summaryrefslogtreecommitdiff
path: root/spec/ruby/library/cgi/htmlextension/radio_group_spec.rb
blob: 1bfd43449d70c9dcf2ab09624b5d592632059504 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require_relative '../../../spec_helper'
require 'cgi'
require_relative 'fixtures/common'

describe "CGI::HtmlExtension#radio_group" do
  before :each do
    @html = CGISpecs.cgi_new
  end

  describe "when passed name, values ..." do
    it "returns a sequence of 'radio'-elements with the passed name and the passed values" do
      output = CGISpecs.split(@html.radio_group("test", "foo", "bar", "baz"))
      output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
    end

    it "allows passing a value inside an Array" do
      output = CGISpecs.split(@html.radio_group("test", ["foo"], "bar", ["baz"]))
      output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
    end

    it "allows passing a value as an Array containing the value and the checked state or a label" do
      output = CGISpecs.split(@html.radio_group("test", ["foo"], ["bar", true], ["baz", "label for baz"]))
      output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "label for baz", not_closed: true)
    end

    # TODO: CGI does not like passing false instead of true.
    it "allows passing a value as an Array containing the value, a label and the checked state" do
      output = CGISpecs.split(@html.radio_group("test", ["foo", "label for foo", true], ["bar", "label for bar", false], ["baz", "label for baz", true]))
      output[0].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "label for foo", not_closed: true)
      output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "label for bar", not_closed: true)
      output[2].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "label for baz", not_closed: true)
    end

    it "returns an empty String when passed no values" do
      @html.radio_group("test").should == ""
    end

    it "ignores a passed block" do
      output = CGISpecs.split(@html.radio_group("test", "foo", "bar", "baz") { "test" })
      output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
    end
  end

  describe "when passed Hash" do
    it "uses the passed Hash to generate the radio sequence" do
      output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]))
      output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)

      output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => [["foo"], ["bar", true], "baz"]))
      output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)

      output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]))
      output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "1"}, "Foo", not_closed: true)
      output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "radio", "VALUE" => "2"}, "Bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "Baz"}, "Baz", not_closed: true)
    end

    it "ignores a passed block" do
      output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]) { "test" })
      output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
      output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
      output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
    end
  end
end
ss='right'>2
-rw-r--r--array.c972
-rw-r--r--benchmark/bm_app_aobench.rb7
-rw-r--r--benchmark/bm_app_lc_fizzbuzz.rb52
-rw-r--r--benchmark/bm_array_shift.rb14
-rw-r--r--benchmark/bm_hash_aref_dsym.rb4
-rw-r--r--benchmark/bm_hash_aref_dsym_long.rb21
-rw-r--r--benchmark/bm_hash_aref_fix.rb4
-rw-r--r--benchmark/bm_hash_aref_flo.rb4
-rw-r--r--benchmark/bm_hash_aref_miss.rb5
-rw-r--r--benchmark/bm_hash_aref_str.rb4
-rw-r--r--benchmark/bm_hash_aref_sym.rb9
-rw-r--r--benchmark/bm_hash_aref_sym_long.rb13
-rw-r--r--benchmark/bm_hash_flatten.rb9
-rw-r--r--benchmark/bm_hash_ident_flo.rb4
-rw-r--r--benchmark/bm_hash_ident_num.rb4
-rw-r--r--benchmark/bm_hash_ident_obj.rb4
-rw-r--r--benchmark/bm_hash_ident_str.rb4
-rw-r--r--benchmark/bm_hash_ident_sym.rb4
-rw-r--r--benchmark/bm_hash_keys.rb9
-rw-r--r--benchmark/bm_hash_shift_u16.rb10
-rw-r--r--benchmark/bm_hash_shift_u24.rb10
-rw-r--r--benchmark/bm_hash_shift_u32.rb10
-rw-r--r--benchmark/bm_hash_to_proc.rb9
-rw-r--r--benchmark/bm_hash_values.rb9
-rw-r--r--benchmark/bm_io_nonblock_noex.rb22
-rw-r--r--benchmark/bm_io_nonblock_noex2.rb21
-rw-r--r--benchmark/bm_marshal_dump_flo.rb2
-rw-r--r--benchmark/bm_marshal_dump_load_geniv.rb10
-rw-r--r--benchmark/bm_marshal_dump_load_time.rb1
-rw-r--r--benchmark/bm_require.rb7
-rw-r--r--benchmark/bm_require_thread.rb15
-rw-r--r--benchmark/bm_securerandom.rb5
-rw-r--r--benchmark/bm_so_meteor_contest.rb14
-rw-r--r--benchmark/bm_vm1_gc_wb_ary.rb10
-rw-r--r--benchmark/bm_vm1_gc_wb_ary_promoted.rb14
-rw-r--r--benchmark/bm_vm1_gc_wb_obj.rb10
-rw-r--r--benchmark/bm_vm1_gc_wb_obj_promoted.rb17
-rw-r--r--benchmark/bm_vm2_case_lit.rb19
-rw-r--r--benchmark/bm_vm2_newlambda.rb5
-rw-r--r--benchmark/bm_vm2_string_literal.rb5
-rw-r--r--benchmark/bm_vm2_struct_big_aref_hi.rb7
-rw-r--r--benchmark/bm_vm2_struct_big_aref_lo.rb7
-rw-r--r--benchmark/bm_vm2_struct_big_aset.rb7
-rw-r--r--benchmark/bm_vm2_struct_big_href_hi.rb7
-rw-r--r--benchmark/bm_vm2_struct_big_href_lo.rb7
-rw-r--r--benchmark/bm_vm2_struct_big_hset.rb7
-rw-r--r--benchmark/bm_vm2_struct_small_aref.rb7
-rw-r--r--benchmark/bm_vm2_struct_small_aset.rb7
-rw-r--r--benchmark/bm_vm2_struct_small_href.rb7
-rw-r--r--benchmark/bm_vm2_struct_small_hset.rb7
-rwxr-xr-x[-rw-r--r--]benchmark/bm_vm3_gc.rb1
-rw-r--r--benchmark/bm_vm_symbol_block_pass.rb13
-rw-r--r--benchmark/bm_vm_thread_close.rb6
-rw-r--r--benchmark/bm_vm_thread_pipe.rb2
-rw-r--r--benchmark/driver.rb121
-rw-r--r--benchmark/gc/gcbench.rb2
-rw-r--r--benchmark/prepare_require.rb25
-rw-r--r--benchmark/prepare_require_thread.rb2
-rw-r--r--benchmark/prepare_so_k_nucleotide.rb2
-rw-r--r--benchmark/prepare_so_reverse_complement.rb2
-rw-r--r--bignum.c715
-rwxr-xr-xbin/erb34
-rwxr-xr-xbin/rake33
-rwxr-xr-xbin/testrb3
-rwxr-xr-xbootstraptest/runner.rb58
-rw-r--r--bootstraptest/test_block.rb14
-rw-r--r--bootstraptest/test_fork.rb30
-rw-r--r--bootstraptest/test_io.rb14
-rw-r--r--bootstraptest/test_literal.rb2
-rw-r--r--bootstraptest/test_method.rb36
-rw-r--r--bootstraptest/test_string.rb3
-rw-r--r--bootstraptest/test_syntax.rb2
-rw-r--r--bootstraptest/test_thread.rb60
-rw-r--r--ccan/build_assert/build_assert.h40
-rw-r--r--ccan/check_type/check_type.h63
-rw-r--r--ccan/container_of/container_of.h142
-rw-r--r--ccan/licenses/BSD-MIT17
-rw-r--r--ccan/licenses/CC028
-rw-r--r--ccan/list/list.h773
-rw-r--r--ccan/str/str.h16
-rw-r--r--class.c709
-rw-r--r--common.mk2068
-rw-r--r--compar.c48
-rw-r--r--compile.c4613
-rw-r--r--complex.c266
-rw-r--r--configure.in1439
-rw-r--r--constant.h22
-rw-r--r--cont.c610
-rw-r--r--coverage/README17
-rw-r--r--cygwin/GNUmakefile.in16
-rw-r--r--debug.c56
-rw-r--r--defs/default_gems5
-rw-r--r--defs/gmake.mk63
-rw-r--r--defs/id.def73
-rw-r--r--defs/keywords6
-rw-r--r--defs/known_errors.def3
-rw-r--r--defs/lex.c.src6
-rw-r--r--defs/opt_operand.def2
-rw-r--r--dir.c751
-rw-r--r--dln.c161
-rw-r--r--dln_find.c21
-rw-r--r--dmyenc.c10
-rw-r--r--dmyext.c5
-rw-r--r--doc/ChangeLog-0.06_to_0.521147
-rw-r--r--doc/ChangeLog-0.50_to_0.60462
-rw-r--r--doc/ChangeLog-0.60_to_1.13955
-rw-r--r--doc/ChangeLog-1.8.06
-rw-r--r--doc/ChangeLog-1.9.338
-rw-r--r--doc/ChangeLog-2.1.018060
-rw-r--r--doc/ChangeLog-2.2.012157
-rw-r--r--doc/ChangeLog-YARV188
-rw-r--r--doc/NEWS-1.8.74
-rw-r--r--doc/NEWS-2.0.02
-rw-r--r--doc/NEWS-2.1.0376
-rw-r--r--doc/NEWS-2.2.0361
-rw-r--r--doc/contributing.rdoc149
-rw-r--r--doc/contributors.rdoc778
-rw-r--r--doc/dtrace_probes.rdoc178
-rw-r--r--doc/etc.rd.ja4
-rw-r--r--doc/extension.ja.rdoc1799
-rw-r--r--doc/extension.rdoc1828
-rw-r--r--doc/forwardable.rd.ja6
-rw-r--r--doc/globals.rdoc3
-rw-r--r--doc/irb/irb-tools.rd.ja10
-rw-r--r--doc/keywords.rdoc158
-rw-r--r--doc/maintainers.rdoc320
-rw-r--r--doc/pty/README.ja2
-rw-r--r--doc/regexp.rdoc16
-rw-r--r--doc/security.rdoc36
-rw-r--r--doc/shell.rd.ja8
-rw-r--r--doc/standard_library.rdoc13
-rw-r--r--doc/syntax/assignment.rdoc19
-rw-r--r--doc/syntax/calling_methods.rdoc27
-rw-r--r--doc/syntax/control_expressions.rdoc27
-rw-r--r--doc/syntax/exceptions.rdoc7
-rw-r--r--doc/syntax/literals.rdoc81
-rw-r--r--doc/syntax/methods.rdoc85
-rw-r--r--doc/syntax/miscellaneous.rdoc11
-rw-r--r--doc/syntax/modules_and_classes.rdoc9
-rw-r--r--doc/syntax/refinements.rdoc74
-rw-r--r--enc/Makefile.in6
-rw-r--r--enc/ascii.c6
-rw-r--r--enc/big5.c6
-rw-r--r--enc/depend462
-rw-r--r--enc/ebcdic.h11
-rw-r--r--enc/encdb.c9
-rw-r--r--enc/encinit.c.erb17
-rw-r--r--enc/euc_jp.c49
-rw-r--r--enc/iso_2022_jp.h2
-rw-r--r--enc/iso_8859_1.c12
-rw-r--r--enc/iso_8859_10.c4
-rw-r--r--enc/iso_8859_13.c8
-rw-r--r--enc/iso_8859_14.c4
-rw-r--r--enc/iso_8859_15.c4
-rw-r--r--enc/iso_8859_16.c4
-rw-r--r--enc/iso_8859_2.c12
-rw-r--r--enc/iso_8859_3.c4
-rw-r--r--enc/iso_8859_4.c5
-rw-r--r--enc/iso_8859_5.c4
-rw-r--r--enc/iso_8859_7.c4
-rw-r--r--enc/iso_8859_9.c4
-rw-r--r--enc/jis/props.h227
-rw-r--r--enc/jis/props.h.blt227
-rw-r--r--enc/jis/props.kwd52
-rw-r--r--enc/jis/props.src52
-rw-r--r--enc/koi8_r.c4
-rw-r--r--enc/koi8_u.c4
-rwxr-xr-xenc/make_encmake.rb25
-rw-r--r--enc/prelude.rb8
-rw-r--r--enc/shift_jis.c47
-rw-r--r--enc/trans/JIS/JISX0201-KANA%UCS.src51
-rw-r--r--enc/trans/JIS/JISX0208@1990%UCS.src54
-rw-r--r--enc/trans/JIS/JISX0212%UCS.src62
-rw-r--r--enc/trans/JIS/UCS%JISX0201-KANA.src52
-rw-r--r--enc/trans/JIS/UCS%JISX0208@1990.src53
-rw-r--r--enc/trans/JIS/UCS%JISX0212.src61
-rw-r--r--enc/trans/ebcdic.trans278
-rw-r--r--enc/trans/escape.trans6
-rw-r--r--enc/trans/euckr-tbl.rb2
-rw-r--r--enc/trans/gb18030.trans8
-rw-r--r--enc/unicode.c193
-rwxr-xr-xenc/unicode/case-folding.rb196
-rw-r--r--enc/unicode/casefold.h8460
-rw-r--r--enc/unicode/name2ctype.h11629
-rw-r--r--enc/unicode/name2ctype.h.blt9915
-rw-r--r--enc/us_ascii.c12
-rw-r--r--enc/utf_16_32.h2
-rw-r--r--enc/utf_16be.c6
-rw-r--r--enc/utf_16le.c6
-rw-r--r--enc/utf_32be.c18
-rw-r--r--enc/utf_32le.c18
-rw-r--r--enc/utf_7.h2
-rw-r--r--enc/utf_8.c31
-rw-r--r--enc/windows_1250.c220
-rw-r--r--enc/windows_1251.c4
-rw-r--r--enc/windows_1252.c211
-rw-r--r--encindex.h67
-rw-r--r--encoding.c288
-rw-r--r--enum.c1351
-rw-r--r--enumerator.c145
-rw-r--r--error.c626
-rw-r--r--eval.c516
-rw-r--r--eval_error.c110
-rw-r--r--eval_intern.h158
-rw-r--r--eval_jump.c13
-rw-r--r--ext/-test-/array/resize/extconf.rb1
-rw-r--r--ext/-test-/bignum/big2str.c1
-rw-r--r--ext/-test-/bignum/bigzero.c6
-rw-r--r--ext/-test-/bignum/depend107
-rw-r--r--ext/-test-/bignum/div.c1
-rw-r--r--ext/-test-/bignum/extconf.rb1
-rw-r--r--ext/-test-/bignum/intpack.c5
-rw-r--r--ext/-test-/bignum/mul.c5
-rw-r--r--ext/-test-/bignum/str2big.c1
-rw-r--r--ext/-test-/bug-3571/bug.c2
-rw-r--r--ext/-test-/bug-3571/extconf.rb1
-rw-r--r--ext/-test-/bug-3662/bug.c (renamed from ext/-test-/notimplement/bug.c)2
-rw-r--r--ext/-test-/bug-3662/extconf.rb1
-rw-r--r--ext/-test-/bug-5832/extconf.rb1
-rw-r--r--ext/-test-/bug_reporter/extconf.rb1
-rw-r--r--ext/-test-/class/extconf.rb1
-rw-r--r--ext/-test-/debug/depend35
-rw-r--r--ext/-test-/debug/extconf.rb1
-rw-r--r--ext/-test-/dln/empty/empty.c4
-rw-r--r--ext/-test-/dln/empty/extconf.rb2
-rw-r--r--ext/-test-/exception/dataerror.c31
-rw-r--r--ext/-test-/exception/depend46
-rw-r--r--ext/-test-/exception/extconf.rb1
-rw-r--r--ext/-test-/fatal/extconf.rb1
-rw-r--r--ext/-test-/file/depend38
-rw-r--r--ext/-test-/file/extconf.rb16
-rw-r--r--ext/-test-/file/fs.c108
-rw-r--r--ext/-test-/float/depend3
-rw-r--r--ext/-test-/float/extconf.rb8
-rw-r--r--ext/-test-/float/init.c11
-rw-r--r--ext/-test-/float/nextafter.c36
-rw-r--r--ext/-test-/funcall/extconf.rb1
-rw-r--r--ext/-test-/gvl/call_without_gvl/call_without_gvl.c34
-rw-r--r--ext/-test-/gvl/call_without_gvl/extconf.rb2
-rw-r--r--ext/-test-/hash/delete.c16
-rw-r--r--ext/-test-/hash/extconf.rb8
-rw-r--r--ext/-test-/hash/init.c11
-rw-r--r--ext/-test-/iseq_load/extconf.rb2
-rw-r--r--ext/-test-/iseq_load/iseq_load.c21
-rw-r--r--ext/-test-/iter/break.c4
-rw-r--r--ext/-test-/iter/extconf.rb9
-rw-r--r--ext/-test-/iter/init.c11
-rw-r--r--ext/-test-/iter/yield.c16
-rw-r--r--ext/-test-/load/dot.dot/extconf.rb1
-rw-r--r--ext/-test-/marshal/compat/extconf.rb1
-rw-r--r--ext/-test-/marshal/internal_ivar/extconf.rb2
-rw-r--r--ext/-test-/marshal/internal_ivar/internal_ivar.c39
-rw-r--r--ext/-test-/marshal/usr/extconf.rb1
-rw-r--r--ext/-test-/marshal/usr/usrmarshal.c21
-rw-r--r--ext/-test-/method/extconf.rb1
-rw-r--r--ext/-test-/notimplement/extconf.rb2
-rw-r--r--ext/-test-/num2int/extconf.rb1
-rw-r--r--ext/-test-/old_thread_select/depend4
-rw-r--r--ext/-test-/old_thread_select/extconf.rb4
-rw-r--r--ext/-test-/old_thread_select/old_thread_select.c75
-rw-r--r--ext/-test-/path_to_class/extconf.rb1
-rw-r--r--ext/-test-/popen_deadlock/extconf.rb5
-rw-r--r--ext/-test-/popen_deadlock/infinite_loop_dlsym.c50
-rw-r--r--ext/-test-/postponed_job/extconf.rb1
-rw-r--r--ext/-test-/printf/extconf.rb1
-rw-r--r--ext/-test-/printf/printf.c37
-rw-r--r--ext/-test-/proc/extconf.rb8
-rw-r--r--ext/-test-/proc/init.c11
-rw-r--r--ext/-test-/proc/receiver.c21
-rw-r--r--ext/-test-/proc/super.c27
-rw-r--r--ext/-test-/rational/depend17
-rw-r--r--ext/-test-/rational/extconf.rb1
-rw-r--r--ext/-test-/rational/rat.c1
-rw-r--r--ext/-test-/recursion/extconf.rb3
-rw-r--r--ext/-test-/recursion/recursion.c28
-rw-r--r--ext/-test-/st/foreach/extconf.rb2
-rw-r--r--ext/-test-/st/foreach/foreach.c175
-rw-r--r--ext/-test-/st/numhash/extconf.rb1
-rw-r--r--ext/-test-/st/numhash/numhash.c34
-rw-r--r--ext/-test-/st/update/extconf.rb1
-rw-r--r--ext/-test-/string/coderange.c21
-rw-r--r--ext/-test-/string/cstr.c105
-rw-r--r--ext/-test-/string/depend118
-rw-r--r--ext/-test-/string/enc_associate.c8
-rw-r--r--ext/-test-/string/extconf.rb3
-rw-r--r--ext/-test-/string/fstring.c15
-rw-r--r--ext/-test-/string/nofree.c13
-rw-r--r--ext/-test-/string/normalize.c1
-rw-r--r--ext/-test-/struct/duplicate.c24
-rw-r--r--ext/-test-/struct/extconf.rb8
-rw-r--r--ext/-test-/struct/init.c11
-rw-r--r--ext/-test-/struct/member.c18
-rw-r--r--ext/-test-/symbol/extconf.rb2
-rw-r--r--ext/-test-/symbol/init.c14
-rw-r--r--ext/-test-/symbol/intern.c14
-rw-r--r--ext/-test-/symbol/type.c35
-rw-r--r--ext/-test-/thread_fd_close/depend14
-rw-r--r--ext/-test-/thread_fd_close/extconf.rb2
-rw-r--r--ext/-test-/thread_fd_close/thread_fd_close.c14
-rw-r--r--ext/-test-/time/extconf.rb8
-rw-r--r--ext/-test-/time/init.c11
-rw-r--r--ext/-test-/time/new.c34
-rw-r--r--ext/-test-/tracepoint/depend23
-rw-r--r--ext/-test-/tracepoint/extconf.rb1
-rw-r--r--ext/-test-/tracepoint/gc_hook.c80
-rw-r--r--ext/-test-/tracepoint/tracepoint.c33
-rw-r--r--ext/-test-/typeddata/extconf.rb1
-rw-r--r--ext/-test-/typeddata/typeddata.c24
-rw-r--r--ext/-test-/vm/at_exit.c44
-rw-r--r--ext/-test-/vm/extconf.rb1
-rw-r--r--ext/-test-/wait_for_single_fd/depend18
-rw-r--r--ext/-test-/wait_for_single_fd/extconf.rb1
-rw-r--r--ext/-test-/win32/console/attribute.c56
-rw-r--r--ext/-test-/win32/console/depend1
-rw-r--r--ext/-test-/win32/console/extconf.rb9
-rw-r--r--ext/-test-/win32/console/init.c11
-rw-r--r--ext/-test-/win32/dln/depend9
-rw-r--r--ext/-test-/win32/dln/extconf.rb40
-rw-r--r--ext/-test-/win32/dln/libdlntest.c2
-rw-r--r--ext/-test-/win32/fd_setsize/depend3
-rw-r--r--ext/-test-/win32/fd_setsize/extconf.rb1
-rw-r--r--ext/.document7
-rw-r--r--ext/Setup24
-rw-r--r--ext/Setup.atheos3
-rw-r--r--ext/Setup.emx33
-rw-r--r--ext/Setup.nacl7
-rw-r--r--ext/Setup.nt3
-rw-r--r--ext/bigdecimal/README60
-rw-r--r--ext/bigdecimal/bigdecimal.c678
-rw-r--r--ext/bigdecimal/bigdecimal.gemspec9
-rw-r--r--ext/bigdecimal/bigdecimal.h34
-rw-r--r--ext/bigdecimal/depend14
-rw-r--r--ext/bigdecimal/extconf.rb5
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb3
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb1
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb32
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb1
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb1
-rw-r--r--ext/bigdecimal/sample/linear.rb21
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb22
-rw-r--r--ext/bigdecimal/sample/pi.rb1
-rw-r--r--ext/cgi/escape/escape.c105
-rw-r--r--ext/cgi/escape/extconf.rb3
-rw-r--r--ext/continuation/continuation.c5
-rw-r--r--ext/continuation/extconf.rb1
-rw-r--r--ext/coverage/coverage.c42
-rw-r--r--ext/coverage/depend32
-rw-r--r--ext/coverage/extconf.rb1
-rw-r--r--ext/curses/curses.c4348
-rw-r--r--ext/curses/depend5
-rw-r--r--ext/curses/extconf.rb141
-rw-r--r--ext/date/date_core.c515
-rw-r--r--ext/date/date_parse.c38
-rw-r--r--ext/date/date_strftime.c9
-rw-r--r--ext/date/date_strptime.c18
-rw-r--r--ext/date/depend58
-rw-r--r--ext/date/extconf.rb2
-rw-r--r--ext/date/lib/date.rb18
-rw-r--r--ext/date/lib/date/format.rb1
-rw-r--r--ext/dbm/dbm.c63
-rw-r--r--ext/dbm/extconf.rb18
-rw-r--r--ext/digest/bubblebabble/bubblebabble.c4
-rw-r--r--ext/digest/bubblebabble/depend14
-rw-r--r--ext/digest/bubblebabble/extconf.rb2
-rw-r--r--ext/digest/depend14
-rw-r--r--ext/digest/digest.c48
-rw-r--r--ext/digest/digest.h25
-rw-r--r--ext/digest/digest_conf.rb30
-rw-r--r--ext/digest/extconf.rb1
-rw-r--r--ext/digest/lib/digest.rb25
-rw-r--r--ext/digest/lib/digest/hmac.rb302
-rw-r--r--ext/digest/md5/depend17
-rw-r--r--ext/digest/md5/extconf.rb15
-rw-r--r--ext/digest/md5/md5.c10
-rw-r--r--ext/digest/md5/md5.h6
-rw-r--r--ext/digest/md5/md5cc.h12
-rw-r--r--ext/digest/md5/md5init.c15
-rw-r--r--ext/digest/md5/md5ossl.c9
-rw-r--r--ext/digest/md5/md5ossl.h4
-rw-r--r--ext/digest/rmd160/depend29
-rw-r--r--ext/digest/rmd160/extconf.rb14
-rw-r--r--ext/digest/rmd160/rmd160.c6
-rw-r--r--ext/digest/rmd160/rmd160.h6
-rw-r--r--ext/digest/rmd160/rmd160init.c13
-rw-r--r--ext/digest/rmd160/rmd160ossl.c8
-rw-r--r--ext/digest/rmd160/rmd160ossl.h3
-rw-r--r--ext/digest/sha1/depend29
-rw-r--r--ext/digest/sha1/extconf.rb14
-rw-r--r--ext/digest/sha1/sha1.c6
-rw-r--r--ext/digest/sha1/sha1.h6
-rw-r--r--ext/digest/sha1/sha1cc.h14
-rw-r--r--ext/digest/sha1/sha1init.c15
-rw-r--r--ext/digest/sha1/sha1ossl.c10
-rw-r--r--ext/digest/sha1/sha1ossl.h4
-rw-r--r--ext/digest/sha2/depend29
-rw-r--r--ext/digest/sha2/extconf.rb20
-rw-r--r--ext/digest/sha2/lib/sha2.rb1
-rw-r--r--ext/digest/sha2/sha2.c28
-rw-r--r--ext/digest/sha2/sha2.h30
-rw-r--r--ext/digest/sha2/sha2cc.h31
-rw-r--r--ext/digest/sha2/sha2init.c13
-rw-r--r--ext/digest/sha2/sha2ossl.c13
-rw-r--r--ext/digest/sha2/sha2ossl.h16
-rw-r--r--ext/dl/callback/depend15
-rw-r--r--ext/dl/callback/extconf.rb14
-rw-r--r--ext/dl/callback/mkcallback.rb242
-rw-r--r--ext/dl/cfunc.c677
-rw-r--r--ext/dl/cptr.c670
-rw-r--r--ext/dl/depend14
-rw-r--r--ext/dl/dl.c569
-rw-r--r--ext/dl/dl.h217
-rw-r--r--ext/dl/extconf.rb43
-rw-r--r--ext/dl/handle.c430
-rw-r--r--ext/dl/lib/dl.rb15
-rw-r--r--ext/dl/lib/dl/callback.rb112
-rw-r--r--ext/dl/lib/dl/cparser.rb156
-rw-r--r--ext/dl/lib/dl/func.rb251
-rw-r--r--ext/dl/lib/dl/import.rb268
-rw-r--r--ext/dl/lib/dl/pack.rb128
-rw-r--r--ext/dl/lib/dl/stack.rb116
-rw-r--r--ext/dl/lib/dl/struct.rb236
-rw-r--r--ext/dl/lib/dl/types.rb71
-rw-r--r--ext/dl/lib/dl/value.rb114
-rw-r--r--ext/etc/depend8
-rw-r--r--ext/etc/etc.c416
-rw-r--r--ext/etc/extconf.rb60
-rw-r--r--ext/etc/mkconstants.rb332
-rwxr-xr-xext/extmk.rb122
-rw-r--r--ext/fcntl/extconf.rb1
-rw-r--r--ext/fcntl/fcntl.c2
-rw-r--r--ext/fiber/extconf.rb1
-rw-r--r--ext/fiddle/closure.c102
-rw-r--r--ext/fiddle/closure.h2
-rw-r--r--ext/fiddle/conversions.h4
-rw-r--r--ext/fiddle/depend55
-rw-r--r--ext/fiddle/extconf.rb149
-rw-r--r--ext/fiddle/extlibs2
-rw-r--r--ext/fiddle/fiddle.c4
-rw-r--r--ext/fiddle/fiddle.h5
-rw-r--r--ext/fiddle/function.c147
-rw-r--r--ext/fiddle/function.h2
-rw-r--r--ext/fiddle/handle.c26
-rw-r--r--ext/fiddle/lib/fiddle.rb1
-rw-r--r--ext/fiddle/lib/fiddle/closure.rb1
-rw-r--r--ext/fiddle/lib/fiddle/cparser.rb158
-rw-r--r--ext/fiddle/lib/fiddle/function.rb1
-rw-r--r--ext/fiddle/lib/fiddle/import.rb5
-rw-r--r--ext/fiddle/lib/fiddle/pack.rb1
-rw-r--r--ext/fiddle/lib/fiddle/struct.rb1
-rw-r--r--ext/fiddle/lib/fiddle/types.rb1
-rw-r--r--ext/fiddle/lib/fiddle/value.rb1
-rw-r--r--ext/fiddle/pointer.c18
-rwxr-xr-xext/fiddle/win32/fficonfig.h29
-rw-r--r--ext/fiddle/win32/libffi-3.2.1-mswin.patch191
-rwxr-xr-xext/fiddle/win32/libffi-config.rb48
-rwxr-xr-xext/fiddle/win32/libffi.mk.tmpl96
-rw-r--r--ext/gdbm/extconf.rb12
-rw-r--r--ext/gdbm/gdbm.c53
-rwxr-xr-xext/io/console/buildgem.sh5
-rw-r--r--ext/io/console/console.c347
-rw-r--r--ext/io/console/depend21
-rw-r--r--ext/io/console/extconf.rb23
-rw-r--r--ext/io/console/io-console.gemspec8
-rw-r--r--ext/io/console/lib/console/size.rb1
-rw-r--r--ext/io/console/win32_vk.chksum1
-rw-r--r--ext/io/console/win32_vk.inc1400
-rw-r--r--ext/io/console/win32_vk.list166
-rw-r--r--ext/io/nonblock/extconf.rb1
-rw-r--r--ext/io/nonblock/nonblock.c15
-rw-r--r--ext/io/wait/extconf.rb1
-rw-r--r--ext/io/wait/wait.c94
-rw-r--r--ext/json/extconf.rb1
-rw-r--r--ext/json/fbuffer/fbuffer.h11
-rw-r--r--ext/json/generator/depend20
-rw-r--r--ext/json/generator/extconf.rb1
-rw-r--r--ext/json/generator/generator.c85
-rw-r--r--ext/json/generator/generator.h29
-rw-r--r--ext/json/json.gemspec7
-rw-r--r--ext/json/lib/json.rb1
-rw-r--r--ext/json/lib/json/add/bigdecimal.rb1
-rw-r--r--ext/json/lib/json/add/complex.rb7
-rw-r--r--ext/json/lib/json/add/core.rb1
-rw-r--r--ext/json/lib/json/add/date.rb2
-rw-r--r--ext/json/lib/json/add/date_time.rb2
-rw-r--r--ext/json/lib/json/add/exception.rb2
-rw-r--r--ext/json/lib/json/add/ostruct.rb2
-rw-r--r--ext/json/lib/json/add/range.rb2
-rw-r--r--ext/json/lib/json/add/rational.rb6
-rw-r--r--ext/json/lib/json/add/regexp.rb2
-rw-r--r--ext/json/lib/json/add/struct.rb2
-rw-r--r--ext/json/lib/json/add/symbol.rb2
-rw-r--r--ext/json/lib/json/add/time.rb4
-rw-r--r--ext/json/lib/json/common.rb11
-rw-r--r--ext/json/lib/json/ext.rb1
-rw-r--r--ext/json/lib/json/generic_object.rb9
-rw-r--r--ext/json/lib/json/version.rb3
-rw-r--r--ext/json/parser/depend19
-rw-r--r--ext/json/parser/extconf.rb3
-rw-r--r--ext/json/parser/parser.c360
-rw-r--r--ext/json/parser/parser.h23
-rw-r--r--ext/json/parser/parser.rl132
-rw-r--r--ext/json/parser/prereq.mk3
-rw-r--r--ext/mathn/complex/extconf.rb1
-rw-r--r--ext/mathn/rational/extconf.rb1
-rw-r--r--ext/nkf/depend28
-rw-r--r--ext/nkf/extconf.rb1
-rw-r--r--ext/nkf/lib/kconv.rb1
-rw-r--r--ext/nkf/nkf-utf8/nkf.c37
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c2
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.h2
-rw-r--r--ext/nkf/nkf.c2
-rw-r--r--ext/objspace/depend80
-rw-r--r--ext/objspace/extconf.rb2
-rw-r--r--ext/objspace/gc_hook.c103
-rw-r--r--ext/objspace/object_tracing.c16
-rw-r--r--ext/objspace/objspace.c299
-rw-r--r--ext/objspace/objspace_dump.c122
-rw-r--r--ext/openssl/depend1097
-rw-r--r--ext/openssl/deprecation.rb1
-rw-r--r--ext/openssl/extconf.rb15
-rw-r--r--ext/openssl/lib/openssl.rb9
-rw-r--r--ext/openssl/lib/openssl/bn.rb17
-rw-r--r--ext/openssl/lib/openssl/buffering.rb29
-rw-r--r--ext/openssl/lib/openssl/cipher.rb10
-rw-r--r--ext/openssl/lib/openssl/config.rb3
-rw-r--r--ext/openssl/lib/openssl/digest.rb33
-rw-r--r--ext/openssl/lib/openssl/pkey.rb37
-rw-r--r--ext/openssl/lib/openssl/ssl.rb270
-rw-r--r--ext/openssl/lib/openssl/x509.rb32
-rw-r--r--ext/openssl/openssl_missing.c18
-rw-r--r--ext/openssl/openssl_missing.h13
-rw-r--r--ext/openssl/ossl.c88
-rw-r--r--ext/openssl/ossl.h24
-rw-r--r--ext/openssl/ossl_asn1.c61
-rw-r--r--ext/openssl/ossl_asn1.h3
-rw-r--r--ext/openssl/ossl_bio.c8
-rw-r--r--ext/openssl/ossl_bio.h4
-rw-r--r--ext/openssl/ossl_bn.c448
-rw-r--r--ext/openssl/ossl_bn.h4
-rw-r--r--ext/openssl/ossl_cipher.c116
-rw-r--r--ext/openssl/ossl_cipher.h4
-rw-r--r--ext/openssl/ossl_config.c18
-rw-r--r--ext/openssl/ossl_config.h5
-rw-r--r--ext/openssl/ossl_digest.c31
-rw-r--r--ext/openssl/ossl_digest.h4
-rw-r--r--ext/openssl/ossl_engine.c55
-rw-r--r--ext/openssl/ossl_engine.h3
-rw-r--r--ext/openssl/ossl_hmac.c23
-rw-r--r--ext/openssl/ossl_hmac.h3
-rw-r--r--ext/openssl/ossl_ns_spki.c32
-rw-r--r--ext/openssl/ossl_ns_spki.h4
-rw-r--r--ext/openssl/ossl_ocsp.c639
-rw-r--r--ext/openssl/ossl_ocsp.h3
-rw-r--r--ext/openssl/ossl_pkcs12.c40
-rw-r--r--ext/openssl/ossl_pkcs12.h4
-rw-r--r--ext/openssl/ossl_pkcs5.c3
-rw-r--r--ext/openssl/ossl_pkcs7.c127
-rw-r--r--ext/openssl/ossl_pkcs7.h4
-rw-r--r--ext/openssl/ossl_pkey.c41
-rw-r--r--ext/openssl/ossl_pkey.h14
-rw-r--r--ext/openssl/ossl_pkey_dh.c88
-rw-r--r--ext/openssl/ossl_pkey_dsa.c24
-rw-r--r--ext/openssl/ossl_pkey_ec.c74
-rw-r--r--ext/openssl/ossl_pkey_rsa.c32
-rw-r--r--ext/openssl/ossl_rand.c108
-rw-r--r--ext/openssl/ossl_rand.h4
-rw-r--r--ext/openssl/ossl_ssl.c718
-rw-r--r--ext/openssl/ossl_ssl.h14
-rw-r--r--ext/openssl/ossl_ssl_session.c37
-rw-r--r--ext/openssl/ossl_version.h3
-rw-r--r--ext/openssl/ossl_x509.c6
-rw-r--r--ext/openssl/ossl_x509.h5
-rw-r--r--ext/openssl/ossl_x509attr.c53
-rw-r--r--ext/openssl/ossl_x509cert.c82
-rw-r--r--ext/openssl/ossl_x509crl.c52
-rw-r--r--ext/openssl/ossl_x509ext.c112
-rw-r--r--ext/openssl/ossl_x509name.c40
-rw-r--r--ext/openssl/ossl_x509req.c44
-rw-r--r--ext/openssl/ossl_x509revoked.c44
-rw-r--r--ext/openssl/ossl_x509store.c73
-rw-r--r--ext/openssl/ruby_missing.h3
-rw-r--r--ext/pathname/extconf.rb2
-rw-r--r--ext/pathname/lib/pathname.rb50
-rw-r--r--ext/pathname/pathname.c27
-rw-r--r--ext/psych/extconf.rb1
-rw-r--r--ext/psych/lib/psych.rb37
-rw-r--r--ext/psych/lib/psych/class_loader.rb1
-rw-r--r--ext/psych/lib/psych/coder.rb1
-rw-r--r--ext/psych/lib/psych/core_ext.rb1
-rw-r--r--ext/psych/lib/psych/deprecated.rb1
-rw-r--r--ext/psych/lib/psych/exception.rb1
-rw-r--r--ext/psych/lib/psych/handler.rb1
-rw-r--r--ext/psych/lib/psych/handlers/document_stream.rb1
-rw-r--r--ext/psych/lib/psych/handlers/recorder.rb1
-rw-r--r--ext/psych/lib/psych/json/ruby_events.rb1
-rw-r--r--ext/psych/lib/psych/json/stream.rb1
-rw-r--r--ext/psych/lib/psych/json/tree_builder.rb1
-rw-r--r--ext/psych/lib/psych/json/yaml_events.rb1
-rw-r--r--ext/psych/lib/psych/nodes.rb1
-rw-r--r--ext/psych/lib/psych/nodes/alias.rb1
-rw-r--r--ext/psych/lib/psych/nodes/document.rb1
-rw-r--r--ext/psych/lib/psych/nodes/mapping.rb1
-rw-r--r--ext/psych/lib/psych/nodes/node.rb1
-rw-r--r--ext/psych/lib/psych/nodes/scalar.rb1
-rw-r--r--ext/psych/lib/psych/nodes/sequence.rb3
-rw-r--r--ext/psych/lib/psych/nodes/stream.rb1
-rw-r--r--ext/psych/lib/psych/omap.rb1
-rw-r--r--ext/psych/lib/psych/parser.rb1
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb7
-rw-r--r--ext/psych/lib/psych/set.rb1
-rw-r--r--ext/psych/lib/psych/stream.rb1
-rw-r--r--ext/psych/lib/psych/streaming.rb1
-rw-r--r--ext/psych/lib/psych/syntax_error.rb1
-rw-r--r--ext/psych/lib/psych/tree_builder.rb1
-rw-r--r--ext/psych/lib/psych/versions.rb4
-rw-r--r--ext/psych/lib/psych/visitors.rb1
-rw-r--r--ext/psych/lib/psych/visitors/depth_first.rb1
-rw-r--r--ext/psych/lib/psych/visitors/emitter.rb1
-rw-r--r--ext/psych/lib/psych/visitors/json_tree.rb1
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb54
-rw-r--r--ext/psych/lib/psych/visitors/visitor.rb1
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb202
-rw-r--r--ext/psych/lib/psych/y.rb1
-rw-r--r--ext/psych/lib/psych_jars.rb6
-rw-r--r--ext/psych/psych.c2
-rw-r--r--ext/psych/psych.gemspec38
-rw-r--r--ext/psych/psych_emitter.c90
-rw-r--r--ext/psych/psych_emitter.h2
-rw-r--r--ext/psych/psych_parser.c28
-rw-r--r--ext/psych/psych_parser.h2
-rw-r--r--ext/psych/yaml/api.c2
-rw-r--r--ext/psych/yaml/config.h13
-rw-r--r--ext/psych/yaml/emitter.c14
-rw-r--r--ext/psych/yaml/loader.c16
-rw-r--r--ext/psych/yaml/reader.c4
-rw-r--r--ext/psych/yaml/scanner.c42
-rw-r--r--ext/psych/yaml/yaml_private.h25
-rw-r--r--ext/pty/depend23
-rw-r--r--ext/pty/extconf.rb1
-rw-r--r--ext/pty/lib/expect.rb1
-rw-r--r--ext/pty/pty.c42
-rw-r--r--ext/racc/cparse/README3
-rw-r--r--ext/racc/cparse/cparse.c62
-rw-r--r--ext/racc/cparse/extconf.rb1
-rw-r--r--ext/rbconfig/sizeof/depend18
-rw-r--r--ext/rbconfig/sizeof/extconf.rb34
-rw-r--r--ext/readline/depend22
-rw-r--r--ext/readline/extconf.rb14
-rw-r--r--ext/readline/readline.c71
-rw-r--r--ext/ripper/depend45
-rw-r--r--ext/ripper/eventids2.c523
-rw-r--r--ext/ripper/extconf.rb1
-rw-r--r--ext/ripper/lib/ripper.rb1
-rw-r--r--ext/ripper/lib/ripper/core.rb22
-rw-r--r--ext/ripper/lib/ripper/filter.rb1
-rw-r--r--ext/ripper/lib/ripper/lexer.rb54
-rw-r--r--ext/ripper/lib/ripper/sexp.rb98
-rwxr-xr-xext/ripper/tools/generate-param-macros.rb1
-rwxr-xr-xext/ripper/tools/generate.rb34
-rwxr-xr-xext/ripper/tools/preproc.rb1
-rwxr-xr-xext/ripper/tools/strip.rb1
-rw-r--r--ext/sdbm/_sdbm.c17
-rw-r--r--ext/sdbm/depend21
-rw-r--r--ext/sdbm/extconf.rb1
-rw-r--r--ext/sdbm/init.c57
-rw-r--r--ext/socket/ancdata.c308
-rw-r--r--ext/socket/basicsocket.c113
-rw-r--r--ext/socket/constants.c2
-rw-r--r--ext/socket/depend312
-rw-r--r--ext/socket/extconf.rb93
-rw-r--r--ext/socket/getaddrinfo.c15
-rw-r--r--ext/socket/getnameinfo.c27
-rw-r--r--ext/socket/ifaddr.c28
-rw-r--r--ext/socket/init.c421
-rw-r--r--ext/socket/ipsocket.c42
-rw-r--r--ext/socket/lib/socket.rb603
-rw-r--r--ext/socket/mkconstants.rb60
-rw-r--r--ext/socket/option.c477
-rw-r--r--ext/socket/raddrinfo.c264
-rw-r--r--ext/socket/rubysocket.h102
-rw-r--r--ext/socket/socket.c584
-rw-r--r--ext/socket/sockport.h15
-rw-r--r--ext/socket/sockssocket.c3
-rw-r--r--ext/socket/tcpserver.c44
-rw-r--r--ext/socket/tcpsocket.c6
-rw-r--r--ext/socket/udpsocket.c190
-rw-r--r--ext/socket/unixserver.c43
-rw-r--r--ext/socket/unixsocket.c39
-rw-r--r--ext/stringio/extconf.rb1
-rw-r--r--ext/stringio/stringio.c196
-rw-r--r--ext/strscan/depend24
-rw-r--r--ext/strscan/extconf.rb1
-rw-r--r--ext/strscan/strscan.c123
-rw-r--r--ext/syslog/depend14
-rw-r--r--ext/syslog/extconf.rb1
-rw-r--r--ext/syslog/lib/syslog/logger.rb3
-rw-r--r--ext/syslog/syslog.c14
-rw-r--r--ext/thread/extconf.rb1
-rw-r--r--ext/thread/thread.c573
-rw-r--r--ext/tk/MANUAL_tcltklib.eng14
-rw-r--r--ext/tk/MANUAL_tcltklib.ja12
-rw-r--r--ext/tk/README.macosx-aqua2
-rw-r--r--ext/tk/README.tcltklib2
-rw-r--r--ext/tk/extconf.rb84
-rw-r--r--ext/tk/lib/README2
-rw-r--r--ext/tk/lib/multi-tk.rb35
-rw-r--r--ext/tk/lib/remote-tk.rb9
-rw-r--r--ext/tk/lib/tcltk.rb5
-rw-r--r--ext/tk/lib/tk.rb51
-rw-r--r--ext/tk/lib/tk/after.rb1
-rw-r--r--ext/tk/lib/tk/autoload.rb3
-rw-r--r--ext/tk/lib/tk/bgerror.rb1
-rw-r--r--ext/tk/lib/tk/bindtag.rb1
-rw-r--r--ext/tk/lib/tk/busy.rb1
-rw-r--r--ext/tk/lib/tk/button.rb1
-rw-r--r--ext/tk/lib/tk/canvas.rb3
-rw-r--r--ext/tk/lib/tk/canvastag.rb1
-rw-r--r--ext/tk/lib/tk/checkbutton.rb1
-rw-r--r--ext/tk/lib/tk/clipboard.rb1
-rw-r--r--ext/tk/lib/tk/clock.rb1
-rw-r--r--ext/tk/lib/tk/composite.rb1
-rw-r--r--ext/tk/lib/tk/console.rb1
-rw-r--r--ext/tk/lib/tk/dialog.rb1
-rw-r--r--ext/tk/lib/tk/encodedstr.rb1
-rw-r--r--ext/tk/lib/tk/entry.rb1
-rw-r--r--ext/tk/lib/tk/event.rb1
-rw-r--r--ext/tk/lib/tk/font.rb1
-rw-r--r--ext/tk/lib/tk/fontchooser.rb7
-rw-r--r--ext/tk/lib/tk/frame.rb1
-rw-r--r--ext/tk/lib/tk/grid.rb1
-rw-r--r--ext/tk/lib/tk/image.rb1
-rw-r--r--ext/tk/lib/tk/itemconfig.rb2
-rw-r--r--ext/tk/lib/tk/itemfont.rb1
-rw-r--r--ext/tk/lib/tk/kinput.rb1
-rw-r--r--ext/tk/lib/tk/label.rb1
-rw-r--r--ext/tk/lib/tk/labelframe.rb1
-rw-r--r--ext/tk/lib/tk/listbox.rb1
-rw-r--r--ext/tk/lib/tk/macpkg.rb1
-rw-r--r--ext/tk/lib/tk/menu.rb1
-rw-r--r--ext/tk/lib/tk/menubar.rb3
-rw-r--r--ext/tk/lib/tk/menuspec.rb1
-rw-r--r--ext/tk/lib/tk/message.rb1
-rw-r--r--ext/tk/lib/tk/mngfocus.rb1
-rw-r--r--ext/tk/lib/tk/msgcat.rb42
-rw-r--r--ext/tk/lib/tk/namespace.rb8
-rw-r--r--ext/tk/lib/tk/optiondb.rb7
-rw-r--r--ext/tk/lib/tk/optionobj.rb1
-rw-r--r--ext/tk/lib/tk/pack.rb1
-rw-r--r--ext/tk/lib/tk/package.rb1
-rw-r--r--ext/tk/lib/tk/palette.rb1
-rw-r--r--ext/tk/lib/tk/panedwindow.rb1
-rw-r--r--ext/tk/lib/tk/place.rb1
-rw-r--r--ext/tk/lib/tk/radiobutton.rb1
-rw-r--r--ext/tk/lib/tk/root.rb1
-rw-r--r--ext/tk/lib/tk/scale.rb1
-rw-r--r--ext/tk/lib/tk/scrollable.rb1
-rw-r--r--ext/tk/lib/tk/scrollbar.rb1
-rw-r--r--ext/tk/lib/tk/scrollbox.rb1
-rw-r--r--ext/tk/lib/tk/selection.rb1
-rw-r--r--ext/tk/lib/tk/spinbox.rb1
-rw-r--r--ext/tk/lib/tk/tagfont.rb1
-rw-r--r--ext/tk/lib/tk/text.rb3
-rw-r--r--ext/tk/lib/tk/textimage.rb1
-rw-r--r--ext/tk/lib/tk/textmark.rb1
-rw-r--r--ext/tk/lib/tk/texttag.rb1
-rw-r--r--ext/tk/lib/tk/textwindow.rb1
-rw-r--r--ext/tk/lib/tk/timer.rb5
-rw-r--r--ext/tk/lib/tk/tk_mac.rb159
-rw-r--r--ext/tk/lib/tk/toplevel.rb1
-rw-r--r--ext/tk/lib/tk/ttk_selector.rb1
-rw-r--r--ext/tk/lib/tk/txtwin_abst.rb1
-rw-r--r--ext/tk/lib/tk/validation.rb1
-rw-r--r--ext/tk/lib/tk/variable.rb4
-rw-r--r--ext/tk/lib/tk/virtevent.rb1
-rw-r--r--ext/tk/lib/tk/winfo.rb1
-rw-r--r--ext/tk/lib/tk/winpkg.rb1
-rw-r--r--ext/tk/lib/tk/wm.rb1
-rw-r--r--ext/tk/lib/tk/xim.rb1
-rw-r--r--ext/tk/lib/tkafter.rb1
-rw-r--r--ext/tk/lib/tkbgerror.rb1
-rw-r--r--ext/tk/lib/tkcanvas.rb1
-rw-r--r--ext/tk/lib/tkclass.rb1
-rw-r--r--ext/tk/lib/tkconsole.rb1
-rw-r--r--ext/tk/lib/tkdialog.rb1
-rw-r--r--ext/tk/lib/tkentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/ICONS.rb1
-rw-r--r--ext/tk/lib/tkextlib/ICONS/icons.rb1
-rw-r--r--ext/tk/lib/tkextlib/ICONS/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS9
-rw-r--r--ext/tk/lib/tkextlib/blt.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/barchart.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/bitmap.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/busy.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/component.rb3
-rw-r--r--ext/tk/lib/tkextlib/blt/container.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/cutbuffer.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/dragdrop.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/eps.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/graph.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/htext.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/spline.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/stripchart.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/table.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tabnotebook.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tabset.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/ted.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/button.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/checkbutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/frame.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/label.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/radiobutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/scrollbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/toplevel.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/tree.rb5
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb3
-rw-r--r--ext/tk/lib/tkextlib/blt/unix_dnd.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/vector.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/watch.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/win_printer.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/winop.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/arrowbutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/bitmap.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/button.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/buttonbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/combobox.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dragsite.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dropsite.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dynamichelp.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/entry.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/label.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/mainframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/messagedlg.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/notebook.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/pagesmanager.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panedwindow.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panelframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/passwddlg.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/progressbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/progressdlg.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollableframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollview.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectcolor.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectfont.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/separator.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/spinbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/statusbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/titleframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb1
-rw-r--r--ext/tk/lib/tkextlib/bwidget/widget.rb1
-rw-r--r--ext/tk/lib/tkextlib/itcl.rb1
-rw-r--r--ext/tk/lib/tkextlib/itcl/incr_tcl.rb1
-rw-r--r--ext/tk/lib/tkextlib/itcl/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/itk.rb1
-rw-r--r--ext/tk/lib/tkextlib/itk/incr_tk.rb1
-rw-r--r--ext/tk/lib/tkextlib/itk/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/combobox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dateentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/datefield.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialogshell.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extbutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/feedback.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/finddialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hierarchy.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/mainwindow.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/menubar.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagebox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagedialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/optionmenu.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/panedwindow.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/promptdialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/pushbutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/radiobox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scopedobject.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb3
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectionbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/shell.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spindate.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinint.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinner.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spintime.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabset.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/timeentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/timefield.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/toolbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/watch.rb1
-rwxr-xr-xext/tk/lib/tkextlib/pkg_checker.rb1
-rw-r--r--ext/tk/lib/tkextlib/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/calendar.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/chatwidget.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/crosshair.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/cursor.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/dateentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/diagrams.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/dialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/getstring.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/history.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ico.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/khim.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/menuentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ntext.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/panelframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb7
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ruler.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/screenruler.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/scrollwin.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/statusbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/style.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/superframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/swaplist.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_core.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb3
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/toolbar.rb3
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tooltip.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/validator.rb66
-rw-r--r--ext/tk/lib/tkextlib/tcllib/widget.rb1
-rw-r--r--ext/tk/lib/tkextlib/tclx.rb1
-rw-r--r--ext/tk/lib/tkextlib/tclx/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tclx/tclx.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/dialog.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/sizegrip.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tcombobox.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabelframe.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tprogressbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb31
-rw-r--r--ext/tk/lib/tkextlib/tile/tscale.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tscrollbar.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tseparator.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tspinbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/tile/tsquare.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkDND.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkDND/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb3
-rw-r--r--ext/tk/lib/tkextlib/tkHTML.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/bmp.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/dted.rb34
-rw-r--r--ext/tk/lib/tkextlib/tkimg/gif.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ico.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/jpeg.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pcx.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pixmap.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/png.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ppm.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ps.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/raw.rb34
-rw-r--r--ext/tk/lib/tkextlib/tkimg/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sgi.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sun.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tga.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tiff.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/window.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xbm.rb1
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xpm.rb1
-rw-r--r--ext/tk/lib/tkextlib/tktable.rb1
-rw-r--r--ext/tk/lib/tkextlib/tktable/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb3
-rw-r--r--ext/tk/lib/tkextlib/tktrans.rb1
-rw-r--r--ext/tk/lib/tkextlib/tktrans/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb1
-rw-r--r--ext/tk/lib/tkextlib/treectrl.rb1
-rw-r--r--ext/tk/lib/tkextlib/treectrl/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb1
-rw-r--r--ext/tk/lib/tkextlib/trofs.rb1
-rw-r--r--ext/tk/lib/tkextlib/trofs/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/trofs/trofs.rb1
-rw-r--r--ext/tk/lib/tkextlib/version.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu/bargraph.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu/charts.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu/dial.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/vu/spinbox.rb1
-rw-r--r--ext/tk/lib/tkextlib/winico.rb1
-rw-r--r--ext/tk/lib/tkextlib/winico/setup.rb1
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb1
-rw-r--r--ext/tk/lib/tkfont.rb1
-rw-r--r--ext/tk/lib/tkmacpkg.rb1
-rw-r--r--ext/tk/lib/tkmenubar.rb1
-rw-r--r--ext/tk/lib/tkmngfocus.rb1
-rw-r--r--ext/tk/lib/tkpalette.rb1
-rw-r--r--ext/tk/lib/tkscrollbox.rb1
-rw-r--r--ext/tk/lib/tktext.rb1
-rw-r--r--ext/tk/lib/tkvirtevent.rb1
-rw-r--r--ext/tk/lib/tkwinpkg.rb1
-rw-r--r--ext/tk/old-extconf.rb1
-rw-r--r--ext/tk/sample/24hr_clock.rb1
-rw-r--r--ext/tk/sample/binding_sample.rb1
-rw-r--r--ext/tk/sample/bindtag_sample.rb1
-rw-r--r--ext/tk/sample/binstr_usage.rb1
-rw-r--r--ext/tk/sample/btn_with_frame.rb1
-rw-r--r--ext/tk/sample/cd_timer.rb1
-rw-r--r--ext/tk/sample/cmd_res_test.rb1
-rw-r--r--ext/tk/sample/demos-en/anilabel.rb1
-rw-r--r--ext/tk/sample/demos-en/aniwave.rb1
-rw-r--r--ext/tk/sample/demos-en/arrow.rb1
-rw-r--r--ext/tk/sample/demos-en/bind.rb1
-rw-r--r--ext/tk/sample/demos-en/bitmap.rb1
-rw-r--r--ext/tk/sample/demos-en/button.rb1
-rw-r--r--ext/tk/sample/demos-en/check.rb1
-rw-r--r--ext/tk/sample/demos-en/check2.rb1
-rw-r--r--ext/tk/sample/demos-en/clrpick.rb1
-rw-r--r--ext/tk/sample/demos-en/colors.rb1
-rw-r--r--ext/tk/sample/demos-en/combo.rb3
-rw-r--r--ext/tk/sample/demos-en/cscroll.rb1
-rw-r--r--ext/tk/sample/demos-en/ctext.rb1
-rw-r--r--ext/tk/sample/demos-en/dialog1.rb1
-rw-r--r--ext/tk/sample/demos-en/dialog2.rb1
-rw-r--r--ext/tk/sample/demos-en/entry1.rb1
-rw-r--r--ext/tk/sample/demos-en/entry2.rb1
-rw-r--r--ext/tk/sample/demos-en/entry3.rb1
-rw-r--r--ext/tk/sample/demos-en/filebox.rb1
-rw-r--r--ext/tk/sample/demos-en/floor.rb1
-rw-r--r--ext/tk/sample/demos-en/floor2.rb1
-rw-r--r--ext/tk/sample/demos-en/form.rb1
-rw-r--r--ext/tk/sample/demos-en/goldberg.rb1
-rw-r--r--ext/tk/sample/demos-en/hscale.rb1
-rw-r--r--ext/tk/sample/demos-en/icon.rb1
-rw-r--r--ext/tk/sample/demos-en/image1.rb1
-rw-r--r--ext/tk/sample/demos-en/image2.rb1
-rw-r--r--ext/tk/sample/demos-en/image3.rb1
-rw-r--r--ext/tk/sample/demos-en/items.rb1
-rw-r--r--ext/tk/sample/demos-en/knightstour.rb1
-rw-r--r--ext/tk/sample/demos-en/label.rb1
-rw-r--r--ext/tk/sample/demos-en/labelframe.rb1
-rw-r--r--ext/tk/sample/demos-en/mclist.rb1
-rw-r--r--ext/tk/sample/demos-en/menu.rb1
-rw-r--r--ext/tk/sample/demos-en/menu84.rb1
-rw-r--r--ext/tk/sample/demos-en/menubu.rb1
-rw-r--r--ext/tk/sample/demos-en/msgbox.rb1
-rw-r--r--ext/tk/sample/demos-en/msgbox2.rb1
-rw-r--r--ext/tk/sample/demos-en/paned1.rb1
-rw-r--r--ext/tk/sample/demos-en/paned2.rb1
-rw-r--r--ext/tk/sample/demos-en/pendulum.rb1
-rw-r--r--ext/tk/sample/demos-en/plot.rb1
-rw-r--r--ext/tk/sample/demos-en/puzzle.rb1
-rw-r--r--ext/tk/sample/demos-en/radio.rb1
-rw-r--r--ext/tk/sample/demos-en/radio2.rb1
-rw-r--r--ext/tk/sample/demos-en/radio3.rb1
-rw-r--r--ext/tk/sample/demos-en/rolodex2
-rw-r--r--ext/tk/sample/demos-en/ruler.rb1
-rw-r--r--ext/tk/sample/demos-en/sayings.rb1
-rw-r--r--ext/tk/sample/demos-en/search.rb1
-rw-r--r--ext/tk/sample/demos-en/spin.rb1
-rw-r--r--ext/tk/sample/demos-en/states.rb1
-rw-r--r--ext/tk/sample/demos-en/style.rb1
-rw-r--r--ext/tk/sample/demos-en/text.rb1
-rw-r--r--ext/tk/sample/demos-en/textpeer.rb1
-rw-r--r--ext/tk/sample/demos-en/tkencoding.rb1
-rw-r--r--ext/tk/sample/demos-en/toolbar.rb1
-rw-r--r--ext/tk/sample/demos-en/tree.rb1
-rw-r--r--ext/tk/sample/demos-en/ttkbut.rb1
-rw-r--r--ext/tk/sample/demos-en/ttkmenu.rb1
-rw-r--r--ext/tk/sample/demos-en/ttknote.rb1
-rw-r--r--ext/tk/sample/demos-en/ttkpane.rb1
-rw-r--r--ext/tk/sample/demos-en/ttkprogress.rb1
-rw-r--r--ext/tk/sample/demos-en/twind.rb1
-rw-r--r--ext/tk/sample/demos-en/twind2.rb1
-rw-r--r--ext/tk/sample/demos-en/unicodeout.rb1
-rw-r--r--ext/tk/sample/demos-en/vscale.rb1
-rw-r--r--ext/tk/sample/demos-jp/anilabel.rb1
-rw-r--r--ext/tk/sample/demos-jp/aniwave.rb1
-rw-r--r--ext/tk/sample/demos-jp/arrow.rb1
-rw-r--r--ext/tk/sample/demos-jp/bind.rb1
-rw-r--r--ext/tk/sample/demos-jp/bitmap.rb1
-rw-r--r--ext/tk/sample/demos-jp/button.rb1
-rw-r--r--ext/tk/sample/demos-jp/check.rb1
-rw-r--r--ext/tk/sample/demos-jp/check2.rb1
-rw-r--r--ext/tk/sample/demos-jp/clrpick.rb1
-rw-r--r--ext/tk/sample/demos-jp/colors.rb1
-rw-r--r--ext/tk/sample/demos-jp/combo.rb1
-rw-r--r--ext/tk/sample/demos-jp/cscroll.rb1
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb1
-rw-r--r--ext/tk/sample/demos-jp/dialog1.rb1
-rw-r--r--ext/tk/sample/demos-jp/dialog2.rb1
-rw-r--r--ext/tk/sample/demos-jp/entry1.rb1
-rw-r--r--ext/tk/sample/demos-jp/entry2.rb1
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb1
-rw-r--r--ext/tk/sample/demos-jp/filebox.rb1
-rw-r--r--ext/tk/sample/demos-jp/floor.rb1
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb1
-rw-r--r--ext/tk/sample/demos-jp/form.rb1
-rw-r--r--ext/tk/sample/demos-jp/goldberg.rb1
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb1
-rw-r--r--ext/tk/sample/demos-jp/icon.rb1
-rw-r--r--ext/tk/sample/demos-jp/image1.rb1
-rw-r--r--ext/tk/sample/demos-jp/image2.rb1
-rw-r--r--ext/tk/sample/demos-jp/image3.rb1
-rw-r--r--ext/tk/sample/demos-jp/items.rb1
-rw-r--r--ext/tk/sample/demos-jp/knightstour.rb1
-rw-r--r--ext/tk/sample/demos-jp/label.rb1
-rw-r--r--ext/tk/sample/demos-jp/labelframe.rb1
-rw-r--r--ext/tk/sample/demos-jp/mclist.rb1
-rw-r--r--ext/tk/sample/demos-jp/menu.rb1
-rw-r--r--ext/tk/sample/demos-jp/menu84.rb1
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb1
-rw-r--r--ext/tk/sample/demos-jp/menubu.rb1
-rw-r--r--ext/tk/sample/demos-jp/msgbox.rb1
-rw-r--r--ext/tk/sample/demos-jp/msgbox2.rb1
-rw-r--r--ext/tk/sample/demos-jp/paned1.rb1
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb1
-rw-r--r--ext/tk/sample/demos-jp/pendulum.rb1
-rw-r--r--ext/tk/sample/demos-jp/plot.rb1
-rw-r--r--ext/tk/sample/demos-jp/puzzle.rb1
-rw-r--r--ext/tk/sample/demos-jp/radio.rb1
-rw-r--r--ext/tk/sample/demos-jp/radio2.rb1
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb1
-rw-r--r--ext/tk/sample/demos-jp/rolodex2
-rw-r--r--ext/tk/sample/demos-jp/ruler.rb1
-rw-r--r--ext/tk/sample/demos-jp/sayings.rb1
-rw-r--r--ext/tk/sample/demos-jp/search.rb1
-rw-r--r--ext/tk/sample/demos-jp/spin.rb1
-rw-r--r--ext/tk/sample/demos-jp/states.rb1
-rw-r--r--ext/tk/sample/demos-jp/style.rb1
-rw-r--r--ext/tk/sample/demos-jp/text.rb1
-rw-r--r--ext/tk/sample/demos-jp/textpeer.rb1
-rw-r--r--ext/tk/sample/demos-jp/toolbar.rb1
-rw-r--r--ext/tk/sample/demos-jp/tree.rb1
-rw-r--r--ext/tk/sample/demos-jp/ttkbut.rb1
-rw-r--r--ext/tk/sample/demos-jp/ttkmenu.rb1
-rw-r--r--ext/tk/sample/demos-jp/ttknote.rb1
-rw-r--r--ext/tk/sample/demos-jp/ttkpane.rb1
-rw-r--r--ext/tk/sample/demos-jp/ttkprogress.rb1
-rw-r--r--ext/tk/sample/demos-jp/twind.rb1
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb1
-rw-r--r--ext/tk/sample/demos-jp/unicodeout.rb1
-rw-r--r--ext/tk/sample/demos-jp/vscale.rb1
-rw-r--r--ext/tk/sample/editable_listbox.rb1
-rw-r--r--ext/tk/sample/encstr_usage.rb1
-rw-r--r--ext/tk/sample/figmemo_sample.rb3
-rw-r--r--ext/tk/sample/irbtk.rb1
-rw-r--r--ext/tk/sample/menubar1.rb3
-rw-r--r--ext/tk/sample/menubar2.rb5
-rw-r--r--ext/tk/sample/menubar3.rb3
-rw-r--r--ext/tk/sample/multi-ip_sample.rb1
-rw-r--r--ext/tk/sample/multi-ip_sample2.rb1
-rw-r--r--ext/tk/sample/optobj_sample.rb1
-rw-r--r--ext/tk/sample/propagate.rb1
-rw-r--r--ext/tk/sample/remote-ip_sample.rb1
-rw-r--r--ext/tk/sample/remote-ip_sample2.rb1
-rw-r--r--[-rwxr-xr-x]ext/tk/sample/safe-tk.rb4
-rw-r--r--ext/tk/sample/scrollframe.rb3
-rw-r--r--ext/tk/sample/tcltklib/lines1.rb1
-rw-r--r--ext/tk/sample/tcltklib/lines2.rb1
-rw-r--r--ext/tk/sample/tcltklib/lines3.rb1
-rw-r--r--ext/tk/sample/tcltklib/lines4.rb1
-rw-r--r--ext/tk/sample/tcltklib/safeTk.rb1
-rw-r--r--ext/tk/sample/tcltklib/sample0.rb1
-rw-r--r--ext/tk/sample/tcltklib/sample1.rb1
-rw-r--r--ext/tk/sample/tcltklib/sample2.rb1
-rw-r--r--ext/tk/sample/tkalignbox.rb1
-rw-r--r--ext/tk/sample/tkballoonhelp.rb1
-rw-r--r--ext/tk/sample/tkbiff.rb1
-rw-r--r--ext/tk/sample/tkbrowse.rb1
-rw-r--r--ext/tk/sample/tkcombobox.rb1
-rw-r--r--ext/tk/sample/tkdialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/ICONS/viewIcons.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/barchart5.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/calendar.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/graph6.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7a.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7b.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7c.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/pareto.rb3
-rw-r--r--ext/tk/sample/tkextlib/blt/plot1.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/plot1b.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/scripts/stipples.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/winop1.rb1
-rw-r--r--ext/tk/sample/tkextlib/blt/winop2.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/basic.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/demo.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/dnd.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/manager.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/select.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tmpldlg.rb1
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tree.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/shell.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb1
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/watch.rb1
-rw-r--r--ext/tk/sample/tkextlib/tcllib/datefield.rb1
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos1.rb1
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos2.rb1
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos3.rb1
-rw-r--r--ext/tk/sample/tkextlib/tcllib/xyplot.rb1
-rw-r--r--ext/tk/sample/tkextlib/tile/demo.rb1
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc.rb1
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/hv.rb1
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/index.html2
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/ss.rb1
-rw-r--r--ext/tk/sample/tkextlib/tkimg/demo.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/basic.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/buttons.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/command.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/debug.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/dynarows.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/maxsize.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/spreadsheet.rb1
-rw-r--r--ext/tk/sample/tkextlib/tktable/valid.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/bitmaps.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/demo.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/explorer.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/help.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/imovie.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/layout.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/mailwasher.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/outlook-folders.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/random.rb1
-rw-r--r--ext/tk/sample/tkextlib/treectrl/www-options.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/canvItems.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker2.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/dial_demo.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/oscilloscope.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/pie.rb1
-rw-r--r--ext/tk/sample/tkextlib/vu/vu_demo.rb1
-rw-r--r--ext/tk/sample/tkfrom.rb1
-rw-r--r--ext/tk/sample/tkhello.rb1
-rw-r--r--ext/tk/sample/tkline.rb1
-rw-r--r--ext/tk/sample/tkmenubutton.rb1
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb.rb1
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb2.rb1
-rw-r--r--ext/tk/sample/tkmsgcat-load_tk.rb1
-rw-r--r--ext/tk/sample/tkmulticolumnlist.rb1
-rw-r--r--ext/tk/sample/tkmultilistbox.rb1
-rw-r--r--ext/tk/sample/tkmultilistframe.rb1
-rw-r--r--[-rwxr-xr-x]ext/tk/sample/tkoptdb-safeTk.rb3
-rw-r--r--ext/tk/sample/tkoptdb.rb1
-rw-r--r--ext/tk/sample/tkrttimer.rb1
-rw-r--r--ext/tk/sample/tksleep_sample.rb1
-rw-r--r--ext/tk/sample/tktextframe.rb1
-rw-r--r--ext/tk/sample/tktextio.rb3
-rw-r--r--ext/tk/sample/tktimer.rb1
-rw-r--r--ext/tk/sample/tktimer2.rb1
-rw-r--r--ext/tk/sample/tktimer3.rb1
-rw-r--r--ext/tk/sample/tktree.rb1
-rw-r--r--ext/tk/sample/ttk_wrapper.rb1
-rw-r--r--ext/tk/stubs.c36
-rw-r--r--ext/tk/stubs.h10
-rw-r--r--ext/tk/tcltklib.c460
-rw-r--r--ext/tk/tkutil/extconf.rb12
-rw-r--r--ext/tk/tkutil/tkutil.c501
-rw-r--r--ext/win32/extconf.rb3
-rw-r--r--ext/win32/lib/Win32API.rb23
-rw-r--r--ext/win32/lib/win32/importer.rb11
-rw-r--r--ext/win32/lib/win32/registry.rb55
-rw-r--r--ext/win32/lib/win32/resolv.rb16
-rw-r--r--ext/win32/lib/win32/sspi.rb1
-rw-r--r--ext/win32ole/depend13
-rw-r--r--ext/win32ole/extconf.rb1
-rw-r--r--ext/win32ole/lib/win32ole/property.rb1
-rw-r--r--ext/win32ole/sample/excel1.rb6
-rw-r--r--ext/win32ole/sample/excel2.rb11
-rw-r--r--ext/win32ole/sample/excel3.rb8
-rw-r--r--ext/win32ole/sample/ie.rb1
-rw-r--r--ext/win32ole/sample/ieconst.rb1
-rw-r--r--ext/win32ole/sample/ienavi.rb1
-rw-r--r--ext/win32ole/sample/ienavi2.rb1
-rw-r--r--ext/win32ole/sample/oledirs.rb1
-rw-r--r--ext/win32ole/sample/olegen.rb9
-rw-r--r--ext/win32ole/sample/xml.rb1
-rw-r--r--ext/win32ole/win32ole.c6317
-rw-r--r--ext/win32ole/win32ole.h155
-rw-r--r--ext/win32ole/win32ole_error.c83
-rw-r--r--ext/win32ole/win32ole_error.h8
-rw-r--r--ext/win32ole/win32ole_event.c1278
-rw-r--r--ext/win32ole/win32ole_event.h6
-rw-r--r--ext/win32ole/win32ole_method.c950
-rw-r--r--ext/win32ole/win32ole_method.h16
-rw-r--r--ext/win32ole/win32ole_param.c438
-rw-r--r--ext/win32ole/win32ole_param.h8
-rw-r--r--ext/win32ole/win32ole_record.c604
-rw-r--r--ext/win32ole/win32ole_record.h10
-rw-r--r--ext/win32ole/win32ole_type.c915
-rw-r--r--ext/win32ole/win32ole_type.h8
-rw-r--r--ext/win32ole/win32ole_typelib.c844
-rw-r--r--ext/win32ole/win32ole_typelib.h11
-rw-r--r--ext/win32ole/win32ole_variable.c380
-rw-r--r--ext/win32ole/win32ole_variable.h8
-rw-r--r--ext/win32ole/win32ole_variant.c732
-rw-r--r--ext/win32ole/win32ole_variant.h9
-rw-r--r--ext/win32ole/win32ole_variant_m.c149
-rw-r--r--ext/win32ole/win32ole_variant_m.h7
-rw-r--r--ext/zlib/extconf.rb4
-rw-r--r--ext/zlib/zlib.c205
-rw-r--r--file.c840
-rw-r--r--gc.c6490
-rw-r--r--gc.h15
-rw-r--r--gem_prelude.rb8
-rw-r--r--gems/bundled_gems6
-rw-r--r--goruby.c6
-rw-r--r--hash.c1063
-rw-r--r--id_table.c1583
-rw-r--r--id_table.h30
-rw-r--r--include/ruby/backward/classext.h4
-rw-r--r--include/ruby/backward/rubyio.h2
-rw-r--r--include/ruby/backward/rubysig.h7
-rw-r--r--include/ruby/backward/st.h2
-rw-r--r--include/ruby/backward/util.h2
-rw-r--r--include/ruby/defines.h107
-rw-r--r--include/ruby/encoding.h212
-rw-r--r--include/ruby/intern.h237
-rw-r--r--include/ruby/io.h59
-rw-r--r--include/ruby/missing.h38
-rw-r--r--include/ruby/oniguruma.h54
-rw-r--r--include/ruby/re.h1
-rw-r--r--include/ruby/ruby.h1204
-rw-r--r--include/ruby/st.h18
-rw-r--r--include/ruby/thread_native.h56
-rw-r--r--include/ruby/util.h15
-rw-r--r--include/ruby/version.h4
-rw-r--r--include/ruby/win32.h125
-rw-r--r--inits.c6
-rw-r--r--insns.def474
-rw-r--r--internal.h769
-rw-r--r--io.c1936
-rw-r--r--iseq.c1578
-rw-r--r--iseq.h157
-rw-r--r--lex.c.blt197
-rw-r--r--lib/English.rb5
-rwxr-xr-x[-rw-r--r--]lib/abbrev.rb96
-rw-r--r--lib/base64.rb22
-rw-r--r--lib/benchmark.rb56
-rw-r--r--lib/cgi.rb5
-rw-r--r--lib/cgi/cookie.rb60
-rw-r--r--lib/cgi/core.rb51
-rw-r--r--lib/cgi/html.rb3
-rw-r--r--lib/cgi/session.rb29
-rw-r--r--lib/cgi/session/pstore.rb14
-rw-r--r--lib/cgi/util.rb22
-rw-r--r--lib/cmath.rb263
-rw-r--r--lib/complex.rb28
-rw-r--r--lib/csv.rb186
-rw-r--r--lib/debug.rb26
-rw-r--r--lib/delegate.rb94
-rw-r--r--lib/drb.rb1
-rw-r--r--lib/drb/acl.rb21
-rw-r--r--lib/drb/drb.rb77
-rw-r--r--lib/drb/eq.rb1
-rw-r--r--lib/drb/extserv.rb31
-rw-r--r--lib/drb/extservm.rb3
-rw-r--r--lib/drb/gw.rb1
-rw-r--r--lib/drb/invokemethod.rb1
-rw-r--r--lib/drb/observer.rb1
-rw-r--r--lib/drb/ssl.rb15
-rw-r--r--lib/drb/timeridconv.rb41
-rw-r--r--lib/drb/unix.rb7
-rw-r--r--lib/e2mmap.rb7
-rw-r--r--lib/erb.rb51
-rw-r--r--lib/fileutils.rb189
-rw-r--r--lib/find.rb8
-rw-r--r--lib/forwardable.rb62
-rw-r--r--lib/getoptlong.rb3
-rw-r--r--lib/gserver.rb310
-rw-r--r--lib/ipaddr.rb282
-rw-r--r--lib/irb.rb45
-rw-r--r--lib/irb/cmd/chws.rb7
-rw-r--r--lib/irb/cmd/fork.rb30
-rw-r--r--lib/irb/cmd/help.rb1
-rw-r--r--lib/irb/cmd/load.rb49
-rw-r--r--lib/irb/cmd/nop.rb12
-rw-r--r--lib/irb/cmd/pushws.rb11
-rw-r--r--lib/irb/cmd/subirb.rb9
-rw-r--r--lib/irb/completion.rb265
-rw-r--r--lib/irb/context.rb176
-rw-r--r--lib/irb/ext/change-ws.rb35
-rw-r--r--lib/irb/ext/history.rb59
-rw-r--r--lib/irb/ext/loader.rb119
-rw-r--r--lib/irb/ext/math-mode.rb9
-rw-r--r--lib/irb/ext/multi-irb.rb176
-rw-r--r--lib/irb/ext/save-history.rb69
-rw-r--r--lib/irb/ext/tracer.rb27
-rw-r--r--lib/irb/ext/use-loader.rb29
-rw-r--r--lib/irb/ext/workspaces.rb27
-rw-r--r--lib/irb/extend-command.rb219
-rw-r--r--lib/irb/frame.rb5
-rw-r--r--lib/irb/help.rb19
-rw-r--r--lib/irb/init.rb213
-rw-r--r--lib/irb/input-method.rb37
-rw-r--r--lib/irb/inspector.rb17
-rw-r--r--lib/irb/lc/error.rb1
-rw-r--r--lib/irb/lc/ja/encoding_aliases.rb1
-rw-r--r--lib/irb/lc/ja/error.rb1
-rw-r--r--lib/irb/locale.rb72
-rw-r--r--lib/irb/magic-file.rb1
-rw-r--r--lib/irb/notifier.rb83
-rw-r--r--lib/irb/output-method.rb7
-rw-r--r--lib/irb/ruby-lex.rb704
-rw-r--r--lib/irb/ruby-token.rb30
-rw-r--r--lib/irb/slex.rb262
-rw-r--r--lib/irb/src_encoding.rb1
-rw-r--r--lib/irb/version.rb1
-rw-r--r--lib/irb/workspace.rb115
-rw-r--r--lib/irb/ws-for-case-2.rb1
-rw-r--r--lib/irb/xmp.rb39
-rw-r--r--lib/logger.rb313
-rw-r--r--lib/mathn.rb152
-rw-r--r--lib/matrix.rb345
-rw-r--r--lib/matrix/eigenvalue_decomposition.rb215
-rw-r--r--lib/matrix/lup_decomposition.rb1
-rw-r--r--lib/minitest/.document2
-rw-r--r--lib/minitest/README.txt (renamed from test/lib/minitest/README.txt)0
-rw-r--r--lib/minitest/autorun.rb19
-rw-r--r--lib/minitest/benchmark.rb (renamed from test/lib/minitest/benchmark.rb)7
-rw-r--r--lib/minitest/hell.rb20
-rw-r--r--lib/minitest/mock.rb (renamed from test/lib/minitest/mock.rb)6
-rw-r--r--lib/minitest/parallel_each.rb80
-rw-r--r--lib/minitest/pride.rb119
-rw-r--r--lib/minitest/spec.rb551
-rw-r--r--lib/minitest/unit.rb (renamed from test/lib/minitest/unit.rb)70
-rw-r--r--lib/mkmf.rb210
-rw-r--r--lib/monitor.rb3
-rw-r--r--lib/mutex_m.rb1
-rw-r--r--lib/net/ftp.rb464
-rw-r--r--lib/net/http.rb76
-rw-r--r--lib/net/http/backward.rb1
-rw-r--r--lib/net/http/exceptions.rb1
-rw-r--r--lib/net/http/generic_request.rb69
-rw-r--r--lib/net/http/header.rb45
-rw-r--r--lib/net/http/proxy_delta.rb1
-rw-r--r--lib/net/http/request.rb1
-rw-r--r--lib/net/http/requests.rb3
-rw-r--r--lib/net/http/response.rb20
-rw-r--r--lib/net/http/responses.rb11
-rw-r--r--lib/net/https.rb3
-rw-r--r--lib/net/imap.rb552
-rw-r--r--lib/net/pop.rb3
-rw-r--r--lib/net/protocol.rb56
-rw-r--r--lib/net/smtp.rb38
-rw-r--r--lib/net/telnet.rb763
-rw-r--r--lib/observer.rb3
-rw-r--r--lib/open-uri.rb40
-rw-r--r--lib/open3.rb66
-rw-r--r--lib/optionparser.rb2
-rw-r--r--lib/optparse.rb358
-rw-r--r--lib/optparse/ac.rb1
-rw-r--r--lib/optparse/date.rb1
-rw-r--r--lib/optparse/shellwords.rb1
-rw-r--r--lib/optparse/time.rb1
-rw-r--r--lib/optparse/uri.rb1
-rw-r--r--lib/optparse/version.rb3
-rw-r--r--lib/ostruct.rb60
-rw-r--r--lib/pp.rb12
-rw-r--r--lib/prettyprint.rb30
-rw-r--r--lib/prime.rb132
-rw-r--r--lib/profile.rb1
-rw-r--r--lib/profiler.rb1
-rw-r--r--lib/pstore.rb25
-rw-r--r--lib/racc/parser.rb9
-rw-r--r--lib/racc/rdoc/grammar.en.rdoc83
-rw-r--r--lib/rake.rb73
-rw-r--r--lib/rake/alt_system.rb108
-rw-r--r--lib/rake/application.rb728
-rw-r--r--lib/rake/backtrace.rb20
-rw-r--r--lib/rake/clean.rb55
-rw-r--r--lib/rake/cloneable.rb16
-rw-r--r--lib/rake/contrib/compositepublisher.rb21
-rw-r--r--lib/rake/contrib/ftptools.rb139
-rw-r--r--lib/rake/contrib/publisher.rb73
-rw-r--r--lib/rake/contrib/rubyforgepublisher.rb16
-rw-r--r--lib/rake/contrib/sshpublisher.rb50
-rw-r--r--lib/rake/contrib/sys.rb2
-rw-r--r--lib/rake/default_loader.rb10
-rw-r--r--lib/rake/dsl_definition.rb157
-rw-r--r--lib/rake/early_time.rb18
-rw-r--r--lib/rake/ext/core.rb28
-rw-r--r--lib/rake/ext/module.rb1
-rw-r--r--lib/rake/ext/string.rb166
-rw-r--r--lib/rake/ext/time.rb15
-rw-r--r--lib/rake/file_creation_task.rb24
-rw-r--r--lib/rake/file_list.rb416
-rw-r--r--lib/rake/file_task.rb46
-rw-r--r--lib/rake/file_utils.rb116
-rw-r--r--lib/rake/file_utils_ext.rb144
-rw-r--r--lib/rake/gempackagetask.rb2
-rw-r--r--lib/rake/invocation_chain.rb57
-rw-r--r--lib/rake/invocation_exception_mixin.rb16
-rw-r--r--lib/rake/lib/.document1
-rw-r--r--lib/rake/lib/project.rake21
-rw-r--r--lib/rake/linked_list.rb103
-rw-r--r--lib/rake/loaders/makefile.rb40
-rw-r--r--lib/rake/multi_task.rb13
-rw-r--r--lib/rake/name_space.rb25
-rw-r--r--lib/rake/packagetask.rb190
-rw-r--r--lib/rake/pathmap.rb1
-rw-r--r--lib/rake/phony.rb15
-rw-r--r--lib/rake/private_reader.rb20
-rw-r--r--lib/rake/promise.rb99
-rw-r--r--lib/rake/pseudo_status.rb29
-rw-r--r--lib/rake/rake_module.rb37
-rw-r--r--lib/rake/rake_test_loader.rb22
-rw-r--r--lib/rake/rdoctask.rb2
-rw-r--r--lib/rake/ruby182_test_unit_fix.rb27
-rw-r--r--lib/rake/rule_recursion_overflow_error.rb20
-rw-r--r--lib/rake/runtest.rb22
-rw-r--r--lib/rake/scope.rb42
-rw-r--r--lib/rake/task.rb378
-rw-r--r--lib/rake/task_argument_error.rb7
-rw-r--r--lib/rake/task_arguments.rb89
-rw-r--r--lib/rake/task_manager.rb297
-rw-r--r--lib/rake/tasklib.rb22
-rw-r--r--lib/rake/testtask.rb201
-rw-r--r--lib/rake/thread_history_display.rb48
-rw-r--r--lib/rake/thread_pool.rb161
-rw-r--r--lib/rake/trace_output.rb22
-rw-r--r--lib/rake/version.rb9
-rw-r--r--lib/rake/win32.rb56
-rw-r--r--lib/rational.rb23
-rw-r--r--lib/rbconfig/datadir.rb1
-rw-r--r--lib/rbconfig/obsolete.rb38
-rw-r--r--lib/rdoc.rb7
-rw-r--r--lib/rdoc/alias.rb1
-rw-r--r--lib/rdoc/anon_class.rb1
-rw-r--r--lib/rdoc/any_method.rb11
-rw-r--r--lib/rdoc/attr.rb1
-rw-r--r--lib/rdoc/class_module.rb1
-rw-r--r--lib/rdoc/code_object.rb1
-rw-r--r--lib/rdoc/code_objects.rb1
-rw-r--r--lib/rdoc/comment.rb1
-rw-r--r--lib/rdoc/constant.rb1
-rw-r--r--lib/rdoc/context.rb12
-rw-r--r--lib/rdoc/context/section.rb1
-rw-r--r--lib/rdoc/cross_reference.rb1
-rw-r--r--lib/rdoc/encoding.rb5
-rw-r--r--lib/rdoc/erb_partial.rb1
-rw-r--r--lib/rdoc/erbio.rb1
-rw-r--r--lib/rdoc/extend.rb1
-rw-r--r--lib/rdoc/generator.rb2
-rw-r--r--lib/rdoc/generator/darkfish.rb6
-rw-r--r--lib/rdoc/generator/json_index.rb50
-rw-r--r--lib/rdoc/generator/markup.rb1
-rw-r--r--lib/rdoc/generator/pot.rb98
-rw-r--r--lib/rdoc/generator/pot/message_extractor.rb68
-rw-r--r--lib/rdoc/generator/pot/po.rb84
-rw-r--r--lib/rdoc/generator/pot/po_entry.rb141
-rw-r--r--lib/rdoc/generator/ri.rb1
-rw-r--r--lib/rdoc/generator/template/darkfish/_footer.rhtml4
-rw-r--r--lib/rdoc/generator/template/darkfish/_head.rhtml21
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml5
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts.css (renamed from lib/rdoc/generator/template/darkfish/css/fonts.css)0
-rwxr-xr-x[-rw-r--r--]lib/rdoc/generator/template/darkfish/images/add.pngbin733 -> 733 bytes-rwxr-xr-x[-rw-r--r--]lib/rdoc/generator/template/darkfish/images/arrow_up.pngbin372 -> 372 bytes-rwxr-xr-x[-rw-r--r--]lib/rdoc/generator/template/darkfish/images/delete.pngbin715 -> 715 bytes-rwxr-xr-x[-rw-r--r--]lib/rdoc/generator/template/darkfish/images/tag_blue.pngbin1880 -> 1880 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/js/darkfish.js43
-rw-r--r--lib/rdoc/generator/template/darkfish/js/jquery.js22
-rw-r--r--lib/rdoc/generator/template/darkfish/js/search.js9
-rw-r--r--lib/rdoc/generator/template/darkfish/rdoc.css (renamed from lib/rdoc/generator/template/darkfish/css/rdoc.css)12
-rw-r--r--lib/rdoc/generator/template/json_index/js/searcher.js4
-rw-r--r--lib/rdoc/ghost_method.rb1
-rw-r--r--lib/rdoc/i18n.rb10
-rw-r--r--lib/rdoc/i18n/locale.rb102
-rw-r--r--lib/rdoc/i18n/text.rb126
-rw-r--r--lib/rdoc/include.rb1
-rw-r--r--lib/rdoc/known_classes.rb2
-rw-r--r--lib/rdoc/markdown.rb177
-rw-r--r--lib/rdoc/markdown/entities.rb1
-rw-r--r--lib/rdoc/markdown/literals_1_9.rb1
-rw-r--r--lib/rdoc/markup.rb5
-rw-r--r--lib/rdoc/markup/attr_changer.rb1
-rw-r--r--lib/rdoc/markup/attr_span.rb1
-rw-r--r--lib/rdoc/markup/attribute_manager.rb3
-rw-r--r--lib/rdoc/markup/attributes.rb1
-rw-r--r--lib/rdoc/markup/blank_line.rb1
-rw-r--r--lib/rdoc/markup/block_quote.rb1
-rw-r--r--lib/rdoc/markup/document.rb1
-rw-r--r--lib/rdoc/markup/formatter.rb1
-rw-r--r--lib/rdoc/markup/formatter_test_case.rb1
-rw-r--r--lib/rdoc/markup/hard_break.rb1
-rw-r--r--lib/rdoc/markup/heading.rb1
-rw-r--r--lib/rdoc/markup/include.rb1
-rw-r--r--lib/rdoc/markup/indented_paragraph.rb1
-rw-r--r--lib/rdoc/markup/inline.rb1
-rw-r--r--lib/rdoc/markup/list.rb1
-rw-r--r--lib/rdoc/markup/list_item.rb1
-rw-r--r--lib/rdoc/markup/paragraph.rb1
-rw-r--r--lib/rdoc/markup/parser.rb1
-rw-r--r--lib/rdoc/markup/pre_process.rb1
-rw-r--r--lib/rdoc/markup/raw.rb1
-rw-r--r--lib/rdoc/markup/rule.rb1
-rw-r--r--lib/rdoc/markup/special.rb1
-rw-r--r--lib/rdoc/markup/text_formatter_test_case.rb1
-rw-r--r--lib/rdoc/markup/to_ansi.rb1
-rw-r--r--lib/rdoc/markup/to_bs.rb1
-rw-r--r--lib/rdoc/markup/to_html.rb10
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb1
-rw-r--r--lib/rdoc/markup/to_html_snippet.rb1
-rw-r--r--lib/rdoc/markup/to_joined_paragraph.rb1
-rw-r--r--lib/rdoc/markup/to_label.rb3
-rw-r--r--lib/rdoc/markup/to_markdown.rb1
-rw-r--r--lib/rdoc/markup/to_rdoc.rb1
-rw-r--r--lib/rdoc/markup/to_table_of_contents.rb1
-rw-r--r--lib/rdoc/markup/to_test.rb1
-rw-r--r--lib/rdoc/markup/to_tt_only.rb1
-rw-r--r--lib/rdoc/markup/verbatim.rb1
-rw-r--r--lib/rdoc/meta_method.rb1
-rw-r--r--lib/rdoc/method_attr.rb15
-rw-r--r--lib/rdoc/mixin.rb1
-rw-r--r--lib/rdoc/normal_class.rb1
-rw-r--r--lib/rdoc/normal_module.rb1
-rw-r--r--lib/rdoc/options.rb59
-rw-r--r--lib/rdoc/parser.rb9
-rw-r--r--lib/rdoc/parser/c.rb19
-rw-r--r--lib/rdoc/parser/changelog.rb11
-rw-r--r--lib/rdoc/parser/markdown.rb1
-rw-r--r--lib/rdoc/parser/rd.rb1
-rw-r--r--lib/rdoc/parser/ruby.rb25
-rw-r--r--lib/rdoc/parser/ruby_tools.rb1
-rw-r--r--lib/rdoc/parser/simple.rb1
-rw-r--r--lib/rdoc/parser/text.rb1
-rw-r--r--lib/rdoc/rd.rb1
-rw-r--r--lib/rdoc/rd/block_parser.rb7
-rw-r--r--lib/rdoc/rd/inline.rb1
-rw-r--r--lib/rdoc/rd/inline_parser.rb3
-rw-r--r--lib/rdoc/rdoc.gemspec7
-rw-r--r--lib/rdoc/rdoc.rb15
-rw-r--r--lib/rdoc/require.rb1
-rw-r--r--lib/rdoc/ri.rb1
-rw-r--r--lib/rdoc/ri/driver.rb1
-rw-r--r--lib/rdoc/ri/formatter.rb1
-rw-r--r--lib/rdoc/ri/paths.rb1
-rw-r--r--lib/rdoc/ri/store.rb1
-rw-r--r--lib/rdoc/ri/task.rb72
-rw-r--r--lib/rdoc/ruby_lex.rb7
-rw-r--r--lib/rdoc/ruby_token.rb15
-rw-r--r--lib/rdoc/rubygems_hook.rb9
-rw-r--r--lib/rdoc/servlet.rb3
-rw-r--r--lib/rdoc/single_class.rb5
-rw-r--r--lib/rdoc/stats.rb5
-rw-r--r--lib/rdoc/stats/normal.rb34
-rw-r--r--lib/rdoc/stats/quiet.rb1
-rw-r--r--lib/rdoc/stats/verbose.rb1
-rw-r--r--lib/rdoc/store.rb1
-rw-r--r--lib/rdoc/task.rb3
-rw-r--r--lib/rdoc/test_case.rb3
-rw-r--r--lib/rdoc/text.rb19
-rw-r--r--lib/rdoc/token_stream.rb3
-rw-r--r--lib/rdoc/tom_doc.rb1
-rw-r--r--lib/rdoc/top_level.rb1
-rw-r--r--lib/resolv-replace.rb2
-rw-r--r--lib/resolv.rb134
-rw-r--r--lib/rexml/attlistdecl.rb3
-rw-r--r--lib/rexml/attribute.rb5
-rw-r--r--lib/rexml/cdata.rb1
-rw-r--r--lib/rexml/child.rb1
-rw-r--r--lib/rexml/comment.rb2
-rw-r--r--lib/rexml/doctype.rb1
-rw-r--r--lib/rexml/document.rb7
-rw-r--r--lib/rexml/dtd/attlistdecl.rb1
-rw-r--r--lib/rexml/dtd/dtd.rb6
-rw-r--r--lib/rexml/dtd/elementdecl.rb5
-rw-r--r--lib/rexml/dtd/entitydecl.rb1
-rw-r--r--lib/rexml/dtd/notationdecl.rb1
-rw-r--r--lib/rexml/element.rb7
-rw-r--r--lib/rexml/encoding.rb1
-rw-r--r--lib/rexml/entity.rb10
-rw-r--r--lib/rexml/formatters/default.rb1
-rw-r--r--lib/rexml/formatters/pretty.rb1
-rw-r--r--lib/rexml/formatters/transitive.rb1
-rw-r--r--lib/rexml/functions.rb32
-rw-r--r--lib/rexml/instruction.rb1
-rw-r--r--lib/rexml/light/node.rb1
-rw-r--r--lib/rexml/namespace.rb1
-rw-r--r--lib/rexml/node.rb1
-rw-r--r--lib/rexml/output.rb1
-rw-r--r--lib/rexml/parent.rb3
-rw-r--r--lib/rexml/parseexception.rb1
-rw-r--r--lib/rexml/parsers/baseparser.rb1
-rw-r--r--lib/rexml/parsers/lightparser.rb1
-rw-r--r--lib/rexml/parsers/pullparser.rb1
-rw-r--r--lib/rexml/parsers/sax2parser.rb2
-rw-r--r--lib/rexml/parsers/streamparser.rb9
-rw-r--r--lib/rexml/parsers/treeparser.rb1
-rw-r--r--lib/rexml/parsers/ultralightparser.rb1
-rw-r--r--lib/rexml/parsers/xpathparser.rb44
-rw-r--r--lib/rexml/quickpath.rb1
-rw-r--r--lib/rexml/rexml.rb1
-rw-r--r--lib/rexml/sax2listener.rb1
-rw-r--r--lib/rexml/security.rb1
-rw-r--r--lib/rexml/source.rb7
-rw-r--r--lib/rexml/streamlistener.rb3
-rw-r--r--lib/rexml/syncenumerator.rb1
-rw-r--r--lib/rexml/text.rb1
-rw-r--r--lib/rexml/undefinednamespaceexception.rb1
-rw-r--r--lib/rexml/validation/relaxng.rb22
-rw-r--r--lib/rexml/validation/validation.rb13
-rw-r--r--lib/rexml/validation/validationexception.rb1
-rw-r--r--lib/rexml/xmldecl.rb1
-rw-r--r--lib/rexml/xmltokens.rb77
-rw-r--r--lib/rexml/xpath.rb1
-rw-r--r--lib/rexml/xpath_parser.rb109
-rw-r--r--lib/rinda/rinda.rb1
-rw-r--r--lib/rinda/ring.rb60
-rw-r--r--lib/rinda/tuplespace.rb4
-rw-r--r--lib/rss.rb1
-rw-r--r--lib/rss/0.9.rb1
-rw-r--r--lib/rss/1.0.rb1
-rw-r--r--lib/rss/2.0.rb1
-rw-r--r--lib/rss/atom.rb1
-rw-r--r--lib/rss/content.rb1
-rw-r--r--lib/rss/content/1.0.rb1
-rw-r--r--lib/rss/content/2.0.rb1
-rw-r--r--lib/rss/converter.rb1
-rw-r--r--lib/rss/dublincore.rb1
-rw-r--r--lib/rss/dublincore/1.0.rb1
-rw-r--r--lib/rss/dublincore/2.0.rb1
-rw-r--r--lib/rss/dublincore/atom.rb1
-rw-r--r--lib/rss/image.rb1
-rw-r--r--lib/rss/itunes.rb1
-rw-r--r--lib/rss/maker.rb1
-rw-r--r--lib/rss/maker/0.9.rb1
-rw-r--r--lib/rss/maker/1.0.rb1
-rw-r--r--lib/rss/maker/2.0.rb1
-rw-r--r--lib/rss/maker/atom.rb1
-rw-r--r--lib/rss/maker/base.rb3
-rw-r--r--lib/rss/maker/content.rb1
-rw-r--r--lib/rss/maker/dublincore.rb1
-rw-r--r--lib/rss/maker/entry.rb1
-rw-r--r--lib/rss/maker/feed.rb1
-rw-r--r--lib/rss/maker/image.rb1
-rw-r--r--lib/rss/maker/itunes.rb1
-rw-r--r--lib/rss/maker/slash.rb1
-rw-r--r--lib/rss/maker/syndication.rb1
-rw-r--r--lib/rss/maker/taxonomy.rb1
-rw-r--r--lib/rss/maker/trackback.rb1
-rw-r--r--lib/rss/parser.rb1
-rw-r--r--lib/rss/rexmlparser.rb1
-rw-r--r--lib/rss/rss.rb9
-rw-r--r--lib/rss/slash.rb1
-rw-r--r--lib/rss/syndication.rb3
-rw-r--r--lib/rss/taxonomy.rb1
-rw-r--r--lib/rss/trackback.rb1
-rw-r--r--lib/rss/utils.rb3
-rw-r--r--lib/rss/xml-stylesheet.rb1
-rw-r--r--lib/rss/xml.rb1
-rw-r--r--lib/rss/xmlparser.rb3
-rw-r--r--lib/rss/xmlscanner.rb1
-rw-r--r--lib/rubygems.rb179
-rw-r--r--lib/rubygems/available_set.rb8
-rw-r--r--lib/rubygems/basic_specification.rb216
-rw-r--r--lib/rubygems/command.rb14
-rw-r--r--lib/rubygems/command_manager.rb4
-rw-r--r--lib/rubygems/commands/build_command.rb5
-rw-r--r--lib/rubygems/commands/cert_command.rb25
-rw-r--r--lib/rubygems/commands/check_command.rb1
-rw-r--r--lib/rubygems/commands/cleanup_command.rb5
-rw-r--r--lib/rubygems/commands/contents_command.rb35
-rw-r--r--lib/rubygems/commands/dependency_command.rb49
-rw-r--r--lib/rubygems/commands/environment_command.rb15
-rw-r--r--lib/rubygems/commands/fetch_command.rb1
-rw-r--r--lib/rubygems/commands/generate_index_command.rb3
-rw-r--r--lib/rubygems/commands/help_command.rb230
-rw-r--r--lib/rubygems/commands/install_command.rb108
-rw-r--r--lib/rubygems/commands/list_command.rb9
-rw-r--r--lib/rubygems/commands/lock_command.rb1
-rw-r--r--lib/rubygems/commands/mirror_command.rb33
-rw-r--r--lib/rubygems/commands/open_command.rb77
-rw-r--r--lib/rubygems/commands/outdated_command.rb3
-rw-r--r--lib/rubygems/commands/owner_command.rb5
-rw-r--r--lib/rubygems/commands/pristine_command.rb29
-rw-r--r--lib/rubygems/commands/push_command.rb1
-rw-r--r--lib/rubygems/commands/query_command.rb24
-rw-r--r--lib/rubygems/commands/rdoc_command.rb1
-rw-r--r--lib/rubygems/commands/search_command.rb11
-rw-r--r--lib/rubygems/commands/server_command.rb1
-rw-r--r--lib/rubygems/commands/setup_command.rb19
-rw-r--r--lib/rubygems/commands/sources_command.rb3
-rw-r--r--lib/rubygems/commands/specification_command.rb1
-rw-r--r--lib/rubygems/commands/stale_command.rb1
-rw-r--r--lib/rubygems/commands/uninstall_command.rb17
-rw-r--r--lib/rubygems/commands/unpack_command.rb1
-rw-r--r--lib/rubygems/commands/update_command.rb25
-rw-r--r--lib/rubygems/commands/which_command.rb1
-rw-r--r--lib/rubygems/commands/yank_command.rb41
-rw-r--r--lib/rubygems/compatibility.rb8
-rw-r--r--lib/rubygems/config_file.rb42
-rw-r--r--lib/rubygems/core_ext/kernel_gem.rb19
-rwxr-xr-xlib/rubygems/core_ext/kernel_require.rb41
-rw-r--r--lib/rubygems/defaults.rb64
-rw-r--r--lib/rubygems/dependency.rb71
-rw-r--r--lib/rubygems/dependency_installer.rb76
-rw-r--r--lib/rubygems/dependency_list.rb10
-rw-r--r--lib/rubygems/deprecate.rb3
-rw-r--r--lib/rubygems/doctor.rb3
-rw-r--r--lib/rubygems/errors.rb31
-rw-r--r--lib/rubygems/exceptions.rb28
-rw-r--r--lib/rubygems/ext.rb1
-rw-r--r--lib/rubygems/ext/build_error.rb1
-rw-r--r--lib/rubygems/ext/builder.rb13
-rw-r--r--lib/rubygems/ext/cmake_builder.rb1
-rw-r--r--lib/rubygems/ext/configure_builder.rb1
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb62
-rw-r--r--lib/rubygems/ext/rake_builder.rb3
-rw-r--r--lib/rubygems/gem_runner.rb1
-rw-r--r--lib/rubygems/gemcutter_utilities.rb14
-rw-r--r--lib/rubygems/indexer.rb120
-rw-r--r--lib/rubygems/install_default_message.rb1
-rw-r--r--lib/rubygems/install_message.rb1
-rw-r--r--lib/rubygems/install_update_options.rb23
-rw-r--r--lib/rubygems/installer.rb188
-rw-r--r--lib/rubygems/installer_test_case.rb12
-rw-r--r--lib/rubygems/local_remote_options.rb7
-rw-r--r--lib/rubygems/mock_gem_ui.rb1
-rw-r--r--lib/rubygems/name_tuple.rb7
-rw-r--r--lib/rubygems/package.rb69
-rw-r--r--lib/rubygems/package/digest_io.rb1
-rw-r--r--lib/rubygems/package/file_source.rb34
-rw-r--r--lib/rubygems/package/io_source.rb46
-rw-r--r--lib/rubygems/package/old.rb28
-rw-r--r--lib/rubygems/package/source.rb4
-rw-r--r--lib/rubygems/package/tar_header.rb4
-rw-r--r--lib/rubygems/package/tar_reader.rb2
-rw-r--r--lib/rubygems/package/tar_reader/entry.rb11
-rw-r--r--lib/rubygems/package/tar_test_case.rb16
-rw-r--r--lib/rubygems/package/tar_writer.rb33
-rw-r--r--lib/rubygems/package_task.rb1
-rw-r--r--lib/rubygems/path_support.rb27
-rw-r--r--lib/rubygems/platform.rb11
-rw-r--r--lib/rubygems/psych_additions.rb3
-rw-r--r--lib/rubygems/psych_tree.rb1
-rw-r--r--lib/rubygems/rdoc.rb11
-rw-r--r--lib/rubygems/remote_fetcher.rb144
-rw-r--r--lib/rubygems/request.rb186
-rw-r--r--lib/rubygems/request/connection_pools.rb88
-rw-r--r--lib/rubygems/request/http_pool.rb48
-rw-r--r--lib/rubygems/request/https_pool.rb11
-rw-r--r--lib/rubygems/request_set.rb269
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb434
-rw-r--r--lib/rubygems/request_set/lockfile.rb328
-rw-r--r--lib/rubygems/request_set/lockfile/parser.rb354
-rw-r--r--lib/rubygems/request_set/lockfile/tokenizer.rb112
-rw-r--r--lib/rubygems/requirement.rb41
-rw-r--r--lib/rubygems/resolver.rb363
-rw-r--r--lib/rubygems/resolver/activation_request.rb74
-rw-r--r--lib/rubygems/resolver/api_set.rb22
-rw-r--r--lib/rubygems/resolver/api_specification.rb13
-rw-r--r--lib/rubygems/resolver/best_set.rb60
-rw-r--r--lib/rubygems/resolver/composed_set.rb28
-rw-r--r--lib/rubygems/resolver/conflict.rb55
-rw-r--r--lib/rubygems/resolver/current_set.rb1
-rw-r--r--lib/rubygems/resolver/dependency_request.rb61
-rw-r--r--lib/rubygems/resolver/git_set.rb55
-rw-r--r--lib/rubygems/resolver/git_specification.rb43
-rw-r--r--lib/rubygems/resolver/index_set.rb35
-rw-r--r--lib/rubygems/resolver/index_specification.rb1
-rw-r--r--lib/rubygems/resolver/installed_specification.rb33
-rw-r--r--lib/rubygems/resolver/installer_set.rb145
-rw-r--r--lib/rubygems/resolver/local_specification.rb42
-rw-r--r--lib/rubygems/resolver/lock_set.rb41
-rw-r--r--lib/rubygems/resolver/lock_specification.rb88
-rw-r--r--lib/rubygems/resolver/molinillo.rb2
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo.rb10
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb287
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb75
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb5
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb100
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb64
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb436
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb45
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/state.rb52
-rw-r--r--lib/rubygems/resolver/requirement_list.rb50
-rw-r--r--lib/rubygems/resolver/set.rb30
-rw-r--r--lib/rubygems/resolver/source_set.rb48
-rw-r--r--lib/rubygems/resolver/spec_specification.rb3
-rw-r--r--lib/rubygems/resolver/specification.rb51
-rw-r--r--lib/rubygems/resolver/stats.rb45
-rw-r--r--lib/rubygems/resolver/vendor_set.rb38
-rw-r--r--lib/rubygems/resolver/vendor_specification.rb9
-rw-r--r--lib/rubygems/safe_yaml.rb48
-rw-r--r--lib/rubygems/security.rb11
-rw-r--r--lib/rubygems/security/policies.rb1
-rw-r--r--lib/rubygems/security/policy.rb5
-rw-r--r--lib/rubygems/security/signer.rb3
-rw-r--r--lib/rubygems/security/trust_dir.rb19
-rw-r--r--lib/rubygems/server.rb38
-rw-r--r--lib/rubygems/source.rb26
-rw-r--r--lib/rubygems/source/git.rb81
-rw-r--r--lib/rubygems/source/installed.rb9
-rw-r--r--lib/rubygems/source/local.rb4
-rw-r--r--lib/rubygems/source/lock.rb49
-rw-r--r--lib/rubygems/source/specific_file.rb8
-rw-r--r--lib/rubygems/source/vendor.rb3
-rw-r--r--lib/rubygems/source_list.rb3
-rw-r--r--lib/rubygems/source_local.rb1
-rw-r--r--lib/rubygems/source_specific_file.rb1
-rw-r--r--lib/rubygems/spec_fetcher.rb20
-rw-r--r--lib/rubygems/specification.rb722
-rw-r--r--lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem25
-rw-r--r--lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem32
-rw-r--r--lib/rubygems/ssl_certs/GlobalSignRootCA.pem21
-rw-r--r--lib/rubygems/stub_specification.rb185
-rw-r--r--lib/rubygems/syck_hack.rb3
-rw-r--r--lib/rubygems/test_case.rb243
-rw-r--r--lib/rubygems/test_utilities.rb82
-rw-r--r--lib/rubygems/text.rb39
-rw-r--r--lib/rubygems/uninstaller.rb12
-rw-r--r--lib/rubygems/uri_formatter.rb1
-rw-r--r--lib/rubygems/user_interaction.rb112
-rw-r--r--lib/rubygems/util.rb80
-rw-r--r--lib/rubygems/util/licenses.rb343
-rw-r--r--lib/rubygems/util/list.rb31
-rw-r--r--lib/rubygems/util/stringio.rb34
-rw-r--r--lib/rubygems/validator.rb2
-rw-r--r--lib/rubygems/version.rb78
-rw-r--r--lib/rubygems/version_option.rb1
-rw-r--r--lib/scanf.rb15
-rw-r--r--lib/securerandom.rb227
-rw-r--r--lib/set.rb134
-rw-r--r--lib/shell.rb48
-rw-r--r--lib/shell/builtin-command.rb15
-rw-r--r--lib/shell/command-processor.rb6
-rw-r--r--lib/shell/error.rb1
-rw-r--r--lib/shell/filter.rb3
-rw-r--r--lib/shell/process-controller.rb10
-rw-r--r--lib/shell/system-command.rb2
-rw-r--r--lib/shell/version.rb1
-rw-r--r--lib/shellwords.rb34
-rw-r--r--lib/singleton.rb1
-rw-r--r--lib/sync.rb1
-rw-r--r--lib/tempfile.rb144
-rw-r--r--lib/test/unit.rb (renamed from test/lib/test/unit.rb)753
-rw-r--r--lib/test/unit/assertions.rb396
-rw-r--r--lib/test/unit/parallel.rb (renamed from test/lib/test/unit/parallel.rb)22
-rw-r--r--lib/test/unit/test-unit.gemspec14
-rw-r--r--lib/test/unit/testcase.rb (renamed from test/lib/test/unit/testcase.rb)2
-rw-r--r--lib/thwait.rb5
-rw-r--r--lib/time.rb120
-rw-r--r--lib/timeout.rb58
-rw-r--r--lib/tmpdir.rb44
-rw-r--r--lib/tracer.rb1
-rw-r--r--lib/tsort.rb16
-rw-r--r--lib/ubygems.rb1
-rw-r--r--lib/un.rb9
-rw-r--r--lib/unicode_normalize.rb79
-rw-r--r--lib/unicode_normalize/normalize.rb161
-rw-r--r--lib/unicode_normalize/tables.rb1160
-rw-r--r--lib/uri.rb3
-rw-r--r--lib/uri/common.rb574
-rw-r--r--lib/uri/ftp.rb26
-rw-r--r--lib/uri/generic.rb282
-rw-r--r--lib/uri/http.rb17
-rw-r--r--lib/uri/https.rb1
-rw-r--r--lib/uri/ldap.rb1
-rw-r--r--lib/uri/ldaps.rb1
-rw-r--r--lib/uri/mailto.rb164
-rw-r--r--lib/uri/rfc2396_parser.rb544
-rw-r--r--lib/uri/rfc3986_parser.rb125
-rw-r--r--lib/weakref.rb12
-rw-r--r--lib/webrick.rb3
-rw-r--r--lib/webrick/accesslog.rb3
-rw-r--r--lib/webrick/cgi.rb1
-rw-r--r--lib/webrick/compat.rb3
-rw-r--r--lib/webrick/config.rb1
-rw-r--r--lib/webrick/cookie.rb1
-rw-r--r--lib/webrick/htmlutils.rb1
-rw-r--r--lib/webrick/httpauth.rb1
-rw-r--r--lib/webrick/httpauth/authenticator.rb1
-rw-r--r--lib/webrick/httpauth/basicauth.rb4
-rw-r--r--lib/webrick/httpauth/digestauth.rb6
-rw-r--r--lib/webrick/httpauth/htdigest.rb1
-rw-r--r--lib/webrick/httpauth/htgroup.rb1
-rw-r--r--lib/webrick/httpauth/htpasswd.rb1
-rw-r--r--lib/webrick/httpauth/userdb.rb1
-rw-r--r--lib/webrick/httpproxy.rb11
-rw-r--r--lib/webrick/httprequest.rb6
-rw-r--r--lib/webrick/httpresponse.rb5
-rw-r--r--lib/webrick/https.rb1
-rw-r--r--lib/webrick/httpserver.rb12
-rw-r--r--lib/webrick/httpservlet.rb1
-rw-r--r--lib/webrick/httpservlet/abstract.rb1
-rw-r--r--lib/webrick/httpservlet/cgi_runner.rb1
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb5
-rw-r--r--lib/webrick/httpservlet/erbhandler.rb3
-rw-r--r--lib/webrick/httpservlet/filehandler.rb4
-rw-r--r--lib/webrick/httpservlet/prochandler.rb1
-rw-r--r--lib/webrick/httpstatus.rb9
-rw-r--r--lib/webrick/httputils.rb1
-rw-r--r--lib/webrick/httpversion.rb1
-rw-r--r--lib/webrick/log.rb5
-rw-r--r--lib/webrick/server.rb151
-rw-r--r--lib/webrick/ssl.rb6
-rw-r--r--lib/webrick/utils.rb111
-rw-r--r--lib/webrick/version.rb1
-rw-r--r--lib/xmlrpc.rb19
-rw-r--r--lib/xmlrpc/base64.rb1
-rw-r--r--lib/xmlrpc/client.rb33
-rw-r--r--lib/xmlrpc/config.rb2
-rw-r--r--lib/xmlrpc/create.rb1
-rw-r--r--lib/xmlrpc/datetime.rb3
-rw-r--r--lib/xmlrpc/httpserver.rb173
-rw-r--r--lib/xmlrpc/marshal.rb1
-rw-r--r--lib/xmlrpc/parser.rb35
-rw-r--r--lib/xmlrpc/server.rb3
-rw-r--r--lib/xmlrpc/utils.rb1
-rw-r--r--lib/yaml.rb41
-rw-r--r--lib/yaml/dbm.rb1
-rw-r--r--lib/yaml/store.rb1
-rw-r--r--load.c318
-rw-r--r--localeinit.c69
-rw-r--r--man/erb.12
-rw-r--r--man/goruby.12
-rw-r--r--man/irb.16
-rw-r--r--man/rake.1205
-rw-r--r--man/ri.12
-rw-r--r--man/ruby.1175
-rw-r--r--marshal.c597
-rw-r--r--math.c294
-rw-r--r--method.h194
-rw-r--r--miniinit.c21
-rw-r--r--misc/README2
-rw-r--r--misc/rdoc-mode.el40
-rw-r--r--misc/ruby-additional.el18
-rw-r--r--misc/ruby-electric.el286
-rw-r--r--misc/ruby-mode.el52
-rw-r--r--missing/crypt.c91
-rw-r--r--missing/explicit_bzero.c88
-rw-r--r--missing/lgamma_r.c2
-rw-r--r--missing/nextafter.c77
-rw-r--r--missing/os2.c138
-rw-r--r--missing/setproctitle.c7
-rw-r--r--nacl/GNUmakefile.in49
-rw-r--r--nacl/README.nacl23
-rw-r--r--nacl/ioctl.h7
-rw-r--r--[-rwxr-xr-x]nacl/nacl-config.rb16
-rw-r--r--nacl/package.rb6
-rw-r--r--nacl/pepper_main.c248
-rw-r--r--node.c343
-rw-r--r--node.h67
-rw-r--r--numeric.c684
-rw-r--r--object.c1075
-rw-r--r--pack.c468
-rw-r--r--parse.y4719
-rw-r--r--prelude.rb125
-rw-r--r--probes.d17
-rw-r--r--probes_helper.h70
-rw-r--r--proc.c1285
-rw-r--r--process.c2232
-rw-r--r--random.c497
-rw-r--r--range.c264
-rw-r--r--rational.c103
-rw-r--r--re.c290
-rw-r--r--regcomp.c291
-rw-r--r--regenc.c76
-rw-r--r--regenc.h32
-rw-r--r--regerror.c24
-rw-r--r--regexec.c815
-rw-r--r--regint.h116
-rw-r--r--regparse.c490
-rw-r--r--regparse.h10
-rw-r--r--ruby.c578
-rw-r--r--ruby_atomic.h115
-rw-r--r--safe.c33
-rw-r--r--sample/benchmark.rb19
-rw-r--r--sample/cgi-session-pstore.rb11
-rw-r--r--sample/curses/hello.rb27
-rw-r--r--sample/curses/mouse.rb52
-rw-r--r--sample/curses/rain.rb74
-rw-r--r--sample/curses/view.rb91
-rw-r--r--sample/curses/view2.rb149
-rw-r--r--sample/delegate.rb31
-rw-r--r--sample/drb/acl.rb15
-rw-r--r--sample/drb/ring_place.rb6
-rw-r--r--sample/exyacc.rb26
-rw-r--r--sample/iseq_loader.rb243
-rw-r--r--sample/list.rb2
-rw-r--r--sample/net-imap.rb167
-rw-r--r--sample/open3.rb12
-rw-r--r--sample/pstore.rb19
-rw-r--r--sample/pty/shl.rb47
-rw-r--r--sample/rinda-ring.rb22
-rw-r--r--sample/simple-bench.rb140
-rw-r--r--sample/tempfile.rb8
-rwxr-xr-xsample/test.rb14
-rw-r--r--sample/timeout.rb2
-rw-r--r--sample/trick2013/README.md15
-rw-r--r--sample/trick2013/kinaba/authors.markdown3
-rw-r--r--sample/trick2013/kinaba/entry.rb1
-rw-r--r--sample/trick2013/kinaba/remarks.markdown37
-rw-r--r--sample/trick2013/mame/authors.markdown3
-rw-r--r--sample/trick2013/mame/entry.rb97
-rw-r--r--sample/trick2013/mame/music-box.mp4bin580724 -> 0 bytes-rw-r--r--sample/trick2013/mame/remarks.markdown47
-rw-r--r--sample/trick2013/shinh/authors.markdown2
-rw-r--r--sample/trick2013/shinh/entry.rb10
-rw-r--r--sample/trick2013/shinh/remarks.markdown4
-rw-r--r--sample/trick2013/yhara/authors.markdown3
-rw-r--r--sample/trick2013/yhara/entry.rb28
-rw-r--r--sample/trick2013/yhara/remarks.en.markdown23
-rw-r--r--sample/trick2013/yhara/remarks.markdown24
-rw-r--r--sample/trick2015/README.md16
-rw-r--r--sample/trick2015/eregon/authors.markdown3
-rw-r--r--sample/trick2015/eregon/entry.rb16
-rw-r--r--sample/trick2015/eregon/remarks.markdown70
-rw-r--r--sample/trick2015/kinaba/authors.markdown4
-rw-r--r--sample/trick2015/kinaba/entry.rb150
-rw-r--r--sample/trick2015/kinaba/remarks.markdown85
-rw-r--r--sample/trick2015/ksk_1/authors.markdown3
-rw-r--r--sample/trick2015/ksk_1/entry.rb1
-rw-r--r--sample/trick2015/ksk_1/remarks.markdown120
-rw-r--r--sample/trick2015/ksk_2/abnormal.cnf6
-rw-r--r--sample/trick2015/ksk_2/authors.markdown3
-rw-r--r--sample/trick2015/ksk_2/entry.rb1
-rw-r--r--sample/trick2015/ksk_2/quinn.cnf21
-rw-r--r--sample/trick2015/ksk_2/remarks.markdown204
-rw-r--r--sample/trick2015/ksk_2/sample.cnf9
-rw-r--r--sample/trick2015/ksk_2/uf20-01.cnf99
-rw-r--r--sample/trick2015/ksk_2/unsat.cnf11
-rw-r--r--sample/trick2015/monae/authors.markdown1
-rw-r--r--sample/trick2015/monae/entry.rb26
-rw-r--r--sample/trick2015/monae/remarks.markdown25
-rw-r--r--sample/weakref.rb9
-rw-r--r--signal.c474
-rw-r--r--siphash.c5
-rw-r--r--spec/default.mspec11
-rw-r--r--sprintf.c353
-rw-r--r--st.c605
-rw-r--r--strftime.c2
-rw-r--r--string.c2935
-rw-r--r--struct.c509
-rw-r--r--symbian/README.SYMBIAN93
-rw-r--r--symbian/configure.bat123
-rw-r--r--symbian/missing-aeabi.c18
-rw-r--r--symbian/missing-pips.c65
-rw-r--r--symbian/pre-build83
-rw-r--r--symbian/setup440
-rw-r--r--symbol.c1134
-rw-r--r--symbol.h108
-rw-r--r--template/Doxyfile.tmpl2
-rw-r--r--template/fake.rb.in77
-rw-r--r--template/id.c.tmpl16
-rw-r--r--template/id.h.tmpl66
-rw-r--r--template/insns.inc.tmpl2
-rw-r--r--template/insns_info.inc.tmpl2
-rw-r--r--template/known_errors.inc.tmpl2
-rw-r--r--template/minsns.inc.tmpl2
-rw-r--r--template/opt_sc.inc.tmpl2
-rw-r--r--template/optinsn.inc.tmpl2
-rw-r--r--template/optunifs.inc.tmpl2
-rw-r--r--template/ruby-runner.c.in37
-rw-r--r--template/sizes.c.tmpl6
-rw-r--r--template/unicode_norm_gen.tmpl222
-rw-r--r--template/verconf.h.in (renamed from template/verconf.h.tmpl)12
-rw-r--r--template/vm.inc.tmpl2
-rw-r--r--template/yarvarch.ja14
-rw-r--r--test/-ext-/array/test_resize.rb1
-rw-r--r--test/-ext-/bignum/test_big2str.rb3
-rw-r--r--test/-ext-/bignum/test_bigzero.rb1
-rw-r--r--test/-ext-/bignum/test_div.rb3
-rw-r--r--test/-ext-/bignum/test_mul.rb3
-rw-r--r--test/-ext-/bignum/test_pack.rb25
-rw-r--r--test/-ext-/bignum/test_str2big.rb3
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb21
-rw-r--r--test/-ext-/class/test_class2name.rb1
-rw-r--r--test/-ext-/debug/test_debug.rb1
-rw-r--r--test/-ext-/debug/test_profile_frames.rb26
-rw-r--r--test/-ext-/exception/test_data_error.rb14
-rw-r--r--test/-ext-/exception/test_enc_raise.rb1
-rw-r--r--test/-ext-/exception/test_ensured.rb2
-rw-r--r--test/-ext-/file/test_stat.rb1
-rw-r--r--test/-ext-/float/test_nextafter.rb65
-rw-r--r--test/-ext-/funcall/test_passing_block.rb1
-rw-r--r--test/-ext-/gvl/test_last_thread.rb23
-rw-r--r--test/-ext-/hash/test_delete.rb20
-rw-r--r--test/-ext-/iseq_load/test_iseq_load.rb117
-rw-r--r--test/-ext-/iter/test_iter_break.rb12
-rw-r--r--test/-ext-/iter/test_yield_block.rb22
-rw-r--r--test/-ext-/load/test_dot_dot.rb1
-rw-r--r--test/-ext-/marshal/test_internal_ivar.rb20
-rw-r--r--test/-ext-/marshal/test_usrmarshal.rb2
-rw-r--r--test/-ext-/method/test_arity.rb1
-rw-r--r--test/-ext-/num2int/test_num2int.rb1
-rw-r--r--test/-ext-/old_thread_select/test_old_thread_select.rb103
-rw-r--r--test/-ext-/path_to_class/test_path_to_class.rb1
-rw-r--r--test/-ext-/popen_deadlock/test_popen_deadlock.rb36
-rw-r--r--test/-ext-/postponed_job/test_postponed_job.rb1
-rw-r--r--test/-ext-/proc/test_bmethod.rb38
-rw-r--r--test/-ext-/rational/test_rat.rb1
-rw-r--r--test/-ext-/st/test_foreach.rb16
-rw-r--r--test/-ext-/st/test_numhash.rb1
-rw-r--r--test/-ext-/st/test_update.rb1
-rw-r--r--test/-ext-/string/test_coderange.rb60
-rw-r--r--test/-ext-/string/test_cstr.rb124
-rw-r--r--test/-ext-/string/test_ellipsize.rb3
-rw-r--r--test/-ext-/string/test_enc_associate.rb14
-rw-r--r--test/-ext-/string/test_enc_str_buf_cat.rb3
-rw-r--r--test/-ext-/string/test_fstring.rb74
-rw-r--r--test/-ext-/string/test_modify_expand.rb17
-rw-r--r--test/-ext-/string/test_nofree.rb13
-rw-r--r--test/-ext-/string/test_normalize.rb14
-rw-r--r--test/-ext-/string/test_qsort.rb3
-rw-r--r--test/-ext-/string/test_set_len.rb3
-rw-r--r--test/-ext-/struct/test_duplicate.rb22
-rw-r--r--test/-ext-/struct/test_member.rb16
-rw-r--r--test/-ext-/symbol/test_inadvertent_creation.rb265
-rw-r--r--test/-ext-/symbol/test_type.rb33
-rw-r--r--test/-ext-/test_bug-3571.rb2
-rw-r--r--test/-ext-/test_bug-3662.rb10
-rw-r--r--test/-ext-/test_bug-5832.rb1
-rw-r--r--test/-ext-/test_notimplement.rb15
-rw-r--r--test/-ext-/test_printf.rb11
-rw-r--r--test/-ext-/test_recursion.rb36
-rw-r--r--test/-ext-/thread_fd_close/test_thread_fd_close.rb23
-rw-r--r--test/-ext-/time/test_new.rb44
-rw-r--r--test/-ext-/tracepoint/test_tracepoint.rb41
-rw-r--r--test/-ext-/typeddata/test_typeddata.rb15
-rw-r--r--test/-ext-/vm/test_at_exit.rb19
-rw-r--r--test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb1
-rw-r--r--test/-ext-/win32/test_console_attr.rb44
-rw-r--r--test/-ext-/win32/test_dln.rb24
-rw-r--r--test/-ext-/win32/test_fd_setsize.rb2
-rw-r--r--test/base64/test_base64.rb15
-rw-r--r--test/benchmark/test_benchmark.rb137
-rw-r--r--test/bigdecimal/test_bigdecimal.rb94
-rw-r--r--test/bigdecimal/test_bigdecimal_util.rb7
-rw-r--r--test/bigdecimal/test_bigmath.rb18
-rw-r--r--test/bigdecimal/testbase.rb1
-rw-r--r--test/cgi/test_cgi_cookie.rb20
-rw-r--r--test/cgi/test_cgi_core.rb136
-rw-r--r--test/cgi/test_cgi_header.rb19
-rw-r--r--test/cgi/test_cgi_modruby.rb11
-rw-r--r--test/cgi/test_cgi_multipart.rb78
-rw-r--r--test/cgi/test_cgi_session.rb47
-rw-r--r--test/cgi/test_cgi_tag_helper.rb28
-rw-r--r--test/cgi/test_cgi_util.rb80
-rw-r--r--test/cgi/update_env.rb9
-rw-r--r--test/colors3
-rw-r--r--test/coverage/test_coverage.rb61
-rw-r--r--test/csv/base.rb3
-rwxr-xr-xtest/csv/test_csv_parsing.rb1
-rwxr-xr-xtest/csv/test_csv_writing.rb1
-rwxr-xr-xtest/csv/test_data_converters.rb5
-rwxr-xr-xtest/csv/test_encodings.rb39
-rwxr-xr-xtest/csv/test_features.rb66
-rwxr-xr-xtest/csv/test_headers.rb35
-rwxr-xr-xtest/csv/test_interface.rb32
-rwxr-xr-xtest/csv/test_row.rb55
-rwxr-xr-xtest/csv/test_table.rb28
-rw-r--r--test/csv/ts_all.rb1
-rw-r--r--test/date/test_date.rb15
-rw-r--r--test/date/test_date_arith.rb31
-rw-r--r--test/date/test_date_attr.rb10
-rw-r--r--test/date/test_date_base.rb1
-rw-r--r--test/date/test_date_compat.rb1
-rw-r--r--test/date/test_date_conv.rb1
-rw-r--r--test/date/test_date_marshal.rb1
-rw-r--r--test/date/test_date_new.rb1
-rw-r--r--test/date/test_date_parse.rb14
-rw-r--r--test/date/test_date_strftime.rb9
-rw-r--r--test/date/test_date_strptime.rb23
-rw-r--r--test/date/test_switch_hitter.rb3
-rw-r--r--test/dbm/test_dbm.rb19
-rw-r--r--test/digest/digest/foo.rb11
-rwxr-xr-x[-rw-r--r--]test/digest/test_digest.rb79
-rw-r--r--test/digest/test_digest_extend.rb5
-rw-r--r--test/digest/test_digest_hmac.rb2
-rw-r--r--test/dl/test_base.rb143
-rw-r--r--test/dl/test_c_struct_entry.rb55
-rw-r--r--test/dl/test_c_union_entity.rb31
-rw-r--r--test/dl/test_callback.rb72
-rw-r--r--test/dl/test_cfunc.rb80
-rw-r--r--test/dl/test_cparser.rb33
-rw-r--r--test/dl/test_cptr.rb222
-rw-r--r--test/dl/test_dl2.rb140
-rw-r--r--test/dl/test_func.rb184
-rw-r--r--test/dl/test_handle.rb187
-rw-r--r--test/dl/test_import.rb165
-rw-r--r--test/dl/test_win32.rb54
-rw-r--r--test/drb/drbtest.rb70
-rw-r--r--test/drb/ignore_test_drb.rb4
-rw-r--r--test/drb/test_acl.rb5
-rw-r--r--test/drb/test_drb.rb38
-rw-r--r--test/drb/test_drbssl.rb15
-rw-r--r--test/drb/test_drbunix.rb14
-rw-r--r--test/drb/ut_array.rb2
-rw-r--r--test/drb/ut_array_drbssl.rb12
-rw-r--r--test/drb/ut_array_drbunix.rb2
-rw-r--r--test/drb/ut_drb.rb9
-rw-r--r--test/drb/ut_drb_drbssl.rb14
-rw-r--r--test/drb/ut_drb_drbunix.rb4
-rw-r--r--test/drb/ut_eq.rb9
-rw-r--r--test/drb/ut_eval.rb8
-rw-r--r--test/drb/ut_large.rb8
-rw-r--r--test/drb/ut_port.rb2
-rw-r--r--test/drb/ut_safe1.rb2
-rw-r--r--test/drb/ut_timerholder.rb75
-rw-r--r--test/dtrace/dummy.rb1
-rw-r--r--test/dtrace/helper.rb12
-rw-r--r--test/dtrace/test_array_create.rb1
-rw-r--r--test/dtrace/test_cmethod.rb1
-rw-r--r--test/dtrace/test_function_entry.rb1
-rw-r--r--test/dtrace/test_gc.rb1
-rw-r--r--test/dtrace/test_hash_create.rb1
-rw-r--r--test/dtrace/test_load.rb1
-rw-r--r--test/dtrace/test_method_cache.rb29
-rw-r--r--test/dtrace/test_object_create_start.rb1
-rw-r--r--test/dtrace/test_raise.rb1
-rw-r--r--test/dtrace/test_require.rb1
-rw-r--r--test/dtrace/test_singleton_function.rb1
-rw-r--r--test/dtrace/test_string.rb1
-rw-r--r--test/erb/test_erb.rb44
-rw-r--r--test/erb/test_erb_command.rb12
-rw-r--r--test/erb/test_erb_m17n.rb3
-rw-r--r--test/etc/test_etc.rb71
-rw-r--r--test/excludes/TestException.rb9
-rw-r--r--test/excludes/TestIO_Console.rb2
-rw-r--r--test/excludes/TestISeq.rb1
-rw-r--r--test/excludes/TestThread.rb2
-rw-r--r--test/fiddle/helper.rb8
-rw-r--r--test/fiddle/test_c_struct_entry.rb1
-rw-r--r--test/fiddle/test_c_union_entity.rb1
-rw-r--r--test/fiddle/test_closure.rb1
-rw-r--r--test/fiddle/test_cparser.rb178
-rw-r--r--test/fiddle/test_fiddle.rb1
-rw-r--r--test/fiddle/test_func.rb1
-rw-r--r--test/fiddle/test_function.rb40
-rw-r--r--test/fiddle/test_handle.rb107
-rw-r--r--test/fiddle/test_import.rb11
-rw-r--r--test/fiddle/test_pointer.rb14
-rw-r--r--test/fileutils/clobber.rb1
-rw-r--r--test/fileutils/fileasserts.rb19
-rw-r--r--test/fileutils/test_dryrun.rb1
-rw-r--r--test/fileutils/test_fileutils.rb456
-rw-r--r--test/fileutils/test_nowrite.rb1
-rw-r--r--test/fileutils/test_verbose.rb1
-rw-r--r--test/fileutils/visibility_tests.rb1
-rw-r--r--test/gdbm/test_gdbm.rb26
-rw-r--r--test/inlinetest.rb55
-rw-r--r--test/io/console/test_io_console.rb133
-rw-r--r--test/io/nonblock/test_flush.rb17
-rw-r--r--test/io/wait/test_io_wait.rb19
-rw-r--r--test/irb/test_completion.rb2
-rw-r--r--test/irb/test_option.rb2
-rw-r--r--test/irb/test_raise_no_backtrace_exception.rb14
-rw-r--r--test/json/setup_variant.rb1
-rwxr-xr-xtest/json/test_json.rb102
-rwxr-xr-x[-rw-r--r--]test/json/test_json_addition.rb5
-rw-r--r--test/json/test_json_encoding.rb3
-rwxr-xr-x[-rw-r--r--]test/json/test_json_fixtures.rb3
-rwxr-xr-x[-rw-r--r--]test/json/test_json_generate.rb88
-rw-r--r--test/json/test_json_generic_object.rb1
-rw-r--r--test/json/test_json_string_matching.rb1
-rwxr-xr-x[-rw-r--r--]test/json/test_json_unicode.rb1
-rw-r--r--test/lib/envutil.rb267
-rw-r--r--test/lib/find_executable.rb22
-rw-r--r--test/lib/iseq_loader_checker.rb75
-rw-r--r--test/lib/leakchecker.rb201
-rw-r--r--test/lib/minitest/autorun.rb14
-rw-r--r--test/lib/test/unit/assertions.rb854
-rw-r--r--test/lib/tracepointchecker.rb119
-rw-r--r--test/lib/zombie_hunter.rb9
-rw-r--r--test/logger/test_logdevice.rb655
-rw-r--r--test/logger/test_logger.rb416
-rw-r--r--test/logger/test_severity.rb16
-rw-r--r--test/matrix/test_matrix.rb194
-rw-r--r--test/matrix/test_vector.rb71
-rw-r--r--test/minitest/metametameta.rb9
-rw-r--r--test/minitest/test_minitest_benchmark.rb6
-rw-r--r--test/minitest/test_minitest_mock.rb10
-rw-r--r--test/minitest/test_minitest_spec.rb811
-rw-r--r--test/minitest/test_minitest_unit.rb93
-rw-r--r--test/misc/test_ruby_mode.rb12
-rw-r--r--test/mkmf/base.rb18
-rw-r--r--test/mkmf/test_config.rb2
-rw-r--r--test/mkmf/test_constant.rb1
-rw-r--r--test/mkmf/test_convertible.rb1
-rw-r--r--test/mkmf/test_find_executable.rb1
-rw-r--r--test/mkmf/test_flags.rb22
-rw-r--r--test/mkmf/test_framework.rb13
-rw-r--r--test/mkmf/test_have_func.rb1
-rw-r--r--test/mkmf/test_have_library.rb1
-rw-r--r--test/mkmf/test_have_macro.rb1
-rw-r--r--test/mkmf/test_libs.rb1
-rw-r--r--test/mkmf/test_signedness.rb1
-rw-r--r--test/mkmf/test_sizeof.rb1
-rw-r--r--test/monitor/test_monitor.rb158
-rw-r--r--test/net/ftp/test_buffered_socket.rb42
-rw-r--r--test/net/ftp/test_ftp.rb1174
-rw-r--r--test/net/ftp/test_mlsx_entry.rb98
-rw-r--r--test/net/http/test_buffered_io.rb1
-rw-r--r--test/net/http/test_http.rb166
-rw-r--r--test/net/http/test_http_request.rb1
-rw-r--r--test/net/http/test_httpheader.rb20
-rw-r--r--test/net/http/test_httpresponse.rb141
-rw-r--r--test/net/http/test_httpresponses.rb1
-rw-r--r--test/net/http/test_https.rb46
-rw-r--r--test/net/http/test_https_proxy.rb32
-rw-r--r--test/net/http/utils.rb22
-rw-r--r--test/net/imap/Makefile15
-rw-r--r--test/net/imap/cacert.pem84
-rw-r--r--test/net/imap/server.crt65
-rw-r--r--test/net/imap/test_imap.rb475
-rw-r--r--test/net/imap/test_imap_response_parser.rb53
-rw-r--r--test/net/pop/test_pop.rb31
-rw-r--r--test/net/protocol/test_protocol.rb10
-rw-r--r--test/net/smtp/test_response.rb5
-rw-r--r--test/net/smtp/test_smtp.rb136
-rw-r--r--test/net/smtp/test_ssl_socket.rb12
-rw-r--r--test/nkf/test_kconv.rb1
-rw-r--r--test/nkf/test_nkf.rb1
-rw-r--r--test/objspace/test_objspace.rb173
-rw-r--r--test/open-uri/test_open-uri.rb206
-rw-r--r--test/open-uri/test_ssl.rb144
-rw-r--r--test/openssl/ssl_server.rb81
-rw-r--r--test/openssl/test_asn1.rb28
-rw-r--r--test/openssl/test_bn.rb38
-rw-r--r--test/openssl/test_buffering.rb5
-rw-r--r--test/openssl/test_cipher.rb39
-rw-r--r--test/openssl/test_config.rb7
-rw-r--r--test/openssl/test_digest.rb20
-rw-r--r--test/openssl/test_engine.rb3
-rw-r--r--test/openssl/test_fips.rb3
-rw-r--r--test/openssl/test_hmac.rb12
-rw-r--r--test/openssl/test_ns_spki.rb3
-rw-r--r--test/openssl/test_ocsp.rb3
-rw-r--r--test/openssl/test_pair.rb286
-rw-r--r--test/openssl/test_partial_record_read.rb35
-rw-r--r--test/openssl/test_pkcs12.rb9
-rw-r--r--test/openssl/test_pkcs5.rb3
-rw-r--r--test/openssl/test_pkcs7.rb144
-rw-r--r--test/openssl/test_pkey_dh.rb26
-rw-r--r--test/openssl/test_pkey_dsa.rb3
-rw-r--r--test/openssl/test_pkey_ec.rb3
-rw-r--r--test/openssl/test_pkey_rsa.rb33
-rw-r--r--test/openssl/test_random.rb17
-rw-r--r--test/openssl/test_ssl.rb663
-rw-r--r--test/openssl/test_ssl_session.rb128
-rw-r--r--test/openssl/test_x509cert.rb38
-rw-r--r--test/openssl/test_x509crl.rb3
-rw-r--r--test/openssl/test_x509ext.rb27
-rw-r--r--test/openssl/test_x509name.rb3
-rw-r--r--test/openssl/test_x509req.rb33
-rw-r--r--test/openssl/test_x509store.rb30
-rw-r--r--test/openssl/utils.rb129
-rw-r--r--test/optparse/test_acceptable.rb46
-rw-r--r--test/optparse/test_autoconf.rb1
-rw-r--r--test/optparse/test_bash_completion.rb1
-rw-r--r--test/optparse/test_cclass.rb18
-rw-r--r--test/optparse/test_getopts.rb1
-rw-r--r--test/optparse/test_noarg.rb1
-rw-r--r--test/optparse/test_optarg.rb1
-rw-r--r--test/optparse/test_optparse.rb1
-rw-r--r--test/optparse/test_placearg.rb1
-rw-r--r--test/optparse/test_reqarg.rb1
-rw-r--r--test/optparse/test_summary.rb1
-rw-r--r--test/optparse/test_zsh_completion.rb1
-rw-r--r--test/ostruct/test_ostruct.rb56
-rw-r--r--test/pathname/test_pathname.rb128
-rw-r--r--test/profile_test_all.rb (renamed from test/lib/profile_test_all.rb)1
-rw-r--r--test/psych/handlers/test_recorder.rb1
-rw-r--r--test/psych/helper.rb12
-rw-r--r--test/psych/json/test_stream.rb3
-rw-r--r--test/psych/nodes/test_enumerable.rb1
-rw-r--r--test/psych/test_alias_and_anchor.rb1
-rw-r--r--test/psych/test_array.rb1
-rw-r--r--test/psych/test_boolean.rb1
-rw-r--r--test/psych/test_class.rb1
-rw-r--r--test/psych/test_coder.rb23
-rw-r--r--test/psych/test_date_time.rb14
-rw-r--r--test/psych/test_deprecated.rb1
-rw-r--r--test/psych/test_document.rb1
-rw-r--r--test/psych/test_emitter.rb22
-rw-r--r--test/psych/test_encoding.rb15
-rw-r--r--test/psych/test_engine_manager.rb47
-rw-r--r--test/psych/test_exception.rb7
-rw-r--r--test/psych/test_hash.rb51
-rw-r--r--test/psych/test_json_tree.rb3
-rw-r--r--test/psych/test_marshalable.rb55
-rw-r--r--test/psych/test_merge_keys.rb31
-rw-r--r--test/psych/test_nil.rb1
-rw-r--r--test/psych/test_null.rb1
-rw-r--r--test/psych/test_numeric.rb1
-rw-r--r--test/psych/test_object.rb1
-rw-r--r--test/psych/test_object_references.rb5
-rw-r--r--test/psych/test_omap.rb1
-rw-r--r--test/psych/test_parser.rb1
-rw-r--r--test/psych/test_psych.rb18
-rw-r--r--test/psych/test_safe_load.rb1
-rw-r--r--test/psych/test_scalar.rb1
-rw-r--r--test/psych/test_scalar_scanner.rb1
-rw-r--r--test/psych/test_serialize_subclasses.rb1
-rw-r--r--test/psych/test_set.rb1
-rw-r--r--test/psych/test_stream.rb1
-rw-r--r--test/psych/test_string.rb75
-rw-r--r--test/psych/test_struct.rb1
-rw-r--r--test/psych/test_symbol.rb9
-rw-r--r--test/psych/test_tainted.rb1
-rw-r--r--test/psych/test_to_yaml_properties.rb3
-rw-r--r--test/psych/test_tree_builder.rb1
-rw-r--r--test/psych/test_yaml.rb8
-rw-r--r--test/psych/test_yamldbm.rb6
-rw-r--r--test/psych/test_yamlstore.rb3
-rw-r--r--test/psych/visitors/test_depth_first.rb1
-rw-r--r--test/psych/visitors/test_emitter.rb1
-rw-r--r--test/psych/visitors/test_to_ruby.rb24
-rw-r--r--test/psych/visitors/test_yaml_tree.rb7
-rw-r--r--test/rake/file_creation.rb34
-rw-r--r--test/rake/helper.rb128
-rw-r--r--test/rake/support/rakefile_definitions.rb444
-rw-r--r--test/rake/support/ruby_runner.rb33
-rw-r--r--test/rake/test_private_reader.rb42
-rw-r--r--test/rake/test_rake.rb40
-rw-r--r--test/rake/test_rake_application.rb517
-rw-r--r--test/rake/test_rake_application_options.rb457
-rw-r--r--test/rake/test_rake_backtrace.rb113
-rw-r--r--test/rake/test_rake_clean.rb52
-rw-r--r--test/rake/test_rake_definitions.rb79
-rw-r--r--test/rake/test_rake_directory_task.rb57
-rw-r--r--test/rake/test_rake_dsl.rb40
-rw-r--r--test/rake/test_rake_early_time.rb31
-rw-r--r--test/rake/test_rake_extension.rb59
-rw-r--r--test/rake/test_rake_file_creation_task.rb56
-rw-r--r--test/rake/test_rake_file_list.rb627
-rw-r--r--test/rake/test_rake_file_list_path_map.rb8
-rw-r--r--test/rake/test_rake_file_task.rb122
-rw-r--r--test/rake/test_rake_file_utils.rb309
-rw-r--r--test/rake/test_rake_ftp_file.rb74
-rw-r--r--test/rake/test_rake_functional.rb466
-rw-r--r--test/rake/test_rake_invocation_chain.rb64
-rw-r--r--test/rake/test_rake_linked_list.rb84
-rw-r--r--test/rake/test_rake_makefile_loader.rb46
-rw-r--r--test/rake/test_rake_multi_task.rb58
-rw-r--r--test/rake/test_rake_name_space.rb43
-rw-r--r--test/rake/test_rake_package_task.rb79
-rw-r--r--test/rake/test_rake_path_map.rb168
-rw-r--r--test/rake/test_rake_path_map_explode.rb34
-rw-r--r--test/rake/test_rake_path_map_partial.rb18
-rw-r--r--test/rake/test_rake_pseudo_status.rb21
-rw-r--r--test/rake/test_rake_rake_test_loader.rb20
-rw-r--r--test/rake/test_rake_reduce_compat.rb26
-rw-r--r--test/rake/test_rake_require.rb40
-rw-r--r--test/rake/test_rake_rules.rb362
-rw-r--r--test/rake/test_rake_scope.rb44
-rw-r--r--test/rake/test_rake_task.rb376
-rw-r--r--test/rake/test_rake_task_argument_parsing.rb103
-rw-r--r--test/rake/test_rake_task_arguments.rb121
-rw-r--r--test/rake/test_rake_task_lib.rb9
-rw-r--r--test/rake/test_rake_task_manager.rb158
-rw-r--r--test/rake/test_rake_task_manager_argument_resolution.rb19
-rw-r--r--test/rake/test_rake_task_with_arguments.rb171
-rw-r--r--test/rake/test_rake_test_task.rb119
-rw-r--r--test/rake/test_rake_thread_pool.rb142
-rw-r--r--test/rake/test_rake_top_level_functions.rb71
-rw-r--r--test/rake/test_rake_win32.rb72
-rw-r--r--test/rake/test_thread_history_display.rb101
-rw-r--r--test/rake/test_trace_output.rb52
-rw-r--r--test/rdoc/test.ja.large.rdoc3
-rw-r--r--test/rdoc/test_attribute_manager.rb120
-rw-r--r--test/rdoc/test_rdoc_alias.rb1
-rw-r--r--test/rdoc/test_rdoc_any_method.rb30
-rw-r--r--test/rdoc/test_rdoc_attr.rb1
-rw-r--r--test/rdoc/test_rdoc_class_module.rb1
-rw-r--r--test/rdoc/test_rdoc_code_object.rb1
-rw-r--r--test/rdoc/test_rdoc_comment.rb1
-rw-r--r--test/rdoc/test_rdoc_constant.rb31
-rw-r--r--test/rdoc/test_rdoc_context.rb3
-rw-r--r--test/rdoc/test_rdoc_context_section.rb1
-rw-r--r--test/rdoc/test_rdoc_cross_reference.rb1
-rw-r--r--test/rdoc/test_rdoc_encoding.rb24
-rw-r--r--test/rdoc/test_rdoc_extend.rb1
-rw-r--r--test/rdoc/test_rdoc_generator_darkfish.rb5
-rw-r--r--test/rdoc/test_rdoc_generator_json_index.rb61
-rw-r--r--test/rdoc/test_rdoc_generator_markup.rb3
-rw-r--r--test/rdoc/test_rdoc_generator_pot.rb92
-rw-r--r--test/rdoc/test_rdoc_generator_pot_po.rb52
-rw-r--r--test/rdoc/test_rdoc_generator_pot_po_entry.rb140
-rw-r--r--test/rdoc/test_rdoc_generator_ri.rb1
-rw-r--r--test/rdoc/test_rdoc_i18n_locale.rb74
-rw-r--r--test/rdoc/test_rdoc_i18n_text.rb124
-rw-r--r--test/rdoc/test_rdoc_include.rb1
-rw-r--r--test/rdoc/test_rdoc_markdown.rb1
-rw-r--r--test/rdoc/test_rdoc_markdown_test.rb1
-rw-r--r--test/rdoc/test_rdoc_markup.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_attribute_manager.rb7
-rw-r--r--test/rdoc/test_rdoc_markup_attributes.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_document.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_formatter.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_hard_break.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_heading.rb9
-rw-r--r--test/rdoc/test_rdoc_markup_include.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_indented_paragraph.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_paragraph.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_parser.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_pre_process.rb3
-rw-r--r--test/rdoc/test_rdoc_markup_raw.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_ansi.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_bs.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb72
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_snippet.rb16
-rw-r--r--test/rdoc/test_rdoc_markup_to_joined_paragraph.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_label.rb9
-rw-r--r--test/rdoc/test_rdoc_markup_to_markdown.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_rdoc.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_table_of_contents.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_to_tt_only.rb1
-rw-r--r--test/rdoc/test_rdoc_markup_verbatim.rb1
-rw-r--r--test/rdoc/test_rdoc_method_attr.rb33
-rw-r--r--test/rdoc/test_rdoc_normal_class.rb9
-rw-r--r--test/rdoc/test_rdoc_normal_module.rb1
-rw-r--r--test/rdoc/test_rdoc_options.rb20
-rw-r--r--test/rdoc/test_rdoc_parser.rb28
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb74
-rw-r--r--test/rdoc/test_rdoc_parser_changelog.rb3
-rw-r--r--test/rdoc/test_rdoc_parser_markdown.rb3
-rw-r--r--test/rdoc/test_rdoc_parser_rd.rb3
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb63
-rw-r--r--test/rdoc/test_rdoc_parser_simple.rb3
-rw-r--r--test/rdoc/test_rdoc_rd.rb1
-rw-r--r--test/rdoc/test_rdoc_rd_block_parser.rb5
-rw-r--r--test/rdoc/test_rdoc_rd_inline.rb1
-rw-r--r--test/rdoc/test_rdoc_rd_inline_parser.rb1
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb28
-rw-r--r--test/rdoc/test_rdoc_require.rb1
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb1
-rw-r--r--test/rdoc/test_rdoc_ri_paths.rb1
-rw-r--r--test/rdoc/test_rdoc_ruby_lex.rb12
-rw-r--r--test/rdoc/test_rdoc_ruby_token.rb1
-rw-r--r--test/rdoc/test_rdoc_rubygems_hook.rb4
-rw-r--r--test/rdoc/test_rdoc_servlet.rb4
-rw-r--r--test/rdoc/test_rdoc_single_class.rb19
-rw-r--r--test/rdoc/test_rdoc_stats.rb56
-rw-r--r--test/rdoc/test_rdoc_store.rb1
-rw-r--r--test/rdoc/test_rdoc_task.rb58
-rw-r--r--test/rdoc/test_rdoc_text.rb4
-rw-r--r--test/rdoc/test_rdoc_token_stream.rb1
-rw-r--r--test/rdoc/test_rdoc_tom_doc.rb1
-rw-r--r--test/rdoc/test_rdoc_top_level.rb1
-rw-r--r--test/rdoc/xref_data.rb1
-rw-r--r--test/rdoc/xref_test_case.rb1
-rw-r--r--test/readline/test_readline.rb18
-rw-r--r--test/readline/test_readline_history.rb1
-rw-r--r--test/resolv/test_addr.rb14
-rw-r--r--test/resolv/test_dns.rb205
-rw-r--r--test/resolv/test_resource.rb22
-rw-r--r--test/rexml/data/ticket_110_utf16.xml (renamed from test/rexml/data/utf16.xml)bin207464 -> 207464 bytes-rw-r--r--test/rexml/data/tutorial.xml2
-rw-r--r--test/rexml/listener.rb95
-rw-r--r--test/rexml/parse/test_document_type_declaration.rb57
-rw-r--r--test/rexml/parse/test_notation_declaration.rb119
-rw-r--r--test/rexml/parser/test_sax2.rb3
-rw-r--r--test/rexml/parser/test_stream.rb32
-rw-r--r--test/rexml/parser/test_tree.rb3
-rw-r--r--test/rexml/parser/test_ultra_light.rb3
-rw-r--r--test/rexml/rexml_test_utils.rb1
-rw-r--r--test/rexml/test_attributes.rb343
-rw-r--r--test/rexml/test_attributes_mixin.rb49
-rw-r--r--test/rexml/test_changing_encoding.rb68
-rw-r--r--test/rexml/test_comment.rb3
-rw-r--r--test/rexml/test_contrib.rb882
-rw-r--r--test/rexml/test_core.rb2458
-rw-r--r--test/rexml/test_doctype.rb191
-rw-r--r--test/rexml/test_document.rb475
-rw-r--r--test/rexml/test_elements.rb197
-rw-r--r--test/rexml/test_encoding.rb162
-rw-r--r--test/rexml/test_encoding_2.rb59
-rw-r--r--test/rexml/test_entity.rb329
-rw-r--r--test/rexml/test_functions.rb415
-rw-r--r--test/rexml/test_functions_number.rb53
-rw-r--r--test/rexml/test_jaxen.rb210
-rw-r--r--test/rexml/test_light.rb171
-rw-r--r--test/rexml/test_lightparser.rb18
-rw-r--r--test/rexml/test_listener.rb202
-rw-r--r--test/rexml/test_martin_fowler.rb41
-rw-r--r--test/rexml/test_namespace.rb55
-rw-r--r--test/rexml/test_order.rb175
-rw-r--r--test/rexml/test_preceding_sibling.rb57
-rw-r--r--test/rexml/test_pullparser.rb161
-rw-r--r--test/rexml/test_rexml_issuezilla.rb21
-rw-r--r--test/rexml/test_sax.rb484
-rw-r--r--test/rexml/test_stream.rb195
-rw-r--r--test/rexml/test_text.rb29
-rw-r--r--test/rexml/test_ticket_80.rb47
-rw-r--r--test/rexml/test_validation_rng.rb617
-rw-r--r--test/rexml/test_xml_declaration.rb43
-rw-r--r--test/rexml/test_xpath.rb1079
-rw-r--r--test/rexml/test_xpath_attribute_query.rb89
-rw-r--r--test/rexml/test_xpath_msw.rb38
-rw-r--r--test/rexml/test_xpath_pred.rb80
-rw-r--r--test/rexml/test_xpathtext.rb72
-rw-r--r--test/rexml/xpath/test_attribute.rb30
-rw-r--r--test/rexml/xpath/test_axis_preceding_sibling.rb40
-rw-r--r--test/rexml/xpath/test_base.rb1090
-rw-r--r--test/rexml/xpath/test_node.rb43
-rw-r--r--test/rexml/xpath/test_predicate.rb83
-rw-r--r--test/rexml/xpath/test_text.rb75
-rw-r--r--test/rinda/test_rinda.rb177
-rw-r--r--test/rinda/test_tuplebag.rb1
-rw-r--r--test/ripper/dummyparser.rb9
-rw-r--r--test/ripper/test_files.rb10
-rw-r--r--test/ripper/test_filter.rb3
-rw-r--r--test/ripper/test_lexer.rb35
-rw-r--r--test/ripper/test_parser_events.rb212
-rw-r--r--test/ripper/test_ripper.rb34
-rw-r--r--test/ripper/test_scanner_events.rb36
-rw-r--r--test/ripper/test_sexp.rb85
-rw-r--r--test/rss/rss-assertions.rb3
-rw-r--r--test/rss/rss-testcase.rb1
-rw-r--r--test/rss/test_1.0.rb1
-rw-r--r--test/rss/test_2.0.rb1
-rw-r--r--test/rss/test_accessor.rb1
-rw-r--r--test/rss/test_atom.rb1
-rw-r--r--test/rss/test_content.rb1
-rw-r--r--test/rss/test_dublincore.rb1
-rw-r--r--test/rss/test_image.rb1
-rw-r--r--test/rss/test_inherit.rb1
-rw-r--r--test/rss/test_itunes.rb1
-rw-r--r--test/rss/test_maker_0.9.rb1
-rw-r--r--test/rss/test_maker_1.0.rb1
-rw-r--r--test/rss/test_maker_2.0.rb1
-rw-r--r--test/rss/test_maker_atom_entry.rb1
-rw-r--r--test/rss/test_maker_atom_feed.rb1
-rw-r--r--test/rss/test_maker_content.rb1
-rw-r--r--test/rss/test_maker_dc.rb1
-rw-r--r--test/rss/test_maker_image.rb1
-rw-r--r--test/rss/test_maker_itunes.rb5
-rw-r--r--test/rss/test_maker_slash.rb1
-rw-r--r--test/rss/test_maker_sy.rb1
-rw-r--r--test/rss/test_maker_taxo.rb1
-rw-r--r--test/rss/test_maker_trackback.rb1
-rw-r--r--test/rss/test_maker_xml-stylesheet.rb1
-rw-r--r--test/rss/test_parser.rb1
-rw-r--r--test/rss/test_parser_1.0.rb1
-rw-r--r--test/rss/test_parser_2.0.rb1
-rw-r--r--test/rss/test_parser_atom_entry.rb1
-rw-r--r--test/rss/test_parser_atom_feed.rb1
-rw-r--r--test/rss/test_setup_maker_0.9.rb1
-rw-r--r--test/rss/test_setup_maker_1.0.rb1
-rw-r--r--test/rss/test_setup_maker_2.0.rb1
-rw-r--r--test/rss/test_setup_maker_atom_entry.rb1
-rw-r--r--test/rss/test_setup_maker_atom_feed.rb1
-rw-r--r--test/rss/test_setup_maker_itunes.rb2
-rw-r--r--test/rss/test_setup_maker_slash.rb1
-rw-r--r--test/rss/test_slash.rb1
-rw-r--r--test/rss/test_syndication.rb1
-rw-r--r--test/rss/test_taxonomy.rb1
-rw-r--r--test/rss/test_to_s.rb31
-rw-r--r--test/rss/test_trackback.rb1
-rw-r--r--test/rss/test_version.rb1
-rw-r--r--test/rss/test_xml-stylesheet.rb1
-rw-r--r--test/ruby/allpairs.rb1
-rw-r--r--test/ruby/beginmainend.rb5
-rw-r--r--test/ruby/bug-11928.rb14
-rw-r--r--test/ruby/bug-13526.rb20
-rw-r--r--test/ruby/enc/test_big5.rb1
-rw-r--r--test/ruby/enc/test_cp949.rb1
-rw-r--r--test/ruby/enc/test_emoji.rb7
-rw-r--r--test/ruby/enc/test_euc_jp.rb1
-rw-r--r--test/ruby/enc/test_euc_kr.rb9
-rw-r--r--test/ruby/enc/test_euc_tw.rb1
-rw-r--r--test/ruby/enc/test_gb18030.rb1
-rw-r--r--test/ruby/enc/test_gbk.rb1
-rw-r--r--test/ruby/enc/test_iso_8859.rb1
-rw-r--r--test/ruby/enc/test_koi8.rb1
-rw-r--r--test/ruby/enc/test_shift_jis.rb1
-rw-r--r--test/ruby/enc/test_utf16.rb9
-rw-r--r--test/ruby/enc/test_utf32.rb69
-rw-r--r--test/ruby/enc/test_windows_1251.rb1
-rw-r--r--test/ruby/enc/test_windows_1252.rb26
-rw-r--r--test/ruby/endblockwarn_rb12
-rw-r--r--test/ruby/envutil.rb448
-rw-r--r--test/ruby/lbtest.rb3
-rw-r--r--test/ruby/marshaltestlib.rb1
-rw-r--r--test/ruby/memory_status.rb (renamed from test/lib/memory_status.rb)80
-rw-r--r--test/ruby/sentence.rb1
-rw-r--r--test/ruby/test_alias.rb84
-rw-r--r--test/ruby/test_argf.rb71
-rw-r--r--test/ruby/test_arity.rb47
-rw-r--r--test/ruby/test_array.rb403
-rw-r--r--test/ruby/test_assignment.rb74
-rw-r--r--test/ruby/test_autoload.rb152
-rw-r--r--test/ruby/test_backtrace.rb164
-rw-r--r--test/ruby/test_basicinstructions.rb1
-rw-r--r--test/ruby/test_beginendblock.rb182
-rw-r--r--test/ruby/test_bignum.rb15
-rw-r--r--test/ruby/test_call.rb82
-rw-r--r--test/ruby/test_case.rb42
-rw-r--r--test/ruby/test_class.rb219
-rw-r--r--test/ruby/test_clone.rb1
-rw-r--r--test/ruby/test_comparable.rb17
-rw-r--r--test/ruby/test_complex.rb459
-rw-r--r--test/ruby/test_complex2.rb1
-rw-r--r--test/ruby/test_complexrational.rb13
-rw-r--r--test/ruby/test_condition.rb1
-rw-r--r--test/ruby/test_const.rb20
-rw-r--r--test/ruby/test_continuation.rb4
-rw-r--r--test/ruby/test_defined.rb48
-rw-r--r--test/ruby/test_dir.rb111
-rw-r--r--test/ruby/test_dir_m17n.rb131
-rw-r--r--test/ruby/test_econv.rb22
-rw-r--r--test/ruby/test_encoding.rb15
-rw-r--r--test/ruby/test_enum.rb432
-rw-r--r--test/ruby/test_enumerator.rb53
-rw-r--r--test/ruby/test_env.rb101
-rw-r--r--test/ruby/test_eval.rb69
-rw-r--r--test/ruby/test_exception.rb433
-rw-r--r--test/ruby/test_extlibs.rb87
-rw-r--r--test/ruby/test_fiber.rb23
-rw-r--r--test/ruby/test_file.rb93
-rw-r--r--test/ruby/test_file_exhaustive.rb1155
-rw-r--r--test/ruby/test_fixnum.rb91
-rw-r--r--test/ruby/test_flip.rb2
-rw-r--r--test/ruby/test_float.rb169
-rw-r--r--test/ruby/test_fnmatch.rb2
-rw-r--r--test/ruby/test_gc.rb247
-rw-r--r--test/ruby/test_hash.rb359
-rw-r--r--test/ruby/test_ifunless.rb1
-rw-r--r--test/ruby/test_integer.rb19
-rw-r--r--test/ruby/test_integer_comb.rb15
-rw-r--r--test/ruby/test_io.rb839
-rw-r--r--test/ruby/test_io_m17n.rb165
-rw-r--r--test/ruby/test_iseq.rb136
-rw-r--r--test/ruby/test_iterator.rb1
-rw-r--r--test/ruby/test_keyword.rb245
-rw-r--r--test/ruby/test_lambda.rb51
-rw-r--r--test/ruby/test_lazy_enumerator.rb59
-rw-r--r--test/ruby/test_literal.rb73
-rw-r--r--test/ruby/test_m17n.rb247
-rw-r--r--test/ruby/test_m17n_comb.rb237
-rw-r--r--test/ruby/test_marshal.rb176
-rw-r--r--test/ruby/test_math.rb172
-rw-r--r--test/ruby/test_metaclass.rb1
-rw-r--r--test/ruby/test_method.rb407
-rw-r--r--test/ruby/test_mixed_unicode_escapes.rb3
-rw-r--r--test/ruby/test_module.rb536
-rw-r--r--test/ruby/test_not.rb1
-rw-r--r--test/ruby/test_notimp.rb1
-rw-r--r--test/ruby/test_numeric.rb242
-rw-r--r--test/ruby/test_object.rb130
-rw-r--r--test/ruby/test_objectspace.rb115
-rw-r--r--test/ruby/test_optimization.rb378
-rw-r--r--test/ruby/test_pack.rb127
-rw-r--r--test/ruby/test_parse.rb107
-rw-r--r--test/ruby/test_path.rb4
-rw-r--r--test/ruby/test_pipe.rb14
-rw-r--r--test/ruby/test_primitive.rb5
-rw-r--r--test/ruby/test_proc.rb116
-rw-r--r--test/ruby/test_process.rb770
-rw-r--r--test/ruby/test_rand.rb34
-rw-r--r--test/ruby/test_range.rb165
-rw-r--r--test/ruby/test_rational.rb408
-rw-r--r--test/ruby/test_rational2.rb1
-rw-r--r--test/ruby/test_readpartial.rb9
-rw-r--r--test/ruby/test_refinement.rb622
-rw-r--r--test/ruby/test_regexp.rb116
-rw-r--r--test/ruby/test_require.rb143
-rw-r--r--test/ruby/test_rubyoptions.rb320
-rw-r--r--test/ruby/test_rubyvm.rb18
-rw-r--r--test/ruby/test_settracefunc.rb650
-rw-r--r--test/ruby/test_signal.rb86
-rw-r--r--test/ruby/test_sleep.rb15
-rw-r--r--test/ruby/test_sprintf.rb123
-rw-r--r--test/ruby/test_sprintf_comb.rb1
-rw-r--r--test/ruby/test_string.rb215
-rw-r--r--test/ruby/test_stringchar.rb9
-rw-r--r--test/ruby/test_struct.rb126
-rw-r--r--test/ruby/test_super.rb173
-rw-r--r--test/ruby/test_symbol.rb215
-rw-r--r--test/ruby/test_syntax.rb455
-rw-r--r--test/ruby/test_system.rb4
-rw-r--r--test/ruby/test_thread.rb330
-rw-r--r--test/ruby/test_threadgroup.rb11
-rw-r--r--test/ruby/test_time.rb102
-rw-r--r--test/ruby/test_time_tz.rb174
-rw-r--r--test/ruby/test_trace.rb16
-rw-r--r--test/ruby/test_transcode.rb64
-rw-r--r--test/ruby/test_undef.rb1
-rw-r--r--test/ruby/test_unicode_escape.rb2
-rw-r--r--test/ruby/test_variable.rb62
-rw-r--r--test/ruby/test_weakmap.rb134
-rw-r--r--test/ruby/test_whileuntil.rb10
-rw-r--r--test/ruby/test_yield.rb50
-rw-r--r--test/ruby/ut_eof.rb5
-rw-r--r--test/rubygems/bad_rake.rb1
-rw-r--r--test/rubygems/bogussources.rb1
-rw-r--r--test/rubygems/fake_certlib/openssl.rb1
-rw-r--r--test/rubygems/fix_openssl_warnings.rb1
-rw-r--r--test/rubygems/foo/discover.rb1
-rw-r--r--test/rubygems/good_rake.rb1
-rw-r--r--test/rubygems/plugin/exception/rubygems_plugin.rb1
-rw-r--r--test/rubygems/plugin/load/rubygems_plugin.rb1
-rw-r--r--test/rubygems/plugin/standarderror/rubygems_plugin.rb1
-rw-r--r--test/rubygems/rubygems/commands/crash_command.rb1
-rw-r--r--test/rubygems/rubygems_plugin.rb1
-rw-r--r--test/rubygems/sff/discover.rb1
-rw-r--r--test/rubygems/simple_gem.rb3
-rw-r--r--test/rubygems/specifications/foo-0.0.1.gemspec (renamed from test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec)bin269 -> 269 bytes-rw-r--r--test/rubygems/test_bundled_ca.rb79
-rw-r--r--test/rubygems/test_config.rb12
-rw-r--r--test/rubygems/test_deprecate.rb1
-rw-r--r--test/rubygems/test_gem.rb441
-rw-r--r--test/rubygems/test_gem_available_set.rb26
-rw-r--r--test/rubygems/test_gem_command.rb56
-rw-r--r--test/rubygems/test_gem_command_manager.rb1
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb11
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_check_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb12
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb58
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb11
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb198
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_lock_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb14
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb53
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb129
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb28
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb299
-rw-r--r--test/rubygems/test_gem_commands_search_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_server_command.rb5
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb25
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb9
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb3
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb46
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb15
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb141
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb27
-rw-r--r--test/rubygems/test_gem_config_file.rb52
-rw-r--r--test/rubygems/test_gem_dependency.rb147
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb276
-rw-r--r--test/rubygems/test_gem_dependency_list.rb1
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb1
-rw-r--r--test/rubygems/test_gem_doctor.rb3
-rw-r--r--test/rubygems/test_gem_ext_builder.rb98
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb3
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb13
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb101
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb1
-rw-r--r--test/rubygems/test_gem_gem_runner.rb1
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb10
-rw-r--r--test/rubygems/test_gem_impossible_dependencies_error.rb33
-rw-r--r--test/rubygems/test_gem_indexer.rb9
-rw-r--r--test/rubygems/test_gem_install_update_options.rb51
-rw-r--r--test/rubygems/test_gem_installer.rb202
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb14
-rw-r--r--test/rubygems/test_gem_name_tuple.rb8
-rw-r--r--test/rubygems/test_gem_package.rb81
-rw-r--r--test/rubygems/test_gem_package_old.rb1
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb17
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb13
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb31
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb29
-rw-r--r--test/rubygems/test_gem_package_task.rb8
-rw-r--r--test/rubygems/test_gem_path_support.rb1
-rw-r--r--test/rubygems/test_gem_platform.rb18
-rw-r--r--test/rubygems/test_gem_rdoc.rb1
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb255
-rw-r--r--test/rubygems/test_gem_request.rb164
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb130
-rw-r--r--test/rubygems/test_gem_request_set.rb382
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb296
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb376
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb549
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_tokenizer.rb306
-rw-r--r--test/rubygems/test_gem_requirement.rb31
-rw-r--r--test/rubygems/test_gem_resolver.rb215
-rw-r--r--test/rubygems/test_gem_resolver_activation_request.rb11
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb46
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb81
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb108
-rw-r--r--test/rubygems/test_gem_resolver_composed_set.rb46
-rw-r--r--test/rubygems/test_gem_resolver_conflict.rb33
-rw-r--r--test/rubygems/test_gem_resolver_dependency_request.rb65
-rw-r--r--test/rubygems/test_gem_resolver_git_set.rb96
-rw-r--r--test/rubygems/test_gem_resolver_git_specification.rb78
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb62
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb23
-rw-r--r--test/rubygems/test_gem_resolver_installed_specification.rb38
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb236
-rw-r--r--test/rubygems/test_gem_resolver_local_specification.rb46
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb24
-rw-r--r--test/rubygems/test_gem_resolver_lock_specification.rb100
-rw-r--r--test/rubygems/test_gem_resolver_requirement_list.rb8
-rw-r--r--test/rubygems/test_gem_resolver_specification.rb65
-rw-r--r--test/rubygems/test_gem_resolver_vendor_set.rb23
-rw-r--r--test/rubygems/test_gem_resolver_vendor_specification.rb13
-rw-r--r--test/rubygems/test_gem_security.rb1
-rw-r--r--test/rubygems/test_gem_security_policy.rb5
-rw-r--r--test/rubygems/test_gem_security_signer.rb1
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb3
-rw-r--r--test/rubygems/test_gem_server.rb78
-rw-r--r--test/rubygems/test_gem_silent_ui.rb6
-rw-r--r--test/rubygems/test_gem_source.rb33
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb1
-rw-r--r--test/rubygems/test_gem_source_git.rb132
-rw-r--r--test/rubygems/test_gem_source_installed.rb9
-rw-r--r--test/rubygems/test_gem_source_list.rb1
-rw-r--r--test/rubygems/test_gem_source_local.rb1
-rw-r--r--test/rubygems/test_gem_source_lock.rb115
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb5
-rw-r--r--test/rubygems/test_gem_source_vendor.rb5
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb1
-rw-r--r--test/rubygems/test_gem_specification.rb987
-rw-r--r--test/rubygems/test_gem_stream_ui.rb13
-rw-r--r--test/rubygems/test_gem_stub_specification.rb132
-rw-r--r--test/rubygems/test_gem_text.rb30
-rw-r--r--test/rubygems/test_gem_uninstaller.rb52
-rw-r--r--test/rubygems/test_gem_unsatisfiable_dependency_error.rb33
-rw-r--r--test/rubygems/test_gem_uri_formatter.rb1
-rw-r--r--test/rubygems/test_gem_util.rb27
-rw-r--r--test/rubygems/test_gem_validator.rb10
-rw-r--r--test/rubygems/test_gem_version.rb11
-rw-r--r--test/rubygems/test_gem_version_option.rb1
-rw-r--r--test/rubygems/test_kernel.rb31
-rw-r--r--test/rubygems/test_require.rb357
-rw-r--r--test/runner.rb32
-rw-r--r--test/scanf/test_scanf.rb39
-rw-r--r--test/scanf/test_scanfblocks.rb1
-rw-r--r--test/scanf/test_scanfio.rb1
-rw-r--r--test/sdbm/test_sdbm.rb4
-rw-r--r--test/shell/test_command_processor.rb2
-rw-r--r--test/socket/test_addrinfo.rb26
-rw-r--r--test/socket/test_ancdata.rb2
-rw-r--r--test/socket/test_basicsocket.rb89
-rw-r--r--test/socket/test_nonblock.rb117
-rw-r--r--test/socket/test_socket.rb184
-rw-r--r--test/socket/test_sockopt.rb29
-rw-r--r--test/socket/test_tcp.rb63
-rw-r--r--test/socket/test_udp.rb33
-rw-r--r--test/socket/test_unix.rb249
-rw-r--r--test/stringio/test_stringio.rb125
-rw-r--r--test/strscan/test_stringscanner.rb14
-rw-r--r--test/syslog/test_syslog_logger.rb1
-rw-r--r--test/test_abbrev.rb1
-rw-r--r--test/test_cmath.rb68
-rw-r--r--test/test_curses.rb74
-rw-r--r--test/test_delegate.rb70
-rw-r--r--test/test_find.rb56
-rw-r--r--test/test_forwardable.rb296
-rw-r--r--test/test_ipaddr.rb277
-rw-r--r--test/test_mathn.rb18
-rw-r--r--test/test_mutex_m.rb1
-rw-r--r--test/test_observer.rb66
-rw-r--r--test/test_open3.rb46
-rw-r--r--test/test_pp.rb58
-rw-r--r--test/test_prettyprint.rb14
-rw-r--r--test/test_prime.rb119
-rw-r--r--test/test_pstore.rb22
-rw-r--r--test/test_pty.rb46
-rw-r--r--test/test_rbconfig.rb1
-rw-r--r--test/test_securerandom.rb30
-rw-r--r--test/test_set.rb216
-rw-r--r--test/test_shellwords.rb73
-rw-r--r--test/test_singleton.rb13
-rw-r--r--test/test_syslog.rb113
-rw-r--r--test/test_tempfile.rb43
-rw-r--r--test/test_time.rb302
-rw-r--r--test/test_timeout.rb72
-rw-r--r--test/test_tmpdir.rb26
-rw-r--r--test/test_tracer.rb11
-rw-r--r--test/test_tsort.rb15
-rw-r--r--test/test_unicode_normalize.rb185
-rw-r--r--test/test_weakref.rb38
-rw-r--r--test/test_win32api.rb24
-rw-r--r--test/testunit/test4test_hideskip.rb3
-rw-r--r--test/testunit/test4test_redefinition.rb3
-rw-r--r--test/testunit/test4test_sorting.rb3
-rw-r--r--test/testunit/test_assertion.rb1
-rw-r--r--test/testunit/test_hideskip.rb3
-rw-r--r--test/testunit/test_parallel.rb45
-rw-r--r--test/testunit/test_rake_integration.rb35
-rw-r--r--test/testunit/test_redefinition.rb5
-rw-r--r--test/testunit/test_sorting.rb3
-rw-r--r--test/testunit/tests_for_parallel/ptest_first.rb1
-rw-r--r--test/testunit/tests_for_parallel/ptest_forth.rb9
-rw-r--r--test/testunit/tests_for_parallel/ptest_second.rb1
-rw-r--r--test/testunit/tests_for_parallel/ptest_third.rb1
-rw-r--r--test/testunit/tests_for_parallel/runner.rb4
-rw-r--r--test/thread/test_cv.rb37
-rw-r--r--test/thread/test_queue.rb411
-rw-r--r--test/thread/test_sync.rb7
-rw-r--r--test/uri/test_common.rb60
-rw-r--r--test/uri/test_ftp.rb1
-rw-r--r--test/uri/test_generic.rb71
-rw-r--r--test/uri/test_http.rb1
-rw-r--r--test/uri/test_ldap.rb1
-rw-r--r--test/uri/test_mailto.rb81
-rw-r--r--test/uri/test_parser.rb7
-rw-r--r--test/webrick/test_cgi.rb45
-rw-r--r--test/webrick/test_cookie.rb1
-rw-r--r--test/webrick/test_do_not_reverse_lookup.rb71
-rw-r--r--test/webrick/test_filehandler.rb68
-rw-r--r--test/webrick/test_htmlutils.rb1
-rw-r--r--test/webrick/test_httpauth.rb72
-rw-r--r--test/webrick/test_httpproxy.rb7
-rw-r--r--test/webrick/test_httprequest.rb3
-rw-r--r--test/webrick/test_httpresponse.rb91
-rw-r--r--test/webrick/test_httpserver.rb125
-rw-r--r--test/webrick/test_httputils.rb1
-rw-r--r--test/webrick/test_httpversion.rb1
-rw-r--r--test/webrick/test_server.rb112
-rw-r--r--test/webrick/test_ssl_server.rb60
-rw-r--r--test/webrick/test_utils.rb91
-rw-r--r--test/webrick/utils.rb55
-rw-r--r--test/webrick/webrick.cgi6
-rw-r--r--test/webrick/webrick_long_filename.cgi2
-rw-r--r--test/win32ole/err_in_callback.rb1
-rw-r--r--test/win32ole/test_err_in_callback.rb5
-rw-r--r--test/win32ole/test_folderitem2_invokeverb.rb1
-rw-r--r--test/win32ole/test_nil2vtempty.rb1
-rw-r--r--test/win32ole/test_ole_methods.rb1
-rw-r--r--test/win32ole/test_propertyputref.rb1
-rw-r--r--test/win32ole/test_thread.rb1
-rw-r--r--test/win32ole/test_win32ole.rb48
-rw-r--r--test/win32ole/test_win32ole_event.rb169
-rw-r--r--test/win32ole/test_win32ole_method.rb9
-rw-r--r--test/win32ole/test_win32ole_param.rb1
-rw-r--r--test/win32ole/test_win32ole_record.rb213
-rw-r--r--test/win32ole/test_win32ole_type.rb1
-rw-r--r--test/win32ole/test_win32ole_typelib.rb3
-rw-r--r--test/win32ole/test_win32ole_variable.rb1
-rw-r--r--test/win32ole/test_win32ole_variant.rb86
-rw-r--r--test/win32ole/test_win32ole_variant_m.rb1
-rw-r--r--test/win32ole/test_win32ole_variant_outarg.rb3
-rw-r--r--test/win32ole/test_word.rb18
-rw-r--r--test/with_different_ofs.rb (renamed from test/lib/with_different_ofs.rb)1
-rw-r--r--test/xmlrpc/test_client.rb19
-rw-r--r--test/xmlrpc/test_cookie.rb22
-rw-r--r--test/xmlrpc/test_datetime.rb1
-rw-r--r--test/xmlrpc/test_features.rb5
-rw-r--r--test/xmlrpc/test_marshal.rb1
-rw-r--r--test/xmlrpc/test_parser.rb1
-rw-r--r--test/xmlrpc/test_webrick_server.rb35
-rw-r--r--test/xmlrpc/webrick_testing.rb36
-rw-r--r--test/zlib/test_zlib.rb66
-rw-r--r--thread.c1723
-rw-r--r--thread_native.h23
-rw-r--r--thread_pthread.c668
-rw-r--r--thread_pthread.h12
-rw-r--r--thread_sync.c1313
-rw-r--r--thread_win32.c99
-rw-r--r--thread_win32.h9
-rw-r--r--time.c364
-rw-r--r--timev.h20
-rwxr-xr-xtool/bisect.sh2
-rwxr-xr-xtool/checksum.rb72
-rw-r--r--tool/compile_prelude.rb (renamed from template/prelude.c.tmpl)125
-rw-r--r--tool/config_files.rb8
-rw-r--r--tool/downloader.rb200
-rwxr-xr-xtool/enc-unicode.rb104
-rwxr-xr-xtool/expand-config.rb33
-rwxr-xr-xtool/extlibs.rb143
-rw-r--r--tool/fake.rb64
-rwxr-xr-xtool/file2lastrev.rb63
-rwxr-xr-xtool/gem-unpack.rb15
-rw-r--r--tool/generic_erb.rb21
-rwxr-xr-xtool/get-config_files7
-rwxr-xr-xtool/ifchange30
-rwxr-xr-xtool/instruction.rb19
-rwxr-xr-xtool/make-snapshot241
-rw-r--r--tool/make_hgraph.rb95
-rwxr-xr-xtool/mdoc2man.rb8
-rwxr-xr-xtool/merger.rb99
-rw-r--r--tool/mk_call_iseq_optimized.rb72
-rwxr-xr-xtool/mkconfig.rb65
-rwxr-xr-xtool/mkrunnable.rb11
-rwxr-xr-xtool/rbinstall.rb295
-rwxr-xr-xtool/redmine-backporter.rb583
-rwxr-xr-xtool/release.sh38
-rwxr-xr-xtool/runruby.rb15
-rwxr-xr-xtool/strip-rdoc.rb1
-rw-r--r--tool/transcode-tblgen.rb60
-rwxr-xr-xtool/update-deps544
-rw-r--r--tool/vcs.rb294
-rw-r--r--tool/vpath.rb5
-rwxr-xr-xtool/ytab.sed26
-rw-r--r--transcode.c105
-rw-r--r--transcode_data.h30
-rw-r--r--util.c97
-rw-r--r--variable.c1504
-rw-r--r--version.c31
-rw-r--r--version.h18
-rw-r--r--vm.c1831
-rw-r--r--vm_args.c828
-rw-r--r--vm_backtrace.c213
-rw-r--r--vm_core.h747
-rw-r--r--vm_dump.c437
-rw-r--r--vm_eval.c1100
-rw-r--r--vm_exec.c22
-rw-r--r--vm_exec.h9
-rw-r--r--vm_insnhelper.c2591
-rw-r--r--vm_insnhelper.h158
-rw-r--r--vm_method.c1432
-rw-r--r--vm_opts.h13
-rw-r--r--vm_trace.c301
-rw-r--r--vsnprintf.c92
-rw-r--r--win32/Makefile.sub166
-rwxr-xr-xwin32/configure.bat56
-rw-r--r--win32/dir.h15
-rw-r--r--win32/file.c293
-rw-r--r--win32/file.h45
-rwxr-xr-xwin32/mkexports.rb6
-rwxr-xr-xwin32/resource.rb2
-rwxr-xr-xwin32/rmall.bat6
-rwxr-xr-xwin32/rmdirs.bat1
-rw-r--r--win32/rtname.cmd33
-rw-r--r--win32/setup.mak66
-rw-r--r--win32/stub.c24
-rw-r--r--win32/win32.c1632
3342 files changed, 111763 insertions, 218930 deletions
diff --git a/.document b/.document
index fb27ba325d..9a5067bc52 100644
--- a/.document
+++ b/.document
@@ -20,7 +20,9 @@ ChangeLog
NEWS
-README.md
-README.ja.md
+README
+README.EXT
+README.EXT.ja
+README.ja
doc
diff --git a/.gdbinit b/.gdbinit
index 03c2b653cb..78ab191c40 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -14,14 +14,14 @@ define ruby_gdb_init
if !$color_end
set $color_end = "\033[m"
end
- if ruby_dummy_gdb_enums.special_consts
- end
end
# set prompt \033[36m(gdb)\033[m\040
define rp
ruby_gdb_init
+ if ruby_dummy_gdb_enums.special_consts
+ end
if (VALUE)($arg0) & RUBY_FIXNUM_FLAG
printf "FIXNUM: %ld\n", (long)($arg0) >> 1
else
@@ -50,7 +50,7 @@ define rp
end
else
set $flags = ((struct RBasic*)($arg0))->flags
- if ($flags & RUBY_FL_PROMOTED) == RUBY_FL_PROMOTED
+ if ($flags & RUBY_FL_PROMOTED)
printf "[PROMOTED] "
end
if ($flags & RUBY_T_MASK) == RUBY_T_NONE
@@ -211,46 +211,12 @@ define rp
else
if ($flags & RUBY_T_MASK) == RUBY_T_SYMBOL
printf "%sT_SYMBOL%s: ", $color_type, $color_end
- print (struct RSymbol *)($arg0)
- set $id_type = ((struct RSymbol *)($arg0))->id & RUBY_ID_SCOPE_MASK
- if $id_type == RUBY_ID_LOCAL
- printf "l"
- else
- if $id_type == RUBY_ID_INSTANCE
- printf "i"
- else
- if $id_type == RUBY_ID_GLOBAL
- printf "G"
- else
- if $id_type == RUBY_ID_ATTRSET
- printf "a"
- else
- if $id_type == RUBY_ID_CONST
- printf "C"
- else
- if $id_type == RUBY_ID_CLASS
- printf "c"
- else
- printf "j"
- end
- end
- end
- end
- end
- end
- set $id_fstr = ((struct RSymbol *)($arg0))->fstr
- rp_string $id_fstr
+ print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_UNDEF
printf "%sT_UNDEF%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
- if ($flags & RUBY_T_MASK) == RUBY_T_IMEMO
- printf "%sT_IMEMO%s(", $color_type, $color_end
- output (enum imemo_type)(($flags>>RUBY_FL_USHIFT)&imemo_mask)
- printf "): "
- rp_imemo $arg0
- else
if ($flags & RUBY_T_MASK) == RUBY_T_NODE
printf "%sT_NODE%s(", $color_type, $color_end
output (enum node_type)(($flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
@@ -295,7 +261,6 @@ define rp
end
end
end
- end
end
document rp
Print a Ruby's VALUE.
@@ -385,9 +350,9 @@ define rp_id
end
end
printf "(%ld): ", $id
- set $str = lookup_id_str($id)
- if $str
- rp_string $str
+ rb_numtable_entry global_symbols.id_str $id
+ if $rb_numtable_rec
+ rp_string $rb_numtable_rec
else
echo undef\n
end
@@ -455,8 +420,8 @@ end
define rp_class
printf "(struct RClass *) %p", (void*)$arg0
- if ((struct RClass *)($arg0))->ptr.origin_ != $arg0
- printf " -> %p", ((struct RClass *)($arg0))->ptr.origin_
+ if ((struct RClass *)($arg0))->ptr.origin != $arg0
+ printf " -> %p", ((struct RClass *)($arg0))->ptr.origin
end
printf "\n"
rb_classname $arg0
@@ -467,40 +432,6 @@ document rp_class
Print the content of a Class/Module.
end
-define rp_imemo
- set $flags = (((struct RBasic *)($arg0))->flags >> RUBY_FL_USHIFT) & imemo_mask
- if $flags == imemo_cref
- printf "(rb_cref_t *) %p\n", (void*)$arg0
- print *(rb_cref_t *)$arg0
- else
- if $flags == imemo_svar
- printf "(struct vm_svar *) %p\n", (void*)$arg0
- print *(struct vm_svar *)$arg0
- else
- if $flags == imemo_throw_data
- printf "(struct vm_throw_data *) %p\n", (void*)$arg0
- print *(struct vm_throw_data *)$arg0
- else
- if $flags == imemo_ifunc
- printf "(struct vm_ifunc *) %p\n", (void*)$arg0
- print *(struct vm_ifunc *)$arg0
- else
- if $flags == imemo_memo
- printf "(struct MEMO *) %p\n", (void*)$arg0
- print *(struct MEMO *)$arg0
- else
- printf "(struct RIMemo *) %p\n", (void*)$arg0
- print *(struct RIMemo *)$arg0
- end
- end
- end
- end
- end
-end
-document rp_imemo
- Print the content of a memo
-end
-
define nd_type
print (enum node_type)((((NODE*)($arg0))->flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
end
@@ -779,12 +710,6 @@ define nd_tval
rp ($arg0).u2.value
end
-define nd_tree
- set $buf = (struct RString *)rb_str_buf_new(0)
- call dump_node((VALUE)($buf), rb_str_new(0, 0), 0, ($arg0))
- printf "%s\n", $buf->as.heap.ptr
-end
-
define rb_p
call rb_p($arg0)
end
@@ -806,7 +731,7 @@ define rb_numtable_entry
end
end
else
- set $rb_numtable_p = $rb_numtable_tbl->as.big.bins[st_numhash($rb_numtable_id) % $rb_numtable_tbl->num_bins]
+ set $rb_numtable_p = $rb_numtable_tbl->as.big.bins[$rb_numtable_id % $rb_numtable_tbl->num_bins]
while $rb_numtable_p
if $rb_numtable_p->key == $rb_numtable_id
set $rb_numtable_key = $rb_numtable_p->key
@@ -820,7 +745,6 @@ define rb_numtable_entry
end
define rb_id2name
- ruby_gdb_init
printf "%sID%s: ", $color_type, $color_end
rp_id $arg0
end
@@ -833,10 +757,10 @@ define rb_method_entry
set $rb_method_entry_id = (ID)$arg1
set $rb_method_entry_me = (rb_method_entry_t *)0
while !$rb_method_entry_me && $rb_method_entry_klass
- rb_numtable_entry $rb_method_entry_klass->m_tbl_wrapper->tbl $rb_method_entry_id
+ rb_numtable_entry $rb_method_entry_klass->m_tbl $rb_method_entry_id
set $rb_method_entry_me = (rb_method_entry_t *)$rb_numtable_rec
if !$rb_method_entry_me
- set $rb_method_entry_klass = (struct RClass *)RCLASS_SUPER($rb_method_entry_klass)
+ set $rb_method_entry_klass = (struct RClass *)$rb_method_entry_klass->ptr->super
end
end
if $rb_method_entry_me
@@ -865,7 +789,7 @@ define rb_ancestors
set $rb_ancestors_module = $arg0
while $rb_ancestors_module
rp_class $rb_ancestors_module
- set $rb_ancestors_module = RCLASS_SUPER($rb_ancestors_module)
+ set $rb_ancestors_module = ((struct RClass *)($rb_ancestors_module))->ptr.super
end
end
document rb_ancestors
@@ -910,16 +834,23 @@ end
define rb_ps_vm
print $ps_vm = (rb_vm_t*)$arg0
- set $ps_thread_ln = $ps_vm->living_threads.n.next
- set $ps_thread_ln_last = $ps_vm->living_threads.n.prev
- while 1
- set $ps_thread_th = (rb_thread_t *)$ps_thread_ln
- set $ps_thread = (VALUE)($ps_thread_th->self)
- rb_ps_thread $ps_thread
- if $ps_thread_ln == $ps_thread_ln_last
- loop_break
+ set $ps_threads = (st_table*)$ps_vm->living_threads
+ if $ps_threads->entries_packed
+ set $ps_threads_i = 0
+ while $ps_threads_i < $ps_threads->num_entries
+ set $ps_threads_key = (st_data_t)$ps_threads->as.packed.entries[$ps_threads_i].key
+ set $ps_threads_val = (st_data_t)$ps_threads->as.packed.entries[$ps_threads_i].val
+ rb_ps_thread $ps_threads_key $ps_threads_val
+ set $ps_threads_i = $ps_threads_i + 1
+ end
+ else
+ set $ps_threads_ptr = (st_table_entry*)$ps_threads->head
+ while $ps_threads_ptr
+ set $ps_threads_key = (st_data_t)$ps_threads_ptr->key
+ set $ps_threads_val = (st_data_t)$ps_threads_ptr->record
+ rb_ps_thread $ps_threads_key $ps_threads_val
+ set $ps_threads_ptr = (st_table_entry*)$ps_threads_ptr->fore
end
- set $ps_thread_ln = $ps_thread_ln->next
end
end
document rb_ps_vm
@@ -928,9 +859,8 @@ end
define rb_ps_thread
set $ps_thread = (struct RTypedData*)$arg0
- set $ps_thread_th = (rb_thread_t*)$ps_thread->data
- printf "* #<Thread:%p rb_thread_t:%p native_thread:%p>\n", \
- $ps_thread, $ps_thread_th, $ps_thread_th->thread_id
+ set $ps_thread_id = $arg1
+ print $ps_thread_th = (rb_thread_t*)$ps_thread->data
end
# Details: https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/MachineInstructionsTraceWithGDB
@@ -949,18 +879,3 @@ define SDR
call rb_vmdebug_stack_dump_raw_current()
end
-define rbi
- if ((LINK_ELEMENT*)$arg0)->type == ISEQ_ELEMENT_LABEL
- p *(LABEL*)$arg0
- else
- if ((LINK_ELEMENT*)$arg0)->type == ISEQ_ELEMENT_INSN
- p *(INSN*)$arg0
- else
- if ((LINK_ELEMENT*)$arg0)->type == ISEQ_ELEMENT_ADJUST
- p *(ADJUST*)$arg0
- else
- print *$arg0
- end
- end
- end
-end
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index d9785fad00..0000000000
--- a/.gitattributes
+++ /dev/null
@@ -1,5 +0,0 @@
-*.gemspec diff=ruby
-*.rb diff=ruby
-bin/* diff=ruby
-tool/update-deps diff=ruby
-tool/make-snapshot diff=ruby
diff --git a/.gitignore b/.gitignore
index 80c12594dd..9cd98beee1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,4 @@
*-*-*.def
-*-*-*.exp
-*-*-*.lib
*.a
*.bak
*.dSYM
@@ -10,13 +8,10 @@
*.inc
*.log
*.o
-*.obj
*.orig
-*.pdb
*.rej
*.sav
*.swp
-*.yarb
*~
.*-*
.*.list
@@ -28,27 +23,19 @@
.ppack
.svn
Makefile
-Makefile.old
-cygruby*.def
extconf.h
y.output
y.tab.c
# /
-/*-fake.rb
-/*.dll
-/*.exe
-/*.res
/*.pc
-/*.rc
/*_prelude.c
/COPYING.LIB
-/ChangeLog-*
+/ChangeLog-1.8.0
/ChangeLog.pre-alpha
/ChangeLog.pre1_1
/Doxyfile
/GNUmakefile
-/GNUmakefile.old
/README.atheos
/README.fat-patch
/README.v6
@@ -57,7 +44,6 @@ y.tab.c
/autom4te*.cache
/automake
/beos
-/bmlog-*
/breakpoints.gdb
/config.cache
/config.h
@@ -65,13 +51,6 @@ y.tab.c
/config.status
/config.status.lineno
/configure
-/coverage/simplecov
-/coverage/simplecov-html
-/coverage/doclie
-/coverage/.last_run.json
-/coverage/.resultset.json*
-/coverage/assets
-/coverage/index.html
/doc/capi
/enc.mk
/encdb.h
@@ -102,8 +81,6 @@ y.tab.c
/riscos
/rubicon
/ruby
-/ruby-runner
-/ruby-runner.c
/ruby-man.rd.gz
/sizes.c
/test.rb
@@ -111,44 +88,22 @@ y.tab.c
/transdb.h
/uncommon.mk
/verconf.h
-/verconf.mk
/web
/yasmdata.rb
# /benchmark/
/benchmark/bmx_*.rb
-/benchmark/fasta.output.*
-/benchmark/wc.input
-
-/enc/*.def
-/enc/*.exp
-/enc/*.lib
-/enc/unicode/data
# /enc/trans/
/enc/trans/*.c
-/enc/trans/*.def
-/enc/trans/*.exp
-/enc/trans/*.lib
-/enc/trans/.time
# /ext/
/ext/extinit.c
-# /ext/-test-/win32/dln/
-/ext/-test-/win32/dln/dlntest.exp
-/ext/-test-/win32/dln/dlntest.lib
-
# /ext/dl/callback/
/ext/dl/callback/callback-*.c
/ext/dl/callback/callback.c
-# /ext/etc/
-/ext/etc/constdefs.h
-
-# /ext/fiddle/
-/ext/fiddle/libffi-*
-
# /ext/rbconfig/
/ext/rbconfig/sizeof/sizes.c
@@ -167,9 +122,6 @@ y.tab.c
# /ext/tk/
/ext/tk/config_list
-# /gems
-/gems/*.gem
-
# /spec/
/spec/mspec
/spec/rubyspec
diff --git a/.travis.yml b/.travis.yml
index f87ffd3483..8db00587d6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,56 +18,45 @@
# Language specification.
language: c
-sudo: false
# Compilers. Several compilers are provided in Travis, so we try them all.
# The value set here is visible via $CC environment variable.
compiler:
- gcc
-
-os:
- - linux
+ - clang
# Dependencies. Some header files are missing in a Travis' worker VM, so we
# have to install them. The "1.9.1" here is OK. It is the most adopted
# version string for Debian/Ubuntu, and no dependencies have been changed so
# far since the 1.9.1 release.
before_install:
- - "CONFIG_FLAG="
- - "JOBS='-j 4'"
+ - "sudo apt-get -qq update"
+ - "sudo apt-get -qq install $CC" # upgrade if any
+install: "sudo apt-get -qq build-dep ruby1.9.1 2>/dev/null"
# Script is where the test runs. Note we just do "make test", not other tests
# like test-all, test-rubyspec. This is because they take too much time,
# enough for Travis to shut down the VM as being stalled.
before_script:
- - "uname -a"
- - "uname -r"
- - "rm -fr .ext autom4te.cache"
- - "echo $TERM"
- - "make -f common.mk BASERUBY=ruby MAKEDIRS='mkdir -p' srcdir=. update-config_files"
+ - "make -f common.mk BASERUBY=ruby srcdir=. update-config_files"
- "autoconf"
- "mkdir config_1st config_2nd"
- - "./configure -C --disable-install-doc --with-gcc=$CC $CONFIG_FLAG"
+ - "./configure -C --with-gcc=$CC"
- "cp -pr config.status .ext/include config_1st"
- "make reconfig"
- "cp -pr config.status .ext/include config_2nd"
- "diff -ru config_1st config_2nd"
- - "make after-update BASERUBY=ruby"
- - "make -s $JOBS"
- - "make update-rubyspec"
+ - "make -sj encs"
+ - "make -sj exts"
script:
- - "make test TESTOPTS=--color=never"
- - "make test-all TESTOPTS='-q -j3 --color=never --job-status=normal'"
- - "make test-rubyspec MSPECOPT=-fm"
+ - "make test OPTS=-v"
+# - "make test-all TESTS='-v'"
# Branch matrix. Not all branches are Travis-ready so we limit branches here.
branches:
only:
- trunk
- - ruby_2_0_0
- - ruby_2_1
- - ruby_2_2
- - ruby_2_3
+ - ruby_1_9_3
# We want to be notified when something happens.
notifications:
@@ -76,7 +65,7 @@ notifications:
- "irc.freenode.org#ruby-core"
- "irc.freenode.org#ruby-ja"
on_success: change # [always|never|change] # default: always
- on_failure: always # [always|never|change] # default: always
+ on_failure: change # [always|never|change] # default: always
template:
- "%{message} by @%{author}: See %{build_url}"
@@ -87,10 +76,6 @@ notifications:
on_success: always
on_failure: never
- email:
- - ko1c-failure@atdot.net
- - shibata.hiroshi@gmail.com
-
# Local Variables:
# mode: YAML
# coding: utf-8-unix
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index ffdf2dd4b8..0000000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,4 +0,0 @@
-Please see the [official issue tracker] and wiki [HowToContribute].
-
-[official issue tracker]: https://bugs.ruby-lang.org
-[HowToContribute]: https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute
diff --git a/ChangeLog b/ChangeLog
index 2d26904f0b..2540307c53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14543 +1,16176 @@
-Thu Dec 14 23:53:41 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Nov 23 03:44:03 2013 Eric Hodel <drbrain@segment7.net>
- * test/net/ftp/test_ftp.rb (process_port_or_eprt): merge a part of
- r56973 to pass the test introduced at previous commit.
+ * lib/rubygems: Update to RubyGems master dcce4ff. Important changes
+ in this commit:
-Thu Dec 14 22:55:05 2017 Shugo Maeda <shugo@ruby-lang.org>
+ Remove automatic detection of gem dependencies files. This prevents a
+ security hole as described in [ruby-core:58490]
- Fix a command injection vulnerability in Net::FTP.
+ Fixed bugs for installing git gems.
-Thu Dec 14 22:35:19 2017 Eric Wong <normalperson@yhbt.net>
+ * test/rubygems: ditto.
- webrick: compile RE correctly for beginning and end match
+Fri Nov 22 22:30:00 2013 Kenta Murata <mrkn@mrkn.jp>
- Using ^ and $ in regexps means we can accidentally get fooled
- by "%0a" in HTTP request paths being decoded to newline
- characters. Use \A and \z to match beginning and end-of-string
- respectively, instead.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power):
+ Round the result value only if the precision is given.
- Thanks to mame and hsbt for reporting.
+Fri Nov 22 17:20:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/webrick/httpserver.rb (MountTable#compile):
- use \A and \z instead of ^ and $
- * lib/webrick/httpserver.rb (MountTable#normalize): use \z instead of $
- * test/webrick/test_httpserver.rb (test_cntrl_in_path): new test
+ * transcode.c (str_transcode0): don't scrub invalid chars if
+ str.encode doesn't have explicit invalid: :replace.
+ workaround fix for see #8995
-Thu Dec 14 22:29:04 2017 Eric Wong <normalperson@yhbt.net>
+Fri Nov 22 17:11:26 2013 Narihiro Nakamura <authornari@gmail.com>
- webrick: do not hang acceptor on slow TLS connections
+ * include/ruby/intern.h, internal.h: Expose rb_gc_count().
- OpenSSL::SSL::SSLSocket#accept may block indefinitely on clients
- which negotiate the TCP connection, but fail (or are slow) to
- negotiate the subsequent TLS handshake. This prevents the
- multi-threaded WEBrick server from accepting other connections.
+Fri Nov 22 17:07:00 2013 Kenta Murata <mrkn@mrkn.jp>
- Since the TLS handshake (via OpenSSL::SSL::SSLSocket#accept)
- consists of normal read/write traffic over TCP, handle it in the
- per-client thread, instead.
+ * ext/bigdecimal/bigdecimal.gemspec: version 1.2.2.
- Furthermore, using non-blocking accept() is useful for non-TLS
- sockets anyways because spurious wakeups are possible from
- select(2).
+Fri Nov 22 17:04:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * lib/webrick/server.rb (accept_client): use TCPServer#accept_nonblock
- and remove OpenSSL::SSL::SSLSocket#accept call
- * lib/webrick/server.rb (start_thread): call OpenSSL::SSL::SSLSocket#acc
-ept
- * test/webrick/test_ssl_server.rb (test_slow_connect): new test
- [ruby-core:83221] [Bug #14005]
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_data_type):
+ Use RUBY_TYPED_FREE_IMMEDIATELY only if it is available.
- webrick: fix up r60172
+Fri Nov 22 16:49:00 2013 Kenta Murata <mrkn@mrkn.jp>
- By making the socket non-blocking in r60172, TLS/SSL negotiation
- via the SSL_accept function must handle non-blocking sockets
- properly and retry on SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE.
- OpenSSL::SSL::SSLSocket#accept cannot do that properly with a
- non-blocking socket, so it must use non-blocking logic of
- OpenSSL::SSL::SSLSocket#accept_nonblock.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
+ [Bug #8818] [ruby-core:56802]
- Thanks to MSP-Greg (Greg L) for finding this.
+ * test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.
- * lib/webrick/server.rb (start_thread): use SSL_accept properly
- with non-blocking socket.
- [Bug #14013] [Bug #14005]
+Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@atdot.net>
- webrick: fix up r60172 and revert r60189
+ * gc.c (heap_set_increment): accept minimum additional page number.
- Thanks to MSP-Greg (Greg L) for helping with this.
+ * gc.c (gc_after_sweep): allocate pages to allocate at least
+ RUBY_HEAP_MIN_SLOTS.
+ [Bug #9137]
- * lib/webrick/server.rb (start_thread): ignore ECONNRESET, ECONNABORTED,
- EPROTO, and EINVAL on TLS negotiation errors the same way they
- were ignored before r60172 in the accept_client method of the
- main acceptor thread.
- [Bug #14013] [Bug #14005]
+Fri Nov 22 16:19:52 2013 Narihiro Nakamura <authornari@gmail.com>
- webrick: fix up r60172 and r60208
+ * include/ruby/intern.h (rb_gc_set_params): Deprecate
+ rb_gc_set_params because it's only used in ruby internal.
- Thanks to MSP-Greg (Greg L) for helping with this.
+ * internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
+ alias function.
- * lib/webrick/server.rb (start_thread): fix non-local return
- introduced in r60208
+ * gc.c: ditto.
- webrick: fix up r60172 and r60210
+ * ruby.c: use ruby_gc_set_params.
- Thanks to MSP-Greg (Greg L) for helping with this.
+Fri Nov 22 14:55:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * lib/webrick/server.rb (start_thread): properly fix non-local return
- introduced in r60208 and r60210
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Insert rb_thread_check_ints.
-Thu Nov 30 23:37:08 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 14:35:00 2013 Kenta Murata <mrkn@mrkn.jp>
- parse.y: fix line in rescue
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix the inserting points
+ of RB_GC_GUARDs.
- * parse.y (set_line_body, primary): fix line number of bodystmt as the
- beginning of the block. [Bug #13181]
+Fri Nov 22 14:31:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Thu Nov 30 23:29:00 2017 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c: Fix indentation.
- Merge rubygems-2.6.14 changes.
+Fri Nov 22 14:03:00 2013 NARUSE, Yui <naruse@ruby-lang.org>
- It fixed http://blog.rubygems.org/2017/10/09/unsafe-object-deserialization-vulnerability.html
+ * ext/nkf: merge nkf 2.1.3 2a2f2c5.
-Fri Sep 15 05:40:40 2017 URABE Shyouhei <shyouhei@ruby-lang.org>
+Fri Nov 22 12:43:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- fix --with-gmp (broken by r57490)
+ * util.c (ruby_strtod): ignore too long fraction part, which does not
+ affect the result.
- Looking at the generated shell script (also the autoconf manual), it
- seems AC_SEARCH_LIBS() m4 macro does not define HAVE_LIBsomething C
- preprocessor macros, unlike AC_CHECK_LIB() which does define them.
- This previous change effectively killed building with GMP because
- building that mode depends on existence of HAVE_LIBGMP. [Bug #13402]
+Fri Nov 22 12:17:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 14 20:25:55 2017 Yusuke Endoh <mame@ruby-lang.org>
+ * ext/openssl/lib/openssl/buffering.rb (OpenSSL::Buffering#initialize):
+ initialize of a module should pass arguments to super.
- lib/webrick/log.rb: sanitize any type of logs
+Fri Nov 22 12:02:58 2013 Tanaka Akira <akr@fsij.org>
- It had failed to sanitize some type of exception messages. Reported and
- patched by Yusuke Endoh (mame) at https://hackerone.com/reports/223363
+ * test/ruby/test_settracefunc.rb: Ignore events from other threads.
-Thu Sep 14 13:32:39 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 10:35:57 2013 Koichi Sasada <ko1@atdot.net>
- parse.y: empty hash in defined
+ * vm.c (ruby_vm_destruct): do not use ruby_xfree() after freeing
+ objspace.
- * parse.y (command): NODE_ARRAY with NULL is invalid. traversal
- in defined_expr0 is simplified than iseq_compile_each0.
- [ruby-core:82113] [Bug #13756]
+ * gc.c (ruby_mimfree): added. It is similar to ruby_mimmalloc().
-Thu Sep 14 13:26:31 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: ditto.
- string.c: fix false coderange
+Fri Nov 22 09:42:35 2013 Zachary Scott <e@zzak.io>
- * string.c (rb_enc_str_scrub): enc can differ from the actual encoding
- of the string, the cached coderange is useless then. [Bug #13874]
+ * test/digest/test_digest.rb: Reverse order of assert_equal
+ Reported by @splattael
-Thu Sep 14 13:24:51 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 09:03:16 2013 NARUSE, Yui <naruse@ruby-lang.org>
- parse.y: primary should not be 0
+ * gc.c: fix build failure on FreeBSD introduced by r43763.
+ malloc_usable_size() is defined by malloc_np.h on FreeBSD.
- * parse.y (primary): should not be 0, since it can be a receiver.
- [ruby-core:82447] [Bug #13836]
+ * configure.in: check malloc.h and malloc_np.h.
-Thu Sep 14 13:19:30 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 22 08:27:13 2013 Eric Hodel <drbrain@segment7.net>
- vm_method.c: alias warning at refined method
+ * lib/rubygems: Update to RubyGems master 50a8210. Important changes
+ in this commit:
- * vm_method.c (rb_method_entry_make): suppress a warning at
- refined method which will not be redefined.
- [ruby-core:82385] [Bug #13817]
+ RubyGems now automatically checks for gem.deps.rb or Gemfile when
+ running ruby executables. This behavior is similar to `bundle exec
+ rake`. This change may be reverted before Ruby 2.1.0 if too many bugs
+ are found.
-Thu Sep 14 13:14:19 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/rubygems: ditto.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_hash): st_index_t may not be
- fixable on 64bit mswin/mingw.
+Thu Nov 21 22:33:59 2013 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c (d_lite_hash): ditto.
- [Backport #13877]
+ * gc.c: RGENGC_CHECK_MODE should be 0.
- * ext/openssl/ossl_bn.c (ossl_bn_hash): ditto.
+Thu Nov 21 21:40:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Sat Sep 9 23:05:31 2017 Kazuki Yamaguchi <k@rhe.jp>
+ * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
+ of the digit array.
- asn1: fix out-of-bounds read in decoding constructed objects
+Thu Nov 21 21:36:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * OpenSSL::ASN1.{decode,decode_all,traverse}: have a bug of
- out-of-bounds read. int_ossl_asn1_decode0_cons() does not give the
- correct available length to ossl_asn1_decode() when decoding the
- inner components of a constructed object. This can cause
- out-of-bounds read if a crafted input given.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision of
+ the result BigDecimal of sqrt.
+ [Bug #5266] [ruby-dev:44450]
- Reference: https://hackerone.com/reports/170316
- https://github.com/ruby/openssl/commit/1648afef33c1d97fb203c82291b8a61269e85d3b
+ * test/bigdecimal/test_bigdecimal.rb: add tests for the above changes.
-Sat Sep 9 22:57:24 2017 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Nov 21 18:49:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/json: bump to version 1.8.3.1. [Backport #13853]
+ * gc.c (vm_xrealloc, vm_xfree): use malloc_usable_size() to obtain old
+ size if available.
-Sat Sep 9 22:50:10 2017 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Nov 21 18:47:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- A HTTP Header value must not contain CR or LF.
- to_str -> to_s
+ * lib/delegate.rb (SimpleDelegator#__getobj__): target object must be set.
- * lib/net/http/header.rb (set_field): `val` can not have `to_str`.
+ * lib/delegate.rb (DelegateClass#__getobj__): ditto.
-Sat Sep 9 22:42:22 2017 Kouhei Sutou <kou@cozmixng.org>
+Thu Nov 21 18:28:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * REXML: Fix a bug that unexpected methods can be called as a XPath
- function. [HackerOne:249295] Reported by Andrea Jegher. Thanks!!!
+ * lib/tempfile.rb (Tempfile#initialize): use class method to get rid
+ of warnings when $VERBOSE.
-Sat Sep 9 22:16:01 2017 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Nov 21 17:43:29 2013 Koichi Sasada <ko1@atdot.net>
- * lib/rubygems: fix several vulnerabilities in RubyGems; bump to version
- 2.5.2.1. [Backport #13842]
+ * gc.c: rename initial_xxx variables to gc_params.xxx.
+ They are not only used initial values.
-Wed Aug 9 22:27:23 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+ Chikanaga-san: Congratulations on RubyPrize!
- * test/ruby/test_syntax.rb (test_invalid_{break,next}): use
- assert_in_out_err instead of assert_syntax_error because on ruby_2_3
- assert_syntax_error uses eval.
+Thu Nov 21 17:16:00 2013 Koichi Sasada <ko1@atdot.net>
-Wed Aug 9 22:27:23 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: enable "RGENGC_ESTIMATE_OLDSPACE" option as default.
+ Without this option, some application consumes huge memory.
+ (and there are only a few performance down)
- * compile.c (iseq_compile_each0): turned dregx context in "once"
- into "guarded" type from "block" type, to disallow `next`,
- `break`, `redo` as well as outside "once".
- [Bug #13690]
+ Introduced new environment variables:
+ * RUBY_GC_HEAP_OLDSPACE (default 16MB)
+ * RUBY_GC_HEAP_OLDSPACE_MAX (default 128 MB)
+ * RUBY_GC_HEAP_OLDSPACE_GROWTH_FACTOR (default 1.2)
-Wed Aug 9 21:28:34 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (initial_malloc_limit): rename to initial_malloc_limit_min.
- * test/ruby/test_process.rb (test_rlimit_{name,value}): test in UTF-8
- encoding. fix test failures introduced at r59531 on some platforms.
+Thu Nov 21 16:51:34 2013 Zachary Scott <e@zzak.io>
-Wed Aug 9 21:16:22 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/digest/bubblebabble/bubblebabble.c: Teach RDoc digest/bubblebabble
- * marshal.c (rb_marshal_dump_limited): do not free dump_arg, which
- may be dereferenced in check_dump_arg due to continuation, and
- get rid of dangling pointers.
+Thu Nov 21 16:50:16 2013 Zachary Scott <e@zzak.io>
- * marshal.c (rb_marshal_load_with_proc): ditto for load_arg.
+ * test/digest/test_digest.rb: Add more tests for digest/bubblebabble
-Wed Aug 9 21:13:24 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Nov 21 16:32:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_compile_each): remove unused definition of unused
- variable derived from original patch.
+ * lib/delegate.rb (Delegator#method_missing): try private methods defined in
+ Kernel after the target. [Fixes GH-449]
-Wed Aug 9 19:45:16 2017 sorah (Shota Fukumori) <her@sorah.jp>
+Thu Nov 21 16:25:08 2013 Akinori MUSHA <knu@iDaemons.org>
- Init_frozen_strings definition is removed in r51511.
- https://bugs.ruby-lang.org/issues/11423
+ * test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path)
+ in addition to uri + path.
- Patch by Kohei Suzuki <eagletmt@gmail.com>
+Thu Nov 21 15:36:08 2013 Zachary Scott <e@zzak.io>
- * internal.h: Remove declaration of unexist function
- [Fix GH-1558]
+ * ext/openssl/lib/openssl/buffering.rb: [DOC] Fix HEREDOC comment for
+ OpenSSL::Buffering which breaks overview because of RDoc bug
-Wed Aug 9 19:34:17 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 14:46:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * internal.h (THROW_DATA_P): parenthesize the argument which is
- casted.
+ * eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure of
+ test/ruby/test_exception.rb on Windows.
+ wrap by __try and __exception statements on mswin to raise SIGSEGV
+ when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't
+ handle the exception.
+ however, (1) mingw-gcc doesn't support __try and __exception
+ statements, and (2) we cannot retry SystemStackError after this
+ change yet (maybe crashed) because SEH and longjmp() are too
+ uncongenial.
-Wed Aug 9 19:34:17 2017 Koichi Sasada <ko1@atdot.net>
+ * signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
+ Windows, too.
- * vm.c: get return_value from imemo_throw_data object (THROW_DATA_VAL()).
- imemo_throw_data (TAG_BREAK) contains returned value.
- However, imemo_throw_data (TAG_BREAK) can skip several frames so that
- we need to use it only once (at most internal frame). To record it,
- we introduced THROW_DATA_CONSUMED and check it.
+ * thread_win32.c (ruby_stack_overflowed_p): ditto.
- * internal.h: define THROW_DATA_CONSUMED flag.
+Thu Nov 21 14:18:24 2013 Zachary Scott <e@zzak.io>
- * test/ruby/test_settracefunc.rb: add tests for [Bug #13369]
+ * object.c: [DOC] Clarify Object#dup vs #clone [Bug #9128]
+ Moving existing doc for this comparison to separate section of #dup
+ Adding examples to document behavior of #dup with Module#extend.
+ Based on a patch by stevegoobermanhill
- * vm_insnhelper.h: add THROW_DATA_CONSUMED_P() and
- THROW_DATA_CONSUMED_SET().
+Thu Nov 21 14:06:02 2013 Koichi Sasada <ko1@atdot.net>
-Wed Aug 9 19:32:17 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_marks_check): do not dump all refs.
- * random.c (get_rnd, try_get_rnd): ensure initialized to get rid
- of crash in forked processes. [Bug #13753]
+ * gc.c (allrefs_dump_i): fix output format.
-Wed Aug 9 19:30:34 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 13:43:07 2013 Koichi Sasada <ko1@atdot.net>
- * ext/strscan/strscan.c (strscan_aref): fix segfault after
- get_byte or getch which do not apply regexp.
- [Bug #13759]
+ * gc.c: change RGENGC_CHECK_MODE (>= 2) logic.
+ Basically, make an object graph of all of living objects before and
+ after marking and check status.
-Wed Aug 9 19:28:40 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [Before marking: check WB sanity]
+ If there is a non-old object `obj' pointed from old object
+ (`parent') then `parent' or `obj' should be remembered.
- * configure.in: add rpath flags which is needed for OPTDIR as well
- as -L options, when it is given. [Bug #13411]
+ [After marking: check marking miss]
+ Traversible objects with the object graph should be marked.
+ (However, this alert about objects pointed by machine context
+ can be false positive. We only display alert.)
-Wed Aug 9 19:14:07 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [Implementation memo]
+ objspace_allrefs() creates an object graph.
+ The object graph is represented by st_table, key is object (VALUE)
+ and value is referring objects. Referring objects are stored by
+ "struct reflist".
- * vm_insnhelper.c (vm_throw_start): size of catch table has been
- included in iseq_catch_table struct, which could be NULL, since
- 2.2. e.g., proc-closure in `once'.
+ * gc.c (init_mark_stack): do not use push_mark_stack_chunk() at init.
+ This pre-allocation causes failure on is_mark_stask_empty()
+ without any pushing.
-Wed Aug 9 19:09:20 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 21 13:40:20 2013 Zachary Scott <e@zzak.io>
- * node.h (nd_line): should sign-extend. shifting `VALUE` extends
- with zero bits if `sizeof(VALUE)` equals to `sizeof(int)`. the
- zero bits are truncated if `sizeof(VALUE)` is bigger enough.
- [ruby-core:80920] [Bug #13523]
+ * lib/observer.rb: [DOC] Clarify default observer method.
+ By @edward [Fixes GH-450] https://github.com/ruby/ruby/pull/450
-Wed Aug 9 17:53:09 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Nov 21 13:32:53 2013 Zachary Scott <e@zzak.io>
- * compile.c (iseq_compile_each): the lifetime of new_opt have to be
- until this case block is end. this is a part of r57971.
- [Backport #13766]
+ * ext/openssl/ossl_engine.c: [DOC] Documentation for OpenSSL::Engine
+ This patch is based off work by @vbatts in GH-436 completing the
+ documentation for this class and its methods.
+ https://github.com/ruby/ruby/pull/436
-Wed Aug 9 17:35:47 2017 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Nov 21 10:45:22 2013 Zachary Scott <e@zzak.io>
- this patch contains r54158, r57410, r57631 and r57954.
+ * ext/openssl/lib/openssl/buffering.rb: Remove unused arguments from
+ OpenSSL::Buffering.new [Fixes GH-445]
- Prevent GC by volatile [Bug #13150]
+Thu Nov 21 10:30:47 2013 Zachary Scott <e@zzak.io>
- test/ruby/test_marshal.rb test_context_switch (load) and test_gc (dump)
- are failed on FreeBSD 10.3 and gcc7 (FreeBSD Ports Collection) 7.0.0
- 20170115 (experimental); RB_GC_GUARD looks not worked well.
+ * test/digest/test_digest.rb: Add test for Digest::SHA256.bubblebabble
- * include/ruby/ruby.h (RB_GC_GUARD): prevent guarded pointer from
- optimization by using as an input to inline asm.
+Wed Nov 20 20:54:01 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ruby.h: remove comment
+ * tool/instruction.rb : fix typo.
- * include/ruby/ruby.h (RB_GC_GUARD): remove comment unsupported by
- Solaris AS.
+Wed Nov 20 19:45:22 2013 Tanaka Akira <akr@fsij.org>
- Hidden objects (klass == 0) are not visible to Ruby code invoked
- from other threads or signal handlers, so they can never be
- accessed from other contexts. This makes it safe to call
- rb_gc_force_recycle on the object slot after releasing malloc
- memory.
+ * random.c (rand_init): Make it possible to specify arbitrary array
+ for init_genrand().
- * marshal.c (rb_marshal_dump_limited): hide dump_arg and recycle when
- done (rb_marshal_load_with_proc): hide load_arg and recycle when done
- [ruby-core:79518]
+Wed Nov 20 17:34:13 2013 Koichi Sasada <ko1@atdot.net>
- * marshal.c (rb_marshal_dump_limited): do not free dump_arg, which
- may be dereferenced in check_dump_arg due to continuation, and
- get rid of dangling pointers.
+ * parse.y (rb_gc_mark_symbols): set global_symbols.minor_marked only
+ when full_mark is 0.
+ rb_gc_mark_symbols() (with full_mark == 1) can be called by other
+ than GC (such as rb_objspace_reachable_objects_from_root()).
- * marshal.c (rb_marshal_load_with_proc): ditto for load_arg.
+Wed Nov 20 11:46:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Aug 9 17:28:35 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/json: merge JSON 1.8.1.
+ https://github.com/nurse/json/compare/002ac2771ce32776b32ccd2d06e5604de6c36dcd...e09ffc0d7da25d0393873936c118c188c78dbac3
+ * Remove Rubinius exception since transcoding should be working now.
+ * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre
+ Lafortune <github_rocks@marc-andre.ca>. Thanks!
+ * Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress
+ warning with -Wchar-subscripts and better validate UTF-8 strings.
+ * Applied patch by ginriki@github to remove unnecessary if.
+ * Add load/dump interface to JSON::GenericObject to make
+ serialize :some_attribute, JSON::GenericObject
+ work in Rails active models for convenient
+ SomeModel#some_attribute.foo.bar access to serialised JSON data.
- * eval.c (setup_exception): make unfrozen copy of special
- exception before setting up a cause.
+Wed Nov 20 01:39:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 9 17:22:29 2017 TAKANO `takano32' Mitsuhiro <tak@no32.tk>
+ * lib/rdoc/constant.rb (RDoc::Constant#documented?): workaround for
+ NoMethodError when the original of alias is not found.
- a64: fix crash on register stack mark/sweep pass
+Tue Nov 19 23:38:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_pthread.c: move 'register_stack_start' earlier.
- [ruby-core:79928] [Bug #13284] [Fix GH-1625]
+ * configure.in (--with-os-version-style): option to transform target
+ OS version string.
- Author: Sergei Trofimovich <slyfox@gentoo.org>
+Tue Nov 19 21:27:33 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 9 17:10:27 2017 Shugo Maeda <shugo@ruby-lang.org>
+ * test/net/http/utils.rb (spawn_server): Specify zero for port to
+ avoid reusing an allocated port.
- * test/net/smtp/test_smtp.rb (test_tls_connect, test_tls_connect):
- use Socket.tcp_server_sockets in case localhost is resolved to ::1.
+ * test/net/http/test_http.rb: Don't specify port here.
-Wed Aug 9 17:10:27 2017 Shugo Maeda <shugo@ruby-lang.org>
+ * test/net/http/test_https.rb: Ditto.
- * lib/net/smtp.rb (tlsconnect): support timeout for TLS handshake.
- [ruby-core:76893] [Bug #12678]
+Tue Nov 19 18:52:10 2013 Koichi Sasada <ko1@atdot.net>
- * lib/net/protocol.rb (ssl_socket_connect): new method to implement
- timeout for TLS handshake.
+ * gc.c (heap_is_swept_object): use heap_page::before_sweep flag.
- * lib/net/http.rb (connect): use Net::Protocol#ssl_socket_connect.
+Tue Nov 19 18:49:32 2013 Koichi Sasada <ko1@atdot.net>
-Wed Aug 9 17:08:01 2017 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (rb_objspace_reachable_objects_from_root): do major marking.
- Zlib::GzipReader#pos underflows after calling #ungetbyte or #ungetc at start of file [Bug #13616]
+Tue Nov 19 18:45:40 2013 Koichi Sasada <ko1@atdot.net>
- patched by Andrew Haines <andrew@haines.org.nz> [ruby-core:81488]
- zlib.c: fix unnormalized Fixnum
+ * gc.c (rb_gc_resurrect): added.
+ rb_fstring() used rb_gc_mark() to avoid freeing used string.
+ However, rb_gc_mark() set mark bit *and* pushes mark_stack.
+ rb_gc_resurrect() does only set mark bit if it is before sweeping.
- * ext/zlib/zlib.c (rb_gzfile_total_out): cast to long not to
- result in an unsigned long to normalized to Fixnum on LLP64
- platforms. [ruby-core:81488]
+ * string.c (rb_fstring): use rb_gc_resurrect.
-Wed Aug 9 17:03:00 2017 Eric Wong <normalperson@yhbt.net>
+ * internal.h: add decl.
- process.c: handle dynamic :rlimit_* symbols in spawn execopts
+Tue Nov 19 09:47:02 2013 Eric Hodel <drbrain@segment7.net>
- * process.c (rb_execarg_addopt_rlimit): hoist out of rb_execarg_addopt
- (rlimit_type_by_sym): new wrapper for dynamic symbol
- (rb_execarg_addopt): check for dsym via rlimit_type_by_sym
- * test/ruby/test_process.rb (test_execopts_rlimit): check dsym w/o pindown
- Add extra check for bogus rlimit args, too.
- [ruby-core:82033] [Bug #13744]
- process.c: null bytes
+ * lib/rdoc: Update to RDoc master a1195ce. Changes include:
- * process.c (rlimit_type_by_sym): prohibit null bytes in key
- names. [ruby-core:82033] [Bug #13744]
+ Improved accessibility of the main sidebar navigation.
-Wed Aug 9 16:56:52 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Fixed handling of regexp options in HTML source highlighting.
- optparse.rb: get rid of eval
+ * test/rdoc: ditto.
- * lib/optparse.rb: try Float() and Integer() instead of eval,
- which does too much things.
+Tue Nov 19 09:33:52 2013 Eric Hodel <drbrain@segment7.net>
+ * lib/rubygems: Update to RubyGems master 6a3d9f9. Changes include:
-Fri Jul 7 10:58:10 2017 Eric Wong <e@80x24.org>
+ Compatibly renamed Gem::DependencyResolver to Gem::Resolver.
- This backport of r58812 is necessary to ease backporting r59028,
- which fixes a real bug.
+ Added support for git gems in gem.deps.rb and Gemfile.
- * thread.c (struct waiting_fd): declare
- (rb_thread_io_blocking_region): use on-stack list waiter
- (rb_notify_fd_close): walk vm->waiting_fds instead
- (call_without_gvl): remove old field setting
- (th_init): ditto
- [Feature #9632]
+ Fixed resolver bugs.
- * vm_core.h (typedef struct rb_vm_struct): add waiting_fds list
+ * test/rubygems: ditto.
- * (typedef struct rb_thread_struct): remove waiting_fd field
- (rb_vm_living_threads_init): initialize waiting_fds list
+ * lib/rubygems/LICENSE.txt: Updated to license from RubyGems trunk.
+ [ruby-trunk - Bug #9086]
- This should fix bad interactions with test_race_gets_and_close
- in test/ruby/test_io.rb since we ensure rb_notify_fd_close
- continues returning the busy flag after enqueuing the interrupt.
+ * lib/rubygems/commands/which_command.rb: RubyGems now indicates
+ failure when any file is missing. [ruby-trunk - Bug #9004]
- * thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
- [ruby-core:81581] [Bug #13632]
+ * lib/rubygems/ext/builder: Extensions are now installed into the
+ extension install directory and the first directory in the require
+ path from the gem. This allows backwards compatibility with msgpack
+ and other gems that calculate full require paths.
+ [ruby-trunk - Bug #9106]
- * test/ruby/test_io.rb (test_single_exception_on_close):
- new test based on script from Nikolay
-Wed Jul 5 15:55:35 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Nov 19 07:21:56 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_cipher.c: remove the encryption key initialization
- from Cipher#initialize. This is effectively a revert of r32723
- ("Avoid possible SEGV from AES encryption/decryption", 2011-07-28).
- the patch is derived from https://github.com/ruby/openssl/commit/8108e0a6db133f3375608303fdd2083eb5115062,
- written by Kazuki Yamaguchi.
- [Backport #8221]
+ * configure.in (LOCALTIME_OVERFLOW_PROBLEM): Define it for cross
+ compiling.
+ [ruby-core:58391] [Bug #9119] Reported by Luis Lavena.
+ Analyzed by Heesob Park.
-Sat Jul 1 00:28:22 2017 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Nov 19 05:55:05 2013 Eric Hodel <drbrain@segment7.net>
- * ext/psych/yaml: update libyaml to 0.1.7.
+ * lib/rdoc/rubygems_hook.rb: Remove debugging puts committed by
+ accident.
- * ext/psych/psych.gemspec: bump version to 2.1.0.1.
+Mon Nov 18 22:47:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jun 30 22:05:39 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval_intern.h (TH_PUSH_TAG, TH_EXEC_TAG): refine stack overflow
+ detection. chain local tag after setjmp() successed on it, because
+ calling setjmp() also can overflow the stack.
+ [ruby-dev:47804] [Bug #9109]
- * parse.y (parser_precise_mbclen): check invalid multibyte char at
- skipping strings following ?x literal string, not to stuck in a
- infinite loop. [Bug #13672]
+ * vm_eval.c (rb_catch_obj): now th->tag points previous tag until
+ TH_EXEC_TAG().
-Fri Jun 30 22:00:56 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread_pthread.c (ruby_init_stack): set stack_start properly by
+ get_main_stack() if possible.
- * ext/pathname/lib/pathname.rb (Pathname#plus): UNC root pathname needs
- a separator. File.basename returns "/" on UNC root, as well as sole
- drive letter, even if it does not end with a separator. [Bug #13515]
+Mon Nov 18 22:45:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jun 30 21:57:27 2017 Kouhei Sutou <kou@cozmixng.org>
+ * eval_jump.c (rb_exec_end_proc): unlink and free procs data before
+ calling for each procs. [Bug #9110]
- * lib/rexml/parsers/streamparser.rb: add close tag check on end of
- document to StreamParser [Bug #13636]
- Reported by Anton Sivakov. Thanks!!!
+Sun Nov 17 06:33:32 2013 Shota Fukumori <her@sorah.jp>
-Fri Jun 30 21:54:01 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: Use $LIBS for base of $SOLIBS, also in darwin.
+ By this fix, environment that libgmp is located in $LIBS can build
+ ruby.
- * array.c (rb_ary_insert): check position to insert even if no elements
- to be inserted. [Bug #13558]
+Sun Nov 17 01:56:32 2013 Tanaka Akira <akr@fsij.org>
-Fri Jun 30 21:51:40 2017 Marcus Stollsteimer <sto.mar@web.de>
+ * thread_pthread.c (rb_thread_create_timer_thread): Show error
+ message instead of error number.
+ (thread_create_core): Ditto.
- * ext/date/date_core.c: [DOC] fix documentation for %Z format of
- {Date,DateTime}.strftime.
- Reported by Damon Timm. Based on a patch by nano.
- [Bug #13231] [Fix GH-1565]
+ * cont.c (fiber_machine_stack_alloc): Ditto.
-Fri Jun 30 21:46:50 2017 Kouhei Sutou <kou@cozmixng.org>
+Sat Nov 16 18:28:08 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/rss/rss.rb: Accept empty text element as valid element
- Parser has been accepted it but XML serializer wasn't accepted.
- Reported by stefano frabetti. Thanks!!!
- [Bug #13531]
+ * lib/rexml/parsers/ultralightparser.rb
+ (REXML::Parsers::UltraLightParser#parse): Fix wrong :start_doctype
+ position.
+ [Bug #9061] [ruby-dev:47778]
+ Patch by Ippei Obayashi. Thanks!!!
-Fri Jun 30 21:40:42 2017 Kazuki Yamaguchi <k@rhe.jp>
+ * test/rexml/parser/test_ultra_light.rb: Add a test for this case.
- * ext/openssl/ossl_x509store.c: clear error queue after calling
- X509_LOOKUP_load_file()
+Sat Nov 16 02:13:56 2013 Masaya Tarui <tarui@ruby-lang.org>
- X509_LOOKUP_load_file(), which ends up calling
- X509_load_cert_crl_file()
- internally, may leave error entries in the queue even when it returns
- non-zero value (which indicates success).
+ * cont.c : Introduce ensure rollback mechanism. Please see below.
- This will be fixed by OpenSSL 1.1.1, but can be worked around by
- clearing the error queue ourselves.
+ * internal.h (ruby_register_rollback_func_for_ensure): catch up above change.
+ Add rollback mechanism API.
- Fixes: [Backport #11033]
+ * vm_core.h (typedef struct rb_vm_struct): catch up above change.
+ Introduce ensure-rollback relation table.
-Fri Jun 30 21:35:16 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_core.h (typedef struct rb_thread_struct): catch up above change.
+ Introduce ensure stack.
- * gc.c (heap_page_allocate): expand sorted pages before inserting
- allocated new page. [Bug #12670]
+ * eval.c (rb_ensure): catch up above change.
+ Introduce ensure stack.
-Fri Jun 30 21:33:39 2017 Koichi Sasada <ko1@atdot.net>
+ * hash.c : New function for rollback ensure, and register it to
+ ensure-rollback relation table. [ruby-dev:47803] [Bug #9105]
- * gc.c (heap_page_resurrect): do not return tomb_pages when
- page->freelist == NULL.
- [Bug #12670]
+ Ensure Rollback Mechanism:
+ A rollback's function is a function to rollback a state before ensure's
+ function execution.
+ When the jump of callcc is across the scope of rb_ensure,
+ ensure's functions and rollback's functions are executed appropriately
+ for keeping consistency.
-Fri Jun 30 21:23:20 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Current API is unstable, and only internal use.
- * vsnprintf.c (BSD_vfprintf): sign and hex-prefix should not be counted
- in precision. [Bug #8916]
+ ruby_register_rollback_func_for_ensure(ensure_func,rollback_func)
+ This API create relation ensure's function to rollback's function.
+ By registered rollback's function, it is executed When jumping into
+ corresponding rb_ensure scope.
-Fri Jun 30 21:20:14 2017 Koichi Sasada <ko1@atdot.net>
+Sat Nov 16 00:18:36 2013 Masaki Matsushita <glass.saga@gmail.com>
- * thread.c (ruby_thread_stack_overflow): disable VM events when stack
- overflow occurred; it causes another stack overflow again in making
- backtrace object, and crashes. [Bug #13425]
+ * eval_jump.c (rb_exec_end_proc): fix double free or corruption error
+ when reentering by callcc. [ruby-core:58329] [Bug #9110]
- * vm.c (hook_before_rewind): skip rewind hooks if err is
- SystemStackError because rewind hooks can cause stack overflow again
- and again.
+ * test/ruby/test_beginendblock.rb: test for above.
- * thread.c (ruby_thread_stack_overflow): do not disable all hooks.
- Additionally, clearing ruby_vm_event_flags is not suitable way
- to disable hooks.
+Fri Nov 15 01:06:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jun 30 21:13:25 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/objspace/objspace_dump.c (dump_output): allow IO object as
+ output, and use Tempfile.create and return open file instead of
+ mkstemp() and path name for :file output.
+ [ruby-core:58266] [Bug #9102]
- * proc.c (method_super_method): skip prepended modules and continue from
- the super class of the original class. [Bug #13656]
+ * test/objspace/test_objspace.rb (TestObjSpace#dump_my_heap_please):
+ remove temporary output file.
-Fri Jun 30 21:10:48 2017 Shugo Maeda <shugo@ruby-lang.org>
+Thu Nov 14 23:39:00 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
- * lib/net/smtp.rb (getok, get_response): raise an ArgumentError when
- CR or LF is included in a line, because they are not allowed in
- RFC5321. Thanks, Jeremy Daer.
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] remove example of
+ Rational#to_d without argument. [Bug #8958]
-Fri Jun 30 21:07:56 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Nov 14 20:24:15 2013 Naohisa Goto <ngotogenome@gmail.com>
- * eval.c (exc_setup_cause): need to unfreeze(=dup) the exception before
- setting cause if its frozen.
+ * ruby_atomic.h (ATOMIC_SIZE_CAS): fix compile error on Solaris
+ since r43460.
-Fri Jun 30 21:07:14 2017 Eric Wong <e@80x24.org>
+Thu Nov 14 19:53:00 2013 Tanaka Akira <akr@fsij.org>
- thread.c: avoid busy looping on rb_thread_fd_close
+ * test/openssl/test_cipher.rb (test_aes_gcm_wrong_tag): Don't use
+ String#succ because it can make modified (wrong) auth_tag longer
+ than 16 bytes. The longer auth_tag makes that
+ EVP_CIPHER_CTX_ctrl (and internally aes_gcm_ctrl) fail.
+ [ruby-core:55143] [Bug #8439] reported by Vit Ondruch.
- We no longer use it this function, but extensions do, and
- we need to ensure it continues to work for them.
+Thu Nov 14 11:33:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (rb_thread_fd_close): schedule other threads in loop
+ * hash.c (foreach_safe_i, hash_foreach_iter): deal with error detected
+ by ST_CHECK.
- * ext/-test-/thread_fd_close/thread_fd_close.c: new file
+ * st.c (st_foreach_check): call with non-error argument in normal case.
- * ext/-test-/thread_fd_close/depend: ditto
+Thu Nov 14 02:37:14 2013 Zachary Scott <e@zzak.io>
- * ext/-test-/thread_fd_close/extconf.rb: ditto
+ * ext/thread/thread.c: [DOC] This patch accomplishes the following:
- * test/-ext-/thread_fd_close/test_thread_fd_close.rb: new test
+ - Teach RDoc about ConditionVariable
+ - Teach RDoc about Queue
+ - Teach RDoc about SizedQueue
+ - Use fully-qualified namespace for Document-method
+ This is necessary to separate definitions between classes
+ - Fix rdoc bug in call_seq vs. call-seq
+ - Correct doc for SizedQueue#pop patch by @jackdanger [Bug #8988]
-Fri Jun 30 20:34:49 2017 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Thu Nov 14 01:11:54 2013 Zachary Scott <e@zzak.io>
- * sample/pty/shl.rb: update sample
- * Specify frozen_string_literal: true.
- * Fix TypeError of raise.
- * Use a character literal instead of Integer.
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] +precision+ is required
-Fri Jun 30 20:31:59 2017 Marcus Stollsteimer <sto.mar@web.de>
+Wed Nov 13 19:21:36 2013 Zachary Scott <e@zzak.io>
- * string.c: [DOC] clarify docs for String#split when called with limit
- and capture groups. Reported by Cichol Tsai. [Bug #13621]
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] Document the required
+ +precision+ argument for Rational#to_d [Bug #8958]
-Fri Jun 30 20:23:31 2017 Takashi Kokubun <takashikkbn@gmail.com>
+Wed Nov 13 19:02:05 2013 Zachary Scott <e@zzak.io>
- * lib/erb.rb: Allow explicit trimming carriage return when trim_mode is
- "-", for Windows environments. [Bug #5339]
+ * ext/digest/*: [DOC] Fix several typos and broken http links.
+ Improved examples for Digest overview and fixed a broken example in
+ Digest::HMAC overview. This patch also adds a description of
+ Digest::SHA256.bubblebabble to the Digest overview.
- * lib/erb.rb: Allow trimming CR in all trim_modes to unify a behavior
- with r58823 and r58825.
+ Patched by @stomar [Bug #9027]
-Fri Jun 30 20:16:15 2017 Takashi Kokubun <takashikkbn@gmail.com>
+Wed Nov 13 18:32:12 2013 Zachary Scott <e@zzak.io>
- * lib/erb.rb: Allow trimming carriage return when trim_mode is "<>", for
- Windows environments. [Bug #11464]
+ * ext/openssl/ossl_config.c: [DOC] Document the following:
-Fri Jun 30 20:07:37 2017 NARUSE, Yui <naruse@ruby-lang.org>
+ - OpenSSL::ConfigError
+ - OpenSSL::Config::DEFAULT_CONFIG_FILE
- * util.c (ruby_strtod) Merge latest dtoa.c [Bug #13545]
- Apply some part of http://www.netlib.org/fp/dtoa.c with my eyes...
+ Patched by @vbatts via GH-436
+ https://github.com/ruby/ruby/pull/436
-Fri Jun 30 20:00:18 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Nov 13 18:03:00 2013 Zachary Scott <e@zzak.io>
- * dir.c (is_case_sensitive): use getattrlist() if fgetattrlist() is
- unavailable, on OSX 10.5. [Bug #11054]
+ * ext/openssl/ossl_asn1.c: [DOC] Document parts of
+ OpenSSL::ASN1::ObjectId included a fix for the class overview, which
+ previously showed the documentation for Constructive due to missing
+ ObjectId overview. This patch also includes a note for Primitive.
-Fri Jun 30 19:58:16 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Based on a patch by @vbatts via GH-436
+ https://github.com/ruby/ruby/pull/436
- * tool/mkconfig.rb (RbConfig): prefix SDKROOT to oldincludedir
- not includedir, the latter is outside the ruby installation.
- [ruby-core:72496] [Bug #11881]
+Wed Nov 13 17:19:36 2013 Zachary Scott <e@zzak.io>
-Fri Jun 30 19:56:06 2017 Eric Wong <e@80x24.org>
+ * ext/openssl/lib/openssl/config.rb: In #parse use +string+ for +str+
- * variable.c (check_autoload_required): do not assume a provided feature
- means autoload is complete, always wait if autoload is being performed
- by another thread. [Bug #11384] Thanks to s.wanabe@gmail.com
+Wed Nov 13 17:09:45 2013 Zachary Scott <e@zzak.io>
-Fri Jun 30 19:53:30 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/openssl/lib/openssl/*.rb: [DOC] Document the following:
- * process.c (obj2uid, obj2gid): use temporary string as the buffer
- instead of rb_alloc_tmp_buffer, which is NODE_ALLOCA since r51492.
- [Bug #13554]
+ - Integer#to_bn
+ - OpenSSL::Buffering module
+ - Deprecated OpenSSL::Digest::Digest compatibility class
+ - OpenSSL::Config
-Fri Jun 30 19:50:25 2017 Eric Wong <e@80x24.org>
+ These changes were based on a patch by @vbatts via GH-436
+ https://github.com/ruby/ruby/pull/436
- * variable.c (autoload_reset): use idempotent list_del_init
+Wed Nov 13 10:55:43 2013 Zachary Scott <e@zzak.io>
- * variable.c (autoload_sleep): moved code from rb_autoload_load
+ * doc/regexp.rdoc: [DOC] Fix typo in Special global variables section.
+ Reported by Alex Johnson on ruby-doc.org
- * variable.c (autoload_sleep_done): cleanup for use with rb_ensure
+Wed Nov 13 10:43:19 2013 Zachary Scott <e@zzak.io>
- * variable.c (rb_autoload_load): ensure list delete happens in case the
- thread dies during sleep
+ * hash.c: [DOC] Adds an example for Hash#store
- * test/ruby/bug-13526.rb: new script for separate execution
+Wed Nov 13 09:03:40 2013 Zachary Scott <e@zzak.io>
- * test/ruby/test_autoload.rb (test_bug_13526): new test [Bug #13526]
+ * doc/regexp.rdoc: [DOC] add note about Bug #4044 as suggested by
+ duerst-san in [ruby-core:43612] [Fixes GH-443] Patched by @rosenfeld
+ https://github.com/ruby/ruby/pull/443
-Fri Jun 30 19:46:46 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Nov 12 10:15:14 2013 Eric Hodel <drbrain@segment7.net>
- * sprintf.c (rb_str_format): while "% 2f" and "% 4f" result in " Inf"
- and " Inf" respectively, "% 3f" results in "Inf" (no space).
+ * test/rubygems/insure_session.rb: Remove unused test file.
- * sprintf.c (rb_str_format): as for non-finite float, calculate the
- exact needed size with the space flag.
+Tue Nov 12 09:16:24 2013 Eric Hodel <drbrain@segment7.net>
-Fri Jun 30 19:41:48 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master b9213d7. Changes include:
- * thread_win32.c (w32_wait_events): do not acquire GVL, to fix deadlock
- at read/close race condition. instead, just ignore interrupt_event if
- it is closed.
+ Fixed tests on Windows (I hope) by forcing platform for
+ platform-dependent tests.
- * thread_win32.c (w32_wait_events): fix wait object index in the case of
- interrupt_event is not usable.
+ Fixed File.exists? warnings.
-Fri Jun 30 19:37:47 2017 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ Improved testing infrastructure.
- * io.c (nogvl_wait_for_single_fd): nogvl_wait_for_single_fd must wait
- as its name.
- poll(fds, n, 0) mean no timeout and immediately return. If you want to
- wait something, you need to use -1 instead.
+ * test/rubygems: ditto.
-Fri Jun 30 19:35:31 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rdoc/test_rdoc_rubygems_hook.rb: Switch to util_spec like
+ RubyGems.
- * class.c (Init_class_hierarchy): prevent rb_cObject which is the class
- tree root, from GC. [Bug #12492]
+Mon Nov 11 18:31:12 2013 Aman Gupta <ruby@tmm1.net>
-Fri Jun 30 19:32:52 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: move common string/hash flags to include file.
+ * ext/objspace/objspace_dump.c: remove flags shared above.
+ * hash.c: ditto.
+ * string.c: ditto.
- * class.c (Init_class_hierarchy): prevent rb_cObject which is the
- class tree root, from GC. [ruby-dev:49666] [Bug #12492]
+Mon Nov 11 04:36:14 2013 Eric Hodel <drbrain@segment7.net>
-Fri Jun 30 19:29:45 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/specification.rb: Include 2.2.0.preview.2 when checking
+ if extensions should be built. Fixes a ruby-ci failure.
+ * test/rubygems/test_gem_specification.rb: Test for the above.
- * ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): fix for nested
- indedented here documents, where Elems are nested too. [Bug #13536]
+Mon Nov 11 03:15:56 2013 Koichi Sasada <ko1@atdot.net>
- * ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): insert stripped
- leading spaces as on_ignored_sp elements, so that the original source
- can be reconsructed. [Bug #13536]
+ * vm_trace.c (symbol2event_flag): add secret feature.
+ add a_call/a_return events.
+ a_call is call | b_call | c_call, and same as a_return.
-Mon May 1 06:36:57 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Nov 11 02:51:17 2013 Eric Hodel <drbrain@segment7.net>
- * parse.y (parser_parse_string): set the mark of term to `nd_func`
- because in this version `u2.id` is not used for this purpose.
- fixed failure of ruby/spec introduced at r58518.
- see also [Backport #13363]
+ * lib/rubygems: Update to RubyGems master 4bdc4f2. Important changes
+ in this commit:
-Sun Apr 30 23:01:00 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ RubyGems now chooses the test server port reliably. Patch by akr.
- class.c: ensure_includable
+ Partial implementation of bundler's Gemfile format.
- * class.c (ensure_includable): extract checks to include and
- prepend.
+ Refactorings to improve the new resolver.
- class.c: prohibit refinement module
+ Fixes bugs in the resolver.
- * class.c (ensure_includable): cannot include refinement
- module, or the type and the class do not match.
- [ruby-core:79632] [Bug #13236]
+ * test/rubygems: Tests for the above.
-Sun Apr 30 22:55:41 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Nov 11 01:02:06 2013 Zachary Scott <e@zzak.io>
- keep line number after unterminated string literal
+ * lib/timeout.rb: [DOC] Add note about change from #8730 [Fixes GH-440]
+ * NEWS: [DOC] Improve grammar on change to Timeout
+ Patched by @srawlins in https://github.com/ruby/ruby/pull/440
- * parse.y (parser_parse_string): keep line number even after an
- unterminated string literal. it does not matter in the parser,
- ripper needs this value after this error.
+Sun Nov 10 23:47:05 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- parse.y: unterminated content token
+ * gc.c (rb_gcdebug_print_obj_condition): catch up recent changes
+ to compile on GC_DEBUG.
- * parse.y (parser_parse_string): defer the end token to next
- reading, to yield tSTRING_CONTENT with the unterminated content.
- [Bug #13363]
+Sun Nov 10 22:16:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Apr 30 22:52:38 2017 Marcus Stollsteimer <sto.mar@web.de>
+ * error.c (exc_cause): captured previous exception.
- * io.c: [DOC] expand docs for IO#puts
- [Bug #13306]
+ * eval.c (make_exception): capture previous exception automagically.
+ [Feature #8257]
-Sun Apr 30 22:38:44 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Nov 10 08:37:20 2013 Zachary Scott <e@zzak.io>
- sample/pty/shl.rb: update [ci skip]
+ * thread.c: [DOC] Remove duplicate reference
- * sample/pty/shl.rb: stop writer loop when the child exited.
- PTY::ChildExited no longer raises asynchronously since r20298.
- [ruby-dev:49974] [Bug #13191]
+Sun Nov 10 08:09:29 2013 Zachary Scott <e@zzak.io>
- * sample/pty/shl.rb: use io/console instead of stty.
- [ruby-dev:49974] [Bug #13191]
+ * lib/drb/drb.rb: [DOC] promote better windows-safe filename regular
+ expression in DRb Logger example. Reported by Chris Pheonix
+ [Bug #9074]
- * sample/pty/shl.rb: do not manage array length separately.
- [ruby-dev:49974] [Bug #13191]
+Sun Nov 10 08:03:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * sample/pty/shl.rb: leap exited child process.
- [ruby-dev:49974] [Bug #13191]
+ * gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
+ finalizer functions.
-Sun Apr 30 22:35:10 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Nov 10 07:41:22 2013 Zachary Scott <e@zzak.io>
- configure.in: use AC_SEARCH_LIBS
+ * lib/weakref.rb: [DOC] fix typos by @xaviershay [Fixes GH-439]
+ https://github.com/ruby/ruby/pull/439
- * configure.in (--with-gmp, --with-jemalloc): use AC_SEARCH_LIBS
- to check if no library is required, instead of AC_CHECK_LIB.
- [ruby-core:79368] [Bug #13175]
+Sun Nov 10 06:14:39 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sun Apr 30 22:24:25 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (iseq_compile_each): emit opt_str_freeze if the #freeze
+ method is called on a static string literal with no arguments.
- * numeric.c (flo_round): [EXPERIMENTAL] adjust the case that the
- receiver is close to the exact but unrepresentable middle value
- of two values in the given precision.
- http://d.hatena.ne.jp/hnw/20160702
+ * defs/id.def (firstline): add freeze so idFreeze is available
-Sun Apr 9 22:21:23 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+ * insns.def (opt_str_freeze): add opt_str_freeze instruction which
+ pushes a frozen string literal without allocating a new object if
+ String#freeze is not overridden
- thread.c: rb_thread_fd_close [ci skip]
+ * string.c (Init_String): define String#freeze
- * thread.c (rb_thread_fd_close): re-define because of a couple of
- external libraries used it.
+ * vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as
+ a basic operation
-Wed Mar 29 23:47:31 2017 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * vm_insnhelper.h: ditto
- * hash.c (any_hash): fix CI failure on L32LLP64 architecture.
- The patch was provided by usa. [ruby-core:80484] [Bug #13376]
+ [Feature #8992] [ruby-core:57705]
-Wed Mar 29 06:22:27 2017 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Sun Nov 10 01:34:14 2013 Koichi Sasada <ko1@atdot.net>
- * hash.c (any_hash): fix Symbol#hash to be nondeterministic.
- The patch was provided by Eric Wong. [ruby-core:80433] [Bug #13376]
+ * gc.c (vm_malloc_increase): sweep immediately on GC due to malloc().
+ To reduce memory usage, sweep as soon as possible.
+ This behavior is same as Ruby 2.0.0 and before.
- * test/ruby/test_symbol.rb: add test for above.
+Sun Nov 10 00:39:26 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 28 00:38:39 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+ * benchmark/gc/gcbench.rb: output version description and GC::OPTS.
- * win32/win32.c (poll_child_status): rb_w32_wait_events_blocking() sets
- errno internally, then should not set it here.
+Sun Nov 10 00:36:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Mar 27 20:15:17 2017 Kazuki Tsujimoto <kazuki@callcc.net>
+ * gc.c (should_be_callable): allow private call since rb_eval_cmd
+ calls even private methods.
- * eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
- TracePoint#method_id should return method_id, not callee_id.
- [ruby-core:77241] [Feature #12747]
+Sun Nov 10 00:33:17 2013 Zachary Scott <e@zzak.io>
- * test/ruby/test_settracefunc.rb: change accordingly.
+ * lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo by Tsuyoshi Sawada
+ [Bug #9077]
-Mon Mar 27 20:12:23 2017 Anton Davydov <mail@davydovanton.com>
+Sat Nov 9 22:35:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`
- with class method.
- * test/uri/test_mailto.rb: Added tests for coverage.
+ * tool/rbinstall.rb (Gem::Specification.load): obtain spec date from
+ VCS for the case using git, RUBY_RELEASE_DATE is the last resort.
+ probably fixes [Bug #9085].
-Mon Mar 20 06:35:08 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 20:56:12 2013 Narihiro Nakamura <authornari@gmail.com>
- * ruby.c (process_options): convert -e script to the encoding
- given by a command line option on Windows. assume it is the
- expected encoding. [ruby-dev:49461] [Bug #11900]
+ * ext/objspace/object_tracing.c: use declarations in internal.h.
-Mon Mar 20 05:47:49 2017 Koichi Sasada <ko1@atdot.net>
+ * ext/objspace/objspace.c: ditto
- * test/ruby/test_exception.rb: fix thread issues.
- * use Queue instead of a local variable for synchronization.
- * join created thread to soleve leaking threads warning.
+Sat Nov 9 20:32:59 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 20 05:47:49 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/objspace/test_objspace.rb (test_dump_all): Make the test string
+ shorter to be an embedded string on 32bit environment as well as
+ 64bit environment.
- * thread.c (rb_threadptr_raise): set cause from the called thread,
- but not from the thread to be interrupted.
- [ruby-core:77222] [Bug #12741]
+Sat Nov 9 15:00:16 2013 Zachary Scott <e@zzak.io>
-Wed Feb 8 02:17:02 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c: [DOC] ARGF.gets may return nil [Bug #9029] patch by znz
- * lib/forwardable.rb (Forwardable._delegator_method): extract
- method generator and deal with non-module objects.
- [ruby-dev:49656] [Bug #12478]
+Sat Nov 9 14:54:52 2013 Zachary Scott <e@zzak.io>
-Wed Feb 8 02:17:02 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rss/*: [DOC] document various constants @steveklabnik [Bug #8812]
- * lib/forwardable.rb (def_instance_delegator): adjust backtrace of
- method body by tail call optimization. adjusting the delegated
- target is still done by deleting backtrace.
+Sat Nov 9 14:50:09 2013 Zachary Scott <e@zzak.io>
- * lib/forwardable.rb (def_single_delegator): ditto.
+ * lib/rss/rss.rb: [DOC] document Time#w3cdtf by @steveklabnik
+ [Bug #8821]
-Tue Jan 17 03:51:48 2017 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 14:29:04 2013 Zachary Scott <e@zzak.io>
- * compile.c (setup_args): duplicate splatting array if more
- arguments present to obey left-to-right execution order.
- [ruby-core:77701] [Bug# 12860]
+ * ext/dl/cfunc.c: [DOC] fix typo in example [Bug #8944]
+ Patched by Heesob Park
-Thu Nov 24 05:47:18 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Sat Nov 9 13:59:58 2013 Zachary Scott <e@zzak.io>
- * test/fileutils/test_fileutils.rb (TestFileUtils#setup): Use primary
- group as well as supplementary groups.
- based on the patch by Vit Ondruch at [Bug #12910]
+ * lib/test/unit/assertions.rb: [DOC] better example for assert_send()
+ Patch by Andrew Grimm [Bug #8975]
-Thu Nov 24 05:44:04 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Sat Nov 9 12:45:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * test/ruby/test_dir_m17n.rb: Don't encode to UTF-8 if it's unnecessary.
- If the file system encoding is ISO-8851-1 or if the encoding of the
- target string is invalid, don't encode to UTF-8. [Bug#12972]
+ * insns.def: unify ic_constant_serial and ic_class_serial into one field
+ ic_serial. This is possible because these fields are only ever used
+ exclusively with each other.
-Mon Nov 21 16:55:15 2016 boshan <boshan@subsplash.com>
+ * insns.def: ditto
+ * vm_core.h: ditto
+ * vm_insnhelper.c: ditto
- * lib/tempfile.rb (Tempfile#initialize): [DOC] the first parameter
- `basename` is optional and defaulted to an empty string since
- [GH-523]. [Fix GH-1225]
+Sat Nov 9 12:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sat Nov 19 14:06:07 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * class.c: unify names of vm state version counters to 'serial'.
+ This includes renaming 'vm_state_version_t' to 'rb_serial_t',
+ 'method_state' to 'method_serial', 'seq' to 'class_serial',
+ 'vmstat' to 'constant_serial', etc.
- * iseq.c (proc_dup): don't duplicate sym_procs. [Fix GH-1479]
- [ruby-core:78100] [Bug #12927]
- Based on the patch provided by Emiliano Ritiro.
+ * insns.def: ditto
+ * internal.h: ditto
+ * vm.c: ditto
+ * vm_core.h: ditto
+ * vm_insnhelper.c: ditto
+ * vm_insnhelper.h: ditto
+ * vm_method.c: ditto
-Sat Nov 19 11:48:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 09:22:29 2013 Masaya Tarui <tarui@ruby-lang.org>
- * iseq.c (iseqw_s_compile_file): deal with syntax error as well as
- compile, and should not abort when rescued.
+ * gc.c (gc_page_sweep, rgengc_rememberset_mark): Refactoring.
+ Get bitmaps directly.
-Wed Nov 16 23:40:29 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Sat Nov 9 09:16:36 2013 Masaya Tarui <tarui@ruby-lang.org>
- * vm_eval.c (vm_call0_body): refined module should not be skipped as
- prepended. [Bug #12920]
+ * gc.c (RVALUE_PROMOTE_INFANT): Refactoring. Remove duplicated nonsense
+ code.
-Tue Nov 15 03:14:02 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Nov 9 09:04:48 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/-test/file/fs.c (get_atime_p): Updating of file access times
- is enabled or not.
+ * gc.c (gc_marks_test): Bugfix. Fix a struct member name for build
+ with RGENGC_CHECK_MODE.
-Tue Nov 15 03:14:02 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 08:58:23 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/ruby/test_file.rb (TestFile#test_stat): fix noatime case.
- [ruby-core:77943] [Bug #12903]
+ * gc.c : Add GC_PROFILE_DETAIL_MEMORY option.
+ If GC_PROFILE_MORE_DETAIL && GC_PROFILE_DETAIL_MEMORY,
+ maxrss, minflt and majflt are added to each profile record.
-Tue Nov 15 03:09:39 2016 Shugo Maeda <shugo@ruby-lang.org>
+Sat Nov 9 07:41:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rinda/test_rinda.rb (test_make_socket_ipv6_multicast,
- test_make_socket_ipv6_multicast_hops): skip if IPv6 multicast
- address is not available.
+ * internal.h (rb_vm_backtrace_object, rb_gc_count): make prototype
+ declarations, not old-K&R style.
-Tue Nov 15 02:49:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Nov 9 06:11:14 2013 vo.x (Vit Ondruch) <vondruch@redhat.com>
- * vm_eval.c (vm_call0_body): follow the original class, not to
- loop the prepended module. [ruby-core:77784] [Bug #12876]
+ * tool/rbinstall.rb (Gem::Specification#collect): make stable
+ Gem::Specification.files in default .gemspecs the different order of
+ "files" in .gemspec files makes them different therefore possibly
+ conflicting in multilib scenario. patch by vo.x (Vit Ondruch) at
+ [ruby-core:57544] [Bug #8623].
-Tue Nov 15 02:45:44 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Nov 9 01:59:18 2013 Aman Gupta <ruby@tmm1.net>
- * lib/net/http.rb (transport_request): other than HTTPContinue
- in 1xx (HTTPInformation) also needs to continue. [Bug #12890]
+ * ext/objspace/objspace_dump.c: Add experimental methods to
+ dump objectspace as json: ObjectSpace.dump_all and
+ ObjectSpace.dump(obj). These methods are useful for debugging
+ reference leaks and memory growth in large ruby applications.
+ [Bug #9026] [ruby-core:57893] [Fixes GH-423]
+ * test/objspace/test_objspace.rb: tests for above.
-Sat Nov 12 01:05:45 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Nov 9 00:26:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * object.c: Improve documentation for Float conversion.
- [ruby-core:71661][Bug #11736][ci skip]
+ * file.c (GetLastError): already defined in windows.h on nowadays
+ cygwin, and caused the confliction with the system provided
+ definition on cygwin64. by @kou1okada [Fixes GH-433].
-Sat Nov 12 00:50:35 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 8 18:35:31 2013 Masaki Matsushita <glass.saga@gmail.com>
- * proc.c (mnew_internal): follow the original class, not to loop
- the prepended module. [ruby-core:77591] [Bug #12832]
+ * lib/open3.rb: receive arguments as keyword arguments.
-Sat Nov 12 00:46:50 2016 Shugo Maeda <shugo@ruby-lang.org>
+Fri Nov 8 13:19:26 2013 Masaki Matsushita <glass.saga@gmail.com>
- * cont.c (cont_new): disable optimization if clang's version is
- 3.8.0. [ruby-core:77894] [Bug #12893]
+ * io.c (rb_io_open_with_args): use RARRAY_CONST_PTR().
-Sat Nov 12 00:27:24 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c (rb_scan_open_args): use const qualifier for above.
- * compile.c (iseq_peephole_optimize): enable tail call
- optimization inside a conditional block.
+ * io.c (rb_open_file): ditto.
-Sat Nov 5 11:53:17 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c (rb_io_open_with_args): ditto.
- * io.c (copy_stream_body): use IO to write to copy to duplex IO.
- http://twitter.com/knu/status/786505317974585344
+Fri Nov 8 11:35:06 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sat Nov 5 11:49:41 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
- * sprintf.c (rb_str_format): format exact number more exactly.
+Fri Nov 8 10:58:02 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sat Nov 5 11:45:32 2016 Kazuki Yamaguchi <k@rhe.jp>
+ * compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
- * ext/openssl/ossl.c (Init_openssl): register an ex_data index for
- X509_STORE and X509_STORE_CTX respectively. Since they don't share
- the ex_data index registry, we can't use the same index.
- (ossl_verify_cb): use the the correct index.
+ * compile.c (iseq_build_from_ary_body): ditto.
- * ext/openssl/ossl_ssl.c (ossl_ssl_verify_callback): ditto.
+Fri Nov 8 10:49:34 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/openssl/ossl_x509store.c (ossl_x509store_set_vfy_cb): ditto.
- (ossl_x509stctx_verify): ditto.
+ * enumerator.c (append_method): use RARRAY_CONST_PTR().
- * ext/openssl/ossl.h (void ossl_clear_error): add extern declarations
- of ossl_store_{ctx_,}ex_verify_cb_idx.
+ * enumerator.c (lazy_init_iterator): ditto.
- * ext/openssl/openssl_missing.c: remove X509_STORE_set_ex_data and
- X509_STORE_get_ex_data.
+Fri Nov 8 02:44:29 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/openssl_missing.h: implement X509_STORE_get_ex_data,
- X509_STORE_set_ex_data and X509_STORE_get_ex_new_index as macros.
+ * gc.c (vm_malloc_increase): check GVL before gc_rest_sweep().
+ vm_malloc_increase() can be called without GVL.
+ However, gc_rest_sweep() assumes acquiring GVL.
+ To avoid this problem, check GVL before gc_rest_sweep().
+ [Bug #9090]
-Sat Nov 5 11:35:58 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This workaround introduces possibility to set malloc_limit as
+ wrong value (*1). However, this may be rare case. So I commit it.
- * thread.c (rb_thread_pending_interrupt_p): no pending interrupt
- before initialization.
+ *1: Without rest_sweep() here, gc_rest_sweep() can decrease
+ malloc_increase due to ruby_sized_xfree().
- * thread.c (thread_raise_m, rb_thread_kill): uninitialized thread
- cannot interrupt. [ruby-core:72732] [Bug #11959]
+Fri Nov 8 02:50:25 2013 Zachary Scott <e@zzak.io>
-Sat Nov 5 11:16:58 2016 Kenta Murata <mrkn@mrkn.jp>
+ * lib/securerandom.rb: [DOC] specify arguments passed to ::random_bytes
+ By @chastell [Fixes GH-412] https://github.com/ruby/ruby/pull/412
- * ext/bigdecimal/bigdecimal.c: Import changes from ruby/bigdecimal
- repository.
+Fri Nov 8 02:43:01 2013 Zachary Scott <e@zzak.io>
-Tue Oct 18 02:58:22 2016 Kazuki Yamaguchi <k@rhe.jp>
+ * ext/objspace/object_tracing.c: [DOC] trace_object_allocations_stop
+ By @srawlins [Fixes GH-421] https://github.com/ruby/ruby/pull/421
- * eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with
- Qundef rather than 0 which is equal to Qfalse. Since Kernel#throw(obj)
- searches a tag with rb_vm_tag::tag == obj, throw(false) can
- accidentally find an unrelated tag which is not created by
- Kernel#catch. [ruby-core:77229] [Bug #12743]
+Fri Nov 8 02:34:20 2013 Zachary Scott <e@zzak.io>
- * test/ruby/test_exception.rb (test_throw_false): Add a test case for
- this.
+ * lib/net/ftp.rb: [DOC] Document Net::FTP.mdtm and .set_socket and fix
+ spelling typo, based on patch by @artfuldodger [Fixes GH-426]
+ https://github.com/ruby/ruby/pull/426
-Tue Oct 18 02:24:29 2016 Aurelien Jacobs <aurel@gnuage.org>
+Fri Nov 8 02:14:37 2013 Zachary Scott <e@zzak.io>
- * lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
- rotate when DST is applied during a month of 31 days.
- [Fix GH-1458]
+ * array.c: [DOC] Add note about negative indices in Array overview
+ By @ckaenzig [Fixes GH-427] https://github.com/ruby/ruby/pull/427
-Wed Oct 12 22:31:09 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri Nov 8 02:09:12 2013 Zachary Scott <e@zzak.io>
- * tool/downloader.rb: Removed verification of gem certification.
- Because signed gem is not working on rubygems ecosystem.
- * tool/gem-unpack.rb: ditto.
+ * lib/csv.rb: [DOC] Fix typo in CSV.parse_line by @funky-bibimbap
+ [Fixes GH-430] https://github.com/ruby/ruby/pull/430
-Fri Oct 7 02:48:06 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Fri Nov 8 01:01:54 2013 Zachary Scott <e@zzak.io>
- * lib/rubygems/ssl_certs/GlobalSignRootCA.pem: add for RugyGems.org.
+ * golf_prelude.rb: syntax formatting for whitespace [Fixes GH-425]
+ Patch by @edward https://github.com/ruby/ruby/pull/425
-Mon Sep 26 23:51:31 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 7 19:36:09 2013 Koichi Sasada <ko1@atdot.net>
- * variable.c (rb_const_search): raise with the actual class/module
- name which defines the private constant.
+ * gc.c: modify malloc_limit strategy.
-Mon Sep 26 23:34:09 2016 Kazuki Yamaguchi <k@rhe.jp>
+ * fix default values:
+ GC_MALLOC_LIMIT_GROWTH_FACTOR
+ GC_MALLOC_LIMIT: 8MB -> 16MB
+ GC_MALLOC_LIMIT_MAX: 384MB -> 32MB
- * ext/openssl/ossl_pkcs12.c (ossl_pkcs12_initialize): pop errors
- leaked by PKCS12_parse(). This is a bug in OpenSSL, which exists
- in the versions before the version 1.0.0t, 1.0.1p, 1.0.2d.
+ * algorithm of malloc_limit increment.
+ if (malloc_increase < malloc_limit) {
+ next_malloc_limit = malloc_limit * factor
+ if (malloc_limit > malloc_limit_max) {
+ malloc_limit = malloc_increase
+ }
+ }
+ This algorithm change malloc_limit from
+ 16MB -> 32MB slowly.
+ If malloc_limit exceeds malloc_limit_max, then
+ increase with malloc_increase.
-Mon Sep 26 23:10:43 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Nov 7 11:06:05 2013 Masaki Matsushita <glass.saga@gmail.com>
- * vm_dump.c (backtrace): use rip in the saved context for the case
- the SIGSEGV is received when the process is in userland.
- Note that ip in the stack should be used if the signal is received
- when it is in kernel (when it is calling syscall) [Bug #12711]
+ * array.c (rb_ary_shuffle_bang): use RARRAY_PTR_USE() without WB
+ because there are not new relations.
-Mon Sep 26 20:23:32 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Thu Nov 7 10:34:12 2013 Masaki Matsushita <glass.saga@gmail.com>
- * gems/bundled_gems: update minitest to 5.8.5.
+ * array.c (rb_ary_sample): use rb_ary_dup().
- * tool/downloader.rb: revert workarounds.
+Thu Nov 7 09:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/gem-unpack.rb: ditto.
+ * vm_trace.c (rb_threadptr_exec_event_hooks_orig): errinfo should not
+ be propagated to trace blocks so that no argument raise does not
+ throw internal objects. [ruby-dev:47793] [Bug #9088]
-Mon Sep 26 07:26:44 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Wed Nov 6 21:30:55 2013 Masaya Tarui <tarui@ruby-lang.org>
- * tool/gem-unpack.rb: don't set security policy.
- workaround for certificate expiration of minitest-5.8.3.gem.
+ * gc.c (gc_before_sweep): Change algorithm of malloc_limit to
+ conservative for closing to memory consumption of ruby 2.0.
-Mon Sep 26 06:33:16 2016 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c (GC_MALLOC_LIMIT, GC_MALLOC_LIMIT_GROWTH_FACTOR):
+ Adjust parameters for new algorithm.
- * lib/uri/generic.rb (def check_password): don't include bad password
- in URI exception output
+Wed Nov 6 21:16:51 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/uri/test_generic.rb (def test_set_component): test for behavior
+ * array.c (rb_ary_shift_m): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
-Mon Sep 26 06:20:58 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Wed Nov 6 21:05:20 2013 Masaki Matsushita <glass.saga@gmail.com>
- * tool/downloader.rb: comment out gem package verification.
- workaround for certificate expiration of minitest-5.8.3.gem.
+ * array.c (rb_ary_reverse): use RARRAY_PTR_USE().
-Sun Sep 25 16:37:22 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 6 19:30:44 2013 Masaya Tarui <tarui@ruby-lang.org>
- * io.c (nogvl_fsync, nogvl_fdatasync): on Windows, just ignore if the
- fd is associated to non-disk device. if call fsync and/or fdatasync
- with such fds, it causes Errno::EBADF exception and the behavior is
- incompatible with ruby 2.1 and earlier unintentionally introduced.
+ * common.mk (help): add texts about gcbench.
-Sun Sep 25 15:09:04 2016 Kazuki Tsujimoto <kazuki@callcc.net>
+Wed Nov 6 16:32:32 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
- * array.c (flatten): use rb_obj_class instead of rb_class_of
- because rb_class_of may return a singleton class.
- [ruby-dev:49781] [Bug #12738]
+ * lib/open3.rb: tweaked grammar in comments
-Sun Sep 25 15:07:19 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Nov 6 11:46:36 2013 Masaki Matsushita <glass.saga@gmail.com>
- * man/irb.1: remove useless -width option.
- [ruby-dev:49767] [Bug #12692]
+ * array.c (rb_ary_sample): use RARRAY_AREF() and RARRAY_PTR_USE()
+ instead of RARRAY_PTR().
-Tue Aug 30 05:24:33 2016 Kazuki Yamaguchi <k@rhe.jp>
+Wed Nov 6 10:37:07 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/openssl/ossl_x509ext.c: additional fix memory leak.
- [ruby-core:76922] [Bug #12680]
+ * array.c (rb_ary_and): defer hash creation and some refactoring.
- * text/openssl/test_x509ext.rb: test for above.
+Wed Nov 6 09:14:31 2013 Koichi Sasada <ko1@atdot.net>
-Sun Aug 28 00:26:58 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * benchmark/bm_vm1_gc_short_lived.rb: added.
+ These GC benchmarks do not reflect practical applications.
+ They are only for tuning.
- * vm_method.c: revert r55869. it breaks Integer#days with
- ActiveSupport-4.1.x. [ruby-core:76949] [Bug #12353]
+ * benchmark/bm_vm1_gc_short_with_complex_long.rb: added.
- * test/ruby/test_marshal.rb: ditto.
+ * benchmark/bm_vm1_gc_short_with_long.rb: added.
-Sat Aug 27 03:51:23 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_vm1_gc_short_with_symbol.rb: added.
- * id_table.c (hash_table_extend): should not shrink the table than
- the previous capacity. [ruby-core:76534] [Bug #12614]
+ * benchmark/bm_vm1_gc_wb_ary.rb: added.
-Sat Aug 27 03:37:49 2016 Kazuki Yamaguchi <k@rhe.jp>
+ * benchmark/bm_vm1_gc_wb_obj.rb: added.
- * ext/openssl/ossl_config.c: fix memory leak.
- [ruby-core:76922] [Bug #12680]
+ * benchmark/bm_vm_thread_queue.rb: added.
+ This benchmark is added to know how fast C version of thread.so.
- * ext/openssl/ossl_ocsp.c: ditto.
+Wed Nov 6 09:13:32 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_pkcs12.c: ditto.
+ * gc.c: define RGENGC_ESTIMATE_OLDSPACE == 0 if USE_RGENGC is 0.
- * ext/openssl/ossl_pkcs7.c: ditto.
+Wed Nov 6 07:13:18 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_pkey_ec.c: ditto.
+ * gc.c (Init_GC): add GC::OPTS to show options.
- * ext/openssl/ossl_x509.h: ditto.
+Wed Nov 6 07:12:17 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_x509attr.c: ditto.
+ * benchmark/gc/gcbench.rb: add some options to make quiet.
- * ext/openssl/ossl_x509crl.c: ditto.
+Wed Nov 6 04:14:25 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/openssl/ossl_x509ext.c: ditto.
+ * ext/psych/lib/psych/visitors/to_ruby.rb: process merge keys before
+ reviving objects. Fixes GH psych #168
+ * test/psych/test_merge_keys.rb: test for change
+ https://github.com/tenderlove/psych/issues/168
- * ext/openssl/ossl_x509req.c: ditto.
+Tue Nov 5 21:21:47 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_x509revoked.c: ditto.
+ * test/ruby/test_thread.rb (test_thread_join_in_trap):
+ Run the test in a different process.
-Thu Aug 25 00:19:24 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Nov 5 20:14:32 2013 Masaya Tarui <tarui@ruby-lang.org>
- * lib/rubygems/specification.rb: `coding` is affect only first line except
- shebang.
- * lib/rubygems/package.rb, lib/rubygems/package/*: ditto.
+ * gc.c (is_live_object): A hidden object may be a live object.
+ [ruby-dev:47788] [Bug #9072]
-Thu Aug 25 00:19:24 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Nov 5 13:37:19 2013 Koichi Sasada <ko1@atdot.net>
- * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2.
- It supports to enable frozen string literal and add `--norc` option for
- disable to `.gemrc` configuration.
- See 2.5.2 release notes for other fixes and enhancements.
- https://github.com/rubygems/rubygems/blob/a8aa3bac723f045c52471c7b9328310a048561e0/History.txt#L3
+ * gc.c: add support to estimate increase of oldspace memory usage.
+ This is another approach to solve an issue discussed at r43530.
+ This feature is disabled as default.
-Wed Aug 24 23:54:40 2016 Charles Oliver Nutter <headius@headius.com>
+ This feature measures an increment of memory consumption by oldgen
+ objects. It measures memory consumption for each objects when
+ the object is promoted. However, measurement of memory consumption
+ is not accurate now. So that this measurement is `estimation'.
- * test/ruby/test_array.rb: split out the test for no stack error
- on large input for test_permutation, test_repeated_permutation,
- and test_repeated_combination, and make them all timeout:30.
+ To implement this feature, move memsize_of() function from
+ ext/objspace/objspace.c and expose rb_obj_memsize_of().
-Tue Aug 23 03:22:34 2016 Naohisa Goto <ngotogenome@gmail.com>
+ Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
+ measure memory size, so that we ignores T_DATA objects now.
+ For example, some functions skip NULL check for pointer.
- * test/fiddle/test_pointer.rb (test_to_str, test_to_s, test_aref_aset):
- Attempt to use independent strings for destructive tests that
- directly modify values on memory by using Fiddle::Pointer.
- [Bug #12537] [ruby-dev:49700]
+ The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
+ and turned off as default.
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ We need to compare 3gen GC and this feature carefully.
+ (it is possible to enable both feature)
+ We need a help to compare them.
- * string.c (str_buf_cat): Fix capa size for embed string.
- Fix bug in r55547. [Bug #12536]
+ * internal.h: expose rb_obj_memsize_of().
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ * ext/objspace/objspace.c: use rb_obj_memsize_of() function.
- * string.c (rb_str_change_terminator_length): New function to change
- termlen and resize heap for the terminator. This is split from
- rb_str_fill_terminator (str_fill_term) because filling terminator
- and changing terminator length are different things. [Bug #12536]
+ * cont.c (fiber_memsize): fix to check NULL.
- * internal.h: declaration for rb_str_change_terminator_length.
+ * variable.c (autoload_memsize): ditto.
- * string.c (str_fill_term): Simplify only to zero-fill the terminator.
- For non-shared strings, it assumes that (capa + termlen) bytes of
- heap is allocated. This partially reverts r55557.
+ * vm.c (vm_memsize): ditto.
- * encoding.c (rb_enc_associate_index): rb_str_change_terminator_length
- is used, and it should be called whenever the termlen is changed.
+Tue Nov 5 04:03:07 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (str_capacity): New static function to return capacity
- of a string with the given termlen, because the termlen may
- sometimes be different from TERM_LEN(str) especially during
- changing termlen or filling terminator with specific termlen.
+ * gc.c (GC_MALLOC_LIMIT_MAX): fix default value 512MB -> 384MB.
+ 512MB is huge.
- * string.c (rb_str_capacity): Use str_capacity.
+Tue Nov 5 03:31:23 2013 Koichi Sasada <ko1@atdot.net>
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ * gc.c: add 3gen GC patch, but disabled as default.
- * string.c: Partially reverts r55547 and r55555.
- ChangeLog about the reverted changes are also deleted in this file.
- [Bug #12536] [ruby-dev:49699] [ruby-dev:49702]
+ RGenGC is designed as 2 generational GC, young and old generation.
+ Young objects will be promoted to old objects after one GC.
+ Old objects are not collect until major (full) GC.
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ The issue of this approach is some objects can promoted as old
+ objects accidentally and not freed until major GC.
+ Major GC is not frequently so short-lived but accidentally becoming
+ old objects are not freed.
- * string.c (str_fill_term): When termlen increases, re-allocation
- of memory for termlen should always be needed.
- In this fix, if possible, decrease capa instead of realloc.
- [Bug #12536] [ruby-dev:49699]
+ For example, the program "loop{Array.new(1_000_000)}" consumes huge
+ memories because short lived objects (an array which has 1M
+ elements) are promoted while GC and they are not freed before major
+ GC.
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ To solve this problem, generational GC with more generations
+ technique is known. This patch implements three generations gen GC.
- * string.c: Specify termlen as far as possible.
- Additional fix for [Bug #12536] [ruby-dev:49699].
+ At first, newly created objects are "Infant" objects.
+ After surviving one GC, "Infant" objects are promoted to "Young"
+ objects.
+ "Young" objects are promoted to "Old" objects after surviving
+ next GC.
+ "Infant" and "Young" objects are collected if it is not marked
+ while minor GC. So that this technique solves this problem.
- * string.c (str_new_static): Specify termlen from the given encoding
- when creating a new String object is needed.
+ Representation of generations:
+ * Infant: !FL_PROMOTED and !oldgen_bitmap [00]
+ * Young : FL_PROMOTED and !oldgen_bitmap [10]
+ * Old : FL_PROMOTED and oldgen_bitmap [11]
- * string.c (rb_tainted_str_new_with_enc): New function to create a
- tainted String object with the given encoding. This means that
- the termlen is correctly specified. Currently static function.
- The function name might be renamed to rb_tainted_enc_str_new
- or rb_enc_tainted_str_new.
+ The macro "RGENGC_THREEGEN" enables/disables this feature, and
+ turned off as default because there are several problems.
+ (1) Failed sometimes (Heisenbugs).
+ (2) Performance down.
+ Especially on write barriers. We need to detect Young or Old
+ object by oldgen_bitmap. It is slower than checking flags.
- * string.c (rb_external_str_new_with_enc): Use encoding by using the
- above rb_tainted_str_new_with_enc().
+ To evaluate this feature on more applications, I commit this patch.
+ Reports are very welcome.
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ This patch includes some refactoring (renaming names, etc).
- * string.c (rb_str_subseq, str_substr): When RSTRING_EMBED_LEN_MAX
- is used, TERM_LEN(str) should be considered with it because
- embedded strings are also processed by TERM_FILL.
- Additional fix for [Bug #12536] [ruby-dev:49699].
+ * include/ruby/ruby.h: catch up 3gen GC.
-Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+ * .gdbinit: fix to show a prompt "[PROMOTED]" for promoted objects.
- * string.c: Fix memory corruptions when using UTF-16/32 strings.
- [Bug #12536] [ruby-dev:49699]
+Tue Nov 5 00:05:51 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_new_with_class): Use TERM_LEN of the "obj".
+ * node.h: catch up comments for last commit.
- * string.c (rb_str_plus, rb_str_justify): Use str_new0 which is aware
- of termlen.
+Tue Nov 5 00:02:00 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (str_shared_replace): Copy +termlen bytes instead of +1.
+ * include/ruby/ruby.h: rename FL_OLDGEN to FL_PROMOTED.
+ This flag represents that "this object is promoted at least once."
- * string.c (rb_str_times): termlen should not be included in capa.
+ * gc.c, debug.c, object.c: catch up this change.
- * string.c (RESIZE_CAPA_TERM): When using RSTRING_EMBED_LEN_MAX,
- termlen should be counted with it because embedded strings are
- also processed by TERM_FILL.
+Mon Nov 4 22:20:16 2013 Tanaka Akira <akr@fsij.org>
- * string.c (rb_str_capacity, str_shared_replace, str_buf_cat): ditto.
+ * test/xmlrpc: Don't use fixed ports: 8070 and 8071.
- * string.c (rb_str_drop_bytes, rb_str_setbyte, str_byte_substr): ditto.
+Mon Nov 4 15:25:52 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 18 23:43:33 2016 Eric Wong <e@80x24.org>
+ * test/xmlrpc/webrick_testing.rb (start_server): Initialize the server
+ at main thread to fail early.
- * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal):
- avoid undefined behavior
- * test/openssl/test_pair.rb (test_write_zero): new test
- [ruby-core:76751] [Bug #12660]
+Mon Nov 4 10:08:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 18 23:18:17 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval_intern.h (TH_EXEC_TAG, TH_JUMP_TAG): get rid of undefined
+ behavior of setjmp() in rhs of assignment expression.
+ [ISO/IEC 9899:1999] 7.13.1.1
- * ext/socket/option.c, ext/socket/rubysocket.h (inet_ntop): share
- the fallback definition. [ruby-core:76646] [Bug #12645]
+Sun Nov 3 23:06:51 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 18 23:07:29 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sample/test.rb: Make temporary file names unique.
- * vm.c (vm_set_main_stack): remove unnecessary check. toplevel
- binding must be initialized. [Bug #12611] (N1)
+Sun Nov 3 20:41:17 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (w32_symlink): fix return type. [Bug #12611] (N3)
+ * test/xmlrpc: Wrap definitions by TestXMLRPC module.
- * string.c (rb_str_split_m): simplify the condition.
- [Bug #12611](N4)
+Sun Nov 3 20:23:38 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 18 23:06:20 2016 Kouhei Sutou <kou@cozmixng.org>
+ * test/xmlrpc/webrick_testing.rb (stop_server): Don't try to shutdown
+ the server if the server is not started.
- * lib/rexml/attribute.rb (REXML::Attribute#to_string): Fix wrong
- entry reference name of double quote.
- [Bug #12609][ruby-core:76509]
- Patch by Joseph Marrero. Thanks!!!
+Sun Nov 3 09:35:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 18 23:04:59 2016 Naohisa Goto <ngotogenome@gmail.com>
+ * load.c (rb_feature_p): deal with default loadable suffixes.
- * thread.c (rb_wait_for_single_fd): Clean up fds.revents every time
- before calling ppoll(2). [Bug #12575] [ruby-dev:49725]
+ * load.c (load_lock): initialize statically linked extensions.
-Thu Aug 18 22:52:19 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * load.c (search_required, rb_require_safe): deal with statically
+ linked extensions.
- * vm_args.c (setup_parameters_complex): don't raise ArgumentError
- if an array is given for instance_exec with optional argument.
- [ruby-core:76300] [Bug #12568]
- https://github.com/rails/rails/pull/25699
+ * load.c (ruby_init_ext): defer initialization of statically linked
+ extensions until required actually. [Bug #8883]
-Tue Aug 16 12:27:48 2016 Koichi Sasada <ko1@atdot.net>
+Sat Nov 2 15:14:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (gc_mark_roots): should mark the VM object itself to mark
- singleton class of the VM object.
- Before this patch, we only set mark bit for the VM object and
- invoke mark function separately.
- [Bug #12583]
+ * lib/logger.rb (Logger::LogDevice::LogDeviceMutex#lock_shift_log):
+ open file can't be removed or renamed on Windows. [ruby-dev:47790]
+ [Bug #9046]
- * test/ruby/test_gc.rb: add a test.
+ * test/logger/test_logger.rb (TestLogDevice#run_children): don't use
+ fork.
-Tue Aug 16 12:01:35 2016 Naohisa Goto <ngotogenome@gmail.com>
+Sat Nov 2 07:08:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/digest/md5/md5ossl.h: Remove excess semicolons.
- Suppress warning on Solaris with Oracle Solaris Studio 12.
- [ruby-dev:49692] [Bug #12524]
+ * lib/logger.rb: Inter-process locking for log rotation
+ Current implementation fails log rotation on multi process env.
+ by sonots <sonots@gmail.com>
+ https://github.com/ruby/ruby/pull/428 fix GH-428 [Bug #9046]
- * ext/digest/md5/md5cc.h: ditto.
- * ext/digest/sha1/sha1cc.h: ditto.
- * ext/digest/sha1/sha1ossl.h: ditto.
- * ext/digest/sha2/sha2cc.h: ditto.
- * ext/digest/sha2/sha2ossl.h: ditto.
+Fri Nov 1 23:24:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 16 11:51:52 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (wmap_mark_map): mark live objects only, but delete zombies.
+ [ruby-dev:47787] [Bug #9069]
- * compile.c (ADD_TRACE): ignore trace instruction on non-positive
- line.
+Fri Nov 1 22:45:54 2013 Masaya Tarui <tarui@ruby-lang.org>
- * parse.y (coverage): get rid of ArgumentError when the starting
- line number is not positive. [ruby-core:76141] [Bug #12517]
+ * gc.c (struct heap_page, gc_page_sweep, gc_sweep): Refactoring for
+ performance. Add before_sweep condition to heap_page structure.
-Tue Aug 16 11:51:52 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (rb_gc_force_recycle): Use before_sweep member.
- * test/coverage/test_coverage.rb: ignored test when enabled to coverage.
- It lead to crash with `make test-all`.
+ * gc.c (heap_is_before_sweep, is_before_sweep): Remove. They have not
+ already been used.
-Tue Aug 16 11:46:07 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Nov 1 22:20:28 2013 Masaya Tarui <tarui@ruby-lang.org>
- * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque
- only if the URI has path-rootless, not path-empty.
- [ruby-core:76055] [Bug #12498]
- patched by Chris Heisterkamp <cheister@squareup.com>
+ * gc.c (make_deferred): Refactoring. Collect codes which should be
+ atomic.
-Tue Aug 16 04:57:28 2016 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c (make_io_deferred, obj_free, rb_objspace_call_finalizer,
+ gc_page_sweep): Correspond to the above.
- * lib/net/http/generic_request.rb (write_header): A Request-Line must
- not contain CR or LF.
+Fri Nov 1 21:40:35 2013 Masaya Tarui <tarui@ruby-lang.org>
-Tue Aug 16 04:54:12 2016 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c (typedef struct rb_objspace): Refactoring. Move some members
+ into profile member.
- * lib/net/ftp.rb (putline): raise an ArgumentError when
- CR or LF is included in a line.
+ * gc.c (newobj_of): Correspond to the above.
-Tue Aug 16 04:38:48 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (finalize_list): Ditto.
- * ext/date/date_strftime.c (date_strftime_with_tmx): reject too
- large precision to get rid of buffer overflow.
- reported by Guido Vranken <guido AT guidovranken.nl>.
+ * gc.c (objspace_live_num): Ditto.
-Tue Aug 16 04:28:22 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_page_sweep): Ditto.
- * file.c (append_fspath): normalize directory name to be appended
- on OS X. [ruby-core:75957] [Ruby trunk Bug#12483]
- https://github.com/rails/rails/issues/25303#issuecomment-224834804
+ * gc.c (rb_gc_force_recycle): Ditto.
-Tue Aug 16 04:16:14 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (garbage_collect_body): Ditto.
- * regcomp.c (noname_disable_map): don't optimize out group 0
- Ruby's Regexp doesn't allow normal numbered groups if the regexp
- has named groups. On such case it optimizes out related NT_ENCLOSE.
- But even on the case it can use \g<0>.
- This fix not to remove NT_ENCLOSE whose regnum is 0.
- [ruby-core:75828] [Bug #12454]
+ * gc.c (rb_gc_count): Ditto.
-Tue Aug 16 04:06:52 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_stat): Ditto.
- * missing/crypt.c: fix size macros to use configured values
- for platforms long is larger than 32bit.
- [ruby-core:75792] [Bug #12446]
+ * gc.c (gc_prof_set_heap_info): Ditto.
-Tue Aug 16 04:03:25 2016 Kazuki Yamaguchi <k@rhe.jp>
+ * gc.c (gc_profile_dump_on): Ditto.
- * ext/openssl/ossl_bn.c (try_convert_to_bnptr): Extracted from
- GetBNPtr(). This doesn't raise exception but returns NULL on error.
- (GetBNPtr): Raise TypeError if conversion fails.
- (ossl_bn_eq): Implement BN#==.
- (ossl_bn_eql): #eql? should not raise TypeError even if the argument
- is not compatible with BN.
- (ossl_bn_hash): Implement BN#hash.
+Fri Nov 1 20:53:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_bn.c (Init_ossl_bn): Define #== and #hash.
+ * string.c (rb_str_scrub): fix typo, should yield invalid byte
+ sequence to be scrubbed. reported by znz at IRC.
- * test/openssl/test_bn.rb: Test BN#eql?, #== and #hash
+Fri Nov 1 17:25:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 16 03:51:59 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (is_live_object): finalizer may not run because of lazy-sweep.
+ [ruby-dev:47786] [Bug #9069]
- * transcode.c (str_transcode0): scrub in the given encoding when
- the source encoding is given, not in the encoding of the
- receiver. [ruby-core:75732] [Bug #12431]
+Fri Nov 1 16:55:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 16 03:41:21 2016 Kazuki Yamaguchi <k@rhe.jp>
+ * string.c (rb_str_scrub): export with fixed length arguments, and
+ allow nil as replacement string instead of omitting.
- * ext/openssl/ossl_pkey_dh.c (ossl_dh_compute_key): Check that the DH
- has 'p' (the prime) before calling DH_size(). We can create a DH with
- no parameter but DH_size() does not check and dereferences NULL.
- [ruby-core:75720] [Bug #12428]
+Fri Nov 1 06:20:44 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/openssl/ossl_pkey_dsa.c (ossl_dsa_sign): Ditto. DSA_size() does
- not check dsa->q.
+ * thread.c (rb_mutex_struct): reduce rb_mutex_t size by 8 bytes
+ on 64bit platform. Patch by Eric Wong. [Feature #9068][ruby-core:58114]
- * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_public_encrypt,
- ossl_rsa_public_decrypt, ossl_rsa_private_encrypt,
- ossl_rsa_private_decrypt): Ditto. RSA_size() does not check rsa->n.
+Fri Nov 1 01:08:33 2013 Koichi Sasada <ko1@atdot.net>
-Tue Aug 16 03:10:42 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/gc/gcbench.rb: print HWM (high water mark) if possible.
- * transcode.c (enc_arg, str_transcode_enc_args, econv_args):
- remove volatile, and add GC guards in callers.
- [ruby-core:75664] [Bug #12411]
+Thu Oct 31 21:48:31 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Aug 16 02:45:52 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/rexml/parsers/streamparser.rb: Add dependency file require.
+ [Bug #9062] [ruby-dev:47779]
+ Reported by Ippei Obayashi. Thanks!!!
- * ext/psych/*, test/psych/*: Update psych 2.1.0
- This version fixed [Bug #11988][ruby-core:72850]
+Thu Oct 31 14:09:32 2013 Koichi Sasada <ko1@atdot.net>
-Fri Aug 12 04:15:10 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_method.c (rb_method_entry_make): fix to pass an ISeq value.
+ OBJ_WRITTEN() accepts only VALUE.
- * common.mk (build-ext), ext/extmk.rb: use variable EXTENCS
- different than ENCOBJS, to get rid of circular dependency.
- build libencs when linking encodings statically.
- [ruby-core:75618] [Bug #12401]
+Wed Oct 30 19:07:57 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Aug 12 04:04:23 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-additional.el (ruby-brace-to-do-end)
+ (ruby-do-end-to-brace, ruby-toggle-block): Remove functions that
+ are already in the latest released version of Emacs (24.3).
+ [Bug #7565]
- * process.c (rb_execarg_commandline): build command line string
- from argument vector in rb_execarg.
- [ruby-core:75611] [Bug #12398]
+Wed Oct 30 12:44:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Aug 12 03:30:59 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/Makefile.sub (config.status): add missing variables,
+ PLATFORM_DIR and THREAD_MODEL.
- * variable.c (rb_local_constants_i): exclude private constants
- when excluding inherited constants too. [Bug #12345]
+Wed Oct 30 12:20:32 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 12 03:00:05 2016 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+ * time.c (v2w): Normalize a rational value to an integer if possible.
+ [ruby-core:58070] [Bug #9059] reported by Isaac Schwabacher.
- * lib/drb/timeridconv.rb: don't use keeper thread. [Bug #12342]
+Wed Oct 30 12:08:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/drb/ut_timerholder.rb: ditto.
+ * array.c (rb_ary_uniq_bang): use rb_ary_modify_check() instead of
+ rb_ary_modify() because the array will be unshared soon.
-Fri Aug 12 02:46:37 2016 Kazuki Yamaguchi <k@rhe.jp>
+Wed Oct 30 03:25:10 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/openssl/ossl_ssl.c (ossl_ssl_stop): Don't free the SSL struct
- here. Since some methods such as SSLSocket#connect releases GVL,
- there is a chance of use after free if we free the SSL from another
- thread. SSLSocket#stop was documented as "prepares it for another
- connection" so this is a slightly incompatible change. However when
- this sentence was added (r30090, Add toplevel documentation for
- OpenSSL, 2010-12-06), it didn't actually. The current behavior is
- from r40304 (Correct shutdown behavior w.r.t GC., 2013-04-15).
- [ruby-core:74978] [Bug #12292]
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: make less garbage when
+ testing if a string is binary.
- * ext/openssl/lib/openssl/ssl.rb (sysclose): Update doc.
+Wed Oct 30 03:08:24 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * test/openssl/test_ssl.rb: Test this.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: string subclasses should
+ not be considered to be binary. Fixes Psych / GH 166
+ https://github.com/tenderlove/psych/issues/166
-Thu Aug 11 01:30:29 2016 Marcus Stollsteimer <sto.mar@web.de>
+ * test/psych/test_string.rb: test for fix
- * ext/json/lib/*.rb: Removed some comments. Because these are unnecessary
- class description. [ci skip][Bug #12255][ruby-core:74835]
+Tue Oct 29 23:01:18 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Aug 11 01:09:43 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c (rb_ary_zip): some refactoring.
- * pack.c (pack_pack): use union instead of bare variable to ease
- optimizations and avoid assigning x87 floating point number.
- [ruby-core:74496] [Bug #12209]
+Tue Oct 29 22:11:37 2013 Masaki Matsushita <glass.saga@gmail.com>
- * pack.c (pack_unpack): ditto.
+ * array.c (rb_ary_uniq_bang): use st_foreach() instead of for loop.
-Tue Aug 2 01:34:12 2016 Eric Wong <e@80x24.org>
+Tue Oct 29 20:01:58 2013 Koichi Sasada <ko1@atdot.net>
- * lib/webrick/httpservlet/cgihandler.rb (do_GET): delete HTTP_PROXY
- * test/webrick/test_cgi.rb (test_cgi_env): new test
- * test/webrick/webrick.cgi (do_GET): new endpoint to dump env
- [ruby-core:76511] [Bug #12610]
+ * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
+ safe functions during garbage collection such as xfree().
-Tue Aug 2 01:33:11 2016 Shugo Maeda <shugo@ruby-lang.org>
+ On default, T_DATA objects are freed at same points as finalizers.
+ This approach protects issues such as reported by [ruby-dev:35578].
+ However, freeing T_DATA objects immediately helps heap usage.
- * test/ruby/test_refinement.rb: skip
- test_prepend_after_refine_wb_miss on ARM or MIPS.
- [ruby-core:76031] [Bug #12491]
+ Most of T_DATA (in other words, most of dfree functions) are safe.
+ However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
+ for safety.
-Sat Jul 30 12:23:29 2016 Shugo Maeda <shugo@ruby-lang.org>
+ * cont.c: ditto.
- * vm_args.c (vm_caller_setup_arg_block): disable symbol block
- argument optimization when tail call optimization is enabled,
- in order to avoid SEGV. [ruby-core:76288] [Bug #12565]
+ * dir.c: ditto.
-Sat Jul 30 12:10:51 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * encoding.c: ditto.
- * proc.c (passed_block): convert passed block symbol to proc.
- based on the patch by Daisuke Sato in [ruby-dev:49695].
- [Bug #12531]
+ * enumerator.c: ditto.
-Sat Jul 30 10:58:49 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * error.c: ditto.
- * vm_insnhelper.c (vm_throw_start): check if the iseq is symbol
- proc, class definition should not be a symbol proc.
- [ruby-core:75856] [Bug #12462]
+ * file.c: ditto.
-Mon Jul 11 22:35:00 2016 Kenta Murata <mrkn@mrkn.jp>
+ * gc.c: ditto.
- * bignum.c (rb_big_hash): make it public function to be available in
- other source files, and remove documentation comment for Bignum#hash.
+ * io.c: ditto.
- * bignum.c (Bignum#hash): remove its definition because it is unified
- with Object#hash.
+ * iseq.c: ditto.
- * include/ruby/intern.h (rb_big_hash): add a prototype declaration.
+ * marshal.c: ditto.
- * hash.c (any_hash): treat Bignum values directly.
+ * parse.y: ditto.
-Sat Jul 2 04:00:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c: ditto.
- * string.c (tr_trans): consider terminator length and fix heap
- overflow. reported by Guido Vranken <guido AT guidovranken.nl>.
+ * process.c: ditto.
-Sat Jul 2 03:33:28 2016 Shugo Maeda <shugo@ruby-lang.org>
+ * random.c: ditto.
- * vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104
- partially to avoid "self has wrong type to call super in this
- context" errors.
- [ruby-core:72724] [Bug #11954]
+ * thread.c: ditto.
-Mon Jun 20 02:38:29 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * time.c: ditto.
- * lib/optparse.rb (OptionParser::Completion.candidate): get rid of
- nil as key names. [ruby-core:75773] [Bug #12438]
+ * transcode.c: ditto.
- * lib/optparse.rb (OptionParser#make_switch): char class option
- cannot be NoArgument, default to RequiredArgument.
+ * variable.c: ditto.
-Mon Jun 20 02:25:44 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm.c: ditto.
- * re.c (unescape_nonascii): scan hex up to only 3 characters.
- [Bug #12420] [Bug #12423]
+ * vm_backtrace.c: ditto.
-Mon Jun 20 02:25:44 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_trace.c: ditto.
- * regparse.c (fetch_token_in_cc): raise error if given octal escaped
- character is too big. [Bug #12420] [Bug #12423]
+ * ext/bigdecimal/bigdecimal.c: ditto.
-Sun Jun 19 04:29:13 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/objspace/objspace.c: ditto.
- * include/ruby/missing.h (isfinite): move from numeric.c.
+ * ext/stringio/stringio.c: ditto.
-Sun Jun 19 04:29:13 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/strscan/strscan.c: ditto.
- * ext/bigdecimal/bigdecimal.c (isfinite): get rid of a warning on
- cygwin. [Bug #12417][ruby-core:75691]
+Tue Oct 29 19:48:33 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jun 19 04:29:13 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+ * include/ruby/ruby.h: fix typo (FL_WB_PROTECT -> FL_WB_PROTECTED).
- * ext/bigdecimal/bigdecimal.c (isfinite): isfinite does not always
- exist. fixed build error on Windows introduced at r55123.
+Tue Oct 29 18:45:08 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jun 19 04:29:13 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_trace.c (tp_free): removed because empty free function.
+ Use RUBY_TYPED_NEVER_FREE instead.
- * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
- non-finite float values not to raise FloatDomainError.
- [ruby-core:75682] [Bug #12414]
+Tue Oct 29 18:37:33 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 16 00:42:56 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h: introduce new flags for T_TYPEDDATA.
+ * RUBY_TYPED_FREE_IMMEDIATELY: free the data given by DATA_PTR()
+ with dfree function immediately. Otherwise (default), the data
+ freed at finalization point.
+ * RUBY_TYPED_WB_PROTECTED: make this object with FL_WB_PROTECT
+ (not shady).
- * string.c (rb_str_modify_expand): check integer overflow.
- [ruby-core:75592] [Bug #12390]
+ * gc.c (obj_free): support RUBY_TYPED_FREE_IMMEDIATELY.
-Thu Jun 16 00:29:29 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 29 16:49:03 2013 Koichi Sasada <ko1@atdot.net>
- * vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
- in the class context. [ruby-core:75505] [Bug #12382]
+ * gc.c (vm_malloc_increase): decrease it more carefully.
-Tue Jun 14 03:49:28 2016 Eric Wong <e@80x24.org>
+Tue Oct 29 16:24:52 2013 Koichi Sasada <ko1@atdot.net>
- * dir.c (dir_close): update RDoc for 2.3 #close change
- [ruby-core:75679] [Bug #12413]
+ * gc.c (heap_page_resurrect): return a page in tomb heap even if
+ freelist is NULL.
-Tue Jun 14 03:47:29 2016 Eric Wong <e@80x24.org>
+Tue Oct 29 15:46:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c: fix RDoc of Proc#===/call/yield/[]
- [Bug #12332]
+ * ruby_atomic.h (ATOMIC_SIZE_CAS): new macro, compare and swap size_t.
-Tue Jun 14 03:34:27 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 29 12:08:05 2013 Tanaka Akira <akr@fsij.org>
- * variable.c (rb_local_constants_i): exclude hidden constants.
- [ruby-core:75575] [Bug #12389]
+ * ext/readline/readline.c (readline_getc): Consider
+ NULL as input.
-Tue Jun 14 03:25:14 2016 Benoit Daloze <eregontp@gmail.com>
+Tue Oct 29 11:10:08 2013 Aman Gupta <ruby@tmm1.net>
- * insns.def (defineclass): Also raise an error when redeclaring the
- superclass of a class as Object and it has another superclass.
- [Bug #12367] [ruby-core:75446]
+ * gc.c (gc_profile_total_time): fix off-by-one error in
+ GC::Profiler.total_time.
+ * test/ruby/test_gc.rb (class TestGc): test for above.
- * test/ruby/test_class.rb: test for above.
+Tue Oct 29 09:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Jun 14 03:15:54 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
+ ruby_vm_global_state_version into two separate counters - one for the
+ global method state and one for the global constant state. This means
+ changes to constants do not affect method caches, and changes to
+ methods do not affect constant caches. In particular, this means
+ inclusions of modules containing constants no longer globally
+ invalidate the method cache.
- * process.c (rb_exec_getargs): honor the expected argument types
- over the conversion method. the basic language functionality
- should be robust. [ruby-core:75388] [Bug #12355]
+ * class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c:
+ rename rb_clear_cache_by_class to rb_clear_method_cache_by_class
-Tue Jun 14 03:02:38 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+ * class.c, include/ruby/intern.h, variable.c, vm_method.c: add
+ rb_clear_constant_cache
- * win32/win32.c, include/ruby/win32.h (rb_w32_utruncate): implements new
- truncate alternative which accepts UTF-8 path.
+ * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in
+ rb_call_info_struct to method_state
- * file.c (truncate): use above function.
- [Bug #12340]
+ * vm_method.c: rename vmstat field in struct cache_entry to method_state
-Tue Jun 14 02:58:41 2016 Marcus Stollsteimer <sto.mar@web.de>
+Mon Oct 28 23:26:04 2013 Tanaka Akira <akr@fsij.org>
- * ext/date/date_core.c (Init_date_core): [DOC] Convert DateTime
- documentation to RDoc from Markdown.
- [ruby-core:75136] [Bug #12311]
+ * test/readline/test_readline.rb (teardown): Clear Readline.input and
+ Readline.output.
-Sun Jun 12 02:36:52 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Oct 28 21:35:31 2013 Tanaka Akira <akr@fsij.org>
- * regcomp.c (compile_length_tree): return error code immediately
- if compile_length_tree raised error [Bug #12418]
+ * ext/-test-/file/depend, ext/-test-/postponed_job/depend,
+ ext/-test-/tracepoint/depend: New files for dependencies.
-Sun Jun 12 02:27:07 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Oct 28 15:32:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (recursive_list_access): a object id may be a Bignum. so,
- the list must be a objhash, instead of a identhash.
- this fixes many test errors on mswin64 CI.
+ * ext/openssl/depend (ossl.o): work around of dependency of
+ thread_native.h, which depends on headers by THREAD_MODEL.
+ [ruby-dev:47777]
-Sun Jun 12 01:59:33 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/openssl/extconf.rb: need THREAD_MODEL.
- * parse.y (new_if_gen): set newline flag to NODE_IF to trace all
- if/elsif statements. [ruby-core:67720] [Bug #10763]
+Mon Oct 28 14:57:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 15 02:33:52 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * load.c (ruby_init_ext): share feature names between frame name and
+ provided features.
- * lib/mkmf.rb (pkg_config): use xsystem consistently to set up
- library path environment variable as well as latter pkg-config
- calls. [ruby-dev:49619] [Bug #12379]
+Mon Oct 28 14:41:27 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri May 6 02:30:32 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-electric.el: Import ruby-electric.el 2.1 from
+ https://github.com/knu/ruby-electric.el.
- * lib/optparse.rb: [DOC] fix example code. base on the code by
- Semyon Gaivoronskiy in [ruby-core:75224]. [Bug #12323]
+ * Hitting the newline-and-indent key within a comment fires
+ comment-indent-new-line.
-Fri May 6 02:28:31 2016 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * Introduce a new feature
+ `ruby-electric-autoindent-on-closing-char`.
- * ext/win32ole/win32ole.c (ole_vstr2wc, ole_variant2val): fix blank
- string conversion.
- [Bug #11880]
- Thanks Akio Tajima for the patch!
+ * Fix fallback behavior of ruby-electric-space/return that
+ caused error with auto-complete.
-Fri May 6 02:24:13 2016 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Mon Oct 28 13:17:17 2013 Or Cohen <orc@fewbytes.com>
- * bignum.c: [DOC] Update result of 123456789 ** -2.
- [ruby-dev:49606] [Bug #12339]
+ * error.c (name_err_to_s): remove no longer needed overriding, since
+ r30455 which made exc_to_s almost same. Fixes [GH-413].
-Wed May 4 02:38:08 2016 Yuichiro Kaneko <yui-knk@ruby-lang.org>
+Mon Oct 28 12:42:11 2013 Tanaka Akira <akr@fsij.org>
- * internal.h (RCOMPLEX_SET_IMAG): undef RCOMPLEX_SET_IMAG
- instead of duplicated undef RCOMPLEX_SET_REAL.
+ * common.mk, ext/objspace/depend, ext/coverage/depend,
+ ext/-test-/debug/depend, ext/date/depend: Update dependencies.
-Wed May 4 02:38:08 2016 Yuichiro Kaneko <yui-knk@ruby-lang.org>
+Mon Oct 28 09:29:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * complex.c (rb_complex_set_imag): Fix to properly set imag
- of complex.
+ * vm.c: vm_clear_all_cache is not necessary now we use a 64 bit counter
+ for global state version.
-Tue Apr 26 23:34:45 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * vm_insnhelper.h: ruby_vm_global_state_version overflow is unnecessary
- * version.h: Bump versionto 2.3.2.
+Mon Oct 28 07:47:32 2013 Aman Gupta <ruby@tmm1.net>
-Tue Apr 26 02:58:51 2016 Marcus Stollsteimer <sto.mar@web.de>
+ * vm_backtrace.c (rb_profile_frame_classpath): do not use rb_inspect
+ directly, since it might have a custom implementation or show ivars.
- * doc/extension.rdoc: Improvements to english grammers.
- [Bug #12246][ruby-core:74792][ci skip]
+Mon Oct 28 04:10:41 2013 Aman Gupta <ruby@tmm1.net>
-Tue Apr 26 02:58:51 2016 craft4coder <yooobuntu@163.com>
+ * vm_backtrace.c (rb_profile_frame_classpath): handle singleton
+ methods defined directly on an object.
+ * test/-ext-/debug/test_profile_frames.rb: test for above.
- * doc/extension.rdoc: [DOC] `nul` should be uppercase.
- change 'nul' => 'NUL'. [Fix GH-1172]
+Mon Oct 28 00:52:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 26 02:54:57 2016 Marcus Stollsteimer <sto.mar@web.de>
+ * struct.c (new_struct): fix warning message, class name and encoding.
- * encoding.c: Fix return value of `Encoding::ISO8859_1.name`
- [Bug #12313][ruby-core:75147][ci skip]
- * ext/bigdecimal/bigdecimal.c: Fix code sample of `BigDecimal.new`
+Sun Oct 27 20:53:08 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 25 02:29:07 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ * ext/readline/readline.c: Include ruby/thread.h for
+ rb_thread_call_without_gvl2.
+ (readline_rl_instream, readline_rl_outstream): Record FILE
+ structures allocated by this extension.
+ (getc_body): New function extracted from readline_getc.
+ (getc_func): New function.
+ (readline_getc): Use rb_thread_call_without_gvl2 to invoke getc_func.
+ [ruby-dev:47033] [Bug #8749]
+ (clear_rl_instream, clear_rl_outstream): Close FILE structure
+ allocated by this extension reliably. [ruby-core:57951] [Bug #9040]
+ (readline_readline): Use clear_rl_instream and clear_rl_outstream.
+ (readline_s_set_input): Set readline_rl_instream.
+ (readline_s_set_output): Set readline_rl_outstream.
+ (Init_readline): Don't call readline_s_set_input because
+ readline_getc doesn't block other threads for any FILE structure now.
- * configure.in: add missing -lm for AIX.
+ [ruby-dev:47033] [Bug #8749] reported by Nobuhiro IMAI.
+ [ruby-core:57951] [Bug #9040] reported by Eamonn Webster.
-Mon Apr 25 02:29:07 2016 Rei Odaira <Rei.Odaira@gmail.com>
+Sat Oct 26 19:31:28 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * configure.in: don't use the system-provided round(3) on AIX.
- In AIX, round(0.49999999999999994) returns 1.0.
- Use round() in numeric.c instead.
+ * gc.c: catch up recent changes to compile on GC_DEBUG,
+ RGENGC_CHECK_MODE.
-Sun Apr 24 03:05:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 26 19:08:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c: cygwin does not use w32_cmdvector, command line can be
- other than UTF-8. [ruby-dev:49519] [Bug #12184]
+ * range.c (range_initialize_copy): disallow to modify after
+ initialized.
-Sat Apr 23 01:01:13 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 26 17:48:54 2013 Tanaka Akira <akr@fsij.org>
- * eval_jump.c (exec_end_procs_chain): restore previous error info
- for each end procs. [ruby-core:75038] [Bug #12302]
+ * lib/open-uri.rb (meta_add_field): : Re-implemented.
+ [ruby-core:58017] [Bug #9051] patch by Eamonn Webster.
-Sat Apr 23 00:51:51 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 26 14:35:09 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c (new_label_body): initialize bit fields, since
- compile_data_alloc does not clear the memory. [Bug #12082]
+ * gc.c (gc_profile_dump_on): use "Page" terminology.
-Sat Apr 23 00:51:51 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 26 13:25:45 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c (iseq_optimize): disable tail call optimization in
- rescued, rescue, and ensure blocks.
- [ruby-core:73871] [Bug #12082]
+ * gc.c (gc_sweep, gc_heap_lazy_sweep): fix measurement code.
+ We only need one sweep time measurement without lazy sweep.
-Sat Apr 23 00:33:04 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Oct 26 11:59:13 2013 Tanaka Akira <akr@fsij.org>
- * ext/nkf/nkf-utf8/nkf.c (mime_putc): fix typo.
- [Bug #12202] [ruby-core:74802]
+ * addr2line.c: Include ELF header after system headers (especially
+ sys/types.h) to avoid compilation failure,
+ "usr/include/sh3/elf_machdep.h:4:2: error: #error Define _BYTE_ORDER!",
+ on NetBSD/sh3 (dreamcast, hpcsh, landisk, mmeye).
-Sat Apr 23 00:33:04 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Oct 26 11:35:22 2013 Koichi Sasada <ko1@atdot.net>
- * ext/nkf/nkf-utf8/nkf.c: Merge upstream 4f3edf80a0.
- patched by Anton Sivakov [Bug #12201] [Bug #12202]
+ * gc.c: tuning parameters.
-Sat Apr 23 00:29:15 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (GC_MALLOC_LIMIT): change default value to 16MB.
- * lib/securerandom.rb (gen_random): to avoid blocking on Windows.
- On Windows OpenSSL RAND_bytes (underlying implementation is
- RAND_poll in crypto/rand/rand_win.c) may be blocked at
- NetStatisticsGet.
- https://wiki.openssl.org/index.php/Random_Numbers#Windows_Issues
- Instead of this, use Random.raw_seed directly (whose implementation
- CryptGenRandom is one of the source of
- entropy of RAND_poll on Windows).
- https://wiki.openssl.org/index.php/Random_Numbers
- Note: CryptGenRandom function is PRNG and doesn't check its entropy,
- so it won't block. [Bug #12139]
- https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa379942.aspx
- https://tools.ietf.org/html/rfc4086#section-7.1.3
- https://eprint.iacr.org/2007/419.pdf
- http://www.cs.huji.ac.il/~dolev/pubs/thesis/msc-thesis-leo.pdf
+ * gc.c (GC_MALLOC_LIMIT_GROWTH_FACTOR): change default value to 2.0.
-Sat Apr 23 00:25:26 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_before_sweep): change decrease ratio of `malloc_limit'
+ from 1/4 to 1/10.
- * miniinit.c (Init_enc): add some common aliases of built-in
- encodings. [ruby-core:72481] [Bug #11872]
+Sat Oct 26 11:30:07 2013 Koichi Sasada <ko1@atdot.net>
-Sat Apr 23 00:13:50 2016 sorah (Shota Fukumori) <her@sorah.jp>
+ * gc.c (vm_malloc_increase): do gc_rest_sweep() before GC.
+ gc_rest_sweep() can reduce malloc_increase, so try it before GC.
+ Otherwise, malloc_increase can be less than malloc_limit at
+ gc_before_sweep(). This means that re-calculation of malloc_limit
+ may be wrong value.
- * lib/forwardable.rb: Convert given accessors to String.
+Sat Oct 26 06:35:41 2013 Masaya Tarui <tarui@ruby-lang.org>
- r53381 changed to accept only Symbol or String for accessors, but
- there are several rubygems that pass classes (e.g. Array,
- Hash, ...) as accessors. Prior r53381, it was accepted because Class#to_s
- returns its class name. After r53381 given accessors are checked
- with define_method, but it accepts only Symbol or String, otherwise
- raises TypeError.
+ * gc.c (gc_before_heap_sweep): Restructure code to mean clearly.
+ heap->freelist is connected to end of list.
- def_delegator Foo, :some_method
+Sat Oct 26 04:01:35 2013 Koichi Sasada <ko1@atdot.net>
- This change is to revert unexpected incompatibility. But this behavior
- may change in the future.
+ * gc.c (gc_before_heap_sweep): fix freelist management.
+ After rb_gc_force_recycle() for a object belonging to heap->freelist,
+ `heap->using_page->freelist' is not null.
-Sat Apr 23 00:02:09 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 24 21:57:24 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * configure.in: check if succeeded in creating config.h.
+ * parse.y: Remove +(binary) and -(binary) special cases
+ [Feature #9048]
- * tool/ifchange: ignore failures when TEST_COLORS unmatched. just
- use the default value if expected name is not contained in it.
- [ruby-core:75046] [Bug #12303]
+Thu Oct 24 12:45:53 2013 Zachary Scott <e@zzak.io>
-Fri Apr 22 23:47:05 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * object.c: [DOC] Document first argument also takes string for:
- * doc/regexp.rdoc (comments): [DOC] terminators cannot appear in
- comments. [ruby-core:74838] [Bug #12256]
+ rb_mod_const_get, rb_mod_const_set, rb_mod_const_defined
-Fri Apr 22 23:44:07 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Also added note about NameError exception for invalid constant name
- * extension.rdoc, extension.ja.rdoc: [DOC] Fix some errors.
- Renamed files, wrong method names or argument types; the example
- GetDBM macro is now updated to the current version of the actual
- code. patch by Marcus Stollsteimer in [ruby-core:74690].
- [Bug #12228]
+Thu Oct 24 12:23:58 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Fri Apr 22 23:32:19 2016 Tanaka Akira <akr@fsij.org>
+ * thread.c (rb_thread_terminate_all): add a comment why we need
+ state check and call terminate_i again.
- * test/ruby/test_time_tz.rb: Tests depends on Europe/Moscow removed
- to avoid test failures due to the tzdata change.
- https://github.com/eggert/tz/commit/8ee11a301cf173afb0c76e0315b9f9ec8ebb9d95
- Found by naruse.
+Thu Oct 24 12:15:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Apr 19 02:32:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (rb_thread_terminate_all): add a comment why infinite
+ sleep is safe.
- * configure.in (rb_cv_lgamma_r_m0): fix the condition for
- lgamma_r(-0.0). [Bug #12249]
+Thu Oct 24 07:41:42 2013 Aman Gupta <ruby@tmm1.net>
-Tue Apr 19 02:32:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: add new initial_growth_max tuning parameter.
+ [ruby-core:57928] [Bug #9035]
+ * gc.c (heap_set_increment): when initial_growth_max is set,
+ do not grow number of slots by more than growth_max at a time.
+ * gc.c (rb_gc_set_params): load optional new tuning value from
+ RUBY_HEAP_SLOTS_GROWTH_MAX environment variable.
+ * test/ruby/test_gc.rb (class TestGc): test for above.
- * configure.in (rb_cv_lgamma_r_m0): check if lgamma_r(-0.0)
- returns negative infinity. [Bug #12249]
+Thu Oct 24 01:34:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * math.c (ruby_lgamma_r): define by the configured result.
+ * include/ruby/win32.h (rb_infinity_float): suppress overflow in
+ constant arithmetic warnings. [ruby-core:57981] [Bug #9044]
-Tue Apr 19 02:32:50 2016 cremno phobia <cremno@mail.ru>
+Thu Oct 24 00:11:24 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows,
- since msvcrt does not provide it.
+ * lib/ostruct.rb: raise NoMethodError with a #name and #args.
+ Raise RuntimeError when modifying frozen instances
+ instead of TypeError.
+ (OpenStruct#each_pair): Return an enumerator with size
+ (OpenStruct#delete): Use the converted argument.
+ Patches by Kenichi Kamiya. [Fixes GH-383]
- * missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0).
- [ruby-core:74823] [Bug #12249]
+ * test/ostruct/test_ostruct.rb: Added tests for above.
-Tue Apr 19 02:32:50 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Oct 24 00:10:22 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong.
- cf. [Bug #12249]
+ * array.c: Add Array#to_h [Feature #7292]
-Tue Apr 19 02:32:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enum.c: Add Enumerable#to_h
- * math.c (ruby_tgamma): fix tgamma(-0.0) on mingw.
- [ruby-core:74817] [Bug #12249]
+Wed Oct 23 23:48:28 2013 Aman Gupta <ruby@tmm1.net>
-Tue Apr 19 01:53:32 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: Rename free_min to min_free_slots and free_min_page to
+ max_free_slots. The algorithm for heap growth is:
+ if (swept_slots < min_free_slots) pages++
+ if (swept_slots > max_free_slots) pages--
- * defs/keywords (alias, undef): symbol literals are allowed.
+Wed Oct 23 22:51:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (parse_percent): should parse symbol literals for alias
- and undef. [ruby-dev:47681] [Bug #8851]
+ * win32/Makefile.sub (config.h): VC 2013 supports C99 mathematics
+ functions. [ruby-core:57981] [Bug #9044]
-Mon Apr 18 18:05:29 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 23 19:13:18 2013 Koichi Sasada <ko1@atdot.net>
- * struct.c (struct_make_members_list, rb_struct_s_def): member
- names should be unique. [ruby-core:74971] [Bug #12291]
+ * gc.c: move increment from heap to heap_pages.
+ Share `increment' information with heaps.
- * struct.c (struct_make_members_list): extract making member name
- list from char* va_list, with creating symbols without
- intermediate IDs.
+ * gc.c: change ratio of heap_pages_free_min_page
+ to 0.80.
+ This change means slow down page freeing speed.
-Mon Apr 18 17:54:40 2016 Joe Swatosh <joe.swatosh@gmail.com>
+Wed Oct 23 17:52:03 2013 Koichi Sasada <ko1@atdot.net>
- * ext/win32/lib/win32/registry.rb (DeleteValue, DeleteKey): fix
- API names. [ruby-core:74863] [Bug #12264]
+ * gc.c (heap_pages_free_unused_pages): cast to (int) for size_t
+ variable `i'.
-Mon Apr 18 17:27:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 23 17:39:35 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c (iseq_peephole_optimize): should not replace the
- current target INSN, not to follow the replaced dangling link in
- the caller. [ruby-core:74993] [Bug #11816]
+ * gc.c: introduce tomb heap.
+ Tomb heap is where zombie objects and ghost (freed slot) lived in.
+ Separate from other heaps (now there is only eden heap) at sweeping
+ helps freeing pages more efficiently.
+ Before this patch, even if there is an empty page at former phase
+ of sweeping, we can't free it.
-Mon Apr 18 17:18:25 2016 cremno phobia <cremno@mail.ru>
+ Algorithm:
+ (1) Sweeping all pages in a heap and move empty pages from the
+ heap to tomb_heap.
+ (2) Check all existing pages and free a page
+ if all slots of this page are empty and
+ there is enough empty slots (checking by swept_num)
- * cont.c (fiber_initialize_machine_stack_context): fix wrong
- _MSC_VER check, should be decimal but not hexadecimal.
- [ruby-core:74936] [Bug #12279]
+ To introduce this patch, there are several tuning of GC parameters.
-Mon Apr 18 17:18:25 2016 cremno phobia <cremno@mail.ru>
+Wed Oct 23 14:20:56 2013 Koichi Sasada <ko1@atdot.net>
- * cont.c (fiber_initialize_machine_stack_context): fix wrong
- _MSC_VER check, should be decimal but not hexadecimal.
- [ruby-core:74936] [Bug #12279]
+ * gc.c (gc_prof_sweep_timer_stop): catch up recent changes
+ to compile on GC_PROFILE_MORE_DETAIL=1.
-Mon Apr 18 17:08:10 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 23 11:43:27 2013 Zachary Scott <e@zzak.io>
- * vm_core.h (rb_vm_struct): make at_exit a single linked list but
- not RArray, not to mark the registered functions by the write
- barrier. based on the patches by Evan Phoenix.
- [ruby-core:73908] [Bug #12095]
+ * file.c: [DOC] fix rdoc format of File#expand_path from r43386
-Mon Apr 18 16:56:31 2016 Benoit Daloze <eregontp@gmail.com>
+Tue Oct 22 21:58:28 2013 URABE Shyouhei <shyouhei@ruby-lang.org>
- * thread.c (update_coverage): Do not track coverage in loaded files
- after Coverage.result. Avoids out-of-bounds access. [Bug #12237]
+ * vm_core.h (enum): avoid syntax error.
- * ext/coverage/coverage.c (coverage_clear_result_i): document.
+ * method.h: ditto.
-Mon Apr 18 16:33:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: ditto.
- * ext/date/date_core.c (Init_date_core): [DOC] fix misplaced doc
- of DateTime. [ruby-core:74729] [Bug #12233]
+Tue Oct 22 19:53:16 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 18 13:48:05 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (Init_heap): move logics from heap_pages_init() and remove
+ heap_pages_init().
- * cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL_PARAM):
- * add missing parentheses and remove double quotes.
- * rename to get rid of recursive references.
- * as --excludes-dir option is for a path name, its argument
- should be converted.
- [ruby-dev:49526] [Bug #12199]
+Tue Oct 22 19:19:05 2013 Koichi Sasada <ko1@atdot.net>
-Mon Apr 18 13:48:05 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: allow multiple heaps.
+ Now, objects are managed by page. And a set of pages is called heap.
+ This commit supports multiple heaps in the object space.
- * common.mk (TEST_EXCLUDES, EXCLUDE_TESTFRAMEWORK): use full spell
- long option.
+ * Functions heap_* and rb_heap_t manages heap data structure.
+ * Functions heap_page_* and struct heap_page manage page data
+ structure.
+ * Functions heap_pages_* and struct rb_objspace_t::heap_pages
+ maintains all pages.
+ For example, pages are allocated from the heap_pages.
- * cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL): suppress path name
- conversions by msys2. [ruby-dev:49525] [Bug #12199]
+ See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design
+ and https://bugs.ruby-lang.org/attachments/4015/data-heap_structure_with_multiple_heaps.png
+ for more details.
-Mon Apr 18 13:48:05 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Now, there is only one heap called `eden', which is a space for all
+ new generated objects.
- * test/lib/test/unit.rb (Options#non_options): make regexp name
- options prefixed with "!" negative filters.
+Tue Oct 22 18:26:12 2013 Tanaka Akira <akr@fsij.org>
- * common.mk (TEST_EXCLUDES): use negative filter to exclude memory
- leak tests. -x option excludes test files, not test methods.
+ * lib/pp.rb (object_address_group): Use Kernel#to_s to obtain the class
+ name and object address.
+ This fix a problem caused by %p in C generates variable length
+ address.
+ Reported by ko1 via IRC.
-Sun Apr 17 04:30:13 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 22 16:57:48 2013 Benoit Daloze <eregontp@gmail.com>
- * parse.y (parse_ident): allow keyword arguments just after a
- method where the same name local variable is defined.
- [ruby-core:73816] [Bug#12073]
+ * file.c (File#expand_path): [DOC] improve documentation of File#expand_path.
+ Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002]
-Sun Apr 17 04:20:40 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 22 15:59:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (setup_exception): set the cause only if it is explicitly
- given or not set yet. [Bug #12068]
+ * dir.c (glob_helper): don't skip current directories if FNM_DOTMATCH
+ is given. [ruby-core:53108] [Bug #8006]
-Sat Apr 16 00:56:45 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 22 14:53:11 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c (rb_thread_setname): defer setting native thread name
- set in initialize until the native thread is created.
- [ruby-core:74963] [Bug #12290]
+ * vm_trace.c: exterminate Zombies.
+ There is a bug that T_ZOMBIE objects are not collected.
+ Because there is a pass to miss finalizer postponed job
+ with multi-threading. This patch solve this issue.
-Fri Apr 15 21:10:00 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * vm_trace.c (rb_postponed_job_register_one): set
+ RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(th) if another same job
+ is registered.
+ There is a possibility to remain a postponed job without
+ interrupt flag.
- * lib/irb/ext/save-history.rb: Fix NoMethodError when method is not defined.
+ * vm_trace.c (rb_postponed_job_register_one): check interrupt
+ carefully.
-Fri Apr 15 14:52:06 2016 Elliot Winkler <elliot.winkler@gmail.com>
+ * vm_trace.c (rb_postponed_job_register_one): use additional space
+ to avoid buffer full.
- * lib/forwardable.rb (def_instance_delegator) fix delegating to
- 'args' and 'block', clashing with local variables in generated
- methods. [ruby-core:72579] [Bug #11916]
+ * gc.c (gc_finalize_deferred_register): check failure.
- * lib/forwardable.rb (def_single_delegator): ditto.
+ * thread.c (rb_threadptr_execute_interrupts): check
+ `postponed_job_interrupt' immediately. There is a possibility
+ to miss this flag.
-Fri Apr 15 14:27:48 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Oct 22 12:11:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/irb/ext/save-history.rb: suppress warning: method redefined;
- discarding old save_history=.
+ * configure.in: check if the given CFLAGS and LDFLAGS are working, and
+ bail out early if not.
-Tue Apr 12 16:15:39 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Oct 22 00:06:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: improve ICC (Intel C Compiler) support.
+ * file.c (rb_file_exists_p): warn deprecated name. [Bug #9041]
- * configure.in (CXX): The name of icc's c++ compiler is `icpc`.
+Mon Oct 21 23:57:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (warnings): Add `-diag-disable=2259` to suppress
- noisy warnings: "non-pointer conversion from "..." to "..." may
- lose significant bits".
+ * encoding.c (load_encoding): should preserve outer errinfo, so that
+ expected exception may not be lost. [ruby-core:57949] [Bug #9038]
- * configure.in (optflags): Add `-fp-model precise` like -fno-fast-math.
+Sun Oct 20 15:41:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/mkmf.rb: icc supports -Werror=division-by-zero
- and -Werror=deprecated-declarations, but doesn't support
- -Wdivision-by-zero and -Wdeprecated-declarations.
+ * io.c (rb_io_reopen): create a new, temporary FD via rb_sysopen and
+ call rb_cloexec_dup2 on it to atomically replace the file fptr->fd
+ points to. This leaves no possible window where fptr->fd is invalid
+ to userspace (even for any threads running w/o GVL). based on the
+ patch by Eric Wong <normalperson@yhbt.net> at [ruby-core:57943].
+ [Bug #9036]
-Tue Apr 12 14:29:01 2016 Kazuki Yamaguchi <k@rhe.jp>
+Sun Oct 20 15:29:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/extconf.rb: check SSL_CTX_set_next_proto_select_cb
- function rather than OPENSSL_NPN_NEGOTIATED macro. it exists
- even if it is disabled by OpenSSL configuration.
- [ruby-core:74384] [Bug #12182]
+ * error.c (rb_syserr_fail_path_in): new function split from
+ rb_sys_fail_path_in to raise SystemCallError without errno.
- * ext/openssl/ossl_ssl.c: update #ifdef(s) as above.
+ * internal.h (rb_syserr_fail_path): like rb_sys_fail_path but without
+ errno.
- * test/openssl/test_ssl.rb: skip NPN tests if NPN is disabled.
+Sun Oct 20 13:58:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 12 14:27:04 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h (rb_obj_wb_unprotect, rb_obj_written),
+ (rb_obj_write): suppress unused-parameter warnings.
- * lib/uri/http.rb (URI::HTTP#initialize): [DOC] fix example,
- missing mandatory arguments. [ruby-core:74540] [Bug #12215]
+Sun Oct 20 10:32:48 2013 Eric Hodel <drbrain@segment7.net>
-Thu Apr 7 01:07:02 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems: Update RubyGems to master 0886307. This commit
+ improves documentation and should bring ruby above 75% documented on
+ rubyci.
- * sprintf.c (rb_str_format): fix buffer overflow, length must be
- greater than precision. reported by William Bowling <will AT
- wbowling.info>.
+Sun Oct 20 09:30:56 2013 Eric Hodel <drbrain@segment7.net>
-Wed Apr 6 00:33:45 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master 3de7e0f. Changes:
- * lib/rubygems/security.rb (DIGEST_ALGORITHM, KEY_ALGORITHM):
- should check same name as the used constants.
- [ruby-core:72674] [Bug #11940]
+ Only attempt to build extensions for newly-installed gems. This
+ prevents compilation attempts at gem activation time for gems that
+ already have extensions built.
-Mon Apr 4 00:31:51 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Fix crash in the dependency resolver for dependencies that cannot be
+ resolved.
- * compile.c (compile_massign_lhs): when index ends with splat,
- append rhs value to it like POSTARG, since VM_CALL_ARGS_SPLAT
- splats the last argument only. [ruby-core:72777] [Bug #11970]
+ * test/rubygems: ditto.
-Sat Apr 2 02:07:29 2016 Seiei Miyagi <hanachin@gmail.com>
+Sun Oct 20 05:24:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): Fix
- Ripper.lex error in dedenting squiggly heredoc. heredoc tree is
- also an array of Elem in the outer tree. [Fix GH-1234]
+ * variable.c (rb_class2name): should return real class name, not
+ singleton class or iclass.
-Wed Mar 30 02:28:13 2016 Eric Wong <e@80x24.org>
+Sun Oct 20 04:18:48 2013 Aman Gupta <ruby@tmm1.net>
- * thread_pthread.c (setup_communication_pipe): delay setting owner
- (rb_thread_create_timer_thread): until thread creation succeeds
- [ruby-core:72590] [Bug #11922]
+ * variable.c (rb_class2name): call rb_tmp_class_path() directly to
+ avoid extra rb_str_dup() from rb_class_name().
-Wed Mar 30 02:20:06 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Oct 19 19:59:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * localeinit.c (rb_locale_charmap_index): fix prototype.
- patched by Andreas Schwab [Bug #12218]
+ * win32/file.c (code_page): use simple array instead of st_table.
-Wed Mar 30 02:20:06 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * encoding.c (rb_locale_encindex): defer initialization of win32 code
+ page table until encoding db loaded.
- * thread_pthread.c (reserve_stack): fix reserving position where
- the stack growing bottom to top. [Bug #12118]
+Sat Oct 19 08:25:05 2013 Koichi Sasada <ko1@atdot.net>
-Wed Mar 30 02:17:33 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: fix rb_objspace_t.
+ * make "struct heap" and move most of variables
+ in rb_objspace_t::heap.
+ * rename rb_objspace_t::heap::sorted to
+ rb_objspace_t::heap_sorted_pages
+ and make a macro heap_sorted_pages.
+ * rename rb_objspace_t::heap::range to
+ rb_objspace_t::heap_range and rename macros
+ lomem/himem to heap_lomem/heap_himem.
- * win32/file.c (rb_readlink): drop garbage after the substitute
- name, as rb_w32_read_reparse_point returns the expected buffer
- size but "\??\" prefix is dropped from the result.
+Sat Oct 19 07:14:40 2013 Eric Hodel <drbrain@segment7.net>
- * win32/win32.c (w32_readlink): ditto, including NUL-terminator.
+ * lib/rubygems: Update to RubyGems master 42543b6. Changes:
-Wed Mar 30 02:17:33 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+ Fix `gem update` for gems with multiple platforms.
- * win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volume
- mount point should be treated as directory, not symlink.
- [ruby-core:72483] [Bug #11874]
+ * test/rubygems: ditto.
- * win32/win32.c (rb_w32_read_reparse_point): check the reparse point is
- a volume mount point or not.
+Sat Oct 19 06:55:52 2013 Eric Hodel <drbrain@segment7.net>
- * win32/file.c (rb_readlink): follow above change (but this pass won't
- be used).
+ * lib/rubygems: Update to RubyGems master 0a3814b. Changes:
-Wed Mar 30 01:32:14 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ Fixed extension directory in Gem::Specification#require_paths.
- * test/-ext-/time/test_new.rb (test_timespec_new): change a gmtoff
- test to a better one that does not depend on whether the current
- time is in summer time or not.
+ Allow installation of gems when $HOME is nonexistent or unwritable.
-Wed Mar 30 01:32:14 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ Use proper API in InstallCommand.
- * test/-ext-/time/test_new.rb (test_timespec_new): Time#gmtoff values
- are the same only when both or neither of the Time objects are in
- summer time (daylight-saving time).
+ Improve support for path option in gem dependency files.
-Wed Mar 30 01:30:54 2016 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ Remove warnings.
- * lib/rubygems/test_case.rb: Fix test on Windows for inconsistent temp path.
- https://github.com/rubygems/rubygems/pull/1554
- [Bug #12193][ruby-core:74431]
+ * test/rubygems: ditto.
-Wed Mar 30 01:25:46 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Oct 18 15:23:34 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (str_new_frozen): if the given string is embeddedable
- but not embedded, embed a new copied string. [Bug #11946]
+ * gc.c: change terminology of heap.
+ Change "slot" to "page". "Slot" is a space of RVALUE.
+ 1. "Heap" consists of a set of "heap_page"s (pages).
+ 2. Each "heap_page" has "heap_page_body".
+ 3. "heap_page_body" has RVALUE (a.k.a. "slot") spaces.
+ 4. "sorted" is a sorted array of "heap_page"s, sorted
+ by address of heap_page_body (for "is_pointer_to_heap").
-Wed Mar 30 01:23:57 2016 Marcus Stollsteimer <sto.mar@web.de>
+ See https://bugs.ruby-lang.org/attachments/4008/data-heap_structure.png.
- * doc/extension.ja.rdoc: Fix RDoc markup in doc/extension*.rdoc.
- [ci skip][Bug #12143][ruby-core:74143]
- * doc/extension.rdoc: ditto.
+Fri Oct 18 09:40:43 2013 Eric Hodel <drbrain@segment7.net>
-Wed Mar 30 01:00:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master cee6788. Changes:
- * proc.c (proc_binding): proc from symbol can not make a binding.
- [ruby-core:74100] [Bug #12137]
+ Fix test failure on vc10-x64 Server on rubyci.org due to attempting
+ to File.chmod where it is not supported.
-Wed Mar 30 00:54:38 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Continuing work on improved gem dependencies file (Gemfile) support.
- * include/ruby/win32.h (O_SHARE_DELETE): change to fit Fixnum
- limit. [ruby-core:74285] [Bug #12171]
+ * test: ditto.
-Wed Mar 30 00:52:47 2016 Rei Odaira <Rei.Odaira@gmail.com>
+Fri Oct 18 06:02:49 2013 Eric Hodel <drbrain@segment7.net>
- * test/net/imap/test_imap.rb (test_idle_timeout): Because of the
- timeout specified in "imap.idle(0.2)", there is no gurantee that
- the server thread has done all the work before the client thread
- performs the assertions. It depends on the thread scheduling.
- Add checks to avoid false positives (on AIX, particularly).
+ * lib/rubygems: Update to RubyGems master f738c67. Changes:
-Wed Mar 30 00:41:42 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ Fixed test bug for ruby with ENABLE_SHARED = no
- * test/socket/test_socket.rb (test_udp_recvmsg_truncation):
- AIX does not set the MSG_TRUNC flag for a message partially read
- by recvmsg(2) with the MSG_PEEK flag set.
+ * test/rubygems: ditto.
-Wed Mar 30 00:00:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Oct 18 00:57:07 2013 Tanaka Akira <akr@fsij.org>
- * doc/extension.rdoc, doc/extension.ja.rdoc: add editor local
- variables, with commenting out by :enddoc: directives which are
- just ignored unless code object mode. [Bug #12111]
+ * lib/tsort.rb (TSort.tsort): Extracted from TSort#tsort.
+ (TSort.tsort_each): Extracted from TSort#tsort_each.
+ (TSort.strongly_connected_components): Extracted from
+ TSort#strongly_connected_components.
+ (TSort.each_strongly_connected_component): Extracted from
+ TSort#each_strongly_connected_component.
-Wed Mar 30 00:00:47 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Oct 17 18:50:08 2013 Koichi Sasada <ko1@atdot.net>
- * doc/extension.ja.rdoc: removed rendering error caused by editor specific
- configuration on http://docs.ruby-lang.org/en/trunk/extension_rdoc.html .
- [Bug #12111][ruby-core:73990]
+ * gc.c (CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE): introduced.
+ This macro enable checker compare with allocated memory and
+ declared old_size of sized_xfree and sized_xrealloc.
-Tue Mar 29 23:54:31 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 17 18:45:41 2013 Koichi Sasada <ko1@atdot.net>
- * object.c (rb_mod_const_get): make error message at uninterned
- string consistent with symbols. [ruby-dev:49498] [Bug #12089]
+ * string.c (STR_HEAP_SIZE): includes TERM_LEN(str).
-Tue Mar 29 23:45:24 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_memsize): use STR_HEAP_SIZE().
- * dir.c (push_pattern, push_glob): deal with read paths as UTF-8
- to stat later, on Windows as well as OS X.
- [ruby-core:73868] [Bug #12081]
+Thu Oct 17 17:43:00 2013 Shugo Maeda <shugo@ruby-lang.org>
-Tue Mar 29 23:36:49 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (vm_call_method): set ci->me to 0 when the
+ original method of a refined method is undef to avoid SEGV.
- * ext/extmk.rb: add cygwin case, nothing excluded.
- [ruby-core:73806] [Bug#12071]
+ * vm_method.c (rb_method_entry_without_refinements): return 0 when
+ the original method of a refined method is undef to avoid SEGV.
-Tue Mar 29 23:10:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_refinement.rb: related test.
- * iseq.c (rb_iseq_mark): mark parent iseq to prevent dynamically
- generated iseq by eval from GC. [ruby-core:72620] [Bug #11928]
+Thu Oct 17 17:38:36 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 22:56:44 2016 Eric Wong <e@80x24.org>
+ * gc.c, internal.h: rename ruby_xsizefree/realloc to
+ rb_sized_free/realloc.
- * lib/resolv.rb (Resolv::IPv6.create): avoid modifying frozen
- * test/resolv/test_dns.rb (test_ipv6_create): test for above
- [Bug #11910] [ruby-core:72559]
+ * array.c: catch up these changes.
-Tue Mar 29 22:31:48 2016 Shugo Maeda <shugo@ruby-lang.org>
+ * string.c: ditto.
- * range.c (range_eqq): revert r11113 because rb_call_super() is
- called in range_include() and thus r11113 doesn't work when the
- receiver Range object consists of non linear objects such as Date
- objects.
- [ruby-core:72908] [Bug #12003]
+Thu Oct 17 17:32:51 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 22:26:55 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c, string.c: use ruby_xsizedfree() and ruby_xsizedrealloc().
- * vm_eval.c (rb_check_funcall_with_hook): also should call the
- given hook before returning Qundef when overridden respond_to?
- method returned false. [ruby-core:73556] [Bug #12030]
+ * internal.h (SIZED_REALLOC_N): define a macro as REALLOC_N().
-Tue Mar 29 22:08:36 2016 Kazuki Yamaguchi <k@rhe.jp>
+Thu Oct 17 17:11:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_peephole_optimize): don't apply tailcall
- optimization to send/invokesuper instructions with blockiseq.
- This is a follow-up to the changes in r51903; blockiseq is now
- the third operand of send/invokesuper instructions.
- [ruby-core:73413] [Bug #12018]
+ * win32/win32.c (console_emulator_p): check by comparison between
+ module handle of WriteConsoleW and kernel32.dll.
-Tue Mar 29 21:22:22 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in, win32/Makefile.sub, win32/setup.mak: no longer need
+ psapi.lib.
- * parse.y (xstring): reset heredoc indent after dedenting,
- so that following string literal would not be dedented.
- [ruby-core:72857] [Bug #11990]
+Thu Oct 17 16:53:30 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 21:22:22 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c, internal.h: add new internal memory management functions.
+ * void *ruby_xsizedrealloc(void *ptr, size_t new_size, size_t old_size)
+ * void ruby_xsizedfree(void *x, size_t size)
+ These functions accept additional size parameter to calculate more
+ accurate malloc_increase parameter which control GC timing.
+ [Feature #8985]
- * parse.y (string1): reset heredoc indent fore each string leteral
- so that concatenated string would not be dedented.
- [ruby-core:72857] [Bug #11990]
+Thu Oct 17 14:21:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 29 21:18:09 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/file.c (rb_file_expand_path_internal): fix memory leaks at
+ a non-absolute home exception.
- * parse.y (parser_here_document): update indent for each line in
- indented here document with single-quotes.
- [ruby-core:72479] [Bug #11871]
+Thu Oct 17 14:06:39 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 21:03:40 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/objspace/object_tracing.c (newobj_i): fix memory leak.
+ There is possibility to remain info due to missing FREEOBJ event.
+ FREEOBJ events are skipped while suppress_tracing state, for example,
+ during trace events are invoking.
- * symbol.h (is_attrset_id): ASET is an attrset ID. fix
- unexpected safe call instead of an ordinary ASET.
+Thu Oct 17 12:30:16 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 29 21:01:07 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/tsort.rb (TSort.each_strongly_connected_component_from):
+ Extracted from TSort#each_strongly_connected_component_from.
- * doc/syntax/calling_methods.rdoc: fix old operator for safe navigation
- operator. [ci skip][fix GH-1182] Patch by @dougo
+Thu Oct 17 11:07:06 2013 Eric Hodel <drbrain@segment7.net>
-Tue Mar 29 18:49:54 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems: Update to RubyGems master 941c21a. Changes:
- * lib/ostruct.rb (freeze): define deferred accessors before
- freezing to get rid of an error when just reading frozen
- OpenStruct.
+ Restored method bundler wants to remove for compatibility.
-Tue Mar 29 18:49:54 2016 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ Improvements to Gemfile compatibility.
- * lib/ostruct.rb: Fix new_ostruct_member to correctly avoid
- redefinition [#11901]
+ * test/rubygems: ditto.
-Tue Mar 29 17:54:17 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 17 08:08:11 2013 Koichi Sasada <ko1@atdot.net>
- * lib/ostruct.rb (OpenStruct): make respond_to? working on
- just-allocated objects for workaround of Psych.
- [ruby-core:72501] [Bug #11884]
+ * ext/objspace/object_tracing.c (newobj_i): add workaround.
+ some bugs hits this check.
-Tue Mar 29 17:04:35 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/objspace/object_tracing.c (object_allocations_reporter_i): cast as pointer.
- * vm_eval.c (rb_f_catch): [DOC] fix malformed RDoc syntax, "+...+"
- cannot enclose non-identifier characters.
- a patch by Sebastian S in [ruby-core:74278]. [Bug#12170]
+Thu Oct 17 07:36:53 2013 Eric Hodel <drbrain@segment7.net>
-Tue Mar 29 17:03:28 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ * lib/rubygems: Update to RubyGems master 2abce58. Changes:
- * test/-ext-/float/test_nextafter.rb: In AIX,
- nextafter(+0.0,-0.0)=+0.0, and nextafter(-0.0,+0.0)=-0.0,
- but they should return -0.0 and +0.0, respectively. This is
- a known bug in nextafter(3) on AIX, so skip related tests.
+ Fixed documentation generation when sdoc and json are installed as
+ gems.
-Tue Mar 29 16:54:14 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Added some missing documentation.
- * string.c (enc_succ_alnum_char): try to skip an invalid character
- gap between GREEK CAPITAL RHO and SIGMA.
- [ruby-core:74478] [Bug #12204]
+Thu Oct 17 07:10:26 2013 Zachary Scott <e@zzak.io>
-Tue Mar 29 16:45:58 2016 Victor Nawothnig <Victor.Nawothnig@gmail.com>
+ * ext/curses/curses.c: [DOC] Cleaned up formatting consistency of rdoc
+ comments for Curses, including period spacing and column width.
- * parse.y (parse_numvar): NTH_REF must be less than a half of
- INT_MAX, as it is left-shifted to be ORed with back-ref flag.
- [ruby-core:74444] [Bug#12192] [Fix GH-1296]
+ This patch also fixed some typos. Thanks to @postmodern for the patch!
+ [Fixes GH-420] https://github.com/ruby/ruby/pull/420
-Tue Mar 29 16:44:54 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Oct 17 06:58:42 2013 Zachary Scott <e@zzak.io>
- * enc/trans/JIS: update Unicode's notice. [Bug #11844]
+ * ext/date/date_core.c: [DOC] plural grammar fixed by @scott113341
+ Contributed via documenting-ruby.org: documenting-ruby/ruby#16
+ https://github.com/documenting-ruby/ruby/pull/16
-Tue Mar 29 16:41:27 2016 Eric Hodel <drbrain@segment7.net>
+Thu Oct 17 05:52:31 2013 Zachary Scott <e@zzak.io>
- * marshal.c (r_object0): raise ArgumentError when linking to undefined
- object.
+ * ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah
+ [Fixes GH-418] https://github.com/ruby/ruby/pull/418 based on the
+ original discussion from documenting-ruby/ruby#18
-Tue Mar 29 16:41:27 2016 Eric Hodel <drbrain@segment7.net>
+Thu Oct 17 05:40:33 2013 Koichi Sasada <ko1@atdot.net>
- * marshal.c (r_object0): Fix Marshal crash for corrupt extended object.
+ * gc.c (objspace_each_objects): do not skip empty RVALUEs.
-Tue Mar 29 16:40:48 2016 Eric Wong <e@80x24.org>
+Thu Oct 17 05:31:31 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): document as MT-unsafe
- [ruby-core:73803] [Bug #12069]
+ * error.c (rb_bug_reporter_add): return simply 0 if failed.
+ Please check return value.
-Tue Mar 29 16:29:44 2016 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Oct 17 05:17:33 2013 Koichi Sasada <ko1@atdot.net>
- * insns.def (opt_mod): show its method name on ZeroDivisionError.
- [Bug #12158]
+ * ext/objspace/object_tracing.c: add new method
+ ObjectSpace.trace_object_allocations_debug_start for GC debugging.
+ If you encounter the BUG "... is T_NONE" (and so on) on your
+ application, please try this method at the beginning of your app.
-Tue Mar 29 16:25:27 2016 Anthony Dmitriyev <antstorm@gmail.com>
+Wed Oct 16 22:35:27 2013 Zachary Scott <e@zzak.io>
- * net/ftp.rb: add NullSocket#closed? to fix closing not opened
- connection. [Fix GH-1232]
+ * ext/io/nonblock/nonblock.c: use rb_cIO instead of VALUE
-Tue Mar 29 16:12:08 2016 Koichi ITO <koic.ito@gmail.com>
+Wed Oct 16 17:45:13 2013 Koichi Sasada <ko1@atdot.net>
- * variable.c: Added documentation about order of `Module#constants`
- [ci skip][Bug #12121][ruby-dev:49505][fix GH-1301]
+ * bootstraptest/runner.rb: check nil before calling `signal?'
+ for a process status.
-Tue Mar 29 16:02:26 2016 Rei Odaira <Rei.Odaira@gmail.com>
+Wed Oct 16 17:37:17 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_process.rb (test_execopts_gid): Skip a test
- that is known to fail on AIX. AIX allows setgid to
- a supplementary group, but Ruby does not allow the "-e"
- option when setgid'ed, so the test does not work as intended.
+ * error.c, internal.h (rb_bug_reporter_add): add a new C-API.
+ rb_bug_reporter_add() allows to register a function which
+ is called at rb_bug() called.
-Tue Mar 29 15:58:18 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ * ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
- * test/socket/test_addrinfo.rb (test_ipv6_address_predicates):
- IN6_IS_ADDR_V4COMPAT and IN6_IS_ADDR_V4MAPPED are broken
- on AIX, so skip related tests.
+ * ext/-test-/bug_reporter/extconf.rb: ditto.
-Tue Mar 29 15:31:06 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ * test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.
- * test/rinda/test_rinda.rb (test_make_socket_ipv4_multicast):
- The fifth argument to getsockopt(2) should be modified to
- indicate the actual size of the value on return,
- but not in AIX. This is a know bug. Skip related tests.
- * test/rinda/test_rinda.rb (test_ring_server_ipv4_multicast):
- ditto.
- * test/rinda/test_rinda.rb (test_make_socket_unicast): ditto.
- * test/socket/test_basicsocket.rb (test_getsockopt): ditto.
- * test/socket/test_sockopt.rb (test_bool): ditto.
+Wed Oct 16 15:14:21 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 15:27:14 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ * NEWS: add a line into NEWS for last commit.
- * test/zlib/test_zlib.rb (test_adler32_combine, test_crc32_combine):
- Skip two tests on AIX because zconf.h in zlib does not correctly
- recognize _LARGE_FILES in AIX. The problem was already reported
- to zlib, and skip these tests until it is fixed.
+Wed Oct 16 15:09:14 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 15:10:31 2016 Rei Odaira <Rei.Odaira@gmail.com>
+ * ext/objspace/objspace.c: add a new method `reachable_objects_from_root'.
+ ObjectSpace.reachable_objects_from_root returns all objects referred
+ from root (called "root objects").
+ This feature is for deep object analysis.
- * thread_pthread.c (getstack): __pi_stacksize returned by
- pthread_getthrds_np() is wrong on AIX. Use
- __pi_stackend - __pi_stackaddr instead.
+ * test/objspace/test_objspace.rb: add a test.
-Tue Mar 29 15:10:05 2016 Alex Boyd <alex@opengroove.org>
+Wed Oct 16 15:00:21 2013 Eric Hodel <drbrain@segment7.net>
- * lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
- [fix GH-1205][ruby-core:72773][Bug #11969]
+ * lib/rubygems: Update to RubyGems master b955554. Changes:
-Tue Mar 29 15:05:16 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ Fixed NameError for Gem::Ext due to re-entering file lookup in
+ RubyGems' overridden require. Bug by Koichi Sasada.
- * ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb: fix method name typo.
- [ruby-core:72513] [Bug #11893] The patch provided by Akira Matsuda.
+ Fixed possible circular require warning in tests.
+ Used existing constant for `gem install -g` dependency file list.
-Tue Mar 29 15:05:02 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * test/rubygems: ditto.
- * ext/tk/lib/tkextlib/tcllib/toolbar.rb: fix method name typo.
- [ruby-core:72511] [Bug #11891] The patch provided by Akira Matsuda.
+Wed Oct 16 09:42:42 2013 Eric Hodel <drbrain@segment7.net>
+ * lib/rubygems: Update to RubyGems master 278d00d. Changes:
-Tue Mar 29 15:04:42 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ Fixes building extensions without a "clean" make rule
- * ext/tk/lib/tkextlib/blt/tree.rb: fix method name typo.
- [ruby-core:72510] [Bug #11890] The patch provided by Akira Matsuda.
+ Adds gem dependency file autodetection to "gem install -g"
+ * test/rubygems: Tests for the above.
-Tue Mar 29 15:04:19 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Wed Oct 16 09:12:23 2013 Eric Hodel <drbrain@segment7.net>
- * ext/tk/lib/tk/menubar.rb: fix a typo in font name. [ruby-core:72505]
- [Bug #11886] The patch provided by Akira Matsuda.
+ * lib/rubygems: Update to RubyGems master commit 2a74263. This fixes
+ several bugs in RubyGems 2.2.0.preview.1.
- * ext/tk/sample/*.rb: ditto.
+ * test/rubygems: ditto.
-Tue Mar 29 15:03:03 2016 Kenta Murata <mrkn@mrkn.jp>
+Wed Oct 16 07:25:02 2013 Aman Gupta <ruby@tmm1.net>
- * ruby.h: undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
- and HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P on C++.
- [ruby-core:72736] [Bug #11962]
+ * gc.c (gc_mark_roots): rename roots to be categories
+ instead of function names.
-Tue Mar 29 14:58:56 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Oct 15 19:18:13 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/option.c (inspect_tcpi_msec): more accurate condition
- for TCPI msec member inspection function.
- [ruby-core:74388] [Bug #12185]
+ * gc.h (rb_objspace_reachable_objects_from_root): added.
+ This API provides information which objects are root objects.
+ `category' shows what kind of root objects.
-Tue Mar 29 14:53:58 2016 Naotoshi Seo <sonots@gmail.com>
+ * gc.c (gc_mark_roots): separate from gc_marks_body().
- * lib/logger.rb: Remove block from Logger.add as it's not needed
- patch provided by Daniel Lobato Garcia [fix GH-1240] [Bug #12054]
+Tue Oct 15 17:47:59 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 29 14:52:20 2016 Zachary Scott <zzak@ruby-lang.org>
+ * process.c: Fix a typo. MacOS X doesn't have ENOTSUPP.
- * re.c: Remove deprecated kcode argument from Regexp.new and compile
- patch provided by Dylan Pulliam [Bug #11495]
+Mon Oct 14 12:32:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 29 14:44:02 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ruby.c (process_options): load statically linked extensions before
+ rubygems, because of ext/thread.
- * ext/socket/socket.c (sock_gethostname): support unlimited size
- hostname.
+ * ruby.c (process_options): use gem_prelude instead of requiring
+ rubygems directly when --enable=gems is given.
-Tue Mar 29 14:35:06 2016 Kouhei Sutou <kou@cozmixng.org>
+ * Makefile.in (DEFAULT_PRELUDES): always use gem_prelude regardless of
+ --disable-rubygems.
- * lib/xmlrpc/client.rb: Support SSL options in async methods of
- XMLRPC::Client.
- [Bug #11489]
- Reported by Aleksandar Kostadinov. Thanks!!!
+Mon Oct 14 11:07:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 29 14:22:57 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/mkmf.rb (have_framework): should append framework options to
+ $LIBS, not $LDFLAGS. The former is propagated to exts.mk when
+ enable-static-linked-ext.
- * marshal.c (r_object0): honor Marshal.load post proc
- value for TYPE_LINK. by Hiroshi Nakamura <nahi@ruby-lang.org>
- https://github.com/ruby/ruby/pull/1204 fix GH-1204
+ * lib/mkmf.rb (create_makefile): ranlib on static library, not DLLIB.
-Tue Mar 29 14:18:26 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Oct 13 23:53:40 2013 Andrew Grimm <andrew.j.grimm@gmail.com>
- * .travis.yml: removed commented-out code.
+ * vsnprintf.c: Fix spelling from compliment to complement.
+ Patch by @agrimm.
-Tue Mar 29 14:18:26 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * include/ruby/ruby.h: ditto
- * .travis.yml: removed osx code. follow up with r53517
+Sun Oct 13 20:59:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 29 14:12:22 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c (Init_BareVM): initialize defined_module_hash here,
+ Init_top_self() is too late to register core classes/modules.
- * ext/socket/option.c (sockopt_bool): relax boolean size to be one
- too not only sizeof(int). Winsock getsockopt() returns a single
- byte as a boolean socket option. [ruby-core:72730] [Bug #11958]
+ * compile.c (compile_array_): no hash to merge if it is empty.
-Tue Mar 29 14:12:22 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c (m_core_hash_merge_kwd): just check keys if only one argument
+ is given, without merging.
- * ext/socket/option.c (check_size): extract a macro to check
- binary data size, with a consistent message.
+Sat Oct 12 06:35:01 2013-10-11 Eric Hodel <drbrain@segment7.net>
- * ext/socket/option.c (sockopt_byte): fix error message,
- sizeof(int) differs from sizeof(unsigned char) in general.
+ * lib/rake: Update to rake 10.1.0
+ * bin/rake: ditto.
+ * test/rake: ditto.
-Tue Mar 29 14:01:14 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+ * NEWS: Update NEWS to include rake 10.1.0 and links to release notes.
- * process.c (rb_execarg_parent_start1): need to convert the encoding to
- ospath's one.
+Sat Oct 12 03:26:04 2013 Koichi Sasada <ko1@atdot.net>
-Tue Mar 29 14:01:14 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+ * class.c, variable.c, gc.c (rb_class_tbl): removed.
- * process.c: use rb_w32_uchdir() instead of plain chdir() on Windows.
- reported by naruse via twitter.
+ * vm.c, vm_core.h (rb_vm_add_root_module): added to register as a
+ defined root module or class.
+ This guard helps mark miss from defined classes/modules they are
+ only referred from C's global variables in C-exts.
+ Basically, it is extension's bug.
+ Register to hash object VM has.
+ Marking a hash objects allows generational GC supports.
- * process.c (rb_execarg_addopt): need to convert the encoding to
- ospath's one.
+ * gc.c (RGENGC_PRINT_TICK): disable (revert).
-Tue Mar 29 13:56:36 2016 Eric Wong <e@80x24.org>
+Sat Oct 12 03:24:49 2013 Koichi Sasada <ko1@atdot.net>
- * ext/stringio/stringio.c (strio_binmode): implement to set encoding
- * test/stringio/test_stringio.rb (test_binmode): new test
- [ruby-core:72699] [Bug #11945]
+ * vm_method.c (rb_gc_mark_unlinked_live_method_entries):
+ revert last commit to introduce debug prints.
-Tue Mar 29 13:50:30 2016 Eric Wong <e@80x24.org>
+Fri Oct 11 21:05:19 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (io_getpartial): remove unused kwarg from template
- * test/ruby/test_io.rb (test_readpartial_bad_args): new
- [Bug #11885]
+ * internal.h, parse.y: use `full_mark' instead of `full_marking'.
-Tue Mar 29 13:41:03 2016 Tadashi Saito <tad.a.digger@gmail.com>
+Fri Oct 11 20:58:16 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c, cont.c, doc, man: fix common misspelling.
- [ruby-core:72466] [Bug #11870]
+ * gc.c: use terminology `full_mark' instead of `minor_gc'
+ in mark functions.
-Tue Mar 29 13:31:34 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Oct 11 20:46:09 2013 Koichi Sasada <ko1@atdot.net>
- * parse.y (regexp): set_yylval_num sets u1, should use nd_tag
- instead of nd_state. [ruby-core:72638] [Bug #11932]
+ * gc.c: use __GNUC__ instead of __GCC__.
-Tue Mar 29 13:31:34 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Oct 11 20:35:59 2013 Koichi Sasada <ko1@atdot.net>
- * parse.y (set_yylval_num): should be used as nd_state, set to u3.
- [ruby-core:72638] [Bug #11932]
+ * gc.c, parse.y: support generational Symbol related marking.
+ Each symbols has String objects respectively to represent
+ Symbols.
+ These objects are marked only when:
+ * full marking
+ * new symbols are added
+ This hack reduce symbols (related strings) marking time.
+ For example, on my Linux environment, the following code
+ "20_000_000.times{''}"
+ with 40k symbols (similar symbol number on Rails 3.2.14 app,
+ @jugyo tells me) boosts, from 7.3sec to 4.2sec.
-Tue Mar 29 13:26:15 2016 Joseph Tibbertsma <josephtibbertsma@gmail.com>
+ * internal.h: change prototype of rb_gc_mark_symbols().
- * gc.c (RVALUE_PAGE_WB_UNPROTECTED): fix a typo of argument name.
- [Fix GH-1221]
+Fri Oct 11 19:27:22 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Jan 21 16:39:55 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * misc/ruby-electric.el: Import ruby-electric.el 2.0.1 which fixes
+ a bug and a flaw with auto-end introduced in the revamp.
- * Makefile.in (update-rubyspec): fix r53208 like r53451.
+ * ruby-forward-sexp is inappropriate here because it moves the
+ cursor past the keyword.
-Fri Jan 15 00:05:57 2016 NARUSE, Yui <naruse@ruby-lang.org>
+ * Fix a reversed looking-back check in
+ ruby-electric--block-beg-keyword-at-point-p.
- * lib/uri/generic.rb (URI::Generic#to_s): change encoding to
- UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com>
- https://github.com/ruby/ruby/pull/1188 fix GH-1188
+ * Do not add end again if space or return is hit repeatedly
+ after a block beginning keyword.
-Tue Jan 12 17:23:39 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Oct 11 18:12:47 2013 Koichi Sasada <ko1@atdot.net>
- * process.c (rb_execarg_parent_start1): need to convert the encoding to
- ospath's one.
+ * ext/objspace/gc_hook.c: prohibit reentrant.
-Tue Jan 12 17:23:39 2016 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Oct 11 18:11:34 2013 Koichi Sasada <ko1@atdot.net>
- * process.c: use rb_w32_uchdir() instead of plain chdir() on Windows.
- reported by naruse via twitter.
+ * vm_trace.c (rb_postponed_job_flush): fix bit operation.
- * process.c (rb_execarg_addopt): need to convert the encoding to
- ospath's one.
+Fri Oct 11 17:33:24 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Jan 12 15:21:00 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-electric.el: Import ruby-electric.el 2.0 from
+ https://github.com/knu/ruby-electric.el which integrates changes
+ from another fork by @qoobaa.
- * include/ruby/missing.h (explicit_bzero_by_memset_s): remove
- inline implementation by memset_s, which needs a macro before
- including headers and can cause problems in extension libraries
- by the order of the macro and headers.
+ * Allow ruby-electric-mode to be disabled by introducing a
+ dedicated key map. Electric key bindings are now defined in
+ ruby-electric-mode-map instead of overwriting ruby-mode-map.
-Thu Dec 24 23:01:57 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * Add ruby-electric-mode-hook.
- * NEWS: added entry for CGI.escapeHTML optimization.
+ * Use a remap in binding ruby-electric-delete-backward-char.
-Thu Dec 24 18:43:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * Totally revamp electric keywords and then introduce electric
+ return. Modifier keywords are now properly detected making
+ use of ruby-mode's indentation level calculator, and
- * error.c (rb_compile_error_with_enc, rb_compile_error),
- (rb_compile_bug): deprecate internal functions.
+ * block-mid keywords (then, else, elsif, when, rescue and
+ ensure) also become electric with automatic reindentation.
- * parse.y (parser_yyerror): construct exception message with
- source code and caret.
+ * Add standardized comments for ELPA integration.
-Thu Dec 24 17:25:42 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * Fix interaction with smartparens-mode by disabling its end
+ keyword completion, since ruby-electric has become more clever
+ at it.
- * compile.c (append_compile_error), parse.y (compile_error):
- preserve encoding of source file name in exceptions.
+ * The custom variable `ruby-electric-keywords` is changed to
+ `ruby-electric-keywords-alist`, allowing user to fine-grained
+ configuration.
- * error.c (rb_compile_error_str, rb_compile_bug_str): add.
+Fri Oct 11 16:53:28 2013 Koichi Sasada <ko1@atdot.net>
-Thu Dec 24 16:17:47 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_trace.c (rb_postponed_job_flush): simplify.
- * common.mk (fake.rb): $(arch)-fake.rb must depend on miniruby because
- it may depend on miniruby.
+Fri Oct 11 03:36:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Dec 24 16:13:05 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread.c (rb_threadptr_execute_interrupts): flush postponed job only
+ once at last.
- * common.mk (ripper.c): r50045 wrongly replace $(PWD) with ../..
- It is the top of build directory, not topsrcdir.
+ * vm_trace.c (rb_postponed_job_flush): defer calling postponed jobs
+ registered while flushing to get rid of infinite reentrance of
+ ObjectSpace.after_gc_start_hook. [ruby-dev:47400] [Bug #8492]
-Thu Dec 24 15:02:42 2015 sorah (Shota Fukumori) <her@sorah.jp>
+Thu Oct 10 23:04:00 2013 Masaki Matsushita <glass.saga@gmail.com>
- * tool/vcs.rb (IO.popen): Refactor. Avoid assigning in condition.
+ * array.c (rb_ary_or): remove unused variables.
-Thu Dec 24 15:01:38 2015 sorah (Shota Fukumori) <her@sorah.jp>
+Thu Oct 10 23:01:16 2013 Masaki Matsushita <glass.saga@gmail.com>
- * tool/file2lastrev.rb: Fix ArgumentError to work on Ruby 1.8.7.
+ * array.c (rb_ary_or): use rb_hash_keys().
-Thu Dec 24 14:44:08 2015 sorah (Shota Fukumori) <her@sorah.jp>
+Thu Oct 10 21:36:16 2013 Masaki Matsushita <glass.saga@gmail.com>
- * tool/vcs.rb (IO.popen): Enable on Ruby 1.9 where chdir option is not
- supported on IO.popen
+ * array.c (rb_ary_compact_bang): use ary_resize_smaller().
- * tool/vcs.rb (IO.popen): Fix NoMethodError. I guess r49705 was not
- tested... :/
+Thu Oct 10 17:25:28 2013 Koichi Sasada <ko1@atdot.net>
-Thu Dec 24 14:57:03 2015 Koichi Sasada <ko1@atdot.net>
+ * vm.c (vm_exec): support :b_return event for "lambda{return}.call".
+ [Bug #8622]
- * NEWS: rename
- "Implementation changes" section to
- "Supported platform changes" section.
+ * test/ruby/test_settracefunc.rb: add a test.
- * NEWS: add "Implementation improvements" and add several entries.
+Thu Oct 10 13:52:37 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: add NEWS entries by Eric Wong. [ruby-core:72450]
+ * vm_trace.c (postponed_job): use preallocated buffer.
+ Pre-allocate MAX_POSTPONED_JOB (1024) sized buffer
+ and use it.
+ If rb_postponed_job_register() cause overflow, simply it
+ fails and returns 0.
+ And maybe rb_postponed_job_register() is signal safe.
-Thu Dec 24 00:26:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_core.h: change data structure.
- * ext/io/console/extconf.rb: fix gem build failure on Windows.
- only win32_vk.inc is included in the gem and no dependencies for
- the header, so that gperf will not be mandatory.
- [ruby-core:72453] [Bug #11866]
+Thu Oct 10 11:11:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/io/console/io-console.gemspec: include depend file and
- win32_vk header.
+ * vm.c (Init_VM): hide also the singleton class of frozen-core, not
+ only frozen-core itself.
-Wed Dec 23 23:58:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 10 06:02:08 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_readwrite_syserr_fail): works with the given errno than
- thread local errno.
+ * test/ruby/test_rand.rb: fix r43224. local variable `e' is
+ no longer available.
-Wed Dec 23 17:57:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 10 00:02:35 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * file.c, io.c, util.c: prefer rb_syserr_fail with saved errno
- over setting errno then call rb_sys_fail, not to be clobbered
- potentially and to reduce thread local errno accesses.
+ * numeric.c (fix_aref): avoid a possible undefined behavior.
+ 1L << 63 on 64-bit platform is undefined, at least, according to
+ ISO/IEC 9899 (C99) 6.5.7.
-Wed Dec 23 11:58:52 2015 Yuichiro Kaneko <yui-knk@ruby-lang.org>
+Wed Oct 9 23:57:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c: Fix document. Default value of the first
- argument of `String#split` is not `$;` but `nil`.
- When `nil` is passed as first argument, `$;` is used.
- [ci skip] [Bug #11729] [ruby-dev:49378]
+ * object.c (id_for_attr): avoid inadvertent symbol creation.
-Wed Dec 23 07:15:17 2015 Eric Wong <e@80x24.org>
+Wed Oct 9 18:03:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/init.c (rsock_init_sock): reject reserved FDs
- [ruby-core:72445] [Bug #11862]
+ * vm_method.c (rb_attr): preserve encoding of the attribute ID in
+ error message.
-Wed Dec 23 02:59:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 9 17:40:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (__STDC_WANT_LIB_EXT1__): necessary to use memset_s
- in strict C99 mode.
+ * string.c (rb_fstring): because of lazy sweep, str may be unmarked
+ already and swept at next time, so mark it for the time being.
+ [ruby-core:57756]
-Wed Dec 23 02:34:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 9 13:53:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regexec.c (match_at): move direct threaded VM code to get rid of
- mixed declarations and code, and enable it only for gcc since it
- depends on a gcc extension.
+ * compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003]
-Wed Dec 23 02:23:19 2015 Yuki Nishijima <mail@yukinishijima.net>
+ * thread.c (rb_exec_recursive_paired_outer): new function which is
+ combination of paired and outer variants.
- * gems/bundled_gems: Upgrade the did_you_mean gem to 1.0.0
+Wed Oct 9 09:18:14 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: Add news about the did_you_mean gem
+ * include/ruby/debug.h,
+ vm_backtrace.c (rb_profile_frame_full_label): add new C API
+ rb_profile_frame_full_label() which returns label with
+ qualified method name.
+ Note that in future version of Ruby label() may return
+ same return value of full_label().
-Wed Dec 23 02:18:57 2015 Jake Worth <jakeworth82@gmail.com>
+ * ext/-test-/debug/profile_frames.c,
+ test/-ext-/debug/test_profile_frames.rb: fix a test for this change.
- * doc/contributing.rdoc: [DOC] remove an extra word "here".
- [Fix GH-1169]
-Wed Dec 23 01:58:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 9 00:55:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regexec.c (USE_DIRECT_THREADED_VM): enable direct threaded VM by
- the default.
+ * load.c (load_lock): display backtrace to $stderr at circular
+ require.
-Tue Dec 22 22:15:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_backtrace.c (rb_backtrace_print_to): new function to print
+ backtrace to the given output.
- * gc.c (internal_object_p): should not expose singleton classes
- without a metaclass. based on patches by ko1 and shugo.
- [Bug #11740]
+Tue Oct 8 21:03:35 2013 Koichi Sasada <ko1@atdot.net>
- * class.c (rb_singleton_class_object_p): added.
+ * vm_backtrace.c, include/ruby/debug.h: add new APIs
+ * VALUE rb_profile_frame_method_name(VALUE frame)
+ * VALUE rb_profile_frame_qualified_method_name(VALUE frame)
-Tue Dec 22 22:15:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * iseq.c (rb_iseq_klass), internal.h: add new internal function
+ rb_iseq_method_name().
- * ext/io/console/io-console.gemspec: bump up to 0.4.4.
+ * ext/-test-/debug/profile_frames.c (profile_frames),
+ test/-ext-/debug/test_profile_frames.rb: add a test.
-Tue Dec 22 22:11:06 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Oct 8 16:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: Added news entry of Psych 2.0.17
+ * array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no
+ block is given.
-Tue Dec 22 22:09:01 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * internal.h: define rb_hash_values() as internal API.
- * NEWS: Added news entry of RDoc 4.2.1
+Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
-Tue Dec 22 21:20:00 2015 Kenta Murata <mrkn@mrkn.jp>
+ * array.c (rb_ary_uniq): use rb_hash_keys().
- * ext/bigdecimal/bigdecimal.gemspec: bump version to 1.2.8.
+ * internal.h: define rb_hash_keys() as internal API.
-Tue Dec 22 21:08:05 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * hash.c (rb_hash_keys): ditto.
- * lib/rdoc.rb: bump version to 4.2.1. It contains following fixes.
- https://github.com/rdoc/rdoc/pull/340
- https://github.com/rdoc/rdoc/pull/341
- https://github.com/rdoc/rdoc/pull/367
- https://github.com/rdoc/rdoc/pull/368
- * lib/rdoc/*: ditto.
- * test/rdoc/*: ditto.
+Tue Oct 8 10:56:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Dec 22 20:25:33 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * cont.c: disable FIBER_USE_NATIVE on GNU/Hurd because it doesn't
+ support a combination getcontext() and threads. Patch by
+ Gabriele Giacone (1o5g4r8o@gmail.com). [Bug #8990][ruby-core:57685]
- * ext/psych/lib/psych.rb: bump version to 2.0.17
- * ext/psych/psych.gemspec: ditto.
+Tue Oct 8 05:58:12 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 22 20:14:47 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
+ time Time object as Ruby 2.0 and before.
- * vm_insnhelper.c: move vm_callee_setup_block_arg() (and related
- functions) to the latter location.
- This moving recovers performance a little.
- [Bug #11829]
+Tue Oct 8 05:40:37 2013 Eric Hodel <drbrain@segment7.net>
-Tue Dec 22 15:21:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * .travis.yml: Rebuild Travis CI's "ruby-head" version on successful
+ build. Patch by Konstantin Haase. [Fixes GH-417]
+ https://github.com/ruby/ruby/pull/417
- * string.c (str_compat_and_valid): as scrub does nothing for dummy
- encoding string now, incompatible encoding is not a matter.
+Tue Oct 8 04:28:25 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Dec 22 14:31:28 2015 Toru Iwase <tietew@tietew.net>
+ * misc/ruby-mode.el: Use preceding-char/following-char
+ (returning 0 at BOF/EOF) instead of char-before/char-after
+ (returning nil at BOF/EOF) to avoid error from char-syntax when
+ at BOF/EOF.
- * ext/cgi/escape/escape.c (optimized_escape_html): CGI.escapeHTML
- should return unfrozen new string.
- [ruby-core:72426] [Bug #11858]
+Tue Oct 8 04:12:45 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Dec 22 05:39:58 2015 Takashi Kokubun <takashikkbn@gmail.com>
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Add a missing
+ else clause to unbreak with `cp932`, etc.
- * ext/cgi/escape/escape.c (preserve_original_state): Preserve
- original state for tainted and frozen. [Fix GH-1166]
- [ruby-dev:49451] [Bug #11855]
+ * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
-Tue Dec 22 03:57:20 2015 Eric Wong <e@80x24.org>
+Tue Oct 8 03:57:34 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/socket/init.c (rsock_init_sock): check FD after validating
- * test/socket/test_basicsocket.rb (test_for_fd): new
- [ruby-core:72418] [Bug #11854]
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Use
+ `default-buffer-file-coding-system` if the :prefer-utf-8
+ property is not available.
-Mon Dec 21 21:29:45 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
- * variable.c (struct ivar_update): rename "extended" to "iv_extended"
- to avoid name conflict with /usr/include/floatingpoint.h on
- Solaris. [Bug #11853] [ruby-dev:49448]
+ * misc/ruby-additional.el (ruby-encoding-map): Override the
+ default value.
-Mon Dec 21 12:15:32 2015 Kimura Wataru <kimuraw@i.nifty.jp>
+Tue Oct 8 03:19:19 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/ruby/test_io.rb: handled rlimit value same as r52277
- [Bug #11852][ruby-dev:49446]
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Add support
+ for `prefer-utf-8` which was introduced in Emacs trunk.
-Mon Dec 21 10:21:22 2015 Ilya Vassilevsky <vassilevsky@gmail.com>
+ * misc/ruby-additional.el (ruby-encoding-map): Add a mapping from
+ `japanese-cp932` to `cp932` to fix the problem where saving a
+ source file written in Shift_JIS twice would end up having
+ `coding: japanese-cp932` which Ruby could not recognize.
- * lib/net/http.rb (open_timeout): update default value in RDoc
- [ruby-core:72413]
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Add support
+ for encodings mapped to nil in `ruby-encoding-map`.
-Mon Dec 21 10:18:46 2015 Kazuki Yamaguchi <k@rhe.jp>
+ * misc/ruby-additional.el (ruby-encoding-map): Map `us-ascii` and
+ `utf-8` to nil by default, meaning they need not be explicitly
+ declared in magic comment.
- * vm_backtrace.c (rb_profile_frames): ignore ifunc frames as it
- did before. [ruby-core:72409] [Bug #11851]
+ * misc/ruby-additional.el (ruby-encoding-map): Add type
+ declaration for better customize UI.
-Mon Dec 21 09:33:17 2015 Karol Bucek <kares@users.noreply.github.com>
+ * misc/ruby-mode.el: Ditto for the above.
- * ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLSocket): fix
- NotImplementedError typo. [Fix GH-1165]
+Tue Oct 8 00:14:53 2013 Akinori MUSHA <knu@iDaemons.org>
-Sun Dec 20 20:54:51 2015 Takashi Kokubun <takashikkbn@gmail.com>
+ * misc/ruby-additional.el: Add a standard header and footer,
+ including (provide 'ruby-additional).
- * cgi/escape/escape.c: Optimize CGI.escapeHTML for
- ASCII-compatible encodings. [Fix GH-1164]
+Mon Oct 7 22:52:45 2013 Akinori MUSHA <knu@iDaemons.org>
-Sun Dec 20 15:36:46 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * misc/ruby-electric.el (ruby-electric-space-can-be-expanded-p):
+ Return nil to avoid "end" insertion when in smartparens-mode
+ that is configured to insert "end" for the same keyword.
- * lib/erb.rb: revert r53123. It breaks compatibility like thor and
- rspec-rails.
- We should try with Ruby 2.4 or 3.0.
- [Bug #11842][ruby-core:72374]
- * lib/rdoc/erb_partial.rb: ditto.
- * template/verconf.h.tmpl: ditto.
+ * misc/ruby-electric.el (ruby-electric-keywords): New custom
+ variable to replace `ruby-electric-simple-keywords-re` with.
-Sun Dec 20 11:43:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Oct 7 22:52:16 2013 Akinori MUSHA <knu@iDaemons.org>
- * parse.y (parser_yylex): allow here documents in labeled
- argument. [ruby-core:72396] [Bug #11849]
+ * misc/ruby-additional.el: Use preceding-char/following-char
+ (returning 0 at BOF/EOF) instead of char-before/char-after
+ (returning nil at BOF/EOF) to avoid error from char-syntax when
+ at BOF/EOF.
-Sun Dec 20 11:14:11 2015 Koichi Sasada <ko1@atdot.net>
+Mon Oct 7 22:45:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c (rb_mod_define_method): should check Symbol or not.
- [Bug #11850]
+ * cont.c (FIBER_USE_NATIVE): split long conditions.
- * test/ruby/test_method.rb: add a test.
+Mon Oct 7 20:29:31 2013 Zachary Scott <e@zzak.io>
-Sun Dec 20 11:01:57 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/time.rb: [DOC] typo in Time.rb overview by @srt32 [Fixes GH-416]
+ https://github.com/ruby/ruby/pull/416
- * proc.c (rb_mod_define_method): fix notation.
+Mon Oct 7 20:07:20 2013 Tanaka Akira <akr@fsij.org>
-Sun Dec 20 10:54:15 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/time.rb (Time.strptime): Use :offset.
+ Patch by Felipe Contreras. [ruby-core:57694]
- * proc.c (proc_new): fix notation.
+Mon Oct 7 16:47:27 2013 Koichi Sasada <ko1@atdot.net>
-Sun Dec 20 00:29:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/-ext-/debug/test_profile_frames.rb: rename class C to
+ something long name because one test depends on absence of
+ class ::C.
- * proc.c (rb_proc_get_iseq): proc made from symbol does not have
- iseq. fix infinite loop. [ruby-core:72381] [Bug #11845]
+Mon Oct 7 16:33:10 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 19 20:06:10 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * ext/-test-/debug/profile_frames.c:
+ test/-ext-/debug/test_profile_frames.rb: add a test for new C-APIs.
- * enc/windows_1250.c: Should not use C++ style comments (C99 feature).
- [Bug #11843]
+Mon Oct 7 16:12:36 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 19 17:17:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/debug.h: add backtrace collecting APIs for profiler.
+ * int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
+ Collect information of frame information.
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
- use WEBrick::Utils::TimeoutHandler::Thread, which is ignored by
- LeakChecker#find_threads, instead of ::Thread to get rid of
- thread leak checker. since this TimeoutHandler is resident
- during tests because of Singleton, it waits for the next timeout
- if it has any schedules. in the case of nested timeouts, inner
- timeout does not cancel outer timeouts and then those schedules
- still remain.
+ * VALUE rb_profile_frame_path(VALUE frame);
+ * VALUE rb_profile_frame_absolute_path(VALUE frame);
+ * VALUE rb_profile_frame_label(VALUE frame);
+ * VALUE rb_profile_frame_base_label(VALUE frame);
+ * VALUE rb_profile_frame_first_lineno(VALUE frame);
+ * VALUE rb_profile_frame_classpath(VALUE frame);
+ * VALUE rb_profile_frame_singleton_method_p(VALUE frame);
+ Get information about each frame.
-Sat Dec 19 14:28:01 2015 Jake Worth <jakeworth82@gmail.com>
+ These APIs are designed for profilers, for example, no object allocation,
+ and enough information for profilers.
+ In this version, this API collects only Ruby level frames.
+ This issue will be fixed after Ruby 2.1.
- * ext/zlib/zlib.c (Init_zlib): [DOC] Fix double-word typo and
- grammatical error. [Fix GH-1162]
+ * vm_backtrace.c: implement above APIs.
-Sat Dec 19 14:23:59 2015 Jake Worth <jakeworth82@gmail.com>
+ * iseq.c (rb_iseq_klass): return local_iseq's class.
- * lib/csv.rb (CSV#initialize): [DOC] Fix double-word typo.
- [Fix GH-1161]
+Mon Oct 7 14:26:01 2013 Koichi Sasada <ko1@atdot.net>
-Sat Dec 19 10:33:33 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * proc.c: catch up last commit.
+ Type of return value of rb_iseq_first_lineno() is now VALUE.
- * enc/iso_8859_2.c, enc/windows_1250.c: separate Windows-1250
- from ISO-8859-2 to fix 0x80..0x9e range (from Kimihito Matsui)
+ * vm_insnhelper.c (argument_error): ditto.
-Fri Dec 18 21:26:54 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * vm_method.c (rb_method_entry_make): ditto.
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): To prevent
- potential deadlocks, Queue is used to tell update of @timeout_info
- instead of sleep and wakeup. [Bug #11742] [ruby-dev:49387]
+Mon Oct 7 14:07:45 2013 Koichi Sasada <ko1@atdot.net>
-Fri Dec 18 17:24:09 2015 Koichi Sasada <ko1@atdot.net>
+ * iseq.c, internal.h: change to public (but internal) functions
+ * VALUE rb_iseq_path(VALUE iseqval);
+ * VALUE rb_iseq_absolute_path(VALUE iseqval);
+ * VALUE rb_iseq_label(VALUE iseqval);
+ * VALUE rb_iseq_base_label(VALUE iseqval);
+ * VALUE rb_iseq_first_lineno(VALUE iseqval);
+ And new (temporary) function:
+ * VALUE rb_iseq_klass(VALUE iseqval);
- * compile.c (ibf_load_object_string): use fstring if frozen string.
+ * iseq.c. vm_core.h (int rb_iseq_first_lineno): remove
+ function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'.
+ Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead.
-Fri Dec 18 16:54:38 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c. vm_insnhelper.c, vm_method.c: catch up this change.
- * ext/stringio/stringio.c (strio_set_encoding): add StringIO's own
- encoding and separate it from the buffer string to override the
- encoding of string when reading. [ruby-core:72189] [Bug #11827]
- note that setting the encoding of its buffer string directly
- without StringIO#set_encoding may cause unpredictable behavior.
+Sun Oct 6 08:37:39 2013 Zachary Scott <e@zzak.io>
-Fri Dec 18 16:50:35 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/webrick.rb: [DOC] fix grammar in WEBrick overview [Fixes GH-413]
+ Based on patch by @chastell https://github.com/ruby/ruby/pull/413
- * compile.c (ibf_load_setup): check tainted string argument.
+Sat Oct 5 11:21:01 2013 Aaron Pfeifer <aaron.pfeifer@gmail.com>
-Fri Dec 18 16:12:13 2015 Koichi Sasada <ko1@atdot.net>
+ * thread.c (terminate_atfork_i): fix locking mutexes not unlocked in
+ forks when not tracked in thread. [ruby-core:55102] [Bug #8433]
- * vm_core.h: define USE_LAZY_LOAD if it is not defined.
+Fri Oct 4 19:54:09 2013 Zachary Scott <e@zzak.io>
-Fri Dec 18 15:40:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/dbm/dbm.c: [DOC] Fix wrong constant name in DBM by @edward
+ [Fixes GH-409] https://github.com/ruby/ruby/pull/409
- * ext/stringio/stringio.c (strio_unget_bytes): extract from
- strio_ungetbyte to share with strio_ungetc.
+Fri Oct 4 19:49:42 2013 Aman Gupta <ruby@tmm1.net>
-Fri Dec 18 12:39:42 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c: rename heap.free_num as heap.swept_num to clarify meaning and
+ avoid confusion with objspace_free_num().
- * doc/syntax/*.rdoc: separated modifier at sentence.
- [ci skip][fix GH-1121] Patch by @clandry94
+Fri Oct 4 19:02:01 2013 Aman Gupta <ruby@tmm1.net>
-Fri Dec 18 12:09:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (objspace_free_num): new method for available/free slots on
+ heap. [ruby-core:57633] [Bug #8983]
+ * gc.c (gc_stat): change heap_free_num definition to use new method.
+ * test/ruby/test_gc.rb: test for above.
- * ext/stringio/stringio.c (strio_ungetbyte): pad with \000 when
- the current position is after the end.
+Fri Oct 4 18:53:42 2013 Aman Gupta <ruby@tmm1.net>
-Fri Dec 18 11:24:48 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c: add rb_objspace.limit to keep accurate count of total heap
+ slots [ruby-core:57633] [Bug #8983]
- * vm_method.c (rb_method_entry_make, check_override_opt_method):
- should check whether a newly created method overrides an optimize
- method in case the method is defined in a prepended module of a
- built-in class.
- [ruby-core:72226] [Bug #11836]
+Fri Oct 4 09:32:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 18 11:09:38 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/csv.rb (CSV.foreach): support enumerator. based on a patch by
+ Hanmac (Hans Mackowiak) at [ruby-core:57643]. [ruby-core:57283]
+ [Feature #8929]
- * vm.c (vm_exec): call RUBY_DTRACE_CMETHOD_RETURN_HOOK instead of
- RUBY_DTRACE_METHOD_RETURN_HOOK.
+Thu Oct 3 18:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 18 10:24:44 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * win32/win32.c (console_emulator_p, constat_handle): disable built-in
+ console colorizing when console-emulator-like DLL is injected.
+ [Feature #8201]
- * lib/irb/ruby-lex.rb: fixed parse error for striped heredocument syntax.
- [fix GH-1127] Patch by @koic
+Thu Oct 3 18:01:44 2013 Koichi Sasada <ko1@atdot.net>
-Fri Dec 18 09:44:47 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c: define gc_profile_record::allocated_size if
+ CALC_EXACT_MALLOC_SIZE is true.
- * ext/pty/pty.c: fix double words typo.
- [ci skip][fix GH-1157] Patch by @jwworth
+Thu Oct 3 13:42:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 18 09:42:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * common.mk (yes-test-sample): use RUNRUBY instead of MINIRUBY to set
+ runtime library path and run the built ruby. [Bug #8971]
- * ext/nkf/nkf-utf8/utf8tbl.c: fix a typo.
- [ci skip][fix GH-1159] Patch by @akshay-vishnoi
- * ext/nkf/nkf-utf8/utf8tbl.h: ditto.
+Thu Oct 3 00:17:15 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Dec 18 07:39:01 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * misc/ruby-additional.el: Properly quote the body. An unquoted
+ body given to eval-after-load is evaluated immediately!
- * vm.c (rb_vm_check_redefinition_opt_method): should check the real
- class instead of the origin iclass.
- [ruby-core:72188] [Bug #11826]
+Wed Oct 2 21:38:30 2013 Yusuke Endoh <mame@tsg.ne.jp>
-Thu Dec 17 22:13:10 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/socket/ifaddr.c (rsock_getifaddrs): fix possible memory leak.
+ When a system had no interface, this function used xmalloc for root
+ but did not return any reference to it. This patch fixes it by
+ immediately returning an empty array if no interface is found.
+ Coverity Scan found this bug.
- * vm_args.c (vm_caller_setup_arg_block): remove code for ifunc
- because it was made unnecessary by r52138.
+Wed Oct 2 21:37:04 2013 Yusuke Endoh <mame@tsg.ne.jp>
-Thu Dec 17 16:13:10 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * random.c (make_seed_value): a local array declaration was accessed
+ out of scope. Coverity Scan found this bug.
- * proc.c (rb_block_arity): should not call GetProcPtr() for symbols.
- [ruby-core:72205] [Bug #11830]
+Wed Oct 2 18:52:40 2013 Koichi Sasada <ko1@atdot.net>
-Thu Dec 17 14:16:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: relax GC condition due to malloc_limit.
- * string.c (rb_str_scrub): the result should be infected by the
- original string.
+ * gc.c (GC_MALLOC_LIMIT_MAX): change default value
+ (256MB -> 512MB) and permit zero to ignore max value.
-Thu Dec 17 13:35:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (vm_malloc_increase, vm_xrealloc): do not cause GC on realloc.
- * transcode.c (rb_econv_substr_append, econv_primitive_convert):
- the result should be infected by the original string.
+ * gc.c (gc_before_sweep): change debug messages.
-Thu Dec 17 09:46:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Oct 2 16:26:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (reg_names_iter): should consider encoding of regexp.
- [ruby-core:72185] [Bug #11825]
+ * io.c (rb_io_close_read): duplex IO should wait its child process
+ even after close_read.
-Thu Dec 17 03:52:10 2015 Koichi Sasada <ko1@atdot.net>
+Wed Oct 2 15:39:13 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm.c (vm_make_env_each): should not compare with Qfalse and FALSE.
- Pointed at http://d.hatena.ne.jp/nagachika/20151216/ruby_trunk_changes_53128_53163
+ * vm_core.h: use __has_attribute() instead of __clang__major__ because
+ clang says "Note that marketing version numbers should not be used
+ to check for language features, as different vendors use different
+ numbering schemes. Instead, use the Feature Checking Macros."
+ http://clang.llvm.org/docs/LanguageExtensions.html
-Thu Dec 17 03:15:25 2015 Koichi Sasada <ko1@atdot.net>
+Wed Oct 2 14:19:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c (vm_call_method_each_type): should not set fastpath
- with keyword arguments for VM_METHOD_TYPE_ATTRSET type methods.
+ * io.c (rb_io_close_write): detach tied IO for writing before closing
+ to get rid of race condition. [ruby-list:49598]
- Normally, we can not use keyword arguments for this kind of methods,
- (obj.foo = 1), but we can set alias names for them.
- [Bug #11657]
+ * io.c (rb_io_close_read): keep fptr in write_io to be discarded, to
+ fix freed pointer access when it is in use by other threads, and get
+ rid of potential memory/fd leak.
- * test/ruby/test_keyword.rb: add a test for this fix.
+Tue Oct 1 23:44:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Wed Dec 16 20:32:43 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * vm_core.h: use __attribute__((unused)) in UNINITIALIZED_VAR on clang
+ 4.0+ instead of just on 4.2. Clang has supported the unused attribute
+ since before version 4, so this should be safe.
- * ext/fiddle/handle.c: check tainted string arguments.
- Patch provided by tenderlove and nobu.
+Tue Oct 1 22:03:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/fiddle/test_handle.rb (class TestHandle): add test for above.
+ * lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed
+ after unlinking. patched by by normalperson (Eric Wong) at
+ [ruby-core:56521] [Bug #8768]
+Tue Oct 1 20:54:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 16 19:30:56 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * file.c (stat_new_0): constify.
- * vm.c (vm_make_proc_from_block): should convert a Symbol to a Proc.
- [ruby-core:72083] [Bug #11811]
+ * file.c (rb_stat_new): constify and export. based on a patch by
+ Hanmac (Hans Mackowiak) at [ruby-core:53225]. [Feature #8050]
-Wed Dec 16 16:17:34 2015 Eric Wong <e@80x24.org>
+Tue Oct 1 16:03:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_io.rb: fix spelling errors
+ * include/ruby/ruby.h (ruby_safe_level_4_warning): needed by extension
+ libraries which check safe level 4. [ruby-dev:47517] [Bug #8652]
-Wed Dec 16 16:04:49 2015 Eric Wong <e@80x24.org>
+Mon Sep 30 23:14:36 2013 Zachary Scott <e@zzak.io>
- * NEWS: note IO#advise change [ruby-core:72168]
+ * ext/objspace/objspace.c: [DOC] Cleaned up many rdoc formatting
+ issues and several duplicate grammar bugs.
-Wed Dec 16 15:35:13 2015 Koichi Sasada <ko1@atdot.net>
+Mon Sep 30 23:01:01 2013 Zachary Scott <e@zzak.io>
- * vm.c: fix mark miss for proc given as passed block.
- [Bug #11750]
+ * ext/objspace/object_tracing.c: [DOC] Adjust rdoc formatting and fix
+ small grammar typo
- * vm.c (vm_make_proc_from_block): should return a Proc object
- if block is given. Previous implementation returns
- a Proc object only when corresponding Proc object is not
- available.
+Mon Sep 30 17:28:39 2013 Koichi Sasada <ko1@atdot.net>
- * vm.c (vm_make_env_each): ditto.
+ * ext/objspace/object_tracing.c: [DOC] add some notes for
+ ObjectSpace::trace_object_allocations.
- * test/ruby/test_proc.rb: add a test for this bug.
+Mon Sep 30 16:46:58 2013 Koichi Sasada <ko1@atdot.net>
-Wed Dec 16 12:24:59 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * ext/objspace/object_tracing.c: add new 3 methods to control tracing.
+ * ObjectSpace::trace_object_allocations_start
+ * ObjectSpace::trace_object_allocations_stop
+ * ObjectSpace::trace_object_allocations_clear
+ And some refactoring.
- * test_struct.rb: Test that initialize is overridable [#11708]
+ * test/objspace/test_objspace.rb: add a test for new methods.
-Wed Dec 16 10:49:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS: add a description for new methods.
- * parse.y (block_command, block_call): fix `&.` calls after
- block_call. [Feature #11537]
+Mon Sep 30 11:18:04 2013 Koichi Sasada <ko1@atdot.net>
-Wed Dec 16 00:53:45 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * gc.c (rb_gc_disable): do rest_sweep() before disable GC.
+ This fix may solve a failure of
+ TestTracepointObj#test_tracks_objspace_events
+ [test/-ext-/tracepoint/test_tracepoint.rb:43].
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): Acquire
- TimeoutMutex only when accessing @timeout_info for avoiding
- potential deadlock. [Bug #11742] [ruby-dev:49387]
+Mon Sep 30 10:40:20 2013 Shugo Maeda <shugo@ruby-lang.org>
-Wed Dec 16 00:39:27 2015 Jake Worth <jakeworth82@gmail.com>
+ * vm_method.c (rb_undef): raise a NameError if the original method
+ of a refined method is not defined.
- * doc/extension.rdoc: [DOC] fix double-word typo. [Fix GH-1153]
+ * vm_insnhelper.c (rb_method_entry_eq): added NULL check to avoid SEGV.
-Wed Dec 16 00:25:41 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * test/ruby/test_refinement.rb: related test.
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
- TimeoutMutex should be acquired when accessing @timeout_info.
- To avoid deadlock, interrupt() calls are delayed.
- Due to the mutex, it is safe to treat ary without ary.dup.
- [Bug #11742] [ruby-dev:49387]
+Sun Sep 29 23:45:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 15 23:13:10 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * parse.y (rb_id_attrset, intern_str): allow junk attrset ID for
+ Struct.
- * gc.c: Delete excess semicolon after RUBY_ALIAS_FUNCTION().
- Suppress "syntax error: empty declaration" warnings by
- Oracle Solaris Studio 12.x on Solaris. [Bug #11821]
+ * parse.y (rb_id_attrset): fix inconsistency with literals, allow
+ ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
+ and raise a NameError instead of rb_bug() for invalid argument.
- * hash.c: ditto, after NOINSERT_UPDATE_CALLBACK().
+Sun Sep 29 18:45:05 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Tue Dec 15 18:04:04 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_yield_setup_block_args):
+ clear keyword arguments to prevent GC bug which occurs
+ while marking VM stack.
+ [ruby-dev:47729] [Bug #8964]
- * NEWS: added news about EBCDIC encoding
+ * test/ruby/test_keyword.rb: tests for the above.
-Tue Dec 15 17:57:57 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+Sat Sep 28 23:25:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * enc/ebcdic.h, enc/trans/ebcdic.trans,
- test/ruby/test_transcode.rb: Fixed encoding name
- to the correct one in the IANA registry (IBM037)
- and added an alias (ebcdic-cp-us)
+ * math.c (math_log, math_log2, math_log10): fix for Bignum argument.
+ numbits should be add only when right shifted.
-Tue Dec 15 16:19:26 2015 Takashi Kokubun <takashikkbn@gmail.com>
+Sat Sep 28 14:30:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/erb.rb: Render erb with array buffer for function call optimization.
- [fix GH-1143]
- * lib/rdoc/erb_partial.rb: ditto.
- * template/verconf.h.tmpl: ditto.
+ * test/dl/test_base.rb: {libc, libm} detection now handle GNU/Hurd
+ correctly. Patch by Gabriele Giacone (1o5g4r8o@gmail.com).
+ [Bug #8937][ruby-core:57311]
+ * test/fiddle/helper.rb: ditto.
-Tue Dec 15 13:50:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 28 00:19:41 2013 Shugo Maeda <shugo@ruby-lang.org>
- * string.c (rb_str_oct): [DOC] mention radix indicators.
- [ruby-core:71310] [Bug #11648]
+ * ext/curses/extconf.rb: check the size of chtype.
-Tue Dec 15 12:20:30 2015 Takashi Kokubun <takashikkbn@gmail.com>
+ * ext/curses/curses.c (NUM2CH, CH2NUM): use proper macros for
+ the size of chtype.
- * lib/erb.rb: Simplify regexp to optimize erb scanner.
- [fix GH-1144]
+ [ruby-core:56090] [Bug #8659]
-Tue Dec 15 11:56:24 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri Sep 27 18:33:23 2013 Koichi Sasada <ko1@atdot.net>
- * lib/uri/common.rb: make code block for rdoc.
- [ci skip][fix GH-1152] Patch by @Tonkpils
+ * gc.c: add two GC tuning environment variables.
+ RUBY_GC_MALLOC_LIMIT_MAX and RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.
+ See r43067 for details.
-Tue Dec 15 11:55:08 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (rb_gc_set_params): refactoring. And change verbose notation.
+ Mostly duplicated functions get_envparam_int/double is not cool.
+ Please rewrite it.
- * ext/zlib/zlib.c: fix a typo.
- [ci skip][fix GH-1149] Patch by @crismali
+ * test/ruby/test_gc.rb: fix a test for this change.
-Tue Dec 15 09:14:14 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+Fri Sep 27 17:44:41 2013 Koichi Sasada <ko1@atdot.net>
- * tool/transcode_tablegen.rb: detailed documentation
- for transcode_tblgen function [ci skip]
+ * gc.c (GC_MALLOC_LIMIT): 8,000,000 -> 8 * 1,024 * 1,024.
-Mon Dec 14 22:11:11 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+Fri Sep 27 17:19:39 2013 Koichi Sasada <ko1@atdot.net>
- * enc/ebcdic.h: new dummy encoding EBCDIC-US
- * enc/trans/ebcdic.trans: transcodings between EBCDIC-US
- and iso-8859-1 [with code from Andrea Ribuoli]
- * test/ruby/test_transcode.rb: tests for above
- * tool/transcode_tablegen.rb: additional argument for
- method transcode_tblgen
+ * gc.c (gc_before_sweep): cast to size_t to suppress warnings.
-Mon Dec 14 17:04:14 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri Sep 27 17:07:55 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/lib/socket.rb: use safe navigation operator.
- [fix GH-1142] Patch by @mlarraz
- * lib/drb/extservm.rb: ditto.
- * lib/net/http.rb: ditto.
- * lib/net/http/response.rb: ditto.
- * lib/scanf.rb: ditto.
- * lib/uri/generic.rb: ditto.
+ * gc.c: add some fine-grained profiling codes to tuning marking phase.
+ If you enable RGENGC_PRINT_TICK to 1, then profiling results by RDTSC
+ (on x86/amd64 environment) are printed at last.
+ Thanks Yoshii-san.
-Mon Dec 14 17:03:05 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri Sep 27 16:32:27 2013 Koichi Sasada <ko1@atdot.net>
- * bootstraptest/runner.rb: use safe navigation operator.
- [fix GH-1142] Patch by @mlarraz
- * test/openssl/test_pair.rb: ditto.
- * test/ruby/test_econv.rb: ditto.
- * test/ruby/test_settracefunc.rb: ditto.
- * test/thread/test_queue.rb: ditto.
+ * gc.c: simplify threshold of GC caused by malloc_increase.
+ Now, malloc_limit is increased/decreased by mysterious logic.
+ This fix simplify malloc_limit increase/decrease logic such as:
+ if (malloc_increase > malloc_limit) /* so many malloc */
+ malloc_limit += malloc_limit * (GC_MALLOC_LIMIT_FACTOR-1);
+ else
+ malloc_limit -= malloc_limit * (GC_MALLOC_LIMIT_FACTOR-1)/4;
+ Default value of GC_MALLOC_LIMIT_FACTOR is 1.8.
+ malloc_limit is bounded by GC_MALLOC_LIMIT_MAX (256MB by default).
+ This logic runs at gc_before_sweep(). So there are no effect from
+ caused by lazy sweep. And we can remove malloc_increase2.
-Mon Dec 14 14:33:35 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (HEAP_MIN_SLOTS, FREE_MIN, HEAP_GROWTH_FACTOR): rename to
+ GC_HEAP_MIN_SLOTS, GC_FREE_MIN, GC_HEAP_GROWTH_FACTOR respectively.
+ Check them by `#ifndef' so you can specify these values outside gc.c.
- * lib/xmlrpc.rb: added documentation for parser details.
- [ci skip][fix GH-1124] Patch by @jrafanie
+ * gc.c (ruby_gc_params_t): add initial_malloc_limit_factor and
+ initial_malloc_limit_max.
-Mon Dec 14 11:46:52 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (vm_malloc_prepare, vm_xrealloc): use vm_malloc_increase to
+ add and check malloc_increase.
- * enum.c: fix a typo in documentation.
- [ci skip][fix GH-1140] Patch by @jutaz
- * io.c: ditto.
- * iseq.c: ditto.
- * numeric.c: ditto.
- * process.c: ditto.
- * string.c: ditto.
- * vm_trace.c: ditto.
+Fri Sep 27 01:05:00 2013 Zachary Scott <e@zzak.io>
-Mon Dec 14 11:41:59 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * re.c: [DOC] arguments of Regexp::union receive #to_regexp [Bug #8205]
- * lib/cgi.rb: fix a typo in documentation.
- [ci skip][fix GH-1140] Patch by @jutaz
+Fri Sep 27 00:39:27 2013 Zachary Scott <e@zzak.io>
-Mon Dec 14 11:31:00 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * struct.c: [DOC] grammar of ArgumentError in Struct.new [Bug #8936]
+ Patch by Prathamesh Sonpatki
- * compile.c: fix typos.
- [ci skip][fix GH-1140] Patch by @jutaz
- * dir.c: ditto.
- * gc.c: ditto.
- * io.c: ditto.
- * node.h: ditto.
- * thread_pthread.c: ditto.
- * vm_insnhelper.c: ditto.
- * vsnprintf.c: ditto.
+Thu Sep 26 22:11:56 2013 Zachary Scott <e@zzak.io>
-Mon Dec 14 11:27:01 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c: [DOC] several fixes by @chastell
+ This includes fixing the capitalization of Infinity, return value of
+ example "BigDecimal.new('NaN') == 0.0", and code style in example.
+ [Fixes GH-398] https://github.com/ruby/ruby/pull/398
- * enc/iso_2022_jp.h: fix typos.
- [ci skip][fix GH-1140] Patch by @jutaz
- * enc/utf_16_32.h: ditto.
- * enc/utf_7.h: ditto.
+Thu Sep 26 22:08:11 2013 Zachary Scott <e@zzak.io>
-Mon Dec 14 11:25:57 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/observer.rb: [DOC] syntax improvement in example by @chastell
+ [Fixes GH-400] https://github.com/ruby/ruby/pull/400
- * benchmark/bm_app_aobench.rb: fix typos.
- [ci skip][fix GH-1140] Patch by @jutaz
- * benchmark/bm_vm_thread_pipe.rb: ditto.
+Thu Sep 26 22:03:15 2013 Zachary Scott <e@zzak.io>
-Sun Dec 13 23:46:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/digest/digest.c: [DOC] typo in overview by @chastell
+ [Fixes GH-399] https://github.com/ruby/ruby/pull/399
- * parse.y (trace_lex_state): trace lex_state changes if yydebug is
- set, and send the messages to rb_stdout.
+Thu Sep 26 22:00:42 2013 Zachary Scott <e@zzak.io>
- * parse.y (rb_parser_printf): store YYPRINTF messages per lines
- so that lex_state traces do not mix.
+ * ext/openssl/ossl.c: [DOC] typo in example by @zoranzaric
+ [Fixes GH-401] https://github.com/ruby/ruby/pull/401
- * tool/ytab.sed: add parser argument to yy_stack_print too.
+Thu Sep 26 21:07:49 2013 Akinori MUSHA <knu@iDaemons.org>
-Sun Dec 13 20:41:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-electric.el (ruby-electric-delete-backward-char): Add
+ support for smartparens-mode.
- * parse.y (build_lex_state_name, trace_lex_state): lex_state is
- now bit flags and can be set 2 bits or more.
+ * misc/ruby-electric.el (ruby-electric-cua-replace-region-maybe)
+ (ruby-electric-cua-delete-region-maybe): New functions that
+ combine `ruby-electric-cua-*-region` with
+ `ruby-electric-cua-*-region-p`, using a slightly better way to
+ detect if it is in cua-mode.
-Sun Dec 13 20:26:30 2015 Yuki Yugui Sonoda <yugui@yugui.jp>
+Thu Sep 26 16:51:00 2013 Shota Fukumori <her@sorah.jp>
- * test/ruby/test_syntax.rb: fix typo in test
+ * insns.def (opt_regexpmatch2): Check String#=~ hasn't overridden
+ before calling rb_reg_match().
-Sun Dec 13 20:12:14 2015 Yuki Yugui Sonoda <yugui@yugui.jp>
+ * test/ruby/test_string.rb: Test for above.
- * parse.y (parse_percent): Allow %-literals in labeled arg as
- r51624 did for parentheses.
- Fixes [ruby-core:72084] [Bug #11812].
+ * vm.c (vm_init_redefined_flag): Add BOP flag for String#=~
-Sun Dec 13 20:02:15 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ [ruby-core:57385] [Bug #8953]
- * ChangeLog: fix a typo
+Thu Sep 26 16:43:42 2013 Akinori MUSHA <knu@iDaemons.org>
-Sun Dec 13 19:54:26 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * misc/ruby-electric.el: Avoid use of the interactive function
+ `self-insert-command` which fires `post-self-insert-hook` and
+ `post-command-hook`, to make the ruby-electric commands work
+ nicely with those minor modes that make use of them to do
+ similar input assistance, such as electric-pair-mode,
+ autopair-mode and smartparens-mode.
- * test/lib/envutil.rb: move envutil's assertions under Test::Unit::Assertion.
- * test/lib/test/unit/assertions.rb: ditto.
+Thu Sep 26 16:24:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sun Dec 13 19:24:20 2015 Yuki Yugui Sonoda <yugui@yugui.jp>
+ * insns.def (opt_regexpmatch1): check Regexp#=~ is not defined before
+ calling rb_reg_match()
- * parse.y (lex_state_name): Make it return the correct names.
- Add new names to follow r51617; Indices ffs(2) returns are 1-origin.
+ * test/ruby/test_regexp.rb: add test
-Sun Dec 13 18:40:45 2015 Yuki Yugui Sonoda <yugui@yugui.jp>
+ * vm.c (ruby_vm_redefined_flag): change type to short[]
- * parse.y: debug output of lex_state transition if PARSER_DEBUG
+ * vm.c (vm_redefinition_check_flag): return REGEXP_REDEFINED_OP_FLAG if
+ klass == rb_cRegexp
-Sun Dec 13 18:49:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c (vm_init_redefined_flag): setup BOP flag for Regexp#=~
- * io.c (parse_mode_enc): preserve encoding of mode string in
- warnings.
+ * vm_insnhelper.h: add REGEXP_REDEFINED_OP_FLAG
- * io.c (io_encname_bom_p): check BOM prefix only, not including
- UTF prefix.
+ [ruby-core:57385] [Bug #8953]
- * io.c (parse_mode_enc): warn BOM with non-UTF encoding.
+Thu Sep 26 14:46:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (parse_mode_enc): fix buffer overflow.
+ * gc.c (mark_locations_array): disable AddressSanitizer. based on a
+ patch by halfie (Ruby Guy) at [ruby-core:57372].
+ [ruby-core:56155] [Bug #8680]
-Sun Dec 13 18:35:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 25 17:41:29 2013 Koichi Sasada <ko1@atdot.net>
- * ext/fiddle/function.c (initialize): check all arguments first.
- reported by Marcin 'Icewall' Noga of Cisco Talos.
+ * README.EXT, README.EXT.ja: remove description of RARRAY_PTR()
+ and add a caution of accessing internal data structure directly.
+ Also add a description of rb_ary_store().
+ [Bug #8399]
- * ext/fiddle/conversions.h (PTR2NUM): use signed integer to make
- Fixnum for negative values.
+Wed Sep 25 17:12:08 2013 Koichi Sasada <ko1@atdot.net>
-Sun Dec 13 18:33:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().
+ RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and
+ usecase of this macro is not acquire raw pointer, but acquire
+ read-only pointer. So we rename to better name.
+ RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR()
+ (I expect that nobody use it).
- * pack.c (pack_pack): always check index range against the
- receiver array length, which can be shortened by elements
- conversion. reported by Marcin 'Icewall' Noga of Cisco Talos.
+ * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c,
+ string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c:
+ catch up this change.
-Sun Dec 13 18:28:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 25 16:58:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/psych_emitter.c (start_document): should not exceed
- tags array range.
+ * internal.h (rb_float_value, rb_float_new): move inline functions
+ from ruby/ruby.h.
- * ext/psych/psych_emitter.c (start_document): ensure string before
- encoding conversion.
+ * numeric.c (rb_float_value, rb_float_new): define external functions
+ for extension libraries.
-Sun Dec 13 18:26:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 25 15:37:02 2013 Koichi Sasada <ko1@atdot.net>
- * ext/tk/tkutil/tkutil.c (tk_hash_kv): check types of array
- argument. reported by Marcin 'Icewall' Noga of Cisco Talos.
+ * test/rdoc/test_rdoc_generator_darkfish.rb: add a guard for windows.
- * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): check length of
- argument arrays for each access, as callback methods can modify
- them. reported by Marcin 'Icewall' Noga of Cisco Talos.
+Wed Sep 25 09:53:11 2013 Eric Hodel <drbrain@segment7.net>
- * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): check types of
- argument elements. reported by Marcin 'Icewall' Noga of Cisco
- Talos.
+ * lib/rubygems: Fix CVE-2013-4363. Miscellaneous minor improvements.
-Sun Dec 13 18:19:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rubygems: Tests for the above.
- * ext/win32ole/win32ole.c (ole_vstr2wc): check argument type, vstr
- must be a String here. reported by Marcin 'Icewall' Noga of
- Cisco Talos.
+Tue Sep 24 17:38:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Dec 13 16:41:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_inspect): get rid of out-of-bound access.
- * configure.in (BOOTSTRAPRUBY): make BASERUBY full path before
- building ruby to get rid of unexpectedly invoking built ruby.
- [ruby-core:72065] [Bug #11807]
+ * string.c (rb_str_inspect): when a UTF-16/32 string doesn't have a
+ BOM, inspect as a dummy encoding string.
- * configure.in (BOOTSTRAPRUBY): use MINIRUBY but not BASERUBY
- unless cross compiling. [ruby-core:72065] [Bug #11807]
+Tue Sep 24 17:15:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Dec 13 14:17:19 2015 Akinori MUSHA <knu@iDaemons.org>
+ * enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy.
- * test/test_shellwords.rb (TestShellwords): Add many more tests
- for handling whitespace characters and frozenness.
+ * encoding.c (enc_autoload): keep dummy encodings dummy.
-Sun Dec 13 14:16:09 2015 Akinori MUSHA <knu@iDaemons.org>
+Tue Sep 24 16:41:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/shellwords.rb (Shellwords#shellsplit): Document that this
- method does not treat shell metacharacters as such.
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#write): data size
+ is in bytes, not chars. terminators should be placed automatically.
-Sun Dec 13 12:17:43 2015 Eric Wong <e@80x24.org>
+Tue Sep 24 16:39:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/shellwords.rb (shellescape): duplicate frozen literal
- * test/test_shellwords.rb (test_stringification): new test
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#each_value): encode
+ name.
-Sun Dec 13 11:47:35 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#each_key): ditto.
- * object.c (rb_inspect): check the default internal encoding as
- String#inspect do.
- [ruby-dev:49415] [Bug #11787]
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#export_string):
+ encode to locale encoding if default internal is not set.
-Sun Dec 13 11:38:12 2015 Akinori MUSHA <knu@iDaemons.org>
+Tue Sep 24 16:35:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/shellwords.rb: Turn on frozen-string-literal after fixing
- shellsplit.
+ * ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumKey):
+ size of the name is in WCHARs, not in bytes.
-Sun Dec 13 10:44:44 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+Tue Sep 24 14:07:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * KNOWNBUGS.rb: Fixed typo, made more explicit [ci skip]
+ * gc.c (free_method_cache_entry_i): unused function
-Sun Dec 13 10:26:47 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (rb_free_mc_table): ditto
- * ext/openssl/ossl_ssl.c (ssl_npn_select_cb_common): fix parsing
- protocol list.
- The protocol list from OpenSSL is not null-terminated.
- patched by Kazuki Yamaguchi [Bug #11810] [ruby-core:72082]
+ * internal.h (method_cache_entry_t): unused struct
-Sun Dec 13 06:40:30 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * vm_method.c (verify_method_cache): remove unused variable
- * lib/ostruct.rb: Have OpenStruct#dig raise if argument is not a
- symbol
- nor a string. See [#11762]
+ * vm_method.c (rb_method_entry): ditto
-Sun Dec 13 00:05:42 2015 Shugo Maeda <shugo@ruby-lang.org>
+Tue Sep 24 14:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * vm_insnhelper.c (vm_call_method_missing): method_missing should
- not be refined.
- [ruby-core:72080] [Bug #11809]
+ * class.c (class_alloc): remove mc_tbl
-Sat Dec 12 23:00:17 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (obj_free): ditto
- * ext/nkf/nkf-utf8/nkf.c: Merge nkf 2.1.4.
+ * internal.h (struct rb_classext_struct): ditto
-Sat Dec 12 18:52:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * method.h (rb_method_entry): remove ent param
- * object.c (rb_obj_dig): raise TypeError if an element does not
- have #dig method. [ruby-core:71798] [Bug #11762]
+ * vm_method.c: restore the global method cache. Per class cache tables
+ turned out to be far too slow.
-Sat Dec 12 17:59:07 2015 Yuichiro Kaneko <yui-knk@ruby-lang.org>
+ [ruby-core:57289] [Bug #8930]
- * test/ruby/test_regexp.rb: Add test cases for `$KCODE` and `$=` warning
- [Misc #11770][ruby-dev:49398]
+Tue Sep 24 12:51:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Dec 12 17:11:57 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * ext/win32/lib/win32/registry.rb (Win32::Registry::API): need
+ Constants.
- * doc/NEWS-0.2.2: add description about incompatible change in Hash
- duplicated key overriding policy. [Bug #10315] [Bug #11501]
+ * ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumValue):
+ size of the name is in WCHARs, not in bytes.
-Sat Dec 12 07:44:38 2015 Eric Wong <e@80x24.org>
+Mon Sep 23 22:16:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (do_io_advise): do not raise on ENOSYS
- * test/ruby/test_io.rb (test_advise): do not skip on Errno::ENOSYS
- (test_advise_pipe): ditto
- [ruby-core:72066] [Feature #11806]
+ * enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): Unicode with BOM
+ must be based on big endian variants, so that actual encodings would
+ work. [ruby-core:57318] [Bug #8940]
-Sat Dec 12 07:05:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Sep 23 12:11:26 2013 Masaki Matsushita <glass.saga@gmail.com>
- * enc/windows_1252.c: separate from ISO-8859-1 to fix 0x80..0x9e
- range. [ruby-core:64049] [Bug #10097]
+ * hash.c (env_each_pair): do not call rb_assoc_new() if
+ it isn't needed.
-Fri Dec 11 23:33:40 2015 Yusuke Endoh <mame@ruby-lang.org>
+Mon Sep 23 10:42:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * sample/trick2015/: added the award-winning entries of TRICK 2015.
- See https://github.com/tric/trick2015 for the contest outline.
+ * test/ruby/test_module.rb (TestModule#test_include_toplevel): test
+ for top level main.include. based on a part of the patch by
+ kyrylo at [GH-395].
-Fri Dec 11 17:59:05 2015 Eric Wong <e@80x24.org>
+Mon Sep 23 05:07:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * insns.def (opt_case_dispatch): avoid converting Infinity
- * test/ruby/test_optimization.rb (test_opt_case_dispatch_inf): new
- [ruby-dev:49423] [Bug #11804]'
+ * include/ruby/intern.h (rb_ary_cat): move from internal.h, since it
+ is described in README.EXT.
-Fri Dec 11 16:48:57 2015 Eric Wong <e@80x24.org>
+Sun Sep 22 20:55:20 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * hash.c (rb_num_hash_start): avoid pathological behavior
- [ruby-core:72028] [Feature #11405]
+ * vm_insnhelper.c (vm_make_proc_with_iseq): fix bug message.
+ This is follow up to changes in r42637.
-Fri Dec 11 11:58:46 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Sep 22 20:35:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * NEWS: Mentioned rubygems-2.5.1
+ * ext/-test-/tracepoint/tracepoint.c (Init_tracepoint): prevent from GC.
-Fri Dec 11 11:52:39 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Sep 22 19:00:28 2013 Benoit Daloze <eregontp@gmail.com>
- * lib/rubygems: Update to RubyGems 2.5.1
- * test/rubygems: ditto.
+ * benchmark/bm_app_answer.rb: revert r42990, benchmark scripts should
+ be self-contained and avoid dependencies, especially such small one.
+ See https://github.com/ruby/ruby/pull/393#issuecomment-24861301.
-Fri Dec 11 11:38:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 21 20:11:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_compile_each, ibf_load_object_hash): rehash
- case-dispatch hash to reduce collisions.
- http://d.hatena.ne.jp/ku-ma-me/20151210
+ * process.c (rb_fork_internal): remove cloexec setting on pipes
+ created by rb_cloexec_pipe. patch by normalperson (Eric Wong) at
+ [ruby-core:56523]. [Bug #8769]
-Fri Dec 11 03:44:43 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Sep 21 01:04:25 2013 Zachary Scott <e@zzak.io>
- * object.c (rb_inspect): dump inspected result with rb_str_escape()
- instead of raising Encoding::CompatibilityError. [Feature #11801]
+ * lib/benchmark.rb: [DOC] grammar of Benchmark#bm [Bug #8888]
+ Patch by Prathamesh Sonpatki
- * string.c (rb_str_escape): added to dump given string like
- rb_str_inspect without quotes and always dump in US-ASCII
- like rb_str_dump.
+Sat Sep 21 00:50:02 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 14:59:59 2015 Koichi Sasada <ko1@atdot.net>
+ * enumerator.c: [DOC] Enumerator#each arguments documentation [GH-388]
+ Patch by @kachick https://github.com/ruby/ruby/pull/388
- * test/ruby/test_gc.rb (test_expand_heap): relax condition (1->2).
+Sat Sep 21 00:49:16 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 14:15:59 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * enum.c: [DOC] Enumerable#to_a accepts arguments [GH-388]
+ Patch by @kachick https://github.com/ruby/ruby/pull/388
- * cont.c: fix a double word typo.
- [Bug #11313][ruby-core:69749]
+Sat Sep 21 00:47:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Dec 10 14:13:34 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * string.c (rb_str_conv_enc_opts): make sure to scan coderange to get
+ rid of unnecessary conversion.
- * ext/tk/lib/multi-tk.rb: fix typos.
- [Bug #11764][ruby-core:71800]
+Sat Sep 21 00:21:08 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 11:33:34 2015 Eric Wong <e@80x24.org>
+ * ext/openssl/lib/openssl/ssl.rb: [DOC] Document OpenSSL::SSLServer
+ Based on a patch by Rafal Lisowski [Bug #8758]
- * compile.c (iseq_compile_each): reduce needless rb_str_dup
- [ruby-core:72018] <5668DB6E.8000101@ruby-lang.org>
+Fri Sep 20 23:54:03 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 09:32:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/gserver.rb: [DOC] correct gserver.rb license [Bug #8913]
- * lib/mkmf.rb, lib/shellwords.rb: disable frozen-string-literal.
- [ruby-core:72011] [Bug #11800]
+Fri Sep 20 23:48:34 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 06:33:39 2015 Eric Wong <e@80x24.org>
+ * ext/psych/yaml/yaml.h: [DOC] merge upstream typo fix by @GreenGeorge
+ https://github.com/tenderlove/psych/pull/161
- * marshal.c (memsize_dump_arg): remove NULL check
- (memsize_load_arg): ditto
+Fri Sep 20 23:37:40 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 05:53:18 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/securerandom.rb: [DOC] SecureRandom.hex length argument
+ [Fixes GH-394] Patch by @avdi https://github.com/ruby/ruby/pull/394
- * tool/mkconfig.rb: rbconfig must not be frozen-string-literal to
- expand CONFIG hash. [ruby-core:72006] [Bug #11798]
+Fri Sep 20 23:34:48 2013 Zachary Scott <e@zzak.io>
-Thu Dec 10 05:03:51 2015 Eric Wong <e@80x24.org>
+ * benchmark/bm_app_answer.rb: removed duplicate code [Fixes GH-393]
+ Patch by @gouravtiwari https://github.com/ruby/ruby/pull/393
- * ext/socket/ifaddr.c (ifaddr_mark): remove empty function
- (ifaddr_type): pass zero to rb_data_type_t.function.dmark
+Fri Sep 20 23:24:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Dec 10 04:49:16 2015 Eric Wong <e@80x24.org>
+ * common.mk (btest, btest-ruby, test-knownbug): add $(RUN_OPTS) to
+ ruby to be run, so that tests are runnable before making exts.
- * proc.c (bm_free): remove, use default free
- (method_data_type): use RUBY_TYPED_DEFAULT_FREE
+ * common.mk (test-sample): ditto, and use $(MINIRUBY) as rubytest.rb
+ does not need extension libraries.
-Thu Dec 10 02:01:41 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/rubytest.rb: pass $(RUN_OPTS) to testing ruby using --run-opt.
- * compile.c (iseq_compile_each): do not add debug information
- without --debug or --debug=frozen-string-literal option
- because String#dup slows down with debug information.
- [Feature #11725]
+Fri Sep 20 15:01:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: apply about it.
+ * parse.y (intern_str): sigil only names are junk, at least one
+ identifier character is needed. [ruby-dev:47723] [Bug #8928]
- * test/ruby/test_rubyoptions.rb: catch up this fix with refactoring.
+ * parse.y (rb_enc_symname_type): fix out of bound access.
-Thu Dec 10 00:06:56 2015 Koichi Sasada <ko1@atdot.net>
+Fri Sep 20 14:14:32 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c: rename methods
- RubyVM::InstructionSequence#to_binary_format -> #to_binary
- RubyVM::InstructionSequence.from_binary_format -> .load_from_binary
- RubyVM::InstructionSequence.from_binary_format_extra_data ->
- .load_from_binary_extra_data
+ * ext/-test-/printf/printf.c (printf_test_call): Fix an end of buffer
+ argument.
- * iseq.c: fix document of iseq.to_binary.
- [Fix GH-1134]
+Thu Sep 19 16:59:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * sample/iseq_loader.rb: catch up this change.
+ * parse.y (lambda): adjust position to the beginning of the block.
- * test/lib/iseq_loader_checker.rb: ditto.
+Thu Sep 19 16:25:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 9 17:02:03 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vsnprintf.c (BSD_vfprintf): initialize cp so that size is 0 in the
+ commented case. fix an accidental bug at r16716.
- * regparse.h (SET_NTYPE): get rid of breaking strict aliasing.
- patch by Zarko Todorovski in [ruby-core:71953]. [Bug #11790]
+Thu Sep 19 14:33:14 2013 Koichi Sasada <ko1@atdot.net>
-Wed Dec 9 16:10:37 2015 Koichi Sasada <ko1@atdot.net>
+ * NEWS: add a news for r42974.
- * vm.c (rb_vm_cref_in_context): Module#define_method in non-class
- expression should be public.
- [Bug #11754]
+Thu Sep 19 14:12:02 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_method.rb: add a test.
+ * include/ruby/ruby.h: make Symbol objects frozen.
+ [Feature #8906]
+ I want to freeze this good day, too.
-Wed Dec 9 14:45:27 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_eval.rb: catch up this change.
- * gc.c (gc_mark_stacked_objects): fix typo.
- reported by XIE Zhibang. [Bug #11763]
+ * test/ruby/test_symbol.rb: add a test to check frozen symbols.
-Wed Dec 9 14:37:51 2015 Shugo Maeda <shugo@ruby-lang.org>
+Thu Sep 19 09:11:33 2013 Eric Hodel <drbrain@segment7.net>
- * doc/syntax/refinements.rdoc: remove outdated description.
+ * NEWS: Update for RDoc 4.1.0.preview.1 and RubyGems 2.2.0.preview.1
-Wed Dec 9 09:58:09 2015 Koichi Sasada <ko1@atdot.net>
+Thu Sep 19 08:59:41 2013 Eric Hodel <drbrain@segment7.net>
- * ext/**/*.c (*_memsize): same as r52986 for extensions.
+ * lib/rdoc/markdown/literals_1_9.rb: Fix trailing whitespace.
-Wed Dec 9 09:46:19 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ Previously kpeg (which generates this file) added trailing
+ whitespace, but this bug is now fixed.
- * .gitignore: ignored ISeq binary format.
+ * lib/rdoc/markdown.rb: ditto.
-Wed Dec 9 09:34:41 2015 Koichi Sasada <ko1@atdot.net>
+Thu Sep 19 08:33:14 2013 Eric Hodel <drbrain@segment7.net>
- * *.c (*_memsize): do not check ptr.
- NULL checking is finished Before call of memsize functions.
- See r52979.
+ * lib/rdoc: Update to RDoc 4.1.0.preview.1
-Wed Dec 9 09:25:29 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ RDoc 4.1.0 contains a number of enhancements including a new default
+ style and accessibility support. You can see the changelog here:
- * test/net/smtp/test_response.rb: use Test::Unit. We should use Test::Unit
- without rubygems and rdoc.
+ https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
-Wed Dec 9 06:26:23 2015 Colin Kelley <colindkelley@gmail.com>
+ * test/rdoc: ditto.
- * lib/uri/generic.rb: enable frozen_string_literal
- (split_userinfo): remove explicit .freeze for string literals
- (check_path): ditto
- (query): ditto
- (fragment): ditto
- (to_s): ditto
- [ruby-core:71910] [Bug #11759]
+Thu Sep 19 07:16:26 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Wed Dec 9 06:25:47 2015 Eric Wong <e@80x24.org>
+ * ext/psych/lib/psych.rb: updating Psych version
- * test/uri/test_generic.rb (to_s): new test
- [ruby-core:71820]
+ * ext/psych/psych.gemspec: ditto
-Wed Dec 9 02:18:52 2015 Koichi Sasada <ko1@atdot.net>
+Thu Sep 19 06:39:40 2013 Eric Hodel <drbrain@segment7.net>
- * compile.c (ibf_dump_memsize): should check NULL.
+ * lib/rubygems/dependency_resolver.rb: Switch the iterative resolver
+ algorithm from recursive to iterative to avoid possible
+ SystemStackError.
-Wed Dec 9 01:46:35 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Sep 19 06:29:30 2013 Eric Hodel <drbrain@segment7.net>
- * string.c (rb_str_init): now accepts new option parameter `encoding'.
- [Feature #11785]
+ * lib/rubygems: Update to RubyGems 2.2.0.preview.1
-Wed Dec 9 00:52:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This brings several new features to RubyGems summarized here:
- * file.c (rb_stat_wr, rb_stat_ww): call get_stat only once and
- reduce checking struct. patch by Yuki Kurihara in
- [ruby-core:71949]. [Misc #11789]
+ https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt
-Wed Dec 9 00:24:33 2015 Koichi Sasada <ko1@atdot.net>
+ * test/rubygems: ditto.
- * compile.c (iseq_ibf_dump): dump extra data just string length.
+Wed Sep 18 23:14:58 2013 Masaki Matsushita <glass.saga@gmail.com>
- * sample/iseq_loader.rb: add using
- RubyVM::InstructionSequence.from_binary_format_extra_data method
- (commented out).
+ * string.c (rb_str_enumerate_lines): make String#each_line and
+ #lines not raise invalid byte sequence error when it is called
+ with an argument. The patch also causes performance improvement.
+ [ruby-dev:47549] [Bug #8698]
-Mon Dec 9 00:21:19 2015 Yuki Nishijima <mail@yukinishijima.net>
+ * test/ruby/test_m17n_comb.rb (test_str_each_line): remove
+ assertions which check that String#each_line and #lines will
+ raise an error if the receiver includes invalid byte sequence.
- * gems/bundled_gems: Upgrade the did_you_mean gem to 1.0.0.rc1
+Wed Sep 18 16:32:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 9 00:17:49 2015 Koichi Sasada <ko1@atdot.net>
+ * proc.c (mnew_from_me): allocate structs after allocated wrapper
+ object successfully, to get rid of potential memory leak.
- * compile.c (ibf_load_setup): cast to int.
+Tue Sep 17 15:54:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 9 00:13:09 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/shell/command-processor.rb (Shell::CommandProcessor#find_system_command):
+ return executable file only, should ignore directories and
+ unexecutable files. [ruby-core:57235] [Bug #8918]
- * compile.c (ibf_setup_load): rename to ibf_load_setup().
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_throw):
+ assertion for throw. MiniTest::Assertions#assert_throws discards
+ the caught value.
- * compile.c (iseq_load_setup): check binary format.
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_nothing_thrown):
+ returns the result of the given block.
-Tue Dec 8 23:30:07 2015 Naohisa Goto <ngotogenome@gmail.com>
+Tue Sep 17 12:55:58 2013 Eric Hodel <drbrain@segment7.net>
- * test/io/console/test_io_console.rb (run_pty): Avoid waiting twice
- for a process. Fix Errno::ECHILD in TestIO_Console#test_close and
- TestIO_Console#test_sync.
+ * doc/regexp.rdoc: [DOC] Replace paragraphs in verbatim sections with
+ plain paragraphs to improve readability as ri and HTML.
-Tue Dec 8 23:05:47 2015 Koichi Sasada <ko1@atdot.net>
+Mon Sep 16 07:32:35 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * compile.c (iseq_ibf_dump): fix for clang type checker.
+ * complex.c: removed meaningless lines.
+ * rational.c: ditto.
-Tue Dec 8 23:04:02 2015 Koichi Sasada <ko1@atdot.net>
+Mon Sep 16 00:44:23 2013 Masaki Matsushita <glass.saga@gmail.com>
- * iseq.c (iseq_s_load): fix mysterious bug.
+ * ext/socket/mkconstants.rb: define MSG_FASTOPEN.
+ [ruby-core:57138] [Feature #8897]
-Tue Dec 8 22:31:58 2015 Koichi Sasada <ko1@atdot.net>
+Sun Sep 15 13:31:23 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * introduce new ISeq binary format serializer/de-serializer
- and a pre-compilation/runtime loader sample.
- [Feature #11788]
+ * rational.c (nurat_div): reverted r28844, r28886 and r28887.
+ REASON: Nobuyoshi Nakada <nobu@ruby-lang.org>'s commits are buggy.
+ So Rational#/ may produce exact number with inexact number.
+ Moreover, without reducing.
+ REALLY NONSENSE COMMITS.
+ A bug report by me [ruby-dev:44710] is also caused by this behavior.
+ Kenta Murata <mrkn@mrkn.jp> patched it up.
+ But he did not fix the origin.
+ Today, the bug is still alive in ruby 1.9.3 and 2.0.0.
- * iseq.c: add new methods:
- * RubyVM::InstructionSequence#to_binary_format(extra_data = nil)
- * RubyVM::InstructionSequence.from_binary_format(binary)
- * RubyVM::InstructionSequence.from_binary_format_extra_data(binary)
+Sat Sep 14 06:08:10 2013 Eric Hodel <drbrain@segment7.net>
- * compile.c: implement body of this new feature.
+ * dir.c (dir_s_glob): [DOC] Improve wording and layout.
- * load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq):
- call RubyVM::InstructionSequence.load_iseq(fname) with
- loading script name if this method is defined.
+ * dir.c (file_s_fnmatch): ditto.
- We can return any ISeq object as a result value.
- Otherwise loading will be continue as usual.
+ * dir.c (Init_Dir): [DOC] Document File::Constants::FNM_XXX
+ constants. (These won't show up in RDoc until a new RDoc is
+ imported.)
- This interface is not matured and is not extensible.
- So that we don't guarantee the future compatibility of this method.
- Basically, you shouldn't use this method.
+Thu Sep 12 14:58:58 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions)
- from iseq.c.
+ * lib/uri/generic.rb (URI::Generic.find_proxy): return nil if
+ http_proxy environment variable is empty string.
+ [ruby-core:57140] [Bug #8898]
- * encoding.c (rb_data_is_encoding), internal.h: added.
+Fri Sep 13 10:40:28 2013 Eric Hodel <drbrain@segment7.net>
- * vm_core.h: add several supports for lazy load.
- * add USE_LAZY_LOAD macro to specify enable or disable of
- this feature.
- * add several fields to rb_iseq_t.
- * introduce new macro rb_iseq_check().
+ * lib/rubygems: Update to RubyGems 2.1.3
- * insns.def: some check for lazy loading feature.
+ Fixed installing platform gems
- * vm_insnhelper.c: ditto.
+ Restored concurrent requires
- * proc.c: ditto.
+ Fixed installing gems with extensions with --install-dir
- * vm.c: ditto.
+ Fixed `gem fetch -v` to install the latest version
- * test/lib/iseq_loader_checker.rb: enabled iff suitable
- environment variables are provided.
+ Fixed installing gems with "./" in their files entries
- * test/runner.rb: enable lib/iseq_loader_checker.rb.
+ * test/rubygems/test_gem_package.rb: Tests for the above.
- * sample/iseq_loader.rb: add sample compiler and loader.
+ * NEWS: Updated for RubyGems 2.1.3
- $ ruby sample/iseq_loader.rb [dir]
+Thu Sep 12 22:40:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- will compile all ruby scripts in [dir].
- With default setting, this compile creates *.rb.yarb files
- in same directory of target .rb scripts.
+ * configure.in (RUBY_CHECK_SIGNEDNESS): macro to check signedness of a
+ type.
- $ ruby -r sample/iseq_loader.rb [app]
+ * configure.in (size_t): must be unsigned.
+ [ruby-core:57149] [Feature #8890]
- will run with enable to load compiled binary data.
+Thu Sep 12 22:37:08 2013 Anton Ovchinnikov <revolver112@gmail.com>
-Tue Dec 8 21:21:16 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * ext/bigdecimal/bigdecimal.c, ext/digest/md5/md5.c,
+ ext/json/fbuffer/fbuffer.h, ext/json/generator/generator.c:
+ Eliminate less-than-zero checks for unsigned variables.
+ According to section 4.1.5 of C89 standard, size_t is an unsigned
+ type. These checks were found with 'cppcheck' static analysis tool.
+ [ruby-core:57117] [Feature #8890]
- * NEWS: mention about Enumerator::Lazy#grep_v.
- [ruby-core:71845] [Feature #11773]
+Thu Sep 12 21:35:46 2013 Naohisa Goto <ngotogenome@gmail.com>
-Tue Dec 8 17:36:36 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * Makefile.in (libruby-static.a): change LDFLAGS order. LDFLAGS may
+ include library path that should be specified before LIBS.
+ [ruby-dev:47707] [Bug #8901]
- * string.c: removed unused variable
+Thu Sep 12 20:07:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 8 16:23:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vsnprintf.c (MAXEXP, MAXFRACT): calculate depending on constants in
+ float.h.
- * enumerator.c (lazy_grep_v): add Enumerator::Lazy#grep_v as well
- as Enumerable, to enumerate lazily.
- [ruby-core:71845] [Feature #11773]
+ * vsnprintf.c (BSD_vfprintf): limit length for cvt() to get rid of
+ buffer overflow. [ruby-core:57023] [Bug #8864]
-Tue Dec 8 14:27:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vsnprintf.c (exponent): make expbuf size more precise.
- * error.c (name_err_local_variables): new method
- NameError#local_variables for internal use only.
- [Feature #11777]
+Wed Sep 11 17:30:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 8 14:20:38 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in (RUNRUBY): append -- only after runruby.rb, not
+ cross-compiling baseruby, so that $(RUN_OPT) can be command line
+ options. [ruby-dev:47703] [Bug #8893]
- * marshal.c (w_objivar): skip internal instance variables in
- T_OBJECT too.
+Wed Sep 11 07:55:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Dec 8 12:58:04 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
+ an exception even if uses on trap. [Bug #8891]
- * test/io/console/test_io_console.rb (test_getpass): s.getpass
- should be tested. Narrow ensure block. This reverts r52911.
- [Bug #11780] [ruby-dev:49412]
+Tue Sep 10 14:37:01 2013 Shota Fukumori <sorah@tubusu.net>
-Tue Dec 8 10:40:21 2015 Eric Wong <e@80x24.org>
+ * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
+ it is nil. [Bug #8884] [ruby-core:57094]
- * benchmark/bm_vm2_case_lit.rb: new benchmark
- * compile.c (case_when_optimizable_literal): add nil/true/false
- * insns.def (opt_case_dispatch): ditto
- * vm.c (vm_redefinition_check_flag): ditto
- * vm.c (vm_init_redefined_flag): ditto
- * vm_core.h: ditto
- * object.c (InitVM_Object): define === explicitly for nil/true/false
- * test/ruby/test_case.rb (test_deoptimize_nil): new test
- * test/ruby/test_optimization.rb (test_opt_case_dispatch): update
- (test_eqq): new test
- [ruby-core:71923] [Feature #11769]
- Original patch by Aaron Patterson <tenderlove@ruby-lang.org>
+ * test/ruby/test_backtrace.rb (test_caller_with_nil_length):
+ Test for above.
-Tue Dec 8 10:19:02 2015 Jake Worth <jakeworth82@gmail.com>
+Tue Sep 10 12:39:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/optparse.rb: fix double word typo in the document.
- [Misc #10608] [Fix GH-1126]
+ * class.c (method_entry_i): should exclude refined methods from
+ instance method list. [ruby-core:57080] [Bug #8881]
-Tue Dec 8 09:03:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Sep 10 12:05:04 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/date/date_core.c (d_lite_lshift): should check the argument
- before negation.
+ * io.c (rb_f_printf): [DOC] add missing parenthesis in rdoc.
-Tue Dec 8 08:56:16 2015 Eric Wong <e@80x24.org>
+Tue Sep 10 10:08:00 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * insns.def (opt_case_dispatch): check Float#=== redefinition
- * test/ruby/test_optimization.rb (test_opt_case_dispatch): new
- [ruby-core:71920] [Bug #11784]
+ * NEWS: Update RubyGems note.
-Tue Dec 8 03:56:05 2015 Koichi Sasada <ko1@atdot.net>
+Tue Sep 10 09:51:22 2013 Eric Hodel <drbrain@segment7.net>
- * test/lib/iseq_loader_checker.rb: add iseq dumper/loader checker.
- If you enable this checker (remove `#' in test/runner.rb),
- you can see comparison results between an original iseq disassembed
- result and dumped and loaded iseq disassembed result.
+ * lib/rubygems: Update to RubyGems 2.1.0. Fixes CVE-2013-4287.
- There are several bugs around there, because of inexact stack depth
- calculation. Now, I leave these bugs because they are not critical
- and difficult to solve completely.
+ See http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html
+ for CVE information.
- * test/runner.rb: require test/lib/iseq_loader_checker.rb but
- disabled at default (commented out).
+ See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.0+%2F+2013-09-09
+ for release notes.
-Tue Dec 8 03:45:47 2015 Eric Wong <e@80x24.org>
+ * test/rubygems: Tests for the above.
- * doc/extension.rdoc: warn about kwargs performance in C
- [Feature #11339] [ci skip]
+Mon Sep 9 21:31:45 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 8 03:44:51 2015 Koichi Sasada <ko1@atdot.net>
+ * process.c: Remove spaces between SI prefix and unit to follow
+ SI brochure.
+ http://www.bipm.org/en/si/si_brochure/
+ https://www.nmij.jp/library/units/si/
- * iseq.c (iseq_load): disable peephole optimization option
- because apply it multiple times change the sequence.
- (iseq != peephole_optimize(load(iseq.to_a)))
+ * time.c: Ditto.
-Tue Dec 8 03:43:21 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/socket/ancdata.c: Ditto.
- * compile.c (rb_iseq_build_from_ary): do not allocate table
- if table_size is 0.
+Mon Sep 9 16:55:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 8 03:30:34 2015 Eric Wong <e@80x24.org>
+ * vm_method.c (rb_add_refined_method_entry): clear cache in the
+ refined class since refining a method entry is modifying the class.
+ [ruby-core:57079] [Bug #8880]
- * ext/socket/unixsocket.c (unix_send_io): document args
- (unix_recv_io): ditto
- * test/socket/test_unix.rb (test_fd_passing_class_mode): added
+Mon Sep 9 09:14:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 08 02:21:35 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/rbinstall.rb (Gem::Specification#initialize): default date to
+ RUBY_RELEASE_DATE. [ruby-core:57072] [Bug #8878]
- * iseq.c (iseq_translate): at the end of constructing an iseq,
- call RubyVM::InstructionSequence.translate(iseq) if this method
- is defined. If the return value is also an object of
- RubyVM::InstructionSequence, then use it instead of created one.
+ * tool/rbinstall.rb (Gem::Specification#to_ruby): add date.
- For example, this method is useful to test iseq dumper/loader
- such as RubyVM::InstructionSequence#to_a and rb_iseq_load().
+Sun Sep 8 16:01:54 2013 Tanaka Akira <akr@fsij.org>
- Because this method is for such internal experimental usage,
- the interface is not matured. For example, this interface has
- no extensibility. Two or more translators can not run
- simultaneously.
+ * rational.c (f_gcd): Relax the condition to use GMP.
- So that we don't guarantee future compatibility of this method.
- Basically, do not use this method.
+Sun Sep 8 13:56:38 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Tue Dec 8 01:57:13 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * ext/win32ole/win32ole.c (folevariant_initialize): check type of
+ element of array.
- * ext/psych/*: update psych to 2.0.16
- * test/psych/*: ditto
+ * test/win32ole/test_win32ole_variant.rb (test_s_new_ary): ditto.
-Mon Dec 7 23:45:20 2015 Koichi Sasada <ko1@atdot.net>
+Sat Sep 7 21:33:10 2013 Tanaka Akira <akr@fsij.org>
- * string.c: introduce String#+@ and String#-@ to control
- String mutability.
- [Feature #11782]
+ * math.c (math_log): Test the sign for bignums.
+ (math_log2): Ditto.
+ (math_log10): Ditto.
-Mon Dec 7 23:39:49 2015 Ben Miller <bjmllr@gmail.com>
+Sat Sep 7 20:25:47 2013 Tanaka Akira <akr@fsij.org>
- * parse.y: add heredoc <<~ syntax. [Feature #9098]
+ * math.c (math_log): Support bignums bigger than 2**1024.
+ (math_log2): Ditto.
+ (math_log10): Ditto.
-Mon Dec 7 23:06:16 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Sat Sep 7 15:36:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * prelude.rb (IO#read_nonblock): [DOC] add missing options to
- call-seq. [ruby-core:71627] [Bug #11730]
+ * vm_eval.c (vm_call0): fix prototype, the id parameter should be of
+ type ID, not VALUE
-Mon Dec 7 15:50:50 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * vm_insnhelper.c (check_match): the rb_funcall family of functions
+ does not care about refinements. We need to use
+ rb_method_entry_with_refinements instead to call === with
+ refinements. Thanks to Jon Conley for reporting this bug.
+ [ruby-core:57051] [Bug #8872]
- * .gitignore: added cygruby*.def for Cygwin
+ * test/ruby/test_refinement.rb: add test
-Sun Dec 6 19:52:31 2015 Eric Wong <e@80x24.org>
+Sat Sep 7 13:49:40 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * include/ruby/intern.h (rb_autoload): deprecate
- * internal.h (rb_autoload_str): declare
- * load.c (rb_mod_autoload): use rb_autoload_str
- * variable.c (rb_autoload): become compatibility wrapper
- (rb_autoload_str): hoisted out from old rb_autoload
- [ruby-core:71369] [Feature #11664]
+ * variable.c (classname): the name of class that has
+ non class id should not be nil. This bug was introduced
+ in r36577.
-Sun Dec 6 18:25:22 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/thread/test_cv.rb: test for change.
- * test/webrick/test_cgi.rb (TestWEBrickCGI#test_cgi): gave up the test
- of binary path info test on Windows because the test had passed
- occasionally as the comment said.
+Sat Sep 7 13:29:22 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sun Dec 6 15:25:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/find.rb (Find.find): respect the encodings of arguments.
+ [ruby-dev:47530] [Feature #8657]
- * ext/io/console/console.c (console_getpass): add IO#getpass
- method.
+ * test/test_find.rb: add tests.
-Sun Dec 6 08:39:05 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Sep 7 10:40:32 2013 Tanaka Akira <akr@fsij.org>
- * ext/json/json.gemspec: bump version to json 1.8.3. CRuby already contained
- upstream changes.
+ * ext/socket/mkconstants.rb (TCP_FASTOPEN): Defined for TCP fast open.
+ [ruby-core:57048] [Feature #8871] patch by Masaki Matsushita.
- https://github.com/ruby/ruby/commit/4d059bf9f5f10f3d3088de49fc87e5555db7770d
- https://github.com/flori/json/commit/d4c99de78905d96c3f301f48b2c789943bb3f098
+Fri Sep 6 23:53:31 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/json/lib/json/version.rb: ditto.
+ * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't
+ require extension libraries. The patch is from nobu
+ (Nobuyoshi Nakada).
-Sat Dec 5 17:48:25 2015 Lars Kanis <lars@greiz-reinsdorf.de>
+ * ext/thread/extconf.rb: for build ext/thread/thread.c.
- * tool/fake.rb: Fix cross build when srcdir is an absolute path.
+ * include/ruby/intern.h: ditto.
- * Makefile.in: PREP dependency is needed when cross build too, not
- "-r$(arch)-fake" to be used before created. [Fix GH-1125]
+ * thread.c: ditto.
-Sat Dec 5 17:26:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/thread.rb: removed and replaced by ext/thread/thread.c.
- * hash.c (env_str_new, env_path_str_new): make default string
- UTF-8 for the case conversion is not possible. [Bug #8822]
+ * ext/thread/thread.c: Queue, SizedQueue and ConditionVariable
+ implementations in C. This patch is based on patches from panaggio
+ (Ricardo Panaggio) and funny_falcon (Yura Sokolov) and ko1
+ (Koichi Sasada). [ruby-core:31513] [Feature #3620]
- * hash.c (get_env_cstr): convert non-ASCII string to UTF-8 string.
+ * test/thread/test_queue.rb (test_queue_thread_raise): add a test for
+ ensuring that killed thread should be removed from waiting threads.
+ It is based on a code by ko1 (Koichi Sasada). [ruby-core:45950]
- * hash.c (ruby_setenv): use wide char version to put environment
- variable to deal with non-ASCII value.
+Fri Sep 6 22:47:12 2013 Tanaka Akira <akr@fsij.org>
-Sat Dec 5 09:56:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: Define ac_cv_func_clock_getres to yes for mingw*.
- * ruby_atomic.h (ATOMIC_CAS): old value to be swapped should be
- same as the destination. immediate value may need type
- promotion.
+Fri Sep 6 21:04:10 2013 Tanaka Akira <akr@fsij.org>
- * ruby_atomic.h (ATOMIC_SIZE_CAS): fix the argument order of
- InterlockedCompareExchange64. new value and then old value is
- the last.
+ * rational.c: Include gmp.h if GMP is used.
+ (GMP_GCD_DIGITS): New macro.
+ (rb_gcd_gmp): New function.
+ (f_gcd_normal): Renamed from f_gcd.
+ (rb_gcd_normal): New function.
+ (f_gcd): Invoke rb_gcd_gmp or f_gcd_normal.
-Sat Dec 5 09:23:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (rb_gcd_normal): Declared.
+ (rb_gcd_gmp): Ditto.
- * random.c (fill_random_seed): fix the size to be filled, not the
- size of element, but the whole size of array.
+ * ext/-test-/rational: New directory.
-Sat Dec 5 06:03:54 2015 Eric Wong <e@80x24.org>
+ * test/-ext-/rational: New directory.
- * vm.c (ruby_vm_verbose_ptr): make static
- (ruby_vm_debug_ptr): ditto
+Fri Sep 6 14:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Dec 5 00:56:29 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * win32/win32.c (clock_getres): required as well as clock_gettime().
+ [ruby-dev:47699] [Bug #8869]
- * include/ruby/ruby.h (RB_OBJ_TAINT): follow-up of r52881.
- Turn into void expression not to use unexpected result.
- Fix "operands have incompatible types" error with
- Oracle Solaris Studio 12.x on Solaris.
+Fri Sep 6 11:45:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 4 19:52:52 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * transcode.c (rb_econv_append): new function to append a string data
+ with converting its encoding. split from rb_econv_substr_append.
- * enc/iso_8859_13.c: Added three missing lower/upper-case
- character pairs (from Kimihito Matsui)
+Fri Sep 6 02:37:22 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Fri Dec 4 18:57:57 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: use double quotes when
+ strings start with special characters.
+ https://github.com/tenderlove/psych/issues/157
- * enc/iso_8859_4.c: Added missing lower/upper-case character
- pair (U+014A and U+014B, LATIN CAPITAL/SMALL LETTER ENG)
- (from Kimihito Matsui)
+ * test/psych/test_string.rb: test for change.
-Fri Dec 4 16:48:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 6 00:05:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_obj_as_string): fstring should not be infected.
- re-apply r52872 and fix a typo.
- TODO: other frozen strings also may not be.
+ * class.c (rewrite_cref_stack): remove recursion.
-Fri Dec 4 15:21:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Sep 5 18:05:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4).
- this version includes #1396, #1397, #1398, #1399
- * test/rubygems: ditto.
+ * string.c (fstring_cmp): take string encoding into account when
+ comparing fstrings [ruby-core:57037] [Bug #8866]
-Fri Dec 4 11:22:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_string.rb: add test
- * thread.c (rb_thread_setname): name must be ascii-compatible, as
- pthread APIs do not accept legacy wide char strings.
+Thu Sep 5 17:25:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Dec 3 15:39:21 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * string.c (rb_fstring, rb_str_free): use st_data_t instead of VALUE.
- * lib/scanf.rb: fixed double words typo.
- [ci skip][fix GH-1123] Patch by @jwworth
+ * string.c (rb_fstring): get rid of duplicating already frozen object.
-Thu Dec 3 15:37:56 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Sep 5 14:01:22 2013 Eric Hodel <drbrain@segment7.net>
- * test/ruby/test_mixed_unicode_escapes.rb: fixed typo.
- [fix GH-1122] Patch by @davydovanton
- * test/ruby/test_object.rb: ditto.
- * test/socket/test_tcp.rb: ditto.
+ * lib/optparse.rb: The Integer acceptable now allows binary and
+ hexadecimal numbers per the documentation. [ruby-trunk - Bug #8865]
-Thu Dec 3 15:33:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ DecimalInteger, OctalInteger, DecimalNumeric now validate their input
+ before converting to a number. [ruby-trunk - Bug #8865]
- * sprintf.c (rb_str_format): fix wrong shifting position in
- Rational conversion when not at the beginning of the result.
- [ruby-core:71806] [Bug #11766]
+ * test/optparse/test_acceptable.rb: Tests for the above, tests for all
+ numeric acceptables for existing behavior.
-Thu Dec 3 14:22:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Sep 5 13:49:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * range.c (range_to_s): should be infected by the receiver.
- str2 infects by appending. [ruby-core:71811] [Bug #11767]
+ * include/ruby/ruby.h: add RSTRING_FSTR flag
-Thu Dec 3 11:57:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: add rb_fstring() prototype
- * configure.in: separate SET_CURRENT_THREAD_NAME, which can set
- the name of current thread only, and SET_ANOTHER_THREAD_NAME,
- which can set the name of other threads.
+ * string.c (rb_fstring): deduplicate frozen string literals
- * thread.c (rb_thread_setname): use SET_ANOTHER_THREAD_NAME. OS X
- is not possible to set another thread name.
+ * string.c (rb_str_free): delete fstrings from frozen_strings table when
+ they are GC'd
- * thread_pthread.c (native_set_thread_name, thread_timer): use
- SET_CURRENT_THREAD_NAME.
+ * string.c (Init_String): initialize frozen_strings table
-Wed Dec 02 22:57:46 2015 Koichi Sasada <ko1@atdot.net>
+Thu Sep 5 12:48:00 2013 Kenta Murata <mrkn@cookpad.com>
- * vm_core.h, iseq.h: remove rb_iseq_t::variable_body.
- Fields in rb_iseq_t::variable_body are contained by
- rb_iseq_t::body::mark_ary (hidden Array object).
+ * configure.in (with_gmp): set with_gmp no if it is empty.
- Index 0 to 2 of mark_ary are reserved by these objects.
+Thu Sep 5 10:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * iseq.c: catch up this fix.
+ * vm_insnhelper.c (vm_getivar): use class sequence to check class
+ identity, instead of pointer + vm state
- * compile.c (rb_iseq_original_iseq): trivial rewrite.
+ * vm_insnhelper.c (vm_setivar): ditto
-Wed Dec 2 17:19:02 2015 Koichi Sasada <ko1@atdot.net>
+Thu Sep 5 08:20:58 2013 Tanaka Akira <akr@fsij.org>
- * iseq.h: introduce ISEQ_ORIGINAL_ISEQ() and
- ISEQ_ORIGINAL_ISEQ_ALLOC() macro.
+ * bignum.c (GMP_DIV_DIGITS): New macro.
+ (bary_divmod_gmp): New function.
+ (rb_big_divrem_gmp): Ditto.
+ (bary_divmod_branch): Ditto.
+ (bary_divmod): Use bary_divmod_branch.
+ (bigdivrem): Ditto.
- * compile.c: use them to access original iseq buffer.
+ * internal.h (rb_big_divrem_gmp): Declared.
- * iseq.c: ditto.
+Thu Sep 5 06:22:42 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bary_divmod_normal): Reduce temporary array allocations.
+
+Thu Sep 5 02:17:06 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_big_divrem_normal): Add GC guards.
+
+Thu Sep 5 00:38:32 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_big_divrem_normal): New function.
+
+ * internal.h (rb_big_divrem_normal): Declared.
+
+ * ext/-test-/bignum/div.c: New file.
+
+ * test/-ext-/bignum/test_div.rb: New file.
+
+Thu Sep 5 00:08:44 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bigdivrem_normal): Removed.
+ (bary_divmod_normal): New function.
+ (bary_divmod): Use bary_divmod_normal.
+ (bigdivrem): Use bary_divmod_normal.
+
+Wed Sep 4 23:02:12 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bigdivrem): Useless declaration removed.
+
+Wed Sep 4 22:56:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (NUM_STEP_GET_INF): split from NUM_STEP_SCAN_ARGS(), since
+ inf is not used in num_step_size().
+
+Wed Sep 4 20:22:43 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bigdivrem_normal): Add assertions.
+
+Wed Sep 4 19:18:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h (vm_state_version_t): prefer LONG_LONG to uint64_t.
+
+Wed Sep 4 16:28:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h (vm_state_version_t): use uint64_t when it is larger than
+ LONG_LONG, and fallback to unsigned long.
+
+Wed Sep 4 15:37:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/utf8_mac-tbl.rb: fix r42789.
+ Fix conversion table and logic. [ruby-dev:47680]
+
+Wed Sep 4 14:08:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
+
+ * class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,
+ variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h,
+ vm_method.c: Implement class hierarchy method cache invalidation.
+
+ [ruby-core:55053] [Feature #8426] [GH-387]
+
+Wed Sep 4 11:13:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_gsub): use BEG(0) for whole matched position not
+ return value from rb_reg_search(), for \K matching.
+ [ruby-dev:47694] [Bug #8856]
+
+Wed Sep 4 11:11:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (SOLIBS): LIBRUBY_SO also needs linking with gmp, to
+ run worker processes in test-all on non-ELF platforms.
+
+Tue Sep 3 23:01:41 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/parser/test_tree.rb
+ (TestTreeParser::TestInvalid#test_unmatched_close_tag):
+ Compute expected value from test value.
+
+Tue Sep 3 22:59:58 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse):
+ Add source information to parse exception on no close tag error.
+ [Bug #8844] [ruby-dev:47672]
+ Patch by Ippei Obayashi. Thanks!!!
+ * test/rexml/parser/test_tree.rb: Add a test for the above case.
+
+Tue Sep 3 22:57:57 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/parser/test_tree.rb: Fix test name to describe test
+ content.
+
+Tue Sep 3 22:54:46 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse):
+ Remove needless nested parse exception information.
+ [Bug #8844] [ruby-dev:47672]
+ Reported by Ippei Obayashi. Thanks!!!
+ * test/rexml/parser/test_tree.rb: Add a test for the above case.
+
+Tue Sep 3 22:03:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_enc_str_new_cstr): new function to create a string from
+ the C-string pointer with the specified encoding.
+
+Tue Sep 3 21:41:37 2013 Akira Matsuda <ronnie@dio.jp>
+
+ * eval.c (Init_eval): Make Module#include and Module#prepend public
+ [Feature #8846]
+
+ * test/ruby/test_module.rb (class TestModule): Test for above
+
+Tue Sep 3 21:35:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (sys/dyntune.h): for gettune().
+
+ * thread_pthread.c (hpux_attr_getstackaddr): fix missing *.
+ [ruby-core:56983] [Feature #8793]
+
+Tue Sep 3 20:12:46 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (GMP_STR2BIG_DIGITS): New macro.
+ (str2big_gmp): New function.
+ (rb_cstr_to_inum): Use str2big_gmp for big bignums.
+ (rb_str2big_gmp): New function.
+
+ * internal.h (rb_str2big_gmp): Declared.
+
+Tue Sep 3 19:44:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#values): added.
+ [Feature #7763] [ruby-core:51783]
+
+Tue Sep 3 18:26:00 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/inf-ruby.el (inf-ruby-keys, run-ruby): Add magic autoload
+ comments.
+
+ * misc/rdoc-mode.el (rdoc-mode): Ditto.
+
+ * misc/ruby-electric.el (ruby-electric-mode): Ditto.
+
+ * misc/ruby-style.el (ruby-style-c-mode): Ditto.
+
+Tue Sep 3 17:06:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_rubyoptions.rb
+ (TestRubyOptions::SEGVTest::ExpectedStderr): the URL was changed at
+ r42800.
+
+Tue Sep 3 14:48:25 2013 Zachary Scott <e@zzak.io>
+
+ * lib/thread.rb: [DOC] CV#wait typo by @avdi [Fixes GH-386]
+ https://github.com/ruby/ruby/pull/386
+
+Tue Sep 3 14:37:53 2013 Zachary Scott <e@zzak.io>
+
+ * error.c: [DOC] Update bug tracker url by @ScotterC [Fixes GH-390]
+ https://github.com/ruby/ruby/pull/390
+
+Tue Sep 3 12:45:23 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_str2big_poweroftwo): New function.
+ (rb_str2big_normal): Ditto.
+ (rb_str2big_karatsuba): Ditto.
+
+ * internal.h (rb_str2big_poweroftwo): Declared.
+ (rb_str2big_normal): Ditto.
+ (rb_str2big_karatsuba): Ditto.
+
+ * ext/-test-/bignum/str2big.c: New file.
+
+ * test/-ext-/bignum/test_str2big.rb: New file.
+
+ * ext/-test-/bignum/depend: Add the dependency for str2big.c.
+
+Tue Sep 3 12:09:08 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): Support times() based monotonic clock.
+ (rb_clock_getres): Ditto.
+
+Tue Sep 3 12:03:02 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (str2big_scan_digits): Extracted from rb_cstr_to_inum.
+
+Tue Sep 3 11:23:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select_with_thread): rounding up the fraction of
+ tv_usec instead of rounding down.
+ this change is an experiment to get rid of failures on vc10-x64 CI.
+
+Tue Sep 3 11:00:28 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (do_select): constify timeout.
+
+ * win32/win32.c (rb_w32_select_with_thread): constify 10ms wait and
+ 0ms wait structs.
+
+Tue Sep 3 10:03:42 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/openssl/test_pair.rb
+ (OpenSSL::TestPair#test_write_nonblock_no_exceptions): on some CIs
+ such as Debian 6.0, Ubuntu 10.04, CentOS and vc10-x64 (maybe depend
+ on OpenSSL version), writing to SSLSocket after SSL_ERROR_WANT_WRITE
+ causes SSL_ERROR_SSL "bad write retry".
+
+Tue Sep 3 08:20:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/utf8_mac-tbl.rb: update conversion table to recent OS X.
+ Previous table is used on Mac OS X 10.1 or prior.
+ This table is used on 10.2 or later. [ruby-dev:47680]
+
+Tue Sep 3 07:49:25 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (NUM_STEP_SCAN_ARGS): On second thought, keep
+ Numeric#step backward compatible in that it raises TypeError
+ when nil is given as second argument.
+
+ * test/ruby/test_float.rb (TestFloat#test_num2dbl): Revert.
+
+ * test/ruby/test_numeric.rb (TestNumeric#test_step): Fix test
+ cases for the above change.
+
+Tue Sep 3 07:39:58 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bytes_2comp): Define it only for little endian
+ environment.
+
+Tue Sep 3 07:31:29 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (NUM_STEP_SCAN_ARGS): Numeric#step should raise
+ TypeError if a non-numeric parameter is given.
+
+ * test/ruby/test_float.rb (TestFloat#test_num2dbl): Allow nil as
+ step, as with the keyword argument.
+
+ * test/ruby/test_numeric.rb (TestNumeric#test_step): Add tests for
+ nil as step or limit.
+
+Tue Sep 3 07:28:49 2013 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (bit_length): Add casts to fix compilation error with
+ clang 3.0 -Werror,-Wshorten-64-to-32.
+ [ruby-dev:47687] reported by SASADA Koichi.
+
+Tue Sep 3 03:17:26 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_search_super_method): use ci->argc instead of
+ ci->orig_argc. ci->argc can be changed by splat arguments.
+ [ruby-list:49575]
+ This fix should be applied to Ruby 2.0.0 series.
+
+ * test/ruby/test_super.rb: add a test for above.
+
+Mon Sep 2 23:46:29 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (num_step): Default the limit argument to infinity and
+ allow it to be omitted. Keyword arguments (by: and to:) are
+ introduced for ease of use. [Feature #8838] [ruby-dev:47662]
+ [ruby-dev:42194]
+
+ * numeric.c (num_step): Optimize for infinite loop.
+
+Mon Sep 2 22:55:59 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (ISDIGIT): Unused macro removed.
+
+Mon Sep 2 22:49:15 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (str2big_poweroftwo): Extracted from rb_cstr_to_inum.
+ (str2big_normal): Ditto.
+ (str2big_karatsuba): Ditto.
+
+Mon Sep 2 14:39:29 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.c (Process#setproctitle): [DOC] Fix and improve rdoc.
+
+ * ruby.c (Process#argv0): [DOC] Improve rdoc.
+
+Mon Sep 2 14:15:00 2013 Kenta Murata <mrkn@cookpad.com>
+
+ * NEWS: fix description of number literal suffixes.
+
+Mon Sep 2 14:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
+
+ * test/rake/test_rake_rules.rb: add space after string literal to
+ prevent conflict with string options syntax "foo"opts
+
+ * test/rss/rss-assertions.rb: ditto
+
+Mon Sep 2 12:28:38 2013 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_bignum.rb (test_interrupt_during_to_s): Disable it
+ when GMP is used.
+
+Mon Sep 2 07:02:10 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (Init_Bignum): Define Bignum::GMP_VERSION when GMP is used.
+
+Mon Sep 2 01:46:14 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h: rename iseq field to support this fix.
+ * bignum.c (big2str_generic): Reduce arguments.
+ (big2str_gmp): Ditto.
+ (rb_big2str1): Follow the above change.
-Wed Dec 2 17:10:32 2015 Koichi Sasada <ko1@atdot.net>
+Mon Sep 2 00:08:08 2013 Tanaka Akira <akr@fsij.org>
- * iseq.h: introduce ISEQ_FLIP_CNT_INCREMENT() macro.
+ * process.c (get_mach_timebase_info): Extracted from rb_clock_gettime.
+ (rb_clock_gettime): Use get_mach_timebase_info.
+ (rb_clock_getres): Support MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC.
- * compile.c (iseq_compile_each): use it.
+Sun Sep 1 23:30:47 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h: rename flip_cnt field to support this fix.
+ * bignum.c (GMP_BIG2STR_DIGITS): New constant.
+ (big2str_gmp): New function.
+ (rb_big2str1): Use big2str_gmp for big bignums.
-Wed Dec 2 17:05:15 2015 Koichi Sasada <ko1@atdot.net>
+ * internal.h (rb_big2str_gmp): Declared.
- * iseq.h: introduce ISEQ_COVERAGE() and ISEQ_COVERAGE_SET() macro.
+ * ext/-test-/bignum/big2str.c (big2str_gmp): New method.
- * compile.c: use them.
+Sun Sep 1 22:37:51 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bary_mul_gmp): Use mpz_init and mpz_clear instead of
+ mpz_inits and mpz_clears.
+ Older GMP don't have them.
+
+Sun Sep 1 21:17:54 2013 Tanaka Akira <akr@fsij.org>
+
+ * test/net/http/test_http.rb (test_bind_to_local_port): Choose an open
+ port more reliably.
+
+Sun Sep 1 20:32:40 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (big2str_base_poweroftwo): Renamed from
+ big2str_base_powerof2.
+ (rb_big2str_poweroftwo): New function for test.
+ (big2str_generic): Extracted from rb_big2str1.
+ (rb_big2str_generic): New function for test.
+
+ * internal.h (rb_big2str_poweroftwo): Declared.
+ (rb_big2str_generic): Ditto.
+
+ * ext/-test-/bignum/big2str.c: New file.
+
+ * test/-ext-/bignum/test_big2str.rb: New file.
+
+Sun Sep 1 15:21:21 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (big2str_2bdigits): Renamed from big2str_orig.
+
+Sun Sep 1 13:02:24 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,
+ SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough.
+
+Sun Sep 1 11:38:26 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (maxpow_in_bdigit): Removed.
+
+Sun Sep 1 10:30:42 2013 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (rb_fix_bit_length): Moved from bignum.c.
+
+Sun Sep 1 09:55:45 2013 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (bit_length): Moved from bignum.c.
+ (nlz_int): Ditto.
+ (nlz_long): Ditto.
+ (nlz_long_long): Ditto.
+ (nlz_int128): Ditto.
+
+Sun Sep 1 03:32:22 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (bit_length): Renamed from bitsize.
+
+Sun Sep 1 00:07:09 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_big_bit_length): New method.
+ (rb_fix_bit_length): Ditto.
+ [ruby-core:56247] [Feature #8700]
+
+Sat Aug 31 22:18:29 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_getres): New method.
+ (timetick2dblnum_reciprocal): New function.
+
+ * configure.in: Check clock_getres.
+
+ [ruby-core:56780] [Feature #8809] accepted as a CRuby feature at
+ DevelopersMeeting20130831Japan
+ https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130831Japan
+
+Sat Aug 31 21:02:07 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c: Use GMP to accelerate big Bignum multiplication.
+ (bary_mul_gmp): New function.
+ (bary_mul): Use bary_mul_gmp.
+ (bigsq): Use different threshold with GMP.
+
+ * configure.in: Detect GMP.
+
+ [ruby-core:56658] [Feature #8796]
+
+Sat Aug 31 15:03:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
+
+ * compile.c (NODE_MATCH3): pass CALL_INFO to opt_regexpmatch2
+
+ * insns.def (opt_regexpmatch2): use CALL_SIMPLE_METHOD to call =~ if
+ the receiver is not a T_STRING [Bug #8847] [ruby-core:56916]
+
+Sat Aug 31 14:07:11 2013 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb (random_bytes): Use Process.clock_gettime.
+
+Sat Aug 31 00:25:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/encoding.h (rb_{ascii8bit,utf8,usascii}_encindex): get
+ rid of conflict with macros defined in internal.h.
+
+Fri Aug 30 22:37:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (native_thread_init_stack): wait the creator thread
+ to fill machine stack info, if get_stack_of() is available.
+
+ * thread_pthread.c (native_thread_create): fill the created thread
+ stack info after starting, if get_stack_of() is available.
+
+ * thread_pthread.c (native_thread_create): define attr only if it is
+ used, and merge pthread_create() calls.
+
+ * thread_pthread.c (get_main_stack): separate function to get stack of
+ main thread.
+
+Thu Aug 29 18:05:33 2013 Koichi Sasada <ko1@atdot.net>
+
+ * struct.c (rb_struct_define_without_accessor_under): added.
+ This function is similar to rb_define_class_under() against
+ rb_define_class().
+
+ * include/ruby/intern.h: add a declaration of this function.
+
+Thu Aug 29 17:03:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_method): a method entry refers the based
+ class/module, so should search superclass from the origin i-class
+ where the entry belongs to, to get rid of infinite loop when zsuper
+ in a prepended class/module. [ruby-core:54105] [Bug #8238]
+
+Thu Aug 29 05:35:58 2013 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (zstream_run): Fix handling of deflate streams that
+ need a dictionary but are being decompressed by Zlib::Inflate.inflate
+ (which has no option to set a dictionary). Now Zlib::NeedDict is
+ raised instead of crashing. [ruby-trunk - Bug #8829]
+ * test/zlib/test_zlib.rb (TestZlibInflate): Test for the above.
+
+Thu Aug 29 02:40:45 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be
+ treated as strings.
+ https://github.com/tenderlove/psych/issues/156
+
+ * test/psych/test_string.rb: test for change
+
+Wed Aug 28 17:20:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (hpux_attr_getstackaddr): basic support for the
+ get_stack() under HP-UX. based on the patch by michal@rokos.cz
+ (Michal Rokos) at [ruby-core:56645]. [Feature #8793]
+
+Wed Aug 28 11:24:20 2013 Michal Rokos <michal@rokos.cz>
+
+ * configure.in (sys/pstat.h): fix missing header check for
+ missing/setproctitle.c on HP-UX. [ruby-core:56644] [Bug #8792]
+
+Wed Aug 28 04:54:33 2013 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read): Replace duplicate
+ wait_writable with wait_readable.
+
+Tue Aug 27 17:18:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/timeout.rb (Timeout#timeout): skip rescue clause only when no
+ exception class is given.
+
+Tue Aug 27 17:02:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (copy_stream_body): should write in binary mode. based on a
+ patch by godfat (Lin Jen-Shin) at [ruby-core:56556].
+ [ruby-core:56518] [Bug #8767]
+
+Tue Aug 27 17:02:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (copy_stream_body): move common open flags.
+
+Tue Aug 27 16:56:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (enumerator_size): use rb_check_funcall() instead of
+ respond_to? and call.
+
+ * enumerator.c (enumerator_each): ensure that argument array size
+ does not overflow at appending.
+
+Tue Aug 27 16:46:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_index, rb_ary_rindex): use optimized equality to
+ improve performance. [Feature #8820]
+
+ * vm_insnhelper.c (rb_equal_opt): optimized equality function.
+
+Tue Aug 27 16:11:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (opt_eq_func): use RBASIC_CLASS() instead of HEAP_CLASS_OF().
+
+ * insns.def (opt_plus, opt_minus, opt_mult, opt_div, opt_mod, opt_lt),
+ (opt_gt, opt_ltlt, opt_aref, opt_aset, opt_length, opt_size),
+ (opt_empty_p, opt_succ): ditto.
+
+Tue Aug 27 16:08:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (rb_check_funcall, rb_check_funcall_with_hook): constify
+ argv.
+
+Tue Aug 27 13:03:33 2013 Koichi Sasada <ko1@atdot.net>
+
+ * ext/stringio/stringio.c (strio_read_nonblock): declare local
+ variables at the first of function.
+
+Tue Aug 27 11:51:37 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Allow Enumerator size argument to be any callable.
+ Patch by Avdi Grimm. [bug #8641] [ruby-core:56032] [fix GH-362]
+
+ * test/ruby/test_enumerator.rb: Test for above
+
+Tue Aug 27 11:46:31 2013 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (gc_profile_clear): do rest_sweep() before clearing
+ profile.current_record.
+
+Tue Aug 27 07:35:05 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * io.c (io_read_nonblock): support non-blocking reads without raising
+ exceptions. As in: `io.read_nonblock(size, exception: false)`
+ [ruby-core:38666] [Feature #5138]
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): ditto
+ * ext/stringio/stringio.c (strio_sysread): ditto
+ * io.c (rb_io_write_nonblock): support non-blocking writes without
+ raising an exception.
+ * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): ditto
+ * test/openssl/test_pair.rb (class OpenSSL): tests
+ * test/ruby/test_io.rb (class TestIO): ditto
+ * test/socket/test_nonblock.rb (class TestSocketNonblock): ditto
+ * test/stringio/test_stringio.rb (class TestStringIO): ditto
+
+Tue Aug 27 05:24:34 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Import RubyGems 2.1.0 Release Candidate
+ * test/rubygems: ditto.
+
+Mon Aug 26 16:24:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_nextc): warn carriage return in middle of line.
+ [ruby-core:56240] [Feature #8699]
+
+Mon Aug 26 15:27:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/timeout.rb (Timeout#timeout): should not be caught by rescue
+ clause. [Bug #8730]
+
+Mon Aug 26 14:44:26 2013 Koichi Sasada <ko1@atdot.net>
+
+ * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
+
+ * enum.c (enum_sort_by): ditto.
+
+ * struct.c (setup_struct): use RARRAY_RAWPTR().
+
+ * vm_eval.c (yield_under): ditto.
+
+ * ext/pathname/pathname.c (path_entries): use RARRAY_AREF().
+
+ * ext/pathname/pathname.c (path_s_glob): ditto.
+
+Mon Aug 26 13:11:10 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * array.c (ary_ensure_room_for_push): fix typo in r42658.
+
+Mon Aug 26 12:37:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/sizes.c.tmpl: generate automatically by extracting
+ RUBY_CHECK_SIZEOF from configure.in.
+
+Mon Aug 26 10:16:59 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * process.c (gcd_timetick_int): Renamed from gcd_timtick_int.
+
+Sun Aug 25 21:02:15 2013 Tanaka Akira <akr@fsij.org>
+
+ * sizes.c (Init_sizes): Define the size of clock_t.
+
+Sun Aug 25 01:47:47 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (BARY_SHORT_MUL): Renamed from BARY_MUL1.
+ (bary_short_mul): Renamed from bary_mul1.
+
+Sat Aug 24 10:35:09 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): The emulated clock names changed.
+
+Fri Aug 23 22:22:07 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): Add a cast to fix compile error by
+ -Werror,-Wshorten-64-to-32.
+
+Fri Aug 23 22:12:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_intern): no symbol cache while initialization.
+
+Fri Aug 23 22:07:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (clock_t): needs time.h.
+
+Fri Aug 23 21:37:28 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (reduce_factors): New function.
+ (timetick2dblnum): Use reduce_factors.
+ (timetick2integer): Ditto.
+ (make_clock_result): Follow the above change.
+ (rb_clock_gettime): Ditto.
+
+Fri Aug 23 21:00:55 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (timetick_int_t): Renamed from timetick_giga_count_t.
+ (gcd_timtick_int): Renamed from gcd_ul and make the arguments
+ timetick_giga_count_t.
+ (reduce_fraction): Make the arguments timetick_int_t.
+ (timetick2integer): Ditto.
+ (make_clock_result): Ditto.
+ (timetick2dblnum): Fix the return type.
+ (rb_clock_gettime): Use timetick_int_t.
+
+Fri Aug 23 20:50:40 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (gcd_ul): New function.
+ (reduce_fraction): Ditto.
+ (reduce_fraction): Ditto.
+ (timetick2dblnum): Ditto.
+ (timetick2integer): Ditto.
+ (make_clock_result): Use timetick2dblnum and timetick2integer.
+ (rb_clock_gettime): Follow the make_clock_result change.
+
+Fri Aug 23 18:39:04 2013 Koichi Sasada <ko1@atdot.net>
+
+ * array.c (ary_make_shared): shared ary as shady. Need more effort to
+ make it normal object.
+
+ * array.c (rb_ary_modify): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
+
+ * array.c (ary_ensure_room_for_unshift): use RARRAY_RAWPTR() because
+ there are not new relations.
+
+Fri Aug 23 11:25:57 2013 Koichi Sasada <ko1@atdot.net>
+
+ * array.c: introduce ARY_SHARED_OCCUPIED(shared).
+
+Fri Aug 23 11:07:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub (config.h): now SIZEOF_CLOCK_T is needed for
+ unsigned_clock_t.
+
+Thu Aug 22 22:01:04 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): Strip "s" from unit names.
+
+Thu Aug 22 20:14:59 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (unsigned_clock_t): Defined.
+ (rb_clock_gettime): Consider clock_t overflow for
+ ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID.
+
+ * configure.in: Check the size of clock_t.
+
+Thu Aug 22 16:22:48 2013 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (build_postexe_iseq): fix to setup the local table.
+
+Thu Aug 22 15:42:43 2013 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (rb_iseq_compile_node): accept NODE_IFUNC to support
+ custom compilation.
+
+ * compile.c (NODE_POSTEXE): compile to
+ "ONCE{ VMFrozenCore::core#set_postexe{...} }" with a new custom
+ compiler `build_postexe_iseq()'.
+
+ * vm.c (m_core_set_postexe): remove parameters (passed by a block).
+
+Thu Aug 22 06:54:15 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): Change emulation symbols for
+ Process.clock_gettime.
+
+Thu Aug 22 06:24:54 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (make_clock_result): Extracted from rb_clock_gettime.
+
+Wed Aug 21 22:30:51 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): clock() based CLOCK_PROCESS_CPUTIME_ID
+ emulation implemented.
+
+Wed Aug 21 21:02:37 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC.
+
+Wed Aug 21 20:33:01 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (get_clk_tck): Extracted from rb_proc_times.
+ (rb_clock_gettime): times() based CLOCK_PROCESS_CPUTIME_ID emulation
+ is implemented.
+
+Wed Aug 21 19:31:48 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c: POSIX_GETTIMEOFDAY_CLOCK_REALTIME is renamed to
+ SUS_GETTIMEOFDAY_CLOCK_REALTIME.
+
+Wed Aug 21 19:17:46 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_clock_gettime): CLOCK_PROCESS_CPUTIME_ID emulation
+ using getrusage is implemented.
+
+Wed Aug 21 17:34:27 2013 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (getrusage_time): Fallback clock_gettime to getrusage when
+ clock_gettime fails.
+ Reported by Eric Saxby. [ruby-core:56762] [Bug #8805]
+
+Wed Aug 21 02:32:32 2013 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def: fix regexp's once option behavior.
+ fix [ruby-trunk - Bug #6701]
+
+ * insns.def: remove `onceinlinecache' and introduce `once' instruction.
+ `once' doesn't use `setinlinecache' insn any more.
+
+ * vm_core.h: `union iseq_inline_storage_entry' to store once data.
+
+ * compile.c: catch up above changes.
* iseq.c: ditto.
- * iseq.c (rb_iseq_coverage): added.
+ * vm.c, vm_insnhelper.c: ditto. fix `m_core_set_postexe()' which
+ is depend on `onceinlinecache' insn.
- * thread.c (update_coverage): use rb_iseq_coverage().
+ * test/ruby/test_regexp.rb: add tests.
- * vm_core.h: rename coverage field name to support this fix.
+ * iseq.c: ISEQ_MINOR_VERSION to 1 (should increment major?)
-Wed Dec 2 17:00:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 21 02:30:15 2013 Koichi Sasada <ko1@atdot.net>
- * encoding.c (enc_name, rb_enc_name_list_i, rb_enc_aliases_enc_i):
- make fstring instead of making each copies.
+ * gc.c (rb_gcdebug_print_obj_condition): add printing information.
-Wed Dec 2 16:32:08 2015 Koichi Sasada <ko1@atdot.net>
+Tue Aug 20 13:38:00 2013 Naohisa Goto <ngotogenome@gmail.com>
- * iseq.h: introduce ISEQ_COMPILE_DATA() macro.
+ * test/gdbm/test_gdbm.rb: skip TestGDBM#test_s_open_lock on Solaris.
+ On Solaris (and platforms which do not have flock and have lockf),
+ with GDBM 1.10, gdbm_open(3) blocks when opening already locked
+ gdbm file. [Bug #8790] [ruby-dev:47631]
- * compile.c, iseq.c: use ISEQ_COMPILE_DATA().
+Tue Aug 20 02:32:52 2013 Zachary Scott <e@zzak.io>
- * vm_core.h: rename compile_data field to support this fix.
+ * lib/test/: [DOC] Document Test::Unit, hide most submodules and
+ classes from rdoc. Since lib/test is only present as a compatibility
+ layer with the legacy test suite many test/unit users will be using
+ minitest or the test/unit gem instead. It is recommended to use one
+ of these alternatives for writing new tests.
-Wed Dec 2 16:27:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This patch was based on a patch submitted by Steve Klabnik.
+ [ruby-core:56694] [Bug #8778]
- * encoding.c (enc_m_loader): defer finding encoding object not to
- be infected by marshal source. [ruby-core:71793] [Bug #11760]
+Tue Aug 20 02:10:19 2013 Zachary Scott <e@zzak.io>
- * marshal.c (r_object0): enable compatible loader on USERDEF
- class. the loader function is called with the class itself,
- instead of an allocated object, and the loaded data.
+ * lib/rss/rss.rb: [DOC] Document for constants by Steve Klabnik
+ [ruby-core:56705] [Bug #8798]
- * marshal.c (compat_allocator_table): initialize
- compat_allocator_tbl on demand.
+Tue Aug 20 02:01:10 2013 Zachary Scott <e@zzak.io>
- * object.c (rb_undefined_alloc): extract from rb_obj_alloc.
+ * lib/rss/xmlparser.rb: [DOC] Hide legacy constant from rdoc
+ Patch by Steve Klabnik [ruby-core:56708] [Bug #8799]
-Wed Dec 2 15:12:43 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Aug 20 01:52:05 2013 Zachary Scott <e@zzak.io>
- * configure.in: Fixed double negative comments.
- [Bug #11698][ruby-core:71506]
+ * ext/socket/unixserver.c: [DOC] Document #accept
+ * ext/socket/tcpserver.c: ditto
+ * ext/socket/udpsocket.c: [DOC] Fix indentation of documentation
+ * ext/socket/socket.c: ditto
+ Patches by David Rodr'iguez [ruby-core:56734] [Bug #8802]
-Wed Dec 2 14:55:01 2015 yui-knk <spiketeika@gmail.com>
+Tue Aug 20 01:19:22 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_string.rb: removed non executing tests.
- [Misc #11757][ruby-dev:49397]
+ * configure.in: Define ac_cv_func_clock_gettime to yes for mingw*.
-Wed Dec 2 11:23:06 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Aug 19 21:31:35 2013 Tanaka Akira <akr@fsij.org>
- * lib/csv.rb: enable frozen_string_literal.
- [fix GH-1116] Patch by @marshall-lee
+ * include/ruby/defines.h: Fix a compilation error with
+ i586-mingw32msvc-gcc of gcc-mingw32 package on Debian squeeze.
+ ruby/missing.h should be included before include/ruby/win32.h
+ because struct timespec, used in the clock_gettime declaration in
+ include/ruby/win32.h, is defined in ruby/missing.h instead of
+ system headers.
-Wed Dec 2 10:36:25 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Aug 19 20:55:12 2013 Koichi Sasada <ko1@atdot.net>
- * ext/bigdecimal/bigdecimal.c: Fix double word typo.
- [ci skip][fix GH-1120] Patch by @jwworth
+ * gc.c: fix around GC_DEBUG.
-Wed Dec 2 07:43:51 2015 Eric Wong <e@80x24.org>
+ * gc.c (RVALUE::line): should be VALUE. On some environment
+ (such as mswin64), `int' introduces alignment mismatch.
- * ext/openssl/ossl_ssl.c (mSSLExtConfig): make static
- (eSSLError): ditto
- (ID_callback_state): ditto
- (ossl_ssl_ex_vcb_idx): ditto
- (ossl_ssl_ex_store_p): ditto
- (ossl_ssl_ex_ptr_idx): ditto
- * ext/openssl/ossl_ssl.h: remove extern declarations for
- mSSLExtConfig and eSSLError
+ * gc.c (newobj_of): add an assertion to check VALUE alignment.
-Wed Dec 2 07:41:08 2015 Eric Wong <e@80x24.org>
+ * gc.c (aligned_malloc): `&' is low priority than `=='.
- * missing/explicit_bzero.c (explicit_bzero): fixup r52839
- for compilers with "weak" attribute
+ * gc.c: define GC_DEBUG everytime and use it as value 0 or 1.
-Wed Dec 2 06:47:25 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Aug 19 17:43:44 2013 Koichi Sasada <ko1@atdot.net>
- * missing/explicit_bzero.c: add ruby_explicit_bzero_hook_unused
- for preventing optimization. Inspired from OpenBSD.
+ * test/ruby/test_fiber.rb: collect garbage fibers immediately.
-Tue Dec 1 23:36:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 19 17:41:49 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c (rb_thread_setname): allow to reset thread name.
+ * test/profile_test_all.rb: add `failed?' information.
-Tue Dec 1 23:14:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 19 17:00:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (rb_thread_setname): check the argument if valid
- string. [ruby-core:71774] [Bug #11756]
+ * process.c (retry_fork): retry with GC if ENOMEM occurred, to free
+ swap/kernel space.
-Tue Dec 1 17:13:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 19 13:28:47 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * string.c (rb_string_value_cstr): should not raise on frozen
- string.
+ * include/ruby/win32.h (CLOCK_MONOTONIC): typo.
-Tue Dec 1 09:35:29 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * win32/win32.c: removed duplicated declarations.
- * missing/explicit_bzero.c: add a few comment.
+Mon Aug 19 13:03:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Dec 1 09:31:19 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in (clock_gettime): should not overwrite cache variable
+ with different condition. otherwise -lrt is not linked and the link
+ fails, after reconfig.
- * missing/explicit_bzero.c: add disabling optimization on gcc.
+Mon Aug 19 12:56:49 2013 Tanaka Akira <akr@fsij.org>
-Tue Dec 1 07:50:33 2015 Eric Wong <e@80x24.org>
+ * process.c (Init_process): Add constants: CLOCK_REALTIME_ALARM and
+ CLOCK_BOOTTIME_ALARM.
- * missing/explicit_bzero.c: new file. define explicit_bzero.
- Fixup r52806
+Sun Aug 18 20:17:41 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Thu Oct 22 12:54:43 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * variable.c, vm_method.c: remove dead code.
- * thread_pthread.c (register_ubf_list): renamed from
- add_signal_thread_list.
- * thread_pthread.c (unregister_ubf_list): renamed
- from remove_signal_thread_list.
- * thread_pthread.c (ubf_wakeup_all_threads): renamed from
- ping_signal_thread_list.
- * thread_pthread.c (ubf_wakeup_thread): renamed from
- ubf_select_each.
- * thread_pthread.c (ubf_threads_empty): renamed from
- check_signal_thread_list().
- * thread_pthread.c (ubf_list_lock): renamed from
- signal_thread_list_lock.
+ * test/ruby/test_fiber.rb, test/ruby/test_thread.rb:
+ change accordingly.
- * thread_pthread.c (register_ubf_list): large simplification
- by using ccan/list.h.
- bonus: removed malloc() and exit(EXIT_FAILURE).
- * thread_pthread.c (unregister_ubf_list): ditto.
- * thread_pthread.c (ubf_threads_empty): ditto.
- * thread_pthread.c (ubf_wakeup_all_threads): ditto.
+Sun Aug 18 19:32:26 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * thread_pthread.c (print_signal_list): removed.
+ * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:
+ $SAFE=4 is obsolete.
-Thu Oct 22 08:03:49 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 18 14:30:47 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_rand.rb (TestRand#test_default_seed): add
- srand case.
+ * process.c (rb_clock_gettime): Rename POSIX_TIME_CLOCK_REALTIME to
+ ISO_C_TIME_CLOCK_REALTIME.
-Thu Oct 22 06:33:38 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 18 14:22:45 2013 Tanaka Akira <akr@fsij.org>
- * random.c (InitVM_Random): move Random::DEFAULT initialization
- bits to Init_Random_default.
- * random.c (Init_Random_default): renamed from Init_RandomSeed2.
- * random.c (Init_RandomSeedCore): renamed from Init_RandomSeed.
+ * configure.in: Revert r42604. It causes linking librt on systems
+ with newer glibc uselessly.
-Thu Oct 22 06:20:48 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 18 13:18:38 2013 Tanaka Akira <akr@fsij.org>
- * random.c (Init_RandomSeed): move all Random::DEFAULT
- construction bits to Init_RandomSeed2. Random::DEFAULT
- and Ruby internal hashes are no longer shared their seed.
- * random.c (Init_RandomSeed2): ditto. And, kill evil
- rb_obj_reveal() stuff.
+ * process.c (Init_process): Add constants: CLOCK_REALTIME_COARSE,
+ CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME.
- * random.c (init_hashseed): add MT argument.
- * random.c: (init_siphash): ditto.
+Sun Aug 18 12:41:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_rand.rb (TestRand#test_default_seed): new
- test for Random::DEFAULT::seed.
+ * configure.in (clock_gettime): need to check with -lrt prior to check
+ for the function only. otherwise -lrt is not linked and the link
+ fails, when ac_cv_func_clock_gettime is cached as yes.
-Thu Oct 22 05:23:48 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 18 10:05:12 2013 Tanaka Akira <akr@fsij.org>
- * random.c (init_hashseed, init_siphash): extract initialize
- functions.
+ * bignum.c (rb_big2str1): Make an expression more explicit.
-Thu Oct 22 01:01:34 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 18 03:18:45 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: sort AC_CHECK_HEADERS() by alphabetical order.
+ * bignum.c (rb_big2str1): Use power_level instead of bitsize(xn).
-Thu Oct 22 00:19:07 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Aug 18 00:44:58 2013 Tanaka Akira <akr@fsij.org>
- * random.c (init_randomseed): remove "initial" argument. It never
- be used from outside of this function.
+ * bignum.c (BIGDIVREM_EXTRA_WORDS): Redefine to 1.
+ (bigdivrem_num_extra_words): Removed.
+ (bigdivrem_normal): Simplified.
+ (big2str_karatsuba): Ditto.
-Thu Oct 22 00:12:33 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Aug 17 23:25:19 2013 Benoit Daloze <eregontp@gmail.com>
- * lib/securerandom.rb (SecureRandom::gen_random): use /dev/urandom
- for initialize OpenSSL's rand.
+ * test/ruby/test_time.rb: use the in_timezone() helper
+ and define it at the top with other helpers.
-Wed Oct 21 12:10:04 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Aug 17 22:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_rand.c (ossl_rand_bytes): RAND_bytes could
- be return -1 as an error. Therefore, added error handling.
- * ext/openssl/ossl_pkey_dsa.c (dsa_generate): ditto.
+ * time.c (time_mload): ignore auxiliary data, offset and zone, if
+ invalid. [ruby-core:56648] [Bug #8795]
-Wed Oct 21 09:04:09 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Aug 17 20:11:49 2013 Benoit Daloze <eregontp@gmail.com>
- * include/ruby/util.h: remove a warning suppression C4723
- (potential divide by zero) for VisualC++. It's meaningless.
- Before r26197, there is ruby_div0() in this place and it
- actually made divide by zero. But now it's just garbage.
+ * process.c: [DOC] MACH_ABSOLUTE_TIME_CLOCK_MONOTONIC is an
+ available emulation for a monotonic clock on Darwin.
+ https://developer.apple.com/library/mac/qa/qa1398/_index.html
-Wed Oct 21 08:23:36 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 16 18:12:05 2013 Koichi Sasada <ko1@atdot.net>
- * random.c: random_raw_seed don't use GRND_NONBLOCK. GRND_NONBLOCK
- mean the result might not have an enough cryptic strength and
- easy predictable. That's no good for SecureRandom.
+ * test/profile_test_all.rb: fix typo.
-Sun Oct 18 17:26:53 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 16 18:09:20 2013 Koichi Sasada <ko1@atdot.net>
- * common.mk: add a rule for explicit_bzero.o.
- * configure.in: detect explicit_bzero and memset_s.
- * include/ruby/missing.h: add explicit_bzero.
- * random.c (init_randomseed): use explicit_bzero() instead of
- memset(). memset could be eliminated by compiler optimization.
+ * test/profile_test_all.rb: remove space characters from test names.
-Mon Nov 30 18:46:44 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Aug 16 17:32:02 2013 Koichi Sasada <ko1@atdot.net>
- * ext/readline/extconf.rb: call dir_config("libedit")
- if --enable-libedit is specified. [Bug #11751]
- patched by John Hein
+ * test/profile_test_all.rb: refactoring memory profiling tool for
+ test-all.
+ Add profiling targets /proc/meminfo and /proc/self/status.
-Mon Nov 30 08:44:29 2015 Eric Wong <e@80x24.org>
+ * test/runner.rb: accept other than 'true'.
- * variable.c: remove spurious #define for globals
- [ruby-core:71735] [Feature #11749]
+Fri Aug 16 11:23:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun Nov 29 09:13:03 2015 Conor Landry <clandry94@gmail.com>
+ * file.c (rb_file_size, rb_file_flock): improve performance of Windows.
- * NEWS: [DOC] Various grammar corrections and clarifications to
- increase readability. [Fix GH-1115]
+ * file.c (rb_file_truncate): removed unnecessary #ifdef.
-Sat Nov 28 19:33:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/test_file.rb (TestFile#test_truncate_size): added an assertion
+ for File#size.
- * parse.y (parser_here_document): store dispatched result of
- on_tstring_content at the last fragment of a here document.
+Fri Aug 16 10:07:59 2013 Tanaka Akira <akr@fsij.org>
-Fri Nov 27 19:19:44 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * bignum.c (bigdivrem_single1): Renamed from bigdivrem_single. Add
+ x_higher_bdigit argument.
+ (bigdivrem_single): Just call bigdivrem_single1.
+ (bigdivrem_restoring): Use bigdivrem_single1 to avoid memmove.
- * lib/net/http.rb (connect): detect closed connection and reconnect
- If the server closes a keep-alive http connection, the client socket
- reaches EOF. To avoid an EOFError, detect the closed connection and
- reconnect.
- Added test to ensure HTTP#post succeeds even if the
- keep-alive-connection has been closed by the server.
- by Kristian Hanekamp <kris.hanekamp@gmail.com>
- https://github.com/ruby/ruby/pull/1089 fix GH-1089
+Fri Aug 16 09:17:00 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 26 21:36:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_small_rshift): Specify the higher BDIGIT instead of
+ sign bit.
+ (big_shift3): Follow the above change.
- * compile.c (iseq_peephole_optimize): enable tail call
- optimization for specialized indexers.
+Fri Aug 16 02:20:39 2013 Tanaka Akira <akr@fsij.org>
- * compile.c (iseq_compile_each): blockiseq should be NULL, but not
- Qnil.
+ * bignum.c (bary_mul_toom3): Reduce a branch.
-Thu Nov 26 17:22:53 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Aug 16 02:14:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:
- Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692
- + https://github.com/k-takata/Onigmo/pull/52
+ * process.c (rb_clock_gettime): add CLOCK_MONOTONIC support on OS X.
+ http://developer.apple.com/library/mac/qa/qa1398/_index.html
+ [Feature #8658]
-Thu Nov 26 09:50:02 2015 yui-knk <spiketeika@gmail.com>
+Fri Aug 16 01:37:43 2013 Tanaka Akira <akr@fsij.org>
- * test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
- [Misc #11732][ruby-dev:49379]
+ * bignum.c (bigdivrem_single): Use shift when y is a power of two.
-Thu Nov 26 09:46:36 2015 yui-knk <spiketeika@gmail.com>
+Fri Aug 16 01:09:33 2013 Tanaka Akira <akr@fsij.org>
- * test/coverage/test_coverage.rb: Added test-case for Coverage.peek_result
- without Coverage.start. [Misc #11726][ruby-core:71622]
+ * bignum.c (bigdivrem_restoring): Use bigdivrem_single if non-topmost
+ BDIGITs of y are zero.
-Thu Nov 26 07:22:55 2015 Eric Wong <e@80x24.org>
+Fri Aug 16 00:33:12 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ssl.rb (test_copy_stream): new test
+ * bignum.c (rb_big2str1): Truncate topmost zeros of x.
-Wed Nov 25 21:23:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 16 00:00:57 2013 Tanaka Akira <akr@fsij.org>
- * io.c (copy_stream_body): try to_io conversion before read,
- readpartial, and write methods. [ruby-dev:49008] [Bug #11199]
+ * bignum.c (bary_divmod): Simplify an expression.
-Wed Nov 25 10:55:21 2015 Shugo Maeda <shugo@ruby-lang.org>
+Thu Aug 15 23:26:12 2013 Tanaka Akira <akr@fsij.org>
- * io.c (argf_getpartial): should not resize str if the second
- argument is not given.
- [ruby-core:71668] [Bug #11738]
+ * bignum.c (bigdivrem_normal): Remove a local variable.
-Tue Nov 24 23:56:25 2015 Naohisa Goto <ngotogenome@gmail.com>
+Thu Aug 15 23:08:32 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: On Solaris, it is safe to define _LARGEFILE_SOURCE
- when _FILE_OFFSET_BITS=64 is defined (= when 32-bit compile).
+ * bignum.c (big2str_karatsuba): Use bigdivrem_restoring directly to
+ reduce working buffer and memory copy.
+ (rb_big2str1): Allocate working buffer for big2str_karatsuba here.
-Tue Nov 24 10:00:10 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Aug 15 20:51:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/rubygems/installer.rb: Fix two double-word typos.
- [ci skip][fix GH-1108] Patch by @jwworth
+ * io.c, internal.h (rb_io_flush_raw): new function to select calling
+ fsync() (on Windows).
-Tue Nov 24 09:17:02 2015 Alexander von Gluck IV <kallisti5@unixzen.com>
+ * io.c (rb_io_flush_raw): use above function.
- * beos: Drop support for BeOS now that Haiku is stable.
- [Fix GH-1112]
+ * file.c (rb_file_truncate): use above function.
-Tue Nov 24 09:16:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_file.rb (TestFile#test_truncate_size): test for
+ above changes.
- * internal.h (rb_gc_for_fd): move to export, as referred by
- ext/socket.
+Thu Aug 15 18:39:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Nov 24 09:04:29 2015 David Rodriguez <deivid.rodriguez@gmail.com>
+ * win32/win32.c (clock_gettime): improve precision when freq is less
+ than and nearly equals 10**9.
- * file.c: [DOC] add a missing period to File docs, to terminate
- the sentence and separate from the next sentence. [Fix GH-1111]
+Thu Aug 15 17:43:15 2013 Koichi Sasada <ko1@atdot.net>
-Tue Nov 24 08:30:06 2015 JuanitoFatas <katehuang0320@gmail.com>
+ * gc.c (gc_lazy_sweep): remove heap_increment() here because heap_inc
+ may be 0.
- * NEWS: Fix the issue number of `Struct#dig`, which should be
- [Feature #11688]. [Fix GH-1110]
+Thu Aug 15 16:59:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Nov 24 07:56:54 2015 Eric Wong <e@80x24.org>
+ * io.c (rb_io_rewind): remove fsync() for Windows to improve the
+ performance.
- * ext/socket/init.c (rsock_s_accept): handle ENOMEM
+Thu Aug 15 16:30:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Nov 24 07:50:15 2015 Eric Wong <e@80x24.org>
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_rmdir):
+ FileUtils.rmdir ignores Errno::ENOTEMPTY, so, in such cases, this
+ assertion is nonsense.
- * dir.c (dir_initialize): use rb_gc_for_fd for ENOMEM
- * ext/socket/init.c (rsock_socket): ditto
- * ext/socket/socket.c (rsock_socketpair): ditto
- * internal.h (rb_gc_for_fd): prototype
- * io.c (rb_gc_for_fd): remove static
- [ruby-core:71623] [Feature #11727]
+Thu Aug 15 15:49:35 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 24 06:46:27 2015 Eric Wong <e@80x24.org>
+ * process.c (rb_clock_gettime): [DOC] FreeBSD 7.1 supports
+ CLOCK_THREAD_CPUTIME_ID.
+ http://www.freebsd.org/releases/7.1R/relnotes.html
- * io.c (rb_gc_for_fd): new helper function
- (ruby_dup): use rb_gc_for_fd
- (rb_sysopen): ditto
- (rb_fdopen): ditto
- (rb_pipe): ditto
- [ruby-core:71623] [Feature #11727]
+Thu Aug 15 14:30:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Nov 24 05:13:35 2015 Eric Wong <e@80x24.org>
+ * include/ruby/win32.h, win32/Makefile.sub, win32/win32.c
+ (clock_gettime): [experimental] emulates clock_gettime(2) of posix.
- * ext/fiddle/function.c (struct nogvl_ffi_call_args):
- new struct for GVL release
- (nogvl_ffi_call): new function
- (function_call): adjust for GVL release
- [ruby-core:71642] [Feature #11607]
- * ext/fiddle/closure.c (struct callback_args):
- new struct for GVL acquire
- (with_gvl_callback): adjusted original callback function
- (callback): wrapper for conditional GVL acquire
- * ext/fiddle/depend: add dependencies
- * ext/fiddle/extconf.rb: include top_srcdir for internal.h
- * internal.h (ruby_thread_has_gvl_p): expose for fiddle
- * vm_core.h (ruby_thread_has_gvl_p): moved to internal.h
- * test/fiddle/test_function.rb (test_nogvl_poll): new test
+Thu Aug 15 02:32:40 2013 Zachary Scott <e@zzak.io>
-Mon Nov 23 19:53:12 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * hash.c (rb_hash_aset): [DOC] Document key dup patch by @kachick
+ [Fixes GH-382] https://github.com/ruby/ruby/pull/382
- * configure.in: On Solaris, with gcc, "-std=iso9899:1999"
- in $ansi_options is often also needed in CPPFLAGS,
- because some feature definitions vary depending on such
- standards options.
+Wed Aug 14 14:28:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Mon Nov 23 12:54:39 2015 Hamish Morrison <hamishm53@gmail.com>
+ * proc.c (rb_mod_define_method): now they return the symbols of the
+ defined methods, not the methods/procs themselves.
+ [ruby-dev:42151] [Feature #3753]
- * configure.in: remove obsolete workarounds for Haiku.
+ * NEWS: documents about above change and def-expr (see r42337).
- * dln.c, file.c, io.c: remove obsolete Haiku workarounds.
+ * test/ruby/test_module.rb: tests about above change.
- * thread_pthread.c: add stack bounds detection for Haiku.
+Wed Aug 14 00:51:14 2013 Tanaka Akira <akr@fsij.org>
- * signal.c: get stack pointer from signal context on Haiku.
- [ruby-core:67923] [Bug #10811] [Fix GH-1109]
+ * bignum.c (bigdivrem_restoring): xn argument removed.
+ (bigdivrem_normal): Follow the above change.
-Mon Nov 23 11:44:11 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Wed Aug 14 00:18:39 2013 Tanaka Akira <akr@fsij.org>
- * gems/bundled_gems: bump version to minitest-5.8.3
+ * bignum.c (big_div_struct): Remove xn and j field. Add zn field.
+ (bigdivrem1): Follow the above change.
+ (bigdivrem_restoring): Ditto.
-Mon Nov 23 08:55:00 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Aug 13 23:38:17 2013 Tanaka Akira <akr@fsij.org>
- * ChangeLog: fix wrong reference for r52714
+ * bignum.c (big_div_struct): ynzero field removed.
+ (bigdivrem1): Follow the above change.
+ (bigdivrem_restoring): Ditto.
-Sun Nov 22 22:23:37 2015 Rei Odaira <Rei.Odaira@gmail.com>
+Tue Aug 13 23:01:16 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (rb_raw_obj_info): fix compile errors when USE_RGENGC
- is 0.
+ * bignum.c (bigdivrem_restoring): Extracted from bigdivrem_normal.
-Sun Nov 22 21:58:09 2015 Naohisa Goto <ngotogenome@gmail.com>
+Tue Aug 13 22:12:59 2013 Kenichi Kamiya <kachick1@gmail.com>
- * lib/cmath.rb: methods which has suffix '!' are now deprecated.
- Re-apply r52469 made by Kazuki Tanaka, with fixing bug about
- mathn.rb compatibility. [ruby-core:68528] [Feature #10974]
+ * random.c (rb_random_ulong_limited): coerce before check negative.
+ [Fixes GH-379]
-Sun Nov 22 19:36:51 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Aug 13 21:52:15 2013 Kenichi Kamiya <kachick1@gmail.com>
- * ext/openssl/ossl.c: fix brew command for installation of openssl.
- [ci skip][fix GH-1107] Patch by @arthurnn
+ * object.c (Init_Object): undef Module#prepend_features on Class, as
+ well as Module#append_features. [Fixes GH-376]
-Sun Nov 22 17:59:50 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * test_class.rb: Added test for above. And ensure type checking
+ on similar methods as module_function.
- * configure.in: On Solaris, add -D_XOPEN_SOURCE=n only when both
- AC_TRY_CPP and AC_TRY_COMPILE pass, because some options
- (e.g. -std=iso9899:1999) are not set when running C preprocessor
- or building ext.
+Tue Aug 13 08:52:18 2013 Zachary Scott <e@zzak.io>
-Sun Nov 22 16:53:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * doc/syntax/literals.rdoc: [DOC] String literal concat by @cknadler
+ [Fixes GH-380] https://github.com/ruby/ruby/pull/380
- * compile.c (iseq_peephole_optimize): remove unreachable code
- chunk after jump/leave.
+Mon Aug 12 23:07:21 2013 Masaya Tarui <tarui@ruby-lang.org>
- * parse.y: move dead code elimination of logical operation to
- compile.c. not to warn logical operation of literal constants.
+ * gc.c (gc_marks_test): inhibit gc for st's operation.
-Sun Nov 22 16:37:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 12 15:59:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_peephole_optimize): eliminate always/never
- branches after a literal object and when the value is used after
- the branch.
+ * parse.y (parser_whole_match_p): treat CR in middle of a line as a
+ mere whitespace.
-Sun Nov 22 01:23:43 2015 Naohisa Goto <ngotogenome@gmail.com>
+Mon Aug 12 15:16:58 2013 Koichi Sasada <ko1@atdot.net>
- * configure.in: Add -D_XOPEN_SOURCE=500 (or 600 or 700) on Solaris
- if available, mainly for enabling some features in sockets.
+ * class.c (rb_prepend_module): make T_ICLASS object shady because
+ this T_ICLASS object seems to share method table with other class
+ objects. It was causes WB miss.
+ TODO: need to know the data structure.
-Sun Nov 22 00:17:22 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * test/ruby/test_module.rb: add a test for WB miss.
- * test/socket/test_socket.rb (test/socket/test_socket.rb): skip
- the test when Socket::SO_TIMESTAMP is not defined. Fix error
- on Solaris 10. [Bug #11728] [ruby-dev:49377]
+Mon Aug 12 13:47:54 2013 Zachary Scott <e@zzak.io>
-Sat Nov 21 18:57:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c: [DOC] RDoc formatting of Process.clock_gettime
- * ruby.c (need_argument): move frozen-string-literal-debug option
- from --enable to --debug. [Feature #11725]
+Mon Aug 12 13:29:09 2013 Zachary Scott <e@zzak.io>
- * ruby.c (proc_options): fix pointer overrun. do not advance argv
- until it is valid.
+ * lib/yaml/dbm.rb: [DOC] Document call-seq for YAML::DBM
-Sat Nov 21 13:59:09 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Aug 12 12:57:26 2013 Zachary Scott <e@zzak.io>
- * ext/digest/sha1/extconf.rb: OpenSSL's struct name for SHA1 is
- SHA_CTX. http://openssl.org/docs/man0.9.8/crypto/SHA1.html
+ * ext/dbm/extconf.rb: [DOC] Hide from RDoc
+ Some libraries might want to document extconf.rb so RDoc treats it
+ like any other ruby program. However, DBM users shouldn't care about
+ these methods.
-Sat Nov 21 13:31:52 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Aug 12 12:53:39 2013 Zachary Scott <e@zzak.io>
- * ext/digest/*/*.[ch]: include ruby.h before digest.h to avoid
- including ext/digest/extconf.h. [Bug #3231]
- https://msdn.microsoft.com/library/36k2cdd4.aspx
+ * ext/dbm/dbm.c: [DOC] Reformat headings of DBM class
- * ext/digest/*/extconf.rb: remove ext/digest from include search path
- to avoid confusion of cl.exe.
+Mon Aug 12 12:46:31 2013 Zachary Scott <e@zzak.io>
- * ext/digest/*/*.[ch]: explicitly specify def.h's path.
+ * lib/yaml.rb, lib/yaml/: [DOC] Document YAML::DBM#key and add
+ references to similar methods with more detail. This patch brings
+ lib/yaml to 100% documentation coverage.
-Sat Nov 21 13:05:16 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Aug 12 02:51:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/openssl/ossl.h: LibreSSL doesn't have and need e_os2.h.
+ * ext/readline/readline.c (readline_s_set_input): on OS X with editline,
+ Readline.readline doesn't work because readline_get doesn't use
+ rl_getc. The difference is introduced by r42402 [ruby-dev:47509]
+ [Bug #8644]. Before it rb_io_stdio_file set ifp->stdio_file.
+ Therefore add manually setting the value.
-Sat Nov 21 09:18:10 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/readline/readline.c (readline_s_set_output): ditto.
- * thread_sync.c: reduce the specification of Queue#close.
- * Queue#close accepts no arguments.
- * deq'ing on closed queue returns nil, always.
- [Feature #10600]
+Sun Aug 11 23:27:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/thread/test_queue.rb: catch up this fix.
+ * file.c (rb_str_encode_ospath): OS path encoding on Mac OS X is also
+ fixed.
-Sat Nov 21 08:44:21 2015 Koichi Sasada <ko1@atdot.net>
+Sun Aug 11 22:57:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_compile_each): add debug information to NODE_STR
- strings as default.
- [Feature #11725]
+ * test/ruby/test_require.rb (assert_require_nonascii_path): OS path
+ encoding on Windows is fixed, so encoding of __FILE__ should be it.
+ [ruby-core:56498] [Bug #8764]
- * insns.def (freezestring): add new instruction to support adding
- debug information for dynamically constructed strings.
+Sun Aug 11 19:11:45 2013 Kouhei Sutou <kou@cozmixng.org>
- * compile.c (iseq_compile_each): support adding debug information
- for NODE_DSTR with freezestring instruction.
+ * test/rexml/parser/test_sax2.rb: Expand abbreviated class name.
- * error.c (rb_error_frozen): change the debug information ID name
- id_debug_created_info and this field should have a 2 element array
- containing path and line information.
+Sun Aug 11 19:06:03 2013 Kouhei Sutou <kou@cozmixng.org>
- * defs/id.def: ditto.
+ * lib/rexml/sax2listener.rb (REXML::SAX2Listener#notationdecl): Fix
+ wrong number of arguments in the template listener.
+ [Bug #8731] [ruby-dev:47582]
+ Reported by Ippei Obayashi.
+ * test/rexml/parser/test_sax2.rb: Add tests for parsing notation
+ declarations with SAX2 API.
- * test/ruby/test_rubyoptions.rb: catch up this fix.
+Sun Aug 11 18:44:04 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/ruby/test_iseq.rb: now frozen strings are not same.
+ * lib/rexml/sax2listener.rb (REXML::SAX2Listener#elementdecl): Fix wrong
+ examples. [Bug #8731] [ruby-dev:47582]
+ Reported by Ippei Obayashi.
-Sat Nov 21 04:34:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Aug 11 18:42:13 2013 Kouhei Sutou <kou@cozmixng.org>
- * symbol.c (rb_str_intern): should not freeze the receiver itself
- unexpectedly. [ruby-core:71611] [Bug #11721]
+ * lib/rexml/parsers/sax2parser.rb
+ (REXML::Parsers::SAX2Parser#handle_entitydecl): Extract.
-Fri Nov 20 23:15:18 2015 Naotoshi Seo <sonots@gmail.com>
+Sun Aug 11 18:40:25 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/logger.rb: expose logger mutex
- [fix GH-541] Patch by @arthurnn
+ * lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
+ Fix wrong "%" position in parameter entity declaration event argument.
+ * test/rexml/parser/test_sax2.rb: Add tests for the above case.
-Fri Nov 20 15:05:28 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Aug 11 18:08:40 2013 Kouhei Sutou <kou@cozmixng.org>
- * Added missing reference of GitHub
+ * lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
+ Support NDATA in external ID entity declaration.
+ * test/rexml/parser/test_sax2.rb: Add tests for the above case.
-Fri Nov 20 14:57:01 2015 Trevor Rowe <trevorrowe@gmail.com>
+Sun Aug 11 18:07:39 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/net/http.rb: Fixed regression for Net::HTTP::PUT with "Expect-100"
- header. [fix GH-949]
- * test/net/http/test_http.rb: added test.
+ * lib/rexml/parsers/baseparser.rb
+ (REXML::Parsers::BaseParser#pull_event): Support optional NDATA
+ in external ID entity declaration.
-Fri Nov 20 14:39:56 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Aug 11 17:54:07 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/net/http.rb: set hostname before call ossl_ssl_set_session.
- [Bug #11401][ruby-core:70152][fix GH-964] Patch by @mkarnebeek
+ * NEWS (REXML::Parsers::SAX2Parser): Add about this change.
+ * lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
+ Fix wrong number of arguments. Document says "an array of the
+ entity declaration" but it passes two or more arguments.
+ This is a bug but it break backward compatibility.
+ Reported by Ippei Obayashi. [Bug #8731] [ruby-dev:47582]
+ * lib/rexml/sax2listener.rb (REXML::SAX2Listener#entitydecl): ditto.
+ The listener template accepted two arguments.
+ * test/rexml/parser/test_sax2.rb: Add tests for external ID case.
-Fri Nov 20 12:53:19 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Aug 11 17:41:41 2013 Kouhei Sutou <kou@cozmixng.org>
- * array.c: clarify docs for take_while/drop_while samples.
- [ci skip][fix GH-1028] Patch by @leriksen
+ * test/rexml/parser/test_sax2.rb: Add SAX2 API test.
-Fri Nov 20 12:48:04 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Aug 11 15:10:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/socket.c: remove mention of :UNIX in getaddrinfo().
- It's typically not a support option.
- [ci skip][fix GH-990] Patch by @eam
+ * parse.y (rb_enc_symname_type): allow ID_ATTRSET for ID_INSTANCE,
+ ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
-Fri Nov 20 12:44:06 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Aug 11 13:17:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * lib/rss/syndication.rb: Add nodoc marker for #validate_sy_updatePeriod.
- [ci skip][fix GH-1105] Patch by @davydovanton
+ * include/ruby/encoding.h: Reduce ENCODING_INLINE_MAX to 127 as this
+ should be sufficient to represent all the encodings Ruby supports.
-Fri Nov 20 09:05:21 2015 Koichi Sasada <ko1@atdot.net>
+Sun Aug 11 11:54:38 2013 Tanaka Akira <akr@fsij.org>
- * vm.c (rb_vm_cref_replace_with_duplicated_cref): added.
+ * process.c (rb_clock_gettime): New method.
+ This is accepted in the meeting:
+ https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130809
+ This method is accepted as a CRuby feature.
+ I.e. Other Ruby implementations don't need to implement it.
+ [ruby-core:56087] [Feature #8658]
- CREFs should not be shared by methods between `using'.
- [Bug #11247]
+Sun Aug 11 10:40:48 2013 Zachary Scott <e@zzak.io>
- * vm_insnhelper.c (vm_cref_replace_with_duplicated_cref): ditto.
+ * lib/time.rb: [DOC] Correcting rdoc visibility of time.rb constants
+ Reported by Tanaka Akira [ruby-core:56517]
- * vm.c (vm_cref_dup): should copy refinements correctly.
+Sun Aug 11 04:48:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * eval.c: use rb_vm_cref_replace_with_duplicated_cref().
+ * file.c (rb_str_normalize_ospath):
+ HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which
+ U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through
+ U+2FAFF are not decomposed (this avoids problems with round trip
+ conversions from old Mac text encodings).
+ http://developer.apple.com/library/mac/qa/qa1173/_index.html
+ Therefore fix r42457 to exclude the range.
- * eval_intern.h: add a decl. of
- rb_vm_cref_replace_with_duplicated_cref().
+Sun Aug 11 03:26:07 2013 Tanaka Akira <akr@fsij.org>
- * vm_eval.c (eval_string_with_cref): do not need to pass
- scope's CREF because VM can find out CREF from stack frames.
+ * bignum.c (bitsize): Fix a conditional expression.
- * test/ruby/test_refinement.rb: add a test.
+Sun Aug 11 02:44:03 2013 Zachary Scott <e@zzak.io>
-Fri Nov 20 06:52:53 2015 Eric Wong <e@80x24.org>
+ * lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]
+ https://github.com/ruby/ruby/pull/377
- * .gitattributes: new file for git users
- [ruby-core:71578] [Feature #11713]
+Sun Aug 11 01:28:52 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 19 22:35:31 2015 Tanaka Akira <akr@fsij.org>
+ * configure.in: Revert r42458.
+ It removes the HAVE_CLOCK_GETTIME from config.h.
+ http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20130809T044800Z.diff.html.gz
- * ext/socket/ancdata.c: Check buffer full and ignore MSG_TRUNC flag.
- buffer fullness is more robust to detect the message is too big for
- the buffer.
- AIX 7.1 recvmsg doesn't set MSG_TRUNC for rflags when MSG_PEEK is
- given.
+Sat Aug 10 13:53:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 19 21:55:11 2015 Koichi Sasada <ko1@atdot.net>
+ * parse.y (rb_id_attrset): allow other than ID_ATTRSET.
- * gc.c (gc_start): force to invoke GC by GC.start
- even if it is GC.disable'd.
+ * parse.y (intern_str): ditto. try stem ID for ID_INSTANCE,
+ ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
- * test/ruby/test_gc.rb: add a test.
+Sat Aug 10 12:49:50 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 19 20:08:59 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/rexml/parsers/baseparser.rb
+ (REXML::Parsers::BaseParser::CDATA_END): Use "\A" instead of "^".
+ It is not an used constant but I fix it. (Or should I remove it?)
- * gc.c: trivial performance improvements.
+Sat Aug 10 12:47:19 2013 Kouhei Sutou <kou@cozmixng.org>
- name modified
- vm1_gc_short_lived* 1.015
- vm1_gc_short_with_complex_long* 1.014
- vm1_gc_short_with_long* 1.000
- vm1_gc_short_with_symbol* 1.016
- vm1_gc_wb_ary* 1.002
- vm1_gc_wb_ary_promoted* 0.996
- vm1_gc_wb_obj* 1.045
- vm1_gc_wb_obj_promoted* 1.014
- vm3_gc 1.021
+ * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):
+ Fix wrong constant name. "]>" pattern match is the same but
+ it is used for "<!DOCTYPE" end mark not "<![CDATA[" end mark.
- * gc.c (gc_writebarrier_generational): reorder parameters to optimize
- register passing function call.
+Sat Aug 10 12:43:15 2013 Kouhei Sutou <kou@cozmixng.org>
- * gc.c (gc_writebarrier_incremental): ditto.
+ * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):
+ Use "\A" instead of "^" in document type declaration patterns
+ because they are used as the head match in content not the head
+ match in line. They don't cause any problems in the current code
+ but it should be fixed.
- * gc.c (rb_gc_writebarrier): remove LIKELY().
- LIKELY() seems to move related functions not better places.
+Sat Aug 10 12:39:00 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 19 19:45:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rexml/parse/test_document_type_declaration.rb: Add tests for
+ parsing document type declaration.
- * ruby.c (ruby_prog_init): [DOC] ARGV does not contain the name of
- the executable. [ruby-core:71561] [Bug #11711]
+Sat Aug 10 12:00:45 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 19 15:53:21 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::SYSTEM):
+ Fix loose "head" match regular expression. It doesn't cause any
+ problem in the current code but it should be fixed because readers
+ may confuse it.
+ Patch by Ippei Obayashi. Thanks!!!
- * signal.c: should also clear ruby_disable_gc.
- [Bug #11692]
+Sat Aug 10 11:58:24 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 19 15:31:45 2015 Koichi Sasada <ko1@atdot.net>
+ * test/rexml/parse/test_notation_declaration.rb (#test_system_public):
+ Add a test for PUBLIC notation and SYSTEM notation order case.
- * compile.c (iseq_compile_each): T_IMEMO/iseq objects should be
- wrap with ISeq wrappers. [Bug #11676]
+Sat Aug 10 11:31:35 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 19 15:16:12 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::PUBLIC):
+ Fix loose "head" match regular expression.
+ [Bug #8701] [ruby-dev:47551]
+ Patch by Ippei Obayashi. Thanks!!!
+ * test/rexml/parse/test_notation_declaration.rb (#test_system_public):
+ Add a test for the above case.
- * lib/rubygems: Update to RubyGems 2.5.0+ HEAD(c6b4946).
- this version includes #1114, #1314, #1322, #1375, #1383, #1387
- * test/rubygems: ditto.
+Sat Aug 10 09:20:21 2013 Zachary Scott <e@zzak.io>
-Thu Nov 19 14:14:37 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * NEWS: [DOC] typo in example reported by @moretea
+ https://github.com/ruby/ruby/commit/a39e724#commitcomment-3831489
- * win32/win32.c (finish_overlapped_socket): return value of this
- function should be only 0 or SOCKET_ERROR.
+Sat Aug 10 09:19:04 2013 Zachary Scott <e@zzak.io>
-Thu Nov 19 14:12:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c: [DOC] rdoc code formatting
- * compile.c (iseq_tailcall_optimize): apply tail call optimization
- before conversion to specialized instructions. when looking
- back from `leave` instruction, `send` instructions have been
- translated already.
+Sat Aug 10 09:12:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 19 13:57:58 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * parse.y (rb_id_attrset): check if the argument is valid type as an
+ attribute.
- * win32/win32.c (finish_overlapped_socket): ignore EMSGSIZE when input,
- because POSIX platforms just do so. fixes test errors revealed by
- r52647.
+Sat Aug 10 05:44:08 2013 Zachary Scott <e@zzak.io>
-Thu Nov 19 02:52:30 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rss/trackback.rb: [DOC] Hide RSS::Trackback from rdoc
+ Patch by Steve Klabnik [Bug #8755] [ruby-core:56456]
- * ext/socket/ancdata.c (bsock_recvmsg_internal): stretch the buffer size
- only when vmaxdatlen is nil.
+Sat Aug 10 04:52:21 2013 Tanaka Akira <akr@fsij.org>
-Thu Nov 19 02:20:11 2015 Tanaka Akira <akr@fsij.org>
+ * bignum.c (big_div_struct): Use size_t.
+ (bigdivrem1): Ditto.
+ (bigdivrem_num_extra_words): Ditto.
+ (bigdivrem_single): Ditto.
+ (bigdivrem_normal): Ditto.
+ (bary_divmod): Ditto.
- * test/socket/test_socket.rb (test_udp_recvmsg_truncation): rflags is
- nil on Solaris 10 which have no HAVE_STRUCT_MSGHDR_MSG_CONTROL.
- Reported by Naohisa Goto. [ruby-core:71557] [Bug #11709]
+Fri Aug 9 23:47:15 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 19 01:48:05 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rss/rexmlparser.rb: Remove needless REXML version check.
+ Both RSS Parser and REXML are bundled in Ruby. RSS Parser can
+ always use the latest REXML. [Bug #8754] [ruby-core:56454]
+ Patch by Steve Klabnik. Thanks!!!
- * configure.in: add -static-libgcc for mingw automatically if available.
+Fri Aug 9 22:51:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 19 00:53:26 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in (XLDFLAGS, LIBRUBYARG_STATIC): CoreFoundation framework
+ option is now needed always, regardless enable-shared.
+ [ruby-core:56467] [Bug #8759]
- * ext/extmk.rb (--extflags): new option to pass EXTLDFLAGS to children,
- especially exts.mk.
+Fri Aug 9 22:20:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk (EXTMK_ARGS): use above option.
+ * ruby.c (load_file_internal): use rb_parser_compile_string_path and
+ rb_parser_compile_file_path, String path name versions. [Bug #8753]
-Wed Nov 18 22:50:43 2015 Koichi Sasada <ko1@atdot.net>
+Fri Aug 9 07:16:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * vm_method.c (rb_class_clear_method_cache): should clear all
- RCLASS_CALLABLE_M_TBLs of all sub-classes (T_ICLASS).
+ * ext/io/console/console.c: delete redefinition of rb_cloexec_open.
+ drop support for 1.8 and 1.9 from the next release of io-console gem.
- RCLASS_CALLABLE_M_TBL() caches complemented method entries.
- It should be cleared when the modules are cleared.
- On previous version clears only for direct children.
- It is enough for normal modules because corresponding T_ICLASSes
- are direct children.
+Fri Aug 9 19:13:54 2013 Koichi Sasada <ko1@atdot.net>
- However, refinements create complex data structure. So that
- we need to clear all children (and descendants).
- [ruby-core:71423] [Bug #11672]
+ * NEWS: update about new methods for Binding.
- * vm_method.c (rb_clear_method_cache_by_class): rb_mKernel
- doesn't call rb_class_clear_method_cache, so that
- clear child T_ICLASSes.
+Fri Aug 9 18:48:09 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_refinement.rb: enable disabled test.
+ * proc.c: add Binding#local_variable_get/set/defined?
+ to access local variables which a binding contains.
+ Most part of implementation by nobu.
-Wed Nov 18 21:09:08 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_proc.rb: add a tests for above.
- * vm_method.c (prepare_callable_method_entry): use
- RCLASS_CALLABLE_M_TBL() instead of accessing a filed directly.
+ * vm.c, vm_core.h (rb_binding_add_dynavars): add a new function
+ to add a new environment to create space for new local variables.
-Wed Nov 18 17:08:18 2015 Koichi Sasada <ko1@atdot.net>
+Fri Aug 9 14:02:01 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * method.h: introduce the following field and macros.
+ * tool/make-snapshot: Fix order of priority for option parameter.
- * rb_method_definition_t::complemented_count to count shared method
- entries because of complemented method entries and separate from
- alias_count.
+Fri Aug 9 12:06:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- Shared `def' only by complemented method entries should not prevent
- method re-definition warning.
+ * file.c (rb_str_normalize_ospath): normalize to Normalization Form C
+ using CFString.
- * METHOD_ENTRY_COMPLEMENTED(me) to represent complemented method entry.
- * METHOD_ENTRY_COMPLEMENTED_SET(me) to check it as complemented me.
+Fri Aug 9 10:53:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * vm_insnhelper.c (aliased_callable_method_entry): should also
- check me->def->complemented_count.
+ * time.c (get_timeval, get_new_timeval): use rb_obj_class()
+ instead of CLASS_OF() because CLASS_OF() may return
+ a singleton class.
- * vm_method.c (method_definition_addref_complement): add to count
- complemented method entries number.
+Fri Aug 9 10:42:11 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * vm_method.c (rb_method_definition_release): release `def' iff
- alias_count == 0 and complemented_count == 0.
+ * vm_insnhelper.c (vm_invoke_block): returning from lambda proc
+ now always exits from the Proc. [ruby-core:56193] [Feature #8693]
- * test/ruby/test_module.rb: add a test.
+ * NEWS, test/ruby/test_lambda.rb: ditto. Patch by nobu.
-Wed Nov 18 17:06:19 2015 Koichi Sasada <ko1@atdot.net>
+Fri Aug 9 00:10:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (rb_raw_obj_info): fix trivial issues.
+ * enumerator.c (lazy_zip_func): fix non-single argument. fix
+ out-of-bound access and pack multiple yielded values.
+ [ruby-core:56383] [Bug #8735]
- * support SPECIAL_CONSTs.
- * fix IMEMO/ment outputs.
+Thu Aug 8 23:01:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 18 11:32:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * object.c (rb_mod_singleton_p): new method Module#singleton_class? to
+ return whether the receiver is a singleton class or not.
+ [ruby-core:51087] [Feature #7609]
- * compile.c (iseq_peephole_optimize): eliminate always/never
- branches after a literal object. this sequence typically
- appears by defined? operator for a method call on a local
- variable.
+Thu Aug 8 21:56:44 2013 Tanaka Akira <akr@fsij.org>
-Wed Nov 18 10:33:06 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * time.c (time_overflow_p): Avoid signed integer overflow.
+ (rb_time_new): Fix overflow condition.
- * ext/socket/ancdata.c (bsock_recvmsg_internal): stretch the buffer size
- when EMSGSIZE occurs on non HAVE_STRUCT_MSGHDR_MSG_CONTROL platforms
- (such as, Windows). fixes a test error revealed by r52625.
+Thu Aug 8 19:58:02 2013 Koichi Sasada <ko1@atdot.net>
-Wed Nov 18 10:12:36 2015 Eric Wong <e@80x24.org>
+ * thread.c (rb_threadptr_pending_interrupt_check_mask):
+ use RARRAY_RAWPTR() instead of RARRAY_PTR() because
+ there is no new reference.
- * ext/socket/ancdata.c (bsock_recvmsg_internal): use 4096 as
- default size to match pre-r52610, which also maps to a common
- page size.
+Thu Aug 8 19:56:52 2013 Koichi Sasada <ko1@atdot.net>
-Wed Nov 18 10:05:25 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * string.c (rb_str_format_m): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * doc/syntax/refinements.rdoc: update documentation to reflect
- recent changes.
- [ci skip] [ruby-core:71466] [Misc #11681] Patch by James Adam
+Thu Aug 8 19:55:51 2013 Koichi Sasada <ko1@atdot.net>
-Wed Nov 18 09:50:21 2015 Naotoshi Seo <sonots@gmail.com>
+ * include/ruby/ruby.h: define USE_RGENGC_LOGGING_WB_UNPROTECT.
- * test/logger/test_logdevice.rb: Fix tests of logger to make it work on
- windows (windows can not remove opened file) [Bug #11702]
+Thu Aug 8 16:44:25 2013 Koichi Sasada <ko1@atdot.net>
-Wed Nov 18 06:59:52 2015 Eric Wong <e@80x24.org>
+ * include/ruby/ruby.h: add old macro name `RUBY_EVENT_SWITCH'.
+ This macro name is obsolete because it is renamed to
+ RUBY_INTERNAL_EVENT_SWITCH, but it has compatibility problem
+ using this macro name like ruby-prof.
+ I want to remove this macro after ruby 2.1.
- * ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer
- on unspecified maxdatlen
- [ruby-core:71517] [Bug #11701]
- * ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen
- (Socket#recvmsg_nonblock): ditto
- * test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test
+Thu Aug 8 15:37:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Nov 17 19:50:06 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/coverage/test_coverage.rb (TestCoverage#test_big_code): use `1'
+ instead of `p' to get rid of a side effect.
+ Kernel#p without any argument seems to do nothing, but flushes stdout.
+ and, if stdout is redirected to file, fsync() will be called on
+ Windows. so, when running test-all on Windows with redirection, such
+ as CI environment, this test took a lot of time.
- * win32/win32.c (fstat): declare for mingw.
+Thu Aug 8 14:54:18 2013 Shugo Maeda <shugo@ruby-lang.org>
-Tue Nov 17 19:02:59 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * NEWS: add description of incompatibility introduced by r42396.
+ [ruby-core:56329] [Bug #8722]
- * configure.in (BASERUBY): use Kernel#print instead of Kernel#p because
- the baseruby may output CRLF as end of line.
+Thu Aug 8 14:50:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Nov 17 15:34:34 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
- * NEWS: Added update from Unicode 7.0.0 to 8.0.0 [ci skip]
+ * common.mk (mini): portable target to build miniruby
-Tue Nov 17 15:30:30 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
- * enc/unicode/casefold.h, name2ctype.h: Change Unicode
- Version for regular expressions from 7.0.0 to
- 8.0.0 (with help from Kimihito Matsui) [Feature #11563]
+ * common.mk (bisect): run git-bisect with miniruby
-Tue Nov 17 14:36:00 2015 Kenichi Kamiya <kachick1@gmail.com>
+ * common.mk (bisect-ruby): run git-bisect with ruby
- * lib/ostruct.rb (dig): Implement OpenStruct#dig
- [Feature #11688]
+ * tool/bisect.sh: script for git-bisect
-Tue Nov 17 14:04:14 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Aug 8 12:11:43 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/socket/lib/socket.rb (Socket#recvmsg{,_nonblock}): default values
- of clen must be nil.
+ * test/webrick/test_httpresponse.rb (test_send_body_*_chunked): these
+ expectations assumes that the IOs are binmode. fixed test failures
+ introduced at r42427 on Windows.
- * ext/socket/ancdata.c (bsock_sendmsg_internal): handle nil of clen.
- fixes test errors introduced at r52602.
+Thu Aug 8 10:27:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Nov 17 13:43:46 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * range.c (range_last): revert r42400. [Bug #8739]
- * ext/socket/lib/socket.rb: UNIXSocket is not always exists. fixes
- install error on Windows, introduced at r52601.
+Thu Aug 8 10:26:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Nov 17 11:27:23 2015 Eric Wong <e@80x24.org>
+ * file.c (rb_str_normalize_ospath): extract and move from dir.c.
- * ext/socket/lib/socket.rb (Socket#recvfrom_nonblock):
- UDPSocket#recvfrom_nonblock):
- update doc for `exception: false` and destination buffer
- [ruby-core:69542] [Feature #11229]
- [ruby-core:69543] [Feature #11242]
+Thu Aug 8 05:59:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Nov 17 11:25:05 2015 Eric Turner <ericturnerdev@gmail.com>
+ * test/openssl/test_ssl.rb: Fix test for CVE-2013-4073.
+ Patch by Antonio Terceiro. [Bug #8750] [ruby-core:56437]
- * array.c (rb_ary_dig), hash.c (rb_hash_dig): [DOC] Update
- comments describing dig methods. [Fix GH-1103]
+Thu Aug 8 03:37:38 2013 Eric Hodel <drbrain@segment7.net>
- * struct.c (rb_struct_dig): [DOC] add rdoc.
+ * lib/webrick/httpresponse.rb: Allow #body to be an IO-like object
+ that responds to #readpartial and #read.
+ [ruby-trunk - Feature #8155]
+ * NEWS: NEWS for above
+ * test/webrick/test_httpresponse.rb: Tests for above.
-Tue Nov 17 11:22:22 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
- * NEWS: Small grammatical fix [ci skip]
+Wed Aug 7 23:06:26 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Nov 17 10:12:30 2015 Eric Wong <e@80x24.org>
+ * ruby.c (Process.argv0): New method to return the original value
+ of $0. [Feature #8696]
- * ext/socket/lib/socket.rb (Socket.accept_loop): avoid exceptions
- (Socket.udp_server_recv): ditto
+Wed Aug 7 23:05:55 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Nov 17 09:59:00 2015 Eric Wong <e@80x24.org>
+ * ruby.c (Process.setproctitle): New method to change the title of
+ the running process that is shown in ps(1). [Feature #8696]
- * ext/socket/ancdata.c (bsock_sendmsg_internal): avoid arg parsing
- [ruby-core:71439] [Feature #11339]
- (rsock_bsock_sendmsg): make private, adjust for above
- (rsock_bsock_sendmsg_nonblock): ditto
- * ext/socket/rubysocket.h: adjust prototypes
- (rsock_opt_false_p): remove
- * ext/socket/basicsocket.c (rsock_init_basicsocket):
- define private methods
- * ext/socket/lib/socket.rb (BasicSocket#sendmsg): new wrapper
- (BasicSocket#sendmsg_nonblock): ditto
+Wed Aug 7 20:05:38 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 17 09:45:18 2015 Eric Wong <e@80x24.org>
+ * bignum.c (rb_big_odd_p): Check the bignum length.
+ (rb_big_even_p): Ditto.
- * ext/socket/ancdata.c (bsock_recvmsg_internal): avoid arg parsing
- (rsock_bsock_recvmsg): adjust for above change
- (rsock_bsock_recvmsg_nonblock): ditto
- [ruby-core:71439] [Feature #11339]
- * ext/socket/rubysocket.h: adjust prototypes for above
- * ext/socket/basicsocket.c (rsock_init_basicsocket):
- adjust private methods
- * ext/socket/lib/socket.rb (BasicSocket#recvmsg): wrapper method
- (BasicSocket#recvmsg_nonblock): ditto
+Wed Aug 7 19:29:26 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 17 08:36:34 2015 Eric Wong <e@80x24.org>
+ * bignum.c (dbl2big): A condition simplified.
- * ext/socket/init.c (rsock_s_accept_nonblock): avoid parsing args
- [ruby-core:71439] [Feature #11339]
- * ext/socket/rubysocket.h: adjust prototype
- * ext/socket/socket.c (sock_accept_nonblock): make private
- * ext/socket/tcpserver.c (tcp_accept_nonblock): ditto
- * ext/socket/unixserver.c (unix_accept_nonblock): ditto
- * ext/socket/lib/socket.rb (Socket#accept_nonblock):
- implement as wrapper, move RDoc
- (TCPServer#accept_nonblock): ditto
- (UNIXServer#accept_nonblock): ditto
+Wed Aug 7 16:34:30 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Nov 17 08:25:57 2015 Eric Wong <e@80x24.org>
+ * test/webrick/test_cgi.rb (TestWEBrickCGI#{start_cgi_server,test_cgi}):
+ mswin is not only mswin32 but also mswin64. [Bug #8746]
- * ext/socket/socket.c (sock_connect_nonblock):
- avoid argument parsing in C.
- [ruby-core:71439] [Feature #11339]
- * ext/socket/lib/socket.rb (Socket#connect_nonblock):
- new wrapper for private method, move RDoc
+Wed Aug 7 16:19:12 2013 Koichi Sasada <ko1@atdot.net>
-Tue Nov 17 08:16:09 2015 Eric Wong <e@80x24.org>
+ * cont.c (rb_fiber_start): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * ext/socket/init.c (rsock_s_recvfrom_nonblock):
- avoid arg parsing with C API
- [ruby-core:71439] [Feature #11339]
- * ext/socket/basicsocket.c (bsock_recv_nonblock):
- adjust for above change, make private
- * ext/socket/socket.c (sock_recvfrom_nonblock): ditto
- * ext/socket/udpsocket.c (udp_recvfrom_nonblock): ditto
- * ext/socket/lib/socket.rb (BasicSocket#recv_nonblock):
- new wrapper for private method, move RDoc
- (Socket#recvfrom_nonblock): ditto
- (UDPSocket#recvfrom_nonblock): ditto
+ * proc.c (curry): ditto.
-Mon Nov 16 21:27:54 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * proc.c (rb_proc_call): remove line break.
- * test/dtrace/helper.rb (Dtrace::TestCase#trap_probe): dtrace buffer
- size is set as 8m on Solaris (default 4m). [Bug #11697]
+Wed Aug 7 13:20:12 2013 Koichi Sasada <ko1@atdot.net>
-Mon Nov 16 20:03:14 2015 Naotoshi Seo <sonots@gmail.com>
+ * random.c (random_load): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * lib/logger.rb: Add Logger#reopen
+Wed Aug 7 12:58:23 2013 Koichi Sasada <ko1@atdot.net>
-Mon Nov 16 18:21:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (thread_start_func_2): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * object.c (rb_obj_dig): dig in nested structs too.
+Wed Aug 7 09:00:24 2013 Zachary Scott <e@zzak.io>
- * struct.c (rb_struct_dig): new method Struct#dig.
- [Feature #11688]
+ * string.c: [DOC] Description of rb_str_equal [Fixes GH-375]
+ Based on a patch by @markijbema
+ https://github.com/ruby/ruby/pull/375
-Mon Nov 16 17:41:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 7 08:30:38 2013 Zachary Scott <e@zzak.io>
- * compile.c (iseq_peephole_optimize): optimize tail calls on aref
- and aset specialized instructions.
+ * ext/openssl/ossl_hmac.c: [DOC] Documentation for OpenSSL::HMAC
+ based on a patch by @repah documenting-ruby/ruby#14
+ https://github.com/documenting-ruby/ruby/pull/14
- * compile.c (iseq_peephole_optimize): optimize replaced leave
- instruction copied to jump instruction too.
+Wed Aug 7 07:46:23 2013 Zachary Scott <e@zzak.io>
-Mon Nov 16 16:39:38 2015 Akinori MUSHA <knu@iDaemons.org>
+ * lib/rss/utils.rb: [DOC] RSS::Utils by Steve Klabnik [Bug #8745]
- * lib/set.rb: Enable frozen_string_literal.
+Wed Aug 7 07:38:39 2013 Tanaka Akira <akr@fsij.org>
- * lib/set.rb: Move << out of the begin block that ensures pop.
+ * bignum.c (nlz16): Removed.
+ (nlz32): Ditto.
+ (nlz64): Ditto.
+ (nlz128): Ditto.
+ (nlz_int): New function.
+ (nlz_long): New function.
+ (nlz_long_long): New function.
+ (nlz_int128): New function.
+ (nlz): Follow above changes.
+ (bitsize): Follow above changes.
-Mon Nov 16 16:28:30 2015 Akinori MUSHA <knu@iDaemons.org>
+Tue Aug 6 22:38:15 2013 Zachary Scott <e@zzak.io>
- * lib/set.rb (Hash#flatten!, #add?, #delete?, #collect!, #reject!,
- #select!, #^, #classify): Micro-optimize some methods for
- performance and readability.
+ * time.c: [DOC] Typo in Time overview by @sparr [Fixes GH-374]
+ https://github.com/ruby/ruby/pull/374
-Mon Nov 16 16:17:58 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Aug 6 22:35:32 2013 Zachary Scott <e@zzak.io>
- * ChangeLog: fixed accidentally commit.
+ * lib/rss/1.0.rb: [DOC] Document RSS10 by Steve Klabnik [Bug #8740]
-Mon Nov 16 16:10:51 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Aug 6 22:14:11 2013 Kouji Takao <kouji.takao@gmail.com>
- * mkconfig.rb: Add some high-level documentation.
- [ci skip][fix GH-1081] Patch by @ulfalizer
+ * ext/readline/readline.c (readline_s_delete_text): remove
+ checking "$SAFE == 4".
-Mon Nov 16 15:59:14 2015 yui-knk <spiketeika@gmail.com>
+ * ext/readline/readline.c: fix rdoc, remove "Raises SecurityError"
+ and add "Raises NotImplementedError".
- * proc.c: Add call-seq of `Method#super_method`
- [ci skip][fix GH-1094]
+Tue Aug 6 22:04:38 2013 Kouji Takao <kouji.takao@gmail.com>
-Mon Nov 16 15:58:39 2015 Kenichi Kamiya <kachick1@gmail.com>
+ * ext/readline/readline.c, test/readline/test_readline.rb: fix
+ indent.
- * struct.c: Standardize a method signature of Struct#[]=.
- [ci skip][fix GH-1095]
+Tue Aug 6 21:59:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Nov 16 15:42:36 2015 Akinori MUSHA <knu@iDaemons.org>
+ * range.c (range_last): return nil for empty range, or in the case the
+ predecessor is smaller than the begin. [Bug #8739]
- * lib/set.rb (#>=, #>, #<=, #<): Make use of Hash#>=, #>, #<, and
- #<= when comparing against an instance of the same kind.
+Tue Aug 6 21:48:31 2013 Kouji Takao <kouji.takao@gmail.com>
-Mon Nov 16 15:37:11 2015 Naotoshi Seo <sonots@gmail.com>
+ * ext/readline/readline.c (readline_s_set_point, Init_readline):
+ add Readline.point=(pos). Patched by naruse. [ruby-dev:47535]
+ [Feature #8675]
- * lib/logger.rb: Support symbol and string log level setting
+Tue Aug 6 21:14:11 2013 Kouji Takao <kouji.takao@gmail.com>
-Mon Nov 16 15:33:11 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/readline/readline.c (Init_readline, readline_s_set_output)
+ (clear_rl_outstream, readline_s_set_input, clear_rl_instream)
+ (readline_readline): fix causing SEGV if closed IO object that is
+ set Readline.input or Readline.output. Patched by akr
+ [ruby-dev:47509] [Bug #8644]
- * tool/rbinstall.rb: fix wrong permission for gem specification without
- zlib runtime. [Bug #11685][ruby-dev:49343]
+Tue Aug 6 17:56:40 2013 Koichi Sasada <ko1@atdot.net>
-Mon Nov 16 12:11:11 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * vm_insnhelper.c (vm_push_frame): change type of stack_max to size_t.
- * lib/webrick/httpauth/basicauth.rb: fix a typo.
- [ci skip][fix GH-1099] Patch by @jwworth
- * lib/webrick/httpauth/digestauth.rb: ditto.
+Tue Aug 6 17:42:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Nov 15 18:28:43 2015 Kenichi Kamiya <kachick1@gmail.com>
+ * range.c (range_last): exclude the last number of the exclusive range
+ if the end is Numeric. [ruby-dev:47587] [Bug #8739]
- * vm_method.c (set_method_visibility): should fail if the receiver
- is frozen. [ruby-core:71489] [Bug #11687]
+Tue Aug 6 17:42:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Nov 14 22:15:07 2015 Tanaka Akira <akr@fsij.org>
+ * win32/win32.c (rb_w32_conv_from_wchar): converted string to CP_UTF8
+ should have UTF-8 encoding. otherwise no conversion takes place
+ later.
- * ext/socket/lib/socket.rb: Specify frozen_string_literal: true.
+Tue Aug 6 17:21:38 2013 Koichi Sasada <ko1@atdot.net>
-Sat Nov 14 21:44:56 2015 Tanaka Akira <akr@fsij.org>
+ * vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.
+ Stack overflow check should be done *after* pushing a stack frame.
+ However, some stack overflow checking codes checked *before*
+ pushing a stack frame with iseq->stack_max.
+ To solve this problem, add a new parameter `stack_max' to specify
+ a possible consuming stack size.
- * lib/time.rb: Use "<<" to reduce string allocation.
+ * vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow
+ checking code.
-Sat Nov 14 17:45:49 2015 Tanaka Akira <akr@fsij.org>
+ * insns.def: catch up this change.
- * lib/tsort.rb: Specify frozen_string_literal: true.
+ * vm.c, vm_eval.c: ditto.
-Sat Nov 14 17:25:15 2015 Tanaka Akira <akr@fsij.org>
+ * test/ruby/test_exception.rb: add a stack overflow test.
+ This code is reported by nobu.
- * lib/resolv-replace.rb: Specify frozen_string_literal: true.
+Tue Aug 6 17:02:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Nov 14 17:00:13 2015 Tanaka Akira <akr@fsij.org>
+ * win32/win32.c (rb_w32_conv_from_wchar): use WideCharToMultiByte(),
+ as like as mbstr_to_wstr(), in the first step of the conversion from
+ WCHAR.
- * lib/time.rb: Specify frozen_string_literal: true.
+Tue Aug 6 16:14:32 2013 Shugo Maeda <shugo@ruby-lang.org>
-Sat Nov 14 16:43:02 2015 Tanaka Akira <akr@fsij.org>
+ * vm_eval.c (eval_string_with_cref): copy cref to limit the scope of
+ refinements in the eval string. [ruby-core:56329] [Bug #8722]
- * lib/open3.rb: Specify frozen_string_literal: true.
+ * test/ruby/test_refinement.rb: related test.
-Sat Nov 14 05:04:09 2015 Koichi Sasada <ko1@atdot.net>
+Tue Aug 6 12:23:12 2013 Tanaka Akira <akr@fsij.org>
- * node.h: remove old comments.
+ * bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED to
+ declare undefined memory area.
+ (bignew_1): Ditto.
-Sat Nov 14 04:55:36 2015 Koichi Sasada <ko1@atdot.net>
+ * internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c
+ (VALGRIND_MAKE_MEM_UNDEFINED): Ditto.
- * refactoring CREF related code.
+Tue Aug 6 01:40:37 2013 Zachary Scott <e@zzak.io>
- * eval_intern.h: remove unused setter functions.
- CREF_CLASS_SET()
- CREF_NEXT_SET()
- CREF_SCOPE_VISI_COPY()
+ * process.c: [DOC] Document caveats of command form of Process.spawn
+ with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]
- * eval_intern.h: rename flags:
- * NODE_FL_CREF_PUSHED_BY_EVAL_ -> CREF_FL_PUSHED_BY_EVAL
- * NODE_FL_CREF_OMOD_SHARED_ -> CREF_FL_OMOD_SHARED
- and use IMEMO_FL_USER1/2.
+Tue Aug 6 01:28:35 2013 Zachary Scott <e@zzak.io>
- * vm.c (vm_cref_new): accept push_by_eval parameter.
+ * lib/rss/0.9.rb: [DOC] Typo in example [Bug #8732]
- * vm.c (vm_cref_new_use_prev): added for rb_vm_rewrite_cref().
+Tue Aug 6 01:22:37 2013 Zachary Scott <e@zzak.io>
- * vm_insnhelper.c (vm_cref_push): accept pushed_by_eval parameter.
+ * lib/rss/2.0.rb: [DOC] Document RSS::Rss by Steve Klabnik #8740
+ * lib/rss/atom.rb: [DOC] Typo in rdoc by Steve Klabnik
- * vm_insnhelper.h: remove unused macros:
- COPY_CREF_OMOD() and COPY_CREF().
+Mon Aug 5 23:47:59 2013 Tanaka Akira <akr@fsij.org>
- * vm_eval.c, insns.def: catch up this fix.
+ * bignum.c: Rename local variables.
-Sat Nov 14 02:58:03 2015 Koichi Sasada <ko1@atdot.net>
+Mon Aug 5 22:23:59 2013 Zachary Scott <e@zzak.io>
- * vm.c (vm_define_method): refactoring.
- * get CREF in this function.
- * cbase is no longer needed (CREF_CLASS(cref) is enough).
+ * vm_trace.c: [DOC] Fix TracePoint return values in examples
+ Based on a patch by @sho-h [Fixes GH-373]
+ https://github.com/ruby/ruby/pull/373
- * compile.c: RubyVM::FrozenCore.define_method only accept 2 args.
+Mon Aug 5 17:38:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Nov 14 02:34:43 2015 Koichi Sasada <ko1@atdot.net>
+ * win32/win32.c (rb_w32_write_console): use MultiByteToWideChar() for
+ the last step of conversion to WCHAR, to get rid of warnings from
+ rb_enc_find() in miniruby. [ruby-dev:47584] [Bug #8733]
- * vm.c (vm_define_method): do not use current CREF immediately,
- but check CREF in environment or methods. Methods defined in methods
- should be public.
- [Bug #11571]
+ * win32/win32.c (wstr_to_mbstr, mbstr_to_wstr): fix wrong trimming.
+ WideCharToMultiByte() and MultiByteToWideChar() do not count
+ NUL-terminator in the size for conversion result, unless the input
+ length is -1.
- * vm_method.c (rb_scope_module_func_check): check CREF in env or me.
- if CREF is contained by `me', then return FALSE.
+Mon Aug 5 11:51:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * test/ruby/test_method.rb: add a test.
+ * include/ruby/encoding.h: document which user flags are used by
+ ENCODING_MASK for better greppability
-Sat Nov 14 02:19:16 2015 Koichi Sasada <ko1@atdot.net>
+Mon Aug 5 10:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * method.h: constify rb_cref_t::scope_visi;
+ * object.c (rb_class_inherited_p): allow iclasses to be tested for
+ inheritance. [Bug #8686] [ruby-core:56174]
- * eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix.
+ * test/ruby/test_method.rb: add test
- * vm_method.c: ditto.
+Mon Aug 5 06:13:48 2013 Zachary Scott <e@zzak.io>
-Sat Nov 14 01:53:52 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * enumerator.c: [DOC] Remove reference to Enumerator::Lazy#cycle
+ Patch by @kachick [Fixes GH-372]
+ https://github.com/ruby/ruby/pull/372
- * pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for
- optimization bug of Oracle Solaris Studio 12.4 on Solaris
- with -xO4 optimization option. [Bug #11684]
+Mon Aug 5 03:57:16 2013 Zachary Scott <e@zzak.io>
-Fri Nov 13 23:00:23 2015 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * lib/rss/0.9.rb: [DOC] Document RSS09 by Steve Klabnik [Bug #8732]
- * configure.in: unset LD_PRELOAD on mingw. msys2 child processes
- crash at make test-all with LD_PRELOAD.
- [ruby-core:71461] [Bug #11680]
+Mon Aug 5 03:35:11 2013 Zachary Scott <e@zzak.io>
-Fri Nov 13 14:00:43 2015 Zachary Scott <zzak@ruby-lang.org>
+ * lib/rexml/attribute.rb: [DOC] Update example for #namespace
+ Patch by Ippei Obayashi [Bug #8685] [ruby-core:56173]
- * ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735]
+Sun Aug 4 21:08:29 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Nov 13 13:09:16 2015 Zachary Scott <zzak@ruby-lang.org>
+ * array.c (rb_ary_zip): performance implement by using
+ ALLOCA_N() to allocate tmp buffer.
- * ext/openssl/ossl_ssl.c: Merge ruby/openssl@81e1a30
+Sun Aug 4 07:14:49 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ssl.rb: ditto
+ * README.EXT, README.EXT.ja: Mention rb_integer_pack and
+ rb_integer_unpack.
-Fri Nov 13 13:05:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Aug 4 01:54:45 2013 Tanaka Akira <akr@fsij.org>
- * prelude.rb (Thread.exclusive): warn as deprecated.
+ * bignum.c (BARY_TRUNC): New macro.
+ (bary_cmp): Use BARY_TRUNC.
+ (bary_mul_toom3): Ditto.
+ (bary_divmod): Ditto.
+ (abs2twocomp): Ditto.
+ (bigfixize): Ditto.
+ (rb_cstr_to_inum): Ditto.
+ (big2str_karatsuba): Ditto.
+ (bigdivrem): Ditto.
-Fri Nov 13 10:36:39 2015 Victor Nawothnig <Victor.Nawothnig@gmail.com>
+Sun Aug 4 00:57:58 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (new_unless): optimize constant condition for `unless`
- as well as `if`. [Fix GH-1092]
+ * bignum.c (big2str_karatsuba): Don't allocate new temporary buffer
+ if the buffer is enough for current invocation.
-Fri Nov 13 10:08:41 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sun Aug 4 00:22:34 2013 Tanaka Akira <akr@fsij.org>
- * ext/psych/psych.gemspec: bump version to 2.0.15
+ * bignum.c (bary2bdigitdbl): New function.
+ (bdigitdbl2bary): Ditto.
+ (bary_mul_single): Use bdigitdbl2bary.
+ (power_cache_get_power): Ditto.
+ (bary_divmod): Use bary2bdigitdbl.
+ (big2str_orig): Ditto.
+ (bigdivrem): Ditto.
-Thu Nov 12 18:44:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 3 22:47:11 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (parser_magic_comment): should match exactly.
- [ruby-core:71460] [Bug #11679]
+ * bignum.c: The branch condition of selecting multiplication
+ algorithms should check smaller argument because Karatsuba and Toom3
+ is effective only if both arguments are big.
+ (bary_mul_toom3_branch): Compare the smaller argument to
+ TOOM3_MUL_DIGITS.
+ (bary_mul): Compare the smaller argument to KARATSUBA_MUL_DIGITS.
-Thu Nov 12 16:16:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 3 22:23:31 2013 Tanaka Akira <akr@fsij.org>
- * template/prelude.c.tmpl: enable tail call optimization.
+ * bignum.c (big2str_orig): Receive the number to stringize as
+ BDIGIT array and size.
+ (big2str_karatsuba): Receive the number to stringize as BDIGIT array
+ and size. Use an temporary array of BDIGIT.
+ (rb_big2str1): Follow the above change.
-Thu Nov 12 14:17:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 3 13:30:04 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (parser_yylex): ANDDOT at the head of the line denote
- line continuation from previous one to support fluent interface,
- as well as single dot.
+ * bignum.c (MAX_BASE36_POWER_TABLE_ENTRIES): Renamed from
+ MAX_BIG2STR_TABLE_ENTRIES.
+ (base36_power_cache): Renamed from big2str_power_cache.
+ (base36_numdigits_cache): Renamed from big2str_numdigits_cache.
-Thu Nov 12 13:49:50 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Aug 3 10:33:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems: Update to RubyGems 2.5.0+ HEAD(db78980).
- this version includes #1367 , #1373 , #1375
- * test/rubygems: ditto.
+ * parse.y (parser_set_integer_literal): use rb_rational_raw1() for
+ integral rational because no reduction is needed with 1.
-Thu Nov 12 10:53:41 2015 Eric Wong <e@80x24.org>
+Sat Aug 3 09:46:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * benchmark/bm_io_nonblock_noex2.rb: new benchmark based
- on bm_io_nonblock_noex.rb
- * io.c (io_read_nonblock): move documentation to prelude.rb
- (io_write_nonblock): ditto
- (Init_io): private, internal methods for prelude.rb use only
- * prelude.rb (IO#read_nonblock): wrapper + documentation
- (IO#write_nonblock): ditto
- [ruby-core:71439] [Feature #11339]
+ * ext/etc/etc.c (setup_passwd, setup_group): set proper encodings to
+ string members.
-Wed Nov 11 18:30:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 3 09:30:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * sprintf.c (rb_str_format): look up the key, then get default
- value and raise KeyError if the returned value is nil.
- [ruby-dev:49338] [Ruby trunk - Bug #11677]
+ * struct.c (rb_struct_define_under): new function to define Struct
+ under the given namespace, not under Struct. [Feature #8264]
-Wed Nov 11 17:38:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/etc/etc.c: use rb_struct_define_under.
- * vm_eval.c (local_var_list_add): skip internal local variable
- name by its type but not if it has a name. internal local
- variable names are just unique per frame, not globally.
- [ruby-core:71437] [Bug #11674]
+Sat Aug 3 06:55:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Nov 11 14:14:33 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * parse.y (value_expr_gen): now NODE_DEFN and NODE_DEFS are not void
+ value expressions. get rid of wrong warning with -w, and make to
+ pass tests with chkbuild. ref. [Feature #3753]
- * transcode.c: fix a typo
- [ci skip][fix GH-1091] Patch by @jwworth
+Sat Aug 3 04:23:48 2013 Eric Hodel <drbrain@segment7.net>
-Wed Nov 11 11:58:38 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * doc/syntax/refinements.rdoc: Remove mention of instance_eval and
+ module_eval from scope section per:
+ http://twitter.com/shugomaeda/status/363219951336693761
- * lib/net/ftp.rb (initialize): Connections are in passive mode per
- default now. The default mode can be changed by
- Net::FTP.default_passive=.
- [ruby-core:71146] [Feature #11612]
+Sat Aug 3 02:22:05 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/ftp.rb (default_passive=, default_passive): new methods.
+ * bignum.c (big2str_orig): Refactored.
-Wed Nov 11 09:03:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 3 01:20:19 2013 Tanaka Akira <akr@fsij.org>
- * sprintf.c (rb_str_format): respect default value of a hash. no
- longer raises KeyError unless the default value of the hash is
- nil. [ruby-core:71354] [Bug #11661]
+ * bignum.c (bigadd_core): Removed.
+ (bigadd): Use bary_add instead of bigadd_core.
-Tue Nov 10 20:35:12 2015 Tanaka Akira <akr@fsij.org>
+Sat Aug 3 00:52:43 2013 Tanaka Akira <akr@fsij.org>
- * lib/open-uri.rb: Remove indicator for "frozen_string_literal: true".
+ * bignum.c (rb_big2str1): Simplify power_level calculation.
- * lib/pp.rb: Ditto.
+Sat Aug 3 00:34:20 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/prettyprint.rb: Ditto.
+ * array.c (rb_ary_zip): use rb_ary_new2() to create buffer
+ if rb_block_arity() > 1.
- * lib/resolv.rb: Ditto.
+Sat Aug 3 00:12:00 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/securerandom.rb: Ditto.
+ * NEWS: Add the description that IO#seek supports SEEK_DATA
+ and SEEK_HOLE.
- * lib/tmpdir.rb: Ditto.
+Fri Aug 2 23:57:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/unicode_normalize/tables.rb: Ditto.
+ * vm.c (m_core_define_method, m_core_define_singleton_method): now
+ the value of def-expr is the Symbol of the name of the method, not
+ nil.
+ ref. [ruby-dev:42151] [Feature #3753]
- * test/net/ftp/test_buffered_socket.rb: Ditto.
+ * test/ruby/test_syntax.rb (TestSyntax#test_value_of_def): test for
+ above changes.
- * test/net/ftp/test_mlsx_entry.rb: Ditto.
+Fri Aug 2 23:54:11 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/open-uri/test_open-uri.rb: Ditto.
+ * array.c (rb_ary_zip): performance improvement by avoiding
+ array creation if rb_block_arity() > 1.
- * test/open-uri/test_ssl.rb: Ditto.
+Fri Aug 2 23:50:53 2013 Tanaka Akira <akr@fsij.org>
- * test/pathname/test_pathname.rb: Ditto.
+ * bignum.c (power_cache_get_power): Apply bigtrunc to the result of
+ bigsq.
+ (big2str_karatsuba): Fix number of leading zero characters.
- * test/test_pp.rb: Ditto.
+Fri Aug 2 23:48:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/test_prettyprint.rb: Ditto.
+ * parse.y (parser_yylex): calculate denominator directly as powers of
+ ten, not parsing string.
- * tool/transcode-tblgen.rb: Ditto.
+ * parse.y (parser_number_literal_suffix): return bit set of found
+ suffixes.
- * ext/pathname/lib/pathname.rb: Ditto.
+ * parse.y (parser_set_number_literal, parser_set_integer_literal):
+ split from parser_number_literal_suffix to set yylval.
-Tue Nov 10 18:42:24 2015 Aleksandrs Ledovskis <aleksandrs@ledovskis.lv>
+ * parse.y (parser_yylex): parse rational number literal with decimal
+ point precisely.
- * defs/id.def, parse.y: Switch internal token name to reflect
- current form of safe-call operator. [Fix GH-1090]
+ * parse.y (simple_numeric): integrate numeric literals and simplify
+ numeric rules.
-Tue Nov 10 18:25:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/ripper/eventids2.c (ripper_init_eventids2): ripper support for
+ new literals, tRATIONAL and tIMAGINARY.
- * hash.c (rb_hash_to_proc): use rb_func_proc_new to make light
- weight proc. [Feature #11653]
+Fri Aug 2 18:33:28 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 10 18:23:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (big2str_karatsuba): Reduce power_level more than one at
+ recursion, if possible.
+ (rb_big2str1): Follow the above change.
- * proc.c (cfunc_proc_t): add room for me.
+Fri Aug 2 12:25:15 2013 Tanaka Akira <akr@fsij.org>
- * proc.c (cfunc_proc_new): generalise for cfunc proc without env.
+ * bignum.c (bary_mul): Swap x and y for bary_mul1 if x is longer than y.
+ [ruby-dev:47565] [Bug #8719] Reported by Narihiro Nakamura.
- * proc.c (rb_func_proc_new, rb_func_lambda_new): new functions to
- make proc/lambda without env from cfunc.
+Fri Aug 2 10:39:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Nov 10 17:32:35 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * parse.y (negate_lit): add T_RATIONAL and T_COMPLEX to the switch
+ statement, and call rb_bug() if an unknown type is passed to
+ negate_lit(). [ruby-core:56316] [Bug #8717]
- * bootstraptest/test_fork.rb ([ruby-dev:37934]): :NPROC (RLIMIT_NPROC)
- is not supported on some platforms (e.g. Solaris 10).
+ * bootstraptest/test_literal_suffix.rb (assert_equal): add test
-Tue Nov 10 16:57:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 2 09:14:47 2013 Eric Hodel <drbrain@segment7.net>
- * hash.c (rb_hash_to_proc): new method Hash#to_proc.
- [Feature #11653]
+ * doc/syntax/refinements.rdoc: Improve description of where you may
+ activate refinements.
-Tue Nov 10 14:34:09 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Aug 2 07:45:55 2013 Tanaka Akira <akr@fsij.org>
- * time.c (rb_time_timespec_new): swap utc and localtime
- to generate gmt flag by INT_MAX - gmtoff.
+ * bignum.c (big2str_orig): Remove len argument.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Follow above change.
-Tue Nov 10 14:01:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Aug 2 02:32:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * hash.c (rb_hash_{le,lt,ge,gt}): new methods, Hash#<=, Hash#<,
- Hash#>=, Hash#>, to test if all elements of a hash are also
- included in another hash, and vice versa.
- [ruby-core:68561] [Feature #10984]
+ * NEWS: Add the description of number literal suffixes.
-Tue Nov 10 11:25:29 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Aug 2 00:02:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * time.c (rb_timespec_now): added. [Feature #11558]
+ * bootstraptest/test_literal_suffix.rb: add two test cases to
+ examine that "1if true" and "1rescue nil" are recognized as 1.
- * time.c (rb_time_timespec_new): added. [Feature #11558]
+Thu Aug 1 23:45:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Tue Nov 10 06:17:17 2015 Eric Wong <e@80x24.org>
+ * rational.c (rb_flt_rationalize_with_prec): new public C function
+ to rationalize a Float instance with a precision.
- * variable.c (rb_autoload_load): allow recursive calls
- [ruby-core:71345] [Bug #11658]
- * test/ruby/test_autoload.rb (test_autoload_while_autoloading):
- new test by: Hiroshi Shirosaki <h.shirosaki@gmail.com>
- [ruby-core:71390]
+ * rational.c (rb_flt_rationalize): new public C function to
+ rationalize a Float instance. A precision is calculated from
+ the given float number.
-Tue Nov 10 00:36:46 2015 Tanaka Akira <akr@fsij.org>
+ * include/ruby/intern.h: Add rb_flt_rationalize_with_prec and
+ rb_flt_rationalize.
- * lib/resolv.rb (Resolv::DNS::Message::MessageEncoder#put_labels):
- Prevent overflow of pointer to labels.
- Patch by Hannes Georg. [ruby-core:71248] [Bug #11632]
+ * parse.y: implement number literal suffixes, 'r' and 'i'.
+ [ruby-core:55096] [Feature #8430]
-Tue Nov 10 00:25:41 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+ * bootstraptest/test_literal_suffix.rb: add tests for parser to scan
+ number literals with the above tsuffixes.
- * gems/bundled_gems: update to power_assert 0.2.6.
+Thu Aug 1 23:55:08 2013 Tanaka Akira <akr@fsij.org>
-Mon Nov 9 21:48:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_big2str1): Remove a local variable.
- * vm_eval.c (rb_check_funcall_default): split from
- rb_check_funcall to return the given fallback value.
+Thu Aug 1 23:33:01 2013 Tanaka Akira <akr@fsij.org>
- * object.c (rb_obj_dig): use rb_check_funcall_default so that tail
- call optimization will be possible. [Feature #11643]
+ * bignum.c (rb_cstr_to_inum): Use power_cache_get_power.
-Mon Nov 9 21:27:23 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Aug 1 21:02:48 2013 Tanaka Akira <akr@fsij.org>
- * array.c (rb_ary_dig): new method Array#dig.
+ * bignum.c (rb_big2str1): Raise an error for too big number.
- * hash.c (rb_hash_dig): new method Hash#dig.
+Thu Aug 1 20:46:29 2013 Tanaka Akira <akr@fsij.org>
- * object.c (rb_obj_dig): dig in nested arrays/hashes.
- [Feature #11643]
+ * bignum.c (power_cache_get_power): Hide cached Bignum objects.
-Mon Nov 9 18:00:47 2015 Yuki Nishijima <mail@yukinishijima.net>
+Thu Aug 1 19:15:05 2013 Tanaka Akira <akr@fsij.org>
- * gems/bundled_gems: Upgrade the did_you_mean gem to 1.0.0.beta3
+ * bignum.c (rb_big2str1): Remove non-trim mode.
+ (rb_big2str0): Non-trim mode implemented here.
+ (big2str_find_n1): Change the result type to long again.
+ (big2str_base_powerof2): Don't take arguments: len and trim.
+ (rb_big2str): Follow above change.
-Mon Nov 9 17:38:14 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Aug 1 12:37:58 2013 Tanaka Akira <akr@fsij.org>
- * test/runner.rb: use official repository for coverage tool.
- * Makefile.in: ditto.
- * common.mk: ditto.
- * .gitignore: ignored third party repositories.
+ * bignum.c (big2str_alloc): New function to allocate the result string.
+ It is called after actual length is calculated.
+ (big2str_struct): Add fields: negative, result and ptr.
+ (big2str_orig): Write out the result via b2s->ptr.
+ (big2str_orig): Ditto.
+ (rb_big2str1): Don't allocate the result string at beginning.
-Mon Nov 9 17:29:09 2015 Shugo Maeda <shugo@ruby-lang.org>
+Thu Aug 1 07:36:27 2013 Tanaka Akira <akr@fsij.org>
- * compile.c (iseq_compile_each): Dynamic string literals should be
- frozen.
- [ruby-core:57574] [Feature #8976]
+ * bignum.c (big2str_orig): Use temporary buffer when trim mode.
-Mon Nov 9 15:56:07 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Aug 1 06:28:48 2013 Tanaka Akira <akr@fsij.org>
- * common.mk: Use ruby organization url for simplecov repository.
+ * bignum.c (big2str_orig): Simplified because RBIGNUM_LEN(x) <= 2 now.
+ (big2str_struct): Two fields added: hbase2, hbase2_numdigits.
+ (rb_big2str1): Initialize above fields.
-Sun Nov 8 16:24:09 2015 Masaki Matsushita <glass.saga@gmail.com>
+Thu Aug 1 04:06:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: describe addition of File::TMPFILE
+ * lib/rdoc/options.rb (RDoc#finish): include root path in include
+ paths, to work in another directory than the source directory.
+ [ruby-core:56282] [Bug #8712]
-Sun Nov 8 15:19:17 2015 Masaki Matsushita <glass.saga@gmail.com>
+ * test/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#setup):
+ fix input_file_name, as the test script is not pre-processed.
- * file.c: Add O_TMPFILE.
+Thu Aug 1 01:45:18 2013 Tanaka Akira <akr@fsij.org>
-Sun Nov 8 14:24:43 2015 windwiny <windwiny.ubt@gmail.com>
+ * bignum.c (big2str_karatsuba): Fix a condition of power_level.
- * method.h (METHOD_ENTRY_{VISI,BASIC,FLAGS}_SET): suppress
- shift-op-parentheses warnings. [Fix GH-1082]
+Thu Aug 1 01:09:02 2013 Tanaka Akira <akr@fsij.org>
-Sun Nov 8 14:01:22 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Removed.
+ (KARATSUBA_BIG2STR_DIGITS): Removed.
+ (big2str_numdigits_cache): New variable.
+ (power_cache_get_power): Merged with power_cache_get_power0.
+ This function returns maxpow_in_bdigit_dbl(base)**(2**power_level).
+ (rb_big2str1): use power_cache_get_power.
- * ext/psych/psych_emitter.c: backport 5bd7744 from tenderlove/psych.
- support backward compatibility of Ruby 2.0
+Wed Jul 31 23:59:28 2013 Tanaka Akira <akr@fsij.org>
-Sun Nov 8 10:55:10 2015 Anton Davydov <antondavydov.o@gmail.com>
+ * bignum.c (big2str_find_n1): Change the return type to size_t.
+ (big2str_orig): Ditto.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Follow the above changes.
- * io.c (rb_io_gets_m): Update IO#gets doc for characters more than
- 1 byte. [Fix GH-1085]
+Wed Jul 31 23:19:06 2013 Tanaka Akira <akr@fsij.org>
-Sun Nov 8 10:37:58 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (power_cache_get_power): Change numdigits_ret to size_t *.
+ (big2str_orig): Change len argument to size_t.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Follow the above changes.
- * lib/uri/ftp.rb: fix a typo.
- [fix GH-1084][ci skip] Patch by @windwiny
+Wed Jul 31 22:59:47 2013 Kouhei Sutou <kou@cozmixng.org>
-Sun Nov 8 08:10:31 2015 Koichi Sasada <ko1@atdot.net>
+ * test/rexml/parse/test_notation_declaration.rb: Change class
+ name to follow file name change.
- * vm_trace.c (exec_hooks_precheck): check need_clean everytime
- to clean-up unused hooks.
+Wed Jul 31 22:57:50 2013 Kouhei Sutou <kou@cozmixng.org>
- * vm_trace.c (list->need_clean): use as boolean value.
+ * test/rexml/test_notationdecl_parsetest.rb: Rename to ...
+ * test/rexml/parse/test_notation_declaration.rb: ... this.
-Sun Nov 8 01:31:27 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Jul 31 22:54:39 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/net/http.rb (Net::HTTP#initialize):
- default value of Net::HTTP#open_timeout is now 60 (was nil).
+ * test/rexml/test_notationdecl_mixin.rb: Remove duplicated tests.
-Sat Nov 7 12:18:05 2015 Eric Wong <e@80x24.org>
+Wed Jul 31 22:52:55 2013 Kouhei Sutou <kou@cozmixng.org>
- * string.c (id_to_s): remove redundant variable
- (rb_obj_as_string): trade id_to_s for idTo_s
- (rb_str_equal): replace rb_intern(...) with pre-defined ID
- (rb_str_cmp_m): ditto
- (rb_str_match): ditto
- (str_upto_each): ditto
- (rb_str_sum): ditto
- (Init_String): remove id_to_s initialization
+ * test/rexml/test_notationdecl_parsetest.rb: Fix typos in expected
+ value.
+ pubilc ->
+ public
+ ^^
-Sat Nov 7 11:40:05 2015 Eric Wong <e@80x24.org>
+Wed Jul 31 22:50:51 2013 Kouhei Sutou <kou@cozmixng.org>
- * thread.c (rb_cThreadShield): make static
+ * test/rexml/test_notationdecl_parsetest.rb: Add tests that focus
+ system literal in external ID system notation declaration.
-Sat Nov 7 09:51:38 2015 Koichi Sasada <ko1@atdot.net>
+Wed Jul 31 22:36:21 2013 Tanaka Akira <akr@fsij.org>
- * vm_trace.c (rb_threadptr_exec_event_hooks_orig):
- maintain trace_running counter on internal events.
+ * bignum.c (bary_cmp): Extracted from rb_big_cmp.
+ (power_cache_get_power): Change n1 argument (number of digits) to
+ power_level which is just passed to power_cache_get_power0.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Calculate the initial power_level.
- This patch is made by Takashi Kokubun <takashikkbn@gmail.com>.
- [Bug #11603] https://github.com/ruby/ruby/pull/1059
+Wed Jul 31 22:04:36 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Nov 7 03:32:27 2015 Koichi Sasada <ko1@atdot.net>
+ * test/rexml/test_notationdecl_parsetest.rb: Fix a typo.
+ Extern ID ->
+ ExternalID
+ ^^
- * include/ruby/ruby.h (RSTRUCT_PTR): need a close parenthesis.
+Wed Jul 31 22:01:36 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Nov 7 01:32:06 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * test/rexml/test_notationdecl_parsetest.rb: Add tests that focus
+ public ID in external ID notation declaration.
- * dir.c (dir_fileno, dirfd): support of Dir#fileno on Solaris 10.
- Solaris 10 does not have dirfd, but the file descriptor of a
- directory is stored in the d_fd or dd_fd member in the DIR struct.
- Note that Solaris 11 has dirfd(3C).
+Wed Jul 31 22:01:24 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * configure.in: checks for DIR.d_fd and DIR.dd_fd on Solaris 10.
+ * parse.y: fix build error with bison-3.0.
-Fri Nov 6 23:13:53 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+Wed Jul 31 21:58:53 2013 Kouhei Sutou <kou@cozmixng.org>
- * array.c: clarifies Array#reject! documentation.
- [fix GH-894][ci skip] Patch by @GxSplinter
+ * test/rexml/test_notationdecl_parsetest.rb: Split test patterns.
-Fri Nov 6 20:18:25 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Wed Jul 31 21:42:33 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/runner.rb: extracted test helper.
- * test/lib/zombie_hunter.rb: ditto.
+ * test/rexml/test_notationdecl_parsetest.rb: Group tests.
-Fri Nov 6 18:07:47 2015 Naohisa Goto <ngotogenome@gmail.com>
+Wed Jul 31 21:37:51 2013 Kouhei Sutou <kou@cozmixng.org>
- * include/ruby/ruby.h (rb_array_const_ptr, rb_struct_const_ptr):
- Suppress pointer type mismatch warnings occurred with old version
- of Fujitsu C Compiler (fcc) on Solaris 10. The warnings cause
- failure of TestMkmf::TestConvertible. [Bug #11644] [ruby-dev:49326]
- * include/ruby/ruby.h (FIX_CONST_VALUE_PTR): macro for the above,
- only effective with fcc.
+ * test/rexml/test_notationdecl_mixin.rb (TestNotationDecl#test_name):
+ Move to ...
+ * test/rexml/test_notationdecl_parsetest.rb
+ (TestNotationDecl#test_name): ... here.
-Fri Nov 6 12:39:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 31 21:37:47 2013 Kouhei Sutou <kou@cozmixng.org>
- * defs/id.def (token_ops), parse.y (parser_yylex): change DOTQ
- from ".?" to "&.". [ruby-core:71363] [Feature #11537]
+Wed Jul 31 21:31:49 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Nov 6 09:01:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rexml/test_notationdecl_parsetest.rb: Remove setup because it
+ doesn't share anything with other tests.
- * parse.y (kwd_append): fix segv after invalid keyword argument,
- preceding keyword list is NULL when syntax error is there.
- [ruby-core:71356] [Bug #11663]
+Wed Jul 31 21:24:55 2013 Kouhei Sutou <kou@cozmixng.org>
-Fri Nov 6 06:59:37 2015 Eric Wong <e@80x24.org>
+ * test/rexml/test_attributes_mixin.rb: Remove a needless shebang.
+ * test/rexml/test_notationdecl_mixin.rb: ditto.
+ * test/rexml/test_doctype.rb: ditto.
+ * test/rexml/test_xml_declaration.rb: ditto.
+ * test/rexml/test_changing_encoding.rb: ditto.
- * test/ruby/test_autoload: hoist out ruby_impl_require
+Wed Jul 31 21:20:08 2013 Kouhei Sutou <kou@cozmixng.org>
-Thu Nov 5 13:03:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rexml/test_notationdecl_parsetest.rb: remove a needless shebang.
- * defs/id.def (token_ops): gather associations between IDs,
- operators, and parser tokens.
+Wed Jul 31 20:11:01 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Nov 5 10:17:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_rindex): fix bug introduced in r42269.
+ "".rindex("") should return 0.
+ (str_rindex): ditto.
- * ext/socket/socket.c (make_addrinfo): use RARRAY_ASET for
- write-barrier.
+Wed Jul 31 19:55:33 2013 Tanaka Akira <akr@fsij.org>
- * ext/tk/tcltklib.c ({call,eval,invoke}_queue_handler): ditto.
+ * bignum.c (MAX_BIG2STR_TABLE_ENTRIES): Use SIZEOF_SIZE_T.
+ (power_cache_get_power0): Add rb_bug call for too bit i argument.
+ (power_cache_get_power): Simplified.
- * ext/tk/tkutil/tkutil.c (ary2list, ary2list2): ditto.
+Wed Jul 31 18:32:25 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Nov 5 10:09:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/uri/common.rb (URI.decode_www_form_component): Use String#b.
- * ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR.
- pointed out by hanmac.
- https://github.com/ruby/ruby/commit/3553a86#commitcomment-14187670
+Wed Jul 31 18:24:02 2013 Shugo Maeda <shugo@ruby-lang.org>
-Wed Nov 4 17:33:24 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * eval.c (rb_mod_refine, mod_using, top_using): don't show
+ warnings because Refinements are no longer experimental.
+ [ruby-core:55993] [Feature #8632]
- * lib/debug.rb: Add documentation for #thread_list_all.
- [Misc #11580][ci skip]
+ * test/ruby/test_refinement.rb: related test.
-Wed Nov 4 15:45:59 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * NEWS: fixes for the above change.
- * class.c: fix documentation for rb_define_class{_id}_under.
- [fix GH-991][ci skip] Patch by @kachick
+Wed Jul 31 17:55:55 2013 Shota Fukumori <her@sorah.jp>
-Wed Nov 4 15:40:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/uri/common.rb (URI.decode_www_form_component):
+ Don't raise error when str includes multibyte characters.
- * method.h: fix typo. Patch by @davydovanton
- [fix GH-1076][ci skip]
+Wed Jul 31 17:45:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-Wed Nov 4 15:39:32 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * string.c (rb_str_rindex): performance improvement by using
+ memrchr(3).
- * hash.c: use correct grammar. Patch by @tveastman
- [fix GH-1079][ci skip]
+Wed Jul 31 16:43:30 2013 Masaki Matsushita <glass.saga@gmail.com>
-Wed Nov 4 11:38:23 2015 Jake Worth <jakeworth82@gmail.com>
+ * string.c (rb_str_rindex): refactoring and avoid to call str_nth() if
+ pos == 0.
- * process.c (proc_getsid): [DOC] Fix double word 'for' and typo.
- [Fix GH-1080]
+Wed Jul 31 14:41:36 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Nov 4 06:01:52 2015 Eric Wong <e@80x24.org>
+ * lib/set.rb: [DOC] Add a couple of notes on Hash as storage.
+ ref. [Feature #6589]
- * include/ruby/ruby.h (struct RObject): hide iv_index_tbl type
- [ruby-core:71306] [Feature #11647]
+Wed Jul 31 14:38:52 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Nov 3 06:48:58 2015 Eric Wong <e@80x24.org>
+ * lib/set.rb: [DOC] Fix example result. Hash is now ordered.
- * variable.c (find_class_path): remove cast for rb_class_ivar_set
- (rb_ivar_set): ditto
- (rb_cvar_set): ditto
+Wed Jul 31 14:38:10 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Nov 3 06:18:21 2015 Eric Wong <e@80x24.org>
+ * lib/set.rb: [DOC] Use the term "sorted" instead of "ordered"
+ when mentioning SortSet.
- * variable.c (rb_global_tbl): convert to id_table
+Wed Jul 31 12:18:47 2013 Tanaka Akira <akr@fsij.org>
-Tue Nov 3 01:58:46 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * bignum.c (big2str_struct): New structure.
+ (big2str_orig): Use big2str_struct.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str1): Ditto.
- * parse.y (NO_QCALL): fix type mismatch of operands that causes
- compile error with Oracle Solaris Studio on Solaris.
- [Bug #11645] [ruby-dev:49327]
+Wed Jul 31 12:02:16 2013 Zachary Scott <e@zzak.io>
-Sun Nov 1 17:14:36 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/rubygems.rb: [DOC] typo in url patch by @Red54 [Fixes #369]
+ https://github.com/ruby/ruby/pull/369
- * id_table.c (mix_id_table_insert): do not touch list during
- list->hash transition because GC can run during transition.
+Wed Jul 31 07:09:07 2013 Eric Hodel <drbrain@segment7.net>
-Sun Nov 1 11:07:31 2015 Eric Wong <e@80x24.org>
+ * lib/rubygems: Import RubyGems from master as of commit 523551c
+ * test/rubygems: ditto.
- * iseq.c (iseq_memsize): account for rb_call_cache entries
+Tue Jul 30 22:21:54 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Nov 1 09:12:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_hash.rb: add a test for enumeration order of Hash.
- * parse.y (parser_yylex): ':' separated by a comment and a newline
- is not valid as symbol.
+Tue Jul 30 18:52:27 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat Oct 31 20:15:48 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/set.rb (Set#intersect?, Set#disjoint?): Add new methods for
+ testing if two sets have any element in common.
+ [ruby-core:45641] [Feature #6588] Based on the code by marcandre.
- * test/openssl/test_pair.rb: skipped tests if openssl doesn't support
- ECDH cipher.
+Tue Jul 30 17:16:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Oct 31 14:58:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
+ characters.
- * man/ruby.1 (SYNOPSIS): remove extraneous space for -F option as
- it does not allow spaces before its argument.
- [ruby-core:71283] [Bug #11641]
+Tue Jul 30 11:00:52 2013 Zachary Scott <e@zzak.io>
-Sat Oct 31 14:58:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/curses/extconf.rb: [DOC] nodoc to reduce Object pollution
- * man/ruby.1 (SYNOPSIS): remove extraneous space for -F option as
- it does not allow spaces before its argument.
- [ruby-core:71283] [Bug #11641]
+Tue Jul 30 08:19:42 2013 Tanaka Akira <akr@fsij.org>
-Sat Oct 31 10:22:49 2015 yui-knk <spiketeika@gmail.com>
+ * sizes.c (Init_sizes): Define sizes only if the type actually exists.
- * eval_error.c (undef_mesg_for): fix typo. Before this commit
- `ArgumentError: malformed format string - %$` was raised when
- `NameError#message` is called. [ruby-core:71282] [Bug #11640]
- [Fix GH-1077]
+Mon Jul 29 22:55:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Oct 30 21:12:45 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+ * sizes.c (Init_sizes): define RbConfig::SIZEOF. [Feature #8568]
- * gems/bundled_gems: update to power_assert 0.2.5.
+Mon Jul 29 22:25:20 2013 Zachary Scott <e@zzak.io>
-Fri Oct 30 19:29:52 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/curses/curses.c: [DOC] Update location of samples
+ * samples/curses/*: Move Curses samples and refactor from mixin
+ The samples are included in rdoc for module and use of mixin is
+ confusing
- * gc.c (newobj_slowpath): do not need to use flags hack (commit miss).
+Mon Jul 29 22:16:11 2013 Tanaka Akira <akr@fsij.org>
-Fri Oct 30 19:08:48 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed from
+ LOG2_KARATSUBA_DIGITS.
+ (KARATSUBA_BIG2STR_DIGITS): Renamed from KARATSUBA_DIGITS.
- * gc.c (heap_get_freeobj_from_next_freepage): not so UNLIKELY.
+Mon Jul 29 22:04:45 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Oct 30 18:09:51 2015 Koichi Sasada <ko1@atdot.net>
+ * hash.c (rb_hash_compare_by_id): add function prototype.
- * gc.c (newobj_slowpath): reduce 1 parameter to use only registers
- for performance.
+Mon Jul 29 21:53:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- On my laptop, 'N.times{x = []}' (where N = 29_000_000) is
- 1.86 sec -> 1.74 sec.
+ * hash.c (rb_hash_compare_by_id): don't call rb_hash_rehash()
+ if self.compare_by_identity? == true.
-Fri Oct 30 12:53:21 2015 yui-knk <spiketeika@gmail.com>
+Mon Jul 29 21:29:48 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/ruby/test_call.rb: added test for safe navigation operator.
- [fix GH-1066]
+ * hash.c (rb_hash_assoc): performance improvement by replacing
+ compare function in RHASH(hash)->ntbl->type temporarily like r42224.
+ it falls back to rb_hash_foreach() if st_lookup() doesn't find the key.
-Fri Oct 30 12:47:34 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * test/ruby/test_hash.rb: add a test for above.
- * ChangeLog: fix wrong commit name.
+Mon Jul 29 21:15:30 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Oct 30 12:36:16 2015 yui-knk <spiketeika@gmail.com>
+ * test/ruby/test_lazy_enumerator.rb
+ (TestLazyEnumerator#test_initialize): Make sure
+ Enumerator::Lazy#initialize raises error if the object is
+ frozen. The check was performed by rb_ivar_set() before
+ rb_check_frozen() was added to enumerator_init().
- * vm_method.c: added documentation of protected/private methods.
- [fix GH-1072]
- * test/ruby/test_module.rb: added testcase for method_defined?
- [fix GH-1071]
+Mon Jul 29 21:06:42 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Oct 30 12:06:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enumerator.c (enumerator_init): Add a frozenness check to
+ prevent a frozen Enumerator object from being reinitialized with
+ a different enumerable object. This is the least we should do,
+ and more fixes will follow. [Fixes GH-368] Patch by Kenichi
+ Kamiya.
- * variable.c (rb_class_ivar_set): rename as class specific ivar
- setter, and st_table is no longer involved.
+ * enumerator.c (generator_init): Ditto.
-Fri Oct 30 11:36:33 2015 Eric Wong <e@80x24.org>
+Mon Jul 29 20:14:24 2013 Masaki Matsushita <glass.saga@gmail.com>
- * variable.c (generic_ivar_remove): adjust type, set valp
- (rb_obj_remove_instance_variable): simplify call
- * test/ruby/test_object.rb (test_remove_instance_variable):
- expand for implementation details
+ * hash.c (rb_hash_assoc): revert r42224. table->type->compare is
+ called only if hashes are matched.
-Fri Oct 30 10:37:56 2015 Eric Wong <e@80x24.org>
+ * test/ruby/test_hash.rb: add a test to check using #== to compare.
- * internal.h (rb_st_insert_id_and_value): update prototype
- * variable.c (rb_st_insert_id_and_value): reduce args
- (find_class_path): adjust call for less args
- (rb_ivar_set): ditto
- (rb_cvar_set): ditto
- * class.c (rb_singleton_class_attached): ditto
+Mon Jul 29 17:00:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Oct 30 09:57:22 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * parse.y (yycompile): store file name as String to keep the encoding.
- * gems/bundled_gems: update latest gems.
- test-unit-3.1.5 and minitest-5.8.2
+ * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path):
+ new functions to pass file name as a String.
-Fri Oct 30 09:54:05 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * parse.y (gettable_gen): return a copy of the original file name, not
+ a copy in filesystem encoding.
- * lib/rubygems: Update to RubyGems HEAD(60d7972).
- this version contains pull requests number of #1343, #1356, #1357, #1363
- at https://github.com/rubygems/rubygems/pulls
- * test/rubygems: ditto.
+ * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)".
-Fri Oct 30 07:38:29 2015 Koichi Sasada <ko1@atdot.net>
+Mon Jul 29 16:53:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * insns.def (getinlinecache/setinlinecache): compare ic->ic_cref and
- current cref only when cached CREF list includes singleton class.
+ * hash.c (rb_hash_initialize_copy): copy st_table type even if empty.
+ [ruby-core:56256] [Bug #8703]
- Singleton classes have own namespaces, so that we need to check
- cref as a key (#10943).
+Mon Jul 29 16:34:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- However, if current CREF list does not include singleton class,
- no need to check CREF because it should be same name space.
+ * hash.c (rb_hash_initialize_copy): clear old table before copy new
+ table.
- * vm_insnhelper.c (vm_get_const_key_cref): add a function returns
- CREF only when it includes singleton class.
+Mon Jul 29 16:34:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h: constify iseq_inline_cache_entry::ic_cref.
+ * hash.c (rb_hash_assoc): aggregate object can be initialized only
+ with link time constants.
-Fri Oct 30 06:43:50 2015 Koichi Sasada <ko1@atdot.net>
+Mon Jul 29 14:54:44 2013 Masaki Matsushita <glass.saga@gmail.com>
- * vm_insnhelper.c (vm_env_cref): make it inline for performance.
+ * hash.c (rb_hash_assoc): performance improvement by replacing
+ compare function in RHASH(hash)->ntbl->type temporarily.
- * vm_insnhelper.c (rb_vm_get_cref): use NULL instead of 0.
+Mon Jul 29 14:52:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Oct 30 06:20:40 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/mkmf.rb (xsystem): expand environment variable in all macros not
+ expanded with RbConfig. [Bug #8702]
- * insns.def: nobody set ic->ic_value.value to Qundef.
+ * test/mkmf/test_framework.rb (create_framework): replace all $@ not
+ only once.
-Fri Oct 30 06:15:50 2015 Koichi Sasada <ko1@atdot.net>
+Mon Jul 29 06:54:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c: add ifndef guard for VM_CHECK_MODE.
+ * win32/win32.c (rb_w32_pipe): use enum for compile time constants,
+ instead of const int for debugging.
-Fri Oct 30 06:13:10 2015 Koichi Sasada <ko1@atdot.net>
+Mon Jul 29 00:11:49 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_check_frame_detail): should require me for
- VM_FRAME_FLAG_BMETHOD type frame.
+ * bignum.c (bigdivrem): Specialized implementation added for
+ nx == 2 && ny == 2
-Thu Oct 29 18:42:30 2015 Koichi Sasada <ko1@atdot.net>
+Sun Jul 28 20:28:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * gc.c (gc_mark_ptr): specify NOINLINE so that gc_mark() can return
- immediately when obj is not a markable object.
+ * io.c (io_getpartial): use rb_str_locktmp_ensure().
+ [ruby-core:56121] [Bug #8669]
-Thu Oct 29 18:05:22 2015 Koichi Sasada <ko1@atdot.net>
+ * io.c (rb_io_sysread): ditto.
- * encoding.c (rb_enc_check_str): add for performance.
- This function only accepts T_STRING (and T_REGEXP).
+ * test/ruby/test_io.rb: add tests for above.
- This patch improves performance of a tiny_segmenter benchmark
- (num=2) 2.54sec -> 2.42sec on my machine.
- https://github.com/chezou/TinySegmenter.jl/blob/master/benchmark/benchmark.rb
+Sun Jul 28 20:10:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * encoding.c: add ENC_DEBUG and ENC_ASSERT() macros.
+ * ext/extmk.rb (extmake): should make static libraries for extensions
+ to be statically linked. [Bug #7948]
- * internal.h: add a decl. of rb_enc_check_str().
+Sun Jul 28 17:38:32 2013 Masaki Matsushita <glass.saga@gmail.com>
- * string.c (rb_str_plus): use rb_enc_check_str().
+ * string.c: add internal API rb_str_locktmp_ensure().
- * string.c (rb_str_subpat_set): ditto.
+ * io.c (io_fread): use rb_str_locktmp_ensure().
+ [ruby-core:56121] [Bug #8669]
-Thu Oct 29 17:16:40 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_io.rb: add a test for above.
- * internal.h: export rb_wb_(un)protected_newobj_of()
- because some extensions include internal.h.
+Sun Jul 28 13:04:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-Thu Oct 29 16:42:19 2015 Koichi Sasada <ko1@atdot.net>
+ * io.c (interpret_seek_whence): support SEEK_DATA and SEEK_HOLE.
+ These are whences for lseek(2) supported by Linux since version 3.1.
+ [ruby-core:56123] [Feature #8671]
- * gc.c (rb_imemo_new): should not pass FL_WB_PROTECTED flag.
+ * test/ruby/test_io.rb: Add tests for above.
- * gc.c (rb_wb_protected_newobj_of): add more assertions.
+Sun Jul 28 12:41:39 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (rb_wb_unprotected_newobj_of): ditto.
+ * bignum.c (absint_numwords_generic): The char_bit variable changed
+ to static constant.
-Thu Oct 29 16:20:26 2015 Koichi Sasada <ko1@atdot.net>
+Sun Jul 28 12:03:23 2013 Tanaka Akira <akr@fsij.org>
- * gc.c: introduce rb_wb_unprotected_newobj_of() and
- rb_wb_protected_newobj_of(), pass the WB_PROTECTED
- information explicitly.
+ * bignum.c: Constify bary_* functions.
- * internal.h: use introduced functions by NEWOBJ_OF().
- `flag' is immediate value, so that C compilers can
- solve them at compile time.
+Sun Jul 28 11:12:07 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/ruby.h: add a comment about that.
+ * include/ruby/intern.h (rb_absint_size): Declaration moved from
+ internal.h to calculate required buffer size to pack integers.
+ (rb_absint_numwords): Ditto.
+ (rb_absint_singlebit_p): Ditto.
+ [ruby-core:42813] [Feature #6065]
-Thu Oct 29 14:52:03 2015 Koichi Sasada <ko1@atdot.net>
+Sun Jul 28 10:54:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c: add rb_objspace::flags::has_hook to represent hook availability.
+ * win32/win32.c (rb_w32_pipe): fix pipe name formatting. as "%x" may
+ not contain '0' at all, fill at fixed position instead.
- * gc.c: add gc_event_hook_available_p(objspace) to check that flag.
+Sun Jul 28 00:35:14 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (newobj_of): use gc_event_hook_available_p() instead of
- checking gc_event_hook_needed_p(objspace, RUBY_INTERNAL_EVENT_NEWOBJ).
- for performance.
+ * bignum.c (rb_big_size): Return the bignum "bytewise" size.
+ [ruby-core:55578] [Feature #8553]
+ This is accepted by matz on DevelopersMeeting20130727Japan.
- * gc.c (newobj_init): add UNLIKELY() for FL_WB_PROTECTED flag.
+Sun Jul 28 00:07:48 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (newobj_init): change parameters order (trivial change).
+ * include/ruby/intern.h (rb_integer_pack): Declaration moved from
+ internal.h.
+ (rb_integer_unpack): Ditto.
+ [ruby-core:42813] [Feature #6065]
-Thu Oct 29 14:45:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 26 23:18:13 2013 Kouhei Sutou <kou@cozmixng.org>
- * vm_core.h (rb_thread_struct): move forward declarations before
- used.
+ * NEWS: Add a new feature that REXML::Parsers::StreamParser
+ supports "entity" event.
-Thu Oct 29 14:07:54 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jul 26 23:14:31 2013 Kouhei Sutou <kou@cozmixng.org>
- * gc.c (gc_mark_ptr): remove debug code for #11244.
+ * lib/rexml/parsers/streamparser.rb
+ (REXML::Parsers::StreamParser#parse): Add "entity" event support to
+ listener. [Bug #8689] [ruby-dev:47542]
+ Reported by Ippei Obayashi.
+ * test/rexml/test_stream.rb (StreamTester#entity): Add a test for
+ the above case.
-Thu Oct 29 10:08:33 2015 Eric Wong <e@80x24.org>
+Fri Jul 26 23:05:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (struct autoload_state): usable as wait-queue head
- (struct autoload_data_i): remove 2 words of overhead
- (autoload_i_mark): remove marking for thread
- (autoload_reset): adjust for struct changes
- (rb_autoload): ditto
- (rb_autoloading_value): ditto
- (rb_autoload_load): ditto
- (const_update): ditto
+ * parse.y (parser_yylex): separate numeric literal from succeeding
+ token, and treat 'e' as floating point number only if followed by
+ exponent part.
-Thu Oct 29 08:48:05 2015 Eric Wong <e@80x24.org>
+Fri Jul 26 22:14:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (struct autoload_data_i): add waitq_head
- (struct autoload_state): new struct
- (autoload_require): save result in autoload_state for use
- in autoload_reset
- (autoload_reset): wake up other waiters with open-coded
- wait-queues
- (rb_autoload_load): add ensure autoload_const_set happens
- atomically w.r.t. autoload-triggered "require"
- [ruby-core:70075] [ruby-core:71239] [Bug #11384]
+ * vm_exec.h (CHECK_VM_STACK_OVERFLOW_FOR_INSN): surround with
+ do/while (0), and remove unnecessary casts.
-Wed Oct 29 00:39:50 2015 Naohisa Goto <ngotogenome@gmail.com>
+Fri Jul 26 20:12:07 2013 Akinori MUSHA <knu@iDaemons.org>
- * test/rubygems/test_gem_commands_server_command.rb
- (test_handle_options_port): change port from http to discard.
- Solaris does not include "http 80/tcp" in its default
- /etc/inet/services. AFAIK, discard (9/tcp) is older than http
- and it is expected that all OS can resolve the service name.
- [Bug #10004] [ruby-core:63518]
+ * ext/syslog/lib/syslog/logger.rb (Syslog::Logger): Add facility
+ to Syslog::Logger. [Fixes GH-305] patch by Max Shytikov
+ https://github.com/ruby/ruby/pull/305
-Wed Oct 28 23:52:48 2015 Naohisa Goto <ngotogenome@gmail.com>
+Fri Jul 26 19:25:17 2013 Koichi Sasada <ko1@atdot.net>
- * probes_helper.h (RUBY_DTRACE_HOOK): add RB_GC_GUARD, though paranoic.
+ * vm_exec.h, tool/instruction.rb: not an error, but a BUG if stack
+ overflow checking failed just before/after the beginning of an
+ instruction. It should be treated as a BUG.
+ Please tell us if your code cause BUG with this problem.
+ This check will removed soon (for performance).
-Wed Oct 28 15:36:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 26 18:30:14 2013 Koichi Sasada <ko1@atdot.net>
- * error.c (rb_name_err_new): store the receiver directly.
+ * array.c (ary_memcpy): cast to int to suppress a warning.
- * error.c (name_err_receiver): return directly stored receiver.
- [Feature #10881]
+Fri Jul 26 18:21:58 2013 Koichi Sasada <ko1@atdot.net>
- * error.c (name_err_mesg_to_str): quote the name if unprintable.
+ * array.c (ary_memcpy): try to enable optimization.
+ At least on my environments, I don't see any errors
+ with many trials. Please tell us if you find any GC bugs.
- * object.c (check_setter_id): use rb_check_id to convert names.
+Fri Jul 26 17:49:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (uninitialized_constant): use NameError::message to
- keep the receiver of uninitialized constant. [Feature #10881]
+ * win32/file.c (fix_string_encoding): fix target encoding. the
+ parameter `encoding' is not the target encoding but the original
+ encoding.
- * error.c (rb_name_err_new): new function to create NameError
- exception instance. [Feature #10881]
+Fri Jul 26 14:05:19 2013 Zachary Scott <e@zzak.io>
-Wed Oct 28 13:29:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/fiddle/*: [DOC] More doc on dlopen and RTLD_DEFAULT from r42184
- * parse.y (new_attr_op_assign): fix op_assign type, which is
- already an ID since r52284. [Feature #11537]
+Fri Jul 26 13:08:53 2013 Zachary Scott <e@zzak.io>
-Tue Oct 27 23:14:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/fiddle/lib/fiddle.rb: [DOC] Document Fiddle.dlopen(nil)
+ * ext/fiddle/handle.c: [DOC] Document Fiddle::Handle.new(nil)
- * defs/id.def: enable anonymous IDs not to expose internal IDs for
- frozen-string-literal-debug by Marshal.dump.
+Fri Jul 26 13:04:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Oct 27 17:06:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * load.c (rb_load_internal): use rb_load_file_str() to keep path
+ encoding.
- * defs/id.def: move internal IDs for frozen-string-literal-debug.
+ * load.c (rb_require_safe): search in OS path encoding for Windows.
-Tue Oct 27 16:41:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ruby.c (rb_load_file_str): load file with keeping path encoding.
- * error.c (rb_error_frozen_object): use rb_attr_get instead of
- rb_ivar_get to get rid of warnings for string objects created
- when frozen-string-literal-debug is disabled.
+ * win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
+ path is encoded in UTF-8. [ruby-core:56136] [Bug #8676]
-Tue Oct 27 16:18:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_str_encode_ospath): simplify using rb_str_conv_enc().
- * lib/logger.rb (Logger::Period#previous_period_end): as weekly
- rotation shifts the log file on Sundays, the end date of the
- previous period should be Saturdays. fix r45072.
- [ruby-dev:49314] [Bug #11622]
+ * win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc().
-Tue Oct 27 16:12:37 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * win32/file.c (convert_mb_to_wchar): use bare pointer instead of
+ VALUE, and remove useless argument.
- * vm_dump.c (rb_print_backtrace): our addr2line doesn't work on sparc.
- http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20151027T043311Z.log.html.gz
+Fri Jul 26 11:42:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Oct 27 12:00:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * rational.c (f_round_common): Rational is expected to be returned by
+ Rational#*, but mathn.rb breaks that assumption. [ruby-core:56177]
+ [Bug #8687]
- * lib/logger.rb (Logger::Period#next_rotate_time): get rid of
- adding to mday not to exceed the days of the month.
- [ruby-core:71185] [Bug #11620]
+Fri Jul 26 01:37:45 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Oct 26 22:43:03 2015 yui-knk <spiketeika@gmail.com>
+ * include/ruby/ruby.h: check defined(USE_RGENGC_LOGGING_WB_UNPROTECT)
- * test/ruby/test_module.rb (test_method_defined): Add test cases
- for `public/protected/private _method_defined?`
- These methods accept string as argument, so add string argument
- cases. [Fix GH-1067]
+Fri Jul 26 01:21:41 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Oct 26 22:23:30 2015 SimonDKnight <simondknight@hotmail.com>
+ * file.c (rb_file_expand_path_internal): fix r42160; skip '~'.
- * lib/racc/rdoc/grammar.en.rdoc: Grammatical errors fixed.
- [Fix GH-1070]
+Thu Jul 25 17:53:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Oct 26 18:36:43 2015 Shota Fukumori (sora_h) <her@sorah.jp>
+ * lib/net/http.rb (Net::HTTP#connect): disable Nagle's algorithm on
+ HTTP connection. [ruby-core:56158] [Feature #8681]
- * vm_method.c(rb_method_entry_make):
- [DOC] [ci skip] Remove a needless space from comment
- [Fixes GH-1069] Patch by @yui-knk
+Thu Jul 25 17:49:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Oct 26 17:30:13 2015 Ryan Hosford <tad.hosford@gmail.com>
+ * re.c (rb_reg_to_s): convert closing parenthesis to the target encoding
+ if it is ASCII incompatible encoding. [ruby-core:56063] [Bug #8650]
- * lib/fileutils.rb: rename tailing to trailing.
- [Misc #11548]
+Thu Jul 25 17:21:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Oct 26 17:11:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * encoding.c (is_obj_encoding): new macro to check if obj is an
+ Encoding. obj can be any type while is_data_encoding expects T_DATA
+ only.
- * parse.y (call_op, call_op2): fix values on ripper. [Feature #11537]
+Thu Jul 25 17:17:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Oct 26 12:55:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_file_expand_path_internal): should clear coderange after
+ copying user name as binary data.
- * parse.y (call_op2): separate from call_op and also allow "::",
- while dot_or_colon should not allow ".?". [Feature #11537]
+Thu Jul 25 16:17:55 2013 Koichi Sasada <ko1@atdot.net>
-Mon Oct 26 01:03:23 2015 Rei Odaira <Rei.Odaira@gmail.com>
+ * encoding.c (check_encoding): Check T_DATA or not.
+ is_data_encoding(obj) assumes that `obj' is T_DATA.
- * thread_pthread.c: fix compile errors when
- USE_SLEEPY_TIMER_THREAD is disabled.
+Thu Jul 25 13:06:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Oct 25 10:12:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * dir.c (dir_s_home): use rb_home_dir_of and rb_default_home_dir.
- * symbol.c (op_tbl): add DOTQ for ripper. [Feature #11537]
+ * file.c (rb_home_dir_of): split from rb_home_dir() for the home
+ directry of the given user, and the user name is a VALUE, not a bare
+ pointer. should raise if the user does not exist.
-Sat Oct 24 22:51:18 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * file.c (rb_default_home_dir): split from rb_home_dir() for the home
+ directry of the current user.
- * configure.in: fixed build failure of Haiku.
- [fix GH-984] Patch by @kallisti5
- * ext/socket/getaddrinfo.c: ditto.
- * ext/socket/getnameinfo.c: ditto.
- * ext/socket/rubysocket.h: ditto.
+Thu Jul 25 12:32:11 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 24 21:16:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/openssl/ossl.c: support additional three thread synchronization
+ functions. [ruby-trunk - Bug #8386]
- * test/fileutils/test_fileutils.rb (test_uptodate): relax error
- message format. [Feature #9025], [ruby-core:71178] [Bug #11617]
+Thu Jul 25 07:15:58 2013 Eric Hodel <drbrain@segment7.net>
-Sat Oct 24 21:06:43 2015 Shota Fukumori (sora_h) <her@sorah.jp>
+ * lib/rubygems: Import RubyGems from master as of commit 4ff70cc
+ * test/rubygems: ditto.
- * lib/mkmf.rb: Revert r45640 because it may lead to link
- with different libruby. [Bug #9760]
+Wed Jul 24 20:57:44 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 24 15:42:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (iseq_set_arguments): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * bootstraptest/test_method.rb: relax error message format.
+ * compile.c (iseq_set_exception_table): ditto.
- * test/ruby/test_arity.rb (err_mess): ditto.
- [Feature #9025], [ruby-core:71178] [Bug #11617]
+Wed Jul 24 19:49:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Oct 24 12:47:47 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is
+ a relative URI. [Bug #8645]
- * vm_insnhelper.c: improved error message for "wrong number
- of arguments", distinguishing given and expected argument
- numbers clearly. [Feature #9025]
+Wed Jul 24 18:56:06 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 24 11:57:59 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * vm_insnhelper.c (vm_expandarray): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR() because there is no new reference.
- * vm_insnhelper.c: remove the typedef redeclaration of
- vm_call_handler.
+ * vm_insnhelper.c (vm_caller_setup_args): ditto.
-Sat Oct 24 07:29:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (vm_yield_setup_block_args): ditto.
- * lib/forwardable.rb (def_instance_delegator, def_single_delegator):
- match backtraces against ::Forwardable in case the target class
- is a subclass of BasicObject and does not include Kernel.
- [ruby-core:71176] [Bug #11616]
+Wed Jul 24 18:40:11 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 24 04:10:13 2015 Koichi Sasada <ko1@atdot.net>
+ * array.c, gc.c: move ary_unprotect_logging() into
+ rb_gc_unprotect_logging() which is general version
- * iseq.c (make_compile_option_value): include frozen_string_literal*
- in a made option value.
+ * include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT
+ to enable.
- * vm_opts.h: forgot to add OPT_FROZEN_STRING_LITERAL_DEBUG
- at last commit.
+Wed Jul 24 17:37:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Oct 24 03:58:02 2015 Koichi Sasada <ko1@atdot.net>
+ * file.c (rb_file_expand_path_internal): preserve the file name
+ encoding in an exception message.
- * ruby.c: introduce --enable-frozen-string-literal-debug option.
- If this option is enabled, the modify error will be:
- can't modify frozen String (RuntimeError) =>
- can't modify frozen String, created at test.rb:3 (RuntimeError)
+Wed Jul 24 08:04:49 2013 Koichi Sasada <ko1@atdot.net>
- * iseq.h: add compile option frozen_string_literal_debug.
+ * test/-ext-/tracepoint/test_tracepoint.rb: add GC on/off to count
+ GC events strictly.
- * compile.c: catch up this fix.
+Tue Jul 23 23:19:24 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * error.c (rb_error_frozen): ditto.
+ * ext/openssl/extconf.rb (CRYPTO_THREADID): check exist or not.
- * iseq.c (set_compile_option_from_hash): ditto.
+ * ext/openssl/ossl.c (ossl_thread_id): use rb_nativethread_self()
+ implemented at r42137 to allow threads which doesn't associated with
+ Ruby thread to use openssl functions.
- * test/ruby/test_rubyoptions.rb: add a test for this fix.
+ * ext/openssl/ossl.c (Init_ossl_locks): If CRYPTO_THREADID is defined
+ (OpenSSL 1.0.0 or later has it) use CRYPTO_THREADID_set_callback()
+ instead of CRYPTO_set_id_callback() because its argument is
+ unsigned long; it may cause id collision on mswin64
+ whose sizeof(unsigned long) < sizeof(void*).
+ http://www.openssl.org/docs/crypto/threads.html
-Sat Oct 24 02:02:24 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/openssl/ossl.c (ossl_threadid_func): defined for above.
- * vm_insnhelper.c: introduce new call handler for simple ISeqs.
+Tue Jul 23 20:47:36 2013 Tanaka Akira <akr@fsij.org>
- vm_call_iseq_setup_normal_0start() is simple, however it has
- some loops/conditions depends on ISeq::param.size and
- ISeq::local_size (in vm_push_frame(), inlined into this function).
+ * bignum.c: Move functions.
- There are many simple methods which has a few parameters and local
- variables. So that this patch introduces several special functions
- generated in vm_call_iseq_optimized.inc by
- tool/mk_call_iseq_optimized.rb.
+Tue Jul 23 20:14:55 2013 Tanaka Akira <akr@fsij.org>
- This script makes
- vm_call_iseq_setup_normal_0start_Xparams_Ylocals()
- where X is 0 to 3 and Y is 1 to 6 (as current setting).
- In this case, X * Y = 24 functions are created.
+ * bignum.c (bary_divmod): Add special cases for x < y easily detected
+ and nx == 2 && ny == 2.
- These functions creates fast method dispatch by inlining
- vm_push_frame() with immediate params/locals sizes.
+Tue Jul 23 19:48:38 2013 Koichi Sasada <ko1@atdot.net>
- On my laptop, we can have the following results.
+ * thread_(pthread|win32).h: rename rb_thread_cond_t to
+ rb_nativethread_cond_t.
- vm2_method* 1.083 (8.3% faster)
- vm2_poly_method* 0.961 (3.4% slower)
+ * thread.c, thread_pthread.c, thread_win32.c, vm_core.h: catch up
+ renaming.
- It shows 8.3% faster for inner loop method dispatch (hit inline
- cache), but 3.4% slower when inline cache miss because we need
- to find a suitable call handler.
+Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@atdot.net>
- * common.mk: add a rule for vm_call_iseq_optimized.inc.
+ * thread_native.h: add rb_nativethread_self() which returns
+ current running native thread identifier.
- * tool/mk_call_iseq_optimized.rb: added.
+ * thread_[pthread|win32].c: implement rb_nativethread_self().
- * vm.c: include vm_call_iseq_optimized.inc.
+Tue Jul 23 19:34:11 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 24 01:58:50 2015 Koichi Sasada <ko1@atdot.net>
+ * thread_pthread.h, thread_win32.h: rename rb_thread_id_t to
+ rb_nativethread_id_t.
- * vm_core.h: define vm_call_handler.
+ * thread_pthread.c, vm_core.h: use rb_nativethread_id_t.
-Sat Oct 24 01:56:01 2015 Koichi Sasada <ko1@atdot.net>
+Tue Jul 23 18:56:11 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h, vm_insnhelper.h: move definition of VMDEBUG
- from vm_insnhelper.h to vm_core.h.
+ * ext/openssl/ossl.c: use system native (system provided)
+ thread locking APIs added by last commit.
+ This patch fixes [Bug #8386].
+ "rb_mutex_*" APIs control only "Ruby" threads.
+ Not for native threads.
-Sat Oct 24 01:51:01 2015 Akinori MUSHA <knu@iDaemons.org>
+Tue Jul 23 18:44:15 2013 Koichi Sasada <ko1@atdot.net>
- * NEWS: [DOC] In the new safe call syntax, arguments are evaluated
- only if a call is made.
+ * thread_native.h: added.
+ Move native thread related lines from vm_core.h.
+ And declare several functions "rb_nativethread_lock_*",
+ manipulate locking.
- * doc/syntax/calling_methods.rdoc: Fix a typo.
+ * common.mk: add thread_native.h.
-Sat Oct 24 00:38:34 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * thread.c: add functions "rb_nativethread_lock_*".
- * lib/forwardable (def_instance_delegator, def_single_delegator):
- rescue ::Exception instead of Exception in case Exception is
- defined under the target class.
- [ruby-core:71175] [Ruby trunk - Bug #11615]
+ * thread.c, thread_[pthread,win32].[ch]: rename rb_thread_lock_t
+ to rb_nativethread_lock_t to make it clear that this lock is for
+ native threads, not for ruby threads.
-Fri Oct 23 21:10:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 23 16:14:57 2013 Koichi Sasada <ko1@atdot.net>
- * error.c (name_err_mesg_to_str): separate class names from the
- receiver description.
+ * gc.c (gc_before_sweep): fix spacing.
- * vm_eval.c (make_no_method_exception, raise_method_missing): add
- format specifiers for class names.
+Tue Jul 23 15:57:11 2013 Koichi Sasada <ko1@atdot.net>
-Fri Oct 23 18:10:32 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (heap_get_freeobj): clear slot->freelist here.
+ This means that this slot doesn't have any free objects.
+ And store this slot with objspace->heap.using_slot.
- * .gitignore: ignored environmental wrapper files.
+ * gc.c (gc_before_sweep): restore objspace->freelist
+ into objspace->heap.using_slot->freelist.
+ This means that using_slot has free objects which are
+ pointed from objspace->freelist.
-Fri Oct 23 17:55:29 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (gc_slot_sweep): do not need to clear slot->freelist.
- * lib/irb.rb: Ignored assignment of STDOUT.sync = true
- when irb.rb loaded. It's affected to IDE such as Jetbrain.
- [fix GH-864] Patch by @os97673
+Tue Jul 23 09:34:49 2013 Zachary Scott <e@zzak.io>
-Fri Oct 23 16:35:08 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * sample/drb/README*.rdoc: [DOC] migrate DRb sample READMEs to rdoc
- * lib/ipaddr.rb, test/test_ipaddr.rb: Reject invalid address contained
- EOL string. Patch by @kachick [fix GH-942][Bug #11513]
+Tue Jul 23 09:28:05 2013 Zachary Scott <e@zzak.io>
-Fri Oct 23 16:03:26 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/drb/invokemethod.rb: [DOC] nodoc InvokeMethod18Mixin
- * file.c: fix indent style. [fix GH-977]
- * test/ruby/test_string.rb: indent. [fix GH-975]
- [ci skip] These patches are contributed from @yui-knk
+Tue Jul 23 08:44:37 2013 Eric Hodel <drbrain@segment7.net>
-Fri Oct 23 15:46:09 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/openssl/ossl_asn1.c (asn1time_to_time): Implement YYMMDDhhmmZ
+ format for ASN.1 UTCTime. [ruby-trunk - Bug #8664]
+ * test/openssl/test_asn1.rb: Test for the above.
- * string.c: Added method signature to include hash. It's inconsistency
- with `gsub` method signature.
- [ci skip][fix GH-1023] Patch by @danielevans
+Tue Jul 23 08:11:32 2013 Zachary Scott <e@zzak.io>
-Fri Oct 23 15:25:51 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/rexml/streamlistener.rb: [DOC] Fix examples in
+ REXML::StreamListener#entitydecl patch by Ippei Obayashi [Bug #8665]
- * lib/net/imap.rb: remove an empty comment line and -*-.
+Tue Jul 23 07:44:59 2013 Eric Hodel <drbrain@segment7.net>
-Fri Oct 23 15:20:02 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/rubygems: Import RubyGems from master as of commit b165260
+ * test/rubygems: ditto.
- * lib/net/ftp.rb (gettextfile, getbinaryfile): use the safe
- navigation operator.
+Tue Jul 23 07:14:31 2013 Tanaka Akira <akr@fsij.org>
-Fri Oct 23 13:51:33 2015 yui-knk <spiketeika@gmail.com>
+ * bignum.c (bary_mulsub_1xN): New function.
+ (bary_mul_toom3): Use bary_mulsub_1xN.
- * test_call.rb (test_safe_call): Add test cases for safe
- navigation operator assignment. [Fix GH-1064]
- Validate:
- * can assign an attribute which is `nil`
- * can "or assign" an attribute which is `nil`
+Tue Jul 23 03:32:23 2013 Tanaka Akira <akr@fsij.org>
-Fri Oct 23 11:58:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (KARATSUBA_BALANCED): New macro.
+ (TOOM3_BALANCED): Ditto.
+ (bary_mul_balance_with_mulfunc): Use KARATSUBA_BALANCED and
+ TOOM3_BALANCED.
+ (rb_big_mul_balance): Relax a condition.
+ (rb_big_mul_karatsuba): Use KARATSUBA_BALANCED.
+ (rb_big_mul_toom3): Use TOOM3_BALANCED.
+ (bary_mul_karatsuba_branch): Use KARATSUBA_BALANCED.
+ (bary_mul_toom3_branch): Use TOOM3_BALANCED.
- * compile.c (iseq_peephole_optimize): optimize lengthy safe
- navigation method chain. [Feature #11537]
+Tue Jul 23 01:34:45 2013 Tanaka Akira <akr@fsij.org>
-Fri Oct 23 10:58:41 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c (bigdivrem_mulsub): Extracted from bigdivrem1.
+ (bigdivrem1): Use bary_add.
- * lib/matrix/eigenvalue_decomposition.rb (tridiagonalize): fix
- indentation to avoid a warning when the command line option -w of
- ruby is specified.
+Mon Jul 22 18:39:52 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/matrix/eigenvalue_decomposition.rb (hessenberg_to_real_schur):
- change the name of a block parameter to avoid a warning when the
- command line option -w of ruby is specified.
+ * string.c (rb_str_enumerate_chars): specify array capa
+ with str_strlen().
-Fri Oct 23 10:49:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_enumerate_codepoints): ditto.
- * compile.c (iseq_compile_each): support safe navigation of simple
- attribute assignment. [Feature #11537]
+Mon Jul 22 18:01:33 2013 Masaki Matsushita <glass.saga@gmail.com>
- * parse.y (mlhs_node, lhs, attrset_gen): ditto. keep mid
- non-attrset as the sign of safe navigation.
+ * string.c (rb_str_enumerate_chars): specify array capa.
-Fri Oct 23 07:17:11 2015 Eric Wong <e@80x24.org>
+Mon Jul 22 17:24:14 2013 Masaki Matsushita <glass.saga@gmail.com>
- * test/io/wait/test_io_wait.rb (test_wait_eof): test return value
+ * string.c (rb_str_each_char_size): performance improvement by
+ using rb_str_length().
-Fri Oct 23 00:32:02 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Jul 22 16:32:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_ssl.c (ssl_npn_select_cb): explicitly raise error
- in ext/openssl instead of OpenSSL itself because LibreSSL
- silently truncate the selected protocol name by casting the length
- from int to unsigned char. [Bug #11369]
- Patch by Jeremy Evans <merch-redmine@jeremyevans.net>
+ * vm_eval.c (eval_string_with_cref): check by Check_TypedStruct
+ instead of rb_obj_is_kind_of.
-Fri Oct 23 00:49:45 2015 Shugo Maeda <shugo@ruby-lang.org>
+Mon Jul 22 13:19:22 2013 Koichi Sasada <ko1@atdot.net>
- * lib/un.rb (help): change the name of a block parameter to avoid
- a warning when the command line option -w of ruby is specified.
+ * array.c (ary_resize_capa): use RARRAY_RAWPTR() because
+ this code creates no new references.
-Fri Oct 23 00:22:20 2015 Josef Simanek <josef.simanek@gmail.com>
+Mon Jul 22 12:58:18 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_tr): [DOC] Escape backslash in String#tr
- documentation. [Fix GH-1063]
+ * array.c (ary_memfill): added.
-Fri Oct 23 00:19:04 2015 yui-knk <spiketeika@gmail.com>
+ * array.c (rb_ary_initialize): use ary_memfill().
- * array.c (rb_ary_collect): [DOC] Fix space of code example of
- Array#map. [Fix GH-1062]
+ * array.c (rb_ary_fill): ditto.
-Thu Oct 22 18:52:53 2015 Akinori MUSHA <knu@iDaemons.org>
+ * array.c (rb_ary_slice_bang): use RARRAY_RAWPTR() because
+ this code creates no new references.
- * vm_eval.c (rb_f_loop): When a loop is stopped by a StopIteration
- exception, return what the enumerator has returned instead of
- nil. [ruby-core:71133] [Feature #11498]
+Mon Jul 22 10:09:46 2013 Koichi Sasada <ko1@atdot.net>
-Thu Oct 22 18:25:10 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c (gc_slot_sweep): need to add empty RVALUE as freeobj.
- * lib/net/imap.rb (idle): add a new argument timeout for keep-alive.
- [ruby-core:63693] [Bug #10031]
+Mon Jul 22 09:48:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Oct 22 15:30:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_eval.c (eval_string_with_cref): use the given file name unless
+ eval even if scope is given. additional fix for [Bug #8436].
+ based on the patch by srawlins at [ruby-core:56099] [Bug #8662].
- * compile.c (iseq_peephole_optimize): peephole optimization for
- branchnil jumps.
+Mon Jul 22 09:24:19 2013 Kouji Takao <kouji@takao7.net>
- * compile.c (iseq_compile_each): generate save navigation operator
- code.
+ * ext/readline/readline.c (Init_readline): added
+ Readline.delete_text. [ruby-dev:45789] [Feature #6626]
+ * ext/readline/extconf.rb: check for rl_delete_text() in Readline library.
- * insns.def (branchnil): new opcode to pop the tos and branch if
- it is nil.
+ Thanks, Nobuyoshi Nakada, for the patch.
- * parse.y (NEW_QCALL, call_op, parser_yylex): parse token '.?'.
- [Feature #11537]
+Mon Jul 22 03:15:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Oct 22 13:16:19 2015 Guilherme Reis Campos <guilhermekbsa@gmail.com>
+ * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
+ can be omitted.
- * dir.c (ruby_brace_expand): glob brace expansion edge case fix.
- When there are closing braces '}' before a open brace '{' it
- must be ignored and considered as literal.
- [ruby-core:71138] [Bug #11609]
+Mon Jul 22 00:15:20 2013 Tanaka Akira <akr@fsij.org>
-Thu Oct 22 13:13:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_sq_fast): Refine expressions.
- * io.c (argf_next_argv): check ARGV element type, and try
- conversion if necessary. [ruby-core:71140] [Bug #11610]
+Sun Jul 21 21:08:59 2013 Tanaka Akira <akr@fsij.org>
-Thu Oct 22 11:11:16 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c (bary_mul): Use simple multiplication if yl is small.
+ (rb_cstr_to_inum): Invoke bigsq instead of bigmul0.
+ (bigsq): Re-implemented.
+ (bigmul0): Invoke bigsq if two arguments are identical.
- * test/net/ftp/test_ftp.rb: add tests for getbinaryfile and
- gettextfile.
+Sun Jul 21 09:58:19 2013 Tanaka Akira <akr@fsij.org>
-Wed Oct 21 18:34:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_mul_toom3): New function based on bigmul1_toom3.
+ (bary_mul_toom3_branch): Call bary_mul_toom3.
+ (rb_big_mul_toom3): Ditto.
+ (bigmul1_toom3): Removed.
+ (big_real_len): Ditto.
+ (big_split): Ditto.
+ (big_split3): Ditto.
- * parse.y (parser_magic_comment): allow a sole magic comment without
- indicators, neither other non-space comments. [Feature #8976]
+Sun Jul 21 08:12:16 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Tue Oct 20 12:17:56 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * proc.c (proc_to_s): use PRIsVALUE to preserve the result encoding.
- * lib/prime.rb: Add basic argument checking to Prime.prime?
- [Bug #11606]
+Sun Jul 21 03:36:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Oct 20 12:17:50 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * hash.c (rb_hash_flatten): use NUM2INT to raise TypeError on 32bit
+ platform. it's introduced by r42039
- * lib/prime.rb: Optimize Integer#prime?
- Patch by Nick Slocum [Bug #10354]
+Sun Jul 21 01:07:45 2013 Benoit Daloze <eregontp@gmail.com>
-Tue Oct 20 08:12:47 2015 Rei Odaira <Rei.Odaira@gmail.com>
+ * common.mk (help): Fix environment variable name and argument.
+ Actually it can also be a directory or any argument for
+ test/unit runner. [Fixes GH-363]
- * configure.in: pthread_getattr_np is broken on AIX.
- More specifically, the stack address and size returned are
- not correct.
+Sat Jul 20 22:44:50 2013 Zachary Scott <e@zzak.io>
-Tue Oct 20 05:54:46 2015 Eric Wong <e@80x24.org>
+ * common.mk: Document running a single test [Fixes GH-363]
+ Patch by Avdi Grimm https://github.com/ruby/ruby/pull/363
- * ext/fiddle/closure.c (callback): static function
+Sat Jul 20 22:39:56 2013 Zachary Scott <e@zzak.io>
-Mon Oct 19 10:33:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sample/*: whitespace patch by Sergio Campama [Fixes GH-364]
+ https://github.com/ruby/ruby/pull/364
- * ext/socket/init.c (rsock_raise_socket_error): get rid of a glibc
- bug. [ruby-core:71100] [Bug #11600]
+Sat Jul 20 22:33:13 2013 Zachary Scott <e@zzak.io>
-Mon Oct 19 01:26:26 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * doc/regexp.rdoc: [DOC] Fix typo in example [Fixes GH-365]
+ Patch by Juanito Fatas https://github.com/ruby/ruby/pull/365
- * file.c (rb_file_identical_p): not necessary to compare the paths after
- comparing the file indexes on Windows. designate by kosaki.
+Sat Jul 20 17:46:03 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Oct 18 21:17:27 2015 Tanaka Akira <akr@fsij.org>
+ * string.c (rb_str_succ): add missing case NEIGHBOR_WRAPPED.
+ r42078 caused buggy behavior like "\xFF".b -> "\x01\xFF".b
- * lib/open-uri.rb: Specify frozen_string_literal: true.
+Sat Jul 20 15:22:38 2013 Koichi Sasada <ko1@atdot.net>
-Sun Oct 18 14:37:56 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (rb_ary_resize): use simple memcpy because there are no new
+ references.
- * random.c (fill_random_bytes_urandom): add a comment why using
- O_NONBLOCK and O_NOCTTY.
+Sat Jul 20 15:02:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Oct 18 13:24:17 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * safe.c (ruby_safe_level_4_warning): define for old extension
+ libraries. [Bug #8652]
- * random.c (fill_random_bytes_syscall): use ATOMIC_SET() for
- updating try_syscall.
+Sat Jul 20 14:38:00 2013 Koichi Sasada <ko1@atdot.net>
-Sun Oct 18 13:03:52 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (ary_make_shared): make shared array shady.
+ Making non-shady shared array causes SEGV (see rubyci).
+ It seems a bug around shared array.
- * include/ruby/backward/util.h: Good-by Borland-C.
+Sat Jul 20 12:14:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Oct 18 13:03:09 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * string.c (enc_succ_char, enc_pred_char): consider wchar case.
+ [ruby-core:56071] [Bug #8653]
- * common.mk: add a comment how to use "make test-all"
+ * string.c (rb_str_succ): do not replace with invalid char.
-Sun Oct 18 12:59:22 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * encoding.c (rb_enc_code_to_mbclen): add new function which returns
+ mbclen from codepoint like as rb_enc_codelen() but 0 for invalid
+ char.
- * common.mk: add comments how to use "make benchmark"
+ * include/ruby/encoding.h (rb_enc_code_to_mbclen): declaration and
+ shortcut macro.
-Sun Oct 18 12:58:15 2015 Tanaka Akira <akr@fsij.org>
+Fri Jul 19 21:59:12 2013 Koichi Sasada <ko1@atdot.net>
- * lib/securerandom.rb: Specify frozen_string_literal: true.
+ * gc.c: declare type_name() at the beginning of file.
-Sun Oct 18 11:22:52 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 19 21:35:09 2013 Koichi Sasada <ko1@atdot.net>
- * dln.c: remove defined(__WATCOMC__).
+ * array.c: reduce shady operations.
-Sun Oct 18 11:16:33 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (rb_ary_modify, ary_make_partial, rb_ary_splice,
+ rb_ary_replace, rb_ary_eql, rb_ary_compact_bang):
+ use RARRAY_RAWPTR() instead of RARRAY_PTR().
- * lib/mkmf.rb: Good-by Borland-C.
+ * array.c (rb_ary_shift): use RARRAY_PTR_USE() without WB because
+ there are not new relations.
-Sun Oct 18 11:04:36 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (ary_ensure_room_for_unshift): ditto.
- * numeric.c: Good-by Borland-C.
- * include/ruby/backward/rubyio.h: ditto.
- * include/ruby/backward/st.h: ditto.
- * include/ruby/backward/util.h: ditto.
- * include/ruby/backward/rubysig.h: ditto.
- * include/ruby/backward/classext.h: ditto.
- * dln.c: ditto.
- * gc.c: ditto.
- * win32/resource.rb: ditto.
- * win32/dir.h: ditto.
- * ext/tk/tcltklib.c: ditto.
- * NEWS: announce that Borland-C is no longer supported.
+ * array.c (rb_ary_sort_bang): ditto.
-Sun Oct 18 10:54:52 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (rb_ary_delete_at): ditto.
- * dln.c: simplify #ifdef. _WIN32 and __CYGWIN__ are exclusive.
- see include/ruby/defines.h
- * gc.c: ditto.
- * ext/sdbm/_sdbm.c: ditto.
+ * array.c (rb_ary_reverse_m): use RARRAY_RAWPTR() because
+ there are not new relations.
-Sun Oct 18 10:42:19 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 19 20:58:20 2013 Koichi Sasada <ko1@atdot.net>
- * ruby.c (open_load_file): add a comment.
+ * array.c: reduce shade operations.
-Sun Oct 18 10:12:46 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (rb_ary_modify): use RARRAY_RAWPTR().
- * file.c (rb_file_identical_p): simplify ifdefs
+ * array.c (ary_make_substitution, rb_ary_s_create, ary_make_partial,
+ rb_ary_splice, rb_ary_resize, rb_ary_rotate_m, rb_ary_times):
+ use ary_memcpy().
-Sun Oct 18 10:01:40 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 19 19:55:28 2013 Koichi Sasada <ko1@atdot.net>
- * ChangeLog: Good-bye OS/2.
- * common.mk: ditto.
- * configure.in: ditto.
- * dln_find.c: ditto.
- * ext/Setup.emx: ditto.
- * ext/extmk.rb: ditto.
- * ext/socket/extconf.rb: ditto.
- * ext/zlib/extconf.rb: ditto.
- * file.c: ditto.
- * include/ruby/defines.h: ditto.
- * io.c: ditto.
- * lib/mkmf.rb: ditto.
- * missing/os2.c: ditto.
- * process.c: ditto.
- * ruby.c: ditto.
- * NEWS: announce OS/2 is no longer supported.
+ * array.c (ary_mem_clear): added. This operation doesn't need WB
+ because this operation creates a reference to Qnil.
-Sun Oct 18 08:50:15 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (ary_make_shared, rb_ary_store, rb_ary_shift_m,
+ rb_ary_splice, rb_ary_resize, rb_ary_fill): use ary_mem_clear()
+ instead of rb_mem_clear().
- * include/ruby/defines.h (DOSISH): add comments.
+ * array.c (ary_make_shared): use RARRAY_RAWPTR() instead of RARRAY_PTR().
-Sun Oct 18 08:26:51 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 19 19:18:51 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (fptr_finalize): don't release gvl if fptr is not writable.
- writable fd may block on close(2) when it's on NFS. But readonly
- fd doesn't. [Bug #11559]
- result: make benchmark OPTS="-p bm_require_t -e ruby-trunk -e ruby-2.2.2"
- build-ruby: 0.171
- ruby 2.3.0dev(r52151): 0.659
- ruby 2.2.0p95 (r50295): 0.834
+ * array.c: fix commit miss.
+ RGENGC_UNPROTECT_LOGGING should be 0.
-Sun Oct 18 09:32:58 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 19 19:15:30 2013 Koichi Sasada <ko1@atdot.net>
- * file.c (ruby_is_fd_loadable): this should be fail if st_mode is
- not regular file nor FIFO.
+ * array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no
+ writing.
-Sun Oct 18 09:20:17 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (rb_ary_new_from_values): use ary_memcpy().
- * ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.
+Fri Jul 19 19:07:31 2013 Koichi Sasada <ko1@atdot.net>
-Sun Oct 18 05:11:22 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * array.c (ary_memcpy): add a function to copy VALUEs into ary
+ with write barrier. If ary is promoted, use write barrier correctly.
- * ruby.c (open_load_file): reset O_NONBLOCK after open.
- Even if S_ISREG() is true, the file may be file on FUSE filesystem
- or something. We can't assume O_NONBLOCK is safe.
- Moreover, we should wait if the path is point to FIFO. That's
- FIFO semantics. GVL should be transparent from ruby script.
- Thus, just reopen without O_NONBLOCK for filling the requirements.
- [Bug #11060][Bug #11559]
+ * array.c (rb_ary_cat, rb_ary_unshift_m, rb_ary_dup,
+ rb_ary_sort_bang, rb_ary_replace, rb_ary_plus): use ary_memcpy().
- * ruby.c (loadopen_func): new for the above.
+Fri Jul 19 15:32:57 2013 Koichi Sasada <ko1@atdot.net>
- * file.c (ruby_is_fd_loadable): new. for checks loadable file type
- of not.
- * file.c (rb_file_load_ok): use ruby_is_fd_loadble()
- * internal.h: add ruby_is_fd_loadble()
+ * array.c (rb_ary_store): use RARRAY_PTR_USE() instead of RARRAY_PTR().
+ Clearing memory space doesn't need WBs.
- * common.mk: now, ruby.o depend on thread.h.
+Fri Jul 19 15:19:37 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_require.rb
- (TestRequire#test_loading_fifo_threading_success): new test.
- This test successful case that loading from FIFO.
+ * array.c (ary_ensure_room_for_push): use RARRAY_RAWPTR() instead of
+ RARRAY_PTR. In this code, there are no "write" operation.
- * test/ruby/test_require.rb
- (TestRequire#test_loading_fifo_threading_raise): rename from
- test_loading_fifo_threading. You shouldn't rescue an exception
- if you test raise or not.
- Moreover, this case should be caught IOError because load(FIFO)
- should be blocked until given any input.
+ * array.c (rb_ary_equal): ditto.
-Sat Oct 17 13:55:32 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (recursive_equal): ditto.
- * file.c (rb_file_expand_path_internal): concatenate converted
- string to the result instead of making converted string and
- append it.
+Fri Jul 19 15:09:22 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_cat_conv_enc_opts): from rb_str_conv_enc_opts,
- separate function to concatenate with transcoding.
+ * gc.c, internal.h (rb_gc_writebarrier_remember_promoted): add a new
+ function to remember an specified object. This api is only
+ experimental (strongly depend on WB/rgengc strategy).
-Sat Oct 17 13:19:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 19 14:56:00 2013 Koichi Sasada <ko1@atdot.net>
- * ruby.c (load_file): unify each preparations and clean-ups by
- merging load_file_internal and load_file_internal2, and remove
- nested rb_protect and rb_ensure.
+ * array.c (ary_unprotect_logging): use (void *) for first parameter
+ because VALUE is not defined before including ruby/ruby.h.
-Sat Oct 17 05:28:32 2015 Rei Odaira <Rei.Odaira@gmail.com>
+Fri Jul 19 14:19:48 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * test/ruby/test_symbol.rb (test_symbol_fstr_leak): add a warm-up
- code and check RSS to avoid false positive on AIX and false
- negative on Mac OS X. [Bug #10686]
+ * ext/pathname/pathname.c (path_inspect): use PRIsVALUE to preserve
+ the result encoding.
-Fri Oct 16 15:54:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 19 12:35:41 2013 Tanaka Akira <akr@fsij.org>
- * file.c (rb_file_load_ok): open in non-blocking mode withoout
- releasing GVL. don't care about others than regular files and
- directories. [ruby-dev:49272] [Bug #11559]
+ * test/socket/test_tcp.rb (test_initialize_failure): Use EADDRNOTAVAIL
+ to test an error message generated by bind() failure.
- * ruby.c (load_file_internal): ditto.
+Fri Jul 19 11:27:38 2013 Zachary Scott <e@zzak.io>
-Thu Oct 15 23:56:03 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/racc/parser.rb: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * proc.c (rb_sym_to_proc): make void env.
+Fri Jul 19 11:26:28 2013 Zachary Scott <e@zzak.io>
-Thu Oct 15 13:37:23 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/psych/lib/psych*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * proc.c (rb_sym_to_proc): move from string.c and create a Proc
- with no environments. [ruby-core:71088] [Bug #11594]
+Fri Jul 19 11:25:12 2013 Zachary Scott <e@zzak.io>
-Thu Oct 15 01:57:03 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * lib/rdoc/*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * test/objspace/test_objspace.rb
- (test_trace_object_allocations_start_stop_clear): clear object
- allocation table first to get rid of erroneous detection for obj3.
- [ruby-dev:49095] [Bug #11271]
+Fri Jul 19 11:23:55 2013 Zachary Scott <e@zzak.io>
-Thu Oct 15 01:53:38 2015 Benoit Daloze <eregontp@gmail.com>
+ * lib/rubygems*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * test/ostruct/test_ostruct.rb: Add tests for OpenStruct#respond_to.
- Patch by @jeremy in [GH-1041]: https://github.com/ruby/ruby/pull/1041
+Fri Jul 19 11:16:54 2013 Akinori MUSHA <knu@iDaemons.org>
-Thu Oct 15 01:49:25 2015 Benoit Daloze <eregontp@gmail.com>
+ * lib/set.rb (Set#to_set): Define Set#to_set so that aSet.to_set
+ returns self. [Fixes GH-359]
- * lib/ostruct.rb: Finish defining OpenStruct attributes lazily.
- Patch by @sferik in [GH-1037]: https://github.com/ruby/ruby/pull/1037
- This commit is an addendum to https://github.com/ruby/ruby/pull/1033.
- It:
- 1. lazily defines attribute accessors for copied and marshaled objects,
- 2. returns nil when an attribute reader is not defined, and
- 3. defines respond_to_missing? to maintain the same respond_to? behavior
+Fri Jul 19 11:10:23 2013 Zachary Scott <e@zzak.io>
-Wed Oct 14 16:56:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rake/*: [DOC] Capitalize "Ruby" in documentation
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * configure.in: check for libunwind.h, which is not available in
- very old OS X SDK. [ruby-core:71080] [Bug #11591]
+Fri Jul 19 01:04:14 2013 Tanaka Akira <akr@fsij.org>
-Wed Oct 14 14:11:42 2015 Brian Black <bblack@veracode.com>
+ * ext/-test-/bignum/intpack.c: Renamed from ext/-test-/bignum/pack.c.
+ (Init_intpack): Renamed from Init_pack.
+ Reported by Naohisa Goto. [ruby-dev:47526] [Bug #8655]
- * iseq.c (rb_insn_operand_intern): change kw in callinfo disasm from the
- number of keyword arguments to an ordered list of the keywords used.
- [Feature #11589]
+Fri Jul 19 00:54:27 2013 Benoit Daloze <eregontp@gmail.com>
-Wed Oct 14 13:58:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_array.rb (test_count): add a test case for #count
+ with an argument. See Bug #8654.
- * parse.y (parser_nextc): send a warning to ripper, not to STDERR
- always.
+Thu Jul 18 23:45:06 2013 Masaki Matsushita <glass.saga@gmail.com>
- * parse.y (rb_warn1, rb_warning1): move argument conversions to
- callers. PRIsVALUE is not valid in String#%.
+ * array.c (rb_ary_eql): compare RARRAY_PTR() for performance
+ improvement in case of that self and other are shared.
-Wed Oct 14 13:37:23 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Jul 18 22:46:42 2013 Zachary Scott <e@zzak.io>
- * lib/racc/rdoc/grammar.en.rdoc: fix spell error.
- [fix GH-1053][ci skip] Patch by @Matrixbirds
+ * lib/cgi.rb: [DOC] Capitalize "Ruby" in documentation [Fixes GH-341]
+ Patch by Dave Worth https://github.com/ruby/ruby/pull/341
+ * lib/webrick.rb: ditto
+ * lib/scanf.rb: ditto
+ * lib/xmlrpc/config.rb: ditto
+ * lib/resolv.rb: ditto
+ * lib/e2mmap.rb: ditto
+ * lib/fileutils.rb: ditto
+ * lib/mkmf.rb: ditto
+ * lib/cgi/session.rb: ditto
+ * lib/yaml.rb: ditto
+ * lib/erb.rb: ditto
+ * lib/irb.rb: ditto
+ * lib/tracer.rb: ditto
+ * lib/net/http.rb: ditto
+ * ext/syslog/lib/syslog/logger.rb: ditto
+ * sample/pty/expect_sample.rb: ditto
-Tue Oct 13 22:06:50 2015 Tanaka Akira <akr@fsij.org>
+Thu Jul 18 21:30:50 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/raddrinfo.c (rsock_fd_family): Check sa_len.
+ * bignum.c (bary_sq_fast): Specialize the last iteration of the
+ outer loop.
+ (bigfixize): A condition simplified.
-Tue Oct 13 12:14:10 2015 Craig Davison <craig65535@gmail.com>
+Thu Jul 18 21:15:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/socket/rsock_addrinfo (rsock_addrinfo): specify address
- family. [Fix GH-1052]
+ * array.c (rb_ary_equal): compare RARRAY_PTR() for performance
+ improvement in case of that self and other are shared.
- * ext/socket/udpsocket.c (udp_connect, udp_bind, udp_send):
- address family by the receiver.
+Thu Jul 18 20:44:51 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Oct 11 07:09:19 2015 Koichi Sasada <ko1@atdot.net>
+ * array.c (rb_ary_fill): use memfill().
- * vm_insnhelper.c (vm_push_frame): initialize other than sp (and ep)
- first for performance.
+Thu Jul 18 20:35:14 2013 Benoit Daloze <eregontp@gmail.com>
-Sun Oct 11 06:21:50 2015 Koichi Sasada <ko1@atdot.net>
+ * array.c (rb_ary_count): check length to avoid SEGV
+ while iterating. Remove other pointer loop when arg is given.
- * vm_eval.c, internal.h (rb_yield_1): added for performance which
- doesn't check Qundef.
+ * test/ruby/test_array.rb (test_count): add test for bug.
+ [ruby-core:56072] [Bug #8654]
- * numeric.c (int_dotimes): use rb_yield_1.
+Thu Jul 18 18:14:36 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Oct 11 06:19:49 2015 Koichi Sasada <ko1@atdot.net>
+ * array.c (rb_ary_count): iterate items appropriately.
+ [Bug #8654]
- * vm_insnhelper.c (vm_call_iseq_setup_normal): setup sp first
- for performance.
+Thu Jul 18 17:35:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Oct 11 05:29:51 2015 Koichi Sasada <ko1@atdot.net>
+ * hash.c (rb_hash_flatten): performance improvement by not using
+ rb_hash_to_a() to avoid array creation with rb_assoc_new().
- * vm.c (invoke_block_from_c): split this function into several
- functions.
+Thu Jul 18 16:16:17 2013 Koichi Sasada <ko1@atdot.net>
- * vm_insnhelper.c (vm_yield_callee_setup_arg): remove this function
- because it is only delegation function.
+ * array.c: add logging feature for RGenGC's write barrier unprotect
+ event.
-Sun Oct 11 03:48:46 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jul 18 15:45:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (newobj_of_slowpass): fix typo (pass -> path).
- Pointed out by Yukihiro Matsumoto <matz@ruby-lang.org>.
+ * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): make only
+ rb_set_safe_level(4) an error always but make rb_secure(4) an error
+ only in the core. [ruby-dev:47517] [Bug #8652]
- * gc.c (newobj_of_...): `of' is unnecessary.
+Thu Jul 18 15:42:01 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 10 19:04:42 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h: fix spell miss.
- * ext/socket/udpsocket.c (udp_connect, udp_bind): get open files
- inside ensure functions.
+Thu Jul 18 15:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Oct 10 18:35:12 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h (ruby_safe_level_4): get rid of special
+ character. [ruby-dev:47512] [misc #8646]
- * vm_insnhelper.c (vm_call_method0): do not propagate enable_fastpath,
- but pass dummy CC to prevent wrong caching.
+Thu Jul 18 14:51:39 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 10 15:28:45 2015 Koichi Sasada <ko1@atdot.net>
+ * array.c (ary_alloc): slim setup process.
- * import a github pull request
- https://github.com/ruby/ruby/pull/1050
- by Kazuho Oku <kazuho@natadeco.co>.
+Thu Jul 18 14:37:57 2013 Koichi Sasada <ko1@atdot.net>
- This pull request has the following commits.
+ * string.c (str_alloc): no need to clear RString (already cleared).
- * gc.c: reduce # of args to 6 (max. of register args on x86-64) so
- that the `newobj_of_slowpass` can be called via TCO.
+Thu Jul 18 12:57:47 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (newobj_of), string.c (str_duplicate): for performance,
- the hot functions must be inlined.
+ * bignum.c (BDIGITS_ZERO): Defined.
+ (bary_pack): Use BDIGITS_ZERO.
+ (bary_unpack): Ditto.
+ (bary_mul_single): Ditto.
+ (bary_mul_normal): Ditto.
+ (bary_sq_fast): Ditto.
+ (bary_mul_balance_with_mulfunc): Ditto.
+ (bary_mul_precheck): Ditto.
+ (bary_mul_toom3_branch): Ditto.
+ (rb_cstr_to_inum): Ditto.
+ (big_shift3): Ditto.
+ (bigmul1_toom3): Ditto.
+ (bary_divmod): Ditto.
- * gc.c: for performance, preceding arguments of `.*newobj_of.*`
- must be same, so that the arg registers can be reused in case of
- TCO.
+Thu Jul 18 06:30:02 2013 Koichi Sasada <ko1@atdot.net>
-Sat Oct 10 08:52:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: rename gc related functions with prefix "gc_".
+ * before_gc_sweep() -> gc_before_sweep().
+ * after_gc_sweep() -> gc_after_sweep().
+ * lazy_sweep() -> gc_lazy_sweep().
+ * rest_sweep() -> gc_rest_sweep().
+ * slot_sweep() -> gc_slot_sweep().
- * ext/socket/udpsocket.c (udp_connect, udp_bind, udp_send): fix
- memory leaks at closed socket.
+ * gc.c: rename a heap management function with prefix "heap_".
+ * get_freeobj() -> heap_get_freeobj().
-Fri Oct 9 17:29:07 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c: rename markable_object_p() to is_markable_object().
- * lib/net/ftp.rb (parse257): refactor.
+Wed Jul 17 22:57:40 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Oct 9 16:42:26 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * hash.c (delete_if_i): use ST_DELETE.
- * lib/net/imap.rb: use frozen_string_literal: true.
+Wed Jul 17 22:34:47 2013 Tanaka Akira <akr@fsij.org>
- * test/net/imap/test_imap.rb: ditto.
+ * bignum.c: An static assertion for relation of SIZEOF_LONG and
+ SIZEOF_BDIGITS is added.
+ (bary_mul_precheck): Reduce comparisons.
+ (bary_mul): Invoke bary_sq_fast or bary_mul1 if the bignum size is
+ small.
+ (bigfixize): Resize the argument bignum here.
+ (bignorm): Don't call bigtrunc after bigfixize.
- * test/net/imap/test_imap_response_parser.rb: ditto.
+Wed Jul 17 22:13:26 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Oct 9 15:52:28 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * hash.c (rb_hash_replace): performance improvement by using
+ st_copy().
- * lib/net/ftp.rb: use frozen_string_literal: true.
+Wed Jul 17 17:19:54 2013 Koichi Sasada <ko1@atdot.net>
- * test/net/ftp/test_buffered_socket.rb: ditto.
+ * gc.c: rename heap management functions with prefix "heap_".
+ * allocate_sorted_array() -> heap_allocate_sorted_array().
+ * slot_add_freeobj() -> heap_slot_add_freeobj().
+ * assign_heap_slot() -> heap_assign_slot().
+ * add_heap_slots() -> heap_add_slots().
+ * init_heap() -> heap_init().
+ * set_heap_increment() -> heap_set_increment().
- * test/net/ftp/test_ftp.rb: ditto.
+ * gc.c (initial_expand_heap): inlined in rb_gc_set_params().
- * test/net/ftp/test_mlsx_entry.rb: ditto.
+Wed Jul 17 17:12:23 2013 Matthew M. Boedicker <matthewm@boedicker.org>
-Fri Oct 9 14:12:35 2015 Shota Fukumori (sora_h) <her@sorah.jp>
+ * hash.c (env_fetch): Add key name to message on ENV.fetch KeyError,
+ as well as Hash#fetch. [ruby-core:56062] [Feature #8649]
- * ext/openssl/lib/openssl/ssl.rb: Revert r52082 because it was
- dropping TLS v1.1 support too. Supporting only TLS v1.2 is too
- early, because many popular websites still don't support it.
+Wed Jul 17 15:59:33 2013 Koichi Sasada <ko1@atdot.net>
- For instance, Servers where aws-sdk connects to still don't support
- TLS v1.2 and it became broken.
+ * gc.c: catch up last changes for debugging/checking mode.
- We should consider more carefully about this.
+Wed Jul 17 15:50:10 2013 Koichi Sasada <ko1@atdot.net>
- [Fix GH-873] [Feature #11524]
+ * gc.c (rb_objspace_free): free slot itself.
-Fri Oct 9 12:52:08 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c (objspace_each_objects): fix condition.
+ Use slot->body instead of slot.
- * compile.c (iseq_compile_each): Dynamic string literals (e.g.,
- "#{x}") should not be frozen because they don't literally
- represent strings.
- https://twitter.com/shugomaeda/status/651937650027401216
- https://twitter.com/yukihiro_matz/status/651942882312482817
- https://twitter.com/yukihiro_matz/status/651980835181096960
+ * gc.c (count_objects): use "slot" variable.
-Fri Oct 9 06:52:49 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jul 17 15:21:10 2013 Koichi Sasada <ko1@atdot.net>
- * benchmark/prepare_require.rb: skip file creation if it already
- exist. Suggested by ko1.
+ * gc.c (unlink_heap_slot): fix memory leak.
+ free slot itself at free_heap_slot().
-Fri Oct 9 06:18:04 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * benchmark/bm_require.rb: new benchmark for require.
- * benchmark/bm_require_thread.rb: new benchmark for conflicting
- require vs thread. like [Bug #11559]
- * prepare_require.rb: new file for preparing above tests.
- * prepare_require.rb: ditto.
+ Reproduce-able code is here:
+ N1 = 100_000; N2 = 1_000_000
+ N1.times{ary = []; N2.times{ary << ''}}
+ Maybe this problem is remaining in Ruby 2.0.0.
-Thu Oct 8 14:10:45 2015 Zachary Scott <zzak@ruby-lang.org>
+ * gc.c (unlink_heap_slot): remove not working code.
- * ext/openssl/lib/openssl/ssl.rb: Default to TLSv1.2 and drop TLS v1
- Patch provided by @claudijd [Fixes GH-873] [Feature #11524]:
- https://github.com/ruby/ruby/pull/873
+Wed Jul 17 14:31:13 2013 Koichi Sasada <ko1@atdot.net>
-Wed Oct 7 22:55:02 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: re-design the heap structure.
- * test/minitest/metametameta.rb (with_output): restore output to
- fix mixing test result output in worker responses.
+ (1) The heap is consists of a set of slots.
+ (2) Each "slot" has a "slot_body".
+ slot::start and slot::limit specify RVALUE beginning address
+ and number of RVALUE in a "slot_body".
+ (3) "slot_body" contains a pointer to slot (slot_body::header::slot)
+ and an array of RVALUE.
+ (4) heap::sorted is an array of "slots", sorted by an address of
+ slot::body.
-Wed Oct 7 21:32:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design
+ for more details (figure).
- * string.c (str_duplicate): move from rb_str_resurrect to short
- circuit initialization.
+ * gc.c: Avoid "heaps" terminology. It is ambiguous.
-Wed Oct 7 20:43:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 17 13:29:16 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_resurrect): fix resurrection of short enough to
- be embedded but not embedded string.
+ * gc.c: fix heaps_header and heaps_slot to reduce memory consumption.
+ (1) move heaps_header::start and limit to heaps_slot.
+ (2) remove heaps_header::end which can be calculated by start+limit.
-Wed Oct 7 20:17:29 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c: catch up above change.
- * gc.c (newobj_of): divide fast path and slow path
- to avoid register savings for fast path.
+Wed Jul 17 12:30:05 2013 Tanaka Akira <akr@fsij.org>
- This idea is given by Kazuho Oku <kazuho@natadeco.co>.
+ * include/ruby/st.h (st_strcasecmp): Macro defined for compatibility.
+ (st_strncasecmp): Ditto.
-Wed Oct 7 17:30:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 17 11:57:45 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
- * string.c (rb_str_times): optimize for the argument 0 and 1.
+ * lib/cgi/util.rb (CGI::Util#escape, unescape): Avoid use of regexp
+ special global variable. [Feature #8648] Thanks to fotos.
-Wed Oct 7 01:20:46 2015 Koichi Sasada <ko1@atdot.net>
+Wed Jul 17 11:57:10 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
- * gc.h, gc.c: introduce new debug function rb_obj_info_dump(VALUE obj)
- which prints the result of rb_raw_obj_info(..., obj).
+ * lib/erb.rb (ERB::Util#url_encode): Avoid use of regexp special global
+ variable. [Feature #8648] Thanks to fotos.
-Wed Oct 7 01:16:11 2015 Koichi Sasada <ko1@atdot.net>
+Wed Jul 17 08:12:41 2013 Tanaka Akira <akr@fsij.org>
- * vm_args.c: remove an unused field args_info::calling.
+ * st.c (st_locale_insensitive_strcasecmp): Renamed from st_strcasecmp.
+ (st_locale_insensitive_strncasecmp): Renamed from st_strncasecmp.
-Tue Oct 6 23:43:10 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/st.h: Follow above changes.
- * proc.c (rb_method_entry_min_max_arity): should support
- OPTIMIZED_METHOD_TYPE_CALL.
+ * include/ruby/ruby.h: Ditto.
-Tue Oct 6 21:29:08 2015 Tanaka Akira <akr@fsij.org>
+Wed Jul 17 00:14:59 2013 Tanaka Akira <akr@fsij.org>
- * lib/tmpdir.rb (Dir.tmpdir): return duplicated string to be
- modify safely even when $SAFE > 0.
+ * bignum.c (bigmul1_toom3): Use bigdivrem_single instead of bigdivrem.
+ (big_three): Removed.
+ (Init_Bignum): Don't initialize big_three.
-Tue Oct 6 19:24:38 2015 Koichi Sasada <ko1@atdot.net>
+Tue Jul 16 21:46:03 2013 Masaki Matsushita <glass.saga@gmail.com>
- * vm_insnhelper.c (vm_call_method0): use switch() for visibilities
- (for readability).
+ * configure.in: revert r42008. strcasecmp() uses the current locale.
-Tue Oct 6 19:23:58 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h: ditto.
- * proc.c (Init_Proc): Proc#call and others should be public.
+ * st.c (st_strcasecmp): ditto.
-Tue Oct 6 18:51:51 2015 Koichi Sasada <ko1@atdot.net>
+Tue Jul 16 21:07:04 2013 Masaki Matsushita <glass.saga@gmail.com>
- * method.h: IMEMO_FL_USER3 and IMEMO_FL_USER4 is not needed any more.
+ * configure.in: check strcasecmp().
-Tue Oct 6 18:47:45 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h: use strcasecmp() as st_strcasecmp() if it
+ exists.
- * method.h: remove METHOD_ENTRY_SAFE(me) and related code
- because $SAFE = 3 and 4 is not available.
- Now, $SAFE is not checked on method dispatch at all.
+ * st.c (st_strcasecmp): define the function only if strcasecmp()
+ doesn't exist.
- * vm_eval.c, vm_insnhelper.c, vm_method.c: ditto.
+Tue Jul 16 20:21:28 2013 Tanaka Akira <akr@fsij.org>
-Tue Oct 6 13:56:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigsq): Renamed from bigsqr.
- * include/ruby/ruby.h: turn function macros into inline functions,
- for debuggers.
+Tue Jul 16 19:42:08 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/ruby.h: turn constant macros into enums, for
- debuggers.
+ * bignum.c (USHORT): Unused macro removed.
-Tue Oct 6 13:48:05 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue Jul 16 19:18:51 2013 Koichi Sasada <ko1@atdot.net>
- * method.h: typo fix. Patch by @davydovanton [fix GH-1032][ci skip]
+ * gc.c: slim a path of newobj_of().
-Tue Oct 6 06:54:34 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (objspace): add a new field objspace::freelist, which contains
+ available RVALUEs.
- * iseq.c (rb_iseq_free): free iseq::variable_body to avoid memory
- leak.
+ * gc.c (newobj_of): simply call new function `get_freeobj()'.
+ get_freeobj() returns objspace::freelist. If objspace::freelist
+ is not available, refill objspace::freelist with a slot pointed by
+ objspace::heap::free_slots.
-Tue Oct 6 06:32:52 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (before_gc_sweep): clear objspace::freelist.
- * proc.c: enable optimization of Proc#call.
- [Feature #11569]
+ * gc.c (slot_sweep): clear slot::freelist.
- * NEWS: write about this optimization and incompatibilities.
+ * gc.c (heaps_prepare_freeslot): renamed to heaps_prepare_freeslot.
- * test/ruby/test_backtrace.rb: catch up this fix.
+ * gc.c (unlink_free_heap_slot): remove unused function.
-Tue Oct 6 04:41:03 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (rb_free_const_table): remove unused function.
- * vm_insnhelper.c: solve goto spaghetti.
+Tue Jul 16 19:05:12 2013 Tanaka Akira <akr@fsij.org>
- Change all goto statement across blocks to tail call functions.
+ * bignum.c (big_shift3): Big shift width is not a problem for right
+ shift.
-Tue Oct 6 02:29:38 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 16 18:50:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_resurrect): optimize by short circuit to copy
- hidden string without checking length, encoding and so on.
+ * array.c (rb_ary_count): [DOC] fix typo. Array#count uses ==, not
+ ===. a question at asakusa.rb ML.
-Mon Oct 5 23:08:17 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Tue Jul 16 18:35:48 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_thread.rb (test_handle_interrupt_blocking): check if
- exception handling was postponed until sleep.
+ * bignum.c (bary_mul_karatsuba): Avoid duplicate calculation when
+ squaring.
+ (bary_mul_toom3_branch): Ditto.
-Mon Oct 5 22:25:49 2015 Tanaka Akira <akr@fsij.org>
+Tue Jul 16 17:43:22 2013 Koichi Sasada <ko1@atdot.net>
- * lib/pp.rb: Use frozen_string_literal: true.
+ * gc.c (link_free_heap_slot): removed.
- * lib/prettyprint.rb: Ditto.
+ * gc.c (slot_sweep): use `heaps_add_freeslot' instead of
+ `link_free_heap_slot'.
- * lib/resolv.rb: Ditto.
+ * gc.c (assign_heap_slot): use local variable `slot' instead of
+ `heaps'.
- * lib/tmpdir.rb: Ditto.
+Tue Jul 16 17:21:39 2013 Koichi Sasada <ko1@atdot.net>
- * test/test_pp.rb: Ditto.
+ * gc.c (assign_heap_slot): refactoring variable names.
- * test/test_prettyprint.rb: Ditto.
+ * gc.c (slot_add_freeobj): added.
- * tool/transcode-tblgen.rb: Ditto.
+ * gc.c (heaps_add_freeslot): added.
-Mon Oct 5 20:39:32 2015 Benoit Daloze <eregontp@gmail.com>
+ * gc.c (finalize_list, rb_gc_force_recycle, slot_sweep): use
+ `slot_add_freeobj' instead of modifying linked list directly.
- * test/ruby/test_thread.rb: fix potential race condition.
- The thread could have a "sleep" status because it tries
- to acquire the mutex, but does not have it yet.
+Tue Jul 16 16:30:58 2013 Koichi Sasada <ko1@atdot.net>
-Mon Oct 5 15:39:30 2015 Zachary Scott <zzak@ruby-lang.org>
+ * gc.c (lazy_sweep): refactoring.
- * numeric.c: [DOC] Overview for Numeric class by Joe Corcoran
- This patch was created at ROSSConf Berlin 2015 [Bug #11555]
+Tue Jul 16 13:32:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Oct 5 15:34:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * encoding.c (enc_set_index): since r41967, old terminator is dealt
+ with in str_fill_term(). should not consider it here because this
+ function is called before any encoding is set.
- * proc.c (proc_new): link ep to calling block.
- [ruby-core:70980] [Bug #11566]
+Tue Jul 16 11:12:03 2013 Masaki Matsushita <glass.saga@gmail.com>
-Mon Oct 5 00:53:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c (rb_block_arity): raise ArgumentError if no block given.
- * dir.c (rb_dir_getwd): make ASCII-8BIT if filesystem encoding is
- US-ASCII, like as Dir.glob.
+Tue Jul 16 08:15:22 2013 Zachary Scott <e@zzak.io>
-Sun Oct 4 23:39:09 2015 Tanaka Akira <akr@fsij.org>
+ * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] document top-level
+ classes from BigDecimal utils native extensions
- * enum.c (nmin_filter): Fix limit value.
- patch by Helder Pereira.
- [Bug #11471] [ruby-core:70477]
+Tue Jul 16 03:23:03 2013 Zachary Scott <e@zzak.io>
-Sun Oct 4 15:11:48 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * numeric.c: [DOC] improve rdoc formatting for parameters and links
- * enc/euc_jp.c (mbc_case_fold): check given string is valid or not,
- and if invalid, return 1. [Bug #11486]
+Mon Jul 15 14:40:00 2013 Tanaka Akira <akr@fsij.org>
-Sun Oct 4 10:09:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/intern.h (rb_big2str0): Deprecated.
- * dir.c (rb_dir_getwd): normalize OS path to UTF-8 on OS X.
+ * bignum.c (rb_big2str1): Renamed from rb_big2str0.
+ (rb_big2str0): Deprecated wrapper for rb_big2str1.
+ (rb_big2str): Invoke rb_big2str1 instead of rb_big2str0.
-Sun Oct 4 00:09:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 15 14:13:02 2013 Masaki Matsushita <glass.saga@gmail.com>
- * template/ruby-runner.c.in: wrapper to set dynamic loading path
- environment variable. /bin/sh on Mac OS X 10.11 (El Capitan)
- clears DYLD_LIBRARY_PATH.
+ * struct.c (rb_struct_each_pair): use rb_yield_values(2, key, value)
+ instead of rb_yield(rb_assoc_new(key, value)) if rb_block_arity()
+ is greater than 1.
- it must:
- - do nothing even if current directory is not present
- - do not set other environment variables, e.g. PWD, SHLVL, etc
- - do not open other FDs, e.g. pipes for timer thread
+Mon Jul 15 13:46:26 2013 Tanaka Akira <akr@fsij.org>
-Sun Oct 2 10:59:00 2015 schneems <richard.schneeman@gmail.com>
+ * bignum.c: Add static assertions.
- * ext/pathname/lib/pathname.rb: freeze string literals for
- reduced object allocation.
- [Feature #11375] [ruby-core:70043]
+Mon Jul 15 13:36:02 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Oct 2 09:20:20 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * hash.c (rb_hash_each_pair): performance improvement by using
+ rb_block_arity().
- * common.mk, lib/unicode_normalize/tables.rb: Change Unicode
- Version for character normalization data from 7.0.0 to
- 8.0.0.
+Mon Jul 15 13:15:37 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Oct 2 00:18:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * proc.c (rb_block_arity): create internal API rb_block_arity().
+ it returns arity of given block.
- * proc.c (proc_mark): block.ep of Proc from Symbol is now NULL.
- [ruby-core:70961] [Bug #11560]
+Mon Jul 15 13:07:27 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-Wed Sep 30 15:47:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/prime.rb (Prime::EratosthenesGenerator,
+ Prime::EratosthenesSieve): New implementation by
+ robertjlooby <robertjlooby AT gmail.com>.
- * vm_args.c (vm_caller_setup_arg_block): bypass Symbol#to_proc
- call to optimize symbol block passing.
+ * test/test_prime.rb: updated with new method name
-Wed Sep 30 01:34:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 15 11:32:46 2013 Zachary Scott <e@zzak.io>
- * parse.y (parser_free): fix memory leak at syntax error when
- warn-indent is enabled.
+ * numeric.c (rb_cNumeric): [DOC] Added comment for Numeric to fix doc
-Tue Sep 29 22:27:50 2015 Benoit Daloze <eregontp@gmail.com>
+Mon Jul 15 11:24:48 2013 Tanaka Akira <akr@fsij.org>
- * parse.y: fix minor typo. [ci skip][fix GH-1038].
- Patch by @ltratt.
+ * bignum.c (maxpow_in_bdigit_dbl): Useless #if removed.
-Tue Sep 29 16:53:53 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+Mon Jul 15 11:10:46 2013 Zachary Scott <e@zzak.io>
- * tool/unicode_norm_gen.tmpl, lib/unicode_normalize/tables.rb:
- get rid of many .freeze commands by using frozen_string_literal
- pragma.
+ * bignum.c (rb_big_coerce): [DOC] Add docs for Bignum#coerce
+ Based on patch by Juanito Fatas [Fixes GH-360]
+ https://github.com/ruby/ruby/pull/360
-Tue Sep 29 16:37:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 15 10:56:01 2013 Zachary Scott <e@zzak.io>
- * compile.c (compile_dstr_fragments): fix performance by omitting
- the first empty string only for keeping literal encoding if
- other literals are too. [ruby-core:70930] [Bug #11556]
+ * thread.c (mutex_sleep): [DOC] Awake thread will reacquire lock
+ By Tim Abdulla [Fixes GH-342] https://github.com/ruby/ruby/pull/342
- * string.c (rb_str_append_literal): append but keep encoding non
- US-ASCII.
+Mon Jul 15 10:45:09 2013 Tanaka Akira <akr@fsij.org>
-Mon Sep 28 17:40:17 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c (nlz16): Use __builtin_clz if possible.
+ (nlz32): Use __builtin_clz or __builtin_clzl if possible.
+ (nlz64): Use __builtin_clzl or __builtin_clzll if possible.
+ (nlz128): Use __builtin_clzll if possible.
- * lib/net/ftp.rb (mtime): use usec instead of fractions to parse
- decimal fractions of a second correctly when the number of digits
- is not 6.
+ * configure.in: Check __builtin_clz, __builtin_clzl and
+ __builtin_clzll.
-Mon Sep 28 16:07:08 2015 Shugo Maeda <shugo@ruby-lang.org>
+Mon Jul 15 09:39:07 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/ftp.rb (mtime): parse decimal fractions of a second as
- specified in RFC 3659.
+ * bignum.c (power_cache_get_power): Use bitsize instead of ceil_log2.
+ (ones): Removed.
+ (next_pow2): Removed.
+ (floor_log2): Removed.
+ (ceil_log2): Removed.
-Mon Sep 28 10:31:12 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * configure.in (__builtin_popcountl): Don't check.
- * test/test_forwardable.rb: Write basic tests for lib/forwardable.
- [fix GH-1035] Patch by @kachick
+Mon Jul 15 02:47:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 27 23:32:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * localeinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
+ move from encoding.c.
- * class.c (rb_define_class, rb_define_class_id_under): refine
- error messages.
+ * miniinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
+ define miniruby specific functions only.
- * class.c (rb_define_module, rb_define_module_id_under): ditto,
- and make consistent with class.
+Mon Jul 15 02:32:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 27 18:44:43 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * encoding.c (rb_enc_init): no longer needs NO_PRESERVED_ENCODING.
- * ChangeLog: removed duplicated message.
+ * encoding.c (enc_inspect): defer loading autoloaded encoding.
-Sun Sep 27 15:46:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * encoding.c (enc_check_encoding): use is_data_encoding() to check
+ type consistently.
- * ruby.c (process_options): add an option to enable/disable
- frozen-string-literal. [Feature #8976]
+ * encoding.c (must_encoding): return rb_encoding* instead of encoding
+ index.
- * compile.c (iseq_compile_each): override compile option by option
- given by pragma.
+ * encoding.c (enc_check_encoding): use is_data_encoding() to check
+ type consistently.
- * iseq.c (rb_iseq_make_compile_option): extract a function to
- overwrite rb_compile_option_t.
+ * encoding.c (must_encoding): return rb_encoding* instead of encoding
+ index.
- * parse.y (parser_set_compile_option_flag): introduce pragma to
- override compile options.
+Mon Jul 15 02:21:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (magic_comments): new pragma "frozen-string-literal".
- [Feature #8976]
+ * string.c (str_fill_term): consider old terminator length, and should
+ not use rb_enc_ascget since it depends on the current encoding which
+ may not be compatible with the new terminator. [Bug #8634]
-Sun Sep 27 08:16:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * encoding.c (enc_inspect): use PRIsVALUE to preserve the result
+ encoding.
- * lib/ostruct.rb (delete_field): do not raise NameError for
- existing keys. [Fix GH-1033]
+Sun Jul 14 23:21:47 2013 Tanaka Akira <akr@fsij.org>
-Sun Sep 27 00:34:31 2015 Zachary Scott <zzak@ruby-lang.org>
+ * configure.in: Check __builtin_popcountl, __builtin_bswap32 and
+ __builtin_bswap64.
- * lib/ostruct.rb: Move method definitions for getter/setter to be lazy
- Patch by @sferik in [GH-1033]: https://github.com/ruby/ruby/pull/1033
+ * internal.h (swap32): Use the configure result for the condition to
+ use __builtin_bswap32.
+ (swap64): Use the configure result for the condition to use
+ __builtin_bswap64.
-Fri Sep 25 10:07:25 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (ones): Use the configure result for the condition to use
+ __builtin_popcountl.
+ (bary_unpack_internal): Use appropriate types for swap argument.
- * lib/net/http.rb: removed unused variable. It's removed at r13648.
- [fix GH-1022] Patch by @nkondratyev
+Sun Jul 14 22:21:11 2013 Tanaka Akira <akr@fsij.org>
-Fri Sep 25 09:48:27 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (bary_subb): Support xn < yn.
+ (bigsub_core): Removed.
+ (bigsub): Don't compare before subtraction. Just subtract and
+ get the two's complement if the subtraction causes a borrow.
- * gems/bundled_gems: upgrade to minitest-5.8.1
+Sun Jul 14 00:36:03 2013 Tanaka Akira <akr@fsij.org>
-Fri Sep 25 09:47:12 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (DIGSPERLONG): Unused macro removed.
+ (DIGSPERLL): Ditto.
- * id_table.c: fix typo. [ci skip][fix GH-1031] Patch @davydovanton
+Sun Jul 14 00:32:51 2013 Tanaka Akira <akr@fsij.org>
-Fri Sep 25 07:54:05 2015 Rei Odaira <Rei.Odaira@gmail.com>
+ * bignum.c (rb_big_aref): Less scan when the number is negative.
- * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_lock): skip
- this test on AIX. The issue is the same as on Solaris.
- [ruby-dev:47631]
+Sun Jul 14 00:17:42 2013 Tanaka Akira <akr@fsij.org>
-Thu Sep 24 17:25:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (big_shift): Avoid signed integer overflow.
- * parse.y (paren_args): fix separator token at `foo::bar()` in
- ripper.
+Sun Jul 14 00:14:15 2013 Tanaka Akira <akr@fsij.org>
-Thu Sep 24 00:00:17 2015 Rei Odaira <Rei.Odaira@gmail.com>
+ * bignum.c (bary_mul_precheck): Use bary_small_lshift or
+ bary_mul_normal if xl is 1.
- * complex.c: ruby/config.h must be included before math.h
- because it defines _LARGE_FILES on AIX and _LARGE_FILES
- must be defined before sys/types.h is included from math.h.
- [Bug #11483]
+Sat Jul 13 22:58:16 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 23 22:22:38 2015 Zachary Scott <zzak@ruby-lang.org>
+ * bignum.c (big_shift3): New function.
+ big_lshift and big_rshift are merged.
+ (big_shift2): New function.
+ (big_lshift): Use big_shift3.
+ (big_rshift): Ditto.
+ (check_shiftdown): Removed.
+ (rb_big_lshift): Use big_shift2 and big_shift3.
+ (rb_big_rshift): Ditto.
+ (big_lshift): Removed.
+ (big_rshift): Ditto.
- * ext/openssl/ossl_pkcs12*: Remove svn commit id macro
+Sat Jul 13 15:51:38 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 23 01:11:28 2015 Zachary Scott <zzak@ruby-lang.org>
+ * bignum.c (bary_small_lshift): Use size_t instead of long.
+ (bary_small_rshift): Ditto.
- * ext/openssl/*: Remove svn commit id macros to make sync easier
+Sat Jul 13 15:33:33 2013 Tanaka Akira <akr@fsij.org>
-Tue Sep 22 04:20:01 2015 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+ * bignum.c (bary_small_lshift): Functions moved to remove
+ declaration.
+ (bary_small_rshift): Ditto.
- * test/drb/test_drb.rb: Run Rinda/DRb tests on localhost. [Fix GH-1027]
- patch by voxik.
+Sat Jul 13 12:27:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rinda/test_rinda.rb: ditto
+ * encoding.c (rb_enc_associate_index): fill new terminator length, not
+ old one.
-Mon Sep 21 20:53:39 2015 tbpgr <tbpgr@tbpgr.jp>
+Sat Jul 13 12:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/win32ole/test_win32ole_event.rb: fix typo.
- swbemsink_avairable? => swbemsink_available? [Fix GH-1025]
+ * ext/win32: move from ext/dl and ext/fiddle. since ext/extmk.rb
+ builds extensions in alphabetical order, compiled?('fiddle') under
+ ext/dl makes no sense.
-Sun Sep 20 10:07:35 2015 Anton Davydov <antondavydov.o@gmail.com>
+Sat Jul 13 09:26:09 2013 Tanaka Akira <akr@fsij.org>
- * cont.c (rb_callcc): [DOC] append continuations example accros
- methods. [Fix GH-1026]
+ * bignum.c (biglsh_bang): Removed.
+ (bigrsh_bang): Ditto.
+ (bigmul1_toom3): Use bary_small_lshift and bary_small_rshift.
-Sun Sep 20 03:20:21 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jul 13 01:04:43 2013 Zachary Scott <e@zzak.io>
- * iseq.c (rb_iseq_free): free rb_iseq_t::body::cc_entries.
+ * lib/rubygems/psych_additions.rb: Ignore Psych docs here
-Sun Sep 20 02:46:34 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jul 12 18:10:46 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * vm_core.h: split rb_call_info_t into several structs.
- * rb_call_info (ci) has compiled fixed information.
- * if ci->flag & VM_CALL_KWARG, then rb_call_info is
- also rb_call_info_with_kwarg. This technique reduce one word
- for major rb_call_info data.
- * rb_calling_info has temporary data (argc, blockptr, recv).
- for each method dispatch. This data is allocated only on
- machine stack.
- * rb_call_cache is for inline method cache.
+ * ext/fiddle/win32/lib/win32/registry.rb
+ (Win32::Registry::API#make_wstr): same as r41922.
- Before this patch, only rb_call_info_t data is passed.
- After this patch, above three structs are passed.
+Fri Jul 12 16:28:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- This patch improves:
- * data locality (rb_call_info is now read-only data).
- * reduce memory consumption (rb_call_info_with_kwarg,
- rb_calling_info).
+ * encoding.c (rb_enc_associate_index): refill the terminator if it
+ becomes longer than before. [ruby-dev:47500] [Bug #8624]
- * compile.c: use above data.
+ * string.c (str_null_char, str_fill_term): get rid of out of bound
+ access.
- * insns.def: ditto.
+ * string.c (rb_str_fill_terminator): add a parameter for the length of
+ new terminator.
- * iseq.c: ditto.
+Fri Jul 12 11:26:25 2013 Masaki Matsushita <glass.saga@gmail.com>
- * vm_args.c: ditto.
+ * hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHash
+ has ntbl and it is empty.
- * vm_eval.c: ditto.
+Fri Jul 12 11:17:41 2013 Masaki Matsushita <glass.saga@gmail.com>
- * vm_insnhelper.c: ditto.
+ * hash.c (recursive_hash): use RHASH_SIZE() to check hash size.
- * vm_insnhelper.h: ditto.
+Fri Jul 12 00:20:00 2013 Masaki Matsushita <glass.saga@gmail.com>
- * iseq.h: add iseq_compile_data::ci_index and
- iseq_compile_data::ci_kw_index.
+ * hash.c (rb_hash_size): use RHASH_SIZE().
- * tool/instruction.rb: introduce TS_CALLCACHE operand type.
+Fri Jul 12 00:08:24 2013 Masaki Matsushita <glass.saga@gmail.com>
-Sun Sep 20 02:18:10 2015 Tanaka Akira <akr@fsij.org>
+ * hash.c (rb_hash_values): set array capa to RHASH_SIZE().
- * test/lib/envutil.rb: mkfifo command based File.mkfifo method
- definition removed.
+Thu Jul 11 23:54:45 2013 Masaki Matsushita <glass.saga@gmail.com>
-Fri Sep 18 20:11:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * hash.c (rb_hash_keys): set array capa to RHASH_SIZE().
- * file.c (rb_file_s_mkfifo): implement File.mkfifo.
- [Feature #11536]
+Thu Jul 11 21:30:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Sep 18 16:56:19 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * win32/win32.c (rb_w32_pow): undef pow to get rid of infinite
+ recursive call. re-fix [Bug #8495]. [ruby-core:55923] [Bug #8621]
- * NEWS: add Net::FTP#mlst and Net::FTP#mlsd.
+Thu Jul 11 20:18:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Sep 18 07:39:22 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * ext/dl/win32/lib/win32/registry.rb (Win32::Registry::API#make_wstr):
+ remove workaround to append WCHAR terminator.
- * ext/objspace/objspace_dump.c (obj_type): add IMEMO types to the heap
- dump information.
+ * transcode.c (str_encode_associate): fill terminator after conversion.
-Thu Sep 17 22:33:07 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * string.c (rb_enc_str_new, rb_str_set_len, rb_str_resize): fill
+ minimum length of the encoding as the terminator.
- * common.mk: fix command error with outside builddir.
+ * string.c (str_buf_cat, rb_str_buf_append, rb_str_splice_0): ditto.
-Thu Sep 17 17:42:09 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * string.c (str_make_independent_expand, rb_str_modify_expand): make
+ the capacity enough for multi-byte terminator.
- * common.mk: separated test for test-framework from test-all task.
- They should be invoke at first before tests of test-all.
+ * string.c (rb_string_value_cstr): fill minimum length of the encoding
+ as the terminator.
-Thu Sep 17 12:05:54 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * string.c (rb_string_value_cstr): check null char in char, not in
+ byte.
- * test/ruby/test_dir.rb (TestDir#test_fileno): s/?x/"x"/. Don't
- use tricky code, please.
+Thu Jul 11 14:48:35 2013 Zachary Scott <e@zzak.io>
-Wed Sep 16 20:49:56 2015 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * array.c: Replace confusing example for #reverse_each in overview
+ Patch by Earl St Sauver [Fixes documenting-ruby/ruby-12]
+ https://github.com/documenting-ruby/ruby/pull/12
- * encindex.h: fix typo of last #endif comment. [ci skip]
+Thu Jul 11 14:22:37 2013 Zachary Scott <e@zzak.io>
-Wed Sep 16 20:39:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/drb/ut_eq.rb: Use localhost for drb tests [Bug #7311]
+ Patch by Vit Ondruch [ruby-core:49101]
+ * test/drb/ut_array.rb: ditto
+ * test/drb/ut_array_drbssl.rb: ditto
- * variable.c (set_const_visibility): fail if the class/module is
- frozen. [ruby-core:70828] [Bug #11532]
+Thu Jul 11 13:48:03 2013 Zachary Scott <e@zzak.io>
-Wed Sep 16 17:16:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sprintf.c: Fix typo patch by @hynkle [Fixes GH-357]
+ https://github.com/ruby/ruby/pull/357
- * vm_core.h (ENABLE_VM_OBJSPACE): enable per-VM object space on
- Windows by default, as rb_w32_sysinit() no longer depends on
- ruby_xmalloc.
+Thu Jul 11 13:00:34 2013 Zachary Scott <e@zzak.io>
-Wed Sep 16 15:08:17 2015 Akinori MUSHA <knu@iDaemons.org>
+ * lib/securerandom.rb: Refactor conditions by Rafal Chmiel
+ [Fixes GH-326] https://github.com/ruby/ruby/pull/326
- * doc/syntax/literals.rdoc (Strings): [DOC] Revise the character
- literal part.
+Thu Jul 11 12:04:47 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 16 14:55:33 2015 Akinori MUSHA <knu@iDaemons.org>
+ * bignum.c: Don't use toom3 after once karatsuba is chosen.
+ (mulfunc_t): New type.
+ (bary_mul_toom3_start): Renamed from bary_mul.
+ (bary_mul_karatsuba_start): Renamed from bary_mul.
+ (bary_mul_balance_with_mulfunc): Renamed from bary_mul_balance and
+ new argument, mulfunc, is added.
+ (rb_big_mul_balance): Invoke bary_mul_balance_with_mulfunc with
+ bary_mul_toom3_start.
+ (bary_mul_karatsuba): Invoke bary_mul_karatsuba_start instead of
+ bary_mul.
+ (bary_mul_precheck): Extracted from bary_mul.
+ (bary_mul_karatsuba_branch): Extracted from bary_mul.
+ (bary_mul_karatsuba_start): New function to call bary_mul_precheck
+ and bary_mul_karatsuba_branch.
+ (bary_mul_toom3_branch): Extracted from bary_mul.
+ (bary_mul_toom3_start): New function to call bary_mul_precheck and
+ bary_mul_toom3_branch.
+ (bary_mul): Just call bary_mul_toom3_start.
+ Arguments for work memory are removed.
+ (rb_cstr_to_inum): Follow the bary_mul change.
+ (bigmul0): Ditto.
- * doc/syntax/literals.rdoc (Strings): [DOC] Document the full list
- of supported escape sequences in string literals.
+Thu Jul 11 10:46:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 16 14:49:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * tool/probes_to_wiki.rb: fix usage comment. use Enumerable#grep
+ which yields each elements to reduce unnecessary array.
- * string.c (rb_str_setbyte): keep the code range as possible.
+Thu Jul 11 10:09:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Sep 16 13:23:48 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * process.c (rb_daemon): daemon(3) is implemented with fork(2).
+ Therefore it needs rb_thread_atfork(). (and revert r41903)
- * doc/syntax/literals.rdoc (Strings): mention about ?a literal.
+Thu Jul 11 03:22:10 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Wed Sep 16 12:06:53 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * tool/probes_to_wiki.rb: adding a script to convert probes.d to wiki
+ format for easy wiki updates.
- * dir.c (glob_helper): check pathtype once again by lstat(2) if
- dp->d_type is DT_UNKNOWN. XFS may return DT_UNKNOWN.
+Thu Jul 11 00:54:07 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Sep 16 03:49:19 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * man/ri.1: Incorrect use of .Dd macro [Bug #8620] by Tristan Hill
- * test/ruby/test_thread.rb (TestThread#test_mutex_synchronize):
- insert waste loop for invoking preemptive thread context switch.
- [Bug #11496]
+Thu Jul 11 00:48:29 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Sep 15 19:38:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/delegate.rb: Add example for __setobj__ and __getobj__
+ [Bug #8615] Patch by Caleb Thompson
- * gc.c (rb_objspace_alloc, rb_objspace_free): define always
- regardless ENABLE_VM_OBJSPACE, and free heap pages.
+Wed Jul 10 23:29:22 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Sep 15 15:15:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/logger.rb: Use :call-seq: for method signature rdoc
- * win32/win32.c (rb_w32_sysinit, rb_w32_readdir): compare by
- encoding index to get rid of encoding initialization before VM
- object space allocation.
+Wed Jul 10 23:23:18 2013 Zachary Scott <zachary@zacharyscott.net>
- * dir.c (fundamental_encoding_p, push_glob): compare by encoding
- index immediately.
+ * lib/logger.rb (#add): Remove incorrect rdoc for return value
+ [Bug #8567] Reported by Tim Pease.
- * enc/{ascii,us_ascii,utf_8}.c: set encoding indexes of
- fundamental built-in encodings so that usable as well as
- allocated rb_encoding before rb_enc_init().
+Wed Jul 10 23:12:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * encindex.h: separate encoding index constants from internal.h.
+ * string.c (rb_str_subpos): make public function.
-Tue Sep 15 13:13:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 10 22:44:19 2013 Tanaka Akira <akr@fsij.org>
- * array.c (rb_ary_sort_bang, rb_ary_sort): [DOC] correct block
- return values, which may be a negative or positive integer, not
- only -1 or +1.
+ * bignum.c: Add a static assertion for RBIGNUM_EMBED_LEN_MAX.
-Tue Sep 15 12:49:10 2015 Jason Barnabe <jason.barnabe@gmail.com>
+Wed Jul 10 22:31:25 2013 Masaki Matsushita <glass.saga@gmail.com>
- * array.c (rb_ary_sort_bang, rb_ary_sort): [DOC] Correct
- description of array sort block return values. And also fix up
- the grammar a bit. [Fix GH-1020]
+ * string.c (rb_str_index): cache single byte flag and some
+ cosmetic changes.
-Tue Sep 15 12:44:32 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 10 22:03:27 2013 Tanaka Akira <akr@fsij.org>
- * util.c (ruby_qsort): use BSD-style qsort_r if available.
+ * bignum.c (bary_2comp): Don't use bary_plus_one.
+ (bary_add_one): Replaced by the implementation of bary_plus_one.
-Mon Sep 14 19:26:34 2015 Shugo Maeda <shugo@ruby-lang.org>
+Wed Jul 10 20:48:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including
- space correctly.
+ * bignum.c (sizeof_bdigit_dbl): check sizeof(BDIGIT_DBL).
-Mon Sep 14 11:12:10 2015 Anton Davydov <antondavydov.o@gmail.com>
+ * internal.h (STATIC_ASSERT): move from enum.c.
- * lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo, "convertion" to
- "conversion". [Fix GH-1016]
+Wed Jul 10 20:08:21 2013 Tanaka Akira <akr@fsij.org>
-Sun Sep 13 11:03:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (SIZEOF_BDIGIT_DBL): Add a ifdef guard for test.
- * include/ruby/ruby.h: prefix RUBY or RB to global symbols to get
- rid of name conflicts with other headers.
+Wed Jul 10 14:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/encoding.h, include/ruby/intern.h: ditto.
+ * process.c (fork_daemon): kill the other threads all and abandon the
+ kept mutexes.
-Sun Sep 13 09:38:51 2015 Shugo Maeda <shugo@ruby-lang.org>
+Wed Jul 10 11:35:36 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/net/ftp.rb (size, modify, create, type, unique, perm, lang,
- media_type, charset): new methods to return standard facts.
+ * test/net/http/test_http.rb (TestNetHTTP_v1_2#test_get,
+ TestNetHTTP_v1_2_chunked#test_get): shouldn't check
+ HttpResponse#decode_content if Zlib is not available.
+ ko1 complained via IRC.
-Sat Sep 12 19:43:49 2015 Koichi Sasada <ko1@atdot.net>
+Wed Jul 10 10:20:07 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_insnhelper.c (vm_call_iseq_setup_normal): do not clear local
- variables here. vm_push_frame() clears.
+ * tool/rbinstall.rb: always require rubygems to stabilize rubygems
+ related status like whether Gem::Specification is defined or not.
- * vm_insnhelper.c (vm_call_iseq_setup_tailcall): ditto.
+ * tool/rbinstall.rb (Gem::Specification.unresolved_deps): define stub.
- * vm_insnhelper.c (vm_push_frame): move check code to
- vm_check_frame().
+Wed Jul 10 08:21:15 2013 Eric Hodel <drbrain@segment7.net>
- Reorder initialization timing to reuse same values (sp).
+ * lib/rubygems: Import RubyGems 2.1
+ * test/rubygems: Ditto.
- * compile.c (rb_iseq_compile_node): use
- iseq_set_exception_local_table() for ISEQ_TYPE_DEFINED_GUARD.
+Wed Jul 10 07:34:34 2013 Eric Hodel <drbrain@segment7.net>
-Sat Sep 12 23:06:51 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/rubygems/ext/ext_conf_builder.rb: Remove siteconf file after
+ building the gem.
+ * test/rubygems/test_gem_ext_ext_conf_builder.rb: Test for the above.
- * lib/net/ftp.rb (file?, directory?, appendable?, creatable?,
- deletable?, enterable?, renamable?, listable?, directory_makable?,
- purgeable?, readable?, writable?): new methods.
+ * lib/rubygems/psych_tree.rb (module Gem): Add backward compatibility
+ for r41148
-Sat Sep 12 21:27:22 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * test/rubygems/test_gem_package.rb: Add backward compatibility for
+ double-slash elimination.
- * lib/net/ftp.rb (FACT_PARSERS): support system dependent facts
- UNIX.mode, UNIX.owner, UNIX.group, UNIX.ctime, and UNIX.atime.
+Wed Jul 10 06:22:27 2013 Tadayoshi Funaba <tadf@dotrb.org>
-Sat Sep 12 19:08:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
- * win32/win32.c (rb_w32_dup2): should return the new fd on
- success, while msvcrt returns 0 wrongly.
+Wed Jul 10 00:41:42 2013 Tanaka Akira <akr@fsij.org>
-Sat Sep 12 18:14:11 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c (bary_mul): x*1 is x.
- * lib/net/ftp.rb (parse_mlsx_entry, mlst) raise an FTPProtoError
- when parsing failed.
+Tue Jul 9 22:24:39 2013 Tanaka Akira <akr@fsij.org>
-Sat Sep 12 18:00:35 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c (bary_mul1): No need to invoke MEMZERO at last.
+ (bary_mul_single): Invoke MEMZERO here.
- * lib/net/ftp.rb (TIME_PARSER): use "Z" instead of "+00:00" to
- get UTC time. Thanks, Wilson Bilkovich.
+Tue Jul 9 21:40:01 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Sep 12 17:55:24 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * test/rexml/test_text.rb: Add missing tests for Text#<<.
+ Reported by nagachika. Thanks!!!
- * lib/net/ftp.rb (mlst, mlsd): support new commands MLST and MLSD
- specified in RFC 3659.
+Tue Jul 9 18:02:38 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat Sep 12 16:14:31 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/fileutils.rb (FileUtils#chown_R): Do not skip traversal even
+ if user and group are both nil, to be consistent with #chown and
+ other commands.
- * file.c: access()/eaccess() wrapping methods check more than just uid.
- [fix GH-1007][ci skip] Patch by @eam
+Tue Jul 9 17:58:26 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat Sep 12 16:07:01 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * test/fileutils/test_fileutils.rb
+ (TestFileUtils#assert_output_lines): New utility assertion
+ method for testing verbose output.
- * README.md: improve markdown rendering for readability.
- [fix GH-1015][ci skip] Patch by @Matrixbirds
+Tue Jul 9 17:43:57 2013 Koichi Sasada <ko1@atdot.net>
-Sat Sep 12 14:30:03 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/test_tracer.rb: catch up recent rubygems changes.
- * process.c (save_redirect_fd): make saved FDs close-on-exec not
- to be inherited.
+Tue Jul 9 16:58:30 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * process.c (run_exec_dup2): restore close-on-exec flags too.
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb: hope that the final
+ resolution to fix the failure of test-all. and includes Win64
+ support (fixed a potential bug).
- * win32/win32.c (fcntl): implement F_GETFD, F_SETFD, and
- F_DUPFD_CLOEXEC.
+Tue Jul 9 15:57:20 2013 Akinori MUSHA <knu@iDaemons.org>
-Sat Sep 12 05:35:24 2015 Eric Wong <e@80x24.org>
+ * object.c: Fix rdoc for Kernel#<=>. [Fixes GH-352]
- * rational.c (string_to_r_strict): preserve encoding in exception
+Tue Jul 9 15:53:51 2013 Akinori MUSHA <knu@iDaemons.org>
-Fri Sep 11 20:23:35 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/fileutils.rb (FileUtils#mode_to_s): Define mode_to_s() also
+ as singleton method, or FileUtils.chmod fails in verbose mode.
- * vm_core.h: remove rb_call_info_t::aux.opt_pc.
+Tue Jul 9 15:16:02 2013 Akinori MUSHA <knu@iDaemons.org>
- * vm_insnhelper.c: introduce shortcut functions for opt_pc == 0
- because opt_pc is always 0 on shortcut function.
+ * test/fileutils/fileasserts.rb
+ (Test::Unit::FileAssertions#assert_not_symlink): Add a missing
+ optional argument "message".
-Fri Sep 11 17:49:36 2015 Koichi Sasada <ko1@atdot.net>
+Tue Jul 9 15:03:24 2013 Akinori MUSHA <knu@iDaemons.org>
- * iseq.c: disable ISeq.load. It enabled accidentally at r51794.
+ * lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): If user
+ and group are both nil, print ":".
-Fri Sep 11 11:15:12 2015 Shugo Maeda <shugo@ruby-lang.org>
+Tue Jul 9 12:47:08 2013 Masaki Matsushita <glass.saga@gmail.com>
- * lib/net/ftp.rb (size, mdtm, system): parse responses according to
- RFC 959 and 3659, where reply codes must be followed by SP.
+ * io.c (appendline): use READ_CHAR_PENDING_XXX macros and
+ RSTRING_END().
- * lib/net/ftp.rb (system): remove LF from the return value.
+ * io.c (rb_io_getline_1): rewrite nested if statement into one
+ statement.
-Thu Sep 10 22:48:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 9 11:04:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * parse.y (literal_concat_gen, evstr2dstr_gen): keep literal
- encoding beginning with an interpolation same as the source file
- encoding. [ruby-core:70703] [Bug #11519]
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Registry#check):
+ should report the position of the error.
-Thu Sep 10 22:15:51 2015 Joe Rafaniello <jrafanie@redhat.com>
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb
+ (Win32::Registry#QueryValue): workaround for test-all crash.
- * process.c (rb_f_spawn): Be more specific regarding "other
- values" by having "non-zero positive integers" Add nil, the
- default value, as a possible value and what it means.
+Tue Jul 9 10:27:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- Try to use more consistent language.
- [Fix GH-1008]
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb
+ (Win32::Registry.expand_environ): use suitable encoding for the
+ string.
-Thu Sep 10 15:16:02 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Registry#read):
+ should return REG_SZ, REG_EXPAND_SZ and REG_MULTI_SZ values with
+ the expected encoding -- assumed as the same encoding of name.
- * lib/net/ftp.rb (getmultiline): refactor.
+Tue Jul 9 10:02:45 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu Sep 10 12:17:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/{dl,fiddle}/win32/lib/win32/registry.rb
+ (Win32::Registry::Error#initialize): use suitable encoding for the
+ string.
- * compile.c (iseq_build_from_ary_body): register cdhash to the
- iseq constant body instead of compile time mark array, not to
- get GCed. [ruby-core:70708] [Feature #8543]
+Tue Jul 9 09:46:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Sep 9 18:16:14 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/dl/win32/lib/win32/registry.rb (Win32::Registry.expand_environ):
+ use suitable encoding for the string. fixed a test-all error of
+ r41838.
- * lib/rubygems/stub_specification.rb (Gem::StubSpecification#data):
- should not change the value of $. when `require`ing gems.
- this fixed test failures introduced by r51813.
+ * ext/fiddle/win32/lib/win32/registry.rb: same changes of r41838 and
+ this revision of dl's win32/registry.rb.
-Wed Sep 9 16:55:45 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Jul 9 07:39:45 2013 Eric Hodel <drbrain@segment7.net>
- * ruby.c (usage, enable_option, disable_option, process_options): new
- option `--disable-did_you_mean`.
+ * lib/rubygems: Update to RubyGems 2.0.4. See
+ https://github.com/rubygems/rubygems/blob/2.0/History.txt for changes
- * gem_prelude.rb: now requires did_you_mean gem by default if available.
+Tue Jul 9 01:47:16 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 9 13:38:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (biglsh_bang): Don't shift a BDIGIT with BITSPERDIG bits.
+ (bigrsh_bang): Ditto.
- * tool/extlibs.rb (do_patch): let "patch" command change the
- working directory and open the patch file there, instead of
- spawn options, so that proper error message will be shown by the
- command not just "chdir" or "open".
+Tue Jul 9 01:17:57 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 9 11:33:05 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * bignum.c (bigrsh_bang): Fix bignum digits overrun.
- * common.mk (update-gems): use BASERUBY instead of RUNRUBY.
+Tue Jul 9 00:46:22 2013 Tanaka Akira <akr@fsij.org>
-Wed Sep 9 11:08:59 2015 Zachary Scott <zzak@ruby-lang.org>
+ * bignum.c (biglsh_bang): Fix bignum digits under-run.
- * lib/delegate.rb: Remove backtrace cleaning for delegated methods
- This patch was provided by Rafael Franca and greatly improves
- performance when an exception is raised. [Bug #11461]
+Mon Jul 8 23:36:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 9 10:05:41 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/dl/win32/lib/win32/registry.rb (Error, API): use WCHAR
+ interfaces. c.f. [Bug #8508]
- * test/rubygems/test_config.rb: fix broken tests for Windows platform.
+Mon Jul 8 23:13:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Sep 9 07:46:32 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * win32/win32.c (rb_w32_pow): move from win32.h and disable strict
+ ANSI mode macro to let _controlfp() stuff defined.
+ [ruby-core:55312] [Bug #8495]
- * lib/rubygems: Update to RubyGems HEAD(fe61e4c112).
- this version contains new feature that warn invalid SPDX license
- identifiers. https://github.com/rubygems/rubygems/pull/1249
- and #1032, #1023, #1332, #1328, #1306, #1321, #1324
- * test/rubygems: ditto.
+ * numeric.c (finite): add declaration for strict ANSI.
+ [ruby-core:55312] [Bug #8495]
-Tue Sep 8 23:17:36 2015 Yuki Nishijima <mail@yukinishijima.net>
+ * thread_win32.c (w32_thread_start_func, thread_start_func_1),
+ (timer_thread_func): use __stdcall instead of _stdcall which is
+ unavailable in strict ANSI mode. [ruby-core:55312] [Bug #8495]
- * gems/bundled_gems: Upgrade the did_you_mean gem to 1.0.0.beta2.
+ * win32/win32.c (gettimeofday): use __cdecl instead of _cdecl.
-Tue Sep 8 23:09:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 8 22:41:12 2013 Tanaka Akira <akr@fsij.org>
- * io.c (rb_io_s_popen): do not wait the child process during being
- killed. [ruby-core:70671] [Bug #11510]
+ * bignum.c (bary_mul): Arguments for work memory added.
+ (bary_mul_balance): Ditto.
+ (bary_mul_karatsuba): Ditto.
-Tue Sep 8 22:18:04 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jul 8 22:03:30 2013 Tanaka Akira <akr@fsij.org>
- * gems/bundled_gems: revert because ruby trunk never be able to install
- the did_you_mean gem. retry after enough test.
+ * bignum.c (rb_big_sq_fast): New function for testing.
+ (rb_big_mul_toom3): Ditto.
-Tue Sep 8 21:48:22 2015 Yuki Nishijima <mail@yukinishijima.net>
+ * internal.h (rb_big_sq_fast): Declared.
+ (rb_big_mul_toom3): Ditto.
- * gems/bundled_gems: Automatically install the did_you_mean gem
- as a bundled gem. [Feature #11252]
+Mon Jul 8 21:59:34 2013 Tanaka Akira <akr@fsij.org>
-Tue Sep 8 17:17:48 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (bary_mul_balance): Initialize a local variable to suppress
+ a warning.
- * vm_core.h: remove rb_call_info_t::blockiseq.
+Mon Jul 8 20:55:22 2013 Tanaka Akira <akr@fsij.org>
- * insns.def (send, invokesuper): pass blockiseq explicitly.
+ * bignum.c (bary_mul_balance): Reduce work memory.
- * compile.c: catch up this fix.
+Mon Jul 8 08:26:15 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * iseq.c: ditto.
+ * test/openssl/test_pkey_ec.rb: Skip tests for "Oakley" curves as
+ they are not suitable for ECDSA.
+ [ruby-core:54881] [Bug #8384]
- * vm_args.c: ditto.
+Mon Jul 8 08:03:01 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c (ISEQ_MINOR_VERSION): 2->3 because instruction spec was
- changed.
+ * bignum.c (bary_mul): Add a RB_GC_GUARD.
-Tue Sep 8 15:01:19 2015 Shugo Maeda <shugo@ruby-lang.org>
+Sun Jul 7 23:56:32 2013 Tanaka Akira <akr@fsij.org>
- * lib/net/ftp.rb (list): fetch all the lines before yielding a block
- to allow other commands in the block. [Feature #11454]
- Patched by Srikanth Shreenivas.
+ * bignum.c (bary_mul_karatsuba): Unreachable code removed. Remove
+ several branches.
-Tue Sep 8 12:05:00 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Jul 7 22:59:06 2013 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (rb_w32_read_reparse_point): return correct required
- buffer size for IO_REPARSE_TAG_MOUNT_POINT.
+ * internal.h (rb_big_mul_normal): Declared.
+ (rb_big_mul_balance): Ditto.
+ (rb_big_mul_karatsuba): Ditto.
-Tue Sep 8 00:14:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_big_mul_normal): New function for tests.
+ (rb_big_mul_balance): Ditto.
+ (rb_big_mul_karatsuba): Ditto.
- * process.c (rb_execarg_parent_start1): raise with the target path
- name when open() failed.
+Sun Jul 7 19:21:30 2013 Tanaka Akira <akr@fsij.org>
-Mon Sep 7 23:45:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c: Reorder functions to decrease forward reference.
- * process.c (rb_exec_fail): raise with the target directory name
- when chdir() failed. pointed out by sorah.
+Sun Jul 7 14:41:57 2013 Tanaka Akira <akr@fsij.org>
-Mon Sep 7 22:05:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c: (bigsub_core): Use bary_sub.
+ (bary_sub): Returns a borrow flag. Use bary_subb.
+ (bary_subb): New function for actually calculating subtraction with
+ borrow.
+ (bary_sub_one): New function.
+ (bigadd_core): Use bary_add.
+ (bary_add): Returns a carry flag. Use bary_addc.
+ (bary_addc): New function for actually calculating addition with
+ carry.
+ (bary_add_one): New function.
+ (bary_muladd_1xN): Extracted from bary_mul_normal.
+ (bigmul1_normal): Removed.
+ (bary_mul_karatsuba): New function.
+ (bary_mul1): Invoke rb_thread_check_ints after bary_mul_normal.
+ (bary_mul): Remove most and least significant zeros before actual
+ multiplication. Use bary_sq_fast, bary_mul_balance,
+ bary_mul_karatsuba and bigmul1_toom3 as bigmul0.
+ (bigmul1_balance): Removed.
+ (bigmul1_karatsuba): Removed.
+ (bigsqr_fast): Removed.
+ (bary_sparse_p): Extracted from big_sparse_p.
+ (big_sparse_p): Removed.
+ (bigmul0): Use bary_mul.
- * win32/win32.c (insert): should use plain strdup() instead of
- ruby_strdup() at startup time, and plain free()ed in cmdglob().
+Sun Jul 7 11:54:33 2013 Kouhei Sutou <kou@cozmixng.org>
-Mon Sep 7 16:49:30 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS: Add REXML::Text#<< related updates.
- * vm_core.h (rb_vm_struct): define objspace always regardless
- ENABLE_VM_OBJSPACE.
+Sun Jul 7 11:49:19 2013 Kouhei Sutou <kou@cozmixng.org>
-Mon Sep 7 15:54:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rexml/text.rb (REXML::Text#<<): Support appending in not
+ "raw" mode. [Bug #8602] [ruby-dev:47482]
+ Reported by Ippei Obayashi. Thanks!!!
- * ruby_atomic.h (ATOMIC_VALUE_CAS): fix typo.
- TODO: make arguments of all CAS macros consistent.
+Sun Jul 7 11:43:13 2013 Kouhei Sutou <kou@cozmixng.org>
-Sun Sep 6 16:07:22 2015 Eric Wong <e@80x24.org>
+ * lib/rexml/text.rb (REXML::Text#<<): Support method chain use by "<<"
+ like other objects.
- * ccan/list/list.h: suppress unused argument warnings
- [ccan commit 6aaca17e07588997417a73fac19dcf0ff17ed81b]
+Sun Jul 7 11:34:18 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Sep 5 11:39:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common
+ cache clear code.
- * lib/rss/rss.rb (Time#w3cdtf): fix zero-trimmed width of fraction
- digits. [ruby-core:70667] [Bug #11509]
+Sun Jul 7 11:01:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Sep 5 08:28:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11
+ introduces a check in the dtrace compiler to ensure that probes
+ actually exist. If there are no probes, then the -G step will
+ fail. As this test is only being used to determine whether -G is
+ necessary (for instance, on OSX it is not), adding a real probe to
+ the conftest allows it to succeed on newer versions of dtrace.
+ Patch by Eric Saxby <sax AT livinginthepast.org> at
+ [ruby-core:55826]. [Fixes GH-351], [Bug #8606].
- * hash.c (rb_hash_equal, rb_hash_eql): [DOC] the orders of each
- hashes are not compared. [Bug #11508]
+Sun Jul 7 10:07:22 2013 Tanaka Akira <akr@fsij.org>
-Fri Sep 4 23:26:22 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_sq_fast): Extracted from bigsqr_fast and
+ ensure not to access zds[2*xn].
+ (bigsqr_fast): Allocate the result bignum with 2*xn words.
- * include/ruby/win32.h: fix macro name for VC runtime version,
- RT_VER is only in Makefile.
+Sat Jul 6 07:37:43 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-Fri Sep 4 17:46:17 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/openssl/ossl_pkey_ec.c: Ensure compatibility to builds of
+ OpenSSL with OPENSSL_NO_EC2M defined, but OPENSSL_NO_EC not
+ defined.
+ * test/openssl/test_pkey_ec.rb: Iterate over built-in curves
+ (and assert their non-emptiness!) instead of hard-coding them, as
+ this may cause problems with respect to the different availability
+ of individual curves in individual OpenSSL builds.
+ [ruby-core:54881] [Bug #8384]
- * doc/contributing.rdoc: fix configuration option.
- [ci skip] [fix GH-1009]
+ Thanks to Vit Ondruch for providing the patch!
-Fri Sep 4 04:46:54 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jul 6 07:12:39 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * iseq.c (iseq_memsize): functions for wrapper object should have
- iseqw_ prefix.
+ * test/openssl/test_x509crl.rb: Remove unused variable.
+ [ruby-core:53501] [Bug #8114]
-Thu Sep 3 21:12:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Thanks, Vipul Amler, for pointing this out!
- * lib/cgi/session.rb (create_new_id): use SHA512 instead of MD5.
- pointed out by SARWAR JAHAN.
+Sat Jul 6 06:37:10 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-Thu Sep 3 20:29:18 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/openssl/ossl.c: Provide CRYPTO_set_locking_callback() and
+ CRYPTO_set_id_callback() callback functions ossl_thread_id and
+ ossl_lock_callback to ensure the OpenSSL extension is usable in
+ multi-threaded environments.
+ [ruby-core:54900] [Bug #8386]
- * gc.c (rb_raw_obj_info): iseq->body->location.first_lineno is Fixnum.
+ Thanks, Dirkjan Bussink, for the patch!
-Thu Sep 3 17:54:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jul 6 06:06:16 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * vm_eval.c (raise_method_missing): "names" should be singular.
- pointed out by Filip Bartuzi.
+ * lib/openssl/ssl.rb: Fix SSL client connection crash for SAN marked
+ critical.
+ The patch for CVE-2013-4073 caused SSL crash when a SSL server returns
+ the certificate that has critical SAN value. X509 extension could
+ include 2 or 3 elements in it:
-Thu Sep 3 17:50:09 2015 Koichi Sasada <ko1@atdot.net>
+ [id, criticality, octet_string] if critical,
+ [id, octet_string] if not.
- * gc.c (rb_raw_obj_info): should support IMEMO/iseq.
+ Making sure to pick the last element of X509 extension and use it as
+ SAN value.
+ [ruby-core:55685] [Bug #8575]
-Thu Sep 3 10:07:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Thank you @nahi for providing the patch!
- * vm_eval.c (raise_method_missing): refine error messages when a
- symbol is not given. [Fix GH-1013]
+Sat Jul 6 04:49:38 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Wed Sep 2 18:49:55 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: register time objects so
+ they are referenced as ids during output.
+ * test/psych/test_date_time.rb: corresponding test.
- * ext/psych/*: merge psych master(8737e5b). It contains following fixes.
- https://github.com/tenderlove/psych/pull/242
- https://github.com/tenderlove/psych/pull/246 [ruby-list:50219]
- * test/psych/*: ditto.
+Fri Jul 5 20:46:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Sep 2 18:04:13 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic): this
+ assertion doesn't seems to be checking the unicode string on command
+ line, but seems to be checking how to treat the unicode string from
+ stdin. so, should escape '\' before 'u'. this fixes a test failure
+ on Windows.
- * vm_insnhelper.h (GET_PC_COUNT): remove unused macro.
+Fri Jul 5 19:05:40 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Sep 2 17:18:37 2015 Chris Schneider <chris@christopher-schneider.com>
+ * lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): Fix the
+ wrong output message when user is nil, which should be "chown
+ :group file" instead of "chown group file".
- * process.c (proc_detach): [DOC] fix typo "intent" as "intend" in
- rdoc. [Fix GH-1011]
+Fri Jul 5 16:21:56 2013 Akinori MUSHA <knu@iDaemons.org>
-Wed Sep 2 16:58:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_regexp.rb
+ (TestRegexp#test_options_in_look_behind)
+ (TestRegexp#assert_match_at): Add tests for another problem
+ fixed in Onigmo 5.13.5. Previously Onigmo did not allow option
+ enclosures in look-behind, which makes it impossible to
+ interpolate a regexp into another in the middle of a look-behind
+ pattern. cf. https://github.com/k-takata/Onigmo/pull/17
- * file.c (rb_realpath_internal): use filesystem encoding if the
- argument is in ASCII encodings.
+ * test/ruby/test_regexp.rb
+ (TestRegexp#test_options_in_look_behind)
+ (TestRegexp#assert_match_at): Parse regexps in run time rather
+ than in compile time.
- * win32/file.c (rb_readlink): needs the result encoding.
+Fri Jul 5 12:14:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Sep 1 18:37:15 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_notfound): after
+ r41710, the path of command uses backslash as the separator on
+ Windows.
- * test/thread/test_queue.rb: catch up last commit.
+Fri Jul 5 11:29:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Sep 1 18:16:32 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/test/unit/assertions.rb (assert_raise_with_message): move from
+ test/fileutils/test_fileutils.rb. this is still experimental and
+ the interface may be changed.
- * thread_sync.c (queue_do_close): ignore multiple close to allow
- multiple producers.
- https://bugs.ruby-lang.org/issues/10600#note-14
+Fri Jul 5 11:08:00 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Sep 1 18:06:26 2015 Koichi Sasada <ko1@atdot.net>
+ * win32/win32.c (w32_spawn): r41710 made that if the command starts with
+ a quote and includes slash, removed the top quote and NOT removed the
+ last quote.
+ this fixes test failures on test/ruby/test_process.rb and
+ test/webrick.
- * thread_tools.c: rename thread_tools.c to thread_sync.c.
+Fri Jul 5 09:53:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/mkmf.rb (CONFIG['CPPOUTFILE']): fix r41769; CONFIG['CPPOUTFILE']
+ may be nil.
-Mon Aug 31 17:04:45 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jul 5 05:39:53 2013 Tanaka Akira <akr@fsij.org>
- * class.c (move_refined_method): should insert a write barrier
- from an original class to a created (cloned) method entry.
+ * bignum.c (BARY_MUL1): Renamed from BARY_MUL.
+ (bary_mul1): Renamed from bary_mul.
+ (bary_mul): Renamed from bary_mul2.
- * test/ruby/test_refinement.rb: add a test.
+Fri Jul 5 04:58:05 2013 Tanaka Akira <akr@fsij.org>
-Sun Aug 30 02:42:22 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * bignum.c (bary_mul_balance): Extracted from bigmul1_balance and
+ use bary_mul2 and bary_add to decrease allocations.
- * ext/openssl/ossl_ssl.c (ossl_ssl_method_tab): Only add SSLv3 support
- if the SSL library supports it. Thanks Kurt Roeckx <kurt@roeckx.be>
- [Bug #11376]
+Fri Jul 5 02:14:00 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/openssl/extconf.rb: check for SSLv3 support in the SSL
- implementation.
+ * lib/fileutils.rb (FileUtils#symbolic_modes_to_i): Fix the wrong
+ character class [+-=], which happened to match all desired
+ characters but also match undesired characters.
- * test/openssl/test_ssl.rb (class OpenSSL): Skip tests that need SSLv3
- if there is no support.
+ * lib/fileutils.rb (FileUtils.chmod{,_R}): Enhance the symbolic
+ mode parser to support the permission symbols u/g/o and multiple
+ actions as defined in SUS, so that chmod("g=o+w", file) works as
+ expected. Invalid symbolic modes are now rejected with
+ ArgumentError.
-Fri Aug 28 16:05:09 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri Jul 5 00:25:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rdoc/*: Update rdoc master(cfffed5)
- https://github.com/rdoc/rdoc/pull/337
- https://github.com/rdoc/rdoc/pull/367
+ * lib/mkmf.rb (have_framework): allow header file to check.
+ [ruby-core:55745] [Bug #8593]
-Fri Aug 28 10:16:20 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jul 4 22:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * vm.c (hook_before_rewind): prevent kicking :return event while
- finishing vm_exec func because invoke_block_from_c() kick a :return
- event for bmethods.
- [Bug #11492]
+ * object.c (rb_obj_equal): Fixed an rb_obj_equal documentation typo
+ where "a" was used instead of "obj".
+ Fixes GH-349. Patch by @adnandoric
- * test/ruby/test_settracefunc.rb: add a test.
+Thu Jul 4 20:39:20 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 27 18:05:42 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * tool/make-snapshot: Exit with EXIT_FAILURE when it fails.
- * lib/webrick/server.rb: use IO::NULL instead of '/dev/null'
- * test/ruby/test_string.rb: ditto.
+Thu Jul 4 20:20:23 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 27 15:24:57 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (maxpow_in_bdigit_dbl): Use tables if available.
+ (maxpow_in_bdigit): Ditto.
+ (U16): New macro.
+ (U32): Ditto.
+ (U64): Ditto.
+ (U128): Ditto.
+ (maxpow16_exp): New table.
+ (maxpow16_num): New table.
+ (maxpow32_exp): New table.
+ (maxpow32_num): New table.
+ (maxpow64_exp): New table.
+ (maxpow64_num): New table.
+ (maxpow128_exp): New table.
+ (maxpow128_num): New table.
- * compile.c (iseq_set_sequence): rename variable names
- to make it readable.
+Thu Jul 4 18:25:25 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 27 07:45:34 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (rb_cstr_to_inum): Avoid temporary buffer allocation except
+ very big base non-power-of-2 numbers.
- * thread_tools.c: add Queue#close(exception=false) and
- SizedQueue#close(exception=false).
- [Feature #10600]
+Thu Jul 4 15:51:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
- Trying to deq from a closed empty queue return nil
- if exception parameter equals to false (default).
+ * string.c (rb_str_succ): use ONIGENC_MBCLEN_CHARFOUND_P correctly.
- If exception parameter is truthy, it raises
- ClosedQueueError (< StopIteration).
- ClosedQueueError inherits StopIteration so that you can write:
+ * string.c (rb_str_dump): ditto.
- loop{ e = q.deq; (using e) }
+Thu Jul 4 10:04:11 2013 NARUSE, Yui <naruse@ruby-lang.org>
- Trying to close a closed queue raises ClosedQueueError.
+ * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
- Blocking threads to wait deq for Queue and SizedQueue will be
- restarted immediately by returning nil (exception=false) or
- raising a ClosedQueueError (exception=true).
+ * [bug] (thanks Akinori MUSHA and Ippei Obayashi)
+ Fix a renumbering bug in condition regexp with a named
+ capture. [Bug #8583]
+ * [spec] (thanks Akinori MUSHA)
+ Allow ENCLOSE_OPTION in look-behind.
- Blocking threads to wait enq for SizedQueue will be
- restarted by raising a ClosedQueueError immediately.
+Thu Jul 4 00:36:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- The above specification is not proposed specification, so that
- we need to continue discussion to conclude specification this
- method.
+ * internal.h (SIGNED_INTEGER_MAX): suppress warning C4146 on VC6.
+ seems a logical ORed expression becomes unsigned.
- * test/thread/test_queue.rb: add tests originally written by
- John Anderson and modify detailed behavior.
+Thu Jul 4 00:13:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 26 10:52:02 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ruby_atomic.h (rb_w32_atomic_cas): call InterlockedCompareExchange
+ directly.
- * re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching
- till the end of string. [ruby-core:70592] [Bug #11488]
+ * ruby_atomic.h (ATOMIC_CAS): fix missing function call.
- * test/ruby/test_m17n.rb (test_include?, test_index): add tests by
- Tom Stuart.
+Wed Jul 3 23:47:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 26 09:26:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in
+ VC6. only InterlockedCompareExchange is declared using PVOID.
- * id_table.c (list_table_extend, hash_table_extend): remove C99
- features. [ruby-dev:49239] [Bug #11487]
+Wed Jul 3 22:29:20 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 25 06:34:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (ruby_digit36_to_number_table): Declared.
- * win32/win32.c (w32_symlink): implement symlink().
+ * util.c (ruby_digit36_to_number_table): Moved from scan_digits.
-Mon Aug 24 16:01:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (conv_digit): Use ruby_digit36_to_number_table.
- * encoding.c (rb_locale_encindex): find encoding index without
- making a string object every time. [ruby-core:58160] [Bug #9080]
+ * pack.c (hex2num): Ditto.
-Sat Aug 22 15:43:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 3 18:12:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_eval.c (check_funcall_failed, check_funcall_missing): cache
- results of respond_to? and respond_to_missing?, and search a
- public method only for compatibility with rb_respond_to.
+ * lib/mkmf.rb (install_dirs): revert DESTDIR prefix by r39841, since
+ it is fixed by r41648. [ruby-core:55760] [Bug #8115]
-Sat Aug 22 08:23:32 2015 Koichi Sasada <ko1@atdot.net>
+Wed Jul 3 14:15:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/thread/thread.c: move definitions of Queue, SizedQueue
- and ConditionalVariables to thread_tools.c. In other words,
- such classes are built-in.
- [Feature #8919]
+ * dir.c (do_stat): use rb_w32_ustati64() in win32.c to get rid of
+ mysterious behavior of FindFirstFile() Windows API which treat "<"
+ and ">" like as wildcard characters. [ruby-core:55764] [Bug #8597]
- At first, I planned to embed only a Queue class.
- However, rubygems requires 'thread.rb' (rubygems are
- required at first, when launch MRI without --disable-gems).
- So most of people require 'thread.rb' as an embedded library.
+Wed Jul 3 12:06:42 2013 Tanaka Akira <akr@fsij.org>
- Now, ext/thread/thread.c is empty, only for a dummy for
- compatibility.
+ * bignum.c (maxpow_in_bdigit): Renamed from calc_hbase and return
+ maxpow.
- * thread.c: move a definition of Mutex class to thread_tools.c.
+Tue Jul 2 23:47:50 2013 Tanaka Akira <akr@fsij.org>
- And define Mutex class under Thread (so now Mutex is Thread::Mutex).
- Because other thread related classes are also defined under Thread.
- We remain ::Mutex as Thread::Mutex. Only an inspect result is changed.
+ * bignum.c (roomof): Cast to long.
+ (rb_ull2big): Fix bignew arguments.
- * common.mk: add dependency from thread.o to thread_tools.c.
+Tue Jul 2 21:17:37 2013 Tanaka Akira <akr@fsij.org>
-Sat Aug 22 05:31:37 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (rb_cstr_to_inum): Merge two temporary buffers.
- * vm_opts.h, iseq.c, iseq.h: add compile option to force frozen
- string literals.
- [Feature #11473]
+Tue Jul 2 20:25:04 2013 Tanaka Akira <akr@fsij.org>
- This addition is not specification change, but to try frozen
- string literal world discussed on [Feature #11473].
+ * bignum.c (rb_cstr_to_inum): Use BDIGIT_DBL to collect adjacent digits.
+ (BDIGIT_DBL_MAX): New macro.
+ (maxpow_in_bdigit_dbl): New function.
- You can try frozen string literal world using this magical line:
+Tue Jul 2 17:23:33 2013 Shugo Maeda <shugo@ruby-lang.org>
- RubyVM::InstructionSequence.compile_option =
- {frozen_string_literal: true}
+ * doc/syntax/refinements.rdoc: add description of Module#using and
+ refinement inheritance by module inclusion.
- Note that this is a global compilation option, so that you need to
- compile another script like that:
+Tue Jul 2 17:22:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- p 'foo'.frozen? #=> false
- RubyVM::InstructionSequence.compile_option =
- {frozen_string_literal: true}
- p 'foo'.frozen? #=> false, because this line is already compiled.
- p eval("'foo'.frozen?") #=> true
+ * internal.h: add EUC-JP and Windows-31J.
- Details:
- * String literals are deduped by rb_fstring().
- * Dynamic string literals ("...#{xyz}...") is now only frozen,
- not deduped. Maybe you have other ideas.
+ * re.c (rb_char_to_option_kcode): use built-in encoding indexes in
+ internal.h.
- Now, please do not use this option on your productions :)
- Of course, current specification can be changed.
+ * internal.h: add UTF8-MAC.
- * compile.c: ditto.
+ * dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
+ internal.h.
- * test/ruby/test_iseq.rb: add a test.
+ * internal.h: add UTF-{16,32} dummy encodings.
-Sat Aug 22 02:53:12 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * string.c (rb_str_inspect, str_scrub0): use built-in encoding indexes
+ in internal.h.
- * ext/psych/*: update to Psych 2.0.14
+ * internal.h: add UTF-{16,32}{BE,LE}.
- * test/psych/*: ditto
+ * io.c (io_strip_bom): use built-in encoding indexes in internal.h.
-Fri Aug 21 19:58:48 2015 Koichi Sasada <ko1@atdot.net>
+ * internal.h (rb_{ascii8bit,utf8,usascii}_encindex): use built-in
+ encoding indexes for optimization.
- * ext/objspace/objspace.c: add a new method ObjectSpace.count_symbols.
- [Feature #11158]
+ * encoding.c (enc_inspect, rb_locale_encindex),
+ (enc_set_filesystem_encoding, rb_filesystem_encindex): use built-in
+ encoding indexes directly.
- * symbol.c (rb_sym_immortal_count): added to count immortal symbols.
+ * encoding.c (rb_enc_set_index, rb_enc_associate_index): validate
+ argument encoding index.
- * symbol.h: ditto.
+ * include/ruby/encoding.h (ENCODING_SET): use rb_enc_set_index()
+ instead of setting inlined bits directly.
- * test/objspace/test_objspace.rb: add a test for this method.
+ * encoding.c (rb_enc_init): register preserved indexes.
- * NEWS: describe about this method.
+ * internal.h (ruby_preserved_encindex): move from encoding.c.
-Fri Aug 21 19:48:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 2 11:14:36 2013 Shota Fukumori <sorah@cookpad.com>
- * win32/Makefile.sub ($(LIBRUBY_SO)): needs additional libraries
- for extension libraries to link statically.
- [ruby-core:70499] [Feature #9018]
+ * lib/mkmf.rb (try_config): Fix to not replace $LDFLAGS with $libs
+ (1.9.3 behavior) [ruby-core:55752] [Bug #8595]
-Fri Aug 21 18:49:22 2015 Koichi Sasada <ko1@atdot.net>
+Tue Jul 2 00:39:59 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/ruby.h, cont.c, vm_trace.c: add a new event
- fiber_switch. We need more discussion about this feature
- so that I don't write it on NEWS.
- [Feature #11348]
+ * ext/socket/ipsocket.c (init_inetsock_internal): Don't try mismatched
+ address family if already failed.
- * test/ruby/test_settracefunc.rb: add tests.
+Mon Jul 1 23:07:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Aug 21 17:32:42 2015 Koichi Sasada <ko1@atdot.net>
+ * template/encdb.h.tmpl: define encoding index macros to use the index
+ statically from C source.
- * vm_insnhelper.c (vm_invoke_block): we should not expect ci->argc is
- stable after invoking a block. [Bug #11451]
+Mon Jul 1 22:57:19 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_yield.rb: add a test. This test script is given by
- Alex Dowad.
+ * bignum.c (bary_mul2): New function.
+ (rb_cstr_to_inum): Use a better algorithm to compose the result
+ if input length is very long.
-Fri Aug 21 06:35:50 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Mon Jul 1 20:22:00 2013 Kenta Murata <mrkn@cookpad.com>
- * test/openssl/test_ssl_session.rb: Fix tests so that they take in to
- account OpenSSL installations that have SSLv3 disabled by default.
- Thanks Jeremy Evans <code@jeremyevans.net> for the patches.
- [Bug #11366] [Bug #11367]
+ * ext/bigdecimal/bigdecimal.h (RB_UNUSED_VAR, UNREACHABLE):
+ import macros from ruby.h for 1.9.3.
+ [Bug #8588] [ruby-core:55730]
-Thu Aug 20 22:19:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.gemspec: Bump version to 1.2.1.
- * vm_method.c (basic_obj_respond_to): call respond_to_missing?
- only when redefined. [ruby-core:70460] [Bug #11465]
+Mon Jul 1 20:03:39 2013 Tanaka Akira <akr@fsij.org>
-Thu Aug 20 14:13:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/ipsocket.c (init_inetsock_internal): Use an address
+ family for local address which is different to the remote
+ address if no other choice.
- * vm_eval.c (check_funcall_respond_to): share the behavior with
- rb_obj_respond_to. [ruby-core:70460] [Bug #11465]
+Mon Jul 1 15:05:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c (vm_respond_to): extract from rb_obj_respond_to and
- merge r39881.
+ * lib/csv.rb (CSV#<<): use StringIO#set_encoding instead of creating
+ new StringIO instance with String#force_encoding, forcing encoding
+ discards the cached coderange bits and can make further operations
+ very slow. [ruby-core:55714] [Bug #8585]
-Thu Aug 20 08:53:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/stringio/stringio.c (strio_write): keep coderange of
+ ptr->string.
- * vm_method.c (rb_obj_respond_to): reuse found method entry
- instead of searching same entry repeatedly.
+ * string.c (rb_enc_cr_str_buf_cat, rb_str_append): consider an empty
+ string 7bit-clean and should not discard cached coderange of string
+ to be appended.
-Thu Aug 20 08:31:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 1 12:56:41 2013 Shugo Maeda <shugo@ruby-lang.org>
- * dir.c (replace_real_basename), win32/win32.c (opendir_internal):
- check reparse point tags and treat supported tags only as
- symbolic links. [ruby-core:70454] [Bug #11462]
+ * eval.c (rb_using_module): activate refinements in the ancestors of
+ the argument module to support refinement inheritance by
+ Module#include. [ruby-core:55671] [Feature #8571]
-Wed Aug 19 23:59:28 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * test/ruby/test_refinement.rb: related test.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): add OP_ALL to
- existing options rather than just setting it. Some vendors apply
- custom patches to their versions of OpenSSL that set default values
- for options. This commit respects the custom patches they've
- applied.
+Mon Jul 1 12:02:39 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ssl.rb (class OpenSSL): check that OP_ALL has been
- added to the options.
+ * bignum.c (rb_cstr_to_inum): Skip leading zeros.
-Wed Aug 19 23:55:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 1 00:59:23 2013 Tanaka Akira <akr@fsij.org>
- * process.c (rb_f_spawn): [DOC] elaborate environment variable
- values. [ruby-core:70456] [Bug #11463]
+ * bignum.c (nlz16): New function.
+ (nlz32): Ditto.
+ (nlz64): Ditto.
+ (nlz128): Ditto.
+ (nlz): Redefined using an above function.
+ (bitsize): New macro.
+ (rb_cstr_to_inum): Use bitsize instead of nlz.
-Wed Aug 19 23:48:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jun 30 22:40:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * win32/win32.c (winnt_lstat): check reparse point tags and treat
- supported tags only as symbolic links.
- [ruby-core:70454] [Bug #11462]
+ * lib/prime.rb: Corrected a few comments. Patch by @Nullset14.
+ Fixes GH-346.
-Tue Aug 18 20:05:49 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Jun 30 21:53:38 2013 Tanaka Akira <akr@fsij.org>
- * thread_pthread.c (reserve_stack): ensure the memory is really
- allocated. [Bug #11457]
+ * bignum.c (rb_cstr_to_inum): Use rb_integer_unpack if base is a power
+ of 2.
-Tue Aug 18 17:19:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jun 30 10:59:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (IS_BEG): include labeled argument state, which was
- EXPR_LABELARG. [ruby-dev:49221] [Bug #11456]
+ * win32/win32.c (join_argv): use backslash instead of slash in program
+ path, otherwise cannot invoke "./c\u{1ee7}a.exe" for some reason.
+ [ruby-core:24309] [Bug #1771]
-Tue Aug 18 16:16:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c (spawnv, spawn): use UTF-8 spawn family. [Bug #1771]
- * include/ruby/ruby.h (RClass): define only in C, `__attribute__`
- between `struct` and the name can't compile with g++.
- [ruby-core:70297] [Bug #11426]
+ * process.c (proc_exec_sh, proc_spawn_cmd, proc_spawn_sh): ditto.
-Mon Aug 17 20:56:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/win32.c (translate_char, join_argv, has_redirection): make
+ codepage aware.
- * parse.y: fix syntax error at do-block after a conditional
- operator. separate label-allowed and after-a-label states from
- others as bit flags. [ruby-dev:48790] [Bug #10653]
+ * win32/win32.c (rb_w32_udln_find_exe_r, rb_w32_udln_find_file_r):
+ codepage independent versions.
-Mon Aug 17 11:57:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/win32.c (w32_spawn): extract codepage aware code from
+ rb_w32_spawn().
- * io.c (rb_io_each_codepoint): raise an exception at incomplete
- character before EOF when conversion takes place. [Bug #11444]
+ * win32/win32.c (rb_w32_uspawn): add UTF-8 version function.
-Sun Aug 16 17:33:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * win32/win32.c (w32_aspawn_flags): extract codepage aware code from
+ rb_w32_aspawn_flags().
- * gems/bundled_gems: update latest version of bundled gems.
- It includes minitest-5.8.0 and test-unit 3.1.3.
+ * win32/win32.c (rb_w32_uaspawn_flags, rb_w32_uaspawn_flags): add
+ UTF-8 version functions.
-Sun Aug 16 17:24:10 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+ * win32/win32.c (w32_getenv): extract codepage aware code from
+ rb_w32_ugetenv() and rb_w32_getenv().
- * gc.c (gc_mark_children): check if RCLASS_EXT is valid
- before marking. This fixes the following test failure
- introduced in r51126:
+ * win32/win32.c (w32_stati64): extract codepage aware code from
+ rb_w32_ustati64() and rb_w32_stati64().
- make test-all TESTOPTS='--gc-stress ruby/test_refinement.rb'
+ * dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra
+ arguments to dln_find_{exe,file}_r().
-Sat Aug 15 10:51:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments.
- * ext/win32/lib/win32/registry.rb (API#SetValue): data size should
- be in bytes, not in chars. [ruby-core:70365] [Bug #11439]
+ * process.c (EXPORT_STR, EXPORT_DUP): convert to default process
+ encoding if defined.
-Sat Aug 15 10:15:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (check_exec_env_i): convert environment variables too.
- * io.c (rb_io_each_codepoint): read more data when read partially.
- [ruby-core:70379] [Bug #11444]
+ * process.c (rb_exec_fillarg): convert program path and arguments too.
-Sat Aug 15 04:33:39 2015 Eric Wong <e@80x24.org>
+Sun Jun 30 01:57:08 2013 Tanaka Akira <akr@fsij.org>
- * hash.c (any_hash): skip rb_objid_hash for static syms
- (rb_num_hash_start): extract from rb_ident_hash
- (rb_objid_hash): call rb_num_hash_start
- (rb_ident_hash): ditto
- [ruby-core:70181] [Feature #11405]
+ * bignum.c (big_rshift): Use abs2twocomp and twocomp2abs_bang.
-Sat Aug 15 04:16:13 2015 Eric Wong <e@80x24.org>
+Sun Jun 30 00:14:20 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c (rb_iseq_mark): reduce NULL checks
+ * bignum.c (RBIGNUM_SET_NEGATIVE_SIGN): New macro.
+ (RBIGNUM_SET_POSITIVE_SIGN): Ditto.
+ (rb_big_neg): Inline get2comp to avoid double negation.
-Fri Aug 14 18:50:57 2015 Eric Wong <e@80x24.org>
+Sat Jun 29 23:26:41 2013 Tanaka Akira <akr@fsij.org>
- * method.h (METHOD_ENTRY_VISI_SET): cast visi to int
- (METHOD_ENTRY_FLAGS_SET): ditto
+ * bignum.c (bary_neg): Extracted from bary_2comp.
+ (bary_plus_one): Extracted from bary_2comp.
+ (bary_2comp): Use bary_neg and bary_plus_one.
+ (big_extend_carry): Extracted from get2comp.
+ (get2comp): Use big_extend_carry.
+ (rb_integer_unpack): Use big_extend_carry.
+ (rb_big_neg): Use bary_neg.
-Fri Aug 14 18:43:11 2015 Eric Wong <e@80x24.org>
+Sat Jun 29 22:31:59 2013 Tanaka Akira <akr@fsij.org>
- * process.c (close_unless_reserved): add extra check
- (dup2_with_divert): remove
- (redirect_dup2): use dup2 without divert
- (before_exec_non_async_signal_safe): adjust call + comment
- (rb_f_exec): stop timer thread for all OSes
- (rb_exec_without_timer_thread): remove
- * eval.c (ruby_cleanup): adjust call
- * thread.c (rb_thread_stop_timer_thread): always close pipes
- * thread_pthread.c (struct timer_thread_pipe): add writing field,
- mark owner_process volatile for signal handlers
- (rb_thread_wakeup_timer_thread_fd): check valid FD
- (rb_thread_wakeup_timer_thread): set writing flag to prevent close
- (rb_thread_wakeup_timer_thread_low): ditto
- (CLOSE_INVALIDATE): new macro
- (close_invalidate): new function
- (close_communication_pipe): removed
- (setup_communication_pipe_internal): make errors non-fatal
- (setup_communication_pipe): ditto
- (thread_timer): close reading ends inside timer thread
- (rb_thread_create_timer_thread): make errors non-fatal
- (native_stop_timer_thread): close write ends only, always,
- wait for signal handlers to finish
- (rb_divert_reserved_fd): remove
- * thread_win32.c (native_stop_timer_thread): adjust (untested)
- (rb_divert_reserved_fd): remove
- * vm_core.h: adjust prototype
- [ruby-core:70386] [Bug #11336]
+ * bignum.c (bary_2comp): Simplified.
-Fri Aug 14 18:40:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 29 09:33:53 2013 Tanaka Akira <akr@fsij.org>
- * ext/win32/lib/win32/registry.rb (API#SetValue): add terminator
- size, not 1 byte. [ruby-core:70365] [Bug #11439]
+ * bignum.c (bigor_int): Return -1 if y == -1.
-Thu Aug 13 22:49:42 2015 Juanito Fatas <katehuang0320@gmail.com>
+Sat Jun 29 09:07:16 2013 Tanaka Akira <akr@fsij.org>
- * lib/timeout.rb (Timeout#timeout): freeze a string message to
- reduce string allocations. [Fix GH-996]
+ * bignum.c (bigor_int): Use RB_GC_GUARD.
+ (bigxor_int): Take xn and hibitsx arguments. Use twocomp2abs_bang.
+ (rb_big_xor): Use abs2twocomp and twocomp2abs_bang.
-Thu Aug 13 17:42:34 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 29 08:19:58 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h (rb_call_info_kw_arg_bytes): move the definition
- to iseq.h because this function is shared with iseq.c and compile.c.
+ * bignum.c (bigand_int): Don't apply bitwise and for BDIGIT and long.
+ (bigor_int): Take xn and hibitsx arguments. Use twocomp2abs_bang.
+ (rb_big_or): Use abs2twocomp and twocomp2abs_bang.
-Thu Aug 13 14:36:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 29 01:08:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * object.c (rb_num_to_dbl): move from num2dbl_with_to_f in math.c.
+ * numeric.c (fix_mul): remove FIT_SQRT_LONG test as it was causing
+ fix_mul to return an incorrect result for -2147483648*-2147483648
+ on 64 bit platforms
-Thu Aug 13 09:01:25 2015 Eric Wong <e@80x24.org>
+ * test/ruby/test_integer_comb.rb (class TestIntegerComb): add test case
- * load.c (features_index_add): avoid repeat calculation
+Fri Jun 28 12:26:53 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 12 21:57:31 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (rb_big_and): Allocate new bignum with same size to shorter
+ argument if it's high bits are zero.
- * id_table.c: IMPL() macro accept op as _opname instead of opname
- because jemalloc seems to replace the word `free' to `je_free'.
+Fri Jun 28 12:14:04 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 12 21:51:11 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/socket/ipsocket.c (init_inetsock_internal): Don't use local
+ addresses which address family is different to remote address.
- * id_table.c (mix_id_table_insert): fix memory leak.
+Fri Jun 28 08:06:22 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 12 21:17:38 2015 Eric Wong <e@80x24.org>
+ * bignum.c (bigand_int): Add arguments, xn and hibitsx.
+ Use twocomp2abs_bang.
- * iseq.c (iseq_memsize): reimplement for wrapper
- (param_keyword_size): extracted from iseq_memsize
- (iseqw_mark): new mark function
- (iseqw_data_type): new data type
- (iseqw_new): wrap as iseqw_data_type
- (iseqw_check): adjust for wrapper
- (Init_ISeq): remove iseqw_iseq_key initialization
- * test/objspace/test_objspace.rb: new test
- [ruby-core:70344] [Feature #11435]
+Thu Jun 27 23:58:13 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 12 21:15:27 2015 Eric Wong <e@80x24.org>
+ * bignum.c (abs2twocomp_bang): Removed.
+ (abs2twocomp): Take n_ret argument to return actual length.
+ (rb_big_and): Follow above change.
- * vm_core.h (rb_call_info_kw_arg_bytes): extract from compile.c
- * compile.c (iseq_build_callinfo_from_hash): use above function
+Thu Jun 27 22:52:19 2013 Tanaka Akira <akr@fsij.org>
-Wed Aug 12 18:00:17 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (get2comp): Use bary_2comp.
+ (abs2twocomp_bang): New function.
+ (abs2twocomp): New function.
+ (twocomp2abs_bang): New function.
+ (rb_big_and): Use abs2twocomp and twocomp2abs_bang.
- * class.c (move_refined_method): same as the last commit.
+Thu Jun 27 20:03:13 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-Wed Aug 12 17:57:53 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/openssl/lib/openssl/ssl.rb (verify_certificate_identity): fix
+ hostname verification. Patched by nahi.
- * class.c, gc.c vm.c: use ID_TABLE_* instead of ST_*
- (such as ST_CONTINUE) for enum rb_id_table_iterator_result.
+ * test/openssl/test_ssl.rb (test_verify_certificate_identity): test for
+ above.
-Wed Aug 12 17:05:36 2015 Koichi Sasada <ko1@atdot.net>
- * id_table.h: introduce ID key table.
- [Feature #11420]
+Thu Jun 27 00:23:57 2013 Tanaka Akira <akr@fsij.org>
- This table only manage ID->VALUE table to reduce overhead of st.
+ * bignum.c (rb_big_pow): Retry if y is a Bignum and it is
+ representable as a Fixnum.
+ Use rb_absint_numwords.
- Some functions prefixed rb_id_table_* are provided.
+Wed Jun 26 23:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * id_table.c: implement rb_id_table_*.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode): fix typo.
+ Fixes GH-343. Patch by @jgarber.
- There are several algorithms to implement it.
+Wed Jun 26 23:22:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- Now, there are roughly 4 types:
+ * enumerator.c (rb_enumeratorize_with_size): use strict definition
+ rb_enumerator_size_func.
- * st
- * array
- * hash (implemented by Yura Sokolov)
- * mix of array and hash
+Wed Jun 26 23:11:14 2013 Kouhei Sutou <kou@cozmixng.org>
- The macro ID_TABLE_IMPL can choose implementation.
- You can see detailes about them at the head of id_table.c.
+ * gc.c (is_before_sweep): Add a missing space before a parenthesis.
+ * gc.c (rb_gc_force_recycle): Add a missing space around a parenthesis.
- At the default, I choose 34 (mix of list and hash).
- This is not final decision.
- Please report your suitable parameters or
- your data structure.
+Wed Jun 26 22:44:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * symbol.c: introduce rb_id_serial_t and rb_id_to_serial()
- to represent ID by serial number.
+ * include/ruby/intern.h (rb_enumeratorize_with_size): cast for
+ backward compatibility.
- * internal.h: use id_table for method tables.
+ * include/ruby/intern.h (rb_enumerator_size_func): define strict
+ function declaration for rb_enumeratorize_with_size().
- * class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto.
+Wed Jun 26 21:01:22 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Wed Aug 12 05:19:11 2015 Eric Wong <e@80x24.org>
+ * test/ruby/test_io.rb (TestIO#test_write_32bit_boundary): skip if
+ writing a file is slow.
+ [ruby-core:55541] [Bug #8519]
- * parse.y (rb_parser_compile_cstr): remove volatile arg
- (rb_parser_compile_string): ditto
- (rb_parser_compile_file): ditto
- (rb_parser_compile_string_path): ditto
- (rb_parser_compile_file_path): ditto
- [ruby-core:70323] [Misc #11431]
+Wed Jun 26 16:42:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 11 22:59:57 2015 Tanaka Akira <akr@fsij.org>
+ * lib/mkmf.rb: should use expanded values for header directories
+ unless extmk. patch by vo.x (Vit Ondruch) at [ruby-core:55653]
+ [Bug #8115], rhbz#921650.
- * numeric.c (Init_Numeric): Fix document for Float::MIN and
- Float::EPSILON.
+Wed Jun 26 12:48:22 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 15:22:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigxor_int): Fix a buffer over read.
- * include/ruby/ruby.h (ALLOCV_N): check integer overflow, as well
- as ruby_xmalloc2. pointed out by Paul <pawlkt AT gmail.com>.
+Wed Jun 26 12:13:12 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 14:57:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigand_int): Consider negative values.
+ (bigor_int): The allocated bignum should have enough size
+ to store long.
+ This fixes (bignum fits in a BDIGIT) | (fixnum bigger than BDIGIT)
+ on platforms which SIZEOF_BDIGITS < SIZEOF_LONG,
+ such as LP64 with 32bit BDIGIT (no int128).
- * array.c (rb_ary_repeated_permutation): fix buffer size, ALLOCV_N
- already multiplies element size.
+Wed Jun 26 12:08:51 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 12:13:20 2015 Jeremy Evans <merch-redmine@jeremyevans.net>
+ * test/socket/test_udp.rb: Close sockets explicitly.
+ Don't use fixed port number.
- * test/openssl/test_ssl.rb: Fix LocalJumpErrors being raised
- in OpenSSL tests. [ruby-core:70020][Bug #11368]
+Wed Jun 26 07:27:17 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 11:54:13 2015 Alexey Lipnyagov <liptonshmidt@gmail.com>
+ * bignum.c (bigand_int): Fix a buffer over read.
- * string.c: Fix documentation for String#slice
- [ruby-core:70298][Bug #11427]
+Wed Jun 26 06:48:07 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 11:53:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigadd_int): Fix a buffer over read.
- * parse.y (superclass): make superclass rule optional and allow
- any contents without a terminator. [EXPERIMENTAL]
+Wed Jun 26 01:18:13 2013 Masaya Tarui <tarui@ruby-lang.org>
-Tue Aug 11 10:58:42 2015 Juanito Fatas <juanitofatas@gmail.com>
+ * gc.c (is_before_sweep): Add new helper function that check the object
+ is before sweep?
+ * gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot
+ already ready to minor sweep.
- * string.c: [DOC] Make #end_with? example doc symmetry
- with #start_with? [fix GH-992][ci skip]
+Wed Jun 26 01:17:29 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 10:51:19 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (bigsub_int): Fix a buffer over read.
- * test/ruby/test_array.rb: Add test for `Array#flatten` with level 1
- [fix GH-986] Patch @yui-knk
+Tue Jun 25 22:45:43 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 11 10:48:16 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (rb_absint_singlebit_p): Use POW2_P.
+ (bary_pack): Ditto.
+ (rb_big2str0): Ditto.
+ (POW2_P): Moved to top.
- * enum.c: added doc for Enumerable#zip
- [fix GH-985] Patch by @yui-knk
- * test/ruby/test_enum.rb: added tests for Enumerable#zip
- [fix GH-985] Patch @yui-knk
+Tue Jun 25 22:28:07 2013 Akinori MUSHA <knu@iDaemons.org>
-Tue Aug 11 10:33:26 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Pass
+ DESTDIR via command line to override what's in MAKEFLAGS. This
+ fixes an installation problem under a package building
+ environment where DESTDIR is specified in the (parent) command
+ line. [Fixes GH-327]
- * vm_method.c: typo fix [fix GH-993][ci skip] Patch by @0x0dea
- * test/ruby/test_refinement.rb: ditto.
+Tue Jun 25 21:43:13 2013 Tanaka Akira <akr@fsij.org>
-Sun Aug 9 14:15:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (big2dbl): Use (BDIGIT)1 instead of 1UL.
+ (bary_mul_normal): Remove a useless cast.
- * vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings
- table in rb_vm_t. [ruby-core:70274] [Bug #11423]
+Tue Jun 25 21:26:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Sat Aug 8 03:59:51 2015 Zachary Scott <zzak@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix for the cases when
+ the argument x is not a BigDecimal.
+ This change is based on the patch made by Heesob Park and Garth Snyder.
+ [Bug #6862] [ruby-core:47145]
+ [Fixes GH-332] https://github.com/ruby/ruby/pull/332
- * object.c: [DOC] Improve grammar for Module#===
- Patch by @SkyBirdSoar in documenting-ruby/ruby#52:
- https://github.com/documenting-ruby/ruby/pull/52
+Tue Jun 25 20:36:31 2013 Tanaka Akira <akr@fsij.org>
-Sat Aug 8 03:39:33 2015 Zachary Scott <zzak@ruby-lang.org>
+ * bignum.c (big2ulong): "check" argument removed.
+ (rb_big2ulong): Follow above change.
+ (rb_big2long): Ditto.
+ (rb_big_rshift): Ditto.
+ (rb_big_aref): Ditto.
- * hash.c: [DOC] Improve description of symbol key syntax
- Patch by Raphael Das Gupta in documenting-ruby/ruby#51:
- https://github.com/documenting-ruby/ruby/pull/51
+Tue Jun 25 20:08:29 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 7 21:04:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
+ (rb_big_aref): Call big2ulong with TRUE for "check" argument.
+ It should be non-effective.
- * parse.y (parser_params): turn in_def and in_single into bit
- flags and reduce the size by 2-words.
+Tue Jun 25 19:07:33 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (parser_params): remove redundant prefixes.
+ * bignum.c (LSHIFTX): Revert r41611.
+ The redundant expression suppresses a warning, C4293, by Visual
+ Studio.
+ http://ruby-mswin.cloudapp.net/vc10-x64/ruby-trunk/log/20130625T072854Z.log.html.gz#miniruby
- * parse.y (yylex): non-pure parser has not been supported since
- merger of ripper. change argument types from void pointers.
+Tue Jun 25 19:03:00 2013 Tanaka Akira <akr@fsij.org>
-Fri Aug 7 17:07:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (big2ulong): Add a cast.
+ (big2ull): Add a specialized code for SIZEOF_LONG_LONG <=
+ SIZEOF_BDIGITS.
- * proc.c (method_super_method): uncallable method entry does not
- have the defined class, use the owner instead.
- [ruby-core:70254] [Bug #11419]
+Tue Jun 25 12:42:57 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_method.rb (test_super_method_unbound): add test
- by Akira Matsuda.
+ * bignum.c (integer_unpack_single_bdigit): Use "1 + ~u" instead of
+ "-u" to suppress warning (C4146) by Visual Studio.
+ Reported by ko1 via IRC.
-Thu Aug 6 10:49:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 25 12:28:57 2013 Tanaka Akira <akr@fsij.org>
- * node.c (rb_alloc_tmp_buffer): round up the size and check the
- range.
+ * bignum.c (big2ulong): Add code specialized for SIZEOF_LONG <=
+ SIZEOF_BDIGITS.
+ This prevents shift width warning from "num <<= BITSPERDIG".
- * ruby_atomic.h (ATOMIC_VALUE_EXCHANGE, ATOMIC_VALUE_CAS): add
- atomic operations for VALUE.
+Tue Jun 25 12:23:30 2013 Koichi Sasada <ko1@atdot.net>
-Thu Aug 6 08:15:49 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c: fix oldgen/remembered_shady counting algorithm.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move
- SSLSocket#sysclose to Ruby.
+ * gc.c (rgengc_check_shady): increment
+ `objspace->rgengc.remembered_shady_object_count' here.
- * ext/openssl/ossl_ssl.c (ossl_ssl_close): ditto
+ * gc.c (rgengc_remember): return FALSE if obj is already remembered.
-Thu Aug 6 07:57:21 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c (rgengc_rememberset_mark): make it void.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move nonblock
- enable to SSLSocket#initialize and remove Nonblock module.
+ * gc.c (gc_mark_children): fix to double counting oldgen_object_count
+ at minor GC.
-Thu Aug 6 07:53:47 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Tue Jun 25 12:07:18 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move
- OpenSSL::SSL::SSLSocket#initialize to Ruby.
+ * bignum.c (MSB): Removed.
+ (BDIGIT_MSB): Defined using BIGRAD_HALF.
+ (bary_2comp): Apply BIGLO after possible over flow of BDIGIT.
+ (get2comp): Ditto.
+ (bary_unpack_internal): Use BDIGIT_MSB.
+ Apply BIGLO after possible over flow of BDIGIT.
+ (rb_integer_unpack): Use BDIGIT_MSB.
+ (calc_hbase): Use BDIGMAX.
+ (big2dbl): Use BDIGMAX.
+ Apply BIGLO after possible over flow of BDIGIT.
+ (rb_big_neg): Apply BIGLO after possible over flow of BDIGIT.
+ (biglsh_bang): Ditto.
+ (bigrsh_bang): Ditto.
+ (bary_divmod): Use BDIGIT_MSB.
+ (bigdivrem): Ditto.
+ (bigxor_int): Apply BIGLO after possible over flow of BDIGIT.
- * ext/openssl/ossl_ssl.c: ditto
+ * marshal.c (shortlen): Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).
-Thu Aug 6 02:25:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): Use SIZEOF_BDIGITS
+ instead of sizeof(BDIGIT).
- * node.c (rb_alloc_tmp_buffer): use NODE_ALLOCA to mark locations
- like as builtin alloca. [ruby-core:70251] [Bug #11418]
+Tue Jun 25 11:40:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 5 14:37:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (big2ulong): suppress shorten-64-to-32 warning. BDIGIT can
+ be bigger than long now.
- * transcode.c (rb_econv_open0): rb_econv_t::source_encoding_name
- and rb_econv_t::destination_encoding_name should refer static
- strings always or NULL. [ruby-core:70247] [Bug #11416]
+ * bignum.c (LSHIFTX): remove redundant never-true expression.
-Tue Aug 4 16:53:43 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Tue Jun 25 00:55:54 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): extract callback
- lookup to private Ruby methods. This means we can keep the default
- DH callback logic hidden from consumers. Also, since the SSLSocket
- always has a context, we can remove conditionals about that
- instance.
+ * gc.c (typedef struct rb_objspace): Change members for monitor objects.
+ * gc.c (gc_marks_test): Check all WriteBarrier Errors and track them in obj-tree.
+ * gc.c (rgengc_check_shady): Ditto.
+ * gc.c (gc_marks): Move 2 function calls to gc_marks_test for test initialize.
- * ext/openssl/ossl_ssl.c: move callback lookup methods to private Ruby
- methods.
+Mon Jun 24 23:30:31 2013 Tanaka Akira <akr@fsij.org>
-Tue Aug 4 16:40:26 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (integer_unpack_single_bdigit): Refine code to filling
+ higher bits and use BIGLO.
- * test/ruby/test_module.rb: should not expect a method table ordering.
- [Feature #11414]
+Mon Jun 24 22:26:31 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Tue Aug 04 15:30:04 2015 Koichi Sasada <ko1@atdot.net>
+ * test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6):
+ ifindex() function may not be implemented on Windows. We use another
+ check for the case.
- * proc.c (rb_block_clear_env_self): clear by Qfalse instead of Qnil.
- [Bug #11409]
+Mon Jun 24 22:11:37 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * test/ruby/test_eval.rb: add tests for this issue,
- written by @0x0dea.
- https://github.com/ruby/ruby/pull/988
+ * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_nolock):
+ skip a failing test on Windows because flock() implementation is
+ different from Unix.
-Tue Aug 4 12:12:14 2015 Eric Wong <e@80x24.org>
+Mon Jun 24 22:06:14 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * variable.c: wrap long lines
+ * test/rubygems/test_gem_installer.rb (test_install_extension_flat):
+ use ruby in build directory in case ruby is not installed.
+ [ruby-core:53265] [Bug #8058]
-Tue Aug 4 09:32:30 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Jun 24 22:04:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * proc.c: Removing duplicate doc [fix GH-987][ci skip]
- Patch by @ronakjangir47
+ * ext/dl/cfunc.c (rb_dlcfunc_call): fix conversion from Bignum to
+ pointer. sizeof(DLSTACK_TYPE) is larger than sizeof(long) on
+ Windows x64 and higher bits over sizeof(long) of DLSTACK_TYPE was
+ zero even if a pointer value was over 32 bits which causes SEGV on
+ DL::TestCPtr#test_to_ptr_io. Adding a cast solves the bug.
-Tue Aug 4 09:21:58 2015 Richard Schneeman <richard.schneeman+foo@gmail.com>
+Mon Jun 24 22:04:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * doc/contributing.rdoc: fixed wrong instructions with OS X
- [fix GH-989][ci skip] Patch by @schneems
+ * eval_error.c (warn_printf): use rb_vsprintf instead so ruby specific
+ extensions like PRIsVALUE can be used in format strings
+ * eval_error.c (error_print): use warn_print_str (alias for
+ rb_write_error_str) to print a string value instead of using
+ RSTRING_PTR and RSTRING_LEN manually
+ * eval.c (setup_exception): use PRIsVALUE instead of %s and RSTRING_PTR
-Mon Aug 3 10:08:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 24 20:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * re.c (rb_memsearch): should match only char boundaries in wide
- character encodings. [ruby-core:70220] [Bug #11413]
+ * compile.c (make_name_for_block): use PRIsVALUE in format string
+ instead of %s and RSTRING_PTR to protect objects from being garbage
+ collected too soon
+ * encoding.c (str_to_encindex): ditto
+ * hash.c (rb_hash_fetch_m): ditto
+ * io.c (rb_io_reopen): ditto
+ * parse.y (reg_fragment_check_gen): ditto
+ * parse.y (reg_compile_gen): ditto
+ * parse.y (ripper_assert_Qundef): ditto
+ * re.c (rb_reg_raise): ditto
+ * ruby.c (set_option_encoding_once): ditto
+ * vm_eval.c (rb_throw_obj): ditto
-Sun Aug 2 07:01:17 2015 Eric Wong <e@80x24.org>
+Mon Jun 24 07:57:18 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/lib/openssl/buffering.rb (gets):
- avoid comparing fixnum with nil
- * test/openssl/test_pair.rb: test gets with limit when EOF is hit
- Thanks to Bar Hofesh <bar.hofesh@safe-t.com> for the bug report
- and testing.
- [ruby-core:70149] [Bug #11400]
+ * gc.c (after_gc_sweep): Have to record malloc info before reset.
+ * gc.c (gc_prof_timer_start): Pick out part of new record creation as gc_prof_setup_new_record.
+ * gc.c (gc_prof_set_malloc_info): Move point of recording allocation size to front of mark.
-Sat Aug 1 17:13:15 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+Mon Jun 24 02:53:09 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/net/http/response.rb (Net::HTTPResponse::Inflater#finish):
- fix a bug that empty gzipped response body causes Zlib::BufError.
- [ruby-core:68846] [Bug #11058]
+ * array.c: Return value in Array overview example found by @PragTob
+ [Fixes GH-336] https://github.com/ruby/ruby/pull/336
- * test/net/http/test_httpresponse.rb: tests for the above.
+Mon Jun 24 02:45:51 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Aug 1 17:05:18 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+ * array.c (rb_ary_zip): typo by @PragTob [Fixes GH-337]
+ https://github.com/ruby/ruby/pull/337
- * lib/net/http/response.rb (Net::HTTPResponse#inflater):
- fix TypeError. An exception object might be nil.
- [ruby-core:68846] [Bug #11058]
+Mon Jun 24 02:42:01 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Aug 1 09:09:46 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * win32/README.win32: grammar typo by @blankenshipz [Fixes GH-334]
+ https://github.com/ruby/ruby/pull/334
- * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): Implement
- SSLContext#options and options= using SSL_CTX_set_options and
- SSL_CTX_get_options. This reduces the number of ivars we need and
- simplifies `ossl_sslctx_setup`.
+Mon Jun 24 00:59:35 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): Default `options`
- to SSL_OP_ALL
+ * bignum.c (BIGUP): Use LSHIFTX and avoid cast to consider the type
+ of x is bigger than BDIGIT_DBL.
+ (big2ulong): Use unsigned long to store the result.
+ (big2ull): Use unsigned LONG_LONG to store the result.
+ (bigand_int): Use long for num to avoid data loss.
+ (bigor_int): Ditto.
+ (bigxor_int): Ditto.
-Sat Aug 1 06:54:36 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Sun Jun 23 23:05:58 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (Init_ossl_ssl): OpenSSL declares these
- constants as longs, so we should follow that and use LONG2NUM.
- http://git.io/vOqxD
+ * include/ruby/defines.h (BDIGIT): Define it only if it is not defined
+ yet. This eases tests and debug.
+ (SIZEOF_BDIGITS): Ditto.
+ (BDIGIT_DBL): Ditto.
+ (BDIGIT_DBL_SIGNED): Ditto.
+ (PRI_BDIGIT_PREFIX): Ditto.
+ (PRI_BDIGIT_DBL_PREFIX): Ditto.
+ (PRIdBDIGIT): Define it only if PRI_BDIGIT_PREFIX is defined.
+ (PRIiBDIGIT): Ditto.
+ (PRIoBDIGIT): Ditto.
+ (PRIuBDIGIT): Ditto.
+ (PRIxBDIGIT): Ditto.
+ (PRIXBDIGIT): Ditto.
+ (PRIdBDIGIT_DBL): Ditto.
+ (PRIiBDIGIT_DBL): Ditto.
+ (PRIoBDIGIT_DBL): Ditto.
+ (PRIuBDIGIT_DBL): Ditto.
+ (PRIxBDIGIT_DBL): Ditto.
+ (PRIXBDIGIT_DBL): Ditto.
-Sat Aug 1 04:06:29 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Define it only if it is
+ not defined yet.
- * ext/openssl/ossl_ssl.c (ossl_call_tmp_dh_callback): change callback
- to return the Ruby dh (or ecdh) object that the caller cares about
- instead of doing rb_iv_get / set to communicate. This means we can
- remove an rb_iv_get call, and only use the set calls for their
- intended purpose (to prevent the object from being GC'd).
+Sun Jun 23 17:29:51 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (ossl_tmp_dh_callback): ditto
- * ext/openssl/ossl_ssl.c (ossl_call_tmp_ecdh_callback): ditto
- * ext/openssl/ossl_ssl.c (ossl_tmp_ecdh_callback): ditto
+ * bignum.c (integer_unpack_single_bdigit): Use a cast.
-Sat Aug 1 03:49:31 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Sun Jun 23 15:38:07 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_ssl.c (ossl_call_tmp_dh_callback): Similarly to the
- tmp_ecdh_callback, the SSLSocket instance always holds a reference
- to the SSLContext object (it's always set in `initialize`). The
- SSLContext holds a reference to the tmp_dh_callback. Ask the
- context for the callback instead of storing the callback in two
- places.
+ * bootstraptest/test_thread.rb: rescue resource limitation errors.
-Sat Aug 1 03:43:10 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Sun Jun 23 08:19:27 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (ossl_call_tmp_dh_callback): create an array
- and use `rb_apply` to clean up calls to `rb_protect`.
+ * bignum.c (integer_unpack_single_bdigit): Extracted from
+ bary_unpack_internal.
- * ext/openssl/ossl_ssl.c (ossl_tmp_dh_callback): ditto
+Sun Jun 23 07:41:52 2013 Tanaka Akira <akr@fsij.org>
-Sat Aug 1 03:27:12 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * bignum.c (bary_unpack_internal): Suppress warnings (C4146) on Visual Studio.
+ Reported by ko1 via IRC.
- * ext/openssl/ossl_ssl.c (ossl_call_tmp_ecdh_callback): The SSL socket
- always holds a reference to the SSLContext object, which will have
- the callback object. Ask the context for the callback instead of
- storing the callback in two places.
+Sun Jun 23 06:49:28 2013 Koichi Sasada <ko1@atdot.net>
-Sat Aug 1 03:14:07 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * include/ruby/ruby.h, gc.c: rename macros and functions:
+ OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(),
+ rb_obj_wb_giveup() -> rb_obj_wb_unprotect(),
+ rb_gc_giveup_promoted_writebarrier() ->
+ rb_gc_writebarrier_unprotect_promoted(),
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): convert
- `tmp_dh_callback` to Ruby, and call it when setting up an SSL
- connection. This allows us to move the "default" behavior to the
- reader method.
+ * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT().
- * ext/openssl/ossl_ssl.c: call the tmp_dh_callback instead of
- accessing the SSLContext's internals.
+Sun Jun 23 05:41:32 2013 Koichi Sasada <ko1@atdot.net>
-Fri Jul 31 23:34:27 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * class.c (rb_include_class_new), eval.c (rb_using_refinement):
+ make classes/modules (who share method table) shady.
+ If module `a' and `b' shares method table m_tbl and new method
+ with iseq is added, then write barrier is applied only `a' or `b'.
+ To avoid this issue, shade such classes/modules.
- * .travis.yml: update libssl before running tests.
- Thanks to Chris Sinjakli <chris@sinjakli.co.uk> for figuring out the
- travis settings!
+ * vm_method.c (rb_method_entry_make): add write barriers.
-Fri Jul 31 21:34:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jun 23 01:27:54 2013 Tanaka Akira <akr@fsij.org>
- * load.c (rb_require_internal): use rb_load_internal0 not to raise
- a exception to be caught.
+ * bignum.c (bytes_zero_p): Removed.
+ (bary_pack): Don't call bytes_zero_p.
-Thu Jul 30 13:19:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jun 23 00:51:29 2013 Tanaka Akira <akr@fsij.org>
- * variable.c (rb_const_get_0): warn deprecated constant reference.
+ * bignum.c (bytes_zero_p): Extracted from bary_pack.
+ (bary_pack): Use bytes_zero_p.
- * variable.c (rb_mod_deprecate_constant): mark constants to be
- warned as deprecated. [Feature #11398]
+Sun Jun 23 00:16:57 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 30 11:53:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (MSB): New macro.
+ (bary_unpack_internal): Use MSB.
+ (bary_divmod): Ditto.
+ (bigdivrem): Ditto.
- * thread.c (rb_thread_s_handle_interrupt): make identity hash, to
- compare masking classes just by their IDs.
+Sat Jun 22 23:45:22 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 30 11:52:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_swap): New function.
+ (bary_pack): Use bary_swap.
+ (bary_unpack_internal): Ditto.
- * load.c (rb_load_internal0): stop separating exits at loading
- from exits from execution. TAG_FATAL is the only case that
- `errinfo` is a Fixnum, and should continue to exit by JUMP_TAG
- but not raising as an ordinary exception.
- [ruby-core:70169] [Bug #11404]
+Sat Jun 22 23:18:39 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 30 10:42:27 2015 Alex Dowad <alexinbeijing@gmail.com>
+ * bignum.c (bytes_2comp): Renamed from quad_buf_complement.
+ (bary_pack): Use bytes_2comp.
+ (rb_quad_pack): Use rb_integer_pack.
+ (rb_quad_unpack): Use rb_integer_unpack.
- * load.c (rb_load_internal0): extra check before returning
- TAG_RAISE when a non-local transfer of control happens while
- loading and parsing a Ruby source file.
- [ruby-core:70169] [Bug #11404]
+Sat Jun 22 21:46:18 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 30 08:48:42 2015 Eric Wong <e@80x24.org>
+ * bignum.c (rb_integer_unpack): Don't allocate a Bignum if possible.
- * st.c (find_entry): constify st_table*
- (find_packed_index_from): ditto
- (find_packed_index): ditto
- (get_keys): ditto
- (get_values): ditto
+Sat Jun 22 21:03:58 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 30 04:29:25 2015 Eric Wong <e@80x24.org>
+ * pack.c (pack_unpack): Remove specialized unpackers for integers.
- * benchmark/bm_hash_aref_dsym.rb: new benchmark
- * benchmark/bm_hash_aref_dsym_long.rb: ditto
- * benchmark/bm_hash_aref_fix.rb: ditto
+Sat Jun 22 20:36:50 2013 Tanaka Akira <akr@fsij.org>
-Wed Jul 29 21:38:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_unpack_internal): Specialized unpacker implemented.
+ (bary_unpack): Support INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION.
+ (rb_integer_unpack): Support INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION.
- * hash.c (any_hash), symbol.c (dsymbol_alloc): fix dynamic symbol
- hash value by restricting in Fixnum range, that is `long`.
+Sat Jun 22 18:53:10 2013 Tanaka Akira <akr@fsij.org>
-Wed Jul 29 17:25:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_pack): Support
+ INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION flag.
+ Fix byte order and word order handling in code specialized for
+ wordsize % SIZEOF_BDIGITS == 0.
- * hash.c (rb_obj_hash): move in order to share with rb_any_hash.
+ * internal.h (INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION): Defined.
-Wed Jul 29 16:00:22 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 22 15:41:25 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (str_buf_cat): consider empty non-embed string case,
- not to loop infinitely. [ruby-core:70074] [Bug #11383]
+ * gc.c (rgengc_check_shady): add new WB miss checking
+ on RGENGC_CHECK_MODE >= 2.
-Wed Jul 29 15:25:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ (1) Save bitmaps before marking
+ (2) Run full marking
+ (3) On each traceable object,
+ (a) object was not oldgen (== newly or shady object) &&
+ (b) parent object was oldgen &&
+ (c) parent object was not remembered &&
+ (d) object was not remembered
+ then, it should be WB miss.
- * vm_eval.c (send_internal): set method_missing_reason before
- invoking overriding method_missing method so that the default
- method_missing can achieve it properly.
- [ruby-core:68515] [Bug #10969]
+ This idea of this checker is by Masaya Tarui <tarui@ruby-lang.org>.
-Wed Jul 29 14:54:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 22 15:25:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * hash.c (rb_sym_hash): return same value as rb_any_hash() of
- Symbol. [Bug #9381]
+ * ext/etc/etc.c (setup_passwd): revert r41560, unnecessary
- * hash.c (rb_any_hash): fix Float hash. rb_dbl_hash() returns a
- Fixnum, but not a long. [Bug #9381]
+Sat Jun 22 14:39:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Wed Jul 29 11:07:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/etc/etc.c (Init_etc): omit 'passwd' from definition of Etc::Passwd
+ if HAVE_STRUCT_PASSWD_PW_PASSWD is not defined to prevent mismatch of
+ fields and values in setup_passwd
- * internal.h (LIKELY, UNLIKELY): make a boolean to enforce 1 or 0.
+Sat Jun 22 14:35:40 2013 Tanaka Akira <akr@fsij.org>
-Wed Jul 29 10:44:43 2015 Alex Dowad <alexinbeijing@gmail.com>
+ * ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of
+ rb_big2ulong_pack and rb_big2ull.
- * gc.c: document argument passed to finalizer proc.
- [fix GH-976][ci skip] Patch by @alexdowad
+ * include/ruby/intern.h (rb_big2ulong_pack): Deprecated.
-Wed Jul 29 10:36:58 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Jun 22 14:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * io.c (rb_io_extract_modeenc): add option parameter `flags'
- to append extra oflags to normal mode.
- [Feature #11253] [ruby-core:69539]
+ * ext/etc/etc.c (setup_passwd): pass 0 as VALUE to rb_struct_new to
+ prevent segfault if the compiler passes it as a 32 bit integer on
+ a 64 bit ruby
-Wed Jul 29 04:54:47 2015 Eric Wong <e@80x24.org>
+Sat Jun 22 13:47:13 2013 Tanaka Akira <akr@fsij.org>
- * test/rubygems/test_gem_remote_fetcher.rb: pre-generate test key
- [ruby-core:70151] [Bug #11397]
+ * bignum.c (bary_pack): MEMZERO can be used even if nails is not zero.
-Tue Jul 28 10:32:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 22 13:43:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * internal.h (struct RClass): moved from ruby/ruby.h to hide the
- internals.
+ * ext/etc/etc.c (etc_getpwnam): use PRIsVALUE in format string instead
+ of %s and RSTRING_PTR
-Tue Jul 28 08:48:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/etc/etc.c (etc_getgrnam): ditto
- * configure.in (RUBY_TYPE_ATTRIBUTE): attribute declaration for
- types.
+Sat Jun 22 13:07:15 2013 Tanaka Akira <akr@fsij.org>
-Tue Jul 28 07:23:03 2015 Eric Wong <e@80x24.org>
+ * bignum.c (CLEAR_LOWBITS): Rewritten without RSHIFTX.
+ (RSHIFTX): Removed.
- * symbol.h (struct RSymbol): add hashval field
- * symbol.c (dsymbol_alloc): setup hashval field once
- * hash.c (rb_any_hash): return RSymbol->hashval directly
- * common.mk: hash.o depends on symbol.h
- Thanks to Bruno Escherl <bruno@escherl.net> for the bug report
- [ruby-core:70129] [Bug #11396]
+Sat Jun 22 10:38:03 2013 Tanaka Akira <akr@fsij.org>
-Tue Jul 28 03:26:15 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * pack.c (num2i32): Removed.
+ (pack_pack): Don't use num2i32.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): raise a more
- helpful exception when verifying the peer connection and an
- anonymous cipher has been selected. [ruby-core:68330] [Bug #10910]
- Thanks to Chris Sinjakli <chris@sinjakli.co.uk> for the patch.
+Sat Jun 22 09:55:13 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_ssl.rb (class OpenSSL): test for change
+ * bignum.c (LSHIFTX): Defined to suppress a warning.
+ (RSHIFTX): Ditto.
+ (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX.
+ (FILL_LOWBITS): Use LSHIFTX.
+ Reported by ko1 via IRC.
-Mon Jul 27 13:24:11 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 22 09:11:33 2013 Ryan Davis <ryand-ruby@zenspider.com>
- * template/id.h.tmpl (ID2ATTRSET): remove an unused macro.
+ * lib/minitest/*: Imported minitest 4.7.5 (r8724)
+ * test/minitest/*: ditto
-Mon Jul 27 12:21:15 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Jun 22 07:20:30 2013 Koichi Sasada <ko1@atdot.net>
- * test/openssl/test_ssl.rb: run tests on non-Unix platforms.
+ * gc.c (gc_prof_set_heap_info, after_gc_sweep): call
+ gc_prof_set_heap_info() just after sweeping to calculate
+ live object number correctly.
+ (live object number = total generated number (before marking) -
+ total freed number (after sweeping))
-Sun Jul 26 19:21:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_marks): record `oldgen_object_count' into current profile`
+ record directly.
- * ext/openssl/ossl_ssl.c (ossl_ssl_alpn_protocol): fix condition
- to compile, needs ALPN to be available. [Feature #9390]
+ * gc.c (rgengc_rememberset_mark): same for remembered_normal_objects
+ and remembered_shady_objects.
-Sun Jul 26 11:29:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 22 06:46:04 2013 Koichi Sasada <ko1@atdot.net>
- * signal.c (default_handler, Init_signal): discard SIGSYS, ENOSYS
- should raise a SystemCallError always instead.
+ * gc.c (rb_objspace::profile): rename rb_objspace::profile::record to
+ records (because it points a set of records) and add a field
+ rb_objspace::profile::current_record to point a current profiling
+ record.
-Sun Jul 26 10:26:35 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c: use above fields.
- * ext/openssl/ossl_ssl.c (ossl_call_servername_cb): set the ssl context
- object returned by the servername callback on to the socket as an
- instance variable. If the callback allocated a new context object
- and didn't keep a reference to it, it could be GC'd out from under
- the socket object.
+Sat Jun 22 06:05:36 2013 Koichi Sasada <ko1@atdot.net>
- * test/openssl/test_ssl.rb (class OpenSSL): test for change.
+ * gc.c (rb_gc_giveup_promoted_writebarrier): remove `rest_sweep()'
+ because all of remembered objects are called for gc_mark_children().
-Sun Jul 26 10:07:26 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Sat Jun 22 05:08:03 2013 Koichi Sasada <ko1@atdot.net>
- * test/openssl/test_ssl.rb (class OpenSSL): add test coverage around
- OpenSSL::SSL::SSLContext#servername_cb
+ * gc.c (rgengc_rememberset_mark): call gc_mark_children() for
+ remembered objects directly instead of pushing on the mark stack.
-Sun Jul 26 09:10:32 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Jun 22 04:48:53 2013 Koichi Sasada <ko1@atdot.net>
- * gems/bundled_gems: update latest version of bundled power_assert.
+ * include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for second
+ parameter `slot'. You don't need to write a cast (VALUE *) any more.
-Sun Jul 26 08:49:28 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
+ vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().
- * test/rubygems/test_gem_remote_fetcher.rb: backport rubygems upstream
- change for OpenSSL key length. see detail to
- https://github.com/rubygems/rubygems/pull/1290
+Sat Jun 22 04:37:08 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jul 26 08:33:03 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c (slot_sweep_body): rename to slot_sweep().
+ No need to separate major/minor GC.
- * ext/openssl/lib/openssl/pkey.rb: implement DEFAULT_512 and
- DEFAULT_1024 constants in Ruby.
+ * gc.c (gc_setup_mark_bits): remove gc_clear_mark_bits() and unify to
+ this function.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): Ask PKey for the
- default DH callback since it already must check whether openssl has
- been compiled with DH support.
+Sat Jun 22 04:20:21 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_pkey_dh.c (OSSL_PKEY_BN): Remove C definitions of
- DEFAULT_512 and DEFAULT_1024
+ * gc.c (check_bitmap_consistency): add to check flag and bitmap consistency.
+ Use this function in several places.
- * ext/openssl/ossl_pkey_dh.c (Init_ossl_dh): ditto
+Sat Jun 22 02:18:07 2013 Tanaka Akira <akr@fsij.org>
- * test/openssl/test_pkey_dh.rb (class OpenSSL): add test to ensure the
- Ruby definitions are the same as the C definitions were.
+ * bignum.c (bary_pack): Specialized packers implemented.
+ (HOST_BIGENDIAN_P): New macro.
+ (ALIGNOF): New macro.
+ (CLEAR_LOWBITS): New macro.
+ (FILL_LOWBITS): New macro.
+ (swap_bdigit): New macro.
+ (bary_2comp): Returns an int.
-Sun Jul 26 08:14:59 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * internal.h (swap16): Moved from pack.c
+ (swap32): Ditto.
+ (swap64): Ditto.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): support
- specifically setting the tmp_dh_callback to nil.
+Fri Jun 21 21:29:49 2013 Masaya Tarui <tarui@ruby-lang.org>
- * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto
+ * gc.c (typedef enum): Introduce flags of major gc reason.
+ * gc.c (garbage_collect_body): Ditto.
+ * gc.c (gc_profile_flags): Ditto.
+ * gc.c (gc_profile_dump_on): Ditto.
- * test/openssl/test_pair.rb (module OpenSSL): add a test
+Fri Jun 21 21:11:53 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jul 26 07:47:14 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c (allocate_sorted_heaps): remove unused variable `add'.
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move the default
- tmp_dh_callback Ruby code and set it as a default in `initialize`.
+Fri Jun 21 20:50:32 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_pkey_dh.c (static unsigned char DEFAULT_DH_512_GEN):
- move this constant to Ruby.
+ * include/ruby/ruby.h: constify RArray::as::ary and RArray::heap::ptr.
+ Use RARRAY_ASET() or RARRAY_PTR_USE() to modify Array objects.
- * ext/openssl/ossl_pkey_dh.c (static unsigned char DEFAULT_DH_1024_GEN):
- ditto
+ * array.c, gc.c: catch up above changes.
- * ext/openssl/ossl_pkey_dh.c (Init_ossl_dh): ditto
+Fri Jun 21 20:32:13 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_ssl.c (ossl_tmp_dh_callback): ditto
+ * vm_eval.c (eval_string_with_cref): fix WB miss.
- * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): tmp_dh_callback should
- always be set, so we can remove this conditional
+Fri Jun 21 20:15:49 2013 Koichi Sasada <ko1@atdot.net>
-Sun Jul 26 06:22:24 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
+ Introduce the following C APIs:
+ * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
+ The type of returned pointer is (const VALUE *).
+ * RSTRUCT_GET(st, idx) returns idx-th value of struct.
+ * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
+ And
+ * RSTRUCT_PTR(st) returns pointer with shady operation.
+ The type of returned pointer is (VALUE *).
- * test/openssl/test_pair.rb: add a test ensuring that the default DH
- callback is used when no DH callback is specified.
+ * struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.
-Sun Jul 26 04:08:27 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Fri Jun 21 19:38:37 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): add missing
- instance variables to squash warnings with alpn.
+ * bignum.c (BDIGMAX): Use BIGRAD.
+ (BIGLO): Use BDIGMAX.
+ (bigdivrem1): Ditto.
+ (bigor_int): Ditto.
+ (rb_big_or): Ditto.
-Sun Jul 26 03:42:19 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): move
- OpenSSL::SSL::SSLContext#initialize implementation to pure Ruby.
+ * pack.c (pack_pack): Move the implementation for 'c' directive after
+ pack_integer label.
- * ext/openssl/ossl_ssl.c (ossl_sslctx_initialize): ditto
+Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto
+ * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
-Sat Jul 25 21:03:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Note: T_MATCH object is also easy to support write barriers.
+ However, most of T_MATCH objects are short-lived objects.
+ So I skipped to support non-shady T_MATCH.
- * random.c (fill_random_bytes_syscall): get rid of blocking when
- no entropy is available. based on the patch by mame in
- [ruby-core:70114]. [Bug #11395]
+Fri Jun 21 18:56:58 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 25 11:05:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigsub_int): Use bdigit_roomof.
+ (bigadd_int): Ditto.
+ (bigand_int): Ditto.
+ (bigor_int): Ditto.
+ (bigxor_int): Ditto.
- * string.c (str_replace_shared_without_enc): fill the terminator
- of embedded strings in wide char encodings.
+Fri Jun 21 17:56:25 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jul 25 06:38:36 2015 Koichi Sasada <ko1@atdot.net>
+ * benchmark/gc/gcbench.rb: fix summary of benchmark result notation.
- * vm_core.h: size should be unsigned.
- * rb_call_info_t::index
- * rb_iseq_constant_body::stack_max
- * rb_iseq_constant_body::local_size
- * rb_iseq_constant_body::param::size
- * rb_iseq_constant_body::local_table_size
- * rb_iseq_constant_body::is_size
- * rb_iseq_constant_body::callinfo_size
+Fri Jun 21 16:38:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * iseq.h: same for iseq_catch_table::size.
+ * ext/openssl/ossl_x509attr.c: change OSSL_X509ATTR_IS_SINGLE and
+ OSSL_X509ATTR_SET_SINGLE macros to use ->value.set rather than
+ ->set to fix compile failure
- * compile.c: catch up these fix.
+Fri Jun 21 15:26:45 2013 Koichi Sasada <ko1@atdot.net>
- * iseq.c: ditto.
+ * gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP is
+ disabled.
- * proc.c: ditto.
+ * gc.c (gc_marks_test): store oldgen count and shady count
+ before test marking and restore them after marking.
- * vm.c: ditto.
+Fri Jun 21 15:07:42 2013 Koichi Sasada <ko1@atdot.net>
- * vm_args.c: ditto.
+ * gc.c: enable lazy sweep (commit miss).
- * vm_eval.c: ditto.
+Fri Jun 21 14:31:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c: ditto.
+ * hash.c (ruby_setenv): refine error message so include the variable
+ name.
-Sat Jul 25 06:00:09 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jun 21 14:15:08 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h: constify rb_iseq_constant_body::line_info_table.
+ * gc.c: fix to use total_allocated_object_num and heaps_used
+ at the GC time for profiler.
- * iseq.c: catch up this fix.
+Fri Jun 21 12:35:35 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jul 25 05:56:43 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c: RGENGC_CHECK_MODE should be 0.
- * vm_core.h: constify rb_iseq_constant_body::param::opt_table and
- rb_iseq_constant_body::param::keyword.
+Fri Jun 21 11:18:25 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c: catch up this fix.
+ * gc.c (gc_marks_body): fix to get `th' in this function.
-Sat Jul 25 04:47:01 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jun 21 10:21:44 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h: constify rb_iseq_constant_body::catch_table.
+ * gc.c (heaps_header/heaps_slot): embed bitmaps into heaps_slot.
+ no need to maintain allocation/free bitmaps.
- * compile.c (iseq_set_exception_table): catch up this fix.
+Fri Jun 21 09:22:16 2013 Koichi Sasada <ko1@atdot.net>
- * iseq.c: ditto.
+ * gc.c (slot_sweep_body): add counters at a time.
- * vm.c (vm_exec): ditto.
+ * gc.c (gc_profile_dump_on): fix line break position.
-Fri Jul 24 21:29:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 21 08:14:00 2013 Masaya Tarui <tarui@ruby-lang.org>
- * st.c (EQUAL, st_delete_safe): fix arguments order to compare
- function, searching key is the first and stored key is the
- second always.
+ * gc.c: refactoring bitmaps. introduce bits_t type and some Consts.
-Fri Jul 24 21:27:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 21 08:04:32 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (fstr_update_callback): fstring must not be a shared
- string, or the content without RSTRING_FSTR may be freed.
- [ruby-dev:49188] [Bug #11386]
+ * gc.c: fix to support USE_RGENGC == 0 (disable RGenGC).
+ If USE_RGENGC==0, it caused compilation error.
-Fri Jul 24 20:09:43 2015 Naohisa Goto <ngotogenome@gmail.com>
+Fri Jun 21 08:08:11 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6): prevent to use
- IPv6 loopback interface for
- Rinda::TestRingFinger#test_make_socket_ipv6_multicast and
- Rinda::TestRingFinger#test_make_socket_ipv6_multicast_hops.
- The tests are skipped if there are no IPv6 devices other than the
- loopback device. [Bug #11394] [ruby-dev:49199]
+ * gc.c (lazy_sweep): Use is_lazy_sweeping()
+ * gc.c (rest_sweep): Ditto.
+ * gc.c (gc_prepare_free_objects): Ditto.
- * test/rinda/test_rinda.rb (test_make_socket_ipv6_multicast): ditto
- for Rinda::TestRingServer#test_make_socket_ipv6_multicast.
+Fri Jun 21 07:34:47 2013 Koichi Sasada <ko1@atdot.net>
- * test/rinda/test_rinda.rb (test_ring_server_ipv6_multicast): ditto
- for Rinda::TestRingServer#test_ring_server_ipv6_multicast.
+ * gc.c (gc_profile_record::oldgen_objects): added.
-Fri Jul 24 16:35:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_profile_dump_on): print the following information:
+ * Living object counts
+ * Free object counts
+ If RGENGC_PROFILE > 0 then
+ * Oldgen object counts
+ * Remembered normal object counts
+ * Remembered shady object counts
- * string.c (fstr_update_callback): pool bare strings only.
+Fri Jun 21 06:43:59 2013 Tanaka Akira <akr@fsij.org>
- * string.c (rb_fstring): return the original string with sharing a
- fstring if it has extra attributes, not the fstring itself.
- [ruby-dev:49188] [Bug #11386]
+ * bignum.c (rb_ull2big): Refactored.
+ (rb_uint2big): Useless code removed.
-Fri Jul 24 16:35:34 2015 yui-knk <spiketeika@gmail.com>
+Fri Jun 21 05:37:39 2013 Koichi Sasada <ko1@atdot.net>
- * file.c (rb_file_s_extname): [DOC] add an example.
+ * gc.c (gc_prof_sweep_timer_stop): accumulate sweep time only when
+ record->gc_time > 0.
- * test/ruby/test_path.rb (test_extname): add tests. [Fix GH-978]
- * path starts with dot ('.a.rb')
- * path includes dir name ('a/b/d/test.rb')
- * path includes dir name and dir name starts with dot
- ('.a/b/d/test.rb')
+Fri Jun 21 00:37:31 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 23 18:50:43 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/bigdecimal: Workaround fix for bigdecimal test failures caused
+ by [ruby-dev:47413] [Feature #8509]
- * vm_core.h: constify rb_iseq_constant_body::local_table and
- rb_iseq_param_keyword::table and
- rb_iseq_param_keyword::default_values.
+ * ext/bigdecimal/bigdecimal.h (BDIGIT): Make it independent from the
+ definition for bignum.c.
+ (SIZEOF_BDIGITS): Ditto.
+ (BDIGIT_DBL): Ditto.
+ (BDIGIT_DBL_SIGNED): Ditto.
+ (PRI_BDIGIT_PREFIX): Undefine the definition.
+ (PRI_BDIGIT_DBL_PREFIX): Ditto.
- * compile.c: catch up this fix.
+ * ext/bigdecimal/bigdecimal.c (RBIGNUM_ZERO_P): Use rb_bigzero_p.
+ (bigzero_p): Removed.
+ (is_even): Use rb_big_pack.
- * iseq.c: ditto.
+Thu Jun 20 22:52:42 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 23 17:30:43 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (bigmul1_toom3): Don't call bignorm twice.
- * vm_core.h: constify rb_iseq_constant_body::iseq_encoded and
- rb_control_frame_t::pc.
+Thu Jun 20 22:49:27 2013 Tanaka Akira <akr@fsij.org>
- * compile.c (rb_iseq_translate_threaded_code): catch up this fix.
+ * bignum.c (bignorm): Don't call bigtrunc if the result is a fixnum.
- * iseq.c: ditto.
+Thu Jun 20 22:29:42 2013 Tanaka Akira <akr@fsij.org>
- * vm_exec.c (vm_exec_core): ditto.
+ * bignum.c (rb_uint2big): Refactored.
-Thu Jul 23 10:25:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 20 22:24:41 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/ruby.h: add raw FL macros, which assume always the
- argument object is not a special constant.
+ * bignum.c (dump_bignum): Use SIZEOF_BDIGITS.
- * internal.h (STR_EMBED_P, STR_SHARED_P): valid only for T_STRING.
+Thu Jun 20 22:22:46 2013 Tanaka Akira <akr@fsij.org>
- * string.c: deal with taint flags directly across String instances.
+ * bignum.c (big2ulong): Change the return type to unsigned long.
+ (rb_big2ulong_pack): Follow the above change.
+ (rb_big2long): Ditto.
+ (rb_big_lshift): Ditto.
+ (rb_big_rshift): Ditto.
+ (rb_big_aref): Ditto.
-Thu Jul 23 09:05:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 20 22:02:46 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (lambda_body): pop cmdarg stack for lookahead
- token. [ruby-core:70067] [Bug #11380]
+ * bignum.c (bary_unpack_internal): Return -2 when negative overflow.
+ (bary_unpack): Set the overflowed bit if an extra BDIGIT exists.
+ (rb_integer_unpack): Set the overflowed bit.
-Thu Jul 23 04:03:03 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Thu Jun 20 21:17:19 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_ssl.c: fix tests by not setting the instance
- variable on the frozen ssl instance.
+ * gc.c (rgengc_rememberset_mark): record
+ (1) normal objects count in remember set
+ (2) shady objects count in remember set
+ each GC timing.
-Thu Jul 23 03:32:26 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * gc.c (gc_profile_record_get): enable to access above information
+ and REMOVING_OBJECTS, EMPTY_OBJECTS.
- * ext/openssl/ossl_ssl.c: add ECDH callback support. [Feature #11356]
+Thu Jun 20 18:29:26 2013 Koichi Sasada <ko1@atdot.net>
- * test/openssl/test_pair.rb: test for ECDH callback support
+ * benchmark/gc/gcbench.rb: Do not use GC::Profiler::disable because
+ GC::Profiler::disable prohibit to access profiling data. It should
+ be spec bug.
-Thu Jul 23 03:29:49 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ Skip GC::Profiler::report if RUBY_VERSION < '2.0.0'
- * ext/openssl/ossl_ssl.c: add ALPN support. [Feature #9390]
+Thu Jun 20 17:59:08 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/extconf.rb: detect ALPN support in OpenSSL
+ * benchmark/gc/gcbench.rb: stop GC::Profiler before output results.
+ Generating GC::Profiler result under profiling causes infinite loop.
- * test/openssl/test_ssl.rb: test for ALPN
+Thu Jun 20 17:24:24 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 22 23:44:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/gc/gcbench.rb: don't use __dir__ to make compatible
+ with ruby 1.9.3.
- * string.c (rb_str_reverse): reversed string is not a substring,
- and should not set coderange of the original string.
- [ruby-dev:49189] [Bug #11387]
+Thu Jun 20 16:57:19 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 22 20:17:51 2015 Koichi Sasada <ko1@atdot.net>
+ * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
+ defining methods.
- * vm_core.h: modify layout of rb_iseq_constant_body.
+Thu Jun 20 16:46:46 2013 Koichi Sasada <ko1@atdot.net>
- Move frequent accessing fields to upper part.
+ * benchmark/bm_app_aobench.rb: added.
-Wed Jul 22 19:57:47 2015 Koichi Sasada <ko1@atdot.net>
+ * benchmark/gc/aobench.rb: added.
- * vm_core.h: remove unused declaration of
- iseq_compile_data_ensure_node_stack.
+Thu Jun 20 16:28:33 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 22 19:52:45 2015 Koichi Sasada <ko1@atdot.net>
+ * benchmark/bm_so_binary_trees.rb: disable `puts' method
+ and change iteration parameter to increase execution time.
- * vm_core.h: separate rb_iseq_body into rb_iseq_constant_body and
- rb_iseq_variable_body (rb_iseq_t::variable_body).
+ * benchmark/gc/binarytree.rb: added.
- rb_iseq_variable_body can be modified after compilation.
+Thu Jun 20 16:06:37 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c: use rb_iseq_t::variable_body.
+ * benchmark/gc/pentomino.rb: added.
+ Simply load pentomino puzzle in the benchmark/ directory.
- * iseq.c: ditto.
+Thu Jun 20 15:32:56 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c: ditto.
+ * benchmark/gc/redblack.rb: import red black tree benchmark from
+ https://github.com/jruby/rubybench/blob/master/time/bench_red_black.rb
-Wed Jul 22 17:50:35 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * benchmark/gc/ring.rb: add a benchmark. This benchmark create many
+ old objects.
- * lib/matrix/eigenvalue_decomposition.rb: refine code style.
- [fix GH-959][ci skip] Patch by @bogdanvlviv
+Thu Jun 20 15:14:00 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 22 15:48:47 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * benchmark/gc: create a directory to store GC related benchmark.
- * test/ruby/test_range.rb: Add test case for Range#end with
- exclude_end true case. [fix GH-968] Patch by @yui-knk
+ * benchmark/gc/gcbench.rb: moved from tool/gcbench.rb.
-Wed Jul 22 09:45:31 2015 Maksim Sitnikov <sitnikovme@undev.ru>
+ * benchmark/gc/hash(1|2).rb: ditto.
- * numeric.c (num_coerce): [DOC] fix doc for Numeric#coerce,
- missing '+'. [Fix GH-974]
+ * benchmark/gc/rdoc.rb: ditto.
-Wed Jul 22 07:24:18 2015 Koichi Sasada <ko1@atdot.net>
+ * benchmark/gc/null.rb: added.
- * make rb_iseq_t T_IMEMO object (type is imemo_iseq).
+ * common.mk: fix rule.
- All contents of previous rb_iseq_t is in rb_iseq_t::body.
- Remove rb_iseq_t::self because rb_iseq_t is an object.
+Thu Jun 20 14:09:54 2013 Koichi Sasada <ko1@atdot.net>
- RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq.
- So RubyVM::ISeq.of(something) method returns different wrapper
- objects but they point the same T_IMEMO/iseq object.
+ * tool/hashbench1.rb: fix parameter too. Increase temporary objects.
- This patch is big, but most of difference is replacement of
- iseq->xxx to iseq->body->xxx.
+Thu Jun 20 14:01:35 2013 Koichi Sasada <ko1@atdot.net>
- (previous) rb_iseq_t::compile_data is also located to
- rb_iseq_t::compile_data.
- It was moved from rb_iseq_body::compile_data.
+ * tool/hashbench1.rb: fix parameters.
- Now rb_iseq_t has empty two pointers.
- I will split rb_iseq_body data into static data and dynamic data.
+Thu Jun 20 14:00:34 2013 Koichi Sasada <ko1@atdot.net>
- * compile.c: rename some functions/macros.
- Now, we don't need to separate iseq and iseqval (only VALUE).
+ * common.mk: remove dependency from ruby.
- * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq).
+Thu Jun 20 13:14:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq.
+ * error.c (rb_check_backtrace): evaluate RARRAY_AREF only once.
+ the first argument of RB_TYPE_P is expanded twice for non-immediate
+ types.
- * gc.c: check T_IMEMO/iseq.
+Thu Jun 20 08:09:29 2013 Koichi Sasada <ko1@atdot.net>
- * internal.h: add imemo_type::imemo_iseq.
+ * tool/gcbench.rb: Summary in one line.
- * iseq.c: define RubyVM::InstructionSequence as T_OBJECT.
- Methods are implemented by functions named iseqw_....
+ * common.mk: separate gcbench-hash to gcbench-hash1 and gcbench-hash2.
- * load.c (rb_load_internal0): rb_iseq_new_top() returns
- rb_iseq_t (T_IMEMO/iesq).
+Thu Jun 20 08:07:23 2013 Tanaka Akira <akr@fsij.org>
- * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq).
+ * bignum.c (BIGSIZE): New macro.
+ (bigfixize): Use BIGSIZE.
+ (big2ulong): Ditto.
+ (check_shiftdown): Ditto.
+ (rb_big_aref): Ditto.
- * vm_core.h (GetISeqPtr): removed because it is not T_DATA now.
+Thu Jun 20 07:46:48 2013 Masaya Tarui <tarui@ruby-lang.org>
- * vm_core.h (struct rb_iseq_body): remove padding for
- [Bug #10037][ruby-core:63721].
+ * gc.c (rb_gc_writebarrier): give up rescan A and register B directly
+ if A has huge number of children.
-Wed Jul 22 07:15:33 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jun 20 07:30:35 2013 Koichi Sasada <ko1@atdot.net>
- * ext/objspace/objspace.c (total_i): no need to skip singleton classes.
+ * common.mk: add new rules `gcbench-rdoc', `gcbench-hash'.
-Wed Jul 22 06:37:54 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/gcbench.rb: separate GC bench framework and process.
- * vm_core.h: constify rb_call_info_t::kw_arg,
- rb_control_frame_t::iseq and rb_control_frame_t::block_iseq.
+ * tool/hashbench1.rb, tool/hashbench2.rb: add two types GC bench.
+ hashbench1: many temporal objects (GC by newobj)
+ hashbench2: hash size becomes bigger and bigger (GC by malloc)
+ Two benches are executed by `gcbench-hash' rule.
- * iseq.c (iseq_free): catch up this fix.
+ * tool/rdocbench.rb: separated.
- * vm.c: ditto.
+Thu Jun 20 06:25:39 2013 Koichi Sasada <ko1@atdot.net>
- * vm_dump.c: ditto.
+ * tool/rdocbench.rb: add summary.
-Wed Jul 22 06:25:45 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jun 20 06:18:01 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h: constify rb_call_info_t::blockiseq and rb_block_t::iseq.
+ * gc.c (gc_profile_total_time): check objspace->profile.next_index > 0.
- * vm.c, vm_insnhelper.c: catch up this fix.
+Thu Jun 20 05:47:41 2013 Koichi Sasada <ko1@atdot.net>
- * iseq.c (iseq_data_to_ary): constify the first iseq parameter.
+ * gc.c (gc_prof_sweep_timer_start): fix merge miss.
- * vm_insnhelper.c (vm_make_proc_with_iseq): ditto.
+ * gc.c (GC_PROFILE_MORE_DETAIL): set it 0.
-Wed Jul 22 06:17:35 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jun 20 05:38:56 2013 Koichi Sasada <ko1@atdot.net>
- * method.h: constify rb_method_iseq_t::iseqptr.
+ * gc.c: Accumulate sweep time to GC time.
+ Now [GC time] is [mark time] + [sweep time] + [misc].
+ ([GC time] >= [mark time] + [sweep time])
- * proc.c (rb_method_entry_min_max_arity): catch up this fix.
+ * gc.c (gc_prof_sweep_slot_timer_start/stop): rename to
+ gc_prof_sweep_timer_start/stop and locate at lazy_sweep().
- * vm_insnhelper.c (def_iseq_ptr): constify.
+ * gc.c (elapsed_time_from): add a utility function.
-Wed Jul 22 03:37:39 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jun 20 05:08:53 2013 Koichi Sasada <ko1@atdot.net>
- * gc.c (internal_object_p): Now a singleton classes appear by
- ObjectSpace.each_object. [Bug #11360]
+ * gc.c (gc_marks): fix wrong option. FALSE means major/full GC.
+ It should be TRUE (minor marking).
- * test/ruby/test_objectspace.rb: add a test about it.
+Thu Jun 20 02:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 21 21:21:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/win32.c (waitpid): should not return 0 but wait until exit
+ unless WNOHANG is given. waiting huge process may return while
+ active, for some reason.
- * thread.c (do_select): replace switch and goto with a loop to
- suppress maybe-uninitialized warnings by gcc6.
+Thu Jun 20 01:34:15 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (set_unblock_function, rb_wait_for_single_fd): ditto.
+ * bignum.c (bdigit_roomof): Use SIZEOF_BDIGITS.
+ (bigfixize): Refine an ifdef condition.
+ (rb_absint_size): Use bdigit_roomof.
+ (rb_absint_singlebit_p): Ditto.
+ (rb_integer_pack): Ditto.
+ (integer_pack_fill_dd): Use BITSPERDIG.
+ (integer_unpack_push_bits): Use BITSPERDIG, BIGLO and BIGDN.
-Tue Jul 21 20:32:33 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Jun 20 01:07:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_range.rb: Add test for Range#hash
- [fix GH-969] Patch by @yui-knk
+ * gc.c (MARKED_IN_BITMAP, FL_TEST2): return boolean value since always
+ used as boolean value.
-Tue Jul 21 19:43:20 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (MARK_IN_BITMAP, CLEAR_IN_BITMAP): evaluate bits once.
- * compile.c: constify the first parameter (iseq).
- * iseq_add_mark_object()
- * iseq_add_mark_object_compile_time()
+Thu Jun 20 00:05:07 2013 Koichi Sasada <ko1@atdot.net>
- * iseq.c, iseq.h (rb_iseq_add_mark_object): ditto.
+ * gc.c (RVALUE_PROMOTED): fix type.
-Tue Jul 21 16:18:48 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 23:39:01 2013 Koichi Sasada <ko1@atdot.net>
- * test/socket/test_nonblock.rb: increase buffer sizes
- to OpenBSD limits. Thanks to Jeremy Evans <code@jeremyevans.net>
- [ruby-core:70058]
+ * gc.c (gc_marks_test): rewrite checking code.
+ When RGENGC_CHECK_MODE >= 2, all minor marking, run normal minor
+ marking *and* major/full marking. After that, compare the results
+ and shows BUG if a object living with major/full marking but dead
+ with minor marking.
+ After detecting bugs, print references information.
+ (RGENGC_CHECK_MODE == 2, show references to dead object)
+ (RGENGC_CHECK_MODE == 3, show all references)
-Tue Jul 21 16:08:53 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 23:51:48 2013 Tanaka Akira <akr@fsij.org>
- * load.c (ruby_dln_librefs): make static
+ * bignum.c (bigfixize): Use rb_absint_size.
+ (check_shiftdown): Ditto.
+ (big2ulong): Use bdigit_roomof.
-Tue Jul 21 13:36:54 2015 yuuji.yaginuma <yuuji.yaginuma@gmail.com>
+Wed Jun 19 23:32:23 2013 Koichi Sasada <ko1@atdot.net>
- * lib/optparse.rb (complete): [DOC] fix typo. [Fix GH-973]
+ * gc.c (RVALUE_PROMOTED): check consistency between oldgen flag and
+ oldgen bitmap if RGENGC_CHECK_MODE > 0.
-Tue Jul 21 05:20:21 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 23:29:29 2013 Koichi Sasada <ko1@atdot.net>
- * io.c (nogvl_wait_for_single_fd): new function for Linux
- (maygvl_copy_stream_wait_read): Linux-specific version
- (nogvl_copy_stream_wait_write): use nogvl_wait_for_single_fd
- [ruby-core:70051] [Feature #11377]
+ * gc.c (rb_gc_force_recycle): clear oldgen bitmap, too.
-Mon Jul 20 15:04:30 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 21:02:13 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (parser_initialize): avoid redundant zero-ing
+ * bignum.c (rb_uint2big): Consider environments BDIGIT is bigger than
+ long.
+ (big2ulong): Ditto.
+ (rb_big_aref): Ditto.
+ (rb_big_pack): Just call rb_integer_pack.
+ (rb_big_unpack): Just call rb_integer_unpack.
-Mon Jul 20 12:12:05 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 20:51:21 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * parse.y (struct parser_params): pack: 88 => 256 bytes on 64-bit
- [ruby-core:70034] [Feature #11371]
+ * gc.c (gc_stress_get): GC.stress can be Fixnum.
-Sun Jul 19 14:29:18 2015 windwiny <windwiny.ubt@gmail.com>
+Wed Jun 19 19:31:30 2013 Tanaka Akira <akr@fsij.org>
- * ext/pty/pty.c: [DOC] fix example typo, an old name at move from
- PTY.open. [Fix GH-972]
+ * bignum.c (DIGSPERLONG): Don't define if BDIGIT is bigger than long.
+ (DIGSPERLL): Don't define if BDIGIT is bigger than LONG_LONG
+ (rb_absint_size): Consider environments BDIGIT is bigger than long.
+ Use BIGLO and BIGDN.
+ (rb_absint_singlebit_p): Ditto.
+ (rb_integer_pack): Ditto.
+ (bigsub_int): Consider environments BDIGIT is bigger than long.
+ Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).
+ (bigadd_int): Ditto.
+ (bigand_int): Ditto.
+ (bigor_int): Ditto.
+ (bigxor_int): Ditto.
-Sat Jul 18 21:29:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jun 19 15:14:30 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c (vm_check_ints_blocking): gather common statements at
- the end, and prefer LIKELY for Visual C optimization.
+ * include/ruby/ruby.h (struct rb_data_type_struct), gc.c: add
+ rb_data_type_struct::flags. Now, this flags is passed
+ at T_DATA object creation. You can specify FL_WB_PROTECTED
+ on this flag.
-Sat Jul 18 20:44:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * iseq.c: making non-shady iseq objects.
- * load.c (rb_load_internal0): do not raise any exceptions but
- return the result tag state.
+ * class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
- * load.c (rb_load_protect): reduce nested EXEC_TAGs.
+ * vm_core.h, iseq.h: constify fields to detect WB insertion.
-Sat Jul 18 19:52:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jun 19 15:11:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (run_finalizer): set and restore safe level here to reduce
- nested EXEC_TAGs.
+ * gc.c (gc_mark_children): show more info for broken object.
-Sat Jul 18 18:45:22 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jun 19 14:04:41 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * eval.c (ruby_cleanup): error_handle() returns exit status to the
- system, not internal error state, do not convert the exit status
- again.
+ * test/ruby/envutil.rb (EnvUtil#rubybin): remove unnecessary
+ unless expression.
-Sat Jul 18 10:29:03 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 07:47:48 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_process.rb: test thread+sigs work after failed exec
+ * gc.c (garbage_collect_body): use FIX2INT for ruby_gc_stress.
-Sat Jul 18 07:20:18 2015 Jeremy Evans <code@jeremyevans.net>
+Wed Jun 19 07:44:31 2013 Koichi Sasada <ko1@atdot.net>
- * test/socket/test_nonblock: use smaller buffer for sendmsg
- [ruby-core:70016] [Bug #11364]
+ * gc.c (rb_objspace::gc_stress): int -> VALUE to store Fixnum object.
-Sat Jul 18 07:04:24 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 07:25:35 2013 Koichi Sasada <ko1@atdot.net>
- * signal.c (trap_handler): cleanup to use RSTRING_GETMEM + memcmp
+ * gc.c (make_deferred): clear flags to T_ZOMBIE.
-Sat Jul 18 02:53:06 2015 Eric Wong <e@80x24.org>
+ * gc.c (slot_sweep_body): fix indent.
- * io.c (argf_read_nonblock): support `exception: false'
- (io_nonblock_eof): new function
- (io_read_nonblock): use io_nonblock_eof
- (argf_getpartial): accept kwargs hash for `exception: false'
- * test/ruby/test_argf.rb (test_read_nonblock): new test
- * NEWS: add item for ARGF.read_nonblock
- [ruby-core:70000] [Feature #11358]
+Wed Jun 19 07:18:47 2013 Tanaka Akira <akr@fsij.org>
-Fri Jul 17 23:51:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_big_aref): Apply BIGLO to ~xds[i] for environment which
+ BDIGIT is 16bit.
- * vm_eval.c (rb_eval_cmd): $SAFE=4 has been deprecated.
+Wed Jun 19 07:09:26 2013 Koichi Sasada <ko1@atdot.net>
-Fri Jul 17 22:18:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (rgengc_remember): fix output level.
- * compile.c (iseq_compile_each): use enum ruby_tag_type names.
+ * gc.c (rgengc_rememberset_mark): fix to output clear count.
+ (shady_object_count + clear_count = count of remembered objects)
- * vm_core.h (ruby_tag_type): move from eval_intern.h for compiling
- break/next/redo/return.
+Wed Jun 19 07:06:21 2013 Koichi Sasada <ko1@atdot.net>
-Fri Jul 17 15:39:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (rgengc_remember): check T_NONE and T_ZOMBIE
+ if RGENGC_CHECK_MODE > 0.
- * include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that
- tells if the coderange is clean, that is 7bit or valid, and no
- needs to scrub.
+Wed Jun 19 07:02:19 2013 Koichi Sasada <ko1@atdot.net>
- * re.c (rb_reg_expr_str): use ENC_CODERANGE_CLEAN_P.
+ * gc.c (RGENGC_CHECK_MODE): add new check mode `3'.
+ In this mode, show all references if there is
+ a miss-corrected object.
- * string.c (enc_strlen, rb_enc_cr_str_buf_cat, rb_str_scrub):
- ditto.
+Wed Jun 19 06:31:08 2013 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_enumerate_chars): ditto, and suppress a warning
- by gcc6.
+ * gc.c (gc_stress_set): add special option of GC.stress.
+ `GC.stress=(flag)' accepts integer to control behavior of GC.
+ See code for details. Of course, this feature is only for MRI.
-Fri Jul 17 15:36:52 2015 yui-knk <spiketeika@gmail.com>
+ You can debug RGenGC (WB) using `GC.stress = 1'.
+ Using this option, do minor marking at all possible places.
- * test/ruby/test_range.rb (test_first_last): Add test for
- `Range.new`. [Fix GH-971]
+ GC::STRESS_MINOR_MARK = 1 and GC::STRESS_LAZY_SWEEP = 2
+ seem good to add.
-Fri Jul 17 15:36:40 2015 yui-knk <spiketeika@gmail.com>
+Wed Jun 19 06:29:31 2013 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_range.rb (test_first_last): Add assertions to
- test of `Range#last` with exclude_end true case. [Fix GH-970]
+ * vm.c (kwmerge_i): add WB.
-Fri Jul 17 09:59:14 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 06:26:49 2013 Koichi Sasada <ko1@atdot.net>
- * thread.c (rb_thread_alone): simplify
+ * hash.c: `st_update()' also has same issue of last fix.
+ write barriers at callback function are too early.
+ All write barriers are executed after `st_update()'
-Fri Jul 17 09:58:32 2015 Eric Wong <e@80x24.org>
+Wed Jun 19 04:33:22 2013 Koichi Sasada <ko1@atdot.net>
- * lib/rinda/tuplespace.rb: remove enumerator require
- * test/pathname/test_pathname.rb: ditto
+ * variable.c (rb_const_set): fix WB miss.
-Fri Jul 17 05:33:58 2015 Eric Wong <e@80x24.org>
+ WBs had located before creating reference between a klass
+ and constant value. It causes GC bug.
- * iseq.c (rb_iseq_compile_with_option): reuse result of previous
- GET_THREAD() call
- * thread.c (thread_create_core): ditto
- (rb_mutex_trylock): ditto
- (rb_mutex_lock): ditto
- * process.c (rb_waitpid): avoid multiple eval from RUBY_VM_CHECK_INTS
- * thread.c (rb_thread_check_ints): ditto
+ # pseudo code:
+ WB(klass, value); # WB and remember klass
+ st_insert(klass->const_table, const_id, value);
-Thu Jul 16 19:12:30 2015 Eric Wong <e@80x24.org>
+ `st_insert()' can cause GC before inserting `value' and
+ forget `klass' from the remember set. After that, relationship
+ between `klass' and `value' are created with constant table.
+ Now, `value' can be young (shady) object and `klass' can be old
+ object, without remembering `klass' object.
+ At the next GC, old `klass' object will be skipped and
+ young (shady) `value' will be miss-collected. -> GC bug
- * thread.c (mutex_alloc): remove needless volatile
+ Lesson: The place of a WB is important.
-Thu Jul 16 22:05:29 2015 Koichi Sasada <ko1@atdot.net>
+Tue Jun 18 22:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * vm_core.h: constify rb_iseq_t::parent_iseq.
+ * vm_insnhelper.c (vm_call_method): ensure methods of type
+ VM_METHOD_TYPE_ATTR_SET are called with 1 argument
- rb_iseq_t::local_iseq is not constant data because
- local_iseq::flip_cnt can be modified (commented).
+ * test/ruby/test_module.rb
+ (TestModule#test_attr_writer_with_no_arguments): add test
+ [ruby-core:55543] [Bug #8540]
- * compile.c: catch up this fix.
+Tue Jun 18 22:36:23 2013 Masaya Tarui <tarui@ruby-lang.org>
- * iseq.c: ditto.
+ * gc.c (gc_profile_record_flag): fix typo.
- * vm_insnhelper.c: ditto.
+Tue Jun 18 22:08:53 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Jul 16 21:47:47 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * ext/objspace/object_tracing.c: Return for ::allocation_generation
- * process.c (redirect_dup2): when the new FD of dup2() conflicts
- with one of the timer thread FDs, the internal FD is diverted.
- [Bug #11336] [ruby-core:69886] [Bug #11350] [ruby-core:69961]
+Tue Jun 18 22:04:35 2013 Zachary Scott <zachary@zacharyscott.net>
- * process.c (dup2_with_divert): new function for the above purpose.
+ * ext/objspace/object_tracing.c: Document object_tracing methods.
- * thread_pthread.c (rb_divert_reserved_fd): new function for
- diverting reserved FD. If the given FD is the same as one of the
- reserved FDs, the reserved FD number is internally changed.
- It returns -1 when error. Otherwise, returns 0. It also returns
- 0 if there is no need to change reserved FD number.
+Tue Jun 18 21:58:17 2013 Zachary Scott <zachary@zacharyscott.net>
- * thread_win32.c (rb_divert_reserved_fd): always returns 0 because
- of no reserved FDs.
+ * gc.c: Rename rb_mObSpace -> rb_mObjSpace
- * internal.h (rb_divert_reserved_fd): prototype declaration.
- It is Ruby internal use only.
+Tue Jun 18 20:55:05 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Jul 16 21:47:46 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
- * iseq.c (rb_iseq_disasm): rename rb_iseq_t *iseqdat to iseq
- and VALUE *iseq to code.
+Tue Jun 18 20:39:04 2013 Zachary Scott <zachary@zacharyscott.net>
- * iseq.c (rb_iseq_disasm_insn): ditto.
+ * ext/objspace/object_tracing.c: Teach rdoc object_tracing.c [Bug #8537]
-Thu Jul 16 14:34:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 18 20:29:47 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm.c (REWIND_CFP): keep the arguments region inside the valid
- value stack. [ruby-core:69969] [Bug #11352]
+ * ext/.document: add object_tracing.c to document file
-Thu Jul 16 11:38:21 2015 Eric Wong <e@80x24.org>
+Tue Jun 18 20:20:27 2013 Zachary Scott <zachary@zacharyscott.net>
- * process.c (close_unless_reserved): declare type of `fd' arg
+ * ext/objspace/objspace.c: rdoc on require to overview from r41355
-Thu Jul 16 08:47:29 2015 Eric Wong <e@80x24.org>
+Tue Jun 18 18:39:58 2013 Tanaka Akira <akr@fsij.org>
- * load.c (rb_construct_expanded_load_path): fstring expanded path
- (get_loaded_features_index): fstring feature path
- (rb_provide_feature): ditto
- [ruby-core:69871] [Feature #11331]
+ * configure.in: Check __int128.
-Thu Jul 16 02:56:14 2015 Eric Wong <e@80x24.org>
+ * include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available.
+ (BDIGIT): Use uint64_t if uint128_t is available.
+ (SIZEOF_BDIGITS): Defined for above case.
+ (BDIGIT_DBL_SIGNED): Ditto.
+ (PRI_BDIGIT_PREFIX): Ditto.
- * thread.c (thread_initialize): avoid RSTRING_PTR and NUMT2INT
+ * include/ruby/ruby.h (PRI_64_PREFIX): Defined.
-Thu Jul 16 01:00:46 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which
+ rb_big_pow returns Float or Bignum.
- * test/ruby/test_process.rb (test_exec_close_reserved_fd): test for
- [Bug #11353]
+ [ruby-dev:47413] [Feature #8509]
-Thu Jul 16 00:35:42 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Tue Jun 18 16:43:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * .gitignore: ignore version.i.
+ * parse.y (parser_heredoc_restore): clear lex_strterm always to get
+ rid of marking recycled node. this bug is revealed by r41372 with
+ GC.stress=true.
-Wed Jul 15 23:40:32 2015 Naohisa Goto <ngotogenome@gmail.com>
+Tue Jun 18 12:53:25 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- use RUBY (= EnvUtil.rubybin)
+ * bignum.c (nlz): Cast the result explicitly.
+ (big2dbl): Don't assign BDIGIT values to int variable.
-Wed Jul 15 23:01:22 2015 Naohisa Goto <ngotogenome@gmail.com>
+Tue Jun 18 12:25:16 2013 Tanaka Akira <akr@fsij.org>
- * process.c (redirect_close, parent_redirect_close): should not close
- reserved FD. It should be closed in the exec system call due to the
- O_CLOEXEC or FD_CLOEXEC flag. [Bug #11353] [ruby-core:69977]
+ * bignum.c (rb_big_xor): Non-effective code removed.
- * process.c (close_unless_reserved): new function to close FD unless
- it is reserved for internal communication.
+Tue Jun 18 11:26:05 2013 Koichi Sasada <ko1@atdot.net>
- * thread_pthread.c (rb_reserved_fd_p): should check owner_process pid
- to avoid false positive in forked child process.
+ * gc.c (gc_stat): add `generated_normal_object_count_types' for
+ RGENGC_PROFILE >= 2.
-Wed Jul 15 18:31:18 2015 Eric Wong <e@80x24.org>
+Tue Jun 18 11:02:18 2013 Koichi Sasada <ko1@atdot.net>
- * proc.c (proc_mark): remove redundant check
- * vm.c (env_mark): ditto
+ * gc.c (gc_mark_maybe): check to skip T_NONE.
-Wed Jul 15 17:27:40 2015 Eric Wong <e@80x24.org>
+ * gc.c (markable_object_p): do not need to check (flags == 0) here.
- * iseq.c (iseq_mark): remove check for data pointer
- * proc.c (binding_mark): ditto
- * vm.c (rb_thread_mark): ditto
- * vm_trace.c (tp_mark): ditto
+Tue Jun 18 10:17:37 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 15 16:55:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * variable.c (rb_autoload): fix WB miss.
- * encoding.c (enc_autoload): drop dummy encoding flag from
- the loaded encoding index. this flag is used only in this
- source.
+Tue Jun 18 04:20:18 2013 Koichi Sasada <ko1@atdot.net>
-Wed Jul 15 14:39:29 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_mark_children): don't need to care about T_ZOMBIE here.
- * vm.c (vm_make_env_each): add comments about env layout.
- Do not use `i' to specify `new_ep'.
+Mon Jun 17 22:16:02 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * vm.c (rb_proc_create, rb_vm_make_proc_lambda): envval is not used.
+ * test/ruby/test_proc.rb (TestProc#test_block_given_method_to_proc):
+ run test for r41359.
-Wed Jul 15 08:59:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 17 21:42:18 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * gc.h (RUBY_MARK_UNLESS_NULL): evaluate the argument only once
- to get rid of inadvertent side effects.
+ * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):
+ new function to invoke a method with a block passed
+ as an argument.
-Wed Jul 15 02:53:11 2015 Koichi Sasada <ko1@atdot.net>
+ * string.c (sym_call): use the above function to avoid
+ a block sharing. [ruby-dev:47438] [Bug #8531]
- * vm_core.h, vm.c: remove rb_proc_t::envval because we can know it via
- rb_proc_t::block::ep.
+ * vm_insnhelper.c (vm_yield_with_cfunc): don't set block
+ in the frame.
- rb_vm_proc_envval(const rb_proc_t *proc) returns an Env object which
- the Proc object use.
+ * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc):
+ run related tests.
- * proc.c: catch up this fix.
+Mon Jun 17 21:33:27 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * vm_dump.c (rb_vmdebug_proc_dump_raw): ditto.
+ * include/ruby/intern.h, proc.c (rb_method_call_with_block):
+ new function to invoke a Method object with a block passed
+ as an argument.
-Wed Jul 15 02:27:22 2015 Koichi Sasada <ko1@atdot.net>
+ * proc.c (bmcall): use the above function to avoid a block sharing.
+ [ruby-core:54626] [Bug #8341]
- * vm_core.h, vm.c: remove rb_env_t::prev_envval because we can know it
- via env->ep.
+ * test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
+ run related tests.
- rb_vm_env_prev_envval(env) returns prev_envval via env->ep.
+Mon Jun 17 20:53:21 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h (rb_vm_env_local_variables): change parameter type
- from VALUE (T_DATA/env) to `const rb_env_t *' to make same as
- rb_vm_env_prev_envval().
+ * loadpath.c (RUBY_REVISION): Defined to suppress revision.h
+ inclusion actually. r41352 removes the dependency.
- * proc.c: catch up these changes.
+Mon Jun 17 18:15:57 2013 Benoit Daloze <eregontp@gmail.com>
- * vm_dump.c: ditto.
+ * ext/objspace/objspace.c: let rdoc know about objspace methods.
+ Specify 'objspace' should be required. See #8537.
- * vm.c: rename macros.
+Mon Jun 17 17:44:31 2013 Benoit Daloze <eregontp@gmail.com>
- * ENV_IN_HEAP_P() to VM_EP_IN_HEAP_P() because it uses ep.
- * ENV_VAL() to VM_ENV_EP_ENVVAL() because it is too short.
+ * gc.c (ObjectSpace): is a module not a class.
-Wed Jul 15 01:09:09 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/objspace/objspace.c: try to include overview in rdoc,
+ see #8537.
- * vm.c: refactoring Proc/Env related code.
+Mon Jun 17 17:38:24 2013 Benoit Daloze <eregontp@gmail.com>
- * vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t.
- Instead of this field, mark given block in Proc at rb_env_t::env.
+ * gc.c: fix example of ObjectSpace.define_finalizer in overview
- * vm.c (vm_make_env_each): make an Env object with this layout.
- And also simplify parameters.
+Mon Jun 17 16:59:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c: catch up this fix.
+ * ext/tk/tkutil/tkutil.c: use rb_sprintf(), rb_id2str(), and
+ rb_intern_str() instead of rb_intern() and RSTRING_PTR() with
+ RB_GC_GUARD(), to prevent temporary objects from GC.
+ [ruby-core:39000] [Bug #5199]
- * vm_core.h: remove rb_env_t::local_size because it is not used.
+Mon Jun 17 14:27:54 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_dump.c (rb_vmdebug_env_dump_raw): catch up this fix.
+ * vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1
- * vm_core.h (rb_vm_make_env_object): remove rb_vm_make_env_object()
- because it is only referred from vm.c.
+Mon Jun 17 13:04:01 2013 Akinori MUSHA <knu@iDaemons.org>
- * vm_eval.c (eval_string_with_cref): catch up this fix.
+ * tool/ifchange (until): Fix the condition, although harmless in
+ this case.
-Wed Jul 15 00:03:36 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Mon Jun 17 11:50:29 2013 Koichi Sasada <ko1@atdot.net>
- * gc.c (__has_feature): move into internal.h.
+ * gc.c (gc_mark_maybe): added. check `is_pointer_to_heap()' and
+ type is not T_ZOMBIE.
- * internal.h (__has_feature): ditto.
+ * gc.c: use `gc_mark_maybe()'. T_ZOMBIE objects should not be pushed
+ to the mark stack.
- * internal.h (__has_extension): new macro.
+Mon Jun 17 07:56:24 2013 Tanaka Akira <akr@fsij.org>
- * internal.h (STATIC_ASSERT): use _Static_assert with
- clang. [ruby-core:69931] [Bug #11343]
+ * bignum.c (bary_small_lshift): Renamed from bdigs_small_lshift.
+ (bary_small_rshift): Renamed from bdigs_small_rshift.
-Wed Jul 15 00:00:00 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Mon Jun 17 07:38:48 2013 Tanaka Akira <akr@fsij.org>
- * random.c (fill_random_bytes_syscall): fix compile error with
- clang. [ruby-core:69931] [Bug #11343]
+ * bignum.c (absint_numwords_bytes): Removed.
+ (rb_absint_numwords): Don't call absint_numwords_bytes.
-Tue Jul 14 11:22:42 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jun 16 23:14:58 2013 Tanaka Akira <akr@fsij.org>
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#register):
- notify the handler thread of new timeout registration.
+ * bignum.c (BARY_ADD): New macro.
+ (BARY_SUB): Ditto.
+ (BARY_MUL): Ditto.
+ (BARY_DIVMOD): Ditto.
+ (BARY_ZERO_P): Ditto.
+ (absint_numwords_generic): Use these macros.
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
- make sleep intervals adaptive than fixed period intervals.
+Sun Jun 16 21:41:39 2013 Tanaka Akira <akr@fsij.org>
- * lib/webrick/server.rb (WEBrick::GenericServer#start): flush
- shutdown pipe.
+ * bignum.c (bary_2comp): Extracted from get2comp.
+ (integer_unpack_num_bdigits): Extracted from
+ rb_integer_unpack_internal.
+ (bary_unpack_internal): Renamed from bary_unpack and support
+ INTEGER_PACK_2COMP.
+ (bary_unpack): New function to validate arguments and invoke
+ bary_unpack_internal.
+ (rb_integer_unpack_internal): Removed.
+ (rb_integer_unpack): Invoke bary_unpack_internal.
+ (rb_integer_unpack_2comp): Removed.
- * lib/webrick/server.rb (WEBrick::GenericServer#stop): request the
- server to stop immediately by sending data via shutdown pipe.
+ * internal.h (rb_integer_unpack_2comp): Removed.
-Mon Jul 13 23:58:08 2015 Stefano Tortarolo <stefano.tortarolo@gmail.com>
+ * pack.c: Follow the above change.
- * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#do_CONNECT):
- fix typos in debugger statements. [Fix GH-967]
+Sun Jun 16 18:41:42 2013 Tanaka Akira <akr@fsij.org>
-Mon Jul 13 19:11:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (INTEGER_PACK_2COMP): Defined.
+ (rb_integer_pack_2comp): Removed.
- * lib/timeout.rb (timeout): warn as deprecated for a long time.
+ * bignum.c (bary_pack): Support INTEGER_PACK_2COMP.
+ (rb_integer_pack): Invoke bary_pack directly.
+ (rb_integer_pack_2comp): Removed.
+ (rb_integer_pack_internal): Ditto.
+ (absint_numwords_generic): Follow the above change.
-Mon Jul 13 01:37:27 2015 Zachary Scott <zzak@ruby-lang.org>
+ * pack.c (pack_pack): Ditto.
- * ext/openssl/ossl.c: [DOC] Backport ruby/openssl@dbb3fdb [Bug #11345]
- Thanks to Tomoya Chiba for the report and help with patch.
+ * sprintf.c (rb_str_format): Ditto.
-Sun Jul 12 09:20:02 2015 Shota Fukumori <her@sorah.jp>
+Sun Jun 16 17:48:14 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/basicsocket.c: [DOC] typo (Errno::AGAIN -> Errno::EAGAIN)
+ * bignum.c (absint_numwords_generic): rb_funcall invocations removed.
- * ext/socket/socket.c: ditto
+Sun Jun 16 16:04:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/socket/tcpserver.c: ditto
+ * tool/config_files.rb: use URI.read to allow it runs with Ruby 1.8.5.
- * ext/socket/udpsocket.c: ditto
+Sun Jun 16 14:32:25 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/unixserver.c: ditto
+ * bignum.c (bary_pack) Extracted from rb_integer_pack_internal.
+ (absint_numwords_generic): Use bary_pack.
- * io.c: ditto
+Sun Jun 16 11:01:57 2013 Kouhei Sutou <kou@cozmixng.org>
-Sun Jul 12 06:42:23 2015 ksss <co000ri@gmail.com>
+ * NEWS (XMLRPC::Client#http): Add.
+ [ruby-core:55197] [Feature #8461]
- * test/stringio/test_stringio.rb (test_sysread): add a test for
- StringIO#sysread. [Fix GH-966]
+Sun Jun 16 10:38:45 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 11 21:16:34 2015 ksss <co000ri@gmail.com>
+ * bignum.c (bary_add): New function.
+ (bary_zero_p): Extracted from bigzero_p.
+ (absint_numwords_generic): Use bary_zero_p and bary_add.
+ (bary_mul): Fix an argument for bary_mul_single.
+ (bary_divmod): Use size_t for arguments.
- * ext/stringio/stringio.c (Init_stringio): [DOC] Fix an example,
- StringIO#puts should be set "\n" at last. [Fix GH-965]
+Sun Jun 16 08:55:22 2013 Tanaka Akira <akr@fsij.org>
-Sat Jul 11 12:45:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bigdivrem): Use a BDIGIT variable to store the return
+ value of bigdivrem_single.
- * lib/timeout.rb (Timeout#timeout): remove regexp with wrong line
- number and fix caller depth.
+Sun Jun 16 08:43:59 2013 Tanaka Akira <akr@fsij.org>
-Fri Jul 10 22:05:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (bary_divmod): New function.
+ (absint_numwords_generic): Use bary_divmod.
+ (bigdivrem_num_extra_words): Extracted from bigdivrem.
+ (bigdivrem_single): Ditto.
+ (bigdivrem_normal): Ditto.
+ (BIGDIVREM_EXTRA_WORDS): Defined.
- * lib/timeout.rb (ExitException): removed internal exception class
- and use Timeout::Error instead, as using throw/catch to isolate
- each timeouts now. [ruby-dev:49179] [Bug #11344]
+Sun Jun 16 05:51:51 2013 Masaya Tarui <tarui@ruby-lang.org>
-Fri Jul 10 17:41:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: Fixup around GC by MALLOC.
+ Add allocate size to malloc_increase before GC
+ for updating limit in after_gc_sweep.
+ Reset malloc_increase into garbage_collect()
+ for preventing GC again soon.
- * dir.c (is_case_sensitive): get attributes by the file descriptor
- of open directory, instead of using mount point name.
+Sun Jun 16 05:15:36 2013 Masaya Tarui <tarui@ruby-lang.org>
-Fri Jul 10 10:46:02 2015 ksss <co000ri@gmail.com>
+ * gc.c: Add some columns to more detail profile.
+ new columns: Allocated size, Prepare Time, Removing Objects, Empty Objects
- * ext/stringio/stringio.c (writable): remove unnecessary check for
- deprecated safe level 4. [Fix GH-963]
+Sun Jun 16 02:04:40 2013 Masaya Tarui <tarui@ruby-lang.org>
-Thu Jul 9 15:07:12 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (gc_prof_timer_stop): Merge function codes of GC_PROFILE_MORE_DETAIL and !GC_PROFILE_MORE_DETAIL.
+ * gc.c (gc_prof_mark_timer_start): Ditto.
+ * gc.c (gc_prof_mark_timer_stop): Ditto.
+ * gc.c (gc_prof_sweep_slot_timer_start): Ditto.
+ * gc.c (gc_prof_sweep_slot_timer_stop): Ditto.
+ * gc.c (gc_prof_set_malloc_info): Ditto.
+ * gc.c (gc_prof_set_heap_info): Ditto.
- * win32/win32.c (waitpid): return immediately if interrupted.
- reported by <takkanm AT gmail.com> [ruby-dev:49176] [Bug #11340]
+Sat Jun 15 23:50:24 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 9 13:03:46 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (bary_sub): New function.
+ (absint_numwords_generic): Use bary_sub.
+ (bigsub_core): Skip unnecessary copy.
- * vm_insnhelper.c (vm_search_super_method): use CI_SET_FASTPATH().
+Sat Jun 15 22:05:30 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 9 11:07:06 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (bary_mul): New function.
+ (absint_numwords_generic): Use bary_mul.
+ (bary_mul_single): Extracted from bigmul1_single.
+ (bary_mul_normal): Extracted from bigmul1_normal.
- * vm_core.h: remove rb_call_info_t::klass because
- rb_callable_method_entry_t has information about defined class.
+Sat Jun 15 20:13:46 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_search_method): don't set ci->klass because
- it is removed.
+ * bignum.c (bary_unpack): Extracted from rb_integer_unpack_internal.
+ (absint_numwords_generic): Use bary_unpack.
+ (roomof): Defined.
+ (bdigit_roomof): Defined.
+ (BARY_ARGS): Defined.
+ (bary_unpack): Declared.
- * vm_insnhelper.c (rb_equal_opt): ditto.
+Sat Jun 15 19:35:04 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_search_superclass): removed because it is too
- simple to write code directly.
+ * bignum.c (absint_numwords_bytes): Make it static.
+ (absint_numwords_small): Ditto.
+ (absint_numwords_generic): Ditto.
- * vm_insnhelper.c (vm_defined): don't use vm_search_superclass().
- This fix avoid searching current callable `me' twice.
+Sat Jun 15 17:14:32 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_search_super_method): ditto.
+ * bignum.c (bigmul1_normal): Shrink the result Bignum length.
-Thu Jul 9 10:03:10 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Jun 15 10:19:42 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/net/http/responses.rb: Added 308 status to CODE_TO_OBJ list.
- [fix GH-961] Patch by @billinghamj
+ * ext/bigdecimal/bigdecimal.c: Update overview formatting of headers
-Thu Jul 9 09:34:14 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 15 10:19:06 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_core.h (rb_control_frame_t): fix comments (layout index).
+ * ext/bigdecimal/bigdecimal.gemspec: Update authors
-Thu Jul 9 09:25:50 2015 Zachary Scott <e@zzak.io>
+Sat Jun 15 10:02:26 2013 Tanaka Akira <akr@fsij.org>
- * parse.y: Improve duplicate key warning with patch by @andremedeiros
- [Fix GH-938] https://github.com/ruby/ruby/pull/938 [Bug #11327]
+ * bignum.c (bdigs_small_rshift): Extracted from big_rshift.
+ (bigdivrem): Use bdigs_small_rshift.
-Wed Jul 8 07:43:01 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Jun 15 08:37:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/csv.rb: typo fix [ci skip][fix GH-958] Patch by @henrik
+ * vm_eval.c (eval_string_with_cref): propagate absolute path from the
+ binding if it is given explicitly. patch by Gat (Dawid Janczak) at
+ [ruby-core:55123]. [Bug #8436]
-Wed Jul 8 04:42:27 2015 Eric Wong <e@80x24.org>
+Sat Jun 15 02:40:18 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c (iseq_data_to_ary): dump kw_arg as symbol
- * test/-ext-/iseq_load/test_iseq_load.rb: test kw_arg roundtrip
- [ruby-core:69891] [Bug #11338]
+ * bignum.c (bdigs_small_lshift): Extracted from big_lshift.
+ (bigdivrem): Use bdigs_small_lshift.
-Tue Jul 7 18:18:41 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Fri Jun 14 20:47:41 2013 Tanaka Akira <akr@fsij.org>
- * random.c (fill_random_bytes_syscall): fix compile error.
+ * bignum.c (bigdivrem): Reduce number of digits before bignew() for div.
-Tue Jul 7 16:47:30 2015 Eric Wong <e@80x24.org>
+Fri Jun 14 20:12:37 2013 Tanaka Akira <akr@fsij.org>
- * compile.c (COMPILE_ERROR): reduce GET_THREAD() calls
+ * bignum.c (bigdivrem): Use bignew when ny == 1.
-Tue Jul 7 16:39:04 2015 Eric Wong <e@80x24.org>
+Fri Jun 14 18:52:51 2013 Koichi Sasada <ko1@atdot.net>
- * random.c (fill_random_bytes_syscall): return -1 for error
- * random.c (fill_random_bytes): try urandom on syscall failure
+ * compile.c (rb_iseq_compile_node): fix location of a `trace'
+ instruction (b_return event).
+ [ruby-core:55305] [ruby-trunk - Bug #8489]
+ (need a backport to 2.0.0?)
-Tue Jul 7 15:02:18 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_settracefunc.rb: add a test.
- * file.c (rb_str_normalize_ospath): skip invalid byte sequence not
- to loop infinitely. this case usually does not happen as the
- input name should come from real file systems.
+Fri Jun 14 18:18:07 2013 Koichi Sasada <ko1@atdot.net>
-Tue Jul 7 14:40:08 2015 Koichi Sasada <ko1@atdot.net>
+ * class.c, include/ruby/ruby.h: add write barriers for T_CLASS,
+ T_MODULE, T_ICLASS.
- * vm_backtrace.c: remove debug flag introduced accidentally.
+ * constant.h: constify rb_const_entry_t::value and file to detect
+ assignment.
-Tue Jul 7 12:05:37 2015 Koichi Sasada <ko1@atdot.net>
+ * variable.c, internal.h (rb_st_insert_id_and_value, rb_st_copy):
+ added. update table with write barrier.
- * cont.c (cont_free): remove mysterious fflush()
- introduced at r19890, maybe accidentally.
+ * method.h: constify some variables to detect assignment.
-Tue Jul 7 11:45:14 2015 Koichi Sasada <ko1@atdot.net>
+ * object.c (init_copy): add WBs.
- * proc.c (rb_method_call): because data->me should be non-NULL,
- do not check data->me
+ * variable.c: ditto.
- * proc.c (method_inspect): ditto.
+ * vm_method.c (rb_add_method): ditto.
-Tue Jul 7 11:37:25 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jun 14 14:33:47 2013 Shugo Maeda <shugo@ruby-lang.org>
- * vm_core.h: remove rb_iseq_t::orig because rb_iseq_clone()
- no longer exists.
+ * NEWS: add a note for Module#using.
- * iseq.c: don't use rb_iseq_t::orig.
+Fri Jun 14 13:40:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 07 11:25:57 2015 Koichi Sasada <ko1@atdot.net>
+ * .travis.yml (before_script): update config files.
- * iseq.c, internal.h (rb_iseq_clone): removed because we don't need to
- clone iseq any more.
+ * common.mk ($(srcdir)/tool/config.{guess,sub}): use get-config_files.
- * class.c (clone_method): share iseq between cloned methods. All of
- method dependent information are able to refer from method entry.
+ * tool/config_files.rb: split get-config_files.
-Tue Jul 7 04:42:25 2015 Eric Wong <e@80x24.org>
+ * common.mk (update-config_files): rule to download config files.
- * string.c (Init_String): use rb_str_freeze for String#freeze
- to resize internal buffer
- [ruby-core:69870] [Feature #11330]
+ * tool/config.guess, tool/config.sub: remove and download from the
+ upstream.
-Tue Jul 7 04:12:32 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/config_files.rb: download config files from GNU.
- * vm.c (vm_define_method): remove an unused local variable.
+Fri Jun 14 12:21:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 7 03:57:28 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): suppress warnings
+ "left-hand operand of comma expression has no effect", on gcc 4.4.
- * vm_core.h: remove rb_iseq_t::defined_method_id because it is not
- needed.
+Fri Jun 14 09:48:48 2013 Shugo Maeda <shugo@ruby-lang.org>
- * eval.c (frame_func_id): simplify. rb_callable_method_entry_t
- has enough information.
+ * NEWS: add notes for $SAFE.
- * eval.c (frame_called_id): ditto.
+ * doc/security.rdoc: remove the description of $SAFE=4.
- * iseq.c (prepare_iseq_build): catch up this fix.
+Fri Jun 14 00:14:29 2013 Tanaka Akira <akr@fsij.org>
- * proc.c (rb_mod_define_method): ditto.
+ * bignum.c (bigdivrem): Zero test condition simplified.
- * vm.c (vm_define_method): ditto.
+Thu Jun 13 23:43:11 2013 Zachary Scott <zachary@zacharyscott.net>
-Tue Jul 7 03:47:26 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
- * vm_core.h: remove a useless declaration.
+Thu Jun 13 23:02:14 2013 Kouhei Sutou <kou@cozmixng.org>
-Tue Jul 7 03:33:20 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
+ Net::HTTP. [ruby-core:55197] [Feature #8461]
+ Reported by Herwin Weststrate. Thanks!!!
- * vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.
+Thu Jun 13 22:44:52 2013 Kouhei Sutou <kou@cozmixng.org>
- * internal.h, iseq.c (rb_iseq_klass): remove it because
- rb_iseq_t::klass is removed.
+ * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Support
+ multiple names in a response. [ruby-core:41711] [Bug #5774]
+ Reported by Roman Riha. Thanks!!!
+ * test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_override):
+ Add a test of the above case.
- * vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but
- check callable method entry on a frame.
- This fix simplify the logic to search super class.
+Thu Jun 13 22:35:50 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/ruby/test_method.rb: support super() from Proc.
- Now, [Bug #4881] and [Bug #3136] was solved.
+ * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Use
+ guard style.
- * proc.c (rb_mod_define_method): catch up this change.
+Thu Jun 13 22:12:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (vm_define_method): ditto.
+ * lib/fileutils.rb (FileUtils#rmdir): fix traversal loop, not trying
+ remove same directory only.
- * vm_backtrace.c (rb_profile_frames): now, each `frame' objects
- are rb_callable_method_entry_t data or iseq VALUEs.
+Thu Jun 13 21:30:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- This fix introduce minor compatibility issue that
- rb_profile_frame_label() always returns
- rb_profile_frame_base_label().
+ * configure.in (opt-dir), tool/ifchange: get rid of "alternate value"
+ expansion for legacy sh. [ruby-dev:47420] [Bug #8524]
- * test/-ext-/debug/test_profile_frames.rb: catch up this change.
+Thu Jun 13 21:24:09 2013 Tanaka Akira <akr@fsij.org>
-Tue Jul 7 01:52:14 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (bigdivrem): Refactored to use ALLOCV_N for temporary
+ buffers.
- * cont.c (fiber_init): initialize control frame correctly.
- This fix does not affect any ordinal execution, but
- affects debug prints.
+Thu Jun 13 18:54:11 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Mon Jul 6 17:59:05 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (integer_unpack_num_bdigits_generic): reorder terms (but not
+ changed the intention of the expression) because VC++ reports a
+ warning for it. reported by ko1 via IRC.
- * vm_insnhelper.c (vm_search_super_method): do not skip calling
- same methods in super.
- [Bug #3351]
+Thu Jun 13 18:53:14 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_super.rb: fix a test.
+ * test/ruby/test_thread.rb (test_thread_local_security): Don't create
+ an unused thread.
-Mon Jul 6 17:59:11 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Jun 13 18:34:20 2013 Tanaka Akira <akr@fsij.org>
- * ext/tk/tcltklib.c: removed deprecated safe level.
+ * bignum.c (bigdivrem): Use nlz.
-Mon Jul 6 17:16:37 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jun 13 14:51:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * method.h, proc.c (rb_method_entry_location): make it static
- and remove prefix `rb_' because it is used only in proc.c.
+ * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): check constant safe
+ level at compile time.
-Mon Jul 6 16:42:10 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Jun 13 14:39:08 2013 Shugo Maeda <shugo@ruby-lang.org>
- * test/lib/memory_status.rb: removed redundant path.
+ * test/-ext-/test_printf.rb, test/rss/test_parser.rb,
+ test/ruby/test_array.rb, test/ruby/test_hash.rb,
+ test/ruby/test_m17n.rb, test/ruby/test_marshal.rb,
+ test/ruby/test_object.rb, test/ruby/test_string.rb: don't use
+ untrusted?, untrust, and trust to avoid warnings in case $VERBOSE is
+ true.
-Mon Jul 6 01:18:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 13 10:47:16 2013 Shugo Maeda <shugo@ruby-lang.org>
- * test/lib/test/unit/parallel.rb: make @@project_dir one level
- upper as this file had moved one level deeper.
+ * bootstraptest/test_autoload.rb, bootstraptest/test_method.rb:
+ remove tests for $SAFE=4.
-Sun Jul 5 23:54:10 2015 mizokami <suzunatsu@yahoo.com>
+ * lib/pp.rb: use taint instead of untrust to avoid warnings when
+ $VERBOSE is set to true.
- * lib/optparse.rb: [DOC] Fix typo.
+Thu Jun 13 06:12:18 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 5 18:25:37 2015 Eric Wong <e@80x24.org>
+ * bignum.c (integer_unpack_num_bdigits_small): Fix a compile error on
+ clang -Werror,-Wshorten-64-to-32
+ Reported by Eric Hodel. [ruby-core:55467] [Bug #8522]
- * gc.c (gc_profile_record_get): fix spelling error in keys
+Thu Jun 13 05:32:13 2013 Eric Hodel <drbrain@segment7.net>
-Sun Jul 5 14:49:01 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * ext/socket/extconf.rb: Enable RFC 3542 IPV6 socket options for OS X
+ 10.7+. [ruby-trunk - Bug #8517]
- * README.md: fix a typo pointed out by raoulvdberge.
- https://github.com/ruby/ruby/pull/953#commitcomment-11998186
+Thu Jun 13 00:17:18 2013 Tanaka Akira <akr@fsij.org>
-Sun Jul 5 12:56:20 2015 Irvi Firqotul Aini <viarc7@gmail.com>
+ * bignum.c (rb_integer_unpack_2comp): New function.
+ (rb_integer_unpack_internal): Extracted from rb_integer_unpack and
+ nlp_bits_ret argument added.
+ (integer_unpack_num_bdigits_small): nlp_bits_ret argument added to
+ return number of leading padding bits.
+ (integer_unpack_num_bdigits_generic): Ditto.
- * README.md: Added link HowToReport bugs.
+ * internal.h (rb_integer_unpack_2comp): Declared.
-Sun Jul 5 10:51:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c (pack_unpack): Use rb_integer_unpack_2comp and
+ rb_integer_unpack.
- * array.c (rb_ary_sort_bang): the original array may not be
- embedded even if a substitution array is embedded, as it is
- embedded when the original array is short enough but not
- embedded. [ruby-dev:49166] [Bug #11332]
+Wed Jun 12 23:27:03 2013 Shugo Maeda <shugo@ruby-lang.org>
-Sun Jul 5 09:31:40 2015 Eric Wong <e@80x24.org>
+ * eval.c (mod_using): new method Module#using, which activates
+ refinements of the specified module only in the current class or
+ module definition. [ruby-core:55273] [Feature #8481]
- * test/ruby/test_process.rb: test for fd=3 usability in child
+ * test/ruby/test_refinement.rb: related test.
-Sat Jul 4 19:43:31 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Wed Jun 12 22:58:48 2013 Shugo Maeda <shugo@ruby-lang.org>
- * Add test case for empty array and first method with args.
- Patch by @yui-knk [fix GH-955]
+ * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
+ when $SAFE is set to 4. $SAFE=4 is now obsolete.
+ [ruby-core:55222] [Feature #8468]
-Sat Jul 4 19:39:08 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
+ Kernel#untrusted?, untrust, and trust are now deprecated.
+ Their behavior is same as tainted?, taint, and untaint,
+ respectively.
- * Add test for `Enumerable#sort` with block. Patch by @yui-knk
- [fix GH-954]
+ * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
+ and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
+ respectively.
-Sat Jul 4 14:38:43 2015 Eric Wong <e@80x24.org>
+ * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
+ ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
+ ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
+ ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
+ ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
+ ext/socket/socket.c, ext/socket/udpsocket.c,
+ ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
+ ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
+ load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
+ safe.c, string.c, thread.c, transcode.c, variable.c,
+ vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
+ $SAFE=4.
- * enum.c (zip_ary): remove volatile, use RB_GC_GUARD
- (zip_i): ditto
+ * test/dl/test_dl2.rb, test/erb/test_erb.rb,
+ test/readline/test_readline.rb,
+ test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
+ test/ruby/test_array.rb, test/ruby/test_dir.rb,
+ test/ruby/test_encoding.rb, test/ruby/test_env.rb,
+ test/ruby/test_eval.rb, test/ruby/test_exception.rb,
+ test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
+ test/ruby/test_io.rb, test/ruby/test_method.rb,
+ test/ruby/test_module.rb, test/ruby/test_object.rb,
+ test/ruby/test_pack.rb, test/ruby/test_rand.rb,
+ test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
+ test/ruby/test_struct.rb, test/ruby/test_thread.rb,
+ test/ruby/test_time.rb: remove tests for $SAFE=4.
-Sat Jul 4 10:42:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jun 12 22:18:23 2013 Tanaka Akira <akr@fsij.org>
- * lib/rubygems/test_case.rb (teardown): do not delete features
- loaded from the original load paths, the same libraries should
- be loaded again when the same features are required.
- [ruby-dev:49031] [Bug #11222]
+ * bignum.c (integer_unpack_num_bdigits_generic): Rewritten without
+ rb_funcall.
+ (integer_unpack_num_bdigits_bytes): Removed.
+ (rb_integer_unpack): integer_unpack_num_bdigits_bytes invocation
+ removed.
-Sat Jul 4 09:38:52 2015 Eric Wong <e@80x24.org>
+Wed Jun 12 20:18:03 2013 Kouhei Sutou <kou@cozmixng.org>
- * vm.c (rb_vm_mark): reduce branches for always-set VM fields
- (rb_vm_add_root_module): ditto
+ * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Extract.
-Fri Jul 03 20:05:10 2015 Koichi Sasada <ko1@atdot.net>
+Wed Jun 12 18:19:41 2013 Tanaka Akira <akr@fsij.org>
- * method.h: introduce rb_callable_method_entry_t to remove
- rb_control_frame_t::klass.
- [Bug #11278], [Bug #11279]
+ * bignum.c (validate_integer_pack_format): supported_flags argument
+ added and validate given flags.
+ (rb_integer_pack_internal): Specify supported_flags.
+ (rb_integer_unpack): Ditto.
- rb_method_entry_t data belong to modules/classes.
- rb_method_entry_t::owner points defined module or class.
+Wed Jun 12 16:41:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- module M
- def foo; end
- end
+ * array.c (rb_ary_sort_bang): remove duplicated assertions.
+ ARY_HEAP_PTR() implies ary not to be embedded. [ruby-dev:47419]
+ [Bug #8518]
- In this case, owner is M.
+Wed Jun 12 12:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- rb_callable_method_entry_t data belong to only classes.
- For modules, MRI creates corresponding T_ICLASS internally.
- rb_callable_method_entry_t can also belong to T_ICLASS.
+ * io.c (io_getc): fix 7bit coderange condition, check if ascii read
+ data instead of read length. [ruby-core:55444] [Bug #8516]
- rb_callable_method_entry_t::defined_class points T_CLASS or
- T_ICLASS.
- rb_method_entry_t data for classes (not for modules) are also
- rb_callable_method_entry_t data because it is completely same data.
- In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class.
+Wed Jun 12 12:35:13 2013 Tanaka Akira <akr@fsij.org>
- For example, there are classes C and D, and includes M,
+ * pack.c (pack_pack): Use rb_integer_pack_2comp.
- class C; include M; end
- class D; include M; end
+Wed Jun 12 12:07:04 2013 Tanaka Akira <akr@fsij.org>
- then, two T_ICLASS objects for C's super class and D's super class
- will be created.
+ * sprintf.c (rb_str_format): Fix a dynamic format string.
- When C.new.foo is called, then M#foo is searched and
- rb_callable_method_t data is used by VM to invoke M#foo.
+Wed Jun 12 12:04:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- rb_method_entry_t data is only one for M#foo.
- However, rb_callable_method_entry_t data are two (and can be more).
- It is proportional to the number of including (and prepending)
- classes (the number of T_ICLASS which point to the module).
+ * array.c (rb_ary_uniq_bang): must not be modified once frozen even in
+ a callback method.
- Now, created rb_callable_method_entry_t are collected when
- the original module M was modified. We can think it is a cache.
+Wed Jun 12 12:03:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- We need to select what kind of method entry data is needed.
- To operate definition, then you need to use rb_method_entry_t.
+ * array.c (rb_ary_sort_bang): must not be modified once frozen even in
+ a callback method.
- You can access them by the following functions.
+Wed Jun 12 12:00:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * rb_method_entry(VALUE klass, ID id);
- * rb_method_entry_with_refinements(VALUE klass, ID id);
- * rb_method_entry_without_refinements(VALUE klass, ID id);
- * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
+ * array.c (FL_SET_EMBED): shared object is frozen even when get
+ unshared.
- To invoke methods, then you need to use rb_callable_method_entry_t
- which you can get by the following APIs corresponding to the
- above listed functions.
+ * array.c (rb_ary_modify): ARY_SET_CAPA needs unshared array.
- * rb_callable_method_entry(VALUE klass, ID id);
- * rb_callable_method_entry_with_refinements(VALUE klass, ID id);
- * rb_callable_method_entry_without_refinements(VALUE klass, ID id);
- * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
+Wed Jun 12 07:32:01 2013 Tanaka Akira <akr@fsij.org>
- VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry()
- returns rb_callable_method_entry_t.
- You can check a super class of current method by
- rb_callable_method_entry_t::defined_class.
+ * random.c (rand_int): Use rb_big_uminus.
- * method.h: renamed from rb_method_entry_t::klass to
- rb_method_entry_t::owner.
+Wed Jun 12 07:12:54 2013 Eric Hodel <drbrain@segment7.net>
- * internal.h: add rb_classext_struct::callable_m_tbl to cache
- rb_callable_method_entry_t data.
+ * struct.c: Improve documentation: replace "instance variable" with
+ "member", recommend the use of a block to customize structs, note
+ that member accessors are created, general cleanup.
- We need to consider about this field again because it is only
- active for T_ICLASS.
+Wed Jun 12 06:35:01 2013 Tanaka Akira <akr@fsij.org>
- * class.c (method_entry_i): ditto.
+ * internal.h (INTEGER_PACK_NEGATIVE): Defined.
+ (rb_integer_unpack): sign argument removed.
- * class.c (rb_define_attr): rb_method_entry() does not takes
- defined_class_ptr.
+ * bignum.c (rb_integer_unpack): sign argument removed.
+ Non-negative integers generated by default.
+ INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers.
- * gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS.
+ * pack.c (pack_unpack): Follow the above change.
- * cont.c (fiber_init): rb_control_frame_t::klass is removed.
+ * random.c (int_pair_to_real_inclusive): Ditto.
+ (make_seed_value): Ditto.
+ (mt_state): Ditto.
+ (limited_big_rand): Ditto.
- * proc.c: fix `struct METHOD' data structure because
- rb_callable_method_t has all information.
+ * marshal.c (r_object0): Ditto.
- * vm_core.h: remove several fields.
- * rb_control_frame_t::klass.
- * rb_block_t::klass.
+Wed Jun 12 00:07:46 2013 Kouhei Sutou <kou@cozmixng.org>
- And catch up changes.
+ * test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_simple):
+ Add a test for the extracted method.
- * eval.c: catch up changes.
+Tue Jun 11 23:56:24 2013 Kouhei Sutou <kou@cozmixng.org>
- * gc.c: ditto.
+ * test/xmlrpc/test_client.rb (XMLRPC::ClientTest::Fake::HTTP#started):
+ Add a missing empty line.
- * insns.def: ditto.
+Tue Jun 11 23:37:19 2013 Tanaka Akira <akr@fsij.org>
- * vm.c: ditto.
+ * bignum.c (validate_integer_pack_format): Don't require a word order
+ flag if numwords is 1 or less.
+ (absint_numwords_generic): Don't specify a word order for
+ rb_integer_pack.
- * vm_args.c: ditto.
+ * hash.c (rb_hash): Ditto.
- * vm_backtrace.c: ditto.
+ * time.c (v2w_bignum): Ditto.
- * vm_dump.c: ditto.
+Tue Jun 11 23:01:57 2013 Tanaka Akira <akr@fsij.org>
- * vm_eval.c: ditto.
+ * bignum.c (validate_integer_pack_format): Refine error messages.
- * vm_insnhelper.c: ditto.
+Tue Jun 11 22:25:04 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c: ditto.
+ * bignum.c (validate_integer_pack_format): numwords argument added.
+ Move a varidation from rb_integer_pack_internal and rb_integer_unpack.
+ (rb_integer_pack_internal): Follow above change.
+ (rb_integer_unpack): Ditto.
-Fri Jul 3 14:30:18 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 11 20:52:43 2013 Tanaka Akira <akr@fsij.org>
- * win32/file.c: some mingw compilers need a tweek for the
- declarations of _wfreopen_s. [Bug #11320]
+ * bignum.c (rb_integer_pack_internal): Renamed from rb_integer_pack
+ and overflow_2comp argument added.
+ (rb_integer_pack): Just call rb_integer_pack_internal.
+ (rb_integer_pack_2comp): New function.
-Fri Jul 3 12:25:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (rb_integer_pack_2comp): Declared.
- * transcode.c (rb_econv_set_replacement): target encoding name can
- be empty now. [ruby-core:69841] [Bug #11324]
+ * sprintf.c (rb_str_format): Use rb_integer_pack and
+ rb_integer_pack_2comp to format binary/octal/hexadecimal integers.
+ (ruby_digitmap): Declared.
+ (remove_sign_bits): Removed.
+ (BITSPERDIG): Ditto.
+ (EXTENDSIGN): Ditto.
-Fri Jul 3 07:21:06 2015 Eric Wong <e@80x24.org>
+Tue Jun 11 16:15:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * benchmark/bm_io_nonblock_noex.rb: new benchmark
- * ext/openssl/ossl_ssl.c (no_exception_p): new function
- (ossl_start_ssl): adjust for no_exception_p
- (ossl_ssl_connect): adjust ossl_start_ssl call
- (ossl_ssl_connect_nonblock): ditto
- (ossl_ssl_accept): ditto
- (ossl_ssl_accept_nonblock): ditto
- (ossl_ssl_read_internal): adjust for no_exception_p
- (ossl_ssl_write_internal): ditto
- (ossl_ssl_write): adjust ossl_write_internal call
- (ossl_ssl_write_nonblock): ditto
- * ext/stringio/stringio.c (strio_read_nonblock):
- delay exception check
- * io.c (no_exception_p): new function
- (io_getpartial): call no_exception_p
- (io_readpartial): adjust for io_getpartial
- (get_kwargs_exception): remove
- (io_read_nonblock): adjust for io_getpartial,
- check no_exception_p on EOF
- (io_write_nonblock): call no_exception_p
- (rb_io_write_nonblock): do not check `exception: false'
- (argf_getpartial): adjust for io_getpartial
- [ruby-core:69778] [Feature #11318]
+ * array.c (ary_shrink_capa): shrink the capacity so it fits just with
+ the length.
-Fri Jul 3 07:13:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (ary_make_shared): release never used elements from frozen
+ array to be shared. [ruby-dev:47416] [Bug #8510]
- * dir.c (replace_real_basename): Win32 API does not set errno, get
- the last error by GetLastError() and map to errno. [Bug #10015]
+Tue Jun 11 12:49:01 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Jul 2 21:32:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * doc/re.rdoc: Rename to doc/regexp.rdoc
+ * re.c: Update rdoc include for rename of file
- * dir.c (replace_real_basename): show warnings at errors.
- [Bug #10015]
+Tue Jun 11 07:13:13 2013 Masaya Tarui <tarui@ruby-lang.org>
-Thu Jul 2 18:39:20 2015 Koichi Sasada <ko1@atdot.net>
+ * eval_error.c (error_print): keep that errat is non-shady object.
+ and guard errat from GC.
- * gc.c: remove `#define RGENGC_OBJ_INFO 1' line introduced to
- debug Bug #11244.
+Tue Jun 11 05:04:25 2013 Benoit Daloze <eregontp@gmail.com>
-Thu Jul 2 18:34:26 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/racc/cparse/cparse.c: use rb_ary_entry() and
+ rb_ary_subseq() instead of RARRAY_PTR.
+ Based on a patch by Dirkjan Bussink. See Bug #8399.
- * gc.c (rb_raw_obj_info): separated from rb_obj_info().
- Fill internal object information into passed buffer.
+Mon Jun 10 23:51:51 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * gc.h: declare rb_raw_obj_info().
+ * array.c (rb_ary_new_from_values): fix a typo. pointed out by
+ nagachika.
+ http://d.hatena.ne.jp/nagachika/20130610/ruby_trunk_changes_41199_41220
-Thu Jul 2 16:15:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 21:51:03 2013 Kouhei Sutou <kou@cozmixng.org>
- * dir.c (replace_real_basename): update path type by the target
- attributes if possible, to improve the performance. [Bug #10015]
+ * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Fix indent.
-Thu Jul 2 14:45:53 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jun 10 21:49:43 2013 Kouhei Sutou <kou@cozmixng.org>
- * st.c: get rid of VC++'s warnings of C4700 (uninitialized local
- variable used). I think that these are wrong, but should shut them
- up.
+ * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Add missing return
+ value assignment.
-Thu Jul 2 14:15:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 20:58:11 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/rubygems.rb (Gem.load_path_insert_index): search
- @gem_prelude_index first.
+ * ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu
+ 13.04's getaddrinfo issue with mdns4. [ruby-list:49420]
- * lib/rubygems/test_case.rb (Gem::TestCase#setup): keep already
- expanded paths to preserve instance variables.
+Mon Jun 10 19:34:39 2013 Tanaka Akira <akr@fsij.org>
-Thu Jul 2 14:12:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_integer_pack): Returns sign instead of words.
+ (absint_numwords_generic): Follow the above change.
+ (big2str_base_powerof2): Follow the above change.
- * ruby.c (process_options): also copy initial load path marks at
- setting load paths encoding.
+ * internal.h: Ditto.
-Thu Jul 2 12:26:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * hash.c (rb_hash): Ditto.
- * test/rubygems/test_gem_server.rb (process_based_port): use
- dynamically chosen port numbers to get rid of conflicts.
+ * pack.c (pack_pack): Ditto.
-Thu Jul 2 11:58:59 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * random.c (int_pair_to_real_inclusive): Ditto.
+ (rand_init): Ditto.
+ (random_load): Ditto.
+ (limited_big_rand): Ditto.
- * test/rubygems/test_gem_specification.rb: skip tests which the
- platform does not permit the filename of its test file.
+ * time.c (v2w_bignum): Ditto.
-Thu Jul 2 11:36:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 17:20:01 2013 Koichi Sasada <ko1@atdot.net>
- * test/rubygems/test_gem_resolver_git_specification.rb: require
- rubygems/installer.rb before Gem::TestCase#setup runs, otherwise
- as Gem::TestCase#teardown restores $LOADED_FEATURES to the state
- at that time, the requiring the file in GitSpecification#install
- method causes a lot of constant redefinitions.
+ * gc.c (rgengc_remember): permit promoted object.
+ (rb_gc_writebarrier -> remember)
-Thu Jul 2 10:43:36 2015 Eric Wong <e@80x24.org>
+Mon Jun 10 17:14:01 2013 Koichi Sasada <ko1@atdot.net>
- * ext/socket/rubysocket.h: flags for common socket families
- (rsock_getfamily): update signature
- * include/ruby/io.h: comment socket FMODE flags
- * ext/socket/init.c (rsock_getfamily): memoize family
- * ext/socket/basicsocket.c: adjust rsock_getfamily calls
- * ext/socket/ancdata.c: ditto
- [ruby-core:69713] [Feature #11298]
+ * gc.c (RVALUE_PROMOTE): fix parameter name (`x' to `obj')
+ and make it inline function (like RVALUE_PROMOTE).
-Thu Jul 2 10:30:01 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Jun 10 16:22:50 2013 Koichi Sasada <ko1@atdot.net>
- * lib/rubygems/resolver.rb: fixed NameError of Gem::Util::NULL_DEVICE.
+ * array.c (rb_ary_new_from_values): add assertion
+ (ary should be young object).
-Thu Jul 2 09:51:44 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Jun 10 16:05:59 2013 Koichi Sasada <ko1@atdot.net>
- * lib/rubygems/resolver.rb: fix error of null device reference with DOSISH
- platform.
+ * gc.c (wmap_mark): check allocation of `w->obj2wmap'.
+ (no-allocation `w->obj2wmap' will be NULL pointer reference)
-Thu Jul 2 06:49:44 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Jun 10 15:36:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems: Update to RubyGems HEAD(c202db2).
- this version contains many enhancements see http://git.io/vtNwF
- * test/rubygems: ditto.
+ * eval_error.c (error_print): use checking functions instead of
+ catching exceptions.
-Wed Jul 1 23:50:34 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * eval_error.c (error_print): restore errinfo for the case new
+ exception raised while printing the message. [ruby-core:55365]
+ [Bug #8501]
- * test/net/http/test_httpresponse.rb
- (HTTPResponseTest#test_read_body_content_encoding_deflate_uppercase):
- fix a failure without zlib.
+ * eval_error.c (error_print): reduce calling setjmp.
-Wed Jul 1 10:54:56 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Jun 10 12:10:06 2013 Tanaka Akira <akr@fsij.org>
- * Add test for Enumerable#none? [fix GH-950] Patch by @yui-knk
+ * bignum.c (integer_unpack_num_bdigits_small: Extracted from
+ rb_integer_unpack.
+ (integer_unpack_num_bdigits_generic): Ditto.
+ (integer_unpack_num_bdigits_bytes): New function.
+ (rb_integer_unpack): Use above functions.
+ Return a Bignum for INTEGER_PACK_FORCE_BIGNUM even when the result
+ is zero.
-Wed Jul 1 09:30:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 05:38:23 2013 Tanaka Akira <akr@fsij.org>
- * struct.c (struct_set_members): hide internal back_members
- object, and members object does not need to be duped as it
- should be frozen and hidden.
+ * bignum.c (absint_numwords_small): New function.
+ (absint_numwords_generic): Use absint_numwords_small if possible.
-Wed Jul 1 09:28:47 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 10 01:07:57 2013 Tanaka Akira <akr@fsij.org>
- * struct.c (struct_member_pos): revert r51080 to fix other
- implicit conversions but cast the return value to fix the
- previous implicit conversion.
+ * bignum.c (absint_numwords_bytes): New function.
+ (absint_numwords_generic): Extracted from rb_absint_numwords.
+ (rb_absint_numwords): Use absint_numwords_bytes if possible.
-Wed Jul 1 08:47:24 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Jun 9 21:33:15 2013 Tanaka Akira <akr@fsij.org>
- * struct.c (struct_member_pos): avoid implicit conversion loses
- integer precision: 'long' to 'int'.
+ * bignum.c (rb_absint_numwords): Return (size_t)-1 when overflow.
+ Refine variable names.
+ (rb_absint_size): Refine variable names.
-Wed Jul 1 05:57:03 2015 Eric Wong <e@80x24.org>
+ * internal.h (rb_absint_size): Refine an argument name.
+ (rb_absint_numwords): Ditto.
- * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD
- * class.c (clone_method): remove RB_GC_GUARD
- * struct.c (define_aref_method): ditto
- (define_aset_method): ditto
- * vm.c (vm_define_method):
- * iseq.c (rb_iseq_clone): add RB_GC_GUARD
+Sun Jun 9 16:51:41 2013 Tanaka Akira <akr@fsij.org>
-Wed Jul 1 05:43:58 2015 Eric Wong <e@80x24.org>
+ * bignum.c (rb_absint_numwords): Renamed from rb_absint_size_in_word.
- * struct.c (AREF_HASH_THRESHOLD): new macro
- (id_back_members): new ID
- (struct_member_pos_ideal): new function
- (struct_member_pos_probe): ditto
- (struct_set_members): ditto
- (struct_member_pos): ditto
- (rb_struct_getmember): use struct_member_pos for O(1) access
- (rb_struct_aref_sym): ditto
- (rb_struct_aset_sym): ditto
- (setup_struct): call struct_set_members
- (struct_define_without_accessor): ditto
- (Init_Struct): initialize __members_back__
- [ruby-core:66851] [ruby-core:69705] [ruby-core:69821]
+ * internal.h (rb_absint_numwords): Follow the above change.
-Tue Jun 30 23:12:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c (pack_pack): Ditto.
- * io.c (rb_io_reopen): FilePathValue() ensures the path
- NUL-terminated and frozen, so it is unnecessary to make it shared.
+ * random.c (rand_init): Ditto.
+ (limited_big_rand): Ditto.
-Tue Jun 30 23:11:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jun 9 14:41:05 2013 Tanaka Akira <akr@fsij.org>
- * dir.c (check_dirname): ensure path name NUL-terminated for
- SHARABLE_MIDDLE_SUBSTRING.
+ * bignum.c (rb_integer_pack): numwords_allocated argument removed.
- * io.c (rb_sysopen): ditto.
+ * internal.h (rb_integer_pack): Follow the above change.
-Tue Jun 30 18:38:16 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * hash.c (rb_hash): Ditto.
- * win32/file.c (rb_freopen): need to terminate by NUL.
+ * time.c (v2w_bignum): Ditto.
-Tue Jun 30 17:28:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c (pack_pack): Ditto.
- * io.c (rb_io_reopen): freopen(3) with OS encoding path.
- [ruby-core:69780] [Bug #11320]
+ * random.c (int_pair_to_real_inclusive): Ditto.
+ (rand_init): Ditto.
+ (random_load): Ditto.
+ (limited_big_rand): Ditto.
- * win32/file.c (rb_freopen): wrapper of wchar version freopen(3).
- use _wfreopen_s() if available.
+Sun Jun 9 09:34:44 2013 Tanaka Akira <akr@fsij.org>
-Tue Jun 30 08:24:08 2015 Eric Wong <e@80x24.org>
+ * bignum.c (big2str_base_powerof2): New function.
+ (rb_big2str0): Use big2str_base_powerof2 if base is 2, 4, 8, 16 or 32.
- * io.c (rb_io_oflags_modestr): handle O_TRUNC correctly
- * test/ruby/test_io.rb (test_reopen_stdio): new test
- Patch-by: cremno phobia <cremno@mail.ru>
- [ruby-core:69779] [Bug #11319]
+Sun Jun 9 00:59:04 2013 Tanaka Akira <akr@fsij.org>
-Tue Jun 30 02:47:02 2015 Eric Wong <e@80x24.org>
+ * hash.c (rb_hash): Use rb_integer_pack to obtain least significant
+ long integer.
- * include/ruby/st.h (struct st_table): hide struct list_head
- * st.c (struct st_table_entry): adjust struct
- (head, tail): remove shortcut macros
- (st_head): new wrapper function
- (st_init_table_with_size): adjust to new struct and API
- (st_clear): ditto
- (add_direct): ditto
- (unpack_entries): ditto
- (rehash): ditto
- (st_copy): ditto
- (remove_entry): ditto
- (st_shift): ditto
- (st_foreach_check): ditto
- (st_foreach): ditto
- (get_keys): ditto
- (get_values): ditto
- (st_values_check): ditto
- (st_reverse_foreach_check): ditto (unused)
- (st_reverse_foreach): ditto (unused)
- [ruby-core:69726] [Misc #10278]
+Sat Jun 8 23:56:00 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 29 17:38:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c (rb_num_to_uint): Use rb_absint_size instead of
+ RBIGNUM_LEN.
- * insns.def (defineclass): do not quote unprintable characters at
- raising an exception.
+Sat Jun 8 22:53:45 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 29 16:01:24 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * marshal.c (r_object0): Use rb_integer_unpack.
- * lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper
- case. [ruby-core:69670] [Bug #11285] patched by Andy Chu
+Sat Jun 8 22:18:57 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 29 14:50:08 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * time.c (v2w): Use rb_absint_size instead of RBIGNUM_LEN.
- * eval.c (add_activated_refinement): should not include the original
- class.
+Sat Jun 8 21:47:33 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 29 12:09:10 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * time.c (v2w_bignum): Simplified using rb_integer_pack.
+ (rb_big_abs_find_maxbit): Removed.
- * README.md: tweak styles. [fix GH-945][ci skip] Patch by @bryndyment
+Sat Jun 8 21:03:40 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 29 07:23:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_absint_singlebit_p): New function.
- * template/sizes.c.tmpl: extract RUBY_DEFINT to define sizes of
- types checked by configure.in, and fix size of intptr_t in
- universal binary.
+ * internal.h (rb_absint_singlebit_p): Declared.
-Mon Jun 29 02:10:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * time.c (v2w_bignum): Use rb_absint_singlebit_p instead of
+ rb_big_abs_find_minbit.
+ (rb_big_abs_find_minbit): Removed.
- * insns.def (defineclass): preserve encoding of name in error
- messages for super class mismatch.
+Sat Jun 8 20:24:23 2013 Tanaka Akira <akr@fsij.org>
- * insns.def (defineclass): preserve encoding of name in error
- messages for non-class super.
+ * time.c (rb_big_abs_find_maxbit): Use rb_absint_size.
+ (bdigit_find_maxbit): Removed.
- * insns.def (defineclass): preserve encoding of name in error
- messages when already defined but type mismatch.
+Sat Jun 8 19:47:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Sun Jun 28 12:07:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * class.c (include_modules_at): invalidate method cache if included
+ module contains constants
- * class.c (rb_define_class_id_under): raise TypeError exception
- same as ruby level class definition when superclass mismatch.
+ * test/ruby/test_module.rb: add test
-Sun Jun 14 19:02:03 2015 Benoit Daloze <eregontp@gmail.com>
+Sat Jun 8 19:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * lib/net/ftp.rb (makeport): close the TCPServer
- when sending the port fails.
+ * random.c (limited_big_rand): declare rnd, lim and mask as uint32_t
+ to avoid 64 bit to 32 bit shorten warnings.
- * test/net/ftp/test_ftp.rb: test for above.
+Sat Jun 8 19:23:53 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Jun 26 12:48:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/Makefile.sub: r41163 changed win32/win32.c and configure.in
+ but it didn't treat about mswin32/mswin64, so fix it.
+ NOTE: this needs a review by usa whether additional condition is
+ required or not.
- * transcode.c (load_transcoder_entry): fix transcoder loading race
- condition, by waiting in require. [ruby-dev:49106] [Bug #11277]
+Sat Jun 8 19:06:26 2013 Tanaka Akira <akr@fsij.org>
-Fri Jun 26 07:53:56 2015 Eric Wong <e@80x24.org>
+ * random.c: Unused RBignum internal accessing macros removed.
- * enum.c (enum_minmax): simplify return value creation
- * test/ruby/test_enum.rb: test behavior on empty
- * hash.c (rb_hash_fetch_m): remove unnecessary volatile since r41597
- (env_reject_bang): trade volatile for GC guard
- (env_select): ditto
- (env_select_bang): ditto
- (env_keep_if): ditto
- (rb_env_clear): ditto
+Sat Jun 8 19:04:15 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 25 21:24:28 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * random.c (limited_big_rand): The argument, limit, is changed to
+ VALUE. Use rb_integer_pack and rb_integer_unpack.
- * test/-ext-/popen_deadlock/test_popen_deadlock.rb: test [Bug #11265]
+Sat Jun 8 17:15:18 2013 Tanaka Akira <akr@fsij.org>
- * ext/-test-/popen_deadlock/infinite_loop_dlsym.c: new ext to call
- dlsym(3) infinitely without GVL, used in the above test.
+ * random.c (make_seed_value): Fix the length given for
+ rb_integer_unpack.
- * ext/-test-/popen_deadlock/extconf.rb: extconf.rb for the above
- ext. Currently, only enabled on Solaris (main target) and Linux
- (as a reference platform and for debugging the ext).
+Sat Jun 8 16:38:02 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 25 19:24:25 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * bignum.c (rb_integer_unpack): Don't use rb_funcall if possible.
- * configure.in: not to use vfork on Solaris to avoid deadlock
- occurred in vfork(2) with multi-threading and dynamic linker
- on Solaris. [Bug #11265] [ruby-dev:49089]
+ * random.c: Use uint32_t for elements of seed.
+ (make_seed_value): Use rb_integer_unpack.
-Thu Jun 25 18:25:41 2015 Naohisa Goto <ngotogenome@gmail.com>
+Sat Jun 8 15:58:18 2013 Tanaka Akira <akr@fsij.org>
- * test/lib/envutil.rb (Test::Unit::Assertions#assert_no_memory_leak):
- NO_MEMORY_LEAK_ENVS is moved to Memory::NO_MEMORY_LEAK_ENVS
- to reduce child executions during test-all on Solaris.
+ * random.c (rand_init): Add a cast to fix clang compile error:
+ random.c:410:32: error: implicit conversion loses integer precision:
+ 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
+ This cast doesn't cause a problem because len is not bigger than
+ MT_MAX_STATE.
- * test/lib/memory_status.rb (Memory::NO_MEMORY_LEAK_ENVS): ditto.
+Sat Jun 8 15:30:03 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 25 17:32:33 2015 Koichi Sasada <ko1@atdot.net>
+ * random.c (rand_init): Use rb_integer_pack.
+ (roomof): Removed.
- * vm_method.c (rb_method_entry_create): need to call
- method_definition_reset() if def is given.
+Sat Jun 8 14:58:32 2013 Tanaka Akira <akr@fsij.org>
- Actually, `me' is a new object, so we don't need to call it.
- It is just to make sure.
+ * internal.h (INTEGER_PACK_FORCE_BIGNUM): New flag constant.
- * vm_method.c (method_definition_reset): remove duplicated insertion.
+ * bignum.c (rb_integer_unpack): Support INTEGER_PACK_FORCE_BIGNUM.
- * vm_method.c (rb_method_entry_clone): assign dst->def here,
- not in method_definition_reset().
+ * random.c (int_pair_to_real_inclusive): Use
+ INTEGER_PACK_FORCE_BIGNUM to use rb_big_mul instead of rb_funcall.
-Thu Jun 25 16:44:54 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 8 14:17:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c: make a rb_method_definition_t data (def) *after* making
- a rb_method_entry_t data (me).
+ * configure.in: check for NET_LUID. header macro varies across
+ compiler versions.
- Normally, `me' points `def'. Some Ruby objects pointed from `def'
- and objects are marked by `me' (mark_method_entry() in gc.c).
- However, `def' is built before making a `me', then nobody can mark
- objects pointed from `def' before making (and pointing from) `me'.
+ * win32/win32.c: use configured macro.
- I hope this patch solve #11244.
+Sat Jun 8 11:59:55 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c: remove `rb_' prefix from some static functions.
+ * random.c (int_pair_to_real_inclusive): Use rb_funcall instead of
+ rb_big_mul because rb_integer_unpack can return a Fixnum.
- * method.h (rb_method_entry_create): constify
+Sat Jun 8 11:17:39 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (mark_method_entry): add checking `def' and
- `def->body.iseq.iseqptr' availability because they can be NULL.
+ * random.c (int_pair_to_real_inclusive): Use rb_integer_pack.
-Thu Jun 25 14:14:16 2015 takiy33 <takiy33@gmail.com>
+Sat Jun 8 09:49:42 2013 Tanaka Akira <akr@fsij.org>
- * test/test_prime.rb (test_eratosthenes_works_fine_after_timeout):
- use spaces instead of TABs in ruby codes. [Fix GH-944]
+ * random.c (int_pair_to_real_inclusive): Use rb_integer_unpack.
-Thu Jun 25 07:08:35 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 8 08:12:22 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (obj_info, method_type_name): show method type name in a string
- instead of a number.
+ * random.c (random_load): Use rb_integer_pack.
-Thu Jun 25 06:49:25 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 8 06:15:46 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (obj_info): show more details for T_IMEMO/imemo_ment.
+ * random.c (numberof): Removed.
-Thu Jun 25 06:40:46 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 8 06:00:47 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c (rb_method_definition_reset): need a WB for
- VM_METHOD_TYPE_ATTRSET.
+ * random.c: include internal.h.
+ (mt_state): Use rb_integer_unpack.
-Thu Jun 25 03:33:21 2015 Koichi Sasada <ko1@atdot.net>
+Sat Jun 8 00:55:51 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (RGENGC_OBJ_INFO, obj_info): add a macro to enable/disable
- rich obj_info() output.
+ * bignum.c (integer_pack_loop_setup): word_num_nailbytes_ret argument
+ removed.
+ (rb_integer_pack): Follow the above change.
+ (rb_integer_unpack): Follow the above change.
- At the default, the value of RGENGC_OBJ_INFO is
- (RGENGC_DEBUG | RGENGC_CHECK_MODE).
+Sat Jun 8 00:37:32 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (RGENGC_OBJ_INFO): force enable it to debug #11244.
+ * bignum.c (validate_integer_pack_format): Renamed from
+ validate_integer_format.
+ (integer_pack_loop_setup): Renamed from integer_format_loop_setup.
+ (integer_pack_fill_dd): Renamed from int_export_fill_dd.
+ (integer_pack_take_lowbits): Renamed from int_export_take_lowbits.
+ (integer_unpack_push_bits): Renamed from int_import_push_bits.
- * gc.c (gc_mark_ptr): print more details with obj_info().
+Fri Jun 7 23:58:06 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (gc_mark_children): remove useless debug prints.
+ * bignum.c (rb_integer_pack): Arguments changed. Use flags to
+ specify word order and byte order.
+ (rb_integer_unpack): Ditto.
+ (validate_integer_format): Follow the above change.
+ (integer_format_loop_setup): Ditto.
-Thu Jun 25 02:40:33 2015 Eric Wong <e@80x24.org>
+ * pack.c: Ditto.
- * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal):
- do not process kwargs in blocking mode
- * test/openssl/test_ssl.rb: test sysread
+ * internal.h: Ditto.
+ (INTEGER_PACK_MSWORD_FIRST): Defined.
+ (INTEGER_PACK_LSWORD_FIRST): Ditto.
+ (INTEGER_PACK_MSBYTE_FIRST): Ditto.
+ (INTEGER_PACK_LSBYTE_FIRST): Ditto.
+ (INTEGER_PACK_NATIVE_BYTE_ORDER): Ditto.
+ (INTEGER_PACK_LITTLE_ENDIAN): Ditto.
+ (INTEGER_PACK_BIG_ENDIAN): Ditto.
-Wed Jun 24 16:54:11 2015 Koichi Sasada <ko1@atdot.net>
+Fri Jun 7 22:10:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * gc.c (gc_mark_children): add additional debug code for #11244.
+ * lib/rubygems/specification.rb (Gem::Specification#to_yaml):
+ use Gem::NoAliasYAMLTree.create instead of Gem::NoAliasYAMLTree.new
+ to suppress deprecated warnings.
-Wed Jun 24 16:05:42 2015 Eric Wong <e@80x24.org>
+Fri Jun 7 21:39:39 2013 Tanaka Akira <akr@fsij.org>
- * string.c (rb_str_justify): use RB_GC_GUARD
+ * bignum.c (rb_integer_pack): Renamed from rb_int_export.
+ (rb_integer_unpack): Renamed from rb_int_import.
-Wed Jun 24 14:25:17 2015 Koichi Sasada <ko1@atdot.net>
+ * internal.h, pack.c: Follow the above change.
- * gc.c (gc_mark_ptr): add a check code for #11244.
+Fri Jun 7 21:05:26 2013 Tanaka Akira <akr@fsij.org>
- It should be removed later. But we can remain this check
- because it is only a branch.
+ * bignum.c (integer_format_loop_setup): Extracted from rb_int_export
+ and rb_int_import.
-Wed Jun 24 12:49:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 7 19:48:38 2013 Tanaka Akira <akr@fsij.org>
- * string.c (rb_fstring_cstr): new function to make a fstring from
- a string literal.
+ * bignum.c (validate_integer_format): Extracted from rb_int_export and
+ rb_int_import.
- * internal.h (rb_fstring_lit): new macro to make a fstring from a
- string literal.
+Fri Jun 7 19:23:15 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/intern.h (rb_strlen_lit): new macro to get the
- length of a string literal, borrowed from mruby/mruby@e4afd53.
+ * bignum.c (rb_absint_size): Use numberof.
+ (rb_int_export): Ditto.
-Wed Jun 24 12:21:16 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri Jun 7 18:58:56 2013 Tanaka Akira <akr@fsij.org>
- * re.c: Update documentation for Regexp class.
- [fix GH-937][ci skip] Patch by @davydovanton
+ * internal.h (numberof): Gathered from various files.
-Wed Jun 24 09:23:03 2015 Eric Wong <e@80x24.org>
+ * array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
+ load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
+ error.c, ruby.c: Remove the definitions of numberof.
- * variable.c (generic_ivar_set): remove FL_ABLE check
- (gen_ivar_copy): ditto
- [ruby-core:69715]
+Fri Jun 7 18:24:39 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 24 08:28:15 2015 Eric Wong <e@80x24.org>
+ * bignum.c (rb_absint_size): Declare a variable, i, just before used
+ to suppress a warning.
+ (rb_int_export): Ditto.
- * ext/socket/ancdata.c (bsock_recvmsg_internal): reduce stack use
- [ruby-core:69595] [Feature #11263]
+Fri Jun 7 17:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Jun 23 14:32:42 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit
+ 64 bit to 32 bit shortening warning
+ * bignum.c (rb_int_export): ditto
+ * bignum.c (int_import_push_bits): ditto
- * error.c (name_err_receiver): raise ArgumentError if no receiver
- is available on this exception object. [Feature #10881]
+Fri Jun 7 17:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Tue Jun 23 09:48:34 2015 Eric Wong <e@80x24.org>
+ * internal.h (RCLASS_SUPER): use descriptive variable name
+ * internal.h (RCLASS_SET_SUPER): ditto
- * dir.c (check_dirname): avoid volatile, use return value
- (dir_s_chroot, dir_s_mkdir, dir_s_rmdir): adjust callers
+Fri Jun 7 13:25:27 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Jun 23 06:37:10 2015 Eric Wong <e@80x24.org>
+ * ext/json/fbuffer/fbuffer.h (fbuffer_append_str): change the place of
+ RB_GC_GUARD. it should be after the object is used.
- * struct.c (struct_ivar_get): cache member definition in a subclass
- Thanks to Sokolov Yura aka funny_falcon <funny.falcon@gmail.com>
- in https://bugs.ruby-lang.org/issues/10585
+Fri Jun 7 13:22:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Jun 23 04:58:06 2015 Eric Wong <e@80x24.org>
+ * gc.c (before_gc_sweep): noinline can also avoid the segv instead of
+ -O0 of r41084. this way is expected less slow.
- * benchmark/bm_vm2_struct_big_href_hi.rb: new benchmark
- * benchmark/bm_vm2_struct_big_href_lo.rb: ditto
- * benchmark/bm_vm2_struct_big_hset.rb: ditto
- * benchmark/bm_vm2_struct_small_href.rb: ditto
- * benchmark/bm_vm2_struct_small_hset.rb: ditto
- Thanks to Sokolov Yura aka funny_falcon <funny.falcon@gmail.com>
- in https://bugs.ruby-lang.org/issues/10585
+Fri Jun 7 11:45:42 2013 Kenta Murata <mrkn@cookpad.com>
-Mon Jun 22 18:08:48 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * rational.c (numeric_quo): move num_quo in numeric.c to numeric_quo
+ in rational.c to refer canonicalization state for mathn support.
+ [ruby-core:41575] [Bug #5736]
- * test/lib/test/unit.rb (Test::Unit::Parallel#start_watchdog): removed
- because it has been meaningless since r36385. [Bug #11288]
+ * numeric.c (num_quo): ditto.
- * test/lib/test/unit.rb (Test::Unit::Parallel#_run_parallel): delete
- lines related to the removed start_watchdog method
+ * test/test_mathn.rb: add a test for the change at r41109.
-Sun Jun 21 23:52:46 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Fri Jun 7 11:41:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: mention about Array#bsearch_index and Hash#fetch_values.
+ * configure.in: revert r41106. size_t may not be unsigned
-Sun Jun 21 23:46:27 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * bignum.c (rb_absint_size_in_word, rb_int_export, rb_int_import): use
+ NUM2SIZET() and SIZET2NUM() already defined in ruby/ruby.h.
- * NEWS: add a reference to a ticket.
+Fri Jun 7 11:28:37 2013 Masaya Tarui <tarui@ruby-lang.org>
-Sun Jun 21 20:28:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: use oldgen bitmap as initial mark bitmap when major gc.
+ so can skip oldgen bitmap check around mark & sweep.
+ * gc.c (slot_sweep_body): change scan algorithm for performance:
+ from object's pointer base to bitmap one.
- * internal.h (roomof): extract from type_roomof, and move from
- bignum.c.
+Fri Jun 7 11:25:56 2013 Masaya Tarui <tarui@ruby-lang.org>
-Sun Jun 21 18:32:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: introduce oldgen bitmap for preparing performance tuning.
- * ruby_atomic.h (ATOMIC_PTR_CAS): define by generic CAS macro, not
- via size_t, to suppress a warning by mingw gcc.
+Fri Jun 7 11:20:57 2013 Masaya Tarui <tarui@ruby-lang.org>
-Sun Jun 21 05:31:41 2015 Shota Fukumori <her@sorah.jp>
+ * gc.c (MARKED_IN_BITMAP, MARK_IN_BITMAP, CLEAR_IN_BITMAP): bring
+ bitmap macros in one place, and introduce BITMAP_BIT.
- * ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when
- passed object is a special const, instead of SEGV.
- Based patch by Kohei Suzuki (eagletmt). [ruby-core:69692] [Bug #11291]
+Fri Jun 7 11:18:35 2013 Masaya Tarui <tarui@ruby-lang.org>
- * test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix.
+ * array.c (ary_new): change order of allocation in order
+ to remove FL_OLDGEN operation.
+Fri Jun 7 11:16:28 2013 Masaya Tarui <tarui@ruby-lang.org>
-Sat Jun 20 03:56:58 2015 Yusuke Endoh <mame@ruby-lang.org>
+ * tool/rdocbench.rb: add gc total time information.
- * enc/make_encmake.rb: the list of encoding extension libraries must
- not include encinit.c itself. It caused "undefined reference to
- Init_encinit".
+Fri Jun 7 10:12:01 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 20 02:03:53 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * gc.c: remove "Sunny" terminology.
+ "Sunny" doesn't mean antonym of "Shady" (questionable, doubtful, etc).
+ Instead of "Sunny", use "non-shady" or "normal".
- * process.c (rb_execarg_parent_start1): new macro ALWAYS_NEED_ENVP
- to generate envp_str anytime on Solaris 10 (or earlier version
- of Solaris) to avoid calling execv() which is async-signal unsafe
- on Solaris 10. [Bug #11265] [ruby-dev:49089]
+Fri Jun 7 09:29:33 2013 Kenta Murata <mrkn@cookpad.com>
- * process.c (exec_with_sh, proc_exec_cmd): On Solaris 10,
- because ALWAYS_NEED_ENVP is 1 and envp_str is always generated,
- execv() in exec_with_sh() and proc_exec_cmd() are never called.
- To guarantee this, execv() is replaced by a macro to print
- out error message on Solaris 10.
+ * bignum.c (rb_int_import): explicitly casting BDIGIT_DBL to BDIGIT
+ to prevent warning.
- * process.c (proc_exec_sh): Because proc_exec_sh() may be called
- by rb_proc_exec() with envp_str = Qfalse, execl() is replaced
- by a macro that calls execle() with "extern char **environ"
- traditional global variable on Solaris 10.
- TODO: This may be unsafe and should be changed in the future.
- Although rb_proc_exec() is not used from inside current version
- of ruby, it may be called by third-party extensions.
+Fri Jun 7 07:29:33 2013 Tanaka Akira <akr@fsij.org>
-Sat Jun 20 01:10:13 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * internal.h (rb_int_export): countp argument is split into
+ wordcount_allocated and wordcount.
- * NEWS: mention about $SAFE.
+ * bignum.c (rb_int_export): Follow the above change.
-Fri Jun 19 14:53:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c (pack_pack): Ditto.
- * proc.c (rb_mod_define_method): now requires a block direct to
- this method call. [ruby-core:69655] [Bug #11283]
+Fri Jun 7 07:17:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Fri Jun 19 13:54:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS: describe a compatibility issue of Numeric#quo
+ introduced at r41109.
- * proc.c (rb_mod_define_method): get rid of inadvertent ID
- creations at error.
+Fri Jun 7 07:15:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Fri Jun 19 07:58:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS: fix style.
- * ext/extmk.rb: if no with-ext option is given, default to
- enable everything. [ruby-dev:49108] [Bug #11280]
+Fri Jun 7 06:48:17 2013 Benoit Daloze <eregontp@gmail.com>
-Fri Jun 19 06:30:07 2015 Koichi Sasada <ko1@atdot.net>
+ * numeric.c: remove unused ID id_to_r introduced in r41109.
- * bootstraptest/test_method.rb: remove a test because $SAFE=2 was
- obsolete.
+Fri Jun 7 06:15:31 2013 Tanaka Akira <akr@fsij.org>
- Please check btest, too.
+ * bignum.c (rb_int_import): New function.
+ (int_import_push_bits): Ditto.
-Thu Jun 18 23:51:51 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * internal.h (rb_int_import): Declared.
- * bin/erb: $SAFE=3 is obsolete.
+ * pack.c (pack_unpack): Use rb_int_import for BER compressed integer.
-Thu Jun 18 23:45:11 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Thu Jun 6 22:24:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * safe.c: removed needless doc related $SAFE=2
+ * numeric.c (num_quo): Use to_r method to convert the receiver to
+ rational. [ruby-core:41575] [Bug #5736]
-Thu Jun 18 23:38:07 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/ruby/test_numeric.rb: add a test for the above change.
- * thread.c (rb_thread_safe_level): fix document. $SAFE=3 is obsolete.
- [ci skip]
+Thu Jun 6 20:40:17 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 18 23:25:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: Invoke RUBY_REPLACE_TYPE for size_t.
+ Don't invoke RUBY_CHECK_PRINTF_PREFIX for size_t to avoid conflict
+ with RUBY_REPLACE_TYPE.
- * ext/extmk.rb: configure intersection of with-ext and not
- without-ext, as withouts is no longer true by default if
- with-ext option is given. [ruby-dev:49108] [Bug #11280]
+ * internal.h (rb_absint_size): Declared.
+ (rb_absint_size_in_word): Ditto.
+ (rb_int_export): Ditto.
-Thu Jun 18 23:20:46 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (rb_absint_size): New function.
+ (rb_absint_size_in_word): Ditto.
+ (int_export_fill_dd): Ditto.
+ (int_export_take_lowbits): Ditto.
+ (rb_int_export): Ditto.
- * include/ruby/ruby.h: $SAFE=2 is now obsolete.
+ * pack.c (pack_pack): Use rb_int_export for BER compressed integer.
- * dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
- gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
- removed code for $SAFE=2
+Thu Jun 6 19:31:33 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * test/erb/test_erb.rb, test/fiddle/test_handle.rb
- test/ruby/test_env.rb: removed tests for $SAFE=2.
+ * ext/date/date_core.c: fixed coding error [ruby-core:55337].
+ reported by Riley Lynch.
-Thu Jun 18 22:50:07 2015 Yusuke Endoh <mame@ruby-lang.org>
+Thu Jun 6 14:16:37 2013 Narihiro Nakamura <authornari@gmail.com>
- * enc/make_encmake.rb: added --transes and --no-transes options.
+ * ext/objspace/object_tracing.c: rename allocation_info to
+ lookup_allocation_info. At times I confused "struct
+ allocation_info" with "function allocation_info".
-Thu Jun 18 18:24:12 2015 Eric Wong <e@80x24.org>
+Thu Jun 6 13:57:06 2013 Narihiro Nakamura <authornari@gmail.com>
- * test/socket/test_unix.rb: replace sleep with select
+ * ext/objspace/object_tracing.c: allocation_info function isn't
+ called by any other file.
-Thu Jun 18 17:59:06 2015 Koichi Sasada <ko1@atdot.net>
+Thu Jun 6 09:41:00 2013 Kenta Murata <mrkn@cookpad.com>
- * vm.c (rb_vm_control_frame_id_and_class): remove useless codes.
- `me' knows ID and owner class.
+ * numeric.c (num_quo): should return a Float for a Float argument.
+ [ruby-dev:44710] [Bug #5515]
-Thu Jun 18 16:58:35 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_fixnum.rb: Add an assertion for the above change.
- * method.h: constify rb_method_alias_struct::original_me and
- rb_method_refined_struct::orig_me.
+ * test/ruby/test_bignum.rb: ditto.
- * class.c (move_refined_method): use RB_OBJ_WRITE() for
- me->def->body.refined.orig_me.
+Thu Jun 6 00:59:44 2013 Masaya Tarui <tarui@ruby-lang.org>
-Thu Jun 18 14:35:28 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_mark): get rid of pushing useless objects.
+ * gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push
+ sunny old object at minor gc.
+ * gc.c (gc_mark_children): move sunny old check to gc_mark().
+ * gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary.
+ * gc.c (rb_gc_writebarrier): ditto.
- * ext/objspace/objspace.c (count_imemo_objects): support imemo_ment.
+ change sunny old check point in order to save mark stack and
+ remove unnatural rest_sweep & demote.
-Thu Jun 18 13:32:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 6 00:52:42 2013 Masaya Tarui <tarui@ruby-lang.org>
- * error.c (name_err_receiver): add NameError#receiver method.
- [Feature #10881]
+ * gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
+ from object's pointer base to bitmap one.
-Thu Jun 18 10:00:06 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Jun 6 00:30:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * safe.c: removed needless doc related $SAFE=3
+ * win32/win32.c (NET_LUID): define it on MinGW32.
+ mingw-w64 has NET_LUID but mingw32 (mingw.org) still doesn't have
+ NET_LUID. reported by taco on IRC
-Thu Jun 18 09:59:23 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Thu Jun 6 00:05:08 2013 Akinori MUSHA <knu@iDaemons.org>
- * safe.c: rename old method name for $SAFE=3
+ * string.c (String#b): Allow code range scan to happen later so
+ ascii_only? on a result string returns the correct value.
+ [ruby-core:55315] [Bug #8496]
-Thu Jun 18 06:02:42 2015 Eric Wong <e@80x24.org>
+Wed Jun 5 22:40:42 2013 Shugo Maeda <shugo@ruby-lang.org>
- * compile.c (get_exception_sym2type, iseq_build_from_ary_body):
- rely on %+PRIsVALUE instead of calling rb_inspect directly
+ * lib/net/imap.rb (capability_response): should ignore trailing
+ spaces. Thanks, Peter Kovacs. [ruby-core:55024] [Bug #8415]
-Wed Jun 17 20:59:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/net/imap/test_imap_response_parser.rb: related test.
- * common.mk (ENC_MK): needs fake.rb if cross compilation.
- [ruby-dev:49098] [Bug #11272]
+Wed Jun 5 21:17:08 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 17 20:23:29 2015 Tanaka Akira <akr@fsij.org>
+ * bignum.c (big_fdiv): Use nlz() instead of bdigbitsize().
+ (bdigbitsize): Removed.
- * ext/rbconfig/sizeof/extconf.rb: Check __float80.
+Wed Jun 5 20:32:00 2013 Kenta Murata <mrkn@cookpad.com>
-Wed Jun 17 15:15:53 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * include/ruby/ruby.h: fix alignment in comment.
- * safe.c (safe_setter): of course, don't have to warn the limitation of
- $SAFE=3 after it's removed.
+Wed Jun 5 20:05:29 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 17 14:29:43 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * random.c (int_pair_to_real_inclusive): Add a cast to BDIGIT.
+ (random_load): Fix shift width for fixnums.
+ Re-implement bignum extraction without ifdefs.
- * include/ruby/ruby.h: $SAFE=3 is now obsolete.
+Wed Jun 5 15:26:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/socket/init.c, ext/socket/socket.c, ext/socket/tcpsocket.c
- ext/socket/udpsocket.c, gc.c, object.c, re.c, safe.c: removed code
- for $SAFE=3
+ * gc.c (before_gc_sweep): don't optimize it to avoid segv on Ubuntu
+ 10.04 gcc 4.4.
+ http://u32.rubyci.org/~chkbuild/ruby-trunk/log/20130527T190301Z.diff.html.gz
- * bootstraptest/test_method.rb, test/erb/test_erb.rb, test/ruby/test_dir.rb
- test/ruby/test_file.rb, test/ruby/test_method.rb, test/ruby/test_regexp.rb
- test/ruby/test_thread.rb: remove tests for $SAFE=3
+Wed Jun 5 09:46:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Jun 17 12:13:33 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
+ EACCES for Windows.
- * ChangeLog: added contributor name.
+Wed Jun 5 08:13:37 2013 Tanaka Akira <akr@fsij.org>
-Wed Jun 17 10:57:28 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c (rb_big_pow): Don't need to multiply SIZEOF_BDIGITS.
+ Use nlz instead of bitlength_bdigit.
+ (bitlength_bdigit): Removed.
- * lib/csv.rb: accept to use Range object for row selection.
- contributed by Mitsutaka Mimura.
- [Feature #11267][ruby-dev:49091]
+Wed Jun 5 07:14:18 2013 Tadayoshi Funaba <tadf@dotrb.org>
-Wed Jun 17 09:50:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/date/date_core.c (d_lite_cmp, d_lite_equal): simplified.
- * lib/rdoc/servlet.rb (documentation_search, root_search):
- requires json for JSON.dump and fix sporadic failures due to
- the loading order.
+Wed Jun 5 07:07:01 2013 Tadayoshi Funaba <tadf@dotrb.org>
-Tue Jun 16 19:19:53 2015 Tanaka Akira <akr@fsij.org>
+ * ext/date/date_core.c: fixed a bug [ruby-core:55295]. reported
+ by Riley Lynch.
- * ext/rbconfig/sizeof/extconf.rb: Check several types defined in C99
- and x86_64 ABI.
+Wed Jun 5 06:44:08 2013 Eric Hodel <drbrain@segment7.net>
- * template/sizes.c.tmpl: Relax a pattern for types.
+ * lib/rubygems: Update to RubyGems 2.0.3
-Tue Jun 16 17:37:01 2015 Koichi Sasada <ko1@atdot.net>
+ * test/rubygems: Tests for the above.
- * test/objspace/test_objspace.rb: relax pattern because uncollectible
- flag and marked flag can be false at major GC.
- [Bug #10852]
+ * NEWS: Added RubyGems 2.0.3 note.
-Tue Jun 16 04:50:44 2015 Eric Wong <e@80x24.org>
+Wed Jun 5 06:35:15 2013 Eric Hodel <drbrain@segment7.net>
- * ext/socket/basicsocket.c (bsock_recv): document outbuf
- * ext/socket/unixsocket.c (unix_recvfrom): ditto
- * ext/socket/init.c (rsock_strbuf, recvfrom_locktmp): new functions
- (rsock_s_recvfrom): support destination buffer as 3rd arg
- (rsock_s_recvfrom_nonblock): ditto
- * string.c (rb_str_locktmp_ensure): export for internal ext
- * test/socket/test_nonblock.rb: test recv_nonblock
- * test/socket/test_unix.rb: test recv
- [ruby-core:69543] [Feature #11242]
+ * doc/marshal.rdoc: Add description of Marshal format.
-Tue Jun 16 04:38:02 2015 Eric Wong <e@80x24.org>
+Wed Jun 5 01:16:09 2013 Benoit Daloze <eregontp@gmail.com>
- * ext/socket/ancdata.c (bsock_sendmsg_internal,
- bsock_recvmsg_internal):
- support "exception: false" kwarg
- * ext/socket/init.c (rsock_s_recvfrom_nonblock):
- ditto
- * ext/socket/init.c (rsock_s_recvfrom_nonblock): use rsock_opt_false_p
- * ext/socket/socket.c (sock_connect_nonblock): ditto
- * ext/socket/rubysocket.h (rsock_opt_false_p): new function
- * ext/socket/basicsocket.c (bsock_recv_nonblock): update rdoc
- * ext/socket/udpsocket.c (udp_recvfrom_nonblock): ditto
- * test/socket/test_nonblock.rb: new tests
- [ruby-core:69542] [Feature #11229]
+ * array.c (Array#+): fix documentation example.
+ Patch by Logan Serman. [Fixes GH-324]
-Mon Jun 15 14:33:02 2015 Akinori MUSHA <knu@iDaemons.org>
+Wed Jun 5 00:21:54 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * lib/set.rb: Make Set#each and SortedSet#each generate a sized
- enumerator. [GH-931] by kachick (Kenichi Kamiya)
+ * lib/irb/lc/ja/help-message: update help messages.
+ following r41028. [ruby-dev:46707] [Feature #7510]
- * test/test_set.rb: Import tests from Set into SortedSet. [GH-931]
- by kachick (Kenichi Kamiya)
+Wed Jun 5 00:09:32 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 15 02:26:34 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * marshal.c (r_object0): Generalize a round up expression.
+ Use BDIGIT instead of int.
- * lib/net/http.rb (Net::HTTP#connect): use connect_nonblock and
- io/wait to eliminate timeout use. fix GH-899
+Tue Jun 4 23:44:02 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Sat Jun 13 07:21:18 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * object.c (rb_Hash): fix docs. patched by Stefan Sch"ussler.
+ [ruby-core:55299] [Bug #8487]
- * thread.c (thread_start_func_2): don't interrupt when last thread
- exit unless main thread is already exited. Otherwise main thread
- could be wrongly interrupted when it uses rb_thread_call_without_gvl().
- Patch by Takehiro Kubo. [Bug #11237][ruby-dev:49044][GH-898]
+Tue Jun 4 23:16:49 2013 Benoit Daloze <eregontp@gmail.com>
- * test/-ext-/gvl/test_last_thread.rb: new test for the above fix.
+ * lib/irb/completion.rb: Use %w literal construction for long lists.
+ Patch by Dave Goodchild. [Fixes GH-299]
- * ext/-test-/gvl/call_without_gvl/call_without_gvl.c: new ext for
- the above test.
- * ext/-test-/gvl/call_without_gvl/extconf.rb: ditto.
+Tue Jun 4 23:08:42 2013 Benoit Daloze <eregontp@gmail.com>
-Mon Jun 15 00:14:33 2015 Tanaka Akira <akr@fsij.org>
+ * ext/objspace/objspace.c: improve wording and remove duplicated comment.
+ Based on a patch by Dave Goodchild. [Fixes GH-299]
- * ext/pathname/lib/pathname.rb (descend): Blockless form supported.
- (ascend): Ditto.
- [ruby-core:68820] [Feature #11052] Patch by Piotr Szotkowski.
+Tue Jun 4 18:41:47 2013 Tanaka Akira <akr@fsij.org>
-Sun Jun 14 20:09:25 2015 Tanaka Akira <akr@fsij.org>
+ * bignum.c (bitlength_bdigit): Fix an off-by-one error.
- * time.c (time_getlocaltime): [DOC] Add examples of valid utc_offset
- formats.
- [ruby-core:68306] [Misc #10905] Patch by Charles Korn.
+Tue Jun 4 15:30:00 2013 Kenta Murata <mrkn@cookpad.com>
-Sun Jun 14 18:49:56 2015 Tanaka Akira <akr@fsij.org>
+ * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): fix the number
+ of figures. Patch by Vipul A M <vipulnsward@gmail.com>.
+ https://github.com/ruby/ruby/pull/323 fix GH-323
- * ext/socket/raddrinfo.c (parse_numeric_port): Detect
- port overflow.
- (numeric_getaddrinfo): Use parse_numeric_port.
- numeric_getaddrinfo fails if port is too big now.
- This makes rb_getaddrinfo invokes the real getaddrinfo()
- on such condition.
- This change is related to [ruby-core:69355] [Bug #11179].
+ * test/bigdecimal/test_bigdecimal_util.rb: fix for the above change.
-Sun Jun 14 17:26:03 2015 Tanaka Akira <akr@fsij.org>
+Tue Jun 4 00:44:27 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * enum.c (enum_chunk_while): New method Enumerable#chunk_while.
- [ruby-core:67738] [Feature #10769] proposed by Tsuyoshi Sawada.
+ * test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
+ EEXIST for Linux. (suggested by nurse)
-Sun Jun 14 17:20:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 3 23:58:19 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * file.c (rb_file_load_ok): try opening file without gvl not to
- lock entire process. [Bug #11060]
+ * lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash.
+ * test/fileutils/test_fileutils.rb: test for above.
-Sun Jun 14 10:43:50 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jun 3 23:47:55 2013 Tanaka Akira <akr@fsij.org>
- * tool/runruby.rb: just remove the lines of RUBY_VERSION check and raise
- instead of replacing the check to `true`, for getting rid of a
- warning `possibly useless use of true in void context`.
+ * bignum.c (bitlength_bdigit): New function.
+ (rb_big_pow): Use bitlength_bdigit instead of ffs.
-Sun Jun 14 10:13:55 2015 Kouhei Sutou <kou@cozmixng.org>
+Mon Jun 3 23:11:19 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * lib/rexml/source.rb (REXML::IOSource#scan): Fix a typo in
- document. [fix GH-934]
- Patch by Anton Davydov. Thanks!!!
+ * lib/fileutils.rb: fix behavior when mkdir/mkdir_p accepted "/".
+ * test/fileutils/test_fileutils.rb: add test for above change.
+ Patched by Mitsunori Komatsu. [GH-319]
-Sun Jun 14 10:09:48 2015 Kouhei Sutou <kou@cozmixng.org>
+Mon Jun 3 19:02:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rexml/attlistdecl.rb (REXML::AttlistDecl): Fix a typo in
- document. [fix GH-934]
- Patch by Anton Davydov. Thanks!!!
+ * dir.c (is_hfs): use the file descriptor instead of a path.
-Sun Jun 14 06:24:57 2015 Benoit Daloze <eregontp@gmail.com>
+Mon Jun 3 07:15:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * test/ruby/test_io.rb: add test for IO.binread fd leak.
- See r50881.
+ * configure.in: removes AC_CHECK_FUNCS(readdir_r). readdir_r()
+ is only used from dir.c and it doesn't need readdir_r().
+ * configure.in (SIZEOF_STRUCT_DIRENT_TOO_SMALL): removed. It is
+ only used for readdir_r.
+ * dir.c: removes NAME_MAX_FOR_STRUCT_DIRENT. It is not right way
+ to detect maximum length of path len. POSIX require to use
+ fpathconf(). IOW, it might have lead to make a vulnerability
+ using stack smashing. Moreover, readdir() works enough for our
+ usage.
+ * dir.c (READDIR): removes an implementation which uses
+ readdir_r() and parenthesize in a macro body correctly.
+ * dir.c (dir_read): removes IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT
+ entry), it is used only for readdir_r().
+ * dir.c (dir_each): ditto.
+ * dir.c (glob_helper): ditto.
-Sun Jun 14 05:23:51 2015 Benoit Daloze <eregontp@gmail.com>
+ * dir.c (READDIR): removes entry and dp argument.
+ * dir.c (dir_read): adjust for the above change.
+ * dir.c (dir_each): ditto.
+ * dir.c (glob_helper): ditto.
- * io.c (rb_io_s_binread): close fd if seek offset is invalid.
+Mon Jun 3 03:40:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Jun 14 04:40:32 2015 Benoit Daloze <eregontp@gmail.com>
+ * vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
+ The code is not useless.
- * test/lib/leakchecker.rb (check): refactor.
+Mon Jun 3 01:25:25 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Sun Jun 14 04:34:14 2015 Benoit Daloze <eregontp@gmail.com>
+ * test/socket/test_sockopt.rb: change test name. follow r41037.
- * test/lib/leakchecker.rb: Return false for no leaks.
- Otherwise the GC could run for nothing.
+Mon Jun 3 01:08:43 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Sun Jun 14 04:15:40 2015 Benoit Daloze <eregontp@gmail.com>
+ * test/rinda/test_rinda.rb: rename functions introduced in r41009.
- * lib/delegate.rb: [DOC] Update SimpleDelegator example. [ci skip]
+Sun Jun 2 23:33:42 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Sat Jun 13 20:28:14 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * enc/trans/japanese_euc.trans, test/ruby/test_transcode.rb,
+ tool/transcode-tblgen.rb: change EUC-JP-2004 to EUC-JIS-2004.
+ This is follow up to changes in r41024.
- * file.c (rb_stat_ino): get inode from the interval of struct st.
+Sun Jun 2 22:44:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * win32/win32.c (stati64_set_inode): get nFileIndexHigh/Low, and set it
- to the interval of struct st as inode.
- [Feature #11216]
+ * ext/socket/option.c: rename functions introduced in r41009
+ s/ip/ipv4/g because they are ipv4 functions.
+ (there's a policy that the name "ip" is for methods which supports
+ both ipv4 and ipv6)
- * win32/win32.c (stati64_set_inode_handle): call stati64_set_inode.
+Sun Jun 2 16:15:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_fstati64): call stati64_set_inode_handle.
+ * dln_find.c (dln_find_exe, dln_find_file): remove deprecated
+ non-reentrant functions.
- * win32/win32.c (stati64_handle): call stati64_set_inode.
+Sun Jun 2 15:04:35 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jun 13 19:44:53 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/cgi/util.rb, lib/erb.rb: Use String#b [Feature #8394] by znz
- * ext/io/console/depend (.list.chksum): revert a part of r50859, because
- it was not mentioned at its commit log and it caused a build error on
- Windows ($(MAKE) is already quoted).
+Sun Jun 2 14:10:21 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jun 13 17:35:11 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/irb/lc/help-message: Apply english updates for irb --help #7510
- * vm_core.h (rb_thread_t): add th->name.
+Sun Jun 2 12:03:58 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm.c (th_init): initialize th->name.
+ * range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143]
- * thread.c (Init_Thread): add Thread.name and name=. [Feature #11251]
+Sun Jun 2 02:08:37 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * thread.c (rb_thread_inspect): show thread's name if set.
+ * enc/euc_jp.c: fix typo: the name of EUC-JIS-2004.
- * thread.c (rb_thread_getname): defined.
+Sat Jun 1 23:17:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * thread.c (rb_thread_setname): ditto.
+ * vm_eval.c (rb_mod_module_eval): mention in docs that arguments passed
+ to the method are passed to the block
-Sat Jun 13 11:39:43 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Jun 1 17:58:13 2013 Akinori MUSHA <knu@iDaemons.org>
- * lib/tempfile.rb: Fix typo. [fix GH-933] Patch by @Zorbash
+ * lib/set.rb (Set#freeze, taint, untaint): Save a "self" by
+ utilizing super returning self, and add tests while at it.
-Sat Jun 13 11:38:00 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat Jun 1 17:24:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_ocsp.c: fix documentation on ocsp response cert status.
- [fix GH-932] Patch by @chrisholmes
+ * compile.c (iseq_set_arguments): not a simple single argument if any
+ keyword arguments exist. [ruby-core:55203] [Bug #8463]
-Sat Jun 13 11:35:19 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * vm_insnhelper.c (vm_yield_setup_block_args): split single parameter
+ if any keyword arguments exist, and then extract keyword arguments.
+ [ruby-core:55203] [Bug #8463]
- * ext/bigdecimal/bigdecimal.gemspec: Fix require paths for released gem.
- [fix GH-929] Patch by @voxik
- * ext/io/console/io-console.gemspec: ditto.
+Sat Jun 1 11:16:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jun 13 00:45:08 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * error.c (rb_exc_new_cstr): rename from rb_exc_new2.
- * lib/prime.rb: Return sized enumerators.
- Patch by Kenichi Kamiya [GH-931]
+ * error.c (rb_exc_new_str): rename from rb_exc_new3.
-Sat Jun 13 00:45:06 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Sat Jun 1 10:13:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/prime.rb: Fix with_object with no block given
+ * string.c (rb_str_new[2-5], rb_{tainted,usascii}_str_new2),
+ (rb_str_buf_new2): remove old interfaces.
-Sat Jun 13 00:44:59 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Sat Jun 1 08:00:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/prime.rb: Have with_index accept an offset parameter.
- Based on patch by T Yamada. [#11007]
+ * ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
+ (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]
-Fri Jun 12 22:21:12 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Sat Jun 1 07:32:15 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_extlibs.rb (TestExtLibs::check_existence): fix
- error. [Bug #11255] [ruby-dev:49079]
+ * bignum.c: Use BDIGIT type for hbase.
-Fri Jun 12 21:17:46 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Jun 1 02:37:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * pack.c (pack_{un,}pack): new template character `j` and `J`, pointer
- with signed and unsigned integers.
+ * ext/socket/option.c (sockopt_s_byte): constructor of the sockopt
+ whose value's is byte.
- * NEWS: mention about this feature.
- [Feature #11215] [ruby-dev:49015]
+ * ext/socket/option.c (sockopt_byte): getter for above.
-Fri Jun 12 21:01:44 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/socket/option.c (inspect_byte): inspect for above.
- * file.c (File::SHARE_DELETE): new flag to be able to delete opened file
- on Windows.
+ * ext/socket/option.c (sockopt_s_ip_multicast_loop): constructor of
+ the sockopt whose optname is IP_MULTICAST_LOOP.
- * include/win32/win32.c (O_SHARE_DELETE): new pseudo file mode flag.
+ * ext/socket/option.c (sockopt_ip_multicast_loop): getter for above.
- * win32/win32.c (rb_w32_{w,}open): support above flag. [EXPERIMENTAL]
+ * ext/socket/option.c (sockopt_s_ip_multicast_ttl): constructor of
+ the sockopt whose optname is IP_MULTICAST_TTL.
- * NEWS: mention about this feature.
- [Feature #11218] [ruby-dev:49022]
+ * ext/socket/option.c (sockopt_ip_multicast_ttl): getter for above.
-Fri Jun 12 18:21:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/socket/option.c (sockopt_inspect): use above.
- * ChangeLog: added missing commit message.
+Sat Jun 01 01:50:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Fri Jun 12 18:20:37 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big
+ to convert a double value to a Bignum.
- * sample/exyacc.rb: Fix some typos. [fix GH-927] Patch by @davydovanton
- * sample/list.rb: ditto.
- * sample/trick2013/kinaba/remarks.markdown: ditto.
+Sat Jun 1 00:19:50 2013 Tanaka Akira <akr@fsij.org>
-Fri Jun 12 17:34:14 2015 Wojciech Mach <wojtek@wojtekmach.pl>
+ * bignum.c (calc_hbase): Make hbase the maximum power of base
+ representable in BDIGIT.
- * hash.c (rb_hash_fetch_values): add `Hash#fetch_values`.
- [Feature #10017] [Fix GH-776]
+Fri May 31 23:56:13 2013 Tanaka Akira <akr@fsij.org>
-Fri Jun 12 16:28:17 2015 Radan Skoric <radan.skoric@gmail.com>
+ * bignum.c (calc_hbase): Extracted from rb_big2str0.
- * array.c (rb_ary_bsearch_index): Implement Array#bsearch_index
- method, which is similar to bsearch and returns the index or
- nil. [Feature #10730]
+Fri May 31 23:22:24 2013 Tanaka Akira <akr@fsij.org>
-Thu Jun 11 19:11:22 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * bignum.c: Don't hard code SIZEOF_BDIGITS for log_base(hbase).
+ (big2str_orig): hbase_numdigits argument added.
+ (big2str_karatsuba): Ditto.
+ (rb_big2str0): Calculate hbase_numdigits.
- * ext/zlib/zlib.c: Fix indentation for rdoc.
- [Bug #11221][ruby-core:69465]
+Fri May 31 17:57:21 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Jun 11 16:23:37 2015 Koichi Sasada <ko1@atdot.net>
+ * process.c: Improve Process::exec documentation
- * method.h (METHOD_ENTRY_BASIC_SET): fix last commit (unbalanced parens).
+Fri May 31 17:26:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 11 15:14:16 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm_eval.c (rb_funcallv): add better names of rb_funcall2.
- * configure.in: define SET_THREAD_NAME if it has pthread_set_name_np
- for FreeBSD, and don't define it if both pthread_setname_np
- and pthread_set_name_np don't exist.
+ * vm_eval.c (rb_funcallv_public): ditto for rb_funcall3.
- * thread_pthread.c (SET_THREAD_NAME): don't define if they don't exist.
+Fri May 31 17:04:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_pthread.c (native_set_thread_name): run if SET_THREAD_NAME
- is defined.
+ * array.c (rb_ary_new_capa): add better names of rb_ary_new2.
-Thu Jun 11 15:53:31 2015 Koichi Sasada <ko1@atdot.net>
+ * array.c (rb_ary_new_from_args): ditto for rb_ary_new3.
- * method.h (METHOD_ENTRY_BASIC_SET): should clear last bit.
+ * array.c (rb_ary_new_from_values): ditto for rb_ary_new4.
-Thu Jun 11 14:34:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri May 31 16:35:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems.rb: bump version to 2.4.7 and 2.4.8. these versions fixed
- CVE-2015-3900.
- * lib/rubygems/remote_fetcher.rb: ditto.
- * test/rubygems/test_gem_remote_fetcher.rb: added testcase for CVE-2015-3900
+ * configure.in (HAVE_ATTRIBUTE_FUNCTION_ALIAS): define to tell if
+ alias attribute is available.
-Thu Jun 11 14:18:51 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Fri May 31 16:03:23 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/rubygems.rb: bump version to 2.4.6. It's missing change at r49774.
+ * object.c, proc.c: s/call_seq/call-seq in rdoc. [Fixes GH-322]
-Thu Jun 11 13:50:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 31 15:56:36 2013 Zachary Scott <zachary@zacharyscott.net>
- * array.c (ary_ensure_room_for_push): check if array size will
- exceed maximum size to get rid of buffer overflow.
- [ruby-dev:49043] [Bug #11235]
+ * ext/openssl/ossl_ssl.c: Add missing paren in rdoc [Fixes GH-321]
- * array.c (ary_ensure_room_for_unshift, rb_ary_splice): ditto.
+Fri May 31 11:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 11 13:17:34 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_method.c (set_visibility): extract from rb_mod_public(),
+ rb_mod_protected() and rb_mod_private().
- * test/test_cmath.rb (TestCMath#test_trigonometric_functions): should
- not compare float values (in complex values) by `==`.
+Thu May 30 19:47:42 2013 Yusuke Endoh <mame@tsg.ne.jp>
-Thu Jun 11 08:52:01 2015 Koichi Sasada <ko1@atdot.net>
+ * vm_insnhelper.c (vm_callee_setup_keyword_arg,
+ vm_callee_setup_arg_complex): consider a hash argument for keyword
+ only when the number of arguments is more than the expected
+ mandatory parameters. [ruby-core:53199] [ruby-trunk - Bug #8040]
- * method.h: embed rb_method_entry_t::attr::flags (5 bits) into
- rb_method_entry_t::flags to make one word spare space.
+ * test/ruby/test_keyword.rb: update a test for above.
- Add some macros to access these flags.
+Thu May 30 17:55:04 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_method.c: use these macros.
+ * process.c: RDoc on Process.spawn
- * internal.h: define IMEMO_FL_USHIFT and IMEMO_FL_USER[0-4]
- for T_IMEMO local flags.
+Thu May 30 00:08:14 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 11 08:27:06 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_profile_enable): rest_sweep() to finish last GC.
+ Profiling record is allocated at first of marking phase.
+ Enable at lazy sweeping may cause an error (SEGV).
- * vm.c: use VM_ASSERT instead of assert().
+Wed May 29 10:33:27 2013 Koichi Sasada <ko1@atdot.net>
- * vm_args.c: ditto.
+ * hash.c: fix WB bug.
+ (1) Hash's key also needs WB.
+ (2) callback parameter *key and *value of st_update() is not a
+ storage of st_table itself (only local variable). So that
+ OBJ_WRITE() is not suitable, especially for `!existing'.
+ OBJ_WRITTEN() is used instead of OBJ_WRITE().
- * vm_insnhelper.c: ditto.
+Tue May 28 12:31:21 2013 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/object_tracing.c: fix a bug reported at
+ "[ruby-core:55182] [ruby-trunk - Bug #8456][Open] Sugfault in Ruby Head"
+ Care about the case TracePoint#path #=> `nil'.
+
+ * ext/objspace/object_tracing.c: add two new methods:
+ * ObjectSpace.allocation_class_path(o)
+ * ObjectSpace.allocation_method_id(o)
+ They are not useful for Object.new because they are always
+ "Class" and :new.
+ To trace more useful information, we need to maintain call-tree
+ using call/return hooks, which is implemented by
+ ll-prof <http://sunagae.net/wiki/doku.php?id=software:llprof>
- * vm_method.c: ditto.
+ * test/objspace/test_objspace.rb: add a test.
+
+Tue May 28 11:30:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): leave makefiles untouched if the content is
+ not changed, to get rid of unnecessary re-linking.
+
+Tue May 28 03:11:02 2013 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/gc_hook.c, ext/objspace/objspace.c: add new methods to
+ hook GC invocation.
+ * ObjectSpace.after_gc_start_hook=(proc)
+ * ObjectSpace.after_gc_end_hook=(proc)
+
+ Note that hooks are not kicked immediately. Procs are kicked
+ at postponed_job.
+
+ This feature is a sample of new internal event and
+ rb_postponed_job API.
+
+Tue May 28 02:56:15 2013 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (gc_stat): remove wrong rest_sweep().
+
+Tue May 28 02:44:23 2013 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (garbage_collect_body): fix GC_ENABLE_LAZY_SWEEP condition.
+
+ * gc.c (GC_NOTIFY): move debug print location and use stderr instead
+ of stdout.
-Thu Jun 11 08:16:48 2015 Koichi Sasada <ko1@atdot.net>
+Tue May 28 02:07:21 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h: define VM_ASSERT() for assertion
- enabled only when (VM_CHECK_MODE > 0).
+ * vm_trace.c (rb_postponed_job_register_one): fix iteration bug.
- * vm_insnhelper.c: move definition VM_CHECK_MODE
- from vm_insnhelper.c to vm_core.h.
+ * ext/-test-/postponed_job/postponed_job.c,
+ test/-ext-/postponed_job/test_postponed_job.rb: add a test.
- * vm.c: remove <assert.h>
+Tue May 28 00:34:23 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 11 06:46:07 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h, gc.c: add new internal event
+ RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of
+ after_sweep().
+ Time chart with lazy sweep is:
+ (1) Kick RUBY_INTERNAL_EVENT_GC_START
+ (2) [gc_marks()]
+ (3) [lazy_sweep()]
+ (4) [... run Ruby program (mutator) with lazy_sweep() ...]
+ (5) [after_sweep()]
+ (6) Kick RUBY_INTERNAL_EVENT_GC_END
+ (7) [... run Ruby program (mutator), and go to (1) ...]
+ Time chart without lazy sweep (GC.start, etc) is:
+ (1) Kick RUBY_INTERNAL_EVENT_GC_START
+ (2) [gc_marks()]
+ (3) [gc_sweep()]
+ (4) [after_sweep()]
+ (5) Kick RUBY_INTERNAL_EVENT_GC_END
+ (6) [... run Ruby program (mutator), and go to (1) ...]
- * vm_insnhelper.c (check_frame): check type of cref_or_me first.
+ * ext/-test-/tracepoint/tracepoint.c,
+ test/-ext-/tracepoint/test_tracepoint.rb: modify a test.
+
+Tue May 28 00:18:57 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_postponed_job_flush): remove a wrong comment.
+
+Mon May 27 22:09:33 2013 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/ruby.h (RHASH_SIZE): Add a cast to suppress a
+ warning, comparison between signed and unsigned integer
+ expressions [-Wsign-compare], on ILP32.
+
+Mon May 27 19:25:47 2013 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE to
+ RUBY_INTERNAL_EVENT_FREEOBJ.
+
+ * ext/-test-/tracepoint/tracepoint.c,
+ ext/objspace/object_tracing.c,
+ gc.c, vm_trace.c: catch up this change.
+
+Mon May 27 18:57:28 2013 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c: support ObjectSpace.trace_object_allocations.
+ Read the following test to know HOWTO.
+ This feature is a sample of RUBY_INTERNAL_EVENT.
+
+ * test/objspace/test_objspace.rb: add a test.
-Thu Jun 11 04:34:39 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * ext/objspace/object_tracing.c: ditto.
- * test/test_cmath.rb: Add some assertions.
+ * gc.c (rb_gc_count): add. This function returns GC count.
-Thu Jun 11 00:34:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: add decl. of rb_gc_count(). Same as `GC.count'.
- * template/fake.rb.in: expanded macro result may have spaces
- between tokens. [ruby-dev:49047] [Bug #11243]
+Mon May 27 17:33:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jun 10 22:27:32 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * tool/rbinstall.rb (install_recursive): add maxdepth option.
- * lib/mkmf.rb: revert r50804 because of build failure when specifying
- LDFLAGS during configure, observed on Solaris with GCC 4.6.
- [Bug #11245]
+ * tool/rbinstall.rb (bin-comm): limit depth of bindir and reject empty
+ files. [ruby-core:55101] [Bug #8432]
-Wed Jun 10 21:59:51 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Mon May 27 16:16:18 2013 Koichi Sasada <ko1@atdot.net>
- * README.ja.md: fix markup miss.
+ * vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use
+ ruby_xmalloc/xfree. It is safe during GC.
-Wed Jun 10 11:06:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 27 09:24:03 2013 Koichi Sasada <ko1@atdot.net>
- * template/fake.rb.in: turn into erb template from autoconf
- template to fake more accurately.
+ * test/-ext-/postponed_job/test_postponed_job.rb: fix typo and class name.
- * common.mk (fake.rb): needs preprocessed file now.
+Mon May 27 09:05:17 2013 Koichi Sasada <ko1@atdot.net>
- * version.c (Init_version): add dummy expression to
- RUBY_ENGINE_VERSION.
+ * include/ruby/ruby.h, gc.c, vm_trace.c: add internal events.
+ * RUBY_INTERNAL_EVENT_NEWOBJ: object created.
+ * RUBY_INTERNAL_EVENT_FREE: object freed.
+ * RUBY_INTERNAL_EVENT_GC_START: GC started.
+ And rename `RUBY_EVENT_SWITCH' to `RUBY_INTERNAL_EVENT_SWITCH'.
-Tue Jun 9 12:31:25 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ Internal events can not invoke any Ruby program because the tracing
+ timing may be critical (under huge restriction).
+ These events can be hooked only by C-extensions.
+ We recommend to use rb_postponed_job_register() API to call Ruby
+ program safely.
- * lib/prime.rb: Simplify and optimize EratosthenesSieve
+ This change is mostly written by Aman Gupta (tmm1).
+ https://bugs.ruby-lang.org/issues/8107#note-12
+ [Feature #8107]
-Tue Jun 9 11:45:00 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * include/ruby/debug.h, vm_trace.c: added two new APIs.
+ * rb_tracearg_event_flag() returns rb_event_flag_t of this event.
+ * rb_tracearg_object() returns created/freed object.
- * lib/prime.rb: Simplify and optimize EratosthenesSieve
- based on patch by Ajay Kumar. [Fixes GH-921]
+ * ext/-test-/tracepoint/extconf.rb,
+ ext/-test-/tracepoint/tracepoint.c,
+ test/-ext-/tracepoint/test_tracepoint.rb: add a test.
-Mon Jun 8 05:09:58 2015 Koichi Sasada <ko1@atdot.net>
+Mon May 27 08:38:21 2013 Koichi Sasada <ko1@atdot.net>
- * gc.c (obj_info): print method id for T_IMEMO/ment.
+ * ext/-test-/postponed_job/postponed_job.c: fix `init' function name.
-Sun Jun 7 07:05:43 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+Mon May 27 06:22:41 2013 Koichi Sasada <ko1@atdot.net>
- * Move test cases from test/ruby/test_complex.rb to test/test_cmath.rb
+ * include/ruby/debug.h, vm_trace.c: add rb_postponed_job API.
+ Postponed jobs are registered with this API. Registered jobs
+ are invoked at `ruby-running-safe-point' as soon as possible.
+ This timing is completely same as finalizer timing.
-Sat Jun 6 18:23:41 2015 Koichi Sasada <ko1@atdot.net>
+ There are two APIs:
+ * rb_postponed_job_register(flags, func, data): register a
+ postponed job with data. flags are reserved.
+ * rb_postponed_job_register_one(flags, func, data): same as
+ `rb_postponed_job_register', but only one `func' job is
+ registered (skip if `func' is already registered).
- * method.h: back to share rb_method_definition_t by
- rb_method_entry_t.
+ This change is mostly written by Aman Gupta (tmm1).
+ https://bugs.ruby-lang.org/issues/8107#note-15
+ [Feature #8107]
- r50728 changed sharing `def's to isolating `def's
- on alias and so on. However, this change conflicts
- future improvement plan. So I change back to sharing approach.
+ * gc.c: use postponed job API for finalizer.
- * method.h: move rb_method_definition_t::flags to
- rb_method_entry_t::attr::flags.
+ * common.mk: add dependency from vm_trace.c to debug.h.
- rb_method_entry_t::attr is union with VALUE because this field
- should have same size of VALUE. rb_method_entry_t is T_IMEMO).
+ * ext/-test-/postponed_job/extconf.rb, postponed_job.c,
+ test/-ext-/postponed_job/test_postponed_job.rb: add a test.
- And also add the following access macros to it's fields.
+ * thread.c: implement postponed API.
- * METHOD_ENTRY_VISI(me)
- * METHOD_ENTRY_BASIC(me)
- * METHOD_ENTRY_SAFE(me)
+ * vm_core.h: ditto.
- * vm_method.c (rb_method_definition_addref): added instead of
- rb_method_definition_clone().
+Mon May 27 02:26:02 2013 Koichi Sasada <ko1@atdot.net>
- Do not create new definition, but increment alias_count.
+ * gc.c (gc_stat): collect promote_operation_count and
+ types (RGENGC_PROFILE >= 2).
- * class.c (clone_method): catch up this fix.
+Mon May 27 01:40:58 2013 Koichi Sasada <ko1@atdot.net>
- * class.c (method_entry_i): ditto.
+ * gc.c (gc_stat): collect shade_operation_count,
+ remembered_sunny_object_count and remembered_shady_object_count
+ for each types when RGENGC_PROFILE >= 2.
+ They are informative for optimization.
- * proc.c (mnew_internal): ditto.
+Mon May 27 01:15:22 2013 Koichi Sasada <ko1@atdot.net>
- * proc.c (mnew_missing): ditto.
+ * hash.c (rb_hash_tbl_raw), internal.h: added.
+ Returns st_table without shading hash.
- * vm_eval.c: ditto.
+ * array.c: use rb_hash_tbl_raw() for read-only purpose.
+
+ * compile.c (iseq_compile_each): ditto.
+
+ * gc.c (count_objects): ditto.
+
+ * insns.def: ditto.
+
+ * process.c: ditto.
+
+ * thread.c (clear_coverage): ditto.
* vm_insnhelper.c: ditto.
- * vm_method.c: ditto.
+Mon May 27 00:31:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Jun 6 15:59:38 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/make-snapshot: use ENV["AUTOCONF"] instead of directly using
+ literal "autoconf".
- * class.c: ins_methods_push() needs rb_method_visibility_t type on
- 2nd arg.
+Sun May 26 21:31:46 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jun 6 15:05:47 2015 Koichi Sasada <ko1@atdot.net>
+ * hash.c, include/ruby/ruby.h: support WB protected hash.
+ * constify RHash::ifnone and make new macro RHASH_SET_IFNONE().
+ * insert write barrier for st_update().
- * class.c (ins_methods_push): Change type and name of parameters
- to make more clear.
+ * include/ruby/intern.h: declare rb_hash_set_ifnone(hash, ifnone).
-Sat Jun 6 08:52:13 2015 Eric Wong <e@80x24.org>
+ * marshal.c (r_object0): use RHASH_SET_IFNONE().
- * test/socket/test_nonblock.rb: try to avoid EMSGSIZE
- [ruby-core:69466]
+ * ext/openssl/ossl_x509name.c (Init_ossl_x509name): ditto.
-Sat Jun 6 07:58:30 2015 Koichi Sasada <ko1@atdot.net>
+Sat May 25 23:22:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * gc.c: remove struct mark_tbl_arg and pass objspace directly
- to avoid indirect access overhead.
+ * test/fiddle/test_c_struct_entry.rb,
+ test/fiddle/test_c_union_entity.rb,
+ test/fiddle/test_cparser.rb, test/fiddle/test_func.rb,
+ test/fiddle/test_handle.rb, test/fiddle/test_import.rb,
+ test/fiddle/test_pointer.rb: don't run test if the system
+ don't support fiddle.
-Sat Jun 6 07:08:45 2015 Eric Wong <e@80x24.org>
+Sat May 25 21:29:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/socket/ancdata.c (bsock_sendmsg_internal): drop redundant assignment
+ * ext/pty/pty.c (get_device_once): FreeBSD 10-current and 9-stable
+ added O_CLOEXEC support to posix_openpt, so assume FreeBSD 9.2 or
+ later supports it.
+ http://www.freebsd.org/cgi/query-pr.cgi?pr=162374
-Sat Jun 6 01:00:06 2015 Naohisa Goto <ngotogenome@gmail.com>
+Sat May 25 18:46:23 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * ext/socket/ancdata.c (bsock_sendmsg_internal): all arguments are
- parsed even on systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL
- to prevent SEGV caused by passing Qnil to RARRAY_LENINT and
- to preserve behavior before r50776.
- [Bug #11224] [ruby-core:69468] [Bug #11225] [ruby-core:69469]
+ * proc.c (rb_method_entry_min_max_arity): fix missing break in switch.
+ This was introduced in r38236, which is not intentional apparently.
+ This has caused no actual harm because VM_METHOD_TYPE_OPTIMIZED is
+ not used except for OPTIMIZED_METHOD_TYPE_SEND, but may do in
+ future. Coverity Scan found this inadequacy.
-Fri Jun 5 22:37:42 2015 Koichi Sasada <ko1@atdot.net>
+Sat May 25 18:08:06 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * class.c (ins_methods_push): change 3rd parameter's type
- from long to rb_method_visibility_t.
+ * dir.c (bracket): fix copy-paste error. When the first and last
+ characters of fnmatch range have different length, fnmatch may
+ have wrongly matched a path that does not really match.
+ Coverity Scan found this bug.
- * class.c (ins_methods_i): catch up this fix.
+Sat May 25 17:06:25 2013 Koichi Sasada <ko1@atdot.net>
- * class.c (method_entry_i): cast to st_data_t instead of `long'.
+ * gc.c (after_gc_sweep): reduce full GC timing.
-Fri Jun 5 20:37:10 2015 Koichi Sasada <ko1@atdot.net>
+Sat May 25 11:28:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * internal.h: move definition of rb_cref_t to method.h.
+ * variable.c (set_const_visibility): return without clearing method
+ cache if no arguments.
- * eval_intern.h: move definition of rb_scope_visibility_t
- to method.h.
+ * vm_method.c (set_method_visibility): ditto.
- * method.h: change rb_cref_t::scope_visi from VALUE to
- rb_scope_visibility_t.
- [Bug #11219]
+Sat May 25 11:27:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (vm_cref_new): accept rb_method_visibility_t directly.
+ * vm_method.c (set_method_visibility): quote unprintable method name.
- * vm_insnhelper.c (rb_vm_rewrite_cref): don't use 0,
- but METHOD_VISI_UNDEF.
+Sat May 25 11:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c (rb_scope_visibility_set): don't need to use cast.
+ * eval.c (rb_frame_callee): returns the called name of the current
+ frame, not the previous frame.
- * vm_method.c (rb_scope_module_func_set): ditto.
+ * eval.c (prev_frame_callee, prev_frame_func): rename and make static,
+ as these are used by rb_f_method_name() and rb_f_callee_name() only.
-Fri Jun 5 17:27:30 2015 Eric Wong <e@80x24.org>
+ * variable.c (set_const_visibility): use the called name.
- * ext/socket/ancdata.c (bsock_sendmsg_internal): avoid msg_control
- ptr if msg_controllen is zero to fix portability problems.
+Sat May 25 08:58:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jun 5 09:17:45 2015 Eric Wong <e@80x24.org>
+ * string.c (rb_str_quote_unprintable): check if argument is a string.
- * ext/socket/ancdata.c (bsock_sendmsg_internal): fix build error
- from r50776
+Fri May 24 19:32:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-Fri Jun 5 07:05:58 2015 Eric Wong <e@80x24.org>
+ * variable.c (set_const_visibility): use rb_frame_this_func() instead
+ of rb_frame_callee() for getting the name of the called method
- * io.c (sym_wait_readable, sym_wait_writable): declare
- (io_getpartial): use sym_wait_readable
- (io_write_nonblock): use sym_wait_writable
- (Init_IO): initialize sym_wait_*able
+ * test/ruby/test_module.rb: add test for private_constant with no args
-Fri Jun 5 06:43:00 2015 Eric Wong <e@80x24.org>
+Fri May 24 18:53:10 2013 Koichi Sasada <ko1@atdot.net>
- * doc/extension.rdoc: note rb_get_kwargs changes keywords_hash
- [ruby-core:68507]
+ * gc.c: do major/full GC when:
+ * number of oldgen object is bigger than twice of
+ number of oldgen object at last full GC.
+ * number of remembered shady object is bigger than twice of
+ number of remembered shady object at last full GC.
+ * number of oldgen object and remembered shady object is bigger
+ than half of total object space.
+ (please fix my English!)
-Fri Jun 5 05:50:29 2015 Eric Wong <e@80x24.org>
+Fri May 24 17:07:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/socket/ancdata.c (bsock_sendmsg_internal): use rb_scan_args
- [ruby-core:69439] [Feature #11207]
+ * intern.h: remove dangling rb_class_init_copy declaration
+ [ruby-core:55120] [Bug #8434]
-Fri Jun 5 02:20:06 2015 Koichi Sasada <ko1@atdot.net>
+Fri May 24 16:31:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/lib/envutil.rb (assert_no_memory_leak): change default value
- of limit from 1.5 to 2.0. It is ad-hoc fix to solve test failure
- in travis-ci.
+ * ext/strscan/strscan.c (strscan_aref): raise error if given
+ name reference is not found.
-Fri Jun 5 01:17:21 2015 Koichi Sasada <ko1@atdot.net>
+Fri May 24 15:48:18 2013 Koichi Sasada <ko1@atdot.net>
- * vm_insnhelper.c (vm_defined): no need to use cast.
+ * gc.c (after_gc_sweep, garbage_collect_body): do major GC (full GC)
+ before extending heaps.
+ TODO: do major GC when there are many old (promoted) objects.
-Fri Jun 5 01:14:02 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (after_gc_sweep): remove TODO comments.
- * vm_insnhelper.c (vm_defined): show additional messages on rb_bug().
+Fri May 24 11:04:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jun 5 01:06:02 2015 Koichi Sasada <ko1@atdot.net>
+ * configure.in (LIBRUBY_RPATHFLAGS): do not append -L option with
+ runtime library directory if cross compiling, but only -R option.
+ runtime path makes no sense on the host system. [ruby-dev:47363]
+ [Bug #8443]
- * vm_method.c (rb_add_method_iseq): use intermediate struct to
- avoid initializing struct with variables.
- [Bug #11217]
+Fri May 24 02:57:17 2013 Koichi Sasada <ko1@atdot.net>
- * method.h: add a comment about it.
+ * object.c (rb_obj_clone): should not propagate OLDGEN status.
+ This propagation had caused WB miss for class.
-Fri Jun 5 00:55:21 2015 Koichi Sasada <ko1@atdot.net>
+Thu May 23 17:35:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * method.h: constify rb_method_refined_t::orig_me.
+ * load.c (loaded_feature_path): fix invalid read by index underflow.
+ the beginning of name is also a boundary as well as just after '/'.
- Also constify the following functions.
+Thu May 23 17:21:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * rb_resolve_refined_method()
- * rb_method_entry_with_refinements()
- * rb_method_entry_without_refinements()
- * rb_method_entry_copy()'s parameter.
+ * gc.c (gc_profile_dump_on): revert r40898. ok to show the record
+ accumulating while lazy_sweep().
- * class.c: catch up this fix.
+Wed May 22 16:50:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c: ditto.
+ * gc.c (gc_profile_dump_on): use size_t to get rid of overflow and
+ show the header when next_index > 0, instead of next_index != 1.
- * vm_method.c: ditto.
+Wed May 22 15:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 4 12:47:54 SGT 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * win32/win32.c (setup_overlapped): check the error code in addition
+ to the result of SetFilePointer() to determine if an error occurred,
+ because INVALID_SET_FILE_POINTER is a valid value.
+ [ruby-core:55098] [Bug #8431]
- * array.c: Revert r50763. because "reentered" is not typo.
+ * win32/win32.c (setup_overlapped, finish_overlapped): extract from
+ rb_w32_read() and rb_w32_write().
-Thu Jun 4 11:12:29 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Wed May 22 14:19:56 2013 Koichi Sasada <ko1@atdot.net>
- * ext/win32ole/win32ole.c: fix a typo. Patch by @davydovanton
- [fix GH-923]
- * include/ruby/st.h: ditto.
- * include/ruby/util.h: ditto.
+ * gc.c (gc_prepare_free_objects, rest_sweep, lazy_sweep): fix position
+ of `during_gc' setting.
-Thu Jun 4 10:54:30 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Wed May 22 07:36:08 2013 Koichi Sasada <ko1@atdot.net>
- * array.c: fix a typo. Patch by @manish-shrivastava
- [fix GH-922]
+ * gc.c (garbage_collect): all GC is start from garbage_collect()
+ (or garbage_collect_body()). `garbage_collect()' accept additional
+ two parameters `full_mark' and `immediate_sweep'.
+ If `full_mark' is TRUE, then force it full gc (major gc), otherwise,
+ it depends on status of object space. Now, it will be minor gc.
+ If `immediate_sweep' is TRUE, then disable lazy sweep.
+ To allocate free memory, `full_mark' and `immediate_sweep' should be
+ TRUE. Otherwise, they should be FALSE.
-Thu Jun 4 09:52:02 2015 Eric Wong <e@80x24.org>
+ * gc.c (gc_prepare_free_objects): use `garbage_collect_body()'.
- * ext/openssl/lib/openssl/ssl.rb: use io/nonblock instead of fcntl
- [ruby-core:69382] [Feature #11190]
+ * gc.c (slot_sweep, before_gc_sweep, after_gc_sweep): add logging code.
-Thu Jun 4 07:22:45 2015 Koichi Sasada <ko1@atdot.net>
+Tue May 21 22:47:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * method.h: introduce rb_method_refined_t for refined method entry.
+ * ext/strscan/strscan.c (strscan_aref): support named captures.
+ patched by Konstantin Haase [ruby-core:54664] [Feature #8343]
- * class.c (move_refined_method): catch up this fix.
+Tue May 21 21:48:44 2013 Kouhei Sutou <kou@cozmixng.org>
- * gc.c (mark_method_entry): ditto.
+ * test/ruby/test_dir_m17n.rb (TestDir_M17N#test_entries_compose):
+ Use #each instead of #map just for iteration.
- * vm_eval.c (vm_call0_body): ditto.
+Tue May 21 19:57:22 2013 Akinori MUSHA <knu@iDaemons.org>
- * vm_insnhelper.c (vm_call_method): ditto.
+ * ext/digest/lib/digest.rb (Digest::Class.file): Take optional
+ arguments that are passed to the constructor of the digest
+ class.
- * vm_method.c: ditto.
+Tue May 21 17:21:12 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 4 07:12:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: remove gc_profile_record::is_marked. always true.
- * dir.c (dirent_match): match short names only when FNM_SHORTNAME
- flag is given, for the backward compatibility, and the new
- behavior is often dangerous. [ruby-core:69435] [Bug #11206]
+Tue May 21 17:13:40 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 4 05:44:01 2015 Eric Wong <e@80x24.org>
+ * gc.c: fix to collect additional information for GC::Profiler.
+ * major/minor GC
+ * trigger reason of GC
- * variable.c (special_generic_ivar): remove flag
- (givar_i, rb_mark_generic_ivar_tbl): remove functions
- (rb_free_generic_ivar, rb_ivar_lookup, rb_ivar_delete,
- generic_ivar_set, rb_ivar_set, rb_ivar_defined,
- rb_copy_generic_ivar, rb_ivar_foreach, rb_ivar_count,
- rb_obj_remove_instance_variable):
- adjust for lack of ivar support in special constants
- * test/ruby/test_variable.rb: test ivars for special consts
- * internal.h: remove rb_mark_generic_ivar_tbl decl
- * gc.c (gc_mark_roots): remove rb_mark_generic_ivar_tbl call
- [ruby-core:69441] [Feature #11208]
+ * gc.c (gc_profile_dump_on): change reporting format with
+ added information.
-Thu Jun 4 05:13:34 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_profile_record_get): return added information by
+ :GC_FLAGS => array.
- * vm_insnhelper.c (def_iseq_ptr): `iseqval' is not available any more.
+Tue May 21 16:45:31 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 4 04:50:12 2015 Koichi Sasada <ko1@atdot.net>
+ * gc.c: GC::Profiler's sweeping time is accumulated all slot
+ sweeping time. At lazy GC, GC::Profiler makes new record entry
+ for each lazy_sweep(). In this change, accumulating all
+ slot_sweep() time.
+ And change indentation.
- * class.c (method_entry_i): mtbl should not have `me' as NULL.
+Tue May 21 16:29:09 2013 Koichi Sasada <ko1@atdot.net>
-Thu Jun 4 04:28:45 2015 Koichi Sasada <ko1@atdot.net>
+ * common.mk (rdoc-bench): add a benchmark rule
+ using RDoc. Generate all rdoc related files
+ (same as `make rdoc') in temporary directory
+ and remove them. Execution time, GC::Profiler
+ and results of GC.stat are printed.
- * class.c (clone_method): do not use me->klass, but use explicitly
- passed argument.
+ * tool/rdocbench.rb: added for `rdoc-bench'.
-Thu Jun 4 04:10:43 2015 Koichi Sasada <ko1@atdot.net>
+Tue May 21 16:25:05 2013 Koichi Sasada <ko1@atdot.net>
- * vm_core.h (rb_vm_rewrite_cref_stack): rename to rb_vm_rewrite_cref().
+ * gc.c (gc_profile_dump_on): `count' should be (int) because it
+ can be negative number.
+ And use pointer for `record' (don't copy).
- * class.c (clone_method): use renamed name.
+Tue May 21 03:11:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c (rb_vm_rewrite_cref): do not use `node' in variable
- names.
+ * dir.c (dir_each): compose HFS file names from
+ UTF8-MAC. [ruby-core:48745] [Bug #7267]
-Wed Jun 3 23:03:50 2015 Koichi Sasada <ko1@atdot.net>
+Tue May 21 03:08:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c: rename `rb_frame_...' to `rb_scope_...'.
+ * test/ruby/envutil.rb (assert_separately): require envutil in the
+ child process too.
- * eval_intern.h: move decl. of rb_scope_visibility_set() to method.h.
+Tue May 21 03:07:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * load.c: catch up this fix.
+ * string.c (rb_str_conv_enc_opts): should infect.
-Wed Jun 3 21:14:20 2015 Tanaka Akira <akr@fsij.org>
+Mon May 20 22:24:45 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/rbconfig/sizeof/extconf.rb: Check C99 standard integer types.
+ * lib/set.rb (Set#delete_if, Set#keep_if): Avoid blockless call of
+ proc, which is not portable to JRuby. Replace &method() with
+ faster and simpler literal blocks while at it.
-Wed Jun 3 21:00:47 2015 Tanaka Akira <akr@fsij.org>
+Mon May 20 22:00:31 2013 Zachary Scott <zachary@zacharyscott.net>
- * configure.in: Don't check __int128.
+ * lib/e2mmap.rb: Format of E2MM documentation
- * ext/rbconfig/sizeof/extconf.rb: Check __int128.
+Mon May 20 21:41:15 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/rbconfig/sizeof/depend: sizes.c depends on
- ext/rbconfig/sizeof/extconf.rb.
+ * ext/extmk.rb: nodoc this file
- * template/sizes.c.tmpl: Detect check_sizeof.
+Mon May 20 20:43:32 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Jun 3 20:07:07 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/cmath.rb: Remove duplicate RDoc heading from overview
- * class.c (clone_method): remove redundant check for me->def != NULL.
- Now, all `me` have `me->def`.
+Mon May 20 20:36:19 2013 Zachary Scott <zachary@zacharyscott.net>
- * proc.c (rb_method_entry_location): ditto.
+ * lib/securerandom.rb: Update position of overview for RDoc
- * vm.c (rb_vm_check_redefinition_opt_method): ditto.
+Mon May 20 19:33:55 2013 Benoit Daloze <eregontp@gmail.com>
- * vm.c (add_opt_method): ditto.
+ * math.c: improve and fix documentation of sin, tan and log
- * vm_eval.c (vm_call0_body): ditto.
+Mon May 20 19:31:49 2013 Benoit Daloze <eregontp@gmail.com>
-Wed Jun 3 19:24:12 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/logger.rb (Logger::Application): show namespace in documentation
- * vm_core.h: rename enum missing_reason to enum method_missing_reason.
+Mon May 20 11:50:12 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_core.h: use enum method_missing_reason for
- rb_thread_t::method_missing_reason.
+ * lib/pp.rb: Revert part of r40834 and nodoc PP::ObjectMixin
+ [ruby-core:55068]
- * vm_eval.c: catch up this fix.
+Mon May 20 10:40:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c: ditto.
+ * lib/webrick/htmlutils.rb (WEBrick::HTMLUtils#escape): replace HTML
+ meta chars even in non-ascii string. [Bug #8425] [ruby-core:55052]
-Wed Jun 3 16:17:21 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils#{_escape,_unescape}):
+ fix %-escape encodings. [Bug #8425] [ruby-core:55052]
- * vm.c: eagerly allocate `loading_table`. This eliminates the need to
- do NULL checks when looking up the `loading_table` hash.
- https://github.com/ruby/ruby/pull/918
+ * lib/webrick/httpservlet/filehandler.rb (set_dir_list): revert r20152
+ partially and fix misuse of bytesize and regexp repetition operator.
- * load.c: remove various NULL checks
+Mon May 20 08:03:51 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Jun 3 11:47:15 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/profiler.rb: Document Profiler__ methods
- * method.h: change fields order to gather frequent access fields.
+Mon May 20 08:02:13 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_insnhelper.c (vm_call_method): add LIKELY().
+ * lib/tempfile.rb: nodoc Tempfile#inspect
-Wed Jun 03 10:35:45 2015 Koichi Sasada <ko1@atdot.net>
+Mon May 20 07:48:24 2013 Zachary Scott <zachary@zacharyscott.net>
- * method.h: split rb_method_definition_t::flag to several flags.
+ * ext/stringio/stringio.c: Correct position of method rdoc
- `flag' contains several categories of attributes and it makes us
- confusion (at least, I had confused).
+Mon May 20 07:27:41 2013 Zachary Scott <zachary@zacharyscott.net>
- * rb_method_visibility_t (flags::visi)
- * NOEX_UNDEF -> METHOD_VISI_UNDEF = 0
- * NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1
- * NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2
- * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3
- * NOEX_SAFE(flag) -> safe (flags::safe, 3 bits)
- * NOEX_BASIC -> basic (flags::basic, 1 bit)
- * NOEX_MODFUNC -> rb_scope_visibility_t in CREF
- * NOEX_SUPER -> MISSING_SUPER (enum missing_reason)
- * NOEX_VCALL -> MISSING_VCALL (enum missing_reason)
- * NOEX_RESPONDS -> BOUND_RESPONDS (macro)
+ * math.c: RDoc formatting of Math core docs with domains and codomains
+ Patch by @eLobato [Fixes GH-309]
- Now, NOEX_NOREDEF is not supported (I'm not sure it is needed).
+Mon May 20 05:58:12 2013 Zachary Scott <zachary@zacharyscott.net>
- Background:
- I did not know what "NOEX" stands for.
- I asked Matz (who made this name) and his answer was "Nothing".
- "At first, it meant NO EXport (private), but the original
- meaning was gone."
- This is why I remove the mysterious word "NOEX" from MRI.
+ * ext/bigdecimal/bigdecimal.c: Formatting for BigMath [Fixes GH-306]
+ Based on a patch by @eLobato.
+ * ext/bigdecimal/lib/bigdecimal/math.rb: ditto
- * vm_core.h: introduce `enum missing_reason' to represent
- method_missing (NoMethodError) reason.
+Mon May 20 04:56:59 2013 Zachary Scott <zachary@zacharyscott.net>
- * eval_intern.h: introduce rb_scope_visibility_t to represent
- scope visibility.
- It has 3 method visibilities (public/private/protected)
- and `module_function`.
+ * lib/forwardable.rb: Forwardable examples in overview were broken
+ Based on patch by @joem [Fixes GH-303] [Bug #8392]
-Wed Jun 3 08:06:30 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon May 20 03:35:26 2013 Zachary Scott <zachary@zacharyscott.net>
- * gem/bundled_gems: updated to test-unit 3.1.1 and minitest 5.7.0.
+ * lib/optparse.rb: nodoc OptionParser::Version and SPLAT_PROC
-Wed Jun 3 04:48:05 2015 Koichi Sasada <ko1@atdot.net>
+Mon May 20 03:16:52 2013 Zachary Scott <zachary@zacharyscott.net>
- * vm_insnhelper.c (vm_defined): check respond_to_missing?
- at defined?(func()).
- [Bug #11212]
+ * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
- * test/ruby/test_defined.rb: add a test for this fix.
+Sun May 19 23:52:22 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Wed Jun 3 04:34:39 2015 Koichi Sasada <ko1@atdot.net>
+ * test/webrick/test_htmlutils.rb: add test for WEBrick::HTMLUtils.
- * vm_insnhelper.c (vm_defined): skip respond_to_missing? when
- a method is available.
- [Bug #11211]
+Sun May 19 23:12:07 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * test/ruby/test_defined.rb: add a test for this fix.
+ * encoding.c: document fix, change default script encoding.
+ patched by @windwiny [Fixes GH-310]
-Wed Jun 3 04:14:13 2015 Koichi Sasada <ko1@atdot.net>
+Sun May 19 17:29:07 2013 Akinori MUSHA <knu@iDaemons.org>
- * insns.def (defined), vm_insnhelper.c (vm_defined):
- move instruction body to the vm_defined() function.
+ * lib/set.rb (Set#delete_if, Set#keep_if): Add comments.
-Wed Jun 3 02:29:25 2015 Benoit Daloze <eregontp@gmail.com>
+Sun May 19 11:37:36 2013 Kazuki Tsujimoto <kazuki@callcc.net>
- * test/ruby/test_module.rb: Do not assume class variable order.
- Patch by @enebo.
+ * ext/fiddle/extconf.rb: ignore rc version of libffi to fix build failure.
-Wed Jun 3 01:10:38 2015 Yusuke Endoh <mame@tsg.ne.jp>
+Sun May 19 10:38:50 2013 Akinori MUSHA <knu@iDaemons.org>
- * vm_method.c (rb_method_definition_set): remove a double assignment.
- Coverity Scan found this bug.
+ * misc/ruby-electric.el (ruby-electric-delete-backward-char): Use
+ delete-char instead of delete-backward-char, which is an
+ interactive function.
-Wed Jun 3 00:04:51 2015 Koichi Sasada <ko1@atdot.net>
+Sun May 19 03:59:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_method.c (rb_alias): rename parameter names.
+ * string.c (str_scrub0): added for refactoring.
-Tue Jun 2 23:27:18 2015 Koichi Sasada <ko1@atdot.net>
+Sun May 19 03:48:26 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * method.h: remove rb_method_iseq_t::iseqval.
- While making a r50728, iseqval is needed (to mark correctly),
- but now just iseqptr is enough.
+ * lib/uri/common.rb (URI.decode_www_form): scrub string if decoded
+ bytes are invalid for the encoding.
- * class.c: catch up this fix.
+Sun May 19 02:46:32 2013 Akinori MUSHA <knu@iDaemons.org>
- * gc.c: ditto.
+ * lib/set.rb (Set#delete_if, Set#keep_if): Make Set#delete_if and
+ Set#keep_if more space and time efficient by avoiding to_a.
- * proc.c: ditto.
+Sun May 19 02:33:09 2013 Akinori MUSHA <knu@iDaemons.org>
- * vm_method.c: ditto.
+ * misc/ruby-electric.el (ruby-electric-setup-keymap): Make
+ backquotes electric as well. It was listed in
+ ruby-electric-expand-delimiters-list but not activated.
-Tue Jun 2 21:29:28 2015 Koichi Sasada <ko1@atdot.net>
+ * misc/ruby-electric.el (ruby-electric-delete-backward-char):
+ Introduce electric DEL that deletes what the previous electric
+ command has input.
- * proc.c (proc_curry): remove a debug line.
+ * misc/ruby-electric.el (ruby-electric-matching-char): Make
+ electric quotes work again at the end of buffer.
-Tue Jun 2 12:43:46 2015 Koichi Sasada <ko1@atdot.net>
+Sun May 19 01:39:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * method.h: make rb_method_entry_t a VALUE.
- Motivation and new data structure are described in [Bug #11203].
+ * configure.in (setjmp-type): check if setjmpex() is really available.
+ workaround for i686-w64-mingw32 which declares it but lacks its
+ definition.
- This patch also solve the following issues.
+ * include/ruby/defines.h: include setjmpex.h only if also setjmpex()
+ is available.
- * [Bug #11200] Memory leak of method entries
- * [Bug #11046] __callee__ returns incorrect method name in orphan
- proc
+Sat May 18 23:57:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_method.rb: add a test for [Bug #11046].
+ * configure.in (setjmp-type): use setjmpex() on w64-mingw32 to get rid
+ of -Wclobbered warnings.
- * vm_core.h: remove rb_control_frame_t::me. me is located at value
- stack.
+ * include/ruby/defines.h: include setjmpex.h here becase setjmp.h is
+ included from win32.h via intrin.h, winnt.h, and so on.
- * vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes
- because method entries are simple VALUEs.
+Sat May 18 20:28:12 2013 Tanaka Akira <akr@fsij.org>
- * method.h: Now, all method entries has own independent method
- definitions. Strictly speaking, this change is not essential,
- but for future changes.
+ * ext/socket/mkconstants.rb (INTEGER2NUM): Make less comparisons.
- * rb_method_entry_t::flag is move to rb_method_definition_t::flag.
- * rb_method_definition_t::alias_count is now
- rb_method_definition_t::alias_count_ptr, a pointer to the counter.
+Sat May 18 20:15:28 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to
- search the current method entry from value stack.
+ * string.c (str_scrub_bang): add String#scrub!. [Feature #8414]
- * vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable
- assertions.
+Sat May 18 16:59:52 2013 Tanaka Akira <akr@fsij.org>
-Tue Jun 2 10:46:36 2015 Eric Wong <e@80x24.org>
+ * ext/socket/mkconstants.rb (INTEGER2NUM): Renamed from INTEGER2VALUE.
- * test/socket/test_nonblock.rb: new test for sendmsg_nonblock
+Sat May 18 16:57:58 2013 Tanaka Akira <akr@fsij.org>
-Tue Jun 2 09:04:14 2015 Eric Wong <e@80x24.org>
+ * ext/socket/mkconstants.rb (INTEGER2VALUE): Suppress a warning:
+ comparison between signed and unsigned integer expressions
- * lib/benchmark.rb: just use Process::CLOCK_MONOTONIC
- [ruby-core:69390]
+Sat May 18 16:38:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 1 22:01:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (iseq_compile_each): forward anonymous and first keyword
+ rest argument one. [ruby-core:55033] [Bug #8416].
- * lib/mkmf.rb (pkg_config): split --libs if --libs-only-l option
- is not available. patch in [ruby-core:69428] by Hans Mackowiak.
- [ruby-core:69421] [Bug #11201]
+Sat May 18 15:49:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 1 21:18:24 2015 Koichi Sasada <ko1@atdot.net>
+ * vm_core.h (rb_vm_tag): move jmpbuf between tag and prev so ensure to
+ be accessible.
- * gc.c (gc_mark_children): remove a garbage character
- introduced at the last commit.
+Sat May 18 11:05:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 1 19:24:42 2015 Koichi Sasada <ko1@atdot.net>
+ * enumerator.c (inspect_enumerator): use VALUE instead of mere char*
+ by using rb_sprintf() and rb_id2str().
- * vm_method.c (rb_method_entry_make): do not show warning message
- when method_entry is an alias.
+ * enumerator.c (append_method): extract from inspect_enumerator().
-Mon Jun 1 15:47:16 2015 Koichi Sasada <ko1@atdot.net>
+Sat May 18 09:00:32 2013 Tanaka Akira <akr@fsij.org>
- * internal.h: move class related definitions.
+ * ext/socket/mkconstants.rb (INTEGER2VALUE): Use LONG2FIX if possible.
-Mon Jun 1 15:43:03 2015 Koichi Sasada <ko1@atdot.net>
+Sat May 18 00:38:47 2013 Tanaka Akira <akr@fsij.org>
- * class.c: remove needless include pragma for method.h.
+ * ext/socket/mkconstants.rb: Convert integer constants bigger than int
+ correctly.
- * struct.c: ditto.
+Fri May 17 22:02:15 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c: ditto.
+ * ext/socket/ifaddr.c: Use unsigned LONG_LONG to represent flags
+ because SunOS 5.11 (OpenIndiana) defines ifa_flags as uint64_t.
-Mon Jun 1 05:42:00 2015 Koichi Sasada <ko1@atdot.net>
+Fri May 17 21:47:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * eval_intern.h, vm_method.c: move macros to functions.
- * SCOPE_TEST(f) -> rb_frame_visibility_test(flag).
- * SCOPE_CHECK(f) -> rb_frame_visibility_check(flag).
- * SCOPE_SET(f) -> rb_frame_visibility_set(flag).
+ * cont.c: Typo in constant MAX_MACHINE_STACK_CACHE from '..MAHINE..'
+ patch by @schmurfy [Fixes GH-307]
- * load.c (load_ext): use it.
+Fri May 17 19:18:24 2013 Akinori MUSHA <knu@iDaemons.org>
-Mon Jun 1 04:47:37 2015 Zachary Scott <e@zzak.io>
+ * misc/ruby-electric.el (ruby-electric-matching-char): Do not put
+ a closing quote when the quote typed does not start a string, as
+ in $', ?\' or ?\".
- * ext/date/date_core.c: [DOC] Add comparison of Time and DateTime
- Patch provided by @pixeltrix
+Fri May 17 18:06:15 2013 Tanaka Akira <akr@fsij.org>
-Mon Jun 1 04:22:09 2015 Koichi Sasada <ko1@atdot.net>
+ * configure.in: Consider error messages to find out version option of
+ C compiler.
+ The C compiler of Sun Studio C emits "Warning: Option -qversion
+ passed to ld, if ld is invoked, ignored otherwise" and exit
+ successfully.
- * vm_core.h (VM_FRAME_MAGIC_DUMMY): introduce new frame type to
- recognize dummy frame.
+Fri May 17 17:34:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (th_init): use new frame type.
+ * gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and
+ msvc.
- * vm_args.c (raise_argument_error): ditto.
+Fri May 17 11:06:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 1 04:15:42 2015 Koichi Sasada <ko1@atdot.net>
+ * eval_intern.h (TH_PUSH_TAG): ensure jmpbuf to be accessible before
+ pushing tag to get rid of unaccessible tag by stack overflow.
- * class.c (rb_class_has_methods): added to reduce dependency
- to internal class data structure.
+Thu May 16 17:15:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * internal.h: ditto.
+ * vm_eval.c (rb_catch_obj): add volatile to tag to prevent crash
+ experimentally.
+ http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20130515T133500Z.log.html.gz
- * hash.c (has_extra_methods): use added function.
+Thu May 16 16:19:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 1 04:11:48 2015 Koichi Sasada <ko1@atdot.net>
+ * win32/Makefile.sub (verconf.in): no longer used.
- * gc.c , gc.h (rb_obj_info): export obj_info(VALUE) for debugging.
+ * win32/Makefile.sub (config.status): fix typo.
-Mon Jun 1 03:52:55 2015 Koichi Sasada <ko1@atdot.net>
+ * configure.in, template/verconf.h.in (RUBY_EXEC_PREFIX): fix for
+ default prefix.
- * test/ruby/test_gc.rb: increase timeout seconds for GC stressful
- debugging.
+Thu May 16 13:12:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 31 04:18:06 2015 Koichi Sasada <ko1@atdot.net>
+ * template/verconf.h.in: generate verconf.h from the template and
+ rbconfig.rb.
- * method.h: fix typo of comments.
+Thu May 16 05:47:18 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-Sun May 31 03:36:42 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: fix syntax error.
+ Thanks @spastorino! [ruby-core:55011]
- * method.h: add VM_METHOD_TYPE_ALIAS rb_method_definition_t::type
- to fix [Bug #11173].
+Thu May 16 03:05:45 2013 Koichi Sasada <ko1@atdot.net>
- Now, inter class/method alias creates new method entry
- VM_METHOD_TYPE_ALIAS, which has an original method entry.
+ * gc.c (rb_node_newnode): use newobj_of() instead of rb_newobj().
- * vm_insnhelper.c (find_defined_class_by_owner): added.
- Search corresponding defined_class from owner class/module.
+Thu May 16 02:03:39 2013 Tanaka Akira <akr@fsij.org>
- * vm_method.c (rb_method_entry_get_without_cache): return me->klass
- directly for defined_class.
+ * ext/socket/depend: Add a dependency for ifaddr.o.
- Now, no need to check me->klass any more.
+Thu May 16 01:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c (method_entry_set0): separated from method_entry_set().
+ * common.mk (verconf.h): $< cannot be used in explicit rules with
+ nmake.
- * vm_method.c (rb_alias): make method entry has VM_METHOD_TYPE_ALIAS.
+ * win32/Makefile.sub (CONFIG_H): create verconf.in instead of
+ verconf.h.
- * vm_method.c (release_method_definition): support VM_METHOD_TYPE_ALIAS.
+Thu May 16 01:25:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * vm_method.c (rb_hash_method_definition): ditto.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: only emit warnings when
+ -w is enabled.
- * vm_method.c (rb_method_definition_eq): ditto.
+Wed May 15 18:58:17 2013 Koichi Sasada <ko1@atdot.net>
- * vm_method.c (release_method_definition): ditto.
+ * gc.c (newobj): rename to `newobj_of' and accept additional
+ three parameters v1, v2, v3. newobj_of() do OBJSETUP() and
+ fill values with v1, v2, v3.
- * vm_insnhelper.c (vm_call_method): ditto.
+ * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
+ use newobj_of().
- * vm_insnhelper.c (vm_method_cfunc_entry): ditto.
+Wed May 15 17:55:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_eval.c (vm_call0_body): ditto.
+ * configure.in (RUBY_PLATFORM): move to config.h as needed by
+ version.c.
- * gc.c (mark_method_entry): ditto.
+Wed May 15 17:04:11 2013 Koichi Sasada <ko1@atdot.net>
- * proc.c (method_def_iseq): ditto.
+ * gc.c: add an additional RGENGC_PROFILE mode (2).
+ Profiling result can be check by GC.stat.
- * proc.c (method_cref): ditto.
+ * gc.c (type_name): separate from obj_type_name().
- * proc.c (rb_method_entry_min_max_arity): ditto.
+Wed May 15 16:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_alias.rb: add tests.
+ * configure.in: save configured load path values into verconf.in.
- * test/ruby/test_module.rb: fix a test to catch up current behavior.
+ * common.mk (verconf.h): create from verconf.in with shvar_to_cpp.rb.
-Sun May 31 03:34:25 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/shvar_to_cpp.rb: turn shell variables into C macros.
+ [Bug #7959]
- * vm_method.c (rb_unlink_method_entry): make it static.
+ * loadpath.c: split load path staffs from version.c.
-Sun May 31 03:26:58 2015 Koichi Sasada <ko1@atdot.net>
+ * dmyloadpath.c: miniruby has no builtin load paths, so verconf.h is
+ not needed.
- * method.h, vm_method.c (rb_free_method_entry): constify a parameter.
+Wed May 15 03:56:09 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * vm_core.h: remove useless declaration about rb_unlink_method_entry().
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: adding backwards
+ compatible YAMLTree.new method
-Sat May 30 18:05:02 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed May 15 02:22:16 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * lib/tempfile.rb (Remover#call): fixed wrong condition. introduced at
- r50682.
+ * ext/psych/lib/psych.rb: Adding Psych.safe_load for loading a user
+ defined, restricted subset of Ruby object types.
+ * ext/psych/lib/psych/class_loader.rb: A class loader for
+ encapsulating the logic for which objects are allowed to be
+ deserialized.
+ * ext/psych/lib/psych/deprecated.rb: Changes to use the class loader
+ * ext/psych/lib/psych/exception.rb: ditto
+ * ext/psych/lib/psych/json/stream.rb: ditto
+ * ext/psych/lib/psych/nodes/node.rb: ditto
+ * ext/psych/lib/psych/scalar_scanner.rb: ditto
+ * ext/psych/lib/psych/stream.rb: ditto
+ * ext/psych/lib/psych/streaming.rb: ditto
+ * ext/psych/lib/psych/visitors/json_tree.rb: ditto
+ * ext/psych/lib/psych/visitors/to_ruby.rb: ditto
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
+ * ext/psych/psych_to_ruby.c: ditto
+ * test/psych/helper.rb: ditto
+ * test/psych/test_safe_load.rb: tests for restricted subset.
+ * test/psych/test_scalar_scanner.rb: ditto
+ * test/psych/visitors/test_to_ruby.rb: ditto
+ * test/psych/visitors/test_yaml_tree.rb: ditto
-Sat May 30 16:12:35 2015 Eric Wong <e@80x24.org>
+Wed May 15 02:06:35 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/socket/ancdata.c: use RB_GC_GUARD instead of volatile
- [ruby-core:69419] [Feature #11198]
+ * test/psych/helper.rb: envutil is not available outside Ruby, so
+ port the functions from envutil to the test helper.
-Sat May 30 15:59:10 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/psych/test_deprecated.rb: ditto
- * lib/tempfile.rb (Tempfile#initialize): initialize @unlinked to fix
- test failures introduced at r50682. I hope that check the results of
- tests before committing, at least the tests about the changed feature.
+ * test/psych/test_encoding.rb: ditto
-Sat May 30 11:02:55 2015 Martin Englund <martin@englund.nu>
+Wed May 15 00:42:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * doc/dtrace_probes.rdoc: change lingering dtrace probe documentation
- from function- to method-
+ * signal.c: need to include unistd.h for write(2).
+ unistd.h is now included via ruby/defines.h, but should explicitly
+ include here. (suggested by kosaki)
-Sat May 30 10:26:09 2015 Masaki Matsushita <glass.saga@gmail.com>
+Tue May 14 23:43:05 2013 Tanaka Akira <akr@fsij.org>
- * lib/tempfile.rb: refactoring.
- * use warn instead of STDERR.print
- * remove @tmpname and use @tmpfile.path
- * introduce @unlinked flag
- * Remover takes only @tmpfile
- * mode will be modified just before file reopen
+ * ext/socket/.document: Add ifaddr.c.
-Sat May 30 09:02:51 2015 Eric Wong <e@80x24.org>
+Tue May 14 23:24:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/intern.h (rb_generic_ivar_table): deprecate
- * internal.h (rb_attr_delete): declare
- * marshal.c (has_ivars): use rb_ivar_foreach
- (w_ivar): ditto
- (w_object): update for new interface
- * time.c (time_mload): use rb_attr_delete
- * variable.c (generic_ivar_delete): implement
- (rb_ivar_delete): ditto
- (rb_attr_delete): ditto
- [ruby-core:69323] [Feature #11170]
+ * ext/socket/extconf.rb: check for if_nametoindex() for
+ i686-w64-mingw32, and check for declarations of if_indextoname() and
+ if_nametoindex().
-Sat May 30 09:14:28 2015 Scott Francis <scott.francis@shopify.com>
+ * ext/socket/ifaddr.c (ifaddr_ifindex): not-implement unless
+ if_nametoindex() is available.
- * cont.c (cont_free): check if ruby_current_thread is still valid.
- [Fix GH-914]
+ * ext/socket/rubysocket.h: declare if_indextoname() and
+ if_nametoindex() if available but not declared.
-Sat May 30 08:36:04 2015 Eric Wong <e@80x24.org>
+Tue May 14 19:58:17 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
- * variable.c (static int special_generic_ivar): move
- (rb_generic_ivar_table): rewrite for compatibility
- (gen_ivtbl_bytes): new function
- (generic_ivar_get): update to use ivar index
- (generic_ivar_update): ditto
- (generic_ivar_set): ditto
- (generic_ivar_defined): ditto
- (generic_ivar_remove): ditto
- (rb_mark_generic_ivar): ditto
- (givar_i): ditto
- (rb_free_generic_ivar): ditto
- (rb_mark_generic_ivar_tbl): ditto
- (rb_generic_ivar_memsize): ditto
- (rb_copy_generic_ivar): ditto
- (rb_ivar_set): ditto
- (rb_ivar_foreach): ditto
- (rb_ivar_count): ditto
- (givar_mark_i): remove
- (gen_ivtbl_mark): new function
- (gen_ivar_each): ditto
- (iv_index_tbl_extend): update for struct ivar_update
- (iv_index_tbl_newsize): ditto
- [ruby-core:69323] [Feature #11170]
+ * ext/dl/lib/dl/func.rb (DL::Function#call): check tainted when
+ $SAFE > 0.
+ * ext/fiddle/function.c (function_call): check tainted when $SAFE > 0.
+ * test/fiddle/test_func.rb (module Fiddle): add test for above.
-Sat May 30 08:10:46 2015 Eric Wong <e@80x24.org>
- * variable.c (iv_index_tbl_make): extract from rb_ivar_set
- (iv_index_tbl_extend): ditto
- (iv_index_tbl_newsize): ditto
- (rb_ivar_set): use extracted functions
- [ruby-core:69323] (Part 1)
+Tue May 14 14:51:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 29 17:39:14 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/win32.h (INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX): split
+ from intptr_t and uintptr_t, since VC9 defines the latter only in
+ crtdefs.h.
- * tool/make_hgraph.rb: added.
+Tue May 14 12:21:28 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Fri May 29 14:39:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/win32.c (NET_LUID): mingw may have NET_LUID and not defined
+ _IFDEF_.
- * compile.c (iseq_compile_each): out of range NTH_REF is always
- nil.
+Tue May 14 03:33:17 2013 Koichi Sasada <ko1@atdot.net>
- * parse.y (parse_numvar): check overflow of NTH_REF and range.
- [ruby-core:69393] [Bug #11192]
+ * string.c (rb_str_new_frozen): remove debug print.
- * util.c (ruby_scan_digits): make public and add length parameter.
+Tue May 14 03:22:51 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 29 11:18:58 2015 Eric Wong <e@80x24.org>
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ arrays (T_ARRAY).
- * ext/socket/ancdata.c (bsock_sendmsg_internal,
- bsock_recvmsg_internal):
- avoid redundant fcntl on Linux
- [ruby-core:69154] [Feature #11145]
- * ext/socket/init.c (rsock_s_recvfrom_nonblock): ditto
- * ext/socket/rubysocket.h (MSG_DONTWAIT_RELIABLE): new macro
+Tue May 14 03:21:42 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 29 10:30:34 2015 Eric Wong <e@80x24.org>
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ strings (T_STRING).
- * lib/net/resolv.rb (request): use monotonic clock
- * lib/net/http.rb (begin_transport, end_transport): ditto
- [ruby-core:69384] [Feature #11124]
+Tue May 14 03:19:59 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 29 04:37:38 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ objects (T_OBJECT).
- * ext/objspace/objspace.c: add two methods to debug internals.
+Tue May 14 03:17:15 2013 Koichi Sasada <ko1@atdot.net>
- * ObjectSpace.internal_class_of: return RBASIC_CLASS(obj).
- * ObjectSpace.internal_super_of: return RCLASS_SUPER(cls).
+ * include/ruby/ruby.h: enable to generate write barrier protected
+ objects for numeric types (Float, Complex, Rational, Bignum).
- * NEWS: add information about both methods.
+Tue May 14 03:10:59 2013 Koichi Sasada <ko1@atdot.net>
- * test/objspace/test_objspace.rb: add tests for both methods.
+ * include/ruby/ruby.h: enable RGENGC (USE_RGENGC)
+ but no type creates write protected (sunny) objects
+ (RGENGC_WB_PROTECTED_* == 0).
-Thu May 28 06:55:53 2015 Anton Davydov <antondavydov.o@gmail.com>
+Tue May 14 02:47:30 2013 Koichi Sasada <ko1@atdot.net>
- * ext/tk/sample/figmemo_sample.rb (open_file),
- ext/tk/sample/tktextio.rb (TkTextIO): fix typo in messages.
- [Fix GH-916]
+ * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
+ See this ticket about RGENGC.
-Wed May 27 09:50:51 2015 Eric Wong <e@80x24.org>
+ * gc.c: Add several flags:
+ * RGENGC_DEBUG: if >0, then prints debug information.
+ * RGENGC_CHECK_MODE: if >0, add assertions.
+ * RGENGC_PROFILE: if >0, add profiling features.
+ check GC.stat and GC::Profiler.
- * ext/openssl/ossl_asn1.c (ossl_asn1_traverse, ossl_asn1_decode,
- ossl_asn1_decode_all): use RB_GC_GUARD instead of volatile
- [ruby-core:69371] [Bug #11185]
+ * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
-Wed May 27 09:27:30 2015 Eric Wong <e@80x24.org>
+ * array.c: add write barriers for T_ARRAY and generate sunny objects.
- * lib/drb/drb.rb (set_sockopt): remove redundant fcntl call
- * lib/drb/unix.rb (set_sockopt): ditto
- [ruby-core:69128] [Feature #11137]
+ * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
+ you want to access raw pointers. If you modify the contents which
+ pointer pointed, then you need to care write barrier.
-Tue May 26 22:10:43 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
- * vm_method.c (rb_alias): should resolve refined methods.
- [ruby-core:69360] [Bug #11182]
+ * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
+ and generate sunny objects.
-Tue May 26 21:35:13 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
+ barriers for T_RATIONAL and generate sunny objects.
- * include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): fix condition.
+ * internal.h: add write barriers for RBasic::klass.
-Mon May 25 22:35:58 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
- * tool/redmine-backporter.rb (rel): after the relations is changed,
- @changesets is no longer right.
+ * object.c (rb_class_allocate_instance), range.c:
+ generate sunny T_OBJECT objects.
-Mon May 25 11:27:14 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * string.c: add write barriers for T_STRING and generate sunny objects.
- * win32/win32.c (setup_overlapped): seek to the file end only when
- writing (mode:a), not reading (mode:a+, read).
+ * variable.c: add write barriers for ivars.
-Mon May 25 00:27:37 2015 Benoit Daloze <eregontp@gmail.com>
+ * vm_insnhelper.c (vm_setivar): ditto.
- * numeric.c (Numeric#negative?): [DOC] Fix call-seq.
- Patch by @yui-knk. [Fixes GH-908]
+ * include/ruby/ruby.h, debug.c: use two flags
+ FL_WB_PROTECTED and FL_OLDGEN.
-Sun May 24 01:35:22 2015 Koichi Sasada <ko1@atdot.net>
+ * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
+ move flag bits.
- * debug.c (ruby_debug_print_id): use rb_id2name() for fprintf().
+Tue May 14 01:54:48 2013 Koichi Sasada <ko1@atdot.net>
-Sat May 23 18:38:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: remove rb_objspace_t::marked_num.
+ We can use `objspace_live_num()' instead of removed `marked_num'
+ if it is after `after_gc_sweep()' function call.
- * man/*.1: updated dates in man pages.
- [ruby-dev:48988] [Bug #11171]
+ * gc.c (after_gc_sweep): use objspace_live_num() instead of removed
+ rb_objspace_t::marked_num.
-Sat May 23 03:10:58 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (gc_mark_ptr, gc_marks): remove rb_objspace_t::marked_num code.
- * win32/win32.c (rb_w32_write_console): should return the count of
- actually eaten characters, include escape sequences.
+ * gc.c (gc_prepare_free_objects): do not call set_heaps_increment()
+ with checking objspace->heap.marked_num. At this point, we only
+ need to check availability of free-cell.
-Fri May 22 22:36:14 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * gc.c (lazy_sweep): call after_gc_sweep() if there are no sweep_able entry.
- * lib/prime.rb: Remove obsolete Prime.new
- patch by Ajay Kumar. [Fixes GH-891]
+ * gc.c (rest_sweep, gc_prepare_free_objects): remove after_gc_sweep() call.
-Fri May 22 21:13:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 14 01:50:41 2013 Koichi Sasada <ko1@atdot.net>
- * include/ruby/intern.h (rb_sym_count): move `rb_sym_all_symbols`
- to a symbol.c specific section. a part of patch by Lourens
- Naude.
+ * gc.c: disable GC_PROFILE_MORE_DETAIL (fix last commit).
-Fri May 22 20:56:33 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (gc_prof_set_malloc_info): fix "objspace->heap.live_num" to
+ "objspace_live_num(objspace)". There is no such member variable.
- * complex.c (f_complex_polar): simple bug reproduced only when y is
- a float but x is not a float.
+Tue May 14 01:25:55 2013 Koichi Sasada <ko1@atdot.net>
-Fri May 22 19:42:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: refactoring GC::Profiler.
- * process.c (rb_spawn_process): do not discard global escape
- status. [ruby-core:69304] [Bug #11166]
+ * gc.c (gc_prof_sweep_timer_start/stop): removed because
+ they doesn't support lazy sweep.
- * process.c (rb_execarg_spawn): extract the start procedure in a
- parent process with ensuring the end procedure.
+ * gc.c (gc_prof_sweep_slot_timer_start/stop): added.
+ redefine `sweeping time' to accumulated time of all of
+ slot_sweep().
-Fri May 22 16:48:32 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * gc.c (rb_objspace_t::profile::count): renamed to
+ rb_objspace_t::profile::next_index. `counter' seems ambiguous.
+ increment it when next record is acquired.
- * NEWS: added news for net-telnet and rake
+Tue May 14 00:48:55 2013 Koichi Sasada <ko1@atdot.net>
-Thu May 21 20:27:07 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * include/ruby/ruby.h: constify RRational::(num,den) and
+ RComplex::(real,imag).
+ Add macro to set these values:
+ * RRATIONAL_SET_NUM()
+ * RRATIONAL_SET_DEN()
+ * RCOMPLEX_SET_REAL()
+ * RCOMPLEX_SET_IMAG()
+ This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
- * configure.in (RUBY_DTRACE_POSTPROCESS): cmp -b is GNU extension.
- darwin uses GNU cmp, and FreeBSD and Solaris are not.
- Note that accidentally equals to expected result.
+ TODO: API design. RRATIONAL_SET(rat,num,den) is enough?
+ TODO: Setting constify variable with cast has same issue of r40691.
-Thu May 21 18:00:19 2015 Koichi Sasada <ko1@atdot.net>
+ * complex.c, rational.c: use above macros.
- * iseq.c: constify.
+Mon May 13 21:49:17 2013 Tanaka Akira <akr@fsij.org>
- * iseq.h: ditto.
+ * ext/socket/extconf.rb: Check socketpair again.
+ It is required on Unix.
- * method.h: ditto.
+Mon May 13 21:20:32 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * proc.c: ditto.
+ * win32/win32.c (getipaddrs): use alternative interface name if
+ available, because if_nametoindex() requires them.
- * vm_method.c: ditto.
+Mon May 13 20:23:24 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu May 21 17:44:53 2015 Koichi Sasada <ko1@atdot.net>
+ * win32/win32.c, include/ruby/win32.h (getipaddrs): [experimental]
+ emulate getipaddrs(3) on Unix.
- * proc.c: fix issues caused by binding created from Method#to_proc.
- [Bug #11163]
+ * win32/Makefile.sub, configure.in (LIBS): need iphlpapi.lib for above
+ function.
- * vm.c (vm_cref_new_toplevel): export as rb_vm_cref_new_toplevel().
+ * include/ruby/win32.h (socketpair): rb_w32_socketpair() doesn't
+ substitute for any function, so use non-prefixed name.
- * test/ruby/test_method.rb: add some assertions.
+ * ext/socket/extconf.rb (socketpair); follow above change.
-Thu May 21 17:29:26 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon May 13 20:11:06 2013 Koichi Sasada <ko1@atdot.net>
- * lib/matrix.rb: added documentation for Matrix#empty and Matrix#/
- [Feature #10070][ruby-dev:48433] Patch by @gogotanaka
+ * iseq.c (prepare_iseq_build): remove additional line break.
-Thu May 21 17:02:43 2015 Koichi Sasada <ko1@atdot.net>
+Mon May 13 19:29:54 2013 Koichi Sasada <ko1@atdot.net>
- * proc.c: rename functions.
- * method_get_def() -> method_def()
- * method_get_iseq() -> method_def_iseq()
- * method_get_cref() -> method_cref()
+ * include/ruby/ruby.h: constify RBasic::klass and add
+ RBASIC_CLASS(obj) macro which returns a class of `obj'.
+ This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
-Thu May 21 16:52:44 2015 Koichi Sasada <ko1@atdot.net>
+ * object.c: add new function rb_obj_reveal().
+ This function reveal internal (hidden) object by rb_obj_hide().
+ Note that do not change class before and after hiding.
+ Only permitted example is:
+ klass = RBASIC_CLASS(obj);
+ rb_obj_hide(obj);
+ ....
+ rb_obj_reveal(obj, klass);
- * proc.c (rb_method_get_iseq): rename to rb_method_iseq.
+ TODO: API design. rb_obj_reveal() should be replaced with others.
- * iseq.c: catch up this fix.
+ TODO: modify constified variables using cast may be harmful for
+ compiler's analysis and optimization.
+ Any idea to prohibit inserting RBasic::klass directly?
+ If rename RBasic::klass and force to use RBASIC_CLASS(obj),
+ then all codes such as `RBASIC(obj)->klass' will be
+ compilation error. Is it acceptable? (We have similar
+ experience at Ruby 1.9,
+ for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
- * iseq.h: commit ditto.
+ * internal.h: add some macros.
+ * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
+ object.
+ * RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
+ * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
+ without write barrier (planned).
+ * RCLASS_SET_SUPER(a, b) set super class of a.
-Thu May 21 15:41:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
+ file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
+ parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
+ string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
+ Use above macros and functions to access RBasic::klass.
- * lib/net/telnet.rb: gemify net-telnet.
- [Feature #11083]
- * gems/bundled_gems: added net-telnet to bundled gems.
+ * ext/coverage/coverage.c, ext/readline/readline.c,
+ ext/socket/ancdata.c, ext/socket/init.c,
+ * ext/zlib/zlib.c: ditto.
-Thu May 21 15:37:32 2015 Zachary Scott <e@zzak.io>
+Mon May 13 18:44:14 2013 Koichi Sasada <ko1@atdot.net>
- * vm_method.c: Remove private attribute warning [Bug #10967]
- Patch by @spastorino [Fixes GH-849]
- https://github.com/ruby/ruby/pull/849
+ * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
+ instead of using RARRAY_PTR().
- * test/ruby/test_module.rb: Update test for changes
+Mon May 13 16:53:53 2013 Koichi Sasada <ko1@atdot.net>
-Thu May 21 10:59:43 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/ruby.h: add new utility macros to access
+ Array's element.
+ * RARRAY_AREF(a, i) returns i-th element of an array `a'
+ * RARRAY_ASET(a, i, v) set i-th element of `a' to `v'
+ This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
- * proc.c (method_proc): rename to method_to_proc.
+Mon May 13 15:31:10 2013 Koichi Sasada <ko1@atdot.net>
-Thu May 21 10:51:54 2015 Jake Worth <jakeworth82@gmail.com>
+ * object.c (rb_obj_setup): added.
- * io.c (rb_f_select): [DOC] Fixes for grammar and style.
- [Fix GH-906]
+ * include/ruby/ruby.h (OBJSETUP): use rb_obj_setup() instead of
+ a macro.
-Thu May 21 08:25:19 2015 Eric Wong <e@80x24.org>
+Mon May 13 15:24:16 2013 Koichi Sasada <ko1@atdot.net>
- * variable.c (Init_var_tables): init generic_iv_tbl
- (rb_generic_ivar_table, generic_ivar_get, generic_ivar_set,
- generic_ivar_defined, generic_ivar_remove,
- rb_mark_generic_ivar, givar_i, rb_mark_generic_ivar_tbl,
- rb_free_generic_ivar, rb_copy_generic_ivar, rb_ivar_foreach,
- rb_ivar_count): remove checks for uninitialize generic_iv_tbl
- [ruby-core:69155] [Feature #11146]
+ * gc.c (rb_data_object_alloc): check klass only if klass is not 0.
+ klass==0 means internal object.
-Thu May 21 04:11:03 2015 Koichi Sasada <ko1@atdot.net>
+Mon May 13 14:57:28 2013 Koichi Sasada <ko1@atdot.net>
- * iseq.c (exception_type2symbol): show correct bug message.
+ * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
+ use NEWOBJ_OF() instead of NEWOBJ().
-Wed May 20 23:19:05 2015 Yusuke Endoh <mame@ruby-lang.org>
+Mon May 13 14:51:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/base64.rb: Fix rdoc-formatting for padding argument.
- [fix GH-905][ci skip] Patch by @davydovanton
+ * proc.c (rb_obj_singleton_method): new method Kernel#singleton_method
+ which returns a Method object of the singleton method.
+ non-singleton method causes NameError, but not aliased or zsuper
+ method, right now.
+ [ruby-core:54914] [Feature #8391]
-Wed May 20 13:16:23 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_method.c (rb_method_entry_at): return the method entry for id at
+ klass, without ancestors.
- * configure.in (DEPRECATED_BY): deprecate warning with preferable
- alternative.
+ * class.c (rb_singleton_class_get): get the singleton class if exists,
+ or nil.
- * configure.in (RUBY_FUNC_ATTRIBUTE): allow attribute arguments in
- the macro.
+Mon May 13 10:20:59 2013 Yuki Yugui Sonoda <yugui@google.com>
-Wed May 20 11:23:24 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/openssl/ossl_ssl.c: Disabled OpenSSL::SSL::SSLSocket if
+ defined(OPENSSL_NO_SOCK).
- * vm_dump.c (rb_print_backtrace): return value of libexec's backtrace
- is size_t, so simply cast as int.
+ This fixes a linkage error on platforms which do not have socket.
+ OpenSSL itself is still useful as a set of cryptographic functions
+ even on such platforms.
-Tue May 19 18:54:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 13 10:30:04 2013 Zachary Scott <zachary@zacharyscott.net>
- * iseq.c (rb_iseq_compile_with_option): check source type, must be
- an IO or a String. [ruby-core:69219] [Bug #11159]
+ * hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301]
-Tue May 19 17:15:03 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon May 13 10:04:22 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/benchmark.rb: Update Benchmark documentation and formatting.
- [fix GH-903][ci skip] Patch by @davydovanton
+ * random.c: Document Random::DEFAULT by @eLobato [Fixes GH-304]
-Tue May 19 13:10:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 12 21:12:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * numeric.c (num_positive_p): should false on Bignum 0.
- http://twitter.com/rafaelfranca/status/600509783427391488
- [ruby-core:69173] [Feature #11151]
+ * include/ruby/ruby.h (OFFT2NUM): RUBY_REPLACE_TYPE also defines macro
+ to convert int type to VALUE if found.
-Tue May 19 11:22:28 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Wed May 8 13:46:52 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/uri/rfc2396_parser.rb (initialize_pattern):
- URI::Generic.build should accept port as a string.
- pattern[:PORT] is not defined for long.
- by Dave Slutzkin <daveslutzkin@fastmail.fm>
- https://github.com/ruby/ruby/pull/804 fix GH-804
+ * include/ruby/intern.h (rb_iv_set, rb_iv_get): removed. Because
+ ruby.h has a declaration for that.
-Tue May 19 11:18:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 8 13:49:06 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * include/ruby/ruby.h (rb_data_typed_object_alloc),
- (rb_data_object_alloc): add old names for source level backward
- compatibilities.
+ * include/ruby/intern.h (rb_uint2big, rb_int2big, rb_uint2inum)
+ (rb_int2inum, rb_ll2inum, rb_ull2inum): removed because ruby.h
+ has a declaration for these.
- * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc): add
- aliases for binary level backward compatibilities.
+Sun May 12 17:52:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue May 19 09:54:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: removes 'ac_cv_func_fseeko=yes' form MinGW
+ specific definitions.
- * include/ruby/ruby.h (Data_Make_Struct0): needs function pointer
- casts to fix function overloading in C++.
+Sun May 12 17:25:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue May 19 09:43:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_file_s_truncate): use correct type. chsize takes
+ a long.
- * include/ruby/ruby.h (Data_Make_Struct0, TypedData_Make_Struct0):
- explicit cast from void* is necessary as implicit cast is
- disallowed in C++.
+Sun May 12 17:18:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon May 18 15:31:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c: move '#define HAVE_SPAWNV 1' to win32/Makefile.sub.
+ * win32/Makefile.sub: see above.
- * include/ruby/intern.h (rb_f_notimplement): should not respond to
- not-implemented methods. as the address inside a DLL and the
- imported address are different on Windows, use an exported
- variable to share the same address.
+Sun May 12 17:13:32 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon May 18 13:55:01 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * configure.in: removes AC_CHECK_FUNCS(setitimer) because it's
+ unused.
- * lib/monitor.rb (mon_try_enter, mon_enter): should reset @mon_count
- just in case the previous owner thread dies without mon_exit.
- [fix GH-874] Patch by @chrisberkhout
+Sun May 12 17:08:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun May 17 17:21:29 2015 Eric Wong <e@80x24.org>
+ * configure.in: removes AC_CHECK_FUNCS(pause) because it's unused.
- * lib/webrick/utils.rb (set_non_blocking): use IO#nonblock=
- * (set_close_on_exec): use IO#close_on_exec=
- [Feature #11136]
+Sun May 12 17:05:18 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun May 17 15:01:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.
- * numeric.c (num_positive_p, num_negative_p): add methods
- Numeric#positive? and Numeric#negative?.
- [ruby-core:69173] [Feature #11151]
+Sun May 12 17:03:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * numeric.c (flo_positive_p, flo_negative_p): specialized
- functions for Float.
+ * configure.in: abort if gettimeofday doesn't exist.
- * complex.c (Init_Complex): Complex do not have positive? and
- negative? methods
+Sun May 12 16:31:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun May 17 14:57:42 2015 Eric Wong <e@80x24.org>
+ * configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating
+ NUM2OFFT.
+ * file.c (rb_file_truncate): use correct type. chsize() take
+ a long.
+ * include/ruby/ruby.h (NUM2OFFT): use a definition created by
+ a configure script by default.
- * lib/webrick/server.rb (accept_client): avoid redundant fcntl call
- [Feature #11137]
+Sun May 12 16:03:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun May 17 12:13:33 2015 Eric Wong <e@80x24.org>
+ * configure.in: removes AC_CHECK_FUNC(fseeko, fseeko64, ftello,
+ ftello64). They are not used from anywhere.
- * ext/socket/init.c (cloexec_accept): support nonblock flag and
- use SOCK_NONBLOCK if possible
- * ext/socket/init.c (rsock_s_accept_nonblock):
- update cloexec_accept call
- * ext/socket/init.c (accept_blocking): ditto for blocking
- * test/socket/test_nonblock.rb: check nonblock? on accepted socket
- [Feature #11138]
+ * win32/win32.c (fseeko): removes.
+ * win32/win32.c (rb_w32_ftello): removes.
+ * include/ruby/win32.h: removes declarations of rb_w32_ftello and
+ rb_w32_fseeko.
+ * win32/Makefile.sub: removes '#define HAVE_FTELLO 1'.
-Sun May 17 03:58:59 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+Sun May 12 15:51:47 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * load.c (loaded_feature_path): stop returning false negatives for
- filenames which are trailing substrings of file extensions. For
- example, 'b', which a trailing substring of ".rb" should not return
- false. [Bug #11155][ruby-core:69206]
+ * configure.in: remove AC_CHECK_FUNC(close). It is not used from
+ anywhere.
- * test/ruby/test_autoload.rb: test for fix
+Sun May 12 15:50:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat May 16 21:41:24 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * configure.in: adds comments for setjmp check.
- * string.c: added documentation for character sequence \' with String#sub
- [Bug #11132][ruby-core:69121][fix GH-900][ci skip] Patch by @shishir127
+Sun May 12 15:38:09 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat May 16 21:38:05 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * configure.in: move clock_gettime() check into regular place.
- * enum.c: fix a sample code. Patch by @eagletmt
- [fix GH-901][ci skip]
+Wed May 8 13:45:53 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat May 16 21:17:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: add getenv() declaration check.
+ * dln_find.c: add HAVE_DECL_GETENV test.
- * gc.c (rb_data_object_wrap, rb_data_typed_object_wrap): rename
- alloc as wrap. these functions do not allocate data pointers
- but just wrap the given pointers.
+Sun May 12 15:33:18 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat May 16 19:59:24 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: sorts AC_CHECK_FUNCS()s as alphabetical order.
- * win32/win32.c (rb_w32_accept): simplified.
+Wed May 8 13:41:57 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Fri May 15 18:28:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bignum.c: remove redundant decl for big_lshift() big_rshift().
- * array.c (rb_ary_assoc, rb_ary_rassoc): [DOC] the result when key
- was found is the existing element, not a new array. reported by
- Giau Nguyen <giaunv AT nustechnology.com>.
+Sun May 12 16:06:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri May 15 08:24:28 2015 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+ * ext/socket/rubysocket.h (rsock_inspect_sockaddr): as r40646
+ check HAVE_TYPE_STRUCT_SOCKADDR_DL.
- * lib/cgi/cookie.rb: Implement HttpOnly flag for cookies.
- [fix GH-887] Patch by @martinpovolny
+Sat May 11 23:01:58 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri May 15 06:54:19 2015 Aaron Patterson <tenderlove@ruby-lang.org>
+ * ext/socket/rubysocket.h (HAVE_TYPE_STRUCT_SOCKADDR_DL):
+ MSVC has struct sockaddr_dl, but its content is broken.
+ http://ruby-mswin.cloudapp.net/vc10-x64/ruby-trunk/log/20130511T103938Z.log.html.gz
- * variable.c: Change autoload to call `require` through Ruby rather
- than directly calling `rb_require_safe`. This allows things like
- RubyGems to intercept file loading done though `autoload`.
- [Feature #11140]
+Sat May 11 22:07:42 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_autoload.rb: Test for change.
+ * test/rinda/test_rinda.rb: Socket.getifaddrs may returns an interface
+ which #addr method returns nil for venet0 in OpenVZ.
-Wed Apr 8 19:18:02 2015 Shota Fukumori (sora_h) <her@sorah.jp>
+Sat May 11 21:56:34 2013 Tanaka Akira <akr@fsij.org>
- * enum.c (enum_grep_v, grep_i, grep_iter_i, Init_enum):
- Implement Enumerable#grep_v. [Feature #11049]
+ * ext/socket/raddrinfo.c (rsock_inspect_sockaddr): Add casts to
+ suppress warnings.
-Thu May 14 15:54:13 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Sat May 11 17:28:51 2013 Tanaka Akira <akr@fsij.org>
- * ext/pathname/lib/pathname.rb: Remove condition of RUBY_VERSION <= 1.9.
- [Feature #11082]
+ * ext/socket: New method, Socket.getifaddrs, implemented.
+ [ruby-core:54777] [Feature #8368]
-Wed May 13 17:10:37 2015 Masaki Matsushita <glass.saga@gmail.com>
+Sat May 11 00:47:22 2013 Tanaka Akira <akr@fsij.org>
- * enum.c (enum_to_a): revert r50457.
- it requires recursion check.
- then, it doesn't make performance improvement.
- [Bug #11130] [Feature #9118]
+ * gc.h (SET_MACHINE_STACK_END): Add !defined(_ILP32) to a defining
+ condition to avoid compilation error on x32.
+ https://sites.google.com/site/x32abi/
-Wed May 13 11:13:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 10 23:56:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (parse_gvar): separate message for gvar without
- non-space characters from message for invalid identifiers.
+ * parse.y (parser_peek_variable_name): treat invalid global, class,
+ and instance variable names as mere strings rather than errors.
+ [ruby-core:54885] [Bug #8375]
-Tue May 12 22:18:27 2015 Masaki Matsushita <glass.saga@gmail.com>
+Fri May 10 20:22:40 2013 Tanaka Akira <akr@fsij.org>
- * enum.c (enum_to_a): fix incompatibility introduced in r50457.
- [Bug #11130]
+ * configure.in: Move library checks into "Checks for libraries." part.
- * test/ruby/test_enum.rb: test for above.
+Fri May 10 19:32:01 2013 Tanaka Akira <akr@fsij.org>
-Tue May 12 17:08:03 2015 Koichi Sasada <ko1@atdot.net>
+ * configure.in: Reformat arguments of AC_CHECK_HEADERS and
+ AC_CHECK_FUNCS to track modifications easily.
- * method.h: remove unused declaration.
+Fri May 10 12:01:36 2013 Tanaka Akira <akr@fsij.org>
-Mon May 11 10:58:45 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * configure.in: Don't link librt if clock_gettime is available in
+ the main C library.
+ glibc 2.17 moves clock_* from librt to the main C library.
+ http://sourceware.org/ml/libc-announce/2012/msg00001.html
- * gems/bundled_gems: Update minitest-5.6.1 and power_assert-0.2.3.
+Thu May 9 22:00:35 2013 Tanaka Akira <akr@fsij.org>
-Mon May 11 00:20:31 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/ancdata.c (bsock_sendmsg_internal): controls_num should
+ not be negative.
- * include/ruby/ruby.h (Data_Make_Struct, TypedData_Make_Struct):
- allocate wrapper data object before allocating DATA_PTR to get
- rid of possible memory leak when the former failed.
+Thu May 9 21:09:57 2013 Tanaka Akira <akr@fsij.org>
-Sun May 10 21:32:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c, ext/etc/etc.c, ext/socket/unixsocket.c,
+ ext/openssl/ossl.h, ext/openssl/openssl_missing.c: Use
+ HAVE_AGGREGATE_MEMBER instead of HAVE_ST_MEMBER.
- * gc.c (gc_mark_children): call dmark function for non-NULL
- pointers only, so that DATA_PTR can be NULL safely now.
+Thu May 9 20:43:41 2013 Tanaka Akira <akr@fsij.org>
-Sun May 10 16:23:58 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/socket/ancdata.c (bsock_sendmsg_internal): Always set
+ controls_num to raise NotImplementedError appropriately.
+ (bsock_recvmsg_internal): Raise NotImplementedError if
+ :scm_rights=>true is given on platforms which don't have
+ 4.4BSD style control message.
- * proc.c (proc_binding): fix segmentation fault on marking phase.
- envptr of newenvval should not be NULL.
+Thu May 9 12:06:07 2013 Tanaka Akira <akr@fsij.org>
- You can reproduce by
- make test-all TESTS='--gc-stress -n test_to_proc_binding ruby/test_method.rb'
+ * ext/socket/rubysocket.h, ext/socket/unixsocket.c,
+ ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead
+ of HAVE_ST_MSG_CONTROL.
-Sun May 10 12:41:18 2015 Masaki Matsushita <glass.saga@gmail.com>
+Thu May 9 11:30:02 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/zlib/zlib.c (rb_gzreader_external_encoding):
- define GzipReader#external_encoding.
- [Bug #10900]
+ * string.c: Add call-seq alias for String#=== [Bug #8381]
- * test/zlib/test_zlib.rb: test for above.
+Thu May 9 11:14:18 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun May 10 11:57:48 2015 Masaki Matsushita <glass.saga@gmail.com>
+ * doc/contributing.rdoc: Add guide for contributing to CRuby
- * ext/win32ole/win32ole_variant.c: fix typo "indicies".
- the patch is from davydovanton <antondavydov.o at gmail.com>.
- [fix GH-892]
+Thu May 9 04:55:49 2013 Tanaka Akira <akr@fsij.org>
- * lib/rubygems/indexer.rb: ditto.
+ * configure.in: Check socket library again. shutdown() is used in
+ io.c.
- * test/rubygems/test_gem_indexer.rb: ditto.
+Thu May 9 01:52:31 2013 Tanaka Akira <akr@fsij.org>
-Sun May 10 11:44:37 2015 Masaki Matsushita <glass.saga@gmail.com>
+ * configure.in: Don't check socketpair. socketpair is not used in
+ ruby command itself.
- * string.c (rb_str_crypt): Raise ArgumentError when
- string passed to String#crypt contains null.
- the patch is from jrusnack <jrusnack at redhat.com>.
- [Bug #10988] [fix GH-853]
+Thu May 9 01:05:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_string.rb: test for above.
+ * class.c (rb_mod_included_modules): should not include non-modules.
+ [ruby-core:53158] [Bug #8025]
-Sun May 10 11:23:03 2015 Masaki Matsushita <glass.saga@gmail.com>
+Wed May 8 22:46:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * enum.c (enum_to_a): Use size to set array capa when possible.
- the patch is from HonoreDB <aweiner at mdsol.com>.
- [fix GH-444]
+ * class.c (rb_mod_included_modules): should not include the original
+ module itself. [ruby-core:53158] [Bug #8025]
-Sat May 9 06:48:36 2015 Eric Wong <e@80x24.org>
+Wed May 8 17:43:55 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/socket/ancdata.c (bsock_recvmsg_internal): GC guard
- [Bug #11123]
+ * io.c (rb_io_ext_int_to_encs): ignore internal encoding if external
+ encoding is ASCII-8BIT. [Bug #8342]
-Fri May 8 22:57:24 2015 takiy33 <takiy33@gmail.com>
+Wed May 8 13:49:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/matrix/test_matrix.rb (test_determinant): refactor test on
- Matrix#determinant, by merging with test_det for an alias method
- det. [Fix GH-897]
+ * ext/json/generator/generator.c (isArrayOrObject): cast char to
+ unsigned char. [Bug #8378]
-Fri May 8 15:43:11 2015 Shugo Maeda <shugo@ruby-lang.org>
+Wed May 8 13:46:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/net/imap.rb (body_ext_mpart): should work even if body-fld-dsp
- is omitted. [ruby-core:69093] [Bug #11128]
+ * ext/json/generator/depend: fix dependencies [Bug #8379]
-Fri May 8 15:05:57 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/json/parser/depend: ditto.
- * doc/syntax/control_expressions.rdoc: fix a missing "a"
- [fix GH-888][ci skip] Patch by @riffraff
+Wed May 8 13:07:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 8 12:11:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid
+ name character. [ruby-core:54846] [Bug #8375].
- * vm_eval.c (rb_method_call_status): resolve refined method entry
- to check if undefined. [ruby-core:69064] [Bug #11117]
+Wed May 8 13:06:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu May 7 22:22:59 2015 Sho Hashimoto <sho-h@ruby-lang.org>
+ * include/ruby/ruby.h (ISGRAPH): add missing macro.
- * proc.c: [DOC] fix Binding#local_variable_set example. [ci skip]
+Wed May 8 06:42:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu May 7 11:32:57 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/socket.c (socket_s_ip_address_list): fix wrongly filled
+ sin6_scope_id on KAME introduced by r40593 for OpenIndiana.
+ KAME uses fe80:<scope_id>::<interface id> for link-local address
+ internally.
+ Setting sin6_scope_id causes it leaked.
+ see also comments of sockaddr_obj().
- * Makefile.in (rbconfig.rb): add rule to make.
+Tue May 7 22:12:34 2013 Tanaka Akira <akr@fsij.org>
-Thu May 7 05:14:39 2015 Eric Wong <e@80x24.org>
+ * ext/readline/readline.c (insert_ignore_escape): Add a cast to
+ unsigned char * before dereference.
+ This suppress a warning on Cygwin.
- * ext/socket/lib/socket.rb (connect_nonblock): use IO#wait_writable
- * lib/drb/drb.rb (DRB::DRbTCPSocket#alive?): use IO#wait_readable
- * lib/webrick/httpserver.rb (run): ditto
- * lib/resolv.rb (request): ditto for single socket case
- [ruby-core:68943] [Feature #11081]
+Tue May 7 12:15:24 2013 Tanaka Akira <akr@fsij.org>
-Wed May 6 22:49:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/ancdata.c (bsock_recvmsg_internal): Add a cast to
+ suppress warning.
+ Bionic defines socklen_t as int.
+ Bionic defines msg_controllen as unsigned int (__kernel_size_t)
+ instead of socklen_t as POSIX.
- * vm_eval.c (rb_method_call_status): undefined refined method is
- not callable unless using. [ruby-core:69064] [Bug #11117]
+Tue May 7 12:12:42 2013 Tanaka Akira <akr@fsij.org>
-Sun May 3 22:40:06 2015 Rei Odaira <Rei.Odaira@gmail.com>
+ * ext/socket/ancdata.c (ancillary_inspect): Don't call
+ anc_inspect_ipv6_pktinfo if !HAVE_TYPE_STRUCT_IN6_PKTINFO.
+ anc_inspect_ipv6_pktinfo is not defined in the case.
- * ext/-test-/file/fs.c: need to include sys/statvfs.h
- to use statvfs().
+Tue May 7 12:10:52 2013 Tanaka Akira <akr@fsij.org>
- * ext/-test-/file/extconf.rb: check the existence of
- sys/statvfs.h
+ * ext/socket/socket.c (socket_s_ip_address_list): Cast EXTRA_SPACE as
+ int. This suppress a warning.
-Sun May 3 21:59:48 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Tue May 7 12:09:29 2013 Tanaka Akira <akr@fsij.org>
- * lib/yaml.rb: fix typo. [ci skip][fix GH-890]
- Patch by @miketheman
+ * ext/socket/extconf.rb: Set close_fds false for Cygwin.
+ Cygwin doesn't support fd passing.
+ This enables socket extension library cross-compilable by default.
-Sun May 3 10:02:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 7 12:07:35 2013 Tanaka Akira <akr@fsij.org>
- * range.c (linear_object_p, range_include): test if covered for
- linear objects. [ruby-core:69052] [Bug #11113]
+ * pack.c (swap32): Don't redefine it if it is already defined.
+ Bionic defines it.
+ (swap64): Ditto.
-Fri May 1 13:30:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 6 20:50:37 2013 Tanaka Akira <akr@fsij.org>
- * dln.c (dln_load): check if a different libruby is loaded by the
- extension library, and then bail out to get rid of very
- frequently reported stale bug reports.
+ * ext/socket/socket.c (socket_s_ip_address_list): Fill sin6_scope_id
+ if getifaddrs() returns an IPv6 link local address which
+ sin6_scope_id is zero, such as on OpenIndiana SunOS 5.11.
-Thu Apr 30 19:51:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 5 18:56:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_compile_each): revert r46873 and r46875, not to
- allow to execute private readers by pretending op assign.
- [ruby-core:68984] [Bug #11096]
+ * insns.def (defined): use vm_search_superclass() like as normal super
+ call. based on a patch <https://gist.github.com/wanabe/5520026> by
+ wanabe.
-Thu Apr 30 17:02:33 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * vm_insnhelper.c (vm_search_superclass): return error but not raise
+ exceptions.
- * rational.c: Added documentation for rational literal.
- [Bug #11075][fix GH-885][ci skip] Patch by @shishir127
+ * vm_insnhelper.c (vm_search_super_method): check the result of
+ vm_search_superclass and raise exceptions on error.
-Thu Apr 30 16:39:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 5 16:29:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/ipsocket.c (init_inetsock_internal): preserve errno
- before other library calls and use rb_syserr_fail.
- [ruby-core:68531] [Bug #10975]
+ * insns.def (defined): get method entry from the method top level
+ frame, not block frame. [ruby-core:54769] [Bug #8367]
-Thu Apr 30 16:22:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 5 13:28:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (lambda): push and reset cmdarg_stack in lambda body.
- [ruby-core:69017] [Bug #11107]
+ * template/ruby.pc.in (Cflags): use rubyarchhdrdir for multiarch.
+ [Bug #7874]
-Sun Apr 26 07:36:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 4 07:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * enc/utf_8.c (code_to_mbclen, code_to_mbc): reject values larger
- than UTF-8 max codepoints. [Feature #11094]
+ * doc/security.rdoc: Add note about reporting security vulns
-Sat Apr 25 14:26:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 4 04:13:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * string.c (str_buf_cat): expand later so that the buffer can be
- larger for further use. [Bug #11080] [Bug #11095]
+ * include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): New for
+ attribute((alloc_size(params))).
-Fri Apr 24 23:48:45 2015 Akinori MUSHA <knu@iDaemons.org>
+ * include/ruby/defines.h (xmalloc, xmalloc2, xcalloc)
+ (xrealloc, xrealloc2): Annotated by RUBY_ATTR_ALLOC_SIZE.
+ * include/ruby/ruby.h (rb_alloc_tmp_buffer): ditto.
- * misc/ruby-electric.el: Import version 2.2.3 from
- https://github.com/knu/ruby-electric.el.
+Fri May 3 19:32:13 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-Fri Apr 24 10:40:02 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/cgi/util.rb: All class methods modulized.
+ We can use these methods like a function when "include CGI::Util".
+ [Feature #8354]
- * win32/win32.c (rb_w32_{getc,putc}): removed. they are needed for old
- ruby (before 1.8), but not now.
+Fri May 3 14:09:45 2013 Tanaka Akira <akr@fsij.org>
-Fri Apr 24 08:40:13 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/extconf.rb: Make default_ipv6 true for Cygwin.
+ Cygwin supports IPv6 since Cygwin 1.7.1 (2009-12).
+ http://cygwin.com/ml/cygwin-announce/2009-12/msg00027.html
- * win32/win32.c: remove bcc related code.
+Fri May 3 13:35:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/win32.h: ditto.
+ * ext/socket/{getaddrinfo,getnameinfo}.c: define socklen_t if not
+ defined, e.g., older VC.
-Fri Apr 24 08:21:07 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Fri May 3 13:29:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_acrt_lowio_lock_fh): wrap _pioinfo(i)->lock.
+ * include/ruby/win32.h (INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX): also
+ should be defined when defining intptr_t and uintptr_t.
+ bigdecimal.c requires the former two now.
- * win32/win32.c (rb_acrt_lowio_unlock_fh): ditto.
+Fri May 3 13:22:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Apr 24 06:47:19 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * win32/win32.c (poll_child_status): fix build error on older mingw.
- * win32/win32.c (_filbuf): msvc14 doesn't have it, use _fgetc_nolock.
+Fri May 3 00:15:58 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * win32/win32.c (_flsbuf): msvc14 doesn't have it, use _fputc_nolock.
+ * common.mk: remove timestamps in distclean-ext realclean-ext.
- * win32/win32.c (vcruntime_file): define vcruntime_file on msvc14
- because it doesn't export FILE's internal structure.
+Thu May 2 23:23:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (FILE_COUNT): added to abstract FILE->_cnt.
+ * object.c (rb_obj_is_kind_of): skip prepending modules.
+ [ruby-core:54742] [Bug #8357]
- * win32/win32.c (FILE_READPTR): added to abstract FILE->_ptr.
+ * object.c (rb_class_inherited_p): ditto.
+ [ruby-core:54736] [Bug #8357]
- * win32/win32.c (FILE_FILENO): added to abstract FILE->_file.
+Thu May 2 22:11:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (init_stdhandle): use FILE_FILENO.
+ * bin/irb: remove dead code from sample/irb.rb.
- * win32/win32.c (rb_w32_getc): use FILE_COUNT and FILE_READPTR.
+Thu May 2 17:32:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_putc): ditto.
+ * marshal.c (copy_ivar_i): get rid of overwriting already copied
+ instance variables. c.f. [Bug #8276]
-Fri Apr 24 06:37:07 2015 NARUSE, Yui <naruse@ruby-lang.org>
+Thu May 2 16:55:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (dupfd): use _set_osfhnd.
+ * thread.c (id_locals): use cached ID.
- * win32/win32.c (rb_w32_wopen): use _set_osflags.
+ * vm.c (ruby_thread_init): ditto.
-Thu Apr 24 05:38:01 2015 Koichi Sasada <ko1@atdot.net>
+ * defs/id.def: add more predefined IDs used in core.
- * gc.c (gc_mark_roots): fox to work PRINT_ROOT_TICKS.
+Thu May 2 13:42:42 2013 Ryan Davis <ryand-ruby@zenspider.com>
-Fri Apr 24 04:49:05 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/minitest/*: Imported minitest 4.7.4 (r8483)
+ * test/minitest/*: ditto
- * win32/Makefile.sub: MSVC14 have struct timespec.
+Thu May 2 11:32:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * win32/rtname.cmd: support vcruntime140.dll.
+ * win32/win32.c (poll_child_status): [experimental] set the cause of
+ a child's death to status if its exitcode seems to be an error.
- * time.c (localtime_with_gmtoff_zone): MSVC14 doesn't have tzname and
- daylight but have _tzname and _daylight.
+ * test/ruby/test_process.rb (TestProcess#test_no_curdir): maybe now
+ we can test it.
-Thu Apr 23 11:35:55 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_thread.rb (TestThread#test_thread_timer_and_interrupt):
+ ditto.
- * vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow
- symbols to just instance_eval/exec, except for definition of
- singletons. [ruby-core:68961] [Bug #11086]
+Thu May 2 11:24:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Apr 23 10:01:36 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * lib/yaml.rb: nodoc EngineManager, add History doc #8344
- * lib/delegate.rb: fix a typo.
- [fix GH-881][ci skip] Patch by @Zorbash
+Wed May 1 21:11:17 2013 Tanaka Akira <akr@fsij.org>
-Wed Apr 22 18:36:50 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * time.c (localtime_with_gmtoff_zone): musl libc may return NULL for
+ tm_zone.
- * lib/net/imap.rb (move, uid_move): support the MOVE command defined
- in RFC6851. Patch by ojab ojab.
- [ruby-core:68960] [Feature #11077]
+Wed May 1 18:59:36 2013 Benoit Daloze <eregontp@gmail.com>
-Tue Apr 22 12:42:12 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * enum.c (Enumerable#chunk): fix grammar of error message
+ for symbols beginning with an underscore [Bug #8351]
- * test/ruby/test_object.rb: add tests for Kernel#String and Kernel#Array.
- [fix GH-879][fix GH-880] Patch by @yui-knk
+Wed May 1 16:47:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 21 20:46:02 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * ext/curses/extconf.rb (curses_version): try once for each tests, a
+ function or a variable. fallback to variable for old SVR4.
- * test/ruby/test_object.rb: renamed tests to explicitly class name.
- [fix GH-877] Patch by @yui-knk
+Wed May 1 16:17:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 21 05:31:00 2015 Eric Wong <e@80x24.org>
+ * ext/extmk.rb (extmake): extensions not to be installed should not
+ make static libraries, but make dynamic libraries always.
- * ext/socket/lib/socket.rb (connect_internal): avoid common exceptions
- from connect_nonblock. [ruby-core:68909]
+Wed May 1 12:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Mon Apr 20 23:46:53 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rake/version.rb: Fix RDoc warning with :include: [Bug #8347]
- * win32/win32.c (rb_w32_wreadlink): follow the official format of
- REPARSE_DATA_BUFFER structure.
+Wed May 1 11:40:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Apr 20 20:23:04 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * defs/id.def (predefined): add "idProc".
- * common.mk ($(arch)-fake.rb): revert r50354 because bsdmake seems not
- to handle such substitution.
+ * eval.c (frame_func_id): use predefined IDs.
- * tool/expand-config.rb: convert path separators here.
+ * proc.c (mnew, mproc, mlambda): use predefined IDs.
-Mon Apr 20 16:52:20 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm.c (rb_vm_control_frame_id_and_class): ditto.
- * tool/fake.rb: don't fake libdir. use libdirname instead.
+ * vm.c (Init_VM): ditto.
-Mon Apr 20 16:49:52 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Apr 30 23:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/mkmf.rb (MakeMakefile#configuration): DESTDIR should never affect
- top_srcdir and builddir.
+ * lib/benchmark.rb: Update Benchmark results on newer CPU
-Mon Apr 20 16:18:17 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Apr 30 12:31:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk ($(arch)-fake.rb): fix the path separator up for Windows.
+ * proc.c (mproc, mlambda): use frozen core methods instead of plain
+ global methods, so that methods cannot be overridden.
+ [ruby-core:54687] [Bug #8345]
-Mon Apr 20 15:02:47 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm.c (Init_VM): define proc and lambda on the frozen core object.
- * win32/win32.c (rb_w32_wreadlink): fixed a bug that a junction misses
- its drive letter.
+ * include/ruby/intern.h (rb_block_lambda): add declaration instead of
+ deprecated rb_f_lambda.
-Mon Apr 20 12:54:56 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+Mon Apr 29 17:02:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/openssl/*: use license instead of licence.
- [fix GH-876][ci skip] Patch by @davydovanton
- * lib/net/https.rb: ditto.
+ * ext/nkf/nkf-utf8/nkf.h: Bionic libc doesn't have locale.
+ [Feature #8338]
-Mon Apr 20 12:42:40 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
- * benchmark/bm_so_meteor_contest.rb: fix a typo.
- [fix GH-876][ci skip] Patch by @davydovanton
- * tool/bisect.sh: ditto.
- * tool/update-deps: ditto.
+Mon Apr 29 06:58:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Apr 20 11:10:46 2015 Eric Wong <e@80x24.org>
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): no need of alloca for
+ small fixed size array.
- * ext/socket/socket.c (sock_connect_nonblock): do not raise EISCONN
- [ruby-core:68926] [Feature #11072]
- * test/socket/test_nonblock.rb: check non-EISCONN on 2nd connect
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): check overflow first,
+ and use alloca for small size input.
-Sun Apr 19 12:19:17 2015 Chad Brewbaker <crb002@gmail.com>
+Mon Apr 29 00:40:13 2013 Benoit Daloze <eregontp@gmail.com>
- * ext/{etc,openssl,tk}: Adding parens and comparisons around
- assignments to get rid of Wparentheses warnings. [Fix GH-875]
+ * lib/yaml.rb: Clarify documentation about YAML being always Psych.
+ Give a tip about using Syck. See #8344.
-Sun Apr 19 10:42:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 28 23:34:01 2013 Benoit Daloze <eregontp@gmail.com>
- * hash.c (get_env_cstr): environment variables must be ASCII
- compatible, as dummy encodings and wide char encodings are
- unsupported now.
+ * lib/yaml.rb: Use another trick to define the YAML module.
+ https://twitter.com/n0kada/status/328342207511801856
-Sat Apr 18 15:18:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 28 23:19:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/json/parser/parser.rl: raise with messages in UTF-8
- encoding. [ruby-core:67386] [Bug #10705]
+ * lib/pp.rb: Update PP module overview by @geopet
-Fri Apr 17 11:58:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 28 22:04:37 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * string.c (STR_SET_EMBED): clear NOFREE flag at embedding as
- embedded strings no longer refer static strings.
- [ruby-core:68436] [Bug #10942]
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix buffer overflow on
+ x64 Windows and memory leak when initializing with integer.
+ [ruby-core:54615] [Bug #8337]
-Thu Apr 16 05:15:50 2015 Eric Wong <e@80x24.org>
+Sun Apr 28 12:38:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: note IO#wait_readable change in r50263
+ * README.EXT: correct method name to be used. [Bug #7982]
-Thu Apr 16 05:09:36 2015 Eric Wong <e@80x24.org>
+ * README.EXT.ja: add notes too.
- * lib/net/protocol.rb (rbuf_fill): use IO#wait_*able
- * lib/net/http/generic_request.rb (wait_for_continue): ditto
- [ruby-core:68891] [Feature #11056]
+Sun Apr 28 10:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Apr 15 18:43:43 2015 Koichi Sasada <ko1@atdot.net>
+ * object.c: With feedback from Steve Klabnik, reverted a change to
+ #untrusted? and #tainted?. Also adjusted grammar for $SAFE levels
- * vm_trace.c (rb_tracepoint_new): fix documentation.
- Commented by @emilsoman.
+Sun Apr 28 10:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Apr 15 17:36:51 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/yaml.rb: Disable setting YAML const twice [ruby-core:54642]
- * vm_trace.c (rb_tracepoint_new): Add documentation for
- rb_tracepoint_new C level API [ci skip]
- Provided by @emilsoman. [fix GH-869]
+Sun Apr 28 09:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Apr 15 10:37:40 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
+ * object.c: Documentation for taint and trust [Bug #8162]
- * doc/contributors.rdoc: fix a typo. Patch by @davydovanton
- [fix GH-872][ci skip]
- * doc/syntax/methods.rdoc: ditto.
- * ext/digest/sha2/sha2.c: ditto.
- * ext/socket/ipsocket.c: ditto.
- * ext/tk/*: ditto.
+Sun Apr 28 09:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Apr 15 07:51:23 2015 Yuki Yugui Sonoda <yugui@yugui.jp>
+ * README.EXT: Copy note from r40505 for rb_sprintf() [Bug #7982]
- * doc/extension.ja.rdoc: Added description of TypedData_XXX.
- Deprecated the old DATA_XXX.
- Reviewed by ko1 and nobu.
- Fixes [ruby-dev:40881] #3064
+Sun Apr 28 08:28:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * doc/extension.rdoc: ditto.
+ * ext/curses/curses.c: Update Curses::Window example for nicer output
+ Patch by Michal Suchanek [Bug #8121] [ruby-core:53520]
-Wed Apr 15 07:34:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 28 08:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * thread_pthread.c (reserve_stack): keep sp safe zone to get rid
- of crash by -fstack-check. [ruby-core:68740] [Bug #11030]
+ * README.EXT: Update note from r40504, by Jeremy Evans [Bug #7982]
-Tue Apr 14 16:03:49 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Apr 28 08:02:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * tool/merger.rb (versionup): should also increment revision when
- changing teeny.
+ * README.EXT: Add note to warn use of %i in Exceptions [Bug #7982]
-Tue Apr 14 11:24:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 28 02:41:05 2013 Tanaka Akira <akr@fsij.org>
- * ext/-test-/printf/printf.c (uint_to_str): renamed to get rid of
- conflict on cygwin. [ruby-core:68877] [Bug #11065]
+ * configure.in: Fix a typo. Should check endgrent() instead of
+ endgrnam().
-Tue Apr 14 08:59:04 2015 Zachary Scott <e@zzak.io>
+Sun Apr 28 00:35:45 2013 Tanaka Akira <akr@fsij.org>
- * gc.c: [DOC] Improve documentation for ObjectSpace.count_objects
- with regards to `:TOTAL` key, with patch by @schneems [Fixes GH-871]
- https://github.com/ruby/ruby/pull/871 [Bug #11067]
+ * process.c (obj2gid): Don't call endgrent() if not exist.
+ Bionic (Android's libc) don't have endgrent().
-Mon Apr 13 22:44:07 2015 Tanaka Akira <akr@fsij.org>
+ * configure.in: Check endgrnam function.
- * test/lib/envutil.rb (File.mkfifo): Defined using mkfifo command.
+Sat Apr 27 23:53:00 2013 Charlie Somerville <charlie@charliesomerville.com>
- * test/ruby/test_io.rb: Use File.mkfifo.
+ * lib/yaml.rb: add security warning to YAML documentation
- * test/ruby/test_file_exhaustive.rb: Ditto.
+Sat Apr 27 23:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * test/ruby/test_process.rb: Ditto.
+ * lib/yaml.rb: Documentation for YAML module [Bug #8213]
-Mon Apr 13 21:20:20 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Sat Apr 27 20:19:21 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/lib/openssl/ssl.rb: stricter hostname verification
- following RFC 6125. with the patch provided by Tony Arcieri and
- Hiroshi Nakamura [ruby-core:61545] [Bug #9644]
- * test/openssl/test_ssl.rb: add tests for above.
+ * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
+ This fixes a compilation failure while cross-compiling for Tensilica
+ Xtensa Processor.
-Sun Apr 12 18:40:04 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sat Apr 27 19:32:44 2013 Benoit Daloze <eregontp@gmail.com>
- * ext/json/json.gemspec: bump version to 1.8.2.
- * ext/json/lib/json/version.rb: ditto.
+ * thread.c: fix typos and documentation
-Sun Apr 12 18:12:07 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sat Apr 27 19:04:55 2013 Tanaka Akira <akr@fsij.org>
- * ext/json/json.gemspec, lib/rdoc/rdoc.gemspec: added gemspec directly.
- * defs/default_gems, tool/rbinstall.rb: removed default_gems definition.
- it make simple installation for default gems.
+ * sparc.c: Use __asm__ instead of asm for gcc.
+ gcc doesn't provide asm keyword if -ansi option is given.
+ http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
-Sun Apr 12 17:35:17 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sat Apr 27 17:22:50 2013 Tanaka Akira <akr@fsij.org>
- * ext/json/*, test/json/*: Reverted r50231. Because it's not
- working with cross-compile environment.
+ * ext/socket/extconf.rb: Redundant test removed.
-Sun Apr 12 15:34:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 27 16:00:10 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (arg): fix segfault by null caused by syntax error.
- [ruby-core:68851] [Bug #10957]
+ * ext/socket/extconf.rb (test_recvmsg_with_msg_peek_creates_fds):
+ Extracted.
-Sun Apr 12 15:11:16 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sat Apr 27 15:50:40 2013 Tanaka Akira <akr@fsij.org>
- * lib/rubygems/test_case.rb: use explicitly exception class and reverted
- to require JSON library for rubygems tests with Ruby 2.2.0 or earlier.
+ * internal.h (SIGNED_INTEGER_TYPE_P): New macro.
+ (SIGNED_INTEGER_MAX): Ditto.
+ (SIGNED_INTEGER_MIN): Ditto.
+ (UNSIGNED_INTEGER_MAX): Ditto.
+ (TIMET_MAX): Use SIGNED_INTEGER_MAX and UNSIGNED_INTEGER_MAX.
+ (TIMET_MIN): Use SIGNED_INTEGER_MIN.
-Sun Apr 12 15:10:18 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (TIMEVAL_SEC_MAX): Use SIGNED_INTEGER_MAX.
+ (TIMEVAL_SEC_MIN): Use SIGNED_INTEGER_MIN.
- * ext/io/wait/wait.c (io_wait_readable): simply returns that IO is
- readable without blocking, but no longer returns EOF.
+Sat Apr 27 10:52:52 2013 Tanaka Akira <akr@fsij.org>
- * ext/io/wait/wait.c (io_ready_p, io_wait_readable): try polling
- first and check FIONREAD optionally to see if EOF.
- [ruby-core:36805] [Feature #4849]
+ * thread.c (TIMEVAL_SEC_MAX, TIMEVAL_SEC_MIN): Consider environments,
+ sizeof(time_t) is smaller than sizeof(tv_sec), such as
+ OpenBSD 5.2 (amd64).
-Sun Apr 12 14:53:23 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Fri Apr 26 23:34:59 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/rubygems/test_case.rb: fixed json load error for rubygems tests.
+ * lib/rexml/text.rb (REXML::Text.normalize): Fix a bug that all
+ entity filters are ignored. [ruby-dev:47278] [Bug #8302]
+ Patch by Ippei Obayashi. Thanks!!!
+ * test/rexml/test_entity.rb (EntityTester#test_entity_filter): Add
+ a test of the above change.
-Sun Apr 12 14:13:28 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Fri Apr 26 22:53:55 2013 Kouhei Sutou <kou@cozmixng.org>
- * gc.c: Document require name for ObjectSpace methods.
- [ci skip][fix GH-860] Patch by @schneems
+ * lib/rexml/element.rb (REXML::Attributes#to_a): Support
+ namespaced attributes. [ruby-dev:47277] [Bug #8301]
+ Patch by Ippei Obayashi. Thanks!!!
+ * test/rexml/test_attributes.rb
+ (AttributesTester#test_to_a_with_namespaces): Add a test of the
+ above change.
-Sun Apr 12 13:54:05 2015 Tanaka Akira <akr@fsij.org>
+Fri Apr 26 21:48:29 2013 Kouhei Sutou <kou@cozmixng.org>
- * test/ruby/test_io.rb: New test that open(fifo) doesn't block other
- threads.
+ * lib/rss/atom.rb (RSS::Atom::Entry): Fix indent of document comment.
-Sun Apr 12 13:52:18 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Fri Apr 26 21:21:17 2013 Kouhei Sutou <kou@cozmixng.org>
- * ext/coverage/coverage.c: Remove extension from require argument.
- [ci skip][fix GH-870] Patch by @yui-knk
+ * lib/rss/maker.rb (RSS::Maker): Fix indent of document comment.
-Sun Apr 12 10:29:14 2015 Eric Wong <e@80x24.org>
+Fri Apr 26 18:41:04 2013 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock):
- support `exception: false'
- * (get_no_exception): move function location
- * ext/socket/socket.c (sock_connect_nonblock):
- support `exception: false'
- * test/openssl/test_pair.rb (test_connect_accept_nonblock_no_exception):
- test `exception: false' on connect,
- rename from `test_accept_nonblock_no_exception'
- * test/socket/test_nonblock.rb (test_connect_nonblock_no_exception):
- new test
+ * ext/socket/extconf.rb: Use a block of enable_config() for
+ --{enable,disable}-close-fds-by-recvmsg-with-peek configure option
-Sun Apr 12 09:57:16 2015 Tanaka Akira <akr@fsij.org>
+Fri Apr 26 18:08:08 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_file_exhaustive.rb: Test a block device on GNU/Linux.
+ * dir.c (dir_set_pos): Fix a compilation error when seekdir() is not
+ exist.
-Sun Apr 12 09:24:03 2015 Tanaka Akira <akr@fsij.org>
+Fri Apr 26 17:41:17 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_file_exhaustive.rb: Test a file not owned.
+ * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
+ This fixes a compilation failure while cross-compiling for ARM.
-Sun Apr 12 09:05:44 2015 Tanaka Akira <akr@fsij.org>
+Fri Apr 26 14:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/fiddle/depend: Fix "Wrong mix of special targets" error with
- OpenBSD make.
+ * lib/rss/atom.rb: Documentation for RSS::Atom based on a patch by
+ Michael Denomy
+ * lib/rss/maker.rb: Documentation for RSS::Maker also by @mdenomy
-Sun Apr 12 09:04:37 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Apr 26 12:41:22 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_file_exhaustive.rb: Windows doesn't support Unix file
- modes.
+ * ext/curses/extconf.rb: Test linkability of curses_version at first.
-Sun Apr 12 08:56:44 2015 Tanaka Akira <akr@fsij.org>
+ * ext/socket/extconf.rb: Test the behavior of fd passing with MSG_PEEK
+ only if recvmsg(), msg_control member, AF_UNIX and SCM_RIGHTS are
+ available.
- * ext/-test-/file/fs.c: OpenBSD needs sys/param.h before sys/mount.h.
+Fri Apr 26 00:07:52 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Sun Apr 12 08:52:01 2015 Tanaka Akira <akr@fsij.org>
+ * lib/rinda/ring.rb (Rinda::RingServer#initialize): accept array
+ arguments of address to specify multicast interface.
- * test/ruby/test_file_exhaustive.rb: Test suid, sgid and sticky file.
+ * lib/rinda/ring.rb (Rinda::RingServer#make_socket): add optional
+ arguments for multicast interface.
-Sat Apr 11 23:48:30 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * test/rinda/test_rinda.rb
+ (TestRingFinger#test_ring_server_ipv4_multicast,
+ TestRingFinger#test_ring_server_ipv6_multicast): add tests for
+ above change.
- * template/fake.rb.in: Don't assign baseruby, Because it's affect to
- Makefile of native gem like json on bundled gems.
+ * test/rinda/test_rinda.rb
+ (TestRingServer#test_make_socket_ipv4_multicast,
+ TestRingServer#test_make_socket_ipv6_multicast): change bound
+ interface address because multicast address is not allowed on Linux
+ or Windows.
+ [ruby-core:53692] [Bug #8159]
-Sat Apr 11 23:33:22 2015 Tanaka Akira <akr@fsij.org>
+Thu Apr 25 23:45:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * file.c (rb_f_test): Consider nsec for "=", "<" and ">" for "test"
- method.
+ * lib/rinda/ring.rb (Rinda::RingServer#initialize): add a socket
+ to @sockets in make_socket() to close sockets on shutdown even if
+ make_socket() is called after initialize.
-Sat Apr 11 23:26:05 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rinda/ring.rb (Rinda::RingServer#make_socket): ditto.
- * tool/rbinstall.rb: support destdir for native extension gem.
+Thu Apr 25 23:39:42 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Sat Apr 11 21:02:06 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/rinda/test_rinda.rb (TupleSpaceProxyTest#test_take_bug_8215):
+ use KILL on Windows since TERM doen't work and ruby process remains
+ after test-all on Windows.
- * test/ruby/test_file_exhaustive.rb
- (TestFileExhaustive#test_stat_socket_p): r50226 accidentally missed
- the guard for non-unix environments.
+Thu Apr 25 23:16:28 2013 Tanaka Akira <akr@fsij.org>
-Sat Apr 11 20:14:21 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * ext/curses/extconf.rb: Implement
+ --with-curses-version={function,variable} configure option for
+ cross-compiling.
- * ext/json/*, test/json/*, defs/default_gems: Gemify JSON library.
- [fix GH-867][Feature #11057]
- * test/ruby/test_extlibs.rb: removed json gem from existence extensions.
- * gems/bundled_gems: added json gem into bundled gem.
- * lib/rdoc/rubygems_hook.rb: ignored no json environment.
- * lib/rubygems/test_case.rb, test/rubygems/*: ditto.
- * lib/rdoc/test_case.rb, test/rdoc/*: ditto.
+Thu Apr 25 18:15:46 2013 Tanaka Akira <akr@fsij.org>
-Sat Apr 11 15:56:58 2015 Tanaka Akira <akr@fsij.org>
+ * ext/socket/extconf.rb: Don't use WIDE getaddrinfo by default.
- * test/ruby/test_file_exhaustive.rb: Create sample files lazily.
+Thu Apr 25 17:56:39 2013 Tanaka Akira <akr@fsij.org>
-Sat Apr 11 14:03:47 2015 Tanaka Akira <akr@fsij.org>
+ * ext/socket/extconf.rb: Remove obsolete options: ---with-ipv6-lib and
+ --with-ipv6-libdir.
- * test/ruby/test_file_exhaustive.rb: Test character device using
- /dev/null.
+Thu Apr 25 17:43:49 2013 Tanaka Akira <akr@fsij.org>
-Sat Apr 11 10:59:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/extconf.rb: Implement
+ --{enable,disable}-close-fds-by-recvmsg-with-peek configure option
+ for cross-compiling.
+ Make --{enable,disable}-wide-getaddrinfo configure option
+ cross-compiling friendly.
- * lib/mkmf.rb (append_cppflags, append_cflags, append_ldflags):
- utility methods to append compiler options.
+Thu Apr 25 16:11:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Apr 11 08:22:24 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * io.c (rb_io_ext_int_to_encs, parse_mode_enc): bom-prefixed name is
+ not a real encoding name, just a fallback. so the proper conversion
+ should take place even if if the internal encoding is equal to the
+ bom-prefixed name, unless actual encoding is equal to the internal
+ encoding. [ruby-core:54563] [Bug #8323]
- * lib/rdoc/text.rb: removed duplicated code.
+ * io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM
+ found. [ruby-core:54569]
-Sat Apr 11 04:46:42 2015 Eric Wong <e@80x24.org>
+Thu Apr 25 14:35:01 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/net/protocol.rb (rbuf_fill): avoid exception with read_nonblock
- [ruby-core:68787] [Feature #11044]
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): allow Fixnum and Bignum.
+ [ruby-core:53986] [Feature #8217]
-Fri Apr 10 23:57:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 25 14:26:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * dir.c (need_normalization): use getattrlist() if fgetattrlist()
- is unavailable, on OSX 10.5. [ruby-core:68829] [Bug #11054]
+ * lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
+ It gets encoding argument to specify the character encoding.
+ It now allows loose percent encoded strings, but denies ;-separator.
+ [ruby-core:53475] [Bug #8103]
-Fri Apr 10 22:29:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
+ It gets encoding argument to convert before percent encode.
+ Now UTF-16 strings aren't converted to UTF-8 before percent encode
+ by default.
- * lib/mkmf.rb (try_compile): pass the given werror flag to try_do
- to check if stderr is empty.
+Wed Apr 25 14:26:00 2013 Charlie Somerville <charlie@charliesomerville.com>
- * lib/mkmf.rb (try_cflags, try_ldflags): default werror to true.
+ * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift
- * win32/Makefile.sub (WERRORFLAG): remove useless option. VC does
- not make warnings of unknown command option an error.
+ * hash.c (rb_hash_shift): use st_shift if hash is not being iterated to
+ delete element without iterating the whole hash.
-Fri Apr 10 19:34:24 2015 Tanaka Akira <akr@fsij.org>
+ * hash.c (shift_i): remove function
- * test/ruby/test_file_exhaustive.rb: Test socket.
+ * include/ruby/st.h (st_shift): add st_shift function
-Fri Apr 10 19:38:46 2015 Koichi Sasada <ko1@atdot.net>
+ * st.c (st_shift): ditto
- * test/objspace/test_objspace.rb: remove debug prints.
+ [Bug #8312] [ruby-core:54524] Patch by funny-falcon
-Fri Apr 10 19:35:51 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 25 12:03:38 2013 Tanaka Akira <akr@fsij.org>
- * ext/objspace/objspace.c: add ObjectSpace.count_imemo_objects method
- to count imemo objects for each type.
+ * ext/socket/extconf.rb: Extract C programs as toplevel constants.
- * test/objspace/test_objspace.rb: add a test.
+Thu Apr 25 02:23:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * NEWS: describe about this addition.
+ * configure.in (RUBY_RM_RECURSIVE): this hack is needed by only
+ autoconf 2.69 or earlier on darwin.
-Fri Apr 10 19:34:24 2015 Tanaka Akira <akr@fsij.org>
+Thu Apr 25 01:22:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_file_exhaustive.rb: Test anonymous pipe.
+ * lib/tracer.rb (get_line): simply read by File.readlines.
-Fri Apr 10 19:31:56 2015 Tanaka Akira <akr@fsij.org>
+ * lib/debug.rb (script_lines): get source lines from SCRIPT_LINES__ or
+ read from the file.
- * test/ruby/test_file_exhaustive.rb: Test named pipe.
+ * lib/debug.rb (display_list): use script_lines instead of recursion.
+ [Bug #8318]
-Fri Apr 10 19:10:34 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/debug.rb (line_at): use script_lines same as display_list.
- * ext/objspace/objspace.c (setup_hash): unify common routine.
+ * lib/debug.rb (display_list): Fix debug listing when called from the
+ same file it has been required. patch by Dario Bertini <berdario AT
+ gmail.com> [Bug #8318] [fix GH-280]
-Fri Apr 10 18:29:49 2015 Tanaka Akira <akr@fsij.org>
+Wed Apr 24 21:51:13 2013 Tanaka Akira <akr@fsij.org>
- * process.c (rb_execarg_parent_start1): Handle EINTR.
+ * configure.in: Check mblen().
+ mblen() is optional in uClibc.
-Fri Apr 10 17:27:58 2015 Koichi Sasada <ko1@atdot.net>
+ * eval_intern.h (CharNext): Don't use mblen() is not available.
- * vm.c (vm_exec): check other events when RETURN is thrown.
- [Bug #10724]
+Wed Apr 24 15:55:06 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * test/ruby/test_settracefunc.rb: add a test.
+ * io.c (rb_fd_fix_cloexec): use rb_update_max_fd().
-Fri Apr 10 11:44:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 24 14:08:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/date/extconf.rb: check warnings.
+ * numeric.c: Fix wiki link on Float imprecision in overview, patched
+ by Makoto Kishimoto [Bug #8304] [ruby-dev:47280]
- * lib/mkmf.rb (try_cflags): pass options to try_compile.
+Wed Apr 24 14:03:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/Makefile.sub (WERRORFLAG): make unknown command line
- options an error.
+ * parse.y (parser_yylex): disallow $- without following identifier
+ character. [ruby-talk:406969]
-Fri Apr 10 08:00:17 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * parse.y (is_special_global_name): mere $- is not a valid global
+ variable name.
- * test/ruby/test_process.rb: unfortunately, windows is not POSIX...
- cygwin has mkfifo command, but it does not affect system-wide.
+Wed Apr 24 13:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Apr 10 02:18:53 2015 Tanaka Akira <akr@fsij.org>
+ * string.c: Document String#setbyte return value by @gjmurakami-10gen
+ [Fixes GH-294]
- * test/ruby/test_process.rb: Use mkfifo command instead of mknod
- command to create a named pipe. mkfifo command is defined by POSIX.
+Wed Apr 24 13:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Apr 10 01:29:05 2015 Tanaka Akira <akr@fsij.org>
+ * class.c: Example of Object#methods by @windwiny [Fixes GH-293]
+ * ruby.c: Document return values of Kernel #sub, #gsub, and #chop
- * process.c: Release GVL when opening a file in spawn() to avoid whole
- process blocking when opening a named pipe.
- (open_func): New function.
- (rb_execarg_parent_start1): Extracted from rb_execarg_parent_start and
- use rb_thread_call_without_gvl2 to release GVL when opening a file.
- (rb_execarg_parent_start): Invoke rb_execarg_parent_start1 via
- rb_protect and invoke rb_execarg_parent_end when error.
+Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Apr 9 22:19:19 2015 Tanaka Akira <akr@fsij.org>
+ * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
- * process.c (redirect_open): Removed.
-Thu Apr 9 21:38:20 2015 Tanaka Akira <akr@fsij.org>
+Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * internal.h (rb_execarg_parent_end): Declared.
+ * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
- * process.c: "spawn" opens files in the parent process.
- (check_exec_redirect): Add an placeholder for fd in parameters
- for fd_open.
- (check_exec_fds_1): Delete fd_open condition.
- (check_exec_fds): Don't call check_exec_fds_1 with fd_open.
- (rb_execarg_parent_start): Open files specified as "spawn" options
- and add "dup2" options.
- (rb_execarg_parent_end): New function to close opened fds.
- (run_exec_open): Removed.
- (rb_execarg_run_options): Don't call run_exec_open.
- (rb_spawn_internal): Call rb_execarg_parent_end.
+Wed Apr 24 12:27:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * io.c (pipe_open): Call rb_execarg_parent_end.
+ * array.c: Fix documentation for Array#index and #replace aliases
+ Based on a patch by @phiggins [Fixes GH-282]
- * ext/pty/pty.c (establishShell): Call rb_execarg_parent_end.
+Tue Apr 23 21:14:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Apr 9 20:52:31 2015 Tanaka Akira <akr@fsij.org>
+ * string.c (rb_str_inspect): refix r40413, on Ruby 1.9 usual character
+ escape uses hex/Unicode escapes, so fix to use Unicode escape on
+ Unicode strings and hex on others. [ruby-core:54458] [Bug #8290]
- * internal.h (rb_execarg_parent_start): Renamed from rb_execarg_fixup.
+Tue Apr 23 20:10:02 2013 Tanaka Akira <akr@fsij.org>
- * process.c: Follows the above change.
+ * missing/isnan.c (isnan): Don't define if isnan() macro is defined.
+ This fixes a compilation failure on uClibc based Gentoo system.
- * io.c: Ditto.
+Tue Apr 23 17:40:40 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
- * ext/pty/pty.c: Ditto.
+ * lib/rexml/document.rb, lib/rexml/element.rb,
+ lib/rexml/formatters/pretty.rb: remove opinionated
+ language in documentation. [Bug #8309],
+ reported by Charles Beckmann
-Thu Apr 9 20:35:12 2015 Tanaka Akira <akr@fsij.org>
+Tue Apr 23 14:04:44 2013 Shugo Maeda <shugo@ruby-lang.org>
- * process.c (fd_clear_cloexec): Extracted from run_exec_dup2.
+ * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
+ response correctly. [ruby-core:54365] [Bug #8281]
-Thu Apr 9 09:26:47 2015 Eric Wong <e@80x24.org>
+Tue Apr 23 11:58:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ccan/list/list.h: sync with ccan upstream
- [ccan commit c2fbfe5282ba264f3485586e7efa8a5967f2d386]
+ * string.c (rb_str_scrub): fix for UTF-32. strlen() on strings
+ contain NUL returns wrong result, use sizeof operator instead.
+ [ruby-dev:45975] [Feature #6752]
-Thu Apr 9 08:24:03 2015 Masahiro Tomita <tommy@tmtm.org>
+Tue Apr 23 10:26:50 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/socket/raddrinfo.c (addrinfo_mload): fix memory leak of
- addrinfo. [ruby-dev:48923] [Bug #11051]
+ * test/ruby/test_module.rb
+ (TestModule#test_const_get_invalid_name)
+ (test_const_defined_invalid_name): Fix expected values.
-Wed Apr 8 17:45:02 2015 Shannon Skipper <shannonskipper@gmail.com>
+Tue Apr 23 09:51:26 2013 Akinori MUSHA <knu@iDaemons.org>
- * version.c (Init_version): the version of the engine or
- interpreter. [Fix GH-858]
+ * string.c (rb_str_inspect): NUL should not be represented as "\0"
+ when octal digits may follow. [ruby-core:54458] [Bug #8290]
-Wed Apr 8 16:15:30 2015 Kenta Murata <mrkn@cookpad.com>
+Mon Apr 22 22:54:00 2013 Charlie Somerville <charlie@charliesomerville.com>
- * bigdecimal: conform to ruby's license. [ruby-core:68466] [Bug #10952]
+ * insns.def (opt_mod): Use % operator if both operands are positive for
+ a significant performance improvement. Thanks to @samsaffron.
-Wed Apr 8 14:57:06 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Apr 22 17:09:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (rb_w32_wreadlink): should treat junctions like as
- symlinks.
+ * marshal.c (r_object0): copy all instance variables not only generic
+ ivars, before calling post proc. [ruby-core:51163] [Bug #7627]
-Wed Apr 8 14:03:47 2015 Koichi Sasada <ko1@atdot.net>
+Mon Apr 22 10:25:21 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/ruby/test_symbol.rb: fix syntax error.
+ * util.c (ruby_hdtoa): revert r29729.
+ If you want ruby to behave as before on x86, specify to use SSE like
+ -msse2 -mfpmath=sse for gcc.
-Wed Apr 8 13:01:06 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 21 23:19:00 2013 Charlie Somerville <charlie@charliesomerville.com>
- * hash.c (rb_any_hash): Symbols are compared by the identities
- always. [ruby-core:68767] [Bug #11035]
+ * configure.in: Revert using sigsetjmp by default due to performance
+ problems on some systems (eg. older Linux)
-Tue Apr 7 10:22:51 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sun Apr 21 21:35:00 2013 Charlie Somerville <charlie@charliesomerville.com>
- * internal.h: fix typo. Patch by @sferik [fix GH-865]
+ * configure.in: Use sigsetjmp by default so jumping out of signal
+ handlers properly restores the signal mask and SS_ONSTACK flag.
+ [ruby-core:54175] [Bug #8254]
-Mon Apr 6 22:52:35 2015 Tanaka Akira <akr@fsij.org>
+ * configure.in: Manually check for presence of sigsetjmp. It is not a
+ function on some systems, so AC_CHECK_FUNCS cannot be used.
- * enum.c: Enumerable#chunk and Enumerable#slice_before no longer takes
- the initial_state argument. [Feature #10958]
+Sun Apr 21 08:00:55 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 6 16:09:58 2015 Koichi Sasada <ko1@atdot.net>
+ * test/csv/test_features.rb, test/logger/test_logger.rb
+ test/mkmf/test_have_macro.rb, test/net/http/test_http.rb,
+ test/openssl/test_config.rb, test/psych/test_encoding.rb,
+ test/psych/test_exception.rb, test/psych/test_psych.rb,
+ test/psych/test_tainted.rb, test/readline/test_readline.rb,
+ test/rexml/test_contrib.rb, test/ruby/test_autoload.rb,
+ test/ruby/test_beginendblock.rb, test/ruby/test_exception.rb,
+ test/ruby/test_file.rb, test/ruby/test_io.rb,
+ test/ruby/test_marshal.rb, test/ruby/test_process.rb,
+ test/ruby/test_require.rb, test/ruby/test_rubyoptions.rb,
+ test/syslog/test_syslog_logger.rb, test/webrick/test_httpauth.rb,
+ test/zlib/test_zlib.rb: Use Tempfile.create.
- * vm_args.c: protect value stack from calling other methods
- during complex parameter setting process (splat, kw, and so on).
- [Bug #11027]
+Sun Apr 21 00:15:36 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h: remove rb_thread_t::mark_stack_len.
- With this modification, we don't need to use th->mark_stack_len.
+ * lib/tempfile.rb (Tempfile.create): Close when the block exits.
- * test/ruby/test_keyword.rb: add a test.
+Sat Apr 20 23:38:14 2013 Tanaka Akira <akr@fsij.org>
- * cont.c (cont_capture): catch up this fix.
+ * lib/webrick/httpauth/htpasswd.rb: Use Tempfile.create to avoid
+ unintentional unlink() by the finalizer.
+ lib/webrick/httpauth/htdigest.rb: Ditto.
- * vm.c (rb_thread_mark): ditto.
+Sat Apr 20 22:47:48 2013 Tanaka Akira <akr@fsij.org>
-Mon Apr 6 11:26:42 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/tempfile.rb (Tempfile.create): New method.
+ The method name is proposed by Shugo Maeda. [ruby-dev:47220]
+ [ruby-core:41478] [Feature #5707]
- * tool/downloader.rb (http_options): prevent content auto decoding
- because this is a downloader.
+Sat Apr 20 14:22:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Apr 5 09:55:18 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * marshal.c (w_object): dump no ivars to the original by marshal_dump.
+ [ruby-core:54334] [Bug #8276]
- * doc/contributing.rdoc: update Maintainers list.
+ * marshal.c (r_object0): copy all ivars of marshal_dump data to the
+ result object instead. [ruby-core:51163] [Bug #7627]
-Sun Apr 5 09:11:00 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sat Apr 20 02:33:27 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * tool/rbinstall.rb: fix bin script permission of bundled gems.
+ * string.c (str_scrub): add ruby method String#scrub which verify and
+ fix invalid byte sequence. [ruby-dev:45975] [Feature #6752]
-Sun Apr 5 08:46:08 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * string.c (str_compat_and_valid): check given string is compatible
+ and valid with given encoding.
- * tool/rbinstall.rb: support --program-suffix option.
+ * transcode.c (str_transcode0): If invalid: :replace is specified for
+ String#encode, replace invalid byte sequence even if the destination
+ encoding equals to the source encoding.
-Sat Apr 4 21:31:18 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Fri Apr 19 21:55:40 2013 Kouhei Sutou <kou@cozmixng.org>
- * lib/rake/*: Gemify rake [fix GH-862][Feature #11025]
- * test/rake/*: ditto.
- * tool/rbinstall.rb: ditto.
+ * README.EXT.ja (Data_Wrap_Struct): Remove a description about
+ orphan argument. Oh, I renamed the argument name without
+ changing description at r36180... Sorry....
+ Patch by Makoto Kishimoto. Thanks!!! [ruby-dev:47269] [Bug #8292]
+ * README.EXT.ja (Data_Make_Struct): Add a sample code that describes
+ how it works.
+ Patch by Makoto Kishimoto. Thanks!!! [ruby-dev:47269] [Bug #8292]
-Sat Apr 4 11:30:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 19 17:54:57 2013 Shugo Maeda <shugo@ruby-lang.org>
- * string.c (rb_str_setbyte): check the argument first not to
- discard shared string and code range unnecessarily until
- actually changing the contents. pointed out by headius.
+ * lib/net/imap.rb (body_type_msg): should accept
+ message/delivery-status with extra data.
+ [ruby-core:53741] [Bug #8167]
-Sat Apr 4 08:16:43 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/net/imap/test_imap_response_parser.rb: related test.
- * lib/net/http.rb (edit_path): use path which is absolute ftp url
- on using ftp_proxy.
+Fri Apr 19 13:03:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Apr 3 11:43:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * marshal.c (w_object): do not dump encoding which is dumped with
+ marshal_dump data. [ruby-core:54334] [Bug #8276]
- * vm_eval.c (vm_call0_cfunc): update invoker arguments.
+Fri Apr 19 11:36:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c (vm_call_cfunc_latter): ditto.
+ * configure.in (stack_protector): control use of -fstack-protector.
- * vm_insnhelper.c (rb_vm_call_cfunc_push_frame): ditto, and prefix
- with rb_.
+ * configure.in (debugflags): let -fstack-protector precede and disable
+ debugflags, because they can't work together on SmartOS. [Bug #8268]
-Thu Apr 2 16:26:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 19 07:43:52 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * common.mk, tool/mkconfig.rb: check the running ruby version in
- rbconfig.rb with the program version, as RUBY_VERSION has never
- been affected by --with-ruby-version option.
- [ruby-core:68639] [Bug #11002]
+ * test/openssl/test_cipher.rb: Correct a typo
+ by jgls <joerg@joergleis.com>
+ https://github.com/ruby/ruby/pull/291 fix GH-291
- * configure.in (LIBRUBY_DLDFLAGS): compatibility_version must be
- valid version numbers, not an arbitrary string.
+Thu Apr 18 16:58:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Apr 1 11:09:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_method.c (rb_mod_public_method): fix visibility on anonymous
+ module. set visibility of singleton method, not method in base
+ class. [ruby-core:54404] [Bug #8284]
- * dir.c (push_glob): remove indirect links of arguments for
- trampoline.
+Thu Apr 18 16:20:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Apr 1 09:59:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * dir.c (glob_helper): should skip dot directories only for recursion,
+ but should not if matching to the given pattern. [ruby-core:54387]
+ [Bug #8283]
- * lib/fileutils.rb (FileUtils#mv): show the exact target path in
- the error message instead of the destination parent directory
- name. patched by Joao Britto <jabcalves AT gmail.com> at
- [ruby-core:68706]. [Bug #11021]
+Thu Apr 18 16:20:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Mar 31 15:25:07 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * pack.c (pack_unpack): increase buffer size to fix buffer overflow,
+ and fix garbage just after unpacking without missing paddings.
+ [Bug #8286]
- * doc/ChangeLog-0.06_to_0.52: added archived Changelog.
- [ruby-list:50105]
- * doc/ChangeLog-0.50_to_0.60: ditto.
- * doc/ChangeLog-0.60_to_1.1: ditto.
+Thu Apr 18 13:35:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Mar 30 22:02:55 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * pack.c (pack_unpack): output characters even if the input doesn't
+ have paddings. [Bug #8286]
- * README.EXT.ja: add redirect [ruby-core:68631]
+Thu Apr 18 08:20:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Mar 30 14:42:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * common.mk (clean-ext): remove timestamps.
- * win32/win32.c (fileattr_to_unixmode, winnt_lstat): deal with
- symbolic link than directory, and set executable bits.
+Wed Apr 17 22:07:50 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 30 11:27:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/rubysocket.h (SOCKLEN_MAX): Expression simplified.
- * io.c (copy_stream_body): use the arguments without conversion if
- having read, readpartial, and write methods, than conversion by
- to_path method. [ruby-core:68676] [Bug #11015]
+Wed Apr 17 20:09:19 2013 Aman Gupta <ruby@tmm1.net>
-Sun Mar 29 21:08:37 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().
- * gc.c (objspace_allrefs_destruct_i): fix a typo.
- [Bug #11013]
+ * insns.def (setinlinecache): Ditto.
-Sun Mar 29 11:51:32 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * iseq.c (rb_iseq_add_mark_object): New function to allocate
+ iseq->mark_ary on demand. [Bug #8142]
- * proc.c (proc_binding): replicate env from method object, and
- allocate the local variable area for the iseq local table.
- [ruby-core:68673] [Bug #11012]
+ * iseq.h (rb_iseq_add_mark_object): Ditto.
-Sat Mar 28 09:19:41 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.
- * ext/date/extconf.rb: try_cflags("-std=iso9899:1999") [Bug #10906]
- ruby itself (including numeric.c) is built with strict compile
- options including -std=iso9899:1999, but ext/date is not.
- By the way -std=iso9899:1999 is not only a warning option but also
- changes behavior like MACRO definitions for example INFINITY.
- gcc on Solaris affect this.
+ * iseq.c (rb_iseq_build_for_ruby2cext): Ditto.
-Fri Mar 27 16:34:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 17 20:00:18 2013 Tanaka Akira <akr@fsij.org>
- * common.mk: revert using BOOTSTRAPRUBY for enc.mk, as
- enc/depend uses CONFIG. [ruby-core:68647] [Bug #11004]
+ * ext/socket/rubysocket.h (SOCKLEN_MAX): Defined.
-Thu Mar 26 10:05:13 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * ext/socket/raddrinfo.c (ext/socket/raddrinfo.c): Reject too long
+ Linux abstract socket name.
- * test/test_observer.rb: add tests for Observable module.
- [fix GH-859] Patch by @brightbits
+Wed Apr 17 19:45:27 2013 Aman Gupta <tmm1@ruby-lang.org>
-Thu Mar 26 06:35:10 2015 Eric Wong <e@80x24.org>
+ * iseq.c (iseq_location_setup): re-use existing string when iseq has
+ the same path and absolute_path. [Bug #8149]
- * README.EXT: add redirect [ruby-core:68631]
+Wed Apr 17 11:38:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 25 16:46:49 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
+ UNASSIGNED is not a valid message.
- * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state,
- but it is a dummy.
+Wed Apr 17 10:58:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/option.c: Solaris 11 doesn't have u_intN_t.
+ * thread.c (sleep_timeval): get rid of overflow on Windows where
+ timeval.tv_sec is not time_t but mere long.
- * ext/socket/option.c: Solaris 11 needs inspect_tcpi_msec.
+Tue Apr 16 23:07:12 2013 Tanaka Akira <akr@fsij.org>
- * ext/socket/raddrinfo.c: Solaris 11 has AF_PACKET but doesn't have
- related macros.
+ * ext/socket/unixsocket.c (unix_send_io): Suppress a warning by clang.
+ (unix_recv_io): Ditto.
-Wed Mar 25 17:03:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 16 12:27:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/-test-/file/fs.c (get_fsname): try magic number only if
- f_type is included. [ruby-dev:48913] [Bug #11000]
+ * ext/sdbm/init.c: Fix comment indentation, by windwiny [Fixes GH-277]
-Wed Mar 25 11:20:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 16 12:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * benchmark/bm_hash_aref_flo.rb: make more realistic data.
- [ruby-core:68632] [[Bug #10999]
+ * ext/socket/option.c: Document synonymous methods, by windwiny [GH-277]
+ * ext/stringio/stringio.c: ditto
+ * ext/io/wait/wait.c: ditto
+ * ext/gdbm/gdbm.c: ditto
+ * ext/dl/cfunc.c: ditto
+ * ext/zlib/zlib.c: ditto
+ * ext/win32ole/win32ole.c: ditto
+ * ext/dbm/dbm.c: ditto
+ * ext/json/generator/generator.c: ditto
+ * ext/date/date_core.c: ditto
-Wed Mar 25 10:39:06 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Apr 16 11:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * .document: removed needless entries.
+ * ext/openssl/*: Document synonymous methods, by windwiny [GH-277]
-Wed Mar 25 08:07:28 2015 Eric Wong <e@80x24.org>
+Mon Apr 15 22:21:42 2013 Tanaka Akira <akr@fsij.org>
- * doc/extension.rdoc: fix spelling of filename
- * doc/extension.ja.rdoc: ditto.
+ * ext/fiddle/depend: New file.
-Tue Mar 25 06:55:43 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+Mon Apr 15 22:01:02 2013 Akinori MUSHA <knu@iDaemons.org>
- * complex.c (k_inexact_p, k_exact_zero_p): use k_exact_zero_p macro
- to remove k_inexact_p macro.
+ * misc/ruby-electric.el (ruby-electric-insert): Check
+ ruby-electric-is-last-command-char-expandable-punct-p here.
- * complex.c (k_exact_one_p): remove unused macro k_exact_one_p.
+ * misc/ruby-electric.el (ruby-electric-closing-char): New
+ interactive function bound to closing characters. Typing one of
+ those closing characters right after the matching counterpart
+ cancels the effect of automatic closing. For example, typing
+ "{" followed by "}" simply makes "{}" instead of "{ } }".
-Tue Mar 24 22:23:33 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Mon Apr 15 12:54:42 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
- * doc/extension.rdoc: move from toplevel document and added extname.
- * doc/extension.ja.rdoc: ditto.
+ * ext/openssl/ossl_ssl.c: Correct shutdown behavior w.r.t GC.
-Tue Mar 24 22:06:58 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * test/openssl/test_ssl.rb: Add tests to verify correct behavior.
- * doc/standard_library.rdoc: strip.
+ [Bug #8240] Patch provided by Shugo Maeda. Thanks!
-Tue Mar 24 22:06:27 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Mon Apr 15 10:23:39 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * doc/standard_library.rdoc: move Thread to Extensions.
+ * ext/coverage/depend: fix id.h place as r40283.
-Tue Mar 24 21:59:10 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * ext/coverage/extconf.rb: add topdir and topsrcdir to VPATH.
- * doc/contributing.rdoc: update Maintainers list.
+Sun Apr 14 19:46:14 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 24 19:10:24 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/-test-/debug/depend: New file.
- * gc.c (gc_writebarrier_generational): fix messages for rb_bug().
- Remove `rb_' prefix.
+ * ext/-test-/exception/depend: Ditto.
- * gc.c (gc_writebarrier_incremental): ditto.
+ * ext/-test-/printf/depend: Ditto.
-Tue Mar 24 17:34:01 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/-test-/string/depend: Ditto.
- * README.ja.md: should be chunibyo.
+ * ext/coverage/depend: Ditto.
-Tue Mar 24 17:30:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/io/console/depend: Ditto.
- * ext/-test-/file/fs.c (get_fsname): return filesystem name by
- statfs/statvfs. [ruby-core:68624] [Bug #10998]
+ * ext/io/nonblock/depend: Ditto.
-Tue Mar 24 16:46:02 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * ext/io/wait/depend: Ditto.
- * tool/redmine-backporter.rb: now doesn't required spaces just after
- `!`.
+ * ext/openssl/depend: Ditto.
-Mon Mar 23 23:18:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/pathname/depend: Ditto.
- * dir.c (dir_close): don't raise on double close for consistent to
- IO#close. [Feature #10950]
+ * ext/psych/depend: Ditto.
-Mon Mar 23 21:22:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/zlib/depend: Ditto.
- * win32/file.c (rb_readlink): move from file.c for better buffer
- allocation and the result encoding.
+Sun Apr 14 02:46:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * win32/win32.c (wreadlink, rb_w32_ureadlink): implement readlink().
+ * lib/mkmf.rb (MakeMakefile#create_makefile): remove {$(VPATH)} other
+ than nmake.
-Mon Mar 23 14:40:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/ripper/depend: use VPATH expecting removed by above.
- * win32/win32.c (winnt_stat): stat with following symbolic links.
+Sat Apr 13 23:06:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (winnt_lstat): rename old winnt_stat, which does
- not follow symbolic links.
+ * lib/mkmf.rb (timestamp_file): gather timestamp files in one
+ directory from each extension directories.
-Mon Mar 23 01:44:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 13 21:09:02 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * marshal.c (r_symreal): register symbol names as strings first so
- that r_symlink always returns valid names.
- [ruby-core:68587] [Bug #10991]
+ * lib/mkmf.rb (MakeMakefile#create_makefile): output new macro
+ disthdrdir to specify the path of id.h, parse.h and etc.
- * marshal.c (r_ivar, r_object0): now need to intern symbol names.
+ * ext/ripper/depend: use above macro.
- * marshal.c (r_object0): compare with symbol names.
+Sat Apr 13 20:28:08 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Mar 22 22:07:40 2015 Kouhei Sutou <kou@cozmixng.org>
+ * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
+ [bug] fix problem with optimization of \z (Issue #16) [Bug #8210]
- * doc/etc.rd.ja: Fix wrong coding for Emacs.
+Sat Apr 13 18:56:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun Mar 22 09:53:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/ripper/depend: parse.h and id.h may be created on topdir.
- * tool/make-snapshot (package): add default CONFIGURE name to
- follow r50039.
+Sat Apr 13 12:08:16 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * tool/make-snapshot (package): substitute configuration variables
- in Makefile.in instead of passing by the command line, and make
- temporary Makefile instead of a pipe.
+ * lib/matrix.rb: Add Vector#cross_product, patch by Luis Ezcurdia
+ [fix GH-276] [rubyspec:81eec89a124]
-Sun Mar 22 08:09:47 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 13 10:20:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk (ext/ripper/ripper.c, ext/rbconfig/sizeof/sizes.c):
- strip autogenerated dependencies which have invalid syntax in
- other than nmake.
+ * struct.c (rb_struct_define_without_accessor, rb_struct_define),
+ (rb_struct_s_def): hide member names array.
-Sat Mar 21 15:01:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * struct.c (anonymous_struct, new_struct, setup_struct): split
+ make_struct() for each purpose.
- * ext/io/console/console.c (console_set_winsize): use handle for
- writing. GetConsoleScreenBufferInfo seems failing on a handle
- for reading.
+Sat Apr 13 09:34:31 2013 Tanaka Akira <akr@fsij.org>
- * io.c: [DOC] update the example of IO#winsize to use $stdout
- instead of $stdin, which does not work on Windows. a patch by
- Jan Lelis <mail AT janlelis.de> at [ruby-core:68574].
- [Bug #10986]
+ * lib/mkmf.rb: Add ruby/ruby.h, ruby/missing.h, ruby/intern.h,
+ ruby/st.h and ruby/subst.h for ruby_headers in generated Makefile.
-Fri Mar 20 18:41:03 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/-test-/old_thread_select/depend: Update dependencies.
- * proc.c (respond_to_missing_p): check if the receiver responds to
- the given method by respond_to_missing?.
+ * ext/-test-/wait_for_single_fd/depend: Ditto.
- * proc.c (mnew_missing): create Method object for method_missing.
- [ruby-core:68564] [Bug #10985]
+ * ext/bigdecimal/depend: Ditto.
-Fri Mar 20 17:43:18 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * ext/curses/depend: Ditto.
- * .travis.yml: enabled email notification.
+ * ext/digest/bubblebabble/depend: Ditto.
-Fri Mar 20 17:39:52 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * ext/digest/depend: Ditto.
- * .travis.yml: removed Ruby 1.9.3 build on Travis CI
+ * ext/digest/md5/depend: Ditto.
-Fri Mar 20 12:38:36 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/digest/rmd160/depend: Ditto.
- * gc.c (obj_info): obj_info() can receive internal objects.
+ * ext/digest/sha1/depend: Ditto.
- * gc.c (check_rvalue_consistency): obj_info() returns const char *.
+ * ext/digest/sha2/depend: Ditto.
-Fri Mar 20 12:14:37 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/dl/callback/depend: Ditto.
- * gc.c (obj_info): show class name and T_DATA type_name.
+ * ext/dl/depend: Ditto.
-Thu Mar 19 22:12:46 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/etc/depend: Ditto.
- * gc.c (rb_copy_wb_protected_attribute): `dest' can be WB unprotected.
+ * ext/nkf/depend: Ditto.
-Thu Mar 19 21:25:25 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/objspace/depend: Ditto.
- * gc.c (rb_copy_wb_protected_attribute): demote `dest' object.
+ * ext/pty/depend: Ditto.
-Thu Mar 19 16:18:00 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/readline/depend: Ditto.
- * gc.c, internal.h: export rb_gc_verify_internal_consistency().
+ * ext/ripper/depend: Ditto.
-Thu Mar 19 16:15:24 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/sdbm/depend: Ditto.
- * gc.c (obj_info): show allocation site if GC_DEBUG is not 0.
+ * ext/socket/depend: Ditto.
-Thu Mar 19 16:12:01 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/stringio/depend: Ditto.
- * gc.c (newobj_of): fix RGENGC_OLD_NEWOBJ_CHECK logics.
- * skip on incremental marking because not sure what happen :p
- * rb_gc_writebarrier_remember() is enough to mark children.
+ * ext/strscan/depend: Ditto.
-Thu Mar 19 16:08:42 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/syslog/depend: Ditto.
- * gc.c (rb_copy_wb_protected_attribute): need demote for old objects.
+ * ext/-test-/num2int/depend: Removed.
-Thu Mar 19 10:31:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/dbm/depend: Ditto.
- * random.c (fill_random_bytes): release the handle in the static
- variable, not a local variable.
+ * ext/fcntl/depend: Ditto.
-Thu Mar 19 06:30:35 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/gdbm/depend: Ditto.
- * object.c (rb_obj_clone): do not touch age (FL_PROMOTED[01]) because
- rb_obj_alloc() can return old object in debug.
+ * ext/racc/cparse/depend: Ditto.
-Thu Mar 19 06:29:28 2015 Koichi Sasada <ko1@atdot.net>
+Sat Apr 13 00:15:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/objspace/test_objspace.rb: flag name was changed
- (long_lived -> uncollectible).
+ * ext/etc/etc.c (Init_etc): move Passwd and Group under Etc namespace
+ as primary names.
-Thu Mar 19 05:30:13 2015 Koichi Sasada <ko1@atdot.net>
+Fri Apr 12 21:06:55 2013 Tanaka Akira <akr@fsij.org>
- * iseq.c (iseq_mark): skip some marking if iseq->orig is available.
+ * common.mk: pack.o depends on internal.h.
- * iseq.c (rb_iseq_clone): need WB for iseq1->klass = iseq0->klass
- (done in MEMCPY).
+Fri Apr 12 20:59:24 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 19 04:55:53 2015 Koichi Sasada <ko1@atdot.net>
+ * bignum.c (ones): Use __builtin_popcountl if available.
- * internal.h (IMEMO_DEBUG): added.
+ * internal.h (GCC_VERSION_SINCE): Macro moved from pack.c.
- * internal.h: remove unused FL_IMEMO_MARK_V[0-3].
+ * pack.c: Include internal.h for GCC_VERSION_SINCE.
- * gc.c (rb_imemo_new_debug): added.
+Fri Apr 12 18:29:42 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (obj_info): show imemo type name.
+ * common.mk: version.o depends on $(srcdir)/include/ruby/version.h
+ instead of {$(VPATH)}version.h to avoid confusion by VPATH between
+ top level version.h and include/ruby/version.h for build in-place.
+ [ruby-dev:47249] [Bug #8256]
-Thu Mar 19 04:52:26 2015 Koichi Sasada <ko1@atdot.net>
+Fri Apr 12 15:21:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (RGENGC_OLD_NEWOBJ_CHECK): add check mechanism.
+ * vm_insnhelper.c (vm_callee_setup_keyword_arg): non-symbol key is not
+ a keyword argument, keep it as a positional argument.
- If RGENGC_OLD_NEWOBJ_CHECK > 0, then create old objects
- (not new objects) periodically.
+Fri Apr 12 11:58:00 2013 Zachary Scott <zachary@zacharyscott.net>
- Create one old objects per RGENGC_OLD_NEWOBJ_CHECK objects are
- created.
+ * array.c: Document synonymous methods, by windwiny [GH-277]
+ * bignum.c: ditto
+ * complex.c: ditto
+ * dir.c: ditto
+ * encoding.c: ditto
+ * enumerator.c: ditto
+ * numeric.c: ditto
+ * proc.c: ditto
+ * re.c: ditto
+ * string.c: ditto
-Thu Mar 19 04:46:36 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 11 23:41:46 2013 Tanaka Akira <akr@fsij.org>
- * enum.c (enum_sort_by): add WBs.
+ * common.mk: Add dependencies for include/ruby.h
-Thu Mar 19 03:37:52 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/update-deps: Use "make -p all miniruby ruby golf" to extract
+ dependencies in makefiles.
- * gc.c (check_rvalue_consistency): refactoring.
- * not inline on RGENGC_CHECK_MODE > 0.
- * check SPECIAL_CONST_P(obj) first.
- * add a check that remembered_bit is only TRUE when old (age == 3).
+Thu Apr 11 23:21:17 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (RVALUE_DEMOTE): should clear RVALUE_REMEMBERED bit.
+ * tool/update-deps: Use "make -p all golf" to extract dependencies in
+ makefiles.
- remembered_bit should be TRUE only for old (age == 3) objects.
+Thu Apr 11 21:02:19 2013 Tanaka Akira <akr@fsij.org>
- Actually there are no effect because demoted objects will be
- uncollectible WB unprotected objects (marked at the beginning of
- every minor GC).
+ * common.mk: Dependency updated.
-Thu Mar 19 02:52:48 2015 Koichi Sasada <ko1@atdot.net>
+ * tool/update-deps: Rewritten.
- * gc.c: rename terminologies.
- * long_lived -> uncollectible:
- because this bitmap does not mean "long lived objects in past",
- but means "prohibit collection these objects until next major GC".
+Thu Apr 11 19:59:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
- Uncollectible objects consist of two types objects, one is old
- objects (WB protected objects which age == 3) and another is
- uncollectible WB unprotected objects which are referred from old
- objects
+ * common.mk: partially revert r40183, which breaks building on
+ other than source directory. (its commit log also says the same
+ thing, but such failure is not reproducible on my environment
+ and the commit breaks build on my environment)
- * remembered_wb_unprotected_objects ->
- uncollectible_wb_unprotected_objects:
- because uncollectible objects does not mean remembered objects.
+Thu Apr 11 16:10:01 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Mar 18 17:21:12 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 on
+ Mac OS X and Linux [Bug #3371]
- * gc.c (gc_writebarrier_generational): add an alternative write
- barrier (WB) implementation.
- When finding reference from [Old obj] to [New obj] by WB, current
- implementation marks [Old obj] as remembered old objects and marks
- children of [Old obj] at the beginning of marking.
+Thu Apr 11 13:19:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- Added (but disabled) code changes current behaviour. This fix promote
- [New obj] to old and marks as a remembered old object. We can assume
- "new objects referred from old objects are maybe long-lived old
- objects".
+ * test/drb/drbtest.rb (Drb{Core,Ary}#teardown): retry Process.kill
+ if it fails with Errno::EPERM on Windows (workaround).
+ [ruby-dev:47245] [Bug #8251]
- Disadvantage of added algorithm is we may promote unwilling
- short-lived objects. For example, consider many new objects push and
- pop to an old stack object. All of new objects (short-lived objects)
- promote to old objects unexpectedly.
+Thu Apr 11 11:11:38 2013 Akinori MUSHA <knu@iDaemons.org>
- To compare these behaviour, I add this new code (but disabled it).
+ * dir.c: Fix a typo.
-Wed Mar 18 17:14:39 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 11 10:39:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * gc.c (RVALUE_PROMOTE_RAW): rename to RVALUE_OLD_LONG_LIVED_SET()
- to make clear.
+ * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): add missing case:
+ RUBY_LIBFFI_MODVERSION is not defined (usually on Windows).
-Wed Mar 18 17:10:01 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 11 09:27:04 2013 Konstantin Haase <me@rkh.im>
- * gc.c (check_rvalue_consistency): do not need to check is_sweeping().
+ * dir.c (file_s_fnmatch): Document File::FNM_EXTGLOB flag.
-Wed Mar 18 14:13:22 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 11 09:17:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * benchmark/bm_vm1_gc_wb_ary.rb: run GC to finish "marking" phase.
+ * README: Fix typo by Benjamin Winkler [Fixes GH-281]
- * benchmark/bm_vm1_gc_wb_obj.rb: ditto.
+Thu Apr 11 06:15:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * benchmark/bm_vm1_gc_wb_ary_promoted.rb: add parameter
- full_mark: false to invoke only minor GC.
+ * regint.h: fix typo: _M_AMD86 -> _M_AMD64.
- * benchmark/bm_vm1_gc_wb_obj_promoted.rb: ditto.
+ * siphash.c: ditto.
-Wed Mar 18 12:07:36 2015 Koichi Sasada <ko1@atdot.net>
+ * st.c: ditto.
- * string.c: add a comment about RSTRING_FSTR.
+Thu Apr 11 06:09:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Mar 18 12:01:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/fiddle/extconf.rb: define RUBY_LIBFFI_MODVERSION macro.
- * hash.c (rb_any_hash): use same hash values with Float#hash so
- that -0.0 and +0.0 will be identical.
- [ruby-core:68541] [Bug #10979]
+ * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 or 1
+ with platform and libffi's version. [Bug #3371]
-Wed Mar 18 05:34:32 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 11 05:30:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * string.c: introduce STR_FAKESTR to show string is FAKESTR or not.
+ * lib/mkmf.rb (pkg_config): Add optional argument "option".
+ If it is given, it returns the result of
+ `pkg-config --<option> <pkgname>`.
- * string.c (STR_SET_SHARED): ignore FAKESTR because only Ruby objects
- can use write barrier.
+Thu Apr 11 03:33:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Mar 17 18:59:16 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/fiddle/closure.c (initialize): check mprotect's return value.
+ If mprotect is failed because of PaX or something, its function call
+ will cause SEGV.
+ http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20130401T210301Z.diff.html.gz
- * include/ruby/ruby.h: use rb_gc_writebrrier() simply.
- For incremental GC, we need to get a pointer to the objspace.
- We can share this pointer for the following WB process.
- And considering icache hit ratio, process in the GC.
+Wed Apr 10 17:39:13 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (rb_gc_writebarrier): added.
+ * ext/bigdecimal/bigdecimal.c (VpCtoV): Initialize a local variable
+ even when overflow.
- * gc.c (gc_writebarrier_generational, gc_writebarrier_incremental):
- make them NOINLINE because inlining them into rb_gc_writebarrier()
- makes a prologue code of rb_gc_writebarrier() longer (storing callee
- save registers).
+Wed Apr 10 12:32:37 2013 Tanaka Akira <akr@fsij.org>
- This patch improve the performance of WB on micro-benchmarks.
+ * bignum.c (rb_ll2big): Don't overflow on signed integer negation.
- name ruby 2.1 trunk modified
- vm1_gc_wb_ary* 0.511 0.632 0.532
- vm1_gc_wb_ary_promoted* 0.578 0.701 0.674
- vm1_gc_wb_obj* 0.419 0.575 0.492
- vm1_gc_wb_obj_promoted* 0.537 0.664 0.618
- (sec)
+ * ext/bigdecimal/bigdecimal.c (MUL_OVERFLOW_SIGNED_VALUE_P): New
+ macro.
+ (AddExponent): Don't overflow on signed integer multiplication.
+ (VpCtoV): Don't overflow on signed integer arithmetic.
+ (VpCtoV): Don't overflow on signed integer arithmetic.
-Tue Mar 17 18:51:43 2015 Koichi Sasada <ko1@atdot.net>
+Wed Apr 10 06:32:12 2013 Tanaka Akira <akr@fsij.org>
- * benchmark/bm_vm1_gc_wb_ary(_promoted).rb: separate fastpath and
- slowpath for WB.
+ * internal.h (MUL_OVERFLOW_INT_P): New macro.
- Before this change bm_vm1_gc_wb_ary.rb tried to check the performance
- for WB slowpath (making a reference from oldobj to newobj). However,
- from Ruby 2.2, 3 GCs are needed to promote new objects because
- only 3 age objects are promoted objects.
+ * sprintf.c (GETNUM): Don't overflow on signed integer multiplication.
- To compare fastpath and slowpath, introduce new "promoted" version
- benchmark.
+Tue Apr 9 20:38:20 2013 Tanaka Akira <akr@fsij.org>
- bm_vm1_gc_wb_ary.rb is for fastpath and
- bm_vm1_gc_wb_ary_promoted.rb is for slowpath.
+ * internal.h (MUL_OVERFLOW_SIGNED_INTEGER_P): New macro.
+ (MUL_OVERFLOW_FIXNUM_P): Ditto.
+ (MUL_OVERFLOW_LONG_P): Ditto.
- * benchmark/bm_vm1_gc_wb_obj(_promoted).rb: ditto.
+ * array.c (rb_ary_product): Don't overflow on signed integer
+ multiplication.
-Tue Mar 17 17:23:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c (fix_mul): Ditto.
+ (int_pow): Ditto.
- * dir.c (glob_helper): distinguish not-yet-stated and DT_UNKNOWN
- by readdir, and traverse recursively for the former. Linux
- readdir returns DT_UNKNOWN on some filesystems, e.g., smbfs,
- iso9660.
+ * rational.c (f_imul): Ditto.
-Mon Mar 16 17:43:21 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * insns.def (opt_mult): Ditto.
- * lib/webrick/server.rb: Fix regression bug in WEBrick's
- :DoNotReverseLookup config option implementation.
- [fix GH-731] Patch by @vais
- * test/webrick/test_do_not_reverse_lookup.rb: ditto.
+ * thread.c (sleep_timeval): Don't overflow on signed integer addition.
-Sat Mar 14 20:05:23 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * bignum.c (rb_int2big): Don't overflow on signed integer negation.
+ (rb_big2ulong): Ditto.
+ (rb_big2long): Ditto.
+ (rb_big2ull): Ditto.
+ (rb_big2ll): Ditto.
- * math.c (math_gamma): optimization for passed small integer.
+Tue Apr 9 19:45:44 2013 Tanaka Akira <akr@fsij.org>
-Sat Mar 14 18:07:23 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * lib/open-uri.rb: Support multiple fields with same field
+ name (like Set-Cookie).
+ (OpenURI::Meta#metas): New accessor to obtain fields as a Hash from
+ field name (string) to field values (array of strings).
+ [ruby-core:37734] [Bug #4964] reported by ren li.
- * enum.c: [DOC] Fixes Enumerable#member? documentation
- [fix GH-756][ci skip] Patch by @shamanime
+Tue Apr 9 15:26:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Mar 14 12:23:53 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (iseq_compile_each): append keyword hash to argument array
+ to splat if needed. [ruby-core:54094] [Bug #8236]
- * dir.c (glob_helper): use d_type to reduce lstat system calls.
+Tue Apr 9 10:02:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/dir.h (struct direct): add d_type instead of d_isdir and
- d_isrep. SYMLINKD is unreliable, since the target can be
- replaced after a link was created.
+ * lib/mkmf.rb (timestamp_file): gather timestamp files in one
+ directory from each extension directories, with considering
+ target_prefix.
- * win32/win32.c (readdir_internal): set d_type.
+Tue Apr 9 04:57:59 JST 2013 Charles Oliver Nutter <headius@headius.com>
-Sat Mar 14 02:14:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * error.c: Capture EAGAIN, EWOULDBLOCK, EINPROGRESS exceptions and
+ export them for use in WaitReadable/Writable exceptions.
+ * io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that
+ include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail
+ for nonblocking failures using those exceptions. Use that
+ function in io_getpartial and io_write_nonblock instead of
+ rb_mod_sys_fail
+ * ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include
+ WaitReadable and WaitWritable. Use those classes for
+ write_would_block and read_would_block instead of rb_mod_sys_fail.
+ * ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of
+ rb_mod_sys_fail in bsock_sendmsg_internal and
+ bsock_recvmsg_internal.
+ * ext/socket/init.c: Use rb_readwrite_sys_fail instead of
+ rb_mod_sys_fail in rsock_s_recvfrom_nonblock and
+ rsock_s_connect_nonblock.
+ * ext/socket/socket.c: Use rb_readwrite_sys_fail instead of
+ rb_mod_sys_fail in sock_connect_nonblock.
+ * include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead
+ of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and
+ RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail.
- * parse.y (primary): empty parentheses at cmdarg can be null.
- [ruby-core:68477] [Bug #10957]
+Tue Apr 9 02:44:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Mar 13 15:04:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/extconf.rb: $defs needs -D or -U. nothing is added
+ otherwize.
- * ext/stringio/stringio.c (strio_close): don't raise on double
- close for consistent to IO#close.
+ * ext/socket/extconf.rb: check struct in_addr6, which is defined in
+ VC6 instead of in6_addr.
-Fri Mar 13 15:03:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/option.c (optname_to_sym): fix macro name.
- * io.c (rb_io_close_read, rb_io_close_write): don't raise after
- close same as IO#close.
+ * ext/socket/constants.c (rsock_cmsg_type_arg): fix macro name.
-Fri Mar 13 12:29:07 2015 Tanaka Akira <akr@fsij.org>
+Mon Apr 8 23:57:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/readline/test_readline.rb: Restore environment variables:
- COLUMNS LINES
+ * object.c (id_for_setter): extract common code from const, class
+ variable, instance variable setters.
-Fri Mar 13 11:37:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 8 23:55:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/fiddle/extconf.rb: needs --enable-shared when linked to
- libruby or fiddle.so. since --with-static-linked-ext does no
- longer link extensions to ruby program with --enable-shared, the
- only combination needs --enable-static is --disable-shared and
- --with-static-linked-ext. [ruby-dev:48901] [Bug #10960]
+ * ext/depend (ENCOBJS, TRANSOBJS): use explicit path to ruby.h for
+ nmake.
-Fri Mar 13 07:02:20 2015 Eric Wong <e@80x24.org>
+ * ext/depend (ENCOBJS, TRANSOBJS): fix header dependency, VPATH has
+ $(srcdir)/include/ruby but not $(srcdir)/include, so cannot find out
+ ruby/ruby.h. use ruby.h instead and ../ruby for include/ruby.h.
- * ext/socket/init.c (rsock_s_accept_nonblock): use rb_hash_lookup2
- * ext/openssl/ossl_ssl.c (get_no_exception): new function
- (ossl_ssl_accept_nonblock): use get_no_exception
- (ossl_ssl_read_internal): ditto
- (ossl_ssl_write_nonblock): ditto
- [ruby-core:68511]
+Mon Apr 8 20:30:37 2013 Yuki Yugui Sonoda <yugui@google.com>
-Fri Mar 13 07:01:38 2015 Eric Wong <e@80x24.org>
+ * ext/depend (ENCOBJS, TRANSOBJS): Add missing dependencies.
- * ext/openssl/ossl_ssl.c: predefine wait_*able symbols
+Mon Apr 8 17:19:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Mar 12 22:59:53 2015 Tanaka Akira <akr@fsij.org>
+ * ext/win32ole/win32ole.c (fole_missing): should check actual argument
+ count before accessing.
- * test/lib/leakchecker.rb: Check environment variables.
+Mon Apr 8 16:03:55 2013 Yuki Yugui Sonoda <yugui@google.com>
-Thu Mar 12 05:54:27 2015 Eric Wong <e@80x24.org>
+ Fixes a build failure of ext/ripper/ripper.c on building out of place.
+ * common.mk (id.h, id.c): Always generated in $(srcdir).
+ (ext/ripper/ripper.c): Passes $(PATH_SEPARATOR) too to the sub make.
- * ext/socket/init.c (rsock_s_accept_nonblock):
- support exception: false
- [ruby-core:66385] [Feature #10532]
- * ext/socket/init.c (rsock_init_socket_init): define new symbols
- * ext/socket/rubysocket.h: adjust prototype
- * ext/socket/socket.c (sock_accept_nonblock): support exception: false
- * ext/openssl/ossl_ssl.c (ossl_ssl_accept_nonblock): ditto
- * ext/socket/socket.c (Init_socket): adjust accept_nonblock definition
- * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto
- * ext/socket/tcpserver.c (rsock_init_tcpserver): ditto
- * ext/socket/unixserver.c (rsock_init_unixserver): ditto
- * ext/socket/tcpserver.c (tcp_accept_nonblock): adjust
- rsock_s_accept_nonblock call
- * ext/socket/unixserver.c (unix_accept_nonblock): ditto
- * ext/openssl/ossl_ssl.c (ossl_start_ssl): support no_exception
- * ext/openssl/ossl_ssl.c (ossl_ssl_connect): adjust ossl_start_ssl call
- * ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock): ditto
- * ext/openssl/ossl_ssl.c (ossl_ssl_accept): ditto
- * test/socket/test_nonblock.rb (test_accept_nonblock): test for
- "exception :false"
- * test/socket/test_tcp.rb (test_accept_nonblock): new test
- * test/socket/test_unix.rb (test_accept_nonblock): ditto
- * test/openssl/test_pair.rb (test_accept_nonblock_no_exception): ditto
+Mon Apr 8 12:05:02 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Mar 12 10:53:06 2015 Koichi Sasada <ko1@atdot.net>
+ * object.c (rb_obj_ivar_set): call to_str for string only once.
+ to_str was called from rb_is_const_name and rb_to_id before.
- * internal.h, node.h: move a definition of `struct rb_global_entry'
- and related functions from node.h to internal.h.
+ * object.c (rb_mod_const_set): ditto.
- * variable.c: remove unused include pragma.
+ * object.c (rb_mod_cvar_set): ditto.
- * common.mk: remove unused dependency.
+Sun Apr 7 13:56:16 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Thu Mar 12 10:32:39 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
+ RUBY_PLATFORM should escape as Regexp,
+ because RUBY_PLATFORM may contain '.'.
- * common.mk: remove unused dependency.
+Sun Apr 7 10:44:01 2013 Tanaka Akira <akr@fsij.org>
-Thu Mar 12 08:20:14 2015 Koichi Sasada <ko1@atdot.net>
+ * include/ruby/defines.h: Simplify the logic to include sys/select.h.
+ This fixes a compilation error on Haiku (gcc2 and gcc4).
- * load.c: removed unused header file "node.h".
+ * configure.in: Use shared linker as $(CC) for Haiku.
+ This fixes a build error on Haiku (gcc2).
- * method.h: ditto.
+Sun Apr 7 10:41:30 2013 Tanaka Akira <akr@fsij.org>
- * symbol.c: ditto.
+ * lib/resolv.rb (MDNSOneShot#sender): Delete an unused variable.
-Thu Mar 12 08:14:48 2015 Koichi Sasada <ko1@atdot.net>
+Sun Apr 7 03:24:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * gc.c: RGENGC_CHECK_MODE should be 0.
+ * addr2line.c: use more generic type:
+ * u_char -> unsigned char
+ * u_short -> unsigned short
+ * u_int -> unsigned int
+ * u_long -> unsigned long
+ * quad_t -> int64_t
+ * u_quad_t -> uint64_t
-Thu Mar 12 07:44:17 2015 Koichi Sasada <ko1@atdot.net>
+ * addr2line.c (imax): inline is defined by configure.
- * internal.h: use T_IMEMO to represent `struct MEMO' value.
- memo->v1 and memo->v2 is WB protected values.
- So use MEMO_V1/V2_SET() macros to set these values.
- memo->u3 is ambiguous (sometimes a VALUE, sometimes an integer
- value), so use gc_mark_maybe() in gc.c to mark it.
+Sun Apr 7 01:40:39 2013 Akinori MUSHA <knu@iDaemons.org>
- Rename NEW_MEMO() to MEMO_NEW().
+ * misc/ruby-electric.el (ruby-electric-hash): New electric
+ function that expands a hash sign inside a string or regexp to
+ "#{}".
- Move MEMO_FOR and NEW_MEMO_FOR macros from node.h.
+ * misc/ruby-electric.el (ruby-electric-curlies): Do not insert
+ spaces inside when the curly brace is a delimiter of %r, %w,
+ etc.
- Export a rb_imemo_new() function for ext/ripper.
+ * misc/ruby-electric.el (ruby-electric-curlies): Insert another
+ space before a closing curly brace when
+ ruby-electric-newline-before-closing-bracket is nil.
- * node.h: remove NODE_MEMO.
+Sun Apr 7 01:01:26 2013 Tanaka Akira <akr@fsij.org>
- * enum.c: catch up these change.
+ * strftime.c (rb_strftime_with_timespec): Test yday range.
+ [ruby-core:44088] [Bug #6247] reported by Ruby Submit.
- * enumerator.c: ditto.
+Sat Apr 6 23:46:54 2013 Naohisa Goto <ngotogenome@gmail.com>
- * load.c: ditto.
+ * configure.in (AC_CHECK_HEADERS): atomic.h for Solaris atomic_ops.
- * ext/objspace/objspace.c (count_nodes): ditto.
+ * ruby_atomic.h: Skip using Solaris10 atomic_ops on Solaris 9 or
+ earlier if atomic.h is not available. [ruby-dev:47229] [Bug #8228]
- * gc.c (gc_mark_children): mark imemo_memo type.
+Sat Apr 6 23:40:40 2013 Tanaka Akira <akr@fsij.org>
- * parse.y (new_args_gen): use T_IMEMO.
- (I'm not sure it is working correctly...)
+ * lib/resolv.rb: Support LOC resources.
+ [ruby-core:23361] [Feature #1436] by JB Smith.
-Wed Mar 11 22:36:34 2015 Koichi Sasada <ko1@atdot.net>
+Sat Apr 6 23:38:09 2013 Naohisa Goto <ngotogenome@gmail.com>
- * eval.c (frame_called_id): it should use vm_ifunc type.
+ * addr2line.c: quad_t and u_quad_t is not available on Solaris.
+ __inline is not available with old compilers on Solaris.
+ [ruby-dev:47229] [Bug #8227]
- * eval.c (frame_func_id): ditto.
+Sat Apr 6 23:31:38 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 11 22:27:05 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/resolv.rb: Add one-shot multicast DNS support.
+ [ruby-core:53387] [Feature #8089] by Eric Hodel.
- * node.h: remove NODE_IFUNC, NEW_IFUNC.
+Sat Apr 6 22:12:01 2013 Tanaka Akira <akr@fsij.org>
- * internal.h: use T_IMEMO for IFUNC.
+ * lib/resolv.rb (Resolv::DNS.fetch_resource): New method to obtain
+ full result.
+ [ruby-dev:43587] [Feature #4788] proposed by Makoto Kishimoto.
- rename `struct IFUNC' to `struct vm_ifunc' and move the definition
- from vm_insnhelper.h. Add imemo_ifunc.
+Sat Apr 6 20:17:51 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (gc_mark_children): mark imemo_ifunc type T_IMEMO object.
+ * ext/socket/socket.c (rsock_sys_fail_raddrinfo): Renamed from
+ rsock_sys_fail_addrinfo.
+ (rsock_sys_fail_raddrinfo_or_sockaddr): Renamed from
+ rsock_sys_fail_addrinfo_or_sockaddr.
- * compile.c: catch up these changes.
+ * ext/socket/rubysocket.h: Follow the above change.
- * proc.c: ditto.
+Sat Apr 6 19:24:59 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h (RUBY_VM_IFUNC_P): ditto.
+ * ext/socket/socket.c (rsock_sys_fail_sockaddr): Takes struct sockaddr
+ and socklen_t instead of String object.
+ (rsock_sys_fail_addrinfo_or_sockaddr): Follow the above change.
- * vm_eval.c (rb_iterate): ditto.
+ * ext/socket/rubysocket.h (rsock_sys_fail_sockaddr): Follow the above
+ change.
- * vm_insnhelper.c: ditto.
+Sat Apr 6 14:28:23 2013 Tanaka Akira <akr@fsij.org>
- * ext/objspace/objspace.c: ditto.
+ * ext/socket/rubysocket.h (SockAddrStringValueWithAddrinfo): New macro.
+ (rsock_sockaddr_string_value_with_addrinfo): New declaration.
+ (rsock_addrinfo_inspect_sockaddr): Ditto.
+ (rsock_sys_fail_addrinfo): Ditto.
+ (rsock_sys_fail_sockaddr_or_addrinfo): Ditto.
-Wed Mar 11 21:53:43 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/socket/raddrinfo.c (rsock_addrinfo_inspect_sockaddr): Renamed
+ from addrinfo_inspect_sockaddr and exported.
+ (rsock_sockaddr_string_value_with_addrinfo): New function to obtain
+ string and possibly addrinfo object.
- * internal.h, eval_intern.h: move CREF accessors.
+ * ext/socket/socket.c (rsock_sys_fail_sockaddr): Don't use
+ rsock_sys_fail_host_port which is IP dependent. Invoke
+ rsock_sys_fail_addrinfo.
+ (rsock_sys_fail_addrinfo): New function using
+ rsock_addrinfo_inspect_sockaddr.
+ (rsock_sys_fail_addrinfo_or_sockaddr): New function.
+ (sock_connect): Use SockAddrStringValueWithAddrinfo and
+ rsock_sys_fail_addrinfo_or_sockaddr.
+ (sock_connect_nonblock): Ditto.
+ (sock_bind): Ditto.
- List IMEMO supported types in internal.h.
+Sat Apr 6 13:34:20 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 11 21:45:36 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/socket/socket.c (rsock_sys_fail_sockaddr): Delete 2nd argument.
- * vm_insnhelper.h: use T_IMEMO to create THROW_DATA.
+ * ext/socket/rubysocket.h (rsock_sys_fail_sockaddr): Follow above
+ change.
- Add THROW_DATA_NEW().
+Sat Apr 6 13:13:39 2013 Tanaka Akira <akr@fsij.org>
- * internal.h: move definition of `struct THROW_DATA'
- from vm_insnhelper.h to internal.h.
+ * ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect only
+ for String to avoid SEGV.
- Rename `THROW_DATA' to `vm_throw_data'.
+Sat Apr 6 12:40:16 2013 Tanaka Akira <akr@fsij.org>
- * eval_intern.h (THROW_DATA_P): move to internal.h.
- THROW_DATA is no longer T_NODE, so check T_IMEMO.
+ * ext/socket/rubysocket.h (rsock_sys_fail_host_port): Wrap by NORETURN.
+ (rsock_sys_fail_path): Ditto.
+ (rsock_sys_fail_sockaddr): Ditto.
- * gc.c (gc_mark_children): mark THROW_DATA.
+Sat Apr 6 11:49:35 2013 Tanaka Akira <akr@fsij.org>
- * vm.c: catch up these changes.
+ * ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect if the
+ path contains a NUL.
- * vm_eval.c: ditto.
+Sat Apr 6 11:39:19 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c: ditto.
+ * ext/socket: Improve socket exception message to show socket address.
+ [ruby-core:45617] [Feature #6583] proposed Eric Hodel.
-Wed Mar 11 21:21:56 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/socket/rubysocket.h (rsock_sys_fail_host_port): Declared.
+ (rsock_sys_fail_path): Ditto.
+ (rsock_sys_fail_sockaddr): Ditto.
- * vm_insnhelper.c: use T_IMEMO to create SVAR.
+ * ext/socket/udpsocket.c (udp_connect): Use rsock_sys_fail_host_port.
+ (udp_bind): Ditto.
+ (udp_send): Ditto.
- * internal.h, vm_insnhelper.h: move definition `struct SVAR'
- from vm_insnhelper.h to internal.h. And rename it to struct vm_svar.
+ * ext/socket/init.c (rsock_init_sock): Specify a string for rb_sys_fail
+ argument.
+ (make_fd_nonblock): Ditto.
+ (rsock_s_accept): Ditto.
- new imemo_type imemo_svar is added.
+ * ext/socket/ipsocket.c (init_inetsock_internal): Use
+ rsock_sys_fail_host_port.
- * gc.c (gc_mark_children): mark imemo_svar.
+ * ext/socket/socket.c (rsock_sys_fail_host_port): Defined.
+ (rsock_sys_fail_path): Ditto.
+ (rsock_sys_fail_sockaddr): Ditto.
+ (setup_domain_and_type): Use rsock_sys_fail_sockaddr.
+ (sock_connect_nonblock): Ditto.
+ (sock_bind): Ditto.
+ (sock_gethostname): Specify a string for rb_sys_fail argument.
+ (socket_s_ip_address_list): Ditto.
- * node.c (rb_gc_mark_node): remove useless marking.
+ * ext/socket/basicsocket.c (bsock_shutdown): Specify a string for
+ rb_sys_fail argument.
+ (bsock_setsockopt): Use rsock_sys_fail_path.
+ (bsock_getsockopt): Ditto.
+ (bsock_getpeereid): Refine the argument for rb_sys_fail.
-Wed Mar 11 19:35:46 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/socket/unixsocket.c (rsock_init_unixsock): Use
+ rsock_sys_fail_path.
+ (unix_path): Ditto.
+ (unix_send_io): Ditto.
+ (unix_recv_io): Ditto.
+ (unix_addr): Ditto.
+ (unix_peeraddr): Ditto.
- * include/ruby/ruby.h: introduce new type T_IMEMO.
- T_IMEMO is Internal Memo type, internal use only.
- T_IMEMO has same purpose of NODE_MEMO.
+Sat Apr 6 11:23:18 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- To insert T_IMEMO, type numbers are modified a little.
+ * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
+ fix load path for encoding to run the test as stand-alone.
- * internal.h: define struct RIMemo. Each RIMemo objects
- has imemo_type. We can observe it by the imemo_type() function.
+Sat Apr 6 09:54:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * gc.c (rb_imemo_new): added.
+ * pack.c (NATINT_LEN): fix definition order, must be after
+ NATINT_PACK.
- * node.h: remove NODE_CREF and NEW_CREF().
+Sat Apr 6 03:11:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * node.c (rb_gc_mark_node): ditto.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: fix symbol keys in coder
+ emission. Thanks @tjwallace
+ * test/psych/test_coder.rb: test for change
- * vm.c (vm_cref_new): use rb_imem_new().
+Sat Apr 6 02:54:08 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * vm_eval.c: ditto.
+ * ext/psych/lib/psych/exception.rb: there should be only one exception
+ base class. Fixes tenderlove/psych #125
+ * ext/psych/lib/psych.rb: require the correct exception class
+ * ext/psych/lib/psych/syntax_error.rb: ditto
+ * ext/psych/lib/psych/visitors/to_ruby.rb: ditto
- * vm_insnhelper.c: use RIMemo objects for CREF.
+Sat Apr 6 02:30:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/objspace/objspace.c: support T_IMEMO.
+ * parse.y (new_defined): remove all extra parentheses, and return
+ "nil" for defined? with empty expression.
+ [ruby-core:54024] [Bug #8224]
-Wed Mar 11 17:03:20 2015 Koichi Sasada <ko1@atdot.net>
+Sat Apr 6 02:06:04 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * gc.c: fix memory leak by prepend method.
+ * ext/psych/lib/psych/visitors/to_ruby.rb: correctly register
+ self-referential strings. Fixes tenderlove/psych #135
- It is easy to reproduce with such script:
+ * test/psych/test_string.rb: appropriate test.
- module M; def bar; end; end
- loop{
- Class.new do
- def foo; end
- prepend M
- end
- }
+Sat Apr 6 01:21:56 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (obj_free): free T_ICLASS::m_tbl if it is created by prepend.
- To recognize it, check RICLASS_IS_ORIGIN flag.
+ * ext/socket/init.c (cloexec_accept): Fix a compile error on
+ Debian GNU/kFreeBSD. Consider HAVE_ACCEPT4 is defined
+ but SOCK_CLOEXEC is not defined.
- * gc.c (gc_mark_children): T_ICLASS objects only need to mark
- T_ICLASS::m_tbl if RICLASS_IS_ORIGIN is set.
+Sat Apr 6 00:19:30 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * gc.c (obj_memsize_of): count T_ICLASS if RICLASS_IS_ORIGIN is set.
+ * load.c (features_index_add): use rb_str_subseq() to specify C string
+ position properly to fix require non ascii path.
+ [ruby-core:53733] [Bug #8165]
- * internal.h (RCLASS_SET_ORIGIN): add to set RCLASS_SET_ORIGIN.
+ * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
+ a test for the above.
- TODO: The word `origin' seems not good name. We need to invent
- another good name.
+Fri Apr 5 20:41:49 2013 Tanaka Akira <akr@fsij.org>
- * class.c: use RCLASS_SET_ORIGIN().
+ * include/ruby/defines.h (HAVE_TRUE_LONG_LONG): Defined to distinguish
+ availability of long long and availability of 64bit integer type.
- * class.c (class_alloc): zero clear rb_classext_t.
+ * pack.c: Use HAVE_TRUE_LONG_LONG to distinguish q! and Q! support.
-Wed Mar 11 13:28:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 5 20:19:42 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: check also procstat_getvmmap, which is not
- available on FreeBSD 9. [ruby-core:68468] [Bug #10954]
+ * addr2line.c: Include ruby/missing.h to fix compile error on Debian.
- * vm_dump.c (procstat_vm): use kinfo_getvmmap instead if
- procstat_getvmmap is not available.
+Fri Apr 5 19:39:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 11 09:15:21 2015 Koichi Sasada <ko1@atdot.net>
+ * compile.c (iseq_compile_each): fix of defined? with empty
+ expression. [ruby-core:53999] [Bug #8220]
- * internal.h: define struct MEMO.
+Fri Apr 5 13:22:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * enum.c: use MEMO.
+ * ext/curses/curses.c (Init_curses): fix implementation function,
+ crmode should be same as cbreak. [ruby-core:54013] [Bug #8222]
- * enumerator.c: ditto.
+Fri Apr 5 12:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * load.c: ditto.
+ * ext/curses/hello.rb: Typo in Curses example by Drew Blas
+ [Fixes GH-273]
- * node.h: return (struct MEMO *) pointer.
+Thu Apr 4 23:45:13 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 11 06:26:21 2015 Koichi Sasada <ko1@atdot.net>
+ * lib/resolv.rb (bind_random_port): Rescue EACCES for SunOS.
+ bind() on SunOS for port 2049 (nfs) and 4045 (lockd) causes
+ EACCES with unprivileged process. cf. PRIV_SYS_NFS in privileges(5)
+ [ruby-core:48064] [Bug #7183] reported by Frank Meier.
- * vm_insnhelper.h (THROW_DATA_STATE): return int, not VALUE.
+Thu Apr 4 23:24:45 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.h (THROW_DATA_STATE_SET): accept int value.
+ * ext/socket/extconf.rb: Remove condition for bcc.
-Wed Mar 11 05:06:46 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 4 22:53:23 2013 Tanaka Akira <akr@fsij.org>
- * vm_eval.c (rb_catch_protect): use THROW_DATA_VAL().
+ * include/ruby/ruby.h (FIX2LONG): Parenthesize the macro body.
-Wed Mar 11 04:56:04 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 4 22:32:32 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.h: define struct IFUNC.
+ * time.c (time_strftime): Describe %L and %N truncates digits under
+ the specified length.
+ [ruby-core:52130] [Bug #7829]
- * vm_eval.c (rb_iterate): use it.
+Thu Apr 4 22:08:46 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_yield_with_cfunc): ditto.
+ * object.c (rb_mod_cvar_set): Reverted "avoid inadvertent
+ symbol creation" to avoid SEGV by
+ Class.new.class_variable_set(1, 2).
-Wed Mar 11 03:52:12 2015 Koichi Sasada <ko1@atdot.net>
+Thu Apr 4 20:07:19 2013 Tanaka Akira <akr@fsij.org>
- * eval_intern.h (THROW_DATA_P): use RB_TYPE_P() instead of
- BUILTIN_TYPE().
+ * ext/pathname/pathname.c (path_write): New method.
+ (path_binwrite): Ditto.
+ [ruby-core:49468] [Feature #7378]
- * thread.c (thread_join): use THROW_DATA_P().
+Thu Apr 4 16:51:29 2013 Yuki Yugui Sonoda <yugui@google.com>
-Wed Mar 11 03:48:01 2015 Koichi Sasada <ko1@atdot.net>
+ * thread_pthread.c: Fixes wrong scopes of #if USE_SLEEPY_TIMER_THREAD
+ .. #endif sections. This fixes a build error on NativeClient.
- * proc.c: use RUBY_VM_IFUNC_P() to recognize IFUNC or not.
+Wed Apr 3 17:25:31 2013 Yuki Yugui Sonoda <yugui@google.com>
- * vm.c: ditto.
+ * thread_pthread.c (ruby_init_stack): Avoid using uninitialized value.
+ stackaddr and size are not set if get_stack() fails.
- * vm_dump.c: ditto.
+Thu Apr 4 16:55:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c: ditto.
+ * struct.c (make_struct): avoid inadvertent symbol creation.
+ (rb_struct_aref): ditto.
+ (rb_struct_aset): ditto.
- * vm_core.h (RUBY_VM_IFUNC_P): use RB_TYPE_P() instead of
- BUILTIN_TYPE().
+Thu Apr 4 16:54:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 11 03:21:37 2015 Koichi Sasada <ko1@atdot.net>
+ * object.c (rb_mod_const_set): avoid inadvertent symbol creation.
+ (rb_obj_ivar_set): ditto.
+ (rb_mod_cvar_set): ditto.
- * vm_insnhelper.h: define struct THROW_DATA to represent
- throwing data. Also define accessor functions.
+Thu Apr 4 15:46:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval_intern.h: move related changes into vm_insnhelper.h.
- Now these MACROs (functions) are only used in vm*.c.
+ * enum.c (enum_inject): avoid inadvertent symbol creation.
- There is only THROW_DATA_P(err) to check this data type or not.
+Thu Apr 4 14:37:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c: catch up these changes.
+ * thread.c (rb_thread_aref): avoid inadvertent symbol creation.
+ (rb_thread_variable_get): ditto.
+ (rb_thread_key_p): ditto.
+ (rb_thread_variable_p): ditto.
- * vm_eval.c: ditto.
+Thu Apr 4 11:33:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_insnhelper.c: ditto.
+ * ext/openssl/ossl_bn.c (ossl_bn_to_i): Use bn2hex to speed up.
+ In general, binary to/from decimal needs extra cost.
-Wed Mar 11 00:57:00 2015 Rei Odaira <Rei.Odaira@gmail.com>
+Thu Apr 4 07:24:18 2013 Tanaka Akira <akr@fsij.org>
- * test/rubygems/test_gem_security_trust_dir.rb: The return value of
- File::Stat#mode is OS dependent. In AIX, 0200000 is set.
+ * ext/socket/extconf.rb: Specify arguments to test functions.
-Tue Mar 10 20:03:41 2015 Tanaka Akira <akr@fsij.org>
+Thu Apr 4 03:25:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/webrick/server.rb: Invoke setup_shutdown_pipe in start method
- instead of listen method.
- [ruby-core:68476] [Bug #10956] Reported by Shintaro Kojima.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn.
-Tue Mar 10 17:27:27 2015 Koichi Sasada <ko1@atdot.net>
+Wed Apr 3 22:09:25 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (thread_join): Fixnum (except TAG_FATAL) and
- NODE should not be reached here.
+ * ext/socket/extconf.rb: Test functions and libraries after headers.
-Mon Mar 9 21:42:10 2015 Koichi Sasada <ko1@atdot.net>
+Wed Apr 3 21:23:29 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (ep_cref): rename to lep_cref() because it should be
- local ep.
+ * io.c (rb_io_seek_m): Accept :CUR, :END, :SET as "whence" argument.
+ (interpret_seek_whence): New function.
+ [ruby-dev:45818] [Feature #6643]
-Mon Mar 9 16:34:36 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 3 20:52:49 2013 Tanaka Akira <akr@fsij.org>
- * ext/stringio/stringio.c (strio_close): don't raise on double
- close for consistent to IO#close.
+ * process.c: Describe the behavior which Ruby invokes a commandline
+ directly without shell if the commandline is simple enough.
+ [ruby-core:50459] [Bug #7489]
-Mon Mar 09 06:44:48 2015 Koichi Sasada <ko1@atdot.net>
+Wed Apr 3 20:27:37 2013 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.h: define struct SVAR for SVAR.
- This data type is also same layout of NODE (NODE_IF).
+ * ext/extmk.rb (extmake): Invoke Logging::log_close in a ensure
+ clause.
- * vm_insnhelper.c: catch up this change.
+Wed Apr 3 18:53:58 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 9 06:43:21 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/extmk.rb (extmake): Use Logging.open to switch stdout and
+ stderr. Delay Logging::log_close until the failure message is
+ written. Write the failure message only if log file is opened.
- * vm_insnhelper.c (lep_svar_set): add WBs.
+ * lib/mkmf.rb (Logging.log_opened?): New method.
-Mon Mar 9 06:19:06 2015 Koichi Sasada <ko1@atdot.net>
+ [ruby-dev:47215] [Bug #8209]
- * internal.h: define rb_cref_t and change to use it.
+Wed Apr 3 17:11:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- rb_cref_t is data type of CREF. Now, the body is still NODE.
- It is easy to understand what is CREF and what is pure NODE.
+ * win32/win32.c (constat_apply): pass through unknown sequence which
+ starts with ESC but is not followed by a bracket. [ruby-core:53879]
+ [Bug #8201]
-Mon Mar 9 06:00:37 2015 Koichi Sasada <ko1@atdot.net>
+Wed Apr 3 16:35:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.h (COPY_CREF_OMOD): fix translation miss.
+ * bignum.c (rb_big_eq): hide intermediate Bignums not just freeing
+ memory. [ruby-core:53893] [Bug #8204]
-Mon Mar 9 04:47:58 2015 Koichi Sasada <ko1@atdot.net>
+ * object.c (rb_obj_hide): hide an object by clearing klass.
- * internal.h: define CREF accessor macros.
- * CREF_CLASS(cref)
- * CREF_NEXT(cref)
- * CREF_VISI(cref)
- * CREF_VISI_SET(cref, v)
- * CREF_REFINEMENTS(cref)
- * CREF_PUSHED_BY_EVAL(cref)
- * CREF_PUSHED_BY_EVAL_SET(cref)
- * CREF_OMOD_SHARED(cref)
- * CREF_OMOD_SHARED_SET(cref)
- * CREF_OMOD_SHARED_UNSET(cref)
+ * bignum.c (rb_big_eq): test as Fixnum if possible and get rid of zero
+ length Bignum. [ruby-core:53893] [Bug #8204]
- This is process to change CREF data type from NODE.
+Tue Apr 2 23:56:03 2013 Tanaka Akira <akr@fsij.org>
-Sun Mar 8 22:50:57 2015 Tanaka Akira <akr@fsij.org>
+ * lib/securerandom.rb (SecureRandom.random_bytes): Use
+ OpenSSL::Random.random_add instead of OpenSSL::Random.seed and
+ specify 0.0 as the entropy.
+ [ruby-core:47308] [Bug #6928]
- * ext/zlib/zlib.c (rb_gzfile_close): Don't raise on double
- close for consistent to IO#close.
+Tue Apr 2 20:24:52 2013 Tanaka Akira <akr@fsij.org>
-Sun Mar 8 16:57:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c: Support Q! and q! for long long.
+ (natstr): Moved to toplevel. Add q and Q if there is long long type.
+ (endstr): Moved to toplevel.
+ (NATINT_PACK): Consider long long.
+ (NATINT_LEN_Q): New macro.
+ (pack_pack): Support Q! and q!.
+ (pack_unpack): Ditto.
+ [ruby-dev:43970] [Feature #3946]
- * dir.c (glob_helper): match patterns against legacy short names
- too, not only ordinary names. [ruby-core:67954] [Bug #10819]
+Tue Apr 2 19:24:26 2013 Tanaka Akira <akr@fsij.org>
- * win32/dir.h (struct direct): add short name members.
+ * ext/-test-/num2int/num2int.c: Define utility methods
+ as module methods of Num2int.
- * win32/win32.c (opendir_internal, readdir_internal): ditto.
+ * test/-ext-/num2int/test_num2int.rb: Follow the above change.
-Sat Mar 7 09:36:05 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Apr 2 18:49:01 2013 Tanaka Akira <akr@fsij.org>
- * array.c: document that first element is kept when using
- Array#uniq and #uniq! [fix GH-845][ci skip]
- Patch by @riffraff
+ * lib/securerandom.rb: Don't use Array#to_s.
+ [ruby-core:52058] [Bug #7811] fixed by zzak (Zachary Scott).
-Sat Mar 7 09:28:02 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Apr 2 17:38:20 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * thread.c: Mutex#owned? is no longer experimental since 2.1.0
- [fix GH-839][ci skip] Patch by @takiy33
+ * re.c (rb_reg_to_s): suppress duplicated charclass warning.
+ Regexp#to_s suppress extra its whole regexp options by calling
+ onig_new with its source, but it doesn't call rb_reg_preprocess.
+ Therefore its Unicode escapes (\u{XXXX}) are given as is,
+ and it may cause duplicated charclass warning for example
+ "[\u{33}]" (3 is duplicated) or "[\u{a}\u{b}]" (u is duplicated).
+ [ruby-core:53649] [Bug #8151]
-Sat Mar 7 09:18:42 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Apr 2 16:00:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * tool/merger.rb: Added documentation to version method.
- [fix GH-847][ci skip] Patch by @magikid
+ * vm_dump.c (rb_print_backtrace): separate to ease showing C backtrace.
-Fri Mar 6 22:50:36 2015 Koichi Sasada <ko1@atdot.net>
+ * internal.h (rb_print_backtrace): ditto.
- * class.c (rb_prepend_module): need a WB for klass -> origin.
+Tue Apr 2 15:22:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Mar 6 20:18:38 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/envutil.rb (assert_separately): stop_auto_run of
+ Test::Unit::Runner to prevent auto runner use ARGV.
- * fix namespace issue on singleton class expressions. [Bug #10943]
+ * test/ruby/envutil.rb (assert_separately): add $: to separate process.
- * vm_core.h, method.h: remove rb_iseq_t::cref_stack. CREF is stored
- to rb_method_definition_t::body.iseq_body.cref.
+ * test/ruby/envutil.rb (assert_separately): fail if stderr is not
+ empty and ignore_stderr is false.
- * vm_insnhelper.c: modify SVAR usage.
- When calling ISEQ type method, push CREF information onto method
- frame, SVAR located place. Before this fix, SVAR is simply nil.
- After this patch, CREF (or NULL == Qfalse for not iseq methods)
- is stored at the method invocation.
+Tue Apr 2 06:46:59 2013 Tanaka Akira <akr@fsij.org>
- When SVAR is required, then put NODE_IF onto SVAR location,
- and NDOE_IF::nd_reserved points CREF itself.
+ * ext/-test-/num2int/num2int.c: Rename utility methods
+ to global functions to ease manual experiments.
- * vm.c (vm_cref_new, vm_cref_dump, vm_cref_new_toplevel): added.
+ * test/-ext-/num2int/test_num2int.rb: Follow the above change.
- * vm_insnhelper.c (vm_push_frame): accept CREF.
+Mon Apr 1 22:26:17 2013 Tanaka Akira <akr@fsij.org>
- * method.h, vm_method.c (rb_add_method_iseq): added. This function
- accepts iseq and CREF.
+ * ext/zlib/zlib.c (rb_gzfile_set_mtime): Use NUM2UINT.
+ The old logic doesn't work well on LP64 platforms as:
+ .. -2**63-1 => error,
+ -2**63 .. -2**62-1 => success,
+ -2**62 .. -2**31-1 => error,
+ -2**31 .. 2**31-1 => success,
+ 2**31 .. 2**62-1 => error,
+ 2**62 .. 2**64-1 => success,
+ 2**64 .. => error.
- * class.c (clone_method): use rb_add_method_iseq().
+Mon Apr 1 22:08:02 2013 Benoit Daloze <eregontp@gmail.com>
- * gc.c (mark_method_entry): mark method_entry::body.iseq_body.cref.
+ * ext/zlib/zlib.c (Zlib::Inflate.new):
+ Fix documentation syntax and naming errors.
+ Based on patch by Robin Dupret. Fix GH-271.
- * iseq.c: remove CREF related codes.
+Mon Apr 1 21:22:31 2013 Tanaka Akira <akr@fsij.org>
- * insns.def (getinlinecache/setinlinecache): CREF should be cache key
- because a different CREF has a different namespace.
+ * test/-ext-/num2int/test_num2int.rb: Test small bignums.
- * node.c (rb_gc_mark_node): mark NODE_IF::nd_reserved for SVAR.
+Mon Apr 1 21:10:56 2013 Tanaka Akira <akr@fsij.org>
- * proc.c: catch up changes.
+ * numeric.c (rb_num2ulong_internal): Don't cast a negative double value
+ into unsigned long, which is undefined behavior.
+ (rb_num2ull): Don't cast a value bigger than LLONG_MAX into
+ long long, which is undefined behavior.
- * struct.c: ditto.
+Mon Apr 1 20:57:57 2013 Tanaka Akira <akr@fsij.org>
- * insns.def: ditto.
+ * ext/-test-/num2int/num2int.c: Return string for result, instead of
+ printing.
- * vm_args.c (raise_argument_error): ditto.
+ * test/-ext-/num2int/test_num2int.rb: updated to follow above change.
- * vm_eval.c: ditto.
+Mon Apr 1 20:08:07 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_class.rb: add a test.
+ * numeric.c (rb_num2long): Don't use SIGNED_VALUE uselessly.
+ (check_int): Ditto.
+ (check_short): Ditto.
+ (rb_num2fix): Ditto.
+ (rb_num2ulong_internal): Add a cast.
-Fri Mar 6 18:19:13 2015 Koichi Sasada <ko1@atdot.net>
+Mon Apr 1 18:41:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/webrick/test_filehandler.rb: on vboxsf (on VirtualBox
- on Windows 7), file name and permissions are strange (can access
- by short file name and so on).
+ * configure.in: skip autoconf 2.64 and 2.66, 2.67 seems short-lived
+ but stick on it for Debian Squeeze.
- Simply skip on such tests on such FS. To detect strange FS, this
- patch use a part of code `File.executable?(__FILE__)`.
- Please correct them if there are better ways.
+Mon Apr 1 14:22:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Mar 6 17:31:29 2015 Koichi Sasada <ko1@atdot.net>
+ * configure.in: check clang version by predefined macro values.
+ [Bug #8192]
- * test/ruby/test_beginendblock.rb: do not change directory.
+Mon Apr 1 12:05:15 2013 Tanaka Akira <akr@fsij.org>
- Run system command in the directory mounted by vboxsf on Windows 7
- and get warning like that "warning: Insecure world writable dir...".
+ * numeric.c (check_uint): Take the 1st argument as unsigned long,
+ instead of VALUE. Refine the validity test conditions.
+ (check_ushort): Ditto.
-Fri Mar 6 10:31:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 1 07:15:03 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * vm_eval.c (vm_call_super): search next super class from the
- original class, to get rid of infinite recursion with
- prepending. a patch by Seiei Higa <hanachin AT gmail.com> at
- [ruby-core:68434]. [ruby-core:68093] [Bug #10847]
+ * configure.in: use quadrigraph to put '[' or ']'. [Bug #8192]
-Fri Mar 6 08:45:26 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Mon Apr 1 04:16:41 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/matrix.rb: Add Vector#round. Patch by Jordan Stephens.
- [Fixes GH-802]
+ * configure.in: kick old clang. [ruby-dev:47204] [Bug #8192]
-Fri Mar 6 07:33:03 2015 Koichi Sasada <ko1@atdot.net>
+Mon Apr 1 01:12:46 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (obj_info): show node name too.
+ * include/ruby/ruby.h (FIX2ULONG): Make it consistent with NUM2ULONG.
-Fri Mar 6 07:00:44 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/-test-/num2int/num2int.c: Add utility methods for FIX2XXX tests.
- * internal.h: remove struct method_table_wrapper.
- struct method_table_wrapper was introduced to avoid duplicate marking
- for method tables.
+ * test/-ext-/num2int/test_num2int.rb: Add tests for FIX2XXX.
- For example, `module M1; def foo; end; end` make one method table
- (mtbl) contains a method `foo`. M1 (T_MODULE) points mtbl.
- Classes C1 and C2 includes M1, then two T_ICLASS objects are created
- and they points mtbl too. In this case, three objects (one T_MODULE
- and two T_ICLASS objects) points same mtbl. On marking phase, these
- three objects mark same mtbl. To avoid such duplication, struct
- method_table_wrapper was introduced.
+Sun Mar 31 17:17:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- However, created two T_ICLASS objects have same or shorter lifetime
- than M1 (T_MODULE) object. So that we only need to mark mtbl from M1,
- not from T_ICLASS objects. This patch tries marking only from M1.
- In other words, original module (M1) has responsibility to mark mtbl.
- Because of no duplicate marking, we don't need method_table_wrapper
- any more.
+ * proc.c (rb_mod_define_method): consider visibility in define_method.
+ patch by mashiro <mail AT mashiro.org>. fix GH-268.
- Note that one `Module#prepend` call creates two T_ICLASS objects.
- One for referring to a prepending Module object, same as
- `Module#include`. We don't need to care this T_ICLASS.
- One for moving original mtbl from a prepending class. We need to
- mark such mtbl from this T_ICLASS object. To mark the mtbl,
- we need to use `RCLASS_ORIGIN(klass)` on marking from a prepended
- class `klass`.
+Sun Mar 31 15:40:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c: ditto.
+ * win32/configure.bat: try to fix option arguments split by commas and
+ equals here. this batch file no longer run with old command.com.
- * eval.c (rb_using_refinement): ditto.
+ * tool/mkconfig.rb: no hacks for cmd.exe.
- * gc.c: ditto.
+Sun Mar 31 13:47:04 2013 Tanaka Akira <akr@fsij.org>
- * include/ruby/ruby.h: define m_tbl directly. The definition of
- struct RClass should be moved to (srcdir)/internal.h.
+ * numeric.c (rb_num2ulong_internal): New function similar to
+ rb_num2ulong but integer wrap around flag is also returned.
+ (rb_num2ulong): Use rb_num2ulong_internal.
+ (rb_num2uint): Use rb_num2ulong_internal and the wrap around flag is
+ used instead of negative_int_p(val).
+ (rb_num2ushort): ditto.
- * method.h: remove decl of rb_free_m_tbl_wrapper().
+Sun Mar 31 06:27:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * object.c: use RCLASS_M_TBL() directly.
+ * class.c (HAVE_METACLASS_P): should check FL_SINGLETON flag before get
+ instance variable to get rid of wrong warning about __attached__.
+ [ruby-core:53839] [Bug #8188]
-Fri Mar 6 02:50:12 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Mar 30 14:11:28 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * dir.c (replace_real_basename): need to check the return value of
- GLOB_REALLOC().
+ * bcc32: removed. agreed at
+ http://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130223Japan
-Fri Mar 6 02:26:03 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Mar 30 03:58:00 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * dir.c (replace_real_basename): shouldn't create Ruby object before
- the object system is loaded.
- [ruby-core:68430] [Bug #10941]
+ * win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII.
+ fix [ruby-core:53079] [Bug #7996]
+ reported and patched by mmeltner (Michael Meltner).
-Wed Mar 5 16:58:43 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+Sat Mar 30 03:49:21 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * hash.c: [DOC] #delete method actually returns nil, if the key
- is not found. [fix GH-844][ci skip] Patch by @ivdma
+ * win32/win32.c (wrename): use MoveFileExW instead of MoveFileW,
+ because the latter fails on cross device file move of some
+ environments.
+ fix [ruby-core:53492] [Bug #8109]
+ reported by mitchellh (Mitchell Hashimoto).
-Wed Mar 5 12:22:23 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+Fri Mar 29 22:09:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * math.c: refactoring: remove unnecessary variable d0 to unify code
- appearance.
+ * thread.c (rb_mutex_synchronize_m): yield no block params. patch by
+ splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097].
+ fix GH-266.
-Thu Mar 5 11:50:54 2015 Shugo Maeda <shugo@ruby-lang.org>
+Fri Mar 29 16:51:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_eval.c (eval_string_with_cref): A binding should keep
- refinements activation information and the refinements should be
- activated in subsequent eval calls with the binding.
- [ruby-core:67945] [Bug #10818]
+ * io.c (argf_next_argv): set init flag if succeeded to forward, after
+ skipping.
-Thu Mar 5 11:16:55 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * io.c (argf_block_call_i, argf_block_call): no more forwarding if
+ forwarded after skipping. [ruby-list:49185]
- * test/ruby/test_refinement.rb: There is no need anymore to suppress
- warnings.
+ * io.c (argf_close): deal with init flag.
-Thu Mar 5 08:31:02 2015 Rei Odaira <Rei.Odaira@gmail.com>
+ * io.c (argf_block_call_i, argf_block_call): forward next file if
+ skipped while iteration, to get rid of IOError. [ruby-list:49185]
- * random.c (random_raw_seed): Avoid calling fill_random_bytes()
- if the requested size is 0. AIX returns -1 for 0-byte read from
- /dev/urandom, while other UNIX returns 0. With this change,
- Random.raw_seed(0) consistently returns "" in any UNIX.
+Fri Mar 29 11:09:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 4 12:43:32 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * lib/mkmf.rb (configuration): not include all CFLAGS in CXXFLAGS, to
+ use different set than C for C++. [ruby-core:45273] [Bug #6504]
- * test/ruby/test_math.rb (assert_float_and_int): Refactor test cases
- by introducing assert_float_and_int. [misc #10810]
+Fri Mar 29 10:24:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 4 11:52:30 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/io.h: undef POSIX compliant names on AIX, which are no
+ longer needed. patch suggested by edelsohn (David Edelsohn) in
+ [ruby-core:53815]. [Bug #8174]
- * symbol.c (Init_sym): make dsym_fstrs a hash compared by identity
- as the keys are unique fstrings, to get rid of running hash and
- compare methods and causing new object allocation during garbage
- collection phase. [ruby-dev:48891] [Bug #10933]
+Fri Mar 29 06:39:42 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 4 10:16:57 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * numeric.c (rb_num2ull): Cast double to unsigned LONG_LONG via
+ LONG_LONG instead of double to unsigned LONG_LONG directly.
+ This is a challenge to fix a test_num2ull(TestNum2int)
+ failure (NUM2ULL(-1.0) should be "18446744073709551615" but was "0")
+ on Mac OS X with 32bit clang.
+ http://a.mrkn.jp/~mrkn/chkbuild/mountain_lion/ruby-trunk-m32-o0/log/20130328T191100Z.diff.html.gz
- * enum.c: Fix typo in slice_after's exception message.
- [fix GH-842][ci skip] Patch by @jsyeo
+Fri Mar 29 00:54:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 4 10:15:37 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
+ preserved. [ruby-core:53745] [Bug #8169]
- * doc/syntax/methods.rdoc: add some missing spaces and
- fix a grammatical error in method docs.
- [fix GH-843][ci skip] Patch by @nikolas
+Thu Mar 28 23:11:25 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 4 02:13:06 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/resolv.rb: Test Windows platform by detecting LoadError when
+ require 'win32/resolv' suggested by Nobuyoshi Nakada [ruby-core:53389].
+ [ruby-core:53388] [Feature #8090] Reported by Charles Nutter.
- * tool/redmine-backporter.rb (backport_command_string): pick up only
- when the revision exists in trunk.
+Thu Mar 28 23:10:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 4 00:44:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/io.h: rename SVR3,4 member names as POSIX compliant,
+ to get rid of conflict on AIX. [ruby-core:53765] [Bug #8174]
- * thread.c (rb_thread_io_blocking_region): assigned variables
- inside EXEC_TAG() should be volatile.
+Thu Mar 28 18:22:21 2013 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_thread_s_handle_interrupt): ditto.
+ * test/-ext-/num2int/test_num2int.rb: extract
+ assert_num2i_success_internal and assert_num2i_error_internal and
+ provide assertion messages as "NUM2XXX(NNN)".
- * thread.c (exec_recursive): ditto.
+Thu Mar 28 07:05:25 2013 Tanaka Akira <akr@fsij.org>
-Wed Mar 4 00:29:18 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * include/ruby/intern.h: Delete redundant inclusions caused by
+ AC_INCLUDES_DEFAULT in defines.h.
- * tool/redmine-backporter.rb: now can specify shorten form of commands.
+ * include/ruby/defines.h: Ditto.
-Tue Mar 3 23:41:42 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * include/ruby/ruby.h: Ditto.
- * tool/redmine-backporter.rb (Readline.readline): drop untreated control
- characters.
+ * include/ruby/st.h: Ditto.
-Tue Mar 3 22:25:24 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Mar 28 06:51:31 2013 Tanaka Akira <akr@fsij.org>
- * test/lib/envutil.rb (EnvUtil.invoke_ruby): need to rescue because
- Signal.signame may raise exception.
+ * include/ruby/defines.h: Fix a compilation error on NetBSD,
+ "type of formal parameter 1 is incomplete" for the rb_thread_wait_for
+ invocation in rb_file_flock, by including header files as
+ AC_INCLUDES_DEFAULT of autoconf.
-Tue Mar 3 16:57:39 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Mar 27 22:09:14 2013 Tanaka Akira <akr@fsij.org>
- * tool/redmine-backporter.rb: use 'b' instead of 's' for showing
- Backport options for merger.rb.
+ * numeric.c (LONG_MIN_MINUS_ONE_IS_LESS_THAN): New macro.
+ (LLONG_MIN_MINUS_ONE_IS_LESS_THAN): Ditto.
+ (rb_num2long): Use LONG_MIN_MINUS_ONE_IS_LESS_THAN.
+ (rb_num2ulong): Ditto.
+ (rb_num2ll): Use LLONG_MIN_MINUS_ONE_IS_LESS_THAN.
+ (rb_num2ull): Ditto.
-Tue Mar 3 16:55:23 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/-ext-/num2int/test_num2int.rb (assert_num2i_success): Test the
+ value converted into a Float if Float can represent the value
+ exactly.
+ (assert_num2i_error): Ditto.
- * tool/redmine-backporter.rb: show selected ticket number at prompt.
+Wed Mar 27 20:59:47 2013 Tanaka Akira <akr@fsij.org>
-Tue Mar 3 14:47:30 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * test/-ext-/num2int/test_num2int.rb (assert_num2i_success): New
+ utility method.
+ (assert_num2i_error): Ditto.
- * math.c (num2dbl_with_to_f): direct casting from Rational to double.
- [Feature #10909]
+Wed Mar 27 20:37:59 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_math.rb: add tests for the above change.
+ * time.c (num_exact): Use to_r method only if to_int method is
+ available.
+ [ruby-core:53764] [Bug #8173] Reported by Hiro Asari.
-Tue Mar 3 07:52:20 2015 Rei Odaira <Rei.Odaira@gmail.com>
+Wed Mar 27 12:07:40 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_symbol.rb: avoid a false positive in AIX.
+ * test/-ext-/num2int/test_num2int.rb (test_num2ll): test LLONG_MIN,
+ not LONG_MIN.
-Tue Mar 3 00:59:39 2015 Naohisa Goto <ngotogenome@gmail.com>
+Wed Mar 27 12:02:45 2013 Tanaka Akira <akr@fsij.org>
- * configure.in: set PRELOADENV in Solaris to avoid "wrong ELF class"
- error. [Bug #10926] [ruby-dev:48888]
- * configure.in: set LIBPATHENV for 32-bit compile in Solaris
- in addition to 64-bit.
+ * internal.h (TIMET_MAX_PLUS_ONE): definition simplified.
-Mon Mar 2 15:36:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 27 06:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: do not check _setjmp unless _longjmp is available,
- so that configure results will not be changed by cache.
+ * lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
+ to be preserved. [ruby-core:53745] [Bug #8169]
-Mon Mar 2 14:44:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 27 05:15:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in (RUBY_REPLACE_TYPE): restore unsigned type from
- cached variable only if the target type is not available.
+ * configure.in (RUBY_REPLACE_TYPE): define SIGNEDNESS_OF_type same as
+ check_signedness of mkmf.rb.
-Mon Mar 2 13:04:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h (TIMET_MAX, TIMET_MIN, TIMET_MAX_PLUS_ONE): use
+ SIGNEDNESS_OF_TIME_T.
- * signal.c (sig_signame): return nil if the argument is a valid
- signal number.
+Wed Mar 27 00:28:45 2013 Tanaka Akira <akr@fsij.org>
-Mon Mar 2 12:05:04 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * internal.h (TIMET_MAX_PLUS_ONE): Defined.
- * test/net/ftp/test_ftp.rb (create_ftp_server): set SO_OOBINLINE
- for receiving OOB data which is sent with MSG_OOB flag in
- portable way. [Bug #10915] [ruby-dev:48885]
- * test/net/ftp/test_ftp.rb (test_abort, test_status): use gets
- for receiving OOB data in portable way.
+ * thread.c (double2timeval): Saturate out-of-range values.
-Mon Mar 2 11:43:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Mar 26 23:41:18 2013 Tanaka Akira <akr@fsij.org>
- * configure.in (RUBY_REPLACE_TYPE): restore unsigned type from
- cached variable.
+ * internal.h: Define TIMET_MAX and TIMET_MIN here.
-Mon Mar 2 06:01:41 2015 Eric Wong <e@80x24.org>
+ * time.c: Remove TIMET_MAX and TIMET_MIN definitions.
- * ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX
- Thanks to Yura Sokolov <funny.falcon@gmail.com>
- [ruby-core:68369] [Bug#10923]
- * test/io/wait/test_io_wait.rb (test_nread_buffered):
- fix broken test
+ * thread.c: Ditto.
-Sun Mar 1 20:21:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread_pthread.c: Remove TIMET_MAX definition.
- * configure.in (RUBY_REPLACE_TYPE): restore convertible type from
- cached variable, so that configured results will be stable.
+ * thread_win32.c: Ditto.
-Sun Mar 1 18:10:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Mar 26 22:31:10 2013 Tanaka Akira <akr@fsij.org>
- * configure.in (rb_cv_broken_memmem): check before adding the
- result HAVE_MEMMEM macro to confdefs.h, so that configured
- results will be stable.
+ * ext/socket/socket.c (sockaddr_len): return the shortest length for
+ unknown socket address.
-Sun Mar 1 11:17:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Mar 26 22:14:46 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (id2ref): prohibit from accessing internal objects.
- [ruby-core:68348] [Bug #10918]
+ * thread.c (double2timeval): convert the infinity to TIME_MAX to avoid
+ SEGV by Thread.new {}.join(Float::INFINITY) on
+ Debian GNU/Linux (amd64).
-Sun Mar 1 09:06:11 2015 Tanaka Akira <akr@fsij.org>
+Mon Mar 25 07:09:20 2013 Eric Hodel <drbrain@segment7.net>
- * lib/time.rb (strptime): Support %s.%N.
- [ruby-core:68301] [Bug #10904] Patch by Sadayuki Furuhashi.
+ * lib/rinda/tuplespace.rb: Only return tuple entry once on move,
+ either through port or regular return, not both. This results in a
+ 120% speedup when combined with #8125. Patch by Joel VanderWerf.
+ [ruby-trunk - Feature #8119]
-Sat Feb 28 17:18:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 25 06:59:01 2013 Eric Hodel <drbrain@segment7.net>
- * enum.c (enum_each_slice, enum_each_cons): limit elements size by
- the enumerator size. suggested by Hans Mackowiak <hanmac AT
- gmx.de> at [ruby-core:68335]
+ * test/rinda/test_rinda.rb: Skip IPv6 tests if no IPv6 addresses
+ exist. Skip fork-dependent test if fork is not available.
+ [ruby-trunk - Bug #8159]
-Sat Feb 28 15:44:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 24 10:38:24 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * vm_dump.c (rb_vm_bugreport): get rid of making new strings
- inside signal context.
+ * addr2line.c (putce): suppress unused return value warning.
- * variable.c (rb_tmp_class_path): defer making temporary class
- path string.
+Mon Mar 25 02:01:03 2013 Narihiro Nakamura <authornari@gmail.com>
- * variable.c (rb_search_class_path): search class path or return
- Qnil or Qfalse if unnamed, not creating a temporary path.
+ * proc.c (bm_free): need to clean up the mark flag of a free and
+ unlinked method entry. [Bug #8100] [ruby-core:53439]
-Sat Feb 28 15:02:02 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 24 22:13:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * variable.c (rb_tmp_class_path): preserve name encoding of an
- anonymous instance of module/class subclass.
+ * string.c (rb_str_rpartition): revert r39903, and convert byte offset
+ to char offset; the return value of rb_reg_search is byte offset,
+ but other than it of rb_str_rpartition expects char offset.
+ [Bug #8138] [ruby-dev:47183]
-Sat Feb 28 08:24:30 2015 Rei Odaira <Rei.Odaira@gmail.com>
+Sun Mar 24 18:29:46 2013 Akinori MUSHA <knu@iDaemons.org>
- * ext/pty/pty.c: AIX supports autopush.
- Patch by Perry Smith [ruby-core:58539] [Bug #9144]
+ * string.c (rb_str_rpartition): Fix String#rpartition(/re/)
+ against a multibyte string. [Bug #8138] [ruby-dev:47183]
-Fri Feb 27 22:00:05 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sun Mar 24 13:42:24 2013 Narihiro Nakamura <authornari@gmail.com>
- * lib/rubygems: Update to RubyGems 2.4.6 and HEAD(800f2e6).
- Fixed #1159, #1171, #1173 on rubygems/rubygems
- * test/rubygems: ditto.
+ * gc.c (GC_ENABLE_LAZY_SWEEP): new macro to switch lazy sweeping
+ for debugging. [Feature #8024] [ruby-dev:47135]
-Fri Feb 27 20:55:42 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sun Mar 24 12:55:47 2013 Narihiro Nakamura <authornari@gmail.com>
- * lib/rake: Update to rake (9237e74), typo fix and remove needless
- private syntax.
- * test/rake: ditto.
+ * gc.c: We have no chance to expand the heap when lazy sweeping is
+ restricted. So collecting is often invoked if there is not
+ enough free space in the heap. Try to expand heap when this is
+ the case.
-Fri Feb 27 17:06:44 2015 Koichi Sasada <ko1@atdot.net>
+Sun Mar 24 11:03:31 2013 Tanaka Akira <akr@fsij.org>
- * vm_core.h: define vm_svar_index.
+ * test/ruby/test_require.rb: Remove temporally files in the tests.
- * vm_insnhelper.c, vm.c, compile.c: use vm_svar_index names.
+ * test/ruby/test_rubyoptions.rb: Ditto.
- * iseq.h: remove DEFAULT_SPECIAL_VAR_COUNT.
- use VM_SVAR_FLIPFLOP_START instead.
+ * test/logger/test_logger.rb: Ditto.
-Fri Feb 27 13:57:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/psych/test_psych.rb: Ditto.
- * io.c (setup_narg): wipe away expanded part of buffer to get rid
- of revealing uncleaned data. reported by Dongkwan Kim <dkay AT
- kaist.ac.kr>.
+ * test/readline/test_readline.rb: Ditto.
-Wed Feb 25 22:25:07 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * test/syslog/test_syslog_logger.rb: Ditto.
- * spec/default.mspec: use default configuration file name.
- https://github.com/ruby/rubyspec/commit/cc69f337b06362e5607ffa3e3ad40ef7494960cf
+ * test/webrick/test_httpauth.rb: Ditto.
-Wed Feb 25 22:21:56 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * test/zlib/test_zlib.rb: Ditto.
- * spec/default.mspec: remove specific version number.
- https://github.com/ruby/rubyspec/commit/7a909e925c1baa9c700bd44af9241aef6e596714
+Sun Mar 24 05:36:29 2013 Eric Hodel <drbrain@segment7.net>
-Wed Feb 25 22:04:04 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rinda/ring.rb: Added documentation for multicast support.
- * ext/win32/Win32API.rb (initialize): accept both a string and an array
- for the arguments of the imported function.
- reported by Aaron Stone [ruby-core:68208] [Bug #10876] [Fixes GH-835]
+ * NEWS: Point to above documentation.
-Wed Feb 25 18:12:11 2015 Eric Wong <e@80x24.org>
+Sun Mar 24 05:32:39 2013 Eric Hodel <drbrain@segment7.net>
- * signal.c (sighandler): preserve errno
- Patch by Steven Stewart-Gallus <sstewartgallus00@mylangara.bc.ca>
- [ruby-core:68172] [Bug #10866]
+ * test/rinda/test_rinda.rb: Restore tests commented out while fixing
+ test slowdown bug before r39895.
-Wed Feb 25 15:59:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 24 05:03:36 2013 Eric Hodel <drbrain@segment7.net>
- * dir.c (push_pattern, push_glob): make globbed file names same
- encoding to the given pattern.
+ * lib/rinda/ring.rb: Add multicast support to Rinda::RingFinger and
+ Rinda::RingServer. [ruby-trunk - Bug #8073]
+ * test/rinda/test_rinda.rb: Test for the above.
-Wed Feb 25 15:27:16 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * NEWS: Update with Rinda multicast support
- * tool/merger.rb: support 2.1+ versioning scheme.
+Sun Mar 24 04:13:27 2013 Eric Hodel <drbrain@segment7.net>
-Tue Feb 25 08:49:12 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * test/rinda/test_rinda.rb: Fixed test failures in r39890 and r39891
+ due to stopping DRb service.
- * lib/cmath.rb (log): raise ArgumentError when more than 2 arguments
- are passed. [ruby-core:66143] [Bug #10487]
+Sun Mar 24 03:34:02 2013 Eric Hodel <drbrain@segment7.net>
-Tue Feb 25 02:15:17 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * lib/rinda/rinda.rb: Fixed loss of tuple when remote is alive but the
+ call stack was unwound. Patch by Joel VanderWerf.
+ [ruby-trunk - Bug #8125]
+ * test/rinda/test_rinda.rb: Test for the above.
- * test/ruby/test_math.rb: Use assert_infinity instead of assert_equal(1.0/0, ...).
+Sun Mar 24 02:14:53 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_math.rb: Add tests for overriding Integer#to_f.
- [ruby-core:67919] [Misc #10809]
+ * test/mkmf/test_have_macro.rb: remove temporally files in the tests.
-Tue Feb 24 22:58:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 23 23:50:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * complex.c (nucomp_mul): calculate as rotation in complex plane
- if matrix calculation resulted in NaN.
+ * addr2line.c (kprintf): added from FreeBSD libstand's printf.
+ this is consided as async signal safe function.
-Tue Feb 24 21:45:39 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * addr2line.c (rb_dump_backtrace_with_lines): use kfprintf.
+ [Bug #8144] [ruby-core:53632]
- * test/ruby/test_math.rb(test_cbrt): Add an assertion for Math.cbrt(1.0/0)
- and move #test_cbrt to more proper place.
+Sat Mar 23 23:28:00 2013 Kenta Murata <mrkn@mrkn.jp>
-Tue Feb 24 19:09:25 2015 Koichi Sasada <ko1@atdot.net>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P
+ instead of (VALUE)0 as a return value.
- * vm_insnhelper.c (lep_svar_place, lep_svar_get): do not create
- additional T_NODE object (svars holder) when only getting
- svars.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_div): ditto.
-Tue Feb 24 11:49:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
- * time.c (time_zone_name): should be US-ASCII only if all 7-bits,
- otherwise locale encoding. [ruby-core:68230] [Bug #10887]
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_remainder): ditto.
-Tue Feb 24 09:47:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 23 17:39:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (chompped_length): enable smart chomp for all non-dummy
- encoding strings, not only default_rs.
- [ruby-core:68258] [Bug #10893]
+ * vm_eval.c (check_funcall_respond_to): preserve passed_block, which
+ is modified in vm_call0_body() via vm_call0(), and caused a bug of
+ rb_check_funcall() by false negative result of rb_block_given_p().
+ re-fix [ruby-core:53650] [Bug #8153].
+ [ruby-core:53653] [Bug #8154]
-Mon Feb 23 23:19:42 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 22 17:48:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/vcs.rb (IO.popen): support :chdir option.
+ * lib/forwardable.rb (Forwardable::FILE_REGEXP): create regexp object
+ outside sources for eval, to reduce allocations in def_delegators
+ wrappers. //o option does not make each regexps shared. patch by
+ tmm1 (Aman Gupta) in [ruby-core:53620] [Bug #8143].
- * tool/vcs.rb (VCS::GIT.get_revisions): use :chdir option instead
- of -C option which is not supported by older git.
- [ruby-dev:48880] [Bug #10890]
+Fri Mar 22 17:38:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Feb 23 15:26:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * load.c (rb_feature_p), vm_core.h (rb_vm_struct): turn
+ loaded_features_index into st_table. patches by tmm1 (Aman Gupta)
+ in [ruby-core:53251] and [ruby-core:53274] [Bug #8048]
- * string.c (rb_str_split_m): raise ArgumentError at broken string
- not RegexpError, as Regexp is not involved in.
- [ruby-core:68229] [Bug #10886]
+Fri Mar 22 10:29:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Feb 23 07:25:29 2015 Benoit Daloze <eregontp@gmail.com>
+ * ext/bigdecimal/bigdecimal.c: Fix style.
- * time.c: Zone encoding should be US-ASCII if all 7-bits. Fix r46907.
+Fri Mar 22 05:30:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_time.rb, test/ruby/test_time_tz.rb: Update tests.
+ * parse.y (ambiguous_operator): refine warning message, since this
+ warning is shown after literal too.
-Sun Feb 22 18:33:42 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Fri Mar 22 04:51:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk: use ruby organization for rubyspec.
+ * vm_insnhelper.c (vm_callee_setup_keyword_arg): should check required
+ keyword arguments even if rest hash is defined. [ruby-core:53608]
+ [Bug #8139]
-Sun Feb 22 15:56:06 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+Fri Mar 22 01:00:17 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
- of original crefs. It fixes segmentation fault when calling
- refined method in duplicate module. [ruby-dev:48878] [Bug #10885]
+ * process.c (rb_execarg_addopt, run_exec_pgroup): use rb_pid_t
+ instead of pid_t.
- * vm_core.h, class.c: change accordingly.
+ * ext/pty/pty.c (raise_from_check, pty_check): ditto.
- * test/ruby/test_refinement.rb: add a test for above.
+Fri Mar 22 00:04:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Feb 22 10:43:37 2015 Koichi Sasada <ko1@atdot.net>
+ * addr2line.c (rb_dump_backtrace_with_lines): output line at once.
- * gc.c (rb_objspace_call_finalizer): control GC execution during
- force firnalizations at the end of interpreter process.
- [Bug #10768]
+Thu Mar 21 23:17:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- 1) Prohibit incremental GC while running Ruby-level finalizers
- to avoid any danger.
- 2) Prohibit GC while invoking T_DATA/T_FILE data structure
- because these operations break object relations consistency.
+ * thread.c (ruby_kill): get rid of deadlock on signal 0.
+ [ruby-dev:47182] [Bug #8137]
- This patch can introduce another memory consuming issue because
- Ruby-level finalizers can run after (2), GC is disabled.
- However, basically object consistency was broken at (2) as I
- described above. So that running Ruby-level finalizers contains
- danger originally. Because of this point, I need to suggest to
- remove these 3 lines (invoking remaining finalizers). And add a
- rule to add that finalizers should not add new finalizers, or
- say there is no guarantee to invoke finalizers that added by
- another finalizer.
+Thu Mar 21 22:39:46 2013 Naohisa Goto <ngotogenome@gmail.com>
-Sun Feb 22 04:07:05 2015 Zachary Scott <e@zzak.io>
+ * marshal.c (marshal_dump, marshal_load): workaround for segv on
+ Intel Solaris compiled with Oracle SolarisStudio 12.3.
+ Partly revert r38174. [ruby-core:52042] [Bug #7805]
- * ext/openssl/ossl_asn1.c: [DOC] RDoc formatting fixes for
- ASN1::ObjectId with patch from @vbatts [Fixes GH-834]
+Thu Mar 21 16:48:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_bn.c: ditto.
+ * parse.y (simple_re_meta): escape all closing characters, not only
+ round parenthesis. [ruby-core:53578] [Bug #8133]
-Sat Feb 21 19:51:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 21 13:50:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (match_aref): RMatch::regexp is Qnil after matching by a
- string since r45451. [ruby-core:68209] [Bug #10877]
+ * vm_core.h (UNINITIALIZED_VAR): suppress warnings by clang 4.2.
+ [ruby-core:51742] [Bug #7756]
-Sat Feb 21 16:18:42 2015 Stefan Schuler <mail@stefanschuessler.de>
+Thu Mar 21 07:34:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * compar.c (Init_Comparable): [DOC] Replace camelcase variable name.
- [Fix GH-833]
+ * ext/date/date_core.c: Typo in Date::MONTHNAMES by Matt Gauger
+ [GH fixes #261]
-Fri Feb 20 17:27:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 22:53:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (rb_file_identical_p): fix handle leak, ensure to close
- the handle of the first argument.
+ * lib/mkmf.rb (find_library): fix to format message.
+ [ruby-core:53568] [Bug #8130]
-Fri Feb 20 17:19:23 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 22:52:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/win32.c (different_device_p): compare by volume serial
- numbers, not by path names. [ruby-core:68162] [Bug #10865]
+ * lib/mkmf.rb (install_dirs, with_destdir): prefix with DESTDIR
+ directories to install only unless bundled extension libraries.
+ [ruby-core:53502] [Bug #8115]
-Thu Feb 19 01:58:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 17:47:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * win32/file.c (rb_file_expand_path_internal): neither the drive
- of base directory nor the current drive are involved in the
- result if different than the drive of path.
- [ruby-core:68130] [Bug #10858]
+ * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup):
+ allow using different root for source and build directories.
+ this may fixes a minor problem of r39834.
-Wed Feb 18 10:48:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 16:40:48 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * win32/win32.c (wrename): return EXDEV if moving a directory to
- another drive, since MoveFileExW does not set proper error code.
- [ruby-core:68162] [Bug #10865]
+ * test/ruby/test_signal.rb (test_hup_me): skip if HUP isn't supported.
+ On Windows this test causes ArgumentError.
-Wed Feb 18 03:13:52 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed Mar 20 16:24:12 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * ext/psych/lib/psych.rb: bump psych version.
- * ext/psych/psych.gemspec: ditto
- * ext/psych/yaml/scanner.c: add latest libyaml change.
- * test/psych/helper.rb: support newer minitest
- * test/psych/test_to_yaml_properties.rb: ditto
+ * test/rubygems/test_gem_installer.rb (test_install_extension_flat):
+ use ruby in build directory in case ruby is not installed.
+ [ruby-core:53265] [Bug #8058]
-Tue Feb 17 11:47:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 15:22:07 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * lib/resolv.rb (Resolv::DNS::Resource#==, #hash): elements
- returned by Kernel#instance_variables are Symbols now.
- [ruby-core:68128] [Bug #10857]
+ * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup): use
+ relative path to get rid of "too long commandline" error.
-Tue Feb 17 10:59:10 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Wed Mar 20 04:27:42 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * doc/syntax/calling_methods.rdoc: Fix documentation for "calling_methods"
- Patch by @sos4nt [fix GH-830][ci skip]
+ * test/rinda/test_rinda.rb: remove unused variables.
+ patched by Vipul A M <vipulnsward@gmail.com>
-Tue Feb 17 10:53:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 20 04:15:32 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * win32/file.c (rb_file_expand_path_internal): do not make invalid
- (or ADS) path if the path has a drive letter, the result also
- should have be under it. [ruby-core:68130] [Bug #10858]
+ * ext/bigdecimal/bigdecimal.c: fixed typo.
+ patched by Vipul A M <vipulnsward@gmail.com>
-Tue Feb 17 10:47:20 2015 Iain Beeston <iain.beeston@gmail.com>
+Sat Mar 16 03:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * hash.c: Added docs to explain that #include? and #member? do not
- check member equality
- * lib/set.rb: ditto
+ * test/ruby/test_signal.rb (test_hup_me): added a few comments.
-Mon Feb 16 20:58:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 16 03:39:38 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * compile.c (compile_massign): optimization for special case,
- assignments by aset or attrset.
- http://kokizzu.blogspot.jp/2015/02/c-java-hhvm-ruby-nodejsrhinojscspidermo.html
- http://www.atdot.net/~ko1/diary/201502.html#d16
+ * thread.c (ruby_kill): added a few comments.
-Sun Feb 15 10:41:23 2015 Sho Hashimoto <sho-h@ruby-lang.org>
+Sat Mar 16 03:36:56 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * doc/standard_library.rdoc: [DOC] delete removed libraries.
- [misc #10843] [ci skip]
+ * thread.c (ruby_kill): release GVL while waiting signal delivered.
-Sat Feb 14 12:20:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Mar 19 19:50:48 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * random.c (rand_random_number): add a method to return a random
- number like SecureRandom to Random::Formatter.
+ * ruby_kill (internal.h, thread.c): use rb_pid_t instead of pid_t.
+ this fixes the build failure of mswin introduced at r39819.
- * lib/securerandom.rb (random_bytes): move to Random::Formatter,
- the base method of the module.
+Tue Mar 19 17:09:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Feb 14 12:01:32 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (rb_str_conv_enc_opts): convert with one converter, instead
+ of re-creating converters for each buffer expansion.
- * random.c (random_raw_seed): extract platform dependent random
- seed initialization function as a new method Random.raw_seed.
+Tue Mar 19 17:06:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/securerandom.rb (SecureRandom): use Random.raw_seed.
+ * dir.c (glob_helper): compose HFS file names from UTF8-MAC.
+ [ruby-core:48745] [Bug #7267]
-Sat Feb 14 00:49:37 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+Sat Mar 16 01:44:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/coverage/coverage.c: Add Coverage.peek_result. Allows you to
- capture coverage information without stopping the coverage tool.
- [ruby-core:67940] [Feature #10816]
+ * internal.h: added a declaration of ruby_kill().
+ * thread.c (ruby_kill): helper function of kill().
- * test/coverage/test_coverage.rb: test for change.
+ * signal.c (rb_f_kill): use ruby_kill() instead of kill().
+ * signal.c (rb_f_kill): call rb_thread_execute_interrupts()
+ to ensure that make SignalException if sent a signal
+ to myself. [Bug #7951] [ruby-core:52864]
-Fri Feb 13 21:52:05 2015 Yusuke Endoh <mame@tsg.ne.jp>
+ * vm_core.h (typedef struct rb_thread_struct): added
+ th->interrupt_cond.
+ * thread.c (rb_threadptr_interrupt_common): added to
+ initialization of th->interrupt_cond.
+ * thread.c (thread_create_core): ditto.
- * string.c (str_discard): does not free for STR_NOFREE string.
- [Bug #10853][ruby-core:68110]
+ * test/ruby/test_signal.rb (TestSignal#test_hup_me): test for
+ the above.
- * bootstraptest/test_string.rb: test for above.
+Sat Mar 16 00:42:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Fri Feb 13 21:16:00 2015 Yusuke Endoh <mame@tsg.ne.jp>
+ * io.c (linux_iocparm_len): enable only exist _IOC_SIZE().
+ Because musl libc doesn't have it. [Bug #8051] [ruby-core:53229]
- * lib/base64.rb: make urlsafe mode user-friendly.
+Tue Mar 19 10:05:04 2013 Shota Fukumori <her@sorah.jp>
- * lib/base64.rb (Base64.urlsafe_encode64): a new option "padding" to
- suppress the padding character ("=").
+ * ext/objspace/objspace.c: Fix typo in doc. Patch by Sho Hashimoto.
+ [Bug #8116] [ruby-dev:47177]
- * lib/base64.rb (Base64.urlsafe_decode64): now it accepts not only
- correctly-padded input but also unpadded input.
- [Feature #10740][ruby-core:67570]
+Tue Mar 19 02:13:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * test/base64/test_base64.rb: Test for above
+ * configure.in: set ac_cv_prog_cxx if CXX is supplied.
-Fri Feb 13 14:19:06 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Mar 19 01:18:00 2013 Kenta Murata <mrkn@mrkn.jp>
- * ext/json: merge upstream from flori/json
- change usage of TypedData. [Feature #10739][ruby-core:67564]
+ * configure.in: Fix c++ compiler auto-selection not only for
+ Darwin 11.x, but also the other versions of Darwin.
-Thu Feb 12 18:34:01 2015 multisnow <infinity.blick.winkel@gmail.com>
+Tue Mar 19 00:26:22 2013 Narihiro Nakamura <authornari@gmail.com>
- * ext/openssl/extconf.rb: check RAND_edg to support libressl.
+ * gc.c: Improve accuracy of objspace_live_num() and
+ allocated/freed counters. patched by tmm1(Aman Gupta).
+ [Bug #8092] [ruby-core:53392]
- * ext/openssl/ossl_rand.c (ossl_rand_egd): define only if RAND_edg
- is available. [Fix GH-829]
+Mon Mar 18 21:42:48 2013 Narihiro Nakamura <authornari@gmail.com>
-Thu Feb 12 10:46:14 2015 Eric Hodel <drbrain@segment7.net>
+ * gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta).
+ [Bug #8093] [ruby-core:53393]
- * proc.c (proc_call): Improve Proc#call documentation. Patch by
- Hsing-Hui Hsu. [fix GH-761]
+Mon Mar 18 17:58:36 2013 Narihiro Nakamura <authornari@gmail.com>
-Thu Feb 12 04:33:02 2015 Benoit Daloze <eregontp@gmail.com>
+ * gc.c: Fix unlimited memory growth with large values of
+ RUBY_FREE_MIN. patched by tmm1(Aman Gupta).
+ [Bug #8095] [ruby-core:53405]
- * compar.c (cmp_equal): no more error hiding for Comparable#==.
- It now behaves as other Comparable methods. See #7688.
+Mon Mar 18 14:46:19 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * test/ruby/test_comparable.rb: update related test.
+ * test/win32ole/test_err_in_callback.rb
+ (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
+ the top of build directory.
-Thu Feb 12 03:28:05 2015 Eric Wong <e@80x24.org>
+Mon Mar 18 13:29:52 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/set.rb (initialize): internal hash defaults to false
+ * vm_dump.c (backtrace): on darwin use custom backtrace() to trace
+ beyond _sigtramp. darwin's backtrace can't trace beyond signal
+ trampoline with sigaltstack.
- * lib/set.rb (include?): use Hash#[] for optimized dispatch.
- Patch by Ismael Abreu <ismaelga@gmail.com>
- [ruby-core:67664] [Misc #10754]
+ * configure.in: check execinfo.h on darwin.
-Wed Feb 11 11:09:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 18 11:03:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/digest/digest_conf.rb (digest_conf): check for CommonDigest.
+ * vm_exec.h (END_INSN): revert r39517 because the segv seems fixed by
+ r39806.
- * ext/digest/*/*cc.h: for Apple CommonCrypto/CommonDigest.h.
+Mon Mar 18 10:41:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/digest/digest.h (DEFINE_FINISH_FUNC_FROM_FINAL): macro for
- finish functions, by inverting arguments order.
+ * vm_exec.c: Correct predefined macro name. This typo is introduced by
+ r36534 and should be backported to ruby_2_0_0.
- * ext/digest/digest_conf.rb (digest_conf): extract common
- configurations.
+Mon Mar 18 03:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Wed Feb 11 11:01:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c: Typo in Array#delete by Timo Sand [GH fixes #258]
- * ext/json/generator/generator.c (generate_json): get rid of
- unnecessary recursive calls which can cause infinite recursion.
- T_STRING may not have rb_cString.
+Mon Mar 18 01:14:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Feb 11 07:53:35 2015 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * io.c (io_fillbuf): show fd number on failure to debug.
+ http://c5632.rubyci.org/~chkbuild/ruby-trunk/log/20130316T050302Z.diff.html.gz
- * test/win32ole/test_word.rb: use skip method to skip test.
+Sun Mar 17 02:38:21 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Feb 10 11:38:28 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/date/date_core.c: include sys/time.h for avoiding implicit
+ declaration of gettimeofday().
- * vm_insnhelper.c (vm_call_method): stop method search when a method
- is not found in a refinement, to support undef in refinements.
- [ruby-core:66741] [Bug #10578]
+Sun Mar 17 00:55:31 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Feb 10 11:19:11 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * include/ruby/missing.h: removed __linux__. it's unnecessary.
- * lib/net/ftp.rb (chdir, delete, gettextfile, mdtm, mkdir, nlst,
- putbinaryfile, puttextfile, rename, rmdir, size): support
- Pathname. Patch by Joe Rafaniello. [fix GH-828]
+Fri Mar 15 14:57:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Feb 9 16:36:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c: disabled _FORTIFY_SOURCE for avoid to hit glibc bug.
+ [Bug #8080] [ruby-core:53349]
+ * test/ruby/test_io.rb (TestIO#test_io_select_with_many_files):
+ test for the above.
- * tool/make-snapshot (package): get rid of loading unbundled and
- unexpected libraries. [ruby-core:67977] [Bug #10822]
+Wed Mar 13 15:16:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun Feb 8 20:09:37 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * include/ruby/missing.h (__syscall): moved to...
+ * io.c: here. because __syscall() is only used from io.c.
- * lib/net/http/header.rb: pass header names as symbols.
- Patch by @DamirSvrtan [fix GH-805]
- * test/net/http/test_httpheader.rb: added test.
+ * include/ruby/missing.h: move "#include <sys/type.h>" to ....
+ * include/ruby/intern.h: here. because it was introduced for
+ fixing NFDBITS issue. [ruby-core:05179].
-Sun Feb 8 13:04:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 13 14:38:53 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/socket/getaddrinfo.c (get_addr): reject too long hostname to
- get rid of GHOST vulnerability on very old platforms.
+ * include/ruby/missing.h (struct timespec): include <sys/time.h>
- * ext/socket/raddrinfo.c (make_hostent_internal): ditto, paranoic
- check for the canonical name.
+Wed Mar 13 13:54:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun Feb 8 12:48:38 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: check struct timeval exist or not.
+ * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL
+ properly. and don't include sys/time.h if struct timeval exist.
- * ext/win32/lib/win32/registry.rb (Win32::Registry::API): use wide
- versions of RegDeleteValue and RegDeleteKey.
- [ruby-core:67958] [Bug #10820]
+ * file.c: include sys/time.h explicitly.
+ * random.c: ditto.
+ * thread_pthread.c: ditto.
+ * time.c: ditto.
+ * ext/date/date_strftime.c: ditto.
-Sat Feb 7 22:13:08 2015 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Fri Mar 15 14:45:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * test/win32ole/test_win32ole_record.rb: remove test using .NET
- Framework 3.5 because it is not included in Windows 8/8.1.
+ * configure.in (_FORTIFY_SOURCE): added a few comments.
-Sat Feb 7 19:25:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 15 14:17:55 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * dir.c (has_magic): always get long path name on Windows even if
- no tilde is there. [ruby-core:68011] [Bug #10819]
+ * thread_pthread.c (numberof): renamed from ARRAY_SIZE() because
+ other all files use numberof().
- * dir.c (replace_real_basename): FindFirstFile ignore redirection
- character, check if exists before call it. cf. [Bug #8597]
+Say Mar 15 01:33:00 2013 Charles Oliver Nutter <headius@headius.com>
-Sat Feb 7 13:30:11 2015 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * test/ruby/test_lazy_enumerator.rb (TestLazyEnumerator#test_drop_while):
+ Modify while condition to show dropping remains off after first false
+ value. This change was made in 39711.
- * test/win32ole/test_win32ole_record.rb
- (test_ole_instance_variable_get): correct VT_RECORD type and
- instance variables.
+Fri Mar 15 23:06:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Feb 6 17:47:05 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+ * time.c (GetTimeval): check if already initialized instance.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
- dumping objects with custom coders. [ruby-core:66215] [Bug #10496]
+ * time.c (GetNewTimeval): check if newly created instance.
- * test/psych/test_coder.rb: test for fix
+ * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must
+ be newly created instance. [ruby-core:53436] [Bug #8099]
-Fri Feb 6 16:58:31 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+Fri Mar 15 14:51:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/lib/psych/visitors/to_ruby.rb: fix support for regular
- expressions with newlines. tenderlove/psych#222
+ * file.c (rb_sys_fail_path_with_func): share same function, and path
+ may be nil.
- * test/psych/test_yaml.rb: test for change.
+Fri Mar 15 08:24:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Feb 6 10:31:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * io.c (rb_sys_fail_path): define & use rb_sys_fail_path0 like r39752
- * vm_core.h (rb_call_info_kw_arg_struct): make keywords a symbols
- list to get rid of inadvertent creation by variable keyword
- arguments. [ruby-core:68031] [Bug #10831]
+Fri Mar 15 04:08:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Feb 5 22:42:34 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * proc.c: Typo in Proc.arity found by Jack Nagel [Bug #8094]
- * lib/rubygems: Update to RubyGems HEAD(5c3b6f3).
- Fixed #1156, #1142, #1115, #1142, #1139 on rubygems/rubygems
- * test/rubygems: ditto.
+Thu Mar 14 16:59:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Feb 5 13:41:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in (rb_cv_function_name_string): macro for function name
+ string predefined identifier, __func__ in C99, or __FUNCTION__ in
+ gcc.
- * vm_eval.c (send_internal), vm_insnhelper.c (vm_call_opt_send):
- convert String method name into a Symbol, as method_missing
- method expects its first argument to be a Symbol. [Bug #10828]
+ * file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING.
- * vm_insnhelper.c (ci_missing_reason): return the reason of method
- missing in call info.
+Thu Mar 14 14:12:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_insnhelper.c (vm_call_opt_send): re-apply r49500 with the
- proper missing reason. [Bug #10828]
+ * file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC.
+ __func__ is C99 feature.
-Thu Feb 5 10:31:46 2015 Shugo Maeda <shugo@ruby-lang.org>
+Thu Mar 14 12:59:59 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * class.c (rb_obj_singleton_methods): should use RTEST() to convert
- VALUE to int.
+ * file.c (rb_sys_fail_path0): add to append the name of called function
+ to ease debugging for example blow umask_spec failure.
+ http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130309T010202Z.diff.html.gz
-Thu Feb 5 03:59:33 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * file.c (rb_sys_fail_path): use rb_sys_fail_path0.
- * vm_insnhelper.c: Fix symbol leak with +send+ [Bug #10828]
+Thu Mar 14 12:53:15 2013 Luis Lavena <luislavena@gmail.com>
-Wed Feb 4 20:26:54 2015 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * win32/file.c (get_user_from_path): add internal function that retrieves
+ username from supplied path (refactored).
+ * win32/file.c (rb_file_expand_path_internal): refactor expansion of user
+ home to use get_user_from_path and cover dir_string corner cases.
+ [ruby-core:53168] [Bug #8034]
- * ext/win32ole/win32ole.c (Init_win32ole): should not use atexit to
- free allocated hash table to avoid error on Cygwin.
+Thu Mar 14 11:53:01 2013 Narihiro Nakamura <authornari@gmail.com>
-Wed Feb 4 15:34:25 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * NEWS: describe RUBY_HEAP_SLOTS_GROWTH_FACTOR.
- * class.c (method_entry_i, class_instance_method_list,
- rb_obj_singleton_methods): should not include methods of
- superclasses if recur is false. [ruby-dev:48854] [Bug #10826]
+Thu Mar 14 10:01:12 2013 Eric Hodel <drbrain@segment7.net>
-Wed Feb 4 16:32:40 2015 Matt Hoyle <matt@deployable.co>
+ * doc/globals.rdoc: $? is thread-local
- * ext/bigdecimal/bigdecimal.c (VpSetPTR): fix a typo, 'expoennt'
- to 'exponent'. [ruby-core:67980] [Bug #10823] [Fix GH-825]
+Wed Mar 13 23:25:59 2013 Narihiro Nakamura <authornari@gmail.com>
-Wed Feb 4 15:55:38 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: allow to tune growth of heap by environment variable
+ RUBY_HEAP_SLOTS_GROWTH_FACTOR. patched by tmm1(Aman Gupta).
+ [Feature #8015] [ruby-core:53131]
- * ext/sdbm/_sdbm.c: include ruby/ruby.h for PRIdPTRDIFF when a
- macro `DEBUG` is defined. based on the patch by Owen Rodley in
- [ruby-core:67987]. [Bug #10825]
+Wed Mar 13 19:43:46 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Wed Feb 4 11:12:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * doc/irb/irb.rd.ja: fix typo
- * Makefile.in (probes.stamp): rebuild dtrace dependent objects
- only when `dtrace -G` modifies its input files.
+ * ext/tk/MANUAL_tcltklib.eng: fix typos
-Tue Feb 3 19:27:16 2015 Naohisa Goto <ngotogenome@gmail.com>
+ * ext/tk/sample/tktextframe.rb (Tk#component_delegates): fix typo
- * common.mk (ruby-glommed.o): dependency on $(OBJ) should be written
- in common.mk (in which OBJ is defined) because of Makefile include
- and parse order. This partly reverts r49419.
- [ruby-dev:48849] [Bug #10808]
+Wed Mar 13 15:13:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * Makefile.in (ruby-glommed.o): ditto.
+ * class.c (rb_obj_singleton_methods): collect methods from the origin
+ class. [ruby-core:53207] [Bug #8044]
- * Makefile.in (ruby-glommed.o): remove excess $(DTRACE_OBJ) because
- it is included in $(OBJS) since r49451.
+Wed Mar 13 14:51:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * Makefile.in (probes.o): should depend on $(DTRACE_DEPENDENT_OBJS)
+ * vm_method.c (rb_export_method): directly override the flag of method
+ defined in prepending class too, not adding zsuper entry.
+ [ruby-core:53106] [Bug #8005]
-Tue Feb 3 17:15:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 13 13:06:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/mkmf.rb (try_cppflags, try_cflags, try_ldflags): get rid of
- interference by modifying global variables in have_devel? method.
- [ruby-core:67962] [Bug #10821]
+ * configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not
+ available on old shells.
-Tue Feb 3 15:23:58 2015 Shugo Maeda <shugo@ruby-lang.org>
+ * configure.in (shvar_to_cpp): escape quotes for old shells.
+ [Bug #7959] [Bug #8071]
- * vm_method.c (remove_method): When remove refined
- method, raise a NameError if the method is not
- defined in refined class.
+Wed Mar 13 11:11:07 2013 Shugo Maeda <shugo@ruby-lang.org>
- But if the method is defined in refined class,
- it should keep refined method and remove original
- method.
+ * object.c (Init_Object): remove Module#used, which has been
+ introduced in Ruby 2.0 by mistake. [Bug #7916] [ruby-core:52719]
- Patch by Seiei Higa. [ruby-core:67722] [Bug #10765]
+Wed Mar 13 05:49:29 2013 Eric Hodel <drbrain@segment7.net>
-Tue Feb 3 14:04:47 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/irb.rb: Fix typo
- * dir.c (glob_helper): obtain real name with FindFirstFile API
- instead of matching all entries, on Windows.
- [ruby-core:67954] [Bug #10819]
+Tue Mar 12 22:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Feb 3 12:26:35 2015 Katsuhiko Nishimra <ktns.87@gmail.com>
+ * compile.c (iseq_set_arguments, iseq_compile_each): support required
+ keyword arguments. [ruby-core:51454] [Feature #7701]
- * lib/mkmf.rb (configuration): set the default cxxflags, which is
- referred from the default CXXFLAGS, for extension libraries.
- [Fix GH-823]
+ * iseq.c (rb_iseq_parameters): ditto.
-Tue Feb 3 05:52:00 2015 Aman Gupta <ruby@tmm1.net>
+ * parse.y (f_kw, f_block_kw): ditto. this syntax is still
+ experimental, the notation may change.
- * gc.c (rb_objspace_free): cause rb_bug if lazy sweep is in progress
- during rb_objspace_free. Adds extra protection for r46340.
- Patch by Vicent Marti. [Bug #10768] [ruby-core:67734]
- * gc.c (rb_objspace_call_finalizer): Ensure GC is completed after
- finalizers have run. We already call gc_rest() before invoking
- finalizers, but finalizer can allocate new objects and start new GC
- cycle, so we call gc_rest() again after finalizers are complete.
+ * vm_core.h (rb_iseq_struct): ditto.
-Mon Feb 2 10:51:34 2015 Ari Pollak <ajp@aripollak.com>
+ * vm_insnhelper.c (vm_callee_setup_keyword_arg): ditto.
- * doc/security.rdoc (Symbols): update about Symbol GC. Symbols
- explicitly converted from Strings now can be collected, but
- reflection/metaprogramming still can cause memory flooding.
- [Fix GH-725]
+Tue Mar 12 17:02:53 2013 TAKANO Mitsuhiro <tak@no32.tk>
-Sun Feb 1 13:46:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * date_core.c: clearly specify operator precedence.
- * tool/rbinstall.rb (bin-comm): drop batch file installation.
- Windows 95 support has not been supported already.
- [Feature #10806]
+Tue Mar 12 17:00:45 2013 TAKANO Mitsuhiro <tak@no32.tk>
-Sat Jan 31 12:06:23 2015 Scott Francis <scott.francis@shopify.com>
+ * insns.def: fix condition.
- * thread_pthread.c (reserve_stack): fix intermittent SIGBUS on
- Linux, by reserving the stack virtual address space at process
- start up so that it will not clash with the heap space.
- [Fix GH-822]
+Tue Mar 12 16:48:19 2013 TAKANO Mitsuhiro <tak@no32.tk>
-Fri Jan 30 17:28:29 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * rational.c: fix dangling if, else-if and else.
- * math.c (num2dbl_with_to_f): make faster when Bignum passed by
- direct conversion using rb_big2dbl(). [Feature #10800]
+Tue Mar 12 06:27:59 2013 Eric Hodel <drbrain@segment7.net>
-Thu Jan 29 23:30:00 2015 Kenta Murata <mrkn@mrkn.jp>
+ * lib/rubygems/commands/setup_command.rb: Don't delete non-rubygems
+ files when installing RubyGems.
+ * test/rubygems/test_gem_commands_setup_command.rb: Test for the
+ above.
- * ext/bigdecimal/bigdecimal.c (rb_rational_num): add fallback function
- for rubies lower than 2.2.0.
+ * lib/rubygems/ext/ext_conf_builder.rb: Use full path to siteconf.rb
+ in case the extconf.rb changes directories (like memcached does).
- * ext/bigdecimal/bigdecimal.c (rb_rational_den): ditto.
+ * lib/rubygems/package.rb: Remove double slash from path.
+ * test/rubygems/test_gem_package.rb: Test for the above.
+ * test/rubygems/test_gem_package_old.rb: ditto.
- * ext/bigdecimal/extconf.rb: check the existences of struct RRational,
- rb_rational_num, and rb_rational_den.
+ * lib/rubygems/source.rb: Revert automatic HTTPS upgrade
+ * lib/rubygems/spec_fetcher.rb: ditto.
+ * test/rubygems/test_gem_remote_fetcher.rb: ditto.
+ * test/rubygems/test_gem_source.rb: ditto.
+ * test/rubygems/test_gem_spec_fetcher.rb: ditto.
- * ext/bigdecimal/bigdecimal.bundle: bump version.
+Tue Mar 12 02:25:19 2013 Eric Hodel <drbrain@segment7.net>
-Thu Jan 29 20:28:25 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/net/smtp.rb: Added Net::SMTP#rset method to implement the SMTP
+ RSET command. [ruby-trunk - Feature #5373]
+ * NEWS: ditto.
+ * test/net/smtp/test_smtp.rb: Test for the above.
- * tool/make-snapshot: removed md5 digest with package information
+Mon Mar 11 22:44:57 2013 Tanaka Akira <akr@fsij.org>
-Thu Jan 29 10:41:52 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
+ * lib/resolv-replace.rb (TCPSocket#initialize): resolve the 3rd
+ argument only if non-nil value is given.
+ [ruby-dev:47150] [ruby-trunk - Bug #8054] reported and analyzed by
+ mrkn.
- * math.c (Get_Double): direct casting from Fixnum to double.
- [Feature #10785]
+Mon Mar 11 19:22:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu Jan 29 02:34:27 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/mkmf/base.rb: class name conflict.
- * ext/psych/lib/psych/visitors/to_ruby.rb: fix parsing hashes with
- instance variables when it is referenced multiple times.
- * ext/psych/lib/psych.rb: bump version
- * ext/psych/psych.gemspec: bump version
- * test/psych/test_hash.rb: test for fix
+Mon Mar 11 18:45:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Jan 29 02:06:09 2015 Eric Wong <e@80x24.org>
+ * enumerator.c (enumerator_with_index): try to convert given offset to
+ integer. fix bug introduced in r39594.
- * thread.c (struct join_arg): restructure and make smaller
- (thread_join_sleep): avoid timeofday() call if forever
- (thread_join): pass join_arg.delay directly
- (rb_thread_inspect_msg): remove, inline into rb_thread_inspect
- (rb_thread_inspect): reduce branching and string creation
- * thread_pthread.c (native_set_thread_name): create string directly
- to avoid reparsing. [Misc #10723]
+Mon Mar 11 17:27:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Jan 28 21:32:24 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * test/ruby/envutil.rb (EnvUtil.with_default_external): add for
+ changing Encoding.default_external without warnings.
- * thread.c: Improve documentation for Thread#value
- [Bug #10694][ruby-core:67324][ci skip]
+ * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto.
-Tue Jan 27 16:04:19 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/ruby/test_io_m17n.rb: use above with_default_external.
- * tool/redmine-backporter.rb: added `!` command.
+Mon Mar 11 16:57:00 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Tue Jan 27 15:58:23 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * io.c (extract_binmode): raise error even if binmode and textmode
+ don't conflict. [Bug #5918] [ruby-core:42199]
- * tool/redmine-backporter.rb: added history feature for platforms which
- lack readline.
+Mon Mar 11 12:25:12 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Jan 26 22:09:35 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * Merge Onigmo d4bad41e16e3eccd97ccce6f1f96712e557c4518.
+ fix lookbehind assertion fails with /m mode enabled. [Bug #8023]
+ fix \Z matches where it shouldn't. [Bug #8001]
- * .gitignore: ignored temporary file with git.
+Mon Mar 11 11:53:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jan 26 18:06:03 2015 Akinori MUSHA <knu@iDaemons.org>
+ * lib/mkmf.rb (MakeMakefile#dir_config, MakeMakefile#_libdir_basename):
+ defer use of instance variable until needed. [Bug #8074]
- * misc/ruby-electric.el: Import version 2.2.2 from
- https://github.com/knu/ruby-electric.el.
+Thu Mar 7 10:42:28 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Mon Jan 26 11:37:49 2015 Dave Stevens <dave@crowdlab.com>
+ * lib/thread.rb (Queue#clear): return self.
+ Patch by Cubing Cube. Thank you! [Bug #7947] [ruby-dev:47098]
+ * lib/thread.rb (Queue#push): ditto.
+ * lib/thread.rb (SizedQueue#push): ditto.
+ * test/thread/test_queue.rb: add tests for the above.
- * string.c (str_make_independent_expand): terminate String when
- moved from heap to embedded. [Fix GH-821].
+Thu Mar 7 10:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun Jan 25 12:04:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * tool/change_maker.rb (#diff2index): check Encoding::BINARY.
+ BASERUBY may still be 1.8.x.
- * array.c (flatten): no need to call to_ary method on elements
- beyond the given level. [ruby-core:67637] [Bug #10748]
+Thu Mar 7 08:47:42 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sun Jan 25 00:42:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * NEWS (Mutex#owned?): no longer experimental.
- * ext/fiddle/win32/libffi.mk.tmpl: assemble without directory prefix.
- workaround of a bug of VC12 ml, by unak at [ruby-core:67792].
- [ruby-core:67789] [Bug #10780]
+Sun Mar 10 23:38:15 2013 Luis Lavena <luislavena@gmail.com>
-Sat Jan 24 19:56:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * win32/file.c (rb_file_expand_path_internal): Expand home directory when
+ used as second parameter (dir_string). [ruby-core:53168] [Bug #8034]
+ * test/ruby/test_file_exhaustive.rb: add test to verify.
- * dln_find.c (dln_find_1): search regular files only. based on
- the patch by Alex Coomans in [ruby-core:67766]. [Bug #10776]
+Sun Mar 10 23:27:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 23 23:57:05 2015 Misumi Rize <r@ayase-e.li>
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ it is impossible to predict which file will be installed to where,
+ by the arguments, so use intermediate destination directory always.
+ [Bug #7698]
- * vm_insnhelper.c (vm_throw_start): search the target to break
- from a block with nested rescue, from the nested blocks.
- [ruby-core:67765] [Bug #10775] [Fix GH-820]
+Sun Mar 10 17:00:22 2013 Tadayoshi Funaba <tadf@dotrb.org>
-Fri Jan 23 20:00:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * complex.c: edited rdoc.
+ * rational.c: ditto.
- * marshal.c (w_object, marshal_dump): use identity tables for
- arbitrary VALUE keys, because of performance of FLONUM.
- [Bug #10761]
+Sun Mar 10 15:02:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * marshal.c (obj_alloc_by_klass, marshal_load): ditto.
+ * process.c (setup_communication_pipe): remove unused function.
+ it was unintentionally added r39683.
-Fri Jan 23 17:12:33 2015 Eric Wong <e@80x24.org>
+Wed Mar 6 00:30:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * benchmark/bm_marshal_dump_flo.rb: new benchmark for [Bug #10761]
+ * tool/gen_ruby_tapset.rb: add tapset generator.
-Thu Jan 22 18:03:19 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Mar 6 03:27:43 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * tool/redmine-backporter.rb (find_svn_log): use double quotes instead
- of single quotes because cmd.exe doesn't handle them.
+ * probes.d (symbol-create): change argument name `string' to
+ `str'. `string' is a keyword for systemtap.
- * tool/redmine-backporter.rb (done): the 2nd element of matched data
- is the offset of the end of matched string, not length.
+Tue Mar 5 22:23:01 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Thu Jan 22 16:45:24 2015 Eric Wong <e@80x24.org>
+ * probes.d: added argument name
- * st.c (st_numhash): mix float value for flonum
- * hash.c (rb_any_hash): ditto
- * benchmark/bm_hash_aref_flo.rb: new benchmark
- * benchmark/bm_hash_ident_flo.rb: ditto
- [Bug #10761]
+Thu Mar 7 01:17:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Wed Jan 21 22:33:51 2015 Akinori MUSHA <knu@iDaemons.org>
+ * test/thread/test_queue.rb (TestQueue#test_thr_kill): reduce
+ iterations from 2000 to 250. When running on uniprocessor
+ systems, every th.kill needs TIME_QUANTUM_USEC time (i.e.
+ 100msec on posix systems). Because, "r.read 1" is 3 steps
+ operations that 1) release GVL 2) read 3) acquire gvl and
+ (1) invoke context switch to main thread. and then, main
+ thread's th.kill resume (1), but not (2). Thus read interrupt
+ need TIME_QUANTUM_USEC. Then maximum iteration is 30sec/100msec
+ = 300.
- * misc/ruby-electric.el: Import version 2.2.1 from
- https://github.com/knu/ruby-electric.el. Improve compatibility
- with and optimize for Emacs 24.4.
+Thu Mar 7 00:14:51 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Wed Jan 21 09:40:52 2015 Zachary Scott <e@zzak.io>
+ * io.c (rb_update_max_fd): use ATOMIC_CAS because this function
+ is used from timer thread too.
- * file.c: Document other cases of missing birthtime on OS with patch
- provided by @sho-h similar to GH-817. [ci skip] [DOC]
+Wed Mar 6 23:30:21 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Wed Jan 21 09:09:19 2015 Tanaka Akira <akr@fsij.org>
+ * thread_pthread.c (ARRAY_SIZE): new.
+ * thread_pthread.c (gvl_acquire_common): use low priority
+ notification for avoiding timer thread interval confusion.
+ If we use timer_thread_pipe[1], every gvl_yield() request
+ one more gvl_yield(). It lead to thread starvation.
+ [Bug #7999] [ruby-core:53095]
+ * thread_pthread.c (rb_reserved_fd_p): adds timer_thread_pipe_low
+ to reserved fds.
- * NEWS: References to tickets added.
- [ruby-core:67701] [Bug #10760] Suggested by Zachary Scott.
+Wed Mar 6 22:36:19 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Jan 20 22:59:54 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * thread_pthread.c (rb_thread_wakeup_timer_thread_fd): add fd
+ argument and remove hardcoded dependency of timer_thread_pipe[1].
+ * thread_pthread.c (consume_communication_pipe): add fd argument.
+ * thread_pthread.c (close_communication_pipe): ditto.
- * tool/vcs.rb: fix the exception given remote-url of svn.
+ * thread_pthread.c (timer_thread_sleep): adjust the above changes.
-Tue Jan 20 12:58:33 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * thread_pthread.c (setup_communication_pipe_internal): factor
+ out pipe initialize logic.
- * tool/redmine-backporter.rb: now can change the page of `ls`.
+Wed Mar 6 22:56:14 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Jan 20 12:28:37 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * thread_pthread.c (ubf_select): add to small comments why we
+ need to call rb_thread_wakeup_timer_thread().
- * tool/redmine-backporter.rb (readline): fallback to normal gets on
- Windows because IO.console.getch is not always do as expected.
+Wed Mar 6 21:42:24 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Jan 20 11:31:07 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * thread_pthread.c (rb_thread_create_timer_thread): factor out
+ creating communication pipe logic into separate function.
+ * thread_pthread.c (setup_communication_pipe): new helper function.
+ * thread_pthread.c (set_nonblock): moves a definition before
+ setup_communication_pipe.
- * tool/redmine-backporter.rb: update usage.
+Sun Mar 3 02:42:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Jan 20 11:23:47 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread_pthread.c (consume_communication_pipe): retry when
+ read returned CCP_READ_BUFF_SIZE.
- * tool/redmine-backporter.rb (mygets): to support Backspace
- implement gets by itself.
+Wed Mar 6 21:31:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Tue Jan 20 02:54:11 2015 Zachary Scott <e@zzak.io>
+ * thread_pthread.c (timer_thread_sleep): use poll() instead of
+ select(). select doesn't work if timer_thread_pipe[0] is
+ greater than FD_SETSIZE.
+ * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): add a dependency
+ against poll.
- * file.c: NotImplementedError is raised if birthtime is unavailable.
- Patch by @y-yagi san and [Fixes GH-817] [ci skip] [DOC]
+Wed Mar 6 21:00:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/pathname/pathname.c: ditto.
+ * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
+ ifdef conditions.
-Mon Jan 19 22:08:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 3 02:30:36 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * class.c (include_modules_at): allow to prepend each module up to
- once for each classe. [EXPERIMENTAL]
+ * thread_pthread.c (set_nonblock): new helper function for set
+ O_NONBLOCK.
+ * thread_pthread.c (rb_thread_create_timer_thread): set O_NONBLOCK
+ to timer_thread_pipe[0] too.
-Sun Jan 18 18:32:20 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sun Mar 10 09:12:51 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * math.c (math_atan2): revive documentation before r49220.
- http://d.hatena.ne.jp/nagachika/20150112/ruby_trunk_changes_49213_49226
+ * complex.c: described syntax of string form.
+ * rational.c: ditto.
-Sun Jan 18 15:57:32 2015 Seiei Higa <hanachin@gmail.com>
+Sat Mar 9 11:58:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c (check_definition): Module#public_method_defined?,
- Module#private_method_defined?, Module#protected_method_defined?
- should not use refinements. [ruby-core:67656] [Bug #10753]
+ * marshal.c (w_extended): check for prepended object.
+ [ruby-core:53206] [Bug #8043]
-Sun Jan 18 15:50:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 9 08:36:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_dump.c (rb_vm_bugreport): check by configured result instead
- of system name for old FreeBSD. based on a patch by Steve Wills
- at [ruby-core:67655]. [Bug #10752]
+ * load.c (features_index_add_single, rb_feature_p): store single index
+ as Fixnum to reduce the number of arrays for the indexes. based on
+ the patch by tmm1 (Aman Gupta) in [ruby-core:53216] [Bug #8048].
-Sun Jan 18 12:56:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 9 00:25:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * Makefile.in (VPATH, NEWLINE_C), common.mk (common-srcs): make
- and use newline.c under enc/trans directory, not toplevel. no
- longer search enc directory implicitly.
+ * marshal.c (r_object0): load prepended objects. treat the class of
+ extended object in the included modules as prepended singleton
+ class. [ruby-core:53202] [Bug #8041]
- * configure.in, enc/Makefile.in (BUILTIN_ENCS, BUILTIN_TRANSES):
- prefix respective directory names to builtin encodings and
- transcoder source names.
+Fri Mar 8 19:44:00 2013 Akinori MUSHA <knu@iDaemons.org>
-Sun Jan 18 11:49:46 2015 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+ * man/rake.1, man/ruby.1: Use the Pa macro to make URLs stand out.
- * ext/win32ole/win32ole.c (ole_invoke): avoid SEGV when VT_RECORD
- variable is passed by reference. [ruby-dev:48803] [Bug #10697]
+Fri Mar 8 13:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jan 17 23:59:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/pathname/pathname.c (path_f_pathname): rdoc for Pathname()
- * ext/psych/lib/psych/visitors/yaml_tree.rb (visit_String):
- anchors like `\Z` are not valid inside character class. use
- negative-lookahead instead.
- Fixes: https://github.com/tenderlove/psych/issues/221
+Fri Mar 8 12:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jan 17 23:42:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * man/rake.1: Document ENVIRONMENT variables on RAKE(1) manpage
- * configure.in: get rid of pattern substitution, which is not
- supported by ash, and ash on NetBSD parses whole source first
- and fails to start. [ruby-dev:48823] [Bug #10750]
+Fri Mar 8 10:44:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Jan 16 18:42:58 2015 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/webrick/httpproxy.rb: Fix typos in HTTPProxyServer [Bug #8013]
+ Patch by Nobuhiro IMAI [ruby-core:53127]
- * tool/redmine-backporter.rb: support adding related revisions
- to issues.
+Fri Mar 8 03:16:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-Fri Jan 16 17:20:33 2015 Koichi Sasada <ko1@atdot.net>
+ * class.c (rb_mod_ancestors): Include singleton_class in ancestors
+ list [Feature #8035]
- vm.c, vm_core.h: constify VM_CF_LEP, VM_CF_PREV_EP, VM_CF_BLOCK_PTR
- and rb_vm_control_frame_block_ptr.
+ * test/ruby/test_module.rb (class): test for above
-Fri Jan 16 15:41:21 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/ruby/marshaltestlib.rb (module): adapt test
- * ext/psych/lib/psych.rb: bump version
+ * NEWS: list change
- * ext/psych/psych.gemspec: ditto
+Thu Mar 7 14:21:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 16 15:37:49 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+ * compile.c (iseq_compile_each): pass keyword arguments to zsuper,
+ with current values. [ruby-core:53114] [Bug #8008]
- * ext/psych/lib/psych/visitors/yaml_tree.rb: only dump hash
- subclasses. Thanks Joe Eli McIlvain <joe.eli.mac@gmail.com>
+Thu Mar 7 12:53:47 2013 Eric Hodel <drbrain@segment7.net>
- * test/psych/test_hash.rb: test for change
+ * lib/rubygems/commands/setup_command.rb: Install .pem files.
+ * test/rubygems/test_gem_commands_setup_command.rb: Test for the
+ above.
-Fri Jan 16 15:35:21 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+ * lib/rubygems/spec_fetcher.rb: Test HTTPS upgrade with URI::HTTPS,
+ not URI::HTTP. Fixes bug in automatic HTTPS upgrade.
+ * test/rubygems/test_gem_spec_fetcher.rb: Test for the above.
- * ext/psych/lib/psych.rb: bump version
+ * lib/rubygems.rb: Version 2.0.2
- * ext/psych/lib/psych/visitors/yaml_tree.rb: fix line width wrapping
- for long strings. Thanks Jakub Jirutka <jakub@jirutka.cz>
+ * lib/rubygems/test_utilities.rb: Ensure scheme and uri class match.
- * test/psych/test_string.rb: test for change
+Thu Mar 7 10:39:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 16 11:44:44 2015 Kazuki Tsujimoto <kazuki@callcc.net>
+ * tool/rbinstall.rb (gem): Gem.ensure_gem_subdirectories now has mode
+ option since r39607. refix of r38870.
- * eval_intern.h, vm.c, vm_eval.c, vm_insnhelper.c:
- change throw mechanism (not save target ep, but save target cfp).
- It fixes `unexpected break' bug that occurs when
- TracePoint#binding is called.
- [ruby-dev:48797] [Bug #10689]
+Wed Mar 6 13:14:28 2013 Eric Hodel <drbrain@segment7.net>
- * test/ruby/test_settracefunc.rb: add a test.
+ * test/rubygems/test_gem_spec_fetcher.rb: Removed unused variable.
-Thu Jan 15 23:55:15 2015 Tanaka Akira <akr@fsij.org>
+Wed Mar 6 08:10:15 2013 Eric Hodel <drbrain@segment7.net>
- * io.c (rb_io_close_m): Don't raise when the IO object is closed.
- [ruby-core:67444] [Feature #10718]
+ * test/rubygems/test_require.rb: Fix tests when 'a.rb' exists.
+ [ruby-trunk - Bug #7749]
-Thu Jan 15 21:34:57 2015 Seiei Higa <hanachin@gmail.com>
+Wed Mar 6 08:00:59 2013 Eric Hodel <drbrain@segment7.net>
- * proc.c (rb_obj_singleton_method): Kernel#singleton_method should
- not use refinements, as well as Kernel#method.
- [ruby-core:67603] [Bug #10744]
+ * lib/rubygems.rb: Allow specification of directory permissions.
+ [ruby-trunk - Bug #7713]
+ * test/rubygems/test_gem.rb: Test for the above.
-Thu Jan 15 10:45:04 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 6 07:40:21 2013 Eric Hodel <drbrain@segment7.net>
- * array.c (rb_ary_select_bang, ary_reject_bang): linear
- performance. [ruby-core:67418] [Feature #10714]
+ * lib/rubygems/commands/query_command.rb: Only fetch remote specs when
+ showing details. [ruby-trunk - Bug #8019] RubyGems bug #487
+ * lib/rubygems/remote_fetcher.rb: ditto.
+ * lib/rubygems/security/policy.rb: ditto.
+ * test/rubygems/test_gem_commands_query_command.rb: Test for the
+ above.
-Wed Jan 14 18:06:06 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
+ * lib/rubygems/security.rb: Make OpenSSL optional for RubyGems.
+ * lib/rubygems/commands/cert_command.rb: ditto.
- * lib/uri/mailto.rb: raising URI::InvalidComponentError instead
- of failing with undefined method `split' for nil:NilClass for
- mailto: URIs without opaque part. [Bug #10738]
- * test/uri/testuri.rb: Test for above
+ * lib/rubygems/config_file.rb: Display file with YAML error, not
+ ~/.gemrc
-Wed Jan 14 16:45:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/remote_fetcher.rb: Only create gem subdirectories when
+ installing gems.
+ * lib/rubygems/dependency_resolver.rb: ditto.
+ * lib/rubygems/test_utilities.rb: ditto.
+ * test/rubygems/test_gem_commands_fetch_command.rb: Test for the
+ above.
- * tool/downloader.rb (RubyGems.download): verify downloaded gem
- packages. LowSecurity to allow untrusted certificates now.
+ * lib/rubygems/spec_fetcher.rb: Only try to upgrade
+ http://rubygems.org to HTTPS
+ * test/rubygems/test_gem_spec_fetcher.rb: Test for the above.
-Wed Jan 14 15:43:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems.rb: Update win_platform? check for JRuby compatibility.
- * ext/readline/readline.c (readline_s_refresh_line): initialize
- before rl_refresh_line(), as some function make the internal
- state non-clean but rl_refresh_line() does not re-initialize it.
- [ruby-core:43957] [Bug #6232]
+ * test/rubygems/test_gem_installer.rb: Update for Ruby 1.9.2
+ compatibility
-Tue Jan 13 21:59:24 2015 Michal Papis <mpapis@gmail.com>
+Wed Mar 6 01:19:28 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * tool/rbinstall.rb (gem): fix changing permissions of installed
- bundled gems. [Fix GH-812]
+ * enumerator.c (enumerator_with_index, lazy_take): use INT2FIX(0)
+ instead of INT2NUM(0).
-Tue Jan 13 21:57:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): ditto.
- * common.mk (distclean-local): remove autom4te.cache generated by
- autoconf.
+ * ext/fiddle/function.c (function_call): ditto.
- * common.mk (realclean-local): remove id sources and dummy header
- for dtrace. [ruby-core:67562] [Bug #10737]
+ * ext/openssl/ossl_x509store.c (ossl_x509store_initialize): ditto.
-Tue Jan 13 21:08:22 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * process.c (proc_getsid): ditto.
- * ext/json, test/json: merge JSON HEAD(259dee6)
- separate implementation of Typed_Data macro.
- https://github.com/flori/json/compare/v1.8.1...v1.8.2
+ * transcode.c (econv_finish): ditto.
-Tue Jan 13 14:16:35 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Mar 5 21:36:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/net/http/test_http.rb: get rid of accessing DNS actually
- for some servers returning wrong results.
- [ruby-core:67454] [Bug #10721]
+ * class.c (rb_prepend_module): check redefinition of built-in optimized
+ methods. [ruby-dev:47124] [Bug #7983]
-Mon Jan 12 23:21:57 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm.c (rb_vm_check_redefinition_by_prepend): ditto.
- * gems/bundled_gems: update test-unit to 3.0.9.
+Tue Mar 5 20:29:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jan 12 18:35:44 2015 Eric Wong <e@80x24.org>
+ * proc.c (mnew): revert r39224. [ruby-core:53038] [Bug #7988]
- * numeric.c (bit_coerce): use original value for error message
- [ruby-core:67405] [Bug #10711]
- * test/ruby/test_numeric.rb (test_coerce): check error message
+Tue Mar 5 20:23:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jan 12 18:01:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/intern.h (rb_check_arity): make a static inline
+ function so it can be used as an expression and argc would be
+ evaluated only once.
- * lib/rdoc/text.rb (expand_tabs): get rid of infinite loop with
- CR. should check if substitution occurred too.
- [ruby-dev:48813] [Bug #10732]
+Tue Mar 5 12:30:55 2013 Eric Hodel <drbrain@segment7.net>
-Mon Jan 12 16:45:46 2015 Seiei Higa <hanachin@gmail.com>
+ * lib/rubygems.rb: Bump version to 2.0.1 for upcoming bugfix release
- * vm_method.c (rb_alias): raise a NameError when creating alias to
- a refined method if the original method of the refined method is
- not defined. [ruby-core:67523] [Bug #10731]
+ * lib/rubygems/ext/ext_conf_builder.rb: Restore ruby 1.8 compatibility
+ for [Bug #7698]
+ * test/rubygems/test_gem_installer.rb: Ditto.
-Mon Jan 12 13:53:17 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rubygems/package.rb: Restore ruby 1.8 compatibility.
- * math.c (math_atan2): improve documentation.
- [Feature #10323][ruby-core:65400][ci skip]
+ * test/rubygems/test_gem_dependency_installer.rb: Fix warnings
-Mon Jan 12 13:50:49 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Mar 5 12:24:23 2013 Eric Hodel <drbrain@segment7.net>
- * ext/bigdecimal/bigdecimal.c: fixes documentation like labeled lists,
- code examples etc. [ruby-core:66730][Bug #10576][ci skip]
+ * enumerator.c (enumerator_with_index): Restore handling of a nil memo
+ from r39594.
-Mon Jan 12 13:36:44 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Mar 5 10:40:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/optparse.rb: improvements for OptionParser documentation.
- [misc #10608][ruby-core:66901][ci skip]
+ * ext/objspace/objspace.c (count_nodes): count also newly added nodes,
+ and fix key for unknown node. patch by tmm1 (Aman Gupta) in
+ [ruby-core:53130] [Bug #8014]
-Mon Jan 12 13:33:52 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Tue Mar 5 10:20:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * array.c (rb_ary_each): documented return value.
- [misc #10469][ruby-core:66063]
+ * enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
+ get rid of conversion exception and integer overflow.
+ [ruby-dev:47131] [Bug #8010]
-Sun Jan 11 15:11:38 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c (rb_int_succ, rb_int_pred): shortcut optimization for
+ Bignum.
- * test/webrick/test_utils.rb (test_create_listeners): use
- dynamically chosen port number, not hardcoded port number.
- [ruby-core:67508]
+Tue Mar 5 10:02:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 10 12:57:12 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ clear DESTDIR so RUBYARCHDIR and RUBYLIBDIR are not be overridden.
+ [Bug #7698]
- * ext/zlib/zlib.c: fix document of method signatures.
- [Bug #10668][ruby-core:67186][ci skip]
+Mon Mar 4 15:33:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 10 12:32:44 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ fix for unusual cases again. install to a temporary directory once
+ and move installed files to the destination directory, if it is same
+ as the current directory. [Bug #7698]
- * eval_error.c (error_print): pos and len parameters of rb_str_substr()
- are counted by characters, not bytes. use rb_str_subseq() instead.
- [Bug #10727] [ruby-core:67473]
+Mon Mar 4 14:13:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 10 10:58:55 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * Makefile.in (miniruby, ruby): move MAINLIBC because linker arguments
+ must appear after object files with newer versions of gcc. patch by
+ tmm1 (Aman Gupta) in [ruby-core:53121] [Bug #8009]
- * complex.c: removed commented-out code.
+Mon Mar 4 10:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jan 10 10:57:19 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * encoding.c: Typo in Encoding overview by Tom Wardrop [GH fixes #255]
- * rational.c: removed commented-out code.
- [Feature #10376][ruby-core:65643]
+Sun Mar 3 12:35:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 10 10:12:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/mkmf.rb (MakeMakefile#libpath_env): set runtime library path for
+ the case rpath is disabled.
- * array.c (rb_ary_select_bang): keep the array consistent by
- removing unselected values soon. [ruby-dev:48805] [Bug #10722]
+Sun Mar 3 12:17:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 9 23:20:04 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rubygems/ext/ext_conf_builder.rb
+ (Gem::Ext::ExtConfBuilder.hack_for_obsolete_style_gems): remove
+ circular dependencies in install-so too. [ruby-core:52882]
+ [Bug #7698]
- * lib/rubygems: Update to RubyGems HEAD(e53c54a).
- * test/rubygems: ditto.
+Sun Mar 3 07:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Jan 9 11:13:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/tcpserver.c: Grammar for TCPServer.new from r39554
- * parse.y (assocs, assoc): eliminate splatting empty literal
- hashes. [ruby-core:67446] [Bug #10719]
+Sun Mar 3 01:17:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (compile_array_): support splatted hash in hash type.
+ * lib/rubygems/ext/ext_conf_builder.rb
+ (Gem::Ext::ExtConfBuilder.hack_for_obsolete_style_gems): remove
+ circular dependencies for old style gems which locate extconf.rb on
+ the toplevel. [ruby-core:53059] [ruby-trunk - Bug #7698]
-Fri Jan 9 10:57:09 2015 Vit Ondruch <vondruch@redhat.com>
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ use RUBYOPT instead of -r option, and revert some tests. [Bug #7698]
- * configure.in (RUBY_SETJMP_TYPE): Remove superfluous semicolon
- which causes a syntax error with autoconf 2.63.
- [ruby-core:67429] [Bug #10716]
+ * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
+ revert use of temporary directory for build, to work some buggy
+ extconf.rb which cannot build outside the source directory.
+ [ruby-core:53056] [Bug #7698]
-Fri Jan 9 07:23:32 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+Sun Mar 3 00:04:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/lib/psych/visitors/yaml_tree.rb: correctly quote non-ascii
- letters. Thanks @jirutka for the patch.
+ * enc/depend (CPPFLAGS), lib/mkmf.rb (MakeMakefile#create_makefile):
+ define RUBY_EXPORT for static-linked-ext mswin. [Bug #7960]
- * test/psych/test_string.rb: test for change
+Sat Mar 2 22:49:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 9 07:13:55 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+ * win32/Makefile.sub (ENCOBJS, EXTOBJS, config.h): definitions for
+ static-linked-ext. [Bug #7960]
- * ext/psych/lib/psych/visitors/to_ruby.rb: call `allocate` on hash
- subclasses. Fixes github.com/tenderlove/psych/issues/196
+Sat Mar 2 17:34:19 2013 Tanaka Akira <akr@fsij.org>
- * test/psych/test_hash.rb: test for change
+ * lib/webrick/utils.rb: use Socket.tcp_server_sockets to create server
+ sockets.
+ fix [Bug #7100] https://bugs.ruby-lang.org/issues/7100
+ reported by sho-h (Sho Hashimoto).
-Fri Jan 9 06:58:43 2015 Aaron Patterson <aaron@tenderlovemaking.com>
+Sat Mar 2 02:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/psych/lib/psych/visitors/to_ruby.rb: revive hashes with ivars
+ * array.c: typo in comment patch by Nami-Doc [Github fixes #253]
- * ext/psych/lib/psych/visitors/yaml_tree.rb: dump hashes with ivars.
- Fixes github.com/psych/issues/43
+Sat Mar 2 01:33:17 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * test/psych/test_hash.rb: test for change
+ * Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
+ v5.13.3 [Bug#7972] [Bug#7974]
-Thu Jan 8 17:05:00 2015 Seiei Higa <hanachin@gmail.com>
+Fri Mar 1 11:09:06 2013 Eric Hodel <drbrain@segment7.net>
- * vm_method.c (rb_method_entry): if no super class, no original
- method entry. [ruby-core:67389] [Bug #10707]
+ * lib/fileutils.rb: Revert r34669 which altered the way
+ metaprogramming in FileUtils occurred. [ruby-trunk - Bug #7958]
-Thu Jan 8 16:31:43 2015 Seiei Higa <hanachin@gmail.com>
+ * test/fileutils/visibility_tests.rb: Refactored tests of FileUtils
+ options modules to expose bug found in #7958
+ * test/fileutils/test_dryrun.rb: ditto.
+ * test/fileutils/test_nowrite.rb: ditto.
+ * test/fileutils/test_verbose.rb: ditto.
- * vm_method.c (rb_export_method): bail out if the original method
- is undefined when the method is refined.
- [ruby-core:67387] [Bug #10706]
+Fri Mar 1 09:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Thu Jan 8 12:53:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/psych.rb: specify in rdoc what object is returned in parser
+ By Adam Stankiewicz [Github tenderlove/psych#133]
- * dir.c (glob_helper): match in case-folding only if the directory
- resides on a case-insensitive file system, on OSX.
- [ruby-core:67364] [Bug #10700]
+Fri Mar 1 07:21:41 2013 Eric Hodel <drbrain@segment7.net>
-Thu Jan 8 11:39:18 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rubygems/ext/builder.rb: Fix incompatibilities when installing
+ extensions. Patch by Nobu.
+ [ruby-trunk - Bug #7698] [ruby-trunk - Bug #7971]
+ * lib/rubygems/ext/ext_conf_builder.rb: ditto.
+ * lib/rubygems/installer.rb: ditto.
+ * test/rubygems/test_gem_ext_ext_conf_builder.rb: Test for the above.
+ * test/rubygems/test_gem_installer.rb: ditto.
- * .travis.yml: Remove redundant configuration option.
- [fix GH-809] Patch by @gxworld
+ * lib/rubygems/commands/sources_command.rb: Prefer HTTPS over HTTP.
+ * lib/rubygems/defaults.rb: ditto
+ * lib/rubygems/dependency_resolver.rb: Ditto.
+ * lib/rubygems/source.rb: ditto.
+ * lib/rubygems/spec_fetcher.rb: ditto.
+ * lib/rubygems/specification.rb: ditto.
+ * lib/rubygems/test_utilities.rb: ditto.
+ * test/rubygems/test_gem.rb: Test for the above.
+ * test/rubygems/test_gem_commands_sources_command.rb: ditto.
+ * test/rubygems/test_gem_dependency_resolver_api_set.rb: ditto.
+ * test/rubygems/test_gem_remote_fetcher.rb: ditto.
+ * test/rubygems/test_gem_source.rb: ditto.
+ * test/rubygems/test_gem_spec_fetcher.rb: ditto.
-Thu Jan 8 07:17:14 2015 Eric Wong <e@80x24.org>
+Fri Mar 1 03:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * lib/resolv.rb: consider ENETUNREACH as ResolvTimeout
- [ruby-core:67411] [Bug #10712]
+ * ext/psych/lib/psych.rb: rdoc for Psych overview by Adam Stankiewicz
+ [Github tenderlove/psych#134]
-Thu Jan 8 00:13:52 2015 Tanaka Akira <akr@fsij.org>
+Thu Feb 28 22:57:48 2013 Koichi Sasada <ko1@atdot.net>
- * lib/open3.rb: Open3 properly passes non-keyword hash args to spawn.
- Fixed by Josh Cheek. [Fix GH-808]
- Related to [ruby-core:67347] [Bug #10699]
+ * compile.c (iseq_compile_each): remove redundant trace(line)
+ instruction. for example, at the following script
+ def m()
+ p:xyzzy
+ 1
+ 2
+ end
+ compiler ignores `1' because there is no effect. However,
+ `trace(line)' instruction remains in bytecode.
+ This modification removes such redundant trace(line) instruction.
-Wed Jan 7 19:19:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_iseq.rb: add a test.
- * dir.c (dir_initialize): workaround of opendir failure at symlink
- directories on Windows via CIFS.
+Thu Feb 28 22:23:27 2013 Tanaka Akira <akr@fsij.org>
-Wed Jan 7 18:52:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/raddrinfo.c (inspect_sockaddr): don't show that Unix
+ domain socket filename is bigger than sizeof(sun_path).
+ This limit is not rigid on some platforms such as Darwin and SunOS.
- * dir.c (need_normalization): not only HFS+, CIFS (SMB) is also
- decomposed. [Bug #10704]
+Thu Feb 28 21:33:01 2013 WATANABE Hirofumi <eban@ruby-lang.org>
- * dir.c (NORMALIZE_UTF8PATH): Unicode decomposition seems to
- perform in an upper layer than file systems on OSX, as all path
- names are always decomposed regardless of file system types.
+ * configure.in(AC_DISABLE_OPTION_CHECKING): avoid warning "WARNING:
+ Unrecognized options: --with-PACKAGE".
-Tue Jan 6 21:41:04 2015 Tanaka Akira <akr@fsij.org>
+Thu Feb 28 20:22:04 2013 Koichi Sasada <ko1@atdot.net>
- * time.c (timelocalw): Set tm_isdst field -1 if vtm->isdst is
- VTM_ISDST_INITVAL. This bug is introduced at packing struct
- vtm (r45155).
- [ruby-core:67345] [Bug #10698] Reported by Boris Ruf.
+ * iseq.c (iseq_data_to_ary): fix condition.
+ r34303 introduces a bug to avoid all line information from
+ a result of ISeq#to_a. This is a regression problem from 2.0.0p0.
-Tue Jan 6 03:10:54 2015 Koichi Sasada <ko1@atdot.net>
+ * test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a.
- * test/fiddle/test_handle.rb: fix syntax.
+Thu Feb 28 08:20:33 2013 Eric Hodel <drbrain@segment7.net>
-Tue Jan 6 00:16:10 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/available_set.rb: Undent for style
- * test/fiddle/test_handle.rb (test_NEXT): use -test-/dln/empty
- which is always a shared object and is not used by others.
- [ruby-dev:48629] [Bug #10384]
+ * lib/rubygems/dependency_installer.rb: Pick latest prerelease gem to
+ install. Fixes RubyGems bug #468.
+ * test/rubygems/test_gem_dependency_installer.rb: Test for the above.
-Mon Jan 5 14:58:01 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rubygems/dependency_installer.rb: Don't display "Done installing
+ documentation" if documentation will not be installed.
+ * lib/rubygems/rdoc.rb: ditto
- * test/ruby/test_io.rb: added timeout for AIX environment.
- [ruby-core:62983][Bug #9917]
+ * lib/rubygems/dependency_list.rb: Use Array#concat for Ruby 1.x
+ performance.
-Sun Jan 4 22:33:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/installer.rb: Use formatted program name when comparing
+ executables. RubyGems pull request #471
+ * test/rubygems/test_gem_installer.rb: Test for the above.
- * test/lib/test/unit.rb (ExcludesOption): add "excludes" support
- to test suite, for alternative implementations and platforms.
- [Feature #10682]
+ * lib/rubygems/package.rb: Use more explicit feature check to work
+ around JRuby bug #552
-Sun Jan 4 22:32:42 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem: Added GeoTrust root
+ certificate.
- * test/lib/test/unit.rb (Test::Unit): reorder modules and merge
- each modules.
+ * test/rubygems/test_gem_source_list.rb: Use "example" instead of real
+ hostname
- * test/lib/test/unit.rb (Test::Unit): split the large class into
- each modules.
+Thu Feb 28 05:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Jan 4 21:32:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c: rdoc formatting for Thread, ThreadGroup, and ThreadError
- * parse.y (f_label): return tLABEL value as it is.
- [ruby-core:67315] [Bug #10693]
+Thu Feb 28 02:42:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Jan 4 14:02:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c: Typo in overview for example of Thread#status returning false
+ Reported by Lee Jarvis
- * test/lib/test/unit/parallel.rb (run): expand the file name to be
- loaded, so that relative paths work in parallel mode.
+Wed Feb 27 22:54:27 2013 Tanaka Akira <akr@fsij.org>
-Sun Jan 4 13:36:56 2015 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * ext/socket/rubysocket.h (union_sockaddr): make it longer for SunOS
+ and Darwin.
- * test/test_tempfile.rb: use assert_file for more descriptive message.
- following r49131.
+Wed Feb 27 21:14:34 2013 Kouhei Sutou <kou@cozmixng.org>
-Sun Jan 4 13:05:09 2015 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * lib/rexml/security.rb (REXML::Security): create.
+ * lib/rexml/rexml.rb: move entity_expansion_limit and
+ entity_expansion_text_limit accessors to ...
+ * lib/rexml/security.rb: ... here.
+ * lib/rexml/document.rb: use REXML::Security.
+ * lib/rexml/text.rb: use REXML::Security.
+ * test/rexml/test_document.rb: use REXML::Security.
- * string.c: improve docs for String#<=>. [ruby-core:65399][Feature #10322]
- Patch by gogo tanaka.
+Wed Feb 27 19:53:32 2013 Benoit Daloze <eregontp@gmail.com>
-Sun Jan 4 12:42:24 2015 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * vm.c (Thread): fix typos in overview
- * array.c: improve docs for Array#reject. [ruby-core:65324][misc #10307]
- Patched by Nebu Pookins.
+Wed Feb 27 13:21:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Jan 4 12:24:11 2015 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * vm.c (Thread): Typo in overview, swap setting and getting
- * string.c: improve docs for String#strip and variations.
- [ruby-core:66081][Bug #10476]
+Wed Feb 27 13:02:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Jan 4 09:21:04 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * vm.c (Thread): Documentation overview of Thread class
- * lib/drb/drb.rb: removed unused argument. Patch by @vipulnsward
- [fix GH-515]
+Wed Feb 27 12:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Jan 4 09:18:31 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * thread.c (rb_thread_wakeup): rdoc formatting
- * lib/tempfile.rb: provide default basename parameter.
- [fix GH-523] Patch by @dissolved
- * test/test_tempfile.rb: ditto.
+Wed Feb 27 12:53:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Jan 4 00:43:41 2015 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * thread.c (rb_thread_group): rdoc formatting
- * README.ja.md: add guidance of mailing list and bugs.r-l.o.
+Wed Feb 27 12:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jan 3 23:56:28 2015 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * lib/ostruct.rb: Typo in OpenStruct overview [Github Fixes #251]
+ Patch by Chun-wei Kuo
- * hash.c: fix docs for Hash#invert. [ruby-core:66917] [Bug #10612]
+Wed Feb 27 12:13:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Jan 3 19:52:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_exec.h (END_INSN): llvm-gcc may optimize out reg_cfp and cause
+ Stack/cfp consistency error when the instruction doesn't use reg_cfp.
+ Usually instructions use PUSH() but for example trace doesn't.
+ This hack cause speed down but you shouldn't use llvm-gcc, use clang.
+ [Bug #7938]
- * include/ruby/intern.h (rb_str_new_literal): define on all
- platforms, not only gcc.
+Wed Feb 27 10:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jan 3 18:53:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c (thread_raise_m): rdoc formatting
- * ext/fiddle/lib/fiddle/cparser.rb (parse_ctype): limit split word
- number as the rest are not used.
+Tue Feb 26 23:32:44 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Jan 3 18:19:50 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rexml/document.rb: move entity_expansion_limit accessor to ...
+ * lib/rexml/rexml.rb: ... here for consistency.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
+ deprecated.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
+ deprecated.
- * ext/fiddle/lib/fiddle/cparser.rb: r49110 broke Fiddle::Import with
- type_alias.
- * test/fiddle/test_cparser.rb: added type_alias test for parse_ctype
- and parse_struct_signature.
+Tue Feb 26 23:26:13 2013 Kouhei Sutou <kou@cozmixng.org>
-Sat Jan 3 11:50:16 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rexml/document.rb: move entity_expansion_text_limit accessor to ...
+ * lib/rexml/rexml.rb: ... here to make rexml/text independent from
+ REXML::Document. It causes circular require.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ deprecated.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit=):
+ deprecated.
+ * lib/rexml/text.rb: add missing require "rexml/rexml" for
+ REXML.entity_expansion_text_limit.
+ Reported by Robert Ulejczyk. Thanks!!! [ruby-core:52895] [Bug #7961]
- * ext/openssl/ossl.h: avoid to build failure of Windows environment.
- * ext/openssl/ossl_ssl_session.c: ditto.
+Tue Feb 26 15:12:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 3 11:27:46 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * tool/mkconfig.rb: reconstruct comma separated list values. a
+ command line to Windows batch file is split not only by spaces
+ and equal signs but also by commas and semicolons.
- * array.c: Improve performance of Array#shift. use shared instead of
- MEMMOVE if with arguments. Patch by @ksss [fix GH-537]
- * test/ruby/test_array.rb: ditto.
- * benchmark/bm_array_shift.rb: Added benchmark of GH-537 issue.
+Tue Feb 26 15:04:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 3 10:38:52 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * configure.in (unexpand_shvar): get rid of non-portable shell
+ behavior on OpenBSD, so no extra quotes. [Bug #7959]
- * lib/net/http.rb: More descriptive error message when net/http fails
- to connect to a server. Patch by @xaviershay [fix GH-700]
- * test/net/http/test_http.rb: ditto.
+Tue Feb 26 10:24:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jan 3 10:14:51 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * parse.y (IS_LABEL_POSSIBLE): allow labels for keyword arguments just
+ after method definition without a parenthesis. [ruby-core:52820]
+ [Bug #7942]
- * ext/openssl/ossl.h: Make `SSL_SESSION_cmp` use `CRYPTO_memcmp`
- [fix GH-591] Patch by @PiPeep
- * ext/openssl/ossl_ssl_session.c: ditto.
+Tue Feb 26 04:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Jan 3 09:54:32 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * error.c: clarify reason for sleep in SignalException example
- * ext/fiddle/lib/fiddle/cparser.rb: Support for Fiddle::CParser
- to handle rich signatures including parameter names and function
- pointer types. Patch by @theryan [fix GH-590]
- * test/fiddle/test_cparser.rb: ditto.
+Tue Feb 26 03:47:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Sat Jan 3 09:01:43 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * error.c: clarify a document of SignalException. Process.kill()
+ doesn't have any guarantee when signal will be delivered.
+ [Bug #7951] [ruby-core:52864]
- * NEWS: added compatibility entry of r49101.
+Mon Feb 25 23:51:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 2 21:06:59 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * include/ruby/version.h: bump RUBY_API_VERSION same as RUBY_VERSION.
- * lib/net/http.rb (Net::HTTP#send_request): there is no response body
- with HEAD request. Patch by @rodrigosaito [fix GH-520]
+Mon Feb 25 21:03:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Jan 2 21:04:36 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * string.c (str_byte_substr): don't set coderange if it's not known.
+ [Bug #7954] [ruby-dev:47108]
- * test/net/http/test_http.rb (_test_send_request__HEAD): Added
- failing test for send_request with HEAD method.
+Mon Feb 25 16:47:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 2 18:41:20 2015 Tanaka Akira <akr@fsij.org>
+ * common.mk (realclean-local): miniprelude.c is made by srcs, so it
+ should not removed by distclean but by realclean. [Bug #6807]
- * eval.c (ruby_init): Print ruby_setup() error only in debug mode.
- Unsuppressable error message is not a good idea.
- Note that the message is printed sometimes with following
- code (highly timing dependent, though):
- pid = spawn("ruby -e ''"); Process.kill(:TERM, pid)
+Mon Feb 25 16:30:30 2013 Eric Hodel <drbrain@segment7.net>
-Fri Jan 2 16:18:44 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/rubygems/config_file.rb: Lazily load .gem/credentials to only
+ check permissions when necessary. RubyGems bug #465
+ * test/rubygems/test_gem_config_file.rb: Test for the above.
- * test/ruby/test_module.rb: Refactor invalid testcase.
- [fix GH-472][ruby-core:59035][Bug #9240]
+ * test/rubygems/test_gem_commands_push_command.rb: Remove duplicated
+ test.
-Fri Jan 2 15:53:00 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Mon Feb 25 15:47:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/webrick/utils.rb: removed unused argument variable.
- [fix GH-356] Patch by @vipulnsward
- * lib/webrick/server.rb: ditto.
- * lib/webrick/ssl.rb: ditto.
- * test/webrick/test_utils.rb: added test for WEBrick::Utils#create_listeners.
+ * enc/depend (ARFLAGS): VisualC++ linker does not allow spaces between
+ output option and the output file name. [Bug #7950]
-Fri Jan 2 15:35:53 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * enc/depend (RANLIB): set default command to do nothing, or make the
+ entire line a label on Windows.
- * lib/securerandom.rb: improve syntax and grammar of documentation.
- [fix GH-796][ci skip] Patch by @Erol
+Mon Feb 25 14:41:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jan 2 15:10:01 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * lib/mkmf.rb (MakeMakefile#init_mkmf): default libdirname to libdir.
- * test/openssl/test_ssl_session.rb (OpenSSL#test_ctx_client_session_cb):
- fix test failure with OpenSSL disabled SSLv3 protocol.
- [ruby-core:63772] [Bug #10046]
+ * tool/rbinstall.rb: ditto.
-Fri Jan 2 09:08:31 2015 Tanaka Akira <akr@fsij.org>
+Mon Feb 25 13:12:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality.
- (Resolv::DNS::Name#initialize): Normalize labels as
- Resolv::DNS::Label::Str objects.
+ * configure.in (setup): find Setup file from target_os 1. by
+ suffix (e.g. Setup.nacl, Setup.atheos), 2. by "platform"
+ option (e.g. Setup.nt, Setup.emx), and 3. default Setup. And
+ Setup.dj had been removed.
-Thu Jan 1 21:41:49 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Mon Feb 25 12:48:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * doc/regexp.rdoc: fix regexp docs for whitespace character.
- [ruby-dev:48765] [Bug #10624]
+ * thread.c: Document Thread::new, clean up ::fork and mention calling
+ super if subclassing Thread
-Thu Jan 1 17:50:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 25 12:38:50 2013 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_rubyoptions.rb: try locale encoding name.
- [ruby-core:67109] [Bug #10643]
+ * ext/socket/extconf.rb: don't test ss_family and ss_len member of
+ struct sockaddr_storage. They are not used now except SunOS
+ specific code.
-Thu Jan 1 11:07:12 2015 Eric Wong <e@80x24.org>
+Mon Feb 25 11:03:38 2013 Akinori MUSHA <knu@iDaemons.org>
- * symbol.c (rb_gc_free_dsymbol): delete from global fstr hash
- * test/ruby/test_symbol.rb (test_symbol_fstr_leak): test for bug
- [ruby-core:67268] [Bug #10686]
+ * configure.in (unexpand_shvar): Use the numeric comparison
+ operator instead of '==' which is a ksh extension. [Bug #7941]
-Thu Jan 1 09:14:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 25 02:37:56 2013 Tanaka Akira <akr@fsij.org>
- * vm_args.c (keyword_hash_p): fix non-symbol keys hash.
- rb_extract_keywords() returns 0 not Qnil when no symbol keys is
- included. [ruby-core:67264] [Bug #10685]
+ * ext/socket: define and use union_sockaddr instead of struct
+ sockaddr_storage for less casts.
-Wed Dec 31 17:48:43 2014 Tanaka Akira <akr@fsij.org>
+ * ext/socket/rubysocket.h (union_sockaddr): defined.
- * lib/resolv.rb (Resolv::DNS::Label::Str#initialize): Set encoding
- ASCII-8BIT before downcase. case insensitivity of DNS labels doesn't
- apply non-ASCII characters. [RFC 4343]
+ * ext/socket/socket.c (sock_accept): use union_sockaddr.
+ (sock_accept_nonblock): ditto.
+ (sock_sysaccept): ditto.
+ (sock_s_getnameinfo): ditto.
-Wed Dec 31 16:48:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/basicsocket.c (bsock_getsockname): ditto.
+ (bsock_getpeername): ditto.
+ (bsock_local_address): ditto.
+ (bsock_remote_address): ditto.
- * parse.y (gettable_gen): disable warnings of possible reference
- to a local variable defined in a past scope.
- [ruby-core:67162] [Bug #10661]
+ * ext/socket/ancdata.c (bsock_recvmsg_internal): ditto.
-Wed Dec 31 13:43:48 2014 Tanaka Akira <akr@fsij.org>
+ * ext/socket/init.c (recvfrom_arg): ditto.
+ (recvfrom_blocking): ditto.
+ (rsock_s_recvfrom): ditto.
+ (rsock_s_recvfrom_nonblock): ditto.
+ (rsock_getfamily): ditto.
- * lib/resolv.rb (Resolv::DNS::Name#==): Compare an array of Label:Str
- objects. Label#Str#== is case-insensitive.
+ * ext/socket/raddrinfo.c (rb_addrinfo_t): ditto.
+ (ai_get_afamily): ditto.
+ (inspect_sockaddr): ditto.
+ (addrinfo_mdump): ditto.
+ (addrinfo_mload): ditto.
+ (addrinfo_getnameinfo): ditto.
+ (addrinfo_ip_port): ditto.
+ (extract_in_addr): ditto.
+ (addrinfo_ipv6_to_ipv4): ditto.
+ (addrinfo_unix_path): ditto.
-Tue Dec 30 16:16:12 2014 Ben Miller <bmiller@rackspace.com>
+ * ext/socket/tcpserver.c (tcp_accept): ditto.
+ (tcp_accept_nonblock): ditto.
+ (tcp_sysaccept): ditto.
- * lib/resolv.rb (Resolv::DNS::Name#==): DNS is case-insensitive, so the
- comparison should be case-insensitive as well.
- [ruby-core:66498] [Bug #10550]
+ * ext/socket/ipsocket.c (ip_addr): ditto.
+ (ip_peeraddr): ditto.
+ (ip_s_getaddress): ditto.
-Tue Dec 30 16:03:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Feb 24 21:15:05 2013 Tadayoshi Funaba <tadf@dotrb.org>
- * lib/resolv.rb (Resolv::DNS::Name): names with different dots
- should be different.
+ * ext/date/date_core.c: [ruby-core:52303]
-Tue Dec 30 13:16:56 2014 Martin Duerst <bernhard+git@lsmod.de>
+Sun Feb 24 15:33:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/uri/common.rb: Initialize HTML5ASCIIINCOMPAT to empty Array
- to avoid error during bootstrap when encodings are not yet defined.
- [Bug #10678]
+ * random.c (rb_random_ulong_limited): limit is inclusive, but generic
+ rand method should return a number less than it, so increase for the
+ difference. [ruby-core:52779] [Bug #7935]
-Tue Dec 30 09:29:26 2014 Bernhard M. Wiedemann <bernhard+git@lsmod.de>
+Sun Feb 24 15:32:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/dbm/dbm.c (Init_dbm): [DOC] as UNIX permissions are octal
- numbers, needs to be prefixed by 0. [Fix GH-800]
+ * random.c (rb_random_ulong_limited): limit is inclusive, but generic
+ rand method should return a number less than it, so increase for the
+ difference. [ruby-core:52779] [Bug #7935]
-Tue Dec 30 08:57:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sun Feb 24 15:14:43 2013 Eric Hodel <drbrain@segment7.net>
- * lib/unicode_normalize.rb: typo fix. [ci skip]
- [ruby-dev:48794][misc #10675]
+ * lib/net/http.rb: Removed duplicate Accept-Encoding in Net::HTTP#get.
+ [ruby-trunk - Bug #7924]
+ * test/net/http/test_http.rb: Test for the above.
-Mon Dec 29 19:38:01 2014 Yukihiro Matsumoto <matz@ruby-lang.org>
+Wed Feb 20 14:28:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * version.h (RUBY_VERSION): 2.3.0 development has started.
+ * thread.c: Document ThreadGroup::Default
-Mon Dec 29 18:58:46 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 20 14:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * re.c (unescape_nonascii): append escape sequence as-is not
- unescaped character, to get rid of unexpected meta-character.
- [ruby-core:67193] [Bug #10670]
+ * thread.c: Grammar for #backtrace_locations and ::handle_interrupt
-Mon Dec 29 14:27:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Feb 24 13:35:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * doc/syntax/literals.rdoc (Symbols): now Symbols created by
- interpolation can be garbage collected. patch by Yihang Ho in
- [ruby-core:67194]. [Bug #10671]
+ * vm_insnhelper.c (vm_call_method): block level control frame does not
+ have method entry, so obtain the method entry from method top-level
+ control frame to be compared with refined method entry.
+ [ruby-core:52750] [Bug #7925]
-Mon Dec 29 11:18:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 20 13:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * thread.c (rb_thread_variable_get): fix dynamic symbol keys.
- rb_check_id() returns non-zero only for static symbols, whereas
- thread local variable keys can be dynamic symbols.
- [ruby-core:67185] [Bug #10667]
+ * object.c: Document methods receiving string and convert to symbol
+ Patch by Stefan Rusterholz
+ * vm_eval.c: ditto
+ * vm_method.c: ditto
-Mon Dec 29 10:37:27 2014 Thiago Lewin <thiago_lewin@yahoo.com.br>
+Wed Feb 20 07:20:56 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * io.c (rb_f_select): [DOC] workaround for YARD doc. [Fix GH-799]
+ * signal.c (sigsegv): suppress unused result warning. Because
+ write(2) is marked __warn_unused_result__ on Linux glibc.
- * process.c (proc_detach): [DOC] fix missing closing parenthesis.
- [Fix GH-799]
+Sun Feb 24 07:50:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Dec 29 07:27:23 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * compile.c (iseq_set_arguments): no keyword check if any keyword rest
+ argument exists, even unnamed. [ruby-core:52744] [Bug #7922]
- * ext/json, test/json: merge JSON HEAD(17fe8e7)
- https://github.com/flori/json/compare/v1.8.1...17fe8e7
+Sat Feb 23 16:51:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Dec 28 23:49:37 2014 Michal Papis <mpapis@gmail.com>
+ * thread.c: Documentation for Thread#backtrace_locations
- * rbinstall.rb: fix target location for installing bundled gems.
- install to the prepared directory instead of default Gem.dir,
- not to be affected GEM_HOME environment variable. [Fix GH-798]
+Sat Feb 23 16:05:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Dec 28 18:19:28 2014 Eric Wong <e@80x24.org>
+ * vm.c: Typo in ObjectSpace::WeakMap overview
- * test/-ext-/iseq_load/test_iseq_load.rb
- (test_next_in_block_in_block): test using ISeq#eval
- (test_break_ensure): ditto
- [ruby-core:66988]
+Sat Feb 23 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sun Dec 28 16:25:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * thread.c: Improved rdoc for ::handle_interrupt, ::pending_interrupt?
+ and #pending_interrupt?
- * cygwin/GNUmakefile.in (EXTOBJS): override to add resource files
- always. [ruby-core:67153] [Bug #10657]
+Sat Feb 23 12:26:43 2013 Akinori MUSHA <knu@iDaemons.org>
-Sun Dec 28 13:54:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * misc/ruby-electric.el (ruby-electric-curlies)
+ (ruby-electric-matching-char, ruby-electric-bar): Avoid electric
+ insertion when there is a prefix argument.
- * parse.y (f_kwrest, new_args_tail_gen): unnamed rest keyword and
- keywords bits arguments should be unique. since internal IDs
- depend on the local variable index in the current scope, new ID
- should be made before popping those vtables.
- [ruby-core:67157] [Bug #10659]
+ * misc/ruby-electric.el (ruby-electric-insert)
+ (ruby-electric-cua-replace-region-p)
+ (ruby-electric-cua-replace-region): Avoid electric insertion and
+ fall back when cua-mode is enabled and a region is active.
-Sat Dec 27 20:12:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 23 12:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/json/generator/generator.c (JSON_Generator_State_type): add
- #ifdef for backward compatibility.
+ * array.c: Document #<=> return values and formatting
+ * bignum.c: ditto
+ * file.c: ditto
+ * object.c: ditto
+ * numeric.c: ditto
+ * rational.c: ditto
+ * string.c: ditto
+ * time.c: ditto
- * ext/json/parser/parser.rl (JSON_Parser_type): ditto.
+Sat Feb 23 10:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * ext/json/generator/generator.h (ZALLOC): add fallback definition.
+ * array.c (rb_ary_diff, rb_ary_and, rb_ary_or): Document return order
+ [RubySpec #7803]
- * ext/json/parser/parser.h (ZALLOC): ditto.
+Sat Feb 23 10:17:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Sat Dec 27 16:54:05 2014 Tanaka Akira <akr@fsij.org>
+ * object.c (rb_obj_comp): Documenting Object#<=> return values
+ Patch by Stefan Rusterholz
- * process.c: Unused code removed.
- It seems waitpid() is universally available on POSIX platforms.
+Sat Feb 23 09:48:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Dec 27 15:08:27 2014 Eric Wong <e@80x24.org>
+ * dir.c (file_s_fnmatch, fnmatch_brace): encoding-incompatible pattern
+ and string do not match, instead of exception. [ruby-dev:47069]
+ [Bug #7911]
- * vm_core.h (rb_vm_living_threads_insert): preserve order
- [Bug #10660] [ruby-core:67154] [ruby-core:67159]
+Sat Feb 23 08:57:46 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-Sat Dec 27 13:08:20 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * doc/NEWS-*: Update NEWS from their respective branches
- * ext/socket/socket.c: improved document for YARD doc.
- [fix GH-795][ci skip] Patch by @tlewin
+Sat Feb 23 08:14:43 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-Sat Dec 27 10:11:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+ * NEWS: many additions for Ruby 2.0.0
- * ext/tk/lib/tkextlib/tcllib/plotchart.rb: fix to invoke correct function
- of tcllib. Patch by @zalt50 [fix GH-787]
+ * object.c: Add doc for Module.prepended
-Sat Dec 27 10:03:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+Sat Feb 23 07:52:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/make-snapshot: show sha1 digest when making packages.
- it's request from https://github.com/ruby/www.ruby-lang.org/issues/921
- [fix GH-794]
+ * template/ruby.pc.in: reorder library flags which may refer library
+ names. [Bug #7913]
-Fri Dec 26 15:32:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 22 23:46:20 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
- * ext/tk/tcltklib.c (ip_invoke_core): remove probably duplicate
- dead code.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ fix a typo in comment in r39384.
-Fri Dec 26 15:28:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 22 18:31:46 2013 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/tk/tcltklib.c (ip_ruby_cmd_receiver_const_get): simply use
- rb_path2class() to get a class/module from its name.
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ new attribute to read/write entity expansion text limit. the default
+ limit is 10Kb.
-Fri Dec 26 15:20:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/rexml/text.rb (REXML::Text.unnormalize): check above attribute.
- * marshal.c (w_long): append at once by w_nbyte() instead of
- appending byte by byte.
+Fri Feb 22 17:36:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Dec 26 15:13:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/test_rbconfig.rb (TestRbConfig): fix r39372.
+ It must see RbConfig::CONFIG instead of CONFIG.
- * ext/json/parser/parser.rl (unescape_unicode): check if valid
- before bit-or assignments.
- reported by Denis Denisov <denji0k AT gmail.com>.
+Fri Feb 22 14:55:41 2013 Naohisa Goto <ngotogenome@gmail.com>
- * ext/nkf/nkf-utf8/nkf.c (nkf_iconv_t): fix a missing semicolon.
- reported by Denis Denisov <denji0k AT gmail.com>.
+ * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
- * process.c (rb_spawn_process): get rid of usage of uninitialized
- variable.
- reported by Denis Denisov <denji0k AT gmail.com>.
+Fri Feb 22 12:46:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regexec.c (match_at): ditto.
+ * random.c (rb_random_ulong_limited): fix error message for negative
+ value. [ruby-dev:47061] [Bug #7903]
- * ext/win32ole/win32ole.c (ole_wc2mb_alloc, ole_vstr2wc, ole_mb2wc):
- ditto.
+Fri Feb 22 11:36:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/test_rbconfig.rb (TestRbConfig): skip user defined values by
+ configuration options. [Bug #7902]
+
+Fri Feb 22 11:33:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#init_mkmf): adjust default library path
+ for multiarch. [Bug #7874]
+
+Fri Feb 22 11:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * enum.c (Enumerable#chunk: Improved examples, grammar, and formatting
+ Patch by Dan Bernier and Rich Bruchal of newhaven.rb
+ [Github documenting-ruby/ruby#8]
+
+Fri Feb 22 11:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * numeric.c: Examples and formatting for Numeric and Float
+ Based on a patch by Zach Morek and Oren K of newhaven.rb
+ [Github documenting-ruby/ruby#5]
+
+Fri Feb 22 07:04:41 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/installer.rb (build_extensions): Create extension
+ install destination before building extension. Patch by Kenta Murata.
+ [ruby-trunk - Bug #7897]
+ * test/rubygems/test_gem_installer.rb: Test for the above.
+
+Fri Feb 22 06:30:57 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/globals.rdoc: Document what setting $DEBUG does.
+
+ * doc/globals.rdoc: Added pointer to $-d for full documentation.
+
+Fri Feb 22 06:27:07 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/globals.rdoc: Document what setting $VERBOSE does. [Bug #7899]
+
+ * doc/globals.rdoc: Added pointer to $-w and $-v for full
+ documentation.
+
+Fri Feb 22 02:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/abbrev.rb: Add words parameter to Abbrev::abbrev
+ Patch by Devin Weaver [Github documenting-ruby/ruby#7]
+
+Thu Feb 21 17:28:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/merger.rb: add interaction when only ChangeLog is modified.
+
+Thu Feb 21 16:34:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * signal.c (check_stack_overflow): extract duplicated code and get rid
+ of declaration-after-statement. [Bug #5014]
+
+Thu Feb 21 14:14:13 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (sigsegv): avoid to use async signal unsafe functions
+ when nested sigsegv is happen.
+ [Bug #5014] [ruby-dev:44082]
+
+Thu Feb 21 13:47:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (rb_group_member): added an error check. SUS says,
+ getgroups(small_value) may return EINVAL.
+
+Thu Feb 21 13:37:07 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (RB_MAX_GROUPS): moved to
+ * internal.h (RB_MAX_GROUPS): here.
+
+ * file.c (rb_group_member): use RB_MAX_GROUPS instead of
+ RUBY_GROUP_MAX. They are the same.
+
+Thu Feb 21 13:15:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (access_internal): removed.
+ * file.c (rb_file_readable_real): use access() instead of
+ access_internal().
+ * file.c (rb_file_writable_real): ditto.
+ * file.c (rb_file_executable_real): ditto.
+
+Thu Feb 21 13:04:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (eaccess): use access() when not using setuid nor setgid.
+ This is minor optimization.
+
+Thu Feb 21 12:56:19 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (rb_group_member): get rid of NGROUPS dependency.
+ [Bug #7886] [ruby-core:52537]
+
+Thu Feb 21 12:45:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (ruby_init_loadpath_safe): try two levels upper for stripping
+ libdir name. [Bug #7874]
+
+ * configure.in (libdir_basename): expand with multiarch in configure,
+ not to defer the expansion till ruby.pc.in and mkmf.rb. [Bug #7874]
+
+ * configure.in (libdir_basename): also -rpath and -install_name flags
+ are affected when libruby directory changes. [Bug #7874]
+
+Wed Feb 20 19:27:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (HAVE_RB_SCAN_ARGS_OPTIONAL_HASH): for
+ rb_scan_args() optional hash feature. [Bug #7861]
+
+Wed Feb 20 18:02:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (target_os): do not strip -gnu suffix on Linux if
+ --target is given explicitly. [Bug #7874]
+
+ * configure.in (libdirname): adjust library path name which libruby
+ files will be installed. [Bug #7874]
+
+ * tool/rbinstall.rb (libdir): ditto.
+
+Wed Feb 20 13:37:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/pty/pty.c: Documentation for the PTY module
+
+Wed Feb 20 12:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * object.c: Document Data class [Bug #7890] [ruby-core:52549]
+ Patch by Matthew Mongeau
+
+Wed Feb 20 11:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/mutex_m.rb: Add rdoc for Mutex_m module
+
+Wed Feb 20 09:34:43 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/update_command.rb: Create the installer after
+ options are processed. [ruby-trunk - Bug #7779]
+ * test/rubygems/test_gem_commands_update_command.rb: Test for the
+ above.
+
+Wed Feb 20 07:51:19 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/installer.rb: Use gsub instead of gsub! to avoid
+ altering @bin_dir. Fixes tests on windows. [ruby-trunk - Bug #7885]
+
+Tue Feb 19 20:50:00 2013 Kenta MURATA <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.gemspec: bump to 1.2.0.
+ [ruby-core:51777] [Bug #7761]
+
+Tue Feb 19 13:07:25 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c (Init_syslog): Define inspect as a singleton
+ method and remove it as an instance method. [Bug #6502]
+
+Tue Feb 19 12:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * object.c: rdoc formatting for Kernel#Array()
+ * array.c: Add rdoc for Array() method to Creating Arrays section
+
+Tue Feb 19 10:35:52 2013 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl.c (class OpenSSL): Use only inner parenthesis in
+ create_extension examples.
+
+Tue Feb 19 10:27:12 2013 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl.c (class OpenSSL): Fixed ExtensionFactory example.
+ Patch by Richard Bradley. [ruby-trunk - Bug #7551]
+
+Tue Feb 19 08:32:11 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_eval.c (vm_call0_body): check interrupts after method dispatch
+ from C methods. [Bug #7878]
+
+Tue Feb 19 08:14:40 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/installer.rb: Fixed placement of executables with
+ --user-install. [ruby-trunk - Bug #7779]
+ * test/rubygems/test_gem_installer.rb: Test for above.
+
+Tue Feb 19 06:04:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace
+ beyond signal trampoline, and as described in r38342 it can't
+ trace on -O because it see stack frame pointers.
+ libunwind unw_backtrace see dwarf information in the binary
+ and it works with -O (without frame pointers).
+
+ * configure.in: remove r38342's hack and check libunwind.
+
+Tue Feb 19 04:26:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: check whether backtrace(3) works well or not.
+
+ * vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE.
+
+Mon Feb 18 16:30:18 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
+ parenthesis.
+
+Mon Feb 18 12:32:24 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can
+ recognize IPv6 addresses with only one edge 16-bit piece
+ compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::].
+ [Bug #7477]
+
+Mon Feb 18 10:09:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (unexpand_shvar): regularize a shell variable by
+ unexpanding shell variables in it.
+
+Sun Feb 17 20:55:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compar.c (rb_invcmp): compare by inversed comparison, with preventing
+ from infinite recursion. [ruby-core:52305] [Bug #7870]
+
+ * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite
+ recursion.
+
+Sun Feb 17 17:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: remove extra topdir in VPATH, which was in
+ win32/Makefile.sub for some reason and moved from there.
+ [ruby-dev:46998] [Bug #7864]
+
+Sun Feb 17 01:19:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/psych/lib/psych/y.rb: Document Kernel#y by Adam Stankiewicz
+ [Github tenderlove/psych#127]
+
+Sun Feb 17 00:52:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/mkconfig.rb: remove prefix from rubyarchdir.
+ r39267 expands variables, it changes expansion timing,
+ breaks RbConfig::CONFIG["includedir"] and building
+ extension libraries with installed ruby.
+
+Sat Feb 16 20:51:17 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (ENV_IN_HEAP_P): fix off-by-one error.
+
+Sat Feb 16 20:47:16 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in (LIBRUBY_DLDFLAGS): Fix a bug where --with-opt-dir
+ options given were not reflected to LIBRUBY_DLDFLAGS on many
+ platforms including Linux and other GNU-based systems, NetBSD,
+ AIX and BeOS.
+
+Sat Feb 16 20:43:20 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/ancdata.c (rsock_recvmsg): ignore truncated part of
+ socket address returned from recvmsg().
+
+ * ext/socket/init.c (recvfrom_blocking): ignore truncated part of
+ socket address returned from recvfrom().
+ (rsock_s_recvfrom_nonblock): ditto.
+
+Sat Feb 16 20:05:26 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/ruby/test_thread.rb: fixed typo
+ patched by Hiroki Matsue via https://github.com/ruby/ruby/pull/248
+
+Sat Feb 16 16:08:35 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (rb_thread_mark): mark a working Proc of bmethod
+ (a method defined by define_method) even if the method was removed.
+ We could not trace working Proc object which represents the body
+ of bmethod if the method was removed (alias/undef/overridden).
+ Simply, it was mark miss.
+ This patch by Kazuki Tsujimoto. [Bug #7825]
+
+ NOTE: We can brush up this marking because we do not need to mark
+ `me' on each living control frame. We need to mark `me's
+ only if `me' was free'ed. This is future work after Ruby 2.0.0.
+
+ * test/ruby/test_method.rb: add a test.
+
+Sat Feb 16 15:45:56 2013 Koichi Sasada <ko1@atdot.net>
+
+ * proc.c (rb_binding_new_with_cfp): create binding object even if
+ the frame is IFUNC. But return a ruby-level binding to keep
+ compatibility.
+ This patch fix degradation introduced from r39067.
+ [Bug #7774] [ruby-dev:46960]
+
+ * test/ruby/test_settracefunc.rb: add a test.
+
+Sat Feb 16 13:40:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (shvar_to_cpp): do not substitute exec_prefix itself
+ with RUBY_EXEC_PREFIX, which cause recursive definition.
+ [ruby-core:52296] [Bug #7860]
+
+Sat Feb 16 13:13:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/io-console.gemspec: bump to 0.4.2. now explicitly
+ requires ruby 1.9.3 or later. [Bug #7847]
+
+ * ext/io/console/console.c (console_dev): compatibility with ruby 1.8.
+
+ * ext/io/console/console.c (rawmode_opt, console_dev): compatibility
+ with ruby 1.9. [ruby-core:52220] [Bug #7847]
+
+Sat Feb 16 12:45:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: unexpand arch sitearch and exec_prefix values, so
+ directly specified bindir, libdir, rubyprefix, etc can be properly
+ substituted. [ruby-core:52296] [Bug #7860]
+
+Sat Feb 16 12:15:20 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * parse.y: add dtrace probe for symbol create.
+
+ * probes.d: ditto
+
+Sat Feb 16 09:27:37 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: don't test sys/feature_tests.h which is not
+ used now.
+ It was included in r7901 as "bug of gcc 3.0 on Solaris 8 ?".
+
+Sat Feb 16 09:24:37 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: reorder header tests to consider inclusion
+ order in rubysocket.h.
+
+Sat Feb 16 08:42:58 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in, ext/socket/extconf.rb: test netinet/in_systm.h in
+ ext/socket/extconf.rb instead of configure.in.
+
+ Originally, netinet/in_systm.h is included for NextStep, OpenStep,
+ and Rhapsody. [ruby-core:1596]
+
+Sat Feb 16 07:55:40 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: don't test xti.h here.
+
+ * ext/socket/extconf.rb: test xti.h here.
+
+ Originally, xti.h is included for IRIX [ruby-core:14447].
+
+Sat Feb 16 07:16:49 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test struct sockaddr_un and its member,
+ sun_len.
+
+ * ext/socket/sockport.h (INIT_SOCKADDR_UN): new macro defined.
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): use INIT_SOCKADDR_UN.
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
+
+ * ext/socket/raddrinfo.c (init_unix_addrinfo): ditto.
+ (addrinfo_mload): ditto.
+
+Sat Feb 16 07:05:59 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family
+ argument. it is always AF_INET.
+
+ * ext/socket/raddrinfo.c (make_inetaddr): follow INIT_SOCKADDR_IN
+ change.
+ (addrinfo_ipv6_to_ipv4): ditto.
+
+Sat Feb 16 04:21:07 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/extconf.rb: workaround for mswin/mingw build problem.
+ sendmsg emulation in win32/win32.c is not enough.
+
+Sat Feb 16 00:19:20 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: use all all tested available headers for
+ have_func.
+
+Fri Feb 15 22:21:37 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in: Fix a bug introduced in r38342 that the cflagspat
+ substitution is messed up by the way CFLAGS and optflags are
+ modified, which affected FreeBSD and NetBSD/amd64 when
+ configured to use libexecinfo. This bug resulted in CFLAGS and
+ CXXFLAGS in RbConfig::CONFIG having warnflags expanded in them,
+ forcing third-party C/C++ extensions to follow what warnflags
+ demands, like ANSI/ISO-C90 conformance. ref [Bug #7101]
+
+Fri Feb 15 20:29:11 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/sockport.h (SET_SIN_LEN): defined for strict-aliasing
+ rule.
+ (INIT_SOCKADDR_IN): ditto.
+
+ * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR_IN.
+ (addrinfo_ipv6_to_ipv4): ditto.
+
+Fri Feb 15 18:24:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#try_run): bail out explicitly if cross
+ compiling, because it cannot work of course.
+
+Fri Feb 15 12:34:58 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test struct sockaddr_storage directly.
+
+ * ext/socket/rubysocket.h: use HAVE_TYPE_STRUCT_SOCKADDR_STORAGE.
+
+Fri Feb 15 12:26:13 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/getaddrinfo.c (GET_AI): don't cast 1st argument for
+ INIT_SOCKADDR.
+
+Fri Feb 15 08:12:11 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/sockport.h (SET_SS_LEN): removed.
+ (SET_SIN_LEN): removed.
+ (INIT_SOCKADDR): new macro.
+
+ * ext/socket/ancdata.c (extract_ipv6_pktinfo): use INIT_SOCKADDR.
+
+ * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR.
+ (addrinfo_ipv6_to_ipv4): ditto.
+
+ * ext/socket/getaddrinfo.c (GET_AI): use INIT_SOCKADDR.
+
+Fri Feb 15 07:49:27 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc.rb: Update to release version of 4.0.0
+
+ * lib/rubygems.rb: Update to release version of 2.0.0
+
+Fri Feb 15 07:07:27 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/sockport.h (SA_LEN): removed because unused now.
+ (SS_LEN): ditto.
+ (SIN_LEN): ditto.
+
+Thu Feb 14 10:45:31 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_process.rb (test_setsid): Added a workaround for
+ MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]
+
+Fri Feb 15 00:15:31 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/sockport.h (VALIDATE_SOCKLEN): new macro to validate
+ sa_len member of 4.4BSD socket address.
+
+ * ext/socket/getnameinfo.c (getnameinfo): use VALIDATE_SOCKLEN,
+ instead of SA_LEN.
+
+ * ext/socket/socket.c (sock_s_getnameinfo): use VALIDATE_SOCKLEN
+ instead of SS_LEN.
+
+Thu Feb 14 22:25:54 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (sockaddr_len): extracted from sockaddr_obj.
+ (sockaddr_obj): add an argument to length of socket address.
+ (socket_s_ip_address_list): call sockaddr_obj with actual socket
+ address length if given, use sockaddr_len otherwise.
+
+Thu Feb 14 20:11:23 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket: always operate length of socket address companion with
+ socket address.
+
+ * ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for
+ socket address length.
+ (rsock_ipaddr): ditto.
+
+ * ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr.
+ (ip_peeraddr): ditto.
+ (ip_s_getaddress): pass length to rsock_make_ipaddr.
+
+ * ext/socket/socket.c (make_addrinfo): pass length to rsock_ipaddr.
+ (sock_s_getnameinfo): pass actual address length to rb_getnameinfo.
+ (sock_s_unpack_sockaddr_in): pass length to rsock_make_ipaddr.
+
+ * ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr.
+ (rsock_s_recvfrom_nonblock): ditto.
+
+ * ext/socket/tcpsocket.c (tcp_sockaddr): pass length to
+ rsock_make_ipaddr.
+
+ * ext/socket/raddrinfo.c (make_ipaddr0): add an argument for socket
+ address length. pass the length to rb_getnameinfo.
+ (rsock_ipaddr): ditto.
+ (rsock_make_ipaddr): add an argument for socket address length.
+ pass the length to make_ipaddr0.
+ (make_inetaddr): pass length to make_ipaddr0.
+ a local variable renamed.
+ (host_str): a local variable renamed.
+ (port_str): ditto.
+
+Thu Feb 14 14:31:43 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Removed OpenSSL dependency from Net::HTTP.
+
+ * test/net/http/test_http.rb: Remove Zlib dependency from tests.
+ * test/net/http/test_http_request.rb: ditto.
+
+Thu Feb 14 11:08:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (include_modules_at): detect cyclic prepend with original
+ method table. [ruby-core:52205] [Bug #7841]
+
+Thu Feb 14 10:30:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_method.c: call method_removed hook on called class, not on
+ prepending iclass. [ruby-core:52207] [Bug #7843]
+
+Thu Feb 14 10:05:57 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http: Do not handle Content-Encoding when the user sets
+ Accept-Encoding. This allows users to handle Content-Encoding for
+ themselves. This restores backwards-compatibility with Ruby 1.x.
+ [ruby-trunk - Bug #7831]
+ * lib/net/http/generic_request.rb: ditto.
+ * lib/net/http/response.rb: ditto
+ * test/net/http/test_http.rb: Test for the above.
+ * test/net/http/test_http_request.rb: ditto.
+ * test/net/http/test_httpresponse.rb: ditto.
+
+Thu Feb 14 08:18:47 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: don't define HAVE_SA_LEN and HAVE_SA_LEN.
+ use HAVE_STRUCT_SOCKADDR_SA_LEN and HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+ instead.
+
+Wed Feb 13 20:59:48 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: don't define socklen_t here, just test.
+
+ * ext/socket/rubysocket.h: define socklen_t if not available.
+
+Wed Feb 13 18:37:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (mnew): skip prepending modules and return the method bound
+ on the given class. [ruby-core:52160] [Bug #7836]
+
+Wed Feb 13 18:11:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (method_original_name): new methods Method#original_name and
+ UnboundMethod#original_name. [ruby-core:52048] [Bug #7806]
+ [EXPERIMENTAL]
+
+ * proc.c (method_inspect): show the given name primarily, and
+ original_id if aliased. [ruby-core:52048] [Bug #7806]
+
+Wed Feb 13 17:56:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (warnflags): disable -Werror by default unless
+ development. [ruby-core:52131] [Bug #7830]
+
+Wed Feb 13 06:05:52 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems.rb: Return BINARY strings from Gem.gzip and Gem.gunzip.
+ Fixes intermittent test failures. RubyGems issue #450 by Jeremey
+ Kemper.
+ * test/rubygems/test_gem.rb: Test for the above.
+
+Wed Feb 13 05:49:21 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test functions just after struct members.
+
+Tue Feb 12 12:02:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: merge JSON 1.7.7.
+ This includes security fix. [CVE-2013-0269]
+ https://github.com/flori/json/commit/d0a62f3ced7560daba2ad546d83f0479a5ae2cf2
+ https://groups.google.com/d/topic/rubyonrails-security/4_YvCpLzL58/discussion
+
+Mon Feb 11 23:08:48 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: enable rb_cv_page_size_log test for MirOS BSD.
+
+Mon Feb 11 20:06:38 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: use -pthread on mirbsd*.
+
+Mon Feb 11 16:07:09 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: add SOLIBS and LIBRUBY_SO definition for mirbsd*.
+
+Mon Feb 11 13:17:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (rubysitearchprefix): sitearchdir and vendorarchdir
+ should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
+
+ * win32/Makefile.sub (config.status): site and vendor directories
+ should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
+
+Mon Feb 11 12:31:25 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: move OS specific header/function knowledge before
+ automatic header tests.
+
+Mon Feb 11 11:04:29 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: move the test for -march=i486 just after
+ RUBY_UNIVERSAL_ARCH/RUBY_DEFAULT_ARCH.
+
+Sun Feb 10 23:42:26 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test structure members just after types test.
+
+Sun Feb 10 20:58:17 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test types just after headers test.
+
+Sun Feb 10 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/rake/doc/MIT-LICENSE: Add license file from upstream
+ * lib/rake/doc/README.rdoc: Link to license file from Rake README
+ * lib/rake/version.rb: Include README rdoc for Rake module overview
+
+Sun Feb 10 15:26:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/rake/doc/*: Sync Rake rdoc files from upstream
+
+Sun Feb 10 15:50:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_exec.h (DISPATCH_ARCH_DEPEND_WAY): use __asm__ __volatile__
+ instead of asm volatile.
+
+Sun Feb 10 15:50:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * gc.h (SET_MACHINE_STACK_END): use __volatile__ instead of volatile.
+
+Sun Feb 10 14:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/rake/, lib/rake/doc/: Move Rake rdoc files to lib/rake
+
+Sun Feb 10 12:10:25 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test headers at first.
+
+Sun Feb 10 12:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * dir.c (ruby_glob0): no need to check never-NULL pointer.
- reported by Denis Denisov <denji0k AT gmail.com>.
+ * doc/rake/*: Removed stale Rake static files
- * win32/file.c (rb_file_expand_path_internal): ditto.
+Sun Feb 10 09:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
- * win32/file.c (code_page_i): handle realloc failure.
- reported by Denis Denisov <denji0k AT gmail.com>.
+ * lib/pp.rb, lib/prettyprint.rb: Documentation for PP and PrettyPrint
+ Based on a patch by Vincent Batts [ruby-core:51253] [Bug #7656]
- * win32/stub.c (stub_sysinit): ditto.
+Sat Feb 9 21:11:21 2013 Tanaka Akira <akr@fsij.org>
- * fix printf format conversion specifiers.
- reported by Denis Denisov <denji0k AT gmail.com>.
+ * configure.in: move header files check to the beginning of
+ "header and library section".
+ test rlim_t with sys/types.h and sys/time.h for MirOS BSD.
+ sys/types.h and sys/time.h is guarded by #ifdef and the above
+ move is required for this change.
-Fri Dec 26 01:41:40 2014 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Feb 9 17:45:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/rbinstall.rb: skip installing bundle gems if zlib is unavailable.
- [Bug #10647] [ruby-dev:48787]
+ * configure.in, version.c: prevent duplicated load paths by empty
+ version string, it does not work right now.
-Fri Dec 26 01:24:42 2014 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Feb 9 17:38:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/downloader.rb: support old versions of ruby.
+ * configure.in: fix arch parameters in help message. [Bug #7804]
- * tool/downloader.rb: now can download gems by http if openssl is not
- available (this may be danger!)
+Sat Feb 9 13:13:00 2013 Zachary Scott <zachary@zacharyscott.net>
-Fri Dec 26 00:13:48 2014 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_trace.c: Note about TracePoint events set, and comment on
+ Kernel#set_trace_func to prefer new TracePoint API
- * test/ruby/test_extlibs.rb: check existence of extension libraries
- which not depend on outer libraries. (experimental)
+Sat Feb 9 10:07:47 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-Thu Dec 25 21:58:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * BSDL: update copyright notice for 2013.
- * ext/fiddle/extconf.rb: make PIC objects if it will be linked as
- a shared object eventually. [ruby-core:67128]
+Sat Feb 9 09:24:38 2013 Eric Hodel <drbrain@segment7.net>
-Thu Dec 25 19:01:13 2014 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rubygems/package/old.rb: Fix behavior only on ruby 1.8.
- * ext/fiddle/win32/libffi-3.2.1-mswin.patch: support mswin32.
+ * lib/rubygems/package.rb: Include checksums.yaml.gz signatures for
+ verification.
+ * test/rubygems/test_gem_package.rb: Test for the above.
-Thu Dec 25 17:30:40 2014 Naohisa Goto <ngotogenome@gmail.com>
+Sat Feb 9 01:23:24 2013 Tanaka Akira <akr@fsij.org>
- * gc.c (wmap_final_func): fix memory size shortage when realloc wmap.
- Fix SEGV during finalize of WeakRef on Solaris (though the SEGV
- could occur on all OS/platforms). [ruby-dev:48779] [Bug #10646]
+ * test/fiddle/helper.rb: specify libc and libm locations for MirOS BSD.
-Thu Dec 25 17:27:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/dl/test_base.rb: ditto.
- * configure.in (NET_LUID): include winsock2.h instead of windows.h.
- patch by Jon Forums in [ruby-core:67125]. [Bug #10640]
+Fri Feb 8 23:25:33 2013 Tanaka Akira <akr@fsij.org>
-Thu Dec 25 16:14:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: change CFLAGS temporally to test
+ ARCH_FLAG="-march=i486".
- * ext/io/console/console.c (console_dev): send the given arguments
- to the opened console. as a special case, do nothing if :close
- is given.
+Fri Feb 8 21:19:41 2013 Tanaka Akira <akr@fsij.org>
- * test/lib/leakchecker.rb (LeakChecker#check_fd_leak): close if
- console.
+ * configure.in: don't define ARCH_FLAG="-march=i486" if it causes
+ compilation problem.
-For the changes before 2.2.0, see doc/ChangeLog-2.2.0
-For the changes before 2.1.0, see doc/ChangeLog-2.1.0
For the changes before 2.0.0, see doc/ChangeLog-2.0.0
For the changes before 1.9.3, see doc/ChangeLog-1.9.3
For the changes before 1.8.0, see doc/ChangeLog-1.8.0
diff --git a/KNOWNBUGS.rb b/KNOWNBUGS.rb
index 35a8e75876..b97a08d928 100644
--- a/KNOWNBUGS.rb
+++ b/KNOWNBUGS.rb
@@ -1,7 +1,5 @@
#
-# IMPORTANT: Always keep the first 7 lines (comments),
-# even if this file is otherwise empty.
-#
-# This test file includes tests which point out known bugs.
+# This test file concludes tests which point out known bugs.
# So all tests will cause failure.
#
+
diff --git a/LEGAL b/LEGAL
index 2607f0082a..65706459cd 100644
--- a/LEGAL
+++ b/LEGAL
@@ -5,37 +5,6 @@ All the files in this distribution are covered under either the Ruby's
license (see the file COPYING) or public-domain except some files
mentioned below.
-ccan/build_assert/build_assert.h
-ccan/check_type/check_type.h
-ccan/container_of/container_of.h
-ccan/str/str.h
-
- These files are licensed under the CC0.
-
- http://creativecommons.org/choose/zero/
-
-ccan/list/list.h
-
- This file is licensed under the MIT License.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-
include/ruby/oniguruma.h:
regcomp.c:
regenc.[ch]:
@@ -87,7 +56,7 @@ http://www.geocities.jp/kosako3/oniguruma/
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/oniguruma/
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/oniguruma/
- When this software is partly used or it is distributed with Ruby,
+ When this software is partly used or it is distributed with Ruby,
this of Ruby follows the license of Ruby.
configure:
@@ -129,7 +98,7 @@ tool/config.sub:
parse.c:
- This file is licensed under the GPL, but is incorporated into Ruby and
+ This file is licensed under the GPL, but is incorporated into Ruby and
redistributed under the terms of the Ruby license, as permitted by the
exception to the GPL below.
@@ -224,11 +193,11 @@ random.c
This is a faster version by taking Shawn Cokus's optimization,
Matthe Bellew's simplification, Isaku Wada's real version.
- Before using, initialize the state by using init_genrand(seed)
+ Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -241,8 +210,8 @@ random.c
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -262,36 +231,6 @@ random.c
http://www.math.keio.ac.jp/matumoto/emt.html
email: matumoto@math.keio.ac.jp
-vm_dump.c:procstat_vm
-
- This file is under the new-style BSD license.
-
- Copyright (c) 2007 Robert N. M. Watson
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- $FreeBSD: head/usr.bin/procstat/procstat_vm.c 261780 2014-02-11 21:57:37Z jhb $
-
vsnprintf.c:
This file is under the old-style BSD license. Note that the
@@ -425,30 +364,30 @@ missing/strlcpy.c
These files are under the new-style BSD license.
- Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
+ Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ All rights reserved.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
missing/langinfo.c
@@ -537,7 +476,7 @@ ext/nkf/nkf-utf8/utf8tbl.c:
copyrighted semi-public-domain software.
Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA)
- Everyone is permitted to do anything on this program
+ Everyone is permitted to do anything on this program
including copying, modifying, improving,
as long as you don't try to pretend that you wrote it.
i.e., the above copyright notice has to appear in all copies.
@@ -588,7 +527,7 @@ ext/win32ole/win32ole.c:
Other modifications Copyright (c) 1997, 1998 by Gurusamy Sarathy
<gsar@umich.edu> and Jan Dubois <jan.dubois@ibm.net>
-
+
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the README file
of the Perl distribution.
diff --git a/Makefile.in b/Makefile.in
index ff475091ab..98749dec61 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
SHELL = /bin/sh
NULLCMD = @NULLCMD@
n=$(NULLCMD)
-ECHO1 = $(V:1=$n)
+ECHO1 = $(V:1=@$n)
RUNCMD = $(SHELL)
CDPATH = .
CHDIR = @CHDIR@
@@ -22,11 +22,9 @@ LD = @LD@
YACC = bison
PURIFY =
AUTOCONF = autoconf
-CONFIGURE = @CONFIGURE@
@SET_MAKE@
MKFILES = @MAKEFILES@
BASERUBY = @BASERUBY@
-HAVE_BASERUBY = @HAVE_BASERUBY@
TEST_RUNNABLE = @TEST_RUNNABLE@
CROSS_COMPILING = @CROSS_COMPILING@
DOXYGEN = @DOXYGEN@
@@ -52,20 +50,18 @@ DOCTARGETS = @RDOCTARGET@ @CAPITARGET@
EXTOUT = @EXTOUT@
arch_hdrdir = $(EXTOUT)/include/$(arch)
-VPATH = $(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir):$(srcdir)/missing
+VPATH = $(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir):$(srcdir)/enc:$(srcdir)/missing
empty =
CC_VERSION = @CC_VERSION@
OUTFLAG = @OUTFLAG@$(empty)
COUTFLAG = @COUTFLAG@$(empty)
ARCH_FLAG = @ARCH_FLAG@
-CFLAGS_NO_ARCH = @CFLAGS@
-CFLAGS = $(CFLAGS_NO_ARCH) $(ARCH_FLAG)
+CFLAGS = @CFLAGS@ $(ARCH_FLAG)
cflags = @cflags@
optflags = @optflags@
debugflags = @debugflags@
warnflags = @warnflags@ @strict_warnflags@
-cppflags = @cppflags@
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir)
XCFLAGS = @XCFLAGS@
CPPFLAGS = @CPPFLAGS@ $(INCFLAGS)
@@ -92,6 +88,7 @@ RUBY_BASE_NAME=@RUBY_BASE_NAME@
RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
RUBY_SO_NAME=@RUBY_SO_NAME@
+RUBY_RELEASE_DATE=@RUBY_RELEASE_DATE@
EXEEXT = @EXEEXT@
LIBEXT = @LIBEXT@
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
@@ -114,7 +111,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
XRUBY_LIBDIR = @XRUBY_LIBDIR@
XRUBY_RUBYLIBDIR = @XRUBY_RUBYLIBDIR@
XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@
-BOOTSTRAPRUBY = @BOOTSTRAPRUBY@
+
+DEFAULT_PRELUDES = $(GEM_PRELUDE)
#### End of system configuration section. ####
@@ -132,26 +130,12 @@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
LIBRUBY_RELATIVE = @LIBRUBY_RELATIVE@
LIBRUBY_A_OBJS = @LIBRUBY_A_OBJS@
-DTRACE_REBUILD_OBJS = $(DTRACE_REBUILD:yes=$(DTRACE_DEPENDENT_OBJS))
-
-DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
- eval.$(OBJEXT) \
- gc.$(OBJEXT) \
- hash.$(OBJEXT) \
- load.$(OBJEXT) \
- object.$(OBJEXT) \
- parse.$(OBJEXT) \
- string.$(OBJEXT) \
- symbol.$(OBJEXT) \
- vm.$(OBJEXT)
-
THREAD_MODEL = @THREAD_MODEL@
PREP = @PREP@
ARCHFILE = @ARCHFILE@
SETUP =
EXTSTATIC = @EXTSTATIC@
-ENCSTATIC = @ENCSTATIC@
SET_LC_MESSAGES = env LC_MESSAGES=C
MAKEDIRS = @MKDIR_P@
@@ -175,9 +159,8 @@ VCS = @VCS@
VCSUP = @VCSUP@
DTRACE = @DTRACE@
DTRACE_EXT = @DTRACE_EXT@
-DTRACE_OBJ = @DTRACE_OBJ@
-DTRACE_REBUILD= @DTRACE_REBUILD@
-DTRACE_GLOMMED_OBJ = $(DTRACE_REBUILD:yes=ruby-glommed.$(OBJEXT))
+DTRACE_OBJ = @DTRACE_OBJ@
+DTRACE_GLOMMED_OBJ = @DTRACE_GLOMMED_OBJ@
OBJEXT = @OBJEXT@
ASMEXT = S
@@ -187,9 +170,10 @@ SYMBOL_PREFIX = @SYMBOL_PREFIX@
INSTALLED_LIST= .installed.list
-NEWLINE_C = enc/trans/newline.c
+MKMAIN_CMD = mkmain.sh
+
+NEWLINE_C = newline.c
MINIPRELUDE_C = miniprelude.c
-PRELUDE_C = prelude.c
RBCONFIG = .rbconfig.time
SRC_FILE = $<
@@ -202,8 +186,6 @@ MESSAGE_END = ; do echo "$$line"; done
ECHO_BEGIN = @sep=''; for word in
ECHO_END = ; do echo @ECHO_N@ "$$sep'$$word'@ECHO_C@"; sep=' '; done; echo
-DESTDIR = @DESTDIR@
-
configure_args = @configure_args@
#### End of variables
@@ -211,13 +193,15 @@ configure_args = @configure_args@
all:
+.DEFAULT: all
+
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
miniruby$(EXEEXT):
@-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi
$(ECHO) linking $@
- $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
+ $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(DTRACE_OBJ) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
$(PROGRAM):
@$(RM) $@
@@ -231,7 +215,7 @@ $(PROGRAM):
$(LIBRUBY_A):
@$(RM) $@
$(ECHO) linking static-library $@
- $(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBY_A_OBJS) $(INITOBJS)
+ $(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBY_A_OBJS) $(DMYEXT)
@-$(RANLIB) $@ 2> /dev/null || true
$(ECHO) verifying static-library $@
@$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT)
@@ -240,28 +224,20 @@ $(LIBRUBY_A):
$(LIBRUBY_SO):
@-$(PRE_LIBRUBY_UPDATE)
$(ECHO) linking shared-library $@
- $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(EXTSOLIBS) $(OUTFLAG)$@
- -$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)ruby_static_id_*' \
- -L '$(SYMBOL_PREFIX)*_threadptr_*' $@
+ $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(DTRACE_OBJ) $(SOLIBS) $(EXTSOLIBS) $(OUTFLAG)$@
+ -$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)*_threadptr_*' $@
$(Q) $(POSTLINK)
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link rescue nil; \
File.symlink "$(LIBRUBY_SO)", link}' \
$(LIBRUBY_ALIASES) || true
+$(arch)-fake.rb: config.status $(srcdir)/template/fake.rb.in
+ @./config.status --file=$@:$(srcdir)/template/fake.rb.in
+ @chmod +x $@
ruby_pc = @ruby_pc@
$(ruby_pc):
@./config.status --file=$@:$(srcdir)/template/ruby.pc.in
-ruby-runner.c: template/ruby-runner.c.in
- @./config.status --file=$@:$(srcdir)/template/$(@F).in
-
-ruby-runner$(EXEEXT): ruby-runner.c
- $(Q) $(PURIFY) $(CC) $(CFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(RUBY_INSTALL_NAME) $(LDFLAGS) $(LIBS) $(OUTFLAG)$@ ruby-runner.c
-
-$(RBCONFIG): $(PREP)
-
-rbconfig.rb: $(RBCONFIG)
-
install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/config.h \
$(LIBRUBY_A) $(LIBRUBY_SO) $(ARCHFILE)
$(ECHO) installing cross-compiling stuff
@@ -281,7 +257,7 @@ install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/confi
Makefile: $(srcdir)/Makefile.in $(srcdir)/enc/Makefile.in
-$(MKFILES): config.status $(srcdir)/version.h
+$(MKFILES): config.status
@[ -f $@ ] && mv $@ $@.old
MAKE=$(MAKE) $(SHELL) ./config.status $@
@cmp $@ $@.old > /dev/null 2>&1 && echo $@ unchanged && exit 0; \
@@ -297,18 +273,18 @@ uncommon.mk: $(srcdir)/common.mk
sed 's/{\$$([^(){}]*)[^{}]*}//g' $< > $@
.PHONY: reconfig
-reconfig-args = $(srcdir)/$(CONFIGURE) $(configure_args)
+reconfig-args = $(srcdir)/configure $(configure_args)
config.status-args = ./config.status --recheck
-reconfig-exec-0 = test -t 1 && { CONFIGURE_TTY=yes; export CONFIGURE_TTY; }; exec 3>&1; exit `exec 4>&1; { "$$@" 3>&- 4>&-; echo $$? 1>&4; } | fgrep -v '(cached)' 1>&3 3>&- 4>&-`
+reconfig-exec-0 = exec 3>&1; exit `exec 4>&1; { "$$@" 3>&- 4>&-; echo $$? 1>&4; } | fgrep -v '(cached)' 1>&3`
reconfig-exec-1 = set -x; "$$@"
-reconfig config.status: $(srcdir)/$(CONFIGURE) $(srcdir)/enc/Makefile.in \
+reconfig config.status: $(srcdir)/configure $(srcdir)/enc/Makefile.in \
$(srcdir)/include/ruby/version.h
@PWD= MINIRUBY="$(MINIRUBY)"; export MINIRUBY; \
set $(SHELL) $($@-args); $(reconfig-exec-$(V))
-$(srcdir)/$(CONFIGURE): $(srcdir)/configure.in $(srcdir)/aclocal.m4
- $(CHDIR) $(srcdir) && exec $(AUTOCONF) -o $(@F)
+$(srcdir)/configure: $(srcdir)/configure.in
+ $(CHDIR) $(srcdir) && exec $(AUTOCONF)
incs: id.h
all-incs: probes.h
@@ -327,9 +303,7 @@ lex.c: defs/keywords
$(CP) $(srcdir)/lex.c.blt $@; \
else \
[ $(Q) ] && echo generating $@ || set -x; \
- gperf -C -P -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? \
- | sed 's/(long)&((\(struct stringpool_t\) *\*)0)->\(stringpool_[a-z0-9]*\)/offsetof(\1, \2)/g' \
- > $@.tmp && \
+ gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@.tmp && \
$(MV) $@.tmp $@ && \
$(CP) $? $(srcdir)/defs/lex.c.src && \
$(CP) $@ $(srcdir)/lex.c.blt; \
@@ -354,22 +328,6 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
$(CP) $@ $(?:.kwd=.h.blt); \
fi
-JIS_PROPS_OPTIONS = -k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property
-
-enc/jis/props.h: enc/jis/props.kwd
- $(MAKEDIRS) $(@D)
- @set +e; \
- if cmp -s $(?:.kwd=.src) $?; then \
- set -x; \
- $(CP) $(?:.kwd=.h.blt) $@; \
- else \
- set -x; \
- gperf $(JIS_PROPS_OPTIONS) $? | \
- sed 's/(int)(long)&((\([a-zA-Z_0-9 ]*[a-zA-Z_0-9]\) *\*)0)->\([a-zA-Z0-9_]*\),/(char)offsetof(\1, \2),/g' > $@ && \
- $(CP) $? $(?:.kwd=.src) && \
- $(CP) $@ $(?:.kwd=.h.blt); \
- fi
-
.c.@OBJEXT@:
@$(ECHO) compiling $<
$(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $<
@@ -389,31 +347,32 @@ enc/jis/props.h: enc/jis/props.kwd
.d.h:
@$(ECHO) translating probes $<
$(Q) $(DTRACE) -o $@.tmp -h -C $(INCFLAGS) -s $<
- $(Q) sed -e 's/RUBY_/RUBY_DTRACE_/g' -e 's/PROBES_H_TMP/RUBY_PROBES_H/' -e 's/(char \*/(const char */g' -e 's/, char \*/, const char */g' $@.tmp > $@
+ $(Q) sed -e 's/RUBY_/RUBY_DTRACE_/g' -e 's/PROBES_H_TMP/PROBES_H/g' -e 's/(char \*/(const char */g' -e 's/, char \*/, const char */g' $@.tmp > $@
$(Q) $(RM) $@.tmp
.dmyh.h:
@$(ECHO) copying dummy $(DEST_FILE)
$(Q) $(CP) $(OS_SRC_FILE) $(OS_DEST_FILE)
-probes.stamp: $(DTRACE_REBUILD_OBJS)
- $(Q) if test -f $@ -o -f probes.$(OBJEXT); then \
- $(RM) $(DTRACE_REBUILD_OBJS) $@; \
- $(ECHO0) "rebuilding objects which were modified by \"dtrace -G\""; \
- $(MAKE) $(DTRACE_REBUILD_OBJS); \
- fi
- $(Q) touch $@
-
-probes.@OBJEXT@: $(srcdir)/probes.d $(DTRACE_REBUILD:yes=probes.stamp)
+probes.@OBJEXT@: $(srcdir)/probes.d
@$(ECHO) processing probes in object files
- $(Q) $(RM) $@
- $(Q) $(DTRACE) -G -C $(INCFLAGS) -s $(srcdir)/probes.d -o $@ $(DTRACE_REBUILD_OBJS)
+ $(Q) stamp="$*.stamp"; \
+ if test -f "$$stamp" -o -f "$@"; then \
+ $(RM) $(DTRACE_DEPENDENT_OBJS) "$$stamp"; \
+ for o in $(DTRACE_DEPENDENT_OBJS); do \
+ echo "rebuilding $$o which was modified by \"dtrace -G\""; \
+ $(MAKE) "$$o"; \
+ done; \
+ fi; \
+ touch "$$stamp"
+ $(RM) $@
+ $(Q) $(DTRACE) -G -C $(INCFLAGS) -s $(srcdir)/probes.d -o $@ $(DTRACE_DEPENDENT_OBJS)
# DTrace static library hacks described here:
# http://mail.opensolaris.org/pipermail/dtrace-discuss/2005-August/000207.html
ruby-glommed.$(OBJEXT):
@$(ECHO) generating a glommed object with DTrace probes for static library
- $(Q) $(LD) -r -o $@ $(OBJS)
+ $(Q) $(LD) -r -o $@ $(OBJS) $(DTRACE_OBJ)
clean-local::
$(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \
@@ -430,7 +389,7 @@ clean-ext distclean-ext realclean-ext::
@cd ext 2>/dev/null || exit 0; set dummy `echo "${EXTS}" | tr , ' '`; shift; \
test "$$#" = 0 && set .; \
set dummy `\
- find "$$@" -name Makefile -print | sed 's:^\./::;s:/Makefile$$::' | sort; \
+ find "$$@" -name Makefile -print | sed 's:^\./::;s:/Makefile$$:~:' | sort | sed 's:~$$::'; \
`; shift; \
cd ..; \
for dir do \
@@ -448,12 +407,24 @@ distclean-ext realclean-ext::
-$(Q)$(RMDIR) ext 2> /dev/null || true
clean-extout:
+ -$(Q)$(RMDIRS) $(EXTOUT) 2> /dev/null || true
clean-enc distclean-enc realclean-enc:
@test -f "$(ENC_MK)" || exit 0; \
echo $(@:-enc=ing) encodings; \
exec $(MAKE) -f $(ENC_MK) $(MFLAGS) $(@:-enc=)
+clean-rdoc distclean-rdoc realclean-rdoc:
+ @echo $(@:-rdoc=ing) rdoc
+ $(Q)$(RMALL) $(RDOCOUT)
+clean-capi distclean-capi realclean-capi:
+ @echo $(@:-capi=ing) capi
+ $(Q)$(RMALL) $(CAPIOUT)
+
+clean-platform:
+ @$(RM) $(PLATFORM_D)
+ -$(Q) $(RMDIR) $(PLATFORM_DIR) 2> /dev/null || true
+
ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
$(ECHO) compiling $@
$(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c ext/extinit.c
@@ -463,80 +434,36 @@ enc/encinit.$(OBJEXT): enc/encinit.c $(SETUP)
up::
@$(CHDIR) "$(srcdir)" && LC_TIME=C exec $(VCSUP)
-after-update:: update-config_files common-srcs
+up::
+ -$(Q)$(MAKE) $(MFLAGS) after-update
+
+after-update:: update-config_files
update-mspec:
@$(CHDIR) $(srcdir); \
if [ -d spec/mspec ]; then \
+ cd spec/mspec; \
echo updating mspec ...; \
- $(Q1:0=:) set -x; \
- cd spec/mspec && \
exec git pull; \
else \
echo retrieving mspec ...; \
- $(Q1:0=:) set -x; \
exec git clone $(MSPEC_GIT_URL) spec/mspec; \
fi
update-rubyspec: update-mspec
@$(CHDIR) $(srcdir); \
if [ -d spec/rubyspec ]; then \
+ cd spec/rubyspec; \
echo updating rubyspec ...; \
- $(Q1:0=:) set -x; \
- cd spec/rubyspec && \
exec git pull; \
else \
echo retrieving rubyspec ...; \
- $(Q1:0=:) set -x; \
exec git clone $(RUBYSPEC_GIT_URL) spec/rubyspec; \
fi
test-rubyspec-precheck:
@if [ ! -d $(srcdir)/spec/rubyspec ]; then echo No rubyspec here. make update-rubyspec first.; exit 1; fi
-update-doclie:
- @$(CHDIR) $(srcdir); \
- if [ -d coverage/doclie ]; then \
- echo updating doclie ...; \
- $(Q1:0=:) set -x; \
- cd coverage/doclie && \
- git fetch && \
- exec git checkout $(DOCLIE_GIT_REF); \
- else \
- echo retrieving doclie ...; \
- $(Q1:0=:) set -x; \
- exec git clone --branch $(DOCLIE_GIT_REF) $(DOCLIE_GIT_URL) coverage/doclie; \
- fi
-
-update-simplecov-html:
- @$(CHDIR) $(srcdir); \
- if [ -d coverage/simplecov-html ]; then \
- echo updating simplecov-html ...; \
- $(Q1:0=:) set -x; \
- cd coverage/simplecov-html && \
- git fetch && \
- exec git checkout $(SIMPLECOV_HTML_GIT_REF); \
- else \
- echo retrieving simplecov-html ...; \
- exec git clone --branch $(SIMPLECOV_HTML_GIT_REF) $(SIMPLECOV_HTML_GIT_URL) coverage/simplecov-html; \
- fi
-
-update-simplecov:
- @$(CHDIR) $(srcdir); \
- if [ -d coverage/simplecov ]; then \
- echo updating simplecov ...; \
- $(Q1:0=:) set -x; \
- cd coverage/simplecov && \
- git fetch && \
- exec git checkout $(SIMPLECOV_GIT_REF); \
- else \
- echo retrieving simplecov ...; \
- $(Q1:0=:) set -x; \
- exec git clone --branch $(SIMPLECOV_GIT_REF) $(SIMPLECOV_GIT_URL) coverage/simplecov; \
- fi
-
-update-coverage: update-simplecov update-simplecov-html update-doclie
-
INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \
vmtc.inc vm.inc
@@ -546,8 +473,6 @@ $(INSNS): $(srcdir)/insns.def vm_opts.h \
$(ECHO) generating $@
$(Q) $(BASERUBY) -Ku $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT) $@
-verconf.h: $(RBCONFIG)
-
loadpath: verconf.h
@$(CPP) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/loadpath.c | \
sed -e '1,/^const char ruby_initial_load_paths/d;/;/,$$d' \
diff --git a/NEWS b/NEWS
index be722bc9de..ae44d7effb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,404 +1,312 @@
# -*- rdoc -*-
-= NEWS for Ruby 2.3.0
+= NEWS for Ruby 2.1.0
This document is a list of user visible feature changes made between
releases except for bug fixes.
Note that each entry is kept so brief that no reason behind or
reference information is supplied with. For a full list of changes
-with all sufficient information, see the ChangeLog file or Redmine
-(e.g. <tt>https://bugs.ruby-lang.org/issues/$FEATURE_OR_BUG_NUMBER</tt>)
+with all sufficient information, see the ChangeLog file.
-== Changes since the 2.2.0 release
+== Changes since the 2.0.0 release
=== Language changes
-* frozen-string-literal pragma:
+* Now the default values of keyword arguments can be omitted. Those
+ "required keyword arguments" need giving explicitly at the call time.
- * new pragma, frozen-string-literal has been experimentally introduced.
- [Feature #8976]
- * besides, --enable/--disable=frozen-string-literal options also have
- been introduced. [Feature #8976]
- * command line options --debug or --debug=frozen-string-literal enable
- additional debugging mode which shows created location with at frozen
- object error (RuntimeError).
- [Feature #11725]
+* Added suffixes for integer and float literals: 'r', 'i', and 'ri'.
+ * "42r" and "3.14r" are evaluated as Rational(42, 1) and 3.14.rationalize,
+ respectively. But exponential form with 'r' suffix like "6.022e+23r" is
+ not accepted because it is misleading.
+ * "42i" and "3.14i" are evaluated as Complex(0, 42) and Complex(0, 3.14),
+ respectively.
+ * "42ri" and "3.14ri" are evaluated as Complex(0, 42r) and Complex(0, 3.14r),
+ respectively.
-* safe navigation operator:
-
- * new method call syntax, `object&.foo', method #foo is called on
- `object' if it is not nil.
- this is similar to `try!' in Active Support, except:
- * method name is syntactically required
- obj.try! {} # valid
- obj&. {} # syntax error
- * arguments are evaluated only if a call is made:
- obj.try!(:foo, bar()) # bar() is always evaluated
- obj&.foo(bar()) # bar() is conditionally evaluated
- * attribute assignment is valid
- obj&.attr += 1
- [Feature #11537]
-
-* the did_you_mean gem:
-
- * When a NameError or NoMethodError occurs because of a typo in the name,
- the did_you_mean gem automatically suggests other names similar to the
- method name.
-
- "Yuki".starts_with?("Y")
- # => NoMethodError: undefined method `starts_with?' for "Yuki":String
- # Did you mean? start_with?
-
-* indented here document:
-
- * new string literal, here document starts with `<<~`.
- refer doc/syntax/literals.rdoc for more details.
- [Feature #9098]
+* def-expr now returns the symbol of its name instead of nil.
=== Core classes updates (outstanding ones only)
-* ARGF
-
- * ARGF.read_nonblock supports `exception: false' like IO#read_nonblock.
- [Feature #11358]
-
* Array
+ * New methods
+ * Array#to_h converts an array of key-value pairs into a Hash.
- * Array#bsearch_index [Feature #10730]
- * Array#dig [Feature #11643]
-
-* Comparable
-
- * Comparable#== no longer rescues exceptions [Feature #7688]
-
-* Encoding
-
- * new Encoding::IBM037 (alias ebcdic-cp-us; dummy)
+* Binding
+ * New methods
+ * Binding#local_variable_get(symbol)
+ * Binding#local_variable_set(symbol, obj)
+ * Binding#local_variable_defined?(symbol)
* Enumerable
-
- * Enumerable#grep_v is added as inverse version of Enumerable#grep.
- [Feature #11049]
- * Enumerable#chunk_while [Feature #10769]
-
-* Enumerator::Lazy
-
- * Enumerator::Lazy#grep_v [Feature #11773]
-
-* File
-
- * File.mkfifo [Feature #11536]
- * Add File::TMPFILE corresponding to O_TMPFILE
-
-* Hash
-
- * Hash#fetch_values [Feature #10017]
- * Hash#dig [Feature #11643]
- * Hash#<=, Hash#<, Hash#>=, Hash#> [Feature #10984]
- * Hash#to_proc [Feature #11653]
+ * New methods
+ * Enumerable#to_h converts a list of key-value pairs into a Hash.
+
+* Exception
+ * New methods
+ * Exception#cause provides the previous exception which has been caught
+ at where raising the new exception.
+
+* GC
+ * added environment variable:
+ * RUBY_HEAP_SLOTS_GROWTH_FACTOR: growth rate of the heap.
+
+* Integer
+ * New methods
+ * Fixnum#bit_length
+ * Bignum#bit_length
+ * Bignum performance improvement
+ * Use GMP if available.
+ GMP is used only for several operations:
+ multiplication, division, radix conversion, GCD
* IO
-
- * new mode flag File::SHARE_DELETE is available.
- this flag means to permit deleting opened file on Windows, but currently
- this affect only files opened as binary. [Feature #11218]
-
- * new option parameter `flags' is added.
- this parameter is bitwise-ORed to oflags generated by normal mode argument.
- [Feature #11253]
-
- * IO#advise no longer raises Errno::ENOSYS in cases where it was
- detected at build time but not available at runtime. [Feature #11806]
+ * extended methods:
+ * IO#seek supports SEEK_DATA and SEEK_HOLE as whence.
+ * IO#seek accepts symbols (:CUR, :END, :SET, :DATA, :HOLE) for 2nd argument.
+ * IO#read_nonblock accepts optional `exception: false` to return symbols
+ * IO#write_nonblock accepts optional `exception: false` to return symbols
* Kernel
-
- * Kernel#loop, when stopped by a StopIteration exception, returns
- what the enumerator has returned instead of nil. [Feature #11498]
+ * New methods:
+ * Kernel#singleton_method
* Module
- * Module#deprecate_constant [Feature #11398]
-
-* NameError
- * NameError#receiver is added to take the receiver object. [Feature #10881]
+ * New methods:
+ * Module#using, which activates refinements of the specified module only
+ in the current class or module definition.
+ * Module#singleton_class? returns true if the receiver is a singleton class
+ or false if it is an ordinary class or module.
+ * extended methods:
+ * Module#refine is no longer experimental.
+ * Module#include and Module#prepend are now public methods.
+
+* Mutex
+ * misc
+ * Mutex#owned? is no longer experimental.
* Numeric
-
- * Numeric#positive? and Numeric#negative? are added, which return
- true when the receiver is positive and negative respectively.
- [Feature #11151]
-
-* Proc
-
- * Proc#call (and also #[], #===, #yield) are optimized.
- Backtrace doesn't show each method (show block lines directly).
- TracePoint also ignores these calls. [Feature #11569]
-
-* Queue (Thread::Queue)
-
- * Queue#close is added to notice a termination. [Feature #10600]
-
-* Regexp/String: Updated Unicode version from 7.0.0 to 8.0.0
-
-* RubyVM::InstructionSequence
- * add the following methods as a primitive tool of iseq loader.
- See sample/iseq_loader.rb for usage.
- Note that loader does not have verifier so it is easy to cause
- critical problem by loading modified/broken binary data.
- See [Feature #11788] for more details. (experimental feature)
- * RubyVM::InstructionSequence#to_binary(extra_data = nil)
- * RubyVM::InstructionSequence.load_from_binary(binary)
- * RubyVM::InstructionSequence.load_from_binary_extra_data(binary)
+ * extended methods:
+ * Numeric#step allows the limit argument to be omitted, in which
+ case an infinite sequence of numbers is generated. Keyword
+ arguments `to` and `by` are introduced for ease of use.
+
+* Process
+ * New methods:
+ * alternative methods to $0/$0=:
+ * Process.argv0() returns the original value of $0.
+ * Process.setproctitle() sets the process title without affecting $0.
+ * Process.clock_gettime
+ * Process.clock_getres
+
+* RbConfig
+ * New constants:
+ * RbConfig::SIZEOF is added to provide the size of C types.
* String
+ * New methods:
+ * String#scrub and String#scrub! verify and fix invalid byte sequence.
+ * extended methods:
+ * If invalid: :replace is specified for String#encode, replace
+ invalid byte sequence even if the destination encoding equals to
+ the source encoding.
- * String#+@ and String#-@ are added to get mutable/frozen strings.
- [Feature #11782]
-
- * String.new now accepts new option parameter `encoding'.
- [Feature #11785]
+* Symbol
+ * All symbols are now frozen.
-* Struct
- * Struct#dig [Feature #11688]
+* pack/unpack (Array/String)
+ * Q! and q! directives for long long type if platform has the type.
-* Thread
- * Thread#name, Thread#name= are added to handle thread names [Feature #11251]
+* toplevel
+ * extended methods:
+ * main.using is no longer experimental. The method activates refinements
+ in the ancestors of the argument module to support refinement
+ inheritance by Module#include.
=== Core classes compatibility issues (excluding feature bug fixes)
-* Array
- * Array#select!, Array#keep_if, Array#reject!, and Array#delete_if
- no longer changes the receiver array instantly every time the
- block is called. [Feature #10714]
-
- * Array#flatten and Array#flatten! no longer try to call #to_ary
- method on elements beyond the given level. [Bug #10748]
-
- * Array#inspect doesn't raise error even if its content returns
- a string which is not compatible with Encoding.default_external
- as inspected result. [Feature #11801]
-
-* Enumerable
- * Enumerable#chunk and Enumerable#slice_before no longer takes the
- initial_state argument. [Feature #10958]
- Use a local variable instead to maintain a state.
+* IO
+ * incompatible changes:
+ * open ignore internal encoding if external encoding is ASCII-8BIT.
-* File::Stat
- * On Windows File::Stat#ino always returned 0, but now returns
- BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low. [Feature #11216]
+* Kernel#eval, Kernel#instance_eval, and Module#module_eval.
+ * Copies the scope information of the original environment, which means
+ that private, protected, public, and module_function without arguments
+ do not affect the environment outside the eval string.
+ For example, `class Foo; eval "private"; def foo; end; end' doesn't make
+ Foo#foo private.
-* Hash
- * Hash#inspect doesn't raise error even if its content returns
- a string which is not compatible with Encoding.default_external
- as inspected result. [Feature #11801]
+* Kernel#untrusted?, untrust, and trust
+ * These methods are deprecated and their behavior is same as tainted?,
+ taint, and untaint, respectively. If $VERBOSE is true, they show warnings.
-* IO
- * IO#close doesn't raise when the IO object is closed. [Feature #10718]
- * IO#each_codepoint raises an exception at incomplete character
- before EOF when conversion takes place. [Bug #11444]
+* Module#ancestors
+ * The ancestors of a singleton class now include singleton classes,
+ in particular itself.
-* Module
- * Module#define_method and Object.define_singleton_method now
- require method body, Proc, Method, or a block, and raise
- ArgumentError if no block is given directly. [Bug #11283]
+* Module#define_method and Object#define_singleton_method
+ * Now they return the symbols of the defined methods, not the methods/procs
+ themselves.
-* pack/unpack (Array/String)
- * j and J directives for pointer width integer type. [Feature #11215]
+* Numeric#quo
+ * Raises TypeError instead of ArgumentError if the receiver doesn't have
+ to_r method.
+* Proc
+ * Returning from lambda proc now always exits from the Proc, not from the
+ method where the lambda is created. Returning from non-lambda proc exits
+ from the method, same as the former behavior.
=== Stdlib updates (outstanding ones only)
-* Logger
+* CGI::Util
+ * All class methods modulized.
- * Logger#level= now supports symbol and string levels such as :debug, :info,
- :warn, :error, :fatal (case insensitive) [Feature #11695]
- * Logger#reopen is added to reopen a log device. [Feature #11696]
+* Digest
+ * extended methods:
+ * Digest::Class.file takes optional arguments for its constructor
-* io/wait
- * IO#wait_readable no longer checks FIONREAD, it may be used for
- non-bytestream IO such as listen sockets.
+* Matrix
+ * Added Vector#cross_product.
-* Net::FTP
- * Net::FTP#mlst is added.
- * Net::FTP#mlsd is added.
+* Net::SMTP
+ * Added Net::SMTP#rset to implement the RSET command
-* nkf
- * Merge nkf 2.1.4.
+* objspace
+ * new method:
+ * ObjectSpace.trace_object_allocations
+ * ObjectSpace.trace_object_allocations_start
+ * ObjectSpace.trace_object_allocations_stop
+ * ObjectSpace.trace_object_allocations_clear
+ * ObjectSpace.allocation_sourcefile
+ * ObjectSpace.allocation_sourceline
+ * ObjectSpace.allocation_class_path
+ * ObjectSpace.allocation_method_id
+ * ObjectSpace.allocation_generation
+ * ObjectSpace.reachable_objects_from_root
-* ObjectSpace (objspace)
- * ObjectSpace.count_symbols is added.
- * ObjectSpace.count_imemo_objects is added.
- * ObjectSpace.internal_class_of is added.
- * ObjectSpace.internal_super_of is added.
+* OpenSSL::BN
+ * extended methods:
+ * OpenSSL::BN.new allows Fixnum/Bignum argument.
-* OpenSSL
- * OpenSSL::SSL::SSLSocket#accept_nonblock and
- OpenSSL::SSL::SSLSocket#connect_nonblock supports `exception: false`.
- [Feature #10532]
+* open-uri
+ * Support multiple fields with same field name (like Set-Cookie).
* Pathname
- * Pathname#descend and Pathname#ascend supported blockless form.
- [Feature #11052]
+ * New methods:
+ * Pathname#write
+ * Pathname#binwrite
-* Socket
- * Socket#connect_nonblock, Socket#accept_nonblock,
- TCPServer#accept_nonblock, UNIXServer#accept_nonblock,
- BasicSocket#recv_nonblock, BasicSocket#recvmsg_nonblock,
- BasicSocket#sendmsg_nonblock all support `exception: false` to return
- :wait_readable or :wait_writable symbols instead of raising
- IO::WaitReadable or IO::WaitWritable exceptions
- [Feature #10532] [Feature #11229]
- * BasicSocket#recv and BasicSocket#recv_nonblock allow an output
- String buffer argument like IO#read and IO#read_nonblock to reduce
- GC overhead [Feature #11242]
-
-* StringIO
- * In read-only mode, StringIO#set_encoding no longer sets the encoding
- of its buffer string. Setting the encoding of the string directly
- without StringIO#set_encoding may cause unpredictable behavior now.
- [Bug #11827]
-
-* timeout
- * Object#timeout is now warned as deprecated when called.
-
-=== Stdlib compatibility issues (excluding feature bug fixes)
+* rake
+ * Updated to 10.1.0. Major changes include removal of the class namespace,
+ Rake::DSL to hold the rake DSL methods and removal of support for legacy
+ rake features.
-* ext/coverage/coverage.c
- * Coverage.peek_result: new method to allow coverage to be captured without
- stopping the coverage tool. [Feature #10816]
+ For a complete list of changes since rake 0.9.6 see:
-* Fiddle
- * Fiddle::Function#call releases the GVL. [Feature #11607]
+ http://rake.rubyforge.org/doc/release_notes/rake-10_1_0_rdoc.html
-* io-console
- * Update to io-console 0.4.5, and change the license to BSD 2-clause
- "Simplified" License.
+ http://rake.rubyforge.org/doc/release_notes/rake-10_0_3_rdoc.html
-* lib/base64.rb
- * Base64.urlsafe_encode64: added a "padding" option to suppress
- the padding character ("="). [Feature #10740]
- * Base64.urlsafe_decode64: now it accepts not only correctly-padded
- input but also unpadded input. [Feature #10740]
+* RDoc
+ * Updated to 4.1.0.preview.2. Major enhancements include a modified default
+ template and accessibility enhancements.
-* lib/drb/drb.rb
- * removed unused argument. https://github.com/ruby/ruby/pull/515
+ For a list of minor enhancements and bug fixes see:
+ https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
-* lib/matrix.rb
- * Add Vector#round. https://github.com/ruby/ruby/pull/802
+* Resolv
+ * New methods:
+ * Resolv::DNS.fetch_resource
+ * One-shot multicast DNS support
+ * Support LOC resources
-* lib/webrick/utils.rb
- * removed unused argument. https://github.com/ruby/ruby/pull/356
+* REXML::Parsers::SAX2Parser
+ * Fixes wrong number of arguments of entitydecl event. Document of the event
+ says "an array of the entity declaration" but implementation passes two
+ or more arguments. It is an implementation bug but it breaks backword
+ compatibility.
-* Net::FTP
- * Connections are in passive mode per default now. The default mode can
- be changed by Net::FTP.default_passive=. [Feature #11612]
+* REXML::Parsers::StreamParser
+ * Supports "entity" event.
-* Net::HTTP
- * default value of Net::HTTP#open_timeout is now 60 (was nil).
+* REXML::Text
+ * REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
+ * REXML::Text#<< supports not "raw" mode.
-* Net::Telnet
- * Net::Telnet is extracted to net-telnet gem. It's unmaintain code.
- [Feature #11083]
+* Rinda::RingServer, Rinda::RingFinger
+ * Rinda now supports multicast sockets. See Rinda::RingServer and
+ Rinda::RingFinger for details.
-* Psych
- * Updated to Psych 2.0.17
+* RubyGems
+ * Updated to 2.2.0.preview.2 For a list of enhancements and bug fixes see:
+ https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt
-* Rake
- * Rake is removed from stdlib. [Feature #11025]
+* Set
+ * New methods:
+ * Set#intersect?
+ * Set#disjoint?
-* RDoc
- * Updated to RDoc 4.2.1. For full release notes see:
+* Socket
+ * New methods:
+ * Socket.getifaddrs
+
+* StringScanner
+ * extended methods:
+ * StringScanner#[] supports named captures.
+
+* Syslog::Logger
+ * Added facility.
+
+* Tempfile
+ * New methods:
+ * Tempfile.create
+
+* Timeout
+ * The exception to terminate the given block can no longer be rescued
+ inside the block, by default, unless the exception class is given
+ explicitly.
+
+* TSort
+ * New methods:
+ * TSort.tsort
+ * TSort.tsort_each
+ * TSort.strongly_connected_components
+ * TSort.each_strongly_connected_component
+ * TSort.each_strongly_connected_component_from
+
+* WEBrick
+ * The body of a response may now be a StringIO or other IO-like that responds
+ to #readpartial and #read.
+
+* XMLRPC::Client
+ * New methods:
+ * XMLRPC::Client#http. It returns Net::HTTP for the client. Normally,
+ it is not needed. It is useful when you want to change minor HTTP client
+ options. You can change major HTTP client options by XMLRPC::Client
+ methods. You should use XMLRPC::Client methods for changing major
+ HTTP client options instead of XMLRPC::Client#http.
- https://github.com/rdoc/rdoc/blob/master/History.rdoc#421--2015-12-22
+=== Stdlib compatibility issues (excluding feature bug fixes)
-* RubyGems
- * Updated to RubyGems 2.5.1. For full release notes see:
+* Set
+ * incompatible changes:
+ * Set#to_set now returns self instead of generating a copy.
- http://docs.seattlerb.org/rubygems/History_txt.html#label-2.5.0+-2F+2015-11-03
- and
- http://docs.seattlerb.org/rubygems/History_txt.html#label-2.5.1+-2F+2015-12-10
+* URI
+ * incompatible changes:
+ * URI.decode_www_form follows current WHATWG URL Standard.
+ It gets encoding argument to specify the character encoding.
+ It now allows loose percent encoded strings, but denies ;-separator.
+ * URI.encode_www_form follows current WHATWG URL Standard.
+ It gets encoding argument to convert before percent encode.
+ UTF-16 strings aren't converted to UTF-8 before percent encode by default.
=== Built-in global variables compatibility issues
* $SAFE
- * $SAFE=2 and $SAFE=3 are obsolete. If $SAFE is set to 2 or larger,
- an ArgumentError is raised. [Feature #5455]
+ * $SAFE=4 is obsolete. If $SAFE is set to 4 or larger, an ArgumentError
+ is raised.
=== C API updates
-
-* rb_define_class_id_under() now raises a TypeError exception when the
- class is already defined but its superclass does not match the given
- superclass, as well as definitions in ruby level.
-
-* rb_timespec_now() is added to fetch current datetime as struct timespec.
- [Feature #11558]
-
-* rb_time_timespec_new() is added to create a time object with epoch,
- nanosecond, and UTC/localtime/time offset arguments. [Feature #11558]
-
-* rb_autoload() deprecated, use rb_funcall() instead. [Feature #11664]
-
-* rb_compile_error_with_enc(), rb_compile_error(), and rb_compile_bug()
- deprecated. these functions are exposed but only for internal use.
- external libraries should not use them.
-
-=== Supported platform changes
-
-* OS/2 is no longer supported
-
-* BeOS is no longer supported
-
-* Borland-C is no longer supported
-
-* Haiku now stable and best effort
-
-=== Implementation improvements
-
-* Optimize Proc#call to eliminate method frame construction.
- [Feature #11569]
-
-* Reconsidering method entry data structure.
- [Bug #11278]
-
-* Introducing new table data structure for ID keys tables used by
- method table and so on. New table structure is simple and fast
- than st_table. [Feature #11420]
-
-* Machine code level tuning for object allocation and method calling
- code. r52099, r52254
-
-* RubyVM::InstructionSequence is extended for future improvement.
- [Feature #11788]
-
-* Case dispatch is now optimized for all special constant literals
- including nil, true, and false. Previously, only literal strings,
- symbols, integers and floats compiled to optimized case dispatch.
- [Feature #11769]
-
-* Instance variables on non-pure Ruby classes (T_DATA, T_FILE,
- etc..) is less expensive to store than before. [Feature #11170]
-
-* All accesses to members of big Struct objects are performed in
- constant-time. Previously, Struct elements beyond the first 10
- 10 elements used a linear scan. [Feature #10585]
-
-* The Set class got several speed up.
- [Misc #10754], [r52591]
-
-* Socket and I/O-related improvements
-
- * Calling overhead of most of new keyword-using I/O methods in
- [Feature #11229] is reduced by avoiding the inefficient C API
- to parse keywords. [Feature #11339]
-
- * The standard library is updated to use the improved
- exception-free non-blocking I/O from [Feature #11229].
- This has the additional benefit of quieter $DEBUG output in
- addition to reducing expensive exceptions. [Feature #11044]
-
- * (Linux-only) waiting on a single FD anywhere in the stdlib no longer
- uses select(2), making it immune to slowdowns with high-numbered FDs.
- [Feature #11081] [Feature #11377]
-
-* CGI.escapeHTML is optimized with C extention.
- https://github.com/ruby/ruby/pull/1164
diff --git a/README b/README
new file mode 100644
index 0000000000..3ffe3553a8
--- /dev/null
+++ b/README
@@ -0,0 +1,166 @@
+= What's Ruby
+
+Ruby is the interpreted scripting language for quick and
+easy object-oriented programming. It has many features to
+process text files and to do system management tasks (as in
+Perl). It is simple, straight-forward, and extensible.
+
+
+== Features of Ruby
+
+* Simple Syntax
+* *Normal* Object-Oriented features(ex. class, method calls)
+* *Advanced* Object-Oriented features(ex. Mix-in, Singleton-method)
+* Operator Overloading
+* Exception Handling
+* Iterators and Closures
+* Garbage Collection
+* Dynamic Loading of Object files(on some architecture)
+* Highly Portable (works on many Unix-like/POSIX compatible platforms
+ as well as Windows, Mac OS X, BeOS etc.)
+ cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms
+
+
+== How to get Ruby
+
+For a complete list of ways to install Ruby, including using third party
+tools like rvm, see:
+
+http://www.ruby-lang.org/en/downloads/
+
+The Ruby distribution files can be found in the following FTP site:
+
+ftp://ftp.ruby-lang.org/pub/ruby/
+
+The trunk of the Ruby source tree can be checked out with the
+following command:
+
+ $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
+
+Or if you are using git then use the following command:
+
+ $ git clone git://github.com/ruby/ruby.git
+
+There are some other branches under development. Try the following
+command and see the list of branches:
+
+ $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
+
+Or if you are using git then use the following command:
+
+ $ git ls-remote git://github.com/ruby/ruby.git
+
+== Ruby home-page
+
+The URL of the Ruby home-page is:
+
+http://www.ruby-lang.org/
+
+
+== Mailing list
+
+There is a mailing list to talk about Ruby.
+To subscribe this list, please send the following phrase
+
+ subscribe YourFirstName YourFamilyName
+e.g.
+ subscribe Joseph Smith
+
+in the mail body (not subject) to the address <mailto:ruby-talk-ctl@ruby-lang.org>.
+
+
+== How to compile and install
+
+This is what you need to do to compile and install Ruby:
+
+0. If you want to use Microsoft Visual C++ to compile ruby,
+ read win32/README.win32 instead of this document.
+
+1. If +./configure+ does not exist or is older than configure.in,
+ run autoconf to (re)generate configure.
+
+2. Run +./configure+, which will generate config.h and Makefile.
+
+ Some C compiler flags may be added by default depending on your
+ environment. Specify <tt>optflags=..</tt> and <tt>warnflags=..</tt> as
+ necessary to override them.
+
+3. Edit +defines.h+ if you need. Usually this step will not be needed.
+
+4. Remove comment mark(<tt>#</tt>) before the module names from +ext/Setup+
+ (or add module names if not present), if you want to link modules
+ statically.
+
+ If you don't want to compile non static extension modules
+ (probably on architectures which does not allow dynamic loading),
+ remove comment mark from the line "<tt>#option nodynamic</tt>" in
+ +ext/Setup+.
+
+ Usually this step will not be needed.
+
+5. Run +make+.
+
+6. Optionally, run '<tt>make check</tt>' to check whether the compiled Ruby
+ interpreter works well. If you see the message "<tt>check succeeded</tt>",
+ your ruby works as it should (hopefully).
+
+7. Run '<tt>make install</tt>'
+
+ This command will create following directories and install files
+ onto them.
+
+ * <tt>${DESTDIR}${prefix}/bin</tt>
+ * <tt>${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/site_ruby</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/vendor_ruby</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/share/man/man1</tt>
+ * <tt>${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system</tt>
+
+ If Ruby's API version is '_x.y.z_', the <tt>${MAJOR}</tt> is '_x_', the
+ <tt>${MINOR}</tt> is '_y_', and the <tt>${TEENY}</tt> is '_z_'.
+
+ *NOTE*: teeny of the API version may be different from one of
+ Ruby's program version
+
+ You may have to be a super user to install ruby.
+
+If you fail to compile ruby, please send the detailed error report with
+the error log and machine/OS type, to help others.
+
+Some extension libraries may not get compiled because of lack of
+necessary external libraries and/or headers, then you will need to run
+'<tt>make distclean-ext</tt>' to remove old configuration after
+installing them in such case.
+
+== Copying
+
+See the file +COPYING+.
+
+== Feedback
+
+Questions about the Ruby language can be asked on the Ruby-Talk mailing list
+(http://www.ruby-lang.org/en/community/mailing-lists) or on websites like
+(http://stackoverflow.com).
+
+Bug reports should be filed at http://bugs.ruby-lang.org
+
+== The Author
+
+Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.
+
+<mailto:matz@ruby-lang.org>
+
+--
+Local variables:
+mode: rdoc
+end:
diff --git a/README.EXT b/README.EXT
index 48b8d964c4..b7a1728110 100644
--- a/README.EXT
+++ b/README.EXT
@@ -1 +1,1499 @@
-Moved to doc/extension.rdoc
+# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
+
+This document explains how to make extension libraries for Ruby.
+
+= Basic Knowledge
+
+In C, variables have types and data do not have types. In contrast,
+Ruby variables do not have a static type, and data themselves have
+types, so data will need to be converted between the languages.
+
+Data in Ruby are represented by the C type `VALUE'. Each VALUE data
+has its data-type.
+
+To retrieve C data from a VALUE, you need to:
+
+1. Identify the VALUE's data type
+2. Convert the VALUE into C data
+
+Converting to the wrong data type may cause serious problems.
+
+== Data-Types
+
+The Ruby interpreter has the following data types:
+
+T_NIL :: nil
+T_OBJECT :: ordinary object
+T_CLASS :: class
+T_MODULE :: module
+T_FLOAT :: floating point number
+T_STRING :: string
+T_REGEXP :: regular expression
+T_ARRAY :: array
+T_HASH :: associative array
+T_STRUCT :: (Ruby) structure
+T_BIGNUM :: multi precision integer
+T_FIXNUM :: Fixnum(31bit or 63bit integer)
+T_COMPLEX :: complex number
+T_RATIONAL :: rational number
+T_FILE :: IO
+T_TRUE :: true
+T_FALSE :: false
+T_DATA :: data
+T_SYMBOL :: symbol
+
+In addition, there are several other types used internally:
+
+T_ICLASS :: included module
+T_MATCH :: MatchData object
+T_UNDEF :: undefined
+T_NODE :: syntax tree node
+T_ZOMBIE :: object awaiting finalization
+
+Most of the types are represented by C structures.
+
+== Check Data Type of the VALUE
+
+The macro TYPE() defined in ruby.h shows the data type of the VALUE.
+TYPE() returns the constant number T_XXXX described above. To handle
+data types, your code will look something like this:
+
+ switch (TYPE(obj)) {
+ case T_FIXNUM:
+ /* process Fixnum */
+ break;
+ case T_STRING:
+ /* process String */
+ break;
+ case T_ARRAY:
+ /* process Array */
+ break;
+ default:
+ /* raise exception */
+ rb_raise(rb_eTypeError, "not valid value");
+ break;
+ }
+
+There is the data-type check function
+
+ void Check_Type(VALUE value, int type)
+
+which raises an exception if the VALUE does not have the type
+specified.
+
+There are also faster check macros for fixnums and nil.
+
+ FIXNUM_P(obj)
+ NIL_P(obj)
+
+== Convert VALUE into C Data
+
+The data for type T_NIL, T_FALSE, T_TRUE are nil, false, true
+respectively. They are singletons for the data type.
+The equivalent C constants are: Qnil, Qfalse, Qtrue.
+Note that Qfalse is false in C also (i.e. 0), but not Qnil.
+
+The T_FIXNUM data is a 31bit or 63bit length fixed integer.
+This size is depend on the size of long: if long is 32bit then
+T_FIXNUM is 31bit, if long is 64bit then T_FIXNUM is 63bit.
+T_FIXNUM can be converted to a C integer by using the
+FIX2INT() macro or FIX2LONG(). Though you have to check that the
+data is really FIXNUM before using them, they are faster. FIX2LONG()
+never raises exceptions, but FIX2INT() raises RangeError if the
+result is bigger or smaller than the size of int.
+There are also NUM2INT() and NUM2LONG() which converts any Ruby
+numbers into C integers. These macros includes a type check,
+so an exception will be raised if the conversion failed. NUM2DBL()
+can be used to retrieve the double float value in the same way.
+
+You can use the macros
+StringValue() and StringValuePtr() to get a char* from a VALUE.
+StringValue(var) replaces var's value with the result of "var.to_str()".
+StringValuePtr(var) does same replacement and returns char*
+representation of var. These macros will skip the replacement if var
+is a String. Notice that the macros take only the lvalue as their
+argument, to change the value of var in place.
+
+You can also use the macro named StringValueCStr(). This is just
+like StringValuePtr(), but always add nul character at the end of
+the result. If the result contains nul character, this macro causes
+the ArgumentError exception.
+StringValuePtr() doesn't guarantee the existence of a nul at the end
+of the result, and the result may contain nul.
+
+Other data types have corresponding C structures, e.g. struct RArray
+for T_ARRAY etc. The VALUE of the type which has the corresponding
+structure can be cast to retrieve the pointer to the struct. The
+casting macro will be of the form RXXXX for each data type; for
+instance, RARRAY(obj). See "ruby.h". However, we do not recommend
+to access RXXXX data directly because these data structure is complex.
+Use corresponding rb_xxx() functions to access internal struct.
+For example, to access an entry of array, use rb_ary_entry(ary, offset)
+and rb_ary_store(ary, offset, obj).
+
+There are some accessing macros for structure members, for example
+`RSTRING_LEN(str)' to get the size of the Ruby String object. The
+allocated region can be accessed by `RSTRING_PTR(str)'.
+
+Notice: Do not change the value of the structure directly, unless you
+are responsible for the result. This ends up being the cause of
+interesting bugs.
+
+== Convert C Data into VALUE
+
+To convert C data to Ruby values:
+
+FIXNUM ::
+
+ left shift 1 bit, and turn on LSB.
+
+Other pointer values::
+
+ cast to VALUE.
+
+You can determine whether a VALUE is pointer or not by checking its LSB.
+
+Notice Ruby does not allow arbitrary pointer values to be a VALUE. They
+should be pointers to the structures which Ruby knows about. The known
+structures are defined in <ruby.h>.
+
+To convert C numbers to Ruby values, use these macros.
+
+INT2FIX() :: for integers within 31bits.
+INT2NUM() :: for arbitrary sized integer.
+
+INT2NUM() converts an integer into a Bignum if it is out of the FIXNUM
+range, but is a bit slower.
+
+== Manipulating Ruby Data
+
+As I already mentioned, it is not recommended to modify an object's
+internal structure. To manipulate objects, use the functions supplied
+by the Ruby interpreter. Some (not all) of the useful functions are
+listed below:
+
+=== String Functions
+
+rb_str_new(const char *ptr, long len) ::
+
+ Creates a new Ruby string.
+
+rb_str_new2(const char *ptr) ::
+rb_str_new_cstr(const char *ptr) ::
+
+ Creates a new Ruby string from a C string. This is equivalent to
+ rb_str_new(ptr, strlen(ptr)).
+
+rb_tainted_str_new(const char *ptr, long len) ::
+
+ Creates a new tainted Ruby string. Strings from external data
+ sources should be tainted.
+
+rb_tainted_str_new2(const char *ptr) ::
+rb_tainted_str_new_cstr(const char *ptr) ::
+
+ Creates a new tainted Ruby string from a C string.
+
+rb_sprintf(const char *format, ...) ::
+rb_vsprintf(const char *format, va_list ap) ::
+
+ Creates a new Ruby string with printf(3) format.
+
+ Note: In the format string, %i is used for Object#to_s (or Object#inspect if
+ '+' flag is set) output (and related argument must be a VALUE). For integers
+ in format strings, use %d.
+
+rb_str_cat(VALUE str, const char *ptr, long len) ::
+
+ Appends len bytes of data from ptr to the Ruby string.
+
+rb_str_cat2(VALUE str, const char* ptr) ::
+
+ Appends C string ptr to Ruby string str. This function is
+ equivalent to rb_str_cat(str, ptr, strlen(ptr)).
+
+rb_str_catf(VALUE str, const char* format, ...) ::
+rb_str_vcatf(VALUE str, const char* format, va_list ap) ::
+
+ Appends C string format and successive arguments to Ruby string
+ str according to a printf-like format. These functions are
+ equivalent to rb_str_cat2(str, rb_sprintf(format, ...)) and
+ rb_str_cat2(str, rb_vsprintf(format, ap)), respectively.
+
+rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) ::
+rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc) ::
+
+ Creates a new Ruby string with the specified encoding.
+
+rb_usascii_str_new(const char *ptr, long len) ::
+rb_usascii_str_new_cstr(const char *ptr) ::
+
+ Creates a new Ruby string with encoding US-ASCII.
+
+rb_str_resize(VALUE str, long len) ::
+
+ Resizes Ruby string to len bytes. If str is not modifiable, this
+ function raises an exception. The length of str must be set in
+ advance. If len is less than the old length the content beyond
+ len bytes is discarded, else if len is greater than the old length
+ the content beyond the old length bytes will not be preserved but
+ will be garbage. Note that RSTRING_PTR(str) may change by calling
+ this function.
+
+rb_str_set_len(VALUE str, long len) ::
+
+ Sets the length of Ruby string. If str is not modifiable, this
+ function raises an exception. This function preserves the content
+ upto len bytes, regardless RSTRING_LEN(str). len must not exceed
+ the capacity of str.
+
+=== Array Functions
+
+rb_ary_new() ::
+
+ Creates an array with no elements.
+
+rb_ary_new2(long len) ::
+rb_ary_new_capa(long len) ::
+
+ Creates an array with no elements, allocating internal buffer
+ for len elements.
+
+rb_ary_new3(long n, ...) ::
+rb_ary_new_from_args(long n, ...) ::
+
+ Creates an n-element array from the arguments.
+
+rb_ary_new4(long n, VALUE *elts) ::
+rb_ary_new_from_values(long n, VALUE *elts) ::
+
+ Creates an n-element array from a C array.
+
+rb_ary_to_ary(VALUE obj) ::
+
+ Converts the object into an array.
+ Equivalent to Object#to_ary.
+
+There are many functions to operate an array. They may dump core if other
+types are given.
+
+rb_ary_aref(argc, VALUE *argv, VALUE ary) ::
+
+ Equivalent to Array#[].
+
+rb_ary_entry(VALUE ary, long offset) ::
+
+ ary[offset]
+
+rb_ary_store(VALUE ary, long offset, VALUE obj) ::
+
+ ary[offset] = obj
+
+rb_ary_subseq(VALUE ary, long beg, long len) ::
+
+ ary[beg, len]
+
+rb_ary_push(VALUE ary, VALUE val) ::
+rb_ary_pop(VALUE ary) ::
+rb_ary_shift(VALUE ary) ::
+rb_ary_unshift(VALUE ary, VALUE val) ::
+
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len) ::
+
+ Appends len elements of objects from ptr to the array.
+
+= Extending Ruby with C
+
+== Adding New Features to Ruby
+
+You can add new features (classes, methods, etc.) to the Ruby
+interpreter. Ruby provides APIs for defining the following things:
+
+* Classes, Modules
+* Methods, Singleton Methods
+* Constants
+
+=== Class and Module Definition
+
+To define a class or module, use the functions below:
+
+ VALUE rb_define_class(const char *name, VALUE super)
+ VALUE rb_define_module(const char *name)
+
+These functions return the newly created class or module. You may
+want to save this reference into a variable to use later.
+
+To define nested classes or modules, use the functions below:
+
+ VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE outer, const char *name)
+
+=== Method and Singleton Method Definition
+
+To define methods or singleton methods, use these functions:
+
+ void rb_define_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+
+ void rb_define_singleton_method(VALUE object, const char *name,
+ VALUE (*func)(), int argc)
+
+The `argc' represents the number of the arguments to the C function,
+which must be less than 17. But I doubt you'll need that many.
+
+If `argc' is negative, it specifies the calling sequence, not number of
+the arguments.
+
+If argc is -1, the function will be called as:
+
+ VALUE func(int argc, VALUE *argv, VALUE obj)
+
+where argc is the actual number of arguments, argv is the C array of
+the arguments, and obj is the receiver.
+
+If argc is -2, the arguments are passed in a Ruby array. The function
+will be called like:
+
+ VALUE func(VALUE obj, VALUE args)
+
+where obj is the receiver, and args is the Ruby array containing
+actual arguments.
+
+There are some more functions to define methods. One takes an ID
+as the name of method to be defined. See also ID or Symbol below.
+
+ void rb_define_method_id(VALUE klass, ID name,
+ VALUE (*func)(ANYARGS), int argc)
+
+There are two functions to define private/protected methods:
+
+ void rb_define_private_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+ void rb_define_protected_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+
+At last, rb_define_module_function defines a module functions,
+which are private AND singleton methods of the module.
+For example, sqrt is the module function defined in Math module.
+It can be called in the following way:
+
+ Math.sqrt(4)
+
+or
+
+ include Math
+ sqrt(4)
+
+To define module functions, use:
+
+ void rb_define_module_function(VALUE module, const char *name,
+ VALUE (*func)(), int argc)
+
+In addition, function-like methods, which are private methods defined
+in the Kernel module, can be defined using:
+
+ void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
+
+To define an alias for the method,
+
+ void rb_define_alias(VALUE module, const char* new, const char* old);
+
+To define a reader/writer for an attribute,
+
+ void rb_define_attr(VALUE klass, const char *name, int read, int write)
+
+To define and undefine the `allocate' class method,
+
+ void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
+ void rb_undef_alloc_func(VALUE klass);
+
+func has to take the klass as the argument and return a newly
+allocated instance. This instance should be as empty as possible,
+without any expensive (including external) resources.
+
+=== Constant Definition
+
+We have 2 functions to define constants:
+
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
+
+The former is to define a constant under specified class/module. The
+latter is to define a global constant.
+
+== Use Ruby Features from C
+
+There are several ways to invoke Ruby's features from C code.
+
+=== Evaluate Ruby Programs in a String
+
+The easiest way to use Ruby's functionality from a C program is to
+evaluate the string as Ruby program. This function will do the job:
+
+ VALUE rb_eval_string(const char *str)
+
+Evaluation is done under the current context, thus current local variables
+of the innermost method (which is defined by Ruby) can be accessed.
+
+Note that the evaluation can raise an exception. There is a safer
+function:
+
+ VALUE rb_eval_string_protect(const char *str, int *state)
+
+It returns nil when an error occur. Moreover, *state is zero if str was
+successfully evaluated, or nonzero otherwise.
+
+=== ID or Symbol
+
+You can invoke methods directly, without parsing the string. First I
+need to explain about ID. ID is the integer number to represent
+Ruby's identifiers such as variable names. The Ruby data type
+corresponding to ID is Symbol. It can be accessed from Ruby in the
+form:
+
+ :Identifier
+
+or
+
+ :"any kind of string"
+
+You can get the ID value from a string within C code by using
+
+ rb_intern(const char *name)
+ rb_intern_str(VALUE name)
+
+You can retrieve ID from Ruby object (Symbol or String) given as an
+argument by using
+
+ rb_to_id(VALUE symbol)
+ rb_check_id(volatile VALUE *name)
+ rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
+
+These functions try to convert the argument to a String if it was not
+a Symbol nor a String. The second function stores the converted
+result into *name, and returns 0 if the string is not a known symbol.
+After this function returned a non-zero value, *name is always a
+Symbol or a String, otherwise it is a String if the result is 0.
+The third function takes NUL-terminated C string, not Ruby VALUE.
+
+You can convert C ID to Ruby Symbol by using
+
+ VALUE ID2SYM(ID id)
+
+and to convert Ruby Symbol object to ID, use
+
+ ID SYM2ID(VALUE symbol)
+
+=== Invoke Ruby Method from C
+
+To invoke methods directly, you can use the function below
+
+ VALUE rb_funcall(VALUE recv, ID mid, int argc, ...)
+
+This function invokes a method on the recv, with the method name
+specified by the symbol mid.
+
+=== Accessing the Variables and Constants
+
+You can access class variables and instance variables using access
+functions. Also, global variables can be shared between both
+environments. There's no way to access Ruby's local variables.
+
+The functions to access/modify instance variables are below:
+
+ VALUE rb_ivar_get(VALUE obj, ID id)
+ VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
+
+id must be the symbol, which can be retrieved by rb_intern().
+
+To access the constants of the class/module:
+
+ VALUE rb_const_get(VALUE obj, ID id)
+
+See also Constant Definition above.
+
+= Information Sharing Between Ruby and C
+
+=== Ruby Constants That C Can Be Accessed From C
+
+As stated in section 1.3,
+the following Ruby constants can be referred from C.
+
+ Qtrue
+ Qfalse
+
+Boolean values. Qfalse is false in C also (i.e. 0).
+
+ Qnil
+
+Ruby nil in C scope.
+
+== Global Variables Shared Between C and Ruby
+
+Information can be shared between the two environments using shared global
+variables. To define them, you can use functions listed below:
+
+ void rb_define_variable(const char *name, VALUE *var)
+
+This function defines the variable which is shared by both environments.
+The value of the global variable pointed to by `var' can be accessed
+through Ruby's global variable named `name'.
+
+You can define read-only (from Ruby, of course) variables using the
+function below.
+
+ void rb_define_readonly_variable(const char *name, VALUE *var)
+
+You can defined hooked variables. The accessor functions (getter and
+setter) are called on access to the hooked variables.
+
+ void rb_define_hooked_variable(const char *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
+
+If you need to supply either setter or getter, just supply 0 for the
+hook you don't need. If both hooks are 0, rb_define_hooked_variable()
+works just like rb_define_variable().
+
+The prototypes of the getter and setter functions are as follows:
+
+ VALUE (*getter)(ID id, VALUE *var);
+ void (*setter)(VALUE val, ID id, VALUE *var);
+
+
+Also you can define a Ruby global variable without a corresponding C
+variable. The value of the variable will be set/get only by hooks.
+
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
+
+The prototypes of the getter and setter functions are as follows:
+
+ VALUE (*getter)(ID id);
+ void (*setter)(VALUE val, ID id);
+
+
+== Encapsulate C Data into a Ruby Object
+
+To wrap and objectify a C pointer as a Ruby object (so called
+DATA), use Data_Wrap_Struct().
+
+ Data_Wrap_Struct(klass, mark, free, sval)
+
+Data_Wrap_Struct() returns a created DATA object. The klass argument
+is the class for the DATA object. The mark argument is the function
+to mark Ruby objects pointed by this data. The free argument is the
+function to free the pointer allocation. If this is -1, the pointer
+will be just freed. The functions mark and free will be called from
+garbage collector.
+
+These mark / free functions are invoked during GC execution. No
+object allocations are allowed during it, so do not allocate ruby
+objects inside them.
+
+You can allocate and wrap the structure in one step.
+
+ Data_Make_Struct(klass, type, mark, free, sval)
+
+This macro returns an allocated Data object, wrapping the pointer to
+the structure, which is also allocated. This macro works like:
+
+ (sval = ALLOC(type), Data_Wrap_Struct(klass, mark, free, sval))
+
+Arguments klass, mark, and free work like their counterparts in
+Data_Wrap_Struct(). A pointer to the allocated structure will be
+assigned to sval, which should be a pointer of the type specified.
+
+To retrieve the C pointer from the Data object, use the macro
+Data_Get_Struct().
+
+ Data_Get_Struct(obj, type, sval)
+
+A pointer to the structure will be assigned to the variable sval.
+
+See the example below for details.
+
+= Example - Creating dbm Extension
+
+OK, here's the example of making an extension library. This is the
+extension to access DBMs. The full source is included in the ext/
+directory in the Ruby's source tree.
+
+== Make the Directory
+
+ % mkdir ext/dbm
+
+Make a directory for the extension library under ext directory.
+
+== Design the Library
+
+You need to design the library features, before making it.
+
+== Write the C Code
+
+You need to write C code for your extension library. If your library
+has only one source file, choosing ``LIBRARY.c'' as a file name is
+preferred. On the other hand, in case your library has multiple source
+files, avoid choosing ``LIBRARY.c'' for a file name. It may conflict
+with an intermediate file ``LIBRARY.o'' on some platforms.
+Note that some functions in mkmf library described below generate
+a file ``conftest.c'' for checking with compilation. You shouldn't
+choose ``conftest.c'' as a name of a source file.
+
+Ruby will execute the initializing function named ``Init_LIBRARY'' in
+the library. For example, ``Init_dbm()'' will be executed when loading
+the library.
+
+Here's the example of an initializing function.
+
+ void
+ Init_dbm(void)
+ {
+ /* define DBM class */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBM includes Enumerate module */
+ rb_include_module(cDBM, rb_mEnumerable);
+
+ /* DBM has class method open(): arguments are received as C array */
+ rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
+
+ /* DBM instance method close(): no args */
+ rb_define_method(cDBM, "close", fdbm_close, 0);
+ /* DBM instance method []: 1 argument */
+ rb_define_method(cDBM, "[]", fdbm_fetch, 1);
+
+ /* ... */
+
+ /* ID for a instance variable to store DBM data */
+ id_dbm = rb_intern("dbm");
+ }
+
+The dbm extension wraps the dbm struct in the C environment using
+Data_Make_Struct.
+
+ struct dbmdata {
+ int di_size;
+ DBM *di_dbm;
+ };
+
+ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
+
+This code wraps the dbmdata structure into a Ruby object. We avoid
+wrapping DBM* directly, because we want to cache size information.
+
+To retrieve the dbmdata structure from a Ruby object, we define the
+following macro:
+
+ #define GetDBM(obj, dbmp) {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+ }
+
+This sort of complicated macro does the retrieving and close checking for
+the DBM.
+
+There are three kinds of way to receive method arguments. First,
+methods with a fixed number of arguments receive arguments like this:
+
+ static VALUE
+ fdbm_delete(VALUE obj, VALUE keystr)
+ {
+ /* ... */
+ }
+
+The first argument of the C function is the self, the rest are the
+arguments to the method.
+
+Second, methods with an arbitrary number of arguments receive
+arguments like this:
+
+ static VALUE
+ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
+ {
+ /* ... */
+ if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ mode = 0666; /* default value */
+ }
+ /* ... */
+ }
+
+The first argument is the number of method arguments, the second
+argument is the C array of the method arguments, and the third
+argument is the receiver of the method.
+
+You can use the function rb_scan_args() to check and retrieve the
+arguments. The third argument is a string that specifies how to
+capture method arguments and assign them to the following VALUE
+references.
+
+
+The following is an example of a method that takes arguments by Ruby's
+array:
+
+ static VALUE
+ thread_initialize(VALUE thread, VALUE args)
+ {
+ /* ... */
+ }
+
+The first argument is the receiver, the second one is the Ruby array
+which contains the arguments to the method.
+
+*Notice*: GC should know about global variables which refer to Ruby's objects,
+but are not exported to the Ruby world. You need to protect them by
+
+ void rb_global_variable(VALUE *var)
+
+== Prepare extconf.rb
+
+If the file named extconf.rb exists, it will be executed to generate
+Makefile.
+
+extconf.rb is the file for checking compilation conditions etc. You
+need to put
+
+ require 'mkmf'
+
+at the top of the file. You can use the functions below to check
+various conditions.
+
+ have_macro(macro[, headers[, opt]]): check whether macro is defined
+ have_library(lib[, func[, headers[, opt]]]): check whether library containing function exists
+ find_library(lib[, func, *paths]): find library from paths
+ have_func(func[, headers[, opt]): check whether function exists
+ have_var(var[, headers[, opt]]): check whether variable exists
+ have_header(header[, preheaders[, opt]]): check whether header file exists
+ find_header(header, *paths): find header from paths
+ have_framework(fw): check whether framework exists (for MacOS X)
+ have_struct_member(type, member[, headers[, opt]]): check whether struct has member
+ have_type(type[, headers[, opt]]): check whether type exists
+ find_type(type, opt, *headers): check whether type exists in headers
+ have_const(const[, headers[, opt]]): check whether constant is defined
+ check_sizeof(type[, headers[, opts]]): check size of type
+ check_signedness(type[, headers[, opts]]): check signedness of type
+ convertible_int(type[, headers[, opts]]): find convertible integer type
+ find_executable(bin[, path]): find executable file path
+ create_header(header): generate configured header
+ create_makefile(target[, target_prefix]): generate Makefile
+
+See MakeMakefile for full documentation of these functions.
+
+The value of the variables below will affect the Makefile.
+
+ $CFLAGS: included in CFLAGS make variable (such as -O)
+ $CPPFLAGS: included in CPPFLAGS make variable (such as -I, -D)
+ $LDFLAGS: included in LDFLAGS make variable (such as -L)
+ $objs: list of object file names
+
+Normally, the object files list is automatically generated by searching
+source files, but you must define them explicitly if any sources will
+be generated while building.
+
+If a compilation condition is not fulfilled, you should not call
+``create_makefile''. The Makefile will not be generated, compilation will
+not be done.
+
+== Prepare Depend (Optional)
+
+If the file named depend exists, Makefile will include that file to
+check dependencies. You can make this file by invoking
+
+ % gcc -MM *.c > depend
+
+It's harmless. Prepare it.
+
+== Generate Makefile
+
+Try generating the Makefile by:
+
+ ruby extconf.rb
+
+If the library should be installed under vendor_ruby directory
+instead of site_ruby directory, use --vendor option as follows.
+
+ ruby extconf.rb --vendor
+
+You don't need this step if you put the extension library under the ext
+directory of the ruby source tree. In that case, compilation of the
+interpreter will do this step for you.
+
+== Run make
+
+Type
+
+ make
+
+to compile your extension. You don't need this step either if you have
+put the extension library under the ext directory of the ruby source tree.
+
+== Debug
+
+You may need to rb_debug the extension. Extensions can be linked
+statically by adding the directory name in the ext/Setup file so that
+you can inspect the extension with the debugger.
+
+== Done! Now You Have the Extension Library
+
+You can do anything you want with your library. The author of Ruby
+will not claim any restrictions on your code depending on the Ruby API.
+Feel free to use, modify, distribute or sell your program.
+
+= Appendix A. Ruby Source Files Overview
+
+== Ruby Language Core
+
+class.c :: classes and modules
+error.c :: exception classes and exception mechanism
+gc.c :: memory management
+load.c :: library loading
+object.c :: objects
+variable.c :: variables and constants
+
+== Ruby Syntax Parser
+
+parse.y :: grammar definition
+parse.c :: automatically generated from parse.y
+keywords :: reserved keywords
+lex.c :: automatically generated from keywords
+
+== Ruby Evaluator (a.k.a. YARV)
+
+ compile.c
+ eval.c
+ eval_error.c
+ eval_jump.c
+ eval_safe.c
+ insns.def : definition of VM instructions
+ iseq.c : implementation of VM::ISeq
+ thread.c : thread management and context switching
+ thread_win32.c : thread implementation
+ thread_pthread.c : ditto
+ vm.c
+ vm_dump.c
+ vm_eval.c
+ vm_exec.c
+ vm_insnhelper.c
+ vm_method.c
+
+ opt_insns_unif.def : instruction unification
+ opt_operand.def : definitions for optimization
+
+ -> insn*.inc : automatically generated
+ -> opt*.inc : automatically generated
+ -> vm.inc : automatically generated
+
+== Regular Expression Engine (Oniguruma)
+
+ regex.c
+ regcomp.c
+ regenc.c
+ regerror.c
+ regexec.c
+ regparse.c
+ regsyntax.c
+
+== Utility Functions
+
+debug.c :: debug symbols for C debugger
+dln.c :: dynamic loading
+st.c :: general purpose hash table
+strftime.c :: formatting times
+util.c :: misc utilities
+
+== Ruby Interpreter Implementation
+
+ dmyext.c
+ dmydln.c
+ dmyencoding.c
+ id.c
+ inits.c
+ main.c
+ ruby.c
+ version.c
+
+ gem_prelude.rb
+ prelude.rb
+
+== Class Library
+
+array.c :: Array
+bignum.c :: Bignum
+compar.c :: Comparable
+complex.c :: Complex
+cont.c :: Fiber, Continuation
+dir.c :: Dir
+enum.c :: Enumerable
+enumerator.c :: Enumerator
+file.c :: File
+hash.c :: Hash
+io.c :: IO
+marshal.c :: Marshal
+math.c :: Math
+numeric.c :: Numeric, Integer, Fixnum, Float
+pack.c :: Array#pack, String#unpack
+proc.c :: Binding, Proc
+process.c :: Process
+random.c :: random number
+range.c :: Range
+rational.c :: Rational
+re.c :: Regexp, MatchData
+signal.c :: Signal
+sprintf.c :: String#sprintf
+string.c :: String
+struct.c :: Struct
+time.c :: Time
+
+defs/known_errors.def :: Errno::* exception classes
+-> known_errors.inc :: automatically generated
+
+== Multilingualization
+
+encoding.c :: Encoding
+transcode.c :: Encoding::Converter
+enc/*.c :: encoding classes
+enc/trans/* :: codepoint mapping tables
+
+== goruby Interpreter Implementation
+
+ goruby.c
+ golf_prelude.rb : goruby specific libraries.
+ -> golf_prelude.c : automatically generated
+
+
+= Appendix B. Ruby Extension API Reference
+
+== Types
+
+VALUE ::
+
+ The type for the Ruby object. Actual structures are defined in ruby.h,
+ such as struct RString, etc. To refer the values in structures, use
+ casting macros like RSTRING(obj).
+
+== Variables and Constants
+
+Qnil::
+ nil object
+
+Qtrue::
+ true object (default true value)
+
+Qfalse::
+ false object
+
+== C Pointer Wrapping
+
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
+
+ Wrap a C pointer into a Ruby object. If object has references to other
+ Ruby objects, they should be marked by using the mark function during
+ the GC process. Otherwise, mark should be 0. When this object is no
+ longer referred by anywhere, the pointer will be discarded by free
+ function.
+
+Data_Make_Struct(klass, type, mark, free, sval) ::
+
+ This macro allocates memory using malloc(), assigns it to the variable
+ sval, and returns the DATA encapsulating the pointer to memory region.
+
+Data_Get_Struct(data, type, sval) ::
+
+ This macro retrieves the pointer value from DATA, and assigns it to
+ the variable sval.
+
+== Checking Data Types
+
+TYPE(value) ::
+
+ Internal type (T_NIL, T_FIXNUM, etc.)
+
+FIXNUM_P(value) ::
+
+ Is +value+ a Fixnum?
+
+NIL_P(value) ::
+
+ Is +value+ nil?
+
+void Check_Type(VALUE value, int type) ::
+
+ Ensures +value+ is of the given internal +type+ or raises a TypeError
+
+SaveStringValue(value) ::
+
+ Checks that +value+ is a String and is not tainted
+
+== Data Type Conversion
+
+FIX2INT(value), INT2FIX(i) ::
+
+ Fixnum <-> integer
+
+FIX2LONG(value), LONG2FIX(l) ::
+
+ Fixnum <-> long
+
+NUM2INT(value), INT2NUM(i) ::
+
+ Numeric <-> integer
+
+NUM2UINT(value), UINT2NUM(ui) ::
+
+ Numeric <-> unsigned integer
+
+NUM2LONG(value), LONG2NUM(l) ::
+
+ Numeric <-> long
+
+NUM2ULONG(value), ULONG2NUM(ul) ::
+
+ Numeric <-> unsigned long
+
+NUM2LL(value), LL2NUM(ll) ::
+
+ Numeric <-> long long
+
+NUM2ULL(value), ULL2NUM(ull) ::
+
+ Numeric <-> unsigned long long
+
+NUM2OFFT(value), OFFT2NUM(off) ::
+
+ Numeric <-> off_t
+
+NUM2SIZET(value), SIZET2NUM(size) ::
+
+ Numeric <-> size_t
+
+NUM2SSIZET(value), SSIZET2NUM(ssize) ::
+
+ Numeric <-> ssize_t
+
+rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags) ::
+
+ Numeric <-> Arbitrary size integer buffer
+
+NUM2DBL(value) ::
+
+ Numeric -> double
+
+rb_float_new(f) ::
+
+ double -> Float
+
+StringValue(value) ::
+
+ Object with #to_str -> String
+
+StringValuePtr(value) ::
+
+ Object with #to_str -> pointer to String data
+
+StringValueCStr(value) ::
+
+ Object with #to_str -> pointer to String data without NULL bytes
+
+rb_str_new2(s) ::
+
+ char * -> String
+
+== Defining Class and Module
+
+VALUE rb_define_class(const char *name, VALUE super) ::
+
+ Defines a new Ruby class as a subclass of super.
+
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
+
+ Creates a new Ruby class as a subclass of super, under the module's
+ namespace.
+
+VALUE rb_define_module(const char *name) ::
+
+ Defines a new Ruby module.
+
+VALUE rb_define_module_under(VALUE module, const char *name) ::
+
+ Defines a new Ruby module under the module's namespace.
+
+void rb_include_module(VALUE klass, VALUE module) ::
+
+ Includes module into class. If class already includes it, just ignored.
+
+void rb_extend_object(VALUE object, VALUE module) ::
+
+ Extend the object with the module's attributes.
+
+== Defining Global Variables
+
+void rb_define_variable(const char *name, VALUE *var) ::
+
+ Defines a global variable which is shared between C and Ruby. If name
+ contains a character which is not allowed to be part of the symbol,
+ it can't be seen from Ruby programs.
+
+void rb_define_readonly_variable(const char *name, VALUE *var) ::
+
+ Defines a read-only global variable. Works just like
+ rb_define_variable(), except the defined variable is read-only.
+
+void rb_define_virtual_variable(const char *name, VALUE (*getter)(), VALUE (*setter)()) ::
+
+ Defines a virtual variable, whose behavior is defined by a pair of C
+ functions. The getter function is called when the variable is
+ referenced. The setter function is called when the variable is set to a
+ value. The prototype for getter/setter functions are:
+
+ VALUE getter(ID id)
+ void setter(VALUE val, ID id)
+
+ The getter function must return the value for the access.
+
+void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), VALUE (*setter)()) ::
+
+ Defines hooked variable. It's a virtual variable with a C variable.
+ The getter is called as
+
+ VALUE getter(ID id, VALUE *var)
+
+ returning a new value. The setter is called as
+
+ void setter(VALUE val, ID id, VALUE *var)
+
+ GC requires C global variables which hold Ruby values to be marked.
+
+void rb_global_variable(VALUE *var)
+
+ Tells GC to protect these variables.
+
+== Constant Definition
+
+void rb_define_const(VALUE klass, const char *name, VALUE val) ::
+
+ Defines a new constant under the class/module.
+
+void rb_define_global_const(const char *name, VALUE val) ::
+
+ Defines a global constant. This is just the same as
+
+ rb_define_const(cKernal, name, val)
+
+== Method Definition
+
+rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
+
+ Defines a method for the class. func is the function pointer. argc
+ is the number of arguments. if argc is -1, the function will receive
+ 3 arguments: argc, argv, and self. if argc is -2, the function will
+ receive 2 arguments, self and args, where args is a Ruby array of
+ the method arguments.
+
+rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
+
+ Defines a private method for the class. Arguments are same as
+ rb_define_method().
+
+rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
+
+ Defines a singleton method. Arguments are same as rb_define_method().
+
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
+
+ Retrieve argument from argc and argv to given VALUE references
+ according to the format string. The format can be described in ABNF
+ as follows:
+
+ scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
+
+ param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
+ pre-opt-post-arg-spec
+ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
+ post-arg-spec := sym-for-variable-length-args
+ [num-of-trailing-mandatory-args]
+ pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
+ num-of-trailing-mandatory-args
+ option-hash-arg-spec := sym-for-option-hash-arg
+ block-arg-spec := sym-for-block-arg
+
+ num-of-leading-mandatory-args := DIGIT ; The number of leading
+ ; mandatory arguments
+ num-of-optional-args := DIGIT ; The number of optional
+ ; arguments
+ sym-for-variable-length-args := "*" ; Indicates that variable
+ ; length arguments are
+ ; captured as a ruby array
+ num-of-trailing-mandatory-args := DIGIT ; The number of trailing
+ ; mandatory arguments
+ sym-for-option-hash-arg := ":" ; Indicates that an option
+ ; hash is captured if the last
+ ; argument is a hash or can be
+ ; converted to a hash with
+ ; #to_hash. When the last
+ ; argument is nil, it is
+ ; captured if it is not
+ ; ambiguous to take it as
+ ; empty option hash; i.e. '*'
+ ; is not specified and
+ ; arguments are given more
+ ; than sufficient.
+ sym-for-block-arg := "&" ; Indicates that an iterator
+ ; block should be captured if
+ ; given
+
+ For example, "12" means that the method requires at least one
+ argument, and at most receives three (1+2) arguments. So, the format
+ string must be followed by three variable references, which are to be
+ assigned to captured arguments. For omitted arguments, variables are
+ set to Qnil. NULL can be put in place of a variable reference, which
+ means the corresponding captured argument(s) should be just dropped.
+
+ The number of given arguments, excluding an option hash or iterator
+ block, is returned.
+
+== Invoking Ruby method
+
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
+
+ Invokes a method. To retrieve mid from a method name, use rb_intern().
+ Able to call even private/protected methods.
+
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
+VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ Invokes a method, passing arguments as an array of values.
+ Able to call even private/protected methods.
+
+VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ Invokes a method, passing arguments as an array of values.
+ Able to call only public methods.
+
+VALUE rb_eval_string(const char *str) ::
+
+ Compiles and executes the string as a Ruby program.
+
+ID rb_intern(const char *name) ::
+
+ Returns ID corresponding to the name.
+
+char *rb_id2name(ID id) ::
+
+ Returns the name corresponding ID.
+
+char *rb_class2name(VALUE klass) ::
+
+ Returns the name of the class.
+
+int rb_respond_to(VALUE object, ID id) ::
+
+ Returns true if the object responds to the message specified by id.
+
+== Instance Variables
+
+VALUE rb_iv_get(VALUE obj, const char *name) ::
+
+ Retrieve the value of the instance variable. If the name is not
+ prefixed by `@', that variable shall be inaccessible from Ruby.
+
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
+
+ Sets the value of the instance variable.
+
+== Control Structure
+
+VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
+
+ Calls a method on the recv, with the method name specified by the
+ symbol mid, with argc arguments in argv, supplying func as the
+ block. When func is called as the block, it will receive the value
+ from yield as the first argument, and data2 as the second argument.
+ When yielded with multiple values (in C, rb_yield_values(),
+ rb_yield_values2() and rb_yield_splat()), data2 is packed as an Array,
+ whereas yielded values can be gotten via argc/argv of the third/fourth
+ arguments.
+
+[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2) ::
+
+ Calls the function func1, supplying func2 as the block. func1 will be
+ called with the argument arg1. func2 receives the value from yield as
+ the first argument, arg2 as the second argument.
+
+ When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
+ This function is obsolete since 1.9; use rb_block_call instead.
+
+VALUE rb_yield(VALUE val) ::
+
+ Evaluates the block with value val.
+
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
+
+ Calls the function func1, with arg1 as the argument. If an exception
+ occurs during func1, it calls func2 with arg2 as the argument. The
+ return value of rb_rescue() is the return value from func1 if no
+ exception occurs, from func2 otherwise.
+
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
+
+ Calls the function func1 with arg1 as the argument, then calls func2
+ with arg2 if execution terminated. The return value from
+ rb_ensure() is that of func1 when no exception occurred.
+
+VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
+
+ Calls the function func with arg as the argument. If no exception
+ occurred during func, it returns the result of func and *state is zero.
+ Otherwise, it returns Qnil and sets *state to nonzero. If state is
+ NULL, it is not set in both cases.
+ You have to clear the error info with rb_set_errinfo(Qnil) when
+ ignoring the caught exception.
+
+void rb_jump_tag(int state) ::
+
+ Continues the exception caught by rb_protect() and rb_eval_string_protect().
+ state must be the returned value from those functions. This function
+ never return to the caller.
+
+void rb_iter_break() ::
+
+ Exits from the current innermost block. This function never return to
+ the caller.
+
+void rb_iter_break_value(VALUE value) ::
+
+ Exits from the current innermost block with the value. The block will
+ return the given argument value. This function never return to the
+ caller.
+
+== Exceptions and Errors
+
+void rb_warn(const char *fmt, ...) ::
+
+ Prints a warning message according to a printf-like format.
+
+void rb_warning(const char *fmt, ...) ::
+
+ Prints a warning message according to a printf-like format, if
+ $VERBOSE is true.
+
+void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
+
+ Raises RuntimeError. The fmt is a format string just like printf().
+
+void rb_raise(VALUE exception, const char *fmt, ...) ::
+
+ Raises a class exception. The fmt is a format string just like printf().
+
+void rb_fatal(const char *fmt, ...) ::
+
+ Raises a fatal error, terminates the interpreter. No exception handling
+ will be done for fatal errors, but ensure blocks will be executed.
+
+void rb_bug(const char *fmt, ...) ::
+
+ Terminates the interpreter immediately. This function should be
+ called under the situation caused by the bug in the interpreter. No
+ exception handling nor ensure execution will be done.
+
+Note: In the format string, %i is used for Object#to_s (or Object#inspect if
+'+' flag is set) output (and related argument must be a VALUE). For integers
+in format strings, use %d.
+
+== Initialize and Start the Interpreter
+
+The embedding API functions are below (not needed for extension libraries):
+
+void ruby_init() ::
+
+ Initializes the interpreter.
+
+void ruby_options(int argc, char **argv) ::
+
+ Process command line arguments for the interpreter.
+
+void ruby_run() ::
+
+ Starts execution of the interpreter.
+
+void ruby_script(char *name) ::
+
+ Specifies the name of the script ($0).
+
+== Hooks for the Interpreter Events
+
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data)
+
+Adds a hook function for the specified interpreter events.
+events should be OR'ed value of:
+
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
+
+The definition of rb_event_hook_func_t is below:
+
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
+ VALUE self, ID id, VALUE klass)
+
+The third argument `data' to rb_add_event_hook() is passed to the hook
+function as the second argument, which was the pointer to the current
+NODE in 1.8. See RB_EVENT_HOOKS_HAVE_CALLBACK_DATA below.
+
+ int rb_remove_event_hook(rb_event_hook_func_t func)
+
+Removes the specified hook function.
+
+== Macros for Compatibility
+
+Some macros to check API compatibilities are available by default.
+
+NORETURN_STYLE_NEW ::
+
+ Means that NORETURN macro is functional style instead of prefix.
+
+HAVE_RB_DEFINE_ALLOC_FUNC ::
+
+ Means that function rb_define_alloc_func() is provided, that means the
+ allocation framework is used. This is same as the result of
+ have_func("rb_define_alloc_func", "ruby.h").
+
+HAVE_RB_REG_NEW_STR ::
+
+ Means that function rb_reg_new_str() is provided, that creates Regexp
+ object from String object. This is same as the result of
+ have_func("rb_reg_new_str", "ruby.h").
+
+HAVE_RB_IO_T ::
+
+ Means that type rb_io_t is provided.
+
+USE_SYMBOL_AS_METHOD_NAME ::
+
+ Means that Symbols will be returned as method names, e.g.,
+ Module#methods, #singleton_methods and so on.
+
+HAVE_RUBY_*_H ::
+
+ Defined in ruby.h and means corresponding header is available. For
+ instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
+ mere st.h.
+
+RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
+
+ Means that rb_add_event_hook() takes the third argument `data', to be
+ passed to the given event hook function.
+
+= Appendix C. Functions available for use in extconf.rb
+
+See documentation for {mkmf}[rdoc-ref:MakeMakefile].
+
+/*
+ * Local variables:
+ * fill-column: 70
+ * end:
+ */
diff --git a/README.EXT.ja b/README.EXT.ja
index f884ecbb0e..9bba51a0d0 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -1 +1,1634 @@
-doc/extension.ja.rdocに移動しました
+# README.EXT.ja - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
+
+Rubyの拡張ライブラリの作り方を説明します.
+
+= 基礎知識
+
+Cの変数には型があり,データには型がありません.ですから,た
+とえばポインタをintの変数に代入すると,その値は整数として取
+り扱われます.逆にRubyの変数には型がなく,データに型がありま
+す.この違いのため,CとRubyは相互に変換しなければ,お互いの
+データをアクセスできません.
+
+RubyのデータはVALUEというCの型で表現されます.VALUE型のデー
+タはそのデータタイプを自分で知っています.このデータタイプと
+いうのはデータ(オブジェクト)の実際の構造を意味していて,Ruby
+のクラスとはまた違ったものです.
+
+VALUEからCにとって意味のあるデータを取り出すためには
+
+1. VALUEのデータタイプを知る
+2. VALUEをCのデータに変換する
+
+の両方が必要です.(1)を忘れると間違ったデータの変換が行われ
+て,最悪プログラムがcore dumpします.
+
+== データタイプ
+
+Rubyにはユーザが使う可能性のある以下のタイプがあります.
+
+T_NIL :: nil
+T_OBJECT :: 通常のオブジェクト
+T_CLASS :: クラス
+T_MODULE :: モジュール
+T_FLOAT :: 浮動小数点数
+T_STRING :: 文字列
+T_REGEXP :: 正規表現
+T_ARRAY :: 配列
+T_HASH :: 連想配列
+T_STRUCT :: (Rubyの)構造体
+T_BIGNUM :: 多倍長整数
+T_FIXNUM :: Fixnum(31bitまたは63bit長整数)
+T_COMPLEX :: 複素数
+T_RATIONAL :: 有理数
+T_FILE :: 入出力
+T_TRUE :: 真
+T_FALSE :: 偽
+T_DATA :: データ
+T_SYMBOL :: シンボル
+
+その他に内部で利用されている以下のタイプがあります.
+
+ T_ICLASS
+ T_MATCH
+ T_UNDEF
+ T_NODE
+ T_ZOMBIE
+
+ほとんどのタイプはCの構造体で実装されています.
+
+== VALUEのデータタイプをチェックする
+
+ruby.hではTYPE()というマクロが定義されていて,VALUEのデータ
+タイプを知ることが出来ます.TYPE()マクロは上で紹介したT_XXXX
+の形式の定数を返します.VALUEのデータタイプに応じて処理する
+場合には,TYPE()の値で分岐することになります.
+
+ switch (TYPE(obj)) {
+ case T_FIXNUM:
+ /* FIXNUMの処理 */
+ break;
+ case T_STRING:
+ /* 文字列の処理 */
+ break;
+ case T_ARRAY:
+ /* 配列の処理 */
+ break;
+ default:
+ /* 例外を発生させる */
+ rb_raise(rb_eTypeError, "not valid value");
+ break;
+ }
+
+それとデータタイプをチェックして,正しくなければ例外を発生す
+る関数が用意されています.
+
+ void Check_Type(VALUE value, int type)
+
+この関数はvalueがtypeで無ければ,例外を発生させます.引数と
+して与えられたVALUEのデータタイプが正しいかどうかチェックす
+るためには,この関数を使います.
+
+FIXNUMとNILに関してはより高速な判別マクロが用意されています.
+
+ FIXNUM_P(obj)
+ NIL_P(obj)
+
+== VALUEをCのデータに変換する
+
+データタイプがT_NIL,T_FALSE,T_TRUEである時,データはそれぞ
+れnil,false,trueです.このデータタイプのオブジェクトはひと
+つずつしか存在しません.
+
+データタイプがT_FIXNUMの時,これは31bitまたは63bitのサイズを
+持つ整数です.longのサイズが32bitのプラットフォームであれば
+31bitに,longのサイズが64bitのプラットフォームであれば63bit
+になります. FIXNUM を C の整数に変換するためにはマクロ
+「FIX2INT()」または「FIX2LONG()」を使います.これらのマクロ
+を使用する際には事前にデータタイプがFIXNUMであることを確認す
+る必要がありますが,比較的高速に変換を行うことができます.ま
+た,「FIX2LONG()」は例外を発生しませんが,「FIX2INT()」は変
+換結果がintのサイズに収まらない場合には例外を発生します.
+それから,FIXNUMに限らずRubyのデータを整数に変換する
+「NUM2INT()」および「NUM2LONG()」というマクロがあります.こ
+れらのマクロはマクロはデータタイプのチェック無しで使えます
+(整数に変換できない場合には例外が発生する).同様にチェック無
+で使える変換マクロはdoubleを取り出す「NUM2DBL()」があります.
+
+char* を取り出す場合, StringValue() と StringValuePtr()
+を使います.
+StringValue(var) は var が String
+であれば何もせず,そうでなければ var を var.to_str() の結果
+に置き換えるマクロ,StringValuePtr(var) は同様に var を
+String に置き換えてから var のバイト列表現に対する char* を
+返すマクロです.var の内容を直接置き換える処理が入るので,
+var は lvalue である必要があります.
+また,StringValuePtr() に類似した StringValueCStr() というマ
+クロもあります.StringValueCStr(var) は var を String に置き
+換えてから var の文字列表現に対する char* を返します.返され
+る文字列の末尾には nul 文字が付加されます.なお,途中に nul
+文字が含まれる場合は ArgumentError が発生します.
+一方,StringValuePtr() では,末尾に nul 文字がある保証はなく,
+途中に nul 文字が含まれている可能性もあります.
+
+それ以外のデータタイプは対応するCの構造体があります.対応す
+る構造体のあるVALUEはそのままキャスト(型変換)すれば構造体の
+ポインタに変換できます.
+
+構造体は「struct RXxxxx」という名前でruby.hで定義されていま
+す.例えば文字列は「struct RString」です.実際に使う可能性が
+あるのは文字列と配列くらいだと思います.
+
+ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文
+字にしたもの)という名前で提供されています(例: RSTRING()).た
+だし、構造体への直接のアクセスはできるだけ避け,対応する
+rb_xxxx() といった関数を使うようにして下さい.例えば,配列の
+要素へアクセスする場合は,rb_ary_entry(ary, offset),
+rb_ary_store(ary, offset, obj) を利用するようにして下さい.
+
+構造体からデータを取り出すマクロが提供されています.文字列
+strの長さを得るためには「RSTRING_LEN(str)」とし,文字列strを
+char*として得るためには「RSTRING_PTR(str)」とします.
+
+Rubyの構造体を直接アクセスする時に気をつけなければならないこ
+とは,配列や文字列の構造体の中身は参照するだけで,直接変更し
+ないことです.直接変更した場合,オブジェクトの内容の整合性が
+とれなくなって,思わぬバグの原因になります.
+
+== CのデータをVALUEに変換する
+
+VALUEの実際の構造は
+
+FIXNUMの場合 ::
+
+ 1bit左シフトして,LSBを立てる.
+
+その他のポインタの場合 ::
+
+ そのままVALUEにキャストする.
+
+となっています.よって,LSBをチェックすればVALUEがFIXNUMかど
+うかわかるわけです(ポインタのLSBが立っていないことを仮定して
+いる).
+
+ですから,FIXNUM以外のRubyのオブジェクトの構造体は単にVALUE
+にキャストするだけでVALUEに変換出来ます.ただし,任意の構造
+体がVALUEにキャスト出来るわけではありません.キャストするの
+はRubyの知っている構造体(ruby.hで定義されているstruct RXxxx
+のもの)だけです.
+
+FIXNUMに関しては変換マクロを経由する必要があります.Cの整数
+からVALUEに変換するマクロは以下のものがあります.必要に応じ
+て使い分けてください.
+
+INT2FIX() :: もとの整数が31bitまたは63bit以内に収まる自信
+ がある時
+INT2NUM() :: 任意の整数からVALUEへ
+
+INT2NUM()は整数がFIXNUMの範囲に収まらない場合,Bignumに変換
+してくれます(が,少し遅い).
+
+== Rubyのデータを操作する
+
+先程も述べた通り,Rubyの構造体をアクセスする時に内容の更新を
+行うことは勧められません.で,Rubyのデータを操作する時には
+Rubyが用意している関数を用いてください.
+
+ここではもっとも使われるであろう文字列と配列の生成/操作を行
+う関数をあげます(全部ではないです).
+
+=== 文字列に対する関数
+
+rb_str_new(const char *ptr, long len) ::
+
+ 新しいRubyの文字列を生成する.
+
+rb_str_new2(const char *ptr)
+rb_str_new_cstr(const char *ptr)
+
+ Cの文字列からRubyの文字列を生成する.この関数の機能は
+ rb_str_new(ptr, strlen(ptr))と同等である.
+
+rb_tainted_str_new(const char *ptr, long len)
+
+ 汚染マークが付加された新しいRubyの文字列を生成する.外部
+ からのデータに基づく文字列には汚染マークが付加されるべき
+ である.
+
+rb_tainted_str_new2(const char *ptr)
+rb_tainted_str_new_cstr(const char *ptr)
+
+ Cの文字列から汚染マークが付加されたRubyの文字列を生成する.
+
+rb_sprintf(const char *format, ...)
+rb_vsprintf(const char *format, va_list ap)
+
+ Cの文字列formatと続く引数をprintf(3)のフォーマットにしたがって
+ 整形し,Rubyの文字列を生成する.
+
+ 注意: %iはObject#to_s('+'フラグが指定されているときはObject#inspect)を
+ 使ったVALUEの出力に使用されているため,整数には%dを使用すること.
+
+rb_str_cat(VALUE str, const char *ptr, long len)
+
+ Rubyの文字列strにlenバイトの文字列ptrを追加する.
+
+rb_str_cat2(VALUE str, const char* ptr)
+
+ Rubyの文字列strにCの文字列ptrを追加する.この関数の機能は
+ rb_str_cat(str, ptr, strlen(ptr))と同等である.
+
+rb_str_catf(VALUE str, const char* format, ...)
+rb_str_vcatf(VALUE str, const char* format, va_list ap)
+
+ Cの文字列formatと続く引数をprintf(3)のフォーマットにしたがって
+ 整形し,Rubyの文字列strに追加する.この関数の機能は,それぞれ
+ rb_str_cat2(str, rb_sprintf(format, ...)) や
+ rb_str_cat2(str, rb_vsprintf(format, ap)) と同等である.
+
+rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
+rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc)
+
+ 指定されたエンコーディングでRubyの文字列を生成する.
+
+rb_usascii_str_new(const char *ptr, long len)
+rb_usascii_str_new_cstr(const char *ptr)
+
+ エンコーディングがUS-ASCIIのRubyの文字列を生成する.
+
+rb_str_resize(VALUE str, long len)
+
+ Rubyの文字列のサイズをlenバイトに変更する.strの長さは前
+ 以てセットされていなければならない.lenが元の長さよりも短
+ い時は,lenバイトを越えた部分の内容は捨てられる.lenが元
+ の長さよりも長い時は,元の長さを越えた部分の内容は保存さ
+ れないでゴミになるだろう.この関数の呼び出しによって
+ RSTRING_PTR(str)が変更されるかもしれないことに注意.
+
+rb_str_set_len(VALUE str, long len)
+
+ Rubyの文字列のサイズをlenバイトにセットする.strが変更可
+ 能でなければ例外が発生する.RSTRING_LEN(str)とは無関係に,
+ lenバイトまでの内容は保存される.lenはstrの容量を越えてい
+ てはならない.
+
+
+== 配列に対する関数
+
+rb_ary_new()
+
+ 要素が0の配列を生成する.
+
+rb_ary_new2(long len)
+rb_ary_new_capa(long len)
+
+ 要素が0の配列を生成する.len要素分の領域をあらかじめ割り
+ 当てておく.
+
+rb_ary_new3(long n, ...)
+rb_ary_new_from_args(long n, ...)
+
+ 引数で指定したn要素を含む配列を生成する.
+
+rb_ary_new4(long n, VALUE *elts)
+rb_ary_new_from_values(long n, VALUE *elts)
+
+ 配列で与えたn要素の配列を生成する.
+
+rb_ary_to_ary(VALUE obj)
+
+ オブジェクトを配列に変換する.
+ Object#to_aryと同等である.
+
+他にも配列を操作する関数が多数ある. これらは
+引数aryに配列を渡さなければならない. さもないと
+コアを吐く.
+
+rb_ary_aref(argc, VALUE *argv, VALUE ary)
+
+ Array#[]と同等.
+
+rb_ary_entry(VALUE ary, long offset)
+
+ ary[offset]
+
+rb_ary_store(VALUE ary, long offset, VALUE obj) ::
+
+ ary[offset] = obj
+
+rb_ary_subseq(VALUE ary, long beg, long len)
+
+ ary[beg, len]
+
+rb_ary_push(VALUE ary, VALUE val)
+rb_ary_pop(VALUE ary)
+rb_ary_shift(VALUE ary)
+rb_ary_unshift(VALUE ary, VALUE val)
+
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
+
+ 配列aryにptrからlen個のオブジェクトを追加する.
+
+= Rubyの機能を使う
+
+原理的にRubyで書けることはCでも書けます.RubyそのものがCで記
+述されているんですから,当然といえば当然なんですけど.ここで
+はRubyの拡張に使うことが多いだろうと予測される機能を中心に紹
+介します.
+
+== Rubyに機能を追加する
+
+Rubyで提供されている関数を使えばRubyインタプリタに新しい機能
+を追加することができます.Rubyでは以下の機能を追加する関数が
+提供されています.
+
+* クラス,モジュール
+* メソッド,特異メソッドなど
+* 定数
+
+では順に紹介します.
+
+=== クラス/モジュール定義
+
+クラスやモジュールを定義するためには,以下の関数を使います.
+
+ VALUE rb_define_class(const char *name, VALUE super)
+ VALUE rb_define_module(const char *name)
+
+これらの関数は新しく定義されたクラスやモジュールを返します.
+メソッドや定数の定義にこれらの値が必要なので,ほとんどの場合
+は戻り値を変数に格納しておく必要があるでしょう.
+
+クラスやモジュールを他のクラスの内部にネストして定義する時に
+は以下の関数を使います.
+
+ VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE outer, const char *name)
+
+=== メソッド/特異メソッド定義
+
+メソッドや特異メソッドを定義するには以下の関数を使います.
+
+ void rb_define_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+
+ void rb_define_singleton_method(VALUE object, const char *name,
+ VALUE (*func)(), int argc)
+
+
+念のため説明すると「特異メソッド」とは,その特定のオブジェク
+トに対してだけ有効なメソッドです.RubyではよくSmalltalkにお
+けるクラスメソッドとして,クラスに対する特異メソッドが使われ
+ます.
+
+これらの関数の argcという引数はCの関数へ渡される引数の数(と
+形式)を決めます.argcが0以上の時は関数に引き渡す引数の数を意
+味します.16個以上の引数は使えません(が,要りませんよね,そ
+んなに).実際の関数には先頭の引数としてselfが与えられますの
+で,指定した数より1多い引数を持つことになります.
+
+argcが負の時は引数の数ではなく,形式を指定したことになります.
+argcが-1の時は引数を配列に入れて渡されます.argcが-2の時は引
+数はRubyの配列として渡されます.
+
+メソッドを定義する関数はまだいくつかあります. ひとつはメソッド
+名としてIDを取ります. IDについては2.2.2を参照.
+
+ void rb_define_method_id(VALUE klass, ID name,
+ VALUE (*func)(ANYARGS), int argc)
+
+private/protectedなメソッドを定義するふたつの関数があります.
+
+ void rb_define_private_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+ void rb_define_protected_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+
+privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ
+ドです.
+
+最後に, rb_define_module関数はモジュール関数を定義します.
+モジュール関数とはモジュールの特異メソッドであり,同時に
+privateメソッドでもあるものです.例をあげるとMathモジュール
+のsqrt()などがあげられます.このメソッドは
+
+ Math.sqrt(4)
+
+という形式でも
+
+ include Math
+ sqrt(4)
+
+という形式でも使えます.モジュール関数を定義する関数は以下の
+通りです.
+
+ void rb_define_module_function(VALUE module, const char *name,
+ VALUE (*func)(), int argc)
+
+関数的メソッド(Kernelモジュールのprivate method)を定義するた
+めの関数は以下の通りです.
+
+ void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
+
+
+メソッドの別名を定義するための関数は以下の通りです.
+
+ void rb_define_alias(VALUE module, const char* new, const char* old);
+
+属性の取得・設定メソッドを定義するには
+
+ void rb_define_attr(VALUE klass, const char *name, int read, int write)
+
+クラスメソッドallocateを定義したり削除したりするための関数は
+以下の通りです.
+
+ void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
+ void rb_undef_alloc_func(VALUE klass);
+
+funcはクラスを引数として受け取って,新しく割り当てられたイン
+スタンスを返さなくてはなりません.このインスタンスは,外部リ
+ソースなどを含まない,できるだけ「空」のままにしておいたほう
+がよいでしょう.
+
+=== 定数定義
+
+拡張ライブラリが必要な定数はあらかじめ定義しておいた方が良い
+でしょう.定数を定義する関数は二つあります.
+
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
+
+前者は特定のクラス/モジュールに属する定数を定義するもの,後
+者はグローバルな定数を定義するものです.
+
+== Rubyの機能をCから呼び出す
+
+既に『1.5 Rubyのデータを操作する』で一部紹介したような関数を
+使えば,Rubyの機能を実現している関数を直接呼び出すことが出来
+ます.
+
+# このような関数の一覧表はいまのところありません.ソースを見
+# るしかないですね.
+
+それ以外にもRubyの機能を呼び出す方法はいくつかあります.
+
+=== Rubyのプログラムをevalする
+
+CからRubyの機能を呼び出すもっとも簡単な方法として,文字列で
+与えられたRubyのプログラムを評価する以下の関数があります.
+
+ VALUE rb_eval_string(const char *str)
+
+この評価は現在の環境で行われます.つまり,現在のローカル変数
+などを受け継ぎます.
+
+評価は例外を発生するかもしれないことに注意しましょう. より安全
+な関数もあります.
+
+ VALUE rb_eval_string_protect(const char *str, int *state)
+
+この関数はエラーが発生するとnilを返します.そして,成功時には
+*stateはゼロに,さもなくば非ゼロになります.
+
+=== IDまたはシンボル
+
+Cから文字列を経由せずにRubyのメソッドを呼び出すこともできま
+す.その前に,Rubyインタプリタ内でメソッドや変数名を指定する
+時に使われているIDについて説明しておきましょう.
+
+IDとは変数名,メソッド名を表す整数です.Rubyの中では
+
+ :識別子
+
+または
+
+ :"任意の文字列"
+
+でアクセスできます.Cからこの整数を得るためには関数
+
+ rb_intern(const char *name)
+ rb_intern_str(VALUE name)
+
+を使います.Rubyから引数として与えられたシンボル(または文字
+列)をIDに変換するには以下の関数を使います.
+
+ rb_to_id(VALUE symbol)
+ rb_check_id(volatile VALUE *name)
+ rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
+
+もし引数がシンボルでも文字列でもなければ、to_strメソッドで文
+字列に変換しようとします.第二の関数はその変換結果を*nameに保
+存し,その名前が既知のシンボルでない場合は0を返します.この関
+数が0以外を返した場合は*nameは常にシンボルか文字列であり、0を
+返した場合は常に文字列です.第三の関数はRubyの文字列ではなく
+NUL終端されたCの文字列を使います.
+
+=== CからRubyのメソッドを呼び出す
+
+Cから文字列を経由せずにRubyのメソッドを呼び出すためには以下
+の関数を使います.
+
+ VALUE rb_funcall(VALUE recv, ID mid, int argc, ...)
+
+この関数はオブジェクトrecvのmidで指定されるメソッドを呼び出
+します.その他に引数の指定の仕方が違う以下の関数もあります.
+
+ VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+ VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv)
+ VALUE rb_apply(VALUE recv, ID mid, VALUE args)
+
+applyには引数としてRubyの配列を与えます.
+
+=== 変数/定数を参照/更新する
+
+Cから関数を使って参照・更新できるのは,定数,インスタンス変
+数です.大域変数は一部のものはCの大域変数としてアクセスでき
+ます.ローカル変数を参照する方法は公開していません.
+
+オブジェクトのインスタンス変数を参照・更新する関数は以下の通
+りです.
+
+ VALUE rb_ivar_get(VALUE obj, ID id)
+ VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
+
+idはrb_intern()で得られるものを使ってください.
+
+定数を参照するには以下の関数を使ってください.
+
+ VALUE rb_const_get(VALUE obj, ID id)
+
+定数を新しく定義するためには『2.1.3 定数定義』で紹介さ
+れている関数を使ってください.
+
+= RubyとCとの情報共有
+
+C言語とRubyの間で情報を共有する方法について解説します.
+
+== Cから参照できるRubyの定数
+
+以下のRubyの定数はCのレベルから参照できます.
+
+ Qtrue
+ Qfalse
+
+真偽値.QfalseはC言語でも偽とみなされます(つまり0).
+
+ Qnil
+
+C言語から見た「nil」.
+
+== CとRubyで共有される大域変数
+
+CとRubyで大域変数を使って情報を共有できます.共有できる大域
+変数にはいくつかの種類があります.そのなかでもっとも良く使わ
+れると思われるのはrb_define_variable()です.
+
+ void rb_define_variable(const char *name, VALUE *var)
+
+この関数はRubyとCとで共有する大域変数を定義します.変数名が
+`$'で始まらない時には自動的に追加されます.この変数の値を変
+更すると自動的にRubyの対応する変数の値も変わります.
+
+またRuby側からは更新できない変数もあります.このread onlyの
+変数は以下の関数で定義します.
+
+ void rb_define_readonly_variable(const char *name, VALUE *var)
+
+これら変数の他にhookをつけた大域変数を定義できます.hook付き
+の大域変数は以下の関数を用いて定義します.hook付き大域変数の
+値の参照や設定はhookで行う必要があります.
+
+ void rb_define_hooked_variable(const char *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
+
+この関数はCの関数によってhookのつけられた大域変数を定義しま
+す.変数が参照された時には関数getterが,変数に値がセットされ
+た時には関数setterが呼ばれる.hookを指定しない場合はgetterや
+setterに0を指定します.
+# getterもsetterも0ならばrb_define_variable()と同じになる.
+
+getterとsetterの仕様は次の通りです.
+
+ VALUE (*getter)(ID id, VALUE *var);
+ void (*setter)(VALUE val, ID id, VALUE *var);
+
+
+それから,対応するCの変数を持たないRubyの大域変数を定義する
+こともできます. その変数の値はフック関数のみによって取得・設定
+されます.
+
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
+
+この関数によって定義されたRubyの大域変数が参照された時には
+getterが,変数に値がセットされた時にはsetterが呼ばれます.
+
+getterとsetterの仕様は以下の通りです.
+
+ (*getter)(ID id);
+ (*setter)(VALUE val, ID id);
+
+== CのデータをRubyオブジェクトにする
+
+Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして
+取り扱いたい場合がありえます.このような場合には,Dataという
+RubyオブジェクトにCの構造体(へのポインタ)をくるむことでRuby
+オブジェクトとして取り扱えるようになります.
+
+Dataオブジェクトを生成して構造体をRubyオブジェクトにカプセル
+化するためには,以下のマクロを使います.
+
+ Data_Wrap_Struct(klass, mark, free, sval)
+
+このマクロの戻り値は生成されたDataオブジェクトです.
+
+klassはこのDataオブジェクトのクラスです.markはこの構造体が
+Rubyのオブジェクトへの参照がある時に使う関数です.そのような
+参照を含まない時には0を指定します.
+
+# そのような参照は勧められません.
+
+freeはこの構造体がもう不要になった時に呼ばれる関数です.この
+関数がガーベージコレクタから呼ばれます.これが-1の場合は,単
+純に開放されます.
+
+markおよびfree関数はGC実行中に呼び出されます.
+なお, GC実行中はRubyオブジェクトのアロケーションは禁止されま
+す. よって, markおよびfree関数でRubyオブジェクトのアロケーシ
+ョンは行わないでください.
+
+Cの構造体の割当とDataオブジェクトの生成を同時に行うマクロと
+して以下のものが提供されています.
+
+ Data_Make_Struct(klass, type, mark, free, sval)
+
+このマクロの戻り値は生成されたDataオブジェクトです.このマク
+ロは以下の式のように働きます:
+
+ (sval = ALLOC(type), Data_Wrap_Struct(klass, mark, free, sval))
+
+klass, mark, freeはData_Wrap_Structと同じ働きをします.type
+は割り当てるC構造体の型です.割り当てられた構造体は変数sval
+に代入されます.この変数の型は (type*) である必要があります.
+
+Dataオブジェクトからポインタを取り出すのは以下のマクロを用い
+ます.
+
+ Data_Get_Struct(obj, type, sval)
+
+Cの構造体へのポインタは変数svalに代入されます.
+
+これらのDataの使い方はちょっと分かりにくいので,後で説明する
+例題を参照してください.
+
+= 例題 - dbmパッケージを作る
+
+ここまでの説明でとりあえず拡張ライブラリは作れるはずです.
+Rubyのextディレクトリにすでに含まれているdbmライブラリを例に
+して段階的に説明します.
+
+== ディレクトリを作る
+
+ % mkdir ext/dbm
+
+Ruby 1.1からは任意のディレクトリでダイナミックライブラリを作
+ることができるようになりました.Rubyに静的にリンクする場合に
+はRubyを展開したディレクトリの下,extディレクトリの中に拡張
+ライブラリ用のディレクトリを作る必要があります.名前は適当に
+選んで構いません.
+
+== 設計する
+
+まあ,当然なんですけど,どういう機能を実現するかどうかまず設
+計する必要があります.どんなクラスをつくるか,そのクラスには
+どんなメソッドがあるか,クラスが提供する定数などについて設計
+します.
+
+== Cコードを書く
+
+拡張ライブラリ本体となるC言語のソースを書きます.C言語のソー
+スがひとつの時には「ライブラリ名.c」を選ぶと良いでしょう.C
+言語のソースが複数の場合には逆に「ライブラリ名.c」というファ
+イル名は避ける必要があります.オブジェクトファイルとモジュー
+ル生成時に中間的に生成される「ライブラリ名.o」というファイル
+とが衝突するからです.また,後述する mkmf ライブラリのいくつ
+かの関数がコンパイルを要するテストのために「conftest.c」とい
+うファイル名を使用することに注意してください.ソースファイル
+名として「conftest.c」を使用してはなりません.
+
+Rubyは拡張ライブラリをロードする時に「Init_ライブラリ名」と
+いう関数を自動的に実行します.dbmライブラリの場合「Init_dbm」
+です.この関数の中でクラス,モジュール,メソッド,定数などの
+定義を行います.dbm.cから一部引用します.
+
+ void
+ Init_dbm(void)
+ {
+ /* DBMクラスを定義する */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBMはEnumerateモジュールをインクルードする */
+ rb_include_module(cDBM, rb_mEnumerable);
+
+ /* DBMクラスのクラスメソッドopen(): 引数はCの配列で受ける */
+ rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
+
+ /* DBMクラスのメソッドclose(): 引数はなし */
+ rb_define_method(cDBM, "close", fdbm_close, 0);
+ /* DBMクラスのメソッド[]: 引数は1個 */
+ rb_define_method(cDBM, "[]", fdbm_fetch, 1);
+
+ /* ... */
+
+ /* DBMデータを格納するインスタンス変数名のためのID */
+ id_dbm = rb_intern("dbm");
+ }
+
+DBMライブラリはdbmのデータと対応するオブジェクトになるはずで
+すから,Cの世界のdbmをRubyの世界に取り込む必要があります.
+
+dbm.cではData_Make_Structを以下のように使っています.
+
+ struct dbmdata {
+ int di_size;
+ DBM *di_dbm;
+ };
+
+
+ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
+
+ここではdbmstruct構造体へのポインタをDataにカプセル化してい
+ます.DBM*を直接カプセル化しないのはclose()した時の処理を考
+えてのことです.
+
+Dataオブジェクトからdbmstruct構造体のポインタを取り出すため
+に以下のマクロを使っています.
+
+ #define GetDBM(obj, dbmp) {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+ }
+
+ちょっと複雑なマクロですが,要するにdbmdata構造体のポインタ
+の取り出しと,closeされているかどうかのチェックをまとめてい
+るだけです.
+
+DBMクラスにはたくさんメソッドがありますが,分類すると3種類の
+引数の受け方があります.ひとつは引数の数が固定のもので,例と
+してはdeleteメソッドがあります.deleteメソッドを実装している
+fdbm_delete()はこのようになっています.
+
+ static VALUE
+ fdbm_delete(VALUE obj, VALUE keystr)
+ {
+ /* ... */
+ }
+
+引数の数が固定のタイプは第1引数がself,第2引数以降がメソッド
+の引数となります.
+
+引数の数が不定のものはCの配列で受けるものとRubyの配列で受け
+るものとがあります.dbmライブラリの中で,Cの配列で受けるもの
+はDBMのクラスメソッドであるopen()です.これを実装している関
+数fdbm_s_open()はこうなっています.
+
+ static VALUE
+ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
+ {
+ /* ... */
+
+ if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ mode = 0666; /* default value */
+ }
+
+ /* ... */
+ }
+
+このタイプの関数は第1引数が与えられた引数の数,第2引数が与え
+られた引数の入っている配列になります.selfは第3引数として与
+えられます.
+
+この配列で与えられた引数を解析するための関数がopen()でも使わ
+れているrb_scan_args()です.第3引数に指定したフォーマットに従
+い,第4変数以降に指定したVALUEへの参照に値を代入してくれま
+す.
+
+
+引数をRubyの配列として受け取るメソッドの例には
+Thread#initializeがあります.実装はこうです.
+
+ static VALUE
+ thread_initialize(VALUE thread, VALUE args)
+ {
+ /* ... */
+ }
+
+第1引数はself,第2引数はRubyの配列です.
+
+*注意事項*
+
+Rubyと共有はしないがRubyのオブジェクトを格納する可能性のある
+Cの大域変数は以下の関数を使ってRubyインタプリタに変数の存在
+を教えてあげてください.でないとGCでトラブルを起こします.
+
+ void rb_global_variable(VALUE *var)
+
+== extconf.rbを用意する
+
+Makefileを作る場合の雛型になるextconf.rbというファイルを作り
+ます.extconf.rbはライブラリのコンパイルに必要な条件のチェッ
+クなどを行うことが目的です.まず,
+
+ require 'mkmf'
+
+をextconf.rbの先頭に置きます.extconf.rbの中では以下のRuby関
+数を使うことが出来ます.
+
+ have_library(lib, func): ライブラリの存在チェック
+ have_func(func, header): 関数の存在チェック
+ have_header(header): ヘッダファイルの存在チェック
+ create_makefile(target[, target_prefix]): Makefileの生成
+
+以下の変数を使うことができます.
+
+ $CFLAGS: コンパイル時に追加的に指定するフラグ(-Oなど)
+ $CPPFLAGS: プリプロセッサに追加的に指定するフラグ(-Iや-Dなど)
+ $LDFLAGS: リンク時に追加的に指定するフラグ(-Lなど)
+ $objs: リンクされるオブジェクトファイル名のリスト
+
+オブジェクトファイルのリストは,通常はソースファイルを検索し
+て自動的に生成されますが,makeの途中でソースを生成するような
+場合は明示的に指定する必要があります.
+
+ライブラリをコンパイルする条件が揃わず,そのライブラリをコン
+パイルしない時にはcreate_makefileを呼ばなければMakefileは生
+成されず,コンパイルも行われません.
+
+== dependを用意する
+
+もし,ディレクトリにdependというファイルが存在すれば,
+Makefileが依存関係をチェックしてくれます.
+
+ % gcc -MM *.c > depend
+
+などで作ることが出来ます.あって損は無いでしょう.
+
+== Makefileを生成する
+
+Makefileを実際に生成するためには
+
+ ruby extconf.rb
+
+とします.extconf.rbに require 'mkmf' の行がない場合にはエラー
+になりますので,引数を追加して
+
+ ruby -r mkmf extconf.rb
+
+としてください.
+
+site_ruby ディレクトリでなく,
+vendor_ruby ディレクトリにインストールする場合には
+以下のように --vendor オプションを加えてください.
+
+ ruby extconf.rb --vendor
+
+ディレクトリをext以下に用意した場合にはRuby全体のmakeの時に
+自動的にMakefileが生成されますので,このステップは不要です.
+
+== makeする
+
+動的リンクライブラリを生成する場合にはその場でmakeしてくださ
+い.必要であれば make install でインストールされます.
+
+ext以下にディレクトリを用意した場合は,Rubyのディレクトリで
+makeを実行するとMakefileを生成からmake,必要によってはそのモ
+ジュールのRubyへのリンクまで自動的に実行してくれます.
+extconf.rbを書き換えるなどしてMakefileの再生成が必要な時はま
+たRubyディレクトリでmakeしてください.
+
+拡張ライブラリはmake installでRubyライブラリのディレクトリの
+下にコピーされます.もし拡張ライブラリと協調して使うRubyで記
+述されたプログラムがあり,Rubyライブラリに置きたい場合には,
+拡張ライブラリ用のディレクトリの下に lib というディレクトリ
+を作り,そこに 拡張子 .rb のファイルを置いておけば同時にイン
+ストールされます.
+
+== デバッグ
+
+まあ,デバッグしないと動かないでしょうね.ext/Setupにディレ
+クトリ名を書くと静的にリンクするのでデバッガが使えるようにな
+ります.その分コンパイルが遅くなりますけど.
+
+== できあがり
+
+後はこっそり使うなり,広く公開するなり,売るなり,ご自由にお
+使いください.Rubyの作者は拡張ライブラリに関して一切の権利を
+主張しません.
+
+= Appendix A. Rubyのソースコードの分類
+
+Rubyのソースはいくつかに分類することが出来ます.このうちクラ
+スライブラリの部分は基本的に拡張ライブラリと同じ作り方になっ
+ています.これらのソースは今までの説明でほとんど理解できると
+思います.
+
+== Ruby言語のコア
+
+class.c :: クラスとモジュール
+error.c :: 例外クラスと例外機構
+gc.c :: 記憶領域管理
+load.c :: ライブラリのロード
+object.c :: オブジェクト
+variable.c :: 変数と定数
+
+== Rubyの構文解析器
+
+ parse.y : 字句解析器と構文定義
+ -> parse.c : 自動生成
+ keywords : 予約語
+ -> lex.c : 自動生成
+
+== Rubyの評価器 (通称YARV)
+ compile.c
+ eval.c
+ eval_error.c
+ eval_jump.c
+ eval_safe.c
+ insns.def : 仮想機械語の定義
+ iseq.c : VM::ISeqの実装
+ thread.c : スレッド管理とコンテキスト切り替え
+ thread_win32.c : スレッド実装
+ thread_pthread.c : 同上
+ vm.c
+ vm_dump.c
+ vm_eval.c
+ vm_exec.c
+ vm_insnhelper.c
+ vm_method.c
+
+ opt_insns_unif.def : 命令融合
+ opt_operand.def : 最適化のための定義
+
+ -> insn*.inc : 自動生成
+ -> opt*.inc : 自動生成
+ -> vm.inc : 自動生成
+
+== 正規表現エンジン (鬼車)
+
+ regex.c
+ regcomp.c
+ regenc.c
+ regerror.c
+ regexec.c
+ regparse.c
+ regsyntax.c
+
+== ユーティリティ関数
+
+debug.c :: Cデバッガ用のデバッグシンボル
+dln.c :: 動的ローディング
+st.c :: 汎用ハッシュ表
+strftime.c :: 時刻整形
+util.c :: その他のユーティリティ
+
+== Rubyコマンドの実装
+
+ dmyext.c
+ dmydln.c
+ dmyencoding.c
+ id.c
+ inits.c
+ main.c
+ ruby.c
+ version.c
+
+ gem_prelude.rb
+ prelude.rb
+
+== クラスライブラリ
+
+array.c :: Array
+bignum.c :: Bignum
+compar.c :: Comparable
+complex.c :: Complex
+cont.c :: Fiber, Continuation
+dir.c :: Dir
+enum.c :: Enumerable
+enumerator.c :: Enumerator
+file.c :: File
+hash.c :: Hash
+io.c :: IO
+marshal.c :: Marshal
+math.c :: Math
+numeric.c :: Numeric, Integer, Fixnum, Float
+pack.c :: Array#pack, String#unpack
+proc.c :: Binding, Proc
+process.c :: Process
+random.c :: 乱数
+range.c :: Range
+rational.c :: Rational
+re.c :: Regexp, MatchData
+signal.c :: Signal
+sprintf.c :: String#sprintf
+string.c :: String
+struct.c :: Struct
+time.c :: Time
+defs/known_errors.def :: 例外クラス Errno::*
+-> known_errors.inc :: 自動生成
+
+== 多言語化
+
+encoding.c :: Encoding
+transcode.c :: Encoding::Converter
+enc/*.c :: エンコーディングクラス群
+enc/trans/* :: コードポイント対応表
+
+== gorubyコマンドの実装
+
+ goruby.c
+ golf_prelude.rb : goruby固有のライブラリ
+ -> golf_prelude.c : 自動生成
+
+= Appendix B. 拡張用関数リファレンス
+
+C言語からRubyの機能を利用するAPIは以下の通りである.
+
+== 型
+
+VALUE ::
+
+ Rubyオブジェクトを表現する型.必要に応じてキャストして用いる.
+ 組み込み型を表現するCの型はruby.hに記述してあるRで始まる構造
+ 体である.VALUE型をこれらにキャストするためにRで始まる構造体
+ 名を全て大文字にした名前のマクロが用意されている.
+
+== 変数・定数
+
+Qnil ::
+
+ 定数: nilオブジェクト
+
+Qtrue ::
+
+ 定数: trueオブジェクト(真のデフォルト値)
+
+Qfalse ::
+
+ 定数: falseオブジェクト
+
+== Cデータのカプセル化
+
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
+
+ Cの任意のポインタをカプセル化したRubyオブジェクトを返す.こ
+ のポインタがRubyからアクセスされなくなった時,freeで指定した
+ 関数が呼ばれる.また,このポインタの指すデータが他のRubyオブ
+ ジェクトを指している場合,markに指定する関数でマークする必要
+ がある.
+
+Data_Make_Struct(klass, type, mark, free, sval) ::
+
+ type型のメモリをmallocし,変数svalに代入した後,それをカプセ
+ ル化したデータを返すマクロ.
+
+Data_Get_Struct(data, type, sval) ::
+
+ dataからtype型のポインタを取り出し変数svalに代入するマクロ.
+
+== 型チェック
+
+ TYPE(value)
+ FIXNUM_P(value)
+ NIL_P(value)
+ void Check_Type(VALUE value, int type)
+ SafeStringValue(value)
+
+== 型変換
+
+ FIX2INT(value), INT2FIX(i)
+ FIX2LONG(value), LONG2FIX(l)
+ NUM2INT(value), INT2NUM(i)
+ NUM2UINT(value), UINT2NUM(ui)
+ NUM2LONG(value), LONG2NUM(l)
+ NUM2ULONG(value), ULONG2NUM(ul)
+ NUM2LL(value), LL2NUM(ll)
+ NUM2ULL(value), ULL2NUM(ull)
+ NUM2OFFT(value), OFFT2NUM(off)
+ NUM2SIZET(value), SIZET2NUM(size)
+ NUM2SSIZET(value), SSIZET2NUM(ssize)
+ rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags)
+ NUM2DBL(value)
+ rb_float_new(f)
+ StringValue(value)
+ StringValuePtr(value)
+ StringValueCStr(value)
+ rb_str_new2(s)
+
+== クラス/モジュール定義
+
+VALUE rb_define_class(const char *name, VALUE super) ::
+
+ superのサブクラスとして新しいRubyクラスを定義する.
+
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
+
+ superのサブクラスとして新しいRubyクラスを定義し,moduleの
+ 定数として定義する.
+
+VALUE rb_define_module(const char *name) ::
+
+ 新しいRubyモジュールを定義する.
+
+VALUE rb_define_module_under(VALUE module, const char *name) ::
+
+ 新しいRubyモジュールを定義し,moduleの定数として定義する.
+
+void rb_include_module(VALUE klass, VALUE module) ::
+
+ モジュールをインクルードする.classがすでにmoduleをインク
+ ルードしている時には何もしない(多重インクルードの禁止).
+
+void rb_extend_object(VALUE object, VALUE module) ::
+
+ オブジェクトをモジュール(で定義されているメソッド)で拡張する.
+
+== 大域変数定義
+
+void rb_define_variable(const char *name, VALUE *var) ::
+
+ RubyとCとで共有するグローバル変数を定義する.変数名が`$'で
+ 始まらない時には自動的に追加される.nameとしてRubyの識別子
+ として許されない文字(例えば` ')を含む場合にはRubyプログラ
+ ムからは見えなくなる.
+
+void rb_define_readonly_variable(const char *name, VALUE *var) ::
+
+ RubyとCとで共有するread onlyのグローバル変数を定義する.
+ read onlyであること以外はrb_define_variable()と同じ.
+
+void rb_define_virtual_variable(const char *name, VALUE (*getter)(), void (*setter)()) ::
+
+ 関数によって実現されるRuby変数を定義する.変数が参照された
+ 時にはgetterが,変数に値がセットされた時にはsetterが呼ばれ
+ る.
+
+void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), void (*setter)()) ::
+
+ 関数によってhookのつけられたグローバル変数を定義する.変数
+ が参照された時にはgetterが,関数に値がセットされた時には
+ setterが呼ばれる.getterやsetterに0を指定した時にはhookを
+ 指定しないのと同じ事になる.
+
+void rb_global_variable(VALUE *var)
+
+ GCのため,Rubyプログラムからはアクセスされないが, Rubyオブ
+ ジェクトを含む大域変数をマークする.
+
+== 定数
+
+void rb_define_const(VALUE klass, const char *name, VALUE val) ::
+
+ 定数を定義する.
+
+void rb_define_global_const(const char *name, VALUE val) ::
+
+ 大域定数を定義する.
+
+ rb_define_const(rb_cObject, name, val)
+
+ と同じ意味.
+
+== メソッド定義
+
+rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
+
+ メソッドを定義する.argcはselfを除く引数の数.argcが-1の時,
+ 関数には引数の数(selfを含まない)を第1引数, 引数の配列を第2
+ 引数とする形式で与えられる(第3引数はself).argcが-2の時,
+ 第1引数がself, 第2引数がargs(argsは引数を含むRubyの配列)と
+ いう形式で与えられる.
+
+rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
+
+ privateメソッドを定義する.引数はrb_define_method()と同じ.
+
+rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
+
+ 特異メソッドを定義する.引数はrb_define_method()と同じ.
+
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
+
+ argc, argv形式で与えられた指定されたフォーマットに従って引
+ 数を分解し,続くVALUEへの参照にセットします.このフォーマッ
+ トは,ABNFで記述すると以下の通りです.
+
+ scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
+
+ param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
+ pre-opt-post-arg-spec
+ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
+ post-arg-spec := sym-for-variable-length-args
+ [num-of-trailing-mandatory-args]
+ pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
+ num-of-trailing-mandatory-args
+ option-hash-arg-spec := sym-for-option-hash-arg
+ block-arg-spec := sym-for-block-arg
+
+ num-of-leading-mandatory-args := DIGIT ; 先頭に置かれる省略不能な引数の数
+ num-of-optional-args := DIGIT ; 続いて置かれる省略可能な引数の数
+ sym-for-variable-length-args := "*" ; 続いて置かれる可変長引数を
+ ; Rubyの配列で取得するための指定
+ num-of-trailing-mandatory-args := DIGIT ; 終端に置かれる省略不能な引数の数
+ sym-for-option-hash-arg := ":" ; オプションハッシュを取得する
+ ; ための指定; 省略不能な引数の
+ ; 数よりも多くの引数が指定され,
+ ; 最後の引数がハッシュ(または
+ ; #to_hashで変換可能)の場合に
+ ; 取得される.最後の引数がnilの
+ ; 場合,可変長引数指定がなく,
+ ; 省略不能引数の数よりも多くの
+ ; 引数が指定された場合に取得される
+ sym-for-block-arg := "&" ; イテレータブロックを取得するための
+ ; 指定
+
+ フォーマットが"12"の場合,引数は最低1つで,3つ(1+2)まで許さ
+ れるという意味になります.従って,フォーマット文字列に続い
+ て3つのVALUEへの参照を置く必要があります.それらには取得した
+ 変数がセットされます.変数への参照の代わりにNULLを指定する
+ こともでき,その場合は取得した引数の値は捨てられます.なお,
+ 省略可能引数が省略された時の変数の値はnil(C言語のレベルでは
+ Qnil)になります.
+
+ 返り値は与えられた引数の数です.オプションハッシュおよびイ
+ テレータブロックは数えません.
+
+== Rubyメソッド呼び出し
+
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
+
+ メソッド呼び出し.文字列からmidを得るためにはrb_intern()を
+ 使う.
+ private/protectedなメソッドでも呼び出せる.
+
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
+VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ メソッド呼び出し.引数をargc, argv形式で渡す.
+ private/protectedなメソッドでも呼び出せる.
+
+VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
+
+ メソッド呼び出し.
+ publicなメソッドしか呼べない.
+
+VALUE rb_eval_string(const char *str)
+
+ 文字列をRubyスクリプトとしてコンパイル・実行する.
+
+ID rb_intern(const char *name) ::
+
+ 文字列に対応するIDを返す.
+
+char *rb_id2name(ID id) ::
+
+ IDに対応する文字列を返す(デバッグ用).
+
+char *rb_class2name(VALUE klass) ::
+
+ クラスの名前を返す(デバッグ用).クラスが名前を持たない時に
+ は, 祖先を遡って名前を持つクラスの名前を返す.
+
+int rb_respond_to(VALUE obj, ID id) ::
+
+ objがidで示されるメソッドを持つかどうかを返す.
+
+== インスタンス変数
+
+VALUE rb_iv_get(VALUE obj, const char *name) ::
+
+ objのインスタンス変数の値を得る.`@'で始まらないインスタン
+ ス変数は Rubyプログラムからアクセスできない「隠れた」イン
+ スタンス変数になる.定数は大文字の名前を持つクラス(または
+ モジュール)のインスタンス変数として実装されている.
+
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
+
+ objのインスタンス変数をvalにセットする.
+
+== 制御構造
+
+VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
+
+ funcをブロックとして設定し,objをレシーバ,argcとargvを引数
+ としてmidメソッドを呼び出す.funcは第一引数にyieldされた値,
+ 第二引数にdata2を受け取る.複数の値がyieldされた場合(Cでは
+ rb_yield_values()とrb_yield_values2(), rb_yield_splat()),
+ data2はArrayとしてパックされている.第三, 第四引数のargcと
+ argvによってyieldされた値を取り出すことができる.
+
+[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
+
+ func2をブロックとして設定し, func1をイテレータとして呼ぶ.
+ func1には arg1が引数として渡され, func2には第1引数にイテレー
+ タから与えられた値, 第2引数にarg2が渡される.
+
+ 1.9でrb_iterateを使う場合は, func1の中でRubyレベルのメソッド
+ を呼び出さなければならない.
+ 1.9でobsoleteとなった. 代わりにrb_block_callが用意された.
+
+VALUE rb_yield(VALUE val) ::
+
+ valを値としてイテレータブロックを呼び出す.
+
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
+
+ 関数func1をarg1を引数に呼び出す.func1の実行中に例外が発生
+ した時には func2をarg2を引数として呼ぶ.戻り値は例外が発生
+ しなかった時はfunc1の戻り値, 例外が発生した時にはfunc2の戻
+ り値である.
+
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
+
+ 関数func1をarg1を引数として実行し, 実行終了後(たとえ例外が
+ 発生しても) func2をarg2を引数として実行する.戻り値はfunc1
+ の戻り値である(例外が発生した時は戻らない).
+
+VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
+
+ 関数funcをargを引数として実行し, 例外が発生しなければその戻
+ り値を返す.例外が発生した場合は, *stateに非0をセットして
+ Qnilを返す.
+ rb_jump_tag()を呼ばずに捕捉した例外を無視する場合には,
+ rb_set_errinfo(Qnil)でエラー情報をクリアしなければならない.
+
+void rb_jump_tag(int state) ::
+
+ rb_protect()やrb_eval_string_protect()で捕捉された例外を再
+ 送する.stateはそれらの関数から返された値でなければならない.
+ この関数は直接の呼び出し元に戻らない.
+
+void rb_iter_break() ::
+
+ 現在の最も内側のブロックを終了する.この関数は直接の呼び出
+ し元に戻らない.
+
+void rb_iter_break_value(VALUE value) ::
+
+ 現在の最も内側のブロックをvalueで終了する.ブロックは引数で
+ 与えられたvalueを返す.この関数は直接の呼び出し元に戻らない.
+
+== 例外・エラー
+
+void rb_warning(const char *fmt, ...) ::
+
+ rb_verbose時に標準エラー出力に警告情報を表示する.引数は
+ printf()と同じ.
+
+void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
+
+ RuntimeError例外を発生させる.引数はprintf()と同じ.
+
+void rb_raise(VALUE exception, const char *fmt, ...) ::
+
+ exceptionで指定した例外を発生させる.fmt以下の引数は
+ printf()と同じ.
+
+void rb_fatal(const char *fmt, ...) ::
+
+ 致命的例外を発生させる.通常の例外処理は行なわれず, インター
+ プリタが終了する(ただしensureで指定されたコードは終了前に
+ 実行される).
+
+void rb_bug(const char *fmt, ...) ::
+
+ インタープリタなどプログラムのバグでしか発生するはずのない
+ 状況の時呼ぶ.インタープリタはコアダンプし直ちに終了する.
+ 例外処理は一切行なわれない.
+
+注意: %iはObject#to_s('+'フラグが指定されているときはObject#inspect)を
+使ったVALUEの出力に使用されているため,整数には%dを使用すること.
+
+== Rubyの初期化・実行
+
+Rubyをアプリケーションに埋め込む場合には以下のインタフェース
+を使う.通常の拡張ライブラリには必要ない.
+
+void ruby_init() ::
+
+ Rubyインタプリタの初期化を行なう.
+
+void ruby_options(int argc, char **argv) ::
+
+ Rubyインタプリタのコマンドライン引数の処理を行なう.
+
+void ruby_run() ::
+
+ Rubyインタプリタを実行する.
+
+void ruby_script(char *name) ::
+
+ Rubyのスクリプト名($0)を設定する.
+
+== インタプリタのイベントのフック
+
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data)
+
+指定されたインタプリタのイベントに対するフック関数を追加します.
+eventsは以下の値のorでなければなりません:
+
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
+
+rb_event_hook_func_tの定義は以下の通りです:
+
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
+ VALUE self, ID id, VALUE klass)
+
+rb_add_event_hook() の第3引数 data は,フック関数の第2引数と
+して渡されます.これは1.8では現在のNODEへのポインタでした.以
+下の RB_EVENT_HOOKS_HAVE_CALLBACK_DATA も参照してください.
+
+ int rb_remove_event_hook(rb_event_hook_func_t func)
+
+指定されたフック関数を削除します.
+
+== 互換性のためのマクロ
+
+APIの互換性をチェックするために以下のマクロがデフォルトで定義されています.
+
+NORETURN_STYLE_NEW ::
+
+ NORETURN マクロが関数型マクロとして定義されていることを意味する.
+
+HAVE_RB_DEFINE_ALLOC_FUNC ::
+
+ rb_define_alloc_func() 関数が提供されていること,つまり
+ allocation framework が使われることを意味する.
+ have_func("rb_define_alloc_func", "ruby.h")
+ の結果と同じ.
+
+HAVE_RB_REG_NEW_STR ::
+
+ StringオブジェクトからRegexpオブジェクトを作る
+ rb_reg_new_str() 関数が提供されていることを意味する.
+ have_func("rb_reg_new_str", "ruby.h").
+ の結果と同じ.
+
+HAVE_RB_IO_T ::
+
+ rb_io_t 型が提供されていることを意味する.
+
+USE_SYMBOL_AS_METHOD_NAME ::
+
+ メソッド名を返すメソッド,Module#methods, #singleton_methods
+ などがSymbolを返すことを意味する.
+
+HAVE_RUBY_*_H ::
+
+ ruby.h で定義されている.対応するヘッダが提供されていること
+ を意味する.たとえば,HAVE_RUBY_ST_H が定義されている場合は
+ 単なる st.h ではなく ruby/st.h を使用する.
+
+RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
+
+ rb_add_event_hook() がフック関数に渡す data を第3引数として
+ 受け取ることを意味する.
+
+= Appendix C. extconf.rbで使える関数たち
+
+extconf.rbの中では利用可能なコンパイル条件チェックの関数は以
+下の通りである.
+
+have_macro(macro, headers) ::
+
+ ヘッダファイルheaderをインクルードしてマクロmacroが定義さ
+ れているかどうかチェックする.マクロが定義されている時true
+ を返す.
+
+have_library(lib, func) ::
+
+ 関数funcを定義しているライブラリlibの存在をチェックする.
+ チェックに成功すると,-llibを$libsに追加し,trueを返す.
+
+find_library(lib, func, path...) ::
+
+ 関数funcを定義しているライブラリlibの存在を -Lpath を追加
+ しながらチェックする.チェックに成功すると,-llibを$libsに
+ 追加し,trueを返す.
+
+have_func(func, header) ::
+
+ ヘッダファイルheaderをインクルードして関数funcの存在をチェ
+ ックする.funcが標準ではリンクされないライブラリ内のもので
+ ある時には先にhave_libraryでそのライブラリをチェックしてお
+ く事.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_{FUNC}` を定義し,trueを返す.
+
+have_var(var, header) ::
+
+ ヘッダファイルheaderをインクルードして変数varの存在をチェッ
+ クする.varが標準ではリンクされないライブラリ内のものであ
+ る時には先にhave_libraryでそのライブラリをチェックしておく
+ 事.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_{VAR}` を定義し,trueを返す.
+
+have_header(header) ::
+
+ ヘッダファイルの存在をチェックする.チェックに成功すると,
+ プリプロセッサマクロ `HAVE_{HEADER_H}` を定義し,trueを返す.
+ (スラッシュやドットはアンダースコアに置換される)
+
+find_header(header, path...) ::
+
+ ヘッダファイルheaderの存在を -Ipath を追加しながらチェック
+ する.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_{HEADER_H}` を定義し,trueを返す.
+ (スラッシュやドットはアンダースコアに置換される)
+
+have_struct_member(type, member[, header[, opt]]) ::
+
+ ヘッダファイルheaderをインクルードして型typeが定義され,
+ なおかつメンバmemberが存在するかをチェックする.チェックに
+ 成功すると,プリプロセッサマクロ `HAVE_{TYPE}_{MEMBER}` を
+ 定義し,trueを返す.
+
+have_type(type, header, opt) ::
+
+ ヘッダファイルheaderをインクルードして型typeが存在するかを
+ チェックする.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_TYPE_{TYPE}` を定義し,trueを返す.
+
+check_sizeof(type, header) ::
+
+ ヘッダファイルheaderをインクルードして型typeのchar単位サイ
+ ズを調べる.チェックに成功すると,プリプロセッサマクロ
+ `SIZEOF_{TYPE}` を定義し,そのサイズを返す.定義されていな
+ いときはnilを返す.
+
+create_makefile(target[, target_prefix]) ::
+
+ 拡張ライブラリ用のMakefileを生成する.この関数を呼ばなけれ
+ ばそのライブラリはコンパイルされない.targetはモジュール名
+ を表す.
+
+find_executable(command, path) ::
+
+ コマンドcommandをFile::PATH_SEPARATORで区切られたパス名の
+ リストpathから探す.pathがnilまたは省略された場合は,環境
+ 変数PATHの値を使用する.実行可能なコマンドが見つかった場合
+ はパスを含むファイル名,見つからなかった場合はnilを返す.
+
+with_config(withval[, default=nil]) ::
+
+ コマンドライン上の--with-<withval>で指定されたオプション値
+ を得る.
+
+enable_config(config, *defaults) ::
+disable_config(config, *defaults) ::
+
+ コマンドライン上の--enable-<config>または
+ --disable-<config>で指定された真偽値を得る.
+ --enable-<config>が指定されていた場合はtrue,
+ --disable-<config>が指定されていた場合はfalseを返す.
+ どちらも指定されていない場合は,ブロックつきで呼び出されて
+ いる場合は*defaultsをyieldした結果,ブロックなしなら
+ *defaultsを返す.
+
+dir_config(target[, default_dir]) ::
+dir_config(target[, default_include, default_lib]) ::
+
+ コマンドライン上の--with-<target>-dir, --with-<target>-include,
+ --with-<target>-libのいずれかで指定されるディレクトリを
+ $CFLAGS や $LDFLAGS に追加する.--with-<target>-dir=/pathは
+ --with-<target>-include=/path/include --with-<target>-lib=/path/lib
+ と等価である.追加された include ディレクトリと lib ディレ
+ クトリの配列を返す. ([include_dir, lib_dir])
+
+pkg_config(pkg, option=nil) ::
+
+ pkg-configコマンドからパッケージpkgの情報を [cflags, ldflags, libs]
+ の配列として得る.$CFLAGS, $LDFLAGS, $libs にはそれぞれの値が
+ 追加される.
+
+ pkg-configの実際のコマンドは,以下の順で試される.
+
+ 1. コマンドラインで--with-{pkg}-config={command}オプションが
+ 指定された場合: {command} {option}
+ 2. {pkg}-config {option}
+ 3. pkg-config {option} {pkg}
+
+ optionが指定された場合は、上記の配列の代わりにそのオプションを
+ 指定して得られた出力をstripしたものを返す.
+
+/*
+ * Local variables:
+ * fill-column: 60
+ * end:
+ */
diff --git a/README.ja b/README.ja
new file mode 100644
index 0000000000..9ab2f3ca0e
--- /dev/null
+++ b/README.ja
@@ -0,0 +1,192 @@
+= Rubyとは
+
+Rubyはシンプルかつ強力なオブジェクト指向スクリプト言語です.
+Rubyは最初から純粋なオブジェクト指向言語として設計されていま
+すから,オブジェクト指向プログラミングを手軽に行う事が出来ま
+す.もちろん通常の手続き型のプログラミングも可能です.
+
+Rubyはテキスト処理関係の能力などに優れ,Perlと同じくらい強力
+です.さらにシンプルな文法と,例外処理やイテレータなどの機構
+によって,より分かりやすいプログラミングが出来ます.
+
+
+== Rubyの特長
+
+* シンプルな文法
+* 普通のオブジェクト指向機能(クラス,メソッドコールなど)
+* 特殊なオブジェクト指向機能(Mixin, 特異メソッドなど)
+* 演算子オーバーロード
+* 例外処理機能
+* イテレータとクロージャ
+* ガーベージコレクタ
+* ダイナミックローディング (アーキテクチャによる)
+* 移植性が高い.多くのUnix-like/POSIX互換プラットフォーム上で
+ 動くだけでなく,Windows, Mac OS X,BeOSなどの上でも動く
+ cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatformsJa
+
+== 入手法
+
+=== FTPで
+
+以下の場所においてあります.
+
+ftp://ftp.ruby-lang.org/pub/ruby/
+
+=== Subversionで
+
+開発先端のソースコードは次のコマンドで取得できます.
+
+ $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
+
+他に開発中のブランチの一覧は次のコマンドで見られます.
+
+ $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
+
+=== Gitで
+
+SubversionのミラーをGitHubに公開しています.
+以下のコマンドでリポジトリを取得できます.
+
+ $ git clone git://github.com/ruby/ruby.git
+
+== ホームページ
+
+RubyのホームページのURLは
+
+http://www.ruby-lang.org/
+
+です.
+
+
+== メーリングリスト
+
+Rubyのメーリングリストがあります。参加希望の方は
+
+mailto:ruby-list-ctl@ruby-lang.org
+
+まで本文に
+
+ subscribe YourFirstName YourFamilyName
+
+と書いて送って下さい。
+
+Ruby開発者向けメーリングリストもあります。こちらではrubyのバ
+グ、将来の仕様拡張など実装上の問題について議論されています。
+参加希望の方は
+
+mailto:ruby-dev-ctl@ruby-lang.org
+
+までruby-listと同様の方法でメールしてください。
+
+Ruby拡張モジュールについて話し合うruby-extメーリングリストと
+数学関係の話題について話し合うruby-mathメーリングリストと
+英語で話し合うruby-talkメーリングリストもあります。参加方法
+はどれも同じです。
+
+
+== コンパイル・インストール
+
+以下の手順で行ってください.
+
+1. もし +configure+ ファイルが見つからない、もしくは
+ +configure.in+ より古いようなら、 +autoconf+ を実行して
+ 新しく +configure+ を生成する
+
+2. +configure+ を実行して +Makefile+ などを生成する
+
+ 環境によってはデフォルトのCコンパイラ用オプションが付き
+ ます. +configure+ オプションで <tt>optflags=..</tt> <tt>warnflags=..</tt> 等
+ で上書きできます.
+
+3. (必要ならば)+defines.h+ を編集する
+
+ 多分,必要無いと思います.
+
+4. (必要ならば)+ext/Setup+ に静的にリンクする拡張モジュールを
+ 指定する
+
+ +ext/Setup+ に記述したモジュールは静的にリンクされます.
+
+ ダイナミックローディングをサポートしていないアーキテク
+ チャでは +Setup+ の1行目の「<tt>option nodynamic</tt>」という行のコ
+ メントを外す必要があります.また,このアーキテクチャで
+ 拡張モジュールを利用するためには,あらかじめ静的にリン
+ クしておく必要があります.
+
+5. +make+ を実行してコンパイルする
+
+6. <tt>make check</tt>でテストを行う.
+
+ 「<tt>check succeeded</tt>」と表示されれば成功です.ただしテスト
+ に成功しても完璧だと保証されている訳ではありません.
+
+7. <tt>make install</tt>
+
+ 以下のディレクトリを作って,そこにファイルをインストー
+ ルします.
+
+ * <tt>${DESTDIR}${prefix}/bin</tt>
+ * <tt>${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/site_ruby</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/vendor_ruby</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}</tt>
+ * <tt>${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}</tt>
+ * <tt>${DESTDIR}${prefix}/share/man/man1</tt>
+ * <tt>${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system</tt>
+
+ RubyのAPIバージョンが'_x.y.z_'であれば,<tt>${MAJOR}</tt>は
+ '_x_'で,<tt>${MINOR}</tt>は'_y_',<tt>${TEENY}</tt>は'_z_'です.
+
+ <b>注意</b>: APIバージョンの +teeny+ は,Rubyプログラムのバージョ
+ ンとは異なることがあります.
+
+ +root+ で作業する必要があるかもしれません.
+
+もし,コンパイル時にエラーが発生した場合にはエラーのログとマ
+シン,OSの種類を含むできるだけ詳しいレポートを作者に送ってく
+ださると他の方のためにもなります.
+
+
+== 移植
+
+UNIXであれば +configure+ がほとんどの差異を吸収してくれるはずで
+すが,思わぬ見落としがあった場合(あるに違いない),作者にその
+ことをレポートすれば,解決できるかも知れません.
+
+アーキテクチャにもっとも依存するのはGC部です.RubyのGCは対象
+のアーキテクチャが<tt>setjmp()</tt>または<tt>getcontext()</tt>によって全てのレ
+ジスタを +jmp_buf+ や +ucontext_t+ に格納することと, +jmp_buf+ や
++ucontext_t+ とスタックが32bitアラインメントされていることを仮定
+しています.特に前者が成立しない場合の対応は非常に困難でしょう.
+後者の解決は比較的簡単で, +gc.c+ でスタックをマークしている
+部分にアラインメントのバイト数だけずらしてマークするコードを
+追加するだけで済みます.<tt>defined(\_\_mc68000\_\_)</tt>で括られてい
+る部分を参考にしてください.
+
+レジスタウィンドウを持つCPUでは,レジスタウィンドウをスタッ
+クにフラッシュするアセンブラコードを追加する必要があるかも知
+れません.
+
+
+== 配布条件
+
++COPYING.ja+ ファイルを参照してください。
+
+
+== 著者
+
+コメント,バグレポートその他は mailto:matz@ruby-lang.org まで.
+-------------------------------------------------------
+created at: Thu Aug 3 11:57:36 JST 1995
+--
+Local variables:
+mode: rdoc
+end:
diff --git a/README.ja.md b/README.ja.md
deleted file mode 100644
index eee54a9171..0000000000
--- a/README.ja.md
+++ /dev/null
@@ -1,171 +0,0 @@
-# Rubyとは
-
-Rubyはシンプルかつ強力なオブジェクト指向スクリプト言語です. Rubyは純粋なオブジェクト指向言語として設計されているので,
-オブジェクト指向プログラミングを手軽に行う事が出来ます.もちろん普通の手続き型のプログラミングも可能です.
-
-Rubyはテキスト処理関係の能力などに優れ,Perlと同じくらい強力です.さらにシンプルな文法と,
-例外処理やイテレータなどの機構によって,より分かりやすいプログラミングが出来ます.
-
-## Rubyの特長
-
-* シンプルな文法
-* 普通のオブジェクト指向機能(クラス,メソッドコールなど)
-* 特殊なオブジェクト指向機能(Mixin, 特異メソッドなど)
-* 演算子オーバーロード
-* 例外処理機能
-* イテレータとクロージャ
-* ガーベージコレクタ
-* ダイナミックローディング (アーキテクチャによる)
-* 移植性が高い.多くのUnix-like/POSIX互換プラットフォーム上で動くだけでなく,Windows, Mac OS
- X,BeOSなどの上でも動く cf.
- http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatformsJa
-
-
-## 入手法
-
-### FTPで
-
-以下の場所においてあります.
-
-ftp://ftp.ruby-lang.org/pub/ruby/
-
-### Subversionで
-
-開発先端のソースコードは次のコマンドで取得できます.
-
- $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
-
-他に開発中のブランチの一覧は次のコマンドで見られます.
-
- $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
-
-### Gitで
-
-SubversionのミラーをGitHubに公開しています. 以下のコマンドでリポジトリを取得できます.
-
- $ git clone git://github.com/ruby/ruby.git
-
-## ホームページ
-
-RubyのホームページのURLは
-
-http://www.ruby-lang.org/
-
-です.
-
-## メーリングリスト
-
-Rubyのメーリングリストがあります.参加希望の方は
-
-mailto:ruby-list-request@ruby-lang.org
-
-まで本文に
-
- subscribe
-
-と書いて送って下さい.
-
-Ruby開発者向けメーリングリストもあります.こちらではrubyのバグ,将来の仕様拡張など実装上の問題について議論されています. 参加希望の方は
-
-mailto:ruby-dev-request@ruby-lang.org
-
-までruby-listと同様の方法でメールしてください.
-
-Ruby拡張モジュールについて話し合うruby-extメーリングリストと数学関係の話題について話し合うruby-mathメーリングリストと
-英語でrubyについて話し合うruby-talkメーリングリストもあります.参加方法はどれも同じです.
-
-## コンパイル・インストール
-
-以下の手順で行ってください.
-
-1. もし `configure` ファイルが見つからない,もしくは `configure.in` より古いようなら, `autoconf` を実行して
- 新しく `configure` を生成する
-
-2. `configure` を実行して `Makefile` などを生成する
-
- 環境によってはデフォルトのCコンパイラ用オプションが付きます. `configure` オプションで `optflags=..`
- `warnflags=..` 等で上書きできます.
-
-3. (必要ならば)`defines.h` を編集する
-
- 多分,必要無いと思います.
-
-4. (必要ならば)`ext/Setup` に静的にリンクする拡張モジュールを指定する
-
- `ext/Setup` に記述したモジュールは静的にリンクされます.
-
- ダイナミックローディングをサポートしていないアーキテクチャでは `Setup` の1行目の「`option nodynamic`」という行のコ
- メントを外す必要があります.また,このアーキテクチャで拡張モジュールを利用するためには,あらかじめ静的にリンクをしておく必要があります.
-
-5. `make` を実行してコンパイルする
-
-6. `make check`でテストを行う.
-
- 「`check succeeded`」と表示されれば成功です.ただしテストに成功しても完璧だと保証されている訳ではありません.
-
-7. `make install`
-
- 以下のディレクトリを作って,そこにファイルをインストー ルします.
-
- * `${DESTDIR}${prefix}/bin`
- * `${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib`
- * `${DESTDIR}${prefix}/lib/ruby`
- * `${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib/ruby/site_ruby`
- * `${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib/ruby/vendor_ruby`
- * `${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/share/man/man1`
- * `${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system`
-
-
- RubyのAPIバージョンが'*x.y.z*'であれば,`${MAJOR}`は
- '*x*'で,`${MINOR}`は'*y*',`${TEENY}`は'*z*'です.
-
- **注意**: APIバージョンの `teeny` は,Rubyプログラムのバージョンとは異なることがあります.
-
- `root` で作業する必要があるかもしれません.
-
-
-もし,コンパイル時にエラーが発生した場合にはエラーのログとマシン,OSの種類を含むできるだけ詳しいレポートを作者に送って下さると他の方のためにもなります.
-
-## 移植
-
-UNIXであれば `configure` がほとんどの差異を吸収してくれるはずですが,思わぬ見落としがあった場合(ある事が多い),作者にその
-ことを報告すれば,解決できる可能性があります.
-
-アーキテクチャにもっとも依存するのはGC部です.RubyのGCは対象
-のアーキテクチャが`setjmp()`または`getcontext()`によって全てのレジスタを `jmp_buf` や `ucontext_t`
-に格納することと, `jmp_buf` や `ucontext_t` とスタックが32bitアラインメントされていることを仮定
-しています.特に前者が成立しない場合の対応は非常に困難でしょう. 後者の解決は比較的簡単で, `gc.c` でスタックをマークしている
-部分にアラインメントのバイト数だけずらしてマークするコードを追加するだけで済みます.`defined(__mc68000__)`で括られてい
-る部分を参考にしてください.
-
-レジスタウィンドウを持つCPUでは,レジスタウィンドウをスタックにフラッシュするアセンブラコードを追加する必要があるかもしれません.
-
-## 配布条件
-
-`COPYING.ja` ファイルを参照してください.
-
-## フィードバック
-
-Rubyに関する質問は Ruby-Talk(英語)や Ruby-List(日本語) (https://www.ruby-lang.org/ja/community/mailing-lists) や,
-stackoverflow (http://ja.stackoverflow.com/) などのWebサイトに投稿してください.
-
-バグ報告は http://bugs.ruby-lang.org で受け付けています.
-
-
-## 著者
-
-Rubyのオリジナル版は,1995年にまつもとゆきひろ氏によって設計・開発されました.
-
-<mailto:matz@ruby-lang.org>
-
----
-created at: Thu Aug 3 11:57:36 JST 1995
diff --git a/README.md b/README.md
deleted file mode 100644
index 14fb7aa213..0000000000
--- a/README.md
+++ /dev/null
@@ -1,164 +0,0 @@
-# What's Ruby
-
-Ruby is the interpreted scripting language for quick and easy object-oriented
-programming. It has many features to process text files and to do system
-management tasks (as in Perl). It is simple, straight-forward, and
-extensible.
-
-## Features of Ruby
-
-* Simple Syntax
-* **Normal** Object-oriented Features (e.g. class, method calls)
-* **Advanced** Object-oriented Features (e.g. Mix-in, Singleton-method)
-* Operator Overloading
-* Exception Handling
-* Iterators and Closures
-* Garbage Collection
-* Dynamic Loading of Object Files (on some architectures)
-* Highly Portable (works on many Unix-like/POSIX compatible platforms as
- well as Windows, Mac OS X, BeOS, etc.) cf.
- http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms
-
-
-## How to get Ruby
-
-For a complete list of ways to install Ruby, including using third-party tools
-like rvm, see:
-
-http://www.ruby-lang.org/en/downloads/
-
-The Ruby distribution files can be found on the following FTP site:
-
-ftp://ftp.ruby-lang.org/pub/ruby/
-
-The trunk of the Ruby source tree can be checked out with the following
-command:
-
- $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
-
-Or if you are using git then use the following command:
-
- $ git clone git://github.com/ruby/ruby.git
-
-There are some other branches under development. Try the following command
-to see the list of branches:
-
- $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
-
-Or if you are using git then use the following command:
-
- $ git ls-remote git://github.com/ruby/ruby.git
-
-## Ruby home page
-
-The URL of the Ruby home page is:
-
-http://www.ruby-lang.org/
-
-## Mailing list
-
-There is a mailing list to talk about Ruby. To subscribe this list, please
-send the following phrase:
-
- subscribe
-
-in the mail body (not subject) to the address
-<mailto:ruby-talk-request@ruby-lang.org>.
-
-## How to compile and install
-
-This is what you need to do to compile and install Ruby:
-
-1. If you want to use Microsoft Visual C++ to compile ruby, read
- win32/README.win32 instead of this document.
-
-2. If `./configure` does not exist or is older than configure.in, run
- `autoconf` to (re)generate configure.
-
-3. Run `./configure`, which will generate `config.h` and `Makefile`.
-
- Some C compiler flags may be added by default depending on your
- environment. Specify `optflags=..` and `warnflags=..` as necessary to
- override them.
-
-4. Edit `defines.h` if you need. Usually this step will not be needed.
-
-5. Remove comment mark(`#`) before the module names from `ext/Setup` (or add
- module names if not present), if you want to link modules statically.
-
- If you don't want to compile non static extension modules (probably on
- architectures which do not allow dynamic loading), remove comment mark
- from the line "`#option nodynamic`" in `ext/Setup`.
-
- Usually this step will not be needed.
-
-6. Run `make`.
-
-7. Optionally, run '`make check`' to check whether the compiled Ruby
- interpreter works well. If you see the message "`check succeeded`", your
- ruby works as it should (hopefully).
-
-8. Run '`make install`'
-
- This command will create following directories and install files onto
- them.
-
- * `${DESTDIR}${prefix}/bin`
- * `${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib`
- * `${DESTDIR}${prefix}/lib/ruby`
- * `${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib/ruby/site_ruby`
- * `${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib/ruby/vendor_ruby`
- * `${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}`
- * `${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}`
- * `${DESTDIR}${prefix}/share/man/man1`
- * `${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system`
-
-
- If Ruby's API version is '*x.y.z*', the `${MAJOR}` is '*x*', the
- `${MINOR}` is '*y*', and the `${TEENY}` is '*z*'.
-
- **NOTE**: teeny of the API version may be different from one of Ruby's
- program version
-
- You may have to be a super user to install ruby.
-
-
-If you fail to compile ruby, please send the detailed error report with the
-error log and machine/OS type, to help others.
-
-Some extension libraries may not get compiled because of lack of necessary
-external libraries and/or headers, then you will need to run '`make distclean-ext`'
-to remove old configuration after installing them in such case.
-
-## Copying
-
-See the file `COPYING`.
-
-## Feedback
-
-Questions about the Ruby language can be asked on the Ruby-Talk mailing list
-(http://www.ruby-lang.org/en/community/mailing-lists) or on websites like
-(http://stackoverflow.com).
-
-Bug reports should be filed at http://bugs.ruby-lang.org. Read [HowToReport] for more information.
-
-[HowToReport]: https://bugs.ruby-lang.org/projects/ruby/wiki/HowToReport
-
-##Contributing
-
-See the file `CONTRIBUTING.md`
-
-
-## The Author
-
-Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in
-1995.
-
-<mailto:matz@ruby-lang.org>
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644
index 30fccd52fe..0000000000
--- a/aclocal.m4
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- autoconf -*-
-
-AC_DEFUN([_COLORIZE_RESULT_PREPARE], [
- msg_checking= msg_result_yes= msg_result_no= msg_result_other= msg_reset=
- AS_IF([test "x${CONFIGURE_TTY}" = xyes -o -t 1], [
- msg_begin="`tput smso 2>/dev/null`"
- AS_CASE(["$msg_begin"], ['@<:@'*m],
- [msg_begin="`echo "$msg_begin" | sed ['s/[0-9]*m$//']`"
- msg_checking="${msg_begin}33m"
- AS_IF([test ${TEST_COLORS:+set}], [
- msg_result_yes=[`expr ":$TEST_COLORS:" : ".*:pass=\([^:]*\):"`]
- msg_result_no=[`expr ":$TEST_COLORS:" : ".*:fail=\([^:]*\):"`]
- msg_result_other=[`expr ":$TEST_COLORS:" : ".*:skip=\([^:]*\):"`]
- ])
- msg_result_yes="${msg_begin}${msg_result_yes:-32;1}m"
- msg_result_no="${msg_begin}${msg_result_no:-31;1}m"
- msg_result_other="${msg_begin}${msg_result_other:-33;1}m"
- msg_reset="${msg_begin}m"
- ])
- AS_UNSET(msg_begin)
- ])
- AS_REQUIRE_SHELL_FN([colorize_result],
- [AS_FUNCTION_DESCRIBE([colorize_result], [MSG], [Colorize result])],
- [AS_CASE(["$[]1"],
- [yes], [AS_ECHO(["${msg_result_yes}$[]1${msg_reset}]")],
- [no], [AS_ECHO(["${msg_result_no}$[]1${msg_reset}]")],
- [AS_ECHO(["${msg_result_other}$[]1${msg_reset}]")])])
-])
-
-AC_DEFUN([COLORIZE_RESULT], [AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
- AS_LITERAL_IF([$1],
- [m4_case([$1],
- [yes], [AS_ECHO(["${msg_result_yes}$1${msg_reset}"])],
- [no], [AS_ECHO(["${msg_result_no}$1${msg_reset}"])],
- [AS_ECHO(["${msg_result_other}$1${msg_reset}"])])],
- [colorize_result "$1"]) dnl
-])
-
-AC_DEFUN([AC_CHECKING],[dnl
-AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
-AS_MESSAGE([checking ${msg_checking}$1${msg_reset}...])])
-
-AC_DEFUN([AC_MSG_RESULT], [dnl
-{ _AS_ECHO_LOG([result: $1])
-COLORIZE_RESULT([$1]); dnl
-}])
diff --git a/addr2line.c b/addr2line.c
index c8faf48d62..f936694724 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -55,8 +55,11 @@ void *alloca();
# endif /* HAVE_ALLOCA_H */
#endif /* __GNUC__ */
-#ifdef HAVE_DLADDR
-# include <dlfcn.h>
+#ifdef HAVE_DL_ITERATE_PHDR
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+# endif
+# include <link.h>
#endif
#define DW_LNS_copy 0x01
@@ -85,13 +88,6 @@ void *alloca();
# define ElfW(x) Elf32##_##x
# endif
#endif
-#ifndef ELF_ST_TYPE
-# if SIZEOF_VOIDP == 8
-# define ELF_ST_TYPE ELF64_ST_TYPE
-# else
-# define ELF_ST_TYPE ELF32_ST_TYPE
-# endif
-#endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
@@ -101,22 +97,13 @@ int kprintf(const char *fmt, ...);
typedef struct {
const char *dirname;
const char *filename;
- const char *path; /* object path */
int line;
- uintptr_t base_addr;
- uintptr_t saddr;
- const char *sname; /* function name */
-} line_info_t;
-typedef struct obj_info obj_info_t;
-struct obj_info {
- const char *path; /* object path */
int fd;
void *mapped;
size_t mapped_size;
- uintptr_t base_addr;
- obj_info_t *next;
-};
+ unsigned long base_addr;
+} line_info_t;
/* Avoid consuming stack as this module may be used from signal handler */
static char binary_filename[PATH_MAX];
@@ -209,15 +196,34 @@ fill_filename(int file, char *include_directories, char *filenames,
}
}
+static int
+get_path_from_symbol(const char *symbol, const char **p, size_t *len)
+{
+ if (symbol[0] == '0') {
+ /* libexecinfo */
+ *p = strchr(symbol, '/');
+ if (*p == NULL) return 0;
+ *len = strlen(*p);
+ }
+ else {
+ /* glibc */
+ const char *q;
+ *p = symbol;
+ q = strchr(symbol, '(');
+ if (q == NULL) return 0;
+ *len = q - symbol;
+ }
+ return 1;
+}
+
static void
-fill_line(int num_traces, void **traces, uintptr_t addr, int file, int line,
- char *include_directories, char *filenames,
- obj_info_t *obj, line_info_t *lines, int offset)
+fill_line(int num_traces, void **traces,
+ unsigned long addr, int file, int line,
+ char *include_directories, char *filenames, line_info_t *lines)
{
int i;
- addr += obj->base_addr;
- for (i = offset; i < num_traces; i++) {
- uintptr_t a = (uintptr_t)traces[i];
+ for (i = 0; i < num_traces; i++) {
+ unsigned long a = (unsigned long)traces[i] - lines[i].base_addr;
/* We assume one line code doesn't result >100 bytes of native code.
We may want more reliable way eventually... */
if (addr < a && a < addr + 100) {
@@ -228,8 +234,8 @@ fill_line(int num_traces, void **traces, uintptr_t addr, int file, int line,
}
static void
-parse_debug_line_cu(int num_traces, void **traces, char **debug_line,
- obj_info_t *obj, line_info_t *lines, int offset)
+parse_debug_line_cu(int num_traces, void **traces,
+ char **debug_line, line_info_t *lines)
{
char *p, *cu_end, *cu_start, *include_directories, *filenames;
unsigned long unit_length;
@@ -275,7 +281,7 @@ parse_debug_line_cu(int num_traces, void **traces, char **debug_line,
is_stmt = default_is_stmt = *(unsigned char *)p;
p++;
- line_base = *(signed char *)p;
+ line_base = *(char *)p;
p++;
line_range = *(unsigned char *)p;
@@ -303,8 +309,7 @@ parse_debug_line_cu(int num_traces, void **traces, char **debug_line,
#define FILL_LINE() \
do { \
fill_line(num_traces, traces, addr, file, line, \
- include_directories, filenames, \
- obj, lines, offset); \
+ include_directories, filenames, lines); \
/*basic_block = prologue_end = epilogue_begin = 0;*/ \
} while (0)
@@ -403,12 +408,11 @@ parse_debug_line_cu(int num_traces, void **traces, char **debug_line,
static void
parse_debug_line(int num_traces, void **traces,
- char *debug_line, unsigned long size,
- obj_info_t *obj, line_info_t *lines, int offset)
+ char *debug_line, unsigned long size, line_info_t *lines)
{
char *debug_line_end = debug_line + size;
while (debug_line < debug_line_end) {
- parse_debug_line_cu(num_traces, traces, &debug_line, obj, lines, offset);
+ parse_debug_line_cu(num_traces, traces, &debug_line, lines);
}
if (debug_line != debug_line_end) {
kprintf("Unexpected size of .debug_line in %s\n",
@@ -417,27 +421,19 @@ parse_debug_line(int num_traces, void **traces,
}
/* read file and fill lines */
-static uintptr_t
-fill_lines(int num_traces, void **traces, int check_debuglink,
- obj_info_t **objp, line_info_t *lines, int offset);
-
static void
-append_obj(obj_info_t **objp) {
- obj_info_t *newobj = calloc(1, sizeof(obj_info_t));
- if (*objp) (*objp)->next = newobj;
- *objp = newobj;
-}
+fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
+ line_info_t *current_line, line_info_t *lines);
static void
-follow_debuglink(char *debuglink, int num_traces, void **traces,
- obj_info_t **objp, line_info_t *lines, int offset)
+follow_debuglink(char *debuglink, int num_traces, void **traces, char **syms,
+ line_info_t *current_line, line_info_t *lines)
{
/* Ideally we should check 4 paths to follow gnu_debuglink,
but we handle only one case for now as this format is used
by some linux distributions. See GDB's info for detail. */
static const char global_debug_dir[] = "/usr/lib/debug";
char *p, *subdir;
- obj_info_t *o1 = *objp, *o2;
p = strrchr(binary_filename, '/');
if (!p) {
@@ -448,22 +444,22 @@ follow_debuglink(char *debuglink, int num_traces, void **traces,
subdir = (char *)alloca(strlen(binary_filename) + 1);
strcpy(subdir, binary_filename);
strcpy(binary_filename, global_debug_dir);
- strlcat(binary_filename, subdir, PATH_MAX);
- strlcat(binary_filename, debuglink, PATH_MAX);
-
- append_obj(objp);
- o2 = *objp;
- o2->base_addr = o1->base_addr;
- o2->path = o1->path;
- fill_lines(num_traces, traces, 0, objp, lines, offset);
+ strncat(binary_filename, subdir,
+ PATH_MAX - strlen(binary_filename) - 1);
+ strncat(binary_filename, debuglink,
+ PATH_MAX - strlen(binary_filename) - 1);
+
+ munmap(current_line->mapped, current_line->mapped_size);
+ close(current_line->fd);
+ fill_lines(num_traces, traces, syms, 0, current_line, lines);
}
/* read file and fill lines */
-static uintptr_t
-fill_lines(int num_traces, void **traces, int check_debuglink,
- obj_info_t **objp, line_info_t *lines, int offset)
+static void
+fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
+ line_info_t *current_line, line_info_t *lines)
{
- int i, j;
+ int i;
char *shstr;
char *section_name;
ElfW(Ehdr) *ehdr;
@@ -472,27 +468,23 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
int fd;
off_t filesize;
char *file;
- ElfW(Shdr) *symtab_shdr = NULL, *strtab_shdr = NULL;
- ElfW(Shdr) *dynsym_shdr = NULL, *dynstr_shdr = NULL;
- obj_info_t *obj = *objp;
- uintptr_t dladdr_fbase = 0;
fd = open(binary_filename, O_RDONLY);
if (fd < 0) {
- goto fail;
+ return;
}
filesize = lseek(fd, 0, SEEK_END);
if (filesize < 0) {
int e = errno;
close(fd);
kprintf("lseek: %s\n", strerror(e));
- goto fail;
+ return;
}
#if SIZEOF_OFF_T > SIZEOF_SIZE_T
if (filesize > (off_t)SIZE_MAX) {
close(fd);
kprintf("Too large file %s\n", binary_filename);
- goto fail;
+ return;
}
#endif
lseek(fd, 0, SEEK_SET);
@@ -502,7 +494,7 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
int e = errno;
close(fd);
kprintf("mmap: %s\n", strerror(e));
- goto fail;
+ return;
}
ehdr = (ElfW(Ehdr) *)file;
@@ -512,12 +504,21 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
* it match non-elf file.
*/
close(fd);
- goto fail;
+ return;
}
- obj->fd = fd;
- obj->mapped = file;
- obj->mapped_size = (size_t)filesize;
+ current_line->fd = fd;
+ current_line->mapped = file;
+ current_line->mapped_size = (size_t)filesize;
+
+ for (i = 0; i < num_traces; i++) {
+ const char *path;
+ size_t len;
+ if (get_path_from_symbol(syms[i], &path, &len) &&
+ !strncmp(path, binary_filename, len)) {
+ lines[i].line = -1;
+ }
+ }
shdr = (ElfW(Shdr) *)(file + ehdr->e_shoff);
@@ -526,88 +527,11 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
for (i = 0; i < ehdr->e_shnum; i++) {
section_name = shstr + shdr[i].sh_name;
- switch (shdr[i].sh_type) {
- case SHT_STRTAB:
- if (!strcmp(section_name, ".strtab")) {
- strtab_shdr = shdr + i;
- }
- else if (!strcmp(section_name, ".dynstr")) {
- dynstr_shdr = shdr + i;
- }
- break;
- case SHT_SYMTAB:
- /* if (!strcmp(section_name, ".symtab")) */
- symtab_shdr = shdr + i;
- break;
- case SHT_DYNSYM:
- /* if (!strcmp(section_name, ".dynsym")) */
- dynsym_shdr = shdr + i;
+ if (!strcmp(section_name, ".debug_line")) {
+ debug_line_shdr = shdr + i;
break;
- case SHT_PROGBITS:
- if (!strcmp(section_name, ".debug_line")) {
- debug_line_shdr = shdr + i;
- }
- else if (!strcmp(section_name, ".gnu_debuglink")) {
- gnu_debuglink_shdr = shdr + i;
- }
- break;
- }
- }
-
- if (offset == -1) {
- /* main executable */
- offset = 0;
- if (dynsym_shdr && dynstr_shdr) {
- char *strtab = file + dynstr_shdr->sh_offset;
- ElfW(Sym) *symtab = (ElfW(Sym) *)(file + dynsym_shdr->sh_offset);
- int symtab_count = (int)(dynsym_shdr->sh_size / sizeof(ElfW(Sym)));
- for (j = 0; j < symtab_count; j++) {
- ElfW(Sym) *sym = &symtab[j];
- Dl_info info;
- void *h, *s;
- if (ELF_ST_TYPE(sym->st_info) != STT_FUNC || sym->st_size <= 0) continue;
- h = dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
- if (!h) continue;
- s = dlsym(h, strtab + sym->st_name);
- if (!s) continue;
- if (dladdr(s, &info)) {
- dladdr_fbase = (uintptr_t)info.dli_fbase;
- break;
- }
- }
- if (ehdr->e_type == ET_EXEC) {
- obj->base_addr = 0;
- }
- else {
- /* PIE (position-independent executable) */
- obj->base_addr = dladdr_fbase;
- }
- }
- }
-
- if (!symtab_shdr) {
- symtab_shdr = dynsym_shdr;
- strtab_shdr = dynstr_shdr;
- }
-
- if (symtab_shdr && strtab_shdr) {
- char *strtab = file + strtab_shdr->sh_offset;
- ElfW(Sym) *symtab = (ElfW(Sym) *)(file + symtab_shdr->sh_offset);
- int symtab_count = (int)(symtab_shdr->sh_size / sizeof(ElfW(Sym)));
- for (j = 0; j < symtab_count; j++) {
- ElfW(Sym) *sym = &symtab[j];
- uintptr_t saddr = (uintptr_t)sym->st_value + obj->base_addr;
- if (ELF_ST_TYPE(sym->st_info) != STT_FUNC || sym->st_size <= 0) continue;
- for (i = offset; i < num_traces; i++) {
- uintptr_t d = (uintptr_t)traces[i] - saddr;
- if (lines[i].line > 0 || d <= 0 || d > (uintptr_t)sym->st_size)
- continue;
- /* fill symbol name and addr from .symtab */
- lines[i].sname = strtab + sym->st_name;
- lines[i].saddr = saddr;
- lines[i].path = obj->path;
- lines[i].base_addr = obj->base_addr;
- }
+ } else if (!strcmp(section_name, ".gnu_debuglink")) {
+ gnu_debuglink_shdr = shdr + i;
}
}
@@ -616,161 +540,111 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
let's check .gnu_debuglink section instead. */
if (gnu_debuglink_shdr && check_debuglink) {
follow_debuglink(file + gnu_debuglink_shdr->sh_offset,
- num_traces, traces,
- objp, lines, offset);
+ num_traces, traces, syms,
+ current_line, lines);
}
- goto finish;
+ return;
}
parse_debug_line(num_traces, traces,
file + debug_line_shdr->sh_offset,
debug_line_shdr->sh_size,
- obj, lines, offset);
-finish:
- return dladdr_fbase;
-fail:
- return (uintptr_t)-1;
+ lines);
}
-#define HAVE_MAIN_EXE_PATH
-#if defined(__FreeBSD__)
-# include <sys/sysctl.h>
-#endif
-/* ssize_t main_exe_path(void)
- *
- * store the path of the main executable to `binary_filename`,
- * and returns strlen(binary_filename).
- * it is NUL terminated.
- */
-#if defined(__linux__)
-ssize_t
-main_exe_path(void)
-{
-# define PROC_SELF_EXE "/proc/self/exe"
- ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
- binary_filename[len] = 0;
- return len;
-}
-#elif defined(__FreeBSD__)
-ssize_t
-main_exe_path(void)
+#ifdef HAVE_DL_ITERATE_PHDR
+
+typedef struct {
+ int num_traces;
+ char **syms;
+ line_info_t *lines;
+} fill_base_addr_state_t;
+
+static int
+fill_base_addr(struct dl_phdr_info *info, size_t size, void *data)
{
- int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
- size_t len = PATH_MAX;
- int err = sysctl(mib, 4, binary_filename, &len, NULL, 0);
- if (err) {
- kprintf("Can't get the path of ruby");
- return -1;
+ int i;
+ fill_base_addr_state_t *st = (fill_base_addr_state_t *)data;
+ for (i = 0; i < st->num_traces; i++) {
+ const char *path;
+ size_t len;
+ size_t name_len = strlen(info->dlpi_name);
+
+ if (get_path_from_symbol(st->syms[i], &path, &len) &&
+ (len == name_len || (len > name_len && path[len-name_len-1] == '/')) &&
+ !strncmp(path+len-name_len, info->dlpi_name, name_len)) {
+ st->lines[i].base_addr = info->dlpi_addr;
+ }
}
- len--; /* sysctl sets strlen+1 */
- return len;
+ return 0;
}
-#else
-#undef HAVE_MAIN_EXE_PATH
-#endif
+
+#endif /* HAVE_DL_ITERATE_PHDR */
void
-rb_dump_backtrace_with_lines(int num_traces, void **traces)
+rb_dump_backtrace_with_lines(int num_traces, void **trace, char **syms)
{
int i;
/* async-signal unsafe */
- line_info_t *lines = (line_info_t *)calloc(num_traces, sizeof(line_info_t));
- obj_info_t *obj = NULL;
- /* 2 is NULL + main executable */
- void **dladdr_fbases = (void **)calloc(num_traces+2, sizeof(void *));
-#ifdef HAVE_MAIN_EXE_PATH
- char *main_path = NULL; /* used on printing backtrace */
- ssize_t len;
- if ((len = main_exe_path()) > 0) {
- main_path = (char *)alloca(len + 1);
- if (main_path) {
- uintptr_t addr;
- memcpy(main_path, binary_filename, len+1);
- append_obj(&obj);
- obj->path = main_path;
- addr = fill_lines(num_traces, traces, 1, &obj, lines, -1);
- if (addr != (uintptr_t)-1) {
- dladdr_fbases[0] = (void *)addr;
- }
+ line_info_t *lines = (line_info_t *)calloc(num_traces,
+ sizeof(line_info_t));
+
+ /* Note that line info of shared objects might not be shown
+ if we don't have dl_iterate_phdr */
+#ifdef HAVE_DL_ITERATE_PHDR
+ fill_base_addr_state_t fill_base_addr_state;
+
+ fill_base_addr_state.num_traces = num_traces;
+ fill_base_addr_state.syms = syms;
+ fill_base_addr_state.lines = lines;
+ /* maybe async-signal unsafe */
+ dl_iterate_phdr(fill_base_addr, &fill_base_addr_state);
+#endif /* HAVE_DL_ITERATE_PHDR */
+
+ for (i = 0; i < num_traces; i++) {
+ const char *path;
+ size_t len;
+ if (lines[i].line) {
+ continue;
+ }
+
+ if (!get_path_from_symbol(syms[i], &path, &len)) {
+ continue;
}
+
+ strncpy(binary_filename, path, len);
+ binary_filename[len] = '\0';
+
+ fill_lines(num_traces, trace, syms, 1, &lines[i], lines);
}
-#endif
- /* fill source lines by reading dwarf */
for (i = 0; i < num_traces; i++) {
- Dl_info info;
- if (lines[i].line) continue;
- if (dladdr(traces[i], &info)) {
- const char *path;
- void **p;
-
- /* skip symbols which is in already checked objects */
- /* if the binary is strip-ed, this may effect */
- for (p=dladdr_fbases; *p; p++) {
- if (*p == info.dli_fbase) {
- lines[i].path = info.dli_fname;
- lines[i].sname = info.dli_sname;
- goto next_line;
+ line_info_t *line = &lines[i];
+
+ if (line->line > 0) {
+ if (line->filename) {
+ if (line->dirname && line->dirname[0]) {
+ kprintf("%s %s/%s:%d\n", syms[i], line->dirname, line->filename, line->line);
}
+ else {
+ kprintf("%s %s:%d\n", syms[i], line->filename, line->line);
+ }
+ } else {
+ kprintf("%s ???:%d\n", syms[i], line->line);
}
- *p = info.dli_fbase;
-
- append_obj(&obj);
- obj->base_addr = (uintptr_t)info.dli_fbase;
- path = info.dli_fname;
- obj->path = path;
- lines[i].path = path;
- strcpy(binary_filename, path);
- fill_lines(num_traces, traces, 1, &obj, lines, i);
+ } else {
+ kprintf("%s\n", syms[i]);
}
-next_line:
- continue;
}
- /* output */
for (i = 0; i < num_traces; i++) {
line_info_t *line = &lines[i];
- uintptr_t addr = (uintptr_t)traces[i];
- uintptr_t d = addr - line->saddr;
- if (!line->path) {
- kprintf("[0x%lx]\n", addr);
- }
- else if (!line->saddr || !line->sname) {
- kprintf("%s [0x%lx]\n", line->path, addr);
- }
- else if (line->line <= 0) {
- kprintf("%s(%s+0x%lx) [0x%lx]\n", line->path, line->sname,
- d, addr);
- }
- else if (!line->filename) {
- kprintf("%s(%s+0x%lx) [0x%lx] ???:%d\n", line->path, line->sname,
- d, addr, line->line);
- }
- else if (line->dirname && line->dirname[0]) {
- kprintf("%s(%s+0x%lx) [0x%lx] %s/%s:%d\n", line->path, line->sname,
- d, addr, line->dirname, line->filename, line->line);
- }
- else {
- kprintf("%s(%s+0x%lx) [0x%lx] %s:%d\n", line->path, line->sname,
- d, addr, line->filename, line->line);
- }
- /* FreeBSD's backtrace may show _start and so on */
- if (line->sname && strcmp("main", line->sname) == 0)
- break;
- }
-
- /* free */
- while (obj) {
- obj_info_t *o = obj;
- obj = o->next;
- if (o->fd) {
- munmap(o->mapped, o->mapped_size);
- close(o->fd);
+ if (line->fd) {
+ munmap(line->mapped, line->mapped_size);
+ close(line->fd);
}
- free(o);
}
free(lines);
- free(dladdr_fbases);
}
/* From FreeBSD's lib/libstand/printf.c */
diff --git a/addr2line.h b/addr2line.h
index d99f010934..3782d89e07 100644
--- a/addr2line.h
+++ b/addr2line.h
@@ -14,7 +14,7 @@
#ifdef USE_ELF
void
-rb_dump_backtrace_with_lines(int num_traces, void **traces);
+rb_dump_backtrace_with_lines(int num_traces, void **traces, char **syms);
#endif /* USE_ELF */
diff --git a/array.c b/array.c
index de81ee7fab..5d01fdb551 100644
--- a/array.c
+++ b/array.c
@@ -11,9 +11,11 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/util.h"
#include "ruby/st.h"
+#include "ruby/encoding.h"
+#include "internal.h"
#include "probes.h"
#include "id.h"
@@ -29,6 +31,70 @@ static ID id_cmp, id_div, id_power;
#define ARY_DEFAULT_SIZE 16
#define ARY_MAX_SIZE (LONG_MAX / (int)sizeof(VALUE))
+void
+rb_mem_clear(register VALUE *mem, register long size)
+{
+ while (size--) {
+ *mem++ = Qnil;
+ }
+}
+
+static void
+ary_mem_clear(VALUE ary, long beg, long size)
+{
+ RARRAY_PTR_USE(ary, ptr, {
+ rb_mem_clear(ptr + beg, size);
+ });
+}
+
+static inline void
+memfill(register VALUE *mem, register long size, register VALUE val)
+{
+ while (size--) {
+ *mem++ = val;
+ }
+}
+
+static void
+ary_memfill(VALUE ary, long beg, long size, VALUE val)
+{
+ RARRAY_PTR_USE(ary, ptr, {
+ memfill(ptr + beg, size, val);
+ OBJ_WRITTEN(ary, Qundef, val);
+ });
+}
+
+static void
+ary_memcpy(VALUE ary, long beg, long argc, const VALUE *argv)
+{
+#if 1
+ if (OBJ_PROMOTED(ary)) {
+ if (argc > (int)(128/sizeof(VALUE)) /* is magic number (cache line size) */) {
+ rb_gc_writebarrier_remember_promoted(ary);
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMCPY(ptr+beg, argv, VALUE, argc);
+ });
+ }
+ else {
+ int i;
+ RARRAY_PTR_USE(ary, ptr, {
+ for (i=0; i<argc; i++) {
+ OBJ_WRITE(ary, &ptr[i+beg], argv[i]);
+ }
+ });
+ }
+ }
+ else {
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMCPY(ptr+beg, argv, VALUE, argc);
+ });
+ }
+#else
+ /* use shady (traditional way) */
+ MEMCPY(RARRAY_PTR(ary)+beg, argv, VALUE, argc);
+#endif
+}
+
# define ARY_SHARED_P(ary) \
(assert(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
FL_TEST((ary),ELTS_SHARED)!=0)
@@ -113,7 +179,7 @@ static ID id_cmp, id_div, id_power;
assert(!ARY_EMBED_P(_ary_)); \
assert(ARY_SHARED_P(_ary_)); \
assert(ARY_SHARED_ROOT_P(_value_)); \
- RB_OBJ_WRITE(_ary_, &RARRAY(_ary_)->as.heap.aux.shared, _value_); \
+ OBJ_WRITE(_ary_, &RARRAY(_ary_)->as.heap.aux.shared, _value_); \
} while (0)
#define RARRAY_SHARED_ROOT_FLAG FL_USER5
#define ARY_SHARED_ROOT_P(ary) (FL_TEST((ary), RARRAY_SHARED_ROOT_FLAG))
@@ -129,74 +195,6 @@ static ID id_cmp, id_div, id_power;
FL_SET((ary), RARRAY_SHARED_ROOT_FLAG); \
} while (0)
-#define ARY_SET(a, i, v) RARRAY_ASET((assert(!ARY_SHARED_P(a)), (a)), (i), (v))
-
-void
-rb_mem_clear(register VALUE *mem, register long size)
-{
- while (size--) {
- *mem++ = Qnil;
- }
-}
-
-static void
-ary_mem_clear(VALUE ary, long beg, long size)
-{
- RARRAY_PTR_USE(ary, ptr, {
- rb_mem_clear(ptr + beg, size);
- });
-}
-
-static inline void
-memfill(register VALUE *mem, register long size, register VALUE val)
-{
- while (size--) {
- *mem++ = val;
- }
-}
-
-static void
-ary_memfill(VALUE ary, long beg, long size, VALUE val)
-{
- RARRAY_PTR_USE(ary, ptr, {
- memfill(ptr + beg, size, val);
- RB_OBJ_WRITTEN(ary, Qundef, val);
- });
-}
-
-static void
-ary_memcpy0(VALUE ary, long beg, long argc, const VALUE *argv, VALUE buff_owner_ary)
-{
-#if 1
- assert(!ARY_SHARED_P(buff_owner_ary));
-
- if (argc > (int)(128/sizeof(VALUE)) /* is magic number (cache line size) */) {
- rb_gc_writebarrier_remember(buff_owner_ary);
- RARRAY_PTR_USE(ary, ptr, {
- MEMCPY(ptr+beg, argv, VALUE, argc);
- });
- }
- else {
- int i;
- RARRAY_PTR_USE(ary, ptr, {
- for (i=0; i<argc; i++) {
- RB_OBJ_WRITE(buff_owner_ary, &ptr[i+beg], argv[i]);
- }
- });
- }
-#else
- /* giveup write barrier (traditional way) */
- RARRAY_PTR(buff_owner_ary);
- MEMCPY(RARRAY_PTR(ary)+beg, argv, VALUE, argc);
-#endif
-}
-
-static void
-ary_memcpy(VALUE ary, long beg, long argc, const VALUE *argv)
-{
- ary_memcpy0(ary, beg, argc, argv, ary);
-}
-
static void
ary_resize_capa(VALUE ary, long capacity)
{
@@ -221,12 +219,13 @@ ary_resize_capa(VALUE ary, long capacity)
if (!ARY_EMBED_P(ary)) {
long len = RARRAY_LEN(ary);
const VALUE *ptr = RARRAY_CONST_PTR(ary);
+ size_t size = ARY_HEAP_SIZE(ary);
if (len > capacity) len = capacity;
MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len);
FL_SET_EMBED(ary);
ARY_SET_LEN(ary, len);
- ruby_xfree((VALUE *)ptr);
+ ruby_sized_xfree((VALUE *)ptr, size);
}
}
}
@@ -345,28 +344,21 @@ rb_ary_modify(VALUE ary)
ARY_SET_CAPA(ary, len);
ARY_SET_PTR(ary, ptr);
}
-
- rb_gc_writebarrier_remember(ary);
}
}
-static VALUE
+static void
ary_ensure_room_for_push(VALUE ary, long add_len)
{
- long old_len = RARRAY_LEN(ary);
- long new_len = old_len + add_len;
+ long new_len = RARRAY_LEN(ary) + add_len;
long capa;
- if (old_len > ARY_MAX_SIZE - add_len) {
- rb_raise(rb_eIndexError, "index %ld too big", new_len);
- }
if (ARY_SHARED_P(ary)) {
if (new_len > RARRAY_EMBED_LEN_MAX) {
VALUE shared = ARY_SHARED(ary);
if (ARY_SHARED_OCCUPIED(shared)) {
if (RARRAY_CONST_PTR(ary) - RARRAY_CONST_PTR(shared) + new_len <= RARRAY_LEN(shared)) {
rb_ary_modify_check(ary);
- return shared;
}
else {
/* if array is shared, then it is likely it participate in push/shift pattern */
@@ -375,8 +367,8 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
if (new_len > capa - (capa >> 6)) {
ary_double_capa(ary, new_len);
}
- return ary;
}
+ return;
}
}
}
@@ -385,8 +377,6 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
if (new_len > capa) {
ary_double_capa(ary, new_len);
}
-
- return ary;
}
/*
@@ -453,7 +443,10 @@ ary_alloc(VALUE klass)
static VALUE
empty_ary_alloc(VALUE klass)
{
- RUBY_DTRACE_CREATE_HOOK(ARRAY, 0);
+ if (RUBY_DTRACE_ARRAY_CREATE_ENABLED()) {
+ RUBY_DTRACE_ARRAY_CREATE(0, rb_sourcefile(), rb_sourceline());
+ }
+
return ary_alloc(klass);
}
@@ -469,16 +462,21 @@ ary_new(VALUE klass, long capa)
rb_raise(rb_eArgError, "array size too big");
}
- RUBY_DTRACE_CREATE_HOOK(ARRAY, capa);
+ if (RUBY_DTRACE_ARRAY_CREATE_ENABLED()) {
+ RUBY_DTRACE_ARRAY_CREATE(capa, rb_sourcefile(), rb_sourceline());
+ }
- ary = ary_alloc(klass);
if (capa > RARRAY_EMBED_LEN_MAX) {
ptr = ALLOC_N(VALUE, capa);
+ ary = ary_alloc(klass);
FL_UNSET_EMBED(ary);
ARY_SET_PTR(ary, ptr);
ARY_SET_CAPA(ary, capa);
ARY_SET_HEAP_LEN(ary, 0);
}
+ else {
+ ary = ary_alloc(klass);
+ }
return ary;
}
@@ -496,7 +494,7 @@ rb_ary_new(void)
}
VALUE
-(rb_ary_new_from_args)(long n, ...)
+rb_ary_new_from_args(long n, ...)
{
va_list ar;
VALUE ary;
@@ -506,7 +504,7 @@ VALUE
va_start(ar, n);
for (i=0; i<n; i++) {
- ARY_SET(ary, i, va_arg(ar, VALUE));
+ RARRAY_ASET(ary, i, va_arg(ar, VALUE));
}
va_end(ar);
@@ -534,15 +532,6 @@ rb_ary_tmp_new(long capa)
return ary_new(0, capa);
}
-VALUE
-rb_ary_tmp_new_fill(long capa)
-{
- VALUE ary = ary_new(0, capa);
- ary_memfill(ary, 0, capa, Qnil);
- ARY_SET_LEN(ary, capa);
- return ary;
-}
-
void
rb_ary_free(VALUE ary)
{
@@ -588,7 +577,7 @@ ary_make_shared(VALUE ary)
}
else {
long capa = ARY_CAPA(ary), len = RARRAY_LEN(ary);
- NEWOBJ_OF(shared, struct RArray, 0, T_ARRAY | (RGENGC_WB_PROTECTED_ARRAY ? FL_WB_PROTECTED : 0));
+ NEWOBJ_OF(shared, struct RArray, 0, T_ARRAY); /* keep shared ary as shady */
FL_UNSET_EMBED(shared);
ARY_SET_LEN((VALUE)shared, capa);
@@ -664,16 +653,16 @@ rb_ary_s_try_convert(VALUE dummy, VALUE ary)
/*
* call-seq:
- * Array.new(size=0, default=nil)
+ * Array.new(size=0, obj=nil)
* Array.new(array)
* Array.new(size) {|index| block }
*
* Returns a new array.
*
* In the first form, if no arguments are sent, the new array will be empty.
- * When a +size+ and an optional +default+ are sent, an array is created with
- * +size+ copies of +default+. Take notice that all elements will reference the
- * same object +default+.
+ * When a +size+ and an optional +obj+ are sent, an array is created with
+ * +size+ copies of +obj+. Take notice that all elements will reference the
+ * same object +obj+.
*
* The second form creates a copy of the array passed as a parameter (the
* array is generated by calling to_ary on the parameter).
@@ -747,14 +736,12 @@ rb_ary_initialize(int argc, VALUE *argv, VALUE ary)
}
len = NUM2LONG(size);
- /* NUM2LONG() may call size.to_int, ary can be frozen, modified, etc */
if (len < 0) {
rb_raise(rb_eArgError, "negative array size");
}
if (len > ARY_MAX_SIZE) {
rb_raise(rb_eArgError, "array size too big");
}
- /* recheck after argument conversion */
rb_ary_modify(ary);
ary_resize_capa(ary, len);
if (rb_block_given_p()) {
@@ -822,7 +809,7 @@ rb_ary_store(VALUE ary, long idx, VALUE val)
if (idx >= len) {
ARY_SET_LEN(ary, idx + 1);
}
- ARY_SET(ary, idx, val);
+ RARRAY_ASET(ary, idx, val);
}
static VALUE
@@ -866,7 +853,7 @@ enum ary_take_pos_flags
};
static VALUE
-ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos_flags last)
+ary_take_first_or_last(int argc, VALUE *argv, VALUE ary, enum ary_take_pos_flags last)
{
VALUE nv;
long n;
@@ -905,20 +892,33 @@ VALUE
rb_ary_push(VALUE ary, VALUE item)
{
long idx = RARRAY_LEN(ary);
- VALUE target_ary = ary_ensure_room_for_push(ary, 1);
- RARRAY_PTR_USE(ary, ptr, {
- RB_OBJ_WRITE(target_ary, &ptr[idx], item);
- });
+
+ ary_ensure_room_for_push(ary, 1);
+ RARRAY_ASET(ary, idx, item);
+ ARY_SET_LEN(ary, idx + 1);
+ return ary;
+}
+
+static VALUE
+rb_ary_push_1(VALUE ary, VALUE item)
+{
+ long idx = RARRAY_LEN(ary);
+
+ if (idx >= ARY_CAPA(ary)) {
+ ary_double_capa(ary, idx);
+ }
+ RARRAY_ASET(ary, idx, item);
ARY_SET_LEN(ary, idx + 1);
return ary;
}
VALUE
-rb_ary_cat(VALUE ary, const VALUE *argv, long len)
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
{
long oldlen = RARRAY_LEN(ary);
- VALUE target_ary = ary_ensure_room_for_push(ary, len);
- ary_memcpy0(ary, oldlen, len, argv, target_ary);
+
+ ary_ensure_room_for_push(ary, len);
+ ary_memcpy(ary, oldlen, len, ptr);
ARY_SET_LEN(ary, oldlen + len);
return ary;
}
@@ -1015,11 +1015,11 @@ rb_ary_shift(VALUE ary)
}
assert(!ARY_EMBED_P(ary)); /* ARY_EMBED_LEN_MAX < ARY_DEFAULT_SIZE */
- ARY_SET(ary, 0, Qnil);
+ RARRAY_ASET(ary, 0, Qnil);
ary_make_shared(ary);
}
else if (ARY_SHARED_OCCUPIED(ARY_SHARED(ary))) {
- RARRAY_PTR_USE(ary, ptr, ptr[0] = Qnil);
+ RARRAY_ASET(ary, 0, Qnil);
}
ARY_INCREASE_PTR(ary, 1); /* shift ptr */
ARY_INCREASE_LEN(ary, -1);
@@ -1065,28 +1065,21 @@ rb_ary_shift_m(int argc, VALUE *argv, VALUE ary)
n = RARRAY_LEN(result);
if (ARY_SHARED_P(ary)) {
if (ARY_SHARED_OCCUPIED(ARY_SHARED(ary))) {
- setup_occupied_shared:
ary_mem_clear(ary, 0, n);
}
ARY_INCREASE_PTR(ary, n);
}
else {
- if (RARRAY_LEN(ary) < ARY_DEFAULT_SIZE) {
- RARRAY_PTR_USE(ary, ptr, {
- MEMMOVE(ptr, ptr+n, VALUE, RARRAY_LEN(ary)-n);
- }); /* WB: no new reference */
- }
- else {
- ary_make_shared(ary);
- goto setup_occupied_shared;
- }
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMMOVE(ptr, ptr + n, VALUE, RARRAY_LEN(ary)-n);
+ }); /* WB: no new reference */
}
ARY_INCREASE_LEN(ary, -n);
return result;
}
-static VALUE
+static void
ary_ensure_room_for_unshift(VALUE ary, int argc)
{
long len = RARRAY_LEN(ary);
@@ -1094,10 +1087,6 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
long capa;
const VALUE *head, *sharedp;
- if (len > ARY_MAX_SIZE - argc) {
- rb_raise(rb_eIndexError, "index %ld too big", new_len);
- }
-
if (ARY_SHARED_P(ary)) {
VALUE shared = ARY_SHARED(ary);
capa = RARRAY_LEN(shared);
@@ -1132,16 +1121,12 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
head = sharedp + argc + room;
}
ARY_SET_PTR(ary, head - argc);
- assert(ARY_SHARED_OCCUPIED(ARY_SHARED(ary)));
- return ARY_SHARED(ary);
}
else {
/* sliding items */
RARRAY_PTR_USE(ary, ptr, {
MEMMOVE(ptr + argc, ptr, VALUE, len);
});
-
- return ary;
}
}
@@ -1161,15 +1146,14 @@ static VALUE
rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary)
{
long len = RARRAY_LEN(ary);
- VALUE target_ary;
if (argc == 0) {
rb_ary_modify_check(ary);
return ary;
}
- target_ary = ary_ensure_room_for_unshift(ary, argc);
- ary_memcpy0(ary, 0, argc, argv, target_ary);
+ ary_ensure_room_for_unshift(ary, argc);
+ ary_memcpy(ary, 0, argc, argv);
ARY_SET_LEN(ary, len + argc);
return ary;
}
@@ -1256,7 +1240,7 @@ rb_ary_subseq(VALUE ary, long beg, long len)
*/
VALUE
-rb_ary_aref(int argc, const VALUE *argv, VALUE ary)
+rb_ary_aref(int argc, VALUE *argv, VALUE ary)
{
VALUE arg;
long beg, len;
@@ -1302,7 +1286,7 @@ rb_ary_aref(int argc, const VALUE *argv, VALUE ary)
* a.at(-1) #=> "e"
*/
-VALUE
+static VALUE
rb_ary_at(VALUE ary, VALUE pos)
{
return rb_ary_entry(ary, NUM2LONG(pos));
@@ -1351,7 +1335,7 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary)
*/
VALUE
-rb_ary_last(int argc, const VALUE *argv, VALUE ary)
+rb_ary_last(int argc, VALUE *argv, VALUE ary)
{
if (argc == 0) {
long len = RARRAY_LEN(ary);
@@ -1580,24 +1564,20 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl)
olen = RARRAY_LEN(ary); /* ary may be resized in rpl.to_ary too */
}
if (beg >= olen) {
- VALUE target_ary;
if (beg > ARY_MAX_SIZE - rlen) {
rb_raise(rb_eIndexError, "index %ld too big", beg);
}
- target_ary = ary_ensure_room_for_push(ary, rlen-len); /* len is 0 or negative */
+ ary_ensure_room_for_push(ary, rlen-len); /* len is 0 or negative */
len = beg + rlen;
ary_mem_clear(ary, olen, beg - olen);
if (rlen > 0) {
- ary_memcpy0(ary, beg, rlen, RARRAY_CONST_PTR(rpl), target_ary);
+ ary_memcpy(ary, beg, rlen, RARRAY_CONST_PTR(rpl));
}
ARY_SET_LEN(ary, len);
}
else {
long alen;
- if (olen - len > ARY_MAX_SIZE - rlen) {
- rb_raise(rb_eIndexError, "index %ld too big", olen + rlen - len);
- }
rb_ary_modify(ary);
alen = olen + rlen - len;
if (alen >= ARY_CAPA(ary)) {
@@ -1614,7 +1594,6 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl)
MEMMOVE(RARRAY_PTR(ary) + beg, RARRAY_CONST_PTR(rpl), VALUE, rlen);
}
}
- RB_GC_GUARD(rpl);
}
void
@@ -1750,9 +1729,7 @@ fixnum:
* Inserts the given values before the element with the given +index+.
*
* Negative indices count backwards from the end of the array, where +-1+ is
- * the last element. If a negative index is used, the given values will be
- * inserted after that element, so using an index of +-1+ will insert the
- * values at the end of the array.
+ * the last element.
*
* a = %w{ a b c d }
* a.insert(2, 99) #=> ["a", "b", 99, "c", "d"]
@@ -1766,8 +1743,8 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary)
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
rb_ary_modify_check(ary);
- pos = NUM2LONG(argv[0]);
if (argc == 1) return ary;
+ pos = NUM2LONG(argv[0]);
if (pos == -1) {
pos = RARRAY_LEN(ary);
}
@@ -1793,9 +1770,9 @@ ary_enum_length(VALUE ary, VALUE args, VALUE eobj)
* ary.each -> Enumerator
*
* Calls the given block once for each element in +self+, passing that element
- * as a parameter. Returns the array itself.
+ * as a parameter.
*
- * If no block is given, an Enumerator is returned.
+ * An Enumerator is returned if no block is given.
*
* a = [ "a", "b", "c" ]
* a.each {|x| print x, " -- " }
@@ -1806,9 +1783,10 @@ ary_enum_length(VALUE ary, VALUE args, VALUE eobj)
*/
VALUE
-rb_ary_each(VALUE ary)
+rb_ary_each(VALUE array)
{
long i;
+ volatile VALUE ary = array;
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
for (i=0; i<RARRAY_LEN(ary); i++) {
@@ -2153,7 +2131,8 @@ rb_ary_to_a(VALUE ary)
* ary.to_h -> hash
*
* Returns the result of interpreting <i>ary</i> as an array of
- * <tt>[key, value]</tt> pairs.
+ * <tt>[key, value]</tt> pairs. Elements other than pairs of
+ * values are ignored.
*
* [[:foo, :bar], [1, 2]].to_h
* # => {:foo => :bar, 1 => 2}
@@ -2165,17 +2144,10 @@ rb_ary_to_h(VALUE ary)
long i;
VALUE hash = rb_hash_new();
for (i=0; i<RARRAY_LEN(ary); i++) {
- const VALUE elt = rb_ary_elt(ary, i);
- const VALUE key_value_pair = rb_check_array_type(elt);
- if (NIL_P(key_value_pair)) {
- rb_raise(rb_eTypeError, "wrong element type %"PRIsVALUE" at %ld (expected array)",
- rb_obj_class(elt), i);
- }
- if (RARRAY_LEN(key_value_pair) != 2) {
- rb_raise(rb_eArgError, "wrong array length at %ld (expected 2, was %ld)",
- i, RARRAY_LEN(key_value_pair));
+ VALUE key_value_pair = rb_check_array_type(rb_ary_elt(ary, i));
+ if (!NIL_P(key_value_pair) && (RARRAY_LEN(key_value_pair) == 2)) {
+ rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1));
}
- rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1));
}
return hash;
}
@@ -2441,9 +2413,9 @@ sort_2(const void *ap, const void *bp, void *dummy)
* Comparisons for the sort will be done using the <code><=></code> operator
* or using an optional code block.
*
- * The block must implement a comparison between +a+ and +b+ and return
- * an integer less than 0 when +b+ follows +a+, +0+ when +a+ and +b+
- * are equivalent, or an integer greater than 0 when +a+ follows +b+.
+ * The block must implement a comparison between +a+ and +b+, and return
+ * +-1+, when +a+ follows +b+, +0+ when +a+ and +b+ are equivalent, or ++1+
+ * if +b+ follows +a+.
*
* See also Enumerable#sort_by.
*
@@ -2474,8 +2446,8 @@ rb_ary_sort_bang(VALUE ary)
if (ARY_EMBED_P(tmp)) {
if (ARY_SHARED_P(ary)) { /* ary might be destructively operated in the given block */
rb_ary_unshare(ary);
- FL_SET_EMBED(ary);
}
+ FL_SET_EMBED(ary);
ary_memcpy(ary, 0, ARY_EMBED_LEN(tmp), ARY_EMBED_PTR(tmp));
ARY_SET_LEN(ary, ARY_EMBED_LEN(tmp));
}
@@ -2522,9 +2494,9 @@ rb_ary_sort_bang(VALUE ary)
* Comparisons for the sort will be done using the <code><=></code> operator
* or using an optional code block.
*
- * The block must implement a comparison between +a+ and +b+ and return
- * an integer less than 0 when +b+ follows +a+, +0+ when +a+ and +b+
- * are equivalent, or an integer greater than 0 when +a+ follows +b+.
+ * The block must implement a comparison between +a+ and +b+, and return
+ * +-1+, when +a+ follows +b+, +0+ when +a+ and +b+ are equivalent, or ++1+
+ * if +b+ follows +a+.
*
*
* See also Enumerable#sort_by.
@@ -2542,8 +2514,6 @@ rb_ary_sort(VALUE ary)
return ary;
}
-static VALUE rb_ary_bsearch_index(VALUE ary);
-
/*
* call-seq:
* ary.bsearch {|x| block } -> elem
@@ -2600,30 +2570,6 @@ static VALUE rb_ary_bsearch_index(VALUE ary);
static VALUE
rb_ary_bsearch(VALUE ary)
{
- VALUE index_result = rb_ary_bsearch_index(ary);
-
- if (FIXNUM_P(index_result)) {
- return rb_ary_entry(ary, FIX2LONG(index_result));
- }
- return index_result;
-}
-
-/*
- * call-seq:
- * ary.bsearch_index {|x| block } -> int or nil
- *
- * By using binary search, finds an index of a value from this array which
- * meets the given condition in O(log n) where n is the size of the array.
- *
- * It supports two modes, depending on the nature of the block and they are
- * exactly the same as in the case of #bsearch method with the only difference
- * being that this method returns the index of the element instead of the
- * element itself. For more details consult the documentation for #bsearch.
- */
-
-static VALUE
-rb_ary_bsearch_index(VALUE ary)
-{
long low = 0, high = RARRAY_LEN(ary), mid;
int smaller = 0, satisfied = 0;
VALUE v, val;
@@ -2634,8 +2580,8 @@ rb_ary_bsearch_index(VALUE ary)
val = rb_ary_entry(ary, mid);
v = rb_yield(val);
if (FIXNUM_P(v)) {
- if (v == INT2FIX(0)) return INT2FIX(mid);
- smaller = (SIGNED_VALUE)v < 0; /* Fixnum preserves its sign-bit */
+ if (FIX2INT(v) == 0) return val;
+ smaller = FIX2INT(v) < 0;
}
else if (v == Qtrue) {
satisfied = 1;
@@ -2646,16 +2592,16 @@ rb_ary_bsearch_index(VALUE ary)
}
else if (rb_obj_is_kind_of(v, rb_cNumeric)) {
const VALUE zero = INT2FIX(0);
- switch (rb_cmpint(rb_funcallv(v, id_cmp, 1, &zero), v, zero)) {
- case 0: return INT2FIX(mid);
- case 1: smaller = 1; break;
- case -1: smaller = 0;
+ switch (rb_cmpint(rb_funcallv(v, id_cmp, 1, &zero), v, INT2FIX(0))) {
+ case 0: return val;
+ case 1: smaller = 1; break;
+ case -1: smaller = 0;
}
}
else {
- rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE
- " (must be numeric, true, false or nil)",
- rb_obj_class(v));
+ rb_raise(rb_eTypeError, "wrong argument type %s"
+ " (must be numeric, true, false or nil)",
+ rb_obj_classname(v));
}
if (smaller) {
high = mid;
@@ -2664,13 +2610,14 @@ rb_ary_bsearch_index(VALUE ary)
low = mid + 1;
}
}
+ if (low == RARRAY_LEN(ary)) return Qnil;
if (!satisfied) return Qnil;
- return INT2FIX(low);
+ return rb_ary_entry(ary, low);
}
static VALUE
-sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, dummy))
+sort_by_i(VALUE i)
{
return rb_yield(i);
}
@@ -2716,9 +2663,8 @@ rb_ary_sort_by_bang(VALUE ary)
* If no block is given, an Enumerator is returned instead.
*
* a = [ "a", "b", "c", "d" ]
- * a.collect { |x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
- * a.map.with_index { |x, i| x * i } #=> ["", "b", "cc", "ddd"]
- * a #=> ["a", "b", "c", "d"]
+ * a.map { |x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
+ * a #=> ["a", "b", "c", "d"]
*/
static VALUE
@@ -2753,8 +2699,6 @@ rb_ary_collect(VALUE ary)
* a = [ "a", "b", "c", "d" ]
* a.map! {|x| x + "!" }
* a #=> [ "a!", "b!", "c!", "d!" ]
- * a.collect!.with_index {|x, i| x[0...i] }
- * a #=> ["", "b", "c!", "d!"]
*/
static VALUE
@@ -2771,7 +2715,7 @@ rb_ary_collect_bang(VALUE ary)
}
VALUE
-rb_get_values_at(VALUE obj, long olen, int argc, const VALUE *argv, VALUE (*func) (VALUE, long))
+rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE (*func) (VALUE, long))
{
VALUE result = rb_ary_new2(argc);
long beg, len, i, j;
@@ -2855,50 +2799,6 @@ rb_ary_select(VALUE ary)
return result;
}
-struct select_bang_arg {
- VALUE ary;
- long len[2];
-};
-
-static VALUE
-select_bang_i(VALUE a)
-{
- volatile struct select_bang_arg *arg = (void *)a;
- VALUE ary = arg->ary;
- long i1, i2;
-
- for (i1 = i2 = 0; i1 < RARRAY_LEN(ary); arg->len[0] = ++i1) {
- VALUE v = RARRAY_AREF(ary, i1);
- if (!RTEST(rb_yield(v))) continue;
- if (i1 != i2) {
- rb_ary_store(ary, i2, v);
- }
- arg->len[1] = ++i2;
- }
- return (i1 == i2) ? Qnil : ary;
-}
-
-static VALUE
-select_bang_ensure(VALUE a)
-{
- volatile struct select_bang_arg *arg = (void *)a;
- VALUE ary = arg->ary;
- long len = RARRAY_LEN(ary);
- long i1 = arg->len[0], i2 = arg->len[1];
-
- if (i2 < len && i2 < i1) {
- long tail = 0;
- if (i1 < len) {
- tail = len - i1;
- RARRAY_PTR_USE(ary, ptr, {
- MEMMOVE(ptr + i2, ptr + i1, VALUE, tail);
- });
- }
- ARY_SET_LEN(ary, i2 + tail);
- }
- return ary;
-}
-
/*
* call-seq:
* ary.select! {|item| block } -> ary or nil
@@ -2907,8 +2807,6 @@ select_bang_ensure(VALUE a)
* Invokes the given block passing in successive elements from +self+,
* deleting elements for which the block returns a +false+ value.
*
- * The array may not be changed instantly every time the block is called.
- *
* If changes were made, it will return +self+, otherwise it returns +nil+.
*
* See also Array#keep_if
@@ -2920,14 +2818,23 @@ select_bang_ensure(VALUE a)
static VALUE
rb_ary_select_bang(VALUE ary)
{
- struct select_bang_arg args;
+ long i1, i2;
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rb_ary_modify(ary);
+ for (i1 = i2 = 0; i1 < RARRAY_LEN(ary); i1++) {
+ VALUE v = RARRAY_AREF(ary, i1);
+ if (!RTEST(rb_yield(v))) continue;
+ if (i1 != i2) {
+ rb_ary_store(ary, i2, v);
+ }
+ i2++;
+ }
- args.ary = ary;
- args.len[0] = args.len[1] = 0;
- return rb_ensure(select_bang_i, (VALUE)&args, select_bang_ensure, (VALUE)&args);
+ if (i1 == i2) return Qnil;
+ if (i2 < i1)
+ ARY_SET_LEN(ary, i2);
+ return ary;
}
/*
@@ -3163,39 +3070,30 @@ ary_reject(VALUE orig, VALUE result)
for (i = 0; i < RARRAY_LEN(orig); i++) {
VALUE v = RARRAY_AREF(orig, i);
if (!RTEST(rb_yield(v))) {
- rb_ary_push(result, v);
+ rb_ary_push_1(result, v);
}
}
return result;
}
static VALUE
-reject_bang_i(VALUE a)
-{
- volatile struct select_bang_arg *arg = (void *)a;
- VALUE ary = arg->ary;
- long i1, i2;
-
- for (i1 = i2 = 0; i1 < RARRAY_LEN(ary); arg->len[0] = ++i1) {
- VALUE v = RARRAY_AREF(ary, i1);
- if (RTEST(rb_yield(v))) continue;
- if (i1 != i2) {
- rb_ary_store(ary, i2, v);
- }
- arg->len[1] = ++i2;
- }
- return (i1 == i2) ? Qnil : ary;
-}
-
-static VALUE
ary_reject_bang(VALUE ary)
{
- struct select_bang_arg args;
+ long i;
+ VALUE result = Qnil;
rb_ary_modify_check(ary);
- args.ary = ary;
- args.len[0] = args.len[1] = 0;
- return rb_ensure(reject_bang_i, (VALUE)&args, select_bang_ensure, (VALUE)&args);
+ for (i = 0; i < RARRAY_LEN(ary); ) {
+ VALUE v = RARRAY_AREF(ary, i);
+ if (RTEST(rb_yield(v))) {
+ rb_ary_delete_at(ary, i);
+ result = ary;
+ }
+ else {
+ i++;
+ }
+ }
+ return result;
}
/*
@@ -3203,10 +3101,11 @@ ary_reject_bang(VALUE ary)
* ary.reject! { |item| block } -> ary or nil
* ary.reject! -> Enumerator
*
- * Deletes every element of +self+ for which the block evaluates to +true+,
- * if no changes were made returns +nil+.
+ * Equivalent to Array#delete_if, deleting elements from +self+ for which the
+ * block evaluates to +true+, but returns +nil+ if no changes were made.
*
- * The array may not be changed instantly every time the block is called.
+ * The array is changed instantly every time the block is called, not after
+ * the iteration is over.
*
* See also Enumerable#reject and Array#delete_if.
*
@@ -3226,7 +3125,7 @@ rb_ary_reject_bang(VALUE ary)
* ary.reject -> Enumerator
*
* Returns a new array containing the items in +self+ for which the given
- * block is not +true+. The ordering of non-rejected elements is maintained.
+ * block is not +true+.
*
* See also Array#delete_if
*
@@ -3271,9 +3170,8 @@ rb_ary_delete_if(VALUE ary)
}
static VALUE
-take_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, cbarg))
+take_i(VALUE val, VALUE *args, int argc, VALUE *argv)
{
- VALUE *args = (VALUE *)cbarg;
if (args[1]-- == 0) rb_iter_break();
if (argc > 1) val = rb_ary_new4(argc, argv);
rb_ary_push(args[0], val);
@@ -3334,10 +3232,8 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
if (rb_block_given_p()) {
int arity = rb_block_arity();
- if (arity > 1) {
- VALUE work, *tmp;
-
- tmp = ALLOCV_N(VALUE, work, argc+1);
+ if (arity > 1 && argc+1 < 0x100) {
+ VALUE *tmp = ALLOCA_N(VALUE, argc+1);
for (i=0; i<RARRAY_LEN(ary); i++) {
tmp[0] = RARRAY_AREF(ary, i);
@@ -3346,8 +3242,6 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
}
rb_yield_values2(argc+1, tmp);
}
-
- if (work) ALLOCV_END(work);
}
else {
for (i=0; i<RARRAY_LEN(ary); i++) {
@@ -3586,7 +3480,7 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
for (i=beg; i<end; i++) {
v = rb_yield(LONG2NUM(i));
if (i>=RARRAY_LEN(ary)) break;
- ARY_SET(ary, i, v);
+ RARRAY_ASET(ary, i, v);
}
}
else {
@@ -3608,13 +3502,6 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
* c #=> [ "a", "b", "c", "d", "e", "f" ]
* a #=> [ "a", "b", "c" ]
*
- * Note that
- * x += y
- * is the same as
- * x = x + y
- * This means that it produces a new array. As a consequence,
- * repeated use of <code>+=</code> on arrays can be quite inefficient.
- *
* See also Array#concat.
*/
@@ -3727,7 +3614,7 @@ rb_ary_times(VALUE ary, VALUE times)
/*
* call-seq:
- * ary.assoc(obj) -> element_ary or nil
+ * ary.assoc(obj) -> new_ary or nil
*
* Searches through an array whose elements are also arrays comparing +obj+
* with the first element of each contained array using <code>obj.==</code>.
@@ -3762,7 +3649,7 @@ rb_ary_assoc(VALUE ary, VALUE key)
/*
* call-seq:
- * ary.rassoc(obj) -> element_ary or nil
+ * ary.rassoc(obj) -> new_ary or nil
*
* Searches through the array whose elements are also arrays.
*
@@ -3846,7 +3733,7 @@ rb_ary_equal(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
if (!RB_TYPE_P(ary2, T_ARRAY)) {
- if (!rb_respond_to(ary2, idTo_ary)) {
+ if (!rb_respond_to(ary2, rb_intern("to_ary"))) {
return Qfalse;
}
return rb_equal(ary2, ary1);
@@ -3887,6 +3774,27 @@ rb_ary_eql(VALUE ary1, VALUE ary2)
return rb_exec_recursive_paired(recursive_eql, ary1, ary2, ary2);
}
+static VALUE
+recursive_hash(VALUE ary, VALUE dummy, int recur)
+{
+ long i;
+ st_index_t h;
+ VALUE n;
+
+ h = rb_hash_start(RARRAY_LEN(ary));
+ if (recur) {
+ h = rb_hash_uint(h, NUM2LONG(rb_hash(rb_cArray)));
+ }
+ else {
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ n = rb_hash(RARRAY_AREF(ary, i));
+ h = rb_hash_uint(h, NUM2LONG(n));
+ }
+ }
+ h = rb_hash_end(h);
+ return LONG2FIX(h);
+}
+
/*
* call-seq:
* ary.hash -> fixnum
@@ -3895,25 +3803,12 @@ rb_ary_eql(VALUE ary1, VALUE ary2)
*
* Two arrays with the same content will have the same hash code (and will
* compare using #eql?).
- *
- * See also Object#hash.
*/
static VALUE
rb_ary_hash(VALUE ary)
{
- long i;
- st_index_t h;
- VALUE n;
-
- h = rb_hash_start(RARRAY_LEN(ary));
- h = rb_hash_uint(h, (st_index_t)rb_ary_hash);
- for (i=0; i<RARRAY_LEN(ary); i++) {
- n = rb_hash(RARRAY_AREF(ary, i));
- h = rb_hash_uint(h, NUM2LONG(n));
- }
- h = rb_hash_end(h);
- return LONG2FIX(h);
+ return rb_exec_recursive_outer(recursive_hash, ary, 0);
}
/*
@@ -3932,15 +3827,9 @@ VALUE
rb_ary_includes(VALUE ary, VALUE item)
{
long i;
- VALUE e;
for (i=0; i<RARRAY_LEN(ary); i++) {
- e = RARRAY_AREF(ary, i);
- switch (rb_equal_opt(e, item)) {
- case Qundef:
- if (rb_equal(e, item)) return Qtrue;
- break;
- case Qtrue:
+ if (rb_equal(RARRAY_AREF(ary, i), item)) {
return Qtrue;
}
}
@@ -3975,26 +3864,21 @@ recursive_cmp(VALUE ary1, VALUE ary2, int recur)
* Comparison --- Returns an integer (+-1+, +0+, or <code>+1</code>) if this
* array is less than, equal to, or greater than +other_ary+.
*
+ * +nil+ is returned if the two values are incomparable.
+ *
* Each object in each array is compared (using the <=> operator).
*
- * Arrays are compared in an "element-wise" manner; the first element of +ary+
- * is compared with the first one of +other_ary+ using the <=> operator, then
- * each of the second elements, etc...
- * As soon as the result of any such comparison is non zero (i.e. the two
- * corresponding elements are not equal), that result is returned for the
- * whole array comparison.
+ * Arrays are compared in an "element-wise" manner; the first two elements
+ * that are not equal will determine the return value for the whole
+ * comparison.
*
- * If all the elements are equal, then the result is based on a comparison of
+ * If all the values are equal, then the return is based on a comparison of
* the array lengths. Thus, two arrays are "equal" according to Array#<=> if,
* and only if, they have the same length and the value of each element is
* equal to the value of the corresponding element in the other array.
*
- * +nil+ is returned if the +other_ary+ is not an array or if the comparison
- * of two elements returned +nil+.
- *
* [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1
* [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1
- * [ 1, 2 ] <=> [ 1, :two ] #=> nil
*
*/
@@ -4021,10 +3905,7 @@ ary_add_hash(VALUE hash, VALUE ary)
long i;
for (i=0; i<RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_AREF(ary, i);
- if (rb_hash_lookup2(hash, elt, Qundef) == Qundef) {
- rb_hash_aset(hash, elt, elt);
- }
+ rb_hash_aset(hash, RARRAY_AREF(ary, i), Qtrue);
}
return hash;
}
@@ -4074,7 +3955,6 @@ ary_recycle_hash(VALUE hash)
RHASH(hash)->ntbl = 0;
st_free_table(tbl);
}
- RB_GC_GUARD(hash);
}
/*
@@ -4098,7 +3978,7 @@ static VALUE
rb_ary_diff(VALUE ary1, VALUE ary2)
{
VALUE ary3;
- VALUE hash;
+ volatile VALUE hash;
long i;
hash = ary_make_hash(to_ary(ary2));
@@ -4155,14 +4035,6 @@ rb_ary_and(VALUE ary1, VALUE ary2)
return ary3;
}
-static int
-ary_hash_orset(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
-{
- if (existing) return ST_STOP;
- *key = *value = (VALUE)arg;
- return ST_CONTINUE;
-}
-
/*
* call-seq:
* ary | other_ary -> new_ary
@@ -4181,23 +4053,22 @@ static VALUE
rb_ary_or(VALUE ary1, VALUE ary2)
{
VALUE hash, ary3;
- long i;
ary2 = to_ary(ary2);
- hash = ary_make_hash(ary1);
-
- for (i=0; i<RARRAY_LEN(ary2); i++) {
- VALUE elt = RARRAY_AREF(ary2, i);
- if (!st_update(RHASH_TBL_RAW(hash), (st_data_t)elt, ary_hash_orset, (st_data_t)elt)) {
- RB_OBJ_WRITTEN(hash, Qundef, elt);
- }
- }
- ary3 = rb_hash_values(hash);
+ hash = ary_add_hash(ary_make_hash(ary1), ary2);
+ ary3 = rb_hash_keys(hash);
ary_recycle_hash(hash);
return ary3;
}
static int
+push_key(st_data_t key, st_data_t val, st_data_t ary)
+{
+ rb_ary_push((VALUE)ary, (VALUE)key);
+ return ST_CONTINUE;
+}
+
+static int
push_value(st_data_t key, st_data_t val, st_data_t ary)
{
rb_ary_push((VALUE)ary, (VALUE)val);
@@ -4216,8 +4087,6 @@ push_value(st_data_t key, st_data_t val, st_data_t ary)
*
* It compares values using their #hash and #eql? methods for efficiency.
*
- * +self+ is traversed in order, and the first occurrence is kept.
- *
* Returns +nil+ if no changes are made (that is, no duplicates are found).
*
* a = [ "a", "a", "b", "b", "c" ]
@@ -4240,23 +4109,36 @@ rb_ary_uniq_bang(VALUE ary)
rb_ary_modify_check(ary);
if (RARRAY_LEN(ary) <= 1)
return Qnil;
- if (rb_block_given_p())
+ if (rb_block_given_p()) {
hash = ary_make_hash_by(ary);
- else
- hash = ary_make_hash(ary);
-
- hash_size = RHASH_SIZE(hash);
- if (RARRAY_LEN(ary) == hash_size) {
- return Qnil;
+ hash_size = RHASH_SIZE(hash);
+ if (RARRAY_LEN(ary) == hash_size) {
+ return Qnil;
+ }
+ rb_ary_modify_check(ary);
+ ARY_SET_LEN(ary, 0);
+ if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) {
+ rb_ary_unshare(ary);
+ FL_SET_EMBED(ary);
+ }
+ ary_resize_capa(ary, hash_size);
+ st_foreach(rb_hash_tbl_raw(hash), push_value, ary);
}
- rb_ary_modify_check(ary);
- ARY_SET_LEN(ary, 0);
- if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) {
- rb_ary_unshare(ary);
- FL_SET_EMBED(ary);
+ else {
+ hash = ary_make_hash(ary);
+ hash_size = RHASH_SIZE(hash);
+ if (RARRAY_LEN(ary) == hash_size) {
+ return Qnil;
+ }
+ rb_ary_modify_check(ary);
+ ARY_SET_LEN(ary, 0);
+ if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) {
+ rb_ary_unshare(ary);
+ FL_SET_EMBED(ary);
+ }
+ ary_resize_capa(ary, hash_size);
+ st_foreach(rb_hash_tbl_raw(hash), push_key, ary);
}
- ary_resize_capa(ary, hash_size);
- st_foreach(rb_hash_tbl_raw(hash), push_value, ary);
ary_recycle_hash(hash);
return ary;
@@ -4273,8 +4155,6 @@ rb_ary_uniq_bang(VALUE ary)
*
* It compares values using their #hash and #eql? methods for efficiency.
*
- * +self+ is traversed in order, and the first occurrence is kept.
- *
* a = [ "a", "a", "b", "b", "c" ]
* a.uniq # => ["a", "b", "c"]
*
@@ -4296,7 +4176,7 @@ rb_ary_uniq(VALUE ary)
}
else {
hash = ary_make_hash(ary);
- uniq = rb_hash_values(hash);
+ uniq = rb_hash_keys(hash);
}
RBASIC_SET_CLASS(uniq, rb_obj_class(ary));
ary_recycle_hash(hash);
@@ -4426,15 +4306,11 @@ flatten(VALUE ary, int level, int *modified)
while (1) {
while (i < RARRAY_LEN(ary)) {
elt = RARRAY_AREF(ary, i++);
- if (level >= 0 && RARRAY_LEN(stack) / 2 >= level) {
- rb_ary_push(result, elt);
- continue;
- }
tmp = rb_check_array_type(elt);
if (RBASIC(result)->klass) {
rb_raise(rb_eRuntimeError, "flatten reentered");
}
- if (NIL_P(tmp)) {
+ if (NIL_P(tmp) || (level >= 0 && RARRAY_LEN(stack) / 2 >= level)) {
rb_ary_push(result, elt);
}
else {
@@ -4463,7 +4339,7 @@ flatten(VALUE ary, int level, int *modified)
st_free_table(memo);
- RBASIC_SET_CLASS(result, rb_obj_class(ary));
+ RBASIC_SET_CLASS(result, rb_class_of(ary));
return result;
}
@@ -4550,7 +4426,7 @@ rb_ary_flatten(int argc, VALUE *argv, VALUE ary)
#define OPTHASH_GIVEN_P(opts) \
(argc > 0 && !NIL_P((opts) = rb_check_hash_type(argv[argc-1])) && (--argc, 1))
-static ID id_random;
+static VALUE sym_random;
#define RAND_UPTO(max) (long)rb_random_ulong_limited((randgen), (max)-1)
@@ -4561,13 +4437,7 @@ static ID id_random;
*
* Shuffles elements in +self+ in place.
*
- * a = [ 1, 2, 3 ] #=> [1, 2, 3]
- * a.shuffle! #=> [2, 3, 1]
- * a #=> [2, 3, 1]
- *
* The optional +rng+ argument will be used as the random number generator.
- *
- * a.shuffle!(random: Random.new(1)) #=> [1, 3, 2]
*/
static VALUE
@@ -4577,14 +4447,7 @@ rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary)
long i, len;
if (OPTHASH_GIVEN_P(opts)) {
- VALUE rnd;
- ID keyword_ids[1];
-
- keyword_ids[0] = id_random;
- rb_get_kwargs(opts, keyword_ids, 0, 1, &rnd);
- if (rnd != Qundef) {
- randgen = rnd;
- }
+ randgen = rb_hash_lookup2(opts, sym_random, randgen);
}
rb_check_arity(argc, 0, 0);
rb_ary_modify(ary);
@@ -4614,7 +4477,6 @@ rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary)
*
* a = [ 1, 2, 3 ] #=> [1, 2, 3]
* a.shuffle #=> [2, 3, 1]
- * a #=> [1, 2, 3]
*
* The optional +rng+ argument will be used as the random number generator.
*
@@ -4663,14 +4525,7 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
long rnds[numberof(idx)];
if (OPTHASH_GIVEN_P(opts)) {
- VALUE rnd;
- ID keyword_ids[1];
-
- keyword_ids[0] = id_random;
- rb_get_kwargs(opts, keyword_ids, 0, 1, &rnd);
- if (rnd != Qundef) {
- randgen = rnd;
- }
+ randgen = rb_hash_lookup2(opts, sym_random, randgen);
}
len = RARRAY_LEN(ary);
if (argc == 0) {
@@ -4825,26 +4680,8 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
#define tmpary_discard(a) (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))
/*
- * Build a ruby array of the corresponding values and yield it to the
- * associated block.
- * Return the class of +values+ for reentry check.
- */
-static int
-yield_indexed_values(const VALUE values, const long r, const long *const p)
-{
- const VALUE result = rb_ary_new2(r);
- VALUE *const result_array = RARRAY_PTR(result);
- const VALUE *const values_array = RARRAY_CONST_PTR(values);
- long i;
-
- for (i = 0; i < r; i++) result_array[i] = values_array[p[i]];
- ARY_SET_LEN(result, r);
- rb_yield(result);
- return !RBASIC(values)->klass;
-}
-
-/*
- * Compute permutations of +r+ elements of the set <code>[0..n-1]</code>.
+ * Recursively compute permutations of +r+ elements of the set
+ * <code>[0..n-1]</code>.
*
* When we have a complete permutation of array indexes, copy the values
* at those indexes into a new array and yield that array.
@@ -4852,40 +4689,38 @@ yield_indexed_values(const VALUE values, const long r, const long *const p)
* n: the size of the set
* r: the number of elements in each permutation
* p: the array (of size r) that we're filling in
+ * index: what index we're filling in now
* used: an array of booleans: whether a given index is already used
* values: the Ruby array that holds the actual values to permute
*/
static void
-permute0(const long n, const long r, long *const p, char *const used, const VALUE values)
+permute0(long n, long r, long *p, long index, char *used, VALUE values)
{
- long i = 0, index = 0;
-
- for (;;) {
- const char *const unused = memchr(&used[i], 0, n-i);
- if (!unused) {
- if (!index) break;
- i = p[--index]; /* pop index */
- used[i++] = 0; /* index unused */
- }
- else {
- i = unused - used;
+ long i,j;
+ for (i = 0; i < n; i++) {
+ if (used[i] == 0) {
p[index] = i;
- used[i] = 1; /* mark index used */
- ++index;
if (index < r-1) { /* if not done yet */
- p[index] = i = 0;
- continue;
+ used[i] = 1; /* mark index used */
+ permute0(n, r, p, index+1, /* recurse */
+ used, values);
+ used[i] = 0; /* index unused */
}
- for (i = 0; i < n; ++i) {
- if (used[i]) continue;
- p[index] = i;
- if (!yield_indexed_values(values, r, p)) {
+ else {
+ /* We have a complete permutation of array indexes */
+ /* Build a ruby array of the corresponding values */
+ /* And yield it to the associated block */
+ VALUE result = rb_ary_new2(r);
+ VALUE *result_array = RARRAY_PTR(result);
+ const VALUE *values_array = RARRAY_PTR(values);
+
+ for (j = 0; j < r; j++) result_array[j] = values_array[p[j]];
+ ARY_SET_LEN(result, r);
+ rb_yield(result);
+ if (RBASIC(values)->klass) {
rb_raise(rb_eRuntimeError, "permute reentered");
}
}
- i = p[--index]; /* pop index */
- used[i] = 0; /* index unused */
- p[index] = ++i;
}
}
}
@@ -4980,42 +4815,23 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary)
}
}
else { /* this is the general case */
- volatile VALUE t0;
- long *p = ALLOCV_N(long, t0, r+roomof(n, sizeof(long)));
- char *used = (char*)(p + r);
+ volatile VALUE t0 = tmpbuf(n,sizeof(long));
+ long *p = (long*)RSTRING_PTR(t0);
+ volatile VALUE t1 = tmpbuf(n,sizeof(char));
+ char *used = (char*)RSTRING_PTR(t1);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
RBASIC_CLEAR_CLASS(ary0);
MEMZERO(used, char, n); /* initialize array */
- permute0(n, r, p, used, ary0); /* compute and yield permutations */
- ALLOCV_END(t0);
+ permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
+ tmpbuf_discard(t0);
+ tmpbuf_discard(t1);
RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
-static void
-combinate0(const long len, const long n, long *const stack, const VALUE values)
-{
- long lev = 0;
-
- MEMZERO(stack+1, long, n);
- stack[0] = -1;
- for (;;) {
- for (lev++; lev < n; lev++) {
- stack[lev+1] = stack[lev]+1;
- }
- if (!yield_indexed_values(values, n, stack+1)) {
- rb_raise(rb_eRuntimeError, "combination reentered");
- }
- do {
- if (lev == 0) return;
- stack[lev--]++;
- } while (stack[lev+1]+n == len+lev+1);
- }
-}
-
static VALUE
rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
{
@@ -5053,7 +4869,7 @@ rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
static VALUE
rb_ary_combination(VALUE ary, VALUE num)
{
- long i, n, len;
+ long n, i, len;
n = NUM2LONG(num);
RETURN_SIZED_ENUMERATOR(ary, 1, &num, rb_ary_combination_size);
@@ -5065,25 +4881,42 @@ rb_ary_combination(VALUE ary, VALUE num)
rb_yield(rb_ary_new2(0));
}
else if (n == 1) {
- for (i = 0; i < RARRAY_LEN(ary); i++) {
+ for (i = 0; i < len; i++) {
rb_yield(rb_ary_new3(1, RARRAY_AREF(ary, i)));
}
}
else {
- VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
- volatile VALUE t0;
- long *stack = ALLOCV_N(long, t0, n+1);
-
- RBASIC_CLEAR_CLASS(ary0);
- combinate0(len, n, stack, ary0);
- ALLOCV_END(t0);
- RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
+ volatile VALUE t0 = tmpbuf(n+1, sizeof(long));
+ long *stack = (long*)RSTRING_PTR(t0);
+ volatile VALUE cc = tmpary(n);
+ VALUE *chosen = RARRAY_PTR(cc);
+ long lev = 0;
+
+ MEMZERO(stack, long, n);
+ stack[0] = -1;
+ for (;;) {
+ chosen[lev] = RARRAY_AREF(ary, stack[lev+1]);
+ for (lev++; lev < n; lev++) {
+ chosen[lev] = RARRAY_AREF(ary, stack[lev+1] = stack[lev]+1);
+ }
+ rb_yield(rb_ary_new4(n, chosen));
+ if (RBASIC(t0)->klass) {
+ rb_raise(rb_eRuntimeError, "combination reentered");
+ }
+ do {
+ if (lev == 0) goto done;
+ stack[lev--]++;
+ } while (stack[lev+1]+n == len+lev+1);
+ }
+ done:
+ tmpbuf_discard(t0);
+ tmpary_discard(cc);
}
return ary;
}
/*
- * Compute repeated permutations of +r+ elements of the set
+ * Recursively compute repeated permutations of +r+ elements of the set
* <code>[0..n-1]</code>.
*
* When we have a complete repeated permutation of array indexes, copy the
@@ -5092,28 +4925,33 @@ rb_ary_combination(VALUE ary, VALUE num)
* n: the size of the set
* r: the number of elements in each permutation
* p: the array (of size r) that we're filling in
+ * index: what index we're filling in now
* values: the Ruby array that holds the actual values to permute
*/
static void
-rpermute0(const long n, const long r, long *const p, const VALUE values)
+rpermute0(long n, long r, long *p, long index, VALUE values)
{
- long i = 0, index = 0;
-
- p[index] = i;
- for (;;) {
- if (++index < r-1) {
- p[index] = i = 0;
- continue;
+ long i, j;
+ for (i = 0; i < n; i++) {
+ p[index] = i;
+ if (index < r-1) { /* if not done yet */
+ rpermute0(n, r, p, index+1, values); /* recurse */
}
- for (i = 0; i < n; ++i) {
- p[index] = i;
- if (!yield_indexed_values(values, r, p)) {
+ else {
+ /* We have a complete permutation of array indexes */
+ /* Build a ruby array of the corresponding values */
+ /* And yield it to the associated block */
+ VALUE result = rb_ary_new2(r);
+ VALUE *result_array = RARRAY_PTR(result);
+ const VALUE *values_array = RARRAY_PTR(values);
+
+ for (j = 0; j < r; j++) result_array[j] = values_array[p[j]];
+ ARY_SET_LEN(result, r);
+ rb_yield(result);
+ if (RBASIC(values)->klass) {
rb_raise(rb_eRuntimeError, "repeated permute reentered");
}
}
- do {
- if (index <= 0) return;
- } while ((i = ++p[--index]) >= n);
}
}
@@ -5176,38 +5014,39 @@ rb_ary_repeated_permutation(VALUE ary, VALUE num)
}
}
else { /* this is the general case */
- volatile VALUE t0;
- long *p = ALLOCV_N(long, t0, r);
+ volatile VALUE t0 = tmpbuf(r, sizeof(long));
+ long *p = (long*)RSTRING_PTR(t0);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
RBASIC_CLEAR_CLASS(ary0);
- rpermute0(n, r, p, ary0); /* compute and yield repeated permutations */
- ALLOCV_END(t0);
+ rpermute0(n, r, p, 0, ary0); /* compute and yield repeated permutations */
+ tmpbuf_discard(t0);
RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
static void
-rcombinate0(const long n, const long r, long *const p, const long rest, const VALUE values)
+rcombinate0(long n, long r, long *p, long index, long rest, VALUE values)
{
- long i = 0, index = 0;
-
- p[index] = i;
- for (;;) {
- if (++index < r-1) {
- p[index] = i;
- continue;
+ long j;
+ if (rest > 0) {
+ for (; index < n; ++index) {
+ p[r-rest] = index;
+ rcombinate0(n, r, p, index, rest-1, values);
}
- for (; i < n; ++i) {
- p[index] = i;
- if (!yield_indexed_values(values, r, p)) {
- rb_raise(rb_eRuntimeError, "repeated combination reentered");
- }
+ }
+ else {
+ VALUE result = rb_ary_new2(r);
+ VALUE *result_array = RARRAY_PTR(result);
+ const VALUE *values_array = RARRAY_PTR(values);
+
+ for (j = 0; j < r; ++j) result_array[j] = values_array[p[j]];
+ ARY_SET_LEN(result, r);
+ rb_yield(result);
+ if (RBASIC(values)->klass) {
+ rb_raise(rb_eRuntimeError, "repeated combination reentered");
}
- do {
- if (index <= 0) return;
- } while ((i = ++p[--index]) >= n);
}
}
@@ -5264,7 +5103,7 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
rb_yield(rb_ary_new2(0));
}
else if (n == 1) {
- for (i = 0; i < RARRAY_LEN(ary); i++) {
+ for (i = 0; i < len; i++) {
rb_yield(rb_ary_new3(1, RARRAY_AREF(ary, i)));
}
}
@@ -5272,13 +5111,13 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
/* yield nothing */
}
else {
- volatile VALUE t0;
- long *p = ALLOCV_N(long, t0, n);
+ volatile VALUE t0 = tmpbuf(n, sizeof(long));
+ long *p = (long*)RSTRING_PTR(t0);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
RBASIC_CLEAR_CLASS(ary0);
- rcombinate0(len, n, p, n, ary0); /* compute and yield repeated combinations */
- ALLOCV_END(t0);
+ rcombinate0(len, n, p, 0, n, ary0); /* compute and yield repeated combinations */
+ tmpbuf_discard(t0);
RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
@@ -5421,7 +5260,7 @@ rb_ary_take(VALUE obj, VALUE n)
/*
* call-seq:
- * ary.take_while { |obj| block } -> new_ary
+ * ary.take_while { |arr| block } -> new_ary
* ary.take_while -> Enumerator
*
* Passes elements to the block until the block returns +nil+ or +false+, then
@@ -5480,7 +5319,7 @@ rb_ary_drop(VALUE ary, VALUE n)
/*
* call-seq:
- * ary.drop_while { |obj| block } -> new_ary
+ * ary.drop_while { |arr| block } -> new_ary
* ary.drop_while -> Enumerator
*
* Drops elements up to, but not including, the first element for which the
@@ -5509,57 +5348,6 @@ rb_ary_drop_while(VALUE ary)
}
/*
- * call-seq:
- * ary.any? [{ |obj| block }] -> true or false
- *
- * See also Enumerable#any?
- */
-
-static VALUE
-rb_ary_any_p(VALUE ary)
-{
- long i, len = RARRAY_LEN(ary);
- const VALUE *ptr = RARRAY_CONST_PTR(ary);
-
- if (!len) return Qfalse;
- if (!rb_block_given_p()) {
- for (i = 0; i < len; ++i) if (RTEST(ptr[i])) return Qtrue;
- }
- else {
- for (i = 0; i < RARRAY_LEN(ary); ++i) {
- if (RTEST(rb_yield(RARRAY_AREF(ary, i)))) return Qtrue;
- }
- }
- return Qfalse;
-}
-
-/*
- * call-seq:
- * ary.dig(idx, ...) -> object
- *
- * Extracts the nested value specified by the sequence of <i>idx</i>
- * objects by calling +dig+ at each step, returning +nil+ if any
- * intermediate step is +nil+.
- *
- * a = [[1, [2, 3]]]
- *
- * a.dig(0, 1, 1) #=> 3
- * a.dig(1, 2, 3) #=> nil
- * a.dig(0, 0, 0) #=> NoMethodError, undefined method `dig' for 1:Fixnum
- * [42, {foo: :bar}].dig(1, :foo) #=> :bar
- */
-
-VALUE
-rb_ary_dig(int argc, VALUE *argv, VALUE self)
-{
- rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
- self = rb_ary_at(self, *argv);
- if (!--argc) return self;
- ++argv;
- return rb_obj_dig(argc, argv, self, Qnil);
-}
-
-/*
* Arrays are ordered, integer-indexed collections of any object.
*
* Array indexing starts at 0, as in C or Java. A negative index is assumed
@@ -5592,8 +5380,7 @@ rb_ary_dig(int argc, VALUE *argv, VALUE self)
* This method is safe to use with mutable objects such as hashes, strings or
* other arrays:
*
- * Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
- * Array.new(4) {|i| i.to_s } #=> ["0", "1", "2", "3"]
+ * Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
*
* This is also a quick way to build up multi-dimensional arrays:
*
@@ -5909,12 +5696,9 @@ Init_Array(void)
rb_define_method(rb_cArray, "drop", rb_ary_drop, 1);
rb_define_method(rb_cArray, "drop_while", rb_ary_drop_while, 0);
rb_define_method(rb_cArray, "bsearch", rb_ary_bsearch, 0);
- rb_define_method(rb_cArray, "bsearch_index", rb_ary_bsearch_index, 0);
- rb_define_method(rb_cArray, "any?", rb_ary_any_p, 0);
- rb_define_method(rb_cArray, "dig", rb_ary_dig, -1);
id_cmp = rb_intern("<=>");
- id_random = rb_intern("random");
+ sym_random = ID2SYM(rb_intern("random"));
id_div = rb_intern("div");
id_power = rb_intern("**");
}
diff --git a/benchmark/bm_app_aobench.rb b/benchmark/bm_app_aobench.rb
index 2bd6acfaf8..807349089f 100644
--- a/benchmark/bm_app_aobench.rb
+++ b/benchmark/bm_app_aobench.rb
@@ -1,6 +1,7 @@
-# AO render benchmark
+# AO rebder benchmark
# Original program (C) Syoyo Fujita in Javascript (and other languages)
-# https://code.google.com/p/aobench/
+# http://lucille.atso-net.jp/blog/?p=642
+# http://lucille.atso-net.jp/blog/?p=711
# Ruby(yarv2llvm) version by Hideki Miura
#
@@ -229,7 +230,7 @@ class Scene
w.times do |x|
rad = Vec.new(0.0, 0.0, 0.0)
- # Subsampling
+ # Subsmpling
nsubsamples.times do |v|
nsubsamples.times do |u|
diff --git a/benchmark/bm_app_lc_fizzbuzz.rb b/benchmark/bm_app_lc_fizzbuzz.rb
deleted file mode 100644
index f09574bbeb..0000000000
--- a/benchmark/bm_app_lc_fizzbuzz.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# FizzBuzz program using only lambda calculus
-#
-# This program is quoted from
-# "Understanding Computation" by Tom Stuart
-# http://computationbook.com/
-#
-# You can understand why this program works fine by reading this book.
-#
-
-solution = -> k { -> f { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] }[l]][x][-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][k][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> l { -> x { -> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[l][f[x]] } }] } }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[m][n]][-> x { -> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[f[-> n { -> p { -> x { p[n[p][x]] } } }[m]][n]][m][x] }][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]] } } }][-> p { -> x { p[x] } }][-> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] } }]][-> n { -> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[x]]]]]]]]]]]]]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[x]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> n { -> l { -> x { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] }[l]][x][-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][l][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][x]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }] } }[-> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> x { f[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { -> n { -> p { -> x { p[n[p][x]] } } }[f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n]][x] }][-> p { -> x { x } }] } } }][n][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][x] }]][-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]] } }][n]]]] }]
-
-FIRST = -> l { LEFT[RIGHT[l]] }
-IF = -> b { b }
-LEFT = -> p { p[-> x { -> y { x } } ] }
-RIGHT = -> p { p[-> x { -> y { y } } ] }
-IS_EMPTY = LEFT
-REST = -> l { RIGHT[RIGHT[l]] }
-
-def to_integer(proc)
- proc[-> n { n + 1 }][0]
-end
-
-def to_boolean(proc)
- IF[proc][true][false]
-end
-
-def to_array(proc)
- array = []
-
- until to_boolean(IS_EMPTY[proc])
- array.push(FIRST[proc])
- proc = REST[proc]
- end
-
- array
-end
-
-def to_char(c)
- '0123456789BFiuz'.slice(to_integer(c))
-end
-
-def to_string(s)
- to_array(s).map { |c| to_char(c) }.join
-end
-
-answer = to_array(solution).map do |p|
- to_string(p)
-end
-
-answer_ary = answer.to_a
-# puts answer_ary
diff --git a/benchmark/bm_array_shift.rb b/benchmark/bm_array_shift.rb
deleted file mode 100644
index 798bb9e3f4..0000000000
--- a/benchmark/bm_array_shift.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'benchmark'
-
-Benchmark.bm do |x|
- [10_000,1_000_000,100_000_000].each do |n|
- ary = Array.new(n,0)
- GC.start
- x.report("#{n}:shift"){ ary.shift }
- (0..4).each do |i|
- ary = Array.new(n,0)
- GC.start
- x.report("#{n}:shift(#{i})"){ ary.shift(i) }
- end
- end
-end
diff --git a/benchmark/bm_hash_aref_dsym.rb b/benchmark/bm_hash_aref_dsym.rb
deleted file mode 100644
index af4f8c36d4..0000000000
--- a/benchmark/bm_hash_aref_dsym.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}
-syms = ('a'..'z').map { |s| s.to_sym }
-syms.each { |s| h[s] = 1 }
-200_000.times { syms.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_dsym_long.rb b/benchmark/bm_hash_aref_dsym_long.rb
deleted file mode 100644
index 9d7759379e..0000000000
--- a/benchmark/bm_hash_aref_dsym_long.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# [ruby-core:70129] [Bug #11396]
-collection_size = 200000
-sample_size = 10000
-
-values = (1..collection_size).to_a.map do |x|
- "THIS IS A LONGER STRING THAT IS ALSO UNIQUE #{x}"
-end
-
-symbol_hash = {}
-
-values.each do |x|
- symbol_hash[x.to_sym] = 1
-end
-
-# use the same samples each time to minimize deviations
-rng = Random.new(0)
-symbol_sample_array = values.sample(sample_size, random: rng).map(&:to_sym)
-
-3000.times do
- symbol_sample_array.each { |x| symbol_hash[x] }
-end
diff --git a/benchmark/bm_hash_aref_fix.rb b/benchmark/bm_hash_aref_fix.rb
deleted file mode 100644
index 1346890582..0000000000
--- a/benchmark/bm_hash_aref_fix.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}
-nums = (1..26).to_a
-nums.each { |i| h[i] = i }
-200_000.times { nums.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_flo.rb b/benchmark/bm_hash_aref_flo.rb
deleted file mode 100644
index 2217274c82..0000000000
--- a/benchmark/bm_hash_aref_flo.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}
-strs = [*1..10000].map! {|i| i.fdiv(10)}
-strs.each { |s| h[s] = s }
-50.times { strs.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_miss.rb b/benchmark/bm_hash_aref_miss.rb
deleted file mode 100644
index b0913dd4bb..0000000000
--- a/benchmark/bm_hash_aref_miss.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-h = {}
-strs = ('a'..'z').to_a.map!(&:freeze)
-strs.each { |s| h[s] = s }
-strs = ('A'..'Z').to_a
-200_000.times { strs.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_str.rb b/benchmark/bm_hash_aref_str.rb
deleted file mode 100644
index 19439b061b..0000000000
--- a/benchmark/bm_hash_aref_str.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}
-strs = ('a'..'z').to_a.map!(&:freeze)
-strs.each { |s| h[s] = s }
-200_000.times { strs.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_sym.rb b/benchmark/bm_hash_aref_sym.rb
deleted file mode 100644
index f75d163fe6..0000000000
--- a/benchmark/bm_hash_aref_sym.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-syms = ('a'..'z').to_a
-begin
- syms = eval("%i[#{syms.join(' ')}]")
-rescue SyntaxError # <= 1.9.3
- syms.map!(&:to_sym)
-end
-syms.each { |s| h[s] = s }
-200_000.times { syms.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_sym_long.rb b/benchmark/bm_hash_aref_sym_long.rb
deleted file mode 100644
index 9dab8df7be..0000000000
--- a/benchmark/bm_hash_aref_sym_long.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-h = {}
-syms = %w[puts warn syswrite write stat bacon lettuce tomato
-some symbols in this array may already be interned others should not be
-hash browns make good breakfast but not cooked using prime numbers
-shift for division entries delete_if keys exist?
-]
-begin
- syms = eval("%i[#{syms.join(' ')}]")
-rescue SyntaxError # <= 1.9.3
- syms.map!(&:to_sym)
-end
-syms.each { |s| h[s] = s }
-200_000.times { syms.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_flatten.rb b/benchmark/bm_hash_flatten.rb
deleted file mode 100644
index e944aae9f2..0000000000
--- a/benchmark/bm_hash_flatten.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-1000.times do
- h.flatten
-end
diff --git a/benchmark/bm_hash_ident_flo.rb b/benchmark/bm_hash_ident_flo.rb
deleted file mode 100644
index 0c7edfed3e..0000000000
--- a/benchmark/bm_hash_ident_flo.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-strs = (1..10000).to_a.map!(&:to_f)
-strs.each { |s| h[s] = s }
-50.times { strs.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_ident_num.rb b/benchmark/bm_hash_ident_num.rb
deleted file mode 100644
index b226736c6f..0000000000
--- a/benchmark/bm_hash_ident_num.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-nums = (1..26).to_a
-nums.each { |n| h[n] = n }
-200_000.times { nums.each { |n| h[n] } }
diff --git a/benchmark/bm_hash_ident_obj.rb b/benchmark/bm_hash_ident_obj.rb
deleted file mode 100644
index 4b3b58edec..0000000000
--- a/benchmark/bm_hash_ident_obj.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-objs = 26.times.map { Object.new }
-objs.each { |o| h[o] = o }
-200_000.times { objs.each { |o| h[o] } }
diff --git a/benchmark/bm_hash_ident_str.rb b/benchmark/bm_hash_ident_str.rb
deleted file mode 100644
index 8582b38e31..0000000000
--- a/benchmark/bm_hash_ident_str.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-strs = ('a'..'z').to_a
-strs.each { |s| h[s] = s }
-200_000.times { strs.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_ident_sym.rb b/benchmark/bm_hash_ident_sym.rb
deleted file mode 100644
index 4c81e3d28e..0000000000
--- a/benchmark/bm_hash_ident_sym.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-syms = ('a'..'z').to_a.map(&:to_sym)
-syms.each { |s| h[s] = s }
-200_000.times { syms.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_keys.rb b/benchmark/bm_hash_keys.rb
deleted file mode 100644
index 6863cd01f9..0000000000
--- a/benchmark/bm_hash_keys.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-5000.times do
- h.keys
-end
diff --git a/benchmark/bm_hash_shift_u16.rb b/benchmark/bm_hash_shift_u16.rb
deleted file mode 100644
index ec800d0342..0000000000
--- a/benchmark/bm_hash_shift_u16.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-h = {}
-
-(16384..65536).each do |i|
- h[i] = nil
-end
-
-300000.times do
- k, v = h.shift
- h[k] = v
-end
diff --git a/benchmark/bm_hash_shift_u24.rb b/benchmark/bm_hash_shift_u24.rb
deleted file mode 100644
index de4e0fa696..0000000000
--- a/benchmark/bm_hash_shift_u24.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-h = {}
-
-(0xff4000..0xffffff).each do |i|
- h[i] = nil
-end
-
-300000.times do
- k, v = h.shift
- h[k] = v
-end
diff --git a/benchmark/bm_hash_shift_u32.rb b/benchmark/bm_hash_shift_u32.rb
deleted file mode 100644
index 656aa55583..0000000000
--- a/benchmark/bm_hash_shift_u32.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-h = {}
-
-(0xffff4000..0xffffffff).each do |i|
- h[i] = nil
-end
-
-300000.times do
- k, v = h.shift
- h[k] = v
-end
diff --git a/benchmark/bm_hash_to_proc.rb b/benchmark/bm_hash_to_proc.rb
deleted file mode 100644
index 2b675bf509..0000000000
--- a/benchmark/bm_hash_to_proc.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-5000.times do |i|
- [i].map(&h)
-end
diff --git a/benchmark/bm_hash_values.rb b/benchmark/bm_hash_values.rb
deleted file mode 100644
index 069441302f..0000000000
--- a/benchmark/bm_hash_values.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-5000.times do
- h.values
-end
diff --git a/benchmark/bm_io_nonblock_noex.rb b/benchmark/bm_io_nonblock_noex.rb
deleted file mode 100644
index da9357fdc6..0000000000
--- a/benchmark/bm_io_nonblock_noex.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-nr = 1_000_000
-i = 0
-msg = '.'
-buf = '.'
-noex = { exception: false }
-begin
- r, w = IO.pipe
- while i < nr
- i += 1
- w.write_nonblock(msg, noex)
- r.read_nonblock(1, buf, noex)
- end
-rescue ArgumentError # old Rubies
- while i < nr
- i += 1
- w.write_nonblock(msg)
- r.read_nonblock(1, buf)
- end
-ensure
- r.close
- w.close
-end
diff --git a/benchmark/bm_io_nonblock_noex2.rb b/benchmark/bm_io_nonblock_noex2.rb
deleted file mode 100644
index 56819d049b..0000000000
--- a/benchmark/bm_io_nonblock_noex2.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-nr = 1_000_000
-i = 0
-msg = '.'
-buf = '.'
-begin
- r, w = IO.pipe
- while i < nr
- i += 1
- w.write_nonblock(msg, exception: false)
- r.read_nonblock(1, buf, exception: false)
- end
-rescue ArgumentError # old Rubies
- while i < nr
- i += 1
- w.write_nonblock(msg)
- r.read_nonblock(1, buf)
- end
-ensure
- r.close
- w.close
-end
diff --git a/benchmark/bm_marshal_dump_flo.rb b/benchmark/bm_marshal_dump_flo.rb
deleted file mode 100644
index 9b8d0c6afb..0000000000
--- a/benchmark/bm_marshal_dump_flo.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-bug10761 = 10000.times.map { |x| x.to_f }
-100.times { Marshal.dump(bug10761) }
diff --git a/benchmark/bm_marshal_dump_load_geniv.rb b/benchmark/bm_marshal_dump_load_geniv.rb
deleted file mode 100644
index 8252ad90fa..0000000000
--- a/benchmark/bm_marshal_dump_load_geniv.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-a = ''
-a.instance_eval do
- @a = :a
- @b = :b
- @c = :c
-end
-100000.times do
- a = Marshal.load(Marshal.dump(a))
-end
-#p(a.instance_eval { @a == :a && @b == :b && @c == :c })
diff --git a/benchmark/bm_marshal_dump_load_time.rb b/benchmark/bm_marshal_dump_load_time.rb
deleted file mode 100644
index e29743b791..0000000000
--- a/benchmark/bm_marshal_dump_load_time.rb
+++ /dev/null
@@ -1 +0,0 @@
-100000.times { Marshal.load(Marshal.dump(Time.now)) }
diff --git a/benchmark/bm_require.rb b/benchmark/bm_require.rb
deleted file mode 100644
index b8abc88f41..0000000000
--- a/benchmark/bm_require.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-$:.push File.join(File.dirname(__FILE__), "bm_require.data")
-
-1.upto(10000) do |i|
- require "c#{i}"
-end
-
-$:.pop
diff --git a/benchmark/bm_require_thread.rb b/benchmark/bm_require_thread.rb
deleted file mode 100644
index e54db6c6e5..0000000000
--- a/benchmark/bm_require_thread.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-$:.push File.join(File.dirname(__FILE__), "bm_require.data")
-
-i=0
-t = Thread.new do
- while true
- i = i+1 # dummy loop
- end
-end
-
-1.upto(100) do |i|
- require "c#{i}"
-end
-
-$:.pop
-t.kill
diff --git a/benchmark/bm_securerandom.rb b/benchmark/bm_securerandom.rb
deleted file mode 100644
index a082ea6d5b..0000000000
--- a/benchmark/bm_securerandom.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require "securerandom"
-
-20_0000.times do
- SecureRandom.random_number(100)
-end
diff --git a/benchmark/bm_so_meteor_contest.rb b/benchmark/bm_so_meteor_contest.rb
index 17e9c046a8..99cf6a91cc 100644
--- a/benchmark/bm_so_meteor_contest.rb
+++ b/benchmark/bm_so_meteor_contest.rb
@@ -32,7 +32,7 @@ class Rotation
@start_masks = Array.new(60)
# create the rotational masks by placing the base mask at the location and seeing if
- # 1) it overlaps the boundaries and 2) it produces a prunable board. if either of these
+ # 1) it overlaps the boundries and 2) it produces a prunable board. if either of these
# is true the piece cannot be placed
0.upto(59) do | offset |
mask = is_even(offset) ? (@even_mask << offset) : (@odd_mask << offset)
@@ -326,9 +326,9 @@ end
# The exact procedure is described in-code
def prunable( board, location, slotting = false)
collectors = []
- # loop across the rows
+ # loop accross the rows
(location / 6).to_i.upto(9) do | row_on |
- # obtain a set of regions representing the bits of the current row.
+ # obtain a set of regions representing the bits of the curent row.
regions = $regions[(board >> (row_on * 6)) & 0b11111]
converter = $converter[row_on]
@@ -370,7 +370,7 @@ def prunable( board, location, slotting = false)
end
# check the existing collectors, if any collector overlapped no bits in the region its [2] value will
- # be zero. The size of any such reaason is tested if it is not a multiple of five true is returned since
+ # be zero. The size of any such reaason is tested if it is not a muliple of five true is returned since
# the board is prunable. if it is a multiple of five it is removed.
# Collector that are still active have a new adjacent value [0] set based n the matched bits
# and have [2] cleared out for the next cycle.
@@ -382,7 +382,7 @@ def prunable( board, location, slotting = false)
collectors[collector_num] = nil
else
# if a collector matches all bits in the row then we can return unprunable early for the
- # following reasons:
+ # follwing reasons:
# 1) there can be no more unavailable bits bince we fill from the top left downward
# 2) all previous regions have been closed or joined so only this region can fail
# 3) this region must be good since there can never be only 1 region that is nuot
@@ -467,7 +467,7 @@ def find_top( rotation_skip)
end
# the normail find routine, iterates through the available pieces, checks all rotations at the current location
-# and adds any boards found. depth is achieved via recursion. the overall approach is described
+# and adds any boards found. depth is acheived via recursion. the overall approach is described
# here: http://www-128.ibm.com/developerworks/java/library/j-javaopt/
# parameters:
# start_location -- where to start looking for place for the next piece at
@@ -526,7 +526,7 @@ def save( board_string)
@boards_found += 1
# the exit motif is a time saver. Ideally the function should return, but those tests
- # take noticeable time (performance).
+ # take noticable time (performance).
if (@boards_found == @stop_count) then
print_results
exit(0)
diff --git a/benchmark/bm_vm1_gc_wb_ary.rb b/benchmark/bm_vm1_gc_wb_ary.rb
index 881528845b..ecfab51dbf 100644
--- a/benchmark/bm_vm1_gc_wb_ary.rb
+++ b/benchmark/bm_vm1_gc_wb_ary.rb
@@ -1,12 +1,10 @@
-short_lived_ary = []
-
-if RUBY_VERSION >= "2.2.0"
- GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false)
-end
+long_lived = []
+GC.start
+GC.start
i = 0
short_lived = ''
while i<30_000_000 # while loop 1
- short_lived_ary[0] = short_lived # write barrier
+ long_lived[0] = short_lived # write barrier
i+=1
end
diff --git a/benchmark/bm_vm1_gc_wb_ary_promoted.rb b/benchmark/bm_vm1_gc_wb_ary_promoted.rb
deleted file mode 100644
index 3c8279c956..0000000000
--- a/benchmark/bm_vm1_gc_wb_ary_promoted.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-long_lived = []
-
-if RUBY_VERSION > "2.2.0"
- 3.times{ GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false) }
-elsif
- GC.start
-end
-
-i = 0
-short_lived = ''
-while i<30_000_000 # while loop 1
- long_lived[0] = short_lived # write barrier
- i+=1
-end
diff --git a/benchmark/bm_vm1_gc_wb_obj.rb b/benchmark/bm_vm1_gc_wb_obj.rb
index a4067af36b..017eff4f94 100644
--- a/benchmark/bm_vm1_gc_wb_obj.rb
+++ b/benchmark/bm_vm1_gc_wb_obj.rb
@@ -1,15 +1,13 @@
class C
attr_accessor :foo
end
-short_lived_obj = C.new
-
-if RUBY_VERSION >= "2.2.0"
- GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false)
-end
+long_lived = C.new
+GC.start
+GC.start
i = 0
short_lived = ''
while i<30_000_000 # while loop 1
- short_lived_obj.foo = short_lived # write barrier
+ long_lived.foo = short_lived # write barrier
i+=1
end
diff --git a/benchmark/bm_vm1_gc_wb_obj_promoted.rb b/benchmark/bm_vm1_gc_wb_obj_promoted.rb
deleted file mode 100644
index eee07a0248..0000000000
--- a/benchmark/bm_vm1_gc_wb_obj_promoted.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class C
- attr_accessor :foo
-end
-long_lived = C.new
-
-if RUBY_VERSION >= "2.2.0"
- 3.times{ GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false) }
-elsif
- GC.start
-end
-
-i = 0
-short_lived = ''
-while i<30_000_000 # while loop 1
- long_lived.foo = short_lived # write barrier
- i+=1
-end
diff --git a/benchmark/bm_vm2_case_lit.rb b/benchmark/bm_vm2_case_lit.rb
deleted file mode 100644
index c62b294e0e..0000000000
--- a/benchmark/bm_vm2_case_lit.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-i = 0
-@ret = [ "foo", true, false, :sym, 6, nil, 0.1, 0xffffffffffffffff ]
-def foo(i)
- @ret[i % @ret.size]
-end
-
-while i<6_000_000 # while loop 2
- case foo(i)
- when "foo" then :foo
- when true then true
- when false then false
- when :sym then :sym
- when 6 then :fix
- when nil then nil
- when 0.1 then :float
- when 0xffffffffffffffff then :big
- end
- i += 1
-end
diff --git a/benchmark/bm_vm2_newlambda.rb b/benchmark/bm_vm2_newlambda.rb
deleted file mode 100644
index 6422c9b0d0..0000000000
--- a/benchmark/bm_vm2_newlambda.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- lambda {}
-end
diff --git a/benchmark/bm_vm2_string_literal.rb b/benchmark/bm_vm2_string_literal.rb
deleted file mode 100644
index 1d73036849..0000000000
--- a/benchmark/bm_vm2_string_literal.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-end
diff --git a/benchmark/bm_vm2_struct_big_aref_hi.rb b/benchmark/bm_vm2_struct_big_aref_hi.rb
deleted file mode 100644
index 22cb26b0a5..0000000000
--- a/benchmark/bm_vm2_struct_big_aref_hi.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.z # x[25]
-end
diff --git a/benchmark/bm_vm2_struct_big_aref_lo.rb b/benchmark/bm_vm2_struct_big_aref_lo.rb
deleted file mode 100644
index 5e61a7087e..0000000000
--- a/benchmark/bm_vm2_struct_big_aref_lo.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.k # x[10]
-end
diff --git a/benchmark/bm_vm2_struct_big_aset.rb b/benchmark/bm_vm2_struct_big_aset.rb
deleted file mode 100644
index 5a1c3d16f3..0000000000
--- a/benchmark/bm_vm2_struct_big_aset.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.k = i # x[10] = i
-end
diff --git a/benchmark/bm_vm2_struct_big_href_hi.rb b/benchmark/bm_vm2_struct_big_href_hi.rb
deleted file mode 100644
index fff940a80a..0000000000
--- a/benchmark/bm_vm2_struct_big_href_hi.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x[:z]
-end
diff --git a/benchmark/bm_vm2_struct_big_href_lo.rb b/benchmark/bm_vm2_struct_big_href_lo.rb
deleted file mode 100644
index 5e4085d59d..0000000000
--- a/benchmark/bm_vm2_struct_big_href_lo.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x[:k]
-end
diff --git a/benchmark/bm_vm2_struct_big_hset.rb b/benchmark/bm_vm2_struct_big_hset.rb
deleted file mode 100644
index 9c0cee4141..0000000000
--- a/benchmark/bm_vm2_struct_big_hset.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x[:k] = i
-end
diff --git a/benchmark/bm_vm2_struct_small_aref.rb b/benchmark/bm_vm2_struct_small_aref.rb
deleted file mode 100644
index 8eaa555b41..0000000000
--- a/benchmark/bm_vm2_struct_small_aref.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(:a, :b, :c)
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.a
-end
diff --git a/benchmark/bm_vm2_struct_small_aset.rb b/benchmark/bm_vm2_struct_small_aset.rb
deleted file mode 100644
index ecd0f95669..0000000000
--- a/benchmark/bm_vm2_struct_small_aset.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(:a, :b, :c)
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.a = i
-end
diff --git a/benchmark/bm_vm2_struct_small_href.rb b/benchmark/bm_vm2_struct_small_href.rb
deleted file mode 100644
index 2c88fee6bf..0000000000
--- a/benchmark/bm_vm2_struct_small_href.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(:a, :b, :c)
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x[:a]
-end
diff --git a/benchmark/bm_vm2_struct_small_hset.rb b/benchmark/bm_vm2_struct_small_hset.rb
deleted file mode 100644
index 33c36d20f1..0000000000
--- a/benchmark/bm_vm2_struct_small_hset.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(:a, :b, :c)
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x[:a] = 1
-end
diff --git a/benchmark/bm_vm3_gc.rb b/benchmark/bm_vm3_gc.rb
index e668026915..7db9829d44 100644..100755
--- a/benchmark/bm_vm3_gc.rb
+++ b/benchmark/bm_vm3_gc.rb
@@ -1,3 +1,4 @@
+#! /usr/bin/ruby
5000.times do
100.times do
{"xxxx"=>"yyyy"}
diff --git a/benchmark/bm_vm_symbol_block_pass.rb b/benchmark/bm_vm_symbol_block_pass.rb
deleted file mode 100644
index 1d433353e1..0000000000
--- a/benchmark/bm_vm_symbol_block_pass.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class C
- 1000.times {|i|
- eval("def i#{i};end")
- }
-end
-
-c = C.new
-m = C.instance_methods(false)
-5_000.times do
- m.each do |n|
- c.tap(&n)
- end
-end
diff --git a/benchmark/bm_vm_thread_close.rb b/benchmark/bm_vm_thread_close.rb
deleted file mode 100644
index 3e9a265ce8..0000000000
--- a/benchmark/bm_vm_thread_close.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-1000.times { Thread.new { sleep } }
-i = 0
-while i<100_000 # benchmark loop 3
- i += 1
- IO.pipe.each(&:close)
-end
diff --git a/benchmark/bm_vm_thread_pipe.rb b/benchmark/bm_vm_thread_pipe.rb
index 112a621905..272d231eba 100644
--- a/benchmark/bm_vm_thread_pipe.rb
+++ b/benchmark/bm_vm_thread_pipe.rb
@@ -1,4 +1,4 @@
-# Measure small and plenty pipe read/write.
+# Mesure small and plenty pipe read/write.
# A performance may depend on GVL implementation.
lmax = 100_000
diff --git a/benchmark/driver.rb b/benchmark/driver.rb
index defe3c30be..695dc41aff 100644
--- a/benchmark/driver.rb
+++ b/benchmark/driver.rb
@@ -29,25 +29,6 @@ class BenchmarkDriver
end
end
- def self.load(input, type, opt)
- attrs = [:executables, :results]
- case type
- when 'yaml'
- require 'yaml'
- h = YAML.load(input)
- when 'json'
- require 'json'
- h = JSON.load(input)
- else
- h = eval(input.read)
- end
- obj = allocate
- obj.instance_variable_set("@execs", h[:executables] || h["executables"])
- obj.instance_variable_set("@results", h[:results] || h["results"])
- obj.instance_variable_set("@opt", opt)
- obj
- end
-
def output *args
puts(*args)
@output and @output.puts(*args)
@@ -136,25 +117,6 @@ class BenchmarkDriver
end
def show_results
- case @opt[:format]
- when :tsv
- strformat = "\t%1$s"
- numformat = "\t%1$*2$.3f"
- minwidth = 0
- name_width = 0
- when :markdown
- markdown = true
- strformat = "|%1$-*2$s"
- numformat = "|%1$*2$.3f"
- when :plain
- strformat = " %1$-*2$s"
- numformat = " %1$*2$.3f"
- end
-
- name_width ||= @results.map {|v,*| v.size}.max
- minwidth ||= 7
- width = @execs.map{|(_, v)| [v.size, minwidth].max}
-
output
if @verbose
@@ -166,29 +128,6 @@ class BenchmarkDriver
message "Elapsed time: #{Time.now - @start_time} (sec)"
end
- if rawdata_output = @opt[:rawdata_output]
- h = {}
- h[:cpuinfo] = File.read('/proc/cpuinfo') if File.exist?('/proc/cpuinfo')
- h[:executables] = @execs
- h[:results] = @results
- if (type = File.extname(rawdata_output)).empty?
- type = rawdata_output
- rawdata_output = @output.path.sub(/\.[^.\/]+\z/, '') << '.' << rawdata_output
- end
- case type
- when 'yaml'
- require 'yaml'
- h = YAML.dump(h)
- when 'json'
- require 'json'
- h = JSON.pretty_generate(h)
- else
- require 'pp'
- h = h.pretty_inspect
- end
- open(rawdata_output, 'w') {|f| f.puts h}
- end
-
output '-----------------------------------------------------------'
output 'benchmark results:'
@@ -197,24 +136,19 @@ class BenchmarkDriver
end
output "Execution time (sec)"
- output if markdown
- output ["name".ljust(name_width), @execs.map.with_index{|(_, v), i| sprintf(strformat, v, width[i])}].join("").rstrip
- output ["-"*name_width, width.map{|n|":".rjust(n, "-")}].join("|") if markdown
+ output "name\t#{@execs.map{|(_, v)| v}.join("\t")}"
@results.each{|v, result|
rets = []
s = adjusted_results(v, result){|r|
- rets << sprintf(numformat, r, width[rets.size])
+ rets << sprintf("%.3f", r)
}
- v += s if s
- output [v.ljust(name_width), rets].join("")
+ output "#{v}#{s}\t#{rets.join("\t")}"
}
if @execs.size > 1
output
output "Speedup ratio: compare with the result of `#{@execs[0][1]}' (greater is better)"
- output if markdown
- output ["name".ljust(name_width), @execs[1..-1].map.with_index{|(_, v), i| sprintf(strformat, v, width[i])}].join("").rstrip
- output ["-"*name_width, width[1..-1].map{|n|":".rjust(n, "-")}].join("|") if markdown
+ output "name\t#{@execs[1..-1].map{|(_, v)| v}.join("\t")}"
@results.each{|v, result|
rets = []
first_value = nil
@@ -223,14 +157,13 @@ class BenchmarkDriver
if r == 0
rets << "Error"
else
- rets << sprintf(numformat, first_value/r, width[rets.size+1])
+ rets << sprintf("%.3f", first_value/r)
end
else
first_value = r
end
}
- v += s if s
- output [v.ljust(name_width), rets].join("")
+ output "#{v}#{s}\t#{rets.join("\t")}"
}
end
@@ -305,17 +238,11 @@ class BenchmarkDriver
result
end
- unless defined?(File::NULL)
- if File.exist?('/dev/null')
- File::NULL = '/dev/null'
- end
- end
-
def measure executable, file
cmd = "#{executable} #{@ruby_arg} #{file}"
m = Benchmark.measure{
- system(cmd, out: File::NULL)
+ `#{cmd}`
}
if $? != 0
@@ -332,14 +259,7 @@ if __FILE__ == $0
:execs => [],
:dir => File.dirname(__FILE__),
:repeat => 1,
- :output => nil,
- :raw_output => nil,
- :format => :tsv,
- }
- formats = {
- :tsv => ".tsv",
- :markdown => ".md",
- :plain => ".txt",
+ :output => "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}",
}
parser = OptionParser.new{|o|
@@ -367,34 +287,15 @@ if __FILE__ == $0
o.on('--ruby-arg [ARG]', "Optional argument for ruby"){|a|
opt[:ruby_arg] = a
}
- o.on('--rawdata-output [FILE]', 'output rawdata'){|r|
- opt[:rawdata_output] = r
- }
- o.on('--load-rawdata=FILE', 'input rawdata'){|r|
- opt[:rawdata_input] = r
- }
- o.on('-f', "--format=FORMAT", "output format (#{formats.keys.join(",")})", formats.keys){|r|
- opt[:format] = r
+ o.on('-q', '--quiet', "Run without notify information except result table."){|q|
+ opt[:quiet] = q
}
o.on('-v', '--verbose'){|v|
opt[:verbose] = v
}
- o.on('-q', '--quiet', "Run without notify information except result table."){|q|
- opt[:quiet] = q
- opt[:verbose] = false
- }
}
parser.parse!(ARGV)
- opt[:output] ||= "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}#{formats[opt[:format]]}"
-
- if input = opt[:rawdata_input]
- b = open(input) {|f|
- BenchmarkDriver.load(f, File.extname(input)[1..-1], opt)
- }
- b.show_results
- else
- BenchmarkDriver.benchmark(opt)
- end
+ BenchmarkDriver.benchmark(opt)
end
diff --git a/benchmark/gc/gcbench.rb b/benchmark/gc/gcbench.rb
index 09a404466a..b038b71b54 100644
--- a/benchmark/gc/gcbench.rb
+++ b/benchmark/gc/gcbench.rb
@@ -34,7 +34,7 @@ end
pp GC.stat
-puts "#{RUBY_DESCRIPTION} #{GC::OPTS.inspect}" if defined?(GC::OPTS)
+puts "#{RUBY_DESCRIPTION} #{GC::OPTS.inspect}"
desc = "#{RUBY_VERSION}#{RUBY_PATCHLEVEL >= 0 ? "p#{RUBY_PATCHLEVEL}" : "dev"}"
name = File.basename(script, '.rb')
diff --git a/benchmark/prepare_require.rb b/benchmark/prepare_require.rb
deleted file mode 100644
index c4786f04ad..0000000000
--- a/benchmark/prepare_require.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require "fileutils"
-
-def prepare
- num_files = 10000
-
- basename = File.dirname($0)
- data_dir = File.join(basename, "bm_require.data")
-
- # skip if all of files exists
- if File.exist?(File.join(data_dir, "c#{num_files}.rb"))
- return
- end
-
- FileUtils.mkdir_p(data_dir)
-
- 1.upto(num_files) do |i|
- f = File.open("#{data_dir}/c#{i}.rb", "w")
- f.puts <<-END
- class C#{i}
- end
- END
- end
-end
-
-prepare
diff --git a/benchmark/prepare_require_thread.rb b/benchmark/prepare_require_thread.rb
deleted file mode 100644
index 339ecb8b39..0000000000
--- a/benchmark/prepare_require_thread.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-load File.join(File.dirname(__FILE__), "prepare_require.rb")
-
diff --git a/benchmark/prepare_so_k_nucleotide.rb b/benchmark/prepare_so_k_nucleotide.rb
index d83aeb7a7e..f28f4460a1 100644
--- a/benchmark/prepare_so_k_nucleotide.rb
+++ b/benchmark/prepare_so_k_nucleotide.rb
@@ -1,2 +1,2 @@
-require_relative 'make_fasta_output'
+require File.join(File.dirname(__FILE__), 'make_fasta_output')
prepare_fasta_output(100_000)
diff --git a/benchmark/prepare_so_reverse_complement.rb b/benchmark/prepare_so_reverse_complement.rb
index da3ec2df14..7f089109de 100644
--- a/benchmark/prepare_so_reverse_complement.rb
+++ b/benchmark/prepare_so_reverse_complement.rb
@@ -1,2 +1,2 @@
-require_relative 'make_fasta_output'
+require File.join(File.dirname(__FILE__), 'make_fasta_output')
prepare_fasta_output(2_500_000)
diff --git a/bignum.c b/bignum.c
index 38380f6c4e..bced660134 100644
--- a/bignum.c
+++ b/bignum.c
@@ -9,9 +9,10 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/thread.h"
#include "ruby/util.h"
+#include "internal.h"
#ifdef HAVE_STRINGS_H
#include <strings.h>
@@ -35,7 +36,9 @@ VALUE rb_cBignum;
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
#ifndef SIZEOF_BDIGIT_DBL
-# if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+# if defined(HAVE_INT64_T) && defined(HAVE_INT128_T)
+# define SIZEOF_BDIGIT_DBL SIZEOF_INT128_T
+# elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
# define SIZEOF_BDIGIT_DBL SIZEOF_LONG_LONG
# else
# define SIZEOF_BDIGIT_DBL SIZEOF_LONG
@@ -44,17 +47,17 @@ const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
STATIC_ASSERT(sizeof_bdigit_dbl, sizeof(BDIGIT_DBL) == SIZEOF_BDIGIT_DBL);
STATIC_ASSERT(sizeof_bdigit_dbl_signed, sizeof(BDIGIT_DBL_SIGNED) == SIZEOF_BDIGIT_DBL);
-STATIC_ASSERT(sizeof_bdigit, SIZEOF_BDIGIT <= sizeof(BDIGIT));
-STATIC_ASSERT(sizeof_bdigit_and_dbl, SIZEOF_BDIGIT*2 <= SIZEOF_BDIGIT_DBL);
+STATIC_ASSERT(sizeof_bdigit, SIZEOF_BDIGITS <= sizeof(BDIGIT));
+STATIC_ASSERT(sizeof_bdigit_and_dbl, SIZEOF_BDIGITS*2 <= SIZEOF_BDIGIT_DBL);
STATIC_ASSERT(bdigit_signedness, 0 < (BDIGIT)-1);
STATIC_ASSERT(bdigit_dbl_signedness, 0 < (BDIGIT_DBL)-1);
STATIC_ASSERT(bdigit_dbl_signed_signedness, 0 > (BDIGIT_DBL_SIGNED)-1);
-STATIC_ASSERT(rbignum_embed_len_max, BIGNUM_EMBED_LEN_MAX <= (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT));
+STATIC_ASSERT(rbignum_embed_len_max, RBIGNUM_EMBED_LEN_MAX <= (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT));
-#if SIZEOF_BDIGIT < SIZEOF_LONG
-STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_LONG % SIZEOF_BDIGIT == 0);
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_LONG % SIZEOF_BDIGITS == 0);
#else
-STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG == 0);
+STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGITS % SIZEOF_LONG == 0);
#endif
#ifdef WORDS_BIGENDIAN
@@ -70,8 +73,8 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG == 0);
#define FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))
#define POW2_P(x) (((x)&((x)-1))==0)
-#define BDIGITS(x) (BIGNUM_DIGITS(x))
-#define BITSPERDIG (SIZEOF_BDIGIT*CHAR_BIT)
+#define BDIGITS(x) (RBIGNUM_DIGITS(x))
+#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
#define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)
#define BIGRAD_HALF ((BDIGIT)(BIGRAD >> 1))
#define BDIGIT_MSB(d) (((d) & BIGRAD_HALF) != 0)
@@ -81,24 +84,25 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG == 0);
#define BDIGMAX ((BDIGIT)(BIGRAD-1))
#define BDIGIT_DBL_MAX (~(BDIGIT_DBL)0)
-#if SIZEOF_BDIGIT == 2
+#if SIZEOF_BDIGITS == 2
# define swap_bdigit(x) swap16(x)
-#elif SIZEOF_BDIGIT == 4
+#elif SIZEOF_BDIGITS == 4
# define swap_bdigit(x) swap32(x)
-#elif SIZEOF_BDIGIT == 8
+#elif SIZEOF_BDIGITS == 8
# define swap_bdigit(x) swap64(x)
#endif
-#define BIGZEROP(x) (BIGNUM_LEN(x) == 0 || \
+#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \
(BDIGITS(x)[0] == 0 && \
- (BIGNUM_LEN(x) == 1 || bigzero_p(x))))
-#define BIGSIZE(x) (BIGNUM_LEN(x) == 0 ? (size_t)0 : \
- BDIGITS(x)[BIGNUM_LEN(x)-1] ? \
- (size_t)(BIGNUM_LEN(x)*SIZEOF_BDIGIT - nlz(BDIGITS(x)[BIGNUM_LEN(x)-1])/CHAR_BIT) : \
+ (RBIGNUM_LEN(x) == 1 || bigzero_p(x))))
+#define BIGSIZE(x) (RBIGNUM_LEN(x) == 0 ? (size_t)0 : \
+ BDIGITS(x)[RBIGNUM_LEN(x)-1] ? \
+ (size_t)(RBIGNUM_LEN(x)*SIZEOF_BDIGITS - nlz(BDIGITS(x)[RBIGNUM_LEN(x)-1])/CHAR_BIT) : \
rb_absint_size(x, NULL))
#define BIGDIVREM_EXTRA_WORDS 1
-#define bdigit_roomof(n) roomof(n, SIZEOF_BDIGIT)
+#define roomof(n, m) ((long)(((n)+(m)-1) / (m)))
+#define bdigit_roomof(n) roomof(n, SIZEOF_BDIGITS)
#define BARY_ARGS(ary) ary, numberof(ary)
#define BARY_ADD(z, x, y) bary_add(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
@@ -107,8 +111,8 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG == 0);
#define BARY_DIVMOD(q, r, x, y) bary_divmod(BARY_ARGS(q), BARY_ARGS(r), BARY_ARGS(x), BARY_ARGS(y))
#define BARY_ZERO_P(x) bary_zero_p(BARY_ARGS(x))
-#define BIGNUM_SET_NEGATIVE_SIGN(b) BIGNUM_SET_SIGN(b, 0)
-#define BIGNUM_SET_POSITIVE_SIGN(b) BIGNUM_SET_SIGN(b, 1)
+#define RBIGNUM_SET_NEGATIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 0)
+#define RBIGNUM_SET_POSITIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 1)
#define bignew(len,sign) bignew_1(rb_cBignum,(len),(sign))
@@ -146,21 +150,21 @@ static void bary_divmod(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BD
static VALUE bigmul0(VALUE x, VALUE y);
static void bary_mul_toom3(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn);
-static VALUE bignew_1(VALUE klass, size_t len, int sign);
+static VALUE bignew_1(VALUE klass, long len, int sign);
static inline VALUE bigtrunc(VALUE x);
static VALUE bigsq(VALUE x);
static void bigdivmod(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp);
static inline VALUE power_cache_get_power(int base, int power_level, size_t *numdigits_ret);
-#if SIZEOF_BDIGIT <= SIZEOF_INT
-static int nlz(BDIGIT x) { return nlz_int((unsigned int)x) - (SIZEOF_INT-SIZEOF_BDIGIT) * CHAR_BIT; }
-#elif SIZEOF_BDIGIT <= SIZEOF_LONG
-static int nlz(BDIGIT x) { return nlz_long((unsigned long)x) - (SIZEOF_LONG-SIZEOF_BDIGIT) * CHAR_BIT; }
-#elif SIZEOF_BDIGIT <= SIZEOF_LONG_LONG
-static int nlz(BDIGIT x) { return nlz_long_long((unsigned LONG_LONG)x) - (SIZEOF_LONG_LONG-SIZEOF_BDIGIT) * CHAR_BIT; }
-#elif SIZEOF_BDIGIT <= SIZEOF_INT128_T
-static int nlz(BDIGIT x) { return nlz_int128((uint128_t)x) - (SIZEOF_INT128_T-SIZEOF_BDIGIT) * CHAR_BIT; }
+#if SIZEOF_BDIGITS <= SIZEOF_INT
+static int nlz(BDIGIT x) { return nlz_int((unsigned int)x) - (SIZEOF_INT-SIZEOF_BDIGITS) * CHAR_BIT; }
+#elif SIZEOF_BDIGITS <= SIZEOF_LONG
+static int nlz(BDIGIT x) { return nlz_long((unsigned long)x) - (SIZEOF_LONG-SIZEOF_BDIGITS) * CHAR_BIT; }
+#elif SIZEOF_BDIGITS <= SIZEOF_LONG_LONG
+static int nlz(BDIGIT x) { return nlz_long_long((unsigned LONG_LONG)x) - (SIZEOF_LONG_LONG-SIZEOF_BDIGITS) * CHAR_BIT; }
+#elif SIZEOF_BDIGITS <= SIZEOF_INT128_T
+static int nlz(BDIGIT x) { return nlz_int128((uint128_t)x) - (SIZEOF_INT128_T-SIZEOF_BDIGITS) * CHAR_BIT; }
#endif
#define U16(a) ((uint16_t)(a))
@@ -172,7 +176,7 @@ static int nlz(BDIGIT x) { return nlz_int128((uint128_t)x) - (SIZEOF_INT128_T-SI
#define U128(a,b,c,d) (((uint128_t)U64(a,b) << 64) | U64(c,d))
#endif
-/* The following script, maxpow.rb, generates the tables follows.
+/* The following scirpt, maxpow.rb, generates the tables follows.
def big(n, bits)
ns = []
@@ -216,7 +220,7 @@ end
*/
-#if SIZEOF_BDIGIT_DBL == 2
+#ifdef HAVE_UINT16_T
static const int maxpow16_exp[35] = {
15, 10, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -232,7 +236,8 @@ static const uint16_t maxpow16_num[35] = {
U16(0x00006978), U16(0x0000745f), U16(0x00008000), U16(0x00008c61),
U16(0x00009988), U16(0x0000a77b), U16(0x0000b640),
};
-#elif SIZEOF_BDIGIT_DBL == 4
+#endif
+#ifdef HAVE_UINT32_T
static const int maxpow32_exp[35] = {
31, 20, 15, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7,
7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
@@ -248,7 +253,8 @@ static const uint32_t maxpow32_num[35] = {
U32(0x2b73a840), U32(0x34e63b41), U32(0x40000000), U32(0x4cfa3cc1),
U32(0x5c13d840), U32(0x6d91b519), U32(0x81bf1000),
};
-#elif SIZEOF_BDIGIT_DBL == 8 && defined HAVE_UINT64_T
+#endif
+#ifdef HAVE_UINT64_T
static const int maxpow64_exp[35] = {
63, 40, 31, 27, 24, 22, 21, 20, 19, 18, 17, 17, 16, 16, 15, 15, 15,
15, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12,
@@ -274,7 +280,8 @@ static const uint64_t maxpow64_num[35] = {
U64(0x211e44f7,0xd02c1000), U64(0x2ee56725,0xf06e5c71),
U64(0x41c21cb8,0xe1000000),
};
-#elif SIZEOF_BDIGIT_DBL == 16 && defined HAVE_UINT128_T
+#endif
+#ifdef HAVE_UINT128_T
static const int maxpow128_exp[35] = {
127, 80, 63, 55, 49, 45, 42, 40, 38, 37, 35, 34, 33, 32, 31, 31, 30,
30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 24,
@@ -660,7 +667,7 @@ bary_pack(int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords
*((unsigned char *)words) = (unsigned char)(d = dp[0]);
return ((1 < de - dp || CLEAR_LOWBITS(d, 8) != 0) ? 2 : 1) * sign;
}
-#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGITS
if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
uint16_t u = (uint16_t)(d = dp[0]);
if (need_swap) u = swap16(u);
@@ -668,7 +675,7 @@ bary_pack(int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords
return ((1 < de - dp || CLEAR_LOWBITS(d, 16) != 0) ? 2 : 1) * sign;
}
#endif
-#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
uint32_t u = (uint32_t)(d = dp[0]);
if (need_swap) u = swap32(u);
@@ -676,7 +683,7 @@ bary_pack(int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords
return ((1 < de - dp || CLEAR_LOWBITS(d, 32) != 0) ? 2 : 1) * sign;
}
#endif
-#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
uint64_t u = (uint64_t)(d = dp[0]);
if (need_swap) u = swap64(u);
@@ -691,40 +698,40 @@ bary_pack(int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords
*((unsigned char *)words) = (unsigned char)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
return (1 < de - dp || FILL_LOWBITS(d, 8) != -1) ? -2 : -1;
}
-#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGITS
if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
uint16_t u = (uint16_t)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
if (need_swap) u = swap16(u);
*((uint16_t *)words) = u;
- return (wordsize == SIZEOF_BDIGIT && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
+ return (wordsize == SIZEOF_BDIGITS && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
(1 < de - dp || FILL_LOWBITS(d, 16) != -1) ? -2 : -1;
}
#endif
-#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
uint32_t u = (uint32_t)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
if (need_swap) u = swap32(u);
*((uint32_t *)words) = u;
- return (wordsize == SIZEOF_BDIGIT && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
+ return (wordsize == SIZEOF_BDIGITS && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
(1 < de - dp || FILL_LOWBITS(d, 32) != -1) ? -2 : -1;
}
#endif
-#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
uint64_t u = (uint64_t)(d = -(BDIGIT_DBL_SIGNED)dp[0]);
if (need_swap) u = swap64(u);
*((uint64_t *)words) = u;
- return (wordsize == SIZEOF_BDIGIT && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
+ return (wordsize == SIZEOF_BDIGITS && de - dp == 2 && dp[1] == 1 && dp[0] == 0) ? -1 :
(1 < de - dp || FILL_LOWBITS(d, 64) != -1) ? -2 : -1;
}
#endif
}
}
#if !defined(WORDS_BIGENDIAN)
- if (nails == 0 && SIZEOF_BDIGIT == sizeof(BDIGIT) &&
+ if (nails == 0 && SIZEOF_BDIGITS == sizeof(BDIGIT) &&
(flags & INTEGER_PACK_WORDORDER_MASK) == INTEGER_PACK_LSWORD_FIRST &&
(flags & INTEGER_PACK_BYTEORDER_MASK) != INTEGER_PACK_MSBYTE_FIRST) {
- size_t src_size = (de - dp) * SIZEOF_BDIGIT;
+ size_t src_size = (de - dp) * SIZEOF_BDIGITS;
size_t dst_size = numwords * wordsize;
int overflow = 0;
while (0 < src_size && ((unsigned char *)ds)[src_size-1] == 0)
@@ -752,9 +759,9 @@ bary_pack(int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords
return sign;
}
#endif
- if (nails == 0 && SIZEOF_BDIGIT == sizeof(BDIGIT) &&
- wordsize % SIZEOF_BDIGIT == 0 && (uintptr_t)words % ALIGNOF(BDIGIT) == 0) {
- size_t bdigits_per_word = wordsize / SIZEOF_BDIGIT;
+ if (nails == 0 && SIZEOF_BDIGITS == sizeof(BDIGIT) &&
+ wordsize % SIZEOF_BDIGITS == 0 && (uintptr_t)words % ALIGNOF(BDIGIT) == 0) {
+ size_t bdigits_per_word = wordsize / SIZEOF_BDIGITS;
size_t src_num_bdigits = de - dp;
size_t dst_num_bdigits = numwords * bdigits_per_word;
int overflow = 0;
@@ -965,7 +972,7 @@ integer_unpack_num_bdigits_small(size_t numwords, size_t wordsize, size_t nails,
static size_t
integer_unpack_num_bdigits_generic(size_t numwords, size_t wordsize, size_t nails, int *nlp_bits_ret)
{
- /* BITSPERDIG = SIZEOF_BDIGIT * CHAR_BIT */
+ /* BITSPERDIG = SIZEOF_BDIGITS * CHAR_BIT */
/* num_bits = (wordsize * CHAR_BIT - nails) * numwords */
/* num_bdigits = (num_bits + BITSPERDIG - 1) / BITSPERDIG */
@@ -1062,7 +1069,7 @@ integer_unpack_single_bdigit(BDIGIT u, size_t size, int flags, BDIGIT *dp)
int sign;
if (flags & INTEGER_PACK_2COMP) {
sign = (flags & INTEGER_PACK_NEGATIVE) ?
- ((size == SIZEOF_BDIGIT && u == 0) ? -2 : -1) :
+ ((size == SIZEOF_BDIGITS && u == 0) ? -2 : -1) :
((u >> (size * CHAR_BIT - 1)) ? -1 : 1);
if (sign < 0) {
u |= LSHIFTX(BDIGMAX, size * CHAR_BIT);
@@ -1094,19 +1101,19 @@ bary_unpack_internal(BDIGIT *bdigits, size_t num_bdigits, const void *words, siz
if (wordsize == 1) {
return integer_unpack_single_bdigit(*(uint8_t *)buf, sizeof(uint8_t), flags, dp);
}
-#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGITS
if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
uint16_t u = *(uint16_t *)buf;
return integer_unpack_single_bdigit(need_swap ? swap16(u) : u, sizeof(uint16_t), flags, dp);
}
#endif
-#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
uint32_t u = *(uint32_t *)buf;
return integer_unpack_single_bdigit(need_swap ? swap32(u) : u, sizeof(uint32_t), flags, dp);
}
#endif
-#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGIT
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
uint64_t u = *(uint64_t *)buf;
return integer_unpack_single_bdigit(need_swap ? swap64(u) : u, sizeof(uint64_t), flags, dp);
@@ -1114,11 +1121,11 @@ bary_unpack_internal(BDIGIT *bdigits, size_t num_bdigits, const void *words, siz
#endif
}
#if !defined(WORDS_BIGENDIAN)
- if (nails == 0 && SIZEOF_BDIGIT == sizeof(BDIGIT) &&
+ if (nails == 0 && SIZEOF_BDIGITS == sizeof(BDIGIT) &&
(flags & INTEGER_PACK_WORDORDER_MASK) == INTEGER_PACK_LSWORD_FIRST &&
(flags & INTEGER_PACK_BYTEORDER_MASK) != INTEGER_PACK_MSBYTE_FIRST) {
size_t src_size = numwords * wordsize;
- size_t dst_size = num_bdigits * SIZEOF_BDIGIT;
+ size_t dst_size = num_bdigits * SIZEOF_BDIGITS;
MEMCPY(dp, words, char, src_size);
if (flags & INTEGER_PACK_2COMP) {
if (flags & INTEGER_PACK_NEGATIVE) {
@@ -1144,9 +1151,9 @@ bary_unpack_internal(BDIGIT *bdigits, size_t num_bdigits, const void *words, siz
return sign;
}
#endif
- if (nails == 0 && SIZEOF_BDIGIT == sizeof(BDIGIT) &&
- wordsize % SIZEOF_BDIGIT == 0) {
- size_t bdigits_per_word = wordsize / SIZEOF_BDIGIT;
+ if (nails == 0 && SIZEOF_BDIGITS == sizeof(BDIGIT) &&
+ wordsize % SIZEOF_BDIGITS == 0) {
+ size_t bdigits_per_word = wordsize / SIZEOF_BDIGITS;
int mswordfirst_p = (flags & INTEGER_PACK_MSWORD_FIRST) != 0;
int msbytefirst_p = (flags & INTEGER_PACK_NATIVE_BYTE_ORDER) ? HOST_BIGENDIAN_P :
(flags & INTEGER_PACK_MSBYTE_FIRST) != 0;
@@ -1537,8 +1544,8 @@ bary_mul_normal(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIG
VALUE
rb_big_mul_normal(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
- VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
bary_mul_normal(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
RB_GC_GUARD(x);
RB_GC_GUARD(y);
@@ -1606,7 +1613,7 @@ bary_sq_fast(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn)
VALUE
rb_big_sq_fast(VALUE x)
{
- size_t xn = BIGNUM_LEN(x), zn = 2 * xn;
+ size_t xn = RBIGNUM_LEN(x), zn = 2 * xn;
VALUE z = bignew(zn, 1);
bary_sq_fast(BDIGITS(z), zn, BDIGITS(x), xn);
RB_GC_GUARD(x);
@@ -1648,7 +1655,7 @@ bary_mul_balance_with_mulfunc(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t
}
tds = zds + n;
MEMCPY(wds, zds + n, BDIGIT, xn);
- mulfunc(tds, tn, xds, xn, yds + n, r, wds+xn, wn-xn);
+ mulfunc(tds, tn, xds, xn, yds + n, r, wds-xn, wn-xn);
bary_add(zds + n, tn,
zds + n, tn,
wds, xn);
@@ -1665,8 +1672,8 @@ bary_mul_balance_with_mulfunc(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t
VALUE
rb_big_mul_balance(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
- VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
bary_mul_balance_with_mulfunc(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0, bary_mul_toom3_start);
RB_GC_GUARD(x);
RB_GC_GUARD(y);
@@ -1821,12 +1828,12 @@ bary_mul_karatsuba(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const B
}
/*
- if (SIZEOF_BDIGIT * zn <= 16) {
+ if (SIZEOF_BDIGITS * zn <= 16) {
uint128_t z, x, y;
ssize_t i;
- for (x = 0, i = xn-1; 0 <= i; i--) { x <<= SIZEOF_BDIGIT*CHAR_BIT; x |= xds[i]; }
- for (y = 0, i = yn-1; 0 <= i; i--) { y <<= SIZEOF_BDIGIT*CHAR_BIT; y |= yds[i]; }
- for (z = 0, i = zn-1; 0 <= i; i--) { z <<= SIZEOF_BDIGIT*CHAR_BIT; z |= zds[i]; }
+ for (x = 0, i = xn-1; 0 <= i; i--) { x <<= SIZEOF_BDIGITS*CHAR_BIT; x |= xds[i]; }
+ for (y = 0, i = yn-1; 0 <= i; i--) { y <<= SIZEOF_BDIGITS*CHAR_BIT; y |= yds[i]; }
+ for (z = 0, i = zn-1; 0 <= i; i--) { z <<= SIZEOF_BDIGITS*CHAR_BIT; z |= zds[i]; }
assert(z == x * y);
}
*/
@@ -1846,8 +1853,8 @@ bary_mul_karatsuba(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const B
VALUE
rb_big_mul_karatsuba(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
- VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
if (!((xn <= yn && yn < 2) || KARATSUBA_BALANCED(xn, yn)))
rb_raise(rb_eArgError, "unexpected bignum length for karatsuba");
bary_mul_karatsuba(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0);
@@ -2243,8 +2250,8 @@ bary_mul_toom3(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGI
VALUE
rb_big_mul_toom3(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
- VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
if (xn > yn || yn < 3 || !TOOM3_BALANCED(xn,yn))
rb_raise(rb_eArgError, "unexpected bignum length for toom3");
bary_mul_toom3(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, NULL, 0);
@@ -2257,7 +2264,7 @@ rb_big_mul_toom3(VALUE x, VALUE y)
static void
bary_mul_gmp(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
{
- const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGITS)*CHAR_BIT;
mpz_t x, y, z;
size_t count;
@@ -2284,8 +2291,8 @@ bary_mul_gmp(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT
VALUE
rb_big_mul_gmp(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), zn = xn + yn;
- VALUE z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), zn = xn + yn;
+ VALUE z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
bary_mul_gmp(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
RB_GC_GUARD(x);
RB_GC_GUARD(y);
@@ -2358,7 +2365,7 @@ bary_mul_precheck(BDIGIT **zdsp, size_t *znp, const BDIGIT **xdsp, size_t *xnp,
}
else {
do {
- if (yds[0] != 0)
+ if (xds[0] != 0)
break;
yds++;
yn--;
@@ -2695,7 +2702,7 @@ bary_divmod_normal(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT
VALUE
rb_big_divrem_normal(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), qn, rn;
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), qn, rn;
BDIGIT *xds = BDIGITS(x), *yds = BDIGITS(y), *qds, *rds;
VALUE q, r;
@@ -2708,11 +2715,11 @@ rb_big_divrem_normal(VALUE x, VALUE y)
return rb_assoc_new(LONG2FIX(0), x);
qn = xn + BIGDIVREM_EXTRA_WORDS;
- q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ q = bignew(qn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
qds = BDIGITS(q);
rn = yn;
- r = bignew(rn, BIGNUM_SIGN(x));
+ r = bignew(rn, RBIGNUM_SIGN(x));
rds = BDIGITS(r);
bary_divmod_normal(qds, qn, rds, rn, xds, xn, yds, yn);
@@ -2730,7 +2737,7 @@ rb_big_divrem_normal(VALUE x, VALUE y)
static void
bary_divmod_gmp(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
{
- const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGITS)*CHAR_BIT;
mpz_t x, y, q, r;
size_t count;
@@ -2776,7 +2783,7 @@ bary_divmod_gmp(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xd
VALUE
rb_big_divrem_gmp(VALUE x, VALUE y)
{
- size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), qn, rn;
+ size_t xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y), qn, rn;
BDIGIT *xds = BDIGITS(x), *yds = BDIGITS(y), *qds, *rds;
VALUE q, r;
@@ -2789,11 +2796,11 @@ rb_big_divrem_gmp(VALUE x, VALUE y)
return rb_assoc_new(LONG2FIX(0), x);
qn = xn - yn + 1;
- q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ q = bignew(qn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
qds = BDIGITS(q);
rn = yn;
- r = bignew(rn, BIGNUM_SIGN(x));
+ r = bignew(rn, RBIGNUM_SIGN(x));
rds = BDIGITS(r);
bary_divmod_gmp(qds, qn, rds, rn, xds, xn, yds, yn);
@@ -2873,11 +2880,11 @@ static void
dump_bignum(VALUE x)
{
long i;
- printf("%c0x0", BIGNUM_SIGN(x) ? '+' : '-');
- for (i = BIGNUM_LEN(x); i--; ) {
- printf("_%0*"PRIxBDIGIT, SIZEOF_BDIGIT*2, BDIGITS(x)[i]);
+ printf("%c0x0", RBIGNUM_SIGN(x) ? '+' : '-');
+ for (i = RBIGNUM_LEN(x); i--; ) {
+ printf("_%0*"PRIxBDIGIT, SIZEOF_BDIGITS*2, BDIGITS(x)[i]);
}
- printf(", len=%"PRIuSIZE, BIGNUM_LEN(x));
+ printf(", len=%lu", RBIGNUM_LEN(x));
puts("");
}
@@ -2894,7 +2901,7 @@ rb_big_dump(VALUE x)
static int
bigzero_p(VALUE x)
{
- return bary_zero_p(BDIGITS(x), BIGNUM_LEN(x));
+ return bary_zero_p(BDIGITS(x), RBIGNUM_LEN(x));
}
int
@@ -2917,7 +2924,7 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
}
if (RB_BIGNUM_TYPE_P(val)) {
if (BIGZEROP(val)) return 0;
- if (BIGNUM_SIGN(val)) return 1;
+ if (RBIGNUM_SIGN(val)) return 1;
return -1;
}
if (RTEST(rb_funcall(val, '>', 1, INT2FIX(0)))) return 1;
@@ -2925,31 +2932,31 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
return 0;
}
-#define BIGNUM_SET_LEN(b,l) \
- ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
+#define RBIGNUM_SET_LEN(b,l) \
+ ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
(void)(RBASIC(b)->flags = \
- (RBASIC(b)->flags & ~BIGNUM_EMBED_LEN_MASK) | \
- ((l) << BIGNUM_EMBED_LEN_SHIFT)) : \
+ (RBASIC(b)->flags & ~RBIGNUM_EMBED_LEN_MASK) | \
+ ((l) << RBIGNUM_EMBED_LEN_SHIFT)) : \
(void)(RBIGNUM(b)->as.heap.len = (l)))
static void
-rb_big_realloc(VALUE big, size_t len)
+rb_big_realloc(VALUE big, long len)
{
BDIGIT *ds;
- if (RBASIC(big)->flags & BIGNUM_EMBED_FLAG) {
- if (BIGNUM_EMBED_LEN_MAX < len) {
+ if (RBASIC(big)->flags & RBIGNUM_EMBED_FLAG) {
+ if (RBIGNUM_EMBED_LEN_MAX < len) {
ds = ALLOC_N(BDIGIT, len);
- MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, BIGNUM_EMBED_LEN_MAX);
- RBIGNUM(big)->as.heap.len = BIGNUM_LEN(big);
+ MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, RBIGNUM_EMBED_LEN_MAX);
+ RBIGNUM(big)->as.heap.len = RBIGNUM_LEN(big);
RBIGNUM(big)->as.heap.digits = ds;
- RBASIC(big)->flags &= ~BIGNUM_EMBED_FLAG;
+ RBASIC(big)->flags &= ~RBIGNUM_EMBED_FLAG;
}
}
else {
- if (len <= BIGNUM_EMBED_LEN_MAX) {
+ if (len <= RBIGNUM_EMBED_LEN_MAX) {
ds = RBIGNUM(big)->as.heap.digits;
- RBASIC(big)->flags |= BIGNUM_EMBED_FLAG;
- BIGNUM_SET_LEN(big, len);
+ RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
+ RBIGNUM_SET_LEN(big, len);
(void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
if (ds) {
MEMCPY(RBIGNUM(big)->as.ary, ds, BDIGIT, len);
@@ -2957,7 +2964,7 @@ rb_big_realloc(VALUE big, size_t len)
}
}
else {
- if (BIGNUM_LEN(big) == 0) {
+ if (RBIGNUM_LEN(big) == 0) {
RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
}
else {
@@ -2968,20 +2975,20 @@ rb_big_realloc(VALUE big, size_t len)
}
void
-rb_big_resize(VALUE big, size_t len)
+rb_big_resize(VALUE big, long len)
{
rb_big_realloc(big, len);
- BIGNUM_SET_LEN(big, len);
+ RBIGNUM_SET_LEN(big, len);
}
static VALUE
-bignew_1(VALUE klass, size_t len, int sign)
+bignew_1(VALUE klass, long len, int sign)
{
NEWOBJ_OF(big, struct RBignum, klass, T_BIGNUM | (RGENGC_WB_PROTECTED_BIGNUM ? FL_WB_PROTECTED : 0));
- BIGNUM_SET_SIGN(big, sign?1:0);
- if (len <= BIGNUM_EMBED_LEN_MAX) {
- RBASIC(big)->flags |= BIGNUM_EMBED_FLAG;
- BIGNUM_SET_LEN(big, len);
+ RBIGNUM_SET_SIGN(big, sign?1:0);
+ if (len <= RBIGNUM_EMBED_LEN_MAX) {
+ RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
+ RBIGNUM_SET_LEN(big, len);
(void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
}
else {
@@ -2993,7 +3000,7 @@ bignew_1(VALUE klass, size_t len, int sign)
}
VALUE
-rb_big_new(size_t len, int sign)
+rb_big_new(long len, int sign)
{
return bignew(len, sign != 0);
}
@@ -3001,8 +3008,8 @@ rb_big_new(size_t len, int sign)
VALUE
rb_big_clone(VALUE x)
{
- size_t len = BIGNUM_LEN(x);
- VALUE z = bignew_1(CLASS_OF(x), len, BIGNUM_SIGN(x));
+ long len = RBIGNUM_LEN(x);
+ VALUE z = bignew_1(CLASS_OF(x), len, RBIGNUM_SIGN(x));
MEMCPY(BDIGITS(z), BDIGITS(x), BDIGIT, len);
return z;
@@ -3011,15 +3018,15 @@ rb_big_clone(VALUE x)
static void
big_extend_carry(VALUE x)
{
- rb_big_resize(x, BIGNUM_LEN(x)+1);
- BDIGITS(x)[BIGNUM_LEN(x)-1] = 1;
+ rb_big_resize(x, RBIGNUM_LEN(x)+1);
+ BDIGITS(x)[RBIGNUM_LEN(x)-1] = 1;
}
/* modify a bignum by 2's complement */
static void
get2comp(VALUE x)
{
- long i = BIGNUM_LEN(x);
+ long i = RBIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
if (bary_2comp(ds, i)) {
@@ -3037,13 +3044,13 @@ static BDIGIT
abs2twocomp(VALUE *xp, long *n_ret)
{
VALUE x = *xp;
- long n = BIGNUM_LEN(x);
+ long n = RBIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
BDIGIT hibits = 0;
BARY_TRUNC(ds, n);
- if (n != 0 && BIGNUM_NEGATIVE_P(x)) {
+ if (n != 0 && RBIGNUM_NEGATIVE_P(x)) {
VALUE z = bignew_1(CLASS_OF(x), n, 0);
MEMCPY(BDIGITS(z), ds, BDIGIT, n);
bary_2comp(BDIGITS(z), n);
@@ -3057,7 +3064,7 @@ abs2twocomp(VALUE *xp, long *n_ret)
static void
twocomp2abs_bang(VALUE x, int hibits)
{
- BIGNUM_SET_SIGN(x, !hibits);
+ RBIGNUM_SET_SIGN(x, !hibits);
if (hibits) {
get2comp(x);
}
@@ -3066,12 +3073,12 @@ twocomp2abs_bang(VALUE x, int hibits)
static inline VALUE
bigtrunc(VALUE x)
{
- size_t len = BIGNUM_LEN(x);
+ long len = RBIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
if (len == 0) return x;
while (--len && !ds[len]);
- if (BIGNUM_LEN(x) > len+1) {
+ if (RBIGNUM_LEN(x) > len+1) {
rb_big_resize(x, len+1);
}
return x;
@@ -3080,9 +3087,9 @@ bigtrunc(VALUE x)
static inline VALUE
bigfixize(VALUE x)
{
- size_t n = BIGNUM_LEN(x);
+ size_t n = RBIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+#if SIZEOF_BDIGITS < SIZEOF_LONG
unsigned long u;
#else
BDIGIT u;
@@ -3092,8 +3099,8 @@ bigfixize(VALUE x)
if (n == 0) return INT2FIX(0);
-#if SIZEOF_BDIGIT < SIZEOF_LONG
- if (sizeof(long)/SIZEOF_BDIGIT < n)
+#if SIZEOF_BDIGITS < SIZEOF_LONG
+ if (sizeof(long)/SIZEOF_BDIGITS < n)
goto return_big;
else {
int i = (int)n;
@@ -3102,14 +3109,14 @@ bigfixize(VALUE x)
u = (unsigned long)(BIGUP(u) + ds[i]);
}
}
-#else /* SIZEOF_BDIGIT >= SIZEOF_LONG */
+#else /* SIZEOF_BDIGITS >= SIZEOF_LONG */
if (1 < n)
goto return_big;
else
u = ds[0];
#endif
- if (BIGNUM_POSITIVE_P(x)) {
+ if (RBIGNUM_POSITIVE_P(x)) {
if (POSFIXABLE(u)) return LONG2FIX((long)u);
}
else {
@@ -3143,7 +3150,7 @@ rb_uint2big(VALUE n)
VALUE big = bignew(bdigit_roomof(SIZEOF_VALUE), 1);
BDIGIT *digits = BDIGITS(big);
-#if SIZEOF_BDIGIT >= SIZEOF_VALUE
+#if SIZEOF_BDIGITS >= SIZEOF_VALUE
digits[0] = n;
#else
for (i = 0; i < bdigit_roomof(SIZEOF_VALUE); i++) {
@@ -3154,7 +3161,7 @@ rb_uint2big(VALUE n)
i = bdigit_roomof(SIZEOF_VALUE);
while (--i && !digits[i]) ;
- BIGNUM_SET_LEN(big, i+1);
+ RBIGNUM_SET_LEN(big, i+1);
return big;
}
@@ -3174,7 +3181,7 @@ rb_int2big(SIGNED_VALUE n)
}
big = rb_uint2big(u);
if (neg) {
- BIGNUM_SET_SIGN(big, 0);
+ RBIGNUM_SET_SIGN(big, 0);
}
return big;
}
@@ -3241,7 +3248,7 @@ rb_absint_size(VALUE val, int *nlz_bits_ret)
if (v < 0) {
v = -v;
}
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
fixbuf[0] = v;
#else
{
@@ -3257,7 +3264,7 @@ rb_absint_size(VALUE val, int *nlz_bits_ret)
}
else {
dp = BDIGITS(val);
- de = dp + BIGNUM_LEN(val);
+ de = dp + RBIGNUM_LEN(val);
}
while (dp < de && de[-1] == 0)
de--;
@@ -3269,7 +3276,7 @@ rb_absint_size(VALUE val, int *nlz_bits_ret)
num_leading_zeros = nlz(de[-1]);
if (nlz_bits_ret)
*nlz_bits_ret = num_leading_zeros % CHAR_BIT;
- return (de - dp) * SIZEOF_BDIGIT - num_leading_zeros / CHAR_BIT;
+ return (de - dp) * SIZEOF_BDIGITS - num_leading_zeros / CHAR_BIT;
}
static size_t
@@ -3292,7 +3299,7 @@ absint_numwords_generic(size_t numbytes, int nlz_bits_in_msbyte, size_t word_num
static const BDIGIT char_bit[1] = { CHAR_BIT };
BDIGIT numbytes_bary[bdigit_roomof(sizeof(numbytes))];
BDIGIT val_numbits_bary[bdigit_roomof(sizeof(numbytes) + 1)];
- BDIGIT nlz_bits_in_msbyte_bary[1];
+ BDIGIT nlz_bits_in_msbyte_bary[1] = { nlz_bits_in_msbyte };
BDIGIT word_numbits_bary[bdigit_roomof(sizeof(word_numbits))];
BDIGIT div_bary[numberof(val_numbits_bary) + BIGDIVREM_EXTRA_WORDS];
BDIGIT mod_bary[numberof(word_numbits_bary)];
@@ -3302,8 +3309,6 @@ absint_numwords_generic(size_t numbytes, int nlz_bits_in_msbyte, size_t word_num
int sign;
size_t numwords;
- nlz_bits_in_msbyte_bary[0] = nlz_bits_in_msbyte;
-
/*
* val_numbits = numbytes * CHAR_BIT - nlz_bits_in_msbyte
* div, mod = val_numbits.divmod(word_numbits)
@@ -3408,7 +3413,7 @@ rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret)
* represent val in two's complement number, without sign bit.
*
* size_t size;
- * int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val);
+ * int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : RBIGNUM_NEGATIVE_P(val);
* size = rb_absint_numwords(val, 1, NULL)
* if (size == (size_t)-1) ...overflow...
* if (neg && rb_absint_singlebit_p(val))
@@ -3418,7 +3423,7 @@ rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret)
* represent val in two's complement number, with sign bit.
*
* size_t size;
- * int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val);
+ * int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : RBIGNUM_NEGATIVE_P(val);
* int nlz_bits;
* size = rb_absint_size(val, &nlz_bits);
* if (nlz_bits == 0 && !(neg && rb_absint_singlebit_p(val)))
@@ -3439,7 +3444,7 @@ rb_absint_singlebit_p(VALUE val)
if (v < 0) {
v = -v;
}
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
fixbuf[0] = v;
#else
{
@@ -3455,7 +3460,7 @@ rb_absint_singlebit_p(VALUE val)
}
else {
dp = BDIGITS(val);
- de = dp + BIGNUM_LEN(val);
+ de = dp + RBIGNUM_LEN(val);
}
while (dp < de && de[-1] == 0)
de--;
@@ -3544,7 +3549,7 @@ rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t
else {
sign = 1;
}
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
fixbuf[0] = v;
#else
{
@@ -3559,9 +3564,9 @@ rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t
num_bdigits = numberof(fixbuf);
}
else {
- sign = BIGNUM_POSITIVE_P(val) ? 1 : -1;
+ sign = RBIGNUM_POSITIVE_P(val) ? 1 : -1;
ds = BDIGITS(val);
- num_bdigits = BIGNUM_LEN(val);
+ num_bdigits = RBIGNUM_LEN(val);
}
return bary_pack(sign, ds, num_bdigits, words, numwords, wordsize, nails, flags);
@@ -3674,15 +3679,33 @@ rb_integer_unpack(const void *words, size_t numwords, size_t wordsize, size_t na
}
if ((flags & INTEGER_PACK_FORCE_BIGNUM) && sign != 0 &&
- bary_zero_p(BDIGITS(val), BIGNUM_LEN(val)))
+ bary_zero_p(BDIGITS(val), RBIGNUM_LEN(val)))
sign = 0;
- BIGNUM_SET_SIGN(val, 0 <= sign);
+ RBIGNUM_SET_SIGN(val, 0 <= sign);
if (flags & INTEGER_PACK_FORCE_BIGNUM)
return bigtrunc(val);
return bignorm(val);
}
+#define QUAD_SIZE 8
+
+void
+rb_quad_pack(char *buf, VALUE val)
+{
+ rb_integer_pack(val, buf, 1, QUAD_SIZE, 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP);
+}
+
+VALUE
+rb_quad_unpack(const char *buf, int signed_p)
+{
+ return rb_integer_unpack(buf, 1, QUAD_SIZE, 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ (signed_p ? INTEGER_PACK_2COMP : 0));
+}
+
#define conv_digit(c) (ruby_digit36_to_number_table[(unsigned char)(c)])
static void
@@ -3868,11 +3891,11 @@ str2big_karatsuba(
for (unit = 2; unit < num_bdigits; unit *= 2) {
for (i = 0; i < num_bdigits; i += unit*2) {
if (2*unit <= num_bdigits - i) {
- bary_mul(vds+i, unit*2, BDIGITS(powerv), BIGNUM_LEN(powerv), uds+i+unit, unit);
+ bary_mul(vds+i, unit*2, BDIGITS(powerv), RBIGNUM_LEN(powerv), uds+i+unit, unit);
bary_add(vds+i, unit*2, vds+i, unit*2, uds+i, unit);
}
else if (unit <= num_bdigits - i) {
- bary_mul(vds+i, num_bdigits-i, BDIGITS(powerv), BIGNUM_LEN(powerv), uds+i+unit, num_bdigits-(i+unit));
+ bary_mul(vds+i, num_bdigits-i, BDIGITS(powerv), RBIGNUM_LEN(powerv), uds+i+unit, num_bdigits-(i+unit));
bary_add(vds+i, num_bdigits-i, vds+i, num_bdigits-i, uds+i, unit);
}
else {
@@ -3905,7 +3928,7 @@ str2big_gmp(
size_t num_bdigits,
int base)
{
- const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGITS)*CHAR_BIT;
char *buf, *p;
const char *q;
VALUE tmps;
@@ -3939,22 +3962,6 @@ str2big_gmp(
}
#endif
-/*
- * Parse +str+ as Ruby Integer, i.e., underscores, 0d and 0b prefixes.
- *
- * str: pointer to the string to be parsed.
- * should be NUL-terminated.
- * base: base of conversion, must be 2..36, or -36..0.
- * if +base+ > 0, the conversion is done according to the +base+
- * and unmatched prefix is parsed as a part of the result if
- * present.
- * if +base+ <= 0, the conversion is done according to the
- * prefix if present, in base <code>-base</code> if +base+ < -1,
- * or in base 10.
- * badcheck: if non-zero, +ArgumentError+ is raised when +str+ is not
- * valid as an Integer. if zero, Fixnum 0 is returned in
- * that case.
- */
VALUE
rb_cstr_to_inum(const char *str, int base, int badcheck)
{
@@ -4049,10 +4056,8 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (c == '_') {
if (++us >= 2)
break;
- }
- else {
+ } else
us = 0;
- }
}
if (!(c = *str) || ISSPACE(c)) --str;
}
@@ -4084,7 +4089,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
}
else {
VALUE big = rb_uint2big(val);
- BIGNUM_SET_SIGN(big, sign);
+ RBIGNUM_SET_SIGN(big, sign);
return bignorm(big);
}
}
@@ -4315,7 +4320,7 @@ rb_ull2big(unsigned LONG_LONG n)
VALUE big = bignew(bdigit_roomof(SIZEOF_LONG_LONG), 1);
BDIGIT *digits = BDIGITS(big);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG_LONG
digits[0] = n;
#else
for (i = 0; i < bdigit_roomof(SIZEOF_LONG_LONG); i++) {
@@ -4326,7 +4331,7 @@ rb_ull2big(unsigned LONG_LONG n)
i = bdigit_roomof(SIZEOF_LONG_LONG);
while (i-- && !digits[i]) ;
- BIGNUM_SET_LEN(big, i+1);
+ RBIGNUM_SET_LEN(big, i+1);
return big;
}
@@ -4346,7 +4351,7 @@ rb_ll2big(LONG_LONG n)
}
big = rb_ull2big(u);
if (neg) {
- BIGNUM_SET_SIGN(big, 0);
+ RBIGNUM_SET_SIGN(big, 0);
}
return big;
}
@@ -4394,8 +4399,8 @@ big_shift3(VALUE x, int lshift_p, size_t shift_numdigits, int shift_numbits)
}
s1 = shift_numdigits;
s2 = shift_numbits;
- xn = BIGNUM_LEN(x);
- z = bignew(xn+s1+1, BIGNUM_SIGN(x));
+ xn = RBIGNUM_LEN(x);
+ z = bignew(xn+s1+1, RBIGNUM_SIGN(x));
zds = BDIGITS(z);
BDIGITS_ZERO(zds, s1);
xds = BDIGITS(x);
@@ -4404,9 +4409,9 @@ big_shift3(VALUE x, int lshift_p, size_t shift_numdigits, int shift_numbits)
else {
long zn;
BDIGIT hibitsx;
- if (LONG_MAX < shift_numdigits || (size_t)BIGNUM_LEN(x) <= shift_numdigits) {
- if (BIGNUM_POSITIVE_P(x) ||
- bary_zero_p(BDIGITS(x), BIGNUM_LEN(x)))
+ if (LONG_MAX < shift_numdigits || (size_t)RBIGNUM_LEN(x) <= shift_numdigits) {
+ if (RBIGNUM_POSITIVE_P(x) ||
+ bary_zero_p(BDIGITS(x), RBIGNUM_LEN(x)))
return INT2FIX(0);
else
return INT2FIX(-1);
@@ -4453,7 +4458,7 @@ big_shift2(VALUE x, int lshift_p, VALUE y)
}
else {
if (1 < sign || CHAR_BIT <= lens[1])
- return BIGNUM_POSITIVE_P(x) ? INT2FIX(0) : INT2FIX(-1);
+ return RBIGNUM_POSITIVE_P(x) ? INT2FIX(0) : INT2FIX(-1);
}
shift_numbits = (int)(lens[0] & (BITSPERDIG-1));
shift_numdigits = (lens[0] >> bit_length(BITSPERDIG-1)) |
@@ -4537,6 +4542,61 @@ power_cache_get_power(int base, int power_level, size_t *numdigits_ret)
return base36_power_cache[base - 2][power_level];
}
+/*
+ * deprecated. (used only from deprecated rb_big2str0)
+ *
+ * big2str_muraken_find_n1
+ *
+ * Let a natural number x is given by:
+ * x = 2^0 * x_0 + 2^1 * x_1 + ... + 2^(B*n_0 - 1) * x_{B*n_0 - 1},
+ * where B is BITSPERDIG (i.e. BDIGITS*CHAR_BIT) and n_0 is
+ * RBIGNUM_LEN(x).
+ *
+ * Now, we assume n_1 = min_n \{ n | 2^(B*n_0/2) <= b_1^(n_1) \}, so
+ * it is realized that 2^(B*n_0) <= {b_1}^{2*n_1}, where b_1 is a
+ * given radix number. And then, we have n_1 <= (B*n_0) /
+ * (2*log_2(b_1)), therefore n_1 is given by ceil((B*n_0) /
+ * (2*log_2(b_1))).
+ */
+static long
+big2str_find_n1(VALUE x, int base)
+{
+ static const double log_2[] = {
+ 1.0, 1.58496250072116, 2.0,
+ 2.32192809488736, 2.58496250072116, 2.8073549220576,
+ 3.0, 3.16992500144231, 3.32192809488736,
+ 3.4594316186373, 3.58496250072116, 3.70043971814109,
+ 3.8073549220576, 3.90689059560852, 4.0,
+ 4.08746284125034, 4.16992500144231, 4.24792751344359,
+ 4.32192809488736, 4.39231742277876, 4.4594316186373,
+ 4.52356195605701, 4.58496250072116, 4.64385618977472,
+ 4.70043971814109, 4.75488750216347, 4.8073549220576,
+ 4.85798099512757, 4.90689059560852, 4.95419631038688,
+ 5.0, 5.04439411935845, 5.08746284125034,
+ 5.12928301694497, 5.16992500144231
+ };
+ long bits;
+
+ if (base < 2 || 36 < base)
+ rb_bug("invalid radix %d", base);
+
+ if (FIXNUM_P(x)) {
+ bits = (SIZEOF_LONG*CHAR_BIT - 1)/2 + 1;
+ }
+ else if (BIGZEROP(x)) {
+ return 0;
+ }
+ else if (RBIGNUM_LEN(x) >= LONG_MAX/BITSPERDIG) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
+ else {
+ bits = BITSPERDIG*RBIGNUM_LEN(x);
+ }
+
+ /* @shyouhei note: vvvvvvvvvvvvv this cast is suspicious. But I believe it is OK, because if that cast loses data, this x value is too big, and should have raised RangeError. */
+ return (long)ceil(((double)bits)/log_2[base - 2]);
+}
+
struct big2str_struct {
int negative;
int base;
@@ -4642,7 +4702,7 @@ big2str_karatsuba(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t wn,
lower_power_level = power_level-1;
b = power_cache_get_power(b2s->base, lower_power_level, &lower_numdigits);
- bn = BIGNUM_LEN(b);
+ bn = RBIGNUM_LEN(b);
bds = BDIGITS(b);
half_numdigits = lower_numdigits;
@@ -4652,7 +4712,7 @@ big2str_karatsuba(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t wn,
(xn == bn && bary_cmp(xds, xn, bds, bn) < 0))) {
lower_power_level--;
b = power_cache_get_power(b2s->base, lower_power_level, &lower_numdigits);
- bn = BIGNUM_LEN(b);
+ bn = RBIGNUM_LEN(b);
bds = BDIGITS(b);
}
@@ -4725,12 +4785,12 @@ big2str_base_poweroftwo(VALUE x, int base)
VALUE result;
char *ptr;
numwords = rb_absint_numwords(x, word_numbits, NULL);
- if (BIGNUM_NEGATIVE_P(x)) {
+ if (RBIGNUM_NEGATIVE_P(x)) {
if (LONG_MAX-1 < numwords)
rb_raise(rb_eArgError, "too big number");
result = rb_usascii_str_new(0, 1+numwords);
ptr = RSTRING_PTR(result);
- *ptr++ = BIGNUM_POSITIVE_P(x) ? '+' : '-';
+ *ptr++ = RBIGNUM_POSITIVE_P(x) ? '+' : '-';
}
else {
if (LONG_MAX < numwords)
@@ -4764,7 +4824,7 @@ big2str_generic(VALUE x, int base)
VALUE power;
xds = BDIGITS(x);
- xn = BIGNUM_LEN(x);
+ xn = RBIGNUM_LEN(x);
BARY_TRUNC(xds, xn);
if (xn == 0) {
@@ -4781,13 +4841,13 @@ big2str_generic(VALUE x, int base)
power_level = 0;
power = power_cache_get_power(base, power_level, NULL);
while (power_level < MAX_BASE36_POWER_TABLE_ENTRIES &&
- (size_t)BIGNUM_LEN(power) <= (xn+1)/2) {
+ (size_t)RBIGNUM_LEN(power) <= (xn+1)/2) {
power_level++;
power = power_cache_get_power(base, power_level, NULL);
}
assert(power_level != MAX_BASE36_POWER_TABLE_ENTRIES);
- if ((size_t)BIGNUM_LEN(power) <= xn) {
+ if ((size_t)RBIGNUM_LEN(power) <= xn) {
/*
* This increment guarantees x < power_cache_get_power(base, power_level)
* without invoking it actually.
@@ -4801,7 +4861,7 @@ big2str_generic(VALUE x, int base)
power_level++;
}
- b2s_data.negative = BIGNUM_NEGATIVE_P(x);
+ b2s_data.negative = RBIGNUM_NEGATIVE_P(x);
b2s_data.base = base;
b2s_data.hbase2 = maxpow_in_bdigit_dbl(base, &b2s_data.hbase2_numdigits);
@@ -4815,7 +4875,7 @@ big2str_generic(VALUE x, int base)
VALUE tmpw = 0;
BDIGIT *wds;
size_t wn;
- wn = power_level * BIGDIVREM_EXTRA_WORDS + BIGNUM_LEN(power);
+ wn = power_level * BIGDIVREM_EXTRA_WORDS + RBIGNUM_LEN(power);
wds = ALLOCV_N(BDIGIT, tmpw, xn + wn);
MEMCPY(wds, xds, BDIGIT, xn);
big2str_karatsuba(&b2s_data, wds, xn, wn, power_level, 0);
@@ -4838,22 +4898,22 @@ rb_big2str_generic(VALUE x, int base)
}
#ifdef USE_GMP
-static VALUE
+VALUE
big2str_gmp(VALUE x, int base)
{
- const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGITS)*CHAR_BIT;
mpz_t mx;
size_t size;
VALUE str;
BDIGIT *xds = BDIGITS(x);
- size_t xn = BIGNUM_LEN(x);
+ size_t xn = RBIGNUM_LEN(x);
mpz_init(mx);
mpz_import(mx, xn, -1, sizeof(BDIGIT), 0, nails, xds);
size = mpz_sizeinbase(mx, base);
- if (BIGNUM_NEGATIVE_P(x)) {
+ if (RBIGNUM_NEGATIVE_P(x)) {
mpz_neg(mx, mx);
str = rb_usascii_str_new(0, size+1);
}
@@ -4890,7 +4950,7 @@ rb_big2str1(VALUE x, int base)
bigtrunc(x);
xds = BDIGITS(x);
- xn = BIGNUM_LEN(x);
+ xn = RBIGNUM_LEN(x);
BARY_TRUNC(xds, xn);
if (xn == 0) {
@@ -4918,6 +4978,41 @@ rb_big2str1(VALUE x, int base)
return big2str_generic(x, base);
}
+/* deprecated */
+VALUE
+rb_big2str0(VALUE x, int base, int trim)
+{
+ VALUE str;
+ long oldlen;
+ long n2;
+
+ str = rb_big2str1(x, base);
+
+ if (trim || FIXNUM_P(x) || BIGZEROP(x))
+ return str;
+
+ oldlen = RSTRING_LEN(str);
+ if (oldlen && RSTRING_PTR(str)[0] != '-') {
+ rb_str_resize(str, oldlen+1);
+ MEMMOVE(RSTRING_PTR(str)+1, RSTRING_PTR(str), char, oldlen);
+ RSTRING_PTR(str)[0] = '+';
+ }
+
+ n2 = big2str_find_n1(x, base);
+
+ oldlen = RSTRING_LEN(str);
+ if (oldlen-1 < n2) {
+ long off = n2 - (oldlen-1);
+ rb_str_resize(str, n2+1);
+ MEMMOVE(RSTRING_PTR(str)+1+off, RSTRING_PTR(str)+1, char, oldlen-1);
+ memset(RSTRING_PTR(str)+1, '0', off);
+ }
+
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+
+ return str;
+}
+
VALUE
rb_big2str(VALUE x, int base)
{
@@ -4956,7 +5051,7 @@ rb_big_to_s(int argc, VALUE *argv, VALUE x)
static unsigned long
big2ulong(VALUE x, const char *type)
{
- size_t len = BIGNUM_LEN(x);
+ long len = RBIGNUM_LEN(x);
unsigned long num;
BDIGIT *ds;
@@ -4966,7 +5061,7 @@ big2ulong(VALUE x, const char *type)
rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
}
ds = BDIGITS(x);
-#if SIZEOF_LONG <= SIZEOF_BDIGIT
+#if SIZEOF_LONG <= SIZEOF_BDIGITS
num = (unsigned long)ds[0];
#else
num = 0;
@@ -4978,12 +5073,22 @@ big2ulong(VALUE x, const char *type)
return num;
}
-unsigned long
+/* deprecated */
+VALUE
+rb_big2ulong_pack(VALUE x)
+{
+ unsigned long num;
+ rb_integer_pack(x, &num, 1, sizeof(num), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER|INTEGER_PACK_2COMP);
+ return num;
+}
+
+VALUE
rb_big2ulong(VALUE x)
{
unsigned long num = big2ulong(x, "unsigned long");
- if (BIGNUM_POSITIVE_P(x)) {
+ if (RBIGNUM_POSITIVE_P(x)) {
return num;
}
else {
@@ -4995,12 +5100,12 @@ rb_big2ulong(VALUE x)
rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
}
-long
+SIGNED_VALUE
rb_big2long(VALUE x)
{
unsigned long num = big2ulong(x, "long");
- if (BIGNUM_POSITIVE_P(x)) {
+ if (RBIGNUM_POSITIVE_P(x)) {
if (num <= LONG_MAX)
return num;
}
@@ -5018,7 +5123,7 @@ rb_big2long(VALUE x)
static unsigned LONG_LONG
big2ull(VALUE x, const char *type)
{
- size_t len = BIGNUM_LEN(x);
+ long len = RBIGNUM_LEN(x);
unsigned LONG_LONG num;
BDIGIT *ds = BDIGITS(x);
@@ -5026,7 +5131,7 @@ big2ull(VALUE x, const char *type)
return 0;
if (BIGSIZE(x) > SIZEOF_LONG_LONG)
rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
-#if SIZEOF_LONG_LONG <= SIZEOF_BDIGIT
+#if SIZEOF_LONG_LONG <= SIZEOF_BDIGITS
num = (unsigned LONG_LONG)ds[0];
#else
num = 0;
@@ -5043,7 +5148,7 @@ rb_big2ull(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "unsigned long long");
- if (BIGNUM_POSITIVE_P(x)) {
+ if (RBIGNUM_POSITIVE_P(x)) {
return num;
}
else {
@@ -5060,7 +5165,7 @@ rb_big2ll(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "long long");
- if (BIGNUM_POSITIVE_P(x)) {
+ if (RBIGNUM_POSITIVE_P(x)) {
if (num <= LLONG_MAX)
return num;
}
@@ -5117,7 +5222,7 @@ static double
big2dbl(VALUE x)
{
double d = 0.0;
- long i = (bigtrunc(x), BIGNUM_LEN(x)), lo = 0, bits;
+ long i = (bigtrunc(x), RBIGNUM_LEN(x)), lo = 0, bits;
BDIGIT *ds = BDIGITS(x), dl;
if (i) {
@@ -5159,7 +5264,7 @@ big2dbl(VALUE x)
}
}
}
- if (!BIGNUM_SIGN(x)) d = -d;
+ if (!RBIGNUM_SIGN(x)) d = -d;
return d;
}
@@ -5293,16 +5398,7 @@ rb_big_cmp(VALUE x, VALUE y)
int cmp;
if (FIXNUM_P(y)) {
- x = bignorm(x);
- if (FIXNUM_P(x)) {
- if (FIX2LONG(x) > FIX2LONG(y)) return INT2FIX(1);
- if (FIX2LONG(x) < FIX2LONG(y)) return INT2FIX(-1);
- return INT2FIX(0);
- }
- else {
- if (BIGNUM_NEGATIVE_P(x)) return INT2FIX(-1);
- return INT2FIX(1);
- }
+ y = rb_int2big(FIX2LONG(y));
}
else if (RB_BIGNUM_TYPE_P(y)) {
}
@@ -5313,11 +5409,11 @@ rb_big_cmp(VALUE x, VALUE y)
return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
}
- if (BIGNUM_SIGN(x) > BIGNUM_SIGN(y)) return INT2FIX(1);
- if (BIGNUM_SIGN(x) < BIGNUM_SIGN(y)) return INT2FIX(-1);
+ if (RBIGNUM_SIGN(x) > RBIGNUM_SIGN(y)) return INT2FIX(1);
+ if (RBIGNUM_SIGN(x) < RBIGNUM_SIGN(y)) return INT2FIX(-1);
- cmp = bary_cmp(BDIGITS(x), BIGNUM_LEN(x), BDIGITS(y), BIGNUM_LEN(y));
- if (BIGNUM_SIGN(x))
+ cmp = bary_cmp(BDIGITS(x), RBIGNUM_LEN(x), BDIGITS(y), RBIGNUM_LEN(y));
+ if (RBIGNUM_SIGN(x))
return INT2FIX(cmp);
else
return INT2FIX(-cmp);
@@ -5447,9 +5543,9 @@ rb_big_eq(VALUE x, VALUE y)
else {
return rb_equal(y, x);
}
- if (BIGNUM_SIGN(x) != BIGNUM_SIGN(y)) return Qfalse;
- if (BIGNUM_LEN(x) != BIGNUM_LEN(y)) return Qfalse;
- if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,BIGNUM_LEN(y)) != 0) return Qfalse;
+ if (RBIGNUM_SIGN(x) != RBIGNUM_SIGN(y)) return Qfalse;
+ if (RBIGNUM_LEN(x) != RBIGNUM_LEN(y)) return Qfalse;
+ if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,RBIGNUM_LEN(y)) != 0) return Qfalse;
return Qtrue;
}
@@ -5468,9 +5564,9 @@ VALUE
rb_big_eql(VALUE x, VALUE y)
{
if (!RB_BIGNUM_TYPE_P(y)) return Qfalse;
- if (BIGNUM_SIGN(x) != BIGNUM_SIGN(y)) return Qfalse;
- if (BIGNUM_LEN(x) != BIGNUM_LEN(y)) return Qfalse;
- if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,BIGNUM_LEN(y)) != 0) return Qfalse;
+ if (RBIGNUM_SIGN(x) != RBIGNUM_SIGN(y)) return Qfalse;
+ if (RBIGNUM_LEN(x) != RBIGNUM_LEN(y)) return Qfalse;
+ if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,RBIGNUM_LEN(y)) != 0) return Qfalse;
return Qtrue;
}
@@ -5486,7 +5582,7 @@ rb_big_uminus(VALUE x)
{
VALUE z = rb_big_clone(x);
- BIGNUM_SET_SIGN(z, !BIGNUM_SIGN(x));
+ RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
return bignorm(z);
}
@@ -5508,22 +5604,22 @@ rb_big_neg(VALUE x)
{
VALUE z = rb_big_clone(x);
BDIGIT *ds = BDIGITS(z);
- long n = BIGNUM_LEN(z);
+ long n = RBIGNUM_LEN(z);
if (!n) return INT2FIX(-1);
- if (BIGNUM_POSITIVE_P(z)) {
+ if (RBIGNUM_POSITIVE_P(z)) {
if (bary_add_one(ds, n)) {
big_extend_carry(z);
}
- BIGNUM_SET_NEGATIVE_SIGN(z);
+ RBIGNUM_SET_NEGATIVE_SIGN(z);
}
else {
bary_neg(ds, n);
if (bary_add_one(ds, n))
return INT2FIX(-1);
bary_neg(ds, n);
- BIGNUM_SET_POSITIVE_SIGN(z);
+ RBIGNUM_SET_POSITIVE_SIGN(z);
}
return bignorm(z);
@@ -5536,8 +5632,8 @@ bigsub(VALUE x, VALUE y)
BDIGIT *xds, *yds, *zds;
long xn, yn, zn;
- xn = BIGNUM_LEN(x);
- yn = BIGNUM_LEN(y);
+ xn = RBIGNUM_LEN(x);
+ yn = RBIGNUM_LEN(y);
zn = xn < yn ? yn : xn;
z = bignew(zn, 1);
@@ -5548,7 +5644,7 @@ bigsub(VALUE x, VALUE y)
if (bary_sub(zds, zn, xds, xn, yds, yn)) {
bary_2comp(zds, zn);
- BIGNUM_SET_NEGATIVE_SIGN(z);
+ RBIGNUM_SET_NEGATIVE_SIGN(z);
}
return z;
@@ -5567,24 +5663,24 @@ bigsub_int(VALUE x, long y0)
y = y0;
xds = BDIGITS(x);
- xn = BIGNUM_LEN(x);
+ xn = RBIGNUM_LEN(x);
if (xn == 0)
return LONG2NUM(-y0);
zn = xn;
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+#if SIZEOF_BDIGITS < SIZEOF_LONG
if (zn < bdigit_roomof(SIZEOF_LONG))
zn = bdigit_roomof(SIZEOF_LONG);
#endif
- z = bignew(zn, BIGNUM_SIGN(x));
+ z = bignew(zn, RBIGNUM_SIGN(x));
zds = BDIGITS(z);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
assert(xn == zn);
num = (BDIGIT_DBL_SIGNED)xds[0] - y;
if (xn == 1 && num < 0) {
- BIGNUM_SET_SIGN(z, !BIGNUM_SIGN(x));
+ RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
zds[0] = (BDIGIT)-num;
RB_GC_GUARD(x);
return bignorm(z);
@@ -5621,7 +5717,7 @@ bigsub_int(VALUE x, long y0)
zds[i] = BIGLO(num);
num = BIGDN(num);
}
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+#if SIZEOF_BDIGITS < SIZEOF_LONG
for (; i < zn; i++) {
y_is_zero_z:
if (num == 0) goto num_is_zero_z;
@@ -5635,7 +5731,7 @@ bigsub_int(VALUE x, long y0)
num_is_zero_x:
zds[i] = xds[i];
}
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+#if SIZEOF_BDIGITS < SIZEOF_LONG
for (; i < zn; i++) {
num_is_zero_z:
zds[i] = 0;
@@ -5647,7 +5743,7 @@ bigsub_int(VALUE x, long y0)
assert(num == 0 || num == -1);
if (num < 0) {
get2comp(z);
- BIGNUM_SET_SIGN(z, !BIGNUM_SIGN(x));
+ RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
}
RB_GC_GUARD(x);
return bignorm(z);
@@ -5663,22 +5759,22 @@ bigadd_int(VALUE x, long y)
long i;
xds = BDIGITS(x);
- xn = BIGNUM_LEN(x);
+ xn = RBIGNUM_LEN(x);
if (xn == 0)
return LONG2NUM(y);
zn = xn;
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+#if SIZEOF_BDIGITS < SIZEOF_LONG
if (zn < bdigit_roomof(SIZEOF_LONG))
zn = bdigit_roomof(SIZEOF_LONG);
#endif
zn++;
- z = bignew(zn, BIGNUM_SIGN(x));
+ z = bignew(zn, RBIGNUM_SIGN(x));
zds = BDIGITS(z);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
num = (BDIGIT_DBL)xds[0] + y;
zds[0] = BIGLO(num);
num = BIGDN(num);
@@ -5740,25 +5836,25 @@ static VALUE
bigadd(VALUE x, VALUE y, int sign)
{
VALUE z;
- size_t len;
+ long len;
- sign = (sign == BIGNUM_SIGN(y));
- if (BIGNUM_SIGN(x) != sign) {
+ sign = (sign == RBIGNUM_SIGN(y));
+ if (RBIGNUM_SIGN(x) != sign) {
if (sign) return bigsub(y, x);
return bigsub(x, y);
}
- if (BIGNUM_LEN(x) > BIGNUM_LEN(y)) {
- len = BIGNUM_LEN(x) + 1;
+ if (RBIGNUM_LEN(x) > RBIGNUM_LEN(y)) {
+ len = RBIGNUM_LEN(x) + 1;
}
else {
- len = BIGNUM_LEN(y) + 1;
+ len = RBIGNUM_LEN(y) + 1;
}
z = bignew(len, sign);
- bary_add(BDIGITS(z), BIGNUM_LEN(z),
- BDIGITS(x), BIGNUM_LEN(x),
- BDIGITS(y), BIGNUM_LEN(y));
+ bary_add(BDIGITS(z), RBIGNUM_LEN(z),
+ BDIGITS(x), RBIGNUM_LEN(x),
+ BDIGITS(y), RBIGNUM_LEN(y));
return z;
}
@@ -5777,7 +5873,7 @@ rb_big_plus(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
n = FIX2LONG(y);
- if ((n > 0) != BIGNUM_SIGN(x)) {
+ if ((n > 0) != RBIGNUM_SIGN(x)) {
if (n < 0) {
n = -n;
}
@@ -5813,7 +5909,7 @@ rb_big_minus(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
n = FIX2LONG(y);
- if ((n > 0) != BIGNUM_SIGN(x)) {
+ if ((n > 0) != RBIGNUM_SIGN(x)) {
if (n < 0) {
n = -n;
}
@@ -5842,7 +5938,7 @@ bigsq(VALUE x)
VALUE z;
BDIGIT *xds, *zds;
- xn = BIGNUM_LEN(x);
+ xn = RBIGNUM_LEN(x);
zn = 2 * xn;
z = bignew(zn, 1);
@@ -5876,11 +5972,11 @@ bigmul0(VALUE x, VALUE y)
if (x == y)
return bigsq(x);
- xn = BIGNUM_LEN(x);
- yn = BIGNUM_LEN(y);
+ xn = RBIGNUM_LEN(x);
+ yn = RBIGNUM_LEN(y);
zn = xn + yn;
- z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
xds = BDIGITS(x);
yds = BDIGITS(y);
@@ -5921,7 +6017,7 @@ rb_big_mul(VALUE x, VALUE y)
static VALUE
bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
{
- long xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y);
+ long xn = RBIGNUM_LEN(x), yn = RBIGNUM_LEN(y);
VALUE z;
BDIGIT *xds, *yds, *zds;
BDIGIT dd;
@@ -5945,12 +6041,12 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
}
if (yn == 1) {
dd = yds[0];
- z = bignew(xn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ z = bignew(xn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
zds = BDIGITS(z);
dd = bigdivrem_single(zds, xds, xn, dd);
if (modp) {
*modp = rb_uint2big((VALUE)dd);
- BIGNUM_SET_SIGN(*modp, BIGNUM_SIGN(x));
+ RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x));
}
if (divp) *divp = z;
return Qnil;
@@ -5961,14 +6057,14 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
BDIGIT_DBL q0 = x0 / y0;
BDIGIT_DBL r0 = x0 % y0;
if (divp) {
- z = bignew(bdigit_roomof(sizeof(BDIGIT_DBL)), BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ z = bignew(bdigit_roomof(sizeof(BDIGIT_DBL)), RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
zds = BDIGITS(z);
zds[0] = BIGLO(q0);
zds[1] = BIGLO(BIGDN(q0));
*divp = z;
}
if (modp) {
- z = bignew(bdigit_roomof(sizeof(BDIGIT_DBL)), BIGNUM_SIGN(x));
+ z = bignew(bdigit_roomof(sizeof(BDIGIT_DBL)), RBIGNUM_SIGN(x));
zds = BDIGITS(z);
zds[0] = BIGLO(r0);
zds[1] = BIGLO(BIGDN(r0));
@@ -5979,7 +6075,7 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
if (divp) {
qn = xn + BIGDIVREM_EXTRA_WORDS;
- q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ q = bignew(qn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
qds = BDIGITS(q);
}
else {
@@ -5989,7 +6085,7 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
if (modp) {
rn = yn;
- r = bignew(rn, BIGNUM_SIGN(x));
+ r = bignew(rn, RBIGNUM_SIGN(x));
rds = BDIGITS(r);
}
else {
@@ -6017,7 +6113,7 @@ bigdivmod(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
VALUE mod;
bigdivrem(x, y, divp, &mod);
- if (BIGNUM_SIGN(x) != BIGNUM_SIGN(y) && !BIGZEROP(mod)) {
+ if (RBIGNUM_SIGN(x) != RBIGNUM_SIGN(y) && !BIGZEROP(mod)) {
if (divp) *divp = bigadd(*divp, rb_int2big(1), 0);
if (modp) *modp = bigadd(mod, y, 1);
}
@@ -6174,7 +6270,7 @@ big_fdiv(VALUE x, VALUE y, long ey)
long l, ex;
bigtrunc(x);
- l = BIGNUM_LEN(x);
+ l = RBIGNUM_LEN(x);
ex = l * BITSPERDIG - nlz(BDIGITS(x)[l-1]);
ex -= 2 * DBL_BIGDIG * BITSPERDIG;
if (ex) x = big_shift(x, ex);
@@ -6196,7 +6292,7 @@ big_fdiv_int(VALUE x, VALUE y)
{
long l, ey;
bigtrunc(y);
- l = BIGNUM_LEN(y);
+ l = RBIGNUM_LEN(y);
ey = l * BITSPERDIG - nlz(BDIGITS(y)[l-1]);
ey -= DBL_BIGDIG * BITSPERDIG;
if (ey) y = big_shift(y, ey);
@@ -6263,7 +6359,7 @@ rb_big_fdiv(VALUE x, VALUE y)
*
* 123456789 ** 2 #=> 15241578750190521
* 123456789 ** 1.2 #=> 5126464716.09932
- * 123456789 ** -2 #=> (1/15241578750190521)
+ * 123456789 ** -2 #=> 6.5610001194102e-17
*/
VALUE
@@ -6276,7 +6372,7 @@ rb_big_pow(VALUE x, VALUE y)
if (y == INT2FIX(0)) return INT2FIX(1);
if (RB_FLOAT_TYPE_P(y)) {
d = RFLOAT_VALUE(y);
- if ((!BIGNUM_SIGN(x) && !BIGZEROP(x)) && d != round(d))
+ if ((!RBIGNUM_SIGN(x) && !BIGZEROP(x)) && d != round(d))
return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
}
else if (RB_BIGNUM_TYPE_P(y)) {
@@ -6333,7 +6429,7 @@ bigand_int(VALUE x, long xn, BDIGIT hibitsx, long y)
if (xn == 0) return hibitsx ? LONG2NUM(y) : 0;
hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
if (!hibitsy) {
y &= xds[0];
return LONG2NUM(y);
@@ -6341,7 +6437,7 @@ bigand_int(VALUE x, long xn, BDIGIT hibitsx, long y)
#endif
zn = xn;
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+#if SIZEOF_BDIGITS < SIZEOF_LONG
if (hibitsx && zn < bdigit_roomof(SIZEOF_LONG))
zn = bdigit_roomof(SIZEOF_LONG);
#endif
@@ -6349,9 +6445,9 @@ bigand_int(VALUE x, long xn, BDIGIT hibitsx, long y)
z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
i = 1;
- zds[0] = xds[0] & BIGLO(y);
+ zds[0] = xds[0] & y;
#else
for (i=0; i < xn; i++) {
if (y == 0 || y == -1) break;
@@ -6447,17 +6543,17 @@ bigor_int(VALUE x, long xn, BDIGIT hibitsx, long y)
hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
- zn = BIGNUM_LEN(x);
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+ zn = RBIGNUM_LEN(x);
+#if SIZEOF_BDIGITS < SIZEOF_LONG
if (zn < bdigit_roomof(SIZEOF_LONG))
zn = bdigit_roomof(SIZEOF_LONG);
#endif
z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
i = 1;
- zds[0] = xds[0] | BIGLO(y);
+ zds[0] = xds[0] | y;
if (i < zn)
goto y_is_fixed_point;
goto finish;
@@ -6570,17 +6666,17 @@ bigxor_int(VALUE x, long xn, BDIGIT hibitsx, long y)
hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
- zn = BIGNUM_LEN(x);
-#if SIZEOF_BDIGIT < SIZEOF_LONG
+ zn = RBIGNUM_LEN(x);
+#if SIZEOF_BDIGITS < SIZEOF_LONG
if (zn < bdigit_roomof(SIZEOF_LONG))
zn = bdigit_roomof(SIZEOF_LONG);
#endif
z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGIT >= SIZEOF_LONG
+#if SIZEOF_BDIGITS >= SIZEOF_LONG
i = 1;
- zds[0] = xds[0] ^ BIGLO(y);
+ zds[0] = xds[0] ^ y;
#else
for (i = 0; i < xn; i++) {
zds[i] = xds[i] ^ BIGLO(y);
@@ -6754,38 +6850,33 @@ static VALUE
rb_big_aref(VALUE x, VALUE y)
{
BDIGIT *xds;
- size_t shift;
- size_t i, s1, s2;
- long l;
+ unsigned long shift;
+ long i, s1, s2;
BDIGIT bit;
if (RB_BIGNUM_TYPE_P(y)) {
- if (!BIGNUM_SIGN(y))
+ if (!RBIGNUM_SIGN(y))
return INT2FIX(0);
bigtrunc(y);
- if (BIGSIZE(y) > sizeof(size_t)) {
+ if (BIGSIZE(y) > sizeof(long)) {
out_of_range:
- return BIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
+ return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
}
-#if SIZEOF_SIZE_T <= SIZEOF_LONG
shift = big2ulong(y, "long");
-#else
- shift = big2ull(y, "long long");
-#endif
}
else {
- l = NUM2LONG(y);
- if (l < 0) return INT2FIX(0);
- shift = (size_t)l;
+ i = NUM2LONG(y);
+ if (i < 0) return INT2FIX(0);
+ shift = i;
}
s1 = shift/BITSPERDIG;
s2 = shift%BITSPERDIG;
bit = (BDIGIT)1 << s2;
- if (s1 >= BIGNUM_LEN(x)) goto out_of_range;
+ if (s1 >= RBIGNUM_LEN(x)) goto out_of_range;
xds = BDIGITS(x);
- if (BIGNUM_POSITIVE_P(x))
+ if (RBIGNUM_POSITIVE_P(x))
return (xds[s1] & bit) ? INT2FIX(1) : INT2FIX(0);
if (xds[s1] & (bit-1))
return (xds[s1] & bit) ? INT2FIX(0) : INT2FIX(1);
@@ -6800,16 +6891,14 @@ rb_big_aref(VALUE x, VALUE y)
* big.hash -> fixnum
*
* Compute a hash based on the value of _big_.
- *
- * See also Object#hash.
*/
-VALUE
+static VALUE
rb_big_hash(VALUE x)
{
st_index_t hash;
- hash = rb_memhash(BDIGITS(x), sizeof(BDIGIT)*BIGNUM_LEN(x)) ^ BIGNUM_SIGN(x);
+ hash = rb_memhash(BDIGITS(x), sizeof(BDIGIT)*RBIGNUM_LEN(x)) ^ RBIGNUM_SIGN(x);
return INT2FIX(hash);
}
@@ -6834,8 +6923,8 @@ rb_big_coerce(VALUE x, VALUE y)
y = rb_int2big(FIX2LONG(y));
}
else if (!RB_BIGNUM_TYPE_P(y)) {
- rb_raise(rb_eTypeError, "can't coerce %"PRIsVALUE" to Bignum",
- rb_obj_class(y));
+ rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
+ rb_obj_classname(y));
}
return rb_assoc_new(y, x);
}
@@ -6853,9 +6942,9 @@ rb_big_coerce(VALUE x, VALUE y)
static VALUE
rb_big_abs(VALUE x)
{
- if (!BIGNUM_SIGN(x)) {
+ if (!RBIGNUM_SIGN(x)) {
x = rb_big_clone(x);
- BIGNUM_SET_SIGN(x, 1);
+ RBIGNUM_SET_SIGN(x, 1);
}
return x;
}
@@ -6907,13 +6996,6 @@ rb_big_size(VALUE big)
* (2**10000).bit_length #=> 10001
* (2**10000+1).bit_length #=> 10001
*
- * This method can be used to detect overflow in Array#pack as follows.
- *
- * if n.bit_length < 32
- * [n].pack("l") # no overflow
- * else
- * raise "overflow"
- * end
*/
static VALUE
@@ -6932,7 +7014,7 @@ rb_big_bit_length(VALUE big)
if (numbytes == 0)
return LONG2FIX(0);
- if (BIGNUM_NEGATIVE_P(big) && rb_absint_singlebit_p(big)) {
+ if (RBIGNUM_NEGATIVE_P(big) && rb_absint_singlebit_p(big)) {
if (nlz_bits != CHAR_BIT-1) {
nlz_bits++;
}
@@ -6967,7 +7049,7 @@ rb_big_bit_length(VALUE big)
static VALUE
rb_big_odd_p(VALUE num)
{
- if (BIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
+ if (RBIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
return Qtrue;
}
return Qfalse;
@@ -6983,7 +7065,7 @@ rb_big_odd_p(VALUE num)
static VALUE
rb_big_even_p(VALUE num)
{
- if (BIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
+ if (RBIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
return Qfalse;
}
return Qtrue;
@@ -7053,7 +7135,6 @@ Init_Bignum(void)
rb_define_method(rb_cBignum, "even?", rb_big_even_p, 0);
#ifdef USE_GMP
- /* The version of loaded GMP. */
rb_define_const(rb_cBignum, "GMP_VERSION", rb_sprintf("GMP %s", gmp_version));
#endif
diff --git a/bin/erb b/bin/erb
index 6a88c3b26a..6a7ea7d593 100755
--- a/bin/erb
+++ b/bin/erb
@@ -11,8 +11,7 @@ class ERB
return nil if self.empty?
arg = self.shift
return nil if arg == '--'
- case arg
- when /\A-(.)(.*)/
+ if arg =~ /^-(.)(.*)/
if $1 == '-'
arg, @maybe_arg = arg.split(/=/, 2)
return arg
@@ -25,8 +24,6 @@ class ERB
@maybe_arg = nil
end
"-#{$1}"
- when /\A(\w+)=/
- arg
else
self.unshift arg
nil
@@ -57,7 +54,6 @@ class ERB
def run(factory=ERB)
trim_mode = 0
disable_percent = false
- variables = {}
begin
while switch = ARGV.switch
case switch
@@ -76,7 +72,7 @@ class ERB
require ARGV.req_arg
when '-S' # security level
arg = ARGV.req_arg
- raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-1]\z/
+ raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-3]$/
safe_level = arg.to_i
when '-T' # trim mode
arg = ARGV.req_arg
@@ -84,7 +80,7 @@ class ERB
trim_mode = arg
next
end
- raise "invalid trim mode #{arg.dump}" unless arg =~ /\A[0-2]\z/
+ raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
trim_mode = arg.to_i
when '-E', '--encoding'
arg = ARGV.req_arg
@@ -95,29 +91,25 @@ class ERB
disable_percent = true
when '--help'
raise "print this help"
- when /\A-/
- raise "unknown switch #{switch.dump}"
else
- var, val = *switch.split('=', 2)
- (variables ||= {})[var] = val
+ raise "unknown switch #{switch.dump}"
end
end
rescue # usage
STDERR.puts $!.to_s
STDERR.puts File.basename($0) +
- " [switches] [var=value...] [inputfile]"
+ " [switches] [inputfile]"
STDERR.puts <<EOU
-x print ruby script
-n print ruby script with line number
-v enable verbose mode
-d set $DEBUG to true
-r library load a library
- -S safe_level set $SAFE (0..1)
+ -S safe_level set $SAFE (0..3)
-E ex[:in] set default external/internal encodings
-U set default encoding to UTF-8.
-T trim_mode specify trim_mode (0..2, -)
-P ignore lines which start with "%"
- var=value set variable
EOU
exit 1
end
@@ -138,23 +130,15 @@ EOU
puts erb.src
end
else
- bind = TOPLEVEL_BINDING.taint
- if variables
- enc = erb.encoding
- for var, val in variables do
- val = val.encode(enc) if val
- bind.local_variable_set(var, val)
- end
- end
- erb.run(bind)
+ erb.run(TOPLEVEL_BINDING.taint)
end
end
module_function :run
def set_encoding(extern, intern = nil)
verbose, $VERBOSE = $VERBOSE, nil
- Encoding.default_external = extern unless extern.nil? || extern == ""
- Encoding.default_internal = intern unless intern.nil? || intern == ""
+ Encoding.default_external = extern unless extern.nil? || extern.empty?
+ Encoding.default_internal = intern unless intern.nil? || intern.empty?
[$stdin, $stdout, $stderr].each do |io|
io.set_encoding(extern, intern)
end
diff --git a/bin/rake b/bin/rake
new file mode 100755
index 0000000000..4e0bbb7b7a
--- /dev/null
+++ b/bin/rake
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+
+#--
+# Copyright (c) 2003, 2004, 2005, 2006, 2007 Jim Weirich
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#++
+
+begin
+ require 'rubygems'
+ gem 'rake'
+rescue LoadError
+end
+
+require 'rake'
+
+Rake.application.run
diff --git a/bin/testrb b/bin/testrb
new file mode 100755
index 0000000000..23a00b439f
--- /dev/null
+++ b/bin/testrb
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+require 'test/unit'
+exit Test::Unit::AutoRunner.run(true)
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 5eb468a338..5fdfc42a63 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -136,18 +136,13 @@ End
@tty &&= !@verbose
if @color
# dircolors-like style
- colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
- begin
- File.read(File.join(__dir__, "../test/colors")).scan(/(\w+)=([^:\n]*)/) do |n, c|
- colors[n] ||= c
- end
- rescue
- end
- @passed = "\e[;#{colors["pass"] || "32"}m"
- @failed = "\e[;#{colors["fail"] || "31"}m"
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
+ @passed = "\e[#{colors["pass"] || "32"}m"
+ @failed = "\e[#{colors["fail"] || "31"}m"
@reset = "\e[m"
+ @erase = "\r\e[2K\r"
else
- @passed = @failed = @reset = ""
+ @passed = @failed = @reset = @erase = ""
end
unless quiet
puts Time.now
@@ -168,44 +163,28 @@ End
}
end
-def erase(e = true)
- if e and @columns > 0 and !@verbose
- "\r#{" "*@columns}\r"
- else
- ""
- end
-end
-
def exec_test(pathes)
@count = 0
@error = 0
@errbuf = []
@location = nil
- @columns = 0
- @width = pathes.map {|path| File.basename(path).size}.max + 2
pathes.each do |path|
@basename = File.basename(path)
- $stderr.printf("%s%-*s ", erase(@quiet), @width, @basename)
- $stderr.flush
- @columns = @width + 1
+ $stderr.print @basename, " "
$stderr.puts if @verbose
count = @count
error = @error
load File.expand_path(path)
if @tty
if @error == error
- msg = "PASS #{@count-count}"
- @columns += msg.size - 1
- $stderr.print "#{@progress_bs}#{@passed}#{msg}#{@reset}"
+ $stderr.print "#{@progress_bs}#{@passed}PASS #{@count-count}#{@reset}"
+ $stderr.print @erase if @quiet
else
- msg = "FAIL #{@error-error}/#{@count-count}"
- $stderr.print "#{@progress_bs}#{@failed}#{msg}#{@reset}"
- @columns = 0
+ $stderr.print "#{@progress_bs}#{@failed}FAIL #{@error-error}/#{@count-count}#{@reset}"
end
end
- $stderr.puts unless @quiet and @tty and @error == error
+ $stderr.puts unless @quiet and @tty
end
- $stderr.print(erase) if @quiet
if @error == 0
if @count == 0
$stderr.puts "No tests, no problem"
@@ -228,28 +207,23 @@ def show_progress(message = '')
elsif @tty
$stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
end
- t = Time.now if @verbose
faildesc, errout = with_stderr {yield}
- t = Time.now - t if @verbose
if !faildesc
if @tty
$stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
- elsif @verbose
- $stderr.printf(". %.3f\n", t)
else
$stderr.print '.'
end
+ $stderr.puts if @verbose
else
- $stderr.print "#{@failed}F"
- $stderr.printf(" %.3f", t) if @verbose
- $stderr.print "#{@reset}"
+ $stderr.print "#{@failed}F#{@reset}"
$stderr.puts if @verbose
error faildesc, message
unless errout.empty?
$stderr.print "#{@failed}stderr output is not empty#{@reset}\n", adjust_indent(errout)
end
if @tty and !@verbose
- $stderr.printf("%-*s%s", @width, @basename, @progress[@count % @progress.size])
+ $stderr.print @basename, " ", @progress[@count % @progress.size]
end
end
rescue Interrupt
@@ -347,7 +321,7 @@ def assert_normal_exit(testsrc, *rest)
$stderr.reopen(old_stderr)
old_stderr.close
end
- if status&.signaled?
+ if status && status.signaled?
signo = status.termsig
signame = Signal.list.invert[signo]
unless ignore_signals and ignore_signals.include?(signame)
@@ -411,7 +385,7 @@ end
INDENT = 27
def adjust_indent(src)
- untabify(src).gsub(/^ {#{INDENT}}/o, '').gsub(/^/, ' ').sub(/\s*\z/, "\n")
+ untabify(src).gsub(/^ {#{INDENT}}/o, '').gsub(/^/, ' ')
end
def untabify(str)
@@ -471,7 +445,7 @@ end
def error(msg, additional_message)
msg = "#{@failed}\##{@count} #{@location}#{@reset}: #{msg} #{additional_message}"
if @tty
- $stderr.puts "#{erase}#{msg}"
+ $stderr.puts "#{@erase}#{msg}"
else
@errbuf.push msg
end
diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb
index cdc5960a59..6a2ccfc6da 100644
--- a/bootstraptest/test_block.rb
+++ b/bootstraptest/test_block.rb
@@ -597,17 +597,3 @@ assert_equal 'true', %q{
C1.new.foo{}
}
-assert_equal 'ok', %q{
- 1.times do
- begin
- raise
- rescue
- begin
- raise
- rescue
- break
- end
- end
- end
- 'ok'
-}
diff --git a/bootstraptest/test_fork.rb b/bootstraptest/test_fork.rb
index 1cd9f7ac6c..384294727f 100644
--- a/bootstraptest/test_fork.rb
+++ b/bootstraptest/test_fork.rb
@@ -22,32 +22,26 @@ assert_finish 10, %q{
}, '[ruby-core:22158]'
assert_normal_exit(<<'End', '[ruby-dev:37934]')
- main = Thread.current
- Thread.new { sleep 0.01 until main.stop?; Thread.kill main }
- Process.setrlimit(:NPROC, 1) if defined?(Process::RLIMIT_NPROC)
+ Thread.new { sleep 1; Thread.kill Thread.main }
+ Process.setrlimit(:NPROC, 1)
fork {}
End
assert_equal 'ok', %q{
begin
- r, w = IO.pipe
if pid1 = fork
- w.close
- r.read(1)
+ sleep 1
Process.kill("USR1", pid1)
_, s = Process.wait2(pid1)
s.success? ? :ok : :ng
else
- r.close
if pid2 = fork
- trap("USR1") { Time.now.to_s; Process.kill("USR2", pid2) }
- w.close
+ trap("USR1") { Time.now.to_s }
Process.wait2(pid2)
else
- w.close
- sleep 0.2
+ sleep 2
end
- exit true
+ exit 0
end
rescue NotImplementedError
:ok
@@ -56,17 +50,17 @@ assert_equal 'ok', %q{
assert_equal '[1, 2]', %q{
a = []
- main = Thread.current
- trap(:INT) { a.push(1).size == 2 and main.wakeup }
- trap(:TERM) { a.push(2).size == 2 and main.wakeup }
+ trap(:INT) { a.push(1) }
+ trap(:TERM) { a.push(2) }
pid = $$
begin
- pid = fork do
+ fork do
+ sleep 0.5
Process.kill(:INT, pid)
Process.kill(:TERM, pid)
end
- Process.wait(pid)
- 100.times {break if a.size > 1; sleep 0.001}
+
+ sleep 1
a.sort
rescue NotImplementedError
[1, 2]
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index 1d2b19368a..f7360f34b3 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -2,8 +2,9 @@ assert_finish 5, %q{
r, w = IO.pipe
t1 = Thread.new { r.sysread(1) }
t2 = Thread.new { r.sysread(1) }
- sleep 0.01 until t1.stop? and t2.stop?
+ sleep 0.1
w.write "a"
+ sleep 0.1
w.write "a"
}, '[ruby-dev:31866]'
@@ -26,16 +27,16 @@ assert_finish 10, %q{
t1.join
t2.join
end
- rescue LoadError, Timeout::Error, NotImplementedError
+ rescue LoadError, TimeoutError, NotImplementedError
end
}, '[ruby-dev:32566]'
assert_finish 1, %q{
r, w = IO.pipe
Thread.new {
- w << "ab"
- sleep 0.01
- w << "ab"
+ w << "ab"
+ sleep 0.1
+ w << "ab"
}
r.gets("abab")
}
@@ -90,8 +91,7 @@ assert_normal_exit %q{
megacontent = "abc" * 12345678
#File.open("megasrc", "w") {|f| f << megacontent }
- t0 = Thread.main
- Thread.new { sleep 0.001 until t0.stop?; Process.kill(:INT, $$) }
+ Thread.new { sleep rand*0.2; Process.kill(:INT, $$) }
r1, w1 = IO.pipe
r2, w2 = IO.pipe
diff --git a/bootstraptest/test_literal.rb b/bootstraptest/test_literal.rb
index aa65bddae1..b95a2f2d0a 100644
--- a/bootstraptest/test_literal.rb
+++ b/bootstraptest/test_literal.rb
@@ -84,7 +84,7 @@ assert_equal '0', 're = /test/; re =~ "test"'
assert_equal '0', 'str = "test"; /test/ =~ str'
assert_equal '0', 're = /test/; str = "test"; re =~ str'
-# dynamic regexp
+# dynacmi regexp
assert_equal 'regexp', %q(/re#{'ge'}xp/.source)
assert_equal 'Regexp', %q(/re#{'ge'}xp/.class)
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index 3462aa9434..4282bc6273 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -3,7 +3,7 @@ assert_equal '1', 'def m() 1 end; m()'
assert_equal '1', 'def m(a) a end; m(1)'
assert_equal '[1, 2]', 'def m(a,b) [a, b] end; m(1,2)'
assert_equal '[1, 2, 3]', 'def m(a,b,c) [a, b, c] end; m(1,2,3)'
-assert_match /\Awrong number of arguments \(.*\b1\b.* 0\)\z/, %q{
+assert_equal 'wrong number of arguments (1 for 0)', %q{
def m; end
begin
m(1)
@@ -12,7 +12,7 @@ assert_match /\Awrong number of arguments \(.*\b1\b.* 0\)\z/, %q{
end
}
-assert_match /\Awrong number of arguments \(.*\b0\b.* 1\)\z/, %q{
+assert_equal 'wrong number of arguments (0 for 1)', %q{
def m a; end
begin
m
@@ -910,6 +910,34 @@ assert_equal 'ok', %q{
}, '[ruby-core:11998]'
assert_equal 'ok', %q{
+ proc{
+ $SAFE = 2
+ class C
+ def m
+ :ok
+ end
+ end
+ }.call
+ C.new.m
+}, '[ruby-core:11998]'
+
+assert_equal 'ok', %q{
+ proc{
+ $SAFE = 3
+ class C
+ def m
+ :ng
+ end
+ end
+ }.call
+ begin
+ C.new.m
+ rescue SecurityError
+ :ok
+ end
+}, '[ruby-core:11998]'
+
+assert_equal 'ok', %q{
class B
def m() :fail end
end
@@ -929,8 +957,8 @@ assert_equal 'ok', %q{
assert_normal_exit %q{
begin
- Process.setrlimit(Process::RLIMIT_STACK, 4_206_592)
- # FreeBSD SEGVs this less than 4M + 12K bytes.
+ Process.setrlimit(Process::RLIMIT_STACK, 4_202_496)
+ # FreeBSD fails this less than 4M + 8K bytes.
rescue Exception
exit
end
diff --git a/bootstraptest/test_string.rb b/bootstraptest/test_string.rb
deleted file mode 100644
index 849dcd45b0..0000000000
--- a/bootstraptest/test_string.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-assert_normal_exit %q{
- inspect.clear
-}, '[ruby-core:68110]'
diff --git a/bootstraptest/test_syntax.rb b/bootstraptest/test_syntax.rb
index a111990a1f..80eaa6416d 100644
--- a/bootstraptest/test_syntax.rb
+++ b/bootstraptest/test_syntax.rb
@@ -376,8 +376,6 @@ assert_equal %q{1}, %q{1 or 2 or 3 or 4}
assert_equal %q{1}, %q{1 or false or 3 or 4}
assert_equal %q{2}, %q{nil or 2 or 3 or 4}
assert_equal %q{2}, %q{false or 2 or 3 or 4}
-assert_equal %q{1}, %q{if true && ""; then 1; end}
-assert_equal %q{1}, %q{if nil || true; then 1; end}
assert_equal %q{false}, %q{nil or false or nil or false}
assert_equal %q{elseng}, %q{
case
diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb
index d64f44be49..c2b2b8ce9b 100644
--- a/bootstraptest/test_thread.rb
+++ b/bootstraptest/test_thread.rb
@@ -22,7 +22,7 @@ begin
}
v == 20100 ? :ok : v
rescue ThreadError => e
- :ok if /can't create Thread/ =~ e.message
+ :ok if e.message =~ "can't create Thread"
end
}
assert_equal %q{5000}, %q{
@@ -85,7 +85,7 @@ assert_equal %q{ok}, %q{
ans = :ok
end
}
- Thread.pass until t.stop?
+ Thread.pass
t.kill
t.join
ans
@@ -241,16 +241,16 @@ assert_equal 'ok', %{
}
assert_finish 3, %{
- th = Thread.new {sleep 0.2}
- th.join(0.1)
+ th = Thread.new {sleep 2}
+ th.join(1)
th.join
}
assert_finish 3, %{
require 'timeout'
- th = Thread.new {sleep 0.2}
+ th = Thread.new {sleep 2}
begin
- Timeout.timeout(0.1) {th.join}
+ Timeout.timeout(1) {th.join}
rescue Timeout::Error
end
th.join
@@ -276,7 +276,7 @@ assert_normal_exit %q{
assert_equal 'ok', %q{
def m
t = Thread.new { while true; // =~ "" end }
- sleep 0.01
+ sleep 0.1
10.times {
if /((ab)*(ab)*)*(b)/ =~ "ab"*7
return :ng if !$4
@@ -340,9 +340,8 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
begin
m1, m2 = Mutex.new, Mutex.new
- f1 = f2 = false
- Thread.new { m1.lock; f2 = true; sleep 0.001 until f1; m2.lock }
- m2.lock; f1 = true; sleep 0.001 until f2; m1.lock
+ Thread.new { m1.lock; sleep 1; m2.lock }
+ m2.lock; sleep 1; m1.lock
:ng
rescue Exception
:ok
@@ -351,7 +350,7 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
m = Mutex.new
- Thread.new { m.lock }; sleep 0.1; m.lock
+ Thread.new { m.lock }; sleep 1; m.lock
:ok
}
@@ -369,15 +368,15 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
m = Mutex.new
- Thread.new { m.lock; sleep 0.2 }
- sleep 0.1; m.lock
+ Thread.new { m.lock; sleep 2 }
+ sleep 1; m.lock
:ok
}
assert_equal 'ok', %q{
m = Mutex.new
- Thread.new { m.lock; sleep 0.2; m.unlock }
- sleep 0.1; m.lock
+ Thread.new { m.lock; sleep 2; m.unlock }
+ sleep 1; m.lock
:ok
}
@@ -399,20 +398,19 @@ assert_equal 'ok', %q{
assert_equal 'ok', %{
open("zzz.rb", "w") do |f|
- f.puts <<-'end;' # do
+ f.puts <<-END
begin
m = Mutex.new
+ Thread.new { m.lock; sleep 1 }
+ sleep 0.3
parent = Thread.current
- th1 = Thread.new { m.lock; sleep }
- sleep 0.01 until th1.stop?
Thread.new do
- sleep 0.01 until parent.stop?
+ sleep 0.3
begin
fork { GC.start }
rescue Exception
parent.raise $!
end
- th1.run
end
m.lock
pid, status = Process.wait2
@@ -420,7 +418,7 @@ assert_equal 'ok', %{
rescue NotImplementedError
$result = :ok
end
- end;
+ END
end
require "./zzz.rb"
$result
@@ -450,27 +448,17 @@ assert_finish 3, %q{
assert_equal 'ok', %q{
begin
- Process.waitpid2(fork {})[1].success? ? 'ok' : 'ng'
+ Process.waitpid2(fork {sleep 1})[1].success? ? 'ok' : 'ng'
rescue NotImplementedError
'ok'
end
}
assert_equal 'foo', %q{
- i = 0
- Thread.start {sleep 1; exit!}
- f = proc {|s, c| /#{c.call; s}/o }
- th2 = Thread.new {
- sleep 0.01 until i == 1
- i = 2
- f.call("bar", proc {sleep 2});
- nil
- }
- th1 = Thread.new {
- f.call("foo", proc {i = 1; sleep 0.01 until i == 2; sleep 0.01})
- nil
- }
- [th1, th2].each {|t| t.join }
+ f = proc {|s| /#{ sleep 1; s }/o }
+ [ Thread.new { f.call("foo"); nil },
+ Thread.new { sleep 0.5; f.call("bar"); nil },
+ ].each {|t| t.join }
GC.start
f.call.source
}
diff --git a/ccan/build_assert/build_assert.h b/ccan/build_assert/build_assert.h
deleted file mode 100644
index a04d1d4709..0000000000
--- a/ccan/build_assert/build_assert.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
-#ifndef CCAN_BUILD_ASSERT_H
-#define CCAN_BUILD_ASSERT_H
-
-/**
- * BUILD_ASSERT - assert a build-time dependency.
- * @cond: the compile-time condition which must be true.
- *
- * Your compile will fail if the condition isn't true, or can't be evaluated
- * by the compiler. This can only be used within a function.
- *
- * Example:
- * #include <stddef.h>
- * ...
- * static char *foo_to_char(struct foo *foo)
- * {
- * // This code needs string to be at start of foo.
- * BUILD_ASSERT(offsetof(struct foo, string) == 0);
- * return (char *)foo;
- * }
- */
-#define BUILD_ASSERT(cond) \
- do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
-
-/**
- * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.
- * @cond: the compile-time condition which must be true.
- *
- * Your compile will fail if the condition isn't true, or can't be evaluated
- * by the compiler. This can be used in an expression: its value is "0".
- *
- * Example:
- * #define foo_to_char(foo) \
- * ((char *)(foo) \
- * + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
- */
-#define BUILD_ASSERT_OR_ZERO(cond) \
- (sizeof(char [1 - 2*!(cond)]) - 1)
-
-#endif /* CCAN_BUILD_ASSERT_H */
diff --git a/ccan/check_type/check_type.h b/ccan/check_type/check_type.h
deleted file mode 100644
index 1f77a535e4..0000000000
--- a/ccan/check_type/check_type.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
-#ifndef CCAN_CHECK_TYPE_H
-#define CCAN_CHECK_TYPE_H
-
-/**
- * check_type - issue a warning or build failure if type is not correct.
- * @expr: the expression whose type we should check (not evaluated).
- * @type: the exact type we expect the expression to be.
- *
- * This macro is usually used within other macros to try to ensure that a macro
- * argument is of the expected type. No type promotion of the expression is
- * done: an unsigned int is not the same as an int!
- *
- * check_type() always evaluates to 0.
- *
- * If your compiler does not support typeof, then the best we can do is fail
- * to compile if the sizes of the types are unequal (a less complete check).
- *
- * Example:
- * // They should always pass a 64-bit value to _set_some_value!
- * #define set_some_value(expr) \
- * _set_some_value((check_type((expr), uint64_t), (expr)))
- */
-
-/**
- * check_types_match - issue a warning or build failure if types are not same.
- * @expr1: the first expression (not evaluated).
- * @expr2: the second expression (not evaluated).
- *
- * This macro is usually used within other macros to try to ensure that
- * arguments are of identical types. No type promotion of the expressions is
- * done: an unsigned int is not the same as an int!
- *
- * check_types_match() always evaluates to 0.
- *
- * If your compiler does not support typeof, then the best we can do is fail
- * to compile if the sizes of the types are unequal (a less complete check).
- *
- * Example:
- * // Do subtraction to get to enclosing type, but make sure that
- * // pointer is of correct type for that member.
- * #define container_of(mbr_ptr, encl_type, mbr) \
- * (check_types_match((mbr_ptr), &((encl_type *)0)->mbr), \
- * ((encl_type *) \
- * ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr))))
- */
-#if HAVE_TYPEOF
-#define check_type(expr, type) \
- ((typeof(expr) *)0 != (type *)0)
-
-#define check_types_match(expr1, expr2) \
- ((typeof(expr1) *)0 != (typeof(expr2) *)0)
-#else
-#include "ccan/build_assert/build_assert.h"
-/* Without typeof, we can only test the sizes. */
-#define check_type(expr, type) \
- BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type))
-
-#define check_types_match(expr1, expr2) \
- BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2))
-#endif /* HAVE_TYPEOF */
-
-#endif /* CCAN_CHECK_TYPE_H */
diff --git a/ccan/container_of/container_of.h b/ccan/container_of/container_of.h
deleted file mode 100644
index ae3e1fc81f..0000000000
--- a/ccan/container_of/container_of.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
-#ifndef CCAN_CONTAINER_OF_H
-#define CCAN_CONTAINER_OF_H
-#include "ccan/check_type/check_type.h"
-
-/**
- * container_of - get pointer to enclosing structure
- * @member_ptr: pointer to the structure member
- * @containing_type: the type this member is within
- * @member: the name of this member within the structure.
- *
- * Given a pointer to a member of a structure, this macro does pointer
- * subtraction to return the pointer to the enclosing type.
- *
- * Example:
- * struct foo {
- * int fielda, fieldb;
- * // ...
- * };
- * struct info {
- * int some_other_field;
- * struct foo my_foo;
- * };
- *
- * static struct info *foo_to_info(struct foo *foo)
- * {
- * return container_of(foo, struct info, my_foo);
- * }
- */
-#define container_of(member_ptr, containing_type, member) \
- ((containing_type *) \
- ((char *)(member_ptr) \
- - container_off(containing_type, member)) \
- + check_types_match(*(member_ptr), ((containing_type *)0)->member))
-
-
-/**
- * container_of_or_null - get pointer to enclosing structure, or NULL
- * @member_ptr: pointer to the structure member
- * @containing_type: the type this member is within
- * @member: the name of this member within the structure.
- *
- * Given a pointer to a member of a structure, this macro does pointer
- * subtraction to return the pointer to the enclosing type, unless it
- * is given NULL, in which case it also returns NULL.
- *
- * Example:
- * struct foo {
- * int fielda, fieldb;
- * // ...
- * };
- * struct info {
- * int some_other_field;
- * struct foo my_foo;
- * };
- *
- * static struct info *foo_to_info_allowing_null(struct foo *foo)
- * {
- * return container_of_or_null(foo, struct info, my_foo);
- * }
- */
-static inline char *container_of_or_null_(void *member_ptr, size_t offset)
-{
- return member_ptr ? (char *)member_ptr - offset : NULL;
-}
-#define container_of_or_null(member_ptr, containing_type, member) \
- ((containing_type *) \
- container_of_or_null_(member_ptr, \
- container_off(containing_type, member)) \
- + check_types_match(*(member_ptr), ((containing_type *)0)->member))
-
-/**
- * container_off - get offset to enclosing structure
- * @containing_type: the type this member is within
- * @member: the name of this member within the structure.
- *
- * Given a pointer to a member of a structure, this macro does
- * typechecking and figures out the offset to the enclosing type.
- *
- * Example:
- * struct foo {
- * int fielda, fieldb;
- * // ...
- * };
- * struct info {
- * int some_other_field;
- * struct foo my_foo;
- * };
- *
- * static struct info *foo_to_info(struct foo *foo)
- * {
- * size_t off = container_off(struct info, my_foo);
- * return (void *)((char *)foo - off);
- * }
- */
-#define container_off(containing_type, member) \
- offsetof(containing_type, member)
-
-/**
- * container_of_var - get pointer to enclosing structure using a variable
- * @member_ptr: pointer to the structure member
- * @container_var: a pointer of same type as this member's container
- * @member: the name of this member within the structure.
- *
- * Given a pointer to a member of a structure, this macro does pointer
- * subtraction to return the pointer to the enclosing type.
- *
- * Example:
- * static struct info *foo_to_i(struct foo *foo)
- * {
- * struct info *i = container_of_var(foo, i, my_foo);
- * return i;
- * }
- */
-#if HAVE_TYPEOF
-#define container_of_var(member_ptr, container_var, member) \
- container_of(member_ptr, typeof(*container_var), member)
-#else
-#define container_of_var(member_ptr, container_var, member) \
- ((void *)((char *)(member_ptr) - \
- container_off_var(container_var, member)))
-#endif
-
-/**
- * container_off_var - get offset of a field in enclosing structure
- * @container_var: a pointer to a container structure
- * @member: the name of a member within the structure.
- *
- * Given (any) pointer to a structure and a its member name, this
- * macro does pointer subtraction to return offset of member in a
- * structure memory layout.
- *
- */
-#if HAVE_TYPEOF
-#define container_off_var(var, member) \
- container_off(typeof(*var), member)
-#else
-#define container_off_var(var, member) \
- ((const char *)&(var)->member - (const char *)(var))
-#endif
-
-#endif /* CCAN_CONTAINER_OF_H */
diff --git a/ccan/licenses/BSD-MIT b/ccan/licenses/BSD-MIT
deleted file mode 100644
index 89de354795..0000000000
--- a/ccan/licenses/BSD-MIT
+++ /dev/null
@@ -1,17 +0,0 @@
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/ccan/licenses/CC0 b/ccan/licenses/CC0
deleted file mode 100644
index feb9b118e6..0000000000
--- a/ccan/licenses/CC0
+++ /dev/null
@@ -1,28 +0,0 @@
-Statement of Purpose
-
-The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
-
-Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
-
-For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
-
-1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
-
- the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
- moral rights retained by the original author(s) and/or performer(s);
- publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
- rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
- rights protecting the extraction, dissemination, use and reuse of data in a Work;
- database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
- other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
-
-2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
-
-3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
-
-4. Limitations and Disclaimers.
-
- No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
- Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
- Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
- Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
diff --git a/ccan/list/list.h b/ccan/list/list.h
deleted file mode 100644
index ca9f9f1f7f..0000000000
--- a/ccan/list/list.h
+++ /dev/null
@@ -1,773 +0,0 @@
-/* Licensed under BSD-MIT - see ccan/licenses/BSD-MIT file for details */
-#ifndef CCAN_LIST_H
-#define CCAN_LIST_H
-#include <assert.h>
-#include "ccan/str/str.h"
-#include "ccan/container_of/container_of.h"
-#include "ccan/check_type/check_type.h"
-
-/**
- * struct list_node - an entry in a doubly-linked list
- * @next: next entry (self if empty)
- * @prev: previous entry (self if empty)
- *
- * This is used as an entry in a linked list.
- * Example:
- * struct child {
- * const char *name;
- * // Linked list of all us children.
- * struct list_node list;
- * };
- */
-struct list_node
-{
- struct list_node *next, *prev;
-};
-
-/**
- * struct list_head - the head of a doubly-linked list
- * @h: the list_head (containing next and prev pointers)
- *
- * This is used as the head of a linked list.
- * Example:
- * struct parent {
- * const char *name;
- * struct list_head children;
- * unsigned int num_children;
- * };
- */
-struct list_head
-{
- struct list_node n;
-};
-
-#define LIST_LOC __FILE__ ":" stringify(__LINE__)
-#define list_debug(h, loc) ((void)loc, h)
-#define list_debug_node(n, loc) ((void)loc, n)
-
-/**
- * LIST_HEAD_INIT - initializer for an empty list_head
- * @name: the name of the list.
- *
- * Explicit initializer for an empty list.
- *
- * See also:
- * LIST_HEAD, list_head_init()
- *
- * Example:
- * static struct list_head my_list = LIST_HEAD_INIT(my_list);
- */
-#define LIST_HEAD_INIT(name) { { &name.n, &name.n } }
-
-/**
- * LIST_HEAD - define and initialize an empty list_head
- * @name: the name of the list.
- *
- * The LIST_HEAD macro defines a list_head and initializes it to an empty
- * list. It can be prepended by "static" to define a static list_head.
- *
- * See also:
- * LIST_HEAD_INIT, list_head_init()
- *
- * Example:
- * static LIST_HEAD(my_global_list);
- */
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
-
-/**
- * list_head_init - initialize a list_head
- * @h: the list_head to set to the empty list
- *
- * Example:
- * ...
- * struct parent *parent = malloc(sizeof(*parent));
- *
- * list_head_init(&parent->children);
- * parent->num_children = 0;
- */
-static inline void list_head_init(struct list_head *h)
-{
- h->n.next = h->n.prev = &h->n;
-}
-
-/**
- * list_node_init - initialize a list_node
- * @n: the list_node to link to itself.
- *
- * You don't need to use this normally! But it lets you list_del(@n)
- * safely.
- */
-static inline void list_node_init(struct list_node *n)
-{
- n->next = n->prev = n;
-}
-
-/**
- * list_add_after - add an entry after an existing node in a linked list
- * @h: the list_head to add the node to (for debugging)
- * @p: the existing list_node to add the node after
- * @n: the new list_node to add to the list.
- *
- * The existing list_node must already be a member of the list.
- * The new list_node does not need to be initialized; it will be overwritten.
- *
- * Example:
- * struct child c1, c2, c3;
- * LIST_HEAD(h);
- *
- * list_add_tail(&h, &c1.list);
- * list_add_tail(&h, &c3.list);
- * list_add_after(&h, &c1.list, &c2.list);
- */
-#define list_add_after(h, p, n) list_add_after_(h, p, n, LIST_LOC)
-static inline void list_add_after_(struct list_head *h,
- struct list_node *p,
- struct list_node *n,
- const char *abortstr)
-{
- n->next = p->next;
- n->prev = p;
- p->next->prev = n;
- p->next = n;
- (void)list_debug(h, abortstr);
-}
-
-/**
- * list_add - add an entry at the start of a linked list.
- * @h: the list_head to add the node to
- * @n: the list_node to add to the list.
- *
- * The list_node does not need to be initialized; it will be overwritten.
- * Example:
- * struct child *child = malloc(sizeof(*child));
- *
- * child->name = "marvin";
- * list_add(&parent->children, &child->list);
- * parent->num_children++;
- */
-#define list_add(h, n) list_add_(h, n, LIST_LOC)
-static inline void list_add_(struct list_head *h,
- struct list_node *n,
- const char *abortstr)
-{
- list_add_after_(h, &h->n, n, abortstr);
-}
-
-/**
- * list_add_before - add an entry before an existing node in a linked list
- * @h: the list_head to add the node to (for debugging)
- * @p: the existing list_node to add the node before
- * @n: the new list_node to add to the list.
- *
- * The existing list_node must already be a member of the list.
- * The new list_node does not need to be initialized; it will be overwritten.
- *
- * Example:
- * list_head_init(&h);
- * list_add_tail(&h, &c1.list);
- * list_add_tail(&h, &c3.list);
- * list_add_before(&h, &c3.list, &c2.list);
- */
-#define list_add_before(h, p, n) list_add_before_(h, p, n, LIST_LOC)
-static inline void list_add_before_(struct list_head *h,
- struct list_node *p,
- struct list_node *n,
- const char *abortstr)
-{
- n->next = p;
- n->prev = p->prev;
- p->prev->next = n;
- p->prev = n;
- (void)list_debug(h, abortstr);
-}
-
-/**
- * list_add_tail - add an entry at the end of a linked list.
- * @h: the list_head to add the node to
- * @n: the list_node to add to the list.
- *
- * The list_node does not need to be initialized; it will be overwritten.
- * Example:
- * list_add_tail(&parent->children, &child->list);
- * parent->num_children++;
- */
-#define list_add_tail(h, n) list_add_tail_(h, n, LIST_LOC)
-static inline void list_add_tail_(struct list_head *h,
- struct list_node *n,
- const char *abortstr)
-{
- list_add_before_(h, &h->n, n, abortstr);
-}
-
-/**
- * list_empty - is a list empty?
- * @h: the list_head
- *
- * If the list is empty, returns true.
- *
- * Example:
- * assert(list_empty(&parent->children) == (parent->num_children == 0));
- */
-#define list_empty(h) list_empty_(h, LIST_LOC)
-static inline int list_empty_(const struct list_head *h, const char* abortstr)
-{
- (void)list_debug(h, abortstr);
- return h->n.next == &h->n;
-}
-
-/**
- * list_empty_nodebug - is a list empty (and don't perform debug checks)?
- * @h: the list_head
- *
- * If the list is empty, returns true.
- * This differs from list_empty() in that if CCAN_LIST_DEBUG is set it
- * will NOT perform debug checks. Only use this function if you REALLY
- * know what you're doing.
- *
- * Example:
- * assert(list_empty_nodebug(&parent->children) == (parent->num_children == 0));
- */
-#ifndef CCAN_LIST_DEBUG
-#define list_empty_nodebug(h) list_empty(h)
-#else
-static inline int list_empty_nodebug(const struct list_head *h)
-{
- return h->n.next == &h->n;
-}
-#endif
-
-/**
- * list_del - delete an entry from an (unknown) linked list.
- * @n: the list_node to delete from the list.
- *
- * Note that this leaves @n in an undefined state; it can be added to
- * another list, but not deleted again.
- *
- * See also:
- * list_del_from(), list_del_init()
- *
- * Example:
- * list_del(&child->list);
- * parent->num_children--;
- */
-#define list_del(n) list_del_(n, LIST_LOC)
-static inline void list_del_(struct list_node *n, const char* abortstr)
-{
- (void)list_debug_node(n, abortstr);
- n->next->prev = n->prev;
- n->prev->next = n->next;
-#ifdef CCAN_LIST_DEBUG
- /* Catch use-after-del. */
- n->next = n->prev = NULL;
-#endif
-}
-
-/**
- * list_del_init - delete a node, and reset it so it can be deleted again.
- * @n: the list_node to be deleted.
- *
- * list_del(@n) or list_del_init() again after this will be safe,
- * which can be useful in some cases.
- *
- * See also:
- * list_del_from(), list_del()
- *
- * Example:
- * list_del_init(&child->list);
- * parent->num_children--;
- */
-#define list_del_init(n) list_del_init_(n, LIST_LOC)
-static inline void list_del_init_(struct list_node *n, const char *abortstr)
-{
- list_del_(n, abortstr);
- list_node_init(n);
-}
-
-/**
- * list_del_from - delete an entry from a known linked list.
- * @h: the list_head the node is in.
- * @n: the list_node to delete from the list.
- *
- * This explicitly indicates which list a node is expected to be in,
- * which is better documentation and can catch more bugs.
- *
- * See also: list_del()
- *
- * Example:
- * list_del_from(&parent->children, &child->list);
- * parent->num_children--;
- */
-static inline void list_del_from(struct list_head *h, struct list_node *n)
-{
-#ifdef CCAN_LIST_DEBUG
- {
- /* Thorough check: make sure it was in list! */
- struct list_node *i;
- for (i = h->n.next; i != n; i = i->next)
- assert(i != &h->n);
- }
-#endif /* CCAN_LIST_DEBUG */
-
- /* Quick test that catches a surprising number of bugs. */
- assert(!list_empty(h));
- list_del(n);
-}
-
-/**
- * list_swap - swap out an entry from an (unknown) linked list for a new one.
- * @o: the list_node to replace from the list.
- * @n: the list_node to insert in place of the old one.
- *
- * Note that this leaves @o in an undefined state; it can be added to
- * another list, but not deleted/swapped again.
- *
- * See also:
- * list_del()
- *
- * Example:
- * struct child x1, x2;
- * LIST_HEAD(xh);
- *
- * list_add(&xh, &x1.list);
- * list_swap(&x1.list, &x2.list);
- */
-#define list_swap(o, n) list_swap_(o, n, LIST_LOC)
-static inline void list_swap_(struct list_node *o,
- struct list_node *n,
- const char* abortstr)
-{
- (void)list_debug_node(o, abortstr);
- *n = *o;
- n->next->prev = n;
- n->prev->next = n;
-#ifdef CCAN_LIST_DEBUG
- /* Catch use-after-del. */
- o->next = o->prev = NULL;
-#endif
-}
-
-/**
- * list_entry - convert a list_node back into the structure containing it.
- * @n: the list_node
- * @type: the type of the entry
- * @member: the list_node member of the type
- *
- * Example:
- * // First list entry is children.next; convert back to child.
- * child = list_entry(parent->children.n.next, struct child, list);
- *
- * See Also:
- * list_top(), list_for_each()
- */
-#define list_entry(n, type, member) container_of(n, type, member)
-
-/**
- * list_top - get the first entry in a list
- * @h: the list_head
- * @type: the type of the entry
- * @member: the list_node member of the type
- *
- * If the list is empty, returns NULL.
- *
- * Example:
- * struct child *first;
- * first = list_top(&parent->children, struct child, list);
- * if (!first)
- * printf("Empty list!\n");
- */
-#define list_top(h, type, member) \
- ((type *)list_top_((h), list_off_(type, member)))
-
-static inline const void *list_top_(const struct list_head *h, size_t off)
-{
- if (list_empty(h))
- return NULL;
- return (const char *)h->n.next - off;
-}
-
-/**
- * list_pop - remove the first entry in a list
- * @h: the list_head
- * @type: the type of the entry
- * @member: the list_node member of the type
- *
- * If the list is empty, returns NULL.
- *
- * Example:
- * struct child *one;
- * one = list_pop(&parent->children, struct child, list);
- * if (!one)
- * printf("Empty list!\n");
- */
-#define list_pop(h, type, member) \
- ((type *)list_pop_((h), list_off_(type, member)))
-
-static inline const void *list_pop_(const struct list_head *h, size_t off)
-{
- struct list_node *n;
-
- if (list_empty(h))
- return NULL;
- n = h->n.next;
- list_del(n);
- return (const char *)n - off;
-}
-
-/**
- * list_tail - get the last entry in a list
- * @h: the list_head
- * @type: the type of the entry
- * @member: the list_node member of the type
- *
- * If the list is empty, returns NULL.
- *
- * Example:
- * struct child *last;
- * last = list_tail(&parent->children, struct child, list);
- * if (!last)
- * printf("Empty list!\n");
- */
-#define list_tail(h, type, member) \
- ((type *)list_tail_((h), list_off_(type, member)))
-
-static inline const void *list_tail_(const struct list_head *h, size_t off)
-{
- if (list_empty(h))
- return NULL;
- return (const char *)h->n.prev - off;
-}
-
-/**
- * list_for_each - iterate through a list.
- * @h: the list_head (warning: evaluated multiple times!)
- * @i: the structure containing the list_node
- * @member: the list_node member of the structure
- *
- * This is a convenient wrapper to iterate @i over the entire list. It's
- * a for loop, so you can break and continue as normal.
- *
- * Example:
- * list_for_each(&parent->children, child, list)
- * printf("Name: %s\n", child->name);
- */
-#define list_for_each(h, i, member) \
- list_for_each_off(h, i, list_off_var_(i, member))
-
-/**
- * list_for_each_rev - iterate through a list backwards.
- * @h: the list_head
- * @i: the structure containing the list_node
- * @member: the list_node member of the structure
- *
- * This is a convenient wrapper to iterate @i over the entire list. It's
- * a for loop, so you can break and continue as normal.
- *
- * Example:
- * list_for_each_rev(&parent->children, child, list)
- * printf("Name: %s\n", child->name);
- */
-#define list_for_each_rev(h, i, member) \
- list_for_each_rev_off(h, i, list_off_var_(i, member))
-
-/**
- * list_for_each_rev_safe - iterate through a list backwards,
- * maybe during deletion
- * @h: the list_head
- * @i: the structure containing the list_node
- * @nxt: the structure containing the list_node
- * @member: the list_node member of the structure
- *
- * This is a convenient wrapper to iterate @i over the entire list backwards.
- * It's a for loop, so you can break and continue as normal. The extra
- * variable * @nxt is used to hold the next element, so you can delete @i
- * from the list.
- *
- * Example:
- * struct child *next;
- * list_for_each_rev_safe(&parent->children, child, next, list) {
- * printf("Name: %s\n", child->name);
- * }
- */
-#define list_for_each_rev_safe(h, i, nxt, member) \
- list_for_each_rev_safe_off(h, i, nxt, list_off_var_(i, member))
-
-/**
- * list_for_each_safe - iterate through a list, maybe during deletion
- * @h: the list_head
- * @i: the structure containing the list_node
- * @nxt: the structure containing the list_node
- * @member: the list_node member of the structure
- *
- * This is a convenient wrapper to iterate @i over the entire list. It's
- * a for loop, so you can break and continue as normal. The extra variable
- * @nxt is used to hold the next element, so you can delete @i from the list.
- *
- * Example:
- * list_for_each_safe(&parent->children, child, next, list) {
- * list_del(&child->list);
- * parent->num_children--;
- * }
- */
-#define list_for_each_safe(h, i, nxt, member) \
- list_for_each_safe_off(h, i, nxt, list_off_var_(i, member))
-
-/**
- * list_next - get the next entry in a list
- * @h: the list_head
- * @i: a pointer to an entry in the list.
- * @member: the list_node member of the structure
- *
- * If @i was the last entry in the list, returns NULL.
- *
- * Example:
- * struct child *second;
- * second = list_next(&parent->children, first, list);
- * if (!second)
- * printf("No second child!\n");
- */
-#define list_next(h, i, member) \
- ((list_typeof(i))list_entry_or_null(list_debug(h, \
- __FILE__ ":" stringify(__LINE__)), \
- (i)->member.next, \
- list_off_var_((i), member)))
-
-/**
- * list_prev - get the previous entry in a list
- * @h: the list_head
- * @i: a pointer to an entry in the list.
- * @member: the list_node member of the structure
- *
- * If @i was the first entry in the list, returns NULL.
- *
- * Example:
- * first = list_prev(&parent->children, second, list);
- * if (!first)
- * printf("Can't go back to first child?!\n");
- */
-#define list_prev(h, i, member) \
- ((list_typeof(i))list_entry_or_null(list_debug(h, \
- __FILE__ ":" stringify(__LINE__)), \
- (i)->member.prev, \
- list_off_var_((i), member)))
-
-/**
- * list_append_list - empty one list onto the end of another.
- * @to: the list to append into
- * @from: the list to empty.
- *
- * This takes the entire contents of @from and moves it to the end of
- * @to. After this @from will be empty.
- *
- * Example:
- * struct list_head adopter;
- *
- * list_append_list(&adopter, &parent->children);
- * assert(list_empty(&parent->children));
- * parent->num_children = 0;
- */
-#define list_append_list(t, f) list_append_list_(t, f, \
- __FILE__ ":" stringify(__LINE__))
-static inline void list_append_list_(struct list_head *to,
- struct list_head *from,
- const char *abortstr)
-{
- struct list_node *from_tail = list_debug(from, abortstr)->n.prev;
- struct list_node *to_tail = list_debug(to, abortstr)->n.prev;
-
- /* Sew in head and entire list. */
- to->n.prev = from_tail;
- from_tail->next = &to->n;
- to_tail->next = &from->n;
- from->n.prev = to_tail;
-
- /* Now remove head. */
- list_del(&from->n);
- list_head_init(from);
-}
-
-/**
- * list_prepend_list - empty one list into the start of another.
- * @to: the list to prepend into
- * @from: the list to empty.
- *
- * This takes the entire contents of @from and moves it to the start
- * of @to. After this @from will be empty.
- *
- * Example:
- * list_prepend_list(&adopter, &parent->children);
- * assert(list_empty(&parent->children));
- * parent->num_children = 0;
- */
-#define list_prepend_list(t, f) list_prepend_list_(t, f, LIST_LOC)
-static inline void list_prepend_list_(struct list_head *to,
- struct list_head *from,
- const char *abortstr)
-{
- struct list_node *from_tail = list_debug(from, abortstr)->n.prev;
- struct list_node *to_head = list_debug(to, abortstr)->n.next;
-
- /* Sew in head and entire list. */
- to->n.next = &from->n;
- from->n.prev = &to->n;
- to_head->prev = from_tail;
- from_tail->next = to_head;
-
- /* Now remove head. */
- list_del(&from->n);
- list_head_init(from);
-}
-
-/* internal macros, do not use directly */
-#define list_for_each_off_dir_(h, i, off, dir) \
- for (i = list_node_to_off_(list_debug(h, LIST_LOC)->n.dir, \
- (off)); \
- list_node_from_off_((void *)i, (off)) != &(h)->n; \
- i = list_node_to_off_(list_node_from_off_((void *)i, (off))->dir, \
- (off)))
-
-#define list_for_each_safe_off_dir_(h, i, nxt, off, dir) \
- for (i = list_node_to_off_(list_debug(h, LIST_LOC)->n.dir, \
- (off)), \
- nxt = list_node_to_off_(list_node_from_off_(i, (off))->dir, \
- (off)); \
- list_node_from_off_(i, (off)) != &(h)->n; \
- i = nxt, \
- nxt = list_node_to_off_(list_node_from_off_(i, (off))->dir, \
- (off)))
-
-/**
- * list_for_each_off - iterate through a list of memory regions.
- * @h: the list_head
- * @i: the pointer to a memory region wich contains list node data.
- * @off: offset(relative to @i) at which list node data resides.
- *
- * This is a low-level wrapper to iterate @i over the entire list, used to
- * implement all oher, more high-level, for-each constructs. It's a for loop,
- * so you can break and continue as normal.
- *
- * WARNING! Being the low-level macro that it is, this wrapper doesn't know
- * nor care about the type of @i. The only assumtion made is that @i points
- * to a chunk of memory that at some @offset, relative to @i, contains a
- * properly filled `struct node_list' which in turn contains pointers to
- * memory chunks and it's turtles all the way down. Whith all that in mind
- * remember that given the wrong pointer/offset couple this macro will
- * happilly churn all you memory untill SEGFAULT stops it, in other words
- * caveat emptor.
- *
- * It is worth mentioning that one of legitimate use-cases for that wrapper
- * is operation on opaque types with known offset for `struct list_node'
- * member(preferably 0), because it allows you not to disclose the type of
- * @i.
- *
- * Example:
- * list_for_each_off(&parent->children, child,
- * offsetof(struct child, list))
- * printf("Name: %s\n", child->name);
- */
-#define list_for_each_off(h, i, off) \
- list_for_each_off_dir_((h),(i),(off),next)
-
-/**
- * list_for_each_rev_off - iterate through a list of memory regions backwards
- * @h: the list_head
- * @i: the pointer to a memory region wich contains list node data.
- * @off: offset(relative to @i) at which list node data resides.
- *
- * See list_for_each_off for details
- */
-#define list_for_each_rev_off(h, i, off) \
- list_for_each_off_dir_((h),(i),(off),prev)
-
-/**
- * list_for_each_safe_off - iterate through a list of memory regions, maybe
- * during deletion
- * @h: the list_head
- * @i: the pointer to a memory region wich contains list node data.
- * @nxt: the structure containing the list_node
- * @off: offset(relative to @i) at which list node data resides.
- *
- * For details see `list_for_each_off' and `list_for_each_safe'
- * descriptions.
- *
- * Example:
- * list_for_each_safe_off(&parent->children, child,
- * next, offsetof(struct child, list))
- * printf("Name: %s\n", child->name);
- */
-#define list_for_each_safe_off(h, i, nxt, off) \
- list_for_each_safe_off_dir_((h),(i),(nxt),(off),next)
-
-/**
- * list_for_each_rev_safe_off - iterate backwards through a list of
- * memory regions, maybe during deletion
- * @h: the list_head
- * @i: the pointer to a memory region wich contains list node data.
- * @nxt: the structure containing the list_node
- * @off: offset(relative to @i) at which list node data resides.
- *
- * For details see `list_for_each_rev_off' and `list_for_each_rev_safe'
- * descriptions.
- *
- * Example:
- * list_for_each_rev_safe_off(&parent->children, child,
- * next, offsetof(struct child, list))
- * printf("Name: %s\n", child->name);
- */
-#define list_for_each_rev_safe_off(h, i, nxt, off) \
- list_for_each_safe_off_dir_((h),(i),(nxt),(off),prev)
-
-/* Other -off variants. */
-#define list_entry_off(n, type, off) \
- ((type *)list_node_from_off_((n), (off)))
-
-#define list_head_off(h, type, off) \
- ((type *)list_head_off((h), (off)))
-
-#define list_tail_off(h, type, off) \
- ((type *)list_tail_((h), (off)))
-
-#define list_add_off(h, n, off) \
- list_add((h), list_node_from_off_((n), (off)))
-
-#define list_del_off(n, off) \
- list_del(list_node_from_off_((n), (off)))
-
-#define list_del_from_off(h, n, off) \
- list_del_from(h, list_node_from_off_((n), (off)))
-
-/* Offset helper functions so we only single-evaluate. */
-static inline void *list_node_to_off_(struct list_node *node, size_t off)
-{
- return (void *)((char *)node - off);
-}
-static inline struct list_node *list_node_from_off_(void *ptr, size_t off)
-{
- return (struct list_node *)((char *)ptr + off);
-}
-
-/* Get the offset of the member, but make sure it's a list_node. */
-#define list_off_(type, member) \
- (container_off(type, member) + \
- check_type(((type *)0)->member, struct list_node))
-
-#define list_off_var_(var, member) \
- (container_off_var(var, member) + \
- check_type(var->member, struct list_node))
-
-#if HAVE_TYPEOF
-#define list_typeof(var) typeof(var)
-#else
-#define list_typeof(var) void *
-#endif
-
-/* Returns member, or NULL if at end of list. */
-static inline void *list_entry_or_null(const struct list_head *h,
- const struct list_node *n,
- size_t off)
-{
- if (n == &h->n)
- return NULL;
- return (char *)n - off;
-}
-#endif /* CCAN_LIST_H */
diff --git a/ccan/str/str.h b/ccan/str/str.h
deleted file mode 100644
index 9a9da9cd3f..0000000000
--- a/ccan/str/str.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
-#ifndef CCAN_STR_H
-#define CCAN_STR_H
-/**
- * stringify - Turn expression into a string literal
- * @expr: any C expression
- *
- * Example:
- * #define PRINT_COND_IF_FALSE(cond) \
- * ((cond) || printf("%s is false!", stringify(cond)))
- */
-#define stringify(expr) stringify_1(expr)
-/* Double-indirection required to stringify expansions */
-#define stringify_1(expr) #expr
-
-#endif /* CCAN_STR_H */
diff --git a/class.c b/class.c
index cb69ffe2b3..8d237985b8 100644
--- a/class.c
+++ b/class.c
@@ -23,13 +23,17 @@
* \{
*/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/st.h"
+#include "method.h"
#include "constant.h"
#include "vm_core.h"
-#include "id_table.h"
+#include "internal.h"
#include <ctype.h>
+int rb_vm_add_root_module(ID id, VALUE module);
+
+
#define id_attached id__attached__
void
@@ -38,7 +42,7 @@ rb_class_subclass_add(VALUE super, VALUE klass)
rb_subclass_entry_t *entry, *head;
if (super && super != Qundef) {
- entry = ALLOC(rb_subclass_entry_t);
+ entry = malloc(sizeof(*entry));
entry->klass = klass;
entry->next = NULL;
@@ -58,7 +62,7 @@ rb_module_add_to_subclasses_list(VALUE module, VALUE iclass)
{
rb_subclass_entry_t *entry, *head;
- entry = ALLOC(rb_subclass_entry_t);
+ entry = malloc(sizeof(*entry));
entry->klass = iclass;
entry->next = NULL;
@@ -84,7 +88,7 @@ rb_class_remove_from_super_subclasses(VALUE klass)
if (entry->next) {
RCLASS_EXT(entry->next->klass)->parent_subclasses = RCLASS_EXT(klass)->parent_subclasses;
}
- xfree(entry);
+ free(entry);
}
RCLASS_EXT(klass)->parent_subclasses = NULL;
@@ -103,14 +107,14 @@ rb_class_remove_from_module_subclasses(VALUE klass)
RCLASS_EXT(entry->next->klass)->module_subclasses = RCLASS_EXT(klass)->module_subclasses;
}
- xfree(entry);
+ free(entry);
}
RCLASS_EXT(klass)->module_subclasses = NULL;
}
void
-rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE arg)
+rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE))
{
rb_subclass_entry_t *cur = RCLASS_EXT(klass)->subclasses;
@@ -119,32 +123,20 @@ rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE arg)
while (cur) {
VALUE curklass = cur->klass;
cur = cur->next;
- f(curklass, arg);
+ f(curklass);
}
}
-static void
-class_detach_subclasses(VALUE klass, VALUE arg)
-{
- rb_class_remove_from_super_subclasses(klass);
-}
-
void
rb_class_detach_subclasses(VALUE klass)
{
- rb_class_foreach_subclass(klass, class_detach_subclasses, Qnil);
-}
-
-static void
-class_detach_module_subclasses(VALUE klass, VALUE arg)
-{
- rb_class_remove_from_module_subclasses(klass);
+ rb_class_foreach_subclass(klass, rb_class_remove_from_super_subclasses);
}
void
rb_class_detach_module_subclasses(VALUE klass)
{
- rb_class_foreach_subclass(klass, class_detach_module_subclasses, Qnil);
+ rb_class_foreach_subclass(klass, rb_class_remove_from_module_subclasses);
}
/**
@@ -162,31 +154,25 @@ rb_class_detach_module_subclasses(VALUE klass)
static VALUE
class_alloc(VALUE flags, VALUE klass)
{
- NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0));
- obj->ptr = ZALLOC(rb_classext_t);
- /* ZALLOC
- RCLASS_IV_TBL(obj) = 0;
- RCLASS_CONST_TBL(obj) = 0;
- RCLASS_M_TBL(obj) = 0;
- RCLASS_IV_INDEX_TBL(obj) = 0;
- RCLASS_SET_SUPER((VALUE)obj, 0);
- RCLASS_EXT(obj)->subclasses = NULL;
- RCLASS_EXT(obj)->parent_subclasses = NULL;
- RCLASS_EXT(obj)->module_subclasses = NULL;
- */
- RCLASS_SET_ORIGIN((VALUE)obj, (VALUE)obj);
- RCLASS_SERIAL(obj) = rb_next_class_serial();
+ NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0));
+ obj->ptr = ALLOC(rb_classext_t);
+ RCLASS_IV_TBL(obj) = 0;
+ RCLASS_CONST_TBL(obj) = 0;
+ RCLASS_M_TBL(obj) = 0;
+ RCLASS_SET_SUPER((VALUE)obj, 0);
+ RCLASS_ORIGIN(obj) = (VALUE)obj;
+ RCLASS_IV_INDEX_TBL(obj) = 0;
+
+ RCLASS_EXT(obj)->subclasses = NULL;
+ RCLASS_EXT(obj)->parent_subclasses = NULL;
+ RCLASS_EXT(obj)->module_subclasses = NULL;
+ RCLASS_EXT(obj)->class_serial = rb_next_class_serial();
+
RCLASS_REFINED_CLASS(obj) = Qnil;
RCLASS_EXT(obj)->allocator = 0;
-
return (VALUE)obj;
}
-static void
-RCLASS_M_TBL_INIT(VALUE c)
-{
- RCLASS_M_TBL(c) = rb_id_table_create(0);
-}
/*!
* A utility function that wraps class_alloc.
@@ -203,7 +189,7 @@ rb_class_boot(VALUE super)
VALUE klass = class_alloc(T_CLASS, rb_cClass);
RCLASS_SET_SUPER(klass, super);
- RCLASS_M_TBL_INIT(klass);
+ RCLASS_M_TBL(klass) = st_init_numtable();
OBJ_INFECT(klass, super);
return (VALUE)klass;
@@ -220,8 +206,8 @@ void
rb_check_inheritable(VALUE super)
{
if (!RB_TYPE_P(super, T_CLASS)) {
- rb_raise(rb_eTypeError, "superclass must be a Class (%"PRIsVALUE" given)",
- rb_obj_class(super));
+ rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
+ rb_obj_classname(super));
}
if (RBASIC(super)->flags & FL_SINGLETON) {
rb_raise(rb_eTypeError, "can't make subclass of singleton class");
@@ -247,29 +233,48 @@ rb_class_new(VALUE super)
}
static void
-clone_method(VALUE old_klass, VALUE new_klass, ID mid, const rb_method_entry_t *me)
-{
- if (me->def->type == VM_METHOD_TYPE_ISEQ) {
- rb_cref_t *new_cref;
- rb_vm_rewrite_cref(me->def->body.iseq.cref, old_klass, new_klass, &new_cref);
- rb_add_method_iseq(new_klass, mid, me->def->body.iseq.iseqptr, new_cref, METHOD_ENTRY_VISI(me));
+rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass, NODE **new_cref_ptr)
+{
+ NODE *new_node;
+ while (node) {
+ if (node->nd_clss == old_klass) {
+ new_node = NEW_CREF(new_klass);
+ new_node->nd_next = node->nd_next;
+ *new_cref_ptr = new_node;
+ return;
+ }
+ new_node = NEW_CREF(node->nd_clss);
+ node = node->nd_next;
+ *new_cref_ptr = new_node;
+ new_cref_ptr = &new_node->nd_next;
+ }
+ *new_cref_ptr = NULL;
+}
+
+static void
+clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
+{
+ VALUE newiseqval;
+ if (me->def && me->def->type == VM_METHOD_TYPE_ISEQ) {
+ rb_iseq_t *iseq;
+ NODE *new_cref;
+ newiseqval = rb_iseq_clone(me->def->body.iseq->self, klass);
+ GetISeqPtr(newiseqval, iseq);
+ rewrite_cref_stack(me->def->body.iseq->cref_stack, me->klass, klass, &new_cref);
+ OBJ_WRITE(iseq->self, &iseq->cref_stack, new_cref);
+ rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
+ RB_GC_GUARD(newiseqval);
}
else {
- rb_method_entry_set(new_klass, mid, me, METHOD_ENTRY_VISI(me));
+ rb_method_entry_set(klass, mid, me, me->flag);
}
}
-struct clone_method_arg {
- VALUE new_klass;
- VALUE old_klass;
-};
-
-static enum rb_id_table_iterator_result
-clone_method_i(ID key, VALUE value, void *data)
+static int
+clone_method_i(st_data_t key, st_data_t value, st_data_t data)
{
- const struct clone_method_arg *arg = (struct clone_method_arg *)data;
- clone_method(arg->old_klass, arg->new_klass, key, (const rb_method_entry_t *)value);
- return ID_TABLE_CONTINUE;
+ clone_method((VALUE)data, (ID)key, (const rb_method_entry_t *)value);
+ return ST_CONTINUE;
}
struct clone_const_arg {
@@ -282,8 +287,8 @@ clone_const(ID key, const rb_const_entry_t *ce, struct clone_const_arg *arg)
{
rb_const_entry_t *nce = ALLOC(rb_const_entry_t);
MEMCPY(nce, ce, rb_const_entry_t, 1);
- RB_OBJ_WRITTEN(arg->klass, Qundef, ce->value);
- RB_OBJ_WRITTEN(arg->klass, Qundef, ce->file);
+ OBJ_WRITTEN(arg->klass, Qundef, ce->value);
+ OBJ_WRITTEN(arg->klass, Qundef, ce->file);
st_insert(arg->tbl, key, (st_data_t)nce);
return ST_CONTINUE;
@@ -316,25 +321,19 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
if (RB_TYPE_P(clone, T_CLASS)) {
class_init_copy_check(clone, orig);
}
- if (!OBJ_INIT_COPY(clone, orig)) return clone;
+ rb_obj_init_copy(clone, orig);
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig));
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
}
RCLASS_SET_SUPER(clone, RCLASS_SUPER(orig));
RCLASS_EXT(clone)->allocator = RCLASS_EXT(orig)->allocator;
- if (RCLASS_IV_TBL(clone)) {
- st_free_table(RCLASS_IV_TBL(clone));
- RCLASS_IV_TBL(clone) = 0;
- }
- if (RCLASS_CONST_TBL(clone)) {
- rb_free_const_table(RCLASS_CONST_TBL(clone));
- RCLASS_CONST_TBL(clone) = 0;
- }
- RCLASS_M_TBL(clone) = 0;
if (RCLASS_IV_TBL(orig)) {
st_data_t id;
+ if (RCLASS_IV_TBL(clone)) {
+ st_free_table(RCLASS_IV_TBL(clone));
+ }
RCLASS_IV_TBL(clone) = rb_st_copy(clone, RCLASS_IV_TBL(orig));
CONST_ID(id, "__tmp_classpath__");
st_delete(RCLASS_IV_TBL(clone), &id, 0);
@@ -345,18 +344,20 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
}
if (RCLASS_CONST_TBL(orig)) {
struct clone_const_arg arg;
-
+ if (RCLASS_CONST_TBL(clone)) {
+ rb_free_const_table(RCLASS_CONST_TBL(clone));
+ }
RCLASS_CONST_TBL(clone) = st_init_numtable();
arg.klass = clone;
arg.tbl = RCLASS_CONST_TBL(clone);
st_foreach(RCLASS_CONST_TBL(orig), clone_const_i, (st_data_t)&arg);
}
if (RCLASS_M_TBL(orig)) {
- struct clone_method_arg arg;
- arg.old_klass = orig;
- arg.new_klass = clone;
- RCLASS_M_TBL_INIT(clone);
- rb_id_table_foreach(RCLASS_M_TBL(orig), clone_method_i, &arg);
+ if (RCLASS_M_TBL(clone)) {
+ rb_free_m_table(RCLASS_M_TBL(clone));
+ }
+ RCLASS_M_TBL(clone) = st_init_numtable();
+ st_foreach(RCLASS_M_TBL(orig), clone_method_i, (st_data_t)clone);
}
return clone;
@@ -371,7 +372,7 @@ rb_singleton_class_clone(VALUE obj)
VALUE
rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
{
- const VALUE klass = RBASIC(obj)->klass;
+ VALUE klass = RBASIC(obj)->klass;
if (!FL_TEST(klass, FL_SINGLETON))
return klass;
@@ -401,13 +402,8 @@ rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
if (attach != Qundef) {
rb_singleton_class_attached(clone, attach);
}
- RCLASS_M_TBL_INIT(clone);
- {
- struct clone_method_arg arg;
- arg.old_klass = klass;
- arg.new_klass = clone;
- rb_id_table_foreach(RCLASS_M_TBL(klass), clone_method_i, &arg);
- }
+ RCLASS_M_TBL(clone) = st_init_numtable();
+ st_foreach(RCLASS_M_TBL(klass), clone_method_i, (st_data_t)clone);
rb_singleton_class_attached(RBASIC(clone)->klass, clone);
FL_SET(clone, FL_SINGLETON);
@@ -426,7 +422,7 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
if (!RCLASS_IV_TBL(klass)) {
RCLASS_IV_TBL(klass) = st_init_numtable();
}
- rb_class_ivar_set(klass, id_attached, obj);
+ rb_st_insert_id_and_value(klass, RCLASS_IV_TBL(klass), id_attached, obj);
}
}
@@ -442,19 +438,6 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
*/
#define META_CLASS_OF_CLASS_CLASS_P(k) (METACLASS_OF(k) == (k))
-static int
-rb_singleton_class_has_metaclass_p(VALUE sklass)
-{
- return rb_attr_get(METACLASS_OF(sklass), id_attached) == sklass;
-}
-
-int
-rb_singleton_class_internal_p(VALUE sklass)
-{
- return (RB_TYPE_P(rb_attr_get(sklass, id_attached), T_CLASS) &&
- !rb_singleton_class_has_metaclass_p(sklass));
-}
-
/*!
* whether k has a metaclass
* @retval 1 if \a k has a metaclass
@@ -462,7 +445,7 @@ rb_singleton_class_internal_p(VALUE sklass)
*/
#define HAVE_METACLASS_P(k) \
(FL_TEST(METACLASS_OF(k), FL_SINGLETON) && \
- rb_singleton_class_has_metaclass_p(k))
+ rb_ivar_get(METACLASS_OF(k), id_attached) == (k))
/*!
* ensures \a klass belongs to its own eigenclass.
@@ -549,11 +532,10 @@ Init_class_hierarchy(void)
{
rb_cBasicObject = boot_defclass("BasicObject", 0);
rb_cObject = boot_defclass("Object", rb_cBasicObject);
- rb_gc_register_mark_object(rb_cObject);
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);
- rb_const_set(rb_cObject, rb_intern_const("BasicObject"), rb_cBasicObject);
+ rb_const_set(rb_cObject, rb_intern("BasicObject"), rb_cBasicObject);
RBASIC_SET_CLASS(rb_cClass, rb_cClass);
RBASIC_SET_CLASS(rb_cModule, rb_cClass);
RBASIC_SET_CLASS(rb_cObject, rb_cClass);
@@ -650,8 +632,7 @@ rb_define_class(const char *name, VALUE super)
if (rb_const_defined(rb_cObject, id)) {
klass = rb_const_get(rb_cObject, id);
if (!RB_TYPE_P(klass, T_CLASS)) {
- rb_raise(rb_eTypeError, "%s is not a class (%"PRIsVALUE")",
- name, rb_obj_class(klass));
+ rb_raise(rb_eTypeError, "%s is not a class", name);
}
if (rb_class_real(RCLASS_SUPER(klass)) != super) {
rb_raise(rb_eTypeError, "superclass mismatch for class %s", name);
@@ -680,7 +661,7 @@ rb_define_class(const char *name, VALUE super)
* \return the created class
* \throw TypeError if the constant name \a name is already taken but
* the constant is not a \c Class.
- * \throw TypeError if the class is already defined but the class can not
+ * \throw NameError if the class is already defined but the class can not
* be reopened because its superclass is not \a super.
* \post top-level constant named \a name refers the returned class.
*
@@ -703,7 +684,7 @@ rb_define_class_under(VALUE outer, const char *name, VALUE super)
* \return the created class
* \throw TypeError if the constant name \a name is already taken but
* the constant is not a \c Class.
- * \throw TypeError if the class is already defined but the class can not
+ * \throw NameError if the class is already defined but the class can not
* be reopened because its superclass is not \a super.
* \post top-level constant named \a name refers the returned class.
*
@@ -718,21 +699,16 @@ rb_define_class_id_under(VALUE outer, ID id, VALUE super)
if (rb_const_defined_at(outer, id)) {
klass = rb_const_get_at(outer, id);
if (!RB_TYPE_P(klass, T_CLASS)) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE"::%"PRIsVALUE" is not a class"
- " (%"PRIsVALUE")",
- outer, rb_id2str(id), rb_obj_class(klass));
+ rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(id));
}
if (rb_class_real(RCLASS_SUPER(klass)) != super) {
- rb_raise(rb_eTypeError, "superclass mismatch for class "
- "%"PRIsVALUE"::%"PRIsVALUE""
- " (%"PRIsVALUE" is given but was %"PRIsVALUE")",
- outer, rb_id2str(id), RCLASS_SUPER(klass), super);
+ rb_name_error(id, "%s is already defined", rb_id2name(id));
}
return klass;
}
if (!super) {
- rb_warn("no super class for `%"PRIsVALUE"::%"PRIsVALUE"', Object assumed",
- rb_class_path(outer), rb_id2str(id));
+ rb_warn("no super class for `%s::%s', Object assumed",
+ rb_class2name(outer), rb_id2name(id));
}
klass = rb_define_class_id(id, super);
rb_set_class_path_string(klass, outer, rb_id2str(id));
@@ -747,7 +723,9 @@ VALUE
rb_module_new(void)
{
VALUE mdl = class_alloc(T_MODULE, rb_cModule);
- RCLASS_M_TBL_INIT(mdl);
+
+ RCLASS_M_TBL(mdl) = st_init_numtable();
+
return (VALUE)mdl;
}
@@ -771,11 +749,9 @@ rb_define_module(const char *name)
id = rb_intern(name);
if (rb_const_defined(rb_cObject, id)) {
module = rb_const_get(rb_cObject, id);
- if (!RB_TYPE_P(module, T_MODULE)) {
- rb_raise(rb_eTypeError, "%s is not a module (%"PRIsVALUE")",
- name, rb_obj_class(module));
- }
- return module;
+ if (RB_TYPE_P(module, T_MODULE))
+ return module;
+ rb_raise(rb_eTypeError, "%s is not a module", rb_obj_classname(module));
}
module = rb_define_module_id(id);
rb_vm_add_root_module(id, module);
@@ -797,12 +773,10 @@ rb_define_module_id_under(VALUE outer, ID id)
if (rb_const_defined_at(outer, id)) {
module = rb_const_get_at(outer, id);
- if (!RB_TYPE_P(module, T_MODULE)) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE"::%"PRIsVALUE" is not a module"
- " (%"PRIsVALUE")",
- outer, rb_id2str(id), rb_obj_class(module));
- }
- return module;
+ if (RB_TYPE_P(module, T_MODULE))
+ return module;
+ rb_raise(rb_eTypeError, "%s::%s is not a module",
+ rb_class2name(outer), rb_obj_classname(module));
}
module = rb_define_module_id(id);
rb_const_set(outer, id, module);
@@ -829,8 +803,7 @@ rb_include_class_new(VALUE module, VALUE super)
RCLASS_IV_TBL(klass) = RCLASS_IV_TBL(module);
RCLASS_CONST_TBL(klass) = RCLASS_CONST_TBL(module);
- RCLASS_M_TBL(OBJ_WB_UNPROTECT(klass)) =
- RCLASS_M_TBL(OBJ_WB_UNPROTECT(RCLASS_ORIGIN(module))); /* TODO: unprotected? */
+ RCLASS_M_TBL(OBJ_WB_UNPROTECT(klass)) = RCLASS_M_TBL(OBJ_WB_UNPROTECT(RCLASS_ORIGIN(module)));
RCLASS_SET_SUPER(klass, super);
if (RB_TYPE_P(module, T_ICLASS)) {
@@ -845,44 +818,39 @@ rb_include_class_new(VALUE module, VALUE super)
return (VALUE)klass;
}
-static int include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super);
-
-static void
-ensure_includable(VALUE klass, VALUE module)
-{
- rb_frozen_class_p(klass);
- Check_Type(module, T_MODULE);
- if (!NIL_P(rb_refinement_module_get_refined_class(module))) {
- rb_raise(rb_eArgError, "refinement module is not allowed");
- }
- OBJ_INFECT(klass, module);
-}
+static int include_modules_at(const VALUE klass, VALUE c, VALUE module);
void
rb_include_module(VALUE klass, VALUE module)
{
int changed = 0;
- ensure_includable(klass, module);
+ rb_frozen_class_p(klass);
+
+ if (!RB_TYPE_P(module, T_MODULE)) {
+ Check_Type(module, T_MODULE);
+ }
- changed = include_modules_at(klass, RCLASS_ORIGIN(klass), module, TRUE);
+ OBJ_INFECT(klass, module);
+
+ changed = include_modules_at(klass, RCLASS_ORIGIN(klass), module);
if (changed < 0)
rb_raise(rb_eArgError, "cyclic include detected");
}
-static enum rb_id_table_iterator_result
-add_refined_method_entry_i(ID key, VALUE value, void *data)
+static int
+add_refined_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
- rb_add_refined_method_entry((VALUE)data, key);
- return ID_TABLE_CONTINUE;
+ rb_add_refined_method_entry((VALUE) data, (ID) key);
+ return ST_CONTINUE;
}
static int
-include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super)
+include_modules_at(const VALUE klass, VALUE c, VALUE module)
{
VALUE p, iclass;
int method_changed = 0, constant_changed = 0;
- struct rb_id_table *const klass_m_tbl = RCLASS_M_TBL(RCLASS_ORIGIN(klass));
+ const st_table *const klass_m_tbl = RCLASS_M_TBL(RCLASS_ORIGIN(klass));
while (module) {
int superclass_seen = FALSE;
@@ -893,38 +861,41 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super)
return -1;
/* ignore if the module included already in superclasses */
for (p = RCLASS_SUPER(klass); p; p = RCLASS_SUPER(p)) {
- int type = BUILTIN_TYPE(p);
- if (type == T_ICLASS) {
+ switch (BUILTIN_TYPE(p)) {
+ case T_ICLASS:
if (RCLASS_M_TBL(p) == RCLASS_M_TBL(module)) {
if (!superclass_seen) {
c = p; /* move insertion point */
}
goto skip;
}
- }
- else if (type == T_CLASS) {
- if (!search_super) break;
+ break;
+ case T_CLASS:
superclass_seen = TRUE;
+ break;
}
}
iclass = rb_include_class_new(module, RCLASS_SUPER(c));
c = RCLASS_SET_SUPER(c, iclass);
- {
- VALUE m = module;
- if (BUILTIN_TYPE(m) == T_ICLASS) m = RBASIC(m)->klass;
- rb_module_add_to_subclasses_list(m, iclass);
+ if (BUILTIN_TYPE(module) == T_ICLASS) {
+ rb_module_add_to_subclasses_list(RBASIC(module)->klass, iclass);
+ } else {
+ rb_module_add_to_subclasses_list(module, iclass);
}
if (FL_TEST(klass, RMODULE_IS_REFINEMENT)) {
VALUE refined_class =
rb_refinement_module_get_refined_class(klass);
- rb_id_table_foreach(RMODULE_M_TBL(module), add_refined_method_entry_i, (void *)refined_class);
+ st_foreach(RMODULE_M_TBL(module), add_refined_method_entry_i,
+ (st_data_t) refined_class);
FL_SET(c, RMODULE_INCLUDED_INTO_REFINEMENT);
}
- if (RMODULE_M_TBL(module) && rb_id_table_size(RMODULE_M_TBL(module))) method_changed = 1;
- if (RMODULE_CONST_TBL(module) && RMODULE_CONST_TBL(module)->num_entries) constant_changed = 1;
+ if (RMODULE_M_TBL(module) && RMODULE_M_TBL(module)->num_entries)
+ method_changed = 1;
+ if (RMODULE_CONST_TBL(module) && RMODULE_CONST_TBL(module)->num_entries)
+ constant_changed = 1;
skip:
module = RCLASS_SUPER(module);
}
@@ -935,53 +906,59 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super)
return method_changed;
}
-static enum rb_id_table_iterator_result
-move_refined_method(ID key, VALUE value, void *data)
+static int
+move_refined_method(st_data_t key, st_data_t value, st_data_t data)
{
rb_method_entry_t *me = (rb_method_entry_t *) value;
- VALUE klass = (VALUE)data;
- struct rb_id_table *tbl = RCLASS_M_TBL(klass);
+ st_table *tbl = (st_table *) data;
if (me->def->type == VM_METHOD_TYPE_REFINED) {
- if (me->def->body.refined.orig_me) {
- const rb_method_entry_t *orig_me = me->def->body.refined.orig_me, *new_me;
- RB_OBJ_WRITE(me, &me->def->body.refined.orig_me, NULL);
- new_me = rb_method_entry_clone(me);
- rb_id_table_insert(tbl, key, (VALUE)new_me);
- RB_OBJ_WRITTEN(klass, Qundef, new_me);
- rb_method_entry_copy(me, orig_me);
- return ID_TABLE_CONTINUE;
+ if (me->def->body.orig_me) {
+ rb_method_entry_t *orig_me = me->def->body.orig_me, *new_me;
+ me->def->body.orig_me = NULL;
+ new_me = ALLOC(rb_method_entry_t);
+ *new_me = *me;
+ st_add_direct(tbl, key, (st_data_t) new_me);
+ *me = *orig_me;
+ xfree(orig_me);
+ return ST_CONTINUE;
}
else {
- rb_id_table_insert(tbl, key, (VALUE)me);
- return ID_TABLE_DELETE;
+ st_add_direct(tbl, key, (st_data_t) me);
+ return ST_DELETE;
}
}
else {
- return ID_TABLE_CONTINUE;
+ return ST_CONTINUE;
}
}
void
rb_prepend_module(VALUE klass, VALUE module)
{
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
VALUE origin;
int changed = 0;
- ensure_includable(klass, module);
+ rb_frozen_class_p(klass);
+
+ Check_Type(module, T_MODULE);
+
+ OBJ_INFECT(klass, module);
origin = RCLASS_ORIGIN(klass);
if (origin == klass) {
origin = class_alloc(T_ICLASS, klass);
- OBJ_WB_UNPROTECT(origin); /* TODO: conservative shading. Need more survey. */
+ OBJ_WB_UNPROTECT(origin); /* TODO: conservertive shading. Need more survery. */
RCLASS_SET_SUPER(origin, RCLASS_SUPER(klass));
RCLASS_SET_SUPER(klass, origin);
- RCLASS_SET_ORIGIN(klass, origin);
+ RCLASS_ORIGIN(klass) = origin;
RCLASS_M_TBL(origin) = RCLASS_M_TBL(klass);
- RCLASS_M_TBL_INIT(klass);
- rb_id_table_foreach(RCLASS_M_TBL(origin), move_refined_method, (void *)klass);
+ RCLASS_M_TBL(klass) = st_init_numtable();
+ st_foreach(RCLASS_M_TBL(origin), move_refined_method,
+ (st_data_t) RCLASS_M_TBL(klass));
}
- changed = include_modules_at(klass, klass, module, FALSE);
+ changed = include_modules_at(klass, klass, module);
if (changed < 0)
rb_raise(rb_eArgError, "cyclic prepend detected");
if (changed) {
@@ -1060,18 +1037,16 @@ rb_mod_include_p(VALUE mod, VALUE mod2)
* call-seq:
* mod.ancestors -> array
*
- * Returns a list of modules included/prepended in <i>mod</i>
- * (including <i>mod</i> itself).
+ * Returns a list of modules included in <i>mod</i> (including
+ * <i>mod</i> itself).
*
* module Mod
* include Math
* include Comparable
- * prepend Enumerable
* end
*
- * Mod.ancestors #=> [Enumerable, Mod, Comparable, Math]
- * Math.ancestors #=> [Math]
- * Enumerable.ancestors #=> [Enumerable]
+ * Mod.ancestors #=> [Mod, Comparable, Math]
+ * Math.ancestors #=> [Math]
*/
VALUE
@@ -1090,84 +1065,83 @@ rb_mod_ancestors(VALUE mod)
return ary;
}
+#define VISI(x) ((x)&NOEX_MASK)
+#define VISI_CHECK(x,f) (VISI(x) == (f))
+
static int
-ins_methods_push(ID name, rb_method_visibility_t visi, VALUE ary, rb_method_visibility_t expected_visi)
+ins_methods_push(ID name, long type, VALUE ary, long visi)
{
- if (visi == METHOD_VISI_UNDEF) return ST_CONTINUE;
+ if (type == -1) return ST_CONTINUE;
- switch (expected_visi) {
- case METHOD_VISI_UNDEF:
- if (visi != METHOD_VISI_PRIVATE) rb_ary_push(ary, ID2SYM(name));
+ switch (visi) {
+ case NOEX_PRIVATE:
+ case NOEX_PROTECTED:
+ case NOEX_PUBLIC:
+ visi = (type == visi);
break;
- case METHOD_VISI_PRIVATE:
- case METHOD_VISI_PROTECTED:
- case METHOD_VISI_PUBLIC:
- if (visi == expected_visi) rb_ary_push(ary, ID2SYM(name));
+ default:
+ visi = (type != NOEX_PRIVATE);
break;
}
+ if (visi) {
+ rb_ary_push(ary, ID2SYM(name));
+ }
return ST_CONTINUE;
}
static int
ins_methods_i(st_data_t name, st_data_t type, st_data_t ary)
{
- return ins_methods_push((ID)name, (rb_method_visibility_t)type, (VALUE)ary, METHOD_VISI_UNDEF); /* everything but private */
+ return ins_methods_push((ID)name, (long)type, (VALUE)ary, -1); /* everything but private */
}
static int
ins_methods_prot_i(st_data_t name, st_data_t type, st_data_t ary)
{
- return ins_methods_push((ID)name, (rb_method_visibility_t)type, (VALUE)ary, METHOD_VISI_PROTECTED);
+ return ins_methods_push((ID)name, (long)type, (VALUE)ary, NOEX_PROTECTED);
}
static int
ins_methods_priv_i(st_data_t name, st_data_t type, st_data_t ary)
{
- return ins_methods_push((ID)name, (rb_method_visibility_t)type, (VALUE)ary, METHOD_VISI_PRIVATE);
+ return ins_methods_push((ID)name, (long)type, (VALUE)ary, NOEX_PRIVATE);
}
static int
ins_methods_pub_i(st_data_t name, st_data_t type, st_data_t ary)
{
- return ins_methods_push((ID)name, (rb_method_visibility_t)type, (VALUE)ary, METHOD_VISI_PUBLIC);
+ return ins_methods_push((ID)name, (long)type, (VALUE)ary, NOEX_PUBLIC);
}
-struct method_entry_arg {
- st_table *list;
- int recur;
-};
-
-static enum rb_id_table_iterator_result
-method_entry_i(ID key, VALUE value, void *data)
+static int
+method_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
const rb_method_entry_t *me = (const rb_method_entry_t *)value;
- struct method_entry_arg *arg = (struct method_entry_arg *)data;
- rb_method_visibility_t type;
+ st_table *list = (st_table *)data;
+ long type;
- if (me->def->type == VM_METHOD_TYPE_REFINED) {
- VALUE owner = me->owner;
- me = rb_resolve_refined_method(Qnil, me);
- if (!me) return ID_TABLE_CONTINUE;
- if (!arg->recur && me->owner != owner) return ID_TABLE_CONTINUE;
+ if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
+ me = rb_resolve_refined_method(Qnil, me, NULL);
+ if (!me) return ST_CONTINUE;
}
- if (!st_lookup(arg->list, key, 0)) {
+ if (!st_lookup(list, key, 0)) {
if (UNDEFINED_METHOD_ENTRY_P(me)) {
- type = METHOD_VISI_UNDEF; /* none */
+ type = -1; /* none */
}
else {
- type = METHOD_ENTRY_VISI(me);
+ type = VISI(me->flag);
}
- st_add_direct(arg->list, key, (st_data_t)type);
+ st_add_direct(list, key, type);
}
- return ID_TABLE_CONTINUE;
+ return ST_CONTINUE;
}
static VALUE
-class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int (*func) (st_data_t, st_data_t, st_data_t))
+class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func) (st_data_t, st_data_t, st_data_t))
{
VALUE ary;
int recur, prepended = 0;
- struct method_entry_arg me_arg;
+ st_table *list;
if (argc == 0) {
recur = TRUE;
@@ -1183,17 +1157,16 @@ class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int
prepended = 1;
}
- me_arg.list = st_init_numtable();
- me_arg.recur = recur;
+ list = st_init_numtable();
for (; mod; mod = RCLASS_SUPER(mod)) {
- if (RCLASS_M_TBL(mod)) rb_id_table_foreach(RCLASS_M_TBL(mod), method_entry_i, &me_arg);
+ if (RCLASS_M_TBL(mod)) st_foreach(RCLASS_M_TBL(mod), method_entry_i, (st_data_t)list);
if (BUILTIN_TYPE(mod) == T_ICLASS && !prepended) continue;
if (obj && FL_TEST(mod, FL_SINGLETON)) continue;
if (!recur) break;
}
ary = rb_ary_new();
- st_foreach(me_arg.list, func, ary);
- st_free_table(me_arg.list);
+ st_foreach(list, func, ary);
+ st_free_table(list);
return ary;
}
@@ -1204,29 +1177,29 @@ class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int
*
* Returns an array containing the names of the public and protected instance
* methods in the receiver. For a module, these are the public and protected methods;
- * for a class, they are the instance (not singleton) methods. If the optional
- * parameter is <code>false</code>, the methods of any ancestors are not included.
+ * for a class, they are the instance (not singleton) methods. With no
+ * argument, or with an argument that is <code>false</code>, the
+ * instance methods in <i>mod</i> are returned, otherwise the methods
+ * in <i>mod</i> and <i>mod</i>'s superclasses are returned.
*
* module A
* def method1() end
* end
* class B
- * include A
* def method2() end
* end
* class C < B
* def method3() end
* end
*
- * A.instance_methods(false) #=> [:method1]
- * B.instance_methods(false) #=> [:method2]
- * B.instance_methods(true).include?(:method1) #=> true
- * C.instance_methods(false) #=> [:method3]
- * C.instance_methods.include?(:method2) #=> true
+ * A.instance_methods #=> [:method1]
+ * B.instance_methods(false) #=> [:method2]
+ * C.instance_methods(false) #=> [:method3]
+ * C.instance_methods(true).length #=> 43
*/
VALUE
-rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod)
+rb_class_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_i);
}
@@ -1236,12 +1209,12 @@ rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod)
* mod.protected_instance_methods(include_super=true) -> array
*
* Returns a list of the protected instance methods defined in
- * <i>mod</i>. If the optional parameter is <code>false</code>, the
- * methods of any ancestors are not included.
+ * <i>mod</i>. If the optional parameter is not <code>false</code>, the
+ * methods of any ancestors are included.
*/
VALUE
-rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
+rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_prot_i);
}
@@ -1251,8 +1224,8 @@ rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
* mod.private_instance_methods(include_super=true) -> array
*
* Returns a list of the private instance methods defined in
- * <i>mod</i>. If the optional parameter is <code>false</code>, the
- * methods of any ancestors are not included.
+ * <i>mod</i>. If the optional parameter is not <code>false</code>, the
+ * methods of any ancestors are included.
*
* module Mod
* def method1() end
@@ -1264,7 +1237,7 @@ rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
*/
VALUE
-rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod)
+rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_priv_i);
}
@@ -1274,12 +1247,12 @@ rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod)
* mod.public_instance_methods(include_super=true) -> array
*
* Returns a list of the public instance methods defined in <i>mod</i>.
- * If the optional parameter is <code>false</code>, the methods of
- * any ancestors are not included.
+ * If the optional parameter is not <code>false</code>, the methods of
+ * any ancestors are included.
*/
VALUE
-rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
+rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_pub_i);
}
@@ -1291,8 +1264,8 @@ rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
* Returns a list of the names of public and protected methods of
* <i>obj</i>. This will include all the methods accessible in
* <i>obj</i>'s ancestors.
- * If the optional parameter is <code>false</code>, it
- * returns an array of <i>obj<i>'s public and protected singleton methods,
+ * If the <i>regular</i> parameter is set to <code>false</code>,
+ * Returns an array of obj's public and protected singleton methods,
* the array will not include methods in modules included in <i>obj</i>.
*
* class Klass
@@ -1303,7 +1276,7 @@ rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
* k.methods[0..9] #=> [:klass_method, :nil?, :===,
* # :==~, :!, :eql?
* # :hash, :<=>, :class, :singleton_class]
- * k.methods.length #=> 56
+ * k.methods.length #=> 57
*
* k.methods(false) #=> []
* def k.singleton_method; end
@@ -1315,13 +1288,22 @@ rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
*/
VALUE
-rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
+rb_obj_methods(int argc, VALUE *argv, VALUE obj)
{
- rb_check_arity(argc, 0, 1);
- if (argc > 0 && !RTEST(argv[0])) {
+ retry:
+ if (argc == 0) {
+ return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_i);
+ }
+ else {
+ VALUE recur;
+
+ rb_scan_args(argc, argv, "1", &recur);
+ if (RTEST(recur)) {
+ argc = 0;
+ goto retry;
+ }
return rb_obj_singleton_methods(argc, argv, obj);
}
- return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_i);
}
/*
@@ -1334,7 +1316,7 @@ rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
+rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_prot_i);
}
@@ -1349,7 +1331,7 @@ rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
+rb_obj_private_methods(int argc, VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_priv_i);
}
@@ -1364,7 +1346,7 @@ rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
+rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_pub_i);
}
@@ -1403,11 +1385,10 @@ rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
+rb_obj_singleton_methods(int argc, VALUE *argv, VALUE obj)
{
VALUE recur, ary, klass, origin;
- struct method_entry_arg me_arg;
- struct rb_id_table *mtbl;
+ st_table *list, *mtbl;
if (argc == 0) {
recur = Qtrue;
@@ -1417,21 +1398,22 @@ rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
}
klass = CLASS_OF(obj);
origin = RCLASS_ORIGIN(klass);
- me_arg.list = st_init_numtable();
- me_arg.recur = RTEST(recur);
+ list = st_init_numtable();
if (klass && FL_TEST(klass, FL_SINGLETON)) {
- if ((mtbl = RCLASS_M_TBL(origin)) != 0) rb_id_table_foreach(mtbl, method_entry_i, &me_arg);
+ if ((mtbl = RCLASS_M_TBL(origin)) != 0)
+ st_foreach(mtbl, method_entry_i, (st_data_t)list);
klass = RCLASS_SUPER(klass);
}
if (RTEST(recur)) {
while (klass && (FL_TEST(klass, FL_SINGLETON) || RB_TYPE_P(klass, T_ICLASS))) {
- if (klass != origin && (mtbl = RCLASS_M_TBL(klass)) != 0) rb_id_table_foreach(mtbl, method_entry_i, &me_arg);
+ if (klass != origin && (mtbl = RCLASS_M_TBL(klass)) != 0)
+ st_foreach(mtbl, method_entry_i, (st_data_t)list);
klass = RCLASS_SUPER(klass);
}
}
ary = rb_ary_new();
- st_foreach(me_arg.list, ins_methods_i, ary);
- st_free_table(me_arg.list);
+ st_foreach(list, ins_methods_i, ary);
+ st_free_table(list);
return ary;
}
@@ -1496,31 +1478,31 @@ rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
void
rb_define_method_id(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc)
{
- rb_add_method_cfunc(klass, mid, func, argc, METHOD_VISI_PUBLIC);
+ rb_add_method_cfunc(klass, mid, func, argc, NOEX_PUBLIC);
}
void
rb_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc)
{
- rb_add_method_cfunc(klass, rb_intern(name), func, argc, METHOD_VISI_PUBLIC);
+ rb_add_method_cfunc(klass, rb_intern(name), func, argc, NOEX_PUBLIC);
}
void
rb_define_protected_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc)
{
- rb_add_method_cfunc(klass, rb_intern(name), func, argc, METHOD_VISI_PROTECTED);
+ rb_add_method_cfunc(klass, rb_intern(name), func, argc, NOEX_PROTECTED);
}
void
rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc)
{
- rb_add_method_cfunc(klass, rb_intern(name), func, argc, METHOD_VISI_PRIVATE);
+ rb_add_method_cfunc(klass, rb_intern(name), func, argc, NOEX_PRIVATE);
}
void
rb_undef_method(VALUE klass, const char *name)
{
- rb_add_method(klass, rb_intern(name), VM_METHOD_TYPE_UNDEF, 0, METHOD_VISI_UNDEF);
+ rb_add_method(klass, rb_intern(name), VM_METHOD_TYPE_UNDEF, 0, NOEX_UNDEF);
}
/*!
@@ -1566,8 +1548,7 @@ singleton_class_of(VALUE obj)
{
VALUE klass;
- if (FIXNUM_P(obj) || FLONUM_P(obj) || STATIC_SYM_P(obj)) {
- no_singleton:
+ if (FIXNUM_P(obj) || FLONUM_P(obj) || SYMBOL_P(obj)) {
rb_raise(rb_eTypeError, "can't define singleton");
}
if (SPECIAL_CONST_P(obj)) {
@@ -1577,19 +1558,18 @@ singleton_class_of(VALUE obj)
return klass;
}
else {
- switch (BUILTIN_TYPE(obj)) {
- case T_FLOAT: case T_BIGNUM: case T_SYMBOL:
- goto no_singleton;
- case T_STRING:
- if (FL_TEST_RAW(obj, RSTRING_FSTR)) goto no_singleton;
- break;
+ enum ruby_value_type type = BUILTIN_TYPE(obj);
+ if (type == T_FLOAT || type == T_BIGNUM) {
+ rb_raise(rb_eTypeError, "can't define singleton");
}
}
- klass = RBASIC(obj)->klass;
- if (!(FL_TEST(klass, FL_SINGLETON) &&
- rb_ivar_get(klass, id_attached) == obj)) {
- klass = rb_make_metaclass(obj, klass);
+ if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
+ rb_ivar_get(RBASIC(obj)->klass, id_attached) == obj) {
+ klass = RBASIC(obj)->klass;
+ }
+ else {
+ klass = rb_make_metaclass(obj, RBASIC(obj)->klass);
}
if (OBJ_TAINTED(obj)) {
@@ -1598,24 +1578,11 @@ singleton_class_of(VALUE obj)
else {
FL_UNSET(klass, FL_TAINT);
}
- if (OBJ_FROZEN(obj)) OBJ_FREEZE_RAW(klass);
+ if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass);
return klass;
}
-void
-rb_freeze_singleton_class(VALUE x)
-{
- /* should not propagate to meta-meta-class, and so on */
- if (!(RBASIC(x)->flags & FL_SINGLETON)) {
- VALUE klass = RBASIC_CLASS(x);
- if (klass && (klass = RCLASS_ORIGIN(klass)) != 0 &&
- FL_TEST(klass, (FL_SINGLETON|FL_FREEZE)) == FL_SINGLETON) {
- OBJ_FREEZE_RAW(klass);
- }
- }
-}
-
/*!
* Returns the singleton class of \a obj, or nil if obj is not a
* singleton object.
@@ -1745,7 +1712,7 @@ rb_define_attr(VALUE klass, const char *name, int read, int write)
int
rb_obj_basic_to_s_p(VALUE obj)
{
- const rb_method_entry_t *me = rb_method_entry(CLASS_OF(obj), rb_intern("to_s"));
+ const rb_method_entry_t *me = rb_method_entry(CLASS_OF(obj), rb_intern("to_s"), 0);
if (me && me->def && me->def->type == VM_METHOD_TYPE_CFUNC &&
me->def->body.cfunc.func == rb_any_to_s)
return 1;
@@ -1819,11 +1786,8 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
}
else {
hash = rb_check_hash_type(last);
- if (!NIL_P(hash)) {
- VALUE opts = rb_extract_keywords(&hash);
- if (!hash) argc--;
- hash = opts ? opts : Qnil;
- }
+ if (!NIL_P(hash))
+ argc--;
}
}
/* capture leading mandatory arguments */
@@ -1887,143 +1851,6 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
return argc;
}
-VALUE
-rb_keyword_error_new(const char *error, VALUE keys)
-{
- const char *msg = "";
- VALUE error_message;
-
- if (RARRAY_LEN(keys) == 1) {
- keys = RARRAY_AREF(keys, 0);
- }
- else {
- keys = rb_ary_join(keys, rb_usascii_str_new2(", "));
- msg = "s";
- }
-
- error_message = rb_sprintf("%s keyword%s: %"PRIsVALUE, error, msg, keys);
-
- return rb_exc_new_str(rb_eArgError, error_message);
-}
-
-NORETURN(static void rb_keyword_error(const char *error, VALUE keys));
-static void
-rb_keyword_error(const char *error, VALUE keys)
-{
- rb_exc_raise(rb_keyword_error_new(error, keys));
-}
-
-NORETURN(static void unknown_keyword_error(VALUE hash, const ID *table, int keywords));
-static void
-unknown_keyword_error(VALUE hash, const ID *table, int keywords)
-{
- st_table *tbl = rb_hash_tbl_raw(hash);
- VALUE keys;
- int i;
- for (i = 0; i < keywords; i++) {
- st_data_t key = ID2SYM(table[i]);
- st_delete(tbl, &key, NULL);
- }
- keys = rb_funcallv(hash, rb_intern("keys"), 0, 0);
- if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword");
- rb_keyword_error("unknown", keys);
-}
-
-static int
-separate_symbol(st_data_t key, st_data_t value, st_data_t arg)
-{
- VALUE *kwdhash = (VALUE *)arg;
-
- if (!SYMBOL_P(key)) kwdhash++;
- if (!*kwdhash) *kwdhash = rb_hash_new();
- rb_hash_aset(*kwdhash, (VALUE)key, (VALUE)value);
- return ST_CONTINUE;
-}
-
-VALUE
-rb_extract_keywords(VALUE *orighash)
-{
- VALUE parthash[2] = {0, 0};
- VALUE hash = *orighash;
-
- if (RHASH_EMPTY_P(hash)) {
- *orighash = 0;
- return hash;
- }
- st_foreach(rb_hash_tbl_raw(hash), separate_symbol, (st_data_t)&parthash);
- *orighash = parthash[1];
- if (parthash[1] && RBASIC_CLASS(hash) != rb_cHash) {
- RBASIC_SET_CLASS(parthash[1], RBASIC_CLASS(hash));
- }
- return parthash[0];
-}
-
-int
-rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
-{
- int i = 0, j;
- int rest = 0;
- VALUE missing = Qnil;
- st_data_t key;
-
-#define extract_kwarg(keyword, val) \
- (key = (st_data_t)(keyword), values ? \
- st_delete(rb_hash_tbl_raw(keyword_hash), &key, (val)) : \
- st_lookup(rb_hash_tbl_raw(keyword_hash), key, (val)))
-
- if (NIL_P(keyword_hash)) keyword_hash = 0;
-
- if (optional < 0) {
- rest = 1;
- optional = -1-optional;
- }
- if (values) {
- for (j = 0; j < required + optional; j++) {
- values[j] = Qundef;
- }
- }
- if (required) {
- for (; i < required; i++) {
- VALUE keyword = ID2SYM(table[i]);
- if (keyword_hash) {
- st_data_t val;
- if (extract_kwarg(keyword, &val)) {
- if (values) values[i] = (VALUE)val;
- continue;
- }
- }
- if (NIL_P(missing)) missing = rb_ary_tmp_new(1);
- rb_ary_push(missing, keyword);
- }
- if (!NIL_P(missing)) {
- rb_keyword_error("missing", missing);
- }
- }
- j = i;
- if (optional && keyword_hash) {
- for (i = 0; i < optional; i++) {
- st_data_t val;
- if (extract_kwarg(ID2SYM(table[required+i]), &val)) {
- if (values) values[required+i] = (VALUE)val;
- j++;
- }
- }
- }
- if (!rest && keyword_hash) {
- if (RHASH_SIZE(keyword_hash) > (unsigned int)(values ? 0 : j)) {
- unknown_keyword_error(keyword_hash, table, required+optional);
- }
- }
- return j;
-#undef extract_kwarg
-}
-
-int
-rb_class_has_methods(VALUE c)
-{
- return rb_id_table_size(RCLASS_M_TBL(c)) == 0 ? FALSE : TRUE;
-}
-
/*!
* \}
*/
diff --git a/common.mk b/common.mk
index da4608bc61..e94c4756ea 100644
--- a/common.mk
+++ b/common.mk
@@ -8,47 +8,32 @@ dll: $(LIBRUBY_SO)
V = 0
Q1 = $(V:1=)
Q = $(Q1:0=@)
-ECHO0 = $(ECHO1:0=echo)
-ECHO = @$(ECHO0)
-
-UNICODE_VERSION = 8.0.0
+ECHO = $(ECHO1:0=@echo)
RUBYLIB = $(PATH_SEPARATOR)
RUBYOPT = -
RUN_OPTS = --disable-gems
-GEM_HOME =
-GEM_PATH =
-GEM_VENDOR =
-
-SPEC_GIT_BASE = git://github.com/ruby
+SPEC_GIT_BASE = git://github.com/nurse
MSPEC_GIT_URL = $(SPEC_GIT_BASE)/mspec.git
RUBYSPEC_GIT_URL = $(SPEC_GIT_BASE)/rubyspec.git
-SIMPLECOV_GIT_URL = git://github.com/colszowka/simplecov.git
-SIMPLECOV_GIT_REF = v0.10.0
-SIMPLECOV_HTML_GIT_URL = git://github.com/colszowka/simplecov-html.git
-SIMPLECOV_HTML_GIT_REF = v0.10.0
-DOCLIE_GIT_URL = git://github.com/ms-ati/docile.git
-DOCLIE_GIT_REF = v1.1.5
-
STATIC_RUBY = static-ruby
EXTCONF = extconf.rb
LIBRUBY_EXTS = ./.libruby-with-ext.time
REVISION_H = ./.revision.time
PLATFORM_D = ./$(PLATFORM_DIR)/.time
-ENC_TRANS_D = ./enc/trans/.time
RDOCOUT = $(EXTOUT)/rdoc
-HTMLOUT = $(EXTOUT)/html
CAPIOUT = doc/capi
-INITOBJS = dmyext.$(OBJEXT) dmyenc.$(OBJEXT)
+DMYEXT = dmyext.$(OBJEXT)
NORMALMAINOBJ = main.$(OBJEXT)
MAINOBJ = $(NORMALMAINOBJ)
-DLDOBJS = $(INITOBJS)
+EXTOBJS =
+DLDOBJS = $(DMYEXT)
EXTSOLIBS =
-MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT) dmyext.$(OBJEXT) miniprelude.$(OBJEXT)
+MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT) miniprelude.$(OBJEXT)
ENC_MK = enc.mk
COMMONOBJS = array.$(OBJEXT) \
@@ -96,7 +81,6 @@ COMMONOBJS = array.$(OBJEXT) \
strftime.$(OBJEXT) \
string.$(OBJEXT) \
struct.$(OBJEXT) \
- symbol.$(OBJEXT) \
time.$(OBJEXT) \
transcode.$(OBJEXT) \
util.$(OBJEXT) \
@@ -111,7 +95,6 @@ COMMONOBJS = array.$(OBJEXT) \
vm_trace.$(OBJEXT) \
thread.$(OBJEXT) \
cont.$(OBJEXT) \
- $(DTRACE_OBJ) \
$(BUILTIN_ENCOBJS) \
$(BUILTIN_TRANSOBJS) \
$(MISSING)
@@ -122,24 +105,21 @@ EXPORTOBJS = $(DLNOBJ) \
$(COMMONOBJS)
OBJS = $(EXPORTOBJS) prelude.$(OBJEXT)
-ALLOBJS = $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(INITOBJS)
+ALLOBJS = $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT)
GOLFOBJS = goruby.$(OBJEXT) golf_prelude.$(OBJEXT)
-DEFAULT_PRELUDES = $(GEM_PRELUDE)
PRELUDE_SCRIPTS = $(srcdir)/prelude.rb $(srcdir)/enc/prelude.rb $(DEFAULT_PRELUDES)
-GEM_PRELUDE = $(srcdir)/gem_prelude.rb
-PRELUDES = {$(srcdir)}prelude.c {$(srcdir)}miniprelude.c
-GOLFPRELUDES = {$(srcdir)}golf_prelude.c
+GEM_PRELUDE = $(srcdir)/gem_prelude.rb
+PRELUDES = prelude.c miniprelude.c
+GOLFPRELUDES = golf_prelude.c
SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
--extout="$(EXTOUT)" \
--mflags="$(MFLAGS)" \
--make-flags="$(MAKEFLAGS)"
EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) \
- --make-flags="V=$(V) MINIRUBY='$(MINIRUBY)'" \
- --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
- --
+ --make-flags="V=$(V) MINIRUBY='$(MINIRUBY)'" --
INSTRUBY = $(SUDO) $(RUNRUBY) -r./$(arch)-fake $(srcdir)/tool/rbinstall.rb
INSTRUBY_ARGS = $(SCRIPT_ARGS) \
--data-mode=$(INSTALL_DATA_MODE) \
@@ -153,24 +133,21 @@ PRE_LIBRUBY_UPDATE = $(MINIRUBY) -e 'ARGV[1] or File.unlink(ARGV[0]) rescue nil'
$(LIBRUBY_EXTS) $(LIBRUBY_SO_UPDATE)
TESTSDIR = $(srcdir)/test
-TEST_EXCLUDES = --excludes-dir=$(TESTSDIR)/excludes --name=!/memory_leak/
-EXCLUDE_TESTFRAMEWORK = --exclude=/testunit/ --exclude=/minitest/
TESTWORKDIR = testwork
-TESTOPTS = $(RUBY_TESTOPTS)
TESTRUN_SCRIPT = $(srcdir)/test.rb
-COMPILE_PRELUDE = $(srcdir)/tool/generic_erb.rb $(srcdir)/template/prelude.c.tmpl
+BOOTSTRAPRUBY = $(BASERUBY)
-SHOWFLAGS = showflags
+COMPILE_PRELUDE = $(MINIRUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb
-all: $(SHOWFLAGS) main docs
+all: showflags main docs
-main: $(SHOWFLAGS) exts $(ENCSTATIC:static=lib)encs
+main: showflags $(EXTSTATIC:static=lib)encs exts
@$(NULLCMD)
.PHONY: showflags
-exts enc trans: $(SHOWFLAGS)
+exts enc trans: showflags
showflags:
$(MESSAGE_BEGIN) \
" CC = $(CC)" \
@@ -200,14 +177,16 @@ $(EXTS_MK): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY)
configure-ext: $(EXTS_MK)
build-ext: $(EXTS_MK)
- $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) libdir="$(libdir)" LIBRUBY_EXTS=$(LIBRUBY_EXTS) \
- EXTENCS="$(ENCOBJS)" UPDATE_LIBRARIES=no $(EXTSTATIC)
+ $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) $(EXTSTATIC) LIBRUBY_EXTS=$(LIBRUBY_EXTS) ENCOBJS="$(ENCOBJS)"
+
+$(MKMAIN_CMD): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY)
+ $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$@ $(EXTMK_ARGS)
prog: program wprogram
$(PREP): $(MKFILES)
-miniruby$(EXEEXT): config.status $(ALLOBJS) $(ARCHFILE)
+miniruby$(EXEEXT): config.status $(ALLOBJS) $(ARCHFILE) $(DTRACE_OBJ)
objs: $(ALLOBJS)
@@ -219,7 +198,7 @@ capi: $(CAPIOUT)/.timestamp PHONY
$(CAPIOUT)/.timestamp: Doxyfile $(PREP)
$(Q) $(MAKEDIRS) "$(@D)"
$(ECHO) generating capi
- -$(Q) $(DOXYGEN) -b
+ $(Q) $(DOXYGEN) -b
$(Q) $(MINIRUBY) -e 'File.open(ARGV[0], "w"){|f| f.puts(Time.now)}' "$@"
Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb $(RBCONFIG)
@@ -227,13 +206,13 @@ Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb
$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -o $@ $(srcdir)/template/Doxyfile.tmpl \
--srcdir="$(srcdir)" --miniruby="$(MINIRUBY)"
-program: $(SHOWFLAGS) $(PROGRAM)
-wprogram: $(SHOWFLAGS) $(WPROGRAM)
+program: showflags $(PROGRAM)
+wprogram: showflags $(WPROGRAM)
mini: PHONY miniruby$(EXEEXT)
$(PROGRAM) $(WPROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
-$(LIBRUBY_A): $(LIBRUBY_A_OBJS) $(MAINOBJ) $(INITOBJS) $(ARCHFILE)
+$(LIBRUBY_A): $(OBJS) $(MAINOBJ) $(DTRACE_OBJ) $(DTRACE_GLOMMED_OBJ) $(DMYEXT) $(ARCHFILE)
$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(LIBRUBY_SO_UPDATE) $(BUILTIN_ENCOBJS)
@@ -244,9 +223,9 @@ $(STATIC_RUBY)$(EXEEXT): $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
$(Q)$(RM) $@
$(PURIFY) $(CC) $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(XLDFLAGS)
-ruby.imp: $(COMMONOBJS)
- $(Q)$(NM) -Pgp $(COMMONOBJS) | \
- awk 'BEGIN{print "#!"}; $$2~/^[BDT]$$/&&$$1!~/^(Init_|ruby_static_id_|.*_threadptr_|\.)/{print $$1}' | \
+ruby.imp: $(EXPORTOBJS)
+ $(Q)$(NM) -Pgp $(EXPORTOBJS) | \
+ awk 'BEGIN{print "#!"}; $$2~/^[BDT]$$/&&$$1!~/^(Init_|.*_threadptr_|\.)/{print $$1}' | \
sort -u -o $@
install: install-$(INSTALLDOC)
@@ -255,80 +234,80 @@ pkgconfig-data: $(ruby_pc)
$(ruby_pc): $(srcdir)/template/ruby.pc.in config.status
install-all: docs pre-install-all do-install-all post-install-all
-pre-install-all:: all pre-install-local pre-install-ext pre-install-doc
-do-install-all: pre-install-all
+pre-install-all:: pre-install-local pre-install-ext pre-install-doc
+do-install-all: all
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=all --rdoc-output="$(RDOCOUT)"
post-install-all:: post-install-local post-install-ext post-install-doc
@$(NULLCMD)
install-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc
pre-install-nodoc:: pre-install-local pre-install-ext
-do-install-nodoc: main pre-install-nodoc
+do-install-nodoc: main
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS)
post-install-nodoc:: post-install-local post-install-ext
install-local: pre-install-local do-install-local post-install-local
pre-install-local:: pre-install-bin pre-install-lib pre-install-man
-do-install-local: $(PROGRAM) pre-install-local
+do-install-local: $(PROGRAM)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local
post-install-local:: post-install-bin post-install-lib post-install-man
install-ext: pre-install-ext do-install-ext post-install-ext
pre-install-ext:: pre-install-ext-arch pre-install-ext-comm
-do-install-ext: exts pre-install-ext
+do-install-ext: exts
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext
post-install-ext:: post-install-ext-arch post-install-ext-comm
install-arch: pre-install-arch do-install-arch post-install-arch
pre-install-arch:: pre-install-bin pre-install-ext-arch
-do-install-arch: main do-install-arch
+do-install-arch: main
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=arch
post-install-arch:: post-install-bin post-install-ext-arch
install-comm: pre-install-comm do-install-comm post-install-comm
pre-install-comm:: pre-install-lib pre-install-ext-comm pre-install-man
-do-install-comm: $(PREP) pre-install-comm
+do-install-comm: $(PREP)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
post-install-comm:: post-install-lib post-install-ext-comm post-install-man
install-bin: pre-install-bin do-install-bin post-install-bin
pre-install-bin:: install-prereq
-do-install-bin: $(PROGRAM) pre-install-bin
+do-install-bin: $(PROGRAM)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin
post-install-bin::
@$(NULLCMD)
install-lib: pre-install-lib do-install-lib post-install-lib
pre-install-lib:: install-prereq
-do-install-lib: $(PREP) pre-install-lib
+do-install-lib: $(PREP)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib
post-install-lib::
@$(NULLCMD)
install-ext-comm: pre-install-ext-comm do-install-ext-comm post-install-ext-comm
pre-install-ext-comm:: install-prereq
-do-install-ext-comm: exts pre-install-ext-comm
+do-install-ext-comm: exts
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm
post-install-ext-comm::
@$(NULLCMD)
install-ext-arch: pre-install-ext-arch do-install-ext-arch post-install-ext-arch
pre-install-ext-arch:: install-prereq
-do-install-ext-arch: exts pre-install-ext-arch
+do-install-ext-arch: exts
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch
post-install-ext-arch::
@$(NULLCMD)
install-man: pre-install-man do-install-man post-install-man
pre-install-man:: install-prereq
-do-install-man: $(PREP) pre-install-man
+do-install-man: $(PREP)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man
post-install-man::
@$(NULLCMD)
install-capi: capi pre-install-capi do-install-capi post-install-capi
pre-install-capi:: install-prereq
-do-install-capi: $(PREP) pre-install-capi
+do-install-capi: $(PREP)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=capi
post-install-capi::
@$(NULLCMD)
@@ -343,10 +322,10 @@ dont-install-all: $(PROGRAM)
post-no-install-all:: post-no-install-local post-no-install-ext post-no-install-doc
@$(NULLCMD)
-uninstall: $(INSTALLED_LIST) sudo-precheck
+uninstall: $(INSTALLED_LIST)
$(Q)$(SUDO) $(MINIRUBY) $(srcdir)/tool/rbuninstall.rb --destdir=$(DESTDIR) $(INSTALLED_LIST)
-reinstall: all uninstall install
+reinstall: uninstall install
what-where-nodoc: no-install-nodoc
no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
@@ -425,14 +404,14 @@ post-no-install-man::
install-doc: rdoc pre-install-doc do-install-doc post-install-doc
pre-install-doc:: install-prereq
-do-install-doc: $(PROGRAM) pre-install-doc
+do-install-doc: $(PROGRAM)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
post-install-doc::
@$(NULLCMD)
install-gem: pre-install-gem do-install-gem post-install-gem
pre-install-gem:: pre-install-bin pre-install-lib pre-install-man
-do-install-gem: $(PROGRAM) pre-install-gem
+do-install-gem: $(PROGRAM)
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=gem
post-install-gem::
@$(NULLCMD)
@@ -441,10 +420,6 @@ rdoc: PHONY main
@echo Generating RDoc documentation
$(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --root "$(srcdir)" --page-dir "$(srcdir)/doc" --encoding=UTF-8 --no-force-update --all --ri --op "$(RDOCOUT)" --debug $(RDOCFLAGS) "$(srcdir)"
-html: PHONY main
- @echo Generating RDoc HTML files
- $(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --root "$(srcdir)" --page-dir "$(srcdir)/doc" --encoding=UTF-8 --no-force-update --all --op "$(HTMLOUT)" --debug $(RDOCFLAGS) "$(srcdir)"
-
rdoc-coverage: PHONY main
@echo Generating RDoc coverage report
$(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --root "$(srcdir)" --encoding=UTF-8 --all --quiet -C $(RDOCFLAGS) "$(srcdir)"
@@ -471,166 +446,108 @@ post-no-install-doc::
CLEAR_INSTALLED_LIST = clear-installed-list
-install-prereq: $(CLEAR_INSTALLED_LIST) yes-fake sudo-precheck PHONY
+install-prereq: $(CLEAR_INSTALLED_LIST) yes-fake PHONY
clear-installed-list: PHONY
@> $(INSTALLED_LIST) set MAKE="$(MAKE)"
-clean: clean-ext clean-enc clean-golf clean-rdoc clean-capi clean-extout clean-local clean-platform
-clean-local:: clean-runnable
+clean: clean-ext clean-local clean-enc clean-golf clean-rdoc clean-capi clean-extout clean-platform
+clean-local:: PHONY
$(Q)$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
- $(Q)$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) dmyenc.$(OBJEXT) $(ARCHFILE) .*.time
- $(Q)$(RM) y.tab.c y.output encdb.h transdb.h config.log rbconfig.rb $(ruby_pc) probes.h probes.$(OBJEXT) probes.stamp ruby-glommed.$(OBJEXT)
- $(Q)$(RM) GNUmakefile.old Makefile.old $(arch)-fake.rb bisect.sh $(ENC_TRANS_D)
- -$(Q) $(RMDIR) enc/jis enc/trans enc 2> $(NULL) || exit 0
-clean-runnable:: PHONY
- $(Q)$(CHDIR) bin 2>$(NULL) && $(RM) $(PROGRAM) $(WPROGRAM) $(GORUBY)$(EXEEXT) bin/*.$(DLEXT) 2>$(NULL) || exit 0
- $(Q)$(CHDIR) lib 2>$(NULL) && $(RM) $(LIBRUBY_A) $(LIBRUBY) $(LIBRUBY_ALIASES) $(RUBY_BASE_NAME)/$(RUBY_PROGRAM_VERSION) $(RUBY_BASE_NAME)/vendor_ruby 2>$(NULL) || exit 0
- $(Q)$(RMDIR) lib/$(RUBY_BASE_NAME) lib bin 2>$(NULL) || exit 0
+ $(Q)$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time
+ $(Q)$(RM) y.tab.c y.output encdb.h transdb.h prelude.c config.log rbconfig.rb $(ruby_pc) probes.h probes.$(OBJEXT) probes.stamp ruby-glommed.$(OBJEXT)
clean-ext:: PHONY
clean-golf: PHONY
$(Q)$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
clean-rdoc: PHONY
-clean-html: PHONY
clean-capi: PHONY
clean-platform: PHONY
clean-extout: PHONY
- -$(Q)$(RMDIR) $(EXTOUT)/$(arch) $(EXTOUT) 2> $(NULL) || exit 0
-clean-docs: clean-rdoc clean-html clean-capi
+clean-docs: clean-rdoc clean-capi
-distclean: distclean-ext distclean-enc distclean-golf distclean-extout distclean-local distclean-platform
+distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean-extout distclean-platform
distclean-local:: clean-local
- $(Q)$(RM) $(MKFILES) yasmdata.rb *.inc $(PRELUDES)
+ $(Q)$(RM) $(MKFILES) yasmdata.rb *.inc
$(Q)$(RM) config.cache config.status config.status.lineno
$(Q)$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP)
- -$(Q)$(RMALL) $(srcdir)/autom4te.cache
distclean-ext:: PHONY
distclean-golf: clean-golf
+ $(Q)$(RM) $(GOLFPRELUDES)
distclean-rdoc: PHONY
-distclean-html: PHONY
distclean-capi: PHONY
distclean-extout: clean-extout
distclean-platform: clean-platform
realclean:: realclean-ext realclean-local realclean-enc realclean-golf realclean-extout
realclean-local:: distclean-local
- $(Q)$(RM) parse.c parse.h lex.c enc/trans/newline.c revision.h
- $(Q)$(RM) id.c id.h probes.dmyh
- $(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) parse.c parse.h lex.c enc/trans/newline.c $(PRELUDES) revision.h
- $(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) id.c id.h probes.dmyh
- $(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) configure tool/config.guess tool/config.sub gems/*.gem
+ $(Q)$(RM) parse.c parse.h lex.c newline.c miniprelude.c revision.h
realclean-ext:: PHONY
realclean-golf: distclean-golf
- $(Q)$(RM) $(GOLFPRELUDES)
realclean-capi: PHONY
realclean-extout: distclean-extout
clean-ext distclean-ext realclean-ext::
$(Q)$(RM) $(EXTS_MK)
$(Q)$(RM) $(EXTOUT)/.timestamp/.*.time
- $(Q)$(RMDIR) $(EXTOUT)/.timestamp 2> $(NULL) || exit 0
clean-enc distclean-enc realclean-enc: PHONY
-clean-enc: clean-enc.d
-
-clean-enc.d: PHONY
- $(Q)$(RM) $(ENC_TRANS_D)
- -$(Q) $(RMDIR) enc/jis enc/trans enc 2> $(NULL) || exit 0
-
-clean-rdoc distclean-rdoc realclean-rdoc:
- @echo $(@:-rdoc=ing) rdoc
- $(Q)$(RMALL) $(RDOCOUT)
-
-clean-html distclean-html realclean-html:
- @echo $(@:-html=ing) HTML
- $(Q)$(RMALL) $(HTMLOUT)
-
-clean-capi distclean-capi realclean-capi:
- @echo $(@:-capi=ing) capi
- $(Q)$(RMALL) $(CAPIOUT)
-
-clean-platform:
- $(Q) $(RM) $(PLATFORM_D)
- -$(Q) $(RMDIR) $(PLATFORM_DIR) 2> $(NULL) || exit 0
-
-check: main test test-testframework test-almost
+check: main test test-all
$(ECHO) check succeeded
check-ruby: test test-ruby
fake: $(CROSS_COMPILING)-fake
yes-fake: $(arch)-fake.rb $(RBCONFIG) PHONY
-no-fake -fake: PHONY
-
-# really doesn't depend on .o, just ensure newer than headers which
-# version.o depends on.
-$(arch)-fake.rb: $(srcdir)/template/fake.rb.in $(srcdir)/tool/generic_erb.rb version.$(OBJEXT) miniruby$(EXEEXT)
- $(ECHO) generating $@
- $(Q) $(CPP) $(warnflags) $(XCFLAGS) $(CPPFLAGS) "$(srcdir)/version.c" | \
- $(BOOTSTRAPRUBY) "$(srcdir)/tool/generic_erb.rb" -o $@ "$(srcdir)/template/fake.rb.in" \
- i=- srcdir="$(srcdir)" BASERUBY="$(BASERUBY)"
+no-fake: PHONY
btest: $(TEST_RUNNABLE)-btest
no-btest: PHONY
yes-btest: fake miniruby$(EXEEXT) PHONY
- $(Q)$(exec) $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(BTESTRUBY) $(RUN_OPTS)" $(OPTS) $(TESTOPTS)
+ $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(BTESTRUBY) $(RUN_OPTS)" $(OPTS) $(TESTOPTS)
btest-ruby: $(TEST_RUNNABLE)-btest-ruby
no-btest-ruby: PHONY
yes-btest-ruby: prog PHONY
- $(Q)$(exec) $(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) -I$(srcdir)/lib $(RUN_OPTS)" -q $(OPTS) $(TESTOPTS)
+ $(Q)$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) -I$(srcdir)/lib $(RUN_OPTS)" -q $(OPTS) $(TESTOPTS)
test-sample: $(TEST_RUNNABLE)-test-sample
no-test-sample: PHONY
yes-test-sample: prog PHONY
- $(Q)$(exec) $(RUNRUBY) "$(srcdir)/tool/rubytest.rb" --run-opt=$(RUN_OPTS) $(OPTS) $(TESTOPTS)
+ $(Q)$(RUNRUBY) $(srcdir)/tool/rubytest.rb --run-opt=$(RUN_OPTS) $(OPTS) $(TESTOPTS)
test-knownbugs: test-knownbug
test-knownbug: $(TEST_RUNNABLE)-test-knownbug
no-test-knownbug: PHONY
yes-test-knownbug: prog PHONY
- -$(exec) $(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) $(RUN_OPTS)" $(OPTS) $(TESTOPTS) $(srcdir)/KNOWNBUGS.rb
-
-test-testframework: $(TEST_RUNNABLE)-test-testframework
-yes-test-testframework: prog PHONY
- $(Q)$(exec) $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS) testunit minitest
-no-test-testframework: PHONY
+ -$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) $(RUN_OPTS)" $(OPTS) $(TESTOPTS) $(srcdir)/KNOWNBUGS.rb
test: test-sample btest-ruby test-knownbug
-# $ make test-all TESTOPTS="--help" displays more detail
-# for example, make test-all TESTOPTS="-j2 -v -n test-name -- test-file-name"
test-all: $(TEST_RUNNABLE)-test-all
yes-test-all: prog PHONY
- $(Q)$(exec) $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) $(TESTS)
+ $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS) $(TESTS)
TESTS_BUILD = mkmf
no-test-all: PHONY
$(MINIRUBY) -I"$(srcdir)/lib" "$(srcdir)/test/runner.rb" $(TESTOPTS) $(TESTS_BUILD)
-test-almost: $(TEST_RUNNABLE)-test-almost
-yes-test-almost: prog PHONY
- $(Q)$(exec) $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) $(EXCLUDE_TESTFRAMEWORK) $(TESTS)
-no-test-almost: PHONY
-
test-ruby: $(TEST_RUNNABLE)-test-ruby
no-test-ruby: PHONY
yes-test-ruby: prog encs PHONY
- $(RUNRUBY) "$(srcdir)/test/runner.rb" $(TEST_EXCLUDES) $(TESTOPTS) -- ruby -ext-
+ $(RUNRUBY) "$(srcdir)/test/runner.rb" -q $(TESTOPTS) -- ruby -ext-
extconf: $(PREP)
$(Q) $(MAKEDIRS) "$(EXTCONFDIR)"
$(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
-$(RBCONFIG): $(srcdir)/tool/mkconfig.rb config.status $(srcdir)/version.h
- $(Q)$(BOOTSTRAPRUBY) $(srcdir)/tool/mkconfig.rb -timestamp=$@ \
- -arch=$(arch) -version=$(RUBY_PROGRAM_VERSION) \
+$(RBCONFIG): $(srcdir)/tool/mkconfig.rb config.status $(srcdir)/version.h $(PREP)
+ $(Q)$(MINIRUBY) $(srcdir)/tool/mkconfig.rb -timestamp=$@ \
-install_name=$(RUBY_INSTALL_NAME) \
-so_name=$(RUBY_SO_NAME) rbconfig.rb
test-rubyspec-precheck:
-test-rubyspec: test-rubyspec-precheck $(arch)-fake.rb
- $(RUNRUBY) -r./$(arch)-fake $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT)
+test-rubyspec: test-rubyspec-precheck
+ $(RUNRUBY) $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT)
RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable
runnable: $(RUNNABLE) prog $(srcdir)/tool/mkrunnable.rb PHONY
@@ -639,7 +556,7 @@ yes-runnable: PHONY
encs: enc trans
libencs: libenc libtrans
-encs enc trans libencs libenc libtrans: $(SHOWFLAGS) $(ENC_MK) $(LIBRUBY) $(PREP) PHONY
+encs enc trans libencs libenc libtrans: showflags $(ENC_MK) $(LIBRUBY) $(PREP)
$(ECHO) making $@
$(Q) $(MAKE) -f $(ENC_MK) V="$(V)" \
RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" \
@@ -650,16 +567,16 @@ libenc enc: {$(VPATH)}encdb.h
libtrans trans: {$(VPATH)}transdb.h
$(ENC_MK): $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \
- $(srcdir)/enc/encinit.c.erb $(srcdir)/lib/mkmf.rb $(RBCONFIG) fake
+ $(srcdir)/enc/encinit.c.erb $(srcdir)/lib/mkmf.rb $(RBCONFIG)
$(ECHO) generating $@
- $(Q) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(ENCSTATIC) $(ENCS) $@
+ $(Q) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(EXTSTATIC) $@ $(ENCS)
.PRECIOUS: $(MKFILES)
.PHONY: PHONY all fake prereq incs srcs preludes help
.PHONY: test install install-nodoc install-doc dist
.PHONY: loadpath golf capi rdoc install-prereq clear-installed-list
-.PHONY: clean clean-ext clean-local clean-enc clean-golf clean-rdoc clean-html clean-extout
+.PHONY: clean clean-ext clean-local clean-enc clean-golf clean-rdoc clean-extout
.PHONY: distclean distclean-ext distclean-local distclean-enc distclean-golf distclean-extout
.PHONY: realclean realclean-ext realclean-local realclean-enc realclean-golf realclean-extout
.PHONY: check test test-all btest btest-ruby test-sample test-knownbug
@@ -685,18 +602,16 @@ $(PLATFORM_D):
$(Q) $(MAKEDIRS) $(PLATFORM_DIR)
@exit > $@
-$(BUILTIN_ENCOBJS) $(BUILTIN_TRANSOBJS): $(ENC_TRANS_D)
-
-$(ENC_TRANS_D):
- $(Q) $(MAKEDIRS) enc/trans
- @exit > $@
-
###
-CCAN_DIR = {$(VPATH)}ccan
RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \
{$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \
{$(VPATH)}subst.h
+ENCODING_H_INCLUDES= {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
+PROBES_H_INCLUDES = {$(VPATH)}probes.h
+VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}thread_$(THREAD_MODEL).h \
+ {$(VPATH)}node.h {$(VPATH)}method.h {$(VPATH)}ruby_atomic.h \
+ {$(VPATH)}vm_debug.h {$(VPATH)}id.h {$(VPATH)}thread_native.h
###
@@ -705,13 +620,12 @@ alloca.$(OBJEXT): {$(VPATH)}alloca.c {$(VPATH)}config.h
crypt.$(OBJEXT): {$(VPATH)}crypt.c
dup2.$(OBJEXT): {$(VPATH)}dup2.c
erf.$(OBJEXT): {$(VPATH)}erf.c
-explicit_bzero.$(OBJEXT): {$(VPATH)}explicit_bzero.c
finite.$(OBJEXT): {$(VPATH)}finite.c
flock.$(OBJEXT): {$(VPATH)}flock.c
memcmp.$(OBJEXT): {$(VPATH)}memcmp.c
memmove.$(OBJEXT): {$(VPATH)}memmove.c
mkdir.$(OBJEXT): {$(VPATH)}mkdir.c
-setproctitle.$(OBJEXT): {$(VPATH)}setproctitle.c
+setproctitle.$(OBJEXT): {$(VPATH)}setproctitle.c {$(VPATH)}util.h $(RUBY_H_INCLUDES) $(hdrdir)/ruby.h
strchr.$(OBJEXT): {$(VPATH)}strchr.c
strdup.$(OBJEXT): {$(VPATH)}strdup.c
strerror.$(OBJEXT): {$(VPATH)}strerror.c
@@ -721,35 +635,230 @@ strstr.$(OBJEXT): {$(VPATH)}strstr.c
strtod.$(OBJEXT): {$(VPATH)}strtod.c
strtol.$(OBJEXT): {$(VPATH)}strtol.c
nt.$(OBJEXT): {$(VPATH)}nt.c
+os2.$(OBJEXT): {$(VPATH)}os2.c
+dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
ia64.$(OBJEXT): {$(VPATH)}ia64.s
$(CC) $(CFLAGS) -c $<
###
-# dependencies for generated C sources.
-parse.$(OBJEXT): {$(VPATH)}parse.c
-miniprelude.$(OBJEXT): {$(VPATH)}miniprelude.c
-prelude.$(OBJEXT): {$(VPATH)}prelude.c
-
-# dependencies for optional sources.
-compile.$(OBJEXT): {$(VPATH)}opt_sc.inc {$(VPATH)}optunifs.inc
-
-win32/win32.$(OBJEXT): {$(VPATH)}win32/win32.c {$(VPATH)}win32/file.h \
- {$(VPATH)}dln.h {$(VPATH)}dln_find.c {$(VPATH)}encindex.h \
- {$(VPATH)}internal.h {$(VPATH)}util.h $(RUBY_H_INCLUDES) $(PLATFORM_D)
-win32/file.$(OBJEXT): {$(VPATH)}win32/file.c {$(VPATH)}win32/file.h \
- $(RUBY_H_INCLUDES) $(PLATFORM_D)
+addr2line.$(OBJEXT): {$(VPATH)}addr2line.c {$(VPATH)}addr2line.h {$(VPATH)}config.h
+array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}vm_opts.h
+bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ {$(VPATH)}thread.h {$(VPATH)}internal.h
+class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}constant.h {$(VPATH)}vm_opts.h
+compar.$(OBJEXT): {$(VPATH)}compar.c $(RUBY_H_INCLUDES)
+complex.$(OBJEXT): {$(VPATH)}complex.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}internal.h $(hdrdir)/ruby.h
+dir.$(OBJEXT): {$(VPATH)}dir.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h
+dln.$(OBJEXT): {$(VPATH)}dln.c {$(VPATH)}dln.h $(RUBY_H_INCLUDES)
+dln_find.$(OBJEXT): {$(VPATH)}dln_find.c {$(VPATH)}dln.h $(RUBY_H_INCLUDES)
+dmydln.$(OBJEXT): {$(VPATH)}dmydln.c $(RUBY_H_INCLUDES)
+dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
+encoding.$(OBJEXT): {$(VPATH)}encoding.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}regenc.h {$(VPATH)}util.h \
+ {$(VPATH)}internal.h
+enum.$(OBJEXT): {$(VPATH)}enum.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
+ {$(VPATH)}util.h {$(VPATH)}id.h {$(VPATH)}internal.h
+enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}node.h
+error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}known_errors.inc \
+ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}eval_intern.h {$(VPATH)}vm.h \
+ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_error.c \
+ {$(VPATH)}eval_jump.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}probes_helper.h
+load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \
+ {$(VPATH)}util.h $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}dln.h {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
+file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}dln.h \
+ {$(VPATH)}internal.h
+gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
+ {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
+ {$(VPATH)}internal.h {$(VPATH)}constant.h \
+ {$(VPATH)}thread.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}debug.h
+hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
+inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}internal.h
+io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
+ {$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}dln.h \
+ {$(VPATH)}internal.h {$(VPATH)}thread.h {$(VPATH)}id.h {$(VPATH)}ruby_atomic.h
+main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h {$(VPATH)}vm_debug.h {$(VPATH)}vm_opts.h $(hdrdir)/ruby.h
+marshal.$(OBJEXT): {$(VPATH)}marshal.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}internal.h
+math.$(OBJEXT): {$(VPATH)}math.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}internal.h
+node.$(OBJEXT): {$(VPATH)}node.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}internal.h
+numeric.$(OBJEXT): {$(VPATH)}numeric.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}id.h
+object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ {$(VPATH)}internal.h {$(VPATH)}constant.h $(ENCODING_H_INCLUDES) $(PROBES_H_INCLUDES) \
+ {$(VPATH)}vm_opts.h {$(VPATH)}id.h
+pack.$(OBJEXT): {$(VPATH)}pack.c $(RUBY_H_INCLUDES) {$(VPATH)}encoding.h \
+ {$(VPATH)}oniguruma.h {$(VPATH)}internal.h
+parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}regenc.h \
+ {$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c \
+ {$(VPATH)}defs/keywords {$(VPATH)}id.c {$(VPATH)}parse.y \
+ {$(VPATH)}parse.h {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
+proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \
+ $(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}iseq.h {$(VPATH)}vm_opts.h
+process.$(OBJEXT): {$(VPATH)}process.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}util.h {$(VPATH)}io.h $(ENCODING_H_INCLUDES) {$(VPATH)}dln.h \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}internal.h \
+ {$(VPATH)}thread.h {$(VPATH)}vm_opts.h
+random.$(OBJEXT): {$(VPATH)}random.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}siphash.c {$(VPATH)}siphash.h {$(VPATH)}internal.h
+range.$(OBJEXT): {$(VPATH)}range.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}id.h
+rational.$(OBJEXT): {$(VPATH)}rational.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h $(hdrdir)/ruby.h
+re.$(OBJEXT): {$(VPATH)}re.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
+ {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}util.h \
+ {$(VPATH)}regint.h {$(VPATH)}regenc.h {$(VPATH)}internal.h
+regcomp.$(OBJEXT): {$(VPATH)}regcomp.c {$(VPATH)}regparse.h \
+ {$(VPATH)}regint.h {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h \
+ $(RUBY_H_INCLUDES)
+regenc.$(OBJEXT): {$(VPATH)}regenc.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h $(RUBY_H_INCLUDES)
+regerror.$(OBJEXT): {$(VPATH)}regerror.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h $(RUBY_H_INCLUDES)
+regexec.$(OBJEXT): {$(VPATH)}regexec.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h $(RUBY_H_INCLUDES)
+regparse.$(OBJEXT): {$(VPATH)}regparse.c {$(VPATH)}regparse.h \
+ {$(VPATH)}regint.h {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h \
+ $(RUBY_H_INCLUDES)
+regsyntax.$(OBJEXT): {$(VPATH)}regsyntax.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h $(RUBY_H_INCLUDES)
+ruby.$(OBJEXT): {$(VPATH)}ruby.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}eval_intern.h $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}dln.h {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+safe.$(OBJEXT): {$(VPATH)}safe.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}internal.h
+signal.$(OBJEXT): {$(VPATH)}signal.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}internal.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
+sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
+ {$(VPATH)}regex.h {$(VPATH)}vsnprintf.c $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
+st.$(OBJEXT): {$(VPATH)}st.c $(RUBY_H_INCLUDES)
+strftime.$(OBJEXT): {$(VPATH)}strftime.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}timev.h $(ENCODING_H_INCLUDES)
+string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
+ {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}node.h {$(VPATH)}ruby_atomic.h {$(VPATH)}vm_core.h {$(VPATH)}vm_debug.h {$(VPATH)}id.h {$(VPATH)}method.h {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}thread_native.h
+struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
+thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
+ $(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}thread_$(THREAD_MODEL).c $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}io.h {$(VPATH)}thread.h {$(VPATH)}timev.h {$(VPATH)}vm_opts.h
+transcode.$(OBJEXT): {$(VPATH)}transcode.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}transcode_data.h {$(VPATH)}internal.h
+cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}gc.h {$(VPATH)}eval_intern.h \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+time.$(OBJEXT): {$(VPATH)}time.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}timev.h {$(VPATH)}internal.h
+util.$(OBJEXT): {$(VPATH)}util.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ {$(VPATH)}internal.h
+variable.$(OBJEXT): {$(VPATH)}variable.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}node.h {$(VPATH)}util.h {$(VPATH)}encoding.h {$(VPATH)}id.h \
+ {$(VPATH)}oniguruma.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) \
+ $(srcdir)/include/ruby/version.h $(srcdir)/version.h $(srcdir)/revision.h {$(VPATH)}config.h
+loadpath.$(OBJEXT): {$(VPATH)}loadpath.c $(RUBY_H_INCLUDES) \
+ $(srcdir)/include/ruby/version.h $(srcdir)/version.h {$(VPATH)}config.h \
+ verconf.h
+localeinit.$(OBJEXT): {$(VPATH)}localeinit.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
+miniinit.$(OBJEXT): {$(VPATH)}miniinit.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES)
+
+compile.$(OBJEXT): {$(VPATH)}compile.c {$(VPATH)}iseq.h \
+ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}insns.inc \
+ {$(VPATH)}insns_info.inc {$(VPATH)}optinsn.inc \
+ {$(VPATH)}optunifs.inc {$(VPATH)}opt_sc.inc {$(VPATH)}insns.inc \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+iseq.$(OBJEXT): {$(VPATH)}iseq.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
+ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}insns.inc \
+ {$(VPATH)}insns_info.inc {$(VPATH)}node_name.inc {$(VPATH)}internal.h {$(VPATH)}vm_opts.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
+vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
+ {$(VPATH)}eval_intern.h $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}vm_method.c {$(VPATH)}vm_eval.c \
+ {$(VPATH)}vm_insnhelper.c {$(VPATH)}vm_insnhelper.h {$(VPATH)}vm_exec.c \
+ {$(VPATH)}vm_exec.h {$(VPATH)}insns.def {$(VPATH)}vmtc.inc \
+ {$(VPATH)}vm.inc {$(VPATH)}insns.inc \
+ {$(VPATH)}internal.h {$(VPATH)}vm.h {$(VPATH)}constant.h \
+ $(PROBES_H_INCLUDES) {$(VPATH)}probes_helper.h {$(VPATH)}vm_opts.h
+vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}addr2line.h \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) \
+ $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_intern.h \
+ {$(VPATH)}util.h {$(VPATH)}vm_opts.h {$(VPATH)}internal.h
+id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}vm_opts.h
+vm_backtrace.$(OBJEXT): {$(VPATH)}vm_backtrace.c \
+ $(VM_CORE_H_INCLUDES) $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}iseq.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
+vm_trace.$(OBJEXT): {$(VPATH)}vm_trace.c $(ENCODING_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) $(RUBY_H_INCLUDES) {$(VPATH)}debug.h \
+ {$(VPATH)}internal.h {$(VPATH)}vm_opts.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h
+miniprelude.$(OBJEXT): {$(VPATH)}miniprelude.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+prelude.$(OBJEXT): {$(VPATH)}prelude.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}vm_opts.h
+goruby.$(OBJEXT): {$(VPATH)}goruby.c {$(VPATH)}main.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}vm_debug.h {$(VPATH)}node.h $(hdrdir)/ruby.h
+
+sizes.$(OBJEXT): {$(VPATH)}sizes.c $(RUBY_H_INCLUDES)
+
+ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
+ {$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
+us_ascii.$(OBJEXT): {$(VPATH)}us_ascii.c {$(VPATH)}regenc.h \
+ {$(VPATH)}config.h {$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
+unicode.$(OBJEXT): {$(VPATH)}unicode.c {$(VPATH)}regint.h \
+ {$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
+ {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
+ {$(VPATH)}missing.h {$(VPATH)}intern.h \
+ {$(VPATH)}enc/unicode/name2ctype.h {$(VPATH)}enc/unicode/casefold.h \
+ {$(VPATH)}subst.h $(RUBY_H_INCLUDES)
+
+utf_8.$(OBJEXT): {$(VPATH)}utf_8.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
+ {$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
+
+win32/win32.$(OBJEXT): {$(VPATH)}win32/win32.c {$(VPATH)}dln.h {$(VPATH)}dln_find.c \
+ {$(VPATH)}internal.h $(RUBY_H_INCLUDES) $(PLATFORM_D)
+win32/file.$(OBJEXT): {$(VPATH)}win32/file.c $(RUBY_H_INCLUDES) $(PLATFORM_D)
$(NEWLINE_C): $(srcdir)/enc/trans/newline.trans $(srcdir)/tool/transcode-tblgen.rb
- $(Q) $(MAKEDIRS) $(@D)
$(Q) $(BASERUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo $@ $(srcdir)/enc/trans/newline.trans
-enc/trans/newline.$(OBJEXT): $(NEWLINE_C)
+newline.$(OBJEXT): $(NEWLINE_C) {$(VPATH)}defines.h \
+ {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \
+ {$(VPATH)}transcode_data.h {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}subst.h
-verconf.h: $(srcdir)/template/verconf.h.tmpl $(srcdir)/tool/generic_erb.rb
+verconf.h: $(srcdir)/template/verconf.h.in $(srcdir)/tool/generic_erb.rb $(RBCONFIG)
$(ECHO) creating $@
- $(Q) $(BOOTSTRAPRUBY) "$(srcdir)/tool/generic_erb.rb" -o $@ $(srcdir)/template/verconf.h.tmpl
+ $(Q) $(MINIRUBY) "$(srcdir)/tool/generic_erb.rb" $(srcdir)/template/verconf.h.in > $@
+
+DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
+ eval.$(OBJEXT) \
+ gc.$(OBJEXT) \
+ hash.$(OBJEXT) \
+ load.$(OBJEXT) \
+ object.$(OBJEXT) \
+ parse.$(OBJEXT) \
+ string.$(OBJEXT) \
+ vm.$(OBJEXT)
-ruby-glommed.$(OBJEXT): $(OBJS)
+probes.$(OBJEXT): $(DTRACE_DEPENDENT_OBJS)
+ruby-glommed.$(OBJEXT): $(OBJS) $(DTRACE_OBJ)
$(OBJS): {$(VPATH)}config.h {$(VPATH)}missing.h
@@ -771,31 +880,20 @@ INSNS2VMOPT = --srcdir="$(srcdir)"
{$(VPATH)}vm.inc: $(srcdir)/template/vm.inc.tmpl
-common-srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}enc/trans/newline.c {$(VPATH)}id.c \
- srcs-lib srcs-ext
+srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c {$(VPATH)}id.c srcs-ext srcs-enc
-srcs: common-srcs srcs-enc
-
-EXT_SRCS = $(srcdir)/ext/ripper/ripper.c \
- $(srcdir)/ext/rbconfig/sizeof/sizes.c
+EXT_SRCS = $(srcdir)/ext/ripper/ripper.c $(srcdir)/ext/json/parser/parser.c \
+ $(srcdir)/ext/dl/callback/callback.c $(srcdir)/ext/rbconfig/sizeof/sizes.c
srcs-ext: $(EXT_SRCS)
-srcs-extra: $(srcdir)/ext/json/parser/parser.c
-
-LIB_SRCS = $(srcdir)/lib/unicode_normalize/tables.rb
-
-srcs-lib: $(LIB_SRCS)
-
srcs-enc: $(ENC_MK)
$(ECHO) making srcs under enc
$(Q) $(MAKE) -f $(ENC_MK) RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs
-all-incs: incs {$(VPATH)}encdb.h {$(VPATH)}transdb.h
-incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}known_errors.inc \
- {$(VPATH)}vm_call_iseq_optimized.inc $(srcdir)/revision.h \
- $(REVISION_H) enc/unicode/name2ctype.h enc/jis/props.h \
- {$(VPATH)}id.h {$(VPATH)}probes.dmyh
+all-incs: incs
+incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}encdb.h {$(VPATH)}transdb.h {$(VPATH)}known_errors.inc \
+ $(srcdir)/revision.h $(REVISION_H) enc/unicode/name2ctype.h {$(VPATH)}id.h {$(VPATH)}probes.dmyh
insns: $(INSNS)
@@ -827,27 +925,20 @@ known_errors.inc: $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_
$(ECHO) generating $@
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def
-vm_call_iseq_optimized.inc: $(srcdir)/tool/mk_call_iseq_optimized.rb
- $(ECHO) generating $@
- $(Q) $(BASERUBY) $(srcdir)/tool/mk_call_iseq_optimized.rb > $@
-
-$(MINIPRELUDE_C): $(COMPILE_PRELUDE)
+$(MINIPRELUDE_C): $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
$(ECHO) generating $@
- $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -o $@ \
- $(srcdir)/template/prelude.c.tmpl
+ $(Q) $(BASERUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $@
-$(PRELUDE_C): $(COMPILE_PRELUDE) \
- {$(srcdir)}lib/rubygems/defaults.rb \
- {$(srcdir)}lib/rubygems/core_ext/kernel_gem.rb \
- $(PRELUDE_SCRIPTS) $(LIB_SRCS)
+prelude.c: $(srcdir)/tool/compile_prelude.rb $(RBCONFIG) \
+ $(srcdir)/lib/rubygems/defaults.rb \
+ $(srcdir)/lib/rubygems/core_ext/kernel_gem.rb \
+ $(PRELUDE_SCRIPTS) $(PREP)
$(ECHO) generating $@
- $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
- $(srcdir)/template/prelude.c.tmpl $(PRELUDE_SCRIPTS)
+ $(Q) $(COMPILE_PRELUDE) $(PRELUDE_SCRIPTS) $@
-{$(VPATH)}golf_prelude.c: $(COMPILE_PRELUDE) {$(srcdir)}golf_prelude.rb
+golf_prelude.c: $(srcdir)/tool/compile_prelude.rb $(RBCONFIG) $(srcdir)/prelude.rb $(srcdir)/golf_prelude.rb $(PREP)
$(ECHO) generating $@
- $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
- $(srcdir)/template/prelude.c.tmpl golf_prelude.rb
+ $(Q) $(COMPILE_PRELUDE) $(srcdir)/golf_prelude.rb $@
probes.dmyh: {$(srcdir)}probes.d $(srcdir)/tool/gen_dummy_probes.rb
$(BASERUBY) $(srcdir)/tool/gen_dummy_probes.rb $(srcdir)/probes.d > $@
@@ -856,7 +947,6 @@ probes.h: {$(VPATH)}probes.$(DTRACE_EXT)
prereq: incs srcs preludes PHONY
-preludes: {$(VPATH)}prelude.c
preludes: {$(VPATH)}miniprelude.c
preludes: {$(srcdir)}golf_prelude.c
@@ -869,23 +959,23 @@ $(REVISION_H): $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastr
$(srcdir)/ext/ripper/ripper.c: parse.y id.h
$(ECHO) generating $@
- $(Q) $(CHDIR) $(@D) && \
- sed /AUTOGENERATED/q depend | \
- $(exec) $(MAKE) -f - $(MFLAGS) \
- Q=$(Q) ECHO=$(ECHO) RM="$(RM)" top_srcdir=../.. srcdir=. VPATH="$(PWD)" \
- RUBY="$(BASERUBY)" PATH_SEPARATOR="$(PATH_SEPARATOR)"
+ $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. VPATH=../.. RUBY="$(BASERUBY)" PATH_SEPARATOR="$(PATH_SEPARATOR)"
$(srcdir)/ext/json/parser/parser.c: $(srcdir)/ext/json/parser/parser.rl
$(ECHO) generating $@
$(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f prereq.mk $(MFLAGS) \
Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. BASERUBY="$(BASERUBY)"
+$(srcdir)/ext/dl/callback/callback.c: $(srcdir)/ext/dl/callback/mkcallback.rb $(srcdir)/ext/dl/dl.h
+ $(ECHO) generating $@
+ $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. VPATH=../.. RUBY="$(BASERUBY)"
+
$(srcdir)/ext/rbconfig/sizeof/sizes.c: $(srcdir)/ext/rbconfig/sizeof/depend \
$(srcdir)/tool/generic_erb.rb $(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in
$(ECHO) generating $@
- $(Q) $(CHDIR) $(@D) && \
- sed /AUTOGENERATED/q depend | \
- $(exec) $(MAKE) -f - $(MFLAGS) \
+ $(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. RUBY="$(BASERUBY)"
##
@@ -909,11 +999,6 @@ COMPARE_RUBY = $(BASERUBY)
ITEM =
OPTS =
-# You can pass several options through OPTS environment variable.
-# $ make benchmark OPTS="--help" displays more detail.
-# for example,
-# $ make benchmark COMPARE_RUBY="ruby-trunk" OPTS="-e ruby-2.2.2"
-# This command compares trunk and built-ruby and 2.2.2
benchmark: $(PROGRAM) PHONY
$(BASERUBY) $(srcdir)/benchmark/driver.rb -v \
--executables="$(COMPARE_RUBY); built-ruby::$(RUNRUBY)" \
@@ -930,8 +1015,7 @@ tbench: $(PROGRAM) PHONY
--pattern='bmx_' --directory=$(srcdir)/benchmark $(OPTS)
run.gdb:
- echo set breakpoint pending on > run.gdb
- echo b ruby_debug_breakpoint >> run.gdb
+ echo b ruby_debug_breakpoint > run.gdb
echo '# handle SIGINT nostop' >> run.gdb
echo '# handle SIGPIPE nostop' >> run.gdb
echo '# b rb_longjmp' >> run.gdb
@@ -951,123 +1035,38 @@ gdb-ruby: $(PROGRAM) run.gdb PHONY
$(Q) $(RUNRUBY_COMMAND) $(RUNRUBY_DEBUGGER) -- $(TESTRUN_SCRIPT)
dist:
- $(BASERUBY) $(srcdir)/tool/make-snapshot -srcdir=$(srcdir) tmp $(RELNAME)
+ $(BASERUBY) $(srcdir)/tool/make-snapshot tmp $(RELNAME)
up::
- -$(Q)$(MAKE) $(MFLAGS) Q=$(Q) REVISION_FORCE=PHONY "$(REVISION_H)"
+ -$(Q)$(MAKE) $(MFLAGS) REVISION_FORCE=PHONY "$(REVISION_H)"
-up::
- -$(Q)$(MAKE) $(MFLAGS) Q=$(Q) after-update
-
-after-update:: update-unicode update-gems extract-extlibs
-
-update-config_files: PHONY
- $(Q) $(BASERUBY) -C "$(srcdir)/tool" \
- ../tool/downloader.rb -e gnu \
- config.guess config.sub
-
-update-gems: PHONY
- $(ECHO) Downloading bundled gem files...
- $(Q) $(BASERUBY) -C "$(srcdir)/gems" \
- -I../tool -rdownloader -answ \
- -e 'gem, ver = *$$F' \
- -e 'old = Dir.glob("#{gem}-*.gem")' \
- -e 'gem = "#{gem}-#{ver}.gem"' \
- -e 'Downloader::RubyGems.download(gem, nil, nil) and' \
- -e 'File.unlink(*(old-[gem]))' \
- bundled_gems
-
-extract-gems: PHONY
- $(ECHO) Extracting bundled gem files...
- $(Q) $(RUNRUBY) -C "$(srcdir)/gems" \
- -I../tool -rgem-unpack -answ \
- -e 'gem, ver = *$$F' \
- -e 'Gem.unpack("#{gem}-#{ver}.gem")' \
- bundled_gems
-
-UPDATE_LIBRARIES = no
-
-### set the following environment variable or uncomment the line if
-### the Unicode data files are updated every minute.
-# ALWAYS_UPDATE_UNICODE = yes
-
-UNICODE_FILES = $(srcdir)/enc/unicode/data/$(UNICODE_VERSION)/UnicodeData.txt \
- $(srcdir)/enc/unicode/data/$(UNICODE_VERSION)/CompositionExclusions.txt \
- $(srcdir)/enc/unicode/data/$(UNICODE_VERSION)/NormalizationTest.txt
-
-update-unicode: $(UNICODE_FILES) PHONY
-
-UNICODE_FILES_DEPS0 = $(UPDATE_LIBRARIES:yes=download-unicode-data)
-UNICODE_FILES_DEPS = $(UNICODE_FILES_DEPS0:no=)
-$(UNICODE_FILES): $(UNICODE_FILES_DEPS)
-
-download-unicode-data: ./.unicode-$(UNICODE_VERSION).time
-./.unicode-$(UNICODE_VERSION).time: PHONY
- $(ECHO) Downloading Unicode $(UNICODE_VERSION) data files...
- $(Q) $(MAKEDIRS) "$(srcdir)/enc/unicode/data/$(UNICODE_VERSION)"
- $(Q) $(BASERUBY) -C "$(srcdir)" tool/downloader.rb \
- -d enc/unicode/data/$(UNICODE_VERSION) \
- -e $(ALWAYS_UPDATE_UNICODE:yes=-a) unicode \
- $(UNICODE_VERSION)/ucd/UnicodeData.txt \
- $(UNICODE_VERSION)/ucd/CompositionExclusions.txt \
- $(UNICODE_VERSION)/ucd/NormalizationTest.txt
- @exit > $@
-
-$(srcdir)/$(HAVE_BASERUBY:yes=lib/unicode_normalize/tables.rb): \
- $(UNICODE_FILES_DEPS:download-unicode-data=./.unicode-tables.time)
-
-./.unicode-tables.time: $(srcdir)/tool/generic_erb.rb \
- $(UNICODE_FILES) $(UNICODE_FILES_DEPS) \
- $(srcdir)/template/unicode_norm_gen.tmpl
- $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb \
- -c -t$@ -o $(srcdir)/lib/unicode_normalize/tables.rb \
- -I $(srcdir) \
- $(srcdir)/template/unicode_norm_gen.tmpl \
- enc/unicode/data/$(UNICODE_VERSION) lib/unicode_normalize
-
-download-extlibs:
- $(Q) $(BASERUBY) -C $(srcdir) -w tool/extlibs.rb --download ext
-
-extract-extlibs:
- $(Q) $(BASERUBY) -C $(srcdir) -w tool/extlibs.rb --all ext
-
-clean-extlibs:
- $(Q) $(RMALL) $(srcdir)/.downloaded-cache
-
-clean-gems:
- $(Q) $(RM) gems/*.gem
-
-CLEAN_CACHE = clean-extlibs
+update-config_files: $(srcdir)/tool/config.guess $(srcdir)/tool/config.sub
+$(srcdir)/tool/config.guess:
+ $(Q) $(BASERUBY) -C $(@D) get-config_files $(@F)
+$(srcdir)/tool/config.sub:
+ $(Q) $(BASERUBY) -C $(@D) get-config_files $(@F)
info: info-program info-libruby_a info-libruby_so info-arch
-info-program: PHONY
+info-program:
@echo PROGRAM=$(PROGRAM)
-info-libruby_a: PHONY
+info-libruby_a:
@echo LIBRUBY_A=$(LIBRUBY_A)
-info-libruby_so: PHONY
+info-libruby_so:
@echo LIBRUBY_SO=$(LIBRUBY_SO)
-info-arch: PHONY
+info-arch:
@echo arch=$(arch)
change: PHONY
$(BASERUBY) -C "$(srcdir)" ./tool/change_maker.rb $(CHANGES) > change.log
-exam: check test-rubyspec
-
-love: sudo-precheck up all test install check
+love: sudo-precheck up all test install test-all
@echo love is all you need
yes-test-all: sudo-precheck
-sudo-precheck: PHONY
+sudo-precheck:
@$(SUDO) echo > $(NULL)
-update-man-date: PHONY
- -$(Q) $(BASERUBY) -I"$(srcdir)/tool" -rvcs -i -p \
- -e 'BEGIN{@vcs=VCS.detect(ARGV.shift)}' \
- -e '$$_.sub!(/^(\.Dd ).*/){$$1+@vcs.modified(ARGF.path).strftime("%B %d, %Y")}' \
- "$(srcdir)" "$(srcdir)"/man/*.1
-
help: PHONY
$(MESSAGE_BEGIN) \
" Makefile of Ruby" \
@@ -1084,12 +1083,11 @@ help: PHONY
" gdb: runs test.rb by miniruby under gdb" \
" gdb-ruby: runs test.rb by ruby under gdb" \
" check: equals make test test-all" \
- " exam: equals make check test-rubyspec" \
" test: ruby core tests" \
- " test-all: all ruby tests [TESTOPTS=-j4 TESTS=\"<test files>\"]" \
+ " test-all: all ruby tests [TESTS=<test files>]" \
" test-rubyspec: run RubySpec test suite" \
" update-rubyspec: update local copy of RubySpec" \
- " benchmark: benchmark this ruby and COMPARE_RUBY." \
+ " benchmark: benchmark this ruby and COMPARE_RUBY" \
" gcbench: gc benchmark [GCBENCH_ITEM=<item_name>]" \
" gcbench-rdoc: gc benchmark with GCBENCH_ITEM=rdoc" \
" install: install all ruby distributions" \
@@ -1101,1411 +1099,5 @@ help: PHONY
" golf: for golfers" \
"" \
"see DeveloperHowto for more detail: " \
- " https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto" \
+ " http://bugs.ruby-lang.org/wiki/ruby/DeveloperHowto" \
$(MESSAGE_END)
-
-# AUTOGENERATED DEPENDENCIES START
-addr2line.$(OBJEXT): {$(VPATH)}addr2line.c
-addr2line.$(OBJEXT): {$(VPATH)}addr2line.h
-addr2line.$(OBJEXT): {$(VPATH)}config.h
-addr2line.$(OBJEXT): {$(VPATH)}missing.h
-array.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-array.$(OBJEXT): $(top_srcdir)/include/ruby.h
-array.$(OBJEXT): {$(VPATH)}array.c
-array.$(OBJEXT): {$(VPATH)}config.h
-array.$(OBJEXT): {$(VPATH)}defines.h
-array.$(OBJEXT): {$(VPATH)}encoding.h
-array.$(OBJEXT): {$(VPATH)}id.h
-array.$(OBJEXT): {$(VPATH)}intern.h
-array.$(OBJEXT): {$(VPATH)}internal.h
-array.$(OBJEXT): {$(VPATH)}io.h
-array.$(OBJEXT): {$(VPATH)}missing.h
-array.$(OBJEXT): {$(VPATH)}oniguruma.h
-array.$(OBJEXT): {$(VPATH)}probes.h
-array.$(OBJEXT): {$(VPATH)}st.h
-array.$(OBJEXT): {$(VPATH)}subst.h
-array.$(OBJEXT): {$(VPATH)}util.h
-array.$(OBJEXT): {$(VPATH)}vm_opts.h
-bignum.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-bignum.$(OBJEXT): $(top_srcdir)/include/ruby.h
-bignum.$(OBJEXT): {$(VPATH)}bignum.c
-bignum.$(OBJEXT): {$(VPATH)}config.h
-bignum.$(OBJEXT): {$(VPATH)}defines.h
-bignum.$(OBJEXT): {$(VPATH)}encoding.h
-bignum.$(OBJEXT): {$(VPATH)}intern.h
-bignum.$(OBJEXT): {$(VPATH)}internal.h
-bignum.$(OBJEXT): {$(VPATH)}io.h
-bignum.$(OBJEXT): {$(VPATH)}missing.h
-bignum.$(OBJEXT): {$(VPATH)}oniguruma.h
-bignum.$(OBJEXT): {$(VPATH)}st.h
-bignum.$(OBJEXT): {$(VPATH)}subst.h
-bignum.$(OBJEXT): {$(VPATH)}thread.h
-bignum.$(OBJEXT): {$(VPATH)}util.h
-class.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-class.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-class.$(OBJEXT): $(CCAN_DIR)/list/list.h
-class.$(OBJEXT): $(CCAN_DIR)/str/str.h
-class.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-class.$(OBJEXT): $(top_srcdir)/include/ruby.h
-class.$(OBJEXT): {$(VPATH)}class.c
-class.$(OBJEXT): {$(VPATH)}config.h
-class.$(OBJEXT): {$(VPATH)}constant.h
-class.$(OBJEXT): {$(VPATH)}defines.h
-class.$(OBJEXT): {$(VPATH)}encoding.h
-class.$(OBJEXT): {$(VPATH)}id.h
-class.$(OBJEXT): {$(VPATH)}id_table.h
-class.$(OBJEXT): {$(VPATH)}intern.h
-class.$(OBJEXT): {$(VPATH)}internal.h
-class.$(OBJEXT): {$(VPATH)}io.h
-class.$(OBJEXT): {$(VPATH)}method.h
-class.$(OBJEXT): {$(VPATH)}missing.h
-class.$(OBJEXT): {$(VPATH)}node.h
-class.$(OBJEXT): {$(VPATH)}oniguruma.h
-class.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-class.$(OBJEXT): {$(VPATH)}st.h
-class.$(OBJEXT): {$(VPATH)}subst.h
-class.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-class.$(OBJEXT): {$(VPATH)}thread_native.h
-class.$(OBJEXT): {$(VPATH)}vm_core.h
-class.$(OBJEXT): {$(VPATH)}vm_debug.h
-class.$(OBJEXT): {$(VPATH)}vm_opts.h
-compar.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-compar.$(OBJEXT): {$(VPATH)}compar.c
-compar.$(OBJEXT): {$(VPATH)}config.h
-compar.$(OBJEXT): {$(VPATH)}defines.h
-compar.$(OBJEXT): {$(VPATH)}intern.h
-compar.$(OBJEXT): {$(VPATH)}missing.h
-compar.$(OBJEXT): {$(VPATH)}st.h
-compar.$(OBJEXT): {$(VPATH)}subst.h
-compile.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-compile.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-compile.$(OBJEXT): $(CCAN_DIR)/list/list.h
-compile.$(OBJEXT): $(CCAN_DIR)/str/str.h
-compile.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-compile.$(OBJEXT): $(top_srcdir)/include/ruby.h
-compile.$(OBJEXT): {$(VPATH)}compile.c
-compile.$(OBJEXT): {$(VPATH)}config.h
-compile.$(OBJEXT): {$(VPATH)}defines.h
-compile.$(OBJEXT): {$(VPATH)}encindex.h
-compile.$(OBJEXT): {$(VPATH)}encoding.h
-compile.$(OBJEXT): {$(VPATH)}gc.h
-compile.$(OBJEXT): {$(VPATH)}id.h
-compile.$(OBJEXT): {$(VPATH)}insns.inc
-compile.$(OBJEXT): {$(VPATH)}insns_info.inc
-compile.$(OBJEXT): {$(VPATH)}intern.h
-compile.$(OBJEXT): {$(VPATH)}internal.h
-compile.$(OBJEXT): {$(VPATH)}io.h
-compile.$(OBJEXT): {$(VPATH)}iseq.h
-compile.$(OBJEXT): {$(VPATH)}method.h
-compile.$(OBJEXT): {$(VPATH)}missing.h
-compile.$(OBJEXT): {$(VPATH)}node.h
-compile.$(OBJEXT): {$(VPATH)}oniguruma.h
-compile.$(OBJEXT): {$(VPATH)}optinsn.inc
-compile.$(OBJEXT): {$(VPATH)}re.h
-compile.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-compile.$(OBJEXT): {$(VPATH)}st.h
-compile.$(OBJEXT): {$(VPATH)}subst.h
-compile.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-compile.$(OBJEXT): {$(VPATH)}thread_native.h
-compile.$(OBJEXT): {$(VPATH)}vm_core.h
-compile.$(OBJEXT): {$(VPATH)}vm_debug.h
-compile.$(OBJEXT): {$(VPATH)}vm_opts.h
-complex.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-complex.$(OBJEXT): $(top_srcdir)/include/ruby.h
-complex.$(OBJEXT): {$(VPATH)}complex.c
-complex.$(OBJEXT): {$(VPATH)}config.h
-complex.$(OBJEXT): {$(VPATH)}defines.h
-complex.$(OBJEXT): {$(VPATH)}encoding.h
-complex.$(OBJEXT): {$(VPATH)}intern.h
-complex.$(OBJEXT): {$(VPATH)}internal.h
-complex.$(OBJEXT): {$(VPATH)}io.h
-complex.$(OBJEXT): {$(VPATH)}missing.h
-complex.$(OBJEXT): {$(VPATH)}oniguruma.h
-complex.$(OBJEXT): {$(VPATH)}st.h
-complex.$(OBJEXT): {$(VPATH)}subst.h
-cont.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-cont.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-cont.$(OBJEXT): $(CCAN_DIR)/list/list.h
-cont.$(OBJEXT): $(CCAN_DIR)/str/str.h
-cont.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-cont.$(OBJEXT): $(top_srcdir)/include/ruby.h
-cont.$(OBJEXT): {$(VPATH)}config.h
-cont.$(OBJEXT): {$(VPATH)}cont.c
-cont.$(OBJEXT): {$(VPATH)}defines.h
-cont.$(OBJEXT): {$(VPATH)}encoding.h
-cont.$(OBJEXT): {$(VPATH)}eval_intern.h
-cont.$(OBJEXT): {$(VPATH)}gc.h
-cont.$(OBJEXT): {$(VPATH)}id.h
-cont.$(OBJEXT): {$(VPATH)}intern.h
-cont.$(OBJEXT): {$(VPATH)}internal.h
-cont.$(OBJEXT): {$(VPATH)}io.h
-cont.$(OBJEXT): {$(VPATH)}method.h
-cont.$(OBJEXT): {$(VPATH)}missing.h
-cont.$(OBJEXT): {$(VPATH)}node.h
-cont.$(OBJEXT): {$(VPATH)}oniguruma.h
-cont.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-cont.$(OBJEXT): {$(VPATH)}st.h
-cont.$(OBJEXT): {$(VPATH)}subst.h
-cont.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-cont.$(OBJEXT): {$(VPATH)}thread_native.h
-cont.$(OBJEXT): {$(VPATH)}vm_core.h
-cont.$(OBJEXT): {$(VPATH)}vm_debug.h
-cont.$(OBJEXT): {$(VPATH)}vm_opts.h
-debug.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-debug.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-debug.$(OBJEXT): $(CCAN_DIR)/list/list.h
-debug.$(OBJEXT): $(CCAN_DIR)/str/str.h
-debug.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-debug.$(OBJEXT): $(top_srcdir)/include/ruby.h
-debug.$(OBJEXT): {$(VPATH)}config.h
-debug.$(OBJEXT): {$(VPATH)}debug.c
-debug.$(OBJEXT): {$(VPATH)}defines.h
-debug.$(OBJEXT): {$(VPATH)}encoding.h
-debug.$(OBJEXT): {$(VPATH)}eval_intern.h
-debug.$(OBJEXT): {$(VPATH)}id.h
-debug.$(OBJEXT): {$(VPATH)}intern.h
-debug.$(OBJEXT): {$(VPATH)}internal.h
-debug.$(OBJEXT): {$(VPATH)}io.h
-debug.$(OBJEXT): {$(VPATH)}method.h
-debug.$(OBJEXT): {$(VPATH)}missing.h
-debug.$(OBJEXT): {$(VPATH)}node.h
-debug.$(OBJEXT): {$(VPATH)}oniguruma.h
-debug.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-debug.$(OBJEXT): {$(VPATH)}st.h
-debug.$(OBJEXT): {$(VPATH)}subst.h
-debug.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-debug.$(OBJEXT): {$(VPATH)}thread_native.h
-debug.$(OBJEXT): {$(VPATH)}util.h
-debug.$(OBJEXT): {$(VPATH)}vm_core.h
-debug.$(OBJEXT): {$(VPATH)}vm_debug.h
-debug.$(OBJEXT): {$(VPATH)}vm_opts.h
-dir.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-dir.$(OBJEXT): $(top_srcdir)/include/ruby.h
-dir.$(OBJEXT): {$(VPATH)}config.h
-dir.$(OBJEXT): {$(VPATH)}defines.h
-dir.$(OBJEXT): {$(VPATH)}dir.c
-dir.$(OBJEXT): {$(VPATH)}encindex.h
-dir.$(OBJEXT): {$(VPATH)}encoding.h
-dir.$(OBJEXT): {$(VPATH)}intern.h
-dir.$(OBJEXT): {$(VPATH)}internal.h
-dir.$(OBJEXT): {$(VPATH)}io.h
-dir.$(OBJEXT): {$(VPATH)}missing.h
-dir.$(OBJEXT): {$(VPATH)}oniguruma.h
-dir.$(OBJEXT): {$(VPATH)}st.h
-dir.$(OBJEXT): {$(VPATH)}subst.h
-dir.$(OBJEXT): {$(VPATH)}util.h
-dln.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-dln.$(OBJEXT): {$(VPATH)}config.h
-dln.$(OBJEXT): {$(VPATH)}defines.h
-dln.$(OBJEXT): {$(VPATH)}dln.c
-dln.$(OBJEXT): {$(VPATH)}dln.h
-dln.$(OBJEXT): {$(VPATH)}intern.h
-dln.$(OBJEXT): {$(VPATH)}missing.h
-dln.$(OBJEXT): {$(VPATH)}st.h
-dln.$(OBJEXT): {$(VPATH)}subst.h
-dln_find.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-dln_find.$(OBJEXT): {$(VPATH)}config.h
-dln_find.$(OBJEXT): {$(VPATH)}defines.h
-dln_find.$(OBJEXT): {$(VPATH)}dln.h
-dln_find.$(OBJEXT): {$(VPATH)}dln_find.c
-dln_find.$(OBJEXT): {$(VPATH)}intern.h
-dln_find.$(OBJEXT): {$(VPATH)}missing.h
-dln_find.$(OBJEXT): {$(VPATH)}st.h
-dln_find.$(OBJEXT): {$(VPATH)}subst.h
-dmydln.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-dmydln.$(OBJEXT): {$(VPATH)}config.h
-dmydln.$(OBJEXT): {$(VPATH)}defines.h
-dmydln.$(OBJEXT): {$(VPATH)}dmydln.c
-dmydln.$(OBJEXT): {$(VPATH)}intern.h
-dmydln.$(OBJEXT): {$(VPATH)}missing.h
-dmydln.$(OBJEXT): {$(VPATH)}st.h
-dmydln.$(OBJEXT): {$(VPATH)}subst.h
-dmyenc.$(OBJEXT): {$(VPATH)}dmyenc.c
-dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
-enc/ascii.$(OBJEXT): {$(VPATH)}config.h
-enc/ascii.$(OBJEXT): {$(VPATH)}defines.h
-enc/ascii.$(OBJEXT): {$(VPATH)}enc/ascii.c
-enc/ascii.$(OBJEXT): {$(VPATH)}encindex.h
-enc/ascii.$(OBJEXT): {$(VPATH)}missing.h
-enc/ascii.$(OBJEXT): {$(VPATH)}oniguruma.h
-enc/ascii.$(OBJEXT): {$(VPATH)}regenc.h
-enc/trans/newline.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}config.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}defines.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}enc/trans/newline.c
-enc/trans/newline.$(OBJEXT): {$(VPATH)}intern.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}missing.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}st.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}subst.h
-enc/trans/newline.$(OBJEXT): {$(VPATH)}transcode_data.h
-enc/unicode.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/unicode.$(OBJEXT): {$(VPATH)}config.h
-enc/unicode.$(OBJEXT): {$(VPATH)}defines.h
-enc/unicode.$(OBJEXT): {$(VPATH)}enc/unicode.c
-enc/unicode.$(OBJEXT): {$(VPATH)}enc/unicode/casefold.h
-enc/unicode.$(OBJEXT): {$(VPATH)}enc/unicode/name2ctype.h
-enc/unicode.$(OBJEXT): {$(VPATH)}intern.h
-enc/unicode.$(OBJEXT): {$(VPATH)}missing.h
-enc/unicode.$(OBJEXT): {$(VPATH)}oniguruma.h
-enc/unicode.$(OBJEXT): {$(VPATH)}regenc.h
-enc/unicode.$(OBJEXT): {$(VPATH)}regint.h
-enc/unicode.$(OBJEXT): {$(VPATH)}st.h
-enc/unicode.$(OBJEXT): {$(VPATH)}subst.h
-enc/us_ascii.$(OBJEXT): {$(VPATH)}config.h
-enc/us_ascii.$(OBJEXT): {$(VPATH)}defines.h
-enc/us_ascii.$(OBJEXT): {$(VPATH)}enc/us_ascii.c
-enc/us_ascii.$(OBJEXT): {$(VPATH)}encindex.h
-enc/us_ascii.$(OBJEXT): {$(VPATH)}missing.h
-enc/us_ascii.$(OBJEXT): {$(VPATH)}oniguruma.h
-enc/us_ascii.$(OBJEXT): {$(VPATH)}regenc.h
-enc/utf_8.$(OBJEXT): {$(VPATH)}config.h
-enc/utf_8.$(OBJEXT): {$(VPATH)}defines.h
-enc/utf_8.$(OBJEXT): {$(VPATH)}enc/utf_8.c
-enc/utf_8.$(OBJEXT): {$(VPATH)}encindex.h
-enc/utf_8.$(OBJEXT): {$(VPATH)}missing.h
-enc/utf_8.$(OBJEXT): {$(VPATH)}oniguruma.h
-enc/utf_8.$(OBJEXT): {$(VPATH)}regenc.h
-encoding.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-encoding.$(OBJEXT): $(top_srcdir)/include/ruby.h
-encoding.$(OBJEXT): {$(VPATH)}config.h
-encoding.$(OBJEXT): {$(VPATH)}defines.h
-encoding.$(OBJEXT): {$(VPATH)}encindex.h
-encoding.$(OBJEXT): {$(VPATH)}encoding.c
-encoding.$(OBJEXT): {$(VPATH)}encoding.h
-encoding.$(OBJEXT): {$(VPATH)}intern.h
-encoding.$(OBJEXT): {$(VPATH)}internal.h
-encoding.$(OBJEXT): {$(VPATH)}io.h
-encoding.$(OBJEXT): {$(VPATH)}missing.h
-encoding.$(OBJEXT): {$(VPATH)}oniguruma.h
-encoding.$(OBJEXT): {$(VPATH)}regenc.h
-encoding.$(OBJEXT): {$(VPATH)}st.h
-encoding.$(OBJEXT): {$(VPATH)}subst.h
-encoding.$(OBJEXT): {$(VPATH)}util.h
-enum.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enum.$(OBJEXT): $(top_srcdir)/include/ruby.h
-enum.$(OBJEXT): {$(VPATH)}config.h
-enum.$(OBJEXT): {$(VPATH)}defines.h
-enum.$(OBJEXT): {$(VPATH)}encoding.h
-enum.$(OBJEXT): {$(VPATH)}enum.c
-enum.$(OBJEXT): {$(VPATH)}id.h
-enum.$(OBJEXT): {$(VPATH)}intern.h
-enum.$(OBJEXT): {$(VPATH)}internal.h
-enum.$(OBJEXT): {$(VPATH)}io.h
-enum.$(OBJEXT): {$(VPATH)}missing.h
-enum.$(OBJEXT): {$(VPATH)}oniguruma.h
-enum.$(OBJEXT): {$(VPATH)}st.h
-enum.$(OBJEXT): {$(VPATH)}subst.h
-enum.$(OBJEXT): {$(VPATH)}util.h
-enumerator.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enumerator.$(OBJEXT): $(top_srcdir)/include/ruby.h
-enumerator.$(OBJEXT): {$(VPATH)}config.h
-enumerator.$(OBJEXT): {$(VPATH)}defines.h
-enumerator.$(OBJEXT): {$(VPATH)}encoding.h
-enumerator.$(OBJEXT): {$(VPATH)}enumerator.c
-enumerator.$(OBJEXT): {$(VPATH)}intern.h
-enumerator.$(OBJEXT): {$(VPATH)}internal.h
-enumerator.$(OBJEXT): {$(VPATH)}io.h
-enumerator.$(OBJEXT): {$(VPATH)}missing.h
-enumerator.$(OBJEXT): {$(VPATH)}oniguruma.h
-enumerator.$(OBJEXT): {$(VPATH)}st.h
-enumerator.$(OBJEXT): {$(VPATH)}subst.h
-error.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-error.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-error.$(OBJEXT): $(CCAN_DIR)/list/list.h
-error.$(OBJEXT): $(CCAN_DIR)/str/str.h
-error.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-error.$(OBJEXT): $(top_srcdir)/include/ruby.h
-error.$(OBJEXT): {$(VPATH)}config.h
-error.$(OBJEXT): {$(VPATH)}defines.h
-error.$(OBJEXT): {$(VPATH)}encoding.h
-error.$(OBJEXT): {$(VPATH)}error.c
-error.$(OBJEXT): {$(VPATH)}id.h
-error.$(OBJEXT): {$(VPATH)}intern.h
-error.$(OBJEXT): {$(VPATH)}internal.h
-error.$(OBJEXT): {$(VPATH)}io.h
-error.$(OBJEXT): {$(VPATH)}known_errors.inc
-error.$(OBJEXT): {$(VPATH)}method.h
-error.$(OBJEXT): {$(VPATH)}missing.h
-error.$(OBJEXT): {$(VPATH)}node.h
-error.$(OBJEXT): {$(VPATH)}oniguruma.h
-error.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-error.$(OBJEXT): {$(VPATH)}st.h
-error.$(OBJEXT): {$(VPATH)}subst.h
-error.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-error.$(OBJEXT): {$(VPATH)}thread_native.h
-error.$(OBJEXT): {$(VPATH)}vm_core.h
-error.$(OBJEXT): {$(VPATH)}vm_debug.h
-error.$(OBJEXT): {$(VPATH)}vm_opts.h
-eval.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-eval.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-eval.$(OBJEXT): $(CCAN_DIR)/list/list.h
-eval.$(OBJEXT): $(CCAN_DIR)/str/str.h
-eval.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-eval.$(OBJEXT): $(top_srcdir)/include/ruby.h
-eval.$(OBJEXT): {$(VPATH)}config.h
-eval.$(OBJEXT): {$(VPATH)}defines.h
-eval.$(OBJEXT): {$(VPATH)}encoding.h
-eval.$(OBJEXT): {$(VPATH)}eval.c
-eval.$(OBJEXT): {$(VPATH)}eval_error.c
-eval.$(OBJEXT): {$(VPATH)}eval_intern.h
-eval.$(OBJEXT): {$(VPATH)}eval_jump.c
-eval.$(OBJEXT): {$(VPATH)}gc.h
-eval.$(OBJEXT): {$(VPATH)}id.h
-eval.$(OBJEXT): {$(VPATH)}intern.h
-eval.$(OBJEXT): {$(VPATH)}internal.h
-eval.$(OBJEXT): {$(VPATH)}io.h
-eval.$(OBJEXT): {$(VPATH)}iseq.h
-eval.$(OBJEXT): {$(VPATH)}method.h
-eval.$(OBJEXT): {$(VPATH)}missing.h
-eval.$(OBJEXT): {$(VPATH)}node.h
-eval.$(OBJEXT): {$(VPATH)}oniguruma.h
-eval.$(OBJEXT): {$(VPATH)}probes.h
-eval.$(OBJEXT): {$(VPATH)}probes_helper.h
-eval.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-eval.$(OBJEXT): {$(VPATH)}st.h
-eval.$(OBJEXT): {$(VPATH)}subst.h
-eval.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-eval.$(OBJEXT): {$(VPATH)}thread_native.h
-eval.$(OBJEXT): {$(VPATH)}vm.h
-eval.$(OBJEXT): {$(VPATH)}vm_core.h
-eval.$(OBJEXT): {$(VPATH)}vm_debug.h
-eval.$(OBJEXT): {$(VPATH)}vm_opts.h
-file.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-file.$(OBJEXT): $(top_srcdir)/include/ruby.h
-file.$(OBJEXT): {$(VPATH)}config.h
-file.$(OBJEXT): {$(VPATH)}defines.h
-file.$(OBJEXT): {$(VPATH)}dln.h
-file.$(OBJEXT): {$(VPATH)}encindex.h
-file.$(OBJEXT): {$(VPATH)}encoding.h
-file.$(OBJEXT): {$(VPATH)}file.c
-file.$(OBJEXT): {$(VPATH)}intern.h
-file.$(OBJEXT): {$(VPATH)}internal.h
-file.$(OBJEXT): {$(VPATH)}io.h
-file.$(OBJEXT): {$(VPATH)}missing.h
-file.$(OBJEXT): {$(VPATH)}oniguruma.h
-file.$(OBJEXT): {$(VPATH)}st.h
-file.$(OBJEXT): {$(VPATH)}subst.h
-file.$(OBJEXT): {$(VPATH)}util.h
-gc.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-gc.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-gc.$(OBJEXT): $(CCAN_DIR)/list/list.h
-gc.$(OBJEXT): $(CCAN_DIR)/str/str.h
-gc.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-gc.$(OBJEXT): $(top_srcdir)/include/ruby.h
-gc.$(OBJEXT): {$(VPATH)}config.h
-gc.$(OBJEXT): {$(VPATH)}constant.h
-gc.$(OBJEXT): {$(VPATH)}debug.h
-gc.$(OBJEXT): {$(VPATH)}defines.h
-gc.$(OBJEXT): {$(VPATH)}encoding.h
-gc.$(OBJEXT): {$(VPATH)}eval_intern.h
-gc.$(OBJEXT): {$(VPATH)}gc.c
-gc.$(OBJEXT): {$(VPATH)}gc.h
-gc.$(OBJEXT): {$(VPATH)}id.h
-gc.$(OBJEXT): {$(VPATH)}id_table.h
-gc.$(OBJEXT): {$(VPATH)}intern.h
-gc.$(OBJEXT): {$(VPATH)}internal.h
-gc.$(OBJEXT): {$(VPATH)}io.h
-gc.$(OBJEXT): {$(VPATH)}method.h
-gc.$(OBJEXT): {$(VPATH)}missing.h
-gc.$(OBJEXT): {$(VPATH)}node.h
-gc.$(OBJEXT): {$(VPATH)}oniguruma.h
-gc.$(OBJEXT): {$(VPATH)}probes.h
-gc.$(OBJEXT): {$(VPATH)}re.h
-gc.$(OBJEXT): {$(VPATH)}regenc.h
-gc.$(OBJEXT): {$(VPATH)}regex.h
-gc.$(OBJEXT): {$(VPATH)}regint.h
-gc.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-gc.$(OBJEXT): {$(VPATH)}st.h
-gc.$(OBJEXT): {$(VPATH)}subst.h
-gc.$(OBJEXT): {$(VPATH)}thread.h
-gc.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-gc.$(OBJEXT): {$(VPATH)}thread_native.h
-gc.$(OBJEXT): {$(VPATH)}util.h
-gc.$(OBJEXT): {$(VPATH)}vm_core.h
-gc.$(OBJEXT): {$(VPATH)}vm_debug.h
-gc.$(OBJEXT): {$(VPATH)}vm_opts.h
-golf_prelude.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-golf_prelude.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-golf_prelude.$(OBJEXT): $(CCAN_DIR)/list/list.h
-golf_prelude.$(OBJEXT): $(CCAN_DIR)/str/str.h
-golf_prelude.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-golf_prelude.$(OBJEXT): $(top_srcdir)/include/ruby.h
-golf_prelude.$(OBJEXT): {$(VPATH)}config.h
-golf_prelude.$(OBJEXT): {$(VPATH)}defines.h
-golf_prelude.$(OBJEXT): {$(VPATH)}encoding.h
-golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c
-golf_prelude.$(OBJEXT): {$(VPATH)}id.h
-golf_prelude.$(OBJEXT): {$(VPATH)}intern.h
-golf_prelude.$(OBJEXT): {$(VPATH)}internal.h
-golf_prelude.$(OBJEXT): {$(VPATH)}io.h
-golf_prelude.$(OBJEXT): {$(VPATH)}method.h
-golf_prelude.$(OBJEXT): {$(VPATH)}missing.h
-golf_prelude.$(OBJEXT): {$(VPATH)}node.h
-golf_prelude.$(OBJEXT): {$(VPATH)}oniguruma.h
-golf_prelude.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-golf_prelude.$(OBJEXT): {$(VPATH)}st.h
-golf_prelude.$(OBJEXT): {$(VPATH)}subst.h
-golf_prelude.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-golf_prelude.$(OBJEXT): {$(VPATH)}thread_native.h
-golf_prelude.$(OBJEXT): {$(VPATH)}vm_core.h
-golf_prelude.$(OBJEXT): {$(VPATH)}vm_debug.h
-golf_prelude.$(OBJEXT): {$(VPATH)}vm_opts.h
-goruby.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-goruby.$(OBJEXT): $(top_srcdir)/include/ruby.h
-goruby.$(OBJEXT): {$(VPATH)}config.h
-goruby.$(OBJEXT): {$(VPATH)}defines.h
-goruby.$(OBJEXT): {$(VPATH)}goruby.c
-goruby.$(OBJEXT): {$(VPATH)}intern.h
-goruby.$(OBJEXT): {$(VPATH)}main.c
-goruby.$(OBJEXT): {$(VPATH)}missing.h
-goruby.$(OBJEXT): {$(VPATH)}node.h
-goruby.$(OBJEXT): {$(VPATH)}st.h
-goruby.$(OBJEXT): {$(VPATH)}subst.h
-goruby.$(OBJEXT): {$(VPATH)}vm_debug.h
-hash.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-hash.$(OBJEXT): $(top_srcdir)/include/ruby.h
-hash.$(OBJEXT): {$(VPATH)}config.h
-hash.$(OBJEXT): {$(VPATH)}defines.h
-hash.$(OBJEXT): {$(VPATH)}encoding.h
-hash.$(OBJEXT): {$(VPATH)}hash.c
-hash.$(OBJEXT): {$(VPATH)}id.h
-hash.$(OBJEXT): {$(VPATH)}intern.h
-hash.$(OBJEXT): {$(VPATH)}internal.h
-hash.$(OBJEXT): {$(VPATH)}io.h
-hash.$(OBJEXT): {$(VPATH)}missing.h
-hash.$(OBJEXT): {$(VPATH)}oniguruma.h
-hash.$(OBJEXT): {$(VPATH)}probes.h
-hash.$(OBJEXT): {$(VPATH)}st.h
-hash.$(OBJEXT): {$(VPATH)}subst.h
-hash.$(OBJEXT): {$(VPATH)}symbol.h
-hash.$(OBJEXT): {$(VPATH)}util.h
-hash.$(OBJEXT): {$(VPATH)}vm_opts.h
-inits.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-inits.$(OBJEXT): $(top_srcdir)/include/ruby.h
-inits.$(OBJEXT): {$(VPATH)}config.h
-inits.$(OBJEXT): {$(VPATH)}defines.h
-inits.$(OBJEXT): {$(VPATH)}encoding.h
-inits.$(OBJEXT): {$(VPATH)}inits.c
-inits.$(OBJEXT): {$(VPATH)}intern.h
-inits.$(OBJEXT): {$(VPATH)}internal.h
-inits.$(OBJEXT): {$(VPATH)}io.h
-inits.$(OBJEXT): {$(VPATH)}missing.h
-inits.$(OBJEXT): {$(VPATH)}oniguruma.h
-inits.$(OBJEXT): {$(VPATH)}st.h
-inits.$(OBJEXT): {$(VPATH)}subst.h
-io.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-io.$(OBJEXT): $(top_srcdir)/include/ruby.h
-io.$(OBJEXT): {$(VPATH)}config.h
-io.$(OBJEXT): {$(VPATH)}defines.h
-io.$(OBJEXT): {$(VPATH)}dln.h
-io.$(OBJEXT): {$(VPATH)}encindex.h
-io.$(OBJEXT): {$(VPATH)}encoding.h
-io.$(OBJEXT): {$(VPATH)}id.h
-io.$(OBJEXT): {$(VPATH)}intern.h
-io.$(OBJEXT): {$(VPATH)}internal.h
-io.$(OBJEXT): {$(VPATH)}io.c
-io.$(OBJEXT): {$(VPATH)}io.h
-io.$(OBJEXT): {$(VPATH)}missing.h
-io.$(OBJEXT): {$(VPATH)}oniguruma.h
-io.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-io.$(OBJEXT): {$(VPATH)}st.h
-io.$(OBJEXT): {$(VPATH)}subst.h
-io.$(OBJEXT): {$(VPATH)}thread.h
-io.$(OBJEXT): {$(VPATH)}util.h
-iseq.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-iseq.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-iseq.$(OBJEXT): $(CCAN_DIR)/list/list.h
-iseq.$(OBJEXT): $(CCAN_DIR)/str/str.h
-iseq.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-iseq.$(OBJEXT): $(top_srcdir)/include/ruby.h
-iseq.$(OBJEXT): {$(VPATH)}config.h
-iseq.$(OBJEXT): {$(VPATH)}defines.h
-iseq.$(OBJEXT): {$(VPATH)}encoding.h
-iseq.$(OBJEXT): {$(VPATH)}eval_intern.h
-iseq.$(OBJEXT): {$(VPATH)}gc.h
-iseq.$(OBJEXT): {$(VPATH)}id.h
-iseq.$(OBJEXT): {$(VPATH)}insns.inc
-iseq.$(OBJEXT): {$(VPATH)}insns_info.inc
-iseq.$(OBJEXT): {$(VPATH)}intern.h
-iseq.$(OBJEXT): {$(VPATH)}internal.h
-iseq.$(OBJEXT): {$(VPATH)}io.h
-iseq.$(OBJEXT): {$(VPATH)}iseq.c
-iseq.$(OBJEXT): {$(VPATH)}iseq.h
-iseq.$(OBJEXT): {$(VPATH)}method.h
-iseq.$(OBJEXT): {$(VPATH)}missing.h
-iseq.$(OBJEXT): {$(VPATH)}node.h
-iseq.$(OBJEXT): {$(VPATH)}node_name.inc
-iseq.$(OBJEXT): {$(VPATH)}oniguruma.h
-iseq.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-iseq.$(OBJEXT): {$(VPATH)}st.h
-iseq.$(OBJEXT): {$(VPATH)}subst.h
-iseq.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-iseq.$(OBJEXT): {$(VPATH)}thread_native.h
-iseq.$(OBJEXT): {$(VPATH)}util.h
-iseq.$(OBJEXT): {$(VPATH)}vm_core.h
-iseq.$(OBJEXT): {$(VPATH)}vm_debug.h
-iseq.$(OBJEXT): {$(VPATH)}vm_opts.h
-load.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-load.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-load.$(OBJEXT): $(CCAN_DIR)/list/list.h
-load.$(OBJEXT): $(CCAN_DIR)/str/str.h
-load.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-load.$(OBJEXT): $(top_srcdir)/include/ruby.h
-load.$(OBJEXT): {$(VPATH)}config.h
-load.$(OBJEXT): {$(VPATH)}defines.h
-load.$(OBJEXT): {$(VPATH)}dln.h
-load.$(OBJEXT): {$(VPATH)}encoding.h
-load.$(OBJEXT): {$(VPATH)}eval_intern.h
-load.$(OBJEXT): {$(VPATH)}id.h
-load.$(OBJEXT): {$(VPATH)}intern.h
-load.$(OBJEXT): {$(VPATH)}internal.h
-load.$(OBJEXT): {$(VPATH)}io.h
-load.$(OBJEXT): {$(VPATH)}load.c
-load.$(OBJEXT): {$(VPATH)}method.h
-load.$(OBJEXT): {$(VPATH)}missing.h
-load.$(OBJEXT): {$(VPATH)}node.h
-load.$(OBJEXT): {$(VPATH)}oniguruma.h
-load.$(OBJEXT): {$(VPATH)}probes.h
-load.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-load.$(OBJEXT): {$(VPATH)}st.h
-load.$(OBJEXT): {$(VPATH)}subst.h
-load.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-load.$(OBJEXT): {$(VPATH)}thread_native.h
-load.$(OBJEXT): {$(VPATH)}util.h
-load.$(OBJEXT): {$(VPATH)}vm_core.h
-load.$(OBJEXT): {$(VPATH)}vm_debug.h
-load.$(OBJEXT): {$(VPATH)}vm_opts.h
-loadpath.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-loadpath.$(OBJEXT): $(hdrdir)/ruby/version.h
-loadpath.$(OBJEXT): $(top_srcdir)/version.h
-loadpath.$(OBJEXT): {$(VPATH)}config.h
-loadpath.$(OBJEXT): {$(VPATH)}defines.h
-loadpath.$(OBJEXT): {$(VPATH)}intern.h
-loadpath.$(OBJEXT): {$(VPATH)}loadpath.c
-loadpath.$(OBJEXT): {$(VPATH)}missing.h
-loadpath.$(OBJEXT): {$(VPATH)}st.h
-loadpath.$(OBJEXT): {$(VPATH)}subst.h
-loadpath.$(OBJEXT): {$(VPATH)}verconf.h
-localeinit.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-localeinit.$(OBJEXT): $(top_srcdir)/include/ruby.h
-localeinit.$(OBJEXT): {$(VPATH)}config.h
-localeinit.$(OBJEXT): {$(VPATH)}defines.h
-localeinit.$(OBJEXT): {$(VPATH)}encindex.h
-localeinit.$(OBJEXT): {$(VPATH)}encoding.h
-localeinit.$(OBJEXT): {$(VPATH)}intern.h
-localeinit.$(OBJEXT): {$(VPATH)}internal.h
-localeinit.$(OBJEXT): {$(VPATH)}io.h
-localeinit.$(OBJEXT): {$(VPATH)}localeinit.c
-localeinit.$(OBJEXT): {$(VPATH)}missing.h
-localeinit.$(OBJEXT): {$(VPATH)}oniguruma.h
-localeinit.$(OBJEXT): {$(VPATH)}st.h
-localeinit.$(OBJEXT): {$(VPATH)}subst.h
-main.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-main.$(OBJEXT): $(top_srcdir)/include/ruby.h
-main.$(OBJEXT): {$(VPATH)}config.h
-main.$(OBJEXT): {$(VPATH)}defines.h
-main.$(OBJEXT): {$(VPATH)}intern.h
-main.$(OBJEXT): {$(VPATH)}main.c
-main.$(OBJEXT): {$(VPATH)}missing.h
-main.$(OBJEXT): {$(VPATH)}node.h
-main.$(OBJEXT): {$(VPATH)}st.h
-main.$(OBJEXT): {$(VPATH)}subst.h
-main.$(OBJEXT): {$(VPATH)}vm_debug.h
-marshal.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-marshal.$(OBJEXT): $(top_srcdir)/include/ruby.h
-marshal.$(OBJEXT): {$(VPATH)}config.h
-marshal.$(OBJEXT): {$(VPATH)}defines.h
-marshal.$(OBJEXT): {$(VPATH)}encindex.h
-marshal.$(OBJEXT): {$(VPATH)}encoding.h
-marshal.$(OBJEXT): {$(VPATH)}id_table.h
-marshal.$(OBJEXT): {$(VPATH)}intern.h
-marshal.$(OBJEXT): {$(VPATH)}internal.h
-marshal.$(OBJEXT): {$(VPATH)}io.h
-marshal.$(OBJEXT): {$(VPATH)}marshal.c
-marshal.$(OBJEXT): {$(VPATH)}missing.h
-marshal.$(OBJEXT): {$(VPATH)}oniguruma.h
-marshal.$(OBJEXT): {$(VPATH)}st.h
-marshal.$(OBJEXT): {$(VPATH)}subst.h
-marshal.$(OBJEXT): {$(VPATH)}util.h
-math.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-math.$(OBJEXT): $(top_srcdir)/include/ruby.h
-math.$(OBJEXT): {$(VPATH)}config.h
-math.$(OBJEXT): {$(VPATH)}defines.h
-math.$(OBJEXT): {$(VPATH)}encoding.h
-math.$(OBJEXT): {$(VPATH)}intern.h
-math.$(OBJEXT): {$(VPATH)}internal.h
-math.$(OBJEXT): {$(VPATH)}io.h
-math.$(OBJEXT): {$(VPATH)}math.c
-math.$(OBJEXT): {$(VPATH)}missing.h
-math.$(OBJEXT): {$(VPATH)}oniguruma.h
-math.$(OBJEXT): {$(VPATH)}st.h
-math.$(OBJEXT): {$(VPATH)}subst.h
-miniinit.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-miniinit.$(OBJEXT): {$(VPATH)}config.h
-miniinit.$(OBJEXT): {$(VPATH)}defines.h
-miniinit.$(OBJEXT): {$(VPATH)}encoding.h
-miniinit.$(OBJEXT): {$(VPATH)}intern.h
-miniinit.$(OBJEXT): {$(VPATH)}miniinit.c
-miniinit.$(OBJEXT): {$(VPATH)}missing.h
-miniinit.$(OBJEXT): {$(VPATH)}oniguruma.h
-miniinit.$(OBJEXT): {$(VPATH)}st.h
-miniinit.$(OBJEXT): {$(VPATH)}subst.h
-miniprelude.$(OBJEXT): {$(VPATH)}miniprelude.c
-node.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-node.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-node.$(OBJEXT): $(CCAN_DIR)/list/list.h
-node.$(OBJEXT): $(CCAN_DIR)/str/str.h
-node.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-node.$(OBJEXT): $(top_srcdir)/include/ruby.h
-node.$(OBJEXT): {$(VPATH)}config.h
-node.$(OBJEXT): {$(VPATH)}defines.h
-node.$(OBJEXT): {$(VPATH)}encoding.h
-node.$(OBJEXT): {$(VPATH)}id.h
-node.$(OBJEXT): {$(VPATH)}intern.h
-node.$(OBJEXT): {$(VPATH)}internal.h
-node.$(OBJEXT): {$(VPATH)}io.h
-node.$(OBJEXT): {$(VPATH)}method.h
-node.$(OBJEXT): {$(VPATH)}missing.h
-node.$(OBJEXT): {$(VPATH)}node.c
-node.$(OBJEXT): {$(VPATH)}node.h
-node.$(OBJEXT): {$(VPATH)}oniguruma.h
-node.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-node.$(OBJEXT): {$(VPATH)}st.h
-node.$(OBJEXT): {$(VPATH)}subst.h
-node.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-node.$(OBJEXT): {$(VPATH)}thread_native.h
-node.$(OBJEXT): {$(VPATH)}vm_core.h
-node.$(OBJEXT): {$(VPATH)}vm_debug.h
-node.$(OBJEXT): {$(VPATH)}vm_opts.h
-numeric.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-numeric.$(OBJEXT): $(top_srcdir)/include/ruby.h
-numeric.$(OBJEXT): {$(VPATH)}config.h
-numeric.$(OBJEXT): {$(VPATH)}defines.h
-numeric.$(OBJEXT): {$(VPATH)}encoding.h
-numeric.$(OBJEXT): {$(VPATH)}id.h
-numeric.$(OBJEXT): {$(VPATH)}intern.h
-numeric.$(OBJEXT): {$(VPATH)}internal.h
-numeric.$(OBJEXT): {$(VPATH)}io.h
-numeric.$(OBJEXT): {$(VPATH)}missing.h
-numeric.$(OBJEXT): {$(VPATH)}numeric.c
-numeric.$(OBJEXT): {$(VPATH)}oniguruma.h
-numeric.$(OBJEXT): {$(VPATH)}st.h
-numeric.$(OBJEXT): {$(VPATH)}subst.h
-numeric.$(OBJEXT): {$(VPATH)}util.h
-object.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-object.$(OBJEXT): $(top_srcdir)/include/ruby.h
-object.$(OBJEXT): {$(VPATH)}config.h
-object.$(OBJEXT): {$(VPATH)}constant.h
-object.$(OBJEXT): {$(VPATH)}defines.h
-object.$(OBJEXT): {$(VPATH)}encoding.h
-object.$(OBJEXT): {$(VPATH)}id.h
-object.$(OBJEXT): {$(VPATH)}intern.h
-object.$(OBJEXT): {$(VPATH)}internal.h
-object.$(OBJEXT): {$(VPATH)}io.h
-object.$(OBJEXT): {$(VPATH)}missing.h
-object.$(OBJEXT): {$(VPATH)}object.c
-object.$(OBJEXT): {$(VPATH)}oniguruma.h
-object.$(OBJEXT): {$(VPATH)}probes.h
-object.$(OBJEXT): {$(VPATH)}st.h
-object.$(OBJEXT): {$(VPATH)}subst.h
-object.$(OBJEXT): {$(VPATH)}util.h
-object.$(OBJEXT): {$(VPATH)}vm_opts.h
-pack.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-pack.$(OBJEXT): $(top_srcdir)/include/ruby.h
-pack.$(OBJEXT): {$(VPATH)}config.h
-pack.$(OBJEXT): {$(VPATH)}defines.h
-pack.$(OBJEXT): {$(VPATH)}encoding.h
-pack.$(OBJEXT): {$(VPATH)}intern.h
-pack.$(OBJEXT): {$(VPATH)}internal.h
-pack.$(OBJEXT): {$(VPATH)}io.h
-pack.$(OBJEXT): {$(VPATH)}missing.h
-pack.$(OBJEXT): {$(VPATH)}oniguruma.h
-pack.$(OBJEXT): {$(VPATH)}pack.c
-pack.$(OBJEXT): {$(VPATH)}st.h
-pack.$(OBJEXT): {$(VPATH)}subst.h
-parse.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-parse.$(OBJEXT): $(top_srcdir)/include/ruby.h
-parse.$(OBJEXT): {$(VPATH)}config.h
-parse.$(OBJEXT): {$(VPATH)}defines.h
-parse.$(OBJEXT): {$(VPATH)}defs/keywords
-parse.$(OBJEXT): {$(VPATH)}encoding.h
-parse.$(OBJEXT): {$(VPATH)}id.h
-parse.$(OBJEXT): {$(VPATH)}intern.h
-parse.$(OBJEXT): {$(VPATH)}internal.h
-parse.$(OBJEXT): {$(VPATH)}io.h
-parse.$(OBJEXT): {$(VPATH)}lex.c
-parse.$(OBJEXT): {$(VPATH)}missing.h
-parse.$(OBJEXT): {$(VPATH)}node.h
-parse.$(OBJEXT): {$(VPATH)}oniguruma.h
-parse.$(OBJEXT): {$(VPATH)}parse.c
-parse.$(OBJEXT): {$(VPATH)}parse.h
-parse.$(OBJEXT): {$(VPATH)}parse.y
-parse.$(OBJEXT): {$(VPATH)}probes.h
-parse.$(OBJEXT): {$(VPATH)}regenc.h
-parse.$(OBJEXT): {$(VPATH)}regex.h
-parse.$(OBJEXT): {$(VPATH)}st.h
-parse.$(OBJEXT): {$(VPATH)}subst.h
-parse.$(OBJEXT): {$(VPATH)}symbol.h
-parse.$(OBJEXT): {$(VPATH)}util.h
-parse.$(OBJEXT): {$(VPATH)}vm_opts.h
-prelude.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-prelude.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-prelude.$(OBJEXT): $(CCAN_DIR)/list/list.h
-prelude.$(OBJEXT): $(CCAN_DIR)/str/str.h
-prelude.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-prelude.$(OBJEXT): $(top_srcdir)/include/ruby.h
-prelude.$(OBJEXT): {$(VPATH)}config.h
-prelude.$(OBJEXT): {$(VPATH)}defines.h
-prelude.$(OBJEXT): {$(VPATH)}encoding.h
-prelude.$(OBJEXT): {$(VPATH)}id.h
-prelude.$(OBJEXT): {$(VPATH)}intern.h
-prelude.$(OBJEXT): {$(VPATH)}internal.h
-prelude.$(OBJEXT): {$(VPATH)}io.h
-prelude.$(OBJEXT): {$(VPATH)}method.h
-prelude.$(OBJEXT): {$(VPATH)}missing.h
-prelude.$(OBJEXT): {$(VPATH)}node.h
-prelude.$(OBJEXT): {$(VPATH)}oniguruma.h
-prelude.$(OBJEXT): {$(VPATH)}prelude.c
-prelude.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-prelude.$(OBJEXT): {$(VPATH)}st.h
-prelude.$(OBJEXT): {$(VPATH)}subst.h
-prelude.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-prelude.$(OBJEXT): {$(VPATH)}thread_native.h
-prelude.$(OBJEXT): {$(VPATH)}vm_core.h
-prelude.$(OBJEXT): {$(VPATH)}vm_debug.h
-prelude.$(OBJEXT): {$(VPATH)}vm_opts.h
-proc.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-proc.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-proc.$(OBJEXT): $(CCAN_DIR)/list/list.h
-proc.$(OBJEXT): $(CCAN_DIR)/str/str.h
-proc.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-proc.$(OBJEXT): $(top_srcdir)/include/ruby.h
-proc.$(OBJEXT): {$(VPATH)}config.h
-proc.$(OBJEXT): {$(VPATH)}defines.h
-proc.$(OBJEXT): {$(VPATH)}encoding.h
-proc.$(OBJEXT): {$(VPATH)}eval_intern.h
-proc.$(OBJEXT): {$(VPATH)}gc.h
-proc.$(OBJEXT): {$(VPATH)}id.h
-proc.$(OBJEXT): {$(VPATH)}intern.h
-proc.$(OBJEXT): {$(VPATH)}internal.h
-proc.$(OBJEXT): {$(VPATH)}io.h
-proc.$(OBJEXT): {$(VPATH)}iseq.h
-proc.$(OBJEXT): {$(VPATH)}method.h
-proc.$(OBJEXT): {$(VPATH)}missing.h
-proc.$(OBJEXT): {$(VPATH)}node.h
-proc.$(OBJEXT): {$(VPATH)}oniguruma.h
-proc.$(OBJEXT): {$(VPATH)}proc.c
-proc.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-proc.$(OBJEXT): {$(VPATH)}st.h
-proc.$(OBJEXT): {$(VPATH)}subst.h
-proc.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-proc.$(OBJEXT): {$(VPATH)}thread_native.h
-proc.$(OBJEXT): {$(VPATH)}vm_core.h
-proc.$(OBJEXT): {$(VPATH)}vm_debug.h
-proc.$(OBJEXT): {$(VPATH)}vm_opts.h
-process.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-process.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-process.$(OBJEXT): $(CCAN_DIR)/list/list.h
-process.$(OBJEXT): $(CCAN_DIR)/str/str.h
-process.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-process.$(OBJEXT): $(top_srcdir)/include/ruby.h
-process.$(OBJEXT): {$(VPATH)}config.h
-process.$(OBJEXT): {$(VPATH)}defines.h
-process.$(OBJEXT): {$(VPATH)}dln.h
-process.$(OBJEXT): {$(VPATH)}encoding.h
-process.$(OBJEXT): {$(VPATH)}id.h
-process.$(OBJEXT): {$(VPATH)}intern.h
-process.$(OBJEXT): {$(VPATH)}internal.h
-process.$(OBJEXT): {$(VPATH)}io.h
-process.$(OBJEXT): {$(VPATH)}method.h
-process.$(OBJEXT): {$(VPATH)}missing.h
-process.$(OBJEXT): {$(VPATH)}node.h
-process.$(OBJEXT): {$(VPATH)}oniguruma.h
-process.$(OBJEXT): {$(VPATH)}process.c
-process.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-process.$(OBJEXT): {$(VPATH)}st.h
-process.$(OBJEXT): {$(VPATH)}subst.h
-process.$(OBJEXT): {$(VPATH)}thread.h
-process.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-process.$(OBJEXT): {$(VPATH)}thread_native.h
-process.$(OBJEXT): {$(VPATH)}util.h
-process.$(OBJEXT): {$(VPATH)}vm_core.h
-process.$(OBJEXT): {$(VPATH)}vm_debug.h
-process.$(OBJEXT): {$(VPATH)}vm_opts.h
-random.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-random.$(OBJEXT): $(top_srcdir)/include/ruby.h
-random.$(OBJEXT): {$(VPATH)}config.h
-random.$(OBJEXT): {$(VPATH)}defines.h
-random.$(OBJEXT): {$(VPATH)}encoding.h
-random.$(OBJEXT): {$(VPATH)}intern.h
-random.$(OBJEXT): {$(VPATH)}internal.h
-random.$(OBJEXT): {$(VPATH)}io.h
-random.$(OBJEXT): {$(VPATH)}missing.h
-random.$(OBJEXT): {$(VPATH)}oniguruma.h
-random.$(OBJEXT): {$(VPATH)}random.c
-random.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-random.$(OBJEXT): {$(VPATH)}siphash.c
-random.$(OBJEXT): {$(VPATH)}siphash.h
-random.$(OBJEXT): {$(VPATH)}st.h
-random.$(OBJEXT): {$(VPATH)}subst.h
-range.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-range.$(OBJEXT): $(top_srcdir)/include/ruby.h
-range.$(OBJEXT): {$(VPATH)}config.h
-range.$(OBJEXT): {$(VPATH)}defines.h
-range.$(OBJEXT): {$(VPATH)}encoding.h
-range.$(OBJEXT): {$(VPATH)}id.h
-range.$(OBJEXT): {$(VPATH)}intern.h
-range.$(OBJEXT): {$(VPATH)}internal.h
-range.$(OBJEXT): {$(VPATH)}io.h
-range.$(OBJEXT): {$(VPATH)}missing.h
-range.$(OBJEXT): {$(VPATH)}oniguruma.h
-range.$(OBJEXT): {$(VPATH)}range.c
-range.$(OBJEXT): {$(VPATH)}st.h
-range.$(OBJEXT): {$(VPATH)}subst.h
-rational.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-rational.$(OBJEXT): $(top_srcdir)/include/ruby.h
-rational.$(OBJEXT): {$(VPATH)}config.h
-rational.$(OBJEXT): {$(VPATH)}defines.h
-rational.$(OBJEXT): {$(VPATH)}encoding.h
-rational.$(OBJEXT): {$(VPATH)}intern.h
-rational.$(OBJEXT): {$(VPATH)}internal.h
-rational.$(OBJEXT): {$(VPATH)}io.h
-rational.$(OBJEXT): {$(VPATH)}missing.h
-rational.$(OBJEXT): {$(VPATH)}oniguruma.h
-rational.$(OBJEXT): {$(VPATH)}rational.c
-rational.$(OBJEXT): {$(VPATH)}st.h
-rational.$(OBJEXT): {$(VPATH)}subst.h
-re.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-re.$(OBJEXT): $(top_srcdir)/include/ruby.h
-re.$(OBJEXT): {$(VPATH)}config.h
-re.$(OBJEXT): {$(VPATH)}defines.h
-re.$(OBJEXT): {$(VPATH)}encindex.h
-re.$(OBJEXT): {$(VPATH)}encoding.h
-re.$(OBJEXT): {$(VPATH)}intern.h
-re.$(OBJEXT): {$(VPATH)}internal.h
-re.$(OBJEXT): {$(VPATH)}io.h
-re.$(OBJEXT): {$(VPATH)}missing.h
-re.$(OBJEXT): {$(VPATH)}oniguruma.h
-re.$(OBJEXT): {$(VPATH)}re.c
-re.$(OBJEXT): {$(VPATH)}re.h
-re.$(OBJEXT): {$(VPATH)}regenc.h
-re.$(OBJEXT): {$(VPATH)}regex.h
-re.$(OBJEXT): {$(VPATH)}regint.h
-re.$(OBJEXT): {$(VPATH)}st.h
-re.$(OBJEXT): {$(VPATH)}subst.h
-re.$(OBJEXT): {$(VPATH)}util.h
-regcomp.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-regcomp.$(OBJEXT): {$(VPATH)}config.h
-regcomp.$(OBJEXT): {$(VPATH)}defines.h
-regcomp.$(OBJEXT): {$(VPATH)}intern.h
-regcomp.$(OBJEXT): {$(VPATH)}missing.h
-regcomp.$(OBJEXT): {$(VPATH)}oniguruma.h
-regcomp.$(OBJEXT): {$(VPATH)}regcomp.c
-regcomp.$(OBJEXT): {$(VPATH)}regenc.h
-regcomp.$(OBJEXT): {$(VPATH)}regint.h
-regcomp.$(OBJEXT): {$(VPATH)}regparse.h
-regcomp.$(OBJEXT): {$(VPATH)}st.h
-regcomp.$(OBJEXT): {$(VPATH)}subst.h
-regenc.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-regenc.$(OBJEXT): {$(VPATH)}config.h
-regenc.$(OBJEXT): {$(VPATH)}defines.h
-regenc.$(OBJEXT): {$(VPATH)}intern.h
-regenc.$(OBJEXT): {$(VPATH)}missing.h
-regenc.$(OBJEXT): {$(VPATH)}oniguruma.h
-regenc.$(OBJEXT): {$(VPATH)}regenc.c
-regenc.$(OBJEXT): {$(VPATH)}regenc.h
-regenc.$(OBJEXT): {$(VPATH)}regint.h
-regenc.$(OBJEXT): {$(VPATH)}st.h
-regenc.$(OBJEXT): {$(VPATH)}subst.h
-regerror.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-regerror.$(OBJEXT): {$(VPATH)}config.h
-regerror.$(OBJEXT): {$(VPATH)}defines.h
-regerror.$(OBJEXT): {$(VPATH)}intern.h
-regerror.$(OBJEXT): {$(VPATH)}missing.h
-regerror.$(OBJEXT): {$(VPATH)}oniguruma.h
-regerror.$(OBJEXT): {$(VPATH)}regenc.h
-regerror.$(OBJEXT): {$(VPATH)}regerror.c
-regerror.$(OBJEXT): {$(VPATH)}regint.h
-regerror.$(OBJEXT): {$(VPATH)}st.h
-regerror.$(OBJEXT): {$(VPATH)}subst.h
-regexec.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-regexec.$(OBJEXT): {$(VPATH)}config.h
-regexec.$(OBJEXT): {$(VPATH)}defines.h
-regexec.$(OBJEXT): {$(VPATH)}intern.h
-regexec.$(OBJEXT): {$(VPATH)}missing.h
-regexec.$(OBJEXT): {$(VPATH)}oniguruma.h
-regexec.$(OBJEXT): {$(VPATH)}regenc.h
-regexec.$(OBJEXT): {$(VPATH)}regexec.c
-regexec.$(OBJEXT): {$(VPATH)}regint.h
-regexec.$(OBJEXT): {$(VPATH)}st.h
-regexec.$(OBJEXT): {$(VPATH)}subst.h
-regparse.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-regparse.$(OBJEXT): {$(VPATH)}config.h
-regparse.$(OBJEXT): {$(VPATH)}defines.h
-regparse.$(OBJEXT): {$(VPATH)}intern.h
-regparse.$(OBJEXT): {$(VPATH)}missing.h
-regparse.$(OBJEXT): {$(VPATH)}oniguruma.h
-regparse.$(OBJEXT): {$(VPATH)}regenc.h
-regparse.$(OBJEXT): {$(VPATH)}regint.h
-regparse.$(OBJEXT): {$(VPATH)}regparse.c
-regparse.$(OBJEXT): {$(VPATH)}regparse.h
-regparse.$(OBJEXT): {$(VPATH)}st.h
-regparse.$(OBJEXT): {$(VPATH)}subst.h
-regsyntax.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-regsyntax.$(OBJEXT): {$(VPATH)}config.h
-regsyntax.$(OBJEXT): {$(VPATH)}defines.h
-regsyntax.$(OBJEXT): {$(VPATH)}intern.h
-regsyntax.$(OBJEXT): {$(VPATH)}missing.h
-regsyntax.$(OBJEXT): {$(VPATH)}oniguruma.h
-regsyntax.$(OBJEXT): {$(VPATH)}regenc.h
-regsyntax.$(OBJEXT): {$(VPATH)}regint.h
-regsyntax.$(OBJEXT): {$(VPATH)}regsyntax.c
-regsyntax.$(OBJEXT): {$(VPATH)}st.h
-regsyntax.$(OBJEXT): {$(VPATH)}subst.h
-ruby.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-ruby.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-ruby.$(OBJEXT): $(CCAN_DIR)/list/list.h
-ruby.$(OBJEXT): $(CCAN_DIR)/str/str.h
-ruby.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-ruby.$(OBJEXT): $(top_srcdir)/include/ruby.h
-ruby.$(OBJEXT): {$(VPATH)}config.h
-ruby.$(OBJEXT): {$(VPATH)}defines.h
-ruby.$(OBJEXT): {$(VPATH)}dln.h
-ruby.$(OBJEXT): {$(VPATH)}encoding.h
-ruby.$(OBJEXT): {$(VPATH)}eval_intern.h
-ruby.$(OBJEXT): {$(VPATH)}id.h
-ruby.$(OBJEXT): {$(VPATH)}intern.h
-ruby.$(OBJEXT): {$(VPATH)}internal.h
-ruby.$(OBJEXT): {$(VPATH)}io.h
-ruby.$(OBJEXT): {$(VPATH)}method.h
-ruby.$(OBJEXT): {$(VPATH)}missing.h
-ruby.$(OBJEXT): {$(VPATH)}node.h
-ruby.$(OBJEXT): {$(VPATH)}oniguruma.h
-ruby.$(OBJEXT): {$(VPATH)}ruby.c
-ruby.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-ruby.$(OBJEXT): {$(VPATH)}st.h
-ruby.$(OBJEXT): {$(VPATH)}subst.h
-ruby.$(OBJEXT): {$(VPATH)}thread.h
-ruby.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-ruby.$(OBJEXT): {$(VPATH)}thread_native.h
-ruby.$(OBJEXT): {$(VPATH)}util.h
-ruby.$(OBJEXT): {$(VPATH)}vm_core.h
-ruby.$(OBJEXT): {$(VPATH)}vm_debug.h
-ruby.$(OBJEXT): {$(VPATH)}vm_opts.h
-safe.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-safe.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-safe.$(OBJEXT): $(CCAN_DIR)/list/list.h
-safe.$(OBJEXT): $(CCAN_DIR)/str/str.h
-safe.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-safe.$(OBJEXT): $(top_srcdir)/include/ruby.h
-safe.$(OBJEXT): {$(VPATH)}config.h
-safe.$(OBJEXT): {$(VPATH)}defines.h
-safe.$(OBJEXT): {$(VPATH)}encoding.h
-safe.$(OBJEXT): {$(VPATH)}id.h
-safe.$(OBJEXT): {$(VPATH)}intern.h
-safe.$(OBJEXT): {$(VPATH)}internal.h
-safe.$(OBJEXT): {$(VPATH)}io.h
-safe.$(OBJEXT): {$(VPATH)}method.h
-safe.$(OBJEXT): {$(VPATH)}missing.h
-safe.$(OBJEXT): {$(VPATH)}node.h
-safe.$(OBJEXT): {$(VPATH)}oniguruma.h
-safe.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-safe.$(OBJEXT): {$(VPATH)}safe.c
-safe.$(OBJEXT): {$(VPATH)}st.h
-safe.$(OBJEXT): {$(VPATH)}subst.h
-safe.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-safe.$(OBJEXT): {$(VPATH)}thread_native.h
-safe.$(OBJEXT): {$(VPATH)}vm_core.h
-safe.$(OBJEXT): {$(VPATH)}vm_debug.h
-safe.$(OBJEXT): {$(VPATH)}vm_opts.h
-setproctitle.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-setproctitle.$(OBJEXT): $(top_srcdir)/include/ruby.h
-setproctitle.$(OBJEXT): {$(VPATH)}config.h
-setproctitle.$(OBJEXT): {$(VPATH)}defines.h
-setproctitle.$(OBJEXT): {$(VPATH)}intern.h
-setproctitle.$(OBJEXT): {$(VPATH)}missing.h
-setproctitle.$(OBJEXT): {$(VPATH)}setproctitle.c
-setproctitle.$(OBJEXT): {$(VPATH)}st.h
-setproctitle.$(OBJEXT): {$(VPATH)}subst.h
-setproctitle.$(OBJEXT): {$(VPATH)}util.h
-signal.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-signal.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-signal.$(OBJEXT): $(CCAN_DIR)/list/list.h
-signal.$(OBJEXT): $(CCAN_DIR)/str/str.h
-signal.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-signal.$(OBJEXT): $(top_srcdir)/include/ruby.h
-signal.$(OBJEXT): {$(VPATH)}config.h
-signal.$(OBJEXT): {$(VPATH)}defines.h
-signal.$(OBJEXT): {$(VPATH)}encoding.h
-signal.$(OBJEXT): {$(VPATH)}eval_intern.h
-signal.$(OBJEXT): {$(VPATH)}id.h
-signal.$(OBJEXT): {$(VPATH)}intern.h
-signal.$(OBJEXT): {$(VPATH)}internal.h
-signal.$(OBJEXT): {$(VPATH)}io.h
-signal.$(OBJEXT): {$(VPATH)}method.h
-signal.$(OBJEXT): {$(VPATH)}missing.h
-signal.$(OBJEXT): {$(VPATH)}node.h
-signal.$(OBJEXT): {$(VPATH)}oniguruma.h
-signal.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-signal.$(OBJEXT): {$(VPATH)}signal.c
-signal.$(OBJEXT): {$(VPATH)}st.h
-signal.$(OBJEXT): {$(VPATH)}subst.h
-signal.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-signal.$(OBJEXT): {$(VPATH)}thread_native.h
-signal.$(OBJEXT): {$(VPATH)}vm_core.h
-signal.$(OBJEXT): {$(VPATH)}vm_debug.h
-signal.$(OBJEXT): {$(VPATH)}vm_opts.h
-sprintf.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-sprintf.$(OBJEXT): $(top_srcdir)/include/ruby.h
-sprintf.$(OBJEXT): {$(VPATH)}config.h
-sprintf.$(OBJEXT): {$(VPATH)}defines.h
-sprintf.$(OBJEXT): {$(VPATH)}encoding.h
-sprintf.$(OBJEXT): {$(VPATH)}id.h
-sprintf.$(OBJEXT): {$(VPATH)}intern.h
-sprintf.$(OBJEXT): {$(VPATH)}internal.h
-sprintf.$(OBJEXT): {$(VPATH)}io.h
-sprintf.$(OBJEXT): {$(VPATH)}missing.h
-sprintf.$(OBJEXT): {$(VPATH)}oniguruma.h
-sprintf.$(OBJEXT): {$(VPATH)}re.h
-sprintf.$(OBJEXT): {$(VPATH)}regex.h
-sprintf.$(OBJEXT): {$(VPATH)}sprintf.c
-sprintf.$(OBJEXT): {$(VPATH)}st.h
-sprintf.$(OBJEXT): {$(VPATH)}subst.h
-sprintf.$(OBJEXT): {$(VPATH)}vsnprintf.c
-st.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-st.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-st.$(OBJEXT): $(CCAN_DIR)/list/list.h
-st.$(OBJEXT): $(CCAN_DIR)/str/str.h
-st.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-st.$(OBJEXT): $(top_srcdir)/include/ruby.h
-st.$(OBJEXT): {$(VPATH)}config.h
-st.$(OBJEXT): {$(VPATH)}defines.h
-st.$(OBJEXT): {$(VPATH)}encoding.h
-st.$(OBJEXT): {$(VPATH)}intern.h
-st.$(OBJEXT): {$(VPATH)}internal.h
-st.$(OBJEXT): {$(VPATH)}io.h
-st.$(OBJEXT): {$(VPATH)}missing.h
-st.$(OBJEXT): {$(VPATH)}oniguruma.h
-st.$(OBJEXT): {$(VPATH)}st.c
-st.$(OBJEXT): {$(VPATH)}st.h
-st.$(OBJEXT): {$(VPATH)}subst.h
-strftime.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-strftime.$(OBJEXT): {$(VPATH)}config.h
-strftime.$(OBJEXT): {$(VPATH)}defines.h
-strftime.$(OBJEXT): {$(VPATH)}encoding.h
-strftime.$(OBJEXT): {$(VPATH)}intern.h
-strftime.$(OBJEXT): {$(VPATH)}missing.h
-strftime.$(OBJEXT): {$(VPATH)}oniguruma.h
-strftime.$(OBJEXT): {$(VPATH)}st.h
-strftime.$(OBJEXT): {$(VPATH)}strftime.c
-strftime.$(OBJEXT): {$(VPATH)}subst.h
-strftime.$(OBJEXT): {$(VPATH)}timev.h
-string.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-string.$(OBJEXT): $(top_srcdir)/include/ruby.h
-string.$(OBJEXT): {$(VPATH)}config.h
-string.$(OBJEXT): {$(VPATH)}defines.h
-string.$(OBJEXT): {$(VPATH)}encindex.h
-string.$(OBJEXT): {$(VPATH)}encoding.h
-string.$(OBJEXT): {$(VPATH)}gc.h
-string.$(OBJEXT): {$(VPATH)}id.h
-string.$(OBJEXT): {$(VPATH)}intern.h
-string.$(OBJEXT): {$(VPATH)}internal.h
-string.$(OBJEXT): {$(VPATH)}io.h
-string.$(OBJEXT): {$(VPATH)}missing.h
-string.$(OBJEXT): {$(VPATH)}oniguruma.h
-string.$(OBJEXT): {$(VPATH)}probes.h
-string.$(OBJEXT): {$(VPATH)}re.h
-string.$(OBJEXT): {$(VPATH)}regex.h
-string.$(OBJEXT): {$(VPATH)}st.h
-string.$(OBJEXT): {$(VPATH)}string.c
-string.$(OBJEXT): {$(VPATH)}subst.h
-string.$(OBJEXT): {$(VPATH)}vm_opts.h
-strlcat.$(OBJEXT): {$(VPATH)}config.h
-strlcat.$(OBJEXT): {$(VPATH)}missing.h
-strlcat.$(OBJEXT): {$(VPATH)}strlcat.c
-strlcpy.$(OBJEXT): {$(VPATH)}config.h
-strlcpy.$(OBJEXT): {$(VPATH)}missing.h
-strlcpy.$(OBJEXT): {$(VPATH)}strlcpy.c
-struct.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-struct.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-struct.$(OBJEXT): $(CCAN_DIR)/list/list.h
-struct.$(OBJEXT): $(CCAN_DIR)/str/str.h
-struct.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-struct.$(OBJEXT): $(top_srcdir)/include/ruby.h
-struct.$(OBJEXT): {$(VPATH)}config.h
-struct.$(OBJEXT): {$(VPATH)}defines.h
-struct.$(OBJEXT): {$(VPATH)}encoding.h
-struct.$(OBJEXT): {$(VPATH)}id.h
-struct.$(OBJEXT): {$(VPATH)}intern.h
-struct.$(OBJEXT): {$(VPATH)}internal.h
-struct.$(OBJEXT): {$(VPATH)}io.h
-struct.$(OBJEXT): {$(VPATH)}method.h
-struct.$(OBJEXT): {$(VPATH)}missing.h
-struct.$(OBJEXT): {$(VPATH)}node.h
-struct.$(OBJEXT): {$(VPATH)}oniguruma.h
-struct.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-struct.$(OBJEXT): {$(VPATH)}st.h
-struct.$(OBJEXT): {$(VPATH)}struct.c
-struct.$(OBJEXT): {$(VPATH)}subst.h
-struct.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-struct.$(OBJEXT): {$(VPATH)}thread_native.h
-struct.$(OBJEXT): {$(VPATH)}vm_core.h
-struct.$(OBJEXT): {$(VPATH)}vm_debug.h
-struct.$(OBJEXT): {$(VPATH)}vm_opts.h
-symbol.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-symbol.$(OBJEXT): $(top_srcdir)/include/ruby.h
-symbol.$(OBJEXT): {$(VPATH)}config.h
-symbol.$(OBJEXT): {$(VPATH)}defines.h
-symbol.$(OBJEXT): {$(VPATH)}encoding.h
-symbol.$(OBJEXT): {$(VPATH)}gc.h
-symbol.$(OBJEXT): {$(VPATH)}id.c
-symbol.$(OBJEXT): {$(VPATH)}id.h
-symbol.$(OBJEXT): {$(VPATH)}intern.h
-symbol.$(OBJEXT): {$(VPATH)}internal.h
-symbol.$(OBJEXT): {$(VPATH)}io.h
-symbol.$(OBJEXT): {$(VPATH)}missing.h
-symbol.$(OBJEXT): {$(VPATH)}oniguruma.h
-symbol.$(OBJEXT): {$(VPATH)}probes.h
-symbol.$(OBJEXT): {$(VPATH)}st.h
-symbol.$(OBJEXT): {$(VPATH)}subst.h
-symbol.$(OBJEXT): {$(VPATH)}symbol.c
-symbol.$(OBJEXT): {$(VPATH)}id_table.c
-symbol.$(OBJEXT): {$(VPATH)}id_table.h
-symbol.$(OBJEXT): {$(VPATH)}symbol.h
-symbol.$(OBJEXT): {$(VPATH)}vm_opts.h
-thread.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-thread.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-thread.$(OBJEXT): $(CCAN_DIR)/list/list.h
-thread.$(OBJEXT): $(CCAN_DIR)/str/str.h
-thread.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-thread.$(OBJEXT): $(top_srcdir)/include/ruby.h
-thread.$(OBJEXT): {$(VPATH)}config.h
-thread.$(OBJEXT): {$(VPATH)}defines.h
-thread.$(OBJEXT): {$(VPATH)}encoding.h
-thread.$(OBJEXT): {$(VPATH)}eval_intern.h
-thread.$(OBJEXT): {$(VPATH)}gc.h
-thread.$(OBJEXT): {$(VPATH)}id.h
-thread.$(OBJEXT): {$(VPATH)}intern.h
-thread.$(OBJEXT): {$(VPATH)}internal.h
-thread.$(OBJEXT): {$(VPATH)}io.h
-thread.$(OBJEXT): {$(VPATH)}method.h
-thread.$(OBJEXT): {$(VPATH)}missing.h
-thread.$(OBJEXT): {$(VPATH)}node.h
-thread.$(OBJEXT): {$(VPATH)}oniguruma.h
-thread.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-thread.$(OBJEXT): {$(VPATH)}st.h
-thread.$(OBJEXT): {$(VPATH)}subst.h
-thread.$(OBJEXT): {$(VPATH)}thread.c
-thread.$(OBJEXT): {$(VPATH)}thread.h
-thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).c
-thread.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-thread.$(OBJEXT): {$(VPATH)}thread_native.h
-thread.$(OBJEXT): {$(VPATH)}thread_sync.c
-thread.$(OBJEXT): {$(VPATH)}timev.h
-thread.$(OBJEXT): {$(VPATH)}vm_core.h
-thread.$(OBJEXT): {$(VPATH)}vm_debug.h
-thread.$(OBJEXT): {$(VPATH)}vm_opts.h
-time.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-time.$(OBJEXT): $(top_srcdir)/include/ruby.h
-time.$(OBJEXT): {$(VPATH)}config.h
-time.$(OBJEXT): {$(VPATH)}defines.h
-time.$(OBJEXT): {$(VPATH)}encoding.h
-time.$(OBJEXT): {$(VPATH)}intern.h
-time.$(OBJEXT): {$(VPATH)}internal.h
-time.$(OBJEXT): {$(VPATH)}io.h
-time.$(OBJEXT): {$(VPATH)}missing.h
-time.$(OBJEXT): {$(VPATH)}oniguruma.h
-time.$(OBJEXT): {$(VPATH)}st.h
-time.$(OBJEXT): {$(VPATH)}subst.h
-time.$(OBJEXT): {$(VPATH)}time.c
-time.$(OBJEXT): {$(VPATH)}timev.h
-transcode.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-transcode.$(OBJEXT): $(top_srcdir)/include/ruby.h
-transcode.$(OBJEXT): {$(VPATH)}config.h
-transcode.$(OBJEXT): {$(VPATH)}defines.h
-transcode.$(OBJEXT): {$(VPATH)}encoding.h
-transcode.$(OBJEXT): {$(VPATH)}intern.h
-transcode.$(OBJEXT): {$(VPATH)}internal.h
-transcode.$(OBJEXT): {$(VPATH)}io.h
-transcode.$(OBJEXT): {$(VPATH)}missing.h
-transcode.$(OBJEXT): {$(VPATH)}oniguruma.h
-transcode.$(OBJEXT): {$(VPATH)}st.h
-transcode.$(OBJEXT): {$(VPATH)}subst.h
-transcode.$(OBJEXT): {$(VPATH)}transcode.c
-transcode.$(OBJEXT): {$(VPATH)}transcode_data.h
-util.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-util.$(OBJEXT): $(top_srcdir)/include/ruby.h
-util.$(OBJEXT): {$(VPATH)}config.h
-util.$(OBJEXT): {$(VPATH)}defines.h
-util.$(OBJEXT): {$(VPATH)}encoding.h
-util.$(OBJEXT): {$(VPATH)}intern.h
-util.$(OBJEXT): {$(VPATH)}internal.h
-util.$(OBJEXT): {$(VPATH)}io.h
-util.$(OBJEXT): {$(VPATH)}missing.h
-util.$(OBJEXT): {$(VPATH)}oniguruma.h
-util.$(OBJEXT): {$(VPATH)}st.h
-util.$(OBJEXT): {$(VPATH)}subst.h
-util.$(OBJEXT): {$(VPATH)}util.c
-util.$(OBJEXT): {$(VPATH)}util.h
-variable.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-variable.$(OBJEXT): $(top_srcdir)/include/ruby.h
-variable.$(OBJEXT): {$(VPATH)}config.h
-variable.$(OBJEXT): {$(VPATH)}constant.h
-variable.$(OBJEXT): {$(VPATH)}defines.h
-variable.$(OBJEXT): {$(VPATH)}encoding.h
-variable.$(OBJEXT): {$(VPATH)}id.h
-variable.$(OBJEXT): {$(VPATH)}intern.h
-variable.$(OBJEXT): {$(VPATH)}internal.h
-variable.$(OBJEXT): {$(VPATH)}io.h
-variable.$(OBJEXT): {$(VPATH)}missing.h
-variable.$(OBJEXT): {$(VPATH)}oniguruma.h
-variable.$(OBJEXT): {$(VPATH)}st.h
-variable.$(OBJEXT): {$(VPATH)}subst.h
-variable.$(OBJEXT): {$(VPATH)}util.h
-variable.$(OBJEXT): {$(VPATH)}variable.c
-version.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-version.$(OBJEXT): $(hdrdir)/ruby/version.h
-version.$(OBJEXT): $(top_srcdir)/revision.h
-version.$(OBJEXT): $(top_srcdir)/version.h
-version.$(OBJEXT): {$(VPATH)}config.h
-version.$(OBJEXT): {$(VPATH)}defines.h
-version.$(OBJEXT): {$(VPATH)}intern.h
-version.$(OBJEXT): {$(VPATH)}missing.h
-version.$(OBJEXT): {$(VPATH)}st.h
-version.$(OBJEXT): {$(VPATH)}subst.h
-version.$(OBJEXT): {$(VPATH)}version.c
-vm.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-vm.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-vm.$(OBJEXT): $(CCAN_DIR)/list/list.h
-vm.$(OBJEXT): $(CCAN_DIR)/str/str.h
-vm.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-vm.$(OBJEXT): $(top_srcdir)/include/ruby.h
-vm.$(OBJEXT): {$(VPATH)}config.h
-vm.$(OBJEXT): {$(VPATH)}constant.h
-vm.$(OBJEXT): {$(VPATH)}defines.h
-vm.$(OBJEXT): {$(VPATH)}encoding.h
-vm.$(OBJEXT): {$(VPATH)}eval_intern.h
-vm.$(OBJEXT): {$(VPATH)}gc.h
-vm.$(OBJEXT): {$(VPATH)}id.h
-vm.$(OBJEXT): {$(VPATH)}id_table.h
-vm.$(OBJEXT): {$(VPATH)}insns.def
-vm.$(OBJEXT): {$(VPATH)}insns.inc
-vm.$(OBJEXT): {$(VPATH)}intern.h
-vm.$(OBJEXT): {$(VPATH)}internal.h
-vm.$(OBJEXT): {$(VPATH)}io.h
-vm.$(OBJEXT): {$(VPATH)}iseq.h
-vm.$(OBJEXT): {$(VPATH)}method.h
-vm.$(OBJEXT): {$(VPATH)}missing.h
-vm.$(OBJEXT): {$(VPATH)}node.h
-vm.$(OBJEXT): {$(VPATH)}oniguruma.h
-vm.$(OBJEXT): {$(VPATH)}probes.h
-vm.$(OBJEXT): {$(VPATH)}probes_helper.h
-vm.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-vm.$(OBJEXT): {$(VPATH)}st.h
-vm.$(OBJEXT): {$(VPATH)}subst.h
-vm.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-vm.$(OBJEXT): {$(VPATH)}thread_native.h
-vm.$(OBJEXT): {$(VPATH)}vm.c
-vm.$(OBJEXT): {$(VPATH)}vm.h
-vm.$(OBJEXT): {$(VPATH)}vm.inc
-vm.$(OBJEXT): {$(VPATH)}vm_call_iseq_optimized.inc
-vm.$(OBJEXT): {$(VPATH)}vm_args.c
-vm.$(OBJEXT): {$(VPATH)}vm_core.h
-vm.$(OBJEXT): {$(VPATH)}vm_debug.h
-vm.$(OBJEXT): {$(VPATH)}vm_eval.c
-vm.$(OBJEXT): {$(VPATH)}vm_exec.c
-vm.$(OBJEXT): {$(VPATH)}vm_exec.h
-vm.$(OBJEXT): {$(VPATH)}vm_insnhelper.c
-vm.$(OBJEXT): {$(VPATH)}vm_insnhelper.h
-vm.$(OBJEXT): {$(VPATH)}vm_method.c
-vm.$(OBJEXT): {$(VPATH)}vm_opts.h
-vm.$(OBJEXT): {$(VPATH)}vmtc.inc
-vm_backtrace.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-vm_backtrace.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-vm_backtrace.$(OBJEXT): $(CCAN_DIR)/list/list.h
-vm_backtrace.$(OBJEXT): $(CCAN_DIR)/str/str.h
-vm_backtrace.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-vm_backtrace.$(OBJEXT): $(top_srcdir)/include/ruby.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}config.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}debug.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}defines.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}encoding.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}eval_intern.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}id.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}intern.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}internal.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}io.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}iseq.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}method.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}missing.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}node.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}oniguruma.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}st.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}subst.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-vm_backtrace.$(OBJEXT): {$(VPATH)}thread_native.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}vm_backtrace.c
-vm_backtrace.$(OBJEXT): {$(VPATH)}vm_core.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}vm_debug.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}vm_opts.h
-vm_call.$(OBJEXT): $(top_srcdir)/include/ruby.h
-vm_call.$(OBJEXT): {$(VPATH)}vm_core.h
-vm_call.$(OBJEXT): {$(VPATH)}vm_call_iseq_optimized.inc
-vm_dump.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-vm_dump.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-vm_dump.$(OBJEXT): $(CCAN_DIR)/list/list.h
-vm_dump.$(OBJEXT): $(CCAN_DIR)/str/str.h
-vm_dump.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-vm_dump.$(OBJEXT): $(top_srcdir)/include/ruby.h
-vm_dump.$(OBJEXT): {$(VPATH)}addr2line.h
-vm_dump.$(OBJEXT): {$(VPATH)}config.h
-vm_dump.$(OBJEXT): {$(VPATH)}defines.h
-vm_dump.$(OBJEXT): {$(VPATH)}encoding.h
-vm_dump.$(OBJEXT): {$(VPATH)}id.h
-vm_dump.$(OBJEXT): {$(VPATH)}intern.h
-vm_dump.$(OBJEXT): {$(VPATH)}internal.h
-vm_dump.$(OBJEXT): {$(VPATH)}io.h
-vm_dump.$(OBJEXT): {$(VPATH)}iseq.h
-vm_dump.$(OBJEXT): {$(VPATH)}method.h
-vm_dump.$(OBJEXT): {$(VPATH)}missing.h
-vm_dump.$(OBJEXT): {$(VPATH)}node.h
-vm_dump.$(OBJEXT): {$(VPATH)}oniguruma.h
-vm_dump.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-vm_dump.$(OBJEXT): {$(VPATH)}st.h
-vm_dump.$(OBJEXT): {$(VPATH)}subst.h
-vm_dump.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-vm_dump.$(OBJEXT): {$(VPATH)}thread_native.h
-vm_dump.$(OBJEXT): {$(VPATH)}vm_core.h
-vm_dump.$(OBJEXT): {$(VPATH)}vm_debug.h
-vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c
-vm_dump.$(OBJEXT): {$(VPATH)}vm_opts.h
-vm_trace.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
-vm_trace.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
-vm_trace.$(OBJEXT): $(CCAN_DIR)/list/list.h
-vm_trace.$(OBJEXT): $(CCAN_DIR)/str/str.h
-vm_trace.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-vm_trace.$(OBJEXT): $(top_srcdir)/include/ruby.h
-vm_trace.$(OBJEXT): {$(VPATH)}config.h
-vm_trace.$(OBJEXT): {$(VPATH)}debug.h
-vm_trace.$(OBJEXT): {$(VPATH)}defines.h
-vm_trace.$(OBJEXT): {$(VPATH)}encoding.h
-vm_trace.$(OBJEXT): {$(VPATH)}eval_intern.h
-vm_trace.$(OBJEXT): {$(VPATH)}id.h
-vm_trace.$(OBJEXT): {$(VPATH)}intern.h
-vm_trace.$(OBJEXT): {$(VPATH)}internal.h
-vm_trace.$(OBJEXT): {$(VPATH)}io.h
-vm_trace.$(OBJEXT): {$(VPATH)}method.h
-vm_trace.$(OBJEXT): {$(VPATH)}missing.h
-vm_trace.$(OBJEXT): {$(VPATH)}node.h
-vm_trace.$(OBJEXT): {$(VPATH)}oniguruma.h
-vm_trace.$(OBJEXT): {$(VPATH)}ruby_atomic.h
-vm_trace.$(OBJEXT): {$(VPATH)}st.h
-vm_trace.$(OBJEXT): {$(VPATH)}subst.h
-vm_trace.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
-vm_trace.$(OBJEXT): {$(VPATH)}thread_native.h
-vm_trace.$(OBJEXT): {$(VPATH)}vm_core.h
-vm_trace.$(OBJEXT): {$(VPATH)}vm_debug.h
-vm_trace.$(OBJEXT): {$(VPATH)}vm_opts.h
-vm_trace.$(OBJEXT): {$(VPATH)}vm_trace.c
-# AUTOGENERATED DEPENDENCIES END
diff --git a/compar.c b/compar.c
index b040641651..2f4db291a4 100644
--- a/compar.c
+++ b/compar.c
@@ -18,16 +18,17 @@ static ID cmp;
void
rb_cmperr(VALUE x, VALUE y)
{
- VALUE classname;
+ const char *classname;
- if (SPECIAL_CONST_P(y) || BUILTIN_TYPE(y) == T_FLOAT) {
- classname = rb_inspect(y);
+ if (SPECIAL_CONST_P(y)) {
+ y = rb_inspect(y);
+ classname = StringValuePtr(y);
}
else {
- classname = rb_obj_class(y);
+ classname = rb_obj_classname(y);
}
- rb_raise(rb_eArgError, "comparison of %"PRIsVALUE" with %"PRIsVALUE" failed",
- rb_obj_class(x), classname);
+ rb_raise(rb_eArgError, "comparison of %s with %s failed",
+ rb_obj_classname(x), classname);
}
static VALUE
@@ -53,10 +54,26 @@ rb_invcmp(VALUE x, VALUE y)
static VALUE
cmp_eq_recursive(VALUE arg1, VALUE arg2, int recursive)
{
- if (recursive) return Qnil;
+ if (recursive) return Qfalse;
return rb_funcallv(arg1, cmp, 1, &arg2);
}
+static VALUE
+cmp_eq(VALUE *a)
+{
+ VALUE c = rb_exec_recursive_paired_outer(cmp_eq_recursive, a[0], a[1], a[1]);
+
+ if (NIL_P(c)) return Qfalse;
+ if (rb_cmpint(c, a[0], a[1]) == 0) return Qtrue;
+ return Qfalse;
+}
+
+static VALUE
+cmp_failed(void)
+{
+ return Qfalse;
+}
+
/*
* call-seq:
* obj == other -> true or false
@@ -64,19 +81,20 @@ cmp_eq_recursive(VALUE arg1, VALUE arg2, int recursive)
* Compares two objects based on the receiver's <code><=></code>
* method, returning true if it returns 0. Also returns true if
* _obj_ and _other_ are the same object.
+ *
+ * Even if _obj_ <=> _other_ raised an exception, the exception
+ * is ignored and returns false.
*/
static VALUE
cmp_equal(VALUE x, VALUE y)
{
- VALUE c;
- if (x == y) return Qtrue;
+ VALUE a[2];
- c = rb_exec_recursive_paired_outer(cmp_eq_recursive, x, y, y);
+ if (x == y) return Qtrue;
- if (NIL_P(c)) return Qfalse;
- if (rb_cmpint(c, x, y) == 0) return Qtrue;
- return Qfalse;
+ a[0] = x; a[1] = y;
+ return rb_rescue(cmp_eq, (VALUE)a, cmp_failed, 0);
}
/*
@@ -185,8 +203,8 @@ cmp_between(VALUE x, VALUE min, VALUE max)
* class SizeMatters
* include Comparable
* attr :str
- * def <=>(other)
- * str.size <=> other.str.size
+ * def <=>(anOther)
+ * str.size <=> anOther.str.size
* end
* def initialize(str)
* @str = str
diff --git a/compile.c b/compile.c
index 0aea3acd92..2b58462d16 100644
--- a/compile.c
+++ b/compile.c
@@ -9,9 +9,8 @@
**********************************************************************/
+#include "ruby/ruby.h"
#include "internal.h"
-#include "ruby/re.h"
-#include "encindex.h"
#include <math.h>
#define USE_INSN_STACK_INCREASE 1
@@ -19,16 +18,6 @@
#include "iseq.h"
#include "insns.inc"
#include "insns_info.inc"
-#include "gc.h"
-
-#ifdef HAVE_DLADDR
-# include <dlfcn.h>
-#endif
-
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
-
-#define ISEQ_TYPE_ONCE_GUARD ISEQ_TYPE_DEFINED_GUARD
#define FIXNUM_INC(n, i) ((n)+(INT2FIX(i)&~FIXNUM_FLAG))
#define FIXNUM_OR(n, i) ((n)|INT2FIX(i))
@@ -49,13 +38,6 @@ typedef struct iseq_link_anchor {
LINK_ELEMENT *last;
} LINK_ANCHOR;
-typedef enum {
- LABEL_RESCUE_NONE,
- LABEL_RESCUE_BEG,
- LABEL_RESCUE_END,
- LABEL_RESCUE_TYPE_MAX
-} LABEL_RESCUE_TYPE;
-
typedef struct iseq_label_data {
LINK_ELEMENT link;
int label_no;
@@ -63,8 +45,6 @@ typedef struct iseq_label_data {
int sc_state;
int set;
int sp;
- int refcnt;
- unsigned int rescued: 2;
} LABEL;
typedef struct iseq_insn_data {
@@ -114,7 +94,7 @@ struct iseq_compile_data_ensure_node_stack {
#if CPDEBUG >= 0
#define compile_debug CPDEBUG
#else
-#define compile_debug ISEQ_COMPILE_DATA(iseq)->option->debug_level
+#define compile_debug iseq->compile_data->option->debug_level
#endif
#if CPDEBUG
@@ -173,7 +153,6 @@ r_value(VALUE value)
#endif
#if CPDEBUG > 1 || CPDEBUG < 0
-#define printf ruby_debug_printf
#define debugs if (compile_debug_print_indent(1)) ruby_debug_printf
#define debug_compile(msg, v) ((void)(compile_debug_print_indent(1) && fputs((msg), stderr)), (v))
#else
@@ -185,14 +164,17 @@ r_value(VALUE value)
/* create new label */
#define NEW_LABEL(l) new_label_body(iseq, (l))
-#define iseq_path(iseq) ((iseq)->body->location.path)
-#define iseq_absolute_path(iseq) ((iseq)->body->location.absolute_path)
+#define iseq_path(iseq) \
+ (((rb_iseq_t*)DATA_PTR(iseq))->location.path)
-#define NEW_ISEQ(node, name, type, line_no) \
- new_child_iseq(iseq, (node), rb_fstring(name), 0, (type), (line_no))
+#define iseq_absolute_path(iseq) \
+ (((rb_iseq_t*)DATA_PTR(iseq))->location.absolute_path)
-#define NEW_CHILD_ISEQ(node, name, type, line_no) \
- new_child_iseq(iseq, (node), rb_fstring(name), iseq, (type), (line_no))
+#define NEW_ISEQVAL(node, name, type, line_no) \
+ new_child_iseq(iseq, (node), (name), 0, (type), (line_no))
+
+#define NEW_CHILD_ISEQVAL(node, name, type, line_no) \
+ new_child_iseq(iseq, (node), (name), iseq->self, (type), (line_no))
/* add instructions */
#define ADD_SEQ(seq1, seq2) \
@@ -202,24 +184,13 @@ r_value(VALUE value)
#define ADD_INSN(seq, line, insn) \
ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
-/* insert an instruction before prev */
-#define INSERT_BEFORE_INSN(prev, line, insn) \
- INSERT_ELEM_PREV(&(prev)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
-
/* add an instruction with some operands (1, 2, 3, 5) */
#define ADD_INSN1(seq, line, insn, op1) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
-/* insert an instruction with some operands (1, 2, 3, 5) before prev */
-#define INSERT_BEFORE_INSN1(prev, line, insn, op1) \
- INSERT_ELEM_PREV(&(prev)->link, (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
-
-#define LABEL_REF(label) ((label)->refcnt++)
-
/* add an instruction with label operand (alias of ADD_INSN1) */
-#define ADD_INSNL(seq, line, insn, label) (ADD_INSN1(seq, line, insn, label), LABEL_REF(label))
+#define ADD_INSNL(seq, line, insn, label) ADD_INSN1(seq, line, insn, label)
#define ADD_INSN2(seq, line, insn, op1, op2) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
@@ -231,36 +202,31 @@ r_value(VALUE value)
/* Specific Insn factory */
#define ADD_SEND(seq, line, id, argc) \
- ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(0), NULL)
-
-#define ADD_SEND_WITH_FLAG(seq, line, id, argc, flag) \
- ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)(flag), NULL)
-
-#define ADD_SEND_WITH_BLOCK(seq, line, id, argc, block) \
- ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(0), NULL)
+ ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(0))
#define ADD_CALL_RECEIVER(seq, line) \
ADD_INSN((seq), (line), putself)
#define ADD_CALL(seq, line, id, argc) \
- ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(VM_CALL_FCALL), NULL)
+ ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(VM_CALL_FCALL))
#define ADD_CALL_WITH_BLOCK(seq, line, id, argc, block) \
- ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL), NULL)
+ ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL))
-#define ADD_SEND_R(seq, line, id, argc, block, flag, keywords) \
- ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_send(iseq, (line), (id), (VALUE)(argc), (block), (VALUE)(flag), (keywords)))
+#define ADD_SEND_R(seq, line, id, argc, block, flag) \
+ ADD_ELEM((seq), (LINK_ELEMENT *) \
+ new_insn_send(iseq, (line), \
+ (VALUE)(id), (VALUE)(argc), (VALUE)(block), (VALUE)(flag)))
#define ADD_TRACE(seq, line, event) \
do { \
- if ((event) == RUBY_EVENT_LINE && ISEQ_COVERAGE(iseq) && \
- (line) > 0 && \
- (line) != ISEQ_COMPILE_DATA(iseq)->last_coverable_line) { \
- RARRAY_ASET(ISEQ_COVERAGE(iseq), (line) - 1, INT2FIX(0)); \
- ISEQ_COMPILE_DATA(iseq)->last_coverable_line = (line); \
+ if ((event) == RUBY_EVENT_LINE && iseq->coverage && \
+ (line) != iseq->compile_data->last_coverable_line) { \
+ RARRAY_ASET(iseq->coverage, (line) - 1, INT2FIX(0)); \
+ iseq->compile_data->last_coverable_line = (line); \
ADD_INSN1((seq), (line), trace, INT2FIX(RUBY_EVENT_COVERAGE)); \
} \
- if (ISEQ_COMPILE_DATA(iseq)->option->trace_instruction) { \
+ if (iseq->compile_data->option->trace_instruction) { \
ADD_INSN1((seq), (line), trace, INT2FIX(event)); \
} \
} while (0)
@@ -278,15 +244,11 @@ r_value(VALUE value)
#define ADD_ADJUST_RESTORE(seq, label) \
ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), -1))
-#define ADD_CATCH_ENTRY(type, ls, le, iseqv, lc) do { \
- VALUE _e = rb_ary_new3(5, (type), \
- (VALUE)(ls) | 1, (VALUE)(le) | 1, \
- (VALUE)(iseqv), (VALUE)(lc) | 1); \
- if (ls) LABEL_REF(ls); \
- if (le) LABEL_REF(le); \
- if (lc) LABEL_REF(lc); \
- rb_ary_push(ISEQ_COMPILE_DATA(iseq)->catch_table_ary, freeze_hide_obj(_e)); \
-} while (0)
+#define ADD_CATCH_ENTRY(type, ls, le, iseqv, lc) \
+ (rb_ary_push(iseq->compile_data->catch_table_ary, \
+ rb_ary_new3(5, (type), \
+ (VALUE)(ls) | 1, (VALUE)(le) | 1, \
+ (VALUE)(iseqv), (VALUE)(lc) | 1)))
/* compile node */
#define COMPILE(anchor, desc, node) \
@@ -303,11 +265,6 @@ r_value(VALUE value)
(debug_compile("== " desc "\n", \
iseq_compile_each(iseq, (anchor), (node), (poped))))
-#define COMPILE_RECV(anchor, desc, node) \
- (private_recv_p(node) ? \
- (ADD_INSN(anchor, nd_line(node), putself), VM_CALL_FCALL) : \
- (COMPILE(anchor, desc, node->nd_recv), 0))
-
#define OPERAND_AT(insn, idx) \
(((INSN*)(insn))->operands[(idx)])
@@ -315,69 +272,20 @@ r_value(VALUE value)
(((INSN*)(insn))->insn_id)
/* error */
-typedef void (*compile_error_func)(VALUE, int, const char *, ...);
-
-static void
-append_compile_error(VALUE file, int line, const char *fmt, ...)
-{
- VALUE err_info = rb_errinfo();
- VALUE str = rb_attr_get(err_info, idMesg);
- va_list args;
-
- if (RSTRING_LEN(str)) rb_str_cat2(str, "\n");
- if (file) {
- rb_str_concat(str, file);
- if (line) rb_str_catf(str, ":%d", line);
- rb_str_cat2(str, ": ");
- }
- va_start(args, fmt);
- rb_str_vcatf(str, fmt, args);
- va_end(args);
-}
-
-NOINLINE(static compile_error_func prepare_compile_error(rb_iseq_t *iseq));
-
-static compile_error_func
-prepare_compile_error(rb_iseq_t *iseq)
-{
- VALUE err_info = ISEQ_COMPILE_DATA(iseq)->err_info;
- if (compile_debug) return rb_compile_bug_str;
- if (NIL_P(err_info)) {
- err_info = rb_exc_new_cstr(rb_eSyntaxError, "");
- RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, err_info);
- }
- rb_set_errinfo(err_info);
- return append_compile_error;
+#define COMPILE_ERROR(strs) \
+{ \
+ VALUE tmp = GET_THREAD()->errinfo; \
+ if (compile_debug) rb_compile_bug strs; \
+ GET_THREAD()->errinfo = iseq->compile_data->err_info; \
+ rb_compile_error strs; \
+ OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, GET_THREAD()->errinfo); \
+ GET_THREAD()->errinfo = tmp; \
+ ret = 0; \
+ break; \
}
-#define COMPILE_ERROR prepare_compile_error(iseq)
-
-#define ERROR_ARGS_AT(n) ruby_sourcefile_string, nd_line(n),
-#define ERROR_ARGS ERROR_ARGS_AT(node)
+#define ERROR_ARGS ruby_sourcefile, nd_line(node),
-#define EXPECT_NODE(prefix, node, ndtype) \
-do { \
- NODE *error_node = (node); \
- enum node_type error_type = nd_type(error_node); \
- if (error_type != (ndtype)) { \
- rb_compile_bug_str(ERROR_ARGS_AT(error_node) \
- prefix ": " #ndtype " is expected, but %s", \
- ruby_node_name(error_type)); \
- } \
-} while (0)
-
-#define EXPECT_NODE_NONULL(prefix, parent, ndtype) \
-do { \
- rb_compile_bug_str(ERROR_ARGS_AT(parent) \
- prefix ": must be " #ndtype ", but 0"); \
-} while (0)
-
-#define UNKNOWN_NODE(prefix, node) \
-do { \
- NODE *error_node = (node); \
- rb_compile_bug_str(ERROR_ARGS_AT(error_node) prefix ": unknown node (%s)", \
- ruby_node_name(nd_type(error_node))); \
-} while (0)
#define COMPILE_OK 1
#define COMPILE_NG 0
@@ -390,13 +298,7 @@ do { \
#define INIT_ANCHOR(name) \
(name##_body__.last = &name##_body__.anchor, name = &name##_body__)
-static inline VALUE
-freeze_hide_obj(VALUE obj)
-{
- OBJ_FREEZE(obj);
- RBASIC_CLEAR_CLASS(obj);
- return obj;
-}
+#define hide_obj(obj) do {OBJ_FREEZE(obj); RBASIC_CLEAR_CLASS(obj);} while (0)
#include "optinsn.inc"
#if OPT_INSTRUCTIONS_UNIFICATION
@@ -413,15 +315,19 @@ freeze_hide_obj(VALUE obj)
#endif
#if CPDEBUG
-#define gl_node_level ISEQ_COMPILE_DATA(iseq)->node_level
+#define gl_node_level iseq->compile_data->node_level
+#if 0
+static void debug_list(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor);
+#endif
#endif
static void dump_disasm_list(LINK_ELEMENT *elem);
static int insn_data_length(INSN *iobj);
+static int insn_data_line_no(INSN *iobj);
static int calc_sp_depth(int depth, INSN *iobj);
-static INSN *new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int argc, ...);
+static INSN *new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...);
static LABEL *new_label_body(rb_iseq_t *iseq, long line);
static ADJUST *new_adjust_body(rb_iseq_t *iseq, LABEL *label, int line);
@@ -430,7 +336,7 @@ static int iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor);
static int iseq_optimize(rb_iseq_t *iseq, LINK_ANCHOR *anchor);
static int iseq_insns_unification(rb_iseq_t *iseq, LINK_ANCHOR *anchor);
-static int iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl);
+static int iseq_set_local_table(rb_iseq_t *iseq, ID *tbl);
static int iseq_set_exception_local_table(rb_iseq_t *iseq);
static int iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *anchor, NODE * node);
@@ -502,11 +408,11 @@ APPEND_ELEM(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor, LINK_ELEMENT *before, LINK_ELE
}
#if CPDEBUG < 0
#define ADD_ELEM(anchor, elem) ADD_ELEM(iseq, (anchor), (elem))
-#define APPEND_ELEM(anchor, before, elem) APPEND_ELEM(iseq, (anchor), (before), (elem))
+#define APPEND_ELEM(anchor, before, elem) ADD_ELEM(iseq, (anchor), (before), (elem))
#endif
static int
-iseq_add_mark_object(const rb_iseq_t *iseq, VALUE v)
+iseq_add_mark_object(rb_iseq_t *iseq, VALUE v)
{
if (!SPECIAL_CONST_P(v)) {
rb_iseq_add_mark_object(iseq, v);
@@ -514,14 +420,13 @@ iseq_add_mark_object(const rb_iseq_t *iseq, VALUE v)
return COMPILE_OK;
}
-#define ruby_sourcefile_string (iseq->body->location.path)
-#define ruby_sourcefile RSTRING_PTR(iseq->body->location.path)
+#define ruby_sourcefile RSTRING_PTR(iseq->location.path)
static int
-iseq_add_mark_object_compile_time(const rb_iseq_t *iseq, VALUE v)
+iseq_add_mark_object_compile_time(rb_iseq_t *iseq, VALUE v)
{
if (!SPECIAL_CONST_P(v)) {
- rb_ary_push(ISEQ_COMPILE_DATA(iseq)->mark_ary, v);
+ rb_ary_push(iseq->compile_data->mark_ary, v);
}
return COMPILE_OK;
}
@@ -533,9 +438,10 @@ validate_label(st_data_t name, st_data_t label, st_data_t arg)
LABEL *lobj = (LABEL *)label;
if (!lobj->link.next) {
do {
- COMPILE_ERROR(ruby_sourcefile_string, lobj->position,
- "%"PRIsVALUE": undefined label",
- rb_id2str((ID)name));
+ int ret;
+ COMPILE_ERROR((ruby_sourcefile, lobj->position,
+ "%s: undefined label", rb_id2name((ID)name)));
+ if (ret) break;
} while (0);
}
return ST_CONTINUE;
@@ -545,14 +451,18 @@ static void
validate_labels(rb_iseq_t *iseq, st_table *labels_table)
{
st_foreach(labels_table, validate_label, (st_data_t)iseq);
- st_free_table(labels_table);
+ if (!NIL_P(iseq->compile_data->err_info)) {
+ rb_exc_raise(iseq->compile_data->err_info);
+ }
}
VALUE
-rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node)
+rb_iseq_compile_node(VALUE self, NODE *node)
{
DECL_ANCHOR(ret);
+ rb_iseq_t *iseq;
INIT_ANCHOR(ret);
+ GetISeqPtr(self, iseq);
if (node == 0) {
COMPILE(ret, "nil", node);
@@ -563,17 +473,14 @@ rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node)
iseq_set_local_table(iseq, node->nd_tbl);
iseq_set_arguments(iseq, ret, node->nd_args);
- switch (iseq->body->type) {
+ switch (iseq->type) {
case ISEQ_TYPE_BLOCK:
{
- LABEL *start = ISEQ_COMPILE_DATA(iseq)->start_label = NEW_LABEL(0);
- LABEL *end = ISEQ_COMPILE_DATA(iseq)->end_label = NEW_LABEL(0);
-
- start->rescued = LABEL_RESCUE_BEG;
- end->rescued = LABEL_RESCUE_END;
+ LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
+ LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);
- ADD_TRACE(ret, FIX2INT(iseq->body->location.first_lineno), RUBY_EVENT_B_CALL);
ADD_LABEL(ret, start);
+ ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_B_CALL);
COMPILE(ret, "block body", node->nd_body);
ADD_LABEL(ret, end);
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_B_RETURN);
@@ -585,14 +492,14 @@ rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node)
}
case ISEQ_TYPE_CLASS:
{
- ADD_TRACE(ret, FIX2INT(iseq->body->location.first_lineno), RUBY_EVENT_CLASS);
+ ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_CLASS);
COMPILE(ret, "scoped node", node->nd_body);
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
break;
}
case ISEQ_TYPE_METHOD:
{
- ADD_TRACE(ret, FIX2INT(iseq->body->location.first_lineno), RUBY_EVENT_CALL);
+ ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_CALL);
COMPILE(ret, "scoped node", node->nd_body);
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
break;
@@ -603,22 +510,21 @@ rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node)
}
}
}
- else if (RB_TYPE_P((VALUE)node, T_IMEMO)) {
- const struct vm_ifunc *ifunc = (struct vm_ifunc *)node;
+ else if (nd_type(node) == NODE_IFUNC) {
/* user callback */
- (*ifunc->func)(iseq, ret, ifunc->data);
+ (*node->nd_cfnc)(iseq, ret, node->nd_tval);
}
else {
- switch (iseq->body->type) {
+ switch (iseq->type) {
case ISEQ_TYPE_METHOD:
case ISEQ_TYPE_CLASS:
case ISEQ_TYPE_BLOCK:
case ISEQ_TYPE_EVAL:
case ISEQ_TYPE_MAIN:
case ISEQ_TYPE_TOP:
- COMPILE_ERROR(ERROR_ARGS "compile/should not be reached: %s:%d",
- __FILE__, __LINE__);
- return COMPILE_NG;
+ rb_compile_error(ERROR_ARGS "compile/should not be reached: %s:%d",
+ __FILE__, __LINE__);
+ break;
case ISEQ_TYPE_RESCUE:
iseq_set_exception_local_table(iseq);
COMPILE(ret, "rescue", node);
@@ -628,27 +534,25 @@ rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node)
COMPILE_POPED(ret, "ensure", node);
break;
case ISEQ_TYPE_DEFINED_GUARD:
- iseq_set_exception_local_table(iseq);
+ iseq_set_local_table(iseq, 0);
COMPILE(ret, "defined guard", node);
break;
default:
- rb_compile_bug_str(ERROR_ARGS "unknown scope");
+ rb_bug("unknown scope");
}
}
- if (iseq->body->type == ISEQ_TYPE_RESCUE || iseq->body->type == ISEQ_TYPE_ENSURE) {
+ if (iseq->type == ISEQ_TYPE_RESCUE || iseq->type == ISEQ_TYPE_ENSURE) {
ADD_INSN2(ret, 0, getlocal, INT2FIX(2), INT2FIX(0));
ADD_INSN1(ret, 0, throw, INT2FIX(0) /* continue throw */ );
}
else {
- ADD_INSN(ret, ISEQ_COMPILE_DATA(iseq)->last_line, leave);
+ ADD_INSN(ret, iseq->compile_data->last_line, leave);
}
#if SUPPORT_JOKE
- if (ISEQ_COMPILE_DATA(iseq)->labels_table) {
- st_table *labels_table = ISEQ_COMPILE_DATA(iseq)->labels_table;
- ISEQ_COMPILE_DATA(iseq)->labels_table = 0;
- validate_labels(iseq, labels_table);
+ if (iseq->compile_data->labels_table) {
+ validate_labels(iseq, iseq->compile_data->labels_table);
}
#endif
return iseq_setup(iseq, ret);
@@ -659,150 +563,54 @@ rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
{
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
const void * const *table = rb_vm_get_insns_address_table();
- unsigned int i;
- VALUE *encoded = (VALUE *)iseq->body->iseq_encoded;
+ unsigned long i;
+
+ iseq->iseq_encoded = ALLOC_N(VALUE, iseq->iseq_size);
+ MEMCPY(iseq->iseq_encoded, iseq->iseq, VALUE, iseq->iseq_size);
- for (i = 0; i < iseq->body->iseq_size; /* */ ) {
- int insn = (int)iseq->body->iseq_encoded[i];
+ for (i = 0; i < iseq->iseq_size; /* */ ) {
+ int insn = (int)iseq->iseq_encoded[i];
int len = insn_len(insn);
- encoded[i] = (VALUE)table[insn];
+ iseq->iseq_encoded[i] = (VALUE)table[insn];
i += len;
}
+#else
+ iseq->iseq_encoded = iseq->iseq;
#endif
return COMPILE_OK;
}
-#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
-static int
-rb_vm_insn_addr2insn(const void *addr) /* cold path */
-{
- int insn;
- const void * const *table = rb_vm_get_insns_address_table();
-
- for (insn = 0; insn < VM_INSTRUCTION_SIZE; insn++) {
- if (table[insn] == addr) {
- return insn;
- }
- }
- rb_bug("rb_vm_insn_addr2insn: invalid insn address: %p", addr);
-}
-#endif
-
-VALUE *
-rb_iseq_original_iseq(const rb_iseq_t *iseq) /* cold path */
-{
- VALUE *original_code;
-
- if (ISEQ_ORIGINAL_ISEQ(iseq)) return ISEQ_ORIGINAL_ISEQ(iseq);
- original_code = ISEQ_ORIGINAL_ISEQ_ALLOC(iseq, iseq->body->iseq_size);
- MEMCPY(original_code, iseq->body->iseq_encoded, VALUE, iseq->body->iseq_size);
-
-#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
- {
- unsigned int i;
-
- for (i = 0; i < iseq->body->iseq_size; /* */ ) {
- const void *addr = (const void *)original_code[i];
- const int insn = rb_vm_insn_addr2insn(addr);
-
- original_code[i] = insn;
- i += insn_len(insn);
- }
- }
-#endif
- return original_code;
-}
-
/*********************************************/
/* definition of data structure for compiler */
/*********************************************/
-/*
- * On 32-bit SPARC, GCC by default generates SPARC V7 code that may require
- * 8-byte word alignment. On the other hand, Oracle Solaris Studio seems to
- * generate SPARCV8PLUS code with unaligned memory access instructions.
- * That is why the STRICT_ALIGNMENT is defined only with GCC.
- */
-#if defined(__sparc) && SIZEOF_VOIDP == 4 && defined(__GNUC__)
- #define STRICT_ALIGNMENT
-#endif
-
-#ifdef STRICT_ALIGNMENT
- #if defined(HAVE_TRUE_LONG_LONG) && SIZEOF_LONG_LONG > SIZEOF_VALUE
- #define ALIGNMENT_SIZE SIZEOF_LONG_LONG
- #else
- #define ALIGNMENT_SIZE SIZEOF_VALUE
- #endif
- #define PADDING_SIZE_MAX ((size_t)((ALIGNMENT_SIZE) - 1))
- #define ALIGNMENT_SIZE_MASK PADDING_SIZE_MAX
- /* Note: ALIGNMENT_SIZE == (2 ** N) is expected. */
-#else
- #define PADDING_SIZE_MAX 0
-#endif /* STRICT_ALIGNMENT */
-
-#ifdef STRICT_ALIGNMENT
-/* calculate padding size for aligned memory access */
-static size_t
-calc_padding(void *ptr, size_t size)
-{
- size_t mis;
- size_t padding = 0;
-
- mis = (size_t)ptr & ALIGNMENT_SIZE_MASK;
- if (mis > 0) {
- padding = ALIGNMENT_SIZE - mis;
- }
-/*
- * On 32-bit sparc or equivalents, when a single VALUE is requested
- * and padding == sizeof(VALUE), it is clear that no padding is needed.
- */
-#if ALIGNMENT_SIZE > SIZEOF_VALUE
- if (size == sizeof(VALUE) && padding == sizeof(VALUE)) {
- padding = 0;
- }
-#endif
-
- return padding;
-}
-#endif /* STRICT_ALIGNMENT */
-
static void *
compile_data_alloc(rb_iseq_t *iseq, size_t size)
{
void *ptr = 0;
struct iseq_compile_data_storage *storage =
- ISEQ_COMPILE_DATA(iseq)->storage_current;
-#ifdef STRICT_ALIGNMENT
- size_t padding = calc_padding((void *)&storage->buff[storage->pos], size);
-#else
- const size_t padding = 0; /* expected to be optimized by compiler */
-#endif /* STRICT_ALIGNMENT */
+ iseq->compile_data->storage_current;
- if (size >= INT_MAX - padding) rb_memerror();
- if (storage->pos + size + padding > storage->size) {
- unsigned int alloc_size = storage->size;
+ if (storage->pos + size > storage->size) {
+ unsigned long alloc_size = storage->size * 2;
- while (alloc_size < size + PADDING_SIZE_MAX) {
- if (alloc_size >= INT_MAX / 2) rb_memerror();
+ retry:
+ if (alloc_size < size) {
alloc_size *= 2;
+ goto retry;
}
storage->next = (void *)ALLOC_N(char, alloc_size +
- SIZEOF_ISEQ_COMPILE_DATA_STORAGE);
- storage = ISEQ_COMPILE_DATA(iseq)->storage_current = storage->next;
+ sizeof(struct
+ iseq_compile_data_storage));
+ storage = iseq->compile_data->storage_current = storage->next;
storage->next = 0;
storage->pos = 0;
storage->size = alloc_size;
-#ifdef STRICT_ALIGNMENT
- padding = calc_padding((void *)&storage->buff[storage->pos], size);
-#endif /* STRICT_ALIGNMENT */
+ storage->buff = (char *)(&storage->buff + 1);
}
-#ifdef STRICT_ALIGNMENT
- storage->pos += (int)padding;
-#endif /* STRICT_ALIGNMENT */
-
ptr = (void *)&storage->buff[storage->pos];
- storage->pos += (int)size;
+ storage->pos += size;
return ptr;
}
@@ -838,8 +646,9 @@ INSERT_ELEM_NEXT(LINK_ELEMENT *elem1, LINK_ELEMENT *elem2)
}
}
+#if 0 /* unused */
/*
- * elem1, elemX => elemX, elem2, elem1
+ * elemX, elem1 => elemX, elem2, elem1
*/
static void
INSERT_ELEM_PREV(LINK_ELEMENT *elem1, LINK_ELEMENT *elem2)
@@ -851,8 +660,8 @@ INSERT_ELEM_PREV(LINK_ELEMENT *elem1, LINK_ELEMENT *elem2)
elem2->prev->next = elem2;
}
}
+#endif
-#if 0
/*
* elemX, elem1, elemY => elemX, elem2, elemY
*/
@@ -868,7 +677,6 @@ REPLACE_ELEM(LINK_ELEMENT *elem1, LINK_ELEMENT *elem2)
elem1->next->prev = elem2;
}
}
-#endif
static void
REMOVE_ELEM(LINK_ELEMENT *elem)
@@ -885,11 +693,13 @@ FIRST_ELEMENT(LINK_ANCHOR *anchor)
return anchor->anchor.next;
}
+#if 0 /* unused */
static LINK_ELEMENT *
LAST_ELEMENT(LINK_ANCHOR *anchor)
{
- return anchor->last;
+ return anchor->last;
}
+#endif
static LINK_ELEMENT *
POP_ELEMENT(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor)
@@ -904,6 +714,32 @@ POP_ELEMENT(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor)
#define POP_ELEMENT(anchor) POP_ELEMENT(iseq, (anchor))
#endif
+#if 0 /* unused */
+static LINK_ELEMENT *
+SHIFT_ELEMENT(LINK_ANCHOR *anchor)
+{
+ LINK_ELEMENT *elem = anchor->anchor.next;
+ if (elem) {
+ anchor->anchor.next = elem->next;
+ }
+ return elem;
+}
+#endif
+
+#if 0 /* unused */
+static int
+LIST_SIZE(LINK_ANCHOR *anchor)
+{
+ LINK_ELEMENT *elem = anchor->anchor.next;
+ int size = 0;
+ while (elem) {
+ size += 1;
+ elem = elem->next;
+ }
+ return size;
+}
+#endif
+
static int
LIST_SIZE_ZERO(LINK_ANCHOR *anchor)
{
@@ -965,6 +801,65 @@ INSERT_LIST(ISEQ_ARG_DECLARE LINK_ANCHOR *anc1, LINK_ANCHOR *anc2)
#define INSERT_LIST(anc1, anc2) INSERT_LIST(iseq, (anc1), (anc2))
#endif
+#if 0 /* unused */
+/*
+ * anc1: e1, e2, e3
+ * anc2: e4, e5
+ *#=>
+ * anc1: e4, e5
+ * anc2: e1, e2, e3
+ */
+static void
+SWAP_LIST(ISEQ_ARG_DECLARE LINK_ANCHOR *anc1, LINK_ANCHOR *anc2)
+{
+ LINK_ANCHOR tmp = *anc2;
+
+ /* it has bug */
+ *anc2 = *anc1;
+ *anc1 = tmp;
+
+ verify_list("swap1", anc1);
+ verify_list("swap2", anc2);
+}
+#if CPDEBUG < 0
+#define SWAP_LIST(anc1, anc2) SWAP_LIST(iseq, (anc1), (anc2))
+#endif
+
+static LINK_ANCHOR *
+REVERSE_LIST(ISEQ_ARG_DECLARE LINK_ANCHOR *anc)
+{
+ LINK_ELEMENT *first, *last, *elem, *e;
+ first = &anc->anchor;
+ elem = first->next;
+ last = anc->last;
+
+ if (elem != 0) {
+ anc->anchor.next = last;
+ anc->last = elem;
+ }
+ else {
+ /* null list */
+ return anc;
+ }
+ while (elem) {
+ e = elem->next;
+ elem->next = elem->prev;
+ elem->prev = e;
+ elem = e;
+ }
+
+ first->next = last;
+ last->prev = first;
+ anc->last->next = 0;
+
+ verify_list("reverse", anc);
+ return anc;
+}
+#if CPDEBUG < 0
+#define REVERSE_LIST(anc) REVERSE_LIST(iseq, (anc))
+#endif
+#endif
+
#if CPDEBUG && 0
static void
debug_list(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor)
@@ -996,12 +891,9 @@ new_label_body(rb_iseq_t *iseq, long line)
labelobj->link.type = ISEQ_ELEMENT_LABEL;
labelobj->link.next = 0;
- labelobj->label_no = ISEQ_COMPILE_DATA(iseq)->label_no++;
+ labelobj->label_no = iseq->compile_data->label_no++;
labelobj->sc_state = 0;
labelobj->sp = -1;
- labelobj->refcnt = 0;
- labelobj->set = 0;
- labelobj->rescued = LABEL_RESCUE_NONE;
return labelobj;
}
@@ -1034,7 +926,7 @@ new_insn_core(rb_iseq_t *iseq, int line_no,
}
static INSN *
-new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int argc, ...)
+new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...)
{
VALUE *operands = 0;
va_list argv;
@@ -1051,65 +943,61 @@ new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int a
return new_insn_core(iseq, line_no, insn_id, argc, operands);
}
-static struct rb_call_info *
-new_callinfo(rb_iseq_t *iseq, ID mid, int argc, unsigned int flag, struct rb_call_info_kw_arg *kw_arg, int has_blockiseq)
+static rb_call_info_t *
+new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
{
- size_t size = kw_arg != NULL ? sizeof(struct rb_call_info_with_kwarg) : sizeof(struct rb_call_info);
- struct rb_call_info *ci = (struct rb_call_info *)compile_data_alloc(iseq, size);
- struct rb_call_info_with_kwarg *ci_kw = (struct rb_call_info_with_kwarg *)ci;
-
+ rb_call_info_t *ci = (rb_call_info_t *)compile_data_alloc(iseq, sizeof(rb_call_info_t));
ci->mid = mid;
ci->flag = flag;
ci->orig_argc = argc;
+ ci->argc = argc;
- if (kw_arg) {
- ci->flag |= VM_CALL_KWARG;
- ci_kw->kw_arg = kw_arg;
- ci->orig_argc += kw_arg->keyword_len;
- iseq->body->ci_kw_size++;
+ if (block) {
+ GetISeqPtr(block, ci->blockiseq);
}
else {
- iseq->body->ci_size++;
+ ci->blockiseq = 0;
+ if (!(ci->flag & (VM_CALL_ARGS_SPLAT | VM_CALL_ARGS_BLOCKARG))) {
+ ci->flag |= VM_CALL_ARGS_SKIP_SETUP;
+ }
}
+ ci->method_serial = 0;
+ ci->class_serial = 0;
+ ci->blockptr = 0;
+ ci->recv = Qundef;
+ ci->call = 0; /* TODO: should set default function? */
+
+ ci->aux.index = iseq->callinfo_size++;
- if (!(ci->flag & (VM_CALL_ARGS_SPLAT | VM_CALL_ARGS_BLOCKARG)) &&
- kw_arg == NULL && !has_blockiseq) {
- ci->flag |= VM_CALL_ARGS_SIMPLE;
- }
return ci;
}
static INSN *
-new_insn_send(rb_iseq_t *iseq, int line_no, ID id, VALUE argc, const rb_iseq_t *blockiseq, VALUE flag, struct rb_call_info_kw_arg *keywords)
+new_insn_send(rb_iseq_t *iseq, int line_no, VALUE id, VALUE argc, VALUE block, VALUE flag)
{
- VALUE *operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * 3);
- operands[0] = (VALUE)new_callinfo(iseq, id, FIX2INT(argc), FIX2INT(flag), keywords, blockiseq != NULL);
- operands[1] = Qfalse; /* cache */
- operands[2] = (VALUE)blockiseq;
- return new_insn_core(iseq, line_no, BIN(send), 3, operands);
+ VALUE *operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * 1);
+ operands[0] = (VALUE)new_callinfo(iseq, SYM2ID(id), FIX2INT(argc), block, FIX2INT(flag));
+ return new_insn_core(iseq, line_no, BIN(send), 1, operands);
}
-static rb_iseq_t *
+static VALUE
new_child_iseq(rb_iseq_t *iseq, NODE *node,
- VALUE name, const rb_iseq_t *parent, enum iseq_type type, int line_no)
+ VALUE name, VALUE parent, enum iseq_type type, int line_no)
{
- rb_iseq_t *ret_iseq;
+ VALUE ret;
debugs("[new_child_iseq]> ---------------------------------------\n");
- ret_iseq = rb_iseq_new_with_opt(node, name,
- iseq_path(iseq), iseq_absolute_path(iseq),
- INT2FIX(line_no), parent, type, ISEQ_COMPILE_DATA(iseq)->option);
+ ret = rb_iseq_new_with_opt(node, name,
+ iseq_path(iseq->self), iseq_absolute_path(iseq->self),
+ INT2FIX(line_no), parent, type, iseq->compile_data->option);
debugs("[new_child_iseq]< ---------------------------------------\n");
- iseq_add_mark_object(iseq, (VALUE)ret_iseq);
- return ret_iseq;
+ iseq_add_mark_object(iseq, ret);
+ return ret;
}
static int
iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
{
- if (RTEST(ISEQ_COMPILE_DATA(iseq)->err_info))
- return COMPILE_NG;
-
/* debugs("[compile step 2] (iseq_array_to_linkedlist)\n"); */
if (compile_debug > 5)
@@ -1121,14 +1009,14 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
if (compile_debug > 5)
dump_disasm_list(FIRST_ELEMENT(anchor));
- if (ISEQ_COMPILE_DATA(iseq)->option->instructions_unification) {
+ if (iseq->compile_data->option->instructions_unification) {
debugs("[compile step 3.2 (iseq_insns_unification)]\n");
iseq_insns_unification(iseq, anchor);
if (compile_debug > 5)
dump_disasm_list(FIRST_ELEMENT(anchor));
}
- if (ISEQ_COMPILE_DATA(iseq)->option->stack_caching) {
+ if (iseq->compile_data->option->stack_caching) {
debugs("[compile step 3.3 (iseq_set_sequence_stackcaching)]\n");
iseq_set_sequence_stackcaching(iseq, anchor);
if (compile_debug > 5)
@@ -1136,73 +1024,70 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
}
debugs("[compile step 4.1 (iseq_set_sequence)]\n");
- if (!iseq_set_sequence(iseq, anchor)) return COMPILE_NG;
+ iseq_set_sequence(iseq, anchor);
if (compile_debug > 5)
dump_disasm_list(FIRST_ELEMENT(anchor));
debugs("[compile step 4.2 (iseq_set_exception_table)]\n");
- if (!iseq_set_exception_table(iseq)) return COMPILE_NG;
+ iseq_set_exception_table(iseq);
debugs("[compile step 4.3 (set_optargs_table)] \n");
- if (!iseq_set_optargs_table(iseq)) return COMPILE_NG;
+ iseq_set_optargs_table(iseq);
debugs("[compile step 5 (iseq_translate_threaded_code)] \n");
- if (!rb_iseq_translate_threaded_code(iseq)) return COMPILE_NG;
+ rb_iseq_translate_threaded_code(iseq);
if (compile_debug > 1) {
- VALUE str = rb_iseq_disasm(iseq);
+ VALUE str = rb_iseq_disasm(iseq->self);
printf("%s\n", StringValueCStr(str));
+ fflush(stdout);
}
debugs("[compile step: finish]\n");
- return COMPILE_OK;
+ return 0;
}
static int
iseq_set_exception_local_table(rb_iseq_t *iseq)
{
- /* TODO: every id table is same -> share it.
- * Current problem is iseq_free().
- */
ID id_dollar_bang;
- ID *ids = (ID *)ALLOC_N(ID, 1);
CONST_ID(id_dollar_bang, "#$!");
- iseq->body->local_table_size = 1;
- iseq->body->local_size = iseq->body->local_table_size + 1;
- ids[0] = id_dollar_bang;
- iseq->body->local_table = ids;
+ iseq->local_table = (ID *)ALLOC_N(ID, 1);
+ iseq->local_table_size = 1;
+ iseq->local_size = iseq->local_table_size + 1;
+ iseq->local_table[0] = id_dollar_bang;
return COMPILE_OK;
}
static int
-get_lvar_level(const rb_iseq_t *iseq)
+get_lvar_level(rb_iseq_t *iseq)
{
int lev = 0;
- while (iseq != iseq->body->local_iseq) {
+ while (iseq != iseq->local_iseq) {
lev++;
- iseq = iseq->body->parent_iseq;
+ iseq = iseq->parent_iseq;
}
return lev;
}
static int
-get_dyna_var_idx_at_raw(const rb_iseq_t *iseq, ID id)
+get_dyna_var_idx_at_raw(rb_iseq_t *iseq, ID id)
{
- unsigned int i;
+ int i;
- for (i = 0; i < iseq->body->local_table_size; i++) {
- if (iseq->body->local_table[i] == id) {
- return (int)i;
+ for (i = 0; i < iseq->local_table_size; i++) {
+ if (iseq->local_table[i] == id) {
+ return i;
}
}
return -1;
}
static int
-get_local_var_idx(const rb_iseq_t *iseq, ID id)
+get_local_var_idx(rb_iseq_t *iseq, ID id)
{
- int idx = get_dyna_var_idx_at_raw(iseq->body->local_iseq, id);
+ int idx = get_dyna_var_idx_at_raw(iseq->local_iseq, id);
if (idx < 0) {
rb_bug("get_local_var_idx: %d", idx);
@@ -1212,7 +1097,7 @@ get_local_var_idx(const rb_iseq_t *iseq, ID id)
}
static int
-get_dyna_var_idx(const rb_iseq_t *iseq, ID id, int *level, int *ls)
+get_dyna_var_idx(rb_iseq_t *iseq, ID id, int *level, int *ls)
{
int lv = 0, idx = -1;
@@ -1221,7 +1106,7 @@ get_dyna_var_idx(const rb_iseq_t *iseq, ID id, int *level, int *ls)
if (idx >= 0) {
break;
}
- iseq = iseq->body->parent_iseq;
+ iseq = iseq->parent_iseq;
lv++;
}
@@ -1230,117 +1115,10 @@ get_dyna_var_idx(const rb_iseq_t *iseq, ID id, int *level, int *ls)
}
*level = lv;
- *ls = iseq->body->local_size;
+ *ls = iseq->local_size;
return idx;
}
-static void
-iseq_calc_param_size(rb_iseq_t *iseq)
-{
- if (iseq->body->param.flags.has_opt ||
- iseq->body->param.flags.has_post ||
- iseq->body->param.flags.has_rest ||
- iseq->body->param.flags.has_block ||
- iseq->body->param.flags.has_kw ||
- iseq->body->param.flags.has_kwrest) {
-
- if (iseq->body->param.flags.has_block) {
- iseq->body->param.size = iseq->body->param.block_start + 1;
- }
- else if (iseq->body->param.flags.has_kwrest) {
- iseq->body->param.size = iseq->body->param.keyword->rest_start + 1;
- }
- else if (iseq->body->param.flags.has_kw) {
- iseq->body->param.size = iseq->body->param.keyword->bits_start + 1;
- }
- else if (iseq->body->param.flags.has_post) {
- iseq->body->param.size = iseq->body->param.post_start + iseq->body->param.post_num;
- }
- else if (iseq->body->param.flags.has_rest) {
- iseq->body->param.size = iseq->body->param.rest_start + 1;
- }
- else if (iseq->body->param.flags.has_opt) {
- iseq->body->param.size = iseq->body->param.lead_num + iseq->body->param.opt_num;
- }
- else {
- rb_bug("unreachable");
- }
- }
- else {
- iseq->body->param.size = iseq->body->param.lead_num;
- }
-}
-
-static void
-iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *optargs, const struct rb_args_info *args)
-{
- NODE *node = args->kw_args;
- struct rb_iseq_param_keyword *keyword;
- const VALUE default_values = rb_ary_tmp_new(1);
- const VALUE complex_mark = rb_str_tmp_new(0);
- int kw = 0, rkw = 0, di = 0, i;
-
- iseq->body->param.flags.has_kw = TRUE;
- iseq->body->param.keyword = keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1);
- keyword->bits_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
-
- while (node) {
- NODE *val_node = node->nd_body->nd_value;
- VALUE dv;
-
- if (val_node == (NODE *)-1) {
- ++rkw;
- }
- else {
- switch (nd_type(val_node)) {
- case NODE_LIT:
- dv = val_node->nd_lit;
- iseq_add_mark_object(iseq, dv);
- break;
- case NODE_NIL:
- dv = Qnil;
- break;
- case NODE_TRUE:
- dv = Qtrue;
- break;
- case NODE_FALSE:
- dv = Qfalse;
- break;
- default:
- COMPILE_POPED(optargs, "kwarg", node); /* nd_type(node) == NODE_KW_ARG */
- dv = complex_mark;
- }
-
- keyword->num = ++di;
- rb_ary_push(default_values, dv);
- }
-
- kw++;
- node = node->nd_next;
- }
-
- keyword->num = kw;
-
- if (args->kw_rest_arg->nd_cflag != 0) {
- keyword->rest_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_cflag);
- iseq->body->param.flags.has_kwrest = TRUE;
- }
- keyword->required_num = rkw;
- keyword->table = &iseq->body->local_table[keyword->bits_start - keyword->num];
-
- {
- VALUE *dvs = ALLOC_N(VALUE, RARRAY_LEN(default_values));
-
- for (i = 0; i < RARRAY_LEN(default_values); i++) {
- VALUE dv = RARRAY_AREF(default_values, i);
- if (dv == complex_mark) dv = Qundef;
- dvs[i] = dv;
- }
-
- keyword->default_values = dvs;
- }
-}
-
static int
iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
{
@@ -1352,11 +1130,14 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
int last_comma = 0;
ID block_id = 0;
- EXPECT_NODE("iseq_set_arguments", node_args, NODE_ARGS);
+ if (nd_type(node_args) != NODE_ARGS) {
+ rb_bug("iseq_set_arguments: NODE_ARGS is expected, but %s",
+ ruby_node_name(nd_type(node_args)));
+ }
- iseq->body->param.lead_num = (int)args->pre_args_num;
- if (iseq->body->param.lead_num > 0) iseq->body->param.flags.has_lead = TRUE;
- debugs(" - argc: %d\n", iseq->body->param.lead_num);
+
+ iseq->argc = (int)args->pre_args_num;
+ debugs(" - argc: %d\n", iseq->argc);
rest_id = args->rest_arg;
if (rest_id == 1) {
@@ -1366,16 +1147,14 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
block_id = args->block_arg;
if (args->first_post_arg) {
- iseq->body->param.post_start = get_dyna_var_idx_at_raw(iseq, args->first_post_arg);
- iseq->body->param.post_num = args->post_args_num;
- iseq->body->param.flags.has_post = TRUE;
+ iseq->arg_post_start = get_dyna_var_idx_at_raw(iseq, args->first_post_arg);
+ iseq->arg_post_len = args->post_args_num;
}
if (args->opt_args) {
NODE *node = args->opt_args;
LABEL *label;
VALUE labels = rb_ary_tmp_new(1);
- VALUE *opt_table;
int i = 0, j;
while (node) {
@@ -1391,28 +1170,60 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
label = NEW_LABEL(nd_line(node_args));
rb_ary_push(labels, (VALUE)label | 1);
ADD_LABEL(optargs, label);
+ i += 1;
- opt_table = ALLOC_N(VALUE, i+1);
-
- MEMCPY(opt_table, RARRAY_CONST_PTR(labels), VALUE, i+1);
- for (j = 0; j < i+1; j++) {
- opt_table[j] &= ~1;
+ iseq->arg_opts = i;
+ iseq->arg_opt_table = ALLOC_N(VALUE, i);
+ MEMCPY(iseq->arg_opt_table, RARRAY_CONST_PTR(labels), VALUE, i);
+ for (j = 0; j < i; j++) {
+ iseq->arg_opt_table[j] &= ~1;
}
rb_ary_clear(labels);
-
- iseq->body->param.flags.has_opt = TRUE;
- iseq->body->param.opt_num = i;
- iseq->body->param.opt_table = opt_table;
+ }
+ else {
+ iseq->arg_opts = 0;
}
if (args->kw_args) {
- iseq_set_arguments_keywords(iseq, optargs, args);
+ NODE *node = args->kw_args;
+ VALUE keywords = rb_ary_tmp_new(1);
+ VALUE required = 0;
+ int i = 0, j, r = 0;
+
+ iseq->arg_keyword = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
+ COMPILE(optargs, "kwarg", args->kw_rest_arg);
+ while (node) {
+ VALUE list = keywords;
+ if (node->nd_body->nd_value == (NODE *)-1) {
+ ++r;
+ if (!required) required = rb_ary_tmp_new(1);
+ list = required;
+ }
+ rb_ary_push(list, INT2FIX(node->nd_body->nd_vid));
+ COMPILE_POPED(optargs, "kwarg", node); /* nd_type(node) == NODE_KW_ARG */
+ node = node->nd_next;
+ i += 1;
+ }
+ iseq->arg_keyword_check = (args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK;
+ iseq->arg_keywords = i;
+ iseq->arg_keyword_required = r;
+ iseq->arg_keyword_table = ALLOC_N(ID, i);
+ if (r) {
+ rb_ary_concat(required, keywords);
+ keywords = required;
+ }
+ for (j = 0; j < i; j++) {
+ iseq->arg_keyword_table[j] = FIX2INT(RARRAY_AREF(keywords, j));
+ }
+ ADD_INSN(optargs, nd_line(args->kw_args), pop);
}
else if (args->kw_rest_arg) {
- struct rb_iseq_param_keyword *keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1);
- keyword->rest_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
- iseq->body->param.keyword = keyword;
- iseq->body->param.flags.has_kwrest = TRUE;
+ iseq->arg_keyword = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
+ COMPILE(optargs, "kwarg", args->kw_rest_arg);
+ ADD_INSN(optargs, nd_line(args->kw_rest_arg), pop);
+ }
+ else {
+ iseq->arg_keyword = -1;
}
if (args->pre_init) { /* m_init */
@@ -1423,42 +1234,70 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
}
if (rest_id) {
- iseq->body->param.rest_start = get_dyna_var_idx_at_raw(iseq, rest_id);
- iseq->body->param.flags.has_rest = TRUE;
- assert(iseq->body->param.rest_start != -1);
+ iseq->arg_rest = get_dyna_var_idx_at_raw(iseq, rest_id);
- if (iseq->body->param.post_start == 0) { /* TODO: why that? */
- iseq->body->param.post_start = iseq->body->param.rest_start + 1;
+ if (iseq->arg_rest == -1) {
+ rb_bug("arg_rest: -1");
+ }
+
+ if (iseq->arg_post_start == 0) {
+ iseq->arg_post_start = iseq->arg_rest + 1;
}
}
if (block_id) {
- iseq->body->param.block_start = get_dyna_var_idx_at_raw(iseq, block_id);
- iseq->body->param.flags.has_block = TRUE;
+ iseq->arg_block = get_dyna_var_idx_at_raw(iseq, block_id);
}
- iseq_calc_param_size(iseq);
+ if (iseq->arg_opts != 0 || iseq->arg_post_len != 0 ||
+ iseq->arg_rest != -1 || iseq->arg_block != -1 ||
+ iseq->arg_keyword != -1) {
+ iseq->arg_simple = 0;
- if (iseq->body->type == ISEQ_TYPE_BLOCK) {
- if (iseq->body->param.flags.has_opt == FALSE &&
- iseq->body->param.flags.has_post == FALSE &&
- iseq->body->param.flags.has_rest == FALSE &&
- iseq->body->param.flags.has_kw == FALSE &&
- iseq->body->param.flags.has_kwrest == FALSE) {
+ /* set arg_size: size of arguments */
+ if (iseq->arg_keyword != -1) {
+ iseq->arg_size = iseq->arg_keyword + 1;
+ }
+ else if (iseq->arg_block != -1) {
+ iseq->arg_size = iseq->arg_block + 1;
+ }
+ else if (iseq->arg_post_len) {
+ iseq->arg_size = iseq->arg_post_start + iseq->arg_post_len;
+ }
+ else if (iseq->arg_rest != -1) {
+ iseq->arg_size = iseq->arg_rest + 1;
+ }
+ else if (iseq->arg_opts) {
+ iseq->arg_size = iseq->argc + iseq->arg_opts - 1;
+ }
+ else {
+ iseq->arg_size = iseq->argc;
+ }
+ }
+ else {
+ iseq->arg_simple = 1;
+ iseq->arg_size = iseq->argc;
+ }
- if (iseq->body->param.lead_num == 1 && last_comma == 0) {
+ if (iseq->type == ISEQ_TYPE_BLOCK) {
+ if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 &&
+ iseq->arg_rest == -1 && iseq->arg_keyword == -1) {
+ if (iseq->argc == 1 && last_comma == 0) {
/* {|a|} */
- iseq->body->param.flags.ambiguous_param0 = TRUE;
+ iseq->arg_simple |= 0x02;
}
}
}
}
+ else {
+ iseq->arg_simple = 1;
+ }
return COMPILE_OK;
}
static int
-iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl)
+iseq_set_local_table(rb_iseq_t *iseq, ID *tbl)
{
int size;
@@ -1471,13 +1310,12 @@ iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl)
}
if (size > 0) {
- ID *ids = (ID *)ALLOC_N(ID, size);
- MEMCPY(ids, tbl, ID, size);
- iseq->body->local_table = ids;
+ iseq->local_table = (ID *)ALLOC_N(ID, size);
+ MEMCPY(iseq->local_table, tbl, ID, size);
}
- iseq->body->local_size = iseq->body->local_table_size = size;
- iseq->body->local_size += 1;
+ iseq->local_size = iseq->local_table_size = size;
+ iseq->local_size += 1;
/*
if (lfp == dfp ) { // top, class, method
dfp[-1]: svar
@@ -1486,7 +1324,7 @@ iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl)
}
*/
- debugs("iseq_set_local_table: %d, %d\n", iseq->body->local_size, iseq->body->local_table_size);
+ debugs("iseq_set_local_table: %d, %d\n", iseq->local_size, iseq->local_table_size);
return COMPILE_OK;
}
@@ -1543,30 +1381,32 @@ cdhash_set_label_i(VALUE key, VALUE val, void *ptr)
static int
iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
{
+ LABEL *lobj;
+ INSN *iobj;
struct iseq_line_info_entry *line_info_table;
unsigned int last_line = 0;
LINK_ELEMENT *list;
VALUE *generated_iseq;
- int insn_num, code_index, line_info_index, sp, stack_max = 0, line = 0;
+ int k, pos, sp, stack_max = 0, line = 0;
- /* fix label position */
+ /* set label position */
list = FIRST_ELEMENT(anchor);
- insn_num = code_index = 0;
+ k = pos = 0;
while (list) {
switch (list->type) {
case ISEQ_ELEMENT_INSN:
{
- INSN *iobj = (INSN *)list;
+ iobj = (INSN *)list;
line = iobj->line_no;
- code_index += insn_data_length(iobj);
- insn_num++;
+ pos += insn_data_length(iobj);
+ k++;
break;
}
case ISEQ_ELEMENT_LABEL:
{
- LABEL *lobj = (LABEL *)list;
- lobj->position = code_index;
+ lobj = (LABEL *)list;
+ lobj->position = pos;
lobj->set = TRUE;
break;
}
@@ -1579,32 +1419,31 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
{
ADJUST *adjust = (ADJUST *)list;
if (adjust->line_no != -1) {
- code_index += 2 /* insn + 1 operand */;
- insn_num++;
+ pos += 2 /* insn + 1 operand */;
+ k++;
}
break;
}
default:
dump_disasm_list(FIRST_ELEMENT(anchor));
dump_disasm_list(list);
- COMPILE_ERROR(ruby_sourcefile_string, line, "error: set_sequence");
- return COMPILE_NG;
+ rb_compile_error(RSTRING_PTR(iseq->location.path), line,
+ "error: set_sequence");
+ break;
}
list = list->next;
}
/* make instruction sequence */
- generated_iseq = ALLOC_N(VALUE, code_index);
- line_info_table = ALLOC_N(struct iseq_line_info_entry, insn_num);
- iseq->body->is_entries = ZALLOC_N(union iseq_inline_storage_entry, iseq->body->is_size);
- iseq->body->ci_entries = (struct rb_call_info *)ruby_xmalloc(sizeof(struct rb_call_info) * iseq->body->ci_size +
- sizeof(struct rb_call_info_with_kwarg) * iseq->body->ci_kw_size);
- iseq->body->cc_entries = ZALLOC_N(struct rb_call_cache, iseq->body->ci_size + iseq->body->ci_kw_size);
-
- ISEQ_COMPILE_DATA(iseq)->ci_index = ISEQ_COMPILE_DATA(iseq)->ci_kw_index = 0;
+ generated_iseq = ALLOC_N(VALUE, pos);
+ line_info_table = ALLOC_N(struct iseq_line_info_entry, k);
+ iseq->is_entries = ALLOC_N(union iseq_inline_storage_entry, iseq->is_size);
+ MEMZERO(iseq->is_entries, union iseq_inline_storage_entry, iseq->is_size);
+ iseq->callinfo_entries = ALLOC_N(rb_call_info_t, iseq->callinfo_size);
+ /* MEMZERO(iseq->callinfo_entries, rb_call_info_t, iseq->callinfo_size); */
list = FIRST_ELEMENT(anchor);
- line_info_index = code_index = sp = 0;
+ k = pos = sp = 0;
while (list) {
switch (list->type) {
@@ -1613,7 +1452,8 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
int j, len, insn;
const char *types;
VALUE *operands;
- INSN *iobj = (INSN *)list;
+
+ iobj = (INSN *)list;
/* update sp */
sp = calc_sp_depth(sp, iobj);
@@ -1624,7 +1464,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
/* fprintf(stderr, "insn: %-16s, sp: %d\n", insn_name(iobj->insn_id), sp); */
operands = iobj->operands;
insn = iobj->insn_id;
- generated_iseq[code_index] = insn;
+ generated_iseq[pos] = insn;
types = insn_op_types(insn);
len = insn_len(insn);
@@ -1632,12 +1472,12 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
if (iobj->operand_size != len - 1) {
/* printf("operand size miss! (%d, %d)\n", iobj->operand_size, len); */
dump_disasm_list(list);
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
+ "operand size miss! (%d for %d)",
+ iobj->operand_size, len - 1);
xfree(generated_iseq);
xfree(line_info_table);
- COMPILE_ERROR(ruby_sourcefile_string, iobj->line_no,
- "operand size miss! (%d for %d)",
- iobj->operand_size, len - 1);
- return COMPILE_NG;
+ return 0;
}
for (j = 0; types[j]; j++) {
@@ -1647,16 +1487,15 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case TS_OFFSET:
{
/* label(destination position) */
- LABEL *lobj = (LABEL *)operands[j];
+ lobj = (LABEL *)operands[j];
if (!lobj->set) {
- COMPILE_ERROR(ruby_sourcefile_string, iobj->line_no,
- "unknown label");
- return COMPILE_NG;
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
+ "unknown label");
}
if (lobj->sp == -1) {
lobj->sp = sp;
}
- generated_iseq[code_index + 1 + j] = lobj->position - (code_index + len);
+ generated_iseq[pos + 1 + j] = lobj->position - (pos + len);
break;
}
case TS_CDHASH:
@@ -1664,102 +1503,87 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
VALUE map = operands[j];
struct cdhash_set_label_struct data;
data.hash = map;
- data.pos = code_index;
+ data.pos = pos;
data.len = len;
rb_hash_foreach(map, cdhash_set_label_i, (VALUE)&data);
- rb_hash_rehash(map);
- freeze_hide_obj(map);
- generated_iseq[code_index + 1 + j] = map;
+ hide_obj(map);
+ generated_iseq[pos + 1 + j] = map;
break;
}
case TS_LINDEX:
case TS_NUM: /* ulong */
- generated_iseq[code_index + 1 + j] = FIX2INT(operands[j]);
+ generated_iseq[pos + 1 + j] = FIX2INT(operands[j]);
break;
case TS_ISEQ: /* iseq */
{
VALUE v = operands[j];
- generated_iseq[code_index + 1 + j] = v;
+ rb_iseq_t *block = 0;
+ if (v) {
+ GetISeqPtr(v, block);
+ }
+ generated_iseq[pos + 1 + j] = (VALUE)block;
break;
}
case TS_VALUE: /* VALUE */
{
VALUE v = operands[j];
- generated_iseq[code_index + 1 + j] = v;
+ generated_iseq[pos + 1 + j] = v;
/* to mark ruby object */
iseq_add_mark_object(iseq, v);
break;
}
case TS_IC: /* inline cache */
{
- unsigned int ic_index = FIX2UINT(operands[j]);
- IC ic = (IC)&iseq->body->is_entries[ic_index];
- if (UNLIKELY(ic_index >= iseq->body->is_size)) {
- rb_bug("iseq_set_sequence: ic_index overflow: index: %d, size: %d", ic_index, iseq->body->is_size);
+ int ic_index = FIX2INT(operands[j]);
+ IC ic = (IC)&iseq->is_entries[ic_index];
+ if (UNLIKELY(ic_index >= iseq->is_size)) {
+ rb_bug("iseq_set_sequence: ic_index overflow: index: %d, size: %d", ic_index, iseq->is_size);
}
- generated_iseq[code_index + 1 + j] = (VALUE)ic;
+ generated_iseq[pos + 1 + j] = (VALUE)ic;
break;
}
case TS_CALLINFO: /* call info */
{
- struct rb_call_info *base_ci = (struct rb_call_info *)operands[j];
- struct rb_call_info *ci;
-
- if (base_ci->flag & VM_CALL_KWARG) {
- struct rb_call_info_with_kwarg *ci_kw_entries = (struct rb_call_info_with_kwarg *)&iseq->body->ci_entries[iseq->body->ci_size];
- struct rb_call_info_with_kwarg *ci_kw = &ci_kw_entries[ISEQ_COMPILE_DATA(iseq)->ci_kw_index++];
- *ci_kw = *((struct rb_call_info_with_kwarg *)base_ci);
- ci = (struct rb_call_info *)ci_kw;
- assert(ISEQ_COMPILE_DATA(iseq)->ci_kw_index <= iseq->body->ci_kw_size);
- }
- else {
- ci = &iseq->body->ci_entries[ISEQ_COMPILE_DATA(iseq)->ci_index++];
- *ci = *base_ci;
- assert(ISEQ_COMPILE_DATA(iseq)->ci_index <= iseq->body->ci_size);
- }
+ rb_call_info_t *base_ci = (rb_call_info_t *)operands[j];
+ rb_call_info_t *ci = &iseq->callinfo_entries[base_ci->aux.index];
+ *ci = *base_ci;
- generated_iseq[code_index + 1 + j] = (VALUE)ci;
- break;
- }
- case TS_CALLCACHE:
- {
- struct rb_call_cache *cc = &iseq->body->cc_entries[ISEQ_COMPILE_DATA(iseq)->ci_index + ISEQ_COMPILE_DATA(iseq)->ci_kw_index - 1];
- generated_iseq[code_index + 1 + j] = (VALUE)cc;
+ if (UNLIKELY(base_ci->aux.index >= iseq->callinfo_size)) {
+ rb_bug("iseq_set_sequence: ci_index overflow: index: %d, size: %d", base_ci->argc, iseq->callinfo_size);
+ }
+ generated_iseq[pos + 1 + j] = (VALUE)ci;
break;
}
case TS_ID: /* ID */
- generated_iseq[code_index + 1 + j] = SYM2ID(operands[j]);
+ generated_iseq[pos + 1 + j] = SYM2ID(operands[j]);
break;
case TS_GENTRY:
{
struct rb_global_entry *entry =
(struct rb_global_entry *)(operands[j] & (~1));
- generated_iseq[code_index + 1 + j] = (VALUE)entry;
+ generated_iseq[pos + 1 + j] = (VALUE)entry;
}
break;
- case TS_FUNCPTR:
- generated_iseq[code_index + 1 + j] = operands[j];
- break;
default:
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
+ "unknown operand type: %c", type);
xfree(generated_iseq);
xfree(line_info_table);
- COMPILE_ERROR(ruby_sourcefile_string, iobj->line_no,
- "unknown operand type: %c", type);
- return COMPILE_NG;
+ return 0;
}
}
if (last_line != iobj->line_no) {
- line_info_table[line_info_index].line_no = last_line = iobj->line_no;
- line_info_table[line_info_index].position = code_index;
- line_info_index++;
+ line_info_table[k].line_no = last_line = iobj->line_no;
+ line_info_table[k].position = pos;
+ k++;
}
- code_index += len;
+ pos += len;
break;
}
case ISEQ_ELEMENT_LABEL:
{
- LABEL *lobj = (LABEL *)list;
+ lobj = (LABEL *)list;
if (lobj->sp == -1) {
lobj->sp = sp;
}
@@ -1783,26 +1607,25 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
if (adjust->line_no != -1) {
if (orig_sp - sp > 0) {
if (last_line != (unsigned int)adjust->line_no) {
- line_info_table[line_info_index].line_no = last_line = adjust->line_no;
- line_info_table[line_info_index].position = code_index;
- line_info_index++;
+ line_info_table[k].line_no = last_line = adjust->line_no;
+ line_info_table[k].position = pos;
+ k++;
}
- generated_iseq[code_index++] = BIN(adjuststack);
- generated_iseq[code_index++] = orig_sp - sp;
+ generated_iseq[pos++] = BIN(adjuststack);
+ generated_iseq[pos++] = orig_sp - sp;
}
else if (orig_sp - sp == 0) {
/* jump to next insn */
if (last_line != (unsigned int)adjust->line_no) {
- line_info_table[line_info_index].line_no = last_line = adjust->line_no;
- line_info_table[line_info_index].position = code_index;
- line_info_index++;
+ line_info_table[k].line_no = last_line = adjust->line_no;
+ line_info_table[k].position = pos;
+ k++;
}
- generated_iseq[code_index++] = BIN(nop);
- generated_iseq[code_index++] = BIN(nop);
+ generated_iseq[pos++] = BIN(jump);
+ generated_iseq[pos++] = 0;
}
else {
- rb_compile_bug_str(ruby_sourcefile_string, adjust->line_no,
- "iseq_set_sequence: adjust bug %d < %d", orig_sp, sp);
+ rb_bug("iseq_set_sequence: adjust bug");
}
}
break;
@@ -1814,13 +1637,20 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
list = list->next;
}
- iseq->body->iseq_encoded = (void *)generated_iseq;
- iseq->body->iseq_size = code_index;
- iseq->body->stack_max = stack_max;
+#if 0 /* XXX */
+ /* this check need dead code elimination */
+ if (sp != 1) {
+ rb_bug("SP is not 0 on %s (%d)\n", RSTRING_PTR(iseq->name), sp);
+ }
+#endif
+
+ iseq->iseq = (void *)generated_iseq;
+ iseq->iseq_size = pos;
+ iseq->stack_max = stack_max;
- REALLOC_N(line_info_table, struct iseq_line_info_entry, line_info_index);
- iseq->body->line_info_table = line_info_table;
- iseq->body->line_info_size = line_info_index;
+ line_info_table = ruby_xrealloc(line_info_table, k * sizeof(struct iseq_line_info_entry));
+ iseq->line_info_table = line_info_table;
+ iseq->line_info_size = k;
return COMPILE_OK;
}
@@ -1841,53 +1671,47 @@ static int
iseq_set_exception_table(rb_iseq_t *iseq)
{
const VALUE *tptr, *ptr;
- unsigned int tlen, i;
+ int tlen, i;
struct iseq_catch_table_entry *entry;
- tlen = (int)RARRAY_LEN(ISEQ_COMPILE_DATA(iseq)->catch_table_ary);
- tptr = RARRAY_CONST_PTR(ISEQ_COMPILE_DATA(iseq)->catch_table_ary);
+ tlen = (int)RARRAY_LEN(iseq->compile_data->catch_table_ary);
+ tptr = RARRAY_CONST_PTR(iseq->compile_data->catch_table_ary);
- if (tlen > 0) {
- struct iseq_catch_table *table = xmalloc(iseq_catch_table_bytes(tlen));
- table->size = tlen;
+ iseq->catch_table = tlen ? ALLOC_N(struct iseq_catch_table_entry, tlen) : 0;
+ iseq->catch_table_size = tlen;
- for (i = 0; i < table->size; i++) {
- ptr = RARRAY_CONST_PTR(tptr[i]);
- entry = &table->entries[i];
- entry->type = (enum catch_type)(ptr[0] & 0xffff);
- entry->start = label_get_position((LABEL *)(ptr[1] & ~1));
- entry->end = label_get_position((LABEL *)(ptr[2] & ~1));
- entry->iseq = (rb_iseq_t *)ptr[3];
+ for (i = 0; i < tlen; i++) {
+ ptr = RARRAY_CONST_PTR(tptr[i]);
+ entry = &iseq->catch_table[i];
+ entry->type = (enum catch_type)(ptr[0] & 0xffff);
+ entry->start = label_get_position((LABEL *)(ptr[1] & ~1));
+ entry->end = label_get_position((LABEL *)(ptr[2] & ~1));
+ entry->iseq = ptr[3];
- /* register iseq as mark object */
- if (entry->iseq != 0) {
- iseq_add_mark_object(iseq, (VALUE)entry->iseq);
- }
+ /* register iseq as mark object */
+ if (entry->iseq != 0) {
+ iseq_add_mark_object(iseq, entry->iseq);
+ }
- /* stack depth */
- if (ptr[4]) {
- LABEL *lobj = (LABEL *)(ptr[4] & ~1);
- entry->cont = label_get_position(lobj);
- entry->sp = label_get_sp(lobj);
-
- /* TODO: Dirty Hack! Fix me */
- if (entry->type == CATCH_TYPE_RESCUE ||
- entry->type == CATCH_TYPE_BREAK ||
- entry->type == CATCH_TYPE_NEXT) {
- entry->sp--;
- }
- }
- else {
- entry->cont = 0;
+ /* stack depth */
+ if (ptr[4]) {
+ LABEL *lobj = (LABEL *)(ptr[4] & ~1);
+ entry->cont = label_get_position(lobj);
+ entry->sp = label_get_sp(lobj);
+
+ /* TODO: Dirty Hack! Fix me */
+ if (entry->type == CATCH_TYPE_RESCUE ||
+ entry->type == CATCH_TYPE_BREAK ||
+ entry->type == CATCH_TYPE_NEXT) {
+ entry->sp--;
}
}
- iseq->body->catch_table = table;
- RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, 0); /* free */
- }
- else {
- iseq->body->catch_table = NULL;
+ else {
+ entry->cont = 0;
+ }
}
+ OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, 0); /* free */
return COMPILE_OK;
}
@@ -1904,11 +1728,11 @@ static int
iseq_set_optargs_table(rb_iseq_t *iseq)
{
int i;
- VALUE *opt_table = (VALUE *)iseq->body->param.opt_table;
- if (iseq->body->param.flags.has_opt) {
- for (i = 0; i < iseq->body->param.opt_num + 1; i++) {
- opt_table[i] = label_get_position((LABEL *)opt_table[i]);
+ if (iseq->arg_opts != 0) {
+ for (i = 0; i < iseq->arg_opts; i++) {
+ iseq->arg_opt_table[i] =
+ label_get_position((LABEL *)iseq->arg_opt_table[i]);
}
}
return COMPILE_OK;
@@ -1958,50 +1782,6 @@ get_prev_insn(INSN *iobj)
return 0;
}
-static void
-unref_destination(INSN *iobj)
-{
- LABEL *lobj = (LABEL *)OPERAND_AT(iobj, 0);
- --lobj->refcnt;
- if (!lobj->refcnt) REMOVE_ELEM(&lobj->link);
-}
-
-static void
-replace_destination(INSN *dobj, INSN *nobj)
-{
- VALUE n = OPERAND_AT(nobj, 0);
- LABEL *dl = (LABEL *)OPERAND_AT(dobj, 0);
- LABEL *nl = (LABEL *)n;
- --dl->refcnt;
- ++nl->refcnt;
- OPERAND_AT(dobj, 0) = n;
- if (!dl->refcnt) REMOVE_ELEM(&dl->link);
-}
-
-static int
-remove_unreachable_chunk(LINK_ELEMENT *i)
-{
- int removed = 0;
- while (i) {
- if (i->type == ISEQ_ELEMENT_INSN) {
- switch (INSN_OF(i)) {
- case BIN(jump):
- case BIN(branchif):
- case BIN(branchunless):
- case BIN(branchnil):
- unref_destination((INSN *)i);
- default:
- break;
- }
- }
- else break;
- REMOVE_ELEM(i);
- removed = 1;
- i = i->next;
- }
- return removed;
-}
-
static int
iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcallopt)
{
@@ -2029,14 +1809,13 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* =>
* LABEL:
*/
- unref_destination(iobj);
REMOVE_ELEM(&iobj->link);
}
- else if (iobj != diobj && diobj->insn_id == BIN(jump) &&
- OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) {
- replace_destination(iobj, diobj);
- remove_unreachable_chunk(iobj->link.next);
- goto again;
+ else if (iobj != diobj && diobj->insn_id == BIN(jump)) {
+ if (OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) {
+ OPERAND_AT(iobj, 0) = OPERAND_AT(diobj, 0);
+ goto again;
+ }
}
else if (diobj->insn_id == BIN(leave)) {
/*
@@ -2050,14 +1829,14 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* LABEL:
* leave
*/
+ INSN *eiobj = new_insn_core(iseq, iobj->line_no, BIN(leave),
+ diobj->operand_size, diobj->operands);
INSN *popiobj = new_insn_core(iseq, iobj->line_no,
BIN(pop), 0, 0);
/* replace */
- unref_destination(iobj);
- iobj->insn_id = BIN(leave);
- iobj->operand_size = 0;
- INSERT_ELEM_NEXT(&iobj->link, &popiobj->link);
- goto again;
+ REPLACE_ELEM((LINK_ELEMENT *)iobj, (LINK_ELEMENT *)eiobj);
+ INSERT_ELEM_NEXT((LINK_ELEMENT *)eiobj, (LINK_ELEMENT *)popiobj);
+ iobj = popiobj;
}
/*
* useless jump elimination (if/unless destination):
@@ -2079,21 +1858,13 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
if (niobj == (INSN *)get_destination_insn(piobj)) {
piobj->insn_id = (piobj->insn_id == BIN(branchif))
? BIN(branchunless) : BIN(branchif);
- replace_destination(piobj, iobj);
+ OPERAND_AT(piobj, 0) = OPERAND_AT(iobj, 0);
REMOVE_ELEM(&iobj->link);
}
}
- else if (remove_unreachable_chunk(iobj->link.next)) {
- goto again;
- }
- }
-
- if (iobj->insn_id == BIN(leave)) {
- remove_unreachable_chunk(iobj->link.next);
}
if (iobj->insn_id == BIN(branchif) ||
- iobj->insn_id == BIN(branchnil) ||
iobj->insn_id == BIN(branchunless)) {
/*
* if L1
@@ -2104,124 +1875,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* if L2
*/
INSN *nobj = (INSN *)get_destination_insn(iobj);
- INSN *pobj = (INSN *)iobj->link.prev;
- int prev_dup = 0;
- if (pobj) {
- if (pobj->link.type != ISEQ_ELEMENT_INSN)
- pobj = 0;
- else if (pobj->insn_id == BIN(dup))
- prev_dup = 1;
- }
-
- for (;;) {
- if (nobj->insn_id == BIN(jump)) {
- replace_destination(iobj, nobj);
- }
- else if (prev_dup && nobj->insn_id == BIN(dup) &&
- !!(nobj = (INSN *)nobj->link.next) &&
- /* basic blocks, with no labels in the middle */
- nobj->insn_id == iobj->insn_id) {
- /*
- * dup
- * if L1
- * ...
- * L1:
- * dup
- * if L2
- * =>
- * dup
- * if L2
- * ...
- * L1:
- * dup
- * if L2
- */
- replace_destination(iobj, nobj);
- }
- else if (pobj) {
- /*
- * putnil
- * if L1
- * =>
- * # nothing
- *
- * putobject true
- * if L1
- * =>
- * jump L1
- *
- * putstring ".."
- * if L1
- * =>
- * jump L1
- *
- * putstring ".."
- * dup
- * if L1
- * =>
- * putstring ".."
- * jump L1
- *
- */
- int cond;
- if (prev_dup && pobj->link.prev->type == ISEQ_ELEMENT_INSN) {
- pobj = (INSN *)pobj->link.prev;
- }
- if (pobj->insn_id == BIN(putobject)) {
- cond = (iobj->insn_id == BIN(branchif) ?
- OPERAND_AT(pobj, 0) != Qfalse :
- iobj->insn_id == BIN(branchunless) ?
- OPERAND_AT(pobj, 0) == Qfalse :
- FALSE);
- }
- else if (pobj->insn_id == BIN(putstring)) {
- cond = iobj->insn_id == BIN(branchif);
- }
- else if (pobj->insn_id == BIN(putnil)) {
- cond = iobj->insn_id != BIN(branchif);
- }
- else break;
- REMOVE_ELEM(iobj->link.prev);
- if (cond) {
- iobj->insn_id = BIN(jump);
- goto again;
- }
- else {
- unref_destination(iobj);
- REMOVE_ELEM(&iobj->link);
- }
- break;
- }
- else break;
- nobj = (INSN *)get_destination_insn(nobj);
+ if (nobj->insn_id == BIN(jump)) {
+ OPERAND_AT(iobj, 0) = OPERAND_AT(nobj, 0);
}
}
- if (iobj->insn_id == BIN(pop)) {
- /*
- * putself / putnil / putobject obj / putstring "..."
- * pop
- * =>
- * # do nothing
- */
- LINK_ELEMENT *prev = iobj->link.prev;
- if (prev->type == ISEQ_ELEMENT_INSN) {
- enum ruby_vminsn_type previ = ((INSN *)prev)->insn_id;
- if (previ == BIN(putobject) || previ == BIN(putnil) ||
- previ == BIN(putself) || previ == BIN(putstring)) {
- /* just push operand or static value and pop soon, no
- * side effects */
- REMOVE_ELEM(prev);
- REMOVE_ELEM(&iobj->link);
- }
- }
- }
-
- if (do_tailcallopt &&
- (iobj->insn_id == BIN(send) ||
- iobj->insn_id == BIN(opt_aref_with) ||
- iobj->insn_id == BIN(opt_aset_with) ||
- iobj->insn_id == BIN(invokesuper))) {
+ if (do_tailcallopt && iobj->insn_id == BIN(leave)) {
/*
* send ...
* leave
@@ -2229,43 +1888,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* send ..., ... | VM_CALL_TAILCALL, ...
* leave # unreachable
*/
- INSN *piobj = NULL;
- if (iobj->link.next) {
- LINK_ELEMENT *next = iobj->link.next;
- do {
- if (next->type != ISEQ_ELEMENT_INSN) {
- next = next->next;
- continue;
- }
- switch (INSN_OF(next)) {
- case BIN(nop):
- /*case BIN(trace):*/
- next = next->next;
- break;
- case BIN(jump):
- /* if cond
- * return tailcall
- * end
- */
- next = get_destination_insn((INSN *)next);
- break;
- case BIN(leave):
- piobj = iobj;
- default:
- next = NULL;
- break;
- }
- } while (next);
- }
+ INSN *piobj = (INSN *)get_prev_insn((INSN *)list);
+ enum ruby_vminsn_type previ = piobj->insn_id;
- if (piobj) {
- struct rb_call_info *ci = (struct rb_call_info *)piobj->operands[0];
- if (piobj->insn_id == BIN(send) || piobj->insn_id == BIN(invokesuper)) {
- if (piobj->operands[2] == 0) { /* no blockiseq */
- ci->flag |= VM_CALL_TAILCALL;
- }
- }
- else {
+ if (previ == BIN(send) || previ == BIN(opt_send_simple) || previ == BIN(invokesuper)) {
+ rb_call_info_t *ci = (rb_call_info_t *)piobj->operands[0];
+ if (ci->blockiseq == 0) {
ci->flag |= VM_CALL_TAILCALL;
}
}
@@ -2276,17 +1904,18 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
static int
insn_set_specialized_instruction(rb_iseq_t *iseq, INSN *iobj, int insn_id)
{
+ int old_opsize = iobj->operand_size;
iobj->insn_id = insn_id;
iobj->operand_size = insn_len(insn_id) - 1;
- if (insn_id == BIN(opt_neq)) {
+ if (iobj->operand_size > old_opsize) {
VALUE *old_operands = iobj->operands;
- iobj->operand_size = 4;
+ if (insn_id != BIN(opt_neq)) {
+ rb_bug("insn_set_specialized_instruction: unknown insn: %d", insn_id);
+ }
iobj->operands = (VALUE *)compile_data_alloc(iseq, iobj->operand_size * sizeof(VALUE));
iobj->operands[0] = old_operands[0];
- iobj->operands[1] = Qfalse; /* CALL_CACHE */
- iobj->operands[2] = (VALUE)new_callinfo(iseq, idEq, 1, 0, NULL, FALSE);
- iobj->operands[3] = Qfalse; /* CALL_CACHE */
+ iobj->operands[1] = (VALUE)new_callinfo(iseq, idEq, 1, 0, 0);
}
return COMPILE_OK;
@@ -2296,11 +1925,10 @@ static int
iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
{
if (iobj->insn_id == BIN(send)) {
- struct rb_call_info *ci = (struct rb_call_info *)OPERAND_AT(iobj, 0);
- const rb_iseq_t *blockiseq = (rb_iseq_t *)OPERAND_AT(iobj, 2);
+ rb_call_info_t *ci = (rb_call_info_t *)OPERAND_AT(iobj, 0);
#define SP_INSN(opt) insn_set_specialized_instruction(iseq, iobj, BIN(opt_##opt))
- if (ci->flag & VM_CALL_ARGS_SIMPLE) {
+ if (ci->blockiseq == 0 && (ci->flag & ~VM_CALL_ARGS_SKIP_SETUP) == 0) {
switch (ci->orig_argc) {
case 0:
switch (ci->mid) {
@@ -2328,17 +1956,10 @@ iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
case idAREF: SP_INSN(aref); return COMPILE_OK;
}
break;
- case 2:
- switch (ci->mid) {
- case idASET: SP_INSN(aset); return COMPILE_OK;
- }
- break;
}
}
-
- if ((ci->flag & VM_CALL_ARGS_BLOCKARG) == 0 && blockiseq == NULL) {
- iobj->insn_id = BIN(opt_send_without_block);
- iobj->operand_size = insn_len(iobj->insn_id) - 1;
+ if (ci->flag & VM_CALL_ARGS_SKIP_SETUP) {
+ iobj->insn_id = BIN(opt_send_simple);
}
}
#undef SP_INSN
@@ -2346,37 +1967,20 @@ iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
return COMPILE_OK;
}
-static inline int
-tailcallable_p(rb_iseq_t *iseq)
-{
- switch (iseq->body->type) {
- case ISEQ_TYPE_RESCUE:
- case ISEQ_TYPE_ENSURE:
- /* rescue block can't tail call because of errinfo */
- return FALSE;
- default:
- return TRUE;
- }
-}
-
static int
iseq_optimize(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
{
LINK_ELEMENT *list;
- const int do_peepholeopt = ISEQ_COMPILE_DATA(iseq)->option->peephole_optimization;
- const int do_tailcallopt = tailcallable_p(iseq) &&
- ISEQ_COMPILE_DATA(iseq)->option->tailcall_optimization;
- const int do_si = ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction;
- const int do_ou = ISEQ_COMPILE_DATA(iseq)->option->operands_unification;
- int rescue_level = 0;
- int tailcallopt = do_tailcallopt;
-
+ const int do_peepholeopt = iseq->compile_data->option->peephole_optimization;
+ const int do_tailcallopt = iseq->compile_data->option->tailcall_optimization;
+ const int do_si = iseq->compile_data->option->specialized_instruction;
+ const int do_ou = iseq->compile_data->option->operands_unification;
list = FIRST_ELEMENT(anchor);
while (list) {
if (list->type == ISEQ_ELEMENT_INSN) {
if (do_peepholeopt) {
- iseq_peephole_optimize(iseq, list, tailcallopt);
+ iseq_peephole_optimize(iseq, list, do_tailcallopt);
}
if (do_si) {
iseq_specialized_instruction(iseq, (INSN *)list);
@@ -2385,17 +1989,6 @@ iseq_optimize(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
insn_operands_unification((INSN *)list);
}
}
- if (list->type == ISEQ_ELEMENT_LABEL) {
- switch (((LABEL *)list)->rescued) {
- case LABEL_RESCUE_BEG:
- rescue_level++;
- tailcallopt = FALSE;
- break;
- case LABEL_RESCUE_END:
- if (!--rescue_level) tailcallopt = do_tailcallopt;
- break;
- }
- }
list = list->next;
}
return COMPILE_OK;
@@ -2519,9 +2112,9 @@ insn_set_sc_state(rb_iseq_t *iseq, INSN *iobj, int state)
dump_disasm_list((LINK_ELEMENT *)iobj);
dump_disasm_list((LINK_ELEMENT *)lobj);
printf("\n-- %d, %d\n", lobj->sc_state, nstate);
- COMPILE_ERROR(ruby_sourcefile_string, iobj->line_no,
- "insn_set_sc_state error\n");
- return COMPILE_NG;
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
+ "insn_set_sc_state error\n");
+ return 0;
}
}
else {
@@ -2621,9 +2214,8 @@ iseq_set_sequence_stackcaching(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case SCS_XX:
goto normal_insn;
default:
- COMPILE_ERROR(ruby_sourcefile_string, iobj->line_no,
- "unreachable");
- return COMPILE_NG;
+ rb_compile_error(RSTRING_PTR(iseq->location.path), iobj->line_no,
+ "unreachable");
}
/* remove useless pop */
REMOVE_ELEM(list);
@@ -2658,27 +2250,20 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
{
NODE *list = node->nd_next;
VALUE lit = node->nd_lit;
- LINK_ELEMENT *first_lit = 0;
int cnt = 0;
debugp_param("nd_lit", lit);
if (!NIL_P(lit)) {
+ hide_obj(lit);
cnt++;
- if (!RB_TYPE_P(lit, T_STRING)) {
- rb_compile_bug_str(ERROR_ARGS "dstr: must be string: %s",
- rb_builtin_type_name(TYPE(lit)));
- }
- lit = node->nd_lit = rb_fstring(lit);
ADD_INSN1(ret, nd_line(node), putobject, lit);
- if (RSTRING_LEN(lit) == 0) first_lit = LAST_ELEMENT(ret);
}
while (list) {
node = list->nd_head;
if (nd_type(node) == NODE_STR) {
- node->nd_lit = rb_fstring(node->nd_lit);
+ hide_obj(node->nd_lit);
ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
- lit = Qnil;
}
else {
COMPILE(ret, "each string", node);
@@ -2686,10 +2271,6 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
cnt++;
list = list->nd_next;
}
- if (NIL_P(lit) && first_lit) {
- REMOVE_ELEM(first_lit);
- --cnt;
- }
*cntp = cnt;
return COMPILE_OK;
@@ -2758,52 +2339,6 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * cond,
return COMPILE_OK;
}
-static int
-compile_array_keyword_arg(rb_iseq_t *iseq, LINK_ANCHOR *ret, const NODE * const root_node, struct rb_call_info_kw_arg ** const kw_arg_ptr)
-{
- if (kw_arg_ptr == NULL) return FALSE;
-
- if (nd_type(root_node) == NODE_HASH && root_node->nd_head && nd_type(root_node->nd_head) == NODE_ARRAY) {
- NODE *node = root_node->nd_head;
-
- while (node) {
- NODE *key_node = node->nd_head;
-
- assert(nd_type(node) == NODE_ARRAY);
- if (key_node && nd_type(key_node) == NODE_LIT && RB_TYPE_P(key_node->nd_lit, T_SYMBOL)) {
- /* can be keywords */
- }
- else {
- return FALSE;
- }
- node = node->nd_next; /* skip value node */
- node = node->nd_next;
- }
-
- /* may be keywords */
- node = root_node->nd_head;
- {
- int len = (int)node->nd_alen / 2;
- struct rb_call_info_kw_arg *kw_arg = (struct rb_call_info_kw_arg *)ruby_xmalloc(sizeof(struct rb_call_info_kw_arg) + sizeof(VALUE) * (len - 1));
- VALUE *keywords = kw_arg->keywords;
- int i = 0;
- kw_arg->keyword_len = len;
-
- *kw_arg_ptr = kw_arg;
-
- for (i=0; node != NULL; i++, node = node->nd_next->nd_next) {
- NODE *key_node = node->nd_head;
- NODE *val_node = node->nd_next->nd_head;
- keywords[i] = key_node->nd_lit;
- COMPILE(ret, "keyword values", val_node);
- }
- assert(i == len);
- return TRUE;
- }
- }
- return FALSE;
-}
-
enum compile_array_type_t {
COMPILE_ARRAY_TYPE_ARRAY,
COMPILE_ARRAY_TYPE_HASH,
@@ -2812,7 +2347,7 @@ enum compile_array_type_t {
static int
compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
- enum compile_array_type_t type, struct rb_call_info_kw_arg **keywords_ptr, int poped)
+ enum compile_array_type_t type, int poped)
{
NODE *node = node_root;
int line = (int)nd_line(node);
@@ -2839,30 +2374,22 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
INIT_ANCHOR(anchor);
for (i=0; i<max && node; i++, len++, node = node->nd_next) {
- if (CPDEBUG > 0) {
- EXPECT_NODE("compile_array", node, NODE_ARRAY);
+ if (CPDEBUG > 0 && nd_type(node) != NODE_ARRAY) {
+ rb_bug("compile_array: This node is not NODE_ARRAY, but %s", ruby_node_name(nd_type(node)));
}
- if (type != COMPILE_ARRAY_TYPE_ARRAY && !node->nd_head) {
+ if (type == COMPILE_ARRAY_TYPE_HASH && !node->nd_head) {
+ opt_p = 0;
kw = node->nd_next;
- node = 0;
- if (kw) {
- opt_p = 0;
- node = kw->nd_next;
- kw = kw->nd_head;
- }
+ node = kw->nd_next;
+ kw = kw->nd_head;
break;
}
if (opt_p && nd_type(node->nd_head) != NODE_LIT) {
opt_p = 0;
}
- if (type == COMPILE_ARRAY_TYPE_ARGS && node->nd_next == NULL /* last node */ && compile_array_keyword_arg(iseq, anchor, node->nd_head, keywords_ptr)) {
- len--;
- }
- else {
- COMPILE_(anchor, "array element", node->nd_head, poped);
- }
+ COMPILE_(anchor, "array element", node->nd_head, poped);
}
if (opt_p && type != COMPILE_ARRAY_TYPE_ARGS) {
@@ -2897,7 +2424,7 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
else { /* COMPILE_ARRAY_TYPE_HASH */
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN1(ret, line, putobject, ary);
- ADD_SEND(ret, line, id_core_hash_from_ary, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(id_core_hash_from_ary), INT2FIX(1));
}
}
else {
@@ -2908,7 +2435,7 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
else {
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN1(ret, line, putobject, ary);
- ADD_SEND(ret, line, id_core_hash_merge_ary, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_ary), INT2FIX(1));
}
}
}
@@ -2938,7 +2465,7 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN(ret, line, swap);
APPEND_LIST(ret, anchor);
- ADD_SEND(ret, line, id_core_hash_merge_ptr, INT2FIX(i + 1));
+ ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_ptr), INT2FIX(i + 1));
}
}
if (kw) {
@@ -2946,8 +2473,7 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
if (i > 0 || !first) ADD_INSN(ret, line, swap);
COMPILE(ret, "keyword splat", kw);
- ADD_SEND(ret, line, id_core_hash_merge_kwd, nhash);
- if (nhash == INT2FIX(1)) ADD_SEND(ret, line, rb_intern("dup"), INT2FIX(0));
+ ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_kwd), nhash);
}
first = 0;
break;
@@ -2969,7 +2495,7 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
static VALUE
compile_array(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root, enum compile_array_type_t type)
{
- return compile_array_(iseq, ret, node_root, type, NULL, 0);
+ return compile_array_(iseq, ret, node_root, type, 0);
}
static VALUE
@@ -2988,14 +2514,8 @@ case_when_optimizable_literal(NODE * node)
}
break;
}
- case NODE_NIL:
- return Qnil;
- case NODE_TRUE:
- return Qtrue;
- case NODE_FALSE:
- return Qfalse;
case NODE_STR:
- return node->nd_lit = rb_fstring(node->nd_lit);
+ return node->nd_lit;
}
return Qundef;
}
@@ -3012,8 +2532,7 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, int onl
}
else {
if (rb_hash_lookup(literals, lit) != Qnil) {
- rb_compile_warning(ruby_sourcefile, nd_line(val),
- "duplicated when clause is ignored");
+ rb_compile_warning(RSTRING_PTR(iseq->location.path), nd_line(val), "duplicated when clause is ignored");
}
else {
rb_hash_aset(literals, lit, (VALUE)(l1) | 1);
@@ -3023,8 +2542,8 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, int onl
ADD_INSN(cond_seq, nd_line(val), dup); /* dup target */
if (nd_type(val) == NODE_STR) {
- val->nd_lit = rb_fstring(val->nd_lit);
debugp_param("nd_lit", val->nd_lit);
+ OBJ_FREEZE(val->nd_lit);
ADD_INSN1(cond_seq, nd_line(val), putobject, val->nd_lit);
}
else {
@@ -3044,24 +2563,21 @@ compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node)
switch (nd_type(node)) {
case NODE_ATTRASGN: {
INSN *iobj;
- struct rb_call_info *ci;
+ rb_call_info_t *ci;
VALUE dupidx;
- int line = nd_line(node);
COMPILE_POPED(ret, "masgn lhs (NODE_ATTRASGN)", node);
- iobj = (INSN *)get_prev_insn((INSN *)LAST_ELEMENT(ret)); /* send insn */
- ci = (struct rb_call_info *)iobj->operands[0];
- ci->orig_argc += 1;
+ POP_ELEMENT(ret); /* pop pop insn */
+ iobj = (INSN *)POP_ELEMENT(ret); /* pop send insn */
+ ci = (rb_call_info_t *)iobj->operands[0];
+ ci->orig_argc += 1; ci->argc = ci->orig_argc;
dupidx = INT2FIX(ci->orig_argc);
- INSERT_BEFORE_INSN1(iobj, line, topn, dupidx);
- if (ci->flag & VM_CALL_ARGS_SPLAT) {
- --ci->orig_argc;
- INSERT_BEFORE_INSN1(iobj, line, newarray, INT2FIX(1));
- INSERT_BEFORE_INSN(iobj, line, concatarray);
- }
- ADD_INSN(ret, line, pop); /* result */
+ ADD_INSN1(ret, nd_line(node), topn, dupidx);
+ ADD_ELEM(ret, (LINK_ELEMENT *)iobj);
+ ADD_INSN(ret, nd_line(node), pop); /* result */
+ ADD_INSN(ret, nd_line(node), pop); /* rhs */
break;
}
case NODE_MASGN: {
@@ -3158,17 +2674,6 @@ compile_massign_opt(rb_iseq_t *iseq, LINK_ANCHOR *ret,
return 1;
}
-static void
-adjust_stack(rb_iseq_t *iseq, LINK_ANCHOR *ret, int line, int rlen, int llen)
-{
- if (rlen < llen) {
- do {ADD_INSN(ret, line, putnil);} while (++rlen < llen);
- }
- else if (rlen > llen) {
- do {ADD_INSN(ret, line, pop);} while (--rlen > llen);
- }
-}
-
static int
compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int poped)
{
@@ -3179,7 +2684,6 @@ compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int poped)
if (!poped || splatn || !compile_massign_opt(iseq, ret, rhsn, lhsn)) {
int llen = 0;
- int expand = 1;
DECL_ANCHOR(lhsseq);
INIT_ANCHOR(lhsseq);
@@ -3195,35 +2699,9 @@ compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int poped)
if (!poped) {
ADD_INSN(ret, nd_line(node), dup);
}
- else if (!lhs_splat) {
- INSN *last = (INSN*)ret->last;
- if (last->link.type == ISEQ_ELEMENT_INSN &&
- last->insn_id == BIN(newarray) &&
- last->operand_size == 1) {
- int rlen = FIX2INT(OPERAND_AT(last, 0));
- /* special case: assign to aset or attrset */
- if (llen == 2) {
- POP_ELEMENT(ret);
- adjust_stack(iseq, ret, nd_line(node), rlen, llen);
- ADD_INSN(ret, nd_line(node), swap);
- expand = 0;
- }
- else if (llen > 2 && llen != rlen) {
- POP_ELEMENT(ret);
- adjust_stack(iseq, ret, nd_line(node), rlen, llen);
- ADD_INSN1(ret, nd_line(node), reverse, INT2FIX(llen));
- expand = 0;
- }
- else if (llen > 2) {
- last->insn_id = BIN(reverse);
- expand = 0;
- }
- }
- }
- if (expand) {
- ADD_INSN2(ret, nd_line(node), expandarray,
- INT2FIX(llen), INT2FIX(lhs_splat));
- }
+
+ ADD_INSN2(ret, nd_line(node), expandarray,
+ INT2FIX(llen), INT2FIX(lhs_splat));
ADD_SEQ(ret, lhsseq);
if (lhs_splat) {
@@ -3302,8 +2780,6 @@ compile_cpath(LINK_ANCHOR *ret, rb_iseq_t *iseq, NODE *cpath)
}
}
-#define private_recv_p(node) (nd_type((node)->nd_recv) == NODE_SELF)
-
#define defined_expr defined_expr0
static int
defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
@@ -3407,10 +2883,17 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
case NODE_VCALL:
case NODE_FCALL:
case NODE_ATTRASGN:{
- const int explicit_receiver =
- (type == NODE_CALL ||
- (type == NODE_ATTRASGN && !private_recv_p(node)));
+ int self = TRUE;
+ switch (type) {
+ case NODE_ATTRASGN:
+ if (node->nd_recv == (NODE *)1) break;
+ case NODE_CALL:
+ self = FALSE;
+ break;
+ default:
+ /* through */;
+ }
if (!lfinish[1]) {
lfinish[1] = NEW_LABEL(nd_line(node));
}
@@ -3418,7 +2901,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
defined_expr(iseq, ret, node->nd_args, lfinish, Qfalse);
ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]);
}
- if (explicit_receiver) {
+ if (!self) {
defined_expr(iseq, ret, node->nd_recv, lfinish, Qfalse);
ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]);
COMPILE(ret, "defined/recv", node->nd_recv);
@@ -3495,13 +2978,11 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
int line = nd_line(node);
LABEL *lstart = NEW_LABEL(line);
LABEL *lend = NEW_LABEL(line);
- const rb_iseq_t *rescue = NEW_CHILD_ISEQ(NEW_NIL(),
- rb_str_concat(rb_str_new2
- ("defined guard in "),
- iseq->body->location.label),
- ISEQ_TYPE_DEFINED_GUARD, 0);
- lstart->rescued = LABEL_RESCUE_BEG;
- lend->rescued = LABEL_RESCUE_END;
+ VALUE rescue = NEW_CHILD_ISEQVAL(NEW_NIL(),
+ rb_str_concat(rb_str_new2
+ ("defined guard in "),
+ iseq->location.label),
+ ISEQ_TYPE_DEFINED_GUARD, 0);
APPEND_LABEL(ret, lcur, lstart);
ADD_LABEL(ret, lend);
ADD_CATCH_ENTRY(CATCH_TYPE_RESCUE, lstart, lend, rescue, lfinish[1]);
@@ -3509,26 +2990,28 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
return done;
}
+#define BUFSIZE 0x100
+
static VALUE
-make_name_for_block(const rb_iseq_t *orig_iseq)
+make_name_for_block(rb_iseq_t *iseq)
{
int level = 1;
- const rb_iseq_t *iseq = orig_iseq;
+ rb_iseq_t *ip = iseq;
- if (orig_iseq->body->parent_iseq != 0) {
- while (orig_iseq->body->local_iseq != iseq) {
- if (iseq->body->type == ISEQ_TYPE_BLOCK) {
+ if (iseq->parent_iseq != 0) {
+ while (ip->local_iseq != ip) {
+ if (ip->type == ISEQ_TYPE_BLOCK) {
level++;
}
- iseq = iseq->body->parent_iseq;
+ ip = ip->parent_iseq;
}
}
if (level == 1) {
- return rb_sprintf("block in %"PRIsVALUE, iseq->body->location.label);
+ return rb_sprintf("block in %"PRIsVALUE, ip->location.label);
}
else {
- return rb_sprintf("block (%d levels) in %"PRIsVALUE, level, iseq->body->location.label);
+ return rb_sprintf("block (%d levels) in %"PRIsVALUE, level, ip->location.label);
}
}
@@ -3538,9 +3021,9 @@ push_ensure_entry(rb_iseq_t *iseq,
struct ensure_range *er, NODE *node)
{
enl->ensure_node = node;
- enl->prev = ISEQ_COMPILE_DATA(iseq)->ensure_node_stack; /* prev */
+ enl->prev = iseq->compile_data->ensure_node_stack; /* prev */
enl->erange = er;
- ISEQ_COMPILE_DATA(iseq)->ensure_node_stack = enl;
+ iseq->compile_data->ensure_node_stack = enl;
}
static void
@@ -3565,7 +3048,7 @@ static void
add_ensure_iseq(LINK_ANCHOR *ret, rb_iseq_t *iseq, int is_return)
{
struct iseq_compile_data_ensure_node_stack *enlp =
- ISEQ_COMPILE_DATA(iseq)->ensure_node_stack;
+ iseq->compile_data->ensure_node_stack;
struct iseq_compile_data_ensure_node_stack *prev_enlp = enlp;
DECL_ANCHOR(ensure);
@@ -3579,7 +3062,7 @@ add_ensure_iseq(LINK_ANCHOR *ret, rb_iseq_t *iseq, int is_return)
add_ensure_range(iseq, enlp->erange, lstart, lend);
- ISEQ_COMPILE_DATA(iseq)->ensure_node_stack = enlp->prev;
+ iseq->compile_data->ensure_node_stack = enlp->prev;
ADD_LABEL(ensure_part, lstart);
COMPILE_POPED(ensure_part, "ensure part", enlp->ensure_node);
ADD_LABEL(ensure_part, lend);
@@ -3592,12 +3075,12 @@ add_ensure_iseq(LINK_ANCHOR *ret, rb_iseq_t *iseq, int is_return)
}
enlp = enlp->prev;
}
- ISEQ_COMPILE_DATA(iseq)->ensure_node_stack = prev_enlp;
+ iseq->compile_data->ensure_node_stack = prev_enlp;
ADD_SEQ(ret, ensure);
}
static VALUE
-setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, unsigned int *flag, struct rb_call_info_kw_arg **keywords)
+setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
{
VALUE argc = INT2FIX(0);
int nsplat = 0;
@@ -3617,7 +3100,6 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, unsigned int *flag, s
switch (nd_type(argn)) {
case NODE_SPLAT: {
COMPILE(args, "args (splat)", argn->nd_head);
- ADD_INSN1(args, nd_line(argn), splatarray, nsplat ? Qtrue : Qfalse);
argc = INT2FIX(1);
nsplat++;
*flag |= VM_CALL_ARGS_SPLAT;
@@ -3630,11 +3112,16 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, unsigned int *flag, s
INIT_ANCHOR(tmp);
COMPILE(tmp, "args (cat: splat)", argn->nd_body);
- if (nd_type(argn) == NODE_ARGSCAT) {
- ADD_INSN1(tmp, nd_line(argn), splatarray, nsplat ? Qtrue : Qfalse);
+ if (next_is_array && nsplat == 0) {
+ /* none */
}
else {
- ADD_INSN1(tmp, nd_line(argn), newarray, INT2FIX(1));
+ if (nd_type(argn) == NODE_ARGSCAT) {
+ ADD_INSN1(tmp, nd_line(argn), splatarray, Qfalse);
+ }
+ else {
+ ADD_INSN1(tmp, nd_line(argn), newarray, INT2FIX(1));
+ }
}
INSERT_LIST(args_splat, tmp);
nsplat++;
@@ -3649,13 +3136,12 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, unsigned int *flag, s
}
break;
}
- case NODE_ARRAY:
- {
- argc = INT2FIX(compile_array_(iseq, args, argn, COMPILE_ARRAY_TYPE_ARGS, keywords, FALSE));
- break;
- }
+ case NODE_ARRAY: {
+ argc = INT2FIX(compile_array(iseq, args, argn, COMPILE_ARRAY_TYPE_ARGS));
+ break;
+ }
default: {
- UNKNOWN_NODE("setup_arg", argn);
+ rb_bug("setup_arg: unknown node: %s\n", ruby_node_name(nd_type(argn)));
}
}
}
@@ -3682,10 +3168,9 @@ build_postexe_iseq(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *body)
{
int line = nd_line(body);
VALUE argc = INT2FIX(0);
- const rb_iseq_t *block = NEW_CHILD_ISEQ(body, make_name_for_block(iseq->body->parent_iseq), ISEQ_TYPE_BLOCK, line);
-
+ VALUE block = NEW_CHILD_ISEQVAL(body, make_name_for_block(iseq->parent_iseq), ISEQ_TYPE_BLOCK, line);
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_CALL_WITH_BLOCK(ret, line, id_core_set_postexe, argc, block);
+ ADD_CALL_WITH_BLOCK(ret, line, ID2SYM(id_core_set_postexe), argc, block);
iseq_set_local_table(iseq, 0);
return Qnil;
}
@@ -3707,28 +3192,21 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (node == 0) {
if (!poped) {
debugs("node: NODE_NIL(implicit)\n");
- ADD_INSN(ret, ISEQ_COMPILE_DATA(iseq)->last_line, putnil);
+ ADD_INSN(ret, iseq->compile_data->last_line, putnil);
}
return COMPILE_OK;
}
- line = (int)nd_line(node);
-
- if (ISEQ_COMPILE_DATA(iseq)->last_line == line) {
- /* ignore */
- }
- else {
- if (node->flags & NODE_FL_NEWLINE) {
- ISEQ_COMPILE_DATA(iseq)->last_line = line;
- ADD_TRACE(ret, line, RUBY_EVENT_LINE);
- saved_last_element = ret->last;
- }
- }
-
+ iseq->compile_data->last_line = line = (int)nd_line(node);
debug_node_start(node);
type = nd_type(node);
+ if (node->flags & NODE_FL_NEWLINE) {
+ ADD_TRACE(ret, line, RUBY_EVENT_LINE);
+ saved_last_element = ret->last;
+ }
+
switch (type) {
case NODE_BLOCK:{
while (node && nd_type(node) == NODE_BLOCK) {
@@ -3799,9 +3277,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
line = nd_line(node);
if (type != NODE_WHEN) {
- COMPILE_ERROR(ERROR_ARGS "NODE_CASE: unexpected node. must be NODE_WHEN, but %s", ruby_node_name(type));
- debug_node_end();
- return COMPILE_NG;
+ COMPILE_ERROR((ERROR_ARGS "NODE_CASE: unexpected node. must be NODE_WHEN, but %s", ruby_node_name(type)));
}
endlabel = NEW_LABEL(line);
@@ -3834,11 +3310,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSNL(cond_seq, nd_line(vals), branchif, l1);
break;
default:
- UNKNOWN_NODE("NODE_CASE", vals);
+ rb_bug("NODE_CASE: unknown node (%s)",
+ ruby_node_name(nd_type(vals)));
}
}
else {
- EXPECT_NODE_NONULL("NODE_CASE", node, NODE_ARRAY);
+ rb_bug("NODE_CASE: must be NODE_ARRAY, but 0");
}
node = node->nd_next;
@@ -3870,7 +3347,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN(ret, nd_line(tempnode), dup);
ADD_INSN2(ret, nd_line(tempnode), opt_case_dispatch, literals, elselabel);
- LABEL_REF(elselabel);
}
ADD_SEQ(ret, cond_seq);
@@ -3896,7 +3372,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
vals = node->nd_head;
if (!vals) {
- rb_compile_bug_str(ERROR_ARGS "NODE_WHEN: must be NODE_ARRAY, but 0");
+ rb_bug("NODE_WHEN: must be NODE_ARRAY, but 0");
}
switch (nd_type(vals)) {
case NODE_ARRAY:
@@ -3916,7 +3392,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSNL(ret, nd_line(vals), branchif, l1);
break;
default:
- UNKNOWN_NODE("NODE_WHEN", vals);
+ rb_bug("NODE_WHEN: unknown node (%s)",
+ ruby_node_name(nd_type(vals)));
}
node = node->nd_next;
}
@@ -3932,23 +3409,22 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_OPT_N:
case NODE_WHILE:
case NODE_UNTIL:{
- LABEL *prev_start_label = ISEQ_COMPILE_DATA(iseq)->start_label;
- LABEL *prev_end_label = ISEQ_COMPILE_DATA(iseq)->end_label;
- LABEL *prev_redo_label = ISEQ_COMPILE_DATA(iseq)->redo_label;
- int prev_loopval_popped = ISEQ_COMPILE_DATA(iseq)->loopval_popped;
+ LABEL *prev_start_label = iseq->compile_data->start_label;
+ LABEL *prev_end_label = iseq->compile_data->end_label;
+ LABEL *prev_redo_label = iseq->compile_data->redo_label;
+ int prev_loopval_popped = iseq->compile_data->loopval_popped;
struct iseq_compile_data_ensure_node_stack enl;
- LABEL *next_label = ISEQ_COMPILE_DATA(iseq)->start_label = NEW_LABEL(line); /* next */
- LABEL *redo_label = ISEQ_COMPILE_DATA(iseq)->redo_label = NEW_LABEL(line); /* redo */
- LABEL *break_label = ISEQ_COMPILE_DATA(iseq)->end_label = NEW_LABEL(line); /* break */
+ LABEL *next_label = iseq->compile_data->start_label = NEW_LABEL(line); /* next */
+ LABEL *redo_label = iseq->compile_data->redo_label = NEW_LABEL(line); /* redo */
+ LABEL *break_label = iseq->compile_data->end_label = NEW_LABEL(line); /* break */
LABEL *end_label = NEW_LABEL(line);
- LABEL *adjust_label = NEW_LABEL(line);
LABEL *next_catch_label = NEW_LABEL(line);
LABEL *tmp_label = NULL;
- ISEQ_COMPILE_DATA(iseq)->loopval_popped = 0;
+ iseq->compile_data->loopval_popped = 0;
push_ensure_entry(iseq, &enl, 0, 0);
if (type == NODE_OPT_N || node->nd_state == 1) {
@@ -3958,7 +3434,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
tmp_label = NEW_LABEL(line);
ADD_INSNL(ret, line, jump, tmp_label);
}
- ADD_LABEL(ret, adjust_label);
ADD_INSN(ret, line, putnil);
ADD_LABEL(ret, next_catch_label);
ADD_INSN(ret, line, pop);
@@ -3980,17 +3455,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
else {
ADD_CALL_RECEIVER(ret, line);
- ADD_CALL(ret, line, idGets, INT2FIX(0));
+ ADD_CALL(ret, line, ID2SYM(idGets), INT2FIX(0));
ADD_INSNL(ret, line, branchif, redo_label);
/* opt_n */
}
ADD_LABEL(ret, end_label);
- ADD_ADJUST_RESTORE(ret, adjust_label);
if (node->nd_state == Qundef) {
/* ADD_INSN(ret, line, putundef); */
- rb_compile_bug_str(ERROR_ARGS "unsupported: putundef");
+ rb_bug("unsupported: putundef");
}
else {
ADD_INSN(ret, line, putnil);
@@ -4007,44 +3481,18 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, redo_label, break_label, 0,
next_catch_label);
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, redo_label, break_label, 0,
- ISEQ_COMPILE_DATA(iseq)->redo_label);
+ iseq->compile_data->redo_label);
- ISEQ_COMPILE_DATA(iseq)->start_label = prev_start_label;
- ISEQ_COMPILE_DATA(iseq)->end_label = prev_end_label;
- ISEQ_COMPILE_DATA(iseq)->redo_label = prev_redo_label;
- ISEQ_COMPILE_DATA(iseq)->loopval_popped = prev_loopval_popped;
- ISEQ_COMPILE_DATA(iseq)->ensure_node_stack = ISEQ_COMPILE_DATA(iseq)->ensure_node_stack->prev;
+ iseq->compile_data->start_label = prev_start_label;
+ iseq->compile_data->end_label = prev_end_label;
+ iseq->compile_data->redo_label = prev_redo_label;
+ iseq->compile_data->loopval_popped = prev_loopval_popped;
+ iseq->compile_data->ensure_node_stack = iseq->compile_data->ensure_node_stack->prev;
break;
}
- case NODE_FOR:
- if (node->nd_var) {
- /* massign to var in "for"
- * args.length == 1 && Array === (tmp = args[0]) ? tmp : args
- */
- NODE *var = node->nd_var;
- LABEL *not_single = NEW_LABEL(nd_line(var));
- LABEL *not_ary = NEW_LABEL(nd_line(var));
- COMPILE(ret, "for var", var);
- ADD_INSN(ret, line, dup);
- ADD_CALL(ret, line, idLength, INT2FIX(0));
- ADD_INSN1(ret, line, putobject, INT2FIX(1));
- ADD_CALL(ret, line, idEq, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, not_single);
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, INT2FIX(0));
- ADD_CALL(ret, line, idAREF, INT2FIX(1));
- ADD_INSN1(ret, line, putobject, rb_cArray);
- ADD_INSN1(ret, line, topn, INT2FIX(1));
- ADD_CALL(ret, line, idEqq, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, not_ary);
- ADD_INSN(ret, line, swap);
- ADD_LABEL(ret, not_ary);
- ADD_INSN(ret, line, pop);
- ADD_LABEL(ret, not_single);
- break;
- }
- case NODE_ITER:{
- const rb_iseq_t *prevblock = ISEQ_COMPILE_DATA(iseq)->current_block;
+ case NODE_ITER:
+ case NODE_FOR:{
+ VALUE prevblock = iseq->compile_data->current_block;
LABEL *retry_label = NEW_LABEL(line);
LABEL *retry_end_l = NEW_LABEL(line);
@@ -4052,13 +3500,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (nd_type(node) == NODE_FOR) {
COMPILE(ret, "iter caller (for)", node->nd_iter);
- ISEQ_COMPILE_DATA(iseq)->current_block = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq),
- ISEQ_TYPE_BLOCK, line);
- ADD_SEND_WITH_BLOCK(ret, line, idEach, INT2FIX(0), ISEQ_COMPILE_DATA(iseq)->current_block);
+ iseq->compile_data->current_block =
+ NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
+ ISEQ_TYPE_BLOCK, line);
+
+ ADD_SEND_R(ret, line, ID2SYM(idEach), INT2FIX(0),
+ iseq->compile_data->current_block, INT2FIX(0));
}
else {
- ISEQ_COMPILE_DATA(iseq)->current_block = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq),
- ISEQ_TYPE_BLOCK, line);
+ iseq->compile_data->current_block =
+ NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
+ ISEQ_TYPE_BLOCK, line);
COMPILE(ret, "iter caller", node->nd_iter);
}
ADD_LABEL(ret, retry_end_l);
@@ -4067,7 +3519,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN(ret, line, pop);
}
- ISEQ_COMPILE_DATA(iseq)->current_block = prevblock;
+ iseq->compile_data->current_block = prevblock;
ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, retry_label, retry_end_l, 0, retry_end_l);
@@ -4076,161 +3528,160 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_BREAK:{
unsigned long level = 0;
- if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0) {
+ if (iseq->compile_data->redo_label != 0) {
/* while/until */
LABEL *splabel = NEW_LABEL(0);
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->redo_label);
- COMPILE_(ret, "break val (while/until)", node->nd_stts, ISEQ_COMPILE_DATA(iseq)->loopval_popped);
+ ADD_ADJUST(ret, line, iseq->compile_data->redo_label);
+ COMPILE_(ret, "break val (while/until)", node->nd_stts, iseq->compile_data->loopval_popped);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->end_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->end_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
ADD_INSN(ret, line, putnil);
}
}
- else if (iseq->body->type == ISEQ_TYPE_BLOCK) {
+ else if (iseq->type == ISEQ_TYPE_BLOCK) {
break_by_insn:
/* escape from block */
COMPILE(ret, "break val (block)", node->nd_stts);
- ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_BREAK));
+ ADD_INSN1(ret, line, throw, INT2FIX(level | 0x02) /* TAG_BREAK */ );
if (poped) {
ADD_INSN(ret, line, pop);
}
}
- else if (iseq->body->type == ISEQ_TYPE_EVAL) {
+ else if (iseq->type == ISEQ_TYPE_EVAL) {
break_in_eval:
- COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with break");
- debug_node_end();
- return COMPILE_NG;
+ COMPILE_ERROR((ERROR_ARGS "Can't escape from eval with break"));
}
else {
- const rb_iseq_t *ip = iseq->body->parent_iseq;
-
+ rb_iseq_t *ip = iseq->parent_iseq;
while (ip) {
- if (!ISEQ_COMPILE_DATA(ip)) {
+ if (!ip->compile_data) {
ip = 0;
break;
}
level++;
- if (ISEQ_COMPILE_DATA(ip)->redo_label != 0) {
- level = VM_THROW_NO_ESCAPE_FLAG;
+ if (ip->compile_data->redo_label != 0) {
+ level = 0x8000;
+ if (ip->compile_data->loopval_popped == 0) {
+ /* need value */
+ level |= 0x4000;
+ }
goto break_by_insn;
}
- else if (ip->body->type == ISEQ_TYPE_BLOCK) {
- level <<= VM_THROW_LEVEL_SHIFT;
+ else if (ip->type == ISEQ_TYPE_BLOCK) {
+ level <<= 16;
goto break_by_insn;
}
- else if (ip->body->type == ISEQ_TYPE_EVAL) {
+ else if (ip->type == ISEQ_TYPE_EVAL) {
goto break_in_eval;
}
- ip = ip->body->parent_iseq;
+ ip = ip->parent_iseq;
}
- COMPILE_ERROR(ERROR_ARGS "Invalid break");
- debug_node_end();
- return COMPILE_NG;
+ COMPILE_ERROR((ERROR_ARGS "Invalid break"));
}
break;
}
case NODE_NEXT:{
unsigned long level = 0;
- if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0) {
+ if (iseq->compile_data->redo_label != 0) {
LABEL *splabel = NEW_LABEL(0);
debugs("next in while loop\n");
ADD_LABEL(ret, splabel);
COMPILE(ret, "next val/valid syntax?", node->nd_stts);
add_ensure_iseq(ret, iseq, 0);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->redo_label);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->redo_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
ADD_INSN(ret, line, putnil);
}
}
- else if (ISEQ_COMPILE_DATA(iseq)->end_label) {
+ else if (iseq->compile_data->end_label) {
LABEL *splabel = NEW_LABEL(0);
debugs("next in block\n");
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->start_label);
COMPILE(ret, "next val", node->nd_stts);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->end_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->end_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
ADD_INSN(ret, line, putnil);
}
}
- else if (iseq->body->type == ISEQ_TYPE_EVAL) {
+ else if (iseq->type == ISEQ_TYPE_EVAL) {
next_in_eval:
- COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with next");
+ COMPILE_ERROR((ERROR_ARGS "Can't escape from eval with next"));
}
else {
- const rb_iseq_t *ip = iseq;
-
+ rb_iseq_t *ip;
+ ip = iseq;
while (ip) {
- if (!ISEQ_COMPILE_DATA(ip)) {
+ if (!ip->compile_data) {
ip = 0;
break;
}
- level = VM_THROW_NO_ESCAPE_FLAG;
- if (ISEQ_COMPILE_DATA(ip)->redo_label != 0) {
+ level = 0x8000 | 0x4000;
+ if (ip->compile_data->redo_label != 0) {
/* while loop */
break;
}
- else if (ip->body->type == ISEQ_TYPE_BLOCK) {
+ else if (ip->type == ISEQ_TYPE_BLOCK) {
break;
}
- else if (ip->body->type == ISEQ_TYPE_EVAL) {
+ else if (ip->type == ISEQ_TYPE_EVAL) {
goto next_in_eval;
}
- ip = ip->body->parent_iseq;
+ ip = ip->parent_iseq;
}
if (ip != 0) {
COMPILE(ret, "next val", node->nd_stts);
- ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_NEXT));
+ ADD_INSN1(ret, line, throw, INT2FIX(level | 0x03) /* TAG_NEXT */ );
if (poped) {
ADD_INSN(ret, line, pop);
}
}
else {
- COMPILE_ERROR(ERROR_ARGS "Invalid next");
+ COMPILE_ERROR((ERROR_ARGS "Invalid next"));
}
}
break;
}
case NODE_REDO:{
- if (ISEQ_COMPILE_DATA(iseq)->redo_label) {
+ if (iseq->compile_data->redo_label) {
LABEL *splabel = NEW_LABEL(0);
debugs("redo in while");
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->redo_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->redo_label);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->redo_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->redo_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
ADD_INSN(ret, line, putnil);
}
}
- else if (iseq->body->type == ISEQ_TYPE_EVAL) {
+ else if (iseq->type == ISEQ_TYPE_EVAL) {
redo_in_eval:
- COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with redo");
+ COMPILE_ERROR((ERROR_ARGS "Can't escape from eval with redo"));
}
- else if (ISEQ_COMPILE_DATA(iseq)->start_label) {
+ else if (iseq->compile_data->start_label) {
LABEL *splabel = NEW_LABEL(0);
debugs("redo in block");
ADD_LABEL(ret, splabel);
add_ensure_iseq(ret, iseq, 0);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->start_label);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_ADJUST(ret, line, iseq->compile_data->start_label);
+ ADD_INSNL(ret, line, jump, iseq->compile_data->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!poped) {
@@ -4238,52 +3689,53 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
}
else {
- const rb_iseq_t *ip = iseq;
- const unsigned long level = VM_THROW_NO_ESCAPE_FLAG;
-
+ rb_iseq_t *ip;
+ unsigned long level;
+ level = 0x8000 | 0x4000;
+ ip = iseq;
while (ip) {
- if (!ISEQ_COMPILE_DATA(ip)) {
+ if (!ip->compile_data) {
ip = 0;
break;
}
- if (ISEQ_COMPILE_DATA(ip)->redo_label != 0) {
+ if (ip->compile_data->redo_label != 0) {
break;
}
- else if (ip->body->type == ISEQ_TYPE_BLOCK) {
+ else if (ip->type == ISEQ_TYPE_BLOCK) {
break;
}
- else if (ip->body->type == ISEQ_TYPE_EVAL) {
+ else if (ip->type == ISEQ_TYPE_EVAL) {
goto redo_in_eval;
}
- ip = ip->body->parent_iseq;
+ ip = ip->parent_iseq;
}
if (ip != 0) {
ADD_INSN(ret, line, putnil);
- ADD_INSN1(ret, line, throw, INT2FIX(level | TAG_REDO));
+ ADD_INSN1(ret, line, throw, INT2FIX(level | 0x05) /* TAG_REDO */ );
if (poped) {
ADD_INSN(ret, line, pop);
}
}
else {
- COMPILE_ERROR(ERROR_ARGS "Invalid redo");
+ COMPILE_ERROR((ERROR_ARGS "Invalid redo"));
}
}
break;
}
case NODE_RETRY:{
- if (iseq->body->type == ISEQ_TYPE_RESCUE) {
+ if (iseq->type == ISEQ_TYPE_RESCUE) {
ADD_INSN(ret, line, putnil);
- ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETRY));
+ ADD_INSN1(ret, line, throw, INT2FIX(0x04) /* TAG_RETRY */ );
if (poped) {
ADD_INSN(ret, line, pop);
}
}
else {
- COMPILE_ERROR(ERROR_ARGS "Invalid retry");
+ COMPILE_ERROR((ERROR_ARGS "Invalid retry"));
}
break;
}
@@ -4295,12 +3747,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *lstart = NEW_LABEL(line);
LABEL *lend = NEW_LABEL(line);
LABEL *lcont = NEW_LABEL(line);
- const rb_iseq_t *rescue = NEW_CHILD_ISEQ(node->nd_resq,
- rb_str_concat(rb_str_new2("rescue in "), iseq->body->location.label),
- ISEQ_TYPE_RESCUE, line);
+ VALUE rescue = NEW_CHILD_ISEQVAL(
+ node->nd_resq,
+ rb_str_concat(rb_str_new2("rescue in "), iseq->location.label),
+ ISEQ_TYPE_RESCUE, line);
- lstart->rescued = LABEL_RESCUE_BEG;
- lend->rescued = LABEL_RESCUE_END;
ADD_LABEL(ret, lstart);
COMPILE(ret, "rescue head", node->nd_head);
ADD_LABEL(ret, lend);
@@ -4350,7 +3801,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSNL(ret, line, branchif, label_hit);
break;
default:
- UNKNOWN_NODE("NODE_RESBODY", narg);
+ rb_bug("NODE_RESBODY: unknown node (%s)",
+ ruby_node_name(nd_type(narg)));
}
}
else {
@@ -4362,7 +3814,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSNL(ret, line, jump, label_miss);
ADD_LABEL(ret, label_hit);
COMPILE(ret, "resbody body", resq->nd_body);
- if (ISEQ_COMPILE_DATA(iseq)->option->tailcall_optimization) {
+ if (iseq->compile_data->option->tailcall_optimization) {
ADD_INSN(ret, line, nop);
}
ADD_INSN(ret, line, leave);
@@ -4373,9 +3825,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_ENSURE:{
DECL_ANCHOR(ensr);
- const rb_iseq_t *ensure = NEW_CHILD_ISEQ(node->nd_ensr,
- rb_str_concat(rb_str_new2 ("ensure in "), iseq->body->location.label),
- ISEQ_TYPE_ENSURE, line);
+ VALUE ensure = NEW_CHILD_ISEQVAL(node->nd_ensr,
+ rb_str_concat(rb_str_new2
+ ("ensure in "),
+ iseq->location.label),
+ ISEQ_TYPE_ENSURE, line);
LABEL *lstart = NEW_LABEL(line);
LABEL *lend = NEW_LABEL(line);
LABEL *lcont = NEW_LABEL(line);
@@ -4402,14 +3856,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
ADD_LABEL(ret, lcont);
- erange = ISEQ_COMPILE_DATA(iseq)->ensure_node_stack->erange;
+ erange = iseq->compile_data->ensure_node_stack->erange;
while (erange) {
ADD_CATCH_ENTRY(CATCH_TYPE_ENSURE, erange->begin, erange->end,
ensure, lcont);
erange = erange->next;
}
- ISEQ_COMPILE_DATA(iseq)->ensure_node_stack = enl.prev;
+ iseq->compile_data->ensure_node_stack = enl.prev;
break;
}
@@ -4441,9 +3895,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_LASGN:{
ID id = node->nd_vid;
- int idx = iseq->body->local_iseq->body->local_size - get_local_var_idx(iseq, id);
+ int idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id);
- debugs("lvar: %"PRIsVALUE" idx: %d\n", rb_id2str(id), idx);
+ debugs("lvar: %s idx: %d\n", rb_id2name(id), idx);
COMPILE(ret, "rvalue", node->nd_value);
if (!poped) {
@@ -4457,7 +3911,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_DASGN_CURR:{
int idx, lv, ls;
COMPILE(ret, "dvalue", node->nd_value);
- debugi("dassn id", rb_id2str(node->nd_vid) ? node->nd_vid : '*');
+ debugp_param("dassn id", rb_str_new2(rb_id2name(node->nd_vid) ? rb_id2name(node->nd_vid) : "*"));
if (!poped) {
ADD_INSN(ret, line, dup);
@@ -4466,7 +3920,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
idx = get_dyna_var_idx(iseq, node->nd_vid, &lv, &ls);
if (idx < 0) {
- rb_compile_bug_str(ERROR_ARGS "NODE_DASGN(_CURR): unknown id (%"PRIsVALUE")", rb_id2str(node->nd_vid));
+ rb_bug("NODE_DASGN(_CURR): unknown id (%s)", rb_id2name(node->nd_vid));
}
ADD_INSN2(ret, line, setlocal, INT2FIX(ls - idx), INT2FIX(lv));
@@ -4489,7 +3943,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN(ret, line, dup);
}
ADD_INSN2(ret, line, setinstancevariable,
- ID2SYM(node->nd_vid), INT2FIX(iseq->body->is_size++));
+ ID2SYM(node->nd_vid), INT2FIX(iseq->is_size++));
break;
}
case NODE_CDECL:{
@@ -4522,8 +3976,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_OP_ASGN1: {
DECL_ANCHOR(args);
VALUE argc;
- unsigned int flag = 0;
- unsigned int asgnflag = 0;
+ VALUE flag = 0;
ID id = node->nd_mid;
int boff = 0;
@@ -4553,7 +4006,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (!poped) {
ADD_INSN(ret, line, putnil);
}
- asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN1 recv", node);
+ COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv);
switch (nd_type(node->nd_args->nd_head)) {
case NODE_ZARRAY:
argc = INT2FIX(0);
@@ -4562,12 +4015,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
boff = 1;
default:
INIT_ANCHOR(args);
- argc = setup_args(iseq, args, node->nd_args->nd_head, &flag, NULL);
+ argc = setup_args(iseq, args, node->nd_args->nd_head, &flag);
ADD_SEQ(ret, args);
}
ADD_INSN1(ret, line, dupn, FIXNUM_INC(argc, 1 + boff));
- ADD_SEND_WITH_FLAG(ret, line, idAREF, argc, INT2FIX(flag));
- flag |= asgnflag;
+ ADD_SEND_R(ret, line, ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag));
if (id == 0 || id == 1) {
/* 0: or, 1: and
@@ -4610,12 +4062,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN(ret, line, pop);
ADD_INSN(ret, line, pop);
}
- ADD_SEND_WITH_FLAG(ret, line, idASET, argc, INT2FIX(flag));
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
+ argc, Qfalse, LONG2FIX(flag));
}
else {
if (boff > 0)
ADD_INSN(ret, line, swap);
- ADD_SEND_WITH_FLAG(ret, line, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
+ FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag));
}
ADD_INSN(ret, line, pop);
ADD_INSNL(ret, line, jump, lfin);
@@ -4628,7 +4082,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
else {
COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body);
- ADD_SEND(ret, line, id, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(id), INT2FIX(1));
if (!poped) {
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
}
@@ -4645,12 +4099,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN(ret, line, pop);
ADD_INSN(ret, line, pop);
}
- ADD_SEND_WITH_FLAG(ret, line, idASET, argc, INT2FIX(flag));
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
+ argc, Qfalse, LONG2FIX(flag));
}
else {
if (boff > 0)
ADD_INSN(ret, line, swap);
- ADD_SEND_WITH_FLAG(ret, line, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
+ ADD_SEND_R(ret, line, ID2SYM(idASET),
+ FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag));
}
ADD_INSN(ret, line, pop);
}
@@ -4659,11 +4115,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_OP_ASGN2:{
ID atype = node->nd_next->nd_mid;
- ID vid = node->nd_next->nd_vid, aid = rb_id_attrset(vid);
- VALUE asgnflag;
LABEL *lfin = NEW_LABEL(line);
LABEL *lcfin = NEW_LABEL(line);
- LABEL *lskip = 0;
/*
class C; attr_accessor :c; end
r = C.new
@@ -4706,14 +4159,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
*/
- asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN2#recv", node);
- if (node->nd_next->nd_aid) {
- lskip = NEW_LABEL(line);
- ADD_INSN(ret, line, dup);
- ADD_INSNL(ret, line, branchnil, lskip);
- }
+ COMPILE(ret, "NODE_OP_ASGN2#recv", node->nd_recv);
ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, vid, INT2FIX(0));
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_vid),
+ INT2FIX(0));
if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */
ADD_INSN(ret, line, dup);
@@ -4727,7 +4176,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value);
ADD_INSN(ret, line, swap);
ADD_INSN1(ret, line, topn, INT2FIX(1));
- ADD_SEND_WITH_FLAG(ret, line, aid, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_aid),
+ INT2FIX(1));
ADD_INSNL(ret, line, jump, lfin);
ADD_LABEL(ret, lcfin);
@@ -4735,9 +4185,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_LABEL(ret, lfin);
ADD_INSN(ret, line, pop);
- if (lskip) {
- ADD_LABEL(ret, lskip);
- }
if (poped) {
/* we can apply more optimize */
ADD_INSN(ret, line, pop);
@@ -4745,16 +4192,15 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
else {
COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value);
- ADD_SEND(ret, line, atype, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_mid),
+ INT2FIX(1));
if (!poped) {
ADD_INSN(ret, line, swap);
ADD_INSN1(ret, line, topn, INT2FIX(1));
}
- ADD_SEND_WITH_FLAG(ret, line, aid, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_aid),
+ INT2FIX(1));
ADD_INSN(ret, line, pop);
- if (lskip) {
- ADD_LABEL(ret, lskip);
- }
}
break;
}
@@ -4771,9 +4217,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "NODE_OP_CDECL/colon2#nd_head", node->nd_head->nd_head);
break;
default:
- COMPILE_ERROR(ERROR_ARGS "%s: invalid node in NODE_OP_CDECL",
- ruby_node_name(nd_type(node->nd_head)));
- debug_node_end();
+ do {
+ COMPILE_ERROR((ERROR_ARGS "%s: invalid node in NODE_OP_CDECL",
+ ruby_node_name(nd_type(node->nd_head))));
+ } while (0);
return COMPILE_NG;
}
mid = node->nd_head->nd_mid;
@@ -4814,7 +4261,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else {
COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value);
/* cref obj value */
- ADD_CALL(ret, line, node->nd_aid, INT2FIX(1));
+ ADD_CALL(ret, line, ID2SYM(node->nd_aid), INT2FIX(1));
/* cref value */
ADD_INSN(ret, line, swap); /* value cref */
if (!poped) {
@@ -4867,13 +4314,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_CALL:
- /* optimization shortcut
- * "literal".freeze -> opt_str_freeze("literal")
- */
if (node->nd_recv && nd_type(node->nd_recv) == NODE_STR &&
- node->nd_mid == idFreeze && node->nd_args == NULL &&
- ISEQ_COMPILE_DATA(iseq)->current_block == NULL &&
- ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
+ node->nd_mid == idFreeze && node->nd_args == NULL)
+ {
VALUE str = rb_fstring(node->nd_recv->nd_lit);
iseq_add_mark_object(iseq, str);
ADD_INSN1(ret, line, opt_str_freeze, str);
@@ -4882,26 +4325,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
break;
}
- /* optimization shortcut
- * obj["literal"] -> opt_aref_with(obj, "literal")
- */
- if (node->nd_mid == idAREF && !private_recv_p(node) && node->nd_args &&
- nd_type(node->nd_args) == NODE_ARRAY && node->nd_args->nd_alen == 1 &&
- nd_type(node->nd_args->nd_head) == NODE_STR &&
- ISEQ_COMPILE_DATA(iseq)->current_block == NULL &&
- ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
- VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit);
- node->nd_args->nd_head->nd_lit = str;
- COMPILE(ret, "recv", node->nd_recv);
- ADD_INSN3(ret, line, opt_aref_with,
- new_callinfo(iseq, idAREF, 1, 0, NULL, FALSE),
- NULL/* CALL_CACHE */, str);
- if (poped) {
- ADD_INSN(ret, line, pop);
- }
- break;
- }
- case NODE_QCALL:
case NODE_FCALL:
case NODE_VCALL:{ /* VCALL: variable or call */
/*
@@ -4911,13 +4334,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
*/
DECL_ANCHOR(recv);
DECL_ANCHOR(args);
- LABEL *lskip = 0;
ID mid = node->nd_mid;
VALUE argc;
- unsigned int flag = 0;
- struct rb_call_info_kw_arg *keywords = NULL;
- const rb_iseq_t *parent_block = ISEQ_COMPILE_DATA(iseq)->current_block;
- ISEQ_COMPILE_DATA(iseq)->current_block = NULL;
+ VALUE flag = 0;
+ VALUE parent_block = iseq->compile_data->current_block;
+ iseq->compile_data->current_block = Qfalse;
INIT_ANCHOR(recv);
INIT_ANCHOR(args);
@@ -4950,12 +4371,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
(mid == goto_id || mid == label_id)) {
LABEL *label;
st_data_t data;
- st_table *labels_table = ISEQ_COMPILE_DATA(iseq)->labels_table;
+ st_table *labels_table = iseq->compile_data->labels_table;
ID label_name;
if (!labels_table) {
labels_table = st_init_numtable();
- ISEQ_COMPILE_DATA(iseq)->labels_table = labels_table;
+ iseq->compile_data->labels_table = labels_table;
}
if (nd_type(node->nd_args->nd_head) == NODE_LIT &&
SYMBOL_P(node->nd_args->nd_head->nd_lit)) {
@@ -4971,7 +4392,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
}
else {
- COMPILE_ERROR(ERROR_ARGS "invalid goto/label format");
+ COMPILE_ERROR((ERROR_ARGS "invalid goto/label format"));
}
@@ -4986,13 +4407,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
#endif
/* receiver */
- if (type == NODE_CALL || type == NODE_QCALL) {
+ if (type == NODE_CALL) {
COMPILE(recv, "recv", node->nd_recv);
- if (type == NODE_QCALL) {
- lskip = NEW_LABEL(line);
- ADD_INSN(recv, line, dup);
- ADD_INSNL(recv, line, branchnil, lskip);
- }
}
else if (type == NODE_FCALL || type == NODE_VCALL) {
ADD_CALL_RECEIVER(recv, line);
@@ -5000,7 +4416,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
/* args */
if (nd_type(node) != NODE_VCALL) {
- argc = setup_args(iseq, args, node->nd_args, &flag, &keywords);
+ argc = setup_args(iseq, args, node->nd_args, &flag);
}
else {
argc = INT2FIX(0);
@@ -5020,11 +4436,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
flag |= VM_CALL_FCALL;
}
- ADD_SEND_R(ret, line, mid, argc, parent_block, INT2FIX(flag), keywords);
+ ADD_SEND_R(ret, line, ID2SYM(mid),
+ argc, parent_block, LONG2FIX(flag));
- if (lskip) {
- ADD_LABEL(ret, lskip);
- }
if (poped) {
ADD_INSN(ret, line, pop);
}
@@ -5034,107 +4448,93 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_ZSUPER:{
DECL_ANCHOR(args);
int argc;
- unsigned int flag = 0;
- struct rb_call_info_kw_arg *keywords = NULL;
- const rb_iseq_t *parent_block = ISEQ_COMPILE_DATA(iseq)->current_block;
+ VALUE flag = 0;
+ VALUE parent_block = iseq->compile_data->current_block;
INIT_ANCHOR(args);
- ISEQ_COMPILE_DATA(iseq)->current_block = NULL;
+ iseq->compile_data->current_block = Qfalse;
if (nd_type(node) == NODE_SUPER) {
- VALUE vargc = setup_args(iseq, args, node->nd_args, &flag, &keywords);
+ VALUE vargc = setup_args(iseq, args, node->nd_args, &flag);
argc = FIX2INT(vargc);
}
else {
/* NODE_ZSUPER */
int i;
- const rb_iseq_t *liseq = iseq->body->local_iseq;
+ rb_iseq_t *liseq = iseq->local_iseq;
int lvar_level = get_lvar_level(iseq);
- argc = liseq->body->param.lead_num;
+ argc = liseq->argc;
/* normal arguments */
- for (i = 0; i < liseq->body->param.lead_num; i++) {
- int idx = liseq->body->local_size - i;
- ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
- }
-
- if (liseq->body->param.flags.has_opt) {
- /* optional arguments */
- int j;
- for (j = 0; j < liseq->body->param.opt_num; j++) {
- int idx = liseq->body->local_size - (i + j);
- ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
- }
- i += j;
- argc = i;
- }
- if (liseq->body->param.flags.has_rest) {
- /* rest argument */
- int idx = liseq->body->local_size - liseq->body->param.rest_start;
+ for (i = 0; i < liseq->argc; i++) {
+ int idx = liseq->local_size - i;
ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
- argc = liseq->body->param.rest_start + 1;
- flag |= VM_CALL_ARGS_SPLAT;
}
- if (liseq->body->param.flags.has_post) {
- /* post arguments */
- int post_len = liseq->body->param.post_num;
- int post_start = liseq->body->param.post_start;
- if (liseq->body->param.flags.has_rest) {
+ if (!liseq->arg_simple) {
+ if (liseq->arg_opts) {
+ /* optional arguments */
int j;
- for (j=0; j<post_len; j++) {
- int idx = liseq->body->local_size - (post_start + j);
+ for (j = 0; j < liseq->arg_opts - 1; j++) {
+ int idx = liseq->local_size - (i + j);
ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
}
- ADD_INSN1(args, line, newarray, INT2FIX(j));
- ADD_INSN (args, line, concatarray);
- /* argc is settled at above */
+ i += j;
+ argc = i;
}
- else {
- int j;
- for (j=0; j<post_len; j++) {
- int idx = liseq->body->local_size - (post_start + j);
- ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
- }
- argc = post_len + post_start;
- }
- }
-
- if (liseq->body->param.flags.has_kw) { /* TODO: support keywords */
- int local_size = liseq->body->local_size;
- argc++;
- ADD_INSN1(args, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
-
- if (liseq->body->param.flags.has_kwrest) {
- ADD_INSN2(args, line, getlocal, INT2FIX(liseq->body->local_size - liseq->body->param.keyword->rest_start), INT2FIX(lvar_level));
- ADD_SEND (args, line, rb_intern("dup"), INT2FIX(0));
- }
- else {
- ADD_INSN1(args, line, newhash, INT2FIX(0));
- }
- for (i = 0; i < liseq->body->param.keyword->num; ++i) {
- ID id = liseq->body->param.keyword->table[i];
- int idx = local_size - get_local_var_idx(liseq, id);
- ADD_INSN1(args, line, putobject, ID2SYM(id));
+ if (liseq->arg_rest != -1) {
+ /* rest argument */
+ int idx = liseq->local_size - liseq->arg_rest;
ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ argc = liseq->arg_rest + 1;
+ flag |= VM_CALL_ARGS_SPLAT;
}
- ADD_SEND(args, line, id_core_hash_merge_ptr, INT2FIX(i * 2 + 1));
- if (liseq->body->param.flags.has_rest) {
- ADD_INSN1(args, line, newarray, INT2FIX(1));
- ADD_INSN (args, line, concatarray);
- --argc;
- }
- }
- else if (liseq->body->param.flags.has_kwrest) {
- ADD_INSN2(args, line, getlocal, INT2FIX(liseq->body->local_size - liseq->body->param.keyword->rest_start), INT2FIX(lvar_level));
- ADD_SEND (args, line, rb_intern("dup"), INT2FIX(0));
- if (liseq->body->param.flags.has_rest) {
- ADD_INSN1(args, line, newarray, INT2FIX(1));
- ADD_INSN (args, line, concatarray);
+
+ if (liseq->arg_post_len) {
+ /* post arguments */
+ int post_len = liseq->arg_post_len;
+ int post_start = liseq->arg_post_start;
+
+ if (liseq->arg_rest != -1) {
+ int j;
+ for (j=0; j<post_len; j++) {
+ int idx = liseq->local_size - (post_start + j);
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ }
+ ADD_INSN1(args, line, newarray, INT2FIX(j));
+ ADD_INSN (args, line, concatarray);
+ /* argc is settled at above */
+ }
+ else {
+ int j;
+ for (j=0; j<post_len; j++) {
+ int idx = liseq->local_size - (post_start + j);
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ }
+ argc = post_len + post_start;
+ }
}
- else {
+
+ if (liseq->arg_keyword >= 0) {
+ int local_size = liseq->local_size;
+ int idx = local_size - liseq->arg_keyword;
argc++;
+ ADD_INSN1(args, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ ADD_SEND (args, line, ID2SYM(rb_intern("dup")), INT2FIX(0));
+ for (i = 0; i < liseq->arg_keywords; ++i) {
+ ID id = liseq->arg_keyword_table[i];
+ idx = local_size - get_local_var_idx(liseq, id);
+ ADD_INSN1(args, line, putobject, ID2SYM(id));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ }
+ ADD_SEND(args, line, ID2SYM(id_core_hash_merge_ptr), INT2FIX(i * 2 + 1));
+ if (liseq->arg_rest != -1) {
+ ADD_INSN1(args, line, newarray, INT2FIX(1));
+ ADD_INSN (args, line, concatarray);
+ --argc;
+ }
}
}
}
@@ -5142,10 +4542,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
/* dummy receiver */
ADD_INSN1(ret, line, putobject, nd_type(node) == NODE_ZSUPER ? Qfalse : Qtrue);
ADD_SEQ(ret, args);
- ADD_INSN3(ret, line, invokesuper,
- new_callinfo(iseq, 0, argc, flag | VM_CALL_SUPER | VM_CALL_FCALL, keywords, parent_block != NULL),
- Qnil, /* CALL_CACHE */
- parent_block);
+ ADD_INSN1(ret, line, invokesuper, new_callinfo(iseq, 0, argc, parent_block,
+ flag | VM_CALL_SUPER | VM_CALL_FCALL));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5153,7 +4551,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_ARRAY:{
- compile_array_(iseq, ret, node, COMPILE_ARRAY_TYPE_ARRAY, NULL, poped);
+ compile_array_(iseq, ret, node, COMPILE_ARRAY_TYPE_ARRAY, poped);
break;
}
case NODE_ZARRAY:{
@@ -5190,8 +4588,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
default:
- rb_compile_bug_str(ERROR_ARGS_AT(node->nd_head) "can't make hash with this node: %s",
- ruby_node_name(type));
+ rb_bug("can't make hash with this node: %s", ruby_node_name(type));
}
if (poped) {
@@ -5203,13 +4600,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
rb_iseq_t *is = iseq;
if (is) {
- if (is->body->type == ISEQ_TYPE_TOP) {
- COMPILE_ERROR(ERROR_ARGS "Invalid return");
+ if (is->type == ISEQ_TYPE_TOP) {
+ COMPILE_ERROR((ERROR_ARGS "Invalid return"));
}
else {
LABEL *splabel = 0;
- if (is->body->type == ISEQ_TYPE_METHOD) {
+ if (is->type == ISEQ_TYPE_METHOD) {
splabel = NEW_LABEL(0);
ADD_LABEL(ret, splabel);
ADD_ADJUST(ret, line, 0);
@@ -5217,7 +4614,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "return nd_stts (return val)", node->nd_stts);
- if (is->body->type == ISEQ_TYPE_METHOD) {
+ if (is->type == ISEQ_TYPE_METHOD) {
add_ensure_iseq(ret, iseq, 1);
ADD_TRACE(ret, line, RUBY_EVENT_RETURN);
ADD_INSN(ret, line, leave);
@@ -5228,7 +4625,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
}
else {
- ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETURN));
+ ADD_INSN1(ret, line, throw, INT2FIX(0x01) /* TAG_RETURN */ );
if (poped) {
ADD_INSN(ret, line, pop);
}
@@ -5240,25 +4637,22 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_YIELD:{
DECL_ANCHOR(args);
VALUE argc;
- unsigned int flag = 0;
- struct rb_call_info_kw_arg *keywords = NULL;
+ VALUE flag = 0;
INIT_ANCHOR(args);
- if (iseq->body->type == ISEQ_TYPE_TOP) {
- COMPILE_ERROR(ERROR_ARGS "Invalid yield");
- debug_node_end();
- return COMPILE_NG;
+ if (iseq->type == ISEQ_TYPE_TOP) {
+ COMPILE_ERROR((ERROR_ARGS "Invalid yield"));
}
if (node->nd_head) {
- argc = setup_args(iseq, args, node->nd_head, &flag, &keywords);
+ argc = setup_args(iseq, args, node->nd_head, &flag);
}
else {
argc = INT2FIX(0);
}
ADD_SEQ(ret, args);
- ADD_INSN1(ret, line, invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), flag, keywords, FALSE));
+ ADD_INSN1(ret, line, invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), 0, flag));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5268,9 +4662,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_LVAR:{
if (!poped) {
ID id = node->nd_vid;
- int idx = iseq->body->local_iseq->body->local_size - get_local_var_idx(iseq, id);
+ int idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id);
- debugs("id: %"PRIsVALUE" idx: %d\n", rb_id2str(id), idx);
+ debugs("id: %s idx: %d\n", rb_id2name(id), idx);
ADD_INSN2(ret, line, getlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq)));
}
break;
@@ -5281,7 +4675,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (!poped) {
idx = get_dyna_var_idx(iseq, node->nd_vid, &lv, &ls);
if (idx < 0) {
- rb_compile_bug_str(ERROR_ARGS "unknown dvar (%"PRIsVALUE")", rb_id2str(node->nd_vid));
+ rb_bug("unknown dvar (%s)", rb_id2name(node->nd_vid));
}
ADD_INSN2(ret, line, getlocal, INT2FIX(ls - idx), INT2FIX(lv));
}
@@ -5299,16 +4693,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
debugi("nd_vid", node->nd_vid);
if (!poped) {
ADD_INSN2(ret, line, getinstancevariable,
- ID2SYM(node->nd_vid), INT2FIX(iseq->body->is_size++));
+ ID2SYM(node->nd_vid), INT2FIX(iseq->is_size++));
}
break;
}
case NODE_CONST:{
debugi("nd_vid", node->nd_vid);
- if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
+ if (iseq->compile_data->option->inline_const_cache) {
LABEL *lend = NEW_LABEL(line);
- int ic_index = iseq->body->is_size++;
+ int ic_index = iseq->is_size++;
ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index));
ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid));
@@ -5334,10 +4728,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_NTH_REF:{
if (!poped) {
- if (!node->nd_nth) {
- ADD_INSN(ret, line, putnil);
- break;
- }
ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(node->nd_nth << 1));
}
@@ -5374,7 +4764,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
- if (ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
+ if (iseq->compile_data->option->specialized_instruction) {
/* TODO: detect by node */
if (recv->last == recv->anchor.next &&
INSN_OF(recv->last) == BIN(putobject) &&
@@ -5386,13 +4776,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else {
ADD_SEQ(ret, recv);
ADD_SEQ(ret, val);
- ADD_INSN2(ret, line, opt_regexpmatch2, new_callinfo(iseq, idEqTilde, 1, 0, NULL, FALSE), Qnil);
+ ADD_INSN1(ret, line, opt_regexpmatch2, new_callinfo(iseq, idEqTilde, 1, 0, 0));
}
}
else {
ADD_SEQ(ret, recv);
ADD_SEQ(ret, val);
- ADD_SEND(ret, line, idEqTilde, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(idEqTilde), INT2FIX(1));
}
if (poped) {
@@ -5410,22 +4800,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_STR:{
debugp_param("nd_lit", node->nd_lit);
if (!poped) {
- node->nd_lit = rb_fstring(node->nd_lit);
- if (!ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal) {
- ADD_INSN1(ret, line, putstring, node->nd_lit);
- }
- else {
- if (ISEQ_COMPILE_DATA(iseq)->option->debug_frozen_string_literal || RTEST(ruby_debug)) {
- VALUE debug_info = rb_ary_new_from_args(2, iseq->body->location.path, INT2FIX(line));
- VALUE str = rb_str_dup(node->nd_lit);
- rb_ivar_set(str, id_debug_created_info, rb_obj_freeze(debug_info));
- ADD_INSN1(ret, line, putobject, rb_obj_freeze(str));
- iseq_add_mark_object_compile_time(iseq, str);
- }
- else {
- ADD_INSN1(ret, line, putobject, node->nd_lit);
- }
- }
+ OBJ_FREEZE(node->nd_lit);
+ ADD_INSN1(ret, line, putstring, node->nd_lit);
}
break;
}
@@ -5435,23 +4811,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (poped) {
ADD_INSN(ret, line, pop);
}
- else {
- if (ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal) {
- VALUE debug_info = Qnil;
- if (ISEQ_COMPILE_DATA(iseq)->option->debug_frozen_string_literal || RTEST(ruby_debug)) {
- debug_info = rb_ary_new_from_args(2, iseq->body->location.path, INT2FIX(line));
- iseq_add_mark_object_compile_time(iseq, rb_obj_freeze(debug_info));
- }
- ADD_INSN1(ret, line, freezestring, debug_info);
- }
- }
break;
}
case NODE_XSTR:{
- node->nd_lit = rb_fstring(node->nd_lit);
+ OBJ_FREEZE(node->nd_lit);
ADD_CALL_RECEIVER(ret, line);
ADD_INSN1(ret, line, putobject, node->nd_lit);
- ADD_CALL(ret, line, idBackquote, INT2FIX(1));
+ ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5461,7 +4827,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_DXSTR:{
ADD_CALL_RECEIVER(ret, line);
compile_dstr(iseq, ret, node);
- ADD_CALL(ret, line, idBackquote, INT2FIX(1));
+ ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5488,11 +4854,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_DREGX_ONCE:{
- int ic_index = iseq->body->is_size++;
+ int ic_index = iseq->is_size++;
NODE *dregx_node = NEW_NODE(NODE_DREGX, node->u1.value, node->u2.value, node->u3.value);
NODE *block_node = NEW_NODE(NODE_SCOPE, 0, dregx_node, 0);
- const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(block_node, make_name_for_block(iseq),
- ISEQ_TYPE_ONCE_GUARD, line);
+ VALUE block_iseq = NEW_CHILD_ISEQVAL(block_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));
@@ -5542,35 +4907,37 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_DEFN:{
- const rb_iseq_t *method_iseq = NEW_ISEQ(node->nd_defn,
- rb_id2str(node->nd_mid),
- ISEQ_TYPE_METHOD, line);
+ VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
+ rb_str_dup(rb_id2str(node->nd_mid)),
+ ISEQ_TYPE_METHOD, line);
- debugp_param("defn/iseq", rb_iseqw_new(method_iseq));
+ debugp_param("defn/iseq", iseqval);
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid));
- ADD_INSN1(ret, line, putiseq, method_iseq);
- ADD_SEND (ret, line, id_core_define_method, INT2FIX(2));
+ ADD_INSN1(ret, line, putiseq, iseqval);
+ ADD_SEND (ret, line, ID2SYM(id_core_define_method), INT2FIX(3));
if (poped) {
ADD_INSN(ret, line, pop);
}
+ debugp_param("defn", iseqval);
break;
}
case NODE_DEFS:{
- const rb_iseq_t * singleton_method = NEW_ISEQ(node->nd_defn,
- rb_id2str(node->nd_mid),
- ISEQ_TYPE_METHOD, line);
+ VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
+ rb_str_dup(rb_id2str(node->nd_mid)),
+ ISEQ_TYPE_METHOD, line);
- debugp_param("defs/iseq", rb_iseqw_new(singleton_method));
+ debugp_param("defs/iseq", iseqval);
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
COMPILE(ret, "defs: recv", node->nd_recv);
ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid));
- ADD_INSN1(ret, line, putiseq, singleton_method);
- ADD_SEND (ret, line, id_core_define_singleton_method, INT2FIX(3));
+ ADD_INSN1(ret, line, putiseq, iseqval);
+ ADD_SEND (ret, line, ID2SYM(id_core_define_singleton_method), INT2FIX(3));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5582,7 +4949,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
COMPILE(ret, "alias arg1", node->u1.node);
COMPILE(ret, "alias arg2", node->u2.node);
- ADD_SEND(ret, line, id_core_set_method_alias, INT2FIX(3));
+ ADD_SEND(ret, line, ID2SYM(id_core_set_method_alias), INT2FIX(3));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5593,7 +4960,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN1(ret, line, putobject, ID2SYM(node->u1.id));
ADD_INSN1(ret, line, putobject, ID2SYM(node->u2.id));
- ADD_SEND(ret, line, id_core_set_variable_alias, INT2FIX(2));
+ ADD_SEND(ret, line, ID2SYM(id_core_set_variable_alias), INT2FIX(2));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5604,7 +4971,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
COMPILE(ret, "undef arg", node->u2.node);
- ADD_SEND(ret, line, id_core_undef_method, INT2FIX(2));
+ ADD_SEND(ret, line, ID2SYM(id_core_undef_method), INT2FIX(2));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5612,16 +4979,18 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_CLASS:{
- const rb_iseq_t *class_iseq = NEW_CHILD_ISEQ(node->nd_body,
- rb_sprintf("<class:%"PRIsVALUE">", rb_id2str(node->nd_cpath->nd_mid)),
- ISEQ_TYPE_CLASS, line);
+ VALUE iseqval =
+ NEW_CHILD_ISEQVAL(
+ node->nd_body,
+ rb_sprintf("<class:%s>", rb_id2name(node->nd_cpath->nd_mid)),
+ ISEQ_TYPE_CLASS, line);
VALUE noscope = compile_cpath(ret, iseq, node->nd_cpath);
int flags = VM_DEFINECLASS_TYPE_CLASS;
-
if (!noscope) flags |= VM_DEFINECLASS_FLAG_SCOPED;
if (node->nd_super) flags |= VM_DEFINECLASS_FLAG_HAS_SUPERCLASS;
COMPILE(ret, "super", node->nd_super);
- ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), class_iseq, INT2FIX(flags));
+ ADD_INSN3(ret, line, defineclass,
+ ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(flags));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5629,16 +4998,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_MODULE:{
- const rb_iseq_t *module_iseq = NEW_CHILD_ISEQ(node->nd_body,
- rb_sprintf("<module:%"PRIsVALUE">", rb_id2str(node->nd_cpath->nd_mid)),
- ISEQ_TYPE_CLASS, line);
+ VALUE iseqval = NEW_CHILD_ISEQVAL(
+ node->nd_body,
+ rb_sprintf("<module:%s>", rb_id2name(node->nd_cpath->nd_mid)),
+ ISEQ_TYPE_CLASS, line);
+
VALUE noscope = compile_cpath(ret, iseq, node->nd_cpath);
int flags = VM_DEFINECLASS_TYPE_MODULE;
-
if (!noscope) flags |= VM_DEFINECLASS_FLAG_SCOPED;
ADD_INSN (ret, line, putnil); /* dummy */
- ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), module_iseq, INT2FIX(flags));
-
+ ADD_INSN3(ret, line, defineclass,
+ ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(flags));
if (poped) {
ADD_INSN(ret, line, pop);
}
@@ -5646,14 +5016,15 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_SCLASS:{
ID singletonclass;
- const rb_iseq_t *singleton_class = NEW_ISEQ(node->nd_body, rb_str_new2("singleton class"),
- ISEQ_TYPE_CLASS, line);
+ VALUE iseqval =
+ NEW_ISEQVAL(node->nd_body, rb_str_new2("singleton class"),
+ ISEQ_TYPE_CLASS, line);
COMPILE(ret, "sclass#recv", node->nd_recv);
ADD_INSN (ret, line, putnil);
CONST_ID(singletonclass, "singletonclass");
ADD_INSN3(ret, line, defineclass,
- ID2SYM(singletonclass), singleton_class,
+ ID2SYM(singletonclass), iseqval,
INT2FIX(VM_DEFINECLASS_TYPE_SINGLETON_CLASS));
if (poped) {
@@ -5665,7 +5036,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (rb_is_const_id(node->nd_mid)) {
/* constant */
LABEL *lend = NEW_LABEL(line);
- int ic_index = iseq->body->is_size++;
+ int ic_index = iseq->is_size++;
DECL_ANCHOR(pref);
DECL_ANCHOR(body);
@@ -5674,7 +5045,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INIT_ANCHOR(body);
compile_colon2(iseq, node, pref, body);
if (LIST_SIZE_ZERO(pref)) {
- if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
+ if (iseq->compile_data->option->inline_const_cache) {
ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index));
}
else {
@@ -5683,7 +5054,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_SEQ(ret, body);
- if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
+ if (iseq->compile_data->option->inline_const_cache) {
ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
@@ -5697,7 +5068,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
/* function call */
ADD_CALL_RECEIVER(ret, line);
COMPILE(ret, "colon2#nd_head", node->nd_head);
- ADD_CALL(ret, line, node->nd_mid, INT2FIX(1));
+ ADD_CALL(ret, line, ID2SYM(node->nd_mid),
+ INT2FIX(1));
}
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5706,12 +5078,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_COLON3:{
LABEL *lend = NEW_LABEL(line);
- int ic_index = iseq->body->is_size++;
+ int ic_index = iseq->is_size++;
debugi("colon3#nd_mid", node->nd_mid);
/* add cache insn */
- if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
+ if (iseq->compile_data->option->inline_const_cache) {
ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index));
ADD_INSN(ret, line, pop);
}
@@ -5719,7 +5091,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, putobject, rb_cObject);
ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_mid));
- if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
+ if (iseq->compile_data->option->inline_const_cache) {
ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
@@ -5748,11 +5120,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *lend = NEW_LABEL(line);
LABEL *lfin = NEW_LABEL(line);
LABEL *ltrue = NEW_LABEL(line);
- rb_iseq_t *local_iseq = iseq->body->local_iseq;
+ rb_iseq_t *local_iseq = iseq->local_iseq;
rb_num_t cnt;
VALUE key;
- cnt = ISEQ_FLIP_CNT_INCREMENT(local_iseq) + VM_SVAR_FLIPFLOP_START;
+ cnt = local_iseq->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
key = INT2FIX(cnt);
ADD_INSN2(ret, line, getspecial, key, INT2FIX(0));
@@ -5810,17 +5182,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_ERRINFO:{
if (!poped) {
- if (iseq->body->type == ISEQ_TYPE_RESCUE) {
+ if (iseq->type == ISEQ_TYPE_RESCUE) {
ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0));
}
else {
- const rb_iseq_t *ip = iseq;
+ rb_iseq_t *ip = iseq;
int level = 0;
while (ip) {
- if (ip->body->type == ISEQ_TYPE_RESCUE) {
+ if (ip->type == ISEQ_TYPE_RESCUE) {
break;
}
- ip = ip->body->parent_iseq;
+ ip = ip->parent_iseq;
level++;
}
if (ip) {
@@ -5858,9 +5230,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
/* compiled to:
* ONCE{ rb_mRubyVMFrozenCore::core#set_postexe{ ... } }
*/
- int is_index = iseq->body->is_size++;
- const rb_iseq_t *once_iseq = NEW_CHILD_ISEQ((NODE *)IFUNC_NEW(build_postexe_iseq, node->nd_body, 0),
- make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
+ int is_index = iseq->is_size++;
+ VALUE once_iseq = NEW_CHILD_ISEQVAL(
+ NEW_IFUNC(build_postexe_iseq, node->nd_body),
+ make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
ADD_INSN2(ret, line, once, once_iseq, INT2FIX(is_index));
@@ -5869,41 +5242,47 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
break;
}
- case NODE_KW_ARG:
- {
- LABEL *end_label = NEW_LABEL(nd_line(node));
- NODE *default_value = node->nd_body->nd_value;
-
- if (default_value == (NODE *)-1) {
- /* required argument. do nothing */
- rb_compile_bug_str(ERROR_ARGS "unreachable");
- }
- else if (nd_type(default_value) == NODE_LIT ||
- nd_type(default_value) == NODE_NIL ||
- nd_type(default_value) == NODE_TRUE ||
- nd_type(default_value) == NODE_FALSE) {
- rb_compile_bug_str(ERROR_ARGS "unreachable");
- }
- else {
- /* if keywordcheck(_kw_bits, nth_keyword)
- * kw = default_value
- * end
- */
- int kw_bits_idx = iseq->body->local_size - iseq->body->param.keyword->bits_start;
- int keyword_idx = iseq->body->param.keyword->num;
-
- ADD_INSN2(ret, line, checkkeyword, INT2FIX(kw_bits_idx), INT2FIX(keyword_idx));
- ADD_INSNL(ret, line, branchif, end_label);
- COMPILE_POPED(ret, "keyword default argument", node->nd_body);
- ADD_LABEL(ret, end_label);
- }
+ case NODE_KW_ARG:{
+ LABEL *default_label = NEW_LABEL(line);
+ LABEL *end_label = 0;
+ int idx, lv, ls;
+ ID id = node->nd_body->nd_vid;
+ ADD_INSN(ret, line, dup);
+ ADD_INSN1(ret, line, putobject, ID2SYM(id));
+ ADD_SEND(ret, line, ID2SYM(rb_intern("key?")), INT2FIX(1));
+ ADD_INSNL(ret, line, branchunless, default_label);
+ ADD_INSN(ret, line, dup);
+ ADD_INSN1(ret, line, putobject, ID2SYM(id));
+ ADD_SEND(ret, line, ID2SYM(rb_intern("delete")), INT2FIX(1));
+ switch (nd_type(node->nd_body)) {
+ case NODE_LASGN:
+ idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id);
+ ADD_INSN2(ret, line, setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq)));
+ break;
+ case NODE_DASGN:
+ case NODE_DASGN_CURR:
+ idx = get_dyna_var_idx(iseq, id, &lv, &ls);
+ ADD_INSN2(ret, line, setlocal, INT2FIX(ls - idx), INT2FIX(lv));
break;
+ default:
+ rb_bug("iseq_compile_each (NODE_KW_ARG): unknown node: %s", ruby_node_name(nd_type(node->nd_body)));
+ }
+ if (node->nd_body->nd_value != (NODE *)-1) {
+ end_label = NEW_LABEL(nd_line(node));
+ ADD_INSNL(ret, nd_line(node), jump, end_label);
}
+ ADD_LABEL(ret, default_label);
+ if (node->nd_body->nd_value != (NODE *)-1) {
+ COMPILE_POPED(ret, "keyword default argument", node->nd_body);
+ ADD_LABEL(ret, end_label);
+ }
+ break;
+ }
case NODE_DSYM:{
compile_dstr(iseq, ret, node);
if (!poped) {
- ADD_SEND(ret, line, idIntern, INT2FIX(0));
+ ADD_SEND(ret, line, ID2SYM(idIntern), INT2FIX(0));
}
else {
ADD_INSN(ret, line, pop);
@@ -5913,52 +5292,24 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_ATTRASGN:{
DECL_ANCHOR(recv);
DECL_ANCHOR(args);
- unsigned int flag = 0;
- ID mid = node->nd_mid;
- LABEL *lskip = 0;
+ VALUE flag = 0;
VALUE argc;
- /* optimization shortcut
- * obj["literal"] = value -> opt_aset_with(obj, "literal", value)
- */
- if (mid == idASET && !private_recv_p(node) && node->nd_args &&
- nd_type(node->nd_args) == NODE_ARRAY && node->nd_args->nd_alen == 2 &&
- nd_type(node->nd_args->nd_head) == NODE_STR &&
- ISEQ_COMPILE_DATA(iseq)->current_block == NULL &&
- ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction)
- {
- VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit);
- node->nd_args->nd_head->nd_lit = str;
- iseq_add_mark_object(iseq, str);
- COMPILE(ret, "recv", node->nd_recv);
- COMPILE(ret, "value", node->nd_args->nd_next->nd_head);
- if (!poped) {
- ADD_INSN(ret, line, swap);
- ADD_INSN1(ret, line, topn, INT2FIX(1));
- }
- ADD_INSN3(ret, line, opt_aset_with,
- new_callinfo(iseq, idASET, 2, 0, NULL, FALSE),
- NULL/* CALL_CACHE */, str);
- ADD_INSN(ret, line, pop);
- break;
- }
-
INIT_ANCHOR(recv);
INIT_ANCHOR(args);
- argc = setup_args(iseq, args, node->nd_args, &flag, NULL);
+ argc = setup_args(iseq, args, node->nd_args, &flag);
- flag |= COMPILE_RECV(recv, "recv", node);
+ if (node->nd_recv == (NODE *) 1) {
+ flag |= VM_CALL_FCALL;
+ ADD_INSN(recv, line, putself);
+ }
+ else {
+ COMPILE(recv, "recv", node->nd_recv);
+ }
debugp_param("argc", argc);
- debugp_param("nd_mid", ID2SYM(mid));
+ debugp_param("nd_mid", ID2SYM(node->nd_mid));
- if (!rb_is_attrset_id(mid)) {
- /* safe nav attr */
- mid = rb_id_attrset(mid);
- ADD_INSN(recv, line, dup);
- lskip = NEW_LABEL(line);
- ADD_INSNL(recv, line, branchnil, lskip);
- }
if (!poped) {
ADD_INSN(ret, line, putnil);
ADD_SEQ(ret, recv);
@@ -5968,7 +5319,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, topn, INT2FIX(1));
if (flag & VM_CALL_ARGS_SPLAT) {
ADD_INSN1(ret, line, putobject, INT2FIX(-1));
- ADD_SEND(ret, line, idAREF, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(idAREF), INT2FIX(1));
}
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3));
ADD_INSN (ret, line, pop);
@@ -5976,7 +5327,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else if (flag & VM_CALL_ARGS_SPLAT) {
ADD_INSN(ret, line, dup);
ADD_INSN1(ret, line, putobject, INT2FIX(-1));
- ADD_SEND(ret, line, idAREF, INT2FIX(1));
+ ADD_SEND(ret, line, ID2SYM(idAREF), INT2FIX(1));
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2));
ADD_INSN (ret, line, pop);
}
@@ -5988,31 +5339,22 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_SEQ(ret, recv);
ADD_SEQ(ret, args);
}
- ADD_SEND_WITH_FLAG(ret, line, mid, argc, INT2FIX(flag));
- if (lskip) ADD_LABEL(ret, lskip);
+ ADD_SEND_R(ret, line, ID2SYM(node->nd_mid), argc, 0, LONG2FIX(flag));
ADD_INSN(ret, line, pop);
break;
}
case NODE_PRELUDE:{
- const rb_compile_option_t *orig_opt = ISEQ_COMPILE_DATA(iseq)->option;
- rb_compile_option_t new_opt = *orig_opt;
- if (node->nd_orig) {
- rb_iseq_make_compile_option(&new_opt, node->nd_orig);
- ISEQ_COMPILE_DATA(iseq)->option = &new_opt;
- }
COMPILE_POPED(ret, "prelude", node->nd_head);
COMPILE_(ret, "body", node->nd_body, poped);
- ISEQ_COMPILE_DATA(iseq)->option = orig_opt;
break;
}
case NODE_LAMBDA:{
/* compile same as lambda{...} */
- const rb_iseq_t *block = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
+ VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
VALUE argc = INT2FIX(0);
-
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_CALL_WITH_BLOCK(ret, line, idLambda, argc, block);
+ ADD_CALL_WITH_BLOCK(ret, line, ID2SYM(idLambda), argc, block);
if (poped) {
ADD_INSN(ret, line, pop);
@@ -6020,7 +5362,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
default:
- UNKNOWN_NODE("iseq_compile_each", node);
+ rb_bug("iseq_compile_each: unknown node: %s", ruby_node_name(type));
return COMPILE_NG;
}
@@ -6051,29 +5393,16 @@ calc_sp_depth(int depth, INSN *insn)
return insn_stack_increase(depth, insn->insn_id, insn->operands);
}
-static VALUE
-opobj_inspect(VALUE obj)
+static int
+insn_data_line_no(INSN *iobj)
{
- struct RBasic *r = (struct RBasic *) obj;
- if (!SPECIAL_CONST_P(r) && r->klass == 0) {
- switch (BUILTIN_TYPE(r)) {
- case T_STRING:
- obj = rb_str_new_cstr(RSTRING_PTR(obj));
- break;
- case T_ARRAY:
- obj = rb_ary_dup(obj);
- break;
- }
- }
- return rb_inspect(obj);
+ return insn_len(iobj->line_no);
}
-
-
static VALUE
insn_data_to_s_detail(INSN *iobj)
{
- VALUE str = rb_sprintf("%-20s ", insn_name(iobj->insn_id));
+ VALUE str = rb_sprintf("%-16s", insn_name(iobj->insn_id));
if (iobj->operands) {
const char *types = insn_op_types(iobj->insn_id);
@@ -6081,6 +5410,7 @@ insn_data_to_s_detail(INSN *iobj)
for (j = 0; types[j]; j++) {
char type = types[j];
+ printf("str: %"PRIxVALUE", type: %c\n", str, type);
switch (type) {
case TS_OFFSET: /* label(destination position) */
@@ -6095,9 +5425,9 @@ insn_data_to_s_detail(INSN *iobj)
rb_iseq_t *iseq = (rb_iseq_t *)OPERAND_AT(iobj, j);
VALUE val = Qnil;
if (0 && iseq) { /* TODO: invalidate now */
- val = (VALUE)iseq;
+ val = iseq->self;
}
- rb_str_concat(str, opobj_inspect(val));
+ rb_str_concat(str, rb_inspect(val));
}
break;
case TS_LINDEX:
@@ -6105,17 +5435,17 @@ insn_data_to_s_detail(INSN *iobj)
case TS_VALUE: /* VALUE */
{
VALUE v = OPERAND_AT(iobj, j);
- rb_str_concat(str, opobj_inspect(v));
+ rb_str_concat(str, rb_inspect(v));
break;
}
case TS_ID: /* ID */
- rb_str_concat(str, opobj_inspect(OPERAND_AT(iobj, j)));
+ rb_str_concat(str, rb_inspect(OPERAND_AT(iobj, j)));
break;
case TS_GENTRY:
{
struct rb_global_entry *entry = (struct rb_global_entry *)
(OPERAND_AT(iobj, j) & (~1));
- rb_str_append(str, rb_id2str(entry->id));
+ rb_str_cat2(str, rb_id2name(entry->id));
break;
}
case TS_IC: /* inline cache */
@@ -6123,33 +5453,13 @@ insn_data_to_s_detail(INSN *iobj)
break;
case TS_CALLINFO: /* call info */
{
- struct rb_call_info *ci = (struct rb_call_info *)OPERAND_AT(iobj, j);
- rb_str_cat2(str, "<callinfo:");
- if (ci->mid) rb_str_catf(str, "%"PRIsVALUE, rb_id2str(ci->mid));
- rb_str_catf(str, ", %d>", ci->orig_argc);
- break;
- }
- case TS_CALLCACHE: /* call cache */
- {
- rb_str_catf(str, "<call cache>");
+ rb_call_info_t *ci = (rb_call_info_t *)OPERAND_AT(iobj, j);
+ rb_str_catf(str, "<callinfo:%s, %d>", ci->mid ? rb_id2name(ci->mid) : "", ci->orig_argc);
break;
}
case TS_CDHASH: /* case/when condition cache */
rb_str_cat2(str, "<ch>");
break;
- case TS_FUNCPTR:
- {
- rb_insn_func_t func = (rb_insn_func_t)OPERAND_AT(iobj, j);
-#ifdef HAVE_DLADDR
- Dl_info info;
- if (dladdr(func, &info) && info.dli_sname) {
- rb_str_cat2(str, info.dli_sname);
- break;
- }
-#endif
- rb_str_catf(str, "<%p>", func);
- }
- break;
default:{
rb_raise(rb_eSyntaxError, "unknown operand type: %c", type);
}
@@ -6178,7 +5488,7 @@ dump_disasm_list(struct iseq_link_element *link)
{
iobj = (INSN *)link;
str = insn_data_to_s_detail(iobj);
- printf("%04d %-65s(%4u)\n", pos, StringValueCStr(str), iobj->line_no);
+ printf("%04d %-65s(%4d)\n", pos, StringValueCStr(str), insn_data_line_no(iobj));
pos += insn_data_length(iobj);
break;
}
@@ -6196,7 +5506,7 @@ dump_disasm_list(struct iseq_link_element *link)
case ISEQ_ELEMENT_ADJUST:
{
ADJUST *adjust = (ADJUST *)link;
- printf("adjust: [label: %d]\n", adjust->label ? adjust->label->label_no : -1);
+ printf("adjust: [label: %d]\n", adjust->label->label_no);
break;
}
default:
@@ -6206,7 +5516,6 @@ dump_disasm_list(struct iseq_link_element *link)
link = link->next;
}
printf("---------------------\n");
- fflush(stdout);
}
const char *
@@ -6221,7 +5530,7 @@ rb_insns_name_array(void)
VALUE ary = rb_ary_new();
int i;
for (i = 0; i < numberof(insn_name_info); i++) {
- rb_ary_push(ary, rb_fstring(rb_str_new2(insn_name_info[i])));
+ rb_ary_push(ary, rb_obj_freeze(rb_str_new2(insn_name_info[i])));
}
return rb_obj_freeze(ary);
}
@@ -6240,7 +5549,6 @@ register_label(rb_iseq_t *iseq, struct st_table *labels_table, VALUE obj)
else {
label = (LABEL *)tmp;
}
- LABEL_REF(label);
return label;
}
@@ -6249,6 +5557,7 @@ get_exception_sym2type(VALUE sym)
{
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
+ VALUE sym_inspect;
static VALUE symRescue, symEnsure, symRetry;
static VALUE symBreak, symRedo, symNext;
@@ -6267,7 +5576,9 @@ get_exception_sym2type(VALUE sym)
if (sym == symBreak) return CATCH_TYPE_BREAK;
if (sym == symRedo) return CATCH_TYPE_REDO;
if (sym == symNext) return CATCH_TYPE_NEXT;
- rb_raise(rb_eSyntaxError, "invalid exception symbol: %+"PRIsVALUE, sym);
+ sym_inspect = rb_inspect(sym);
+ rb_raise(rb_eSyntaxError, "invalid exception symbol: %s",
+ StringValuePtr(sym_inspect));
return 0;
}
@@ -6278,13 +5589,12 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table,
int i;
for (i=0; i<RARRAY_LEN(exception); i++) {
- const rb_iseq_t *eiseq;
- VALUE v, type;
+ VALUE v, type, eiseqval;
const VALUE *ptr;
LABEL *lstart, *lend, *lcont;
- unsigned int sp;
+ int sp;
- v = rb_convert_type(RARRAY_AREF(exception, i), T_ARRAY,
+ RB_GC_GUARD(v) = rb_convert_type(RARRAY_AREF(exception, i), T_ARRAY,
"Array", "to_ary");
if (RARRAY_LEN(v) != 6) {
rb_raise(rb_eSyntaxError, "wrong exception entry");
@@ -6292,22 +5602,20 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table,
ptr = RARRAY_CONST_PTR(v);
type = get_exception_sym2type(ptr[0]);
if (ptr[1] == Qnil) {
- eiseq = NULL;
+ eiseqval = 0;
}
else {
- eiseq = rb_iseqw_to_iseq(rb_iseq_load(ptr[1], (VALUE)iseq, Qnil));
+ eiseqval = rb_iseq_load(ptr[1], iseq->self, Qnil);
}
lstart = register_label(iseq, labels_table, ptr[2]);
lend = register_label(iseq, labels_table, ptr[3]);
lcont = register_label(iseq, labels_table, ptr[4]);
- sp = NUM2UINT(ptr[5]);
+ sp = NUM2INT(ptr[5]);
(void)sp;
- ADD_CATCH_ENTRY(type, lstart, lend, eiseq, lcont);
-
- RB_GC_GUARD(v);
+ ADD_CATCH_ENTRY(type, lstart, lend, eiseqval, lcont);
}
return COMPILE_OK;
}
@@ -6326,74 +5634,32 @@ insn_make_insn_table(void)
return table;
}
-static const rb_iseq_t *
-iseq_build_load_iseq(const rb_iseq_t *iseq, VALUE op)
+static VALUE
+iseq_build_load_iseq(rb_iseq_t *iseq, VALUE op)
{
- VALUE iseqw;
- const rb_iseq_t *loaded_iseq;
-
+ VALUE iseqval;
if (RB_TYPE_P(op, T_ARRAY)) {
- iseqw = rb_iseq_load(op, (VALUE)iseq, Qnil);
+ iseqval = rb_iseq_load(op, iseq->self, Qnil);
}
else if (CLASS_OF(op) == rb_cISeq) {
- iseqw = op;
+ iseqval = op;
}
else {
rb_raise(rb_eSyntaxError, "ISEQ is required");
}
-
- loaded_iseq = rb_iseqw_to_iseq(iseqw);
- iseq_add_mark_object(iseq, (VALUE)loaded_iseq);
- return loaded_iseq;
-}
-
-static VALUE
-iseq_build_callinfo_from_hash(rb_iseq_t *iseq, VALUE op)
-{
- ID mid = 0;
- int orig_argc = 0;
- unsigned int flag = 0;
- struct rb_call_info_kw_arg *kw_arg = 0;
-
- if (!NIL_P(op)) {
- VALUE vmid = rb_hash_aref(op, ID2SYM(rb_intern("mid")));
- VALUE vflag = rb_hash_aref(op, ID2SYM(rb_intern("flag")));
- VALUE vorig_argc = rb_hash_aref(op, ID2SYM(rb_intern("orig_argc")));
- VALUE vkw_arg = rb_hash_aref(op, ID2SYM(rb_intern("kw_arg")));
-
- if (!NIL_P(vmid)) mid = SYM2ID(vmid);
- if (!NIL_P(vflag)) flag = NUM2UINT(vflag);
- if (!NIL_P(vorig_argc)) orig_argc = FIX2INT(vorig_argc);
-
- if (!NIL_P(vkw_arg)) {
- int i;
- int len = RARRAY_LENINT(vkw_arg);
- size_t n = rb_call_info_kw_arg_bytes(len);
-
- kw_arg = xmalloc(n);
- kw_arg->keyword_len = len;
- for (i = 0; i < len; i++) {
- VALUE kw = RARRAY_AREF(vkw_arg, i);
- SYM2ID(kw); /* make immortal */
- kw_arg->keywords[i] = kw;
- }
- }
- }
-
- return (VALUE)new_callinfo(iseq, mid, orig_argc, flag, kw_arg, (flag & VM_CALL_ARGS_SIMPLE) == 0);
+ iseq_add_mark_object(iseq, iseqval);
+ return iseqval;
}
static int
iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
- VALUE body, VALUE labels_wrapper)
+ VALUE body, struct st_table *labels_table)
{
/* TODO: body should be frozen */
const VALUE *ptr = RARRAY_CONST_PTR(body);
long i, len = RARRAY_LEN(body);
- struct st_table *labels_table = DATA_PTR(labels_wrapper);
int j;
int line_no = 0;
- int ret = COMPILE_OK;
/*
* index -> LABEL *label
@@ -6423,17 +5689,14 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
insn = (argc < 0) ? Qnil : RARRAY_AREF(obj, 0);
if (st_lookup(insn_table, (st_data_t)insn, &insn_id) == 0) {
/* TODO: exception */
- COMPILE_ERROR(ruby_sourcefile_string, line_no,
- "unknown instruction: %+"PRIsVALUE, insn);
- ret = COMPILE_NG;
- break;
+ RB_GC_GUARD(insn) = rb_inspect(insn);
+ rb_compile_error(RSTRING_PTR(iseq->location.path), line_no,
+ "unknown instruction: %s", RSTRING_PTR(insn));
}
if (argc != insn_len((VALUE)insn_id)-1) {
- COMPILE_ERROR(ruby_sourcefile_string, line_no,
- "operand size mismatch");
- ret = COMPILE_NG;
- break;
+ rb_compile_error(RSTRING_PTR(iseq->location.path), line_no,
+ "operand size mismatch");
}
if (argc > 0) {
@@ -6458,7 +5721,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
case TS_ISEQ:
{
if (op != Qnil) {
- argv[j] = (VALUE)iseq_build_load_iseq(iseq, op);
+ argv[j] = iseq_build_load_iseq(iseq, op);
}
else {
argv[j] = 0;
@@ -6471,15 +5734,30 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
break;
case TS_IC:
argv[j] = op;
- if (NUM2UINT(op) >= iseq->body->is_size) {
- iseq->body->is_size = NUM2INT(op) + 1;
+ if (NUM2INT(op) >= iseq->is_size) {
+ iseq->is_size = NUM2INT(op) + 1;
}
break;
case TS_CALLINFO:
- argv[j] = iseq_build_callinfo_from_hash(iseq, op);
- break;
- case TS_CALLCACHE:
- argv[j] = Qfalse;
+ {
+ ID mid = 0;
+ int orig_argc = 0;
+ VALUE block = 0;
+ unsigned long flag = 0;
+
+ if (!NIL_P(op)) {
+ VALUE vmid = rb_hash_aref(op, ID2SYM(rb_intern("mid")));
+ VALUE vflag = rb_hash_aref(op, ID2SYM(rb_intern("flag")));
+ VALUE vorig_argc = rb_hash_aref(op, ID2SYM(rb_intern("orig_argc")));
+ VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("block")));
+
+ if (!NIL_P(vmid)) mid = SYM2ID(vmid);
+ if (!NIL_P(vflag)) flag = NUM2ULONG(vflag);
+ if (!NIL_P(vorig_argc)) orig_argc = FIX2INT(vorig_argc);
+ if (!NIL_P(vblock)) block = iseq_build_load_iseq(iseq, vblock);
+ }
+ argv[j] = (VALUE)new_callinfo(iseq, mid, orig_argc, block, flag);
+ }
break;
case TS_ID:
argv[j] = rb_convert_type(op, T_SYMBOL,
@@ -6488,30 +5766,16 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
case TS_CDHASH:
{
int i;
- VALUE map = rb_hash_new();
-
- rb_hash_tbl_raw(map)->type = &cdhash_type;
op = rb_convert_type(op, T_ARRAY, "Array", "to_ary");
+ op = rb_ary_dup(op);
for (i=0; i<RARRAY_LEN(op); i+=2) {
- VALUE key = RARRAY_AREF(op, i);
- VALUE sym = RARRAY_AREF(op, i+1);
+ VALUE sym = rb_ary_entry(op, i+1);
LABEL *label =
register_label(iseq, labels_table, sym);
- rb_hash_aset(map, key, (VALUE)label | 1);
+ rb_ary_store(op, i+1, (VALUE)label | 1);
}
- RB_GC_GUARD(op);
- argv[j] = map;
- rb_iseq_add_mark_object(iseq, map);
- }
- break;
- case TS_FUNCPTR:
- {
-#if SIZEOF_VALUE <= SIZEOF_LONG
- long funcptr = NUM2LONG(op);
-#else
- LONG_LONG funcptr = NUM2LL(op);
-#endif
- argv[j] = (VALUE)funcptr;
+ argv[j] = op;
+ iseq_add_mark_object_compile_time(iseq, op);
}
break;
default:
@@ -6527,197 +5791,87 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
rb_raise(rb_eTypeError, "unexpected object for instruction");
}
}
- DATA_PTR(labels_wrapper) = 0;
validate_labels(iseq, labels_table);
- if (!ret) return ret;
- return iseq_setup(iseq, anchor);
+ st_free_table(labels_table);
+ iseq_setup(iseq, anchor);
+ return COMPILE_OK;
}
#define CHECK_ARRAY(v) rb_convert_type((v), T_ARRAY, "Array", "to_ary")
+#define CHECK_STRING(v) rb_convert_type((v), T_STRING, "String", "to_str")
#define CHECK_SYMBOL(v) rb_convert_type((v), T_SYMBOL, "Symbol", "to_sym")
+static inline VALUE CHECK_INTEGER(VALUE v) {(void)NUM2LONG(v); return v;}
-static int
-int_param(int *dst, VALUE param, VALUE sym)
-{
- VALUE val = rb_hash_aref(param, sym);
- switch (TYPE(val)) {
- case T_NIL:
- return FALSE;
- case T_FIXNUM:
- *dst = FIX2INT(val);
- return TRUE;
- default:
- rb_raise(rb_eTypeError, "invalid %+"PRIsVALUE" Fixnum: %+"PRIsVALUE,
- sym, val);
- }
- return FALSE;
-}
-
-static const struct rb_iseq_param_keyword *
-iseq_build_kw(rb_iseq_t *iseq, VALUE params, VALUE keywords)
-{
- int i, j;
- int len = RARRAY_LENINT(keywords);
- int default_len;
- VALUE key, sym, default_val;
- VALUE *dvs;
- ID *ids;
- struct rb_iseq_param_keyword *keyword = ZALLOC(struct rb_iseq_param_keyword);
-
- iseq->body->param.flags.has_kw = TRUE;
-
- keyword->num = len;
-#define SYM(s) ID2SYM(rb_intern(#s))
- (void)int_param(&keyword->bits_start, params, SYM(kwbits));
- i = keyword->bits_start - keyword->num;
- ids = (VALUE *)&iseq->body->local_table[i];
-#undef SYM
-
- /* required args */
- for (i = 0; i < len; i++) {
- VALUE val = RARRAY_AREF(keywords, i);
-
- if (!SYMBOL_P(val)) {
- goto default_values;
- }
- ids[i] = SYM2ID(val);
- keyword->required_num++;
- }
-
- default_values: /* note: we intentionally preserve `i' from previous loop */
- default_len = len - i;
- if (default_len == 0) {
- return keyword;
- }
-
- dvs = ALLOC_N(VALUE, default_len);
-
- for (j = 0; i < len; i++, j++) {
- key = RARRAY_AREF(keywords, i);
- CHECK_ARRAY(key);
-
- switch (RARRAY_LEN(key)) {
- case 1:
- sym = RARRAY_AREF(key, 0);
- default_val = Qundef;
- break;
- case 2:
- sym = RARRAY_AREF(key, 0);
- default_val = RARRAY_AREF(key, 1);
- break;
- default:
- rb_raise(rb_eTypeError, "keyword default has unsupported len %+"PRIsVALUE, key);
- }
- ids[i] = SYM2ID(sym);
- dvs[j] = default_val;
- }
-
- keyword->table = ids;
- keyword->default_values = dvs;
-
- return keyword;
-}
-
-void
-rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params,
+VALUE
+rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body)
{
-#define SYM(s) ID2SYM(rb_intern(#s))
- int i, len;
+ int i;
ID *tbl;
struct st_table *labels_table = st_init_numtable();
- VALUE labels_wrapper = Data_Wrap_Struct(0, 0, st_free_table, labels_table);
- VALUE arg_opt_labels = rb_hash_aref(params, SYM(opt));
- VALUE keywords = rb_hash_aref(params, SYM(keyword));
- VALUE sym_arg_rest = ID2SYM(rb_intern("#arg_rest"));
DECL_ANCHOR(anchor);
INIT_ANCHOR(anchor);
- len = RARRAY_LENINT(locals);
- iseq->body->local_table_size = len;
- iseq->body->local_table = tbl = len > 0 ? (ID *)ALLOC_N(ID, iseq->body->local_table_size) : NULL;
- iseq->body->local_size = iseq->body->local_table_size + 1;
+ iseq->local_table_size = RARRAY_LENINT(locals);
+ iseq->local_table = tbl = (ID *)ALLOC_N(ID, iseq->local_table_size);
+ iseq->local_size = iseq->local_table_size + 1;
- for (i = 0; i < len; i++) {
+ for (i=0; i<RARRAY_LEN(locals); i++) {
VALUE lv = RARRAY_AREF(locals, i);
+ tbl[i] = FIXNUM_P(lv) ? (ID)FIX2LONG(lv) : SYM2ID(CHECK_SYMBOL(lv));
+ }
- if (sym_arg_rest == lv) {
- tbl[i] = 0;
+ /* args */
+ if (FIXNUM_P(args)) {
+ iseq->arg_size = iseq->argc = FIX2INT(args);
+ iseq->arg_simple = 1;
+ }
+ else {
+ int i = 0;
+ VALUE argc = CHECK_INTEGER(rb_ary_entry(args, i++));
+ VALUE arg_opt_labels = CHECK_ARRAY(rb_ary_entry(args, i++));
+ VALUE arg_post_len = CHECK_INTEGER(rb_ary_entry(args, i++));
+ VALUE arg_post_start = CHECK_INTEGER(rb_ary_entry(args, i++));
+ VALUE arg_rest = CHECK_INTEGER(rb_ary_entry(args, i++));
+ VALUE arg_block = CHECK_INTEGER(rb_ary_entry(args, i++));
+ VALUE arg_simple = CHECK_INTEGER(rb_ary_entry(args, i++));
+
+ iseq->argc = FIX2INT(argc);
+ iseq->arg_rest = FIX2INT(arg_rest);
+ iseq->arg_post_len = FIX2INT(arg_post_len);
+ iseq->arg_post_start = FIX2INT(arg_post_start);
+ iseq->arg_block = FIX2INT(arg_block);
+ iseq->arg_opts = RARRAY_LENINT(arg_opt_labels);
+ iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, iseq->arg_opts);
+
+ if (iseq->arg_block != -1) {
+ iseq->arg_size = iseq->arg_block + 1;
+ }
+ else if (iseq->arg_post_len) {
+ iseq->arg_size = iseq->arg_post_start + iseq->arg_post_len;
+ }
+ else if (iseq->arg_rest != -1) {
+ iseq->arg_size = iseq->arg_rest + 1;
}
else {
- tbl[i] = FIXNUM_P(lv) ? (ID)FIX2LONG(lv) : SYM2ID(CHECK_SYMBOL(lv));
+ iseq->arg_size = iseq->argc + (iseq->arg_opts ? iseq->arg_opts - 1 : 0);
}
- }
- /*
- * we currently ignore misc params,
- * local_size, stack_size and param.size are all calculated
- */
-
-#define INT_PARAM(F) int_param(&iseq->body->param.F, params, SYM(F))
- if (INT_PARAM(lead_num)) {
- iseq->body->param.flags.has_lead = TRUE;
- }
- if (INT_PARAM(post_num)) iseq->body->param.flags.has_post = TRUE;
- if (INT_PARAM(post_start)) iseq->body->param.flags.has_post = TRUE;
- if (INT_PARAM(rest_start)) iseq->body->param.flags.has_rest = TRUE;
- if (INT_PARAM(block_start)) iseq->body->param.flags.has_block = TRUE;
-#undef INT_PARAM
-
- switch (TYPE(arg_opt_labels)) {
- case T_ARRAY:
- len = RARRAY_LENINT(arg_opt_labels);
- iseq->body->param.flags.has_opt = !!(len - 1 >= 0);
-
- if (iseq->body->param.flags.has_opt) {
- VALUE *opt_table = ALLOC_N(VALUE, len);
-
- for (i = 0; i < len; i++) {
- VALUE ent = RARRAY_AREF(arg_opt_labels, i);
- LABEL *label = register_label(iseq, labels_table, ent);
- opt_table[i] = (VALUE)label;
- }
-
- iseq->body->param.opt_num = len - 1;
- iseq->body->param.opt_table = opt_table;
+ for (i=0; i<RARRAY_LEN(arg_opt_labels); i++) {
+ iseq->arg_opt_table[i] =
+ (VALUE)register_label(iseq, labels_table,
+ rb_ary_entry(arg_opt_labels, i));
}
- case T_NIL:
- break;
- default:
- rb_raise(rb_eTypeError, ":opt param is not an array: %+"PRIsVALUE,
- arg_opt_labels);
- }
- switch (TYPE(keywords)) {
- case T_ARRAY:
- iseq->body->param.keyword = iseq_build_kw(iseq, params, keywords);
- case T_NIL:
- break;
- default:
- rb_raise(rb_eTypeError, ":keywords param is not an array: %+"PRIsVALUE,
- keywords);
+ iseq->arg_simple = NUM2INT(arg_simple);
}
- if (Qtrue == rb_hash_aref(params, SYM(ambiguous_param0))) {
- iseq->body->param.flags.ambiguous_param0 = TRUE;
- }
-
- if (int_param(&i, params, SYM(kwrest))) {
- struct rb_iseq_param_keyword *keyword = (struct rb_iseq_param_keyword *)iseq->body->param.keyword;
- if (keyword == NULL) {
- iseq->body->param.keyword = keyword = ZALLOC(struct rb_iseq_param_keyword);
- }
- keyword->rest_start = i;
- iseq->body->param.flags.has_kwrest = TRUE;
- }
-#undef SYM
- iseq_calc_param_size(iseq);
-
/* exception */
iseq_build_from_ary_exception(iseq, labels_table, exception);
/* body */
- iseq_build_from_ary_body(iseq, anchor, body, labels_wrapper);
+ iseq_build_from_ary_body(iseq, anchor, body, labels_table);
+ return iseq->self;
}
/* for parser */
@@ -6726,23 +5880,22 @@ int
rb_dvar_defined(ID id)
{
rb_thread_t *th = GET_THREAD();
- const rb_iseq_t *iseq;
-
+ rb_iseq_t *iseq;
if (th->base_block && (iseq = th->base_block->iseq)) {
- while (iseq->body->type == ISEQ_TYPE_BLOCK ||
- iseq->body->type == ISEQ_TYPE_RESCUE ||
- iseq->body->type == ISEQ_TYPE_ENSURE ||
- iseq->body->type == ISEQ_TYPE_EVAL ||
- iseq->body->type == ISEQ_TYPE_MAIN
+ while (iseq->type == ISEQ_TYPE_BLOCK ||
+ iseq->type == ISEQ_TYPE_RESCUE ||
+ iseq->type == ISEQ_TYPE_ENSURE ||
+ iseq->type == ISEQ_TYPE_EVAL ||
+ iseq->type == ISEQ_TYPE_MAIN
) {
- unsigned int i;
+ int i;
- for (i = 0; i < iseq->body->local_table_size; i++) {
- if (iseq->body->local_table[i] == id) {
+ for (i = 0; i < iseq->local_table_size; i++) {
+ if (iseq->local_table[i] == id) {
return 1;
}
}
- iseq = iseq->body->parent_iseq;
+ iseq = iseq->parent_iseq;
}
}
return 0;
@@ -6752,14 +5905,14 @@ int
rb_local_defined(ID id)
{
rb_thread_t *th = GET_THREAD();
- const rb_iseq_t *iseq;
+ rb_iseq_t *iseq;
if (th->base_block && th->base_block->iseq) {
- unsigned int i;
- iseq = th->base_block->iseq->body->local_iseq;
+ int i;
+ iseq = th->base_block->iseq->local_iseq;
- for (i=0; i<iseq->body->local_table_size; i++) {
- if (iseq->body->local_table[i] == id) {
+ for (i=0; i<iseq->local_table_size; i++) {
+ if (iseq->local_table[i] == id) {
return 1;
}
}
@@ -6778,1595 +5931,3 @@ rb_parse_in_main(void)
{
return GET_THREAD()->parse_in_eval < 0;
}
-
-static int
-caller_location(VALUE *path, VALUE *absolute_path)
-{
- const rb_thread_t *const th = GET_THREAD();
- const rb_control_frame_t *const cfp =
- rb_vm_get_ruby_level_next_cfp(th, th->cfp);
-
- if (cfp) {
- int line = rb_vm_get_sourceline(cfp);
- *path = cfp->iseq->body->location.path;
- *absolute_path = cfp->iseq->body->location.absolute_path;
- return line;
- }
- else {
- *path = rb_str_new2("<compiled>");
- *absolute_path = *path;
- return 1;
- }
-}
-
-typedef struct {
- VALUE arg;
- rb_insn_func_t func;
- int line;
-} accessor_args;
-
-static const rb_iseq_t *
-method_for_self(VALUE name, VALUE arg, rb_insn_func_t func,
- VALUE (*build)(rb_iseq_t *, LINK_ANCHOR *, VALUE))
-{
- VALUE path, absolute_path;
- accessor_args acc;
-
- acc.arg = arg;
- acc.func = func;
- acc.line = caller_location(&path, &absolute_path);
- return rb_iseq_new_with_opt((NODE *)IFUNC_NEW(build, (VALUE)&acc, 0),
- rb_sym2str(name), path, absolute_path,
- INT2FIX(acc.line), 0, ISEQ_TYPE_METHOD, 0);
-}
-
-static VALUE
-for_self_aref(rb_iseq_t *iseq, LINK_ANCHOR *ret, VALUE a)
-{
- const accessor_args *const args = (void *)a;
- const int line = args->line;
-
- iseq_set_local_table(iseq, 0);
- iseq->body->param.lead_num = 0;
- iseq->body->param.size = 0;
-
- ADD_INSN1(ret, line, putobject, args->arg);
- ADD_INSN1(ret, line, opt_call_c_function, (VALUE)args->func);
- return Qnil;
-}
-
-static VALUE
-for_self_aset(rb_iseq_t *iseq, LINK_ANCHOR *ret, VALUE a)
-{
- const accessor_args *const args = (void *)a;
- const int line = args->line;
- static const ID vars[] = {1, idUScore};
-
- iseq_set_local_table(iseq, vars);
- iseq->body->param.lead_num = 1;
- iseq->body->param.size = 1;
-
- ADD_INSN2(ret, line, getlocal, INT2FIX(numberof(vars)-0), INT2FIX(0));
- ADD_INSN1(ret, line, putobject, args->arg);
- ADD_INSN1(ret, line, opt_call_c_function, (VALUE)args->func);
- ADD_INSN(ret, line, pop);
- return Qnil;
-}
-
-/*
- * func (index) -> (value)
- */
-const rb_iseq_t *
-rb_method_for_self_aref(VALUE name, VALUE arg, rb_insn_func_t func)
-{
- return method_for_self(name, arg, func, for_self_aref);
-}
-
-/*
- * func (index, value) -> (index, value)
- */
-const rb_iseq_t *
-rb_method_for_self_aset(VALUE name, VALUE arg, rb_insn_func_t func)
-{
- return method_for_self(name, arg, func, for_self_aset);
-}
-
-/* ISeq binary format */
-
-typedef unsigned int ibf_offset_t;
-#define IBF_OFFSET(ptr) ((ibf_offset_t)(VALUE)(ptr))
-
-struct ibf_header {
- char magic[4]; /* YARB */
- unsigned int major_version;
- unsigned int minor_version;
- unsigned int size;
- unsigned int extra_size;
-
- unsigned int iseq_list_size;
- unsigned int id_list_size;
- unsigned int object_list_size;
-
- ibf_offset_t iseq_list_offset;
- ibf_offset_t id_list_offset;
- ibf_offset_t object_list_offset;
-};
-
-struct ibf_id_entry {
- enum {
- ibf_id_enc_ascii,
- ibf_id_enc_utf8,
- ibf_id_enc_other
- } enc : 2;
- char body[1];
-};
-
-struct ibf_dump {
- VALUE str;
- VALUE iseq_list; /* [iseq0 offset, ...] */
- VALUE obj_list; /* [objs] */
- st_table *iseq_table; /* iseq -> iseq number */
- st_table *id_table; /* id -> id number */
-};
-
-rb_iseq_t * iseq_alloc(void);
-
-struct ibf_load {
- const char *buff;
- const struct ibf_header *header;
- ID *id_list; /* [id0, ...] */
- VALUE iseq_list; /* [iseq0, ...] */
- VALUE obj_list; /* [obj0, ...] */
- VALUE loader_obj;
- VALUE str;
- rb_iseq_t *iseq;
-};
-
-static ibf_offset_t
-ibf_dump_pos(struct ibf_dump *dump)
-{
- return (unsigned int)rb_str_strlen(dump->str);
-}
-
-static ibf_offset_t
-ibf_dump_write(struct ibf_dump *dump, const void *buff, unsigned long size)
-{
- ibf_offset_t pos = ibf_dump_pos(dump);
- rb_str_cat(dump->str, (const char *)buff, size);
- /* TODO: overflow check */
- return pos;
-}
-
-static void
-ibf_dump_overwrite(struct ibf_dump *dump, void *buff, unsigned int size, long offset)
-{
- VALUE str = dump->str;
- char *ptr = RSTRING_PTR(str);
- if ((unsigned long)(size + offset) > (unsigned long)RSTRING_LEN(str))
- rb_bug("ibf_dump_overwrite: overflow");
- memcpy(ptr + offset, buff, size);
-}
-
-static void *
-ibf_load_alloc(const struct ibf_load *load, ibf_offset_t offset, int size)
-{
- void *buff = ruby_xmalloc(size);
- memcpy(buff, load->buff + offset, size);
- return buff;
-}
-
-#define IBF_W(b, type, n) (type *)(VALUE)ibf_dump_write(dump, (b), sizeof(type) * (n))
-#define IBF_WV(variable) ibf_dump_write(dump, &(variable), sizeof(variable))
-#define IBF_WP(b, type, n) ibf_dump_write(dump, (b), sizeof(type) * (n))
-#define IBF_R(val, type, n) (type *)ibf_load_alloc(load, IBF_OFFSET(val), sizeof(type) * (n))
-
-static int
-ibf_table_lookup(struct st_table *table, st_data_t key)
-{
- st_data_t val;
-
- if (st_lookup(table, key, &val)) {
- return (int)val;
- }
- else {
- return -1;
- }
-}
-
-static int
-ibf_table_index(struct st_table *table, st_data_t key)
-{
- int index = ibf_table_lookup(table, key);
-
- if (index < 0) { /* not found */
- index = (int)table->num_entries;
- st_insert(table, key, (st_data_t)index);
- }
-
- return index;
-}
-
-/* dump/load generic */
-
-static VALUE ibf_load_object(const struct ibf_load *load, VALUE object_index);
-static rb_iseq_t *ibf_load_iseq(const struct ibf_load *load, const rb_iseq_t *index_iseq);
-
-static VALUE
-ibf_dump_object(struct ibf_dump *dump, VALUE obj)
-{
- long index = RARRAY_LEN(dump->obj_list);
- long i;
- for (i=0; i<index; i++) {
- if (RARRAY_AREF(dump->obj_list, i) == obj) return (VALUE)i; /* dedup */
- }
- rb_ary_push(dump->obj_list, obj);
- return (VALUE)index;
-}
-
-static VALUE
-ibf_dump_id(struct ibf_dump *dump, ID id)
-{
- return (VALUE)ibf_table_index(dump->id_table, (st_data_t)id);
-}
-
-static ID
-ibf_load_id(const struct ibf_load *load, const ID id_index)
-{
- ID id;
-
- if (id_index == 0) {
- id = 0;
- }
- else {
- id = load->id_list[(long)id_index];
-
- if (id == 0) {
- long *indices = (long *)(load->buff + load->header->id_list_offset);
- VALUE str = ibf_load_object(load, indices[id_index]);
- id = NIL_P(str) ? 0 : rb_intern_str(str); /* str == nil -> internal junk id */
- load->id_list[(long)id_index] = id;
- }
- }
-
- return id;
-}
-
-/* dump/load: code */
-
-static VALUE
-ibf_dump_callinfo(struct ibf_dump *dump, const struct rb_call_info *ci)
-{
- return (ci->flag & VM_CALL_KWARG) ? Qtrue : Qfalse;
-}
-
-static ibf_offset_t ibf_dump_iseq_each(struct ibf_dump *dump, const rb_iseq_t *iseq);
-
-static rb_iseq_t *
-ibf_dump_iseq(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- if (iseq == NULL) {
- return (rb_iseq_t *)-1;
- }
- else {
- int iseq_index = ibf_table_lookup(dump->iseq_table, (st_data_t)iseq);
- if (iseq_index < 0) {
- iseq_index = ibf_table_index(dump->iseq_table, (st_data_t)iseq);
- rb_ary_store(dump->iseq_list, iseq_index, LONG2NUM(ibf_dump_iseq_each(dump, rb_iseq_check(iseq))));
- }
- return (rb_iseq_t *)(VALUE)iseq_index;
- }
-}
-
-static VALUE
-ibf_dump_gentry(struct ibf_dump *dump, const struct rb_global_entry *entry)
-{
- return (VALUE)ibf_dump_id(dump, entry->id);
-}
-
-static VALUE
-ibf_load_gentry(const struct ibf_load *load, const struct rb_global_entry *entry)
-{
- ID gid = ibf_load_id(load, (ID)(VALUE)entry);
- return (VALUE)rb_global_entry(gid);
-}
-
-static VALUE *
-ibf_dump_code(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- const int iseq_size = iseq->body->iseq_size;
- int code_index;
- VALUE *code;
- const VALUE *orig_code = rb_iseq_original_iseq(iseq);
-
- code = ALLOCA_N(VALUE, iseq_size);
-
- for (code_index=0; code_index<iseq_size;) {
- const VALUE insn = orig_code[code_index];
- const char *types = insn_op_types(insn);
- int op_index;
-
- code[code_index++] = (VALUE)insn;
-
- for (op_index=0; types[op_index]; op_index++, code_index++) {
- VALUE op = orig_code[code_index];
- switch (types[op_index]) {
- case TS_CDHASH:
- case TS_VALUE:
- code[code_index] = ibf_dump_object(dump, op);
- break;
- case TS_ISEQ:
- code[code_index] = (VALUE)ibf_dump_iseq(dump, (const rb_iseq_t *)op);
- break;
- case TS_IC:
- {
- unsigned int i;
- for (i=0; i<iseq->body->is_size; i++) {
- if (op == (VALUE)&iseq->body->is_entries[i]) {
- break;
- }
- }
- code[code_index] = i;
- }
- break;
- case TS_CALLINFO:
- code[code_index] = ibf_dump_callinfo(dump, (const struct rb_call_info *)op);
- break;
- case TS_CALLCACHE:
- code[code_index] = 0;
- break;
- case TS_ID:
- code[code_index] = ibf_dump_id(dump, (ID)op);
- break;
- case TS_GENTRY:
- code[code_index] = ibf_dump_gentry(dump, (const struct rb_global_entry *)op);
- break;
- case TS_FUNCPTR:
- rb_raise(rb_eRuntimeError, "TS_FUNCPTR is not supported");
- break;
- default:
- code[code_index] = op;
- break;
- }
- }
- assert(insn_len(insn) == op_index+1);
- }
-
- return IBF_W(code, VALUE, iseq_size);
-}
-
-static VALUE *
-ibf_load_code(const struct ibf_load *load, const rb_iseq_t *iseq, const struct rb_iseq_constant_body *body)
-{
- const int iseq_size = body->iseq_size;
- int code_index;
- VALUE *code = IBF_R(body->iseq_encoded, VALUE, iseq_size);
-
- struct rb_call_info *ci_entries = iseq->body->ci_entries;
- struct rb_call_info_with_kwarg *ci_kw_entries = (struct rb_call_info_with_kwarg *)&iseq->body->ci_entries[iseq->body->ci_size];
- struct rb_call_cache *cc_entries = iseq->body->cc_entries;
- union iseq_inline_storage_entry *is_entries = iseq->body->is_entries;
-
- for (code_index=0; code_index<iseq_size;) {
- const VALUE insn = code[code_index++];
- const char *types = insn_op_types(insn);
- int op_index;
-
- for (op_index=0; types[op_index]; op_index++, code_index++) {
- VALUE op = code[code_index];
-
- switch (types[op_index]) {
- case TS_CDHASH:
- case TS_VALUE:
- code[code_index] = ibf_load_object(load, op);
- break;
- case TS_ISEQ:
- code[code_index] = (VALUE)ibf_load_iseq(load, (const rb_iseq_t *)op);
- break;
- case TS_IC:
- code[code_index] = (VALUE)&is_entries[(int)op];
- break;
- case TS_CALLINFO:
- code[code_index] = op ? (VALUE)ci_kw_entries++ : (VALUE)ci_entries++; /* op is Qtrue (kw) or Qfalse (!kw) */
- break;
- case TS_CALLCACHE:
- code[code_index] = (VALUE)cc_entries++;
- break;
- case TS_ID:
- code[code_index] = ibf_load_id(load, (ID)op);
- break;
- case TS_GENTRY:
- code[code_index] = ibf_load_gentry(load, (const struct rb_global_entry *)op);
- break;
- case TS_FUNCPTR:
- rb_raise(rb_eRuntimeError, "TS_FUNCPTR is not supported");
- break;
- default:
- /* code[code_index] = op; */
- break;
- }
- }
- assert(insn_len(insn) == op_index+1);
- };
-
-
- return code;
-}
-
-static VALUE *
-ibf_dump_param_opt_table(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- int opt_num = iseq->body->param.opt_num;
-
- if (opt_num > 0) {
- return IBF_W(iseq->body->param.opt_table, VALUE, opt_num + 1);
- }
- else {
- return NULL;
- }
-}
-
-static VALUE *
-ibf_load_param_opt_table(const struct ibf_load *load, const struct rb_iseq_constant_body *body)
-{
- int opt_num = body->param.opt_num;
-
- if (opt_num > 0) {
- ibf_offset_t offset = IBF_OFFSET(body->param.opt_table);
- VALUE *table = ALLOC_N(VALUE, opt_num+1);
- MEMCPY(table, load->buff + offset, VALUE, opt_num+1);
- return table;
- }
- else {
- return NULL;
- }
-}
-
-static struct rb_iseq_param_keyword *
-ibf_dump_param_keyword(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- const struct rb_iseq_param_keyword *kw = iseq->body->param.keyword;
-
- if (kw) {
- struct rb_iseq_param_keyword dump_kw = *kw;
- int dv_num = kw->num - kw->required_num;
- ID *ids = kw->num > 0 ? ALLOCA_N(ID, kw->num) : NULL;
- VALUE *dvs = dv_num > 0 ? ALLOCA_N(VALUE, dv_num) : NULL;
- int i;
-
- for (i=0; i<kw->num; i++) ids[i] = (ID)ibf_dump_id(dump, kw->table[i]);
- for (i=0; i<dv_num; i++) dvs[i] = (VALUE)ibf_dump_object(dump, kw->default_values[i]);
-
- dump_kw.table = IBF_W(ids, ID, kw->num);
- dump_kw.default_values = IBF_W(dvs, VALUE, dv_num);
- return IBF_W(&dump_kw, struct rb_iseq_param_keyword, 1);
- }
- else {
- return NULL;
- }
-}
-
-static const struct rb_iseq_param_keyword *
-ibf_load_param_keyword(const struct ibf_load *load, const struct rb_iseq_constant_body *body)
-{
- if (body->param.keyword) {
- struct rb_iseq_param_keyword *kw = IBF_R(body->param.keyword, struct rb_iseq_param_keyword, 1);
- ID *ids = IBF_R(kw->table, ID, kw->num);
- int dv_num = kw->num - kw->required_num;
- VALUE *dvs = IBF_R(kw->default_values, VALUE, dv_num);
- int i;
-
- for (i=0; i<kw->num; i++) {
- ids[i] = ibf_load_id(load, ids[i]);
- }
- for (i=0; i<dv_num; i++) {
- dvs[i] = ibf_load_object(load, dvs[i]);
- }
-
- kw->table = ids;
- kw->default_values = dvs;
- return kw;
- }
- else {
- return NULL;
- }
-}
-
-static struct iseq_line_info_entry *
-ibf_dump_line_info_table(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- return IBF_W(iseq->body->line_info_table, struct iseq_line_info_entry, iseq->body->line_info_size);
-}
-
-static struct iseq_line_info_entry *
-ibf_load_line_info_table(const struct ibf_load *load, const struct rb_iseq_constant_body *body)
-{
- return IBF_R(body->line_info_table, struct iseq_line_info_entry, body->line_info_size);
-}
-
-static ID *
-ibf_dump_local_table(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- const int size = iseq->body->local_size - 1;
- ID *table = ALLOCA_N(ID, size);
- int i;
-
- for (i=0; i<size; i++) {
- table[i] = ibf_dump_id(dump, iseq->body->local_table[i]);
- }
-
- return IBF_W(table, ID, size);
-}
-
-static ID *
-ibf_load_local_table(const struct ibf_load *load, const struct rb_iseq_constant_body *body)
-{
- const int size = body->local_size - 1;
-
- if (size > 0) {
- ID *table = IBF_R(body->local_table, ID, size);
- int i;
-
- for (i=0; i<size; i++) {
- table[i] = ibf_load_id(load, table[i]);
- }
- return table;
- }
- else {
- return NULL;
- }
-}
-
-static struct iseq_catch_table *
-ibf_dump_catch_table(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- const struct iseq_catch_table *table = iseq->body->catch_table;
-
- if (table) {
- int byte_size = iseq_catch_table_bytes(iseq->body->catch_table->size);
- struct iseq_catch_table *dump_table = (struct iseq_catch_table *)ALLOCA_N(char, byte_size);
- unsigned int i;
- dump_table->size = table->size;
- for (i=0; i<table->size; i++) {
- dump_table->entries[i] = table->entries[i];
- dump_table->entries[i].iseq = ibf_dump_iseq(dump, table->entries[i].iseq);
- }
- return (struct iseq_catch_table *)(VALUE)ibf_dump_write(dump, dump_table, byte_size);
- }
- else {
- return NULL;
- }
-}
-
-static struct iseq_catch_table *
-ibf_load_catch_table(const struct ibf_load *load, const struct rb_iseq_constant_body *body)
-{
- if (body->catch_table) {
- struct iseq_catch_table *table;
- unsigned int i;
- unsigned int size;
- size = *(unsigned int *)(load->buff + IBF_OFFSET(body->catch_table));
- table = ibf_load_alloc(load, IBF_OFFSET(body->catch_table), iseq_catch_table_bytes(size));
- for (i=0; i<size; i++) {
- table->entries[i].iseq = ibf_load_iseq(load, table->entries[i].iseq);
- }
- return table;
- }
- else {
- return NULL;
- }
-}
-
-static struct rb_call_info *
-ibf_dump_ci_entries(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- const unsigned int ci_size = iseq->body->ci_size;
- const unsigned int ci_kw_size = iseq->body->ci_kw_size;
- const struct rb_call_info *ci_entries = iseq->body->ci_entries;
- struct rb_call_info *dump_ci_entries;
- struct rb_call_info_with_kwarg *dump_ci_kw_entries;
- int byte_size = ci_size * sizeof(struct rb_call_info) +
- ci_kw_size * sizeof(struct rb_call_info_with_kwarg);
- unsigned int i;
-
- dump_ci_entries = (struct rb_call_info *)ALLOCA_N(char, byte_size);
- dump_ci_kw_entries = (struct rb_call_info_with_kwarg *)&dump_ci_entries[ci_size];
- memcpy(dump_ci_entries, ci_entries, byte_size);
-
- for (i=0; i<ci_size; i++) { /* conver ID for each ci */
- dump_ci_entries[i].mid = ibf_dump_id(dump, dump_ci_entries[i].mid);
- }
- for (i=0; i<ci_kw_size; i++) {
- const struct rb_call_info_kw_arg *kw_arg = dump_ci_kw_entries[i].kw_arg;
- int j;
- VALUE *keywords = ALLOCA_N(VALUE, kw_arg->keyword_len);
- for (j=0; j<kw_arg->keyword_len; j++) {
- keywords[j] = (VALUE)ibf_dump_object(dump, kw_arg->keywords[j]); /* kw_arg->keywords[n] is Symbol */
- }
- dump_ci_kw_entries[i].kw_arg = (struct rb_call_info_kw_arg *)(VALUE)ibf_dump_write(dump, &kw_arg->keyword_len, sizeof(int));
- ibf_dump_write(dump, keywords, sizeof(VALUE) * kw_arg->keyword_len);
-
- dump_ci_kw_entries[i].ci.mid = ibf_dump_id(dump, dump_ci_kw_entries[i].ci.mid);
- }
- return (struct rb_call_info *)(VALUE)ibf_dump_write(dump, dump_ci_entries, byte_size);
-}
-
-static struct rb_call_info *
-ibf_load_ci_entries(const struct ibf_load *load, const struct rb_iseq_constant_body *body)
-{
- unsigned int i;
- const unsigned int ci_size = body->ci_size;
- const unsigned int ci_kw_size = body->ci_kw_size;
- struct rb_call_info *ci_entries = ibf_load_alloc(load, IBF_OFFSET(body->ci_entries),
- sizeof(struct rb_call_info) * body->ci_size +
- sizeof(struct rb_call_info_with_kwarg) * body->ci_kw_size);
- struct rb_call_info_with_kwarg *ci_kw_entries = (struct rb_call_info_with_kwarg *)&ci_entries[ci_size];
-
- for (i=0; i<ci_size; i++) {
- ci_entries[i].mid = ibf_load_id(load, ci_entries[i].mid);
- }
- for (i=0; i<ci_kw_size; i++) {
- int j;
- ibf_offset_t kw_arg_offset = IBF_OFFSET(ci_kw_entries[i].kw_arg);
- const int keyword_len = *(int *)(load->buff + kw_arg_offset);
- const VALUE *keywords = (VALUE *)(load->buff + kw_arg_offset + sizeof(int));
- struct rb_call_info_kw_arg *kw_arg = ruby_xmalloc(sizeof(struct rb_call_info_kw_arg) + sizeof(VALUE) * (keyword_len - 1));
- kw_arg->keyword_len = keyword_len;
- for (j=0; j<kw_arg->keyword_len; j++) {
- kw_arg->keywords[j] = (VALUE)ibf_load_object(load, keywords[j]);
- }
- ci_kw_entries[i].kw_arg = kw_arg;
- ci_kw_entries[i].ci.mid = ibf_load_id(load, ci_kw_entries[i].ci.mid);
- }
-
- return ci_entries;
-}
-
-static ibf_offset_t
-ibf_dump_iseq_each(struct ibf_dump *dump, const rb_iseq_t *iseq)
-{
- struct rb_iseq_constant_body dump_body;
- dump_body = *iseq->body;
-
- dump_body.location.path = ibf_dump_object(dump, dump_body.location.path);
- dump_body.location.absolute_path = ibf_dump_object(dump, dump_body.location.absolute_path);
- dump_body.location.base_label = ibf_dump_object(dump, dump_body.location.base_label);
- dump_body.location.label = ibf_dump_object(dump, dump_body.location.label);
-
- dump_body.iseq_encoded = ibf_dump_code(dump, iseq);
- dump_body.param.opt_table = ibf_dump_param_opt_table(dump, iseq);
- dump_body.param.keyword = ibf_dump_param_keyword(dump, iseq);
- dump_body.line_info_table = ibf_dump_line_info_table(dump, iseq);
- dump_body.local_table = ibf_dump_local_table(dump, iseq);
- dump_body.catch_table = ibf_dump_catch_table(dump, iseq);
- dump_body.parent_iseq = ibf_dump_iseq(dump, iseq->body->parent_iseq);
- dump_body.local_iseq = ibf_dump_iseq(dump, iseq->body->local_iseq);
- dump_body.is_entries = NULL;
- dump_body.ci_entries = ibf_dump_ci_entries(dump, iseq);
- dump_body.cc_entries = NULL;
- dump_body.mark_ary = ISEQ_FLIP_CNT(iseq);
-
- return ibf_dump_write(dump, &dump_body, sizeof(dump_body));
-}
-
-static VALUE
-ibf_load_location_str(const struct ibf_load *load, VALUE str_index)
-{
- VALUE str = ibf_load_object(load, str_index);
- if (str != Qnil) {
- str = rb_fstring(str);
- }
- return str;
-}
-
-static void
-ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t offset)
-{
- struct rb_iseq_constant_body *load_body = iseq->body = ZALLOC(struct rb_iseq_constant_body);
- const struct rb_iseq_constant_body *body = (struct rb_iseq_constant_body *)(load->buff + offset);
-
- /* memcpy(load_body, load->buff + offset, sizeof(*load_body)); */
- load_body->type = body->type;
- load_body->stack_max = body->stack_max;
- load_body->local_size = body->local_size;
- load_body->iseq_size = body->iseq_size;
- load_body->param = body->param;
- load_body->local_table_size = body->local_table_size;
- load_body->is_size = body->is_size;
- load_body->ci_size = body->ci_size;
- load_body->ci_kw_size = body->ci_kw_size;
- load_body->line_info_size = body->line_info_size;
-
- RB_OBJ_WRITE(iseq, &load_body->mark_ary, iseq_mark_ary_create((int)body->mark_ary));
-
- RB_OBJ_WRITE(iseq, &load_body->location.path, ibf_load_location_str(load, body->location.path));
- RB_OBJ_WRITE(iseq, &load_body->location.absolute_path, ibf_load_location_str(load, body->location.absolute_path));
- RB_OBJ_WRITE(iseq, &load_body->location.base_label, ibf_load_location_str(load, body->location.base_label));
- RB_OBJ_WRITE(iseq, &load_body->location.label, ibf_load_location_str(load, body->location.label));
- load_body->location.first_lineno = body->location.first_lineno;
-
- load_body->is_entries = ZALLOC_N(union iseq_inline_storage_entry, body->is_size);
- load_body->ci_entries = ibf_load_ci_entries(load, body);
- load_body->cc_entries = ZALLOC_N(struct rb_call_cache, body->ci_size + body->ci_kw_size);
- load_body->param.opt_table = ibf_load_param_opt_table(load, body);
- load_body->param.keyword = ibf_load_param_keyword(load, body);
- load_body->line_info_table = ibf_load_line_info_table(load, body);
- load_body->local_table = ibf_load_local_table(load, body);
- load_body->catch_table = ibf_load_catch_table(load, body);
- load_body->parent_iseq = ibf_load_iseq(load, body->parent_iseq);
- load_body->local_iseq = ibf_load_iseq(load, body->local_iseq);
-
- load_body->iseq_encoded = ibf_load_code(load, iseq, body);
-
- rb_iseq_translate_threaded_code(iseq);
-}
-
-
-static void
-ibf_dump_iseq_list(struct ibf_dump *dump, struct ibf_header *header)
-{
- const long size = RARRAY_LEN(dump->iseq_list);
- ibf_offset_t *list = ALLOCA_N(ibf_offset_t, size);
- long i;
-
- for (i=0; i<size; i++) {
- list[i] = (ibf_offset_t)NUM2LONG(rb_ary_entry(dump->iseq_list, i));
- }
-
- header->iseq_list_offset = ibf_dump_write(dump, list, sizeof(ibf_offset_t) * size);
- header->iseq_list_size = (unsigned int)size;
-}
-
-struct ibf_dump_id_list_i_arg {
- struct ibf_dump *dump;
- long *list;
- int current_i;
-};
-
-static int
-ibf_dump_id_list_i(st_data_t key, st_data_t val, st_data_t ptr)
-{
- struct ibf_dump_id_list_i_arg *arg = (struct ibf_dump_id_list_i_arg *)ptr;
- int i = (int)val;
- ID id = (ID)key;
- assert(arg->current_i == i);
- arg->current_i++;
-
- if (rb_id2name(id)) {
- arg->list[i] = (long)ibf_dump_object(arg->dump, rb_id2str(id));
- }
- else {
- arg->list[i] = 0;
- }
-
- return ST_CONTINUE;
-}
-
-static void
-ibf_dump_id_list(struct ibf_dump *dump, struct ibf_header *header)
-{
- const long size = dump->id_table->num_entries;
- struct ibf_dump_id_list_i_arg arg;
- arg.list = ALLOCA_N(long, size);
- arg.dump = dump;
- arg.current_i = 0;
-
- st_foreach(dump->id_table, ibf_dump_id_list_i, (st_data_t)&arg);
-
- header->id_list_offset = ibf_dump_write(dump, arg.list, sizeof(long) * size);
- header->id_list_size = (unsigned int)size;
-}
-
-#define IBF_OBJECT_INTERNAL FL_PROMOTED0
-
-/*
- * Binary format
- * - ibf_object_header
- * - ibf_object_xxx (xxx is type)
- */
-
-struct ibf_object_header {
- unsigned int type: 5;
- unsigned int special_const: 1;
- unsigned int frozen: 1;
- unsigned int internal: 1;
-};
-
-enum ibf_object_class_index {
- IBF_OBJECT_CLASS_OBJECT,
- IBF_OBJECT_CLASS_ARRAY,
- IBF_OBJECT_CLASS_STANDARD_ERROR
-};
-
-struct ibf_object_string {
- long encindex;
- long len;
- char ptr[1];
-};
-
-struct ibf_object_regexp {
- long srcstr;
- char option;
-};
-
-struct ibf_object_array {
- long len;
- long ary[1];
-};
-
-struct ibf_object_hash {
- long len;
- long keyval[1];
-};
-
-struct ibf_object_struct_range {
- long class_index;
- long len;
- long beg;
- long end;
- int excl;
-};
-
-struct ibf_object_bignum {
- ssize_t slen;
- BDIGIT digits[1];
-};
-
-enum ibf_object_data_type {
- IBF_OBJECT_DATA_ENCODING
-};
-
-struct ibf_object_complex_rational {
- long a, b;
-};
-
-struct ibf_object_symbol {
- long str;
-};
-
-#define IBF_OBJHEADER(offset) (struct ibf_object_header *)(load->buff + (offset))
-#define IBF_OBJBODY(type, offset) (type *)(load->buff + sizeof(struct ibf_object_header) + (offset))
-
-static void
-ibf_dump_object_unsupported(struct ibf_dump *dump, VALUE obj)
-{
- rb_obj_info_dump(obj);
- rb_bug("ibf_dump_object_unsupported: unsupported");
-}
-
-static VALUE
-ibf_load_object_unsupported(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- rb_bug("unsupported");
- return Qnil;
-}
-
-static void
-ibf_dump_object_class(struct ibf_dump *dump, VALUE obj)
-{
- enum ibf_object_class_index cindex;
- if (obj == rb_cObject) {
- cindex = IBF_OBJECT_CLASS_OBJECT;
- }
- else if (obj == rb_cArray) {
- cindex = IBF_OBJECT_CLASS_ARRAY;
- }
- else if (obj == rb_eStandardError) {
- cindex = IBF_OBJECT_CLASS_STANDARD_ERROR;
- }
- else {
- rb_obj_info_dump(obj);
- rb_p(obj);
- rb_bug("unsupported class");
- }
- ibf_dump_write(dump, &cindex, sizeof(cindex));
-}
-
-static VALUE
-ibf_load_object_class(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- enum ibf_object_class_index *cindexp = IBF_OBJBODY(enum ibf_object_class_index, offset);
- enum ibf_object_class_index cindex = *cindexp;
-
- switch (cindex) {
- case IBF_OBJECT_CLASS_OBJECT:
- return rb_cObject;
- case IBF_OBJECT_CLASS_ARRAY:
- return rb_cArray;
- case IBF_OBJECT_CLASS_STANDARD_ERROR:
- return rb_eStandardError;
- }
-
- rb_bug("ibf_load_object_class: unknown class (%d)", (int)cindex);
-}
-
-
-static void
-ibf_dump_object_float(struct ibf_dump *dump, VALUE obj)
-{
- double dbl = RFLOAT_VALUE(obj);
- ibf_dump_write(dump, &dbl, sizeof(dbl));
-}
-
-static VALUE
-ibf_load_object_float(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- double *dblp = IBF_OBJBODY(double, offset);
- return DBL2NUM(*dblp);
-}
-
-static void
-ibf_dump_object_string(struct ibf_dump *dump, VALUE obj)
-{
- long encindex = (long)rb_enc_get_index(obj);
- long len = RSTRING_LEN(obj);
- const char *ptr = RSTRING_PTR(obj);
-
- if (encindex > RUBY_ENCINDEX_BUILTIN_MAX) {
- rb_encoding *enc = rb_enc_from_index((int)encindex);
- const char *enc_name = rb_enc_name(enc);
- encindex = RUBY_ENCINDEX_BUILTIN_MAX + ibf_dump_object(dump, rb_str_new2(enc_name));
- }
-
- IBF_WV(encindex);
- IBF_WV(len);
- IBF_WP(ptr, char, len);
-}
-
-static VALUE
-ibf_load_object_string(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_string *string = IBF_OBJBODY(struct ibf_object_string, offset);
- VALUE str = rb_str_new(string->ptr, string->len);
- int encindex = (int)string->encindex;
-
- if (encindex > RUBY_ENCINDEX_BUILTIN_MAX) {
- VALUE enc_name_str = ibf_load_object(load, encindex - RUBY_ENCINDEX_BUILTIN_MAX);
- encindex = rb_enc_find_index(RSTRING_PTR(enc_name_str));
- }
- rb_enc_associate_index(str, encindex);
-
- if (header->internal) rb_obj_hide(str);
- if (header->frozen) str = rb_fstring(str);
-
- return str;
-}
-
-static void
-ibf_dump_object_regexp(struct ibf_dump *dump, VALUE obj)
-{
- struct ibf_object_regexp regexp;
- regexp.srcstr = RREGEXP_SRC(obj);
- regexp.option = (char)rb_reg_options(obj);
- regexp.srcstr = (long)ibf_dump_object(dump, regexp.srcstr);
- IBF_WV(regexp);
-}
-
-static VALUE
-ibf_load_object_regexp(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_regexp *regexp = IBF_OBJBODY(struct ibf_object_regexp, offset);
- VALUE srcstr = ibf_load_object(load, regexp->srcstr);
- VALUE reg = rb_reg_compile(srcstr, (int)regexp->option, NULL, 0);
-
- if (header->internal) rb_obj_hide(reg);
- if (header->frozen) rb_obj_freeze(reg);
-
- return reg;
-}
-
-static void
-ibf_dump_object_array(struct ibf_dump *dump, VALUE obj)
-{
- long i, len = (int)RARRAY_LEN(obj);
- IBF_WV(len);
- for (i=0; i<len; i++) {
- long index = (long)ibf_dump_object(dump, RARRAY_AREF(obj, i));
- IBF_WV(index);
- }
-}
-
-static VALUE
-ibf_load_object_array(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_array *array = IBF_OBJBODY(struct ibf_object_array, offset);
- VALUE ary = rb_ary_new_capa(array->len);
- int i;
-
- for (i=0; i<array->len; i++) {
- rb_ary_push(ary, ibf_load_object(load, array->ary[i]));
- }
-
- if (header->internal) rb_obj_hide(ary);
- if (header->frozen) rb_obj_freeze(ary);
-
- return ary;
-}
-
-static int
-ibf_dump_object_hash_i(st_data_t key, st_data_t val, st_data_t ptr)
-{
- struct ibf_dump *dump = (struct ibf_dump *)ptr;
- long key_index = (long)ibf_dump_object(dump, (VALUE)key);
- long val_index = (long)ibf_dump_object(dump, (VALUE)val);
- IBF_WV(key_index);
- IBF_WV(val_index);
- return ST_CONTINUE;
-}
-
-static void
-ibf_dump_object_hash(struct ibf_dump *dump, VALUE obj)
-{
- long len = RHASH_SIZE(obj);
- IBF_WV(len);
- if (len > 0) st_foreach(RHASH(obj)->ntbl, ibf_dump_object_hash_i, (st_data_t)dump);
-}
-
-static VALUE
-ibf_load_object_hash(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_hash *hash = IBF_OBJBODY(struct ibf_object_hash, offset);
- VALUE obj = rb_hash_new();
- int i;
-
- for (i=0; i<hash->len; i++) {
- VALUE key = ibf_load_object(load, hash->keyval[i*2 ]);
- VALUE val = ibf_load_object(load, hash->keyval[i*2+1]);
- rb_hash_aset(obj, key, val);
- }
- rb_hash_rehash(obj);
-
- if (header->internal) rb_obj_hide(obj);
- if (header->frozen) rb_obj_freeze(obj);
-
- return obj;
-}
-
-static void
-ibf_dump_object_struct(struct ibf_dump *dump, VALUE obj)
-{
- if (rb_obj_is_kind_of(obj, rb_cRange)) {
- struct ibf_object_struct_range range;
- VALUE beg, end;
- range.len = 3;
- range.class_index = 0;
-
- rb_range_values(obj, &beg, &end, &range.excl);
- range.beg = (long)ibf_dump_object(dump, beg);
- range.end = (long)ibf_dump_object(dump, end);
-
- IBF_WV(range);
- }
- else {
- rb_bug("ibf_dump_object_struct: unsupported class");
- }
-}
-
-static VALUE
-ibf_load_object_struct(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_struct_range *range = IBF_OBJBODY(struct ibf_object_struct_range, offset);
- VALUE beg = ibf_load_object(load, range->beg);
- VALUE end = ibf_load_object(load, range->end);
- VALUE obj = rb_range_new(beg, end, range->excl);
- if (header->internal) rb_obj_hide(obj);
- if (header->frozen) rb_obj_freeze(obj);
- return obj;
-}
-
-static void
-ibf_dump_object_bignum(struct ibf_dump *dump, VALUE obj)
-{
- ssize_t len = BIGNUM_LEN(obj);
- ssize_t slen = BIGNUM_SIGN(obj) > 0 ? len : len * -1;
- BDIGIT *d = BIGNUM_DIGITS(obj);
-
- IBF_WV(slen);
- IBF_WP(d, BDIGIT, len);
-}
-
-static VALUE
-ibf_load_object_bignum(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_bignum *bignum = IBF_OBJBODY(struct ibf_object_bignum, offset);
- int sign = bignum->slen > 0;
- ssize_t len = sign > 0 ? bignum->slen : -1 * bignum->slen;
- VALUE obj = rb_integer_unpack(bignum->digits, len * 2, 2, 0,
- INTEGER_PACK_LITTLE_ENDIAN | (sign == 0 ? INTEGER_PACK_NEGATIVE : 0));
- if (header->internal) rb_obj_hide(obj);
- if (header->frozen) rb_obj_freeze(obj);
- return obj;
-}
-
-static void
-ibf_dump_object_data(struct ibf_dump *dump, VALUE obj)
-{
- if (rb_data_is_encoding(obj)) {
- rb_encoding *enc = rb_to_encoding(obj);
- const char *name = rb_enc_name(enc);
- enum ibf_object_data_type type = IBF_OBJECT_DATA_ENCODING;
- long len = strlen(name) + 1;
- IBF_WV(type);
- IBF_WV(len);
- IBF_WP(name, char, strlen(name) + 1);
- }
- else {
- ibf_dump_object_unsupported(dump, obj);
- }
-}
-
-static VALUE
-ibf_load_object_data(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const enum ibf_object_data_type *typep = IBF_OBJBODY(enum ibf_object_data_type, offset);
- /* const long *lenp = IBF_OBJBODY(long, offset + sizeof(enum ibf_object_data_type)); */
- const char *data = IBF_OBJBODY(char, offset + sizeof(enum ibf_object_data_type) + sizeof(long));
-
- switch (*typep) {
- case IBF_OBJECT_DATA_ENCODING:
- {
- VALUE encobj = rb_enc_from_encoding(rb_enc_find(data));
- return encobj;
- }
- }
-
- return ibf_load_object_unsupported(load, header, offset);
-}
-
-static void
-ibf_dump_object_complex_rational(struct ibf_dump *dump, VALUE obj)
-{
- long real = (long)ibf_dump_object(dump, RCOMPLEX(obj)->real);
- long imag = (long)ibf_dump_object(dump, RCOMPLEX(obj)->imag);
-
- IBF_WV(real);
- IBF_WV(imag);
-}
-
-static VALUE
-ibf_load_object_complex_rational(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- const struct ibf_object_complex_rational *nums = IBF_OBJBODY(struct ibf_object_complex_rational, offset);
- VALUE a = ibf_load_object(load, nums->a);
- VALUE b = ibf_load_object(load, nums->b);
- VALUE obj = header->type == T_COMPLEX ?
- rb_complex_new(a, b) : rb_rational_new(a, b);
-
- if (header->internal) rb_obj_hide(obj);
- if (header->frozen) rb_obj_freeze(obj);
- return obj;
-}
-
-static void
-ibf_dump_object_symbol(struct ibf_dump *dump, VALUE obj)
-{
- VALUE str = rb_sym2str(obj);
- long str_index = (long)ibf_dump_object(dump, str);
- IBF_WV(str_index);
-}
-
-static VALUE
-ibf_load_object_symbol(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
-{
- /* const struct ibf_object_header *header = IBF_OBJHEADER(offset); */
- const struct ibf_object_symbol *symbol = IBF_OBJBODY(struct ibf_object_symbol, offset);
- VALUE str = ibf_load_object(load, symbol->str);
- ID id = rb_intern_str(str);
- return ID2SYM(id);
-}
-
-typedef void (*ibf_dump_object_function)(struct ibf_dump *dump, VALUE obj);
-static ibf_dump_object_function dump_object_functions[RUBY_T_MASK+1] = {
- ibf_dump_object_unsupported, /* T_NONE */
- ibf_dump_object_unsupported, /* T_OBJECT */
- ibf_dump_object_class, /* T_CLASS */
- ibf_dump_object_unsupported, /* T_MODULE */
- ibf_dump_object_float, /* T_FLOAT */
- ibf_dump_object_string, /* T_STRING */
- ibf_dump_object_regexp, /* T_REGEXP */
- ibf_dump_object_array, /* T_ARRAY */
- ibf_dump_object_hash, /* T_HASH */
- ibf_dump_object_struct, /* T_STRUCT */
- ibf_dump_object_bignum, /* T_BIGNUM */
- ibf_dump_object_unsupported, /* T_FILE */
- ibf_dump_object_data, /* T_DATA */
- ibf_dump_object_unsupported, /* T_MATCH */
- ibf_dump_object_complex_rational, /* T_COMPLEX */
- ibf_dump_object_complex_rational, /* T_RATIONAL */
- ibf_dump_object_unsupported, /* 0x10 */
- ibf_dump_object_unsupported, /* 0x11 T_NIL */
- ibf_dump_object_unsupported, /* 0x12 T_TRUE */
- ibf_dump_object_unsupported, /* 0x13 T_FALSE */
- ibf_dump_object_symbol, /* 0x14 T_SYMBOL */
- ibf_dump_object_unsupported, /* T_FIXNUM */
- ibf_dump_object_unsupported, /* T_UNDEF */
- ibf_dump_object_unsupported, /* 0x17 */
- ibf_dump_object_unsupported, /* 0x18 */
- ibf_dump_object_unsupported, /* 0x19 */
- ibf_dump_object_unsupported, /* T_IMEMO 0x1a */
- ibf_dump_object_unsupported, /* T_NODE 0x1b */
- ibf_dump_object_unsupported, /* T_ICLASS 0x1c */
- ibf_dump_object_unsupported, /* T_ZOMBIE 0x1d */
- ibf_dump_object_unsupported, /* 0x1e */
- ibf_dump_object_unsupported /* 0x1f */
-};
-
-static ibf_offset_t
-lbf_dump_object_object(struct ibf_dump *dump, VALUE obj)
-{
- struct ibf_object_header obj_header;
- ibf_offset_t current_offset = ibf_dump_pos(dump);
- obj_header.type = TYPE(obj);
-
- if (SPECIAL_CONST_P(obj)) {
- if (RB_TYPE_P(obj, T_SYMBOL) ||
- RB_TYPE_P(obj, T_FLOAT)) {
- obj_header.internal = FALSE;
- goto dump_object;
- }
- obj_header.special_const = TRUE;
- obj_header.frozen = TRUE;
- obj_header.internal = TRUE;
- IBF_WV(obj_header);
- IBF_WV(obj);
- }
- else {
- obj_header.internal = (RBASIC_CLASS(obj) == 0) ? TRUE : FALSE;
- dump_object:
- obj_header.special_const = FALSE;
- obj_header.frozen = FL_TEST(obj, FL_FREEZE) ? TRUE : FALSE;
- IBF_WV(obj_header);
- (*dump_object_functions[obj_header.type])(dump, obj);
- }
-
- return current_offset;
-}
-
-typedef VALUE (*ibf_load_object_function)(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t);
-static ibf_load_object_function load_object_functions[RUBY_T_MASK+1] = {
- ibf_load_object_unsupported, /* T_NONE */
- ibf_load_object_unsupported, /* T_OBJECT */
- ibf_load_object_class, /* T_CLASS */
- ibf_load_object_unsupported, /* T_MODULE */
- ibf_load_object_float, /* T_FLOAT */
- ibf_load_object_string, /* T_STRING */
- ibf_load_object_regexp, /* T_REGEXP */
- ibf_load_object_array, /* T_ARRAY */
- ibf_load_object_hash, /* T_HASH */
- ibf_load_object_struct, /* T_STRUCT */
- ibf_load_object_bignum, /* T_BIGNUM */
- ibf_load_object_unsupported, /* T_FILE */
- ibf_load_object_data, /* T_DATA */
- ibf_load_object_unsupported, /* T_MATCH */
- ibf_load_object_complex_rational, /* T_COMPLEX */
- ibf_load_object_complex_rational, /* T_RATIONAL */
- ibf_load_object_unsupported, /* 0x10 */
- ibf_load_object_unsupported, /* T_NIL */
- ibf_load_object_unsupported, /* T_TRUE */
- ibf_load_object_unsupported, /* T_FALSE */
- ibf_load_object_symbol,
- ibf_load_object_unsupported, /* T_FIXNUM */
- ibf_load_object_unsupported, /* T_UNDEF */
- ibf_load_object_unsupported, /* 0x17 */
- ibf_load_object_unsupported, /* 0x18 */
- ibf_load_object_unsupported, /* 0x19 */
- ibf_load_object_unsupported, /* T_IMEMO 0x1a */
- ibf_load_object_unsupported, /* T_NODE 0x1b */
- ibf_load_object_unsupported, /* T_ICLASS 0x1c */
- ibf_load_object_unsupported, /* T_ZOMBIE 0x1d */
- ibf_load_object_unsupported, /* 0x1e */
- ibf_load_object_unsupported /* 0x1f */
-};
-
-static VALUE
-ibf_load_object(const struct ibf_load *load, VALUE object_index)
-{
- if (object_index == 0) {
- return Qnil;
- }
- else if (object_index >= load->header->object_list_size) {
- rb_raise(rb_eIndexError, "object index out of range: %"PRIdVALUE, object_index);
- }
- else {
- VALUE obj = rb_ary_entry(load->obj_list, (long)object_index);
- if (obj == Qnil) { /* TODO: avoid multiple Qnil load */
- ibf_offset_t *offsets = (ibf_offset_t *)(load->header->object_list_offset + load->buff);
- ibf_offset_t offset = offsets[object_index];
- const struct ibf_object_header *header = IBF_OBJHEADER(offset);
-
- if (header->special_const) {
- VALUE *vp = IBF_OBJBODY(VALUE, offset);
- obj = *vp;
- }
- else {
- obj = (*load_object_functions[header->type])(load, header, offset);
- }
-
- rb_ary_store(load->obj_list, (long)object_index, obj);
- }
- iseq_add_mark_object(load->iseq, obj);
- return obj;
- }
-}
-
-static void
-ibf_dump_object_list(struct ibf_dump *dump, struct ibf_header *header)
-{
- VALUE list = rb_ary_tmp_new(RARRAY_LEN(dump->obj_list));
- int i, size;
-
- for (i=0; i<RARRAY_LEN(dump->obj_list); i++) {
- VALUE obj = RARRAY_AREF(dump->obj_list, i);
- ibf_offset_t offset = lbf_dump_object_object(dump, obj);
- rb_ary_push(list, UINT2NUM(offset));
- }
- size = i;
- header->object_list_offset = ibf_dump_pos(dump);
-
- for (i=0; i<size; i++) {
- ibf_offset_t offset = NUM2UINT(RARRAY_AREF(list, i));
- IBF_WV(offset);
- }
-
- header->object_list_size = size;
-}
-
-static void
-ibf_dump_mark(void *ptr)
-{
- struct ibf_dump *dump = (struct ibf_dump *)ptr;
- rb_gc_mark(dump->str);
- rb_gc_mark(dump->iseq_list);
- rb_gc_mark(dump->obj_list);
-}
-
-static void
-ibf_dump_free(void *ptr)
-{
- struct ibf_dump *dump = (struct ibf_dump *)ptr;
- if (dump->iseq_table) {
- st_free_table(dump->iseq_table);
- dump->iseq_table = 0;
- }
- if (dump->id_table) {
- st_free_table(dump->id_table);
- dump->id_table = 0;
- }
- ruby_xfree(dump);
-}
-
-static size_t
-ibf_dump_memsize(const void *ptr)
-{
- struct ibf_dump *dump = (struct ibf_dump *)ptr;
- size_t size = sizeof(*dump);
- if (dump->iseq_table) size += st_memsize(dump->iseq_table);
- if (dump->id_table) size += st_memsize(dump->id_table);
- return size;
-}
-
-static const rb_data_type_t ibf_dump_type = {
- "ibf_dump",
- {ibf_dump_mark, ibf_dump_free, ibf_dump_memsize,},
- 0, 0, RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static void
-ibf_dump_setup(struct ibf_dump *dump, VALUE dumper_obj)
-{
- RB_OBJ_WRITE(dumper_obj, &dump->str, rb_str_new(0, 0));
- RB_OBJ_WRITE(dumper_obj, &dump->iseq_list, rb_ary_tmp_new(0));
- RB_OBJ_WRITE(dumper_obj, &dump->obj_list, rb_ary_tmp_new(1));
- rb_ary_push(dump->obj_list, Qnil); /* 0th is nil */
- dump->iseq_table = st_init_numtable(); /* need free */
- dump->id_table = st_init_numtable(); /* need free */
-
- ibf_table_index(dump->id_table, 0); /* id_index:0 is 0 */
-}
-
-VALUE
-iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt)
-{
- struct ibf_dump *dump;
- struct ibf_header header = {{0}};
- VALUE dump_obj;
- VALUE str;
-
- if (iseq->body->parent_iseq != NULL ||
- iseq->body->local_iseq != iseq) {
- rb_raise(rb_eRuntimeError, "should be top of iseq");
- }
- if (RTEST(ISEQ_COVERAGE(iseq))) {
- rb_raise(rb_eRuntimeError, "should not compile with coverage");
- }
-
- dump_obj = TypedData_Make_Struct(0, struct ibf_dump, &ibf_dump_type, dump);
- ibf_dump_setup(dump, dump_obj);
-
- ibf_dump_write(dump, &header, sizeof(header));
- ibf_dump_write(dump, RUBY_PLATFORM, strlen(RUBY_PLATFORM) + 1);
- ibf_dump_iseq(dump, iseq);
-
- header.magic[0] = 'Y'; /* YARB */
- header.magic[1] = 'A';
- header.magic[2] = 'R';
- header.magic[3] = 'B';
- header.major_version = ISEQ_MAJOR_VERSION;
- header.minor_version = ISEQ_MINOR_VERSION;
- ibf_dump_iseq_list(dump, &header);
- ibf_dump_id_list(dump, &header);
- ibf_dump_object_list(dump, &header);
- header.size = ibf_dump_pos(dump);
-
- if (RTEST(opt)) {
- VALUE opt_str = opt;
- const char *ptr = StringValuePtr(opt_str);
- header.extra_size = RSTRING_LENINT(opt_str);
- ibf_dump_write(dump, ptr, header.extra_size);
- }
- else {
- header.extra_size = 0;
- }
-
- ibf_dump_overwrite(dump, &header, sizeof(header), 0);
-
- str = dump->str;
- ibf_dump_free(dump);
- DATA_PTR(dump_obj) = NULL;
- RB_GC_GUARD(dump_obj);
- return str;
-}
-
-static const ibf_offset_t *
-ibf_iseq_list(const struct ibf_load *load)
-{
- return (ibf_offset_t *)(load->buff + load->header->iseq_list_offset);
-}
-
-void
-ibf_load_iseq_complete(rb_iseq_t *iseq)
-{
- struct ibf_load *load = RTYPEDDATA_DATA(iseq->aux.loader.obj);
- rb_iseq_t *prev_src_iseq = load->iseq;
- load->iseq = iseq;
- ibf_load_iseq_each(load, iseq, ibf_iseq_list(load)[iseq->aux.loader.index]);
- ISEQ_COMPILE_DATA(iseq) = NULL;
- FL_UNSET(iseq, ISEQ_NOT_LOADED_YET);
- load->iseq = prev_src_iseq;
-}
-
-#if USE_LAZY_LOAD
-const rb_iseq_t *
-rb_iseq_complete(const rb_iseq_t *iseq)
-{
- ibf_load_iseq_complete((rb_iseq_t *)iseq);
- return iseq;
-}
-#endif
-
-static rb_iseq_t *
-ibf_load_iseq(const struct ibf_load *load, const rb_iseq_t *index_iseq)
-{
- int iseq_index = (int)(VALUE)index_iseq;
-
- if (iseq_index == -1) {
- return NULL;
- }
- else {
- VALUE iseqv = rb_ary_entry(load->iseq_list, iseq_index);
-
- if (iseqv != Qnil) {
- return (rb_iseq_t *)iseqv;
- }
- else {
- rb_iseq_t *iseq = iseq_imemo_alloc();
- FL_SET(iseq, ISEQ_NOT_LOADED_YET);
- iseq->aux.loader.obj = load->loader_obj;
- iseq->aux.loader.index = iseq_index;
- rb_ary_store(load->iseq_list, iseq_index, (VALUE)iseq);
-
-#if !USE_LAZY_LOAD
- ibf_load_iseq_complete(iseq);
-#endif /* !USE_LAZY_LOAD */
-
- if (load->iseq) {
- iseq_add_mark_object(load->iseq, (VALUE)iseq);
- }
- return iseq;
- }
- }
-}
-
-static void
-ibf_load_setup(struct ibf_load *load, VALUE loader_obj, VALUE str)
-{
- rb_check_safe_obj(str);
-
- if (RSTRING_LENINT(str) < (int)sizeof(struct ibf_header)) {
- rb_raise(rb_eRuntimeError, "broken binary format");
- }
- RB_OBJ_WRITE(loader_obj, &load->str, str);
- load->loader_obj = loader_obj;
- load->buff = StringValuePtr(str);
- load->header = (struct ibf_header *)load->buff;
- RB_OBJ_WRITE(loader_obj, &load->iseq_list, rb_ary_tmp_new(0));
- RB_OBJ_WRITE(loader_obj, &load->obj_list, rb_ary_tmp_new(0));
- load->id_list = ZALLOC_N(ID, load->header->id_list_size);
- load->iseq = NULL;
-
- if (RSTRING_LENINT(str) < (int)load->header->size) {
- rb_raise(rb_eRuntimeError, "broken binary format");
- }
- if (strncmp(load->header->magic, "YARB", 4) != 0) {
- rb_raise(rb_eRuntimeError, "unknown binary format");
- }
- if (load->header->major_version != ISEQ_MAJOR_VERSION ||
- load->header->minor_version != ISEQ_MINOR_VERSION) {
- rb_raise(rb_eRuntimeError, "unmatched version file (%u.%u for %u.%u)",
- load->header->major_version, load->header->minor_version, ISEQ_MAJOR_VERSION, ISEQ_MINOR_VERSION);
- }
- if (strcmp(load->buff + sizeof(struct ibf_header), RUBY_PLATFORM) != 0) {
- rb_raise(rb_eRuntimeError, "unmatched platform");
- }
-}
-
-static void
-ibf_loader_mark(void *ptr)
-{
- if (ptr) {
- struct ibf_load *load = (struct ibf_load *)ptr;
- rb_gc_mark(load->str);
- rb_gc_mark(load->iseq_list);
- rb_gc_mark(load->obj_list);
- }
-}
-
-static void
-ibf_loader_free(void *ptr)
-{
- if (ptr) {
- struct ibf_load *load = (struct ibf_load *)ptr;
- ruby_xfree(load->id_list);
- ruby_xfree(load);
- }
-}
-
-static size_t
-ibf_loader_memsize(const void *ptr)
-{
- struct ibf_load *load = (struct ibf_load *)ptr;
- return sizeof(struct ibf_load) + load->header->id_list_size * sizeof(ID);
-}
-
-static const rb_data_type_t ibf_load_type = {
- "ibf_loader",
- {ibf_loader_mark, ibf_loader_free, ibf_loader_memsize,},
- 0, 0, RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-const rb_iseq_t *
-iseq_ibf_load(VALUE str)
-{
- struct ibf_load *load;
- const rb_iseq_t *iseq;
- VALUE loader_obj = TypedData_Make_Struct(0, struct ibf_load, &ibf_load_type, load);
-
- ibf_load_setup(load, loader_obj, str);
- iseq = ibf_load_iseq(load, 0);
-
- RB_GC_GUARD(loader_obj);
- return iseq;
-}
-
-VALUE
-iseq_ibf_load_extra_data(VALUE str)
-{
- struct ibf_load *load;
- VALUE loader_obj = TypedData_Make_Struct(0, struct ibf_load, &ibf_load_type, load);
- VALUE extra_str;
-
- ibf_load_setup(load, loader_obj, str);
- extra_str = rb_str_new(load->buff + load->header->size, load->header->extra_size);
- RB_GC_GUARD(loader_obj);
- return extra_str;
-}
-
diff --git a/complex.c b/complex.c
index 5199dcc7c2..3e9d63117a 100644
--- a/complex.c
+++ b/complex.c
@@ -5,13 +5,9 @@
which is written in ruby.
*/
-#include "ruby/config.h"
-#if defined _MSC_VER
-/* Microsoft Visual C does not define M_PI and others by default */
-# define _USE_MATH_DEFINES 1
-#endif
-#include <math.h>
+#include "ruby.h"
#include "internal.h"
+#include <math.h>
#define NDEBUG
#include <assert.h>
@@ -19,21 +15,13 @@
#define ZERO INT2FIX(0)
#define ONE INT2FIX(1)
#define TWO INT2FIX(2)
-#define RFLOAT_0 DBL2NUM(0)
-#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun) && \
- !defined(signbit)
-extern int signbit(double);
-#endif
VALUE rb_cComplex;
-static VALUE nucomp_abs(VALUE self);
-static VALUE nucomp_arg(VALUE self);
-
-static ID id_abs, id_arg, id_convert,
- id_denominator, id_eqeq_p, id_expt, id_fdiv,
- id_negate, id_numerator, id_quo,
- id_real_p, id_to_f, id_to_i, id_to_r,
+static ID id_abs, id_abs2, id_arg, id_cmp, id_conj, id_convert,
+ id_denominator, id_divmod, id_eqeq_p, id_expt, id_fdiv, id_floor,
+ id_idiv, id_imag, id_inspect, id_negate, id_numerator, id_quo,
+ id_real, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s,
id_i_real, id_i_imag;
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
@@ -88,6 +76,20 @@ f_add(VALUE x, VALUE y)
}
inline static VALUE
+f_cmp(VALUE x, VALUE y)
+{
+ if (FIXNUM_P(x) && FIXNUM_P(y)) {
+ long c = FIX2LONG(x) - FIX2LONG(y);
+ if (c > 0)
+ c = 1;
+ else if (c < 0)
+ c = -1;
+ return INT2FIX(c);
+ }
+ return rb_funcall(x, id_cmp, 1, y);
+}
+
+inline static VALUE
f_div(VALUE x, VALUE y)
{
if (FIXNUM_P(y) && FIX2LONG(y) == 1)
@@ -104,6 +106,16 @@ f_gt_p(VALUE x, VALUE y)
}
inline static VALUE
+f_lt_p(VALUE x, VALUE y)
+{
+ if (FIXNUM_P(x) && FIXNUM_P(y))
+ return f_boolcast(FIX2LONG(x) < FIX2LONG(y));
+ return rb_funcall(x, '<', 1, y);
+}
+
+binop(mod, '%')
+
+inline static VALUE
f_mul(VALUE x, VALUE y)
{
#ifndef PRESERVE_SIGNEDZERO
@@ -140,10 +152,16 @@ f_sub(VALUE x, VALUE y)
}
fun1(abs)
+fun1(abs2)
fun1(arg)
+fun1(conj)
fun1(denominator)
+fun1(floor)
+fun1(imag)
+fun1(inspect)
fun1(negate)
fun1(numerator)
+fun1(real)
fun1(real_p)
inline static VALUE
@@ -162,6 +180,9 @@ f_to_f(VALUE x)
}
fun1(to_r)
+fun1(to_s)
+
+fun2(divmod)
inline static VALUE
f_eqeq_p(VALUE x, VALUE y)
@@ -173,6 +194,7 @@ f_eqeq_p(VALUE x, VALUE y)
fun2(expt)
fun2(fdiv)
+fun2(idiv)
fun2(quo)
inline static VALUE
@@ -236,6 +258,12 @@ k_numeric_p(VALUE x)
}
inline static VALUE
+k_integer_p(VALUE x)
+{
+ return f_kind_of_p(x, rb_cInteger);
+}
+
+inline static VALUE
k_fixnum_p(VALUE x)
{
return f_kind_of_p(x, rb_cFixnum);
@@ -266,8 +294,10 @@ k_complex_p(VALUE x)
}
#define k_exact_p(x) (!k_float_p(x))
+#define k_inexact_p(x) k_float_p(x)
#define k_exact_zero_p(x) (k_exact_p(x) && f_zero_p(x))
+#define k_exact_one_p(x) (k_exact_p(x) && f_one_p(x))
#define get_dat1(x) \
struct RComplex *dat;\
@@ -346,8 +376,6 @@ nucomp_canonicalization(int f)
{
canonicalization = f;
}
-#else
-#define canonicalization 0
#endif
inline static void
@@ -429,6 +457,13 @@ nucomp_s_new(int argc, VALUE *argv, VALUE klass)
}
inline static VALUE
+f_complex_new1(VALUE klass, VALUE x)
+{
+ assert(!k_complex_p(x));
+ return nucomp_s_canonicalize_internal(klass, x, ZERO);
+}
+
+inline static VALUE
f_complex_new2(VALUE klass, VALUE x, VALUE y)
{
assert(!k_complex_p(x));
@@ -443,8 +478,6 @@ f_complex_new2(VALUE klass, VALUE x, VALUE y)
*
* Complex(1, 2) #=> (1+2i)
* Complex('1+2i') #=> (1+2i)
- * Complex(nil) #=> TypeError
- * Complex(1, nil) #=> TypeError
*
* Syntax of string form:
*
@@ -504,6 +537,7 @@ m_log_bang(VALUE x)
imp1(sin)
imp1(sinh)
+imp1(sqrt)
static VALUE
m_cos(VALUE x)
@@ -536,8 +570,6 @@ m_sin(VALUE x)
}
#if 0
-imp1(sqrt)
-
static VALUE
m_sqrt(VALUE x)
{
@@ -561,44 +593,11 @@ m_sqrt(VALUE x)
}
#endif
-static VALUE
+inline static VALUE
f_complex_polar(VALUE klass, VALUE x, VALUE y)
{
assert(!k_complex_p(x));
assert(!k_complex_p(y));
- if (f_zero_p(x) || f_zero_p(y)) {
- if (canonicalization) return x;
- return nucomp_s_new_internal(klass, x, RFLOAT_0);
- }
- if (RB_FLOAT_TYPE_P(y)) {
- const double arg = RFLOAT_VALUE(y);
- if (arg == M_PI) {
- x = f_negate(x);
- if (canonicalization) return x;
- y = RFLOAT_0;
- }
- else if (arg == M_PI_2) {
- y = x;
- x = RFLOAT_0;
- }
- else if (arg == M_PI_2+M_PI) {
- y = f_negate(x);
- x = RFLOAT_0;
- }
- else if (RB_FLOAT_TYPE_P(x)) {
- const double abs = RFLOAT_VALUE(x);
- const double real = abs * cos(arg), imag = abs * sin(arg);
- x = DBL2NUM(real);
- if (canonicalization && imag == 0.0) return x;
- y = DBL2NUM(imag);
- }
- else {
- y = f_mul(x, DBL2NUM(sin(arg)));
- x = f_mul(x, DBL2NUM(cos(arg)));
- if (canonicalization && f_zero_p(y)) return x;
- }
- return nucomp_s_new_internal(klass, x, y);
- }
return nucomp_s_canonicalize_internal(klass,
f_mul(x, m_cos(y)),
f_mul(x, m_sin(y)));
@@ -623,8 +622,8 @@ nucomp_s_polar(int argc, VALUE *argv, VALUE klass)
switch (rb_scan_args(argc, argv, "11", &abs, &arg)) {
case 1:
nucomp_real_check(abs);
- if (canonicalization) return abs;
- return nucomp_s_new_internal(klass, abs, ZERO);
+ arg = ZERO;
+ break;
default:
nucomp_real_check(abs);
nucomp_real_check(arg);
@@ -717,12 +716,11 @@ f_addsub(VALUE self, VALUE other,
* Complex(9, 8) + 4 #=> (13+8i)
* Complex(20, 9) + 9.8 #=> (29.8+9i)
*/
-VALUE
-rb_nucomp_add(VALUE self, VALUE other)
+static VALUE
+nucomp_add(VALUE self, VALUE other)
{
return f_addsub(self, other, f_add, '+');
}
-#define nucomp_add rb_nucomp_add
/*
* call-seq:
@@ -742,19 +740,6 @@ nucomp_sub(VALUE self, VALUE other)
return f_addsub(self, other, f_sub, '-');
}
-static VALUE
-safe_mul(VALUE a, VALUE b, int az, int bz)
-{
- double v;
- if (!az && bz && RB_FLOAT_TYPE_P(a) && (v = RFLOAT_VALUE(a), !isnan(v))) {
- a = signbit(v) ? DBL2NUM(-1.0) : DBL2NUM(1.0);
- }
- if (!bz && az && RB_FLOAT_TYPE_P(b) && (v = RFLOAT_VALUE(b), !isnan(v))) {
- b = signbit(v) ? DBL2NUM(-1.0) : DBL2NUM(1.0);
- }
- return f_mul(a, b);
-}
-
/*
* call-seq:
* cmp * numeric -> complex
@@ -767,24 +752,18 @@ safe_mul(VALUE a, VALUE b, int az, int bz)
* Complex(9, 8) * 4 #=> (36+32i)
* Complex(20, 9) * 9.8 #=> (196.0+88.2i)
*/
-VALUE
-rb_nucomp_mul(VALUE self, VALUE other)
+static VALUE
+nucomp_mul(VALUE self, VALUE other)
{
if (k_complex_p(other)) {
VALUE real, imag;
- VALUE areal, aimag, breal, bimag;
- int arzero, aizero, brzero, bizero;
get_dat2(self, other);
- arzero = !!f_zero_p(areal = adat->real);
- aizero = !!f_zero_p(aimag = adat->imag);
- brzero = !!f_zero_p(breal = bdat->real);
- bizero = !!f_zero_p(bimag = bdat->imag);
- real = f_sub(safe_mul(areal, breal, arzero, brzero),
- safe_mul(aimag, bimag, aizero, bizero));
- imag = f_add(safe_mul(areal, bimag, arzero, bizero),
- safe_mul(aimag, breal, aizero, brzero));
+ real = f_sub(f_mul(adat->real, bdat->real),
+ f_mul(adat->imag, bdat->imag));
+ imag = f_add(f_mul(adat->real, bdat->imag),
+ f_mul(adat->imag, bdat->real));
return f_complex_new2(CLASS_OF(self), real, imag);
}
@@ -797,7 +776,6 @@ rb_nucomp_mul(VALUE self, VALUE other)
}
return rb_num_coerce_bin(self, other, '*');
}
-#define nucomp_mul rb_nucomp_mul
inline static VALUE
f_divide(VALUE self, VALUE other,
@@ -1020,8 +998,8 @@ nucomp_coerce(VALUE self, VALUE other)
if (RB_TYPE_P(other, T_COMPLEX))
return rb_assoc_new(other, self);
- rb_raise(rb_eTypeError, "%"PRIsVALUE" can't be coerced into %"PRIsVALUE,
- rb_obj_class(other), rb_obj_class(self));
+ rb_raise(rb_eTypeError, "%s can't be coerced into %s",
+ rb_obj_classname(other), rb_obj_classname(self));
return Qnil;
}
@@ -1255,6 +1233,10 @@ nucomp_eql_p(VALUE self, VALUE other)
inline static VALUE
f_signbit(VALUE x)
{
+#if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun) && \
+ !defined(signbit)
+ extern int signbit(double);
+#endif
if (RB_TYPE_P(x, T_FLOAT)) {
double f = RFLOAT_VALUE(x);
return f_boolcast(!isnan(f) && signbit(f));
@@ -1303,7 +1285,7 @@ f_format(VALUE self, VALUE (*func)(VALUE))
static VALUE
nucomp_to_s(VALUE self)
{
- return f_format(self, rb_String);
+ return f_format(self, f_to_s);
}
/*
@@ -1324,7 +1306,7 @@ nucomp_inspect(VALUE self)
VALUE s;
s = rb_usascii_str_new2("(");
- rb_str_concat(s, f_format(self, rb_inspect));
+ rb_str_concat(s, f_format(self, f_inspect));
rb_str_cat2(s, ")");
return s;
@@ -1404,20 +1386,6 @@ rb_Complex(VALUE x, VALUE y)
return nucomp_s_convert(2, a, rb_cComplex);
}
-VALUE
-rb_complex_set_real(VALUE cmp, VALUE r)
-{
- RCOMPLEX_SET_REAL(cmp, r);
- return cmp;
-}
-
-VALUE
-rb_complex_set_imag(VALUE cmp, VALUE i)
-{
- RCOMPLEX_SET_IMAG(cmp, i);
- return cmp;
-}
-
/*
* call-seq:
* cmp.to_i -> integer
@@ -1434,9 +1402,10 @@ nucomp_to_i(VALUE self)
{
get_dat1(self);
- if (!k_exact_zero_p(dat->imag)) {
- rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Integer",
- self);
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
+ VALUE s = f_to_s(self);
+ rb_raise(rb_eRangeError, "can't convert %s into Integer",
+ StringValuePtr(s));
}
return f_to_i(dat->real);
}
@@ -1457,9 +1426,10 @@ nucomp_to_f(VALUE self)
{
get_dat1(self);
- if (!k_exact_zero_p(dat->imag)) {
- rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Float",
- self);
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
+ VALUE s = f_to_s(self);
+ rb_raise(rb_eRangeError, "can't convert %s into Float",
+ StringValuePtr(s));
}
return f_to_f(dat->real);
}
@@ -1482,9 +1452,10 @@ nucomp_to_r(VALUE self)
{
get_dat1(self);
- if (!k_exact_zero_p(dat->imag)) {
- rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational",
- self);
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
+ VALUE s = f_to_s(self);
+ rb_raise(rb_eRangeError, "can't convert %s into Rational",
+ StringValuePtr(s));
}
return f_to_r(dat->real);
}
@@ -1509,9 +1480,10 @@ nucomp_rationalize(int argc, VALUE *argv, VALUE self)
rb_scan_args(argc, argv, "01", NULL);
- if (!k_exact_zero_p(dat->imag)) {
- rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational",
- self);
+ if (k_inexact_p(dat->imag) || f_nonzero_p(dat->imag)) {
+ VALUE s = f_to_s(self);
+ rb_raise(rb_eRangeError, "can't convert %s into Rational",
+ StringValuePtr(s));
}
return rb_funcall2(dat->real, rb_intern("rationalize"), argc, argv);
}
@@ -1696,6 +1668,8 @@ isimagunit(int c)
c == 'j' || c == 'J');
}
+VALUE rb_cstr_to_rat(const char *, int);
+
static VALUE
str2num(char *s)
{
@@ -1800,26 +1774,19 @@ parse_comp(const char *s, int strict,
VALUE *num)
{
char *buf, *b;
- VALUE tmp;
- int ret = 1;
- buf = ALLOCV_N(char, tmp, strlen(s) + 1);
+ buf = ALLOCA_N(char, strlen(s) + 1);
b = buf;
skip_ws(&s);
- if (!read_comp(&s, strict, num, &b)) {
- ret = 0;
- }
- else {
- skip_ws(&s);
-
- if (strict)
- if (*s != '\0')
- ret = 0;
- }
- ALLOCV_END(tmp);
+ if (!read_comp(&s, strict, num, &b))
+ return 0;
+ skip_ws(&s);
- return ret;
+ if (strict)
+ if (*s != '\0')
+ return 0;
+ return 1;
}
static VALUE
@@ -1845,8 +1812,9 @@ string_to_c_strict(VALUE self)
s = (char *)"";
if (!parse_comp(s, 1, &num)) {
- rb_raise(rb_eArgError, "invalid value for convert(): %+"PRIsVALUE,
- self);
+ VALUE ins = f_inspect(self);
+ rb_raise(rb_eArgError, "invalid value for convert(): %s",
+ StringValuePtr(ins));
}
return num;
@@ -2087,10 +2055,9 @@ float_arg(VALUE self)
* and i is imaginary unit. Real a equals complex a+0i
* mathematically.
*
- * Complex object can be created as literal, and also by using
- * Kernel#Complex, Complex::rect, Complex::polar or to_c method.
+ * In ruby, you can create complex object with Complex, Complex::rect,
+ * Complex::polar or to_c method.
*
- * 2+1i #=> (2+1i)
* Complex(1) #=> (1+0i)
* Complex(2, 3) #=> (2+3i)
* Complex.polar(2, 3) #=> (-1.9799849932008908+0.2822400161197344i)
@@ -2124,19 +2091,29 @@ Init_Complex(void)
assert(fprintf(stderr, "assert() is now active\n"));
id_abs = rb_intern("abs");
+ id_abs2 = rb_intern("abs2");
id_arg = rb_intern("arg");
+ id_cmp = rb_intern("<=>");
+ id_conj = rb_intern("conj");
id_convert = rb_intern("convert");
id_denominator = rb_intern("denominator");
+ id_divmod = rb_intern("divmod");
id_eqeq_p = rb_intern("==");
id_expt = rb_intern("**");
id_fdiv = rb_intern("fdiv");
+ id_floor = rb_intern("floor");
+ id_idiv = rb_intern("div");
+ id_imag = rb_intern("imag");
+ id_inspect = rb_intern("inspect");
id_negate = rb_intern("-@");
id_numerator = rb_intern("numerator");
id_quo = rb_intern("quo");
+ id_real = rb_intern("real");
id_real_p = rb_intern("real?");
id_to_f = rb_intern("to_f");
id_to_i = rb_intern("to_i");
id_to_r = rb_intern("to_r");
+ id_to_s = rb_intern("to_s");
id_i_real = rb_intern("@real");
id_i_imag = rb_intern("@image"); /* @image, not @imag */
@@ -2176,6 +2153,10 @@ Init_Complex(void)
rb_undef_method(rb_cComplex, "truncate");
rb_undef_method(rb_cComplex, "i");
+#if 0 /* NUBY */
+ rb_undef_method(rb_cComplex, "//");
+#endif
+
rb_define_method(rb_cComplex, "real", nucomp_real, 0);
rb_define_method(rb_cComplex, "imaginary", nucomp_imag, 0);
rb_define_method(rb_cComplex, "imag", nucomp_imag, 0);
@@ -2223,11 +2204,8 @@ Init_Complex(void)
rb_define_method(rb_cComplex, "to_s", nucomp_to_s, 0);
rb_define_method(rb_cComplex, "inspect", nucomp_inspect, 0);
- rb_undef_method(rb_cComplex, "positive?");
- rb_undef_method(rb_cComplex, "negative?");
-
rb_define_private_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
- compat = rb_define_class_under(rb_cComplex, "compatible", rb_cObject); /* :nodoc: */
+ compat = rb_define_class_under(rb_cComplex, "compatible", rb_cObject);
rb_define_private_method(compat, "marshal_load", nucomp_marshal_load, 1);
rb_marshal_define_compat(rb_cComplex, compat, nucomp_dumper, nucomp_loader);
@@ -2269,8 +2247,6 @@ Init_Complex(void)
*/
rb_define_const(rb_cComplex, "I",
f_complex_new_bang2(rb_cComplex, ZERO, ONE));
-
- rb_provide("complex.so"); /* for backward compatibility */
}
/*
diff --git a/configure.in b/configure.in
index 2cd0f27b64..5d86e14bd0 100644
--- a/configure.in
+++ b/configure.in
@@ -11,10 +11,6 @@ AC_DEFUN([RUBY_PREREQ_AC],
AC_DISABLE_OPTION_CHECKING
-AC_ARG_VAR([cflags], [additional CFLAGS])
-AC_ARG_VAR([cppflags], [additional CPPFLAGS])
-AC_ARG_VAR([cxxflags], [additional CXXFLAGS])
-
AC_DEFUN([RUBY_RM_RECURSIVE], [
m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [2.70]), [-1], [
# suppress error messages, rm: cannot remove 'conftest.dSYM', from
@@ -43,20 +39,21 @@ AC_ARG_WITH(baseruby,
AS_CASE(["$withval"],[*ruby*],[BASERUBY=$withval],[AC_MSG_ERROR(need ruby)])
],
[
- AC_PATH_PROG([BASERUBY], [ruby], [false])
+ BASERUBY="ruby"
])
-if test "`RUBYOPT=- $BASERUBY -e 'print 42' 2>/dev/null`" = 42; then
- if test "`RUBYOPT=- $BASERUBY --disable=gems -e 'print 42' 2>/dev/null`" = 42; then
+if test "`RUBYOPT=- $BASERUBY -e 'p 42' 2>/dev/null`" = 42; then
+ if test "`RUBYOPT=- $BASERUBY --disable=gems -e 'p 42' 2>/dev/null`" = 42; then
BASERUBY="$BASERUBY --disable=gems"
fi
- $BASERUBY -C "$srcdir/tool" downloader.rb -e gnu config.guess config.sub
- HAVE_BASERUBY=yes
else
BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false"
- HAVE_BASERUBY=no
fi
AC_SUBST(BASERUBY)
-AC_SUBST(HAVE_BASERUBY)
+
+for conf in config.guess config.sub; do
+ test -f "$srcdir/tool/$conf" && continue
+ $BASERUBY -C "$srcdir/tool" get-config_files $conf
+done
AC_DEFUN([RUBY_MINGW32],
[AS_CASE(["$host_os"],
@@ -102,15 +99,8 @@ AC_DEFUN([RUBY_NACL],
[no], [nacl_cv_build_variant=glibc],
[yes], [nacl_cv_build_variant=newlib])])
- AS_CASE(["$target_cpu"],
- [x86_64], [nacl_cv_cpu_nick=x86
- nacl_cv_cpu_nick2=x86_64],
- [i?86], [nacl_cv_cpu_nick=x86
- nacl_cv_cpu_nick2=x86_32],
- [le32], [nacl_cv_cpu_nick=pnacl
- nacl_cv_cpu_nick2=pnacl
- ac_cv_exeext=.pexe],
- [nacl_cv_cpu_nick=$target_cpu])
+ AS_CASE(["$build_cpu"],
+ [x86_64|i?86], [nacl_cv_cpu_nick=x86], [nacl_cv_cpu_nick=$build_cpu])
AS_CASE(["$build_os"],
[linux*], [nacl_cv_os_nick=linux],
[darwin*], [nacl_cv_os_nick=mac],
@@ -121,15 +111,9 @@ AC_DEFUN([RUBY_NACL],
ac_tool_prefix="$host_cpu-nacl-"
AC_MSG_CHECKING([NativeClient toolchain])
- if test x"$nacl_cv_cpu_nick" = xpnacl; then
- NACL_TOOLCHAIN="${nacl_cv_os_nick}_pnacl"
- ac_tool_prefix=pnacl-
- elif test -d \
+ if test -d \
"${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"; then
NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"
- elif test -d \
- "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_x86_${nacl_cv_cpu_nick}/${nacl_cv_build_variant}"; then
- NACL_TOOLCHAIN="${nacl_cv_os_nick}_x86_${nacl_cv_cpu_nick}/${nacl_cv_build_variant}"
else
AS_CASE(
["${nacl_cv_build_variant}"],
@@ -157,32 +141,10 @@ AC_DEFUN([RUBY_NACL],
if ! echo -- "${PATH}" | grep -F "${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin" > /dev/null; then
PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin"
fi
- AC_MSG_RESULT(${NACL_SDK_ROOT}/toolchain/${NACL_TOOLCHAIN}/bin)
-
- RUBY_APPEND_OPTIONS(XCFLAGS, '-I$(NACL_SDK_ROOT)/include')
- if test x"${nacl_cv_cpu_nick}" = xpnacl; then
- RUBY_APPEND_OPTIONS(XCFLAGS, '-isystem $(NACL_SDK_ROOT)/include/pnacl')
- elif test x"${nacl_cv_build_variant}" = xnewlib; then
- RUBY_APPEND_OPTIONS(XCFLAGS, '-isystem $(NACL_SDK_ROOT)/include/newlib')
- fi
-
- AC_MSG_CHECKING([nacl library path])
- if test -d "${NACL_SDK_ROOT}/lib/${nacl_cv_build_variant}_${nacl_cv_cpu_nick2}/Release"; then
- nacl_cv_libpath="${nacl_cv_build_variant}_${nacl_cv_cpu_nick2}"
- elif test -d "${NACL_SDK_ROOT}/lib/${nacl_cv_cpu_nick2}/Release"; then
- nacl_cv_libpath="${nacl_cv_cpu_nick2}"
- else
- AC_MSG_ERROR([not found])
- fi
- AC_MSG_RESULT([${nacl_cv_libpath}])
- RUBY_APPEND_OPTIONS(XLDFLAGS, '-L$(NACL_SDK_ROOT)/'"lib/${nacl_cv_libpath}/Release")
AC_SUBST(NACL_TOOLCHAIN)
AC_SUBST(NACL_SDK_ROOT)
- AC_SUBST(NACL_SDK_VARIANT, "${nacl_cv_build_variant}")
- AC_SUBST(NACL_LIB_PATH, "${nacl_cv_libpath}")
- AC_CHECK_TOOLS(CC, [clang gcc])
- AC_CHECK_TOOLS(CXX, [clang++ g++])
+ AC_SUBST(NACL_SDK_VARIANT, nacl_cv_build_variant)
])])
AC_DEFUN([RUBY_NACL_CHECK_PEPPER_TYPES],
@@ -235,6 +197,8 @@ AC_SUBST(MINOR)
AC_SUBST(TEENY)
RUBY_PROGRAM_VERSION=`sed -n 's/^#define RUBY_VERSION "\(.*\)"/\1/p' $srcdir/version.h`
AC_SUBST(RUBY_PROGRAM_VERSION)
+RUBY_RELEASE_DATE=`sed -n 's/^#define RUBY_RELEASE_DATE "\(.*\)"/\1/p' $srcdir/version.h`
+AC_SUBST(RUBY_RELEASE_DATE)
RUBY_PATCHLEVEL=`sed -n 's/^#define RUBY_PATCHLEVEL //p' $srcdir/version.h`
AC_DEFINE(CANONICALIZATION_FOR_MATHN)
dnl checks for alternative programs
@@ -259,7 +223,6 @@ AS_CASE(["$build_os"],
[xgcc-4.2|x/usr/bin/gcc-4.2], [: ${CXX=g++-4.2}],
[xgcc|x/usr/bin/gcc], [: ${CXX=g++}],
[xcc|x/usr/bin/cc], [: ${CXX=c++}],
- [xicc], [: ${CXX=icpc}],
[xclang|x/usr/bin/clang], [: ${CXX=clang++}])
])
test -z "$CC" || ac_cv_prog_CC="$CC"
@@ -268,9 +231,6 @@ test -z "$CXX" || ac_cv_prog_CXX="$CXX"
if test "$program_prefix" = NONE; then
program_prefix=
fi
-if test "$prefix" -ef .; then
- AC_MSG_ERROR(--prefix cannot be the current working directory.)
-fi
RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
AC_SUBST(RUBY_BASE_NAME)
@@ -282,21 +242,14 @@ test x"$target_alias" = x &&
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
ac_install_sh='' # unusable for extension libraries.
+AS_CASE($target_os,
+ [darwin*], [os_version_style=major+0],
+ [os_version_style=full])
AC_ARG_WITH(os-version-style,
AS_HELP_STRING([--with-os-version-style=TYPE],
[OS version number for target and target_os [[full]]]
[(full|teeny|minor+0|minor|major+0|major|none)]),
- [os_version_style=$withval],
- [os_version_style=full
- AS_CASE($target_os, [[*[0-9].*]],
- [AS_CASE([`/usr/bin/ruby -e 'puts RUBY_PLATFORM' 2>/dev/null`],
- [[*-*[0-9].*.0]], [os_version_style=minor+0],
- [[*-*[0-9].*.*]], [os_version_style=full],
- [[*-*[0-9].0] ], [os_version_style=major+0],
- [[*-*[0-9].*] ], [os_version_style=minor],
- [[*-*[0-9]] ], [os_version_style=major],
- )])
- ])
+ [os_version_style=$withval])
os_version_style_transform=
AS_CASE("${os_version_style}",
[full|teeny], [],
@@ -313,26 +266,24 @@ AS_IF([test -z "$target_alias" -a -n "$os_version_style_transform"],
])
AC_DEFUN([RUBY_APPEND_OPTION],
- [# RUBY_APPEND_OPTION($1)
+ [# RUBY_APPEND_OPTION($1, $2)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])])
AC_DEFUN([RUBY_APPEND_OPTIONS],
- [# RUBY_APPEND_OPTIONS($1)
- for rb_opt in $2; do
+ [{ for rb_opt in $2; do # RUBY_APPEND_OPTIONS($1, $2)
AS_CASE([" [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"])
- done])
+ done; }])
AC_DEFUN([RUBY_PREPEND_OPTION],
- [# RUBY_PREPEND_OPTION($1)
+ [# RUBY_PREPEND_OPTION($1, $2)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])])
AC_DEFUN([RUBY_PREPEND_OPTIONS],
- [# RUBY_PREPEND_OPTIONS($1)
- unset rb_opts; for rb_opt in $2; do
+ [{ unset rb_opts; for rb_opt in $2; do # RUBY_PREPEND_OPTIONS($1, $2)
AS_CASE([" [$]{rb_opts} [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ rb_opts="[$]{rb_opts}[$]{rb_opt} "])
done
- $1="[$]{rb_opts}[$]$1"])
+ $1="[$]{rb_opts}[$]$1"; }])
AC_ARG_WITH(arch,
AS_HELP_STRING([--with-arch=ARCHS],
@@ -355,11 +306,9 @@ AC_MSG_RESULT([$ARCH_FLAG])
AC_DEFUN([RUBY_UNIVERSAL_ARCH], [
# RUBY_UNIVERSAL_ARCH begin
-ARCH_FLAG=`expr " $CXXFLAGS " : ['.* \(-m[0-9][0-9]*\) ']`
-test ${CXXFLAGS+set} && CXXFLAGS=`echo "$CXXFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']`
ARCH_FLAG=`expr " $CFLAGS " : ['.* \(-m[0-9][0-9]*\) ']`
-test ${CFLAGS+set} && CFLAGS=`echo "$CFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']`
-test ${LDFLAGS+set} && LDFLAGS=`echo "$LDFLAGS" | sed [-e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g']`
+test ${CFLAGS+set} && CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g'`
+test ${LDFLAGS+set} && LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-arch *[^ ]*//g' -e 's/ *-m32//g' -e 's/ *-m64//g'`
unset universal_binary universal_archnames
if test ${target_archs+set}; then
AC_MSG_CHECKING([target architectures])
@@ -437,8 +386,8 @@ else
rb_cv_target_archs=${target_archs}
fi
if test "x${ARCH_FLAG}" != x; then
- CFLAGS="${CFLAGS:+$CFLAGS }${ARCH_FLAG}"
- LDFLAGS="${LDFLAGS:+$LDFLAGS }${ARCH_FLAG}"
+ CFLAGS="$CFLAGS ${ARCH_FLAG}"
+ LDFLAGS="${LDFLAGS+$LDFLAGS }${ARCH_FLAG}"
fi
# RUBY_UNIVERSAL_ARCH end
])
@@ -472,7 +421,7 @@ fi
RUBY_NACL
AS_CASE(["$host_os:$build_os"],
[darwin*:darwin*], [
- AC_CHECK_TOOLS(CC, [clang gcc cc])
+ AC_CHECK_TOOLS(CC, [gcc-4.2 clang gcc cc])
# Following Apple deployed clang are broken
# clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/tags/Apple/clang-23 exported)
# Apple clang version 2.0 (tags/Apple/clang-137) (based on LLVM 2.9svn)
@@ -502,9 +451,7 @@ if test "$GCC" = yes; then
linker_flag=-Wl,
: ${optflags=-O3}
gcc_major=`echo =__GNUC__ | $CC -E -xc - | sed '/^=/!d;s///'`
- gcc_minor=`echo =__GNUC_MINOR__ | $CC -E -xc - | sed '/^=/!d;s///'`
test -n "$gcc_major" || gcc_major=0
- test -n "$gcc_minor" || gcc_minor=0
# RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
else
linker_flag=
@@ -622,10 +569,8 @@ AC_DEFUN([RUBY_DTRACE_AVAILABLE],
[
echo "provider conftest{ probe fire(); };" > conftest_provider.d
if $DTRACE -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null; then
- AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [
- # DTrace is available on the system
- rb_cv_dtrace_available=yes
- ], [rb_cv_dtrace_available=no])
+ # DTrace is available on the system
+ rb_cv_dtrace_available=yes
else
# DTrace is not available while dtrace command exists
# for example FreeBSD 8 or FreeBSD 9 without DTrace build option
@@ -638,28 +583,19 @@ AC_DEFUN([RUBY_DTRACE_AVAILABLE],
AC_DEFUN([RUBY_DTRACE_POSTPROCESS],
[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g,
[
- rb_cv_prog_dtrace_g=no
if {
- cat >conftest_provider.d <<_PROBES &&
- provider conftest {
- probe fire();
- };
-_PROBES
- $DTRACE -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null &&
- :
+ echo "provider conftest{ probe fire(); };" > conftest_provider.d &&
+ dtrace -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null &&
+ cat >conftest.c <<_CONF &&
+ @%:@include "conftest_provider.h"
+ int main(void){ CONFTEST_FIRE(); return 0; }
+_CONF
+ $CC $CFLAGS -c -o conftest.o conftest.c &&
+ $DTRACE -G -s conftest_provider.d conftest.o 2>/dev/null
}; then
- AC_TRY_COMPILE([@%:@include "conftest_provider.h"], [CONFTEST_FIRE();], [
- if {
- cp -p conftest.${ac_objext} conftest.${ac_objext}.save &&
- $DTRACE -G -s conftest_provider.d conftest.${ac_objext} 2>/dev/null &&
- :
- }; then
- if cmp -s conftest.o conftest.${ac_objext}.save; then
- rb_cv_prog_dtrace_g=yes
- else
- rb_cv_prog_dtrace_g=rebuild
- fi
- fi])
+ rb_cv_prog_dtrace_g=yes
+ else
+ rb_cv_prog_dtrace_g=no
fi
rm -f conftest.[co] conftest_provider.[dho]
])
@@ -742,25 +678,16 @@ RUBY_WERROR_FLAG([
]
)
AC_MSG_CHECKING([whether LDFLAGS is valid])
- {
- mkdir tmp.$$.try_link &&
- cd tmp.$$.try_link &&
- cp ../confdefs.h . &&
- echo '<?xml?><plist><dict><key>CFBundleIdentifier</key><string></string></dict></plist>' > Info.plist &&
- :
- } || AC_MSG_ERROR([failed to make temporary directory])
AC_TRY_LINK([], [],
[AC_MSG_RESULT(yes)],
[
- cd .. && rm -fr tmp.$$.try_link
AC_MSG_RESULT(no)
AC_MSG_ERROR([something wrong with LDFLAGS="$LDFLAGS"])
]
)
- cd .. && rm -fr tmp.$$.try_link
])
-AC_DEFUN([RUBY_TRY_CFLAGS], [
+AC_DEFUN(RUBY_TRY_CFLAGS, [
AC_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS])
RUBY_WERROR_FLAG([
CFLAGS="[$]CFLAGS $1"
@@ -772,7 +699,7 @@ AC_DEFUN([RUBY_TRY_CFLAGS], [
])
])
-AC_DEFUN([RUBY_TRY_LDFLAGS], [
+AC_DEFUN(RUBY_TRY_LDFLAGS, [
save_LDFLAGS="$LDFLAGS"
LDFLAGS="[$]LDFLAGS $1"
AC_MSG_CHECKING([whether $1 is accepted as LDFLAGS])
@@ -787,24 +714,6 @@ AC_DEFUN([RUBY_TRY_LDFLAGS], [
save_LDFLAGS=
])
-: ${RPATHFLAG=''}
-rpathflag=''
-AS_IF([test x"${RPATHFLAG}" = x], [
- AS_CASE(["$target_os"],
- [hpux*], [AS_IF([test "$rb_cv_prog_gnu_ld" = no], [rpathflag='+b '])],
- [aix*], [rpathflag='-blibpath:'],
- [for rpathflag in -R "-rpath "; do
- AS_CASE("$rpathflag",
- [*" "], [AS_CASE(["${linker_flag}"],
- [*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])])
- rpathflag="${linker_flag}${rpathflag}"
- RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=])
- AS_IF([test "x${rpathflag}" != x], [])
- done])
-], [
- rpathflag=`echo "$RPATHFLAG" | sed 's/%.*//'`
-])
-
AS_CASE([$RUBY_PATCHLEVEL], [-*],
[particular_werror_flags=yes], [particular_werror_flags=no])
AC_ARG_ENABLE(werror,
@@ -821,11 +730,7 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
else
extra_warning=
fi
- if test $gcc_major -eq 5; then
- extra_warning="$extra_warning -Wno-maybe-uninitialized"
- fi
for wflag in -Wno-unused-parameter -Wno-parentheses -Wno-long-long \
- -diag-disable=2259 \
-Wno-missing-field-initializers \
-Wunused-variable \
-Werror=pointer-arith \
@@ -834,8 +739,6 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
-Werror=shorten-64-to-32 \
-Werror=implicit-function-declaration \
-Werror=division-by-zero \
- -Werror=deprecated-declarations \
- -Wno-packed-bitfield-compat \
$extra_warning \
; do
if test "$particular_werror_flags" != yes; then
@@ -861,37 +764,17 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
rb_cv_warnflags="$warnflags"
warnflags=
fi
-RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)])
-
-for n in infinity nan; do
- m=AS_TR_CPP($n)
- AC_CACHE_CHECK([whether $m is available without C99 option], rb_cv_$n,
- [AC_COMPILE_IFELSE(
- [AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([@%:@include <math.h>
-@%:@ifndef $m
-@%:@error no $m
-@%:@endif
-]), [1])], [eval rb_cv_$n=yes], [eval rb_cv_$n=no])])
- if eval test '"$rb_cv_'$n'"' = yes; then
- AC_DEFINE_UNQUOTED([HAVE_]$m)
- fi
-done
-
if test "$GCC" = yes; then
- # NaCl's glibc build generates undefined references to __memset_chk.
- # TODO(sbc): Remove this once NaCl's glibc is fixed.
- AS_CASE(["$target_os"], [nacl], [], [
- # -D_FORTIFY_SOURCE
- # When defined _FORTIFY_SOURCE, glibc enables some additional sanity
- # argument check. The performance drop is very little and Ubuntu enables
- # _FORTIFY_SOURCE=2 by default. So, let's support it for protecting us from
- # a mistake of silly C extensions.
- RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)])
- ])
+ # -D_FORTIFY_SOURCE
+ # When defined _FORTIFY_SOURCE, glibc enables some additional sanity
+ # argument check. The performance drop is very little and Ubuntu enables
+ # _FORTIFY_SOURCE=2 by default. So, let's support it for protecting us from
+ # a mistake of silly C extensions.
+ RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)])
# -fstack-protector
AS_CASE(["$target_os"],
- [mingw*|nacl], [
+ [mingw*|nacl|haiku], [
stack_protector=no
])
if test -z "${stack_protector+set}"; then
@@ -912,46 +795,21 @@ if test "$GCC" = yes; then
# various headers. Most frequent situation is the use of //
# comments. We bypass ANSI C mode for them. Otherwise
# extension libs cannot include those headers.
-
- # Since math.h in some mingw64 wrongly delcares frexp and modf
- # to be pure, the variables pointed by the second arguments are
- # considered uninitialized unexpectedly.
- AC_CACHE_CHECK([whether frexp and modf are broken],
- rb_cv_mingw64_broken_frexp_modf,
- [
- save_CFLAGS="$CFLAGS"
- if test "$particular_werror_flags" = "yes"; then
- CFLAGS="$CFLAGS -Werror=uninitialized"
- else
- CFLAGS="$CFLAGS -Werror -Wuninitialized"
- fi
- AC_TRY_COMPILE([@%:@include <math.h>
- int foo(double x)
- {
- int exp;
- frexp(x, &exp);
- return exp;
- }], [if (foo(0.0)) return 1;],
- [rb_cv_mingw64_broken_frexp_modf=no],
- [rb_cv_mingw64_broken_frexp_modf=yes])
- CFLAGS="$save_CFLAGS"
- ])
- if test "$rb_cv_mingw64_broken_frexp_modf" = yes; then
- AC_DEFINE(RUBY_MINGW64_BROKEN_FREXP_MODF)
- fi
],
- [cygwin*|darwin*|netbsd*|nacl], [
+ [cygwin*|darwin*|netbsd*], [
# need lgamma_r(), finite()
],
+ [haiku], [
+ # Haiku R1/alpha3 uses gcc-4.4.4 which can not handle anonymous union
+ # with ANSI standard flags. Anonumous union is required to compile
+ # socket extension where <net/if.h> uses anonymous union.
+ ],
[
# ANSI (no XCFLAGS because this is C only)
- for ansi_options in -std=iso9899:1999 "-ansi -std=iso9899:199409"; do
- RUBY_TRY_CFLAGS(${ansi_options}, [
- RUBY_APPEND_OPTIONS(warnflags, ${ansi_options})
- RUBY_APPEND_OPTIONS(strict_warnflags, ${ansi_options})
- ], [ansi_options=])
- test "x${ansi_options}" = x || break
- done
+ RUBY_TRY_CFLAGS(-ansi -std=iso9899:199409, [
+ RUBY_APPEND_OPTION(warnflags, -ansi -std=iso9899:199409)
+ RUBY_APPEND_OPTION(strict_warnflags, -ansi -std=iso9899:199409)
+ ])
])
# suppress annoying -Wstrict-overflow warnings
@@ -986,30 +844,14 @@ if test "$GCC" = yes; then
AS_CASE(["$target_os"], [mingw*], [
RUBY_TRY_CFLAGS(-fno-omit-frame-pointer, [optflags="${optflags+$optflags }-fno-omit-frame-pointer"])
- RUBY_TRY_CFLAGS(-static-libgcc, [static_libgcc=yes], [static_libgcc=no])
- if test "$static_libgcc" = yes; then
- RUBY_APPEND_OPTION(EXTLDFLAGS, -static-libgcc)
- fi
])
# disable fast-math
- for oflag in -fno-fast-math -fp-model\ precise; do
+ for oflag in -fno-fast-math; do
RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)])
done
fi
-AC_ARG_WITH(opt-dir,
- AS_HELP_STRING([--with-opt-dir=DIR-LIST],
- [add optional headers and libraries directories separated by $PATH_SEPARATOR]),
- [
- val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
- CPPFLAGS="$CPPFLAGS $val"
- val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib${rpathflag:+ $rpathflag\\\\1/lib}|g;s/^ //"`
- LDFLAGS="$LDFLAGS $val"
- LDFLAGS_OPTDIR="$val"
- OPT_DIR="$withval"
- ], [OPT_DIR=])
-
test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\""
test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\""
@@ -1022,7 +864,6 @@ AC_ARG_WITH(winnt-ver,
AS_CASE(["$target_os"],
[mingw*], [
RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
- RUBY_APPEND_OPTION(CPPFLAGS, -D__MINGW_USE_VC2005_COMPAT)
])
AS_CASE(["$target_os"],
@@ -1069,33 +910,15 @@ AS_CASE(["$target_os"],
],
[macosx_10_5=yes], [macosx_10_5=no])
AC_MSG_RESULT($macosx_10_5)
- AS_IF([test "${target_os@%:@darwin}" -ge 16], [
- ac_cv_func___syscall=no
- ac_cv_func_syscall=no
- ac_cv_header_sys_syscall_h=no
- ac_cv_header_syscall_h=no
- ])
if test $macosx_10_5 = yes; then
- ac_cv_func_getcontext=no
- ac_cv_func_setcontext=no
+ ac_cv_header_ucontext_h=no
else
AC_DEFINE(BROKEN_SETREUID, 1)
AC_DEFINE(BROKEN_SETREGID, 1)
fi
- incs=`$CC -v -E -xc - < /dev/null 2>&1 | sed ['1,/^@%:@include </d;s/^ *//;s|[^./][^/]*/\.\./||g;/\/include$/!d;s||/lib|;/\/usr\/lib/d']`
- for d in `$CC -print-search-dirs | sed -e '/^libraries: */!d;s///' | tr : '\012' | fgrep -v /../ | sed -n 's|^\(/.*/lib\)/$|\1|p'`; do
- incs=`echo "$incs" | fgrep -v "$d"`
- done
- for d in $incs; do
- test -d "$d" && RUBY_APPEND_OPTIONS(LDFLAGS, "-L$d")
- done
ac_cv_type_getgroups=gid_t # getgroups() on Rosetta fills garbage
ac_cv_lib_crypt_crypt=no
ac_cv_func_fdatasync=no # Mac OS X wrongly reports it has fdatasync()
- ac_cv_func_vfork=no
- if test $gcc_major -lt 4 -o \( $gcc_major -eq 4 -a $gcc_minor -lt 3 \); then
- ac_cv_func___builtin_setjmp=no
- fi
AC_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
[AC_TRY_RUN([
#include <stdio.h>
@@ -1140,60 +963,14 @@ main()
],
[hpux*], [ LIBS="-lm $LIBS"
ac_cv_c_inline=no],
-[solaris*], [ LIBS="-lm $LIBS"
- ac_cv_func_vfork=no
- AC_MSG_CHECKING(whether _XOPEN_SOURCE is already given)
- AC_TRY_COMPILE([#include <unistd.h>
- #ifndef _XOPEN_SOURCE
- #error _XOPEN_SOURCE is not defined
- #endif
- ], [],
- [given_xopen_source=yes], [given_xopen_source=no])
- AC_MSG_RESULT($given_xopen_source)
- if test $given_xopen_source = no; then
- # On Solaris, with gcc, -std=iso9899:1999 in $ansi_options
- # is often also needed in CPPFLAGS, because some feature
- # definitions vary depending on such standards options.
- AS_CASE(["${ansi_options}"],
- [*-std=iso9899:1999*], [
- RUBY_APPEND_OPTIONS(CPPFLAGS, ${ansi_options})
- ])
- AC_MSG_CHECKING(appropriate _XOPEN_SOURCE value to define)
- define_xopen_source=""
- for tmp_xpg in 7 6 5; do
- if test x"$define_xopen_source" != x; then
- break
- fi
- # Both AC_TRY_CPP and AC_TRY_COMPILE should pass
- # because some options may not be set to CPPFLAGS.
- AC_TRY_CPP([
- #define _XOPEN_SOURCE ${tmp_xpg}00
- #include <unistd.h>
- #ifndef _XPG${tmp_xpg}
- #error _XPG${tmp_xpg} should be defined by _XOPEN_SOURCE=${tmp_xpg}00
- #endif
- ], [
- AC_TRY_COMPILE([
- #define _XOPEN_SOURCE ${tmp_xpg}00
- #include <unistd.h>
- #ifndef _XPG${tmp_xpg}
- #error _XPG${tmp_xpg} should be defined by _XOPEN_SOURCE=${tmp_xpg}00
- #endif
- ], [],
- [define_xopen_source=${tmp_xpg}00], [])
- ], [])
- done
- if test x"$define_xopen_source" = x; then
- define_xopen_source=no
- fi
- AC_MSG_RESULT($define_xopen_source)
- if test x"$define_xopen_source" != xno; then
- RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE=$define_xopen_source)
- fi
- fi
- ],
-[haiku*], [
- LIBS="$LIBS" # m lib is include in root
+[beos*|haiku*], [
+ ac_cv_func_link=no
+ ac_cv_func_sched_yield=no
+ ac_cv_func_pthread_attr_setinheritsched=no
+ AS_CASE(["$target_os"],
+ [beos*], [ ac_cv_header_net_socket_h=yes],
+ [haiku*], [ ac_cv_func_shutdown=no])
+ LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
],
[cygwin*], [ ac_cv_header_langinfo_h=yes
AC_CHECK_FUNCS(cygwin_conv_path)
@@ -1210,7 +987,6 @@ main()
ac_cv_header_sys_time_h=no
ac_cv_header_sys_times_h=no
ac_cv_header_sys_socket_h=no
- ac_cv_func_lstat=yes
ac_cv_func_times=yes
ac_cv_func_waitpid=yes
ac_cv_func_fsync=yes
@@ -1219,10 +995,7 @@ main()
ac_cv_func_isinf=yes
ac_cv_func_isnan=yes
ac_cv_func_finite=yes
- ac_cv_func_lchown=yes
ac_cv_func_link=yes
- ac_cv_func_readlink=yes
- ac_cv_func_symlink=yes
ac_cv_lib_crypt_crypt=no
ac_cv_func_getpgrp_void=no
ac_cv_func_memcmp_working=yes
@@ -1237,17 +1010,16 @@ main()
ac_cv_func_clock_gettime=yes
ac_cv_func_clock_getres=yes
ac_cv_func_malloc_usable_size=no
- { test "$target_cpu" = x64 && ac_cv_func___builtin_setjmp=no; }
AC_CHECK_TYPE([NET_LUID], [], [],
- [@%:@include <winsock2.h>
- @%:@include <iphlpapi.h>])
+ [@%:@include <windows.h>
+ @%:@include <iphlpapi.h>])
if test x"$ac_cv_type_NET_LUID" = xyes; then
AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
fi
- AC_CHECK_FUNCS(_gmtime64_s)
- AC_CHECK_FUNCS(_wfreopen_s)
AC_LIBOBJ([langinfo])
],
+[os2-emx*], [ LIBS="-lm $LIBS"
+ ac_cv_lib_dir_opendir=no],
[bsdi*], [ LIBS="-lm $LIBS"
AC_DEFINE(BROKEN_SETREUID, 1)
AC_DEFINE(BROKEN_SETREGID, 1)
@@ -1258,23 +1030,21 @@ main()
ac_cv_func_shutdown=no
ac_cv_func_close=no
],
-[netbsd*], [ LIBS="-lm $LIBS"
- ],
[dragonfly*], [ LIBS="-lm $LIBS"
# isinf() and isnan() are macros on DragonFly.
ac_cv_func_isinf=yes
ac_cv_func_isnan=yes
],
-[aix*],[ LIBS="-lm $LIBS"
- ac_cv_func_round=no
- ],
[nacl], [
LIBS="-lm $LIBS"
if test "${nacl_cv_build_variant}" = "newlib"; then
RUBY_APPEND_OPTION(CPPFLAGS, -DNACL_NEWLIB)
+ RUBY_APPEND_OPTION(LIBS, '-lnosys')
else
RUBY_APPEND_OPTION(XCFLAGS, -fPIC)
fi
+ ac_cv_func_shutdown=no
+ ac_cv_func_fcntl=no
],
[ LIBS="-lm $LIBS"])
@@ -1288,46 +1058,43 @@ AC_HEADER_DIRENT
dnl AC_HEADER_STDC has been checked in AC_USE_SYSTEM_EXTENSIONS
AC_HEADER_STDBOOL
AC_HEADER_SYS_WAIT
-
-AC_CHECK_HEADERS(a.out.h)
-AC_CHECK_HEADERS(atomic.h)
-AC_CHECK_HEADERS(direct.h)
-AC_CHECK_HEADERS(grp.h)
-AC_CHECK_HEADERS(fcntl.h)
-AC_CHECK_HEADERS(float.h)
-AC_CHECK_HEADERS(ieeefp.h)
-AC_CHECK_HEADERS(intrinsics.h)
-AC_CHECK_HEADERS(langinfo.h)
-AC_CHECK_HEADERS(limits.h)
-AC_CHECK_HEADERS(locale.h)
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(malloc/malloc.h)
-AC_CHECK_HEADERS(malloc_np.h)
-AC_CHECK_HEADERS(net/socket.h)
-AC_CHECK_HEADERS(process.h)
-AC_CHECK_HEADERS(pwd.h)
-AC_CHECK_HEADERS(setjmpex.h)
-AC_CHECK_HEADERS(sys/attr.h)
-AC_CHECK_HEADERS(sys/fcntl.h)
-AC_CHECK_HEADERS(sys/file.h)
-AC_CHECK_HEADERS(sys/id.h)
-AC_CHECK_HEADERS(sys/ioctl.h)
-AC_CHECK_HEADERS(sys/mkdev.h)
-AC_CHECK_HEADERS(sys/param.h)
-AC_CHECK_HEADERS(sys/prctl.h)
-AC_CHECK_HEADERS(sys/resource.h)
-AC_CHECK_HEADERS(sys/select.h)
-AC_CHECK_HEADERS(sys/sendfile.h)
-AC_CHECK_HEADERS(sys/socket.h)
-AC_CHECK_HEADERS(sys/syscall.h)
-AC_CHECK_HEADERS(sys/time.h)
-AC_CHECK_HEADERS(sys/times.h)
-AC_CHECK_HEADERS(sys/uio.h)
-AC_CHECK_HEADERS(sys/utime.h)
-AC_CHECK_HEADERS(syscall.h)
-AC_CHECK_HEADERS(time.h)
-AC_CHECK_HEADERS(ucontext.h)
-AC_CHECK_HEADERS(utime.h)
+AC_CHECK_HEADERS( \
+ limits.h \
+ sys/file.h \
+ sys/ioctl.h \
+ sys/syscall.h \
+ fcntl.h \
+ sys/fcntl.h \
+ sys/select.h \
+ sys/time.h \
+ sys/times.h \
+ sys/param.h \
+ syscall.h \
+ pwd.h \
+ grp.h \
+ a.out.h \
+ utime.h \
+ direct.h \
+ sys/resource.h \
+ sys/mkdev.h \
+ sys/utime.h \
+ float.h \
+ ieeefp.h \
+ ucontext.h \
+ intrinsics.h \
+ langinfo.h \
+ locale.h \
+ sys/sendfile.h \
+ time.h \
+ net/socket.h \
+ sys/socket.h \
+ process.h \
+ sys/prctl.h \
+ atomic.h \
+ malloc.h \
+ malloc_np.h \
+ setjmpex.h
+)
AC_ARG_WITH([gmp],
[AS_HELP_STRING([--without-gmp],
@@ -1337,87 +1104,25 @@ AC_ARG_WITH([gmp],
AS_IF([test "x$with_gmp" != xno],
[AC_CHECK_HEADERS(gmp.h)
AS_IF([test "x$ac_cv_header_gmp_h" != xno],
- AC_SEARCH_LIBS([__gmpz_init], [gmp],
- [AC_DEFINE(HAVE_LIBGMP, 1)]))])
-
-AC_ARG_WITH([jemalloc],
- [AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])],
- [with_jemalloc=$withval], [with_jemalloc=no])
-AS_IF([test "x$with_jemalloc" = xyes],[
- AC_SEARCH_LIBS([malloc_conf], [jemalloc],
- [AC_DEFINE(HAVE_LIBJEMALLOC, 1)], [with_jemalloc=no])
- AC_CHECK_HEADER(jemalloc/jemalloc.h, [
- AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, [<jemalloc/jemalloc.h>])
- ])
- AS_IF([test "x$with_jemalloc" = xno], [
- AC_CACHE_CHECK([for jemalloc with JEMALLOC_MANGLE], rb_cv_jemalloc_demangle,
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@define JEMALLOC_MANGLE 1
- @%:@ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
- @%:@include RUBY_ALTERNATIVE_MALLOC_HEADER
- @%:@else
- @%:@include <jemalloc.h>
- @%:@endif], [return !&malloc_conf])],
- [rb_cv_jemalloc_demangle=yes],
- [rb_cv_jemalloc_demangle=no])
- ])
- ])
- AS_IF([test "x$rb_cv_jemalloc_demangle" = xyes], [
- AC_DEFINE(JEMALLOC_MANGLE)
- with_jemalloc=yes
- ])
- AS_IF([test "x$with_jemalloc" = xyes],
- [
- ac_cv_func_malloc_usable_size=yes
- ],
- [AC_MSG_ERROR([jemalloc requested but not found])
- ])
-])
+ AC_CHECK_LIB([gmp], [__gmpz_init]))
+ with_gmp="$ac_cv_lib_gmp___gmpz_init"
+ AS_IF([test -z "$with_gmp"], [with_gmp=no])])
dnl check for large file stuff
mv confdefs.h confdefs1.h
: > confdefs.h
AC_SYS_LARGEFILE
-# On 32-bit Solaris, it is safe to define _LARGEFILE_SOURCE
-# which is not added by AC_SYS_LARGEFILE.
-if test x"$enable_largefile" != xno; then
- AS_CASE(["$target_os"], [solaris*], [
- AC_MSG_CHECKING([wheather _LARGEFILE_SOURCE should be defined])
- AS_CASE(["${ac_cv_sys_file_offset_bits}:${ac_cv_sys_large_files}"],
- ["64:"|"64:no"|"64:unknown"], [
- # insert _LARGEFILE_SOURCE before _FILE_OFFSET_BITS line
- # that is the same order as "getconf LFS_CFLAGS" output
- mv confdefs.h largefile0.h
- : > confdefs.h
- AC_DEFINE(_LARGEFILE_SOURCE)
- cat largefile0.h >> confdefs.h
- rm largefile0.h
- AC_MSG_RESULT([yes])
- ], [AC_MSG_RESULT([no])])
- ])
-fi
mv confdefs.h largefile.h
mv confdefs1.h confdefs.h
cat largefile.h >> confdefs.h
-AS_CASE(["$target_os"],
- [mingw*], [ac_cv_type_off_t=yes;ac_cv_sizeof_off_t=8],
- [aix*], [
- AS_CASE(["$target_cpu:$ac_cv_sys_large_files"],
- [ppc64:*|powerpc64:*], [],
- [*:no|*:unknown], [],
- [
- # AIX currently does not support a 32-bit call to posix_fadvise()
- # if _LARGE_FILES is defined.
- ac_cv_func_posix_fadvise=no
- ])
- ])
+AS_CASE(["$target_os"],[mingw*], [ac_cv_type_off_t=yes;ac_cv_sizeof_off_t=8])
AC_C_BIGENDIAN
AC_C_CONST
AC_C_CHAR_UNSIGNED
AC_C_INLINE
AC_C_VOLATILE
-AC_C_TYPEOF
AS_CASE(":$ac_cv_c_const:$ac_cv_c_volatile:",
[*:no:*], [AC_MSG_ERROR(ANSI C-conforming const and volatile are mandatory)])
@@ -1516,6 +1221,7 @@ RUBY_CHECK_SIZEOF(short)
RUBY_CHECK_SIZEOF(long, [int], [ILP LP])
RUBY_CHECK_SIZEOF(long long)
RUBY_CHECK_SIZEOF(__int64)
+RUBY_CHECK_SIZEOF(__int128)
RUBY_CHECK_SIZEOF(off_t)
RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP])
RUBY_CHECK_SIZEOF(float)
@@ -1523,29 +1229,10 @@ RUBY_CHECK_SIZEOF(double)
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
RUBY_CHECK_SIZEOF(clock_t, [], [], [@%:@include <time.h>])
-AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct,
- [rb_cv_packed_struct=no
- for mac in \
- "__pragma(pack(push, 1)) x __pragma(pack(pop))" \
- "x __attribute__((packed))" \
- ; do
- AC_TRY_COMPILE([@%:@define PACKED_STRUCT(x) $mac
- PACKED_STRUCT(struct { int a; });], [],
- [rb_cv_packed_struct=$mac; break])
- done])
-packed_struct_unaligned=x
-if test "$rb_cv_packed_struct" != no; then
- AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], [$rb_cv_packed_struct])
-else
- AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], x)
-fi
-AC_DEFINE_UNQUOTED(PACKED_STRUCT_UNALIGNED(x), $packed_struct_unaligned)
-
AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[
[rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE]
- RUBY_WERROR_FLAG(RUBY_APPEND_OPTIONS(CFLAGS, $rb_cv_wsuppress_flags)
- for pri in $2; do
+ RUBY_WERROR_FLAG(for pri in $2; do
AC_TRY_COMPILE(
[@%:@include <stdio.h>
@%:@include <stddef.h>
@@ -1613,16 +1300,7 @@ AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
[
t=INT])
rb_cv_[$1]_convertible=${u}${t}])
- if test "${AS_TR_SH(ac_cv_type_[$1])}" = "yes"; then
- n="$1"
- else
- AS_CASE(["${rb_cv_[$1]_convertible}"],
- [*LL], [n="long long"],
- [*LONG], [n="long"],
- [n="int"])
- AS_CASE(["${rb_cv_[$1]_convertible}"],
- [U*], [n="unsigned $n"])
- fi
+ test "${AS_TR_SH(ac_cv_type_[$1])}" = "yes" && n="$1"
AS_CASE("${rb_cv_[$1]_convertible}", [U*], [u=+1], [u=-1])
AC_DEFINE_UNQUOTED(rb_[$1], $n)
AC_DEFINE_UNQUOTED([SIGNEDNESS_OF_]AS_TR_CPP($1), $u)
@@ -1744,81 +1422,48 @@ EOH
])dnl
])dnl
-dnl RUBY_DECL_ATTRIBUTE(attrib, macroname, cachevar, condition, type, code)
-AC_DEFUN([RUBY_DECL_ATTRIBUTE], [dnl
+dnl RUBY_FUNC_ATTRIBUTE(attrib, macroname, cachevar, condition)
+AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
m4_ifval([$2], dnl
- [AS_VAR_PUSHDEF([attrib], m4_bpatsubst([$2], [(.*)], []))], dnl
- [AS_VAR_PUSHDEF([attrib], m4_toupper(m4_format(%.4s, [$5]))[_]AS_TR_CPP($1))] dnl
+ [AS_VAR_PUSHDEF([attrib],[$2])], dnl
+ [AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
)dnl
m4_ifval([$3], dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
- [AS_VAR_PUSHDEF([rbcv],[rb_cv_]m4_format(%.4s, [$5])[_][$1])]dnl
+ [AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
)dnl
-m4_pushdef([attrib_code],[m4_bpatsubst([$1],["],[\\"])])dnl
-m4_pushdef([attrib_params],[m4_bpatsubst([$2(x)],[^[^()]*(\([^()]*\)).*],[\1])])dnl
m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond])
-AC_CACHE_CHECK(for m4_ifval([$2],[m4_bpatsubst([$2], [(.*)], [])],[$1]) [$5] attribute, rbcv, dnl
+AC_CACHE_CHECK(for [$1] function attribute, rbcv,
[rbcv=x
RUBY_WERROR_FLAG([
-for mac in \
- "__attribute__ ((attrib_code)) x" \
- "x __attribute__ ((attrib_code))" \
- "__declspec(attrib_code) x" \
- x; do
+for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
m4_ifval([$4],mac="$mac"${rbcv_cond+" /* only if $rbcv_cond */"})
AC_TRY_COMPILE(
m4_ifval([$4],${rbcv_cond+[@%:@if ]$rbcv_cond})
-[@%:@define ]attrib[](attrib_params)[ $mac]
+[@%:@define ]attrib[(x) $mac]
m4_ifval([$4],${rbcv_cond+[@%:@else]}
-${rbcv_cond+[@%:@define ]attrib[](attrib_params)[ x]}
+${rbcv_cond+[@%:@define ]attrib[(x) x]}
${rbcv_cond+[@%:@endif]})
-$6
- attrib[](attrib_params)[;], [],
+ attrib[(void conftest_attribute_check(void));], [],
[rbcv="$mac"; break])
done
])])
if test "$rbcv" != x; then
- RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[](attrib_params)[], $rbcv)
+ RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[(x)], $rbcv)
fi
-m4_ifval([$4], [unset rbcv_cond]) dnl
-m4_popdef([attrib_params])dnl
-m4_popdef([attrib_code])dnl
+m4_ifval([$4], [unset rbcv_cond])dnl
AS_VAR_POPDEF([attrib])dnl
AS_VAR_POPDEF([rbcv])dnl
])
-dnl RUBY_FUNC_ATTRIBUTE(attrib, macroname, cachevar, condition)
-AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
- RUBY_DECL_ATTRIBUTE([$1], [$2], [$3], [$4],
- [function], [@%:@define x void conftest_attribute_check(void)]
- )
-])
-
-dnl RUBY_TYPE_ATTRIBUTE(attrib, macroname, cachevar, condition)
-AC_DEFUN([RUBY_TYPE_ATTRIBUTE], [dnl
- RUBY_DECL_ATTRIBUTE([$1], [$2], [$3], [$4],
- [type], [
-@%:@define x struct conftest_attribute_check {int i;}
-@%:@define mesg ("")
-])
-])
-
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
RUBY_FUNC_ATTRIBUTE(deprecated, DEPRECATED)
-RUBY_FUNC_ATTRIBUTE(deprecated("by "@%:@n), DEPRECATED_BY(n,x), rb_cv_func_deprecated_by)
-RUBY_TYPE_ATTRIBUTE(deprecated mesg, DEPRECATED_TYPE(mesg,x), rb_cv_type_deprecated)
RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
-RUBY_FUNC_ATTRIBUTE(weak, WEAK, rb_cv_func_weak)
-if test "$rb_cv_func_weak" != x; then
- AC_DEFINE(HAVE_FUNC_WEAK)
-fi
if_i386=${universal_binary+[defined __i386__]}
RUBY_FUNC_ATTRIBUTE(stdcall, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(cdecl, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(fastcall, [], [], ${if_i386})
-RUBY_FUNC_ATTRIBUTE(optimize("O0"), FUNC_UNOPTIMIZED, rb_cv_func_unoptimized)
-RUBY_FUNC_ATTRIBUTE(optimize("-Os","-fomit-frame-pointer"), FUNC_MINIMIZED, rb_cv_func_minimized)
if test "$GCC" = yes; then
AC_CACHE_CHECK([for function alias], [rb_cv_gcc_function_alias],
@@ -1835,42 +1480,24 @@ if test "$GCC" = yes; then
AC_DEFINE_UNQUOTED([RUBY_ALIAS_FUNCTION_VOID(prot, name, args)],
[RUBY_ALIAS_FUNCTION_TYPE(void, prot, name, args)])
fi
-
- AC_CACHE_CHECK([for __atomic builtins], [rb_cv_gcc_atomic_builtins], [
- AC_TRY_LINK([unsigned char atomic_var;],
- [
- __atomic_exchange_n(&atomic_var, 0, __ATOMIC_SEQ_CST);
- __atomic_exchange_n(&atomic_var, 1, __ATOMIC_SEQ_CST);
- __atomic_fetch_add(&atomic_var, 1, __ATOMIC_SEQ_CST);
- __atomic_fetch_sub(&atomic_var, 1, __ATOMIC_SEQ_CST);
- __atomic_or_fetch(&atomic_var, 1, __ATOMIC_SEQ_CST);
- ],
- [rb_cv_gcc_atomic_builtins=yes],
- [rb_cv_gcc_atomic_builtins=no])])
- if test "$rb_cv_gcc_atomic_builtins" = yes; then
- AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
- fi
-
- AC_CACHE_CHECK([for __sync builtins], [rb_cv_gcc_sync_builtins], [
+ AC_CACHE_CHECK([for atomic builtins], [rb_cv_gcc_atomic_builtins], [
AC_TRY_LINK([unsigned char atomic_var;],
[
__sync_lock_test_and_set(&atomic_var, 0);
__sync_lock_test_and_set(&atomic_var, 1);
__sync_fetch_and_add(&atomic_var, 1);
__sync_fetch_and_sub(&atomic_var, 1);
- __sync_or_and_fetch(&atomic_var, 1);
- __sync_val_compare_and_swap(&atomic_var, 0, 1);
],
- [rb_cv_gcc_sync_builtins=yes],
- [rb_cv_gcc_sync_builtins=no])])
- if test "$rb_cv_gcc_sync_builtins" = yes; then
- AC_DEFINE(HAVE_GCC_SYNC_BUILTINS)
+ [rb_cv_gcc_atomic_builtins=yes],
+ [rb_cv_gcc_atomic_builtins=no])])
+ if test "$rb_cv_gcc_atomic_builtins" = yes; then
+ AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
fi
AC_CACHE_CHECK(for __builtin_unreachable, rb_cv_func___builtin_unreachable,
[RUBY_WERROR_FLAG(
- [AC_TRY_LINK([volatile int zero;],
- [if (zero) __builtin_unreachable();],
+ [AC_TRY_LINK([@%:@include <stdlib.h>],
+ [exit(0); __builtin_unreachable();],
[rb_cv_func___builtin_unreachable=yes],
[rb_cv_func___builtin_unreachable=no])
])
@@ -1911,32 +1538,6 @@ if test "$rb_cv_function_name_string" != no; then
AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string])
fi
-AC_CACHE_CHECK(if enum over int is allowed, rb_cv_enum_over_int, [
- rb_cv_enum_over_int=no
- if test "x$ac_cv_type_long_long" = xyes; then
- type="unsigned long long" max="ULLONG_MAX"
- else
- type="unsigned long" max="ULONG_MAX"
- fi
- RUBY_WERROR_FLAG([
- AC_COMPILE_IFELSE([
- AC_LANG_BOOL_COMPILE_TRY([
- @%:@include <limits.h>
- enum {conftest_max = $max};
- ], [
- (conftest_max == $max) &&
- (sizeof(conftest_max) == sizeof($type))
- ]
- )],
- [rb_cv_enum_over_int=yes],
- [rb_cv_enum_over_int=no]
- )
- ])
-])
-if test $rb_cv_enum_over_int = yes; then
- AC_DEFINE(ENUM_OVER_INT, 1)
-fi
-
dnl Check whether we need to define sys_nerr locally
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
@%:@include <errno.h>])
@@ -1970,11 +1571,10 @@ RUBY_CHECK_PRINTF_PREFIX(ptrdiff_t, t)
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
-RUBY_CHECK_SIZEOF([struct stat.st_size], [off_t int long "long long"], [], [@%:@include <sys/stat.h>])
+RUBY_CHECK_SIZEOF([struct stat.st_size], [int long "long long"], [], [@%:@include <sys/stat.h>])
if test "$ac_cv_member_struct_stat_st_blocks" = yes; then
- RUBY_CHECK_SIZEOF([struct stat.st_blocks], [off_t int long "long long"], [], [@%:@include <sys/stat.h>])
+ RUBY_CHECK_SIZEOF([struct stat.st_blocks], [int long "long long"], [], [@%:@include <sys/stat.h>])
fi
-RUBY_CHECK_SIZEOF([struct stat.st_ino], [long "long long"], [], [@%:@include <sys/stat.h>])
AC_CHECK_MEMBERS([struct stat.st_atim])
AC_CHECK_MEMBERS([struct stat.st_atimespec])
AC_CHECK_MEMBERS([struct stat.st_atimensec])
@@ -1984,7 +1584,6 @@ AC_CHECK_MEMBERS([struct stat.st_mtimensec])
AC_CHECK_MEMBERS([struct stat.st_ctim])
AC_CHECK_MEMBERS([struct stat.st_ctimespec])
AC_CHECK_MEMBERS([struct stat.st_ctimensec])
-AC_CHECK_MEMBERS([struct stat.st_birthtimespec])
AC_CHECK_TYPES([struct timeval], [], [], [@%:@ifdef HAVE_TIME_H
@%:@include <time.h>
@@ -2051,6 +1650,7 @@ typedef $1 t; int s = sizeof(t) == 42;])],
["$ac_cv_sizeof_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long"],
["$ac_cv_sizeof_long_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long long"],
["$ac_cv_sizeof___int64"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int64"],
+ ["$ac_cv_sizeof___int128"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int128"],
[ rb_cv_type_$1=no])])])
if test "${rb_cv_type_$1}" != no; then
AC_DEFINE([HAVE_]AS_TR_CPP($1), 1)
@@ -2072,6 +1672,8 @@ RUBY_DEFINT(int32_t, 4)
RUBY_DEFINT(uint32_t, 4, unsigned)
RUBY_DEFINT(int64_t, 8)
RUBY_DEFINT(uint64_t, 8, unsigned)
+RUBY_DEFINT(int128_t, 16)
+RUBY_DEFINT(uint128_t, 16, unsigned)
RUBY_DEFINT(intptr_t, void*)
RUBY_DEFINT(uintptr_t, void*, unsigned)
RUBY_DEFINT(ssize_t, size_t, [], [@%:@include <sys/types.h>]) dnl may differ from int, so not use AC_TYPE_SSIZE_T.
@@ -2181,29 +1783,10 @@ AS_CASE(["$target_os"],[freebsd*],[
AC_DEFINE(BROKEN_CLOSE)
AC_REPLACE_FUNCS(close)
])
-
-AC_REPLACE_FUNCS(acosh)
-AC_REPLACE_FUNCS(cbrt)
-AC_REPLACE_FUNCS(crypt)
-AC_REPLACE_FUNCS(dup2)
-AC_REPLACE_FUNCS(erf)
-AC_REPLACE_FUNCS(explicit_bzero)
-AC_REPLACE_FUNCS(ffs)
-AC_REPLACE_FUNCS(finite)
-AC_REPLACE_FUNCS(flock)
-AC_REPLACE_FUNCS(hypot)
-AC_REPLACE_FUNCS(isinf)
-AC_REPLACE_FUNCS(isnan)
-AC_REPLACE_FUNCS(lgamma_r)
-AC_REPLACE_FUNCS(memmove)
-AC_REPLACE_FUNCS(nextafter)
-AC_REPLACE_FUNCS(setproctitle)
-AC_REPLACE_FUNCS(strchr)
-AC_REPLACE_FUNCS(strerror)
-AC_REPLACE_FUNCS(strlcat)
-AC_REPLACE_FUNCS(strlcpy)
-AC_REPLACE_FUNCS(strstr)
-AC_REPLACE_FUNCS(tgamma)
+AC_REPLACE_FUNCS(dup2 memmove strerror\
+ strchr strstr crypt flock\
+ isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt \
+ strlcpy strlcat ffs setproctitle)
# for missing/setproctitle.c
AS_CASE(["$target_os"],
@@ -2225,51 +1808,17 @@ else
AC_LIBOBJ([signbit])
fi
-AC_CACHE_CHECK(for broken memmem, rb_cv_broken_memmem, [
- AC_TRY_RUN([
-@%:@include <string.h>
-
-int
-main(int argc, char **argv)
-{
- const char *str = "hogefugafoobar";
- const char *rs = "foo";
- const char *empty = "";
- char *p;
-
- p = memmem(str, strlen(str), rs, strlen(rs));
- if (p == str+8) {
- p = memmem(str, strlen(str), empty, strlen(empty));
- if (p == str)
- return 0;
- }
- return 1;
-}
- ],
- rb_cv_broken_memmem=no,
- rb_cv_broken_memmem=yes,
- rb_cv_broken_memmem=yes)
-])
-test x"$rb_cv_broken_memmem" = xyes && ac_cv_func_memmem=no
-
-AC_FUNC_FORK
-
AC_CHECK_FUNCS(__syscall)
AC_CHECK_FUNCS(_longjmp) # used for AC_ARG_WITH(setjmp-type)
-# we don't use _setjmp if _longjmp doesn't exist.
-test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
AC_CHECK_FUNCS(_setjmp) # used for AC_ARG_WITH(setjmp-type)
AC_CHECK_FUNCS(_setjmpex) # used for AC_ARG_WITH(setjmp-type)
-AC_CHECK_FUNCS(atan2l atan2f)
AC_CHECK_FUNCS(chroot)
AC_CHECK_FUNCS(chsize)
AC_CHECK_FUNCS(clock_gettime)
AC_CHECK_FUNCS(cosh)
AC_CHECK_FUNCS(daemon)
-AC_CHECK_FUNCS(dirfd)
AC_CHECK_FUNCS(dl_iterate_phdr)
AC_CHECK_FUNCS(dlopen)
-AC_CHECK_FUNCS(dladdr)
AC_CHECK_FUNCS(dup)
AC_CHECK_FUNCS(dup3)
AC_CHECK_FUNCS(eaccess)
@@ -2278,31 +1827,24 @@ AC_CHECK_FUNCS(fchmod)
AC_CHECK_FUNCS(fchown)
AC_CHECK_FUNCS(fcntl)
AC_CHECK_FUNCS(fdatasync)
-AC_CHECK_FUNCS(fgetattrlist)
AC_CHECK_FUNCS(fmod)
+AC_CHECK_FUNCS(fork)
AC_CHECK_FUNCS(fsync)
AC_CHECK_FUNCS(ftruncate)
AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform
-AC_CHECK_FUNCS(getattrlist)
AC_CHECK_FUNCS(getcwd)
-AC_CHECK_FUNCS(getgidx)
-AC_CHECK_FUNCS(getgrnam)
AC_CHECK_FUNCS(getgrnam_r)
AC_CHECK_FUNCS(getgroups)
AC_CHECK_FUNCS(getpgid)
AC_CHECK_FUNCS(getpgrp)
AC_CHECK_FUNCS(getpriority)
AC_CHECK_FUNCS(getpwnam_r)
-AC_CHECK_FUNCS(getresgid)
-AC_CHECK_FUNCS(getresuid)
AC_CHECK_FUNCS(getrlimit)
AC_CHECK_FUNCS(getsid)
AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday
-AC_CHECK_FUNCS(getuidx)
AC_CHECK_FUNCS(gmtime_r)
AC_CHECK_FUNCS(initgroups)
AC_CHECK_FUNCS(ioctl)
-AC_CHECK_FUNCS(isfinite)
AC_CHECK_FUNCS(issetugid)
AC_CHECK_FUNCS(killpg)
AC_CHECK_FUNCS(lchmod)
@@ -2313,15 +1855,9 @@ AC_CHECK_FUNCS(lockf)
AC_CHECK_FUNCS(log2)
AC_CHECK_FUNCS(lstat)
AC_CHECK_FUNCS(malloc_usable_size)
-AC_CHECK_FUNCS(malloc_size)
AC_CHECK_FUNCS(mblen)
AC_CHECK_FUNCS(memalign)
-AC_CHECK_FUNCS(memset_s)
-AC_CHECK_FUNCS(writev)
AC_CHECK_FUNCS(memrchr)
-AC_CHECK_FUNCS(memmem)
-AC_CHECK_FUNCS(mkfifo)
-AC_CHECK_FUNCS(mknod)
AC_CHECK_FUNCS(mktime)
AC_CHECK_FUNCS(pipe2)
AC_CHECK_FUNCS(poll)
@@ -2329,10 +1865,8 @@ AC_CHECK_FUNCS(posix_fadvise)
AC_CHECK_FUNCS(posix_memalign)
AC_CHECK_FUNCS(ppoll)
AC_CHECK_FUNCS(pread)
-AC_CHECK_FUNCS(qsort_r)
AC_CHECK_FUNCS(readlink)
AC_CHECK_FUNCS(round)
-AC_CHECK_FUNCS(sched_getaffinity)
AC_CHECK_FUNCS(seekdir)
AC_CHECK_FUNCS(select_large_fdset)
AC_CHECK_FUNCS(sendfile)
@@ -2373,159 +1907,20 @@ AC_CHECK_FUNCS(utimes)
AC_CHECK_FUNCS(wait4)
AC_CHECK_FUNCS(waitpid)
-AS_IF([test "$ac_cv_func_memset_s" = yes],
- [RUBY_DEFINE_IF([!defined __STDC_WANT_LIB_EXT1__], [__STDC_WANT_LIB_EXT1__], 1)])
-
-AS_IF([test "$ac_cv_func_getcwd" = yes], [
- AC_CACHE_CHECK(if getcwd allocates buffer if NULL is given, [rb_cv_getcwd_malloc],
- [AC_TRY_RUN([
-@%:@include <stddef.h>
-@%:@include <stdio.h>
-@%:@ifdef HAVE_UNISTD_H
-@%:@include <unistd.h>
-@%:@endif
-@%:@ifndef EXIT_SUCCESS
-@%:@define EXIT_SUCCESS 0
-@%:@endif
-@%:@ifndef EXIT_FAILURE
-@%:@define EXIT_FAILURE 1
-@%:@endif
-
-int
-main(int argc, char **argv)
-{
- if (!getcwd(NULL, 0)) return EXIT_FAILURE;
- return EXIT_SUCCESS;
-}
-],
- rb_cv_getcwd_malloc=yes,
- rb_cv_getcwd_malloc=no,
- AS_CASE($target_os,
- [linux*|darwin*|*bsd|cygwin*|mingw*|mswin*],
- [rb_cv_getcwd_malloc=yes],
- [rb_cv_getcwd_malloc=no]))])
- AS_IF([test "$rb_cv_getcwd_malloc" = no], [AC_DEFINE(NO_GETCWD_MALLOC, 1)])
-])
-
AC_DEFUN([RUBY_CHECK_BUILTIN_FUNC], [dnl
AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_builtin_$1),
[AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([int foo;], [$2;])],
+ [AC_LANG_PROGRAM([], [$2;])],
[AS_TR_SH(rb_cv_builtin_$1)=yes],
[AS_TR_SH(rb_cv_builtin_$1)=no])])
if test "${AS_TR_SH(rb_cv_builtin_$1)}" != no; then
AC_DEFINE(AS_TR_CPP(HAVE_BUILTIN_$1))
fi])
-RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap16, [__builtin_bswap16(0)])
RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap32, [__builtin_bswap32(0)])
RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap64, [__builtin_bswap64(0)])
RUBY_CHECK_BUILTIN_FUNC(__builtin_clz, [__builtin_clz(0)])
RUBY_CHECK_BUILTIN_FUNC(__builtin_clzl, [__builtin_clzl(0)])
RUBY_CHECK_BUILTIN_FUNC(__builtin_clzll, [__builtin_clzll(0)])
-RUBY_CHECK_BUILTIN_FUNC(__builtin_choose_expr, [
- [int x[__extension__(__builtin_choose_expr(1, 1, -1))]];
- [int y[__extension__(__builtin_choose_expr(0, -1, 1))]];
- ])
-if test x$rb_cv_builtin___builtin_choose_expr = xyes; then
- RUBY_CHECK_BUILTIN_FUNC(__builtin_choose_expr_constant_p, [
- [int x[__extension__(__builtin_choose_expr(__builtin_constant_p(1), 1, -1))]];
- [int y[__extension__(__builtin_choose_expr(__builtin_constant_p(foo), -1, 1))]];
- ])
-fi
-RUBY_CHECK_BUILTIN_FUNC(__builtin_types_compatible_p, [__builtin_types_compatible_p(int, int)])
-
-if test "$ac_cv_func_qsort_r" != no; then
- AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r,
- [AC_TRY_COMPILE([
-@%:@include <stdlib.h>
-void qsort_r(void *base, size_t nmemb, size_t size,
- int (*compar)(const void *, const void *, void *),
- void *arg);
-],[ ],
- [rb_cv_gnu_qsort_r=yes],
- [rb_cv_gnu_qsort_r=no])
- ])
- AC_CACHE_CHECK(whether qsort_r is BSD version, rb_cv_bsd_qsort_r,
- [AC_TRY_COMPILE([
-@%:@include <stdlib.h>
-void qsort_r(void *base, size_t nmemb, size_t size,
- void *arg, int (*compar)(void *, const void *, const void *));
-],[ ],
- [rb_cv_bsd_qsort_r=yes],
- [rb_cv_bsd_qsort_r=no])
- ])
- AS_CASE("$rb_cv_gnu_qsort_r:$rb_cv_bsd_qsort_r",
- [yes:no], [
- AC_DEFINE(HAVE_GNU_QSORT_R, 1)
- ],
- [no:yes], [
- AC_DEFINE(HAVE_BSD_QSORT_R, 1)
- ])
-fi
-
-AC_CACHE_CHECK(whether atan2 handles Inf as C99, rb_cv_atan2_inf_c99, [
- AS_IF([test $ac_cv_func_atan2f:$ac_cv_func_atan2l = yes:yes], [
- AC_TRY_RUN([
-@%:@include <math.h>
-@%:@ifdef HAVE_UNISTD_H
-@%:@include <unistd.h>
-@%:@endif
-@%:@ifndef EXIT_SUCCESS
-@%:@define EXIT_SUCCESS 0
-@%:@endif
-@%:@ifndef EXIT_FAILURE
-@%:@define EXIT_FAILURE 1
-@%:@endif
-
-int
-main(int argc, char **argv)
-{
- if (fabs(atan2(INFINITY, INFINITY) - M_PI_4) <= 0.01) return EXIT_SUCCESS;
- return EXIT_FAILURE;
-}
-],
- [rb_cv_atan2_inf_c99=yes],
- [rb_cv_atan2_inf_c99=no],
- [AS_CASE($target_os, [mingw*|mswin*], [rb_cv_atan2_inf_c99=no], [rb_cv_atan2_inf_c99=yes])]
- )
- ], [rb_cv_atan2_inf_c99=no])
-])
-AS_IF([test "x$rb_cv_atan2_inf_c99" = xyes], [AC_DEFINE(ATAN2_INF_C99)])
-
-AS_IF([test "x$ac_cv_func_lgamma_r" = xyes], [
- AC_CACHE_CHECK(whether lgamma_r handles -0.0, rb_cv_lgamma_r_m0, [
- AC_TRY_RUN([
-@%:@include <math.h>
-@%:@ifdef HAVE_UNISTD_H
-@%:@include <unistd.h>
-@%:@endif
-@%:@ifndef EXIT_SUCCESS
-@%:@define EXIT_SUCCESS 0
-@%:@endif
-@%:@ifndef EXIT_FAILURE
-@%:@define EXIT_FAILURE 1
-@%:@endif
-
-int
-main(int argc, char **argv)
-{
- int sign;
- double x = lgamma_r(-0.0, &sign);
-
- /* should be [+inf, -1] */
- if (x <= 0) return EXIT_FAILURE;
- if (!isinf(x)) return EXIT_FAILURE;
- if (sign != -1) return EXIT_FAILURE;
- return EXIT_SUCCESS;
-}
-],
- [rb_cv_lgamma_r_m0=yes],
- [rb_cv_lgamma_r_m0=no],
- [rb_cv_lgamma_r_m0=yes]
- )
- ])
- AS_IF([test "x$rb_cv_lgamma_r_m0" = xno], [AC_DEFINE(LGAMMA_R_M0_FIX)])
-])
# Some platform need -lrt for clock_gettime, but the other don't.
if test x"$ac_cv_func_clock_gettime" != xyes; then
@@ -2556,32 +1951,17 @@ AC_CACHE_CHECK(for sigsetjmp as a macro or function, ac_cv_func_sigsetjmp,
ac_cv_func_sigsetjmp=yes,
ac_cv_func_sigsetjmp=no)])
-AC_DEFUN([RUBY_CHECK_BUILTIN_SETJMP], [
-if test x"${ac_cv_func___builtin_setjmp}" = xyes; then
- unset ac_cv_func___builtin_setjmp
-fi
AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
- [
- ac_cv_func___builtin_setjmp=no
- for cast in "" "(void **)"; do
- RUBY_WERROR_FLAG(
- [AC_TRY_LINK([@%:@include <setjmp.h>
- @%:@include <stdio.h>
- jmp_buf jb;
- void t(void) {__builtin_longjmp($cast jb, 1);}
- int jump(void) {(void)(__builtin_setjmp($cast jb) ? 1 : 0); return 0;}],
- [
- void (*volatile f)(void) = t;
- if (!jump()) printf("%d\n", f != 0);
- ],
- [ac_cv_func___builtin_setjmp="yes with cast ($cast)"])
- ])
- test "$ac_cv_func___builtin_setjmp" = no || break
- done])
+[AC_TRY_LINK([@%:@include <setjmp.h>
+ jmp_buf jb; void t(v) int v; {__builtin_longjmp(jb, v);}],
+ [__builtin_setjmp(jb);],
+ [ac_cv_func___builtin_setjmp=yes],
+ [ac_cv_func___builtin_setjmp=no])
])
-AC_DEFUN([RUBY_SETJMP_TYPE], [
-RUBY_CHECK_BUILTIN_SETJMP
+# we don't use _setjmp if _longjmp doesn't exist.
+test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
+
AC_MSG_CHECKING(for setjmp type)
setjmp_suffix=
AC_ARG_WITH(setjmp-type,
@@ -2595,13 +1975,11 @@ AC_ARG_WITH(setjmp-type,
[setjmpex], [ setjmp_prefix= setjmp_suffix=ex],
[''], [ unset setjmp_prefix],
[ AC_MSG_ERROR(invalid setjmp type: $withval)])], [unset setjmp_prefix])
-setjmp_cast=
if test ${setjmp_prefix+set}; then
if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp${setjmp_suffix} = no; then
AC_MSG_ERROR(${setjmp_prefix}setjmp${setjmp_suffix} is not available)
fi
-elif { AS_CASE("$ac_cv_func___builtin_setjmp", [yes*], [true], [false]) }; then
- setjmp_cast=`expr "$ac_cv_func___builtin_setjmp" : "yes with cast (\(.*\))"`
+elif test "$ac_cv_func___builtin_setjmp" = yes; then
setjmp_prefix=__builtin_
setjmp_suffix=
elif test "$ac_cv_header_setjmpex_h:$ac_cv_func__setjmpex" = yes:yes; then
@@ -2622,11 +2000,10 @@ if test x$setjmp_prefix = xsig; then
else
unset setjmp_sigmask
fi
-AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+\($setjmp_cast\)})
-AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}($setjmp_cast(env)${setjmp_sigmask+,0})])
-AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp($setjmp_cast(env),val)])
+AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix})
+AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}(env${setjmp_sigmask+,0})])
+AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
-])
# End of setjmp check.
AC_ARG_ENABLE(setreuid,
@@ -2824,14 +2201,6 @@ if test "$ac_cv_func_setpgid:$ac_cv_func_setpgrp" = no:yes; then
AC_FUNC_SETPGRP
fi
-if test x"$ac_cv_func_dirfd" = xno; then
- AS_CASE(["$target_os"],[solaris*],
- [AC_CHECK_MEMBERS([DIR.d_fd, DIR.dd_fd],,,[
-#include <sys/types.h>
-#include <dirent.h>
-])])
-fi
-
if test x"$target_cpu" = xia64; then
AC_LIBOBJ([ia64])
AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
@@ -2857,10 +2226,70 @@ else
AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>(int)(y)) : (x)>>(int)(y)))
fi
+# win32.c still use this. Don't remove it.
+test "$rb_cv_fcnt" = "not found" && rb_cv_fcnt="not found (OK if using GNU libc)"
+AC_CACHE_CHECK([read count field in FILE structures], rb_cv_fcnt,
+[rb_cv_fcnt="not found (OK if using GNU libc)"
+for fcnt in dnl
+ _cnt dnl
+ __cnt dnl
+ _r dnl
+ readCount dnl
+ _rcount dnl for emx0.9c
+; do
+ AC_TRY_COMPILE([#include <stdio.h>
+],
+ [FILE *f = stdin; f->$fcnt = 0;],
+ [rb_cv_fcnt="$fcnt"; break])
+done])
+AS_CASE("$rb_cv_fcnt",
+ ["not found"*], [rb_cv_fcnt="not found"],
+ [AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt)])
+
+# win32.c still use this. Don't remove it.
+AC_CACHE_CHECK([read buffer ptr field in FILE structures], rb_cv_frptr,
+[for frptr in dnl
+ _IO_read_ptr dnl
+ _ptr dnl
+ __ptr dnl
+ bufpos dnl
+ _p dnl
+ __bufpos dnl
+; do
+ AC_TRY_COMPILE([#include <stdio.h>
+],
+ [FILE *f = stdin; char buf[256]; f->$frptr = buf;],
+ rb_cv_frptr="$frptr"; break,
+ rb_cv_frptr="not found")
+done])
+if test "$rb_cv_frptr" != "not found"; then
+ AC_DEFINE_UNQUOTED(FILE_READPTR, $rb_cv_frptr)
+
+ if test "$rb_cv_fcnt" = "not found"; then
+ AC_CACHE_CHECK([read buffer end field in FILE structures], rb_cv_frend,
+ [for frend in dnl
+ _IO_read_end dnl
+ bufread dnl
+ __bufread dnl
+ ; do
+ AC_TRY_COMPILE([#include <stdio.h>
+ ],
+ [FILE *f = stdin; char buf[256]; f->$frend = buf;],
+ rb_cv_frend="$frend"; break,
+ rb_cv_frend="not found")
+ done])
+ if test "$rb_cv_frend" != "not found"; then
+ AC_DEFINE_UNQUOTED(FILE_READEND, $rb_cv_frend)
+ fi
+ fi
+fi
+
if test x"$ac_cv_func_gettimeofday" != xyes; then
AC_MSG_ERROR(gettimeofday() must exist)
fi
+RUBY_CHECK_SIZEOF([struct stat.st_ino], [long "long long"], [], [@%:@include <sys/stat.h>])
+
if test "$ac_cv_func_sysconf" = yes; then
AC_DEFUN([RUBY_CHECK_SYSCONF], [dnl
AC_CACHE_CHECK([whether _SC_$1 is supported], rb_cv_have_sc_[]m4_tolower($1),
@@ -2877,7 +2306,7 @@ if test "$ac_cv_func_sysconf" = yes; then
RUBY_CHECK_SYSCONF(CLK_TCK)
fi
-AC_DEFUN([RUBY_STACK_GROW_DIRECTION], [
+AC_DEFUN(RUBY_STACK_GROW_DIRECTION, [
AS_VAR_PUSHDEF([stack_grow_dir], [rb_cv_stack_grow_dir_$1])
AC_CACHE_CHECK(stack growing direction on $1, stack_grow_dir, [
AS_CASE(["$1"],
@@ -2958,104 +2387,25 @@ if test x"$enable_pthread" = xyes; then
else
AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
fi
- AC_CACHE_CHECK([whether pthread_t is scalar type], [rb_cv_scalar_pthread_t], [
- AC_TRY_COMPILE([
- @%:@include <pthread.h>
- ], [
- pthread_t thread_id;
- thread_id = 0;
- if (!thread_id) return 0;
- ], [rb_cv_scalar_pthread_t=yes], [rb_cv_scalar_pthread_t=no])
- ])
- if test x"$rb_cv_scalar_pthread_t" = xyes; then
- : # RUBY_CHECK_SIZEOF(pthread_t, [void* int long], [], [@%:@include <pthread.h>])
- else
- AC_DEFINE(NON_SCALAR_THREAD_ID)
- fi
AC_CHECK_FUNCS(sched_yield pthread_attr_setinheritsched \
- pthread_attr_get_np pthread_attr_getstack\
+ pthread_getattr_np pthread_attr_get_np pthread_attr_getstack\
pthread_get_stackaddr_np pthread_get_stacksize_np \
thr_stksegment pthread_stackseg_np pthread_getthrds_np \
pthread_cond_init pthread_condattr_setclock pthread_condattr_init \
- pthread_sigmask pthread_setname_np pthread_set_name_np)
- AS_CASE(["$target_os"],[aix*],[ac_cv_func_pthread_getattr_np=no],[AC_CHECK_FUNCS(pthread_getattr_np)])
+ pthread_sigmask)
if test "${host_os}" = "nacl"; then
ac_cv_func_pthread_attr_init=no
else
AC_CHECK_FUNCS(pthread_attr_init)
fi
- set_current_thread_name=
- if test "$ac_cv_func_pthread_setname_np" = yes; then
- AC_CACHE_CHECK([arguments of pthread_setname_np], [rb_cv_func_pthread_setname_np_arguments],
- [rb_cv_func_pthread_setname_np_arguments=
- # Linux,AIX, (pthread_self(), name)
- # NetBSD (pthread_self(), name, \"%s\")
- # Darwin (name)
- for mac in \
- "(pthread_self(), name)" \
- "(pthread_self(), name, \"%s\")" \
- "(name)" \
- ; do
- AC_TRY_COMPILE([
- @%:@include <pthread.h>
- @%:@ifdef HAVE_PTHREAD_NP_H
- @%:@include <pthread_np.h>
- @%:@endif
- @%:@define SET_THREAD_NAME(name) pthread_setname_np${mac}
- ],
- [if (SET_THREAD_NAME("conftest")) return 1;],
- [rb_cv_func_pthread_setname_np_arguments="${mac}"
- break])
- done
- ]
- )
- if test -n "${rb_cv_func_pthread_setname_np_arguments}"; then
- set_current_thread_name="pthread_setname_np${rb_cv_func_pthread_setname_np_arguments}"
- fi
- elif test "$ac_cv_func_pthread_set_name_np" = yes; then
- set_current_thread_name="pthread_set_name_np(pthread_self(), name)"
- fi
- AS_IF([test -n "$set_current_thread_name"], [
- AC_DEFINE_UNQUOTED(SET_CURRENT_THREAD_NAME(name), $set_current_thread_name)
- AS_CASE([$set_current_thread_name],
- [*'pthread_self()'*], [
- set_another_thread_name=`echo "$set_current_thread_name" | sed 's/pthread_self()/thid/'`
- AC_DEFINE_UNQUOTED(SET_ANOTHER_THREAD_NAME(thid,name), $set_another_thread_name)
- ])
- ])
fi
-
-if test x"$ac_cv_header_ucontext_h" = xno; then
- AC_CACHE_CHECK([if signal.h defines ucontext_t], [rb_cv_ucontext_in_signal_h],
- [AC_TRY_COMPILE([@%:@include <signal.h>],
- [size_t size = sizeof(ucontext_t);],
- [rb_cv_ucontext_in_signal_h=yes], [rb_cv_ucontext_in_signal_h=no])])
- if test x"$rb_cv_ucontext_in_signal_h" = xyes; then
- AC_DEFINE_UNQUOTED(UCONTEXT_IN_SIGNAL_H, 1)
- fi
-fi
-if test x"$ac_cv_header_ucontext_h" = xyes -o x"$rb_cv_ucontext_in_signal_h" = xyes; then
- AC_CACHE_CHECK([if mcontext_t is a pointer], [rb_cv_mcontext_t_ptr],
- [AC_TRY_COMPILE([
- @%:@include <signal.h>
- @%:@ifdef HAVE_UCONTEXT_H
- @%:@include <ucontext.h>
- @%:@endif
- mcontext_t test(mcontext_t mc) {return mc+1;}
- ],
- [test(0);],
- [rb_cv_mcontext_t_ptr=yes], [rb_cv_mcontext_t_ptr=no])])
- if test x"$rb_cv_mcontext_t_ptr" = xyes; then
- AC_DEFINE_UNQUOTED(DEFINE_MCONTEXT_PTR(mc, uc), mcontext_t mc = (uc)->uc_mcontext)
- else
- AC_DEFINE_UNQUOTED(DEFINE_MCONTEXT_PTR(mc, uc), mcontext_t *mc = &(uc)->uc_mcontext)
- fi
+if test x"$ac_cv_header_ucontext_h" = xyes; then
if test x"$rb_with_pthread" = xyes; then
AC_CHECK_FUNCS(getcontext setcontext)
fi
fi
-if test "$ac_cv_func_fork_works" = "yes" -a "$rb_with_pthread" = "yes"; then
+if test "$ac_cv_func_fork" = "yes" -a "$rb_with_pthread" = "yes"; then
AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
[AC_TRY_RUN([
#include <stdlib.h>
@@ -3139,8 +2489,8 @@ AC_ARG_WITH(dln-a-out,
AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
[AC_TRY_LINK([],[], [
-AS_CASE(["`head -1 conftest$EXEEXT | tr -dc '\177ELF' | tr '\177' .`"],
-[.ELF*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])],
+AS_CASE(["`head -1 conftest$EXEEXT | cat -e`"],
+['^?ELF'*], [rb_cv_binary_elf=yes], [rb_cv_binary_elf=no])],
rb_cv_binary_elf=no)])
if test "$rb_cv_binary_elf" = yes; then
@@ -3173,9 +2523,9 @@ AC_SUBST(LDSHAREDXX)dnl
AC_SUBST(DLEXT)dnl
AC_SUBST(DLEXT2)dnl
AC_SUBST(LIBEXT)dnl
-AC_SUBST(ASMEXT, S)dnl
STATIC=
+: ${PATHFLAG=''}
if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=unknown
@@ -3191,7 +2541,7 @@ if test "$with_dln_a_out" != yes; then
# mkmf.rb's have_header() to fail if the desired resource happens to be
# installed in the /usr/local tree.
RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)],
- [bsdi*|cygwin*|mingw*|aix*|interix*], [ ],
+ [bsdi*|beos*|haiku*|cygwin*|mingw*|aix*|interix*], [ ],
[
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
else
@@ -3208,14 +2558,20 @@ if test "$with_dln_a_out" != yes; then
AS_HELP_STRING([--enable-rpath], [embed run path into extension libraries.
enabled by default on ELF platforms]),
[enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
+ if test "$enable_rpath" = yes; then
+ RPATHFLAG=" ${linker_flag}-R%1\$-s"
+ fi
AS_CASE(["$target_os"],
[hpux*], [ DLDFLAGS="$DLDFLAGS -E"
: ${LDSHARED='$(LD) -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
: ${LIBPATHENV=SHLIB_PATH}
+ if test "$rb_cv_prog_gnu_ld" = no; then
+ RPATHFLAG=' +b %1$-s'
+ fi
rb_cv_dlopen=yes],
- [solaris*], [ if test "$GCC" = yes; then
+ [solaris*], [ if test "$GCC" = yes; then
: ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_prog_gnu_ld" = yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
@@ -3225,10 +2581,6 @@ if test "$with_dln_a_out" != yes; then
fi
if test "$ac_cv_sizeof_voidp" = 8; then
: ${LIBPATHENV=LD_LIBRARY_PATH_64}
- : ${PRELOADENV=LD_PRELOAD_64}
- else
- : ${LIBPATHENV=LD_LIBRARY_PATH_32}
- : ${PRELOADENV=LD_PRELOAD_32}
fi
rb_cv_dlopen=yes],
[sunos*], [ : ${LDSHARED='$(LD) -assert nodefinitions'}
@@ -3246,7 +2598,7 @@ if test "$with_dln_a_out" != yes; then
[bsdi3*], [ AS_CASE(["$CC"],
[*shlicc*], [ : ${LDSHARED='$(CC) -r'}
rb_cv_dlopen=yes])],
- [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*], [
+ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
: ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
@@ -3260,7 +2612,7 @@ if test "$with_dln_a_out" != yes; then
: ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -rdynamic"
- DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
+ DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
else
test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
fi
@@ -3271,9 +2623,17 @@ if test "$with_dln_a_out" != yes; then
fi
rb_cv_dlopen=yes],
[darwin*], [ : ${LDSHARED='$(CC) -dynamic -bundle'}
+ : ${DLDFLAGS="${linker_flag}-undefined${linker_flag:+,}dynamic_lookup ${linker_flag}-multiply_defined${linker_flag:+,}suppress"}
: ${LDFLAGS=""}
: ${LIBPATHENV=DYLD_LIBRARY_PATH}
- : ${PRELOADENV=DYLD_INSERT_LIBRARIES}
+ # /usr/local/include is always searched for
+ # some reason, but /usr/local/lib is not.
+ hdr=`find /usr/local/include -name \*.h -type f | sed 's:^/usr/local/include/::;q'`
+ if test -n "$hdr" && $CC -E -include "$hdr" -xc - </dev/null 2>/dev/null | fgrep -q "$hdr"; then
+ $CC -print-search-dirs | grep -q '^libraries:.*:/usr/local/lib/*' ||
+ echo " $LDFLAGS " | grep -q ' -L */usr/local/lib/* ' ||
+ LDFLAGS="${LDFLAGS:+$LDFLAGS }-L/usr/local/lib"
+ fi
rb_cv_dlopen=yes],
[aix*], [ : ${LDSHARED='$(CC)'}
LDSHARED="$LDSHARED ${linker_flag}-G"
@@ -3284,7 +2644,33 @@ if test "$with_dln_a_out" != yes; then
TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
: ${LIBPATHENV=LIBPATH}
+ RPATHFLAG=" ${linker_flag}-blibpath:%1\$-s:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
+ rb_cv_dlopen=yes],
+ [beos*], [ AS_CASE(["$target_cpu"],
+ [powerpc*], [
+ : ${LDSHARED='$(LD) -xms'}
+ EXTDLDFLAGS='-export $(TARGET_ENTRY)'
+ DLDFLAGS="$DLDFLAGS -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
+ LDFLAGS="$LDFLAGS -L/boot/home/config/lib -lbe -lroot"
+ ],
+ [i586*], [
+ : ${LDSHARED='$(LD) -shared'}
+ DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib \$(topdir)/_APP_ -lroot"
+ LDFLAGS="$LDFLAGS -L/boot/develop/lib/x86 -L/boot/home/config/lib -lroot"
+ ])
+ : ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes],
+ [haiku*], [ AS_CASE(["$target_cpu"],
+ [powerpc*], [
+ : ${LDSHARED='$(LD) -xms'}
+ EXTDLDFLAGS='-export $(TARGET_ENTRY)'
+ DLDFLAGS="$DLDFLAGS -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
+ ],
+ [i586*], [
+ : ${LDSHARED='$(CC) -shared'}
+ ])
+ : ${LIBPATHENV=LIBRARY_PATH}
+ rb_cv_dlopen=yes ],
[nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
: ${LDSHARED='$(LD) -Bshareable -x'}
LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
@@ -3294,36 +2680,15 @@ if test "$with_dln_a_out" != yes; then
XLDFLAGS="$XLDFLAGS -Wl,--stack,0x00200000,--enable-auto-import"
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import"
: ${LIBPATHENV=""}
- : ${PRELOADENV=""}
rb_cv_dlopen=yes],
[hiuxmpp], [ : ${LDSHARED='$(LD) -r'}],
[atheos*], [ : ${LDSHARED='$(CC) -shared'}
rb_cv_dlopen=yes],
+ [os2-emx*], [ LDFLAGS="$LDFLAGS -Zomf"
+ ],
[nacl], [ LDSHARED='$(CC) -shared' ],
- [ : ${LDSHARED='$(LD)'}])
+ [ : ${LDSHARED='$(LD)'}])
AC_MSG_RESULT($rb_cv_dlopen)
-
- if test "$rb_cv_dlopen" = yes; then
- AS_CASE(["$target_os"],
- [darwin*], [
- for flag in \
- "-undefined dynamic_lookup" \
- "-multiply_defined suppress" \
- ; do
- test "x${linker_flag}" = x || flag="${linker_flag}`echo ${flag} | tr ' ' ,`"
- RUBY_TRY_LDFLAGS([$flag], [], [flag=])
- if test "x$flag" != x; then
- RUBY_APPEND_OPTIONS(DLDFLAGS, [$flag])
- fi
- done
- ])
- fi
-
- AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [
- AS_IF([test "x$rpathflag" != x], [
- RPATHFLAG=" ${rpathflag}%1\$-s"
- ])
- ])
fi
if test "${LDSHAREDXX}" = ""; then
AS_CASE(["${LDSHARED}"],
@@ -3345,39 +2710,31 @@ AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
AC_SUBST(RPATHFLAG)
AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
-AC_SUBST(PRELOADENV, "${PRELOADENV-LD_PRELOAD}")
AC_SUBST(TRY_LINK)
-if test "x$OPT_DIR" != x; then
- pat=`echo "${LDFLAGS_OPTDIR}" | sed ['s/[][\\.*|]/\\\\&/']`
- LDFLAGS=`echo "${LDFLAGS}" | sed "s| ${pat}||"`
- val=`IFS="$PATH_SEPARATOR"
- for dir in $OPT_DIR; do
- echo x ${LIBPATHFLAG} ${RPATHFLAG} |
- sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g"
- done | tr '\012' ' ' | sed 's/ *$//'`
- if test x"$val" != x; then
- test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
- LDFLAGS="$LDFLAGS$val"
- test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
- DLDFLAGS="$DLDFLAGS$val"
- fi
- LDFLAGS_OPTDIR="$val"
-fi
+AC_ARG_WITH(opt-dir,
+ AS_HELP_STRING([--with-opt-dir=DIR-LIST],
+ [add optional headers and libraries directories separated by $PATH_SEPARATOR]),
+ [
+ val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
+ CPPFLAGS="$CPPFLAGS $val"
+ val=`IFS="$PATH_SEPARATOR"
+ for dir in $withval; do
+ echo x ${LIBPATHFLAG} ${RPATHFLAG} |
+ sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g"
+ done | tr '\012' ' '`
+ LDFLAGS_OPTDIR="$val"
+ test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
+ LDFLAGS="$LDFLAGS$val"
+ test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
+ DLDFLAGS="$DLDFLAGS$val"
+ ])
-AS_CASE(["$target_os"],
-[freebsd*], [
- AC_CHECK_LIB([procstat], [procstat_open_sysctl])
- if test "x$ac_cv_lib_procstat_procstat_open_sysctl" = xyes; then
- AC_CHECK_FUNCS(procstat_getvmmap)
- fi
- ])
AS_CASE(["$target_cpu-$target_os"],
[*-darwin*], [
AC_CHECK_HEADERS([execinfo.h])
if test "x$ac_cv_header_execinfo_h" = xyes; then
AC_CHECK_LIB([execinfo], [backtrace])
- AC_CHECK_HEADERS([libunwind.h])
fi],
[*-freebsd*|x86_64-netbsd*], [
AC_CHECK_HEADERS([execinfo.h])
@@ -3406,25 +2763,24 @@ void sigsegv(int signum, siginfo_t *info, void *ctx){
if (n > 0) {
/*fprintf(stdout, "backtrace:%d\n",n);*/
} else {
- _exit(EXIT_FAILURE);
+ abort();
}
- _exit(EXIT_SUCCESS);
+ _exit(0);
}
int
-main(void)
+main()
{
- volatile int *a = NULL;
stack_t ss;
ss.ss_sp = malloc(SIGSTKSZ);
if (ss.ss_sp == NULL) {
fprintf(stderr, "cannot allocate memory for sigaltstack\n");
- return EXIT_FAILURE;
+ abort();
}
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) == -1) {
fprintf(stderr, "sigaltstack failed\n");
- return EXIT_FAILURE;
+ abort();
}
struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction));
@@ -3433,8 +2789,9 @@ main(void)
sa.sa_flags |= SA_SIGINFO;
sa.sa_flags |= SA_ONSTACK;
sigaction(SIGSEGV, &sa, NULL);
+ int *a = NULL;
a[0] = 1;
- return EXIT_SUCCESS;
+ return 0;
}
],
rb_cv_broken_backtrace=no,
@@ -3485,6 +2842,9 @@ else
[darwin*], [
RUBY_APPEND_OPTION(XLDFLAGS, [-Wl,-u,_objc_msgSend])
DLEXT=bundle],
+ [os2-emx*], [
+ LOAD_RELATIVE=1
+ DLEXT=dll],
[cygwin*|mingw*|*djgpp*], [
LOAD_RELATIVE=1
DLEXT=so],
@@ -3492,6 +2852,7 @@ else
DLEXT=so])
fi
if test "$rb_cv_dlopen:$load_relative" = yes:yes; then
+ AC_CHECK_FUNCS(dladdr)
if test "$ac_cv_func_dladdr" = yes; then
LOAD_RELATIVE=1
fi
@@ -3532,27 +2893,16 @@ EXTSTATIC=
AC_SUBST(EXTSTATIC)dnl
AC_ARG_WITH(static-linked-ext,
AS_HELP_STRING([--with-static-linked-ext], [link external modules statically]),
- [AS_CASE([$withval],[yes],[STATIC=;EXTSTATIC=static],[no],[],[EXTSTATIC="$withval"])])
-AS_CASE([",$EXTSTATIC,"], [,static,|*,enc,*], [
+ [AS_CASE([$withval],[yes],[STATIC=;EXTSTATIC=static])])
+if test x"$EXTSTATIC" = xstatic; then
ENCOBJS='enc/encinit.$(OBJEXT) enc/libenc.$(LIBEXT) enc/libtrans.$(LIBEXT)'
EXTOBJS='ext/extinit.$(OBJEXT)'
AC_DEFINE_UNQUOTED(EXTSTATIC, 1)
- AC_SUBST(ENCSTATIC, static)
-], [
- ENCOBJS='dmyenc.$(OBJEXT)'
- EXTOBJS='dmyext.$(OBJEXT)'
-])
+fi
AC_SUBST(ENCOBJS)
AC_SUBST(EXTOBJS)
-AC_ARG_WITH(setup,
- AS_HELP_STRING([--with-setup=SETUP], [use extension libraries setup]),
- [setup=$withval])
-if test -n "$setup"; then
- if ! test -f "ext/$setup" -o -f "$srcdir/ext/$setup"; then
- AC_MSG_ERROR(Setup file $setup not found under ext or $srcdir/ext)
- fi
-elif test -f "$srcdir/ext/Setup.$target_os"; then
+if test -f "$srcdir/ext/Setup.$target_os"; then
setup="Setup.$target_os"
else
setup=
@@ -3570,15 +2920,6 @@ else
fi
AC_SUBST(setup)
-rubylibprefix='${libdir}/${RUBY_BASE_NAME}'
-AC_ARG_WITH(rubylibprefix,
- AS_HELP_STRING([--with-rubylibprefix=DIR], [prefix for ruby libraries [[LIBDIR/RUBY_BASE_NAME]]]),
- [if test "x$withval" = xno; then
- AC_MSG_ERROR([No ruby, No libprefix])
- fi
- rubylibprefix="$withval"])
-AC_SUBST(rubylibprefix)
-
if test x"${exec_prefix}" != xNONE; then
RUBY_EXEC_PREFIX="$exec_prefix"
elif test x"$prefix" != xNONE; then
@@ -3587,7 +2928,7 @@ else
RUBY_EXEC_PREFIX=$ac_default_prefix
fi
pat=`echo "${RUBY_EXEC_PREFIX}" | tr -c '\012' .`'\(.*\)'
-for var in bindir libdir rubylibprefix; do
+for var in bindir libdir; do
eval val='"$'$var'"'
AS_CASE(["$val"], ["${RUBY_EXEC_PREFIX}"*], [val='${exec_prefix}'"`expr \"$val\" : \"$pat\"`"])
eval $var='"$val"'
@@ -3606,7 +2947,6 @@ if test x"$cross_compiling" = xyes; then
RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
RUNRUBY='$(RUNRUBY_COMMAND)'
XRUBY='$(MINIRUBY)'
- BOOTSTRAPRUBY='$(BASERUBY)'
TEST_RUNNABLE=no
CROSS_COMPILING=yes
@@ -3630,7 +2970,6 @@ else
RUNRUBY_COMMAND='$(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)'
RUNRUBY='$(RUNRUBY_COMMAND) --'
XRUBY='$(RUNRUBY)'
- BOOTSTRAPRUBY='$(MINIRUBY)'
TEST_RUNNABLE=yes
CROSS_COMPILING=no
fi
@@ -3642,7 +2981,6 @@ AC_SUBST(PREP)
AC_SUBST(RUNRUBY_COMMAND)
AC_SUBST(RUNRUBY)
AC_SUBST(XRUBY)
-AC_SUBST(BOOTSTRAPRUBY)
AC_SUBST(EXTOUT, [${EXTOUT=.ext}])
FIRSTMAKEFILE=""
@@ -3653,7 +2991,7 @@ LIBRUBYARG='$(LIBRUBYARG_STATIC)'
SOLIBS=
AS_CASE(["$target_os"],
- [cygwin*|mingw*|haiku*|darwin*], [
+ [cygwin*|mingw*|beos*|haiku*|darwin*|os2-emx*], [
: ${DLDLIBS=""}
],
[
@@ -3721,7 +3059,7 @@ AS_CASE("$enable_shared", [yes], [
[sunos4*], [
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
],
- [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku*], [
+ [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [
LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR"
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
if test "$load_relative" = yes; then
@@ -3773,6 +3111,12 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
SOLIBS='-lm -lc'
],
+ [beos*], [
+ AS_CASE(["$target_cpu"],
+ [powerpc*], [
+ LIBRUBY_DLDFLAGS="-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o $LDFLAGS_OPTDIR"
+ ])
+ ],
[darwin*], [
RUBY_SO_NAME="$RUBY_SO_NAME"'.$(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_LDSHARED='$(CC) -dynamiclib'
@@ -3781,11 +3125,10 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBY_RELATIVE=yes
fi
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)'
- LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-compatibility_version $(MAJOR).$(MINOR)'
- LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(RUBY_PROGRAM_VERSION)'
+ LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(MAJOR).$(MINOR).$(TEENY)'
+ LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-compatibility_version $(ruby_version)'
if test "$visibility_option" = ld; then
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_*'
- LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_ruby_static_id_*'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*'
fi
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)'
@@ -3803,10 +3146,12 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBYARG_SHARED=
# enable PIE if possible
- AC_ARG_ENABLE(pie,
- AS_HELP_STRING([--disable-pie], [disable PIE feature]),
- [pie=$enableval], [pie=])
+ pie=
AS_CASE(["$target_os"],
+ [haiku], [
+ # gcc supports PIE, but doesn't work correctly in Haiku
+ pie=no
+ ],
[nacl], [
# -pie implies -shared for NaCl.
pie=no
@@ -3834,13 +3179,8 @@ AS_CASE("$enable_shared", [yes], [
])
if test "$enable_rpath" = yes; then
test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS "
- rpathflag="${RPATHFLAG}"
- AS_CASE(["${cross_compiling}${load_relative}"], [*yes*], [], [rpathflag="$RPATHFLAG$LIBPATHFLAG"])
- rpathflag=`IFS="$PATH_SEPARATOR"
- echo x "$rpathflag" |
- sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${libprefix}${IFS}g;s${IFS}%s${IFS}${libprefix}${IFS}g"
- `
- LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${rpathflag}"
+ LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${linker_flag}-R ${linker_flag}${libprefix}"
+ test "x$cross_compiling" = xyes || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS -L${libprefix}"
LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED"
LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
fi
@@ -3856,15 +3196,6 @@ if test "$EXEEXT" = .exe; then
AC_SUBST(EXECUTABLE_EXTS)
fi
-AS_CASE("$cross_compiling:${LIBPATHENV}", [yes:* | no:], [], [
- AC_MSG_CHECKING(whether wrapper for $LIBPATHENV is needed)
- AS_IF([env ${LIBPATHENV}=/lib /bin/sh -c ': ${'${LIBPATHENV}'?}' 2>/dev/null],
- [AC_MSG_RESULT(no)],
- [PREP="$PREP"' ruby-runner$(EXEEXT)'
- AC_MSG_RESULT(yes)]
- )
-])
-
AC_ARG_ENABLE(dtrace,
AS_HELP_STRING([--enable-dtrace],
[enable DTrace for tracing inside ruby. enabled by default on systems having dtrace]),
@@ -3880,7 +3211,6 @@ if test "${enable_dtrace}" = "auto"; then
fi
LIBRUBY_A_OBJS='$(OBJS)'
-DTRACE_REBUILD=
if test "${enable_dtrace}" = "yes"; then
if test -z "$DTRACE"; then
AC_MSG_ERROR([dtrace(1) is missing])
@@ -3893,11 +3223,9 @@ if test "${enable_dtrace}" = "yes"; then
AC_MSG_ERROR([--enable-dtrace, however, USDT is not available])
fi
RUBY_DTRACE_POSTPROCESS()
- if test "$rb_cv_prog_dtrace_g" != 'no'; then
+ if test "$rb_cv_prog_dtrace_g" = 'yes'; then
DTRACE_OBJ='probes.$(OBJEXT)'
- fi
- if test "$rb_cv_prog_dtrace_g" = 'rebuild'; then
- DTRACE_REBUILD=yes
+ DTRACE_GLOMMED_OBJ='ruby-glommed.$(OBJEXT)'
LIBRUBY_A_OBJS='$(DTRACE_GLOMMED_OBJ)'
fi
AS_CASE("${target_os}", [freebsd*], [
@@ -3911,10 +3239,9 @@ else
fi
AC_SUBST(DTRACE_EXT)
AC_SUBST(DTRACE_OBJ)
-AC_SUBST(DTRACE_REBUILD)
+AC_SUBST(DTRACE_GLOMMED_OBJ)
AC_SUBST(LIBRUBY_A_OBJS)
-RUBY_SETJMP_TYPE
}
{ # build section
@@ -3922,14 +3249,14 @@ dnl build rdoc index if requested
RDOCTARGET=""
CAPITARGET=""
AC_ARG_ENABLE(install-doc,
- AS_HELP_STRING([--disable-install-doc], [do not install either rdoc indexes or C API documents during install]),
+ AS_HELP_STRING([--disable-install-doc], [do not install neither rdoc indexes nor C API documents during install]),
[install_doc=$enableval], [install_doc=yes])
AC_ARG_ENABLE(install-rdoc,
AS_HELP_STRING([--disable-install-rdoc], [do not install rdoc indexes during install]),
[install_rdoc=$enableval], [install_rdoc=yes])
AC_ARG_ENABLE(install-capi,
AS_HELP_STRING([--disable-install-capi], [do not install C API documents during install]),
- [install_capi=$enableval], [install_capi=no])
+ [install_capi=$enableval], [install_capi=yes])
if test "$install_doc" != no; then
if test "$install_rdoc" != no; then
@@ -3984,6 +3311,13 @@ AS_CASE(["$target_os"],
RUBY_APPEND_OPTION(XLDFLAGS, [-framework CoreFoundation])
RUBY_APPEND_OPTION(LIBRUBYARG_STATIC, [-framework CoreFoundation])
],
+ [os2-emx], [
+ AC_LIBOBJ([os2])
+ CFLAGS="$CFLAGS -DOS2"
+ LIBRUBY_A=`echo $LIBRUBY_A | sed 's/^lib//'`
+ LIBRUBY_SO=`echo $LIBRUBY_SO | sed 's/^lib//'`
+ LIBRUBY_ALIASES=`for i in $LIBRUBY_ALIASES; do echo "$i"; done | sed 's/^lib//'`
+ ],
[osf*], [
if test "$GCC" != "yes" ; then
# compile something small: taint.c is fine for this.
@@ -3999,6 +3333,10 @@ AS_CASE(["$target_os"],
CFLAGS="$CFLAGS -std"
fi
],
+ [beos*], [
+ AS_CASE(["$target_cpu"],[powerpc*], [CFLAGS="$CFLAGS -relax_pointers"])
+ CPPFLAGS="$CPPFLAGS -I/boot/home/config/include"
+ ],
[cygwin*|mingw*], [
RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)$(TEENY)'
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
@@ -4048,6 +3386,9 @@ AS_CASE(["$target_os"],
FIRSTMAKEFILE=GNUmakefile:nacl/GNUmakefile.in
])
+AS_CASE(["$with_gmp: $SOLIBS "], [no:* | *' -lgmp '*|*' $(LIBS) '*], [],
+ [SOLIBS="-lgmp $SOLIBS"])
+
MINIOBJS="$MINIDLNOBJ"
AS_CASE(["$THREAD_MODEL"],
@@ -4126,12 +3467,44 @@ if test "${universal_binary-no}" = yes ; then
mv -f confdefs1.h confdefs.h
AC_MSG_ERROR([failed])
])])
- AC_CACHE_CHECK(whether __ARCHITECTURE__ is available, rb_cv_architecture_available,
- AC_TRY_COMPILE([@%:@include <stdio.h>
- const char arch[[]] = __ARCHITECTURE__;], [puts(arch);],
- [rb_cv_architecture_available=yes], [rb_cv_architecture_available=no]))
fi
+AC_CHECK_FUNC(memmem, [
+ AC_CACHE_CHECK(for broken memmem, rb_cv_broken_memmem, [
+ AC_TRY_RUN([
+#include <string.h>
+
+int
+main()
+{
+ char *str = "hogefugafoobar";
+ char *rs = "foo";
+ char *empty = "";
+ char *p;
+
+ p = memmem(str, strlen(str), rs, strlen(rs));
+ if (p == str+8) {
+ p = memmem(str, strlen(str), empty, strlen(empty));
+ if (p == str)
+ return 0;
+ else
+ return 1;
+ }
+ else {
+ return 1;
+ }
+}
+ ],
+ rb_cv_broken_memmem=no,
+ rb_cv_broken_memmem=yes,
+ rb_cv_broken_memmem=yes)
+ ])
+ if test "$rb_cv_broken_memmem" = no; then
+ AC_DEFINE(HAVE_MEMMEM, 1)
+ fi
+])
+
+
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
if test -n "${cflags+set}"; then
@@ -4149,7 +3522,7 @@ if test "${ARCH_FLAG}"; then
LDFLAGS=`echo "$LDFLAGS" | sed "s| *$archflagpat"'||'`
fi
warnflags="$rb_cv_warnflags"
-AC_SUBST(cppflags)dnl
+AC_SUBST(cppflags, [])dnl
AC_SUBST(cflags, ["$orig_cflags "'${optflags} ${debugflags} ${warnflags}'])dnl
AC_SUBST(cxxflags, ["$orig_cxxflags "'${optflags} ${debugflags} ${warnflags}'])dnl
AC_SUBST(optflags)dnl
@@ -4207,6 +3580,14 @@ AS_CASE(["$target_os"],
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
])
+rubylibprefix='${libdir}/${RUBY_BASE_NAME}'
+AC_ARG_WITH(rubylibprefix,
+ AS_HELP_STRING([--with-rubylibprefix=DIR], [prefix for ruby libraries [[LIBDIR/RUBY_BASE_NAME]]]),
+ [if test "x$withval" = xno; then
+ AC_MSG_ERROR([No ruby, No libprefix])
+ fi
+ rubylibprefix="$withval"])
+AC_SUBST(rubylibprefix)
rubylibdir='${rubylibprefix}/${ruby_version}'
rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
@@ -4256,7 +3637,7 @@ if test ${RUBY_LIB_VERSION_STYLE+set}; then
elif test -z "${ruby_version}"; then
AC_MSG_ERROR([No ruby version, No place for bundled libraries])
else
- RUBY_LIB_VERSION="${ruby_version}"
+ RUBY_LIB_VERSION="\"${ruby_version}\""
fi
AC_SUBST(RUBY_LIB_VERSION_STYLE)
AC_SUBST(RUBY_LIB_VERSION)
@@ -4309,11 +3690,13 @@ AC_SUBST(vendordir)dnl
AC_SUBST(vendorlibdir)dnl
AC_SUBST(vendorarchdir)dnl
-AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
if test "${universal_binary-no}" = yes ; then
arch="universal-${target_os}"
+ AC_CACHE_CHECK(whether __ARCHITECTURE__ is available, rb_cv_architecture_available,
+ AC_TRY_COMPILE([const char arch[] = __ARCHITECTURE__;], [puts(arch);],
+ [rb_cv_architecture_available=yes], [rb_cv_architecture_available=no]))
if test "${rb_cv_architecture_available}" = yes; then
AC_DEFINE_UNQUOTED(RUBY_PLATFORM_CPU, __ARCHITECTURE__)
else
@@ -4332,8 +3715,7 @@ if test "${universal_binary-no}" = yes ; then
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS)
else
arch="${target_cpu}-${target_os}"
- AS_CASE(["$arch"], [le32-nacl], [arch="pnacl"])
- AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "$arch")
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
fi
unset sitearch
@@ -4391,7 +3773,7 @@ AC_ARG_WITH(mantype,
AS_HELP_STRING([--with-mantype=TYPE], [specify man page type; TYPE is one of man and doc]),
[
AS_CASE(["$withval"],
- [man|man.gz|man.bz2|doc|doc.gz|doc.bz2], [MANTYPE=$withval],
+ [man|doc], [MANTYPE=$withval],
[AC_MSG_ERROR(invalid man type: $withval)])
])
if test -z "$MANTYPE"; then
@@ -4425,10 +3807,7 @@ guard=INCLUDE_RUBY_CONFIG_H
grep -v "^#define PACKAGE_" confdefs.h
echo "#endif /* $guard */"
} | tr -d '\015' |
-(
- if test "x$CONFIGURE_TTY" = xyes; then color=--color; else color=; fi
- exec ${srcdir}/tool/ifchange $color "${config_h}" -
-) || AC_MSG_ERROR([failed to create ${config_h}])
+${srcdir}/tool/ifchange "${config_h}" -
tr -d '\015' < largefile.h > confdefs.h
rm largefile.h
@@ -4436,7 +3815,7 @@ BUILTIN_ENCS=["`sed -n -e '/^BUILTIN_ENCS[ ]*=/{' \
-e s/// -e :l -e '/\\\\$/N' -e 's/\\\\\\n/ /' -e 't l' -e p \
-e '}' "${srcdir}/enc/Makefile.in"`"]
BUILTIN_ENCOBJS=
-for e in $BUILTIN_ENCS; do BUILTIN_ENCOBJS="$BUILTIN_ENCOBJS "`echo $e | sed 's/\.c$/.$(OBJEXT)/'`; done
+for e in $BUILTIN_ENCS; do BUILTIN_ENCOBJS="$BUILTIN_ENCOBJS `basename $e .c`"'.$(OBJEXT)'; done
AC_SUBST(BUILTIN_ENCOBJS)
BUILTIN_TRANSES=["`sed -n -e '/^BUILTIN_TRANSES[ ]*=/{' \
@@ -4445,15 +3824,15 @@ BUILTIN_TRANSES=["`sed -n -e '/^BUILTIN_TRANSES[ ]*=/{' \
BUILTIN_TRANSSRCS=
BUILTIN_TRANSOBJS=
for e in $BUILTIN_TRANSES; do
- BUILTIN_TRANSSRCS="$BUILTIN_TRANSSRCS "`echo $e | sed 's/\.trans$/.c/'`
- BUILTIN_TRANSOBJS="$BUILTIN_TRANSOBJS "`echo $e | sed 's/\.trans$/.$(OBJEXT)/'`
+ BUILTIN_TRANSSRCS="$BUILTIN_TRANSSRCS `basename $e .trans`"'.c';
+ BUILTIN_TRANSOBJS="$BUILTIN_TRANSOBJS `basename $e .trans`"'.$(OBJEXT)';
done
AC_SUBST(BUILTIN_TRANSSRCS)
AC_SUBST(BUILTIN_TRANSOBJS)
PACKAGE=$RUBY_BASE_NAME
AC_SUBST(PACKAGE)
-AS_MESSAGE([$PACKAGE library version = $ruby_version])
+AC_MSG_RESULT($PACKAGE library version = $ruby_version)
AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/ *$//'`])
@@ -4479,7 +3858,6 @@ AC_CONFIG_FILES(Makefile, [
["git svn"], [VCSUP='$(VCS) rebase $(GITSVNREBASEOPTIONS)'],
[git], [VCSUP='$(VCS) pull $(GITPULLOPTIONS)'],
[VCSUP='$(VCS)'])
- sed -n 's/^@%:@define \(RUBY_RELEASE_DATE\) "\(.*\)"/\1 = \2/p' "$srcdir/version.h"
sed '/^MISSING/s/\$U\././g;/^VCS *=/s#@VCS@#'"$VCS"'#;/^VCSUP *=/s#@VCSUP@#'"$VCSUP"'#' Makefile
echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)'
if test "$gnumake" != yes; then
@@ -4505,17 +3883,12 @@ AC_CONFIG_FILES(Makefile, [
[EXEEXT='$EXEEXT' gnumake='$gnumake'])
AC_ARG_WITH([ruby-pc],
- AC_HELP_STRING([--with-ruby-pc=FILENAME], [pc file basename]),
+ AC_HELP_STRING([pc file basename]),
[ruby_pc="$withval"],
[ruby_pc="${RUBY_BASE_NAME}-${MAJOR}.${MINOR}.pc"])
AC_SUBST(ruby_pc)
AC_SUBST(exec, [exec])
-AC_ARG_WITH(destdir,
- AS_HELP_STRING([--with-destdir=DESTDIR], [specify default directory to install]),
- [DESTDIR="$withval"])
-AC_SUBST(DESTDIR)
-
AC_CONFIG_FILES($ruby_pc:template/ruby.pc.in,
[
if sed ['s/\$(\([A-Za-z_][A-Za-z0-9_]*\))/${\1}/g;s/@[A-Za-z_][A-Za-z0-9_]*@//'] $ruby_pc > ruby.tmp.pc &&
diff --git a/constant.h b/constant.h
index 23d17ac24c..3dc9b8d4ef 100644
--- a/constant.h
+++ b/constant.h
@@ -12,32 +12,19 @@
#define CONSTANT_H
typedef enum {
- CONST_DEPRECATED = 0x100,
-
- CONST_VISIBILITY_MASK = 0xff,
CONST_PUBLIC = 0x00,
- CONST_PRIVATE,
- CONST_VISIBILITY_MAX
+ CONST_PRIVATE = 0x01
} rb_const_flag_t;
-#define RB_CONST_PRIVATE_P(ce) \
- (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
-#define RB_CONST_PUBLIC_P(ce) \
- (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
-
-#define RB_CONST_DEPRECATED_P(ce) \
- ((ce)->flag & CONST_DEPRECATED)
-
typedef struct rb_const_entry_struct {
rb_const_flag_t flag;
- int line;
const VALUE value; /* should be mark */
const VALUE file; /* should be mark */
+ int line;
} rb_const_entry_t;
-VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
-VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
-VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
+VALUE rb_mod_private_constant(int argc, VALUE *argv, VALUE obj);
+VALUE rb_mod_public_constant(int argc, VALUE *argv, VALUE obj);
void rb_free_const_table(st_table *tbl);
VALUE rb_public_const_get(VALUE klass, ID id);
VALUE rb_public_const_get_at(VALUE klass, ID id);
@@ -45,6 +32,5 @@ VALUE rb_public_const_get_from(VALUE klass, ID id);
int rb_public_const_defined(VALUE klass, ID id);
int rb_public_const_defined_at(VALUE klass, ID id);
int rb_public_const_defined_from(VALUE klass, ID id);
-rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
#endif /* CONSTANT_H */
diff --git a/cont.c b/cont.c
index b2e48c6202..fa9e91ee64 100644
--- a/cont.c
+++ b/cont.c
@@ -9,6 +9,7 @@
**********************************************************************/
+#include "ruby/ruby.h"
#include "internal.h"
#include "vm_core.h"
#include "gc.h"
@@ -88,26 +89,24 @@ enum context_type {
typedef struct rb_context_struct {
enum context_type type;
- int argc;
VALUE self;
+ int argc;
VALUE value;
VALUE *vm_stack;
#ifdef CAPTURE_JUST_VALID_VM_STACK
size_t vm_stack_slen; /* length of stack (head of th->stack) */
size_t vm_stack_clen; /* length of control frames (tail of th->stack) */
#endif
- struct {
- VALUE *stack;
- VALUE *stack_src;
- size_t stack_size;
+ VALUE *machine_stack;
+ VALUE *machine_stack_src;
#ifdef __ia64
- VALUE *register_stack;
- VALUE *register_stack_src;
- int register_stack_size;
+ VALUE *machine_register_stack;
+ VALUE *machine_register_stack_src;
+ int machine_register_stack_size;
#endif
- } machine;
- rb_thread_t saved_thread; /* selected properties of GET_THREAD() (see cont_save_thread) */
+ rb_thread_t saved_thread;
rb_jmpbuf_t jmpbuf;
+ size_t machine_stack_size;
rb_ensure_entry_t *ensure_array;
rb_ensure_list_t *ensure_list;
} rb_context_t;
@@ -129,30 +128,26 @@ static machine_stack_cache_t machine_stack_cache[MAX_MACHINE_STACK_CACHE];
static machine_stack_cache_t terminated_machine_stack;
#endif
-struct rb_fiber_struct {
+typedef struct rb_fiber_struct {
rb_context_t cont;
- struct rb_fiber_struct *prev;
+ VALUE prev;
enum fiber_status status;
+ struct rb_fiber_struct *prev_fiber;
+ struct rb_fiber_struct *next_fiber;
/* If a fiber invokes "transfer",
* then this fiber can't "resume" any more after that.
* You shouldn't mix "transfer" and "resume".
*/
- int transferred;
+ int transfered;
#if FIBER_USE_NATIVE
#ifdef _WIN32
void *fib_handle;
#else
ucontext_t context;
- /* Because context.uc_stack.ss_sp and context.uc_stack.ss_size
- * are not necessarily valid after makecontext() or swapcontext(),
- * they are saved in these variables for later use.
- */
- void *ss_sp;
- size_t ss_size;
#endif
#endif
-};
+} rb_fiber_t;
static const rb_data_type_t cont_data_type, fiber_data_type;
static VALUE rb_cContinuation;
@@ -167,7 +162,7 @@ static VALUE rb_eFiberError;
if (!(ptr)) rb_raise(rb_eFiberError, "uninitialized fiber"); \
} while (0)
-NOINLINE(static VALUE cont_capture(volatile int *volatile stat));
+NOINLINE(static VALUE cont_capture(volatile int *stat));
#define THREAD_MUST_BE_RUNNING(th) do { \
if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread"); \
@@ -188,32 +183,32 @@ cont_mark(void *ptr)
rb_gc_mark_locations(cont->vm_stack,
cont->vm_stack + cont->vm_stack_slen + cont->vm_stack_clen);
#else
- rb_gc_mark_locations(cont->vm_stack,
+ rb_gc_mark_localtion(cont->vm_stack,
cont->vm_stack, cont->saved_thread.stack_size);
#endif
}
- if (cont->machine.stack) {
+ if (cont->machine_stack) {
if (cont->type == CONTINUATION_CONTEXT) {
/* cont */
- rb_gc_mark_locations(cont->machine.stack,
- cont->machine.stack + cont->machine.stack_size);
+ rb_gc_mark_locations(cont->machine_stack,
+ cont->machine_stack + cont->machine_stack_size);
}
else {
/* fiber */
rb_thread_t *th;
rb_fiber_t *fib = (rb_fiber_t*)cont;
GetThreadPtr(cont->saved_thread.self, th);
- if ((th->fiber != fib) && fib->status == RUNNING) {
- rb_gc_mark_locations(cont->machine.stack,
- cont->machine.stack + cont->machine.stack_size);
+ if ((th->fiber != cont->self) && fib->status == RUNNING) {
+ rb_gc_mark_locations(cont->machine_stack,
+ cont->machine_stack + cont->machine_stack_size);
}
}
}
#ifdef __ia64
- if (cont->machine.register_stack) {
- rb_gc_mark_locations(cont->machine.register_stack,
- cont->machine.register_stack + cont->machine.register_stack_size);
+ if (cont->machine_register_stack) {
+ rb_gc_mark_locations(cont->machine_register_stack,
+ cont->machine_register_stack + cont->machine_register_stack_size);
}
#endif
}
@@ -226,31 +221,31 @@ cont_free(void *ptr)
RUBY_FREE_ENTER("cont");
if (ptr) {
rb_context_t *cont = ptr;
- RUBY_FREE_UNLESS_NULL(cont->saved_thread.stack);
+ RUBY_FREE_UNLESS_NULL(cont->saved_thread.stack); fflush(stdout);
#if FIBER_USE_NATIVE
if (cont->type == CONTINUATION_CONTEXT) {
/* cont */
ruby_xfree(cont->ensure_array);
- RUBY_FREE_UNLESS_NULL(cont->machine.stack);
+ RUBY_FREE_UNLESS_NULL(cont->machine_stack);
}
else {
/* fiber */
- rb_fiber_t *fib = (rb_fiber_t*)cont;
- const rb_thread_t *const th = GET_THREAD();
#ifdef _WIN32
- if (th && th->fiber != fib && cont->type != ROOT_FIBER_CONTEXT) {
+ if (GET_THREAD()->fiber != cont->self && cont->type != ROOT_FIBER_CONTEXT) {
/* don't delete root fiber handle */
+ rb_fiber_t *fib = (rb_fiber_t*)cont;
if (fib->fib_handle) {
DeleteFiber(fib->fib_handle);
}
}
#else /* not WIN32 */
- if (th && th->fiber != fib) {
- if (fib->ss_sp) {
+ if (GET_THREAD()->fiber != cont->self) {
+ rb_fiber_t *fib = (rb_fiber_t*)cont;
+ if (fib->context.uc_stack.ss_sp) {
if (cont->type == ROOT_FIBER_CONTEXT) {
rb_bug("Illegal root fiber parameter");
}
- munmap((void*)fib->ss_sp, fib->ss_size);
+ munmap((void*)fib->context.uc_stack.ss_sp, fib->context.uc_stack.ss_size);
}
}
else {
@@ -262,10 +257,10 @@ cont_free(void *ptr)
}
#else /* not FIBER_USE_NATIVE */
ruby_xfree(cont->ensure_array);
- RUBY_FREE_UNLESS_NULL(cont->machine.stack);
+ RUBY_FREE_UNLESS_NULL(cont->machine_stack);
#endif
#ifdef __ia64
- RUBY_FREE_UNLESS_NULL(cont->machine.register_stack);
+ RUBY_FREE_UNLESS_NULL(cont->machine_register_stack);
#endif
RUBY_FREE_UNLESS_NULL(cont->vm_stack);
@@ -280,48 +275,63 @@ cont_memsize(const void *ptr)
{
const rb_context_t *cont = ptr;
size_t size = 0;
-
- size = sizeof(*cont);
- if (cont->vm_stack) {
+ if (cont) {
+ size = sizeof(*cont);
+ if (cont->vm_stack) {
#ifdef CAPTURE_JUST_VALID_VM_STACK
- size_t n = (cont->vm_stack_slen + cont->vm_stack_clen);
+ size_t n = (cont->vm_stack_slen + cont->vm_stack_clen);
#else
- size_t n = cont->saved_thread.stack_size;
+ size_t n = cont->saved_thread.stack_size;
#endif
- size += n * sizeof(*cont->vm_stack);
- }
+ size += n * sizeof(*cont->vm_stack);
+ }
- if (cont->machine.stack) {
- size += cont->machine.stack_size * sizeof(*cont->machine.stack);
- }
+ if (cont->machine_stack) {
+ size += cont->machine_stack_size * sizeof(*cont->machine_stack);
+ }
#ifdef __ia64
- if (cont->machine.register_stack) {
- size += cont->machine.register_stack_size * sizeof(*cont->machine.register_stack);
- }
+ if (cont->machine_register_stack) {
+ size += cont->machine_register_stack_size * sizeof(*cont->machine_register_stack);
+ }
#endif
+ }
return size;
}
-void
-rb_fiber_mark_self(rb_fiber_t *fib)
-{
- if (fib)
- rb_gc_mark(fib->cont.self);
-}
-
static void
fiber_mark(void *ptr)
{
RUBY_MARK_ENTER("cont");
if (ptr) {
rb_fiber_t *fib = ptr;
- rb_fiber_mark_self(fib->prev);
+ rb_gc_mark(fib->prev);
cont_mark(&fib->cont);
}
RUBY_MARK_LEAVE("cont");
}
static void
+fiber_link_join(rb_fiber_t *fib)
+{
+ VALUE current_fibval = rb_fiber_current();
+ rb_fiber_t *current_fib;
+ GetFiberPtr(current_fibval, current_fib);
+
+ /* join fiber link */
+ fib->next_fiber = current_fib->next_fiber;
+ fib->prev_fiber = current_fib;
+ current_fib->next_fiber->prev_fiber = fib;
+ current_fib->next_fiber = fib;
+}
+
+static void
+fiber_link_remove(rb_fiber_t *fib)
+{
+ fib->prev_fiber->next_fiber = fib->next_fiber;
+ fib->next_fiber->prev_fiber = fib->prev_fiber;
+}
+
+static void
fiber_free(void *ptr)
{
RUBY_FREE_ENTER("fiber");
@@ -331,6 +341,7 @@ fiber_free(void *ptr)
fib->cont.saved_thread.local_storage) {
st_free_table(fib->cont.saved_thread.local_storage);
}
+ fiber_link_remove(fib);
cont_free(&fib->cont);
}
@@ -342,13 +353,14 @@ fiber_memsize(const void *ptr)
{
const rb_fiber_t *fib = ptr;
size_t size = 0;
-
- size = sizeof(*fib);
- if (fib->cont.type != ROOT_FIBER_CONTEXT &&
- fib->cont.saved_thread.local_storage != NULL) {
- size += st_memsize(fib->cont.saved_thread.local_storage);
+ if (ptr) {
+ size = sizeof(*fib);
+ if (fib->cont.type != ROOT_FIBER_CONTEXT &&
+ fib->cont.saved_thread.local_storage != NULL) {
+ size += st_memsize(fib->cont.saved_thread.local_storage);
+ }
+ size += cont_memsize(&fib->cont);
}
- size += cont_memsize(&fib->cont);
return size;
}
@@ -368,82 +380,63 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
{
size_t size;
- SET_MACHINE_STACK_END(&th->machine.stack_end);
+ SET_MACHINE_STACK_END(&th->machine_stack_end);
#ifdef __ia64
- th->machine.register_stack_end = rb_ia64_bsp();
+ th->machine_register_stack_end = rb_ia64_bsp();
#endif
- if (th->machine.stack_start > th->machine.stack_end) {
- size = cont->machine.stack_size = th->machine.stack_start - th->machine.stack_end;
- cont->machine.stack_src = th->machine.stack_end;
+ if (th->machine_stack_start > th->machine_stack_end) {
+ size = cont->machine_stack_size = th->machine_stack_start - th->machine_stack_end;
+ cont->machine_stack_src = th->machine_stack_end;
}
else {
- size = cont->machine.stack_size = th->machine.stack_end - th->machine.stack_start;
- cont->machine.stack_src = th->machine.stack_start;
+ size = cont->machine_stack_size = th->machine_stack_end - th->machine_stack_start;
+ cont->machine_stack_src = th->machine_stack_start;
}
- if (cont->machine.stack) {
- REALLOC_N(cont->machine.stack, VALUE, size);
+ if (cont->machine_stack) {
+ REALLOC_N(cont->machine_stack, VALUE, size);
}
else {
- cont->machine.stack = ALLOC_N(VALUE, size);
+ cont->machine_stack = ALLOC_N(VALUE, size);
}
FLUSH_REGISTER_WINDOWS;
- MEMCPY(cont->machine.stack, cont->machine.stack_src, VALUE, size);
+ MEMCPY(cont->machine_stack, cont->machine_stack_src, VALUE, size);
#ifdef __ia64
rb_ia64_flushrs();
- size = cont->machine.register_stack_size = th->machine.register_stack_end - th->machine.register_stack_start;
- cont->machine.register_stack_src = th->machine.register_stack_start;
- if (cont->machine.register_stack) {
- REALLOC_N(cont->machine.register_stack, VALUE, size);
+ size = cont->machine_register_stack_size = th->machine_register_stack_end - th->machine_register_stack_start;
+ cont->machine_register_stack_src = th->machine_register_stack_start;
+ if (cont->machine_register_stack) {
+ REALLOC_N(cont->machine_register_stack, VALUE, size);
}
else {
- cont->machine.register_stack = ALLOC_N(VALUE, size);
+ cont->machine_register_stack = ALLOC_N(VALUE, size);
}
- MEMCPY(cont->machine.register_stack, cont->machine.register_stack_src, VALUE, size);
+ MEMCPY(cont->machine_register_stack, cont->machine_register_stack_src, VALUE, size);
#endif
}
static const rb_data_type_t cont_data_type = {
"continuation",
{cont_mark, cont_free, cont_memsize,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
-static inline void
+static void
cont_save_thread(rb_context_t *cont, rb_thread_t *th)
{
- rb_thread_t *sth = &cont->saved_thread;
-
/* save thread context */
- sth->stack = th->stack;
- sth->stack_size = th->stack_size;
- sth->local_storage = th->local_storage;
- sth->cfp = th->cfp;
- sth->safe_level = th->safe_level;
- sth->raised_flag = th->raised_flag;
- sth->state = th->state;
- sth->status = th->status;
- sth->tag = th->tag;
- sth->protect_tag = th->protect_tag;
- sth->errinfo = th->errinfo;
- sth->first_proc = th->first_proc;
- sth->root_lep = th->root_lep;
- sth->root_svar = th->root_svar;
- sth->ensure_list = th->ensure_list;
-
- sth->trace_arg = th->trace_arg;
-
- /* saved_thread->machine.stack_(start|end) should be NULL */
+ cont->saved_thread = *th;
+ /* saved_thread->machine_stack_(start|end) should be NULL */
/* because it may happen GC afterward */
- sth->machine.stack_start = 0;
- sth->machine.stack_end = 0;
+ cont->saved_thread.machine_stack_start = 0;
+ cont->saved_thread.machine_stack_end = 0;
#ifdef __ia64
- sth->machine.register_stack_start = 0;
- sth->machine.register_stack_end = 0;
+ cont->saved_thread.machine_register_stack_start = 0;
+ cont->saved_thread.machine_register_stack_end = 0;
#endif
}
@@ -452,12 +445,7 @@ cont_init(rb_context_t *cont, rb_thread_t *th)
{
/* save thread context */
cont_save_thread(cont, th);
- cont->saved_thread.self = th->self;
- cont->saved_thread.machine.stack_maxsize = th->machine.stack_maxsize;
- cont->saved_thread.fiber = th->fiber;
cont->saved_thread.local_storage = 0;
- cont->saved_thread.local_storage_recursive_hash = Qnil;
- cont->saved_thread.local_storage_recursive_hash_for_trace = Qnil;
}
static rb_context_t *
@@ -475,19 +463,20 @@ cont_new(VALUE klass)
}
static VALUE
-cont_capture(volatile int *volatile stat)
+cont_capture(volatile int *stat)
{
- rb_context_t *volatile cont;
- rb_thread_t *th = GET_THREAD();
+ rb_context_t *cont;
+ rb_thread_t *th = GET_THREAD(), *sth;
volatile VALUE contval;
THREAD_MUST_BE_RUNNING(th);
rb_vm_stack_to_heap(th);
cont = cont_new(rb_cContinuation);
contval = cont->self;
+ sth = &cont->saved_thread;
#ifdef CAPTURE_JUST_VALID_VM_STACK
- cont->vm_stack_slen = th->cfp->sp - th->stack;
+ cont->vm_stack_slen = th->cfp->sp + th->mark_stack_len - th->stack;
cont->vm_stack_clen = th->stack + th->stack_size - (VALUE*)th->cfp;
cont->vm_stack = ALLOC_N(VALUE, cont->vm_stack_slen + cont->vm_stack_clen);
MEMCPY(cont->vm_stack, th->stack, VALUE, cont->vm_stack_slen);
@@ -496,7 +485,7 @@ cont_capture(volatile int *volatile stat)
cont->vm_stack = ALLOC_N(VALUE, th->stack_size);
MEMCPY(cont->vm_stack, th->stack, VALUE, th->stack_size);
#endif
- cont->saved_thread.stack = 0;
+ sth->stack = 0;
cont_save_machine_stack(th, cont);
@@ -517,9 +506,8 @@ cont_capture(volatile int *volatile stat)
}
if (ruby_setjmp(cont->jmpbuf)) {
- VALUE value;
+ volatile VALUE value;
- VAR_INITIALIZED(cont);
value = cont->value;
if (cont->argc == -1) rb_exc_raise(value);
cont->value = Qnil;
@@ -532,7 +520,7 @@ cont_capture(volatile int *volatile stat)
}
}
-static inline void
+static void
cont_restore_thread(rb_context_t *cont)
{
rb_thread_t *th = GET_THREAD(), *sth = &cont->saved_thread;
@@ -540,14 +528,16 @@ cont_restore_thread(rb_context_t *cont)
/* restore thread context */
if (cont->type == CONTINUATION_CONTEXT) {
/* continuation */
- rb_fiber_t *fib;
+ VALUE fib;
th->fiber = sth->fiber;
fib = th->fiber ? th->fiber : th->root_fiber;
if (fib) {
- th->stack_size = fib->cont.saved_thread.stack_size;
- th->stack = fib->cont.saved_thread.stack;
+ rb_fiber_t *fcont;
+ GetFiberPtr(fib, fcont);
+ th->stack_size = fcont->cont.saved_thread.stack_size;
+ th->stack = fcont->cont.saved_thread.stack;
}
#ifdef CAPTURE_JUST_VALID_VM_STACK
MEMCPY(th->stack, cont->vm_stack, VALUE, cont->vm_stack_slen);
@@ -562,9 +552,7 @@ cont_restore_thread(rb_context_t *cont)
th->stack = sth->stack;
th->stack_size = sth->stack_size;
th->local_storage = sth->local_storage;
- th->local_storage_recursive_hash = sth->local_storage_recursive_hash;
- th->local_storage_recursive_hash_for_trace = sth->local_storage_recursive_hash_for_trace;
- th->fiber = (rb_fiber_t*)cont;
+ th->fiber = cont->self;
}
th->cfp = sth->cfp;
@@ -591,7 +579,7 @@ fiber_set_stack_location(void)
VALUE *ptr;
SET_MACHINE_STACK_END(&ptr);
- th->machine.stack_start = (void*)(((VALUE)ptr & RB_PAGE_MASK) + STACK_UPPER((void *)&ptr, 0, RB_PAGE_SIZE));
+ th->machine_stack_start = (void*)(((VALUE)ptr & RB_PAGE_MASK) + STACK_UPPER((void *)&ptr, 0, RB_PAGE_SIZE));
}
static VOID CALLBACK
@@ -657,10 +645,6 @@ fiber_initialize_machine_stack_context(rb_fiber_t *fib, size_t size)
rb_thread_t *sth = &fib->cont.saved_thread;
#ifdef _WIN32
-# if defined(_MSC_VER) && _MSC_VER <= 1200
-# define CreateFiberEx(cs, stacksize, flags, entry, param) \
- CreateFiber((stacksize), (entry), (param))
-# endif
fib->fib_handle = CreateFiberEx(size - 1, size, 0, fiber_entry, NULL);
if (!fib->fib_handle) {
/* try to release unnecessary fibers & retry to create */
@@ -670,7 +654,7 @@ fiber_initialize_machine_stack_context(rb_fiber_t *fib, size_t size)
rb_raise(rb_eFiberError, "can't create fiber");
}
}
- sth->machine.stack_maxsize = size;
+ sth->machine_stack_maxsize = size;
#else /* not WIN32 */
ucontext_t *context = &fib->context;
char *ptr;
@@ -681,14 +665,12 @@ fiber_initialize_machine_stack_context(rb_fiber_t *fib, size_t size)
context->uc_link = NULL;
context->uc_stack.ss_sp = ptr;
context->uc_stack.ss_size = size;
- fib->ss_sp = ptr;
- fib->ss_size = size;
makecontext(context, rb_fiber_start, 0);
- sth->machine.stack_start = (VALUE*)(ptr + STACK_DIR_UPPER(0, size));
- sth->machine.stack_maxsize = size - RB_PAGE_SIZE;
+ sth->machine_stack_start = (VALUE*)(ptr + STACK_DIR_UPPER(0, size));
+ sth->machine_stack_maxsize = size - RB_PAGE_SIZE;
#endif
#ifdef __ia64
- sth->machine.register_stack_maxsize = sth->machine.stack_maxsize;
+ sth->machine_register_stack_maxsize = sth->machine_stack_maxsize;
#endif
}
@@ -705,31 +687,31 @@ fiber_setcontext(rb_fiber_t *newfib, rb_fiber_t *oldfib)
/* restore thread context */
cont_restore_thread(&newfib->cont);
- th->machine.stack_maxsize = sth->machine.stack_maxsize;
- if (sth->machine.stack_end && (newfib != oldfib)) {
- rb_bug("fiber_setcontext: sth->machine.stack_end has non zero value");
+ th->machine_stack_maxsize = sth->machine_stack_maxsize;
+ if (sth->machine_stack_end && (newfib != oldfib)) {
+ rb_bug("fiber_setcontext: sth->machine_stack_end has non zero value");
}
/* save oldfib's machine stack */
if (oldfib->status != TERMINATED) {
STACK_GROW_DIR_DETECTION;
- SET_MACHINE_STACK_END(&th->machine.stack_end);
+ SET_MACHINE_STACK_END(&th->machine_stack_end);
if (STACK_DIR_UPPER(0, 1)) {
- oldfib->cont.machine.stack_size = th->machine.stack_start - th->machine.stack_end;
- oldfib->cont.machine.stack = th->machine.stack_end;
+ oldfib->cont.machine_stack_size = th->machine_stack_start - th->machine_stack_end;
+ oldfib->cont.machine_stack = th->machine_stack_end;
}
else {
- oldfib->cont.machine.stack_size = th->machine.stack_end - th->machine.stack_start;
- oldfib->cont.machine.stack = th->machine.stack_start;
+ oldfib->cont.machine_stack_size = th->machine_stack_end - th->machine_stack_start;
+ oldfib->cont.machine_stack = th->machine_stack_start;
}
}
/* exchange machine_stack_start between oldfib and newfib */
- oldfib->cont.saved_thread.machine.stack_start = th->machine.stack_start;
- th->machine.stack_start = sth->machine.stack_start;
- /* oldfib->machine.stack_end should be NULL */
- oldfib->cont.saved_thread.machine.stack_end = 0;
+ oldfib->cont.saved_thread.machine_stack_start = th->machine_stack_start;
+ th->machine_stack_start = sth->machine_stack_start;
+ /* oldfib->machine_stack_end should be NULL */
+ oldfib->cont.saved_thread.machine_stack_end = 0;
#ifndef _WIN32
- if (!newfib->context.uc_stack.ss_sp && th->root_fiber != newfib) {
+ if (!newfib->context.uc_stack.ss_sp && th->root_fiber != newfib->cont.self) {
rb_bug("non_root_fiber->context.uc_stac.ss_sp should not be NULL");
}
#endif
@@ -760,16 +742,16 @@ cont_restore_1(rb_context_t *cont)
((_JUMP_BUFFER*)(&buf))->Frame;
}
#endif
- if (cont->machine.stack_src) {
+ if (cont->machine_stack_src) {
FLUSH_REGISTER_WINDOWS;
- MEMCPY(cont->machine.stack_src, cont->machine.stack,
- VALUE, cont->machine.stack_size);
+ MEMCPY(cont->machine_stack_src, cont->machine_stack,
+ VALUE, cont->machine_stack_size);
}
#ifdef __ia64
- if (cont->machine.register_stack_src) {
- MEMCPY(cont->machine.register_stack_src, cont->machine.register_stack,
- VALUE, cont->machine.register_stack_size);
+ if (cont->machine_register_stack_src) {
+ MEMCPY(cont->machine_register_stack_src, cont->machine_register_stack,
+ VALUE, cont->machine_register_stack_size);
}
#endif
@@ -804,7 +786,7 @@ register_stack_extend(rb_context_t *cont, VALUE *vp, VALUE *curr_bsp)
E(k) = E(l) = E(m) = E(n) = E(o) =
E(p) = E(q) = E(r) = E(s) = E(t) = 0;
}
- if (curr_bsp < cont->machine.register_stack_src+cont->machine.register_stack_size) {
+ if (curr_bsp < cont->machine_register_stack_src+cont->machine_register_stack_size) {
register_stack_extend(cont, vp, (VALUE*)rb_ia64_bsp());
}
cont_restore_0(cont, vp);
@@ -816,7 +798,7 @@ register_stack_extend(rb_context_t *cont, VALUE *vp, VALUE *curr_bsp)
static void
cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
{
- if (cont->machine.stack_src) {
+ if (cont->machine_stack_src) {
#ifdef HAVE_ALLOCA
#define STACK_PAD_SIZE 1
#else
@@ -829,7 +811,7 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
/* Stack grows downward */
#endif
#if STACK_GROW_DIRECTION <= 0
- volatile VALUE *const end = cont->machine.stack_src;
+ volatile VALUE *const end = cont->machine_stack_src;
if (&space[0] > end) {
# ifdef HAVE_ALLOCA
volatile VALUE *sp = ALLOCA_N(VALUE, &space[0] - end);
@@ -845,7 +827,7 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
/* Stack grows upward */
#endif
#if STACK_GROW_DIRECTION >= 0
- volatile VALUE *const end = cont->machine.stack_src + cont->machine.stack_size;
+ volatile VALUE *const end = cont->machine_stack_src + cont->machine_stack_size;
if (&space[STACK_PAD_SIZE] < end) {
# ifdef HAVE_ALLOCA
volatile VALUE *sp = ALLOCA_N(VALUE, end - &space[STACK_PAD_SIZE]);
@@ -891,24 +873,6 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
* Ron
* Max
*
- * Also you can call callcc in other methods:
- *
- * require "continuation"
- *
- * def g
- * arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ]
- * cc = callcc { |cc| cc }
- * puts arr.shift
- * return cc, arr.size
- * end
- *
- * def f
- * c, size = g
- * c.call(c) if size > 1
- * end
- *
- * f
- *
* This (somewhat contrived) example allows the inner loop to abandon
* processing early:
*
@@ -963,7 +927,7 @@ rb_callcc(VALUE self)
}
static VALUE
-make_passing_arg(int argc, const VALUE *argv)
+make_passing_arg(int argc, VALUE *argv)
{
switch (argc) {
case 0:
@@ -1079,6 +1043,9 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
rb_raise(rb_eRuntimeError, "continuation called across stack rewinding barrier");
}
if (cont->saved_thread.fiber) {
+ rb_fiber_t *fcont;
+ GetFiberPtr(cont->saved_thread.fiber, fcont);
+
if (th->fiber != cont->saved_thread.fiber) {
rb_raise(rb_eRuntimeError, "continuation called across fiber");
}
@@ -1112,7 +1079,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
* comes with a small 4KB stack. This enables the fiber to be paused from deeply
* nested function calls within the fiber block.
*
- * When a fiber is created it will not run automatically. Rather it must
+ * When a fiber is created it will not run automatically. Rather it must be
* be explicitly asked to run using the <code>Fiber#resume</code> method.
* The code running inside the fiber can give up control by calling
* <code>Fiber.yield</code> in which case it yields control back to caller
@@ -1164,7 +1131,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
static const rb_data_type_t fiber_data_type = {
"fiber",
{fiber_mark, fiber_free, fiber_memsize,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -1184,11 +1151,12 @@ fiber_t_alloc(VALUE fibval)
}
THREAD_MUST_BE_RUNNING(th);
- fib = ZALLOC(rb_fiber_t);
+ fib = ALLOC(rb_fiber_t);
+ memset(fib, 0, sizeof(rb_fiber_t));
fib->cont.self = fibval;
fib->cont.type = FIBER_CONTEXT;
cont_init(&fib->cont, th);
- fib->prev = NULL;
+ fib->prev = Qnil;
fib->status = CREATED;
DATA_PTR(fibval) = fib;
@@ -1202,7 +1170,6 @@ fiber_init(VALUE fibval, VALUE proc)
rb_fiber_t *fib = fiber_t_alloc(fibval);
rb_context_t *cont = &fib->cont;
rb_thread_t *th = &cont->saved_thread;
- rb_thread_t *cth = GET_THREAD();
/* initialize cont */
cont->vm_stack = 0;
@@ -1210,33 +1177,34 @@ fiber_init(VALUE fibval, VALUE proc)
th->stack = 0;
th->stack_size = 0;
- th->stack_size = cth->vm->default_params.fiber_vm_stack_size / sizeof(VALUE);
+ fiber_link_join(fib);
+
+ th->stack_size = th->vm->default_params.fiber_vm_stack_size / sizeof(VALUE);
th->stack = ALLOC_N(VALUE, th->stack_size);
th->cfp = (void *)(th->stack + th->stack_size);
th->cfp--;
th->cfp->pc = 0;
- th->cfp->sp = th->stack + 2;
+ th->cfp->sp = th->stack + 1;
#if VM_DEBUG_BP_CHECK
th->cfp->bp_check = 0;
#endif
- th->cfp->ep = th->stack + 1;
- th->cfp->ep[ 0] = VM_ENVVAL_BLOCK_PTR(0);
- th->cfp->ep[-1] = 0;
+ th->cfp->ep = th->stack;
+ *th->cfp->ep = VM_ENVVAL_BLOCK_PTR(0);
th->cfp->self = Qnil;
- th->cfp->flag = VM_FRAME_MAGIC_DUMMY | VM_FRAME_FLAG_FINISH;
+ th->cfp->klass = Qnil;
+ th->cfp->flag = 0;
th->cfp->iseq = 0;
th->cfp->proc = 0;
th->cfp->block_iseq = 0;
+ th->cfp->me = 0;
th->tag = 0;
th->local_storage = st_init_numtable();
- th->local_storage_recursive_hash = Qnil;
- th->local_storage_recursive_hash_for_trace = Qnil;
th->first_proc = proc;
#if !FIBER_USE_NATIVE
- MEMCPY(&cont->jmpbuf, &cth->root_jmpbuf, rb_jmpbuf_t, 1);
+ MEMCPY(&cont->jmpbuf, &th->root_jmpbuf, rb_jmpbuf_t, 1);
#endif
return fibval;
@@ -1255,19 +1223,61 @@ rb_fiber_new(VALUE (*func)(ANYARGS), VALUE obj)
return fiber_init(fiber_alloc(rb_cFiber), rb_proc_new(func, obj));
}
-static void rb_fiber_terminate(rb_fiber_t *fib);
+static VALUE
+return_fiber(void)
+{
+ rb_fiber_t *fib;
+ VALUE curr = rb_fiber_current();
+ VALUE prev;
+ GetFiberPtr(curr, fib);
+
+ prev = fib->prev;
+ if (NIL_P(prev)) {
+ const VALUE root_fiber = GET_THREAD()->root_fiber;
+
+ if (root_fiber == curr) {
+ rb_raise(rb_eFiberError, "can't yield from root fiber");
+ }
+ return root_fiber;
+ }
+ else {
+ fib->prev = Qnil;
+ return prev;
+ }
+}
+
+VALUE rb_fiber_transfer(VALUE fib, int argc, VALUE *argv);
+
+static void
+rb_fiber_terminate(rb_fiber_t *fib)
+{
+ VALUE value = fib->cont.value;
+ fib->status = TERMINATED;
+#if FIBER_USE_NATIVE && !defined(_WIN32)
+ /* Ruby must not switch to other thread until storing terminated_machine_stack */
+ terminated_machine_stack.ptr = fib->context.uc_stack.ss_sp;
+ terminated_machine_stack.size = fib->context.uc_stack.ss_size / sizeof(VALUE);
+ fib->context.uc_stack.ss_sp = NULL;
+ fib->cont.machine_stack = NULL;
+ fib->cont.machine_stack_size = 0;
+#endif
+ rb_fiber_transfer(return_fiber(), 1, &value);
+}
void
rb_fiber_start(void)
{
rb_thread_t *th = GET_THREAD();
- rb_fiber_t *fib = th->fiber;
+ rb_fiber_t *fib;
+ rb_context_t *cont;
rb_proc_t *proc;
int state;
+ GetFiberPtr(th->fiber, fib);
+ cont = &fib->cont;
+
TH_PUSH_TAG(th);
if ((state = EXEC_TAG()) == 0) {
- rb_context_t *cont = &VAR_FROM_MEMORY(fib)->cont;
int argc;
const VALUE *argv, args = cont->value;
GetProcPtr(cont->saved_thread.first_proc, proc);
@@ -1275,10 +1285,9 @@ rb_fiber_start(void)
cont->value = Qnil;
th->errinfo = Qnil;
th->root_lep = rb_vm_ep_local_ep(proc->block.ep);
- th->root_svar = Qfalse;
- fib->status = RUNNING;
+ th->root_svar = Qnil;
- EXEC_EVENT_HOOK(th, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, Qnil);
+ fib->status = RUNNING;
cont->value = rb_vm_invoke_proc(th, proc, argc, argv, 0);
}
TH_POP_TAG();
@@ -1312,117 +1321,90 @@ root_fiber_alloc(rb_thread_t *th)
#endif
#endif
fib->status = RUNNING;
+ fib->prev_fiber = fib->next_fiber = fib;
return fib;
}
-static inline rb_fiber_t*
-fiber_current(void)
+VALUE
+rb_fiber_current(void)
{
rb_thread_t *th = GET_THREAD();
if (th->fiber == 0) {
/* save root */
rb_fiber_t *fib = root_fiber_alloc(th);
- th->root_fiber = th->fiber = fib;
+ th->root_fiber = th->fiber = fib->cont.self;
}
return th->fiber;
}
-static inline rb_fiber_t*
-return_fiber(void)
-{
- rb_fiber_t *fib = fiber_current();
- rb_fiber_t *prev = fib->prev;
-
- if (!prev) {
- rb_fiber_t *root_fiber = GET_THREAD()->root_fiber;
-
- if (root_fiber == fib) {
- rb_raise(rb_eFiberError, "can't yield from root fiber");
- }
- return root_fiber;
- }
- else {
- fib->prev = NULL;
- return prev;
- }
-}
-
-VALUE
-rb_fiber_current(void)
-{
- return fiber_current()->cont.self;
-}
-
-static inline VALUE
-fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
+static VALUE
+fiber_store(rb_fiber_t *next_fib)
{
+ rb_thread_t *th = GET_THREAD();
rb_fiber_t *fib;
if (th->fiber) {
- fib = th->fiber;
+ GetFiberPtr(th->fiber, fib);
cont_save_thread(&fib->cont, th);
}
else {
/* create current fiber */
fib = root_fiber_alloc(th);
- th->root_fiber = th->fiber = fib;
+ th->root_fiber = th->fiber = fib->cont.self;
}
+#if !FIBER_USE_NATIVE
+ cont_save_machine_stack(th, &fib->cont);
+#endif
+
+ if (FIBER_USE_NATIVE || ruby_setjmp(fib->cont.jmpbuf)) {
#if FIBER_USE_NATIVE
- fiber_setcontext(next_fib, fib);
- /* restored */
+ fiber_setcontext(next_fib, fib);
#ifndef _WIN32
- if (terminated_machine_stack.ptr) {
- if (machine_stack_cache_index < MAX_MACHINE_STACK_CACHE) {
- machine_stack_cache[machine_stack_cache_index].ptr = terminated_machine_stack.ptr;
- machine_stack_cache[machine_stack_cache_index].size = terminated_machine_stack.size;
- machine_stack_cache_index++;
- }
- else {
- if (terminated_machine_stack.ptr != fib->cont.machine.stack) {
- munmap((void*)terminated_machine_stack.ptr, terminated_machine_stack.size * sizeof(VALUE));
+ if (terminated_machine_stack.ptr) {
+ if (machine_stack_cache_index < MAX_MACHINE_STACK_CACHE) {
+ machine_stack_cache[machine_stack_cache_index].ptr = terminated_machine_stack.ptr;
+ machine_stack_cache[machine_stack_cache_index].size = terminated_machine_stack.size;
+ machine_stack_cache_index++;
}
else {
- rb_bug("terminated fiber resumed");
+ if (terminated_machine_stack.ptr != fib->cont.machine_stack) {
+ munmap((void*)terminated_machine_stack.ptr, terminated_machine_stack.size * sizeof(VALUE));
+ }
+ else {
+ rb_bug("terminated fiber resumed");
+ }
}
+ terminated_machine_stack.ptr = NULL;
+ terminated_machine_stack.size = 0;
}
- terminated_machine_stack.ptr = NULL;
- terminated_machine_stack.size = 0;
- }
-#endif /* not _WIN32 */
- fib = th->fiber;
- if (fib->cont.argc == -1) rb_exc_raise(fib->cont.value);
- return fib->cont.value;
-
-#else /* FIBER_USE_NATIVE */
- cont_save_machine_stack(th, &fib->cont);
- if (ruby_setjmp(fib->cont.jmpbuf)) {
+#endif
+#endif
/* restored */
- fib = th->fiber;
+ GetFiberPtr(th->fiber, fib);
if (fib->cont.argc == -1) rb_exc_raise(fib->cont.value);
- if (next_fib->cont.value == Qundef) {
- cont_restore_0(&next_fib->cont, &next_fib->cont.value);
- rb_bug("rb_fiber_resume: unreachable");
- }
return fib->cont.value;
}
+#if !FIBER_USE_NATIVE
else {
- VALUE undef = Qundef;
- cont_restore_0(&next_fib->cont, &undef);
- rb_bug("rb_fiber_resume: unreachable");
+ return Qundef;
}
-#endif /* FIBER_USE_NATIVE */
+#endif
}
static inline VALUE
-fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
+fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
{
VALUE value;
- rb_context_t *cont = &fib->cont;
+ rb_fiber_t *fib;
+ rb_context_t *cont;
rb_thread_t *th = GET_THREAD();
- if (th->fiber == fib) {
+ GetFiberPtr(fibval, fib);
+ cont = &fib->cont;
+
+ if (th->fiber == fibval) {
/* ignore fiber context switch
* because destination fiber is same as current fiber
*/
@@ -1437,25 +1419,34 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
}
else if (fib->status == TERMINATED) {
value = rb_exc_new2(rb_eFiberError, "dead fiber called");
-
- if (th->fiber->status != TERMINATED) rb_exc_raise(value);
-
- /* th->fiber is also dead => switch to root fiber */
- /* (this means we're being called from rb_fiber_terminate, */
- /* and the terminated fiber's return_fiber() is already dead) */
- cont = &th->root_fiber->cont;
+ if (th->fiber != fibval) {
+ GetFiberPtr(th->fiber, fib);
+ if (fib->status != TERMINATED) rb_exc_raise(value);
+ fibval = th->root_fiber;
+ }
+ else {
+ fibval = fib->prev;
+ if (NIL_P(fibval)) fibval = th->root_fiber;
+ }
+ GetFiberPtr(fibval, fib);
+ cont = &fib->cont;
cont->argc = -1;
cont->value = value;
#if FIBER_USE_NATIVE
- fiber_setcontext(th->root_fiber, th->fiber);
+ {
+ VALUE oldfibval;
+ rb_fiber_t *oldfib;
+ oldfibval = rb_fiber_current();
+ GetFiberPtr(oldfibval, oldfib);
+ fiber_setcontext(fib, oldfib);
+ }
#else
cont_restore_0(cont, &value);
#endif
- /* unreachable */
}
if (is_resume) {
- fib->prev = fiber_current();
+ fib->prev = rb_fiber_current();
}
else {
/* restore `tracing' context. see [Feature #4347] */
@@ -1465,69 +1456,56 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
cont->argc = argc;
cont->value = make_passing_arg(argc, argv);
- value = fiber_store(fib, th);
+ value = fiber_store(fib);
+#if !FIBER_USE_NATIVE
+ if (value == Qundef) {
+ cont_restore_0(cont, &value);
+ rb_bug("rb_fiber_resume: unreachable");
+ }
+#endif
RUBY_VM_CHECK_INTS(th);
- EXEC_EVENT_HOOK(th, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, Qnil);
-
return value;
}
VALUE
-rb_fiber_transfer(VALUE fibval, int argc, const VALUE *argv)
+rb_fiber_transfer(VALUE fib, int argc, VALUE *argv)
{
- rb_fiber_t *fib;
- GetFiberPtr(fibval, fib);
return fiber_switch(fib, argc, argv, 0);
}
-static void
-rb_fiber_terminate(rb_fiber_t *fib)
-{
- VALUE value = fib->cont.value;
- fib->status = TERMINATED;
-#if FIBER_USE_NATIVE && !defined(_WIN32)
- /* Ruby must not switch to other thread until storing terminated_machine_stack */
- terminated_machine_stack.ptr = fib->ss_sp;
- terminated_machine_stack.size = fib->ss_size / sizeof(VALUE);
- fib->ss_sp = NULL;
- fib->context.uc_stack.ss_sp = NULL;
- fib->cont.machine.stack = NULL;
- fib->cont.machine.stack_size = 0;
-#endif
- fiber_switch(return_fiber(), 1, &value, 0);
-}
-
VALUE
-rb_fiber_resume(VALUE fibval, int argc, const VALUE *argv)
+rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
{
rb_fiber_t *fib;
GetFiberPtr(fibval, fib);
- if (fib->prev != 0 || fib->cont.type == ROOT_FIBER_CONTEXT) {
+ if (fib->prev != Qnil || fib->cont.type == ROOT_FIBER_CONTEXT) {
rb_raise(rb_eFiberError, "double resume");
}
- if (fib->transferred != 0) {
+ if (fib->transfered != 0) {
rb_raise(rb_eFiberError, "cannot resume transferred Fiber");
}
- return fiber_switch(fib, argc, argv, 1);
+ return fiber_switch(fibval, argc, argv, 1);
}
VALUE
-rb_fiber_yield(int argc, const VALUE *argv)
+rb_fiber_yield(int argc, VALUE *argv)
{
- return fiber_switch(return_fiber(), argc, argv, 0);
+ return rb_fiber_transfer(return_fiber(), argc, argv);
}
void
rb_fiber_reset_root_local_storage(VALUE thval)
{
rb_thread_t *th;
+ rb_fiber_t *fib;
GetThreadPtr(thval, th);
if (th->root_fiber && th->root_fiber != th->fiber) {
- th->local_storage = th->root_fiber->cont.saved_thread.local_storage;
+ GetFiberPtr(th->root_fiber, fib);
+ th->local_storage = fib->cont.saved_thread.local_storage;
}
}
@@ -1607,7 +1585,7 @@ rb_fiber_m_resume(int argc, VALUE *argv, VALUE fib)
* fiber2.resume
* fiber3.resume
*
- * <em>produces</em>
+ * <em>produces</em>
*
* In fiber 2
* In fiber 1
@@ -1619,8 +1597,8 @@ rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fibval)
{
rb_fiber_t *fib;
GetFiberPtr(fibval, fib);
- fib->transferred = 1;
- return fiber_switch(fib, argc, argv, 0);
+ fib->transfered = 1;
+ return rb_fiber_transfer(fibval, argc, argv);
}
/*
@@ -1681,7 +1659,7 @@ Init_Cont(void)
#else /* not WIN32 */
pagesize = sysconf(_SC_PAGESIZE);
#endif
- SET_MACHINE_STACK_END(&th->machine.stack_end);
+ SET_MACHINE_STACK_END(&th->machine_stack_end);
#endif
rb_cFiber = rb_define_class("Fiber", rb_cObject);
diff --git a/coverage/README b/coverage/README
deleted file mode 100644
index 7e4ff59e2a..0000000000
--- a/coverage/README
+++ /dev/null
@@ -1,17 +0,0 @@
-Usage
-
-The make task `update-coverage' retrieves simplecov for coverage report.
-
-COVERAGE=1 make test-all TESTS=test/cgi
-
-it generate test coverage to coverage directory.
-
-Limitation
-
- * test_coverage.rb and test_process.rb broke test suit with SimpleCov
- * some tests failed randomly.
-
-TODO
-
- * more reduce bundled simplecov(additional configuration, formatter, etc)
- * measure rubyspec coverage
diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in
index edf02242ee..5bd414d786 100644
--- a/cygwin/GNUmakefile.in
+++ b/cygwin/GNUmakefile.in
@@ -33,7 +33,7 @@ WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
-include uncommon.mk
SOLIBS := $(DLL_BASE_NAME).res.@OBJEXT@ $(SOLIBS)
-override EXTOBJS += $(if $(filter-out $(RUBYW_INSTALL_NAME),$(@:$(EXEEXT)=)),$(RUBY_INSTALL_NAME),$(@:$(EXEEXT)=)).res.$(OBJEXT)
+EXTOBJS += $(if $(filter-out $(RUBYW_INSTALL_NAME),$(@:$(EXEEXT)=)),$(RUBY_INSTALL_NAME),$(@:$(EXEEXT)=)).res.$(OBJEXT)
RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc
RUBYDEF = $(DLL_BASE_NAME).def
@@ -67,11 +67,11 @@ $(WPROGRAM): $(RUBYW_INSTALL_NAME).res.@OBJEXT@
$(ECHO) linking $@
$(Q) $(PURIFY) $(CC) -mwindows -e $(SYMBOL_PREFIX)mainCRTStartup $(LDFLAGS) $(XLDFLAGS) \
$(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
-$(STUBPROGRAM): $(RUBY_INSTALL_NAME).res.@OBJEXT@ win32/stub.@OBJEXT@
+$(STUBPROGRAM): $(RUBY_INSTALL_NAME).res.@OBJEXT@ stub.@OBJEXT@
@rm -f $@
$(ECHO) linking $@
$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) \
- win32/stub.@OBJEXT@ $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
+ stub.@OBJEXT@ $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
$(RUBY_EXP): $(LIBRUBY_A)
$(ECHO) creating $@
@@ -86,15 +86,7 @@ GNUmakefile: $(srcdir)/cygwin/GNUmakefile.in
ifeq (@target_os@,mingw32)
$(OBJS) $(MAINOBJ): win32.h
-dir.$(OBJEXT) win32/win32.$(OBJEXT): win32/dir.h
-file.$(OBJEXT) win32/win32.$(OBJEXT): win32/file.h
-
-MSYS2_ARG_CONV_EXCL_PARAM = --exclude=;--name=
-
-yes-test-ruby: export MSYS2_ARG_CONV_EXCL=$(MSYS2_ARG_CONV_EXCL_PARAM)
-yes-test-all: export MSYS2_ARG_CONV_EXCL=$(MSYS2_ARG_CONV_EXCL_PARAM)
-yes-test-almost: export MSYS2_ARG_CONV_EXCL=$(MSYS2_ARG_CONV_EXCL_PARAM)
-
+dir.$(OBJEXT) win32.$(OBJEXT): win32/dir.h
endif
$(LIBRUBY_SO): $(RUBYDEF)
diff --git a/debug.c b/debug.c
index a600259818..2f1e03cc3a 100644
--- a/debug.c
+++ b/debug.c
@@ -25,11 +25,41 @@ const union {
enum node_type node_type;
enum ruby_method_ids method_ids;
enum ruby_id_types id_types;
- enum ruby_fl_type fl_types;
- enum ruby_encoding_consts encoding_consts;
- enum ruby_coderange_type enc_coderange_types;
- enum ruby_econv_flag_type econv_flag_types;
enum {
+ RUBY_ENCODING_INLINE_MAX = ENCODING_INLINE_MAX,
+ RUBY_ENCODING_SHIFT = ENCODING_SHIFT,
+ RUBY_ENC_CODERANGE_MASK = ENC_CODERANGE_MASK,
+ RUBY_ENC_CODERANGE_UNKNOWN = ENC_CODERANGE_UNKNOWN,
+ RUBY_ENC_CODERANGE_7BIT = ENC_CODERANGE_7BIT,
+ RUBY_ENC_CODERANGE_VALID = ENC_CODERANGE_VALID,
+ RUBY_ENC_CODERANGE_BROKEN = ENC_CODERANGE_BROKEN,
+ RUBY_FL_WB_PROTECTED = FL_WB_PROTECTED,
+ RUBY_FL_PROMOTED = FL_PROMOTED,
+ RUBY_FL_FINALIZE = FL_FINALIZE,
+ RUBY_FL_TAINT = FL_TAINT,
+ RUBY_FL_EXIVAR = FL_EXIVAR,
+ RUBY_FL_FREEZE = FL_FREEZE,
+ RUBY_FL_SINGLETON = FL_SINGLETON,
+ RUBY_FL_USER0 = FL_USER0,
+ RUBY_FL_USER1 = FL_USER1,
+ RUBY_FL_USER2 = FL_USER2,
+ RUBY_FL_USER3 = FL_USER3,
+ RUBY_FL_USER4 = FL_USER4,
+ RUBY_FL_USER5 = FL_USER5,
+ RUBY_FL_USER6 = FL_USER6,
+ RUBY_FL_USER7 = FL_USER7,
+ RUBY_FL_USER8 = FL_USER8,
+ RUBY_FL_USER9 = FL_USER9,
+ RUBY_FL_USER10 = FL_USER10,
+ RUBY_FL_USER11 = FL_USER11,
+ RUBY_FL_USER12 = FL_USER12,
+ RUBY_FL_USER13 = FL_USER13,
+ RUBY_FL_USER14 = FL_USER14,
+ RUBY_FL_USER15 = FL_USER15,
+ RUBY_FL_USER16 = FL_USER16,
+ RUBY_FL_USER17 = FL_USER17,
+ RUBY_FL_USER18 = FL_USER18,
+ RUBY_FL_USHIFT = FL_USHIFT,
RUBY_NODE_TYPESHIFT = NODE_TYPESHIFT,
RUBY_NODE_TYPEMASK = NODE_TYPEMASK,
RUBY_NODE_LSHIFT = NODE_LSHIFT,
@@ -37,7 +67,9 @@ const union {
} various;
} ruby_dummy_gdb_enums;
+const VALUE RUBY_FL_USER19 = FL_USER19;
const SIGNED_VALUE RUBY_NODE_LMASK = NODE_LMASK;
+const VALUE RUBY_ENCODING_MASK = ENCODING_MASK;
int
ruby_debug_print_indent(int level, int debug_level, int indent_level)
@@ -107,20 +139,18 @@ ruby_debug_breakpoint(void)
static void
set_debug_option(const char *str, int len, void *arg)
{
-#if defined _WIN32 && RUBY_MSVCRT_VERSION >= 80
- extern int ruby_w32_rtc_error;
-#endif
-#define SET_WHEN(name, var, val) do { \
+#define SET_WHEN(name, var) do { \
if (len == sizeof(name) - 1 && \
strncmp(str, (name), len) == 0) { \
- (var) = (val); \
+ extern int var; \
+ var = 1; \
return; \
} \
} while (0)
- SET_WHEN("gc_stress", *ruby_initial_gc_stress_ptr, Qtrue);
- SET_WHEN("core", ruby_enable_coredump, 1);
-#if defined _WIN32 && RUBY_MSVCRT_VERSION >= 80
- SET_WHEN("rtc_error", ruby_w32_rtc_error, 1);
+ SET_WHEN("gc_stress", *ruby_initial_gc_stress_ptr);
+ SET_WHEN("core", ruby_enable_coredump);
+#if defined _WIN32 && defined _MSC_VER && _MSC_VER >= 1400
+ SET_WHEN("rtc_error", ruby_w32_rtc_error);
#endif
fprintf(stderr, "unexpected debug option: %.*s\n", len, str);
}
diff --git a/defs/default_gems b/defs/default_gems
new file mode 100644
index 0000000000..e73e383b26
--- /dev/null
+++ b/defs/default_gems
@@ -0,0 +1,5 @@
+# gem base directory versioning file [executable files under bin]
+rake lib/rake lib/rake/version.rb [rake]
+rdoc lib/rdoc lib/rdoc.rb [rdoc ri]
+minitest lib/minitest lib/minitest/unit.rb
+json ext/json ext/json/lib/json/version.rb
diff --git a/defs/gmake.mk b/defs/gmake.mk
index 439ca9b6f0..0acb88ef57 100644
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -1,56 +1,20 @@
# -*- makefile-gmake -*-
-gnumake = yes
-
-CHECK_TARGETS := exam love check%
TEST_TARGETS := $(filter check test check% test% btest%,$(MAKECMDGOALS))
TEST_TARGETS += $(subst check,test-all,$(patsubst check-%,test-%,$(TEST_TARGETS)))
TEST_TARGETS := $(patsubst test-%,yes-test-%,$(patsubst btest-%,yes-btest-%,$(TEST_TARGETS)))
TEST_DEPENDS := $(if $(TEST_TARGETS),$(filter all main exts,$(MAKECMDGOALS)))
-TEST_DEPENDS += $(if $(filter $(CHECK_TARGETS),$(MAKECMDGOALS)),main)
-TEST_DEPENDS += $(if $(filter main,$(TEST_DEPENDS)),$(if $(filter all,$(INSTALLDOC)),docs))
-
-ifneq ($(filter -O0 -Od,$(optflags)),)
-override XCFLAGS := $(filter-out -D_FORTIFY_SOURCE=%,$(XCFLAGS))
-endif
-
-ifeq ($(if $(filter all main exts enc trans libencs libenc libtrans \
- prog program ruby ruby$(EXEEXT) \
- wprogram rubyw rubyw$(EXEEXT) \
- miniruby$(EXEEXT) mini,\
- $(MAKECMDGOALS)),,$(MAKECMDGOALS)),)
--include $(SHOWFLAGS)
-endif
-
-ifneq ($(filter universal-%,$(arch)),)
-define archcmd
-%.$(1).S: %.c
- @$$(ECHO) translating $$< with $(2)
- $$(Q) $$(CC) $$(CFLAGS_NO_ARCH) $(2) $$(XCFLAGS) $$(CPPFLAGS) $$(COUTFLAG)$$@ -S $$<
-
-%.S: %.$(1).S
-
-%.$(1).i: %.c
- @$$(ECHO) preprocessing $$< with $(2)
- $$(Q) $$(CPP) $$(warnflags) $(2) $$(XCFLAGS) $$(CPPFLAGS) $$(COUTFLAG)$$@ -E $$< > $$@
+TEST_DEPENDS += $(TEST_DEPENDS) $(if $(filter check%,$(MAKECMDGOALS)),main)
-%.i: %.$(1).i
-endef
-
-$(foreach arch,$(filter -arch=%,$(subst -arch ,-arch=,$(ARCH_FLAG))),\
- $(eval $(call archcmd,$(patsubst -arch=%,%,$(value arch)),$(patsubst -arch=%,-arch %,$(value arch)))))
-endif
-
-ifneq ($(filter $(CHECK_TARGETS) test,$(MAKECMDGOALS)),)
+ifneq ($(filter check% test,$(MAKECMDGOALS)),)
yes-test-knownbug: $(TEST_DEPENDS) yes-btest-ruby
yes-btest-ruby: $(TEST_DEPENDS) yes-test-sample
yes-test-sample: $(TEST_DEPENDS)
endif
-ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS)) $(filter test-all,$(TEST_TARGETS)),)
-yes-test-testframework yes-test-almost yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS))
+ifneq ($(filter check%,$(MAKECMDGOALS)) $(filter test-all,$(TEST_TARGETS)),)
+yes-test-all yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS))
endif
-ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS))$(if $(filter test-all,$(MAKECMDGOALS)),$(filter test-knownbug,$(MAKECMDGOALS))),)
-yes-test-testframework yes-test-almost yes-test-ruby: yes-test-knownbug
-yes-test-almost: yes-test-testframework
+ifneq ($(filter check%,$(MAKECMDGOALS))$(if $(filter test-all,$(MAKECMDGOALS)),$(filter test-knownbug,$(MAKECMDGOALS))),)
+yes-test-all yes-test-ruby: yes-test-knownbug
endif
$(TEST_TARGETS): $(TEST_DEPENDS)
@@ -61,18 +25,5 @@ $(word 1,$(install-targets)): $(word 0,$(install-targets))
endif
ifneq ($(filter reinstall,$(MAKECMDGOALS)),)
-install-prereq: uninstall
-uninstall sudo-precheck: all $(if $(filter all,$(INSTALLDOC)),docs)
-endif
-
-ifneq ($(filter exam,$(MAKECMDGOALS)),)
-test-rubyspec: check
-yes-test-all no-test-all: test
-endif
-
-ifneq ($(filter love,$(MAKECMDGOALS)),)
-showflags: up
-sudo-precheck: test
-install-prereq: sudo-precheck
-yes-test-all no-test-all: install
+install: uninstall
endif
diff --git a/defs/id.def b/defs/id.def
index 1ff0d9aa3d..53ed3775ad 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -26,22 +26,6 @@ firstline, predefined = __LINE__+1, %[\
initialize_copy
initialize_clone
initialize_dup
- to_int
- to_ary
- to_str
- to_sym
- to_hash
- to_proc
- to_io
- to_a
- to_s
- to_i
- bt
- bt_locations
- call
- mesg
- exception
-
_ UScore
"/*NULL*/" NULL
empty?
@@ -60,44 +44,6 @@ firstline, predefined = __LINE__+1, %[\
core#hash_merge_ary
core#hash_merge_ptr
core#hash_merge_kwd
-
- - debug#created_info
-]
-
-# VM ID OP Parser Token
-token_ops = %[\
- Dot2 .. DOT2
- Dot3 ... DOT3
- UPlus +@ UPLUS
- UMinus -@ UMINUS
- Pow ** POW
- DSTAR **
- Cmp <=> CMP
- PLUS +
- MINUS -
- MULT *
- DIV /
- MOD %
- LTLT << LSHFT
- GTGT >> RSHFT
- LT <
- LE <= LEQ
- GT >
- GE >= GEQ
- Eq == EQ
- Eqq === EQQ
- Neq != NEQ
- Not !
- Backquote `
- EqTilde =~ MATCH
- NeqTilde !~ NMATCH
- AREF []
- ASET []=
- COLON2 ::
- COLON3 ::
- ANDOP &&
- OROP ||
- ANDDOT &.
]
class KeywordError < RuntimeError
@@ -113,8 +59,6 @@ instance_ids = []
global_ids = []
const_ids = []
class_ids = []
-attrset_ids = []
-token_op_ids = []
names = {}
predefined.split(/^/).each_with_index do |line, num|
next if /^#/ =~ line
@@ -131,10 +75,6 @@ predefined.split(/^/).each_with_index do |line, num|
token.sub!(/\A@/, "_I_")
token.gsub!(/\W+/, "")
end
- if name == '-'
- preserved_ids << token
- next
- end
if prev = names[name]
KeywordError.raise("#{name} is already registered at line #{prev+firstline}", firstline+num)
end
@@ -148,27 +88,18 @@ predefined.split(/^/).each_with_index do |line, num|
when /\A\$(?:\d+|(?!\d)\w+)\z/; global_ids
when /\A@@(?!\d)\w+\z/; class_ids
when /\A@(?!\d)\w+\z/; instance_ids
- when /\A((?!\d)\w+)=\z/; attrset_ids
+ when /\A((?!\d)\w+)=\z/
+ KeywordError.raise("use ID2ATTRSET(#{$1}) instead of ATTRSET #{name}", firstline+num)
else preserved_ids
end << token
predefined_ids[token] = name
end
-token_ops.split(/^/).each do |line|
- next if /^#/ =~ line
- line.sub!(/\s+#.*/, '')
- id, op, token = line.split
- next unless id and op
- token ||= (id unless /\A\W\z/ =~ op)
- token_op_ids << [id, op, token]
-end
{
"LOCAL" => local_ids,
"INSTANCE" => instance_ids,
"GLOBAL" => global_ids,
"CONST" => const_ids,
"CLASS" => class_ids,
- "ATTRSET" => attrset_ids,
:preserved => preserved_ids,
:predefined => predefined_ids,
- :token_op => token_op_ids,
}
diff --git a/defs/keywords b/defs/keywords
index e0d931cd1f..1b5719aa85 100644
--- a/defs/keywords
+++ b/defs/keywords
@@ -1,5 +1,5 @@
%{
-struct kwtable {int name, id[2], state;};
+struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER
static const struct kwtable *reserved_word(const char *, unsigned int);
@@ -13,7 +13,7 @@ __LINE__, {keyword__LINE__, keyword__LINE__}, EXPR_END
__FILE__, {keyword__FILE__, keyword__FILE__}, EXPR_END
BEGIN, {keyword_BEGIN, keyword_BEGIN}, EXPR_END
END, {keyword_END, keyword_END}, EXPR_END
-alias, {keyword_alias, keyword_alias}, EXPR_FNAME|EXPR_FITEM
+alias, {keyword_alias, keyword_alias}, EXPR_FNAME
and, {keyword_and, keyword_and}, EXPR_VALUE
begin, {keyword_begin, keyword_begin}, EXPR_BEG
break, {keyword_break, keyword_break}, EXPR_MID
@@ -43,7 +43,7 @@ self, {keyword_self, keyword_self}, EXPR_END
super, {keyword_super, keyword_super}, EXPR_ARG
then, {keyword_then, keyword_then}, EXPR_BEG
true, {keyword_true, keyword_true}, EXPR_END
-undef, {keyword_undef, keyword_undef}, EXPR_FNAME|EXPR_FITEM
+undef, {keyword_undef, keyword_undef}, EXPR_FNAME
unless, {keyword_unless, modifier_unless}, EXPR_VALUE
until, {keyword_until, modifier_until}, EXPR_VALUE
when, {keyword_when, keyword_when}, EXPR_VALUE
diff --git a/defs/known_errors.def b/defs/known_errors.def
index b9c490d3a2..3cebe90a8e 100644
--- a/defs/known_errors.def
+++ b/defs/known_errors.def
@@ -143,6 +143,3 @@ EPROGMISMATCH
EPROGUNAVAIL
ERPCMISMATCH
EIPSEC
-EHWPOISON
-ECAPMODE
-ENOTCAPABLE
diff --git a/defs/lex.c.src b/defs/lex.c.src
index e0d931cd1f..1b5719aa85 100644
--- a/defs/lex.c.src
+++ b/defs/lex.c.src
@@ -1,5 +1,5 @@
%{
-struct kwtable {int name, id[2], state;};
+struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER
static const struct kwtable *reserved_word(const char *, unsigned int);
@@ -13,7 +13,7 @@ __LINE__, {keyword__LINE__, keyword__LINE__}, EXPR_END
__FILE__, {keyword__FILE__, keyword__FILE__}, EXPR_END
BEGIN, {keyword_BEGIN, keyword_BEGIN}, EXPR_END
END, {keyword_END, keyword_END}, EXPR_END
-alias, {keyword_alias, keyword_alias}, EXPR_FNAME|EXPR_FITEM
+alias, {keyword_alias, keyword_alias}, EXPR_FNAME
and, {keyword_and, keyword_and}, EXPR_VALUE
begin, {keyword_begin, keyword_begin}, EXPR_BEG
break, {keyword_break, keyword_break}, EXPR_MID
@@ -43,7 +43,7 @@ self, {keyword_self, keyword_self}, EXPR_END
super, {keyword_super, keyword_super}, EXPR_ARG
then, {keyword_then, keyword_then}, EXPR_BEG
true, {keyword_true, keyword_true}, EXPR_END
-undef, {keyword_undef, keyword_undef}, EXPR_FNAME|EXPR_FITEM
+undef, {keyword_undef, keyword_undef}, EXPR_FNAME
unless, {keyword_unless, modifier_unless}, EXPR_VALUE
until, {keyword_until, modifier_until}, EXPR_VALUE
when, {keyword_when, keyword_when}, EXPR_VALUE
diff --git a/defs/opt_operand.def b/defs/opt_operand.def
index 887e3da49a..ab7103a421 100644
--- a/defs/opt_operand.def
+++ b/defs/opt_operand.def
@@ -1,5 +1,5 @@
#
-# configuration file for operand union optimization
+# configration file for operand union optimization
#
# format:
# [insn name] op1, op2 ...
diff --git a/dir.c b/dir.c
index 7376d5df1c..e3a74c18b0 100644
--- a/dir.c
+++ b/dir.c
@@ -11,8 +11,9 @@
**********************************************************************/
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "internal.h"
-#include "encindex.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -72,63 +73,24 @@ char *strchr(char*,char);
#define rmdir(p) rb_w32_urmdir(p)
#undef opendir
#define opendir(p) rb_w32_uopendir(p)
-#define IS_WIN32 1
-#else
-#define IS_WIN32 0
-#endif
-
-#ifdef HAVE_SYS_ATTR_H
-#include <sys/attr.h>
-#endif
-
-#ifdef HAVE_GETATTRLIST
-# define USE_NAME_ON_FS 1
-# define RUP32(size) ((size)+3/4)
-# define SIZEUP32(type) RUP32(sizeof(type))
-#elif defined _WIN32
-# define USE_NAME_ON_FS 1
-#elif defined DOSISH
-# define USE_NAME_ON_FS 2 /* by fnmatch */
-#else
-# define USE_NAME_ON_FS 0
#endif
#ifdef __APPLE__
-# define NORMALIZE_UTF8PATH 1
+# define HAVE_HFS 1
#else
-# define NORMALIZE_UTF8PATH 0
+# define HAVE_HFS 0
#endif
-
-#if NORMALIZE_UTF8PATH
+#if HAVE_HFS
#include <sys/param.h>
#include <sys/mount.h>
-#include <sys/vnode.h>
-# if defined HAVE_FGETATTRLIST || !defined HAVE_GETATTRLIST
-# define need_normalization(dirp, path) need_normalization(dirp)
-# else
-# define need_normalization(dirp, path) need_normalization(path)
-# endif
static inline int
-need_normalization(DIR *dirp, const char *path)
-{
-# if defined HAVE_FGETATTRLIST || defined HAVE_GETATTRLIST
- u_int32_t attrbuf[SIZEUP32(fsobj_tag_t)];
- struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, ATTR_CMN_OBJTAG,};
-# if defined HAVE_FGETATTRLIST
- int ret = fgetattrlist(dirfd(dirp), &al, attrbuf, sizeof(attrbuf), 0);
-# else
- int ret = getattrlist(path, &al, attrbuf, sizeof(attrbuf), 0);
-# endif
- if (!ret) {
- const fsobj_tag_t *tag = (void *)(attrbuf+1);
- switch (*tag) {
- case VT_HFS:
- case VT_CIFS:
- return TRUE;
- }
+is_hfs(DIR *dirp)
+{
+ struct statfs buf;
+ if (fstatfs(dirfd(dirp), &buf) == 0) {
+ return buf.f_type == 17; /* HFS on darwin */
}
-# endif
return FALSE;
}
@@ -143,30 +105,10 @@ has_nonascii(const char *ptr, size_t len)
return 0;
}
-# define IF_NORMALIZE_UTF8PATH(something) something
-#else
-# define IF_NORMALIZE_UTF8PATH(something) /* nothing */
-#endif
-
-#ifndef IFTODT
-# define IFTODT(m) (((m) & S_IFMT) / ((~S_IFMT & S_IFMT-1) + 1))
-#endif
-
-typedef enum {
-#ifdef DT_UNKNOWN
- path_exist = DT_UNKNOWN,
- path_directory = DT_DIR,
- path_regular = DT_REG,
- path_symlink = DT_LNK,
+# define IF_HAVE_HFS(something) something
#else
- path_exist,
- path_directory = IFTODT(S_IFDIR),
- path_regular = IFTODT(S_IFREG),
- path_symlink = IFTODT(S_IFLNK),
+# define IF_HAVE_HFS(something) /* nothing */
#endif
- path_noent = -1,
- path_unknown = -2
-} rb_pathtype_t;
#define FNM_NOESCAPE 0x01
#define FNM_PATHNAME 0x02
@@ -178,11 +120,6 @@ typedef enum {
#else
#define FNM_SYSCASE 0
#endif
-#if _WIN32
-#define FNM_SHORTNAME 0x20
-#else
-#define FNM_SHORTNAME 0
-#endif
#define FNM_NOMATCH 1
#define FNM_ERROR 2
@@ -259,7 +196,7 @@ bracket(
return ok == not ? NULL : (char *)p + 1;
}
-/* If FNM_PATHNAME is set, only path element will be matched. (up to '/' or '\0')
+/* If FNM_PATHNAME is set, only path element will be matched. (upto '/' or '\0')
Otherwise, entire string will be matched.
End marker itself won't be compared.
And if function succeeds, *pcur reaches end marker.
@@ -438,13 +375,13 @@ dir_free(void *ptr)
static size_t
dir_memsize(const void *ptr)
{
- return sizeof(struct dir_data);
+ return ptr ? sizeof(struct dir_data) : 0;
}
static const rb_data_type_t dir_data_type = {
"dir",
{dir_mark, dir_free, dir_memsize,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE dir_close(VALUE);
@@ -487,21 +424,18 @@ dir_initialize(int argc, VALUE *argv, VALUE dir)
struct dir_data *dp;
rb_encoding *fsenc;
VALUE dirname, opt, orig;
- static ID keyword_ids[1];
- const char *path;
+ static VALUE sym_enc;
- if (!keyword_ids[0]) {
- keyword_ids[0] = rb_id_encoding();
+ if (!sym_enc) {
+ sym_enc = ID2SYM(rb_intern("encoding"));
}
-
fsenc = rb_filesystem_encoding();
rb_scan_args(argc, argv, "1:", &dirname, &opt);
if (!NIL_P(opt)) {
- VALUE enc;
- rb_get_kwargs(opt, keyword_ids, 0, 1, &enc);
- if (enc != Qundef && !NIL_P(enc)) {
+ VALUE enc = rb_hash_aref(opt, sym_enc);
+ if (!NIL_P(enc)) {
fsenc = rb_to_encoding(enc);
}
}
@@ -516,23 +450,13 @@ dir_initialize(int argc, VALUE *argv, VALUE dir)
dp->dir = NULL;
dp->path = Qnil;
dp->enc = fsenc;
- path = RSTRING_PTR(dirname);
- dp->dir = opendir(path);
+ dp->dir = opendir(RSTRING_PTR(dirname));
if (dp->dir == NULL) {
- if (rb_gc_for_fd(errno)) {
- dp->dir = opendir(path);
- }
-#ifdef HAVE_GETATTRLIST
- else if (errno == EIO) {
- u_int32_t attrbuf[1];
- struct attrlist al = {ATTR_BIT_MAP_COUNT, 0};
- if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW) == 0) {
- dp->dir = opendir(path);
- }
+ if (errno == EMFILE || errno == ENFILE) {
+ rb_gc();
+ dp->dir = opendir(RSTRING_PTR(dirname));
}
-#endif
if (dp->dir == NULL) {
- RB_GC_GUARD(dirname);
rb_sys_fail_path(orig);
}
}
@@ -578,16 +502,11 @@ dir_closed(void)
}
static struct dir_data *
-dir_get(VALUE dir)
-{
- rb_check_frozen(dir);
- return rb_check_typeddata(dir, &dir_data_type);
-}
-
-static struct dir_data *
dir_check(VALUE dir)
{
- struct dir_data *dirp = dir_get(dir);
+ struct dir_data *dirp;
+ rb_check_frozen(dir);
+ dirp = rb_check_typeddata(dir, &dir_data_type);
if (!dirp->dir) dir_closed();
return dirp;
}
@@ -615,52 +534,8 @@ dir_inspect(VALUE dir)
rb_str_cat2(str, ">");
return str;
}
- return rb_funcallv(dir, rb_intern("to_s"), 0, 0);
-}
-
-/* Workaround for Solaris 10 that does not have dirfd.
- Note: Solaris 11 (POSIX.1-2008 compliant) has dirfd(3C).
- */
-#if defined(__sun) && !defined(HAVE_DIRFD)
-# if defined(HAVE_DIR_D_FD)
-# define dirfd(x) ((x)->d_fd)
-# define HAVE_DIRFD 1
-# elif defined(HAVE_DIR_DD_FD)
-# define dirfd(x) ((x)->dd_fd)
-# define HAVE_DIRFD 1
-# endif
-#endif
-
-#ifdef HAVE_DIRFD
-/*
- * call-seq:
- * dir.fileno -> integer
- *
- * Returns the file descriptor used in <em>dir</em>.
- *
- * d = Dir.new("..")
- * d.fileno #=> 8
- *
- * This method uses dirfd() function defined by POSIX 2008.
- * NotImplementedError is raised on other platforms, such as Windows,
- * which doesn't provide the function.
- *
- */
-static VALUE
-dir_fileno(VALUE dir)
-{
- struct dir_data *dirp;
- int fd;
-
- GetDIR(dir, dirp);
- fd = dirfd(dirp->dir);
- if (fd == -1)
- rb_sys_fail("dirfd");
- return INT2NUM(fd);
+ return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}
-#else
-#define dir_fileno rb_f_notimplement
-#endif
/*
* call-seq:
@@ -683,18 +558,6 @@ dir_path(VALUE dir)
}
#if defined _WIN32
-static int
-fundamental_encoding_p(rb_encoding *enc)
-{
- switch (rb_enc_to_index(enc)) {
- case ENCINDEX_ASCII:
- case ENCINDEX_US_ASCII:
- case ENCINDEX_UTF_8:
- return TRUE;
- default:
- return FALSE;
- }
-}
# define READDIR(dir, enc) rb_w32_readdir((dir), (enc))
#else
# define READDIR(dir, enc) readdir((dir))
@@ -754,18 +617,18 @@ dir_each(VALUE dir)
{
struct dir_data *dirp;
struct dirent *dp;
- IF_NORMALIZE_UTF8PATH(int norm_p);
+ IF_HAVE_HFS(int hfs_p);
RETURN_ENUMERATOR(dir, 0, 0);
GetDIR(dir, dirp);
rewinddir(dirp->dir);
- IF_NORMALIZE_UTF8PATH(norm_p = need_normalization(dirp->dir, RSTRING_PTR(dirp->path)));
+ IF_HAVE_HFS(hfs_p = is_hfs(dirp->dir));
while ((dp = READDIR(dirp->dir, dirp->enc)) != NULL) {
const char *name = dp->d_name;
size_t namlen = NAMLEN(dp);
VALUE path;
-#if NORMALIZE_UTF8PATH
- if (norm_p && has_nonascii(name, namlen) &&
+#if HAVE_HFS
+ if (hfs_p && has_nonascii(name, namlen) &&
!NIL_P(path = rb_str_normalize_ospath(name, namlen))) {
path = rb_external_str_with_enc(path, dirp->enc);
}
@@ -885,8 +748,8 @@ dir_rewind(VALUE dir)
* call-seq:
* dir.close -> nil
*
- * Closes the directory stream.
- * Calling this method on closed Dir object is ignored since Ruby 2.3.
+ * Closes the directory stream. Any further attempts to access
+ * <em>dir</em> will raise an <code>IOError</code>.
*
* d = Dir.new("testdir")
* d.close #=> nil
@@ -896,8 +759,7 @@ dir_close(VALUE dir)
{
struct dir_data *dirp;
- dirp = dir_get(dir);
- if (!dirp->dir) return Qnil;
+ GetDIR(dir, dirp);
closedir(dirp->dir);
dirp->dir = NULL;
@@ -986,6 +848,7 @@ dir_s_chdir(int argc, VALUE *argv, VALUE obj)
{
VALUE path = Qnil;
+ rb_secure(2);
if (rb_scan_args(argc, argv, "01", &path) == 1) {
FilePathValue(path);
path = rb_str_encode_ospath(path);
@@ -1022,17 +885,10 @@ rb_dir_getwd(void)
{
char *path;
VALUE cwd;
- int fsenc = rb_enc_to_index(rb_filesystem_encoding());
- if (fsenc == ENCINDEX_US_ASCII) fsenc = ENCINDEX_ASCII;
path = my_getcwd();
-#ifdef __APPLE__
- cwd = rb_str_normalize_ospath(path, strlen(path));
- OBJ_TAINT(cwd);
-#else
cwd = rb_tainted_str_new2(path);
-#endif
- rb_enc_associate_index(cwd, fsenc);
+ rb_enc_associate(cwd, rb_filesystem_encoding());
xfree(path);
return cwd;
@@ -1048,7 +904,6 @@ rb_dir_getwd(void)
*
* Dir.chdir("/tmp") #=> 0
* Dir.getwd #=> "/tmp"
- * Dir.pwd #=> "/tmp"
*/
static VALUE
dir_s_getwd(VALUE dir)
@@ -1056,14 +911,15 @@ dir_s_getwd(VALUE dir)
return rb_dir_getwd();
}
-static VALUE
-check_dirname(VALUE dir)
+static void
+check_dirname(volatile VALUE *dir)
{
- VALUE d = dir;
+ VALUE d = *dir;
char *path, *pend;
long len;
rb_encoding *enc;
+ rb_secure(2);
FilePathValue(d);
enc = rb_enc_get(d);
RSTRING_GETMEM(d, path, len);
@@ -1071,9 +927,8 @@ check_dirname(VALUE dir)
pend = rb_enc_path_end(rb_enc_path_skip_prefix(path, pend, enc), pend, enc);
if (pend - path < len) {
d = rb_str_subseq(d, 0, pend - path);
- StringValueCStr(d);
}
- return rb_str_encode_ospath(d);
+ *dir = rb_str_encode_ospath(d);
}
#if defined(HAVE_CHROOT)
@@ -1089,7 +944,7 @@ check_dirname(VALUE dir)
static VALUE
dir_s_chroot(VALUE dir, VALUE path)
{
- path = check_dirname(path);
+ check_dirname(&path);
if (chroot(RSTRING_PTR(path)) == -1)
rb_sys_fail_path(path);
@@ -1127,7 +982,7 @@ dir_s_mkdir(int argc, VALUE *argv, VALUE obj)
mode = 0777;
}
- path = check_dirname(path);
+ check_dirname(&path);
if (mkdir(RSTRING_PTR(path), mode) == -1)
rb_sys_fail_path(path);
@@ -1146,56 +1001,26 @@ dir_s_mkdir(int argc, VALUE *argv, VALUE obj)
static VALUE
dir_s_rmdir(VALUE obj, VALUE dir)
{
- dir = check_dirname(dir);
+ check_dirname(&dir);
if (rmdir(RSTRING_PTR(dir)) < 0)
rb_sys_fail_path(dir);
return INT2FIX(0);
}
-struct warning_args {
-#ifdef RUBY_FUNCTION_NAME_STRING
- const char *func;
-#endif
- const char *mesg;
- rb_encoding *enc;
-};
-
-#ifndef RUBY_FUNCTION_NAME_STRING
-#define sys_enc_warning_in(func, mesg, enc) sys_enc_warning(mesg, enc)
-#endif
-
static VALUE
sys_warning_1(VALUE mesg)
{
- const struct warning_args *arg = (struct warning_args *)mesg;
-#ifdef RUBY_FUNCTION_NAME_STRING
- rb_sys_enc_warning(arg->enc, "%s: %s", arg->func, arg->mesg);
-#else
- rb_sys_enc_warning(arg->enc, "%s", arg->mesg);
-#endif
+ rb_sys_warning("%s:%s", strerror(errno), (const char *)mesg);
return Qnil;
}
-static void
-sys_enc_warning_in(const char *func, const char *mesg, rb_encoding *enc)
-{
- struct warning_args arg;
-#ifdef RUBY_FUNCTION_NAME_STRING
- arg.func = func;
-#endif
- arg.mesg = mesg;
- arg.enc = enc;
- rb_protect(sys_warning_1, (VALUE)&arg, 0);
-}
-
#define GLOB_VERBOSE (1U << (sizeof(int) * CHAR_BIT - 1))
-#define sys_warning(val, enc) \
- ((flags & GLOB_VERBOSE) ? sys_enc_warning_in(RUBY_FUNCTION_NAME_STRING, (val), (enc)) :(void)0)
+#define sys_warning(val) \
+ (void)((flags & GLOB_VERBOSE) && rb_protect(sys_warning_1, (VALUE)(val), 0))
#define GLOB_ALLOC(type) ((type *)malloc(sizeof(type)))
#define GLOB_ALLOC_N(type, n) ((type *)malloc(sizeof(type) * (n)))
-#define GLOB_REALLOC(ptr, size) realloc((ptr), (size))
#define GLOB_FREE(ptr) free(ptr)
#define GLOB_JUMP_TAG(status) (((status) == -1) ? rb_memerror() : rb_jump_tag(status))
@@ -1207,30 +1032,29 @@ sys_enc_warning_in(const char *func, const char *mesg, rb_encoding *enc)
#ifdef _WIN32
#define STAT(p, s) rb_w32_ustati64((p), (s))
-#undef lstat
-#define lstat(p, s) rb_w32_ulstati64((p), (s))
#else
#define STAT(p, s) stat((p), (s))
#endif
/* System call with warning */
static int
-do_stat(const char *path, struct stat *pst, int flags, rb_encoding *enc)
+do_stat(const char *path, struct stat *pst, int flags)
+
{
int ret = STAT(path, pst);
if (ret < 0 && !to_be_ignored(errno))
- sys_warning(path, enc);
+ sys_warning(path);
return ret;
}
#if defined HAVE_LSTAT || defined lstat
static int
-do_lstat(const char *path, struct stat *pst, int flags, rb_encoding *enc)
+do_lstat(const char *path, struct stat *pst, int flags)
{
int ret = lstat(path, pst);
if (ret < 0 && !to_be_ignored(errno))
- sys_warning(path, enc);
+ sys_warning(path);
return ret;
}
@@ -1243,8 +1067,10 @@ do_opendir(const char *path, int flags, rb_encoding *enc)
{
DIR *dirp;
#ifdef _WIN32
- VALUE tmp = 0;
- if (!fundamental_encoding_p(enc)) {
+ volatile VALUE tmp;
+ if (enc != rb_usascii_encoding() &&
+ enc != rb_ascii8bit_encoding() &&
+ enc != rb_utf8_encoding()) {
tmp = rb_enc_str_new(path, strlen(path), enc);
tmp = rb_str_encode_ospath(tmp);
path = RSTRING_PTR(tmp);
@@ -1252,23 +1078,17 @@ do_opendir(const char *path, int flags, rb_encoding *enc)
#endif
dirp = opendir(path);
if (dirp == NULL && !to_be_ignored(errno))
- sys_warning(path, enc);
-#ifdef _WIN32
- if (tmp) rb_str_resize(tmp, 0); /* GC guard */
-#endif
+ sys_warning(path);
return dirp;
}
-/* Globing pattern */
-enum glob_pattern_type { PLAIN, ALPHA, MAGICAL, RECURSIVE, MATCH_ALL, MATCH_DIR };
-
/* Return nonzero if S has any special globbing chars in it. */
-static enum glob_pattern_type
+static int
has_magic(const char *p, const char *pend, int flags, rb_encoding *enc)
{
const int escape = !(flags & FNM_NOESCAPE);
- int hasalpha = 0;
+ const int nocase = flags & FNM_CASEFOLD;
register char c;
@@ -1277,32 +1097,22 @@ has_magic(const char *p, const char *pend, int flags, rb_encoding *enc)
case '*':
case '?':
case '[':
- return MAGICAL;
+ return 1;
case '\\':
- if (escape && p++ >= pend)
- continue;
- break;
-
-#ifdef _WIN32
- case '.':
- break;
+ if (escape && !(c = *p++))
+ return 0;
+ continue;
- case '~':
- hasalpha = 1;
- break;
-#endif
default:
- if (IS_WIN32 || ISALPHA(c)) {
- hasalpha = 1;
- }
- break;
+ if (!FNM_SYSCASE && ISALPHA(c) && nocase)
+ return 1;
}
p = Next(p-1, pend, enc);
}
- return hasalpha ? ALPHA : PLAIN;
+ return 0;
}
/* Find separator in globbing pattern. */
@@ -1366,6 +1176,9 @@ remove_backslashes(char *p, register const char *pend, rb_encoding *enc)
return p;
}
+/* Globing pattern */
+enum glob_pattern_type { PLAIN, MAGICAL, RECURSIVE, MATCH_ALL, MATCH_DIR };
+
struct glob_pattern {
char *str;
enum glob_pattern_type type;
@@ -1384,7 +1197,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
while (p < e && *p) {
tmp = GLOB_ALLOC(struct glob_pattern);
if (!tmp) goto error;
- if (p + 2 < e && p[0] == '*' && p[1] == '*' && p[2] == '/') {
+ if (p[0] == '*' && p[1] == '*' && p[2] == '/') {
/* fold continuous RECURSIVEs (needed in glob_helper) */
do { p += 3; while (*p == '/') p++; } while (p[0] == '*' && p[1] == '*' && p[2] == '/');
tmp->type = RECURSIVE;
@@ -1394,13 +1207,12 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
}
else {
const char *m = find_dirsep(p, e, flags, enc);
- const enum glob_pattern_type magic = has_magic(p, m, flags, enc);
- const enum glob_pattern_type non_magic = (USE_NAME_ON_FS || FNM_SYSCASE) ? PLAIN : ALPHA;
+ int magic = has_magic(p, m, flags, enc);
char *buf;
- if (!(FNM_SYSCASE || magic > non_magic) && !recursive && *m) {
+ if (!magic && !recursive && *m) {
const char *m2;
- while (has_magic(m+1, m2 = find_dirsep(m+1, e, flags, enc), flags, enc) <= non_magic &&
+ while (!has_magic(m+1, m2 = find_dirsep(m+1, e, flags, enc), flags, enc) &&
*m2) {
m = m2;
}
@@ -1412,7 +1224,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
}
memcpy(buf, p, m-p);
buf[m-p] = '\0';
- tmp->type = magic > MAGICAL ? MAGICAL : magic > non_magic ? magic : PLAIN;
+ tmp->type = magic ? MAGICAL : PLAIN;
tmp->str = buf;
if (*m) {
dirsep = 1;
@@ -1469,165 +1281,7 @@ join_path(const char *path, long len, int dirsep, const char *name, size_t namle
return buf;
}
-#ifdef HAVE_GETATTRLIST
-# if defined HAVE_FGETATTRLIST
-# define is_case_sensitive(dirp, path) is_case_sensitive(dirp)
-# else
-# define is_case_sensitive(dirp, path) is_case_sensitive(path)
-# endif
-static int
-is_case_sensitive(DIR *dirp, const char *path)
-{
- struct {
- u_int32_t length;
- vol_capabilities_attr_t cap[1];
- } __attribute__((aligned(4), packed)) attrbuf[1];
- struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, 0, ATTR_VOL_INFO|ATTR_VOL_CAPABILITIES};
- const vol_capabilities_attr_t *const cap = attrbuf[0].cap;
- const int idx = VOL_CAPABILITIES_FORMAT;
- const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
-
-# if defined HAVE_FGETATTRLIST
- if (fgetattrlist(dirfd(dirp), &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
- return -1;
-# else
- if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
- return -1;
-# endif
- if (!(cap->valid[idx] & mask))
- return -1;
- return (cap->capabilities[idx] & mask) != 0;
-}
-
-static char *
-replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int flags, rb_pathtype_t *type)
-{
- struct {
- u_int32_t length;
- attrreference_t ref[1];
- fsobj_type_t objtype;
- char path[MAXPATHLEN * 3];
- } __attribute__((aligned(4), packed)) attrbuf[1];
- struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, ATTR_CMN_NAME|ATTR_CMN_OBJTYPE};
- const attrreference_t *const ar = attrbuf[0].ref;
- const char *name;
- long len;
- char *tmp;
- IF_NORMALIZE_UTF8PATH(VALUE utf8str = Qnil);
-
- *type = path_noent;
- if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW)) {
- if (!to_be_ignored(errno))
- sys_warning(path, enc);
- return path;
- }
-
- switch (attrbuf[0].objtype) {
- case VREG: *type = path_regular; break;
- case VDIR: *type = path_directory; break;
- case VLNK: *type = path_symlink; break;
- default: *type = path_exist; break;
- }
- name = (char *)ar + ar->attr_dataoffset;
- len = (long)ar->attr_length - 1;
- if (name + len > (char *)attrbuf + sizeof(attrbuf))
- return path;
-
-# if NORMALIZE_UTF8PATH
- if (norm_p && has_nonascii(name, len)) {
- if (!NIL_P(utf8str = rb_str_normalize_ospath(name, len))) {
- RSTRING_GETMEM(utf8str, name, len);
- }
- }
-# endif
-
- tmp = GLOB_REALLOC(path, base + len + 1);
- if (tmp) {
- path = tmp;
- memcpy(path + base, name, len);
- path[base + len] = '\0';
- }
- IF_NORMALIZE_UTF8PATH(if (!NIL_P(utf8str)) rb_str_resize(utf8str, 0));
- return path;
-}
-#elif defined _WIN32
-VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
-int rb_w32_reparse_symlink_p(const WCHAR *path);
-
-static char *
-replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int flags, rb_pathtype_t *type)
-{
- char *plainname = path;
- volatile VALUE tmp = 0;
- WIN32_FIND_DATAW fd;
- WIN32_FILE_ATTRIBUTE_DATA fa;
- WCHAR *wplain;
- HANDLE h = INVALID_HANDLE_VALUE;
- long wlen;
- int e = 0;
- if (!fundamental_encoding_p(enc)) {
- tmp = rb_enc_str_new_cstr(plainname, enc);
- tmp = rb_str_encode_ospath(tmp);
- plainname = RSTRING_PTR(tmp);
- }
- wplain = rb_w32_mbstr_to_wstr(CP_UTF8, plainname, -1, &wlen);
- if (tmp) rb_str_resize(tmp, 0);
- if (!wplain) return path;
- if (GetFileAttributesExW(wplain, GetFileExInfoStandard, &fa)) {
- h = FindFirstFileW(wplain, &fd);
- e = rb_w32_map_errno(GetLastError());
- }
- if (fa.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
- if (!rb_w32_reparse_symlink_p(wplain))
- fa.dwFileAttributes &= ~FILE_ATTRIBUTE_REPARSE_POINT;
- }
- free(wplain);
- if (h == INVALID_HANDLE_VALUE) {
- *type = path_noent;
- if (e && !to_be_ignored(e)) {
- errno = e;
- sys_warning(path, enc);
- }
- return path;
- }
- FindClose(h);
- *type =
- (fa.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) ? path_symlink :
- (fa.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? path_directory :
- path_regular;
- if (tmp) {
- char *buf;
- tmp = rb_w32_conv_from_wchar(fd.cFileName, enc);
- wlen = RSTRING_LEN(tmp);
- buf = GLOB_REALLOC(path, base + wlen + 1);
- if (buf) {
- path = buf;
- memcpy(path + base, RSTRING_PTR(tmp), wlen);
- path[base + wlen] = 0;
- }
- rb_str_resize(tmp, 0);
- }
- else {
- char *utf8filename;
- wlen = WideCharToMultiByte(CP_UTF8, 0, fd.cFileName, -1, NULL, 0, NULL, NULL);
- utf8filename = GLOB_REALLOC(0, wlen);
- if (utf8filename) {
- char *buf;
- WideCharToMultiByte(CP_UTF8, 0, fd.cFileName, -1, utf8filename, wlen, NULL, NULL);
- buf = GLOB_REALLOC(path, base + wlen + 1);
- if (buf) {
- path = buf;
- memcpy(path + base, utf8filename, wlen);
- path[base + wlen] = 0;
- }
- GLOB_FREE(utf8filename);
- }
- }
- return path;
-}
-#elif USE_NAME_ON_FS == 1
-# error not implemented
-#endif
+enum answer {UNKNOWN = -1, NO, YES};
#ifndef S_ISDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -1648,35 +1302,23 @@ struct glob_args {
rb_encoding *enc;
};
-#define glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (void *)(enc))
-
static VALUE
glob_func_caller(VALUE val)
{
struct glob_args *args = (struct glob_args *)val;
- glob_call_func(args->func, args->path, args->value, args->enc);
+ (*args->func)(args->path, args->value, args->enc);
return Qnil;
}
-static inline int
-dirent_match(const char *pat, rb_encoding *enc, const char *name, const struct dirent *dp, int flags)
-{
- if (fnmatch(pat, enc, name, flags) == 0) return 1;
-#ifdef _WIN32
- if (dp->d_altname && (flags & FNM_SHORTNAME)) {
- if (fnmatch(pat, enc, dp->d_altname, flags) == 0) return 1;
- }
-#endif
- return 0;
-}
+#define glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (enc))
static int
glob_helper(
const char *path,
- long pathlen,
int dirsep, /* '/' should be placed before appending child entry's name to 'path'. */
- rb_pathtype_t pathtype, /* type of 'path' */
+ enum answer exist, /* Does 'path' indicate an existing entry? */
+ enum answer isdir, /* Does 'path' indicate a directory or a symlink to a directory? */
struct glob_pattern **beg,
struct glob_pattern **end,
int flags,
@@ -1689,6 +1331,7 @@ glob_helper(
struct glob_pattern **cur, **new_beg, **new_end;
int plain = 0, magical = 0, recursive = 0, match_all = 0, match_dir = 0;
int escape = !(flags & FNM_NOESCAPE);
+ long pathlen;
for (cur = beg; cur < end; ++cur) {
struct glob_pattern *p = *cur;
@@ -1700,15 +1343,8 @@ glob_helper(
case PLAIN:
plain = 1;
break;
- case ALPHA:
-#if USE_NAME_ON_FS == 1
- plain = 1;
-#else
- magical = 1;
-#endif
- break;
case MAGICAL:
- magical = 2;
+ magical = 1;
break;
case MATCH_ALL:
match_all = 1;
@@ -1721,28 +1357,33 @@ glob_helper(
}
}
+ pathlen = strlen(path);
if (*path) {
- if (match_all && pathtype == path_unknown) {
- if (do_lstat(path, &st, flags, enc) == 0) {
- pathtype = IFTODT(st.st_mode);
+ if (match_all && exist == UNKNOWN) {
+ if (do_lstat(path, &st, flags) == 0) {
+ exist = YES;
+ isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;
}
else {
- pathtype = path_noent;
+ exist = NO;
+ isdir = NO;
}
}
- if (match_dir && pathtype == path_unknown) {
- if (do_stat(path, &st, flags, enc) == 0) {
- pathtype = IFTODT(st.st_mode);
+ if (match_dir && isdir == UNKNOWN) {
+ if (do_stat(path, &st, flags) == 0) {
+ exist = YES;
+ isdir = S_ISDIR(st.st_mode) ? YES : NO;
}
else {
- pathtype = path_noent;
+ exist = NO;
+ isdir = NO;
}
}
- if (match_all && pathtype > path_noent) {
+ if (match_all && exist == YES) {
status = glob_call_func(func, path, arg, enc);
if (status) return status;
}
- if (match_dir && pathtype == path_directory) {
+ if (match_dir && isdir == YES) {
char *tmp = join_path(path, pathlen, dirsep, "", 0);
if (!tmp) return -1;
status = glob_call_func(func, tmp, arg, enc);
@@ -1751,53 +1392,23 @@ glob_helper(
}
}
- if (pathtype == path_noent) return 0;
+ if (exist == NO || isdir == NO) return 0;
if (magical || recursive) {
struct dirent *dp;
DIR *dirp;
-# if USE_NAME_ON_FS == 2
- char *plainname = 0;
-# endif
- IF_NORMALIZE_UTF8PATH(int norm_p);
-# if USE_NAME_ON_FS == 2
- if (cur + 1 == end && (*cur)->type <= ALPHA) {
- plainname = join_path(path, pathlen, dirsep, (*cur)->str, strlen((*cur)->str));
- if (!plainname) return -1;
- dirp = do_opendir(plainname, flags, enc);
- GLOB_FREE(plainname);
- }
- else
-# endif
+ IF_HAVE_HFS(int hfs_p);
dirp = do_opendir(*path ? path : ".", flags, enc);
- if (dirp == NULL) {
-# if FNM_SYSCASE || NORMALIZE_UTF8PATH
- if ((magical < 2) && !recursive && (errno == EACCES)) {
- /* no read permission, fallback */
- goto literally;
- }
-# endif
- return 0;
- }
- IF_NORMALIZE_UTF8PATH(norm_p = need_normalization(dirp, *path ? path : "."));
+ if (dirp == NULL) return 0;
+ IF_HAVE_HFS(hfs_p = is_hfs(dirp));
-# if NORMALIZE_UTF8PATH
- if (!(norm_p || magical || recursive)) {
- closedir(dirp);
- goto literally;
- }
-# endif
-# ifdef HAVE_GETATTRLIST
- if (is_case_sensitive(dirp, path) == 0)
- flags |= FNM_CASEFOLD;
-# endif
while ((dp = READDIR(dirp, enc)) != NULL) {
char *buf;
- rb_pathtype_t new_pathtype = path_unknown;
+ enum answer new_isdir = UNKNOWN;
const char *name;
size_t namlen;
int dotfile = 0;
- IF_NORMALIZE_UTF8PATH(VALUE utf8str = Qnil);
+ IF_HAVE_HFS(VALUE utf8str = Qnil);
if (recursive && dp->d_name[0] == '.') {
++dotfile;
@@ -1814,33 +1425,30 @@ glob_helper(
name = dp->d_name;
namlen = NAMLEN(dp);
-# if NORMALIZE_UTF8PATH
- if (norm_p && has_nonascii(name, namlen)) {
+# if HAVE_HFS
+ if (hfs_p && has_nonascii(name, namlen)) {
if (!NIL_P(utf8str = rb_str_normalize_ospath(name, namlen))) {
RSTRING_GETMEM(utf8str, name, namlen);
}
}
# endif
buf = join_path(path, pathlen, dirsep, name, namlen);
- IF_NORMALIZE_UTF8PATH(if (!NIL_P(utf8str)) rb_str_resize(utf8str, 0));
+ IF_HAVE_HFS(if (!NIL_P(utf8str)) rb_str_resize(utf8str, 0));
if (!buf) {
status = -1;
break;
}
name = buf + pathlen + (dirsep != 0);
if (recursive && dotfile < ((flags & FNM_DOTMATCH) ? 2 : 1)) {
-#ifdef DT_UNKNOWN
- if ((new_pathtype = dp->d_type) != (rb_pathtype_t)DT_UNKNOWN)
- /* Got it. We need nothing more. */
- ;
- else
- /* fall back to call lstat(2) */
-#endif
/* RECURSIVE never match dot files unless FNM_DOTMATCH is set */
- if (do_lstat(buf, &st, flags, enc) == 0)
- new_pathtype = IFTODT(st.st_mode);
+#ifndef _WIN32
+ if (do_lstat(buf, &st, flags) == 0)
+ new_isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;
else
- new_pathtype = path_noent;
+ new_isdir = NO;
+#else
+ new_isdir = dp->d_isdir ? (!dp->d_isrep ? YES : UNKNOWN) : NO;
+#endif
}
new_beg = new_end = GLOB_ALLOC_N(struct glob_pattern *, (end - beg) * 2);
@@ -1853,30 +1461,17 @@ glob_helper(
for (cur = beg; cur < end; ++cur) {
struct glob_pattern *p = *cur;
if (p->type == RECURSIVE) {
- if (new_pathtype == path_directory || /* not symlink but real directory */
- new_pathtype == path_exist)
+ if (new_isdir == YES) /* not symlink but real directory */
*new_end++ = p; /* append recursive pattern */
p = p->next; /* 0 times recursion */
}
- switch (p->type) {
- case ALPHA:
-# if USE_NAME_ON_FS == 2
- if (plainname) {
- *new_end++ = p->next;
- break;
- }
-# endif
- case PLAIN:
- case MAGICAL:
- if (dirent_match(p->str, enc, name, dp, flags))
+ if (p->type == PLAIN || p->type == MAGICAL) {
+ if (fnmatch(p->str, enc, name, flags) == 0)
*new_end++ = p->next;
- default:
- break;
}
}
- status = glob_helper(buf, name - buf + namlen, 1,
- new_pathtype, new_beg, new_end,
+ status = glob_helper(buf, 1, YES, new_isdir, new_beg, new_end,
flags, func, arg, enc);
GLOB_FREE(buf);
GLOB_FREE(new_beg);
@@ -1888,17 +1483,13 @@ glob_helper(
else if (plain) {
struct glob_pattern **copy_beg, **copy_end, **cur2;
-# if FNM_SYSCASE || NORMALIZE_UTF8PATH
- literally:
-# endif
copy_beg = copy_end = GLOB_ALLOC_N(struct glob_pattern *, end - beg);
if (!copy_beg) return -1;
for (cur = beg; cur < end; ++cur)
- *copy_end++ = (*cur)->type <= ALPHA ? *cur : 0;
+ *copy_end++ = (*cur)->type == PLAIN ? *cur : 0;
for (cur = copy_beg; cur < copy_end; ++cur) {
if (*cur) {
- rb_pathtype_t new_pathtype = path_unknown;
char *buf;
char *name;
size_t len = strlen((*cur)->str) + 1;
@@ -1932,16 +1523,8 @@ glob_helper(
status = -1;
break;
}
-#if USE_NAME_ON_FS == 1
- if ((*cur)->type == ALPHA) {
- long base = pathlen + (dirsep != 0);
- buf = replace_real_basename(buf, base, enc, IF_NORMALIZE_UTF8PATH(1)+0,
- flags, &new_pathtype);
- }
-#endif
- status = glob_helper(buf, pathlen + strlen(buf + pathlen), 1,
- new_pathtype, new_beg, new_end,
- flags, func, arg, enc);
+ status = glob_helper(buf, 1, UNKNOWN, UNKNOWN, new_beg,
+ new_end, flags, func, arg, enc);
GLOB_FREE(buf);
GLOB_FREE(new_beg);
if (status) break;
@@ -1969,7 +1552,7 @@ ruby_glob0(const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_enco
root = rb_enc_path_skip_prefix(root, root + strlen(root), enc);
#endif
- if (*root == '/') root++;
+ if (root && *root == '/') root++;
n = root - start;
buf = GLOB_ALLOC_N(char, n + 1);
@@ -1982,8 +1565,7 @@ ruby_glob0(const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_enco
GLOB_FREE(buf);
return -1;
}
- status = glob_helper(buf, n, 0, path_unknown, &list, &list + 1,
- flags, func, arg, enc);
+ status = glob_helper(buf, 0, UNKNOWN, UNKNOWN, &list, &list + 1, flags, func, arg, enc);
glob_free_pattern(list);
GLOB_FREE(buf);
@@ -2037,15 +1619,7 @@ rb_glob(const char *path, void (*func)(const char *, VALUE, void *), VALUE arg)
static void
push_pattern(const char *path, VALUE ary, void *enc)
{
-#if defined _WIN32 || defined __APPLE__
- VALUE name = rb_utf8_str_new_cstr(path);
- rb_encoding *eenc = rb_default_internal_encoding();
- OBJ_TAINT(name);
- name = rb_str_conv_enc(name, NULL, eenc ? eenc : enc);
-#else
- VALUE name = rb_external_str_new_with_enc(path, strlen(path), enc);
-#endif
- rb_ary_push(ary, name);
+ rb_ary_push(ary, rb_external_str_new_with_enc(path, strlen(path), enc));
}
static int
@@ -2063,7 +1637,7 @@ ruby_brace_expand(const char *str, int flags, ruby_glob_func *func, VALUE arg,
if (*p == '{' && nest++ == 0) {
lbrace = p;
}
- if (*p == '}' && lbrace && --nest == 0) {
+ if (*p == '}' && --nest <= 0) {
rbrace = p;
break;
}
@@ -2101,7 +1675,7 @@ ruby_brace_expand(const char *str, int flags, ruby_glob_func *func, VALUE arg,
GLOB_FREE(buf);
}
else if (!lbrace && !rbrace) {
- status = glob_call_func(func, s, arg, enc);
+ status = (*func)(s, arg, enc);
}
return status;
@@ -2121,12 +1695,12 @@ glob_brace(const char *path, VALUE val, void *enc)
return ruby_glob0(path, arg->flags, arg->func, arg->value, enc);
}
-int
-ruby_brace_glob_with_enc(const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
+static int
+ruby_brace_glob0(const char *str, int flags, ruby_glob_func *func, VALUE arg,
+ rb_encoding* enc)
{
struct brace_args args;
- flags &= ~GLOB_VERBOSE;
args.func = func;
args.value = arg;
args.flags = flags;
@@ -2136,47 +1710,30 @@ ruby_brace_glob_with_enc(const char *str, int flags, ruby_glob_func *func, VALUE
int
ruby_brace_glob(const char *str, int flags, ruby_glob_func *func, VALUE arg)
{
- return ruby_brace_glob_with_enc(str, flags, func, arg, rb_ascii8bit_encoding());
+ return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg,
+ rb_ascii8bit_encoding());
}
-struct push_glob_args {
- struct glob_args glob;
- int flags;
-};
-
-static int
-push_caller(const char *path, VALUE val, void *enc)
+int
+ruby_brace_glob_with_enc(const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc)
{
- struct push_glob_args *arg = (struct push_glob_args *)val;
-
- return ruby_glob0(path, arg->flags, rb_glob_caller, (VALUE)&arg->glob, enc);
+ return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg, enc);
}
static int
push_glob(VALUE ary, VALUE str, int flags)
{
- struct push_glob_args args;
+ struct glob_args args;
rb_encoding *enc = rb_enc_get(str);
-#if defined _WIN32 || defined __APPLE__
- str = rb_str_encode_ospath(str);
-#endif
- if (rb_enc_to_index(enc) == ENCINDEX_US_ASCII)
- enc = rb_filesystem_encoding();
- if (rb_enc_to_index(enc) == ENCINDEX_US_ASCII)
- enc = rb_ascii8bit_encoding();
- flags |= GLOB_VERBOSE;
- args.glob.func = push_pattern;
- args.glob.value = ary;
- args.glob.enc = enc;
- args.flags = flags;
-#if defined _WIN32 || defined __APPLE__
- enc = rb_utf8_encoding();
-#endif
+ if (enc == rb_usascii_encoding()) enc = rb_filesystem_encoding();
+ args.func = push_pattern;
+ args.value = ary;
+ args.enc = enc;
RB_GC_GUARD(str);
- return ruby_brace_expand(RSTRING_PTR(str), flags,
- push_caller, (VALUE)&args, enc);
+ return ruby_brace_glob0(RSTRING_PTR(str), flags | GLOB_VERBOSE,
+ rb_glob_caller, (VALUE)&args, enc);
}
static VALUE
@@ -2225,9 +1782,11 @@ dir_globs(long argc, const VALUE *argv, int flags)
/*
* call-seq:
+ * Dir[ array ] -> array
* Dir[ string [, string ...] ] -> array
*
* Equivalent to calling
+ * <code>Dir.glob(</code><i>array,</i><code>0)</code> and
* <code>Dir.glob([</code><i>string,...</i><code>],0)</code>.
*
*/
@@ -2331,9 +1890,8 @@ dir_s_glob(int argc, VALUE *argv, VALUE obj)
ary = rb_push_glob(str, flags);
}
else {
- VALUE v = ary;
+ volatile VALUE v = ary;
ary = dir_globs(RARRAY_LEN(v), RARRAY_CONST_PTR(v), flags);
- RB_GC_GUARD(v);
}
if (rb_block_given_p()) {
@@ -2596,23 +2154,18 @@ dir_s_home(int argc, VALUE *argv, VALUE obj)
/*
* call-seq:
* Dir.exist?(file_name) -> true or false
+ * Dir.exists?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is a directory,
* <code>false</code> otherwise.
*
*/
VALUE
-rb_file_directory_p(void)
+rb_file_directory_p()
{
}
#endif
-/*
- * call-seq:
- * Dir.exists?(file_name) -> true or false
- *
- * Deprecated method. Don't use.
- */
static VALUE
rb_dir_exists_p(VALUE obj, VALUE fname)
{
@@ -2644,7 +2197,6 @@ Init_Dir(void)
rb_define_singleton_method(rb_cDir, "entries", dir_entries, -1);
rb_define_method(rb_cDir,"initialize", dir_initialize, -1);
- rb_define_method(rb_cDir,"fileno", dir_fileno, 0);
rb_define_method(rb_cDir,"path", dir_path, 0);
rb_define_method(rb_cDir,"to_path", dir_path, 0);
rb_define_method(rb_cDir,"inspect", dir_inspect, 0);
@@ -2707,18 +2259,5 @@ Init_Dir(void)
* Allows file globbing through "{a,b}" in File.fnmatch patterns.
*/
rb_file_const("FNM_EXTGLOB", INT2FIX(FNM_EXTGLOB));
-
- /* Document-const: File::Constants::FNM_SYSCASE
- *
- * System default case insensitiveness, equals to FNM_CASEFOLD or
- * 0.
- */
rb_file_const("FNM_SYSCASE", INT2FIX(FNM_SYSCASE));
-
- /* Document-const: File::Constants::FNM_SHORTNAME
- *
- * Makes patterns to match short names if existing. Valid only
- * on Microsoft Windows.
- */
- rb_file_const("FNM_SHORTNAME", INT2FIX(FNM_SHORTNAME));
}
diff --git a/dln.c b/dln.c
index 0f918af090..e6b20d54e3 100644
--- a/dln.c
+++ b/dln.c
@@ -47,7 +47,6 @@ void *xcalloc();
void *xrealloc();
#endif
-#undef free
#define free(x) xfree(x)
#include <stdio.h>
@@ -85,6 +84,10 @@ char *getenv();
# endif
#endif
+#if defined(__BEOS__) || defined(__HAIKU__)
+# include <image.h>
+#endif
+
#ifndef dln_loaderror
static void
dln_loaderror(const char *format, ...)
@@ -102,12 +105,13 @@ dln_loaderror(const char *format, ...)
# define USE_DLN_DLOPEN
#endif
-#if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(NeXT) || defined(MACOSX_DYLD)
-# define EXTERNAL_PREFIX "_"
-#else
-# define EXTERNAL_PREFIX ""
+#ifndef FUNCNAME_PATTERN
+# if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(__BORLANDC__) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD)
+# define FUNCNAME_PREFIX "_Init_"
+# else
+# define FUNCNAME_PREFIX "Init_"
+# endif
#endif
-#define FUNCNAME_PREFIX EXTERNAL_PREFIX"Init_"
#if defined __CYGWIN__ || defined DOSISH
#define isdirsep(x) ((x) == '/' || (x) == '\\')
@@ -1113,12 +1117,12 @@ dln_sym(const char *name)
#endif
#endif
-#ifdef _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
#include <windows.h>
#include <imagehlp.h>
#endif
-#ifdef _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
static const char *
dln_strerror(char *message, size_t size)
{
@@ -1174,26 +1178,25 @@ dln_strerror(void)
static void
aix_loaderror(const char *pathname)
{
- char *message[1024], errbuf[1024];
- int i;
-#define ERRBUF_APPEND(s) strlcat(errbuf, (s), sizeof(errbuf))
- snprintf(errbuf, sizeof(errbuf), "load failed - %s. ", pathname);
-
- if (loadquery(L_GETMESSAGES, &message[0], sizeof(message)) != -1) {
- ERRBUF_APPEND("Please issue below command for detailed reasons:\n\t");
- ERRBUF_APPEND("/usr/sbin/execerror ruby ");
- for (i=0; message[i]; i++) {
- ERRBUF_APPEND("\"");
- ERRBUF_APPEND(message[i]);
- ERRBUF_APPEND("\" ");
- }
- ERRBUF_APPEND("\n");
+ char *message[1024], errbuf[1024];
+ int i;
+#define ERRBUF_APPEND(s) strncat(errbuf, (s), sizeof(errbuf)-strlen(errbuf)-1)
+ snprintf(errbuf, sizeof(errbuf), "load failed - %s. ", pathname);
+
+ if (loadquery(L_GETMESSAGES, &message[0], sizeof(message)) != -1) {
+ ERRBUF_APPEND("Please issue below command for detailed reasons:\n\t");
+ ERRBUF_APPEND("/usr/sbin/execerror ruby ");
+ for (i=0; message[i]; i++) {
+ ERRBUF_APPEND("\"");
+ ERRBUF_APPEND(message[i]);
+ ERRBUF_APPEND("\" ");
}
- else {
- ERRBUF_APPEND(strerror(errno));
- ERRBUF_APPEND("[loadquery failed]");
- }
- dln_loaderror("%s", errbuf);
+ ERRBUF_APPEND("\n");
+ } else {
+ ERRBUF_APPEND(strerror(errno));
+ ERRBUF_APPEND("[loadquery failed]");
+ }
+ dln_loaderror("%s", errbuf);
}
#endif
@@ -1250,27 +1253,22 @@ dln_load(const char *file)
#define DLN_ERROR() (error = dln_strerror(), strcpy(ALLOCA_N(char, strlen(error) + 1), error))
#endif
-#if defined _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
HINSTANCE handle;
- WCHAR *winfile;
+ char winfile[MAXPATHLEN];
char message[1024];
void (*init_fct)();
char *buf;
+ if (strlen(file) >= MAXPATHLEN) dln_loaderror("filename too long");
+
/* Load the file as an object one */
init_funcname(&buf, file);
- /* Convert the file path to wide char */
- winfile = rb_w32_mbstr_to_wstr(CP_UTF8, file, -1, NULL);
- if (!winfile) {
- dln_memerror();
- }
+ strlcpy(winfile, file, sizeof(winfile));
/* Load file */
- handle = LoadLibraryW(winfile);
- free(winfile);
-
- if (!handle) {
+ if ((handle = LoadLibrary(winfile)) == NULL) {
error = dln_strerror();
goto failed;
}
@@ -1320,32 +1318,33 @@ dln_load(const char *file)
# define RTLD_GLOBAL 0
#endif
+#ifdef __native_client__
+ char* p, *orig;
+ if (file[0] == '.' && file[1] == '/') file+=2;
+ orig = strdup(file);
+ for (p = file; *p; ++p) {
+ if (*p == '/') *p = '_';
+ }
+#endif
/* Load file */
if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) {
+#ifdef __native_client__
+ free(orig);
+#endif
error = dln_strerror();
goto failed;
}
-# if defined RUBY_EXPORT
- {
- static const char incompatible[] = "incompatible library version";
- void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc");
- if (ex && ex != ruby_xmalloc) {
-
-# if defined __APPLE__ && \
- defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
- (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11)
- /* dlclose() segfaults */
- rb_fatal("%s - %s", incompatible, file);
-# else
- dlclose(handle);
- error = incompatible;
- goto failed;
-# endif
- }
- }
-# endif
init_fct = (void(*)())(VALUE)dlsym(handle, buf);
+#ifdef __native_client__
+ strcpy(file, orig);
+ free(orig);
+#endif
+#if defined __SYMBIAN32__
+ if (init_fct == NULL) {
+ init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */
+ }
+#endif
if (init_fct == NULL) {
error = DLN_ERROR();
dlclose(handle);
@@ -1440,6 +1439,54 @@ dln_load(const char *file)
}
#endif
+#if defined(__BEOS__) || defined(__HAIKU__)
+# define DLN_DEFINED
+ {
+ status_t err_stat; /* BeOS error status code */
+ image_id img_id; /* extension module unique id */
+ void (*init_fct)(); /* initialize function for extension module */
+
+ /* load extension module */
+ img_id = load_add_on(file);
+ if (img_id <= 0) {
+ dln_loaderror("Failed to load add_on %.200s error_code=%x",
+ file, img_id);
+ }
+
+ /* find symbol for module initialize function. */
+ /* The Be Book KernelKit Images section described to use
+ B_SYMBOL_TYPE_TEXT for symbol of function, not
+ B_SYMBOL_TYPE_CODE. Why ? */
+ /* strcat(init_fct_symname, "__Fv"); */ /* parameter nothing. */
+ /* "__Fv" dont need! The Be Book Bug ? */
+ err_stat = get_image_symbol(img_id, buf,
+ B_SYMBOL_TYPE_TEXT, (void **)&init_fct);
+
+ if (err_stat != B_NO_ERROR) {
+ char real_name[MAXPATHLEN];
+
+ strlcpy(real_name, buf, MAXPATHLEN);
+ strlcat(real_name, "__Fv", MAXPATHLEN);
+ err_stat = get_image_symbol(img_id, real_name,
+ B_SYMBOL_TYPE_TEXT, (void **)&init_fct);
+ }
+
+ if ((B_BAD_IMAGE_ID == err_stat) || (B_BAD_INDEX == err_stat)) {
+ unload_add_on(img_id);
+ dln_loaderror("Failed to lookup Init function %.200s", file);
+ }
+ else if (B_NO_ERROR != err_stat) {
+ char errmsg[] = "Internal of BeOS version. %.200s (symbol_name = %s)";
+ unload_add_on(img_id);
+ dln_loaderror(errmsg, strerror(err_stat), buf);
+ }
+
+ /* call module initialize function. */
+ (*init_fct)();
+ return (void*)img_id;
+ }
+#endif /* __BEOS__ || __HAIKU__ */
+
#ifndef DLN_DEFINED
dln_notimplement();
#endif
diff --git a/dln_find.c b/dln_find.c
index b17b0d23e1..f41ceb051d 100644
--- a/dln_find.c
+++ b/dln_find.c
@@ -78,12 +78,11 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size
}
if (!path) {
- path =
- "/usr/local/bin" PATH_SEP
- "/usr/ucb" PATH_SEP
- "/usr/bin" PATH_SEP
- "/bin" PATH_SEP
- ".";
+#if defined(_WIN32)
+ path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;.";
+#else
+ path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
+#endif
}
buf = dln_find_1(fname, path, buf, size, 1 DLN_FIND_EXTRA_ARG);
if (envpath) free(envpath);
@@ -276,15 +275,13 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
}
goto next;
}
-#endif
+#endif /* _WIN32 or __EMX__ */
-#ifndef S_ISREG
-# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
- if (stat(fbuf, &st) == 0 && S_ISREG(st.st_mode)) {
+ if (stat(fbuf, &st) == 0) {
if (exe_flag == 0) return fbuf;
/* looking for executable */
- if (eaccess(fbuf, X_OK) == 0) return fbuf;
+ if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
+ return fbuf;
}
next:
/* if not, and no other alternatives, life is bleak */
diff --git a/dmyenc.c b/dmyenc.c
deleted file mode 100644
index 7e006e826c..0000000000
--- a/dmyenc.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#define require(name) ruby_require_internal(name, (unsigned int)sizeof(name)-1)
-int ruby_require_internal(const char *, int);
-
-void
-Init_enc(void)
-{
- if (require("enc/encdb.so") == 1) {
- require("enc/trans/transdb.so");
- }
-}
diff --git a/dmyext.c b/dmyext.c
index 4d273f7faf..34ea7a02f4 100644
--- a/dmyext.c
+++ b/dmyext.c
@@ -2,3 +2,8 @@ void
Init_ext(void)
{
}
+
+void
+Init_enc(void)
+{
+}
diff --git a/doc/ChangeLog-0.06_to_0.52 b/doc/ChangeLog-0.06_to_0.52
deleted file mode 100644
index 63826081b3..0000000000
--- a/doc/ChangeLog-0.06_to_0.52
+++ /dev/null
@@ -1,1147 +0,0 @@
-Fri Oct 14 13:22:18 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.52: ……なんてこったい.
-
- * eval.c(rb_call): returnの処理が間違っていたので, マシンによって
- はreturnで関数を終了するだけでなくtoplevelまでつき抜けていた.
-
- * object.c: Builtinクラスを新設. 組み込み関数をKernelから移した.
- nilが組み込み関数を理解するとトラブルの元である.
-
- * dbm.c: Dictと同様にeachが[key,value]を返すように.
-
- * version 0.51
-
-Thu Oct 13 12:13:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(SETUP_ARGS): 付加演算子が配列でない時には配列に変換する.
-
- * parse.y: 括弧なしのメソッド呼び出しでも`*'による付加引数が使える
- ようにした. ただし, 通常引数が一つもない場合は乗算演算子と区別が
- つかないので, 必ず括弧が必要.
-
-Wed Oct 12 10:09:07 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(rb_call): キャッシュの計算をinline化. キャッシュミスがあ
- れば関数呼び出しでメソッドを検索する. methods.cはなくなった.
-
- * eval.c(rb_eval): ローカル変数用の領域をalloca()するように変更.
- サイズの変更が必要になれば改めてmalloc()するように.
-
- * parse.y: error recoveryの際にlex_stateを更新しておくように.
-
-Tue Oct 11 17:10:46 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * socket.c(for_fd): ファイル記述子(Fixnum)からソケットインスタンス
- を得るメソッド. たとえばinetdから起動されたサーバで標準入出力に
- ソケット操作を行なうために使う. つまりSocket.for_fd($stdin)で標
- 準入力に対応するソケットオブジェクトが得られる.
-
- * io.c(to_i): IOクラスのインスタンスを整数に変換するとそのファイル
- 記述子を返すように.
-
- * numeric.c(num2int): to_iメソッドを使ってできる限り整数に変換する.
- 以前はnum2fixだけが全てのオブジェクトに対してto_iメソッドを適用
- していた.
-
- * sprintf.c(Fsprintf): 整数表示の際, オブジェクトをできる限り整数
- に変換するように(to_iメソッドを使う).
-
-Fri Oct 7 14:06:32 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(Fcaller): 必要性がよく分からないのでドキュメントから削除.
- 将来デバッガを作る時に復活させよう.
-
- * eval.c(rb_call): Cで記述されたメソッド呼び出しでは環境をスタック
- にセーブしないことによって高速化.
-
-Wed Oct 5 15:00:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby.h: 一時env.hに移動してたQselfの定義を復活. ただし今回は関数
- として実現(env.hでは変数として再定義してある).
-
- * ruby.h: TRUEでsyntax errorにならないよう#undefを追加.
-
- * eval.c(rb_eval): thread化に挑戦したが, 失敗(速くならなかった).
- が, Scopingなどの無駄なコードの削除とメソッド呼び出しの引数セッ
- トのinline化で若干の高速化を実現した. 副作用として, argc, argv形
- 式の関数呼び出しの仕様が変化した(argvにselfを含まなくなった).
-
- * eval.c(rb_call): メソッド呼び出しの高速化.
-
-Tue Oct 4 11:40:53 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby-mode.el: 修飾子に対応した.
-
- * parse.y: 多重代入にrestをつけた. この機能を使えばoptional引数の
- 解析が簡単にできる(はず).
-
- * pack.c(unpack): uuencode形式のdecodeの際に文字列の長さが間違って
- いた.
-
-Mon Oct 3 15:58:41 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * file.c(type): ファイルタイプを文字列で返すメソッド.
-
-Fri Sep 30 11:36:07 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * object.c: デフォルトの真の値である%TRUEの値を1(Fixnum)からtに変
- 更した. to_sで文字列に変換した時にも`t'と表示される. 更に踏み込
- んで`t'を予約語にしてlispのようにしようかとも思ったが, そこまで
- は決心できなかった. 一文字のローカル変数はかなり使いそうな気がす
- るので….
-
- * array.c,dict.c: equalを再定義しているクラスで, hashを正しく定義
- した.
-
-Wed Sep 28 23:30:28 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c(Ffail): 今までfailはカーネルクラスのメソッドであったが,
- 構文に組み込んだ. この変更によって, 1)`fail'は予約語となり, ロー
- カル変数に用いることができなくなった. 2)`fail'単体で例外を発生す
- るようになった. 3)failはメソッドではなくなったので再定義される可
- 能性がなくなった.
-
- * dic.c, dbm.c(indexes): Arrayのindexesと同様の機能を持つメソッド
- を追加.
-
- * array.c(indexes): 引数をインデックスとする要素の配列を返す. 整数
- の配列を引数とする時には引数の要素をインデックスとする要素の配列
- を返す.
-
-Mon Sep 19 13:42:31 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * array.c(aset): 部分配列に対する代入で配列以外のオブジェクトが指
- 定された場合に多重代入と同じルールで配列化するようにした.
-
- * io.c(print): 引数として与えられた各オブジェクトにprint_onメッセー
- ジを与えるように. 実行速度は落ちるが柔軟性は増す.
-
-Fri Sep 16 14:59:18 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * glob.c: ワイルドカードの導入. bashに使われているGNUのglobルーチ
- ンを流用した.
-
-Mon Sep 12 18:36:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(value_expr): 式がnilの時に対応.
-
- * class.c: ICLASSのclassが必ずClass/Moduleを指すように.
-
-Tue Sep 6 16:23:28 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c: 正規表現内で「\数字」形式が指定できるように.
-
- * parse.y:「do expr using var ... end」形式はなくなった. 寂しい気
- もする. *BACKWARD INCOMPATIBILITY*
-
-Mon Sep 5 10:59:01 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * numeric.c(next): Numericクラスにもnextを提供.
-
- * string.c(upto): uptoを提供.
-
- * range.c(each): nextを使ったインタフェースからuptoを使うように変
- 更した. この方が一つのメソッドで処理をまとめで行なうことができる.
-
-Fri Sep 2 15:25:39 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * dict.c(each): 戻り値を[key, value]のペアに変更. 今までのeachは
- each_valueとして残る. *BACKWARD INCOMPATIBILITY*
-
-Thu Sep 1 10:49:04 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 成功した(特別な戻り値を持たない)システムコールは`0'を返すように.
-
-Wed Aug 31 00:26:51 1994 Yukihiro Matsumoto (matz@dyna)
-
- * string.c: チェックサムを得るメソッド`sum'を作った.
-
- * class.c(include_class_new): ICLASSのclassをもとのクラスにした.
- gcの際に元クラスをマークする必要があるのが, フィールドを増やす余
- 地が無いので, classフィールドを流用した. 私の見積りが間違ってい
- て, ICLASSのインスタンスにメッセージを送る事があれば, おかしな動
- 作をするだろう.
-
- * eval.c(masign): 式(a,b = nil)の値を[nil]からnilに変更した.
-
-Mon Aug 29 11:56:09 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * class.c: rb_define_mfuncを無くして, メタクラスにモジュールをイン
- クルードするようにした.
-
- * error.c(yyerror): 同じ行で複数のsyntax errorをリポートしないよう
- にした.
-
- * file.c: FileTestモジュールにファイルテストメソッドを分離した.
-
- * parse.y: 演算子を指定する時のlex_stateを正しく設定した.
-
-Sat Aug 27 01:23:34 1994 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: if/whileなどの複合式をprimaryに移動した. これによって例
- えば「if cond then a else b end.message()」のような式が書けるよ
- うになった.
-
-Fri Aug 26 10:46:30 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * spec: 整理された文法にしたがって書き直した.
-
- * parse.y: ここ数日で混乱していた文法を整理した. 括弧を省略したメ
- ソッド呼び出しができるようになったこと, modifierが付けられるよう
- になったこと, returnにリストが渡せるようになったことが主な変更点
- である.
-
- * process周りが怪しいがとにかくSolaris 2.3で動くように.
-
- * parse.y: 曖昧性がない場合にはメソッド呼び出しの引数の括弧を省略
- できるように. 省略できるメソッド呼び出しの条件は, 1)かならず1個
- 以上の引数を必要とすること, 2)第1引数が`+', `-', `(', `[', `{',
- `/'など, 式の始まりに置かれた時と途中に現れた時とで解釈が違う記
- 号で始まらないこと, である.
-
-Thu Aug 25 13:54:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(cond): 条件式の展開部にbugがあった.
-
-Wed Aug 24 00:01:15 1994 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: returnはコンマで区切ったリストも受け取るように. つまり,
- return a, b, cはreturn [a, b, c]と同じ意味になる.
-
- * parse.y: yield以外の大域脱出制御式をexprからexpr0に移した. よっ
- てメソッドの引数に制御式を使えなくなる(これで困る人はいないはず).
-
- * parse.y: `+'の定数展開の際に演算子の優先順位を忘れていた.
-
- * eval.c: untilの戻り値はnilになった.
-
- * parse.y: modifierとしてのif/unless/while/untilを追加.
-
- * parse.y: 文法からendの後ろにつけるキーワードを削除. ほとんど使わ
- なかった上に, emacsではruby-modeがあれば対応のチェックが機械的に
- 出来るため.
-
-Tue Aug 23 18:08:33 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: スクリプト実行開始前に例外が発生した時にcore dumpした.
- 組み込み用にコードを変更した時にenbugしてしまった.
-
-Tue Aug 23 00:07:17 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c: doの戻り値がいつもnilになっていた.
-
- * parse.y: loop制御変数の多重代入化にbugがあった.
-
- * parse.y(expand_op): 文字列も畳み込みの対象に.
-
-Mon Aug 22 10:50:01 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(expand_op): `+'に関しては結合則を使って, より多く定数畳
- み込みを行なうように.
-
- * ruby.c(proc_options): argcが0の時にも対応.
-
- * parse.y: forなどの制御変数に多重代入も使えるように.
-
-Sat Aug 20 00:59:40 1994 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y(call_op): 演算子`~'の取り扱いをルール部へ移動.
-
-Fri Aug 19 11:44:13 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * main.c: rubyをほかのプログラムに組み込めるようにmain()を分割した.
- それにともない, プログラムの呼び出し構造を修正した.
-
- * parse.y: 条件式の定義を変更. ifなどの条件式の中でだけ`&&'や`||'
- および`!'の引数が条件式になるように. この変更により条件式以外の
- 場所での `&&', `||', `!'演算子の動作が直観に一致する.
-
- * parse.y: 実引数の`*'の後に続く引数はexprに制限した. 今までは全て
- の文が有効であったが, ここで定義文があってもしょうがない.
-
-Thu Aug 18 10:21:45 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c: 正規表現ルーチンの初期化部分を削除してしまっていた. これで
- はemacsの正規表現になってしまう.
-
- * version.c: copyright表示を追加.
-
- * version.c: バージョン表示をstderrに.
-
- * configure.in: gccがない場合testに失敗していた.
-
-Fri Aug 12 14:12:23 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * array.c(astore): 配列の拡大する時にある程度の大きさをまとめて拡
- 大するように.
-
- * io.c(Fprint): 配列に対しては一度文字列に変換することなく, 直接内
- 容を出力するように.
-
- * string.c(str_new): memmoveからmemcpyへ置き換えた. これでもかなり
- 速度が違う.
-
- * ruby.h: データメンバの取り出しで名前を文字列からIDで指定するよう
- にした. かなりの高速化になる.
-
- * io.c: $ARGFという変数で引数列からなる仮想ファイルをオブジェクト
- として扱えるようにした. 今まではトップレベルのgets()などを使って
- アクセスしていたが, どうもオブジェクト指向的ではなかった.
-
-Thu Aug 11 11:43:15 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * gc.c: mark_location()の間違った呼び出し方の行が残っていた.
-
- * method.c: プロトタイプ宣言が足りなかった.
-
-Wed Aug 10 15:54:46 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * variable.c: -vオプションが指定されている時は初期化されていない,
- 大域変数, インスタンス変数, ローカル変数を参照した時点でwarning
- を出すようにした.
-
-Tue Aug 9 11:50:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * bignum.c: 冪乗に関しても多倍長演算を行なうように. 特に浮動小数点
- 数の範囲を越えた時の処理を的確に行なうように.
-
- * eval.c: メソッド定義後は構文木から, メソッド定義部分を外す. 無駄
- な再定義が起こらないようにするためと2重にfree()されないため.
-
- * array.c(Fary_aref): 引数が1つでFixnumの時, Range checkを行なわな
- いように修正.
-
- * eval.c: メソッドの引数の数をコンパイル時に計算して若干の高速化.
-
-Mon Aug 8 13:06:24 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * object.c: nilによる比較連鎖をなくした.
-
- * parse.y: bit演算子の優先順位を比較演算子よりも強くした. Cとは異
- なることになるが, 直観には合致する.
-
- * gc.c: クラスを解放する時, 個々のメソッド毎にキャッシュをクリアす
- るのではなく, クラス単位でクリアするように.
-
-Thu Aug 4 18:45:09 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * methods.c(method_free): 解放されたメソッドに関してキャッシュをク
- リアしておく必要があった.
-
- * gc.c: Dataクラスのデータ部分をfree()し忘れていた.
-
-Wed Aug 3 09:58:14 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: def func .. end形式による関数メソッドの定義はなくなった.
-
- * methods.c: func形式のメソッドをなくした. あっても, あまり意味が
- ないので.
-
- * eval.c: $0への代入でps(1)の出力が変化するように.
-
- * io.c(Fsyscall): syscall()を実現.
-
-Mon Aug 1 13:41:11 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: ダブルクォートで囲まれた文字列や正規表現中で"#{変数名}"
- または"#変数名"という形式で変数の内容を埋め込むことができるよう
- になった.
-
- * io.c: 関数メソッドsystem2()はなくなった. 今はバッククォートがあ
- るからね.
-
- * parse.y: `cmd`によってコマンドを文字列に展開することができるよう
- になった.
-
- * parse.y: __FILE__, __LINE__を追加. それぞれファイル名(文字列),
- 行番号(整数)を値とする疑似変数.
-
-Fri Jul 29 13:16:07 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * methods.h: メソッドをオブジェクトとして扱うのをやめる. メソッド
- のメモリ管理にはリファレンスカウントを使うことにした. これでオブ
- ジェクトの数が減ってほんの少しだけGCが速くなる(かな).
-
- * purifyによってメモリ関係のバグを検査した(見つかる,見つかる…).
-
- * gc.c: GCをプログラマが変数をマークする形式から, スタックとレジス
- タからマークする方法に変更. 移植性が下がるような気もするが, siod
- やscmでも採用されているから多分大丈夫だろう. Linux on i486でも動
- 作を確認した.
-
-Wed Jul 27 16:13:13 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(Eval): トップレベルでは構造木をfreeしないように. どうせ解
- 放されるから時間の無駄である.
-
- * array.c, dict.c: "=="を構造一致に変更.
-
-Fri Jul 22 10:14:09 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * error.c: 組み込みタイプの名前を登録し忘れていた.
-
-Thu Jul 21 14:06:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(freenode),eval.c(Eval): 解析木を解放し忘れていた.
-
-Mon Jul 18 10:19:15 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: 多重代入を処理するルールにバグがあって, 3要素以上の多重
- 代入に失敗していた.
-
- * eval.c(rb_eval): 多重代入で, 右辺が配列でない時には`to_a'メソッ
- ドで配列に変換して代入するようにした. 今までの仕様だと右辺値が第
- 1要素にそのまま代入されていたが, structなど配列に変換できるもの
- は変換した方が嬉しい気がする.
-
- * dbm.c,dict.c(delete_if): メソッド追加.
-
- * process.c(wait,waitpid): システムコールwaitpidまたはwait4がある
- 時はそちらを使うように. configureもそれらをチェックするように変更.
-
- * dbm.c, dict.c(clear): メソッド追加.
-
-Fri Jul 15 10:54:45 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * array.c(Fary_fill,Fary_clear): メソッドを追加.
-
- * string.c(Fstr_split): $;の値が長さ1の文字列である時, これを正規
- 表現化しないで, 単なる文字として分割する.
-
- * string.c(Fstr_aset/Fstr_aref): インデックスが文字列の範囲外だっ
- た時の動作をArrayを参考に修正した.
-
- * array.c(astore,Fary_aset): 領域をreallocした後, ゼロでクリアする
- ように. 今まで配列にゴミが入っていた.
-
- * array.c: []/[]=でのインデックス関係を整理. 基本的に負のインデッ
- クスに代入しない限り例外は起きないように変更した. 必要に応じて適
- 当に解釈して, 必要ならば領域を拡張するように.
-
-Thu Jul 14 11:18:07 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * autoexec.c: 削除. autoload関係の機能は今後検討しよう.
-
- * dict.c: 辞書クラスの正式名称をDictに変更した. 別名としてHashを用
- 意した. 今までDictionaryなどと長い名前にしていたが誰も使っていな
- かったしね. *BACKWARD INCOMPATIBILITY*
-
- * parse.y: Dictを生成する構文を追加. こちらを{..}にした.
-
- * parse.y: 配列を生成する構文を[..]に変更した. 過去のRubyスクリプ
- トとの互換性が保てないが, Dictを生成する構文を導入するに当たり,
- perl5に合わせて(意識して), 変更する時期は今しかないと考えた.
- *BACKWARD INCOMPATIBILITY*
-
- * eval.c(Feval): eval()でメソッドを定義する時, 定義されるクラスを
- メソッドの所属するクラスにした. 今まではObjectクラスに定義されて
- いた.
-
- * parse.y: ローカル引数がない時のeval()で落ちていた.
-
-Tue Jul 12 09:41:28 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * pack.c: uuencode形式のサポート.
-
- * `-0'を`-R'に. 出力レコードセパレータをコマンドラインから指定する
- 方法はなくなった. どうも, 仕様がゆれるなあ.
-
-Mon Jul 11 09:51:24 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby.c: `-r'オプションは`-0'オプションになった. 当面は`-r'も有効
- だが変更される可能性がある. `-R'は当面はそのまま.
-
- * version.c: version表示に日付を含めた.
-
- * parse.y: private methodの復活. RubyのprivateメソッドはC++におけ
- るprotected methodに該当するもので, `@'で始まる名前を持つ.
-
- * env.h: struct ENVIRONの定義を分離.
-
- * parse.y: `\$var', `\@var', `%var'も許すように.
-
- * variable.c(Fdefined): idも引数として受け付けるように.
-
- * parse.y: if文/unless文にキーワードthenを追加. thenなしというのは,
- 意外と間違いが多いので. もちろん省略できる.
-
-Sat Jul 9 02:16:04 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c(rb_eval): class/moduleの評価で新しいスコープを割り当てて
- いなかった. スコープ割り当て部分をrb_call()からrb_eval()に移した.
-
- * eval.c(rb_call): realloc()に渡される事のある, ローカル変数用の領
- 域をalloca()していた. たまに落ちるわけだ.
-
- * string.c(Fstr_times): 割り当てた領域を越えた部分を変更していた.
-
-Wed Jul 6 15:52:42 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * socket.c: Socket -> BasicSocket, RawSocket -> Socket に改名.
-
- * string.c(ucfirst,lcfirst): 最初の1文字だけの大文字/小文字変換.
-
- * numeric.c(chr): 整数の文字列化メソッド.
-
- * inits.c, dbm.c: DBMが使えない時はクラスそのものを定義しないよう
- にした. 利用できないクラスはnilとすることを今後のポリシーとしよ
- う(いままではアクセスした時点でエラーが発生していた). autoexec()
- のあり方も検討が必要になりそうだ.
-
- * bignum.c(bigadd): バグ修正.
-
-Thu Jul 7 11:12:18 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(Fload,Feval): eval_treeをクリアし忘れていた.
-
- * _inspect: オブジェクトを可読形式の文字列に変換する(主にデバッグ
- 出力用).
-
-Wed Jul 6 00:57:18 1994 Yukihiro Matsumoto (matz@dyna)
-
- * numeric.c, bignum.c: 整数に対する`[]'演算子. nビット目がセットさ
- れているかどうかを返す.
-
-Tue Jul 5 12:48:39 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * io.c(Feof): 追加. コマンドラインからなる仮想ファイルについても
- EOFが検出できるように.
-
- * ruby.c: -l/-r/-R/-Xオプションの追加.
-
- * ruby.c: -n/-pオプションのloopの付加などをメインルーチンに移動し
- た. これで, オプションの解析途中で(`-c'オプションのせいで)終了な
- どといったことはない.
-
- * io.c(Fgets): 高速化. 凝ったことをしない方が速かった. 虚しい.
-
-Mon Jul 4 15:55:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * Socket:getsockname/getpeername - ようやく仕様が安定した.
-
- * io.c(Fgets): eachでgetsを記述するのではなく, getsでeachを記述す
- るようにした.
-
-Fri Jul 1 10:35:49 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * $ENV[env] = nil/$ENV.delete(env)で環境変数を削除できるようになっ
- た. $ENV.deleteは環境変数の以前の値を返す.
-
- * !~の定義が間違っていた.
-
- * Dict,DBM:[]= - nilの代入によって要素を削除できるようになった. こ
- れにともないnilはDictの要素になれなくなった.
-
- * ソースの整理. 盲腸のような使われていないコードをなくしたり, 変数
- 名を付け変えたりした.
-
-Fri Jul 1 00:21:29 1994 Yukihiro Matsumoto (matz@dyna)
-
- * Array:join() - 要素数0の配列に対して空文字列を返す.
-
- * RawSocket:open(),socketpair() - 文字列で指定できるドメインとタイ
- プをいくつか追加した.
-
-Thu Jun 30 13:51:29 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * -fオプションをなくした. 昔(loadのなかった頃)の名残なので, 今となっ
- ては必要ないだろう.
-
- * -sオプションを追加. perlの-sオプションと同じ動きをする.
-
- * RawSocketクラスを提供する. Socketに対するシステムコールレベルの
- アクセスが可能になった.
-
-Thu Jun 30 00:27:19 1994 Yukihiro Matsumoto (matz@dyna)
-
- * Socket - bug fixes.
-
- * linuxではsyscall(SYS_select)が正常に動作しない.
-
- * Socket:addr,peeraddr - 配列としてsockaddrの情報を返す.
-
-Wed Jun 29 00:14:20 1994 Yukihiro Matsumoto (matz@dyna)
-
- * Socket:setopt,getopt - setsockopt(2), getsockopt(2)へのアクセス
- を実現.
-
- * sprintf() - rubyにはunsignedは無いので, %uを取り除いた.
-
- * sprintf() - %b, %x, %oでは2の補数表現, %B, %X, %Oでは符号付き表
- 現で出力するように. ここ数日でsprintf()の仕様がゆらいでいたが,
- これで落ち着きそうだ.
-
-Tue Jun 28 14:42:03 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * Bignum:<<,>> - 2の補数をとる処理を除いた. シフト演算には関係ない
- 処理だった.
-
- * Bignum:^ - bug fix. 符合が反対だった.
-
- * sprintf() - 2進出力子"%b"を追加.
-
- * sprintf() - %x, %oでFixnumを出力する時, 2の補数表示を行なわない.
-
- * sprintf() - %x, %oはやはり負の数の時は`-'を出力するように.
-
-Mon Jun 27 14:56:13 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * sprintf() - Bignumについても%d, %oは(2の補数表現に変換して)正の
- 整数を表示するようにした.
-
- * Bignumに対する論理演算の定義を修正した. 負の数は2の補数表現であ
- るとみなし, かつ仮想的に左側に無限に1が連続しているような演算結
- 果を得る.
-
- * Fixnum:<<,>> - 符合付シフトに変更.
-
- * Bignum:>> - 負の整数のシフトに対応した.
-
- * __END__, ^D, ^Zでスクリプトを終了できる.
-
- * -xオプションを追加. #! ..rubyなる行まで読み飛ばす.
-
- * -cオプションを追加. コンパイルのみを行う.
-
-Sat Jun 25 01:37:21 1994 Yukihiro Matsumoto (matz@dyna)
-
- * Fixnum:<< - 必要に応じてBignumに拡張して左シフトするように. よっ
- て, シフト幅が32を越えるとCやPerlとは違った値を返す.
-
-Fri Jun 24 10:01:28 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ioctl()/fcntl() - システムコールを呼び出す前にバッファの大きさを
- 調節するようにした.
-
- * String:toupper/tolower - 文字列を置き換えたコピーを作るのではな
- く, 元の文字列の内容を変更するようにした.
-
- * inplace editを実現した. perlと同じように`-i'オプションで指定する.
- もっとも, こちらはMS-DOSのこととか考えてないけど.
-
- * デフォルトの出力先を追加した. 今までは$stdoutに代入するしか方法
- はなかった.
-
-Fri Jun 17 10:55:08 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 環境変数にアクセスする方法としてgetenv()/setenv()以外に$ENVを用
- 意した. $ENVは文字列-文字列の辞書であるかのように動作するEnvDict
- オブジェクトが代入されている(eachはassocを与える).
-
- * nilに代入するとcore dumpした. コンパイル時のチェックを強化.
-
- * Struct: struct_new()の引数をGCプロテクトする必要がある. せめてス
- タック領域だけでもスキャンできるようにしなければいけないんだろう
- か? でも, 移植性がなあ.
-
-Fri Jun 17 01:01:46 1994 Yukihiro Matsumoto (matz@dyna)
-
- * Time::asctime() - 日付のフォーマットで日が落ちていた.
-
- * Stat: StatはEtcなどと同様にStructで実現したので, Statクラスは無
- くなった.
-
-Thu Jun 16 10:32:23 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * bignum.c: いくつかのバグを修正した. Fixnumを渡すべきところで普通
- のintを渡していた. 失敗.
-
- * big2str() - 1桁ずつbaseで割る代わりに, 4桁ずつ割算を行なうように
- した. これで多倍長割算の回数が1/4になる. さらに整数->数(文字)へ
- の変換をテーブルを用いるようにした.
-
- * rb_ivar_get_1() - すでに何らかのインスタンス変数を持つオブジェク
- トでは, 未定義のインスタンス変数の値が不定値になっていた.
-
- * yylex() - インスタンス変数の認識に失敗していた. attr()は正しく動
- 作していたので, 混用すると動作しなかった. 全部違っていたから動い
- ていたのね.
-
- * Object:attr() - すでにアクセスメソッドが定義されている時にはデフォ
- ルトのアクセスメソッドを定義しないようにした. もっともアクセスメ
- ソッドと同名のメソッドの区別はRubyには存在しないけど, それは仕方
- がないよね.
-
- * pack.c: エンディアンをautoconfで判定するようにしたので, v/Vが使
- えるようになった. またntoh?()/hton?()も自前で用意した.
-
- * Stat: st_rdevをアクセスするメソッドを追加. さらにシステムがstat
- 構造体にst_blksize, st_blockを持っているかをautoconfでチェックす
- るようにした.
-
- * ドキュメントを少し整備した.
-
- * INT2FIX()のうち, 31bit幅が保証できないものは, int2inum()に置き換
- えた.
-
-Wed Jun 15 10:18:27 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * sprintf() - bignumの出力の時, 出力幅を正しく計算するようにした.
-
- * str2inum() - baseが0の時, baseを自動判定するように(0xで始まる時
- 16 進, 0で始まる時8進).
-
-Tue Jun 14 16:08:42 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * gc.c: Bignum型を追加するのを忘れていた. 組み込み型を追加した時に
- は必ずmark()とsweep()にその型に関する処理を追加する必要がある.
-
- * bignum: 割算も動いたような気がする. アルゴリズムを理解していない
- ので, 自信がない.
-
-Mon Jun 13 14:36:55 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * まだサポートしていないメソッドなどがあるが, 曲がりなりにもBignum
- が使えるようになる. これでioctlも使える.
-
-Fri Jun 10 17:26:42 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * Comparable: 基礎となるメソッドを`=='と`>'から`<=>'に変更した. 今
- 後Comparableのサブクラスは`<=>'だけを再定義する必要がある.
-
-Wed Jun 8 13:12:18 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * Need_Fixnum()をほとんどなくして, NUM2INT()で直接intに変換するこ
- とにした. これで31bitに丸めて桁落ちをおこす問題がなくなる.
-
-Tue Jun 7 09:45:31 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby.h: マクロFIXABLE(n)を追加. ついでにFIXNUM周りの定義を変更し
- て, 移植性を高めた(つもり).
-
- * C++の予約語であるnewを削除した. しかし, もうひとつの予約語である
- classに関しては, 置き換える単語が思いつかないこともあってそのま
- まになっている.
-
- * 31bitを越えそうなINT2FIX()を関数呼び出しに変えた. 将来bignumが導
- 入された時には自動的にbignumを返すようにする.
-
- * readline() - 引数の`-'は標準入力を意味するようになった.
-
- * ruby.h: 右シフトが論理シフトか算術シフトかは処理系依存のようなの
- で, ruby.hでcppを使ってチェックするようにした. これでうまくいく
- と思うのだが, 手元に符合付intを論理シフトする処理系がないので確
- 認できない. NEWS-OSのCCは確か右シフトはいつも論理シフトだったよ
- うな気がするんだけど….
-
-Mon Jun 6 10:10:22 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * FIX2INT()の定義を変更した. どうして昔はうまく動かなかったんだろ
- うか? もしかして, 右シフトの符号拡張は処理系依存?
-
- * FIX2INT()とFIX2UINT()を使い分けるようにした. もっともfixnumは31
- ビットしかないので, 本質的な解決にはならないのだが(ioctlが組み込
- みたかった).
-
- * printを関数的メソッドから通常メソッドに変更. 引数が与えられない
- 時にはレシーバをプリントするようにした. これでprintをメッセージ
- 形式でも実行できるようになった. 例:
-
- ruby -e 'readlines().sort.print'
-
- 上のスクリプトは, 引数として与えられた(あるいは標準入力から読み
- 込まれた)文字列を各行毎にソートして表示する.
-
- * eval.c: argc,argvパターンで引数を受けるメソッドに引数が一つも与
- えられない時, argvがnilになっていた(argv[0]にアクセスすると落ち
- てしまう).
-
- * _exit()を追加. こちらは例外処理など行なわない.
-
- * dbmクラス: クラス名称をDBM(大文字)に統一した.
-
-Sat Jun 4 00:51:04 1994 Yukihiro Matsumoto (matz@dyna)
-
- * ループ変数にも属性や配列要素を指定できるようにした.
-
-Fri Jun 3 09:49:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 多重代入において, 属性代入, 配列要素への代入も行なえるようにした.
-
- * Need_Fixnum(): nilを0に変換するように.
-
- * Enumerable:min, max, index, includes - 追加. min, maxは要素が
- `<=>'メソッドを持つことを仮定している.
-
- * Dict/Dbm:length - 要素数を返すメソッド.
-
- * Dbmクラスにto_aメソッドを追加.
-
- * Sunにおけるsortの誤動作の件, 昨日の修正でfixされた. しかし, それ
- でなぜ動かなかったのかは明らかではないが…. 比較関数がどんな値を
- 返しても指定した領域外をアクセスするのはバグではないか.
-
- * ファイルの全内容を読んで, 各行を配列として返すメソッドはpythonを
- 参考にして`readlines'という名前にした. それにともないgetsに対し
- てreadlineという別名を用意した.
-
-Fri Jun 3 00:08:38 1994 Yukihiro Matsumoto (matz@dyna)
-
- * Array:sort - 判別関数の戻り値はFixnumではなく, Intであるべきだっ
- た. 間違い. Sunで動作がおかしかったのはこのせいかも知れない.
-
-Thu Jun 2 11:48:37 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * IO:read_all() - ストリームの最後まで入力して, 各行を要素とする配
- 列を返すメソッドを追加. また関数メソッド read_all()も追加した.
- これは引数のファイルから読み込んで各行を要素とする配列を返す. 意
- 味的には
-
- def read_all()
- ary = {}
- while gets()
- ary.push($_)
- end
- end
-
- とほぼ等価である.
-
- * String:atoiメソッドを削除. to_aメソッドからaが配列であるとの連想
- を呼んで, 混乱を招かないため. 代わりにto_iメソッドを使うこと.
-
- * 配列への変換メソッドto_aを導入した. 通常のオブジェクトは自分自身
- を唯一の要素とする長さ1の配列を返す. 配列は自分自身を, 辞書はキー
- と値のペアの配列を返す. Enumeratedをincludeしたクラスは, eachが
- 返す各要素を含む配列を返す.
-
- * file.c: 不定個の引数を受けとるメソッド(chmod,chown,utimes)を書き
- 換えて, 整理した. それに伴い, 最初に全ての引数の型チェックを行な
- うようにした. 型チェックに失敗すると処理を行なわずに例外を発生さ
- せる.
-
- * configure.in: 不必要なテストを行なわないように修正した.
-
-Tue May 31 10:41:08 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * String:pack(): 2進数の文字列変換(B,b)で0と1が逆だった.
-
- * Math.c: 実数系のメソッドに引数として整数が渡された時に自動的に変
- 換するようにした.
-
- * toupper(), tolower(): 文字列の判定ミスで変換されていなかった.
-
- * getopt_long()の仕様によって, スクリプトへの引数がインタプリタの
- 引数だと解釈されていた. 引数パターン文字列の先頭に`+'を追加.
-
- * config.hを削除した. DEFINEはMakefileで与えられる.
-
- * sprintf(): "%d"に文字列が与えられた時にはアドレスではなく内容を
- 整数に変換するようにした. ついでに浮動小数点数も変換するように変
- 更した.
-
- * regexp.c: rubyの拡張正規表現(\d, \D, \s, \S)の処理で割り当てた領
- 域を越えてバッファに書き込んでいた. 処理前にバッファをきちんと拡
- 張するようにした. これで昨日問題にしていたメモリの問題は解決でき
- たと思う.
-
- * yylex(): ダブルクォート文字列中でダブルクォートを表現するため
- のバックスラッシュ表現ができなかった.
-
-Mon May 30 10:07:42 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 演算子`!'の右辺も条件式であるとした. これによって, この演算子を
- 再定義する人は混乱するかも知れないが, 大多数のこの演算子を使う人
- は混乱を避けることができると思う.
-
- * autoconfを使って, 自動的にMakefile, config.hを生成するようにした.
- これで, 多くのマシンでは`configure'を実行した後, `make'一発でコ
- ンパイルできると思う.
-
- * clone: サブクラスに対して用いられた場合, 元のオブジェクトと同じ
- クラスのインスタンスを返すように(以前はビルトインクラスの場合を
- 考えてなかった).
-
- * ビルトインクラスのサブクラスも作れるように, リテラルのあるクラス
- にもnewメソッドを追加した.
-
- * malloc()で落ちる. purifyが必要かも知れない.
-
- * re.c: rb_global_variable()の呼びだし形式の間違い. 変数へのポイン
- タを渡さなければいけない.
-
- * parse.y: ローカル変数の扱いに引数の評価順に依存する移植性のない
- 部分があった.
-
- * attr(): 属性設定のバグを直した. いつ内部仕様が変わったんだろう…?
-
-Sat May 28 23:08:18 1994 Yukihiro Matsumoto (matz@dyna)
-
- * 正規表現キャッシュの文字列一致判定をポインタ一致から内容一致に変
- 更した. そういえば文字列リテラルは一回毎に新しくオブジェクトが生
- 成されるのだった.
-
-Fri May 27 11:42:00 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * trから文字削除(delete), 文字圧縮(squeeze)を分離した. それにとも
- ないtrのオプション引数はなくなった.
-
-Thu May 26 10:32:55 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * スクリプト読み込みルーチンを書き直して, 通常ファイル以外のファイ
- ル名や空文字列がスクリプトとして与えられた場合に対応した. また,
- 標準入力からスクリプトを読み込む時に, 一時ファイルが/tmpに残らな
- いようにした.
-
- * Fixnum:id2name - IDから文字列に戻す関数. String:internの逆.
-
- * Array: 配列の範囲外の要素をアクセスした時に例外を発生させずに,
- nilを返すようにした. 配列は自動的に拡張される.
-
- * string:stripを追加.
-
- * -nオプションが-eオプションを複数指定した時も動作するように.
-
- * parse.yで<sys/types.h>もインクルードするようにした.
-
- * fname周りの細かいbugを修正.
-
-Wed May 26 11:45:10 1994 Yukihiro Matsumoto (matz@dyna)
-
- * 定数をキャッシュするようにした. 繰り返しが多い場合には有効のはず
- だが, 一度しかアクセスしない場合は遅くなるなあ.
-
-Wed May 25 00:42:24 1994 Yukihiro Matsumoto (matz@dyna)
-
- * 多重代入文(foo, bar = 1, 2)の採用.
-
- * 条件式部に文字列あるいは正規表現リテラルをおくと`=~'演算子によっ
- て`$_'と比較される. 更に`...'の両辺では整数リテラルが`$.'と比較
- される.
-
-Mon May 23 23:27:03 1994 Yukihiro Matsumoto (matz@dyna)
-
- * &式 形式はなくなった. 代わりにkernel:apply(id, args..)を導入.
-
- * def op () ..形式の導入. opは再定義可能な演算子.
-
- * constantの代入時チェック. 既に初期化されている定数に代入した場合
- は例外が発生する.
-
- * 多重代入文.
-
-Thu May 19 22:57:07 1994 Yukihiro Matsumoto (matz@dyna)
-
- * 複合文でもvoid valueのチェックを行うようにした.
-
- * untilの動作の修正(do..until型だった).
-
-Wed May 18 01:06:25 1994 Yukihiro Matsumoto (matz@dyna)
-
- * 移植に関する若干の問題を修正.
-
- * 別名の構文を「def a b」にした.
-
- * until/unless: 演算子から制御文へ. 例外を捕捉する機能はそのまま.
-
- * 選択可能な機能をconfig.hからdefines.hに移動.
-
-Fri May 13 23:20:21 1994 Yukihiro Matsumoto (matz@dyna)
-
- * -yオプションを新設. -dオプションからコンパイラのデバッグ部分を分
- 離した.
-
-Tue Apr 25 20:17:33 1994 Yukihiro Matsumoto (matz@dyna)
-
- * マルチバイト文字列を識別子に使えるように. 個人的には使いたくは無
- いけどなあ.
-
- * `-v'フラグの状態を$verboseでアクセスできるように.
-
- * CVSの導入に伴い, バージョン管理の方法を変更.
-
- * 真面目にChangeLogをつける事にした.
-
-Tue Mar 8 10:09:25 1994 Yukihiro Matsumoto (matz at nws119)
-
- * %変数名 によるクラス定数を導入.
-
- * undef メソッド によるメソッド定義の取り消しを導入.
-
- * rb_get_method_bodyではthe_envを変更せず, rb_call()で明示的に変更
- するように. これでresponds_toなどで環境が破壊されない.
-
-Mon Mar 7 17:46:15 1994 Yukihiro Matsumoto (matz at nws119)
-
- * 「&文字列」形式. 「式.文字列」型のメッセージセンドはなくなった.
-
- * 自己代入形式(+=. -=, ...)
-
- * obj.attr = expr形式の採用.
-
-Thu Feb 24 16:23:28 1994 Yukihiro Matsumoto (matz at nws119)
-
- * toint, tofloat, print_stringをそれぞれto_i, to_f, to_sに変更.
-
- * String:clone - Copy on Writeの実現.
-
-Tue Feb 22 11:11:44 1994 Yukihiro Matsumoto (matz at nws119)
-
- * re.c: マッチした文字列の保存に失敗していた.
-
- * trap: 可能ならば処理に時間のかかるシステムコール(read, wait,
- sigpause, select)をフックして割り込み処理の即答性を高める(DOSな
- どでは無理だなあ).
-
- * trap: 割り込みをその場で処理するか(迅速だが危険), 安全なタイミン
- グで処理するかを選択できるように.
-
-Tue Feb 17 11:11:12 1994 Yukihiro Matsumoto (matz at nws119)
-
- * trap: 割り込みハンドラ.
-
-Wed Feb 16 12:29:12 1994 Yukihiro Matsumoto (matz at nws119)
-
- * String:crypt: 暗号化ルーチン
-
- * "::"演算子の追加. a::b は {a, b}と同義. a::b::c は {a, {b, c}}と
- 同義(右結合). 同義とはいうものの, "::"演算子を使った方が少しだけ
- メモリ効率が良い.
-
- * Dir.rmdir(), File.unlink(), File.utime() -- 各システムコールへの
- インタフェース.
-
- * kill -- kill(2) I/F
-
- * select(): readのチェックではstdioにバッファリングされているかど
- うかをチェックするように.
-
-Tue Feb 15 15:08:31 1994 Yukihiro Matsumoto (matz at nws119)
-
- * file.c: statをキャッシュするように.
-
- * File:utime()を追加.
-
- * unliteralize(): フラグを破壊していた.
-
- * Bug(): coreを吐くように.
-
- * String:tr -- tr(1)互換. 引数パターンがちょっと違うけど….
-
-Mon Feb 14 18:24:13 1994 Yukihiro Matsumoto (matz at nws119)
-
- * unless, untilが例外も偽と見なすように.
-
- * select() -- select(2) I/F
-
- * Array:pack, String:unpack: perlのpack/unpackの同等品
-
-Tue Feb 8 17:11:10 1994 Yukihiro Matsumoto (matz at nws119)
-
- * setenv()のないシステムのためにputenv()を使ったコードも用意した.
-
-Mon Feb 7 09:52:44 1994 Yukihiro Matsumoto (matz at nws119)
-
- * 引数の一番最後に`*'を置けるようにした. これでrest引数のリストを
- 操作する必要が少なくなる.
-
-Fri Feb 4 18:23:26 1994 Yukihiro Matsumoto (matz at nws119)
-
- * ruby-mode.elを書き直す. ずいぶんましになったと思う.
-
- * 文字列リテラルのCopy on Writeを実現. これで文字列がリテラルであ
- るからといっていちいちcloneしなくても済む.
-
-Tue Feb 1 09:21:09 1994 Yukihiro Matsumoto (matz at nws119)
-
- * sub(), gsub()で, マッチした文字列を$&, $1..$9でアクセスできるよ
- うにした. 同時にマッチした部分文字列をコピーしておくように(元の
- 文字列が変更されても状態を保存するため).
-
-Mon Jan 31 15:16:58 1994 Yukihiro Matsumoto (matz at nws119)
-
- * プライベートメソッドの仕様を変更. 今までは同じクラスのメソッドか
- らしかアクセスできなかったが, サブクラスのメソッドからもアクセス
- できるようにした(C++におけるprotected メンバ関数).
-
- * メソッドサーチのアルゴリズムを改善し, 10%程度の高速化を行なった.
-
- * 高速化. Cで記述されたメソッドを呼び出す時にはsetjmpを呼ばないよ
- うにした. これでCメソッドを多用する場合には3倍程度高速になった.
-
-Fri Jan 28 15:44:04 1994 Yukihiro Matsumoto (matz at nws119)
-
- * sh-modeを元にruby-mode.elを作る. 演算子で終る, 2行に渡る文には対
- 応していないけど….
-
-Thu Jan 27 11:35:19 1994 Yukihiro Matsumoto (matz at nws119)
-
- * freenode(): NODE_NILの解放忘れ.
-
- * 字句解析部のバグ修正(コメントの後の状態を戻し忘れ).
-
- * protect .. endのバグ修正. GC_LINKのネストが不正だった.
-
- * joinのバグ修正(使っているオブジェクトをfreeしていた).
-
- * splitのバグ修正(アルゴリズムがおかしかった).
-
- * fork()を追加.
-
-Wed Jan 26 17:09:56 1994 Yukihiro Matsumoto (matz at nws119)
-
- * ファイルテストメソッドの追加.
-
- * rb_autoexec(): クラスを初めてアクセスした時の挙動を制御できるよ
- うにした. これでautoloadも実現できる. これにともないメソッド
- unknownはなくなった.
-
-Tue Jan 25 15:51:36 1994 Yukihiro Matsumoto (matz at nws119)
-
- * Dbmクラス, Mathモジュールを作成.
-
- * -Iオプションでサーチパスに追加できるように.
-
- * サーチパスを変数$load_pathに設定できるように.
-
- * load(): ダイナミックロードを使えるようにした.
-
-Tue Jan 18 14:14:01 1994 Yukihiro Matsumoto (matz at nws119)
-
- * Comparable:"<=>"
-
- * Float,Fixnum:"**"
-
- * Array:sort
-
-Fri Jan 14 16:53:37 1994 Yukihiro Matsumoto (matz at nws119)
-
- * version 0.07
-
- * メソッドに関するドキュメントを充実させた.
-
- * String:index(): 引数positionを増やした.
-
-Thu Jan 13 15:13:52 1994 Yukihiro Matsumoto (matz at nws119)
-
- * 未初期化の変数アクセスをなくした.
-
- * 無駄なhash tableのアロケーションを削除.
-
- * Purify'd(on Sun)
-
- * ~RE と ~STRのコンパイル時展開の抑制.
-
- * Sunへ移植. signal()の戻り値. RDataのbug修正.
-
- * parse.y: nlsルールを削除.
-
- * yylex(): 改行と符合の解析部分を変更.
-
- * missing/strftime.c: 移植用.
-
- * Time:strftime: その他のメソッドもstrftimeを利用するように.
-
- * メソッド再定義時にメソッドキャッシュをクリアする.
-
-Fri Jan 7 15:23:20 1994 Yukihiro Matsumoto (matz at nws119)
-
- * Float:coerce(): FixnumとFloat以外の引数を与えられるた時には例外
- を発生するように.
-
- * Stat: stat構造体の全てのメンバに対するアクセスメソッドを用意.
-
- * 未定義のクラス/モジュールへの参照がunknownメソッドを呼び出すよう
- にした.
-
- * baseline - version 0.06.
diff --git a/doc/ChangeLog-0.50_to_0.60 b/doc/ChangeLog-0.50_to_0.60
deleted file mode 100644
index 5f5b03ff40..0000000000
--- a/doc/ChangeLog-0.50_to_0.60
+++ /dev/null
@@ -1,462 +0,0 @@
-Thu Dec 8 00:32:21 1994 Yukihiro Matsumoto (matz@dyna)
-
- * io.c($<.file,$<.filename): きちんと初期化.
-
- * parse.y(rb_class2name): includeしているクラス名を正常に表示でき
- なかった.
-
-Wed Dec 7 15:40:36 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * dln.c: config.hをincludeしていなかった.
-
- * missing/strdup.c: 忘れていた.
-
-Fri Dec 2 15:21:44 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 関数の命名ルールを変えた(クラスメソッド: Sxxx_xxx,ユーティリティ
- メソッドxxx_xxxなど).
-
- * re.c(casefold): 個々の正規表現オブジェクトが大文字小文字を無視す
- るかどうかを設定できるようにした.
-
-Thu Dec 1 01:44:51 1994 Yukihiro Matsumoto (matz@dyna)
-
- * missing.c: システムで提供されないファイルの扱いを変更した.
-
- * io.c($<): 変数`$<'が指しているものを現在読み込み中のファイル名か
- ら仮想ファイル($ARGF)に変更した.また,現在読み込み中のファイル
- 名とファイルオブジェクトにアクセスするメソッドも用意した.
-
- * ruby.h(data_new): Dataオブジェクトの割り当て方法を改善した.
-
-Wed Nov 30 15:36:13 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * Makefile: ルールを整理した.
-
-Tue Nov 29 00:09:26 1994 Yukihiro Matsumoto (matz@dyna)
-
- * array.c(`|'): 引数が配列でなく,かつそのオブジェクトが要素として
- 含まれていない時,そのオブジェクトを追加する.あればなにもしない.
-
- * process.c(gid,egid): GIDをアクセスするメソッド.
-
- * io.c(print): 文字列と配列に対する処理を組み込んで若干の高速化を
- 図った.出力が多い場合に効いてくるようだ.
-
- * parse.y(parse_string): ""で囲まれた文字列内では対応するエスケー
- プがない`\'を残さないように.つまり,今後は"\k" -> "k"である(以
- 前は"\k"だった).
-
-Mon Nov 28 18:02:31 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c(re_regsub): 置換文字列の置換えが不完全だった.
-
- * 一時オブジェクトの解放をすべてGCに任せた.今のままではまずいタイ
- ミングでオブジェクトを解放する可能性があった.昔のGCの時にはこれ
- でも良かったのだが.
-
-Tue Nov 22 00:15:24 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c($"): 既にロードしたファイル名の配列.
-
-Mon Nov 21 01:09:50 1994 Yukihiro Matsumoto (matz@dyna)
-
- * array.c(&,|): 集合としての積演算と和演算.
-
- * io.c($<): 文字列を代入した時には自動的にopenするように.IOのサブ
- クラスかどうかのチェックも行う.
-
-Sun Nov 19 23:02:27 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c($:): $LOAD_PATHの別名.
-
- * io.c($>): デフォルト出力先.IO.defaultは無くなった.
-
- * io.c($<): $FILENAMEの別名
-
- * glob.c(each): ワイルドカードにマッチするものがない場合,パターン
- そのものを与えるように.
-
- * file.c(chmod,chown,unlink,utime): `\'でワイルドカードをエスケー
- プできるように.
-
-Fri Nov 18 00:20:42 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.55 released
-
- * file.c(chmod,chown,unlink,utime): 引数として与えられた文字列にワ
- イルドカードが含まれている場合にはGlobオブジェクトに変換する.
-
-Wed Nov 16 17:33:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * file.c(chmod,chown,unlink,utime): 引数としてワイルドカードも受け
- 付けるように. その場合はマッチするファイル全体に適用される.
-
-Fri Nov 11 00:07:28 1994 Yukihiro Matsumoto (matz@dyna)
-
- * string.c(strip): 文字列そのものを変更するように.
-
- * eval.c(rb_cal): 環境をスタックに積むタイミングが間違っていたので,
- 不適切なエラーメッセージが出る時があった.
-
- * eval.c(rb_undefined): メソッドが無い時とメソッドにアクセスできな
- い時とでメッセージを替えた.
-
- * string.c: toupper/tolowerはupcase/downcaseを使って実現.
-
- * string.c: lcfirst/ucfirstは削除.
-
-Thu Nov 10 16:15:16 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * string.c: sub/gsubは置換後の文字列を返すようにした.
-
- * string.c: toupper/tolower/lcfirstなどを文字列を変更するものとし
- ないものの2 種類を提供するようにした.
-
-Tue Nov 1 17:52:09 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: 変数展開にバグがあって元の文字列を破壊していた.
-
-Thu Oct 27 09:56:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: rest引数の処理が間違っていた.
-
- * env.c(rb_yield): ローカル変数の設定が間違っていた.
-
-Wed Oct 26 19:01:43 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: 引数セットの高速化.
-
- * process.c: sleepのバグ.
-
- * parse.y, gnuglob.c: Sunのccでもコンパイルできるように.
-
-Tue Oct 25 00:36:16 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: 若干の高速化. スタックの処理によってrb_call()が少し遅く
- なった分の穴埋めくらいか.
-
- * eval.c: blockをenvから外すなどしてスタックを軽くした.
-
-Mon Oct 24 11:47:54 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c: 正規表現アクセス用の変数($`, $', $+)を追加.
-
- * re.c($KANJI): 処理する漢字コードをrubyプログラム内から設定できる
- ようにした.
-
-Sat Oct 22 00:42:41 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c: イテレータ内のredoとretryの処理にバグがあった.
-
-Fri Oct 21 00:53:21 1994 Yukihiro Matsumoto (matz@dyna)
-
- * string.c(swapcase): 文字列の大文字小文字を置き換える.
-
- * string.c(ljust,rjust,center): 文字列のレイアウト用メソッド.
- sprintf()でも同じようなことはできるが.
-
- * socket.c(recv,recvfrom): flags引数を省略可能にした. 省略時の値は
- 0である.
-
- * socket.c(recvfrom): recvと同様だが, データと相手アドレスのペアを
- 返す.
-
- * socket.c(accept): 戻り値をつながったソケットから, ソケットとアド
- レスのペアに変更した.
-
- * eval.c(eval): the_classをセットする時に, last_moduleがincludeさ
- れているモジュール(T_ICLASS)であれば, 定義元のモジュールの方をセッ
- トするように. この修正がないとICLASSに対してメソッドが呼ばれる可
- 能性があり, 不審な動作をする(はず).
-
- * class.c: オブジェクトのcloneの際に特異クラス(特異メソッド用のク
- ラス)をきちんとコピーするようにした. 今までは個々のメソッドのコ
- ピーを忘れていた.
-
- * numeric.c: Numericのnewとcloneをundefした.
-
-Thu Oct 20 11:30:00 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.53 released.
-
- * parse.y: TopLevelのdef文は関数メソッドを定義するようにした.
-
- * parse.y: def文のprivate指定はなくなった. export/noexportメソッド
- を使ってもらうことにした.
-
- * parse.y: case文にthenを含むことができるようになった.
-
-Wed Oct 19 13:09:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * object.c(export,unexport): 関数メソッドの設定用メソッド.
-
- * eval.c, class.c: 関数的メソッドを復活させ(またか…), `@'による
- privateメソッドをなくした. やはり, 関数的なものは関数的に呼びた
- い気がしてきた. こう仕様が変動しててはいけないような気もするなあ.
- *BACKWARD INCOMPATIBILITY*
-
- * eval.c: メソッドの構成を変更し, 別名管理と関数メソッドの管理を分
- 離した.
-
- * eval.c: the_env->last_funcをCメソッドの時にも更新する. これがな
- いとStructのアクセスが動作しない.
-
-Fri Oct 14 13:22:18 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.52 released: ……なんてこったい.
-
- * eval.c(rb_call): returnの処理が間違っていたので, マシンによって
- はreturnで関数を終了するだけでなくtoplevelまでつき抜けていた.
-
- * dbm.c: Dictと同様にeachが[key,value]を返すように.
-
- * version 0.51 released
-
-Thu Oct 13 12:13:48 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(SETUP_ARGS): 付加引数が配列でない時には配列に変換する.
-
- * parse.y: 括弧なしのメソッド呼び出しでも`*'による付加引数が使える
- ようにした. ただし, 通常引数が一つもない場合は乗算演算子と区別が
- つかないので, 必ず括弧が必要.
-
-Wed Oct 12 10:09:07 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(rb_call): キャッシュの計算をinline化. キャッシュミスがあ
- れば関数呼び出しでメソッドを検索する. methods.cはなくなった.
-
- * eval.c(rb_eval): ローカル変数用の領域をalloca()するように変更.
- サイズの変更が必要になれば改めてmalloc()するように.
-
- * parse.y: error recoveryの際にlex_stateを更新しておくように.
-
-Tue Oct 11 17:10:46 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * socket.c(for_fd): ファイル記述子(Fixnum)からソケットインスタンス
- を得るメソッド. たとえばinetdから起動されたサーバで標準入出力に
- ソケット操作を行なうために使う. つまりSocket.for_fd($stdin)で標
- 準入力に対応するソケットオブジェクトが得られる.
-
- * io.c(to_i): IOクラスのインスタンスを整数に変換するとそのファイル
- 記述子を返すように.
-
- * numeric.c(num2int): to_iメソッドを使ってできる限り整数に変換する.
- 以前はnum2fixだけが全てのオブジェクトに対してto_iメソッドを適用
- していた.
-
- * sprintf.c(Fsprintf): 整数表示の際, オブジェクトをできる限り整数
- に変換するように(to_iメソッドを使う).
-
-Fri Oct 7 14:06:32 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(Fcaller): 必要性がよく分からないのでドキュメントから削除.
- 将来デバッガを作る時に復活させよう.
-
- * eval.c(rb_call): Cで記述されたメソッド呼び出しでは環境をスタック
- にセーブしないことによって高速化.
-
-Wed Oct 5 15:00:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby.h: 一時env.hに移動してたQselfの定義を復活. ただし今回は関数
- として実現(env.hでは変数として再定義してある).
-
- * ruby.h: TRUEでsyntax errorにならないよう#undefを追加.
-
- * eval.c(rb_eval): thread化に挑戦したが, 失敗(速くならなかった).
- が, Scopingなどの無駄なコードの削除とメソッド呼び出しの引数セッ
- トのinline化で若干の高速化を実現した. 副作用として, argc, argv形
- 式の関数呼び出しの仕様が変化した(argvにselfを含まなくなった).
-
- * eval.c(rb_call): メソッド呼び出しの高速化.
-
-Tue Oct 4 11:40:53 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby-mode.el: 修飾子に対応した.
-
- * parse.y: 多重代入にrestをつけた. この機能を使えばoptional引数の
- 解析が簡単にできる(はず).
-
- * pack.c(unpack): uuencode形式のdecodeの際に文字列の長さが間違って
- いた.
-
-Mon Oct 3 15:58:41 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * file.c(type): ファイルタイプを文字列で返すメソッド.
-
-Fri Sep 30 11:36:07 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * object.c: デフォルトの真の値である%TRUEの値を1(Fixnum)からtに変
- 更した. to_sで文字列に変換した時にも`t'と表示される. 更に踏み込
- んで`t'を予約語にしてlispのようにしようかとも思ったが, そこまで
- は決心できなかった. 一文字のローカル変数はかなり使いそうな気がす
- るので….
-
- * array.c,dict.c: equalを再定義しているクラスで, hashを正しく定義
- した.
-
-Wed Sep 28 23:30:28 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c(Ffail): 今までfailはカーネルクラスのメソッドであったが,
- 構文に組み込んだ. この変更によって, 1)`fail'は予約語となり, ロー
- カル変数に用いることができなくなった. 2)`fail'単体で例外を発生す
- るようになった. 3)failはメソッドではなくなったので再定義される可
- 能性がなくなった.
-
- * dic.c, dbm.c(indexes): Arrayのindexesと同様の機能を持つメソッド
- を追加.
-
- * array.c(indexes): 引数をインデックスとする要素の配列を返す. 整数
- の配列を引数とする時には引数の要素をインデックスとする要素の配列
- を返す.
-
-Mon Sep 19 13:42:31 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * array.c(aset): 部分配列に対する代入で配列以外のオブジェクトが指
- 定された場合に多重代入と同じルールで配列化するようにした.
-
- * io.c(print): 引数として与えられた各オブジェクトにprint_onメッセー
- ジを与えるように. 実行速度は落ちるが柔軟性は増す.
-
-Fri Sep 16 14:59:18 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * glob.c: ワイルドカードの導入. bashに使われているGNUのglobルーチ
- ンを流用した.
-
-Mon Sep 12 18:36:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(value_expr): 式がnilの時に対応.
-
- * class.c: ICLASSのclassが必ずClass/Moduleを指すように.
-
-Tue Sep 6 16:23:28 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c: 正規表現内で「\数字」形式が指定できるように.
-
- * parse.y:「do expr using var ... end」形式はなくなった. 寂しい気
- もする. *BACKWARD INCOMPATIBILITY*
-
-Mon Sep 5 10:59:01 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * numeric.c(next): Numericクラスにもnextを提供.
-
- * string.c(upto): uptoを提供.
-
- * range.c(each): nextを使ったインタフェースからuptoを使うように変
- 更した. この方が一つのメソッドで処理をまとめで行なうことができる.
-
-Fri Sep 2 15:25:39 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * dict.c(each): 戻り値を[key, value]のペアに変更. 今までのeachは
- each_valueとして残る. *BACKWARD INCOMPATIBILITY*
-
-Thu Sep 1 10:49:04 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 成功した(特別な戻り値を持たない)システムコールは`0'を返すように.
-
-Wed Aug 31 00:26:51 1994 Yukihiro Matsumoto (matz@dyna)
-
- * string.c: チェックサムを得るメソッド`sum'を作った.
-
- * class.c(include_class_new): ICLASSのclassをもとのクラスにした.
- gcの際に元クラスをマークする必要があるのが, フィールドを増やす余
- 地が無いので, classフィールドを流用した. 私の見積りが間違ってい
- て, ICLASSのインスタンスにメッセージを送る事があれば, おかしな動
- 作をするだろう.
-
- * eval.c(masign): 式(a,b = nil)の値を[nil]からnilに変更した.
-
-Mon Aug 29 11:56:09 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * class.c: rb_define_mfuncを無くして, メタクラスにモジュールをイン
- クルードするようにした.
-
- * error.c(yyerror): 同じ行で複数のsyntax errorをリポートしないよう
- にした.
-
- * file.c: FileTestモジュールにファイルテストメソッドを分離した.
-
- * parse.y: 演算子を指定する時のlex_stateを正しく設定した.
-
-Sat Aug 27 01:23:34 1994 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: if/whileなどの複合式をprimaryに移動した. これによって例
- えば「if cond then a else b end.message()」のような式が書けるよ
- うになった.
-
-Fri Aug 26 10:46:30 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * spec: 整理された文法にしたがって書き直した.
-
- * parse.y: ここ数日で混乱していた文法を整理した. 括弧を省略したメ
- ソッド呼び出しができるようになったこと, modifierが付けられるよう
- になったこと, returnにリストが渡せるようになったことが主な変更点
- である.
-
- * process周りが怪しいがとにかくSolaris 2.3で動くように.
-
- * parse.y: 曖昧性がない場合にはメソッド呼び出しの引数の括弧を省略
- できるように. 省略できるメソッド呼び出しの条件は, 1)かならず1個
- 以上の引数を必要とすること, 2)第1引数が`+', `-', `(', `[', `{',
- `/'など, 式の始まりに置かれた時と途中に現れた時とで解釈が違う記
- 号で始まらないこと, である.
-
-Thu Aug 25 13:54:58 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(cond): 条件式の展開部にbugがあった.
-
-Wed Aug 24 00:01:15 1994 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: returnはコンマで区切ったリストも受け取るように. つまり,
- return a, b, cはreturn [a, b, c]と同じ意味になる.
-
- * parse.y: yield以外の大域脱出制御式をexprからexpr0に移した. よっ
- てメソッドの引数に制御式を使えなくなる(これで困る人はいないはず).
-
- * parse.y: `+'の定数展開の際に演算子の優先順位を忘れていた.
-
- * eval.c: untilの戻り値はnilになった.
-
- * parse.y: modifierとしてのif/unless/while/untilを追加.
-
- * parse.y: 文法からendの後ろにつけるキーワードを削除. ほとんど使わ
- なかった上に, emacsではruby-modeがあれば対応のチェックが機械的に
- 出来るため.
-
-Tue Aug 23 18:08:33 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: スクリプト実行開始前に例外が発生した時にcore dumpした.
- 組み込み用にコードを変更した時にenbugしてしまった.
-
-Tue Aug 23 00:07:17 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c: doの戻り値がいつもnilになっていた.
-
- * parse.y: loop制御変数の多重代入化にbugがあった.
-
- * parse.y(expand_op): 文字列も畳み込みの対象に.
-
-Mon Aug 22 10:50:01 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(expand_op): `+'に関しては結合則を使って, より多く定数畳
- み込みを行なうように.
-
- * ruby.c(proc_options): argcが0の時にも対応.
-
- * parse.y: forなどの制御変数に多重代入も使えるように.
-
-Sat Aug 20 00:59:40 1994 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y(call_op): 演算子`~'の取り扱いをルール部へ移動.
-
-Fri Aug 19 11:44:13 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * main.c: rubyをほかのプログラムに組み込めるようにmain()を分割した.
- それにともない, プログラムの呼び出し構造を修正した.
-
- * parse.y: 条件式の定義を変更. ifなどの条件式の中でだけ`&&'や`||'
- および`!'の引数が条件式になるように. この変更により条件式以外の
- 場所での `&&', `||', `!'演算子の動作が直観に一致する.
-
- * parse.y: 実引数の`*'の後に続く引数はexprに制限した. 今までは全て
- の文が有効
diff --git a/doc/ChangeLog-0.60_to_1.1 b/doc/ChangeLog-0.60_to_1.1
deleted file mode 100644
index 33b0326892..0000000000
--- a/doc/ChangeLog-0.60_to_1.1
+++ /dev/null
@@ -1,3955 +0,0 @@
-Tue Aug 12 16:02:18 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * variable.c: option variables: $-0, $-p(readonly), $-v,
- $-I(load_path), $-a(readonly), $-K, $-d, $-F, $-i, $-l.
-
- * parse.y (yylex): ignore rd (ruby document) in the code.
-
-Mon Aug 11 12:37:58 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * re.c (Init_Regexp): $-K as alias to the $KCODE.
-
- * io.c (Init_IO): new virtual variable $-i for the value of -i
- option.
-
- * enum.c (Init_Enumerable): include? as alias of member?
-
-Fri Aug 8 11:16:50 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * io.c (io_foreach): now the record separator can be specified.
-
- * io.c (io_s_readlines): new method to read in whole file (or
- command output) from path.
-
- * ext/socket/socket.c (Init_socket): recvfrom did not work.
-
- * ext/socket/socket.c (sock_send): forgot to check nil for false
- value.
-
-Thu Aug 7 11:40:01 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * variable.c (mod_constants): lists constants defiend in the
- modules/classes.
-
- * variable.c (rb_const_set): no longer warns about constant
- overriding by subclasses.
-
- * eval.c (mod_eval): does eval() on module's context. local
- variables are shared with outer scope.
-
- * object.c (Init_Object): remove private_attr/public_attr.
-
-Wed Aug 6 14:21:36 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * object.c (mod_attr): forgot to check nil for false value.
-
-Mon Aug 4 11:50:28 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * object.c (class_s_new): need not to specify names to create
- classes (or modules) dynamically.
-
- * variable.c (rb_class_path): scan class constants for anonymous
- classes/modules to make up pathes.
-
-Wed Jul 30 08:45:12 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * eval.c (rb_eval): stop to cache const value in nodes.
-
-Sat Jul 26 03:17:22 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * numeric.c (flo_to_s): wrong .0 at end.
-
-Sat Jul 26 00:36:36 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * eval.c (error_print): always print exception type in the
- toplevel exception handler.
-
- * string.c (str_hash): wrong hash value.
-
-Thu Jul 24 11:05:51 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * string.c (uscore_get): proper error message for unset $_.
-
-Wed Jul 23 09:56:55 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (obj_methods): returns list of method names of the
- specified object.
-
- * class.c (mod_instance_methods): returns list of method names of
- the class instnace.
-
-Fri Jul 11 22:38:55 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (class_superclass): returns class's superclass
- itself. (1.1)
-
- * object.c (obj_type): returns object's class itself. (1.1)
-
- * class.c (mod_included_modules): list included modules.
-
- * object.c (class_superclass): raises error for Object.
-
-Thu Jul 3 09:54:02 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (SETUP_ARGS): save source position, remove nd_line().
-
- * eval.c (rb_call): replace modulo by bit-masking.
-
- * eval.c (POP_SCOPE): force recycle scope object to reduce gc rate.
-
- * gc.c (obj_free): aboid calling run_final() when no finalizer is set.
-
- * eval.c (PUSH_VARS): do not allocate the dynamic scope's end-mark
- object.
-
-Wed Jul 2 14:25:07 1997 KIMURA Koichi <kkimura@pure.cpdc.canon.co.jp>
-
- * Native mswin32 support.
-
-Tue Jul 1 09:59:00 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970701
-
- * parse.y (mrhs): allow rest-star(*) in right hand side.
-
-Tue Jun 24 19:04:31 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970624
-
-Sat Jun 20 22:22:51 1997 Michio "Karl" Jinbo <karl@marcer.nagaokaut.ac.jp>
-
- * eval.c: freebsd 3.0 <sys/select.h> support.
-
-Fri Jun 20 01:24:45 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970620
-
- * gc.c: eliminate uninitilalized field of Hash, Array etc., to
- avoid dumping core.
-
-Thu Jun 19 01:29:44 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970619
-
- * string.c (str_split_method): wrong limit.
-
-Sat Jun 14 01:54:16 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * class.c (rb_singleton_class): no singleton for special
- constants (now raises exception).
-
- * eval.c (ruby_init): cbase in TOPLEVEL_BINDING need to be
- initialized.
-
-Sat Jun 14 01:01:16 1997 maeda shugo <shugo@po.aianet.ne.jp>
-
- * array.c (sort_2): wrong comparison.
-
-Sat Jun 14 00:53:44 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * hash.c (hash_foreach): safe iteration.
-
-Fri Jun 13 14:04:56 1997 Michio "Karl" Jinbo <karl@marcer.nagaokaut.ac.jp>
-
- * configure.in: -Bshareable option for netbsd.
-
-Fri Jun 13 01:16:22 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * io.c (pipe_open): call io_unbuffered() only for writable pipes.
-
-Thu Jun 12 01:14:15 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970612
-
- * ext/socket/socket.c (sock_new): use io_unbuffered().
-
- * ext/marshal/marshal.c (w_long): compact long format, which
- supports 64 bit architectures (unless longs are >32 bit size).
-
- * ext/marshal/marshal.c: allows recursive data for marshaling.
-
- * parse.y (rb_intern): raise exception for non-internable string.
-
- * ext/marshal/marshal.c (marshal_load): allows direct loading from
- strings.
-
- * ext/marshal/marshal.c (marshal_dump): allows direct dump to strings.
-
- * ext/marshal/marshal.c (marshal_dump): interface changed.
-
-Wed Jun 11 18:26:00 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gc.c (rb_newobj): remove needless memset().
-
-Mon Jun 9 13:03:43 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): reduce condition checks from while/until loop.
-
- * eval.c (rb_eval): wrong jump point for `next'.
-
-Fri Jun 6 11:47:39 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c (ruby_set_argv): initialize dln_argv0 for dln_a_out.
-
- * ext/socket/socket.c (open_unix): display path name for exceptions.
-
- * ruby.c (proc_options): option -S did not work well.
-
-Fri May 30 02:14:44 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970530
-
- * eval.c (eval): set $! properly if exception raised in eval().
-
- * io.c (io_write): now handles non T_FILE object.
-
- * io.c (io_defset): $< can be anything which has `write' method.
-
-Thu May 29 15:40:22 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (eval): $@ is always an array (not string).
-
- * pack.c (pack_unpack): avoid corrupting memory for unexpected
- input strings.
-
-Wed May 28 12:46:13 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970528
-
- * process.c (rb_waitpid): do not block other threads.
-
-Tue May 27 12:02:31 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (ruby_init): split initialize and processing command line
- options.
-
- * ruby.c (ruby_options): ruby_init(0, 0, envp) dumps core.
-
-Tue May 20 18:59:45 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * variable.c (rb_ivar_set): invalid instance variable access for
- built-in object raises TypeError.
-
-Fri May 16 17:32:21 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970516
-
- * dir.c (push_globs): was freeing non heap pointer.
-
- * gc.c: remove some duplicated prototypes.
-
- * ext/kconv/kconv.c: fix prototypes.
-
-Fri May 9 11:38:59 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970509
-
- * gc.c (obj_free): avoid free(NULL).
-
- * eval.c (rb_check_safe_str): argument missing for TypeError().
-
-Thu May 8 01:14:28 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_s_dirname): need to return "." for path without
- slashes.
-
-Wed May 7 19:18:48 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * process.c (f_fork): child processe does not inherit parent's
- itimer setting on linux. call setitimer() again in the child
- process.
-
-Sat May 3 02:49:43 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/curses/curses.c: modified for portability and add to the
- standard distribution.
-
-Wed Apr 30 00:34:00 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_s_size): returns 0 for empty files (not FALSE).
-
-Fri Apr 25 02:17:50 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970425
-
- * eval.c (f_load): free unused name-table.
-
- * eval.c (f_load): copy local variable name-table.
-
- * gc.c (obj_free): avoid free(NULL).
-
- * eval.c (rb_eval): forgot to make link from the scope object to
- NODE_SCOPE. It may crash the interpreter.
-
-Thu Apr 24 00:35:09 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * random.c (f_srand): save old seed anyway. srand() returns no
- value on some systems.
-
- * gc.c (obj_free): avoid double free of the local variable name
- table.
-
- * parse.y (top_local_setup): modify realloc to handle offset.
-
-Tue Apr 22 12:58:26 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970422
-
-Thu Apr 17 00:40:51 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * configure.in (rb_cv_bsdpgrp): proper check for BSD
- setpgrp/setpgrp.
-
-Wed Apr 16 16:14:02 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (proc_call): proc called in other thread must be orphan.
-
-Tue Apr 15 10:46:31 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970415
-
- * gc.c (obj_free): NODE_SCOPE marked from SCOPE object.
-
- * gc.c (gc_mark): some nodes marked wrong.
-
- * process.c (proc_getpgrp): wrong argument
-
-Fri Apr 14 18:32:42 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970414
-
-Fri Apr 12 01:20:12 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.h: String pointer changed to unsigned char.
-
-Fri Apr 11 10:27:29 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970411
-
- * Makefile.in: create libruby.a before linking ruby.
-
- * string.c (str_strip_bang): >0x80 characters for isspace().
-
- * eval.c (proc_call): set safe-level temporally
-
- * eval.c (proc_s_new): save safe-level in the proc context.
-
- * eval.c (rb_eval): no class/module extension in safe mode.
-
-Thu Apr 10 02:10:41 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gc.c (gc_mark): remove some pointer checks for speeding up.
-
- * ruby.c (ruby_options): set $0 temporally for -r option.
-
- * eval.c: built-in security feature.
-
- * gc.c (gc_sweep): do not free nodes during compile.
-
- * parse.y (yycompile): set flag when compiling.
-
-Wed Apr 9 10:19:02 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c: forgot to include <ctype.h> for isspace().
-
- * file.c: provide S_ISREG for some platforms.
-
- * io.c (Init_IO): added some $< operations.
-
- * lib/ping.rb: check host upness using TCP echo.
-
-Tue Apr 8 00:10:15 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (arg_read): bug with 0 length input.
-
-Mon Apr 7 11:36:16 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/fcntl/fcntl.c: module for fcntl constants.
-
- * eval.c (rb_alias): bug when original was an alias.
-
- * parse.y (primary): syntax to access singleton class.
-
- * eval.c (mod_public_method): method's to specify visibitily of
- the class methods. make_method_{public,private} removed.
-
-Fri Apr 4 21:43:57 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970404
-
- * gc.c (obj_free): finalizer added for experiment.
-
-Thu Apr 3 02:12:31 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_schedule): make Fatal rise on main_thread on
- deadlocks.
-
- * eval.c (thread_join): raise ThreadError instead of Fatal, in
- case of deadlock.
-
- * regex.c (re_compile_fastmap): uninitialized local variable.
-
- * parse.y (parse_regx): new option //[nes] to specify character
- code for regexp literals. Last specified code option is valid.
-
- * re.c (reg_s_new): additional 3rd argument to specify compiled
- regexp's character code.
-
- * re.c (reg_new_1): regexp character code can be specified for
- each regexp object.
-
-Wed Apr 2 14:51:06 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_create): handle uncaught throw.
-
- * eval.c (thread_create): halt on some deadlock conditions.
-
- * regex.c (is_in_list): wrong result for non-mbc higher-byte
- characters.
-
- * regex.c (re_match): wrong skip for multi-byte characters.
-
- * regex.c (re_compile_fastmap): wrong fastmap in non-mbc mode.
-
- * hash.c (Init_Hash): hash compatible features added to ENV.
-
-Tue Apr 1 15:24:06 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (obj_extend): remove Object#extend as an iterator which
- is in experimental state, since it unveils internal singleton
- classes.
-
-Mon Mar 31 14:29:39 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970331
-
-Sun Mar 30 19:40:57 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * parse.y (terms): avoided win32 gcc's optimization bug.
-
-Sat Mar 29 11:21:58 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * struct.c (make_struct): St[val,..] creates new structure.
-
-Fri Mar 28 11:24:51 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (obj_make_private): new method make_method_{public,private}
- to change visibility of singleton methods.
-
- * regex.c (re_compile_pattern): enables numeric literal >= 0x80 in
- the character class.
-
- * regex.c (re_compile_pattern): enabled numeric literal >= 0x80,
- in multibyte mode.
-
- * regex.c (re_compile_fastmap): modified exantn and charset(_not)
- to set fastmap for higher bytes properly.
-
- * regex.c (is_in_list): now matches numeric literals.
-
-Thu Mar 27 13:34:20 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * pack.c (pack_unpack): extra null byte after unpacked string.
-
-Wed Mar 26 15:20:34 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * regex.c (re_compile_pattern): register numbers must be fit in a
- byte (0 <= regnum <= 0xff).
-
- * regex.c (re_compile_fastmap): forgot to set mbchar map for
- charset_not if RE_MBCTYPE is on.
-
- * regex.c (re_compile_pattern): set list bits for multi-byte
- characters for \W, \S, \D in range expression.
-
- * object.c (obj_is_kind_of): defined that nil itself is kind of
- nil. TRUE is kind of TRUE, FALSE is kind of FALSE likewise.
- This change makes `obj.kind_of?(eval(obj.type))' always true.
-
-Tue Mar 25 14:08:43 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/English.rb: provides nicer English alias for the variables.
-
- * parse.y (expr): alias $var1 $var2 makes alias of the global
- variable.
-
-Mon Mar 24 18:23:20 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970324
-
-Thu Mar 20 22:04:59 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (mod_modfunc): forget to clear method cache.
-
-Wed Mar 19 17:06:55 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (program): set methods' default private/public status
- correctly under eval().
-
- * eval.c (eval): set the_class correctly while evaluating string.
-
-Tue Mar 18 12:23:53 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (eval): yield can be called from eval().
-
- * version 1.0-970318
-
- * parse.y (program): regexp in condition expression should do
- matching operation with $_.
-
- * re.c (reg_regsub): wrong substitution.
-
-Fri Mar 14 14:36:28 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * hash.c (hash_invert): returns value to key mapping of the
- associative array.
-
- * ext/socket/extconf.rb: set environment variable SOCKS_SERVER to
- compile with libsocks.a.
-
- * ext/socket/socket.c (socks_s_open): SOCKSsocket class to access
- internet via SOCKS library.
-
- * sprintf.c (f_sprintf): unsigned formats display leading double
- dots for imaginary sequence of signed bit to the left.
-
- * sprintf.c (f_sprintf): correct width and precision formatting
- for big integers.
-
- * parse.y (yylex): enables negative hex/octal numbers and `_' in
- non-decimal numbers.
-
- * sprintf.c (f_sprintf): %u added for unsigned decimal format.
-
-Thu Mar 13 10:24:27 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sprintf.c (f_sprintf): wrong output for bignums.
-
- * array.c (ary_reverse_each): iterates in reverse order.
-
- * pack.c (pack_unpack): L unpacked signed long.
-
- * io.c (f_backquote): now returns an empty string for no output.
-
-Wed Mar 12 10:20:30 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/socks/socks.c: socket module with socks library.
-
-Mon Mar 10 20:44:22 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * re.c (reg_regsub): \& for substitution. \`, \', and \+ are
- avaiable also.
-
-Thu Mar 6 01:47:03 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970306
-
- * sample/rubydb.el (gud): ruby debugger emacs interface
-
- * lib/debug.rb: ruby debugger
-
- * parse.y (exprs): more accurate line number display.
-
-Wed Mar 5 21:31:46 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970305
-
-Tue Mar 4 12:28:32 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c (proc_options): search through RUBYPATH and PATH for
- option -S.
-
-Mon Mar 3 22:44:55 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_status): returns nil for exception terminated
- threads.
-
- * eval.c (thread_value): re-raise exceptions.
-
-Sat Mar 1 00:59:47 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): restore $! value after rescue clause, to
- re-raise exceptions correctly.
-
-Fri Feb 28 16:43:38 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970228
-
-Thu Feb 27 11:23:41 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_yield_0): redo raises exception
-
- * eval.c (thread_schedule): bug in interrupt handling by rescue.
-
-Wed Feb 26 00:55:36 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (eval): forgot to restore dynamic local variable
- bindings.
-
-Tue Feb 25 11:22:08 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/aix_ld.rb: AIX dynamic load support (not tested).
-
- * eval.c (rb_eval): wrong return value for defined? super.
-
- * error.c (exception): more error check.
-
- * re.c (reg_regsub): wrong substitution when sub expanded to null
- string.
-
-Fri Feb 21 13:01:47 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970221
-
- * eval.c (f_require): volatile added. register variable was
- recycled, so that GC did not mark that variable.
-
- * object.c (Init_Object): forget to mark main object (was mostly
- ok, but made trouble with early GC.)
-
-Thu Feb 20 11:50:50 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970220
-
-Thu Feb 20 11:25:50 1997 Yasuo OHBA <jammy@shljapan.co.jp>
-
- * lib/date.rb: update
-
-Thu Feb 20 08:25:57 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (yylex): forgot tokfix() before rb_intern().
-
- * lib/tk.rb (TkVariable): give up using trace_var.
-
-Wed Feb 19 00:24:35 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970219
-
- * pack.c (pack_pack): packed by null for A specifier. must be
- space filled.
-
- * pack.c (pack_unpack): bug in skipping spaces
-
- * gc.c (xmalloc): garbage collect for every 4 Meg. allocation.
-
- * string.c (str_split_method): limit worked wrong way.
-
- * io.c (io_gets_method): misunderstand 0xff in binary files when
- $/ == nil.
-
- * re.c (reg_regsub): re-implement.
-
- * ext/socket/socket.c (thread_connect): remove O_NONBLOCK, which
- is not defined on some platform like NeXT.
-
-Mon Feb 17 13:08:30 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970217
-
- * object.c (mod_eqq): === extended for subclass check (to use case
- as typecase).
-
-Sat Feb 15 02:07:22 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * regex.c (re_compile_pattern): wrong match backref at end of pattern.
-
- * io.c (arg_read): now works beyond end of file.
-
-Thu Feb 13 16:21:24 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (expr): return/yield now accept normal argument format.
-
- * parse.y (yylex): a star in `yield *x' must not be multiplication
- operator.
-
-Wed Feb 12 15:06:44 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * time.c (time_plus): bug in simple addition.
-
- * eval.c (thread_raise): raise exceptions from outside.
-
- * eval.c (Init_Thread): Thread#alive? -- alias for Thread#status.
-
-Mon Feb 10 00:38:55 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.h (Data_Make_Struct): rename macros.
-
-Sun Feb 8 11:48:13 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (f_syscall): argument offset was wrong.
-
-Fri Feb 7 18:01:17 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970207
-
- * eval.c: add volatiles to avoid variable crobbering by longjmp().
-
- * eval.c (f_raise): 1st argument can be the GlobalExit object now.
-
- * array.c (ary_unshift): no longer accept more than 2 args.
-
- * eval.c (f_raise): bug if 2nd argument is the exception.
-
-Tue Feb 4 00:37:29 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970204
-
- * eval.c (eval): check compile errors by nerrs.
-
- * eval.c (rb_eval): check syntax error by nerrs, not by the return
- value, which may be NULL.
-
- * eval.c (compile): Do not clear errinfo.
-
-Mon Feb 3 10:13:06 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (obj_extend): move real inclusion to Module#extend_object
- to allow redfinition.
-
- * object.c (Init_Object): Kernel class is now Module. Object class
- became the true root class.
-
- * object.c (obj_inspect): remove useless buffer.
-
- * hash.c (any_cmp): disable interrupts and context switching.
-
- * st.c: remove ALLOW_INTS to disable interrupt during operations.
-
-Fri Jan 31 22:10:08 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * hash.c (hash_rehash): re-register all key-value.
-
-Thu Jan 30 02:14:49 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (io_reopen): re-implement according to clone() way.
-
- * io.c (io_clone): copy IO object.
-
- * struct.c (struct_eql): compare elements by eql?.
-
- * io.c (io_mode_flags): detect "rb", "wb" etc.
-
- * io.h (FMODE_BINMODE): added.
-
- * ext/socket/socket.c (Init_socket): undef BasicSocket.new
-
- * file.c (Init_File): File.new(path[,mode])
-
- * io.c (Init_IO): IO.new(fd[,mode])
-
- * eval.c (rb_method_boundp): forgot to enable priv argument.
-
- * object.c (Init_Object): remove `=~' from Kernel class.
-
- * ext/socket/socket.c (open_inet): initialize sockaddr before
- calling bind(2).
-
- * sample/ruby-mode.el (ruby-calculate-indent): skip comment lines
-
-Wed Jan 29 18:43:22 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (Init_Thread): DEFER_INTS during initializing threads.
-
- * hash.c (Init_Hash): Hash#eql? checks for object identity.
-
- * eval.c (thread_set_critical): wrong value assigned.
-
-Mon Jan 27 16:10:51 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (io_print): remove print_on().
-
- * eval.c (f_missing): proper error message for undefined method
- without argument
-
-Sat Jan 25 23:32:32 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_sub_s): false alert - sub() does not modify string.
-
- * array.c (ary_times): negative multiplication detected
-
- * string.c (str_times): negative multiplication detected
-
-Fri Jan 24 10:51:39 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * time.c (time_arg): month -> 0 == "jan" == "1" == "01", little bit
- confusing but wanted to conform japanese style.
-
- * version 1.0-970124
-
-Fri Jan 24 09:52:49 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * util.c (_fixpath): supports SJIS filenames on DJGPP.
-
-Thu Jan 23 16:52:06 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * README.EXT: update. partially translated into English.
-
- * ext/extmk.rb.in: inherit $LDFLAGS to the final link.
-
- * ext/socket/socket.c (Init_socket): add various constants.
-
-Mon Jan 23 11:40:59 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * eval.c (Init_Thread): allocate main_thread first to avoid crash.
-
-Thu Jan 23 02:09:26 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gc.c (ObjectSpace): API modified. each_object method will do all
- the iteration.
-
- * eval.c (proc_call): wrong return from nested lambda.
-
- * ext/GD/GD.c: debugged.
-
-Wed Jan 22 16:12:25 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970122
-
- * gc.c (gc_mark): forgot to mark match->str.
-
- * ext/GD/GD.c: GD interface module.
-
- * eval.c (PUSH_BLOCK): wrong value pushed as the block level.
-
-Mon Jan 20 14:01:31 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_run): no context switch in the critical section.
-
-Mon Jan 20 09:40:59 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * utils.c: supports 8+3 filenames
-
-Sat Jan 18 01:23:03 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970118
-
- * regex.c (PATFETCH): need cast to unsigned char.
-
- * io.c (io_ctl): bug in case when arg is not a string.
-
- * lib/tk.rb: forgot that Kernel#type returns the class name now.
-
- * regex.c (re_search): "abc\n" =~ "^$" should not match.
-
-Fri Jan 17 12:31:37 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970117
-
- * ruby.c (ruby_options): constant PLATFORM, which is in the {cpu}-{os}
- form, defined.
-
- * configure.in: platform information embedded in the interpreter.
-
- * regex.c (re_search): /^$/ did not match to "" by wrong exit condition.
-
- * lib/thread.rb: re-write Mutex/Queue based on Thread.critical.
-
- * eval.c (thread_set_critical): remove Thread.exclusive, add
- Thread.critical = TRUE/FALSE instead.
-
- * re.c (reg_search): re-compile pattern if needed
-
- * regex.c (PATFETCH): do translate at compile time
-
-Thu Jan 16 00:49:10 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gc.c (gc_mark_frame): forgot to mark frame->cbase.
-
- * regex.c (re_compile_pattern): /a$|b)/ causes error.
-
- * regex.c (re_compile_pattern): /(^|b)/ causes error.
-
- * version 1.0-970116
-
- * re.c (Init_Regexp): set RE_CONTEXTUAL_INVALID_OPS flag.
-
-Tue Jan 14 02:09:06 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (proc_call): Proc#callをイテレータとして呼んだ時に対応
-
- * configure.in: nextstep対応?
-
- * eval.c (rb_eval): a[b]=cで無駄な配列を割り当てない
-
- * eval.c (f_send): イテレータとして呼ばれたらイテレータとしてメソッ
- ドを呼ぶ.
-
- * string.c (str_new4): match共有用の生成関数
-
- * re.c (reg_search): matchの実体(文字列)をマッチを行った文字列と
- copy-on-writeで共有
-
- * string.c (str_hash): toupperをかける条件が違っていた
-
- * array.c (sort_2): FixnumとStringを特別扱いして高速化
-
-Mon Jan 13 11:03:53 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_create): threadが生成されるまで割込みを設定しない
-
- * eval.c (Init_Thread): 割込みタイミングを100msecに
-
-Sat Jan 11 00:17:05 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * regex.c (re_search): マッチに失敗する場合があった(本当に直ったか?)
-
- * io.c (io_ioctl,io_fcntl): 第2引数を省略可能に
-
- * io.c (io_ioctl,io_fcntl): 戻り値がIOだった.整数(システムコール
- の戻り値)を返すようにした.
-
- * io.c (io_ctl): 引数が整数の時に対応
-
- * io.c (io_fcntl): file.cから移動
-
-Fri Jan 10 17:01:47 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-970110
-
- * ext/socket/socket.c (thread_connect): open(connect(2))で他の
- threadをブロックしないように
-
- * eval.c (thread_create): exitでないときにexitだと思い込む
-
-Mon Jan 6 17:42:22 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_sub_s): 文字列長より長いoffsetの検出
-
- * regex.c (re_search): 空にマッチするパターン後の$で失敗
-
-Thu Jan 2 16:36:23 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_reopen): Fileのreopen(pathまたはIOで指定).
-
- * io.c (io_reopen): IOのreopen(IOで指定) -- change classつき
-
-Wed Jan 1 11:09:01 1997 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (f_select): timeoutでnilを返す
-
-Fri Dec 27 13:06:44 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_s_open): サブクラスではそのクラスのインスタンスを返
- すように.
-
-Fri Dec 27 08:58:27 1996 <ono@isl.nara.sharp.co.jp>
-
- * numeric.c (flo_to_s): index()を使わない.strstr()に.
-
-Thu Dec 26 01:34:17 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/tk.rb: placeが使えるように
-
- * pack.c (endian): マクロDYNAMIC_ENDIANを指定すると実行時にendian
- を判定するように.
-
- * eval.c (thread_alloc): 初期化忘れのメンバがあった.
-
-Wed Dec 25 00:33:19 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 1.0-961225
-
- * io.c (Init_IO): newを無効化
-
- * lib/tkthcore.rb: tk_call "global $foo; set foo 5"などもできるように
-
- * eval.c (thread_restore_context): $~, $_でスタックを壊していた
-
- * process.c (rb_waitpid): threadに一応対応
-
-Tue Dec 24 15:20:58 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.4-961224
-
- * configure.in: charがunsignedかどうかもチェック
-
- * regex.c (SIGN_EXTEND_CHAR): __CHAR_UNSIGNED__にも対応
-
- * pack.c (pack_unpack): 明示的にsigned charを指定.
-
-Mon Dec 23 14:41:23 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c (load_file): 標準入力からのスクリプトで一時ファイルを使わ
- ないように
-
- * object.c (f_integer): `0x', `0'などでbaseを解釈するように.
-
-Fri Dec 20 01:44:39 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * Makefile.in (flock.o): flockに対応
-
-Thu Dec 19 20:13:32 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.4-961219
-
-Wed Dec 18 00:06:48 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * glob.c (glob_filename): strrchrがマクロの場合に対応
-
- * configure.in: <sys/select.h>をチェック
-
- * ext/kconv/kconv.c: 1.62ベースに
-
- * ext/kconv/kconv.c: Kconvモジュール
-
- * string.c (str_substr): lenが元の文字列より長い時に対応
-
- * parse.y (iterator): 「$bar do .. end」などは許さないように
-
- * parse.y (iterator): FID(foo!,foo?)をdo形式のイテレータにできる.
-
- * missing/flock.c (flock): lockf()を使って代替
-
- * file.c (file_flock): flockを実装
-
-Tue Dec 17 12:13:38 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.4-961217
-
-Fri Dec 13 02:05:03 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * configure.in: RUBYLIBのカレントを後回し(@mix/awk offline)
-
- * dln.c: AIXに対応した?(@mix/awk offline)
-
- * eval.c (thread_schedule): critical sectionでも明示的なコンテキス
- トスイッチは起きないとまずい
-
- * re.c (reg_search): matchに失敗した時に$~をnilに.
-
- * re.c (reg_search): 毎回matchを生成するように
-
-Thu Dec 12 17:03:30 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * numeric.c (flo_to_s): 2.0.to_s -> 2.0に
-
- * eval.c (thread_save_context): $_, $~をthread毎に保存
-
- * eval.c (thread_kill): main threadではexit(0)
-
- * string.c (str_split_method): 間違った結果を返していた
-
-Thu Dec 12 15:32:48 1996 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * dir.c: CYGWIN32対応
-
- * ext/socket/socket.c: CYGWIN32対応
-
- * io.c: CYGWIN32対応
-
-Thu Dec 12 14:43:51 1996 Jun Kuroda <j_kuro@pluto.ai.kutech.ac.jp>
-
- * lib/tk.rb: wish4.2も探索候補に含める
-
- * config.guess: JCC対応
-
-Thu Dec 12 00:41:17 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.4-961212
-
- * parse.y (parse_string): """..."""はやはり無くすことにした
-
- * parse.y (parse_regx): %r|...|でterminatorを \ でエスケープできる
- ように
-
- * signal.c (posix_signal): sigactionを使うsignal
-
- * configure.in: posix signal/bsd signalの検出
-
-Wed Dec 11 17:47:35 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_schedule): critical sectionではコンテキストスイッ
- チが起きないように
-
- * lib/thread.rb: SharedMutexクラス
-
- * lib/jcode.rb: String#scanを使うように
-
-Tue Dec 10 12:21:28 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961210
-
- * string.c (str_split_method): 正規表現に()を含む時にバグ
-
- * lib/jcode.rb: ちょっとましになった
-
- * string.c (tr_setup_table): 置換文字が短すぎる(2文字)のときのバグ
-
-Mon Dec 9 11:38:04 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_scan): 文字列のマッチを行う.イテレータとしても動
- 作する
-
- * regex.c (re_copy_registers): allocatedが初期化されていなかった
-
- * re.c (match_to_s): $~の文字列化
-
- * re.c (match_to_a): $~を配列化できるように
-
- * re.c (match_getter): レジスタが初期化されていなかった
-
-Thu Dec 5 11:06:10 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_split_method): マッチしなかった括弧は空文字列を
- pushするべきではない
-
- * string.c (str_succ): アルファベットを含まない文字に対応
-
-Wed Dec 4 10:48:09 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961204
-
- * io.c (io_binmode): DJGPPでのbinmode対応
-
- * sprintf.c (f_sprintf): intの範囲の数値は直接sprintfで変換する
-
- * sprintf.c (f_sprintf): "%02s"に頼らない
-
- * re.c (reg_search): indexでSEGV
-
-Tue Dec 3 10:09:36 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961203
-
- * ext/extmk.rb.in (install): INSTALL_DATAからINSTALLに変更
-
- * dln.c: hpux対応
-
- * string.c (str_aset_method): 負の値を含む範囲でも例外を起こさない
-
- * array.c (ary_replace): 負の値を含む範囲でも例外を起こさない
-
- * array.c (beg_len): beg==endの時,長さ0に
-
-Mon Dec 2 14:07:12 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * configure.in: HP shl対応
-
- * string.c (str_upto): beg > endの時無限ループに落ちるのを止めた
-
- * range.c (range_each): String#uptoが再定義された場合に対応
-
- * string.c (str_split_method): "ABC".split(/(B)/)が誤動作
-
-Sat Nov 30 01:43:52 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): undefでSEGV
-
-Fri Nov 29 12:17:59 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-parse-region): %Q#..#などに対応.しか
- し,区切り文字が演算子で行末にある場合には対応できなかった.
-
- * re.c (reg_raise): 例外でもスラッシュをエスケープ
-
- * re.c (reg_inspect): スラッシュをエスケープ
-
- * parse.y (parse_string): `%[QqXxRr](.)..\1'なる文字列形式(テスト
- 採用)
-
- * parse.y (parse_qstring): '''...'''の形式
-
- * ext/dbm/dbm.c (Init_dbm): 述語key?,value?の追加
-
- * ext/dbm/dbm.c (Init_dbm): includes->include?
-
- * hash.c (Init_Hash): 述語key?,value?,include?の追加
-
- * eval.c (rb_eval): unlessでelse節が実行されない(うーん)
-
- * string.c (str_sub_iter_s): イテレータブロック内でマッチが行われ
- ると位置がずれる(時に無限ループに落ちる)
-
- * string.c (str_resize): lenが0の時sizeの調整が行われなかった
-
-Thu Nov 28 00:59:54 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961128
-
- * parse.y (parse_string): 3-quote styleの文字列(例:"""abc"d"e""")
-
- * configure.in (EXTSTATIC): extを静的にリンクする時にはrubyはdllを
- 使うように
-
- * io.c (Init_IO): getsの引数が間違っていた
-
- * string.c (str_each_line): RSを明示的に指定できるように
-
-Wed Nov 27 12:37:46 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961127
-
- * eval.c (rb_eval): iver defined? でselfを指定するのを忘れた
-
- * io.c: gets等でRSを明示的に指定できるように
-
- * ext/extmk.rb.in (install): static linkに失敗
-
-Tue Nov 26 10:33:04 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961126
-
- * string.c (str_sub_s): 置換後の文字列長さが間違っていた
-
-Mon Nov 25 09:11:22 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * numeric.c (fix_rshift): 32以上の右シフトで0を返すように(Cの
- rshiftは(x>>(y%32))を返していた).
-
- * string.c (str_gsub): 置換が行われない場合があった
-
- * string.c (str_resize): 本当に必要な時だけrealloc
-
-Thu Nov 21 04:13:21 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * configure.in (EXTSTATIC): --with-static-linked-extで全てのモジュー
- ルを静的リンクするように
-
- * pack.c (pack_unpack): 行末の改行がない時にもチェックサムをスキッ
- プするように
-
-Wed Nov 20 21:42:51 1996 Yasuo OHBA <jammy@shljapan.co.jp>
-
- * configure.in: freebsd対応
-
-Wed Nov 20 10:24:24 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/extmk.rb.in (install): 通常リンク用のLDFLAGSとダイナミックリ
- ンク用のDLDFALGSを分離
-
- * ext/extmk.rb.in (install): コンパイルの成功したものを静的リンク
- のリストに追加する
-
- * eval.c (f_missing): オブジェクトの文字列表現が長すぎる時バッファ
- を書き潰していた
-
- * process.c (proc_exec_v): forkした後例外を発生させてはいけない
-
-Tue Nov 19 13:28:15 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961119
-
- * eval.c (mod_method_defined): Module#method_defined? の追加
-
- * parse.y (call_args): 引数が唯一のコマンドコールである時のバグ(戻
- り値が展開されてしまう)
-
-Mon Nov 18 13:28:18 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_sub): 失敗した時にnilを返していた
-
- * string.c (str_split_method): 検索開始位置が移動してなかった
-
- * ext/socket/socket.c (sock_s_getservbyaname): まだ間違っていた
-
- * version 0.99.3-961118
-
- * string.c (str_sub_s): 元の文字列を置換するのを止めた
-
- * pack.c (encodes): 領域外をアクセスしていた
-
-Fri Nov 15 17:10:35 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * bignum.c (big_divmod): Bignumが引数の場合の対応忘れ
-
- * sample/ruby-mode.el (ruby-expr-beg): word?形式への対応が不完全
-
-Wed Nov 13 15:42:40 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_tr_s_bang): tr_sでtrが行われていなかった
-
- * eval.c (rb_eval): autoloadクラスのチェック
-
- * string.c (f_sub): subがsub!と同じ動作になっていた
-
- * eval.c (thread_sleep): stopとsleepの分離
-
-Mon Nov 11 13:53:19 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961111
-
- * numeric.c (fix_step): to, stepが整数以外の場合に対応
-
- * eval.c (rb_call): dynamic varがdynamic scopingになっていた(これ
- はまずい)
-
- * string.c (str_chop_bang): 長さ0の文字列のchopで,領域外のアクセ
- スが発生していた.
-
- * parse.y (yyerror): 割り当てた領域外をアクセスしていた
-
-Fri Nov 8 11:54:46 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_yield): scopeをheapにコピー
-
-Thu Nov 7 09:56:53 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * numeric.c (num_coerce): とりあえず両辺をFloatに変換することに
-
-Wed Nov 6 10:45:13 1996 Yasuo OHBA <jammy@shljapan.co.jp>
-
- * lib/parsearg.rb: 第2引数を変更.
-
-Tue Nov 5 14:21:09 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961105
-
-Sat Nov 2 01:11:40 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * bignum.c (big_pow): typo (dy -> dx)
-
- * bignum.c (big_divmod): 知らない型はfloatに変換してみる
-
- * numeric.c (fix_lshift): 境界条件のバグ(負になっていた)
-
- * bignum.c (big_pow): 無駄なfloatへの変換をなくした
-
- * math.c (math_atan2): typo(x -> y)
-
-Fri Nov 1 15:30:59 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/socket/socket.c (sock_gethostname): gethostnameがない時には
- unameを使ってホスト名を得る
-
- * ext/etc/etc.c (etc_getlogin): getloginがNULLを返しても環境変数を
- 調べるように
-
- * object.c (krn_clone): オブジェクトのフラグもコピー
-
- * hash.c (rb_cmp): ハッシュの比較を`=='でなく`eql?'に変更
-
- * math.c (Need_Float): Float()を使って変換する
-
- * compar.c (cmp_gt): 以前の右辺を返す仕様の名残が残っていた
-
-Thu Oct 31 12:55:51 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961031
-
- * numeric.c (Init_Numeric): typo
-
- * eval.c (error_print): 長すぎるtrace backを途中省略する
-
- * regex.c (re_compile_pattern): 全角のrangeに対応
-
-Wed Oct 30 03:03:18 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.3-961030
-
- * io.c (f_ungetc): 関数を追加
-
- * eval.c (dyna_var_asgn): return値忘れ
-
-Tue Oct 29 10:05:28 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (f_split): 関数splitを追加
-
- * eval.c (rb_call): ネストした外側のクラス/モジュールの定数を参照
- できるように
-
-Mon Oct 28 09:51:03 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_sub): offsetが文字の末尾にある時のチェック
-
- * regex.c (re_match): 割り当てるレジスタの数が1多かった
-
- * io.c (io_gets): $/ = ""の動作をperlに合わせる(awkとはちょっと違
- うらしい)
-
- * io.c (io_gets): $/ = nilの時少し高速化
-
- * string.c (str_split_method): 括弧がnullにマッチした時にも無視し
- ないように
-
- * string.c (str_split_method): 括弧にマッチした分はlimitの数に含め
- ないように.
-
- * numeric.c (num_coerce_bin): coerceの定義を変更,2要素の配列
- [x,y]を返すように
-
- * sample/ruby-mode.el (ruby-calculate-indent): "do |aa|"の対応を改
- 善した.
-
-Sat Oct 26 01:43:51 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/marshal/marshal.c (w_object): ビルトインクラスのサブクラスを
- 正しく復旧できるように
-
- * ext/marshal/marshal.c (w_object): ユーザ定義dumpの優先
-
- * numeric.c (flo_coerce): Float()を使って定義
-
- * numeric.c (Init_Numeric): Numericのnewのundefはまずい
-
- * ext/marshal/marshal.c (w_symbol): シンボルの内容(文字列)は一度し
- かファイルに書き出さない.
-
- * sample/ruby-mode.el (ruby-parse-region): if/while修飾子に対応し
- なくなっていた
-
- * bignum.c (Init_Bignum): Bignum.newを除く
-
- * eval.c (rb_eval): 引数評価後にファイル名と行番号を再設定
-
- * numeric.c (flo_div): typo
-
- * sample/ruby-mode.el (ruby-parse-region): def /, def `に対応
-
-Fri Oct 25 09:26:29 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-calculate-indent): "do |aa|"に対応
-
- * array.c (ary_aset): indexがfixnumの場合ちょっと高速化
-
- * eval.c (thread_fd_writable): 書き込み前のselectチェック
-
- * array.c (ary_assoc): 無限ループに落ちた
-
- * eval.c (thread_wait_for): selectがエラー終了した時,linux以外で
- の動作が正しくなかった.
-
-Thu Oct 24 08:26:48 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (backtrace): `$@'を文字列から配列に変更した.
-
- * eval.c (eval): eval中の例外発生位置を保存する
-
- * bignum.c (bigsub): オペランドの大小比較の失敗
-
- * re.c (reg_search): 直接参照がない時にも`$~'がセットされるように
-
-Wed Oct 23 10:40:10 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-961023
-
- * ext/marshal/marshal.c (r_bytes): mallocをやめ,allocaを使う
-
- * sample/ruby-mode.el (ruby-calculate-indent): 括弧の対応を変更.
- ()内ではインデントをレベルを合わせるように
-
-Tue Oct 22 12:59:11 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * hash.c (hash_s_new): sizeを指定できるように
-
- * ext/marshal/marshal.c (w_object): dumpする深さ制限を指定できるよ
- うに
-
- * array.c (ary_s_new): sizeを指定した時の初期化忘れ
-
- * object.c (f_float): big2dblの宣言忘れ.
-
- * bignum.c (bigsub): 大きさの近いBignum同士の演算で結果が負になる
- 場合に間違いがあった.
-
- * array.c (ary_aset): 置換先と置換元が同じ長さの時内容を
- shift(memmove)しないように.
-
- * ext/marshal/marshal.c (marshal_dump): ファイルフォーマットにバー
- ジョンを埋め込むように
-
- * ext/marshal/marshal.c (tmpnam): linux-aout-dln用に定義
-
-Mon Oct 21 08:40:20 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/socket/socket.c (sock_s_gethostbyname): hostent構造体の情報
- を返す
- (sock_s_gethostbyaddr): IPアドレスからhostent構造体を得る
- (sock_s_getservbyaname): getservbyname(3)
-
-Fri Oct 18 10:37:36 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-indent-to): 移動先カラムが負になるバグ
-
- * eval.c (compile): evalで元ソースの行番号でエラーを表示する
-
-Thu Oct 17 09:52:28 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (eval): evalで文法エラーがあった時にSEGV
-
- * lib/safe.rb: Restricted.evalの中だけ制限を加える.
-
- * eval.c (error_print): バックトレースの出力.callerで例外発生位置
- を調整した時に問題が出る(そんなことをしなければ良いのだが…)
-
- * eval.c (make_backtrace): バックトレースの生成
-
-Wed Oct 16 12:56:22 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby-man-0.99.2-jp/index.html: 日本語版ドキュメントの完成(長かった…)
-
- * re.c (reg_regcomp): $=がnilの時の処理
-
- * string.c (f_chop): $_に対するchop
-
-Tue Oct 15 11:04:23 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-961015
-
-Mon Oct 14 18:22:38 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_schedule): BOW対応.selectが-1を返した時にバグ(実
- はdo .. whileがcontinueで先頭にジャンプすると思い込んでいた.条
- 件の直前だったのね ^^);;;;;
-
- * sample/ruby-mode.el (ruby-mode-syntax-table): ?のsyntaxが"/"では
- まずいらしい
-
- * hash.c (rb_hash): name conflict
-
-Fri Oct 11 00:23:05 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-961011
-
- * ext/marshal/marshal.c (w_object): 結局動いていなかった循環オブジェ
- クト対応を外した.
-
- * hash.c (rb_hash): Fixnumと文字列の高速化
-
- * ext/marshal/marshal.c (w_object): 無駄なデータの削除(フォーマッ
- トの非互換性)
-
- * io.c (io_readline): 戻り値の不備
-
- * ext/marshal/marshal.c (marshal_dumps): MSDOS対応
-
- * ruby.c (load_file): MSDOS対応
-
-Wed Oct 9 17:46:27 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/extmk.rb.in (install): 無駄なコピーを避ける
-
- * string.c (str_sub_method): マッチがなかった時のString#subの値が
- 違っていた.
-
- * eval.c (obj_extend): extendした時にobject_extendedを呼ぶように
-
-Tue Oct 8 00:55:38 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_alloc): 割当の平均化
-
- * eval.c (thread_schedule): joinのバグを修正
-
- * eval.c (thread_wait_for): selectへの割込みなどに対応
-
- * eval.c (thread_select): linuxのselectの挙動に対応(timeoutが変化
- する)
-
-Mon Oct 7 09:47:19 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-961007
-
- * eval.c (PUSH_BLOCK): the_classの保存を忘れていた.
-
- * ext/dbm/dbm.c (fdbm_store): sizeの保存する場所が間違っていた
-
- * ext/socket/socket.c (s_accept): thread対応していなかった
-
-Sat Oct 5 01:32:27 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (io_readchar): EOFで例外を発生させる
-
-Fri Oct 4 11:59:54 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/marshal/marshal.c (w_object): HashとObjectの復旧に必要なハッ
- シュテーブルが渡されていなかった.
-
- * variable.c (rb_path2class): ユーザ定義クラスの復旧に失敗していた
-
- * variable.c (rb_path2class): クラスが存在しない時のエラーをFatal
- からNameErrorへ.
-
- * range.c (range_s_new): first,lastが両方Numericの時エラーになって
- いた.
-
- * range.c: start->first, end->last
-
-Wed Oct 2 02:02:46 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c: DJGPPでchmod,chownを使えるように(ってDOSにchownがあるのか?)
-
- * class.c (rb_singleton_class): ビルトインクラスもextendしたり特異
- メソッドを追加したりできるように
-
- * variable.c (rb_set_class_path): ユーザ定義のトップレベルクラスに
- pathを設定しない
-
- * eval.c (eval): 例外がRuntimeErrorに化けていた
-
- * eval.c (eval): eval中の例外の表現の改善
-
- * eval.c (eval): eval_with_bindingとの一本化
-
- * eval.c (rb_eval): クラス/モジュール定義の中から定義中のクラス/モ
- ジュールが参照できるように
-
-Tue Oct 1 01:40:09 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-961001
-
- * parse.y: cur_crefが2度宣言されていた
-
- * signal.c (trap): SIGSEGV,SIGBUSのない機種に対応
-
- * io.c (Init_IO): 引数タイプの指定間違い
-
-Mon Sep 30 15:28:00 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-960930
-
- * config.guess,config.sub: $host_osが正しく設定されない
-
- * eval.c (rb_eval): yieldで正しくないselfが設定されていた
-
- * eval.c (ruby_run): toplevelの例外処理のバグ
-
-Mon Sep 30 09:13:26 1996 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * djgpp対応
-
-Sat Sep 28 02:45:10 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-960928
-
- * sample/ruby-mode.el (ruby-beginning-of-block): ブロックの先頭に
- 移動(正しくインデントしていないと動作しない)
- (ruby-end-of-block): 同上
-
- * eval.c (class_s_new): Class#newがイテレータとして呼ばれた時は
- initializeもイテレータとして呼ばれるように
-
- * signal.c (sigsegv): SEGVでbacktraceを表示するように
-
-Fri Sep 27 09:51:07 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-960927
-
- * eval.c (error_print): 引数のないraiseでメッセージが正しく表示さ
- れるように.
-
- * eval.c (rb_longjmp): mesgがnilの時RuntimeErrorを生成する.
-
- * eval.c (f_raise): 引数がない時に対応
-
- * eval.c (thread_mark): stack上にないデータのアドレス変換を行って
- いた.
-
- * eval.c (Init_Thread): 割込みの間隔が1秒と長すぎた.
-
-Thu Sep 26 16:02:45 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_schedule): 一度ペンディングになるとフラグがクリア
- されていなかった.
-
- * process.c (rb_proc_exec): system/execの引数が空文字列であった場
- 合,例外を発生すべきだった.
-
- * config.sub/config.guess: 新しいものに置き換え
-
-Thu Sep 26 15:41:35 1996 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * io.c (next_argv): -i.bakをBOWとDOSに対応.
-
-Thu Sep 26 01:31:43 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (io_sysread): EOFで例外
-
- * io.c (f_readline): EOFで例外を発生するように.getsは互換性のため
- nilを返すままにする
-
- * eval.c (proc_call): lambdaからのreturnでIN_BLOCKフラグが立ったま
- まだった
-
- * eval.c (PUSH_BLOCK2): threadに対応するためBlockを一度stackにコピー
-
-Wed Sep 25 11:54:11 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (method_call): Const::method()形式を使えるようにしてみた.
- 引数括弧は省略できない.
-
- * sample/test.rb: Process.killの存在を確かめてからテストを行う
-
- * eval.c (eval_with_binding): 第2引数としてbinding(またはlambda)を
- 与えるとその環境でevalを実行するようにした
-
- * eval.c (f_binding): 現在のbindingを返す関数
-
- * eval.c: block構造体にthe_classを保存するメンバを追加
-
- * process.c (Init_process): kill,wait,waitpidをProcessに移動
-
-Tue Sep 24 02:44:43 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el: いろいろ問題が多いので以前の高速化は破棄.
- 別のアプローチを使った.
-
- * lib/tk.rb (Tk.pack): 複数のウィンドウを受け付けるpack
-
-Sat Sep 21 11:08:09 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (exprs): 空文も受け付けるように文法を変更.今までは改行
- の連続だけが許されていた.
-
-Fri Sep 20 11:39:18 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * Failの大半を名前つき例外に変更.
-
- * re.c (Init_Regexp): 名前つき例外を導入.
-
- * eval.c (f_missing): Objectはinspectしない.
-
- * object.c (inspect_i): Object#inspectでloopに対応.
-
- * regex.c (re_search): /^$/が""にマッチしなかった.
-
-Thu Sep 19 19:25:12 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * regex.c (re_search): /^$/が非空行にマッチしていた.
-
-Tue Sep 17 10:28:11 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-960917
-
-Mon Sep 16 10:47:56 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-calculate-indent): 演算子継続の場合の
- 文字列の判定のバグ
-
- * sample/ruby-mode.el (ruby-calculate-indent): elseなどの次の行の
- インデント計算を正しく.
-
-Sat Sep 14 08:37:19 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.2-960914
-
-Fri Sep 13 08:06:03 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/socket/socket.c (tcpaddr): port番号にntohsをつけ忘れ
-
- * dln.c (link_undef): テーブルの種類が間違っていた.
-
- * bignum.c (bigadd): 引き算が発生する時に計算違いが起きていた.
-
- * parse.y (iter_do_block): do..endでもdynamic variableを.
-
- * bignum.c (big_pow): より正確な計算を(整数同士ではfloatに変換しな
- い).
-
-Thu Sep 12 13:11:55 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * variable.c (rb_set_class_path): Stringクラスが初期化される前に
- Stringを作っていた.組込みクラスにはpathはいらない
-
- * parse.y (yylex): 0.1が0になっていた
-
- * parse.y (yylex): 行番号の不整合
-
- * gc.c (oblist_live_obj): 今「生きている」全部のオブジェクトを返す
- イテレータ.そのクラス(またはサブクラス)の全部のインスタンスを返
- すeach_object_ofも定義した.
-
- * class.c (rb_define_class_id): 無駄なクラスを割り当てていた.結果
- として未初期化のクラスオブジェクトが存在していた.
-
-Wed Sep 11 00:56:23 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (yylex): octalの定数の検出をより正確に(090はエラーとか).
-
- * bignum.c (big_minus): yがxより大きい場合にエラー.
-
- * parse.y (yylex): エラー行番号の表示をより正確に
-
- * sample/ruby-mode.el (ruby-expr-beg): 変数名が1文字の時誤動作して
- いた.
-
- * sample/ruby-mode.el (ruby-calculate-indent): ?/でループに落ちい
- たバグを修正.
-
- * enum.c (enum_min,enum_max): sortのようにイテレータとしても動作す
- るように.
-
- * enum.c (enum_find_all): typo
-
-Tue Sep 10 12:07:12 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * node.h (nd_line): NODEのlineをflagsに押し込めてオブジェクトサイ
- ズを小さくした.制限:32bit intのマシンの場合,ファイルの行数が
- 32767を越えると正常に表示されない.
-
- * st.c: hashとcompareの関数メンバを構造体にパック,クラス的な使い
- 方を行う.1 tableあたり4 byteの節約.
-
-Mon Sep 9 16:35:54 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_truncate): 提供されない時には特別な例外を発生するよ
- うに.
-
- * eval.c (Init_Proc): 不適切な位置のlocal-jumpを例外に.
-
-Sat Sep 7 17:06:15 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (proc_call): まだスコープがスタック上にある時には局所脱出
- を有効にする.これで,procを生成してcallすることは,スコープを脱
- 出しない限り,yieldと同じ意味を持つことになる.
-
-Fri Sep 6 13:30:59 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-indent-to): インデントが変わらない時に
- はバッファを変更しない.
- (ruby-calculate-indent): まず文字列の内部か判断してから,前の行
- からパーズを行う.defunが大きくなった時の高速化.
- (ruby-in-string-p): 文字列の内部かどうかを判断する関数(以前の
- parseから分離)
- (ruby-parse-region): 文字列に対する処理をはずす.
- (ruby-beginning-of-block): ブロックの先頭に
- (ruby-end-of-block): ブロックの末尾に(遅い…)
-
-Thu Sep 5 14:23:07 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_s_split): [dirname,basename]にsplitする.
-
- * eval.c (rb_eval): evalの中でも定数の値が正しくなるように.これで
- 定数に関しては静的なスコープが保証されるようになった.
-
- * st.c (rehash): ハッシュ拡大の系数を2から1.79に.割算がより良い値
- を返すように.
-
-Thu Sep 5 00:32:07 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (class_superclass) クラスのスーパークラスを返すメソッド.
-
-Wed Sep 4 16:54:56 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * random.c (f_rand): Bignumやlongの範囲を越えるFloatに対する乱数も
- 発生できるように.
-
- * struct.c (struct_alloc): Fatalではなく例外を発生させるように(通
- 常の使用で発生しうる).
-
- * struct.c (struct_s_members): Structの特異メソッドではなく,生成
- されたStructクラスの特異メソッドにした.
-
- * st.c (st_init_table): ruby専用にパラメタを固定にした(サイ
- ズが減った)
-
-Mon Sep 2 11:37:59 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * array.c (ary_shift): capaがあまりにも大きい時には領域をREALLOC
- (ary_pop): 同上
-
- * string.c (str_inspect): multibyte character 対応にミス.
- (str_inspect): unsigned charにしないと符号展開されてしまう
-
- * parse.y (primary): `::'をprimaryに移動 Foo::Bar.Bazがエラーにな
- らないように.
-
- * parse.y (primary): オペレータ形式の特異メソッドが定義できない
-
- * random.c (f_rand): maxが0の時に対応
-
- * io.c (io_printf): 関数を定義していたがインタプリタに登録していな
- かった.
-
- * file.c (file_s_basename): 第2引数が無い時にエラー.
-
-Thu Aug 29 10:49:40 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (expr): イテレータの新形式に「method do .. end」形式を採
- 用した.もちろん昔の形式も有効.
-
- * sample/ruby-mode.el (ruby-calculate-indent): endの数の方が多い場
- 合にもエラーを起こさないように.
-
-Wed Aug 28 09:41:36 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * numeric.c (upto,downto,step,times): 対象がfixnumの範囲を越えても
- 動作するように.
-
-Mon Aug 26 10:04:37 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * missing/setenv.c (envix): typo(missing `== 0' for memcmp)
-
- * dir.c (dir_foreach): foreach(dir open -> read loop -> closeまで)
-
- * io.c (io_foreach): foreach(file open -> read loop -> closeまで)
-
- * Fatalのうち捕捉可能ないくつかを例外に.
-
-Sat Aug 24 23:56:37 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * bignum.c (bigdivmod): FIX2INT -> INT2FIX 大間違い
-
-Fri Aug 23 18:13:03 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * regex.c (re_free_registers): allocateしていない時には当然 free
- してはいけない.
-
-Thu Aug 22 01:20:35 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_create): 外側から強制終了させられたthreadは
- cleanupする必要が無い.
-
-Wed Aug 21 09:57:28 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_create): threadを終了させた大域脱出の情報を
- main_threadに渡すように.
-
- * parse.y (call_args): 最終引数に括弧を省略したメソッド呼出しを置
- けるように(例: print foo bar, baz == print(foo(bar,baz)))
-
-Tue Aug 20 13:37:16 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (masign): 多重代入とrest引数の動作を合わせて空の配列を代
- 入するように.
-
- * parse.y (arg): defined?の強度をもうちょっと強く
-
- * eval.c (error_print): -wで例外名も表示するように
-
- * eval.c (rb_eval): 新構文に対応
- (handle_rescue): 捕捉する例外を kind_of? で同定
-
- * parse.y (primary): rescueの構文を変更(同定引数の追加,複数rescue)
-
- * Fail()のかなりを適当な例外を使うように
-
- * eval.c (thread_interrupt): Interrupt(今はnon-local jump)は
- main-threadに送られるように.
-
- * eval.c (rb_longjmp): $! の内容を文字列から例外クラスに変更
- (rb_raise): rb_fail から名称変更
- (rb_interrupt): 例外化
- (rb_exit): 例外化
-
- * error.c (Init_Exception): 例外クラスの新設(文字列のサブクラス)
-
-Mon Aug 19 19:40:52 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * signal.c (trap): 古いハンドラを返すように.
-
-Wed Aug 14 00:07:18 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_trap_eval): ハンドラのためにthreadをforkすることを止
- めた.
-
- * eval.c (thread_mark): thread毎の $!, $@ をマークし忘れ
-
- * ext/dbm/dbm.c (fdbm_delete): イテレータとして呼ばれた場合,要素
- が無ければブロックを評価する.
-
- * hash.c (hash_delete): イテレータとして呼ばれた場合,要素が無けれ
- ばブロックを評価する.
-
- * array.c (ary_delete): イテレータとして呼ばれた場合,要素が無けれ
- ばブロックを評価する.
-
- * eval.c (rb_interrupt): SIGINTのデフォルトをexitから特別な大域脱
- 出に.やはり割り込まれた位置の表示が無いのは寂しいので.
-
-Tue Aug 13 01:34:00 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_exit): sub-thread内でのexitもstatusを保存するように
- (thread_create): 自thread内のexitに対応
-
- * signal.c (sighandle): SIGINTのデフォルトハンドラはexitするように
- (以前は例外を発生していた).
-
- * 例外の一部をFatalに.
-
- * string.c (str_aset): 文字列の置換の対象が部分文字列でなかった時,
- 例外を発生させないように
-
- * eval.c (proc_call): Procの中からbreak/nextは通し,他のものは通さ
- ないように
-
-Mon Aug 12 14:15:09 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (krn_type): 文字列を返す
-
- * eval.c (thread_create): sub-thread内でのexitに対応
-
- * numeric.c (fix_type): 文字列を返す
-
- * io.c (f_p): デバッグ用データ表示メソッド
-
- * eval.c (f_missing): nil/TRUE/FALSEを特別扱い
-
- * string.c (str_inspect): 長い文字列を短縮表示.inspectの働きを
- human readable stringの生成に統一(re-generatable string は正式に
- 無くなった).
-
-Sat Aug 10 16:54:21 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (Init_Object): kernel/nil/false/trueのクラス名を変更(小
- 文字に),rubyスクリプトからアクセスできないように.
-
- * eval.c (rb_eval): CONSTANTのアクセス先を単純化.crefを使わない.
-
- * eval.c (f_eval): 特異メソッド内でも定数の値が正しくなるように
-
-Fri Aug 9 12:23:17 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * array.c (ary_concat): append -> concat Stringに合わせた
-
- * parse.y (yylex): `$;'が使えなかった.
-
- * array.c (ary_push_method): 複数引数を受け付けるように.
- (ary_unshift): 複数引数を受け付けるように.
-
- * io.c (io_popen): IO.popenでcommand pipeが開けるように.
-
- * object.c (Init_Object): KernelとNilをruby scriptからアクセスでき
- ないように.
-
-Thu Aug 8 01:21:47 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (f_integer): 整数への変換関数
- (f_float): 実数への変換関数
- (f_string): 文字列への変換関数
- (f_array): 配列への変換関数
-
- * bignum.c (big_to_i): FIXNUMの範囲でない時はBignumのまま返すよう
- に変更.
-
-Wed Aug 7 09:28:38 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99.1-960807
-
- * parse.y (mlhs): 「*foo = 1,2,3」タイプの多重代入も可能に.
-
- * object.c (Init_Object): クラスTrue/Falseをruby scriptからアクセ
- スできないように.
-
- * object.c (nil_inspect): inspect表現は"nil"に
-
- * io.c (io_print): nilのprintをnilに.
-
- * object.c (nil_to_s): nilの文字列表現を""に.
-
-Tue Aug 6 01:12:32 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * dir.c (dir_s_open): file descripterが足りない時にはgcしてからも
- う一度openしてみる.
-
- * io.c (rb_fopen): すべてのfopen()についてfile descripterが足りな
- い時にはgcしてからもう一度openしてみる.
-
- * ext/socket/socket.c (Init_socket): 定数の追加.
-
- * sample/ruby-mode.el (ruby-indent-to): インデント後のカーソル位置
- の調整を正しく.
-
- * gc.c (gc): 割込みチェックを行わない(Cコードの中で安心して
- malloc()が使えなくなるので).
-
- * st.c (call_hash_func): signalとthreadによる割込みに対応.
-
- * sig.h (DEFER_INTS): 割込み禁止区間の指定
-
- * eval.c (f_require): threadによるrequireの競合に対応(最初の
- requireが終了するまで他のthreadは待つ).
-
- * bignum.c (str2inum): 0x80000000の値が負になっていた
-
- * sprintf.c (f_sprintf): 文字列末尾,行末の単独の`%'に対応
-
- * bignum.c (big_cmp): 比較の結果が逆になる時があった.
-
-Mon Aug 5 10:58:13 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * process.c (proc_exec_v): 例外のメッセージを分かりやすく.
-
- * ext/dbm/dbm.c (fdbm_store): nilを格納すると要素の削除になる
-
- * ext/dbm/dbm.c: サイズをキャッシュ.
-
-Sat Aug 3 01:52:52 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_fail): `fail'が引数無しで呼ばれた時だけ以前の`$@'を保
- 存するように.
-
- * eval.c (f_fail): frameの調整
-
-Fri Aug 2 11:26:21 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/socket/socket.c (bsock_setopt): valとしてTRUE/FALSE/Fixnumも
- 受け付けるように.
-
- * ext/socket/socket.c (Init_socket): SO_REUSEADDR等の定数の追加
-
- * ext/md5/md5init.c: md5モジュール(初の複数ファイルからなるモジュー
- ルでもある)
-
- * ruby.h (Make_Data_Struct): Data: objectのinstance変数に格納 ->
- Data型のObjectに(Dir,Time,Proc,Thread,DBM)
-
-Thu Aug 1 11:38:44 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/dbm/dbm.c (fdbm_store): valueが文字で無い時に対応
-
-Wed Jul 31 10:53:42 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/socket/socket.c (open_inet): htonsが必要であった
- (tcpaddr): ntohlで変換した
-
- * process.c (rb_proc_exec): execvp -> execv
-
-Tue Jul 30 17:48:33 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c: `$?'をthread localに
-
- * Makefile.in (install): install時にstripを行う
-
- * configure.in: install時のstripの検出
-
- * configure.in: NEXTSTEP対応
-
- * version 0.99.1-960730
-
-Tue Jul 30 16:40:35 1996 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
-
- * dln.c (dln_load): NeXT dln(mach-o)対応.configureは未対応
-
-Tue Jul 30 09:46:51 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * process.c (f_system): 複数引数もとれるように
-
- * process.c (f_exec): 複数引数もとれるように
-
- * array.c (ary_append): 配列(またはEnum)の要素を破壊的に追加
-
- * array.c (ary_plus): Enumはその要素を追加
-
- * file.c (file_s_open): File.openを追加
-
- * struct.c (struct_new): FIX2INTを忘れていた
-
- * file.c (Init_File): exists? -> exist?
-
- * object.c (obj_is_kind_of): is_kind_of? -> kind_of?, is_a?
-
- * object.c (obj_is_instance_of): is_instance_of? -> instance_of?
-
-Mon Jul 29 16:40:02 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (parse_regx): 式展開を行った場合,casefoldの設定ができて
- いなかった.
-
- * object.c (true_type): TRUE/FALSEにtypeを実装.
-
- * parse.y (read_escape): 3文字以内のoctalに対応(\0とか)
-
-Fri Jul 26 00:31:45 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * array.c (ary_reverse_bang): in-placeで配列を反転させる
- (ary_sort_bang): in-placeでsortする
- (ary_sort): sortした配列を返すように
- (ary_delete_at): 指定した位置の要素を削除する
-
- * eval.c (rb_call): stack深さチェックを毎回は行わないように
-
- * error.c (Warning): 実行中のwarningが表示されていなかった
-
- * eval.c (compile): 例外発生を分離.
-
- * eval.c (f_eval): 変数rb_in_evalを正しく管理するように
-
- * ext/dbm/dbm.c (fdbm_store): 格納するkeyを文字列に変換
-
- * eval.c (rb_call): 無限再帰のチェックを大域脱出を行うC methodにも
- 対応させた.threadのstack深さチェックルーチンを流用.
-
- * parse.y (yylex): 第1引数のunary -/+の判定が間違っていた.
-
- * parse.y (yylex): unary +で数字を余計に読んでいた(ex. +5 -> 55)
-
-Thu Jul 25 12:15:04 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (yylex): 曖昧でない引数に対して警告を出していた.
-
- * eval.c (iterator_p): 引数で呼んでも正しい結果を返すように.
-
- * parse.y: break/next/redo/retryのメソッド化.
-
- * sample/ruby-mode.el (ruby-calculate-indent): nestのチェックミス
-
- * sample/ruby-mode.el (ruby-parse-region): 予約語のチェックを強化
-
- * parse.y (primary): unless/untilの復活
-
-Tue Jul 23 18:50:10 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * array.c (Array#empty?), Hash.c (Hash#empty?), ext/dbm/dbm.c (DBM#empty?):
- 空の判定述語
-
- * eval.c (f_unless): ifの逆をするイテレータ
-
- * eval.c (f_until): whileの逆をするイテレータ
-
- * parse.y: notの優先順位をand/orより高く
-
- * parse.y (expr): `!'を引数括弧を省略したcallでも有効に
-
-Mon Jul 22 10:15:38 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960722
-
- * array.c (ary_print_on): OFSのNILチェックが不完全
-
- * ruby.c (load_file): 標準入力からのスクリプトが空の時に対応.
-
- * ruby.c (proc_options): -wでは引数無しの時には標準入力からスクリ
- プトをとる(-vではたんに終了する).
-
- * array.c (ary_compact): nilの要素を取り除くメソッド
-
- * array.c (ary_nitems): nilでない要素を数えるメソッド
-
-Sun Jul 20 00:51:53 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c (proc_options): -w optionを追加
-
- * parse.y: {}が閉じていない時には展開しない文字列を
-
-Fri Jul 19 16:16:05 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960719
-
- * lib/find.rb: 石塚版(pruneの拡張付き)
-
- * file.c (test_l): lstatで調べないとね.
-
- * eval.c (f_throw): 第2引数を省略可能に.
-
- * parse.y (str_extend): {}のネストに対応
-
-Thu Jul 18 18:25:46 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960718
-
- * parse.y (str_extend): 文字列中の式展開に \" ' ` / を含む事ができ
- るように.
-
-Tue Jul 16 15:55:31 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-parse-region): 正規表現内のエスケープ
- に対応
-
- * version 0.99-960716
-
-Fri Jul 12 10:06:19 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (f_select): 引数のclose check.
-
- * ruby.c (load_file): #!行の引数チェックを第1引数に限定(実をいうと
- DOS改行対策)
-
-Wed Jul 10 17:18:35 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960710
-
- * time.c (time_s_timegm/time_s_timelocal): 時間を生成するメソッド
-
-Mon Jun 17 15:59:20 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960617
-
- * parse.y (yyerror): エラー表示の簡略化.
-
-Wed Jun 12 14:11:01 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * signal.c (rb_trap_exit): trap 0はthreadを生成せずに処理する.
-
-Fri Jun 7 10:17:01 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * array.c/hash.c (indexes): 配列1引数のパターンを無くした.配列の
- 場合は`*ary'を使ってもらおう.
-
- * eval.c (thread_wait_threads): main_threadが終了する前に他の
- threadを待つ(強制的には終了させない).
- (ruby_run): 他のthreadを待っている間にシグナルが来たら,全thread
- を強制終了させる.
-
- * eval.c (rb_fail): メソッド名を`$!'に埋め込む.
-
- * eval.c (thread_create): main_threadのコンテクストがセーブされな
- い場合があった.
-
- * process.c (f_sleep): 時間を指定せず,threadがひとつしかない状況
- にも対応.
-
- * eval.c (thread_create): create後,fnを呼び出す前にcontext switch
- が起きると違うcontextでfnが実行されてしまうバグ.
-
-Mon Jun 3 08:03:17 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * struct.c (struct_s_def): メンバの指定を文字列,シンボル(FIXNUM)
- 双方で可能にした.
-
- * ext/etc/etc.c (Init_etc): 構造体オブジェクトをGCから保護した.
-
- * error.c (rb_sys_fail): nil/FALSEを引数として受け付けるように.
-
-Thu May 30 16:19:08 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_select): EINTRに対応.
-
-Wed May 29 11:04:51 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (f_catch): catch/throwを実装した.
-
-Tue May 28 13:30:52 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960528
-
- * eval.c (thread_cleanup): main threadが終了すると他のthreadも終了
- することの明確化.
-
- * signal.c (trap): SIGINTのデフォルトの設定ミス(本当にSIG_DFLでは
- まずかった).rubyではちゃんとハンドルしないと.
-
- * eval.c (thread_interrupt): SIGINTはmain_threadに例外を発生させる
- ように.
-
-Mon May 27 15:13:31 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_status): threadの状態を返すメソッド.threadの終了
- を待たない.
-
- * eval.c (thread_value): 一種のpromiseを実装するためのメソッド.
-
- * eval.c (thread_join): 待っているthreadが例外を起こした時には,
- joinがその例外を発生するように.
-
- * eval.c (thread_create): threadでの例外をpropagateしないように.
-
-Fri May 24 10:47:53 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * enum.c (Init_Enumerable): `size' as alias to the `length'
-
- * eval.c (thread_save_context): `$@', `$!'をスレッド毎にセーブ.
-
- * eval.c (superclass): エラー表示をより親切に.
-
-Thu May 23 10:38:41 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.99-960523
-
- * eval.c (superclass): エラー時にスーパークラス名を(分かれば)表示
- するように.
-
-Wed May 22 19:48:42 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (superclass): スーパークラスの指定子を`:'から`<'に変更.
-
-Tue May 21 09:27:59 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/thread.rb: threadをサポートするクラス(Mutex, Queue).
-
-Mon May 20 09:39:49 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * time.c (time_cmp): 浮動小数点数も扱えるように.
- (time_minus): Time - Timeが浮動小数点数を返すように.
-
-Fri May 17 15:40:10 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * process.c (rb_proc_exec): Thread対応時にexecの直前に
- ITIMER_VIRTUALをリセットする.
-
-Tue May 14 02:12:44 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * signal.c (sighandle): SIGINTに対してデフォルトで例外を発生させる
- のをやめ,status 130でexitするようにした.
-
- * eval.c (thread_schedule): Threadのバグはほとんどとれたようだ.
-
-Fri May 10 11:21:08 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (thread_schedule): ユーザレベルThread機能.効率はともかく
- 移植性はある.今後,thread間の通信機能を実装する予定.
-
-Thu May 2 21:22:31 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * time.c (time_timeval): struct timevalを直接返すように(static変数
- を使わない).
-
-Wed May 1 17:27:32 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * process.c (f_sleep): 整数以外のtimeを指定できるように.
-
-Thu Apr 25 08:19:15 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (file_s_dirname): ファイル名が"/"を含まない時,"."を返す
- ように(GNU dirnameの仕様).
-
- * file.c (file_s_basename): まだnilと0を混同しているソースが残って
- いた.
-
- * parse.y (exprs): エラーリカバリを追加.
-
-Wed Apr 24 15:51:05 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_chop_bang): CRLFの場合2 bytesをchop!するように.
-
- * ext/socket/socket.c (tcp_svr_s_open): まだnilと0を混同しているソー
- スが残っていた.
-
-Tue Apr 23 18:14:25 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * pack.c (pack_pack): "A/a"のバグ.余計なpaddingが入っていた.
-
-Thu Apr 18 13:02:11 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * configure.in: アーキテクチャ依存部を別ディレクトリにインストール
- するように.
-
- * parse.y (yyerror): エラー発生時にエラー行とその位置を表示するよ
- うに.
-
-Wed Apr 17 14:22:42 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * defines.h: SAFE_SIGHANDLEを無くし,危険な選択はできないように.
-
- * io.c (io_ungetc): 新機能.
-
- * ruby.c (load_file): ファイルからの読み込み方式が変わったのに対応.
-
- * parse.y (compile_file): ファイルからの入力を一度全部読み込むのを
- 止めて,getsを使うことにした.
-
-Wed Apr 10 17:40:11 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.98
-
-Tue Apr 9 09:54:30 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (iter_block): イテレータブロックの指定をメソッド呼び出し
- に限定.文法の明確化.
-
- * eval.c (rb_eval): 条件式の正規表現の比較をinline化.
-
- * eval.c (rb_eval): defined? の 定義情報(種別)を文字列で返す.
-
- * node.h: NODE_BEGIN -> NODE_RESCUE, NODE_ENSUREに分離.
-
- * eval.c (rb_eval): option -n/-pのトップレベルループのinline展開.
-
- * parse.y (cond0): 条件式中の文字列は比較の対象としない
-
-Wed Mar 27 12:33:54 1996 Tairo Nomura <tairo@hucom.tp.titech.ac.jp>
-
- * defines.h: NeXT対応
-
-Wed Mar 27 10:02:44 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y: 予約語の変更 continue -> next
-
-Mon Mar 25 07:34:37 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (parse_regx): o(once)オプションを追加.
-
-Fri Mar 22 14:25:35 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.97d
-
- * eval.c (dyna_var_defined): 動的ローカル変数の定義チェック用ルー
- チン.
-
- * parse.y (gettable): eval()の中での動的ローカル変数(既に値を持っ
- ているもの)の検出に失敗していた.
-
-Tue Mar 19 10:46:47 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.97c
-
- * re.c (reg_s_new): compile時にsegmentation fault.
-
- * parse.y (str_extend): いつもevalするように.
-
-Wed Mar 13 11:00:42 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (str_extend): 文字列中の式展開の不備を無くした.
-
- * parse.y: 下手なエラーリカバリを外した.
-
-Tue Mar 12 12:30:20 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rescue): 間違ってensureでも例外を捕捉していた.
-
-Wed Mar 6 12:11:03 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (var_extend): 変数展開"#{}"で,任意の式を書けるようにし
- た,これで「変数」展開では無くなっちゃったなあ.
-
- * regex.c (init_syntax_once): `_'をwordに追加.
-
- * regex.c (re_compile_pattern): `\w',`\W'の判定をsyntax tableを使
- うように.
-
-Tue Feb 27 10:15:32 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (obj_inspect): 表示するインスタンス変数が無い時には,
- to_sを使う.
-
- * configure.in: dlnの検出を自動的に.
-
-Mon Feb 26 19:55:33 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c (readin): read(2)で一度にファイルが読み込めない場合に対応.
-
-Sat Feb 24 14:47:18 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.97b
-
-Fri Feb 23 11:26:02 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * class.c (rb_define_module): C言語で定義されたモジュールのPATHの
- 設定忘れ.文字列化でcore dump.
-
- * eval.c (mod_include): 戻り値をnilに.
-
- * version 0.97a
-
-Thu Feb 22 21:03:42 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * array.c (ary_times): 「配列*文字列」がjoinと同じ働きをするように.
-
-Wed Feb 21 11:18:09 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * configure.in : fileCountをcache.
-
- * configure.in : LinuxでELF環境を自動的に検出できるよう.
-
-Tue Feb 20 11:18:09 1996 Mitsuhide Satou <mit-sato@aries.bekkoame.or.jp>
-
- * FreeBSD dynamic link対応.
-
-Fri Feb 16 08:50:01 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (obj_inspect): インスタンス変数を持たないオブジェクトも
- 正しく表示されるように.
-
-Wed Feb 14 16:56:44 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): 条件式の`2..2'など左辺成立直後に右辺が成立する
- パターンにバグ.
-
-Tue Feb 13 18:22:22 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.97
-
-Fri Feb 9 21:32:55 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/tkscrollbox.rb: スクロールでtclの設定を行い,ruby<->wishの不
- 要な通信を無くした.
-
-Wed Feb 7 10:26:52 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_aref): indexをunsigned intでとっていた.
-
- * string.c (str_aref): 範囲外のindexに対してnilを返す.
-
- * parse.y (special_local_set): `$_'が宣言無しに使われた場合に対応.
- 関数をvariable.cから移動.
-
- * string.c (str_sub): 置換開始位置が間違っていた.
-
-Tue Feb 6 16:17:31 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-parse-region): コメントの読み飛ばしの
- バグ.
-
-Fri Feb 2 18:35:28 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * variable.c (lastline_get): `$_'を`$~'と同じようにSCOPEローカルな
- 変数にした.
-
-Thu Feb 1 14:14:07 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c: statのcacheをやめた.
-
-Wed Jan 31 07:13:08 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (proc_s_new): procの中でyieldを呼ばれた時にcore dumpして
- いた.とりあえず例外を発生させる.
-
- * variable.c (rb_class2path): singleton classに対応.
-
- * ext/etc/etc.c (Init_etc): struct_defineのターミネータがnilだった
- (0でなければならない).
-
- * ext/marshal/marshal.c: TRUE/FALSEを吐き出せるように.
-
- * eval.c (rb_get_method_body): キャッシュのalias対応,いままでは
- aliasはキャッシュに入っていなかった.
-
-Tue Jan 30 09:55:13 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): NODE_BLOCK - tail recursive(というほどでもない
- が).
-
- * io.c (io_pipe): pipe(2)を実装した.
-
- * eval.c (rb_eval): Qselfをなくした.thread対応への第一歩.先は遠
- いが….
-
- * eval.c (proc_call): procの中でのreturnはprocの終了を意味するよう
- に.ただし,procからのyieldの中でのreturnは例外を発生する.
-
-Wed Jan 24 11:33:48 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.96a
-
- * dir.c (dir_each): `$_'の値を変更するのをやめた.
-
- * io.c (f_readlines): nilとFALSEの分離のあおりで無限ループに落ちて
- いた.
-
- * ruby.c (ruby_options): $0の設定ミス.
-
-Tue Jan 23 15:28:21 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): ``は文字列を引数とするメソッド(`)呼び出しのシ
- ンタックスシュガーであるとした.
-
- * ruby.c (addpath): `-I'オプションでディレクトリが「前に」追加され
- るように変更.
-
-Fri Jan 19 11:23:12 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * dln.c (load_1): N_INDR対応(出来たような気がする).
-
-Thu Jan 18 18:14:20 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.texi: FALSEとnilの分離を反映した.
-
-Tue Jan 16 17:39:23 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.96 - とりあえずnilとFALSEを区別する版
-
-Wed Jan 10 15:31:48 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * re.c (reg_match): マッチしなかった時の戻り値はFALSE.
-
- * object.c (rb_equal): `0 == nil'がTRUEになるバグ.
-
-Tue Jan 9 00:44:58 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * nilとFALSEが分離可能に変更.
-
- * nilとFALSEと0の区別を厳密に.
-
- * struct.c (struct_new): 引数を0で終る必要が無くなった.
-
- * object.c (inspect_i): オブジェクトのチェックのバグ(Fixnumでcore
- dumpしていた).
-
- * range.c (range_to_s): Rangeの表示を改善.
-
- * object.c (true_inspect): TRUEの表示を`TRUE'に.
-
-Mon Jan 8 15:02:33 1996 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * numeric.c (fix_mul): divide by zero errorが発生した(オーバーフロー
- 検出のバグ)
-
- * texinfo.texをパッケージに含めた.
-
-Sun Dec 31 00:08:49 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): `::'では,そのクラスで定義された定数を参照する
- ように変更.
-
- * string.c (Init_String): eachをeach_lineに戻した.
-
-Thu Dec 28 12:31:55 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): caseの演算子を`=~'から`==='に.
-
- * variable.c (rb_const_set): クラス定数の再定義を許す(同じクラスで
- は不可).警告は出す.
-
-Wed Dec 27 13:27:52 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.95c
-
- * ext/tkutil/tkutil.c: wishがあってもなくても一応コンパイルだけは
- するように.
-
- * lib/tk.rb: 環境変数PATHから{wish|wish4.0}を探すように.
-
-Tue Dec 26 01:03:42 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-parse-region): 正規表現の検出強化.
-
- * numeric.c (fix_mul): 乗算のオーバーフロー検出アルゴリズムのバグ.
-
- * ext/extmk.rb.in: ./install-shを使う場合のPATHを調整.
-
- * Makefile.in (install): lib/*.rbを一つずつインストール.
-
- * io.c (io_each_line): イテレータの戻り値をnilで統一.
-
-Fri Dec 22 10:34:32 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.95b
-
- * variable.c (f_untrace_var): 第2引数を指定すると特定のtraceを削除
- できるように.
-
- * variable.c (f_trace_var): 第2引数がnilの時,traceを削除する.
-
- * lib/tk.rb (file_readable/file_writable): 第2引数をnilにすること
- によるevent handlerの削除.
-
- * parse.y (variable): ドキュメントに`__FILE__'と`__LINE__'が残って
- いた.`caller(0)'で代用したはずだったのに.
-
- * eval.c (f_eval): $!のリセット.
-
- * error.c (err_sprintf): 勝手に"\n"を付加するのを止めた.
-
- * parse.y (f_arglist): 引数リスト直後のif/whileの読み間違い.
- lex_stateの値が設定されていなかった.
-
-Thu Dec 21 00:56:57 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.95a - ^^;;;
-
- * lib/tkscrollbox.rb: パッケージに入ってなかった.
-
- * configure.in: FILE structureのチェックにバグ.
-
- * Makefile.in (clean): ext以下をinstallしていた.
-
- * ext/socket/extconf.rb: Solarisにおける-lnlsのチェック.
-
- * array.c (beg_len): バグがあった….悲しい.
-
- * version 0.95 - fj.sourcesに
-
- * eval.c (rb_eval): rescueのロジックをrb_rescue()に一元化.
-
-Wed Dec 20 19:30:58 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * Makefile.in: 不要なコンパイルの回避(より完全に).
-
- * class.c (singleton_class_new): `single'->`singleton'
-
-Tue Dec 19 07:14:33 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * io.c (closed?): IOがcloseされているかどうかを知る述語.
-
- * parse.y (primary): 特異メソッドの引数のlex_stateが不適切.
-
- * lib/tk.rb: tcl->rubyの変換関数の用意.
-
- * ext/extmk.rb.in (install): installの2重コンパイルの回避.
-
- * array.c (range_beg_len): range指定の不適切なエラーを訂正.
-
- * string.c (str_aref): range指定のバグを削除.
-
- * lib/tk.rb (tk_split_list): Tclのリストに対応.
-
-Mon Dec 18 09:58:12 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.94
-
- * dln.c (dln_load): HP対応(未確認)
-
- * eval.c (Init_Proc): BlockをProcに改名.
-
-Sat Dec 16 13:46:14 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): retryでイテレータの再実行ができるように.
-
-Fri Dec 15 17:14:30 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c: proc:lambdaの親しみやすい別名
-
-Thu Dec 14 17:21:55 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (dyna_var_asgn): イテレータブロック内で最初に初期化された
- ローカル変数の有効範囲をそのブロック内に限定.これでlambdaと呼べ
- ないことはない.
-
-Wed Dec 13 02:30:58 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gc.c: autoloadのマークミス.
-
- * lib/tk.rb: wishからの複数行の戻り値に対応
-
- * lib/tkcomposite.rb: 複合widget
-
- * variable.c (rb_class2path): ICLASSに対応してなかった.
-
- * eval.c (ruby_run): exit(0)のバグ
-
-Sat Dec 9 01:21:24 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/marshal/marshal.c (dumps|load): 文字列に対する入出力を可能に
- した(ただし実はファイル経由なのだ).
-
-Fri Dec 8 18:29:11 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/marshal/marshal.c: シンボルを一度だけ初期化する.
-
-Thu Dec 7 07:58:50 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (yylex): 第1引数の正規表現の認識にエラーがあった.同時に
- 状態数を減らした.
-
- * string.c (str_sub): 置換でスキップ幅が大きすぎた.
-
-Wed Dec 6 15:14:23 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_sub_method): sub/gsub(!なし)は置換が行なわれなかっ
- た時,置換前の文字列を返す.
-
-Tue Dec 5 00:55:15 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (yylex): 括弧を省略した時の引数展開の`*'に対応.
-
- * eval.c (ruby_run): EXITハンドラ内での例外に対応.
-
- * bignum.c (big_cmp): BignumとFixnumの比較で落ちる.
-
-Mon Dec 4 14:21:18 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (call_op): コンパイル時の定数式の展開をやめた.労多くし
- て益少ないと判断したので.
-
-Thu Nov 30 01:35:15 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/tk.rb: {Radio,Check}Buttonのvariableの実装.
-
- * eval.c (rb_yield_0): Block.callがネストした時のバグ.
-
- * io.c (f_select): 常に配列3つをふくむ配列を返すように
-
- * lib/tk.rb: fileeventをruby側で実装.
-
-Wed Nov 29 17:53:23 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * variable.c (rb_ivar_get): selfを常に指定するように.
-
-Tue Nov 14 00:07:29 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/tk.rb: Tk4.0対応
-
-Mon Nov 13 16:23:32 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.93
-
-Thu Nov 9 23:26:01 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gc.c (gc_mark): モジュールのMixinのマーク忘れ.
-
- * parse.y (f_arglist): メソッド定義の引数を括弧で括らなくても良い
- ようにした.
-
-Wed Nov 8 00:17:51 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_yield_0): 未初期化のローカル変数があった.
-
- * eval.c (rb_eval): pendig signalのチェックをeval実行後に行うよう
- にした.でないとシグナルの発生と検出が遠く離れてしまう事がある.
-
- * parse.y: class文のsuperclass部を定数から式に拡張した.
-
- * lib/tk.rb: Tkのほぼ全ウィンドウクラスに対応.キャンバスとテキス
- ト上のオブジェクトが残っている.
-
-Tue Nov 7 08:18:37 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * signal.c (trap): ブロックを指定できるように.
-
-Mon Nov 6 16:44:00 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (f_caller): 呼出元の情報を得る.
-
- * ext/tkutil/tkutil.c: wishのstderr出力を監視することで,エラー処
- 理を行う.
-
- * ext/tkutil/tkutil.c: wishとの通信部をCで記述.
-
-Sat Nov 4 01:12:59 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el (ruby-calculate-indent): インデントの計算を
- もう少しスマートにした(正規表現のチェック,継続行のチェック).
-
- * eval.c (rb_call): 無限再帰を避けるため,関数のネストレベルの制限
- を行なう.
-
- * lib/tk.rb: Tkインターフェース.まだ不完全だが.
-
- * eval.c (rb_yield_0): 空のBlockのバグ.
-
- * sample/ruby-mode.el (ruby-calculate-indent): 行末の演算子による
- 行継続に対応.
-
-Fri Nov 3 12:56:21 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_call): 本体が空の関数の実行にバグ.
-
- * parse.y (var_extend): 文字列の末尾の変数展開のバグ.
-
- * variable.c (rb_gvar_set): traceの評価時にに変数値を与えるように.
-
- * eval.c (f_require): ruby scriptのrequireにbug.
-
- * variable.c (rb_const_get): モジュールのinclude対策.
-
-Thu Oct 19 13:56:06 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * dln.c (dln_load): HP対応でのtypo.
-
-Wed Oct 18 17:39:39 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.92
-
- * object.c (krn_type): オブジェクトの動的な型を返すメソッド.
-
-Tue Oct 17 00:48:18 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.c (proc_options): -X オプション.chdirだけを行う.
-
- * re.c (reg_search): 漢字コードを途中で変更できるように.コンパイ
- ル時のコードが変更された時にはマッチの直前に正規表現の再コンパイ
- ルを行う.定数KCODEから変数$KCODEへ.
-
- * parse.y: ()のなかにcompexprを許す.
-
- * re.c (reg_search): メモリリークを直した.
-
-Fri Oct 13 13:19:19 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (str_sub): 文字列置換にバグ.
-
- * string.c (str_strip_bang): 文字列の後ろの長さの調整が行われてい
- なかった.
-
- * re.c (reg_search): $&, $1...はローカルに束縛するようになった.呼
- び出したメソッドでのマッチは現スコープの$&などの値に影響しない.
- マッチの情報をスコープ外で得たいときには$~を使って束縛情報を持ち
- 出す必要がある.
-
-Thu Oct 12 00:33:33 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * re.c (reg_search): String:split, String:indexでは$&, $1...が変化
- しないようにした.
-
- * io.c (rb_str_setter): setterの仕様が変更になっていた.
-
- * variable.c (f_trace_var): 第2引数を省略してイテレータとして呼べ
- るように.
-
-Wed Oct 11 11:50:59 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.91
-
- * variable.c (var_setter): 引数が間違っていた.致命的バグ.
-
- * io.c (pipe_open): $stderrの値が変更されている時にはそちらを
- 子プロセスのstderrに設定する.
-
-Mon Oct 9 13:06:33 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (mod_to_s): モジュール内のモジュールは`::'を使った表現
- で表示されるように.
-
- * variable.c (rb_gvar_set): 代入によるループが発生しないように,
- trace内での代入ではtraceを評価しない.
-
- * struct.c (struct_equal): structのequal判定にクラスの一致を含めた.
-
-Sat Oct 7 00:18:32 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_eval): defined?の機能を拡張(yieldのチェック,superの
- 存在など).
-
-Fri Oct 6 12:06:47 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.90
-
- * st.c (st_foreach): 要素を削除した時に要素数が変化していなかった.
-
- * hash.c (hash_values): バグ修正.keysを返していた….
-
- * parse.y (call_op): defined? の引数では定数の畳み込みを行わない
- (チェックする前にコンパイルエラーになっては困る).
-
- * スコープ生成の一部見直し.
-
-Thu Oct 5 00:29:43 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * 関数とクラスの命名規則を変更した.関数名,変数名の全面書き換え.
-
- * gc.c (looks_pointerp): ヒープチェックの高速化.
-
- * struct.c (Fstruct_aset): 構造体に対する`[]='.
- (struct_set): 構造体メンバに対する代入.
-
-Wed Oct 4 09:54:07 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.89
-
- * eval.c (Frequire): ダイナミックロードのエラーチェックを厳しく.
-
- * struct.c: structの構造を完全に書き換えた.以前は順序付きの
- id->valueの連想配列であったが,今度は構造体毎に新しいクラスを生
- 成するようにした.
-
- * parse.y: `::'の意味をAssocの生成からクラス(モジュール)内の定数ア
- クセスへ変更.
-
- * assoc.c: なくす.
-
-Tue Oct 3 13:31:08 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * variable.c (Ftrace_var): trace_var, 大域変数への書き込みhookを設
- 定する.
-
- * variable.c: global_entryの構成を書き換えた.これでtrace_varを実
- 装できる.
-
- * file.c (Ffile_stat): "&"で直前のfstatの結果も参照できるように.
-
-Fri Sep 29 14:15:13 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.88
-
- * dln.c (dln_load): AIXとHPに対応したコードを入れた(動作は未確認).
-
- * ext/extmk.rb.in: 必要に応じて,定数EXTLIBを定義するように.
-
- * dln.c (dln_load): dln独立に書き換える.将来の拡張用.
- (load_1): dln_a_outにおいてソースコードでライブラリを明示的にロー
- ドする必要がないように変更した.
-
-Thu Sep 28 13:31:37 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/ruby-mode.el: もっとましなhilit19対応(正規表現).
-
-Wed Sep 27 04:12:44 1995 Takahasi Mamoru <taka@soum.co.jp>
-
- * sample/test.rb: echoで-nを使わないように(SysV対策).
-
- * ext/extmk.rb.in: sub -> sub!
-
-Tue Sep 26 19:12:42 1995 Yasuo OHBA <jammy@csg.mes.co.jp>
-
- * dln.c (dln_find_1): `.', `..'から始まるパスに対応した.
-
-Mon Sep 25 12:33:03 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.87
-
-Sat Sep 23 10:00:18 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (Fmod_modfunc): メソッドをprivateにし,同時に特異メソッド
- も定義するメソッド.パッケージ的使い方のモジュール用.
-
-Fri Sep 22 11:02:44 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * lib/find.rb: findを提供するライブラリ
-
- * variable.c (rb_define_variable): hookの設定を分離.
- (add_hook): 1変数に対して複数のhookを設定できるように.
-
-Thu Sep 21 00:22:11 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (Fstr_frozen): 文字列が更新不可かどうかをチェックする述
- 語メソッド.
-
- * hash.c (Fhash_aset): keyが文字列の時,キーの内容が変化しないよう
- に,dupしてfreezeする.
-
-Wed Sep 20 16:12:44 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.86
-
- * ext/extmk.rb.in (have_header): キャッシュにバグ.
-
- * ext/extmk.rb.in (have_library): 引数の順序が変わった.
-
-Thu Sep 14 18:00:59 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * object.c (obj_is_instance_of): is_member_ofから名称変更.
-
- Wed Sep 13 15:44:35 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (Fstr_tr_bang): 範囲外の文字に対する変換バグ.
-
-Tue Sep 12 14:27:58 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (Sfile_expand_path): expand_file_name -> expand_pathに名
- 称変更.
-
- * enum.c (Fenum_member): includes? -> member? に名称変更.
-
- * string.c (Fstr_each_byte): StringはByteArrayであるという基本に戻っ
- て,eachの定義をeach_byteに変更した.今までのeachはeach_lineでア
- クセスできる.
-
-Mon Sep 11 18:31:17 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (cache_stat): ファイル名として"&"を指定すると直前の
- stat(2)の結果を再利用するように.
-
-Fri Sep 8 14:18:51 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ruby.texi: `!', `?'に対応してアップデート.
-
- * parse.y: defined -> defined?
-
- * file.c: FileOpの一文字メソッドをなくす.一文字テストはtestメソッ
- ドにまかせる.
-
- * parse.y (yylex): 変数名の後ろに`?'も許す.述語メソッドの後ろに
- `?'を追加する.
-
-Thu Sep 7 20:01:33 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c: 文字列の中身を更新するメソッドの名前の終りに`!'を付加.
- `!'の無いバージョンも用意した.
-
- * parse.y: 変数名の後ろに`!'を許す.
-
-Wed Sep 6 14:12:19 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.85
-
- * string.c (Fstr_dup): 文字列の複製を作る
- (Fstr_freeze): 文字列の更新不可属性を設定できるように.
- (Fsub/Fgsub): $_の内容をdupしてから置換を行うように.
-
- * ruby.h (CLONESETUP): flagsの状態もコピー
-
-Tue Sep 5 01:27:50 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * sample/test.rb: 失敗の検出を厳しく.
-
-Fri Aug 25 14:31:02 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * process.c (Ffork): イテレータとしても動作するように.
-
- * version 0.84
-
- * signal.c (sig_beg): ハンドラが設定されている時には再設定しない.
-
- * ext/extmk.rb.in (create_makefile): shared objectのリンクの際に
- `-l'オプションを指定するように.
-
- * signal.c (trap): `EXIT'で終了処理を行う設定が出来る.
-
-Wed Aug 16 00:13:22 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * signal.c (sig_beg): デフォルトではbegin節の中でだけSIGINTを捕捉
- するように変更.
-
- * io.c (io_ctl): fcntlを持たないシステムにも対応.
-
- * 各ディレクトリに分散していたMANIFESTをまとめた.拡張モジュール毎
- には必要.
-
- * string.c (Sstr_new,str_sub,Fstr_crypt): 引数を自動的に文字列に変
- 換するように.
-
-Sat Aug 12 00:44:02 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * string.c (Fstr_crypt): PD cryptを用意した.
-
-Fri Aug 11 14:37:03 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * assoc.c (Fassoc_clone): assocもcloneできるように.
-
- * io.c: マクロREAD_DATA_PENDINGの定義を変更(Linux対応)
-
- * io.c (io_fptr_finalize): fptrの開放時の処理を指定できるように.
-
-Wed Aug 9 16:52:41 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * eval.c (rb_provided): 複数のfeatureをロードすると無限ループに落
- ちるという単純な(しかし凶悪な)ミス.
-
- * ext/extmk.rb.in (install): dlopen対応を行った.今までdlnにしか十
- 分に対応していなかった.
-
-Tue Aug 8 14:17:06 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.83
-
-Mon Aug 7 12:47:41 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y: resque -> rescue.恥ずかしいがtypoを残しておくわけには
- いかないよなあ.なんで今まで気がつかなかったのか….
-
-Thu Aug 3 18:18:05 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * missing/nt.c: NT移植用の関数群をまとめた.
-
- * variable.c (rb_const_get): また例外を発生するようにした.defined
- がある以上例外を発生させない理由がないので(例外が発生した方がタ
- イプミスの検出などの点で有利).
-
- * variable.c (Fautoload): autoloadを実装.今度は使えるか.
-
-Mon Jul 31 15:44:21 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (arg_ambiguous): 第1引数のあいまいさを警告(-vオプション
- で有効).
-
- * eval.c (rb_eval): `-v'オプションをつけて`def'が呼ばれると不必要
- なエラーメッセージが出た.
-
- * parse.y (yylex): メソッドの第1引数の判定をもうちょっと賢くした.
-
-Fri Jul 28 19:04:43 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (yylex): `+/-/['の直前に空白が来るかどうかで動作を変更し
- た(混乱のもとか?)
-
-Wed Jul 26 09:21:23 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.82a
-
- * sprintf.c (Fsprintf): `%s'で'\0'を含む文字列に対応.
-
- * pack.c (Fpck_pack): packの要素確保のバグ.
-
- * eval.c (Floop): 無限ループのイテレータ.
-
- * io.c (next_argv): 存在しないファイル名が指定された時のエラー処理
- が行われていなかった.
-
-Mon Jul 24 17:37:34 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.82
-
- * ext/extmk.rb.in (install): 拡張モジュールをstatic linkする場合は
- そのモジュールが既にrequireされたのと同じようにfeatureを設定する.
- これで拡張モジュールの機能が必要な時には(static linkされているか
- どうかにかかわらず)requireすればよくなる.
-
- * eval.c (Frequire): `$"'に格納する文字列をフルパスでなくフィーチャ
- 名とする.rubyスクリプトをロードした時には`.rb',オブジェクトを
- ロードした時には`.o'をフィーチャ名に付加する.lispのrequireと
- provideの働きに(少し)近い.
-
-Thu Jul 20 12:50:05 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * Makefile.in (test): make testができるように.
-
- * struct.c (struct_new): typo.
-
- * eval.c (rb_eval): `defined'を追加.メソッド/変数/定数の定義状態
- を知る事が出来る.
-
-Wed Jul 19 18:04:01 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.81
-
-Mon Jul 17 14:53:51 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * variable.c (rb_const_get): 未初期化のCONSTANTの値をnilにした.し
- かし,今後また例外に戻す可能性はある.要はoptionalなクラス/モジュー
- ルが存在するかチェックしたいだけなんだな.
-
- * st.c (int): grow_factorを固定にした(大嶋さんのマシンに対応).
-
-Fri Jul 14 00:48:40 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * ext/extmk.rb.in: キャッシュのバグを修正.
-
- * parse.y (var_extend): #{$数字}に対応した.
-
- * dln.c (dln_load_1): `Init_FILENAME'だけを有効に.`init_*'は今後
- 実行しない.
-
- * ext/etc/etc.c : Etcモジュールを拡張モジュールとして分離.実はNT
- 対応への布石だったりするかもしれない.
-
-Tue Jul 11 17:12:48 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * gcc -Wallで出たwarningを元にソースを変更.
-
- * signal.c (trap): typo.
-
-Fri Jul 7 10:08:51 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.80
-
- * ruby.texi: texinfo documentを提供.specとruby.1は無くなった.
-
- * signal.c (Ftrap): 割込み禁止中の例外発生に対応.
-
- * eval.c (Flambda): Blockオブジェクトを返す.Block.newと同義.
-
-Thu Jul 6 00:35:03 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * signal.c (Ftrap): SIG_DFLの処理を変更.SIGINTへのデフォルトハン
- ドラを用意(例外を発生する).
-
- * file.c (Sfile_expand_fname): パス名を絶対パスに展開するメソッド.
- (Sfile_basename): basenameを得るメソッド.拡張子も外せる.
- (Sfile_dirname): basenameの反対.
-
- * eval.c (rb_call): argument評価中の例外発生に対応.
-
- * file.c (Ftest): `M', `A', `C'を追加.
-
-Tue Jul 4 12:36:33 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * file.c (Ftest): ファイルテスト用メソッド.
-
- * ruby.c (proc_options): `-r'オプションを追加.
-
- * parse.y (f_args): デフォルト引数を追加.
-
- * eval.c (rb_call): 該当する引数が無い時,rest引数の値をnilに.
-
- * numeric.c (num_equal): 数値以外との比較で例外が発生していた.
- FALSEを返すように.
-
- * eval.c (masign): 多重代入のrest部の動作がおかしかった.
-
-Sat Jun 17 01:03:16 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * parse.y (gettable): 未初期化のローカル変数の参照(独立した識別子)
- は正式にメソッド呼び出しとした.
-
- * parse.y (read_escape): tokenbufを使わないように修正.それにとも
- ない,`\C-x',`\M-x'などのエスケープ表現を復活.これでドキュメン
- トと実際の処理系が一致した.
-
-Thu Jun 15 15:42:00 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * re.c (re_regcomp): cacheのチェックを改善.
-
-Mon Jun 12 18:50:51 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * version 0.79
-
-Sat Jun 10 00:25:01 1995 Yukihiro Matsumoto <matz@caelum.co.jp>
-
- * re.c (re_regcomp): cache判定に`$='の値も反映させた.
-
- * sample/test.rb: test suite作成.
-
-Fri Jun 9 15:58:34 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * re.c (re_regcomp): cacheの判定が間違っていた.
-
-Fri Jun 9 00:01:35 1995 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c (rb_yield): block構造体に初期化していないメンバ(iter)があっ
- たのでイテレータのネストが正しく動作しなかった.
-
-Thu Jun 8 00:59:03 1995 Yukihiro Matsumoto (matz@dyna)
-
- * re.c (=~): String以外との比較がFALSEを返すように(例外を発生して
- いた).
-
- * extmk.rb.in: 判定した値をファイルにキャッシュするようにした.
-
- * assoc.c (to_a): to_aメソッドが再定義されていなかった.
-
- * eval.c (rb_eval): 初期化されていないローカル変数へのアクセスを引
- 数の無いメソッド呼び出しと解釈する.ただし,(現状では)メソッドが
- 定義されていない場合,エラーにせず変数未初期化のwaringを出して
- nilを返している.「ruby -pe print」などが実行できるという意味で
- はありがたいこの仕様は,しかし今後の検討が必要である.-- メソッ
- ド呼び出しとするのを止めるか(以前の仕様),いつもメソッド呼び出し
- とする(未定義ならばエラー)か,今の仕様で行くか.
-
- * eval.c (rb_eval): 初期化されていないローカル変数へのアクセスで
- (evalなどで)初期化された事が分かった時には以後初期化されたローカ
- ル変数とみなす.
-
-Wed Jun 7 11:58:12 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * eval.c (rb_fail): 例外処理後も`$!'をクリアしないように.
- (rb_fail): `$!'変数に最後に改行を追加しない.
-
- * io.c (Fprint): privateメソッドに変更.引数を取らない時の動作を変
- 更(`$_'を出力する).
- (Fio_print): 出力先指定のprintメソッド.
- (Fio_printf): 出力先指定のprintfメソッド.
-
- * parse.y: not演算子の追加.優先順位の低い`!'演算子.
-
-Mon Jun 5 19:00:55 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * version 0.78
-
-Fri Jun 2 17:52:03 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * ruby.c (proc_options): -Iオプションで`$:'への追加される順番を修
- 正した.
-
-Fri Jun 2 00:36:34 1995 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: while修飾子の動作を通常のwhileと同じにした.ただし,
- begin式へのwhile修飾子だけはdo..while型のループとなる.
-
-Wed May 31 18:36:30 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * version 0.77
-
-Mon May 29 18:39:37 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * ext/extmk.rb.in (install): 拡張モジュールもインストールできるよ
- うに.
-
-Fri May 26 14:43:01 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * process.c (Fsystem): 戻り値をサブプロセスの失敗/成功を表す真偽値
- にした.終了ステータスは`$?'で得る.
-
-Tue May 23 10:58:11 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * string.c (Fstr_upto): 無限ループに陥らないように.
-
- * parse.y (cond): `||'などの右辺に制御式が書けるように,条件式がか
- ならずしも値を持たなくても良いようにした.
-
- * ext/marshal/marshal.c: オブジェクトの読み書きをメソッドの再定義
- でコントロールできるように.インスタンスが`_dump_to'というメソッ
- ドを定義している時はそちらを使うように.
-
- * ext/extmk.rb.in: static linkも設定できるような仕様にした.
- ext/Setupというファイルにディレクトリ名を記述するとそのディレク
- トリに存在するモジュールはstatic linkされる(はず).
-
- * eval.c (rb_eval): `..'を文法に組み込み,`..'と`...'の動作をperl
- に合わせた.
-
-Sat May 20 01:22:48 1995 Yukihiro Matsumoto (matz@dyna)
-
- * io.c (select): timeout時と割込み時の動作の明確化.
-
-Fri May 19 15:33:23 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * version 0.76
-
-Fri May 19 00:48:08 1995 Yukihiro Matsumoto (matz@dyna)
-
- * string.c (Fstr_each): イテレータブロック中で文字列の変更が行われ
- たかどうかをチェック.ポインタの値が変わっていれば例外を発生する.
-
- * ruby-mode.el: ruby-electric-braceの新設.
-
-Thu May 18 12:27:23 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * string.c (Fstr_tr): trの置換対象に`\0'を含む時に正しく置換を行わ
- ないバグがあった.更に置換文字列をASCII順に指定しないと動作しな
- い問題もあった.結果としてtrを書き換えたので,copyrightの問題は
- 無くなった(と思う).
-
- * gc.c (gc): the_scopeをマークしていなかったので,ローカル変数の指
- しているオブジェクトが間違って開放される場合があった.
-
- * gc.c (mark_locations_array): 若干の高速化.
-
-Mon May 15 11:43:49 1995 Yukihiro Matsumoto <matz@ix-02>
-
- * ext/extmk.rb.in: Dynamic Loadモジュールのコンパイル用チェックを
- 行うruby script.autoconfに近い感覚で使える.新しいモジュールを
- 提供したい人はextの下にディレクトリを作るだけで良い.必須のファ
- イルはファイル名の一覧を記録した`MANIFEST'というファイルのみ.必
- 要に応じて`depend'(ファイルの依存関係を記述するファイル gcc -MM
- の出力),`extconf.rb'(コンパイル用にライブラリと関数の存在チェッ
- クするファイル)を用意できる.
-
- * eval.c (rb_call): rubyメソッドの引数チェック時に未初期化の
- jmp_bufを使用していた.
-
- * parse.y: `or'と`and'の優先順位を同じにした.
-
-Wed May 3 18:21:36 1995 Yukihiro Matsumoto (matz@dyna)
-
- * dln.c: Linuxでは`__.SYMDEF/'であった.
-
- * dln.c: system callのエラーチェックを忘れていた.
-
-Wed Apr 26 09:50:56 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: イテレータブロックの変数宣言を`|'で括るようにした.これ
- でイテレータ変数がない時は宣言そのものを省略できる.文法の変更は
- 久しぶりだ.
-
-Tue Apr 25 12:04:17 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(require): loadからダイナミックロードの機能を移してきた.
- さらに拡張子の補完機能を追加してユーザがdln/dlopenの差を意識する
- 必要のないようにした.
-
- * string.c(sub,sub): イテレータとしても動作するように.
-
- * object.c: init_object -> initialize.
-
-Mon Apr 24 14:22:39 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * NEWS-OS 3.4対応
-
- * io.c: Solarisのstdioの動作が違うようだ.signalでEOFを返してしま
- う….perlでも同様の問題がある.
-
-Fri Apr 21 20:04:39 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.75
-
- * signal.c: trapがなくなっていた.うーむ.
-
- * configure: Solaris 2.3対応.
-
- * io.c: #elifのないcppもある.
-
- * dir.c: autoconf 2.xへの対応が不十分
-
-Thu Apr 20 12:31:24 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.74
-
- * env.h, gc.c, regex.c: IRIXへの移植対応
-
- * configure: dlopen用にpicを生成するoptionの検出のため,システムタ
- イプをチェックするように.
-
-Tue Apr 18 19:08:17 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * gc.c(xrealloc): ptr=nilの時,malloc()と同じ働きを
-
- * array.c(astore): 空の配列の0番目の要素に代入するとsize=0で
- realloc()を呼んでいた.
-
- * configure, glob.c: Solaris 2.xでコンパイルできるように
-
-Mon Apr 10 18:36:06 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.73
-
-Fri Apr 7 13:51:08 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * cons.c->assoc.c: consの余計な機能は外してpairとしての機能だけを
- 残した.Enumerableをincludeするのもやめた.
-
- * string.c(esub): 文字列置換イテレータ.perlのs///eの相当する.
-
-Wed Apr 5 11:35:21 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.72
-
- * EWS4800対応
-
- * file.c: utimesがない時はutimeを使うように.
-
-Mon Apr 3 15:19:41 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.71
-
- * regexp.c(re_match): バグがあった.match_2を削除した時にenbugして
- いたのだった.
-
-Mon Mar 27 15:41:43 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * dict.c: Dict->Hashに全面的に移行.
-
-Thu Mar 23 20:30:00 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * dbm.c,socket.c: extディレクトリに分離.
-
- * configure: dln周りのチェックの強化
-
- * dln.c: initの呼び出しをdlopen()版に合わせた.
-
-Mon Mar 20 17:45:08 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * configure: autoconf 2.2に対応(一部).
-
-Fri Mar 17 15:56:44 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * dln.c: dlopenのあるマシンではそちらを使うように.ただし,ちゃん
- と動いているかどうかは自信がない.
-
- * regex.c: virtual concatinationをやめた.
-
-Thu Mar 16 11:32:57 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.70
-
- * eval.c,regex.c: gccでのコンパイルエラー.
-
- * io.c: inplace-editで拡張子が指定されない場合,もとのファイルを削
- 除する.
-
-Wed Mar 15 14:59:18 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.69
-
- * eval.c(method_missing): unknownから名称変更.
-
- * eval.c(single_method_added): 特異メソッドが定義された時に呼ばれ
- るメソッド.hookとして使える.実際に定義される直前に呼ばれる.
-
-Tue Mar 14 14:46:44 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby.c(proc_options): 引数の解析を自分でやることにより引数指定の
- 方法がperlに近付いた.getopt_longはもう使わない.
-
- * dir.c(glob): `{}'のネストを許すようにした.
-
-Mon Mar 13 17:56:25 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * glob.c: Glob(ワイルドカードオブジェクト)はなくなった.ワイルドカー
- ドの展開はDir.glob(文字列)を使う.ワイルドカードのマッチは正規表
- 現で代用.
-
-Fri Mar 10 18:35:46 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: Mathのようなモジュールは自分自身でextendする.
-
- * eval.c: クラスやモジュールを定義する時,既に同名のものがあれば追
- 加定義となるように.ただし.superクラスの違いなどはチェックする.
-
- * regex.c: debug.
-
- * math.c: 定数PIとEを定義.
-
-Thu Mar 9 21:35:12 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * regex.c: EUC,SJISモードでは0x80以上の8進,16進リテラルを禁止.
-
- * regex.c: クラス内でも数値リテラル・文字クラスが使えるようした.
-
-Wed Mar 8 17:39:05 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * regex.c: \200など括弧の数以上の表現は8進リテラルと解釈する.ただ
- し,\1から\9までは例外.
-
- * regex.c: \9以上のリファレンスも有効にした.
-
-Tue Mar 7 14:26:01 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(public/private): スコープ制御メソッドの名称変更.静的なア
- クセスも出来るようにしてみたが,不採用.
-
-Mon Mar 6 19:34:32 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c(inlcude): メソッド化.動的にモジュールをインクルードでき
- るように.さらに任意のオブジェクトにもモジュールをインクルードで
- きるメソッド `extend'も用意した.
-
- * parse.y: 文法からincludeを削除.メソッド化.
-
-Tue Feb 28 15:35:10 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: 配列,連想配列の最後に`,'をおけるように.
-
-Fri Feb 24 13:15:43 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.68
-
-Thu Feb 23 11:19:19 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: resque節のselfの値が間違っていた.
-
- * eval.c(rb_clear_cache): キャッシュのクリアし忘れがあった.
-
- * eval.c: 定数のスコープをクラス内の静的スコープに変更した.これに
- よって,特異メソッドから参照される定数は,レシーバのクラスではな
- く,定義されたスコープのクラスの定数となる.
-
-Wed Feb 22 00:51:38 1995 Yukihiro Matsumoto (matz@dyna)
-
- * regex.c: ignorecaseを正規表現のコンパイル前に指定しないと正しく
- 動作しない.修正.
-
- * string.c(toupper,tolower): bug fix.
-
- * ENV,VERSION: readonly変数から定数へ.
-
-Tue Feb 21 18:56:56 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * io.c(STDIN, STDOUT, STDERR): 定数として定義.
-
- * io.c(select): bug fix.
-
- * version 0.67
-
-Mon Feb 20 16:10:14 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(yylex): 定数を`%識別子'から,第1文字が大文字の識別子に変
- 更.それにともないクラスは定数となった.
-
- * eval.c: クラス定義内のselfがクラス定義外部のthe_classだった.
-
- * variable.c(rb_name_class): クラス名をインスタンス変数に格納する.
-
-Thu Feb 16 15:36:17 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: BLOCKをbraceで表現する文法に変更したものを作ってみる.
- MLに提示してみるが反応がない.
-
- * object.c(do,forever): なくした.
-
-Wed Feb 15 13:20:49 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c(new): 第2引数が与えられて,かつnilでないときだけ設定するよ
- うに(以前はnilの時にも設定を行なっていた).
-
- * parse.y(parse_regexp): 正規表現リテラルで大文字小文字を無視する
- かどうか指定できるように.
-
-Tue Feb 14 00:55:33 1995 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: (compexpr) -> (expr).
-
-Fri Feb 10 16:30:00 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * ruby.c(load_file): scriptを読み込む時だけ"#!"の解析を行うように.
-
- * ruby.c(readin): ファイル読み込み時に先頭に"#!"があり,その行が
- "ruby"という文字列を含む時,rubyに引数が与えられていれば,その引
- 数も有効になる.
-
- * parse.y(yylex): コメント行の終りが`\'であった時,次の行に継続し
- ているとみなすようにした.
-
-Thu Feb 9 16:18:37 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.66
-
- * parse.y: protectをbeginに変更.begin..endは例外処理だけでなく,
- 文括弧としても働くことになった.
-
-Wed Feb 1 19:48:24 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * version 0.65
-
- * string.c(str_replace): 置き換える文字列の長さが等しい時メモリコ
- ピーをしない.
-
- * string.c(rindex): バグ修正.
-
-Mon Jan 30 11:23:05 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(value_expr): ifのチェックを追加.
-
- * gc.c(gc_mark): free cellの扱いにバグ.
-
- * parse.y: 文法の変更(よりシンプルに).例外を減らした.
-
-Thu Jan 26 00:52:55 1995 Yukihiro Matsumoto (matz@dyna)
-
- * parse.y: 引数として連想配列を置くことができるように.この場合,
- 連想配列リテラルが最終引数となる.
-
- * parse.y: 配列参照の`[]'内が空でもよいことにした.
-
-Tue Jan 24 14:45:15 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * class.c(rb_include_module): `-v'を指定した時にはincludeしたモジュー
- ルとクラス定数が衝突していないかチェックする.
-
-Mon Jan 23 10:42:09 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(rb_class2name): メタクラスに関するbug fix.
-
- * dict.c: Dict[..]で辞書の生成が出来るように.
-
- * array.c: Array[..]で配列の生成が出来るように.
-
- * parse.y: 辞書の表現として{a,b,..}という形式も許すように.
-
-Fri Jan 20 10:28:38 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * re.c(Regexp.quote): 正規表現をエスケープするメソッド.
-
- * 無駄なrb_intern()を減らした.
-
- * parse.y: `!', `!=', `!~'を特殊演算子にする.よってこれらは再定義
- できなくなった.
-
-Wed Jan 18 13:20:41 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: 文法の整理(unless,untilをなくした).
-
-Tue Jan 17 11:11:27 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: defでメソッド再定義時にはスーパークラスのメソッドの可視
- 性を継承する.最初の定義の時は今までと同じデフォルト(トップレベ
- ルで関数的,クラス定義内で通常メソッド).
-
- * object.c(Class#new): オブジェクトの生成時に関数的メソッド
- init_objectが必ず呼ばれるように変更.
-
- * eval.c: 未定義のメソッドに対してunknownメソッドが呼ばれるように
- なった.エラー表示が今までと同じになるようにenvを調節している.
-
-Fri Jan 13 14:40:30 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * gc.c: gcを若干書き換えて整理した.が,あまり変化はなかったようだ.
-
- * parse.y(yylex): symbolを\symから:symに変更した.
-
-Thu Jan 12 01:39:28 1995 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c: 新規関数 rb_eval_string().
-
- * gc.c: gc_mark()を一部非再帰化.
-
- * variable.c(rb_ivar_{get,set}): インスタンス変数のアクセス周りで
- チェックが足りなかった.
-
- * variable.c: クラス定数とインスタンス変数でハッシュテーブルを共有
- するようにした.
-
- * ruby.h: iv_tblをRBasicからRObjectとRClassへ移動した.これにより,
- ObjectとClass,Moduleしかインスタンス変数を持てなくなる.が,メモ
- リ効率は若干向上する.
-
-Tue Jan 10 00:58:20 1995 Yukihiro Matsumoto (matz@dyna)
-
- * 0.64 released
-
- * eval.c: レシーバと引数は常にiterではない.
-
- * cons.c(aref,aset): negative offset対応.
-
-Mon Jan 9 14:40:39 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: foo{..}の形式において,fooをローカル変数やクラス名では
- なく,引数なしの関数型メソッド呼び出しとみなすようにした.
-
- * list.c -> cons.c: 名称変更(クラス名も).
-
- * list.c: a::b::c::nilをリスト(a b c)とみなすlisp形式から,a::b::c
- をリスト(a b c)とみなすruby形式に変更.[], []=, eachもそれに会わ
- せた仕様とする.
-
- * list.c: consペアとしての機能を強調.仕様変更.
-
-Sat Jan 7 01:26:26 1995 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c: 自己代入の不具合修正.
-
- * eval.c(masign): 多重代入が配列もリストもとれるようにした.
-
- * list.c: assocを2要素の配列からList(CONSペア)に変更した.
-
-Fri Jan 6 13:42:12 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: a[b]+=cやa.b+=cなどの自己代入形式で,aやbを2度評価しな
- くなった.
-
- * eval.c: iterator設定のバグフィックス.
-
- * list.c: Listクラスを新設.
-
-Thu Jan 5 13:55:00 1995 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: SCOPEのメモリリークをなくした.
-
- * eval.c: built-inメソッドへの引数の引き渡し方を変更して,配列の生
- 成数を減らした.
-
- * re.c: match-dataを毎回生成することをやめた.`$~'をアクセスした時
- にon-demandで生成する.
-
- * string.c etc: 不必要なmemmoveをmemcpyに置換.
-
- * parse.y: =~, !~は副作用があるのでコンパイル時に展開できない.
-
-Tue Jan 3 02:04:36 1995 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c: rest引数のbug fix.
-
- * eval.c,gc.c: scopeをオブジェクトにした.
-
- * eval.c: envとscopeの扱いを変更した.
-
-Wed Dec 28 09:46:57 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: evalでローカル変数が追加された場合に対応した.
-
- * parse.y: 演算子を含むaliasのbug fix.
-
-Tue Dec 27 16:45:20 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: def A Bをalias A Bに変更.
-
- * eval.c: alias関係のbug修正.nodeをオブジェクト化した時にenbugし
- たようだ.
-
- * signal.c: システムコールの再定義を止めた.
-
- * io.c(select): write/exceptのフラグ設定にバグ.
-
- * Makefile.in: static link用オプションをMake変数として独立させた.
-
-Tue Dec 20 00:46:19 1994 Yukihiro Matsumoto (matz@dyna)
-
- * 0.63 released
-
- * eval.c(rb_call): superの呼び出しで落ちる.argc, argvの設定を忘れ
- ていた.
-
- * parse.y(read_escape): 展開エラー.
-
- * variable.c: 定義済みの変数のhookを変更しないように.
-
-Mon Dec 19 12:01:10 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y(cond): 条件式に代入式が置かれた場合,`-v'オプションで警
- 告が出るように.
-
- * parse.y(**): 冪乗演算子`**'の優先順位を単項演算子より高くした.
-
- * parse.y(and,or): 優先順位の低い演算子`and', `or'.
-
- * 0.62 released.
-
- * eval.c: 不必要になったPUSH_ENV, POP_ENVを減らした.
-
- * env.h: ENVIONからselfをはずした.PUSH_ENVはsuperの準備のためだけ
- に用いることにした.
-
- * eval.c: 下記のオブジェクト化で遅くなった実行速度をもとに戻した.
-
-Mon Dec 17 23:01:10 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * eval.c: env.{argv,argc}とscope.local_varsのオブジェクト化.
-
- * eval.c: 1スコープ内で複数Blockを生成したときのバグを修正.
-
-Fri Dec 16 15:52:06 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * parse.y: `&&'と`||'の両辺はいつでも条件式とした.
-
-Thu Dec 15 00:16:04 1994 Yukihiro Matsumoto (matz@dyna)
-
- * eval.c(Block): Blockオブジェクトを実現.
-
- * node.h: NODE_QLISTはなくなった.
-
- * eval.c(rb_call): 引数への代入を名前で一つずつ代入するのをやめて,
- 一度にコピーするようにした.
-
- * eval.c(rb_call): rubyで記述されたメソッドへの引数渡しをinline化.
-
- * eval.c: イテレータ判定処理の全面書き換え.不適切なイテレータ呼び
- 出しをなくした.例えば「[foo(),bar()]{i|baz(i)}」でfooもbarもイ
- テレータとして呼び出され*ない*.
-
- * eval.c(rb_call): SCOPE処理をinline化.メソッド呼び出しの若干の高
- 速化.
-
-Wed Dec 14 18:09:33 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * node.h: nodeもオブジェクトにする.よってGCで回収される.
-
-Thu Dec 8 14:17:29 1994 Yukihiro Matsumoto (matz@ix-02)
-
- * 0.60 released - alpha test baseline.
diff --git a/doc/ChangeLog-1.8.0 b/doc/ChangeLog-1.8.0
index 0d00266735..07d7c6b165 100644
--- a/doc/ChangeLog-1.8.0
+++ b/doc/ChangeLog-1.8.0
@@ -1454,7 +1454,7 @@ Fri Jun 27 03:24:54 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
Thu Jun 26 21:34:49 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* class.c (class_instance_method_list): get rid of warning about
- argument type mismatch, and inline method_list().
+ arguement type mismatch, and inline method_list().
[ruby-core:01198]
Wed Jun 25 14:40:33 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -3361,7 +3361,7 @@ Fri Apr 11 02:41:35 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
Thu Apr 10 21:12:19 2003 Minero Aoki <aamine@loveruby.net>
- * lib/net/pop.rb: Exception line was accidentally removed.
+ * lib/net/pop.rb: Exception line was accidentaly removed.
[ruby-dev:19989]
Thu Apr 10 18:42:13 2003 Tadayoshi Funaba <tadf@dotrb.org>
@@ -5986,7 +5986,7 @@ Thu Nov 7 09:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
Wed Nov 6 16:57:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* class.c (rb_define_method): do not set NOEX_CFUNC if klass is
- really a module, whose methods must be safe for receiver's type.
+ really a module, whose methods must be safe for reciever's type.
* eval.c (rb_eval): nosuper should not be inherited unless the
overwritten method is an undef placeholder.
diff --git a/doc/ChangeLog-1.9.3 b/doc/ChangeLog-1.9.3
index b3deb551b0..b8e3162511 100644
--- a/doc/ChangeLog-1.9.3
+++ b/doc/ChangeLog-1.9.3
@@ -3541,7 +3541,7 @@ Sun May 15 23:45:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Sun May 15 22:26:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* signal.c (rb_f_kill): accept '-SIGXXX' style signal with Symbol or
- implicit conversion with #to_str. [ruby-dev:43169] fixes #4362
+ implicit convertion with #to_str. [ruby-dev:43169] fixes #4362
* test/ruby/test_signal.rb (test_signal_process_group): add a test
for send signal to process group.
@@ -8041,7 +8041,7 @@ Sat Dec 25 17:33:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
anonymous classes.
* lib/csv.rb (CSV#init_separators): use IO#gets with length
- parameter to get rid of wrong conversion.
+ parameter to get rid of wrong convertion.
* lib/csv.rb (CSV::foreach, CSV#initialize): directly use encoding
@@ -8382,7 +8382,7 @@ Tue Dec 14 14:24:15 2010 NAKAMURA Usaku <usa@ruby-lang.org>
to 'test_io' because the old one is meaningless and inconvenient.
* test/ruby/test_io.rb (test_binmode_after_closed): the temporary file
- made by make_temfile is already closed.
+ maked by make_temfile is already closed.
Tue Dec 14 13:52:19 2010 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -22363,7 +22363,7 @@ Tue Sep 29 22:19:36 2009 Tanaka Akira <akr@fsij.org>
Tue Sep 29 21:16:35 2009 NARUSE, Yui <naruse@ruby-lang.org>
- * io.c (rb_scan_open_args): add UTF8-MAC to no-conversion encoding.
+ * io.c (rb_scan_open_args): add UTF8-MAC to no-convertion encoding.
Tue Sep 29 21:21:15 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -33712,7 +33712,7 @@ Thu Dec 25 14:51:43 2008 NAKAMURA Usaku <usa@ruby-lang.org>
Thu Dec 25 14:32:23 2008 Koichi Sasada <ko1@atdot.net>
* vm_insnhelper.c (vm_method_search): fix control flow bug.
- (committed at r20981)
+ (commited at r20981)
Thu Dec 25 13:28:20 2008 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -71774,7 +71774,7 @@ Wed Mar 1 17:13:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
Thu Mar 2 17:54:45 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * gc.c: committed magic for reducing RVALUE size on windows. (24->20byte)
+ * gc.c: commited magic for reducing RVALUE size on windows. (24->20byte)
[ruby-core:7474]
Thu Mar 2 14:12:26 2006 Tanaka Akira <akr@m17n.org>
@@ -73761,7 +73761,7 @@ Fri Oct 21 15:42:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* ext/socket/extconf.rb: BeOS is only one platform should call
closesocket, so check __BEOS__ macro directly. (I was worried
- accidentally HAVE_CLOSESOCKET is defined on windows again because
+ accidently HAVE_CLOSESOCKET is defined on windows again because
it has it)
* ext/socket/{getaddrinfo.c,socket.c}: ditto.
@@ -73770,7 +73770,7 @@ Fri Oct 21 15:42:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
Fri Oct 21 15:23:23 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * bignum.c (bignew_1): conversion from `int' to `char' discards
+ * bignum.c (bignew_1): convertion from `int' to `char' discards
upper bits, (ie. (char)0xff00 -> 0) so it's better to test if
nonzero and set 0 or 1 instead of simply casting ... as a flag usage.
(but I believe this won't cause actual bug in current implementation)
@@ -74937,7 +74937,7 @@ Mon Sep 12 20:32:00 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
Mon Sep 12 19:58:53 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * dln.c: avoid warning of const to non-const conversion.
+ * dln.c: avoid warning of const to non-const convertion.
[ruby-dev:27041]
* eval.c, io.c, ruby.c: ditto.
@@ -83155,7 +83155,7 @@ Thu Aug 19 16:29:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: Fail to treat a hash value of 'font' option.
- * ext/tk/lib/tk.rb: bindinfo cannot return '%' substiturion information.
+ * ext/tk/lib/tk.rb: bindinfo cannot return '%' substiturion infomation.
* ext/tk/lib/menu.rb: typo bug.
@@ -83584,7 +83584,7 @@ Wed Jul 14 18:05:21 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
Wed Jul 14 12:20:05 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* util.c (ruby_strtod): should not convert string in the form of
- "-I.FE-X" which both "I" and "F" are omitted. [ruby-dev:23883]
+ "-I.FE-X" which both "I" and "F" are ommitted. [ruby-dev:23883]
* test/ruby/test_float.rb (test_strtod): add test for bug fix.
@@ -84298,7 +84298,7 @@ Sat May 22 11:54:10 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat May 22 05:37:11 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/remote-tk.rb: (NEW library) control Tk interpreters
+ * ext/tk/lib/remote-tk.rb: (NEW library) controll Tk interpreters
on the other processes by Tcl/Tk's 'send' command
Fri May 21 09:22:05 2004 Dave Thomas <dave@pragprog.com>
@@ -85607,10 +85607,10 @@ Wed Mar 17 00:22:03 2004 Kazuo Saito <ksaito@uranus.dti.ne.jp>
Tue Mar 16 11:14:17 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* dir.c (fnmatch_helper): File.fnmatch('\.', '.') should return true.
- (Rev1.112 lost compatibility)
+ (Rev1.112 lost compatiblity)
* dir.c (fnmatch_helper): File.fnmatch('\/', '/', File::FNM_PATHNAME)
- should return true. (Rev1.112 lost compatibility)
+ should return true. (Rev1.112 lost compatiblity)
* dir.c (fnmatch): File.fnmatch('**/.boo', '.foo/.boo',
File::FNM_PATHNAME) should return false because of leading period.
@@ -86434,7 +86434,7 @@ Mon Feb 16 22:22:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
Mon Feb 16 20:28:52 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * bcc32/Makefile.sub: show more warnings. (referring to mingw)
+ * bcc32/Makefile.sub: show more warnings. (refering to mingw)
* bcc32/setup.mak: ditto.
@@ -86492,7 +86492,7 @@ Mon Feb 16 12:29:10 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
Mon Feb 16 10:29:52 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* dir.c (CompareImpl): File.fnmatch and Dir.glob get better performance
- in Win32. This is achieved by calling downcase() for single-byte
+ in Win32. This is achived by calling downcase() for single-byte
characters. (CharLower() is slower than downcase())
Mon Feb 16 02:14:29 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
@@ -86561,7 +86561,7 @@ Sat Feb 14 11:14:12 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
Fri Feb 13 21:51:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * lib/fileutils.rb: slightly improved documentation (sync with 1.8)
+ * lib/fileutils.rb: slighly improved documentation (sync with 1.8)
Fri Feb 13 19:57:01 2004 Kouhei Sutou <kou@cozmixng.org>
@@ -86877,7 +86877,7 @@ Sun Feb 1 18:21:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
Sun Feb 1 05:30:06 2004 Tanaka Akira <akr@m17n.org>
* lib/open-uri.rb (URI::Generic#find_proxy): warn HTTP_PROXY.
- raise an error on non-http proxy URI.
+ raise an errror on non-http proxy URI.
(OpenURI::Buffer#<<): make a tempfile binmode. [ruby-talk:90793]
Sun Feb 1 00:57:41 2004 Kouhei Sutou <kou@cozmixng.org>
@@ -89179,7 +89179,7 @@ Thu Nov 27 22:05:48 2003 Akinori MUSHA <knu@iDaemons.org>
Thu Nov 27 17:36:42 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkafter.rb: bug fix on TkTimer#cancel_on_exception=(mode).
- TkTimer#wait receives the exception of the callback.
+ TkTimer#wait recieves the exception of the callback.
The exception is kept on @return_value.
Thu Nov 27 16:58:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
diff --git a/doc/ChangeLog-2.1.0 b/doc/ChangeLog-2.1.0
deleted file mode 100644
index f80b2d6bd1..0000000000
--- a/doc/ChangeLog-2.1.0
+++ /dev/null
@@ -1,18060 +0,0 @@
-Fri Dec 20 17:52:50 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_method.c: check definition of
- GLOBAL_METHOD_CACHE_SIZE and GLOBAL_METHOD_CACHE_MASK.
-
-Fri Dec 20 17:03:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into
- RB_OBJ_WRITE and RB_OBJ_WRITTEN.
-
- * array.c, class.c, compile.c, hash.c, internal.h, iseq.c,
- proc.c, process.c, re.c, string.c, variable.c, vm.c,
- vm_eval.c, vm_insnhelper.c, vm_insnhelper.h,
- vm_method.c: catch up this change.
-
-Fri Dec 20 16:01:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: add a comment for WB interfaces.
-
-Fri Dec 20 16:00:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: DLDFLAGS is defined in --with-opt-dir handler, so
- ${DLDFLAGS=} does not work now. use RUBY_APPEND_OPTIONS instead.
- [ruby-dev:47855] [Bug #9256]
-
-Fri Dec 20 14:19:12 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (AC_ARG_WITH): use withval directly.
- fix failure on FreeBSD.
- http://fb32.rubyci.org/~chkbuild/ruby-trunk/log/20131217T070301Z.diff.html.gz
-
-Fri Dec 20 14:00:01 2013 Aman Gupta <ruby@tmm1.net>
-
- * include/ruby/ruby.h (struct RClass): add super, remove iv_index_tbl.
- since RCLASS_SUPER() is commonly used inside while loops, we move it
- back inside struct RClass to improve cache hits. this provides a
- small improvement (1%) in hotspots like rb_obj_is_kind_of()
- * internal.h (struct rb_classext_struct): remove super, add
- iv_index_table
- * internal.h (RCLASS_SUPER): update for new location
- * internal.h (RCLASS_SET_SUPER): ditto
- * internal.h (RCLASS_IV_INDEX_TBL): ditto
- * object.c (rb_class_get_superclass): ditto
- * include/ruby/backward/classext.h (RCLASS_SUPER): ditto
-
-Fri Dec 20 07:07:35 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 03d6ae7. Changes include:
-
- * Fixed typos.
-
- * Relaxed Gem.ruby test for ruby packagers that do not use `ruby`.
-
- * test/rubygems: ditto.
-
-Thu Dec 19 14:03:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_get_freeobj): improve hot path performance.
-
- * gc.c (heap_get_freeobj_from_next_freepage): replace with
- heap_get_freepage(). It returns freeobj instead of freepage.
- This is not on hot path.
-
-Thu Dec 19 12:05:17 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master af60443. Changes include:
-
- * Improved speed of `gem install --ignore-dependencies`.
-
- * Open read-write for exclusive flock. [ruby-trunk - Bug #9257]
-
- * Remove specification before install to prevent infinite loop.
-
-Thu Dec 19 11:23:49 2013 Aman Gupta <ruby@tmm1.net>
-
- * vm_insnhelper.c (vm_call_iseq_setup_normal): simple for loop
- condition optimization. this area shows up as a hotspot in VM
- profiles.
-
-Thu Dec 19 10:50:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (newobj_of): don't need to RBASIC_SET_CLASS() which includes WB
- here because created obj is always YOUNG/INFANT.
-
-Thu Dec 19 10:48:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: check GC::OPTS availability
- for not MRI 2.1.0.
-
-Thu Dec 19 03:10:30 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (heap_get_freeobj): remove redundant assignment. heap->freelist
- is set after the while() loop already.
-
-Thu Dec 19 01:54:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/runner.rb: fix commit miss on r44278.
-
-Thu Dec 19 00:26:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect_body): lazy_sweep setting should work
- without USE_RGENGC.
-
-Wed Dec 18 23:31:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_dump_major_reason): fix this function because major_reason
- can be OR of multiple reasons.
-
- * gc.c (gc_profile_dump_on): ditto.
-
-Wed Dec 18 17:03:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_record_get): should return an empty array
- when profiling is active.
-
-Wed Dec 18 16:49:40 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_clear, gc_profile_enable): remove rest_sweep().
-
- * gc.c: check objspace->profile.current_record before inserting
- profiling record by new macro gc_prof_enabled().
-
-Wed Dec 18 14:32:06 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_exec.h (VM_DEBUG_STACKOVERFLOW): added.
- disable stack overflow check for every stack pushing as default.
-
- * vm_exec.c (vm_stack_overflow_for_insn): ditto.
-
-Wed Dec 18 10:00:22 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master d8f12e2. This increases the
- speed of `gem install --ignore-dependencies` which helps bundler
- tests.
- * test/rubygems: ditto.
-
-Wed Dec 18 09:00:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb (test_expand_heap): allow +/-1 diff.
-
-Tue Dec 17 23:44:15 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/ruby/test_io.rb: fix duplicated test name.
-
-Tue Dec 17 20:15:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_reject): revert to deprecated behavior, with
- warnings, due to compatibility for HashWithDifferentAccess.
- [ruby-core:59154] [Bug #9223]
-
-Tue Dec 17 17:30:56 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el: Import version 2.1.1 from
- https://github.com/knu/ruby-electric.el.
-
- * ruby-electric-delete-backward-char: Enable support for number
- prefix.
-
- * ruby-electric-curlies: Fix electric operation after an open
- curly.
-
-Tue Dec 17 16:19:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_trace.c (rb_postponed_job_flush): isolate exceptions in
- postponed jobs and restore outer ones. based on a patch by
- tarui. [ruby-core:58652] [Bug #9168]
-
-Tue Dec 17 10:48:04 2013 Aman Gupta <ruby@tmm1.net>
-
- * configure.in (RUBY_DTRACE_POSTPROCESS): Fix compatibility with
- systemtap on linux. stap requires `dtrace -G` post-processing, but
- the dtrace compatibility wrapper is very strict about probes.d
- syntax.
-
-Tue Dec 17 05:18:17 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 1c5f4b3. Allows rubygems
- repackagers to disable backward-compatible shared gem directory
- behavior.
- * test/rubygems: ditto.
-
-Tue Dec 17 05:14:35 2013 Eric Hodel <drbrain@segment7.net>
-
- * NEWS (RDoc): Update version number so I don't have to change it
- for the final release.
-
-Mon Dec 16 19:19:19 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_markable_object_p): should check special_const_p
- first (by is_markable_object()).
-
-Mon Dec 16 19:12:54 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c (reachable_object_from_root_i): use
- compare_by_identity hash to avoid hash modify problem
- during iteration.
- [Bug #9252]
-
- * ext/objspace/objspace.c (reachable_objects_from_root): ditto.
-
-Mon Dec 16 18:16:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_verify_internal_consistency): should not use
- rb_objspace_each_objects() because it call rest_sweep().
-
-Mon Dec 16 18:07:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_markable_object_p): fix last commit (build error).
-
-Mon Dec 16 18:04:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_markable_object_p): it should be live objects.
-
-Mon Dec 16 18:00:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_each_objects): should not clear dont_lazy_sweep
- flag in nested case.
-
-Mon Dec 16 16:40:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_method.c (rb_method_entry_make): fix WB miss.
- Note that rb_method_entry_t::klass is not constified.
- We may constify this field.
-
- * test/ruby/test_alias.rb: add a test.
-
-Mon Dec 16 14:14:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: use gc_verify_internal_consistency() instead of
- gc_check_before_marks_i() for check consistency
- on RGENGC_CHECK_MODE >= 2.
-
-Mon Dec 16 14:01:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * process.c (make_clock_result): add :second as a unit for
- Process.clock_gettime.
-
-Mon Dec 16 13:10:54 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: introduce GC.verify_internal_consistency method to verify GC
- internal data structure.
-
- Now this method only checks generation (old/young) consistency.
-
-Mon Dec 16 11:49:26 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (gc_info_decode): Fix build errors when compiled with
- RGENGC_ESTIMATE_OLDMALLOC=0
- * gc.c (objspace_malloc_increase): ditto
-
-Sun Dec 15 13:38:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c (reachable_object_from_root_i):
- reachable objects should not include categories and
- category_objects because it is noisy information.
-
- In fact, objects created after calling
- ObjectSpace.reachable_objects_from_root should not be included
- as a returning hash objects. Currently, mswin64 platform has a
- problem because of this behavior. Should we trace new objects?
-
-Sun Dec 15 07:09:28 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc master 263a9e5. This improves the
- accessibility of the search box.
-
-Sat Dec 14 17:39:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_arg_complex): count post
- arguments as mandatory arguments. [ruby-core:57706] [Bug #8993]
-
- * vm_insnhelper.c (vm_yield_setup_block_args): ditto.
-
-Sat Dec 14 16:26:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rubylibprefix): replace exec_prefix as well as
- bindir and libdir. a patch by kimuraw (Wataru Kimura) at
- [ruby-dev:47852]. [Bug #9160]
-
-Sat Dec 14 14:42:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/logger.rb (lock_shift_log): no need to rotate the log file
- if it has been rotated by another process. based on the patch
- by no6v (Nobuhiro IMAI) in [ruby-core:58620]. [Bug #9133]
-
-Sat Dec 14 13:01:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mnew_from_me): method by respond_to_missing? should be
- owned by the original class.
-
-Sat Dec 14 11:55:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/scanf.rb (IO#scanf): fix mistaken use of rescue modifier.
- a patch by Mon_Ouie at [ruby-core:52813]. [Bug #7940]
-
-Sat Dec 14 11:44:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * util.c (ruby_qsort): fix potential stack overflow on a large
- machine. based on the patch by Conrad Irwin <conrad.irwin AT
- gmail.com> at [ruby-core:51816]. [Bug #7772]
-
-Sat Dec 14 11:25:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_defined): support nested class path as
- well as const_get. [Feature #7414]
-
-Sat Dec 14 01:31:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_rescue2): reuse tags pushed for body proc to protect
- rescue proc too.
-
-Sat Dec 14 01:15:51 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (wmap_final_func): Bugfix. Should update *value to new pointer.
-
-Sat Dec 14 01:05:46 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/lib/socket.rb: Don't test $! in "ensure" clause because
- it may be set before the body.
- Reported by ko1 and mrkn. [ruby-core:59088] [Bug #9247]
-
- * lib/cgi/core.rb: Ditto.
-
- * lib/drb/ssl.rb: Ditto.
-
-Sat Dec 14 00:34:31 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * internal.h (ruby_sized_xrealloc2): fix typo introduced in r44117,
- which cause compile error on Solaris.
-
-Sat Dec 14 00:22:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c: (exec_recursive): use rb_catch_protect() instead of
- rb_catch_obj() and PUSH_TAG(), and reduce pushing tags and
- machine stack usage.
-
-Sat Dec 14 00:18:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mnew_from_me): achieve the original defined_class from
- prepended iclass, to fix inherited owner.
-
- * proc.c (method_owner): return the defined class, but not the
- class which the method object is created from.
-
-Fri Dec 13 22:29:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (method_owner): return the class where alias is defined, not
- the class original method is defined.
-
- * vm_method.c (rb_method_entry_make, rb_alias): store the originally
- defined class in me. [Bug #7993] [Bug #7842] [Bug #9236]
-
- * vm_method.c (rb_method_entry_get_without_cache): cache included
- module but not iclass.
-
-Fri Dec 13 16:27:17 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (gc_info_decode): Use :major_by=>:nofree as fallback reason
- when other trigger conditions are present.
-
-Fri Dec 13 13:25:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * error.c: add Exception#backtrace_locations.
- Now, there are no setter and independent from Exception#backtrace.
- [Feature #8960]
-
- * eval.c (setup_exception): set backtrace locations for `bt_location'
- special attribute.
-
- * vm_backtrace.c (rb_backtrace_to_location_ary): added.
-
- * internal.h: ditto.
-
- * test/ruby/test_backtrace.rb: add a test for
- Exception#backtrace_locations.
-
-Fri Dec 13 12:01:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect_body): use rb_bug() and explicit error message
- instead of using assert().
- [Bug #9222]
-
-Fri Dec 13 11:52:41 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c: fix comment to remove the word "shady".
-
- * variable.c: ditto.
-
-Fri Dec 13 11:33:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename *shady* func/macros.
- * RVALUE_RAW_SHADY() -> RVALUE_WB_PROTECTED_RAW()
- * RVALUE_SHADY() -> RVALUE_RAW_SHADY()
- * rgengc_check_shady() -> rgengc_check_relation().
- And fix some messages using "shady" to "non-WB-protected".
-
-Fri Dec 13 10:04:23 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/request_set/lockfile.rb: Import RubyGems master a8d0669
- with a 1.8.7 compatibility fix.
- * test/rubygems/test_gem_request_set_lockfile.rb: ditto.
-
-Fri Dec 13 09:50:49 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master ddac51f. Changes:
-
- * Allow override for the shared gem installation directory for
- rubygems packagers.
-
- * Lock gem cache files for read and write to improve thread safety.
-
- * Use io/console when available.
-
- * Minor cleanup.
-
- * test/rubygems: ditto.
-
-Fri Dec 13 08:15:31 2013 Aman Gupta <ruby@tmm1.net>
-
- * class.c (include_modules_at): use RCLASS_M_TBL_WRAPPER for
- equality checks. this avoids an unnecessary deference inside a tight
- loop, fixing a performance regression from r43973.
- * object.c (rb_obj_is_kind_of): ditto.
- * object.c (rb_class_inherited_p): ditto.
-
-Wed Dec 13 02:00:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (VpSetPTR): fix for limitation of the resulting
- precision.
- [ruby-core:50269] [Bug #7458]
-
- * test/bigdecimal/test_bigdecimal.rb (test_limit): add tests for the above
- change.
-
-Wed Dec 13 01:56:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (VpAddAbs): put out a conditional branch from
- the inside of while-loop.
-
- * ext/bigdecimal/bigdecimal.c (VpSubAbs): ditto.
-
-Wed Dec 13 01:53:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (VPrint): be a static function, support another
- dump formats, and add more information of the given bigdecimal.
-
- * ext/bigdecimal/bigdecimal.h: ditto.
-
-Wed Dec 11 16:45:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * eval.c (rb_raise_jump): call c_return hook immediately after
- popping `raise' frame.
- Patches by deivid (David Rodriguez). [Bug #8886]
-
- * test/ruby/test_settracefunc.rb: catch up this fix.
-
-Wed Dec 11 16:01:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_reject): return a plain hash, without copying
- the class, default value, instance variables, and taintedness.
- they had been copied just by accident.
- [ruby-core:59045] [Bug #9223]
-
-Wed Dec 11 15:36:15 2013 Aman Gupta <ruby@tmm1.net>
-
- * compile.c (iseq_specialized_instruction): emit opt_aset instruction
- to optimize Hash#[]= and Array#[]= when called with Fixnum argument.
- [Bug #9227] [ruby-core:58956]
-
-Wed Dec 11 04:54:03 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master ec8ed22. Notable changes
- include:
-
- * Renamed extension_install_dir to extension_dir (backwards
- compatible).
-
- * Fixed creation of gem.deps.rb.lock file from
- TestGemRequestSet#test_install_from_gemdeps_install_dir
-
- * Fixed a typo and some documentation.
-
- * test/rubygems: ditto.
-
-Wed Dec 11 03:18:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * insns.def: Fix optimization bug of Float#/ [Bug #9238]
-
-Tue Dec 10 23:58:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/date/date_strptime.c (date__strptime_internal): unset
- case-insensitive flag for [:alpha:], which already implies both
- cases, to get rid of backtrack explosion. [ruby-core:58984]
- [Bug #9221]
-
-Tue Dec 10 23:44:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_hash): add salt to differentiate false and empty
- array. [ruby-core:58993] [Bug #9231]
-
- * hash.c (rb_any_hash, rb_hash_hash): ditto.
-
-Tue Dec 10 18:16:09 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * man/ruby.1: [DOC] Use www.ruby-toolbox.com instead of RAA.
-
-Tue Dec 10 17:21:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (wmap_finalize, wmap_aset_update): use simple malloced array
- instead of T_ARRAY, to reduce GC pressure.
-
-Tue Dec 10 15:56:48 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (reflist_add): revert changes from r44109. it is unnecessary
- after r44113
- * gc.c (allrefs_i): fix whitespace
- * gc.c (allrefs_roots_i): fix whitespace
-
-Tue Dec 10 15:46:03 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (allrefs_add): push obj only if allrefs table doesn't have
- obj.
-
- * gc.c (allrefs_roots_i): ditto.
-
-Tue Dec 10 15:28:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (RGENGC_CHECK_MODE): separate checkers to different modes.
- * 2: enable generational bits check (for debugging)
- * 3: enable livness check
- * 4: show all references
-
-Tue Dec 10 15:15:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_marks_check): disable GC during checking and
- restore malloc_increase info.
-
-Tue Dec 10 14:41:53 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (reflist_add): return 0 if reference already exists
- * gc.c (allrefs_add): return 1 on newly added references
- * gc.c (allrefs_i): follow references to construct complete object
- graph. before this patch, RGENGC_CHECK could fail to verify some WB
- miss issues. [Bug #9226] [ruby-core:58959]
-
-Tue Dec 10 11:20:56 2013 Aman Gupta <ruby@tmm1.net>
-
- * ext/objspace/objspace_dump.c (dump_object): include fstring flag on
- strings. include gc flags (old, remembered, wb_protected) on all objects.
- * ext/objspace/objspace_dump.c (Init_objspace_dump): initialize lazy
- IDs before first use.
- * gc.c (rb_obj_gc_flags): new function to retrieve object flags
- * internal.h (RB_OBJ_GC_FLAGS_MAX): maximum flags allowed for one obj
- * test/objspace/test_objspace.rb (test_dump_flags): test for above
- * test/objspace/test_objspace.rb (test_trace_object_allocations):
- resolve name before dump (for rb_class_path_cached)
-
-Tue Dec 10 07:48:29 2013 Aman Gupta <ruby@tmm1.net>
-
- * vm_method.c (rb_clear_method_cache_by_class): fire
- ruby::method-cache-clear probe on global or klass-level method cache
- clear [Bug #9190]
- * probes.d (provider ruby): new dtrace probe
- * doc/dtrace_probes.rdoc: docs for new probe
- * test/dtrace/test_method_cache.rb: test for new probe
-
-Tue Dec 10 06:14:11 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/.document: Remove curses from documentable directories.
-
-Tue Dec 10 04:55:36 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/digest.rb: Deprecate OpenSSL::Digest::Digest
- [Fixes GH-446] https://github.com/ruby/ruby/pull/446
-
-Tue Dec 10 00:41:42 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/thread/thread.c: [DOC] add call-seq alias for Queue#enq, #<<, etc.
-
- * ext/thread/thread.c (Init_thread): use rb_define_alias instead of
- rb_alias to document alias.
-
-Mon Dec 9 20:00:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * internal.h (RCLASS_SERIAL): Add RCLASS_SERIAL as a convenience
- accessor for RCLASS_EXT(klass)->class_serial.
-
- * class.c, vm_insnhelper.c, vm_method.c: Use RCLASS_SERIAL
-
-Mon Dec 9 19:50:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,
- vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial
- to global_method_state and constant_serial to global_constant_state
- after discussion with ko1.
-
-Mon Dec 9 18:50:43 2013 Aman Gupta <ruby@tmm1.net>
-
- * hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced
- in r44060 [Bug #9230] [ruby-core:58991]
- * test/ruby/test_hash.rb: regression test for above
-
-Mon Dec 9 18:10:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (vm_stat): renamed from ruby_vm_stat.
- Should not use ruby_ prefix here.
-
-Mon Dec 9 16:13:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (wmap_size): add ObjectSpace::WeakMap#size and #length.
-
-Mon Dec 9 15:26:17 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/test_curses.rb: removed.
-
-Mon Dec 9 13:36:55 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/curses, sample/curses: removed curses.
-
- * NEWS: added an entry for the above change.
-
-Mon Dec 9 12:26:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/objspace/object_tracing.c (newobj_i): use cached class path
- only to get rid object allocation during NEWOBJ hook.
- [ruby-core:58853] [Bug #9212]
-
- * variable.c (rb_class_path_cached): returns cached class path
- only, without searching and allocating new class path string.
-
-Mon Dec 9 11:14:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/date/date_parse.c (parse_time): unset case-insensitive flag
- for [:alpha:], which already implies both cases, to get rid of
- backtrack explosion. [ruby-core:58876] [Bug #9221]
-
-Mon Dec 9 08:40:40 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master bf37240. Fixes useless
- error message with `gem install -g` with no gem dependencies file.
- * test/rubygems: ditto.
-
-Mon Dec 9 04:52:25 2013 Eric Hodel <drbrain@segment7.net>
-
- * NEWS: Update RubyGems entry with notable features.
-
-Mon Dec 9 04:43:54 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/.document: Add syslog/lib and thread/thread.c to documentable
- items. [ruby-trunk - Bug #9228]
-
-Mon Dec 9 04:28:50 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 096db36. Changes include
- support for PATH in Gemfile.lock and a typo fix from Akira Matsuda.
- * test/rubygems: ditto.
-
-Mon Dec 9 02:10:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/responses.rb:
- Add `HTTPIMUsed`, as it is also supported by rack/rails.
- RFC - http://tools.ietf.org/html/rfc3229
- by Vipul A M <vipulnsward@gmail.com>
- https://github.com/ruby/ruby/pull/447 fix GH-447
-
-Sun Dec 8 20:47:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_get_kwargs): when values is non-null, remove
- extracted keywords from the rest keyword argument.
-
-Sun Dec 8 20:26:54 2013 Yutaka Kanemoto <kanemoto@ruby-lang.org>
-
- * common.mk (ruby.imp): avoid circular dependency on AIX
-
-Sun Dec 8 20:21:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * bigdecimal.c (BigDecimal_coerce): convert a Float to a BigDecimal instead
- of converting the receiver to a Float. The reason is there are BigDecimal
- instances with precisions that is smaller than the Float's precision.
- [ruby-core:58756] [Bug #9192]
-
- * test/bigdecimal/test_bigdecimal.rb: add tests for the above change.
-
-Sun Dec 8 18:28:20 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * NEWS: [DOC] update NEWS about GC.
-
-Sun Dec 8 17:52:24 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * object.c: [DOC] document Module#singleton_class?.
-
-Sun Dec 8 16:19:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_get_kwargs): if optional is negative, unknown
- keywords are allowed.
-
- * vm_insnhelper.c (vm_callee_setup_keyword_arg): check unknown
- keywords.
-
-Sun Dec 8 14:55:12 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * array.c (rb_ary_shuffle_bang, rb_ary_sample): rename local variables.
-
-Sun Dec 8 13:59:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * array.c (rb_ary_shuffle_bang, rb_ary_sample): check
- unknown keywords.
-
- * test/ruby/test_array.rb (test_shuffle, test_sample): tests for
- the above.
-
-Sun Dec 8 13:01:11 2013 Aman Gupta <ruby@tmm1.net>
-
- * vm.c (ruby_vm_stat): add RubyVM.stat() for access to internal cache
- counters. this methods behaves like GC.stat, accepting an optional
- hash or symbol argument. [Bug #9190] [ruby-core:58750]
- * test/ruby/test_rubyvm.rb: test for new method
-
-Sun Dec 8 11:59:40 2013 Aman Gupta <ruby@tmm1.net>
-
- * hash.c (rb_hash_replace): add a write barrier to fix GC mark miss on
- hashes using Hash#replace [Bug #9226] [ruby-core:58948]
-
-Sun Dec 8 11:21:00 2013 Aman Gupta <ruby@tmm1.net>
-
- * include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting
- In a large app, this reduces the size of
- remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947]
- * gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF
- * class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF
- * iseq.c (set_relation): ditto
- * iseq.c (rb_iseq_clone): ditto
- * vm_eval.c (rb_yield_refine_block): ditto
- * vm_insnhelper.c (vm_cref_push): ditto
- * vm_insnhelper.h (COPY_CREF): ditto
-
-Sun Dec 8 10:45:05 2013 Aman Gupta <ruby@tmm1.net>
-
- * hash.c (hash_aset_str): revert r43870 due to performance issue
- [Bug #9188] [ruby-core:58730]
- * parse.y (assoc): convert literal string hash keys to fstrings
- * test/ruby/test_hash.rb (class TestHash): expand test
-
-Sun Dec 8 10:22:38 2013 Aman Gupta <ruby@tmm1.net>
-
- * parse.y (register_symid_str): use fstrings in symbol table
- [Bug #9171] [ruby-core:58656]
- * parse.y (rb_id2str): ditto
- * string.c (rb_fstring): create frozen_strings on first usage. this
- allows rb_fstring() calls from the parser (before cString is created)
- * string.c (fstring_set_class_i): set klass on fstrings generated
- before cString was defined
- * string.c (Init_String): convert frozen_strings table to String
- objects after boot
- * ext/-test-/symbol/type.c (bug_sym_id2str): expose rb_id2str()
- * test/-ext-/symbol/test_type.rb (module Test_Symbol): verify symbol
- table entries are fstrings
-
-Sun Dec 8 10:24:20 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Update version for upcoming ruby 2.1.0 RC.
-
-Sun Dec 8 10:21:36 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 14749ce. This fixes bugs
- handling of gem dependencies lockfiles (Gemfile.lock).
-
- * test/rubygems: ditto.
-
-Sun Dec 8 09:40:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
-
- * process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
- barriers where appropriate
-
- * vm.c (kwmerge_i): use RHASH_TBL_RAW
-
- * vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
- st_insert
-
-Sat Dec 7 11:15:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_reject): copy unrejected elements only to new hash,
- so that the change on the original receiver can affect.
- [ruby-core:58914] [Bug #9223]
-
-Sat Dec 7 08:25:00 2013 Richo Healey <richo@psych0tik.net>
-
- * test/ruby/test_struct.rb: Add regression test for question marks and
- bangs in struct members. [Closes GH-468]
-
-Fri Dec 6 19:33:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_extract_keywords, rb_get_kwargs): move from
- vm_insnhelper.c.
-
-Fri Dec 6 19:18:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change oldmalloc meaning.
- Increase oldmalloc_increase with malloc_increase
- instead of using obj_memsize_of().
-
- This change will avoid the danger of memory full without major GC.
-
-Fri Dec 6 19:08:48 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (atomic_sub_nounderflow): not 0 but val itself.
-
-Fri Dec 6 18:37:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_alloc, Init_heap): initialize
- oldmalloc_increase_limit at Init_heap.
-
- rb_objspace_alloc() is not called on some platforms.
-
-Fri Dec 6 18:33:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect_body): bug fix.
- initialize after recording.
-
-Fri Dec 6 17:49:46 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (atomic_sub_nounderflow): added to simplify atomic sub with
- care about underflow.
-
- * gc.c (objspace_malloc_increase): use it.
-
-Fri Dec 6 17:10:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (rb_get_kwargs): get keyword argument values from an
- option hash, not only checking keys.
-
- * dir.c (dir_initialize): use rb_get_kwargs.
-
- * gc.c (gc_start_internal): ditto.
-
-Fri Dec 6 16:47:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-brace-to-do-end): split single line block.
-
- * misc/ruby-mode.el (ruby-do-end-to-brace): shrink single line block
- to one line.
-
-Fri Dec 6 16:16:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_start_internal): do not use rb_gc_start() and rb_gc().
-
-Fri Dec 6 15:24:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_start_internal, rb_gc): do not need
- heap_pages_free_unused_pages() here.
- It was done in after_sweep().
-
- * gc.c (rb_gc): The reason is now GPR_FLAG_CAPI.
-
-Fri Dec 6 14:05:19 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (gc_start_internal): GC.start() now accepts two optional
- keyword arguments. These can be used to disable full_mark (minor
- mark only) or disable immediate_sweep (use lazy sweep). These new
- options are useful for benchmarking GC behavior, or performing minor
- GC out-of-band.
- * test/ruby/test_gc.rb (class TestGc): tests for new options.
-
-Fri Dec 6 11:51:28 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/erb.rb: [DOC] fix broken link, Use rubygems.org and www.ruby-toolbox.com instead of RAA.
- [Bug #9197]
-
-Fri Dec 6 10:50:54 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/webrick/httprequest.rb: [DOC] Fix broken link of CGI specification by @udzura [fix GH-466]
-
-Thu Dec 6 01:27:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec):
- treat 0.0 and -0.0 of floating-point numbers specially for an optimization
- and to correctly propagate its signbit to the result.
- [Bug #9214] [ruby-core:58858]
-
- * test/bigdecimal/test_bigdecimal.rb: add tests case for the above change.
-
- * test/bigdecimal/test_bigdecimal_util.rb: ditto.
-
-Thu Dec 5 22:18:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (configuration): strip destdir part from prefix to get
- rid of duplication. a patch by arton at [ruby-core:58859].
- [ruby-core:58856] [Bug #9213]
-
-Thu Dec 5 21:53:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_or): lhs elements are preferred, so should not
- replace with rhs elements.
-
- * test/ruby/test_array.rb (test_OR_in_order): import the test failed
- by r43969 from rubyspec/core/array/union_spec.rb.
-
-Thu Dec 5 21:05:42 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_info_decode): fix to avoid syntax error on VS2012.
-
-Thu Dec 5 19:35:35 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * st.c: tweaked comment
-
-Thu Dec 5 19:21:10 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (struct rb_objspace): rename internal last_collection_flags to
- latest_gc_info
- * gc.c (gc_latest_collection_info): add GC.latest_gc_info() with similar
- behavior to GC.stat()
- * gc.c (rb_gc_latest_gc_info): new c-api for above
- * gc.c (gc_stat_internal): remove :last_collection_flags from GC.stat
- * gc.c (gc_profile_decode_flags): remove GC::Profiler.decode_flags
- * include/ruby/intern.h (rb_gc_latest_gc_info): export new c-api
- * test/ruby/test_gc.rb (class TestGc): test for new behavior
- * NEWS: note about new api
-
- * gc.c (gc_stat_internal): raise TypeError on wrong type
- * gc.c (gc_stat): fix error message
-
-Thu Dec 5 18:18:08 2013 Aman Gupta <ruby@tmm1.net>
-
- * ext/objspace/gc_hook.c: remove this file
- * ext/-test-/tracepoint/gc_hook.c: new filename for above
- * ext/objspace/objspace.c: remove ObjectSpace.after_gc_start_hook=
- * test/objspace/test_objspace.rb: remove test
- * test/-ext-/tracepoint/test_tracepoint.rb: add above test for
- tracepoint re-entry
-
-Thu Dec 5 17:44:53 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change function names vm_ prefix to objspace_ prefix.
- They are objspace_ functionality.
-
-Thu Dec 5 16:11:04 2013 Aman Gupta <ruby@tmm1.net>
-
- * include/ruby/intern.h: add rb_gc_stat() for access to GC.stat
- variables from c-api
- * gc.c (rb_gc_stat): new c-api method. accepts either VALUE hash like
- GC.stat, or VALUE symbol key and returns size_t directly. the second
- form is useful to avoid allocations, i.e. for usage inside
- INTERNAL_EVENT_GC tracepoints.
- * gc.c (gc_stat): add GC.stat(:key) to return single value instead of hash
- * gc.c (gc_stat_internal): helper method to retrieve single or all stat values
- * test/ruby/test_gc.rb (class TestGc): test for new behavior
- * NEWS: note about this new api
-
-Thu Dec 5 14:40:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash): revert r43981 and bail out to the outermost frame
- when recursion is detected.
-
-Thu Dec 5 13:47:15 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (vm_malloc_size): added.
- return malloc_usable_size() if possible.
-
- * gc.c (MALLOC_ALLOCATED_SIZE): add new setting macro to enable
- GC.allocated_size.
- If platform supports `malloc_usable_size()' (or similar one),
- GC.allocated_size can be implemented with this function.
- Default is 0.
-
- * gc.c (vm_xmalloc, vm_xrealloc, vm_xfree): use vm_malloc_size()
- to detect collect allocated size.
-
- * gc.c (vm_malloc_increase): refactoring.
-
-Thu Dec 5 13:19:03 2013 Aman Gupta <ruby@tmm1.net>
-
- * include/ruby/ruby.h: remove INTERNAL_EVENT_GC_END and replace with
- two new events: GC_END_MARK and GC_END_SWEEP
- * gc.c (gc_after_sweep): emit GC_END_SWEEP after lazy sweep is done
- * gc.c (gc_marks_body): emit GC_END_MARK at end of minor/major mark
- * ext/-test-/tracepoint/tracepoint.c (struct tracepoint_track): tests
- for new events.
- * test/-ext-/tracepoint/test_tracepoint.rb (class TestTracepointObj):
- ditto.
- * NEWS: remove ObjectSpace.after_gc_*_hook. These are only a sample,
- and will be removed before ruby 2.1.
- * ext/objspace/gc_hook.c: remove ObjectSpace.after_gc_end_hook=
-
-Thu Dec 5 10:47:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby_atomic.h (ATOMIC_PTR_EXCHANGE): atomic exchange function for
- a generic pointer.
-
-Thu Dec 5 10:47:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (finalize_deferred): flush all deferred finalizers while other
- finalizers can get ready to run newly by lazy sweep.
- [ruby-core:58833] [Bug #9205]
-
-Thu Dec 5 09:07:59 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning
- settings can be applied before rb_safe_level() is available.
- * internal.h (rb_gc_set_params): ditto.
- * ruby.c (process_options): Apply GC tuning early during boot process
- so boot-time allocations can benefit. This also benefits any code
- loaded in via `ruby -r`.
-
-Wed Dec 4 13:02:13 2013 Aman Gupta <ruby@tmm1.net>
-
- * vm_trace.c (rb_suppress_tracing): Fix initialization of stack
- allocated rb_trace_arg_t structure. Without this patch, sometimes
- INTERNAL_EVENT_GC would be skipped accidentally inside
- rb_threadptr_exec_event_hooks_orig().
-
-Wed Dec 4 12:57:24 2013 Aman Gupta <ruby@tmm1.net>
-
- * string.c (fstr_update_callback): Improve implementation in r43968
- based on feedback from @nagachika. In the existing case, we can
- return ST_STOP to prevent any hash modification. In the !existing
- case, set both key and value to the fstr.
-
-Wed Dec 4 12:47:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/delegate.rb (Delegator#method_missing): ignore the target if not
- set, and delegate to global methods. [ruby-core:58572] [Bug #9155]
-
- * lib/delegate.rb (Delegator#respond_to_missing): ditto.
-
- * lib/delegate.rb (SimpleDelegator#__getobj__): yield and return if
- not delegated but a block is given, like as Hash#fetch.
-
- * lib/delegate.rb (DelegateClass#__getobj__): ditto.
-
-Tue Dec 3 23:48:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check malloc_size() availability.
-
- * gc.c: use malloc_size() with malloc/malloc.h if available.
-
-Tue Dec 3 23:06:20 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * object.c (rb_obj_clone): don't copy FL_WB_PROTECTED of a
- original object.
-
-Tue Dec 3 22:32:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_recursive): make similar (recursive) constructs
- return same hash value. execute recursively, and rewind to the
- topmost frame with an object which .eql? to the recursive
- object, if recursion is detected.
-
- * hash.c (rb_hash): detect recursion for all `hash' methods. each
- `hash' methods no longer need to use rb_exec_recursive().
-
-Tue Dec 3 21:53:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_catch_protect): new function similar to
- rb_catch_obj(), but protect from all global jumps like as
- rb_load_protect(), rb_protect(), etc.
-
-Tue Dec 3 20:18:46 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * object.c (rb_obj_clone): Protect FL_PROMOTED and FL_WB_PROTECTED
- flags of a destination object.
-
-Tue Dec 3 20:16:38 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_hash_rehash): use hash_alloc() instead of rb_hash_new(),
- to hide temporary object from ObjectSpace. [Bug #9187]
-
-Tue Dec 3 17:11:47 2013 Aman Gupta <ruby@tmm1.net>
-
- * load.c (features_index_add_single): Move loaded_features_index array values off
- the ruby heap. [Bug #9201] [ruby-core:58805]
- * load.c (loaded_features_index_clear_i): Clean up off-heap array structure.
- * vm.c (rb_vm_mark): Remove unnecessary mark_tbl for loaded_features_index.
- This improves minor GC time by 15% in a large application.
-
-Tue Dec 3 17:01:45 2013 Aman Gupta <ruby@tmm1.net>
-
- * include/ruby/ruby.h (struct RClass): Add wrapper struct around
- RClass->m_tbl with serial. This prevents double marking method
- tables, since many classes/modules can share the same method table.
- This improves minor mark time in a large application by 30%.
- * internal.h (struct method_table_wrapper): Define new
- wrapper struct with additional serial.
- * internal.h (RCLASS_M_TBL_INIT): New macro for initializing method
- table wrapper and st_table.
- * method.h (void rb_sweep_method_entry): Rename rb_free_m_table to
- rb_free_m_tbl for consistency
- * .gdbinit (define rb_method_entry): Update rb_method_entry gdb helper
- for new method table structure.
- * class.c: Use RCLASS_M_TBL_WRAPPER and
- RCLASS_M_TBL_INIT macros.
- * class.c (rb_include_class_new): Share WRAPPER between module and
- iclass, so serial can prevent double marking.
- * eval.c (rb_prepend_module): ditto.
- * eval.c (rb_using_refinement): ditto.
- * gc.c: Mark and free new wrapper struct.
- * gc.c (obj_memsize_of): Count size of additional wrapper struct.
-
-Tue Dec 3 14:05:49 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_uniq_bang): remove duplicate code.
-
-Tue Dec 3 13:40:42 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (ary_add_hash): set and return values because string keys
- will be frozen. [ruby-core:58809] [Bug #9202]
-
- * array.c (rb_ary_uniq_bang): ditto.
-
- * array.c (rb_ary_or): ditto.
-
- * array.c (rb_ary_uniq): ditto.
-
- * test/ruby/test_array.rb: tests for above.
-
- The patch is from normalperson (Eric Wong).
-
-Tue Dec 3 12:20:21 2013 Aman Gupta <ruby@tmm1.net>
-
- * string.c (rb_fstring): Use st_update instead of st_lookup +
- st_insert.
- * string.c (fstr_update_callback): New callback for st_update.
-
-Tue Dec 3 12:17:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rdoc/constant.rb (RDoc::Constant#documented?): workaround for
- NoMethodError when the original of alias is not found.
-
-Tue Dec 3 10:43:58 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/lib/openssl/buffering.rb: Return ASCII-8BIT strings from
- SSLSocket methods. [ruby-trunk - Bug #9028]
- * test/openssl/test_ssl.rb: Test for the above.
-
-Tue Dec 3 09:42:27 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc master 900de99. Changes include:
-
- Fixed documentation display of constants
-
- Fixed handling of unknown parsers
-
- * test/rdoc: ditto.
-
-Mon Dec 2 22:30:10 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * hash.c (getenv): fixed test failures introduced by r43950.
- [ruby-core:58774] [Bug #9195] reported by phasis68 (Heesob Park).
-
-Mon Dec 2 21:49:19 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_rehash): make temporary st_table under the control
- of GC. [Bug #9187]
-
- * test/ruby/test_hash.rb: add a test for above.
-
-Mon Dec 2 17:23:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * variable.c (rb_mod_constants): when calling Module#constants with
- inherit=false, there is no need to use a hashtable to deduplicate
- constant names. [Feature #9196] [ruby-core:58786]
-
-Mon Dec 2 14:16:52 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/smtp.rb (Net::SMTP#critical): Always return a
- Net::SMTP::Response. Patch by Pawel Veselov.
- [ruby-trunk - Bug #9125]
- * test/net/smtp/test_smtp.rb: Test for the above.
-
-Mon Dec 2 05:52:33 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master baa965b. Notable changes:
-
- Copy directories to lib/ when installing extensions. This completes
- the fix for [ruby-trunk - Bug #9106]
-
- * test/rubygems: ditto.
-
-Mon Dec 2 02:03:47 2013 Shota Fukumori <her@sorah.jp>
-
- * test/ruby/test_case.rb (test_nomethoderror):
- Add test related to r43913, r43914
-
-Mon Dec 2 00:53:01 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * hash.c (getenv): use ANSI codepage version of getenv() for miniruby
- on Windows.
- [ruby-core:58732] [Bug #9189] reported by phasis68 (Heesob Park).
-
-Sun Dec 1 22:14:27 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributors.rdoc: [DOC] Import contributors from redmine wiki
- Many wiki pages have become outdated and spam-ridden, we will import
- these to trunk and begin maintaining them in ruby-trunk. This will
- also allow new contributors to easily contribute patches to update
- these pages, where previously a redmine account with wiki access was
- required. Another bonus is having a contributors file to show thanks
- to all of the people who have submitted a patch to Ruby.
-
-Sun Dec 1 18:03:26 2013 Zachary Scott <e@zzak.io>
-
- * doc/maintainers.rdoc: [DOC] Current maintainers of Ruby
-
-Sun Dec 1 17:17:36 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Current branch maintainers
-
-Sun Dec 1 17:16:36 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Reporting other (ruby-lang.org) issues
-
-Sun Dec 1 17:15:51 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Current platform maintainers
-
-Sun Dec 1 17:14:55 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Reporting downstream distro issues
-
-Sun Dec 1 14:37:20 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_to_a): specify array capa.
-
-Sun Dec 1 14:15:36 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_rehash): fix to free new st_table when exception
- is raised in do_hash(). [Bug #9187]
-
-Sun Dec 1 11:57:59 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/buffering.rb: Fix warning in copyright
-
-Sun Dec 1 08:27:28 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 66e5c39. Notable changes:
-
- Implement gem.deps.rb (Gemfile) .lock support
-
- Fixed `gem uninstall` for a relative directory in GEM_HOME.
-
- * test/rubygems: ditto.
-
-Sun Dec 1 06:00:49 2013 Aman Gupta <ruby@tmm1.net>
-
- * test/ruby/test_gc.rb (test_gc_reason): Force minor GC by consuming
- free slots to fix test.
-
-Sat Nov 30 21:22:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_initialize): check unknown keywords. [ruby-dev:47152]
- [Bug #8060]
-
-Sat Nov 30 18:05:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32ole/win32ole.c (hash2named_arg): correct declaration to fix
- build failure. a patch by phasis68 (Heesob Park) at
- [ruby-core:58710]. [Bug #9184]
-
-Sat Nov 30 17:46:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (ruby_cleanup): determine exit status and signal to terminate
- before finalization, to get rid of access destroyed T_DATA exception
- object. [ruby-core:58643] [Bug #9167]
-
-Sat Nov 30 16:25:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (enumerator_with_index): should not store local variable
- address to memoize the arguments. it is invalidated after the return.
- [ruby-core:58692] [Bug #9178]
-
-Sat Nov 30 13:28:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * siphash.c (sip_hash24): fix for aligned word access little endian
- platforms. [ruby-core:58658] [Bug #9172]
-
-Sat Nov 30 13:21:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_yield_block): implement non-nil block argument.
-
-Fri Nov 29 20:59:39 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * vm_dump.c (rb_vmdebug_debug_print_pre): Bugfix. Get PC directly.
- PC is cached into local stack and cfp->pc is incorrect at next of
- branch or jump.
- * vm_exec.h (DEBUG_ENTER_INSN): catch up this change.
- * vm_core.h: update signature of rb_vmdebug_debug_print_pre.
-
-Fri Nov 29 20:43:57 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * compile.c: Bugsfix for dump_disasm_list.
- rb_inspect denies a hidden object. So, insert wrapper that creates
- the unhidden one.
- adjust->label is null sometimes.
- insn_data_line_no makes no sense at all.
-
-Fri Nov 29 18:06:45 2013 Shota Fukumori <her@sorah.jp>
-
- * test/ruby/test_case.rb (test_method_missing): Test for r43913.
-
-Fri Nov 29 17:53:22 2013 Shota Fukumori <her@sorah.jp>
-
- * vm_insnhelper.c (check_match): Fix SEGV with VM_CHECKMATCH_TYPE_CASE
- and class of `pattern` has `method_missing`
- [Bug #8872] [ruby-core:58606]
-
-Fri Nov 29 17:06:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_yield_block): yield block with rb_block_call_func
- arguments.
-
- * range.c (range_each): use rb_yield_block.
-
- * include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): constify argv.
-
- * enum.c (rb_enum_values_pack): ditto.
-
- * vm_eval.c (rb_block_call, rb_check_block_call): ditto.
-
- * include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
- argument list of rb_block_call_func.
-
-Fri Nov 29 11:26:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (rb_block_call_func): add blockarg. block
- function can take block argument, e.g., proc {|&blockarg| ...}.
-
-Thu Nov 28 21:43:48 2013 Zachary Scott <e@zzak.io>
-
- * doc/dtrace_probes.rdoc: [DOC] Import dtrace probes doc from wiki
-
-Thu Nov 28 21:17:32 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Add heading above ChangeLog tips to
- setup entry for commits, its not required. Actually easier if
- contributors don't include a ChangeLog entry.
-
-Thu Nov 28 21:16:18 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Add coding style heading for patch
- rules
-
-Thu Nov 28 21:15:45 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Add notes about deciding what to patch
-
-Thu Nov 28 19:43:45 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * benchmark/bm_hash_flatten.rb: added. r43896 is about 4 times faster
- than 2.0.0p353.
-
- * benchmark/bm_hash_keys.rb: added. r43896 is about 5 times faster
- than 2.0.0p353.
-
- * benchmark/bm_hash_values.rb: added. r43896 is about 5 times faster
- than 2.0.0p353.
-
-Thu Nov 28 19:29:04 2013 Zachary Scott <e@zzak.io>
-
- * doc/contributing.rdoc: [DOC] Add notes about slideshow proposals
- from wiki page: HowToRequestFeatures
-
-Thu Nov 28 17:34:42 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * st.c: add st_values() and st_values_check().
-
- * include/ruby/st.h: add prototypes for above.
-
- * hash.c (rb_hash_values): use st_values_check() for performance
- improvement if VALUE and st_data_t are compatible.
-
-Thu Nov 28 17:14:14 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * st.c (st_keys): fix not to use Qundef in st.c.
-
- * include/ruby/st.h: define modified prototype.
-
- * hash.c (rb_hash_keys): use modified st_keys().
-
-Thu Nov 28 16:34:43 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: Expose details about last garbage collection via GC.stat.
- * gc.c (gc_stat): Add :last_collection_flags for reason/trigger/type of
- last GC run.
- * gc.c (gc_prof_sweep_timer_stop): Record HAVE_FINALIZE GPR even
- without GC_PROFILE_MORE_DETAIL.
- * gc.c (gc_profile_flags): Add GC::Profiler.decode_flags to make sense
- of GC.stat[:last_collection_flags]
- * test/ruby/test_gc.rb (class TestGc): Test for above.
-
-Thu Nov 28 16:15:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_dup2): extract from rb_cloexec_dup2() and
- redirect_dup2().
-
-Tue Nov 28 14:40:00 2013 Akira Matsuda <ronnie@dio.jp>
-
- * lib/drb/ssl.rb: [Doc] Fix typo
-
-Thu Nov 28 13:56:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (Doxyfile): tool/file2lastrev.rb needs running with
- BASERUBY since r43617. [ruby-dev:47823] [Bug #9169]
-
-Thu Nov 28 09:18:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_fstring): fstrings should be ELTS_SHARED.
- If we resurrect dying objects (non-marked, but not swept yet),
- pointing shared string can be collected.
- To avoid such issue, fstrings (recorded to fstring_table)
- should not be ELTS_SHARED (should not have a shared string).
-
-Thu Nov 28 01:35:08 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * st.c (st_keys): fix to use st_index_t for size of hash.
-
-Thu Nov 28 00:36:52 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * st.c (st_keys): define st_keys(). it writes each key to buffer.
-
- * hash.c (rb_hash_keys): use st_keys() for performance improvement
- if st_data_t and VALUE are compatible.
-
- * include/ruby/st.h: define macro ST_DATA_COMPATIBLE_P() to predicate
- whether st_data_t and passed type are compatible.
-
- * configure.in: check existence of builtin function to use in
- ST_DATA_COMPATIBLE_P().
-
-Thu Nov 28 00:07:28 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * ruby_atomic.h: remove duplicate definitions between ATOMIC_XXX
- and ATOMIC_SIZE_XXX.
-
-Wed Nov 27 23:55:50 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * ruby_atomic.h: define ATOMIC_SIZE_CAS() with
- __atomic_compare_exchange_n() and refactoring.
-
-Tue Nov 27 21:43:00 2013 Akira Matsuda <ronnie@dio.jp>
-
- * lib/irb/notifier.rb: [Doc] Fix typo
- * ext/json/lib/json/common.rb: Ditto.
-
-Tue Nov 27 18:04:57 2013 Akira Matsuda <ronnie@dio.jp>
-
- * lib/irb/notifier.rb: Fix typo
-
-Wed Nov 27 17:54:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_stacked_objects): check only when check_mode > 0.
-
-Wed Nov 27 16:07:19 2013 Aman Gupta <ruby@tmm1.net>
-
- * test/ruby/test_gc.rb (class TestGc): Fix warning in
- test_expand_heap.
-
-Wed Nov 27 15:55:52 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (Init_GC): Add new GC::INTERNAL_CONSTANTS for information about
- GC heap/page/slot sizing.
- * test/ruby/test_gc.rb (class TestGc): test for above.
-
-Wed Nov 27 15:21:17 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (gc_page_sweep): Fix compile warning from last commit.
- * hash.c (hash_aset_str): Re-use existing variable to avoid
- unnecessary pointer dereferencing.
-
-Wed Nov 27 15:12:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_page_sweep): disable debug print.
-
-Wed Nov 27 15:05:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): add new information heap_eden_page_length and
- heap_tomb_page_length.
-
- * test/ruby/test_gc.rb: fix to use GC.stat[:heap_eden_page_length]
- instead of GC.stat[:heap_length].
- This test expects `heap_eden_page_length' (used pages size).
-
-Wed Nov 27 15:02:53 2013 Aman Gupta <ruby@tmm1.net>
-
- * test/ruby/test_eval.rb (class TestEval): Use assert_same instead of
- assert_equal.
- * test/ruby/test_hash.rb (class TestHash): ditto.
- * test/ruby/test_iseq.rb (class TestISeq): ditto.
-
-Wed Nov 27 14:50:02 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/ring.rb: Announce RingServer for the same process.
- [ruby-trunk - Bug #9163]
- * test/rinda/test_rinda.rb: Tests for the above.
-
-Wed Nov 27 14:37:33 2013 Aman Gupta <ruby@tmm1.net>
-
- * test/ruby/test_eval.rb (class TestEval): Add test for shared eval
- filenames via rb_fstring().
- * test/ruby/test_iseq.rb (class TestISeq): Add test for shared
- iseq labels via rb_fstring(). [Bug #9159]
-
-Wed Nov 27 14:24:55 2013 Aman Gupta <ruby@tmm1.net>
-
- * hash.c (hash_aset_str): Use rb_fstring() to de-duplicate hash string
- keys. Patch by Eric Wong. [Bug #8998] [ruby-core:57727]
- * test/ruby/test_hash.rb (class TestHash): test for above.
-
-Wed Nov 27 10:39:39 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: Rename rb_heap_t members:
- used -> page_length
- limit -> total_slots
-
-Wed Nov 27 08:24:49 2013 Aman Gupta <ruby@tmm1.net>
-
- * compile.c: Use rb_fstring() to de-duplicate string literals in code.
- [ruby-core:58599] [Bug #9159] [ruby-core:54405]
- * iseq.c (prepare_iseq_build): De-duplicate iseq labels and source
- locations.
- * re.c (rb_reg_initialize): Use rb_fstring() for regex string.
- * string.c (rb_fstring): Handle non-string and already-fstr arguments.
- * vm_eval.c (eval_string_with_cref): De-duplicate eval source
- filename.
-
-Wed Nov 27 07:13:54 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: psych version 2.0.2
- * ext/psych/psych.gemspec: ditto
-
-Wed Nov 27 06:40:18 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: fix support for negative
- years.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
- * test/psych/test_date_time.rb: test for change.
- Fixes: https://github.com/tenderlove/psych/issues/168
-
-Wed Nov 27 04:46:55 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: fix regexp for matching TIME
- strings.
- * test/psych/test_date_time.rb: test for change.
- Fixes: https://github.com/tenderlove/psych/issues/171
-
-Wed Nov 27 02:26:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_new4): copy the original capacity so that memsize of
- frozen shared string returns correct size.
-
-Wed Nov 27 02:20:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_hash): should not ignore the rest of recursive
- constructs.
-
- * hash.c (rb_hash_hash): ditto.
-
- * range.c (range_hash): ditto.
-
- * struct.c (rb_struct_hash): ditto.
-
- * test/-ext-/test_recursion.rb (TestRecursion): separate from
- test/ruby/test_thread.rb.
-
-Tue Nov 26 22:43:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash): cut off if recursion detected to get rid of stack
- overflow. [ruby-core:58567] [Bug #9151]
-
-Tue Nov 26 20:02:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_settracefunc.rb: add tests for a_call/a_return
- by Brandur <brandur@mutelight.org> [Feature #9120]
-
-Tue Nov 26 19:29:52 2013 Koichi Sasada <ko1@atdot.net>
-
- * common.mk: add useful config "set breakpoint pending on"
- for run.gdb.
-
-Tue Nov 26 19:17:47 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c (newobj_i): skip class_path if class
- is frozen.
-
- rb_class_path() can modify frozen classes (and causes errors).
- This patch is temporary. We need no-modification/no-allocation
- class path function.
-
-Tue Nov 26 18:12:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: skip "exception check" and "reentrant check (only normal
- events) for internal events.
-
- Reentrant check for internal events are remaining.
-
-Tue Nov 26 17:38:16 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: prohibit to specify normal events and internal events
- simultaneously.
- I will introduce special care for internal events later.
-
- * ext/-test-/tracepoint/tracepoint.c: test this behavior.
-
- * test/-ext-/tracepoint/test_tracepoint.rb: ditto.
-
-Tue Nov 26 16:30:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_readlink): fix buffer overflow on a long symlink. since
- rb_str_modify_expand() expands from its length but not its capacity,
- need to set the length properly for each expansion.
- [ruby-core:58592] [Bug #9157]
-
-Tue Nov 26 14:23:17 2013 Aman Gupta <ruby@tmm1.net>
-
- * ext/objspace/objspace_dump.c (dump_append_string_value): Escape
- control characters for strict json parsers.
- * ext/objspace/objspace_dump.c (objspace_dump): Document File/IO
- output option.
-
-Tue Nov 26 11:43:19 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * ruby_atomic.h: use __atomic builtin functions supported by GCC.
- __sync family are legacy functions now and it is recommended
- that new code use the __atomic functions.
- http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
-
- * configure.in: check existence of __atomic functions.
-
-Tue Nov 26 10:57:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.gemspec: revert Gem::Specification#date
- for snapshot/release tarballs.
-
-Tue Nov 26 06:42:50 2013 Aman Gupta <ruby@tmm1.net>
-
- * NEWS: Add ObjectSpace.after_gc_{start,end}_hook=
- * ext/objspace/objspace_dump.c: [DOC] catch up dump/dump_all to r43679
-
-Tue Nov 26 04:12:10 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 612f85a. Notable changes:
-
- Fixed installation and activation of git: and path: gems via
- Gem.use_gemdeps
-
- Improved documentation coverage
-
- * test/rubygems: ditto.
-
-Mon Nov 25 22:23:03 2013 Zachary Scott <e@zzak.io>
-
- * lib/xmlrpc.rb: [DOC] Fix link to xmlrpc4r site [Bug #9148]
- Patch by Giorgos Tsiftsis
-
-Mon Nov 25 19:48:10 2013 Zachary Scott <e@zzak.io>
-
- * lib/uri/common.rb: [DOC] typo fixes by @vipulnsward [Fixes GH-456]
- https://github.com/ruby/ruby/pull/456
- * lib/uri/generic.rb: [DOC] ditto.
-
-Mon Nov 25 14:34:42 2013 Zachary Scott <e@zzak.io>
-
- * ext/bigdecimal/bigdecimal.gemspec: bump BigDecimal to 1.2.3 for
- proper release date in RubyGems
-
-Mon Nov 25 14:25:08 2013 Zachary Scott <e@zzak.io>
-
- * ext/bigdecimal/bigdecimal.gemspec: Remove Gem::Specification#date
- We should rely on rubygems to create the date the gem was released
- for each version.
-
-Mon Nov 25 06:53:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * internal.h: do not use ruby_sized_xrealloc() and ruby_sized_xfree()
- if HAVE_MALLOC_USABLE_SIZE (or _WIN32) is defined.
-
- We don't need these function if malloc_usable_size() is available.
-
- * gc.c: catch up this change.
-
- * gc.c: define HAVE_MALLOC_USABLE_SIZE on _WIN32.
-
- * array.c (ary_resize_capa): do not use ruby_sized_xfree() with
- local variable to avoid "unused local variable" warning.
- This change only has few impact.
-
- * string.c (rb_str_resize): ditto.
-
-Mon Nov 25 05:05:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/-ext-/tracepoint/test_tracepoint.rb: catch up GC.stat changes
- at r43835.
-
-Mon Nov 25 04:45:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: continue to change OLDSPACE -> OLDMALLOC.
- RGENGC_ESTIMATE_OLDSPACE -> RGENGC_ESTIMATE_OLDMALLOC.
-
- * gc.c: add a new major GC reason GPR_FLAG_MAJOR_BY_OLDMALLOC.
-
-Mon Nov 25 04:16:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change terminology "..._num" to "..._slots" about slot operation.
- * final_num -> final_slots
- * objspace_live_num() -> objspace_live_slots()
- * objspace_limit_num() -> objspace_limit_slots()
- * objspace_free_num() -> objspace_free_slots()
-
-Mon Nov 25 04:03:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): add internal information.
- * heap_swept_slot
- * malloc_increase
- * malloc_limit
- * remembered_shady_object
- * remembered_shady_object_limit
- * old_object
- * old_object_limit
- * oldmalloc_increase
- * oldmalloc_limit
-
- * gc.c (gc_stat): rename names.
- * heap_live_num -> heap_live_slot
- * heap_free_num -> heap_free_slot
- * heap_final_slot -> heap_final_slot
-
- Quote from RDoc of GC.stat():
- "The contents of the hash are implementation specific and may
- be changed in the future."
-
- * test/ruby/test_gc.rb: catch up this change.
-
-Mon Nov 25 03:59:45 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb: catch up last commit.
- Now RUBY_GC_OLDSPACE_LIMIT(...) is RUBY_GC_OLDMALLOC_LIMIT(...).
-
-Mon Nov 25 03:10:46 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change terminology OLDSPACE -> OLDMALLOC.
- (oldspace -> oldmalloc for variable names)
-
- OLDSPACE is confusing because it is not includes slots.
- To more clearly, rename such as (oldspace_limit -> oldmalloc_limit).
- It is clear that it measures (estimates) malloc()'ed size.
-
-Mon Nov 25 00:50:03 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * internal.h: use __builtin_bswap16() if possible.
-
- * configure.in: check existence of __builtin_bswap16().
-
-Sun Nov 24 22:24:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigxor_int): Apply BIGLO for long in a BDIGIT expression.
- (bigor_int): Ditto.
- (bigand_int): Ditto.
-
-Sun Nov 24 18:13:23 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h (SIZEOF_ACTUAL_BDIGIT): Defined.
-
- * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Use
- SIZEOF_ACTUAL_BDIGIT instead of SIZEOF_BDIGITS.
- SIZEOF_BDIGITS can be different to sizeof(BDIGIT).
-
-Sun Nov 24 13:49:08 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h: Don't use int128_t for Bignum.
- It's not always faster.
-
- * bignum.c: Ditto.
-
-Sun Nov 24 10:18:15 2013 Aman Gupta <ruby@tmm1.net>
-
- * NEWS: Add details about new debugging features and APIs.
-
-Sun Nov 24 09:37:20 2013 Andrew Vit <andrew@avit.ca>
-
- * lib/csv.rb: Optimize header hashes by freezing string keys.
- [ruby-core:58510]
-
-Sun Nov 24 09:18:06 2013 Aman Gupta <ruby@tmm1.net>
-
- * ext/objspace/objspace_dump.c (dump_object): Use PRIuSIZE to print
- size_t for better win32 compatibility.
- * test/objspace/test_objspace.rb (test_dump_all): Hold reference to
- test string to avoid failure due to GC. Reduce size of failure message
- using grep(/TEST STRING/).
-
-Sun Nov 24 08:38:00 2013 Kyle Stevens <kstevens715@gmail.com>
-
- * lib/csv.rb: If skip_lines is set to a String, convert it to a Regexp
- to prevent the alternative, which is that each line in the CSV gets
- converted to a Regexp when calling skip_lines#match.
-
-Sun Nov 24 01:03:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Use FIX2LONG instead
- of FIX2INT to avoid conversion error.
-
-Sun Nov 24 00:44:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): define by macros
- defined in defines.h, instead of complex and repeated expression.
-
-Sat Nov 23 22:22:26 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Limit the value to
- less than 8.
-
-Sat Nov 23 19:52:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/lib/bigdecimal/math.rb (BigMath.E): Use BigMath.exp.
- [Feature #6857] [ruby-core:47130]
-
-Sat Nov 23 19:46:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Optimize the
- calculation algorithm to reduce the number of divisions.
- This optimization was proposed by Rafal Michalski.
- [Feature #6857] [ruby-core:47130]
-
-Sat Nov 23 19:20:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): The signature was
- changed to allow us to pass arguments directly.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_div3): Added for the role of
- the old BigDecimal_div2.
-
-Sat Nov 23 12:31:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix global variable name.
- Now we have following environments (and related variable names).
-
- * RUBY_GC_HEAP_INIT_SLOTS
- * RUBY_GC_HEAP_FREE_SLOTS
- * RUBY_GC_HEAP_GROWTH_FACTOR (new from 2.1)
- * RUBY_GC_HEAP_GROWTH_MAX_SLOTS (new from 2.1)
-
- * obsolete
- * RUBY_FREE_MIN -> RUBY_GC_HEAP_FREE_SLOTS (from 2.1)
- * RUBY_HEAP_MIN_SLOTS -> RUBY_GC_HEAP_INIT_SLOTS (from 2.1)
-
- * RUBY_GC_MALLOC_LIMIT
- * RUBY_GC_MALLOC_LIMIT_MAX (new from 2.1)
- * RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR (new from 2.1)
-
- * RUBY_GC_OLDSPACE_LIMIT (new from 2.1)
- * RUBY_GC_OLDSPACE_LIMIT_MAX (new from 2.1)
- * RUBY_GC_OLDSPACE_LIMIT_GROWTH_FACTOR (new from 2.1)
-
- * test/ruby/test_gc.rb: catch up this change.
-
-Sat Nov 23 09:45:49 2013 Aman Gupta <ruby@tmm1.net>
-
- * marshal.c (w_object): Use HASH_PROC_DEFAULT directly from internal.h
-
-Sat Nov 23 08:43:23 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: Rename heap_pages_swept_num to heap_pages_swept_slots to
- clarify meaning (number of slots, not pages).
-
-Sat Nov 23 08:23:23 2013 Aman Gupta <ruby@tmm1.net>
-
- * lib/set.rb (class SortedSet): Fix source_location for methods
- defined via eval.
-
-Sat Nov 23 03:44:03 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master dcce4ff. Important changes
- in this commit:
-
- Remove automatic detection of gem dependencies files. This prevents a
- security hole as described in [ruby-core:58490]
-
- Fixed bugs for installing git gems.
-
- * test/rubygems: ditto.
-
-Fri Nov 22 22:30:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power):
- Round the result value only if the precision is given.
-
-Fri Nov 22 17:20:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * transcode.c (str_transcode0): don't scrub invalid chars if
- str.encode doesn't have explicit invalid: :replace.
- workaround fix for see #8995
-
-Fri Nov 22 17:11:26 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * include/ruby/intern.h, internal.h: Expose rb_gc_count().
-
-Fri Nov 22 17:07:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.gemspec: version 1.2.2.
-
-Fri Nov 22 17:04:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_data_type):
- Use RUBY_TYPED_FREE_IMMEDIATELY only if it is available.
-
-Fri Nov 22 16:49:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power): Round the result value.
- [Bug #8818] [ruby-core:56802]
-
- * test/bigdecimal/test_bigdecimal.rb: Add a test for the above fix.
-
-Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_set_increment): accept minimum additional page number.
-
- * gc.c (gc_after_sweep): allocate pages to allocate at least
- RUBY_HEAP_MIN_SLOTS.
- [Bug #9137]
-
-Fri Nov 22 16:19:52 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * include/ruby/intern.h (rb_gc_set_params): Deprecate
- rb_gc_set_params because it's only used in ruby internal.
-
- * internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
- alias function.
-
- * gc.c: ditto.
-
- * ruby.c: use ruby_gc_set_params.
-
-Fri Nov 22 14:55:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Insert rb_thread_check_ints.
-
-Fri Nov 22 14:35:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix the inserting points
- of RB_GC_GUARDs.
-
-Fri Nov 22 14:31:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c: Fix indentation.
-
-Fri Nov 22 14:03:00 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf: merge nkf 2.1.3 2a2f2c5.
-
-Fri Nov 22 12:43:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * util.c (ruby_strtod): ignore too long fraction part, which does not
- affect the result.
-
-Fri Nov 22 12:17:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/lib/openssl/buffering.rb (OpenSSL::Buffering#initialize):
- initialize of a module should pass arguments to super.
-
-Fri Nov 22 12:02:58 2013 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_settracefunc.rb: Ignore events from other threads.
-
-Fri Nov 22 10:35:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (ruby_vm_destruct): do not use ruby_xfree() after freeing
- objspace.
-
- * gc.c (ruby_mimfree): added. It is similar to ruby_mimmalloc().
-
- * internal.h: ditto.
-
-Fri Nov 22 09:42:35 2013 Zachary Scott <e@zzak.io>
-
- * test/digest/test_digest.rb: Reverse order of assert_equal
- Reported by @splattael
-
-Fri Nov 22 09:03:16 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c: fix build failure on FreeBSD introduced by r43763.
- malloc_usable_size() is defined by malloc_np.h on FreeBSD.
-
- * configure.in: check malloc.h and malloc_np.h.
-
-Fri Nov 22 08:27:13 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 50a8210. Important changes
- in this commit:
-
- RubyGems now automatically checks for gem.deps.rb or Gemfile when
- running ruby executables. This behavior is similar to `bundle exec
- rake`. This change may be reverted before Ruby 2.1.0 if too many bugs
- are found.
-
- * test/rubygems: ditto.
-
-Thu Nov 21 22:33:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: RGENGC_CHECK_MODE should be 0.
-
-Thu Nov 21 21:40:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
- of the digit array.
-
-Thu Nov 21 21:36:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix the precision of
- the result BigDecimal of sqrt.
- [Bug #5266] [ruby-dev:44450]
-
- * test/bigdecimal/test_bigdecimal.rb: add tests for the above changes.
-
-Thu Nov 21 18:49:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (vm_xrealloc, vm_xfree): use malloc_usable_size() to obtain old
- size if available.
-
-Thu Nov 21 18:47:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/delegate.rb (SimpleDelegator#__getobj__): target object must be set.
-
- * lib/delegate.rb (DelegateClass#__getobj__): ditto.
-
-Thu Nov 21 18:28:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/tempfile.rb (Tempfile#initialize): use class method to get rid
- of warnings when $VERBOSE.
-
-Thu Nov 21 17:43:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename initial_xxx variables to gc_params.xxx.
- They are not only used initial values.
-
- Chikanaga-san: Congratulations on RubyPrize!
-
-Thu Nov 21 17:16:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: enable "RGENGC_ESTIMATE_OLDSPACE" option as default.
- Without this option, some application consumes huge memory.
- (and there are only a few performance down)
-
- Introduced new environment variables:
- * RUBY_GC_HEAP_OLDSPACE (default 16MB)
- * RUBY_GC_HEAP_OLDSPACE_MAX (default 128 MB)
- * RUBY_GC_HEAP_OLDSPACE_GROWTH_FACTOR (default 1.2)
-
- * gc.c (initial_malloc_limit): rename to initial_malloc_limit_min.
-
-Thu Nov 21 16:51:34 2013 Zachary Scott <e@zzak.io>
-
- * ext/digest/bubblebabble/bubblebabble.c: Teach RDoc digest/bubblebabble
-
-Thu Nov 21 16:50:16 2013 Zachary Scott <e@zzak.io>
-
- * test/digest/test_digest.rb: Add more tests for digest/bubblebabble
-
-Thu Nov 21 16:32:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/delegate.rb (Delegator#method_missing): try private methods defined in
- Kernel after the target. [Fixes GH-449]
-
-Thu Nov 21 16:25:08 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path)
- in addition to uri + path.
-
-Thu Nov 21 15:36:08 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/buffering.rb: [DOC] Fix HEREDOC comment for
- OpenSSL::Buffering which breaks overview because of RDoc bug
-
-Thu Nov 21 14:46:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure of
- test/ruby/test_exception.rb on Windows.
- wrap by __try and __exception statements on mswin to raise SIGSEGV
- when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't
- handle the exception.
- however, (1) mingw-gcc doesn't support __try and __exception
- statements, and (2) we cannot retry SystemStackError after this
- change yet (maybe crashed) because SEH and longjmp() are too
- uncongenial.
-
- * signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
- Windows, too.
-
- * thread_win32.c (ruby_stack_overflowed_p): ditto.
-
-Thu Nov 21 14:18:24 2013 Zachary Scott <e@zzak.io>
-
- * object.c: [DOC] Clarify Object#dup vs #clone [Bug #9128]
- Moving existing doc for this comparison to separate section of #dup
- Adding examples to document behavior of #dup with Module#extend.
- Based on a patch by stevegoobermanhill
-
-Thu Nov 21 14:06:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_marks_check): do not dump all refs.
-
- * gc.c (allrefs_dump_i): fix output format.
-
-Thu Nov 21 13:43:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change RGENGC_CHECK_MODE (>= 2) logic.
- Basically, make an object graph of all of living objects before and
- after marking and check status.
-
- [Before marking: check WB sanity]
- If there is a non-old object `obj' pointed from old object
- (`parent') then `parent' or `obj' should be remembered.
-
- [After marking: check marking miss]
- Traversible objects with the object graph should be marked.
- (However, this alert about objects pointed by machine context
- can be false positive. We only display alert.)
-
- [Implementation memo]
- objspace_allrefs() creates an object graph.
- The object graph is represented by st_table, key is object (VALUE)
- and value is referring objects. Referring objects are stored by
- "struct reflist".
-
- * gc.c (init_mark_stack): do not use push_mark_stack_chunk() at init.
- This pre-allocation causes failure on is_mark_stack_empty()
- without any pushing.
-
-Thu Nov 21 13:40:20 2013 Zachary Scott <e@zzak.io>
-
- * lib/observer.rb: [DOC] Clarify default observer method.
- By @edward [Fixes GH-450] https://github.com/ruby/ruby/pull/450
-
-Thu Nov 21 13:32:53 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_engine.c: [DOC] Documentation for OpenSSL::Engine
- This patch is based off work by @vbatts in GH-436 completing the
- documentation for this class and its methods.
- https://github.com/ruby/ruby/pull/436
-
-Thu Nov 21 10:45:22 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/buffering.rb: Remove unused arguments from
- OpenSSL::Buffering.new [Fixes GH-445]
-
-Thu Nov 21 10:30:47 2013 Zachary Scott <e@zzak.io>
-
- * test/digest/test_digest.rb: Add test for Digest::SHA256.bubblebabble
-
-Wed Nov 20 20:54:01 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * tool/instruction.rb : fix typo.
-
-Wed Nov 20 19:45:22 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (rand_init): Make it possible to specify arbitrary array
- for init_genrand().
-
-Wed Nov 20 17:34:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * parse.y (rb_gc_mark_symbols): set global_symbols.minor_marked only
- when full_mark is 0.
- rb_gc_mark_symbols() (with full_mark == 1) can be called by other
- than GC (such as rb_objspace_reachable_objects_from_root()).
-
-Wed Nov 20 11:46:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json: merge JSON 1.8.1.
- https://github.com/nurse/json/compare/002ac2771ce32776b32ccd2d06e5604de6c36dcd...e09ffc0d7da25d0393873936c118c188c78dbac3
- * Remove Rubinius exception since transcoding should be working now.
- * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre
- Lafortune <github_rocks@marc-andre.ca>. Thanks!
- * Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress
- warning with -Wchar-subscripts and better validate UTF-8 strings.
- * Applied patch by ginriki@github to remove unnecessary if.
- * Add load/dump interface to JSON::GenericObject to make
- serialize :some_attribute, JSON::GenericObject
- work in Rails active models for convenient
- SomeModel#some_attribute.foo.bar access to serialised JSON data.
-
-Wed Nov 20 01:39:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rdoc/constant.rb (RDoc::Constant#documented?): workaround for
- NoMethodError when the original of alias is not found.
-
-Tue Nov 19 23:38:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (--with-os-version-style): option to transform target
- OS version string.
-
-Tue Nov 19 21:27:33 2013 Tanaka Akira <akr@fsij.org>
-
- * test/net/http/utils.rb (spawn_server): Specify zero for port to
- avoid reusing an allocated port.
-
- * test/net/http/test_http.rb: Don't specify port here.
-
- * test/net/http/test_https.rb: Ditto.
-
-Tue Nov 19 18:52:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_is_swept_object): use heap_page::before_sweep flag.
-
-Tue Nov 19 18:49:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_reachable_objects_from_root): do major marking.
-
-Tue Nov 19 18:45:40 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_resurrect): added.
- rb_fstring() used rb_gc_mark() to avoid freeing used string.
- However, rb_gc_mark() set mark bit *and* pushes mark_stack.
- rb_gc_resurrect() does only set mark bit if it is before sweeping.
-
- * string.c (rb_fstring): use rb_gc_resurrect.
-
- * internal.h: add decl.
-
-Tue Nov 19 09:47:02 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc master a1195ce. Changes include:
-
- Improved accessibility of the main sidebar navigation.
-
- Fixed handling of regexp options in HTML source highlighting.
-
- * test/rdoc: ditto.
-
-Tue Nov 19 09:33:52 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 6a3d9f9. Changes include:
-
- Compatibly renamed Gem::DependencyResolver to Gem::Resolver.
-
- Added support for git gems in gem.deps.rb and Gemfile.
-
- Fixed resolver bugs.
-
- * test/rubygems: ditto.
-
- * lib/rubygems/LICENSE.txt: Updated to license from RubyGems trunk.
- [ruby-trunk - Bug #9086]
-
- * lib/rubygems/commands/which_command.rb: RubyGems now indicates
- failure when any file is missing. [ruby-trunk - Bug #9004]
-
- * lib/rubygems/ext/builder: Extensions are now installed into the
- extension install directory and the first directory in the require
- path from the gem. This allows backwards compatibility with msgpack
- and other gems that calculate full require paths.
- [ruby-trunk - Bug #9106]
-
-
-Tue Nov 19 07:21:56 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in (LOCALTIME_OVERFLOW_PROBLEM): Define it for cross
- compiling.
- [ruby-core:58391] [Bug #9119] Reported by Luis Lavena.
- Analyzed by Heesob Park.
-
-Tue Nov 19 05:55:05 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/rubygems_hook.rb: Remove debugging puts committed by
- accident.
-
-Mon Nov 18 22:47:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_intern.h (TH_PUSH_TAG, TH_EXEC_TAG): refine stack overflow
- detection. chain local tag after setjmp() successed on it, because
- calling setjmp() also can overflow the stack.
- [ruby-dev:47804] [Bug #9109]
-
- * vm_eval.c (rb_catch_obj): now th->tag points previous tag until
- TH_EXEC_TAG().
-
- * thread_pthread.c (ruby_init_stack): set stack_start properly by
- get_main_stack() if possible.
-
-Mon Nov 18 22:45:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_jump.c (rb_exec_end_proc): unlink and free procs data before
- calling for each procs. [Bug #9110]
-
-Sun Nov 17 06:33:32 2013 Shota Fukumori <her@sorah.jp>
-
- * configure.in: Use $LIBS for base of $SOLIBS, also in darwin.
- By this fix, environment that libgmp is located in $LIBS can build
- ruby.
-
-Sun Nov 17 01:56:32 2013 Tanaka Akira <akr@fsij.org>
-
- * thread_pthread.c (rb_thread_create_timer_thread): Show error
- message instead of error number.
- (thread_create_core): Ditto.
-
- * cont.c (fiber_machine_stack_alloc): Ditto.
-
-Sat Nov 16 18:28:08 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/ultralightparser.rb
- (REXML::Parsers::UltraLightParser#parse): Fix wrong :start_doctype
- position.
- [Bug #9061] [ruby-dev:47778]
- Patch by Ippei Obayashi. Thanks!!!
-
- * test/rexml/parser/test_ultra_light.rb: Add a test for this case.
-
-Sat Nov 16 02:13:56 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * cont.c : Introduce ensure rollback mechanism. Please see below.
-
- * internal.h (ruby_register_rollback_func_for_ensure): catch up above change.
- Add rollback mechanism API.
-
- * vm_core.h (typedef struct rb_vm_struct): catch up above change.
- Introduce ensure-rollback relation table.
-
- * vm_core.h (typedef struct rb_thread_struct): catch up above change.
- Introduce ensure stack.
-
- * eval.c (rb_ensure): catch up above change.
- Introduce ensure stack.
-
- * hash.c : New function for rollback ensure, and register it to
- ensure-rollback relation table. [ruby-dev:47803] [Bug #9105]
-
- Ensure Rollback Mechanism:
- A rollback's function is a function to rollback a state before ensure's
- function execution.
- When the jump of callcc is across the scope of rb_ensure,
- ensure's functions and rollback's functions are executed appropriately
- for keeping consistency.
-
- Current API is unstable, and only internal use.
-
- ruby_register_rollback_func_for_ensure(ensure_func,rollback_func)
- This API create relation ensure's function to rollback's function.
- By registered rollback's function, it is executed When jumping into
- corresponding rb_ensure scope.
-
-Sat Nov 16 00:18:36 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * eval_jump.c (rb_exec_end_proc): fix double free or corruption error
- when reentering by callcc. [ruby-core:58329] [Bug #9110]
-
- * test/ruby/test_beginendblock.rb: test for above.
-
-Fri Nov 15 01:06:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/objspace/objspace_dump.c (dump_output): allow IO object as
- output, and use Tempfile.create and return open file instead of
- mkstemp() and path name for :file output.
- [ruby-core:58266] [Bug #9102]
-
- * test/objspace/test_objspace.rb (TestObjSpace#dump_my_heap_please):
- remove temporary output file.
-
-Thu Nov 14 23:39:00 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] remove example of
- Rational#to_d without argument. [Bug #8958]
-
-Thu Nov 14 20:24:15 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * ruby_atomic.h (ATOMIC_SIZE_CAS): fix compile error on Solaris
- since r43460.
-
-Thu Nov 14 19:53:00 2013 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/test_cipher.rb (test_aes_gcm_wrong_tag): Don't use
- String#succ because it can make modified (wrong) auth_tag longer
- than 16 bytes. The longer auth_tag makes that
- EVP_CIPHER_CTX_ctrl (and internally aes_gcm_ctrl) fail.
- [ruby-core:55143] [Bug #8439] reported by Vit Ondruch.
-
-Thu Nov 14 11:33:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (foreach_safe_i, hash_foreach_iter): deal with error detected
- by ST_CHECK.
-
- * st.c (st_foreach_check): call with non-error argument in normal case.
-
-Thu Nov 14 02:37:14 2013 Zachary Scott <e@zzak.io>
-
- * ext/thread/thread.c: [DOC] This patch accomplishes the following:
-
- - Teach RDoc about ConditionVariable
- - Teach RDoc about Queue
- - Teach RDoc about SizedQueue
- - Use fully-qualified namespace for Document-method
- This is necessary to separate definitions between classes
- - Fix rdoc bug in call_seq vs. call-seq
- - Correct doc for SizedQueue#pop patch by @jackdanger [Bug #8988]
-
-Thu Nov 14 01:11:54 2013 Zachary Scott <e@zzak.io>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] +precision+ is required
-
-Wed Nov 13 19:21:36 2013 Zachary Scott <e@zzak.io>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] Document the required
- +precision+ argument for Rational#to_d [Bug #8958]
-
-Wed Nov 13 19:02:05 2013 Zachary Scott <e@zzak.io>
-
- * ext/digest/*: [DOC] Fix several typos and broken http links.
- Improved examples for Digest overview and fixed a broken example in
- Digest::HMAC overview. This patch also adds a description of
- Digest::SHA256.bubblebabble to the Digest overview.
-
- Patched by @stomar [Bug #9027]
-
-Wed Nov 13 18:32:12 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_config.c: [DOC] Document the following:
-
- - OpenSSL::ConfigError
- - OpenSSL::Config::DEFAULT_CONFIG_FILE
-
- Patched by @vbatts via GH-436
- https://github.com/ruby/ruby/pull/436
-
-Wed Nov 13 18:03:00 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_asn1.c: [DOC] Document parts of
- OpenSSL::ASN1::ObjectId included a fix for the class overview, which
- previously showed the documentation for Constructive due to missing
- ObjectId overview. This patch also includes a note for Primitive.
-
- Based on a patch by @vbatts via GH-436
- https://github.com/ruby/ruby/pull/436
-
-Wed Nov 13 17:19:36 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/config.rb: In #parse use +string+ for +str+
-
-Wed Nov 13 17:09:45 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/*.rb: [DOC] Document the following:
-
- - Integer#to_bn
- - OpenSSL::Buffering module
- - Deprecated OpenSSL::Digest::Digest compatibility class
- - OpenSSL::Config
-
- These changes were based on a patch by @vbatts via GH-436
- https://github.com/ruby/ruby/pull/436
-
-Wed Nov 13 10:55:43 2013 Zachary Scott <e@zzak.io>
-
- * doc/regexp.rdoc: [DOC] Fix typo in Special global variables section.
- Reported by Alex Johnson on ruby-doc.org
-
-Wed Nov 13 10:43:19 2013 Zachary Scott <e@zzak.io>
-
- * hash.c: [DOC] Adds an example for Hash#store
-
-Wed Nov 13 09:03:40 2013 Zachary Scott <e@zzak.io>
-
- * doc/regexp.rdoc: [DOC] add note about Bug #4044 as suggested by
- duerst-san in [ruby-core:43612] [Fixes GH-443] Patched by @rosenfeld
- https://github.com/ruby/ruby/pull/443
-
-Tue Nov 12 10:15:14 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/insure_session.rb: Remove unused test file.
-
-Tue Nov 12 09:16:24 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master b9213d7. Changes include:
-
- Fixed tests on Windows (I hope) by forcing platform for
- platform-dependent tests.
-
- Fixed File.exists? warnings.
-
- Improved testing infrastructure.
-
- * test/rubygems: ditto.
-
- * test/rdoc/test_rdoc_rubygems_hook.rb: Switch to util_spec like
- RubyGems.
-
-Mon Nov 11 18:31:12 2013 Aman Gupta <ruby@tmm1.net>
-
- * internal.h: move common string/hash flags to include file.
- * ext/objspace/objspace_dump.c: remove flags shared above.
- * hash.c: ditto.
- * string.c: ditto.
-
-Mon Nov 11 04:36:14 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Include 2.2.0.preview.2 when checking
- if extensions should be built. Fixes a ruby-ci failure.
- * test/rubygems/test_gem_specification.rb: Test for the above.
-
-Mon Nov 11 03:15:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (symbol2event_flag): add secret feature.
- add a_call/a_return events.
- a_call is call | b_call | c_call, and same as a_return.
-
-Mon Nov 11 02:51:17 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 4bdc4f2. Important changes
- in this commit:
-
- RubyGems now chooses the test server port reliably. Patch by akr.
-
- Partial implementation of bundler's Gemfile format.
-
- Refactorings to improve the new resolver.
-
- Fixes bugs in the resolver.
-
- * test/rubygems: Tests for the above.
-
-Mon Nov 11 01:02:06 2013 Zachary Scott <e@zzak.io>
-
- * lib/timeout.rb: [DOC] Add note about change from #8730 [Fixes GH-440]
- * NEWS: [DOC] Improve grammar on change to Timeout
- Patched by @srawlins in https://github.com/ruby/ruby/pull/440
-
-Sun Nov 10 23:47:05 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * gc.c (rb_gcdebug_print_obj_condition): catch up recent changes
- to compile on GC_DEBUG.
-
-Sun Nov 10 22:16:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (exc_cause): captured previous exception.
-
- * eval.c (make_exception): capture previous exception automagically.
- [Feature #8257]
-
-Sun Nov 10 08:37:20 2013 Zachary Scott <e@zzak.io>
-
- * thread.c: [DOC] Remove duplicate reference
-
-Sun Nov 10 08:09:29 2013 Zachary Scott <e@zzak.io>
-
- * lib/drb/drb.rb: [DOC] promote better windows-safe filename regular
- expression in DRb Logger example. Reported by Chris Pheonix
- [Bug #9074]
-
-Sun Nov 10 08:03:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export
- finalizer functions.
-
-Sun Nov 10 07:41:22 2013 Zachary Scott <e@zzak.io>
-
- * lib/weakref.rb: [DOC] fix typos by @xaviershay [Fixes GH-439]
- https://github.com/ruby/ruby/pull/439
-
-Sun Nov 10 06:14:39 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * compile.c (iseq_compile_each): emit opt_str_freeze if the #freeze
- method is called on a static string literal with no arguments.
-
- * defs/id.def (firstline): add freeze so idFreeze is available
-
- * insns.def (opt_str_freeze): add opt_str_freeze instruction which
- pushes a frozen string literal without allocating a new object if
- String#freeze is not overridden
-
- * string.c (Init_String): define String#freeze
-
- * vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as
- a basic operation
-
- * vm_insnhelper.h: ditto
-
- [Feature #8992] [ruby-core:57705]
-
-Sun Nov 10 01:34:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (vm_malloc_increase): sweep immediately on GC due to malloc().
- To reduce memory usage, sweep as soon as possible.
- This behavior is same as Ruby 2.0.0 and before.
-
-Sun Nov 10 00:39:26 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: output version description and GC::OPTS.
-
-Sun Nov 10 00:36:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (should_be_callable): allow private call since rb_eval_cmd
- calls even private methods.
-
-Sun Nov 10 00:33:17 2013 Zachary Scott <e@zzak.io>
-
- * lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo by Tsuyoshi Sawada
- [Bug #9077]
-
-Sat Nov 9 22:35:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (Gem::Specification.load): obtain spec date from
- VCS for the case using git, RUBY_RELEASE_DATE is the last resort.
- probably fixes [Bug #9085].
-
-Sat Nov 9 20:56:12 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * ext/objspace/object_tracing.c: use declarations in internal.h.
-
- * ext/objspace/objspace.c: ditto
-
-Sat Nov 9 20:32:59 2013 Tanaka Akira <akr@fsij.org>
-
- * test/objspace/test_objspace.rb (test_dump_all): Make the test string
- shorter to be an embedded string on 32bit environment as well as
- 64bit environment.
-
-Sat Nov 9 15:00:16 2013 Zachary Scott <e@zzak.io>
-
- * io.c: [DOC] ARGF.gets may return nil [Bug #9029] patch by znz
-
-Sat Nov 9 14:54:52 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/*: [DOC] document various constants @steveklabnik [Bug #8812]
-
-Sat Nov 9 14:50:09 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/rss.rb: [DOC] document Time#w3cdtf by @steveklabnik
- [Bug #8821]
-
-Sat Nov 9 14:29:04 2013 Zachary Scott <e@zzak.io>
-
- * ext/dl/cfunc.c: [DOC] fix typo in example [Bug #8944]
- Patched by Heesob Park
-
-Sat Nov 9 13:59:58 2013 Zachary Scott <e@zzak.io>
-
- * lib/test/unit/assertions.rb: [DOC] better example for assert_send()
- Patch by Andrew Grimm [Bug #8975]
-
-Sat Nov 9 12:45:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * insns.def: unify ic_constant_serial and ic_class_serial into one field
- ic_serial. This is possible because these fields are only ever used
- exclusively with each other.
-
- * insns.def: ditto
- * vm_core.h: ditto
- * vm_insnhelper.c: ditto
-
-Sat Nov 9 12:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * class.c: unify names of vm state version counters to 'serial'.
- This includes renaming 'vm_state_version_t' to 'rb_serial_t',
- 'method_state' to 'method_serial', 'seq' to 'class_serial',
- 'vmstat' to 'constant_serial', etc.
-
- * insns.def: ditto
- * internal.h: ditto
- * vm.c: ditto
- * vm_core.h: ditto
- * vm_insnhelper.c: ditto
- * vm_insnhelper.h: ditto
- * vm_method.c: ditto
-
-Sat Nov 9 09:22:29 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_page_sweep, rgengc_rememberset_mark): Refactoring.
- Get bitmaps directly.
-
-Sat Nov 9 09:16:36 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (RVALUE_PROMOTE_INFANT): Refactoring. Remove duplicated nonsense
- code.
-
-Sat Nov 9 09:04:48 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_marks_test): Bugfix. Fix a struct member name for build
- with RGENGC_CHECK_MODE.
-
-Sat Nov 9 08:58:23 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c : Add GC_PROFILE_DETAIL_MEMORY option.
- If GC_PROFILE_MORE_DETAIL && GC_PROFILE_DETAIL_MEMORY,
- maxrss, minflt and majflt are added to each profile record.
-
-Sat Nov 9 07:41:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (rb_vm_backtrace_object, rb_gc_count): make prototype
- declarations, not old-K&R style.
-
-Sat Nov 9 06:11:14 2013 vo.x (Vit Ondruch) <vondruch@redhat.com>
-
- * tool/rbinstall.rb (Gem::Specification#collect): make stable
- Gem::Specification.files in default .gemspecs the different order of
- "files" in .gemspec files makes them different therefore possibly
- conflicting in multilib scenario. patch by vo.x (Vit Ondruch) at
- [ruby-core:57544] [Bug #8623].
-
-Sat Nov 9 01:59:18 2013 Aman Gupta <ruby@tmm1.net>
-
- * ext/objspace/objspace_dump.c: Add experimental methods to
- dump objectspace as json: ObjectSpace.dump_all and
- ObjectSpace.dump(obj). These methods are useful for debugging
- reference leaks and memory growth in large ruby applications.
- [Bug #9026] [ruby-core:57893] [Fixes GH-423]
- * test/objspace/test_objspace.rb: tests for above.
-
-Sat Nov 9 00:26:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (GetLastError): already defined in windows.h on nowadays
- cygwin, and caused the confliction with the system provided
- definition on cygwin64. by @kou1okada [Fixes GH-433].
-
-Fri Nov 8 18:35:31 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/open3.rb: receive arguments as keyword arguments.
-
-Fri Nov 8 13:19:26 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (rb_io_open_with_args): use RARRAY_CONST_PTR().
-
- * io.c (rb_scan_open_args): use const qualifier for above.
-
- * io.c (rb_open_file): ditto.
-
- * io.c (rb_io_open_with_args): ditto.
-
-Fri Nov 8 11:35:06 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
-
-Fri Nov 8 10:58:02 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
-
- * compile.c (iseq_build_from_ary_body): ditto.
-
-Fri Nov 8 10:49:34 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * enumerator.c (append_method): use RARRAY_CONST_PTR().
-
- * enumerator.c (lazy_init_iterator): ditto.
-
-Fri Nov 8 02:44:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (vm_malloc_increase): check GVL before gc_rest_sweep().
- vm_malloc_increase() can be called without GVL.
- However, gc_rest_sweep() assumes acquiring GVL.
- To avoid this problem, check GVL before gc_rest_sweep().
- [Bug #9090]
-
- This workaround introduces possibility to set malloc_limit as
- wrong value (*1). However, this may be rare case. So I commit it.
-
- *1: Without rest_sweep() here, gc_rest_sweep() can decrease
- malloc_increase due to ruby_sized_xfree().
-
-Fri Nov 8 02:50:25 2013 Zachary Scott <e@zzak.io>
-
- * lib/securerandom.rb: [DOC] specify arguments passed to ::random_bytes
- By @chastell [Fixes GH-412] https://github.com/ruby/ruby/pull/412
-
-Fri Nov 8 02:43:01 2013 Zachary Scott <e@zzak.io>
-
- * ext/objspace/object_tracing.c: [DOC] trace_object_allocations_stop
- By @srawlins [Fixes GH-421] https://github.com/ruby/ruby/pull/421
-
-Fri Nov 8 02:34:20 2013 Zachary Scott <e@zzak.io>
-
- * lib/net/ftp.rb: [DOC] Document Net::FTP.mdtm and .set_socket and fix
- spelling typo, based on patch by @artfuldodger [Fixes GH-426]
- https://github.com/ruby/ruby/pull/426
-
-Fri Nov 8 02:14:37 2013 Zachary Scott <e@zzak.io>
-
- * array.c: [DOC] Add note about negative indices in Array overview
- By @ckaenzig [Fixes GH-427] https://github.com/ruby/ruby/pull/427
-
-Fri Nov 8 02:09:12 2013 Zachary Scott <e@zzak.io>
-
- * lib/csv.rb: [DOC] Fix typo in CSV.parse_line by @funky-bibimbap
- [Fixes GH-430] https://github.com/ruby/ruby/pull/430
-
-Fri Nov 8 01:01:54 2013 Zachary Scott <e@zzak.io>
-
- * golf_prelude.rb: syntax formatting for whitespace [Fixes GH-425]
- Patch by @edward https://github.com/ruby/ruby/pull/425
-
-Thu Nov 7 19:36:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: modify malloc_limit strategy.
-
- * fix default values:
- GC_MALLOC_LIMIT_GROWTH_FACTOR
- GC_MALLOC_LIMIT: 8MB -> 16MB
- GC_MALLOC_LIMIT_MAX: 384MB -> 32MB
-
- * algorithm of malloc_limit increment.
- if (malloc_increase < malloc_limit) {
- next_malloc_limit = malloc_limit * factor
- if (malloc_limit > malloc_limit_max) {
- malloc_limit = malloc_increase
- }
- }
- This algorithm change malloc_limit from
- 16MB -> 32MB slowly.
- If malloc_limit exceeds malloc_limit_max, then
- increase with malloc_increase.
-
-Thu Nov 7 11:06:05 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_shuffle_bang): use RARRAY_PTR_USE() without WB
- because there are not new relations.
-
-Thu Nov 7 10:34:12 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_sample): use rb_ary_dup().
-
-Thu Nov 7 09:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_trace.c (rb_threadptr_exec_event_hooks_orig): errinfo should not
- be propagated to trace blocks so that no argument raise does not
- throw internal objects. [ruby-dev:47793] [Bug #9088]
-
-Wed Nov 6 21:30:55 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_before_sweep): Change algorithm of malloc_limit to
- conservative for closing to memory consumption of ruby 2.0.
-
- * gc.c (GC_MALLOC_LIMIT, GC_MALLOC_LIMIT_GROWTH_FACTOR):
- Adjust parameters for new algorithm.
-
-Wed Nov 6 21:16:51 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_shift_m): use RARRAY_PTR_USE() without WB because
- there are not new relations.
-
-Wed Nov 6 21:05:20 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_reverse): use RARRAY_PTR_USE().
-
-Wed Nov 6 19:30:44 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * common.mk (help): add texts about gcbench.
-
-Wed Nov 6 16:32:32 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/open3.rb: tweaked grammar in comments
-
-Wed Nov 6 11:46:36 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_sample): use RARRAY_AREF() and RARRAY_PTR_USE()
- instead of RARRAY_PTR().
-
-Wed Nov 6 10:37:07 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_and): defer hash creation and some refactoring.
-
-Wed Nov 6 09:14:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_vm1_gc_short_lived.rb: added.
- These GC benchmarks do not reflect practical applications.
- They are only for tuning.
-
- * benchmark/bm_vm1_gc_short_with_complex_long.rb: added.
-
- * benchmark/bm_vm1_gc_short_with_long.rb: added.
-
- * benchmark/bm_vm1_gc_short_with_symbol.rb: added.
-
- * benchmark/bm_vm1_gc_wb_ary.rb: added.
-
- * benchmark/bm_vm1_gc_wb_obj.rb: added.
-
- * benchmark/bm_vm_thread_queue.rb: added.
- This benchmark is added to know how fast C version of thread.so.
-
-Wed Nov 6 09:13:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: define RGENGC_ESTIMATE_OLDSPACE == 0 if USE_RGENGC is 0.
-
-Wed Nov 6 07:13:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (Init_GC): add GC::OPTS to show options.
-
-Wed Nov 6 07:12:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: add some options to make quiet.
-
-Wed Nov 6 04:14:25 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: process merge keys before
- reviving objects. Fixes GH psych #168
- * test/psych/test_merge_keys.rb: test for change
- https://github.com/tenderlove/psych/issues/168
-
-Tue Nov 5 21:21:47 2013 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_thread.rb (test_thread_join_in_trap):
- Run the test in a different process.
-
-Tue Nov 5 20:14:32 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (is_live_object): A hidden object may be a live object.
- [ruby-dev:47788] [Bug #9072]
-
-Tue Nov 5 13:37:19 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add support to estimate increase of oldspace memory usage.
- This is another approach to solve an issue discussed at r43530.
- This feature is disabled as default.
-
- This feature measures an increment of memory consumption by oldgen
- objects. It measures memory consumption for each objects when
- the object is promoted. However, measurement of memory consumption
- is not accurate now. So that this measurement is `estimation'.
-
- To implement this feature, move memsize_of() function from
- ext/objspace/objspace.c and expose rb_obj_memsize_of().
-
- Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
- measure memory size, so that we ignores T_DATA objects now.
- For example, some functions skip NULL check for pointer.
-
- The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
- and turned off as default.
-
- We need to compare 3gen GC and this feature carefully.
- (it is possible to enable both feature)
- We need a help to compare them.
-
- * internal.h: expose rb_obj_memsize_of().
-
- * ext/objspace/objspace.c: use rb_obj_memsize_of() function.
-
- * cont.c (fiber_memsize): fix to check NULL.
-
- * variable.c (autoload_memsize): ditto.
-
- * vm.c (vm_memsize): ditto.
-
-Tue Nov 5 04:03:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (GC_MALLOC_LIMIT_MAX): fix default value 512MB -> 384MB.
- 512MB is huge.
-
-Tue Nov 5 03:31:23 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add 3gen GC patch, but disabled as default.
-
- RGenGC is designed as 2 generational GC, young and old generation.
- Young objects will be promoted to old objects after one GC.
- Old objects are not collect until major (full) GC.
-
- The issue of this approach is some objects can promoted as old
- objects accidentally and not freed until major GC.
- Major GC is not frequently so short-lived but accidentally becoming
- old objects are not freed.
-
- For example, the program "loop{Array.new(1_000_000)}" consumes huge
- memories because short lived objects (an array which has 1M
- elements) are promoted while GC and they are not freed before major
- GC.
-
- To solve this problem, generational GC with more generations
- technique is known. This patch implements three generations gen GC.
-
- At first, newly created objects are "Infant" objects.
- After surviving one GC, "Infant" objects are promoted to "Young"
- objects.
- "Young" objects are promoted to "Old" objects after surviving
- next GC.
- "Infant" and "Young" objects are collected if it is not marked
- while minor GC. So that this technique solves this problem.
-
- Representation of generations:
- * Infant: !FL_PROMOTED and !oldgen_bitmap [00]
- * Young : FL_PROMOTED and !oldgen_bitmap [10]
- * Old : FL_PROMOTED and oldgen_bitmap [11]
-
- The macro "RGENGC_THREEGEN" enables/disables this feature, and
- turned off as default because there are several problems.
- (1) Failed sometimes (Heisenbugs).
- (2) Performance down.
- Especially on write barriers. We need to detect Young or Old
- object by oldgen_bitmap. It is slower than checking flags.
-
- To evaluate this feature on more applications, I commit this patch.
- Reports are very welcome.
-
- This patch includes some refactoring (renaming names, etc).
-
- * include/ruby/ruby.h: catch up 3gen GC.
-
- * .gdbinit: fix to show a prompt "[PROMOTED]" for promoted objects.
-
-Tue Nov 5 00:05:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * node.h: catch up comments for last commit.
-
-Tue Nov 5 00:02:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: rename FL_OLDGEN to FL_PROMOTED.
- This flag represents that "this object is promoted at least once."
-
- * gc.c, debug.c, object.c: catch up this change.
-
-Mon Nov 4 22:20:16 2013 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc: Don't use fixed ports: 8070 and 8071.
-
-Mon Nov 4 15:25:52 2013 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc/webrick_testing.rb (start_server): Initialize the server
- at main thread to fail early.
-
-Mon Nov 4 10:08:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_intern.h (TH_EXEC_TAG, TH_JUMP_TAG): get rid of undefined
- behavior of setjmp() in rhs of assignment expression.
- [ISO/IEC 9899:1999] 7.13.1.1
-
-Sun Nov 3 23:06:51 2013 Tanaka Akira <akr@fsij.org>
-
- * sample/test.rb: Make temporary file names unique.
-
-Sun Nov 3 20:41:17 2013 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc: Wrap definitions by TestXMLRPC module.
-
-Sun Nov 3 20:23:38 2013 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc/webrick_testing.rb (stop_server): Don't try to shutdown
- the server if the server is not started.
-
-Sun Nov 3 09:35:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (rb_feature_p): deal with default loadable suffixes.
-
- * load.c (load_lock): initialize statically linked extensions.
-
- * load.c (search_required, rb_require_safe): deal with statically
- linked extensions.
-
- * load.c (ruby_init_ext): defer initialization of statically linked
- extensions until required actually. [Bug #8883]
-
-Sat Nov 2 15:14:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/logger.rb (Logger::LogDevice::LogDeviceMutex#lock_shift_log):
- open file can't be removed or renamed on Windows. [ruby-dev:47790]
- [Bug #9046]
-
- * test/logger/test_logger.rb (TestLogDevice#run_children): don't use
- fork.
-
-Sat Nov 2 07:08:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/logger.rb: Inter-process locking for log rotation
- Current implementation fails log rotation on multi process env.
- by sonots <sonots@gmail.com>
- https://github.com/ruby/ruby/pull/428 fix GH-428 [Bug #9046]
-
-Fri Nov 1 23:24:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (wmap_mark_map): mark live objects only, but delete zombies.
- [ruby-dev:47787] [Bug #9069]
-
-Fri Nov 1 22:45:54 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (struct heap_page, gc_page_sweep, gc_sweep): Refactoring for
- performance. Add before_sweep condition to heap_page structure.
-
- * gc.c (rb_gc_force_recycle): Use before_sweep member.
-
- * gc.c (heap_is_before_sweep, is_before_sweep): Remove. They have not
- already been used.
-
-Fri Nov 1 22:20:28 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (make_deferred): Refactoring. Collect codes which should be
- atomic.
-
- * gc.c (make_io_deferred, obj_free, rb_objspace_call_finalizer,
- gc_page_sweep): Correspond to the above.
-
-Fri Nov 1 21:40:35 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (typedef struct rb_objspace): Refactoring. Move some members
- into profile member.
-
- * gc.c (newobj_of): Correspond to the above.
-
- * gc.c (finalize_list): Ditto.
-
- * gc.c (objspace_live_num): Ditto.
-
- * gc.c (gc_page_sweep): Ditto.
-
- * gc.c (rb_gc_force_recycle): Ditto.
-
- * gc.c (garbage_collect_body): Ditto.
-
- * gc.c (rb_gc_count): Ditto.
-
- * gc.c (gc_stat): Ditto.
-
- * gc.c (gc_prof_set_heap_info): Ditto.
-
- * gc.c (gc_profile_dump_on): Ditto.
-
-Fri Nov 1 20:53:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_scrub): fix typo, should yield invalid byte
- sequence to be scrubbed. reported by znz at IRC.
-
-Fri Nov 1 17:25:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (is_live_object): finalizer may not run because of lazy-sweep.
- [ruby-dev:47786] [Bug #9069]
-
-Fri Nov 1 16:55:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_scrub): export with fixed length arguments, and
- allow nil as replacement string instead of omitting.
-
-Fri Nov 1 06:20:44 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_mutex_struct): reduce rb_mutex_t size by 8 bytes
- on 64bit platform. Patch by Eric Wong. [Feature #9068][ruby-core:58114]
-
-Fri Nov 1 01:08:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: print HWM (high water mark) if possible.
-
-Thu Oct 31 21:48:31 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/streamparser.rb: Add dependency file require.
- [Bug #9062] [ruby-dev:47779]
- Reported by Ippei Obayashi. Thanks!!!
-
-Thu Oct 31 14:09:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_method.c (rb_method_entry_make): fix to pass an ISeq value.
- OBJ_WRITTEN() accepts only VALUE.
-
-Wed Oct 30 19:07:57 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el (ruby-brace-to-do-end)
- (ruby-do-end-to-brace, ruby-toggle-block): Remove functions that
- are already in the latest released version of Emacs (24.3).
- [Bug #7565]
-
-Wed Oct 30 12:44:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (config.status): add missing variables,
- PLATFORM_DIR and THREAD_MODEL.
-
-Wed Oct 30 12:20:32 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (v2w): Normalize a rational value to an integer if possible.
- [ruby-core:58070] [Bug #9059] reported by Isaac Schwabacher.
-
-Wed Oct 30 12:08:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_uniq_bang): use rb_ary_modify_check() instead of
- rb_ary_modify() because the array will be unshared soon.
-
-Wed Oct 30 03:25:10 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: make less garbage when
- testing if a string is binary.
-
-Wed Oct 30 03:08:24 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: string subclasses should
- not be considered to be binary. Fixes Psych / GH 166
- https://github.com/tenderlove/psych/issues/166
-
- * test/psych/test_string.rb: test for fix
-
-Tue Oct 29 23:01:18 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_zip): some refactoring.
-
-Tue Oct 29 22:11:37 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_uniq_bang): use st_foreach() instead of for loop.
-
-Tue Oct 29 20:01:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
- safe functions during garbage collection such as xfree().
-
- On default, T_DATA objects are freed at same points as finalizers.
- This approach protects issues such as reported by [ruby-dev:35578].
- However, freeing T_DATA objects immediately helps heap usage.
-
- Most of T_DATA (in other words, most of dfree functions) are safe.
- However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
- for safety.
-
- * cont.c: ditto.
-
- * dir.c: ditto.
-
- * encoding.c: ditto.
-
- * enumerator.c: ditto.
-
- * error.c: ditto.
-
- * file.c: ditto.
-
- * gc.c: ditto.
-
- * io.c: ditto.
-
- * iseq.c: ditto.
-
- * marshal.c: ditto.
-
- * parse.y: ditto.
-
- * proc.c: ditto.
-
- * process.c: ditto.
-
- * random.c: ditto.
-
- * thread.c: ditto.
-
- * time.c: ditto.
-
- * transcode.c: ditto.
-
- * variable.c: ditto.
-
- * vm.c: ditto.
-
- * vm_backtrace.c: ditto.
-
- * vm_trace.c: ditto.
-
- * ext/bigdecimal/bigdecimal.c: ditto.
-
- * ext/objspace/objspace.c: ditto.
-
- * ext/stringio/stringio.c: ditto.
-
- * ext/strscan/strscan.c: ditto.
-
-Tue Oct 29 19:48:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: fix typo (FL_WB_PROTECT -> FL_WB_PROTECTED).
-
-Tue Oct 29 18:45:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (tp_free): removed because empty free function.
- Use RUBY_TYPED_NEVER_FREE instead.
-
-Tue Oct 29 18:37:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: introduce new flags for T_TYPEDDATA.
- * RUBY_TYPED_FREE_IMMEDIATELY: free the data given by DATA_PTR()
- with dfree function immediately. Otherwise (default), the data
- freed at finalization point.
- * RUBY_TYPED_WB_PROTECTED: make this object with FL_WB_PROTECT
- (not shady).
-
- * gc.c (obj_free): support RUBY_TYPED_FREE_IMMEDIATELY.
-
-Tue Oct 29 16:49:03 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (vm_malloc_increase): decrease it more carefully.
-
-Tue Oct 29 16:24:52 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_page_resurrect): return a page in tomb heap even if
- freelist is NULL.
-
-Tue Oct 29 15:46:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby_atomic.h (ATOMIC_SIZE_CAS): new macro, compare and swap size_t.
-
-Tue Oct 29 12:08:05 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/readline/readline.c (readline_getc): Consider
- NULL as input.
-
-Tue Oct 29 11:10:08 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (gc_profile_total_time): fix off-by-one error in
- GC::Profiler.total_time.
- * test/ruby/test_gc.rb (class TestGc): test for above.
-
-Tue Oct 29 09:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
- ruby_vm_global_state_version into two separate counters - one for the
- global method state and one for the global constant state. This means
- changes to constants do not affect method caches, and changes to
- methods do not affect constant caches. In particular, this means
- inclusions of modules containing constants no longer globally
- invalidate the method cache.
-
- * class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c:
- rename rb_clear_cache_by_class to rb_clear_method_cache_by_class
-
- * class.c, include/ruby/intern.h, variable.c, vm_method.c: add
- rb_clear_constant_cache
-
- * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in
- rb_call_info_struct to method_state
-
- * vm_method.c: rename vmstat field in struct cache_entry to method_state
-
-Mon Oct 28 23:26:04 2013 Tanaka Akira <akr@fsij.org>
-
- * test/readline/test_readline.rb (teardown): Clear Readline.input and
- Readline.output.
-
-Mon Oct 28 21:35:31 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/file/depend, ext/-test-/postponed_job/depend,
- ext/-test-/tracepoint/depend: New files for dependencies.
-
-Mon Oct 28 15:32:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/depend (ossl.o): work around of dependency of
- thread_native.h, which depends on headers by THREAD_MODEL.
- [ruby-dev:47777]
-
- * ext/openssl/extconf.rb: need THREAD_MODEL.
-
-Mon Oct 28 14:57:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (ruby_init_ext): share feature names between frame name and
- provided features.
-
-Mon Oct 28 14:41:27 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el: Import ruby-electric.el 2.1 from
- https://github.com/knu/ruby-electric.el.
-
- * Hitting the newline-and-indent key within a comment fires
- comment-indent-new-line.
-
- * Introduce a new feature
- `ruby-electric-autoindent-on-closing-char`.
-
- * Fix fallback behavior of ruby-electric-space/return that
- caused error with auto-complete.
-
-Mon Oct 28 13:17:17 2013 Or Cohen <orc@fewbytes.com>
-
- * error.c (name_err_to_s): remove no longer needed overriding, since
- r30455 which made exc_to_s almost same. Fixes [GH-413].
-
-Mon Oct 28 12:42:11 2013 Tanaka Akira <akr@fsij.org>
-
- * common.mk, ext/objspace/depend, ext/coverage/depend,
- ext/-test-/debug/depend, ext/date/depend: Update dependencies.
-
-Mon Oct 28 09:29:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * vm.c: vm_clear_all_cache is not necessary now we use a 64 bit counter
- for global state version.
-
- * vm_insnhelper.h: ruby_vm_global_state_version overflow is unnecessary
-
-Mon Oct 28 07:47:32 2013 Aman Gupta <ruby@tmm1.net>
-
- * vm_backtrace.c (rb_profile_frame_classpath): do not use rb_inspect
- directly, since it might have a custom implementation or show ivars.
-
-Mon Oct 28 04:10:41 2013 Aman Gupta <ruby@tmm1.net>
-
- * vm_backtrace.c (rb_profile_frame_classpath): handle singleton
- methods defined directly on an object.
- * test/-ext-/debug/test_profile_frames.rb: test for above.
-
-Mon Oct 28 00:52:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * struct.c (new_struct): fix warning message, class name and encoding.
-
-Sun Oct 27 20:53:08 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/readline/readline.c: Include ruby/thread.h for
- rb_thread_call_without_gvl2.
- (readline_rl_instream, readline_rl_outstream): Record FILE
- structures allocated by this extension.
- (getc_body): New function extracted from readline_getc.
- (getc_func): New function.
- (readline_getc): Use rb_thread_call_without_gvl2 to invoke getc_func.
- [ruby-dev:47033] [Bug #8749]
- (clear_rl_instream, clear_rl_outstream): Close FILE structure
- allocated by this extension reliably. [ruby-core:57951] [Bug #9040]
- (readline_readline): Use clear_rl_instream and clear_rl_outstream.
- (readline_s_set_input): Set readline_rl_instream.
- (readline_s_set_output): Set readline_rl_outstream.
- (Init_readline): Don't call readline_s_set_input because
- readline_getc doesn't block other threads for any FILE structure now.
-
- [ruby-dev:47033] [Bug #8749] reported by Nobuhiro IMAI.
- [ruby-core:57951] [Bug #9040] reported by Eamonn Webster.
-
-Sat Oct 26 19:31:28 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * gc.c: catch up recent changes to compile on GC_DEBUG,
- RGENGC_CHECK_MODE.
-
-Sat Oct 26 19:08:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * range.c (range_initialize_copy): disallow to modify after
- initialized.
-
-Sat Oct 26 17:48:54 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/open-uri.rb (meta_add_field): : Re-implemented.
- [ruby-core:58017] [Bug #9051] patch by Eamonn Webster.
-
-Sat Oct 26 14:35:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_dump_on): use "Page" terminology.
-
-Sat Oct 26 13:25:45 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_sweep, gc_heap_lazy_sweep): fix measurement code.
- We only need one sweep time measurement without lazy sweep.
-
-Sat Oct 26 11:59:13 2013 Tanaka Akira <akr@fsij.org>
-
- * addr2line.c: Include ELF header after system headers (especially
- sys/types.h) to avoid compilation failure,
- "usr/include/sh3/elf_machdep.h:4:2: error: #error Define _BYTE_ORDER!",
- on NetBSD/sh3 (dreamcast, hpcsh, landisk, mmeye).
-
-Sat Oct 26 11:35:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: tuning parameters.
-
- * gc.c (GC_MALLOC_LIMIT): change default value to 16MB.
-
- * gc.c (GC_MALLOC_LIMIT_GROWTH_FACTOR): change default value to 2.0.
-
- * gc.c (gc_before_sweep): change decrease ratio of `malloc_limit'
- from 1/4 to 1/10.
-
-Sat Oct 26 11:30:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (vm_malloc_increase): do gc_rest_sweep() before GC.
- gc_rest_sweep() can reduce malloc_increase, so try it before GC.
- Otherwise, malloc_increase can be less than malloc_limit at
- gc_before_sweep(). This means that re-calculation of malloc_limit
- may be wrong value.
-
-Sat Oct 26 06:35:41 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_before_heap_sweep): Restructure code to mean clearly.
- heap->freelist is connected to end of list.
-
-Sat Oct 26 04:01:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_before_heap_sweep): fix freelist management.
- After rb_gc_force_recycle() for a object belonging to heap->freelist,
- `heap->using_page->freelist' is not null.
-
-Thu Oct 24 21:57:24 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * parse.y: Remove +(binary) and -(binary) special cases
- [Feature #9048]
-
-Thu Oct 24 12:45:53 2013 Zachary Scott <e@zzak.io>
-
- * object.c: [DOC] Document first argument also takes string for:
-
- rb_mod_const_get, rb_mod_const_set, rb_mod_const_defined
-
- Also added note about NameError exception for invalid constant name
-
-Thu Oct 24 12:23:58 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_terminate_all): add a comment why we need
- state check and call terminate_i again.
-
-Thu Oct 24 12:15:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_terminate_all): add a comment why infinite
- sleep is safe.
-
-Thu Oct 24 07:41:42 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: add new initial_growth_max tuning parameter.
- [ruby-core:57928] [Bug #9035]
- * gc.c (heap_set_increment): when initial_growth_max is set,
- do not grow number of slots by more than growth_max at a time.
- * gc.c (rb_gc_set_params): load optional new tuning value from
- RUBY_HEAP_SLOTS_GROWTH_MAX environment variable.
- * test/ruby/test_gc.rb (class TestGc): test for above.
-
-Thu Oct 24 01:34:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/win32.h (rb_infinity_float): suppress overflow in
- constant arithmetic warnings. [ruby-core:57981] [Bug #9044]
-
-Thu Oct 24 00:11:24 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/ostruct.rb: raise NoMethodError with a #name and #args.
- Raise RuntimeError when modifying frozen instances
- instead of TypeError.
- (OpenStruct#each_pair): Return an enumerator with size
- (OpenStruct#delete): Use the converted argument.
- Patches by Kenichi Kamiya. [Fixes GH-383]
-
- * test/ostruct/test_ostruct.rb: Added tests for above.
-
-Thu Oct 24 00:10:22 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * array.c: Add Array#to_h [Feature #7292]
-
- * enum.c: Add Enumerable#to_h
-
-Wed Oct 23 23:48:28 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: Rename free_min to min_free_slots and free_min_page to
- max_free_slots. The algorithm for heap growth is:
- if (swept_slots < min_free_slots) pages++
- if (swept_slots > max_free_slots) pages--
-
-Wed Oct 23 22:51:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (config.h): VC 2013 supports C99 mathematics
- functions. [ruby-core:57981] [Bug #9044]
-
-Wed Oct 23 19:13:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: move increment from heap to heap_pages.
- Share `increment' information with heaps.
-
- * gc.c: change ratio of heap_pages_free_min_page
- to 0.80.
- This change means slow down page freeing speed.
-
-Wed Oct 23 17:52:03 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_pages_free_unused_pages): cast to (int) for size_t
- variable `i'.
-
-Wed Oct 23 17:39:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: introduce tomb heap.
- Tomb heap is where zombie objects and ghost (freed slot) lived in.
- Separate from other heaps (now there is only eden heap) at sweeping
- helps freeing pages more efficiently.
- Before this patch, even if there is an empty page at former phase
- of sweeping, we can't free it.
-
- Algorithm:
- (1) Sweeping all pages in a heap and move empty pages from the
- heap to tomb_heap.
- (2) Check all existing pages and free a page
- if all slots of this page are empty and
- there is enough empty slots (checking by swept_num)
-
- To introduce this patch, there are several tuning of GC parameters.
-
-Wed Oct 23 14:20:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_prof_sweep_timer_stop): catch up recent changes
- to compile on GC_PROFILE_MORE_DETAIL=1.
-
-Wed Oct 23 11:43:27 2013 Zachary Scott <e@zzak.io>
-
- * file.c: [DOC] fix rdoc format of File#expand_path from r43386
-
-Tue Oct 22 21:58:28 2013 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * vm_core.h (enum): avoid syntax error.
-
- * method.h: ditto.
-
- * internal.h: ditto.
-
-Tue Oct 22 19:53:16 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (Init_heap): move logics from heap_pages_init() and remove
- heap_pages_init().
-
-Tue Oct 22 19:19:05 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: allow multiple heaps.
- Now, objects are managed by page. And a set of pages is called heap.
- This commit supports multiple heaps in the object space.
-
- * Functions heap_* and rb_heap_t manages heap data structure.
- * Functions heap_page_* and struct heap_page manage page data
- structure.
- * Functions heap_pages_* and struct rb_objspace_t::heap_pages
- maintains all pages.
- For example, pages are allocated from the heap_pages.
-
- See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design
- and https://bugs.ruby-lang.org/attachments/4015/data-heap_structure_with_multiple_heaps.png
- for more details.
-
- Now, there is only one heap called `eden', which is a space for all
- new generated objects.
-
-Tue Oct 22 18:26:12 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/pp.rb (object_address_group): Use Kernel#to_s to obtain the class
- name and object address.
- This fix a problem caused by %p in C generates variable length
- address.
- Reported by ko1 via IRC.
-
-Tue Oct 22 16:57:48 2013 Benoit Daloze <eregontp@gmail.com>
-
- * file.c (File#expand_path): [DOC] improve documentation of File#expand_path.
- Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002]
-
-Tue Oct 22 15:59:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): don't skip current directories if FNM_DOTMATCH
- is given. [ruby-core:53108] [Bug #8006]
-
-Tue Oct 22 14:53:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: exterminate Zombies.
- There is a bug that T_ZOMBIE objects are not collected.
- Because there is a pass to miss finalizer postponed job
- with multi-threading. This patch solve this issue.
-
- * vm_trace.c (rb_postponed_job_register_one): set
- RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(th) if another same job
- is registered.
- There is a possibility to remain a postponed job without
- interrupt flag.
-
- * vm_trace.c (rb_postponed_job_register_one): check interrupt
- carefully.
-
- * vm_trace.c (rb_postponed_job_register_one): use additional space
- to avoid buffer full.
-
- * gc.c (gc_finalize_deferred_register): check failure.
-
- * thread.c (rb_threadptr_execute_interrupts): check
- `postponed_job_interrupt' immediately. There is a possibility
- to miss this flag.
-
-Tue Oct 22 12:11:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check if the given CFLAGS and LDFLAGS are working, and
- bail out early if not.
-
-Tue Oct 22 00:06:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_exists_p): warn deprecated name. [Bug #9041]
-
-Mon Oct 21 23:57:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (load_encoding): should preserve outer errinfo, so that
- expected exception may not be lost. [ruby-core:57949] [Bug #9038]
-
-Sun Oct 20 15:41:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_reopen): create a new, temporary FD via rb_sysopen and
- call rb_cloexec_dup2 on it to atomically replace the file fptr->fd
- points to. This leaves no possible window where fptr->fd is invalid
- to userspace (even for any threads running w/o GVL). based on the
- patch by Eric Wong <normalperson@yhbt.net> at [ruby-core:57943].
- [Bug #9036]
-
-Sun Oct 20 15:29:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_syserr_fail_path_in): new function split from
- rb_sys_fail_path_in to raise SystemCallError without errno.
-
- * internal.h (rb_syserr_fail_path): like rb_sys_fail_path but without
- errno.
-
-Sun Oct 20 13:58:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (rb_obj_wb_unprotect, rb_obj_written),
- (rb_obj_write): suppress unused-parameter warnings.
-
-Sun Oct 20 10:32:48 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update RubyGems to master 0886307. This commit
- improves documentation and should bring ruby above 75% documented on
- rubyci.
-
-Sun Oct 20 09:30:56 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 3de7e0f. Changes:
-
- Only attempt to build extensions for newly-installed gems. This
- prevents compilation attempts at gem activation time for gems that
- already have extensions built.
-
- Fix crash in the dependency resolver for dependencies that cannot be
- resolved.
-
- * test/rubygems: ditto.
-
-Sun Oct 20 05:24:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (rb_class2name): should return real class name, not
- singleton class or iclass.
-
-Sun Oct 20 04:18:48 2013 Aman Gupta <ruby@tmm1.net>
-
- * variable.c (rb_class2name): call rb_tmp_class_path() directly to
- avoid extra rb_str_dup() from rb_class_name().
-
-Sat Oct 19 19:59:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/file.c (code_page): use simple array instead of st_table.
-
- * encoding.c (rb_locale_encindex): defer initialization of win32 code
- page table until encoding db loaded.
-
-Sat Oct 19 08:25:05 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix rb_objspace_t.
- * make "struct heap" and move most of variables
- in rb_objspace_t::heap.
- * rename rb_objspace_t::heap::sorted to
- rb_objspace_t::heap_sorted_pages
- and make a macro heap_sorted_pages.
- * rename rb_objspace_t::heap::range to
- rb_objspace_t::heap_range and rename macros
- lomem/himem to heap_lomem/heap_himem.
-
-Sat Oct 19 07:14:40 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 42543b6. Changes:
-
- Fix `gem update` for gems with multiple platforms.
-
- * test/rubygems: ditto.
-
-Sat Oct 19 06:55:52 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 0a3814b. Changes:
-
- Fixed extension directory in Gem::Specification#require_paths.
-
- Allow installation of gems when $HOME is nonexistent or unwritable.
-
- Use proper API in InstallCommand.
-
- Improve support for path option in gem dependency files.
-
- Remove warnings.
-
- * test/rubygems: ditto.
-
-Fri Oct 18 15:23:34 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change terminology of heap.
- Change "slot" to "page". "Slot" is a space of RVALUE.
- 1. "Heap" consists of a set of "heap_page"s (pages).
- 2. Each "heap_page" has "heap_page_body".
- 3. "heap_page_body" has RVALUE (a.k.a. "slot") spaces.
- 4. "sorted" is a sorted array of "heap_page"s, sorted
- by address of heap_page_body (for "is_pointer_to_heap").
-
- See https://bugs.ruby-lang.org/attachments/4008/data-heap_structure.png.
-
-Fri Oct 18 09:40:43 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master cee6788. Changes:
-
- Fix test failure on vc10-x64 Server on rubyci.org due to attempting
- to File.chmod where it is not supported.
-
- Continuing work on improved gem dependencies file (Gemfile) support.
-
- * test: ditto.
-
-Fri Oct 18 06:02:49 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master f738c67. Changes:
-
- Fixed test bug for ruby with ENABLE_SHARED = no
-
- * test/rubygems: ditto.
-
-Fri Oct 18 00:57:07 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/tsort.rb (TSort.tsort): Extracted from TSort#tsort.
- (TSort.tsort_each): Extracted from TSort#tsort_each.
- (TSort.strongly_connected_components): Extracted from
- TSort#strongly_connected_components.
- (TSort.each_strongly_connected_component): Extracted from
- TSort#each_strongly_connected_component.
-
-Thu Oct 17 18:50:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE): introduced.
- This macro enable checker compare with allocated memory and
- declared old_size of sized_xfree and sized_xrealloc.
-
-Thu Oct 17 18:45:41 2013 Koichi Sasada <ko1@atdot.net>
-
- * string.c (STR_HEAP_SIZE): includes TERM_LEN(str).
-
- * string.c (rb_str_memsize): use STR_HEAP_SIZE().
-
-Thu Oct 17 17:43:00 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_method): set ci->me to 0 when the
- original method of a refined method is undef to avoid SEGV.
-
- * vm_method.c (rb_method_entry_without_refinements): return 0 when
- the original method of a refined method is undef to avoid SEGV.
-
- * test/ruby/test_refinement.rb: related test.
-
-Thu Oct 17 17:38:36 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c, internal.h: rename ruby_xsizefree/realloc to
- rb_sized_free/realloc.
-
- * array.c: catch up these changes.
-
- * string.c: ditto.
-
-Thu Oct 17 17:32:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c, string.c: use ruby_xsizedfree() and ruby_xsizedrealloc().
-
- * internal.h (SIZED_REALLOC_N): define a macro as REALLOC_N().
-
-Thu Oct 17 17:11:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (console_emulator_p): check by comparison between
- module handle of WriteConsoleW and kernel32.dll.
-
- * configure.in, win32/Makefile.sub, win32/setup.mak: no longer need
- psapi.lib.
-
-Thu Oct 17 16:53:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c, internal.h: add new internal memory management functions.
- * void *ruby_xsizedrealloc(void *ptr, size_t new_size, size_t old_size)
- * void ruby_xsizedfree(void *x, size_t size)
- These functions accept additional size parameter to calculate more
- accurate malloc_increase parameter which control GC timing.
- [Feature #8985]
-
-Thu Oct 17 14:21:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/file.c (rb_file_expand_path_internal): fix memory leaks at
- a non-absolute home exception.
-
-Thu Oct 17 14:06:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c (newobj_i): fix memory leak.
- There is possibility to remain info due to missing FREEOBJ event.
- FREEOBJ events are skipped while suppress_tracing state, for example,
- during trace events are invoking.
-
-Thu Oct 17 12:30:16 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/tsort.rb (TSort.each_strongly_connected_component_from):
- Extracted from TSort#each_strongly_connected_component_from.
-
-Thu Oct 17 11:07:06 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 941c21a. Changes:
-
- Restored method bundler wants to remove for compatibility.
-
- Improvements to Gemfile compatibility.
-
- * test/rubygems: ditto.
-
-Thu Oct 17 08:08:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c (newobj_i): add workaround.
- some bugs hits this check.
-
- * ext/objspace/object_tracing.c (object_allocations_reporter_i): cast as pointer.
-
-Thu Oct 17 07:36:53 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 2abce58. Changes:
-
- Fixed documentation generation when sdoc and json are installed as
- gems.
-
- Added some missing documentation.
-
-Thu Oct 17 07:10:26 2013 Zachary Scott <e@zzak.io>
-
- * ext/curses/curses.c: [DOC] Cleaned up formatting consistency of rdoc
- comments for Curses, including period spacing and column width.
-
- This patch also fixed some typos. Thanks to @postmodern for the patch!
- [Fixes GH-420] https://github.com/ruby/ruby/pull/420
-
-Thu Oct 17 06:58:42 2013 Zachary Scott <e@zzak.io>
-
- * ext/date/date_core.c: [DOC] plural grammar fixed by @scott113341
- Contributed via documenting-ruby.org: documenting-ruby/ruby#16
- https://github.com/documenting-ruby/ruby/pull/16
-
-Thu Oct 17 05:52:31 2013 Zachary Scott <e@zzak.io>
-
- * ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah
- [Fixes GH-418] https://github.com/ruby/ruby/pull/418 based on the
- original discussion from documenting-ruby/ruby#18
-
-Thu Oct 17 05:40:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (objspace_each_objects): do not skip empty RVALUEs.
-
-Thu Oct 17 05:31:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * error.c (rb_bug_reporter_add): return simply 0 if failed.
- Please check return value.
-
-Thu Oct 17 05:17:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c: add new method
- ObjectSpace.trace_object_allocations_debug_start for GC debugging.
- If you encounter the BUG "... is T_NONE" (and so on) on your
- application, please try this method at the beginning of your app.
-
-Wed Oct 16 22:35:27 2013 Zachary Scott <e@zzak.io>
-
- * ext/io/nonblock/nonblock.c: use rb_cIO instead of VALUE
-
-Wed Oct 16 17:45:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * bootstraptest/runner.rb: check nil before calling `signal?'
- for a process status.
-
-Wed Oct 16 17:37:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * error.c, internal.h (rb_bug_reporter_add): add a new C-API.
- rb_bug_reporter_add() allows to register a function which
- is called at rb_bug() called.
-
- * ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
-
- * ext/-test-/bug_reporter/extconf.rb: ditto.
-
- * test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.
-
-Wed Oct 16 15:14:21 2013 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add a line into NEWS for last commit.
-
-Wed Oct 16 15:09:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c: add a new method `reachable_objects_from_root'.
- ObjectSpace.reachable_objects_from_root returns all objects referred
- from root (called "root objects").
- This feature is for deep object analysis.
-
- * test/objspace/test_objspace.rb: add a test.
-
-Wed Oct 16 15:00:21 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master b955554. Changes:
-
- Fixed NameError for Gem::Ext due to re-entering file lookup in
- RubyGems' overridden require. Bug by Koichi Sasada.
-
- Fixed possible circular require warning in tests.
-
- Used existing constant for `gem install -g` dependency file list.
-
- * test/rubygems: ditto.
-
-Wed Oct 16 09:42:42 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 278d00d. Changes:
-
- Fixes building extensions without a "clean" make rule
-
- Adds gem dependency file autodetection to "gem install -g"
-
- * test/rubygems: Tests for the above.
-
-Wed Oct 16 09:12:23 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master commit 2a74263. This fixes
- several bugs in RubyGems 2.2.0.preview.1.
-
- * test/rubygems: ditto.
-
-Wed Oct 16 07:25:02 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (gc_mark_roots): rename roots to be categories
- instead of function names.
-
-Tue Oct 15 19:18:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.h (rb_objspace_reachable_objects_from_root): added.
- This API provides information which objects are root objects.
- `category' shows what kind of root objects.
-
- * gc.c (gc_mark_roots): separate from gc_marks_body().
-
-Tue Oct 15 17:47:59 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c: Fix a typo. MacOS X doesn't have ENOTSUPP.
-
-Mon Oct 14 12:32:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (process_options): load statically linked extensions before
- rubygems, because of ext/thread.
-
- * ruby.c (process_options): use gem_prelude instead of requiring
- rubygems directly when --enable=gems is given.
-
- * Makefile.in (DEFAULT_PRELUDES): always use gem_prelude regardless of
- --disable-rubygems.
-
-Mon Oct 14 11:07:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_framework): should append framework options to
- $LIBS, not $LDFLAGS. The former is propagated to exts.mk when
- enable-static-linked-ext.
-
- * lib/mkmf.rb (create_makefile): ranlib on static library, not DLLIB.
-
-Sun Oct 13 23:53:40 2013 Andrew Grimm <andrew.j.grimm@gmail.com>
-
- * vsnprintf.c: Fix spelling from compliment to complement.
- Patch by @agrimm.
-
- * include/ruby/ruby.h: ditto
-
-Sun Oct 13 20:59:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (Init_BareVM): initialize defined_module_hash here,
- Init_top_self() is too late to register core classes/modules.
-
- * compile.c (compile_array_): no hash to merge if it is empty.
-
- * vm.c (m_core_hash_merge_kwd): just check keys if only one argument
- is given, without merging.
-
-Sat Oct 12 06:35:01 2013-10-11 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake: Update to rake 10.1.0
- * bin/rake: ditto.
- * test/rake: ditto.
-
- * NEWS: Update NEWS to include rake 10.1.0 and links to release notes.
-
-Sat Oct 12 03:26:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * class.c, variable.c, gc.c (rb_class_tbl): removed.
-
- * vm.c, vm_core.h (rb_vm_add_root_module): added to register as a
- defined root module or class.
- This guard helps mark miss from defined classes/modules they are
- only referred from C's global variables in C-exts.
- Basically, it is extension's bug.
- Register to hash object VM has.
- Marking a hash objects allows generational GC supports.
-
- * gc.c (RGENGC_PRINT_TICK): disable (revert).
-
-Sat Oct 12 03:24:49 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_method.c (rb_gc_mark_unlinked_live_method_entries):
- revert last commit to introduce debug prints.
-
-Fri Oct 11 21:05:19 2013 Koichi Sasada <ko1@atdot.net>
-
- * internal.h, parse.y: use `full_mark' instead of `full_marking'.
-
-Fri Oct 11 20:58:16 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: use terminology `full_mark' instead of `minor_gc'
- in mark functions.
-
-Fri Oct 11 20:46:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: use __GNUC__ instead of __GCC__.
-
-Fri Oct 11 20:35:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c, parse.y: support generational Symbol related marking.
- Each symbols has String objects respectively to represent
- Symbols.
- These objects are marked only when:
- * full marking
- * new symbols are added
- This hack reduce symbols (related strings) marking time.
- For example, on my Linux environment, the following code
- "20_000_000.times{''}"
- with 40k symbols (similar symbol number on Rails 3.2.14 app,
- @jugyo tells me) boosts, from 7.3sec to 4.2sec.
-
- * internal.h: change prototype of rb_gc_mark_symbols().
-
-Fri Oct 11 19:27:22 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el: Import ruby-electric.el 2.0.1 which fixes
- a bug and a flaw with auto-end introduced in the revamp.
-
- * ruby-forward-sexp is inappropriate here because it moves the
- cursor past the keyword.
-
- * Fix a reversed looking-back check in
- ruby-electric--block-beg-keyword-at-point-p.
-
- * Do not add end again if space or return is hit repeatedly
- after a block beginning keyword.
-
-Fri Oct 11 18:12:47 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/gc_hook.c: prohibit reentrant.
-
-Fri Oct 11 18:11:34 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_postponed_job_flush): fix bit operation.
-
-Fri Oct 11 17:33:24 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el: Import ruby-electric.el 2.0 from
- https://github.com/knu/ruby-electric.el which integrates changes
- from another fork by @qoobaa.
-
- * Allow ruby-electric-mode to be disabled by introducing a
- dedicated key map. Electric key bindings are now defined in
- ruby-electric-mode-map instead of overwriting ruby-mode-map.
-
- * Add ruby-electric-mode-hook.
-
- * Use a remap in binding ruby-electric-delete-backward-char.
-
- * Totally revamp electric keywords and then introduce electric
- return. Modifier keywords are now properly detected making
- use of ruby-mode's indentation level calculator, and
-
- * block-mid keywords (then, else, elsif, when, rescue and
- ensure) also become electric with automatic reindentation.
-
- * Add standardized comments for ELPA integration.
-
- * Fix interaction with smartparens-mode by disabling its end
- keyword completion, since ruby-electric has become more clever
- at it.
-
- * The custom variable `ruby-electric-keywords` is changed to
- `ruby-electric-keywords-alist`, allowing user to fine-grained
- configuration.
-
-Fri Oct 11 16:53:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_postponed_job_flush): simplify.
-
-Fri Oct 11 03:36:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (rb_threadptr_execute_interrupts): flush postponed job only
- once at last.
-
- * vm_trace.c (rb_postponed_job_flush): defer calling postponed jobs
- registered while flushing to get rid of infinite reentrance of
- ObjectSpace.after_gc_start_hook. [ruby-dev:47400] [Bug #8492]
-
-Thu Oct 10 23:04:00 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_or): remove unused variables.
-
-Thu Oct 10 23:01:16 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_or): use rb_hash_keys().
-
-Thu Oct 10 21:36:16 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_compact_bang): use ary_resize_smaller().
-
-Thu Oct 10 17:25:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (vm_exec): support :b_return event for "lambda{return}.call".
- [Bug #8622]
-
- * test/ruby/test_settracefunc.rb: add a test.
-
-Thu Oct 10 13:52:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (postponed_job): use preallocated buffer.
- Pre-allocate MAX_POSTPONED_JOB (1024) sized buffer
- and use it.
- If rb_postponed_job_register() cause overflow, simply it
- fails and returns 0.
- And maybe rb_postponed_job_register() is signal safe.
-
- * vm_core.h: change data structure.
-
-Thu Oct 10 11:11:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (Init_VM): hide also the singleton class of frozen-core, not
- only frozen-core itself.
-
-Thu Oct 10 06:02:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_rand.rb: fix r43224. local variable `e' is
- no longer available.
-
-Thu Oct 10 00:02:35 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * numeric.c (fix_aref): avoid a possible undefined behavior.
- 1L << 63 on 64-bit platform is undefined, at least, according to
- ISO/IEC 9899 (C99) 6.5.7.
-
-Wed Oct 9 23:57:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (id_for_attr): avoid inadvertent symbol creation.
-
-Wed Oct 9 18:03:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_attr): preserve encoding of the attribute ID in
- error message.
-
-Wed Oct 9 17:40:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_fstring): because of lazy sweep, str may be unmarked
- already and swept at next time, so mark it for the time being.
- [ruby-core:57756]
-
-Wed Oct 9 13:53:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003]
-
- * thread.c (rb_exec_recursive_paired_outer): new function which is
- combination of paired and outer variants.
-
-Wed Oct 9 09:18:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/debug.h,
- vm_backtrace.c (rb_profile_frame_full_label): add new C API
- rb_profile_frame_full_label() which returns label with
- qualified method name.
- Note that in future version of Ruby label() may return
- same return value of full_label().
-
- * ext/-test-/debug/profile_frames.c,
- test/-ext-/debug/test_profile_frames.rb: fix a test for this change.
-
-
-Wed Oct 9 00:55:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (load_lock): display backtrace to $stderr at circular
- require.
-
- * vm_backtrace.c (rb_backtrace_print_to): new function to print
- backtrace to the given output.
-
-Tue Oct 8 21:03:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_backtrace.c, include/ruby/debug.h: add new APIs
- * VALUE rb_profile_frame_method_name(VALUE frame)
- * VALUE rb_profile_frame_qualified_method_name(VALUE frame)
-
- * iseq.c (rb_iseq_klass), internal.h: add new internal function
- rb_iseq_method_name().
-
- * ext/-test-/debug/profile_frames.c (profile_frames),
- test/-ext-/debug/test_profile_frames.rb: add a test.
-
-Tue Oct 8 16:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no
- block is given.
-
- * internal.h: define rb_hash_values() as internal API.
-
-Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_uniq): use rb_hash_keys().
-
- * internal.h: define rb_hash_keys() as internal API.
-
- * hash.c (rb_hash_keys): ditto.
-
-Tue Oct 8 10:56:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * cont.c: disable FIBER_USE_NATIVE on GNU/Hurd because it doesn't
- support a combination getcontext() and threads. Patch by
- Gabriele Giacone (1o5g4r8o@gmail.com). [Bug #8990][ruby-core:57685]
-
-Tue Oct 8 05:58:12 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
- time Time object as Ruby 2.0 and before.
-
-Tue Oct 8 05:40:37 2013 Eric Hodel <drbrain@segment7.net>
-
- * .travis.yml: Rebuild Travis CI's "ruby-head" version on successful
- build. Patch by Konstantin Haase. [Fixes GH-417]
- https://github.com/ruby/ruby/pull/417
-
-Tue Oct 8 04:28:25 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-mode.el: Use preceding-char/following-char
- (returning 0 at BOF/EOF) instead of char-before/char-after
- (returning nil at BOF/EOF) to avoid error from char-syntax when
- at BOF/EOF.
-
-Tue Oct 8 04:12:45 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el (ruby-mode-set-encoding): Add a missing
- else clause to unbreak with `cp932`, etc.
-
- * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
-
-Tue Oct 8 03:57:34 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el (ruby-mode-set-encoding): Use
- `default-buffer-file-coding-system` if the :prefer-utf-8
- property is not available.
-
- * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
-
- * misc/ruby-additional.el (ruby-encoding-map): Override the
- default value.
-
-Tue Oct 8 03:19:19 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el (ruby-mode-set-encoding): Add support
- for `prefer-utf-8` which was introduced in Emacs trunk.
-
- * misc/ruby-additional.el (ruby-encoding-map): Add a mapping from
- `japanese-cp932` to `cp932` to fix the problem where saving a
- source file written in Shift_JIS twice would end up having
- `coding: japanese-cp932` which Ruby could not recognize.
-
- * misc/ruby-additional.el (ruby-mode-set-encoding): Add support
- for encodings mapped to nil in `ruby-encoding-map`.
-
- * misc/ruby-additional.el (ruby-encoding-map): Map `us-ascii` and
- `utf-8` to nil by default, meaning they need not be explicitly
- declared in magic comment.
-
- * misc/ruby-additional.el (ruby-encoding-map): Add type
- declaration for better customize UI.
-
- * misc/ruby-mode.el: Ditto for the above.
-
-Tue Oct 8 00:14:53 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el: Add a standard header and footer,
- including (provide 'ruby-additional).
-
-Mon Oct 7 22:52:45 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-space-can-be-expanded-p):
- Return nil to avoid "end" insertion when in smartparens-mode
- that is configured to insert "end" for the same keyword.
-
- * misc/ruby-electric.el (ruby-electric-keywords): New custom
- variable to replace `ruby-electric-simple-keywords-re` with.
-
-Mon Oct 7 22:52:16 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el: Use preceding-char/following-char
- (returning 0 at BOF/EOF) instead of char-before/char-after
- (returning nil at BOF/EOF) to avoid error from char-syntax when
- at BOF/EOF.
-
-Mon Oct 7 22:45:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * cont.c (FIBER_USE_NATIVE): split long conditions.
-
-Mon Oct 7 20:29:31 2013 Zachary Scott <e@zzak.io>
-
- * lib/time.rb: [DOC] typo in Time.rb overview by @srt32 [Fixes GH-416]
- https://github.com/ruby/ruby/pull/416
-
-Mon Oct 7 20:07:20 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.strptime): Use :offset.
- Patch by Felipe Contreras. [ruby-core:57694]
-
-Mon Oct 7 16:47:27 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/-ext-/debug/test_profile_frames.rb: rename class C to
- something long name because one test depends on absence of
- class ::C.
-
-Mon Oct 7 16:33:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/-test-/debug/profile_frames.c:
- test/-ext-/debug/test_profile_frames.rb: add a test for new C-APIs.
-
-Mon Oct 7 16:12:36 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/debug.h: add backtrace collecting APIs for profiler.
- * int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
- Collect information of frame information.
-
- * VALUE rb_profile_frame_path(VALUE frame);
- * VALUE rb_profile_frame_absolute_path(VALUE frame);
- * VALUE rb_profile_frame_label(VALUE frame);
- * VALUE rb_profile_frame_base_label(VALUE frame);
- * VALUE rb_profile_frame_first_lineno(VALUE frame);
- * VALUE rb_profile_frame_classpath(VALUE frame);
- * VALUE rb_profile_frame_singleton_method_p(VALUE frame);
- Get information about each frame.
-
- These APIs are designed for profilers, for example, no object allocation,
- and enough information for profilers.
- In this version, this API collects only Ruby level frames.
- This issue will be fixed after Ruby 2.1.
-
- * vm_backtrace.c: implement above APIs.
-
- * iseq.c (rb_iseq_klass): return local_iseq's class.
-
-Mon Oct 7 14:26:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * proc.c: catch up last commit.
- Type of return value of rb_iseq_first_lineno() is now VALUE.
-
- * vm_insnhelper.c (argument_error): ditto.
-
- * vm_method.c (rb_method_entry_make): ditto.
-
-Mon Oct 7 14:07:45 2013 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c, internal.h: change to public (but internal) functions
- * VALUE rb_iseq_path(VALUE iseqval);
- * VALUE rb_iseq_absolute_path(VALUE iseqval);
- * VALUE rb_iseq_label(VALUE iseqval);
- * VALUE rb_iseq_base_label(VALUE iseqval);
- * VALUE rb_iseq_first_lineno(VALUE iseqval);
- And new (temporary) function:
- * VALUE rb_iseq_klass(VALUE iseqval);
-
- * iseq.c. vm_core.h (int rb_iseq_first_lineno): remove
- function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'.
- Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead.
-
- * proc.c. vm_insnhelper.c, vm_method.c: catch up this change.
-
-Sun Oct 6 08:37:39 2013 Zachary Scott <e@zzak.io>
-
- * lib/webrick.rb: [DOC] fix grammar in WEBrick overview [Fixes GH-413]
- Based on patch by @chastell https://github.com/ruby/ruby/pull/413
-
-Sat Oct 5 11:21:01 2013 Aaron Pfeifer <aaron.pfeifer@gmail.com>
-
- * thread.c (terminate_atfork_i): fix locking mutexes not unlocked in
- forks when not tracked in thread. [ruby-core:55102] [Bug #8433]
-
-Fri Oct 4 19:54:09 2013 Zachary Scott <e@zzak.io>
-
- * ext/dbm/dbm.c: [DOC] Fix wrong constant name in DBM by @edward
- [Fixes GH-409] https://github.com/ruby/ruby/pull/409
-
-Fri Oct 4 19:49:42 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: rename heap.free_num as heap.swept_num to clarify meaning and
- avoid confusion with objspace_free_num().
-
-Fri Oct 4 19:02:01 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c (objspace_free_num): new method for available/free slots on
- heap. [ruby-core:57633] [Bug #8983]
- * gc.c (gc_stat): change heap_free_num definition to use new method.
- * test/ruby/test_gc.rb: test for above.
-
-Fri Oct 4 18:53:42 2013 Aman Gupta <ruby@tmm1.net>
-
- * gc.c: add rb_objspace.limit to keep accurate count of total heap
- slots [ruby-core:57633] [Bug #8983]
-
-Fri Oct 4 09:32:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/csv.rb (CSV.foreach): support enumerator. based on a patch by
- Hanmac (Hans Mackowiak) at [ruby-core:57643]. [ruby-core:57283]
- [Feature #8929]
-
-Thu Oct 3 18:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (console_emulator_p, constat_handle): disable built-in
- console colorizing when console-emulator-like DLL is injected.
- [Feature #8201]
-
-Thu Oct 3 18:01:44 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: define gc_profile_record::allocated_size if
- CALC_EXACT_MALLOC_SIZE is true.
-
-Thu Oct 3 13:42:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (yes-test-sample): use RUNRUBY instead of MINIRUBY to set
- runtime library path and run the built ruby. [Bug #8971]
-
-Thu Oct 3 00:17:15 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-additional.el: Properly quote the body. An unquoted
- body given to eval-after-load is evaluated immediately!
-
-Wed Oct 2 21:38:30 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * ext/socket/ifaddr.c (rsock_getifaddrs): fix possible memory leak.
- When a system had no interface, this function used xmalloc for root
- but did not return any reference to it. This patch fixes it by
- immediately returning an empty array if no interface is found.
- Coverity Scan found this bug.
-
-Wed Oct 2 21:37:04 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * random.c (make_seed_value): a local array declaration was accessed
- out of scope. Coverity Scan found this bug.
-
-Wed Oct 2 18:52:40 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: relax GC condition due to malloc_limit.
-
- * gc.c (GC_MALLOC_LIMIT_MAX): change default value
- (256MB -> 512MB) and permit zero to ignore max value.
-
- * gc.c (vm_malloc_increase, vm_xrealloc): do not cause GC on realloc.
-
- * gc.c (gc_before_sweep): change debug messages.
-
-Wed Oct 2 16:26:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_close_read): duplex IO should wait its child process
- even after close_read.
-
-Wed Oct 2 15:39:13 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_core.h: use __has_attribute() instead of __clang__major__ because
- clang says "Note that marketing version numbers should not be used
- to check for language features, as different vendors use different
- numbering schemes. Instead, use the Feature Checking Macros."
- http://clang.llvm.org/docs/LanguageExtensions.html
-
-Wed Oct 2 14:19:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_close_write): detach tied IO for writing before closing
- to get rid of race condition. [ruby-list:49598]
-
- * io.c (rb_io_close_read): keep fptr in write_io to be discarded, to
- fix freed pointer access when it is in use by other threads, and get
- rid of potential memory/fd leak.
-
-Tue Oct 1 23:44:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * vm_core.h: use __attribute__((unused)) in UNINITIALIZED_VAR on clang
- 4.0+ instead of just on 4.2. Clang has supported the unused attribute
- since before version 4, so this should be safe.
-
-Tue Oct 1 22:03:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed
- after unlinking. patched by by normalperson (Eric Wong) at
- [ruby-core:56521] [Bug #8768]
-
-Tue Oct 1 20:54:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (stat_new_0): constify.
-
- * file.c (rb_stat_new): constify and export. based on a patch by
- Hanmac (Hans Mackowiak) at [ruby-core:53225]. [Feature #8050]
-
-Tue Oct 1 16:03:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (ruby_safe_level_4_warning): needed by extension
- libraries which check safe level 4. [ruby-dev:47517] [Bug #8652]
-
-Mon Sep 30 23:14:36 2013 Zachary Scott <e@zzak.io>
-
- * ext/objspace/objspace.c: [DOC] Cleaned up many rdoc formatting
- issues and several duplicate grammar bugs.
-
-Mon Sep 30 23:01:01 2013 Zachary Scott <e@zzak.io>
-
- * ext/objspace/object_tracing.c: [DOC] Adjust rdoc formatting and fix
- small grammar typo
-
-Mon Sep 30 17:28:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c: [DOC] add some notes for
- ObjectSpace::trace_object_allocations.
-
-Mon Sep 30 16:46:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c: add new 3 methods to control tracing.
- * ObjectSpace::trace_object_allocations_start
- * ObjectSpace::trace_object_allocations_stop
- * ObjectSpace::trace_object_allocations_clear
- And some refactoring.
-
- * test/objspace/test_objspace.rb: add a test for new methods.
-
- * NEWS: add a description for new methods.
-
-Mon Sep 30 11:18:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_disable): do rest_sweep() before disable GC.
- This fix may solve a failure of
- TestTracepointObj#test_tracks_objspace_events
- [test/-ext-/tracepoint/test_tracepoint.rb:43].
-
-Mon Sep 30 10:40:20 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_method.c (rb_undef): raise a NameError if the original method
- of a refined method is not defined.
-
- * vm_insnhelper.c (rb_method_entry_eq): added NULL check to avoid SEGV.
-
- * test/ruby/test_refinement.rb: related test.
-
-Sun Sep 29 23:45:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_id_attrset, intern_str): allow junk attrset ID for
- Struct.
-
- * parse.y (rb_id_attrset): fix inconsistency with literals, allow
- ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
- and raise a NameError instead of rb_bug() for invalid argument.
-
-Sun Sep 29 18:45:05 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_yield_setup_block_args):
- clear keyword arguments to prevent GC bug which occurs
- while marking VM stack.
- [ruby-dev:47729] [Bug #8964]
-
- * test/ruby/test_keyword.rb: tests for the above.
-
-Sat Sep 28 23:25:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * math.c (math_log, math_log2, math_log10): fix for Bignum argument.
- numbits should be add only when right shifted.
-
-Sat Sep 28 14:30:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/dl/test_base.rb: {libc, libm} detection now handle GNU/Hurd
- correctly. Patch by Gabriele Giacone (1o5g4r8o@gmail.com).
- [Bug #8937][ruby-core:57311]
- * test/fiddle/helper.rb: ditto.
-
-Sat Sep 28 00:19:41 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/curses/extconf.rb: check the size of chtype.
-
- * ext/curses/curses.c (NUM2CH, CH2NUM): use proper macros for
- the size of chtype.
-
- [ruby-core:56090] [Bug #8659]
-
-Fri Sep 27 18:33:23 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add two GC tuning environment variables.
- RUBY_GC_MALLOC_LIMIT_MAX and RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.
- See r43067 for details.
-
- * gc.c (rb_gc_set_params): refactoring. And change verbose notation.
- Mostly duplicated functions get_envparam_int/double is not cool.
- Please rewrite it.
-
- * test/ruby/test_gc.rb: fix a test for this change.
-
-Fri Sep 27 17:44:41 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (GC_MALLOC_LIMIT): 8,000,000 -> 8 * 1,024 * 1,024.
-
-Fri Sep 27 17:19:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_before_sweep): cast to size_t to suppress warnings.
-
-Fri Sep 27 17:07:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add some fine-grained profiling codes to tuning marking phase.
- If you enable RGENGC_PRINT_TICK to 1, then profiling results by RDTSC
- (on x86/amd64 environment) are printed at last.
- Thanks Yoshii-san.
-
-Fri Sep 27 16:32:27 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: simplify threshold of GC caused by malloc_increase.
- Now, malloc_limit is increased/decreased by mysterious logic.
- This fix simplify malloc_limit increase/decrease logic such as:
- if (malloc_increase > malloc_limit) /* so many malloc */
- malloc_limit += malloc_limit * (GC_MALLOC_LIMIT_FACTOR-1);
- else
- malloc_limit -= malloc_limit * (GC_MALLOC_LIMIT_FACTOR-1)/4;
- Default value of GC_MALLOC_LIMIT_FACTOR is 1.8.
- malloc_limit is bounded by GC_MALLOC_LIMIT_MAX (256MB by default).
- This logic runs at gc_before_sweep(). So there are no effect from
- caused by lazy sweep. And we can remove malloc_increase2.
-
- * gc.c (HEAP_MIN_SLOTS, FREE_MIN, HEAP_GROWTH_FACTOR): rename to
- GC_HEAP_MIN_SLOTS, GC_FREE_MIN, GC_HEAP_GROWTH_FACTOR respectively.
- Check them by `#ifndef' so you can specify these values outside gc.c.
-
- * gc.c (ruby_gc_params_t): add initial_malloc_limit_factor and
- initial_malloc_limit_max.
-
- * gc.c (vm_malloc_prepare, vm_xrealloc): use vm_malloc_increase to
- add and check malloc_increase.
-
-Fri Sep 27 01:05:00 2013 Zachary Scott <e@zzak.io>
-
- * re.c: [DOC] arguments of Regexp::union receive #to_regexp [Bug #8205]
-
-Fri Sep 27 00:39:27 2013 Zachary Scott <e@zzak.io>
-
- * struct.c: [DOC] grammar of ArgumentError in Struct.new [Bug #8936]
- Patch by Prathamesh Sonpatki
-
-Thu Sep 26 22:11:56 2013 Zachary Scott <e@zzak.io>
-
- * ext/bigdecimal/bigdecimal.c: [DOC] several fixes by @chastell
- This includes fixing the capitalization of Infinity, return value of
- example "BigDecimal.new('NaN') == 0.0", and code style in example.
- [Fixes GH-398] https://github.com/ruby/ruby/pull/398
-
-Thu Sep 26 22:08:11 2013 Zachary Scott <e@zzak.io>
-
- * lib/observer.rb: [DOC] syntax improvement in example by @chastell
- [Fixes GH-400] https://github.com/ruby/ruby/pull/400
-
-Thu Sep 26 22:03:15 2013 Zachary Scott <e@zzak.io>
-
- * ext/digest/digest.c: [DOC] typo in overview by @chastell
- [Fixes GH-399] https://github.com/ruby/ruby/pull/399
-
-Thu Sep 26 22:00:42 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl.c: [DOC] typo in example by @zoranzaric
- [Fixes GH-401] https://github.com/ruby/ruby/pull/401
-
-Thu Sep 26 21:07:49 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-delete-backward-char): Add
- support for smartparens-mode.
-
- * misc/ruby-electric.el (ruby-electric-cua-replace-region-maybe)
- (ruby-electric-cua-delete-region-maybe): New functions that
- combine `ruby-electric-cua-*-region` with
- `ruby-electric-cua-*-region-p`, using a slightly better way to
- detect if it is in cua-mode.
-
-Thu Sep 26 16:51:00 2013 Shota Fukumori <her@sorah.jp>
-
- * insns.def (opt_regexpmatch2): Check String#=~ hasn't overridden
- before calling rb_reg_match().
-
- * test/ruby/test_string.rb: Test for above.
-
- * vm.c (vm_init_redefined_flag): Add BOP flag for String#=~
-
- [ruby-core:57385] [Bug #8953]
-
-Thu Sep 26 16:43:42 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el: Avoid use of the interactive function
- `self-insert-command` which fires `post-self-insert-hook` and
- `post-command-hook`, to make the ruby-electric commands work
- nicely with those minor modes that make use of them to do
- similar input assistance, such as electric-pair-mode,
- autopair-mode and smartparens-mode.
-
-Thu Sep 26 16:24:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * insns.def (opt_regexpmatch1): check Regexp#=~ is not defined before
- calling rb_reg_match()
-
- * test/ruby/test_regexp.rb: add test
-
- * vm.c (ruby_vm_redefined_flag): change type to short[]
-
- * vm.c (vm_redefinition_check_flag): return REGEXP_REDEFINED_OP_FLAG if
- klass == rb_cRegexp
-
- * vm.c (vm_init_redefined_flag): setup BOP flag for Regexp#=~
-
- * vm_insnhelper.h: add REGEXP_REDEFINED_OP_FLAG
-
- [ruby-core:57385] [Bug #8953]
-
-Thu Sep 26 14:46:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (mark_locations_array): disable AddressSanitizer. based on a
- patch by halfie (Ruby Guy) at [ruby-core:57372].
- [ruby-core:56155] [Bug #8680]
-
-Wed Sep 25 17:41:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * README.EXT, README.EXT.ja: remove description of RARRAY_PTR()
- and add a caution of accessing internal data structure directly.
- Also add a description of rb_ary_store().
- [Bug #8399]
-
-Wed Sep 25 17:12:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().
- RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and
- usecase of this macro is not acquire raw pointer, but acquire
- read-only pointer. So we rename to better name.
- RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR()
- (I expect that nobody use it).
-
- * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c,
- string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c:
- catch up this change.
-
-Wed Sep 25 16:58:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (rb_float_value, rb_float_new): move inline functions
- from ruby/ruby.h.
-
- * numeric.c (rb_float_value, rb_float_new): define external functions
- for extension libraries.
-
-Wed Sep 25 15:37:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/rdoc/test_rdoc_generator_darkfish.rb: add a guard for windows.
-
-Wed Sep 25 09:53:11 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Fix CVE-2013-4363. Miscellaneous minor improvements.
-
- * test/rubygems: Tests for the above.
-
-Tue Sep 24 17:38:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_inspect): get rid of out-of-bound access.
-
- * string.c (rb_str_inspect): when a UTF-16/32 string doesn't have a
- BOM, inspect as a dummy encoding string.
-
-Tue Sep 24 17:15:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy.
-
- * encoding.c (enc_autoload): keep dummy encodings dummy.
-
-Tue Sep 24 16:41:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry#write): data size
- is in bytes, not chars. terminators should be placed automatically.
-
-Tue Sep 24 16:39:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry#each_value): encode
- name.
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry#each_key): ditto.
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry#export_string):
- encode to locale encoding if default internal is not set.
-
-Tue Sep 24 16:35:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumKey):
- size of the name is in WCHARs, not in bytes.
-
-Tue Sep 24 14:07:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * gc.c (free_method_cache_entry_i): unused function
-
- * gc.c (rb_free_mc_table): ditto
-
- * internal.h (method_cache_entry_t): unused struct
-
- * vm_method.c (verify_method_cache): remove unused variable
-
- * vm_method.c (rb_method_entry): ditto
-
-Tue Sep 24 14:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * class.c (class_alloc): remove mc_tbl
-
- * gc.c (obj_free): ditto
-
- * internal.h (struct rb_classext_struct): ditto
-
- * method.h (rb_method_entry): remove ent param
-
- * vm_method.c: restore the global method cache. Per class cache tables
- turned out to be far too slow.
-
- [ruby-core:57289] [Bug #8930]
-
-Tue Sep 24 12:51:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry::API): need
- Constants.
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumValue):
- size of the name is in WCHARs, not in bytes.
-
-Mon Sep 23 22:16:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): Unicode with BOM
- must be based on big endian variants, so that actual encodings would
- work. [ruby-core:57318] [Bug #8940]
-
-Mon Sep 23 12:11:26 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (env_each_pair): do not call rb_assoc_new() if
- it isn't needed.
-
-Mon Sep 23 10:42:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_module.rb (TestModule#test_include_toplevel): test
- for top level main.include. based on a part of the patch by
- kyrylo at [GH-395].
-
-Mon Sep 23 05:07:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/intern.h (rb_ary_cat): move from internal.h, since it
- is described in README.EXT.
-
-Sun Sep 22 20:55:20 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_insnhelper.c (vm_make_proc_with_iseq): fix bug message.
- This is follow up to changes in r42637.
-
-Sun Sep 22 20:35:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/-test-/tracepoint/tracepoint.c (Init_tracepoint): prevent from GC.
-
-Sun Sep 22 19:00:28 2013 Benoit Daloze <eregontp@gmail.com>
-
- * benchmark/bm_app_answer.rb: revert r42990, benchmark scripts should
- be self-contained and avoid dependencies, especially such small one.
- See https://github.com/ruby/ruby/pull/393#issuecomment-24861301.
-
-Sat Sep 21 20:11:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (rb_fork_internal): remove cloexec setting on pipes
- created by rb_cloexec_pipe. patch by normalperson (Eric Wong) at
- [ruby-core:56523]. [Bug #8769]
-
-Sat Sep 21 01:04:25 2013 Zachary Scott <e@zzak.io>
-
- * lib/benchmark.rb: [DOC] grammar of Benchmark#bm [Bug #8888]
- Patch by Prathamesh Sonpatki
-
-Sat Sep 21 00:50:02 2013 Zachary Scott <e@zzak.io>
-
- * enumerator.c: [DOC] Enumerator#each arguments documentation [GH-388]
- Patch by @kachick https://github.com/ruby/ruby/pull/388
-
-Sat Sep 21 00:49:16 2013 Zachary Scott <e@zzak.io>
-
- * enum.c: [DOC] Enumerable#to_a accepts arguments [GH-388]
- Patch by @kachick https://github.com/ruby/ruby/pull/388
-
-Sat Sep 21 00:47:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_conv_enc_opts): make sure to scan coderange to get
- rid of unnecessary conversion.
-
-Sat Sep 21 00:21:08 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/lib/openssl/ssl.rb: [DOC] Document OpenSSL::SSLServer
- Based on a patch by Rafal Lisowski [Bug #8758]
-
-Fri Sep 20 23:54:03 2013 Zachary Scott <e@zzak.io>
-
- * lib/gserver.rb: [DOC] correct gserver.rb license [Bug #8913]
-
-Fri Sep 20 23:48:34 2013 Zachary Scott <e@zzak.io>
-
- * ext/psych/yaml/yaml.h: [DOC] merge upstream typo fix by @GreenGeorge
- https://github.com/tenderlove/psych/pull/161
-
-Fri Sep 20 23:37:40 2013 Zachary Scott <e@zzak.io>
-
- * lib/securerandom.rb: [DOC] SecureRandom.hex length argument
- [Fixes GH-394] Patch by @avdi https://github.com/ruby/ruby/pull/394
-
-Fri Sep 20 23:34:48 2013 Zachary Scott <e@zzak.io>
-
- * benchmark/bm_app_answer.rb: removed duplicate code [Fixes GH-393]
- Patch by @gouravtiwari https://github.com/ruby/ruby/pull/393
-
-Fri Sep 20 23:24:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (btest, btest-ruby, test-knownbug): add $(RUN_OPTS) to
- ruby to be run, so that tests are runnable before making exts.
-
- * common.mk (test-sample): ditto, and use $(MINIRUBY) as rubytest.rb
- does not need extension libraries.
-
- * tool/rubytest.rb: pass $(RUN_OPTS) to testing ruby using --run-opt.
-
-Fri Sep 20 15:01:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (intern_str): sigil only names are junk, at least one
- identifier character is needed. [ruby-dev:47723] [Bug #8928]
-
- * parse.y (rb_enc_symname_type): fix out of bound access.
-
-Fri Sep 20 14:14:32 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/printf/printf.c (printf_test_call): Fix an end of buffer
- argument.
-
-Thu Sep 19 16:59:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (lambda): adjust position to the beginning of the block.
-
-Thu Sep 19 16:25:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vsnprintf.c (BSD_vfprintf): initialize cp so that size is 0 in the
- commented case. fix an accidental bug at r16716.
-
-Thu Sep 19 14:33:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add a news for r42974.
-
-Thu Sep 19 14:12:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: make Symbol objects frozen.
- [Feature #8906]
- I want to freeze this good day, too.
-
- * test/ruby/test_eval.rb: catch up this change.
-
- * test/ruby/test_symbol.rb: add a test to check frozen symbols.
-
-Thu Sep 19 09:11:33 2013 Eric Hodel <drbrain@segment7.net>
-
- * NEWS: Update for RDoc 4.1.0.preview.1 and RubyGems 2.2.0.preview.1
-
-Thu Sep 19 08:59:41 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/markdown/literals_1_9.rb: Fix trailing whitespace.
-
- Previously kpeg (which generates this file) added trailing
- whitespace, but this bug is now fixed.
-
- * lib/rdoc/markdown.rb: ditto.
-
-Thu Sep 19 08:33:14 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc 4.1.0.preview.1
-
- RDoc 4.1.0 contains a number of enhancements including a new default
- style and accessibility support. You can see the changelog here:
-
- https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
-
- * test/rdoc: ditto.
-
-Thu Sep 19 07:16:26 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: updating Psych version
-
- * ext/psych/psych.gemspec: ditto
-
-Thu Sep 19 06:39:40 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_resolver.rb: Switch the iterative resolver
- algorithm from recursive to iterative to avoid possible
- SystemStackError.
-
-Thu Sep 19 06:29:30 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.2.0.preview.1
-
- This brings several new features to RubyGems summarized here:
-
- https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt
-
- * test/rubygems: ditto.
-
-Wed Sep 18 23:14:58 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_enumerate_lines): make String#each_line and
- #lines not raise invalid byte sequence error when it is called
- with an argument. The patch also causes performance improvement.
- [ruby-dev:47549] [Bug #8698]
-
- * test/ruby/test_m17n_comb.rb (test_str_each_line): remove
- assertions which check that String#each_line and #lines will
- raise an error if the receiver includes invalid byte sequence.
-
-Wed Sep 18 16:32:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mnew_from_me): allocate structs after allocated wrapper
- object successfully, to get rid of potential memory leak.
-
-Tue Sep 17 15:54:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/shell/command-processor.rb (Shell::CommandProcessor#find_system_command):
- return executable file only, should ignore directories and
- unexecutable files. [ruby-core:57235] [Bug #8918]
-
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_throw):
- assertion for throw. MiniTest::Assertions#assert_throws discards
- the caught value.
-
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_nothing_thrown):
- returns the result of the given block.
-
-Tue Sep 17 12:55:58 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/regexp.rdoc: [DOC] Replace paragraphs in verbatim sections with
- plain paragraphs to improve readability as ri and HTML.
-
-Mon Sep 16 07:32:35 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: removed meaningless lines.
- * rational.c: ditto.
-
-Mon Sep 16 00:44:23 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * ext/socket/mkconstants.rb: define MSG_FASTOPEN.
- [ruby-core:57138] [Feature #8897]
-
-Sun Sep 15 13:31:23 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * rational.c (nurat_div): reverted r28844, r28886 and r28887.
- REASON: Nobuyoshi Nakada <nobu@ruby-lang.org>'s commits are buggy.
- So Rational#/ may produce exact number with inexact number.
- Moreover, without reducing.
- REALLY NONSENSE COMMITS.
- A bug report by me [ruby-dev:44710] is also caused by this behavior.
- Kenta Murata <mrkn@mrkn.jp> patched it up.
- But he did not fix the origin.
- Today, the bug is still alive in ruby 1.9.3 and 2.0.0.
-
-Sat Sep 14 06:08:10 2013 Eric Hodel <drbrain@segment7.net>
-
- * dir.c (dir_s_glob): [DOC] Improve wording and layout.
-
- * dir.c (file_s_fnmatch): ditto.
-
- * dir.c (Init_Dir): [DOC] Document File::Constants::FNM_XXX
- constants. (These won't show up in RDoc until a new RDoc is
- imported.)
-
-Thu Sep 12 14:58:58 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI::Generic.find_proxy): return nil if
- http_proxy environment variable is empty string.
- [ruby-core:57140] [Bug #8898]
-
-Fri Sep 13 10:40:28 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.1.3
-
- Fixed installing platform gems
-
- Restored concurrent requires
-
- Fixed installing gems with extensions with --install-dir
-
- Fixed `gem fetch -v` to install the latest version
-
- Fixed installing gems with "./" in their files entries
-
- * test/rubygems/test_gem_package.rb: Tests for the above.
-
- * NEWS: Updated for RubyGems 2.1.3
-
-Thu Sep 12 22:40:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_CHECK_SIGNEDNESS): macro to check signedness of a
- type.
-
- * configure.in (size_t): must be unsigned.
- [ruby-core:57149] [Feature #8890]
-
-Thu Sep 12 22:37:08 2013 Anton Ovchinnikov <revolver112@gmail.com>
-
- * ext/bigdecimal/bigdecimal.c, ext/digest/md5/md5.c,
- ext/json/fbuffer/fbuffer.h, ext/json/generator/generator.c:
- Eliminate less-than-zero checks for unsigned variables.
- According to section 4.1.5 of C89 standard, size_t is an unsigned
- type. These checks were found with 'cppcheck' static analysis tool.
- [ruby-core:57117] [Feature #8890]
-
-Thu Sep 12 21:35:46 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * Makefile.in (libruby-static.a): change LDFLAGS order. LDFLAGS may
- include library path that should be specified before LIBS.
- [ruby-dev:47707] [Bug #8901]
-
-Thu Sep 12 20:07:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vsnprintf.c (MAXEXP, MAXFRACT): calculate depending on constants in
- float.h.
-
- * vsnprintf.c (BSD_vfprintf): limit length for cvt() to get rid of
- buffer overflow. [ruby-core:57023] [Bug #8864]
-
- * vsnprintf.c (exponent): make expbuf size more precise.
-
-Wed Sep 11 17:30:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUNRUBY): append -- only after runruby.rb, not
- cross-compiling baseruby, so that $(RUN_OPT) can be command line
- options. [ruby-dev:47703] [Bug #8893]
-
-Wed Sep 11 07:55:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
- an exception even if uses on trap. [Bug #8891]
-
-Tue Sep 10 14:37:01 2013 Shota Fukumori <sorah@tubusu.net>
-
- * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
- it is nil. [Bug #8884] [ruby-core:57094]
-
- * test/ruby/test_backtrace.rb (test_caller_with_nil_length):
- Test for above.
-
-Tue Sep 10 12:39:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (method_entry_i): should exclude refined methods from
- instance method list. [ruby-core:57080] [Bug #8881]
-
-Tue Sep 10 12:05:04 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * io.c (rb_f_printf): [DOC] add missing parenthesis in rdoc.
-
-Tue Sep 10 10:08:00 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * NEWS: Update RubyGems note.
-
-Tue Sep 10 09:51:22 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.1.0. Fixes CVE-2013-4287.
-
- See http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html
- for CVE information.
-
- See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.1.0+%2F+2013-09-09
- for release notes.
-
- * test/rubygems: Tests for the above.
-
-Mon Sep 9 21:31:45 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c: Remove spaces between SI prefix and unit to follow
- SI brochure.
- http://www.bipm.org/en/si/si_brochure/
- https://www.nmij.jp/library/units/si/
-
- * time.c: Ditto.
-
- * ext/socket/ancdata.c: Ditto.
-
-Mon Sep 9 16:55:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_add_refined_method_entry): clear cache in the
- refined class since refining a method entry is modifying the class.
- [ruby-core:57079] [Bug #8880]
-
-Mon Sep 9 09:14:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (Gem::Specification#initialize): default date to
- RUBY_RELEASE_DATE. [ruby-core:57072] [Bug #8878]
-
- * tool/rbinstall.rb (Gem::Specification#to_ruby): add date.
-
-Sun Sep 8 16:01:54 2013 Tanaka Akira <akr@fsij.org>
-
- * rational.c (f_gcd): Relax the condition to use GMP.
-
-Sun Sep 8 13:56:38 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (folevariant_initialize): check type of
- element of array.
-
- * test/win32ole/test_win32ole_variant.rb (test_s_new_ary): ditto.
-
-Sat Sep 7 21:33:10 2013 Tanaka Akira <akr@fsij.org>
-
- * math.c (math_log): Test the sign for bignums.
- (math_log2): Ditto.
- (math_log10): Ditto.
-
-Sat Sep 7 20:25:47 2013 Tanaka Akira <akr@fsij.org>
-
- * math.c (math_log): Support bignums bigger than 2**1024.
- (math_log2): Ditto.
- (math_log10): Ditto.
-
-Sat Sep 7 15:36:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * vm_eval.c (vm_call0): fix prototype, the id parameter should be of
- type ID, not VALUE
-
- * vm_insnhelper.c (check_match): the rb_funcall family of functions
- does not care about refinements. We need to use
- rb_method_entry_with_refinements instead to call === with
- refinements. Thanks to Jon Conley for reporting this bug.
- [ruby-core:57051] [Bug #8872]
-
- * test/ruby/test_refinement.rb: add test
-
-Sat Sep 7 13:49:40 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * variable.c (classname): the name of class that has
- non class id should not be nil. This bug was introduced
- in r36577.
-
- * test/thread/test_cv.rb: test for change.
-
-Sat Sep 7 13:29:22 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * lib/find.rb (Find.find): respect the encodings of arguments.
- [ruby-dev:47530] [Feature #8657]
-
- * test/test_find.rb: add tests.
-
-Sat Sep 7 10:40:32 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb (TCP_FASTOPEN): Defined for TCP fast open.
- [ruby-core:57048] [Feature #8871] patch by Masaki Matsushita.
-
-Fri Sep 6 23:53:31 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't
- require extension libraries. The patch is from nobu
- (Nobuyoshi Nakada).
-
- * ext/thread/extconf.rb: for build ext/thread/thread.c.
-
- * include/ruby/intern.h: ditto.
-
- * thread.c: ditto.
-
- * lib/thread.rb: removed and replaced by ext/thread/thread.c.
-
- * ext/thread/thread.c: Queue, SizedQueue and ConditionVariable
- implementations in C. This patch is based on patches from panaggio
- (Ricardo Panaggio) and funny_falcon (Yura Sokolov) and ko1
- (Koichi Sasada). [ruby-core:31513] [Feature #3620]
-
- * test/thread/test_queue.rb (test_queue_thread_raise): add a test for
- ensuring that killed thread should be removed from waiting threads.
- It is based on a code by ko1 (Koichi Sasada). [ruby-core:45950]
-
-Fri Sep 6 22:47:12 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Define ac_cv_func_clock_getres to yes for mingw*.
-
-Fri Sep 6 21:04:10 2013 Tanaka Akira <akr@fsij.org>
-
- * rational.c: Include gmp.h if GMP is used.
- (GMP_GCD_DIGITS): New macro.
- (rb_gcd_gmp): New function.
- (f_gcd_normal): Renamed from f_gcd.
- (rb_gcd_normal): New function.
- (f_gcd): Invoke rb_gcd_gmp or f_gcd_normal.
-
- * internal.h (rb_gcd_normal): Declared.
- (rb_gcd_gmp): Ditto.
-
- * ext/-test-/rational: New directory.
-
- * test/-ext-/rational: New directory.
-
-Fri Sep 6 14:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (clock_getres): required as well as clock_gettime().
- [ruby-dev:47699] [Bug #8869]
-
-Fri Sep 6 11:45:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c (rb_econv_append): new function to append a string data
- with converting its encoding. split from rb_econv_substr_append.
-
-Fri Sep 6 02:37:22 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: use double quotes when
- strings start with special characters.
- https://github.com/tenderlove/psych/issues/157
-
- * test/psych/test_string.rb: test for change.
-
-Fri Sep 6 00:05:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rewrite_cref_stack): remove recursion.
-
-Thu Sep 5 18:05:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * string.c (fstring_cmp): take string encoding into account when
- comparing fstrings [ruby-core:57037] [Bug #8866]
-
- * test/ruby/test_string.rb: add test
-
-Thu Sep 5 17:25:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_fstring, rb_str_free): use st_data_t instead of VALUE.
-
- * string.c (rb_fstring): get rid of duplicating already frozen object.
-
-Thu Sep 5 14:01:22 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/optparse.rb: The Integer acceptable now allows binary and
- hexadecimal numbers per the documentation. [ruby-trunk - Bug #8865]
-
- DecimalInteger, OctalInteger, DecimalNumeric now validate their input
- before converting to a number. [ruby-trunk - Bug #8865]
-
- * test/optparse/test_acceptable.rb: Tests for the above, tests for all
- numeric acceptables for existing behavior.
-
-Thu Sep 5 13:49:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * include/ruby/ruby.h: add RSTRING_FSTR flag
-
- * internal.h: add rb_fstring() prototype
-
- * string.c (rb_fstring): deduplicate frozen string literals
-
- * string.c (rb_str_free): delete fstrings from frozen_strings table when
- they are GC'd
-
- * string.c (Init_String): initialize frozen_strings table
-
-Thu Sep 5 12:48:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * configure.in (with_gmp): set with_gmp no if it is empty.
-
-Thu Sep 5 10:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * vm_insnhelper.c (vm_getivar): use class sequence to check class
- identity, instead of pointer + vm state
-
- * vm_insnhelper.c (vm_setivar): ditto
-
-Thu Sep 5 08:20:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (GMP_DIV_DIGITS): New macro.
- (bary_divmod_gmp): New function.
- (rb_big_divrem_gmp): Ditto.
- (bary_divmod_branch): Ditto.
- (bary_divmod): Use bary_divmod_branch.
- (bigdivrem): Ditto.
-
- * internal.h (rb_big_divrem_gmp): Declared.
-
-Thu Sep 5 06:22:42 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_divmod_normal): Reduce temporary array allocations.
-
-Thu Sep 5 02:17:06 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_divrem_normal): Add GC guards.
-
-Thu Sep 5 00:38:32 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_divrem_normal): New function.
-
- * internal.h (rb_big_divrem_normal): Declared.
-
- * ext/-test-/bignum/div.c: New file.
-
- * test/-ext-/bignum/test_div.rb: New file.
-
-Thu Sep 5 00:08:44 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_normal): Removed.
- (bary_divmod_normal): New function.
- (bary_divmod): Use bary_divmod_normal.
- (bigdivrem): Use bary_divmod_normal.
-
-Wed Sep 4 23:02:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Useless declaration removed.
-
-Wed Sep 4 22:56:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * numeric.c (NUM_STEP_GET_INF): split from NUM_STEP_SCAN_ARGS(), since
- inf is not used in num_step_size().
-
-Wed Sep 4 20:22:43 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_normal): Add assertions.
-
-Wed Sep 4 19:18:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (vm_state_version_t): prefer LONG_LONG to uint64_t.
-
-Wed Sep 4 16:28:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (vm_state_version_t): use uint64_t when it is larger than
- LONG_LONG, and fallback to unsigned long.
-
-Wed Sep 4 15:37:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enc/trans/utf8_mac-tbl.rb: fix r42789.
- Fix conversion table and logic. [ruby-dev:47680]
-
-Wed Sep 4 14:08:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,
- variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h,
- vm_method.c: Implement class hierarchy method cache invalidation.
-
- [ruby-core:55053] [Feature #8426] [GH-387]
-
-Wed Sep 4 11:13:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_gsub): use BEG(0) for whole matched position not
- return value from rb_reg_search(), for \K matching.
- [ruby-dev:47694] [Bug #8856]
-
-Wed Sep 4 11:11:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (SOLIBS): LIBRUBY_SO also needs linking with gmp, to
- run worker processes in test-all on non-ELF platforms.
-
-Tue Sep 3 23:01:41 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parser/test_tree.rb
- (TestTreeParser::TestInvalid#test_unmatched_close_tag):
- Compute expected value from test value.
-
-Tue Sep 3 22:59:58 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse):
- Add source information to parse exception on no close tag error.
- [Bug #8844] [ruby-dev:47672]
- Patch by Ippei Obayashi. Thanks!!!
- * test/rexml/parser/test_tree.rb: Add a test for the above case.
-
-Tue Sep 3 22:57:57 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parser/test_tree.rb: Fix test name to describe test
- content.
-
-Tue Sep 3 22:54:46 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse):
- Remove needless nested parse exception information.
- [Bug #8844] [ruby-dev:47672]
- Reported by Ippei Obayashi. Thanks!!!
- * test/rexml/parser/test_tree.rb: Add a test for the above case.
-
-Tue Sep 3 22:03:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_enc_str_new_cstr): new function to create a string from
- the C-string pointer with the specified encoding.
-
-Tue Sep 3 21:41:37 2013 Akira Matsuda <ronnie@dio.jp>
-
- * eval.c (Init_eval): Make Module#include and Module#prepend public
- [Feature #8846]
-
- * test/ruby/test_module.rb (class TestModule): Test for above
-
-Tue Sep 3 21:35:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (sys/dyntune.h): for gettune().
-
- * thread_pthread.c (hpux_attr_getstackaddr): fix missing *.
- [ruby-core:56983] [Feature #8793]
-
-Tue Sep 3 20:12:46 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (GMP_STR2BIG_DIGITS): New macro.
- (str2big_gmp): New function.
- (rb_cstr_to_inum): Use str2big_gmp for big bignums.
- (rb_str2big_gmp): New function.
-
- * internal.h (rb_str2big_gmp): Declared.
-
-Tue Sep 3 19:44:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry#values): added.
- [Feature #7763] [ruby-core:51783]
-
-Tue Sep 3 18:26:00 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/inf-ruby.el (inf-ruby-keys, run-ruby): Add magic autoload
- comments.
-
- * misc/rdoc-mode.el (rdoc-mode): Ditto.
-
- * misc/ruby-electric.el (ruby-electric-mode): Ditto.
-
- * misc/ruby-style.el (ruby-style-c-mode): Ditto.
-
-Tue Sep 3 17:06:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_rubyoptions.rb
- (TestRubyOptions::SEGVTest::ExpectedStderr): the URL was changed at
- r42800.
-
-Tue Sep 3 14:48:25 2013 Zachary Scott <e@zzak.io>
-
- * lib/thread.rb: [DOC] CV#wait typo by @avdi [Fixes GH-386]
- https://github.com/ruby/ruby/pull/386
-
-Tue Sep 3 14:37:53 2013 Zachary Scott <e@zzak.io>
-
- * error.c: [DOC] Update bug tracker url by @ScotterC [Fixes GH-390]
- https://github.com/ruby/ruby/pull/390
-
-Tue Sep 3 12:45:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_str2big_poweroftwo): New function.
- (rb_str2big_normal): Ditto.
- (rb_str2big_karatsuba): Ditto.
-
- * internal.h (rb_str2big_poweroftwo): Declared.
- (rb_str2big_normal): Ditto.
- (rb_str2big_karatsuba): Ditto.
-
- * ext/-test-/bignum/str2big.c: New file.
-
- * test/-ext-/bignum/test_str2big.rb: New file.
-
- * ext/-test-/bignum/depend: Add the dependency for str2big.c.
-
-Tue Sep 3 12:09:08 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): Support times() based monotonic clock.
- (rb_clock_getres): Ditto.
-
-Tue Sep 3 12:03:02 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (str2big_scan_digits): Extracted from rb_cstr_to_inum.
-
-Tue Sep 3 11:23:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_select_with_thread): rounding up the fraction of
- tv_usec instead of rounding down.
- this change is an experiment to get rid of failures on vc10-x64 CI.
-
-Tue Sep 3 11:00:28 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (do_select): constify timeout.
-
- * win32/win32.c (rb_w32_select_with_thread): constify 10ms wait and
- 0ms wait structs.
-
-Tue Sep 3 10:03:42 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/openssl/test_pair.rb
- (OpenSSL::TestPair#test_write_nonblock_no_exceptions): on some CIs
- such as Debian 6.0, Ubuntu 10.04, CentOS and vc10-x64 (maybe depend
- on OpenSSL version), writing to SSLSocket after SSL_ERROR_WANT_WRITE
- causes SSL_ERROR_SSL "bad write retry".
-
-Tue Sep 3 08:20:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enc/trans/utf8_mac-tbl.rb: update conversion table to recent OS X.
- Previous table is used on Mac OS X 10.1 or prior.
- This table is used on 10.2 or later. [ruby-dev:47680]
-
-Tue Sep 3 07:49:25 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * numeric.c (NUM_STEP_SCAN_ARGS): On second thought, keep
- Numeric#step backward compatible in that it raises TypeError
- when nil is given as second argument.
-
- * test/ruby/test_float.rb (TestFloat#test_num2dbl): Revert.
-
- * test/ruby/test_numeric.rb (TestNumeric#test_step): Fix test
- cases for the above change.
-
-Tue Sep 3 07:39:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bytes_2comp): Define it only for little endian
- environment.
-
-Tue Sep 3 07:31:29 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * numeric.c (NUM_STEP_SCAN_ARGS): Numeric#step should raise
- TypeError if a non-numeric parameter is given.
-
- * test/ruby/test_float.rb (TestFloat#test_num2dbl): Allow nil as
- step, as with the keyword argument.
-
- * test/ruby/test_numeric.rb (TestNumeric#test_step): Add tests for
- nil as step or limit.
-
-Tue Sep 3 07:28:49 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (bit_length): Add casts to fix compilation error with
- clang 3.0 -Werror,-Wshorten-64-to-32.
- [ruby-dev:47687] reported by SASADA Koichi.
-
-Tue Sep 3 03:17:26 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_search_super_method): use ci->argc instead of
- ci->orig_argc. ci->argc can be changed by splat arguments.
- [ruby-list:49575]
- This fix should be applied to Ruby 2.0.0 series.
-
- * test/ruby/test_super.rb: add a test for above.
-
-Mon Sep 2 23:46:29 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * numeric.c (num_step): Default the limit argument to infinity and
- allow it to be omitted. Keyword arguments (by: and to:) are
- introduced for ease of use. [Feature #8838] [ruby-dev:47662]
- [ruby-dev:42194]
-
- * numeric.c (num_step): Optimize for infinite loop.
-
-Mon Sep 2 22:55:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (ISDIGIT): Unused macro removed.
-
-Mon Sep 2 22:49:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (str2big_poweroftwo): Extracted from rb_cstr_to_inum.
- (str2big_normal): Ditto.
- (str2big_karatsuba): Ditto.
-
-Mon Sep 2 14:39:29 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * ruby.c (Process#setproctitle): [DOC] Fix and improve rdoc.
-
- * ruby.c (Process#argv0): [DOC] Improve rdoc.
-
-Mon Sep 2 14:15:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * NEWS: fix description of number literal suffixes.
-
-Mon Sep 2 14:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * test/rake/test_rake_rules.rb: add space after string literal to
- prevent conflict with string options syntax "foo"opts
-
- * test/rss/rss-assertions.rb: ditto
-
-Mon Sep 2 12:28:38 2013 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_bignum.rb (test_interrupt_during_to_s): Disable it
- when GMP is used.
-
-Mon Sep 2 07:02:10 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (Init_Bignum): Define Bignum::GMP_VERSION when GMP is used.
-
-Mon Sep 2 01:46:14 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_generic): Reduce arguments.
- (big2str_gmp): Ditto.
- (rb_big2str1): Follow the above change.
-
-Mon Sep 2 00:08:08 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (get_mach_timebase_info): Extracted from rb_clock_gettime.
- (rb_clock_gettime): Use get_mach_timebase_info.
- (rb_clock_getres): Support MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC.
-
-Sun Sep 1 23:30:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (GMP_BIG2STR_DIGITS): New constant.
- (big2str_gmp): New function.
- (rb_big2str1): Use big2str_gmp for big bignums.
-
- * internal.h (rb_big2str_gmp): Declared.
-
- * ext/-test-/bignum/big2str.c (big2str_gmp): New method.
-
-Sun Sep 1 22:37:51 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_gmp): Use mpz_init and mpz_clear instead of
- mpz_inits and mpz_clears.
- Older GMP don't have them.
-
-Sun Sep 1 21:17:54 2013 Tanaka Akira <akr@fsij.org>
-
- * test/net/http/test_http.rb (test_bind_to_local_port): Choose an open
- port more reliably.
-
-Sun Sep 1 20:32:40 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_base_poweroftwo): Renamed from
- big2str_base_powerof2.
- (rb_big2str_poweroftwo): New function for test.
- (big2str_generic): Extracted from rb_big2str1.
- (rb_big2str_generic): New function for test.
-
- * internal.h (rb_big2str_poweroftwo): Declared.
- (rb_big2str_generic): Ditto.
-
- * ext/-test-/bignum/big2str.c: New file.
-
- * test/-ext-/bignum/test_big2str.rb: New file.
-
-Sun Sep 1 15:21:21 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_2bdigits): Renamed from big2str_orig.
-
-Sun Sep 1 13:02:24 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,
- SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough.
-
-Sun Sep 1 11:38:26 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (maxpow_in_bdigit): Removed.
-
-Sun Sep 1 10:30:42 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_fix_bit_length): Moved from bignum.c.
-
-Sun Sep 1 09:55:45 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (bit_length): Moved from bignum.c.
- (nlz_int): Ditto.
- (nlz_long): Ditto.
- (nlz_long_long): Ditto.
- (nlz_int128): Ditto.
-
-Sun Sep 1 03:32:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bit_length): Renamed from bitsize.
-
-Sun Sep 1 00:07:09 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_bit_length): New method.
- (rb_fix_bit_length): Ditto.
- [ruby-core:56247] [Feature #8700]
-
-Sat Aug 31 22:18:29 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_getres): New method.
- (timetick2dblnum_reciprocal): New function.
-
- * configure.in: Check clock_getres.
-
- [ruby-core:56780] [Feature #8809] accepted as a CRuby feature at
- DevelopersMeeting20130831Japan
- https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130831Japan
-
-Sat Aug 31 21:02:07 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Use GMP to accelerate big Bignum multiplication.
- (bary_mul_gmp): New function.
- (bary_mul): Use bary_mul_gmp.
- (bigsq): Use different threshold with GMP.
-
- * configure.in: Detect GMP.
-
- [ruby-core:56658] [Feature #8796]
-
-Sat Aug 31 15:03:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * compile.c (NODE_MATCH3): pass CALL_INFO to opt_regexpmatch2
-
- * insns.def (opt_regexpmatch2): use CALL_SIMPLE_METHOD to call =~ if
- the receiver is not a T_STRING [Bug #8847] [ruby-core:56916]
-
-Sat Aug 31 14:07:11 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/securerandom.rb (random_bytes): Use Process.clock_gettime.
-
-Sat Aug 31 00:25:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/encoding.h (rb_{ascii8bit,utf8,usascii}_encindex): get
- rid of conflict with macros defined in internal.h.
-
-Fri Aug 30 22:37:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (native_thread_init_stack): wait the creator thread
- to fill machine stack info, if get_stack_of() is available.
-
- * thread_pthread.c (native_thread_create): fill the created thread
- stack info after starting, if get_stack_of() is available.
-
- * thread_pthread.c (native_thread_create): define attr only if it is
- used, and merge pthread_create() calls.
-
- * thread_pthread.c (get_main_stack): separate function to get stack of
- main thread.
-
-Thu Aug 29 18:05:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * struct.c (rb_struct_define_without_accessor_under): added.
- This function is similar to rb_define_class_under() against
- rb_define_class().
-
- * include/ruby/intern.h: add a declaration of this function.
-
-Thu Aug 29 17:03:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_method): a method entry refers the based
- class/module, so should search superclass from the origin i-class
- where the entry belongs to, to get rid of infinite loop when zsuper
- in a prepended class/module. [ruby-core:54105] [Bug #8238]
-
-Thu Aug 29 05:35:58 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (zstream_run): Fix handling of deflate streams that
- need a dictionary but are being decompressed by Zlib::Inflate.inflate
- (which has no option to set a dictionary). Now Zlib::NeedDict is
- raised instead of crashing. [ruby-trunk - Bug #8829]
- * test/zlib/test_zlib.rb (TestZlibInflate): Test for the above.
-
-Thu Aug 29 02:40:45 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be
- treated as strings.
- https://github.com/tenderlove/psych/issues/156
-
- * test/psych/test_string.rb: test for change
-
-Wed Aug 28 17:20:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (hpux_attr_getstackaddr): basic support for the
- get_stack() under HP-UX. based on the patch by michal@rokos.cz
- (Michal Rokos) at [ruby-core:56645]. [Feature #8793]
-
-Wed Aug 28 11:24:20 2013 Michal Rokos <michal@rokos.cz>
-
- * configure.in (sys/pstat.h): fix missing header check for
- missing/setproctitle.c on HP-UX. [ruby-core:56644] [Bug #8792]
-
-Wed Aug 28 04:54:33 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl_ssl.c (ossl_ssl_read): Replace duplicate
- wait_writable with wait_readable.
-
-Tue Aug 27 17:18:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/timeout.rb (Timeout#timeout): skip rescue clause only when no
- exception class is given.
-
-Tue Aug 27 17:02:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (copy_stream_body): should write in binary mode. based on a
- patch by godfat (Lin Jen-Shin) at [ruby-core:56556].
- [ruby-core:56518] [Bug #8767]
-
-Tue Aug 27 17:02:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (copy_stream_body): move common open flags.
-
-Tue Aug 27 16:56:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (enumerator_size): use rb_check_funcall() instead of
- respond_to? and call.
-
- * enumerator.c (enumerator_each): ensure that argument array size
- does not overflow at appending.
-
-Tue Aug 27 16:46:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_index, rb_ary_rindex): use optimized equality to
- improve performance. [Feature #8820]
-
- * vm_insnhelper.c (rb_equal_opt): optimized equality function.
-
-Tue Aug 27 16:11:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (opt_eq_func): use RBASIC_CLASS() instead of HEAP_CLASS_OF().
-
- * insns.def (opt_plus, opt_minus, opt_mult, opt_div, opt_mod, opt_lt),
- (opt_gt, opt_ltlt, opt_aref, opt_aset, opt_length, opt_size),
- (opt_empty_p, opt_succ): ditto.
-
-Tue Aug 27 16:08:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_check_funcall, rb_check_funcall_with_hook): constify
- argv.
-
-Tue Aug 27 13:03:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/stringio/stringio.c (strio_read_nonblock): declare local
- variables at the first of function.
-
-Tue Aug 27 11:51:37 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Allow Enumerator size argument to be any callable.
- Patch by Avdi Grimm. [bug #8641] [ruby-core:56032] [fix GH-362]
-
- * test/ruby/test_enumerator.rb: Test for above
-
-Tue Aug 27 11:46:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_clear): do rest_sweep() before clearing
- profile.current_record.
-
-Tue Aug 27 07:35:05 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * io.c (io_read_nonblock): support non-blocking reads without raising
- exceptions. As in: `io.read_nonblock(size, exception: false)`
- [ruby-core:38666] [Feature #5138]
- * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): ditto
- * ext/stringio/stringio.c (strio_sysread): ditto
- * io.c (rb_io_write_nonblock): support non-blocking writes without
- raising an exception.
- * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): ditto
- * test/openssl/test_pair.rb (class OpenSSL): tests
- * test/ruby/test_io.rb (class TestIO): ditto
- * test/socket/test_nonblock.rb (class TestSocketNonblock): ditto
- * test/stringio/test_stringio.rb (class TestStringIO): ditto
-
-Tue Aug 27 05:24:34 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems 2.1.0 Release Candidate
- * test/rubygems: ditto.
-
-Mon Aug 26 16:24:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_nextc): warn carriage return in middle of line.
- [ruby-core:56240] [Feature #8699]
-
-Mon Aug 26 15:27:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/timeout.rb (Timeout#timeout): should not be caught by rescue
- clause. [Bug #8730]
-
-Mon Aug 26 14:44:26 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
- there are not new relations.
-
- * enum.c (enum_sort_by): ditto.
-
- * struct.c (setup_struct): use RARRAY_RAWPTR().
-
- * vm_eval.c (yield_under): ditto.
-
- * ext/pathname/pathname.c (path_entries): use RARRAY_AREF().
-
- * ext/pathname/pathname.c (path_s_glob): ditto.
-
-Mon Aug 26 13:11:10 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * array.c (ary_ensure_room_for_push): fix typo in r42658.
-
-Mon Aug 26 12:37:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/sizes.c.tmpl: generate automatically by extracting
- RUBY_CHECK_SIZEOF from configure.in.
-
-Mon Aug 26 10:16:59 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * process.c (gcd_timetick_int): Renamed from gcd_timtick_int.
-
-Sun Aug 25 21:02:15 2013 Tanaka Akira <akr@fsij.org>
-
- * sizes.c (Init_sizes): Define the size of clock_t.
-
-Sun Aug 25 01:47:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BARY_SHORT_MUL): Renamed from BARY_MUL1.
- (bary_short_mul): Renamed from bary_mul1.
-
-Sat Aug 24 10:35:09 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): The emulated clock names changed.
-
-Fri Aug 23 22:22:07 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): Add a cast to fix compile error by
- -Werror,-Wshorten-64-to-32.
-
-Fri Aug 23 22:12:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (rb_intern): no symbol cache while initialization.
-
-Fri Aug 23 22:07:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (clock_t): needs time.h.
-
-Fri Aug 23 21:37:28 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (reduce_factors): New function.
- (timetick2dblnum): Use reduce_factors.
- (timetick2integer): Ditto.
- (make_clock_result): Follow the above change.
- (rb_clock_gettime): Ditto.
-
-Fri Aug 23 21:00:55 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (timetick_int_t): Renamed from timetick_giga_count_t.
- (gcd_timtick_int): Renamed from gcd_ul and make the arguments
- timetick_giga_count_t.
- (reduce_fraction): Make the arguments timetick_int_t.
- (timetick2integer): Ditto.
- (make_clock_result): Ditto.
- (timetick2dblnum): Fix the return type.
- (rb_clock_gettime): Use timetick_int_t.
-
-Fri Aug 23 20:50:40 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (gcd_ul): New function.
- (reduce_fraction): Ditto.
- (reduce_fraction): Ditto.
- (timetick2dblnum): Ditto.
- (timetick2integer): Ditto.
- (make_clock_result): Use timetick2dblnum and timetick2integer.
- (rb_clock_gettime): Follow the make_clock_result change.
-
-Fri Aug 23 18:39:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_make_shared): shared ary as shady. Need more effort to
- make it normal object.
-
- * array.c (rb_ary_modify): use RARRAY_PTR_USE() without WB because
- there are not new relations.
-
- * array.c (ary_ensure_room_for_unshift): use RARRAY_RAWPTR() because
- there are not new relations.
-
-Fri Aug 23 11:25:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c: introduce ARY_SHARED_OCCUPIED(shared).
-
-Fri Aug 23 11:07:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (config.h): now SIZEOF_CLOCK_T is needed for
- unsigned_clock_t.
-
-Thu Aug 22 22:01:04 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): Strip "s" from unit names.
-
-Thu Aug 22 20:14:59 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (unsigned_clock_t): Defined.
- (rb_clock_gettime): Consider clock_t overflow for
- ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID.
-
- * configure.in: Check the size of clock_t.
-
-Thu Aug 22 16:22:48 2013 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (build_postexe_iseq): fix to setup the local table.
-
-Thu Aug 22 15:42:43 2013 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (rb_iseq_compile_node): accept NODE_IFUNC to support
- custom compilation.
-
- * compile.c (NODE_POSTEXE): compile to
- "ONCE{ VMFrozenCore::core#set_postexe{...} }" with a new custom
- compiler `build_postexe_iseq()'.
-
- * vm.c (m_core_set_postexe): remove parameters (passed by a block).
-
-Thu Aug 22 06:54:15 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): Change emulation symbols for
- Process.clock_gettime.
-
-Thu Aug 22 06:24:54 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (make_clock_result): Extracted from rb_clock_gettime.
-
-Wed Aug 21 22:30:51 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): clock() based CLOCK_PROCESS_CPUTIME_ID
- emulation implemented.
-
-Wed Aug 21 21:02:37 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC.
-
-Wed Aug 21 20:33:01 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (get_clk_tck): Extracted from rb_proc_times.
- (rb_clock_gettime): times() based CLOCK_PROCESS_CPUTIME_ID emulation
- is implemented.
-
-Wed Aug 21 19:31:48 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c: POSIX_GETTIMEOFDAY_CLOCK_REALTIME is renamed to
- SUS_GETTIMEOFDAY_CLOCK_REALTIME.
-
-Wed Aug 21 19:17:46 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): CLOCK_PROCESS_CPUTIME_ID emulation
- using getrusage is implemented.
-
-Wed Aug 21 17:34:27 2013 Tanaka Akira <akr@fsij.org>
-
- * gc.c (getrusage_time): Fallback clock_gettime to getrusage when
- clock_gettime fails.
- Reported by Eric Saxby. [ruby-core:56762] [Bug #8805]
-
-Wed Aug 21 02:32:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * insns.def: fix regexp's once option behavior.
- fix [ruby-trunk - Bug #6701]
-
- * insns.def: remove `onceinlinecache' and introduce `once' instruction.
- `once' doesn't use `setinlinecache' insn any more.
-
- * vm_core.h: `union iseq_inline_storage_entry' to store once data.
-
- * compile.c: catch up above changes.
-
- * iseq.c: ditto.
-
- * vm.c, vm_insnhelper.c: ditto. fix `m_core_set_postexe()' which
- is depend on `onceinlinecache' insn.
-
- * test/ruby/test_regexp.rb: add tests.
-
- * iseq.c: ISEQ_MINOR_VERSION to 1 (should increment major?)
-
-Wed Aug 21 02:30:15 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gcdebug_print_obj_condition): add printing information.
-
-Tue Aug 20 13:38:00 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * test/gdbm/test_gdbm.rb: skip TestGDBM#test_s_open_lock on Solaris.
- On Solaris (and platforms which do not have flock and have lockf),
- with GDBM 1.10, gdbm_open(3) blocks when opening already locked
- gdbm file. [Bug #8790] [ruby-dev:47631]
-
-Tue Aug 20 02:32:52 2013 Zachary Scott <e@zzak.io>
-
- * lib/test/: [DOC] Document Test::Unit, hide most submodules and
- classes from rdoc. Since lib/test is only present as a compatibility
- layer with the legacy test suite many test/unit users will be using
- minitest or the test/unit gem instead. It is recommended to use one
- of these alternatives for writing new tests.
-
- This patch was based on a patch submitted by Steve Klabnik.
- [ruby-core:56694] [Bug #8778]
-
-Tue Aug 20 02:10:19 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/rss.rb: [DOC] Document for constants by Steve Klabnik
- [ruby-core:56705] [Bug #8798]
-
-Tue Aug 20 02:01:10 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/xmlparser.rb: [DOC] Hide legacy constant from rdoc
- Patch by Steve Klabnik [ruby-core:56708] [Bug #8799]
-
-Tue Aug 20 01:52:05 2013 Zachary Scott <e@zzak.io>
-
- * ext/socket/unixserver.c: [DOC] Document #accept
- * ext/socket/tcpserver.c: ditto
- * ext/socket/udpsocket.c: [DOC] Fix indentation of documentation
- * ext/socket/socket.c: ditto
- Patches by David Rodr'iguez [ruby-core:56734] [Bug #8802]
-
-Tue Aug 20 01:19:22 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Define ac_cv_func_clock_gettime to yes for mingw*.
-
-Mon Aug 19 21:31:35 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h: Fix a compilation error with
- i586-mingw32msvc-gcc of gcc-mingw32 package on Debian squeeze.
- ruby/missing.h should be included before include/ruby/win32.h
- because struct timespec, used in the clock_gettime declaration in
- include/ruby/win32.h, is defined in ruby/missing.h instead of
- system headers.
-
-Mon Aug 19 20:55:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix around GC_DEBUG.
-
- * gc.c (RVALUE::line): should be VALUE. On some environment
- (such as mswin64), `int' introduces alignment mismatch.
-
- * gc.c (newobj_of): add an assertion to check VALUE alignment.
-
- * gc.c (aligned_malloc): `&' is low priority than `=='.
-
- * gc.c: define GC_DEBUG everytime and use it as value 0 or 1.
-
-Mon Aug 19 17:43:44 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_fiber.rb: collect garbage fibers immediately.
-
-Mon Aug 19 17:41:49 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/profile_test_all.rb: add `failed?' information.
-
-Mon Aug 19 17:00:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (retry_fork): retry with GC if ENOMEM occurred, to free
- swap/kernel space.
-
-Mon Aug 19 13:28:47 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/win32.h (CLOCK_MONOTONIC): typo.
-
- * win32/win32.c: removed duplicated declarations.
-
-Mon Aug 19 13:03:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (clock_gettime): should not overwrite cache variable
- with different condition. otherwise -lrt is not linked and the link
- fails, after reconfig.
-
-Mon Aug 19 12:56:49 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (Init_process): Add constants: CLOCK_REALTIME_ALARM and
- CLOCK_BOOTTIME_ALARM.
-
-Sun Aug 18 20:17:41 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * variable.c, vm_method.c: remove dead code.
-
- * test/ruby/test_fiber.rb, test/ruby/test_thread.rb:
- change accordingly.
-
-Sun Aug 18 19:32:26 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:
- $SAFE=4 is obsolete.
-
-Sun Aug 18 14:30:47 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): Rename POSIX_TIME_CLOCK_REALTIME to
- ISO_C_TIME_CLOCK_REALTIME.
-
-Sun Aug 18 14:22:45 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Revert r42604. It causes linking librt on systems
- with newer glibc uselessly.
-
-Sun Aug 18 13:18:38 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (Init_process): Add constants: CLOCK_REALTIME_COARSE,
- CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME.
-
-Sun Aug 18 12:41:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (clock_gettime): need to check with -lrt prior to check
- for the function only. otherwise -lrt is not linked and the link
- fails, when ac_cv_func_clock_gettime is cached as yes.
-
-Sun Aug 18 10:05:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Make an expression more explicit.
-
-Sun Aug 18 03:18:45 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Use power_level instead of bitsize(xn).
-
-Sun Aug 18 00:44:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BIGDIVREM_EXTRA_WORDS): Redefine to 1.
- (bigdivrem_num_extra_words): Removed.
- (bigdivrem_normal): Simplified.
- (big2str_karatsuba): Ditto.
-
-Sat Aug 17 23:25:19 2013 Benoit Daloze <eregontp@gmail.com>
-
- * test/ruby/test_time.rb: use the in_timezone() helper
- and define it at the top with other helpers.
-
-Sat Aug 17 22:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * time.c (time_mload): ignore auxiliary data, offset and zone, if
- invalid. [ruby-core:56648] [Bug #8795]
-
-Sat Aug 17 20:11:49 2013 Benoit Daloze <eregontp@gmail.com>
-
- * process.c: [DOC] MACH_ABSOLUTE_TIME_CLOCK_MONOTONIC is an
- available emulation for a monotonic clock on Darwin.
- https://developer.apple.com/library/mac/qa/qa1398/_index.html
-
-Fri Aug 16 18:12:05 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/profile_test_all.rb: fix typo.
-
-Fri Aug 16 18:09:20 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/profile_test_all.rb: remove space characters from test names.
-
-Fri Aug 16 17:32:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/profile_test_all.rb: refactoring memory profiling tool for
- test-all.
- Add profiling targets /proc/meminfo and /proc/self/status.
-
- * test/runner.rb: accept other than 'true'.
-
-Fri Aug 16 11:23:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_file_size, rb_file_flock): improve performance of Windows.
-
- * file.c (rb_file_truncate): removed unnecessary #ifdef.
-
- * test/test_file.rb (TestFile#test_truncate_size): added an assertion
- for File#size.
-
-Fri Aug 16 10:07:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_single1): Renamed from bigdivrem_single. Add
- x_higher_bdigit argument.
- (bigdivrem_single): Just call bigdivrem_single1.
- (bigdivrem_restoring): Use bigdivrem_single1 to avoid memmove.
-
-Fri Aug 16 09:17:00 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_small_rshift): Specify the higher BDIGIT instead of
- sign bit.
- (big_shift3): Follow the above change.
-
-Fri Aug 16 02:20:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_toom3): Reduce a branch.
-
-Fri Aug 16 02:14:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * process.c (rb_clock_gettime): add CLOCK_MONOTONIC support on OS X.
- http://developer.apple.com/library/mac/qa/qa1398/_index.html
- [Feature #8658]
-
-Fri Aug 16 01:37:43 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_single): Use shift when y is a power of two.
-
-Fri Aug 16 01:09:33 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_restoring): Use bigdivrem_single if non-topmost
- BDIGITs of y are zero.
-
-Fri Aug 16 00:33:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Truncate topmost zeros of x.
-
-Fri Aug 16 00:00:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_divmod): Simplify an expression.
-
-Thu Aug 15 23:26:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_normal): Remove a local variable.
-
-Thu Aug 15 23:08:32 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_karatsuba): Use bigdivrem_restoring directly to
- reduce working buffer and memory copy.
- (rb_big2str1): Allocate working buffer for big2str_karatsuba here.
-
-Thu Aug 15 20:51:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c, internal.h (rb_io_flush_raw): new function to select calling
- fsync() (on Windows).
-
- * io.c (rb_io_flush_raw): use above function.
-
- * file.c (rb_file_truncate): use above function.
-
- * test/ruby/test_file.rb (TestFile#test_truncate_size): test for
- above changes.
-
-Thu Aug 15 18:39:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (clock_gettime): improve precision when freq is less
- than and nearly equals 10**9.
-
-Thu Aug 15 17:43:15 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_lazy_sweep): remove heap_increment() here because heap_inc
- may be 0.
-
-Thu Aug 15 16:59:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_io_rewind): remove fsync() for Windows to improve the
- performance.
-
-Thu Aug 15 16:30:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/fileutils/test_fileutils.rb (TestFileUtils#test_rmdir):
- FileUtils.rmdir ignores Errno::ENOTEMPTY, so, in such cases, this
- assertion is nonsense.
-
-Thu Aug 15 15:49:35 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): [DOC] FreeBSD 7.1 supports
- CLOCK_THREAD_CPUTIME_ID.
- http://www.freebsd.org/releases/7.1R/relnotes.html
-
-Thu Aug 15 14:30:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/win32.h, win32/Makefile.sub, win32/win32.c
- (clock_gettime): [experimental] emulates clock_gettime(2) of posix.
-
-Thu Aug 15 02:32:40 2013 Zachary Scott <e@zzak.io>
-
- * hash.c (rb_hash_aset): [DOC] Document key dup patch by @kachick
- [Fixes GH-382] https://github.com/ruby/ruby/pull/382
-
-Wed Aug 14 14:28:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * proc.c (rb_mod_define_method): now they return the symbols of the
- defined methods, not the methods/procs themselves.
- [ruby-dev:42151] [Feature #3753]
-
- * NEWS: documents about above change and def-expr (see r42337).
-
- * test/ruby/test_module.rb: tests about above change.
-
-Wed Aug 14 00:51:14 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_restoring): xn argument removed.
- (bigdivrem_normal): Follow the above change.
-
-Wed Aug 14 00:18:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_div_struct): Remove xn and j field. Add zn field.
- (bigdivrem1): Follow the above change.
- (bigdivrem_restoring): Ditto.
-
-Tue Aug 13 23:38:17 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_div_struct): ynzero field removed.
- (bigdivrem1): Follow the above change.
- (bigdivrem_restoring): Ditto.
-
-Tue Aug 13 23:01:16 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_restoring): Extracted from bigdivrem_normal.
-
-Tue Aug 13 22:12:59 2013 Kenichi Kamiya <kachick1@gmail.com>
-
- * random.c (rb_random_ulong_limited): coerce before check negative.
- [Fixes GH-379]
-
-Tue Aug 13 21:52:15 2013 Kenichi Kamiya <kachick1@gmail.com>
-
- * object.c (Init_Object): undef Module#prepend_features on Class, as
- well as Module#append_features. [Fixes GH-376]
-
- * test_class.rb: Added test for above. And ensure type checking
- on similar methods as module_function.
-
-Tue Aug 13 08:52:18 2013 Zachary Scott <e@zzak.io>
-
- * doc/syntax/literals.rdoc: [DOC] String literal concat by @cknadler
- [Fixes GH-380] https://github.com/ruby/ruby/pull/380
-
-Mon Aug 12 23:07:21 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_marks_test): inhibit gc for st's operation.
-
-Mon Aug 12 15:59:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_whole_match_p): treat CR in middle of a line as a
- mere whitespace.
-
-Mon Aug 12 15:16:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * class.c (rb_prepend_module): make T_ICLASS object shady because
- this T_ICLASS object seems to share method table with other class
- objects. It was causes WB miss.
- TODO: need to know the data structure.
-
- * test/ruby/test_module.rb: add a test for WB miss.
-
-Mon Aug 12 13:47:54 2013 Zachary Scott <e@zzak.io>
-
- * process.c: [DOC] RDoc formatting of Process.clock_gettime
-
-Mon Aug 12 13:29:09 2013 Zachary Scott <e@zzak.io>
-
- * lib/yaml/dbm.rb: [DOC] Document call-seq for YAML::DBM
-
-Mon Aug 12 12:57:26 2013 Zachary Scott <e@zzak.io>
-
- * ext/dbm/extconf.rb: [DOC] Hide from RDoc
- Some libraries might want to document extconf.rb so RDoc treats it
- like any other ruby program. However, DBM users shouldn't care about
- these methods.
-
-Mon Aug 12 12:53:39 2013 Zachary Scott <e@zzak.io>
-
- * ext/dbm/dbm.c: [DOC] Reformat headings of DBM class
-
-Mon Aug 12 12:46:31 2013 Zachary Scott <e@zzak.io>
-
- * lib/yaml.rb, lib/yaml/: [DOC] Document YAML::DBM#key and add
- references to similar methods with more detail. This patch brings
- lib/yaml to 100% documentation coverage.
-
-Mon Aug 12 02:51:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/readline/readline.c (readline_s_set_input): on OS X with editline,
- Readline.readline doesn't work because readline_get doesn't use
- rl_getc. The difference is introduced by r42402 [ruby-dev:47509]
- [Bug #8644]. Before it rb_io_stdio_file set ifp->stdio_file.
- Therefore add manually setting the value.
-
- * ext/readline/readline.c (readline_s_set_output): ditto.
-
-Sun Aug 11 23:27:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_str_encode_ospath): OS path encoding on Mac OS X is also
- fixed.
-
-Sun Aug 11 22:57:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_require.rb (assert_require_nonascii_path): OS path
- encoding on Windows is fixed, so encoding of __FILE__ should be it.
- [ruby-core:56498] [Bug #8764]
-
-Sun Aug 11 19:11:45 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parser/test_sax2.rb: Expand abbreviated class name.
-
-Sun Aug 11 19:06:03 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/sax2listener.rb (REXML::SAX2Listener#notationdecl): Fix
- wrong number of arguments in the template listener.
- [Bug #8731] [ruby-dev:47582]
- Reported by Ippei Obayashi.
- * test/rexml/parser/test_sax2.rb: Add tests for parsing notation
- declarations with SAX2 API.
-
-Sun Aug 11 18:44:04 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/sax2listener.rb (REXML::SAX2Listener#elementdecl): Fix wrong
- examples. [Bug #8731] [ruby-dev:47582]
- Reported by Ippei Obayashi.
-
-Sun Aug 11 18:42:13 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/sax2parser.rb
- (REXML::Parsers::SAX2Parser#handle_entitydecl): Extract.
-
-Sun Aug 11 18:40:25 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
- Fix wrong "%" position in parameter entity declaration event argument.
- * test/rexml/parser/test_sax2.rb: Add tests for the above case.
-
-Sun Aug 11 18:08:40 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
- Support NDATA in external ID entity declaration.
- * test/rexml/parser/test_sax2.rb: Add tests for the above case.
-
-Sun Aug 11 18:07:39 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb
- (REXML::Parsers::BaseParser#pull_event): Support optional NDATA
- in external ID entity declaration.
-
-Sun Aug 11 17:54:07 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * NEWS (REXML::Parsers::SAX2Parser): Add about this change.
- * lib/rexml/parsers/sax2parser.rb (REXML::Parsers::SAX2Parser#parse):
- Fix wrong number of arguments. Document says "an array of the
- entity declaration" but it passes two or more arguments.
- This is a bug but it break backward compatibility.
- Reported by Ippei Obayashi. [Bug #8731] [ruby-dev:47582]
- * lib/rexml/sax2listener.rb (REXML::SAX2Listener#entitydecl): ditto.
- The listener template accepted two arguments.
- * test/rexml/parser/test_sax2.rb: Add tests for external ID case.
-
-Sun Aug 11 17:41:41 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parser/test_sax2.rb: Add SAX2 API test.
-
-Sun Aug 11 15:10:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_enc_symname_type): allow ID_ATTRSET for ID_INSTANCE,
- ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
-
-Sun Aug 11 13:17:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * include/ruby/encoding.h: Reduce ENCODING_INLINE_MAX to 127 as this
- should be sufficient to represent all the encodings Ruby supports.
-
-Sun Aug 11 11:54:38 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_clock_gettime): New method.
- This is accepted in the meeting:
- https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130809
- This method is accepted as a CRuby feature.
- I.e. Other Ruby implementations don't need to implement it.
- [ruby-core:56087] [Feature #8658]
-
-Sun Aug 11 10:40:48 2013 Zachary Scott <e@zzak.io>
-
- * lib/time.rb: [DOC] Correcting rdoc visibility of time.rb constants
- Reported by Tanaka Akira [ruby-core:56517]
-
-Sun Aug 11 04:48:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (rb_str_normalize_ospath):
- HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which
- U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through
- U+2FAFF are not decomposed (this avoids problems with round trip
- conversions from old Mac text encodings).
- http://developer.apple.com/library/mac/qa/qa1173/_index.html
- Therefore fix r42457 to exclude the range.
-
-Sun Aug 11 03:26:07 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bitsize): Fix a conditional expression.
-
-Sun Aug 11 02:44:03 2013 Zachary Scott <e@zzak.io>
-
- * lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]
- https://github.com/ruby/ruby/pull/377
-
-Sun Aug 11 01:28:52 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Revert r42458.
- It removes the HAVE_CLOCK_GETTIME from config.h.
- http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20130809T044800Z.diff.html.gz
-
-Sat Aug 10 13:53:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_id_attrset): allow other than ID_ATTRSET.
-
- * parse.y (intern_str): ditto. try stem ID for ID_INSTANCE,
- ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
-
-Sat Aug 10 12:49:50 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb
- (REXML::Parsers::BaseParser::CDATA_END): Use "\A" instead of "^".
- It is not an used constant but I fix it. (Or should I remove it?)
-
-Sat Aug 10 12:47:19 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):
- Fix wrong constant name. "]>" pattern match is the same but
- it is used for "<!DOCTYPE" end mark not "<![CDATA[" end mark.
-
-Sat Aug 10 12:43:15 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):
- Use "\A" instead of "^" in document type declaration patterns
- because they are used as the head match in content not the head
- match in line. They don't cause any problems in the current code
- but it should be fixed.
-
-Sat Aug 10 12:39:00 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parse/test_document_type_declaration.rb: Add tests for
- parsing document type declaration.
-
-Sat Aug 10 12:00:45 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::SYSTEM):
- Fix loose "head" match regular expression. It doesn't cause any
- problem in the current code but it should be fixed because readers
- may confuse it.
- Patch by Ippei Obayashi. Thanks!!!
-
-Sat Aug 10 11:58:24 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parse/test_notation_declaration.rb (#test_system_public):
- Add a test for PUBLIC notation and SYSTEM notation order case.
-
-Sat Aug 10 11:31:35 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::PUBLIC):
- Fix loose "head" match regular expression.
- [Bug #8701] [ruby-dev:47551]
- Patch by Ippei Obayashi. Thanks!!!
- * test/rexml/parse/test_notation_declaration.rb (#test_system_public):
- Add a test for the above case.
-
-Sat Aug 10 09:20:21 2013 Zachary Scott <e@zzak.io>
-
- * NEWS: [DOC] typo in example reported by @moretea
- https://github.com/ruby/ruby/commit/a39e724#commitcomment-3831489
-
-Sat Aug 10 09:19:04 2013 Zachary Scott <e@zzak.io>
-
- * proc.c: [DOC] rdoc code formatting
-
-Sat Aug 10 09:12:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_id_attrset): check if the argument is valid type as an
- attribute.
-
-Sat Aug 10 05:44:08 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/trackback.rb: [DOC] Hide RSS::Trackback from rdoc
- Patch by Steve Klabnik [Bug #8755] [ruby-core:56456]
-
-Sat Aug 10 04:52:21 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_div_struct): Use size_t.
- (bigdivrem1): Ditto.
- (bigdivrem_num_extra_words): Ditto.
- (bigdivrem_single): Ditto.
- (bigdivrem_normal): Ditto.
- (bary_divmod): Ditto.
-
-Fri Aug 9 23:47:15 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rexmlparser.rb: Remove needless REXML version check.
- Both RSS Parser and REXML are bundled in Ruby. RSS Parser can
- always use the latest REXML. [Bug #8754] [ruby-core:56454]
- Patch by Steve Klabnik. Thanks!!!
-
-Fri Aug 9 22:51:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (XLDFLAGS, LIBRUBYARG_STATIC): CoreFoundation framework
- option is now needed always, regardless enable-shared.
- [ruby-core:56467] [Bug #8759]
-
-Fri Aug 9 22:20:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (load_file_internal): use rb_parser_compile_string_path and
- rb_parser_compile_file_path, String path name versions. [Bug #8753]
-
-Fri Aug 9 07:16:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/io/console/console.c: delete redefinition of rb_cloexec_open.
- drop support for 1.8 and 1.9 from the next release of io-console gem.
-
-Fri Aug 9 19:13:54 2013 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: update about new methods for Binding.
-
-Fri Aug 9 18:48:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * proc.c: add Binding#local_variable_get/set/defined?
- to access local variables which a binding contains.
- Most part of implementation by nobu.
-
- * test/ruby/test_proc.rb: add a tests for above.
-
- * vm.c, vm_core.h (rb_binding_add_dynavars): add a new function
- to add a new environment to create space for new local variables.
-
-Fri Aug 9 14:02:01 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/make-snapshot: Fix order of priority for option parameter.
-
-Fri Aug 9 12:06:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_str_normalize_ospath): normalize to Normalization Form C
- using CFString.
-
-Fri Aug 9 10:53:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * time.c (get_timeval, get_new_timeval): use rb_obj_class()
- instead of CLASS_OF() because CLASS_OF() may return
- a singleton class.
-
-Fri Aug 9 10:42:11 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_insnhelper.c (vm_invoke_block): returning from lambda proc
- now always exits from the Proc. [ruby-core:56193] [Feature #8693]
-
- * NEWS, test/ruby/test_lambda.rb: ditto. Patch by nobu.
-
-Fri Aug 9 00:10:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (lazy_zip_func): fix non-single argument. fix
- out-of-bound access and pack multiple yielded values.
- [ruby-core:56383] [Bug #8735]
-
-Thu Aug 8 23:01:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_singleton_p): new method Module#singleton_class? to
- return whether the receiver is a singleton class or not.
- [ruby-core:51087] [Feature #7609]
-
-Thu Aug 8 21:56:44 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (time_overflow_p): Avoid signed integer overflow.
- (rb_time_new): Fix overflow condition.
-
-Thu Aug 8 19:58:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (rb_threadptr_pending_interrupt_check_mask):
- use RARRAY_RAWPTR() instead of RARRAY_PTR() because
- there is no new reference.
-
-Thu Aug 8 19:56:52 2013 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_str_format_m): use RARRAY_RAWPTR() instead of
- RARRAY_PTR() because there is no new reference.
-
-Thu Aug 8 19:55:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: define USE_RGENGC_LOGGING_WB_UNPROTECT.
-
-Thu Aug 8 16:44:25 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: add old macro name `RUBY_EVENT_SWITCH'.
- This macro name is obsolete because it is renamed to
- RUBY_INTERNAL_EVENT_SWITCH, but it has compatibility problem
- using this macro name like ruby-prof.
- I want to remove this macro after ruby 2.1.
-
-Thu Aug 8 15:37:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/coverage/test_coverage.rb (TestCoverage#test_big_code): use `1'
- instead of `p' to get rid of a side effect.
- Kernel#p without any argument seems to do nothing, but flushes stdout.
- and, if stdout is redirected to file, fsync() will be called on
- Windows. so, when running test-all on Windows with redirection, such
- as CI environment, this test took a lot of time.
-
-Thu Aug 8 14:54:18 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * NEWS: add description of incompatibility introduced by r42396.
- [ruby-core:56329] [Bug #8722]
-
-Thu Aug 8 14:50:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (mini): portable target to build miniruby
-
- * common.mk (bisect): run git-bisect with miniruby
-
- * common.mk (bisect-ruby): run git-bisect with ruby
-
- * tool/bisect.sh: script for git-bisect
-
-Thu Aug 8 12:11:43 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/webrick/test_httpresponse.rb (test_send_body_*_chunked): these
- expectations assumes that the IOs are binmode. fixed test failures
- introduced at r42427 on Windows.
-
-Thu Aug 8 10:27:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * range.c (range_last): revert r42400. [Bug #8739]
-
-Thu Aug 8 10:26:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_str_normalize_ospath): extract and move from dir.c.
-
-Thu Aug 8 05:59:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * test/openssl/test_ssl.rb: Fix test for CVE-2013-4073.
- Patch by Antonio Terceiro. [Bug #8750] [ruby-core:56437]
-
-Thu Aug 8 03:37:38 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/webrick/httpresponse.rb: Allow #body to be an IO-like object
- that responds to #readpartial and #read.
- [ruby-trunk - Feature #8155]
- * NEWS: NEWS for above
- * test/webrick/test_httpresponse.rb: Tests for above.
-
-Wed Aug 7 23:06:26 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * ruby.c (Process.argv0): New method to return the original value
- of $0. [Feature #8696]
-
-Wed Aug 7 23:05:55 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * ruby.c (Process.setproctitle): New method to change the title of
- the running process that is shown in ps(1). [Feature #8696]
-
-Wed Aug 7 20:05:38 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_odd_p): Check the bignum length.
- (rb_big_even_p): Ditto.
-
-Wed Aug 7 19:29:26 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (dbl2big): A condition simplified.
-
-Wed Aug 7 16:34:30 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/webrick/test_cgi.rb (TestWEBrickCGI#{start_cgi_server,test_cgi}):
- mswin is not only mswin32 but also mswin64. [Bug #8746]
-
-Wed Aug 7 16:19:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * cont.c (rb_fiber_start): use RARRAY_RAWPTR() instead of
- RARRAY_PTR() because there is no new reference.
-
- * proc.c (curry): ditto.
-
- * proc.c (rb_proc_call): remove line break.
-
-Wed Aug 7 13:20:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * random.c (random_load): use RARRAY_RAWPTR() instead of
- RARRAY_PTR() because there is no new reference.
-
-Wed Aug 7 12:58:23 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (thread_start_func_2): use RARRAY_RAWPTR() instead of
- RARRAY_PTR() because there is no new reference.
-
-Wed Aug 7 09:00:24 2013 Zachary Scott <e@zzak.io>
-
- * string.c: [DOC] Description of rb_str_equal [Fixes GH-375]
- Based on a patch by @markijbema
- https://github.com/ruby/ruby/pull/375
-
-Wed Aug 7 08:30:38 2013 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_hmac.c: [DOC] Documentation for OpenSSL::HMAC
- based on a patch by @repah documenting-ruby/ruby#14
- https://github.com/documenting-ruby/ruby/pull/14
-
-Wed Aug 7 07:46:23 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/utils.rb: [DOC] RSS::Utils by Steve Klabnik [Bug #8745]
-
-Wed Aug 7 07:38:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (nlz16): Removed.
- (nlz32): Ditto.
- (nlz64): Ditto.
- (nlz128): Ditto.
- (nlz_int): New function.
- (nlz_long): New function.
- (nlz_long_long): New function.
- (nlz_int128): New function.
- (nlz): Follow above changes.
- (bitsize): Follow above changes.
-
-Tue Aug 6 22:38:15 2013 Zachary Scott <e@zzak.io>
-
- * time.c: [DOC] Typo in Time overview by @sparr [Fixes GH-374]
- https://github.com/ruby/ruby/pull/374
-
-Tue Aug 6 22:35:32 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/1.0.rb: [DOC] Document RSS10 by Steve Klabnik [Bug #8740]
-
-Tue Aug 6 22:14:11 2013 Kouji Takao <kouji.takao@gmail.com>
-
- * ext/readline/readline.c (readline_s_delete_text): remove
- checking "$SAFE == 4".
-
- * ext/readline/readline.c: fix rdoc, remove "Raises SecurityError"
- and add "Raises NotImplementedError".
-
-Tue Aug 6 22:04:38 2013 Kouji Takao <kouji.takao@gmail.com>
-
- * ext/readline/readline.c, test/readline/test_readline.rb: fix
- indent.
-
-Tue Aug 6 21:59:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * range.c (range_last): return nil for empty range, or in the case the
- predecessor is smaller than the begin. [Bug #8739]
-
-Tue Aug 6 21:48:31 2013 Kouji Takao <kouji.takao@gmail.com>
-
- * ext/readline/readline.c (readline_s_set_point, Init_readline):
- add Readline.point=(pos). Patched by naruse. [ruby-dev:47535]
- [Feature #8675]
-
-Tue Aug 6 21:14:11 2013 Kouji Takao <kouji.takao@gmail.com>
-
- * ext/readline/readline.c (Init_readline, readline_s_set_output)
- (clear_rl_outstream, readline_s_set_input, clear_rl_instream)
- (readline_readline): fix causing SEGV if closed IO object that is
- set Readline.input or Readline.output. Patched by akr
- [ruby-dev:47509] [Bug #8644]
-
-Tue Aug 6 17:56:40 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_push_frame): change type of stack_max to size_t.
-
-Tue Aug 6 17:42:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * range.c (range_last): exclude the last number of the exclusive range
- if the end is Numeric. [ruby-dev:47587] [Bug #8739]
-
-Tue Aug 6 17:42:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_conv_from_wchar): converted string to CP_UTF8
- should have UTF-8 encoding. otherwise no conversion takes place
- later.
-
-Tue Aug 6 17:21:38 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.
- Stack overflow check should be done *after* pushing a stack frame.
- However, some stack overflow checking codes checked *before*
- pushing a stack frame with iseq->stack_max.
- To solve this problem, add a new parameter `stack_max' to specify
- a possible consuming stack size.
-
- * vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow
- checking code.
-
- * insns.def: catch up this change.
-
- * vm.c, vm_eval.c: ditto.
-
- * test/ruby/test_exception.rb: add a stack overflow test.
- This code is reported by nobu.
-
-Tue Aug 6 17:02:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_conv_from_wchar): use WideCharToMultiByte(),
- as like as mbstr_to_wstr(), in the first step of the conversion from
- WCHAR.
-
-Tue Aug 6 16:14:32 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_eval.c (eval_string_with_cref): copy cref to limit the scope of
- refinements in the eval string. [ruby-core:56329] [Bug #8722]
-
- * test/ruby/test_refinement.rb: related test.
-
-Tue Aug 6 12:23:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED to
- declare undefined memory area.
- (bignew_1): Ditto.
-
- * internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c
- (VALGRIND_MAKE_MEM_UNDEFINED): Ditto.
-
-Tue Aug 6 01:40:37 2013 Zachary Scott <e@zzak.io>
-
- * process.c: [DOC] Document caveats of command form of Process.spawn
- with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]
-
-Tue Aug 6 01:28:35 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/0.9.rb: [DOC] Typo in example [Bug #8732]
-
-Tue Aug 6 01:22:37 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/2.0.rb: [DOC] Document RSS::Rss by Steve Klabnik #8740
- * lib/rss/atom.rb: [DOC] Typo in rdoc by Steve Klabnik
-
-Mon Aug 5 23:47:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Rename local variables.
-
-Mon Aug 5 22:23:59 2013 Zachary Scott <e@zzak.io>
-
- * vm_trace.c: [DOC] Fix TracePoint return values in examples
- Based on a patch by @sho-h [Fixes GH-373]
- https://github.com/ruby/ruby/pull/373
-
-Mon Aug 5 17:38:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_write_console): use MultiByteToWideChar() for
- the last step of conversion to WCHAR, to get rid of warnings from
- rb_enc_find() in miniruby. [ruby-dev:47584] [Bug #8733]
-
- * win32/win32.c (wstr_to_mbstr, mbstr_to_wstr): fix wrong trimming.
- WideCharToMultiByte() and MultiByteToWideChar() do not count
- NUL-terminator in the size for conversion result, unless the input
- length is -1.
-
-Mon Aug 5 11:51:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * include/ruby/encoding.h: document which user flags are used by
- ENCODING_MASK for better greppability
-
-Mon Aug 5 10:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * object.c (rb_class_inherited_p): allow iclasses to be tested for
- inheritance. [Bug #8686] [ruby-core:56174]
-
- * test/ruby/test_method.rb: add test
-
-Mon Aug 5 06:13:48 2013 Zachary Scott <e@zzak.io>
-
- * enumerator.c: [DOC] Remove reference to Enumerator::Lazy#cycle
- Patch by @kachick [Fixes GH-372]
- https://github.com/ruby/ruby/pull/372
-
-Mon Aug 5 03:57:16 2013 Zachary Scott <e@zzak.io>
-
- * lib/rss/0.9.rb: [DOC] Document RSS09 by Steve Klabnik [Bug #8732]
-
-Mon Aug 5 03:35:11 2013 Zachary Scott <e@zzak.io>
-
- * lib/rexml/attribute.rb: [DOC] Update example for #namespace
- Patch by Ippei Obayashi [Bug #8685] [ruby-core:56173]
-
-Sun Aug 4 21:08:29 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_zip): performance implement by using
- ALLOCA_N() to allocate tmp buffer.
-
-Sun Aug 4 07:14:49 2013 Tanaka Akira <akr@fsij.org>
-
- * README.EXT, README.EXT.ja: Mention rb_integer_pack and
- rb_integer_unpack.
-
-Sun Aug 4 01:54:45 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BARY_TRUNC): New macro.
- (bary_cmp): Use BARY_TRUNC.
- (bary_mul_toom3): Ditto.
- (bary_divmod): Ditto.
- (abs2twocomp): Ditto.
- (bigfixize): Ditto.
- (rb_cstr_to_inum): Ditto.
- (big2str_karatsuba): Ditto.
- (bigdivrem): Ditto.
-
-Sun Aug 4 00:57:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_karatsuba): Don't allocate new temporary buffer
- if the buffer is enough for current invocation.
-
-Sun Aug 4 00:22:34 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary2bdigitdbl): New function.
- (bdigitdbl2bary): Ditto.
- (bary_mul_single): Use bdigitdbl2bary.
- (power_cache_get_power): Ditto.
- (bary_divmod): Use bary2bdigitdbl.
- (big2str_orig): Ditto.
- (bigdivrem): Ditto.
-
-Sat Aug 3 22:47:11 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: The branch condition of selecting multiplication
- algorithms should check smaller argument because Karatsuba and Toom3
- is effective only if both arguments are big.
- (bary_mul_toom3_branch): Compare the smaller argument to
- TOOM3_MUL_DIGITS.
- (bary_mul): Compare the smaller argument to KARATSUBA_MUL_DIGITS.
-
-Sat Aug 3 22:23:31 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_orig): Receive the number to stringize as
- BDIGIT array and size.
- (big2str_karatsuba): Receive the number to stringize as BDIGIT array
- and size. Use an temporary array of BDIGIT.
- (rb_big2str1): Follow the above change.
-
-Sat Aug 3 13:30:04 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (MAX_BASE36_POWER_TABLE_ENTRIES): Renamed from
- MAX_BIG2STR_TABLE_ENTRIES.
- (base36_power_cache): Renamed from big2str_power_cache.
- (base36_numdigits_cache): Renamed from big2str_numdigits_cache.
-
-Sat Aug 3 10:33:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_set_integer_literal): use rb_rational_raw1() for
- integral rational because no reduction is needed with 1.
-
-Sat Aug 3 09:46:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (setup_passwd, setup_group): set proper encodings to
- string members.
-
-Sat Aug 3 09:30:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * struct.c (rb_struct_define_under): new function to define Struct
- under the given namespace, not under Struct. [Feature #8264]
-
- * ext/etc/etc.c: use rb_struct_define_under.
-
-Sat Aug 3 06:55:29 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * parse.y (value_expr_gen): now NODE_DEFN and NODE_DEFS are not void
- value expressions. get rid of wrong warning with -w, and make to
- pass tests with chkbuild. ref. [Feature #3753]
-
-Sat Aug 3 04:23:48 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/refinements.rdoc: Remove mention of instance_eval and
- module_eval from scope section per:
- http://twitter.com/shugomaeda/status/363219951336693761
-
-Sat Aug 3 02:22:05 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_orig): Refactored.
-
-Sat Aug 3 01:20:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigadd_core): Removed.
- (bigadd): Use bary_add instead of bigadd_core.
-
-Sat Aug 3 00:52:43 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Simplify power_level calculation.
-
-Sat Aug 3 00:34:20 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_zip): use rb_ary_new2() to create buffer
- if rb_block_arity() > 1.
-
-Sat Aug 3 00:12:00 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * NEWS: Add the description that IO#seek supports SEEK_DATA
- and SEEK_HOLE.
-
-Fri Aug 2 23:57:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * vm.c (m_core_define_method, m_core_define_singleton_method): now
- the value of def-expr is the Symbol of the name of the method, not
- nil.
- ref. [ruby-dev:42151] [Feature #3753]
-
- * test/ruby/test_syntax.rb (TestSyntax#test_value_of_def): test for
- above changes.
-
-Fri Aug 2 23:54:11 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_zip): performance improvement by avoiding
- array creation if rb_block_arity() > 1.
-
-Fri Aug 2 23:50:53 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (power_cache_get_power): Apply bigtrunc to the result of
- bigsq.
- (big2str_karatsuba): Fix number of leading zero characters.
-
-Fri Aug 2 23:48:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): calculate denominator directly as powers of
- ten, not parsing string.
-
- * parse.y (parser_number_literal_suffix): return bit set of found
- suffixes.
-
- * parse.y (parser_set_number_literal, parser_set_integer_literal):
- split from parser_number_literal_suffix to set yylval.
-
- * parse.y (parser_yylex): parse rational number literal with decimal
- point precisely.
-
- * parse.y (simple_numeric): integrate numeric literals and simplify
- numeric rules.
-
- * ext/ripper/eventids2.c (ripper_init_eventids2): ripper support for
- new literals, tRATIONAL and tIMAGINARY.
-
-Fri Aug 2 18:33:28 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_karatsuba): Reduce power_level more than one at
- recursion, if possible.
- (rb_big2str1): Follow the above change.
-
-Fri Aug 2 12:25:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul): Swap x and y for bary_mul1 if x is longer than y.
- [ruby-dev:47565] [Bug #8719] Reported by Narihiro Nakamura.
-
-Fri Aug 2 10:39:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * parse.y (negate_lit): add T_RATIONAL and T_COMPLEX to the switch
- statement, and call rb_bug() if an unknown type is passed to
- negate_lit(). [ruby-core:56316] [Bug #8717]
-
- * bootstraptest/test_literal_suffix.rb (assert_equal): add test
-
-Fri Aug 2 09:14:47 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/refinements.rdoc: Improve description of where you may
- activate refinements.
-
-Fri Aug 2 07:45:55 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_orig): Remove len argument.
- (big2str_karatsuba): Ditto.
- (rb_big2str1): Follow above change.
-
-Thu Aug 2 02:32:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * NEWS: Add the description of number literal suffixes.
-
-Thu Aug 2 00:02:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * bootstraptest/test_literal_suffix.rb: add two test cases to
- examine that "1if true" and "1rescue nil" are recognized as 1.
-
-Thu Aug 1 23:45:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * rational.c (rb_flt_rationalize_with_prec): new public C function
- to rationalize a Float instance with a precision.
-
- * rational.c (rb_flt_rationalize): new public C function to
- rationalize a Float instance. A precision is calculated from
- the given float number.
-
- * include/ruby/intern.h: Add rb_flt_rationalize_with_prec and
- rb_flt_rationalize.
-
- * parse.y: implement number literal suffixes, 'r' and 'i'.
- [ruby-core:55096] [Feature #8430]
-
- * bootstraptest/test_literal_suffix.rb: add tests for parser to scan
- number literals with the above tsuffixes.
-
-Thu Aug 1 23:55:08 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Remove a local variable.
-
-Thu Aug 1 23:33:01 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_cstr_to_inum): Use power_cache_get_power.
-
-Thu Aug 1 21:02:48 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Raise an error for too big number.
-
-Thu Aug 1 20:46:29 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (power_cache_get_power): Hide cached Bignum objects.
-
-Thu Aug 1 19:15:05 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2str1): Remove non-trim mode.
- (rb_big2str0): Non-trim mode implemented here.
- (big2str_find_n1): Change the result type to long again.
- (big2str_base_powerof2): Don't take arguments: len and trim.
- (rb_big2str): Follow above change.
-
-Thu Aug 1 12:37:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_alloc): New function to allocate the result string.
- It is called after actual length is calculated.
- (big2str_struct): Add fields: negative, result and ptr.
- (big2str_orig): Write out the result via b2s->ptr.
- (big2str_orig): Ditto.
- (rb_big2str1): Don't allocate the result string at beginning.
-
-Thu Aug 1 07:36:27 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_orig): Use temporary buffer when trim mode.
-
-Thu Aug 1 06:28:48 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_orig): Simplified because RBIGNUM_LEN(x) <= 2 now.
- (big2str_struct): Two fields added: hbase2, hbase2_numdigits.
- (rb_big2str1): Initialize above fields.
-
-Thu Aug 1 04:06:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rdoc/options.rb (RDoc#finish): include root path in include
- paths, to work in another directory than the source directory.
- [ruby-core:56282] [Bug #8712]
-
- * test/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#setup):
- fix input_file_name, as the test script is not pre-processed.
-
-Thu Aug 1 01:45:18 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_karatsuba): Fix a condition of power_level.
-
-Thu Aug 1 01:09:02 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Removed.
- (KARATSUBA_BIG2STR_DIGITS): Removed.
- (big2str_numdigits_cache): New variable.
- (power_cache_get_power): Merged with power_cache_get_power0.
- This function returns maxpow_in_bdigit_dbl(base)**(2**power_level).
- (rb_big2str1): use power_cache_get_power.
-
-Wed Jul 31 23:59:28 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_find_n1): Change the return type to size_t.
- (big2str_orig): Ditto.
- (big2str_karatsuba): Ditto.
- (rb_big2str1): Follow the above changes.
-
-Wed Jul 31 23:19:06 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (power_cache_get_power): Change numdigits_ret to size_t *.
- (big2str_orig): Change len argument to size_t.
- (big2str_karatsuba): Ditto.
- (rb_big2str1): Follow the above changes.
-
-Wed Jul 31 22:59:47 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/parse/test_notation_declaration.rb: Change class
- name to follow file name change.
-
-Wed Jul 31 22:57:50 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Rename to ...
- * test/rexml/parse/test_notation_declaration.rb: ... this.
-
-Wed Jul 31 22:54:39 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_mixin.rb: Remove duplicated tests.
-
-Wed Jul 31 22:52:55 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Fix typos in expected
- value.
- pubilc ->
- public
- ^^
-
-Wed Jul 31 22:50:51 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Add tests that focus
- system literal in external ID system notation declaration.
-
-Wed Jul 31 22:36:21 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_cmp): Extracted from rb_big_cmp.
- (power_cache_get_power): Change n1 argument (number of digits) to
- power_level which is just passed to power_cache_get_power0.
- (big2str_karatsuba): Ditto.
- (rb_big2str1): Calculate the initial power_level.
-
-Wed Jul 31 22:04:36 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Fix a typo.
- Extern ID ->
- ExternalID
- ^^
-
-Wed Jul 31 22:01:36 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Add tests that focus
- public ID in external ID notation declaration.
-
-Wed Jul 31 22:01:24 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * parse.y: fix build error with bison-3.0.
-
-Wed Jul 31 21:58:53 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Split test patterns.
-
-Wed Jul 31 21:42:33 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Group tests.
-
-Wed Jul 31 21:37:51 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_mixin.rb (TestNotationDecl#test_name):
- Move to ...
- * test/rexml/test_notationdecl_parsetest.rb
- (TestNotationDecl#test_name): ... here.
-
-Wed Jul 31 21:37:47 2013 Kouhei Sutou <kou@cozmixng.org>
-
-Wed Jul 31 21:31:49 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: Remove setup because it
- doesn't share anything with other tests.
-
-Wed Jul 31 21:24:55 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_attributes_mixin.rb: Remove a needless shebang.
- * test/rexml/test_notationdecl_mixin.rb: ditto.
- * test/rexml/test_doctype.rb: ditto.
- * test/rexml/test_xml_declaration.rb: ditto.
- * test/rexml/test_changing_encoding.rb: ditto.
-
-Wed Jul 31 21:20:08 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_notationdecl_parsetest.rb: remove a needless shebang.
-
-Wed Jul 31 20:11:01 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_rindex): fix bug introduced in r42269.
- "".rindex("") should return 0.
- (str_rindex): ditto.
-
-Wed Jul 31 19:55:33 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (MAX_BIG2STR_TABLE_ENTRIES): Use SIZEOF_SIZE_T.
- (power_cache_get_power0): Add rb_bug call for too bit i argument.
- (power_cache_get_power): Simplified.
-
-Wed Jul 31 18:32:25 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/uri/common.rb (URI.decode_www_form_component): Use String#b.
-
-Wed Jul 31 18:24:02 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_mod_refine, mod_using, top_using): don't show
- warnings because Refinements are no longer experimental.
- [ruby-core:55993] [Feature #8632]
-
- * test/ruby/test_refinement.rb: related test.
-
- * NEWS: fixes for the above change.
-
-Wed Jul 31 17:55:55 2013 Shota Fukumori <her@sorah.jp>
-
- * lib/uri/common.rb (URI.decode_www_form_component):
- Don't raise error when str includes multibyte characters.
-
-Wed Jul 31 17:45:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_rindex): performance improvement by using
- memrchr(3).
-
-Wed Jul 31 16:43:30 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_rindex): refactoring and avoid to call str_nth() if
- pos == 0.
-
-Wed Jul 31 14:41:36 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb: [DOC] Add a couple of notes on Hash as storage.
- ref. [Feature #6589]
-
-Wed Jul 31 14:38:52 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb: [DOC] Fix example result. Hash is now ordered.
-
-Wed Jul 31 14:38:10 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb: [DOC] Use the term "sorted" instead of "ordered"
- when mentioning SortSet.
-
-Wed Jul 31 12:18:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_struct): New structure.
- (big2str_orig): Use big2str_struct.
- (big2str_karatsuba): Ditto.
- (rb_big2str1): Ditto.
-
-Wed Jul 31 12:02:16 2013 Zachary Scott <e@zzak.io>
-
- * lib/rubygems.rb: [DOC] typo in url patch by @Red54 [Fixes #369]
- https://github.com/ruby/ruby/pull/369
-
-Wed Jul 31 07:09:07 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems from master as of commit 523551c
- * test/rubygems: ditto.
-
-Tue Jul 30 22:21:54 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * test/ruby/test_hash.rb: add a test for enumeration order of Hash.
-
-Tue Jul 30 18:52:27 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#intersect?, Set#disjoint?): Add new methods for
- testing if two sets have any element in common.
- [ruby-core:45641] [Feature #6588] Based on the code by marcandre.
-
-Tue Jul 30 17:16:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable
- characters.
-
-Tue Jul 30 11:00:52 2013 Zachary Scott <e@zzak.io>
-
- * ext/curses/extconf.rb: [DOC] nodoc to reduce Object pollution
-
-Tue Jul 30 08:19:42 2013 Tanaka Akira <akr@fsij.org>
-
- * sizes.c (Init_sizes): Define sizes only if the type actually exists.
-
-Mon Jul 29 22:55:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sizes.c (Init_sizes): define RbConfig::SIZEOF. [Feature #8568]
-
-Mon Jul 29 22:25:20 2013 Zachary Scott <e@zzak.io>
-
- * ext/curses/curses.c: [DOC] Update location of samples
- * samples/curses/*: Move Curses samples and refactor from mixin
- The samples are included in rdoc for module and use of mixin is
- confusing
-
-Mon Jul 29 22:16:11 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed from
- LOG2_KARATSUBA_DIGITS.
- (KARATSUBA_BIG2STR_DIGITS): Renamed from KARATSUBA_DIGITS.
-
-Mon Jul 29 22:04:45 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_compare_by_id): add function prototype.
-
-Mon Jul 29 21:53:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_compare_by_id): don't call rb_hash_rehash()
- if self.compare_by_identity? == true.
-
-Mon Jul 29 21:29:48 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_assoc): performance improvement by replacing
- compare function in RHASH(hash)->ntbl->type temporarily like r42224.
- it falls back to rb_hash_foreach() if st_lookup() doesn't find the key.
-
- * test/ruby/test_hash.rb: add a test for above.
-
-Mon Jul 29 21:15:30 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * test/ruby/test_lazy_enumerator.rb
- (TestLazyEnumerator#test_initialize): Make sure
- Enumerator::Lazy#initialize raises error if the object is
- frozen. The check was performed by rb_ivar_set() before
- rb_check_frozen() was added to enumerator_init().
-
-Mon Jul 29 21:06:42 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * enumerator.c (enumerator_init): Add a frozenness check to
- prevent a frozen Enumerator object from being reinitialized with
- a different enumerable object. This is the least we should do,
- and more fixes will follow. [Fixes GH-368] Patch by Kenichi
- Kamiya.
-
- * enumerator.c (generator_init): Ditto.
-
-Mon Jul 29 20:14:24 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_assoc): revert r42224. table->type->compare is
- called only if hashes are matched.
-
- * test/ruby/test_hash.rb: add a test to check using #== to compare.
-
-Mon Jul 29 17:00:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (yycompile): store file name as String to keep the encoding.
-
- * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path):
- new functions to pass file name as a String.
-
- * parse.y (gettable_gen): return a copy of the original file name, not
- a copy in filesystem encoding.
-
- * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)".
-
-Mon Jul 29 16:53:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_initialize_copy): copy st_table type even if empty.
- [ruby-core:56256] [Bug #8703]
-
-Mon Jul 29 16:34:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_initialize_copy): clear old table before copy new
- table.
-
-Mon Jul 29 16:34:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_assoc): aggregate object can be initialized only
- with link time constants.
-
-Mon Jul 29 14:54:44 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_assoc): performance improvement by replacing
- compare function in RHASH(hash)->ntbl->type temporarily.
-
-Mon Jul 29 14:52:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (xsystem): expand environment variable in all macros not
- expanded with RbConfig. [Bug #8702]
-
- * test/mkmf/test_framework.rb (create_framework): replace all $@ not
- only once.
-
-Mon Jul 29 06:54:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_pipe): use enum for compile time constants,
- instead of const int for debugging.
-
-Mon Jul 29 00:11:49 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Specialized implementation added for
- nx == 2 && ny == 2
-
-Sun Jul 28 20:28:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (io_getpartial): use rb_str_locktmp_ensure().
- [ruby-core:56121] [Bug #8669]
-
- * io.c (rb_io_sysread): ditto.
-
- * test/ruby/test_io.rb: add tests for above.
-
-Sun Jul 28 20:10:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): should make static libraries for extensions
- to be statically linked. [Bug #7948]
-
-Sun Jul 28 17:38:32 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c: add internal API rb_str_locktmp_ensure().
-
- * io.c (io_fread): use rb_str_locktmp_ensure().
- [ruby-core:56121] [Bug #8669]
-
- * test/ruby/test_io.rb: add a test for above.
-
-Sun Jul 28 13:04:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (interpret_seek_whence): support SEEK_DATA and SEEK_HOLE.
- These are whences for lseek(2) supported by Linux since version 3.1.
- [ruby-core:56123] [Feature #8671]
-
- * test/ruby/test_io.rb: Add tests for above.
-
-Sun Jul 28 12:41:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (absint_numwords_generic): The char_bit variable changed
- to static constant.
-
-Sun Jul 28 12:03:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Constify bary_* functions.
-
-Sun Jul 28 11:12:07 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_absint_size): Declaration moved from
- internal.h to calculate required buffer size to pack integers.
- (rb_absint_numwords): Ditto.
- (rb_absint_singlebit_p): Ditto.
- [ruby-core:42813] [Feature #6065]
-
-Sun Jul 28 10:54:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_pipe): fix pipe name formatting. as "%x" may
- not contain '0' at all, fill at fixed position instead.
-
-Sun Jul 28 00:35:14 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_size): Return the bignum "bytewise" size.
- [ruby-core:55578] [Feature #8553]
- This is accepted by matz on DevelopersMeeting20130727Japan.
-
-Sun Jul 28 00:07:48 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_integer_pack): Declaration moved from
- internal.h.
- (rb_integer_unpack): Ditto.
- [ruby-core:42813] [Feature #6065]
-
-Fri Jul 26 23:18:13 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * NEWS: Add a new feature that REXML::Parsers::StreamParser
- supports "entity" event.
-
-Fri Jul 26 23:14:31 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/streamparser.rb
- (REXML::Parsers::StreamParser#parse): Add "entity" event support to
- listener. [Bug #8689] [ruby-dev:47542]
- Reported by Ippei Obayashi.
- * test/rexml/test_stream.rb (StreamTester#entity): Add a test for
- the above case.
-
-Fri Jul 26 23:05:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): separate numeric literal from succeeding
- token, and treat 'e' as floating point number only if followed by
- exponent part.
-
-Fri Jul 26 22:14:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_exec.h (CHECK_VM_STACK_OVERFLOW_FOR_INSN): surround with
- do/while (0), and remove unnecessary casts.
-
-Fri Jul 26 20:12:07 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/syslog/lib/syslog/logger.rb (Syslog::Logger): Add facility
- to Syslog::Logger. [Fixes GH-305] patch by Max Shytikov
- https://github.com/ruby/ruby/pull/305
-
-Fri Jul 26 19:25:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_exec.h, tool/instruction.rb: not an error, but a BUG if stack
- overflow checking failed just before/after the beginning of an
- instruction. It should be treated as a BUG.
- Please tell us if your code cause BUG with this problem.
- This check will removed soon (for performance).
-
-Fri Jul 26 18:30:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_memcpy): cast to int to suppress a warning.
-
-Fri Jul 26 18:21:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_memcpy): try to enable optimization.
- At least on my environments, I don't see any errors
- with many trials. Please tell us if you find any GC bugs.
-
-Fri Jul 26 17:49:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/file.c (fix_string_encoding): fix target encoding. the
- parameter `encoding' is not the target encoding but the original
- encoding.
-
-Fri Jul 26 14:05:19 2013 Zachary Scott <e@zzak.io>
-
- * ext/fiddle/*: [DOC] More doc on dlopen and RTLD_DEFAULT from r42184
-
-Fri Jul 26 13:08:53 2013 Zachary Scott <e@zzak.io>
-
- * ext/fiddle/lib/fiddle.rb: [DOC] Document Fiddle.dlopen(nil)
- * ext/fiddle/handle.c: [DOC] Document Fiddle::Handle.new(nil)
-
-Fri Jul 26 13:04:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (rb_load_internal): use rb_load_file_str() to keep path
- encoding.
-
- * load.c (rb_require_safe): search in OS path encoding for Windows.
-
- * ruby.c (rb_load_file_str): load file with keeping path encoding.
-
- * win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
- path is encoded in UTF-8. [ruby-core:56136] [Bug #8676]
-
- * file.c (rb_str_encode_ospath): simplify using rb_str_conv_enc().
-
- * win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc().
-
- * win32/file.c (convert_mb_to_wchar): use bare pointer instead of
- VALUE, and remove useless argument.
-
-Fri Jul 26 11:42:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * rational.c (f_round_common): Rational is expected to be returned by
- Rational#*, but mathn.rb breaks that assumption. [ruby-core:56177]
- [Bug #8687]
-
-Fri Jul 26 01:37:45 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * include/ruby/ruby.h: check defined(USE_RGENGC_LOGGING_WB_UNPROTECT)
-
-Fri Jul 26 01:21:41 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (rb_file_expand_path_internal): fix r42160; skip '~'.
-
-Thu Jul 25 17:53:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP#connect): disable Nagle's algorithm on
- HTTP connection. [ruby-core:56158] [Feature #8681]
-
-Thu Jul 25 17:49:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * re.c (rb_reg_to_s): convert closing parenthesis to the target encoding
- if it is ASCII incompatible encoding. [ruby-core:56063] [Bug #8650]
-
-Thu Jul 25 17:21:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (is_obj_encoding): new macro to check if obj is an
- Encoding. obj can be any type while is_data_encoding expects T_DATA
- only.
-
-Thu Jul 25 17:17:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_expand_path_internal): should clear coderange after
- copying user name as binary data.
-
-Thu Jul 25 16:17:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * encoding.c (check_encoding): Check T_DATA or not.
- is_data_encoding(obj) assumes that `obj' is T_DATA.
-
-Thu Jul 25 13:06:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_s_home): use rb_home_dir_of and rb_default_home_dir.
-
- * file.c (rb_home_dir_of): split from rb_home_dir() for the home
- directry of the given user, and the user name is a VALUE, not a bare
- pointer. should raise if the user does not exist.
-
- * file.c (rb_default_home_dir): split from rb_home_dir() for the home
- directry of the current user.
-
-Thu Jul 25 12:32:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/openssl/ossl.c: support additional three thread synchronization
- functions. [ruby-trunk - Bug #8386]
-
-Thu Jul 25 07:15:58 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems from master as of commit 4ff70cc
- * test/rubygems: ditto.
-
-Wed Jul 24 20:57:44 2013 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (iseq_set_arguments): use RARRAY_RAWPTR() instead of
- RARRAY_PTR() because there is no new reference.
-
- * compile.c (iseq_set_exception_table): ditto.
-
-Wed Jul 24 19:49:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is
- a relative URI. [Bug #8645]
-
-Wed Jul 24 18:56:06 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_expandarray): use RARRAY_RAWPTR() instead of
- RARRAY_PTR() because there is no new reference.
-
- * vm_insnhelper.c (vm_caller_setup_args): ditto.
-
- * vm_insnhelper.c (vm_yield_setup_block_args): ditto.
-
-Wed Jul 24 18:40:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c, gc.c: move ary_unprotect_logging() into
- rb_gc_unprotect_logging() which is general version
-
- * include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT
- to enable.
-
-Wed Jul 24 17:37:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_expand_path_internal): preserve the file name
- encoding in an exception message.
-
-Wed Jul 24 08:04:49 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/-ext-/tracepoint/test_tracepoint.rb: add GC on/off to count
- GC events strictly.
-
-Tue Jul 23 23:19:24 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/openssl/extconf.rb (CRYPTO_THREADID): check exist or not.
-
- * ext/openssl/ossl.c (ossl_thread_id): use rb_nativethread_self()
- implemented at r42137 to allow threads which doesn't associated with
- Ruby thread to use openssl functions.
-
- * ext/openssl/ossl.c (Init_ossl_locks): If CRYPTO_THREADID is defined
- (OpenSSL 1.0.0 or later has it) use CRYPTO_THREADID_set_callback()
- instead of CRYPTO_set_id_callback() because its argument is
- unsigned long; it may cause id collision on mswin64
- whose sizeof(unsigned long) < sizeof(void*).
- http://www.openssl.org/docs/crypto/threads.html
-
- * ext/openssl/ossl.c (ossl_threadid_func): defined for above.
-
-Tue Jul 23 20:47:36 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Move functions.
-
-Tue Jul 23 20:14:55 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_divmod): Add special cases for x < y easily detected
- and nx == 2 && ny == 2.
-
-Tue Jul 23 19:48:38 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread_(pthread|win32).h: rename rb_thread_cond_t to
- rb_nativethread_cond_t.
-
- * thread.c, thread_pthread.c, thread_win32.c, vm_core.h: catch up
- renaming.
-
-Tue Jul 23 19:44:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread_native.h: add rb_nativethread_self() which returns
- current running native thread identifier.
-
- * thread_[pthread|win32].c: implement rb_nativethread_self().
-
-Tue Jul 23 19:34:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread_pthread.h, thread_win32.h: rename rb_thread_id_t to
- rb_nativethread_id_t.
-
- * thread_pthread.c, vm_core.h: use rb_nativethread_id_t.
-
-Tue Jul 23 18:56:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/openssl/ossl.c: use system native (system provided)
- thread locking APIs added by last commit.
- This patch fixes [Bug #8386].
- "rb_mutex_*" APIs control only "Ruby" threads.
- Not for native threads.
-
-Tue Jul 23 18:44:15 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread_native.h: added.
- Move native thread related lines from vm_core.h.
- And declare several functions "rb_nativethread_lock_*",
- manipulate locking.
-
- * common.mk: add thread_native.h.
-
- * thread.c: add functions "rb_nativethread_lock_*".
-
- * thread.c, thread_[pthread,win32].[ch]: rename rb_thread_lock_t
- to rb_nativethread_lock_t to make it clear that this lock is for
- native threads, not for ruby threads.
-
-Tue Jul 23 16:14:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_before_sweep): fix spacing.
-
-Tue Jul 23 15:57:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_get_freeobj): clear slot->freelist here.
- This means that this slot doesn't have any free objects.
- And store this slot with objspace->heap.using_slot.
-
- * gc.c (gc_before_sweep): restore objspace->freelist
- into objspace->heap.using_slot->freelist.
- This means that using_slot has free objects which are
- pointed from objspace->freelist.
-
- * gc.c (gc_slot_sweep): do not need to clear slot->freelist.
-
-Tue Jul 23 09:34:49 2013 Zachary Scott <e@zzak.io>
-
- * sample/drb/README*.rdoc: [DOC] migrate DRb sample READMEs to rdoc
-
-Tue Jul 23 09:28:05 2013 Zachary Scott <e@zzak.io>
-
- * lib/drb/invokemethod.rb: [DOC] nodoc InvokeMethod18Mixin
-
-Tue Jul 23 08:44:37 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl_asn1.c (asn1time_to_time): Implement YYMMDDhhmmZ
- format for ASN.1 UTCTime. [ruby-trunk - Bug #8664]
- * test/openssl/test_asn1.rb: Test for the above.
-
-Tue Jul 23 08:11:32 2013 Zachary Scott <e@zzak.io>
-
- * lib/rexml/streamlistener.rb: [DOC] Fix examples in
- REXML::StreamListener#entitydecl patch by Ippei Obayashi [Bug #8665]
-
-Tue Jul 23 07:44:59 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems from master as of commit b165260
- * test/rubygems: ditto.
-
-Tue Jul 23 07:14:31 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mulsub_1xN): New function.
- (bary_mul_toom3): Use bary_mulsub_1xN.
-
-Tue Jul 23 03:32:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (KARATSUBA_BALANCED): New macro.
- (TOOM3_BALANCED): Ditto.
- (bary_mul_balance_with_mulfunc): Use KARATSUBA_BALANCED and
- TOOM3_BALANCED.
- (rb_big_mul_balance): Relax a condition.
- (rb_big_mul_karatsuba): Use KARATSUBA_BALANCED.
- (rb_big_mul_toom3): Use TOOM3_BALANCED.
- (bary_mul_karatsuba_branch): Use KARATSUBA_BALANCED.
- (bary_mul_toom3_branch): Use TOOM3_BALANCED.
-
-Tue Jul 23 01:34:45 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem_mulsub): Extracted from bigdivrem1.
- (bigdivrem1): Use bary_add.
-
-Mon Jul 22 18:39:52 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_enumerate_chars): specify array capa
- with str_strlen().
-
- * string.c (rb_str_enumerate_codepoints): ditto.
-
-Mon Jul 22 18:01:33 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_enumerate_chars): specify array capa.
-
-Mon Jul 22 17:24:14 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_each_char_size): performance improvement by
- using rb_str_length().
-
-Mon Jul 22 16:32:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (eval_string_with_cref): check by Check_TypedStruct
- instead of rb_obj_is_kind_of.
-
-Mon Jul 22 13:19:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_resize_capa): use RARRAY_RAWPTR() because
- this code creates no new references.
-
-Mon Jul 22 12:58:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_memfill): added.
-
- * array.c (rb_ary_initialize): use ary_memfill().
-
- * array.c (rb_ary_fill): ditto.
-
- * array.c (rb_ary_slice_bang): use RARRAY_RAWPTR() because
- this code creates no new references.
-
-Mon Jul 22 10:09:46 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_slot_sweep): need to add empty RVALUE as freeobj.
-
-Mon Jul 22 09:48:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (eval_string_with_cref): use the given file name unless
- eval even if scope is given. additional fix for [Bug #8436].
- based on the patch by srawlins at [ruby-core:56099] [Bug #8662].
-
-Mon Jul 22 09:24:19 2013 Kouji Takao <kouji@takao7.net>
-
- * ext/readline/readline.c (Init_readline): added
- Readline.delete_text. [ruby-dev:45789] [Feature #6626]
- * ext/readline/extconf.rb: check for rl_delete_text() in Readline library.
-
- Thanks, Nobuyoshi Nakada, for the patch.
-
-Mon Jul 22 03:15:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
- can be omitted.
-
-Mon Jul 22 00:15:20 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_sq_fast): Refine expressions.
-
-Sun Jul 21 21:08:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul): Use simple multiplication if yl is small.
- (rb_cstr_to_inum): Invoke bigsq instead of bigmul0.
- (bigsq): Re-implemented.
- (bigmul0): Invoke bigsq if two arguments are identical.
-
-Sun Jul 21 09:58:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_toom3): New function based on bigmul1_toom3.
- (bary_mul_toom3_branch): Call bary_mul_toom3.
- (rb_big_mul_toom3): Ditto.
- (bigmul1_toom3): Removed.
- (big_real_len): Ditto.
- (big_split): Ditto.
- (big_split3): Ditto.
-
-Sun Jul 21 08:12:16 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * proc.c (proc_to_s): use PRIsVALUE to preserve the result encoding.
-
-Sun Jul 21 03:36:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * hash.c (rb_hash_flatten): use NUM2INT to raise TypeError on 32bit
- platform. it's introduced by r42039
-
-Sun Jul 21 01:07:45 2013 Benoit Daloze <eregontp@gmail.com>
-
- * common.mk (help): Fix environment variable name and argument.
- Actually it can also be a directory or any argument for
- test/unit runner. [Fixes GH-363]
-
-Sat Jul 20 22:44:50 2013 Zachary Scott <e@zzak.io>
-
- * common.mk: Document running a single test [Fixes GH-363]
- Patch by Avdi Grimm https://github.com/ruby/ruby/pull/363
-
-Sat Jul 20 22:39:56 2013 Zachary Scott <e@zzak.io>
-
- * sample/*: whitespace patch by Sergio Campama [Fixes GH-364]
- https://github.com/ruby/ruby/pull/364
-
-Sat Jul 20 22:33:13 2013 Zachary Scott <e@zzak.io>
-
- * doc/regexp.rdoc: [DOC] Fix typo in example [Fixes GH-365]
- Patch by Juanito Fatas https://github.com/ruby/ruby/pull/365
-
-Sat Jul 20 17:46:03 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_succ): add missing case NEIGHBOR_WRAPPED.
- r42078 caused buggy behavior like "\xFF".b -> "\x01\xFF".b
-
-Sat Jul 20 15:22:38 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_resize): use simple memcpy because there are no new
- references.
-
-Sat Jul 20 15:02:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * safe.c (ruby_safe_level_4_warning): define for old extension
- libraries. [Bug #8652]
-
-Sat Jul 20 14:38:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_make_shared): make shared array shady.
- Making non-shady shared array causes SEGV (see rubyci).
- It seems a bug around shared array.
-
-Sat Jul 20 12:14:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (enc_succ_char, enc_pred_char): consider wchar case.
- [ruby-core:56071] [Bug #8653]
-
- * string.c (rb_str_succ): do not replace with invalid char.
-
- * encoding.c (rb_enc_code_to_mbclen): add new function which returns
- mbclen from codepoint like as rb_enc_codelen() but 0 for invalid
- char.
-
- * include/ruby/encoding.h (rb_enc_code_to_mbclen): declaration and
- shortcut macro.
-
-Fri Jul 19 21:59:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: declare type_name() at the beginning of file.
-
-Fri Jul 19 21:35:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c: reduce shady operations.
-
- * array.c (rb_ary_modify, ary_make_partial, rb_ary_splice,
- rb_ary_replace, rb_ary_eql, rb_ary_compact_bang):
- use RARRAY_RAWPTR() instead of RARRAY_PTR().
-
- * array.c (rb_ary_shift): use RARRAY_PTR_USE() without WB because
- there are not new relations.
-
- * array.c (ary_ensure_room_for_unshift): ditto.
-
- * array.c (rb_ary_sort_bang): ditto.
-
- * array.c (rb_ary_delete_at): ditto.
-
- * array.c (rb_ary_reverse_m): use RARRAY_RAWPTR() because
- there are not new relations.
-
-Fri Jul 19 20:58:20 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c: reduce shade operations.
-
- * array.c (rb_ary_modify): use RARRAY_RAWPTR().
-
- * array.c (ary_make_substitution, rb_ary_s_create, ary_make_partial,
- rb_ary_splice, rb_ary_resize, rb_ary_rotate_m, rb_ary_times):
- use ary_memcpy().
-
-Fri Jul 19 19:55:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_mem_clear): added. This operation doesn't need WB
- because this operation creates a reference to Qnil.
-
- * array.c (ary_make_shared, rb_ary_store, rb_ary_shift_m,
- rb_ary_splice, rb_ary_resize, rb_ary_fill): use ary_mem_clear()
- instead of rb_mem_clear().
-
- * array.c (ary_make_shared): use RARRAY_RAWPTR() instead of RARRAY_PTR().
-
-Fri Jul 19 19:18:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c: fix commit miss.
- RGENGC_UNPROTECT_LOGGING should be 0.
-
-Fri Jul 19 19:15:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no
- writing.
-
- * array.c (rb_ary_new_from_values): use ary_memcpy().
-
-Fri Jul 19 19:07:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_memcpy): add a function to copy VALUEs into ary
- with write barrier. If ary is promoted, use write barrier correctly.
-
- * array.c (rb_ary_cat, rb_ary_unshift_m, rb_ary_dup,
- rb_ary_sort_bang, rb_ary_replace, rb_ary_plus): use ary_memcpy().
-
-Fri Jul 19 15:32:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_store): use RARRAY_PTR_USE() instead of RARRAY_PTR().
- Clearing memory space doesn't need WBs.
-
-Fri Jul 19 15:19:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_ensure_room_for_push): use RARRAY_RAWPTR() instead of
- RARRAY_PTR. In this code, there are no "write" operation.
-
- * array.c (rb_ary_equal): ditto.
-
- * array.c (recursive_equal): ditto.
-
-Fri Jul 19 15:09:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c, internal.h (rb_gc_writebarrier_remember_promoted): add a new
- function to remember an specified object. This api is only
- experimental (strongly depend on WB/rgengc strategy).
-
-Fri Jul 19 14:56:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_unprotect_logging): use (void *) for first parameter
- because VALUE is not defined before including ruby/ruby.h.
-
-Fri Jul 19 14:19:48 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/pathname/pathname.c (path_inspect): use PRIsVALUE to preserve
- the result encoding.
-
-Fri Jul 19 12:35:41 2013 Tanaka Akira <akr@fsij.org>
-
- * test/socket/test_tcp.rb (test_initialize_failure): Use EADDRNOTAVAIL
- to test an error message generated by bind() failure.
-
-Fri Jul 19 11:27:38 2013 Zachary Scott <e@zzak.io>
-
- * lib/racc/parser.rb: [DOC] Capitalize "Ruby" in documentation
- Patch by Dave Worth https://github.com/ruby/ruby/pull/341
-
-Fri Jul 19 11:26:28 2013 Zachary Scott <e@zzak.io>
-
- * ext/psych/lib/psych*: [DOC] Capitalize "Ruby" in documentation
- Patch by Dave Worth https://github.com/ruby/ruby/pull/341
-
-Fri Jul 19 11:25:12 2013 Zachary Scott <e@zzak.io>
-
- * lib/rdoc/*: [DOC] Capitalize "Ruby" in documentation
- Patch by Dave Worth https://github.com/ruby/ruby/pull/341
-
-Fri Jul 19 11:23:55 2013 Zachary Scott <e@zzak.io>
-
- * lib/rubygems*: [DOC] Capitalize "Ruby" in documentation
- Patch by Dave Worth https://github.com/ruby/ruby/pull/341
-
-Fri Jul 19 11:16:54 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#to_set): Define Set#to_set so that aSet.to_set
- returns self. [Fixes GH-359]
-
-Fri Jul 19 11:10:23 2013 Zachary Scott <e@zzak.io>
-
- * lib/rake/*: [DOC] Capitalize "Ruby" in documentation
- Patch by Dave Worth https://github.com/ruby/ruby/pull/341
-
-Fri Jul 19 01:04:14 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/bignum/intpack.c: Renamed from ext/-test-/bignum/pack.c.
- (Init_intpack): Renamed from Init_pack.
- Reported by Naohisa Goto. [ruby-dev:47526] [Bug #8655]
-
-Fri Jul 19 00:54:27 2013 Benoit Daloze <eregontp@gmail.com>
-
- * test/ruby/test_array.rb (test_count): add a test case for #count
- with an argument. See Bug #8654.
-
-Thu Jul 18 23:45:06 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_eql): compare RARRAY_PTR() for performance
- improvement in case of that self and other are shared.
-
-Thu Jul 18 22:46:42 2013 Zachary Scott <e@zzak.io>
-
- * lib/cgi.rb: [DOC] Capitalize "Ruby" in documentation [Fixes GH-341]
- Patch by Dave Worth https://github.com/ruby/ruby/pull/341
- * lib/webrick.rb: ditto
- * lib/scanf.rb: ditto
- * lib/xmlrpc/config.rb: ditto
- * lib/resolv.rb: ditto
- * lib/e2mmap.rb: ditto
- * lib/fileutils.rb: ditto
- * lib/mkmf.rb: ditto
- * lib/cgi/session.rb: ditto
- * lib/yaml.rb: ditto
- * lib/erb.rb: ditto
- * lib/irb.rb: ditto
- * lib/tracer.rb: ditto
- * lib/net/http.rb: ditto
- * ext/syslog/lib/syslog/logger.rb: ditto
- * sample/pty/expect_sample.rb: ditto
-
-Thu Jul 18 21:30:50 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_sq_fast): Specialize the last iteration of the
- outer loop.
- (bigfixize): A condition simplified.
-
-Thu Jul 18 21:15:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_equal): compare RARRAY_PTR() for performance
- improvement in case of that self and other are shared.
-
-Thu Jul 18 20:44:51 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_fill): use memfill().
-
-Thu Jul 18 20:35:14 2013 Benoit Daloze <eregontp@gmail.com>
-
- * array.c (rb_ary_count): check length to avoid SEGV
- while iterating. Remove other pointer loop when arg is given.
-
- * test/ruby/test_array.rb (test_count): add test for bug.
- [ruby-core:56072] [Bug #8654]
-
-Thu Jul 18 18:14:36 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_count): iterate items appropriately.
- [Bug #8654]
-
-Thu Jul 18 17:35:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_flatten): performance improvement by not using
- rb_hash_to_a() to avoid array creation with rb_assoc_new().
-
-Thu Jul 18 16:16:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c: add logging feature for RGenGC's write barrier unprotect
- event.
-
-Thu Jul 18 15:45:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): make only
- rb_set_safe_level(4) an error always but make rb_secure(4) an error
- only in the core. [ruby-dev:47517] [Bug #8652]
-
-Thu Jul 18 15:42:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: fix spell miss.
-
-Thu Jul 18 15:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (ruby_safe_level_4): get rid of special
- character. [ruby-dev:47512] [misc #8646]
-
-Thu Jul 18 14:51:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ary_alloc): slim setup process.
-
-Thu Jul 18 14:37:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * string.c (str_alloc): no need to clear RString (already cleared).
-
-Thu Jul 18 12:57:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BDIGITS_ZERO): Defined.
- (bary_pack): Use BDIGITS_ZERO.
- (bary_unpack): Ditto.
- (bary_mul_single): Ditto.
- (bary_mul_normal): Ditto.
- (bary_sq_fast): Ditto.
- (bary_mul_balance_with_mulfunc): Ditto.
- (bary_mul_precheck): Ditto.
- (bary_mul_toom3_branch): Ditto.
- (rb_cstr_to_inum): Ditto.
- (big_shift3): Ditto.
- (bigmul1_toom3): Ditto.
- (bary_divmod): Ditto.
-
-Thu Jul 18 06:30:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename gc related functions with prefix "gc_".
- * before_gc_sweep() -> gc_before_sweep().
- * after_gc_sweep() -> gc_after_sweep().
- * lazy_sweep() -> gc_lazy_sweep().
- * rest_sweep() -> gc_rest_sweep().
- * slot_sweep() -> gc_slot_sweep().
-
- * gc.c: rename a heap management function with prefix "heap_".
- * get_freeobj() -> heap_get_freeobj().
-
- * gc.c: rename markable_object_p() to is_markable_object().
-
-Wed Jul 17 22:57:40 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (delete_if_i): use ST_DELETE.
-
-Wed Jul 17 22:34:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: An static assertion for relation of SIZEOF_LONG and
- SIZEOF_BDIGITS is added.
- (bary_mul_precheck): Reduce comparisons.
- (bary_mul): Invoke bary_sq_fast or bary_mul1 if the bignum size is
- small.
- (bigfixize): Resize the argument bignum here.
- (bignorm): Don't call bigtrunc after bigfixize.
-
-Wed Jul 17 22:13:26 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_replace): performance improvement by using
- st_copy().
-
-Wed Jul 17 17:19:54 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename heap management functions with prefix "heap_".
- * allocate_sorted_array() -> heap_allocate_sorted_array().
- * slot_add_freeobj() -> heap_slot_add_freeobj().
- * assign_heap_slot() -> heap_assign_slot().
- * add_heap_slots() -> heap_add_slots().
- * init_heap() -> heap_init().
- * set_heap_increment() -> heap_set_increment().
-
- * gc.c (initial_expand_heap): inlined in rb_gc_set_params().
-
-Wed Jul 17 17:12:23 2013 Matthew M. Boedicker <matthewm@boedicker.org>
-
- * hash.c (env_fetch): Add key name to message on ENV.fetch KeyError,
- as well as Hash#fetch. [ruby-core:56062] [Feature #8649]
-
-Wed Jul 17 15:59:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: catch up last changes for debugging/checking mode.
-
-Wed Jul 17 15:50:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_free): free slot itself.
-
- * gc.c (objspace_each_objects): fix condition.
- Use slot->body instead of slot.
-
- * gc.c (count_objects): use "slot" variable.
-
-Wed Jul 17 15:21:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (unlink_heap_slot): fix memory leak.
- free slot itself at free_heap_slot().
-
- Reproduce-able code is here:
- N1 = 100_000; N2 = 1_000_000
- N1.times{ary = []; N2.times{ary << ''}}
- Maybe this problem is remaining in Ruby 2.0.0.
-
- * gc.c (unlink_heap_slot): remove not working code.
-
-Wed Jul 17 14:31:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: re-design the heap structure.
-
- (1) The heap is consists of a set of slots.
- (2) Each "slot" has a "slot_body".
- slot::start and slot::limit specify RVALUE beginning address
- and number of RVALUE in a "slot_body".
- (3) "slot_body" contains a pointer to slot (slot_body::header::slot)
- and an array of RVALUE.
- (4) heap::sorted is an array of "slots", sorted by an address of
- slot::body.
-
- See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design
- for more details (figure).
-
- * gc.c: Avoid "heaps" terminology. It is ambiguous.
-
-Wed Jul 17 13:29:16 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix heaps_header and heaps_slot to reduce memory consumption.
- (1) move heaps_header::start and limit to heaps_slot.
- (2) remove heaps_header::end which can be calculated by start+limit.
-
- * gc.c: catch up above change.
-
-Wed Jul 17 12:30:05 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/st.h (st_strcasecmp): Macro defined for compatibility.
- (st_strncasecmp): Ditto.
-
-Wed Jul 17 11:57:45 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/cgi/util.rb (CGI::Util#escape, unescape): Avoid use of regexp
- special global variable. [Feature #8648] Thanks to fotos.
-
-Wed Jul 17 11:57:10 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/erb.rb (ERB::Util#url_encode): Avoid use of regexp special global
- variable. [Feature #8648] Thanks to fotos.
-
-Wed Jul 17 08:12:41 2013 Tanaka Akira <akr@fsij.org>
-
- * st.c (st_locale_insensitive_strcasecmp): Renamed from st_strcasecmp.
- (st_locale_insensitive_strncasecmp): Renamed from st_strncasecmp.
-
- * include/ruby/st.h: Follow above changes.
-
- * include/ruby/ruby.h: Ditto.
-
-Wed Jul 17 00:14:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigmul1_toom3): Use bigdivrem_single instead of bigdivrem.
- (big_three): Removed.
- (Init_Bignum): Don't initialize big_three.
-
-Tue Jul 16 21:46:03 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * configure.in: revert r42008. strcasecmp() uses the current locale.
-
- * include/ruby/ruby.h: ditto.
-
- * st.c (st_strcasecmp): ditto.
-
-Tue Jul 16 21:07:04 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * configure.in: check strcasecmp().
-
- * include/ruby/ruby.h: use strcasecmp() as st_strcasecmp() if it
- exists.
-
- * st.c (st_strcasecmp): define the function only if strcasecmp()
- doesn't exist.
-
-Tue Jul 16 20:21:28 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigsq): Renamed from bigsqr.
-
-Tue Jul 16 19:42:08 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (USHORT): Unused macro removed.
-
-Tue Jul 16 19:18:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: slim a path of newobj_of().
-
- * gc.c (objspace): add a new field objspace::freelist, which contains
- available RVALUEs.
-
- * gc.c (newobj_of): simply call new function `get_freeobj()'.
- get_freeobj() returns objspace::freelist. If objspace::freelist
- is not available, refill objspace::freelist with a slot pointed by
- objspace::heap::free_slots.
-
- * gc.c (before_gc_sweep): clear objspace::freelist.
-
- * gc.c (slot_sweep): clear slot::freelist.
-
- * gc.c (heaps_prepare_freeslot): renamed to heaps_prepare_freeslot.
-
- * gc.c (unlink_free_heap_slot): remove unused function.
-
- * gc.c (rb_free_const_table): remove unused function.
-
-Tue Jul 16 19:05:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_shift3): Big shift width is not a problem for right
- shift.
-
-Tue Jul 16 18:50:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_count): [DOC] fix typo. Array#count uses ==, not
- ===. a question at asakusa.rb ML.
-
-Tue Jul 16 18:35:48 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_karatsuba): Avoid duplicate calculation when
- squaring.
- (bary_mul_toom3_branch): Ditto.
-
-Tue Jul 16 17:43:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (link_free_heap_slot): removed.
-
- * gc.c (slot_sweep): use `heaps_add_freeslot' instead of
- `link_free_heap_slot'.
-
- * gc.c (assign_heap_slot): use local variable `slot' instead of
- `heaps'.
-
-Tue Jul 16 17:21:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (assign_heap_slot): refactoring variable names.
-
- * gc.c (slot_add_freeobj): added.
-
- * gc.c (heaps_add_freeslot): added.
-
- * gc.c (finalize_list, rb_gc_force_recycle, slot_sweep): use
- `slot_add_freeobj' instead of modifying linked list directly.
-
-Tue Jul 16 16:30:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (lazy_sweep): refactoring.
-
-Tue Jul 16 13:32:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (enc_set_index): since r41967, old terminator is dealt
- with in str_fill_term(). should not consider it here because this
- function is called before any encoding is set.
-
-Tue Jul 16 11:12:03 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * proc.c (rb_block_arity): raise ArgumentError if no block given.
-
-Tue Jul 16 08:15:22 2013 Zachary Scott <e@zzak.io>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] document top-level
- classes from BigDecimal utils native extensions
-
-Tue Jul 16 03:23:03 2013 Zachary Scott <e@zzak.io>
-
- * numeric.c: [DOC] improve rdoc formatting for parameters and links
-
-Mon Jul 15 14:40:00 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_big2str0): Deprecated.
-
- * bignum.c (rb_big2str1): Renamed from rb_big2str0.
- (rb_big2str0): Deprecated wrapper for rb_big2str1.
- (rb_big2str): Invoke rb_big2str1 instead of rb_big2str0.
-
-Mon Jul 15 14:13:02 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * struct.c (rb_struct_each_pair): use rb_yield_values(2, key, value)
- instead of rb_yield(rb_assoc_new(key, value)) if rb_block_arity()
- is greater than 1.
-
-Mon Jul 15 13:46:26 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Add static assertions.
-
-Mon Jul 15 13:36:02 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_each_pair): performance improvement by using
- rb_block_arity().
-
-Mon Jul 15 13:15:37 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * proc.c (rb_block_arity): create internal API rb_block_arity().
- it returns arity of given block.
-
-Mon Jul 15 13:07:27 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * lib/prime.rb (Prime::EratosthenesGenerator,
- Prime::EratosthenesSieve): New implementation by
- robertjlooby <robertjlooby AT gmail.com>.
-
- * test/test_prime.rb: updated with new method name
-
-Mon Jul 15 11:32:46 2013 Zachary Scott <e@zzak.io>
-
- * numeric.c (rb_cNumeric): [DOC] Added comment for Numeric to fix doc
-
-Mon Jul 15 11:24:48 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (maxpow_in_bdigit_dbl): Useless #if removed.
-
-Mon Jul 15 11:10:46 2013 Zachary Scott <e@zzak.io>
-
- * bignum.c (rb_big_coerce): [DOC] Add docs for Bignum#coerce
- Based on patch by Juanito Fatas [Fixes GH-360]
- https://github.com/ruby/ruby/pull/360
-
-Mon Jul 15 10:56:01 2013 Zachary Scott <e@zzak.io>
-
- * thread.c (mutex_sleep): [DOC] Awake thread will reacquire lock
- By Tim Abdulla [Fixes GH-342] https://github.com/ruby/ruby/pull/342
-
-Mon Jul 15 10:45:09 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (nlz16): Use __builtin_clz if possible.
- (nlz32): Use __builtin_clz or __builtin_clzl if possible.
- (nlz64): Use __builtin_clzl or __builtin_clzll if possible.
- (nlz128): Use __builtin_clzll if possible.
-
- * configure.in: Check __builtin_clz, __builtin_clzl and
- __builtin_clzll.
-
-Mon Jul 15 09:39:07 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (power_cache_get_power): Use bitsize instead of ceil_log2.
- (ones): Removed.
- (next_pow2): Removed.
- (floor_log2): Removed.
- (ceil_log2): Removed.
-
- * configure.in (__builtin_popcountl): Don't check.
-
-Mon Jul 15 02:47:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * localeinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
- move from encoding.c.
-
- * miniinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
- define miniruby specific functions only.
-
-Mon Jul 15 02:32:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (rb_enc_init): no longer needs NO_PRESERVED_ENCODING.
-
- * encoding.c (enc_inspect): defer loading autoloaded encoding.
-
- * encoding.c (enc_check_encoding): use is_data_encoding() to check
- type consistently.
-
- * encoding.c (must_encoding): return rb_encoding* instead of encoding
- index.
-
- * encoding.c (enc_check_encoding): use is_data_encoding() to check
- type consistently.
-
- * encoding.c (must_encoding): return rb_encoding* instead of encoding
- index.
-
-Mon Jul 15 02:21:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_fill_term): consider old terminator length, and should
- not use rb_enc_ascget since it depends on the current encoding which
- may not be compatible with the new terminator. [Bug #8634]
-
- * encoding.c (enc_inspect): use PRIsVALUE to preserve the result
- encoding.
-
-Sun Jul 14 23:21:47 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Check __builtin_popcountl, __builtin_bswap32 and
- __builtin_bswap64.
-
- * internal.h (swap32): Use the configure result for the condition to
- use __builtin_bswap32.
- (swap64): Use the configure result for the condition to use
- __builtin_bswap64.
-
- * bignum.c (ones): Use the configure result for the condition to use
- __builtin_popcountl.
- (bary_unpack_internal): Use appropriate types for swap argument.
-
-Sun Jul 14 22:21:11 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_subb): Support xn < yn.
- (bigsub_core): Removed.
- (bigsub): Don't compare before subtraction. Just subtract and
- get the two's complement if the subtraction causes a borrow.
-
-Sun Jul 14 00:36:03 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (DIGSPERLONG): Unused macro removed.
- (DIGSPERLL): Ditto.
-
-Sun Jul 14 00:32:51 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_aref): Less scan when the number is negative.
-
-Sun Jul 14 00:17:42 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_shift): Avoid signed integer overflow.
-
-Sun Jul 14 00:14:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_precheck): Use bary_small_lshift or
- bary_mul_normal if xl is 1.
-
-Sat Jul 13 22:58:16 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_shift3): New function.
- big_lshift and big_rshift are merged.
- (big_shift2): New function.
- (big_lshift): Use big_shift3.
- (big_rshift): Ditto.
- (check_shiftdown): Removed.
- (rb_big_lshift): Use big_shift2 and big_shift3.
- (rb_big_rshift): Ditto.
- (big_lshift): Removed.
- (big_rshift): Ditto.
-
-Sat Jul 13 15:51:38 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_small_lshift): Use size_t instead of long.
- (bary_small_rshift): Ditto.
-
-Sat Jul 13 15:33:33 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_small_lshift): Functions moved to remove
- declaration.
- (bary_small_rshift): Ditto.
-
-Sat Jul 13 12:27:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (rb_enc_associate_index): fill new terminator length, not
- old one.
-
-Sat Jul 13 12:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32: move from ext/dl and ext/fiddle. since ext/extmk.rb
- builds extensions in alphabetical order, compiled?('fiddle') under
- ext/dl makes no sense.
-
-Sat Jul 13 09:26:09 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (biglsh_bang): Removed.
- (bigrsh_bang): Ditto.
- (bigmul1_toom3): Use bary_small_lshift and bary_small_rshift.
-
-Sat Jul 13 01:04:43 2013 Zachary Scott <e@zzak.io>
-
- * lib/rubygems/psych_additions.rb: Ignore Psych docs here
-
-Fri Jul 12 18:10:46 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/fiddle/win32/lib/win32/registry.rb
- (Win32::Registry::API#make_wstr): same as r41922.
-
-Fri Jul 12 16:28:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (rb_enc_associate_index): refill the terminator if it
- becomes longer than before. [ruby-dev:47500] [Bug #8624]
-
- * string.c (str_null_char, str_fill_term): get rid of out of bound
- access.
-
- * string.c (rb_str_fill_terminator): add a parameter for the length of
- new terminator.
-
-Fri Jul 12 11:26:25 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHash
- has ntbl and it is empty.
-
-Fri Jul 12 11:17:41 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (recursive_hash): use RHASH_SIZE() to check hash size.
-
-Fri Jul 12 00:20:00 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_size): use RHASH_SIZE().
-
-Fri Jul 12 00:08:24 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_values): set array capa to RHASH_SIZE().
-
-Thu Jul 11 23:54:45 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_keys): set array capa to RHASH_SIZE().
-
-Thu Jul 11 21:30:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_pow): undef pow to get rid of infinite
- recursive call. re-fix [Bug #8495]. [ruby-core:55923] [Bug #8621]
-
-Thu Jul 11 20:18:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/win32/lib/win32/registry.rb (Win32::Registry::API#make_wstr):
- remove workaround to append WCHAR terminator.
-
- * transcode.c (str_encode_associate): fill terminator after conversion.
-
- * string.c (rb_enc_str_new, rb_str_set_len, rb_str_resize): fill
- minimum length of the encoding as the terminator.
-
- * string.c (str_buf_cat, rb_str_buf_append, rb_str_splice_0): ditto.
-
- * string.c (str_make_independent_expand, rb_str_modify_expand): make
- the capacity enough for multi-byte terminator.
-
- * string.c (rb_string_value_cstr): fill minimum length of the encoding
- as the terminator.
-
- * string.c (rb_string_value_cstr): check null char in char, not in
- byte.
-
-Thu Jul 11 14:48:35 2013 Zachary Scott <e@zzak.io>
-
- * array.c: Replace confusing example for #reverse_each in overview
- Patch by Earl St Sauver [Fixes documenting-ruby/ruby-12]
- https://github.com/documenting-ruby/ruby/pull/12
-
-Thu Jul 11 14:22:37 2013 Zachary Scott <e@zzak.io>
-
- * test/drb/ut_eq.rb: Use localhost for drb tests [Bug #7311]
- Patch by Vit Ondruch [ruby-core:49101]
- * test/drb/ut_array.rb: ditto
- * test/drb/ut_array_drbssl.rb: ditto
-
-Thu Jul 11 13:48:03 2013 Zachary Scott <e@zzak.io>
-
- * sprintf.c: Fix typo patch by @hynkle [Fixes GH-357]
- https://github.com/ruby/ruby/pull/357
-
-Thu Jul 11 13:00:34 2013 Zachary Scott <e@zzak.io>
-
- * lib/securerandom.rb: Refactor conditions by Rafal Chmiel
- [Fixes GH-326] https://github.com/ruby/ruby/pull/326
-
-Thu Jul 11 12:04:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Don't use toom3 after once karatsuba is chosen.
- (mulfunc_t): New type.
- (bary_mul_toom3_start): Renamed from bary_mul.
- (bary_mul_karatsuba_start): Renamed from bary_mul.
- (bary_mul_balance_with_mulfunc): Renamed from bary_mul_balance and
- new argument, mulfunc, is added.
- (rb_big_mul_balance): Invoke bary_mul_balance_with_mulfunc with
- bary_mul_toom3_start.
- (bary_mul_karatsuba): Invoke bary_mul_karatsuba_start instead of
- bary_mul.
- (bary_mul_precheck): Extracted from bary_mul.
- (bary_mul_karatsuba_branch): Extracted from bary_mul.
- (bary_mul_karatsuba_start): New function to call bary_mul_precheck
- and bary_mul_karatsuba_branch.
- (bary_mul_toom3_branch): Extracted from bary_mul.
- (bary_mul_toom3_start): New function to call bary_mul_precheck and
- bary_mul_toom3_branch.
- (bary_mul): Just call bary_mul_toom3_start.
- Arguments for work memory are removed.
- (rb_cstr_to_inum): Follow the bary_mul change.
- (bigmul0): Ditto.
-
-Thu Jul 11 10:46:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/probes_to_wiki.rb: fix usage comment. use Enumerable#grep
- which yields each elements to reduce unnecessary array.
-
-Thu Jul 11 10:09:18 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * process.c (rb_daemon): daemon(3) is implemented with fork(2).
- Therefore it needs rb_thread_atfork(). (and revert r41903)
-
-Thu Jul 11 03:22:10 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * tool/probes_to_wiki.rb: adding a script to convert probes.d to wiki
- format for easy wiki updates.
-
-Thu Jul 11 00:54:07 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * man/ri.1: Incorrect use of .Dd macro [Bug #8620] by Tristan Hill
-
-Thu Jul 11 00:48:29 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/delegate.rb: Add example for __setobj__ and __getobj__
- [Bug #8615] Patch by Caleb Thompson
-
-Wed Jul 10 23:29:22 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/logger.rb: Use :call-seq: for method signature rdoc
-
-Wed Jul 10 23:23:18 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/logger.rb (#add): Remove incorrect rdoc for return value
- [Bug #8567] Reported by Tim Pease.
-
-Wed Jul 10 23:12:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_subpos): make public function.
-
-Wed Jul 10 22:44:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Add a static assertion for RBIGNUM_EMBED_LEN_MAX.
-
-Wed Jul 10 22:31:25 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_index): cache single byte flag and some
- cosmetic changes.
-
-Wed Jul 10 22:03:27 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_2comp): Don't use bary_plus_one.
- (bary_add_one): Replaced by the implementation of bary_plus_one.
-
-Wed Jul 10 20:48:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (sizeof_bdigit_dbl): check sizeof(BDIGIT_DBL).
-
- * internal.h (STATIC_ASSERT): move from enum.c.
-
-Wed Jul 10 20:08:21 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (SIZEOF_BDIGIT_DBL): Add a ifdef guard for test.
-
-Wed Jul 10 14:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (fork_daemon): kill the other threads all and abandon the
- kept mutexes.
-
-Wed Jul 10 11:35:36 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/net/http/test_http.rb (TestNetHTTP_v1_2#test_get,
- TestNetHTTP_v1_2_chunked#test_get): shouldn't check
- HttpResponse#decode_content if Zlib is not available.
- ko1 complained via IRC.
-
-Wed Jul 10 10:20:07 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/rbinstall.rb: always require rubygems to stabilize rubygems
- related status like whether Gem::Specification is defined or not.
-
- * tool/rbinstall.rb (Gem::Specification.unresolved_deps): define stub.
-
-Wed Jul 10 08:21:15 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems 2.1
- * test/rubygems: Ditto.
-
-Wed Jul 10 07:34:34 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/ext/ext_conf_builder.rb: Remove siteconf file after
- building the gem.
- * test/rubygems/test_gem_ext_ext_conf_builder.rb: Test for the above.
-
- * lib/rubygems/psych_tree.rb (module Gem): Add backward compatibility
- for r41148
-
- * test/rubygems/test_gem_package.rb: Add backward compatibility for
- double-slash elimination.
-
-Wed Jul 10 06:22:27 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
-
-Wed Jul 10 00:41:42 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul): x*1 is x.
-
-Tue Jul 9 22:24:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul1): No need to invoke MEMZERO at last.
- (bary_mul_single): Invoke MEMZERO here.
-
-Tue Jul 9 21:40:01 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_text.rb: Add missing tests for Text#<<.
- Reported by nagachika. Thanks!!!
-
-Tue Jul 9 18:02:38 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/fileutils.rb (FileUtils#chown_R): Do not skip traversal even
- if user and group are both nil, to be consistent with #chown and
- other commands.
-
-Tue Jul 9 17:58:26 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * test/fileutils/test_fileutils.rb
- (TestFileUtils#assert_output_lines): New utility assertion
- method for testing verbose output.
-
-Tue Jul 9 17:43:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/test_tracer.rb: catch up recent rubygems changes.
-
-Tue Jul 9 16:58:30 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/{dl,fiddle}/win32/lib/win32/registry.rb: hope that the final
- resolution to fix the failure of test-all. and includes Win64
- support (fixed a potential bug).
-
-Tue Jul 9 15:57:20 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * object.c: Fix rdoc for Kernel#<=>. [Fixes GH-352]
-
-Tue Jul 9 15:53:51 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/fileutils.rb (FileUtils#mode_to_s): Define mode_to_s() also
- as singleton method, or FileUtils.chmod fails in verbose mode.
-
-Tue Jul 9 15:16:02 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * test/fileutils/fileasserts.rb
- (Test::Unit::FileAssertions#assert_not_symlink): Add a missing
- optional argument "message".
-
-Tue Jul 9 15:03:24 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): If user
- and group are both nil, print ":".
-
-Tue Jul 9 12:47:08 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (appendline): use READ_CHAR_PENDING_XXX macros and
- RSTRING_END().
-
- * io.c (rb_io_getline_1): rewrite nested if statement into one
- statement.
-
-Tue Jul 9 11:04:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Registry#check):
- should report the position of the error.
-
- * ext/{dl,fiddle}/win32/lib/win32/registry.rb
- (Win32::Registry#QueryValue): workaround for test-all crash.
-
-Tue Jul 9 10:27:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/{dl,fiddle}/win32/lib/win32/registry.rb
- (Win32::Registry.expand_environ): use suitable encoding for the
- string.
-
- * ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Registry#read):
- should return REG_SZ, REG_EXPAND_SZ and REG_MULTI_SZ values with
- the expected encoding -- assumed as the same encoding of name.
-
-Tue Jul 9 10:02:45 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/{dl,fiddle}/win32/lib/win32/registry.rb
- (Win32::Registry::Error#initialize): use suitable encoding for the
- string.
-
-Tue Jul 9 09:46:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/dl/win32/lib/win32/registry.rb (Win32::Registry.expand_environ):
- use suitable encoding for the string. fixed a test-all error of
- r41838.
-
- * ext/fiddle/win32/lib/win32/registry.rb: same changes of r41838 and
- this revision of dl's win32/registry.rb.
-
-Tue Jul 9 07:39:45 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.0.4. See
- https://github.com/rubygems/rubygems/blob/2.0/History.txt for changes
-
-Tue Jul 9 01:47:16 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (biglsh_bang): Don't shift a BDIGIT with BITSPERDIG bits.
- (bigrsh_bang): Ditto.
-
-Tue Jul 9 01:17:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigrsh_bang): Fix bignum digits overrun.
-
-Tue Jul 9 00:46:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (biglsh_bang): Fix bignum digits under-run.
-
-Mon Jul 8 23:36:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/win32/lib/win32/registry.rb (Error, API): use WCHAR
- interfaces. c.f. [Bug #8508]
-
-Mon Jul 8 23:13:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_pow): move from win32.h and disable strict
- ANSI mode macro to let _controlfp() stuff defined.
- [ruby-core:55312] [Bug #8495]
-
- * numeric.c (finite): add declaration for strict ANSI.
- [ruby-core:55312] [Bug #8495]
-
- * thread_win32.c (w32_thread_start_func, thread_start_func_1),
- (timer_thread_func): use __stdcall instead of _stdcall which is
- unavailable in strict ANSI mode. [ruby-core:55312] [Bug #8495]
-
- * win32/win32.c (gettimeofday): use __cdecl instead of _cdecl.
-
-Mon Jul 8 22:41:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul): Arguments for work memory added.
- (bary_mul_balance): Ditto.
- (bary_mul_karatsuba): Ditto.
-
-Mon Jul 8 22:03:30 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_sq_fast): New function for testing.
- (rb_big_mul_toom3): Ditto.
-
- * internal.h (rb_big_sq_fast): Declared.
- (rb_big_mul_toom3): Ditto.
-
-Mon Jul 8 21:59:34 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_balance): Initialize a local variable to suppress
- a warning.
-
-Mon Jul 8 20:55:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_balance): Reduce work memory.
-
-Mon Jul 8 08:26:15 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * test/openssl/test_pkey_ec.rb: Skip tests for "Oakley" curves as
- they are not suitable for ECDSA.
- [ruby-core:54881] [Bug #8384]
-
-Mon Jul 8 08:03:01 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul): Add a RB_GC_GUARD.
-
-Sun Jul 7 23:56:32 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_karatsuba): Unreachable code removed. Remove
- several branches.
-
-Sun Jul 7 22:59:06 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (rb_big_mul_normal): Declared.
- (rb_big_mul_balance): Ditto.
- (rb_big_mul_karatsuba): Ditto.
-
- * bignum.c (rb_big_mul_normal): New function for tests.
- (rb_big_mul_balance): Ditto.
- (rb_big_mul_karatsuba): Ditto.
-
-Sun Jul 7 19:21:30 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Reorder functions to decrease forward reference.
-
-Sun Jul 7 14:41:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: (bigsub_core): Use bary_sub.
- (bary_sub): Returns a borrow flag. Use bary_subb.
- (bary_subb): New function for actually calculating subtraction with
- borrow.
- (bary_sub_one): New function.
- (bigadd_core): Use bary_add.
- (bary_add): Returns a carry flag. Use bary_addc.
- (bary_addc): New function for actually calculating addition with
- carry.
- (bary_add_one): New function.
- (bary_muladd_1xN): Extracted from bary_mul_normal.
- (bigmul1_normal): Removed.
- (bary_mul_karatsuba): New function.
- (bary_mul1): Invoke rb_thread_check_ints after bary_mul_normal.
- (bary_mul): Remove most and least significant zeros before actual
- multiplication. Use bary_sq_fast, bary_mul_balance,
- bary_mul_karatsuba and bigmul1_toom3 as bigmul0.
- (bigmul1_balance): Removed.
- (bigmul1_karatsuba): Removed.
- (bigsqr_fast): Removed.
- (bary_sparse_p): Extracted from big_sparse_p.
- (big_sparse_p): Removed.
- (bigmul0): Use bary_mul.
-
-Sun Jul 7 11:54:33 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * NEWS: Add REXML::Text#<< related updates.
-
-Sun Jul 7 11:49:19 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/text.rb (REXML::Text#<<): Support appending in not
- "raw" mode. [Bug #8602] [ruby-dev:47482]
- Reported by Ippei Obayashi. Thanks!!!
-
-Sun Jul 7 11:43:13 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/text.rb (REXML::Text#<<): Support method chain use by "<<"
- like other objects.
-
-Sun Jul 7 11:34:18 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common
- cache clear code.
-
-Sun Jul 7 11:01:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11
- introduces a check in the dtrace compiler to ensure that probes
- actually exist. If there are no probes, then the -G step will
- fail. As this test is only being used to determine whether -G is
- necessary (for instance, on OSX it is not), adding a real probe to
- the conftest allows it to succeed on newer versions of dtrace.
- Patch by Eric Saxby <sax AT livinginthepast.org> at
- [ruby-core:55826]. [Fixes GH-351], [Bug #8606].
-
-Sun Jul 7 10:07:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_sq_fast): Extracted from bigsqr_fast and
- ensure not to access zds[2*xn].
- (bigsqr_fast): Allocate the result bignum with 2*xn words.
-
-Sat Jul 6 07:37:43 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl_pkey_ec.c: Ensure compatibility to builds of
- OpenSSL with OPENSSL_NO_EC2M defined, but OPENSSL_NO_EC not
- defined.
- * test/openssl/test_pkey_ec.rb: Iterate over built-in curves
- (and assert their non-emptiness!) instead of hard-coding them, as
- this may cause problems with respect to the different availability
- of individual curves in individual OpenSSL builds.
- [ruby-core:54881] [Bug #8384]
-
- Thanks to Vit Ondruch for providing the patch!
-
-Sat Jul 6 07:12:39 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * test/openssl/test_x509crl.rb: Remove unused variable.
- [ruby-core:53501] [Bug #8114]
-
- Thanks, Vipul Amler, for pointing this out!
-
-Sat Jul 6 06:37:10 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl.c: Provide CRYPTO_set_locking_callback() and
- CRYPTO_set_id_callback() callback functions ossl_thread_id and
- ossl_lock_callback to ensure the OpenSSL extension is usable in
- multi-threaded environments.
- [ruby-core:54900] [Bug #8386]
-
- Thanks, Dirkjan Bussink, for the patch!
-
-Sat Jul 6 06:06:16 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * lib/openssl/ssl.rb: Fix SSL client connection crash for SAN marked
- critical.
- The patch for CVE-2013-4073 caused SSL crash when a SSL server returns
- the certificate that has critical SAN value. X509 extension could
- include 2 or 3 elements in it:
-
- [id, criticality, octet_string] if critical,
- [id, octet_string] if not.
-
- Making sure to pick the last element of X509 extension and use it as
- SAN value.
- [ruby-core:55685] [Bug #8575]
-
- Thank you @nahi for providing the patch!
-
-Sat Jul 6 04:49:38 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: register time objects so
- they are referenced as ids during output.
- * test/psych/test_date_time.rb: corresponding test.
-
-Fri Jul 5 20:46:39 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic): this
- assertion doesn't seems to be checking the unicode string on command
- line, but seems to be checking how to treat the unicode string from
- stdin. so, should escape '\' before 'u'. this fixes a test failure
- on Windows.
-
-Fri Jul 5 19:05:40 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): Fix the
- wrong output message when user is nil, which should be "chown
- :group file" instead of "chown group file".
-
-Fri Jul 5 16:21:56 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * test/ruby/test_regexp.rb
- (TestRegexp#test_options_in_look_behind)
- (TestRegexp#assert_match_at): Add tests for another problem
- fixed in Onigmo 5.13.5. Previously Onigmo did not allow option
- enclosures in look-behind, which makes it impossible to
- interpolate a regexp into another in the middle of a look-behind
- pattern. cf. https://github.com/k-takata/Onigmo/pull/17
-
- * test/ruby/test_regexp.rb
- (TestRegexp#test_options_in_look_behind)
- (TestRegexp#assert_match_at): Parse regexps in run time rather
- than in compile time.
-
-Fri Jul 5 12:14:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_notfound): after
- r41710, the path of command uses backslash as the separator on
- Windows.
-
-Fri Jul 5 11:29:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit/assertions.rb (assert_raise_with_message): move from
- test/fileutils/test_fileutils.rb. this is still experimental and
- the interface may be changed.
-
-Fri Jul 5 11:08:00 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (w32_spawn): r41710 made that if the command starts with
- a quote and includes slash, removed the top quote and NOT removed the
- last quote.
- this fixes test failures on test/ruby/test_process.rb and
- test/webrick.
-
-Fri Jul 5 09:53:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/mkmf.rb (CONFIG['CPPOUTFILE']): fix r41769; CONFIG['CPPOUTFILE']
- may be nil.
-
-Fri Jul 5 05:39:53 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BARY_MUL1): Renamed from BARY_MUL.
- (bary_mul1): Renamed from bary_mul.
- (bary_mul): Renamed from bary_mul2.
-
-Fri Jul 5 04:58:05 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_balance): Extracted from bigmul1_balance and
- use bary_mul2 and bary_add to decrease allocations.
-
-Fri Jul 5 02:14:00 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/fileutils.rb (FileUtils#symbolic_modes_to_i): Fix the wrong
- character class [+-=], which happened to match all desired
- characters but also match undesired characters.
-
- * lib/fileutils.rb (FileUtils.chmod{,_R}): Enhance the symbolic
- mode parser to support the permission symbols u/g/o and multiple
- actions as defined in SUS, so that chmod("g=o+w", file) works as
- expected. Invalid symbolic modes are now rejected with
- ArgumentError.
-
-Fri Jul 5 00:25:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_framework): allow header file to check.
- [ruby-core:55745] [Bug #8593]
-
-Thu Jul 4 22:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * object.c (rb_obj_equal): Fixed an rb_obj_equal documentation typo
- where "a" was used instead of "obj".
- Fixes GH-349. Patch by @adnandoric
-
-Thu Jul 4 20:39:20 2013 Tanaka Akira <akr@fsij.org>
-
- * tool/make-snapshot: Exit with EXIT_FAILURE when it fails.
-
-Thu Jul 4 20:20:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (maxpow_in_bdigit_dbl): Use tables if available.
- (maxpow_in_bdigit): Ditto.
- (U16): New macro.
- (U32): Ditto.
- (U64): Ditto.
- (U128): Ditto.
- (maxpow16_exp): New table.
- (maxpow16_num): New table.
- (maxpow32_exp): New table.
- (maxpow32_num): New table.
- (maxpow64_exp): New table.
- (maxpow64_num): New table.
- (maxpow128_exp): New table.
- (maxpow128_num): New table.
-
-Thu Jul 4 18:25:25 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_cstr_to_inum): Avoid temporary buffer allocation except
- very big base non-power-of-2 numbers.
-
-Thu Jul 4 15:51:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_succ): use ONIGENC_MBCLEN_CHARFOUND_P correctly.
-
- * string.c (rb_str_dump): ditto.
-
-Thu Jul 4 10:04:11 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
-
- * [bug] (thanks Akinori MUSHA and Ippei Obayashi)
- Fix a renumbering bug in condition regexp with a named
- capture. [Bug #8583]
- * [spec] (thanks Akinori MUSHA)
- Allow ENCLOSE_OPTION in look-behind.
-
-Thu Jul 4 00:36:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (SIGNED_INTEGER_MAX): suppress warning C4146 on VC6.
- seems a logical ORed expression becomes unsigned.
-
-Thu Jul 4 00:13:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby_atomic.h (rb_w32_atomic_cas): call InterlockedCompareExchange
- directly.
-
- * ruby_atomic.h (ATOMIC_CAS): fix missing function call.
-
-Wed Jul 3 23:47:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in
- VC6. only InterlockedCompareExchange is declared using PVOID.
-
-Wed Jul 3 22:29:20 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (ruby_digit36_to_number_table): Declared.
-
- * util.c (ruby_digit36_to_number_table): Moved from scan_digits.
-
- * bignum.c (conv_digit): Use ruby_digit36_to_number_table.
-
- * pack.c (hex2num): Ditto.
-
-Wed Jul 3 18:12:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (install_dirs): revert DESTDIR prefix by r39841, since
- it is fixed by r41648. [ruby-core:55760] [Bug #8115]
-
-Wed Jul 3 14:15:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (do_stat): use rb_w32_ustati64() in win32.c to get rid of
- mysterious behavior of FindFirstFile() Windows API which treat "<"
- and ">" like as wildcard characters. [ruby-core:55764] [Bug #8597]
-
-Wed Jul 3 12:06:42 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (maxpow_in_bdigit): Renamed from calc_hbase and return
- maxpow.
-
-Tue Jul 2 23:47:50 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (roomof): Cast to long.
- (rb_ull2big): Fix bignew arguments.
-
-Tue Jul 2 21:17:37 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_cstr_to_inum): Merge two temporary buffers.
-
-Tue Jul 2 20:25:04 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_cstr_to_inum): Use BDIGIT_DBL to collect adjacent digits.
- (BDIGIT_DBL_MAX): New macro.
- (maxpow_in_bdigit_dbl): New function.
-
-Tue Jul 2 17:23:33 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * doc/syntax/refinements.rdoc: add description of Module#using and
- refinement inheritance by module inclusion.
-
-Tue Jul 2 17:22:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h: add EUC-JP and Windows-31J.
-
- * re.c (rb_char_to_option_kcode): use built-in encoding indexes in
- internal.h.
-
- * internal.h: add UTF8-MAC.
-
- * dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
- internal.h.
-
- * internal.h: add UTF-{16,32} dummy encodings.
-
- * string.c (rb_str_inspect, str_scrub0): use built-in encoding indexes
- in internal.h.
-
- * internal.h: add UTF-{16,32}{BE,LE}.
-
- * io.c (io_strip_bom): use built-in encoding indexes in internal.h.
-
- * internal.h (rb_{ascii8bit,utf8,usascii}_encindex): use built-in
- encoding indexes for optimization.
-
- * encoding.c (enc_inspect, rb_locale_encindex),
- (enc_set_filesystem_encoding, rb_filesystem_encindex): use built-in
- encoding indexes directly.
-
- * encoding.c (rb_enc_set_index, rb_enc_associate_index): validate
- argument encoding index.
-
- * include/ruby/encoding.h (ENCODING_SET): use rb_enc_set_index()
- instead of setting inlined bits directly.
-
- * encoding.c (rb_enc_init): register preserved indexes.
-
- * internal.h (ruby_preserved_encindex): move from encoding.c.
-
-Tue Jul 2 11:14:36 2013 Shota Fukumori <sorah@cookpad.com>
-
- * lib/mkmf.rb (try_config): Fix to not replace $LDFLAGS with $libs
- (1.9.3 behavior) [ruby-core:55752] [Bug #8595]
-
-Tue Jul 2 00:39:59 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ipsocket.c (init_inetsock_internal): Don't try mismatched
- address family if already failed.
-
-Mon Jul 1 23:07:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * template/encdb.h.tmpl: define encoding index macros to use the index
- statically from C source.
-
-Mon Jul 1 22:57:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul2): New function.
- (rb_cstr_to_inum): Use a better algorithm to compose the result
- if input length is very long.
-
-Mon Jul 1 20:22:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * ext/bigdecimal/bigdecimal.h (RB_UNUSED_VAR, UNREACHABLE):
- import macros from ruby.h for 1.9.3.
- [Bug #8588] [ruby-core:55730]
-
- * ext/bigdecimal/bigdecimal.gemspec: Bump version to 1.2.1.
-
-Mon Jul 1 20:03:39 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ipsocket.c (init_inetsock_internal): Use an address
- family for local address which is different to the remote
- address if no other choice.
-
-Mon Jul 1 15:05:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/csv.rb (CSV#<<): use StringIO#set_encoding instead of creating
- new StringIO instance with String#force_encoding, forcing encoding
- discards the cached coderange bits and can make further operations
- very slow. [ruby-core:55714] [Bug #8585]
-
- * ext/stringio/stringio.c (strio_write): keep coderange of
- ptr->string.
-
- * string.c (rb_enc_cr_str_buf_cat, rb_str_append): consider an empty
- string 7bit-clean and should not discard cached coderange of string
- to be appended.
-
-Mon Jul 1 12:56:41 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_using_module): activate refinements in the ancestors of
- the argument module to support refinement inheritance by
- Module#include. [ruby-core:55671] [Feature #8571]
-
- * test/ruby/test_refinement.rb: related test.
-
-Mon Jul 1 12:02:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_cstr_to_inum): Skip leading zeros.
-
-Mon Jul 1 00:59:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (nlz16): New function.
- (nlz32): Ditto.
- (nlz64): Ditto.
- (nlz128): Ditto.
- (nlz): Redefined using an above function.
- (bitsize): New macro.
- (rb_cstr_to_inum): Use bitsize instead of nlz.
-
-Sun Jun 30 22:40:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * lib/prime.rb: Corrected a few comments. Patch by @Nullset14.
- Fixes GH-346.
-
-Sun Jun 30 21:53:38 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_cstr_to_inum): Use rb_integer_unpack if base is a power
- of 2.
-
-Sun Jun 30 10:59:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (join_argv): use backslash instead of slash in program
- path, otherwise cannot invoke "./c\u{1ee7}a.exe" for some reason.
- [ruby-core:24309] [Bug #1771]
-
- * io.c (spawnv, spawn): use UTF-8 spawn family. [Bug #1771]
-
- * process.c (proc_exec_sh, proc_spawn_cmd, proc_spawn_sh): ditto.
-
- * win32/win32.c (translate_char, join_argv, has_redirection): make
- codepage aware.
-
- * win32/win32.c (rb_w32_udln_find_exe_r, rb_w32_udln_find_file_r):
- codepage independent versions.
-
- * win32/win32.c (w32_spawn): extract codepage aware code from
- rb_w32_spawn().
-
- * win32/win32.c (rb_w32_uspawn): add UTF-8 version function.
-
- * win32/win32.c (w32_aspawn_flags): extract codepage aware code from
- rb_w32_aspawn_flags().
-
- * win32/win32.c (rb_w32_uaspawn_flags, rb_w32_uaspawn_flags): add
- UTF-8 version functions.
-
- * win32/win32.c (w32_getenv): extract codepage aware code from
- rb_w32_ugetenv() and rb_w32_getenv().
-
- * win32/win32.c (w32_stati64): extract codepage aware code from
- rb_w32_ustati64() and rb_w32_stati64().
-
- * dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra
- arguments to dln_find_{exe,file}_r().
-
- * dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments.
-
- * process.c (EXPORT_STR, EXPORT_DUP): convert to default process
- encoding if defined.
-
- * process.c (check_exec_env_i): convert environment variables too.
-
- * process.c (rb_exec_fillarg): convert program path and arguments too.
-
-Sun Jun 30 01:57:08 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_rshift): Use abs2twocomp and twocomp2abs_bang.
-
-Sun Jun 30 00:14:20 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (RBIGNUM_SET_NEGATIVE_SIGN): New macro.
- (RBIGNUM_SET_POSITIVE_SIGN): Ditto.
- (rb_big_neg): Inline get2comp to avoid double negation.
-
-Sat Jun 29 23:26:41 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_neg): Extracted from bary_2comp.
- (bary_plus_one): Extracted from bary_2comp.
- (bary_2comp): Use bary_neg and bary_plus_one.
- (big_extend_carry): Extracted from get2comp.
- (get2comp): Use big_extend_carry.
- (rb_integer_unpack): Use big_extend_carry.
- (rb_big_neg): Use bary_neg.
-
-Sat Jun 29 22:31:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_2comp): Simplified.
-
-Sat Jun 29 09:33:53 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigor_int): Return -1 if y == -1.
-
-Sat Jun 29 09:07:16 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigor_int): Use RB_GC_GUARD.
- (bigxor_int): Take xn and hibitsx arguments. Use twocomp2abs_bang.
- (rb_big_xor): Use abs2twocomp and twocomp2abs_bang.
-
-Sat Jun 29 08:19:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigand_int): Don't apply bitwise and for BDIGIT and long.
- (bigor_int): Take xn and hibitsx arguments. Use twocomp2abs_bang.
- (rb_big_or): Use abs2twocomp and twocomp2abs_bang.
-
-Fri Jun 29 01:08:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * numeric.c (fix_mul): remove FIT_SQRT_LONG test as it was causing
- fix_mul to return an incorrect result for -2147483648*-2147483648
- on 64 bit platforms
-
- * test/ruby/test_integer_comb.rb (class TestIntegerComb): add test case
-
-Fri Jun 28 12:26:53 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_and): Allocate new bignum with same size to shorter
- argument if it's high bits are zero.
-
-Fri Jun 28 12:14:04 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ipsocket.c (init_inetsock_internal): Don't use local
- addresses which address family is different to remote address.
-
-Fri Jun 28 08:06:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigand_int): Add arguments, xn and hibitsx.
- Use twocomp2abs_bang.
-
-Thu Jun 27 23:58:13 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (abs2twocomp_bang): Removed.
- (abs2twocomp): Take n_ret argument to return actual length.
- (rb_big_and): Follow above change.
-
-Thu Jun 27 22:52:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (get2comp): Use bary_2comp.
- (abs2twocomp_bang): New function.
- (abs2twocomp): New function.
- (twocomp2abs_bang): New function.
- (rb_big_and): Use abs2twocomp and twocomp2abs_bang.
-
-Thu Jun 27 20:03:13 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * ext/openssl/lib/openssl/ssl.rb (verify_certificate_identity): fix
- hostname verification. Patched by nahi.
-
- * test/openssl/test_ssl.rb (test_verify_certificate_identity): test for
- above.
-
-
-Thu Jun 27 00:23:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_pow): Retry if y is a Bignum and it is
- representable as a Fixnum.
- Use rb_absint_numwords.
-
-Wed Jun 26 23:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode): fix typo.
- Fixes GH-343. Patch by @jgarber.
-
-Wed Jun 26 23:22:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (rb_enumeratorize_with_size): use strict definition
- rb_enumerator_size_func.
-
-Wed Jun 26 23:11:14 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * gc.c (is_before_sweep): Add a missing space before a parenthesis.
- * gc.c (rb_gc_force_recycle): Add a missing space around a parenthesis.
-
-Wed Jun 26 22:44:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/intern.h (rb_enumeratorize_with_size): cast for
- backward compatibility.
-
- * include/ruby/intern.h (rb_enumerator_size_func): define strict
- function declaration for rb_enumeratorize_with_size().
-
-Wed Jun 26 21:01:22 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_io.rb (TestIO#test_write_32bit_boundary): skip if
- writing a file is slow.
- [ruby-core:55541] [Bug #8519]
-
-Wed Jun 26 16:42:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb: should use expanded values for header directories
- unless extmk. patch by vo.x (Vit Ondruch) at [ruby-core:55653]
- [Bug #8115], rhbz#921650.
-
-Wed Jun 26 12:48:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigxor_int): Fix a buffer over read.
-
-Wed Jun 26 12:13:12 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigand_int): Consider negative values.
- (bigor_int): The allocated bignum should have enough size
- to store long.
- This fixes (bignum fits in a BDIGIT) | (fixnum bigger than BDIGIT)
- on platforms which SIZEOF_BDIGITS < SIZEOF_LONG,
- such as LP64 with 32bit BDIGIT (no int128).
-
-Wed Jun 26 12:08:51 2013 Tanaka Akira <akr@fsij.org>
-
- * test/socket/test_udp.rb: Close sockets explicitly.
- Don't use fixed port number.
-
-Wed Jun 26 07:27:17 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigand_int): Fix a buffer over read.
-
-Wed Jun 26 06:48:07 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigadd_int): Fix a buffer over read.
-
-Wed Jun 26 01:18:13 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (is_before_sweep): Add new helper function that check the object
- is before sweep?
- * gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot
- already ready to minor sweep.
-
-Wed Jun 26 01:17:29 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigsub_int): Fix a buffer over read.
-
-Tue Jun 25 22:45:43 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_absint_singlebit_p): Use POW2_P.
- (bary_pack): Ditto.
- (rb_big2str0): Ditto.
- (POW2_P): Moved to top.
-
-Tue Jun 25 22:28:07 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Pass
- DESTDIR via command line to override what's in MAKEFLAGS. This
- fixes an installation problem under a package building
- environment where DESTDIR is specified in the (parent) command
- line. [Fixes GH-327]
-
-Tue Jun 25 21:43:13 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2dbl): Use (BDIGIT)1 instead of 1UL.
- (bary_mul_normal): Remove a useless cast.
-
-Tue Jun 25 21:26:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix for the cases when
- the argument x is not a BigDecimal.
- This change is based on the patch made by Heesob Park and Garth Snyder.
- [Bug #6862] [ruby-core:47145]
- [Fixes GH-332] https://github.com/ruby/ruby/pull/332
-
-Tue Jun 25 20:36:31 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2ulong): "check" argument removed.
- (rb_big2ulong): Follow above change.
- (rb_big2long): Ditto.
- (rb_big_rshift): Ditto.
- (rb_big_aref): Ditto.
-
-Tue Jun 25 20:08:29 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big2ulong_pack): Use rb_integer_pack.
- (rb_big_aref): Call big2ulong with TRUE for "check" argument.
- It should be non-effective.
-
-Tue Jun 25 19:07:33 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (LSHIFTX): Revert r41611.
- The redundant expression suppresses a warning, C4293, by Visual
- Studio.
- http://ruby-mswin.cloudapp.net/vc10-x64/ruby-trunk/log/20130625T072854Z.log.html.gz#miniruby
-
-Tue Jun 25 19:03:00 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2ulong): Add a cast.
- (big2ull): Add a specialized code for SIZEOF_LONG_LONG <=
- SIZEOF_BDIGITS.
-
-Tue Jun 25 12:42:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_single_bdigit): Use "1 + ~u" instead of
- "-u" to suppress warning (C4146) by Visual Studio.
- Reported by ko1 via IRC.
-
-Tue Jun 25 12:28:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2ulong): Add code specialized for SIZEOF_LONG <=
- SIZEOF_BDIGITS.
- This prevents shift width warning from "num <<= BITSPERDIG".
-
-Tue Jun 25 12:23:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix oldgen/remembered_shady counting algorithm.
-
- * gc.c (rgengc_check_shady): increment
- `objspace->rgengc.remembered_shady_object_count' here.
-
- * gc.c (rgengc_remember): return FALSE if obj is already remembered.
-
- * gc.c (rgengc_rememberset_mark): make it void.
-
- * gc.c (gc_mark_children): fix to double counting oldgen_object_count
- at minor GC.
-
-Tue Jun 25 12:07:18 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (MSB): Removed.
- (BDIGIT_MSB): Defined using BIGRAD_HALF.
- (bary_2comp): Apply BIGLO after possible over flow of BDIGIT.
- (get2comp): Ditto.
- (bary_unpack_internal): Use BDIGIT_MSB.
- Apply BIGLO after possible over flow of BDIGIT.
- (rb_integer_unpack): Use BDIGIT_MSB.
- (calc_hbase): Use BDIGMAX.
- (big2dbl): Use BDIGMAX.
- Apply BIGLO after possible over flow of BDIGIT.
- (rb_big_neg): Apply BIGLO after possible over flow of BDIGIT.
- (biglsh_bang): Ditto.
- (bigrsh_bang): Ditto.
- (bary_divmod): Use BDIGIT_MSB.
- (bigdivrem): Ditto.
- (bigxor_int): Apply BIGLO after possible over flow of BDIGIT.
-
- * marshal.c (shortlen): Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): Use SIZEOF_BDIGITS
- instead of sizeof(BDIGIT).
-
-Tue Jun 25 11:40:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (big2ulong): suppress shorten-64-to-32 warning. BDIGIT can
- be bigger than long now.
-
- * bignum.c (LSHIFTX): remove redundant never-true expression.
-
-Tue Jun 25 00:55:54 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (typedef struct rb_objspace): Change members for monitor objects.
- * gc.c (gc_marks_test): Check all WriteBarrier Errors and track them in obj-tree.
- * gc.c (rgengc_check_shady): Ditto.
- * gc.c (gc_marks): Move 2 function calls to gc_marks_test for test initialize.
-
-Mon Jun 24 23:30:31 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_single_bdigit): Refine code to filling
- higher bits and use BIGLO.
-
-Mon Jun 24 22:26:31 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/rinda/test_rinda.rb (RingIPv6#prepare_ipv6):
- ifindex() function may not be implemented on Windows. We use another
- check for the case.
-
-Mon Jun 24 22:11:37 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_nolock):
- skip a failing test on Windows because flock() implementation is
- different from Unix.
-
-Mon Jun 24 22:06:14 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/rubygems/test_gem_installer.rb (test_install_extension_flat):
- use ruby in build directory in case ruby is not installed.
- [ruby-core:53265] [Bug #8058]
-
-Mon Jun 24 22:04:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * ext/dl/cfunc.c (rb_dlcfunc_call): fix conversion from Bignum to
- pointer. sizeof(DLSTACK_TYPE) is larger than sizeof(long) on
- Windows x64 and higher bits over sizeof(long) of DLSTACK_TYPE was
- zero even if a pointer value was over 32 bits which causes SEGV on
- DL::TestCPtr#test_to_ptr_io. Adding a cast solves the bug.
-
-Mon Jun 24 22:04:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * eval_error.c (warn_printf): use rb_vsprintf instead so ruby specific
- extensions like PRIsVALUE can be used in format strings
- * eval_error.c (error_print): use warn_print_str (alias for
- rb_write_error_str) to print a string value instead of using
- RSTRING_PTR and RSTRING_LEN manually
- * eval.c (setup_exception): use PRIsVALUE instead of %s and RSTRING_PTR
-
-Mon Jun 24 20:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * compile.c (make_name_for_block): use PRIsVALUE in format string
- instead of %s and RSTRING_PTR to protect objects from being garbage
- collected too soon
- * encoding.c (str_to_encindex): ditto
- * hash.c (rb_hash_fetch_m): ditto
- * io.c (rb_io_reopen): ditto
- * parse.y (reg_fragment_check_gen): ditto
- * parse.y (reg_compile_gen): ditto
- * parse.y (ripper_assert_Qundef): ditto
- * re.c (rb_reg_raise): ditto
- * ruby.c (set_option_encoding_once): ditto
- * vm_eval.c (rb_throw_obj): ditto
-
-Mon Jun 24 07:57:18 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (after_gc_sweep): Have to record malloc info before reset.
- * gc.c (gc_prof_timer_start): Pick out part of new record creation as gc_prof_setup_new_record.
- * gc.c (gc_prof_set_malloc_info): Move point of recording allocation size to front of mark.
-
-Mon Jun 24 02:53:09 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c: Return value in Array overview example found by @PragTob
- [Fixes GH-336] https://github.com/ruby/ruby/pull/336
-
-Mon Jun 24 02:45:51 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c (rb_ary_zip): typo by @PragTob [Fixes GH-337]
- https://github.com/ruby/ruby/pull/337
-
-Mon Jun 24 02:42:01 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * win32/README.win32: grammar typo by @blankenshipz [Fixes GH-334]
- https://github.com/ruby/ruby/pull/334
-
-Mon Jun 24 00:59:35 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BIGUP): Use LSHIFTX and avoid cast to consider the type
- of x is bigger than BDIGIT_DBL.
- (big2ulong): Use unsigned long to store the result.
- (big2ull): Use unsigned LONG_LONG to store the result.
- (bigand_int): Use long for num to avoid data loss.
- (bigor_int): Ditto.
- (bigxor_int): Ditto.
-
-Sun Jun 23 23:05:58 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h (BDIGIT): Define it only if it is not defined
- yet. This eases tests and debug.
- (SIZEOF_BDIGITS): Ditto.
- (BDIGIT_DBL): Ditto.
- (BDIGIT_DBL_SIGNED): Ditto.
- (PRI_BDIGIT_PREFIX): Ditto.
- (PRI_BDIGIT_DBL_PREFIX): Ditto.
- (PRIdBDIGIT): Define it only if PRI_BDIGIT_PREFIX is defined.
- (PRIiBDIGIT): Ditto.
- (PRIoBDIGIT): Ditto.
- (PRIuBDIGIT): Ditto.
- (PRIxBDIGIT): Ditto.
- (PRIXBDIGIT): Ditto.
- (PRIdBDIGIT_DBL): Ditto.
- (PRIiBDIGIT_DBL): Ditto.
- (PRIoBDIGIT_DBL): Ditto.
- (PRIuBDIGIT_DBL): Ditto.
- (PRIxBDIGIT_DBL): Ditto.
- (PRIXBDIGIT_DBL): Ditto.
-
- * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Define it only if it is
- not defined yet.
-
-Sun Jun 23 17:29:51 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_single_bdigit): Use a cast.
-
-Sun Jun 23 15:38:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * bootstraptest/test_thread.rb: rescue resource limitation errors.
-
-Sun Jun 23 08:19:27 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_single_bdigit): Extracted from
- bary_unpack_internal.
-
-Sun Jun 23 07:41:52 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_unpack_internal): Suppress warnings (C4146) on Visual Studio.
- Reported by ko1 via IRC.
-
-Sun Jun 23 06:49:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h, gc.c: rename macros and functions:
- OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(),
- rb_obj_wb_giveup() -> rb_obj_wb_unprotect(),
- rb_gc_giveup_promoted_writebarrier() ->
- rb_gc_writebarrier_unprotect_promoted(),
-
- * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT().
-
-Sun Jun 23 05:41:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * class.c (rb_include_class_new), eval.c (rb_using_refinement):
- make classes/modules (who share method table) shady.
- If module `a' and `b' shares method table m_tbl and new method
- with iseq is added, then write barrier is applied only `a' or `b'.
- To avoid this issue, shade such classes/modules.
-
- * vm_method.c (rb_method_entry_make): add write barriers.
-
-Sun Jun 23 01:27:54 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bytes_zero_p): Removed.
- (bary_pack): Don't call bytes_zero_p.
-
-Sun Jun 23 00:51:29 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bytes_zero_p): Extracted from bary_pack.
- (bary_pack): Use bytes_zero_p.
-
-Sun Jun 23 00:16:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (MSB): New macro.
- (bary_unpack_internal): Use MSB.
- (bary_divmod): Ditto.
- (bigdivrem): Ditto.
-
-Sat Jun 22 23:45:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_swap): New function.
- (bary_pack): Use bary_swap.
- (bary_unpack_internal): Ditto.
-
-Sat Jun 22 23:18:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bytes_2comp): Renamed from quad_buf_complement.
- (bary_pack): Use bytes_2comp.
- (rb_quad_pack): Use rb_integer_pack.
- (rb_quad_unpack): Use rb_integer_unpack.
-
-Sat Jun 22 21:46:18 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_unpack): Don't allocate a Bignum if possible.
-
-Sat Jun 22 21:03:58 2013 Tanaka Akira <akr@fsij.org>
-
- * pack.c (pack_unpack): Remove specialized unpackers for integers.
-
-Sat Jun 22 20:36:50 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_unpack_internal): Specialized unpacker implemented.
- (bary_unpack): Support INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION.
- (rb_integer_unpack): Support INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION.
-
-Sat Jun 22 18:53:10 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_pack): Support
- INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION flag.
- Fix byte order and word order handling in code specialized for
- wordsize % SIZEOF_BDIGITS == 0.
-
- * internal.h (INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION): Defined.
-
-Sat Jun 22 15:41:25 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_check_shady): add new WB miss checking
- on RGENGC_CHECK_MODE >= 2.
-
- (1) Save bitmaps before marking
- (2) Run full marking
- (3) On each traceable object,
- (a) object was not oldgen (== newly or shady object) &&
- (b) parent object was oldgen &&
- (c) parent object was not remembered &&
- (d) object was not remembered
- then, it should be WB miss.
-
- This idea of this checker is by Masaya Tarui <tarui@ruby-lang.org>.
-
-Sat Jun 22 15:25:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/etc/etc.c (setup_passwd): revert r41560, unnecessary
-
-Sat Jun 22 14:39:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/etc/etc.c (Init_etc): omit 'passwd' from definition of Etc::Passwd
- if HAVE_STRUCT_PASSWD_PW_PASSWD is not defined to prevent mismatch of
- fields and values in setup_passwd
-
-Sat Jun 22 14:35:40 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/dl/cfunc.c (rb_dlcfunc_call): Use rb_big_pack instead of
- rb_big2ulong_pack and rb_big2ull.
-
- * include/ruby/intern.h (rb_big2ulong_pack): Deprecated.
-
-Sat Jun 22 14:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/etc/etc.c (setup_passwd): pass 0 as VALUE to rb_struct_new to
- prevent segfault if the compiler passes it as a 32 bit integer on
- a 64 bit ruby
-
-Sat Jun 22 13:47:13 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_pack): MEMZERO can be used even if nails is not zero.
-
-Sat Jun 22 13:43:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/etc/etc.c (etc_getpwnam): use PRIsVALUE in format string instead
- of %s and RSTRING_PTR
-
- * ext/etc/etc.c (etc_getgrnam): ditto
-
-Sat Jun 22 13:07:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (CLEAR_LOWBITS): Rewritten without RSHIFTX.
- (RSHIFTX): Removed.
-
-Sat Jun 22 10:38:03 2013 Tanaka Akira <akr@fsij.org>
-
- * pack.c (num2i32): Removed.
- (pack_pack): Don't use num2i32.
-
-Sat Jun 22 09:55:13 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (LSHIFTX): Defined to suppress a warning.
- (RSHIFTX): Ditto.
- (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX.
- (FILL_LOWBITS): Use LSHIFTX.
- Reported by ko1 via IRC.
-
-Sat Jun 22 09:11:33 2013 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/minitest/*: Imported minitest 4.7.5 (r8724)
- * test/minitest/*: ditto
-
-Sat Jun 22 07:20:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_prof_set_heap_info, after_gc_sweep): call
- gc_prof_set_heap_info() just after sweeping to calculate
- live object number correctly.
- (live object number = total generated number (before marking) -
- total freed number (after sweeping))
-
- * gc.c (gc_marks): record `oldgen_object_count' into current profile`
- record directly.
-
- * gc.c (rgengc_rememberset_mark): same for remembered_normal_objects
- and remembered_shady_objects.
-
-Sat Jun 22 06:46:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace::profile): rename rb_objspace::profile::record to
- records (because it points a set of records) and add a field
- rb_objspace::profile::current_record to point a current profiling
- record.
-
- * gc.c: use above fields.
-
-Sat Jun 22 06:05:36 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_giveup_promoted_writebarrier): remove `rest_sweep()'
- because all of remembered objects are called for gc_mark_children().
-
-Sat Jun 22 05:08:03 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_rememberset_mark): call gc_mark_children() for
- remembered objects directly instead of pushing on the mark stack.
-
-Sat Jun 22 04:48:53 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for second
- parameter `slot'. You don't need to write a cast (VALUE *) any more.
-
- * class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
- vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().
-
-Sat Jun 22 04:37:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (slot_sweep_body): rename to slot_sweep().
- No need to separate major/minor GC.
-
- * gc.c (gc_setup_mark_bits): remove gc_clear_mark_bits() and unify to
- this function.
-
-Sat Jun 22 04:20:21 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (check_bitmap_consistency): add to check flag and bitmap consistency.
- Use this function in several places.
-
-Sat Jun 22 02:18:07 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_pack): Specialized packers implemented.
- (HOST_BIGENDIAN_P): New macro.
- (ALIGNOF): New macro.
- (CLEAR_LOWBITS): New macro.
- (FILL_LOWBITS): New macro.
- (swap_bdigit): New macro.
- (bary_2comp): Returns an int.
-
- * internal.h (swap16): Moved from pack.c
- (swap32): Ditto.
- (swap64): Ditto.
-
-Fri Jun 21 21:29:49 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (typedef enum): Introduce flags of major gc reason.
- * gc.c (garbage_collect_body): Ditto.
- * gc.c (gc_profile_flags): Ditto.
- * gc.c (gc_profile_dump_on): Ditto.
-
-Fri Jun 21 21:11:53 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (allocate_sorted_heaps): remove unused variable `add'.
-
-Fri Jun 21 20:50:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: constify RArray::as::ary and RArray::heap::ptr.
- Use RARRAY_ASET() or RARRAY_PTR_USE() to modify Array objects.
-
- * array.c, gc.c: catch up above changes.
-
-Fri Jun 21 20:32:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_eval.c (eval_string_with_cref): fix WB miss.
-
-Fri Jun 21 20:15:49 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
- Introduce the following C APIs:
- * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
- The type of returned pointer is (const VALUE *).
- * RSTRUCT_GET(st, idx) returns idx-th value of struct.
- * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
- And
- * RSTRUCT_PTR(st) returns pointer with shady operation.
- The type of returned pointer is (VALUE *).
-
- * struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.
-
-Fri Jun 21 19:38:37 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BDIGMAX): Use BIGRAD.
- (BIGLO): Use BDIGMAX.
- (bigdivrem1): Ditto.
- (bigor_int): Ditto.
- (rb_big_or): Ditto.
-
-Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@fsij.org>
-
- * pack.c (pack_pack): Move the implementation for 'c' directive after
- pack_integer label.
-
-Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
-
- Note: T_MATCH object is also easy to support write barriers.
- However, most of T_MATCH objects are short-lived objects.
- So I skipped to support non-shady T_MATCH.
-
-Fri Jun 21 18:56:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigsub_int): Use bdigit_roomof.
- (bigadd_int): Ditto.
- (bigand_int): Ditto.
- (bigor_int): Ditto.
- (bigxor_int): Ditto.
-
-Fri Jun 21 17:56:25 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: fix summary of benchmark result notation.
-
-Fri Jun 21 16:38:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/openssl/ossl_x509attr.c: change OSSL_X509ATTR_IS_SINGLE and
- OSSL_X509ATTR_SET_SINGLE macros to use ->value.set rather than
- ->set to fix compile failure
-
-Fri Jun 21 15:26:45 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP is
- disabled.
-
- * gc.c (gc_marks_test): store oldgen count and shady count
- before test marking and restore them after marking.
-
-Fri Jun 21 15:07:42 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: enable lazy sweep (commit miss).
-
-Fri Jun 21 14:31:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (ruby_setenv): refine error message so include the variable
- name.
-
-Fri Jun 21 14:15:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix to use total_allocated_object_num and heaps_used
- at the GC time for profiler.
-
-Fri Jun 21 12:35:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: RGENGC_CHECK_MODE should be 0.
-
-Fri Jun 21 11:18:25 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_marks_body): fix to get `th' in this function.
-
-Fri Jun 21 10:21:44 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heaps_header/heaps_slot): embed bitmaps into heaps_slot.
- no need to maintain allocation/free bitmaps.
-
-Fri Jun 21 09:22:16 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (slot_sweep_body): add counters at a time.
-
- * gc.c (gc_profile_dump_on): fix line break position.
-
-Fri Jun 21 08:14:00 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c: refactoring bitmaps. introduce bits_t type and some Consts.
-
-Fri Jun 21 08:04:32 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix to support USE_RGENGC == 0 (disable RGenGC).
- If USE_RGENGC==0, it caused compilation error.
-
-Fri Jun 21 08:08:11 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (lazy_sweep): Use is_lazy_sweeping()
- * gc.c (rest_sweep): Ditto.
- * gc.c (gc_prepare_free_objects): Ditto.
-
-Fri Jun 21 07:34:47 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_record::oldgen_objects): added.
-
- * gc.c (gc_profile_dump_on): print the following information:
- * Living object counts
- * Free object counts
- If RGENGC_PROFILE > 0 then
- * Oldgen object counts
- * Remembered normal object counts
- * Remembered shady object counts
-
-Fri Jun 21 06:43:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_ull2big): Refactored.
- (rb_uint2big): Useless code removed.
-
-Fri Jun 21 05:37:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_prof_sweep_timer_stop): accumulate sweep time only when
- record->gc_time > 0.
-
-Fri Jun 21 00:37:31 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/bigdecimal: Workaround fix for bigdecimal test failures caused
- by [ruby-dev:47413] [Feature #8509]
-
- * ext/bigdecimal/bigdecimal.h (BDIGIT): Make it independent from the
- definition for bignum.c.
- (SIZEOF_BDIGITS): Ditto.
- (BDIGIT_DBL): Ditto.
- (BDIGIT_DBL_SIGNED): Ditto.
- (PRI_BDIGIT_PREFIX): Undefine the definition.
- (PRI_BDIGIT_DBL_PREFIX): Ditto.
-
- * ext/bigdecimal/bigdecimal.c (RBIGNUM_ZERO_P): Use rb_bigzero_p.
- (bigzero_p): Removed.
- (is_even): Use rb_big_pack.
-
-Thu Jun 20 22:52:42 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigmul1_toom3): Don't call bignorm twice.
-
-Thu Jun 20 22:49:27 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bignorm): Don't call bigtrunc if the result is a fixnum.
-
-Thu Jun 20 22:29:42 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_uint2big): Refactored.
-
-Thu Jun 20 22:24:41 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (dump_bignum): Use SIZEOF_BDIGITS.
-
-Thu Jun 20 22:22:46 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2ulong): Change the return type to unsigned long.
- (rb_big2ulong_pack): Follow the above change.
- (rb_big2long): Ditto.
- (rb_big_lshift): Ditto.
- (rb_big_rshift): Ditto.
- (rb_big_aref): Ditto.
-
-Thu Jun 20 22:02:46 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_unpack_internal): Return -2 when negative overflow.
- (bary_unpack): Set the overflowed bit if an extra BDIGIT exists.
- (rb_integer_unpack): Set the overflowed bit.
-
-Thu Jun 20 21:17:19 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_rememberset_mark): record
- (1) normal objects count in remember set
- (2) shady objects count in remember set
- each GC timing.
-
- * gc.c (gc_profile_record_get): enable to access above information
- and REMOVING_OBJECTS, EMPTY_OBJECTS.
-
-Thu Jun 20 18:29:26 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: Do not use GC::Profiler::disable because
- GC::Profiler::disable prohibit to access profiling data. It should
- be spec bug.
-
- Skip GC::Profiler::report if RUBY_VERSION < '2.0.0'
-
-Thu Jun 20 17:59:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: stop GC::Profiler before output results.
- Generating GC::Profiler result under profiling causes infinite loop.
-
-Thu Jun 20 17:24:24 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/gcbench.rb: don't use __dir__ to make compatible
- with ruby 1.9.3.
-
-Thu Jun 20 16:57:19 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
- defining methods.
-
-Thu Jun 20 16:46:46 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_app_aobench.rb: added.
-
- * benchmark/gc/aobench.rb: added.
-
-Thu Jun 20 16:28:33 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_so_binary_trees.rb: disable `puts' method
- and change iteration parameter to increase execution time.
-
- * benchmark/gc/binarytree.rb: added.
-
-Thu Jun 20 16:06:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/pentomino.rb: added.
- Simply load pentomino puzzle in the benchmark/ directory.
-
-Thu Jun 20 15:32:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc/redblack.rb: import red black tree benchmark from
- https://github.com/jruby/rubybench/blob/master/time/bench_red_black.rb
-
- * benchmark/gc/ring.rb: add a benchmark. This benchmark create many
- old objects.
-
-Thu Jun 20 15:14:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/gc: create a directory to store GC related benchmark.
-
- * benchmark/gc/gcbench.rb: moved from tool/gcbench.rb.
-
- * benchmark/gc/hash(1|2).rb: ditto.
-
- * benchmark/gc/rdoc.rb: ditto.
-
- * benchmark/gc/null.rb: added.
-
- * common.mk: fix rule.
-
-Thu Jun 20 14:09:54 2013 Koichi Sasada <ko1@atdot.net>
-
- * tool/hashbench1.rb: fix parameter too. Increase temporary objects.
-
-Thu Jun 20 14:01:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * tool/hashbench1.rb: fix parameters.
-
-Thu Jun 20 14:00:34 2013 Koichi Sasada <ko1@atdot.net>
-
- * common.mk: remove dependency from ruby.
-
-Thu Jun 20 13:14:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_check_backtrace): evaluate RARRAY_AREF only once.
- the first argument of RB_TYPE_P is expanded twice for non-immediate
- types.
-
-Thu Jun 20 08:09:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * tool/gcbench.rb: Summary in one line.
-
- * common.mk: separate gcbench-hash to gcbench-hash1 and gcbench-hash2.
-
-Thu Jun 20 08:07:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BIGSIZE): New macro.
- (bigfixize): Use BIGSIZE.
- (big2ulong): Ditto.
- (check_shiftdown): Ditto.
- (rb_big_aref): Ditto.
-
-Thu Jun 20 07:46:48 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (rb_gc_writebarrier): give up rescan A and register B directly
- if A has huge number of children.
-
-Thu Jun 20 07:30:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * common.mk: add new rules `gcbench-rdoc', `gcbench-hash'.
-
- * tool/gcbench.rb: separate GC bench framework and process.
-
- * tool/hashbench1.rb, tool/hashbench2.rb: add two types GC bench.
- hashbench1: many temporal objects (GC by newobj)
- hashbench2: hash size becomes bigger and bigger (GC by malloc)
- Two benches are executed by `gcbench-hash' rule.
-
- * tool/rdocbench.rb: separated.
-
-Thu Jun 20 06:25:39 2013 Koichi Sasada <ko1@atdot.net>
-
- * tool/rdocbench.rb: add summary.
-
-Thu Jun 20 06:18:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_total_time): check objspace->profile.next_index > 0.
-
-Thu Jun 20 05:47:41 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_prof_sweep_timer_start): fix merge miss.
-
- * gc.c (GC_PROFILE_MORE_DETAIL): set it 0.
-
-Thu Jun 20 05:38:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: Accumulate sweep time to GC time.
- Now [GC time] is [mark time] + [sweep time] + [misc].
- ([GC time] >= [mark time] + [sweep time])
-
- * gc.c (gc_prof_sweep_slot_timer_start/stop): rename to
- gc_prof_sweep_timer_start/stop and locate at lazy_sweep().
-
- * gc.c (elapsed_time_from): add a utility function.
-
-Thu Jun 20 05:08:53 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_marks): fix wrong option. FALSE means major/full GC.
- It should be TRUE (minor marking).
-
-Thu Jun 20 02:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (waitpid): should not return 0 but wait until exit
- unless WNOHANG is given. waiting huge process may return while
- active, for some reason.
-
-Thu Jun 20 01:34:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bdigit_roomof): Use SIZEOF_BDIGITS.
- (bigfixize): Refine an ifdef condition.
- (rb_absint_size): Use bdigit_roomof.
- (rb_absint_singlebit_p): Ditto.
- (rb_integer_pack): Ditto.
- (integer_pack_fill_dd): Use BITSPERDIG.
- (integer_unpack_push_bits): Use BITSPERDIG, BIGLO and BIGDN.
-
-Thu Jun 20 01:07:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (MARKED_IN_BITMAP, FL_TEST2): return boolean value since always
- used as boolean value.
-
- * gc.c (MARK_IN_BITMAP, CLEAR_IN_BITMAP): evaluate bits once.
-
-Thu Jun 20 00:05:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (RVALUE_PROMOTED): fix type.
-
-Wed Jun 19 23:39:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_marks_test): rewrite checking code.
- When RGENGC_CHECK_MODE >= 2, all minor marking, run normal minor
- marking *and* major/full marking. After that, compare the results
- and shows BUG if a object living with major/full marking but dead
- with minor marking.
- After detecting bugs, print references information.
- (RGENGC_CHECK_MODE == 2, show references to dead object)
- (RGENGC_CHECK_MODE == 3, show all references)
-
-Wed Jun 19 23:51:48 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigfixize): Use rb_absint_size.
- (check_shiftdown): Ditto.
- (big2ulong): Use bdigit_roomof.
-
-Wed Jun 19 23:32:23 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (RVALUE_PROMOTED): check consistency between oldgen flag and
- oldgen bitmap if RGENGC_CHECK_MODE > 0.
-
-Wed Jun 19 23:29:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_force_recycle): clear oldgen bitmap, too.
-
-Wed Jun 19 21:02:13 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_uint2big): Consider environments BDIGIT is bigger than
- long.
- (big2ulong): Ditto.
- (rb_big_aref): Ditto.
- (rb_big_pack): Just call rb_integer_pack.
- (rb_big_unpack): Just call rb_integer_unpack.
-
-Wed Jun 19 20:51:21 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * gc.c (gc_stress_get): GC.stress can be Fixnum.
-
-Wed Jun 19 19:31:30 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (DIGSPERLONG): Don't define if BDIGIT is bigger than long.
- (DIGSPERLL): Don't define if BDIGIT is bigger than LONG_LONG
- (rb_absint_size): Consider environments BDIGIT is bigger than long.
- Use BIGLO and BIGDN.
- (rb_absint_singlebit_p): Ditto.
- (rb_integer_pack): Ditto.
- (bigsub_int): Consider environments BDIGIT is bigger than long.
- Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).
- (bigadd_int): Ditto.
- (bigand_int): Ditto.
- (bigor_int): Ditto.
- (bigxor_int): Ditto.
-
-Wed Jun 19 15:14:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h (struct rb_data_type_struct), gc.c: add
- rb_data_type_struct::flags. Now, this flags is passed
- at T_DATA object creation. You can specify FL_WB_PROTECTED
- on this flag.
-
- * iseq.c: making non-shady iseq objects.
-
- * class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
-
- * vm_core.h, iseq.h: constify fields to detect WB insertion.
-
-Wed Jun 19 15:11:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (gc_mark_children): show more info for broken object.
-
-Wed Jun 19 14:04:41 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/envutil.rb (EnvUtil#rubybin): remove unnecessary
- unless expression.
-
-Wed Jun 19 07:47:48 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect_body): use FIX2INT for ruby_gc_stress.
-
-Wed Jun 19 07:44:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace::gc_stress): int -> VALUE to store Fixnum object.
-
-Wed Jun 19 07:25:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (make_deferred): clear flags to T_ZOMBIE.
-
- * gc.c (slot_sweep_body): fix indent.
-
-Wed Jun 19 07:18:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_aref): Apply BIGLO to ~xds[i] for environment which
- BDIGIT is 16bit.
-
-Wed Jun 19 07:09:26 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_remember): fix output level.
-
- * gc.c (rgengc_rememberset_mark): fix to output clear count.
- (shady_object_count + clear_count = count of remembered objects)
-
-Wed Jun 19 07:06:21 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_remember): check T_NONE and T_ZOMBIE
- if RGENGC_CHECK_MODE > 0.
-
-Wed Jun 19 07:02:19 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (RGENGC_CHECK_MODE): add new check mode `3'.
- In this mode, show all references if there is
- a miss-corrected object.
-
-Wed Jun 19 06:31:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stress_set): add special option of GC.stress.
- `GC.stress=(flag)' accepts integer to control behavior of GC.
- See code for details. Of course, this feature is only for MRI.
-
- You can debug RGenGC (WB) using `GC.stress = 1'.
- Using this option, do minor marking at all possible places.
-
- GC::STRESS_MINOR_MARK = 1 and GC::STRESS_LAZY_SWEEP = 2
- seem good to add.
-
-Wed Jun 19 06:29:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (kwmerge_i): add WB.
-
-Wed Jun 19 06:26:49 2013 Koichi Sasada <ko1@atdot.net>
-
- * hash.c: `st_update()' also has same issue of last fix.
- write barriers at callback function are too early.
- All write barriers are executed after `st_update()'
-
-Wed Jun 19 04:33:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * variable.c (rb_const_set): fix WB miss.
-
- WBs had located before creating reference between a klass
- and constant value. It causes GC bug.
-
- # pseudo code:
- WB(klass, value); # WB and remember klass
- st_insert(klass->const_table, const_id, value);
-
- `st_insert()' can cause GC before inserting `value' and
- forget `klass' from the remember set. After that, relationship
- between `klass' and `value' are created with constant table.
- Now, `value' can be young (shady) object and `klass' can be old
- object, without remembering `klass' object.
- At the next GC, old `klass' object will be skipped and
- young (shady) `value' will be miss-collected. -> GC bug
-
- Lesson: The place of a WB is important.
-
-Tue Jun 18 22:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_method): ensure methods of type
- VM_METHOD_TYPE_ATTR_SET are called with 1 argument
-
- * test/ruby/test_module.rb
- (TestModule#test_attr_writer_with_no_arguments): add test
- [ruby-core:55543] [Bug #8540]
-
-Tue Jun 18 22:36:23 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_profile_record_flag): fix typo.
-
-Tue Jun 18 22:08:53 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/objspace/object_tracing.c: Return for ::allocation_generation
-
-Tue Jun 18 22:04:35 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/objspace/object_tracing.c: Document object_tracing methods.
-
-Tue Jun 18 21:58:17 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * gc.c: Rename rb_mObSpace -> rb_mObjSpace
-
-Tue Jun 18 20:55:05 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
-
-Tue Jun 18 20:39:04 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/objspace/object_tracing.c: Teach rdoc object_tracing.c [Bug #8537]
-
-Tue Jun 18 20:29:47 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/.document: add object_tracing.c to document file
-
-Tue Jun 18 20:20:27 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/objspace/objspace.c: rdoc on require to overview from r41355
-
-Tue Jun 18 18:39:58 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Check __int128.
-
- * include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available.
- (BDIGIT): Use uint64_t if uint128_t is available.
- (SIZEOF_BDIGITS): Defined for above case.
- (BDIGIT_DBL_SIGNED): Ditto.
- (PRI_BDIGIT_PREFIX): Ditto.
-
- * include/ruby/ruby.h (PRI_64_PREFIX): Defined.
-
- * bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which
- rb_big_pow returns Float or Bignum.
-
- [ruby-dev:47413] [Feature #8509]
-
-Tue Jun 18 16:43:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_heredoc_restore): clear lex_strterm always to get
- rid of marking recycled node. this bug is revealed by r41372 with
- GC.stress=true.
-
-Tue Jun 18 12:53:25 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (nlz): Cast the result explicitly.
- (big2dbl): Don't assign BDIGIT values to int variable.
-
-Tue Jun 18 12:25:16 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_xor): Non-effective code removed.
-
-Tue Jun 18 11:26:05 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): add `generated_normal_object_count_types' for
- RGENGC_PROFILE >= 2.
-
-Tue Jun 18 11:02:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_maybe): check to skip T_NONE.
-
- * gc.c (markable_object_p): do not need to check (flags == 0) here.
-
-Tue Jun 18 10:17:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * variable.c (rb_autoload): fix WB miss.
-
-Tue Jun 18 04:20:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_children): don't need to care about T_ZOMBIE here.
-
-Mon Jun 17 22:16:02 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/ruby/test_proc.rb (TestProc#test_block_given_method_to_proc):
- run test for r41359.
-
-Mon Jun 17 21:42:18 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):
- new function to invoke a method with a block passed
- as an argument.
-
- * string.c (sym_call): use the above function to avoid
- a block sharing. [ruby-dev:47438] [Bug #8531]
-
- * vm_insnhelper.c (vm_yield_with_cfunc): don't set block
- in the frame.
-
- * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc):
- run related tests.
-
-Mon Jun 17 21:33:27 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * include/ruby/intern.h, proc.c (rb_method_call_with_block):
- new function to invoke a Method object with a block passed
- as an argument.
-
- * proc.c (bmcall): use the above function to avoid a block sharing.
- [ruby-core:54626] [Bug #8341]
-
- * test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
- run related tests.
-
-Mon Jun 17 20:53:21 2013 Tanaka Akira <akr@fsij.org>
-
- * loadpath.c (RUBY_REVISION): Defined to suppress revision.h
- inclusion actually. r41352 removes the dependency.
-
-Mon Jun 17 18:15:57 2013 Benoit Daloze <eregontp@gmail.com>
-
- * ext/objspace/objspace.c: let rdoc know about objspace methods.
- Specify 'objspace' should be required. See #8537.
-
-Mon Jun 17 17:44:31 2013 Benoit Daloze <eregontp@gmail.com>
-
- * gc.c (ObjectSpace): is a module not a class.
-
- * ext/objspace/objspace.c: try to include overview in rdoc,
- see #8537.
-
-Mon Jun 17 17:38:24 2013 Benoit Daloze <eregontp@gmail.com>
-
- * gc.c: fix example of ObjectSpace.define_finalizer in overview
-
-Mon Jun 17 16:59:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/tk/tkutil/tkutil.c: use rb_sprintf(), rb_id2str(), and
- rb_intern_str() instead of rb_intern() and RSTRING_PTR() with
- RB_GC_GUARD(), to prevent temporary objects from GC.
- [ruby-core:39000] [Bug #5199]
-
-Mon Jun 17 14:27:54 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1
-
-Mon Jun 17 13:04:01 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * tool/ifchange (until): Fix the condition, although harmless in
- this case.
-
-Mon Jun 17 11:50:29 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_maybe): added. check `is_pointer_to_heap()' and
- type is not T_ZOMBIE.
-
- * gc.c: use `gc_mark_maybe()'. T_ZOMBIE objects should not be pushed
- to the mark stack.
-
-Mon Jun 17 07:56:24 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_small_lshift): Renamed from bdigs_small_lshift.
- (bary_small_rshift): Renamed from bdigs_small_rshift.
-
-Mon Jun 17 07:38:48 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (absint_numwords_bytes): Removed.
- (rb_absint_numwords): Don't call absint_numwords_bytes.
-
-Sun Jun 16 23:14:58 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (BARY_ADD): New macro.
- (BARY_SUB): Ditto.
- (BARY_MUL): Ditto.
- (BARY_DIVMOD): Ditto.
- (BARY_ZERO_P): Ditto.
- (absint_numwords_generic): Use these macros.
-
-Sun Jun 16 21:41:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_2comp): Extracted from get2comp.
- (integer_unpack_num_bdigits): Extracted from
- rb_integer_unpack_internal.
- (bary_unpack_internal): Renamed from bary_unpack and support
- INTEGER_PACK_2COMP.
- (bary_unpack): New function to validate arguments and invoke
- bary_unpack_internal.
- (rb_integer_unpack_internal): Removed.
- (rb_integer_unpack): Invoke bary_unpack_internal.
- (rb_integer_unpack_2comp): Removed.
-
- * internal.h (rb_integer_unpack_2comp): Removed.
-
- * pack.c: Follow the above change.
-
-Sun Jun 16 18:41:42 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (INTEGER_PACK_2COMP): Defined.
- (rb_integer_pack_2comp): Removed.
-
- * bignum.c (bary_pack): Support INTEGER_PACK_2COMP.
- (rb_integer_pack): Invoke bary_pack directly.
- (rb_integer_pack_2comp): Removed.
- (rb_integer_pack_internal): Ditto.
- (absint_numwords_generic): Follow the above change.
-
- * pack.c (pack_pack): Ditto.
-
- * sprintf.c (rb_str_format): Ditto.
-
-Sun Jun 16 17:48:14 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (absint_numwords_generic): rb_funcall invocations removed.
-
-Sun Jun 16 16:04:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/config_files.rb: use URI.read to allow it runs with Ruby 1.8.5.
-
-Sun Jun 16 14:32:25 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_pack) Extracted from rb_integer_pack_internal.
- (absint_numwords_generic): Use bary_pack.
-
-Sun Jun 16 11:01:57 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * NEWS (XMLRPC::Client#http): Add.
- [ruby-core:55197] [Feature #8461]
-
-Sun Jun 16 10:38:45 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_add): New function.
- (bary_zero_p): Extracted from bigzero_p.
- (absint_numwords_generic): Use bary_zero_p and bary_add.
- (bary_mul): Fix an argument for bary_mul_single.
- (bary_divmod): Use size_t for arguments.
-
-Sun Jun 16 08:55:22 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Use a BDIGIT variable to store the return
- value of bigdivrem_single.
-
-Sun Jun 16 08:43:59 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_divmod): New function.
- (absint_numwords_generic): Use bary_divmod.
- (bigdivrem_num_extra_words): Extracted from bigdivrem.
- (bigdivrem_single): Ditto.
- (bigdivrem_normal): Ditto.
- (BIGDIVREM_EXTRA_WORDS): Defined.
-
-Sun Jun 16 05:51:51 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c: Fixup around GC by MALLOC.
- Add allocate size to malloc_increase before GC
- for updating limit in after_gc_sweep.
- Reset malloc_increase into garbage_collect()
- for preventing GC again soon.
-
-Sun Jun 16 05:15:36 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c: Add some columns to more detail profile.
- new columns: Allocated size, Prepare Time, Removing Objects, Empty Objects
-
-Sun Jun 16 02:04:40 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_prof_timer_stop): Merge function codes of GC_PROFILE_MORE_DETAIL and !GC_PROFILE_MORE_DETAIL.
- * gc.c (gc_prof_mark_timer_start): Ditto.
- * gc.c (gc_prof_mark_timer_stop): Ditto.
- * gc.c (gc_prof_sweep_slot_timer_start): Ditto.
- * gc.c (gc_prof_sweep_slot_timer_stop): Ditto.
- * gc.c (gc_prof_set_malloc_info): Ditto.
- * gc.c (gc_prof_set_heap_info): Ditto.
-
-Sat Jun 15 23:50:24 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_sub): New function.
- (absint_numwords_generic): Use bary_sub.
- (bigsub_core): Skip unnecessary copy.
-
-Sat Jun 15 22:05:30 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul): New function.
- (absint_numwords_generic): Use bary_mul.
- (bary_mul_single): Extracted from bigmul1_single.
- (bary_mul_normal): Extracted from bigmul1_normal.
-
-Sat Jun 15 20:13:46 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_unpack): Extracted from rb_integer_unpack_internal.
- (absint_numwords_generic): Use bary_unpack.
- (roomof): Defined.
- (bdigit_roomof): Defined.
- (BARY_ARGS): Defined.
- (bary_unpack): Declared.
-
-Sat Jun 15 19:35:04 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (absint_numwords_bytes): Make it static.
- (absint_numwords_small): Ditto.
- (absint_numwords_generic): Ditto.
-
-Sat Jun 15 17:14:32 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigmul1_normal): Shrink the result Bignum length.
-
-Sat Jun 15 10:19:42 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/bigdecimal/bigdecimal.c: Update overview formatting of headers
-
-Sat Jun 15 10:19:06 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/bigdecimal/bigdecimal.gemspec: Update authors
-
-Sat Jun 15 10:02:26 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bdigs_small_rshift): Extracted from big_rshift.
- (bigdivrem): Use bdigs_small_rshift.
-
-Sat Jun 15 08:37:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (eval_string_with_cref): propagate absolute path from the
- binding if it is given explicitly. patch by Gat (Dawid Janczak) at
- [ruby-core:55123]. [Bug #8436]
-
-Sat Jun 15 02:40:18 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bdigs_small_lshift): Extracted from big_lshift.
- (bigdivrem): Use bdigs_small_lshift.
-
-Fri Jun 14 20:47:41 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Reduce number of digits before bignew() for div.
-
-Fri Jun 14 20:12:37 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Use bignew when ny == 1.
-
-Fri Jun 14 18:52:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (rb_iseq_compile_node): fix location of a `trace'
- instruction (b_return event).
- [ruby-core:55305] [ruby-trunk - Bug #8489]
- (need a backport to 2.0.0?)
-
- * test/ruby/test_settracefunc.rb: add a test.
-
-Fri Jun 14 18:18:07 2013 Koichi Sasada <ko1@atdot.net>
-
- * class.c, include/ruby/ruby.h: add write barriers for T_CLASS,
- T_MODULE, T_ICLASS.
-
- * constant.h: constify rb_const_entry_t::value and file to detect
- assignment.
-
- * variable.c, internal.h (rb_st_insert_id_and_value, rb_st_copy):
- added. update table with write barrier.
-
- * method.h: constify some variables to detect assignment.
-
- * object.c (init_copy): add WBs.
-
- * variable.c: ditto.
-
- * vm_method.c (rb_add_method): ditto.
-
-Fri Jun 14 14:33:47 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * NEWS: add a note for Module#using.
-
-Fri Jun 14 13:40:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * .travis.yml (before_script): update config files.
-
- * common.mk ($(srcdir)/tool/config.{guess,sub}): use get-config_files.
-
- * tool/config_files.rb: split get-config_files.
-
- * common.mk (update-config_files): rule to download config files.
-
- * tool/config.guess, tool/config.sub: remove and download from the
- upstream.
-
- * tool/config_files.rb: download config files from GNU.
-
-Fri Jun 14 12:21:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): suppress warnings
- "left-hand operand of comma expression has no effect", on gcc 4.4.
-
-Fri Jun 14 09:48:48 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * NEWS: add notes for $SAFE.
-
- * doc/security.rdoc: remove the description of $SAFE=4.
-
-Fri Jun 14 00:14:29 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Zero test condition simplified.
-
-Thu Jun 13 23:43:11 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
-
-Thu Jun 13 23:02:14 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
- Net::HTTP. [ruby-core:55197] [Feature #8461]
- Reported by Herwin Weststrate. Thanks!!!
-
-Thu Jun 13 22:44:52 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Support
- multiple names in a response. [ruby-core:41711] [Bug #5774]
- Reported by Roman Riha. Thanks!!!
- * test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_override):
- Add a test of the above case.
-
-Thu Jun 13 22:35:50 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Use
- guard style.
-
-Thu Jun 13 22:12:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/fileutils.rb (FileUtils#rmdir): fix traversal loop, not trying
- remove same directory only.
-
-Thu Jun 13 21:30:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (opt-dir), tool/ifchange: get rid of "alternate value"
- expansion for legacy sh. [ruby-dev:47420] [Bug #8524]
-
-Thu Jun 13 21:24:09 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Refactored to use ALLOCV_N for temporary
- buffers.
-
-Thu Jun 13 18:54:11 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * bignum.c (integer_unpack_num_bdigits_generic): reorder terms (but not
- changed the intention of the expression) because VC++ reports a
- warning for it. reported by ko1 via IRC.
-
-Thu Jun 13 18:53:14 2013 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_thread.rb (test_thread_local_security): Don't create
- an unused thread.
-
-Thu Jun 13 18:34:20 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bigdivrem): Use nlz.
-
-Thu Jun 13 14:51:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): check constant safe
- level at compile time.
-
-Thu Jun 13 14:39:08 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/-ext-/test_printf.rb, test/rss/test_parser.rb,
- test/ruby/test_array.rb, test/ruby/test_hash.rb,
- test/ruby/test_m17n.rb, test/ruby/test_marshal.rb,
- test/ruby/test_object.rb, test/ruby/test_string.rb: don't use
- untrusted?, untrust, and trust to avoid warnings in case $VERBOSE is
- true.
-
-Thu Jun 13 10:47:16 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * bootstraptest/test_autoload.rb, bootstraptest/test_method.rb:
- remove tests for $SAFE=4.
-
- * lib/pp.rb: use taint instead of untrust to avoid warnings when
- $VERBOSE is set to true.
-
-Thu Jun 13 06:12:18 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_num_bdigits_small): Fix a compile error on
- clang -Werror,-Wshorten-64-to-32
- Reported by Eric Hodel. [ruby-core:55467] [Bug #8522]
-
-Thu Jun 13 05:32:13 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/socket/extconf.rb: Enable RFC 3542 IPV6 socket options for OS X
- 10.7+. [ruby-trunk - Bug #8517]
-
-Thu Jun 13 00:17:18 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_unpack_2comp): New function.
- (rb_integer_unpack_internal): Extracted from rb_integer_unpack and
- nlp_bits_ret argument added.
- (integer_unpack_num_bdigits_small): nlp_bits_ret argument added to
- return number of leading padding bits.
- (integer_unpack_num_bdigits_generic): Ditto.
-
- * internal.h (rb_integer_unpack_2comp): Declared.
-
- * pack.c (pack_unpack): Use rb_integer_unpack_2comp and
- rb_integer_unpack.
-
-Wed Jun 12 23:27:03 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (mod_using): new method Module#using, which activates
- refinements of the specified module only in the current class or
- module definition. [ruby-core:55273] [Feature #8481]
-
- * test/ruby/test_refinement.rb: related test.
-
-Wed Jun 12 22:58:48 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
- when $SAFE is set to 4. $SAFE=4 is now obsolete.
- [ruby-core:55222] [Feature #8468]
-
- * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
- Kernel#untrusted?, untrust, and trust are now deprecated.
- Their behavior is same as tainted?, taint, and untaint,
- respectively.
-
- * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
- and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
- respectively.
-
- * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
- ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
- ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
- ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
- ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
- ext/socket/socket.c, ext/socket/udpsocket.c,
- ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
- ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
- load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
- safe.c, string.c, thread.c, transcode.c, variable.c,
- vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
- $SAFE=4.
-
- * test/dl/test_dl2.rb, test/erb/test_erb.rb,
- test/readline/test_readline.rb,
- test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
- test/ruby/test_array.rb, test/ruby/test_dir.rb,
- test/ruby/test_encoding.rb, test/ruby/test_env.rb,
- test/ruby/test_eval.rb, test/ruby/test_exception.rb,
- test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
- test/ruby/test_io.rb, test/ruby/test_method.rb,
- test/ruby/test_module.rb, test/ruby/test_object.rb,
- test/ruby/test_pack.rb, test/ruby/test_rand.rb,
- test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
- test/ruby/test_struct.rb, test/ruby/test_thread.rb,
- test/ruby/test_time.rb: remove tests for $SAFE=4.
-
-Wed Jun 12 22:18:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_num_bdigits_generic): Rewritten without
- rb_funcall.
- (integer_unpack_num_bdigits_bytes): Removed.
- (rb_integer_unpack): integer_unpack_num_bdigits_bytes invocation
- removed.
-
-Wed Jun 12 20:18:03 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Extract.
-
-Wed Jun 12 18:19:41 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (validate_integer_pack_format): supported_flags argument
- added and validate given flags.
- (rb_integer_pack_internal): Specify supported_flags.
- (rb_integer_unpack): Ditto.
-
-Wed Jun 12 16:41:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_sort_bang): remove duplicated assertions.
- ARY_HEAP_PTR() implies ary not to be embedded. [ruby-dev:47419]
- [Bug #8518]
-
-Wed Jun 12 12:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_getc): fix 7bit coderange condition, check if ascii read
- data instead of read length. [ruby-core:55444] [Bug #8516]
-
-Wed Jun 12 12:35:13 2013 Tanaka Akira <akr@fsij.org>
-
- * pack.c (pack_pack): Use rb_integer_pack_2comp.
-
-Wed Jun 12 12:07:04 2013 Tanaka Akira <akr@fsij.org>
-
- * sprintf.c (rb_str_format): Fix a dynamic format string.
-
-Wed Jun 12 12:04:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_uniq_bang): must not be modified once frozen even in
- a callback method.
-
-Wed Jun 12 12:03:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_sort_bang): must not be modified once frozen even in
- a callback method.
-
-Wed Jun 12 12:00:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (FL_SET_EMBED): shared object is frozen even when get
- unshared.
-
- * array.c (rb_ary_modify): ARY_SET_CAPA needs unshared array.
-
-Wed Jun 12 07:32:01 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (rand_int): Use rb_big_uminus.
-
-Wed Jun 12 07:12:54 2013 Eric Hodel <drbrain@segment7.net>
-
- * struct.c: Improve documentation: replace "instance variable" with
- "member", recommend the use of a block to customize structs, note
- that member accessors are created, general cleanup.
-
-Wed Jun 12 06:35:01 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (INTEGER_PACK_NEGATIVE): Defined.
- (rb_integer_unpack): sign argument removed.
-
- * bignum.c (rb_integer_unpack): sign argument removed.
- Non-negative integers generated by default.
- INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers.
-
- * pack.c (pack_unpack): Follow the above change.
-
- * random.c (int_pair_to_real_inclusive): Ditto.
- (make_seed_value): Ditto.
- (mt_state): Ditto.
- (limited_big_rand): Ditto.
-
- * marshal.c (r_object0): Ditto.
-
-Wed Jun 12 00:07:46 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_simple):
- Add a test for the extracted method.
-
-Tue Jun 11 23:56:24 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/xmlrpc/test_client.rb (XMLRPC::ClientTest::Fake::HTTP#started):
- Add a missing empty line.
-
-Tue Jun 11 23:37:19 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (validate_integer_pack_format): Don't require a word order
- flag if numwords is 1 or less.
- (absint_numwords_generic): Don't specify a word order for
- rb_integer_pack.
-
- * hash.c (rb_hash): Ditto.
-
- * time.c (v2w_bignum): Ditto.
-
-Tue Jun 11 23:01:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (validate_integer_pack_format): Refine error messages.
-
-Tue Jun 11 22:25:04 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (validate_integer_pack_format): numwords argument added.
- Move a varidation from rb_integer_pack_internal and rb_integer_unpack.
- (rb_integer_pack_internal): Follow above change.
- (rb_integer_unpack): Ditto.
-
-Tue Jun 11 20:52:43 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_pack_internal): Renamed from rb_integer_pack
- and overflow_2comp argument added.
- (rb_integer_pack): Just call rb_integer_pack_internal.
- (rb_integer_pack_2comp): New function.
-
- * internal.h (rb_integer_pack_2comp): Declared.
-
- * sprintf.c (rb_str_format): Use rb_integer_pack and
- rb_integer_pack_2comp to format binary/octal/hexadecimal integers.
- (ruby_digitmap): Declared.
- (remove_sign_bits): Removed.
- (BITSPERDIG): Ditto.
- (EXTENDSIGN): Ditto.
-
-Tue Jun 11 16:15:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (ary_shrink_capa): shrink the capacity so it fits just with
- the length.
-
- * array.c (ary_make_shared): release never used elements from frozen
- array to be shared. [ruby-dev:47416] [Bug #8510]
-
-Tue Jun 11 12:49:01 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/re.rdoc: Rename to doc/regexp.rdoc
- * re.c: Update rdoc include for rename of file
-
-Tue Jun 11 07:13:13 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * eval_error.c (error_print): keep that errat is non-shady object.
- and guard errat from GC.
-
-Tue Jun 11 05:04:25 2013 Benoit Daloze <eregontp@gmail.com>
-
- * ext/racc/cparse/cparse.c: use rb_ary_entry() and
- rb_ary_subseq() instead of RARRAY_PTR.
- Based on a patch by Dirkjan Bussink. See Bug #8399.
-
-Mon Jun 10 23:51:51 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * array.c (rb_ary_new_from_values): fix a typo. pointed out by
- nagachika.
- http://d.hatena.ne.jp/nagachika/20130610/ruby_trunk_changes_41199_41220
-
-Mon Jun 10 21:51:03 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Fix indent.
-
-Mon Jun 10 21:49:43 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Add missing return
- value assignment.
-
-Mon Jun 10 20:58:11 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu
- 13.04's getaddrinfo issue with mdns4. [ruby-list:49420]
-
-Mon Jun 10 19:34:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_pack): Returns sign instead of words.
- (absint_numwords_generic): Follow the above change.
- (big2str_base_powerof2): Follow the above change.
-
- * internal.h: Ditto.
-
- * hash.c (rb_hash): Ditto.
-
- * pack.c (pack_pack): Ditto.
-
- * random.c (int_pair_to_real_inclusive): Ditto.
- (rand_init): Ditto.
- (random_load): Ditto.
- (limited_big_rand): Ditto.
-
- * time.c (v2w_bignum): Ditto.
-
-Mon Jun 10 17:20:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_remember): permit promoted object.
- (rb_gc_writebarrier -> remember)
-
-Mon Jun 10 17:14:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (RVALUE_PROMOTE): fix parameter name (`x' to `obj')
- and make it inline function (like RVALUE_PROMOTE).
-
-Mon Jun 10 16:22:50 2013 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_new_from_values): add assertion
- (ary should be young object).
-
-Mon Jun 10 16:05:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (wmap_mark): check allocation of `w->obj2wmap'.
- (no-allocation `w->obj2wmap' will be NULL pointer reference)
-
-Mon Jun 10 15:36:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_error.c (error_print): use checking functions instead of
- catching exceptions.
-
- * eval_error.c (error_print): restore errinfo for the case new
- exception raised while printing the message. [ruby-core:55365]
- [Bug #8501]
-
- * eval_error.c (error_print): reduce calling setjmp.
-
-Mon Jun 10 12:10:06 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_unpack_num_bdigits_small: Extracted from
- rb_integer_unpack.
- (integer_unpack_num_bdigits_generic): Ditto.
- (integer_unpack_num_bdigits_bytes): New function.
- (rb_integer_unpack): Use above functions.
- Return a Bignum for INTEGER_PACK_FORCE_BIGNUM even when the result
- is zero.
-
-Mon Jun 10 05:38:23 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (absint_numwords_small): New function.
- (absint_numwords_generic): Use absint_numwords_small if possible.
-
-Mon Jun 10 01:07:57 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (absint_numwords_bytes): New function.
- (absint_numwords_generic): Extracted from rb_absint_numwords.
- (rb_absint_numwords): Use absint_numwords_bytes if possible.
-
-Sun Jun 9 21:33:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_absint_numwords): Return (size_t)-1 when overflow.
- Refine variable names.
- (rb_absint_size): Refine variable names.
-
- * internal.h (rb_absint_size): Refine an argument name.
- (rb_absint_numwords): Ditto.
-
-Sun Jun 9 16:51:41 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_absint_numwords): Renamed from rb_absint_size_in_word.
-
- * internal.h (rb_absint_numwords): Follow the above change.
-
- * pack.c (pack_pack): Ditto.
-
- * random.c (rand_init): Ditto.
- (limited_big_rand): Ditto.
-
-Sun Jun 9 14:41:05 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_pack): numwords_allocated argument removed.
-
- * internal.h (rb_integer_pack): Follow the above change.
-
- * hash.c (rb_hash): Ditto.
-
- * time.c (v2w_bignum): Ditto.
-
- * pack.c (pack_pack): Ditto.
-
- * random.c (int_pair_to_real_inclusive): Ditto.
- (rand_init): Ditto.
- (random_load): Ditto.
- (limited_big_rand): Ditto.
-
-Sun Jun 9 09:34:44 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big2str_base_powerof2): New function.
- (rb_big2str0): Use big2str_base_powerof2 if base is 2, 4, 8, 16 or 32.
-
-Sun Jun 9 00:59:04 2013 Tanaka Akira <akr@fsij.org>
-
- * hash.c (rb_hash): Use rb_integer_pack to obtain least significant
- long integer.
-
-Sat Jun 8 23:56:00 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_num_to_uint): Use rb_absint_size instead of
- RBIGNUM_LEN.
-
-Sat Jun 8 22:53:45 2013 Tanaka Akira <akr@fsij.org>
-
- * marshal.c (r_object0): Use rb_integer_unpack.
-
-Sat Jun 8 22:18:57 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (v2w): Use rb_absint_size instead of RBIGNUM_LEN.
-
-Sat Jun 8 21:47:33 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (v2w_bignum): Simplified using rb_integer_pack.
- (rb_big_abs_find_maxbit): Removed.
-
-Sat Jun 8 21:03:40 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_absint_singlebit_p): New function.
-
- * internal.h (rb_absint_singlebit_p): Declared.
-
- * time.c (v2w_bignum): Use rb_absint_singlebit_p instead of
- rb_big_abs_find_minbit.
- (rb_big_abs_find_minbit): Removed.
-
-Sat Jun 8 20:24:23 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (rb_big_abs_find_maxbit): Use rb_absint_size.
- (bdigit_find_maxbit): Removed.
-
-Sat Jun 8 19:47:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * class.c (include_modules_at): invalidate method cache if included
- module contains constants
-
- * test/ruby/test_module.rb: add test
-
-Sat Jun 8 19:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * random.c (limited_big_rand): declare rnd, lim and mask as uint32_t
- to avoid 64 bit to 32 bit shorten warnings.
-
-Sat Jun 8 19:23:53 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * win32/Makefile.sub: r41163 changed win32/win32.c and configure.in
- but it didn't treat about mswin32/mswin64, so fix it.
- NOTE: this needs a review by usa whether additional condition is
- required or not.
-
-Sat Jun 8 19:06:26 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c: Unused RBignum internal accessing macros removed.
-
-Sat Jun 8 19:04:15 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (limited_big_rand): The argument, limit, is changed to
- VALUE. Use rb_integer_pack and rb_integer_unpack.
-
-Sat Jun 8 17:15:18 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (make_seed_value): Fix the length given for
- rb_integer_unpack.
-
-Sat Jun 8 16:38:02 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_unpack): Don't use rb_funcall if possible.
-
- * random.c: Use uint32_t for elements of seed.
- (make_seed_value): Use rb_integer_unpack.
-
-Sat Jun 8 15:58:18 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (rand_init): Add a cast to fix clang compile error:
- random.c:410:32: error: implicit conversion loses integer precision:
- 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
- This cast doesn't cause a problem because len is not bigger than
- MT_MAX_STATE.
-
-Sat Jun 8 15:30:03 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (rand_init): Use rb_integer_pack.
- (roomof): Removed.
-
-Sat Jun 8 14:58:32 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (INTEGER_PACK_FORCE_BIGNUM): New flag constant.
-
- * bignum.c (rb_integer_unpack): Support INTEGER_PACK_FORCE_BIGNUM.
-
- * random.c (int_pair_to_real_inclusive): Use
- INTEGER_PACK_FORCE_BIGNUM to use rb_big_mul instead of rb_funcall.
-
-Sat Jun 8 14:17:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check for NET_LUID. header macro varies across
- compiler versions.
-
- * win32/win32.c: use configured macro.
-
-Sat Jun 8 11:59:55 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (int_pair_to_real_inclusive): Use rb_funcall instead of
- rb_big_mul because rb_integer_unpack can return a Fixnum.
-
-Sat Jun 8 11:17:39 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (int_pair_to_real_inclusive): Use rb_integer_pack.
-
-Sat Jun 8 09:49:42 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (int_pair_to_real_inclusive): Use rb_integer_unpack.
-
-Sat Jun 8 08:12:22 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (random_load): Use rb_integer_pack.
-
-Sat Jun 8 06:15:46 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (numberof): Removed.
-
-Sat Jun 8 06:00:47 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c: include internal.h.
- (mt_state): Use rb_integer_unpack.
-
-Sat Jun 8 00:55:51 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_pack_loop_setup): word_num_nailbytes_ret argument
- removed.
- (rb_integer_pack): Follow the above change.
- (rb_integer_unpack): Follow the above change.
-
-Sat Jun 8 00:37:32 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (validate_integer_pack_format): Renamed from
- validate_integer_format.
- (integer_pack_loop_setup): Renamed from integer_format_loop_setup.
- (integer_pack_fill_dd): Renamed from int_export_fill_dd.
- (integer_pack_take_lowbits): Renamed from int_export_take_lowbits.
- (integer_unpack_push_bits): Renamed from int_import_push_bits.
-
-Fri Jun 7 23:58:06 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_pack): Arguments changed. Use flags to
- specify word order and byte order.
- (rb_integer_unpack): Ditto.
- (validate_integer_format): Follow the above change.
- (integer_format_loop_setup): Ditto.
-
- * pack.c: Ditto.
-
- * internal.h: Ditto.
- (INTEGER_PACK_MSWORD_FIRST): Defined.
- (INTEGER_PACK_LSWORD_FIRST): Ditto.
- (INTEGER_PACK_MSBYTE_FIRST): Ditto.
- (INTEGER_PACK_LSBYTE_FIRST): Ditto.
- (INTEGER_PACK_NATIVE_BYTE_ORDER): Ditto.
- (INTEGER_PACK_LITTLE_ENDIAN): Ditto.
- (INTEGER_PACK_BIG_ENDIAN): Ditto.
-
-Fri Jun 7 22:10:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/rubygems/specification.rb (Gem::Specification#to_yaml):
- use Gem::NoAliasYAMLTree.create instead of Gem::NoAliasYAMLTree.new
- to suppress deprecated warnings.
-
-Fri Jun 7 21:39:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_integer_pack): Renamed from rb_int_export.
- (rb_integer_unpack): Renamed from rb_int_import.
-
- * internal.h, pack.c: Follow the above change.
-
-Fri Jun 7 21:05:26 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (integer_format_loop_setup): Extracted from rb_int_export
- and rb_int_import.
-
-Fri Jun 7 19:48:38 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (validate_integer_format): Extracted from rb_int_export and
- rb_int_import.
-
-Fri Jun 7 19:23:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_absint_size): Use numberof.
- (rb_int_export): Ditto.
-
-Fri Jun 7 18:58:56 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (numberof): Gathered from various files.
-
- * array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
- load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
- error.c, ruby.c: Remove the definitions of numberof.
-
-Fri Jun 7 18:24:39 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_absint_size): Declare a variable, i, just before used
- to suppress a warning.
- (rb_int_export): Ditto.
-
-Fri Jun 7 17:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit
- 64 bit to 32 bit shortening warning
- * bignum.c (rb_int_export): ditto
- * bignum.c (int_import_push_bits): ditto
-
-Fri Jun 7 17:31:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * internal.h (RCLASS_SUPER): use descriptive variable name
- * internal.h (RCLASS_SET_SUPER): ditto
-
-Fri Jun 7 13:25:27 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json/fbuffer/fbuffer.h (fbuffer_append_str): change the place of
- RB_GC_GUARD. it should be after the object is used.
-
-Fri Jun 7 13:22:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c (before_gc_sweep): noinline can also avoid the segv instead of
- -O0 of r41084. this way is expected less slow.
-
-Fri Jun 7 11:45:42 2013 Kenta Murata <mrkn@cookpad.com>
-
- * rational.c (numeric_quo): move num_quo in numeric.c to numeric_quo
- in rational.c to refer canonicalization state for mathn support.
- [ruby-core:41575] [Bug #5736]
-
- * numeric.c (num_quo): ditto.
-
- * test/test_mathn.rb: add a test for the change at r41109.
-
-Fri Jun 7 11:41:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: revert r41106. size_t may not be unsigned
-
- * bignum.c (rb_absint_size_in_word, rb_int_export, rb_int_import): use
- NUM2SIZET() and SIZET2NUM() already defined in ruby/ruby.h.
-
-Fri Jun 7 11:28:37 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c: use oldgen bitmap as initial mark bitmap when major gc.
- so can skip oldgen bitmap check around mark & sweep.
- * gc.c (slot_sweep_body): change scan algorithm for performance:
- from object's pointer base to bitmap one.
-
-Fri Jun 7 11:25:56 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c: introduce oldgen bitmap for preparing performance tuning.
-
-Fri Jun 7 11:20:57 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (MARKED_IN_BITMAP, MARK_IN_BITMAP, CLEAR_IN_BITMAP): bring
- bitmap macros in one place, and introduce BITMAP_BIT.
-
-Fri Jun 7 11:18:35 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * array.c (ary_new): change order of allocation in order
- to remove FL_OLDGEN operation.
-
-Fri Jun 7 11:16:28 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * tool/rdocbench.rb: add gc total time information.
-
-Fri Jun 7 10:12:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: remove "Sunny" terminology.
- "Sunny" doesn't mean antonym of "Shady" (questionable, doubtful, etc).
- Instead of "Sunny", use "non-shady" or "normal".
-
-Fri Jun 7 09:29:33 2013 Kenta Murata <mrkn@cookpad.com>
-
- * bignum.c (rb_int_import): explicitly casting BDIGIT_DBL to BDIGIT
- to prevent warning.
-
-Fri Jun 7 07:29:33 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (rb_int_export): countp argument is split into
- wordcount_allocated and wordcount.
-
- * bignum.c (rb_int_export): Follow the above change.
-
- * pack.c (pack_pack): Ditto.
-
-Fri Jun 7 07:17:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * NEWS: describe a compatibility issue of Numeric#quo
- introduced at r41109.
-
-Fri Jun 7 07:15:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * NEWS: fix style.
-
-Fri Jun 7 06:48:17 2013 Benoit Daloze <eregontp@gmail.com>
-
- * numeric.c: remove unused ID id_to_r introduced in r41109.
-
-Fri Jun 7 06:15:31 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_int_import): New function.
- (int_import_push_bits): Ditto.
-
- * internal.h (rb_int_import): Declared.
-
- * pack.c (pack_unpack): Use rb_int_import for BER compressed integer.
-
-Thu Jun 6 22:24:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * numeric.c (num_quo): Use to_r method to convert the receiver to
- rational. [ruby-core:41575] [Bug #5736]
-
- * test/ruby/test_numeric.rb: add a test for the above change.
-
-Thu Jun 6 20:40:17 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Invoke RUBY_REPLACE_TYPE for size_t.
- Don't invoke RUBY_CHECK_PRINTF_PREFIX for size_t to avoid conflict
- with RUBY_REPLACE_TYPE.
-
- * internal.h (rb_absint_size): Declared.
- (rb_absint_size_in_word): Ditto.
- (rb_int_export): Ditto.
-
- * bignum.c (rb_absint_size): New function.
- (rb_absint_size_in_word): Ditto.
- (int_export_fill_dd): Ditto.
- (int_export_take_lowbits): Ditto.
- (rb_int_export): Ditto.
-
- * pack.c (pack_pack): Use rb_int_export for BER compressed integer.
-
-Thu Jun 6 19:31:33 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: fixed coding error [ruby-core:55337].
- reported by Riley Lynch.
-
-Thu Jun 6 14:16:37 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * ext/objspace/object_tracing.c: rename allocation_info to
- lookup_allocation_info. At times I confused "struct
- allocation_info" with "function allocation_info".
-
-Thu Jun 6 13:57:06 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * ext/objspace/object_tracing.c: allocation_info function isn't
- called by any other file.
-
-Thu Jun 6 09:41:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * numeric.c (num_quo): should return a Float for a Float argument.
- [ruby-dev:44710] [Bug #5515]
-
- * test/ruby/test_fixnum.rb: Add an assertion for the above change.
-
- * test/ruby/test_bignum.rb: ditto.
-
-Thu Jun 6 00:59:44 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (gc_mark): get rid of pushing useless objects.
- * gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push
- sunny old object at minor gc.
- * gc.c (gc_mark_children): move sunny old check to gc_mark().
- * gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary.
- * gc.c (rb_gc_writebarrier): ditto.
-
- change sunny old check point in order to save mark stack and
- remove unnatural rest_sweep & demote.
-
-Thu Jun 6 00:52:42 2013 Masaya Tarui <tarui@ruby-lang.org>
-
- * gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
- from object's pointer base to bitmap one.
-
-Thu Jun 6 00:30:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * win32/win32.c (NET_LUID): define it on MinGW32.
- mingw-w64 has NET_LUID but mingw32 (mingw.org) still doesn't have
- NET_LUID. reported by taco on IRC
-
-Thu Jun 6 00:05:08 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * string.c (String#b): Allow code range scan to happen later so
- ascii_only? on a result string returns the correct value.
- [ruby-core:55315] [Bug #8496]
-
-Wed Jun 5 22:40:42 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (capability_response): should ignore trailing
- spaces. Thanks, Peter Kovacs. [ruby-core:55024] [Bug #8415]
-
- * test/net/imap/test_imap_response_parser.rb: related test.
-
-Wed Jun 5 21:17:08 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (big_fdiv): Use nlz() instead of bdigbitsize().
- (bdigbitsize): Removed.
-
-Wed Jun 5 20:32:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * include/ruby/ruby.h: fix alignment in comment.
-
-Wed Jun 5 20:05:29 2013 Tanaka Akira <akr@fsij.org>
-
- * random.c (int_pair_to_real_inclusive): Add a cast to BDIGIT.
- (random_load): Fix shift width for fixnums.
- Re-implement bignum extraction without ifdefs.
-
-Wed Jun 5 15:26:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c (before_gc_sweep): don't optimize it to avoid segv on Ubuntu
- 10.04 gcc 4.4.
- http://u32.rubyci.org/~chkbuild/ruby-trunk/log/20130527T190301Z.diff.html.gz
-
-Wed Jun 5 09:46:46 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
- EACCES for Windows.
-
-Wed Jun 5 08:13:37 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_pow): Don't need to multiply SIZEOF_BDIGITS.
- Use nlz instead of bitlength_bdigit.
- (bitlength_bdigit): Removed.
-
-Wed Jun 5 07:14:18 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c (d_lite_cmp, d_lite_equal): simplified.
-
-Wed Jun 5 07:07:01 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: fixed a bug [ruby-core:55295]. reported
- by Riley Lynch.
-
-Wed Jun 5 06:44:08 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.0.3
-
- * test/rubygems: Tests for the above.
-
- * NEWS: Added RubyGems 2.0.3 note.
-
-Wed Jun 5 06:35:15 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/marshal.rdoc: Add description of Marshal format.
-
-Wed Jun 5 01:16:09 2013 Benoit Daloze <eregontp@gmail.com>
-
- * array.c (Array#+): fix documentation example.
- Patch by Logan Serman. [Fixes GH-324]
-
-Wed Jun 5 00:21:54 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/irb/lc/ja/help-message: update help messages.
- following r41028. [ruby-dev:46707] [Feature #7510]
-
-Wed Jun 5 00:09:32 2013 Tanaka Akira <akr@fsij.org>
-
- * marshal.c (r_object0): Generalize a round up expression.
- Use BDIGIT instead of int.
-
-Tue Jun 4 23:44:02 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * object.c (rb_Hash): fix docs. patched by Stefan Sch"ussler.
- [ruby-core:55299] [Bug #8487]
-
-Tue Jun 4 23:16:49 2013 Benoit Daloze <eregontp@gmail.com>
-
- * lib/irb/completion.rb: Use %w literal construction for long lists.
- Patch by Dave Goodchild. [Fixes GH-299]
-
-Tue Jun 4 23:08:42 2013 Benoit Daloze <eregontp@gmail.com>
-
- * ext/objspace/objspace.c: improve wording and remove duplicated comment.
- Based on a patch by Dave Goodchild. [Fixes GH-299]
-
-Tue Jun 4 18:41:47 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bitlength_bdigit): Fix an off-by-one error.
-
-Tue Jun 4 15:30:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): fix the number
- of figures. Patch by Vipul A M <vipulnsward@gmail.com>.
- https://github.com/ruby/ruby/pull/323 fix GH-323
-
- * test/bigdecimal/test_bigdecimal_util.rb: fix for the above change.
-
-Tue Jun 4 00:44:27 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/fileutils/test_fileutils.rb (TestFileUtils#test_mkdir): add
- EEXIST for Linux. (suggested by nurse)
-
-Mon Jun 3 23:58:19 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash.
- * test/fileutils/test_fileutils.rb: test for above.
-
-Mon Jun 3 23:47:55 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bitlength_bdigit): New function.
- (rb_big_pow): Use bitlength_bdigit instead of ffs.
-
-Mon Jun 3 23:11:19 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/fileutils.rb: fix behavior when mkdir/mkdir_p accepted "/".
- * test/fileutils/test_fileutils.rb: add test for above change.
- Patched by Mitsunori Komatsu. [GH-319]
-
-Mon Jun 3 19:02:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (is_hfs): use the file descriptor instead of a path.
-
-Mon Jun 3 07:15:17 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: removes AC_CHECK_FUNCS(readdir_r). readdir_r()
- is only used from dir.c and it doesn't need readdir_r().
- * configure.in (SIZEOF_STRUCT_DIRENT_TOO_SMALL): removed. It is
- only used for readdir_r.
- * dir.c: removes NAME_MAX_FOR_STRUCT_DIRENT. It is not right way
- to detect maximum length of path len. POSIX require to use
- fpathconf(). IOW, it might have lead to make a vulnerability
- using stack smashing. Moreover, readdir() works enough for our
- usage.
- * dir.c (READDIR): removes an implementation which uses
- readdir_r() and parenthesize in a macro body correctly.
- * dir.c (dir_read): removes IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT
- entry), it is used only for readdir_r().
- * dir.c (dir_each): ditto.
- * dir.c (glob_helper): ditto.
-
- * dir.c (READDIR): removes entry and dp argument.
- * dir.c (dir_read): adjust for the above change.
- * dir.c (dir_each): ditto.
- * dir.c (glob_helper): ditto.
-
-Mon Jun 3 03:40:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
- The code is not useless.
-
-Mon Jun 3 01:25:25 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/socket/test_sockopt.rb: change test name. follow r41037.
-
-Mon Jun 3 01:08:43 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/rinda/test_rinda.rb: rename functions introduced in r41009.
-
-Sun Jun 2 23:33:42 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * enc/trans/japanese_euc.trans, test/ruby/test_transcode.rb,
- tool/transcode-tblgen.rb: change EUC-JP-2004 to EUC-JIS-2004.
- This is follow up to changes in r41024.
-
-Sun Jun 2 22:44:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/option.c: rename functions introduced in r41009
- s/ip/ipv4/g because they are ipv4 functions.
- (there's a policy that the name "ip" is for methods which supports
- both ipv4 and ipv6)
-
-Sun Jun 2 16:15:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dln_find.c (dln_find_exe, dln_find_file): remove deprecated
- non-reentrant functions.
-
-Sun Jun 2 15:04:35 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/cgi/util.rb, lib/erb.rb: Use String#b [Feature #8394] by znz
-
-Sun Jun 2 14:10:21 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb/lc/help-message: Apply english updates for irb --help #7510
-
-Sun Jun 2 12:03:58 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143]
-
-Sun Jun 2 02:08:37 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enc/euc_jp.c: fix typo: the name of EUC-JIS-2004.
-
-Sat Jun 1 23:17:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * vm_eval.c (rb_mod_module_eval): mention in docs that arguments passed
- to the method are passed to the block
-
-Sat Jun 1 17:58:13 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#freeze, taint, untaint): Save a "self" by
- utilizing super returning self, and add tests while at it.
-
-Sat Jun 1 17:24:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_set_arguments): not a simple single argument if any
- keyword arguments exist. [ruby-core:55203] [Bug #8463]
-
- * vm_insnhelper.c (vm_yield_setup_block_args): split single parameter
- if any keyword arguments exist, and then extract keyword arguments.
- [ruby-core:55203] [Bug #8463]
-
-Sat Jun 1 11:16:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_exc_new_cstr): rename from rb_exc_new2.
-
- * error.c (rb_exc_new_str): rename from rb_exc_new3.
-
-Sat Jun 1 10:13:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_new[2-5], rb_{tainted,usascii}_str_new2),
- (rb_str_buf_new2): remove old interfaces.
-
-Sat Jun 1 08:00:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
- (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]
-
-Sat Jun 1 07:32:15 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Use BDIGIT type for hbase.
-
-Sat Jun 1 02:37:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/option.c (sockopt_s_byte): constructor of the sockopt
- whose value's is byte.
-
- * ext/socket/option.c (sockopt_byte): getter for above.
-
- * ext/socket/option.c (inspect_byte): inspect for above.
-
- * ext/socket/option.c (sockopt_s_ip_multicast_loop): constructor of
- the sockopt whose optname is IP_MULTICAST_LOOP.
-
- * ext/socket/option.c (sockopt_ip_multicast_loop): getter for above.
-
- * ext/socket/option.c (sockopt_s_ip_multicast_ttl): constructor of
- the sockopt whose optname is IP_MULTICAST_TTL.
-
- * ext/socket/option.c (sockopt_ip_multicast_ttl): getter for above.
-
- * ext/socket/option.c (sockopt_inspect): use above.
-
-Sat Jun 01 01:50:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big
- to convert a double value to a Bignum.
-
-Sat Jun 1 00:19:50 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (calc_hbase): Make hbase the maximum power of base
- representable in BDIGIT.
-
-Fri May 31 23:56:13 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (calc_hbase): Extracted from rb_big2str0.
-
-Fri May 31 23:22:24 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c: Don't hard code SIZEOF_BDIGITS for log_base(hbase).
- (big2str_orig): hbase_numdigits argument added.
- (big2str_karatsuba): Ditto.
- (rb_big2str0): Calculate hbase_numdigits.
-
-Fri May 31 17:57:21 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * process.c: Improve Process::exec documentation
-
-Fri May 31 17:26:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_funcallv): add better names of rb_funcall2.
-
- * vm_eval.c (rb_funcallv_public): ditto for rb_funcall3.
-
-Fri May 31 17:04:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_new_capa): add better names of rb_ary_new2.
-
- * array.c (rb_ary_new_from_args): ditto for rb_ary_new3.
-
- * array.c (rb_ary_new_from_values): ditto for rb_ary_new4.
-
-Fri May 31 16:35:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (HAVE_ATTRIBUTE_FUNCTION_ALIAS): define to tell if
- alias attribute is available.
-
-Fri May 31 16:03:23 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c, proc.c: s/call_seq/call-seq in rdoc. [Fixes GH-322]
-
-Fri May 31 15:56:36 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/openssl/ossl_ssl.c: Add missing paren in rdoc [Fixes GH-321]
-
-Fri May 31 11:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (set_visibility): extract from rb_mod_public(),
- rb_mod_protected() and rb_mod_private().
-
-Thu May 30 19:47:42 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * vm_insnhelper.c (vm_callee_setup_keyword_arg,
- vm_callee_setup_arg_complex): consider a hash argument for keyword
- only when the number of arguments is more than the expected
- mandatory parameters. [ruby-core:53199] [ruby-trunk - Bug #8040]
-
- * test/ruby/test_keyword.rb: update a test for above.
-
-Thu May 30 17:55:04 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * process.c: RDoc on Process.spawn
-
-Thu May 30 00:08:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_enable): rest_sweep() to finish last GC.
- Profiling record is allocated at first of marking phase.
- Enable at lazy sweeping may cause an error (SEGV).
-
-Wed May 29 10:33:27 2013 Koichi Sasada <ko1@atdot.net>
-
- * hash.c: fix WB bug.
- (1) Hash's key also needs WB.
- (2) callback parameter *key and *value of st_update() is not a
- storage of st_table itself (only local variable). So that
- OBJ_WRITE() is not suitable, especially for `!existing'.
- OBJ_WRITTEN() is used instead of OBJ_WRITE().
-
-Tue May 28 12:31:21 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/object_tracing.c: fix a bug reported at
- "[ruby-core:55182] [ruby-trunk - Bug #8456][Open] Sugfault in Ruby Head"
- Care about the case TracePoint#path #=> `nil'.
-
- * ext/objspace/object_tracing.c: add two new methods:
- * ObjectSpace.allocation_class_path(o)
- * ObjectSpace.allocation_method_id(o)
- They are not useful for Object.new because they are always
- "Class" and :new.
- To trace more useful information, we need to maintain call-tree
- using call/return hooks, which is implemented by
- ll-prof <http://sunagae.net/wiki/doku.php?id=software:llprof>
-
- * test/objspace/test_objspace.rb: add a test.
-
-Tue May 28 11:30:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): leave makefiles untouched if the content is
- not changed, to get rid of unnecessary re-linking.
-
-Tue May 28 03:11:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/gc_hook.c, ext/objspace/objspace.c: add new methods to
- hook GC invocation.
- * ObjectSpace.after_gc_start_hook=(proc)
- * ObjectSpace.after_gc_end_hook=(proc)
-
- Note that hooks are not kicked immediately. Procs are kicked
- at postponed_job.
-
- This feature is a sample of new internal event and
- rb_postponed_job API.
-
-Tue May 28 02:56:15 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): remove wrong rest_sweep().
-
-Tue May 28 02:44:23 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect_body): fix GC_ENABLE_LAZY_SWEEP condition.
-
- * gc.c (GC_NOTIFY): move debug print location and use stderr instead
- of stdout.
-
-Tue May 28 02:07:21 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_postponed_job_register_one): fix iteration bug.
-
- * ext/-test-/postponed_job/postponed_job.c,
- test/-ext-/postponed_job/test_postponed_job.rb: add a test.
-
-Tue May 28 00:34:23 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h, gc.c: add new internal event
- RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of
- after_sweep().
- Time chart with lazy sweep is:
- (1) Kick RUBY_INTERNAL_EVENT_GC_START
- (2) [gc_marks()]
- (3) [lazy_sweep()]
- (4) [... run Ruby program (mutator) with lazy_sweep() ...]
- (5) [after_sweep()]
- (6) Kick RUBY_INTERNAL_EVENT_GC_END
- (7) [... run Ruby program (mutator), and go to (1) ...]
- Time chart without lazy sweep (GC.start, etc) is:
- (1) Kick RUBY_INTERNAL_EVENT_GC_START
- (2) [gc_marks()]
- (3) [gc_sweep()]
- (4) [after_sweep()]
- (5) Kick RUBY_INTERNAL_EVENT_GC_END
- (6) [... run Ruby program (mutator), and go to (1) ...]
-
- * ext/-test-/tracepoint/tracepoint.c,
- test/-ext-/tracepoint/test_tracepoint.rb: modify a test.
-
-Tue May 28 00:18:57 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_postponed_job_flush): remove a wrong comment.
-
-Mon May 27 22:09:33 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h (RHASH_SIZE): Add a cast to suppress a
- warning, comparison between signed and unsigned integer
- expressions [-Wsign-compare], on ILP32.
-
-Mon May 27 19:25:47 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE to
- RUBY_INTERNAL_EVENT_FREEOBJ.
-
- * ext/-test-/tracepoint/tracepoint.c,
- ext/objspace/object_tracing.c,
- gc.c, vm_trace.c: catch up this change.
-
-Mon May 27 18:57:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c: support ObjectSpace.trace_object_allocations.
- Read the following test to know HOWTO.
- This feature is a sample of RUBY_INTERNAL_EVENT.
-
- * test/objspace/test_objspace.rb: add a test.
-
- * ext/objspace/object_tracing.c: ditto.
-
- * gc.c (rb_gc_count): add. This function returns GC count.
-
- * internal.h: add decl. of rb_gc_count(). Same as `GC.count'.
-
-Mon May 27 17:33:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (install_recursive): add maxdepth option.
-
- * tool/rbinstall.rb (bin-comm): limit depth of bindir and reject empty
- files. [ruby-core:55101] [Bug #8432]
-
-Mon May 27 16:16:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use
- ruby_xmalloc/xfree. It is safe during GC.
-
-Mon May 27 09:24:03 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/-ext-/postponed_job/test_postponed_job.rb: fix typo and class name.
-
-Mon May 27 09:05:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h, gc.c, vm_trace.c: add internal events.
- * RUBY_INTERNAL_EVENT_NEWOBJ: object created.
- * RUBY_INTERNAL_EVENT_FREE: object freed.
- * RUBY_INTERNAL_EVENT_GC_START: GC started.
- And rename `RUBY_EVENT_SWITCH' to `RUBY_INTERNAL_EVENT_SWITCH'.
-
- Internal events can not invoke any Ruby program because the tracing
- timing may be critical (under huge restriction).
- These events can be hooked only by C-extensions.
- We recommend to use rb_postponed_job_register() API to call Ruby
- program safely.
-
- This change is mostly written by Aman Gupta (tmm1).
- https://bugs.ruby-lang.org/issues/8107#note-12
- [Feature #8107]
-
- * include/ruby/debug.h, vm_trace.c: added two new APIs.
- * rb_tracearg_event_flag() returns rb_event_flag_t of this event.
- * rb_tracearg_object() returns created/freed object.
-
- * ext/-test-/tracepoint/extconf.rb,
- ext/-test-/tracepoint/tracepoint.c,
- test/-ext-/tracepoint/test_tracepoint.rb: add a test.
-
-Mon May 27 08:38:21 2013 Koichi Sasada <ko1@atdot.net>
-
- * ext/-test-/postponed_job/postponed_job.c: fix `init' function name.
-
-Mon May 27 06:22:41 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/debug.h, vm_trace.c: add rb_postponed_job API.
- Postponed jobs are registered with this API. Registered jobs
- are invoked at `ruby-running-safe-point' as soon as possible.
- This timing is completely same as finalizer timing.
-
- There are two APIs:
- * rb_postponed_job_register(flags, func, data): register a
- postponed job with data. flags are reserved.
- * rb_postponed_job_register_one(flags, func, data): same as
- `rb_postponed_job_register', but only one `func' job is
- registered (skip if `func' is already registered).
-
- This change is mostly written by Aman Gupta (tmm1).
- https://bugs.ruby-lang.org/issues/8107#note-15
- [Feature #8107]
-
- * gc.c: use postponed job API for finalizer.
-
- * common.mk: add dependency from vm_trace.c to debug.h.
-
- * ext/-test-/postponed_job/extconf.rb, postponed_job.c,
- test/-ext-/postponed_job/test_postponed_job.rb: add a test.
-
- * thread.c: implement postponed API.
-
- * vm_core.h: ditto.
-
-Mon May 27 02:26:02 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): collect promote_operation_count and
- types (RGENGC_PROFILE >= 2).
-
-Mon May 27 01:40:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): collect shade_operation_count,
- remembered_sunny_object_count and remembered_shady_object_count
- for each types when RGENGC_PROFILE >= 2.
- They are informative for optimization.
-
-Mon May 27 01:15:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * hash.c (rb_hash_tbl_raw), internal.h: added.
- Returns st_table without shading hash.
-
- * array.c: use rb_hash_tbl_raw() for read-only purpose.
-
- * compile.c (iseq_compile_each): ditto.
-
- * gc.c (count_objects): ditto.
-
- * insns.def: ditto.
-
- * process.c: ditto.
-
- * thread.c (clear_coverage): ditto.
-
- * vm_insnhelper.c: ditto.
-
-Mon May 27 00:31:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/make-snapshot: use ENV["AUTOCONF"] instead of directly using
- literal "autoconf".
-
-Sun May 26 21:31:46 2013 Koichi Sasada <ko1@atdot.net>
-
- * hash.c, include/ruby/ruby.h: support WB protected hash.
- * constify RHash::ifnone and make new macro RHASH_SET_IFNONE().
- * insert write barrier for st_update().
-
- * include/ruby/intern.h: declare rb_hash_set_ifnone(hash, ifnone).
-
- * marshal.c (r_object0): use RHASH_SET_IFNONE().
-
- * ext/openssl/ossl_x509name.c (Init_ossl_x509name): ditto.
-
-Sat May 25 23:22:38 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/fiddle/test_c_struct_entry.rb,
- test/fiddle/test_c_union_entity.rb,
- test/fiddle/test_cparser.rb, test/fiddle/test_func.rb,
- test/fiddle/test_handle.rb, test/fiddle/test_import.rb,
- test/fiddle/test_pointer.rb: don't run test if the system
- don't support fiddle.
-
-Sat May 25 21:29:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/pty/pty.c (get_device_once): FreeBSD 10-current and 9-stable
- added O_CLOEXEC support to posix_openpt, so assume FreeBSD 9.2 or
- later supports it.
- http://www.freebsd.org/cgi/query-pr.cgi?pr=162374
-
-Sat May 25 18:46:23 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * proc.c (rb_method_entry_min_max_arity): fix missing break in switch.
- This was introduced in r38236, which is not intentional apparently.
- This has caused no actual harm because VM_METHOD_TYPE_OPTIMIZED is
- not used except for OPTIMIZED_METHOD_TYPE_SEND, but may do in
- future. Coverity Scan found this inadequacy.
-
-Sat May 25 18:08:06 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * dir.c (bracket): fix copy-paste error. When the first and last
- characters of fnmatch range have different length, fnmatch may
- have wrongly matched a path that does not really match.
- Coverity Scan found this bug.
-
-Sat May 25 17:06:25 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (after_gc_sweep): reduce full GC timing.
-
-Sat May 25 11:28:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (set_const_visibility): return without clearing method
- cache if no arguments.
-
- * vm_method.c (set_method_visibility): ditto.
-
-Sat May 25 11:27:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (set_method_visibility): quote unprintable method name.
-
-Sat May 25 11:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_frame_callee): returns the called name of the current
- frame, not the previous frame.
-
- * eval.c (prev_frame_callee, prev_frame_func): rename and make static,
- as these are used by rb_f_method_name() and rb_f_callee_name() only.
-
- * variable.c (set_const_visibility): use the called name.
-
-Sat May 25 08:58:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_quote_unprintable): check if argument is a string.
-
-Fri May 24 19:32:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * variable.c (set_const_visibility): use rb_frame_this_func() instead
- of rb_frame_callee() for getting the name of the called method
-
- * test/ruby/test_module.rb: add test for private_constant with no args
-
-Fri May 24 18:53:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: do major/full GC when:
- * number of oldgen object is bigger than twice of
- number of oldgen object at last full GC.
- * number of remembered shady object is bigger than twice of
- number of remembered shady object at last full GC.
- * number of oldgen object and remembered shady object is bigger
- than half of total object space.
- (please fix my English!)
-
-Fri May 24 17:07:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
-
- * intern.h: remove dangling rb_class_init_copy declaration
- [ruby-core:55120] [Bug #8434]
-
-Fri May 24 16:31:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/strscan/strscan.c (strscan_aref): raise error if given
- name reference is not found.
-
-Fri May 24 15:48:18 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (after_gc_sweep, garbage_collect_body): do major GC (full GC)
- before extending heaps.
- TODO: do major GC when there are many old (promoted) objects.
-
- * gc.c (after_gc_sweep): remove TODO comments.
-
-Fri May 24 11:04:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (LIBRUBY_RPATHFLAGS): do not append -L option with
- runtime library directory if cross compiling, but only -R option.
- runtime path makes no sense on the host system. [ruby-dev:47363]
- [Bug #8443]
-
-Fri May 24 02:57:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * object.c (rb_obj_clone): should not propagate OLDGEN status.
- This propagation had caused WB miss for class.
-
-Thu May 23 17:35:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (loaded_feature_path): fix invalid read by index underflow.
- the beginning of name is also a boundary as well as just after '/'.
-
-Thu May 23 17:21:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (gc_profile_dump_on): revert r40898. ok to show the record
- accumulating while lazy_sweep().
-
-Wed May 22 16:50:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (gc_profile_dump_on): use size_t to get rid of overflow and
- show the header when next_index > 0, instead of next_index != 1.
-
-Wed May 22 15:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (setup_overlapped): check the error code in addition
- to the result of SetFilePointer() to determine if an error occurred,
- because INVALID_SET_FILE_POINTER is a valid value.
- [ruby-core:55098] [Bug #8431]
-
- * win32/win32.c (setup_overlapped, finish_overlapped): extract from
- rb_w32_read() and rb_w32_write().
-
-Wed May 22 14:19:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_prepare_free_objects, rest_sweep, lazy_sweep): fix position
- of `during_gc' setting.
-
-Wed May 22 07:36:08 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect): all GC is start from garbage_collect()
- (or garbage_collect_body()). `garbage_collect()' accept additional
- two parameters `full_mark' and `immediate_sweep'.
- If `full_mark' is TRUE, then force it full gc (major gc), otherwise,
- it depends on status of object space. Now, it will be minor gc.
- If `immediate_sweep' is TRUE, then disable lazy sweep.
- To allocate free memory, `full_mark' and `immediate_sweep' should be
- TRUE. Otherwise, they should be FALSE.
-
- * gc.c (gc_prepare_free_objects): use `garbage_collect_body()'.
-
- * gc.c (slot_sweep, before_gc_sweep, after_gc_sweep): add logging code.
-
-Tue May 21 22:47:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/strscan/strscan.c (strscan_aref): support named captures.
- patched by Konstantin Haase [ruby-core:54664] [Feature #8343]
-
-Tue May 21 21:48:44 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * test/ruby/test_dir_m17n.rb (TestDir_M17N#test_entries_compose):
- Use #each instead of #map just for iteration.
-
-Tue May 21 19:57:22 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/digest/lib/digest.rb (Digest::Class.file): Take optional
- arguments that are passed to the constructor of the digest
- class.
-
-Tue May 21 17:21:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: remove gc_profile_record::is_marked. always true.
-
-Tue May 21 17:13:40 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix to collect additional information for GC::Profiler.
- * major/minor GC
- * trigger reason of GC
-
- * gc.c (gc_profile_dump_on): change reporting format with
- added information.
-
- * gc.c (gc_profile_record_get): return added information by
- :GC_FLAGS => array.
-
-Tue May 21 16:45:31 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: GC::Profiler's sweeping time is accumulated all slot
- sweeping time. At lazy GC, GC::Profiler makes new record entry
- for each lazy_sweep(). In this change, accumulating all
- slot_sweep() time.
- And change indentation.
-
-Tue May 21 16:29:09 2013 Koichi Sasada <ko1@atdot.net>
-
- * common.mk (rdoc-bench): add a benchmark rule
- using RDoc. Generate all rdoc related files
- (same as `make rdoc') in temporary directory
- and remove them. Execution time, GC::Profiler
- and results of GC.stat are printed.
-
- * tool/rdocbench.rb: added for `rdoc-bench'.
-
-Tue May 21 16:25:05 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_profile_dump_on): `count' should be (int) because it
- can be negative number.
- And use pointer for `record' (don't copy).
-
-Tue May 21 03:11:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_each): compose HFS file names from
- UTF8-MAC. [ruby-core:48745] [Bug #7267]
-
-Tue May 21 03:08:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_separately): require envutil in the
- child process too.
-
-Tue May 21 03:07:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_conv_enc_opts): should infect.
-
-Mon May 20 22:24:45 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#delete_if, Set#keep_if): Avoid blockless call of
- proc, which is not portable to JRuby. Replace &method() with
- faster and simpler literal blocks while at it.
-
-Mon May 20 22:00:31 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/e2mmap.rb: Format of E2MM documentation
-
-Mon May 20 21:41:15 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/extmk.rb: nodoc this file
-
-Mon May 20 20:43:32 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/cmath.rb: Remove duplicate RDoc heading from overview
-
-Mon May 20 20:36:19 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/securerandom.rb: Update position of overview for RDoc
-
-Mon May 20 19:33:55 2013 Benoit Daloze <eregontp@gmail.com>
-
- * math.c: improve and fix documentation of sin, tan and log
-
-Mon May 20 19:31:49 2013 Benoit Daloze <eregontp@gmail.com>
-
- * lib/logger.rb (Logger::Application): show namespace in documentation
-
-Mon May 20 11:50:12 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/pp.rb: Revert part of r40834 and nodoc PP::ObjectMixin
- [ruby-core:55068]
-
-Mon May 20 10:40:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/webrick/htmlutils.rb (WEBrick::HTMLUtils#escape): replace HTML
- meta chars even in non-ascii string. [Bug #8425] [ruby-core:55052]
-
- * lib/webrick/httputils.rb (WEBrick::HTTPUtils#{_escape,_unescape}):
- fix %-escape encodings. [Bug #8425] [ruby-core:55052]
-
- * lib/webrick/httpservlet/filehandler.rb (set_dir_list): revert r20152
- partially and fix misuse of bytesize and regexp repetition operator.
-
-Mon May 20 08:03:51 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/profiler.rb: Document Profiler__ methods
-
-Mon May 20 08:02:13 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/tempfile.rb: nodoc Tempfile#inspect
-
-Mon May 20 07:48:24 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/stringio/stringio.c: Correct position of method rdoc
-
-Mon May 20 07:27:41 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * math.c: RDoc formatting of Math core docs with domains and codomains
- Patch by @eLobato [Fixes GH-309]
-
-Mon May 20 05:58:12 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/bigdecimal/bigdecimal.c: Formatting for BigMath [Fixes GH-306]
- Based on a patch by @eLobato.
- * ext/bigdecimal/lib/bigdecimal/math.rb: ditto
-
-Mon May 20 04:56:59 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/forwardable.rb: Forwardable examples in overview were broken
- Based on patch by @joem [Fixes GH-303] [Bug #8392]
-
-Mon May 20 03:35:26 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/optparse.rb: nodoc OptionParser::Version and SPLAT_PROC
-
-Mon May 20 03:16:52 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/pp.rb: Document PP::ObjectMixin [Fixes GH-312]
-
-Sun May 19 23:52:22 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/webrick/test_htmlutils.rb: add test for WEBrick::HTMLUtils.
-
-Sun May 19 23:12:07 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * encoding.c: document fix, change default script encoding.
- patched by @windwiny [Fixes GH-310]
-
-Sun May 19 17:29:07 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#delete_if, Set#keep_if): Add comments.
-
-Sun May 19 11:37:36 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/fiddle/extconf.rb: ignore rc version of libffi to fix build failure.
-
-Sun May 19 10:38:50 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-delete-backward-char): Use
- delete-char instead of delete-backward-char, which is an
- interactive function.
-
-Sun May 19 03:59:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (str_scrub0): added for refactoring.
-
-Sun May 19 03:48:26 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/common.rb (URI.decode_www_form): scrub string if decoded
- bytes are invalid for the encoding.
-
-Sun May 19 02:46:32 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#delete_if, Set#keep_if): Make Set#delete_if and
- Set#keep_if more space and time efficient by avoiding to_a.
-
-Sun May 19 02:33:09 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-setup-keymap): Make
- backquotes electric as well. It was listed in
- ruby-electric-expand-delimiters-list but not activated.
-
- * misc/ruby-electric.el (ruby-electric-delete-backward-char):
- Introduce electric DEL that deletes what the previous electric
- command has input.
-
- * misc/ruby-electric.el (ruby-electric-matching-char): Make
- electric quotes work again at the end of buffer.
-
-Sun May 19 01:39:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (setjmp-type): check if setjmpex() is really available.
- workaround for i686-w64-mingw32 which declares it but lacks its
- definition.
-
- * include/ruby/defines.h: include setjmpex.h only if also setjmpex()
- is available.
-
-Sat May 18 23:57:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (setjmp-type): use setjmpex() on w64-mingw32 to get rid
- of -Wclobbered warnings.
-
- * include/ruby/defines.h: include setjmpex.h here becase setjmp.h is
- included from win32.h via intrin.h, winnt.h, and so on.
-
-Sat May 18 20:28:12 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb (INTEGER2NUM): Make less comparisons.
-
-Sat May 18 20:15:28 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (str_scrub_bang): add String#scrub!. [Feature #8414]
-
-Sat May 18 16:59:52 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb (INTEGER2NUM): Renamed from INTEGER2VALUE.
-
-Sat May 18 16:57:58 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb (INTEGER2VALUE): Suppress a warning:
- comparison between signed and unsigned integer expressions
-
-Sat May 18 16:38:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): forward anonymous and first keyword
- rest argument one. [ruby-core:55033] [Bug #8416].
-
-Sat May 18 15:49:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_core.h (rb_vm_tag): move jmpbuf between tag and prev so ensure to
- be accessible.
-
-Sat May 18 11:05:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (inspect_enumerator): use VALUE instead of mere char*
- by using rb_sprintf() and rb_id2str().
-
- * enumerator.c (append_method): extract from inspect_enumerator().
-
-Sat May 18 09:00:32 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb (INTEGER2VALUE): Use LONG2FIX if possible.
-
-Sat May 18 00:38:47 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: Convert integer constants bigger than int
- correctly.
-
-Fri May 17 22:02:15 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ifaddr.c: Use unsigned LONG_LONG to represent flags
- because SunOS 5.11 (OpenIndiana) defines ifa_flags as uint64_t.
-
-Fri May 17 21:47:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * cont.c: Typo in constant MAX_MACHINE_STACK_CACHE from '..MAHINE..'
- patch by @schmurfy [Fixes GH-307]
-
-Fri May 17 19:18:24 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-matching-char): Do not put
- a closing quote when the quote typed does not start a string, as
- in $', ?\' or ?\".
-
-Fri May 17 18:06:15 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Consider error messages to find out version option of
- C compiler.
- The C compiler of Sun Studio C emits "Warning: Option -qversion
- passed to ld, if ld is invoked, ignored otherwise" and exit
- successfully.
-
-Fri May 17 17:34:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and
- msvc.
-
-Fri May 17 11:06:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_intern.h (TH_PUSH_TAG): ensure jmpbuf to be accessible before
- pushing tag to get rid of unaccessible tag by stack overflow.
-
-Thu May 16 17:15:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_eval.c (rb_catch_obj): add volatile to tag to prevent crash
- experimentally.
- http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20130515T133500Z.log.html.gz
-
-Thu May 16 16:19:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (verconf.in): no longer used.
-
- * win32/Makefile.sub (config.status): fix typo.
-
- * configure.in, template/verconf.h.in (RUBY_EXEC_PREFIX): fix for
- default prefix.
-
-Thu May 16 13:12:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/verconf.h.in: generate verconf.h from the template and
- rbconfig.rb.
-
-Thu May 16 05:47:18 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: fix syntax error.
- Thanks @spastorino! [ruby-core:55011]
-
-Thu May 16 03:05:45 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_node_newnode): use newobj_of() instead of rb_newobj().
-
-Thu May 16 02:03:39 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/depend: Add a dependency for ifaddr.o.
-
-Thu May 16 01:44:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (verconf.h): $< cannot be used in explicit rules with
- nmake.
-
- * win32/Makefile.sub (CONFIG_H): create verconf.in instead of
- verconf.h.
-
-Thu May 16 01:25:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: only emit warnings when
- -w is enabled.
-
-Wed May 15 18:58:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (newobj): rename to `newobj_of' and accept additional
- three parameters v1, v2, v3. newobj_of() do OBJSETUP() and
- fill values with v1, v2, v3.
-
- * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
- use newobj_of().
-
-Wed May 15 17:55:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_PLATFORM): move to config.h as needed by
- version.c.
-
-Wed May 15 17:04:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add an additional RGENGC_PROFILE mode (2).
- Profiling result can be check by GC.stat.
-
- * gc.c (type_name): separate from obj_type_name().
-
-Wed May 15 16:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: save configured load path values into verconf.in.
-
- * common.mk (verconf.h): create from verconf.in with shvar_to_cpp.rb.
-
- * tool/shvar_to_cpp.rb: turn shell variables into C macros.
- [Bug #7959]
-
- * loadpath.c: split load path staffs from version.c.
-
- * dmyloadpath.c: miniruby has no builtin load paths, so verconf.h is
- not needed.
-
-Wed May 15 03:56:09 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: adding backwards
- compatible YAMLTree.new method
-
-Wed May 15 02:22:16 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: Adding Psych.safe_load for loading a user
- defined, restricted subset of Ruby object types.
- * ext/psych/lib/psych/class_loader.rb: A class loader for
- encapsulating the logic for which objects are allowed to be
- deserialized.
- * ext/psych/lib/psych/deprecated.rb: Changes to use the class loader
- * ext/psych/lib/psych/exception.rb: ditto
- * ext/psych/lib/psych/json/stream.rb: ditto
- * ext/psych/lib/psych/nodes/node.rb: ditto
- * ext/psych/lib/psych/scalar_scanner.rb: ditto
- * ext/psych/lib/psych/stream.rb: ditto
- * ext/psych/lib/psych/streaming.rb: ditto
- * ext/psych/lib/psych/visitors/json_tree.rb: ditto
- * ext/psych/lib/psych/visitors/to_ruby.rb: ditto
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
- * ext/psych/psych_to_ruby.c: ditto
- * test/psych/helper.rb: ditto
- * test/psych/test_safe_load.rb: tests for restricted subset.
- * test/psych/test_scalar_scanner.rb: ditto
- * test/psych/visitors/test_to_ruby.rb: ditto
- * test/psych/visitors/test_yaml_tree.rb: ditto
-
-Wed May 15 02:06:35 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * test/psych/helper.rb: envutil is not available outside Ruby, so
- port the functions from envutil to the test helper.
-
- * test/psych/test_deprecated.rb: ditto
-
- * test/psych/test_encoding.rb: ditto
-
-Wed May 15 00:42:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * signal.c: need to include unistd.h for write(2).
- unistd.h is now included via ruby/defines.h, but should explicitly
- include here. (suggested by kosaki)
-
-Tue May 14 23:43:05 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/.document: Add ifaddr.c.
-
-Tue May 14 23:24:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/extconf.rb: check for if_nametoindex() for
- i686-w64-mingw32, and check for declarations of if_indextoname() and
- if_nametoindex().
-
- * ext/socket/ifaddr.c (ifaddr_ifindex): not-implement unless
- if_nametoindex() is available.
-
- * ext/socket/rubysocket.h: declare if_indextoname() and
- if_nametoindex() if available but not declared.
-
-Tue May 14 19:58:17 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * ext/dl/lib/dl/func.rb (DL::Function#call): check tainted when
- $SAFE > 0.
- * ext/fiddle/function.c (function_call): check tainted when $SAFE > 0.
- * test/fiddle/test_func.rb (module Fiddle): add test for above.
-
-
-Tue May 14 14:51:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/win32.h (INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX): split
- from intptr_t and uintptr_t, since VC9 defines the latter only in
- crtdefs.h.
-
-Tue May 14 12:21:28 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (NET_LUID): mingw may have NET_LUID and not defined
- _IFDEF_.
-
-Tue May 14 03:33:17 2013 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_str_new_frozen): remove debug print.
-
-Tue May 14 03:22:51 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: enable to generate write barrier protected
- arrays (T_ARRAY).
-
-Tue May 14 03:21:42 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: enable to generate write barrier protected
- strings (T_STRING).
-
-Tue May 14 03:19:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: enable to generate write barrier protected
- objects (T_OBJECT).
-
-Tue May 14 03:17:15 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: enable to generate write barrier protected
- objects for numeric types (Float, Complex, Rational, Bignum).
-
-Tue May 14 03:10:59 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: enable RGENGC (USE_RGENGC)
- but no type creates write protected (sunny) objects
- (RGENGC_WB_PROTECTED_* == 0).
-
-Tue May 14 02:47:30 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
- See this ticket about RGENGC.
-
- * gc.c: Add several flags:
- * RGENGC_DEBUG: if >0, then prints debug information.
- * RGENGC_CHECK_MODE: if >0, add assertions.
- * RGENGC_PROFILE: if >0, add profiling features.
- check GC.stat and GC::Profiler.
-
- * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
-
- * array.c: add write barriers for T_ARRAY and generate sunny objects.
-
- * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
- you want to access raw pointers. If you modify the contents which
- pointer pointed, then you need to care write barrier.
-
- * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
-
- * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
- and generate sunny objects.
-
- * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
- barriers for T_RATIONAL and generate sunny objects.
-
- * internal.h: add write barriers for RBasic::klass.
-
- * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
-
- * object.c (rb_class_allocate_instance), range.c:
- generate sunny T_OBJECT objects.
-
- * string.c: add write barriers for T_STRING and generate sunny objects.
-
- * variable.c: add write barriers for ivars.
-
- * vm_insnhelper.c (vm_setivar): ditto.
-
- * include/ruby/ruby.h, debug.c: use two flags
- FL_WB_PROTECTED and FL_OLDGEN.
-
- * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
- move flag bits.
-
-Tue May 14 01:54:48 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: remove rb_objspace_t::marked_num.
- We can use `objspace_live_num()' instead of removed `marked_num'
- if it is after `after_gc_sweep()' function call.
-
- * gc.c (after_gc_sweep): use objspace_live_num() instead of removed
- rb_objspace_t::marked_num.
-
- * gc.c (gc_mark_ptr, gc_marks): remove rb_objspace_t::marked_num code.
-
- * gc.c (gc_prepare_free_objects): do not call set_heaps_increment()
- with checking objspace->heap.marked_num. At this point, we only
- need to check availability of free-cell.
-
- * gc.c (lazy_sweep): call after_gc_sweep() if there are no sweep_able entry.
-
- * gc.c (rest_sweep, gc_prepare_free_objects): remove after_gc_sweep() call.
-
-Tue May 14 01:50:41 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: disable GC_PROFILE_MORE_DETAIL (fix last commit).
-
- * gc.c (gc_prof_set_malloc_info): fix "objspace->heap.live_num" to
- "objspace_live_num(objspace)". There is no such member variable.
-
-Tue May 14 01:25:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: refactoring GC::Profiler.
-
- * gc.c (gc_prof_sweep_timer_start/stop): removed because
- they doesn't support lazy sweep.
-
- * gc.c (gc_prof_sweep_slot_timer_start/stop): added.
- redefine `sweeping time' to accumulated time of all of
- slot_sweep().
-
- * gc.c (rb_objspace_t::profile::count): renamed to
- rb_objspace_t::profile::next_index. `counter' seems ambiguous.
- increment it when next record is acquired.
-
-Tue May 14 00:48:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: constify RRational::(num,den) and
- RComplex::(real,imag).
- Add macro to set these values:
- * RRATIONAL_SET_NUM()
- * RRATIONAL_SET_DEN()
- * RCOMPLEX_SET_REAL()
- * RCOMPLEX_SET_IMAG()
- This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
-
- TODO: API design. RRATIONAL_SET(rat,num,den) is enough?
- TODO: Setting constify variable with cast has same issue of r40691.
-
- * complex.c, rational.c: use above macros.
-
-Mon May 13 21:49:17 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Check socketpair again.
- It is required on Unix.
-
-Mon May 13 21:20:32 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (getipaddrs): use alternative interface name if
- available, because if_nametoindex() requires them.
-
-Mon May 13 20:23:24 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/ruby/win32.h (getipaddrs): [experimental]
- emulate getipaddrs(3) on Unix.
-
- * win32/Makefile.sub, configure.in (LIBS): need iphlpapi.lib for above
- function.
-
- * include/ruby/win32.h (socketpair): rb_w32_socketpair() doesn't
- substitute for any function, so use non-prefixed name.
-
- * ext/socket/extconf.rb (socketpair); follow above change.
-
-Mon May 13 20:11:06 2013 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (prepare_iseq_build): remove additional line break.
-
-Mon May 13 19:29:54 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: constify RBasic::klass and add
- RBASIC_CLASS(obj) macro which returns a class of `obj'.
- This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
-
- * object.c: add new function rb_obj_reveal().
- This function reveal internal (hidden) object by rb_obj_hide().
- Note that do not change class before and after hiding.
- Only permitted example is:
- klass = RBASIC_CLASS(obj);
- rb_obj_hide(obj);
- ....
- rb_obj_reveal(obj, klass);
-
- TODO: API design. rb_obj_reveal() should be replaced with others.
-
- TODO: modify constified variables using cast may be harmful for
- compiler's analysis and optimization.
- Any idea to prohibit inserting RBasic::klass directly?
- If rename RBasic::klass and force to use RBASIC_CLASS(obj),
- then all codes such as `RBASIC(obj)->klass' will be
- compilation error. Is it acceptable? (We have similar
- experience at Ruby 1.9,
- for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
-
- * internal.h: add some macros.
- * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
- object.
- * RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
- * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
- without write barrier (planned).
- * RCLASS_SET_SUPER(a, b) set super class of a.
-
- * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
- file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
- parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
- string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
- Use above macros and functions to access RBasic::klass.
-
- * ext/coverage/coverage.c, ext/readline/readline.c,
- ext/socket/ancdata.c, ext/socket/init.c,
- * ext/zlib/zlib.c: ditto.
-
-Mon May 13 18:44:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
- instead of using RARRAY_PTR().
-
-Mon May 13 16:53:53 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: add new utility macros to access
- Array's element.
- * RARRAY_AREF(a, i) returns i-th element of an array `a'
- * RARRAY_ASET(a, i, v) set i-th element of `a' to `v'
- This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
-
-Mon May 13 15:31:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * object.c (rb_obj_setup): added.
-
- * include/ruby/ruby.h (OBJSETUP): use rb_obj_setup() instead of
- a macro.
-
-Mon May 13 15:24:16 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_data_object_alloc): check klass only if klass is not 0.
- klass==0 means internal object.
-
-Mon May 13 14:57:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):
- use NEWOBJ_OF() instead of NEWOBJ().
-
-Mon May 13 14:51:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_obj_singleton_method): new method Kernel#singleton_method
- which returns a Method object of the singleton method.
- non-singleton method causes NameError, but not aliased or zsuper
- method, right now.
- [ruby-core:54914] [Feature #8391]
-
- * vm_method.c (rb_method_entry_at): return the method entry for id at
- klass, without ancestors.
-
- * class.c (rb_singleton_class_get): get the singleton class if exists,
- or nil.
-
-Mon May 13 10:20:59 2013 Yuki Yugui Sonoda <yugui@google.com>
-
- * ext/openssl/ossl_ssl.c: Disabled OpenSSL::SSL::SSLSocket if
- defined(OPENSSL_NO_SOCK).
-
- This fixes a linkage error on platforms which do not have socket.
- OpenSSL itself is still useful as a set of cryptographic functions
- even on such platforms.
-
-Mon May 13 10:30:04 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301]
-
-Mon May 13 10:04:22 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * random.c: Document Random::DEFAULT by @eLobato [Fixes GH-304]
-
-Sun May 12 21:12:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (OFFT2NUM): RUBY_REPLACE_TYPE also defines macro
- to convert int type to VALUE if found.
-
-Wed May 8 13:46:52 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/intern.h (rb_iv_set, rb_iv_get): removed. Because
- ruby.h has a declaration for that.
-
-Wed May 8 13:49:06 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/intern.h (rb_uint2big, rb_int2big, rb_uint2inum)
- (rb_int2inum, rb_ll2inum, rb_ull2inum): removed because ruby.h
- has a declaration for these.
-
-Sun May 12 17:52:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: removes 'ac_cv_func_fseeko=yes' form MinGW
- specific definitions.
-
-Sun May 12 17:25:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (rb_file_s_truncate): use correct type. chsize takes
- a long.
-
-Sun May 12 17:18:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * process.c: move '#define HAVE_SPAWNV 1' to win32/Makefile.sub.
- * win32/Makefile.sub: see above.
-
-Sun May 12 17:13:32 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: removes AC_CHECK_FUNCS(setitimer) because it's
- unused.
-
-Sun May 12 17:08:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: removes AC_CHECK_FUNCS(pause) because it's unused.
-
-Sun May 12 17:05:18 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.
-
-Sun May 12 17:03:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: abort if gettimeofday doesn't exist.
-
-Sun May 12 16:31:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating
- NUM2OFFT.
- * file.c (rb_file_truncate): use correct type. chsize() take
- a long.
- * include/ruby/ruby.h (NUM2OFFT): use a definition created by
- a configure script by default.
-
-Sun May 12 16:03:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: removes AC_CHECK_FUNC(fseeko, fseeko64, ftello,
- ftello64). They are not used from anywhere.
-
- * win32/win32.c (fseeko): removes.
- * win32/win32.c (rb_w32_ftello): removes.
- * include/ruby/win32.h: removes declarations of rb_w32_ftello and
- rb_w32_fseeko.
- * win32/Makefile.sub: removes '#define HAVE_FTELLO 1'.
-
-Sun May 12 15:51:47 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: remove AC_CHECK_FUNC(close). It is not used from
- anywhere.
-
-Sun May 12 15:50:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: adds comments for setjmp check.
-
-Sun May 12 15:38:09 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: move clock_gettime() check into regular place.
-
-Wed May 8 13:45:53 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: add getenv() declaration check.
- * dln_find.c: add HAVE_DECL_GETENV test.
-
-Sun May 12 15:33:18 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: sorts AC_CHECK_FUNCS()s as alphabetical order.
-
-Wed May 8 13:41:57 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * bignum.c: remove redundant decl for big_lshift() big_rshift().
-
-Sun May 12 16:06:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/rubysocket.h (rsock_inspect_sockaddr): as r40646
- check HAVE_TYPE_STRUCT_SOCKADDR_DL.
-
-Sat May 11 23:01:58 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/rubysocket.h (HAVE_TYPE_STRUCT_SOCKADDR_DL):
- MSVC has struct sockaddr_dl, but its content is broken.
- http://ruby-mswin.cloudapp.net/vc10-x64/ruby-trunk/log/20130511T103938Z.log.html.gz
-
-Sat May 11 22:07:42 2013 Tanaka Akira <akr@fsij.org>
-
- * test/rinda/test_rinda.rb: Socket.getifaddrs may returns an interface
- which #addr method returns nil for venet0 in OpenVZ.
-
-Sat May 11 21:56:34 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/raddrinfo.c (rsock_inspect_sockaddr): Add casts to
- suppress warnings.
-
-Sat May 11 17:28:51 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: New method, Socket.getifaddrs, implemented.
- [ruby-core:54777] [Feature #8368]
-
-Sat May 11 00:47:22 2013 Tanaka Akira <akr@fsij.org>
-
- * gc.h (SET_MACHINE_STACK_END): Add !defined(_ILP32) to a defining
- condition to avoid compilation error on x32.
- https://sites.google.com/site/x32abi/
-
-Fri May 10 23:56:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_peek_variable_name): treat invalid global, class,
- and instance variable names as mere strings rather than errors.
- [ruby-core:54885] [Bug #8375]
-
-Fri May 10 20:22:40 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Move library checks into "Checks for libraries." part.
-
-Fri May 10 19:32:01 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Reformat arguments of AC_CHECK_HEADERS and
- AC_CHECK_FUNCS to track modifications easily.
-
-Fri May 10 12:01:36 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Don't link librt if clock_gettime is available in
- the main C library.
- glibc 2.17 moves clock_* from librt to the main C library.
- http://sourceware.org/ml/libc-announce/2012/msg00001.html
-
-Thu May 9 22:00:35 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ancdata.c (bsock_sendmsg_internal): controls_num should
- not be negative.
-
-Thu May 9 21:09:57 2013 Tanaka Akira <akr@fsij.org>
-
- * file.c, ext/etc/etc.c, ext/socket/unixsocket.c,
- ext/openssl/ossl.h, ext/openssl/openssl_missing.c: Use
- HAVE_AGGREGATE_MEMBER instead of HAVE_ST_MEMBER.
-
-Thu May 9 20:43:41 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ancdata.c (bsock_sendmsg_internal): Always set
- controls_num to raise NotImplementedError appropriately.
- (bsock_recvmsg_internal): Raise NotImplementedError if
- :scm_rights=>true is given on platforms which don't have
- 4.4BSD style control message.
-
-Thu May 9 12:06:07 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h, ext/socket/unixsocket.c,
- ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead
- of HAVE_ST_MSG_CONTROL.
-
-Thu May 9 11:30:02 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * string.c: Add call-seq alias for String#=== [Bug #8381]
-
-Thu May 9 11:14:18 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/contributing.rdoc: Add guide for contributing to CRuby
-
-Thu May 9 04:55:49 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Check socket library again. shutdown() is used in
- io.c.
-
-Thu May 9 01:52:31 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Don't check socketpair. socketpair is not used in
- ruby command itself.
-
-Thu May 9 01:05:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_mod_included_modules): should not include non-modules.
- [ruby-core:53158] [Bug #8025]
-
-Wed May 8 22:46:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_mod_included_modules): should not include the original
- module itself. [ruby-core:53158] [Bug #8025]
-
-Wed May 8 17:43:55 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (rb_io_ext_int_to_encs): ignore internal encoding if external
- encoding is ASCII-8BIT. [Bug #8342]
-
-Wed May 8 13:49:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json/generator/generator.c (isArrayOrObject): cast char to
- unsigned char. [Bug #8378]
-
-Wed May 8 13:46:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json/generator/depend: fix dependencies [Bug #8379]
-
- * ext/json/parser/depend: ditto.
-
-Wed May 8 13:07:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid
- name character. [ruby-core:54846] [Bug #8375].
-
-Wed May 8 13:06:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (ISGRAPH): add missing macro.
-
-Wed May 8 06:42:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/socket.c (socket_s_ip_address_list): fix wrongly filled
- sin6_scope_id on KAME introduced by r40593 for OpenIndiana.
- KAME uses fe80:<scope_id>::<interface id> for link-local address
- internally.
- Setting sin6_scope_id causes it leaked.
- see also comments of sockaddr_obj().
-
-Tue May 7 22:12:34 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/readline/readline.c (insert_ignore_escape): Add a cast to
- unsigned char * before dereference.
- This suppress a warning on Cygwin.
-
-Tue May 7 12:15:24 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ancdata.c (bsock_recvmsg_internal): Add a cast to
- suppress warning.
- Bionic defines socklen_t as int.
- Bionic defines msg_controllen as unsigned int (__kernel_size_t)
- instead of socklen_t as POSIX.
-
-Tue May 7 12:12:42 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ancdata.c (ancillary_inspect): Don't call
- anc_inspect_ipv6_pktinfo if !HAVE_TYPE_STRUCT_IN6_PKTINFO.
- anc_inspect_ipv6_pktinfo is not defined in the case.
-
-Tue May 7 12:10:52 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (socket_s_ip_address_list): Cast EXTRA_SPACE as
- int. This suppress a warning.
-
-Tue May 7 12:09:29 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Set close_fds false for Cygwin.
- Cygwin doesn't support fd passing.
- This enables socket extension library cross-compilable by default.
-
-Tue May 7 12:07:35 2013 Tanaka Akira <akr@fsij.org>
-
- * pack.c (swap32): Don't redefine it if it is already defined.
- Bionic defines it.
- (swap64): Ditto.
-
-Mon May 6 20:50:37 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (socket_s_ip_address_list): Fill sin6_scope_id
- if getifaddrs() returns an IPv6 link local address which
- sin6_scope_id is zero, such as on OpenIndiana SunOS 5.11.
-
-Sun May 5 18:56:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * insns.def (defined): use vm_search_superclass() like as normal super
- call. based on a patch <https://gist.github.com/wanabe/5520026> by
- wanabe.
-
- * vm_insnhelper.c (vm_search_superclass): return error but not raise
- exceptions.
-
- * vm_insnhelper.c (vm_search_super_method): check the result of
- vm_search_superclass and raise exceptions on error.
-
-Sun May 5 16:29:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * insns.def (defined): get method entry from the method top level
- frame, not block frame. [ruby-core:54769] [Bug #8367]
-
-Sun May 5 13:28:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/ruby.pc.in (Cflags): use rubyarchhdrdir for multiarch.
- [Bug #7874]
-
-Sat May 4 07:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Add note about reporting security vulns
-
-Sat May 4 04:13:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/defines.h (RUBY_ATTR_ALLOC_SIZE): New for
- attribute((alloc_size(params))).
-
- * include/ruby/defines.h (xmalloc, xmalloc2, xcalloc)
- (xrealloc, xrealloc2): Annotated by RUBY_ATTR_ALLOC_SIZE.
- * include/ruby/ruby.h (rb_alloc_tmp_buffer): ditto.
-
-Fri May 3 19:32:13 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/cgi/util.rb: All class methods modulized.
- We can use these methods like a function when "include CGI::Util".
- [Feature #8354]
-
-Fri May 3 14:09:45 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Make default_ipv6 true for Cygwin.
- Cygwin supports IPv6 since Cygwin 1.7.1 (2009-12).
- http://cygwin.com/ml/cygwin-announce/2009-12/msg00027.html
-
-Fri May 3 13:35:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/{getaddrinfo,getnameinfo}.c: define socklen_t if not
- defined, e.g., older VC.
-
-Fri May 3 13:29:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/win32.h (INTPTR_MAX, INTPTR_MIN, UINTPTR_MAX): also
- should be defined when defining intptr_t and uintptr_t.
- bigdecimal.c requires the former two now.
-
-Fri May 3 13:22:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (poll_child_status): fix build error on older mingw.
-
-Fri May 3 00:15:58 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * common.mk: remove timestamps in distclean-ext realclean-ext.
-
-Thu May 2 23:23:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_obj_is_kind_of): skip prepending modules.
- [ruby-core:54742] [Bug #8357]
-
- * object.c (rb_class_inherited_p): ditto.
- [ruby-core:54736] [Bug #8357]
-
-Thu May 2 22:11:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bin/irb: remove dead code from sample/irb.rb.
-
-Thu May 2 17:32:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (copy_ivar_i): get rid of overwriting already copied
- instance variables. c.f. [Bug #8276]
-
-Thu May 2 16:55:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (id_locals): use cached ID.
-
- * vm.c (ruby_thread_init): ditto.
-
- * defs/id.def: add more predefined IDs used in core.
-
-Thu May 2 13:42:42 2013 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/minitest/*: Imported minitest 4.7.4 (r8483)
- * test/minitest/*: ditto
-
-Thu May 2 11:32:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (poll_child_status): [experimental] set the cause of
- a child's death to status if its exitcode seems to be an error.
-
- * test/ruby/test_process.rb (TestProcess#test_no_curdir): maybe now
- we can test it.
-
- * test/ruby/test_thread.rb (TestThread#test_thread_timer_and_interrupt):
- ditto.
-
-Thu May 2 11:24:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/yaml.rb: nodoc EngineManager, add History doc #8344
-
-Wed May 1 21:11:17 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (localtime_with_gmtoff_zone): musl libc may return NULL for
- tm_zone.
-
-Wed May 1 18:59:36 2013 Benoit Daloze <eregontp@gmail.com>
-
- * enum.c (Enumerable#chunk): fix grammar of error message
- for symbols beginning with an underscore [Bug #8351]
-
-Wed May 1 16:47:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/curses/extconf.rb (curses_version): try once for each tests, a
- function or a variable. fallback to variable for old SVR4.
-
-Wed May 1 16:17:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): extensions not to be installed should not
- make static libraries, but make dynamic libraries always.
-
-Wed May 1 12:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/rake/version.rb: Fix RDoc warning with :include: [Bug #8347]
-
-Wed May 1 11:40:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * defs/id.def (predefined): add "idProc".
-
- * eval.c (frame_func_id): use predefined IDs.
-
- * proc.c (mnew, mproc, mlambda): use predefined IDs.
-
- * vm.c (rb_vm_control_frame_id_and_class): ditto.
-
- * vm.c (Init_VM): ditto.
-
-Tue Apr 30 23:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/benchmark.rb: Update Benchmark results on newer CPU
-
-Tue Apr 30 12:31:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mproc, mlambda): use frozen core methods instead of plain
- global methods, so that methods cannot be overridden.
- [ruby-core:54687] [Bug #8345]
-
- * vm.c (Init_VM): define proc and lambda on the frozen core object.
-
- * include/ruby/intern.h (rb_block_lambda): add declaration instead of
- deprecated rb_f_lambda.
-
-Mon Apr 29 17:02:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.h: Bionic libc doesn't have locale.
- [Feature #8338]
-
-
-Mon Apr 29 06:58:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): no need of alloca for
- small fixed size array.
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): check overflow first,
- and use alloca for small size input.
-
-Mon Apr 29 00:40:13 2013 Benoit Daloze <eregontp@gmail.com>
-
- * lib/yaml.rb: Clarify documentation about YAML being always Psych.
- Give a tip about using Syck. See #8344.
-
-Sun Apr 28 23:34:01 2013 Benoit Daloze <eregontp@gmail.com>
-
- * lib/yaml.rb: Use another trick to define the YAML module.
- https://twitter.com/n0kada/status/328342207511801856
-
-Sun Apr 28 23:19:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/pp.rb: Update PP module overview by @geopet
-
-Sun Apr 28 22:04:37 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix buffer overflow on
- x64 Windows and memory leak when initializing with integer.
- [ruby-core:54615] [Bug #8337]
-
-Sun Apr 28 12:38:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * README.EXT: correct method name to be used. [Bug #7982]
-
- * README.EXT.ja: add notes too.
-
-Sun Apr 28 10:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: With feedback from Steve Klabnik, reverted a change to
- #untrusted? and #tainted?. Also adjusted grammar for $SAFE levels
-
-Sun Apr 28 10:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/yaml.rb: Disable setting YAML const twice [ruby-core:54642]
-
-Sun Apr 28 09:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: Documentation for taint and trust [Bug #8162]
-
-Sun Apr 28 09:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README.EXT: Copy note from r40505 for rb_sprintf() [Bug #7982]
-
-Sun Apr 28 08:28:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/curses/curses.c: Update Curses::Window example for nicer output
- Patch by Michal Suchanek [Bug #8121] [ruby-core:53520]
-
-Sun Apr 28 08:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README.EXT: Update note from r40504, by Jeremy Evans [Bug #7982]
-
-Sun Apr 28 08:02:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README.EXT: Add note to warn use of %i in Exceptions [Bug #7982]
-
-Sun Apr 28 02:41:05 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Fix a typo. Should check endgrent() instead of
- endgrnam().
-
-Sun Apr 28 00:35:45 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (obj2gid): Don't call endgrent() if not exist.
- Bionic (Android's libc) don't have endgrent().
-
- * configure.in: Check endgrnam function.
-
-Sat Apr 27 23:53:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * lib/yaml.rb: add security warning to YAML documentation
-
-Sat Apr 27 23:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/yaml.rb: Documentation for YAML module [Bug #8213]
-
-Sat Apr 27 20:19:21 2013 Tanaka Akira <akr@fsij.org>
-
- * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
- This fixes a compilation failure while cross-compiling for Tensilica
- Xtensa Processor.
-
-Sat Apr 27 19:32:44 2013 Benoit Daloze <eregontp@gmail.com>
-
- * thread.c: fix typos and documentation
-
-Sat Apr 27 19:04:55 2013 Tanaka Akira <akr@fsij.org>
-
- * sparc.c: Use __asm__ instead of asm for gcc.
- gcc doesn't provide asm keyword if -ansi option is given.
- http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
-
-Sat Apr 27 17:22:50 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Redundant test removed.
-
-Sat Apr 27 16:00:10 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb (test_recvmsg_with_msg_peek_creates_fds):
- Extracted.
-
-Sat Apr 27 15:50:40 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (SIGNED_INTEGER_TYPE_P): New macro.
- (SIGNED_INTEGER_MAX): Ditto.
- (SIGNED_INTEGER_MIN): Ditto.
- (UNSIGNED_INTEGER_MAX): Ditto.
- (TIMET_MAX): Use SIGNED_INTEGER_MAX and UNSIGNED_INTEGER_MAX.
- (TIMET_MIN): Use SIGNED_INTEGER_MIN.
-
- * thread.c (TIMEVAL_SEC_MAX): Use SIGNED_INTEGER_MAX.
- (TIMEVAL_SEC_MIN): Use SIGNED_INTEGER_MIN.
-
-Sat Apr 27 10:52:52 2013 Tanaka Akira <akr@fsij.org>
-
- * thread.c (TIMEVAL_SEC_MAX, TIMEVAL_SEC_MIN): Consider environments,
- sizeof(time_t) is smaller than sizeof(tv_sec), such as
- OpenBSD 5.2 (amd64).
-
-Fri Apr 26 23:34:59 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/text.rb (REXML::Text.normalize): Fix a bug that all
- entity filters are ignored. [ruby-dev:47278] [Bug #8302]
- Patch by Ippei Obayashi. Thanks!!!
- * test/rexml/test_entity.rb (EntityTester#test_entity_filter): Add
- a test of the above change.
-
-Fri Apr 26 22:53:55 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/element.rb (REXML::Attributes#to_a): Support
- namespaced attributes. [ruby-dev:47277] [Bug #8301]
- Patch by Ippei Obayashi. Thanks!!!
- * test/rexml/test_attributes.rb
- (AttributesTester#test_to_a_with_namespaces): Add a test of the
- above change.
-
-Fri Apr 26 21:48:29 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/atom.rb (RSS::Atom::Entry): Fix indent of document comment.
-
-Fri Apr 26 21:21:17 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/maker.rb (RSS::Maker): Fix indent of document comment.
-
-Fri Apr 26 18:41:04 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Use a block of enable_config() for
- --{enable,disable}-close-fds-by-recvmsg-with-peek configure option
-
-Fri Apr 26 18:08:08 2013 Tanaka Akira <akr@fsij.org>
-
- * dir.c (dir_set_pos): Fix a compilation error when seekdir() is not
- exist.
-
-Fri Apr 26 17:41:17 2013 Tanaka Akira <akr@fsij.org>
-
- * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
- This fixes a compilation failure while cross-compiling for ARM.
-
-Fri Apr 26 14:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/rss/atom.rb: Documentation for RSS::Atom based on a patch by
- Michael Denomy
- * lib/rss/maker.rb: Documentation for RSS::Maker also by @mdenomy
-
-Fri Apr 26 12:41:22 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: Test linkability of curses_version at first.
-
- * ext/socket/extconf.rb: Test the behavior of fd passing with MSG_PEEK
- only if recvmsg(), msg_control member, AF_UNIX and SCM_RIGHTS are
- available.
-
-Fri Apr 26 00:07:52 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * lib/rinda/ring.rb (Rinda::RingServer#initialize): accept array
- arguments of address to specify multicast interface.
-
- * lib/rinda/ring.rb (Rinda::RingServer#make_socket): add optional
- arguments for multicast interface.
-
- * test/rinda/test_rinda.rb
- (TestRingFinger#test_ring_server_ipv4_multicast,
- TestRingFinger#test_ring_server_ipv6_multicast): add tests for
- above change.
-
- * test/rinda/test_rinda.rb
- (TestRingServer#test_make_socket_ipv4_multicast,
- TestRingServer#test_make_socket_ipv6_multicast): change bound
- interface address because multicast address is not allowed on Linux
- or Windows.
- [ruby-core:53692] [Bug #8159]
-
-Thu Apr 25 23:45:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * lib/rinda/ring.rb (Rinda::RingServer#initialize): add a socket
- to @sockets in make_socket() to close sockets on shutdown even if
- make_socket() is called after initialize.
-
- * lib/rinda/ring.rb (Rinda::RingServer#make_socket): ditto.
-
-Thu Apr 25 23:39:42 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/rinda/test_rinda.rb (TupleSpaceProxyTest#test_take_bug_8215):
- use KILL on Windows since TERM doen't work and ruby process remains
- after test-all on Windows.
-
-Thu Apr 25 23:16:28 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: Implement
- --with-curses-version={function,variable} configure option for
- cross-compiling.
-
-Thu Apr 25 18:15:46 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Don't use WIDE getaddrinfo by default.
-
-Thu Apr 25 17:56:39 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Remove obsolete options: ---with-ipv6-lib and
- --with-ipv6-libdir.
-
-Thu Apr 25 17:43:49 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Implement
- --{enable,disable}-close-fds-by-recvmsg-with-peek configure option
- for cross-compiling.
- Make --{enable,disable}-wide-getaddrinfo configure option
- cross-compiling friendly.
-
-Thu Apr 25 16:11:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_ext_int_to_encs, parse_mode_enc): bom-prefixed name is
- not a real encoding name, just a fallback. so the proper conversion
- should take place even if if the internal encoding is equal to the
- bom-prefixed name, unless actual encoding is equal to the internal
- encoding. [ruby-core:54563] [Bug #8323]
-
- * io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM
- found. [ruby-core:54569]
-
-Thu Apr 25 14:35:01 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): allow Fixnum and Bignum.
- [ruby-core:53986] [Feature #8217]
-
-Thu Apr 25 14:26:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
- It gets encoding argument to specify the character encoding.
- It now allows loose percent encoded strings, but denies ;-separator.
- [ruby-core:53475] [Bug #8103]
-
- * lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
- It gets encoding argument to convert before percent encode.
- Now UTF-16 strings aren't converted to UTF-8 before percent encode
- by default.
-
-Wed Apr 25 14:26:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift
-
- * hash.c (rb_hash_shift): use st_shift if hash is not being iterated to
- delete element without iterating the whole hash.
-
- * hash.c (shift_i): remove function
-
- * include/ruby/st.h (st_shift): add st_shift function
-
- * st.c (st_shift): ditto
-
- [Bug #8312] [ruby-core:54524] Patch by funny-falcon
-
-Thu Apr 25 12:03:38 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Extract C programs as toplevel constants.
-
-Thu Apr 25 02:23:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_RM_RECURSIVE): this hack is needed by only
- autoconf 2.69 or earlier on darwin.
-
-Thu Apr 25 01:22:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/tracer.rb (get_line): simply read by File.readlines.
-
- * lib/debug.rb (script_lines): get source lines from SCRIPT_LINES__ or
- read from the file.
-
- * lib/debug.rb (display_list): use script_lines instead of recursion.
- [Bug #8318]
-
- * lib/debug.rb (line_at): use script_lines same as display_list.
-
- * lib/debug.rb (display_list): Fix debug listing when called from the
- same file it has been required. patch by Dario Bertini <berdario AT
- gmail.com> [Bug #8318] [fix GH-280]
-
-Wed Apr 24 21:51:13 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Check mblen().
- mblen() is optional in uClibc.
-
- * eval_intern.h (CharNext): Don't use mblen() is not available.
-
-Wed Apr 24 15:55:06 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_fd_fix_cloexec): use rb_update_max_fd().
-
-Wed Apr 24 14:08:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * numeric.c: Fix wiki link on Float imprecision in overview, patched
- by Makoto Kishimoto [Bug #8304] [ruby-dev:47280]
-
-Wed Apr 24 14:03:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): disallow $- without following identifier
- character. [ruby-talk:406969]
-
- * parse.y (is_special_global_name): mere $- is not a valid global
- variable name.
-
-Wed Apr 24 13:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * string.c: Document String#setbyte return value by @gjmurakami-10gen
- [Fixes GH-294]
-
-Wed Apr 24 13:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * class.c: Example of Object#methods by @windwiny [Fixes GH-293]
- * ruby.c: Document return values of Kernel #sub, #gsub, and #chop
-
-Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
-
-
-Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
-
-Wed Apr 24 12:27:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c: Fix documentation for Array#index and #replace aliases
- Based on a patch by @phiggins [Fixes GH-282]
-
-Tue Apr 23 21:14:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_inspect): refix r40413, on Ruby 1.9 usual character
- escape uses hex/Unicode escapes, so fix to use Unicode escape on
- Unicode strings and hex on others. [ruby-core:54458] [Bug #8290]
-
-Tue Apr 23 20:10:02 2013 Tanaka Akira <akr@fsij.org>
-
- * missing/isnan.c (isnan): Don't define if isnan() macro is defined.
- This fixes a compilation failure on uClibc based Gentoo system.
-
-Tue Apr 23 17:40:40 2013 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/rexml/document.rb, lib/rexml/element.rb,
- lib/rexml/formatters/pretty.rb: remove opinionated
- language in documentation. [Bug #8309],
- reported by Charles Beckmann
-
-Tue Apr 23 14:04:44 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
- response correctly. [ruby-core:54365] [Bug #8281]
-
-Tue Apr 23 11:58:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_scrub): fix for UTF-32. strlen() on strings
- contain NUL returns wrong result, use sizeof operator instead.
- [ruby-dev:45975] [Feature #6752]
-
-Tue Apr 23 10:26:50 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * test/ruby/test_module.rb
- (TestModule#test_const_get_invalid_name)
- (test_const_defined_invalid_name): Fix expected values.
-
-Tue Apr 23 09:51:26 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * string.c (rb_str_inspect): NUL should not be represented as "\0"
- when octal digits may follow. [ruby-core:54458] [Bug #8290]
-
-Mon Apr 22 22:54:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * insns.def (opt_mod): Use % operator if both operands are positive for
- a significant performance improvement. Thanks to @samsaffron.
-
-Mon Apr 22 17:09:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (r_object0): copy all instance variables not only generic
- ivars, before calling post proc. [ruby-core:51163] [Bug #7627]
-
-Mon Apr 22 10:25:21 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * util.c (ruby_hdtoa): revert r29729.
- If you want ruby to behave as before on x86, specify to use SSE like
- -msse2 -mfpmath=sse for gcc.
-
-Sun Apr 21 23:19:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * configure.in: Revert using sigsetjmp by default due to performance
- problems on some systems (eg. older Linux)
-
-Sun Apr 21 21:35:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * configure.in: Use sigsetjmp by default so jumping out of signal
- handlers properly restores the signal mask and SS_ONSTACK flag.
- [ruby-core:54175] [Bug #8254]
-
- * configure.in: Manually check for presence of sigsetjmp. It is not a
- function on some systems, so AC_CHECK_FUNCS cannot be used.
-
-Sun Apr 21 08:00:55 2013 Tanaka Akira <akr@fsij.org>
-
- * test/csv/test_features.rb, test/logger/test_logger.rb
- test/mkmf/test_have_macro.rb, test/net/http/test_http.rb,
- test/openssl/test_config.rb, test/psych/test_encoding.rb,
- test/psych/test_exception.rb, test/psych/test_psych.rb,
- test/psych/test_tainted.rb, test/readline/test_readline.rb,
- test/rexml/test_contrib.rb, test/ruby/test_autoload.rb,
- test/ruby/test_beginendblock.rb, test/ruby/test_exception.rb,
- test/ruby/test_file.rb, test/ruby/test_io.rb,
- test/ruby/test_marshal.rb, test/ruby/test_process.rb,
- test/ruby/test_require.rb, test/ruby/test_rubyoptions.rb,
- test/syslog/test_syslog_logger.rb, test/webrick/test_httpauth.rb,
- test/zlib/test_zlib.rb: Use Tempfile.create.
-
-Sun Apr 21 00:15:36 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/tempfile.rb (Tempfile.create): Close when the block exits.
-
-Sat Apr 20 23:38:14 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/httpauth/htpasswd.rb: Use Tempfile.create to avoid
- unintentional unlink() by the finalizer.
- lib/webrick/httpauth/htdigest.rb: Ditto.
-
-Sat Apr 20 22:47:48 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/tempfile.rb (Tempfile.create): New method.
- The method name is proposed by Shugo Maeda. [ruby-dev:47220]
- [ruby-core:41478] [Feature #5707]
-
-Sat Apr 20 14:22:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_object): dump no ivars to the original by marshal_dump.
- [ruby-core:54334] [Bug #8276]
-
- * marshal.c (r_object0): copy all ivars of marshal_dump data to the
- result object instead. [ruby-core:51163] [Bug #7627]
-
-Sat Apr 20 02:33:27 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (str_scrub): add ruby method String#scrub which verify and
- fix invalid byte sequence. [ruby-dev:45975] [Feature #6752]
-
- * string.c (str_compat_and_valid): check given string is compatible
- and valid with given encoding.
-
- * transcode.c (str_transcode0): If invalid: :replace is specified for
- String#encode, replace invalid byte sequence even if the destination
- encoding equals to the source encoding.
-
-Fri Apr 19 21:55:40 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * README.EXT.ja (Data_Wrap_Struct): Remove a description about
- orphan argument. Oh, I renamed the argument name without
- changing description at r36180... Sorry....
- Patch by Makoto Kishimoto. Thanks!!! [ruby-dev:47269] [Bug #8292]
- * README.EXT.ja (Data_Make_Struct): Add a sample code that describes
- how it works.
- Patch by Makoto Kishimoto. Thanks!!! [ruby-dev:47269] [Bug #8292]
-
-Fri Apr 19 17:54:57 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (body_type_msg): should accept
- message/delivery-status with extra data.
- [ruby-core:53741] [Bug #8167]
-
- * test/net/imap/test_imap_response_parser.rb: related test.
-
-Fri Apr 19 13:03:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_object): do not dump encoding which is dumped with
- marshal_dump data. [ruby-core:54334] [Bug #8276]
-
-Fri Apr 19 11:36:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (stack_protector): control use of -fstack-protector.
-
- * configure.in (debugflags): let -fstack-protector precede and disable
- debugflags, because they can't work together on SmartOS. [Bug #8268]
-
-Fri Apr 19 07:43:52 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/openssl/test_cipher.rb: Correct a typo
- by jgls <joerg@joergleis.com>
- https://github.com/ruby/ruby/pull/291 fix GH-291
-
-Thu Apr 18 16:58:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_mod_public_method): fix visibility on anonymous
- module. set visibility of singleton method, not method in base
- class. [ruby-core:54404] [Bug #8284]
-
-Thu Apr 18 16:20:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): should skip dot directories only for recursion,
- but should not if matching to the given pattern. [ruby-core:54387]
- [Bug #8283]
-
-Thu Apr 18 16:20:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * pack.c (pack_unpack): increase buffer size to fix buffer overflow,
- and fix garbage just after unpacking without missing paddings.
- [Bug #8286]
-
-Thu Apr 18 13:35:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * pack.c (pack_unpack): output characters even if the input doesn't
- have paddings. [Bug #8286]
-
-Thu Apr 18 08:20:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (clean-ext): remove timestamps.
-
-Wed Apr 17 22:07:50 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h (SOCKLEN_MAX): Expression simplified.
-
-Wed Apr 17 20:09:19 2013 Aman Gupta <ruby@tmm1.net>
-
- * compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().
-
- * insns.def (setinlinecache): Ditto.
-
- * iseq.c (rb_iseq_add_mark_object): New function to allocate
- iseq->mark_ary on demand. [Bug #8142]
-
- * iseq.h (rb_iseq_add_mark_object): Ditto.
-
- * iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.
-
- * iseq.c (rb_iseq_build_for_ruby2cext): Ditto.
-
-Wed Apr 17 20:00:18 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h (SOCKLEN_MAX): Defined.
-
- * ext/socket/raddrinfo.c (ext/socket/raddrinfo.c): Reject too long
- Linux abstract socket name.
-
-Wed Apr 17 19:45:27 2013 Aman Gupta <tmm1@ruby-lang.org>
-
- * iseq.c (iseq_location_setup): re-use existing string when iseq has
- the same path and absolute_path. [Bug #8149]
-
-Wed Apr 17 11:38:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
- UNASSIGNED is not a valid message.
-
-Wed Apr 17 10:58:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (sleep_timeval): get rid of overflow on Windows where
- timeval.tv_sec is not time_t but mere long.
-
-Tue Apr 16 23:07:12 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/unixsocket.c (unix_send_io): Suppress a warning by clang.
- (unix_recv_io): Ditto.
-
-Tue Apr 16 12:27:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/sdbm/init.c: Fix comment indentation, by windwiny [Fixes GH-277]
-
-Tue Apr 16 12:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/socket/option.c: Document synonymous methods, by windwiny [GH-277]
- * ext/stringio/stringio.c: ditto
- * ext/io/wait/wait.c: ditto
- * ext/gdbm/gdbm.c: ditto
- * ext/dl/cfunc.c: ditto
- * ext/zlib/zlib.c: ditto
- * ext/win32ole/win32ole.c: ditto
- * ext/dbm/dbm.c: ditto
- * ext/json/generator/generator.c: ditto
- * ext/date/date_core.c: ditto
-
-Tue Apr 16 11:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/openssl/*: Document synonymous methods, by windwiny [GH-277]
-
-Mon Apr 15 22:21:42 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/fiddle/depend: New file.
-
-Mon Apr 15 22:01:02 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-insert): Check
- ruby-electric-is-last-command-char-expandable-punct-p here.
-
- * misc/ruby-electric.el (ruby-electric-closing-char): New
- interactive function bound to closing characters. Typing one of
- those closing characters right after the matching counterpart
- cancels the effect of automatic closing. For example, typing
- "{" followed by "}" simply makes "{}" instead of "{ } }".
-
-Mon Apr 15 12:54:42 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl_ssl.c: Correct shutdown behavior w.r.t GC.
-
- * test/openssl/test_ssl.rb: Add tests to verify correct behavior.
-
- [Bug #8240] Patch provided by Shugo Maeda. Thanks!
-
-Mon Apr 15 10:23:39 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/coverage/depend: fix id.h place as r40283.
-
- * ext/coverage/extconf.rb: add topdir and topsrcdir to VPATH.
-
-Sun Apr 14 19:46:14 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/debug/depend: New file.
-
- * ext/-test-/exception/depend: Ditto.
-
- * ext/-test-/printf/depend: Ditto.
-
- * ext/-test-/string/depend: Ditto.
-
- * ext/coverage/depend: Ditto.
-
- * ext/io/console/depend: Ditto.
-
- * ext/io/nonblock/depend: Ditto.
-
- * ext/io/wait/depend: Ditto.
-
- * ext/openssl/depend: Ditto.
-
- * ext/pathname/depend: Ditto.
-
- * ext/psych/depend: Ditto.
-
- * ext/zlib/depend: Ditto.
-
-Sun Apr 14 02:46:50 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#create_makefile): remove {$(VPATH)} other
- than nmake.
-
- * ext/ripper/depend: use VPATH expecting removed by above.
-
-Sat Apr 13 23:06:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (timestamp_file): gather timestamp files in one
- directory from each extension directories.
-
-Sat Apr 13 21:09:02 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#create_makefile): output new macro
- disthdrdir to specify the path of id.h, parse.h and etc.
-
- * ext/ripper/depend: use above macro.
-
-Sat Apr 13 20:28:08 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
- [bug] fix problem with optimization of \z (Issue #16) [Bug #8210]
-
-Sat Apr 13 18:56:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/ripper/depend: parse.h and id.h may be created on topdir.
-
-Sat Apr 13 12:08:16 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Vector#cross_product, patch by Luis Ezcurdia
- [fix GH-276] [rubyspec:81eec89a124]
-
-Sat Apr 13 10:20:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * struct.c (rb_struct_define_without_accessor, rb_struct_define),
- (rb_struct_s_def): hide member names array.
-
- * struct.c (anonymous_struct, new_struct, setup_struct): split
- make_struct() for each purpose.
-
-Sat Apr 13 09:34:31 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/mkmf.rb: Add ruby/ruby.h, ruby/missing.h, ruby/intern.h,
- ruby/st.h and ruby/subst.h for ruby_headers in generated Makefile.
-
- * ext/-test-/old_thread_select/depend: Update dependencies.
-
- * ext/-test-/wait_for_single_fd/depend: Ditto.
-
- * ext/bigdecimal/depend: Ditto.
-
- * ext/curses/depend: Ditto.
-
- * ext/digest/bubblebabble/depend: Ditto.
-
- * ext/digest/depend: Ditto.
-
- * ext/digest/md5/depend: Ditto.
-
- * ext/digest/rmd160/depend: Ditto.
-
- * ext/digest/sha1/depend: Ditto.
-
- * ext/digest/sha2/depend: Ditto.
-
- * ext/dl/callback/depend: Ditto.
-
- * ext/dl/depend: Ditto.
-
- * ext/etc/depend: Ditto.
-
- * ext/nkf/depend: Ditto.
-
- * ext/objspace/depend: Ditto.
-
- * ext/pty/depend: Ditto.
-
- * ext/readline/depend: Ditto.
-
- * ext/ripper/depend: Ditto.
-
- * ext/sdbm/depend: Ditto.
-
- * ext/socket/depend: Ditto.
-
- * ext/stringio/depend: Ditto.
-
- * ext/strscan/depend: Ditto.
-
- * ext/syslog/depend: Ditto.
-
- * ext/-test-/num2int/depend: Removed.
-
- * ext/dbm/depend: Ditto.
-
- * ext/fcntl/depend: Ditto.
-
- * ext/gdbm/depend: Ditto.
-
- * ext/racc/cparse/depend: Ditto.
-
-Sat Apr 13 00:15:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (Init_etc): move Passwd and Group under Etc namespace
- as primary names.
-
-Fri Apr 12 21:06:55 2013 Tanaka Akira <akr@fsij.org>
-
- * common.mk: pack.o depends on internal.h.
-
-Fri Apr 12 20:59:24 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (ones): Use __builtin_popcountl if available.
-
- * internal.h (GCC_VERSION_SINCE): Macro moved from pack.c.
-
- * pack.c: Include internal.h for GCC_VERSION_SINCE.
-
-Fri Apr 12 18:29:42 2013 Tanaka Akira <akr@fsij.org>
-
- * common.mk: version.o depends on $(srcdir)/include/ruby/version.h
- instead of {$(VPATH)}version.h to avoid confusion by VPATH between
- top level version.h and include/ruby/version.h for build in-place.
- [ruby-dev:47249] [Bug #8256]
-
-Fri Apr 12 15:21:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_keyword_arg): non-symbol key is not
- a keyword argument, keep it as a positional argument.
-
-Fri Apr 12 11:58:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c: Document synonymous methods, by windwiny [GH-277]
- * bignum.c: ditto
- * complex.c: ditto
- * dir.c: ditto
- * encoding.c: ditto
- * enumerator.c: ditto
- * numeric.c: ditto
- * proc.c: ditto
- * re.c: ditto
- * string.c: ditto
-
-Thu Apr 11 23:41:46 2013 Tanaka Akira <akr@fsij.org>
-
- * common.mk: Add dependencies for include/ruby.h
-
- * tool/update-deps: Use "make -p all miniruby ruby golf" to extract
- dependencies in makefiles.
-
-Thu Apr 11 23:21:17 2013 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Use "make -p all golf" to extract dependencies in
- makefiles.
-
-Thu Apr 11 21:02:19 2013 Tanaka Akira <akr@fsij.org>
-
- * common.mk: Dependency updated.
-
- * tool/update-deps: Rewritten.
-
-Thu Apr 11 19:59:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk: partially revert r40183, which breaks building on
- other than source directory. (its commit log also says the same
- thing, but such failure is not reproducible on my environment
- and the commit breaks build on my environment)
-
-Thu Apr 11 16:10:01 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 on
- Mac OS X and Linux [Bug #3371]
-
-Thu Apr 11 13:19:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/drb/drbtest.rb (Drb{Core,Ary}#teardown): retry Process.kill
- if it fails with Errno::EPERM on Windows (workaround).
- [ruby-dev:47245] [Bug #8251]
-
-Thu Apr 11 11:11:38 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * dir.c: Fix a typo.
-
-Thu Apr 11 10:39:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): add missing case:
- RUBY_LIBFFI_MODVERSION is not defined (usually on Windows).
-
-Thu Apr 11 09:27:04 2013 Konstantin Haase <me@rkh.im>
-
- * dir.c (file_s_fnmatch): Document File::FNM_EXTGLOB flag.
-
-Thu Apr 11 09:17:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README: Fix typo by Benjamin Winkler [Fixes GH-281]
-
-Thu Apr 11 06:15:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regint.h: fix typo: _M_AMD86 -> _M_AMD64.
-
- * siphash.c: ditto.
-
- * st.c: ditto.
-
-Thu Apr 11 06:09:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/fiddle/extconf.rb: define RUBY_LIBFFI_MODVERSION macro.
-
- * ext/fiddle/closure.c (USE_FFI_CLOSURE_ALLOC): define 0 or 1
- with platform and libffi's version. [Bug #3371]
-
-Thu Apr 11 05:30:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/mkmf.rb (pkg_config): Add optional argument "option".
- If it is given, it returns the result of
- `pkg-config --<option> <pkgname>`.
-
-Thu Apr 11 03:33:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/fiddle/closure.c (initialize): check mprotect's return value.
- If mprotect is failed because of PaX or something, its function call
- will cause SEGV.
- http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20130401T210301Z.diff.html.gz
-
-Wed Apr 10 17:39:13 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/bigdecimal/bigdecimal.c (VpCtoV): Initialize a local variable
- even when overflow.
-
-Wed Apr 10 12:32:37 2013 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_ll2big): Don't overflow on signed integer negation.
-
- * ext/bigdecimal/bigdecimal.c (MUL_OVERFLOW_SIGNED_VALUE_P): New
- macro.
- (AddExponent): Don't overflow on signed integer multiplication.
- (VpCtoV): Don't overflow on signed integer arithmetic.
- (VpCtoV): Don't overflow on signed integer arithmetic.
-
-Wed Apr 10 06:32:12 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (MUL_OVERFLOW_INT_P): New macro.
-
- * sprintf.c (GETNUM): Don't overflow on signed integer multiplication.
-
-Tue Apr 9 20:38:20 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (MUL_OVERFLOW_SIGNED_INTEGER_P): New macro.
- (MUL_OVERFLOW_FIXNUM_P): Ditto.
- (MUL_OVERFLOW_LONG_P): Ditto.
-
- * array.c (rb_ary_product): Don't overflow on signed integer
- multiplication.
-
- * numeric.c (fix_mul): Ditto.
- (int_pow): Ditto.
-
- * rational.c (f_imul): Ditto.
-
- * insns.def (opt_mult): Ditto.
-
- * thread.c (sleep_timeval): Don't overflow on signed integer addition.
-
- * bignum.c (rb_int2big): Don't overflow on signed integer negation.
- (rb_big2ulong): Ditto.
- (rb_big2long): Ditto.
- (rb_big2ull): Ditto.
- (rb_big2ll): Ditto.
-
-Tue Apr 9 19:45:44 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/open-uri.rb: Support multiple fields with same field
- name (like Set-Cookie).
- (OpenURI::Meta#metas): New accessor to obtain fields as a Hash from
- field name (string) to field values (array of strings).
- [ruby-core:37734] [Bug #4964] reported by ren li.
-
-Tue Apr 9 15:26:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): append keyword hash to argument array
- to splat if needed. [ruby-core:54094] [Bug #8236]
-
-Tue Apr 9 10:02:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (timestamp_file): gather timestamp files in one
- directory from each extension directories, with considering
- target_prefix.
-
-Tue Apr 9 04:57:59 JST 2013 Charles Oliver Nutter <headius@headius.com>
-
- * error.c: Capture EAGAIN, EWOULDBLOCK, EINPROGRESS exceptions and
- export them for use in WaitReadable/Writable exceptions.
- * io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that
- include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail
- for nonblocking failures using those exceptions. Use that
- function in io_getpartial and io_write_nonblock instead of
- rb_mod_sys_fail
- * ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include
- WaitReadable and WaitWritable. Use those classes for
- write_would_block and read_would_block instead of rb_mod_sys_fail.
- * ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of
- rb_mod_sys_fail in bsock_sendmsg_internal and
- bsock_recvmsg_internal.
- * ext/socket/init.c: Use rb_readwrite_sys_fail instead of
- rb_mod_sys_fail in rsock_s_recvfrom_nonblock and
- rsock_s_connect_nonblock.
- * ext/socket/socket.c: Use rb_readwrite_sys_fail instead of
- rb_mod_sys_fail in sock_connect_nonblock.
- * include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead
- of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and
- RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail.
-
-Tue Apr 9 02:44:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/extconf.rb: $defs needs -D or -U. nothing is added
- otherwize.
-
- * ext/socket/extconf.rb: check struct in_addr6, which is defined in
- VC6 instead of in6_addr.
-
- * ext/socket/option.c (optname_to_sym): fix macro name.
-
- * ext/socket/constants.c (rsock_cmsg_type_arg): fix macro name.
-
-Mon Apr 8 23:57:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (id_for_setter): extract common code from const, class
- variable, instance variable setters.
-
-Mon Apr 8 23:55:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/depend (ENCOBJS, TRANSOBJS): use explicit path to ruby.h for
- nmake.
-
- * ext/depend (ENCOBJS, TRANSOBJS): fix header dependency, VPATH has
- $(srcdir)/include/ruby but not $(srcdir)/include, so cannot find out
- ruby/ruby.h. use ruby.h instead and ../ruby for include/ruby.h.
-
-Mon Apr 8 20:30:37 2013 Yuki Yugui Sonoda <yugui@google.com>
-
- * ext/depend (ENCOBJS, TRANSOBJS): Add missing dependencies.
-
-Mon Apr 8 17:19:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32ole/win32ole.c (fole_missing): should check actual argument
- count before accessing.
-
-Mon Apr 8 16:03:55 2013 Yuki Yugui Sonoda <yugui@google.com>
-
- Fixes a build failure of ext/ripper/ripper.c on building out of place.
- * common.mk (id.h, id.c): Always generated in $(srcdir).
- (ext/ripper/ripper.c): Passes $(PATH_SEPARATOR) too to the sub make.
-
-Mon Apr 8 12:05:02 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * object.c (rb_obj_ivar_set): call to_str for string only once.
- to_str was called from rb_is_const_name and rb_to_id before.
-
- * object.c (rb_mod_const_set): ditto.
-
- * object.c (rb_mod_cvar_set): ditto.
-
-Sun Apr 7 13:56:16 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
- RUBY_PLATFORM should escape as Regexp,
- because RUBY_PLATFORM may contain '.'.
-
-Sun Apr 7 10:44:01 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h: Simplify the logic to include sys/select.h.
- This fixes a compilation error on Haiku (gcc2 and gcc4).
-
- * configure.in: Use shared linker as $(CC) for Haiku.
- This fixes a build error on Haiku (gcc2).
-
-Sun Apr 7 10:41:30 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (MDNSOneShot#sender): Delete an unused variable.
-
-Sun Apr 7 03:24:36 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c: use more generic type:
- * u_char -> unsigned char
- * u_short -> unsigned short
- * u_int -> unsigned int
- * u_long -> unsigned long
- * quad_t -> int64_t
- * u_quad_t -> uint64_t
-
- * addr2line.c (imax): inline is defined by configure.
-
-Sun Apr 7 01:40:39 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-hash): New electric
- function that expands a hash sign inside a string or regexp to
- "#{}".
-
- * misc/ruby-electric.el (ruby-electric-curlies): Do not insert
- spaces inside when the curly brace is a delimiter of %r, %w,
- etc.
-
- * misc/ruby-electric.el (ruby-electric-curlies): Insert another
- space before a closing curly brace when
- ruby-electric-newline-before-closing-bracket is nil.
-
-Sun Apr 7 01:01:26 2013 Tanaka Akira <akr@fsij.org>
-
- * strftime.c (rb_strftime_with_timespec): Test yday range.
- [ruby-core:44088] [Bug #6247] reported by Ruby Submit.
-
-Sat Apr 6 23:46:54 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * configure.in (AC_CHECK_HEADERS): atomic.h for Solaris atomic_ops.
-
- * ruby_atomic.h: Skip using Solaris10 atomic_ops on Solaris 9 or
- earlier if atomic.h is not available. [ruby-dev:47229] [Bug #8228]
-
-Sat Apr 6 23:40:40 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: Support LOC resources.
- [ruby-core:23361] [Feature #1436] by JB Smith.
-
-Sat Apr 6 23:38:09 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * addr2line.c: quad_t and u_quad_t is not available on Solaris.
- __inline is not available with old compilers on Solaris.
- [ruby-dev:47229] [Bug #8227]
-
-Sat Apr 6 23:31:38 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: Add one-shot multicast DNS support.
- [ruby-core:53387] [Feature #8089] by Eric Hodel.
-
-Sat Apr 6 22:12:01 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (Resolv::DNS.fetch_resource): New method to obtain
- full result.
- [ruby-dev:43587] [Feature #4788] proposed by Makoto Kishimoto.
-
-Sat Apr 6 20:17:51 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_sys_fail_raddrinfo): Renamed from
- rsock_sys_fail_addrinfo.
- (rsock_sys_fail_raddrinfo_or_sockaddr): Renamed from
- rsock_sys_fail_addrinfo_or_sockaddr.
-
- * ext/socket/rubysocket.h: Follow the above change.
-
-Sat Apr 6 19:24:59 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_sys_fail_sockaddr): Takes struct sockaddr
- and socklen_t instead of String object.
- (rsock_sys_fail_addrinfo_or_sockaddr): Follow the above change.
-
- * ext/socket/rubysocket.h (rsock_sys_fail_sockaddr): Follow the above
- change.
-
-Sat Apr 6 14:28:23 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h (SockAddrStringValueWithAddrinfo): New macro.
- (rsock_sockaddr_string_value_with_addrinfo): New declaration.
- (rsock_addrinfo_inspect_sockaddr): Ditto.
- (rsock_sys_fail_addrinfo): Ditto.
- (rsock_sys_fail_sockaddr_or_addrinfo): Ditto.
-
- * ext/socket/raddrinfo.c (rsock_addrinfo_inspect_sockaddr): Renamed
- from addrinfo_inspect_sockaddr and exported.
- (rsock_sockaddr_string_value_with_addrinfo): New function to obtain
- string and possibly addrinfo object.
-
- * ext/socket/socket.c (rsock_sys_fail_sockaddr): Don't use
- rsock_sys_fail_host_port which is IP dependent. Invoke
- rsock_sys_fail_addrinfo.
- (rsock_sys_fail_addrinfo): New function using
- rsock_addrinfo_inspect_sockaddr.
- (rsock_sys_fail_addrinfo_or_sockaddr): New function.
- (sock_connect): Use SockAddrStringValueWithAddrinfo and
- rsock_sys_fail_addrinfo_or_sockaddr.
- (sock_connect_nonblock): Ditto.
- (sock_bind): Ditto.
-
-Sat Apr 6 13:34:20 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_sys_fail_sockaddr): Delete 2nd argument.
-
- * ext/socket/rubysocket.h (rsock_sys_fail_sockaddr): Follow above
- change.
-
-Sat Apr 6 13:13:39 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect only
- for String to avoid SEGV.
-
-Sat Apr 6 12:40:16 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h (rsock_sys_fail_host_port): Wrap by NORETURN.
- (rsock_sys_fail_path): Ditto.
- (rsock_sys_fail_sockaddr): Ditto.
-
-Sat Apr 6 11:49:35 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect if the
- path contains a NUL.
-
-Sat Apr 6 11:39:19 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: Improve socket exception message to show socket address.
- [ruby-core:45617] [Feature #6583] proposed Eric Hodel.
-
- * ext/socket/rubysocket.h (rsock_sys_fail_host_port): Declared.
- (rsock_sys_fail_path): Ditto.
- (rsock_sys_fail_sockaddr): Ditto.
-
- * ext/socket/udpsocket.c (udp_connect): Use rsock_sys_fail_host_port.
- (udp_bind): Ditto.
- (udp_send): Ditto.
-
- * ext/socket/init.c (rsock_init_sock): Specify a string for rb_sys_fail
- argument.
- (make_fd_nonblock): Ditto.
- (rsock_s_accept): Ditto.
-
- * ext/socket/ipsocket.c (init_inetsock_internal): Use
- rsock_sys_fail_host_port.
-
- * ext/socket/socket.c (rsock_sys_fail_host_port): Defined.
- (rsock_sys_fail_path): Ditto.
- (rsock_sys_fail_sockaddr): Ditto.
- (setup_domain_and_type): Use rsock_sys_fail_sockaddr.
- (sock_connect_nonblock): Ditto.
- (sock_bind): Ditto.
- (sock_gethostname): Specify a string for rb_sys_fail argument.
- (socket_s_ip_address_list): Ditto.
-
- * ext/socket/basicsocket.c (bsock_shutdown): Specify a string for
- rb_sys_fail argument.
- (bsock_setsockopt): Use rsock_sys_fail_path.
- (bsock_getsockopt): Ditto.
- (bsock_getpeereid): Refine the argument for rb_sys_fail.
-
- * ext/socket/unixsocket.c (rsock_init_unixsock): Use
- rsock_sys_fail_path.
- (unix_path): Ditto.
- (unix_send_io): Ditto.
- (unix_recv_io): Ditto.
- (unix_addr): Ditto.
- (unix_peeraddr): Ditto.
-
-Sat Apr 6 11:23:18 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
- fix load path for encoding to run the test as stand-alone.
-
-Sat Apr 6 09:54:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * pack.c (NATINT_LEN): fix definition order, must be after
- NATINT_PACK.
-
-Sat Apr 6 03:11:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: fix symbol keys in coder
- emission. Thanks @tjwallace
- * test/psych/test_coder.rb: test for change
-
-Sat Apr 6 02:54:08 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/exception.rb: there should be only one exception
- base class. Fixes tenderlove/psych #125
- * ext/psych/lib/psych.rb: require the correct exception class
- * ext/psych/lib/psych/syntax_error.rb: ditto
- * ext/psych/lib/psych/visitors/to_ruby.rb: ditto
-
-Sat Apr 6 02:30:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (new_defined): remove all extra parentheses, and return
- "nil" for defined? with empty expression.
- [ruby-core:54024] [Bug #8224]
-
-Sat Apr 6 02:06:04 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: correctly register
- self-referential strings. Fixes tenderlove/psych #135
-
- * test/psych/test_string.rb: appropriate test.
-
-Sat Apr 6 01:21:56 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/init.c (cloexec_accept): Fix a compile error on
- Debian GNU/kFreeBSD. Consider HAVE_ACCEPT4 is defined
- but SOCK_CLOEXEC is not defined.
-
-Sat Apr 6 00:19:30 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * load.c (features_index_add): use rb_str_subseq() to specify C string
- position properly to fix require non ascii path.
- [ruby-core:53733] [Bug #8165]
-
- * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
- a test for the above.
-
-Fri Apr 5 20:41:49 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h (HAVE_TRUE_LONG_LONG): Defined to distinguish
- availability of long long and availability of 64bit integer type.
-
- * pack.c: Use HAVE_TRUE_LONG_LONG to distinguish q! and Q! support.
-
-Fri Apr 5 20:19:42 2013 Tanaka Akira <akr@fsij.org>
-
- * addr2line.c: Include ruby/missing.h to fix compile error on Debian.
-
-Fri Apr 5 19:39:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): fix of defined? with empty
- expression. [ruby-core:53999] [Bug #8220]
-
-Fri Apr 5 13:22:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/curses/curses.c (Init_curses): fix implementation function,
- crmode should be same as cbreak. [ruby-core:54013] [Bug #8222]
-
-Fri Apr 5 12:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/curses/hello.rb: Typo in Curses example by Drew Blas
- [Fixes GH-273]
-
-Thu Apr 4 23:45:13 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (bind_random_port): Rescue EACCES for SunOS.
- bind() on SunOS for port 2049 (nfs) and 4045 (lockd) causes
- EACCES with unprivileged process. cf. PRIV_SYS_NFS in privileges(5)
- [ruby-core:48064] [Bug #7183] reported by Frank Meier.
-
-Thu Apr 4 23:24:45 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Remove condition for bcc.
-
-Thu Apr 4 22:53:23 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h (FIX2LONG): Parenthesize the macro body.
-
-Thu Apr 4 22:32:32 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (time_strftime): Describe %L and %N truncates digits under
- the specified length.
- [ruby-core:52130] [Bug #7829]
-
-Thu Apr 4 22:08:46 2013 Tanaka Akira <akr@fsij.org>
-
- * object.c (rb_mod_cvar_set): Reverted "avoid inadvertent
- symbol creation" to avoid SEGV by
- Class.new.class_variable_set(1, 2).
-
-Thu Apr 4 20:07:19 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/pathname/pathname.c (path_write): New method.
- (path_binwrite): Ditto.
- [ruby-core:49468] [Feature #7378]
-
-Thu Apr 4 16:51:29 2013 Yuki Yugui Sonoda <yugui@google.com>
-
- * thread_pthread.c: Fixes wrong scopes of #if USE_SLEEPY_TIMER_THREAD
- .. #endif sections. This fixes a build error on NativeClient.
-
-Wed Apr 3 17:25:31 2013 Yuki Yugui Sonoda <yugui@google.com>
-
- * thread_pthread.c (ruby_init_stack): Avoid using uninitialized value.
- stackaddr and size are not set if get_stack() fails.
-
-Thu Apr 4 16:55:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * struct.c (make_struct): avoid inadvertent symbol creation.
- (rb_struct_aref): ditto.
- (rb_struct_aset): ditto.
-
-Thu Apr 4 16:54:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_set): avoid inadvertent symbol creation.
- (rb_obj_ivar_set): ditto.
- (rb_mod_cvar_set): ditto.
-
-Thu Apr 4 15:46:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_inject): avoid inadvertent symbol creation.
-
-Thu Apr 4 14:37:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (rb_thread_aref): avoid inadvertent symbol creation.
- (rb_thread_variable_get): ditto.
- (rb_thread_key_p): ditto.
- (rb_thread_variable_p): ditto.
-
-Thu Apr 4 11:33:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/openssl/ossl_bn.c (ossl_bn_to_i): Use bn2hex to speed up.
- In general, binary to/from decimal needs extra cost.
-
-Thu Apr 4 07:24:18 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Specify arguments to test functions.
-
-Thu Apr 4 03:25:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn.
-
-Wed Apr 3 22:09:25 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Test functions and libraries after headers.
-
-Wed Apr 3 21:23:29 2013 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_io_seek_m): Accept :CUR, :END, :SET as "whence" argument.
- (interpret_seek_whence): New function.
- [ruby-dev:45818] [Feature #6643]
-
-Wed Apr 3 20:52:49 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c: Describe the behavior which Ruby invokes a commandline
- directly without shell if the commandline is simple enough.
- [ruby-core:50459] [Bug #7489]
-
-Wed Apr 3 20:27:37 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/extmk.rb (extmake): Invoke Logging::log_close in a ensure
- clause.
-
-Wed Apr 3 18:53:58 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/extmk.rb (extmake): Use Logging.open to switch stdout and
- stderr. Delay Logging::log_close until the failure message is
- written. Write the failure message only if log file is opened.
-
- * lib/mkmf.rb (Logging.log_opened?): New method.
-
- [ruby-dev:47215] [Bug #8209]
-
-Wed Apr 3 17:11:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (constat_apply): pass through unknown sequence which
- starts with ESC but is not followed by a bracket. [ruby-core:53879]
- [Bug #8201]
-
-Wed Apr 3 16:35:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (rb_big_eq): hide intermediate Bignums not just freeing
- memory. [ruby-core:53893] [Bug #8204]
-
- * object.c (rb_obj_hide): hide an object by clearing klass.
-
- * bignum.c (rb_big_eq): test as Fixnum if possible and get rid of zero
- length Bignum. [ruby-core:53893] [Bug #8204]
-
-Tue Apr 2 23:56:03 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/securerandom.rb (SecureRandom.random_bytes): Use
- OpenSSL::Random.random_add instead of OpenSSL::Random.seed and
- specify 0.0 as the entropy.
- [ruby-core:47308] [Bug #6928]
-
-Tue Apr 2 20:24:52 2013 Tanaka Akira <akr@fsij.org>
-
- * pack.c: Support Q! and q! for long long.
- (natstr): Moved to toplevel. Add q and Q if there is long long type.
- (endstr): Moved to toplevel.
- (NATINT_PACK): Consider long long.
- (NATINT_LEN_Q): New macro.
- (pack_pack): Support Q! and q!.
- (pack_unpack): Ditto.
- [ruby-dev:43970] [Feature #3946]
-
-Tue Apr 2 19:24:26 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/num2int/num2int.c: Define utility methods
- as module methods of Num2int.
-
- * test/-ext-/num2int/test_num2int.rb: Follow the above change.
-
-Tue Apr 2 18:49:01 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/securerandom.rb: Don't use Array#to_s.
- [ruby-core:52058] [Bug #7811] fixed by zzak (Zachary Scott).
-
-Tue Apr 2 17:38:20 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * re.c (rb_reg_to_s): suppress duplicated charclass warning.
- Regexp#to_s suppress extra its whole regexp options by calling
- onig_new with its source, but it doesn't call rb_reg_preprocess.
- Therefore its Unicode escapes (\u{XXXX}) are given as is,
- and it may cause duplicated charclass warning for example
- "[\u{33}]" (3 is duplicated) or "[\u{a}\u{b}]" (u is duplicated).
- [ruby-core:53649] [Bug #8151]
-
-Tue Apr 2 16:00:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_dump.c (rb_print_backtrace): separate to ease showing C backtrace.
-
- * internal.h (rb_print_backtrace): ditto.
-
-Tue Apr 2 15:22:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_separately): stop_auto_run of
- Test::Unit::Runner to prevent auto runner use ARGV.
-
- * test/ruby/envutil.rb (assert_separately): add $: to separate process.
-
- * test/ruby/envutil.rb (assert_separately): fail if stderr is not
- empty and ignore_stderr is false.
-
-Tue Apr 2 06:46:59 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/num2int/num2int.c: Rename utility methods
- to global functions to ease manual experiments.
-
- * test/-ext-/num2int/test_num2int.rb: Follow the above change.
-
-Mon Apr 1 22:26:17 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/zlib/zlib.c (rb_gzfile_set_mtime): Use NUM2UINT.
- The old logic doesn't work well on LP64 platforms as:
- .. -2**63-1 => error,
- -2**63 .. -2**62-1 => success,
- -2**62 .. -2**31-1 => error,
- -2**31 .. 2**31-1 => success,
- 2**31 .. 2**62-1 => error,
- 2**62 .. 2**64-1 => success,
- 2**64 .. => error.
-
-Mon Apr 1 22:08:02 2013 Benoit Daloze <eregontp@gmail.com>
-
- * ext/zlib/zlib.c (Zlib::Inflate.new):
- Fix documentation syntax and naming errors.
- Based on patch by Robin Dupret. Fix GH-271.
-
-Mon Apr 1 21:22:31 2013 Tanaka Akira <akr@fsij.org>
-
- * test/-ext-/num2int/test_num2int.rb: Test small bignums.
-
-Mon Apr 1 21:10:56 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_num2ulong_internal): Don't cast a negative double value
- into unsigned long, which is undefined behavior.
- (rb_num2ull): Don't cast a value bigger than LLONG_MAX into
- long long, which is undefined behavior.
-
-Mon Apr 1 20:57:57 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/num2int/num2int.c: Return string for result, instead of
- printing.
-
- * test/-ext-/num2int/test_num2int.rb: updated to follow above change.
-
-Mon Apr 1 20:08:07 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_num2long): Don't use SIGNED_VALUE uselessly.
- (check_int): Ditto.
- (check_short): Ditto.
- (rb_num2fix): Ditto.
- (rb_num2ulong_internal): Add a cast.
-
-Mon Apr 1 18:41:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: skip autoconf 2.64 and 2.66, 2.67 seems short-lived
- but stick on it for Debian Squeeze.
-
-Mon Apr 1 14:22:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check clang version by predefined macro values.
- [Bug #8192]
-
-Mon Apr 1 12:05:15 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (check_uint): Take the 1st argument as unsigned long,
- instead of VALUE. Refine the validity test conditions.
- (check_ushort): Ditto.
-
-Mon Apr 1 07:15:03 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * configure.in: use quadrigraph to put '[' or ']'. [Bug #8192]
-
-Mon Apr 1 04:16:41 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: kick old clang. [ruby-dev:47204] [Bug #8192]
-
-Mon Apr 1 01:12:46 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h (FIX2ULONG): Make it consistent with NUM2ULONG.
-
- * ext/-test-/num2int/num2int.c: Add utility methods for FIX2XXX tests.
-
- * test/-ext-/num2int/test_num2int.rb: Add tests for FIX2XXX.
-
-Sun Mar 31 17:17:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_mod_define_method): consider visibility in define_method.
- patch by mashiro <mail AT mashiro.org>. fix GH-268.
-
-Sun Mar 31 15:40:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/configure.bat: try to fix option arguments split by commas and
- equals here. this batch file no longer run with old command.com.
-
- * tool/mkconfig.rb: no hacks for cmd.exe.
-
-Sun Mar 31 13:47:04 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_num2ulong_internal): New function similar to
- rb_num2ulong but integer wrap around flag is also returned.
- (rb_num2ulong): Use rb_num2ulong_internal.
- (rb_num2uint): Use rb_num2ulong_internal and the wrap around flag is
- used instead of negative_int_p(val).
- (rb_num2ushort): ditto.
-
-Sun Mar 31 06:27:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (HAVE_METACLASS_P): should check FL_SINGLETON flag before get
- instance variable to get rid of wrong warning about __attached__.
- [ruby-core:53839] [Bug #8188]
-
-Sat Mar 30 14:11:28 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * bcc32: removed. agreed at
- http://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130223Japan
-
-Sat Mar 30 03:58:00 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII.
- fix [ruby-core:53079] [Bug #7996]
- reported and patched by mmeltner (Michael Meltner).
-
-Sat Mar 30 03:49:21 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (wrename): use MoveFileExW instead of MoveFileW,
- because the latter fails on cross device file move of some
- environments.
- fix [ruby-core:53492] [Bug #8109]
- reported by mitchellh (Mitchell Hashimoto).
-
-Fri Mar 29 22:09:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (rb_mutex_synchronize_m): yield no block params. patch by
- splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097].
- fix GH-266.
-
-Fri Mar 29 16:51:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (argf_next_argv): set init flag if succeeded to forward, after
- skipping.
-
- * io.c (argf_block_call_i, argf_block_call): no more forwarding if
- forwarded after skipping. [ruby-list:49185]
-
- * io.c (argf_close): deal with init flag.
-
- * io.c (argf_block_call_i, argf_block_call): forward next file if
- skipped while iteration, to get rid of IOError. [ruby-list:49185]
-
-Fri Mar 29 11:09:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (configuration): not include all CFLAGS in CXXFLAGS, to
- use different set than C for C++. [ruby-core:45273] [Bug #6504]
-
-Fri Mar 29 10:24:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/io.h: undef POSIX compliant names on AIX, which are no
- longer needed. patch suggested by edelsohn (David Edelsohn) in
- [ruby-core:53815]. [Bug #8174]
-
-Fri Mar 29 06:39:42 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_num2ull): Cast double to unsigned LONG_LONG via
- LONG_LONG instead of double to unsigned LONG_LONG directly.
- This is a challenge to fix a test_num2ull(TestNum2int)
- failure (NUM2ULL(-1.0) should be "18446744073709551615" but was "0")
- on Mac OS X with 32bit clang.
- http://a.mrkn.jp/~mrkn/chkbuild/mountain_lion/ruby-trunk-m32-o0/log/20130328T191100Z.diff.html.gz
-
-Fri Mar 29 00:54:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
- preserved. [ruby-core:53745] [Bug #8169]
-
-Thu Mar 28 23:11:25 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: Test Windows platform by detecting LoadError when
- require 'win32/resolv' suggested by Nobuyoshi Nakada [ruby-core:53389].
- [ruby-core:53388] [Feature #8090] Reported by Charles Nutter.
-
-Thu Mar 28 23:10:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/io.h: rename SVR3,4 member names as POSIX compliant,
- to get rid of conflict on AIX. [ruby-core:53765] [Bug #8174]
-
-Thu Mar 28 18:22:21 2013 Tanaka Akira <akr@fsij.org>
-
- * test/-ext-/num2int/test_num2int.rb: extract
- assert_num2i_success_internal and assert_num2i_error_internal and
- provide assertion messages as "NUM2XXX(NNN)".
-
-Thu Mar 28 07:05:25 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h: Delete redundant inclusions caused by
- AC_INCLUDES_DEFAULT in defines.h.
-
- * include/ruby/defines.h: Ditto.
-
- * include/ruby/ruby.h: Ditto.
-
- * include/ruby/st.h: Ditto.
-
-Thu Mar 28 06:51:31 2013 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h: Fix a compilation error on NetBSD,
- "type of formal parameter 1 is incomplete" for the rb_thread_wait_for
- invocation in rb_file_flock, by including header files as
- AC_INCLUDES_DEFAULT of autoconf.
-
-Wed Mar 27 22:09:14 2013 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (LONG_MIN_MINUS_ONE_IS_LESS_THAN): New macro.
- (LLONG_MIN_MINUS_ONE_IS_LESS_THAN): Ditto.
- (rb_num2long): Use LONG_MIN_MINUS_ONE_IS_LESS_THAN.
- (rb_num2ulong): Ditto.
- (rb_num2ll): Use LLONG_MIN_MINUS_ONE_IS_LESS_THAN.
- (rb_num2ull): Ditto.
-
- * test/-ext-/num2int/test_num2int.rb (assert_num2i_success): Test the
- value converted into a Float if Float can represent the value
- exactly.
- (assert_num2i_error): Ditto.
-
-Wed Mar 27 20:59:47 2013 Tanaka Akira <akr@fsij.org>
-
- * test/-ext-/num2int/test_num2int.rb (assert_num2i_success): New
- utility method.
- (assert_num2i_error): Ditto.
-
-Wed Mar 27 20:37:59 2013 Tanaka Akira <akr@fsij.org>
-
- * time.c (num_exact): Use to_r method only if to_int method is
- available.
- [ruby-core:53764] [Bug #8173] Reported by Hiro Asari.
-
-Wed Mar 27 12:07:40 2013 Tanaka Akira <akr@fsij.org>
-
- * test/-ext-/num2int/test_num2int.rb (test_num2ll): test LLONG_MIN,
- not LONG_MIN.
-
-Wed Mar 27 12:02:45 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (TIMET_MAX_PLUS_ONE): definition simplified.
-
-Wed Mar 27 06:39:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
- to be preserved. [ruby-core:53745] [Bug #8169]
-
-Wed Mar 27 05:15:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_REPLACE_TYPE): define SIGNEDNESS_OF_type same as
- check_signedness of mkmf.rb.
-
- * internal.h (TIMET_MAX, TIMET_MIN, TIMET_MAX_PLUS_ONE): use
- SIGNEDNESS_OF_TIME_T.
-
-Wed Mar 27 00:28:45 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h (TIMET_MAX_PLUS_ONE): Defined.
-
- * thread.c (double2timeval): Saturate out-of-range values.
-
-Tue Mar 26 23:41:18 2013 Tanaka Akira <akr@fsij.org>
-
- * internal.h: Define TIMET_MAX and TIMET_MIN here.
-
- * time.c: Remove TIMET_MAX and TIMET_MIN definitions.
-
- * thread.c: Ditto.
-
- * thread_pthread.c: Remove TIMET_MAX definition.
-
- * thread_win32.c: Ditto.
-
-Tue Mar 26 22:31:10 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (sockaddr_len): return the shortest length for
- unknown socket address.
-
-Tue Mar 26 22:14:46 2013 Tanaka Akira <akr@fsij.org>
-
- * thread.c (double2timeval): convert the infinity to TIME_MAX to avoid
- SEGV by Thread.new {}.join(Float::INFINITY) on
- Debian GNU/Linux (amd64).
-
-Mon Mar 25 07:09:20 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/tuplespace.rb: Only return tuple entry once on move,
- either through port or regular return, not both. This results in a
- 120% speedup when combined with #8125. Patch by Joel VanderWerf.
- [ruby-trunk - Feature #8119]
-
-Mon Mar 25 06:59:01 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rinda/test_rinda.rb: Skip IPv6 tests if no IPv6 addresses
- exist. Skip fork-dependent test if fork is not available.
- [ruby-trunk - Bug #8159]
-
-Sun Mar 24 10:38:24 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * addr2line.c (putce): suppress unused return value warning.
-
-Mon Mar 25 02:01:03 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * proc.c (bm_free): need to clean up the mark flag of a free and
- unlinked method entry. [Bug #8100] [ruby-core:53439]
-
-Sun Mar 24 22:13:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_rpartition): revert r39903, and convert byte offset
- to char offset; the return value of rb_reg_search is byte offset,
- but other than it of rb_str_rpartition expects char offset.
- [Bug #8138] [ruby-dev:47183]
-
-Sun Mar 24 18:29:46 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * string.c (rb_str_rpartition): Fix String#rpartition(/re/)
- against a multibyte string. [Bug #8138] [ruby-dev:47183]
-
-Sun Mar 24 13:42:24 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (GC_ENABLE_LAZY_SWEEP): new macro to switch lazy sweeping
- for debugging. [Feature #8024] [ruby-dev:47135]
-
-Sun Mar 24 12:55:47 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: We have no chance to expand the heap when lazy sweeping is
- restricted. So collecting is often invoked if there is not
- enough free space in the heap. Try to expand heap when this is
- the case.
-
-Sun Mar 24 11:03:31 2013 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_require.rb: Remove temporally files in the tests.
-
- * test/ruby/test_rubyoptions.rb: Ditto.
-
- * test/logger/test_logger.rb: Ditto.
-
- * test/psych/test_psych.rb: Ditto.
-
- * test/readline/test_readline.rb: Ditto.
-
- * test/syslog/test_syslog_logger.rb: Ditto.
-
- * test/webrick/test_httpauth.rb: Ditto.
-
- * test/zlib/test_zlib.rb: Ditto.
-
-Sun Mar 24 05:36:29 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/ring.rb: Added documentation for multicast support.
-
- * NEWS: Point to above documentation.
-
-Sun Mar 24 05:32:39 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rinda/test_rinda.rb: Restore tests commented out while fixing
- test slowdown bug before r39895.
-
-Sun Mar 24 05:03:36 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/ring.rb: Add multicast support to Rinda::RingFinger and
- Rinda::RingServer. [ruby-trunk - Bug #8073]
- * test/rinda/test_rinda.rb: Test for the above.
-
- * NEWS: Update with Rinda multicast support
-
-Sun Mar 24 04:13:27 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rinda/test_rinda.rb: Fixed test failures in r39890 and r39891
- due to stopping DRb service.
-
-Sun Mar 24 03:34:02 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/rinda.rb: Fixed loss of tuple when remote is alive but the
- call stack was unwound. Patch by Joel VanderWerf.
- [ruby-trunk - Bug #8125]
- * test/rinda/test_rinda.rb: Test for the above.
-
-Sun Mar 24 02:14:53 2013 Tanaka Akira <akr@fsij.org>
-
- * test/mkmf/test_have_macro.rb: remove temporally files in the tests.
-
-Sat Mar 23 23:50:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (kprintf): added from FreeBSD libstand's printf.
- this is consided as async signal safe function.
-
- * addr2line.c (rb_dump_backtrace_with_lines): use kfprintf.
- [Bug #8144] [ruby-core:53632]
-
-Sat Mar 23 23:28:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P
- instead of (VALUE)0 as a return value.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_div): ditto.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_remainder): ditto.
-
-Sat Mar 23 17:39:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (check_funcall_respond_to): preserve passed_block, which
- is modified in vm_call0_body() via vm_call0(), and caused a bug of
- rb_check_funcall() by false negative result of rb_block_given_p().
- re-fix [ruby-core:53650] [Bug #8153].
- [ruby-core:53653] [Bug #8154]
-
-Fri Mar 22 17:48:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/forwardable.rb (Forwardable::FILE_REGEXP): create regexp object
- outside sources for eval, to reduce allocations in def_delegators
- wrappers. //o option does not make each regexps shared. patch by
- tmm1 (Aman Gupta) in [ruby-core:53620] [Bug #8143].
-
-Fri Mar 22 17:38:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (rb_feature_p), vm_core.h (rb_vm_struct): turn
- loaded_features_index into st_table. patches by tmm1 (Aman Gupta)
- in [ruby-core:53251] and [ruby-core:53274] [Bug #8048]
-
-Fri Mar 22 10:29:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c: Fix style.
-
-Fri Mar 22 05:30:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (ambiguous_operator): refine warning message, since this
- warning is shown after literal too.
-
-Fri Mar 22 04:51:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_keyword_arg): should check required
- keyword arguments even if rest hash is defined. [ruby-core:53608]
- [Bug #8139]
-
-Fri Mar 22 01:00:17 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * process.c (rb_execarg_addopt, run_exec_pgroup): use rb_pid_t
- instead of pid_t.
-
- * ext/pty/pty.c (raise_from_check, pty_check): ditto.
-
-Fri Mar 22 00:04:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (rb_dump_backtrace_with_lines): output line at once.
-
-Thu Mar 21 23:17:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (ruby_kill): get rid of deadlock on signal 0.
- [ruby-dev:47182] [Bug #8137]
-
-Thu Mar 21 22:39:46 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * marshal.c (marshal_dump, marshal_load): workaround for segv on
- Intel Solaris compiled with Oracle SolarisStudio 12.3.
- Partly revert r38174. [ruby-core:52042] [Bug #7805]
-
-Thu Mar 21 16:48:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (simple_re_meta): escape all closing characters, not only
- round parenthesis. [ruby-core:53578] [Bug #8133]
-
-Thu Mar 21 13:50:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_core.h (UNINITIALIZED_VAR): suppress warnings by clang 4.2.
- [ruby-core:51742] [Bug #7756]
-
-Thu Mar 21 07:34:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/date/date_core.c: Typo in Date::MONTHNAMES by Matt Gauger
- [GH fixes #261]
-
-Wed Mar 20 22:53:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (find_library): fix to format message.
- [ruby-core:53568] [Bug #8130]
-
-Wed Mar 20 22:52:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (install_dirs, with_destdir): prefix with DESTDIR
- directories to install only unless bundled extension libraries.
- [ruby-core:53502] [Bug #8115]
-
-Wed Mar 20 17:47:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup):
- allow using different root for source and build directories.
- this may fixes a minor problem of r39834.
-
-Wed Mar 20 16:40:48 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_signal.rb (test_hup_me): skip if HUP isn't supported.
- On Windows this test causes ArgumentError.
-
-Wed Mar 20 16:24:12 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/rubygems/test_gem_installer.rb (test_install_extension_flat):
- use ruby in build directory in case ruby is not installed.
- [ruby-core:53265] [Bug #8058]
-
-Wed Mar 20 15:22:07 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup): use
- relative path to get rid of "too long commandline" error.
-
-Wed Mar 20 04:27:42 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/rinda/test_rinda.rb: remove unused variables.
- patched by Vipul A M <vipulnsward@gmail.com>
-
-Wed Mar 20 04:15:32 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/bigdecimal/bigdecimal.c: fixed typo.
- patched by Vipul A M <vipulnsward@gmail.com>
-
-Sat Mar 16 03:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_signal.rb (test_hup_me): added a few comments.
-
-Sat Mar 16 03:39:38 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (ruby_kill): added a few comments.
-
-Sat Mar 16 03:36:56 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (ruby_kill): release GVL while waiting signal delivered.
-
-Tue Mar 19 19:50:48 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ruby_kill (internal.h, thread.c): use rb_pid_t instead of pid_t.
- this fixes the build failure of mswin introduced at r39819.
-
-Tue Mar 19 17:09:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_conv_enc_opts): convert with one converter, instead
- of re-creating converters for each buffer expansion.
-
-Tue Mar 19 17:06:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): compose HFS file names from UTF8-MAC.
- [ruby-core:48745] [Bug #7267]
-
-Sat Mar 16 01:44:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * internal.h: added a declaration of ruby_kill().
- * thread.c (ruby_kill): helper function of kill().
-
- * signal.c (rb_f_kill): use ruby_kill() instead of kill().
- * signal.c (rb_f_kill): call rb_thread_execute_interrupts()
- to ensure that make SignalException if sent a signal
- to myself. [Bug #7951] [ruby-core:52864]
-
- * vm_core.h (typedef struct rb_thread_struct): added
- th->interrupt_cond.
- * thread.c (rb_threadptr_interrupt_common): added to
- initialization of th->interrupt_cond.
- * thread.c (thread_create_core): ditto.
-
- * test/ruby/test_signal.rb (TestSignal#test_hup_me): test for
- the above.
-
-Sat Mar 16 00:42:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (linux_iocparm_len): enable only exist _IOC_SIZE().
- Because musl libc doesn't have it. [Bug #8051] [ruby-core:53229]
-
-Tue Mar 19 10:05:04 2013 Shota Fukumori <her@sorah.jp>
-
- * ext/objspace/objspace.c: Fix typo in doc. Patch by Sho Hashimoto.
- [Bug #8116] [ruby-dev:47177]
-
-Tue Mar 19 02:13:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * configure.in: set ac_cv_prog_cxx if CXX is supplied.
-
-Tue Mar 19 01:18:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * configure.in: Fix c++ compiler auto-selection not only for
- Darwin 11.x, but also the other versions of Darwin.
-
-Tue Mar 19 00:26:22 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: Improve accuracy of objspace_live_num() and
- allocated/freed counters. patched by tmm1(Aman Gupta).
- [Bug #8092] [ruby-core:53392]
-
-Mon Mar 18 21:42:48 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta).
- [Bug #8093] [ruby-core:53393]
-
-Mon Mar 18 17:58:36 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: Fix unlimited memory growth with large values of
- RUBY_FREE_MIN. patched by tmm1(Aman Gupta).
- [Bug #8095] [ruby-core:53405]
-
-Mon Mar 18 14:46:19 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/win32ole/test_err_in_callback.rb
- (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
- the top of build directory.
-
-Mon Mar 18 13:29:52 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_dump.c (backtrace): on darwin use custom backtrace() to trace
- beyond _sigtramp. darwin's backtrace can't trace beyond signal
- trampoline with sigaltstack.
-
- * configure.in: check execinfo.h on darwin.
-
-Mon Mar 18 11:03:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_exec.h (END_INSN): revert r39517 because the segv seems fixed by
- r39806.
-
-Mon Mar 18 10:41:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_exec.c: Correct predefined macro name. This typo is introduced by
- r36534 and should be backported to ruby_2_0_0.
-
-Mon Mar 18 03:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c: Typo in Array#delete by Timo Sand [GH fixes #258]
-
-Mon Mar 18 01:14:56 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (io_fillbuf): show fd number on failure to debug.
- http://c5632.rubyci.org/~chkbuild/ruby-trunk/log/20130316T050302Z.diff.html.gz
-
-Sun Mar 17 02:38:21 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/date/date_core.c: include sys/time.h for avoiding implicit
- declaration of gettimeofday().
-
-Sun Mar 17 00:55:31 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/missing.h: removed __linux__. it's unnecessary.
-
-Fri Mar 15 14:57:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c: disabled _FORTIFY_SOURCE for avoid to hit glibc bug.
- [Bug #8080] [ruby-core:53349]
- * test/ruby/test_io.rb (TestIO#test_io_select_with_many_files):
- test for the above.
-
-Wed Mar 13 15:16:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/missing.h (__syscall): moved to...
- * io.c: here. because __syscall() is only used from io.c.
-
- * include/ruby/missing.h: move "#include <sys/type.h>" to ....
- * include/ruby/intern.h: here. because it was introduced for
- fixing NFDBITS issue. [ruby-core:05179].
-
-Wed Mar 13 14:38:53 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/missing.h (struct timespec): include <sys/time.h>
-
-Wed Mar 13 13:54:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: check struct timeval exist or not.
- * include/ruby/missing.h (struct timeval): check HAVE_STRUCT_TIMEVAL
- properly. and don't include sys/time.h if struct timeval exist.
-
- * file.c: include sys/time.h explicitly.
- * random.c: ditto.
- * thread_pthread.c: ditto.
- * time.c: ditto.
- * ext/date/date_strftime.c: ditto.
-
-Fri Mar 15 14:45:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in (_FORTIFY_SOURCE): added a few comments.
-
-Fri Mar 15 14:17:55 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (numberof): renamed from ARRAY_SIZE() because
- other all files use numberof().
-
-Say Mar 15 01:33:00 2013 Charles Oliver Nutter <headius@headius.com>
-
- * test/ruby/test_lazy_enumerator.rb (TestLazyEnumerator#test_drop_while):
- Modify while condition to show dropping remains off after first false
- value. This change was made in 39711.
-
-Fri Mar 15 23:06:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * time.c (GetTimeval): check if already initialized instance.
-
- * time.c (GetNewTimeval): check if newly created instance.
-
- * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must
- be newly created instance. [ruby-core:53436] [Bug #8099]
-
-Fri Mar 15 14:51:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_sys_fail_path_with_func): share same function, and path
- may be nil.
-
-Fri Mar 15 08:24:51 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (rb_sys_fail_path): define & use rb_sys_fail_path0 like r39752
-
-Fri Mar 15 04:08:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * proc.c: Typo in Proc.arity found by Jack Nagel [Bug #8094]
-
-Thu Mar 14 16:59:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_function_name_string): macro for function name
- string predefined identifier, __func__ in C99, or __FUNCTION__ in
- gcc.
-
- * file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING.
-
-Thu Mar 14 14:12:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC.
- __func__ is C99 feature.
-
-Thu Mar 14 12:59:59 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (rb_sys_fail_path0): add to append the name of called function
- to ease debugging for example blow umask_spec failure.
- http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20130309T010202Z.diff.html.gz
-
- * file.c (rb_sys_fail_path): use rb_sys_fail_path0.
-
-Thu Mar 14 12:53:15 2013 Luis Lavena <luislavena@gmail.com>
-
- * win32/file.c (get_user_from_path): add internal function that retrieves
- username from supplied path (refactored).
- * win32/file.c (rb_file_expand_path_internal): refactor expansion of user
- home to use get_user_from_path and cover dir_string corner cases.
- [ruby-core:53168] [Bug #8034]
-
-Thu Mar 14 11:53:01 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * NEWS: describe RUBY_HEAP_SLOTS_GROWTH_FACTOR.
-
-Thu Mar 14 10:01:12 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/globals.rdoc: $? is thread-local
-
-Wed Mar 13 23:25:59 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: allow to tune growth of heap by environment variable
- RUBY_HEAP_SLOTS_GROWTH_FACTOR. patched by tmm1(Aman Gupta).
- [Feature #8015] [ruby-core:53131]
-
-Wed Mar 13 19:43:46 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * doc/irb/irb.rd.ja: fix typo
-
- * ext/tk/MANUAL_tcltklib.eng: fix typos
-
- * ext/tk/sample/tktextframe.rb (Tk#component_delegates): fix typo
-
-Wed Mar 13 15:13:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_obj_singleton_methods): collect methods from the origin
- class. [ruby-core:53207] [Bug #8044]
-
-Wed Mar 13 14:51:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_export_method): directly override the flag of method
- defined in prepending class too, not adding zsuper entry.
- [ruby-core:53106] [Bug #8005]
-
-Wed Mar 13 13:06:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rm, shvar_to_cpp, unexpand_shvar): local is not
- available on old shells.
-
- * configure.in (shvar_to_cpp): escape quotes for old shells.
- [Bug #7959] [Bug #8071]
-
-Wed Mar 13 11:11:07 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * object.c (Init_Object): remove Module#used, which has been
- introduced in Ruby 2.0 by mistake. [Bug #7916] [ruby-core:52719]
-
-Wed Mar 13 05:49:29 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/irb.rb: Fix typo
-
-Tue Mar 12 22:20:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_set_arguments, iseq_compile_each): support required
- keyword arguments. [ruby-core:51454] [Feature #7701]
-
- * iseq.c (rb_iseq_parameters): ditto.
-
- * parse.y (f_kw, f_block_kw): ditto. this syntax is still
- experimental, the notation may change.
-
- * vm_core.h (rb_iseq_struct): ditto.
-
- * vm_insnhelper.c (vm_callee_setup_keyword_arg): ditto.
-
-Tue Mar 12 17:02:53 2013 TAKANO Mitsuhiro <tak@no32.tk>
-
- * date_core.c: clearly specify operator precedence.
-
-Tue Mar 12 17:00:45 2013 TAKANO Mitsuhiro <tak@no32.tk>
-
- * insns.def: fix condition.
-
-Tue Mar 12 16:48:19 2013 TAKANO Mitsuhiro <tak@no32.tk>
-
- * rational.c: fix dangling if, else-if and else.
-
-Tue Mar 12 06:27:59 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/setup_command.rb: Don't delete non-rubygems
- files when installing RubyGems.
- * test/rubygems/test_gem_commands_setup_command.rb: Test for the
- above.
-
- * lib/rubygems/ext/ext_conf_builder.rb: Use full path to siteconf.rb
- in case the extconf.rb changes directories (like memcached does).
-
- * lib/rubygems/package.rb: Remove double slash from path.
- * test/rubygems/test_gem_package.rb: Test for the above.
- * test/rubygems/test_gem_package_old.rb: ditto.
-
- * lib/rubygems/source.rb: Revert automatic HTTPS upgrade
- * lib/rubygems/spec_fetcher.rb: ditto.
- * test/rubygems/test_gem_remote_fetcher.rb: ditto.
- * test/rubygems/test_gem_source.rb: ditto.
- * test/rubygems/test_gem_spec_fetcher.rb: ditto.
-
-Tue Mar 12 02:25:19 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/smtp.rb: Added Net::SMTP#rset method to implement the SMTP
- RSET command. [ruby-trunk - Feature #5373]
- * NEWS: ditto.
- * test/net/smtp/test_smtp.rb: Test for the above.
-
-Mon Mar 11 22:44:57 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv-replace.rb (TCPSocket#initialize): resolve the 3rd
- argument only if non-nil value is given.
- [ruby-dev:47150] [ruby-trunk - Bug #8054] reported and analyzed by
- mrkn.
-
-Mon Mar 11 19:22:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/mkmf/base.rb: class name conflict.
-
-Mon Mar 11 18:45:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enumerator.c (enumerator_with_index): try to convert given offset to
- integer. fix bug introduced in r39594.
-
-Mon Mar 11 17:27:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/ruby/envutil.rb (EnvUtil.with_default_external): add for
- changing Encoding.default_external without warnings.
-
- * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto.
-
- * test/ruby/test_io_m17n.rb: use above with_default_external.
-
-Mon Mar 11 16:57:00 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (extract_binmode): raise error even if binmode and textmode
- don't conflict. [Bug #5918] [ruby-core:42199]
-
-Mon Mar 11 12:25:12 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Merge Onigmo d4bad41e16e3eccd97ccce6f1f96712e557c4518.
- fix lookbehind assertion fails with /m mode enabled. [Bug #8023]
- fix \Z matches where it shouldn't. [Bug #8001]
-
-Mon Mar 11 11:53:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#dir_config, MakeMakefile#_libdir_basename):
- defer use of instance variable until needed. [Bug #8074]
-
-Thu Mar 7 10:42:28 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/thread.rb (Queue#clear): return self.
- Patch by Cubing Cube. Thank you! [Bug #7947] [ruby-dev:47098]
- * lib/thread.rb (Queue#push): ditto.
- * lib/thread.rb (SizedQueue#push): ditto.
- * test/thread/test_queue.rb: add tests for the above.
-
-Thu Mar 7 10:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * tool/change_maker.rb (#diff2index): check Encoding::BINARY.
- BASERUBY may still be 1.8.x.
-
-Thu Mar 7 08:47:42 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * NEWS (Mutex#owned?): no longer experimental.
-
-Sun Mar 10 23:38:15 2013 Luis Lavena <luislavena@gmail.com>
-
- * win32/file.c (rb_file_expand_path_internal): Expand home directory when
- used as second parameter (dir_string). [ruby-core:53168] [Bug #8034]
- * test/ruby/test_file_exhaustive.rb: add test to verify.
-
-Sun Mar 10 23:27:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
- it is impossible to predict which file will be installed to where,
- by the arguments, so use intermediate destination directory always.
- [Bug #7698]
-
-Sun Mar 10 17:00:22 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: edited rdoc.
- * rational.c: ditto.
-
-Sun Mar 10 15:02:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * process.c (setup_communication_pipe): remove unused function.
- it was unintentionally added r39683.
-
-Wed Mar 6 00:30:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * tool/gen_ruby_tapset.rb: add tapset generator.
-
-Wed Mar 6 03:27:43 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * probes.d (symbol-create): change argument name `string' to
- `str'. `string' is a keyword for systemtap.
-
-Tue Mar 5 22:23:01 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * probes.d: added argument name
-
-Thu Mar 7 01:17:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/thread/test_queue.rb (TestQueue#test_thr_kill): reduce
- iterations from 2000 to 250. When running on uniprocessor
- systems, every th.kill needs TIME_QUANTUM_USEC time (i.e.
- 100msec on posix systems). Because, "r.read 1" is 3 steps
- operations that 1) release GVL 2) read 3) acquire gvl and
- (1) invoke context switch to main thread. and then, main
- thread's th.kill resume (1), but not (2). Thus read interrupt
- need TIME_QUANTUM_USEC. Then maximum iteration is 30sec/100msec
- = 300.
-
-Thu Mar 7 00:14:51 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_update_max_fd): use ATOMIC_CAS because this function
- is used from timer thread too.
-
-Wed Mar 6 23:30:21 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (ARRAY_SIZE): new.
- * thread_pthread.c (gvl_acquire_common): use low priority
- notification for avoiding timer thread interval confusion.
- If we use timer_thread_pipe[1], every gvl_yield() request
- one more gvl_yield(). It lead to thread starvation.
- [Bug #7999] [ruby-core:53095]
- * thread_pthread.c (rb_reserved_fd_p): adds timer_thread_pipe_low
- to reserved fds.
-
-Wed Mar 6 22:36:19 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (rb_thread_wakeup_timer_thread_fd): add fd
- argument and remove hardcoded dependency of timer_thread_pipe[1].
- * thread_pthread.c (consume_communication_pipe): add fd argument.
- * thread_pthread.c (close_communication_pipe): ditto.
-
- * thread_pthread.c (timer_thread_sleep): adjust the above changes.
-
- * thread_pthread.c (setup_communication_pipe_internal): factor
- out pipe initialize logic.
-
-Wed Mar 6 22:56:14 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (ubf_select): add to small comments why we
- need to call rb_thread_wakeup_timer_thread().
-
-Wed Mar 6 21:42:24 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (rb_thread_create_timer_thread): factor out
- creating communication pipe logic into separate function.
- * thread_pthread.c (setup_communication_pipe): new helper function.
- * thread_pthread.c (set_nonblock): moves a definition before
- setup_communication_pipe.
-
-Sun Mar 3 02:42:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (consume_communication_pipe): retry when
- read returned CCP_READ_BUFF_SIZE.
-
-Wed Mar 6 21:31:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (timer_thread_sleep): use poll() instead of
- select(). select doesn't work if timer_thread_pipe[0] is
- greater than FD_SETSIZE.
- * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): add a dependency
- against poll.
-
-Wed Mar 6 21:00:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
- ifdef conditions.
-
-Sun Mar 3 02:30:36 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (set_nonblock): new helper function for set
- O_NONBLOCK.
- * thread_pthread.c (rb_thread_create_timer_thread): set O_NONBLOCK
- to timer_thread_pipe[0] too.
-
-Sun Mar 10 09:12:51 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: described syntax of string form.
- * rational.c: ditto.
-
-Sat Mar 9 11:58:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_extended): check for prepended object.
- [ruby-core:53206] [Bug #8043]
-
-Sat Mar 9 08:36:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (features_index_add_single, rb_feature_p): store single index
- as Fixnum to reduce the number of arrays for the indexes. based on
- the patch by tmm1 (Aman Gupta) in [ruby-core:53216] [Bug #8048].
-
-Sat Mar 9 00:25:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (r_object0): load prepended objects. treat the class of
- extended object in the included modules as prepended singleton
- class. [ruby-core:53202] [Bug #8041]
-
-Fri Mar 8 19:44:00 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * man/rake.1, man/ruby.1: Use the Pa macro to make URLs stand out.
-
-Fri Mar 8 13:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/pathname/pathname.c (path_f_pathname): rdoc for Pathname()
-
-Fri Mar 8 12:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * man/rake.1: Document ENVIRONMENT variables on RAKE(1) manpage
-
-Fri Mar 8 10:44:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/webrick/httpproxy.rb: Fix typos in HTTPProxyServer [Bug #8013]
- Patch by Nobuhiro IMAI [ruby-core:53127]
-
-Fri Mar 8 03:16:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * class.c (rb_mod_ancestors): Include singleton_class in ancestors
- list [Feature #8035]
-
- * test/ruby/test_module.rb (class): test for above
-
- * test/ruby/marshaltestlib.rb (module): adapt test
-
- * NEWS: list change
-
-Thu Mar 7 14:21:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): pass keyword arguments to zsuper,
- with current values. [ruby-core:53114] [Bug #8008]
-
-Thu Mar 7 12:53:47 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/setup_command.rb: Install .pem files.
- * test/rubygems/test_gem_commands_setup_command.rb: Test for the
- above.
-
- * lib/rubygems/spec_fetcher.rb: Test HTTPS upgrade with URI::HTTPS,
- not URI::HTTP. Fixes bug in automatic HTTPS upgrade.
- * test/rubygems/test_gem_spec_fetcher.rb: Test for the above.
-
- * lib/rubygems.rb: Version 2.0.2
-
- * lib/rubygems/test_utilities.rb: Ensure scheme and uri class match.
-
-Thu Mar 7 10:39:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (gem): Gem.ensure_gem_subdirectories now has mode
- option since r39607. refix of r38870.
-
-Wed Mar 6 13:14:28 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_gem_spec_fetcher.rb: Removed unused variable.
-
-Wed Mar 6 08:10:15 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_require.rb: Fix tests when 'a.rb' exists.
- [ruby-trunk - Bug #7749]
-
-Wed Mar 6 08:00:59 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Allow specification of directory permissions.
- [ruby-trunk - Bug #7713]
- * test/rubygems/test_gem.rb: Test for the above.
-
-Wed Mar 6 07:40:21 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/query_command.rb: Only fetch remote specs when
- showing details. [ruby-trunk - Bug #8019] RubyGems bug #487
- * lib/rubygems/remote_fetcher.rb: ditto.
- * lib/rubygems/security/policy.rb: ditto.
- * test/rubygems/test_gem_commands_query_command.rb: Test for the
- above.
-
- * lib/rubygems/security.rb: Make OpenSSL optional for RubyGems.
- * lib/rubygems/commands/cert_command.rb: ditto.
-
- * lib/rubygems/config_file.rb: Display file with YAML error, not
- ~/.gemrc
-
- * lib/rubygems/remote_fetcher.rb: Only create gem subdirectories when
- installing gems.
- * lib/rubygems/dependency_resolver.rb: ditto.
- * lib/rubygems/test_utilities.rb: ditto.
- * test/rubygems/test_gem_commands_fetch_command.rb: Test for the
- above.
-
- * lib/rubygems/spec_fetcher.rb: Only try to upgrade
- http://rubygems.org to HTTPS
- * test/rubygems/test_gem_spec_fetcher.rb: Test for the above.
-
- * lib/rubygems.rb: Update win_platform? check for JRuby compatibility.
-
- * test/rubygems/test_gem_installer.rb: Update for Ruby 1.9.2
- compatibility
-
-Wed Mar 6 01:19:28 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * enumerator.c (enumerator_with_index, lazy_take): use INT2FIX(0)
- instead of INT2NUM(0).
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): ditto.
-
- * ext/fiddle/function.c (function_call): ditto.
-
- * ext/openssl/ossl_x509store.c (ossl_x509store_initialize): ditto.
-
- * process.c (proc_getsid): ditto.
-
- * transcode.c (econv_finish): ditto.
-
-Tue Mar 5 21:36:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_prepend_module): check redefinition of built-in optimized
- methods. [ruby-dev:47124] [Bug #7983]
-
- * vm.c (rb_vm_check_redefinition_by_prepend): ditto.
-
-Tue Mar 5 20:29:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mnew): revert r39224. [ruby-core:53038] [Bug #7988]
-
-Tue Mar 5 20:23:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/intern.h (rb_check_arity): make a static inline
- function so it can be used as an expression and argc would be
- evaluated only once.
-
-Tue Mar 5 12:30:55 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Bump version to 2.0.1 for upcoming bugfix release
-
- * lib/rubygems/ext/ext_conf_builder.rb: Restore ruby 1.8 compatibility
- for [Bug #7698]
- * test/rubygems/test_gem_installer.rb: Ditto.
-
- * lib/rubygems/package.rb: Restore ruby 1.8 compatibility.
-
- * test/rubygems/test_gem_dependency_installer.rb: Fix warnings
-
-Tue Mar 5 12:24:23 2013 Eric Hodel <drbrain@segment7.net>
-
- * enumerator.c (enumerator_with_index): Restore handling of a nil memo
- from r39594.
-
-Tue Mar 5 10:40:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/objspace/objspace.c (count_nodes): count also newly added nodes,
- and fix key for unknown node. patch by tmm1 (Aman Gupta) in
- [ruby-core:53130] [Bug #8014]
-
-Tue Mar 5 10:20:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
- get rid of conversion exception and integer overflow.
- [ruby-dev:47131] [Bug #8010]
-
- * numeric.c (rb_int_succ, rb_int_pred): shortcut optimization for
- Bignum.
-
-Tue Mar 5 10:02:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
- clear DESTDIR so RUBYARCHDIR and RUBYLIBDIR are not be overridden.
- [Bug #7698]
-
-Mon Mar 4 15:33:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
- fix for unusual cases again. install to a temporary directory once
- and move installed files to the destination directory, if it is same
- as the current directory. [Bug #7698]
-
-Mon Mar 4 14:13:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in (miniruby, ruby): move MAINLIBC because linker arguments
- must appear after object files with newer versions of gcc. patch by
- tmm1 (Aman Gupta) in [ruby-core:53121] [Bug #8009]
-
-Mon Mar 4 10:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * encoding.c: Typo in Encoding overview by Tom Wardrop [GH fixes #255]
-
-Sun Mar 3 12:35:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#libpath_env): set runtime library path for
- the case rpath is disabled.
-
-Sun Mar 3 12:17:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rubygems/ext/ext_conf_builder.rb
- (Gem::Ext::ExtConfBuilder.hack_for_obsolete_style_gems): remove
- circular dependencies in install-so too. [ruby-core:52882]
- [Bug #7698]
-
-Sun Mar 3 07:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/socket/tcpserver.c: Grammar for TCPServer.new from r39554
-
-Sun Mar 3 01:17:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rubygems/ext/ext_conf_builder.rb
- (Gem::Ext::ExtConfBuilder.hack_for_obsolete_style_gems): remove
- circular dependencies for old style gems which locate extconf.rb on
- the toplevel. [ruby-core:53059] [ruby-trunk - Bug #7698]
-
- * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
- use RUBYOPT instead of -r option, and revert some tests. [Bug #7698]
-
- * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
- revert use of temporary directory for build, to work some buggy
- extconf.rb which cannot build outside the source directory.
- [ruby-core:53056] [Bug #7698]
-
-Sun Mar 3 00:04:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/depend (CPPFLAGS), lib/mkmf.rb (MakeMakefile#create_makefile):
- define RUBY_EXPORT for static-linked-ext mswin. [Bug #7960]
-
-Sat Mar 2 22:49:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (ENCOBJS, EXTOBJS, config.h): definitions for
- static-linked-ext. [Bug #7960]
-
-Sat Mar 2 17:34:19 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/utils.rb: use Socket.tcp_server_sockets to create server
- sockets.
- fix [Bug #7100] https://bugs.ruby-lang.org/issues/7100
- reported by sho-h (Sho Hashimoto).
-
-Sat Mar 2 02:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c: typo in comment patch by Nami-Doc [Github fixes #253]
-
-Sat Mar 2 01:33:17 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
- v5.13.3 [Bug#7972] [Bug#7974]
-
-Fri Mar 1 11:09:06 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/fileutils.rb: Revert r34669 which altered the way
- metaprogramming in FileUtils occurred. [ruby-trunk - Bug #7958]
-
- * test/fileutils/visibility_tests.rb: Refactored tests of FileUtils
- options modules to expose bug found in #7958
- * test/fileutils/test_dryrun.rb: ditto.
- * test/fileutils/test_nowrite.rb: ditto.
- * test/fileutils/test_verbose.rb: ditto.
-
-Fri Mar 1 09:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/psych.rb: specify in rdoc what object is returned in parser
- By Adam Stankiewicz [Github tenderlove/psych#133]
-
-Fri Mar 1 07:21:41 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/ext/builder.rb: Fix incompatibilities when installing
- extensions. Patch by Nobu.
- [ruby-trunk - Bug #7698] [ruby-trunk - Bug #7971]
- * lib/rubygems/ext/ext_conf_builder.rb: ditto.
- * lib/rubygems/installer.rb: ditto.
- * test/rubygems/test_gem_ext_ext_conf_builder.rb: Test for the above.
- * test/rubygems/test_gem_installer.rb: ditto.
-
- * lib/rubygems/commands/sources_command.rb: Prefer HTTPS over HTTP.
- * lib/rubygems/defaults.rb: ditto
- * lib/rubygems/dependency_resolver.rb: Ditto.
- * lib/rubygems/source.rb: ditto.
- * lib/rubygems/spec_fetcher.rb: ditto.
- * lib/rubygems/specification.rb: ditto.
- * lib/rubygems/test_utilities.rb: ditto.
- * test/rubygems/test_gem.rb: Test for the above.
- * test/rubygems/test_gem_commands_sources_command.rb: ditto.
- * test/rubygems/test_gem_dependency_resolver_api_set.rb: ditto.
- * test/rubygems/test_gem_remote_fetcher.rb: ditto.
- * test/rubygems/test_gem_source.rb: ditto.
- * test/rubygems/test_gem_spec_fetcher.rb: ditto.
-
-Fri Mar 1 03:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/psych/lib/psych.rb: rdoc for Psych overview by Adam Stankiewicz
- [Github tenderlove/psych#134]
-
-Thu Feb 28 22:57:48 2013 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (iseq_compile_each): remove redundant trace(line)
- instruction. for example, at the following script
- def m()
- p:xyzzy
- 1
- 2
- end
- compiler ignores `1' because there is no effect. However,
- `trace(line)' instruction remains in bytecode.
- This modification removes such redundant trace(line) instruction.
-
- * test/ruby/test_iseq.rb: add a test.
-
-Thu Feb 28 22:23:27 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/raddrinfo.c (inspect_sockaddr): don't show that Unix
- domain socket filename is bigger than sizeof(sun_path).
- This limit is not rigid on some platforms such as Darwin and SunOS.
-
-Thu Feb 28 21:33:01 2013 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * configure.in(AC_DISABLE_OPTION_CHECKING): avoid warning "WARNING:
- Unrecognized options: --with-PACKAGE".
-
-Thu Feb 28 20:22:04 2013 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (iseq_data_to_ary): fix condition.
- r34303 introduces a bug to avoid all line information from
- a result of ISeq#to_a. This is a regression problem from 2.0.0p0.
-
- * test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a.
-
-Thu Feb 28 08:20:33 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/available_set.rb: Undent for style
-
- * lib/rubygems/dependency_installer.rb: Pick latest prerelease gem to
- install. Fixes RubyGems bug #468.
- * test/rubygems/test_gem_dependency_installer.rb: Test for the above.
-
- * lib/rubygems/dependency_installer.rb: Don't display "Done installing
- documentation" if documentation will not be installed.
- * lib/rubygems/rdoc.rb: ditto
-
- * lib/rubygems/dependency_list.rb: Use Array#concat for Ruby 1.x
- performance.
-
- * lib/rubygems/installer.rb: Use formatted program name when comparing
- executables. RubyGems pull request #471
- * test/rubygems/test_gem_installer.rb: Test for the above.
-
- * lib/rubygems/package.rb: Use more explicit feature check to work
- around JRuby bug #552
-
- * lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem: Added GeoTrust root
- certificate.
-
- * test/rubygems/test_gem_source_list.rb: Use "example" instead of real
- hostname
-
-Thu Feb 28 05:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: rdoc formatting for Thread, ThreadGroup, and ThreadError
-
-Thu Feb 28 02:42:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm.c: Typo in overview for example of Thread#status returning false
- Reported by Lee Jarvis
-
-Wed Feb 27 22:54:27 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h (union_sockaddr): make it longer for SunOS
- and Darwin.
-
-Wed Feb 27 21:14:34 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/security.rb (REXML::Security): create.
- * lib/rexml/rexml.rb: move entity_expansion_limit and
- entity_expansion_text_limit accessors to ...
- * lib/rexml/security.rb: ... here.
- * lib/rexml/document.rb: use REXML::Security.
- * lib/rexml/text.rb: use REXML::Security.
- * test/rexml/test_document.rb: use REXML::Security.
-
-Wed Feb 27 19:53:32 2013 Benoit Daloze <eregontp@gmail.com>
-
- * vm.c (Thread): fix typos in overview
-
-Wed Feb 27 13:21:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm.c (Thread): Typo in overview, swap setting and getting
-
-Wed Feb 27 13:02:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm.c (Thread): Documentation overview of Thread class
-
-Wed Feb 27 12:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c (rb_thread_wakeup): rdoc formatting
-
-Wed Feb 27 12:53:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c (rb_thread_group): rdoc formatting
-
-Wed Feb 27 12:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/ostruct.rb: Typo in OpenStruct overview [Github Fixes #251]
- Patch by Chun-wei Kuo
-
-Wed Feb 27 12:13:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_exec.h (END_INSN): llvm-gcc may optimize out reg_cfp and cause
- Stack/cfp consistency error when the instruction doesn't use reg_cfp.
- Usually instructions use PUSH() but for example trace doesn't.
- This hack cause speed down but you shouldn't use llvm-gcc, use clang.
- [Bug #7938]
-
-Wed Feb 27 10:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c (thread_raise_m): rdoc formatting
-
-Tue Feb 26 23:32:44 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb: move entity_expansion_limit accessor to ...
- * lib/rexml/rexml.rb: ... here for consistency.
- * lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
- deprecated.
- * lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
- deprecated.
-
-Tue Feb 26 23:26:13 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb: move entity_expansion_text_limit accessor to ...
- * lib/rexml/rexml.rb: ... here to make rexml/text independent from
- REXML::Document. It causes circular require.
- * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
- deprecated.
- * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit=):
- deprecated.
- * lib/rexml/text.rb: add missing require "rexml/rexml" for
- REXML.entity_expansion_text_limit.
- Reported by Robert Ulejczyk. Thanks!!! [ruby-core:52895] [Bug #7961]
-
-Tue Feb 26 15:12:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/mkconfig.rb: reconstruct comma separated list values. a
- command line to Windows batch file is split not only by spaces
- and equal signs but also by commas and semicolons.
-
-Tue Feb 26 15:04:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (unexpand_shvar): get rid of non-portable shell
- behavior on OpenBSD, so no extra quotes. [Bug #7959]
-
-Tue Feb 26 10:24:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (IS_LABEL_POSSIBLE): allow labels for keyword arguments just
- after method definition without a parenthesis. [ruby-core:52820]
- [Bug #7942]
-
-Tue Feb 26 04:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * error.c: clarify reason for sleep in SignalException example
-
-Tue Feb 26 03:47:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * error.c: clarify a document of SignalException. Process.kill()
- doesn't have any guarantee when signal will be delivered.
- [Bug #7951] [ruby-core:52864]
-
-Mon Feb 25 23:51:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/version.h: bump RUBY_API_VERSION same as RUBY_VERSION.
-
-Mon Feb 25 21:03:34 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (str_byte_substr): don't set coderange if it's not known.
- [Bug #7954] [ruby-dev:47108]
-
-Mon Feb 25 16:47:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (realclean-local): miniprelude.c is made by srcs, so it
- should not removed by distclean but by realclean. [Bug #6807]
-
-Mon Feb 25 16:30:30 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Lazily load .gem/credentials to only
- check permissions when necessary. RubyGems bug #465
- * test/rubygems/test_gem_config_file.rb: Test for the above.
-
- * test/rubygems/test_gem_commands_push_command.rb: Remove duplicated
- test.
-
-Mon Feb 25 15:47:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/depend (ARFLAGS): VisualC++ linker does not allow spaces between
- output option and the output file name. [Bug #7950]
-
- * enc/depend (RANLIB): set default command to do nothing, or make the
- entire line a label on Windows.
-
-Mon Feb 25 14:41:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#init_mkmf): default libdirname to libdir.
-
- * tool/rbinstall.rb: ditto.
-
-Mon Feb 25 13:12:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (setup): find Setup file from target_os 1. by
- suffix (e.g. Setup.nacl, Setup.atheos), 2. by "platform"
- option (e.g. Setup.nt, Setup.emx), and 3. default Setup. And
- Setup.dj had been removed.
-
-Mon Feb 25 12:48:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Document Thread::new, clean up ::fork and mention calling
- super if subclassing Thread
-
-Mon Feb 25 12:38:50 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: don't test ss_family and ss_len member of
- struct sockaddr_storage. They are not used now except SunOS
- specific code.
-
-Mon Feb 25 11:03:38 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in (unexpand_shvar): Use the numeric comparison
- operator instead of '==' which is a ksh extension. [Bug #7941]
-
-Mon Feb 25 02:37:56 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: define and use union_sockaddr instead of struct
- sockaddr_storage for less casts.
-
- * ext/socket/rubysocket.h (union_sockaddr): defined.
-
- * ext/socket/socket.c (sock_accept): use union_sockaddr.
- (sock_accept_nonblock): ditto.
- (sock_sysaccept): ditto.
- (sock_s_getnameinfo): ditto.
-
- * ext/socket/basicsocket.c (bsock_getsockname): ditto.
- (bsock_getpeername): ditto.
- (bsock_local_address): ditto.
- (bsock_remote_address): ditto.
-
- * ext/socket/ancdata.c (bsock_recvmsg_internal): ditto.
-
- * ext/socket/init.c (recvfrom_arg): ditto.
- (recvfrom_blocking): ditto.
- (rsock_s_recvfrom): ditto.
- (rsock_s_recvfrom_nonblock): ditto.
- (rsock_getfamily): ditto.
-
- * ext/socket/raddrinfo.c (rb_addrinfo_t): ditto.
- (ai_get_afamily): ditto.
- (inspect_sockaddr): ditto.
- (addrinfo_mdump): ditto.
- (addrinfo_mload): ditto.
- (addrinfo_getnameinfo): ditto.
- (addrinfo_ip_port): ditto.
- (extract_in_addr): ditto.
- (addrinfo_ipv6_to_ipv4): ditto.
- (addrinfo_unix_path): ditto.
-
- * ext/socket/tcpserver.c (tcp_accept): ditto.
- (tcp_accept_nonblock): ditto.
- (tcp_sysaccept): ditto.
-
- * ext/socket/ipsocket.c (ip_addr): ditto.
- (ip_peeraddr): ditto.
- (ip_s_getaddress): ditto.
-
-Sun Feb 24 21:15:05 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: [ruby-core:52303]
-
-Sun Feb 24 15:33:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (rb_random_ulong_limited): limit is inclusive, but generic
- rand method should return a number less than it, so increase for the
- difference. [ruby-core:52779] [Bug #7935]
-
-Sun Feb 24 15:32:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (rb_random_ulong_limited): limit is inclusive, but generic
- rand method should return a number less than it, so increase for the
- difference. [ruby-core:52779] [Bug #7935]
-
-Sun Feb 24 15:14:43 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb: Removed duplicate Accept-Encoding in Net::HTTP#get.
- [ruby-trunk - Bug #7924]
- * test/net/http/test_http.rb: Test for the above.
-
-Wed Feb 20 14:28:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Document ThreadGroup::Default
-
-Wed Feb 20 14:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Grammar for #backtrace_locations and ::handle_interrupt
-
-Sun Feb 24 13:35:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_method): block level control frame does not
- have method entry, so obtain the method entry from method top-level
- control frame to be compared with refined method entry.
- [ruby-core:52750] [Bug #7925]
-
-Wed Feb 20 13:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: Document methods receiving string and convert to symbol
- Patch by Stefan Rusterholz
- * vm_eval.c: ditto
- * vm_method.c: ditto
-
-Wed Feb 20 07:20:56 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (sigsegv): suppress unused result warning. Because
- write(2) is marked __warn_unused_result__ on Linux glibc.
-
-Sun Feb 24 07:50:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_set_arguments): no keyword check if any keyword rest
- argument exists, even unnamed. [ruby-core:52744] [Bug #7922]
-
-Sat Feb 23 16:51:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Documentation for Thread#backtrace_locations
-
-Sat Feb 23 16:05:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm.c: Typo in ObjectSpace::WeakMap overview
-
-Sat Feb 23 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Improved rdoc for ::handle_interrupt, ::pending_interrupt?
- and #pending_interrupt?
-
-Sat Feb 23 12:26:43 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-curlies)
- (ruby-electric-matching-char, ruby-electric-bar): Avoid electric
- insertion when there is a prefix argument.
-
- * misc/ruby-electric.el (ruby-electric-insert)
- (ruby-electric-cua-replace-region-p)
- (ruby-electric-cua-replace-region): Avoid electric insertion and
- fall back when cua-mode is enabled and a region is active.
-
-Sat Feb 23 12:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c: Document #<=> return values and formatting
- * bignum.c: ditto
- * file.c: ditto
- * object.c: ditto
- * numeric.c: ditto
- * rational.c: ditto
- * string.c: ditto
- * time.c: ditto
-
-Sat Feb 23 10:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c (rb_ary_diff, rb_ary_and, rb_ary_or): Document return order
- [RubySpec #7803]
-
-Sat Feb 23 10:17:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c (rb_obj_comp): Documenting Object#<=> return values
- Patch by Stefan Rusterholz
-
-Sat Feb 23 09:48:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (file_s_fnmatch, fnmatch_brace): encoding-incompatible pattern
- and string do not match, instead of exception. [ruby-dev:47069]
- [Bug #7911]
-
-Sat Feb 23 08:57:46 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * doc/NEWS-*: Update NEWS from their respective branches
-
-Sat Feb 23 08:14:43 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * NEWS: many additions for Ruby 2.0.0
-
- * object.c: Add doc for Module.prepended
-
-Sat Feb 23 07:52:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/ruby.pc.in: reorder library flags which may refer library
- names. [Bug #7913]
-
-Fri Feb 22 23:46:20 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
- fix a typo in comment in r39384.
-
-Fri Feb 22 18:31:46 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
- new attribute to read/write entity expansion text limit. the default
- limit is 10Kb.
-
- * lib/rexml/text.rb (REXML::Text.unnormalize): check above attribute.
-
-Fri Feb 22 17:36:23 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/test_rbconfig.rb (TestRbConfig): fix r39372.
- It must see RbConfig::CONFIG instead of CONFIG.
-
-Fri Feb 22 14:55:41 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
-
-Fri Feb 22 12:46:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (rb_random_ulong_limited): fix error message for negative
- value. [ruby-dev:47061] [Bug #7903]
-
-Fri Feb 22 11:36:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/test_rbconfig.rb (TestRbConfig): skip user defined values by
- configuration options. [Bug #7902]
-
-Fri Feb 22 11:33:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#init_mkmf): adjust default library path
- for multiarch. [Bug #7874]
-
-Fri Feb 22 11:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * enum.c (Enumerable#chunk: Improved examples, grammar, and formatting
- Patch by Dan Bernier and Rich Bruchal of newhaven.rb
- [Github documenting-ruby/ruby#8]
-
-Fri Feb 22 11:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * numeric.c: Examples and formatting for Numeric and Float
- Based on a patch by Zach Morek and Oren K of newhaven.rb
- [Github documenting-ruby/ruby#5]
-
-Fri Feb 22 07:04:41 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb (build_extensions): Create extension
- install destination before building extension. Patch by Kenta Murata.
- [ruby-trunk - Bug #7897]
- * test/rubygems/test_gem_installer.rb: Test for the above.
-
-Fri Feb 22 06:30:57 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/globals.rdoc: Document what setting $DEBUG does.
-
- * doc/globals.rdoc: Added pointer to $-d for full documentation.
-
-Fri Feb 22 06:27:07 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/globals.rdoc: Document what setting $VERBOSE does. [Bug #7899]
-
- * doc/globals.rdoc: Added pointer to $-w and $-v for full
- documentation.
-
-Fri Feb 22 02:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/abbrev.rb: Add words parameter to Abbrev::abbrev
- Patch by Devin Weaver [Github documenting-ruby/ruby#7]
-
-Thu Feb 21 17:28:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/merger.rb: add interaction when only ChangeLog is modified.
-
-Thu Feb 21 16:34:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (check_stack_overflow): extract duplicated code and get rid
- of declaration-after-statement. [Bug #5014]
-
-Thu Feb 21 14:14:13 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (sigsegv): avoid to use async signal unsafe functions
- when nested sigsegv is happen.
- [Bug #5014] [ruby-dev:44082]
-
-Thu Feb 21 13:47:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (rb_group_member): added an error check. SUS says,
- getgroups(small_value) may return EINVAL.
-
-Thu Feb 21 13:37:07 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * process.c (RB_MAX_GROUPS): moved to
- * internal.h (RB_MAX_GROUPS): here.
-
- * file.c (rb_group_member): use RB_MAX_GROUPS instead of
- RUBY_GROUP_MAX. They are the same.
-
-Thu Feb 21 13:15:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (access_internal): removed.
- * file.c (rb_file_readable_real): use access() instead of
- access_internal().
- * file.c (rb_file_writable_real): ditto.
- * file.c (rb_file_executable_real): ditto.
-
-Thu Feb 21 13:04:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (eaccess): use access() when not using setuid nor setgid.
- This is minor optimization.
-
-Thu Feb 21 12:56:19 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (rb_group_member): get rid of NGROUPS dependency.
- [Bug #7886] [ruby-core:52537]
-
-Thu Feb 21 12:45:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (ruby_init_loadpath_safe): try two levels upper for stripping
- libdir name. [Bug #7874]
-
- * configure.in (libdir_basename): expand with multiarch in configure,
- not to defer the expansion till ruby.pc.in and mkmf.rb. [Bug #7874]
-
- * configure.in (libdir_basename): also -rpath and -install_name flags
- are affected when libruby directory changes. [Bug #7874]
-
-Wed Feb 20 19:27:02 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (HAVE_RB_SCAN_ARGS_OPTIONAL_HASH): for
- rb_scan_args() optional hash feature. [Bug #7861]
-
-Wed Feb 20 18:02:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (target_os): do not strip -gnu suffix on Linux if
- --target is given explicitly. [Bug #7874]
-
- * configure.in (libdirname): adjust library path name which libruby
- files will be installed. [Bug #7874]
-
- * tool/rbinstall.rb (libdir): ditto.
-
-Wed Feb 20 13:37:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/pty/pty.c: Documentation for the PTY module
-
-Wed Feb 20 12:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: Document Data class [Bug #7890] [ruby-core:52549]
- Patch by Matthew Mongeau
-
-Wed Feb 20 11:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/mutex_m.rb: Add rdoc for Mutex_m module
-
-Wed Feb 20 09:34:43 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/update_command.rb: Create the installer after
- options are processed. [ruby-trunk - Bug #7779]
- * test/rubygems/test_gem_commands_update_command.rb: Test for the
- above.
-
-Wed Feb 20 07:51:19 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Use gsub instead of gsub! to avoid
- altering @bin_dir. Fixes tests on windows. [ruby-trunk - Bug #7885]
-
-Tue Feb 19 20:50:00 2013 Kenta MURATA <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.gemspec: bump to 1.2.0.
- [ruby-core:51777] [Bug #7761]
-
-Tue Feb 19 13:07:25 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/syslog/syslog.c (Init_syslog): Define inspect as a singleton
- method and remove it as an instance method. [Bug #6502]
-
-Tue Feb 19 12:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: rdoc formatting for Kernel#Array()
- * array.c: Add rdoc for Array() method to Creating Arrays section
-
-Tue Feb 19 10:35:52 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl.c (class OpenSSL): Use only inner parenthesis in
- create_extension examples.
-
-Tue Feb 19 10:27:12 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl.c (class OpenSSL): Fixed ExtensionFactory example.
- Patch by Richard Bradley. [ruby-trunk - Bug #7551]
-
-Tue Feb 19 08:32:11 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_eval.c (vm_call0_body): check interrupts after method dispatch
- from C methods. [Bug #7878]
-
-Tue Feb 19 08:14:40 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Fixed placement of executables with
- --user-install. [ruby-trunk - Bug #7779]
- * test/rubygems/test_gem_installer.rb: Test for above.
-
-Tue Feb 19 06:04:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace
- beyond signal trampoline, and as described in r38342 it can't
- trace on -O because it see stack frame pointers.
- libunwind unw_backtrace see dwarf information in the binary
- and it works with -O (without frame pointers).
-
- * configure.in: remove r38342's hack and check libunwind.
-
-Tue Feb 19 04:26:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: check whether backtrace(3) works well or not.
-
- * vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE.
-
-Mon Feb 18 16:30:18 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
- parenthesis.
-
-Mon Feb 18 12:32:24 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can
- recognize IPv6 addresses with only one edge 16-bit piece
- compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::].
- [Bug #7477]
-
-Mon Feb 18 10:09:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (unexpand_shvar): regularize a shell variable by
- unexpanding shell variables in it.
-
-Sun Feb 17 20:55:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compar.c (rb_invcmp): compare by inversed comparison, with preventing
- from infinite recursion. [ruby-core:52305] [Bug #7870]
-
- * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite
- recursion.
-
-Sun Feb 17 17:23:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb: remove extra topdir in VPATH, which was in
- win32/Makefile.sub for some reason and moved from there.
- [ruby-dev:46998] [Bug #7864]
-
-Sun Feb 17 01:19:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/psych/lib/psych/y.rb: Document Kernel#y by Adam Stankiewicz
- [Github tenderlove/psych#127]
-
-Sun Feb 17 00:52:14 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/mkconfig.rb: remove prefix from rubyarchdir.
- r39267 expands variables, it changes expansion timing,
- breaks RbConfig::CONFIG["includedir"] and building
- extension libraries with installed ruby.
-
-Sat Feb 16 20:51:17 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (ENV_IN_HEAP_P): fix off-by-one error.
-
-Sat Feb 16 20:47:16 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in (LIBRUBY_DLDFLAGS): Fix a bug where --with-opt-dir
- options given were not reflected to LIBRUBY_DLDFLAGS on many
- platforms including Linux and other GNU-based systems, NetBSD,
- AIX and BeOS.
-
-Sat Feb 16 20:43:20 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ancdata.c (rsock_recvmsg): ignore truncated part of
- socket address returned from recvmsg().
-
- * ext/socket/init.c (recvfrom_blocking): ignore truncated part of
- socket address returned from recvfrom().
- (rsock_s_recvfrom_nonblock): ditto.
-
-Sat Feb 16 20:05:26 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/ruby/test_thread.rb: fixed typo
- patched by Hiroki Matsue via https://github.com/ruby/ruby/pull/248
-
-Sat Feb 16 16:08:35 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_thread_mark): mark a working Proc of bmethod
- (a method defined by define_method) even if the method was removed.
- We could not trace working Proc object which represents the body
- of bmethod if the method was removed (alias/undef/overridden).
- Simply, it was mark miss.
- This patch by Kazuki Tsujimoto. [Bug #7825]
-
- NOTE: We can brush up this marking because we do not need to mark
- `me' on each living control frame. We need to mark `me's
- only if `me' was free'ed. This is future work after Ruby 2.0.0.
-
- * test/ruby/test_method.rb: add a test.
-
-Sat Feb 16 15:45:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * proc.c (rb_binding_new_with_cfp): create binding object even if
- the frame is IFUNC. But return a ruby-level binding to keep
- compatibility.
- This patch fix degradation introduced from r39067.
- [Bug #7774] [ruby-dev:46960]
-
- * test/ruby/test_settracefunc.rb: add a test.
-
-Sat Feb 16 13:40:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (shvar_to_cpp): do not substitute exec_prefix itself
- with RUBY_EXEC_PREFIX, which cause recursive definition.
- [ruby-core:52296] [Bug #7860]
-
-Sat Feb 16 13:13:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/io-console.gemspec: bump to 0.4.2. now explicitly
- requires ruby 1.9.3 or later. [Bug #7847]
-
- * ext/io/console/console.c (console_dev): compatibility with ruby 1.8.
-
- * ext/io/console/console.c (rawmode_opt, console_dev): compatibility
- with ruby 1.9. [ruby-core:52220] [Bug #7847]
-
-Sat Feb 16 12:45:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: unexpand arch sitearch and exec_prefix values, so
- directly specified bindir, libdir, rubyprefix, etc can be properly
- substituted. [ruby-core:52296] [Bug #7860]
-
-Sat Feb 16 12:15:20 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * parse.y: add dtrace probe for symbol create.
-
- * probes.d: ditto
-
-Sat Feb 16 09:27:37 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: don't test sys/feature_tests.h which is not
- used now.
- It was included in r7901 as "bug of gcc 3.0 on Solaris 8 ?".
-
-Sat Feb 16 09:24:37 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: reorder header tests to consider inclusion
- order in rubysocket.h.
-
-Sat Feb 16 08:42:58 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in, ext/socket/extconf.rb: test netinet/in_systm.h in
- ext/socket/extconf.rb instead of configure.in.
-
- Originally, netinet/in_systm.h is included for NextStep, OpenStep,
- and Rhapsody. [ruby-core:1596]
-
-Sat Feb 16 07:55:40 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: don't test xti.h here.
-
- * ext/socket/extconf.rb: test xti.h here.
-
- Originally, xti.h is included for IRIX [ruby-core:14447].
-
-Sat Feb 16 07:16:49 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: test struct sockaddr_un and its member,
- sun_len.
-
- * ext/socket/sockport.h (INIT_SOCKADDR_UN): new macro defined.
-
- * ext/socket/socket.c (sock_s_pack_sockaddr_un): use INIT_SOCKADDR_UN.
-
- * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
-
- * ext/socket/raddrinfo.c (init_unix_addrinfo): ditto.
- (addrinfo_mload): ditto.
-
-Sat Feb 16 07:05:59 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family
- argument. it is always AF_INET.
-
- * ext/socket/raddrinfo.c (make_inetaddr): follow INIT_SOCKADDR_IN
- change.
- (addrinfo_ipv6_to_ipv4): ditto.
-
-Sat Feb 16 04:21:07 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/socket/extconf.rb: workaround for mswin/mingw build problem.
- sendmsg emulation in win32/win32.c is not enough.
-
-Sat Feb 16 00:19:20 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: use all all tested available headers for
- have_func.
-
-Fri Feb 15 22:21:37 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in: Fix a bug introduced in r38342 that the cflagspat
- substitution is messed up by the way CFLAGS and optflags are
- modified, which affected FreeBSD and NetBSD/amd64 when
- configured to use libexecinfo. This bug resulted in CFLAGS and
- CXXFLAGS in RbConfig::CONFIG having warnflags expanded in them,
- forcing third-party C/C++ extensions to follow what warnflags
- demands, like ANSI/ISO-C90 conformance. ref [Bug #7101]
-
-Fri Feb 15 20:29:11 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/sockport.h (SET_SIN_LEN): defined for strict-aliasing
- rule.
- (INIT_SOCKADDR_IN): ditto.
-
- * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR_IN.
- (addrinfo_ipv6_to_ipv4): ditto.
-
-Fri Feb 15 18:24:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#try_run): bail out explicitly if cross
- compiling, because it cannot work of course.
-
-Fri Feb 15 12:34:58 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: test struct sockaddr_storage directly.
-
- * ext/socket/rubysocket.h: use HAVE_TYPE_STRUCT_SOCKADDR_STORAGE.
-
-Fri Feb 15 12:26:13 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/getaddrinfo.c (GET_AI): don't cast 1st argument for
- INIT_SOCKADDR.
-
-Fri Feb 15 08:12:11 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/sockport.h (SET_SS_LEN): removed.
- (SET_SIN_LEN): removed.
- (INIT_SOCKADDR): new macro.
-
- * ext/socket/ancdata.c (extract_ipv6_pktinfo): use INIT_SOCKADDR.
-
- * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR.
- (addrinfo_ipv6_to_ipv4): ditto.
-
- * ext/socket/getaddrinfo.c (GET_AI): use INIT_SOCKADDR.
-
-Fri Feb 15 07:49:27 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc.rb: Update to release version of 4.0.0
-
- * lib/rubygems.rb: Update to release version of 2.0.0
-
-Fri Feb 15 07:07:27 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/sockport.h (SA_LEN): removed because unused now.
- (SS_LEN): ditto.
- (SIN_LEN): ditto.
-
-Thu Feb 14 10:45:31 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_process.rb (test_setsid): Added a workaround for
- MacOS X. Patch by nagachika. [Bug #7826] [ruby-core:52126]
-
-Fri Feb 15 00:15:31 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/sockport.h (VALIDATE_SOCKLEN): new macro to validate
- sa_len member of 4.4BSD socket address.
-
- * ext/socket/getnameinfo.c (getnameinfo): use VALIDATE_SOCKLEN,
- instead of SA_LEN.
-
- * ext/socket/socket.c (sock_s_getnameinfo): use VALIDATE_SOCKLEN
- instead of SS_LEN.
-
-Thu Feb 14 22:25:54 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (sockaddr_len): extracted from sockaddr_obj.
- (sockaddr_obj): add an argument to length of socket address.
- (socket_s_ip_address_list): call sockaddr_obj with actual socket
- address length if given, use sockaddr_len otherwise.
-
-Thu Feb 14 20:11:23 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: always operate length of socket address companion with
- socket address.
-
- * ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for
- socket address length.
- (rsock_ipaddr): ditto.
-
- * ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr.
- (ip_peeraddr): ditto.
- (ip_s_getaddress): pass length to rsock_make_ipaddr.
-
- * ext/socket/socket.c (make_addrinfo): pass length to rsock_ipaddr.
- (sock_s_getnameinfo): pass actual address length to rb_getnameinfo.
- (sock_s_unpack_sockaddr_in): pass length to rsock_make_ipaddr.
-
- * ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr.
- (rsock_s_recvfrom_nonblock): ditto.
-
- * ext/socket/tcpsocket.c (tcp_sockaddr): pass length to
- rsock_make_ipaddr.
-
- * ext/socket/raddrinfo.c (make_ipaddr0): add an argument for socket
- address length. pass the length to rb_getnameinfo.
- (rsock_ipaddr): ditto.
- (rsock_make_ipaddr): add an argument for socket address length.
- pass the length to make_ipaddr0.
- (make_inetaddr): pass length to make_ipaddr0.
- a local variable renamed.
- (host_str): a local variable renamed.
- (port_str): ditto.
-
-Thu Feb 14 14:31:43 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb: Removed OpenSSL dependency from Net::HTTP.
-
- * test/net/http/test_http.rb: Remove Zlib dependency from tests.
- * test/net/http/test_http_request.rb: ditto.
-
-Thu Feb 14 11:08:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (include_modules_at): detect cyclic prepend with original
- method table. [ruby-core:52205] [Bug #7841]
-
-Thu Feb 14 10:30:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c: call method_removed hook on called class, not on
- prepending iclass. [ruby-core:52207] [Bug #7843]
-
-Thu Feb 14 10:05:57 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http: Do not handle Content-Encoding when the user sets
- Accept-Encoding. This allows users to handle Content-Encoding for
- themselves. This restores backwards-compatibility with Ruby 1.x.
- [ruby-trunk - Bug #7831]
- * lib/net/http/generic_request.rb: ditto.
- * lib/net/http/response.rb: ditto
- * test/net/http/test_http.rb: Test for the above.
- * test/net/http/test_http_request.rb: ditto.
- * test/net/http/test_httpresponse.rb: ditto.
-
-Thu Feb 14 08:18:47 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: don't define HAVE_SA_LEN and HAVE_SA_LEN.
- use HAVE_STRUCT_SOCKADDR_SA_LEN and HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
- instead.
-
-Wed Feb 13 20:59:48 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: don't define socklen_t here, just test.
-
- * ext/socket/rubysocket.h: define socklen_t if not available.
-
-Wed Feb 13 18:37:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mnew): skip prepending modules and return the method bound
- on the given class. [ruby-core:52160] [Bug #7836]
-
-Wed Feb 13 18:11:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (method_original_name): new methods Method#original_name and
- UnboundMethod#original_name. [ruby-core:52048] [Bug #7806]
- [EXPERIMENTAL]
-
- * proc.c (method_inspect): show the given name primarily, and
- original_id if aliased. [ruby-core:52048] [Bug #7806]
-
-Wed Feb 13 17:56:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (warnflags): disable -Werror by default unless
- development. [ruby-core:52131] [Bug #7830]
-
-Wed Feb 13 06:05:52 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Return BINARY strings from Gem.gzip and Gem.gunzip.
- Fixes intermittent test failures. RubyGems issue #450 by Jeremey
- Kemper.
- * test/rubygems/test_gem.rb: Test for the above.
-
-Wed Feb 13 05:49:21 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: test functions just after struct members.
-
-Tue Feb 12 12:02:35 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json: merge JSON 1.7.7.
- This includes security fix. [CVE-2013-0269]
- https://github.com/flori/json/commit/d0a62f3ced7560daba2ad546d83f0479a5ae2cf2
- https://groups.google.com/d/topic/rubyonrails-security/4_YvCpLzL58/discussion
-
-Mon Feb 11 23:08:48 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: enable rb_cv_page_size_log test for MirOS BSD.
-
-Mon Feb 11 20:06:38 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: use -pthread on mirbsd*.
-
-Mon Feb 11 16:07:09 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: add SOLIBS and LIBRUBY_SO definition for mirbsd*.
-
-Mon Feb 11 13:17:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rubysitearchprefix): sitearchdir and vendorarchdir
- should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
-
- * win32/Makefile.sub (config.status): site and vendor directories
- should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
-
-Mon Feb 11 12:31:25 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: move OS specific header/function knowledge before
- automatic header tests.
-
-Mon Feb 11 11:04:29 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: move the test for -march=i486 just after
- RUBY_UNIVERSAL_ARCH/RUBY_DEFAULT_ARCH.
-
-Sun Feb 10 23:42:26 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: test structure members just after types test.
-
-Sun Feb 10 20:58:17 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: test types just after headers test.
-
-Sun Feb 10 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/rake/doc/MIT-LICENSE: Add license file from upstream
- * lib/rake/doc/README.rdoc: Link to license file from Rake README
- * lib/rake/version.rb: Include README rdoc for Rake module overview
-
-Sun Feb 10 15:26:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/rake/doc/*: Sync Rake rdoc files from upstream
-
-Sun Feb 10 15:50:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm_exec.h (DISPATCH_ARCH_DEPEND_WAY): use __asm__ __volatile__
- instead of asm volatile.
-
-Sun Feb 10 15:50:02 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * gc.h (SET_MACHINE_STACK_END): use __volatile__ instead of volatile.
-
-Sun Feb 10 14:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/rake/, lib/rake/doc/: Move Rake rdoc files to lib/rake
-
-Sun Feb 10 12:10:25 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: test headers at first.
-
-Sun Feb 10 12:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/rake/*: Removed stale Rake static files
-
-Sun Feb 10 09:10:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/pp.rb, lib/prettyprint.rb: Documentation for PP and PrettyPrint
- Based on a patch by Vincent Batts [ruby-core:51253] [Bug #7656]
-
-Sat Feb 9 21:11:21 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: move header files check to the beginning of
- "header and library section".
- test rlim_t with sys/types.h and sys/time.h for MirOS BSD.
- sys/types.h and sys/time.h is guarded by #ifdef and the above
- move is required for this change.
-
-Sat Feb 9 17:45:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in, version.c: prevent duplicated load paths by empty
- version string, it does not work right now.
-
-Sat Feb 9 17:38:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: fix arch parameters in help message. [Bug #7804]
-
-Sat Feb 9 13:13:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm_trace.c: Note about TracePoint events set, and comment on
- Kernel#set_trace_func to prefer new TracePoint API
-
-Sat Feb 9 10:07:47 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * BSDL: update copyright notice for 2013.
-
-Sat Feb 9 09:24:38 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package/old.rb: Fix behavior only on ruby 1.8.
-
- * lib/rubygems/package.rb: Include checksums.yaml.gz signatures for
- verification.
- * test/rubygems/test_gem_package.rb: Test for the above.
-
-Sat Feb 9 01:23:24 2013 Tanaka Akira <akr@fsij.org>
-
- * test/fiddle/helper.rb: specify libc and libm locations for MirOS BSD.
-
- * test/dl/test_base.rb: ditto.
-
-Fri Feb 8 23:25:33 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: change CFLAGS temporally to test
- ARCH_FLAG="-march=i486".
-
-Fri Feb 8 21:19:41 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: don't define ARCH_FLAG="-march=i486" if it causes
- compilation problem.
-
-For the changes before 2.0.0, see doc/ChangeLog-2.0.0
-For the changes before 1.9.3, see doc/ChangeLog-1.9.3
-For the changes before 1.8.0, see doc/ChangeLog-1.8.0
-
-Local variables:
-coding: us-ascii
-add-log-time-format: (lambda ()
- (let* ((time (current-time))
- (system-time-locale "C")
- (diff (+ (cadr time) 32400))
- (lo (% diff 65536))
- (hi (+ (car time) (/ diff 65536))))
- (format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
-indent-tabs-mode: t
-tab-width: 8
-change-log-indent-text: 2
-end:
-vim: tabstop=8 shiftwidth=2
diff --git a/doc/ChangeLog-2.2.0 b/doc/ChangeLog-2.2.0
deleted file mode 100644
index 5a7dbf826d..0000000000
--- a/doc/ChangeLog-2.2.0
+++ /dev/null
@@ -1,12157 +0,0 @@
-Thu Dec 25 16:01:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_expand_path_internal): drop characters ignored
- by filesystem on Mac OS X.
-
-Thu Dec 25 15:36:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (replace_real_basename): get the real name and replace the
- base name with it by getattrlist(2) if available.
- suggested by Matthew Draper at [ruby-core:67116]. [Bug #10015]
-
- * dir.c (glob_helper): get the real name of the whole path, not
- only the last name.
-
-Thu Dec 25 13:59:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (NET_LUID): include also ifdef.h as a workaround of
- a bug in mingw-w64 header. [ruby-core:67103] [Bug #10640]
-
-Thu Dec 25 12:47:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (gettable_gen): warn possible reference to a local
- variable defined in a past scope.
-
-Thu Dec 25 10:09:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (console_dev): id_console is not a
- constant name, use rb_const_remove() to get rid of NameError.
-
-Thu Dec 25 09:18:55 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
- set timeout for recvfrom because if client thread is crashed, it
- waits infinity.
-
-Thu Dec 25 08:42:11 2014 Eric Wong <e@80x24.org>
-
- * lib/uri/generic.rb (split_userinfo): fstring for 1-byte split
- (set_port): reduce bytecode size
- (check_path): reduce garbage via opt_str_freeze
- (query=): ditto
- (fragment=): ditto
- [misc #10628]
- * lib/uri/rfc3986_parser.rb (regexp): cache as attr
- (initialize): setup and freeze regexp attr once
- (split): reduce bytecode size, use opt_str_freeze
- (parse): minor bytecode and garbage reduction
- (default_regexp): rename for initialize
-
-Wed Dec 24 20:38:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_make_pattern): restrict searching case-insensitive
- name from the filesystem to only last part, for the performance.
- [ruby-core:63591] [Bug #10015]
-
-Wed Dec 24 18:21:27 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: remove unused rb_objspace_t::rgengc::old_objects_at_gc_start.
-
-Wed Dec 24 13:25:22 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/redmine-backporter.rb: require view_changesets permission.
-
-Wed Dec 24 13:00:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/downloader.rb (Downloader.download): fix the exception to
- re-raise. initialize methods of subclasses of Exception may
- have different parameters. [ruby-core:67086] [Bug #10639]
-
-Wed Dec 24 12:16:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.h (rb_data_type_t): revert r48647 and revise parent member.
- [ruby-core:66969] [Bug #10621]
-
-Wed Dec 24 05:40:52 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/downloader.rb: use config.guess in gcc repo.
-
-Wed Dec 24 11:50:19 2014 Koichi Sasada <ko1@atdot.net>
-
- * hash.c (rb_hash_delete): return Qnil if there are no corresponding
- entry. [Bug #10623]
-
- * hash.c (rb_hash_delete_entry): try delete and return Qundef if there
- are no corresponding entry.
-
- * internal.h: add rb_hash_delete_entry()'s declaration.
-
- * symbol.c: use rb_hash_delete_entry().
-
- * thread.c: use rb_hash_delete_entry().
-
- * ext/-test-/hash/delete.c: use rb_hash_delete_entry().
-
-Wed Dec 24 09:35:11 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/fiddle/extconf.rb: remove ffitarget.h generated by configure on
- mswin, because it's not normal file (cygwin's symlink) and have
- system attribute.
-
-Wed Dec 24 05:40:52 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/downloader.rb: support ruby 1.8.
-
-Wed Dec 24 02:44:06 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/response.rb (Net::HTTPResponse): require one or more
- spaces [Bug #10591].
- by leriksen <leif.eriksen.au@gmail.com>
- https://github.com/ruby/ruby/pull/782 fix GH-782
- NOTE: graph.facebook.com returns without SP Reason-Phrase.
-
-Wed Dec 24 02:12:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/make-snapshot (package): VCS#branch_list expects glob a
- pattern string but not a regexp. based on the patch by Vit
- Ondruch. in [ruby-core:67064]. [Bug #10636]
-
- * tool/vcs.rb (VCS::SVN#branch_list): strip newlines.
-
- * tool/vcs.rb (VCS::GIT.get_revisions): retrieve modified time
- from toplevel log too.
-
- * tool/vcs.rb (VCS::GIT#branch_list): yield for each lines.
-
-Wed Dec 24 00:23:13 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/extlibs.rb (do_extract): the pipe should be binmode.
-
-Wed Dec 24 00:21:44 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * Makefile.in, common.mk: move common-srcs to Makefile.in because
- it breaks build on mswin.
-
-Wed Dec 24 00:04:45 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/open-uri.rb (OpenURI.open_http): accept multiple certs path in
- ssl_ca_certs.
-
- * tool/downloader.rb: use certs of rubygems for downloading gems.
-
-Tue Dec 23 22:39:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/fiddle/extlibs: libffi-3.2.1 and patch for mswin.
-
-Tue Dec 23 22:04:38 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI::Generic#query=): don't escape [\]^
- on both rfc2396 and rfc3986. [Bug #10619]
-
-Tue Dec 23 16:03:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry::Error#initialize):
- try en_US message if the default message cannot be encoded to
- locale. [ruby-core:65295] [Bug #10300]
-
-Tue Dec 23 11:42:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/ossl_cipher.c (ossl_cipher_update_long): update huge
- data gradually not to exceed INT_MAX. workaround of OpenSSL API
- limitation. [ruby-core:67043] [Bug #10633]
-
-Mon Dec 22 21:30:16 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_event.rb: some tests are
- executed on standard Windows OS without ADO.
-
-Mon Dec 22 14:08:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (received_signal): fix condition to define.
- [ruby-core:67032] [Bug #10629]
-
-Sun Dec 21 10:51:51 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_event.rb: test_s_new_exception is
- executed on standard Windows OS without ADO.
-
-Sun Dec 21 08:35:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (jemalloc): fix option argument, should use
- `$withval` but not `yes` always. [ruby-core:66994] [Bug #10625]
-
- * configure.in (jemalloc): defer adding the liner option to get
- rid of linking contest against jemalloc, so that it works
- without runtime dynamic load path.
-
-Sat Dec 20 17:49:03 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/tmpdir.rb (Dir.mktmpdir): Accept nil again, as Ruby 2.1.
- [ruby-core:66943] [Bug #10616] Fixed by Alex Slynko.
-
-Sat Dec 20 11:22:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/fiddle/depend, ext/fiddle/extconf.rb: try to build bundled
- libffi if existing.
-
-Sat Dec 20 05:21:00 2014 Eric Wong <e@80x24.org>
-
- * test/test_weakref.rb (test_repeated_object_leak): increase timeout
- [Bug #10618]
-
-Fri Dec 19 22:33:13 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Use $(hdrdir) if possible.
-
-Fri Dec 19 22:10:00 2014 Kenta Murata <mrkn@cookpad.com>
-
- * ext/bigdecimal/depend: Fix dependencies to make bigdecimal
- installable by rubygems.
-
- * ext/bigdecimal/bigdecimal.gemspec: version 1.2.6.
-
-Fri Dec 19 20:00:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (PRIsVALUE): put a space after string
- literals not to be confused with C++11 string literal suffix.
- https://github.com/ruby/ruby/commit/a9f3eb7#commitcomment-9040169
-
-Fri Dec 19 15:36:02 2014 Simon Genier <simon.genier@shopify.com>
-
- * hash.c (hash_equal): prefer true than the result of implicit
- conversion from int returned by rb_eql() to VALUE. [Fix GH-789]
-
-Thu Dec 18 17:45:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_binary_elf): get rid of -e option of cat
- which is not available on BusyBox, use tr instead.
- [ruby-core:64824] [Bug #10210]
-
-Thu Dec 18 14:25:17 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * signal.c (ruby_signal): since SIGKILL is not supported by MSVCRT,
- should be treated before calling signal(3).
- [Bug #10615]
-
-Wed Dec 17 12:20:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (rb_method_for_self_aref, rb_method_for_self_aset):
- move from iseq.c to build from node instead of arrays.
-
-Wed Dec 17 10:50:09 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/gdbm/test_gdbm.rb: Added test for each_key called without a block.
- Patch by @joeyates [fix GH-783]
-
-Wed Dec 17 10:18:42 2014 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (iseq_compile_each): check
- iseq->compile_data->option->specialized_instruction for opt_* insn.
-
- * test/ruby/test_iseq.rb: check no specialized_instructions option.
-
-Wed Dec 17 09:48:57 2014 Eric Wong <e@80x24.org>
-
- * compile.c (iseq_compile_each): only emit opt_str_freeze,
- opt_aref_with, and opt_aset_with insn when no block is given
- [Bug #10557] [ruby-core:66595]
- * test/ruby/test_optimization.rb (test_block_given_aset_aref):
- new test for bug thanks to Bartosz Kopinski.
- (test_string_freeze): additional assertion for object_id
-
-Wed Dec 17 01:06:47 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/win32/lib/Win32API.rb (Win32API#call): need to splat. hmm, when
- was this broken?
-
-Tue Dec 16 15:18:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): call
- accessor functions directly, not to be affected by [] and []=
- methods. [ruby-core:66846] [Bug #10601]
-
- * struct.c (define_aref_method, define_aset_method): ditto.
-
- * vm_insnhelper.c (rb_vm_opt_struct_aref, rb_vm_opt_struct_aset):
- direct accessors of Struct.
-
-Tue Dec 16 12:01:29 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- extend timeout seconds to 60 for RGENGC_CHECK_MODE > 0 environment.
-
-Tue Dec 16 08:53:12 2014 Eric Wong <e@80x24.org>
-
- * tool/vcs.rb: fix Ruby 1.8 compatibility harder
-
-Tue Dec 16 07:37:18 2014 Eric Wong <e@80x24.org>
-
- * gc.c (GC_HEAP_FREE_SLOTS): move definition to match use order
- (RUBY_GC_HEAP_GROWTH_SLOTS): s/factor/number of slots/
-
- * man/ruby.1: add section for GC environment variables
- [Feature #10197]
-
-Tue Dec 16 05:41:46 2014 Eric Wong <e@80x24.org>
-
- * tool/vcs.rb: fix Ruby 1.8 compatibility
-
-Mon Dec 15 17:51:28 2014 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c: ObjectSpace.memsize_of(obj) returns
- with sizeof(RVALUE). [Bug #8984]
-
- * gc.c (obj_memsize_of): ditto.
-
- * NEWS: add a NEWS entry.
-
- * test/objspace/test_objspace.rb: catch up this fix.
-
- * test/ruby/test_file_exhaustive.rb: ditto.
-
-Mon Dec 15 16:19:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_enc_str_coderange): dummy wchar, non-endianness
- encoding string cannot be ascii only.
- [ruby-core:66835] [Bug #10598]
-
-Sun Dec 14 20:11:42 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (primary): restore current_arg so that circular
- reference after a method definition is also warned.
- [ruby-core:61299] [Bug #9593]
-
-Sat Dec 13 20:41:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_trace.c (rb_postponed_job_flush): mask signal trap interrupt
- too to defer handling after finalizers finished.
- [ruby-core:66825] [Bug #10595]
-
-Sat Dec 13 18:33:25 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/openssl/test_pkey_ec.rb: ignored tests with old OpenSSL.
-
-Sat Dec 13 18:01:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (check_stack_overflow): check sp also on i386/x86_64
- FreeBSD.
-
-Sat Dec 13 09:58:41 2014 Eric Wong <e@80x24.org>
-
- * gc.c (define_final0): avoid duplicate blocks
- [Bug #10537]
- * test/test_weakref.rb (test_repeated_object_leak): new test
-
-Sat Dec 13 04:59:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bin/erb (ERB::Main#run): get rid of shadowing outer local
- variables. [ruby-core:65772] [Feature #10395]
-
-Fri Dec 12 21:56:44 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * gems/bundled_gems: Upgrade to test-unit 3.0.8. assert_throw and
- assert_nothing_thrown in test-unit 3.0.7 were broken by
- UncaughtThrowError change introduced in Ruby 2.2.0
- preview2. These assertions in test-unit 3.0.8 work well with
- UncaughtThrowError in Ruby 2.2.0 preview2.
-
-Fri Dec 12 19:48:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bin/erb (ARGV.switch, ERB::Main#run): allow variables to be set
- from the command line. [ruby-core:65772] [Feature #10395]
-
-Fri Dec 12 19:31:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/erb.rb (ERB#lineno): accessor for line number to eval.
-
- * lib/erb.rb (ERB#location=): setter of file name and line number.
-
-Fri Dec 12 13:09:13 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_latest_gc_info): return :state field to show current
- GC state (none/marking/sweeping).
- [Feature #10590]
-
-Fri Dec 12 10:49:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_crypt): check arguments more strictly.
- * crypt() is not for wide char strings
- * salt bytes should not be NUL
-
-Fri Dec 12 08:16:01 2014 Matt Hoyle <matt@deployable.co>
-
- * io.c (io_read) Fix spelling in docco for read. [Fix GH-781]
- try > tries
-
-Thu Dec 11 19:06:01 2014 Koichi Sasada <ko1@atdot.net>
-
- * class.c (class_alloc): Start from age == 2.
- Class and Module objects can be living long life.
-
- * iseq.c: Same for ISeq objects.
-
- * gc.c (RVALUE_AGE_RESET): added.
-
- * gc.c (newobj_of): allow to generate (age != 0) objects.
-
- * gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected
- objects.
-
- * include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended
- flag.
-
-Thu Dec 11 05:37:52 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/prime.rb: Remove useless loop and block capture.
- See [#10354]
-
-Thu Dec 11 04:27:24 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: introduce new field
- rb_thread_t::local_storage_recursive_hash_for_trace to store
- recursive hash to avoid creating new recursive (nested) hashes
- for each trace events.
- [Bug #10511]
-
- * vm_trace.c (rb_threadptr_exec_event_hooks_orig): use it.
-
- * cont.c: catch up this fix.
-
- * vm.c (rb_thread_mark): ditto.
-
-Wed Dec 10 13:39:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * struct.c (define_aref_method, define_aset_method): use iseq
- VALUE instead of rb_iseq_t to prevent from GC, as RB_GC_GUARD
- makes sense only for local variables. [Feature #10575]
-
-Wed Dec 10 09:38:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (exec_recursive): use the same last method name as
- recursive_push in the error message when recursive_pop failed.
- [ruby-core:66742] [Bug #10579]
-
-Wed Dec 10 02:48:46 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/net/http/test_https.rb
- (TestNetHTTPS#test_certificate_verify_failure): on Windows,
- Errno::ECONNRESET will be raised when the verify is failure at the
- client side, and it'll be eaten by WEBrick.
-
- * test/open-uri/test_ssl.rb (TestOpenURISSL#test_validation_failure):
- ditto.
-
-Wed Dec 10 00:42:13 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (rb_method_for_self_aref, rb_method_for_self_aset):
- new methods to generate bytecode for struct.c
- [Feature #10575]
- * struct.c (rb_struct_ref, rb_struct_set): remove
- (define_aref_method, define_aset_method): new functions
- (setup_struct): use new functions
- * test/ruby/test_struct.rb: add test for struct >10 members
- * benchmark/bm_vm2_struct_big_aref_hi.rb: new benchmark
- * benchmark/bm_vm2_struct_big_aref_lo.rb: ditto
- * benchmark/bm_vm2_struct_big_aset.rb: ditto
- * benchmark/bm_vm2_struct_small_aref.rb: ditto
- * benchmark/bm_vm2_struct_small_aset.rb: ditto
-
-Tue Dec 9 20:24:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * string.c: [DOC] Add missing documentation around String#chomp.
- Patch by @stderr [ci skip][fix GH-780]
-
-Tue Dec 9 18:20:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c: [DOC] Revise documentation by Marcus Stollsteimer at
- [ruby-core:66368]. [Bug #10526]
-
- * #inspect: be more specific about generated string, remove
- obsolete example.
- * #nil?: use code examples instead of different call-seq's.
- * #tap: clarify what is yielded.
- * Integer(): be more specific about to_int and to_i, remove
- reference to Ruby 1.8.
- * Array(): fix error.
- * Class: fix variable name style and indentation in example.
- * improve consistency, fix typos and formatting.
-
-Tue Dec 9 12:48:32 2014 Josef Simanek <josef.simanek@gmail.com>
-
- * vm_eval.c (rb_eval_string_wrap): [DOC] Fix `rb_eval_string_wrap`
- documentation. It is referencing `require` instead of `load`.
- The former does not have the optional argument. [Fix GH-779]
-
-Tue Dec 9 10:16:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_frame_last_func): return the most recent frame method
- name.
-
- * thread.c (recursive_list_access): use the last method name,
- instead of the current method name which can be unset in some
- cases, not to use a symbol by the invalid ID.
- [ruby-core:66742] [Bug #10579]
-
-Sun Dec 7 19:36:12 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/socket/basicsocket.c, ext/socket/sockssocket.c:
- remove code for $SAFE=4.
-
-Sun Dec 7 10:20:55 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc 4.2.0.
- * test/rdoc: ditto.
-
-Sun Dec 7 09:52:30 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.4.5.
- * test/rubygems: ditto.
-
-Sat Dec 6 10:05:08 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb: Fix undefined variable usage & refactor/DRY
- code. Patch by @aledovsky. [Fixes GH-770]
-
- * test/net/test_imap.rb: related test.
-
-Sat Dec 6 10:09:44 2014 Eric Wong <e@80x24.org>
-
- * thread.c (do_select): rename parameters to avoid shadowing
-
-Sat Dec 6 09:22:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rake: Update to rake 10.4.2
- * test/rake: ditto.
-
-Sat Dec 6 06:48:03 2014 Eric Wong <e@80x24.org>
-
- * compile.c (rb_iseq_build_from_ary): remove misc handling
-
-Sat Dec 6 06:14:23 2014 Vit Ondruch <vondruch@redhat.com>
-
- * configure.in (RUBY_LIB_VERSION): Fix --with-ruby-version
- configuration option. get rid of quoting in config.status.
-
- * template/verconf.h.tmpl: quote RUBY_LIB_VERSION here.
- [ruby-core:66724] [Bug #10572]
-
-Sat Dec 6 04:33:52 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/pp.rb (File::Stat#pretty_print): some platforms (such as Windows)
- does not have major/minor parts of device.
-
-Fri Dec 5 22:43:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/psych/lib/psych.rb: bump version to 2.0.8
- * ext/psych/psych.gemspec: ditto.
- * ext/psych/psych_emitter.c: ditto.
- * ext/psych/psych_parser.c: ditto.
-
-Fri Dec 5 17:09:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/option.c (inet_ntop): link aliased inet_ntop in
- libruby on mswin not rb_w32_inet_ntop which fails to link for
- unknown reason.
-
-Fri Dec 5 11:09:54 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (prepare_iseq_build): remove unused block_opt param
- (rb_iseq_new_with_bopt_and_opt): remove
- (rb_iseq_new_with_opt): inline removed function
- (rb_iseq_new_with_bopt): remove
- (iseq_load): adjust prepare_iseq_build call
- [Feature #10565]
-
-Fri Dec 5 09:46:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): fix lex_state after tLABEL_END, should
- be EXPR_LABELARG to be followed by "paren with arg".
- [ruby-core:66705] [Feature #4935]
-
-Fri Dec 5 02:27:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb: as all extension objects including initializations
- of ext and enc should be linked to libruby if enable-shared,
- EXTOBJS should not be linked to main programs.
- [ruby-core:66675] [Bug #10566]
-
-Thu Dec 4 07:06:02 2014 Eric Wong <e@80x24.org>
-
- * compile.c (rb_iseq_build_from_exception): entry->sp is unsigned
- (iseq_build_callinfo_from_hash): account for kw_arg
- (iseq_build_from_ary_body): update for r35459
- (CHECK_STRING, CHECK_INTEGER): remove unused checks
- (int_param): new function for checking new `params' hash
- (iseq_build_kw): new function for loading rb_iseq_param_keyword
- (rb_iseq_build_from_ary): account for `misc' entry and general
- structure changes
- [Feature #8543]
- * iseq.c (CHECK_HASH): new macro (for `misc' and `param' entries)
- (iseq_load): account for `misc' and `params' hashes
- (iseq_data_to_ary): add final opt to arg_opt_labels,
- fix kw support, account for unsigned entry->sp
- * ext/-test-/iseq_load/iseq_load.c: new ext for test
- * ext/-test-/iseq_load/extconf.rb: ditto
- * test/-ext-/iseq_load/test_iseq_load.rb: new test
-
-Thu Dec 4 06:56:57 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (iseq_free): avoid segfault on incomplete iseq
- * test/ruby/test_syntax.rb (test_invalid_next): new test
- for syntax error, not segfault
-
-Thu Dec 4 04:20:34 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (ruby_require_internal): ignore error detail, just return
- an error.
-
-Wed Dec 3 17:13:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (load_encoding): use rb_require_internal instead of
- calling rb_require_safe with protection.
-
-Wed Dec 3 16:47:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (register_init_ext, ruby_init_ext): defer running the
- registered initialization function until required, not to enable
- extensions which have global effects just by loading, e.g.,
- mathn/complex and mathn/rational. fix `make test` with
- --with-static-linked-ext.
-
- * enc/encinit.c.erb (Init_enc): initialize encdb and transdb
- directly.
-
-Wed Dec 3 14:51:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (ruby_require_internal): separate from rb_require_safe,
- not to raise exceptions.
-
- * ruby.c (process_options): remove unnatural encoding search.
-
-Wed Dec 3 14:34:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (setup_fake_str): fake string does not share another
- string, but just should not free.
-
-Wed Dec 3 11:14:14 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (w32_spawn): `v2` is used not only for `shell` but also
- `cmd`, so must not free before using `cmd`.
- [ruby-core:66648] [Bug #10563]
-
-Wed Dec 3 09:48:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/racc/cparse/cparse.c (cparse_params_type): use typed data.
-
-Tue Dec 2 21:33:56 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: use typed data for com_hash.
-
-Tue Dec 2 15:30:30 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * array.c (rb_ary_plus): in documentation, added note about
- inefficiency of repeated += operations.
-
-Tue Dec 2 07:20:21 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (iseq_data_to_ary): keep hidden variables
- Thanks to wanabe [ruby-core:66566]
-
-Tue Dec 2 06:46:57 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: bumping version
-
- * ext/psych/psych.gemspec: ditto
-
-Tue Dec 2 06:34:08 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: support objects that are
- marshalable, but inherit from basic object.
- Thanks Sean Griffin <sean@thoughtbot.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
-
- * test/psych/test_marshalable.rb: test for fix
-
-Tue Dec 2 06:32:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (ripper_flush_string_content): preserve the dispatched
- results at tSTRING_CONTENT. [ruby-dev:48714] [Bug #10437]
-
- * parse.y (regexp_contents): check in ripper only if the whole
- content is a single regexp without interpolation.
- [ruby-dev:48714] [Bug #10437]
-
-Tue Dec 2 06:30:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * re.c (rb_reg_region_copy): new function to try with GC if copy
- failed and return the error.
-
-Tue Dec 2 04:43:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * re.c (CHECK_REGION_COPIED): onig_region_copy() can fail when
- memory exhausted but returns nothing, so check by if allocated.
-
-Tue Dec 2 02:53:00 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (magic_comment_encoding): enable in ripper, since the
- encoding is necessary to parse non-default encoding scripts.
-
-Tue Dec 2 02:30:25 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI::Generic.build):
- use hostname= to detect and wrap IPv6 hosts.
- Build is accepting URI components and users may not expect
- that a host component needs to be wrapped with square brackets
- since it's not providing a URI.
- Note: initialize with arg_check => true does not wrap IPv6 hosts.
- by Joe Rafaniello <jrafanie@redhat.com>
- https://github.com/ruby/ruby/pull/765 fix GH-765
-
- * test/uri/test_generic.rb: Add more tests
-
-Mon Dec 1 20:01:12 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: use typed data for WIN32OLE.
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_event.c: ditto.
-
-Mon Dec 1 17:20:42 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (verconf.h): so depends on verconf.mk, which
- is rebuilt by setup.mak.
-
-Mon Dec 1 11:05:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * proc.c: fix grammar by @BenMorganIO [fix GH-764][ci skip]
-
-Mon Dec 1 10:49:53 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * man/rake.1: Update latest man content by @aledovsky
- [fix GH-771][ci skip]
-
-Mon Dec 1 10:42:31 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * doc/syntax/refinements.rdoc: refinements are no longer experimental.
- patch by @gaurish [fix GH-775][ci skip]
-
-Sun Nov 30 20:05:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (regexp_contents): fix a typo. pointed out by wanabe.
- [ruby-dev:48741] [Bug #10543]
-
-Sun Nov 30 18:55:32 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- Don't raise Interrupt.
-
-Sun Nov 30 17:11:05 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking): Use
- assert_separately.
-
-Sun Nov 30 00:02:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (process_options, ruby_script): transcode script name and
- program name to locale encoding as well as argv.
- [ruby-dev:48752] [Bug #10555]
-
- * ruby.c (translit_char_bin): should not use code page dependent
- CharNext on UTF-8 string. [ruby-dev:48752] [Bug #10555]
-
-Sat Nov 29 16:53:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (ruby_set_argv): convert argv from UTF-8.
-
- * win32/win32.c (rb_w32_sysinit, cmdglob, w32_cmdvector): convert
- wide char command line to UTF-8 argv, and glob in UTF-8 so that
- metacharacters would match multibyte characters.
- [ruby-dev:48752] [Bug #10555]
-
-Sat Nov 29 10:49:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (win32_direct_conv, rb_w32_readdir): convert UTF-8
- and filesystem code page by using Win32 API directly.
-
-Sat Nov 29 09:37:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (syserr_initialize): simplify message building and get
- rid of potential invalid byte sequence.
-
-Sat Nov 29 06:09:44 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * eval_error.c (error_print): respect the encoding of the message.
-
- * io.c (rb_write_error_str): use rb_w32_write_console() on Windows
- if stderr is a tty.
-
-Fri Nov 28 05:10:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (--with-setup): add option to select ext/Setup file.
-
-Fri Nov 28 05:02:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dmyenc.c (Init_enc): separate from dmyext.c for statically
- linked extension excluding encoding libraries.
-
-Thu Nov 27 21:58:30 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk (miniprelude.c): It does not depend on prelude.rb now.
-
-Thu Nov 27 21:49:49 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: List up files built always in the source directory
- and source files built always in the build directory.
-
-Thu Nov 27 21:24:55 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * NEWS: add obsolete callcc.
-
-Thu Nov 27 19:59:49 2014 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (iseq_compile_each): remove duplicated line event.
- [Bug #10449]
-
- * test/ruby/test_settracefunc.rb: add and fix tests.
-
-Thu Nov 27 19:04:50 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_args.c: fix backtrace location for keyword related exceptions.
-
- For example, the following program
- def foo(k1: 1); end # line 1
- foo(k2: 2) # line 2
- causes "unknown keyword: k2 (ArgumentError)".
-
- Before this patch, the backtrace location is only line 2.
- However, error should be located at line 1 (over line 2 in
- stack trace). This patch fix this problem.
-
- * class.c (rb_keyword_error_new): separate exception creation logic
- from rb_keyword_error(), to use in vm_args.c.
-
- * vm_insnhelper.c (rb_arg_error_new): rename to rb_arity_error_new().
-
- * vm_args.c (argument_arity_error): rename to argument_arity_error().
-
- * vm_args.c (argument_kw_error): added to fix backtrace.
-
- * test/ruby/test_keyword.rb: add tests.
-
-Thu Nov 27 17:31:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (prelude.c): no longer depends on miniruby, since not
- depending on rbconfig.rb.
-
-Thu Nov 27 17:12:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (miniprelude.c): miniruby needs no preludes.
-
-Thu Nov 27 17:10:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/prelude.c.tmpl: no code if no prelude code is given.
-
-Thu Nov 27 13:11:00 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (objspace_malloc_increase): enable lazy sweep on GC by malloc()
- (malloc_increase) to make GC incrementally.
-
- This change can increase memory consumption. Report us if you find
- any problem.
-
-Thu Nov 27 12:46:38 2014 Tanaka Akira <akr@fsij.org>
-
- * time.c (time_s_mkutc): [DOC] Time.utc's 10 arguments form
- doesn't examine wday, yday, isdst and tz.
- (time_s_mktime): [DOC] Time.mktime's 10 arguments form
- doesn't examine wday, yday and tz.
- Suggested by naruse.
-
-Thu Nov 27 11:45:33 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (iseq_data_to_ary): add missing GC guard
-
-Thu Nov 27 10:51:59 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: add rb_thread_t::local_storage_recursive_hash
- to speed up Thread#[:__recursive_key__] access.
- [Bug #10511]
-
- * thread.c (threadptr_local_aref): add fast path for
- :__recursive_data__.
-
- * thread.c (threadptr_recursive_hash, threadptr_recursive_hash_set):
- add special accessor for recursive hash.
-
- * cont.c: store/restore local_storage_recursive_hash.
-
- * vm.c: init and mark local_storage_recursive_hash.
-
- * vm_trace.c (rb_threadptr_exec_event_hooks_orig): clear and restore
- local_storage_recursive_hash directly.
-
-Thu Nov 27 07:11:00 2014 Eric Wong <e@80x24.org>
-
- * compile.c (iseq_calc_param_size): hoist out of iseq_set_arguments
-
-Wed Nov 26 22:28:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (rb_get_kwargs, rb_extract_keywords): export
- keyword argument functions.
-
-Wed Nov 26 21:18:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/inlinetest.rb: removed unused test helper.
-
-Wed Nov 26 20:47:28 2014 Masaya Tarui <tarui@ruby-lang.org>
-
- * ext/continuation/continuation.c (Init_continuation): obsolete callcc.
- first step of [Feature #10548].
-
-Wed Nov 26 19:57:54 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb (test_latest_gc_info): do test separately
- to avoid mysterious behavior.
-
-Wed Nov 26 19:54:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (constat_reset): do nothing on non-standard
- console emulators. [ruby-core:66471] [Bug #10546]
-
-Wed Nov 26 19:44:13 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/tsort.rb: Returns an enumerator if no block is given.
- [ruby-core:66270] [Feature #10508] Proposed by Andrey Savchenko.
-
-Wed Nov 26 17:25:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (f_label, f_kw, formal_argument_gen): ignore invalid
- formal argument in keyword argument definition.
- [ruby-dev:48742] [Bug #10545]
-
-Wed Nov 26 15:32:06 2014 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (iseq_set_sequence): use "nop" insn instead of
- "jump to next insn".
- https://bugs.ruby-lang.org/issues/8543#change-50085
-
-Wed Nov 26 11:01:35 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (iseq_s_compile_file): close IO when done
-
-Wed Nov 26 06:06:23 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk: encdb.h and transdb.h depends on $(PREP).
- So prebuild files for them in tarball are useless.
-
-Wed Nov 26 02:08:44 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/make-snapshot: Don't generate enc/trans/newline.c in tarball.
-
-Wed Nov 26 00:41:44 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk (prereq): Don't depends on prelude.c and golf_prelude.c.
- Since they depend on $(PREP) which is miniruby, they are rebuilt
- after miniruby is built, even if tarball contains them.
-
-Wed Nov 26 00:20:48 2014 Tanaka Akira <akr@fsij.org>
-
- * template/prelude.c.tmpl: Don't expand RbConfig::Config[...].
- It is not used now.
-
- * common.mk: prelude.c and golf_prelude.c doesn't depend on rbconfig.
-
-Tue Nov 25 17:07:06 2014 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add an "Implementation changes" section.
-
-Tue Nov 25 16:09:28 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb: Do not attempt SSL session resumption when the
- session is expired. [Bug #10533]
-
-Tue Nov 25 15:59:46 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake: Update to rake 10.4.0
- * test/rake: ditto.
- * NEWS: ditto.
-
- * test/lib/minitest/unit.rb: Add compatibility shim for minitest 5.
- This only provides minitest 5 unit test naming compatibility.
-
-Tue Nov 25 15:26:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/vcs.rb (get_revisions): use Time.new instead of Time.mktime
- which does not accept UTC offset, and offset manually for older
- versions than 1.9.
-
-Tue Nov 25 12:14:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (Init_process): initialize static IDs before constant
- definitions. [ruby-core:66445]
-
-Tue Nov 25 10:32:23 2014 Eric Wong <e@80x24.org>
-
- * compile.c (iseq_build_callinfo_from_hash): hoist out
- (iseq_build_from_ary_body): shorten callinfo case
-
-Mon Nov 24 23:03:21 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * gems/bundled_gems: Update to test-unit 3.0.7.
-
-Mon Nov 24 12:44:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (check_exec_redirect_fd, check_exec_redirect),
- (rb_execarg_addopt): get rid of inadvertent ID pindown.
-
-Mon Nov 24 02:03:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_setter): preserve encoding of global variable
- name in error message.
-
-Mon Nov 24 02:03:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (rb_insn_operand_intern): preserve encoding of method
- name in CALL_INFO at disassembling.
-
-Mon Nov 24 02:02:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (must_respond_to): preserve encodings of variable name and
- class name in warning message.
-
-Sun Nov 23 10:46:23 2014 Eric Wong <e@80x24.org>
-
- * internal.h (struct rb_execarg): 160 => 144 bytes on x86-64
- * ruby.c (struct load_file_arg): 48 => 40 bytes on x86-64
- * vm_args.c (struct args_info): ditto
-
-Sun Nov 23 07:46:54 2014 Andy Maloney <asmaloney@gmail.com>
-
- * io.c (rb_io_sysread): Remove redundant assignment of 'n'.
- [Fix GH-767]
-
-Sat Nov 22 09:48:33 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/make-snapshot: Specify PWD macro for make.
- PWD environment variable may not exist.
-
-Fri Nov 21 11:58:58 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/resolv.rb: fall back if canonicalization fails.
- Thanks Vit Ondruch for the patch! [ruby-core:65836]
-
- * test/resolv/test_dns.rb: test for patch
-
-Sat Nov 22 01:11:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_get, rb_mod_const_defined): ditto.
-
- * variable.c (rb_const_missing, rb_mod_const_missing): call
- const_missing without new ID to get rid of inadvertent ID
- creation.
-
-Fri Nov 21 19:32:57 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (ext/ripper/ripper.c): revert about srcdir and top_srcdir.
-
- * common.mk (ext/ripper/ripper.c): use $(PWD) for Unix,
- $(MAKEDIR) for Windows.
-
-Fri Nov 21 18:12:37 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Refactored.
-
-Fri Nov 21 14:25:40 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (top_srcdir): added because lacking this macro
- causes build error at r48526.
-
-Fri Nov 21 12:00:58 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps (in_makefile): Use FILES_NEED_VPATH and
- FILES_CONFUSING.
-
- * ext/objspace/extconf.rb: Add VPATH for id.h
-
-Fri Nov 21 09:10:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (ext/ripper/ripper.c): fix dependencies for the case
- to make ripper.y and id.h under the build directory.
-
-Fri Nov 21 08:42:21 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (ext/ripper/ripper.c): id.h in VPATH may exist in the build
- directory.
-
- * common.mk (ext/ripper/ripper.c): $(RM) was not defined.
-
-Fri Nov 21 00:36:09 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/openssl/lib/openssl/x509.rb
- (OpenSSL::X509::Name::RFC2253DN::StringChar): get rid of a false
- positive assertion in ripper's test.
-
-Fri Nov 21 00:29:51 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/net/imap.rb (Net::IMAP::ResponseParser::BEG_REGEXP): no need to
- use embed string.
-
-Fri Nov 21 00:19:17 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/uri/mailto.rb (URI::MailTo::EMAIL_REGEXP): should escape `#`.
-
-Thu Nov 20 23:17:11 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Insert all dependencies found by compiler.
-
-Thu Nov 20 15:51:01 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/depend (nkf.o): add nkf.c as dependency.
- bsdmake tries to make nkf.o with nkf-utf8/nkf.c without this.
-
-Thu Nov 20 08:54:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (struct parser_params): reduce size by reordering
- members and an unused member.
-
-Thu Nov 20 02:44:27 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Vector#independent? and associated class method
- patch by gogo tanaka [#10451]
-
-Thu Nov 20 02:32:34 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Vector#angle_with
- Patch by Egunov Dmitriy [#10442]
-
-Thu Nov 20 02:10:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (ripper_flush_string_content, parser_parse_string):
- preserve parsed string content. [ruby-dev:48714] [Bug #10437]
-
- * parse.y (ripper_new_yylval): abstract function to create ripper
- wrapper, and make it able to hold another object.
-
-Thu Nov 20 01:00:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (reg_named_capture_assign_gen): use predefined ID
- instead of rb_intern.
-
-Thu Nov 20 00:54:57 2014 Tanaka Akira <akr@fsij.org>
-
- * internal.h (ruby_init_setproctitle): Declare here.
-
-Thu Nov 20 00:26:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_here_document): append byte sequence directly to
- the delayed content instead of creating an intermediate string
- object.
-
-Wed Nov 19 21:11:01 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (ext/json/parser/parser.c): don't touch parse.c,
- ruby repo is a downstream.
-
-Wed Nov 19 20:38:11 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (ext/ripper/ripper.c): use $(PWD) to get
- <build-directory>/ext/ripper.
-
-Wed Nov 19 18:12:17 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/downloader.rb (RubyGems.download): Don't download gem if the
- version is already downloaded. A gem file is versioned and
- it must be identical if the version is the same.
-
-Wed Nov 19 17:59:25 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (ext/ripper/ripper.c): pass build directory as VPATH.
-
- * ext/ripper/depend (.y.c): use VPATH for y.tab.c.
-
-Wed Nov 19 10:07:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/prelude.c.tmpl (Prelude#translate): strip VPATH prefix
- from prelude names, so that srcdir differences do not make the
- generated code different.
-
-Wed Nov 19 07:45:11 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_write): should set the error of
- GetOverlappedResult()'s, not WriteFile()'s (it's always
- ERROR_IO_PENDING, of course).
-
-Tue Nov 18 14:16:47 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_record): add information for debug print.
-
-Wed Nov 19 04:49:07 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * debug.c (set_debug_option): need the declaration.
-
- * debug.c (set_debug_option): use the same macro with the implementation
- at win32/win32.c.
-
-Wed Nov 19 04:16:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (symbol_list): fix the node type of literal symbol list
- with no interpolation. [ruby-core:66343]
-
-Wed Nov 19 00:26:15 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Sort dependencies.
-
-Wed Nov 19 00:24:18 2014 Tanaka Akira <akr@fsij.org>
-
- * enc/encdb.c: Include internal.h.
-
-Tue Nov 18 23:23:45 2014 Tanaka Akira <akr@fsij.org>
-
- * internal.h: Gather declarations in non-header files.
-
-Tue Nov 18 23:45:52 2014 Tanaka Akira <akr@fsij.org>
-
- * debug.c (SET_WHEN): Don't declare debug variables here.
- ruby_initial_gc_stress_ptr is changed int* to VALUE* at r41406.
-
- * internal.h (ruby_initial_gc_stress_ptr): Declared.
- (ruby_enable_coredump): Ditto.
-
-Tue Nov 18 18:06:43 2014 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/io.h (FMODE_WSPLIT): Removed. The write() system call
- is not required to split. It was useful to avoid whole process
- blocking in Ruby 1.8 but not useful since write() is invoked without
- GVL.
- (FMODE_WSPLIT_INITIALIZED): Ditto.
-
- * io.c (wsplit_p): Removed.
- (io_writable_length): Removed.
- (rb_fcntl): Don't update the removed flags.
-
-Tue Nov 18 03:23:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (check_setter_id): show the original argument instead
- of nil on TypeError.
-
-Tue Nov 18 03:20:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * symbol.h (is_{local,global,instance,attrset,const,class,junk}_sym):
- fix ID type names.
-
-Mon Nov 17 20:17:59 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_event.c: use typed data.
-
-Mon Nov 17 12:54:56 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rubygems/*, test/rubygems/*: Update to RubyGems 2.4.4
- master (2f6e42e).
-
-Mon Nov 17 06:13:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (proc_binding): use the original iseq on a binding from
- proc from method object to get the location.
-
-Sun Nov 16 19:38:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_current_receiver): new function to return the
- receiver in the current control frame. [Feature #10195]
-
-Sun Nov 16 19:11:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/timeout.rb (Timeout::ExitException#exception): rescue
- UncaughtThrowError which is specific for throw, instead of
- ArgumentError.
-
-Sun Nov 16 18:22:18 2014 Eric Wong <e@80x24.org>
-
- * tool/update-deps: warning to disable ccache
-
-Sun Nov 16 13:11:35 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk (CCAN_LIST_INCLUDES): Unused variable removed.
- (ENCODING_H_INCLUDES): Ditto.
- (PROBES_H_INCLUDES): Ditto.
- (VM_CORE_H_INCLUDES): Ditto.
-
-Sun Nov 16 11:07:25 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_io.rb (test_readpartial_locktmp):
- remove unnecessary begin/end
-
-Sun Nov 16 00:45:23 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk: Specify dependencies for generated C sources.
-
-Sat Nov 15 23:10:45 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk: No need to declare dependencies which
- will be detected by inference rules.
-
-Sat Nov 15 20:34:23 2014 Tanaka Akira <akr@fsij.org>
-
- * internal.h: Include ruby.h and ruby/encoding.h to be
- includable without prior inclusion.
-
-Sat Nov 15 20:46:44 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb
- (REXMLTests::TestDocument::EntityExpansionLimitTest):
- Group tests by general entity and parameter entity.
-
-Sat Nov 15 20:43:31 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb
- (REXMLTests::TestDocument::EntityExpansionLimitTest): Define
- test XML in each test method because (1) each XML in used only
- one test and (2) related data and code should be close.
-
-Sat Nov 15 20:39:06 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb
- (REXMLTests::TestDocument::EntityExpansionLimitTest): Use
- one test method for one test.
-
-Sat Nov 15 20:16:59 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb
- (REXMLTests::TestDocument::EntityExpansionLimitTest): Use
- setup and teardown instead of ensure in test.
-
-Sat Nov 15 20:11:34 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb (REXMLTests::TestDocument): Group
- entity expansion limit related tests.
-
-Sat Nov 15 20:09:00 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb (REXMLTests::TestDocument::BomTest):
- Fix wrong parent class. It doesn't need inherit tests in
- TestDocument class.
-
-Sat Nov 15 19:48:59 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (depend_rules): support comments during a line.
-
- * lib/mkmf.rb (depend_rules): apply RULE_SUBST even if the dependency
- file contains path.
-
-Sat Nov 15 19:25:46 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk: Remove comments in Dependency lines.
- Notified by usa.
-
- * enc/depend: Ditto.
-
- * ext/**/depend: Ditto.
-
-Sat Nov 15 16:28:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_throw_obj): throw UncaughtThrowError instead of
- ArgumentError. [Feature #10480]
-
-Sat Nov 15 14:13:38 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Extend to fix dependencies.
-
- * common.mk: Dependencies updated by tool/update-deps.
-
- * enc/depend: Ditto.
-
- * ext/**/depend: Ditto.
-
-Fri Nov 14 17:36:48 2014 Tanaka Akira <akr@fsij.org>
-
- * tool/update-deps: Support GNU Make 4.0.
-
-Fri Nov 14 16:59:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (default_proc_for_compat_func): check arguments number and
- type, and get rid of reentering this default proc.
-
-Fri Nov 14 16:33:06 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): support compatible layer for
- GC.stat(symbol) type access.
-
-Fri Nov 14 16:19:08 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): add compatible layer.
- From Ruby 2.2, keys of GC.stat are changed [Feature #9924].
- To provide compatible layer, GC.stat add a default_proc
- (if default_proc of given Hash object is not set).
-
- At first use of this compatible layer of interpreter process,
- show a warning message like that:
- program: GC.stat[:total_allocated_object]
- warning message: "warning: GC.stat keys were changed from Ruby
- 2.1. In this case, you refer to obsolete `total_allocated_object'
- (new key is `total_allocated_objects').
- Please check <https://bugs.ruby-lang.org/issues/9924>
- for more information."
-
- Please correct my English message :)
-
- * hash.c (rb_hash_set_default_proc): export (in internal).
-
- * internal.h: ditto.
-
-Fri Nov 14 10:41:25 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: guard by #if/#endif with GC_ENABLE_INCREMENTAL_MARK
- to hide unused codes.
-
- * gc.c: similar to GC_ENABLE_LAZY_SWEEP.
-
-Fri Nov 14 10:23:35 2014 Eric Wong <e@80x24.org>
-
- * vm_eval.c (rb_eval_cmd): use pre-defined idCall
-
-Fri Nov 14 09:25:44 2014 Eric Wong <e@80x24.org>
-
- * vm_eval.c (rb_yield_splat): add missing GC guard
- [Bug #10509]
-
-Fri Nov 14 08:12:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gc.c: fix build error caused by implicit conversion with clang.
-
-Fri Nov 14 06:54:06 2014 Eric Wong <e@80x24.org>
-
- * insns.def (opt_succ): remove Time#succ optimization
- [Feature #10501]
-
-Fri Nov 14 05:29:46 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: refactoring.
-
- * gc.c: use GC_ENABLE_INCREMENTAL_MARK instead of USE_RINCGC.
-
- * gc.c (gc_start): check FORCE_MAJOR_GC.
-
-Fri Nov 14 04:51:18 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: Tuning RincGC parameters.
-
- Before this patch, gc_marks_step() marks (white -> grey) fixed
- number objects. However, this strategy does not fit practical
- cases, for example too slow to make progress.
-
- This patch changes this strategy how many objects the
- gc_marks_step() should handle.
-
- We can estimate how many times gc_marks_step() is called during
- this major marking (== C) with the free slot number in pooled
- pages. We also can estimate the living object number (== L)
- using last marked_slots value. We can solve this problem (how
- many objects should be process in gc_marks_step()) by L/C.
-
- * gc.c (rb_objspace_t): add rb_objspace_t::rincgc::pooled_slots and
- step_slots.
-
-Fri Nov 14 01:26:47 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (search_response): parse MODSEQ in SEARCH
- responses properly. [ruby-core:64203] [Bug #10112]
-
-Fri Nov 14 01:03:17 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/envutil.rb: Moved from test/ruby/.
-
- * test/lib/find_executable.rb: Ditto.
-
- * test/lib/memory_status.rb: Ditto.
-
- * test/lib/test/unit.rb: require envutil.
-
- * test/: Don't require envutil in test files.
-
-Thu Nov 13 21:59:58 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rexml/document.rb: add REXML::Document#document.
- reported by Tomas Hoger <thoger@redhat.com> and patched by nahi.
-
-Thu Nov 13 21:51:56 2014 Tanaka Akira <akr@fsij.org>
-
- * test/monitor/test_monitor.rb: Use assert_join_threads.
-
-Thu Nov 13 21:45:13 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl: Don't specify port number.
-
-Thu Nov 13 21:22:35 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/ssl_server.rb: Unused file removed.
- It is not used since r16111, Ruby 1.9.1.
-
-Thu Nov 13 18:50:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_ensure): remove obsolete prot_tag comment. patch by
- Jack Danger at [ruby-core:66238]. [misc #10502]
-
-Thu Nov 13 18:10:38 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (rb_vm_make_proc_lambda): similar to rb_vm_make_proc() with
- is_lambda argument.
-
-Thu Nov 13 12:11:18 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_fstat{,i64}): speed up. adjusting
- timestamps in this function is to get rid of the side effect of
- ENV["TZ"]. then, if ENV["TZ"] is not set, no need to adjust.
- this change makes File#stat about 60% faster.
-
-Thu Nov 13 11:56:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c: include "internal.h" for STATIC_ASSERT.
-
-Thu Nov 13 03:56:38 2014 Eric Wong <e@80x24.org>
-
- * gc.c (struct heap_page): trivial packing
- 304 => 296 bytes on x86-64
-
-Wed Nov 12 22:50:12 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gems/bundled_gems: Update to test-unit 3.0.6 and minitest 5.4.3.
-
-Wed Nov 12 22:30:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rubygems/*: Update to RubyGems 2.4.3 master (7b1f684).
-
-Wed Nov 12 00:26:37 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_object.rb: Specify an exception class for rescue clause.
-
- * test/dbm/test_dbm.rb: Ditto.
-
- * test/gdbm/test_gdbm.rb: Ditto.
-
- * test/sdbm/test_sdbm.rb: Ditto.
-
-Tue Nov 11 23:43:51 2014 Tanaka Akira <akr@fsij.org>
-
- * test/fileutils/test_fileutils.rb: Use assert_join_threads.
-
-Tue Nov 11 22:51:14 2014 Tanaka Akira <akr@fsij.org>
-
- * test/resolv/test_dns.rb: Use assert_join_threads.
-
-Tue Nov 11 22:33:08 2014 Tanaka Akira <akr@fsij.org>
-
- * test/net/pop/test_pop.rb: Use assert_join_threads.
-
-Tue Nov 11 22:07:20 2014 Tanaka Akira <akr@fsij.org>
-
- * test/net/http/test_https_proxy.rb: Use assert_join_threads.
-
-Tue Nov 11 18:09:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/prelude.c.tmpl: move from tool/compile_prelude.rb and
- expand by generic_erb.rb.
-
-Tue Nov 11 13:01:31 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/rubygems/commands/contents_command.rb (files_in_default_gem):
- remove useless sort. show_files will sort the result and
- another branch, files_in_gem, doesn't sort.
- it should be removed for consistency.
-
- * test/rubygems/test_gem_commands_contents_command.rb
- (test_execute_default_gem): adjust the sort algorithm with
- Gem::Commands::ContentsCommand#show_files, which sort items
- as array of [prefix, basename] not strings.
-
-Tue Nov 11 10:37:09 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (sym_equal): use rb_obj_equal().
- rb_obj_equal() is specially optimized in
- opt_eq_func()@vm_insnhelper.c.
-
- This fix is made from this discussion:
- https://www.omniref.com/ruby/2.1.4/symbols/Symbol/%3D%3D#line=8361.
-
-Tue Nov 11 09:38:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rdoc/known_classes.rb: reverted regression changes of
- rdoc known class.
-
-Tue Nov 11 00:21:50 2014 Tanaka Akira <akr@fsij.org>
-
- * test/net/imap/test_imap.rb: Don't ignore exceptions on server
- threads.
-
-Mon Nov 10 23:34:13 2014 Tanaka Akira <akr@fsij.org>
-
- * test/net/ftp/test_ftp.rb (create_ftp_server): Don't ignore
- exceptions on server thread.
- Delete read_timeout method call to fix NoMethodError.
-
-Mon Nov 10 20:20:53 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_read): retry with reduced length if cannot to
- write any data but no error occurs.
-
-Mon Nov 10 20:04:16 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/server.rb: Setup shutdown pipe in listen method.
-
-Mon Nov 10 19:37:09 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/win32/win32.h (rb_w32_set_nonblock): new
- function to support nonblock-mode of pipes.
-
- * win32/win32.c (rb_w32_read): nonblock-mode pipe returns ERROR_NO_DATA
- if there is no data, but also returns it if remote-end is closed.
-
- * win32/win32.c (rb_w32_write): if cannot to write any data, it may be
- blocking.
-
- * io.c (rb_io_set_nonblock): use rb_w32_set_nonblock for Windows.
-
- * ext/io/nonblock/nonblock.c (rb_io_nonblock_set): use ruby's API when
- setting nonblock-mode.
-
- * test/ruby/test_io.rb: test nonblock pipes on Windows.
-
-Mon Nov 10 17:24:34 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (etc_getlogin): set login name encoding properly.
- [ruby-core:66163] [Bug #10493]
-
-Mon Nov 10 16:20:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rubygems/*.rb: Update to RubyGems master(3e36528).
-
-Mon Nov 10 16:09:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (rb_f_kill): [DOC] mention known signal list.
- [ruby-core:66162] [Bug #10492]
-
-Mon Nov 10 14:17:58 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rdoc/*.rb: Update to RDoc 4.2.0.alpha(579a11c)
-
-Mon Nov 10 12:44:39 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/server.rb: Less instance variables.
-
-Mon Nov 10 12:19:43 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/server.rb (shutdown): Use close() on @shutdown_pipe_w to
- notify readability on the read side of the pipe.
- write_nonblock() is not usable for pipe on Windows.
- (cleanup_shutdown_pipe): Rescue IOError for @shutdown_pipe_w.close.
-
-Mon Nov 10 07:31:59 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/server.rb (initialize): Initialize shutdown pipe here
- to avoid race condition.
- (cleanup_shutdown_pipe): New private method.
- (cleanup_listener): Extracted from shutdown method.
- Call this method from start method to avoid race condition.
-
-Mon Nov 10 05:57:53 2014 Tanaka Akira <akr@fsij.org>
-
- * test/webrick/webrick.cgi: Don't use debug mode.
-
- * test/webrick/webrick_long_filename.cgi: Ditto.
-
-Sun Nov 9 23:25:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (vm_call_super): allow bound proc method to call super
- method.
-
- * vm_insnhelper.c (vm_yield_with_cfunc): push defined class and
- bound proc method entry to the control frame.
-
-Sun Nov 9 22:46:13 2014 Tanaka Akira <akr@fsij.org>
-
- * test/open-uri: Test server log in server thread.
-
- * test/webrick: Ditto.
-
-Sun Nov 9 22:28:34 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/httpstatus.rb: require webrick/accesslog for AccessLog.
-
-Sun Nov 9 21:03:59 2014 Tanaka Akira <akr@fsij.org>
-
- * test/webrick: Fix the argument order of assert_equal.
-
-Sun Nov 9 20:29:01 2014 Tanaka Akira <akr@fsij.org>
-
- * test/webrick: Store log in an array.
-
- * test/net/http: Ditto.
-
- * test/open-uri: Ditto.
-
-Sun Nov 9 18:35:36 2014 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc: Refine log test.
-
-Sun Nov 9 18:33:33 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: Replaced if-else by
- case in self.normalized? in parallel to r48309.
-
-Sun Nov 9 18:07:00 2014 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc: Use assert_join_threads.
-
-Sun Nov 9 14:06:13 2014 Tanaka Akira <akr@fsij.org>
-
- * test/xmlrpc: Test webrick error log is empty.
-
-Sun Nov 9 13:47:02 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (is_incremental_marking): use #if/#else because
- rb_objspace_t::flags::during_incremental_marking is not defined
- when GC_ENABLE_INCREMENTAL_MARK is 0.
-
- * gc.c (will_be_incremental_marking, is_full_marking): similar fix.
-
-Sun Nov 9 12:16:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/securerandom.rb (SecureRandom.gen_random): separate
- implementation details and select at the load time.
-
-Sun Nov 9 12:09:38 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32/lib/win32/registry.rb (Win32::Registry::API#Enum{Value,Key):
- ditto.
-
-Sun Nov 9 11:48:40 2014 Tanaka Akira <akr@fsij.org>
-
- * test/net/http: Examine webrick log.
-
-Sun Nov 9 11:45:19 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gems/bundled_gems: upgraded to test-unit 3.0.5.
-
-Sun Nov 9 11:40:50 2014 Tanaka Akira <akr@fsij.org>
-
- * defs/known_errors.def: More errors for FreeBSD.
-
-Sun Nov 9 11:25:11 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * gems/bundled_gems: upgraded to power_assert 0.2.0.
-
-Sun Nov 9 10:31:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/securerandom.rb: set the script encoding to make a string
- literal in SecureRandom::Kernel32.last_error_message single byte
- encoding so msg[] works in bytes, since FormatMessage() returns
- the size in TCHARs, not in characters.
-
-Sun Nov 9 09:50:22 2014 Tanaka Akira <akr@fsij.org>
-
- * test/webrick: Refine log tests.
-
-Sun Nov 9 08:58:05 2014 Tanaka Akira <akr@fsij.org>
-
- * defs/known_errors.def (EHWPOISON): New errno symbol.
- It is defined by glibc-2.16.
-
-Sun Nov 9 05:00:23 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/securerandom.rb (initialize): call the special method for Win32
- before checking `/dev/urandom` because we know windows doesn't have it.
-
-Sun Nov 9 04:01:46 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/securerandom.rb (SecureRandom::AdvApi32): split from `initialize`.
- thanks @zzak to remember it.
-
-Sun Nov 9 02:05:33 2014 Tanaka Akira <akr@fsij.org>
-
- * test/net/http/utils.rb: Don't connect to spawned server
- before actual test.
-
-Sun Nov 9 01:51:50 2014 Benoit Daloze <eregontp@gmail.com>
-
- * object.c (Module#const_defined?): [DOC] Revise the documentation.
- Patch by Xavier Noria.
- [Fixes GH-754] https://github.com/ruby/ruby/pull/754
-
-Sun Nov 9 00:37:44 2014 Tanaka Akira <akr@fsij.org>
-
- * test/webrick: Examine log and use assert_join_threads.
-
-Fri Nov 7 00:00:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/unicode_norm_gen.tmpl: expand kompatible_table so that
- recursive expansion is not needed at runtime.
-
-Thu Nov 6 23:58:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * pack.c (pack_pack): escape unprintable characters and preserve
- the encoding of warning message.
-
-Thu Nov 6 23:55:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (sym_printable): QUOTE() should not raise an exception
- even on invalid byte sequence.
-
-Thu Nov 6 21:44:36 2014 Tanaka Akira <akr@fsij.org>
-
- * test/test_unicode_normalize.rb: Rename TestNormalize to
- TestUnicodeNormalize.
- Define constants under TestUnicodeNormalize.
-
-Thu Nov 6 21:22:59 2014 Tanaka Akira <akr@fsij.org>
-
- * test/open-uri/test_open-uri.rb: Check empty webrick log.
-
-Thu Nov 6 19:27:34 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * re.c (unescape_nonascii): cast -1 for the case char is unsigned char.
- If char is signed char, for example gcc for ARM or ppc64, it caused
- infinite loop.
- http://kmuto.jp/build-ruby/arm/ruby-trunk/log/20141106T013005Z.fail.html.gz
- http://rubyci.blob.core.windows.net/f19p8/ruby-trunk/log/20141106T090217Z.fail.html.gz
-
-Thu Nov 6 09:53:18 2014 Eric Wong <e@80x24.org>
-
- * lib/uri/rfc2396_parser.rb (initialize): reduce bytecode size
- 2088 => 1332 bytes on 32-bit x86
-
-Thu Nov 6 08:49:49 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: Comment clarification.
-
-Wed Nov 5 23:43:24 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * compile.c (compile_data_alloc): add padding when strict alignment
- is required for memory access. Currently, the padding is enabled
- only when the CPU is 32-bit SPARC and the compiler is GCC.
- [Bug #9681] [ruby-core:61715]
-
- * compile.c (STRICT_ALIGNMENT): defined if strict alignment is required
-
- * compile.c (ALIGNMENT_SIZE, ALIGNMENT_SIZE_MASK, PADDING_SIZE_MAX):
- new macros for alignment word size, bit mask, max size of padding.
-
- * compile.c (calc_padding): new function to calculate padding size.
-
-Wed Nov 5 23:24:45 2014 Tanaka Akira <akr@fsij.org>
-
- * test/open-uri/test_open-uri.rb: Don't ignore webrick's log.
-
-Wed Nov 5 19:20:08 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/server.rb: Stop listener loop properly.
- [ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.
-
-Wed Nov 5 17:20:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/intern.h (rb_disable_super, rb_enable_super): warn
- as deprecated at build time, instead of ignoring silently or
- warning at runtime only.
-
-Wed Nov 5 16:55:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_f_lambda): remove deprecated function, which has been
- unavailable from extension libraries.
-
-Wed Nov 5 16:26:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/intern.h (rb_clear_cache): mark as deprecated, not
- only warnings at runtime.
-
-Wed Nov 5 15:05:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_{,l,r}strip_bang): rb_str_subseq() will not
- NUL-terminate the result string, in the future, so it will not
- be needed in other cases.
-
-Wed Nov 5 14:11:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (lib/unicode_normalize/tables.rb): do nothing unless
- BASERUBY is available. MINIRUBY cannot load extension libraries,
- so cannot update Unicode data.
-
-Wed Nov 5 12:13:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_lstrip, rb_str_strip): reduce memory copy by
- copying necessary part only.
-
- * string.c (rb_str_strip_bang, rb_str_strip): ditto.
-
-Wed Nov 5 12:13:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_lstrip, rb_str_strip): reduce memory copy by
- copying necessary part only.
-
- * string.c (rb_str_strip_bang, rb_str_strip): ditto.
-
-Wed Nov 5 10:54:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_lstrip_bang, rb_str_rstrip_bang): terminate
- wchar strings with wchar 0.
-
-Tue Nov 4 21:23:22 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/win32/lib/Win32API.rb: Fiddle::Importer is defined in
- fiddle/import.rb and it's not loaded implicitly.
-
- * ext/win32/lib/Win32API.rb (Win32API#initialize): `import` is a string.
-
- * ext/win32/lib/Win32API.rb (Win32API#initialize):
- Fiddle::Importer::CALL_TYPE_TO_ABI is private constant.
-
-Tue Nov 4 21:20:07 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/securerandom.rb (SecureRandom.random_bytes): use fiddle directly
- instead of using Win32API.
-
-Tue Nov 4 21:04:30 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rubygems/test_gem_request_set_lockfile.rb
- (test_relative_path_from): driveletter support.
-
-Tue Nov 4 16:23:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/rubygems/test_gem_remote_fetcher.rb (RemoteFetcherCleanup):
- close all pooled connections for each tests to fix leaked file
- descriptors.
-
-Tue Nov 4 12:51:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (PRIsVALUE), vsnprintf.c (BSD_vfprintf): add
- RUBY_PRI_VALUE_MARK to reduce danger of accidental conflict with
- plain "%i". binary incompatible with extension libraries using
- PRIsVALUE and built for 2.1 and earlier. [EXPERIMENTAL]
-
-Tue Nov 4 12:33:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * object.c: fix document of Kernel#String by @suzukaze
- [fix GH-743][ci skip]
-
-Tue Nov 4 12:21:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/csv.rb: added documentation for skip_blanks option by @decasia
- [fix GH-744][ci skip]
-
-Tue Nov 4 12:09:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/open3.rb: fix code formatting in documentation by @JoshCheek
- [fix GH-747][ci skip]
-
-Tue Nov 4 08:57:37 2014 Eric Wong <e@80x24.org>
-
- * encoding.c (enc_memsize): remove unnecessary function
- [ruby-core:65304]
-
-Mon Nov 3 18:09:39 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/utils.rb: The default of :ignore_listener_error is
- changed to false.
-
-Mon Nov 3 14:42:37 2014 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (iseq_free): resolve memory leak.
-
-Mon Nov 3 13:49:18 2014 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (iseq_memsize): catch up recent changes.
-
-Mon Nov 3 13:38:28 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: change semantics of opt_num and opt_table.
- `opt_num' was the number of optional parameters + 1.
- `opt_table' has "opt_num" entries.
-
- Change them to:
- `opt_num' is the number of optional parameters.
- `opt_table' has "opt_num + 1" entries.
-
- This change simplify parameter fitting logics.
-
- * compile.c: catch up this change.
-
- * iseq.c: ditto.
-
- * proc.c: ditto.
-
- * vm_args.c: ditto.
-
-Mon Nov 3 11:47:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * NEWS: added period into Matrix section. [ci skip]
- [misc #10446][ruby-core:65987]
-
-Mon Nov 3 09:43:30 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * vm_args.c: fixed build error with clang
-
-Mon Nov 3 09:32:46 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/rfc3986_parser.rb (URI::RFC3986_Parser::RFC3986_URI):
- allow '[' and ']' for URI input (and escape). [Bug #10402]
-
- * lib/uri/generic.rb (URI#query=): escape '[', '\', and ']'.
-
-Mon Nov 3 07:49:34 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: change iseq parameter data structure.
- https://bugs.ruby-lang.org/issues/10440#change-49694
-
- * change terminology `arg' to `param'.
- * move rb_iseq_t::arg_* to rb_iseq_t::param.
- * move rb_iseq_t::arg_size to rb_iseq_t::param::size.
- * move rb_iseq_t::argc to rb_iseq_t::param::lead_num.
- * move rb_iseq_t::arg_opts to rb_iseq_t::param::opt_num.
- * move rb_iseq_t::arg_rest to rb_iseq_t::param::rest_start.
- * move rb_iseq_t::arg_post_num to rb_iseq_t::param::post_num.
- * move rb_iseq_t::arg_post_start to rb_iseq_t::param::post_start.
- * move rb_iseq_t::arg_block to rb_iseq_t::param::block_start.
- * move rb_iseq_t::arg_keyword* to rb_iseq_t::param::keyword.
- rb_iseq_t::param::keyword is allocated only when keyword
- parameters are available.
- * introduce rb_iseq_t::param::flags to represent parameter
- availability. For example, rb_iseq_t::param::flags::has_kw
- represents that this iseq has keyword parameters and
- rb_iseq_t::param::keyword is allocated.
- We don't need to compare with -1 to check availability.
- * remove rb_iseq_t::arg_simple.
-
- * compile.c: catch up this change.
-
- * iseq.c: ditto.
-
- * proc.c: ditto.
-
- * vm.c, vm_args.c, vm_dump.c, vm_insnhelper.c: ditto.
-
- * iseq.c (iseq_data_to_ary): support keyword argument.
-
-Mon Nov 3 03:39:04 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_method.rb: r48239 makes this test green.
-
-Mon Nov 03 03:02:38 2014 Koichi Sasada <ko1@atdot.net>
-
- * rewrite method/block parameter fitting logic to optimize
- keyword arguments/parameters and a splat argument.
- [Feature #10440] (Details are described in this ticket)
-
- Most of complex part is moved to vm_args.c.
-
- Now, ISeq#to_a does not catch up new instruction format.
-
- * vm_core.h: change iseq data structures.
-
- * introduce rb_call_info_kw_arg_t to represent keyword arguments.
- * add rb_call_info_t::kw_arg.
- * rename rb_iseq_t::arg_post_len to rb_iseq_t::arg_post_num.
- * rename rb_iseq_t::arg_keywords to arg_keyword_num.
- * rename rb_iseq_t::arg_keyword to rb_iseq_t::arg_keyword_bits.
- to represent keyword bitmap parameter index.
- This bitmap parameter shows that which keyword parameters are given
- or not given (0 for given).
- It is referred by `checkkeyword' instruction described bellow.
- * rename rb_iseq_t::arg_keyword_check to rb_iseq_t::arg_keyword_rest
- to represent keyword rest parameter index.
- * add rb_iseq_t::arg_keyword_default_values to represent default
- keyword values.
- * rename VM_CALL_ARGS_SKIP_SETUP to VM_CALL_ARGS_SIMPLE
- to represent
- (ci->flag & (SPLAT|BLOCKARG)) &&
- ci->blockiseq == NULL &&
- ci->kw_arg == NULL.
-
- * vm_insnhelper.c, vm_args.c: rewrite with refactoring.
-
- * rewrite splat argument code.
- * rewrite keyword arguments/parameters code.
- * merge method and block parameter fitting code into one code base.
-
- * vm.c, vm_eval.c: catch up these changes.
-
- * compile.c (new_callinfo): callinfo requires kw_arg parameter.
-
- * compile.c (compile_array_): check the last argument Hash object or
- not. If Hash object and all keys are Symbol literals, they are
- compiled to keyword arguments.
-
- * insns.def (checkkeyword): add new instruction.
- This instruction check the availability of corresponding keyword.
-
- For example, a method "def foo k1: 'v1'; end" is compiled to the
- following instructions.
-
- 0000 checkkeyword 2, 0 # check k1 is given.
- 0003 branchif 9 # if given, jump to address #9
- 0005 putstring "v1"
- 0007 setlocal_OP__WC__0 3 # k1 = 'v1'
- 0009 trace 8
- 0011 putnil
- 0012 trace 16
- 0014 leave
-
- * insns.def (opt_send_simple): removed and add new instruction
- "opt_send_without_block".
-
- * parse.y (new_args_tail_gen): reorder variables.
- Before this patch, a method "def foo(k1: 1, kr1:, k2: 2, **krest, &b)"
- has parameter variables "k1, kr1, k2, &b, internal_id, krest",
- but this patch reorders to "kr1, k1, k2, internal_id, krest, &b".
- (locate a block variable at last)
-
- * parse.y (vtable_pop): added.
- This function remove latest `n' variables from vtable.
-
- * iseq.c: catch up iseq data changes.
-
- * proc.c: ditto.
-
- * class.c (keyword_error): export as rb_keyword_error().
-
- * common.mk: depend vm_args.c for vm.o.
-
- * hash.c (rb_hash_has_key): export.
-
- * internal.h: ditto.
-
-Mon Nov 3 02:35:32 2014 Koichi Sasada <ko1@atdot.net>
-
- * sample/simple-bench.rb: added to measure performance of simple
- lines.
-
-Mon Nov 3 02:33:43 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (obj_info): show T_STRING more details.
-
-Sun Nov 2 01:30:32 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/test_ssl.rb: Don't ignore errors on listener threads,
- as much as possible.
-
- * test/openssl/test_ssl_session.rb: Ditto.
-
- * test/openssl/test_partial_record_read.rb: Ditto.
-
-Sat Nov 1 23:11:05 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/utils.rb (start_server): Don't close sockets before
- threads finished.
-
-Sat Nov 1 22:06:24 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/test_ssl_session.rb (test_ctx_client_session_cb): Don't
- ignore errors of SSL accept.
- (test_ctx_server_session_cb): Ditto.
-
- * test/openssl/utils.rb (server_loop): Add ignore_ssl_accept_error
- argument.
- (start_server): Refine threads waits.
-
- * test/ruby/envutil.rb (assert_join_threads): Show a thread before
- backtrace.
-
-Sat Nov 1 20:40:18 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/utils.rb (start_server, server_loop): Use a
- pipe to stop server instead of shutdown/close a listening socket.
-
-Sat Nov 1 19:24:59 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/envutil.rb (assert_join_threads): New assertion to
- join multiple threads without exceptions.
-
-Sat Nov 1 17:09:32 2014 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (bary_mul_balance_with_mulfunc): Fix free work area
- location.
- [ruby-dev:48723] [Bug #10464]
- [ruby-core:66044] [Bug #10465]
- Reported by Kohji Nishihama.
-
-Sat Nov 1 15:45:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parse_atmark): mere atmark and two atmarks without
- succeeding identifiers are invalid as instance/class variable
- names.
-
-Sat Nov 1 06:31:41 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_variant.c: use typed data.
-
-Fri Oct 31 13:55:28 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/dl/*: remove DL as it is replaced by Fiddle.
- [Feature #5458] Thanks to Jonan Scheffler <jonanscheffler@gmail.com>
- for this patch
-
- * test/dl/*: ditto.
-
-Fri Oct 31 15:26:02 2014 Charles Oliver Nutter <headius@headius.com>
-
- * test/openssl/test_ssl.rb: Add certificate verification chain
- test from JRuby community.
-
-Fri Oct 31 18:58:02 2014 Charles Oliver Nutter <headius@headius.com>
-
- * test/psych/test_emitter.rb: Fix line_width test...initial value
- is impl-specific and attr assignment always returns LHS.
-
-Fri Oct 31 22:19:30 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/digest/lib/digest.rb (Digest()): This function should now be
- thread-safe. If you have a problem with regard to on-demand
- loading under a multi-threaded environment, preload "digest/*"
- modules on boot or use this method instead of directly
- referencing Digest::*. [Bug #9494]
- cf. https://github.com/aws/aws-sdk-ruby/issues/525
-
-Fri Oct 31 21:33:17 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * test/digest/test_digest.rb: Drop #!. This no longer runs
- stand-alone because it depends on ruby/envutil.
-
-Fri Oct 31 17:22:19 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/setup.mak: $(APPEND) with some arguments insert a space before
- the arguments, so it causes error if the arguments are expected to be
- a macro definition. this fix resolve the build error introduced at
- r48210.
-
-Fri Oct 31 16:47:35 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/syslog/lib/syslog/logger.rb (Syslog::Logger::VERSION): Bump
- the VERSION to 2.1.0. [ruby-core:64483] [Bug #10159]
-
-Fri Oct 31 16:33:46 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/net/imap.rb (Net::IMAP#fetch): [DOC] Document that
- Net::IMAP#fetch will return nil instead of an empty array.
-
-Fri Oct 31 12:54:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (.unicode-tables.time): needs Unicode files always,
- and should update after downloading these files.
- [ruby-core:66026] [Bug #10461]
-
-Fri Oct 31 10:16:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: reverted r48199, it's unrelated configuration.
-
-Fri Oct 31 09:58:14 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_unicode_normalize.rb: added unicode version number to
- test data location.
-
-Fri Oct 31 09:56:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .gitignore: ignored unicode data with version directories.
-
-Fri Oct 31 09:35:30 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: tweak build scripts for unicode_normalize.rb.
-
-Thu Oct 30 18:47:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk: fix for the case ALWAYS_UPDATE_UNICODE=no
-
-Thu Oct 30 13:23:23 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: changed Unicode data download location
- from latest Unicode version to Unicode 7.0.0.
-
-Thu Oct 30 11:16:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_arg{_complex,}): try conversion
- by to_ary for a lambda, as well as a proc.
- [ruby-core:65887] [Bug #9605]
-
-Wed Oct 29 21:13:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (gettable_gen): warn circular argument reference, for
- transition from 2.1 and earlier. [ruby-core:65990] [Bug #10314]
-
-Wed Oct 29 20:41:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_params): remove unused member `cur_mid`.
- this has been taken over by `in_def` since 1.6.
-
-Wed Oct 29 14:44:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (rb_f_load): path name needs to be transcoded to OS path
- encoding. [ruby-list:49994]
-
-Wed Oct 29 11:48:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (__builtin_setjmp): disable with gcc/clang earlier
- than 4.3 on Mac OS X. [ruby-core:65174] [Bug #10272]
-
-Wed Oct 29 11:43:43 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Generalize Vector#cross_product to arbitrary
- dimensions
- based on a patch by gogo tanaka [#10074]
-
-Wed Oct 29 11:43:11 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Matrix#adjucate
- patch by gogo tanaka [#10056]
-
-Wed Oct 29 11:42:33 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add aliases for Vector#cross & dot
- patch by gogo tanaka [#10352]
-
-Wed Oct 29 10:00:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gems/bundled_gems: Update latest version of bundled gems.
-
-Tue Oct 28 16:52:07 2014 Eric Wong <e@80x24.org>
-
- * signal.c (install_sighandler): remove rb_disable_interrupt and
- rb_enable_interrupt calls
- (init_sigchld): ditto
- (Init_signal): disable and enable interrupt once around all
- install_sighandler and init_sigchld to reduce syscalls at start
- [Feature #9345] [ruby-core:59480]
-
-Tue Oct 28 16:22:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (process_options, load_file_internal2): should not
- require other files when dump option is given.
- [ruby-dev:48712] [Bug #10435]
-
-Tue Oct 28 14:51:38 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: remove apple-gcc4.2 from CC candidates.
-
-Mon Oct 27 20:13:37 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/rexml/entity.rb: keep the entity size within the limitation.
- reported by Willis Vandevanter <will@silentrobots.com> and
- patched by nahi.
-
-Mon Oct 27 17:17:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (method_proc): the receiver of binding from method should
- be same as the receiver of the method.
- [ruby-core:65917] [Bug #10432]
-
-Mon Oct 27 16:26:37 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_super.rb: add a test to check block passing.
-
-Mon Oct 27 15:59:26 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: is_incremental_marking(), will_be_incremental_marking():
- use `&&' with GC_ENABLE_INCREMENTAL_MARK instead of using
- #if/#else/#endif.
-
-Mon Oct 27 13:40:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (gc_sweep_rest): sweep rest pages regardless of whether
- lazy sweep is enabled or not. based on the patch by Masahiro
- Ide at [ruby-dev:48706]. [Bug #10431]
-
-Mon Oct 27 11:18:32 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- reduce garbage during forks
-
-Sun Oct 25 12:26:26 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * template/insns.inc.tmpl, insns_info.inc.tmpl, known_errors.inc.tmpl,
- minsns.inc.tmpl: fixed path of generating script.
-
-Sun Oct 26 12:24:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/ripper/lib/ripper/sexp.rb (Ripper.sexp, Ripper.sexp_raw):
- return nil on error. [ruby-dev:48678] [Bug #10405]
-
-Sun Oct 25 11:24:24 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * string.c: improved comment.
-
-Sun Oct 26 07:40:11 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_val2variant, ole_invoke): refactoring.
- use ole_variant2variant to convert WIN32OLE_VARIANT object to
- VARIANT object.
-
- * ext/win32ole/win32ole_variant.c: refactoring. add
- ole_variant2variant.
- * ext/win32ole/win32ole_variant.h: ditto.
-
-Sat Oct 25 22:28:17 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c (io_binwrite_string): Test writev() failure.
-
-Sat Oct 25 20:19:19 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * test/test-unicode_normalize.rb: added test_us_ascii.
-
-Sat Oct 25 20:09:09 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: added US_ASCII
- as trivially supported encoding (is always normalized,
- and may appear mixed in with UTF-8 or other Unicode
- encodings).
-
-Sat Oct 25 20:01:01 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * test/test-unicode_normalize.rb: added
- test_raise_exception_for_non_unicode_encoding.
-
-Sat Oct 25 19:30:30 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * test/test-unicode_normalize.rb: removed unused function.
-
-Sat Oct 25 18:41:41 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * template/unicode_norm_gen.tmpl: Adjusted name of generating file.
-
-Fri Oct 24 22:49:42 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): dispatch newline and space at fluent
- interface, so that the following identifier does not include the
- space. [ruby-dev:48684] [Bug #10411]
-
-Fri Oct 24 20:41:36 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * signal.c (check_reserved_signal_): fix write count since r47991.
-
-Thu Oct 23 21:42:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_delete): now does not call the block given to
- the current method. [ruby-core:65861] [Bug #10413]
-
-Thu Oct 23 19:13:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_method_entry_make): warn redefinition only for
- already defined methods, but not for undefined methods.
- [ruby-dev:48691] [Bug #10421]
-
-Thu Oct 23 17:19:04 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/source.rb (REXML::IOSource#encoding_updated): Fix a
- bug that can't parse XML correctly when
- Encoding.default_internal is different with XML
- encoding. REXML::Source converts XML encoding on read. So IO
- should not convert XML encoding.
- Based on patch by NAKAMURA Usaku.
- [ruby-dev:48686] [Bug #10418]
-
- * test/rexml/test_encoding.rb
- (REXMLTests::EncodingTester#test_parse_utf16_with_utf8_default_internal):
- Add the for the above case.
-
-Thu Oct 23 16:29:02 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_encoding.rb
- (REXMLTests::EncodingTester#test_parse_utf16): Use meaningful
- test name. "ticket" in the old test name means the ticket in
- REXML's issue tracker. The REXML's issue tracker was gone. So
- "ticket" is meaningless.
-
- * test/rexml/data/ticket_110_utf16.xml: Rename to ...
- * test/rexml/data/utf16.xml: ... this.
-
-Thu Oct 23 16:18:11 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_encoding.rb
- (REXMLTests::EncodingTester#test_ticket_110): Fix expected and
- actual order.
- Patch by NAKAMURA Usaku. Thanks!!!
-
-Thu Oct 23 10:47:16 2014 Eric Wong <e@80x24.org>
-
- * insns.def (getlocal,setlocal): add comment to def/opt_operand.def
-
-Thu Oct 23 10:22:41 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- use IO#wait_readable instead of timeout
-
-Thu Oct 23 10:22:24 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- ensure exit! during fork failure
-
-Thu Oct 23 10:21:21 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * NEWS: Added String#unicode_normalize(|!|d?) [ci skip]
-
-Thu Oct 23 03:41:51 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (unknown_keyword_error): delete expected keywords
- directly from raw table, so that the given block is not called.
- [ruby-core:65837] [Bug #10413]
-
-Thu Oct 23 02:33:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (update-unicode): invert dependency to run every times.
- [ruby-core:65842] [Bug #10415]
-
- * common.mk (after-update): update files under source tree.
- [ruby-core:65840] [Bug #10414]
-
-Wed Oct 22 22:38:59 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override
- options even if OpenSSL::SSL::OP_NO_SSLv3 is not defined.
- this is pointed out by Stephen Touset. [ruby-core:65711] [Bug #9424]
-
-Wed Oct 22 21:31:56 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * common.mk (prelude.c): add dependency to LIB_SRCS because
- enc/prelude.rb requires lib/unicode_normalize.rb, and it's also
- requires lib/unicode_normalize/tables.rb (=LIB_SRCS).
-
-Wed Oct 22 21:09:51 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * configure.in (nacl_cv_cpu_nick): fix typo in PNaCl.
- (XCFLAGS) Add -isystem flag to pnacl and nacl-newlib
- (CXX): added
-
- * nacl/GNUmakefile.in (CXX): Added
- (PPROGRAM): Use clang++ instead of clang because libnacl_io
- depends on c++ std lib.
-
-Wed Oct 22 21:07:32 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * common.mk (build-ext): avoid trying to build dynamic libraries
- if configured --with-static-linked-ext.
-
-Wed Oct 22 20:33:33 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * common.mk: Fixed grammar in comment [ci skip]
-
-Wed Oct 22 19:18:18 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/unicode_norm_gen.rb: Fixed escaping of backslash and
- double quote ('\\\&' -> "\\\\\\\&"; double quoted string
- is needed to make \& mean last match; double double
- backslashes are needed because of two layers of escaping).
-
-Wed Oct 22 18:13:29 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/test-unicode_normalize.rb: as often said, ruby is sometimes built
- at non-srcdir.
-
-Wed Oct 22 18:12:12 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * test/test-unicode_normalize.rb: Adjusted path for test
- data file (now ../enc/unicode/data/NormalizationTest.txt).
-
-Wed Oct 22 18:07:07 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * test/test-unicode_normalize.rb: Removed explicit require,
- changed method names, adjusted copyright.
-
-Wed Oct 22 18:00:00 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * test/test-unicode_normalize.rb: Importing from
- https://github.com/duerst/eprun/blob/master/test/test_normalize.rb.
- (removing trailing whitespace, fixing EOLs and adding EOL property)
-
-Wed Oct 22 08:21:09 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * nacl/pepper_main.c (Instance_DidCreate): mount devfs and rebind fd 0
- .. 2 so that stderr goes to the console of the browser.
-
-Wed Oct 22 03:47:43 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/etc/etc.c (etc_nprocessors_affin): maximum "n" should be 16384.
-
-Wed Oct 22 03:37:00 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/etc/etc.c (etc_nprocessors_affin): minor spell fix.
-
-Wed Oct 22 03:33:58 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/etc/etc.c (etc_nprocessors_affin): optimize memory usage a
- bit. Typical rubyist never use 8k cpus machine.
-
-Wed Oct 22 00:01:09 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * configure.in (XCFLAGS): Add include path for NaCl libraries.
- (XLDFLAGS): ditto.
- (NACL_LIB_PATH): new substitution
-
- * nacl/nacl-config.rb: support NACL_LIB_PATH
-
- * nacl/package.rb: ditto.
-
- * nacl/pepper_main.c: replace old implementations with nacl_io.
-
- * nacl/GNUmakefile.in: link nacl_io to pepper_ruby
-
- * ruby.c (rb_load_file): remove __attribute__((weak)) because the old
- override hack was replaced with nacl_io.
-
- * file.c (rb_file_load_ok): ditto.
-
-Tue Oct 21 17:32:32 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * common.mk: Adding explicit creation of directory
- enc/unicode/data because git doesn't handle empty
- directories. [patch by Masahiro Ide, filed with r48073]
-
-Tue Oct 21 17:12:12 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/tables.rb: Committing to make version
- update easier and more predictable, and reducing compilation
- time.
-
-Tue Oct 21 15:56:56 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: Added comment to point to
- relevant portion of Unicode standard for Hangul (de)composition
- identifiers and algorithm.
-
-Tue Oct 21 11:49:16 2014 Andreas Schwab <schwab@suse.de>
-
- * gc.c (mark_current_machine_context) [__mc68000__]: Update stack
- marking.
- (rb_gc_mark_machine_stack) [__mc68000__]: Also handle it here.
-
-Mon Oct 20 23:59:38 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * enc/prelude.rb: we sometimes run ruby without library path (especially
- for test), so should permit to run ruby if unicode_normalize.rb is
- missing.
-
-Mon Oct 20 23:57:58 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * common.mk (lib/unicode_normalize/tables.rb): enable running (n)make
- in non-srcdir.
-
-Mon Oct 20 23:58:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/downloader.rb: add -a option to always download regardless
- existing files.
-
-Mon Oct 20 23:18:18 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb: no need to convert path separator for COPY because it's
- ruby -run cp and it can treat '/' on any platform.
-
-Mon Oct 20 19:54:54 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * config.mk: Added missing data files as targets for
- prerequisite update_unicode.
-
-Mon Oct 20 19:06:06 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: revert r48046. The s in sIndex
- is not hungarian notation. The variable name sIndex is
- directly taken from the relevant part of the Unicode
- Standard, where it is written SIndex and stands for
- 'syllable index'. See pp. 144/145 of
- http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf.
-
-Mon Oct 20 12:46:46 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: removing unnecessary 'self'.
-
-Mon Oct 20 12:37:37 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: change method names
- in commented-out code. Followup to r48027.
-
-Mon Oct 20 02:23:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (rb_ivar_get), vm_insnhelper.c (vm_getivar): improve
- instance variable retrieval performance by checking ruby_verbose
- before call of rb_warning and evaluation of its argument.
- [ruby-core:65786] [Feature #10396]
-
-Sun Oct 19 23:31:29 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/unicode_normalize.rb: (unicode_normalize!): change method name.
- catch up the method name change at r48014. [Feature #10084]
-
-Sun Oct 19 20:05:58 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/tk/lib/tkextlib/tile/treeview.rb: fix syntax error.
-
-Sun Oct 19 18:39:39 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * enc/prelude.rb: Added automatic loading of
- lib/unicode_normalize.rb. This makes sure that all
- the methods that are available on String are
- available without explicit require.
-
-Sun Oct 19 18:35:35 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: Added a missing
- file extension in require statement.
-
-Sun Oct 19 18:13:13 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * common.mk: Added a rule to generate
- lib/unicode_normalize/tables.rb. This rule still
- needs to be integrated into the overall make process.
-
-Sun Oct 19 17:53:53 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Changed to dynamic
- loading of actual normalization code and tables.
-
-Sun Oct 19 17:37:37 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Small documentation fix.
-
-Sun Oct 19 17:26:26 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Added documentation.
-
-Sun Oct 19 11:09:09 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/unicode_norm_gen.rb, lib/unicode_normalize.rb:
- File name change from lib/unicode_normalize/normalize_tables.rb
- to lib/unicode_normalize/tables.rb.
-
-Sun Oct 19 10:12:12 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Changing method names, see
- https://bugs.ruby-lang.org/issues/10084#note-7
-
-Sun Oct 19 10:10:10 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Changing module name.
-
-Sun Oct 19 10:08:08 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Changing require statement,
- adjusting copyright.
-
-Sun Oct 19 10:04:04 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize.rb: Importing from
- https://github.com/duerst/eprun/blob/master/lib/string_normalize.rb.
- (removing trailing whitespace, fixing EOLs and adding EOL property)
-
-Sun Oct 19 09:56:56 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/unicode_norm_gen.rb: Changed module name.
-
-Sun Oct 19 09:48:48 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: Changed module name,
- adjusted copyright.
-
-Sun Oct 19 09:38:38 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize/normalize.rb: Importing from
- https://github.com/duerst/eprun/blob/master/lib/normalize.rb.
-
-Sat Oct 18 20:40:52 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_core.h, proc.c, vm_backtrace.c, vm_trace.c:
- remove rb_binding_new_with_cfp, and use rb_vm_make_binding instead.
-
-Sat Oct 18 20:38:48 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_core.h, vm.c, proc.c: fix GC mark miss on bindings.
- [ruby-dev:48616] [Bug #10368]
-
- * test/ruby/test_eval.rb: add a test code.
-
-Fri Oct 17 22:47:11 2014 Tanaka Akira <akr@fsij.org>
-
- * pack.c (pack_unpack): Add casts for char references for 'u'.
- Fix line ending recognition algorithm.
-
-Fri Oct 17 21:49:52 2014 Tanaka Akira <akr@fsij.org>
-
- * pack.c (pack_unpack): Add casts for char references for 'b' and 'h'.
-
-Fri Oct 17 17:50:10 2014 Tanaka Akira <akr@fsij.org>
-
- * Avoid undefined behaviors found by gcc -fsanitize=undefined.
- gcc (Debian 4.9.1-16) 4.9.1
-
- * string.c (rb_str_sum): Avoid undefined behavior.
-
-Fri Oct 17 17:43:50 2014 Tanaka Akira <akr@fsij.org>
-
- * Avoid undefined behaviors found by gcc -fsanitize=undefined.
- gcc (Debian 4.9.1-16) 4.9.1
-
- * include/ruby/ruby.h (INT2FIX): Avoid undefined behavior.
-
- * node.h (nd_set_line): Ditto.
-
- * pack.c (encodes): Ditto.
- (pack_unpack): Ditto.
-
- * regint.h (BIT_STATUS_AT): Ditto.
- (BS_BIT): Ditto.
-
- * time.c (time_mdump): Ditto.
- (time_mload): Ditto.
-
- * vm_core.h (VM_FRAME_MAGIC_MASK): Ditto.
-
- * vm_trace.c (recalc_add_ruby_vm_event_flags): Ditto.
-
-Fri Oct 17 15:06:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * re.c (unescape_nonascii): make dynamically compiled US-ASCII
- regexps ASCII-8BIT encoding if binary (hexadecimal, control,
- meta) escapes are contained, as well as literal regexps.
- [ruby-dev:48626] [Bug #10382]
-
-Fri Oct 17 03:05:08 2014 Eric Wong <e@80x24.org>
-
- * test/-ext-/bug_reporter/test_bug_reporter.rb
- (test_bug_reporter_add): revert r47972
- * test/ruby/test_rubyoptions.rb (test_segv_test): revert r47971
- [ruby-core:65764]
-
-Thu Oct 16 23:17:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (rb_sigaltstack_size): double default size to get rid
- of heap corruption by alternate stack overflow in SEGV handler.
- typically happened at fprintf() in control_frame_dump().
-
-Thu Oct 16 22:43:12 2014 Tanaka Akira <akr@fsij.org>
-
- * vm_backtrace.c (id2str): Fix a variable name.
- [ruby-dev:48642] [Bug #10389]
-
-Thu Oct 16 20:01:26 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/envutil.rb (assert_pattern_list): Show number of matched
- patterns and characters.
-
-Thu Oct 16 16:26:09 2014 Eric Wong <e@80x24.org>
-
- * cont.c (fiber_store): fix WIN32 fibers
- [ruby-core:65745] [ruby-core:65758]
-
-Thu Oct 16 15:05:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_here_document): do not append already appended
- and disposed code fragment. [ruby-dev:48647] [Bug #10392]
-
-Thu Oct 16 10:35:33 2014 Eric Wong <e@80x24.org>
-
- * test/-ext-/bug_reporter/test_bug_reporter.rb
- (test_bug_reporter_add): fix race
-
-Thu Oct 16 10:09:02 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_rubyoptions.rb (test_segv_test): fix race
-
-Thu Oct 16 09:17:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * cont.c (rb_fiber_t): fix compile error caused by move to
- vm_core.h at r47964. [Feature #10341]
-
-Thu Oct 16 08:58:11 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
- avoid killing wrong parent
-
-Thu Oct 16 08:40:04 2014 Eric Wong <e@80x24.org>
-
- * cont.c (fiber_store): restore references to next_fib (fix typo)
-
-Thu Oct 16 08:26:08 2014 Eric Wong <e@80x24.org>
-
- * cont.c (fiber_store): remove references to nextfib
- fix build when FIBER_USE_NATIVE is 0
-
-Thu Oct 16 06:51:35 2014 Knut Franke <Knut.Franke@gmx.de>
-
- * vm_core.h: declare rb_fiber_t typedef
- (rb_thread_t): fiber and root_fiber become rb_fiber_t * (from VALUE)
- * vm.c (rb_thread_mark): use rb_fiber_mark_self
- * cont.c (rb_fiber_t): prev becomes rb_fiber_t * (from VALUE)
- (cont_mark, cont_free): simplify conditions
- (rb_fiber_mark_self): new function
- (fiber_mark): use rb_fiber_mark_self
- (cont_save_thread, cont_restore_thread): inline
- (cont_restore_thread): simplify
- (fiber_setcontext): simplify conditions
- (rb_cont_call): remove dereference
- (fiber_t_alloc): update for rb_fiber_t->prev type change
- (rb_fiber_start): ditto
- (fiber_current): extract from rb_fiber_current
- (return_fiber): move, simplify type checks
- (rb_fiber_current): use fiber_current
- (fiber_store): simplify type checks
- (fiber_switch): ditto, simplify call to fiber_setcontext,
- use fiber_current
- (rb_fiber_transfer): update for type changes
- (rb_fiber_terminate): move, use fiber_switch
- (rb_fiber_resume): update for type changes
- (rb_fiber_reset_root_local_storage): ditto
- (rb_fiber_yield): use rb_fiber_switch instead of rb_fiber_transfer
- (rb_fiber_m_transfer): ditto
- [ruby-core:65518] [Feature #10341]
-
-Thu Oct 16 06:25:29 2014 Knut Franke <Knut.Franke@gmx.de>
-
- * cont.c (rb_context_t): comment on saved_thread
- (cont_save_thread): sparse copy
- (cont_init): copy extra fields
- (fiber_init): use current thread VM stack size
- [ruby-core:65518] [Feature #10341]
-
-Thu Oct 16 06:13:09 2014 Knut Franke <Knut.Franke@gmx.de>
-
- * cont.c (cont_capture): remove unnecessary variable
- [ruby-core:65518] [Feature #10341]
-
-Thu Oct 16 05:02:31 2014 Knut Franke <Knut.Franke@gmx.de>
-
- * cont.c (fiber_store, fiber_switch): simplify
- [ruby-core:65518] [Feature #10341]
-
-Thu Oct 16 04:28:41 2014 Knut Franke <Knut.Franke@gmx.de>
-
- * cont.c (rb_fiber_t): remove prev_fiber/next_fiber
- (fiber_link_join, fiber_link_remove): remove functions
- (fiber_free, fiber_init, root_fiber_alloc):
- remove references to removed fields and functions
- [ruby-core:65518] [Feature #10341]
-
-Wed Oct 15 22:08:37 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/etc/etc.c (etc_nprocessors_affin): Test CPU_ALLOC availability.
- CentOS 5 don't have CPU_ALLOC().
-
-Wed Oct 15 18:26:19 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/etc/etc.c (etc_nprocessors_affinity): use sched_getaffinity
- for getting precious number of available cpus.
-
- * ext/etc/etc.c (etc_nprocessors): use etc_nprocessors_affinity if
- possible.
-
- [Feature #10267] etc-nprocessors-kosaki2.patch
-
-Wed Oct 15 17:53:28 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/envutil.rb (assert_pattern_list) Renamed from
- assert_regexp_list.
- Show multiline string in multi lines.
-
- * test/-ext-/bug_reporter/test_bug_reporter.rb: Use
- assert_pattern_list.
-
-Wed Oct 15 12:26:58 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/envutil.rb (assert_regexp_list): New assertion method.
-
- * test/ruby/test_rubyoptions.rb: Use assert_regexp_list.
-
-Wed Oct 15 07:21:09 2014 Tanaka Akira <akr@fsij.org>
-
- * enum.c: min(n) drops elements bigger than the n-th maximum element.
- (struct nmin_data): New field to record the n-th maximum element, limit
- (nmin_filter): Update limit field.
- (nmin_i): Drop too big elements.
- (nmin_run): Initialize limit field.
-
-Wed Oct 15 07:00:14 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_optimization.rb (test_string_size): new test
-
-Wed Oct 15 06:51:13 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_optimization.rb (test_string_eq_neq): new test
- (test_string_ltlt): ditto
-
-Wed Oct 15 06:50:29 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_optimization.rb (test_hash_aset_with):
- assert assignment
-
-Wed Oct 15 04:56:27 2014 Zachary Scott <e@zzak.io>
-
- * gc.c (rb_obj_id): [DOC] Fix typo, clean up sentence, and wrap cols
-
-Wed Oct 15 04:53:30 2014 Zachary Scott <e@zzak.io>
-
- * error.c: [DOC] Fix case of type in exception message by @tricknotes
- [Fixes GH-740] https://github.com/ruby/ruby/pull/740
-
- * object.c: ditto
-
-Tue Oct 14 21:39:16 2014 Vit Ondruch <vondruch@redhat.com>
-
- * tool/rbinstall.rb (gem): Fix permissions of bundled gems
- specification files. [ruby-core:65700] [Bug #10383]
-
-Tue Oct 14 19:15:31 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_record.c: use typed data.
-
-Tue Oct 14 16:23:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * symbol.c (global_symbols): make ids two-dimensional array of
- strings and symbols, for write-barrier.
-
- * symbol.c (global_symbols): make IDs immortal always, instead
- of treating dynamic symbols as IDs.
-
- * iseq.c, marshal.c, string.c: use rb_str_intern instead of
- rb_str_dynamic_intern.
-
- * symbol.c (rb_str_intern): rename rb_str_dynamic_intern.
-
-Tue Oct 14 10:19:10 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_optimization.rb (test_string_freeze): new test
- (test_hash_aref_with): ditto
- (test_hash_aset_with): ditto
-
-Tue Oct 14 01:27:54 2014 Tanaka Akira <akr@fsij.org>
-
- * enum.c (nmin_run): max(n) and max_by(n) returns an array in
- descending order.
- [ruby-core:65452] Suggested by David Grayson.
-
-Mon Oct 13 20:44:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (update-gems): chdir to the target directory and then
- add the tool directory to load paths, for older BASERUBY.
- [Bug #10372][ruby-core:65630]
-
-Mon Oct 13 17:53:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/xmlrpc/parser.rb: added new parser class using libxml-ruby gem.
- [Feature #9379][ruby-core:59633]
- * lib/xmlrpc/config.rb: ditto.
-
-Mon Oct 13 16:32:56 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/find.rb (Find.find): Call to_path for arguments to obtain
- strings.
- [ruby-core:63713] [Bug #10035] Reported by Herwin.
-
-Mon Oct 13 15:42:25 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * common.mk: use relative load path for bundled_gems directory.
- [Bug #10372][ruby-core:65630]
-
-Mon Oct 13 08:44:06 2014 Zachary Scott <e@zzak.io>
-
- * README.EXT: [DOC] fix example missing typedef with patch by
- @steveklabnik [Fixes GH-739] https://github.com/ruby/ruby/pull/739
-
- * README.EXT.ja: ditto.
-
-Mon Oct 13 06:52:09 2014 Eric Wong <e@80x24.org>
-
- * array.c (ary_recycle_hash): add RB_GC_GUARD
- (rb_ary_diff): remove volatile
- [Bug #10369]
-
-Mon Oct 13 03:20:23 2014 Zachary Scott <e@zzak.io>
-
- * ext/date/date_core.c: [DOC] Clean up whitespace, examples, and typos
- in date_core based on a patch by @vipulnsward [Fixes GH-724]
- https://github.com/ruby/ruby/pull/724
-
-Mon Oct 13 02:39:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (remove_duplicate_keys): should not simply eliminate all
- value nodes, which may have side effects.
- [ruby-core:65625] [Bug #10315]
-
-Sun Oct 12 10:39:16 2014 Zachary Scott <e@zzak.io>
-
- * vm.c: [DOC] fix typo by @yui-knk [Fixes GH-738]
- https://github.com/ruby/ruby/pull/738
-
-Sun Oct 12 09:24:15 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/test/unit.rb: Hide skips by default.
-
-Sun Oct 12 01:37:11 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * file.c: include sys/time.h only if HAVE_SYS_TIME_H
-
-Sat Oct 11 22:29:40 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * file.c (HAVE_UTIMENSAT): disabled for NativeClient.
- Fixes build error.
-
-Sat Oct 11 22:11:58 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * ext/extmk.rb: generates the rule for extinit.$(OBJEXT).
- extinit.$(OBJEXT) used to be generated by the builtin rule, thus
- didn't accept custom $(CC) and caused linkage error for cross
- compiling.
-
-Sat Oct 11 18:46:50 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * include/ruby/intern.h (rb_fd_select): declare struct timeval, or the
- struct gets local to the function in C99.
-
- * file.c (#include): add nacl/stat.h for PNaCl.
- (utimes): added a declaration for PNaCl.
- (stat_atimespec): stat::st_atimensec is long long but
- timespec::tv_nsec is long in PNaCl.
- (stat_mtimespec, stat_ctimespec): ditto.
- (rb_group_member): disable getgroups unless HAVE_GETGROUPS.
- (eaccess): unify the fallback to generic defined(USE_GETEUID).
-
- * io.c: include sys/time.h for struct timeval.
- (rb_close_before_exec): nothing we can do if F_GETFD is not
- available.
- (ioctl): pnacl newlib actually doesn't have ioctl.
-
- * process.c (maxgroups): it is used iff
- defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) but not
- defined(HAVE_GETGROUPS) || defined(HAVE_SETGROUPS).
- (obj2gid): fail unless the object is a Fixnum if getgrnam is not
- available.
- (disable_child_handler_fork_child): sigaction is not available in
- PNaCl newlib.
-
- * configure.in (warnflags, strict_warnflags): avoid -ansi for strlcpy.
- (rb_cv_gcc_atomic_builtins): also check
- __atomic_or_etch because it is used in ruby_atomic.h.
- (rb_cv_gcc_sync_builtins): ditto.
- (HAVE_GETGRNAM): added.
-
-Sat Oct 11 15:32:08 2014 Eric Wong <e@80x24.org>
-
- * compile.c (iseq_build_from_ary_exception): move RB_GC_GUARD
- (iseq_build_from_ary_body): use PRIsVALUE instead of RB_GC_GUARD
-
-Sat Oct 11 14:57:08 2014 Eric Wong <e@80x24.org>
-
- * string.c (rb_str_intern): remove unnecessary RB_GC_GUARD
-
-Sat Oct 11 13:47:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (remove_duplicate_keys): remove duplicate literal keys,
- i.e., symbols and strings. [ruby-core:65368] [Bug #10315]
-
- * vm.c (kwmerge_i): override existing keys by new keys.
- [ruby-core:65368] [Bug #10315]
-
- * parse.y (assocs): concatenate splatted literal hashes. the
- former key has precedence even if duplicated literal keys
- follow. [ruby-core:65368] [Bug #10315]
-
-Sat Oct 11 12:27:03 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * configure.in (RUBY_NACL): automatically locate pnacl-clang.
- (RUBY_PLATFORM): pnacl instead of le32-nacl.
-
-Sat Oct 11 11:27:14 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * io.c: fix issues in the last two commits. don't disable cloexec for
- platforms other than NativeClient.
-
- * ChangeLog: ditto. add entries for the last two commits.
-
-Sat Oct 11 11:12:00 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * signal.c (install_signalhandler, init_sigchld): allow failure because it
- always fails with ENOSYS on NaCl.
-
-Sat Oct 11 11:11:53 2014 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * configure.in (RUBY_NACL and others): merge patch from naclports. Supports PNaCl.
-
- * dln.c: ditto. replace the old hacky dynamic loading over HTTP with nacl_io.
-
- * file.c: ditto. tentatively use access(2) instead of eaccess.
- (rb_file_load_ok): weaken with attribute but not by postprocess.
-
- * io.c: ditto.
- (socket.h): now NaCl has socket.h
- (flock): disable here instead of nacl/ioctl.h
-
- * nacl/GNUmakefile.in: ditto.
- (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY):
- respect path to them if they are absolute.
- This helps naclports to build ruby in their source tree.
- (PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl.
- (ruby.o, file.o): move the hack to attributes in ruby.c and file.c
-
- * nacl/ioctl.h: ditto. removed. move the hack to io.c.
-
- * nacl/nacl-config.rb: ditto. support arm, pnacl and others.
-
- * nacl/pepper_main.c: ditto. support build in a naclports tree.
-
- * ruby.c (rb_load_file): ditto. weaken with attribute but not by postprocess.
-
-Sat Oct 11 09:32:00 2014 Zachary Scott <e@zzak.io>
-
- * ext/socket/unixsocket.c: [DOC] Fix example to render in HTML
- properly, with a patch by @eval [Fixes GH-733]
- https://github.com/ruby/ruby/pull/733
-
-Sat Oct 11 04:14:41 2014 Kir Shatrov <shatrov@me.com>
-
- * lib/open-uri.rb (OpenURI::Options): add :open_timeout default
- * (def OpenURI.open_http): check :open_timeout option
- * (module OpenURI): rdoc for :open_timeout
- * test/open-uri/test_open-uri.rb (test_open_timeout): new test
- [Feature #10361]
-
-Fri Oct 10 11:27:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/io.h (rb_io_mode_flags, rb_io_modenum_flags):
- deprecate old macros for compatibility for ruby 1.8 and older.
-
-Thu Oct 9 23:31:47 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * bignum.c (absint_numwords_generic): set an array element after
- definition of a variable to fix compile error with older version
- of fcc (Fujitsu C Compiler) 5.6 on Solaris 10 on Sparc.
- [Bug #10350] [ruby-dev:48608]
-
-Thu Oct 9 16:15:26 2014 Eric Wong <e@80x24.org>
-
- * ext/-test-/st/foreach/extconf.rb: new file
- * ext/-test-/st/foreach/foreach.c: ditto
- * test/-ext-/st/test_foreach.rb: ditto
- [Feature #10321]
-
-Thu Oct 9 12:40:28 2014 Eric Wong <e@80x24.org>
-
- * benchmark/bm_hash_aref_sym*.rb: force static symbols
-
-Thu Oct 9 12:38:28 2014 Eric Wong <e@80x24.org>
-
- * hash.c (rb_any_hash): remove unnecessary dsym check
-
-Thu Oct 9 07:20:30 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * missing/setproctitle.c: Avoid invalidating argv[1], argv[2],
- etc. until the first call to Process.setproctitle, because
- the ps command of AIX refers to the argv array.
- [Bug #10090]
-
-Thu Oct 9 00:53:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_s_aref): fix rdoc. `Dir.glob` allows an array but
- `Dir[]` not. the former accepts an optional parameter `flags`,
- while the latter accepts arbitrary number of arguments but no
- `flags`. [ruby-core:65265] [Bug #10294]
-
-Wed Oct 8 21:44:10 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_variable.c: use typed data.
-
-Wed Oct 8 16:36:47 2014 gogo tanaka <mail@tanakakazuki.com>
-
- * test/ruby/test_syntax.rb: added syntax tests of underscore
- arguments. [Feature #10340][ruby-core:65496]
-
-Wed Oct 8 07:42:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI#inspect): remove Object id.
- URI is considered that it doesn't require id.
-
-Wed Oct 8 05:22:42 2014 Eric Wong <e@80x24.org>
-
- * ext/etc/etc.c (etc_systmpdir): set default tmplen correctly
- Fixup r47826
-
-Wed Oct 8 05:16:32 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add @- and @+ for Matrix and Vector.
- patch by gogo tanaka [#10068] [#10069]
-
-Wed Oct 8 04:58:48 2014 John Bachir <j@jjb.cc>
-
- * bootstraptest/test_io.rb (assert_finish):
- normalize rescue for Timeout::Error
- * lib/net/ftp.rb (Net#read_timeout): ditto for doc
- * lib/resolv.rb (Resolv::ResolvTimeout): ditto for subclass
- * lib/webrick/httprequest.rb (_read_data): ditto for rescue
- * sample/timeout.rb (p timeout): ditto for call
- * test/drb/drbtest.rb (test_06_timeout): ditto
- * test/ruby/test_readpartial.rb (test_open_pipe): ditto
- * test/thread/test_queue.rb (test_queue_thread_raise): ditto
- * thread.c (rb_thread_s_handle_interrupt): ditto for doc
- [ruby-core:65481] [misc #10339]
-
-Wed Oct 8 04:38:29 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * test/ruby/test_process.rb (TestProcess#test_setsid): AIX
- does not allow Process::getsid(pid) when pid is in a
- different session.
-
-Wed Oct 8 04:33:04 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding):
- On AIX, locale_charmap is ISO-8859-1 with LANG=C. This means
- the source encoding of stdin is ISO-8859-1, so "invalid
- multibyte char" error does not occur.
-
-Wed Oct 8 04:30:29 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Matrix#laplace_expansion.
- patch by gogo tanaka [#10073]
-
-Wed Oct 8 04:29:21 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Vector.basis.
- Based on patch by gogo tanaka [#10072]
-
-Tue Oct 7 23:40:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (rb_f_kill): get rid of deadlock as unhandled and
- discarded signals do not make interrupt_cond signaled.
- based on the patch by Kazuki Tsujimoto at [ruby-dev:48606].
- [Bug #9820]
-
-Tue Oct 7 22:43:44 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_method.c: use typed data.
-
-Tue Oct 7 21:47:05 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_param.c: refactoring.
-
-Tue Oct 7 21:40:17 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_method.c: refactoring. add
- olemethod_data_get_struct to wrap Data_Get_Struct.
- * ext/win32ole/win32ole_method.h: ditto.
-
- * ext/win32ole/win32ole_param.c (oleparam_ole_param):
- call olemethod_data_get_struct instead of Data_Get_Struct.
-
-Tue Oct 7 11:17:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (etc_systmpdir): try user temporary directory by
- confstr() on Mac OS X.
- c.f. http://www.opensource.apple.com/source/ruby/ruby-104/patches/ext_etc_etc.c.diff
-
-Tue Oct 7 10:48:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (struct stat.st_size): prefer off_t over int, long,
- and so on. inspired by
- http://www.opensource.apple.com/source/ruby/ruby-104/patches/config.h.ed
-
-Tue Oct 7 10:37:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_UNIVERSAL_ARCH): fix missing quoting
- brackets. incorporated from
- http://www.opensource.apple.com/source/ruby/ruby-104/patches/configure.diff
-
-Mon Oct 6 23:34:42 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_param.c: use typed data.
-
-Mon Oct 6 22:37:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * symbol.h (struct RSymbol): move from internal.h.
-
-Mon Oct 6 21:43:03 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * error.c: update exception tree. [DOC]
- reported by @hemge via twitter.
-
-Mon Oct 6 18:43:03 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * configure.in: Fix typo. [Bug #9914]
-
-Mon Oct 6 16:23:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (rb_f_kill): should not ignore signal unless the
- default handler is registered. [ruby-dev:48592] [Bug #9820]
-
-Mon Oct 6 16:07:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_string.rb (test_LSHIFT_neary_long_max): enable
- only on platforms where string size range is smaller than memory
- space. this test does not make sense but just wastes memory and
- time on other platforms, as it is hardly possible that a string
- size becomes neary LONG_MAX if long size equals pointer size.
- [ruby-core:65410] [Bug #10325]
-
-Mon Oct 6 11:21:21 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/unicode_norm_gen.rb: Adding/tweaking comments.
-
-Mon Oct 6 10:57:57 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/unicode_norm_gen.rb: Adjusted directory paths.
-
-Mon Oct 6 10:27:27 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/unicode_norm_gen.rb: Data generation script imported from
- https://github.com/duerst/eprun/blob/master/lib/generate.rb
-
-Mon Oct 6 10:15:15 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: Adjust example in documentation for
- Downloader.download.
-
-Mon Oct 6 10:07:07 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * lib/unicode_normalize: New folder for Unicode normalization
- functionality
-
-Sun Oct 5 11:04:13 2014 Luiz Angelo Daros de Luca <luizluca@gmail.com>
-
- * ext/digest/{md5,rmd160,sha1,sha2}/extconf.rb: configure OpenSSL
- only if bundled libraries is not used, so that OpenSSL is not
- linked unnecessarily. [ruby-core:65404] [Bug #10324]
-
-Sun Oct 5 10:39:11 2014 Luiz Angelo Daros de Luca <luizluca@gmail.com>
-
- * ext/digest/rmd160/extconf.rb: fix transform function name to
- check. [ruby-core:65091] [Bug #10252]
-
-Sun Oct 5 05:46:00 2014 Eric Wong <e@80x24.org>
-
- * ext/zlib/zlib.c (zstream_mark, zstream_free): update signature
- (gzfile_mark, gzfile_free): ditto
- (zstream_memsize): new function for rb_data_type->dsize
- (gzfile_memsize): ditto
- (zstream_data_type, gzfile_data_type): new data types
- (zstream_new): Data_Make_Struct => TypedData_Make_Struct
- (gzfile_new): ditto
- (get_zstream, get_gzfile): Data_Get_Struct => TypedData_Get_Struct
- (rb_zstream_flush_next_in): ditto
- (rb_zstream_flush_next_out): ditto
- (rb_zstream_avail_out): ditto
- (rb_zstream_avail_in): ditto
- (rb_zstream_closed_p): ditto
- (rb_deflate_initialize): ditto
- (rb_deflate_init_copy): ditto
- (rb_inflate_initialize): ditto
- (gzfile_ensure_close): ditto
- (rb_gzfile_closed_p): ditto
- (rb_gzfile_path): ditto
- (rb_gzwriter_initialize): ditto
- (rb_gzreader_initialize): ditto
- (rb_gzreader_unused): ditto
- [ruby-core:65377] [Feature #10319]
-
-Sat Oct 4 16:24:41 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * test/test_syslog.rb (TestSyslog#test_log): In AIX, each output
- line of LOG_PERROR to stderr has an additional empty line appended,
- so skip that line.
-
-Sat Oct 4 16:05:49 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * test/socket/test_unix.rb (TestSocket_UNIXSocket#test_too_long_path):
- sockaddr_un.sun_path in AIX is defined as char[1024],
- so "a" * 300 is not too long. "a" * 3000 would be enough.
-
-Sat Oct 4 09:12:03 2014 Zachary Scott <e@zzak.io>
-
- * ext/win32ole/sample/example*.rb: Add wait input to quit for examples
- with patch provided by @windwiny [Fixes GH-705]
- https://github.com/ruby/ruby/pull/705
-
-Sat Oct 4 09:08:18 2014 Zachary Scott <e@zzak.io>
-
- * ext/win32ole/win32ole.c: [DOC] Fix typo in :nodoc: reported by
- @windwiny to [Fix GH-705] https://github.com/ruby/ruby/pull/705
-
- * ext/pty/pty.c: ditto
-
-Sat Oct 4 08:59:45 2014 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_rand.c: [DOC] Add call signature for pseudo_bytes
- and random_bytes, wrap lines at 80 chars, and remove useless
- comments.
-
-Sat Oct 4 08:49:34 2014 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_rand.c: [DOC] Add rdoc for method descriptions
- By @vipulnsward [Fixes GH-657] https://github.com/ruby/ruby/pull/657
-
-Sat Oct 4 08:23:48 2014 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_rand.c: Use rb_define_module_function instead of
- macro. [Fixes GH-686] https://github.com/ruby/ruby/pull/686
-
-Sat Oct 4 06:04:56 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_method.c(olemethod_set_member): remove
- redundant NULL check.
- * ext/win32ole/win32ole_type.c(oletype_set_member): ditto.
-
-Sat Oct 4 00:25:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: removed needless preparation for gcc.
-
-Fri Oct 3 23:41:20 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: enabled gcc build with osx on travis.
-
-Fri Oct 3 23:22:23 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * template/fake.rb.in: fix make install failure due to MSYS path
- with mingw on MSYS environment.
- [ruby-core:64965] [Bug #10230]
-
-Fri Oct 3 21:02:32 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_io.rb (TestIO#test_advise): avoid to infinite loop.
-
-Fri Oct 3 19:26:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: enabled test results of linux.
-
-Fri Oct 3 18:52:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_io.rb (TestIO#test_advise): added workaround of fadvise(2)
- with tmpfs and old linux kernel. [ruby-core:65355][Bug #10313]
-
-Fri Oct 3 18:22:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: Disabled to generate document on travis.
- Reduce test running time.
-
-Fri Oct 3 12:42:15 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add hstack & vstack methods.
- Based on a patch by creasywuqiong. [Fix GH-344]
-
-Fri Oct 3 12:37:48 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Fix Matrix.rows copy bug.
- Patch by Arron Mabrey. [Fix GH-707]
-
-Fri Oct 3 06:06:28 2014 Eric Wong <e@80x24.org>
-
- * st.c (next_pow2): new function (from old bignum.c)
- (new_size): use next_pow2 function
-
-Fri Oct 3 05:58:58 2014 Eric Wong <e@80x24.org>
-
- * vm_trace.c (rb_tp_t): pack 56 => 48 bytes on 64-bit
-
-Thu Oct 2 18:41:45 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/etc/etc.c (etc_nprocessors): Windows support.
- see [Feature #10267]
-
-Thu Oct 2 12:21:52 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/etc/etc.c (etc_nprocessors): New method.
- Accepted by matz at RubyKaigi 2014.
- [ruby-core:65142] [Feature #10267]
-
-Thu Oct 2 07:56:49 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (rb_iseq_line_trace_each): explicit cast
- Fix https://travis-ci.org/ruby/ruby/jobs/36814282
-
-Thu Oct 2 05:40:05 2014 Eric Wong <e@80x24.org>
-
- * ruby.h: set rb_event_flag_t to uint32_t
- [ruby-core:65315] [misc #10249]
-
-Thu Oct 2 05:32:17 2014 Eric Wong <e@80x24.org>
-
- * io.c (fptr_finalize): free memory before GC sweep
- [ruby-core:65269] [Feature #10295]
-
-Thu Oct 2 05:27:24 2014 Eric Wong <e@80x24.org>
-
- * marshal.c (w_class): check dump_arg->compat_tbl before lookup
- (w_object): lazy init ->compat_tbl before insert
- (obj_alloc_by_class): ditto
- (clear_dump_arg): free only non-NULL ->compat_tbl
- (clear_load_arg): ditto for ->compat_tbl
- (marshal_dump): ->compat_tbl defaults to zero
- (marshal_load): ditto for ->compat_tbl
- (r_entry0): check l->compat_tbl before lookup
- (r_fixup_compat): ditto
- [ruby-core:65305] [Feature #10302]
-
-Wed Oct 1 21:14:34 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_type.c: use typed data.
-
-Wed Oct 1 18:15:42 2014 Nolan Evans <nolane@gmail.com>
-
- * compile.c: remove commented out code.
-
-Wed Oct 1 17:38:53 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * test/fileutils/test_fileutils.rb: AIX does not allow
- a sticky bit on a regular file.
-
-Wed Oct 1 17:31:41 2014 Eric Hodel <drbrain@segment7.net>
-
- * NEWS: Add RubyGems update.
-
-Wed Oct 1 17:28:58 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.4.2.
- * test/rubygems: ditto.
-
-Tue Sep 30 22:25:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_data_type): separate ripper data type for from
- parser.
-
-Tue Sep 30 18:46:31 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_typelib.c: use typed data.
-
-Tue Sep 30 09:51:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * common.mk: fixed broken reference of update-config_files task
-
-Mon Sep 29 22:54:51 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/file.c (append_wstr): set expanded length, not length of
- appended string. fix "probable buffer overflow" bug.
- [ruby-core:65317] [Bug #10304]
-
- * string.c (str_make_independent_expand): drop NOFREE flag after
- reallocation, static buffer is not pointed anymore.
- [ruby-core:65317] [Bug #10304]
-
-Sun Sep 28 23:59:17 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * gc.c (rb_gcdebug_print_obj_condition): use RVALUE_REMEMBERED
- because GET_HEAP_REMEMBERSET_BITS is obsoleted.
-
-Sun Sep 28 11:14:14 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * common.mk: Created new target update-unicode to download
- some Unicode data files.
-
-Fri Sep 26 15:03:19 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/uri/rfc3986_parser.rb: raise URI::InvalidURIError when
- uri doesn't respond to #to_str. [ruby-core:64453] [Bug #10150]
-
- * test/uri/test_parser.rb: test for above.
-
-Sat Sep 27 10:31:48 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * gems/bundled_gems: upgraded to power_assert 0.1.4.
-
-Fri Sep 26 12:52:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_write): ASCII-8BIT StringIO
- should be writable any encoding strings, without conversion.
- [ruby-core:65240] [Bug #10285]
-
-Fri Sep 26 05:21:01 2014 Eric Wong <e@80x24.org>
-
- * object.c (rb_class_real): do not dereference 0 VALUE
-
- * test/ruby/test_module.rb (test_inspect_segfault):
- Test case and bug report by Thomas Stratmann.
- [ruby-core:65214] [Bug #10282]
-
-Fri Sep 26 05:12:10 2014 Eric Wong <e@80x24.org>
-
- * man/ruby.1: document stack size env variables
- [Feature #10197]
-
-Thu Sep 25 19:37:34 2014 Eric Wong <e@80x24.org>
-
- * io.c (free_io_buffer): new function for a common pattern
- (clear_readconv): use free_io_buffer
- (rb_io_fptr_finalize): ditto
-
-Thu Sep 25 07:51:07 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/matrix.rb: Fix docs. Patched by Ben Woodall. [GH-726]
-
-Wed Sep 24 19:04:04 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * enc/unicode/data: New directory for downloaded Unicode
- data files.
-
-Wed Sep 24 18:59:59 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: Adjusting example for
- Downloader.download to implementation changes in r47693.
-
-Wed Sep 24 18:06:06 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: Removing unused method
- Downloader.download_if_modified_since.
- (if ever used, just replace with Downloader.download)
-
-Wed Sep 24 17:59:59 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: Fixing raise after return.
-
-Wed Sep 24 17:55:55 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: Made Unicode data file location available
- via :unicode Symbol.
-
-Wed Sep 24 10:45:45 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: Small fix to documentation comment.
-
-Tue Sep 23 22:00:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parse_ident): just after a label, new expression should
- start, cannot be a modifier. [ruby-core:65211] [Bug #10279]
-
-Tue Sep 23 16:07:07 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * tool/downloader.rb: added Downloader.download_if_modified_since
- to reduce downloads of large files that change only rarely.
- [ruby-core:65164] [CommonRuby - Feature #10084]
-
-Tue Sep 23 11:55:09 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: added rubyspec into travis tasks and eliminate to stdout.
-
-Mon Sep 22 20:00:29 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_variant.rb
- (test_conversion_time2date_with_msec): test by using only
- assert_in_delta to avoid to fail when converting Time object with
- 999999999 nanoseconds into VT_DATE Variant.
-
-Mon Sep 22 19:49:12 2014 Zachary Scott <e@zzak.io>
-
- * doc/syntax/methods.rdoc: [DOC] [] and []= methods by @process
- [Fixes GH-662] https://github.com/ruby/ruby/pull/662
-
-Mon Sep 22 18:21:35 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: Only osx build is enabled. linux builds is random failure
- and test results of major linux is covered by rubyci.
-
-Mon Sep 22 12:10:29 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_time_tz.rb: Fix test error with tzdata-2014g.
- [ruby-core:65058] [Bug #10245] Reported by Vit Ondruch.
-
-Mon Sep 22 09:28:43 2014 Eric Wong <e@80x24.org>
-
- * ext/socket/ancdata.c ({send,recv}msg_args_struct): 24 => 16 bytes
- * ext/socket/init.c (connect_arg): ditto
- * ext/socket/raddrinfo.c (getnameinfo_arg): 56 => 48 bytes
- (reductions only for 64-bit systems)
-
-Mon Sep 22 02:04:25 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/drb/drb.rb: Support graceful shutdown.
- (DRbTCPSocket#initialize): Create a pipe for shutdown notification.
- (DRbTCPSocket#close): Invoke close_shutdown_pipe.
- (DRbTCPSocket#close_shutdown_pipe): New private method.
- (DRbTCPSocket#accept): Use accept_or_shutdown.
- (DRbTCPSocket#accept_or_shutdown): New private method which returns
- nil on shutdown.
- (DRbServer#stop_service): Use shutdown instead of Thread#kill.
- (DRbServer#run): Break infinite loop when main_loop returns nil.
- (DRbServer#main_loop): @protocol.accept may return nil.
-
- * lib/drb/ssl.rb: Follow above change.
-
- * lib/drb/unix.rb: Ditto.
-
-Sun Sep 21 13:54:36 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * time.c: raise exception when minutes of utc_offset is out of 00-59.
- patch is from Kenichi Kamiya.
- [ruby-dev:47539] [Bug #8679]
-
- * test/ruby/test_time.rb: test for above.
- patch is from Kenichi Kamiya.
-
-Sun Sep 21 19:04:08 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * st.c (do_hash_bin): unused macro.
-
-Sun Sep 21 18:45:01 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * parse.y (parser_class_nest): unused variable after YARV
- merged (r11439).
-
-Sun Sep 21 18:14:03 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * st.c (numberof): unused. internal.h has same macro.
-
- * node.c (F_CUSTOM2): unused.
-
-Sun Sep 21 14:11:23 2014 Tanaka Akira <akr@fsij.org>
-
- * thread_pthread.c (native_set_thread_name): New function to
- set thread name visible with ps command on GNU/Linux.
- Ex. ps -o %c -L
-
- * thread.c (thread_start_func_2): Call native_set_thread_name at
- beginning.
- (rb_thread_inspect_msg): Extract from rb_thread_inspect.
-
-Sun Sep 21 12:49:11 2014 Eric Wong <e@80x24.org>
-
- * iseq.c (rb_iseq_defined_string): trim redundant semi-colon
-
-Sun Sep 21 12:19:29 2014 Eric Wong <e@80x24.org>
-
- * file.c (rb_find_file_ext_safe): clear tmp buffer on failure
- (rb_find_file_safe): ditto
-
-Sat Sep 20 04:42:18 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/csv.rb: avoid unnecessary object allocations.
- patch is from Andrew Vit. [ruby-core:63215] [Feature #9952]
-
-Sun Sep 21 12:10:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rexml/**/*.rb: removed commented-out code.
-
-Sat Sep 20 03:46:58 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c: use rb_equal_opt() for performance improvement.
- [ruby-core:64954] [Feature #10227]
-
-Sun Sep 21 11:16:56 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (rbtime2vtdate, vtdate2rbtime): fix
- the bug in conversion of milliseconds. [Bug #10258]
-
- * test/win32ole/test_win32ole_variant.rb
- (test_conversion_dbl2date_with_msec,
- test_conversion_time2date_with_msec): use assert_in_delta instead
- of assert_equal to treat an acceptable error range.
-
-Sun Sep 21 11:03:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (ruby_signal): although "EINVAL from sigaction(2) is
- not a bug", but even it is a failure. pointed at toRuby/guRuby
- in RubyHiroba.
-
-Sat Sep 20 03:00:26 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/tempfile.rb: define parameters appropriately and some
- refactoring.
-
- * lib/tmpdir.rb: ditto.
-
-Sat Sep 20 23:58:21 2014 Tanaka Akira <akr@fsij.org>
-
- * enum.c (enum_chunk): Deprecate the state management.
- (enum_slice_before): Ditto.
-
-Sat Sep 20 15:39:11 2014 Tanaka Akira <akr@fsij.org>
-
- * enum.c (enum_slice_when): New method: Enumerable#slice_when.
- (slicewhen_i): New function.
- (slicewhen_ii): New function.
-
- * enumerator.c (InitVM_Enumerator): New method:
- Enumerator::Lazy#slice_when.
-
- [ruby-core:62499] [Feature #9826]
-
-Sat Sep 20 11:55:19 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .travis.yml: added new configurations for osx on travis ci.
- [fix GH-723]
- * test/ruby/test_object.rb: tweaked to memory leak limit for osx build.
-
-Sat Sep 20 10:48:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (assoc): allow quoted ID as a key of a hash literal.
- [ruby-core:34453] [Feature #4276]
-
-Sat Sep 20 10:23:00 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_set_arguments): store local variable IDs in
- temporary list as Symbols. previously these are stored as
- Fixnums to prevent from GC, but IDs of dynamic symbols can
- exceed Fixnum range and cause RangeError at inverting from
- Fixnum. [ruby-dev:48564] [Bug #10266]
-
-Sat Sep 20 10:02:51 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/openssl/lib/openssl/x509.rb (OpenSSL::X509::Name#pretty_print):
- New method.
- (OpenSSL::X509::Certificate#pretty_print): Ditto.
-
- * ext/openssl/lib/openssl/bn.rb (OpenSSL::BN#pretty_print): Ditto.
-
-Sat Sep 20 07:55:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (eval_string_with_cref): fix super from eval with
- scope. set klass in the current control frame to the class of
- the receiver in the context to be evaluated, this class/module
- must match the actual receiver to call super.
- [ruby-core:65122] [Bug #10263]
-
-Fri Sep 19 20:06:00 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * symbol.c (rb_str_dynamic_intern): check if the stem ID of
- attrset ID is already registered as a static ID.
- [ruby-dev:48559] [Bug #10259]
-
-Fri Sep 19 15:48:09 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (VCSUP): nothing to do if this worktree is not
- under any VCS (it means that the worktree may be from the release
- package).
-
-Fri Sep 19 10:47:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_math.rb (TestMath#assert_infinity): Float#finite?
- returns true also for NaN, so use Float#infinite? instead.
- [ruby-core:65117] [Feature #10261]
-
-Fri Sep 19 05:36:16 2014 Eric Wong <e@80x24.org>
-
- * NEWS: note --with-jemalloc option [ci skip]
-
-Thu Sep 18 16:26:27 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rubygems/test_gem_commands_setup_command.rb: @ui uses StringIO
- as its streams, and Encoding.default_external does not effect to
- StringIOs already exist. so, we need to set external_encoding of
- @ui.outs directly. this problem (test failure) does not appear in
- the environments default_external is us-ascii or utf-8.
-
-Thu Sep 18 15:02:15 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rubygems/test_gem_specification.rb: '/' is not always the root.
-
-Thu Sep 18 09:36:37 2014 Scott Francis <scott.francis@shopify.com>
-
- * vm_method.c (Init_Method): make global method cache size
- configurable by environment variable
- "RUBY_GLOBAL_METHOD_CACHE_SIZE" [Fix GH-719]
-
-Thu Sep 18 07:03:36 2014 Eric Wong <e@80x24.org>
-
- * test/-ext-/string/test_modify_expand.rb: increase limit
- for {je,tc}malloc [Bug #10236]
-
-Thu Sep 18 06:41:18 2014 Eric Wong <e@80x24.org>
-
- * ext/zlib/zlib.c (struct gzfile): pack (288 => 272 bytes) on 64-bit
-
-Thu Sep 18 05:44:05 2014 Eric Wong <e@80x24.org>
-
- * ext/socket/init.c (rsock_connect): refactor for blocking
- (wait_connectable): clear error before wait
- [Bug #9356]
-
-Wed Sep 17 23:12:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/rfc3986_parser.rb: specify a regexp for :OPAQUE; generic.rb
- assumes it is present, and will refuse all values otherwise.
- by Matthew Draper <matthew@trebex.net>
- https://github.com/ruby/ruby/pull/718 fix GH-718
-
-Wed Sep 17 16:22:58 2014 Eric Wong <e@80x24.org>
-
- * ext/zlib/zlib.c (zlib_mem_alloc): check overflow
-
-Wed Sep 17 11:33:35 2014 Laurent Arnoud <laurent@spkdev.net>
-
- * test/fiddle/test_import.rb (Fiddle::TestImport#test_sizeof):
- added test for long long [fix GH-716]
-
-Wed Sep 17 11:09:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/rbinstall.rb: fixed invalid options with latest rubygems.
- https://github.com/rubygems/rubygems/issues/1013
-
-Tue Sep 16 19:19:00 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * benchmark/bm_app_aobench.rb: update outdated links to the
- original program. [ruby-dev:48550] [Feature #10247]
-
-Tue Sep 16 01:06:40 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * reg*.c: Merge Onigmo 5.15.0 38a870960aa7370051a3544
-
-Mon Sep 15 16:21:10 2014 Eric Wong <e@80x24.org>
-
- * io.c (struct io_advise_struct): 32 => 24 bytes on 64-bit
- * io.c (struct io_internal_writev_struct): 24 => 16 bytes on 64-bit
- * process.c (struct waitpid_arg): ditto
-
-Mon Sep 15 10:29:25 2014 Natalie Weizenbaum <nweiz@google.com>
-
- * ext/pathname/lib/pathname.rb (SAME_PATHS):
- Pathname#relative_path_from uses String#casecmp to compare strings
- on case-insensitive filesystem platforms (e.g., Windows). This can
- return nil for strings with different encodings, and the code
- previously assumed that it always returned a Fixnum. [Fix GH-713]
-
-Mon Sep 15 09:43:18 2014 Sho Hashimoto <sho.hsmt@gmail.com>
-
- * ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
- SIZEOF_LONG_LON. [Fix GH-714]
-
-Mon Sep 15 08:13:40 2014 Matthew Draper <matthew@trebex.net>
-
- * sprintf.c (rb_str_format): rational 'f' format works for more
- values. [fix GH-717]
-
-Sun Sep 14 16:57:27 2014 Eric Wong <e@80x24.org>
-
- * template/vm.inc.tmpl: "insns.c" => "insns.def"
- * tool/instruction.rb: typo fix
-
-Sun Sep 14 12:29:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_tracer.rb: fixed testcase for rubygems update.
-
-Sun Sep 14 12:29:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
- Complete history at:
- https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216
-
- * test/rubygems: ditto.
-
-Sun Sep 14 11:03:24 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: update version
- * ext/psych/psych.gemspec: ditto
-
-Sun Sep 14 08:43:37 2014 Eric Wong <e@80x24.org>
-
- * ccan/container_of/container_of.h (container_of_or_null): added
- [ccan 7ec5b8e06b2fd5fa98b1fcde1158c286d2d429d8] (David Gibson)
-
-Sun Sep 14 08:41:44 2014 Eric Wong <e@80x24.org>
-
- * ccan/list/list.h (list_del_init, list_node_init): new functions
- for multiple list_del() calls
- [ccan ec8654d94d3c5c47aa5f82698f7e8048c79765b1] (Rusty Russell)
-
-Sat Sep 13 22:19:26 2014 Bernard Potocki <bernard.potocki@imanel.org>
-
- * hash.c (rb_hash_aset): fix misleading example which may suggest
- that Hash.store will return self instead of value - Hash#store
- is returning value and update itself, as well as Hash#[]=.
- [Fix GH-715]
-
-Sat Sep 13 15:16:31 2014 Eric Wong <e@80x24.org>
-
- * class.c: use ALLOC(rb_subclass_entry_t)
-
-Sat Sep 13 14:14:00 2014 Eric Wong <e@80x24.org>
-
- * process.c (free_exec_arg): remove
- (memsize_exec_arg): ptr is never NULL
- (exec_arg_data_type): use RUBY_TYPED_DEFAULT_FREE
-
- * variable.c (autoload_i_free): remove
- (autoload_data_i_type): use RUBY_TYPED_DEFAULT_FREE
- (autoload_memsize): ptr is never NULL
-
- * vm_backtrace.c (location_free): remove
- (location_mark): ptr is never NULL
- (location_data_type): use RUBY_TYPED_DEFAULT_FREE
- (backtrace_mark): ditto
- (backtrace_free): ditto
-
-Sat Sep 13 13:43:07 2014 Eric Wong <e@80x24.org>
-
- * doc/NEWS-2.0.0: fix typo for default RUBY_FIBER_MACHINE_STACK_SIZE
- [ci skip]
-
-Sat Sep 13 11:16:58 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_event.c(ev_advise, ole_event_free,
- fev_s_allocate, fev_unadvise): avoid segmentation fault when COM
- server freed before calling Unadvise from WIN32OLE_EVENT object.
- * ext/win32ole/win32ole.c: ditto.
-
-Sat Sep 13 09:47:44 2014 Eric Wong <e@80x24.org>
-
- * man/ruby.1: use https for *.ruby-lang.org links
-
-Sat Sep 13 06:31:23 2014 Eric Wong <e@80x24.org>
-
- * vm.c (thread_alloc): remove needless volatile
-
-Sat Sep 13 06:13:55 2014 Eric Wong <e@80x24.org>
-
- * proc.c (proc_free): remove, use RUBY_TYPED_DEFAULT_FREE
- (proc_mark, proc_memsize): remove needless branching
-
- * vm.c (env_free): remove, use RUBY_TYPED_DEFAULT_FREE
- (env_mark, env_memsize): remove needless branching
-
-Sat Sep 13 05:52:15 2014 Eric Wong <e@80x24.org>
-
- * proc.c (rb_proc_alloc): inline and move to vm.c
- (rb_proc_wrap): new wrapper function used by rb_proc_alloc
- (proc_dup): simplify alloc + copy + wrap operation
- [ruby-core:64994]
-
- * vm.c (rb_proc_alloc): new inline function
- (rb_vm_make_proc): call rb_proc_alloc
-
- * vm_core.h: remove rb_proc_alloc, add rb_proc_wrap
-
- * benchmark/bm_vm2_newlambda.rb: short test to show difference
-
-Sat Sep 13 04:40:04 2014 Eric Wong <e@80x24.org>
-
- * process.c (Init_process): subclass Thread as Process::Waiter
- (rb_detach_process): use Process::Waiter instead of singleton class
- Thanks to headius and nobu. [Bug #10231]
-
- * test/ruby/test_process.rb (test_process_detach): new test
-
- * inits.c (rb_call_inits): call Init_Thread before Init_process to
- ensure Process::Waiter may be a subclass of Thread
-
-Fri Sep 12 18:14:28 2014 Eric Wong <e@80x24.org>
-
- * vm.c (env_alloc): inline to avoid extra zeroing
- tiny speedup [ruby-core:64980]
-
-Fri Sep 12 17:13:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_method_entry_make, remove_method): ditto.
-
-Fri Sep 12 14:39:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gems/bundled_gems: Upgraded to test-unit-3.0.1 and minitest-5.4.1
-
-Fri Sep 12 06:55:40 2014 Eric Wong <e@80x24.org>
-
- * string.c (Init_frozen_strings): use st_init_table_with_size
-
-Fri Sep 12 06:15:37 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (sym_find): remove Symbol.find because we have Symbol GC now.
- https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20140904Japan
- If you still want this, request again on Redmine. [Feature #7854]
- https://bugs.ruby-lang.org/issues/7854
-
- * ext/-test-/symbol/init.c (sym_find): moved from string.c for tests.
-
-Fri Sep 12 04:24:03 2014 Eric Wong <e@80x24.org>
-
- * insns.def (once): define and use fake RUNNING_THREAD_ONCE_DONE
- pointer to indicate is->once.running_thread is done.
-
- * vm_core.h (iseq_inline_storage_entry): remove done field,
- allowing the union to be reduced from 24=>16 bytes on 64-bit
- [Feature #10187]
-
-Thu Sep 11 20:10:00 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_thread_mark): use rb_gc_mark_values() to mark VM stack.
-
-Thu Sep 11 19:50:57 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_vm_register_special_exception): make new function to
- make and register special exceptions.
-
- * vm.c (rb_vm_mark): do not need to mark special exceptions
- because they are registered by rb_gc_register_mark_object().
-
- * eval.c (Init_eval): use rb_vm_register_special_exception().
-
- * gc.c (Init_GC): ditto.
-
- * proc.c (Init_Proc): ditto.
-
- * thread.c (Init_Thread): ditto.
-
-Thu Sep 11 19:32:30 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_mark_values): added.
- This function is similar to rb_gc_mark_locations(), but not
- conservative.
-
- * internal.h: ditto.
-
- * vm.c (env_mark): use rb_gc_mark_values() because env values should
- be Ruby VALUEs.
-
-Thu Sep 11 19:16:39 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_ptr): rename to gc_mark_set.
-
- * gc.c (gc_mark): add gc_mark_ptr() to skip is_markable_object()
- check. gc_mark_maybe() can use gc_mark_ptr() directly because
- passed pointer is checked by is_pointer_to_heap().
-
-Thu Sep 11 18:40:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .gitignore: ignored temporary files and coverage results.
-
-Thu Sep 11 18:15:30 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .gitignore: ignored only simplecov.
- * coverage/README: Added coverage docs.
-
-Thu Sep 11 17:25:31 2014 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h, gc.c: add new internal events
- RUBY_INTERNAL_EVENT_GC_ENTER and
- RUBY_INTERNAL_EVENT_GC_EXIT.
-
- When invoking GC process, GC_ENTER event is called.
- When exiting from GC process, GC_EXIT event is called.
-
- Incremental GC (incremental marking and lazy sweep) can call
- these events many times.
-
- For example (minor marking):
- (1) GC_ENTER
- - (2) GC_START (minor GC)
- (minor marking)
- - (3) GC_END_MARK
- (start lazy sweep)
- (4) GC_EXIT
- (ruby process)
- (5) GC_ENTER
- (lazy sweep)
- (6) GC_EXIT
- (ruby process)
- (... repeat (5), (6))
- (7) GC_ENTER
- (finish lazy sweep)
- - (8) GC_END_SWEEP
- (9) GC_EXIT
-
- 2nd example (incremental major marking):
- (1) GC_ENTER
- - (2) GC_START (minor GC)
- (start incremental marking)
- (3) GC_EXIT
- (ruby process)
- (4) GC_ENTER
- (incremental marking)
- (5) GC_EXIT
- (ruby process)
- (... repeat (4), (5))
- (6) GC_ENTER
- (finish incremental marking)
- - (7) GC_END_MARK
- (start lazy sweep)
- (8) GC_EXIT
- (ruby process)
- (9) GC_ENTER
- (lazy sweep)
- (10) GC_EXIT
- (ruby process)
- (... repeat (9), (10))
- (11) GC_ENTER
- (finish lazy marking)
- - (12) GC_STOP_SWEEP
- (13) GC_EXIT
-
- These internal events enable to measure GC pause time completely.
-
-Thu Sep 11 17:04:54 2014 Eric Wong <e@80x24.org>
-
- * lib/benchmark.rb: remove CLOCK_MONOTONIC_RAW support
- Thanks to Vit Ondruch for reporting the issue on ARM.
- [Bug #10202]
-
-Thu Sep 11 14:31:57 2014 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: freeze nil/true/false.
- [Feature #8923]
-
- * gc.c (should_be_finalizable): check frozen after checkin FL_ABLE.
-
- * object.c (rb_obj_taint): check
- OBJ_TAINTABLE(obj).
-
- * object.c (rb_obj_freeze): remove immediate_frozen_tbl
- because all of immediate values are frozen. YAY!
-
- * object.c (rb_obj_frozen_p): ditto.
-
- * test/ruby/test_eval.rb: skip instance_variable_set for
- frozen objects.
-
- * test/ruby/test_weakmap.rb: check ArgumentError instead of
- RuntimeError.
-
-Thu Sep 11 10:03:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(21b241a)
-
-Wed Sep 10 17:52:25 2014 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (rb_vm_addr2insn): rename to rb_vm_insn_addr2insn
- to clear what address.
-
-Wed Sep 10 16:22:26 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb: fix condition.
-
-Wed Sep 10 15:29:46 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (rb_call_info_t): ci->flag becomes 32-bit unsigned int
- ci->index becomes a 32-bit signed int (from signed long).
- Reorder for better packing on 64-bit, giving an 8 byte reduction
- from 104 to 96 bytes for each ci.
- [Feature #10187]
-
- * compile.c (new_callinfo, setup_args, iseq_compile_each,
- iseq_build_from_ary_body): adjust for type changes
-
- * vm_insnhelper.c (vm_getivar): ditto
-
-Wed Sep 10 15:07:35 2014 Eric Wong <e@80x24.org>
-
- * compile.c (rb_iseq_translate_threaded_code):
- modify in-place w/o copy
- (rb_vm_addr2insn): new function for debug
- (rb_iseq_original_iseq): ditto
- (iseq_set_sequence): assign iseq_encoded directly
- [Feature #10185]
-
- * vm_core (rb_iseq_t): move original ->iseq to bottom
-
- * iseq.c (iseq_free, iseq_free): adjust for new layout
- (rb_iseq_disasm): use original iseq for dump
- (iseq_data_to_ary): ditto
- (rb_iseq_line_trace_each): ditto
- (rb_iseq_build_for_ruby2cext): use iseq_encoded directly
-
- * vm_dump.c (rb_vmdebug_debug_print_pre): use original iseq
-
-Wed Sep 10 15:00:11 2014 Eric Wong <e@80x24.org>
-
- * time.c (time_mark): remove NULL check
- (time_memsize): ditto
- (time_free): remove, use RUBY_TYPED_DEFAULT_FREE instead
- [Feature #10219]
-
-Wed Sep 10 14:14:57 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * common.mk (encs enc trans libencs libenc libtrans): force to run
- enk.mk because common.mk does not know the dependency, but enk.mk
- knows. [ruby-dev:48530] [Bug #10220]
-
-Wed Sep 10 11:59:10 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): update rdoc.
-
-Wed Sep 10 11:52:08 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): rename:
- * malloc_increase -> malloc_increase_bytes
- * malloc_limit -> malloc_increase_bytes_limit
- * oldmalloc_increase -> oldmalloc_increase_bytes
- * oldmalloc_limit -> oldmalloc_increase_bytes_limit
- ref: [Feature #9924]
-
-Wed Sep 10 11:45:40 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): rename `heap_used' to `heap_allocated_pages'.
- ref: [Feature #9924]
-
- * test/ruby/test_gc.rb: add constraints test for gc stat information.
-
-Wed Sep 10 11:31:16 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): rename:
- * remembered_shady_object -> remembered_wb_unprotected_objects
- * remembered_shady_object_limit -> remembered_wb_unprotected_objects_limit
- * old_object -> old_objects
- * old_object_limit -> old_objects_limit
- ref: [Feature #9924]
-
-Wed Sep 10 11:12:25 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): support:
- * total_allocated_pages
- * total_freed_pages
- ref: [Feature #9924]
-
-Wed Sep 10 10:48:04 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb: catch up last fix.
-
-Wed Sep 10 10:36:08 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (objspace_total_slot): rename objspace_available_slots.
-
- * gc.c (objspace_live_slot, objspace_free_slot): rename
- ..._slot() to ..._slots().
-
- * gc.c (objspace_free_slot): should subtract heap_pages_final_slots.
-
- * gc.c (gc_stat_internal):
- * add `heap_available_slots' field
- * rename heap_live_slot to heap_live_slots
- * rename heap_free_slot to heap_free_slots
- ref: [Feature #9924]
-
-Wed Sep 10 07:22:53 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: refactoring for RGENGC_PROFILE > 0.
-
- * rename rb_objspace_t::profile::..._count
- to rb_objspace_t::profile::total_..._count
- * rename promote_infant_types to promote_types
-
- * gc.c (gc_remember_unprotected): count remembered shady objects here.
-
-Wed Sep 10 03:12:12 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * gc.c (init_mark_stack): MEMZERO() receive type as 2nd argument instead
- of size.
- Coverity Scan found this bug.
-
-Tue Sep 9 21:55:39 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/sample/excel2.rb: remove some commented-out code.
- rotate graph more slowly to see graph clearly.
-
-Tue Sep 9 19:52:33 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename rb_objspace_t::marked_objects to marked_slots.
-
- * gc.c (gc_marks_start): should be clear first.
-
- * gc.c (gc_marks_start): remembered shady objects are also marked.
-
- * gc.c (gc_stat_internal): add heap_marked_slots.
-
-Tue Sep 9 18:58:48 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename
- * total_allocated_object_num -> total_allocated_objects
- * total_allocated_object_num_at_gc_start -> total_allocated_objects_at_gc_start
- * total_freed_object_num -> total_freed_objects
-
- * gc.c (gc_stat_internal):
- * rename total_allocated_object -> total_allocated_objects
- * rename total_freed_object -> total_freed_objects
-
-Tue Sep 9 18:51:36 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): fix symbol names
- * heap_final_slot -> heap_final_slots
- * heap_swept_slot -> heap_swept_slots
-
-Tue Sep 9 18:18:07 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_t::heap_pages): rename field names:
- * used -> allocated_pages
- * increment -> allocatable_pages
- * length -> sorted_length
- And remove unused `limit' field.
-
- * gc.c: rename macros:
- * heap_pages_used -> heap_allocated_pages
- * heap_pages_length -> heap_pages_sorted_length
- * heap_pages_increment -> heap_allocatable_pages
-
- * gc.c (gc_stat_internal): fix symbol names
- * heap_used -> heap_allocated_pages
- * heap_eden_page_length -> heap_eden_pages
- * heap_tomb_page_length -> heap_tomb_pages
- * heap_increment -> heap_allocatable_pages
- * heap_length -> heap_sorted_length
-
- ref: [Feature #9924]
- https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing
- Yellow color fields in this table are changed.
-
- * test/ruby/test_gc.rb: catch up this change.
-
-Tue Sep 9 14:56:03 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: continue layout changing.
-
- newobj_of() also touch:
- (4) increment total_allocated_object_num
- (5) check hook_events
-
- And gather fields related to marking phase.
-
-Tue Sep 9 14:21:50 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix layout of rb_objspace_t to improve cache locality.
-
- newobj_of() accesses:
- (1) rb_objspace_t::flags
- (2) rb_objspace_t::eden_heap::freelist
- (3) and rb_objspace_t::eden_heap::free_pages if freelist is NULL.
-
-Tue Sep 9 14:09:36 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: move rb_objspace_t::flags::gc_stressful after during_gc
- to make accessing both parameters easy.
-
- * gc.c (heap_get_freeobj): add LIKELY() hint.
-
- * gc.c (heap_get_freeobj_from_next_freepage): ditto.
-
- * gc.c (newobj_of): check both parameters at once for exceptional
- case.
-
-Tue Sep 9 13:51:32 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add rb_objspace_t::flags::gc_stressful and
- ruby_gc_stressful macro.
- Rename objspace->gc_stress to objspace->gc_stress_mode.
-
- If objspace->gc_stress_mode is true (!nil and !false) then
- ruby_gc_stressful becomes TRUE.
-
- ruby_gc_stressful will speedup newobj_of() slightly.
-
- * gc.c: initialize ruby_gc_stress(full|_mode) by gc_params.gc_stress
- even if ENABLE_VM_OBJSPACE is false.
-
-Tue Sep 9 13:05:50 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: remove ruby_disable_gc_stress and add ruby_disable_gc
- to speed-up newobj_of().
-
- * gc.c (ready_to_gc): check ruby_disable_gc.
-
- * signal.c: use ruby_disable_gc.
-
-Tue Sep 9 12:11:41 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename gc_stat entries and check stat transition.
-
-Tue Sep 9 12:06:03 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_sweep_rest): remove wrong modification of during_gc flag.
-
-Tue Sep 9 11:39:41 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: pack boolean values into rb_objspace_t::flags with bit fields
- to improve cache locality.
-
-Tue Sep 9 11:11:05 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_object.rb: extend timeout.
-
-Tue Sep 9 09:02:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#pkg_config): append --cflags to also
- $CXXFLAGS, as they are often used by C++ compiler.
- [ruby-core:54532] [Bug #8315]
-
-Tue Sep 9 07:03:22 2014 Eric Wong <e@80x24.org>
-
- * compile.c: remove needless SYM2ID <-> ID2SYM conversions
- [misc #10207]
-
-Tue Sep 9 05:48:42 2014 Eric Wong <e@80x24.org>
-
- * symbol.c (rb_intern_cstr_without_pindown): check dsymbol on return
- This is not a complete fix for bug 10206, but seems to reduce
- that crash and also looks correct.
-
-Tue Sep 9 04:36:24 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (rb_env_t): use flexible array
- This reduces allocations and speeds up the lambda calculus
- fizzbuzz (bm_app_lc_fizzbuzz.rb) benchmark [ruby-core:64858]
- * proc.c (get_local_variable_ptr): deconst to adjust for flex array
- * vm.c (env_mark, env_free, env_memsize): remove check for env->env
- * vm.c (env_alloc): single allocation for flex array
- * vm.c (vm_make_env_each): adjust env_alloc call
-
-Mon Sep 8 16:08:22 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_app_lc_fizzbuzz.rb: should skip output on benchmark.
-
-Mon Sep 8 16:04:02 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_app_lc_fizzbuzz.rb: `answer.to_a' does not return
- a string, but an array.
-
-Mon Sep 8 13:18:37 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_app_lc_fizzbuzz.rb: added.
-
- This program is described closely in "Understanding Computation"
- chapter 6 by Tom Stuart. <http://computationbook.com/>
-
- Japanese translation will be published soon.
- <http://www.oreilly.co.jp/books/9784873116976/>
-
-Mon Sep 8 12:01:39 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add incremental GC algorithm. [Feature #10137]
-
- Please refer this ticket for details.
-
- This change also introduces the following changes.
-
- * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3).
- Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in
- RBasic::flags (2 bit). Age == 3 objects become old objects.
- * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap.
- * LONG_LIVED bitmap to represent living objects while minor GCs
- It specifies (1) Old objects and (2) remembered shady objects.
- * Introduce rb_objspace_t::marked_objects which counts marked
- objects in current marking phase. marking count is needed to
- introduce incremental marking.
- * rename mark related function and sweep related function to
- gc_(marks|sweep)_(start|finish|step|rest|continue).
- * rename rgengc_report() to gc_report().
- * Add obj_info() function to get cstr of object details.
- * Add MEASURE_LINE() macro to measure execution time of specific line.
- * and many small fixes.
-
- * include/ruby/ruby.h: add flag USE_RINCGC.
- Now USE_RINCGC can be set only with USE_RGENGC.
-
- * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1
- to count object age.
-
- * include/ruby/ruby.h: rewrite write barriers for incremental marking.
-
- * debug.c: catch up flag name changes.
-
- * internal.h: add rb_gc_writebarrier_remember() instead of
- rb_gc_writebarrier_remember_promoted().
-
- * array.c (ary_memcpy0): use rb_gc_writebarrier_remember().
-
- * array.c (rb_ary_modify): ditto.
-
- * hash.c (rb_hash_keys): ditto.
-
- * hash.c (rb_hash_values): ditto.
-
- * object.c (init_copy): use rb_copy_wb_protected_attribute() because
- FL_WB_PROTECTED is moved from RBasic::flags.
-
- * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes.
-
-Sun Sep 7 12:47:06 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c: PTHREAD_CANCEL_DISABLE is not defined on Android.
-
-Sat Sep 6 20:59:06 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (has_privilege): The gid zero is not a privilege.
-
-Sat Sep 6 20:19:16 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (struct child_handler_disabler_state): cancelstate field
- added.
- (disable_child_handler_before_fork): Record cancelstate.
- (disable_child_handler_fork_parent): Restore cancelstate.
-
-Sat Sep 6 19:27:10 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (struct child_handler_disabler_state): Defined.
-
-Sat Sep 6 18:31:32 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rake.rb, lib/rake/*, test/rake/*: Update latest rake master(e47d023)
-
-Sat Sep 6 16:38:08 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_variant.c (ole_val2variant_err,
- ole_val2variantdata, Init_win32ole_variant): support VT_ERROR
- variant with error code. add WIN32OLE_VARIANT::NoParam.
- * test/win32ole/test_win32ole_variant.rb(test_c_noparam,
- test_vt_error_noparam): ditto.
- * ext/win32ole/win32ole.c: ditto.
-
-Sat Sep 6 11:08:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (arg_ambiguous_gen): fix warning message, "even" does
- not mean the number of spaces here. state the place to put a
- space and the operator. [ruby-core:64790] [Bug #10204]
-
-Sat Sep 6 08:44:40 2014 Zachary Scott <e@zzak.io>
-
- * lib/rdoc/generator/template/darkfish/js/jquery.js: Backport
- rdoc/rdoc@74f60fcb04fee1778fe2694d1a0ea6513f8e67b7
-
-Sat Sep 6 08:10:44 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_io.rb (test_readpartial_locktmp): use IO#nonblock=
- Old fcntl invocation may drop necessary flags on some platforms.
-
-Sat Sep 6 07:46:51 2014 Eric Wong <e@80x24.org>
-
- * test/ruby/test_io.rb (test_readpartial_locktmp): avoid EBADF
- [ruby-core:64773] [ruby-core:64775]
-
-Sat Sep 6 01:34:31 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_f_exec): Call before_exec_async_signal_safe and
- after_exec_async_signal_safe around rb_exec_async_signal_safe.
- (rb_exec_async_signal_safe): Don't call
- before_exec_async_signal_safe and after_exec_async_signal_safe.
- (rb_exec_without_timer_thread): Call before_exec and
- after_exec.
- (disable_child_handler_fork_child): Make SIGPIPE handler SIG_DFL.
-
-Sat Sep 6 00:49:41 2014 Tanaka Akira <akr@fsij.org>
-
- * signal.c (ruby_signal): Don't set SA_SIGINFO for SIG_IGN and
- SIG_DFL.
-
-Fri Sep 5 21:45:33 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (disable_child_handler_before_fork): New function.
- (disable_child_handler_fork_parent): Ditto.
- (disable_child_handler_fork_child): Ditto.
- (retry_fork_async_signal_safe): Call above functions to disable
- signal handlers in child process.
-
-Fri Sep 5 21:02:54 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (handle_fork_error): Make try_gc_p argument volatile to
- suppress "clobbered" warning.
-
-Fri Sep 5 20:48:06 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (handle_fork_error): Don't need state_p argument.
-
-Fri Sep 5 20:35:52 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (has_privilege): Fix a return value.
-
-Fri Sep 5 19:00:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/shellwords.rb: proofreading documentation.
- [Bug #10155][ruby-core:64471]
-
-Fri Sep 5 18:34:33 2014 Laurent Arnoud <laurent@spkdev.net>
-
- * test/csv/test_row.rb: Added some missing tests in CSV.
- [fix GH-710]
- * test/csv/test_table.rb: ditto.
-
-Fri Sep 5 12:57:52 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (has_privilege): Refine uid/gid check.
-
-Fri Sep 5 12:40:55 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Check sys/id.h, getuidx and getgidx for AIX.
-
- * process.c (getresuid): Defined for AIX.
- (getresgid): Ditto
- AIX don't have getresuid/getresgid but getuidx/getgidx.
-
-Fri Sep 5 12:28:21 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (has_privilege): Fix assignments.
-
-Fri Sep 5 11:10:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rdoc/generator/pot/po.rb: fixed broken tests for trailing whitespace.
- * test/rdoc/test_rdoc_generator_pot.rb: ditto.
- * test/rdoc/test_rdoc_generator_pot_po.rb: ditto.
-
-Fri Sep 5 10:41:07 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/rdoc/test_rdoc_rdoc.rb (TestRDocRDoc#test_parse_file_encoding):
- typofix.
-
-Fri Sep 5 10:39:14 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(313287)
-
-Fri Sep 5 06:04:22 2014 Eric Wong <e@80x24.org>
-
- * vm.c: remove unused USE_THREAD_RECYCLE [misc #10198]
-
-Fri Sep 5 00:29:08 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in (dirfd): Check function.
-
- * dir.c (dir_fileno): New method.
- [ruby-dev:48265] [Feature #9880]
-
-Thu Sep 4 23:39:52 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (has_privilege): New function.
- (retry_fork_async_signal_safe): Don't use vfork() for privileged
- process.
-
- * configure.in (getresuid): Check function.
- (getresgid): Ditto.
-
-Thu Sep 4 20:22:14 2014 Laurent Arnoud <laurent@spkdev.net>
-
- * test/pathname/test_pathname.rb: added testcase for Pathname#mountpoint?.
- [fix GH-709]
-
-Thu Sep 4 20:09:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * symbian/*: removed Symbian support.
- [Feature #10199][ruby-core:64725]
- * dln.c: ditto.
- * include/ruby/defines.h: ditto.
- * thread_pthread.c: ditto.
- * vm.c: ditto.
-
-Thu Sep 4 17:44:40 2014 Koichi Sasada <ko1@atdot.net>
-
- * dir.c (glob_helper): use #ifdef instead of #if.
- gcc's -Wundef option shows warning for undefined macro.
-
- * numeric.c (flo_is_finite_p): ditto.
-
- * vm_dump.c (rb_vmdebug_thread_dump_state): ditto.
-
- * vm_core.h: define VM_DEBUG_VERIFY_METHOD_CACHE to 0.
-
-Thu Sep 4 03:57:46 2014 Eric Wong <e@80x24.org>
-
- * man/ruby.1: spelling fix ("bellow" => "below") [ci-skip]
-
-Thu Sep 4 03:52:16 2014 Eric Wong <e@80x24.org>
-
- * man/ruby.1: add trailing slash to URLs [ci-skip]
-
-Wed Sep 3 19:10:28 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (before_fork_ruby): Renamed from before_fork.
- (after_fork_ruby): Renamed from after_fork.
-
-Wed Sep 3 18:56:05 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (forked_child): Removed.
-
-Wed Sep 3 16:56:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_obj_copy_ivar): allocate no memory for empty
- instance variables. [ruby-core:64700] [Bug #10191]
-
-Wed Sep 3 12:05:17 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (retry_fork_async_signal_safe): Use vfork() if available.
- vfork() is still faster than fork() especially when the parent
- process uses big memory.
-
- ruby -rbenchmark -e 'a = "a" * 1_000_000_000; puts Benchmark.measure { system("true") }'
- fork: 0.000000 0.010000 0.010000 ( 0.014968)
- vfork: 0.000000 0.000000 0.000000 ( 0.000912)
- on Debian sid.
-
-Wed Sep 3 11:33:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/openssl/test_pkey_rsa.rb (OpenSSL#test_sign_verify_memory_leak):
- added timeout into testcase for low performance environment.
- [Bug #9984][ruby-core:63367]
-
-Wed Sep 3 07:50:15 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Use AC_FUNC_FORK.
-
- * io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK.
-
- * process.c: Ditto.
-
-Wed Sep 3 00:12:44 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (retry_fork_async_signal_safe): Don't return on in child
- process.
-
-Tue Sep 2 23:47:35 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (retry_fork_async_signal_safe): Specialized version of
- retry_fork respect to rb_fork_async_signal_safe.
- (retry_fork_ruby): Specialized version of retry_fork respect to
- rb_fork_ruby.
- (rb_fork_ruby): Removed.
-
-Tue Sep 2 23:26:26 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (send_child_error): Simplified.
- (recv_child_error): Ditto.
-
-Tue Sep 2 22:56:25 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_async_signal_safe): Inline rb_fork_internal.
- (rb_fork_ruby): Ditto.
- (rb_fork_internal): Removed.
- (chfunc_protect): Removed.
-
-Tue Sep 2 22:43:52 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_io.rb (test_new_with_block): Set autoclose to avoid
- EBADF.
-
-Tue Sep 2 22:01:51 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * Makefile.in (update-coverage): Remove a never executed line.
-
-Tue Sep 2 19:48:26 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (handle_fork_error): Extracted from retry_fork.
-
-Tue Sep 2 17:02:53 2014 Vit Ondruch <v.ondruch@tiscali.cz>
-
- * tool/rbinstall.rb: fixed error of local installation.
- [Bug #10192][ruby-core:64702]
-
-Tue Sep 2 16:58:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/runner.rb: reporting test coverage for test-all with COVERAGE env.
- [Feature #10189][ruby-core:64681][fix GH-708]
- * Makefile.in: added task for coverage report.
- * common.mk: added definition of forked simplecov url.
- * .gitignore: ignored coverage directory.
-
-Mon Sep 1 20:11:02 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (rbtime2vtdate): try to convert millisecond
- of Time object to millisecond of VT_DATE VARIANT.
- * test/win32ole/test_win32ole_variant.rb
- (test_conversion_time2date_with_msec): ditto.
-
-Sun Aug 31 16:58:49 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/benchmark.rb: Fix a syntax error.
-
-Sun Aug 31 08:46:44 2014 Eric Wong <e@80x24.org>
-
- * ext/zlib/zlib.c (gzfile_reset): preserve ZSTREAM_FLAG_GZFILE
- [Bug #10101]
-
- * test/zlib/test_zlib.rb (test_rewind): test each_byte
-
-Sat Aug 30 19:22:47 2014 Eric Wong <e@80x24.org>
-
- * symbol.c (rb_sym2id): do not return garbage object
-
-Sat Aug 30 06:39:48 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: fix NameError dumping and
- loading. Fixes GH #85. Thanks @brentdax for the patch!
- * test/psych/test_exception.rb: test for fix
-
-Sat Aug 30 06:23:40 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: fix loading strings that
- look like integers but have a newline. Fixes GH #189
- * test/psych/test_string.rb: test for fix
-
-Sat Aug 30 06:10:39 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: merge keys with a hash
- should merge the hash in to the parent.
- * test/psych/test_merge_keys.rb: test for change. Fixes GH #202
-
-Sat Aug 30 06:00:26 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: quoted "<<" strings
- should not be treated as merge keys.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: hashes with keys
- containing "<<" should roundtrip.
- * test/psych/test_merge_keys.rb: test for change. Fixes GH #203
-
-Fri Aug 29 17:56:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/net/imap/test_imap_response_parser.rb: removed needless code.
-
-Fri Aug 29 17:36:58 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/rinda/test_rinda.rb: removed useless assignment variables.
- * test/rss/rss-assertions.rb: ditto.
- * test/rss/test_maker_itunes.rb: ditto.
-
-Fri Aug 29 16:18:26 2014 Eric Wong <e@80x24.org>
-
- * string.c: revert part of r47311, add rb_vm_fstring_table(),
- remove vm_core.h dependency. [ruby-core:64627]
-
-Fri Aug 29 15:17:13 2014 Eric Wong <e@80x24.org>
-
- * string.c: remove static frozen_strings
- * string.c (Init_frozen_strings): new function
- * string.c (rb_fstring): remove check for frozen strings,
- use per-VM table
- * string.c (rb_str_free): use per-VM table
- * string.c (Init_String): use per-VM table
- * vm_core.h (rb_vm_t): add frozen_strings table
- * internal.h (Init_frozen_strings): new function prototype
- * eval.c (ruby_setup): call Init_frozen_strings
- [Feature #10182]
-
-Wed Aug 27 23:10:24 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/tempfile.rb: remove "require 'thread'". its features are no
- longer used.
-
-Wed Aug 27 21:19:40 2014 gogo tanaka <mail@tanakakazuki.com>
-
- * lib/drb/acl.rb: Removed meaningless #to_s methods in interpolation.
- [Feature #10174][ruby-core:64584]
- * lib/erb.rb: ditto.
- * lib/observer.rb: ditto.
- * lib/rake/invocation_chain.rb: ditto.
- * lib/rubygems/command_manager.rb: ditto.
- * lib/rubygems/config_file.rb: ditto.
- * lib/uri/common.rb: ditto.
-
-Wed Aug 27 21:08:20 2014 gogo tanaka <mail@tanakakazuki.com>
-
- * lib/drb/drb.rb: use attr_reader instead of Module#attr.
- [Feature #10172][ruby-core:64582]
- * lib/irb/ruby-token.rb: ditto.
- * lib/net/telnet.rb: ditto.
- * lib/rdoc/ruby_token.rb: ditto.
- * lib/thwait.rb: ditto.
-
-Wed Aug 27 19:52:33 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (vtdate2rbtime): try to convert millisecond
- of VT_DATE VARIANT to nsec of Time object.
- * test/win32ole/test_win32ole_variant.rb
- (test_conversion_dbl2date_with_msec): ditto.
-
-Wed Aug 27 09:57:29 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_complex.rb: removed unreachable code.
- * test/ruby/test_rational.rb: ditto.
-
-Wed Aug 27 07:59:17 2014 Eric Wong <e@80x24.org>
-
- * compile.c (iseq_set_sequence): check for multiplication overflow
-
-Tue Aug 26 22:07:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_complex.rb: cherry-picked working assertions from r47251.
- * test/ruby/test_rational.rb: cherry-picked working assertions from r47263.
-
-Tue Aug 26 21:07:56 2014 gogo tanaka <mail@tanakakazuki.com>
-
- * lib/mathn.rb (Fixnum#**, Bignum#**, Float#**, Rational#**):
- remove as these are now built-in. [ruby-core:63973] [Bug #10086]
-
-Tue Aug 26 20:46:55 2014 Tanaka Akira <akr@fsij.org>
-
- * time.c (rb_time_unmagnify_to_float): Avoid double rounding.
- Reported by Tsuyoshi Sawada.
- https://bugs.ruby-lang.org/issues/10135#note-1
-
-Tue Aug 26 17:12:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_close): ignore only "closed stream" IOError and
- NoMethodError, do not swallow other exceptions at the end of
- block. [ruby-core:64463] [Bug #10153]
-
-Tue Aug 26 13:46:33 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * template/fake.rb.in: fix failed to make install when @srcdir@ is
- absolute path.
-
-Tue Aug 26 13:43:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_range.rb: added workaround for VERBOSE message.
-
-Tue Aug 26 12:38:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_mathn.rb: added workaround for VERBOSE messages.
-
-Tue Aug 26 11:44:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/shell/process-controller.rb: removed commented-out code.
-
-Tue Aug 26 11:39:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/thwait.rb (ThreadsWait): removed needless constant.
-
-Tue Aug 26 09:27:10 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/mathn.rb: mathn library is deprecated on ruby 2.2.
- [Feature #10169][ruby-core:64553]
-
-Tue Aug 26 09:25:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/mathn.rb: removed commented-out code.
-
-Mon Aug 25 20:15:50 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c(fole_s_connect, fole_initialize): raise a
- security error with the tainted string object.
- * ext/win32ole/win32ole_event.c(ev_advise): ditto.
- * test/win32ole/test_win32ole.rb(test_s_new_exc_svr_tainted,
- test_s_new_exc_host_tainted): ditto.
- * test/win32ole/test_win32ole_event.rb(test_s_new_exc_tainted): ditto.
-
-Mon Aug 25 12:56:54 2014 Ivan Korunkov <ivankorunkov@ya.ru>
-
- * lib/logger.rb (format_datetime): use "%6N" to show microsecond.
- [Fix GH-704]
-
-Mon Aug 25 11:02:07 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (rb_iseq_location_t): change first_lineno type to VALUE
- * iseq.c (rb_iseq_build_for_ruby2cext): update based on argument
-
-Sun Aug 24 16:14:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/e2mmap.rb: remove needless instance variables.
- * lib/irb.rb: ditto.
- * lib/irb/**/*.rb: ditto.
- * lib/shell.rb: ditto.
-
-Sun Aug 24 12:44:26 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_complex.rb: removed needless conditions.
- * test/ruby/test_rational.rb: ditto.
-
-Sun Aug 24 11:47:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_rational.rb: fixed indent.
-
-Sun Aug 24 11:44:11 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_rational.rb: remove commented-out code.
-
-Sun Aug 24 11:09:29 2014 Eric Wong <e@80x24.org>
-
- * lib/benchmark.rb (measure): reduce allocations as in r47260
-
-Sun Aug 24 10:35:54 2014 Pete Higgins <pete@peterhiggins.org>
-
- * lib/benchmark.rb (module Benchmark): define BENCHMARK_CLOCK
- (realtime): use Process.clock_gettime(BENCHMARK_CLOCK)
- Reduces allocations to improve performance [Feature #10165]
-
- * test/benchmark/test_benchmark.rb (test_realtime_output): new test
-
-Fri Aug 22 20:23:54 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_fstring): fix condition (easy to cause infinite loop!).
-
-Fri Aug 22 20:07:43 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_fstring, fstr_update_callback): simply delete garbage
- key first.
-
- Garbage keys can be swept by lazy sweeping invoked by creating new
- fstring. So that simply do:
- (1) delete garbage key and return `fstr_update_callback' immediately
- (2) try again `fstr_update_callback()' to create a new fstr.
-
- This bug can be cause memory corruption, reported by
- http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20140821T220302Z.fail.html.gz
-
-Fri Aug 22 19:30:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_complex.rb: removed commented-out code.
-
-Fri Aug 22 19:25:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_complex.rb: fixed broken tests. Math is not
- compatible CMath now.
-
-Fri Aug 22 15:36:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (Doxyfile): revert r43888, not to require preinstalled
- ruby. [ruby-core:64488] [Bug #10161]
-
-Fri Aug 22 12:32:15 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/shell.rb: removed commented-out code.
- * lib/shell/builtin-command.rb: ditto.
- * lib/shell/command-processor.rb: ditto.
-
-Fri Aug 22 12:21:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/complex.rb: removed deprecated library.
- * lib/rational.rb: ditto.
-
-Fri Aug 22 11:38:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/prettyprint.rb: removed PrettyPrint#first?
- because it is obsoleted method since Ruby 1.8.2
-
-Thu Aug 21 17:10:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (constat_attr): manage reverse video internally
- since Windows console window does not manage it. based on the
- patch by white leaf in [ruby-dev:48483]. [Bug #10158]
-
-Thu Aug 21 14:45:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/e2mmap.rb: removed commented-out code.
-
-Thu Aug 21 13:23:34 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rinda/ring.rb: split executable code into sample directory.
- * sample/rinda-ring.rb: ditto.
-
-Thu Aug 21 13:21:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/drb/acl.rb: split executable code into sample directory.
- * sample/drb/acl.rb: ditto.
-
-Thu Aug 21 12:55:35 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * .gitignore: ignored temporary file for Changelog.
- http://mkosaki.blog46.fc2.com/blog-entry-1284.html
-
-Thu Aug 21 12:40:22 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/net/imap.rb: split executable code into sample directory.
- * sample/net-imap.rb: ditto.
-
-Thu Aug 21 12:23:56 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/net/imap.rb: removed commented-out code.
-
-Wed Aug 20 17:27:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_TRY_CFLAGS, RUBY_TRY_LDFLAGS),
- (RUBY_CHECK_BUILTIN_SETJMP, RUBY_SETJMP_TYPE),
- (RUBY_STACK_GROW_DIRECTION): quote defun names, for some
- versions of autoconf possibly. [ruby-core:64473] [Bug #10156]
-
-Tue Aug 19 22:28:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (rb_str_format): fix condition to round.
- [ruby-core:64454] [Bug #10151]
-
-Tue Aug 19 22:22:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/trans/euckr-tbl.rb (EUCKR_TO_UCS_TBL): add missing euro and
- registered signs. [ruby-core:64452] [Bug #10149]
-
-Tue Aug 19 13:59:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compar.c (rb_cmperr): preserve encodings of arguments in the
- message.
-
-Tue Aug 19 10:13:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/thread/thread.c (get_array): check instance variables are
- initialized properly. [ruby-core:63826][Bug #10062]
-
-Mon Aug 18 17:06:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (rb_str_format): support rational 'f' format.
- [ruby-core:64382] [Bug #10136]
-
-Mon Aug 18 08:03:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * spec/default.mspec: use 2.2 definition.
-
-Sun Aug 17 19:41:40 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * gc.c (obj_memsize_of): don't calculate memsize of T_NODE
- when called from check_gen_consistency. It fixes segmentation
- fault on RGENGC_CHECK_MODE >= 1 introduced by r47188.
-
-Sun Aug 17 17:08:12 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_invoke): use RHASH_SIZE instead of
- calling Hash#length method.
-
-Sat Aug 16 19:32:06 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_event.c (evs_length): use RARRAY_LEN instead
- of calling Array#length method.
-
-Sat Aug 16 10:20:17 2014 Eric Wong <e@80x24.org>
-
- * time.c (time_timespec): fix tv_nsec overflow
- [Bug #10144]
-
-Fri Aug 15 20:34:17 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_EVENT src from
- win32ole.c.
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_event.c: ditto.
- * ext/win32ole/win32ole_event.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Fri Aug 15 19:38:00 2014 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (rb_iseq_clone): Should not insert write barrier from
- non-RVALUE data (to non-RVALUE data, of course).
-
- Ruby 2.1 also has a same problem.
-
-Fri Aug 15 19:34:33 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (setup_fake_str): fake strings should not set class by
- RBASIC_SET_CLASS() because it insert write barriers to fake
- (non-RVALUE) structure.
-
- It can cause unexpected behaviour.
-
- Ruby 2.1 also have a same problem (setup_fake_str() in parse.y).
-
- * symbol.c (setup_fake_str): ditto.
-
-Fri Aug 15 19:27:25 2014 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_tmp_new_fill): added.
- This function creates internal use only array (which is completely
- hided by ObjectSpace.each_object) with filling nil.
-
- Otherwise, it can be includes strange VALUEs.
-
- * internal.h: added.
-
- * node.h: use rb_ary_tmp_new_fill() for MEMO.
-
-Fri Aug 15 10:13:37 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/gserver.rb: removed unmaintained code.
- [ruby-core:40313][Feature #5480]
- * lib/xmlrpc/httpserver.rb: ditto.
-
-Fri Aug 15 09:22:12 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (rb_thread_struct): reorder to pack
- * cont.c (rb_context_struct, rb_fiber_struct): ditto
- On x86-64, these changes reduces:
- rb_thread_struct to 1000 bytes (from 1016)
- rb_context_struct to 1288 bytes (from 1312)
- rb_fiber_struct to 2272 bytes (from 2304)
-
-Fri Aug 15 09:06:31 2014 Eric Wong <e@80x24.org>
-
- * thread_pthread.h: define RB_NATIVETHREAD_LOCK_INIT and
- RB_NATIVETHREAD_COND_INIT macros
-
- * thread_pthread.c (native_mutex_lock, native_mutex_unlock,
- native_mutex_trylock, native_mutex_initialize,
- native_mutex_destroy, native_cond_wait):
- use rb_nativethread_lock_t instead of pthread_mutex_t
- [Feature #10134]
-
- * thread_pthread.c (native_mutex_debug): make argument type-agnostic
- to avoid later cast.
-
- * thread_pthread.c (register_cached_thread_and_wait):
- replace PTHREAD_COND_INITIALIZER with RB_NATIVETHREAD_COND_INIT,
- use native_mutex_{lock,unlock}
-
- * thread_pthread.c (use_cached_thread):
- use native_mutex_{lock,unlock}
-
- * thread_pthread.c (native_sleep):
- use rb_nativethread_lock_t to match th->interrupt_lock,
- use native_mutex_{lock,unlock}
-
- * thread_pthread.c (timer_thread_lock): use rb_nativethread_lock_t type
-
-Fri Aug 15 08:10:29 2014 Eric Wong <e@80x24.org>
-
- * cont.c (cont_mark): fix typo in unused path [ci skip]
-
-Fri Aug 15 06:00:56 2014 Eric Wong <e@80x24.org>
-
- * vm.c (rb_thread_mark): update comment about marking `me'
- [ruby-core:64340] [ruby-core:64341]
-
-Fri Aug 15 05:53:59 2014 Eric Wong <e@80x24.org>
-
- * README.EXT: preliminary documentation for RB_GC_GUARD
- [Bug #10100] [ruby-core:60741]
-
-Thu Aug 14 00:26:19 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_RECORD src from
- win32ole.c
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_record.c: ditto.
- * ext/win32ole/win32ole_record.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Wed Aug 13 21:41:04 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_VARIANT src from
- win32ole.c.
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_variant.c: ditto.
- * ext/win32ole/win32ole_variant.c: ditto.
- * ext/win32ole/depend: ditto.
-
-Wed Aug 13 20:09:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: remove unused variable.
-
-Wed Aug 13 19:31:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_search_handler_method, rescue_callback,
- folerecord_inspect): use PRIsVALUE in rb_sprintf.
-
- * ext/win32ole/win32ole_param.c (foleparam_inspect): ditto.
-
- * ext/win32ole/win32ole_variable.c (folevariable_inspect): use
- PRIsVALUE in rb_sprintf, use rb_inspect.
-
-Wed Aug 13 11:54:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/irb/completion.rb: reverted r47163.
- because another case can't be show completion target.
-
-Wed Aug 13 11:17:00 2014 Shimpei Makimoto <github@makimoto.org>
-
- * lib/irb.rb: Prevent irb from crashing when exception with
- nil backtrace is raised.
- [fix GH-434][ruby-core:58078][Bug #9063]
- * test/irb/test_raise_no_backtrace_exception.rb: ditto.
-
-Wed Aug 13 11:08:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/irb/completion.rb: fixed broken completion list with
- String including spaces. Contributed from @dunric. [fix GH-465]
-
-Wed Aug 13 00:07:01 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_PARAM src from win32ole.c
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_param.c: ditto.
- * ext/win32ole/win32ole_param.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Tue Aug 12 23:17:47 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: refactoring. move some methods
- into win32ole_type.c / win32ole_method.c
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_method.c: ditto.
- * ext/win32ole/win32ole_method.h: ditto.
- * ext/win32ole/win32ole_type.h: ditto.
- * ext/win32ole/win32ole_type.h: ditto.
-
-Tue Aug 12 22:59:48 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: refactoring. move
- ole_typelib_from_itypeinfo into win32ole_typelib.c.
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_typelib.h: ditto.
- * ext/win32ole/win32ole_typelib.h: ditto.
-
-Tue Aug 12 21:49:40 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_create_dcom): use the converted
- result if the argument can be converted to a string, to get rid
- of invalid access. Thanks to nobu. [ruby-dev:48467] [Bug #10127]
-
-Tue Aug 12 14:22:58 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * configure.in: ignored working directory same as prefix value.
- [ruby-core:54999] [Bug #8409]
-
-Tue Aug 12 13:34:25 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/fileutils.rb: enable to remove with non-owner directory.
- [ruby-dev:45976] [Bug #6756]
- * test/fileutils/test_fileutils.rb: add testcase for #6756.
-
-Tue Aug 12 12:57:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * vm_exec.c: improve performance in ppc64 arch.
- [ruby-core:63437] [Feature #9997]
-
-Tue Aug 12 12:14:52 2014 Akira Matsuda <ronnie@dio.jp>
-
- * lib/fileutils.rb: fix typo.
- [ruby-dev:47831] [Bug #9180]
-
-Tue Aug 12 10:10:42 2014 Eric Wong <e@80x24.org>
-
- * vm_method.c (release_method_definition): use rb_free_method_entry
-
-Tue Aug 12 06:16:09 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_METHOD src from
- win32ole.c.
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_method.c: ditto.
- * ext/win32ole/win32ole_method.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Mon Aug 11 22:19:15 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_variable.c (folevariable_inspect): refactoring.
-
-Mon Aug 11 20:47:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_VARIABLE src from
- win32ole.c
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_variable.c: ditto.
- * ext/win32ole/win32ole_variable.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Mon Aug 11 16:17:21 2014 Tony Miller <mcfiredrill@gmail.com>
-
- * dir.c (rb_dir_exists_p): [DOC] Document that Dir.exists? is
- deprecated. [ruby-core:64135] [Bug #10102]
-
-Mon Aug 11 11:26:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/tempfile.rb: start rdoc parsing inside singleton class
- definition to include the document there.
- [ruby-core:64157] [Bug #10105]
-
-Sun Aug 10 12:22:43 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_type.c: refactoring.
-
-Sun Aug 10 10:34:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/cgi/session/pstore.rb: separated sample code.
- * lib/open3.rb: ditto.
-
-Sun Aug 10 10:03:24 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/irb/ext/multi-irb.rb: removed commented-out code.
-
-Sat Aug 9 11:02:07 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/irb.rb: removed commented-out code.
- * lib/irb/**/*.rb: ditto.
-
-Sat Aug 9 10:35:30 2014 Laurent Arnoud <laurent@spkdev.net>
-
- * lib/cmath.rb: fixed indent. [fix GH-696]
- * lib/drb/ssl.rb: ditto.
- * lib/irb/**/*.rb: ditto.
-
-Sat Aug 9 10:28:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/minitest/test_minitest_unit.rb: removed obsoleted condition
- for Ruby 1.8.
- * test/ruby/test_time_tz.rb: ditto.
-
-Sat Aug 9 10:18:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/cgi/test_cgi_core.rb: removed obsoleted condition for Ruby 1.8.
- * test/cgi/test_cgi_header.rb: ditto.
- * test/cgi/test_cgi_multipart.rb: ditto.
- * test/cgi/test_cgi_tag_helper.rb: ditto.
-
-Sat Aug 9 00:34:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE_TYPE src from win32ole.c.
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_type.c: ditto.
- * ext/win32ole/win32ole_type.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Fri Aug 8 01:53:37 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/securerandom.rb: use OpenSSL::BN for performance improvement.
-
- * benchmark/bm_securerandom.rb: benchmark script.
-
-Fri Aug 8 17:19:57 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/open-uri.rb: remove needless condition for old ruby version.
- * test/open-uri/test_open-uri.rb: ditto.
-
-Fri Aug 8 16:40:59 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/irb/init.rb: removed unreachable code.
-
-Fri Aug 8 16:34:22 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/drb/drb.rb: removed unreachable code.
-
-Fri Aug 8 14:33:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/webrick/httpproxy.rb: remove needless condition
- for old ruby version.
-
-Fri Aug 8 01:07:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): fix invalid char in eval, should raise
- an syntax error too, as well as directly coded.
- [ruby-core:64243] [Bug #10117]
-
-Thu Aug 7 23:25:29 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/open3.rb: avoid unnecessary write if stdin_data is empty.
-
-Thu Aug 7 21:42:49 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole_typelib.c (foletypelib_version): return
- version string.
-
- * test/win32ole/test_win32ole_typelib.rb (test_version): ditto.
-
-Thu Aug 7 15:13:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/cgi.rb: remove needless condition for old ruby version.
-
-Thu Aug 7 06:04:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yyerror): preserve source code encoding in
- syntax error messages. [ruby-core:64228] [Bug #10114]
-
-Wed Aug 6 20:56:02 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate src of WIN32OLE_TYPELIB from
- win32ole.c
-
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_typelib.c: ditto.
- * ext/win32ole/win32ole_typelib.h: ditto.
- * ext/win32ole/depend: ditto.
-
-Wed Aug 6 20:44:07 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * enum.c (enum_one): [DOC] Move enum.one? documentation before the
- relevant method. Submitted by @vipulnsward. [Fixes GH-687]
- https://github.com/ruby/ruby/pull/687
-
-Wed Aug 6 20:25:47 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set#replace): Check if an object given is enumerable
- before clearing self. Reported by yui-knk. [GH-675]
- https://github.com/ruby/ruby/pull/675
-
-Wed Aug 6 20:07:26 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (olerecord_ivar_set): remove rb_str_subseq.
-
-Wed Aug 6 19:09:27 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb (Set): Implement Set#clone by splitting
- initialize_copy into initialize_dup and initialize_clone.
- Submitted by yui-knk. [Fixes GH-661]
- https://github.com/ruby/ruby/pull/661
-
-Wed Aug 6 18:42:58 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate src of WIN32OLERuntimeError
- from win32ole.c.
-
- * ext/win32ole/win32ole.h: ditto
- * ext/win32ole/depend: ditto.
- * ext/win32ole/win32ole_error.c: ditto.
- * ext/win32ole/win32ole_error.h: ditto.
-
-Wed Aug 6 04:33:58 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP.proxy_uri): use initializer instead
- of parser to handle IPv6 address. [Bug #9129]
-
-Wed Aug 6 04:16:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/requests.rb (Net::HTTP::Options::RESPONSE_HAS_BODY):
- OPTIONS requests may have response bodies. [Feature #8429]
- http://tools.ietf.org/html/rfc7231#section-4.3.7
-
-Wed Aug 6 03:18:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/generic_request.rb (Net::HTTP::GenericRequest#exec):
- handle req['host'] in update_uri.
-
- * lib/net/http/generic_request.rb
- (Net::HTTP::GenericRequest#update_uri):
- use req['host'] if it is explicitly set. Even if URI is given,
- it is already used for the initial value of req['host'].
- Therefore overwritten value should be respected. [Bug #10054]
-
-Wed Aug 6 03:17:34 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/generic_request.rb
- (Net::HTTP::GenericRequest#update_uri):
- handle scheme, host, and port to reflect connection to @uri.
-
- * lib/net/http.rb (Net::HTTP#begin_transport): move trivial handling
- to Net::HTTP::GenericRequest#update_uri.
-
-
-Wed Aug 6 02:16:43 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/generic_request.rb
- (Net::HTTP::GenericRequest#initialize):
- optimize object allocation.
-
-Wed Aug 6 01:16:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI::Generic#path_query): remove a private method.
-
-Wed Aug 6 01:15:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI::Generic#normalize!): use String#empty?
-
- * lib/uri/generic.rb (URI::Generic#path_query): optimized.
-
- * lib/uri/generic.rb (URI::Generic#to_s): optimized.
-
-Wed Aug 6 00:15:10 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/http.rb (URI::HTTP#request_uri): optimized.
- decrease object allocation, and ensure always create at least one new
- object for return value.
-
-Wed Aug 6 03:41:21 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: backwards compatibility for
- hashes emitted by Syck. Github #198
- * test/psych/test_hash.rb: test for change.
-
-Tue Aug 5 19:27:59 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_invoke): skip VariantClear when
- argument is VT_RECORD variant.
-
-Tue Aug 5 15:52:51 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gems/bundled_gems: Upgrade to test-unit-3.0.0 and minitest-5.4.0.
-
-Mon Aug 4 21:50:09 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_record.rb: add for WIN32OLE_RECORD
- test(need .NET Framework 3.5 to run test).
-
-Mon Aug 4 19:49:34 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_invoke): call rb_hash_foreach instead
- of rb_block_call.
-
- * ext/win32ole/win32ole.c: add comment for rdoc of WIN32OLE_VARIANT
- class.
-
-Mon Aug 4 09:12:47 2014 Eric Wong <e@80x24.org>
-
- * variable.c: cleanup to use rb_const_lookup
- [Feature #10107]
-
- * vm_insnhelper.c: ditto
-
-Sun Aug 3 10:55:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/encoding.h (rb_check_symbol_cstr): ditto.
-
-Sun Aug 3 10:43:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_method): unusable super class should cause
- method missing when BasicObject is refined but not been using.
- [ruby-core:64166] [Bug #10106]
-
-Sat Aug 2 23:47:45 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: separate WIN32OLE::VARIANT src file
- from win32ole.c
- * ext/win32ole/win32ole.h: ditto.
- * ext/win32ole/win32ole_variant_m.c: ditto.
- * ext/win32ole/win32ole_variant_m.h: ditto.
- * ext/win32ole/depend: ditto.
- * ext/.document: ditto.
-
-Sat Aug 2 14:34:58 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: add comments for rdoc.
-
-Sat Aug 2 10:26:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_obj_itself): new method Object#itself. based on the
- patch by Rafael Franca in [ruby-core:64156].
- [EXPERIMENTAL] this method may be renamed due to compatibilities.
- [ruby-core:44704] [Feature #6373]
-
-Fri Aug 1 22:30:40 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (folerecord_initialize): accept
- only 2 arguments. The 2nd argument should be WIN32OLE object or
- WIN32OLE_RECORD object.
-
-Fri Aug 1 20:17:33 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_variant2val): call
- folerecord_s_allocate instead of WIN32OLE_RECORD.new.
-
-Fri Aug 1 18:39:57 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/date/test_date.rb: remove commented-out code.
- * test/date/test_date_arith.rb: ditto.
- * test/date/test_date_attr.rb: ditto.
- * test/date/test_date_parse.rb: ditto.
-
-Fri Aug 1 16:35:32 2014 Evan Miller <evan@squareup.com>
-
- * numeric.c (flodivmod): all results are NaN if divisor is NaN.
- [fix GH-692]
-
-Thu Aug 01 07:28:12 2014 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c: [DOC] Add description of
- `BigDecimal.new` exceptions. Patched by @joker1007 and
- @prathamesh-sonpatki [Fixes GH-690]
- https://github.com/ruby/ruby/pull/690
-
-Thu Jul 31 22:20:12 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: add WIN32OLE_RECORD#inspect.
-
-Thu Jul 31 20:35:32 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: add
- WIN32OLE_RECORD#ole_instance_variable_set and
- WIN32OLE_RECORD#ole_instance_variable_get
-
-Wed Jul 30 23:28:10 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * sprintf.c (rb_str_format): like r47006, get rid of
- function calls in RSTRING_PTR().
-
-Wed Jul 30 22:10:29 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * process.c (rlimit_resource_type, rlimit_resource_value):
- get rid of inadvertent dynamic symbol pin-down.
-
- * re.c (match_backref_number): ditto.
-
- * signal.c (esignal_init, rb_f_kill, trap_signm): ditto.
-
- * transcode.c (econv_opts): ditto.
-
- * vm_trace.c (symbol2event_flag): ditto.
-
-Wed Jul 30 21:29:39 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant
- by reference when invoke OLE methods at first.
-
- * ext/win32ole/win32ole.c (olerecord_set_ivar): release
- IRecordInfo interface before setting another IRecordInfo interface.
-
-Wed Jul 30 13:17:35 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: remove unused macros.
-
-Tue Jul 29 22:21:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD
- instance variable if the variable is nil.
-
-Tue Jul 29 19:43:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (folerecord_method_missing): refactoring.
- divide functionality of folerecord_method_missing into
- olerecord_ivar_set and olerecord_ivar_get.
-
-Mon Jul 28 20:20:08 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win23ole.c (folerecord_method_missing): support
- setter of member of WIN32OLE_RECORD object.
-
-Mon Jul 28 06:37:19 2014 Zachary Scott <e@zzak.io>
-
- * vm_eval.c: [DOC] Fix rdoc formatting of patch from [Bug #9551]
-
-Mon Jul 28 06:34:43 2014 Zachary Scott <e@zzak.io>
-
- * vm_eval.c: [DOC] [Bug #9551] Improve clarity of Kernel::catch
- documentation, patch by Jesse Sielaff.
-
-Mon Jul 28 06:24:54 2014 Zachary Scott <e@zzak.io>
-
- * lib/uri/common.rb: [DOC] [Bug #9563] Recommend using URI.escape
- before parsing a uri to avoid invalid characters. Reported by
- Evgeniy Serykh.
-
-Mon Jul 28 05:55:56 2014 Zachary Scott <e@zzak.io>
-
- * time.c: [DOC] Clarify %Y in strftime, which can accept any digits
- and will output at least 4 digits as the year. Reported by Yury
- Trofimenko [Bug #10049]
-
- * lib/time.rb: ditto
-
-Mon Jul 28 05:32:06 2014 Zachary Scott <e@zzak.io>
-
- * lib/uri/common.rb: [DOC] [Bug #10075] Clarify how URI.join arguments
- are handled by RFC3986, originally reported by John Feminella.
-
-Mon Jul 28 05:21:41 2014 Zachary Scott <e@zzak.io>
-
- * file.c: [DOC] Clarify how File.file? handles symbolic links. Also
- cleaned up the rdoc style for this method, more to follow.
- Originally reported by Michael Renner [Bug #10067]
-
-Mon Jul 28 05:12:22 2014 Zachary Scott <e@zzak.io>
-
- * time.c: [DOC] Remove dead link and old bug report, which hasn't been
- reproduced in a few years. Reported by Federico Builes [Bug #10071]
-
-Mon Jul 28 04:39:58 2014 Zachary Scott <e@zzak.io>
-
- * ext/zlib/zlib.c: [DOC] Remove default value of Zlib constants, as
- they may change in the implementation without notice. Patched by
- @robin850 [Fixes GH-682] https://github.com/ruby/ruby/pull/682
-
-Mon Jul 28 04:35:35 2014 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_hmac.c: Fix NO_HMAC warning [Fixes GH-665]
- Patched by @vipulnsward https://github.com/ruby/ruby/pull/665
-
-Sun Jul 27 19:49:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/cgi/core.rb: remove unused variables.
- * lib/erb.rb: ditto.
- * lib/mkmf.rb: ditto.
- * lib/net/http/response.rb: ditto.
- * lib/optparse/version.rb: ditto.
- * lib/prime.rb: ditto.
- * lib/racc/parser.rb: ditto.
- * lib/rexml/document.rb: ditto.
- * lib/rexml/dtd/dtd.rb: ditto.
- * lib/rexml/element.rb: ditto.
- * lib/rexml/functions.rb: ditto.
- * lib/rexml/parsers/xpathparser.rb: ditto.
-
-Sun Jul 27 05:11:21 2014 Zachary Scott <e@zzak.io>
-
- * lib/irb.rb: [DOC] PROMPT_I cannot be nil, patch by @hgillane
- Fixes documenting-ruby/ruby#37
- https://github.com/documenting-ruby/ruby/pull/37
-
-Sun Jul 27 02:41:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/shell/command-processor.rb: remove unused variable.
- * lib/shell/system-command.rb: ditto.
- * lib/tmpdir.rb: ditto.
- * lib/uri/generic.rb: ditto.
-
-Sun Jul 27 02:08:31 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/weakref.rb: split executable code into sample directory.
- * sample/weakref.rb: ditto.
-
-Sun Jul 27 02:06:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/delegate.rb: split executable code into sample directory.
- * sample/delegate.rb: ditto.
-
-Sun Jul 27 01:46:34 2014 Zachary Scott <e@zzak.io>
-
- * proc.c (method_super_method): [DOC] Method#super_method
-
-Sun Jul 27 01:22:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (method_super_method): new method Method#super_method,
- which returns a method object of the method to be called by
- `super` in the receiver method object.
- [ruby-core:62202] [Feature #9781]
-
-Sat Jul 26 17:22:14 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * ext/objspace/objspace_dump.c (dump_append): avoid fflush.
-
- because dump_append_string_value() iterates over each chars,
- fflush()-ing here effectively issues system calls on every single
- bytes exist in a ruby process.
-
-Sat Jul 26 16:55:18 2014 Eric Wong <e@80x24.org>
-
- * iseq.h (struct iseq_compile_data_storage): reduce overhead
- to 16 bytes (from 32) on 64-bit
-
-Sat Jul 26 16:28:06 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (struct rb_iseq_struct): reduce to 280 bytes
- (from 288 bytes) on 64-bit
-
-Sat Jul 26 06:44:43 2014 Eric Wong <e@80x24.org>
-
- * parse.y (struct parse_params): shrink to 320 to 304 bytes on 64-bit
-
-Sat Jul 26 05:58:35 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
- (Data_Make_Struct, TypedData_Make_Struct):
- ZALLOC replaces ALLOC+memset
- [ruby-core:63951][Feature #10082]
- * compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
- * cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
- * io.c (rb_io_reopen): ditto
- * iseq.c (prepare_iseq_build): ditto
- * parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
- * re.c (match_alloc): ditto
- * variable.c (rb_const_set): ditto
- * ext/socket/raddrinfo.c (get_addrinfo): ditto
- * ext/strscan/strscan.c (strscan_s_allocate): ditto
- * gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO
-
-Sat Jul 26 05:54:54 2014 Eric Wong <e@80x24.org>
-
- * symbol.c (dsymbol_check): remove unneeded semi-colon
-
-Fri Jul 25 14:07:27 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change objspace::rgengc::parent_object_is_old (boolean)
- to objspace::rgengc::parent_object (VALUE).
- Use Qfalse or RVALUE pointer instead of FALSE and TRUE.
-
- * gc.c (gc_marks_body): should clear parent_object just before
- gc_mark_roots() because there are no parents objects
- for root objects.
-
-Fri Jul 25 13:45:39 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_writebarrier_remember_promoted): should remember only
- OLD objects on RGENGC_AGE2_PROMOTION.
-
-Fri Jul 25 13:42:02 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_stacked_objects): fix error message.
-
-Fri Jul 25 13:18:00 2014 Will Farrington <wfarrington@digitalocean.com>
-
- * ext/socket/socket.c (sock_gethostname): Use NI_MAXHOST to support
- hostnames longer than 64 characters if the system supports it.
- [fixes GH-683]
-
-Fri Jul 25 12:21:11 2014 Santiago Pastorino <santiago@wyeworks.com>
-
- * compile.c (defined_expr): make the condition if the receiver
- is explicit or implicit cleaner. [fix GH-681]
-
-Fri Jul 25 03:53:52 2014 Eric Hodel <drbrain@segment7.net>
-
- * doc/keywords.rdoc: [DOC] Describe each keyword.
-
-Thu Jul 24 22:40:24 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (Init_win32ole): add WIN32OLE_RECORD#initialize
- method.
-
- * ext/win32ole/win32ole.c (ole_val2variant): convert WIN32OLE_RECORD
- object to VT_RECORD variant.
-
-Thu Jul 24 20:10:59 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: fix major GC flags.
- * add GPR_FLAG_MAJOR_BY_FORCE, which indicates
- major GC by METHOD, CAPI and so on (see GC_BY).
- * remove GPR_FLAG_MAJOR_BY_RESCAN because not used.
- * remove GPR_FLAG_MAJOR_BY_STRESS, use FORCE instead.
-
- * test/ruby/test_gc.rb: catch up.
-
-Thu Jul 24 15:55:02 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * include/ruby/io.h (struct rb_io_buffer_t): PACKED_STRUCT should not
- be used for platform-specific optimization. PACKED_STRUCT_UNALIGNED
- should be used. [ruby-core:63988] [Bug #10088]
-
-Thu Jul 24 04:42:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/benchmark.rb: split executable code into sample directory.
- * sample/benchmark.rb: ditto.
-
-Thu Jul 24 04:36:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/tempfile.rb: split executable code into sample directory.
- * sample/tempfile.rb: ditto.
-
-Thu Jul 24 04:29:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/pstore.rb: split executable code into sample directory.
- * sample/pstore.rb: ditto.
-
-Wed Jul 23 23:50:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/defines.h, siphash.c, st.c (UNALIGNED_WORD_ACCESS):
- add PowerPC64 too, which is capable to access unaligned words.
- patched by Gustavo Frederico Temple Pedrosa in [ruby-core:63937].
- [Feature #10081]
-
- * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): ditto.
-
-Wed Jul 23 04:04:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/drb/extserv.rb: remove duplicate code with sample directory.
- contributed from @vipulnsward. [fix GH-679]
-
-Tue Jul 22 12:56:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_count): fix wrong single-byte optimization.
- 7bit ascii can be a trailing byte in Shift_JIS.
- [ruby-dev:48442] [Bug #10078]
-
-Tue Jul 22 01:48:38 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/io.h (rb_io_buffer_t): fix packing on gcc
- r46892 caused packing to be a no-op on gcc (4.7.2-5, Debian)
- [Bug #10079][ruby-core:63912]
-
-Mon Jul 21 15:55:42 2014 fuji70 <fujifuji70@gmail.com>
-
- * lib/optparse.rb (getopts): print default values and descriptions
- in the help message. [fix GH-676]
-
-Sun Jul 20 14:26:27 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (rb_proc_t): reduce to 64 bytes from 72 on 64-bit
-
-Sun Jul 20 13:50:34 2014 Eric Wong <e@80x24.org>
-
- * transcode.c (rb_econv_t): reduce to 184 bytes from 200 on 64-bit
-
-Sun Jul 20 12:44:23 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/io.h (rb_io_buffer_t): pack structure
- Reduces rb_io_t from 200 to 192 bytes, allowing rb_io_t to
- occupy one less cache line.
- [Feature #10050]
-
-Sun Jul 20 12:41:53 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/io.h (rb_io_t): shrink to 200 bytes from 216 on 64-bit
- This puts us within 8 bytes of being three cache lines instead of
- four lines on x86-64. This breaks the ABI.
- [Feature #10050]
-
-Sun Jul 20 12:36:46 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/oniguruma.h (struct re_pattern_buffer): shrink to 448
- bytes from 464 bytes on 64-bit. This breaks the ABI.
- [Feature #10034]
-
-Sun Jul 20 01:06:06 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/openssl/ossl.c: use encryptor instead of encrypter in doc.
- contributed from @vipulnsward. [fix GH-663]
-
-Sun Jul 20 00:32:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_initialize): [DOC] fix rdoc of append mode. it does
- not move the pointer at open. [ruby-core:63747] [Bug #10039]
-
-Sat Jul 19 12:40:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): allow to access private attribute
- reader in op_assign. [ruby-core:63817] [Bug #10060]
-
-Sat Jul 19 11:56:36 2014 Grey Baker <greysteil@gmail.com>
-
- * lib/time.rb (Time#apply_offset): Guards against a `nil` return
- value from `Time.month_days` when offsetting date. Out of range
- values are then caught when `Time.utc` is called (as usual).
-
- Previously a `nil` return value from `Time.month_days` would
- have the `<` operator called on it, and raise `NoMethodError`.
- [fix GH-667]
-
- * lib/rdoc/parser/changelog.rb (RDoc#parse_entries): fix dirty hack.
-
-Sat Jul 19 06:19:01 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: refactoring.
-
-Fri Jul 18 22:34:41 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (folevariant_initialize): WIN32OLE_VARIANT
- does not support VT_RECORD. VT_RECORD should be supported in
- WIN32OLE_RECORD.
-
- * test/win32ole/test_win32ole_variant.rb (test_s_new_vt_record_exc):
- ditto.
-
-Fri Jul 18 19:54:03 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (folevariant_initialize): remove unnecessary
- code.
-
-Fri Jul 18 19:11:03 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix/eigenvalue_decomposition: Style fix
- Patch by Gogo Tanaka [#10058]
-
-Fri Jul 18 19:03:53 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Avoid using `and`.
- Patch by gogo tanaka [#10058]
-
-Fri Jul 18 17:41:54 2014 GoGo tanaka <qlli.illb@gmail.com>
-
- * test/matrix/test_matrix.rb: Add tests for Matrix class.
- [Feature #10057][ruby-core:63809]
-
-Fri Jul 18 10:14:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/fileutils.rb: added missing options of FileUtils.touch by @Domon.
- [fix GH-669]
-
-Thu Jul 17 19:57:27 2014 Herwin <herwin@quarantainenet.nl>
-
- * ext/thread/thread.c (rb_szqueue_push): add optional parameter,
- non_block defaulted to false. [ruby-core:63794] [Feature #10052]
-
-Wed Jul 16 23:01:43 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_variant2val): support array of
- VT_RECORD variant.
-
-Wed Jul 16 20:21:49 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * vm_core.h (struct rb_iseq_struct): stack_max is changed to int
- because all calculations related to stack_max in compile.c
- (iseq_set_sequence) and vm_insnhelper.c (vm_push_frame) are
- conducted by using int. This partly reverts r23945.
- * vm_insnhelper.c (vm_push_frame): ditto. This reverts r42401.
-
-Wed Jul 16 19:55:32 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * vm_core.h (struct rb_iseq_struct): temporal workaround of [Bug 10037].
- Add padding on big-endian 64-bit architecture (e.g. sparc64).
-
-Wed Jul 16 19:32:23 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (fole_record_method_missing): call
- rb_hash_fetch instead of rb_hash_aref.
-
-Wed Jul 16 18:08:47 2014 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (rb_iseq_defined_string): use rb_gc_mark_object() instead of
- marking from vm_mark().
-
- * vm.c (rb_vm_mark): ditto.
-
-Wed Jul 16 18:03:50 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_roots): call rb_vm_mark directly.
-
- * vm.c: remove mark function for RubyVM object because
- RubyVM object marked manually.
-
-Wed Jul 16 12:25:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09.
- this includes Support for Unicode 7.0 [Bug #9092].
-
-Tue Jul 15 23:59:27 2014 Jared Jennings <jared.jennings.ctr@us.af.mil>
-
- * ext/digest: make built-in digest function implementations
- indicate success or failure of init and final functions.
- [ruby-core:61614] [Bug #9659]
-
- * ext/digest/digest.c: expect digest init and finish functions to
- indicate success or failure; raise exception on failure.
- [ruby-core:61614] [Bug #9659]
-
-Tue Jul 15 20:31:40 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: modify document for WIN32OLE_RECORD.
-
-Tue Jul 15 12:42:23 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * defs/default_gems: change version definition file of rake.
-
-Tue Jul 15 12:00:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rake.rb, lib/rake/*.rb: Upgrade to rake-10.3.2
- [fix GH-668]
- * test/rake/*.rb: ditto.
-
-Mon Jul 14 19:14:51 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: modify WIN32OLE class document and
- add comment for constants of WIN32OLE.
-
-Mon Jul 14 16:38:45 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (struct rb_iseq_struct): reduce to 288 bytes
- on x86-64 (from 296 bytes)
-
-Mon Jul 14 16:07:25 2014 Eric Wong <e@80x24.org>
-
- * iseq.h (struct iseq_catch_table_entry): shrink to 32 bytes
- on x86-64 (from 48 bytes)
-
-Mon Jul 14 16:04:41 2014 Eric Wong <e@80x24.org>
-
- * iseq.h (struct iseq_catch_table): new flexible array struct
- (iseq_catch_table_bytes): allocated size function
- * vm_core.h (struct rb_iseq_struct): update catch_table member
- This reduces the struct from 304 to 296 bytes on x86-64.
- * compile.c (iseq_set_exception_table): update for struct changes
- * iseq.c (iseq_free): ditto
- * iseq.c (iseq_memsize): ditto
- * iseq.c (rb_iseq_disasm): ditto
- * iseq.c (iseq_data_to_ary): ditto
- * iseq.c (rb_iseq_build_for_ruby2cext): ditto (untested)
- * vm.c (vm_exec): ditto
- * vm_core.h (struct rb_iseq_struct): ditto
- * vm_insnhelper.c (vm_throw): ditto
-
-Sun Jul 13 17:49:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/openssl/ossl_cipher.c: Fix call to ciphers class method and
- spell out `encryption` by @vipulnsward [fix GH-664]
-
-Sun Jul 13 17:31:51 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/gdbm/gdbm.c: fix wrong arguments in GetDBM2 macro.
- * ext/sdbm/init.c: ditto.
-
-Sun Jul 13 17:25:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/dbm/dbm.c: fix wrong arguments in GetDBM2 macro by @v2e4lisp.
- [fix GH-655]
-
-Sun Jul 13 16:44:56 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (struct rb_call_info_struct): improve packing
- This reduces the struct from 112 to 104 bytes on x86-64.
-
-Sun Jul 13 15:53:25 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (struct rb_iseq_struct): stack_max is uint32_t
- This reduces the struct from 312 to 304 bytes on x86-64.
-
-Sun Jul 13 10:56:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_broken_backtrace): exit with failure
- normally, no needs to abort. [ruby-core:63678] [Bug #10008]
-
-Sat Jul 12 15:10:22 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (fole_record_method_missing): correct
- fields Hash key.
-
-Sat Jul 12 04:17:40 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/net/smtp.rb (Net::SMTP#data): enable buffering while
- 'data' send for optimizing Net::SMTP#send_message.
- [ruby-dev:48329] [misc #9981]
- patch by Masahiro Tomita.
-
-Sat Jul 12 01:13:45 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * test/ruby/envutil.rb (assert_no_memory_leak): On Solaris 9 or later,
- if possible, execute child ruby with environment variables
- LD_PRELOAD=libumem.so UMEM_OPTIONS="backend=mmap". With these
- variables, freed memory is immediately returned to the OS.
- [Bug #10020] [ruby-dev:48391]
-
-Fri Jul 11 20:49:10 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: add WIN32OLE_RECORD class to support
- VT_RECORD OLE variables.
-
-Fri Jul 11 17:15:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/abbrev.rb: remove executable.
-
-Fri Jul 11 16:45:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/fileutils.rb: handle ENOENT error with symlink targeted to
- non-exists file. [ruby-dev:45933] [Bug #6716]
-
-Fri Jul 11 15:59:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * array.c: Clarify documentation for Array#insert.
- [ruby-core:62934] [Bug #9901]
-
-Fri Jul 11 15:39:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * io.c: Improve Documentation by @dapplebeforedawn.
- [fix GH-658] [ruby-core:63579] [Bug #10012]
-
-Fri Jul 11 14:19:14 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Fix sign for cross_product [#9499]
-
-Fri Jul 11 11:11:50 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/prepare_so_k_nucleotide.rb: use require_relative.
-
- * benchmark/prepare_so_reverse_complement.rb: ditto.
-
-Fri Jul 11 10:09:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * pack.c (encodes): fix buffer overrun by tail_lf. Thanks to
- Mamoru Tasaka and Tomas Hoger. [ruby-core:63604] [Bug #10019]
-
-Thu Jul 10 23:51:36 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * hash.c (ruby_setenv): Fix TestEnv#test_aset failure on Solaris 9.
- When name contains '=', ruby_setenv raises Errno::EINVAL.
- That is the same behavior as Solaris 10.
- NULL check for malloc return value is also added.
-
-Thu Jul 10 15:02:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_keyword_arg): adjust VM stack
- pointer to get rid of overwriting splat arguments by arguments
- for `to_hash` conversion. [ruby-core:63593] [Bug #10016]
-
-Thu Jul 10 01:09:57 2014 Koichi Sasada <ko1@atdot.net>
-
- * symbol.c: remove rb_gc_mark_symbols().
-
- fstrings referred by static symbols and pinned dynamic symbols
- are registered by rb_gc_register_mark_object().
-
- fstrings referred by dynamic symbols (not pinned symbols)
- are referred from global_symbols.dsymbol_fstr_hash (Hash object).
-
- Note that fstrings referred from dynamic symbols must live logger
- than symbol objects themselves because rb_gc_free_dsymbol() uses
- fstrings to remove from symbol tables.
- This is why we can not mark fstrings from dynamic symbols.
-
- This technique reduces root objects for GC marking.
-
- * gc.c (gc_mark_roots): ditto.
-
- * internal.h: ditto.
-
-Thu Jul 10 00:24:18 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * common.mk (DTRACE_DEPENDENT_OBJS): fix build failure on Solaris
- introduced in r46768. Object files containing dtrace probes should
- be listed in DTRACE_DEPENDENT_OBJS.
-
-Wed Jul 9 17:07:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * symbol.c, symbol.h: Symbol class implementation and internals,
- split from parse.y.
-
-Wed Jul 9 14:45:39 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y: change Symbol <-> ID relationship to avoid
- exposing IDs from collectable symbols.
- [Bug #10014]
-
- Now, rb_check_id() returns 0 if corresponding symbol is
- pinned dynamic symbol.
-
- There is remaining intern_cstr_without_pindown(), it can return
- IDs from collectable symbols. We must be careful to use it
- (only used in parse.y). I think it should be removed if
- it does not have impact for performance.
-
- * parse.y:
- add:
- * STATIC_SYM2ID()
- * STATIC_ID2SYM()
- rename:
- * rb_pin_dynamic_symbol() -> dsymbol_pindown()
-
- * internal.h:
- remove:
- * rb_check_id_without_pindown()
- * rb_sym2id_without_pindown()
- add:
- * rb_check_symbol()
- * rb_check_symbol_cstr()
-
- * load.c: use rb_check_id() or rb_check_id_cstr().
-
- * object.c: ditto.
-
- * struct.c: ditto.
-
- * thread.c: ditto.
-
- * vm_method.c: ditto.
-
- * string.c (sym_find): use only rb_check_symbol().
-
- * sprintf.c (rb_str_format): use rb_check_symbol_cstr().
-
-Wed Jul 9 12:21:55 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y (symbols_i): delete garbage symbols for Symbol.all_symbols.
-
-Wed Jul 9 05:49:08 2014 Eric Wong <e@80x24.org>
-
- * thread_pthread.h (struct rb_global_vm_lock_struct):
- do not expose pthread type for lock
-
-Wed Jul 9 05:41:40 2014 Eric Wong <e@80x24.org>
-
- * thread_pthread.h: remove unneeded semaphore.h include
-
-Wed Jul 9 00:12:28 2014 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ruby-lex.rb: fix counting indent in identify_string_dvar.
-
-Tue Jul 8 16:58:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/memory_status.rb (Memory::PSCMD): use ps command which
- outputs expected result. [ruby-dev:48370] [Bug #10010]
-
-Tue Jul 8 14:45:17 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y (dsymbol_alloc): set global_symbols.minor_marked to 0.
-
- * parse.y (dsymbol_check): set RSYMBOL(sym)->fstr to 0
- because we should not touch fstr after that.
-
- * parse.y (rb_gc_free_dsymbol): skip deleting str and sym
- from tables if fstr == 0.
-
-Mon Jul 7 14:31:52 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y: remove global_symbols::pinned_dsym
- (and ::pinned_dsym_minor_marked).
-
- Mark pinned dsymbols by rb_gc_register_mark_object() because
- they are immortal.
-
- * parse.y (rb_gc_free_dsymbol): rename parameter name `ptr' to `sym'.
-
-Mon Jul 7 12:45:51 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: revert miss-commit.
-
-Mon Jul 7 12:40:59 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y: need to use updated (re-created) symbols.
-
-Mon Jul 7 11:02:55 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/mkconfig.rb: remove not to require rbconfig/obsolete.rb.
-
- * lib/rbconfig/obsolete.rb: removed.
-
-Mon Jul 7 10:52:03 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y: do not use rb_gc_resurrect(), but create a new dynamic
- symbol for garbage dynamic symbol.
-
- * common.mk: use gc.h by parse.y.
-
-Mon Jul 7 02:18:42 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (fstr_update_callback): do not use rb_gc_resurrect()
- any more.
-
- Make new frozen string and replace with garbage frozen string.
-
- * common.mk: use gc.h from string.c.
-
-Mon Jul 7 00:36:13 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename is_dying_object() to is_garbage_object().
-
- * gc.h: rb_objspace_garbage_object_p() as an exported function.
-
-Sun Jul 6 21:30:35 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (is_dying_object): fix missed condition.
-
- * gc.c (is_live_object): move frequent path first.
-
-Sun Jul 6 21:00:11 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename is_dead_object() to is_dying_object().
- This function is not opposite against is_live_object()
- because is_dying_object() does *not* check object type.
-
- * gc.c (is_dying_object): change condition.
-
- * gc.c (is_live_object): use T_NONE instead of 0.
-
- * gc.c (rb_objspace_dying_object_p): added.
-
-Sun Jul 6 13:37:27 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_register_mark_object): change data structure.
- From single array, to array of arrays. Each array only has 1024
- entries.
-
- * vm.c (Init_vm_objects): change default capa from 1 to 128.
-
-Sat Jul 5 05:05:53 2014 Vipul A M <vipulnsward@gmail.com>
-
- * lib/irb/locale.rb (IRB::Locale#modifier): fix wrong attr_reader
- `modifieer` => `modifier` from irb locale. [fix GH-656]
-
-Fri Jul 4 20:45:26 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y: rename symbols::sym_id to symbols::str_id.
- This table is not {Symbol => ID} table, but
- {String => ID} table.
-
- * parse.y (lookup_sym_id): also rename lookup_sym_id() to
- lookup_str_id() because key is not Symbol, but String.
-
-Fri Jul 4 18:42:04 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y (must_be_dynamic_symbol): fix missed-condition.
-
-Fri Jul 4 18:38:11 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y (rb_pin_dynamic_symbol): should be `static' function.
-
-Fri Jul 4 18:03:35 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y (must_be_dynamic_symbol): refactoring.
- * add `inline'.
- * use UNLIKELY().
- * check only DYNAMIC_SYM_P(), otherwise it is a bug.
- * lookup_id_str() is not needed in second condition.
-
-Fri Jul 4 11:53:56 2014 Koichi Sasada <ko1@atdot.net>
-
- * parse.y: remove unused code
- surrounded by `#if ENABLE_SELECTOR_NAMESPACE'
-
-Fri Jul 4 10:08:24 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/rubygems/test_gem_package.rb: avoid tempfile leaks using Tempfile#close!
- * test/rubygems/test_gem_request_set.rb: ditto.
- * test/rubygems/test_gem_request_set_gem_dependency_api.rb: ditto.
-
-Fri Jul 4 04:42:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/response.rb (Net::Inflater#inflate_adapter):
- prevent automatic encoding conversion.
-
-Fri Jul 4 04:39:52 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/response.rb (Net::HTTPResponse.each_response_header):
- raise first exception even if inflate_body_io.finish raises error.
- when begin block raises error, finish usually raises error too.
-
-Fri Jul 4 02:56:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (URI::Generic#query=): remove validation, just
- escape. [Feature #2542]
-
- * lib/uri/generic.rb (URI::Generic#fragment=): ditto.
-
- * lib/uri/generic.rb (URI::Generic#check_query): removed.
-
- * lib/uri/generic.rb (URI::Generic#set_query): ditto.
-
- * lib/uri/generic.rb (URI::Generic#check_fragment): ditto.
-
- * lib/uri/generic.rb (URI::Generic#set_fragment): ditto.
-
-Thu Jul 3 12:40:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (--with-static-linked-ext): fix for extensions to
- be linked statically.
-
- * Makefile.in, common.mk: use ENCSTATIC for enc directory.
-
- * ext/extmk.rb: supply dependencies of statically linked extension
- libraries.
-
-Wed Jul 2 15:45:49 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_heap_lazy_sweep): simplify logic.
-
- * gc.c (gc_page_sweep): return TRUE if empty slots are available.
-
-Wed Jul 2 09:48:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * logger.rb: removed unmaintained code.
- [Feature #9860][ruby-core:62724]
- * test/logger/test_application.rb: ditto.
-
-Wed Jul 2 03:20:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
-
- * node.c (dump_node): handle nd_value == (NODE *)-1 to mean this
- keyword argument is required
-
-Wed Jul 2 02:57:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (rb_vm_env_local_variables): returns array of local
- variable name symbols in the environment by envval.
-
- * proc.c (bind_local_variables): use rb_vm_env_local_variables.
-
-Wed Jul 2 02:23:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (bind_receiver): new method to return the bound receiver
- of the binding object. [ruby-dev:47613] [Feature #8779]
-
-Wed Jul 2 02:14:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (bind_local_variables): update env from envval for each
- iterations. [ruby-dev:48351] [Bug #10001]
-
-Tue Jul 1 23:46:34 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * NEWS: [DOC] mention about Binding#local_variables, introduced at
- r44392 (see [Feature #8773]).
-
-Tue Jul 1 23:30:51 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * numeric.c (num_step_scan_args): table argument of rb_get_kwargs() is
- array of IDs, not Symbols. [ruby-dev:48353] [Bug #9811]
-
-Tue Jul 1 16:18:22 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/digest/lib/digest/hmac.rb, test/digest/test_digest_hmac.rb:
- Digest::HMAC is finally removed as previously noticed.
- [fix GH-648]
-
-Tue Jul 1 11:13:43 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/date/lib/date/format.rb: removed empty file by @vipulnsward.
- * ext/date/lib/date.rb: removed needless require.
- [fix GH-647]
-
-Mon Jun 30 16:42:52 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat_internal): return size_t value instead of VALUE
- and remove `out' parameter.
-
- * gc.c: add braces for `if' statements.
-
- * gc.c (gc_stat_internal): fix comment.
-
-Mon Jun 30 15:07:34 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: support `USE_RGENGC == 0'.
-
- * test/ruby/test_gc.rb: ditto.
-
-Mon Jun 30 11:36:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * file.c: [DOC] document File.join returns a string.
- Contributed by @dapplebeforedawn. [fix GH-646]
-
-Sat Jun 28 22:57:01 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/pathname/pathname.c (path_birthtime): Windows support.
- see [Feature #9857] [ruby-dev:48339]
-
-Sat Jun 28 22:44:16 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/pathname/pathname.c (path_birthtime): New method,
- Pathname#birthtime.
- Proposed by Kazuhiro NISHIYAMA. [ruby-dev:48232] [Feature #9857]
-
-Sat Jun 28 20:29:03 2014 Simon Baird <simon.baird@gmail.com>
-
- * ext/bigdecimal/lib/bigdecimal/math.rb (BigMath#PI): change error
- message about zero or negative precision for clarity and
- consistency with other methods. [GH-644]
-
-Sat Jun 28 15:32:57 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/utils.rb (create_listeners): Close socket objects.
-
-Sat Jun 28 13:58:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (setup_exception): should not overwrite SystemStackError
- backtrace if set already. [ruby-core:63377] [Feature #6216]
-
- * eval.c (setup_exception): get rid of method calls before raising
- stack overflow, not to cause stack overflow again.
-
- * defs/id.def: add IDs for backtraces.
-
-Sat Jun 28 04:08:22 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/mailto.rb: update to latest specs, RFC 6068 and HTML5.
-
- * lib/uri/mailto.rb (HEADER_PATTERN): removed.
-
- * lib/uri/mailto.rb (HEADER_REGEXP): use RFC 6068 hfields.
-
- * lib/uri/mailto.rb (EMAIL_REGEXP): use HTML5 email regexp.
-
- * lib/uri/mailto.rb (URI::MailTo.build): support multiple to addresses.
-
- * lib/uri/mailto.rb (URI::MailTo#initialize): Support multiple to
- addresses. Don't check with regexp, only split.
-
- * lib/uri/mailto.rb (URI::MailTo#check_to): verify by matching
- URI path-rootless and HTML5 email regexp with unescaped one.
-
- * lib/uri/mailto.rb (URI::MailTo#check_headers): verify only by
- HEADER_REGEXP.
-
- * lib/uri/mailto.rb (URI::MailTo#set_headers): don't check by
- HEADER_REGEXP, only split it.
-
-Sat Jun 28 00:35:10 2014 Lauri Tirkkonen <lotheac@iki.fi>
-
- * tool/mkconfig.rb: fix empty RbConfig::CONFIG["prefix"] when
- configured --with-rubyarchprefix, remove prefix from rubyarchdir
- after expansion for the case it does not start with '$(prefix)'.
- [fix GH-643]
-
-Fri Jun 27 15:20:12 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rubygems/test_case.rb: rescue Gem::LoadError in Gem::TestCase.
- because it's effected by removing minitest from stdlib.
-
-Fri Jun 27 12:29:37 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/rubygems/specification.rb: fixed broken condition caused
- by removing YAML::ENGINE.
- * lib/rubygems/package/old.rb: ditto.
-
-Fri Jun 27 05:33:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (env_shift): fix memory leak on Windows, free environment
- strings block always. [ruby-dev:48332] [Bug #9983]
-
-Fri Jun 27 03:41:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (GETASTER): should not use the numbered argument to be
- formatted, raise ArgumentError instead.
- [ruby-dev:48330] [Bug #9982]
-
-Thu Jun 26 18:18:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/with_different_ofs.rb: move into test library directory.
- * test/csv/base.rb: fix require path for with_different_ofs.rb.
- * test/digest/test_digest_extend.rb: ditto.
-
-Thu Jun 26 18:06:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/profile_test_all.rb: move into test library directory.
- * test/runner.rb: fix require path for profile_test_all.rb.
-
-Thu Jun 26 17:57:57 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/webrick/httpproxy.rb: remove useless assigned variables.
- * lib/webrick/httpservlet/cgihandler.rb: ditto.
- * lib/webrick/httpservlet/erbhandler.rb: ditto.
- * lib/webrick/server.rb: ditto.
-
-Thu Jun 26 08:28:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (env_select): fix memory leak and crash on Windows, make
- keys array first instead of iterating on environ directly.
- [ruby-dev:48325] [Bug #9978]
-
-Thu Jun 26 02:45:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_error.c (error_print): put a newline after an anonymous
- exception class name.
-
-Wed Jun 25 22:31:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (ruby_setenv): fix memory leak on Windows, free
- environment strings block after check for the size.
- [ruby-dev:48323] [Bug #9977]
-
-Wed Jun 25 15:44:12 2014 Eric Wong <e@80x24.org>
-
- * ccan/container_of/container_of.h (container_off_var):
- avoid warning with -Wcast-qual
- [ccan ba5ad771af4aa9e085498de6c3c665c52694460f (Rusty Russell)]
-
-Wed Jun 25 10:19:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (env_aset, env_has_key, env_assoc, env_has_value),
- (env_rassoc, env_key): prohibit tainted strings if $SAFE is
- non-zero. [Bug #9976]
-
-Tue Jun 24 14:46:17 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/gserver.rb: remove redundant use of to_s in interpolation.
- * lib/logger.rb: ditto.
- * lib/optparse.rb: ditto.
- * lib/rbconfig/obsolete.rb: ditto.
- * lib/resolv.rb: ditto.
- * lib/webrick/httpresponse.rb: ditto.
-
-Tue Jun 24 10:50:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (env_path_str_new): make PATH environment variable
- string, to be frozen.
-
-Tue Jun 24 10:40:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/make-snapshot: download bundle gems when package making.
- [Feature #9852][ruby-core:62676]
- * gems/bundled_gems: listed bundled gems for Ruby 2.2.
-
-Tue Jun 24 10:20:35 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/downloader.rb: make Downloader class to general download utility.
- It can be used without config.guess and config.sub.
- * tool/get-config_files: ditto.
- * tool/make-snapshot: ditto.
-
-Tue Jun 24 06:17:52 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * eval.c (setup_exception): "mesg == sysstack_error" and
- sysstack_error_p(mesg) are duplicated.
- r46502 seems to want to use latter.
-
-Tue Jun 24 06:15:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/tk/tcltklib.c: fix format specifiers for VALUE and
- Tcl_Interp*. [ruby-core:63283] [Bug #9972]
-
-Tue Jun 24 05:40:41 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * nacl/nacl-config.rb: Use File.exist? instead of executable?
- for irt_core. Recent nacl_sdk has non-executable irt_core.
- Patch by Shinichiro Hamaji.
- [Fixes GH-529] https://github.com/ruby/ruby/pull/529
-
-Mon Jun 23 18:44:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/config_files.rb: rename class ConfigFiles to Downloader.
- * tool/get-config_files: ditto.
- * tool/make-snapshot: ditto.
-
-Mon Jun 23 18:03:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/rbinstall.rb: support to install bundle gems.
-
-Mon Jun 23 17:33:11 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/net/imap.rb (Net::IMAP#fetch): [DOC] Describe how a range in
- +set+ is interpreted, and mention -1 which can be used for '*'.
-
-Mon Jun 23 16:22:50 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * include/ruby/ruby.h (struct RHash): no longer. [Feature #9889]
-
- * include/ruby/ruby.h (RHASH): ditto.
-
- * include/ruby/ruby.h (RHASH_ITER_LEV): deprecated. Will be deleted later.
-
- * include/ruby/ruby.h (RHASH_IFNONE): ditto.
-
- * internal.h (struct RHash): moved here.
-
- * internal.h (RHASH): ditto.
-
- * hash.c (rb_hash_iter_lev): do not use this.
-
- * hash.c (rb_hash_ifnone): ditto.
-
-Mon Jun 23 13:30:11 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
-
- * include/ruby/ruby.h (RCOMPLEX): ditto.
-
- * include/ruby/ruby.h (RCOMPLEX_SET_REAL): deprecated. Will be deleted later.
-
- * include/ruby/ruby.h (RCOMPLEX_SET_IMAG): ditto.
-
- * internal.h (struct RFloat): moved here.
-
- * internal.h (RCOMPLEX): ditto.
-
- * complex.c (rb_complex_set_real): do not use this.
-
- * complex.c (rb_complex_set_imag): ditto.
-
-Mon Jun 23 13:10:15 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * include/ruby/ruby.h (struct RFloat): no longer. [Feature #9863]
-
- * include/ruby/ruby.h (RFLOAT): ditto.
-
- * internal.h (struct RFloat): moved here.
-
- * internal.h (RFLOAT): ditto.
-
-Mon Jun 23 12:01:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb (check_port): allow strings for port= as
- described in rdoc.
-
- * lib/uri/rfc3986_parser.rb (regexp): implementation detail of above.
-
-Mon Jun 23 11:35:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (setup_exception): set backtrace in system stack error
- other than the pre-allocated sysstack_error. [Feature #6216]
-
- * proc.c (Init_Proc): freeze the pre-allocated sysstack_error.
-
- * vm_insnhelper.c (vm_stackoverflow): raise new instance for each
- times without calling any methods to keep the backtrace with no
- further stack overflow.
-
- * object.c (rb_obj_copy_ivar): extract function to copy instance
- variables only for T_OBJECT from init_copy.
-
-Mon Jun 23 11:11:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (check_stack_overflow): drop the last tag too close to
- the fault page, to get rid of stack overflow deadlock.
- [Bug #9971]
-
-Sun Jun 22 09:11:15 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/generic.rb: remove registry.
- 'registry' is not used and RFC3986 doesn't use it.
-
-Sun Jun 22 09:10:09 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/rfc3986_parser.rb: raise exception when given a URI string
- has non ASCII in order to keep the regexp compiled for US-ASCII.
-
-Sun Jun 22 09:05:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/common.rb (URI::REGEXP): move to lib/uri/rfc2396_parser.rb.
-
- * lib/uri/common.rb (URI::Parser): ditto.
-
- * lib/uri/common.rb (URI.split): use RFC3986_Parser. [Feature #2542]
-
- * lib/uri/common.rb (URI.parse): ditto.
-
- * lib/uri/common.rb (URI.join): ditto.
-
- * lib/uri/common.rb (URI.extract): deprecated.
-
- * lib/uri/common.rb (URI.regexp): ditto.
-
- * lib/uri/rfc2396_parser.rb: added.
-
- * lib/uri/rfc3986_parser.rb: added.
-
-Sun Jun 22 09:04:50 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/mailto.rb (initialize): as previous commit, fix arg_check
-
-Sun Jun 22 09:01:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/ftp.rb (initialize): argument checking flag is arg_check,
- but arg[-1] is fragment.
-
- * lib/uri/ftp.rb (initialize): explicitly specify arguments.
-
-Sat Jun 21 12:50:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/fiddle/extconf.rb: supply 0 to fill RUBY_LIBFFI_MODVERSION
- with 3-digit. libffi 3.1 returns just 2-digit.
- [ruby-core:62920] [Bug #9897]
-
-Sat Jun 21 07:06:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (enc_find): [DOC] never accepted a symbol.
- [ruby-dev:48308] [Bug #9966]
-
-Fri Jun 20 17:15:43 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/lib/tracepointchecker.rb: add to check TracePoint healthiness.
-
- * test/runner.rb: use it.
-
-Fri Jun 20 07:26:44 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_settracefunc.rb: rewrite tests with
- assert_consistent_call_return().
-
- assert_consistent_call_return() is also modified to check
- consistency.
-
-Fri Jun 20 07:07:28 2014 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (rb_iseq_compile_node): put start label of block after
- trace (b_call).
- [Bug #9964]
-
- * test/ruby/test_settracefunc.rb: add a test.
-
- added assert_consistent_call_return() method check call/return
- consistency.
-
-Fri Jun 20 05:26:27 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_eval.c (rb_catch_protect): fix same problem of [Bug #9961].
-
- * vm_eval.c (rb_iterate): ditto.
-
-Thu Jun 19 21:41:30 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfp
- with invoking RUBY_EVENT_C_RETURN.
- [Bug #9961]
-
- * vm_core.h: ditto.
-
- * eval.c (rb_protect): use it.
-
- * eval.c (rb_rescue2): ditto.
-
- * vm_eval.c (rb_iterate): ditto.
-
- * test/ruby/test_settracefunc.rb: add a test.
-
- * vm_core.h (rb_vm_rewind_cfp): add the prototype declaration.
-
-Thu Jun 19 19:47:21 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (invoke_block_from_c): move call/return event timing for
- bmethod. It can invoke inconsistent call event if this call raises
- argument error.
- [Bug #9959]
-
- * vm_insnhelper.c (vm_call_bmethod_body): ditto.
-
- * test/ruby/test_settracefunc.rb: add a test.
-
-Thu Jun 19 18:14:47 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: add VM_FRAME_MAGIC_RESCUE to recognize normal block or
- rescue clause.
-
- * vm.c (vm_exec): use VM_FRAME_MAGIC_RESCUE on at rescue/ensure.
-
- * test/ruby/test_settracefunc.rb: should not invoke b_return at rescue
- clause.
- [Bug #9957]
-
- * vm_dump.c (control_frame_dump): check VM_FRAME_MAGIC_RESCUE.
-
- * vm_dump.c (vm_stack_dump_each): ditto.
-
-Thu Jun 19 13:39:11 2014 Arne Brasseur <arne@arnebrasseur.net>
-
- * proc.c (rb_method_curry): Implement Method#curry, which delegates
- to to_proc.curry. [ruby-core:62212] [Feature #9783]
-
-Tue Jun 17 16:41:49 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb (gets, readline): read lines without LF properly.
- [ruby-core:63205] [Bug #9949]
-
- * test/net/ftp/test_buffered_socket.rb: related test.
-
-Tue Jun 17 12:35:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (extract_raise_opts): pass unknown options to the
- exception, so that exception class can receive a hash argument.
- [ruby-core:63203] [Feature #8257]
-
-Tue Jun 17 12:24:57 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (obj_memsize_of): memsize_of(T_ZOMBIE) returns 0, not a rb_bug.
- ObjectSpace.count_objects_size() uses memsize_of(T_ZOMBIE).
-
- This bug introduced at r46348.
-
-Mon Jun 16 19:00:11 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/runner.rb: failure message should be passed as an argument.
-
-Mon Jun 16 18:42:57 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/runner.rb: capture TracePoint stat before setup and compare
- it after teardown.
-
-Mon Jun 16 14:33:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (open): use UTF-8 version function to support
- non-ascii path properly. [ruby-core:63185] [Bug #9946]
-
-Sat Jun 14 10:54:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rcombinate0): remove recursion, by looping with indexes
- stored in `p`.
-
- * array.c (rpermute0): remove recursion, by looping with indexes
- stored in `p`.
-
- * array.c (permute0): remove recursion, by looping with indexes
- stored in `p`. [ruby-core:63103] [Bug #9932]
-
-Sat Jun 14 10:52:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_resize): update capa only when buffer get
- reallocated.
- http://d.hatena.ne.jp/nagachika/20140613/ruby_trunk_changes_46413_46420#r46413
-
-Sat Jun 14 08:28:59 2014 Zachary Scott <e@zzak.io>
-
- * man/rake.1: [DOC] Update links for Rake, patch by @hsbt [Bug #9904]
- [Fixes GH-628] https://github.com/ruby/ruby/pull/628
-
-Fri Jun 13 17:58:58 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: add new method TracePoint.stat to debug
- TracePoint mechanism.
-
- Ruby users should not use this method. So I don't note this method
- in the NEWS file.
-
- * test/runner.rb: detect zombie active TracePoints with
- TracePoint.stat.
-
-Fri Jun 13 17:46:31 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: clear and restore recursive checking thread local data
- to avoid unexpected throw from TracePoint.
- [Bug #9940]
-
- * test/ruby/test_settracefunc.rb: add a test.
-
- * thread.c: added
- * rb_threadptr_reset_recursive_data(rb_thread_t *th);
- * rb_threadptr_restore_recursive_data(rb_thread_t *th, VALUE old);
-
- * vm_core.h: ditto.
-
-Fri Jun 13 17:33:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_combination): iterate on a shared copy, and use
- array of indexes instead of array of chosen objects.
- [ruby-core:63149] [Bug #9939]
-
- * array.c (yield_indexed_values): extract from permute0(),
- rpermute0(), and rcombinate0().
-
-Fri Jun 13 13:42:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_permutation): `p` is the array of size `r`, as
- commented at permute0(). since `n >= r` here, buffer overflow
- never happened, just reduce unnecessary allocation though.
-
-Thu Jun 12 20:32:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_resize): should consider the capacity instead
- of the old length, as pointed out by nagachika.
-
-Thu Jun 12 18:31:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/net/http/responses.rb: added Net::HTTPPermanentRedirect(308)
- Contributed by @yorkie [fix GH-638]
-
-Thu Jun 12 13:27:38 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_freeze): shrink the buffer before freezing, as
- pointed out by Eric Wong at [ruby-core:63119].
-
-Thu Jun 12 13:09:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (expand_path): shrink expanded path which no longer needs
- rooms to append. [ruby-core:63114] [Bug #9934]
-
-Wed Jun 11 17:37:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_scalar_pthread_t): pthread_t is not required
- to be a scalar type.
-
- * thread.c (fill_thread_id_string, thread_id_str): dump pthread_t
- in hexadecimal form if it is not a scalar type, assume it can be
- represented in a pointer form otherwise. based on the patch by
- Rei Odaira at [ruby-core:62867]. [ruby-core:62857] [Bug #9884]
-
- * thread_pthread.c (Init_native_thread, thread_start_func_1),
- (native_thread_create): set thread_id_str if needed.
-
- * vm_core.h (rb_thread_t): add thread_id_string if needed.
-
-Wed Jun 11 01:53:22 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: invoke GC before memory allocation (xmalloc/xrealloc)
- when GC.stress = true.
- [Bug #9859]
-
- * test/ruby/test_gc.rb: add a test.
-
-Tue Jun 10 13:20:14 2014 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/cgi/core.rb: Provide a mechanism to specify the
- max_multipart_length of multipart data.
- [Feature #8370] patch by Leif Eriksen <leif.eriksen.au@gmail.com>
-
-Tue Jun 10 10:57:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/csv.rb (CSV#<<): honor explicitly given encoding. based on
- the patch by DAISUKE TANIWAKI <daisuketaniwaki AT gmail.com> at
- [ruby-core:62113]. [Bug #9766]
-
-Mon Jun 9 20:40:48 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change full GC timing to keep lower memory usage.
-
- Extend heap only at
- (1) after major GC
- or
- (2) after several (two times, at current) minor GC
-
- Details in https://bugs.ruby-lang.org/issues/9607#note-9
- [Bug #9607]
-
-Mon Jun 9 16:01:41 2014 Masahiro Ide <imasahiro9@gmail.com>
-
- * gc.c (gcdebug_sentinel): fix typo, "sentinel" not "sential".
- [fix GH-634]
-
-Mon Jun 9 00:04:25 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (posix_fadvise): disable use of posix_fadvise
- itself on 32-bit AIX. [ruby-core:62968] [Bug #9914]
-
-Sun Jun 8 23:28:00 2014 <kanemoto@ruby-lang.org>
-
- * io.c (rb_io_advise): AIX currently does not support a 32-bit call to
- posix_fadvise() if _LARGE_FILES is defined. Patch by Rei Odaira.
- [ruby-core:62968] [Bug #9914]
-
-Sun Jun 8 04:52:40 2014 Jun Hiroe <Jun.Hiroe@gmail.com>
-
- * string.c (rb_str_slice_bang): [DOC] update return value against
- a fixnum, which has changed because of M17N. [fix GH-631]
-
-Sat Jun 7 22:13:42 2014 Benoit Daloze <eregontp@gmail.com>
-
- * numeric.c (do_coerce): Add a warning when an exception is raised
- or an invalid value is returned in #coerce called by
- numeric comparison operators and the exception
- thrown by the caller has no information on the failure.
- In the next release such exception should not be rescued or
- should be the cause of the caller exception. nil is accepted
- as the "no possible coercion" return value. See #7688.
-
- * test/ruby/test_numeric.rb: Add corresponding test.
-
-Sat Jun 7 18:15:33 2014 Benoit Daloze <eregontp@gmail.com>
-
- * numeric.c (bit_coerce): remove constant parameter `err'
- (always TRUE) of bit_coerce().
-
-Sat Jun 7 16:01:57 2014 Yutaka Kanemoto <kanemoto@ruby-lang.org>
-
- * cont.c (rb_fiber_struct): keep context.uc_stack.ss_sp and context.uc_stack.ss_size
- for later use. Patch by Rei Odaira. [ruby-core:62945] [Bug #9905]
-
-Sat Jun 7 12:51:51 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (read_all): truncate the buffer before appending read data,
- instead of truncating before reading.
- [ruby-core:55951] [Bug #8625]
-
-Sat Jun 7 12:28:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/digest/digest.c (rb_digest_instance_equal): no need to call
- `to_s` twice. [Bug #9913]
-
-Sat Jun 7 11:35:01 2014 Tanaka Akira <akr@fsij.org>
-
- * object.c (rb_mod_initialize_clone): Override Kernel#initialize_clone
- to avoid an exception on Class.new.freeze.clone.to_s.
- Reported by Andrew Grimm. [ruby-core:41858] [Bug #5828]
-
-Sat Jun 7 06:03:11 2014 Benoit Daloze <eregontp@gmail.com>
-
- * ext/digest/digest.c (rb_digest_instance_equal):
- fix #== for non-string arguments. [ruby-core:62967] [Bug #9913]
-
- * test/digest/test_digest.rb: add test for above.
-
-Fri Jun 6 22:19:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (private_recv_p): check by node type, instead of a
- magic number.
-
- * node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove
-
-Fri Jun 6 17:07:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each), parse.y (new_attr_op_assign_gen):
- allow op assign to a private attribute.
- [ruby-core:62949] [Bug #9907]
-
-Fri Jun 6 13:39:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_setstrbuf, io_read): should not shorten the given buffer until
- read succeeds. [ruby-core:55951] [Bug #8625]
-
-Fri Jun 6 07:41:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: dump empty symbols with a
- tag so that they can be parsed on input. [Bug #9873] [ruby-core:62825]
- * test/psych/test_symbol.rb: test for change
-
-Thu Jun 5 16:08:39 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_page_sweep): refactoring.
-
- * gc.c (gc_page_sweep): should not set, but add final_slots into
- sweep_page->final_slots.
-
-Thu Jun 5 14:36:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (jemalloc): check for the header regardless drop-in
- libjemalloc is found, for `malloc_conf` declaration.
-
- * version.c (ruby_show_version): show `malloc_conf` if set.
- [Feature #9113]
-
- * configure.in (with-jemalloc): also check for header, for ABIs
- which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF
- platforms. [ruby-core:62939] [Feature #9113]
-
- * include/ruby/missing.h: include alternative malloc header to
- replace memory management functions.
-
- * dln.c, io.c, parse.y, st.c: undef malloc family before
- re-definition to suppress warnings.
-
-Thu Jun 5 12:52:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * man/ruby.1: remove rubyforge entry.
-
-Thu Jun 5 12:45:32 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * misc/README: use github link instead of rubyforge.
-
-Thu Jun 5 10:03:29 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (obj_free): check also FL_PROMOTED bit by RVALUE_OLD_P().
-
-Thu Jun 5 03:45:28 2014 Eric Wong <e@80x24.org>
-
- * configure.in: add --with-jemalloc option
- [ruby-core:62912]
-
-Wed Jun 4 22:28:14 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: introduce RZombie to manage zombie objects.
- Rewrite finalizing logics with this type.
-
- * gc.c (gc_verify_internal_consistency): verify zombie (finalizing)
- objects count.
-
-Wed Jun 4 22:09:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * re.c (match_aref, rb_reg_regsub): consider encoding of captured
- names, encoding-incompatible should not match.
- [ruby-dev:48278] [Bug #9903]
-
-Wed Jun 4 21:23:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * re.c (match_aref): should not ignore name after NUL byte.
- [ruby-dev:48275] [Bug #9902]
-
-Wed Jun 4 04:08:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (core_hash_merge_kwd): should return the result hash, which
- may be converted from and differ from the given argument.
- [ruby-core:62921] [Bug #9898]
-
-Tue Jun 3 23:32:34 2014 Tanaka Akira <akr@fsij.org>
-
- * ruby.c (load_file_internal2): Extracted from load_file_internal.
- (load_file_internal): Invoke load_file_internal2 using rb_protect.
- Close an opened FD if load_file_internal2 raises an exception.
-
-Tue Jun 3 19:11:45 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_objspace_free): should not rest_sweep() here.
- Some data structures are already freed.
-
-Tue Jun 3 18:43:51 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb: allocate more objects to invoke GC by newobj.
- GC allows extending pages depends on heap_increment.
-
-Tue Jun 3 18:01:27 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_call_finalizer_at_exit): add
- gc_verify_internal_consistency() when RGENGC_CHECK_MODE >= 2.
-
-Tue Jun 3 17:54:21 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: change the counting method for young objects.
- clear counter at the beginning of every GC and
- count promoted (infant->young) objects.
-
- Some promotions (infant->young) are transition of promoting to old
- objects. We should not count such promotions.
-
- With this technique, we don't need to check young objects
- at obj_free().
-
-Tue Jun 3 16:38:19 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: add verifying counters code in gc_verify_internal_consistency().
- gc_verify_internal_consistency() counts all
- - live objects
- - young objects (if age2 promotion)
- - old objects
- in all pages and compares with objspace managing counters.
-
- * gc.c (gc_after_sweep): do gc_verify_internal_consistency()
- when RGENGC_CHECK_MODE >= 2.
-
-Tue Jun 3 13:14:04 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (body_type_1part): Gmail IMAP reports a body
- type as "MIXED" followed immediately by params
- [ruby-core:62864] [Bug #9885]
- Patch by @rayners (David Raynes). [Fixes GH-622]
- https://github.com/ruby/ruby/pull/622
-
-Tue Jun 3 13:18:24 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (objspace_live_slot): live slot count should not include final
- slot (contains T_ZOMBIE) count.
-
-Tue Jun 3 13:03:21 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (obj_free): fix spacing.
-
-Tue Jun 3 12:59:32 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (check_gen_consistency): fix error message.
-
-Tue Jun 3 12:40:23 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: count old/young objects more correctly.
-
- * gc.c (RVALUE_DEMOTE_FROM_OLD): decrement old object count.
-
- * gc.c (RVALUE_DEMOTE_FROM_YOUNG): decrement young object count.
-
- * gc.c (rb_gc_resurrect): increment old object count.
-
- * gc.c (gc_marks_body): should not add old object count.
- This code is completely my misunderstanding.
-
- * gc.c (rb_gc_force_recycle): decrement young or old object count
- correctly.
-
-Tue Jun 3 12:26:47 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/memory_status.rb: add $LOAD_PATH to load test/unit
- correctly for fiddle/import unavailable environments.
-
-Tue Jun 3 09:45:13 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/openssl/test_ssl.rb (OpenSSL::TestSSL#test_verify_result):
- shouldn't use same server for respective tests, because the 1st
- test sometimes kills the server main loop silently.
- [Bug #9881] [ruby-dev:48266]
-
-Tue Jun 3 01:34:59 2014 Zachary Scott <e@zzak.io>
-
- * README.EXT: [DOC] Add rb_call_super when subclassing from @robin850
- [Fixes GH-623] https://github.com/ruby/ruby/pull/623
-
-Mon Jun 2 17:14:49 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (ruby_vm_destruct): remove useless call of
- rb_gc_force_recycle().
-
- At this line, a VM object is already freed
- (is changed to T_NONE) by rb_gc_call_finalizer_at_exit().
-
-Mon Jun 2 15:50:24 2014 Koichi Sasada <ko1@atdot.net>
-
- * eval.c (rb_using_refinement): add write-barriers for
- cref->nd_refinements.
-
-Mon Jun 2 12:26:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * CONTRIBUTING.md: added contributing guide for github. [fix GH-625]
-
-Mon Jun 2 07:30:33 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/envutil.rb (default_warning): New method.
-
- * test/ruby/test_autoload.rb: Use EnvUtil.default_warning.
-
-Mon Jun 2 07:05:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/encoding.h: constify `rb_encoding` arguments.
-
- * include/ruby/oniguruma.h: constify `OnigEncoding` arguments.
-
-Sun Jun 1 12:05:10 2014 Tanaka Akira <akr@fsij.org>
-
- * test/drb: Wrap tests definitions by DRbTests module. This makes
- several tests (ACLEntryTest, TestBug4409, etc.) easier to understand
- that they are tests for DRb.
-
-Sun Jun 1 11:36:25 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/rinda/ring.rb (RingFinger#make_socket): Close the socket on
- exception.
-
-Sun Jun 1 06:55:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (intern_str): dynamic attrset ID is registered by
- `rb_id_attrset()` already, so no further registration is needed.
- [ruby-core:62861]
-
-Sun Jun 1 04:52:47 2014 Zachary Scott <e@zzak.io>
-
- * lib/English.rb: [DOC] $LOADED_FEATURES moved to load.c [Fixes GH-620]
- Patch submitted by @leafac in https://github.com/ruby/ruby/pull/620
- * doc/globals.rdoc: Added $LOADED_FEATURES to list
-
-Sat May 31 22:30:14 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/leakchecker.rb: Leak checker extracted from
- test/lib/minitest/unit.rb.
-
-Sat May 31 21:15:43 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * thread.c (rb_thread_atfork_internal): My compiler complains
- about this variable being used before initialized. I looked at
- the code and expanded the macro and turned out it was actually
- USED for pointer arithmetic, not dereferenced. So this was
- never a serious bug. But is annoying indeed to see warnings
- every time. I added `=0` and all went healthy.
-
- * configure.in: Also, I found that the problematic macro expansion
- only happens when we lack __typeof__ C extension, which shall
- not be the case of my compiler. I added AC_C_TYPEOF to kick ass.
-
-Sat May 31 16:32:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/ipaddr.rb: extracted inline tests into test dir.
- * test/test_ipaddr.rb: ditto.
-
-Sat May 31 16:29:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/digest/lib/digest/hmac.rb: extracted inline tests into test dir.
- * test/digest/test_digest_hmac.rb: ditto.
-
-Sat May 31 16:02:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_syslog.rb: remove executable.
-
-Sat May 31 08:58:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/unicode.c (init_case_fold_table): no longer need to
- initialize tables at runtime.
-
- * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
- lookup case unfolding table 3.
-
- * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
- lookup case unfolding table 2.
-
- * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
- lookup case unfolding table 1.
-
- * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
- lookup case folding table.
-
- * enc/unicode/case-folding.rb (print_table): merge non-locale and
- locale tables, and reduce initializing loops.
-
- * enc/unicode/case-folding.rb (CaseFolding): modularize, and add
- --output-file option.
-
- * enc/unicode/case-folding.rb: script to convert CaseFolding.txt,
- translated from CaseFolding.py.
-
-Sat May 31 08:31:41 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Check Tempfile leaks for each test method
- again.
-
-Sat May 31 03:50:50 2014 Zachary Scott <e@zzak.io>
-
- * lib/delegate.rb: [DOC] Document raise in Delegator class
- Patch by @lucasmazza. [Fixes GH-621]
- https://github.com/ruby/ruby/pull/621
-
-Fri May 30 21:23:26 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/server.rb: Use a pipe to detect server shutdown.
- shutdown() or close() for listening socket is not a reliable.
- Actually, both doesn't work (doesn't wake up select()) on
- DragonFly BSD 3.6.2.
-
- * test/webrick/utils.rb: :ShutdownSocketWithoutClose is not required
- now to immediate server shutdown detection.
- This fixes fd leaks.
-
- * test/net/http/utils.rb: Ditto.
-
-Fri May 30 20:58:37 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb (check_fd_leak): Sort the inspected
- objects list for a FD.
-
-Fri May 30 18:06:55 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb (check_fd_leak): Try GC to delete leaked
- FDs.
-
-Fri May 30 12:05:59 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/lib/test/unit/parallel.rb (_run_suite): orig_stdout may be nil
- though I don't know the reason.
-
-Fri May 30 11:33:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_substr): need to reset code range for shared
- string too, not only copied string.
- [ruby-core:62842] [Bug #9882]
-
-Fri May 30 10:22:21 2014 Mark Lorenz <mlorenz@covermymeds.com>
-
- * lib/erb.rb (result): [DOC] no longer accepts a Proc, as
- Kernel.eval does not. [fix GH-619]
-
-Fri May 30 07:25:46 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/-test-/dir: Dir#fileno implemented.
-
- * test/lib/minitest/unit.rb (find_fds): Don't return the fd used to
- scan /proc/$$/fd.
-
-Fri May 30 04:48:00 2014 Eric Wong <e@80x24.org>
-
- * parse.y (rb_gc_mark_parser): remove, empty since r8758
- * internal.h: ditto, not usable from extensions since 2.0.0
- * gc.c (gc_mark_roots): remove checkpoint for parser
-
-Thu May 29 23:27:50 2014 Rei Odaira <Rei.Odaira@gmail.com>
-
- * signal.c (ruby_signal): should return either `old.sa_sigaction`
- or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
- `old.sa_flags`, because they may not be a union.
- [ruby-core:62836] [Bug #9878]
-
-Thu May 29 23:11:20 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c (pipe_open): Close pipes when rb_execarg_fixup() raises
- an exception.
- (rb_execarg_fixup_v): New function.
-
-Thu May 29 22:18:57 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb (capture_subprocess_io): Close fds.
-
-Thu May 29 19:47:08 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_io_s_pipe): Close pipes if io_encoding_set() raises an
- exception.
- (io_encoding_set_v): New function.
-
-Thu May 29 19:42:49 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/csv.rb (CSV.open): Close the opened file when an exception
- occur.
-
-Thu May 29 19:31:10 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): Close a socket
- if any exception occur.
-
-Thu May 29 05:05:29 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/ruby.h: Hide Symbol internals.
- (struct RSymbol): moved to internal.h
- (RSYMBOL): ditto
-
-Thu May 29 00:28:56 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/unixsocket.c (rsock_init_unixsock): Open a socket
- after path length check.
- This fixes a fd leak by TestSocket_UNIXSocket#test_too_long_path.
-
-Wed May 28 23:04:35 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_io.rb (test_flush_in_finalizer1): Use
- ObjectSpace.each_object to close files.
- GC.start is not reliable.
-
-Wed May 28 19:00:31 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/net/imap.rb (Net::IMAP#initialize): Close the opened socket when
- any exception occur.
- This fixes a fd leak by IMAPTest#test_imaps_post_connection_check
- which start_tls_session() raises an exception.
-
-Wed May 28 18:06:13 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/openssl/ossl_ssl.c (ossl_ssl_close): Fix sync_close to work
- when SSL is not started.
- This fix the fd leak by test_https_proxy_authentication in
- test/net/http/test_https_proxy.rb.
-
-Wed May 28 10:29:28 2014 Eric Wong <e@80x24.org>
-
- * vm.c (rb_vm_living_threads_foreach): remove function
- [ruby-core:62745]
- * thread.c (terminate_i): remove
- * thread.c (terminate_all): implement (inlines old terminate_i)
- * thread.c (rb_thread_terminate_all): use terminate_all
- * thread.c (rb_thread_fd_close_i): remove
- * thread.c (rb_thread_fd_close): iterate inline
- * thread.c (thread_list_i): remove
- * thread.c (rb_thread_list): iterate inline
- * thread.c (rb_thread_atfork_internal): iterate inline
- * thread.c (terminate_atfork_i): update types to remove casts
- * thread.c (terminate_atfork_before_exec_i): ditto
- * thread.c (struct thgroup_list_params): remove definition
- * thread.c (thgroup_list_i): remove
- * thread.c (thgroup_list): iterate inline
- * thread.c (check_deadlock_i): remove
- * thread.c (debug_deadlock_check): implement (inlines check_deadlock_i)
- * thread.c (debug_i): remove
- * thread.c (rb_check_deadlock): iterate inline
- * vm.c (vm_mark_each_thread_func): remove
- * vm.c (rb_vm_mark): iterate inline
- * vm_core.h (rb_vm_living_threads_remove): remove
- * vm_trace.c (clear_trace_func_i): remove
- * vm_trace.c (rb_clear_trace_func): iterate inline
-
-Wed May 28 09:30:51 2014 Eric Wong <e@80x24.org>
-
- * signal.c (signal_exec): ignore immediate cmd for SIG_IGN
- * signal.c (trap_handler): set cmd to true for SIG_IGN
- * signal.c (trap): handle nil and true values for oldcmd
- [Bug #9835]
-
-Wed May 28 01:02:54 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/tempfile.rb (Tempfile#inspect): Show "(closed)" if the tempfile
- is closed.
-
-Wed May 28 00:38:09 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Use Tempfile#close! instead of
- Tempfile#unlink to close file descriptors.
-
- * test/openssl/test_config.rb: Ditto.
-
- * test/ruby/test_io.rb: Ditto.
-
-Wed May 28 00:06:18 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an
- exception occur.
-
-Tue May 27 23:50:07 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/cgi/core.rb: Use Tempfile#close! instead of Tempfile#unlink
- to close file descriptors.
-
-Tue May 27 23:06:46 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_number_literal_suffix): refine error message for
- extra dot and digits.
-
-Tue May 27 22:44:20 2014 Tanaka Akira <akr@fsij.org>
-
- * test/rexml: Avoid fd leaks.
-
-Tue May 27 22:24:25 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb: Indent.
-
-Tue May 27 22:15:29 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb: Wrap by REXMLTests module.
-
-Tue May 27 22:11:10 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_encoding_2.rb: Remove a needless file.
-
-Tue May 27 22:10:30 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_contrib.rb: Indent.
-
-Tue May 27 21:28:16 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/socket/ifaddr.c (ifaddr_inspect_flags): support IFF_SIMPLEX.
-
-Tue May 27 21:03:03 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/: Use REXMLTests as wrapping module for REXML tests.
- I avoid using the same module for library in test because
- it provides "include REXML" environment in test. Normally,
- users don't use REXML on "include REXML" environment. So I
- don't want to write tests on "include REXML" environment.
-
-Tue May 27 20:59:37 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_comment.rb: Remove needless REXML module wrapping.
-
-Tue May 27 20:56:49 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/openssl/test_pkcs7.rb: Fix inverted expected and actual values.
-
-Tue May 27 20:26:06 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (test_flush_in_finalizer1): some opened fds are
- remain before GC, so unlink the tempfile is failed.
-
-Tue May 27 19:07:26 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_io_autoclose_p): Don't raise on frozen IO.
-
- * test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.
-
-Tue May 27 19:01:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/openssl/test_pair.rb: Modify TestSSL#test_read_and_write
- to handle partial sysreads. [Bug #7398][ruby-core:49563]
- * test/openssl/test_ssl.rb: ditto.
-
-Tue May 27 18:46:23 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/openssl/test_pkcs7.rb: Add tests for PKCS7#type= and add_data.
- [Feature #7399][ruby-core:49565]
-
-Tue May 27 17:45:09 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/openssl/test_hmac.rb (test_binary_update): Added Test for
- HMAC signing with UTF-8 String. [Bug #7512][ruby-core:50559]
-
-Tue May 27 17:10:14 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/runner.rb: fixed randomly test failure.
- [Bug #6573][ruby-core:45563]
-
-Tue May 27 16:58:12 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_timeout.rb (test_timeout): inverted test condition.
- [Bug #8523]
-
-Tue May 27 12:24:22 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Show leaked file descriptors.
-
-Tue May 27 11:12:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_fileno, rb_io_inspect): non-modification does not
- error on frozen IO. [ruby-dev:48241] [Bug #9865]
-
-Tue May 27 00:00:21 2014 yui-knk <spiketeika@gmail.com>
-
- * insns.def (defineclass): fix typo in the instruction comment.
- [fix GH-618]
-
-Mon May 26 16:33:15 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_file.rb: skip the test of atime on Windows, because
- Windows delays updating atime about 1 hour.
- see more details:
- http://msdn.microsoft.com/en-us/library/windows/desktop/ms724290%28v=vs.85%29.aspx
-
-Mon May 26 12:25:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optionparser.rb, lib/optparse.rb (OptParse): aliases.
- [ruby-core:62751] [Feature #9864]
-
-Mon May 26 07:59:34 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Show Finished threads line-by-line.
-
-Mon May 26 01:39:02 2014 Zachary Scott <e@zzak.io>
-
- * lib/csv.rb: Reject nil as data source for CSV.new, patch by @Peeja.
- [Fixes GH-580] https://github.com/ruby/ruby/pull/580
-
-Mon May 26 01:07:51 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Show leaked threads and tempfiles
- line-by-line.
-
-Sun May 25 23:02:06 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove
- tempfiles.
-
-Sun May 25 22:42:27 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Check tempfile leak for each test class.
-
-Sun May 25 20:31:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (ac_cv_func_{getcontext,setcontext}): do not
- disable ucontext.h entirely, but disable use of functions only.
- `ucontext_t` is necessary in the signal handler now.
-
-Sun May 25 20:00:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (check_stack_overflow): revert part of r46100, the
- previous condition was correct, and fix compilation error on
- other architecture linux. [ruby-core:62746] [Bug #9862]
-
-Sun May 25 17:09:13 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Less ObjectSpace.each_object(Tempfile)
- invocation.
-
-Sun May 25 16:54:06 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Use Thread.list instead of
- ObjectSpace.each_object(Thread).
-
-Sun May 25 15:53:54 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/rinda/ring.rb (Rinda::RingServer#shutdown): Join the killed
- threads.
-
-Sun May 25 15:26:17 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/utils.rb: Override the inspect method of the thread
- used in WEBrick::Utils::TimeoutHandler.
-
-Sun May 25 14:22:30 2014 Tanaka Akira <akr@fsij.org>
-
- * test/openssl: Join threads.
-
-Sun May 25 12:46:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_bug_context): new function to report bug with
- context.
-
- * vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
- dump machine registers. based on [GH-584].
-
- * signal.c (sigbus, sigsegv): dump machine registers if available.
-
-Sun May 25 12:32:42 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Sort leaked threads and tempfiles.
-
-Sun May 25 12:15:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (check_stack_overflow): fix condition to use ucontext
- register, mcontext_t dereference, and its member names, on Mac
- OS X.
-
-Sun May 25 11:58:26 2014 Zachary Scott <e@zzak.io>
-
- * enumerator.c: [DOC] Fix example to show Enumerator#peek behavior
- Patch by Erik Hollembeak [Bug #9814]
-
-Sun May 25 11:56:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vsnprintf.c (BSD_vfprintf): fix string width when precision is
- given. as the result of `memchr` is NULL or its offset from the
- start cannot exceed the size, the comparison was always false.
- [ruby-core:62737] [Bug #9861]
-
-Sun May 25 11:32:42 2014 Zachary Scott <e@zzak.io>
-
- * lib/yaml.rb: Remove Psych::EngineManager [Bug #8344]
- * test/psych/*: ditto.
-
-Sun May 25 10:34:15 2014 Zachary Scott <e@zzak.io>
-
- * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
- [Fixes GH-606] https://github.com/ruby/ruby/pull/606
-
-Sun May 25 10:19:34 2014 Zachary Scott <e@zzak.io>
-
- * enum.c: [DOC] Use #find in example to clarify alias by @rachellogie
- Patch submitted via documenting-ruby/ruby#34
-
-Sun May 25 10:16:43 2014 Zachary Scott <e@zzak.io>
-
- * cont.c: [DOC] Fix rdoc in example for Fiber#transfer by @majjoha
- Patch submitted via documenting-ruby/ruby#33
-
-Sun May 25 10:01:11 2014 Zachary Scott <e@zzak.io>
-
- * lib/irb.rb: [DOC] Fixed syntax error in example by @jasdeepsingh.
- Patch submitted via documenting-ruby/ruby#32
-
-Sun May 25 09:58:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/fileutils/test_fileutils.rb (test_chown_R): Add tests for
- chown_R. [Feature #9383][ruby-core:59641]
-
-Sun May 25 09:57:09 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/fileutils/test_fileutils.rb: Added recursively chown tests.
- [Feature #9303][ruby-core:59325]
-
-Sun May 25 09:41:56 2014 Zachary Scott <e@zzak.io>
-
- * class.c: [DOC] Fixed grammar and examples of instance_methods.
- By @alex-frost via documenting-ruby/ruby#31
-
-Sun May 25 09:40:44 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb: Show leaked threads and tempfiles.
-
-Sun May 25 08:54:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/openssl/test_partial_record_read.rb: Testing read_nonblock on
- a partial TLS record results in IO::WaitReadable by @mohamedhafez.
- [fix GH-547]
-
-Sun May 25 08:43:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * lib/logger.rb: refactored to include Logger::Period.
-
-Sun May 25 06:50:19 2014 Zachary Scott <e@zzak.io>
-
- * vm_eval.c: [DOC] Improve instance_eval description when given a
- block or String arguments. By @nathanl via documenting-ruby/ruby#28
-
-Sun May 25 06:29:39 2014 Zachary Scott <e@zzak.io>
-
- * array.c: [DOC] Clarify default argument for Array.new.
- By @Elffers [Fixes GH-610]
-
-Sat May 24 22:37:20 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * array.c: [DOC] Add more documents to shuffle! and shuffle.
- Contributed by @JuanitoFatas [ci skip][fix GH-612]
-
-Sat May 24 22:28:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/lib/minitest/.document: removed unused configuration.
-
-Sat May 24 19:08:47 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/spec.rb: Unused file removed.
-
- * test/lib/minitest/autorun.rb: Don't require minitest/spec.
-
- * test/lib/minitest/benchmark.rb: Ditto.
-
-Sat May 24 18:45:30 2014 Tanaka Akira <akr@fsij.org>
-
- * test/benchmark/test_benchmark.rb: Use test/unit.
-
-Sat May 24 16:20:59 2014 Eric Wong <e@80x24.org>
-
- * process.c (proc_getgroups, proc_setgroups): use ALLOCV_N
- [Bug #9856]
-
-Sat May 24 15:49:39 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/unit.rb (parallelize_me!): Removed.
- This fixes the line-by-line structure of the test result in verbose
- mode. [ruby-core:54905]
-
- * test/lib/minitest/parallel_each.rb: Removed.
-
- * test/minitest/test_minitest_mock.rb: Don't call parallelize_me!.
-
- * test/minitest/test_minitest_spec.rb: Ditto.
-
- * test/minitest/test_minitest_unit.rb: Ditto.
- Tests for parallel feature removed.
-
-Sat May 24 15:29:10 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest/hell.rb: Unused file removed.
-
- * test/lib/minitest/pride.rb: Ditto.
-
-Sat May 24 15:05:32 2014 yui-knk <spiketeika@gmail.com>
-
- * enumerator.c (yielder_yield_push): Insert a break after the
- method return value. [fix GH-617]
-
-Sat May 24 14:59:12 2014 Tanaka Akira <akr@fsij.org>
-
- * test/lib/minitest: Remove comments not appropriate now.
-
- * test/minitest: Ditto.
-
-Sat May 24 14:02:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * NEWS: added minitest changes.
-
-Sat May 24 13:42:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/lib/test/unit/test-unit.gemspec: removed needless gemspec file.
-
-Sat May 24 09:39:06 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * defs/default_gems: removed minitest entry.
-
-Sat May 24 06:17:33 2014 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/minitest: minitest 4.7.5 removed. Need to support proper
- gem packaging / installation before minitest 5 can be added.
-
-Sat May 24 05:54:06 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: More constants
-
-Sat May 24 00:25:34 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * NEWS: add information of incompatibility about Prime.prime?
- * lib/prime.rb: fix docs.
-
-Fri May 23 21:36:28 2014 Josh Goebel <dreamer3@gmail.com>
-
- * net/protocol.rb (using_each_crlf_line): fix SMTP dot-stuffing
- for messages not ending with a new-line.
- [ruby-core:61441] [Bug #9627] [fix GH-616]
-
-Fri May 23 03:48:08 2014 Eric Wong <e@80x24.org>
-
- * gc.c (rb_free_m_tbl): mark function as static
-
- * method.h (rb_free_m_tbl): remove prototype
-
-Thu May 22 22:58:27 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: More TCP option constants.
- Describe Linux and glibc versions.
-
-Thu May 22 20:38:10 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (stat_birthtime): add birthtime support [Feature #9647]
-
- * file.c (rb_stat_birthtime): add File::Stat.birthtime
-
- * file.c (rb_file_s_birthtime): add File.birthtime
-
- * file.c (rb_file_birthtime): add File#birthtime
-
- * configure.in: check struct stat.st_birthtimespec.
-
-Thu May 22 19:38:14 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c: remove IO::Statfs because of reject. [Feature #9772]
-
-Thu May 22 14:02:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/jis/props.kwd: constify character property tables of JIS
- based encodings by perfect hash.
-
- * enc/euc_jp.c, enc/shift_jis.c: use character property functions.
-
-Wed May 21 12:21:10 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c: Fix compilation error on Android.
- Bionic doesn't define TCP state constants.
-
-Wed May 21 11:42:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: workaround for Info.plist to get rid of `dsymutil`
- crash by wrong files in parent directories.
- [ruby-core:62594] [Bug #9840]
-
-Tue May 20 20:57:34 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_dir.rb (test_glob): added testcase of double
- slash path.
-
-Tue May 20 04:58:54 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/extconf.rb: Don't check fields of struct tcp_info if the
- structure is not available.
-
-Mon May 19 23:13:33 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c (inspect_tcp_info): Permit longer data. (glibc
- 2.7 adds tcpi_rcv_rtt, tcpi_rcv_space and tcpi_total_retrans to
- struct tcp_info.)
-
-Mon May 19 20:49:07 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c (inspect_tcp_info): New function to inspect
- struct tcp_info.
- (sockopt_inspect): Use inspect_tcp_info.
-
- * ext/socket/extconf.rb: Check tcp_info related things.
-
- * ext/socket/rubysocket.h: Include netinet/tcp_fsm.h if available.
-
-Mon May 19 19:36:39 2014 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb: Use Etc.uname.
-
- * test/gdbm/test_gdbm.rb: Ditto.
-
-Mon May 19 16:54:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (etc_uname): add support for Windows using
- GetVersionExW(), GetSystemInfo(), and GetComputerNameExW() with
- `ComputerNameDnsHostname`. [Feature #9842]
-
-Mon May 19 16:29:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_pat_search): advance by byte offset but not by char
- offset. [ruby-core:62669] [Bug #9849]
-
-Mon May 19 14:06:18 2014 Shota Fukumori <her@sorah.jp>
-
- * bin/testrb: Removed. Forgot to remove in r45971.
- [Feature #9711] [ruby-core:62620]
-
-Sun May 18 16:42:08 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_m17n_comb.rb (test_str_crypt): Use Etc.confstr to
- detect the glibc version.
- libc.so is not an executable on Debian GNU/kFreeBSD 7.0 (wheezy).
-
-Sun May 18 12:15:54 2014 Jonathan Mukai-Heidt <johnnymukai@gmail.com>
-
- * io.c (argf_each_line, argf_inplace_mode_set): [DOC] Update ARGF
- documentation examples. `ARGF.lines` has been deprecated in
- favor of `ARGF.each_line`. [Fixes GH-615]
-
-Sun May 18 11:59:25 2014 Tanaka Akira <akr@fsij.org>
-
- * missing/nextafter.c: Include ruby/missing.h.
-
-Sun May 18 11:09:28 2014 Tanaka Akira <akr@fsij.org>
-
- * win32/Makefile.sub: Add nextafter.obj to MISSING.
-
-Sun May 18 10:46:04 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/etc/etc.c: Etc.sysconf, Etc.confstr and IO#pathconf implemented.
-
- * ext/etc/extconf.rb: Check sysconf(), confstr() and fpathconf().
-
- * ext/etc/mkconstants.rb: New file.
-
- [ruby-core:62600] [Feature #9842]
-
-Sun May 18 09:58:17 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/etc/etc.c: Etc.uname method implemented.
-
- * ext/etc/extconf.rb: Check uname() function.
-
- [ruby-core:62139] [Feature #9770]
-
-Sun May 18 09:16:33 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Check nextafter() availability.
-
- * include/ruby/missing.h (nextafter): New optional declaration.
-
- * missing/nextafter.c: New file.
-
- * numeric.c: Float#next_float and Float#prev_float implemented.
-
- [ruby-core:62562] [Feature #9834]
-
-Sun May 18 09:02:17 2014 Tanaka Akira <akr@fsij.org>
-
- * enum.c: Enumerable#slice_after implemented.
-
- * enumerator.c: Enumerator::Lazy#slice_after implemented.
-
- Requested by Tsuyoshi Sawada. [ruby-core:58123] [Feature #9071]
-
-Sun May 18 08:22:25 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_setstrbuf): always check if the buffer is modifiable.
- [ruby-core:62643] [Bug #9847]
-
-Sun May 18 01:21:23 2014 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h: Hide Rational internal.
- (RRational): Moved to internal.h
- (RRATIONAL): Ditto.
- (RRATIONAL_SET_NUM): Moved to rational.c.
- (RRATIONAL_SET_DEN): Ditto.
-
- * rational.c (rb_rational_num): New function.
- (rb_rational_den): Ditto.
-
- * include/ruby/intern.h (rb_rational_num): Declared.
- (rb_rational_den): Ditto.
-
- * ext/bigdecimal/bigdecimal.c: Follow the above change.
-
- * ext/date/date_core.c: Ditto.
-
- [ruby-core:60665] [Feature #9513]
-
-Sat May 17 17:04:32 2014 Shota Fukumori <her@sorah.jp>
-
- * NEWS: Add news about removal of lib/test/**/*.rb.
-
-Sat May 17 16:57:33 2014 Shota Fukumori <her@sorah.jp>
-
- * lib/test: Removed because ruby's test cases now independent to
- lib/test by r45970. [Feature #9711] [ruby-core:62620]
-
- I'm still considering about the future of lib/minitest, lib/test.
- (bundling gems?)
-
-Sat May 17 15:06:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/runner.rb: remove dependency test-unit and minitest
- from stdlib when running with test-all.
- [Feature #9711][ruby-core:61890]
- * test/testunit/*.rb: ditto.
- * test/lib: ditto.
-
-Sat May 17 11:02:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): try match PLAIN as well as ALPHA, which are
- separated by previous commits. [ruby-core:61552] [Bug #9648]
-
- * dir.c (glob_make_pattern): set PLAIN for non-magical path to
- skip parts which not need to glob.
- [ruby-core:61552] [Bug #9648]
-
- * dir.c (has_magic): return ALPHA at alphabetical name regardless
- FNM_CASEFOLD flag.
-
- * dir.c (glob_helper): fix conditions for ALPHA.
- [ruby-core:61552] [Bug #9648]
-
-Sat May 17 01:49:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): reduce matching at non-magical path on
- Windows.
-
-Sat May 17 01:49:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_pattern_type): separate names with alphabet but no
- magical from plain.
-
- * dir.c (glob_helper): match plain names as-is to treat super-root
- same as the root. [ruby-core:61552] [Bug #9648]
-
-Fri May 16 17:38:22 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_marks, gc_marks_body): increase the counter of young objects
- at the major GC because AGE2Promotion changes all old objects into
- young objects at major GC.
-
-Fri May 16 17:26:24 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_before_sweep): heap_pages_swept_slots should contains
- heap_pages_increment.
-
- For example, GC by exceeding malloc_limit can remain
- heap_pages_increment.
-
-Thu May 15 21:18:43 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * configure.in: enable SSE2 on mingw. target='i386-pc-mingw32'.
- [ruby-core:62095] [Bug #8358]
-
-Thu May 15 21:04:06 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * lib/test/unit/parallel.rb: fix test-all parallel failure if a test
- is skipped after raise.
- DL::TestFunc#test_sinf is skipped after raise on mingw ruby.
- But it causes Marshal.load failure due to undefined class/module
- DL::DLError when doing test-all parallel and test-all doesn't
- complete. We create new MiniTest::Skip object to avoid Marshal.load
- failure.
- [ruby-core:62133] [Bug #9767]
-
- * test/testunit/test_parallel.rb (TestParallel): add a test.
-
- * test/testunit/tests_for_parallel/ptest_forth.rb: ditto.
-
-Thu May 15 18:57:23 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect_body): move gc_heap_prepare_minimum_pages()
- from gc_sweep().
-
-Thu May 15 18:51:25 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_extend_pages): calculate next growing heap size.
-
- * gc.c (heap_set_increment): accept addition pages instead of
- minimum pages.
-
- * gc.c (gc_after_sweep): use heap_etend_pages().
-
- * gc.c (gc_heap_prepare_minimum_pages): add only 1 page.
-
- * gc.c (heap_ready_to_gc): add only 1 page.
-
-Thu May 15 18:42:49 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: introduce macros to remove magic number.
-
- GC_HEAP_FREE_SLOTS_MIN_RATIO = 0.3: guarantee minimum empty slots
- ratio after sweep.
- GC_HEAP_FREE_SLOTS_MAX_RATIO = 0.8: allow to free pages 0.2 (= 1-0.8)
- of current existing slots.
-
-Thu May 15 17:32:51 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * thread_win32.c (rb_w32_stack_overflow_handler): use Structured
- Exception Handling by AddVectoredExceptionHandler() for machine
- stack overflow on mingw.
- This would be equivalent to the handling using __try and __except
- on mswin introduced by r43748.
-
-Wed May 14 19:31:03 2014 Koichi Sasada <ko1@atdot.net>
-
- * ext/openssl/depend: remove dependency from internal headers.
- [Feature #9612]
-
- * ext/openssl/ossl.c (ossl_fips_mode_set): ditto.
-
- * ext/coverage/depend: ditto.
-
- * include/ruby/thread_native.h: added.
-
- This header file only provides wrapper functions to control
- native threads. These wrapper functions are used by MRI
- implementation.
-
- * vm_core.h: use include/ruby/thread_native.h.
-
- * thread.c: ditto.
-
- * thread_pthread.h: ditto.
-
- * thread_win32.h: ditto.
-
- * thread_native.h: removed.
-
-Wed May 14 18:03:28 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: enable RGENGC_AGE2_PROMOTION.
-
-Wed May 14 18:02:30 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rgengc_rememberset_mark): promote remembered object earlier.
-
-Mon May 12 23:57:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_atan2_inf_c99): check whether runtime atan2
- handles Inf as C99. [ruby-core:62536] [Bug #9831]
-
-Mon May 12 20:33:01 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Invoke AC_REPLACE_FUNCS for each function.
-
-Mon May 12 19:52:11 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: count young object correctly and show it in GC.stat
- on RGENGC_AGE2_PROMOTION.
-
- * gc.c (RVALUE_PROMOTE_YOUNG): decrement young object count on
- YOUNG->OLD.
-
- * gc.c (obj_free): decrement young object count when young object
- freed.
-
- * gc.c (gc_marks): should not clear young object count.
-
- * gc.c (gc_stat_internal): GC.stat :young_object information.
-
-Mon May 12 01:30:59 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ifaddr.c (IS_IFADDRS): Unused macro removed.
-
- * ext/strscan/strscan.c (BUFSIZE): Ditto.
-
- * ext/zlib/zlib.c (OBJ_IS_FREED): Ditto.
-
-Sun May 11 22:27:18 2014 Tanaka Akira <akr@fsij.org>
-
- * compile.c (BUFSIZE): Unused macro removed.
-
- * vm.c (BUFSIZE): Ditto.
-
- * pack.c (INT64toNUM): Ditto.
- (UINT64toNUM): Ditto.
- (BYTEWIDTH): Ditto.
-
- * time.c (lshift): Ditto.
- (UINT64toNUM): Ditto.
- (id_lshift): Unused variable removed.
-
-Sun May 11 21:23:27 2014 Tanaka Akira <akr@fsij.org>
-
- * pack.c (swaps): Unused macro removed.
- (swapi): Ditto.
- (swapl): Ditto.
- (swapll): Ditto.
-
-Sun May 11 08:02:49 2014 Eric Wong <e@80x24.org>
-
- * vm_core.h (rb_vm_t): list_head and counter for living_threads
- (rb_thread_t): vmlt_node for living_threads linkage
- (rb_vm_living_threads_init): new function wrapper
- (rb_vm_living_threads_insert): ditto
- (rb_vm_living_threads_remove): ditto
- * vm.c (rb_vm_living_threads_foreach): new function wrapper
- * thread.c (terminate_i, thread_start_func_2, thread_create_core,
- thread_fd_close_i, thread_fd_close): update to use new APIs
- * vm.c (vm_mark_each_thread_func, rb_vm_mark, ruby_vm_destruct,
- vm_memsize, vm_init2, Init_VM): ditto
- * vm_trace.c (clear_trace_func_i, rb_clear_trace_func): ditto
- * benchmark/bm_vm_thread_close.rb: added to show improvement
- * ccan/build_assert/build_assert.h: added as a dependency of list.h
- * ccan/check_type/check_type.h: ditto
- * ccan/container_of/container_of.h: ditto
- * ccan/licenses/BSD-MIT: ditto
- * ccan/licenses/CC0: ditto
- * ccan/str/str.h: ditto (stripped of unused macros)
- * ccan/list/list.h: ditto
- * common.mk: add CCAN_LIST_INCLUDES
- [ruby-core:61871][Feature #9632 (part 1)]
-
-Sun May 11 01:10:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (rb_f_kill): directly enqueue an ignored signal to self,
- except for SIGSEGV and SIGBUS. [ruby-dev:48203] [Bug #9820]
-
-Sat May 10 22:37:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (push_glob): match in UTF-8 on Mac OS X.
- [ruby-dev:48213] [Bug #9825]
-
-Sat May 10 13:32:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (thread_start_func_2): stop if forked in a sub-thread,
- the thread has become the main thread.
- [ruby-core:62070] [Bug #9751]
-
-Sat May 10 09:32:19 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * man/ruby.1: remove deadlink. [ruby-core:62145][Bug #9773]
-
-Sat May 10 08:47:36 2014 Tanaka Akira <akr@fsij.org>
-
- * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.
-
-Fri May 9 14:27:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_SETJMP_TYPE): check for setjmp type after
- CCDLFLAGS is appended to CFLAGS, since __builtin_setjmp can be
- affected. [ruby-core:62469] [Bug #9818]
-
-Fri May 9 03:59:06 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/delegate.rb: Fix example of using delegator.
- patched from Andrey Koleshko. [Fixes GH-505]
-
-Fri May 9 03:42:43 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/shell.rb: add documentation in lib/shell.rb
- patched from reprah. [Fixes GH-516]
-
-Fri May 9 03:28:04 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/fileutils.rb: show fileutils require at top.
- patched from Richard Schneeman. [Fixes GH-604]
-
-Fri May 9 03:07:09 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/prime.rb (Prime#prime?): negative numbers can't be primes
- by definition. reported by Ivan Kataitsev. [Bug #7395]
- * test/test_prime.rb: add test.
-
-Thu May 8 14:34:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_mod_init_copy): always clear instance variable,
- constant and method tables first, regardless the source tables.
- [ruby-dev:48182] [Bug #9813]
-
-Thu May 8 10:53:14 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: OpenBSD needs to include sys/param.h before include
- sys/mount.h. [ruby-dev:48167]
-
-Thu May 8 10:17:04 2014 Karsten Sperling <karsten@sperling.co.nz>
-
- * lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): stop
- handling requests on shutdown, even if the socket is readable
- and IO.select() returns true. [Fixes GH-607]
-
- * lib/webrick/server.rb (WEBrick::GenericServer#start): IO.select()
- raises ENOTSOCK on shutdown on Windows.
-
-Wed May 7 21:45:00 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#accept):
- Consider Socket#accept as well as TCPServer#accept.
- Reported by Sam Stelfox. [ruby-core:62064] [Bug #9750]
-
-Wed May 7 17:24:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * numeric.c (num_step_scan_args): check keyword arguments and fail
- if they conflict with positional arguments.
- [ruby-dev:48177] [Bug #9811]
-
-Wed May 7 12:06:14 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: remove debug output and output results into
- specified file.
-
-Wed May 7 11:55:40 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: add '--rawdata-output=[FILE] option to output
- raw results into FILE.
-
-Wed May 7 11:25:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_f_local_variables): exclude variables hidden by
- shadowing. [ruby-core:60501] [Bug #9486]
-
- * vm.c (collect_local_variables_in_iseq): ditto.
-
-Tue May 6 23:29:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (new_bv_gen): no duplicated names, if already added in
- shadowing_lvar().
-
- * parse.y (local_tbl_gen): remove local variables duplicated with
- arguments.
- [ruby-core:60501] [Bug #9486]
-
-Tue May 6 18:48:50 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.make_time): Adjust the time zone of "now".
-
-Tue May 6 18:33:12 2014 Tadayoshi Funaba <tadf@dotrb.org>
-
- * io.c (io_{read,write}_nonblock): use rb_get_kwargs instead of
- rb_hash_aref.
-
-Tue May 6 18:03:05 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.make_time): Argument validation code moved from
- Time.parse and Time.strptime.
-
-Tue May 6 17:27:06 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.parse): [DOC] Fix an example in the documentation
- to use EST.
- Reported by Marcus Stollsteimer.
- [ruby-core:60778] [Bug #9521] and [ruby-core:61718] [Bug #9682]
-
-Tue May 6 04:31:48 2014 Tadayoshi Funaba <tadf@dotrb.org>
-
- * file.c (rb_f_test): removed meaningless "case 'a'".
-
-Tue May 6 01:28:14 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/open-uri.rb (OpenURI.open_uri): Call StringIO#close only if
- the StringIO object is not closed yet.
- Reported by Jordi Massaguer Pla. [ruby-core:42538] [Bug #6010]
-
-Tue May 6 01:08:01 2014 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: define File::NULL if not defined and /dev/null
- is available to run benchmark driver on ruby 1.9.2.
-
-Mon May 5 23:53:24 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: Add IP_TRANSPARENT.
- IP_TRANSPARENT is provieded since glibc-2.12.
- Reported by Eliezer Croitoru. [ruby-core:50372] [Bug #7476]
-
-Mon May 5 22:29:47 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (check_exec_redirect): Open the file in write mode for
- redirect from [:out, :err].
- Proposed and implemented by Yusuke Endoh.
- [ruby-dev:41430] [Feature #3348]
-
-Mon May 5 21:52:35 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/pathname/lib/pathname.rb (cleanpath_aggressive): make all
- separators File::SEPARATOR from File::ALT_SEPARATOR.
- Reported by Daniel Rikowski.
- Fixed by Nobuyoshi Nakada. [Bug #9618]
-
- * ext/pathname/lib/pathname.rb (cleanpath_conservative): ditto.
-
-Mon May 5 21:48:04 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/pathname/lib/pathname.rb (Pathname#/): Aliased to Pathname#+.
- Suggested by Alexey Muranov. [ruby-core:61432] [Feature #9625]
-
-Mon May 5 17:26:09 2014 Tadayoshi Funaba <tadf@dotrb.org>
-
- * math.c (rb_math_sqrt): omitted exporting an unused function,
- anyway.
- * internal.h: follows the above change.
-
-Mon May 5 11:44:03 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptime
- doesn't extract date information.
- Reported by tadayoshi funaba. [ruby-core:62349]
-
-Mon May 5 01:12:27 2014 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c (rt_rewrite_frags): a new feature (not a
- bug fix) of strptime. applies offset even if the given date is
- not local time (%s and %Q). This is an exceptional feature and
- I do NOT recommend to use this at all. Thank you git community.
-
-Sun May 4 20:51:32 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.force_zone!): Use usual local time if it has
- expected offset from UTC.
-
-Sun May 4 17:58:12 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.force_zone!): New private method.
- (Time.make_time): Use Time.force_zone!.
- (Time.strptime): Ditto.
- (Time.rfc2822): Ditto.
- (Time.xmlschema): Ditto.
-
- * lib/rss/rss.rb (Time.w3cdtf): Use Time.force_zone!.
-
-Sun May 4 10:22:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * math.c (math_atan2): return values like as expected by C99 if
- both two arguments are infinity. based on the patch by cremno
- phobia <cremno AT mail.ru> in [ruby-core:62310]. [Feature #9799]
-
-Sun May 4 03:46:42 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.httpdate): Always return a UTC Time object.
-
-Sun May 4 03:26:39 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.make_time): Refactored.
-
-Sun May 4 02:53:17 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.rfc2822): Fix year completion.
- Produce fixed-offset time object if appropriate.
- (Time.xmlschema): Produce fixed-offset time object if appropriate.
-
-Sat May 3 23:52:20 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (make_time): Produce fixed-offset time object if
- appropriate.
- (Time.strptime): Use d[:zone] instead of d[:offset].
-
- * lib/rss/rss.rb (Time.w3cdtf): Produce fixed-offset time object if
- appropriate.
-
-Sat May 3 20:21:38 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is not
- given.
- Reported by tadayoshi funaba. [ruby-core:62322]
-
-Sat May 3 04:04:16 2014 Eric Wong <e@80x24.org>
-
- * complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END
- [Bug #9608]
- * rational.c (read_digits): ditto
-
-Sat May 3 00:06:30 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * file.c (HAVE_STRUCT_STATVFS_F_BASETYPE): File::Statfs#fstypename
- is supported on AIX, HP-UX, and Solaris, by using the value of
- struct statvfs.f_basetype.
-
- * configure.in (HAVE_STRUCT_STATVFS_F_BASETYPE): check struct
- statvfs.f_basetype which is available on AIX, HP-UX, and Solaris.
-
-Fri May 2 21:04:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (next_id): no reason to set ID_STATIC_SYM here, as ID
- returned by rb_intern3 can be a dynamic symbol and the static
- symbol flag is set otherwise. [Bug #9787]
-
-Fri May 2 11:32:51 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_io.rb (test_seek, test_seek_symwhence): defer
- File::Statfs#type call which may not be implemented, to mitigate
- errors on platforms where SEEK_DATA is available but f_type in
- struct statfs is not. [ruby-dev:48154] [Bug #9789]
-
-Fri May 2 10:37:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_id_attrset): turn dynamically interned Symbol into
- an ID, since rb_str_dynamic_intern returns a Symbol but not an
- ID. [ruby-core:62226] [Bug #9787]
-
-Thu May 1 22:19:34 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * file.c: Change AND condition to nested condition.
-
-Thu May 1 00:36:26 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * file.c (FSTATFS): check availability of struct statfs and
- struct statvfs in addition to fstatfs(2) and fstatvfs(2).
- This fixes error in Solaris. [Bug #9788] [ruby-dev:48145]
-
-Wed Apr 30 19:46:23 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
- Tomb heap pages are freed pages here, so expanding heap is
- not required.
-
-Wed Apr 30 17:58:40 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (invoke_block_from_c): add VM_FRAME_FLAG_BMETHOD to record
- it is bmethod frame.
-
- * vm.c (vm_exec): invoke RUBY_EVENT_RETURN event if rollbacked frame
- is VM_FRAME_FLAG_BMETHOD.
- [Bug #9759]
-
- * test/ruby/test_settracefunc.rb: add a test for TracePoint/set_trace_func.
-
- * vm_core.h: rename rb_thread_t::passed_me to
- rb_thread_t::passed_bmethod_me to clarify the usage.
-
- * vm_insnhelper.c (vm_call_bmethod_body): use renamed member.
-
-Wed Apr 30 17:06:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_id_attrset): pin down dynamic symbol only. it is
- possible that attrset ID can be registered as a static symbol
- after the corresponding attrget ID has been registered as a
- dynamic, and then the latter may be collected.
- [ruby-core:62226] [Bug #9787]
-
-Tue Apr 29 14:17:57 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/tmpdir.rb: Rescue LoadError on etc.so for miniruby.
- Revert r45707, r45711, r45717.
-
-Tue Apr 29 12:50:02 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
- rescue LoadError on 'etc'.
-
-Tue Apr 29 10:21:38 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * parse.y (symbols_i): like r45492, call rb_gc_resurrect().
-
-Tue Apr 29 04:29:05 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for
- statfs_t.
- * file.c (HAVE_STRUCT_STATFS_T_F_TYPE): ditto.
-
- * file.c (rb_io_statfs): check FSTATFS macro only instead of
- HAVE_FSTATFS and HAVE_FSTATVFS.
-
- * file.c (statfs_type): use new macro.
- * file.c (statfs_fstypename): ditto.
- * file.c (statfs_inspect): ditto.
-
-Tue Apr 29 00:20:26 2014 Rajarshi Das <rajarshid@cybage.com>
-
- * bootstraptest/test_literal.rb: fix typo of "dynamic". [ci skip]
-
- * regexp.rdoc: fix typo of "organized". [ci skip]
-
- * lib/session.rb: fix typo of "recognized". [ci skip]
-
-Mon Apr 28 21:40:27 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (HAVE_STRUCT_STATFS_F_TYPE): check struct statfs.f_type
- to support OpenBSD.
-
- * file.c (statfs_type): use above macro to switch.
-
- * file.c (statfs_inspect): ditto.
-
-Mon Apr 28 18:06:08 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: check struct statvfs and struct statvfs.f_fstypename.
-
- * configure.in: on NetBSD fstatfs is obsoleted.
-
- * file.c: support NetBSD for File::Statfs.
-
-Mon Apr 28 17:42:42 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: This argument must be a pointer.
-
-Mon Apr 28 17:40:15 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: Fix typos. These are undefined variables.
-
-Sun Apr 27 19:39:42 2014 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_strptime.c (date__strptime_internal): do not
- overwrite century.
-
-Sat Apr 26 11:50:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/ruby/test_enum.rb (test_flat_map): Added test for flat_map.
- Contribute from @igaiga. [fix GH-598]
-
-Sat Apr 26 10:55:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (compile_array_): make copy a first hash not to modify
- the argument itself. keyword splat should be non-destructive.
- [ruby-core:62161] [Bug #9776]
-
-Sat Apr 26 08:05:36 2014 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_process.rb (test_rlimit_nofile): Don't limit
- RLIMIT_NOFILE too small.
- This fix sporadic "[ASYNC BUG] thread_timer: select" on GNU/Linux.
-
-Fri Apr 25 22:54:34 2014 Naohisa Goto <ngotogenome@gmail.com>
-
- * lib/fileutils.rb (rmdir): rescue Errno::EEXIST in addition to
- ENOTEMPTY (and ENOENT), because SUSv3 describes that "If the
- directory is not an empty directory, rmdir() shall fail and set
- errno to [EEXIST] or [ENOTEMPTY]" and Solaris uses EEXIST.
- [Bug #9571] [ruby-dev:48017]
-
-Fri Apr 25 19:16:30 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/utils.rb: Don't rescue LoadError for 'etc' extension.
-
-Fri Apr 25 14:55:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_func___builtin_unreachable): try with an
- external variable not only by a warning, which might not be
- shown due to the optimization. [ruby-core:61647] [Bug #9665]
-
-Fri Apr 25 13:11:49 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: NetBSD's ksh, used by configure, needs escapes.
-
-Fri Apr 25 12:51:08 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: correct pthread_setname_np's prototype on NetBSD.
- [Bug #9586]
-
-Thu Apr 24 23:17:25 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/fileutils.rb (fu_get_uid, fu_get_gid): Etc.getpwnam/getgrnam may
- returns nil.
-
- * lib/webrick/utils.rb (su): ditto.
-
-Thu Apr 24 22:55:22 2014 Tanaka Akira <akr@fsij.org>
-
- * bootstraptest/test_io.rb: Add etc.so to $" before require 'tmpdir'.
-
-Thu Apr 24 21:09:55 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * man/ruby.1: fix broken link.
-
-Thu Apr 24 20:53:02 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/tmpdir.rb: Don't need to rescue LoadError for etc.so.
-
-Thu Apr 24 17:39:53 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (statfs_inspect): suppress warnings.
- assume those values won't be larger than LONG_LONG_MAX.
-
-Thu Apr 24 11:53:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/ossl_asn1.c (ossl_asn1_initialize): SYMID on a value
- other than Symbol is an undefined behavior. fix up r31699.
- [ruby-core:62142] [Bug #9771]
-
-Thu Apr 24 11:21:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
- non-symbol values, for the time being.
-
-Thu Apr 24 05:50:13 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * parse.y (dsym_node_gen): like r45492, call rb_gc_resurrect().
-
-Wed Apr 23 20:36:22 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/etc/extconf.rb: Build ext/etc unconditionally.
-
-Wed Apr 23 14:10:50 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (statfs_fsid): remove statfs.f_fsid because it doesn't return
- meaningful value portably. http://togetter.com/li/658517
-
-Wed Apr 23 11:03:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_write): use rb_str_append to
- reuse coderange bits other than ASCII-8BIT, and keep
- taintedness. [ruby-dev:48118] [Bug #9769]
-
-Wed Apr 23 00:43:00 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/ruby/win32.h (ustatfs): implementation of
- statfs(2) clone. [EXPERIMENTAL]
-
- * file.c (rb_io_statfs): use above function.
-
- * configure.in, win32/Makefile.sub (struct statfs): available.
-
-Tue Apr 22 23:56:24 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable.
-
- * configure.in (fstatfs): check it.
-
-Tue Apr 22 22:15:51 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_io_statfs): need to define even if the system doesn't have
- fstatfs(2).
-
- * test/ruby/test_file.rb (TestFile#test_statfs): skip if IO#stafs is not
- implemented.
-
-Tue Apr 22 19:32:48 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c: newly added a class File::Statfs. (experimental)
-
-Tue Apr 22 08:22:33 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (objspace_malloc_increase): don't cause GC by malloc_increase
- when memop type is MEMOP_TYPE_REALLOC.
-
- GC at realloc is not well maintained.
- We need a time to make it safe.
- [ruby-dev:48117]
-
-Tue Apr 22 06:54:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (objspace_malloc_increase): run full mark if 0x04 bit is
- set in ruby_gc_stress. [ruby-core:62103] [Feature #9761]
-
- * gc.c (objspace_malloc_increase): run GC after realloc not only
- malloc and calloc by GC.stress. [ruby-core:62103] [Feature #9761]
-
-Mon Apr 21 19:12:20 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_coderange_scan_restartable): coderange is always
- ENC_CODERANGE_VALID if the string is ASCII-8BIT and already has a non
- ASCII character.
-
-Mon Apr 21 19:02:44 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (coderange_scan): remove useless condition `p < e` after
- search_nonascii.
-
- * string.c (rb_str_coderange_scan_restartable): ditto.
-
-Mon Apr 21 18:55:21 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/-test-/string/coderange.c: add Bug::String.new#coderange_scan
- to explicitly scan coderange.
-
-Mon Apr 21 18:19:35 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (coderange_scan): remove unused logic.
-
- * string.c (rb_str_coderange_scan_restartable): ditto.
-
-Mon Apr 21 14:11:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_putc): fix for non-ascii
- encoding, like as IO#putc. [ruby-dev:48114] [Bug #9765]
-
-Sun Apr 20 12:57:15 2014 Masaya Tarui <tarui@ruby-lang.org>
-
- * st.c (st_foreach_check): change start point of search at check
- from top to current. [ruby-dev:48047] [Bug #9646]
-
-Sun Apr 20 08:41:33 2014 Andrew DeMaria <ademariad@gmail.com>
-
- * lib/mkmf.rb (link_command, libpathflag, create_makefile): prefer
- user specified `$LIBPATH` than `$DEFLIBPATH`. [ruby-core:62100]
- [ruby-trunk - Bug #9760]
-
-Sun Apr 20 06:01:18 2014 Eric Wong <e@80x24.org>
-
- * gc.c (rb_gc_writebarrier): drop special case for big hash/array
- [Bug #9518]
-
-Sat Apr 19 15:38:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (primary): flush cmdarg flags inside left-paren in a
- command argument, to allow parenthesed do-block as an argument
- without arguments parentheses. [ruby-core:61950] [Bug #9726]
-
-Sat Apr 19 10:07:24 2014 Tanaka Akira <akr@fsij.org>
-
- * internal.h (struct RBignum): Use size_t for len.
-
- * include/ruby/intern.h (rb_big_new): Use size_t instead of long to
- specify the size of bignum.
- (rb_big_resize): Ditto.
-
- * bignum.c: Follow above changes.
-
- * rational.c: Follow above changes.
-
- * marshal.c: Follow above changes.
-
-Sat Apr 19 00:32:07 2014 Tanaka Akira <akr@fsij.org>
-
- * numeric.c (rb_num2long): Returns a long.
- (rb_num2ulong): Returns a unsigned long.
-
- * bignum.c (rb_big2long): Returns a long.
- (rb_big2ulong): Returns a unsigned long.
-
- * include/ruby/intern.h: Follow above changes.
-
- * include/ruby/ruby.h: Follow above changes.
- (rb_num2long_inline): No need to cast.
- (rb_num2ulong_inline): Ditto.
-
-Sat Apr 19 00:17:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (SHARABLE_SUBSTRING_P): predicate if substring can be
- shared with the original string. true if just at the end of the
- original string, for the time being. all substring will be able to
- be shared in the future.
-
-Fri Apr 18 21:48:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_new_frozen): consider the shared string at
- middle.
-
- * string.c (rb_str_subseq, rb_str_substr, str_byte_substr): share
- middle of a string.
-
-Fri Apr 18 15:40:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c: use uintptr_t instead of VALUE because they are not ruby
- object.
-
-Fri Apr 18 14:51:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c: check str_strlen's argument, and add comment or
- use NULL if simply it uses str's enc.
-
-Fri Apr 18 14:32:40 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (str_strlen): use enc_strlen if the coderange is known.
-
-Fri Apr 18 14:21:21 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (enc_strlen): move UTF-8 optimization from str_strlen to
- enc_strlen.
-
-Fri Apr 18 08:50:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_getcwd_malloc): check if getcwd allocates
- buffer if NULL is given [ruby-core:62072] [Bug #9752]
-
-Thu Apr 17 16:28:10 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * prelude.rb: [DOC] Update Thread::exclusive docs by @stevenharman.
-
-Thu Apr 17 10:03:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/fileutils.rb (FileUtils#copy_entry): update rdoc about
- preserve option and permissions, following r31123.
- [ruby-core:62065] [Bug #9748]
-
-Wed Apr 16 23:47:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (dont_recycle_block_arg): fix condition to recycle block
- argument. lambda with rest can get internal array directly.
- [ruby-core:62060] [Bug #9749]
-
-Wed Apr 16 09:51:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/ossl_pkey.c (ossl_pkey_verify): as EVP_VerifyFinal()
- finalizes only a copy of the digest context, the context must be
- cleaned up after initialization by EVP_MD_CTX_cleanup() or a
- memory leak will occur. [ruby-core:62038] [Bug #9743]
-
-Tue Apr 15 19:36:42 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/win32.h (rb_w32_cmdvector): removed.
-
- * win32/win32.c (rb_w32_sysinit): use WCHAR version of GetCommandLine()
- internally.
-
- * win32/win32.c (w32_cmdvector): renamed from rb_w32_cmdvector. use
- WCHAR* instead of char* internally.
-
- these changes are expected to not changing the behavior yet.
-
-Tue Apr 15 19:26:05 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/extmk.rb: Re-generate extmk.mk and dummy makefiles only if
- really required.
- This fixes a problem to run multiple test-all concurrently as:
- make test-all & make test-all & make test-all & ...
-
-Tue Apr 15 12:49:53 2014 Sam Rawlins <sam.rawlins@gmail.com>
-
- * enum.c (enum_each_slice, enum_each_cons): make more efficient by
- allocating less and recycling block argument arrays if possible.
- [Fixes GH-596]
-
-Mon Apr 14 18:44:45 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): get base addrs in fill_lines to use it
- with dladdr_fbases introduced at r45563.
- it didn't get before if the executable is not pie.
-
-Mon Apr 14 18:05:48 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (main_exe_path): support FreeBSD.
- At least sh, csh, tcsh, bash, and zsh sets realpath of the main
- executable for dladdr, but gdb doesn't.
-
-Mon Apr 14 17:20:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (umethod_bind): use the ancestor iclass instead of new
- iclass to get rid of infinite recursion, if the defined module
- is already included. [ruby-core:62014] [Bug #9721]
-
-Sun Apr 13 12:46:58 2014 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.
-
- * internal.h: Ditto.
-
- * marshal.c: Ditto.
-
- * rational.c: Ditto.
-
-Sun Apr 13 10:18:09 2014 Tanaka Akira <akr@fsij.org>
-
- * common.mk: Unused target, $(MKMAIN_CMD), removed.
-
- * Makefile.in (MKMAIN_CMD): Unused macro removed.
-
- * win32/Makefile.sub (MKMAIN_CMD): Ditto.
-
-Sat Apr 12 22:11:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (sym_to_proc), proc.c (rb_block_clear_env_self): clear
- caller's self which is useless, so that it can get collected.
- [Fixes GH-592]
-
-Sat Apr 12 09:26:48 2014 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl_ocsp.c: [DOC] Document OpenSSL::OCSP.
-
-Fri Apr 11 18:52:38 2014 Koichi Sasada <ko1@atdot.net>
-
- * array.c (ARY_SET): added.
-
- ARY_SET() is same functionality of RARRAY_ASET(), but
- it has an assertion (`ary' doesn't have shared array).
-
-Fri Apr 11 16:54:26 2014 Koichi Sasada <ko1@atdot.net>
-
- * array.c: make shared arrays WB-protected objects.
-
- Shared arrays were WB-unprotected object because
- sharing array can modify shared array's buffer
- if it occupied shared array.
-
- [sharing array (ary)] -> [shared array (shared)] -> <buff>
- | A
- +---------------------------------------+
- write `buff' with WB(ary, &buff[i], obj)
- -> if `ary' and `shared' are old, then only `ary'
- will be remembered.
- -> traverse from `ary'. But `shared' is old, so
- that written `obj' is not marked.
-
- It cause WB miss so that shared arrays were WB-unprotected.
- (WB-unprotected objects are marked everytime if it is living)
-
- This patch insert WB() for `shared' if it is needed.
-
-Fri Apr 11 15:05:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_method_call_with_block, umethod_bind): call with
- IClass including the module for a module instance method.
- [ruby-core:61936] [Bug #9721]
-
- * vm_insnhelper.c (vm_search_super_method): allow bound
- UnboundMethod case.
-
-Fri Apr 11 12:02:30 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (rb_dump_backtrace_with_lines): set base address
- which is retrieved from dladdr to dladdr_fbases, to skip already
- parsed objects.
-
-Fri Apr 11 12:44:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (ary_reject): may be turned into a shared array during
- the given block. [ruby-dev:48101] [Bug #9727]
-
-Thu Apr 10 23:41:21 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/net/ftp.rb (Net::FTP#login): [DOC] The default password for
- anonymous login was changed to "anonymous@" in r25313.
-
-Thu Apr 10 19:22:58 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_array.rb: remove useless `assert'.
-
-Thu Apr 10 19:11:11 2014 Koichi Sasada <ko1@atdot.net>
-
- * array.c (rb_ary_modify): remember shared array owner if a shared
- array owner is promoted and a shared array is not promoted.
-
- Now, shared array is WB-unprotected so that shared arrays are not
- promoted. All objects referred from shared array should be marked
- correctly.
-
- [ruby-core:61919] [ruby-trunk - Bug #9718]
-
- * test/ruby/test_array.rb: add a test for above.
-
-Thu Apr 10 18:57:12 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_verify_internal_consistency): move lines and enable
- allrefs_dump() on RGENGC_CHECK_MODE >= 4.
-
-Thu Apr 10 15:01:06 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (append_obj): clear allocated memory.
-
- * addr2line.c (rb_dump_backtrace_with_lines): free `base_addrs'.
-
-Thu Apr 10 14:40:18 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (rb_gc_writebarrier_unprotect_promoted): disable to dump debug
- message when RGENGC_CHECK_MODE == 0.
-
-Thu Apr 10 08:13:47 2014 Tanaka Akira <akr@fsij.org>
-
- * signal.c (check_stack_overflow): Don't use ucontext_t if ucontext.h
- is not available.
- Fixes build on Android (x86).
-
-Wed Apr 9 23:22:44 2014 Tanaka Akira <akr@fsij.org>
-
- * gc.c (mark_current_machine_context): Call SET_STACK_END.
- This reverts a hunk of r40703 by ko1.
- This fixes [ruby-dev:48098] [Bug #9717].
-
-Wed Apr 9 21:02:04 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (OBJ2UID1): Defined even if getpwnam_r is not usable.
- (OBJ2GID1): Defined even if getgrnam_r is not usable.
- This fixes compilation error on Android.
-
-Wed Apr 9 15:16:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (rb_enc_default_internal): fix rdoc. `__FILE__` is
- in filesystem encoding but not `default_internal`.
- [ruby-core:61894] [Bug #9713]
-
-Wed Apr 9 14:43:00 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb: more long timeout.
- This test failed under RGENGC_CHECK_MODE >= 2.
-
-Wed Apr 9 13:07:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: get rid of __builtin_setjmp/__builtin_longjmp on
- x64-mingw, which causes SEGV with callcc.
- [ruby-core:61887] [Bug #9710]
-
-Wed Apr 9 12:44:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_buf_cat): should round up the capacity by 4KiB,
- but not number of rooms. [ruby-core:61886] [Bug #9709]
-
-Tue Apr 8 22:55:32 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/mkmf.rb (MakeMakefile#dir_config): [DOC] Improve
- documentation.
-
-Tue Apr 8 22:31:44 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: rename `RGENGC_THREEGEN' to `RGENGC_AGE2_PROMOTION'.
-
- * gc.c (rgengc_rememberset_mark): don't promote, but remain in
- remember set for infant objects.
-
- * gc.c (RVALUE_PROMOTE_INFANT, RVALUE_PROMOTE_YOUNG): count numbers
- in these functions.
-
-Mon Apr 7 21:11:49 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (sock_s_getnameinfo): Save errno for EAI_SYSTEM.
- Reported by Saravana kumar. [ruby-core:61820] [Bug #9697]
- Fixed by Heesob Park. [ruby-core:61868]
-
-Mon Apr 7 07:20:23 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/xmlrpc/client.rb (do_rpc): don't check body length.
- If HTTP content-encoding is used, the length may be different.
- [Bug #8182] [ruby-core:53811]
-
-Mon Apr 7 02:39:48 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Add Matrix#cofactor [fix GH-568]
- Add first_minor [fix GH-568]
- Handle empty diagonal matrix case [fix GH-576]
- Patches by gogotanaka
-
-Sun Apr 6 08:52:50 2014 Bugra Barin <bugrabarin@hotmail.com>
-
- * dln.c (dln_load): use wchar version to load a library in
- non-ascii path on Windows. based on the patch by Bugra Barin
- <bugrabarin AT hotmail.com> in [ruby-core:61845]. [Bug #9699]
-
-Sat Apr 5 19:36:33 2014 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c (d_lite_cmp): should compare with #<.
-
-Sat Apr 5 00:31:21 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/extconf.rb (rl_hook_func_t): check pointer type.
- [ruby-dev:48089] [Bug #9702]
-
-Fri Apr 4 07:13:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (ac_cv_func___builtin_setjmp): should not skip
- flags restoration in RUBY_WERROR_FLAG by `break`.
- [ruby-dev:48086] [Bug #9698]
-
-Wed Apr 2 21:50:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp()
- in Apple LLVM 5.1 (LLVM 3.4svn) uses `void**`, not `jmp_buf`.
- [Bug #9692]
-
-Wed Apr 2 20:57:15 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c, gc.h (rb_objspace_each_objects_without_setup):
- Add a new (hidden) C-API to iterate objspace snapshot.
-
- This API is not safe to call any C-APIs in a given callback
- function. Be careful to use this C-API.
-
-Wed Apr 2 17:43:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (ac_cv_func___builtin_setjmp): gcc 4.9 disallows a
- variable as the second argument of __builtin_longjmp().
- [ruby-core:61800] [Bug #9692]
-
-Wed Apr 2 15:12:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * common.mk: Use redmine-2.x url for DeveloperHowto wiki.
- [ruby-core:60657] [Bug #9511]
-
-Wed Apr 2 11:46:29 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/pathname/lib/pathname.rb (Pathname#join): Fix error with
- empty args. Reported by ko1 via IRC.
-
- * test/pathname/test_pathname.rb (TestPathname#test_join): Add the
- test for above case.
-
-Tue Apr 1 11:39:57 2014 James Edward Gray II <james@graysoftinc.com>
-
- * lib/csv.rb: Symbol HeaderConverter: strip leading/trailing space.
- Reported by Skye Shaw
- [Fixes GH-575]
-
-Tue Apr 1 11:34:04 2014 James Edward Gray II <james@graysoftinc.com>
-
- * lib/csv.rb: Don't attempt to convert nil headers.
- Reported by Skye Shaw
-
-Tue Apr 1 17:29:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/config_files.rb (ConfigFiles.download): show failed URI.
- [ruby-core:61792] [Bug #9690]
-
-Tue Apr 1 12:06:49 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (rb_dump_backtrace_with_lines): don't depend hard coded
- symbol '_start'.
-
- * addr2line.c (fill_lines): instead of above, get a dynamic symbol
- in the main executable and use it to know the base address.
-
- * addr2line.c (follow_debuglink0): use obj_info_t instead of
- line_info_t to handle object related data.
-
- * addr2line.c (main_exe_path): defined for Linux.
-
-Tue Apr 1 08:58:39 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbol
- is before sweeping.
-
-Tue Apr 1 07:37:00 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): use dynsym, which is used for dynamic
- linking and always exists, if there's no symtab.
-
-Tue Apr 1 07:27:15 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_dump.c (rb_print_backtrace): current implementation
- uses dladdr to get the path of objects.
-
-Mon Mar 31 23:57:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/extconf.rb: fix typo, `$defs` not `$DEFS`.
- [ruby-core:61756] [Bug #9578]
-
-Mon Mar 31 17:23:50 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/memory_status.rb: require envutil before accessing EnvUtil
- module. reported by ko1 via twitter.
-
-Mon Mar 31 10:28:01 2014 Eric Wong <e@80x24.org>
-
- * st.c (st_init_table_with_size): update comment
- [Feature #9425]
-
-Sun Mar 30 23:39:26 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_accept, open_ifs_socket, socketpair_internal):
- reset inherit flag of socket to avoid unintentional inheritance of
- socket. note that the return value of SetHandleInformation() is not
- verified intentionally because old Windows may return an error.
- [Bug #9688] [ruby-core:61754]
-
-Sat Mar 29 13:04:22 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_before_sweep): cap `malloc_limit' to
- gc_params.malloc_limit_max. It can grow and grow with such case:
- `loop{"a" * (1024 ** 2)}'
- [Bug #9687]
-
- This issue is pointed by Tim Robertson.
- http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/
-
-Fri Mar 28 19:32:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * struct.c (not_a_member): extract name error and use same error
- messages. based on the patch by Marcus Stollsteimer <sto.mar AT
- web.de> at [ruby-core:61721]. [Bug #9684]
-
-Fri Mar 28 09:21:54 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/psych/psych.gemspec: update gemspec for psych-2.0.5
-
-Fri Mar 28 09:11:06 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * ext/psych/lib/psych.rb: Merge psych-2.0.5. bump version to
- libyaml-0.1.6 for CVE-2014-2525.
- * ext/psych/yaml/config.h: ditto.
- * ext/psych/yaml/scanner.c: ditto.
- * ext/psych/yaml/yaml_private.h: ditto.
-
-Thu Mar 27 18:58:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * re.c (match_regexp): set regexp for MatchData from string.
-
- * re.c (rb_backref_set_string): create MatchData from string and
- set backref.
-
- * string.c (rb_pat_search, rb_str_sub, rb_str_sub_bang, str_gsub),
- (scan_once, rb_str_scan, rb_str_partition): use rb_str_index
- instead of rb_reg_search() when pattern is a String. based on
- the patch by Sam Rawlins <sam.rawlins@gmail.com> [Fixes GH-579]
-
-Thu Mar 27 11:58:55 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): check shdr[i].sh_type because even if
- .symtab section exists, the section's type can be SHT_NOBITS and
- actual data doesn't exist in the file.
- revert r45441.
-
-Wed Mar 26 14:57:35 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * parse.y: inline must be static (for mswin).
- fixed build error introduced at r45426.
-
-Wed Mar 26 14:33:00 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * internal.h (USE_SYMBOL_GC): enable Symbol GC by default (USE_SYMBOL_GC == 1).
-
-Tue Mar 25 22:57:11 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * parse.y: support Symbol GC. [ruby-trunk Feature #9634]
- See this ticket about Symbol GC.
-
- * include/ruby/ruby.h:
- Declare few functions.
- * rb_sym2id: almost same as old SYM2ID but support dynamic symbols.
- * rb_id2sym: almost same as old ID2SYM but support dynamic symbols.
- * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not
- pin down a dynamic symbol.
- Declare a new struct.
- * struct RSymbol: represents a dynamic symbol as object in
- Ruby's heaps.
- Add few macros.
- * STATIC_SYM_P: check a static symbol.
- * DYNAMIC_SYM_P: check a dynamic symbol.
- * RSYMBOL: cast to RSymbol
-
- * gc.c: declare RSymbol. support T_SYMBOL.
-
- * internal.h: Declare few functions.
- * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this
- function at a sweep phase.
- * rb_str_dynamic_intern: convert a string to a dynamic symbol.
- * rb_check_id_without_pindown: not pinning function.
- * rb_sym2id_without_pindown: ditto.
- * rb_check_id_cstr_without_pindown: ditto.
-
- * string.c (Init_String): String#intern and String#to_sym use
- rb_str_dynamic_intern.
-
- * template/id.h.tmpl: use LSB of ID as a flag for determining a
- static symbol, so we shift left other ruby_id_types.
-
- * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
- avoid pinning.
-
- * load.c: use xx_without_pindown function at creating temporary ID
- to avoid pinning.
-
- * object.c: ditto.
-
- * sprintf.c: ditto.
-
- * struct.c: ditto.
-
- * thread.c: ditto.
-
- * variable.c: ditto.
-
- * vm_method.c: ditto.
-
-Wed Mar 26 13:25:54 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): loop reverse order not to overwrite
- the basis of base addresses comparison.
-
- * addr2line.c: use uintptr_t instead of intptr_t for pointers.
-
- * addr2line.c (rb_dump_backtrace_with_lines): don't use syms.
-
- * vm_dump.c (rb_print_backtrace): ditto.
-
- * addr2line.h: ditto.
-
-Wed Mar 26 11:20:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_object): internal objects are not dumpable.
- [ruby-core:61677] [Bug #9674]
-
- * ext/thread/thread.c (undumpable): ConditionVariable and Queue
- are not dumpable. [ruby-core:61677] [Bug #9674]
-
-Wed Mar 26 10:36:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (follow_debuglink): show message if it closes opened
- (and maybe used) elf binary.
-
-Wed Mar 26 10:34:25 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_line): pass and use offset instead of
- curobj_baseaddr.
-
-Wed Mar 26 09:07:48 2014 Yutaka Kanemoto <kanemoto@ruby-lang.org>
-
- * configure.in: add --disable-pie. [Feature #9673]
-
-Wed Mar 26 08:47:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): don't run fill_lines multiple times.
-
-Wed Mar 26 08:45:00 2014 Sam Rawlins <sam.rawlins@gmail.com>
-
- * internal.h: add prototype for rb_reg_search0
-
- * re.c: rename rb_reg_search to rb_reg_search0, add set_backref_str
- argument to allow callers to indicate that they don't require the
- backref string to be allocated.
-
- * string.c: don't allocate backref str if replacement string is provided
-
- [GH-578] [Bug #9676] [ruby-core:61682]
-
-Wed Mar 26 08:29:43 2014 mo khan <mo@mokhan.ca>
-
- * lib/rubygems.rb: fix spelling of Jim Weirich. [Fixes GH-577]
-
-Wed Mar 26 01:55:45 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (rb_dump_backtrace_with_lines): a function to get must
- be a function in the main executable, whose absolute path is not
- available by dladdr, and ruby get it by /proc/self/exe on Linux.
-
-Wed Mar 26 01:34:50 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): skip if path is NULL.
-
-Tue Mar 25 23:57:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): only a newline after label should be
- significant. [ruby-core:61658] [Bug #9669]
-
-Tue Mar 25 23:32:25 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/pathname/lib/pathname.rb (Pathname#join): remove unnecessary
- unshift.
-
- * test/pathname/test_pathname.rb (TestPathname#test_join): add tests.
-
-Tue Mar 25 16:47:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (lex_state_e, parser_params, f_arglist, parser_yylex):
- separate EXPR_LABELARG from EXPR_BEG and let newline significant,
- so that required keyword argument can place at the end of
- argument list without parentheses. [ruby-core:61658] [Bug #9669]
-
-Mon Mar 24 22:19:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (ripper_initialize): filename can not be modified.
-
-Mon Mar 24 15:19:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (rb_dump_backtrace_with_lines): fetch path of the
- executable from /proc/self/exe on Linux.
-
-Mon Mar 24 14:14:37 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * gc.c: Fix up default GC params by @csfrancis [fix GH-556]
-
-Mon Mar 24 13:13:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (parse_debug_line_cu): explicitly specify signed char
- because DWARF's line_Base is signed char and char maybe unsigned.
- patched by Rei Odaira. [ruby-dev:48068] [Bug #9654]
-
-Sun Mar 23 11:03:50 2014 Kohei Suzuki <eagletmt@gmail.com>
-
- * vm_method.c (rb_method_entry_get_without_cache): me->klass is 0
- for a method aliased in a module. [ruby-core:61636] [Bug #9663]
-
-Sun Mar 23 08:12:27 2014 Eric Wong <e@80x24.org>
-
- * st.c (hash_pos): use bitwise AND to avoid slow modulo op
- (new_size): power-of-two sizes for hash_pos change
- (st_numhash): adjust for common keys due to lack of prime modulo
- [Feature #9425]
- * hash.c (rb_any_hash): right shift for symbols
- * benchmark/bm_hash_aref_miss.rb: added to show improvement
- * benchmark/bm_hash_aref_sym_long.rb: ditto
- * benchmark/bm_hash_aref_str.rb: ditto
- * benchmark/bm_hash_aref_sym.rb: ditto
- * benchmark/bm_hash_ident_num.rb: added to prevent regression
- * benchmark/bm_hash_ident_obj.rb: ditto
- * benchmark/bm_hash_ident_str.rb: ditto
- * benchmark/bm_hash_ident_sym.rb: ditto
-
-Sat Mar 22 22:56:45 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): compare the file names of object in which
- symbols exist. [Bug #9654] [ruby-dev:48058]
-
-Sat Mar 22 06:46:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/cgi/util.rb (escape_html, unescape_html): make synonyms
- aliases instead of wrapper methods.
-
- * lib/cgi/util.rb (escape_element, unescape_element): ditto.
- [Fixes GH-573]
-
-Fri Mar 21 21:57:34 2014 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in: Fix a build problem with clang and --with-opt-dir.
- If ruby is configured with --with-opt-dir=dir when using clang
- as compiler, a warning `clang: warning: argument unused during
- compilation: '-I dir'` is emitted almost every time clang
- compiles a file. Unfortunately, RUBY_CHECK_PRINTF_PREFIX takes
- any output from the compiler as fatal error, and the check thus
- fails due to the warning. This is an attempt to fix the problem
- by adding a flag -Qunused-arguments to CFLAGS locally in the
- function to suppress the warning. [ruby-dev:48062] [Bug #9658]
- [Fixes GH-571] https://github.com/ruby/ruby/pull/571
-
-Fri Mar 21 16:31:56 2014 Zachary Scott <e@zzak.io>
-
- * gc.c: [DOC] Fix call-seq for GC.start by @jasonrclark [Fixes GH-572]
- https://github.com/ruby/ruby/pull/572
-
-Thu Mar 20 11:37:28 2014 James Edward Gray II <james@graysoftinc.com>
-
- * lib/csv.rb: Fixed a broken regular expression that was causing
- CSV to miss escaping some special meaning characters when used
- in parsing.
- Reported by David Unric
- [ruby-core:54986] [Bug #8405]
-
-Thu Mar 20 16:53:07 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (objspace_malloc_increase): should not invoke
- garbage_collect_with_gvl() here on non-ruby threads.
-
- Should just ignore the malloc_increase.
-
- This issue is pointed by Eric Wong [ruby-core:61519].
-
-Thu Mar 20 13:05:16 2014 Koichi Sasada <ko1@atdot.net>
-
- * struct.c (rb_struct_alloc): use RARRAY_CONST_PTR() instead of
- RARRAY_PTR().
-
-Thu Mar 20 12:59:39 2014 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/intern.h (rb_obj_call_init, rb_class_new_instance):
- constify a parameter (VALUE *).
- I believe this incompatibility doesn't break any code.
- However, if you have trouble, please tell us.
-
- * eval.c, object.c: ditto.
-
-Thu Mar 20 12:31:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_method_entry_get_without_cache): get rid of
- infinite recursion at aliases in a subclass and a superclass.
- return actually defined class for other than singleton class.
- [ruby-core:60431] [Bug #9475]
-
-Wed Mar 19 17:13:06 2014 Eric Wong <e@80x24.org>
-
- * time.c (time_mload): freeze and preserve marshal-loaded time zone
- * test/ruby/test_time.rb: add test for GC on loaded object
- [Bug #9652]
-
-Tue Mar 18 23:20:12 2014 Shota Fukumori <her@sorah.jp>
-
- * vm_eval.c (eval_string_with_cref): Unify to use NIL_P.
-
-Tue Mar 18 22:03:41 2014 Shota Fukumori <her@sorah.jp>
-
- * vm_eval.c (eval_string_with_cref): Use file path even if scope is
- given. Related to [ruby-core:56099] [Bug #8662] and r42103.
-
-Mon Mar 17 13:17:47 2014 Koichi Sasada <ko1@atdot.net>
-
- * enumerator.c (enumerator_block_call): use RARRAY_CONST_PTR()
- instead of RARRAY_PTR().
-
- * io.c (rb_io_s_popen): ditto.
-
- * numeric.c (num_step_size): ditto.
-
- * vm_eval.c (rb_apply): ditto.
-
- * vm_eval.c (rb_eval_cmd): ditto.
-
-Mon Mar 17 10:11:59 2014 Eric Wong <e@80x24.org>
-
- * variable.c (rb_const_set): delete existing entry on redefinition
- [Bug #9645]
- * test/ruby/test_const.rb (test_redefinition): test for leak
-
-Sun Mar 16 21:33:01 2014 Zachary Scott <e@zzak.io>
-
- * lib/time.rb: [DOC] Fix timezone in example of Time.parse [Bug #9521]
- Based on patch by @stomar
-
-Sun Mar 16 13:21:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (DLDFLAGS): insert a space between option and its
- argument for non-GCC compilers. [ruby-core:61429] [Bug #9624]
-
-Sun Mar 16 08:05:06 2014 Eric Wong <e@80x24.org>
-
- * gc.c (objspace_xcalloc): fix GC accounting
-
-Sun Mar 16 06:33:35 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): return address is just after calling
- address. Therefore noreturn function with tail call's return
- address may be in another function.
-
-Sun Mar 16 05:51:55 2014 Zachary Scott <e@zzak.io>
-
- * lib/gserver.rb: [DOC] Fixed typo in example by @stomar [Bug #9543]
-
-Sat Mar 15 18:54:03 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/.document: remove refinement from documentable directories.
-
-Sat Mar 15 11:02:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (DLDFLAGS): check for each options to control
- symbol resolution. [ruby-core:61429] [Bug #9624]
-
-Sat Mar 15 07:02:35 2014 Eric Wong <e@80x24.org>
-
- * st.c (st_update): remove unnecessary assignment
-
-Fri Mar 14 14:58:38 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (fill_lines): fetch symbol names from ELF binary's
- symbol table if it is built with cc -g and not stripped.
- Now ruby can show static symbols on Linux though glibc's
- backtrace_symbols(3) don't show them.
-
- * addr2line.c (rb_dump_backtrace_with_lines): use dladdr(3) to
- detect what object file declares the symbol because
- dl_iterate_phdr can't detect the main executable file
- and codes on the stack.
- NOTE: signal trampolines sometimes on the user stack. (FreeBSD)
-
- * addr2line.c (rb_dump_backtrace_with_lines): stop showing
- backtrace if the function's name is main.
- NOTE: FreeBSD's backtrace (libexecinfo) shows _start and
- an additional address. Why it doesn't remove them on dladdr phase
- is, dladdr may fail to detect the main function but detect
- as _start function. Therefore it must be after scanning
- the symbol table and getting correct name.
-
-
-Fri Mar 14 12:07:46 2014 Zachary Scott <e@zzak.io>
-
- * doc/syntax/literals.rdoc: [DOC] Single quote strings allows escape
- of backslash as well, patch by @idupree [Fixes GH-553]
- https://github.com/ruby/ruby/pull/553
-
-Fri Mar 14 01:18:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (invoke_block_from_c): add splattable argument.
-
- * vm.c (vm_invoke_proc): disallow to splat when directly invoked.
-
- * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_callee_setup_arg):
- relax arity check of yielded lambda. [ruby-core:61340] [Bug #9605]
-
- * test/ruby/test_yield.rb (TestRubyYieldGen#emu_bind_params): no
- longer raise ArgumentError when splatting to lambda.
-
-Thu Mar 13 23:51:02 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/-test-/win32/dln/libdlntest.c (dlntest_ordinal): no need to
- specify export in the source file because .def file do it.
- get rid of warning on linking.
-
-Wed Mar 12 11:19:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_arg): disable fastpath if splat
- argument, since argc may differ for each calls.
- [ruby-core:61422] [Bug #9622]
-
- * vm_insnhelper.c (vm_callee_setup_arg): turn a macro into an
- inline function.
-
-Wed Mar 12 07:26:05 2014 Eric Wong <e@80x24.org>
-
- * insns.def (opt_regexpmatch2): respect redefined match op
- Thanks to Sam Rawlins for the fix.
- * test/ruby/test_string.rb: test based on Tsuyoshi Sawada's report
- [Bug #9581]
-
-Tue Mar 11 22:31:25 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/.document: add objspace/objspace_dump.c to document file.
-
-Tue Mar 11 22:22:38 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/objspace/test_objspace.rb (TestObjSpace#test_dump_uninitialized_file):
- remove dependency on json library.
-
-Tue Mar 11 10:55:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * README.EXT{,.ja} (Appendix B): update contents of `ruby_options`
- and replace `ruby_run` with `ruby_run_node`. based on the patch
- by Kaneko Yuichiro at [ruby-dev:48030] [Bug #9619].
-
-Tue Mar 11 06:54:00 2014 Scott Francis <scott.francis@shopify.com>
-
- * ext/objspace/objspace_dump.c: Check fptr before trying to dump RFILE
- object fd. [GH-562]
-
- * test/objspace/test_objspace.rb: add test
-
-Tue Mar 11 02:04:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_dump.c (rb_vm_bugreport): show vm maps on FreeBSD.
-
- * vm_dump.c (procstat_vm): copied from FreeBSD.
- http://svnweb.freebsd.org/base/head/usr.bin/procstat/procstat_vm.c?revision=261780
-
-Mon Mar 10 12:14:26 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: always check dladdr(1).
-
- * addr2line.c (fill_lines): show the line number in C backtrace if
- ruby is built without --enable-shared (PIE) on Linux.
- patch is originally by Shinichiro Hamaji
- https://twitter.com/shinh/status/441957774264504321
- NOTE: ld doesn't insert __executable_start for PIE.
- dladdr(3)'s argument must be a function pointer.
-
-Mon Mar 10 10:51:17 2014 ksss <co000ri@gmail.com>
-
- * test/ruby/test_enumerator.rb (test_iterators): fix test for hash
- iterators. [Fixes GH-558]
-
-Sun Mar 9 14:14:49 2014 Eric Wong <e@80x24.org>
-
- * class.c (rb_class_subclass_add): use xmalloc
- * class.c (rb_module_add_to_subclasses_list): ditto
- * class.c (rb_class_remove_from_super_subclasses): use xfree
- * class.c (rb_class_remove_from_module_subclasses): ditto
- [Bug #9616]
-
-Sun Mar 9 13:51:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/fiddle/function.c (function_call): fix memory leak when an
- exception occurs at argument conversion or the function call.
-
-Sun Mar 9 06:42:40 2014 Eric Wong <e@80x24.org>
-
- * variable.c (struct global_variable): shrink by 8 bytes on 64-bit
-
-Sat Mar 8 17:42:51 2014 Eric Wong <e@80x24.org>
-
- * vm.c (add_opt_method): cleanup to use rb_method_entry_at
-
-Sat Mar 8 13:46:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/cptr.c (dlptr_free), ext/dl/handle.c (dlhandle_free),
- ext/fiddle/handle.c (fiddle_handle_free),
- ext/fiddle/pointer.c (fiddle_ptr_free): fix memory leak.
- based on the patch Heesob Park at [ruby-dev:48021] [Bug #9599].
-
-Sat Mar 8 13:30:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (obj2uid, obj2gid): now getpwnam_r() and getgrnam_r()
- may need larger buffers than sysconf values, so retry with
- expanding the buffer when ERANGE is returned.
- [ruby-core:61325] [Bug #9600]
-
-Fri Mar 7 19:29:13 2014 Eric Wong <e@80x24.org>
-
- * vm_eval.c (vm_call0_body): use RARRAY_CONST_PTR
- (check_funcall_exec): ditto
- [ruby-core:61360]
-
-Fri Mar 7 19:14:11 2014 Eric Wong <e@80x24.org>
-
- * vm_eval.c (vm_call0_body): fix RB_GC_GUARD location
- (check_funcall_exec): ditto
- [Bug #9609]
-
-Fri Mar 7 14:48:17 2014 Narihiro Nakamura <authornari@gmail.com>
-
- * parse.y (ENC_SINGLE): Unused macro removed.
-
-Fri Mar 7 12:06:19 2014 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * test/openssl/test_ssl.rb: Reuse TLS default options from
- OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.
-
-Thu Mar 6 15:15:24 2014 Zachary Scott <e@zzak.io>
-
- * doc/syntax/assignment.rdoc: [DOC] Fix assignment directions
- By @idupree [Fixes GH-555] https://github.com/ruby/ruby/pull/555
-
-Thu Mar 6 15:07:18 2014 Zachary Scott <e@zzak.io>
-
- * doc/syntax/methods.rdoc: [DOC] Fix example for block arguments
- By @idupree [Fixes GH-554] https://github.com/ruby/ruby/pull/554
-
-Thu Mar 6 10:33:31 2014 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * lib/openssl/ssl.rb: Explicitly whitelist the default
- SSL/TLS ciphers. Forbid SSLv2 and SSLv3, disable
- compression by default.
- Reported by Jeff Hodges.
- [ruby-core:59829] [Bug #9424]
-
-Wed Mar 5 15:56:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (f_arg_asgn): define optional arguments as argument
- variables in the rhs default expressions.
- [ruby-core:61299] [Bug #9593]
-
-Wed Mar 5 11:58:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/ossl.c (ossl_make_error): check NULL for unknown
- error reasons with old OpenSSL, and insert a colon iff formatted
- message is not empty.
-
-Wed Mar 5 00:42:00 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/pathname/lib/pathname.rb (Pathname#find): add "ignore_error"
- keyword argument defaulted to true as well as Find#find.
-
-Tue Mar 4 23:00:18 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_eval.rb (TestEval#make_test_binding): renamed.
- it's not test method.
-
-Tue Mar 4 20:50:59 2014 Masaya Tarui <tarui@ruby-lang.org>
-
- * st.c (st_foreach): fix type of hash. not st_data_t but st_index_t.
-
-Tue Mar 4 19:41:40 2014 Tanaka Akira <akr@fsij.org>
-
- * Makefile.in: ".DEFAULT" target removed because it is not for
- specifying default target.
-
-Tue Mar 4 00:25:35 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * lib/find.rb (Find#find): should pass ignore_error option to enumerators.
-
-Mon Mar 3 13:27:35 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/test_find.rb (TestFind#test_unsearchable_dir): ruby cannot make
- directory unreachable by owner on Windows.
-
-Mon Mar 3 08:10:04 2014 Eric Wong <e@80x24.org>
-
- * vm_method.c (rb_method_entry_get_without_cache): disable GMC
- writing if GMC is disabled.
- [ruby-core:61218]
-
-Mon Mar 3 07:47:17 2014 Eric Wong <e@80x24.org>
-
- * README.EXT: wrap GetDBM with do/while(0)
- * README.EXT.ja: ditto
- * ext/dbm/dbm.c: ditto, likewise for GetDBM2
- * ext/gdbm/gdbm.c: ditto
- * ext/sdbm/init.c: ditto
- [ruby-core:61217]
-
-Mon Mar 3 07:17:31 2014 Zachary Scott <e@zzak.io>
-
- * NEWS: [DOC] Update doc regarding filesystem load when flushing IO
-
-Mon Mar 3 04:37:50 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_io_fsync): need to fsync even if on Windows. fixed mistake
- of r45254 and r45256.
-
-Mon Mar 3 04:21:34 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/win32ole: get rid of warnings (unused variable).
-
-Mon Mar 3 02:53:53 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_io_flush_raw): [EXPERIMENTAL] remove force syncing for Win32
- to speed up IO. this may break some tests, and they'll be fixed
- later.
- [ruby-core:58570] [Bug #9153]
-
-Mon Mar 3 00:17:43 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_backtrace.rb: get rid of warnings. unused variable,
- shadowing.
-
-Sun Mar 2 11:15:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/find.rb (Find#find): add "ignore_error" keyword argument
- defaulted to true. [ruby-core:51025] [Feature #7596]
-
-Sun Mar 2 11:13:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/extconf.rb (rl_hook_func_t): define as Function for
- very old readline versions. [ruby-core:61209] [Bug #9578]
-
-Sun Mar 2 10:47:58 2014 Eric Wong <e@80x24.org>
-
- * load.c (ruby_init_ext): make idempotent to suppress warnings
-
-Sat Mar 1 19:51:42 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/open3.rb (Open3.capture3): Ignore Errno::EPIPE for writing
- stdin_data.
- (Open3.capture2): Ditto.
- (Open3.capture2e): Ditto.
-
-Sat Mar 1 19:06:47 2014 Eric Wong <e@80x24.org>
-
- * gc.c (ruby_gc_set_params): simplify condition
-
-Sat Mar 1 16:18:40 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/readline/readline.c (Init_readline): Use rl_hook_func_t instead
- of Function to support readline-6.3. (rl_hook_func_t is available
- since readline-4.2.)
- Reported by Dmitry Medvinsky. [ruby-core:61141] [Bug #9578]
-
-Sat Mar 1 16:05:58 2014 Eric Wong <e@80x24.org>
-
- * gc.c (ruby_gc_set_params): fix building without RGenGC
-
-Sat Mar 1 11:08:00 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: support dumping Encoding
- objects.
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: support loading Encoding
- objects.
-
- * test/psych/test_encoding.rb: add test
-
- * ext/psych/lib/psych.rb: add version
-
-Sat Mar 1 10:52:34 2014 Zachary Scott <e@zzak.io>
-
- * README.EXT.ja: [DOC] Fix typo "macro macro" @utenmiki [Fixes GH-551]
- https://github.com/ruby/ruby/pull/551
-
-Fri Feb 28 11:16:55 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c: Fix Numeric#step with 0 unit [Bug #9575]
-
-Thu Feb 27 17:59:01 2014 Zachary Scott <e@zzak.io>
-
- * lib/optparse.rb: [DOC] Add example of generating help with optparse.
- Patch by @joelmccracken documenting-ruby/ruby#19
- https://github.com/documenting-ruby/ruby/pull/19
-
-Thu Feb 27 12:10:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * numeric.c (ruby_num_interval_step_size): check signs and get rid
- of implementation dependent behavior of negative division.
- [ruby-core:61106] [Bug #9570]
-
-Thu Feb 27 03:55:45 2014 Zachary Scott <e@zzak.io>
-
- * thread.c: [DOC] Typo in comment for _FORTIFY_SOURCE [Fixes GH-548]
- Patch by @qnet-herwin https://github.com/ruby/ruby/pull/548
-
-Wed Feb 26 18:43:43 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (heap_pages_free_unused_pages): check tomb page availability
- at first.
- And return immediately if we don't touch sorted list any more.
-
-Wed Feb 26 14:10:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (setup_exception): preserve exception class name encoding
- in debug mode messages.
-
- * eval.c (setup_exception): preserve errinfo across calling #to_s
- method on the exception. [ruby-core:61091] [Bug #9568]
-
-Wed Feb 26 01:29:27 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (sym_find): Add Symbol.find(str), which returns whether given
- string is defined as symbol or not. [Feature #7854]
-
-Tue Feb 25 22:52:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/dl/dl.c (rb_dl_realloc): use NUM2SIZET instead of NUM2INT.
-
- * ext/fiddle/fiddle.c (rb_fiddle_realloc): ditto.
-
-Tue Feb 25 22:49:30 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/dl/dl.c (rb_dl_malloc): use NUM2SIZET instead of NUM2INT.
- Coverity Scan found this bug.
-
- * ext/fiddle/fiddle.c (rb_fiddle_malloc): ditto.
-
-Tue Feb 25 12:06:13 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * win32/Makefile.sub: define PACKED_STRUCT.
-
-Mon Feb 24 21:41:56 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * README.md, README.ja.md: removed (wrong) mode setting for emacs.
-
-Mon Feb 24 20:05:41 2014 Eric Wong <e@80x24.org>
-
- * configure.in: define PACKED_STRUCT_UNALIGNED for x86*
- * timev.h (struct vtm): use PACKED_STRUCT_UNALIGNED
- * time.c (struct time_object): ditto
- [Bug #9558] non-x86 cannot safely access unaligned addresses
-
-Mon Feb 24 18:10:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/fiddle/test_function.rb: remove unused variables.
- * test/fileutils/test_fileutils.rb: ditto.
- * test/io/console/test_io_console.rb: ditto.
-
-Mon Feb 24 12:37:51 2014 Eric Wong <e@80x24.org>
-
- * configure.in: use -Wno-packed-bitfield-compat for GCC 4.4+
- use __attribute__((packed)) if available
- * timev.h: shrink and pack struct vtm
- * time.c: pack struct time_object and adjust/introduce helpers
- [ruby-core:60794]
-
-Sun Feb 23 17:55:50 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/xmltokens.rb: Add missing non ASCII valid characters
- to element name characters. Now, REXML name tokens exactly
- match "[5] Name" in the XML spec and "[4] NCName" in the
- Namespaces in XML spec. See comment about the details.
- [Bug #9539] [ruby-core:60901]
- Reported by Mario Barcala. Thanks!!!
-
- * test/rexml/xpath/test_node.rb: Add tests for the above case.
-
-Sun Feb 23 12:18:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/raddrinfo.c (inet_pton): use rb_w32_inet_pton, instead of
- inet_pton directly, which is unavailable on older version Windows.
-
- * include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a
- wrapper function for inet_pton minimum supported client is
- Vista, as well as inet_ntop.
-
-Sun Feb 23 11:33:25 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/net/imap/test_imap.rb: remove unused variables.
- * test/net/imap/test_imap_response_parser.rb: ditto.
- * test/net/pop/test_pop.rb: ditto.
-
-Sun Feb 23 02:19:51 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (bind_random_port): Rescue EPERM for FreeBSD which
- security.mac.portacl.port_high is changed.
- See mac_portacl(4) for details.
- Reported by Jakub Szafranski. [ruby-core:60917] [Bug #9544]
-
-Sat Feb 22 23:17:01 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/xpath_parser.rb: Fix indent.
-
-Sat Feb 22 23:15:35 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/xpath/test_attribute.rb: Simplify.
-
-Sat Feb 22 20:28:47 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/redmine-backporter.rb: more friendly.
-
-Sat Feb 22 20:24:43 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_xpath*.rb: Move to ...
- * test/rexml/xpath/*.rb: ... here.
-
-Sat Feb 22 20:04:41 2014 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/listener.rb: Untabify.
-
-Sat Feb 22 19:07:31 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/io/console/console.c (console_dev): need read access for conout$
- because some functions need it. [Bug#9554]
-
-Sat Feb 22 18:40:58 2014 Eric Wong <e@80x24.org>
-
- * .gitignore: ignore benchmark files
-
-Sat Feb 22 01:22:24 2014 Yusuke Endoh <mame@tsg.ne.jp>
-
- * bignum.c (bary_mul_precheck): fix a copy-paste error.
- Coverity Scan found this bug.
-
-Sat Feb 22 00:58:51 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/socket/raddrinfo.c (rb_getaddrinfo): second argument of
- MEMZERO is type. Coverity Scan found this bug.
-
-Fri Feb 21 23:47:24 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/socket/init.c (wait_connectable): break if the socket is
- writable to avoid infinite loops on FreeBSD and other platforms
- which conforms to SUSv3. This problem cannot be reproduced with
- loopback interfaces, so it's hard to write test code.
- rsock_connect() and wait_connectable() are overly complicated, so
- they should be refactored, but I commit this fix as a workaround
- for the release of Ruby 1.9.3 scheduled on Feb 24.
- [ruby-core:60940] [Bug #9547]
-
-Fri Feb 21 23:03:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/redmine-backporter.rb: added to handle redmine tickets.
-
-Fri Feb 21 20:42:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_mod_init_copy): do nothing if copying self.
- [ruby-dev:47989] [Bug #9535]
-
- * hash.c (rb_hash_initialize_copy): ditto.
-
-Fri Feb 21 16:45:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/logger.rb (next_rotate_time, previous_period_end): consider
- DST change.
-
- * lib/logger.rb (Logger::LogDevice#check_shift_log): compare the
- current time with the time for the next rotation to fix rotation
- miss when date changed between the comparison and log writing.
- based on the patch by megayu <yuhg2310 AT gmail.com>.
- [Fixes GH-539]
-
-Fri Feb 21 10:39:33 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/monitor/test_monitor.rb: remove unused variables.
- * test/resolv/test_dns.rb: ditto.
- * test/rexml/test_functions.rb: ditto.
- * test/rss/test_setup_maker_itunes.rb: ditto.
-
-Fri Feb 21 09:48:56 2014 Eric Wong <e@80x24.org>
-
- * ext/socket/ancdata.c (bsock_sendmsg_internal): only retry on error
- (bsock_recvmsg_internal): ditto
- * test/socket/test_unix.rb: test above for infinite loop
-
-Fri Feb 21 08:27:19 2014 Eric Wong <e@80x24.org>
-
- * include/ruby/ruby.h (RB_GC_GUARD):
- use rb_gc_guarded_ptr_val on non-GCC/MSC
- * gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
- RB_GC_GUARD should be robust enough for any compiler.
- [ruby-core:60816] [Bug #7805]
-
-Thu Feb 20 22:21:26 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
- Suggested by Eric Wong.
- https://bugs.ruby-lang.org/issues/9525#note-14
-
-Thu Feb 20 11:21:13 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_flatten): fix behavior of flatten(-1).
- [ruby-dev:47988] [Bug #9533]
-
- * test/ruby/test_array.rb: test for above.
-
-Wed Feb 19 18:57:02 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: Bypass getaddrinfo() if node and serv are numeric.
- Reporeted by Naotoshi Seo. [ruby-core:60801] [Bug #9525]
-
- * ext/socket/extconf.rb: Detect struct sockaddr_in6.sin6_len.
-
- * ext/socket/sockport.h (SET_SIN6_LEN): New macro.
- (INIT_SOCKADDR_IN6): Ditto.
-
- * ext/socket/rubysocket.h (struct rb_addrinfo): Add
- allocated_by_malloc field.
-
- * ext/socket/raddrinfo.c (numeric_getaddrinfo): New function.
- (rb_getaddrinfo): Call numeric_getaddrinfo at first.
- (rb_freeaddrinfo): Free struct addrinfo properly when it is
- allocated by numeric_getaddrinfo.
-
-Wed Feb 19 18:31:48 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: Wrap struct addrinfo by struct rb_addrinfo.
-
-Wed Feb 19 17:47:01 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.
-
-Wed Feb 19 11:39:41 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: it must see rb_cv_broken_memmem not rb_cv_func_memmem.
-
-Tue Feb 18 23:18:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/socket/test_socket.rb: unix socket is required by test case.
-
-Tue Feb 18 20:48:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/socket/test_addrinfo.rb: remove unused variables.
- * test/socket/test_nonblock.rb: ditto.
- * test/socket/test_socket.rb: ditto.
- * test/socket/test_unix.rb: ditto.
- * test/testunit/test_parallel.rb: ditto.
- * test/webrick/test_filehandler.rb: ditto.
- * test/xmlrpc/test_features.rb: ditto.
- * test/zlib/test_zlib.rb: ditto.
-
-Tue Feb 18 14:27:18 2014 Shota Fukumori <her@sorah.jp>
-
- * lib/test/unit.rb: Requires minitest < 5.0.0 if Gem is available.
-
-Tue Feb 18 14:24:07 2014 Shota Fukumori <her@sorah.jp>
-
- * lib/test/unit/test-unit.gemspec: Add minitest < 5.0.0 dependency
-
- * tool/rbinstall.rb: Add empty implementations for `add_dependency`,
- `add_runtime_dependency`, `add_development_dependency` for
- Gem::Specification.
-
-Tue Feb 18 12:06:39 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in (FILE_COUNT): Removed. (win32.c defines it in itself.)
- (FILE_READPTR): Ditto.
-
-Tue Feb 18 09:35:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test/psych/test_string.rb: remove unused variables.
- * test/test/psych/test_yaml.rb: ditto.
-
-Mon Feb 17 21:31:31 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_gc.rb: ignore warning messages for running with -w
- option such as chkbuild.
-
-Mon Feb 17 20:00:27 2014 Tanaka Akira <akr@fsij.org>
-
- * internal.h: Move BDIGIT and related definitions from
- include/ruby/defines.h.
-
-Mon Feb 17 17:41:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (marshal_dump, marshal_load): do not recycle wrapper
- objects, to prevent from segfault with continuation.
- [ruby-dev:47970] [Bug #9523]
-
-Mon Feb 17 15:43:59 2014 Zachary Scott <e@zzak.io>
-
- * doc/keywords.rdoc: [DOC] Add keywords doc by documenting-ruby/ruby#29
- https://github.com/documenting-ruby/ruby/pull/29
-
-Mon Feb 17 12:31:31 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (get_envparam_double): fix a warning message.
-
-Mon Feb 17 12:09:52 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c: introduce new environment variable
- "RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" to control major/minor GC
- frequency.
-
- Do full GC when the number of old objects is more than R * N
- where R is this factor and
- N is the number of old objects just after last full GC.
-
- * test/ruby/test_gc.rb: add a test.
-
-Mon Feb 17 11:28:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_pty.rb: ignore warnings to unused variables.
-
-Mon Feb 17 11:27:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_find.rb: remove unused variables.
-
-Sun Feb 17 02:12:00 2014 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto.
-
-Sun Feb 16 15:53:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/test_securerandom.rb: File.exists? is deprecated. use File.exist?
-
-Sun Feb 16 15:05:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/pathname/test_pathname.rb: File.exists? is deprecated. use File.exist?
-
-Sun Feb 16 15:00:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * test/net/ftp/test_ftp.rb: remove unused variables.
- * test/logger/test_logger.rb: ditto.
-
-Sun Feb 16 14:52:46 2014 Eric Wong <e@80x24.org>
-
- * dir.c (dir_s_glob): RB_GC_GUARD instead of volatile
-
-Sun Feb 16 14:33:52 2014 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h (RBIGNUM_SIGN): Defined for compatibility.
- (RBIGNUM_POSITIVE_P): Ditto.
- (RBIGNUM_NEGATIVE_P): Ditto.
-
-Sun Feb 16 12:46:47 2014 Eric Wong <e@80x24.org>
-
- * io.c (rb_f_backquote): trade volatile for manual recycle
- rb_gc_force_recycle ensures object is visible until recycle
-
-Sun Feb 16 11:55:14 2014 Eric Wong <e@80x24.org>
-
- * marshal.c (marshal_dump): use rb_gc_force_recycle for GC-safety
- (marshal_load): ditto
- [ruby-core:60730] [Bug #7805]
-
-Sun Feb 16 08:11:23 2014 Zachary Scott <e@zzak.io>
-
- * README.EXT.ja: [DOC] Fix typo by @utenmiki [Fixes GH-534]
- https://github.com/ruby/ruby/pull/534
-
-Sun Feb 16 07:48:20 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/bigdecimal/bigdecimal.c (BIGNUM_ZERO_P): Unused macro removed.
-
-Sun Feb 16 06:12:23 2014 Tanaka Akira <akr@fsij.org>
-
- * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
- (BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
- (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
- (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
- (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
- (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
- (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
- (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
- (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
- (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
- (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
- (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
- (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
- (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.
-
- * bignum.c: Follow the above change.
-
- * gc.c: Ditto.
-
- * marshal.c: Ditto.
-
- * math.c: Ditto.
-
- * numeric.c: Ditto.
-
- * random.c: Ditto.
-
- * rational.c: Ditto.
-
- * sprintf.c: Ditto.
-
- * ext/-test-/bignum/bigzero.c: Ditto.
-
- * ext/-test-/bignum/intpack.c: Ditto.
-
- * ext/bigdecimal/bigdecimal.c: Ditto.
-
-Sat Feb 15 20:48:49 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in (FILE_READEND): Don't detect it because it is not used.
-
-Sat Feb 15 13:22:28 2014 Eric Wong <e@80x24.org>
-
- * probes_helper.h (RUBY_DTRACE_HOOK): correct type for _id
-
-Sat Feb 15 11:47:47 2014 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_cmp): Avoid bignum allocation for comparison
- between bignum and fixnum.
-
-Sat Feb 15 10:55:12 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * ext/-test-/win32/fd_setsize/depend: fix wrong dependencies.
- [ruby-dev:47253]
-
-Sat Feb 15 00:38:54 2014 Tanaka Akira <akr@fsij.org>
-
- * enum.c: Enumerable#{min,min_by,max,max_by} extended to take an
- optional argument.
- (nmin_cmp): New function.
- (nmin_block_cmp): Ditto
- (nmin_filter): Ditto.
- (nmin_i): Ditto.
- (nmin_run): Ditto.
- (enum_min): Call nmin_run if the optional argument is given.
- (nmin_max): Ditto.
- (nmin_min_by): Ditto.
- (nmin_max_by): Ditto.
-
- * range.c: Range#{min,max} extended to take an optional argument.
- (range_min): Call range_first if the optional argument is given.
- (range_max): Call rb_call_super if the optional argument is given.
-
- [ruby-core:57111] [Feature #8887]
-
-Sat Feb 15 00:27:46 2014 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/ruby.h,
- internal.h,
- ext/-test-/bignum/bigzero.c: Hide a Bignum definition.
- [ruby-core:42891] [Feature #6083]
-
-Sat Feb 15 00:13:14 2014 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h,
- include/ruby/io.h,
- include/ruby/ruby.h,
- include/ruby/win32.h,
- include/ruby/backward/rubysig.h,
- bignum.c,
- gc.c,
- io.c,
- process.c,
- safe.c,
- struct.c,
- thread.c,
- ext/socket/rubysocket.h,
- ext/-test-/old_thread_select: Remove deprecated definitions
- [ruby-core:60581] [Feature #9502]
-
-Fri Feb 14 18:38:46 2014 Eric Wong <e@80x24.org>
-
- * string.c (rb_str_format_m): trade volatile for RB_GC_GUARD
- RB_GC_GUARD meaning is clear and has better code generation.
- [ruby-core:60688]
-
-Thu Feb 13 23:30:30 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_method): should check ci->me->flag of
- a refining method in case the method is private.
- [ruby-core:60111] [Bug #9452]
-
- * vm_method.c (make_method_entry_refined): set me->flag of a refined
- method entry to NOEX_PUBLIC in case the original method is private
- and it is refined as a public method. The original flag is stored
- in me->def->body.orig_me, so it's OK to make a refined method
- entry public. [ruby-core:60111] [Bug #9452]
-
- * test/ruby/test_refinement.rb: related tests.
-
-Thu Feb 13 18:38:15 2014 Eric Wong <e@80x24.org>
-
- * re.c (rb_reg_raise): remove volatile
- Unnecessary since r41597
-
-Thu Feb 13 18:28:51 2014 Eric Wong <e@80x24.org>
-
- * re.c (rb_reg_regcomp): remove volatile
- Unnecessary since r13261
-
-Thu Feb 13 16:54:32 2014 Zachary Scott <e@zzak.io>
-
- * test/ruby/test_array.rb: Ensure flatten! is used for test_flatten
- Patch by @ksss [Fixes GH-530] https://github.com/ruby/ruby/pull/530
-
-Thu Feb 13 15:43:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.
-
- * parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also
- attrset ID. [ruby-core:60668] [Bug #8756]
-
-Thu Feb 13 11:06:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check if pthread_setname_np is available.
-
- * thread_pthread.c: pthread_setname_np is not available on old
- Darwins. [ruby-core:60524] [Bug #9492]
-
-Thu Feb 13 00:56:59 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * configure.in: revert r44922. I should have used AC_CHECK_FUNCS()
- to just define a symbol if the function is available.
-
-Thu Feb 13 00:20:58 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * configure.in: use AC_CHECK_FUNC instead of AC_CHECK_FUNCS
- if available.
-
-Thu Feb 13 00:15:10 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * configure.in: fix to undefine HAVE_MEMMEM correctly if it is broken.
-
-Tue Feb 11 23:54:40 2014 Tanaka Akira <akr@fsij.org>
-
- * bignum.c (rb_big_cmp): Specialize a comparison to zero.
-
- * ext/bigdecimal/bigdecimal.c (is_negative): Use rb_big_cmp instead of
- RBIGNUM_NEGATIVE_P.
- (BigMath_s_log): Ditto.
-
-Tue Feb 11 22:59:10 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): Use rb_integer_pack.
- Fix SEGV by OpenSSL::BN.new(1 << (2**34)).
-
-Tue Feb 11 17:00:38 2014 Zachary Scott <e@zzak.io>
-
- * ext/tk/README.tcltklib: [DOC] Fix typo by @xta [Fixes GH-532]
-
-Sun Feb 9 13:59:29 2014 Tanaka Akira <akr@fsij.org>
-
- * configure.in: Fix compilation error.
- https://bugs.ruby-lang.org/issues/8358#note-16
-
-Sun Feb 9 05:20:24 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (rb_cv_gnu_qsort_r): use compile error "conflicting
- types for 'qsort_r'" instead of AC_RUN_IFELSE.
-
-Sun Feb 9 04:07:34 2014 Zachary Scott <e@zzak.io>
-
- * lib/yaml.rb: [DOC] Add links to syck and psych on github [Bug #9501]
- Based on a patch by Giorgos Tsiftsis
-
-Sun Feb 9 02:13:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT),
- marshal.c (r_entry0): all Numerics never be tainted now.
- [ruby-core:57346] [Bug #8945]
-
-Sat Feb 8 23:40:35 2014 Vit Ondruch <vondruch@redhat.com>
-
- * configure.in: add quoting brackets and append wildcard for the
- rest after target_cpu, to properly detect platform for SSE2
- instructions. [ruby-core:60576] [Bug #8358]
-
-Sat Feb 8 21:44:07 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * configure.in: check qsort_r(3) and whether it is GNU version.
- BSD version has different prototype.
-
- * util.h: use qsort_r() as ruby_qsort() if it is GNU version.
-
- * util.c: define ruby_qsort() if needed.
-
-Sat Feb 8 16:34:36 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder#get_labels):
- Make it iterative.
-
-Sat Feb 8 15:54:12 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c, gc.h (rb_objspace_marked_object_p): added.
- This function *ONLY* works just after marking phase,
- before any sweeping.
- This function is highly depending current GC implementation
- and can be removed future version.
-
-Sat Feb 8 15:41:37 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: Don't set CLOEXEC flag explicitly. (Ruby set it by
- default.)
-
-Sat Feb 8 15:27:02 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
- DecodeError if no data before the limit.
- Reported by Will Bryant. [ruby-core:60557] [Bug #9498]
-
-Sat Feb 8 15:11:21 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c (SMALLBUF): Unused macro removed.
-
-Fri Feb 7 23:37:49 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: Ignore name servers which cause EAFNOSUPPORT on
- socket creation.
- Reported by Bjoern Rennhak. [ruby-core:60442] [Bug #9477]
-
-Fri Feb 7 21:58:48 2014 Zachary Scott <e@zzak.io>
-
- * lib/open-uri.rb: [DOC] use lower case version of core classes, same
- as commit r44878, based on patch by Jonathan Jackson [Bug #9483]
-
-Fri Feb 7 21:54:53 2014 Zachary Scott <e@zzak.io>
-
- * ext/ripper/lib/ripper/lexer.rb: [DOC] use lower case version of core
- classes when referring to return value, since we aren't directly
- talking about the class. Patch by Jonathan Jackson [Bug #9483]
-
-Fri Feb 7 05:28:38 2014 Eric Wong <e@80x24.org>
-
- * constant.h: reduce rb_const_entry_t size on 64-bit
- Patch by Adam Avilla [ruby-core:60542] [Feature #9496]
-
-Thu Feb 6 15:27:46 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (get_envparam_int): correct warning messages.
-
- * gc.c (get_envparam_double): ditto.
-
-Thu Feb 6 15:17:30 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (get_envparam_int): don't accept a value equals to lowerbound
- (changed by last commit) because "" or "foo" (not a number) strings
- are parsed as 0. They should be rejected.
-
- * gc.c (get_envparam_double): ditto.
-
-Thu Feb 6 09:00:35 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,
- then set objspace->rgengc.oldmalloc_increase_limit.
- Without this fix, the env variable RUBY_GC_OLDMALLOC_LIMIT
- does not work.
-
- * gc.c (get_envparam_int): accept a value equals to lowerbound.
-
- * gc.c (get_envparam_double): ditto.
-
-Thu Feb 6 08:23:28 2014 Eric Wong <e@80x24.org>
-
- * ext/thread/thread.c (rb_szqueue_max_set): use correct queue and
- limit wakeups. [Bug #9343][ruby-core:60517]
- * test/thread/test_queue.rb (test_sized_queue_assign_max):
- test for bug
-
-Thu Feb 6 07:18:01 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.2.2. Complete history at:
-
- http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.2.2+%2F+2014-02-05
-
- * test/rubygems: ditto.
-
-Wed Feb 5 20:56:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (to_be_skipped_id): ignore anonymous attributes.
-
- * pack.c (Init_pack): use anonymous ID so that associated objects
- do not appear in the packed result.
-
- * parse.y (rb_make_internal_id): return an anonymous ID for
- internal use.
-
-Wed Feb 5 14:41:56 2014 Koichi Sasada <ko1@atdot.net>
-
- * vsnprintf.c: remove duplicated def of `UNINITIALIZED_VAR()'.
-
-Wed Feb 5 14:40:16 2014 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace_dump.c (dump_object): use STR_SHARED_P()
- instead of removed STR_NOCAPA_P() macro.
-
-Wed Feb 5 13:51:33 2014 Koichi Sasada <ko1@atdot.net>
-
- * internal.h, vm_core.h: move LIKELY/UNLIKELY/UNINITIALIZED_VAR()
- macros from vm_core.h to internal.h.
-
- * string.c: remove dependency to "vm_core.h".
-
- * common.mk: ditto.
-
-Wed Feb 5 13:29:01 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly
- because str is not embed.
-
- * string.c (str_replace): remove `FL_SET(str, STR_SHARED)' line
- because STR_SET_SHARED() set STR_SHARED.
-
-Wed Feb 5 13:18:08 2014 Koichi Sasada <ko1@atdot.net>
-
- * internal.h: remove macros STR_NOCAPA and STR_NOCAPA_P().
-
- * string.c (rb_str_resize): remove `STR_SET_NOEMBED(str)' because
- str_make_independent_expand() set NOEMBED flag.
-
- * string.c (rb_str_resize): remove `STR_NOCAPA_P(str)' check because
- `str' is independent (not shared).
-
-Wed Feb 5 12:54:25 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c: refactoring, especially about string flags.
-
- * string.c (STR_UNSET_NOCAPA): removed.
- Use FL_UNSET() with STR_SHARED.
-
- * string.c (rb_str_capacity): check STR_SHARED directly
- because it is not a embed string.
-
- * string.c (rb_str_modify_expand): ditto.
-
- * string.c (rb_str_shared_replace): use STR_SET_SHARED().
-
- * string.c (str_make_independent_expand): remove STR_UNSET_NOCAPA()
- because `str' is not shared string.
-
-Wed Feb 5 12:11:04 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (RESIZE_CAPA): should not resize shared string.
-
-Wed Feb 5 11:46:42 2014 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_mark_children): STR_ASSOC is no longer available.
- Reported by @nagachika.
- http://d.hatena.ne.jp/nagachika/20140204
-
-Wed Feb 5 11:27:22 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c (rb_str_new_frozen): refactoring code.
- * Move code from str_new_frozen_with_klass() (and remove it)
- * `aux.shared' should not be 0 for STR_SHARED strings.
-
-Wed Feb 5 04:23:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: New release of psych.
- * ext/psych/psych.gemspec: ditto
-
-Wed Feb 5 04:16:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/yaml/emitter.c: merge libyaml 0.1.5
- * ext/psych/yaml/loader.c: ditto
- * ext/psych/yaml/parser.c: ditto
- * ext/psych/yaml/reader.c: ditto
- * ext/psych/yaml/scanner.c: ditto
- * ext/psych/yaml/writer.c: ditto
- * ext/psych/yaml/yaml_private.h: ditto
-
-Tue Feb 4 19:10:29 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c: use long allocator names instead of numbered
- allocator names.
- * rb_str_new2 -> rb_str_new_cstr
- * rb_str_new4 -> rb_str_new_frozen
- * rb_str_new5 -> rb_str_new_with_class
- * str_new3 -> str_new_shared
- * str_new4 -> str_new_frozen_with_klass
-
-Tue Feb 4 17:20:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): return the filename with actual cases on
- the filesystem if it is case-insensitive. [ruby-core:42469]
- [Feature #5994]
-
-Tue Feb 4 16:16:58 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c: use STR_SHARED instead of ELTS_SHARED.
- (same value, but more clear meaning)
-
-Tue Feb 4 16:09:14 2014 Koichi Sasada <ko1@atdot.net>
-
- * string.c: remove STR_ASSOC related code.
- By r44804, string objects can not have STR_ASSOC flag.
-
- * internal.h: ditto.
-
- * ext/objspace/objspace_dump.c (dump_object): ditto.
-
-Tue Feb 4 14:07:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * pack.c (str_associate, str_associated): keep associated objects
- in an instance variables, instead of in the internal structure.
-
- * string.c (rb_str_associate, rb_str_associated): deprecate.
-
-Tue Feb 4 12:55:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_modify_expand): enable capacity and disable
- association with packed objects when setting capa, so that
- pack("p") string fails to unpack properly after modified.
-
-Tue Feb 4 12:45:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_make_pattern): all alphabets are magic characters on
- case-insensitive filesystems. [ruby-core:42469] [Feature #5994]
-
-Tue Feb 4 09:47:57 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 2.2.2 prerelease to check fixes to
- CI.
- * test/rubygems: ditto.
-
-Mon Feb 3 12:04:47 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * error.c: [DOC] Exception#cause may return nil. [ci skip]
-
-Sun Feb 2 05:48:42 2014 Eric Wong <e@80x24.org>
-
- * io.c (rb_io_syswrite): add RB_GC_GUARD
- [Bug #9472][ruby-core:60407]
-
-Sat Feb 1 15:09:16 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_typedesc2val): add VT_RECORD case.
-
-Sat Feb 1 06:38:51 2014 Zachary Scott <e@zzak.io>
-
- * lib/drb/drb.rb: [DOC] Add note about start_service for each process
- Based on a patch by @rosenfeld [Fixes GH-514] [ci skip]
- https://github.com/ruby/ruby/pull/514
-
-Sat Feb 1 06:30:20 2014 Zachary Scott <e@zzak.io>
-
- * error.c: [DOC] Document Exception#cause by @jasonrclark [ci skip]
- [Fixes GH-519] https://github.com/ruby/ruby/pull/519
-
-Sat Feb 1 06:10:49 2014 Zachary Scott <e@zzak.io>
-
- * lib/securerandom.rb: [DOC] Add note on require for examples
- Based on a patch by @schneems [Fixes GH-518] [ci skip]
- https://github.com/ruby/ruby/pull/518
-
-Sat Feb 1 06:04:56 2014 Zachary Scott <e@zzak.io>
-
- * numeric.c: [DOC] Fix typo in example for #step [ci skip]
- Patch by @ksss [Fixes GH-522] https://github.com/ruby/ruby/pull/522
-
-Fri Jan 31 17:01:47 2014 Eric Wong <e@80x24.org>
-
- * ext/socket/init.c (rsock_socket0): split out SOCK_CLOEXEC version
- * ext/socket/socket.c (rsock_socketpair0): ditto
- [ruby-core:60377]
-
-Fri Jan 31 03:48:40 2014 Eric Wong <e@80x24.org>
-
- * benchmark/driver: avoid large alloc in driver process
- [ruby-core:59869] [Bug #9430]
-
-Thu Jan 30 14:45:49 2014 Shugo Maeda <shugo@ruby-lang.org>
-
- * configure.in: use $@ instead of $(.TARGET) because .TARGET is not
- supported by GNU make.
-
-Thu Jan 30 08:26:21 2014 Yusuke Endoh <mame@tsg.ne.jp>
-
- * ext/fiddle/closure.c: use sizeof(*pcl) for correct sizeof value.
- [ruby-core:57599] [Bug #8978].
-
-Wed Jan 29 20:08:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (nogvl_copy_stream_sendfile): check socket on other than
- linux, as sendfile(2) on non-socket fd works only on linux.
- [Feature #9427]
-
-Wed Jan 29 18:09:48 2014 Eric Wong <e@80x24.org>
-
- * io.c (nogvl_copy_stream_sendfile): remove socket check
- [ruby-core:59856][Feature #9427]
-
-Wed Jan 29 04:29:54 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/openssl/ossl_ssl.c: pass read_nonblock options to underlying IO
- when SSL session has not been started.
-
- * test/openssl/test_ssl.rb: test for change.
-
-Wed Jan 29 03:49:36 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/fiddle/closure.c: use sizeof(*pcl) for correct sizeof value.
- [ruby-core:57599] [Bug #8978]. Thanks mame!
-
-Wed Jan 29 03:36:42 2014 Eric Wong <e@80x24.org>
-
- * doc/contributing.rdoc: allow/encourage other git hosts
- [ruby-core:59807][misc #9421]
-
-Tue Jan 28 23:36:01 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: Avoid redundant fcntl/fstat syscalls for cloexec
- sockets.
- Patch by Eric Wong. [ruby-core:59429] [Feature #9330]
-
-Tue Jan 28 20:51:07 2014 Tanaka Akira <akr@fsij.org>
-
- * process.c (READ_FROM_CHILD): Apply the last hunk of
- 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by
- Eric Wong in [Bug #8770].
-
-Tue Jan 28 16:31:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (ruby_init_stack, ruby_stack_overflowed_p):
- place get_stack above others to get stack boundary information.
- [ruby-core:60113] [Bug #9454]
-
-Tue Jan 28 15:27:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread_pthread.c: rlimit is only available on Linux.
- At least r44712 breaks FreeBSD.
- [ruby-core:60113] [Bug #9454]
-
-Tue Jan 28 15:17:59 2014 Zachary Scott <e@zzak.io>
-
- * lib/set.rb: [DOC] Add examples for Set#intersect? and Set#disjoint?
- Patch by xavier nayrac [Bug #9331] [ci skip]
-
-Tue Jan 28 15:12:22 2014 Zachary Scott <e@zzak.io>
-
- * ext/zlib/zlib.c (rb_zlib_adler32): [DOC] Add example for adler32
- Patch by Vajrasky Kok [Bug #9307] [ci skip]
-
-Tue Jan 28 08:56:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
-
- * compile.c (iseq_build_from_ary_body): Use :blockptr instead of :block
- as hash key when loading serialized instruction sequences from arrays.
- [Bug #9455] [ruby-core:60146]
-
-Mon Jan 27 21:52:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c: get current main thread stack size, which may
- be expanded than allocated size at initialization, by rlimit().
- [ruby-core:60113] [Bug #9454]
-
-Sat Jan 25 22:17:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * README.ja.md, README.md: update the controller address of
- mailing lists.
-
-Sat Jan 25 14:50:42 2014 Eric Wong <normalperson@yhbt.net>
-
- * process.c (send_child_error): retry write on EINTR to fix
- occasional Errno::EINTR from Process.spawn.
-
- * process.c (recv_child_error): retry read on EINTR to fix
- occasional Errno::EINTR from Process.spawn.
-
-Sat Jan 25 14:21:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): result of assignment should be
- its rhs instead of returned value from a method.
- [ruby-core:60071] [Bug #9448]
-
-Sat Jan 25 11:16:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_extract_keywords): treat nil keyword_hash same as 0,
- for the case rb_scan_args returns nil if no keyword hash.
-
-Fri Jan 24 15:13:20 2014 Zachary Scott <e@zzak.io>
-
- * lib/racc/rdoc/grammar.en.rdoc: [DOC] Correct grammar and typos
- Patch by Giorgos Tsiftsis [Bug #9429] [ci skip]
-
-Thu Jan 23 20:20:17 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/envutil.rb: try to wait a bit (0.1sec) when ruby process
- exits by signals because some SEGV tests fail because of not enough
- error output.
-
-Thu Jan 23 20:06:27 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_settracefunc.rb: check the target thread.
-
-Thu Jan 23 19:59:16 2014 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_settracefunc.rb: check the target thread.
-
-Thu Jan 23 14:26:44 2014 Zachary Scott <e@zzak.io>
-
- * lib/fileutils.rb: [DOC] Fix typo in options_of() example [Bug #9392]
- Patch by Giorgos Tsiftsis
-
-Thu Jan 23 13:56:16 2014 Zachary Scott <e@zzak.io>
-
- * README -> README.md: [DOC] Format README with Markdown [Bug #9255]
- * README.ja -> README.ja.md: ditto
-
-Wed Jan 22 15:59:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/thread/thread.c (Init_thread): ConditionVariable and Queue
- are not able to copy. [ruby-core:59961] [Bug #9440]
-
-Tue Jan 21 20:14:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (rb_thread_create_timer_thread): fix for platforms
- where PTHREAD_STACK_MIN is a dynamic value and not a compile-time
- constant. [ruby-dev:47911] [Bug #9436]
-
-Tue Jan 21 17:55:09 2014 Zachary Scott <e@zzak.io>
-
- * lib/uri/common.rb: [DOC] Use static w3.org uri [ci skip]
- Patch by @ykzts [Fix GH-484] https://github.com/ruby/ruby/pull/484
-
-Tue Jan 21 16:43:22 2014 Zachary Scott <e@zzak.io>
-
- * enum.c: [DOC] Add simple example of Enumerable#zip [ci skip]
- Patch by @nruth on documenting-ruby/ruby#22
- https://github.com/documenting-ruby/ruby/pull/22
-
-Tue Jan 21 16:26:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (rb_thread_create_timer_thread): expand timer
- thread stack size to get rid of segfault on FreeBSD/powerpc64.
- based on the patch by Steve Wills at [ruby-core:59923].
- [ruby-core:56590] [Bug #8783]
-
-Tue Jan 21 04:31:23 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
- IP_MULTICAST_TTL on Mac OS X and Windows.
-
-Tue Jan 21 00:39:15 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c: Use "byte" as default argument for
- IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket option to follow
- the original multicast implementation.
-
-Mon Jan 20 20:20:27 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c: Use preprocessor macros to avoid repeated
- conditionals.
-
-Mon Jan 20 13:55:03 2014 Zachary Scott <e@zzak.io>
-
- * lib/rubygems/version.rb: [DOC] Use gender-neutral pronouns [ci skip]
- * lib/rubygems/security.rb: ditto
-
-Sun Jan 19 06:38:48 2014 Benoit Daloze <eregontp@gmail.com>
-
- * compar.c (cmp_equal): warn for this release and still rescue
- standard exceptions for a nicer transition. See #7688.
- Partly reverts r44502.
-
- * test/ruby/test_comparable.rb: adapt assertion to match new behavior.
-
-Sun Jan 19 06:27:18 2014 Benoit Daloze <eregontp@gmail.com>
-
- * test/ruby/test_comparable.rb: specify behavior for the different
- kind of exceptions rescued (or not) by Comparable#==.
-
-Sat Jan 18 23:12:19 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket: Avoid unnecessary ppoll/select on Linux.
- Patch by Eric Wong. [ruby-core:57950] [Bug #9039]
-
-Sat Jan 18 22:57:44 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (Resolv::DNS::Resource::TXT#data): Return concatenated
- string.
- Patch by Ryan Brunner. [ruby-core:58220] [Bug #9093]
-
-Sat Jan 18 22:35:15 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_update_max_fd): Return immediately if the given fd is small
- enough.
-
-Sat Jan 18 22:25:53 2014 Tanaka Akira <akr@fsij.org>
-
- * io.c: Test O_CLOEXEC only once.
- Patch by Eric Wong. [ruby-core:59419] [Feature #9328]
-
-Sat Jan 18 21:24:49 2014 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/option.c: IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket
- option takes a byte on OpenBSD.
- Fixed by Jeremy Evans. [ruby-core:59496] [Bug #9350]
-
-Sat Jan 18 21:19:04 2014 Tanaka Akira <akr@fsij.org>
-
- * lib/open-uri.rb: Make proxy disabling working again.
- Fixed by Christophe Philemotte. [ruby-core:59650] [Bug #9385]
-
-Fri Jan 17 20:05:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/delegate.rb (Delegator): keep source information methods
- which start and end with '__'. [ruby-core:59718] [Bug #9403]
-
-Fri Jan 17 17:58:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_mod_s_constants): return its own constants for other
- than Module itself. [ruby-core:59763] [Bug #9413]
-
-Tue Jan 16 00:17:00 2014 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.5.
-
-Wed Jan 15 20:30:31 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (io_binwrite): use writev(2) to avoid double write if available.
-
- * configure.in: check writev(2)
-
-Wed Jan 15 14:04:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (get_encoding): respect BOM on pseudo encodings.
- [ruby-dev:47895] [Bug #9415]
-
-Wed Jan 15 14:03:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (get_actual_encoding): get actual encoding according to
- the BOM if exists.
-
- * string.c (rb_str_inspect): use according encoding, instead of
- pseudo encodings, UTF-{16,32}. [ruby-core:59757] [Bug #8940]
-
-Tue Jan 14 21:07:22 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * ext/thread/thread.c (rb_szqueue_clear): notify SZQUEUE_WAITERS
- on SizedQueue#clear. [ruby-core:59462] [Bug #9342]
-
- * test/thread/test_queue.rb: add test. the patch is from
- Justin Collins.
-
-Tue Jan 14 15:58:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap
- depending on PRIsVALUE for 1.9. [Backport #9406]
-
- * ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback
- definition for 2.1 or older. [ruby-core:59750] [Backport #9406]
-
-Tue Jan 14 11:28:44 2014 Yuki Yugui Sonoda <yugui@google.com>
-
- * vm_exec.c (cfp): Fixes a SEGV issue in r44554.
- r11 can be broken by subroutine and sometimes causes SEGV at
- runtime. Use r13 instead.
-
-Tue Jan 14 02:20:00 2014 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Add an additional
- digit for the quotient to be compatible with bigdecimal 1.2.1 and
- the former. [ruby-core:59365] [#9316] [#9305]
-
- * test/bigdecimal/test_bigdecimal.rb: tests for the above change.
-
- * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.4.
-
-Mon Jan 13 14:55:31 2014 Zachary Scott <e@zzak.io>
-
- * lib/xmlrpc/client.rb: [DOC] Remove note about SSL package on RAA
- Since RAA has been deprecated, and the SSL package has been replaced
- with net/https this statement is entirely false and should be
- deleted. [Bug #9152]
-
-Mon Jan 13 14:47:07 2014 Zachary Scott <e@zzak.io>
-
- * lib/net/smtp.rb: [DOC] Remove dead link to RAA by Giorgos Tsiftsis
- Fixes the following bugs: [Bug #9152] [Bug #9268] [Bug #9394]
- * lib/open-uri.rb: ditto
-
-Mon Jan 13 14:25:55 2014 Zachary Scott <e@zzak.io>
-
- * ext/openssl/ossl_pkey_dh.c: Fixed typo by Sandor Szuecs [Bug #9243]
-
-Mon Jan 13 12:03:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
-
- * ext/thread/thread.c (rb_szqueue_push): check GET_SZQUEUE_WAITERS
- instead of GET_QUEUE_WAITERS to prevent deadlock. Patch by Eric Wong.
- [Bug #9302] [ruby-core:59324]
-
- * test/thread/test_queue.rb: add test
-
-Sun Jan 12 16:41:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (iseq_load): keep type_map to get rid of memory leak.
- based on a patch by Eric Wong at [ruby-core:59699]. [Bug #9399]
-
-Sun Jan 12 09:21:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/util.h (DECIMAL_SIZE_OF_BITS): a preprocessor
- constant macro to approximate decimal representation size of n-bits
- integer.
-
- * iseq.c (register_label): use DECIMAL_SIZE_OF_BITS for better
- approximation.
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto.
-
- * common.mk (iseq.o), ext/bigdecimal/depend (bigdecimal.o): add
- dependency to ruby/util.h for DECIMAL_SIZE_OF_BITS.
-
-Fri Jan 10 16:27:20 2014 Yuki Yugui Sonoda <yugui@google.com>
-
- * vm_exec.c (cfp): Avoid generating invalid binary for
- NativeClient.
- r15 on x86_64 is reserved by NativeClient. So r15 to cfp used to
- generate invalid binary under some combinations of compiler
- optimization flags.
-
-Fri Jan 10 18:01:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_search_super_method): allow bound method from a
- module, yet another method transplanting.
-
-Fri Jan 10 13:34:04 2014 Aman Gupta <ruby@tmm1.net>
-
- * insns.def (opt_aref_with): new instruction to optimize Hash#[],
- removing any allocation overhead when used with a string literal
- key. Patch by normalperson (Eric Wong). [ruby-core:59640] [Bug #9382]
- * insns.def (opt_aset_with): new instruction to optimize Hash#[]=
- * compile.c (iseq_compile_each): compiler shortcuts for new
- instructions
- * hash.c (static VALUE rb_hash_compare_by_id_p): fix documentation for
- Hash#compare_by_identity to reflect frozen string sharing
- * test/ruby/test_hash.rb (class TestHash): test for new behavior
-
-Fri Jan 10 06:23:21 2014 Benoit Daloze <eregontp@gmail.com>
-
- * range.c (Range#size): [DOC] improve description and add examples.
- Patch by @skade. [Fixes GH-501]
-
-Fri Jan 10 00:47:52 2014 Josef Stribny <strzibny@gmail.com>
-
- * ext/tk/extconf.rb: fix to pass arrays instead of strings to
- libpathflag. patch at [ruby-core:59665]. [Bug #9386]
-
-Thu Jan 9 20:49:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: -mstackrealign is necessary for -msse2 working.
- [ruby-core:54716] [Bug #8349]
-
- * configure.in: use SSE2 instructions to drop unexpected precisions on
- other than mingw. [ruby-core:59472] [Bug #8358]
-
-Thu Jan 9 20:31:10 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * hash.c (rb_objid_hash): should return `long'. brushup r44534.
-
- * object.c (rb_obj_hash): follow above change.
-
-Thu Jan 9 19:12:37 2014 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.
- The patch base by drkaes (Stefan Kaes).
- [Bug #9321]
-
- * variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()
- instead of rb_frame_pop().
-
- * vm_eval.c (raise_method_missing): ditto.
-
- * vm_eval.c (rb_iterate): ditto.
-
- * internal.h (rb_vm_pop_cfunc_frame): add decl.
-
- * test/ruby/test_settracefunc.rb: add tests.
- provided by drkaes (Stefan Kaes).
-
- * vm.c, eval.c, include/ruby/intern.h (rb_frame_pop):
- move definition of rb_frame_pop() and deprecate it.
- It doesn't care about `return' events.
-
-Thu Jan 9 17:40:28 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * hash.c (rb_any_hash): should treat the return value of rb_objid_hash()
- as `long', because ruby assumes the hash value of the object id of
- an object is `long'.
- this fixes test failures on mswin64 introduced at r44525.
-
-Thu Jan 9 09:55:20 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: dumping strings with
- quotes should not have changed. [ruby-core:59316] [Bug #9300]
-
- * ext/psych/lib/psych.rb: fixed missing require.
-
- * test/psych/test_string.rb: test
-
-Thu Jan 9 09:51:00 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: anonymous structs
- should be able to roundtrip. Thanks @splattael!
-
- * test/psych/test_object_references.rb: test for change
-
-Wed Jan 8 22:53:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_search_super_method): when super called in a
- bound UnboundMethod generated from a module, no superclass is
- found since the current defined class is the module, then call
- method_missing in that case. [ruby-core:59619] [Bug #9377]
-
-Wed Jan 8 15:55:21 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_objid_hash): return hash value from object ID with a
- salt, extract from rb_any_hash().
-
- * object.c (rb_obj_hash): return same value as rb_any_hash().
- fix r44125. [ruby-core:59638] [Bug #9381]
-
-Wed Jan 8 13:12:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/timeout.rb (Timeout::ExitException.catch): pass arguments
- for new instance.
-
- * lib/timeout.rb (Timeout::ExitException#exception): fallback to
- Timeout::Error if couldn't throw. [ruby-dev:47872] [Bug #9380]
-
- * lib/timeout.rb (Timeout#timeout): initialize ExitException with
- message for the fallback case.
-
-Tue Jan 7 12:43:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/timeout.rb (Timeout#timeout): should not rescue ordinarily
- raised ExitException, which should not be thrown.
-
- * lib/timeout.rb (Timeout::ExitException.catch): set @thread only if
- it ought to be caught.
-
- * lib/timeout.rb (Timeout#timeout): when a custom exception is given,
- no instance is needed to be caught, so defer creating new instance
- until it is raised. [ruby-core:59511] [Bug #9354]
-
-Tue Jan 7 10:16:02 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 21e409d / RubyGems 2.2.1.
-
- See http://rubygems.rubyforge.org/rubygems-update/History_txt.html
- for a list of bug fixes.
-
- * test/rubygems: ditto.
-
-Tue Jan 7 10:10:46 2014 Eric Wong <e@80x24.org>
-
- * ext/json/generator/depend: add build dependencies for json extension
- [Bug #9374] [ruby-core:59609]
- * ext/json/parser/depend: ditto
-
-Tue Jan 7 04:35:46 2014 Aman Gupta <ruby@tmm1.net>
-
- * array.c (ary_add_hash): Fix consistency issue between Array#uniq and
- Array#uniq! [Bug #9340] [ruby-core:59457]
- * test/ruby/test_array.rb (class TestArray): regression test for above.
-
-Mon Jan 6 21:28:48 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * .gitignore: ignore *-fake.rb generated even when CROSS_COMPILING = no
- since r42862.
-
-Sun Jan 5 20:14:14 2014 Benoit Daloze <eregontp@gmail.com>
-
- * compar.c (cmp_equal): remove error hiding in Comparable#==.
- Comparable#== no longer rescues exceptions silently.
- This was the cause of quite a couple bugs. See #7688. [EXPERIMENTAL]
-
- * test/ruby/test_comparable.rb: adapt assertion to match new behavior.
-
- * lib/rdoc/method_attr.rb: fix bugs discovered by this change.
-
- * test/rdoc/test_rdoc_normal_class.rb: fix bugs in tests.
-
-Sat Jan 4 22:44:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
-
- * struct.c (rb_struct_set): return assigned value from setter method
- rather than struct object. [Bug #9353] [ruby-core:59509]
-
- * test/ruby/test_struct.rb (test_setter_method_returns_value): add test
-
-Sat Jan 4 21:44:31 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/test_gc.rb (TestGc#test_latest_gc_info): use
- GC.stat(:key) instead of GC.stat.
-
-Sat Jan 4 19:15:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/socket.c (rsock_syserr_fail_host_port): use format flags,
- '+' to inspect, ' ' to quote unprintables.
-
- * ext/socket/socket.c (rsock_syserr_fail_path): ditto.
-
- * ext/socket/socket.c (rsock_syserr_fail_raddrinfo): ditto.
-
- * ext/socket/socket.c (rsock_syserr_fail_host_port): add errno
- argument version and use rb_syserr_fail_str() instead of
- rb_sys_fail_str() with restoring errno.
-
- * ext/socket/socket.c (rsock_syserr_fail_path): ditto, and
- rb_syserr_fail().
-
- * ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto, use
- rsock_syserr_fail_raddrinfo().
-
- * ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto.
-
- * ext/socket/socket.c (setup_domain_and_type): ditto.
-
-Sat Jan 4 17:18:58 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (RubyVM::OPTS): get rid of a garbage character.
-
-Sat Jan 4 10:17:54 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/ring.rb (Rinda::RingFinger#make_socket): Use
- ipv4_multicast_ttl option for portability.
-
-Sat Jan 4 10:15:47 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rinda/ring.rb (Rinda::RingFinger#make_socket): Use
- ipv4_multicast_loop option for portability. Patch by Jeremy Evans.
- [ruby-trunk - Bug #9351]
-
-Fri Jan 3 19:09:00 2014 Eric Wong <normalperson@yhbt.net>
-
- * ext/socket/socket.c (rsock_sys_fail_host_port): save and restore errno
- before calling rb_sys_fail_str to prevent [BUG] errno == 0.
- Patch by Eric Wong. [ruby-core:59498] [Bug #9352]
-
- * ext/socket/socket.c (rsock_sys_fail_path): ditto
- * ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto
- * ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto
- * ext/socket/socket.c (rsock_sys_fail_raddrinfo_or_sockaddr): ditto
-
-Fri Jan 3 10:43:57 2014 Aman Gupta <ruby@tmm1.net>
-
- * test/net/imap/cacert.pem: generate new CA cert, since the last one
- expired. [Bug #9341] [ruby-core:59459]
- * test/net/imap/server.crt: new server cert signed with updated CA.
- * test/net/imap/Makefile: add `make regen_certs` to automate this
- process.
-
-Fri Jan 3 00:09:54 2014 Benoit Daloze <eregontp@gmail.com>
-
- * ext/bigdecimal: update class method call style from :: to .
- in documentation and usage.
-
- * ext/bigdecimal/lib/bigdecimal/math.rb: [DOC] fix examples values.
- Computations were made using ruby 2.0.0p247 to ensure
- no effect of the recent BigDecimal bug.
-
- * ext/bigdecimal/sample/nlsolve.rb: fix indent.
-
-Thu Jan 2 16:07:21 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (io_fwrite): freeze converted str.
-
-Thu Jan 2 04:15:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_longjmp): remove an extra modifier from the forward
- declaration to match the actual definition. [ruby-core:59451]
- [Bug #9338]
-
-Thu Jan 2 01:23:30 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * vm_eval.c (method_missing): use ALLOCV_N() instead of
- ALLOCA_N() and rb_ary_tmp_new().
-
-Thu Jan 2 00:53:16 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().
-
-Thu Jan 2 00:04:29 2014 Masaki Matsushita <glass.saga@gmail.com>
-
- * hash.c (rb_hash_keys): make rb_hash_keys() static.
- it is no longer used from array.c since r43969.
- the patch is from normalperson (Eric Wong).
- [ruby-core:59449] [Feature #9336]
-
- * internal.h: remove definition of rb_hash_keys().
-
-Wed Jan 1 18:19:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: reset LDFLAGS and DLDFLAGS for opt-dir again after
- LIBPATHFLAG and RPATHFLAG are set. [ruby-dev:47868] [Bug #9317]
-
-Wed Jan 1 11:12:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: use SSE2 instructions for drop unexpected
- precisions. [ruby-core:54738] [Bug #8358]
-
-Tue Dec 31 23:49:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_f_raise): add cause: optional keyword argument.
- [ruby-core:58610] [Feature #8257] [EXPERIMENTAL]
-
-Tue Dec 31 21:44:17 2013 Akio Tajima <artonx@yahoo.co.jp>
-
- * win32/Makefile.sub: remove HAVE_FSEEKO because fseeko removed from win32/win32.c
- Fixed [Bug #9333].
-
-Tue Dec 31 21:02:27 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * io.c (io_fwrite): allocate frozen str only when str is not converted.
-
-Tue Dec 31 15:44:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (RbConfig): expand RUBY_SO_NAME for extensions
- backward compatibility. [ruby-core:59426] [Bug #9329]
-
-Mon Dec 30 23:33:07 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * variable.c: [DOC] adding extra example in docs.
- patched by Steve Klabnik. [Bug #9210]
-
-Mon Dec 30 18:34:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (must_encindex, rb_enc_from_index, rb_obj_encoding): mask
- encoding index and ignore dummy flags. [ruby-core:59354] [Bug #9314]
-
-Mon Dec 30 16:11:52 2013 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * tool/make-snapshot: needs CXXFLAGS. [ruby-core:59393][Bug #9320]
-
-Sun Dec 29 18:36:54 2013 Shota Fukumori <her@sorah.jp>
-
- * lib/mkmf.rb (configuration): Make CXXFLAGS customizable.
- Patch by Kohei Suzuki (eagletmt). [Fixes GH-492]
-
-Sun Dec 29 12:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (mnew_from_me): keep iclass as-is, to make inheritance
- chain consistent. [ruby-core:59358] [Bug #9315]
-
- * proc.c (method_owner): return the original defined_class from
- prepended iclass, instead.
-
-Sun Dec 29 08:47:24 2013 Lucas Allan Amorim <lucas.allan@gmail.com>
-
- * test/ruby/test_sprintf.rb (test_hash): Added tests for sprintf
- with a hash as parameter. [Fixes GH-491]
-
-Sun Dec 29 07:27:51 2013 Benoit Daloze <eregontp@gmail.com>
-
- * compar.c (cmp_eq_recursive): Fix the return value, the value for
- failed #<=> should be nil. It was raising a NoMethodError for
- the test case TestComparable#test_no_cmp (undefined method `>'
- for false:FalseClass). Yet one more reason for #7688.
-
-Sat Dec 28 22:21:59 2013 Benoit Daloze <eregontp@gmail.com>
-
- * object.c (Kernel#<=>) surround Comparable operators with <code> tags.
- The #== method was hidden in ri/rdoc's output and was highlighting
- the line instead.
-
-Sat Dec 28 17:24:00 2013 DV Suresh <e@dvsuresh.me>
-
- * benchmark/bm_so_meteor_contest.rb: [DOC] Fix a few typos
- * ext/fiddle/lib/fiddle/import.rb: ditto
- * ext/psych/lib/psych.rb: ditto
- * ext/psych/lib/psych/nodes/sequence.rb: ditto
- * ext/tk/lib/multi-tk.rb: ditto
- * ext/tk/lib/tcltk.rb: ditto
-
-Sat Dec 28 00:42:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to
- isolate command argument state from outer scope.
- [ruby-core:59342] [Bug #9308]
-
-Fri Dec 27 13:25:03 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/{setup.mak,Makefile.sub}: update fake.rb like
- template/fake.rb.in.
-
-Thu Dec 26 16:10:41 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (fake.rb): should depend on version.h because
- if RUBY_VERSION is updated, fake.rb need to say the new version
- to avoid install error in rbconfig.rb.
-
-Thu Dec 26 14:25:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (HASH_REJECT_COPY_EXTRA_STATES): turn off the old
- behavior, copying extra states by accident.
-
-Thu Dec 26 10:49:14 2013 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * version.h (RUBY_VERSION): 2.2.0 development has started.
-
-Thu Dec 26 10:27:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/merger.rb (tag): support 2.1.1 semi-automatic tagging and 2.2.0
- explicit tagging.
-
-Thu Dec 26 06:35:25 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * proc.c: Having any mandatory keyword argument increases min arity
- [#9299]
-
-Thu Dec 26 06:27:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * proc.c: Having optional keyword arguments makes maximum arity +1,
- not unlimited [#8072]
-
-Thu Dec 26 01:09:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/release.sh: make symbolic links.
-
-Thu Dec 26 00:45:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/make-snapshot: support new version scheme.
-
-Wed Dec 25 22:44:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_set_arguments): set arg_keyword_check from
- nd_cflag, which is set by parser. internal ID is used for
- unnamed keyword rest argument, which should be separated from no
- keyword check.
-
- * iseq.c (rb_iseq_parameters): if no keyword check, keyword rest is
- present.
-
- * parse.y (new_args_tail_gen): set keywords check to nd_cflag, which
- equals to that keyword rest is not present.
-
-Wed Dec 25 22:32:19 2013 Zachary Scott <e@zzak.io>
-
- * lib/abbrev.rb: [DOC] rdoc format patch by Giorgos Tsiftsis [Bug #9146]
-
-Wed Dec 25 20:30:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (rb_iseq_parameters): push argument type symbol only for
- unnamed rest keywords argument.
-
-Wed Dec 25 20:28:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_iseq_min_max_arity): maximum argument is unlimited if
- having rest keywords argument. [ruby-core:53298] [Bug #8072]
-
-Wed Dec 25 18:29:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (argument_error): insert dummy frame to make
- a backtrace object intead of modify backtrace string array.
- [Bug #9295]
-
- * test/ruby/test_backtrace.rb: add a test for this patch.
- fix test to compare a result of Exception#backtrace with
- a result of Exception#backtrace_locations.
-
-Wed Dec 25 13:00:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: let mingw do something black-magic, and check if
- _gmtime64_s() is available actually.
-
- * win32/win32.c (gmtime_s, localtime_s): use _gmtime64_s() and
- _localtime64_s() if available, not depending on very confusing
- mingw variants macros. based on the patch by phasis68 (Heesob
- Park) at [ruby-core:58764]. [ruby-core:58391] [Bug #9119]
-
-Wed Dec 25 12:33:41 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * sample/trick2013/: added the award-winning entries of TRICK 2013.
- See https://github.com/tric/trick2013 for the contest outline.
- (Matz has approved the attachment.)
-
-Wed Dec 25 10:42:02 2013 Yamashita Yuu <yamashita@geishatokyo.com>
-
- * ext/openssl/ossl_ssl.c (Init_ossl_ssl): Declare a constant
- `OP_MSIE_SSLV2_RSA_PADDING` only if the macro is defined. The
- `SSL_OP_MSIE_SSLV2_RSA_PADDING` has been removed from latest
- snapshot of OpenSSL 1.0.1. [Fixes GH-488]
-
-Wed Dec 25 01:03:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (bind_local_variables): allowing binding to list its
- local variables. patch by Jack Danger Canty <jackdanger AT
- squareup.com> at [ruby-core:56543]. [Feature #8773]
-
-Tue Dec 24 23:20:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/fileutils/fileasserts.rb (assert_ownership_user): new
- assertion for user ownership.
-
- * test/fileutils/test_fileutils.rb (test_chown_error),
- (test_chown_without_permission, test_chown_with_root):
- based on the patch by vajrasky (Vajrasky Kok) at
- [ruby-core:59298]. [Feature #9292]
-
-Tue Dec 24 16:28:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_mod_define_method): consider visibility only if self
- in the caller is same as the receiver, otherwise make public as
- well as old behavior. [ruby-core:57747] [Bug #9005]
- [ruby-core:58497] [Bug #9141]
-
- * vm.c (rb_vm_cref_in_context): return ruby level cref if self is
- same.
-
-Tue Dec 24 14:13:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * README.EXT: add a refer to URL.
-
-Tue Dec 24 13:48:45 2013 Koichi Sasada <ko1@atdot.net>
-
- * README.EXT: add a document about RGenGC.
- Reviewed by havenwood.
- [misc #8962]
-
- * README.EXT.ja: ditto.
-
-Tue Dec 24 12:11:43 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h (RARRAY_ASET): try to avoid compiler warning.
- [Bug #9287]
-
-Tue Dec 24 05:04:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/fileutils/test_fileutils.rb (setup): should not call
- Process.groups for Windows. get rid of many errors introduced by
- r44364.
-
-Mon Dec 23 18:37:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/fileutils/fileasserts.rb (assert_ownership_group): new
- assertion for group ownership.
-
- * test/fileutils/test_fileutils.rb (test_chown{,_verbose,_noop}):
- based on the patch by vajrasky (Vajrasky Kok) at
- [ruby-core:59281]. [Feature #9286]
-
-Mon Dec 23 15:53:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (HAS_EXTRA_STATES): warn extra states only when something
- differ. [ruby-core:59254] [Bug #9275]
-
-Mon Dec 23 12:42:13 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * array.c: Have to_h raise on elements that are not key-value pairs
- [#9239]
-
- * enum.c: ditto
-
-Mon Dec 23 05:01:55 2013 Zachary Scott <e@zzak.io>
-
- * doc/syntax/methods.rdoc: [DOC] Added example for underscore
- conventions in method names. Also added doc to clarify encoding
- character set support for Ruby programs and elaborated on defining
- predicate and bang methods. Based on a patch by @gaurish
- [Fixes GH-477] https://github.com/ruby/ruby/pull/477
-
-Mon Dec 23 03:18:09 2013 Zachary Scott <e@zzak.io>
-
- * doc/ChangeLog-1.9.3: [DOC] Fix typos by @dvsuresh
- [Fixes GH-485] https://github.com/ruby/ruby/pull/485
- * ext/openssl/ossl_config.c: ditto
- * lib/rss/utils.rb, lib/time.rb: ditto
- * test/ruby/envutil.rb: ditto
-
-Sun Dec 22 23:56:56 2013 Zachary Scott <e@zzak.io>
-
- * lib/{rake,rdoc,rss}/*, test/rexml/test_listener.rb: [DOC] Fix typos
- by @dvsuresh [Fixes GH-486] https://github.com/ruby/ruby/pull/486
-
-Sun Dec 22 11:08:47 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_gem_ext_builder.rb: Fix warning due to ambiguous
- expression.
-
-Sun Dec 22 11:05:53 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/install_command.rb: Restore gem install
- --ignore-dependencies for remote gems
- * test/rubygems/test_gem_commands_install_command.rb: Test for the
- above.
-
-Sun Dec 22 10:23:40 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc.rb: Set RDoc to release version.
-
-Sun Dec 22 10:19:07 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Set RubyGems to release version.
-
-Sun Dec 22 10:16:08 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb (module Gem): Fix comment for
- Gem::load_path_insert_index.
-
-Sun Dec 22 04:07:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (ruby_gc_set_params): don't show obsolete warnings for
- RUBY_FREE_MIN/RUBY_HEAP_MIN_SLOTS if
- RUBY_GC_HEAP_FREE_SLOTS/RUBY_GC_HEAP_INIT_SLOTS are given.
- [Bug #9276]
-
-Sat Dec 21 13:00:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c: remove unnecessary the source path from EEXIST error
- messages and show the destination path only. [ruby-core:59202]
- [Feature #9263]
-
-Sat Dec 21 12:37:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not
- consider encodings in hosts file. [ruby-core:59239] [Bug #9273]
-
- * lib/resolv.rb (Resolv::Config.parse_resolv_conf): ditto.
-
-Sat Dec 21 05:43:27 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/make-snapshot: replace RUBY_PATCHLEVEL_STR in version.h to
- show users that this ruby is a preview/rc version.
-
-Sat Dec 21 05:03:49 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (fake.rb): fixed wrong RUBY_PLATFORM, to correctly
- install win32.h.
- [ruby-core:58801][Bug #9199] reported by arton.
-
-For the changes before 2.1.0, see doc/ChangeLog-2.1.0
-For the changes before 2.0.0, see doc/ChangeLog-2.0.0
-For the changes before 1.9.3, see doc/ChangeLog-1.9.3
-For the changes before 1.8.0, see doc/ChangeLog-1.8.0
-
-Local variables:
-coding: us-ascii
-add-log-time-format: (lambda ()
- (let* ((time (current-time))
- (system-time-locale "C")
- (diff (+ (cadr time) 32400))
- (lo (% diff 65536))
- (hi (+ (car time) (/ diff 65536))))
- (format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
-indent-tabs-mode: t
-tab-width: 8
-change-log-indent-text: 2
-end:
-vim: tabstop=8 shiftwidth=2
diff --git a/doc/ChangeLog-YARV b/doc/ChangeLog-YARV
index 6a6cfbd0c9..cbc51c5593 100644
--- a/doc/ChangeLog-YARV
+++ b/doc/ChangeLog-YARV
@@ -86,7 +86,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* blockinlining.c, compile.c, compile.h, debug.c, debug.h,
insnhelper.h, insns.def, iseq.c, thread.c, thread_pthread.ci,
thread_pthread.h, thread_win32.ci, thread_win32.h, vm.c, vm.h,
- vm_dump.c, vm_evalbody.ci, vm_opts.h.base, yarv.h,
+ vm_dump.c, vm_evalbody.ci, vm_opts.h.base, yarv.h,
yarv_version.h, yarvcore.c, yarvcore.h :
add a header includes copyright
@@ -110,7 +110,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* signal.c : ditto
- * test/ruby/test_signal.rb :
+ * test/ruby/test_signal.rb :
* thread_pthread.ci : rename timer thread functions
@@ -203,7 +203,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* ext/dbm, dl, gdbm, iconv, io, pty, sdbm : added
- * test/dbm, gdbm, io, logger, net, readline, sdbm, soap,
+ * test/dbm, gdbm, io, logger, net, readline, sdbm, soap,
webrick, win32ole, wsdl, xsd : added
@@ -652,7 +652,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* vm.c : ditto
- * yarvcore.c : prohibit tail call optimization to mark
+ * yarvcore.c : prohibit tail call optimization to mark
iseq object
* yarvcore.h : add some allocator function declaration
@@ -906,7 +906,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarvcore.h : disable to use get/setcontext
- * lib/webrick/server.rb : add experimental implementation
+ * lib/webrick/server.rb : add experimental implementation
using thraeds pool
@@ -1447,7 +1447,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* insns.def : ditto
- * vm_dump.c :
+ * vm_dump.c :
* intern.h : change rb_thread_signal_raise/exit interface
@@ -2060,7 +2060,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2006-02-15(Wed) 17:39:16 +0900 Koichi Sasada <ko1@atdot.net>
- * eval_intern.h :
+ * eval_intern.h :
* eval_jump.h, vm.c : localjump_error() and jump_tag_but_local_jump()
move to th_localjump_error and th_jump_tag_but_local_jump at vm.c
@@ -2428,7 +2428,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2006-02-14(Tue) 05:53:56 +0900 Minero Aoki <aamine@loveruby.net>
* eval.c (ruby_cleanup): th->errinfo contains a NODE while
- break'ing, check it before referring klass.
+ break'ing, check it before refering klass.
2006-02-14(Tue) 05:45:07 +0900 Koichi Sasada <ko1@atdot.net>
@@ -2461,7 +2461,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2006-02-14(Tue) 01:42:11 +0900 Koichi Sasada <ko1@atdot.net>
- * error.c : fix include file position
+ * error.c : fix include file positon
* test/ruby/test_signal.rb : skip test_exit_action on cygwin
@@ -2618,123 +2618,123 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* array.c : revert last commit
- * ascii.c : ditto
+ * ascii.c : ditto
- * bignum.c : ditto
+ * bignum.c : ditto
- * class.c : ditto
+ * class.c : ditto
- * compar.c : ditto
+ * compar.c : ditto
- * defines.h : ditto
+ * defines.h : ditto
- * dir.c : ditto
+ * dir.c : ditto
- * dln.c : ditto
+ * dln.c : ditto
- * dln.h : ditto
+ * dln.h : ditto
- * enum.c : ditto
+ * enum.c : ditto
- * enumerator.c : ditto
+ * enumerator.c : ditto
- * error.c : ditto
+ * error.c : ditto
- * euc_jp.c : ditto
+ * euc_jp.c : ditto
- * file.c : ditto
+ * file.c : ditto
- * gc.c : ditto
+ * gc.c : ditto
- * hash.c : ditto
+ * hash.c : ditto
- * intern.h : ditto
+ * intern.h : ditto
- * io.c : ditto
+ * io.c : ditto
- * lex.c : ditto
+ * lex.c : ditto
- * main.c : ditto
+ * main.c : ditto
- * marshal.c : ditto
+ * marshal.c : ditto
- * math.c : ditto
+ * math.c : ditto
- * missing.h : ditto
+ * missing.h : ditto
- * node.h : ditto
+ * node.h : ditto
- * numeric.c : ditto
+ * numeric.c : ditto
- * object.c : ditto
+ * object.c : ditto
- * oniguruma.h : ditto
+ * oniguruma.h : ditto
- * pack.c : ditto
+ * pack.c : ditto
- * prec.c : ditto
+ * prec.c : ditto
- * process.c : ditto
+ * process.c : ditto
- * random.c : ditto
+ * random.c : ditto
- * range.c : ditto
+ * range.c : ditto
- * rb/mklog.rb : ditto
+ * rb/mklog.rb : ditto
- * re.c : ditto
+ * re.c : ditto
- * regcomp.c : ditto
+ * regcomp.c : ditto
- * regenc.c : ditto
+ * regenc.c : ditto
- * regenc.h : ditto
+ * regenc.h : ditto
- * regerror.c : ditto
+ * regerror.c : ditto
- * regex.h : ditto
+ * regex.h : ditto
- * regexec.c : ditto
+ * regexec.c : ditto
- * regint.h : ditto
+ * regint.h : ditto
- * regparse.c : ditto
+ * regparse.c : ditto
- * regparse.h : ditto
+ * regparse.h : ditto
- * ruby.c : ditto
+ * ruby.c : ditto
- * ruby.h : ditto
+ * ruby.h : ditto
- * rubyio.h : ditto
+ * rubyio.h : ditto
- * rubysig.h : ditto
+ * rubysig.h : ditto
- * signal.c : ditto
+ * signal.c : ditto
- * sjis.c : ditto
+ * sjis.c : ditto
- * sprintf.c : ditto
+ * sprintf.c : ditto
- * st.c : ditto
+ * st.c : ditto
- * st.h : ditto
+ * st.h : ditto
- * string.c : ditto
+ * string.c : ditto
- * struct.c : ditto
+ * struct.c : ditto
- * time.c : ditto
+ * time.c : ditto
- * utf8.c : ditto
+ * utf8.c : ditto
- * util.c : ditto
+ * util.c : ditto
- * util.h : ditto
+ * util.h : ditto
- * variable.c : ditto
+ * variable.c : ditto
- * version.c : ditto
+ * version.c : ditto
2006-02-12(Sun) 21:33:10 +0900 Koichi Sasada <ko1@atdot.net>
@@ -3151,7 +3151,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2006-02-12(Sun) 05:05:02 +0900 Koichi Sasada <ko1@atdot.net>
* eval.c, eval_intern.h, eval_load.c, eval_proc.c, node.h,
- insnhelper.h, insns.def, vm.c, yarvcore.c, yarvcore.h :
+ insnhelper.h, insns.def, vm.c, yarvcore.c, yarvcore.h :
change cref data structure and unify ruby_class and ruby_cbase
and some refoctoring
@@ -3810,7 +3810,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarvtest/test_eval.rb : added
- * yarvtest/test_proc.rb :
+ * yarvtest/test_proc.rb :
2005-12-29(Thu) 12:27:12 +0900 Koichi Sasada <ko1@atdot.net>
@@ -4091,7 +4091,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2005-12-25(Sun) 01:45:55 +0900 Koichi Sasada <ko1@atdot.net>
- * insns.def, compile.c, rb/insns2vm.rb, template/insns_info.inc.tmpl :
+ * insns.def, compile.c, rb/insns2vm.rb, template/insns_info.inc.tmpl :
trace stack depth at compile time
and use it as cont_sp for exception handling
@@ -4167,7 +4167,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* compile.c, yarvcore.h : support all defined?() syntax
- * compile.c : fix NODE_COLON2
+ * compile.c : fix NODE_COLON2
* yarvtest/test_bin.rb : add or fix tests for above
@@ -4278,7 +4278,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* insns.def : remove logic for zsuper
- * template/optinsn.inc.tmpl :
+ * template/optinsn.inc.tmpl :
* vm.c : remove thread_yield_light_prepare, thread_yield_light_invoke
@@ -4292,7 +4292,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* array.c, numeric.c, range.c : add prototype of
block inlining function
- * blockinlining.c, vm_opts.h.base : add block inlining flag
+ * blockinlining.c, vm_opts.h.base : add block inlining flag
* common.mk, debug.h, debug.c : add debug_breakpoint() for gdb
@@ -4328,7 +4328,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* vm.c : fix to skip pushing value at "next"
- * yarvcore.h : move definition of
+ * yarvcore.h : move definision of
"struct iseq_compile_data_ensure_node_stack" to compile.c
* compile.c : fix ensure catch table creation
@@ -4390,7 +4390,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2005-11-29(Tue) 16:39:07 +0900 Koichi Sasada <ko1@atdot.net>
- * eval.c, eval_proc.c, vm.c, vm_macro.def :
+ * eval.c, eval_proc.c, vm.c, vm_macro.def :
support define_method and invoke NODE_BMETHOD method
@@ -4478,7 +4478,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* debug.c : add debug_v() and change to use only printf
on debug_id()
- * sample/test.rb :
+ * sample/test.rb :
* vm.c : fix make_proc_from_block
@@ -4539,7 +4539,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* eval.c : support rb_frame_pop() and rb_frame_callee(),
add rb_sourcefile(), rb_sourceline(),
-
+
* compile.c : support postposition while/until,
fix block parameter index
@@ -4582,7 +4582,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* benchmark/other-lang/eval.rb : fix path
- * lib/English.rb, lib/cgi.rb, lib/complex.rb, lib/delegate.rb :
+ * lib/English.rb, lib/cgi.rb, lib/complex.rb, lib/delegate.rb :
added
@@ -4712,7 +4712,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2005-10-05(Wed) 21:20:13 +0900 Koichi Sasada <ko1@atdot.net>
- * eva.c, eval_thread.c, ruby.h, eval_error.h, eval_jump.h,
+ * eva.c, eval_thread.c, ruby.h, eval_error.h, eval_jump.h,
eval_load.c, thread.c, error.c, compile.h : remove ruby_errinfo
* thread_win32.h, thread_pthread.h : set stack size to 4KB
@@ -4795,7 +4795,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* thread.c, common.mk : add thread.c
- * thread.c, gc.c, eval_thread.c, yarvcore.c, yarvcore.h :
+ * thread.c, gc.c, eval_thread.c, yarvcore.c, yarvcore.h :
support native thread (on pthread)
* insns.def : add YARV_CHECK_INTS() check
@@ -5322,7 +5322,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarvcore.c, yarvcore.h : remove cYarvThrowObject (unused)
- * yarvcore.c, yarvcore.h, insns.def :
+ * yarvcore.c, yarvcore.h, insns.def :
thread_object#stack_mark_poinetr
* depend, rb/eval.rb : BOPT, TOPT -> OPT
@@ -5394,7 +5394,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* tmpl/vmtc.inc.tmpl : add const prefix
- * /rb/asm_parse.rb, extconf.rb : added and make assembler analised output
+ * /rb/asm_parse.rb, extconf.rb : added and make assembler analised output
* opt_operand.def : add send operands unification
@@ -5493,7 +5493,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* depend : adde reconf rule
- * insnhelper.h :
+ * insnhelper.h :
* vm_evalbody.inc : rename to vm_evalbody.h
@@ -5711,7 +5711,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarvcore.h : make type "struct iseq_compile_data"
- * yarvcore.h : iseq_object#insn_info_ary to iseq_object#insn_info_tbl
+ * yarvcore.h : iseq_object#insn_info_ary to iseq_object#insn_info_tbl
2005-02-21(Mon) 05:24:01 +0900 Koichi Sasada <ko1@atdot.net>
@@ -5736,7 +5736,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* test/test_method.rb : add tests for above
- * insns.def : opt_ltlt and
+ * insns.def : opt_ltlt and
2005-02-18(Fri) 08:54:40 +0900 Koichi Sasada <ko1@atdot.net>
@@ -5770,7 +5770,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarvcore.h, insns.def, compile.c : support defined? expression (limited)
- * test/test_syn.rb : tests for above is added
+ * test/test_syn.rb : tests for above is added
* compile.c, insns.def : support block passed method dispatch
@@ -6002,7 +6002,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* vm.c (thread_dump_regs) : added
- * vm.c (thread_call0, thread_call0_cfunc, thread_invoke_yield,
+ * vm.c (thread_call0, thread_call0_cfunc, thread_invoke_yield,
thread_invoke_yield_cfunc), insns.def (yield, send) :
fixed, added to support IFUNC
@@ -6168,7 +6168,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* test.rb : restore $" after evaluation with ruby
- * rb/insns2vm.rb : remove unnecessary each
+ * rb/insns2vm.rb : remove unnecesary each
2004-12-17(Fri) 18:56:38 +0900 Koichi Sasada <ko1@atdot.net>
@@ -6322,7 +6322,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2004-12-02(Thu) 13:20:41 +0900 Koichi Sasada <ko1@atdot.net>
* yarvcore.c, vm.h, vm.c, insns.def, insnhelper.h, yarvutil.rb :
- add usage analisys framework
+ add usage analisys framework
* disasm.c : insn_operand_intern to separate function
@@ -6397,7 +6397,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* vm.c : fix stack dump routine
- * vm.c : implement thread_funcall (temporarily)
+ * vm.c : impliment thread_funcall (temporarily)
* yarv.h : add IS_YARV_WORKING(), SET_YARV_START(), SET_YARV_STOP()
@@ -6433,7 +6433,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarv.h : added
- * yarvcore.c, yarv.h : support yarv_is_working, yarv_block_given_p,
+ * yarvcore.c, yarv.h : support yarv_is_working, yarv_block_given_p,
yarv_yield, yarv_funcall (only dummy function)
* vm.c : thread_eval_body changed return value
@@ -6488,7 +6488,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
2004-11-01(Mon) 04:45:54 +0900 Koichi Sasada <ko1@atdot.net>
- * yarvcore.h, compile.c, debug.c, version.h :
+ * yarvcore.h, compile.c, debug.c, version.h :
redesgin gc debug scheme (GC_CHECK())
* yarvcore.c : mark iseqobj->current_block on GC
@@ -6590,7 +6590,7 @@ Sun Dec 31 17:42:05 2006 Koichi Sasada <ko1@atdot.net>
* yarvcore.h, yarvcore.c : add idThrow*
* insns.def, compile.c, vm.c : support retry, break,
- next, redo, return(incomplete)
+ next, redo, return(imcomplete)
2004-09-03(Fri) 13:40:08 +0900 Koichi Sasada <ko1@atdot.net>
diff --git a/doc/NEWS-1.8.7 b/doc/NEWS-1.8.7
index 38571fe103..51fb5f1c6a 100644
--- a/doc/NEWS-1.8.7
+++ b/doc/NEWS-1.8.7
@@ -230,7 +230,7 @@ with all sufficient information, see the ChangeLog file.
* ARGF.lines
* ARGF.readbyte
- New methods.
+ New methods.
* Method#name
* Method#owner
@@ -638,7 +638,7 @@ with all sufficient information, see the ChangeLog file.
md = Digest::MD5.new("string")
# After (works with any version)
md = Digest::MD5.new.update("string")
-
+
# Before
hd = Digest::MD5.new("string").hexdigest
# After (works with any version)
diff --git a/doc/NEWS-2.0.0 b/doc/NEWS-2.0.0
index 9ad7254317..f99ba3e882 100644
--- a/doc/NEWS-2.0.0
+++ b/doc/NEWS-2.0.0
@@ -168,7 +168,7 @@ with all sufficient information, see the ChangeLog file.
* RUBY_FIBER_VM_STACK_SIZE: vm stack size used at fiber creation.
default: 64KB or 128KB.
* RUBY_FIBER_MACHINE_STACK_SIZE: machine stack size used at fiber
- creation. default: 256KB or 512KB.
+ creation. default: 256KB or 256KB.
These variables are checked only at launched time.
* added constant DEFAULT_PARAMS to get above default parameters.
diff --git a/doc/NEWS-2.1.0 b/doc/NEWS-2.1.0
deleted file mode 100644
index 5d4152b8dc..0000000000
--- a/doc/NEWS-2.1.0
+++ /dev/null
@@ -1,376 +0,0 @@
-# -*- rdoc -*-
-
-= NEWS for Ruby 2.1.0
-
-This document is a list of user visible feature changes made between
-releases except for bug fixes.
-
-Note that each entry is kept so brief that no reason behind or
-reference information is supplied with. For a full list of changes
-with all sufficient information, see the ChangeLog file.
-
-== Changes since the 2.0.0 release
-
-=== Language changes
-
-* Now the default values of keyword arguments can be omitted. Those
- "required keyword arguments" need giving explicitly at the call time.
-
-* Added suffixes for integer and float literals: 'r', 'i', and 'ri'.
- * "42r" and "3.14r" are evaluated as Rational(42, 1) and 3.14.rationalize,
- respectively. But exponential form with 'r' suffix like "6.022e+23r" is
- not accepted because it is misleading.
- * "42i" and "3.14i" are evaluated as Complex(0, 42) and Complex(0, 3.14),
- respectively.
- * "42ri" and "3.14ri" are evaluated as Complex(0, 42r) and Complex(0, 3.14r),
- respectively.
-
-* def-expr now returns the symbol of its name instead of nil.
-
-=== Core classes updates (outstanding ones only)
-
-* Array
- * New methods
- * Array#to_h converts an array of key-value pairs into a Hash.
-
-* Binding
- * New methods
- * Binding#local_variable_get(symbol)
- * Binding#local_variable_set(symbol, obj)
- * Binding#local_variable_defined?(symbol)
-
-* Enumerable
- * New methods
- * Enumerable#to_h converts a list of key-value pairs into a Hash.
-
-* Exception
- * New methods
- * Exception#cause provides the previous exception which has been caught
- at where raising the new exception.
-
-* GC
- * improvements:
- * introduced the generational GC a.k.a RGenGC.
- * added environment variables:
- * RUBY_GC_HEAP_INIT_SLOTS
- * RUBY_GC_HEAP_FREE_SLOTS
- * RUBY_GC_HEAP_GROWTH_FACTOR
- * RUBY_GC_HEAP_GROWTH_MAX_SLOTS
- * RUBY_GC_MALLOC_LIMIT_MAX
- * RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
- * RUBY_GC_OLDMALLOC_LIMIT
- * RUBY_GC_OLDMALLOC_LIMIT_MAX
- * RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
- * obsoleted environment variables:
- * RUBY_FREE_MIN (Use RUBY_GC_HEAP_FREE_SLOTS instead)
- * RUBY_HEAP_MIN_SLOTS (Use RUBY_GC_HEAP_INIT_SLOTS instead)
-
-* Integer
- * New methods
- * Fixnum#bit_length
- * Bignum#bit_length
- * Bignum performance improvement
- * Use GMP if available.
- GMP is used only for several operations:
- multiplication, division, radix conversion, GCD
-
-* IO
- * extended methods:
- * IO#seek supports SEEK_DATA and SEEK_HOLE as whence.
- * IO#seek accepts symbols (:CUR, :END, :SET, :DATA, :HOLE) for 2nd argument.
- * IO#read_nonblock accepts optional `exception: false` to return symbols
- * IO#write_nonblock accepts optional `exception: false` to return symbols
-
-* Kernel
- * New methods:
- * Kernel#singleton_method
-
-* Module
- * New methods:
- * Module#using, which activates refinements of the specified module only
- in the current class or module definition.
- * Module#singleton_class? returns true if the receiver is a singleton class
- or false if it is an ordinary class or module.
- * extended methods:
- * Module#refine is no longer experimental.
- * Module#include and Module#prepend are now public methods.
-
-* Mutex
- * misc
- * Mutex#owned? is no longer experimental.
-
-* Numeric
- * extended methods:
- * Numeric#step allows the limit argument to be omitted, in which
- case an infinite sequence of numbers is generated. Keyword
- arguments `to` and `by` are introduced for ease of use.
- `by` can be 0, in which case the same value will be generated
- indefinitely.
-
-* Process
- * New methods:
- * alternative methods to $0/$0=:
- * Process.argv0() returns the original value of $0.
- * Process.setproctitle() sets the process title without affecting $0.
- * Process.clock_gettime
- * Process.clock_getres
-
-* String
- * "literal".freeze is now optimized to return the same object
- * New methods:
- * String#scrub and String#scrub! verify and fix invalid byte sequence.
- If you want to use this function with older Ruby,
- consider to use string-scrub.gem.
-
-* Symbol
- * All symbols are now frozen.
-
-* pack/unpack (Array/String)
- * Q! and q! directives for long long type if platform has the type.
-
-* toplevel
- * extended methods:
- * main.using is no longer experimental. The method activates refinements
- in the ancestors of the argument module to support refinement
- inheritance by Module#include.
-
-=== Core classes compatibility issues (excluding feature bug fixes)
-
-* Hash
- * incompatible changes:
- * Hash#reject will return plain Hash object in the future versions, that
- is the original object's subclass, instance variables, default value,
- and taintedness will be no longer copied, so now warnings are emitted
- when called with such Hash.
-
-* IO
- * incompatible changes:
- * open ignore internal encoding if external encoding is ASCII-8BIT.
-
-* Kernel#eval, Kernel#instance_eval, and Module#module_eval.
- * Copies the scope information of the original environment, which means
- that private, protected, public, and module_function without arguments
- do not affect the environment outside the eval string.
- For example, `class Foo; eval "private"; def foo; end; end' doesn't make
- Foo#foo private.
-
-* Kernel#untrusted?, untrust, and trust
- * These methods are deprecated and their behavior is same as tainted?,
- taint, and untaint, respectively. If $VERBOSE is true, they show warnings.
-
-* Module#ancestors
- * The ancestors of a singleton class now include singleton classes,
- in particular itself.
-
-* Module#define_method and Object#define_singleton_method
- * Now they return the symbols of the defined methods, not the methods/procs
- themselves.
-
-* Numeric#quo
- * Raises TypeError instead of ArgumentError if the receiver doesn't have
- to_r method.
-
-* Proc
- * Returning from lambda proc now always exits from the Proc, not from the
- method where the lambda is created. Returning from non-lambda proc exits
- from the method, same as the former behavior.
-
-String
- * If invalid: :replace is specified for String#encode, replace
- invalid byte sequence even if the destination encoding equals to
- the source encoding.
-
-=== Stdlib updates (outstanding ones only)
-
-* CGI::Util
- * All class methods modulized.
-
-* Digest
- * extended methods:
- * Digest::Class.file takes optional arguments for its constructor
-
-* Matrix
- * Added Vector#cross_product.
-
-* Net::SMTP
- * Added Net::SMTP#rset to implement the RSET command
-
-* objspace
- * new method:
- * ObjectSpace.trace_object_allocations
- * ObjectSpace.trace_object_allocations_start
- * ObjectSpace.trace_object_allocations_stop
- * ObjectSpace.trace_object_allocations_clear
- * ObjectSpace.allocation_sourcefile
- * ObjectSpace.allocation_sourceline
- * ObjectSpace.allocation_class_path
- * ObjectSpace.allocation_method_id
- * ObjectSpace.allocation_generation
- * ObjectSpace.reachable_objects_from_root
- * ObjectSpace.dump
- * ObjectSpace.dump_all
-
-* OpenSSL::BN
- * extended methods:
- * OpenSSL::BN.new allows Fixnum/Bignum argument.
-
-* open-uri
- * Support multiple fields with same field name (like Set-Cookie).
-
-* Pathname
- * New methods:
- * Pathname#write
- * Pathname#binwrite
-
-* rake
- * Updated to 10.1.0. Major changes include removal of the class namespace,
- Rake::DSL to hold the rake DSL methods and removal of support for legacy
- rake features.
-
- For a complete list of changes since rake 0.9.6 see:
-
- http://rake.rubyforge.org/doc/release_notes/rake-10_1_0_rdoc.html
-
- http://rake.rubyforge.org/doc/release_notes/rake-10_0_3_rdoc.html
-
-* RbConfig
- * New constants:
- * RbConfig::SIZEOF is added to provide the size of C types.
-
-* RDoc
- * Updated to 4.1.0. Major enhancements include a modified default template
- * and accessibility enhancements.
-
- For a list of minor enhancements and bug fixes see:
- https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
-
-* Resolv
- * New methods:
- * Resolv::DNS.fetch_resource
- * One-shot multicast DNS support
- * Support LOC resources
-
-* REXML::Parsers::SAX2Parser
- * Fixes wrong number of arguments of entitydecl event. Document of the event
- says "an array of the entity declaration" but implementation passes two
- or more arguments. It is an implementation bug but it breaks backward
- compatibility.
-
-* REXML::Parsers::StreamParser
- * Supports "entity" event.
-
-* REXML::Text
- * REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
- * REXML::Text#<< supports not "raw" mode.
-
-* Rinda::RingServer, Rinda::RingFinger
- * Rinda now supports multicast sockets. See Rinda::RingServer and
- Rinda::RingFinger for details.
-
-* RubyGems
- * Updated to 2.2.0. Notable new features include:
-
- * Gemfile or gem.deps.rb support including Gem.file.lock (experimental)
- * Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
- * Support for a sharing a GEM_HOME across ruby platforms and versions
-
- For a complete list of enhancements and bug fixes see:
- https://github.com/rubygems/rubygems/tree/master/History.txt
-
-* Set
- * New methods:
- * Set#intersect?
- * Set#disjoint?
-
-* Socket
- * New methods:
- * Socket.getifaddrs
-
-* StringScanner
- * extended methods:
- * StringScanner#[] supports named captures.
-
-* Syslog::Logger
- * Added facility.
-
-* Tempfile
- * New methods:
- * Tempfile.create
-
-* Timeout
- * The exception to terminate the given block can no longer be rescued
- inside the block, by default, unless the exception class is given
- explicitly.
-
-* TSort
- * New methods:
- * TSort.tsort
- * TSort.tsort_each
- * TSort.strongly_connected_components
- * TSort.each_strongly_connected_component
- * TSort.each_strongly_connected_component_from
-
-* WEBrick
- * The body of a response may now be a StringIO or other IO-like that responds
- to #readpartial and #read.
-
-* XMLRPC::Client
- * New methods:
- * XMLRPC::Client#http. It returns Net::HTTP for the client. Normally,
- it is not needed. It is useful when you want to change minor HTTP client
- options. You can change major HTTP client options by XMLRPC::Client
- methods. You should use XMLRPC::Client methods for changing major
- HTTP client options instead of XMLRPC::Client#http.
-
-=== Stdlib compatibility issues (excluding feature bug fixes)
-
-* Set
- * incompatible changes:
- * Set#to_set now returns self instead of generating a copy.
-
-* URI
- * incompatible changes:
- * URI.decode_www_form follows current WHATWG URL Standard.
- It gets encoding argument to specify the character encoding.
- It now allows loose percent encoded strings, but denies ;-separator.
- * URI.encode_www_form follows current WHATWG URL Standard.
- It gets encoding argument to convert before percent encode.
- UTF-16 strings aren't converted to UTF-8 before percent encode by default.
-
-* curses
- * Removed.
- curses is now available as a gem.
- See https://rubygems.org/gems/curses for details.
-
-=== Built-in global variables compatibility issues
-
-* $SAFE
- * $SAFE=4 is obsolete. If $SAFE is set to 4 or larger, an ArgumentError
- is raised.
-
-=== C API updates
-
-* rb_gc_set_params() is deprecated. This is only used in Ruby internal.
-
-* rb_gc_count() added. This returns the number of times GC occurred.
-
-* rb_gc_stat() added. This allows access to specific GC.stat() values from C
- without any allocation overhead.
-
-* rb_gc_latest_gc_info() added. This allows access to GC.latest_gc_info().
-
-* rb_postponed_job_register() added. Takes a function callback which is invoked
- when the VM is in a consistent state, i.e. to perform work from a C signal
- handler.
-
-* rb_profile_frames() added. Provides low-cost access to the current ruby stack
- for callstack profiling.
-
-* rb_tracepoint_new() supports new internal events accessible only from C:
- * RUBY_INTERNAL_EVENT_NEWOBJ
- * RUBY_INTERNAL_EVENT_FREEOBJ
- * RUBY_INTERNAL_EVENT_GC_START
- * RUBY_INTERNAL_EVENT_GC_END_MARK
- * RUBY_INTERNAL_EVENT_GC_END_SWEEP
- * Note that you *can not* specify "internal events" with normal events
- (such as RUBY_EVENT_CALL, RUBY_EVENT_RETURN) simultaneously.
diff --git a/doc/NEWS-2.2.0 b/doc/NEWS-2.2.0
deleted file mode 100644
index 70ccddf32d..0000000000
--- a/doc/NEWS-2.2.0
+++ /dev/null
@@ -1,361 +0,0 @@
-# -*- rdoc -*-
-
-= NEWS for Ruby 2.2.0
-
-This document is a list of user visible feature changes made between
-releases except for bug fixes.
-
-Note that each entry is kept so brief that no reason behind or
-reference information is supplied with. For a full list of changes
-with all sufficient information, see the ChangeLog file.
-
-== Changes since the 2.1.0 release
-
-=== Language changes
-
-* nil/true/false
- * nil/true/false objects are frozen. [Feature #8923]
-
-* Hash literal
- * Symbol key followed by a colon can be quoted. [Feature #4276]
-
-* default argument
- fixed a very longstanding bug that an optional argument was not
- accessible in its default value expression. [Bug #9593]
-
-=== Core classes updates (outstanding ones only)
-
-* Binding
- * New methods:
- * Binding#local_variables
- * Binding#receiver
-
-* Dir
- * New methods:
- * Dir#fileno
-
-* Enumerable
- * New methods:
- * Enumerable#slice_after
- * Enumerable#slice_when
- * Extended methods:
- * min, min_by, max and max_by supports optional argument to return
- multiple elements.
-
-* Float
- * New methods:
- * Float#next_float
- * Float#prev_float
-
-* File
- * New methods:
- * File.birthtime
- * File#birthtime
-
-* File::Stat
- * New methods:
- * File::Stat#birthtime
-
-* GC
- * GC.latest_gc_info returns :state to represent current GC status.
- * Improvements
- * Introduce incremental marking for major GC. [Feature #10137]
-
-* IO
- * Improvements
- * IO#nonblock_read and IO#nonblock_write for pipes on Windows are supported.
-
-* Kernel
- * New methods:
- * Kernel#itself
- * Improvements
- * Kernel#throw raises UncaughtThrowError, subclass of ArgumentError when
- there is no corresponding catch block, instead of ArgumentError.
-
-* Process
- * Extended method:
- * Process execution methods such as Process.spawn opens the file in write
- mode for redirect from [:out, :err].
-
-* String
- * New methods:
- * String#unicode_normalize
- * String#unicode_normalize!
- * String#unicode_normalized?
-
-* Symbol
- * Improvements
- * Most symbols which are returned by String#to_sym and
- String#intern are GC-able.
-
-* Method
- * New methods:
- * Method#curry([arity]) returns a curried Proc.
- * Method#super_method returns a Method of superclass, which would be called
- when super is used.
-
-=== Core classes compatibility issues (excluding feature bug fixes)
-
-* Enumerable
- * Enumerable#slice_before's state management deprecated.
- * Enumerable#chunk's state management deprecated.
-
-* GC
- * incompatible changes:
- * Rename GC.stat entries. [Feature #9924]
- See https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing
-
-* Hash
- * incompatible changes:
- * Change overriding policy for duplicated key. [Bug #10315]
- { **hash1, **hash2 } contains values of hash2 for duplicated keys.
-
-* IO
- * incompatible changes:
- * When flushing file IO with IO#flush, you cannot assume that the metadata
- of the file is updated immediately. On some platforms (especially
- Windows), it is delayed until the filesystem load is decreased.
- Use IO#fsync if you want to guarantee updating metadata.
-
-* Math
- * incompatible changes:
- * Math.log now raises Math::DomainError instead of returning NaN if the
- base is less than 0, and returns NaN instead of -infinity if both of
- two arguments are 0.
- * Math.atan2 now returns values like as expected by C99 if both two
- arguments are infinity.
-
-* Proc
- * incompatible changes:
- * ArgumentError is no longer raised when lambda Proc is passed as a
- block, and the number of yielded arguments does not match the formal
- arguments of the lambda, if just an array is yielded and its length
- matches.
-
-* Process
- * Process execution methods such as Process.spawn opens the file in write
- mode for redirect from [:out, :err].
- Before Ruby 2.2, it was opened in read mode.
-
-=== Stdlib updates (outstanding ones only)
-
-* Continuation
- * callcc is obsolete. use Fiber instead.
-
-* Digest
-
- * Digest() should now be thread-safe. If you have a problem with
- regard to on-demand loading under a multi-threaded environment,
- preload "digest/*" modules on boot or use this method instead of
- directly referencing Digest::*.
- * Digest::HMAC has been removed just as previously noticed.
-
-* DL
- * DL has been removed from stdlib. Please use Fiddle instead!
-
-* Etc
- * New methods:
- * Etc.uname
- * Etc.sysconf
- * Etc.confstr
- * IO#pathconf
- * Etc.nprocessors
-
-* Find, Pathname
- * Extended methods:
- * find method accepts "ignore_error" keyword argument.
-
-* Matrix
- * New methods:
- * Matrix#first_minor(row, column) returns the submatrix obtained
- by deleting the specified row and column.
- * Matrix#cofactor(row, column) returns the (row, column) cofactor
- which is obtained by multiplying the first minor by (-1)**(row + column).
- * Matrix#adjugate returns the adjugate of the matrix.
- * hstack and vstack are new instance and class methods to stack matrices
- horizontally and vertically.
- * Matrix#laplace_expansion(row_or_column: num) returns the laplace_expansion
- along the +num+ -th row or column.
- * Vector.basis(size:, index:) returns the specified basis vector.
- * Unary - and + added for Vector and Matrix.
- * Vector#cross_product generalized to arbitrary dimensions.
- * Vector#dot and #cross are aliases for #inner_product and #cross_product.
- * Vector#angle_with returns the angle with its argument
- * New instance and class method independent? to test linear independence.
-
-* Pathname
- * Pathname#/ is aliased to Pathname#+.
- * New methods:
- * Pathname#birthtime
-
-* Rake
- * Updated to Rake 10.4.0. For full release notes see:
-
- http://docs.seattlerb.org/rake/History_rdoc.html#label-10.4.0
-
-* RubyGems
- * Updated to RubyGems 2.4.2. For full release notes see:
-
- http://docs.seattlerb.org/rubygems/History_txt.html#label-2.4.2+%2F+2014-10-01
-
-* TSort
- * TSort.tsort_each, TSort.each_strongly_connected_component and
- TSort.each_strongly_connected_component_from returns an enumerator if
- no block given.
-
-* XMLRPC
- * Added new parser class named LibXMLStreamParser.
-
-=== Stdlib compatibility issues (excluding feature bug fixes)
-
-* lib/mathn.rb
- * Show deprecated warning [Feature #10169]
-
-* ext/date/lib/date/format.rb
- * Removed because it's empty file.
-
-* Digest
- * Digest::HMAC has finally ceased to exist. Use OpenSSL::HMAC or an external gem instead.
-
-* time.rb
- * Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema may produce
- fixed-offset Time objects.
- It is happen when usual localtime doesn't preserve the offset from UTC.
- * Time.httpdate produces always UTC Time object.
- * Time.strptime raises ArgumentError when no date information.
-
-* lib/rational.rb
- * Removed because it is deprecated from 2009.
-
-* lib/complex.rb
- * Removed because it is deprecated from 2009.
-
-* lib/prettyprint.rb
- * Removed PrettyPrint#first?
-
-* lib/minitest/*.rb
- * Removed because it conflicts to minitest 5. [Feature #9711]
-
-* lib/test/**/*.rb
- * Removed because it conflicts to minitest 5, and it was just an wrapper
- of minitest 4. [Feature #9711]
-
-* lib/uri
- * support RFC 3986. [Feature #2542]
-
-* GServer
- * GServer is extracted to gserver gem. It's unmaintain code.
-
-* Logger
- * Logger::Application is extracted to logger-application gem. It's unmaintain code.
-
-* ObjectSpace (after requiring "objspace")
- * ObjectSpace.memsize_of(obj) returns a size includes sizeof(RVALUE).
- [Bug #8984]
-
-* Prime
- * incompatible changes:
- * Prime.prime? now returns false for negative numbers. This method
- should not be used to know the number is composite or not. [Bug #7395]
-
-* Psych
- * Removed Psych::EngineManager [Bug #8344]
-
-=== Built-in global variables compatibility issues
-
-=== C API updates
-
-* Deprecated APIs removed. [Feature #9502]
-
- Check_SafeStr -> SafeStringValue
- rb_check_safe_str -> SafeStringValue
- rb_quad_pack -> rb_integer_pack
- rb_quad_unpack -> rb_integer_unpack
- rb_read_check : access struct FILE internal. no replacement.
- rb_struct_iv_get : internal function. no replacement.
- struct rb_blocking_region_buffer : internal type. no replacement.
- rb_thread_blocking_region_begin -> rb_thread_call_without_gvl family
- rb_thread_blocking_region_end -> rb_thread_call_without_gvl family
- TRAP_BEG -> rb_thread_call_without_gvl family
- TRAP_END -> rb_thread_call_without_gvl family
- rb_thread_select -> rb_thread_fd_select
- struct rb_exec_arg : internal type. no replacement.
- rb_exec : internal function. no replacement.
- rb_exec_arg_addopt : internal function. no replacement.
- rb_exec_arg_fixup : internal function. no replacement.
- rb_exec_arg_init : internal function. no replacement.
- rb_exec_err : internal function. no replacement.
- rb_fork : internal function. no replacement.
- rb_fork_err : internal function. no replacement.
- rb_proc_exec_n : internal function. no replacement.
- rb_run_exec_options : internal function. no replacement.
- rb_run_exec_options_err : internal function. no replacement.
- rb_thread_blocking_region -> rb_thread_call_without_gvl family
- rb_thread_polling -> rb_thread_wait_for
- rb_big2str0 : internal function. no replacement.
- rb_big2ulong_pack -> rb_integer_pack
- rb_gc_set_params : internal function. no replacement.
- rb_io_mode_flags -> rb_io_modestr_fmode
- rb_io_modenum_flags -> rb_io_oflags_fmode
-
-* struct RBignum is hidden. [Feature #6083]
- Use rb_integer_pack and rb_integer_unpack instead.
-
-* struct RRational is hidden. [Feature #9513]
- Use rb_rational_num and rb_rational_den instead.
-
-* rb_big_new and rb_big_resize takes a size_t instead of long.
-
-* rb_num2long returns a long instead of SIGNED_VALUE.
-
-* rb_num2ulong returns an unsigned long instead of VALUE.
-
-* st hash table uses power-of-two sizes for speed [Feature #9425].
- Lookups are 10-25% faster if using appropriate hash functions.
- However, weaknesses in hash distribution can no longer be masked
- by prime number-sized tables, so extensions may need to tweak
- hash functions to ensure good distribution.
-
-* rb_sym2str() added. This is almost same as `rb_id2str(SYM2ID(sym))`
- but not pinning a dynamic symbol.
-
-* rb_str_cat_cstr() added. This is same as `rb_str_cat2()`.
-
-* `rb_str_substr()` and `rb_str_subseq()` will share middle of a string,
- but not only the end of a string, in the future. Therefore, result
- strings may not be NUL-terminated, `StringValueCStr()` is needed
- calling to obtain a NUL-terminated C string.
-
-* rb_tracepoint_new() supports new internal events accessible only from C:
- * RUBY_INTERNAL_EVENT_GC_ENTER
- * RUBY_INTERNAL_EVENT_GC_EXIT
- r47528
-
-* rb_hash_delete() now does not call the block given to the current method.
-
-* rb_extract_keywords() and rb_get_kwargs() exported. See README.EXT
- for details.
-
-=== Build system updates
-
-* jemalloc is optionally supported via `./configure --with-jemalloc`
- jemalloc may be suitable when system malloc is slow or prone
- to fragmentation. [Feature #9113]
-
-=== Implementation changes
-
-* GC
- * Most symbols which are returned by String#to_sym and
- String#intern are GC-able [Feature #9634]
- * Introduce incremental marking for major GC. [Feature #10137]
- * Enable lazy sweep on GC caused by malloc().
-
-* VM
- * Use frozen string literals for Hash#[] and Hash#[]=
- * Fast keyword arguments passing [Feature #10440]
- * Allow to receive huge splatted array by a rest argument
- [Feature #10440]
-
-* Process
- * Process creation methods, such as spawn(), uses vfork() system call.
- vfork() is faster than fork() when the parent process uses huge memory.
diff --git a/doc/contributing.rdoc b/doc/contributing.rdoc
index 898f1174eb..85f7c920a9 100644
--- a/doc/contributing.rdoc
+++ b/doc/contributing.rdoc
@@ -49,44 +49,6 @@ on your ticket.
* Please reply to feedback requests. If a bug report doesn't get any feedback,
it'll eventually get rejected.
-=== Reporting to downstream distributions
-
-You can report downstream issues for the following distributions via their bug tracker:
-
-* {debian}[http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=ruby-defaults]
-* {freebsd}[http://www.freebsd.org/cgi/query-pr-summary.cgi?text=ruby]
-* {redhat}[https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=MODIFIED]
-* {macports}[http://trac.macports.org/query?status=assigned&status=new&status=reopened&port=~ruby]
-* etc (add your distribution bug tracker here)
-
-=== Platform Maintainers
-
-For platform specific bugs in Ruby, you can assign your ticket to the current
-maintainer for a specific platform.
-
-The current active platform maintainers are as follows:
-
-[mswin32, mswin64 (Microsoft Windows)]
- NAKAMURA Usaku (usa)
-[mingw32 (Minimalist GNU for Windows)]
- Nobuyoshi Nakada (nobu)
-[IA-64 (Debian GNU/Linux)]
- TAKANO Mitsuhiro (takano32)
-[Symbian OS]
- Alexander Zavorine (azov)
-[AIX]
- Yutaka Kanemoto (kanemoto)
-[FreeBSD]
- Akinori MUSHA (knu)
-[Solaris]
- Naohisa Goto (ngoto)
-[RHEL, CentOS]
- KOSAKI Motohiro kosaki
-[Mac OS X]
- Kenta Murata (mrkn)
-[cygwin, bcc32, djgpp, wince, ...]
- none. (Maintainer WANTED)
-
== Reporting Security Issues
Security vulnerabilities receive special treatment since they may negatively
@@ -96,29 +58,16 @@ mailto:security@ruby-lang.org list and the problem will be published after
fixes have been released. You can also encrypt the issue using {the PGP public
key}[http://www.ruby-lang.org/security.asc] for the list.
-== Reporting Other Issues
-
-If you're having an issue with the website, or maybe the mailing list, you can
-contact the webmaster to help resolve the problem.
-
-The current webmaster is:
-
-* Hiroshi SHIBATA (hsbt)
-
-You can also report issues with the ruby-lang.org website on the issue tracker:
-
-* {issue tracker}[https://github.com/ruby/www.ruby-lang.org/issues]
-
== Resolve Existing Issues
As a next step beyond reporting issues you can help the core team resolve
existing issues. If you check the Everyone's Issues list in GitHub Issues,
-you will find a lot of issues already requiring attention. What can you do for
+you'll find lots of issues already requiring attention. What can you do for
these? Quite a bit, actually:
When a bug report goes for a while without any feedback, it goes to the bug
graveyard which is unfortunate. If you check the {issues
-list}[https://bugs.ruby-lang.org/projects/ruby-trunk/issues] you will find lots
+list}[https://bugs.ruby-lang.org/projects/ruby-trunk/issues] you'll find lots
of delinquent bugs that require attention.
You can help by verifying the existing tickets, try to reproduce the reported
@@ -154,7 +103,7 @@ patch.
== How To Request Features
-If there's a new feature that you want to see added to Ruby, you will need to
+If there's a new feature that you want to see added to Ruby, you'll need to
write a convincing proposal and patch to implement the feature.
For new features in CRuby, use the {'Feature'
@@ -174,7 +123,7 @@ requests can seem like an alluring way to contribute to Ruby, often these
discussions can lead nowhere and exhaust time and energy that could be better
spent fixing bugs. Choose your battles.
-A good template for a feature proposal should look something like this:
+A good template for feature proposal should look something like this:
[Abstract]
Summary of your feature
@@ -197,29 +146,10 @@ A good template for a feature proposal should look something like this:
[See also]
Links to the other related resources
-=== Slideshow
-
-At the Ruby Developer Meeting in Japan, committers discuss Feature Proposals together in Tokyo. We will judge proposals and then accept, reject, or give feedback for them.
-If you have a stalled proposal, making a slide to submit is good way to get feedback.
-
-Slides should be:
-
-* One-page slide
-* Include a corresponding ticket number
-* MUST include a figure and/or short example code
-* SHOULD have less sentence in natural language (try to write less than 140 characters)
-* It is RECOMMENDED to itemize: motivation/use case, proposal, pros/cons, corner case
-* PDF or Image (Web browsers can show it)
-
-Please note:
-
-* Even if the proposal is generally acceptable, it won't be accepted without writing corner cases in the ticket
-* Slide's example: DevelopersMeeting20130727Japan
-
== Backport Requests
-When a new version of Ruby is released, it starts at patch level 0 (p0), and
-bugs will be fixed first on the trunk branch. If it's determined that a bug
+When a new version of Ruby is released it starts at patch level 0 (p0), and
+bugs will be fixed first on the trunk branch. If its determined that a bug
exists in a previous version of Ruby that is still in the bug fix stage of
maintenance, then a patch will be backported. After the maintenance stage of a
particular Ruby version ends, it goes into "security fix only" mode which
@@ -239,29 +169,6 @@ Each major version of Ruby has a release manager that should be assigned to
handle backport requests. You can find the list of release managers on the
{wiki}[https://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering].
-=== Branch Maintainers
-
-A branch maintainer maintains a branch and releases a new release of Ruby. The
-branch depends on the associated version of Ruby, such as ruby_1_8_7 for
-version 1.8.7. The current branch maintainers are as follows:
-
-[trunk]
- unnecessary
-[ruby_2_2]
- Chikanaga Tomoyuki (nagachika)
-[ruby_2_1]
- NAKAMURA Usaku (usa)
-[ruby_2_0_0]
- NAKAMURA Usaku (usa)
-[ruby_1_9_3, ruby_1_9_2, ruby_1_9_1]
- _unmaintained_
-[ruby_1_8]
- _unmaintained_
-[ruby_1_8_7]
- _unmaintained_
-[ruby_1_8_6 ...]
- _unmaintained_
-
== Running tests
In order to help resolve existing issues and contributing patches to Ruby you
@@ -294,6 +201,7 @@ libraries, but these are not required:
* Tcl/Tk
* NDBM/QDBM
* GDBM
+* Ncurses (or something)
* OpenSSL
* readline/editline(libedit)
* zlib
@@ -313,7 +221,7 @@ Now let's build CRuby:
autoconf
mkdir build && cd build # its good practice to build outside of source dir
mkdir ~/.rubies # we will install to .rubies/ruby-trunk in our home dir
- ../configure --prefix="${HOME}/.rubies/ruby-trunk"
+ ../configure --prefix=~/.rubies/ruby-trunk
make && make install
After adding Ruby to your PATH, you should be ready to run the test suite:
@@ -329,7 +237,7 @@ This is also how you can run a specific test from our build dir:
make test-all TESTS=drb/test_drb.rb
-For older versions of Ruby you will need to run the build setup again after
+For older versions of Ruby you'll need to run the build setup again after
checking out the associated branch in git, for example if you wanted to
checkout 1.9.3:
@@ -346,24 +254,6 @@ Manual}[https://bugs.ruby-lang.org/projects/rurema] in Japanese.
== Contributing A Patch
-=== Deciding what to patch
-
-Before you submit a patch, there are a few things you should know:
-
-* Pay attention to the maintenance policy for stable and maintained versions of Ruby.
-* Released versions in security mode will not merge feature changes.
-* Search for previous discussions on ruby-core to verify the maintenance policy
-* Patches must be distributed under Ruby's license.
-* This license may change in the future, you must join the discussion if you don't agree to the change
-
-To improve the chance your patch will be accepted please follow these simple rules:
-
-* Bug fixes should be committed on trunk first
-* Format of the patch file must be a unified diff (ie: diff -pu, svn diff, or git diff)
-* Don't introduce cosmetic changes
-* Follow the original coding style of the code
-* Don't mix different changes in one commit
-
First thing you should do is check out the code if you haven't already:
git clone git://github.com/ruby/ruby.git ruby-trunk
@@ -378,8 +268,6 @@ your local computer and won't be part of the official Ruby repository. It will
be used to create patches based on the differences between your branch and
trunk, or edge Ruby.
-=== Coding style
-
Here are some general rules to follow when writing Ruby and C code for CRuby:
* Indent 4 spaces for C with tabs for eight-space indentation (emacs default)
@@ -393,11 +281,6 @@ Here are some general rules to follow when writing Ruby and C code for CRuby:
* ABBRs should be all upper case.
* Do as others do
-=== ChangeLog
-
-Although not required, if you wish to add a ChangeLog entry for your change
-please note:
-
You can use the following template for the ChangeLog entry on your commit:
Thu Jan 1 00:00:00 2004 Your Name <yourmail@example.com>
@@ -439,8 +322,7 @@ your working branch:
Now that you've got some code you want to contribute, let's get set up to
generate a patch. Start by forking the github mirror, check the {github docs on
forking}[https://help.github.com/articles/fork-a-repo] if you get stuck here.
-You will only need a github account if you intend to host your repository
-on github.
+here. You will also need a github account if you don't yet have one.
Next copy the writable url for your fork and add it as a git remote, replace
"my_username" with your github account name:
@@ -458,11 +340,6 @@ the patch for you, save the file to your computer and upload it to the bug
tracker. Alternatively you can submit a pull request, but for the best chances
to receive feedback add it is recommended you add it to redmine.
-Since git is a distributed system, you are welcome to host your git repository
-on any {publicly accessible hosting
-site}[https://git.wiki.kernel.org/index.php/GitHosting], including {hosting your
-own}[https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#public-repositories]
-You may use the {'git format-patch'}[http://git-scm.com/docs/git-format-patch]
-command to generate patch files to upload to redmine. You may also use
-the {'git request-pull'}[http://git-scm.com/docs/git-request-pull] command for
-formatting pull request messages to redmine.
+
+
+
diff --git a/doc/contributors.rdoc b/doc/contributors.rdoc
deleted file mode 100644
index ced4eb1cd0..0000000000
--- a/doc/contributors.rdoc
+++ /dev/null
@@ -1,778 +0,0 @@
-= Contributors to Ruby
-
-The following list might be incomplete. Feel free to add your name if your
-patch was accepted into Ruby.
-
-== A
-
-Ayumu AIZAWA (ayumin)
-* committer
-
-AKIYOSHI, Masamichi (akiyoshi)
-* committer
-* He had maintained the VMS support on 2003-2004.
-
-Muhammad Ali
-* wrote rdoc for Fiber
-
-Minero Aoki (aamine)
-* committer
-* He is the maintainer of:
- * fileutils
- * net/http, net/https
- * net/pop
- * net/smtp
- * racc
- * ripper
- * strscan
-
-Wakou Aoyama (wakou)
-* committer
-* He was the maintainer of some standard libraries.
-
-Koji Arai
-* committer
-
-arton
-* He is the distributor of ActiveScriptRuby and experimental 1.9.0-x installers for win32.
-* Wrote patches for win32ole, gc.c, tmpdir.rb
-
-== B
-
-Daniel Berger
-* a patch for irb
-* documentation
-* He wrote forwardable.rb
-
-David Black (dblack)
-* committer
-* He is the maintainer of scanf
-
-Ken Bloom
-* a patch for REXML.
-
-Oliver M. Bolzer
-* a patch for soap
-
-Alexey Borzenkov
-* a patch for mkmf.rb
-
-Richard Brown
-* a patch for configure.in
-
-Dirkjan Bussink
-* a patch for date.rb
-
-Daniel Bovensiepen
-* documentation
-* a patch for irb
-
-== C
-
-Brian Candler
-* a patch for configure.in, net/telnet
-
-keith cascio
-* a patch for optparse.rb
-
-Frederick Cheung
-* a patch for test/ruby/test_symbol.rb
-
-Christoph
-* patches for set.rb
-
-Sean Chittenden
-* pathces for net/http, cgi
-
-William D. Clinger
-* ruby_strtod is based on his paper.
-
-== D
-
-Ryan Davis (ryan)
-* committer
-* He wrote and is the maintainer of miniunit
-
-Guy Decoux (ts)
-* committer
-
-Zach Dennis
-
-Martin Duerst (duerst)
-* committer
-* M17N
-
-Paul Duncan
-* pathces for rdoc
-
-Alexander Dymo
-* a patch for lib/benchmark.rb
-
-== E
-
-Yusuke Endoh (mame)
-* committer
-* He wrote and is the maintainer of base64 library (1.9)
-* did much upon YARV compiler.
-
-erlercw
-* wrote Integer::gcd2
-
-== F
-
-Frank S.Fejes
-* a patch for net/pop
-
-Fundakowski Feldman
-* a patch for process.c
-
-Mauricio Fernandez
-* patches for parse.y
-
-David Flanagan (davidflanagan)
-* committer
-* M17N
-
-Takeyuki Fujioka (xibbar)
-* committer
-* He is the maintainer of cgi/*
-
-FUKUMOTO, Atsushi
-* a patch for tracer.rb
-
-Shota Fukumori (sorah)
-* committer
-* #4415 parallel unit/test
-
-Tadayoshi Funaba (tadf)
-* committer
-* He wrote and is the maintainer of
- * date
- * parsedate (1.8)
-* He ported rational.rb and complex.rb, which 1.8 contains, into rational.c and complex.c of 1.9.
-
-== G
-
-David M. Gay
-* ruby_strtod
-
-Florian Gilcher
-* documentation
-
-GOTOU, Kentaro (gotoken)
-* committer
-* He wrote benchmark.rb
-* He is the maintainer of:
- * benchmark.rb
- * open3
-
-GOTOU, Yuuzou (gotoyuzo)
-* committer
-
-James Edward Gray II (jeg2)
-* committer
-* He wrote the faster implementation of CSV and is the maintainer of csv.
-* Wrote documentation for rdoc
-
-== H
-
-Phil Hagelberg
-* patch for ruby-mode.el's documentation.
-
-Kirk Haines (wyhaines)
-* committer
-* the maintainer of ruby_1_8_6 branch
-
-Shinichiro Hamaji
-* fixed memory leaks (marshal.c, string.c)
-
-Shin-ichiro HARA
-* the developer and the sysop of ruby-{dev,list,core,talk} archive.
-* a patch for numeric.c
-
-Chris Heath (traumdeutung)
-* a patch for proc.c
-
-HIROKAWA Hisashi
-* fixed socket/socket.c
-
-Daniel Hob
-* He wrote:
- * SMTP-TLS support for net/smtp.
- * POP3S support
-
-Eric Hodel (drbrain)
-* committer
-* He is the maintainer of:
- * rdoc
- * ri
- * rubygems
-
-Erik Hollensbe
-* a patch for delegate.rb
-
-Johan Holmberg
-* a patch for dir.c
-* documentation
-
-Erik Huelsmann
-
-Dae San Hwang
-* built a continuous integration environment on OpenSolaris.
-
-== I
-
-Nobuhiro IMAI
-* a patch for logger.rb
-
-"incorporate"
-* a patch for sprintf.c
-
-Keiju Ishitsuka (keiju)
-* committer
-* He wrote and is the maintainer of:
- * cmath.rb (1.9)
- * complex.rb (1.8)
- * e2mmap.rb
- * forwardable.rb
- * irb
- * mathn
- * matrix.rb
- * mutex_m.rb
- * rational.rb (1.8)
- * sync.rb
- * shell/*
- * thwait.rb
- * tracer.rb
-
-== J
-
-Curtis Jackson
-* missing/dup2.c
-
-Alan Johnson
-* a patch for net/ftp
-
-Lyle Johnson
-* patches for nkf, bigdecimal, numeric.c
-
-== K
-
-Yoshihiro Kambayashi
-* a patch for enc/trans/single_byte.trans.
-* He wrote supports for some encodings.
-
-Yutaka Kanemoto
-* patches for common.mk, AIX AF_INET6 support
-
-Motoyuki Kasahara
-* He wrote getoptlong.rb
-
-Masahiro Kawato
-* a patch for shellwords.rb
-
-Wataru Kimura
-* a patch for configure.in
-
-Michael Klishin
-* patch for make help.
-
-Noritada Kobayashi
-* a patch for optparse.rb
-
-Shigeo Kobayashi (shigek)
-* committer
-* He is the maintainer of bigdecimal
-
-KONISHI, Hiromasa (H_Konishi)
-* committer
-* He had maintained the bcc32 support in 2004.
-
-Kornelius "murphy" Kalnbach
-* documentation
-
-K.Kosako (kosako)
-* committer
-* He wrote Oniguruma.
-
-Takehiro Kubo
-* patches for dl 64bit support.
-
-== L
-
-Marc-Andre Lafortune (marcandre)
-* committer
-* patches for hash.c, array.c, thread.c, enumc, string.c, range.c and rdoc documentation.
-
-Hongli Lai
-* improved pstore.rb
-* patch for tool/file2lastrev.rb.
-
-raspberry lemon
-* a patch for webrick/httpproxy.rb.
-
-Christian Loew
-* a patch for fileutils.rb
-
-== M
-
-Shugo Maeda (shugo)
-* committer
-* A system administrator of ruby-lang.org servers.
-* He wrote and is the maintainer of:
- * monitor.rb
- * net/ftp
- * net/imap
-
-Stephan Maka (mathew)
-* documentation
-
-Yukihiro Matsumoto (matz)
-* Matz -- the founder, language designer of Ruby.
-* committer
-* Ruby itself, most of Ruby.
-* He is the maintainer of:
- * singleton
- * timeout
- * gdbm
- * sdbm
-
-Konrad Meyer
-* documentation
-
-Mib Software
-* missing/vsnprintf.c
-
-Todd C. Miller
-* missing/strlcat.c
-* missing/strlcpy.c
-
-MIYASAKA, Masaru
-* a patch for cgi.rb
-
-Stefan Monnier
-* regex.c was fixed with based on his Emacs21 patch.
-
-Marcel Moolenaar
-* patches for eval.c and gc.c.
-
-moonwolf
-* a patch for REXML, xmlrpc
-
-Hiroshi Moriyama
-* a patch for yaml.
-
-Kyosuke Morohashi
-* a patch for gem_prelude.rb
-
-Kenta Murata
-* patches for json, bignum.c
-
-Akinori MUSHA (knu)
-* committer
-* He wrote and is the maintainer of:
- * abbrev.rb
- * generator (1.8)
- * enumerator (1.8)
- * set
- * ipaddr.rb
- * digest/*
- * syslog
-* He is the branch maintainer of ruby_1_8, the release manager of 1.8 series.
-
-== N
-
-Hidetoshi NAGAI (nagai)
-* committer
-* He is the maintainer of tk/*
-
-Nobuyoshi Nakada (nobu)
-* committer
-* a.k.a. the "patch monster"
-* He wrote and is the maintainer of:
- * optparse
- * stringio
- * io/wait
- * iconv
-
-Satoshi Nakagawa
-* patches for util.c
-
-Narihiro Nakamura (nari)
-* committer
-* a.k.a. authorNari
-* working at GC
-
-NAKAMURA, Hiroshi (nahi)
-* committer
-* He is the maintainer of:
- * csv.rb (1.8)
- * logger.rb
- * soap/* (1.8)
- * wsdl/* (1.8)
- * xsd/* (1.8)
-
-NAKAMURA, Usaku (usa)
-* committer
-* a.k.a. unak
-* He is the maintainer of mswin32 and mswin64 support.
-
-NARUSE, Yui (naruse)
-* committer
-* a.k.a. "nurse"
-* Did much upon m17n.
-* He is the maintainer of:
- * json
- * nkf
-
-Christian Neukirchen
-* a patch for webrick/httputils
-
-Michael Neumann (mneumann)
-* committer
-* He is the maintainer of
- * xmlrpc (1.8)
- * gserver (1.8)
-
-NISHIO Hirokazu
-* wrote a patch for CVE-2010-0541
-
-Kazuhiro NISHIYAMA (kazu)
-* committer
-* a.k.a. znz
-
-Go Noguchi
-
-Martin Nordholts
-* misc/rdebug.el
-
-nmu
-* a patch for socket
-
-== O
-
-okkez
-* He is a sysop of the Ruby Reference Manual Renewal Project.
-* fixed ipaddr.rb, ext/etc
-
-Haruhiko Okumura
-* some of missing/* is based on his book:
- * missing/erf.c
- * missing/lgamma_r.c
- * missing/tgamma.c
-
-OMAE, jun
-* a patch for debug.rb
-
-Eugene Ossintsev
-* documentation
-
-== P
-
-Heesob Park
-* a patch for win32/win32.c.
-
-pegacorn
-* a patch for instruby.rb
-
-== Q
-
-== R
-
-Gaston Ramos
-* documentation
-
-The Regents of the University of California
-* missing/crypt.c
-* missing/vsnprintf.c
-
-Sam Roberts
-* patch for socket
-* documentation
-
-Michal Rokos (michal)
-* committer
-* He was the maintainer of DJGPP support.
-
-rubikitch
-* a patch for io.c
-
-Marcus Rueckert
-* a patch for mkconfig.rb.
-
-Run Paint Run Run
-* patch for enc/unicode.c
-* documentation
-
-Sean Russell (ser)
-* committer
-* He wrote and is the maintainer of REXML.
-
-== S
-
-Kazuo Saito (ksaito)
-* committer
-* M17N
-
-Tadashi Saito
-* patches for test/ruby/test_math.rb, thread_*.c, bignum.c
-* working upon BigDecimal.
-* did much upon documentation
-
-Masahiro Sakai
-* a patch for io.c
-
-Laurent Sansonetti
-* a patch for tool/ytab.sed
-
-Jeff Saracco
-* documentation
-
-Koichi Sasada (ko1)
-* committer
-* He wrote YARV.
-
-Hugh Sasse
-* a patch for net/http
-* documentation
-
-Charlie Savage
-* a patch for win32/Makefile.sub
-
-Michael Scholz
-* a patch for ruby-mode.el
-
-Arthur Schreiber
-* patch for net/http and rdoc.
-
-Masatoshi SEKI (seki)
-* committer
-* He wrote and is the maintainer of:
- * drb/*
- * erb
- * rinda
-
-Roman Shterenzon
-* a patch for open-uri.
-
-Kent Sibilev
-
-Gavin Sinclair (gsinclair)
-* committer
-
-John W. Small
-* He wrote gserver.rb
-
-Yuki Sonoda (yugui)
-* committer
-* She is the maintainer of man/* manual pages and is the release manager of 1.9 series.
-* She wrote prime.rb.
-* A developer and a sysop of redmine.ruby-lang.org.
-
-SOUMA, Yutaka
-* a patch for pack.c.
-
-Tatsuki Sugiura
-* WebDAV support for net/http
-
-Masaki Suketa (suke)
-* committer
-* He is the maintainer of win32ole
-
-sheepman
-* patches for ruby.c, thread.c, stringio, enum.c, webrick, net/http
-
-Siena. (siena)
-* committer
-
-Kirill A. Shutemov
-* a patch for parse.y
-
-Darren Smith
-* a patch for golf_prelude.rb
-
-Richard M. Stallman
-* missing/alloca.c
-
-Robin Stocker
-* documentation
-
-Adam Strzelecki
-* a patch for compile.c
-
-Masashi Sumi
-* improved net/pop.rb
-
-Eric Sunshine
-* NeXT OpenStep, Rhapsody support
-
-Kouhei Sutou (kou)
-* committer
-* He wrote and is the maintainer of rss/*
-
-David Symonds
-* documentation
-
-== T
-
-TAKANO Mitsuhiro (takano32)
-* committer
-* He is the maintainer of IA-64 support.
-* BigDecimal
-
-TAKAO, Kouji (kouji)
-* committer
-* He is the maintainer of readline.
-
-Nathaniel Talbott (ntalbott)
-* committer
-* He was the maintainer of test/unit, runit, rubyunit.
-
-TANAKA, Akira (akr)
-* committer
-* Did much upon m17n.
-* And he is the maintainer of:
- * open-uri
- * pathname
- * pp
- * resolv-replace
- * resolv
- * time
- * tsort
-
-Takaaki Tateishi (ttate)
-* committer
-* He was the maintainer of dl
-
-Technorama Ltd. (technoroma)
-* committer
-* openssl
-
-Andrew Thompson
-* a patch for socket.c IRIX support.
-
-Dave Thomas (dave)
-* committer
-* a.k.a. the Pragmatic Programmer.
-* He wrote rdoc.
-
-Tietew
-* patches for win32 support
-
-Masahiro Tomita
-* a patch for cgi.rb
-
-Jakub Travnik
-* a patch for eval.c
-
-Tom Truscott
-* missing/crypt.c
-
-== U
-
-UEDA, Satoshi
-* a patch for uri
-
-Takaaki Uematsu (uema2)
-* committer
-* He was the maintainer of WinCE support.
-
-UENO, Katsuhiro (katsu)
-* committer
-* He is the maintainer of zlib
-
-Hajimu UMEMOTO
-* He wrote ipaddr.rb
-
-URABE, Shyouhei (shyouhei)
-* committer
-* a.k.a. mput.
-* He is the branch maintainer of ruby_1_8_6 and ruby_1_8_7
-* and is the release manager of 1.8.x-pXXX.
-
-== V
-
-Joel VanderWerf
-* a patch for numeric.c
-
-Peter Vanbroekhoven
-
-Corinna Vinschen
-
-== W
-
-wanabe (wanabe)
-* committer
-* fixed YARV and Oniguruma.
-
-Chun Wang
-* a patch for time.rb
-
-WATANABE, Hirofumi (eban)
-* committer
-* He is the maintainer of
- * ftools (1.8)
- * tmpdir
- * un
- * Win32API
-
-WATANABE, Tetsuya
-* a patch for ruby.c
-
-William Webber (wew)
-* committer
-
-Jim Weirich (jim)
-* committer
-* He wrote Rake.
-
-Nathan Weizenbaum
-* fixed misc/ruby-mode.el.
-
-why the lukky stiff (why)
-* committer
-* He is the maintainer of syck
-
-Caley Woods
-* documentation
-
-Gary Wright
-* documentation
-
-== X
-
-== Y
-
-Akira Yamada (akira)
-* committer
-* He is the maintainer of ruby related packages at Debian project.
-
-Keita Yamaguchi
-* patches for enum.c, parse.y
-* documentation
-
-Hirokazu Yamamoto (ocean)
-* committer
-
-Hirotaka Yoshioka
-* a patch for improving SEGV handling
-
-== Z
-
-Aristarkh A Zagorodnikov
-* a patch for io.c
-
-Alexander Zavorine
-* committer
-* He is the maintainer for Symbian OS.
-
-Chiyuan Zhang
-* a patch for misc/ruby-mode.el.
-
-Dee Zsombor (zunda)
-* a patch for thread_pthread.c
-
-Dan Zwell
-* a patch for net/pop
-
-
diff --git a/doc/dtrace_probes.rdoc b/doc/dtrace_probes.rdoc
deleted file mode 100644
index d2cdd56902..0000000000
--- a/doc/dtrace_probes.rdoc
+++ /dev/null
@@ -1,178 +0,0 @@
-= DTrace Probes
-
-A list of DTrace probes and their functionality. "Module" and "Function" cannot
-be defined in user defined probes (known as USDT), so they will not be
-specified. Probe definitions are in the format of:
-
- provider:module:function:name(arguments)
-
-Since module and function cannot be specified, they will be blank. An example
-probe definition for Ruby would then be:
-
- ruby:::method-entry(class name, method name, file name, line number)
-
-Where "ruby" is the provider name, module and function names are blank, the
-probe name is "method-entry", and the probe takes four arguments:
-
-* class name
-* method name
-* file name
-* line number
-
-== Probes List
-
-=== Stability
-
-Before we list the specific probes, let's talk about stability. Probe stability
-is declared in the probes.d file at the bottom on the #pragma D attributes
-lines. Here is a description of each of the stability declarations.
-
-[Provider name stability]
- The provider name of "ruby" has been declared as stable. It is unlikely that
- we will change the provider name from "ruby" to something else.
-
-[Module and Function stability]
- Since we are not allowed to provide values for the module and function name,
- the values we have provided (no value) is declared as stable.
-
-[Probe name stability]
- The probe names are likely to change in the future, so they are marked as
- "Evolving". Consumers should not depend on these names to be stable.
-
-[Probe argument stability]
- The parameters passed to the probes are likely to change in the future, so
- they are marked as "Evolving". Consumers should not depend on these to be
- stable.
-
-=== Declared probes
-
-Probes are defined in the probes.d file. Here are the declared probes along
-with when they are fired and the arguments they take:
-
-[ruby:::method-entry(classname, methodname, filename, lineno);]
- This probe is fired just before a method is entered.
-
- classname name of the class (a string)
- methodname name of the method about to be executed (a string)
- filename the file name where the method is _being called_ (a string)
- lineno the line number where the method is _being called_ (an int)
-
-[ruby:::method-return(classname, methodname, filename, lineno);]
- This probe is fired just after a method has returned. The arguments are the
- same as "ruby:::method-entry".
-
-[ruby:::cmethod-entry(classname, methodname, filename, lineno);]
- This probe is fired just before a C method is entered. The arguments are the
- same as "ruby:::method-entry".
-
-[ruby:::cmethod-return(classname, methodname, filename, lineno);]
- This probe is fired just before a C method returns. The arguments are the
- same as "ruby:::method-entry".
-
-[ruby:::require-entry(requiredfile, filename, lineno);]
- This probe is fired on calls to rb_require_safe (when a file is required).
-
- requiredfile is the name of the file to be required (string).
- filename is the file that called "require" (string).
- lineno is the line number where the call to require was made (int).
-
-[ruby:::require-return(requiredfile, filename, lineno);]
- This probe is fired just before rb_require_safe (when a file is required)
- returns. The arguments are the same as "ruby:::require-entry". This probe
- will not fire if there was an exception during file require.
-
-[ruby:::find-require-entry(requiredfile, filename, lineno);]
- This probe is fired right before search_required is called. search_required
- determines whether the file has already been required by searching loaded
- features ($"), and if not, figures out which file must be loaded.
-
- requiredfile is the file to be required (string).
- filename is the file that called "require" (string).
- lineno is the line number where the call to require was made (int).
-
-[ruby:::find-require-return(requiredfile, filename, lineno);]
- This probe is fired right after search_required returns. See the
- documentation for "ruby:::find-require-entry" for more details. Arguments for
- this probe are the same as "ruby:::find-require-entry".
-
-[ruby:::load-entry(loadedfile, filename, lineno);]
- This probe is fired when calls to "load" are made. The arguments are the same
- as "ruby:::require-entry".
-
-[ruby:::load-return(loadedfile, filename, lineno);]
- This probe is fired when "load" returns. The arguments are the same as
- "ruby:::load-entry".
-
-[ruby:::raise(classname, filename, lineno);]
- This probe is fired when an exception is raised.
-
- classname is the class name of the raised exception (string)
- filename the name of the file where the exception was raised (string)
- lineno the line number in the file where the exception was raised (int)
-
-[ruby:::object-create(classname, filename, lineno);]
- This probe is fired when an object is about to be allocated.
-
- classname the class of the allocated object (string)
- filename the name of the file where the object is allocated (string)
- lineno the line number in the file where the object is allocated (int)
-
-[ruby:::array-create(length, filename, lineno);]
- This probe is fired when an Array is about to be allocated.
-
- length the size of the array (long)
- filename the name of the file where the array is allocated (string)
- lineno the line number in the file where the array is allocated (int)
-
-[ruby:::hash-create(length, filename, lineno);]
- This probe is fired when a Hash is about to be allocated.
-
- length the size of the hash (long)
- filename the name of the file where the hash is allocated (string)
- lineno the line number in the file where the hash is allocated (int)
-
-[ruby:::string-create(length, filename, lineno);]
- This probe is fired when a String is about to be allocated.
-
- length the size of the string (long)
- filename the name of the file where the string is allocated (string)
- lineno the line number in the file where the string is allocated (int)
-
-[ruby:::symbol-create(str, filename, lineno);]
- This probe is fired when a Symbol is about to be allocated.
-
- str the contents of the symbol (string)
- filename the name of the file where the string is allocated (string)
- lineno the line number in the file where the string is allocated (int)
-
-[ruby:::parse-begin(sourcefile, lineno);]
- Fired just before parsing and compiling a source file.
-
- sourcefile the file being parsed (string)
- lineno the line number where the source starts (int)
-
-[ruby:::parse-end(sourcefile, lineno);]
- Fired just after parsing and compiling a source file.
-
- sourcefile the file being parsed (string)
- lineno the line number where the source ended (int)
-
-[ruby:::gc-mark-begin();]
- Fired at the beginning of a mark phase.
-
-[ruby:::gc-mark-end();]
- Fired at the end of a mark phase.
-
-[ruby:::gc-sweep-begin();]
- Fired at the beginning of a sweep phase.
-
-[ruby:::gc-sweep-end();]
- Fired at the end of a sweep phase.
-
-[ruby:::method-cache-clear(class, sourcefile, lineno);]
- Fired when the method cache is cleared.
-
- class is the classname being cleared, or "global" (string)
- sourcefile the file being parsed (string)
- lineno the line number where the source ended (int)
-
diff --git a/doc/etc.rd.ja b/doc/etc.rd.ja
index b4ff6ed04e..b36e05c994 100644
--- a/doc/etc.rd.ja
+++ b/doc/etc.rd.ja
@@ -1,4 +1,4 @@
-# etc.rd.ja - -*- mode: rd; coding: utf-8; -*- created at: Fri Jul 14 00:47:15 JST 1995
+# etc.rd.ja - -*- mode: rd; coding: euc-jp; -*- created at: Fri Jul 14 00:47:15 JST 1995
=begin
= Etc(モジュール)
@@ -33,7 +33,7 @@
age # エージ(整数)
class # ユーザアクセスクラス(文字列)
comment # コメント(文字列)
- expire # アカウント有効期限(整数)
+ expire # アカウント有効期限(整数)
end
詳細はgetpwnam(3)を参照のこと.
diff --git a/doc/extension.ja.rdoc b/doc/extension.ja.rdoc
deleted file mode 100644
index 7a9729eb41..0000000000
--- a/doc/extension.ja.rdoc
+++ /dev/null
@@ -1,1799 +0,0 @@
-# README.EXT.ja - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
-
-Rubyの拡張ライブラリの作り方を説明します.
-
-= 基礎知識
-
-Cの変数には型があり,データには型がありません.ですから,た
-とえばポインタをintの変数に代入すると,その値は整数として取
-り扱われます.逆にRubyの変数には型がなく,データに型がありま
-す.この違いのため,CとRubyは相互に変換しなければ,お互いの
-データをアクセスできません.
-
-RubyのデータはVALUEというCの型で表現されます.VALUE型のデー
-タはそのデータタイプを自分で知っています.このデータタイプと
-いうのはデータ(オブジェクト)の実際の構造を意味していて,Ruby
-のクラスとはまた違ったものです.
-
-VALUEからCにとって意味のあるデータを取り出すためには
-
-1. VALUEのデータタイプを知る
-2. VALUEをCのデータに変換する
-
-の両方が必要です.(1)を忘れると間違ったデータの変換が行われ
-て,最悪プログラムがcore dumpします.
-
-== データタイプ
-
-Rubyにはユーザが使う可能性のある以下のタイプがあります.
-
-T_NIL :: nil
-T_OBJECT :: 通常のオブジェクト
-T_CLASS :: クラス
-T_MODULE :: モジュール
-T_FLOAT :: 浮動小数点数
-T_STRING :: 文字列
-T_REGEXP :: 正規表現
-T_ARRAY :: 配列
-T_HASH :: 連想配列
-T_STRUCT :: (Rubyの)構造体
-T_BIGNUM :: 多倍長整数
-T_FIXNUM :: Fixnum(31bitまたは63bit長整数)
-T_COMPLEX :: 複素数
-T_RATIONAL :: 有理数
-T_FILE :: 入出力
-T_TRUE :: 真
-T_FALSE :: 偽
-T_DATA :: データ
-T_SYMBOL :: シンボル
-
-その他に内部で利用されている以下のタイプがあります.
-
- T_ICLASS
- T_MATCH
- T_UNDEF
- T_NODE
- T_ZOMBIE
-
-ほとんどのタイプはCの構造体で実装されています.
-
-== VALUEのデータタイプをチェックする
-
-ruby.hではTYPE()というマクロが定義されていて,VALUEのデータ
-タイプを知ることが出来ます.TYPE()マクロは上で紹介したT_XXXX
-の形式の定数を返します.VALUEのデータタイプに応じて処理する
-場合には,TYPE()の値で分岐することになります.
-
- switch (TYPE(obj)) {
- case T_FIXNUM:
- /* FIXNUMの処理 */
- break;
- case T_STRING:
- /* 文字列の処理 */
- break;
- case T_ARRAY:
- /* 配列の処理 */
- break;
- default:
- /* 例外を発生させる */
- rb_raise(rb_eTypeError, "not valid value");
- break;
- }
-
-それとデータタイプをチェックして,正しくなければ例外を発生す
-る関数が用意されています.
-
- void Check_Type(VALUE value, int type)
-
-この関数はvalueがtypeで無ければ,例外を発生させます.引数と
-して与えられたVALUEのデータタイプが正しいかどうかチェックす
-るためには,この関数を使います.
-
-FIXNUMとNILに関してはより高速な判別マクロが用意されています.
-
- FIXNUM_P(obj)
- NIL_P(obj)
-
-== VALUEをCのデータに変換する
-
-データタイプがT_NIL,T_FALSE,T_TRUEである時,データはそれぞ
-れnil,false,trueです.このデータタイプのオブジェクトはひと
-つずつしか存在しません.
-
-データタイプがT_FIXNUMの時,これは31bitまたは63bitのサイズを
-持つ整数です.longのサイズが32bitのプラットフォームであれば
-31bitに,longのサイズが64bitのプラットフォームであれば63bit
-になります. FIXNUM を C の整数に変換するためにはマクロ
-「FIX2INT()」または「FIX2LONG()」を使います.これらのマクロ
-を使用する際には事前にデータタイプがFIXNUMであることを確認す
-る必要がありますが,比較的高速に変換を行うことができます.ま
-た,「FIX2LONG()」は例外を発生しませんが,「FIX2INT()」は変
-換結果がintのサイズに収まらない場合には例外を発生します.
-それから,FIXNUMに限らずRubyのデータを整数に変換する
-「NUM2INT()」および「NUM2LONG()」というマクロがあります.こ
-れらのマクロはデータタイプのチェック無しで使えます
-(整数に変換できない場合には例外が発生する).同様にチェック無し
-で使える変換マクロはdoubleを取り出す「NUM2DBL()」があります.
-
-char* を取り出す場合, StringValue() と StringValuePtr()
-を使います.
-StringValue(var) は var が String
-であれば何もせず,そうでなければ var を var.to_str() の結果
-に置き換えるマクロ,StringValuePtr(var) は同様に var を
-String に置き換えてから var のバイト列表現に対する char* を
-返すマクロです.var の内容を直接置き換える処理が入るので,
-var は lvalue である必要があります.
-また,StringValuePtr() に類似した StringValueCStr() というマ
-クロもあります.StringValueCStr(var) は var を String に置き
-換えてから var の文字列表現に対する char* を返します.返され
-る文字列の末尾には NUL 文字が付加されます.なお,途中に NUL
-文字が含まれる場合は ArgumentError が発生します.
-一方,StringValuePtr() では,末尾に NUL 文字がある保証はなく,
-途中に NUL 文字が含まれている可能性もあります.
-
-それ以外のデータタイプは対応するCの構造体があります.対応す
-る構造体のあるVALUEはそのままキャスト(型変換)すれば構造体の
-ポインタに変換できます.
-
-構造体は「struct RXxxxx」という名前でruby.hで定義されていま
-す.例えば文字列は「struct RString」です.実際に使う可能性が
-あるのは文字列と配列くらいだと思います.
-
-ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文
-字にしたもの)という名前で提供されています(例: RSTRING()).た
-だし、構造体への直接のアクセスはできるだけ避け,対応する
-rb_xxxx() といった関数を使うようにして下さい.例えば,配列の
-要素へアクセスする場合は,rb_ary_entry(ary, offset),
-rb_ary_store(ary, offset, obj) を利用するようにして下さい.
-
-構造体からデータを取り出すマクロが提供されています.文字列
-strの長さを得るためには「RSTRING_LEN(str)」とし,文字列strを
-char*として得るためには「RSTRING_PTR(str)」とします.
-
-Rubyの構造体を直接アクセスする時に気をつけなければならないこ
-とは,配列や文字列の構造体の中身は参照するだけで,直接変更し
-ないことです.直接変更した場合,オブジェクトの内容の整合性が
-とれなくなって,思わぬバグの原因になります.
-
-== CのデータをVALUEに変換する
-
-VALUEの実際の構造は
-
-FIXNUMの場合 ::
-
- 1bit左シフトして,LSBを立てる.
-
-その他のポインタの場合 ::
-
- そのままVALUEにキャストする.
-
-となっています.よって,LSBをチェックすればVALUEがFIXNUMかど
-うかわかるわけです(ポインタのLSBが立っていないことを仮定して
-いる).
-
-ですから,FIXNUM以外のRubyのオブジェクトの構造体は単にVALUE
-にキャストするだけでVALUEに変換出来ます.ただし,任意の構造
-体がVALUEにキャスト出来るわけではありません.キャストするの
-はRubyの知っている構造体(ruby.hで定義されているstruct RXxxx
-のもの)だけです.
-
-FIXNUMに関しては変換マクロを経由する必要があります.Cの整数
-からVALUEに変換するマクロは以下のものがあります.必要に応じ
-て使い分けてください.
-
-INT2FIX() :: もとの整数が31bitまたは63bit以内に収まる自信
- がある時
-INT2NUM() :: 任意の整数からVALUEへ
-
-INT2NUM()は整数がFIXNUMの範囲に収まらない場合,Bignumに変換
-してくれます(が,少し遅い).
-
-== Rubyのデータを操作する
-
-先程も述べた通り,Rubyの構造体をアクセスする時に内容の更新を
-行うことは勧められません.で,Rubyのデータを操作する時には
-Rubyが用意している関数を用いてください.
-
-ここではもっとも使われるであろう文字列と配列の生成/操作を行
-う関数をあげます(全部ではないです).
-
-=== 文字列に対する関数
-
-rb_str_new(const char *ptr, long len) ::
-
- 新しいRubyの文字列を生成する.
-
-rb_str_new2(const char *ptr) ::
-rb_str_new_cstr(const char *ptr) ::
-
- Cの文字列からRubyの文字列を生成する.この関数の機能は
- rb_str_new(ptr, strlen(ptr))と同等である.
-
-rb_str_new_literal(const char *ptr) ::
-
- Cのリテラル文字列からRubyの文字列を生成する.
-
-rb_tainted_str_new(const char *ptr, long len) ::
-
- 汚染マークが付加された新しいRubyの文字列を生成する.外部
- からのデータに基づく文字列には汚染マークが付加されるべき
- である.
-
-rb_tainted_str_new2(const char *ptr) ::
-rb_tainted_str_new_cstr(const char *ptr) ::
-
- Cの文字列から汚染マークが付加されたRubyの文字列を生成する.
-
-rb_sprintf(const char *format, ...) ::
-rb_vsprintf(const char *format, va_list ap) ::
-
- Cの文字列formatと続く引数をprintf(3)のフォーマットにしたがって
- 整形し,Rubyの文字列を生成する.
-
- 注意: "%"PRIsVALUEがObject#to_s('+'フラグが指定されている
- ときはObject#inspect)を使ったVALUEの出力に利用できる.これ
- は"%i"と衝突するため,整数には"%d"を使用すること.
-
-rb_str_cat(VALUE str, const char *ptr, long len) ::
-
- Rubyの文字列strにlenバイトの文字列ptrを追加する.
-
-rb_str_cat2(VALUE str, const char* ptr) ::
-rb_str_cat_cstr(VALUE str, const char* ptr) ::
-
- Rubyの文字列strにCの文字列ptrを追加する.この関数の機能は
- rb_str_cat(str, ptr, strlen(ptr))と同等である.
-
-rb_str_catf(VALUE str, const char* format, ...) ::
-rb_str_vcatf(VALUE str, const char* format, va_list ap) ::
-
- Cの文字列formatと続く引数をprintf(3)のフォーマットにしたがって
- 整形し,Rubyの文字列strに追加する.この関数の機能は,それぞれ
- rb_str_cat2(str, rb_sprintf(format, ...)) や
- rb_str_cat2(str, rb_vsprintf(format, ap)) と同等である.
-
-rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) ::
-rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc) ::
-
- 指定されたエンコーディングでRubyの文字列を生成する.
-
-rb_enc_str_new_literal(const char *ptr) ::
-
- Cのリテラル文字列から指定されたエンコーディングでRubyの文字列を生成する.
-
-rb_usascii_str_new(const char *ptr, long len) ::
-rb_usascii_str_new_cstr(const char *ptr) ::
-
- エンコーディングがUS-ASCIIのRubyの文字列を生成する.
-
-rb_usascii_str_new_literal(const char *ptr) ::
-
- Cのリテラル文字列からエンコーディングがUS-ASCIIのRubyの文字列を生成する.
-
-rb_utf8_str_new(const char *ptr, long len) ::
-rb_utf8_str_new_cstr(const char *ptr) ::
-
- エンコーディングがUTF-8のRubyの文字列を生成する.
-
-rb_utf8_str_new_literal(const char *ptr) ::
-
- Cのリテラル文字列からエンコーディングがUTF-8のRubyの文字列を生成する.
-
-rb_str_resize(VALUE str, long len) ::
-
- Rubyの文字列のサイズをlenバイトに変更する.strの長さは前
- 以てセットされていなければならない.lenが元の長さよりも短
- い時は,lenバイトを越えた部分の内容は捨てられる.lenが元
- の長さよりも長い時は,元の長さを越えた部分の内容は保存さ
- れないでゴミになるだろう.この関数の呼び出しによって
- RSTRING_PTR(str)が変更されるかもしれないことに注意.
-
-rb_str_set_len(VALUE str, long len) ::
-
- Rubyの文字列のサイズをlenバイトにセットする.strが変更可
- 能でなければ例外が発生する.RSTRING_LEN(str)とは無関係に,
- lenバイトまでの内容は保存される.lenはstrの容量を越えてい
- てはならない.
-
-=== 配列に対する関数
-
-rb_ary_new() ::
-
- 要素が0の配列を生成する.
-
-rb_ary_new2(long len) ::
-rb_ary_new_capa(long len) ::
-
- 要素が0の配列を生成する.len要素分の領域をあらかじめ割り
- 当てておく.
-
-rb_ary_new3(long n, ...) ::
-rb_ary_new_from_args(long n, ...) ::
-
- 引数で指定したn要素を含む配列を生成する.
-
-rb_ary_new4(long n, VALUE *elts) ::
-rb_ary_new_from_values(long n, VALUE *elts) ::
-
- 配列で与えたn要素の配列を生成する.
-
-rb_ary_to_ary(VALUE obj) ::
-
- オブジェクトを配列に変換する.
- Object#to_aryと同等である.
-
-他にも配列を操作する関数が多数ある. これらは
-引数aryに配列を渡さなければならない. さもないと
-コアを吐く.
-
-rb_ary_aref(argc, VALUE *argv, VALUE ary) ::
-
- Array#[]と同等.
-
-rb_ary_entry(VALUE ary, long offset) ::
-
- \ary[offset]
-
-rb_ary_store(VALUE ary, long offset, VALUE obj) ::
-
- \ary[offset] = obj
-
-rb_ary_subseq(VALUE ary, long beg, long len) ::
-
- ary[beg, len]
-
-rb_ary_push(VALUE ary, VALUE val) ::
-rb_ary_pop(VALUE ary) ::
-rb_ary_shift(VALUE ary) ::
-rb_ary_unshift(VALUE ary, VALUE val) ::
-
- ary.push, ary.pop, ary.shift, ary.unshift
-
-rb_ary_cat(VALUE ary, const VALUE *ptr, long len) ::
-
- 配列aryにptrからlen個のオブジェクトを追加する.
-
-= Rubyの機能を使う
-
-原理的にRubyで書けることはCでも書けます.RubyそのものがCで記
-述されているんですから,当然といえば当然なんですけど.ここで
-はRubyの拡張に使うことが多いだろうと予測される機能を中心に紹
-介します.
-
-== Rubyに機能を追加する
-
-Rubyで提供されている関数を使えばRubyインタプリタに新しい機能
-を追加することができます.Rubyでは以下の機能を追加する関数が
-提供されています.
-
-- クラス,モジュール
-- メソッド,特異メソッドなど
-- 定数
-
-では順に紹介します.
-
-=== クラス/モジュール定義
-
-クラスやモジュールを定義するためには,以下の関数を使います.
-
- VALUE rb_define_class(const char *name, VALUE super)
- VALUE rb_define_module(const char *name)
-
-これらの関数は新しく定義されたクラスやモジュールを返します.
-メソッドや定数の定義にこれらの値が必要なので,ほとんどの場合
-は戻り値を変数に格納しておく必要があるでしょう.
-
-クラスやモジュールを他のクラスの内部にネストして定義する時に
-は以下の関数を使います.
-
- VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
- VALUE rb_define_module_under(VALUE outer, const char *name)
-
-=== メソッド/特異メソッド定義
-
-メソッドや特異メソッドを定義するには以下の関数を使います.
-
- void rb_define_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
-
- void rb_define_singleton_method(VALUE object, const char *name,
- VALUE (*func)(), int argc)
-
-念のため説明すると「特異メソッド」とは,その特定のオブジェク
-トに対してだけ有効なメソッドです.RubyではよくSmalltalkにお
-けるクラスメソッドとして,クラスに対する特異メソッドが使われ
-ます.
-
-これらの関数の argcという引数はCの関数へ渡される引数の数(と
-形式)を決めます.argcが0以上の時は関数に引き渡す引数の数を意
-味します.16個以上の引数は使えません(が,要りませんよね,そ
-んなに).実際の関数には先頭の引数としてselfが与えられますの
-で,指定した数より1多い引数を持つことになります.
-
-argcが負の時は引数の数ではなく,形式を指定したことになります.
-argcが-1の時は引数を配列に入れて渡されます.argcが-2の時は引
-数はRubyの配列として渡されます.
-
-メソッドを定義する関数はまだいくつかあります. ひとつはメソッド
-名としてIDを取ります. IDについては2.2.2を参照.
-
- void rb_define_method_id(VALUE klass, ID name,
- VALUE (*func)(ANYARGS), int argc)
-
-private/protectedなメソッドを定義するふたつの関数があります.
-
- void rb_define_private_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
- void rb_define_protected_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
-
-privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ
-ドです.
-
-最後に, rb_define_module関数はモジュール関数を定義します.
-モジュール関数とはモジュールの特異メソッドであり,同時に
-privateメソッドでもあるものです.例をあげるとMathモジュール
-のsqrt()などがあげられます.このメソッドは
-
- Math.sqrt(4)
-
-という形式でも
-
- include Math
- sqrt(4)
-
-という形式でも使えます.モジュール関数を定義する関数は以下の
-通りです.
-
- void rb_define_module_function(VALUE module, const char *name,
- VALUE (*func)(), int argc)
-
-関数的メソッド(Kernelモジュールのprivate method)を定義するた
-めの関数は以下の通りです.
-
- void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
-
-メソッドの別名を定義するための関数は以下の通りです.
-
- void rb_define_alias(VALUE module, const char* new, const char* old);
-
-属性の取得・設定メソッドを定義するには
-
- void rb_define_attr(VALUE klass, const char *name, int read, int write)
-
-クラスメソッドallocateを定義したり削除したりするための関数は
-以下の通りです.
-
- void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
- void rb_undef_alloc_func(VALUE klass);
-
-funcはクラスを引数として受け取って,新しく割り当てられたイン
-スタンスを返さなくてはなりません.このインスタンスは,外部リ
-ソースなどを含まない,できるだけ「空」のままにしておいたほう
-がよいでしょう.
-
-継承したクラスにある既存のメソッドをオーバーライドしているな
-ら,オーバーライドされたメソッドを呼び出すには以下の関数を使
-います.
-
- VALUE rb_call_super(int argc, const VALUE *argv)
-
-現在のスコープのレシーバは(他に方法がなければ),以下の関数で
-得ることができます.
-
- VALUE rb_current_receiver(void)
-
-=== 定数定義
-
-拡張ライブラリが必要な定数はあらかじめ定義しておいた方が良い
-でしょう.定数を定義する関数は二つあります.
-
- void rb_define_const(VALUE klass, const char *name, VALUE val)
- void rb_define_global_const(const char *name, VALUE val)
-
-前者は特定のクラス/モジュールに属する定数を定義するもの,後
-者はグローバルな定数を定義するものです.
-
-== Rubyの機能をCから呼び出す
-
-既に『1.5 Rubyのデータを操作する』で一部紹介したような関数を
-使えば,Rubyの機能を実現している関数を直接呼び出すことが出来
-ます.
-
-# このような関数の一覧表はいまのところありません.ソースを見
-# るしかないですね.
-
-それ以外にもRubyの機能を呼び出す方法はいくつかあります.
-
-=== Rubyのプログラムをevalする
-
-CからRubyの機能を呼び出すもっとも簡単な方法として,文字列で
-与えられたRubyのプログラムを評価する以下の関数があります.
-
- VALUE rb_eval_string(const char *str)
-
-この評価は現在の環境で行われます.つまり,現在のローカル変数
-などを受け継ぎます.
-
-評価は例外を発生するかもしれないことに注意しましょう. より安全
-な関数もあります.
-
- VALUE rb_eval_string_protect(const char *str, int *state)
-
-この関数はエラーが発生するとnilを返します.そして,成功時には
-*stateはゼロに,さもなくば非ゼロになります.
-
-=== IDまたはシンボル
-
-Cから文字列を経由せずにRubyのメソッドを呼び出すこともできま
-す.その前に,Rubyインタプリタ内でメソッドや変数名を指定する
-時に使われているIDについて説明しておきましょう.
-
-IDとは変数名,メソッド名を表す整数です.Rubyの中では
-
- :識別子
-
-または
-
- :"任意の文字列"
-
-でアクセスできます.Cからこの整数を得るためには関数
-
- rb_intern(const char *name)
- rb_intern_str(VALUE name)
-
-を使います.Rubyから引数として与えられたシンボル(または文字
-列)をIDに変換するには以下の関数を使います.
-
- rb_to_id(VALUE symbol)
- rb_check_id(volatile VALUE *name)
- rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
-
-もし引数がシンボルでも文字列でもなければ,to_strメソッドで文
-字列に変換しようとします.第二の関数はその変換結果を*nameに保
-存し,その名前が既知のシンボルでない場合は0を返します.この関
-数が0以外を返した場合は*nameは常にシンボルか文字列であり,0を
-返した場合は常に文字列です.第三の関数はRubyの文字列ではなく
-NUL終端されたCの文字列を使います.
-
-Rubyから引数として与えられたシンボル(または文字列)をシンボル
-に変換するには以下の関数を使います.
-
- rb_to_symbol(VALUE name)
- rb_check_symbol(volatile VALUE *namep)
- rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
-
-これらの関数は,IDの代わりにシンボルを返すことを除けば上記の
-関数と同じです.
-
-=== CからRubyのメソッドを呼び出す
-
-Cから文字列を経由せずにRubyのメソッドを呼び出すためには以下
-の関数を使います.
-
- VALUE rb_funcall(VALUE recv, ID mid, int argc, ...)
-
-この関数はオブジェクトrecvのmidで指定されるメソッドを呼び出
-します.その他に引数の指定の仕方が違う以下の関数もあります.
-
- VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
- VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv)
- VALUE rb_apply(VALUE recv, ID mid, VALUE args)
-
-applyには引数としてRubyの配列を与えます.
-
-=== 変数/定数を参照/更新する
-
-Cから関数を使って参照・更新できるのは,定数,インスタンス変
-数です.大域変数は一部のものはCの大域変数としてアクセスでき
-ます.ローカル変数を参照する方法は公開していません.
-
-オブジェクトのインスタンス変数を参照・更新する関数は以下の通
-りです.
-
- VALUE rb_ivar_get(VALUE obj, ID id)
- VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
-
-idはrb_intern()で得られるものを使ってください.
-
-定数を参照するには以下の関数を使ってください.
-
- VALUE rb_const_get(VALUE obj, ID id)
-
-定数を新しく定義するためには『2.1.3 定数定義』で紹介さ
-れている関数を使ってください.
-
-= RubyとCとの情報共有
-
-C言語とRubyの間で情報を共有する方法について解説します.
-
-== Cから参照できるRubyの定数
-
-以下のRubyの定数はCのレベルから参照できます.
-
-Qtrue ::
-Qfalse ::
-
- 真偽値.QfalseはC言語でも偽とみなされます(つまり0).
-
-Qnil ::
-
- C言語から見た「nil」.
-
-== CとRubyで共有される大域変数
-
-CとRubyで大域変数を使って情報を共有できます.共有できる大域
-変数にはいくつかの種類があります.そのなかでもっとも良く使わ
-れると思われるのはrb_define_variable()です.
-
- void rb_define_variable(const char *name, VALUE *var)
-
-この関数はRubyとCとで共有する大域変数を定義します.変数名が
-`$'で始まらない時には自動的に追加されます.この変数の値を変
-更すると自動的にRubyの対応する変数の値も変わります.
-
-またRuby側からは更新できない変数もあります.このread onlyの
-変数は以下の関数で定義します.
-
- void rb_define_readonly_variable(const char *name, VALUE *var)
-
-これら変数の他にhookをつけた大域変数を定義できます.hook付き
-の大域変数は以下の関数を用いて定義します.hook付き大域変数の
-値の参照や設定はhookで行う必要があります.
-
- void rb_define_hooked_variable(const char *name, VALUE *var,
- VALUE (*getter)(), void (*setter)())
-
-この関数はCの関数によってhookのつけられた大域変数を定義しま
-す.変数が参照された時には関数getterが,変数に値がセットされ
-た時には関数setterが呼ばれる.hookを指定しない場合はgetterや
-setterに0を指定します.
---
-getterもsetterも0ならばrb_define_variable()と同じになる.
-++
-
-getterとsetterの仕様は次の通りです.
-
- VALUE (*getter)(ID id, VALUE *var);
- void (*setter)(VALUE val, ID id, VALUE *var);
-
-それから,対応するCの変数を持たないRubyの大域変数を定義する
-こともできます. その変数の値はフック関数のみによって取得・設定
-されます.
-
- void rb_define_virtual_variable(const char *name,
- VALUE (*getter)(), void (*setter)())
-
-この関数によって定義されたRubyの大域変数が参照された時には
-getterが,変数に値がセットされた時にはsetterが呼ばれます.
-
-getterとsetterの仕様は以下の通りです.
-
- (*getter)(ID id);
- (*setter)(VALUE val, ID id);
-
-== CのデータをRubyオブジェクトにする
-
-Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして
-取り扱いたい場合がありえます.このような場合はTypedData_XXX
-マクロ群を用いて構造体へのポインタとRubyのオブジェクトとを互
-いに変換できます.
-
---
-古い(非Typedな)Data_XXXマクロ群は非推奨になりました.
-将来のバージョンのRubyでは古いマクロは動作しなくなる可能性
-があります.
-++
-
-=== 構造体からオブジェクトへ
-
-構造体へのポインタsvalをRubyオブジェクトに変換するには次のマ
-クロを使います。
-
- TypedData_Wrap_Struct(klass, data_type, sval)
-
-このマクロの戻り値は生成されたオブジェクトを表すVALUE値です.
-
-klassはこのオブジェクトのクラスです.data_typeはこの構造体を
-Rubyが管理するための情報を記述したconst rb_data_type_t型への
-ポインタです.
-
-なお, klassは, Objectや他のクラスではなくData (rb_cData)とい
-う特別なクラスから派生することが推奨されます.
-Dataから派生しない場合には, 必ずrb_undef_alloc_func(klass)
-を呼び出してください.
-
-rb_data_type_tは次のように定義されています.
-
- struct rb_data_type_struct {
- const char *wrap_struct_name;
- struct {
- void (*dmark)(void*);
- void (*dfree)(void*);
- size_t (*dsize)(const void *);
- void *reserved[2];
- } function;
- const rb_data_type_t *parent;
- void *data;
- VALUE flags;
- };
-
-wrap_struct_nameはこの構造体を識別する名前です.主に統計情報
-の収集と出力に用いられます.プロセス内で一意であれば特にCや
-Rubyの識別子として有効である必要はありません.
-
-dmarkおよびdfree関数はGC実行中に呼び出されます.
-なお, GC実行中はRubyオブジェクトのアロケーションは禁止されま
-す. よって, dmarkおよびdfree関数でRubyオブジェクトのアロケー
-ションは行わないでください.
-
-dmarkはガーベージコレクタがオブジェクトへの参照をマークする
-ときに用いる関数です.この構造体がRubyのオブジェクトへの参照
-を保持するときには, dmarkではrb_gc_markなどを用いて構造体内
-のすべての参照をマークしなければなりません.
-そのような参照を含まない時には0を指定します.
-
---
-そのような参照は勧められません.
-++
-
-dfreeはこの構造体がもう不要になった時に呼ばれる関数です.こ
-の関数がガーベージコレクタから呼ばれます.これが-1の場合は,
-単純に構造体が解放されます.
-
-dsizeは構造体が消費しているメモリのバイト数を返す関数です.
-引数として構造体へのポインタが渡されます.実装困難であれば0
-を渡しても差し支えありませんが, できるだけ指定するようにして
-ください.
-
-reservedとparentは0で埋めなければなりません.
-
-dataにはユーザー定義の任意の値を指定できます.Rubyはこの値に
-は関知しないので,好きに使ってください.
-
-flagsには次のフラグのうち当てはまるもののビット和を指定しま
-す.いずれもRubyのガーベージコレクタについての深い理解を必要
-としますので,良くわからない場合には0を指定すると良いでしょ
-う.
-
-RUBY_TYPED_FREE_IMMEDIATELY ::
-
- このフラグを指定すると,ガーベージコレクタはこの構造体が不
- 要になった場合にはGC中に直ちにdfreeを呼び出します.
- dfreeがRuby内部のロック(GVL)を解放する可能性がない場合はこ
- のフラグを指定できます.
-
- 指定しない場合はdfree呼び出しは遅延され, ファイナライザと
- 同じタイミングで実行されます.
-
-RUBY_TYPED_WB_PROTECTED ::
-
- オブジェクトの実装がライトバリアをサポートしていることを示
- します.このフラグを指定するとRubyはそのオブジェクトに対し
- てGCをより効率的に実行できます.
- ただし,指定する場合はユーザーはそのオブジェクトのすべての
- メソッドの実装に適切にライトバリアを挿入する責任があります.
- さもなくばRubyは実行時にクラッシュする可能性があります.
-
- ライトバリアについてはdoc/extension.rdocのAppendix D
- "Generational GC"も参照してください.
-
-
-Cの構造体の割当と対応するオブジェクトの生成を同時に行うマク
-ロとして以下のものが提供されています.
-
- TypedData_Make_Struct(klass, type, data_type, sval)
-
-このマクロの戻り値は生成されたオブジェクトのVALUE値
-です.このマクロは以下の式のように働きます:
-
- (sval = ZALLOC(type), TypedData_Wrap_Struct(klass, data_type, sval))
-
-klass, data_typeはData_Wrap_Structと同じ働きをします.type
-は割り当てるC構造体の型です.割り当てられた構造体は変数sval
-に代入されます.この変数の型は (type*) である必要があります.
-
-=== オブジェクトから構造体へ
-
-TypedData_Wrap_StructやTypedData_Make_Structで生成したオブジェ
-クトから構造体へのポインタを復元するには以下のマクロを用いま
-す.
-
- TypedData_Get_Struct(obj, type, &data_type, sval)
-
-Cの構造体へのポインタは変数svalに代入されます.
-
-これらのマクロの使い方はちょっと分かりにくいので,後で説明す
-る例題を参照してください.
-
-== ディレクトリを作る
-
- % mkdir ext/dbm
-
-Ruby 1.1からは任意のディレクトリでダイナミックライブラリを作
-ることができるようになりました.Rubyに静的にリンクする場合に
-はRubyを展開したディレクトリの下,extディレクトリの中に拡張
-ライブラリ用のディレクトリを作る必要があります.名前は適当に
-選んで構いません.
-
-== 設計する
-
-まあ,当然なんですけど,どういう機能を実現するかどうかまず設
-計する必要があります.どんなクラスをつくるか,そのクラスには
-どんなメソッドがあるか,クラスが提供する定数などについて設計
-します.
-
-== Cコードを書く
-
-拡張ライブラリ本体となるC言語のソースを書きます.C言語のソー
-スがひとつの時には「ライブラリ名.c」を選ぶと良いでしょう.C
-言語のソースが複数の場合には逆に「ライブラリ名.c」というファ
-イル名は避ける必要があります.オブジェクトファイルとモジュー
-ル生成時に中間的に生成される「ライブラリ名.o」というファイル
-とが衝突するからです.また,後述する mkmf ライブラリのいくつ
-かの関数がコンパイルを要するテストのために「conftest.c」とい
-うファイル名を使用することに注意してください.ソースファイル
-名として「conftest.c」を使用してはなりません.
-
-Rubyは拡張ライブラリをロードする時に「Init_ライブラリ名」と
-いう関数を自動的に実行します.dbmライブラリの場合「Init_dbm」
-です.この関数の中でクラス,モジュール,メソッド,定数などの
-定義を行います.dbm.cから一部引用します.
-
- void
- Init_dbm(void)
- {
- /* DBMクラスを定義する */
- VALUE cDBM = rb_define_class("DBM", rb_cObject);
- /* DBMはEnumerableモジュールをインクルードする */
- rb_include_module(cDBM, rb_mEnumerable);
-
- /* DBMクラスのクラスメソッドopen(): 引数はCの配列で受ける */
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
-
- /* DBMクラスのメソッドclose(): 引数はなし */
- rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBMクラスのメソッド[]: 引数は1個 */
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
-
- /* ... */
-
- /* DBMデータを格納するインスタンス変数名のためのID */
- id_dbm = rb_intern("dbm");
- }
-
-DBMライブラリはdbmのデータと対応するオブジェクトになるはずで
-すから,Cの世界のdbmをRubyの世界に取り込む必要があります.
-
-dbm.cではData_Make_Structを以下のように使っています.
-
- struct dbmdata {
- int di_size;
- DBM *di_dbm;
- };
-
- static const rb_data_type_t dbm_type = {
- "dbm",
- {0, free_dbm, memsize_dbm,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
- };
-
- obj = TypedData_Make_Struct(klass, struct dbmdata, &dbm_type, dbmp);
-
-ここではdbmdata構造体へのポインタをDataにカプセル化してい
-ます.DBM*を直接カプセル化しないのはclose()した時の処理を考
-えてのことです.
-
-Dataオブジェクトからdbmstruct構造体のポインタを取り出すため
-に以下のマクロを使っています.
-
- #define GetDBM(obj, dbmp) do {\
- TypedData_Get_Struct((obj), struct dbmdata, &dbm_type, (dbmp));\
- if ((dbmp) == 0) closed_dbm();\
- if ((dbmp)->di_dbm == 0) closed_dbm();\
- } while (0)
-
-ちょっと複雑なマクロですが,要するにdbmdata構造体のポインタ
-の取り出しと,closeされているかどうかのチェックをまとめてい
-るだけです.
-
-DBMクラスにはたくさんメソッドがありますが,分類すると3種類の
-引数の受け方があります.ひとつは引数の数が固定のもので,例と
-してはdeleteメソッドがあります.deleteメソッドを実装している
-fdbm_delete()はこのようになっています.
-
- static VALUE
- fdbm_delete(VALUE obj, VALUE keystr)
- {
- /* ... */
- }
-
-引数の数が固定のタイプは第1引数がself,第2引数以降がメソッド
-の引数となります.
-
-引数の数が不定のものはCの配列で受けるものとRubyの配列で受け
-るものとがあります.dbmライブラリの中で,Cの配列で受けるもの
-はDBMのクラスメソッドであるopen()です.これを実装している関
-数fdbm_s_open()はこうなっています.
-
- static VALUE
- fdbm_s_open(int argc, VALUE *argv, VALUE klass)
- {
- /* ... */
-
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
- mode = 0666; /* default value */
- }
-
- /* ... */
- }
-
-このタイプの関数は第1引数が与えられた引数の数,第2引数が与え
-られた引数の入っている配列になります.selfは第3引数として与
-えられます.
-
-この配列で与えられた引数を解析するための関数がopen()でも使わ
-れているrb_scan_args()です.第3引数に指定したフォーマットに従
-い,第4変数以降に指定したVALUEへの参照に値を代入してくれま
-す.
-
-引数をRubyの配列として受け取るメソッドの例には
-Thread#initializeがあります.実装はこうです.
-
- static VALUE
- thread_initialize(VALUE thread, VALUE args)
- {
- /* ... */
- }
-
-第1引数はself,第2引数はRubyの配列です.
-
-*注意事項*
-
-Rubyと共有はしないがRubyのオブジェクトを格納する可能性のある
-Cの大域変数は以下の関数を使ってRubyインタプリタに変数の存在
-を教えてあげてください.でないとGCでトラブルを起こします.
-
- void rb_global_variable(VALUE *var)
-
-== extconf.rbを用意する
-
-Makefileを作る場合の雛型になるextconf.rbというファイルを作り
-ます.extconf.rbはライブラリのコンパイルに必要な条件のチェッ
-クなどを行うことが目的です.まず,
-
- require 'mkmf'
-
-をextconf.rbの先頭に置きます.extconf.rbの中では以下のRuby関
-数を使うことが出来ます.
-
- have_library(lib, func): ライブラリの存在チェック
- have_func(func, header): 関数の存在チェック
- have_header(header): ヘッダファイルの存在チェック
- create_makefile(target[, target_prefix]): Makefileの生成
-
-以下の変数を使うことができます.
-
- $CFLAGS: コンパイル時に追加的に指定するフラグ(-Oなど)
- $CPPFLAGS: プリプロセッサに追加的に指定するフラグ(-Iや-Dなど)
- $LDFLAGS: リンク時に追加的に指定するフラグ(-Lなど)
- $objs: リンクされるオブジェクトファイル名のリスト
-
-オブジェクトファイルのリストは,通常はソースファイルを検索し
-て自動的に生成されますが,makeの途中でソースを生成するような
-場合は明示的に指定する必要があります.
-
-ライブラリをコンパイルする条件が揃わず,そのライブラリをコン
-パイルしない時にはcreate_makefileを呼ばなければMakefileは生
-成されず,コンパイルも行われません.
-
-== dependを用意する
-
-もし,ディレクトリにdependというファイルが存在すれば,
-Makefileが依存関係をチェックしてくれます.
-
- % gcc -MM *.c > depend
-
-などで作ることが出来ます.あって損は無いでしょう.
-
-== Makefileを生成する
-
-Makefileを実際に生成するためには
-
- ruby extconf.rb
-
-とします.extconf.rbに require 'mkmf' の行がない場合にはエラー
-になりますので,引数を追加して
-
- ruby -r mkmf extconf.rb
-
-としてください.
-
-site_ruby ディレクトリでなく,
-vendor_ruby ディレクトリにインストールする場合には
-以下のように --vendor オプションを加えてください.
-
- ruby extconf.rb --vendor
-
-ディレクトリをext以下に用意した場合にはRuby全体のmakeの時に
-自動的にMakefileが生成されますので,このステップは不要です.
-
-== makeする
-
-動的リンクライブラリを生成する場合にはその場でmakeしてくださ
-い.必要であれば make install でインストールされます.
-
-ext以下にディレクトリを用意した場合は,Rubyのディレクトリで
-makeを実行するとMakefileを生成からmake,必要によってはそのモ
-ジュールのRubyへのリンクまで自動的に実行してくれます.
-extconf.rbを書き換えるなどしてMakefileの再生成が必要な時はま
-たRubyディレクトリでmakeしてください.
-
-拡張ライブラリはmake installでRubyライブラリのディレクトリの
-下にコピーされます.もし拡張ライブラリと協調して使うRubyで記
-述されたプログラムがあり,Rubyライブラリに置きたい場合には,
-拡張ライブラリ用のディレクトリの下に lib というディレクトリ
-を作り,そこに 拡張子 .rb のファイルを置いておけば同時にイン
-ストールされます.
-
-== デバッグ
-
-まあ,デバッグしないと動かないでしょうね.ext/Setupにディレ
-クトリ名を書くと静的にリンクするのでデバッガが使えるようにな
-ります.その分コンパイルが遅くなりますけど.
-
-== できあがり
-
-後はこっそり使うなり,広く公開するなり,売るなり,ご自由にお
-使いください.Rubyの作者は拡張ライブラリに関して一切の権利を
-主張しません.
-
-= Appendix A. Rubyのソースコードの分類
-
-Rubyのソースはいくつかに分類することが出来ます.このうちクラ
-スライブラリの部分は基本的に拡張ライブラリと同じ作り方になっ
-ています.これらのソースは今までの説明でほとんど理解できると
-思います.
-
-== Ruby言語のコア
-
-class.c :: クラスとモジュール
-error.c :: 例外クラスと例外機構
-gc.c :: 記憶領域管理
-load.c :: ライブラリのロード
-object.c :: オブジェクト
-variable.c :: 変数と定数
-
-== Rubyの構文解析器
-
-parse.y :: 字句解析器と構文定義
-parse.c :: 自動生成
-defs/keywords :: 予約語
-lex.c :: 自動生成
-
-== Rubyの評価器 (通称YARV)
-
- compile.c
- eval.c
- eval_error.c
- eval_jump.c
- eval_safe.c
- insns.def : 仮想機械語の定義
- iseq.c : VM::ISeqの実装
- thread.c : スレッド管理とコンテキスト切り替え
- thread_win32.c : スレッド実装
- thread_pthread.c : 同上
- vm.c
- vm_dump.c
- vm_eval.c
- vm_exec.c
- vm_insnhelper.c
- vm_method.c
-
- defs/opt_insns_unif.def : 命令融合
- defs/opt_operand.def : 最適化のための定義
-
- -> insn*.inc : 自動生成
- -> opt*.inc : 自動生成
- -> vm.inc : 自動生成
-
-== 正規表現エンジン (鬼車)
-
- regex.c
- regcomp.c
- regenc.c
- regerror.c
- regexec.c
- regparse.c
- regsyntax.c
-
-== ユーティリティ関数
-
-debug.c :: Cデバッガ用のデバッグシンボル
-dln.c :: 動的ローディング
-st.c :: 汎用ハッシュ表
-strftime.c :: 時刻整形
-util.c :: その他のユーティリティ
-
-== Rubyコマンドの実装
-
- dmyext.c
- dmydln.c
- dmyencoding.c
- id.c
- inits.c
- main.c
- ruby.c
- version.c
-
- gem_prelude.rb
- prelude.rb
-
-== クラスライブラリ
-
-array.c :: Array
-bignum.c :: Bignum
-compar.c :: Comparable
-complex.c :: Complex
-cont.c :: Fiber, Continuation
-dir.c :: Dir
-enum.c :: Enumerable
-enumerator.c :: Enumerator
-file.c :: File
-hash.c :: Hash
-io.c :: IO
-marshal.c :: Marshal
-math.c :: Math
-numeric.c :: Numeric, Integer, Fixnum, Float
-pack.c :: Array#pack, String#unpack
-proc.c :: Binding, Proc
-process.c :: Process
-random.c :: 乱数
-range.c :: Range
-rational.c :: Rational
-re.c :: Regexp, MatchData
-signal.c :: Signal
-sprintf.c :: String#sprintf
-string.c :: String
-struct.c :: Struct
-time.c :: Time
-
-defs/known_errors.def :: 例外クラス Errno::*
--> known_errors.inc :: 自動生成
-
-== 多言語化
-
-encoding.c :: Encoding
-transcode.c :: Encoding::Converter
-enc/*.c :: エンコーディングクラス群
-enc/trans/* :: コードポイント対応表
-
-== gorubyコマンドの実装
-
- goruby.c
- golf_prelude.rb : goruby固有のライブラリ
- -> golf_prelude.c : 自動生成
-
-= Appendix B. 拡張用関数リファレンス
-
-C言語からRubyの機能を利用するAPIは以下の通りである.
-
-== 型
-
-VALUE ::
-
- Rubyオブジェクトを表現する型.必要に応じてキャストして用いる.
- 組み込み型を表現するCの型はruby.hに記述してあるRで始まる構造
- 体である.VALUE型をこれらにキャストするためにRで始まる構造体
- 名を全て大文字にした名前のマクロが用意されている.
-
-== 変数・定数
-
-Qnil ::
-
- 定数: nilオブジェクト
-
-Qtrue ::
-
- 定数: trueオブジェクト(真のデフォルト値)
-
-Qfalse ::
-
- 定数: falseオブジェクト
-
-== Cデータのカプセル化
-
-Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
-
- Cの任意のポインタをカプセル化したRubyオブジェクトを返す.こ
- のポインタがRubyからアクセスされなくなった時,freeで指定した
- 関数が呼ばれる.また,このポインタの指すデータが他のRubyオブ
- ジェクトを指している場合,markに指定する関数でマークする必要
- がある.
-
-Data_Make_Struct(klass, type, mark, free, sval) ::
-
- type型のメモリをmallocし,変数svalに代入した後,それをカプセ
- ル化したデータを返すマクロ.
-
-Data_Get_Struct(data, type, sval) ::
-
- dataからtype型のポインタを取り出し変数svalに代入するマクロ.
-
-== 型チェック
-
- TYPE(value)
- FIXNUM_P(value)
- NIL_P(value)
- void Check_Type(VALUE value, int type)
- SafeStringValue(value)
-
-== 型変換
-
- FIX2INT(value), INT2FIX(i)
- FIX2LONG(value), LONG2FIX(l)
- NUM2INT(value), INT2NUM(i)
- NUM2UINT(value), UINT2NUM(ui)
- NUM2LONG(value), LONG2NUM(l)
- NUM2ULONG(value), ULONG2NUM(ul)
- NUM2LL(value), LL2NUM(ll)
- NUM2ULL(value), ULL2NUM(ull)
- NUM2OFFT(value), OFFT2NUM(off)
- NUM2SIZET(value), SIZET2NUM(size)
- NUM2SSIZET(value), SSIZET2NUM(ssize)
- rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags)
- NUM2DBL(value)
- rb_float_new(f)
- RSTRING_LEN(str)
- RSTRING_PTR(str)
- StringValue(value)
- StringValuePtr(value)
- StringValueCStr(value)
- rb_str_new2(s)
-
-== クラス/モジュール定義
-
-VALUE rb_define_class(const char *name, VALUE super) ::
-
- superのサブクラスとして新しいRubyクラスを定義する.
-
-VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
-
- superのサブクラスとして新しいRubyクラスを定義し,moduleの
- 定数として定義する.
-
-VALUE rb_define_module(const char *name) ::
-
- 新しいRubyモジュールを定義する.
-
-VALUE rb_define_module_under(VALUE module, const char *name) ::
-
- 新しいRubyモジュールを定義し,moduleの定数として定義する.
-
-void rb_include_module(VALUE klass, VALUE module) ::
-
- モジュールをインクルードする.classがすでにmoduleをインク
- ルードしている時には何もしない(多重インクルードの禁止).
-
-void rb_extend_object(VALUE object, VALUE module) ::
-
- オブジェクトをモジュール(で定義されているメソッド)で拡張する.
-
-== 大域変数定義
-
-void rb_define_variable(const char *name, VALUE *var) ::
-
- RubyとCとで共有するグローバル変数を定義する.変数名が`$'で
- 始まらない時には自動的に追加される.nameとしてRubyの識別子
- として許されない文字(例えば` ')を含む場合にはRubyプログラ
- ムからは見えなくなる.
-
-void rb_define_readonly_variable(const char *name, VALUE *var) ::
-
- RubyとCとで共有するread onlyのグローバル変数を定義する.
- read onlyであること以外はrb_define_variable()と同じ.
-
-void rb_define_virtual_variable(const char *name, VALUE (*getter)(), void (*setter)()) ::
-
- 関数によって実現されるRuby変数を定義する.変数が参照された
- 時にはgetterが,変数に値がセットされた時にはsetterが呼ばれ
- る.
-
-void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), void (*setter)()) ::
-
- 関数によってhookのつけられたグローバル変数を定義する.変数
- が参照された時にはgetterが,関数に値がセットされた時には
- setterが呼ばれる.getterやsetterに0を指定した時にはhookを
- 指定しないのと同じ事になる.
-
-void rb_global_variable(VALUE *var) ::
-
- GCのため,Rubyプログラムからはアクセスされないが, Rubyオブ
- ジェクトを含む大域変数をマークする.
-
-== 定数
-
-void rb_define_const(VALUE klass, const char *name, VALUE val) ::
-
- 定数を定義する.
-
-void rb_define_global_const(const char *name, VALUE val) ::
-
- 大域定数を定義する.
-
- rb_define_const(rb_cObject, name, val)
-
- と同じ意味.
-
-== メソッド定義
-
-rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-
- メソッドを定義する.argcはselfを除く引数の数.argcが-1の時,
- 関数には引数の数(selfを含まない)を第1引数, 引数の配列を第2
- 引数とする形式で与えられる(第3引数はself).argcが-2の時,
- 第1引数がself, 第2引数がargs(argsは引数を含むRubyの配列)と
- いう形式で与えられる.
-
-rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-
- privateメソッドを定義する.引数はrb_define_method()と同じ.
-
-rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-
- 特異メソッドを定義する.引数はrb_define_method()と同じ.
-
-rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
-
- argc, argv形式で与えられた指定されたフォーマットに従って引
- 数を分解し,続くVALUEへの参照にセットします.このフォーマッ
- トは,ABNFで記述すると以下の通りです.
-
- scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
-
- param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
- pre-opt-post-arg-spec
- pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
- post-arg-spec := sym-for-variable-length-args
- [num-of-trailing-mandatory-args]
- pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
- num-of-trailing-mandatory-args
- option-hash-arg-spec := sym-for-option-hash-arg
- block-arg-spec := sym-for-block-arg
-
- num-of-leading-mandatory-args := DIGIT ; 先頭に置かれる省略不能な引数の数
- num-of-optional-args := DIGIT ; 続いて置かれる省略可能な引数の数
- sym-for-variable-length-args := "*" ; 続いて置かれる可変長引数を
- ; Rubyの配列で取得するための指定
- num-of-trailing-mandatory-args := DIGIT ; 終端に置かれる省略不能な引数の数
- sym-for-option-hash-arg := ":" ; オプションハッシュを取得する
- ; ための指定; 省略不能な引数の
- ; 数よりも多くの引数が指定され,
- ; 最後の引数がハッシュ(または
- ; #to_hashで変換可能)の場合に
- ; 取得される.最後の引数がnilの
- ; 場合,可変長引数指定がなく,
- ; 省略不能引数の数よりも多くの
- ; 引数が指定された場合に取得される
- sym-for-block-arg := "&" ; イテレータブロックを取得するための
- ; 指定
-
- フォーマットが"12"の場合,引数は最低1つで,3つ(1+2)まで許さ
- れるという意味になります.従って,フォーマット文字列に続い
- て3つのVALUEへの参照を置く必要があります.それらには取得した
- 変数がセットされます.変数への参照の代わりにNULLを指定する
- こともでき,その場合は取得した引数の値は捨てられます.なお,
- 省略可能引数が省略された時の変数の値はnil(C言語のレベルでは
- Qnil)になります.
-
- 返り値は与えられた引数の数です.オプションハッシュおよびイ
- テレータブロックは数えません.
-
-int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values) ::
-
- キーワードで指定された値をtableにしたがって取り出します.
- tableの最初のrequired個のIDは必須キーワードを表し,続く
- optional (optionalが負の場合は-optional-1) 個のIDは省略可能
- キーワードです.必須キーワードがkeyword_hash中にない場合,
- "missing keyword"ArgumentErrorが発生します.省略可能キーワー
- ドがない場合は,values中の対応する要素にはQundefがセットされ
- ます.keyword_hashに使用されない要素がある場合は,optionalが
- 負なら無視されますが,そうでなければ"unknown keyword"
- ArgumentErrorが発生します.
-
-VALUE rb_extract_keywords(VALUE *original_hash) ::
-
- original_hashで参照されるHashオブジェクトから,Symbolである
- キーとその値を新しいHashに取り出します.original_hashの指す
- 先には,元のHashがSymbol以外のキーを含んでいた場合はそれらが
- コピーされた別の新しいHash,そうでなければ0が保存されます.
-
-== Rubyメソッド呼び出し
-
-VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
-
- メソッド呼び出し.文字列からmidを得るためにはrb_intern()を
- 使う.
- private/protectedなメソッドでも呼び出せる.
-
-VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
-VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
-
- メソッド呼び出し.引数をargc, argv形式で渡す.
- private/protectedなメソッドでも呼び出せる.
-
-VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
-
- メソッド呼び出し.
- publicなメソッドしか呼べない.
-
-VALUE rb_eval_string(const char *str) ::
-
- 文字列をRubyスクリプトとしてコンパイル・実行する.
-
-ID rb_intern(const char *name) ::
-
- 文字列に対応するIDを返す.
-
-char *rb_id2name(ID id) ::
-
- IDに対応する文字列を返す(デバッグ用).
-
-char *rb_class2name(VALUE klass) ::
-
- クラスの名前を返す(デバッグ用).クラスが名前を持たない時に
- は, 祖先を遡って名前を持つクラスの名前を返す.
-
-int rb_respond_to(VALUE obj, ID id) ::
-
- objがidで示されるメソッドを持つかどうかを返す.
-
-== インスタンス変数
-
-VALUE rb_iv_get(VALUE obj, const char *name) ::
-
- objのインスタンス変数の値を得る.`@'で始まらないインスタン
- ス変数は Rubyプログラムからアクセスできない「隠れた」イン
- スタンス変数になる.定数は大文字の名前を持つクラス(または
- モジュール)のインスタンス変数として実装されている.
-
-VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
-
- objのインスタンス変数をvalにセットする.
-
-== 制御構造
-
-VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
-
- funcをブロックとして設定し,objをレシーバ,argcとargvを引数
- としてmidメソッドを呼び出す.funcは第一引数にyieldされた値,
- 第二引数にdata2を受け取る.複数の値がyieldされた場合(Cでは
- rb_yield_values()とrb_yield_values2(), rb_yield_splat()),
- data2はArrayとしてパックされている.第三, 第四引数のargcと
- argvによってyieldされた値を取り出すことができる.
-
-\[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-
- func2をブロックとして設定し, func1をイテレータとして呼ぶ.
- func1には arg1が引数として渡され, func2には第1引数にイテレー
- タから与えられた値, 第2引数にarg2が渡される.
-
- 1.9でrb_iterateを使う場合は, func1の中でRubyレベルのメソッド
- を呼び出さなければならない.
- 1.9でobsoleteとなった. 代わりにrb_block_callが用意された.
-
-VALUE rb_yield(VALUE val) ::
-
- valを値としてイテレータブロックを呼び出す.
-
-VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-
- 関数func1をarg1を引数に呼び出す.func1の実行中に例外が発生
- した時には func2をarg2を引数として呼ぶ.戻り値は例外が発生
- しなかった時はfunc1の戻り値, 例外が発生した時にはfunc2の戻
- り値である.
-
-VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-
- 関数func1をarg1を引数として実行し, 実行終了後(たとえ例外が
- 発生しても) func2をarg2を引数として実行する.戻り値はfunc1
- の戻り値である(例外が発生した時は戻らない).
-
-VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
-
- 関数funcをargを引数として実行し, 例外が発生しなければその戻
- り値を返す.例外が発生した場合は, *stateに非0をセットして
- Qnilを返す.
- rb_jump_tag()を呼ばずに捕捉した例外を無視する場合には,
- rb_set_errinfo(Qnil)でエラー情報をクリアしなければならない.
-
-void rb_jump_tag(int state) ::
-
- rb_protect()やrb_eval_string_protect()で捕捉された例外を再
- 送する.stateはそれらの関数から返された値でなければならない.
- この関数は直接の呼び出し元に戻らない.
-
-void rb_iter_break() ::
-
- 現在の最も内側のブロックを終了する.この関数は直接の呼び出
- し元に戻らない.
-
-void rb_iter_break_value(VALUE value) ::
-
- 現在の最も内側のブロックをvalueで終了する.ブロックは引数で
- 与えられたvalueを返す.この関数は直接の呼び出し元に戻らない.
-
-== 例外・エラー
-
-void rb_warning(const char *fmt, ...) ::
-
- rb_verbose時に標準エラー出力に警告情報を表示する.引数は
- printf()と同じ.
-
-void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
-
- RuntimeError例外を発生させる.引数はprintf()と同じ.
-
-void rb_raise(VALUE exception, const char *fmt, ...) ::
-
- exceptionで指定した例外を発生させる.fmt以下の引数は
- printf()と同じ.
-
-void rb_fatal(const char *fmt, ...) ::
-
- 致命的例外を発生させる.通常の例外処理は行なわれず, インター
- プリタが終了する(ただしensureで指定されたコードは終了前に
- 実行される).
-
-void rb_bug(const char *fmt, ...) ::
-
- インタープリタなどプログラムのバグでしか発生するはずのない
- 状況の時呼ぶ.インタープリタはコアダンプし直ちに終了する.
- 例外処理は一切行なわれない.
-
-注意: "%"PRIsVALUEがObject#to_s('+'フラグが指定されていると
-きはObject#inspect)を使ったVALUEの出力に利用できる.これは
-"%i"と衝突するため,整数には"%d"を使用すること.
-
-== Rubyの初期化・実行
-
-Rubyをアプリケーションに埋め込む場合には以下のインタフェース
-を使う.通常の拡張ライブラリには必要ない.
-
-void ruby_init() ::
-
- Rubyインタプリタの初期化を行なう.
-
-void *ruby_options(int argc, char **argv) ::
-
- Rubyインタプリタのコマンドライン引数の処理を行ない,
- Rubyのソースコードをコンパイルする.
- コンパイルされたソースへのポインタ,もしくは特殊値を返す.
-
-int ruby_run_node(void *n) ::
-
- コンパイルされたコードを実行する.
- 実行に成功した場合はEXIT_SUCCESSを,エラーが起こったときはそれ以外を返す.
-
-void ruby_script(char *name) ::
-
- Rubyのスクリプト名($0)を設定する.
-
-== インタプリタのイベントのフック
-
-void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data) ::
-
- 指定されたインタプリタのイベントに対するフック関数を追加します.
- eventsは以下の値のorでなければなりません:
-
- RUBY_EVENT_LINE
- RUBY_EVENT_CLASS
- RUBY_EVENT_END
- RUBY_EVENT_CALL
- RUBY_EVENT_RETURN
- RUBY_EVENT_C_CALL
- RUBY_EVENT_C_RETURN
- RUBY_EVENT_RAISE
- RUBY_EVENT_ALL
-
- rb_event_hook_func_tの定義は以下の通りです:
-
- typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
- VALUE self, ID id, VALUE klass)
-
- rb_add_event_hook() の第3引数 data は,フック関数の第2引数と
- して渡されます.これは1.8では現在のNODEへのポインタでした.以
- 下の RB_EVENT_HOOKS_HAVE_CALLBACK_DATA も参照してください.
-
-int rb_remove_event_hook(rb_event_hook_func_t func) ::
-
- 指定されたフック関数を削除します.
-
-== 互換性のためのマクロ
-
-APIの互換性をチェックするために以下のマクロがデフォルトで定義されています.
-
-NORETURN_STYLE_NEW ::
-
- NORETURN マクロが関数型マクロとして定義されていることを意味する.
-
-HAVE_RB_DEFINE_ALLOC_FUNC ::
-
- rb_define_alloc_func() 関数が提供されていること,つまり
- allocation framework が使われることを意味する.
- have_func("rb_define_alloc_func", "ruby.h")
- の結果と同じ.
-
-HAVE_RB_REG_NEW_STR ::
-
- StringオブジェクトからRegexpオブジェクトを作る
- rb_reg_new_str() 関数が提供されていることを意味する.
- have_func("rb_reg_new_str", "ruby.h").
- の結果と同じ.
-
-HAVE_RB_IO_T ::
-
- rb_io_t 型が提供されていることを意味する.
-
-USE_SYMBOL_AS_METHOD_NAME ::
-
- メソッド名を返すメソッド,Module#methods, \#singleton_methods
- などがSymbolを返すことを意味する.
-
-HAVE_RUBY_*_H ::
-
- ruby.h で定義されている.対応するヘッダが提供されていること
- を意味する.たとえば,HAVE_RUBY_ST_H が定義されている場合は
- 単なる st.h ではなく ruby/st.h を使用する.
-
-RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
-
- rb_add_event_hook() がフック関数に渡す data を第3引数として
- 受け取ることを意味する.
-
-= Appendix C. extconf.rbで使える関数たち
-
-extconf.rbの中では利用可能なコンパイル条件チェックの関数は以
-下の通りである.
-
-have_macro(macro, headers) ::
-
- ヘッダファイルheaderをインクルードしてマクロmacroが定義さ
- れているかどうかチェックする.マクロが定義されている時true
- を返す.
-
-have_library(lib, func) ::
-
- 関数funcを定義しているライブラリlibの存在をチェックする.
- チェックに成功すると,-llibを$libsに追加し,trueを返す.
-
-find_library(lib, func, path...) ::
-
- 関数funcを定義しているライブラリlibの存在を -Lpath を追加
- しながらチェックする.チェックに成功すると,-llibを$libsに
- 追加し,trueを返す.
-
-have_func(func, header) ::
-
- ヘッダファイルheaderをインクルードして関数funcの存在をチェ
- ックする.funcが標準ではリンクされないライブラリ内のもので
- ある時には先にhave_libraryでそのライブラリをチェックしてお
- く事.チェックに成功すると,プリプロセッサマクロ
- `HAVE_{FUNC}` を定義し,trueを返す.
-
-have_var(var, header) ::
-
- ヘッダファイルheaderをインクルードして変数varの存在をチェッ
- クする.varが標準ではリンクされないライブラリ内のものであ
- る時には先にhave_libraryでそのライブラリをチェックしておく
- 事.チェックに成功すると,プリプロセッサマクロ
- `HAVE_{VAR}` を定義し,trueを返す.
-
-have_header(header) ::
-
- ヘッダファイルの存在をチェックする.チェックに成功すると,
- プリプロセッサマクロ `HAVE_{HEADER_H}` を定義し,trueを返す.
- (スラッシュやドットはアンダースコアに置換される)
-
-find_header(header, path...) ::
-
- ヘッダファイルheaderの存在を -Ipath を追加しながらチェック
- する.チェックに成功すると,プリプロセッサマクロ
- `HAVE_{HEADER_H}` を定義し,trueを返す.
- (スラッシュやドットはアンダースコアに置換される)
-
-have_struct_member(type, member[, header[, opt]]) ::
-
- ヘッダファイルheaderをインクルードして型typeが定義され,
- なおかつメンバmemberが存在するかをチェックする.チェックに
- 成功すると,プリプロセッサマクロ `HAVE_{TYPE}_{MEMBER}` を
- 定義し,trueを返す.
-
-have_type(type, header, opt) ::
-
- ヘッダファイルheaderをインクルードして型typeが存在するかを
- チェックする.チェックに成功すると,プリプロセッサマクロ
- `HAVE_TYPE_{TYPE}` を定義し,trueを返す.
-
-check_sizeof(type, header) ::
-
- ヘッダファイルheaderをインクルードして型typeのchar単位サイ
- ズを調べる.チェックに成功すると,プリプロセッサマクロ
- `SIZEOF_{TYPE}` を定義し,そのサイズを返す.定義されていな
- いときはnilを返す.
-
-create_makefile(target[, target_prefix]) ::
-
- 拡張ライブラリ用のMakefileを生成する.この関数を呼ばなけれ
- ばそのライブラリはコンパイルされない.targetはモジュール名
- を表す.
-
-find_executable(command, path) ::
-
- コマンドcommandをFile::PATH_SEPARATORで区切られたパス名の
- リストpathから探す.pathがnilまたは省略された場合は,環境
- 変数PATHの値を使用する.実行可能なコマンドが見つかった場合
- はパスを含むファイル名,見つからなかった場合はnilを返す.
-
-with_config(withval[, default=nil]) ::
-
- コマンドライン上の--with-<withval>で指定されたオプション値
- を得る.
-
-enable_config(config, *defaults) ::
-disable_config(config, *defaults) ::
-
- コマンドライン上の--enable-<config>または
- --disable-<config>で指定された真偽値を得る.
- --enable-<config>が指定されていた場合はtrue,
- --disable-<config>が指定されていた場合はfalseを返す.
- どちらも指定されていない場合は,ブロックつきで呼び出されて
- いる場合は*defaultsをyieldした結果,ブロックなしなら
- \*defaultsを返す.
-
-dir_config(target[, default_dir]) ::
-dir_config(target[, default_include, default_lib]) ::
-
- コマンドライン上の--with-<target>-dir, --with-<target>-include,
- --with-<target>-libのいずれかで指定されるディレクトリを
- $CFLAGS や $LDFLAGS に追加する.--with-<target>-dir=/pathは
- --with-<target>-include=/path/include --with-<target>-lib=/path/lib
- と等価である.追加された include ディレクトリと lib ディレ
- クトリの配列を返す. ([include_dir, lib_dir])
-
-pkg_config(pkg, option=nil) ::
-
- pkg-configコマンドからパッケージpkgの情報を [cflags, ldflags, libs]
- の配列として得る.$CFLAGS, $LDFLAGS, $libs にはそれぞれの値が
- 追加される.
-
- pkg-configの実際のコマンドは,以下の順で試される.
-
- 1. コマンドラインで--with-{pkg}-config={command}オプションが
- 指定された場合: {command} {option}
- 2. {pkg}-config {option}
- 3. pkg-config {option} {pkg}
-
- optionが指定された場合は,上記の配列の代わりにそのオプションを
- 指定して得られた出力をstripしたものを返す.
-
-= Appendix D. 世代別GC
-
-Ruby 2.1から世代別GCに対応しました.我々はこれをRGenGCと呼んでいます.
-RGenGCは,過去の拡張ライブラリに(ほぼ)互換性を保つように開発されている
-ため,拡張ライブラリ側の対応はほぼ不要です.
-
-ただし,対応をすることで性能を向上することができる可能性があります.もし
-拡張ライブラリに高い性能が必要である場合は対応を検討して下さい.
-
-とくにRARRAY_PTR()/RHASH_TBL()のようなマクロを用いてポインタに直接アクセ
-スするようなコードは書かないようにして下さい.代わりに,rb_ary_aref(),
-rb_ary_store() などの,適切な API 関数を利用するようにして下さい.
-
-そのほか,対応についての詳細は README.EXT の「Appendix D. Generational
-GC」を参照して下さい.
-
-:enddoc: Local variables:
-:enddoc: fill-column: 60
-:enddoc: end:
diff --git a/doc/extension.rdoc b/doc/extension.rdoc
deleted file mode 100644
index 40f83bf0d8..0000000000
--- a/doc/extension.rdoc
+++ /dev/null
@@ -1,1828 +0,0 @@
-# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
-
-This document explains how to make extension libraries for Ruby.
-
-= Basic Knowledge
-
-In C, variables have types and data do not have types. In contrast,
-Ruby variables do not have a static type, and data themselves have
-types, so data will need to be converted between the languages.
-
-Data in Ruby are represented by the C type `VALUE'. Each VALUE data
-has its data type.
-
-To retrieve C data from a VALUE, you need to:
-
-1. Identify the VALUE's data type
-2. Convert the VALUE into C data
-
-Converting to the wrong data type may cause serious problems.
-
-== Data Types
-
-The Ruby interpreter has the following data types:
-
-T_NIL :: nil
-T_OBJECT :: ordinary object
-T_CLASS :: class
-T_MODULE :: module
-T_FLOAT :: floating point number
-T_STRING :: string
-T_REGEXP :: regular expression
-T_ARRAY :: array
-T_HASH :: associative array
-T_STRUCT :: (Ruby) structure
-T_BIGNUM :: multi precision integer
-T_FIXNUM :: Fixnum(31bit or 63bit integer)
-T_COMPLEX :: complex number
-T_RATIONAL :: rational number
-T_FILE :: IO
-T_TRUE :: true
-T_FALSE :: false
-T_DATA :: data
-T_SYMBOL :: symbol
-
-In addition, there are several other types used internally:
-
-T_ICLASS :: included module
-T_MATCH :: MatchData object
-T_UNDEF :: undefined
-T_NODE :: syntax tree node
-T_ZOMBIE :: object awaiting finalization
-
-Most of the types are represented by C structures.
-
-== Check Data Type of the VALUE
-
-The macro TYPE() defined in ruby.h shows the data type of the VALUE.
-TYPE() returns the constant number T_XXXX described above. To handle
-data types, your code will look something like this:
-
- switch (TYPE(obj)) {
- case T_FIXNUM:
- /* process Fixnum */
- break;
- case T_STRING:
- /* process String */
- break;
- case T_ARRAY:
- /* process Array */
- break;
- default:
- /* raise exception */
- rb_raise(rb_eTypeError, "not valid value");
- break;
- }
-
-There is the data type check function
-
- void Check_Type(VALUE value, int type)
-
-which raises an exception if the VALUE does not have the type
-specified.
-
-There are also faster check macros for fixnums and nil.
-
- FIXNUM_P(obj)
- NIL_P(obj)
-
-== Convert VALUE into C Data
-
-The data for type T_NIL, T_FALSE, T_TRUE are nil, false, true
-respectively. They are singletons for the data type.
-The equivalent C constants are: Qnil, Qfalse, Qtrue.
-Note that Qfalse is false in C also (i.e. 0), but not Qnil.
-
-The T_FIXNUM data is a 31bit or 63bit length fixed integer.
-This size depends on the size of long: if long is 32bit then
-T_FIXNUM is 31bit, if long is 64bit then T_FIXNUM is 63bit.
-T_FIXNUM can be converted to a C integer by using the
-FIX2INT() macro or FIX2LONG(). Though you have to check that the
-data is really FIXNUM before using them, they are faster. FIX2LONG()
-never raises exceptions, but FIX2INT() raises RangeError if the
-result is bigger or smaller than the size of int.
-There are also NUM2INT() and NUM2LONG() which converts any Ruby
-numbers into C integers. These macros include a type check,
-so an exception will be raised if the conversion failed. NUM2DBL()
-can be used to retrieve the double float value in the same way.
-
-You can use the macros
-StringValue() and StringValuePtr() to get a char* from a VALUE.
-StringValue(var) replaces var's value with the result of "var.to_str()".
-StringValuePtr(var) does the same replacement and returns the char*
-representation of var. These macros will skip the replacement if var
-is a String. Notice that the macros take only the lvalue as their
-argument, to change the value of var in place.
-
-You can also use the macro named StringValueCStr(). This is just
-like StringValuePtr(), but always adds a NUL character at the end of
-the result. If the result contains a NUL character, this macro causes
-the ArgumentError exception.
-StringValuePtr() doesn't guarantee the existence of a NUL at the end
-of the result, and the result may contain NUL.
-
-Other data types have corresponding C structures, e.g. struct RArray
-for T_ARRAY etc. The VALUE of the type which has the corresponding
-structure can be cast to retrieve the pointer to the struct. The
-casting macro will be of the form RXXXX for each data type; for
-instance, RARRAY(obj). See "ruby.h". However, we do not recommend
-to access RXXXX data directly because these data structures are complex.
-Use corresponding rb_xxx() functions to access the internal struct.
-For example, to access an entry of array, use rb_ary_entry(ary, offset)
-and rb_ary_store(ary, offset, obj).
-
-There are some accessing macros for structure members, for example
-`RSTRING_LEN(str)' to get the size of the Ruby String object. The
-allocated region can be accessed by `RSTRING_PTR(str)'.
-
-Notice: Do not change the value of the structure directly, unless you
-are responsible for the result. This ends up being the cause of
-interesting bugs.
-
-== Convert C Data into VALUE
-
-To convert C data to Ruby values:
-
-FIXNUM ::
-
- left shift 1 bit, and turn on its least significant bit (LSB).
-
-Other pointer values ::
-
- cast to VALUE.
-
-You can determine whether a VALUE is a pointer or not by checking its LSB.
-
-Notice: Ruby does not allow arbitrary pointer values to be a VALUE. They
-should be pointers to the structures which Ruby knows about. The known
-structures are defined in <ruby.h>.
-
-To convert C numbers to Ruby values, use these macros:
-
-INT2FIX() :: for integers within 31bits.
-INT2NUM() :: for arbitrary sized integers.
-
-INT2NUM() converts an integer into a Bignum if it is out of the FIXNUM
-range, but is a bit slower.
-
-== Manipulating Ruby Data
-
-As I already mentioned, it is not recommended to modify an object's
-internal structure. To manipulate objects, use the functions supplied
-by the Ruby interpreter. Some (not all) of the useful functions are
-listed below:
-
-=== String Functions
-
-rb_str_new(const char *ptr, long len) ::
-
- Creates a new Ruby string.
-
-rb_str_new2(const char *ptr) ::
-rb_str_new_cstr(const char *ptr) ::
-
- Creates a new Ruby string from a C string. This is equivalent to
- rb_str_new(ptr, strlen(ptr)).
-
-rb_str_new_literal(const char *ptr) ::
-
- Creates a new Ruby string from a C string literal.
-
-rb_tainted_str_new(const char *ptr, long len) ::
-
- Creates a new tainted Ruby string. Strings from external data
- sources should be tainted.
-
-rb_tainted_str_new2(const char *ptr) ::
-rb_tainted_str_new_cstr(const char *ptr) ::
-
- Creates a new tainted Ruby string from a C string.
-
-rb_sprintf(const char *format, ...) ::
-rb_vsprintf(const char *format, va_list ap) ::
-
- Creates a new Ruby string with printf(3) format.
-
- Note: In the format string, "%"PRIsVALUE can be used for Object#to_s
- (or Object#inspect if '+' flag is set) output (and related argument
- must be a VALUE). Since it conflicts with "%i", for integers in
- format strings, use "%d".
-
-rb_str_cat(VALUE str, const char *ptr, long len) ::
-
- Appends len bytes of data from ptr to the Ruby string.
-
-rb_str_cat2(VALUE str, const char* ptr) ::
-rb_str_cat_cstr(VALUE str, const char* ptr) ::
-
- Appends C string ptr to Ruby string str. This function is
- equivalent to rb_str_cat(str, ptr, strlen(ptr)).
-
-rb_str_catf(VALUE str, const char* format, ...) ::
-rb_str_vcatf(VALUE str, const char* format, va_list ap) ::
-
- Appends C string format and successive arguments to Ruby string
- str according to a printf-like format. These functions are
- equivalent to rb_str_cat2(str, rb_sprintf(format, ...)) and
- rb_str_cat2(str, rb_vsprintf(format, ap)), respectively.
-
-rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) ::
-rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc) ::
-
- Creates a new Ruby string with the specified encoding.
-
-rb_enc_str_new_literal(const char *ptr) ::
-
- Creates a new Ruby string from a C string literal with the specified
- encoding.
-
-rb_usascii_str_new(const char *ptr, long len) ::
-rb_usascii_str_new_cstr(const char *ptr) ::
-
- Creates a new Ruby string with encoding US-ASCII.
-
-rb_usascii_str_new_literal(const char *ptr) ::
-
- Creates a new Ruby string from a C string literal with encoding
- US-ASCII.
-
-rb_utf8_str_new(const char *ptr, long len) ::
-rb_utf8_str_new_cstr(const char *ptr) ::
-
- Creates a new Ruby string with encoding UTF-8.
-
-rb_utf8_str_new_literal(const char *ptr) ::
-
- Creates a new Ruby string from a C string literal with encoding
- UTF-8.
-
-rb_str_resize(VALUE str, long len) ::
-
- Resizes a Ruby string to len bytes. If str is not modifiable, this
- function raises an exception. The length of str must be set in
- advance. If len is less than the old length the content beyond
- len bytes is discarded, else if len is greater than the old length
- the content beyond the old length bytes will not be preserved but
- will be garbage. Note that RSTRING_PTR(str) may change by calling
- this function.
-
-rb_str_set_len(VALUE str, long len) ::
-
- Sets the length of a Ruby string. If str is not modifiable, this
- function raises an exception. This function preserves the content
- up to len bytes, regardless RSTRING_LEN(str). len must not exceed
- the capacity of str.
-
-=== Array Functions
-
-rb_ary_new() ::
-
- Creates an array with no elements.
-
-rb_ary_new2(long len) ::
-rb_ary_new_capa(long len) ::
-
- Creates an array with no elements, allocating internal buffer
- for len elements.
-
-rb_ary_new3(long n, ...) ::
-rb_ary_new_from_args(long n, ...) ::
-
- Creates an n-element array from the arguments.
-
-rb_ary_new4(long n, VALUE *elts) ::
-rb_ary_new_from_values(long n, VALUE *elts) ::
-
- Creates an n-element array from a C array.
-
-rb_ary_to_ary(VALUE obj) ::
-
- Converts the object into an array.
- Equivalent to Object#to_ary.
-
-There are many functions to operate an array. They may dump core if other
-types are given.
-
-rb_ary_aref(argc, VALUE *argv, VALUE ary) ::
-
- Equivalent to Array#[].
-
-rb_ary_entry(VALUE ary, long offset) ::
-
- \ary[offset]
-
-rb_ary_store(VALUE ary, long offset, VALUE obj) ::
-
- \ary[offset] = obj
-
-rb_ary_subseq(VALUE ary, long beg, long len) ::
-
- ary[beg, len]
-
-rb_ary_push(VALUE ary, VALUE val) ::
-rb_ary_pop(VALUE ary) ::
-rb_ary_shift(VALUE ary) ::
-rb_ary_unshift(VALUE ary, VALUE val) ::
-
- ary.push, ary.pop, ary.shift, ary.unshift
-
-rb_ary_cat(VALUE ary, const VALUE *ptr, long len) ::
-
- Appends len elements of objects from ptr to the array.
-
-= Extending Ruby with C
-
-== Adding New Features to Ruby
-
-You can add new features (classes, methods, etc.) to the Ruby
-interpreter. Ruby provides APIs for defining the following things:
-
-- Classes, Modules
-- Methods, Singleton Methods
-- Constants
-
-=== Class and Module Definition
-
-To define a class or module, use the functions below:
-
- VALUE rb_define_class(const char *name, VALUE super)
- VALUE rb_define_module(const char *name)
-
-These functions return the newly created class or module. You may
-want to save this reference into a variable to use later.
-
-To define nested classes or modules, use the functions below:
-
- VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
- VALUE rb_define_module_under(VALUE outer, const char *name)
-
-=== Method and Singleton Method Definition
-
-To define methods or singleton methods, use these functions:
-
- void rb_define_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
-
- void rb_define_singleton_method(VALUE object, const char *name,
- VALUE (*func)(), int argc)
-
-The `argc' represents the number of the arguments to the C function,
-which must be less than 17. But I doubt you'll need that many.
-
-If `argc' is negative, it specifies the calling sequence, not number of
-the arguments.
-
-If argc is -1, the function will be called as:
-
- VALUE func(int argc, VALUE *argv, VALUE obj)
-
-where argc is the actual number of arguments, argv is the C array of
-the arguments, and obj is the receiver.
-
-If argc is -2, the arguments are passed in a Ruby array. The function
-will be called like:
-
- VALUE func(VALUE obj, VALUE args)
-
-where obj is the receiver, and args is the Ruby array containing
-actual arguments.
-
-There are some more functions to define methods. One takes an ID
-as the name of method to be defined. See also ID or Symbol below.
-
- void rb_define_method_id(VALUE klass, ID name,
- VALUE (*func)(ANYARGS), int argc)
-
-There are two functions to define private/protected methods:
-
- void rb_define_private_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
- void rb_define_protected_method(VALUE klass, const char *name,
- VALUE (*func)(), int argc)
-
-At last, rb_define_module_function defines a module function,
-which are private AND singleton methods of the module.
-For example, sqrt is a module function defined in the Math module.
-It can be called in the following way:
-
- Math.sqrt(4)
-
-or
-
- include Math
- sqrt(4)
-
-To define module functions, use:
-
- void rb_define_module_function(VALUE module, const char *name,
- VALUE (*func)(), int argc)
-
-In addition, function-like methods, which are private methods defined
-in the Kernel module, can be defined using:
-
- void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
-
-To define an alias for the method,
-
- void rb_define_alias(VALUE module, const char* new, const char* old);
-
-To define a reader/writer for an attribute,
-
- void rb_define_attr(VALUE klass, const char *name, int read, int write)
-
-To define and undefine the `allocate' class method,
-
- void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
- void rb_undef_alloc_func(VALUE klass);
-
-func has to take the klass as the argument and return a newly
-allocated instance. This instance should be as empty as possible,
-without any expensive (including external) resources.
-
-If you are overriding an existing method of any ancestor of your class,
-you may rely on:
-
- VALUE rb_call_super(int argc, const VALUE *argv)
-
-To achieve the receiver of the current scope (if no other way is
-available), you can use:
-
- VALUE rb_current_receiver(void)
-
-=== Constant Definition
-
-We have 2 functions to define constants:
-
- void rb_define_const(VALUE klass, const char *name, VALUE val)
- void rb_define_global_const(const char *name, VALUE val)
-
-The former is to define a constant under specified class/module. The
-latter is to define a global constant.
-
-== Use Ruby Features from C
-
-There are several ways to invoke Ruby's features from C code.
-
-=== Evaluate Ruby Programs in a String
-
-The easiest way to use Ruby's functionality from a C program is to
-evaluate the string as Ruby program. This function will do the job:
-
- VALUE rb_eval_string(const char *str)
-
-Evaluation is done under the current context, thus current local variables
-of the innermost method (which is defined by Ruby) can be accessed.
-
-Note that the evaluation can raise an exception. There is a safer
-function:
-
- VALUE rb_eval_string_protect(const char *str, int *state)
-
-It returns nil when an error occurred. Moreover, *state is zero if str was
-successfully evaluated, or nonzero otherwise.
-
-=== ID or Symbol
-
-You can invoke methods directly, without parsing the string. First I
-need to explain about ID. ID is the integer number to represent
-Ruby's identifiers such as variable names. The Ruby data type
-corresponding to ID is Symbol. It can be accessed from Ruby in the
-form:
-
- :Identifier
-
-or
-
- :"any kind of string"
-
-You can get the ID value from a string within C code by using
-
- rb_intern(const char *name)
- rb_intern_str(VALUE name)
-
-You can retrieve ID from Ruby object (Symbol or String) given as an
-argument by using
-
- rb_to_id(VALUE symbol)
- rb_check_id(volatile VALUE *name)
- rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
-
-These functions try to convert the argument to a String if it was not
-a Symbol nor a String. The second function stores the converted
-result into *name, and returns 0 if the string is not a known symbol.
-After this function returned a non-zero value, *name is always a
-Symbol or a String, otherwise it is a String if the result is 0.
-The third function takes NUL-terminated C string, not Ruby VALUE.
-
-You can retrieve Symbol from Ruby object (Symbol or String) given as
-an argument by using
-
- rb_to_symbol(VALUE name)
- rb_check_symbol(volatile VALUE *namep)
- rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
-
-These functions are similar to above functions except that these
-return a Symbol instead of an ID.
-
-You can convert C ID to Ruby Symbol by using
-
- VALUE ID2SYM(ID id)
-
-and to convert Ruby Symbol object to ID, use
-
- ID SYM2ID(VALUE symbol)
-
-=== Invoke Ruby Method from C
-
-To invoke methods directly, you can use the function below
-
- VALUE rb_funcall(VALUE recv, ID mid, int argc, ...)
-
-This function invokes a method on the recv, with the method name
-specified by the symbol mid.
-
-=== Accessing the Variables and Constants
-
-You can access class variables and instance variables using access
-functions. Also, global variables can be shared between both
-environments. There's no way to access Ruby's local variables.
-
-The functions to access/modify instance variables are below:
-
- VALUE rb_ivar_get(VALUE obj, ID id)
- VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
-
-id must be the symbol, which can be retrieved by rb_intern().
-
-To access the constants of the class/module:
-
- VALUE rb_const_get(VALUE obj, ID id)
-
-See also Constant Definition above.
-
-= Information Sharing Between Ruby and C
-
-=== Ruby Constants That Can Be Accessed From C
-
-As stated in section 1.3,
-the following Ruby constants can be referred from C.
-
-Qtrue ::
-Qfalse ::
-
- Boolean values. Qfalse is false in C also (i.e. 0).
-
-Qnil ::
-
- Ruby nil in C scope.
-
-== Global Variables Shared Between C and Ruby
-
-Information can be shared between the two environments using shared global
-variables. To define them, you can use functions listed below:
-
- void rb_define_variable(const char *name, VALUE *var)
-
-This function defines the variable which is shared by both environments.
-The value of the global variable pointed to by `var' can be accessed
-through Ruby's global variable named `name'.
-
-You can define read-only (from Ruby, of course) variables using the
-function below.
-
- void rb_define_readonly_variable(const char *name, VALUE *var)
-
-You can defined hooked variables. The accessor functions (getter and
-setter) are called on access to the hooked variables.
-
- void rb_define_hooked_variable(const char *name, VALUE *var,
- VALUE (*getter)(), void (*setter)())
-
-If you need to supply either setter or getter, just supply 0 for the
-hook you don't need. If both hooks are 0, rb_define_hooked_variable()
-works just like rb_define_variable().
-
-The prototypes of the getter and setter functions are as follows:
-
- VALUE (*getter)(ID id, VALUE *var);
- void (*setter)(VALUE val, ID id, VALUE *var);
-
-Also you can define a Ruby global variable without a corresponding C
-variable. The value of the variable will be set/get only by hooks.
-
- void rb_define_virtual_variable(const char *name,
- VALUE (*getter)(), void (*setter)())
-
-The prototypes of the getter and setter functions are as follows:
-
- VALUE (*getter)(ID id);
- void (*setter)(VALUE val, ID id);
-
-== Encapsulate C Data into a Ruby Object
-
-Sometimes you need to expose your struct in the C world as a Ruby
-object.
-In a situation like this, making use of the TypedData_XXX macro
-family, the pointer to the struct and the Ruby object can be mutually
-converted.
-
---
-The old (non-Typed) Data_XXX macro family has been deprecated.
-In the future version of Ruby, it is possible old macros will not
-work.
-++
-
-=== C struct to Ruby object
-
-You can convert sval, a pointer to your struct, into a Ruby object
-with the next macro.
-
- TypedData_Wrap_Struct(klass, data_type, sval)
-
-TypedData_Wrap_Struct() returns a created Ruby object as a VALUE.
-
-The klass argument is the class for the object.
-data_type is a pointer to a const rb_data_type_t which describes
-how Ruby should manage the struct.
-
-It is recommended that klass derives from a special class called
-Data (rb_cData) but not from Object or other ordinal classes.
-If it doesn't, you have to call rb_undef_alloc_func(klass).
-
-rb_data_type_t is defined like this. Let's take a look at each
-member of the struct.
-
- struct rb_data_type_struct {
- const char *wrap_struct_name;
- struct {
- void (*dmark)(void*);
- void (*dfree)(void*);
- size_t (*dsize)(const void *);
- void *reserved[2];
- } function;
- const rb_data_type_t *parent;
- void *data;
- VALUE flags;
- };
-
-wrap_struct_name is an identifier of this instance of the struct.
-It is basically used for collecting and emitting statistics.
-So the identifier must be unique in the process, but doesn't need
-to be valid as a C or Ruby identifier.
-
-These dmark / dfree functions are invoked during GC execution. No
-object allocations are allowed during it, so do not allocate ruby
-objects inside them.
-
-dmark is a function to mark Ruby objects referred from your struct.
-It must mark all references from your struct with rb_gc_mark or
-its family if your struct keeps such references.
-
---
-Note that it is recommended to avoid such a reference.
-++
-
-dfree is a function to free the pointer allocation.
-If this is -1, the pointer will be just freed.
-
-dsize calculates memory consumption in bytes by the struct.
-Its parameter is a pointer to your struct.
-You can pass 0 as dsize if it is hard to implement such a function.
-But it is still recommended to avoid 0.
-
-You have to fill reserved and parent with 0.
-
-You can fill "data" with an arbitrary value for your use.
-Ruby does nothing with the member.
-
-flags is a bitwise-OR of the following flag values.
-Since they require deep understanding of garbage collector in Ruby,
-you can just set 0 to flags if you are not sure.
-
-RUBY_TYPED_FREE_IMMEDIATELY ::
-
- This flag makes the garbage collector immediately invoke dfree()
- during GC when it need to free your struct.
- You can specify this flag if the dfree never unlocks Ruby's
- internal lock (GVL).
-
- If this flag is not set, Ruby defers invokation of dfree()
- and invokes dfree() at the same time as finalizers.
-
-RUBY_TYPED_WB_PROTECTED ::
-
- It shows that implementation of the object supports write barriers.
- If this flag is set, Ruby is better able to do garbage collection
- of the object.
-
- When it is set, however, you are responsible for putting write
- barriers in all implementations of methods of that object as
- appropriate. Otherwise Ruby might crash while running.
-
- More about write barriers can be found in "Generational GC" in
- Appendix D.
-
-You can allocate and wrap the structure in one step.
-
- TypedData_Make_Struct(klass, type, data_type, sval)
-
-This macro returns an allocated Data object, wrapping the pointer to
-the structure, which is also allocated. This macro works like:
-
- (sval = ZALLOC(type), TypedData_Wrap_Struct(klass, data_type, sval))
-
-Arguments klass and data_type work like their counterparts in
-TypedData_Wrap_Struct(). A pointer to the allocated structure will
-be assigned to sval, which should be a pointer of the type specified.
-
-=== Ruby object to C struct
-
-To retrieve the C pointer from the Data object, use the macro
-Data_Get_Struct().
-
- TypedData_Get_Struct(obj, type, &data_type, sval)
-
-A pointer to the structure will be assigned to the variable sval.
-
-See the example below for details.
-
-= Example - Creating the dbm Extension
-
-OK, here's the example of making an extension library. This is the
-extension to access DBMs. The full source is included in the ext/
-directory in the Ruby's source tree.
-
-== Make the Directory
-
- % mkdir ext/dbm
-
-Make a directory for the extension library under ext directory.
-
-== Design the Library
-
-You need to design the library features, before making it.
-
-== Write the C Code
-
-You need to write C code for your extension library. If your library
-has only one source file, choosing ``LIBRARY.c'' as a file name is
-preferred. On the other hand, in case your library has multiple source
-files, avoid choosing ``LIBRARY.c'' for a file name. It may conflict
-with an intermediate file ``LIBRARY.o'' on some platforms.
-Note that some functions in mkmf library described below generate
-a file ``conftest.c'' for checking with compilation. You shouldn't
-choose ``conftest.c'' as a name of a source file.
-
-Ruby will execute the initializing function named ``Init_LIBRARY'' in
-the library. For example, ``Init_dbm()'' will be executed when loading
-the library.
-
-Here's the example of an initializing function.
-
- void
- Init_dbm(void)
- {
- /* define DBM class */
- VALUE cDBM = rb_define_class("DBM", rb_cObject);
- /* DBM includes Enumerable module */
- rb_include_module(cDBM, rb_mEnumerable);
-
- /* DBM has class method open(): arguments are received as C array */
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
-
- /* DBM instance method close(): no args */
- rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBM instance method []: 1 argument */
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
-
- /* ... */
-
- /* ID for a instance variable to store DBM data */
- id_dbm = rb_intern("dbm");
- }
-
-The dbm extension wraps the dbm struct in the C environment using
-Data_Make_Struct.
-
- struct dbmdata {
- int di_size;
- DBM *di_dbm;
- };
-
- static const rb_data_type_t dbm_type = {
- "dbm",
- {0, free_dbm, memsize_dbm,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
- };
-
- obj = TypedData_Make_Struct(klass, struct dbmdata, &dbm_type, dbmp);
-
-This code wraps the dbmdata structure into a Ruby object. We avoid
-wrapping DBM* directly, because we want to cache size information.
-
-To retrieve the dbmdata structure from a Ruby object, we define the
-following macro:
-
- #define GetDBM(obj, dbmp) do {\
- TypedData_Get_Struct((obj), struct dbmdata, &dbm_type, (dbmp));\
- if ((dbmp) == 0) closed_dbm();\
- if ((dbmp)->di_dbm == 0) closed_dbm();\
- } while (0)
-
-This sort of complicated macro does the retrieving and close checking
-for the DBM.
-
-There are three kinds of way to receive method arguments. First,
-methods with a fixed number of arguments receive arguments like this:
-
- static VALUE
- fdbm_delete(VALUE obj, VALUE keystr)
- {
- /* ... */
- }
-
-The first argument of the C function is the self, the rest are the
-arguments to the method.
-
-Second, methods with an arbitrary number of arguments receive
-arguments like this:
-
- static VALUE
- fdbm_s_open(int argc, VALUE *argv, VALUE klass)
- {
- /* ... */
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
- mode = 0666; /* default value */
- }
- /* ... */
- }
-
-The first argument is the number of method arguments, the second
-argument is the C array of the method arguments, and the third
-argument is the receiver of the method.
-
-You can use the function rb_scan_args() to check and retrieve the
-arguments. The third argument is a string that specifies how to
-capture method arguments and assign them to the following VALUE
-references.
-
-The following is an example of a method that takes arguments by Ruby's
-array:
-
- static VALUE
- thread_initialize(VALUE thread, VALUE args)
- {
- /* ... */
- }
-
-The first argument is the receiver, the second one is the Ruby array
-which contains the arguments to the method.
-
-<b>Notice</b>: GC should know about global variables which refer to Ruby's objects,
-but are not exported to the Ruby world. You need to protect them by
-
- void rb_global_variable(VALUE *var)
-
-== Prepare extconf.rb
-
-If the file named extconf.rb exists, it will be executed to generate
-Makefile.
-
-extconf.rb is the file for checking compilation conditions etc. You
-need to put
-
- require 'mkmf'
-
-at the top of the file. You can use the functions below to check
-various conditions.
-
- have_macro(macro[, headers[, opt]]): check whether macro is defined
- have_library(lib[, func[, headers[, opt]]]): check whether library containing function exists
- find_library(lib[, func, *paths]): find library from paths
- have_func(func[, headers[, opt]): check whether function exists
- have_var(var[, headers[, opt]]): check whether variable exists
- have_header(header[, preheaders[, opt]]): check whether header file exists
- find_header(header, *paths): find header from paths
- have_framework(fw): check whether framework exists (for MacOS X)
- have_struct_member(type, member[, headers[, opt]]): check whether struct has member
- have_type(type[, headers[, opt]]): check whether type exists
- find_type(type, opt, *headers): check whether type exists in headers
- have_const(const[, headers[, opt]]): check whether constant is defined
- check_sizeof(type[, headers[, opts]]): check size of type
- check_signedness(type[, headers[, opts]]): check signedness of type
- convertible_int(type[, headers[, opts]]): find convertible integer type
- find_executable(bin[, path]): find executable file path
- create_header(header): generate configured header
- create_makefile(target[, target_prefix]): generate Makefile
-
-See MakeMakefile for full documentation of these functions.
-
-The value of the variables below will affect the Makefile.
-
- $CFLAGS: included in CFLAGS make variable (such as -O)
- $CPPFLAGS: included in CPPFLAGS make variable (such as -I, -D)
- $LDFLAGS: included in LDFLAGS make variable (such as -L)
- $objs: list of object file names
-
-Normally, the object files list is automatically generated by searching
-source files, but you must define them explicitly if any sources will
-be generated while building.
-
-If a compilation condition is not fulfilled, you should not call
-``create_makefile''. The Makefile will not be generated, compilation will
-not be done.
-
-== Prepare Depend (Optional)
-
-If the file named depend exists, Makefile will include that file to
-check dependencies. You can make this file by invoking
-
- % gcc -MM *.c > depend
-
-It's harmless. Prepare it.
-
-== Generate Makefile
-
-Try generating the Makefile by:
-
- ruby extconf.rb
-
-If the library should be installed under vendor_ruby directory
-instead of site_ruby directory, use --vendor option as follows.
-
- ruby extconf.rb --vendor
-
-You don't need this step if you put the extension library under the ext
-directory of the ruby source tree. In that case, compilation of the
-interpreter will do this step for you.
-
-== Run make
-
-Type
-
- make
-
-to compile your extension. You don't need this step either if you have
-put the extension library under the ext directory of the ruby source tree.
-
-== Debug
-
-You may need to rb_debug the extension. Extensions can be linked
-statically by adding the directory name in the ext/Setup file so that
-you can inspect the extension with the debugger.
-
-== Done! Now You Have the Extension Library
-
-You can do anything you want with your library. The author of Ruby
-will not claim any restrictions on your code depending on the Ruby API.
-Feel free to use, modify, distribute or sell your program.
-
-= Appendix A. Ruby Source Files Overview
-
-== Ruby Language Core
-
-class.c :: classes and modules
-error.c :: exception classes and exception mechanism
-gc.c :: memory management
-load.c :: library loading
-object.c :: objects
-variable.c :: variables and constants
-
-== Ruby Syntax Parser
-
-parse.y :: grammar definition
-parse.c :: automatically generated from parse.y
-keywords :: reserved keywords
-lex.c :: automatically generated from keywords
-
-== Ruby Evaluator (a.k.a. YARV)
-
- compile.c
- eval.c
- eval_error.c
- eval_jump.c
- eval_safe.c
- insns.def : definition of VM instructions
- iseq.c : implementation of VM::ISeq
- thread.c : thread management and context switching
- thread_win32.c : thread implementation
- thread_pthread.c : ditto
- vm.c
- vm_dump.c
- vm_eval.c
- vm_exec.c
- vm_insnhelper.c
- vm_method.c
-
- opt_insns_unif.def : instruction unification
- opt_operand.def : definitions for optimization
-
- -> insn*.inc : automatically generated
- -> opt*.inc : automatically generated
- -> vm.inc : automatically generated
-
-== Regular Expression Engine (Oniguruma)
-
- regex.c
- regcomp.c
- regenc.c
- regerror.c
- regexec.c
- regparse.c
- regsyntax.c
-
-== Utility Functions
-
-debug.c :: debug symbols for C debugger
-dln.c :: dynamic loading
-st.c :: general purpose hash table
-strftime.c :: formatting times
-util.c :: misc utilities
-
-== Ruby Interpreter Implementation
-
- dmyext.c
- dmydln.c
- dmyencoding.c
- id.c
- inits.c
- main.c
- ruby.c
- version.c
-
- gem_prelude.rb
- prelude.rb
-
-== Class Library
-
-array.c :: Array
-bignum.c :: Bignum
-compar.c :: Comparable
-complex.c :: Complex
-cont.c :: Fiber, Continuation
-dir.c :: Dir
-enum.c :: Enumerable
-enumerator.c :: Enumerator
-file.c :: File
-hash.c :: Hash
-io.c :: IO
-marshal.c :: Marshal
-math.c :: Math
-numeric.c :: Numeric, Integer, Fixnum, Float
-pack.c :: Array#pack, String#unpack
-proc.c :: Binding, Proc
-process.c :: Process
-random.c :: random number
-range.c :: Range
-rational.c :: Rational
-re.c :: Regexp, MatchData
-signal.c :: Signal
-sprintf.c :: String#sprintf
-string.c :: String
-struct.c :: Struct
-time.c :: Time
-
-defs/known_errors.def :: Errno::* exception classes
--> known_errors.inc :: automatically generated
-
-== Multilingualization
-
-encoding.c :: Encoding
-transcode.c :: Encoding::Converter
-enc/*.c :: encoding classes
-enc/trans/* :: codepoint mapping tables
-
-== goruby Interpreter Implementation
-
- goruby.c
- golf_prelude.rb : goruby specific libraries.
- -> golf_prelude.c : automatically generated
-
-= Appendix B. Ruby Extension API Reference
-
-== Types
-
-VALUE ::
-
- The type for the Ruby object. Actual structures are defined in ruby.h,
- such as struct RString, etc. To refer the values in structures, use
- casting macros like RSTRING(obj).
-
-== Variables and Constants
-
-Qnil ::
-
- nil object
-
-Qtrue ::
-
- true object (default true value)
-
-Qfalse ::
-
- false object
-
-== C Pointer Wrapping
-
-Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
-
- Wrap a C pointer into a Ruby object. If object has references to other
- Ruby objects, they should be marked by using the mark function during
- the GC process. Otherwise, mark should be 0. When this object is no
- longer referred by anywhere, the pointer will be discarded by free
- function.
-
-Data_Make_Struct(klass, type, mark, free, sval) ::
-
- This macro allocates memory using malloc(), assigns it to the variable
- sval, and returns the DATA encapsulating the pointer to memory region.
-
-Data_Get_Struct(data, type, sval) ::
-
- This macro retrieves the pointer value from DATA, and assigns it to
- the variable sval.
-
-== Checking Data Types
-
-TYPE(value) ::
-
- Internal type (T_NIL, T_FIXNUM, etc.)
-
-FIXNUM_P(value) ::
-
- Is +value+ a Fixnum?
-
-NIL_P(value) ::
-
- Is +value+ nil?
-
-void Check_Type(VALUE value, int type) ::
-
- Ensures +value+ is of the given internal +type+ or raises a TypeError
-
-SaveStringValue(value) ::
-
- Checks that +value+ is a String and is not tainted
-
-== Data Type Conversion
-
-FIX2INT(value), INT2FIX(i) ::
-
- Fixnum <-> integer
-
-FIX2LONG(value), LONG2FIX(l) ::
-
- Fixnum <-> long
-
-NUM2INT(value), INT2NUM(i) ::
-
- Numeric <-> integer
-
-NUM2UINT(value), UINT2NUM(ui) ::
-
- Numeric <-> unsigned integer
-
-NUM2LONG(value), LONG2NUM(l) ::
-
- Numeric <-> long
-
-NUM2ULONG(value), ULONG2NUM(ul) ::
-
- Numeric <-> unsigned long
-
-NUM2LL(value), LL2NUM(ll) ::
-
- Numeric <-> long long
-
-NUM2ULL(value), ULL2NUM(ull) ::
-
- Numeric <-> unsigned long long
-
-NUM2OFFT(value), OFFT2NUM(off) ::
-
- Numeric <-> off_t
-
-NUM2SIZET(value), SIZET2NUM(size) ::
-
- Numeric <-> size_t
-
-NUM2SSIZET(value), SSIZET2NUM(ssize) ::
-
- Numeric <-> ssize_t
-
-rb_integer_pack(value, words, numwords, wordsize, nails, flags), rb_integer_unpack(words, numwords, wordsize, nails, flags) ::
-
- Numeric <-> Arbitrary size integer buffer
-
-NUM2DBL(value) ::
-
- Numeric -> double
-
-rb_float_new(f) ::
-
- double -> Float
-
-RSTRING_LEN(str) ::
-
- String -> length of String data in bytes
-
-RSTRING_PTR(str) ::
-
- String -> pointer to String data
- Note that the result pointer may not be NUL-terminated
-
-StringValue(value) ::
-
- Object with \#to_str -> String
-
-StringValuePtr(value) ::
-
- Object with \#to_str -> pointer to String data
-
-StringValueCStr(value) ::
-
- Object with \#to_str -> pointer to String data without NUL bytes
- It is guaranteed that the result data is NUL-terminated
-
-rb_str_new2(s) ::
-
- char * -> String
-
-== Defining Classes and Modules
-
-VALUE rb_define_class(const char *name, VALUE super) ::
-
- Defines a new Ruby class as a subclass of super.
-
-VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
-
- Creates a new Ruby class as a subclass of super, under the module's
- namespace.
-
-VALUE rb_define_module(const char *name) ::
-
- Defines a new Ruby module.
-
-VALUE rb_define_module_under(VALUE module, const char *name) ::
-
- Defines a new Ruby module under the module's namespace.
-
-void rb_include_module(VALUE klass, VALUE module) ::
-
- Includes module into class. If class already includes it, just ignored.
-
-void rb_extend_object(VALUE object, VALUE module) ::
-
- Extend the object with the module's attributes.
-
-== Defining Global Variables
-
-void rb_define_variable(const char *name, VALUE *var) ::
-
- Defines a global variable which is shared between C and Ruby. If name
- contains a character which is not allowed to be part of the symbol,
- it can't be seen from Ruby programs.
-
-void rb_define_readonly_variable(const char *name, VALUE *var) ::
-
- Defines a read-only global variable. Works just like
- rb_define_variable(), except the defined variable is read-only.
-
-void rb_define_virtual_variable(const char *name, VALUE (*getter)(), void (*setter)()) ::
-
- Defines a virtual variable, whose behavior is defined by a pair of C
- functions. The getter function is called when the variable is
- referenced. The setter function is called when the variable is set to a
- value. The prototype for getter/setter functions are:
-
- VALUE getter(ID id)
- void setter(VALUE val, ID id)
-
- The getter function must return the value for the access.
-
-void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), void (*setter)()) ::
-
- Defines hooked variable. It's a virtual variable with a C variable.
- The getter is called as
-
- VALUE getter(ID id, VALUE *var)
-
- returning a new value. The setter is called as
-
- void setter(VALUE val, ID id, VALUE *var)
-
-void rb_global_variable(VALUE *var) ::
-
- GC requires C global variables which hold Ruby values to be marked.
- rb_global_variable tells GC to protect these variables.
-
-== Constant Definition
-
-void rb_define_const(VALUE klass, const char *name, VALUE val) ::
-
- Defines a new constant under the class/module.
-
-void rb_define_global_const(const char *name, VALUE val) ::
-
- Defines a global constant. This is just the same as
-
- rb_define_const(rb_cObject, name, val)
-
-== Method Definition
-
-rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-
- Defines a method for the class. func is the function pointer. argc
- is the number of arguments. if argc is -1, the function will receive
- 3 arguments: argc, argv, and self. if argc is -2, the function will
- receive 2 arguments, self and args, where args is a Ruby array of
- the method arguments.
-
-rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-
- Defines a private method for the class. Arguments are same as
- rb_define_method().
-
-rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) ::
-
- Defines a singleton method. Arguments are same as rb_define_method().
-
-rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
-
- Retrieve argument from argc and argv to given VALUE references
- according to the format string. The format can be described in ABNF
- as follows:
-
- scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
-
- param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
- pre-opt-post-arg-spec
- pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
- post-arg-spec := sym-for-variable-length-args
- [num-of-trailing-mandatory-args]
- pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
- num-of-trailing-mandatory-args
- option-hash-arg-spec := sym-for-option-hash-arg
- block-arg-spec := sym-for-block-arg
-
- num-of-leading-mandatory-args := DIGIT ; The number of leading
- ; mandatory arguments
- num-of-optional-args := DIGIT ; The number of optional
- ; arguments
- sym-for-variable-length-args := "*" ; Indicates that variable
- ; length arguments are
- ; captured as a ruby array
- num-of-trailing-mandatory-args := DIGIT ; The number of trailing
- ; mandatory arguments
- sym-for-option-hash-arg := ":" ; Indicates that an option
- ; hash is captured if the last
- ; argument is a hash or can be
- ; converted to a hash with
- ; #to_hash. When the last
- ; argument is nil, it is
- ; captured if it is not
- ; ambiguous to take it as
- ; empty option hash; i.e. '*'
- ; is not specified and
- ; arguments are given more
- ; than sufficient.
- sym-for-block-arg := "&" ; Indicates that an iterator
- ; block should be captured if
- ; given
-
- For example, "12" means that the method requires at least one
- argument, and at most receives three (1+2) arguments. So, the format
- string must be followed by three variable references, which are to be
- assigned to captured arguments. For omitted arguments, variables are
- set to Qnil. NULL can be put in place of a variable reference, which
- means the corresponding captured argument(s) should be just dropped.
-
- The number of given arguments, excluding an option hash or iterator
- block, is returned.
-
-int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values) ::
-
- Retrieves argument VALUEs bound to keywords, which directed by +table+
- into +values+, deleting retrieved entries from +keyword_hash+ along
- the way. First +required+ number of IDs referred by +table+ are
- mandatory, and succeeding +optional+ (- +optional+ - 1 if
- +optional+ is negative) number of IDs are optional. If a
- mandatory key is not contained in +keyword_hash+, raises "missing
- keyword" +ArgumentError+. If an optional key is not present in
- +keyword_hash+, the corresponding element in +values+ is set to +Qundef+.
- If +optional+ is negative, rest of +keyword_hash+ are ignored, otherwise
- raises "unknown keyword" +ArgumentError+.
-
- Be warned, handling keyword arguments in the C API is less efficient
- than handling them in Ruby. Consider using a Ruby wrapper method
- around a non-keyword C function.
- ref: https://bugs.ruby-lang.org/issues/11339
-
-VALUE rb_extract_keywords(VALUE *original_hash) ::
-
- Extracts pairs whose key is a symbol into a new hash from a hash
- object referred by +original_hash+. If the original hash contains
- non-symbol keys, then they are copied to another hash and the new hash
- is stored through +original_hash+, else 0 is stored.
-
-== Invoking Ruby method
-
-VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
-
- Invokes a method. To retrieve mid from a method name, use rb_intern().
- Able to call even private/protected methods.
-
-VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
-VALUE rb_funcallv(VALUE recv, ID mid, int argc, VALUE *argv) ::
-
- Invokes a method, passing arguments as an array of values.
- Able to call even private/protected methods.
-
-VALUE rb_funcallv_public(VALUE recv, ID mid, int argc, VALUE *argv) ::
-
- Invokes a method, passing arguments as an array of values.
- Able to call only public methods.
-
-VALUE rb_eval_string(const char *str) ::
-
- Compiles and executes the string as a Ruby program.
-
-ID rb_intern(const char *name) ::
-
- Returns ID corresponding to the name.
-
-char *rb_id2name(ID id) ::
-
- Returns the name corresponding ID.
-
-char *rb_class2name(VALUE klass) ::
-
- Returns the name of the class.
-
-int rb_respond_to(VALUE obj, ID id) ::
-
- Returns true if the object responds to the message specified by id.
-
-== Instance Variables
-
-VALUE rb_iv_get(VALUE obj, const char *name) ::
-
- Retrieve the value of the instance variable. If the name is not
- prefixed by `@', that variable shall be inaccessible from Ruby.
-
-VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
-
- Sets the value of the instance variable.
-
-== Control Structure
-
-VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
-
- Calls a method on the recv, with the method name specified by the
- symbol mid, with argc arguments in argv, supplying func as the
- block. When func is called as the block, it will receive the value
- from yield as the first argument, and data2 as the second argument.
- When yielded with multiple values (in C, rb_yield_values(),
- rb_yield_values2() and rb_yield_splat()), data2 is packed as an Array,
- whereas yielded values can be gotten via argc/argv of the third/fourth
- arguments.
-
-\[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-
- Calls the function func1, supplying func2 as the block. func1 will be
- called with the argument arg1. func2 receives the value from yield as
- the first argument, arg2 as the second argument.
-
- When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
- This function is obsolete since 1.9; use rb_block_call instead.
-
-VALUE rb_yield(VALUE val) ::
-
- Evaluates the block with value val.
-
-VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-
- Calls the function func1, with arg1 as the argument. If an exception
- occurs during func1, it calls func2 with arg2 as the argument. The
- return value of rb_rescue() is the return value from func1 if no
- exception occurs, from func2 otherwise.
-
-VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-
- Calls the function func1 with arg1 as the argument, then calls func2
- with arg2 if execution terminated. The return value from
- rb_ensure() is that of func1 when no exception occurred.
-
-VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
-
- Calls the function func with arg as the argument. If no exception
- occurred during func, it returns the result of func and *state is zero.
- Otherwise, it returns Qnil and sets *state to nonzero. If state is
- NULL, it is not set in both cases.
- You have to clear the error info with rb_set_errinfo(Qnil) when
- ignoring the caught exception.
-
-void rb_jump_tag(int state) ::
-
- Continues the exception caught by rb_protect() and rb_eval_string_protect().
- state must be the returned value from those functions. This function
- never return to the caller.
-
-void rb_iter_break() ::
-
- Exits from the current innermost block. This function never return to
- the caller.
-
-void rb_iter_break_value(VALUE value) ::
-
- Exits from the current innermost block with the value. The block will
- return the given argument value. This function never return to the
- caller.
-
-== Exceptions and Errors
-
-void rb_warn(const char *fmt, ...) ::
-
- Prints a warning message according to a printf-like format.
-
-void rb_warning(const char *fmt, ...) ::
-
- Prints a warning message according to a printf-like format, if
- $VERBOSE is true.
-
-void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
-
- Raises RuntimeError. The fmt is a format string just like printf().
-
-void rb_raise(VALUE exception, const char *fmt, ...) ::
-
- Raises a class exception. The fmt is a format string just like printf().
-
-void rb_fatal(const char *fmt, ...) ::
-
- Raises a fatal error, terminates the interpreter. No exception handling
- will be done for fatal errors, but ensure blocks will be executed.
-
-void rb_bug(const char *fmt, ...) ::
-
- Terminates the interpreter immediately. This function should be
- called under the situation caused by the bug in the interpreter. No
- exception handling nor ensure execution will be done.
-
-Note: In the format string, "%"PRIsVALUE can be used for Object#to_s
-(or Object#inspect if '+' flag is set) output (and related argument
-must be a VALUE). Since it conflicts with "%i", for integers in
-format strings, use "%d".
-
-== Initialize and Start the Interpreter
-
-The embedding API functions are below (not needed for extension libraries):
-
-void ruby_init() ::
-
- Initializes the interpreter.
-
-void *ruby_options(int argc, char **argv) ::
-
- Process command line arguments for the interpreter.
- And compiles the Ruby source to execute.
- It returns an opaque pointer to the compiled source
- or an internal special value.
-
-int ruby_run_node(void *n) ::
-
- Runs the given compiled source and exits this process.
- It returns EXIT_SUCCESS if successfully runs the source.
- Otherwise, it returns other value.
-
-void ruby_script(char *name) ::
-
- Specifies the name of the script ($0).
-
-== Hooks for the Interpreter Events
-
-void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data) ::
-
- Adds a hook function for the specified interpreter events.
- events should be OR'ed value of:
-
- RUBY_EVENT_LINE
- RUBY_EVENT_CLASS
- RUBY_EVENT_END
- RUBY_EVENT_CALL
- RUBY_EVENT_RETURN
- RUBY_EVENT_C_CALL
- RUBY_EVENT_C_RETURN
- RUBY_EVENT_RAISE
- RUBY_EVENT_ALL
-
- The definition of rb_event_hook_func_t is below:
-
- typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
- VALUE self, ID id, VALUE klass)
-
- The third argument `data' to rb_add_event_hook() is passed to the hook
- function as the second argument, which was the pointer to the current
- NODE in 1.8. See RB_EVENT_HOOKS_HAVE_CALLBACK_DATA below.
-
-int rb_remove_event_hook(rb_event_hook_func_t func) ::
-
- Removes the specified hook function.
-
-== Macros for Compatibility
-
-Some macros to check API compatibilities are available by default.
-
-NORETURN_STYLE_NEW ::
-
- Means that NORETURN macro is functional style instead of prefix.
-
-HAVE_RB_DEFINE_ALLOC_FUNC ::
-
- Means that function rb_define_alloc_func() is provided, that means the
- allocation framework is used. This is same as the result of
- have_func("rb_define_alloc_func", "ruby.h").
-
-HAVE_RB_REG_NEW_STR ::
-
- Means that function rb_reg_new_str() is provided, that creates Regexp
- object from String object. This is same as the result of
- have_func("rb_reg_new_str", "ruby.h").
-
-HAVE_RB_IO_T ::
-
- Means that type rb_io_t is provided.
-
-USE_SYMBOL_AS_METHOD_NAME ::
-
- Means that Symbols will be returned as method names, e.g.,
- Module#methods, \#singleton_methods and so on.
-
-HAVE_RUBY_*_H ::
-
- Defined in ruby.h and means corresponding header is available. For
- instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
- mere st.h.
-
-RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
-
- Means that rb_add_event_hook() takes the third argument `data', to be
- passed to the given event hook function.
-
-= Appendix C. Functions available for use in extconf.rb
-
-See documentation for {mkmf}[rdoc-ref:MakeMakefile].
-
-= Appendix D. Generational GC
-
-Ruby 2.1 introduced a generational garbage collector (called RGenGC).
-RGenGC (mostly) keeps compatibility.
-
-Generally, the use of the technique called write barriers is required in
-extension libraries for generational GC
-(http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29).
-RGenGC works fine without write barriers in extension libraries.
-
-If your library adheres to the following tips, performance can
-be further improved. Especially, the "Don't touch pointers directly" section is
-important.
-
-== Incompatibility
-
-You can't write RBASIC(obj)->klass field directly because it is const
-value now.
-
-Basically you should not write this field because MRI expects it to be
-an immutable field, but if you want to do it in your extension you can
-use the following functions:
-
-VALUE rb_obj_hide(VALUE obj) ::
-
- Clear RBasic::klass field. The object will be an internal object.
- ObjectSpace::each_object can't find this object.
-
-VALUE rb_obj_reveal(VALUE obj, VALUE klass) ::
-
- Reset RBasic::klass to be klass.
- We expect the `klass' is hidden class by rb_obj_hide().
-
-== Write barriers
-
-RGenGC doesn't require write barriers to support generational GC.
-However, caring about write barrier can improve the performance of
-RGenGC. Please check the following tips.
-
-=== Don't touch pointers directly
-
-In MRI (include/ruby/ruby.h), some macros to acquire pointers to the
-internal data structures are supported such as RARRAY_PTR(),
-RSTRUCT_PTR() and so on.
-
-DO NOT USE THESE MACROS and instead use the corresponding C-APIs such as
-rb_ary_aref(), rb_ary_store() and so on.
-
-=== Consider whether to insert write barriers
-
-You don't need to care about write barriers if you only use built-in
-types.
-
-If you support T_DATA objects, you may consider using write barriers.
-
-Inserting write barriers into T_DATA objects only works with the
-following type objects: (a) long-lived objects, (b) when a huge number
-of objects are generated and \(c) container-type objects that have
-references to other objects. If your extension provides such a type of
-T_DATA objects, consider inserting write barriers.
-
-(a): short-lived objects don't become old generation objects.
-(b): only a few oldgen objects don't have performance impact.
-\(c): only a few references don't have performance impact.
-
-Inserting write barriers is a very difficult hack, it is easy to
-introduce critical bugs. And inserting write barriers has several areas
-of overhead. Basically we don't recommend you insert write barriers.
-Please carefully consider the risks.
-
-=== Combine with built-in types
-
-Please consider utilizing built-in types. Most built-in types support
-write barrier, so you can use them to avoid manually inserting write
-barriers.
-
-For example, if your T_DATA has references to other objects, then you
-can move these references to Array. A T_DATA object only has a reference
-to an array object. Or you can also use a Struct object to gather a
-T_DATA object (without any references) and an that Array contains
-references.
-
-With use of such techniques, you don't need to insert write barriers
-anymore.
-
-=== Insert write barriers
-
-\[AGAIN] Inserting write barriers is a very difficult hack, and it is
-easy to introduce critical bugs. And inserting write barriers has
-several areas of overhead. Basically we don't recommend you insert write
-barriers. Please carefully consider the risks.
-
-Before inserting write barriers, you need to know about RGenGC algorithm
-(gc.c will help you). Macros and functions to insert write barriers are
-available in include/ruby/ruby.h. An example is available in iseq.c.
-
-For a complete guide for RGenGC and write barriers, please refer to
-<https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/RGenGC>.
-
-= Appendix E. RB_GC_GUARD to protect from premature GC
-
-C Ruby currently uses conservative garbage collection, thus VALUE
-variables must remain visible on the stack or registers to ensure any
-associated data remains usable. Optimizing C compilers are not designed
-with conservative garbage collection in mind, so they may optimize away
-the original VALUE even if the code depends on data associated with that
-VALUE.
-
-The following example illustrates the use of RB_GC_GUARD to ensure
-the contents of sptr remain valid while the second invocation of
-rb_str_new_cstr is running.
-
- VALUE s, w;
- const char *sptr;
-
- s = rb_str_new_cstr("hello world!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- sptr = RSTRING_PTR(s);
- w = rb_str_new_cstr(sptr + 6); /* Possible GC invocation */
-
- RB_GC_GUARD(s); /* ensure s (and thus sptr) do not get GC-ed */
-
-In the above example, RB_GC_GUARD must be placed _after_ the last use of
-sptr. Placing RB_GC_GUARD before dereferencing sptr would be of no use.
-RB_GC_GUARD is only effective on the VALUE data type, not converted C
-data types.
-
-RB_GC_GUARD would not be necessary at all in the above example if
-non-inlined function calls are made on the `s' VALUE after sptr is
-dereferenced. Thus, in the above example, calling any un-inlined
-function on `s' such as:
-
- rb_str_modify(s);
-
-Will ensure `s' stays on the stack or register to prevent a
-GC invocation from prematurely freeing it.
-
-Using the RB_GC_GUARD macro is preferable to using the "volatile"
-keyword in C. RB_GC_GUARD has the following advantages:
-
-1. the intent of the macro use is clear
-
-2. RB_GC_GUARD only affects its call site, "volatile" generates some
- extra code every time the variable is used, hurting optimization.
-
-3. "volatile" implementations may be buggy/inconsistent in some
- compilers and architectures. RB_GC_GUARD is customizable for broken
- systems/compilers without those without negatively affecting other
- systems.
-
-:enddoc: Local variables:
-:enddoc: fill-column: 70
-:enddoc: end:
diff --git a/doc/forwardable.rd.ja b/doc/forwardable.rd.ja
index 171724b2e5..6a5ff2e236 100644
--- a/doc/forwardable.rd.ja
+++ b/doc/forwardable.rd.ja
@@ -9,8 +9,8 @@
== 使い方
-クラスに対してextendして使います.
-
+クラスに対してextendして使います.
+
class Foo
extend Forwardable
@@ -50,7 +50,7 @@
== 使い方
-オブジェクトに対して((|extend|))して使います.
+オブジェクトに対して((|extend|))して使います.
g = Goo.new
g.extend SingleForwardable
diff --git a/doc/globals.rdoc b/doc/globals.rdoc
index 3bc7e05623..06355b187a 100644
--- a/doc/globals.rdoc
+++ b/doc/globals.rdoc
@@ -31,7 +31,6 @@ $DEBUG:: The debug flag, which is set by the -d switch. Enabling debug
backtrace). Setting this to a true value enables debug output as
if -d were given on the command line. Setting this to a false
value disables debug output.
-$LOADED_FEATURES:: The alias to the $".
$FILENAME:: Current input file from $<. Same as $<.filename.
$LOAD_PATH:: The alias to the $:.
$stderr:: The current standard error output.
@@ -43,7 +42,7 @@ $VERBOSE:: The verbose flag, which is set by the -w or -v switch. Setting
including from Kernel#warn.
$-0:: The alias to $/.
$-a:: True if option -a is set. Read-only variable.
-$-d:: The alias of $DEBUG. See $DEBUG above for further discussion.
+$-d:: The alias of $DEBUG. See $DEBUG above for further discusison.
$-F:: The alias to $;.
$-i:: In in-place-edit mode, this variable holds the extension, otherwise nil.
$-I:: The alias to $:.
diff --git a/doc/irb/irb-tools.rd.ja b/doc/irb/irb-tools.rd.ja
index b997f0edea..3c95faeb8a 100644
--- a/doc/irb/irb-tools.rd.ja
+++ b/doc/irb/irb-tools.rd.ja
@@ -112,7 +112,7 @@ XMPメソッド群のコンテキストは, 呼び出す前のコンテキスト
マルチスレッドには対応していません.
= frame.rb
-現在実行中のフレーム情報を取り扱うためのクラスです.
+現在実行中のフレーム情報を取り扱うためのクラスです.
* IRB::Frame.top(n = 0)
上からn番目のコンテキストを取り出します. nは0が最上位になります.
@@ -127,7 +127,7 @@ set_trace_funcを用いてRubyの実行をトレースしています. マルチ
は対応していません.
= completion.rb
-irbのcompletion機能を提供するものです.
+irbのcompletion機能を提供するものです.
== 使い方
@@ -144,7 +144,7 @@ irb実行中に (TAB) を押すとコンプレーションします.
トップレベルで(TAB)を押すとすべての構文要素, クラス, メソッドの候補がで
ます. 候補が唯一ならば完全に補完します.
- irb(main):001:0> in
+ irb(main):001:0> in
in inspect instance_eval
include install_alias_method instance_of?
initialize install_aliases instance_variables
@@ -168,8 +168,8 @@ irb実行中に (TAB) を押すとコンプレーションします.
foo.dup foo.kind_of? foo.to_s
foo.eql? foo.method foo.type
foo.equal? foo.methods foo.untaint
- foo.extend foo.nil?
- foo.freeze foo.private_methods
+ foo.extend foo.nil?
+ foo.freeze foo.private_methods
=end
diff --git a/doc/keywords.rdoc b/doc/keywords.rdoc
deleted file mode 100644
index 98bbd5e864..0000000000
--- a/doc/keywords.rdoc
+++ /dev/null
@@ -1,158 +0,0 @@
-== Keywords
-
-The following keywords are used by Ruby.
-
-__ENCODING__::
- The script encoding of the current file. See Encoding.
-
-__LINE__::
- The line number of this keyword in the current file.
-
-__FILE__::
- The path to the current file.
-
-BEGIN::
- Runs before any other code in the current file. See {miscellaneous
- syntax}[rdoc-ref:syntax/miscellaneous.rdoc]
-
-END::
- Runs after any other code in the current file. See {miscellaneous
- syntax}[rdoc-ref:syntax/miscellaneous.rdoc]
-
-alias::
- Creates an alias between two methods (and other things). See {modules and
- classes syntax}[rdoc-ref:syntax/modules_and_classes.rdoc]
-
-and::
- Short-circuit Boolean and with lower precedence than <code>&&</code>
-
-begin::
- Starts an exception handling block. See {exceptions
- syntax}[rdoc-ref:syntax/exceptions.rdoc]
-
-break::
- Leaves a block early. See {control expressions
- syntax}[rdoc-ref:syntax/control_expressions.rdoc]
-
-case::
- Starts a +case+ expression. See {control expressions
- syntax}[rdoc-ref:syntax/control_expressions.rdoc]
-
-class::
- Creates or opens a class. See {modules and classes
- syntax}[rdoc-ref:syntax/modules_and_classes.rdoc]
-
-def::
- Defines a method. See {methods syntax}[rdoc-ref:syntax/methods.rdoc]
-
-defined?::
- Returns a string describing its argument. See {miscellaneous
- syntax}[rdoc-ref:syntax/miscellaneous.rdoc]
-
-do::
- Starts a block.
-
-else::
- The unhandled condition in +case+, +if+ and +unless+ expressions. See
- {control expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-elsif::
- An alternate condition for an +if+ expression. See {control
- expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-end::
- The end of a syntax block. Used by classes, modules, methods, exception
- handling and control expressions.
-
-ensure::
- Starts a section of code that is always run when an exception is raised.
- See {exception handling}[rdoc-ref:syntax/exceptions.rdoc]
-
-false::
- Boolean false. See {literals}[rdoc-ref:syntax/literals.rdoc]
-
-for::
- A loop that is similar to using the +each+ method. See {control
- expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-if::
- Used for +if+ and modifier +if+ expressions. See {control
- expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-in::
- Used to separate the iterable object and iterator variable in a +for+ loop.
- See {control expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-module::
- Creates or opens a module. See {modules and classes
- syntax}[rdoc-ref:syntax/modules_and_classes.rdoc]
-
-next::
- Skips the rest of the block. See {control
- expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-nil::
- A false value usually indicating "no value" or "unknown". See
- {literals}[rdoc-ref:syntax/literals.rdoc]
-
-not::
- Inverts the following boolean expression. Has a lower precedence than
- <code>!</code>
-
-or::
- Boolean or with lower precedence than <code>||</code>
-
-redo::
- Restarts execution in the current block. See {control
- expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-rescue::
- Starts an exception section of code in a +begin+ block. See {exception
- handling}[rdoc-ref:syntax/exceptions.rdoc]
-
-retry::
- Retries an exception block. See {exception
- handling}[rdoc-ref:syntax/exceptions.rdoc]
-
-return::
- Exits a method. See {methods}[rdoc-ref:syntax/methods.rdoc]
-
-self::
- The object the current method is attached to. See
- {methods}[rdoc-ref:syntax/methods.rdoc]
-
-super::
- Calls the current method in a superclass. See
- {methods}[rdoc-ref:syntax/methods.rdoc]
-
-then::
- Indicates the end of conditional blocks in control structures. See
- {control expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-true::
- Boolean true. See {literals}[rdoc-ref:syntax/literals.rdoc]
-
-undef::
- Prevents a class or module from responding to a method call.
- See {modules and classes}[rdoc-ref:syntax/modules_and_classes.rdoc]
-
-unless::
- Used for +unless+ and modifier +unless+ expressions. See {control
- expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-until::
- Creates a loop that executes until the condition is true. See
- {control expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-when::
- A condition in a +case+ expression. See
- {control expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-while::
- Creates a loop that executes while the condition is true. See
- {control expressions}[rdoc-ref:syntax/control_expressions.rdoc]
-
-yield::
- Starts execution of the block sent to the current method. See
- {methods}[rdoc-ref:syntax/methods.rdoc]
-
diff --git a/doc/maintainers.rdoc b/doc/maintainers.rdoc
deleted file mode 100644
index d657626e30..0000000000
--- a/doc/maintainers.rdoc
+++ /dev/null
@@ -1,320 +0,0 @@
-= Maintainers
-
-This page describes the current module, library, and extension maintainers of Ruby.
-
-== Module Maintainers
-
-A module maintainer is responsible for a certain part of Ruby.
-
-* The maintainer fixes bugs of the part. Particularly, they should fix security vulnerabilities as soon as possible.
-* They handle issues related the module on the Redmine or ML.
-* They may be discharged by the 3 months rule [ruby-core:25764].
-* They have commit right to Ruby's repository to modify their part in the repository.
-* They have "developer" role on the Redmine to modify issues.
-* They have authority to decide the feature of their part. But they should always respect discussions on ruby-core/ruby-dev.
-
-A submaintainer of a module is like a maintainer. But The submaintainer does
-not have authority to change/add a feature on his/her part. They need consensus
-on ruby-core/ruby-dev before changing/adding. Some of submaintainers have
-commit right, others don't.
-
-=== Language core features including security
-
-Yukihiro Matsumoto (matz)
-
-=== Evaluator
-
-Koichi Sasada (ko1)
-
-=== Core classes
-
-Yukihiro Matsumoto (matz)
-
-=== Documentation
-
-Zachary Scott (zzak)
-
-== Library Maintainers
-
-[lib/English.rb]
- _unmaintained_
-[lib/abbrev.rb]
- Akinori MUSHA (knu)
-[lib/base64.rb]
- * 1.8: _unmaintained_
- * 1.9: Yusuke Endoh (mame)
-[lib/benchmark.rb]
- _unmaintained_
-[lib/cgi.rb, lib/cgi/*]
- Takeyuki Fujioka (xibbar)
-[lib/complex.rb]
- * 1.8: _unmaintained_
- * 1.9: moved into core
-[lib/cmath.rb]
- * 1.8: 1.9 feature
- * 1.9: _unmaintained_
-[lib/csv.rb]
- * 1.8: Hiroshi Nakamura (nahi)
- * 1.9: James Edward Gray II (jeg2)
-[lib/date.rb, lib/date/*]
- Tadayoshi Funaba (tadf)
-[lib/drb.rb, lib/drb/*]
- Masatoshi SEKI (seki)
-[lib/debug.rb]
- _unmaintained_
-[lib/delegate.rb]
- _unmaintained_
-[lib/e2mmap.rb]
- Keiju ISHITSUKA (keiju)
-[lib/erb.rb]
- Masatoshi SEKI (seki)
-[lib/fileutils.rb]
- _unmaintained_
-[lib/find.rb]
- Kazuki Tsujimoto (ktsj)
-[lib/finalize.rb]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/forwardable.rb]
- Keiju ISHITSUKA (keiju)
-[lib/ftools.rb]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/generator.rb]
- * 1.8: Akinori MUSHA (knu)
- * 1.9: moved into core
-[lib/getoptlong.rb]
- _unmaintained_
-[lib/getopts.rb]
- * 1.8: Akinori MUSHA (knu)
- * 1.9: _deprecated_
-[lib/gserver.rb]
- James Edward Gray II (jeg2)
-[lib/ipaddr.rb]
- Akinori MUSHA (knu)
-[lib/irb.rb, lib/irb/*]
- Keiju ISHITSUKA (keiju)
-[lib/jcode.rb]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/logger.rb]
- Naotoshi Seo (sonots)
-[lib/mathn.rb]
- Keiju ISHITSUKA (keiju)
-[lib/matrix.rb]
- Marc-Andre Lafortune (marcandre)
-[lib/minitest/*]
- * 1.8: 1.9 feature
- * 1.9: Ryan Davis (ryan)
-[lib/mkmf.rb]
- _unmaintained_
-[lib/monitor.rb]
- Shugo Maeda (shugo)
-[lib/mutex_m.rb]
- Keiju ISHITSUKA (keiju)
-[lib/net/ftp.rb]
- Shugo Maeda (shugo)
-[lib/net/imap.rb]
- Shugo Maeda (shugo)
-[lib/net/http.rb, lib/net/https]
- NARUSE, Yui (naruse)
-[lib/net/pop.rb]
- _unmaintained_
-[lib/net/smtp.rb]
- _unmaintained_
-[lib/observer.rb]
- _unmaintained_
-[lib/open-uri.rb]
- Tanaka Akira (akr)
-[lib/open3.rb]
- _unmaintained_
-[lib/optparse.rb, lib/optparse/*]
- Nobuyuki Nakada (nobu)
-[lib/ostruct.rb]
- Marc-Andre Lafortune (marcandre)
-[lib/parsearg.rb]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/parsedate.rb]
- * 1.8: Tadayoshi Funaba (tadf)
- * 1.9: _deprecated_
-[lib/pathname.rb]
- Tanaka Akira (akr)
-[lib/ping.rb]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/pp.rb]
- Tanaka Akira (akr)
-[lib/prettyprint.rb]
- Tanaka Akira (akr)
-[lib/prime.rb]
- Yuki Sonoda (yugui)
-[lib/profile.rb]
- _unmaintained_
-[lib/profiler.rb]
- _unmaintained_
-[lib/pstore.rb]
- _unmaintained_
-[lib/racc/*]
- Aaron Patterson (tenderlove)
-[lib/rake/*]
- Eric Hodel (drbrain)
-[lib/rational.rb]
- * 1.8: _unmaintained_
- * 1.9: moved into core
-[lib/rdoc/*]
- Eric Hodel (drbrain)
-[lib/readbytes.rb]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/resolv-replace.rb]
- Tanaka Akira (akr)
-[lib/resolv.rb]
- Tanaka Akira (akr)
-[lib/rexml/*]
- Kouhei Sutou (kou)
-[lib/rinda/*]
- Masatoshi SEKI (seki)
-[lib/rss/*]
- Kouhei Sutou (kou)
-[lib/rubygems.rb, lib/ubygems.rb, lib/rubygems/*]
- * 1.8: 1.9 feature
- * 1.9: Eric Hodel (drbrain)
-[lib/rubyunit.rb, lib/runit/*]
- * 1.8: _unmaintained_
- * 1.9: _deprecated_
-[lib/scanf.rb]
- David A. Black (dblack)
-[lib/set.rb]
- Akinori MUSHA (knu)
-[lib/securerandom.rb]
- Tanaka Akira (akr)
-[lib/shell.rb, lib/shell/*]
- Keiju ISHITSUKA (keiju)
-[lib/shellwords.rb]
- Akinori MUSHA (knu)
-[lib/singleton.rb]
- Yukihiro Matsumoto (matz)
-[lib/{soap|wsdl|xsd}/*]
- * 1.8: Hiroshi Nakamura (nahi)
- * 1.9: _deprecated_
-[lib/sync.rb]
- Keiju ISHITSUKA (keiju)
-[lib/tempfile.rb]
- _unmaintained_
-[lib/test/*]
- Shota Fukumori (sorah)
-[lib/tmpdir.rb]
- _unmaintained_
-[lib/thread.rb]
- _unmaintained_
-[lib/thwait.rb]
- Keiju ISHITSUKA (keiju)
-[lib/time.rb]
- Tanaka Akira (akr)
-[lib/timeout.rb]
- Yukihiro Matsumoto (matz)
-[lib/tracer.rb]
- Keiju ISHITSUKA (keiju)
-[lib/tsort.rb]
- Tanaka Akira (akr)
-[lib/un.rb]
- WATANABE Hirofumi (eban)
-[lib/uri.rb, lib/uri/*]
- YAMADA, Akira (akira)
-[lib/weakref.rb]
- _unmaintained_
-[lib/webrick.rb, lib/webrick/*]
- Hiroshi Nakamura (nahi)
-[lib/xmlrpc/*]
- Kouhei Sutou (kou)
-[lib/yaml.rb, lib/yaml/*]
- Aaron Patterson (tenderlove)
-
-== Extension Maintainers
-
-[ext/Win32API]
- * 1.8: _unmaintained_
- * 1.9: merged into dl
-[ext/bigdecimal]
- Kenta Murata (mrkn)
-[ext/continuation]
- * 1.8: 1.9 feature
- * 1.9: Koichi Sasada (ko1)
-[ext/coverage]
- Yusuke Endoh (mame)
-[ext/dbm]
- _unmaintained_
-[ext/digest, ext/digest/*]
- Akinori MUSHA (knu)
-[ext/dl]
- Aaron Patterson (tenderlove)
-[ext/dl/win32]
- NAKAMURA Usaku (usa)
-[ext/enumerator]
- * 1.8: Akinori MUSHA (knu)
- * 1.9: moved into core
-[ext/etc]
- _unmaintained_
-[ext/fcntl]
- _unmaintained_
-[ext/fiber]
- * 1.8: 1.9 feature
- * 1.9: Koichi Sasada (ko1)
-[ext/fiddle]
- Aaron Patterson (tenderlove)
-[ext/gdbm]
- Yukihiro Matsumoto (matz)
-[ext/iconv]
- Nobuyuki Nakada (nobu)
-[ext/io/wait]
- Nobuyuki Nakada (nobu)
-[ext/json]
- NARUSE, Yui (naruse)
-[ext/mathn/complex]
- * 1.8: 1.9 feature
- * 1.9: Keiju ISHITSUKA (keiju)
-[ext/mathn/rational]
- * 1.8: 1.9 feature
- * 1.9: Keiju ISHITSUKA (keiju)
-[ext/nkf]
- NARUSE, Yui (narse)
-[ext/objspace]
- _unmaintained_
-[ext/openssl]
- Martin Boßlet (emboss)
-[ext/psych]
- Aaron Patterson (tenderlove)
-[ext/pty]
- _unmaintained_
-[ext/racc]
- Aaron Patterson (tenderlove)
-[ext/readline]
- TAKAO Kouji (kouji)
-[ext/ripper]
- _unmaintained_
-[ext/sdbm]
- Yukihiro Matsumoto (matz)
-[ext/socket]
- * Tanaka Akira (akr)
- * API change needs matz's approval
-[ext/stringio]
- Nobuyuki Nakada (nobu)
-[ext/strscan]
- _unmaintained_
-[ext/syck]
- _unmaintained_
-[ext/syslog]
- Akinori MUSHA (knu)
-[ext/thread]
- * 1.8: _unmaintained_
- * 1.9: 1.8 feature
-[ext/tcltklib]
- _deprecated_
-[ext/tk]
- Hidetoshi NAGAI (nagai)
-[ext/win32ole]
- Masaki Suketa (suke)
-[ext/zlib]
- _unmaintained_
-
diff --git a/doc/pty/README.ja b/doc/pty/README.ja
index 2d83ffa033..9b9d306bf7 100644
--- a/doc/pty/README.ja
+++ b/doc/pty/README.ja
@@ -34,7 +34,7 @@ pty 拡張モジュール version 0.3 by A.ito
数がブロックパラメータ付きで呼ばれた場合には,そのブロックの中で
のみ例外が発生します.子プロセスをモニターしているスレッドはブロッ
クを抜けるときに終了します.
-
+
protect_signal
reset_signal
diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc
index 7384670557..3c13b6683f 100644
--- a/doc/regexp.rdoc
+++ b/doc/regexp.rdoc
@@ -128,8 +128,8 @@ The following metacharacters also behave like character classes:
* <tt>/\D/</tt> - A non-digit character (<tt>[^0-9]</tt>)
* <tt>/\h/</tt> - A hexdigit character (<tt>[0-9a-fA-F]</tt>)
* <tt>/\H/</tt> - A non-hexdigit character (<tt>[^0-9a-fA-F]</tt>)
-* <tt>/\s/</tt> - A whitespace character: <tt>/[ \t\r\n\f\v]/</tt>
-* <tt>/\S/</tt> - A non-whitespace character: <tt>/[^ \t\r\n\f\v]/</tt>
+* <tt>/\s/</tt> - A whitespace character: <tt>/[ \t\r\n\f]/</tt>
+* <tt>/\S/</tt> - A non-whitespace character: <tt>/[^ \t\r\n\f]/</tt>
POSIX <i>bracket expressions</i> are also similar to character classes.
They provide a portable alternative to the above, with the added benefit
@@ -545,7 +545,7 @@ Options may also be used with <tt>Regexp.new</tt>:
As mentioned above, the <tt>x</tt> option enables <i>free-spacing</i>
mode. Literal white space inside the pattern is ignored, and the
octothorpe (<tt>#</tt>) character introduces a comment until the end of
-the line. This allows the components of the pattern to be organized in a
+the line. This allows the components of the pattern to be organised in a
potentially more readable fashion.
A contrived pattern to match a number with optional decimal places:
@@ -558,19 +558,13 @@ A contrived pattern to match a number with optional decimal places:
\Z/x
float_pat.match('3.14') #=> #<MatchData "3.14" 1:".14">
-There are a number of strategies for matching whitespace:
-
-* Use a pattern such as <tt>\s</tt> or <tt>\p{Space}</tt>.
-* Use escaped whitespace such as <tt>\ </tt>, i.e. a space preceded by a backslash.
-* Use a character class such as <tt>[ ]</tt>.
+*Note*: To match whitespace in an <tt>x</tt> pattern use an escape such as
+<tt>\s</tt> or <tt>\p{Space}</tt>.
Comments can be included in a non-<tt>x</tt> pattern with the
<tt>(?#</tt><i>comment</i><tt>)</tt> construct, where <i>comment</i> is
arbitrary text ignored by the regexp engine.
-Comments in regexp literals cannot include unescaped terminator
-characters.
-
== Encoding
Regular expressions are assumed to use the source encoding. This can be
diff --git a/doc/security.rdoc b/doc/security.rdoc
index 378699fb15..d8efca0042 100644
--- a/doc/security.rdoc
+++ b/doc/security.rdoc
@@ -66,28 +66,20 @@ method, variable and constant names. The reason for this is that symbols are
simply integers with names attached to them, so they are faster to look up in
hashtables.
-Starting in version 2.2, most symbols can be garbage collected; these are
-called <i>mortal</i> symbols. Most symbols you create (e.g. by calling
-+to_sym+) are mortal.
-
-<i>Immortal</i> symbols on the other hand will never be garbage collected.
-They are created when modifying code:
-* defining a method (e.g. with +define_method+),
-* setting an instance variable (e.g. with +instance_variable_set+),
-* creating a variable or constant (e.g. with +const_set+)
-C extensions that have not been updated and are still calling `SYM2ID`
-will create immortal symbols.
-Bugs in 2.2.0: +send+ and +__send__+ also created immortal symbols,
-and calling methods with keyword arguments could also create some.
-
-Don't create immortal symbols from user inputs. Otherwise, this would
-allow a user to mount a denial of service attack against your application by
-flooding it with unique strings, which will cause memory to grow indefinitely
-until the Ruby process is killed or causes the system to slow to a halt.
-
-While it might not be a good idea to call these with user inputs, methods that
-used to be vulnerable such as +to_sym+, +respond_to?+,
-+method+, +instance_variable_get+, +const_get+, etc. are no longer a threat.
+Once a symbol is created, the memory used by it is never freed. If you convert
+user input to symbols with +to_sym+ or +intern+, it is possible for an attacker
+to mount a denial of service attack against your application by flooding it
+with unique strings. Because each string is kept in memory until the Ruby
+process exits, this will cause memory consumption to grow and grow until Ruby
+runs out of memory and crashes.
+
+Be careful with passing user input to methods such as +send+,
++instance_variable_get+ or +_set+, +const_get+ or +_set+, etc. as these methods
+will convert string parameters to symbols internally and pose the same DoS
+potential as direct conversion through +to_sym+/+intern+.
+
+The workaround to this is simple - don't convert user input to symbols. You
+should attempt to leave user input in string form instead.
== Regular expressions
diff --git a/doc/shell.rd.ja b/doc/shell.rd.ja
index a9507fe92a..053b11fb99 100644
--- a/doc/shell.rd.ja
+++ b/doc/shell.rd.ja
@@ -47,7 +47,7 @@ OS上のコマンドを実行するにはまず, Shellのメソッドとして
--- Shell.def_system_command(command, path = command)
- Shellのメソッドとしてcommandを登録します.
+ Shellのメソッドとしてcommandを登録します.
例)
Shell.def_system_command "ls"
@@ -62,7 +62,7 @@ OS上のコマンドを実行するにはまず, Shellのメソッドとして
--- Shell.alias_command(ali, command, *opts) {...}
- commandのaliasをします.
+ commandのaliasをします.
例)
Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
@@ -139,7 +139,7 @@ OS上のコマンドを実行するにはまず, Shellのメソッドとして
--- Shell#test(command, file1, file2)
--- Shell#[command, file1, file2]
- ファイルテスト関数testと同じ.
+ ファイルテスト関数testと同じ.
例)
sh[?e, "foo"]
sh[:e, "foo"]
@@ -185,7 +185,7 @@ OS上のコマンドを実行するにはまず, Shellのメソッドとして
--- Shell#glob(patten)
--- Shell#tee(file)
- これらは実行すると, それらを内容とするFilterオブジェクトを返します.
+ これらは実行すると, それらを内容とするFilterオブジェクトを返します.
--- Filter#each &block
diff --git a/doc/standard_library.rdoc b/doc/standard_library.rdoc
index bd15c2ea9a..e94727f913 100644
--- a/doc/standard_library.rdoc
+++ b/doc/standard_library.rdoc
@@ -13,6 +13,7 @@ Base64:: Support for encoding and decoding binary data using a Base64 representa
Benchmark:: Provides methods to measure and report the time used to execute code
CGI:: Support for the Common Gateway Interface protocol
CMath:: Provides Trigonometric and Transcendental functions for complex numbers
+complex.rb:: Deprecated library replaced by C implementation in core
ConditionVariable:: Augments the Mutex class, provided by thread.rb
CSV:: Provides an interface to read and write CSV files and data
DEBUGGER__:: Debugging functionality for Ruby
@@ -25,12 +26,14 @@ FileUtils:: Several file utility methods for copying, moving, removing, etc
Find:: This module supports top-down traversal of a set of file paths
Forwardable:: Provides delegation of specified methods to a designated object
GetoptLong:: Parse command line options similar to the GNU C getopt_long()
+GServer:: HTTP server with logging, thread pooling and multi-server management
IPAddr:: Provides methods to manipulate IPv4 and IPv6 IP addresses
IRB:: Interactive Ruby command-line tool for REPL (Read Eval Print Loop)
Logger:: Provides a simple logging utility for outputing messages
mathn.rb:: Deprecated library that extends math operations
MakeMakefile:: Module used to generate a Makefile for C extensions
Matrix:: Represents a mathematical matrix.
+MiniTest:: A test suite with TDD, BDD, mocking and benchmarking
Monitor:: Provides an object or module to use safely by more than one thread
Mutex_m:: Mixin to extend objects to be handled like a Mutex
Net::FTP:: Support for the File Transfer Protocol
@@ -53,6 +56,7 @@ PStore:: Implements a file based persistence mechanism based on a Hash
Queue:: Synchronized communication between threads, provided by thread.rb
Racc:: A LALR(1) parser generator written in Ruby.
Rake:: Ruby build program with capabilities similar to make
+rational.rb:: Deprecated library replaced by C implementation in core
RbConfig:: Information of your configure and build of Ruby
RDoc:: Produces HTML and command-line documentation for Ruby
resolv-replace.rb:: Replace Socket DNS with Resolv
@@ -69,6 +73,8 @@ Shellwords:: Manipulates strings with word parsing rules of UNIX Bourne shell
Singleton:: Implementation of the Singleton pattern for Ruby
Synchronizer:: A module that provides a two-phase lock with a counter
Tempfile:: A utility class for managing temporary files
+Test::Unit:: A compatibility layer for MiniTest
+Thread:: Provides support classes for threaded programs
ThreadsWait:: Watches for termination of multiple threads
Time:: Extends the Time class with methods for parsing and conversion
Timeout:: Auto-terminate potentially long-running operations in Ruby
@@ -86,10 +92,12 @@ YAML:: Ruby client library for the Psych YAML implementation
BigDecimal:: Provides arbitrary-precision floating point decimal arithmetic
Coverage:: Provides coverage measurement for Ruby
+Curses:: Implements the CRT screen handling and optimization library
Date:: A subclass of Object includes Comparable module for handling dates
DateTime:: Subclass of Date to handling dates, hours, minutes, seconds, offsets
DBM:: Provides a wrapper for the UNIX-style Database Manager Library
Digest:: Provides a framework for message digest libraries
+DL:: Provides a wrapper for the UNIX dlopen() library
Etc:: Provides access to information typically stored in UNIX /etc directory
Fcntl:: Loads constants defined in the OS fcntl.h C header file
Fiddle:: A libffi wrapper for Ruby
@@ -109,7 +117,10 @@ Socket:: Access underlying OS socket implementations
StringIO:: Pseudo I/O on String objects
StringScanner:: Provides lexical scanning operations on a String
Syslog:: Ruby interface for the POSIX system logging facility
-Thread:: Provides support classes for threaded programs
Tk:: Provides a framework for building a Graphical User Interface (GUI)
WIN32OLE:: Provides an interface for OLE Automation in Ruby
Zlib:: Ruby interface for the zlib compression/decompression library
+
+
+
+
diff --git a/doc/syntax/assignment.rdoc b/doc/syntax/assignment.rdoc
index 83300cbece..7424d4885f 100644
--- a/doc/syntax/assignment.rdoc
+++ b/doc/syntax/assignment.rdoc
@@ -1,6 +1,6 @@
= Assignment
-In Ruby, assignment uses the <code>=</code> (equals sign) character. This
+In Ruby assignment uses the <code>=</code> (equals sign) character. This
example assigns the number five to the local variable +v+:
v = 5
@@ -137,7 +137,7 @@ Here is an example of instance variable usage:
p object2.value # prints "other value"
An uninitialized instance variable has a value of +nil+. If you run Ruby with
-warnings enabled, you will get a warning when accessing an uninitialized
+warnings enabled you will get a warning when accessing an uninitialized
instance variable.
The +value+ method has access to the value set by the +initialize+ method, but
@@ -279,7 +279,7 @@ to an instance variable most people use Module#attr_accessor:
end
When using method assignment you must always have a receiver. If you do not
-have a receiver, Ruby assumes you are assigning to a local variable:
+have a receiver Ruby assumes you are assigning to a local variable:
class C
attr_accessor :value
@@ -354,7 +354,7 @@ Here is an example:
p a # prints 1
-Note that these two operators behave more like <code>a || a = 0</code> than
+Note that these two operators behave more like <code>a || a = 0<code> than
<code>a = a || 0</code>.
== Implicit Array Assignment
@@ -374,7 +374,7 @@ assigning. This is similar to multiple assignment:
p a # prints [1, 2, 3]
-You can splat anywhere in the right-hand side of the assignment:
+You can splat anywhere in the left-hand side of the assignment:
a = 1, *[2, 3]
@@ -382,7 +382,7 @@ You can splat anywhere in the right-hand side of the assignment:
== Multiple Assignment
-You can assign multiple values on the right-hand side to multiple variables:
+You can assign multiple values on the left-hand side to multiple variables:
a, b = 1, 2
@@ -408,8 +408,8 @@ You can use multiple assignment to swap two values in-place:
p new_value: new_value, old_value: old_value
# prints {:new_value=>1, :old_value=>2}
-If you have more values on the right hand side of the assignment than variables
-on the left hand side, the extra values are ignored:
+If you have more values on the left hand side of the assignment than variables
+on the right hand side the extra values are ignored:
a, b = 1, 2, 3
@@ -422,7 +422,7 @@ the assignment.
p a: a, b: b # prints {:a=>1, :b=>[2, 3]}
-The <code>*</code> can appear anywhere on the left-hand side:
+The <code>*</code> can appear anywhere on the right-hand side:
*a, b = 1, 2, 3
@@ -452,3 +452,4 @@ Since each decomposition is considered its own multiple assignment you can use
p a: a, b: b, c: c, d: d
# prints {:a=>1, :b=>2, :c=>[3, 4], :d=>[5, 6]}
+
diff --git a/doc/syntax/calling_methods.rdoc b/doc/syntax/calling_methods.rdoc
index ec86ef05ee..79c0de59dc 100644
--- a/doc/syntax/calling_methods.rdoc
+++ b/doc/syntax/calling_methods.rdoc
@@ -27,10 +27,6 @@ This sends the +my_method+ message to +my_object+. Any object can be a
receiver but depending on the method's visibility sending a message may raise a
NoMethodError.
-You may use <code>&.</code> to designate a receiver, then +my_method+ is not
-invoked and the result is +nil+ when the receiver is +nil+. In that case, the
-arguments of +my_method+ are not evaluated.
-
You may also use <code>::</code> to designate a receiver, but this is rarely
used due to the potential for confusion with <code>::</code> for namespaces.
@@ -66,7 +62,7 @@ The positional arguments for the message follow the method name:
my_method(argument1, argument2)
-In many cases, parenthesis are not necessary when sending a message:
+In many cases parenthesis are not necessary when sending a message:
my_method argument1, argument2
@@ -88,7 +84,7 @@ hash-type arguments are assigned as a single hash to the last argument:
my_method('a' => 1, b: 2) # prints: {'a'=>1, :b=>2}
-If too many positional arguments are given, an ArgumentError is raised.
+If too many positional arguments are given an ArgumentError is raised.
=== Default Positional Arguments
@@ -250,8 +246,8 @@ Both are equivalent to:
my_method(1, 2, 3)
-If the method accepts keyword arguments, the splat operator will convert a
-hash at the end of the array into keyword arguments:
+If the method accepts keyword arguments the splat operator will convert a hash
+at the end of the array into keyword arguments:
def my_method(a, b, c: 3)
end
@@ -263,7 +259,7 @@ You may also use the <code>**</code> (described next) to convert a Hash into
keyword arguments.
If the number of objects in the Array do not match the number of arguments for
-the method, an ArgumentError will be raised.
+the method an ArgumentError will be raised.
If the splat operator comes first in the call, parentheses must be used to
avoid a warning.
@@ -290,7 +286,7 @@ Both are equivalent to:
my_method(first: 3, second: 4, third: 5)
If the method definition uses <code>**</code> to gather arbitrary keyword
-arguments, they will not be gathered by <code>*</code>:
+arguments they will not be gathered by <code>*</code>:
def my_method(*a, **kw)
p arguments: a, keywords: kw
@@ -300,9 +296,9 @@ arguments, they will not be gathered by <code>*</code>:
Prints:
- {:arguments=>[1, 2, {"3"=>4}], :keywords=>{:five=>6}}
+ {:arguments=>[1, 2], :keywords=>{"3"=>4, :five=>6}}
-Unlike the splat operator described above, the <code>**</code> operator has no
+Unlike the splat operator described above the <code>**</code> operator has no
commonly recognized name.
=== Proc to Block Conversion
@@ -323,12 +319,12 @@ operator:
If the splat operator comes first in the call, parenthesis must be used to
avoid a warning.
-Unlike the splat operator described above, the <code>&</code> operator has no
+Unlike the splat operator described above the <code>&</code> operator has no
commonly recognized name.
== Method Lookup
-When you send a message, Ruby looks up the method that matches the name of the
+When you send a message Ruby looks up the method that matches the name of the
message for the receiver. Methods are stored in classes and modules so method
lookup walks these, not the objects themselves.
@@ -347,6 +343,7 @@ If no match is found this repeats from the beginning, but looking for
+method_missing+. The default +method_missing+ is BasicObject#method_missing
which raises a NameError when invoked.
-If refinements (an experimental feature) are active, the method lookup changes.
+If refinements (an experimental feature) are active the method lookup changes.
See the {refinements documentation}[rdoc-ref:syntax/refinements.rdoc] for
details.
+
diff --git a/doc/syntax/control_expressions.rdoc b/doc/syntax/control_expressions.rdoc
index 123b48b6b9..0efc1668ad 100644
--- a/doc/syntax/control_expressions.rdoc
+++ b/doc/syntax/control_expressions.rdoc
@@ -110,7 +110,7 @@ expression as this can be confusing.
== +unless+ Expression
The +unless+ expression is the opposite of the +if+ expression. If the value
-is false, the "then" expression is executed:
+is false the "then" expression is executed:
unless true
puts "the value is a false-value"
@@ -204,10 +204,10 @@ Here is an example of using +case+ to compare a String against a pattern:
Here the string <code>"12345"</code> is compared with <code>/^1/</code> by
calling <code>/^1/ === "12345"</code> which returns +true+. Like the +if+
-expression, the first +when+ that matches is executed and all other matches are
+expression the first +when+ that matches is executed and all other matches are
ignored.
-If no matches are found, the +else+ is executed.
+If no matches are found the +else+ is executed.
The +else+ and +then+ are optional, this +case+ expression gives the same
result as the one above:
@@ -300,9 +300,9 @@ This prints the numbers 0 through 11. Like a while loop the condition <code>a
> 10</code> is checked when entering the loop and each time the loop body
executes. If the condition is false the loop will continue to execute.
-Like a +while+ loop, the +do+ is optional.
+Like a +while+ loop the +do+ is optional.
-Like a +while+ loop, the result of an +until+ loop is nil unless +break+ is
+Like a +while+ loop the result of an +until+ loop is nil unless +break+ is
used.
== +for+ Loop
@@ -356,7 +356,7 @@ before the condition:
p a # prints 10
-If you don't use +rescue+ or +ensure+, Ruby optimizes away any exception
+If you don't use +rescue+ or +ensure+ Ruby optimizes away any exception
handling overhead.
== +break+ Statement
@@ -434,14 +434,14 @@ Use +redo+ to redo the current iteration:
This prints [0, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11]
-In Ruby 1.8, you could also use +retry+ where you used +redo+. This is no
+In Ruby 1.8 you could also use +retry+ where you used +redo+. This is no
longer true, now you will receive a SyntaxError when you use +retry+ outside
of a +rescue+ block. See {Exceptions}[rdoc-ref:syntax/exceptions.rdoc]
for proper usage of +retry+.
== Flip-Flop
-The flip-flop is a rarely seen conditional expression. It's primary use is
+The flip-flop is rarely seen conditional expression. It's primary use is
for processing text from ruby one-line programs used with <code>ruby -n</code>
or <code>ruby -p</code>.
@@ -461,14 +461,14 @@ Here is an example:
p selected # prints [2, 3, 4, 5, 6, 7, 8]
-In the above example, the on condition is <code>n==2</code>. The flip-flop
+In the above example the on condition is <code>n==2</code>. The flip-flop
is initially off (false) for 0 and 1, but becomes on (true) for 2 and remains
on through 8. After 8 it turns off and remains off for 9 and 10.
The flip-flop must be used inside a conditional such as +if+, +while+,
+unless+, +until+ etc. including the modifier forms.
-When you use an inclusive range (<code>..</code>), the off condition is
+When you use an inclusive range (<code>..</code>) the off condition is
evaluated when the on condition changes:
selected = []
@@ -479,11 +479,11 @@ evaluated when the on condition changes:
p selected # prints [2]
-Here, both sides of the flip-flop are evaluated so the flip-flop turns on and
+Here both sides of the flip-flop are evaluated so the flip-flop turns on and
off only when +value+ equals 2. Since the flip-flop turned on in the
iteration it returns true.
-When you use an exclusive range (<code>...</code>), the off condition is
+When you use an exclusive range (<code>...</code>) the off condition is
evaluated on the following iteration:
selected = []
@@ -494,6 +494,7 @@ evaluated on the following iteration:
p selected # prints [2, 3, 4, 5]
-Here, the flip-flop turns on when +value+ equals 2, but doesn't turn off on the
+Here the flip-flop turns on when +value+ equals 2 but doesn't turn off on the
same iteration. The off condition isn't evaluated until the following
iteration and +value+ will never be two again.
+
diff --git a/doc/syntax/exceptions.rdoc b/doc/syntax/exceptions.rdoc
index a2e75616fb..0efc35a59f 100644
--- a/doc/syntax/exceptions.rdoc
+++ b/doc/syntax/exceptions.rdoc
@@ -8,7 +8,7 @@ Exceptions are rescued in a +begin+/+end+ block:
# handle exception
end
-If you are inside a method, you do not need to use +begin+ or +end+ unless you
+If you are inside a method you do not need to use +begin+ or +end+ unless you
wish to limit the scope of rescued exceptions:
def my_method
@@ -29,7 +29,7 @@ variable_name</tt> at the end of the +rescue+ line:
raise # re-raise the current exception
end
-By default, StandardError and its subclasses are rescued. You can rescue a
+By default StandardError and its subclasses are rescued. You can rescue a
specific set of exception classes (and their subclasses) by listing them after
+rescue+:
@@ -52,7 +52,7 @@ You may rescue different types of exceptions in different ways:
end
The exception is matched to the rescue section starting at the top, and matches
-only once. If an ArgumentError is raised in the begin section, it will not be
+only once. If an ArgumentError is raised in the begin section it will not be
handled in the StandardError section.
You may retry rescued exceptions:
@@ -93,3 +93,4 @@ You may also run some code when an exception is not raised:
ensure
# ...
end
+
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
index b8ed7f7c54..e01b6875d4 100644
--- a/doc/syntax/literals.rdoc
+++ b/doc/syntax/literals.rdoc
@@ -83,33 +83,8 @@ Any internal <tt>"</tt> must be escaped:
"This string has a quote: \". As you can see, it is escaped"
-Double-quote strings allow escaped characters such as <tt>\n</tt> for
-newline, <tt>\t</tt> for tab, etc. The full list of supported escape
-sequences are as follows:
-
- \a bell, ASCII 07h (BEL)
- \b backspace, ASCII 08h (BS)
- \t horizontal tab, ASCII 09h (TAB)
- \n newline (line feed), ASCII 0Ah (LF)
- \v vertical tab, ASCII 0Bh (VT)
- \f form feed, ASCII 0Ch (FF)
- \r carriage return, ASCII 0Dh (CR)
- \e escape, ASCII 1Bh (ESC)
- \s space, ASCII 20h (SPC)
- \\ backslash, \
- \nnn octal bit pattern, where nnn is 1-3 octal digits ([0-7])
- \xnn hexadecimal bit pattern, where nn is 1-2 hexadecimal digits ([0-9a-fA-F])
- \unnnn Unicode character, where nnnn is exactly 4 hexadecimal digits ([0-9a-fA-F])
- \u{nnnn ...} Unicode character(s), where each nnnn is 1-6 hexadecimal digits ([0-9a-fA-F])
- \cx or \C-x control character, where x is an ASCII printable character
- \M-x meta character, where x is an ASCII printable character
- \M-\C-x meta control character, where x is an ASCII printable character
- \M-\cx same as above
- \c\M-x same as above
- \c? or \C-? delete, ASCII 7Fh (DEL)
-
-Any other character following a backslash is interpreted as the
-character itself.
+Double-quote strings allow escaped characters such as <tt>\n</tt> for newline,
+<tt>\t</tt> for tab, etc.
Double-quote strings allow interpolation of other values using
<tt>#{...}</tt>:
@@ -125,15 +100,14 @@ single-quote strings:
'#{1 + 1}' #=> "\#{1 + 1}"
In addition to disabling interpolation, single-quoted strings also disable all
-escape sequences except for the single-quote (<tt>\'</tt>) and backslash
-(<tt>\\\\</tt>).
+escape sequences except for the single-quote (<tt>\'</tt>).
You may also create strings using <tt>%</tt>:
%(1 + 1 is #{1 + 1}) #=> "1 + 1 is 2"
There are two different types of <tt>%</tt> strings <tt>%q(...)</tt> behaves
-like a single-quote string (no interpolation or character escaping), while
+like a single-quote string (no interpolation or character escaping) while
<tt>%Q</tt> behaves as a double-quote string. See Percent Strings below for
more discussion of the syntax of percent strings.
@@ -149,23 +123,6 @@ be concatenated as long as a percent-string is not last.
%q{a} 'b' "c" #=> "abc"
"a" 'b' %q{c} #=> NameError: uninitialized constant q
-There is also a character literal notation to represent single
-character strings, which syntax is a question mark (<tt>?</tt>)
-followed by a single character or escape sequence that corresponds to
-a single codepoint in the script encoding:
-
- ?a #=> "a"
- ?abc #=> SyntaxError
- ?\n #=> "\n"
- ?\s #=> " "
- ?\\ #=> "\\"
- ?\u{41} #=> "A"
- ?\C-a #=> "\x01"
- ?\M-a #=> "\xE1"
- ?\M-\C-a #=> "\x81"
- ?\C-\M-a #=> "\x81", same as above
- ?あ #=> "あ"
-
=== Here Documents
If you are writing a large block of text you may use a "here document" or
@@ -196,20 +153,6 @@ Note that the while the closing identifier may be indented, the content is
always treated as if it is flush left. If you indent the content those spaces
will appear in the output.
-To have indented content as well as an indented closing identifier, you can use
-a "squiggly" heredoc, which uses a "~" instead of a "-" after <tt><<</tt>:
-
- expected_result = <<~SQUIGGLY_HEREDOC
- This would contain specially formatted text.
-
- That might span many lines
- SQUIGGLY_HEREDOC
-
-The indentation of the least-indented line will be removed from each line of
-the content. Note that empty lines and lines consisting solely of literal tabs
-and spaces will be ignored for the purposes of determining indentation, but
-escaped tabs and spaces are considered non-indentation characters.
-
A heredoc allows interpolation and escaped characters. You may disable
interpolation and escaping by surrounding the opening identifier with single
quotes:
@@ -255,11 +198,14 @@ You may also create symbols by interpolation:
:"my_symbol1"
:"my_symbol#{1 + 1}"
+Note that symbols are never garbage collected so be careful when referencing
+symbols using interpolation.
+
Like strings, a single-quote may be used to disable interpolation:
:'my_symbol#{1 + 1}' #=> :"my_symbol\#{1 + 1}"
-When creating a Hash, there is a special syntax for referencing a Symbol as
+When creating a Hash there is a special syntax for referencing a Symbol as
well.
== Arrays
@@ -289,14 +235,6 @@ You can create a hash using symbol keys with the following syntax:
This same syntax is used for keyword arguments for a method.
-Like Symbol literals, you can quote symbol keys.
-
- { "a 1": 1, "b #{1 + 1}": 2 }
-
-is equal to
-
- { :"a 1" => 1, :"b 2" => 2 }
-
See Hash for the methods you may use with a hash.
== Ranges
@@ -344,7 +282,7 @@ This proc will add one to its argument.
== Percent Strings
-Besides <tt>%(...)</tt> which creates a String, the <tt>%</tt> may create
+Besides <tt>%(...)</tt> which creates a String, The <tt>%</tt> may create
other types of object. As with strings, an uppercase letter allows
interpolation and escaped characters while a lowercase letter disables them.
@@ -366,3 +304,4 @@ one of the array entries you must escape it with a "\\" character:
If you are using "(", "[", "{", "<" you must close it with ")", "]", "}", ">"
respectively. You may use most other non-alphanumeric characters for percent
string delimiters such as "%", "|", "^", etc.
+
diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc
index 0ee2a08367..7fd69983f3 100644
--- a/doc/syntax/methods.rdoc
+++ b/doc/syntax/methods.rdoc
@@ -8,8 +8,8 @@ definition:
end
A method definition consists of the +def+ keyword, a method name, the body of
-the method, +return+ value and the +end+ keyword. When called the method will
-execute the body of the method. This method returns +2+.
+the method, then the +end+ keyword. When called the method will execute the
+body of the method. This method returns +2+.
This section only covers defining methods. See also the {syntax documentation
on calling methods}[rdoc-ref:syntax/calling_methods.rdoc].
@@ -17,53 +17,30 @@ on calling methods}[rdoc-ref:syntax/calling_methods.rdoc].
== Method Names
Method names may be one of the operators or must start a letter or a character
-with the eight bit set. It may contain letters, numbers, an <code>_</code>
-(underscore or low line) or a character with the eight bit set. The convention
-is to use underscores to separate words in a multiword method name:
+with the eight bit set. Typically method names are US-ASCII compatible since
+the keys to type them exist on all keyboards.
- def method_name
- puts "use underscores to separate words"
- end
-
-Ruby programs must be written in a US-ASCII-compatible character set such as
-UTF-8, ISO-8859-1 etc. In such character sets if the eight bit is set it
-indicates an extended character. Ruby allows method names and other identifiers
-to contain such characters. Ruby programs cannot contain some characters like
-ASCII NUL (<code>\x00<code>).
-
-The following are the examples of valid ruby methods:
-
- def hello
- "hello"
- end
+(Ruby programs must be written in a US-ASCII-compatible character set. In
+such character sets if the eight bit is set it indicates an extended
+character. Ruby allows method names and other identifiers to contain such
+characters.)
- def こんにちは
- puts "means hello in Japanese"
- end
-
-Typically method names are US-ASCII compatible since the keys to type them
-exist on all keyboards.
+Method names may contain letters, numbers, an <code>_</code> (underscore or
+low line) or a character with the eight bit set.
Method names may end with a <code>!</code> (bang or exclamation mark), a
<code>?</code> (question mark) or <code>=</code> equals sign.
-The bang methods (<code>!</code> at the end of method name) are called and
-executed just like any other method. However, by convention, a method with an
-exclamation point or bang is considered dangerous. In ruby core library the
-dangerous method implies that when a method ends with a bang (<code>!</code>),
-it indicates that unlike its non-bang equivalent, permanently modifies its
-receiver. Almost always, ruby core library will have a non-bang
-counterpart (method name which does NOT end with <code>!</code>) of every bang
-method (method name which does end with <code>!</code>) that does not modify
-the receiver. This convention is typically true for ruby core library but
-may or may not hold true for other ruby libraries.
-
-Methods that end with a question mark by convention return boolean, but they
-may not always return just +true+ or +false+. Often, they will return an
-object to indicate a true value (or "truthy" value).
+In the ruby core library when a method ends with a bang it indicates there is
+a non-bang method that has does not modify the receiver. This is typically
+true for the standard library but does not hold true for other ruby libraries.
+
+Methods that end with a question mark do not always return just +true+ or
++false+. Often they will may return an object to indicate a true value (or
+"truthy" value).
Methods that end with an equals sign indicate an assignment method. For
-assignment methods, the return value is ignored and the arguments are returned
+assignment methods the return value is ignored, the arguments are returned
instead.
These are method names for the various ruby operators. Each of these
@@ -109,25 +86,6 @@ operator with an <code>@</code> as in <code>+@</code> or <code>!@</code>:
Unary methods accept zero arguments.
-Additionally, methods for element reference and assignment may be defined:
-<code>[]</code> and <code>[]=</code> respectively. Both can take one or more
-arguments, and element reference can take none.
-
- class C
- def [](a, b)
- puts a + b
- end
-
- def []=(a, b, c)
- puts a * b + c
- end
- end
-
- obj = C.new
-
- obj[2, 3] # prints "5"
- obj[2, 3] = 4 # prints "10"
-
== Return Values
By default, a method returns the last expression that was evaluated in the body
@@ -148,7 +106,7 @@ evaluated.
end
Note that for assignment methods the return value will always be ignored.
-Instead, the argument will be returned:
+Instead the argument will be returned:
def a=(value)
return 1 + value
@@ -402,7 +360,7 @@ arguments must appear before any keyword arguments.
The block argument is indicated by <code>&</code> and must come last:
def my_method(&my_block)
- my_block.call(self)
+ my_method.call(self)
end
Most frequently the block argument is used to pass a block to another method:
@@ -450,6 +408,7 @@ May be written as:
# handle exception
end
-If you wish to rescue an exception for only part of your method, use +begin+ and
+If you wish to rescue an exception for only part of your method use +begin+ and
+end+. For more details see the page on {exception
handling}[rdoc-ref:syntax/exceptions.rdoc].
+
diff --git a/doc/syntax/miscellaneous.rdoc b/doc/syntax/miscellaneous.rdoc
index d5691f8d60..8f424f019f 100644
--- a/doc/syntax/miscellaneous.rdoc
+++ b/doc/syntax/miscellaneous.rdoc
@@ -10,16 +10,16 @@ most frequently used with <code>ruby -e</code>.
== Indentation
-Ruby does not require any indentation. Typically, ruby programs are indented
+Ruby does not require any indentation. Typically ruby programs are indented
two spaces.
-If you run ruby with warnings enabled and have an indentation mis-match, you
+If you run ruby with warnings enabled and have an indentation mis-match you
will receive a warning.
== +alias+
The +alias+ keyword is most frequently used to alias methods. When aliasing a
-method, you can use either its name or a symbol:
+method you can use either its name or a symbol:
alias new_name old_name
alias :new_name :old_name
@@ -61,7 +61,7 @@ You may use +undef+ in any scope. See also Module#undef_method
p defined?(RUBY_VERSION) # prints "constant"
p defined?(1 + 1) # prints "method"
-You don't need to use parenthesis with +defined?+, but they are recommended due
+You don't need to use parenthesis with +defined?+ but they are recommended due
to the {low precedence}[rdoc-ref:syntax/precedence.rdoc] of +defined?+.
For example, if you wish to check if an instance variable exists and that the
@@ -69,7 +69,7 @@ instance variable is zero:
defined? @instance_variable && @instance_variable.zero?
-This returns <code>"expression"</code>, which is not what you want if the
+This returns <code>"expression"</code> which is not what you want if the
instance variable is not defined.
@instance_variable = 1
@@ -104,3 +104,4 @@ Here is an example one-liner that adds numbers from standard input or any files
in the argument list:
ruby -ne 'BEGIN { count = 0 }; END { puts count }; count += gets.to_i'
+
diff --git a/doc/syntax/modules_and_classes.rdoc b/doc/syntax/modules_and_classes.rdoc
index dd70d4ac21..f4ab1ea6f9 100644
--- a/doc/syntax/modules_and_classes.rdoc
+++ b/doc/syntax/modules_and_classes.rdoc
@@ -4,8 +4,8 @@ Modules serve two purposes in Ruby, namespacing and mix-in functionality.
A namespace can be used to organize code by package or functionality that
separates common names from interference by other packages. For example, the
-IRB namespace provides functionality for irb that prevents a collision
-for the common name "Context".
+Curses namespace provides functionality for curses that prevents a collision
+for the common name "Window".
Mix-in functionality allows sharing common methods across multiple classes or
modules. Ruby comes with the Enumerable mix-in module which provides many
@@ -94,7 +94,7 @@ nesting:
end
However, if you use <code>::</code> to define <code>A::B</code> without
-nesting it inside +A+, a NameError exception will be raised because the nesting
+nesting it inside +A+ a NameError exception will be raised because the nesting
does not include +A+:
module A
@@ -129,7 +129,7 @@ method on a module is often called a "class method" instead of a "module
method". See also Module#module_function which can convert an instance method
into a class method.)
-When a class method references a constant, it uses the same rules as referencing
+When a class method references a constant it uses the same rules as referencing
it outside the method as the scope is the same.
Instance methods defined in a module are only callable when included. These
@@ -342,3 +342,4 @@ is equivalent to this code block:
end
Both objects will have a +my_method+ that returns +2+.
+
diff --git a/doc/syntax/refinements.rdoc b/doc/syntax/refinements.rdoc
index 4cba61d396..1a516ed8b2 100644
--- a/doc/syntax/refinements.rdoc
+++ b/doc/syntax/refinements.rdoc
@@ -9,6 +9,11 @@ Refinements are designed to reduce the impact of monkey patching on other
users of the monkey-patched class. Refinements provide a way to extend a
class locally.
+Refinements are an experimental feature in Ruby 2.0. At the time of writing,
+refinements are expected to exist in future versions of Ruby but the
+specification of refinements may change. You will receive a warning the first
+time you define or activate a refinement.
+
Here is a basic refinement:
class C
@@ -37,27 +42,21 @@ Activate the refinement with #using:
using M
- c = C.new
+ x = C.new
c.foo # prints "C#foo in M"
== Scope
-You may activate refinements at top-level, and inside classes and modules.
-You may not activate refinements in method scope. Refinements are activated
-until the end of the current class or module definition, or until the end of
-the current file if used at the top-level.
-
-You may activate refinements in a string passed to Kernel#eval. Refinements
-are active the end of the eval string.
+You may only activate refinements at top-level, not inside any class, module
+or method scope. You may activate refinements in a string passed to
+Kernel#eval that is evaluated at top-level. Refinements are active until the
+end of the file or the end of the eval string, respectively.
-Refinements are lexical in scope. Refinements are only active within a scope
-after the call to using. Any code before the using statement will not have the
-refinement activated.
-
-When control is transferred outside the scope the refinement is deactivated.
-This means that if you require or load a file or call a method that is defined
-outside the current scope the refinement will be deactivated:
+Refinements are lexical in scope. When control is transferred outside the
+scope the refinement is deactivated. This means that if you require or load a
+file or call a method that is defined outside the current scope the refinement
+will be deactivated:
class C
end
@@ -142,26 +141,6 @@ In a file:
end
# activated here
-In a class:
-
- # not activated here
- class Foo
- # not activated here
- def foo
- # not activated here
- end
- using M
- # activated here
- def bar
- # activated here
- end
- # activated here
- end
- # not activated here
-
-Note that the refinements in M are not activated automatically if the class
-Foo is reopened later.
-
In eval:
# not activated here
@@ -208,6 +187,24 @@ called:
p [{1=>2}, {3=>4}].to_json # prints "[{\"1\":2},{\"3\":4}]"
+You may also activate refinements in a class or module definition, in which
+case the refinements are activated from the point where using is called to
+the end of the class or module definition:
+
+ # not activated here
+ class Foo
+ # not activated here
+ using M
+ # activated here
+ def foo
+ # activated here
+ end
+ # activated here
+ end
+ # not activated here
+
+Note that the refinements in M are not activated automatically even if the class
+Foo is reopened later.
== Method Lookup
@@ -255,8 +252,15 @@ method lookup.
This behavior may be changed in the future.
+== Refinements and module inclusion
+
+Refinements are inherited by module inclusion. That is, using activates all
+refinements in the ancestors of the specified module. Refinements in a
+descendant have priority over refinements in an ancestor.
+
== Further Reading
See http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/RefinementsSpec for the
current specification for implementing refinements. The specification also
contains more details.
+
diff --git a/enc/Makefile.in b/enc/Makefile.in
index ac9cee9a40..a64785d1c5 100644
--- a/enc/Makefile.in
+++ b/enc/Makefile.in
@@ -22,10 +22,10 @@ DLEXT = @DLEXT@
OBJEXT = @OBJEXT@
LIBEXT = @LIBEXT@
-BUILTIN_ENCS = enc/ascii.c enc/us_ascii.c\
- enc/unicode.c enc/utf_8.c
+BUILTIN_ENCS = ascii.c us_ascii.c\
+ unicode.c utf_8.c
-BUILTIN_TRANSES = enc/trans/newline.trans
+BUILTIN_TRANSES = newline.trans
RUBY_SO_NAME = @RUBY_SO_NAME@
LIBRUBY = @LIBRUBY@
diff --git a/enc/ascii.c b/enc/ascii.c
index 4fdc976e12..72150c037c 100644
--- a/enc/ascii.c
+++ b/enc/ascii.c
@@ -29,10 +29,6 @@
*/
#include "regenc.h"
-#include "encindex.h"
-#ifndef ENCINDEX_ASCII
-#define ENCINDEX_ASCII 0
-#endif
OnigEncodingDefine(ascii, ASCII) = {
onigenc_single_byte_mbc_enc_len,
@@ -51,7 +47,7 @@ OnigEncodingDefine(ascii, ASCII) = {
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
onigenc_always_true_is_allowed_reverse_match,
- ENCINDEX_ASCII,
+ 0,
ONIGENC_FLAG_NONE,
};
ENC_ALIAS("BINARY", "ASCII-8BIT")
diff --git a/enc/big5.c b/enc/big5.c
index 27315c4ba9..9d7738d8f9 100644
--- a/enc/big5.c
+++ b/enc/big5.c
@@ -167,19 +167,19 @@ big5_mbc_enc_len0(const UChar* p, const UChar* e, int tridx, const int tbl[])
static int
big5_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED)
{
- return big5_mbc_enc_len0(p, e, 0, EncLen_BIG5);
+ return big5_mbc_enc_len0(p, e, 0, EncLen_BIG5);
}
static int
big5_hkscs_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED)
{
- return big5_mbc_enc_len0(p, e, 2, EncLen_BIG5_HKSCS);
+ return big5_mbc_enc_len0(p, e, 2, EncLen_BIG5_HKSCS);
}
static int
big5_uao_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED)
{
- return big5_mbc_enc_len0(p, e, 2, EncLen_BIG5_UAO);
+ return big5_mbc_enc_len0(p, e, 2, EncLen_BIG5_UAO);
}
static OnigCodePoint
diff --git a/enc/depend b/enc/depend
index 39a26a7b76..5750a0dc49 100644
--- a/enc/depend
+++ b/enc/depend
@@ -82,9 +82,15 @@ srcs: $(TRANSCSRCS)
% unless ENCS.empty? or TRANS.empty?
+% unless ENCS.empty?
+$(ENCOBJS): $(hdrdir)/ruby.h regenc.h oniguruma.h config.h defines.h ruby.h missing.h subst.h intern.h st.h encoding.h
+% end
% ENC_DEPS.each do |e, deps|
enc/<%=e%>.$(OBJEXT): <%=deps.map {|n| rule_subst % n}.join(' ')%>
% end
+% unless TRANS.empty?
+$(TRANSOBJS): $(hdrdir)/ruby.h ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.h st.h transcode_data.h subst.h encoding.h
+% end
% ATRANS.each do |e|
% src = "#{e}.trans"
@@ -132,13 +138,12 @@ enc/encdb.$(OBJEXT): encdb.h
enc/trans/transdb.$(OBJEXT): transdb.h
clean:
-% %w[$(ENCSOS) $(LIBENC) $(ENCOBJS) $(ENCCLEANOBJS) $(ENCCLEANLIBS) $(TRANSSOS) $(LIBTRANS) $(TRANSOBJS) $(TRANSCLEANOBJS) $(TRANSCLEANLIBS) enc/trans/.time].each do |clean|
+% %w[$(ENCSOS) $(LIBENC) $(ENCOBJS) $(ENCCLEANOBJS) $(ENCCLEANLIBS) $(TRANSSOS) $(LIBTRANS) $(TRANSOBJS) $(TRANSCLEANOBJS) $(TRANSCLEANLIBS)].each do |clean|
$(Q)$(RM) <%=pathrep[clean]%>
% end
% @ignore_error = $nmake ? '' : ' 2> /dev/null || true'
% unless inplace
$(Q)$(RM) enc/unicode/name2ctype.h
- $(Q)$(RM) enc/jis/props.h
-$(Q)$(RMDIR) enc/unicode<%=@ignore_error%>
% end
% workdirs.reverse_each do|d|
@@ -149,460 +154,7 @@ clean-srcs:
$(Q)$(RM) <%=pathrep['$(TRANSCSRCS)']%>
-$(Q)$(RMDIR) <%=pathrep['enc/trans']%><%=@ignore_error%>
$(Q)$(RM) enc/unicode/name2ctype.h
- $(Q)$(RM) enc/jis/props.h
-$(Q)$(RMDIR) <%=pathrep['enc/unicode']%><%=@ignore_error%>
- -$(Q)$(RMDIR) <%=pathrep['enc/props']%><%=@ignore_error%>
-$(Q)$(RMDIR) <%=pathrep['enc']%><%=@ignore_error%>
<%# vim: set ft=eruby noexpandtab ts=8 sw=2 : -%>
-
-# AUTOGENERATED DEPENDENCIES START
-enc/ascii.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/ascii.$(OBJEXT): config.h
-enc/ascii.$(OBJEXT): defines.h
-enc/ascii.$(OBJEXT): enc/ascii.c
-enc/ascii.$(OBJEXT): missing.h
-enc/ascii.$(OBJEXT): oniguruma.h
-enc/big5.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/big5.$(OBJEXT): config.h
-enc/big5.$(OBJEXT): defines.h
-enc/big5.$(OBJEXT): enc/big5.c
-enc/big5.$(OBJEXT): missing.h
-enc/big5.$(OBJEXT): oniguruma.h
-enc/cp949.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/cp949.$(OBJEXT): config.h
-enc/cp949.$(OBJEXT): defines.h
-enc/cp949.$(OBJEXT): enc/cp949.c
-enc/cp949.$(OBJEXT): missing.h
-enc/cp949.$(OBJEXT): oniguruma.h
-enc/emacs_mule.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/emacs_mule.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/emacs_mule.$(OBJEXT): $(top_srcdir)/regint.h
-enc/emacs_mule.$(OBJEXT): config.h
-enc/emacs_mule.$(OBJEXT): defines.h
-enc/emacs_mule.$(OBJEXT): enc/emacs_mule.c
-enc/emacs_mule.$(OBJEXT): intern.h
-enc/emacs_mule.$(OBJEXT): missing.h
-enc/emacs_mule.$(OBJEXT): oniguruma.h
-enc/emacs_mule.$(OBJEXT): st.h
-enc/emacs_mule.$(OBJEXT): subst.h
-enc/encdb.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/encdb.$(OBJEXT): $(top_srcdir)/include/ruby.h
-enc/encdb.$(OBJEXT): $(top_srcdir)/internal.h
-enc/encdb.$(OBJEXT): config.h
-enc/encdb.$(OBJEXT): defines.h
-enc/encdb.$(OBJEXT): enc/encdb.c
-enc/encdb.$(OBJEXT): encdb.h
-enc/encdb.$(OBJEXT): encoding.h
-enc/encdb.$(OBJEXT): intern.h
-enc/encdb.$(OBJEXT): io.h
-enc/encdb.$(OBJEXT): missing.h
-enc/encdb.$(OBJEXT): oniguruma.h
-enc/encdb.$(OBJEXT): st.h
-enc/encdb.$(OBJEXT): subst.h
-enc/euc_jp.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/euc_jp.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/euc_jp.$(OBJEXT): $(top_srcdir)/regint.h
-enc/euc_jp.$(OBJEXT): config.h
-enc/euc_jp.$(OBJEXT): defines.h
-enc/euc_jp.$(OBJEXT): enc/euc_jp.c
-enc/euc_jp.$(OBJEXT): enc/jis/props.h
-enc/euc_jp.$(OBJEXT): enc/jis/props.kwd
-enc/euc_jp.$(OBJEXT): intern.h
-enc/euc_jp.$(OBJEXT): missing.h
-enc/euc_jp.$(OBJEXT): oniguruma.h
-enc/euc_jp.$(OBJEXT): st.h
-enc/euc_jp.$(OBJEXT): subst.h
-enc/euc_kr.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/euc_kr.$(OBJEXT): config.h
-enc/euc_kr.$(OBJEXT): defines.h
-enc/euc_kr.$(OBJEXT): enc/euc_kr.c
-enc/euc_kr.$(OBJEXT): missing.h
-enc/euc_kr.$(OBJEXT): oniguruma.h
-enc/euc_tw.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/euc_tw.$(OBJEXT): config.h
-enc/euc_tw.$(OBJEXT): defines.h
-enc/euc_tw.$(OBJEXT): enc/euc_tw.c
-enc/euc_tw.$(OBJEXT): missing.h
-enc/euc_tw.$(OBJEXT): oniguruma.h
-enc/gb18030.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/gb18030.$(OBJEXT): config.h
-enc/gb18030.$(OBJEXT): defines.h
-enc/gb18030.$(OBJEXT): enc/gb18030.c
-enc/gb18030.$(OBJEXT): missing.h
-enc/gb18030.$(OBJEXT): oniguruma.h
-enc/gb2312.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/gb2312.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/gb2312.$(OBJEXT): config.h
-enc/gb2312.$(OBJEXT): defines.h
-enc/gb2312.$(OBJEXT): enc/gb2312.c
-enc/gb2312.$(OBJEXT): encoding.h
-enc/gb2312.$(OBJEXT): intern.h
-enc/gb2312.$(OBJEXT): missing.h
-enc/gb2312.$(OBJEXT): oniguruma.h
-enc/gb2312.$(OBJEXT): st.h
-enc/gb2312.$(OBJEXT): subst.h
-enc/gbk.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/gbk.$(OBJEXT): config.h
-enc/gbk.$(OBJEXT): defines.h
-enc/gbk.$(OBJEXT): enc/gbk.c
-enc/gbk.$(OBJEXT): missing.h
-enc/gbk.$(OBJEXT): oniguruma.h
-enc/iso_8859_1.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_1.$(OBJEXT): config.h
-enc/iso_8859_1.$(OBJEXT): defines.h
-enc/iso_8859_1.$(OBJEXT): enc/iso_8859_1.c
-enc/iso_8859_1.$(OBJEXT): missing.h
-enc/iso_8859_1.$(OBJEXT): oniguruma.h
-enc/iso_8859_10.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_10.$(OBJEXT): config.h
-enc/iso_8859_10.$(OBJEXT): defines.h
-enc/iso_8859_10.$(OBJEXT): enc/iso_8859_10.c
-enc/iso_8859_10.$(OBJEXT): missing.h
-enc/iso_8859_10.$(OBJEXT): oniguruma.h
-enc/iso_8859_11.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_11.$(OBJEXT): config.h
-enc/iso_8859_11.$(OBJEXT): defines.h
-enc/iso_8859_11.$(OBJEXT): enc/iso_8859_11.c
-enc/iso_8859_11.$(OBJEXT): missing.h
-enc/iso_8859_11.$(OBJEXT): oniguruma.h
-enc/iso_8859_13.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_13.$(OBJEXT): config.h
-enc/iso_8859_13.$(OBJEXT): defines.h
-enc/iso_8859_13.$(OBJEXT): enc/iso_8859_13.c
-enc/iso_8859_13.$(OBJEXT): missing.h
-enc/iso_8859_13.$(OBJEXT): oniguruma.h
-enc/iso_8859_14.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_14.$(OBJEXT): config.h
-enc/iso_8859_14.$(OBJEXT): defines.h
-enc/iso_8859_14.$(OBJEXT): enc/iso_8859_14.c
-enc/iso_8859_14.$(OBJEXT): missing.h
-enc/iso_8859_14.$(OBJEXT): oniguruma.h
-enc/iso_8859_15.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_15.$(OBJEXT): config.h
-enc/iso_8859_15.$(OBJEXT): defines.h
-enc/iso_8859_15.$(OBJEXT): enc/iso_8859_15.c
-enc/iso_8859_15.$(OBJEXT): missing.h
-enc/iso_8859_15.$(OBJEXT): oniguruma.h
-enc/iso_8859_16.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_16.$(OBJEXT): config.h
-enc/iso_8859_16.$(OBJEXT): defines.h
-enc/iso_8859_16.$(OBJEXT): enc/iso_8859_16.c
-enc/iso_8859_16.$(OBJEXT): missing.h
-enc/iso_8859_16.$(OBJEXT): oniguruma.h
-enc/iso_8859_2.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_2.$(OBJEXT): config.h
-enc/iso_8859_2.$(OBJEXT): defines.h
-enc/iso_8859_2.$(OBJEXT): enc/iso_8859_2.c
-enc/iso_8859_2.$(OBJEXT): missing.h
-enc/iso_8859_2.$(OBJEXT): oniguruma.h
-enc/iso_8859_3.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_3.$(OBJEXT): config.h
-enc/iso_8859_3.$(OBJEXT): defines.h
-enc/iso_8859_3.$(OBJEXT): enc/iso_8859_3.c
-enc/iso_8859_3.$(OBJEXT): missing.h
-enc/iso_8859_3.$(OBJEXT): oniguruma.h
-enc/iso_8859_4.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_4.$(OBJEXT): config.h
-enc/iso_8859_4.$(OBJEXT): defines.h
-enc/iso_8859_4.$(OBJEXT): enc/iso_8859_4.c
-enc/iso_8859_4.$(OBJEXT): missing.h
-enc/iso_8859_4.$(OBJEXT): oniguruma.h
-enc/iso_8859_5.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_5.$(OBJEXT): config.h
-enc/iso_8859_5.$(OBJEXT): defines.h
-enc/iso_8859_5.$(OBJEXT): enc/iso_8859_5.c
-enc/iso_8859_5.$(OBJEXT): missing.h
-enc/iso_8859_5.$(OBJEXT): oniguruma.h
-enc/iso_8859_6.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_6.$(OBJEXT): config.h
-enc/iso_8859_6.$(OBJEXT): defines.h
-enc/iso_8859_6.$(OBJEXT): enc/iso_8859_6.c
-enc/iso_8859_6.$(OBJEXT): missing.h
-enc/iso_8859_6.$(OBJEXT): oniguruma.h
-enc/iso_8859_7.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_7.$(OBJEXT): config.h
-enc/iso_8859_7.$(OBJEXT): defines.h
-enc/iso_8859_7.$(OBJEXT): enc/iso_8859_7.c
-enc/iso_8859_7.$(OBJEXT): missing.h
-enc/iso_8859_7.$(OBJEXT): oniguruma.h
-enc/iso_8859_8.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_8.$(OBJEXT): config.h
-enc/iso_8859_8.$(OBJEXT): defines.h
-enc/iso_8859_8.$(OBJEXT): enc/iso_8859_8.c
-enc/iso_8859_8.$(OBJEXT): missing.h
-enc/iso_8859_8.$(OBJEXT): oniguruma.h
-enc/iso_8859_9.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/iso_8859_9.$(OBJEXT): config.h
-enc/iso_8859_9.$(OBJEXT): defines.h
-enc/iso_8859_9.$(OBJEXT): enc/iso_8859_9.c
-enc/iso_8859_9.$(OBJEXT): missing.h
-enc/iso_8859_9.$(OBJEXT): oniguruma.h
-enc/koi8_r.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/koi8_r.$(OBJEXT): config.h
-enc/koi8_r.$(OBJEXT): defines.h
-enc/koi8_r.$(OBJEXT): enc/koi8_r.c
-enc/koi8_r.$(OBJEXT): missing.h
-enc/koi8_r.$(OBJEXT): oniguruma.h
-enc/koi8_u.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/koi8_u.$(OBJEXT): config.h
-enc/koi8_u.$(OBJEXT): defines.h
-enc/koi8_u.$(OBJEXT): enc/koi8_u.c
-enc/koi8_u.$(OBJEXT): missing.h
-enc/koi8_u.$(OBJEXT): oniguruma.h
-enc/shift_jis.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/shift_jis.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/shift_jis.$(OBJEXT): $(top_srcdir)/regint.h
-enc/shift_jis.$(OBJEXT): config.h
-enc/shift_jis.$(OBJEXT): defines.h
-enc/shift_jis.$(OBJEXT): enc/jis/props.h
-enc/shift_jis.$(OBJEXT): enc/jis/props.kwd
-enc/shift_jis.$(OBJEXT): enc/shift_jis.c
-enc/shift_jis.$(OBJEXT): intern.h
-enc/shift_jis.$(OBJEXT): missing.h
-enc/shift_jis.$(OBJEXT): oniguruma.h
-enc/shift_jis.$(OBJEXT): st.h
-enc/shift_jis.$(OBJEXT): subst.h
-enc/trans/big5.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/big5.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/big5.$(OBJEXT): config.h
-enc/trans/big5.$(OBJEXT): defines.h
-enc/trans/big5.$(OBJEXT): enc/trans/big5.c
-enc/trans/big5.$(OBJEXT): intern.h
-enc/trans/big5.$(OBJEXT): missing.h
-enc/trans/big5.$(OBJEXT): st.h
-enc/trans/big5.$(OBJEXT): subst.h
-enc/trans/chinese.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/chinese.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/chinese.$(OBJEXT): config.h
-enc/trans/chinese.$(OBJEXT): defines.h
-enc/trans/chinese.$(OBJEXT): enc/trans/chinese.c
-enc/trans/chinese.$(OBJEXT): intern.h
-enc/trans/chinese.$(OBJEXT): missing.h
-enc/trans/chinese.$(OBJEXT): st.h
-enc/trans/chinese.$(OBJEXT): subst.h
-enc/trans/emoji.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/emoji.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/emoji.$(OBJEXT): config.h
-enc/trans/emoji.$(OBJEXT): defines.h
-enc/trans/emoji.$(OBJEXT): enc/trans/emoji.c
-enc/trans/emoji.$(OBJEXT): intern.h
-enc/trans/emoji.$(OBJEXT): missing.h
-enc/trans/emoji.$(OBJEXT): st.h
-enc/trans/emoji.$(OBJEXT): subst.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): config.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): defines.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): enc/trans/emoji_iso2022_kddi.c
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): intern.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): missing.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): st.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): subst.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): config.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): defines.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): enc/trans/emoji_sjis_docomo.c
-enc/trans/emoji_sjis_docomo.$(OBJEXT): intern.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): missing.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): st.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): subst.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): config.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): defines.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): enc/trans/emoji_sjis_kddi.c
-enc/trans/emoji_sjis_kddi.$(OBJEXT): intern.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): missing.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): st.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): subst.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): config.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): defines.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): enc/trans/emoji_sjis_softbank.c
-enc/trans/emoji_sjis_softbank.$(OBJEXT): intern.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): missing.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): st.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): subst.h
-enc/trans/escape.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/escape.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/escape.$(OBJEXT): config.h
-enc/trans/escape.$(OBJEXT): defines.h
-enc/trans/escape.$(OBJEXT): enc/trans/escape.c
-enc/trans/escape.$(OBJEXT): intern.h
-enc/trans/escape.$(OBJEXT): missing.h
-enc/trans/escape.$(OBJEXT): st.h
-enc/trans/escape.$(OBJEXT): subst.h
-enc/trans/gb18030.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/gb18030.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/gb18030.$(OBJEXT): config.h
-enc/trans/gb18030.$(OBJEXT): defines.h
-enc/trans/gb18030.$(OBJEXT): enc/trans/gb18030.c
-enc/trans/gb18030.$(OBJEXT): intern.h
-enc/trans/gb18030.$(OBJEXT): missing.h
-enc/trans/gb18030.$(OBJEXT): st.h
-enc/trans/gb18030.$(OBJEXT): subst.h
-enc/trans/gbk.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/gbk.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/gbk.$(OBJEXT): config.h
-enc/trans/gbk.$(OBJEXT): defines.h
-enc/trans/gbk.$(OBJEXT): enc/trans/gbk.c
-enc/trans/gbk.$(OBJEXT): intern.h
-enc/trans/gbk.$(OBJEXT): missing.h
-enc/trans/gbk.$(OBJEXT): st.h
-enc/trans/gbk.$(OBJEXT): subst.h
-enc/trans/iso2022.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/iso2022.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/iso2022.$(OBJEXT): config.h
-enc/trans/iso2022.$(OBJEXT): defines.h
-enc/trans/iso2022.$(OBJEXT): enc/trans/iso2022.c
-enc/trans/iso2022.$(OBJEXT): intern.h
-enc/trans/iso2022.$(OBJEXT): missing.h
-enc/trans/iso2022.$(OBJEXT): st.h
-enc/trans/iso2022.$(OBJEXT): subst.h
-enc/trans/japanese.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/japanese.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/japanese.$(OBJEXT): config.h
-enc/trans/japanese.$(OBJEXT): defines.h
-enc/trans/japanese.$(OBJEXT): enc/trans/japanese.c
-enc/trans/japanese.$(OBJEXT): intern.h
-enc/trans/japanese.$(OBJEXT): missing.h
-enc/trans/japanese.$(OBJEXT): st.h
-enc/trans/japanese.$(OBJEXT): subst.h
-enc/trans/japanese_euc.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/japanese_euc.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/japanese_euc.$(OBJEXT): config.h
-enc/trans/japanese_euc.$(OBJEXT): defines.h
-enc/trans/japanese_euc.$(OBJEXT): enc/trans/japanese_euc.c
-enc/trans/japanese_euc.$(OBJEXT): intern.h
-enc/trans/japanese_euc.$(OBJEXT): missing.h
-enc/trans/japanese_euc.$(OBJEXT): st.h
-enc/trans/japanese_euc.$(OBJEXT): subst.h
-enc/trans/japanese_sjis.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/japanese_sjis.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/japanese_sjis.$(OBJEXT): config.h
-enc/trans/japanese_sjis.$(OBJEXT): defines.h
-enc/trans/japanese_sjis.$(OBJEXT): enc/trans/japanese_sjis.c
-enc/trans/japanese_sjis.$(OBJEXT): intern.h
-enc/trans/japanese_sjis.$(OBJEXT): missing.h
-enc/trans/japanese_sjis.$(OBJEXT): st.h
-enc/trans/japanese_sjis.$(OBJEXT): subst.h
-enc/trans/korean.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/korean.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/korean.$(OBJEXT): config.h
-enc/trans/korean.$(OBJEXT): defines.h
-enc/trans/korean.$(OBJEXT): enc/trans/korean.c
-enc/trans/korean.$(OBJEXT): intern.h
-enc/trans/korean.$(OBJEXT): missing.h
-enc/trans/korean.$(OBJEXT): st.h
-enc/trans/korean.$(OBJEXT): subst.h
-enc/trans/newline.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/newline.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/newline.$(OBJEXT): config.h
-enc/trans/newline.$(OBJEXT): defines.h
-enc/trans/newline.$(OBJEXT): enc/trans/newline.c
-enc/trans/newline.$(OBJEXT): intern.h
-enc/trans/newline.$(OBJEXT): missing.h
-enc/trans/newline.$(OBJEXT): st.h
-enc/trans/newline.$(OBJEXT): subst.h
-enc/trans/single_byte.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/single_byte.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/single_byte.$(OBJEXT): config.h
-enc/trans/single_byte.$(OBJEXT): defines.h
-enc/trans/single_byte.$(OBJEXT): enc/trans/single_byte.c
-enc/trans/single_byte.$(OBJEXT): intern.h
-enc/trans/single_byte.$(OBJEXT): missing.h
-enc/trans/single_byte.$(OBJEXT): st.h
-enc/trans/single_byte.$(OBJEXT): subst.h
-enc/trans/transdb.$(OBJEXT): enc/trans/transdb.c
-enc/trans/transdb.$(OBJEXT): transdb.h
-enc/trans/utf8_mac.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/utf8_mac.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/utf8_mac.$(OBJEXT): config.h
-enc/trans/utf8_mac.$(OBJEXT): defines.h
-enc/trans/utf8_mac.$(OBJEXT): enc/trans/utf8_mac.c
-enc/trans/utf8_mac.$(OBJEXT): intern.h
-enc/trans/utf8_mac.$(OBJEXT): missing.h
-enc/trans/utf8_mac.$(OBJEXT): st.h
-enc/trans/utf8_mac.$(OBJEXT): subst.h
-enc/trans/utf_16_32.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/trans/utf_16_32.$(OBJEXT): $(top_srcdir)/transcode_data.h
-enc/trans/utf_16_32.$(OBJEXT): config.h
-enc/trans/utf_16_32.$(OBJEXT): defines.h
-enc/trans/utf_16_32.$(OBJEXT): enc/trans/utf_16_32.c
-enc/trans/utf_16_32.$(OBJEXT): intern.h
-enc/trans/utf_16_32.$(OBJEXT): missing.h
-enc/trans/utf_16_32.$(OBJEXT): st.h
-enc/trans/utf_16_32.$(OBJEXT): subst.h
-enc/unicode.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/unicode.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/unicode.$(OBJEXT): $(top_srcdir)/regint.h
-enc/unicode.$(OBJEXT): config.h
-enc/unicode.$(OBJEXT): defines.h
-enc/unicode.$(OBJEXT): enc/unicode.c
-enc/unicode.$(OBJEXT): enc/unicode/casefold.h
-enc/unicode.$(OBJEXT): enc/unicode/name2ctype.h
-enc/unicode.$(OBJEXT): intern.h
-enc/unicode.$(OBJEXT): missing.h
-enc/unicode.$(OBJEXT): oniguruma.h
-enc/unicode.$(OBJEXT): st.h
-enc/unicode.$(OBJEXT): subst.h
-enc/us_ascii.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/us_ascii.$(OBJEXT): config.h
-enc/us_ascii.$(OBJEXT): defines.h
-enc/us_ascii.$(OBJEXT): enc/us_ascii.c
-enc/us_ascii.$(OBJEXT): missing.h
-enc/us_ascii.$(OBJEXT): oniguruma.h
-enc/utf_16be.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/utf_16be.$(OBJEXT): config.h
-enc/utf_16be.$(OBJEXT): defines.h
-enc/utf_16be.$(OBJEXT): enc/utf_16be.c
-enc/utf_16be.$(OBJEXT): missing.h
-enc/utf_16be.$(OBJEXT): oniguruma.h
-enc/utf_16le.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/utf_16le.$(OBJEXT): config.h
-enc/utf_16le.$(OBJEXT): defines.h
-enc/utf_16le.$(OBJEXT): enc/utf_16le.c
-enc/utf_16le.$(OBJEXT): missing.h
-enc/utf_16le.$(OBJEXT): oniguruma.h
-enc/utf_32be.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/utf_32be.$(OBJEXT): config.h
-enc/utf_32be.$(OBJEXT): defines.h
-enc/utf_32be.$(OBJEXT): enc/utf_32be.c
-enc/utf_32be.$(OBJEXT): missing.h
-enc/utf_32be.$(OBJEXT): oniguruma.h
-enc/utf_32le.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/utf_32le.$(OBJEXT): config.h
-enc/utf_32le.$(OBJEXT): defines.h
-enc/utf_32le.$(OBJEXT): enc/utf_32le.c
-enc/utf_32le.$(OBJEXT): missing.h
-enc/utf_32le.$(OBJEXT): oniguruma.h
-enc/utf_8.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/utf_8.$(OBJEXT): config.h
-enc/utf_8.$(OBJEXT): defines.h
-enc/utf_8.$(OBJEXT): enc/utf_8.c
-enc/utf_8.$(OBJEXT): missing.h
-enc/utf_8.$(OBJEXT): oniguruma.h
-enc/windows_1251.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/windows_1251.$(OBJEXT): config.h
-enc/windows_1251.$(OBJEXT): defines.h
-enc/windows_1251.$(OBJEXT): enc/windows_1251.c
-enc/windows_1251.$(OBJEXT): missing.h
-enc/windows_1251.$(OBJEXT): oniguruma.h
-enc/windows_31j.$(OBJEXT): $(hdrdir)/ruby/ruby.h
-enc/windows_31j.$(OBJEXT): $(top_srcdir)/regenc.h
-enc/windows_31j.$(OBJEXT): $(top_srcdir)/regint.h
-enc/windows_31j.$(OBJEXT): config.h
-enc/windows_31j.$(OBJEXT): defines.h
-enc/windows_31j.$(OBJEXT): enc/jis/props.h
-enc/windows_31j.$(OBJEXT): enc/jis/props.kwd
-enc/windows_31j.$(OBJEXT): enc/shift_jis.c
-enc/windows_31j.$(OBJEXT): enc/windows_31j.c
-enc/windows_31j.$(OBJEXT): intern.h
-enc/windows_31j.$(OBJEXT): missing.h
-enc/windows_31j.$(OBJEXT): oniguruma.h
-enc/windows_31j.$(OBJEXT): st.h
-enc/windows_31j.$(OBJEXT): subst.h
-# AUTOGENERATED DEPENDENCIES END
diff --git a/enc/ebcdic.h b/enc/ebcdic.h
deleted file mode 100644
index a3b380a327..0000000000
--- a/enc/ebcdic.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "regenc.h"
-/* dummy for unsupported, non-ascii-based encoding */
-ENC_DUMMY("IBM037");
-ENC_ALIAS("ebcdic-cp-us", "IBM037");
-
-/* we start with just defining a single EBCDIC encoding,
- * hopefully the most widely used one.
- *
- * See http://www.iana.org/assignments/character-sets/character-sets.xhtml
- * http://tools.ietf.org/html/rfc1345
- */
diff --git a/enc/encdb.c b/enc/encdb.c
index a41e4edc6d..fa04a5f7f6 100644
--- a/enc/encdb.c
+++ b/enc/encdb.c
@@ -9,8 +9,13 @@
**********************************************************************/
-#include "internal.h"
-
+int rb_encdb_replicate(const char *alias, const char *orig);
+int rb_encdb_alias(const char *alias, const char *orig);
+int rb_encdb_dummy(const char *name);
+void rb_encdb_declare(const char *name);
+void rb_enc_set_base(const char *name, const char *orig);
+int rb_enc_set_dummy(int index);
+void rb_encdb_set_unicode(int index);
#define ENC_REPLICATE(name, orig) rb_encdb_replicate((name), (orig))
#define ENC_ALIAS(name, orig) rb_encdb_alias((name), (orig))
#define ENC_DUMMY(name) rb_encdb_dummy(name)
diff --git a/enc/encinit.c.erb b/enc/encinit.c.erb
index 70c2a1934c..fd3ade0c4b 100644
--- a/enc/encinit.c.erb
+++ b/enc/encinit.c.erb
@@ -8,30 +8,19 @@
ruby_init_ext(name, func); \
}
-#define init_enc(name) init(Init_##name, "enc/"#name".so")
-#define init_trans(name) init(Init_trans_##name, "enc/trans/"#name".so")
-#define provide(func, name) { \
- extern void Init_##func(void); \
- Init_##func(); \
- rb_provide(name".so"); \
-}
-
void ruby_init_ext(const char *name, void (*init)(void));
-void rb_provide(const char *feature);
void
Init_enc(void)
{
- provide(encdb, "encdb");
% ENCS.each do |enc|
-% next if enc == 'encdb'
- init_enc(<%= enc %>);
+ init(Init_<%= enc %>, "enc/<%= enc %>.so");
% end
- provide(transdb, "trans/transdb");
+ init(Init_transdb, "enc/trans/transdb.so");
% TRANS.each do |trans|
% next if trans == 'trans/transdb'
- init_trans(<%= File.basename trans %>);
+ init(Init_trans_<%= File.basename trans %>, "enc/<%= trans %>.so");
% end
}
<%# vim: set ft=eruby sw=2 : -%>
diff --git a/enc/euc_jp.c b/enc/euc_jp.c
index 7922aac150..d7af1abaee 100644
--- a/enc/euc_jp.c
+++ b/enc/euc_jp.c
@@ -293,7 +293,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -381,10 +381,8 @@ mbc_case_fold(OnigCaseFoldType flag,
OnigCodePoint code;
int len;
- len = mbc_enc_len(p, end, enc);
code = get_lower_case(mbc_to_code(p, end, enc));
len = code_to_mbc(code, lower, enc);
- if (len == ONIGERR_INVALID_CODE_POINT_VALUE) len = 1;
(*pp) += len;
return len; /* return byte length of converted char to lower */
}
@@ -420,6 +418,12 @@ is_allowed_reverse_match(const UChar* s, const UChar* end, OnigEncoding enc ARG_
}
+static int PropertyInited = 0;
+static const OnigCodePoint** PropertyList;
+static int PropertyListNum;
+static int PropertyListSize;
+static hash_table_type* PropertyNameTable;
+
static const OnigCodePoint CR_Hiragana[] = {
1,
#ifdef ENC_EUC_JIS_2004
@@ -500,20 +504,41 @@ static const OnigCodePoint CR_Cyrillic[] = {
/* TODO: add JIS X 0212 row 7 */
}; /* CR_Cyrillic */
-#include "enc/jis/props.h"
+static int
+init_property_list(void)
+{
+ int r;
+
+ PROPERTY_LIST_ADD_PROP("hiragana", CR_Hiragana);
+ PROPERTY_LIST_ADD_PROP("katakana", CR_Katakana);
+ PROPERTY_LIST_ADD_PROP("han", CR_Han);
+ PROPERTY_LIST_ADD_PROP("latin", CR_Latin);
+ PROPERTY_LIST_ADD_PROP("greek", CR_Greek);
+ PROPERTY_LIST_ADD_PROP("cyrillic", CR_Cyrillic);
+ PropertyInited = 1;
+
+ end:
+ return r;
+}
static int
-property_name_to_ctype(OnigEncoding enc, const UChar* p, const UChar* end)
+property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
- const UChar *s = p, *e = end;
- const struct enc_property *prop =
- onig_jis_property((const char* )s, (unsigned int )(e - s));
+ st_data_t ctype;
+ UChar *s, *e;
+
+ PROPERTY_LIST_INIT_CHECK;
- if (!prop) {
+ s = e = ALLOCA_N(UChar, end-p+1);
+ for (; p < end; p++) {
+ *e++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
+ }
+
+ if (onig_st_lookup_strend(PropertyNameTable, s, e, &ctype) == 0) {
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return (int )prop->ctype;
+ return (int )ctype;
}
static int
@@ -529,6 +554,8 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSE
}
}
else {
+ PROPERTY_LIST_INIT_CHECK;
+
ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= (unsigned int )PropertyListNum)
return ONIGERR_TYPE_BUG;
@@ -549,6 +576,8 @@ get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
else {
*sb_out = 0x80;
+ PROPERTY_LIST_INIT_CHECK;
+
ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= (OnigCtype )PropertyListNum)
return ONIGERR_TYPE_BUG;
diff --git a/enc/iso_2022_jp.h b/enc/iso_2022_jp.h
index 9240130166..399c2f56a5 100644
--- a/enc/iso_2022_jp.h
+++ b/enc/iso_2022_jp.h
@@ -1,5 +1,5 @@
#include "regenc.h"
-/* dummy for unsupported, stateful encoding */
+/* dummy for unsupported, statefull encoding */
ENC_DUMMY("ISO-2022-JP");
ENC_ALIAS("ISO2022-JP", "ISO-2022-JP");
ENC_REPLICATE("ISO-2022-JP-2", "ISO-2022-JP");
diff --git a/enc/iso_8859_1.c b/enc/iso_8859_1.c
index e3315876cd..92dc14f978 100644
--- a/enc/iso_8859_1.c
+++ b/enc/iso_8859_1.c
@@ -29,6 +29,8 @@
#include "regenc.h"
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
#define ENC_IS_ISO_8859_1_CTYPE(code,ctype) \
((EncISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
@@ -275,3 +277,13 @@ OnigEncodingDefine(iso_8859_1, ISO_8859_1) = {
ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-1", "ISO-8859-1")
+
+/*
+ * Name: windows-1252
+ * MIBenum: 2252
+ * Link: http://www.iana.org/assignments/character-sets
+ * Link: http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
+ * Link: http://en.wikipedia.org/wiki/Windows-1252
+ */
+ENC_REPLICATE("Windows-1252", "ISO-8859-1")
+ENC_ALIAS("CP1252", "Windows-1252")
diff --git a/enc/iso_8859_10.c b/enc/iso_8859_10.c
index ab71a5adcf..ec20a15baa 100644
--- a/enc/iso_8859_10.c
+++ b/enc/iso_8859_10.c
@@ -208,7 +208,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -219,7 +219,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_13.c b/enc/iso_8859_13.c
index 4ecf15678f..4d7b328818 100644
--- a/enc/iso_8859_13.c
+++ b/enc/iso_8859_13.c
@@ -158,10 +158,6 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSE
}
static const OnigPairCaseFoldCodes CaseFoldMap[] = {
- { 0xa8, 0xb8 },
- { 0xaa, 0xba },
- { 0xaf, 0xbf },
-
{ 0xc0, 0xe0 },
{ 0xc1, 0xe1 },
{ 0xc2, 0xe2 },
@@ -201,7 +197,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -212,7 +208,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_14.c b/enc/iso_8859_14.c
index 2939e89b7b..1271c8a7a6 100644
--- a/enc/iso_8859_14.c
+++ b/enc/iso_8859_14.c
@@ -210,7 +210,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -221,7 +221,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_15.c b/enc/iso_8859_15.c
index fdb7ca12d7..451033e158 100644
--- a/enc/iso_8859_15.c
+++ b/enc/iso_8859_15.c
@@ -204,7 +204,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -215,7 +215,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_16.c b/enc/iso_8859_16.c
index 5e53f3b6d0..5234cf0e7f 100644
--- a/enc/iso_8859_16.c
+++ b/enc/iso_8859_16.c
@@ -206,7 +206,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -217,7 +217,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_2.c b/enc/iso_8859_2.c
index 9302e62fc1..f4cb9100df 100644
--- a/enc/iso_8859_2.c
+++ b/enc/iso_8859_2.c
@@ -29,6 +29,8 @@
#include "regenc.h"
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
#define ENC_ISO_8859_2_TO_LOWER_CASE(c) EncISO_8859_2_ToLowerCaseTable[c]
#define ENC_IS_ISO_8859_2_CTYPE(code,ctype) \
((EncISO_8859_2_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
@@ -240,3 +242,13 @@ OnigEncodingDefine(iso_8859_2, ISO_8859_2) = {
ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ISO8859-2", "ISO-8859-2")
+
+/*
+ * Name: windows-1250
+ * MIBenum: 2250
+ * Link: http://www.iana.org/assignments/character-sets
+ * Link: http://www.microsoft.com/globaldev/reference/sbcs/1250.mspx
+ * Link: http://en.wikipedia.org/wiki/Windows-1250
+ */
+ENC_REPLICATE("Windows-1250", "ISO-8859-2")
+ENC_ALIAS("CP1250", "Windows-1250")
diff --git a/enc/iso_8859_3.c b/enc/iso_8859_3.c
index 863a575020..85572574b8 100644
--- a/enc/iso_8859_3.c
+++ b/enc/iso_8859_3.c
@@ -204,7 +204,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -215,7 +215,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_4.c b/enc/iso_8859_4.c
index 6a74406303..771a2cf6e7 100644
--- a/enc/iso_8859_4.c
+++ b/enc/iso_8859_4.c
@@ -166,7 +166,6 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
{ 0xab, 0xbb },
{ 0xac, 0xbc },
{ 0xae, 0xbe },
- { 0xbd, 0xbf },
{ 0xc0, 0xe0 },
{ 0xc1, 0xe1 },
@@ -207,7 +206,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -218,7 +217,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_5.c b/enc/iso_8859_5.c
index e71a488c4c..4ee27b10d8 100644
--- a/enc/iso_8859_5.c
+++ b/enc/iso_8859_5.c
@@ -194,7 +194,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -205,7 +205,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/iso_8859_7.c b/enc/iso_8859_7.c
index 8d07cb6310..aa82f880f9 100644
--- a/enc/iso_8859_7.c
+++ b/enc/iso_8859_7.c
@@ -190,7 +190,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -201,7 +201,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/iso_8859_9.c b/enc/iso_8859_9.c
index 211ba3b2f3..0adafa3ed4 100644
--- a/enc/iso_8859_9.c
+++ b/enc/iso_8859_9.c
@@ -197,7 +197,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, f, arg);
}
@@ -208,7 +208,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 1,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/jis/props.h b/enc/jis/props.h
deleted file mode 100644
index 4ae2e1fd23..0000000000
--- a/enc/jis/props.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property enc/jis/props.kwd */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "enc/jis/props.kwd"
-/* -*- c -*- */
-#define GPERF_DOWNCASE 1
-#define GPERF_CASE_STRNCMP 1
-
-static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
-{
- const UChar *str = (const UChar *)s1;
- const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
-}
-
-enum onigenc_jis_ctype {
- onigenc_jis_min = ONIGENC_MAX_STD_CTYPE,
- onigenc_jis_hiragana,
- onigenc_jis_katakana,
- onigenc_jis_han,
- onigenc_jis_latin,
- onigenc_jis_greek,
- onigenc_jis_cyrillic,
- onigenc_jis_max
-};
-
-enum {PropertyListNum = onigenc_jis_max - onigenc_jis_min - 1};
-
-static const OnigCodePoint* const PropertyList[PropertyListNum] = {
- CR_Hiragana,
- CR_Katakana,
- CR_Han,
- CR_Latin,
- CR_Greek,
- CR_Cyrillic,
-};
-
-struct enc_property {
- signed char name;
- unsigned char ctype;
-};
-
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
-#line 43 "enc/jis/props.kwd"
-struct enc_property;
-
-#define TOTAL_KEYWORDS 6
-#define MIN_WORD_LENGTH 3
-#define MAX_WORD_LENGTH 8
-#define MIN_HASH_VALUE 5
-#define MAX_HASH_VALUE 12
-/* maximum key range = 8, duplicates = 0 */
-
-#ifndef GPERF_DOWNCASE
-#define GPERF_DOWNCASE 1
-static unsigned char gperf_downcase[256] =
- {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
- 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
- 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
- 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
- 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
- 255
- };
-#endif
-
-#ifndef GPERF_CASE_STRNCMP
-#define GPERF_CASE_STRNCMP 1
-static int
-gperf_case_strncmp (s1, s2, n)
- register const char *s1;
- register const char *s2;
- register unsigned int n;
-{
- for (; n > 0;)
- {
- unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
- unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
- if (c1 != 0 && c1 == c2)
- {
- n--;
- continue;
- }
- return (int)c1 - (int)c2;
- }
- return 0;
-}
-#endif
-
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)
-inline
-#elif defined(__GNUC__)
-__inline
-#endif
-static unsigned int
-onig_jis_property_hash (str, len)
- register const char *str;
- register unsigned int len;
-{
- static const unsigned char asso_values[] =
- {
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 3, 13, 2,
- 13, 1, 1, 13, 13, 2, 1, 13, 1, 13,
- 13, 13, 1, 13, 1, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 3,
- 13, 2, 13, 1, 1, 13, 13, 2, 1, 13,
- 1, 13, 13, 13, 1, 13, 1, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13
- };
- return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
-}
-
-struct onig_jis_property_pool_t
- {
- char onig_jis_property_pool_str5[sizeof("han")];
- char onig_jis_property_pool_str7[sizeof("latin")];
- char onig_jis_property_pool_str8[sizeof("greek")];
- char onig_jis_property_pool_str10[sizeof("hiragana")];
- char onig_jis_property_pool_str11[sizeof("katakana")];
- char onig_jis_property_pool_str12[sizeof("cyrillic")];
- };
-static const struct onig_jis_property_pool_t onig_jis_property_pool_contents =
- {
- "han",
- "latin",
- "greek",
- "hiragana",
- "katakana",
- "cyrillic"
- };
-#define onig_jis_property_pool ((const char *) &onig_jis_property_pool_contents)
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct enc_property *
-onig_jis_property (str, len)
- register const char *str;
- register unsigned int len;
-{
- static const struct enc_property wordlist[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1},
-#line 48 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str5), onigenc_jis_han},
- {-1},
-#line 49 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str7), onigenc_jis_latin},
-#line 50 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str8), onigenc_jis_greek},
- {-1},
-#line 46 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str10), onigenc_jis_hiragana},
-#line 47 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str11), onigenc_jis_katakana},
-#line 51 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str12), onigenc_jis_cyrillic}
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = onig_jis_property_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = wordlist[key].name;
- if (o >= 0)
- {
- register const char *s = o + onig_jis_property_pool;
-
- if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
- return &wordlist[key];
- }
- }
- }
- return 0;
-}
-#line 52 "enc/jis/props.kwd"
-
diff --git a/enc/jis/props.h.blt b/enc/jis/props.h.blt
deleted file mode 100644
index 4ae2e1fd23..0000000000
--- a/enc/jis/props.h.blt
+++ /dev/null
@@ -1,227 +0,0 @@
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property enc/jis/props.kwd */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "enc/jis/props.kwd"
-/* -*- c -*- */
-#define GPERF_DOWNCASE 1
-#define GPERF_CASE_STRNCMP 1
-
-static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
-{
- const UChar *str = (const UChar *)s1;
- const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
-}
-
-enum onigenc_jis_ctype {
- onigenc_jis_min = ONIGENC_MAX_STD_CTYPE,
- onigenc_jis_hiragana,
- onigenc_jis_katakana,
- onigenc_jis_han,
- onigenc_jis_latin,
- onigenc_jis_greek,
- onigenc_jis_cyrillic,
- onigenc_jis_max
-};
-
-enum {PropertyListNum = onigenc_jis_max - onigenc_jis_min - 1};
-
-static const OnigCodePoint* const PropertyList[PropertyListNum] = {
- CR_Hiragana,
- CR_Katakana,
- CR_Han,
- CR_Latin,
- CR_Greek,
- CR_Cyrillic,
-};
-
-struct enc_property {
- signed char name;
- unsigned char ctype;
-};
-
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
-#line 43 "enc/jis/props.kwd"
-struct enc_property;
-
-#define TOTAL_KEYWORDS 6
-#define MIN_WORD_LENGTH 3
-#define MAX_WORD_LENGTH 8
-#define MIN_HASH_VALUE 5
-#define MAX_HASH_VALUE 12
-/* maximum key range = 8, duplicates = 0 */
-
-#ifndef GPERF_DOWNCASE
-#define GPERF_DOWNCASE 1
-static unsigned char gperf_downcase[256] =
- {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
- 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
- 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
- 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
- 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
- 255
- };
-#endif
-
-#ifndef GPERF_CASE_STRNCMP
-#define GPERF_CASE_STRNCMP 1
-static int
-gperf_case_strncmp (s1, s2, n)
- register const char *s1;
- register const char *s2;
- register unsigned int n;
-{
- for (; n > 0;)
- {
- unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
- unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
- if (c1 != 0 && c1 == c2)
- {
- n--;
- continue;
- }
- return (int)c1 - (int)c2;
- }
- return 0;
-}
-#endif
-
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)
-inline
-#elif defined(__GNUC__)
-__inline
-#endif
-static unsigned int
-onig_jis_property_hash (str, len)
- register const char *str;
- register unsigned int len;
-{
- static const unsigned char asso_values[] =
- {
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 3, 13, 2,
- 13, 1, 1, 13, 13, 2, 1, 13, 1, 13,
- 13, 13, 1, 13, 1, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 3,
- 13, 2, 13, 1, 1, 13, 13, 2, 1, 13,
- 1, 13, 13, 13, 1, 13, 1, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13
- };
- return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
-}
-
-struct onig_jis_property_pool_t
- {
- char onig_jis_property_pool_str5[sizeof("han")];
- char onig_jis_property_pool_str7[sizeof("latin")];
- char onig_jis_property_pool_str8[sizeof("greek")];
- char onig_jis_property_pool_str10[sizeof("hiragana")];
- char onig_jis_property_pool_str11[sizeof("katakana")];
- char onig_jis_property_pool_str12[sizeof("cyrillic")];
- };
-static const struct onig_jis_property_pool_t onig_jis_property_pool_contents =
- {
- "han",
- "latin",
- "greek",
- "hiragana",
- "katakana",
- "cyrillic"
- };
-#define onig_jis_property_pool ((const char *) &onig_jis_property_pool_contents)
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct enc_property *
-onig_jis_property (str, len)
- register const char *str;
- register unsigned int len;
-{
- static const struct enc_property wordlist[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1},
-#line 48 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str5), onigenc_jis_han},
- {-1},
-#line 49 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str7), onigenc_jis_latin},
-#line 50 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str8), onigenc_jis_greek},
- {-1},
-#line 46 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str10), onigenc_jis_hiragana},
-#line 47 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str11), onigenc_jis_katakana},
-#line 51 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str12), onigenc_jis_cyrillic}
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = onig_jis_property_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = wordlist[key].name;
- if (o >= 0)
- {
- register const char *s = o + onig_jis_property_pool;
-
- if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
- return &wordlist[key];
- }
- }
- }
- return 0;
-}
-#line 52 "enc/jis/props.kwd"
-
diff --git a/enc/jis/props.kwd b/enc/jis/props.kwd
deleted file mode 100644
index f3235c0100..0000000000
--- a/enc/jis/props.kwd
+++ /dev/null
@@ -1,52 +0,0 @@
-%{/* -*- c -*- */
-#define GPERF_DOWNCASE 1
-#define GPERF_CASE_STRNCMP 1
-
-static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
-{
- const UChar *str = (const UChar *)s1;
- const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
-}
-
-enum onigenc_jis_ctype {
- onigenc_jis_min = ONIGENC_MAX_STD_CTYPE,
- onigenc_jis_hiragana,
- onigenc_jis_katakana,
- onigenc_jis_han,
- onigenc_jis_latin,
- onigenc_jis_greek,
- onigenc_jis_cyrillic,
- onigenc_jis_max
-};
-
-enum {PropertyListNum = onigenc_jis_max - onigenc_jis_min - 1};
-
-static const OnigCodePoint* const PropertyList[PropertyListNum] = {
- CR_Hiragana,
- CR_Katakana,
- CR_Han,
- CR_Latin,
- CR_Greek,
- CR_Cyrillic,
-};
-
-struct enc_property {
- signed char name;
- unsigned char ctype;
-};
-
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
-%}
-
-struct enc_property;
-
-%%
-hiragana, onigenc_jis_hiragana
-katakana, onigenc_jis_katakana
-han, onigenc_jis_han
-latin, onigenc_jis_latin
-greek, onigenc_jis_greek
-cyrillic, onigenc_jis_cyrillic
-%%
diff --git a/enc/jis/props.src b/enc/jis/props.src
deleted file mode 100644
index f3235c0100..0000000000
--- a/enc/jis/props.src
+++ /dev/null
@@ -1,52 +0,0 @@
-%{/* -*- c -*- */
-#define GPERF_DOWNCASE 1
-#define GPERF_CASE_STRNCMP 1
-
-static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
-{
- const UChar *str = (const UChar *)s1;
- const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
-}
-
-enum onigenc_jis_ctype {
- onigenc_jis_min = ONIGENC_MAX_STD_CTYPE,
- onigenc_jis_hiragana,
- onigenc_jis_katakana,
- onigenc_jis_han,
- onigenc_jis_latin,
- onigenc_jis_greek,
- onigenc_jis_cyrillic,
- onigenc_jis_max
-};
-
-enum {PropertyListNum = onigenc_jis_max - onigenc_jis_min - 1};
-
-static const OnigCodePoint* const PropertyList[PropertyListNum] = {
- CR_Hiragana,
- CR_Katakana,
- CR_Han,
- CR_Latin,
- CR_Greek,
- CR_Cyrillic,
-};
-
-struct enc_property {
- signed char name;
- unsigned char ctype;
-};
-
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
-%}
-
-struct enc_property;
-
-%%
-hiragana, onigenc_jis_hiragana
-katakana, onigenc_jis_katakana
-han, onigenc_jis_han
-latin, onigenc_jis_latin
-greek, onigenc_jis_greek
-cyrillic, onigenc_jis_cyrillic
-%%
diff --git a/enc/koi8_r.c b/enc/koi8_r.c
index 85fa72287e..8ec48747f8 100644
--- a/enc/koi8_r.c
+++ b/enc/koi8_r.c
@@ -183,7 +183,7 @@ koi8_r_apply_all_case_fold(OnigCaseFoldType flag,
void* arg, OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -193,7 +193,7 @@ koi8_r_get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/koi8_u.c b/enc/koi8_u.c
index 0ae449ca21..0e51b6eb80 100644
--- a/enc/koi8_u.c
+++ b/enc/koi8_u.c
@@ -187,7 +187,7 @@ koi8_u_apply_all_case_fold(OnigCaseFoldType flag,
void* arg, OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -197,7 +197,7 @@ koi8_u_get_case_fold_codes_by_str(OnigCaseFoldType flag,
OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/make_encmake.rb b/enc/make_encmake.rb
index 4ab85f36e3..b917eca0bd 100755
--- a/enc/make_encmake.rb
+++ b/enc/make_encmake.rb
@@ -9,15 +9,12 @@ if $".grep(/mkmf/).empty?
end
require 'erb'
-CONFIG['srcdir'] = RbConfig::CONFIG['srcdir']
CONFIG["MAKEDIRS"] ||= '$(MINIRUBY) -run -e mkdir -- -p'
BUILTIN_ENCS = []
BUILTIN_TRANSES = []
ENC_PATTERNS = []
NOENC_PATTERNS = []
-TRANS_PATTERNS = []
-NOTRANS_PATTERNS = []
module_type = :dynamic
until ARGV.empty?
@@ -34,12 +31,6 @@ until ARGV.empty?
when /\A--no-encs=/
NOENC_PATTERNS.concat $'.split
ARGV.shift
- when /\A--transes=/
- TRANS_PATTERNS.concat $'.split
- ARGV.shift
- when /\A--no-transes=/
- NOTRANS_PATTERNS.concat $'.split
- ARGV.shift
when /\A--module$/
ARGV.shift
when /\A--modulestatic$/
@@ -52,7 +43,7 @@ end
ALPHANUMERIC_ORDER = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
def target_encodings
- encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS - ["mktable.c", "encinit.c"]
+ encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS - ["mktable.c"]
encs.each {|e| e.chomp!(".c")}
encs.reject! {|e| !ENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !ENC_PATTERNS.empty?
encs.reject! {|e| NOENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}}
@@ -60,7 +51,7 @@ def target_encodings
deps = Hash.new {[]}
inc_srcs = Hash.new {[]}
default_deps = %w[regenc.h oniguruma.h config.h defines.h]
- encs.delete(db = "encdb")
+ db = encs.delete("encdb")
encs.each do |e|
File.foreach("#$srcdir/#{e}.c") do |l|
if /^\s*#\s*include\s+(?:"([^\"]+)"|<(ruby\/\sw+.h)>)/ =~ l
@@ -100,14 +91,9 @@ def target_transcoders
trans -= BUILTIN_TRANSES
atrans -= BUILTIN_TRANSES
trans.uniq!
- atrans.reject! {|e| !TRANS_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !TRANS_PATTERNS.empty?
- atrans.reject! {|e| NOTRANS_PATTERNS.any? {|p| File.fnmatch?(p, e)}}
- trans.reject! {|e| !TRANS_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !TRANS_PATTERNS.empty?
- trans.reject! {|e| NOTRANS_PATTERNS.any? {|p| File.fnmatch?(p, e)}}
atrans = atrans.sort_by(&ALPHANUMERIC_ORDER)
trans = trans.sort_by(&ALPHANUMERIC_ORDER)
- trans.delete(db = "transdb")
- trans.unshift(db)
+ trans.unshift(trans.delete("transdb"))
trans.compact!
trans |= atrans
trans.map! {|e| "trans/#{e}"}
@@ -134,9 +120,8 @@ open(ARGV[0], 'wb') {|f|
f.puts mkin, dep
}
if MODULE_TYPE == :static
- filename = "encinit.c.erb"
- erb = ERB.new(File.read(File.join($srcdir, filename)), nil, '%-')
- erb.filename = "enc/#{filename}"
+ erb = ERB.new(File.read(File.join($srcdir, "encinit.c.erb")), nil, '%-')
+ erb.filename = "enc/encinit.c.cerb"
tmp = erb.result(binding)
begin
Dir.mkdir 'enc'
diff --git a/enc/prelude.rb b/enc/prelude.rb
index be7c0c9445..8ce59f957a 100644
--- a/enc/prelude.rb
+++ b/enc/prelude.rb
@@ -1,4 +1,6 @@
-begin
- require 'unicode_normalize'
-rescue LoadError
+%w'enc/encdb.so enc/trans/transdb.so'.each do |init|
+ begin
+ require(init)
+ rescue LoadError
+ end
end
diff --git a/enc/shift_jis.c b/enc/shift_jis.c
index 165592c905..5f5a802874 100644
--- a/enc/shift_jis.c
+++ b/enc/shift_jis.c
@@ -278,7 +278,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -433,6 +433,12 @@ is_allowed_reverse_match(const UChar* s, const UChar* end, OnigEncoding enc ARG_
}
+static int PropertyInited = 0;
+static const OnigCodePoint** PropertyList;
+static int PropertyListNum;
+static int PropertyListSize;
+static hash_table_type* PropertyNameTable;
+
static const OnigCodePoint CR_Hiragana[] = {
1,
0x829f, 0x82f1
@@ -487,20 +493,41 @@ static const OnigCodePoint CR_Cyrillic[] = {
0x8480, 0x8491,
}; /* CR_Cyrillic */
-#include "enc/jis/props.h"
+static int
+init_property_list(void)
+{
+ int r;
+
+ PROPERTY_LIST_ADD_PROP("hiragana", CR_Hiragana);
+ PROPERTY_LIST_ADD_PROP("katakana", CR_Katakana);
+ PROPERTY_LIST_ADD_PROP("han", CR_Han);
+ PROPERTY_LIST_ADD_PROP("latin", CR_Latin);
+ PROPERTY_LIST_ADD_PROP("greek", CR_Greek);
+ PROPERTY_LIST_ADD_PROP("cyrillic", CR_Cyrillic);
+ PropertyInited = 1;
+
+ end:
+ return r;
+}
static int
-property_name_to_ctype(OnigEncoding enc, const UChar* p, const UChar* end)
+property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
- const UChar *s = p, *e = end;
- const struct enc_property *prop =
- onig_jis_property((const char* )s, (unsigned int )(e - s));
+ hash_data_type ctype;
+ UChar *s, *e;
+
+ PROPERTY_LIST_INIT_CHECK;
- if (!prop) {
+ s = e = ALLOCA_N(UChar, end-p+1);
+ for (; p < end; p++) {
+ *e++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
+ }
+
+ if (onig_st_lookup_strend(PropertyNameTable, s, e, &ctype) == 0) {
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return (int )prop->ctype;
+ return (int )ctype;
}
static int
@@ -516,6 +543,8 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
}
}
else {
+ PROPERTY_LIST_INIT_CHECK;
+
ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= (unsigned int )PropertyListNum)
return ONIGERR_TYPE_BUG;
@@ -536,6 +565,8 @@ get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
else {
*sb_out = 0x80;
+ PROPERTY_LIST_INIT_CHECK;
+
ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= (OnigCtype )PropertyListNum)
return ONIGERR_TYPE_BUG;
diff --git a/enc/trans/JIS/JISX0201-KANA%UCS.src b/enc/trans/JIS/JISX0201-KANA%UCS.src
index d56b97f7cc..d25b580fed 100644
--- a/enc/trans/JIS/JISX0201-KANA%UCS.src
+++ b/enc/trans/JIS/JISX0201-KANA%UCS.src
@@ -12,16 +12,27 @@ BEGIN_MAP
# This mapping data is made from the mapping data provided by Unicode, Inc.
# Original notice:
#
-# JIS0201.TXT
-# Date: 2015-12-02 23:49:00 GMT [KW]
-# © 2015 Unicode®, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-#
# Name: JIS X 0201 (1976) to Unicode 1.1 Table
# Unicode version: 1.1
-# Table version: 2.0
+# Table version: 0.9
# Table format: Format A
-# Date: 2011 October 14 (header updated: 2015 December 02)
+# Date: 8 March 1994
+#
+# Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved.
+#
+# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+# No claims are made as to fitness for any particular purpose. No
+# warranties of any kind are expressed or implied. The recipient
+# agrees to determine applicability of information provided. If this
+# file has been provided on magnetic media by Unicode, Inc., the sole
+# remedy for any claim will be exchange of defective media within 90
+# days of receipt.
+#
+# Recipient is granted the right to make copies in any form for
+# internal distribution and to freely use the information supplied
+# in the creation of products supporting Unicode. Unicode, Inc.
+# specifically excludes the right to re-distribute this file directly
+# to third parties or other organizations whether for profit or not.
#
# General notes:
#
@@ -31,7 +42,15 @@ BEGIN_MAP
# same as those used by actual products, nor may they be the best suited
# for all uses. For more information on the mappings between various code
# pages incorporating the repertoire of JIS X 0201 and Unicode, consult the
-# VENDORS mapping data.
+# VENDORS mapping data. Normative information on the mapping between
+# JIS X 0201 and Unicode may be found in the Unihan.txt file in the
+# latest Unicode Character Database.
+#
+# If you have carefully considered the fact that the mappings in
+# this table are only one possible set of mappings between JIS X 0201 and
+# Unicode and have no normative status, but still feel that you
+# have located an error in the table that requires fixing, you may
+# report any such error to errata@unicode.org.
#
#
# Format: Three tab-separated columns
@@ -41,22 +60,6 @@ BEGIN_MAP
#
# The entries are in JIS order
#
-# Revision History:
-#
-# [v2.0, 2015 December 02]
-# updates to copyright notice and terms of use
-# no changes to character mappings
-#
-# [v1.0, 2011 October 14]
-# Updated terms of use to current wording.
-# Updated contact information.
-# No changes to the mapping data.
-#
-# [v0.9, 8 March 1994]
-# First release.
-#
-# Use the Unicode reporting form <http://www.unicode.org/reporting.html>
-# for any questions or comments or to report errors in the data.
#
0x21 = 0xFF61
0x22 = 0xFF62
diff --git a/enc/trans/JIS/JISX0208@1990%UCS.src b/enc/trans/JIS/JISX0208@1990%UCS.src
index 7875969b95..c2cacd422e 100644
--- a/enc/trans/JIS/JISX0208@1990%UCS.src
+++ b/enc/trans/JIS/JISX0208@1990%UCS.src
@@ -12,17 +12,27 @@ BEGIN_MAP
# This mapping data is made from the mapping data provided by Unicode, Inc.
# Original notice:
#
-#
-# JIS0208.TXT
-# Date: 2015-12-02 23:50:00 GMT [KW]
-# © 2015 Unicode®, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-#
# Name: JIS X 0208 (1990) to Unicode
# Unicode version: 1.1
-# Table version: 2.0
+# Table version: 0.9
# Table format: Format A
-# Date: 2011 October 14 (header updated: 2015 December 02)
+# Date: 8 March 1994
+#
+# Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved.
+#
+# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+# No claims are made as to fitness for any particular purpose. No
+# warranties of any kind are expressed or implied. The recipient
+# agrees to determine applicability of information provided. If this
+# file has been provided on magnetic media by Unicode, Inc., the sole
+# remedy for any claim will be exchange of defective media within 90
+# days of receipt.
+#
+# Recipient is granted the right to make copies in any form for
+# internal distribution and to freely use the information supplied
+# in the creation of products supporting Unicode. Unicode, Inc.
+# specifically excludes the right to re-distribute this file directly
+# to third parties or other organizations whether for profit or not.
#
# General notes:
#
@@ -32,7 +42,15 @@ BEGIN_MAP
# same as those used by actual products, nor may they be the best suited
# for all uses. For more information on the mappings between various code
# pages incorporating the repertoire of JIS X 0208 (1990) and Unicode, consult the
-# VENDORS mapping data.
+# VENDORS mapping data. Normative information on the mapping between
+# JIS X 0208 (1990) and Unicode may be found in the Unihan.txt file in the
+# latest Unicode Character Database.
+#
+# If you have carefully considered the fact that the mappings in
+# this table are only one possible set of mappings between JIS X 0208 (1990)
+# and Unicode and have no normative status, but still feel that you
+# have located an error in the table that requires fixing, you may
+# report any such error to errata@unicode.org.
#
#
# Format: Four tab-separated columns
@@ -59,22 +77,12 @@ BEGIN_MAP
# the kuten form. For example, 0x2121 -> 0x0101 -> 0101;
# 0x7426 -> 0x5406 -> 8406
#
-# Revision History:
-#
-# [v2.0, 2015 December 02]
-# updates to copyright notice and terms of use
-# no changes to character mappings
-#
-# [v1.0, 2011 October 14]
-# Updated terms of use to current wording.
-# Updated contact information.
-# No changes to the mapping data.
+# The kanji mappings are a normative part of ISO/IEC 10646. The
+# non-kanji mappings are provisional, pending definition of
+# official mappings by Japanese standards bodies
#
-# [v0.9, 8 March 1994]
-# First release.
+# Any comments or problems, contact <John_Jenkins@taligent.com>
#
-# Use the Unicode reporting form <http://www.unicode.org/reporting.html>
-# for any questions or comments or to report errors in the data.
#
# NetBSD specific modification:
# 2003-08-18 : change the conversion for reverse solidus (0x2140).
diff --git a/enc/trans/JIS/JISX0212%UCS.src b/enc/trans/JIS/JISX0212%UCS.src
index aa51257b99..cf4e7ecf62 100644
--- a/enc/trans/JIS/JISX0212%UCS.src
+++ b/enc/trans/JIS/JISX0212%UCS.src
@@ -12,16 +12,27 @@ BEGIN_MAP
# This mapping data is made from the mapping data provided by Unicode, Inc.
# Original notice:
#
-# JIS0212.TXT
-# Date: 2015-12-02 23:51:00 GMT [KW]
-# © 2015 Unicode®, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-#
# Name: JIS X 0212 (1990) to Unicode
# Unicode version: 1.1
-# Table version: 2.0
+# Table version: 0.9
# Table format: Format A
-# Date: 2011 October 14 (header updated: 2015 December 02)
+# Date: 8 March 1994
+#
+# Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved.
+#
+# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+# No claims are made as to fitness for any particular purpose. No
+# warranties of any kind are expressed or implied. The recipient
+# agrees to determine applicability of information provided. If this
+# file has been provided on magnetic media by Unicode, Inc., the sole
+# remedy for any claim will be exchange of defective media within 90
+# days of receipt.
+#
+# Recipient is granted the right to make copies in any form for
+# internal distribution and to freely use the information supplied
+# in the creation of products supporting Unicode. Unicode, Inc.
+# specifically excludes the right to re-distribute this file directly
+# to third parties or other organizations whether for profit or not.
#
# General notes:
#
@@ -31,7 +42,15 @@ BEGIN_MAP
# same as those used by actual products, nor may they be the best suited
# for all uses. For more information on the mappings between various code
# pages incorporating the repertoire of JIS X 0212 and Unicode, consult the
-# VENDORS mapping data.
+# VENDORS mapping data. Normative information on the mapping between
+# JIS X 0212 and Unicode may be found in the Unihan.txt file in the
+# latest Unicode Character Database.
+#
+# If you have carefully considered the fact that the mappings in
+# this table are only one possible set of mappings between JIS X 0212 and
+# Unicode and have no normative status, but still feel that you
+# have located an error in the table that requires fixing, you may
+# report any such error to errata@unicode.org.
#
#
# Format: Three tab-separated columns
@@ -57,11 +76,17 @@ BEGIN_MAP
# the kuten form. For example, 0x2121 -> 0x0101 -> 0101;
# 0x6D63 -> 0x4D43 -> 7767
#
+# The kanji mappings are a normative part of ISO/IEC 10646. The
+# non-kanji mappings are provisional, pending definition of
+# official mappings by Japanese standards bodies
+#
+# Any comments or problems, contact <John_Jenkins@taligent.com>
+#
# Notes:
#
# 1. JIS X 0212 apparently unified the following two symbols
# into a single character at 0x2922:
-#
+#
# LATIN CAPITAL LETTER D WITH STROKE
# LATIN CAPITAL LETTER ETH
#
@@ -71,24 +96,7 @@ BEGIN_MAP
# 0x2922 and 0x2942 are intended to be a capital/small pair.
# Consequently, in the Unicode mapping, 0x2922 is treated as
# LATIN CAPITAL LETTER D WITH STROKE.
-#
-# Revision History:
-#
-# [v2.0, 2015 December 02]
-# updates to copyright notice and terms of use
-# no changes to character mappings
-#
-# [v1.0, 2011 October 14]
-# Updated terms of use to current wording.
-# Updated contact information.
-# No changes to the mapping data.
-#
-# [v0.9, 8 March 1994]
-# First release.
-#
-# Use the Unicode reporting form <http://www.unicode.org/reporting.html>
-# for any questions or comments or to report errors in the data.
-#
+#
0x222F = 0x02D8
0x2230 = 0x02C7
0x2231 = 0x00B8
diff --git a/enc/trans/JIS/UCS%JISX0201-KANA.src b/enc/trans/JIS/UCS%JISX0201-KANA.src
index fac6ae8afe..57ae00f23b 100644
--- a/enc/trans/JIS/UCS%JISX0201-KANA.src
+++ b/enc/trans/JIS/UCS%JISX0201-KANA.src
@@ -12,16 +12,27 @@ BEGIN_MAP
# This mapping data is made from the mapping data provided by Unicode, Inc.
# Original notice:
#
-# JIS0201.TXT
-# Date: 2015-12-02 23:49:00 GMT [KW]
-# © 2015 Unicode®, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-#
# Name: JIS X 0201 (1976) to Unicode 1.1 Table
# Unicode version: 1.1
-# Table version: 2.0
+# Table version: 0.9
# Table format: Format A
-# Date: 2011 October 14 (header updated: 2015 December 02)
+# Date: 8 March 1994
+#
+# Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved.
+#
+# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+# No claims are made as to fitness for any particular purpose. No
+# warranties of any kind are expressed or implied. The recipient
+# agrees to determine applicability of information provided. If this
+# file has been provided on magnetic media by Unicode, Inc., the sole
+# remedy for any claim will be exchange of defective media within 90
+# days of receipt.
+#
+# Recipient is granted the right to make copies in any form for
+# internal distribution and to freely use the information supplied
+# in the creation of products supporting Unicode. Unicode, Inc.
+# specifically excludes the right to re-distribute this file directly
+# to third parties or other organizations whether for profit or not.
#
# General notes:
#
@@ -31,7 +42,15 @@ BEGIN_MAP
# same as those used by actual products, nor may they be the best suited
# for all uses. For more information on the mappings between various code
# pages incorporating the repertoire of JIS X 0201 and Unicode, consult the
-# VENDORS mapping data.
+# VENDORS mapping data. Normative information on the mapping between
+# JIS X 0201 and Unicode may be found in the Unihan.txt file in the
+# latest Unicode Character Database.
+#
+# If you have carefully considered the fact that the mappings in
+# this table are only one possible set of mappings between JIS X 0201 and
+# Unicode and have no normative status, but still feel that you
+# have located an error in the table that requires fixing, you may
+# report any such error to errata@unicode.org.
#
#
# Format: Three tab-separated columns
@@ -41,23 +60,6 @@ BEGIN_MAP
#
# The entries are in JIS order
#
-# Revision History:
-#
-# [v2.0, 2015 December 02]
-# updates to copyright notice and terms of use
-# no changes to character mappings
-#
-# [v1.0, 2011 October 14]
-# Updated terms of use to current wording.
-# Updated contact information.
-# No changes to the mapping data.
-#
-# [v0.9, 8 March 1994]
-# First release.
-#
-# Use the Unicode reporting form <http://www.unicode.org/reporting.html>
-# for any questions or comments or to report errors in the data.
-#
#
0xFF61 = 0x21
0xFF62 = 0x22
diff --git a/enc/trans/JIS/UCS%JISX0208@1990.src b/enc/trans/JIS/UCS%JISX0208@1990.src
index b06e6de231..977171ccda 100644
--- a/enc/trans/JIS/UCS%JISX0208@1990.src
+++ b/enc/trans/JIS/UCS%JISX0208@1990.src
@@ -12,16 +12,27 @@ BEGIN_MAP
# This mapping data is made from the mapping data provided by Unicode, Inc.
# Original notice:
#
-# JIS0208.TXT
-# Date: 2015-12-02 23:50:00 GMT [KW]
-# © 2015 Unicode®, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-#
# Name: JIS X 0208 (1990) to Unicode
# Unicode version: 1.1
-# Table version: 2.0
+# Table version: 0.9
# Table format: Format A
-# Date: 2011 October 14 (header updated: 2015 December 02)
+# Date: 8 March 1994
+#
+# Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved.
+#
+# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+# No claims are made as to fitness for any particular purpose. No
+# warranties of any kind are expressed or implied. The recipient
+# agrees to determine applicability of information provided. If this
+# file has been provided on magnetic media by Unicode, Inc., the sole
+# remedy for any claim will be exchange of defective media within 90
+# days of receipt.
+#
+# Recipient is granted the right to make copies in any form for
+# internal distribution and to freely use the information supplied
+# in the creation of products supporting Unicode. Unicode, Inc.
+# specifically excludes the right to re-distribute this file directly
+# to third parties or other organizations whether for profit or not.
#
# General notes:
#
@@ -31,7 +42,15 @@ BEGIN_MAP
# same as those used by actual products, nor may they be the best suited
# for all uses. For more information on the mappings between various code
# pages incorporating the repertoire of JIS X 0208 (1990) and Unicode, consult the
-# VENDORS mapping data.
+# VENDORS mapping data. Normative information on the mapping between
+# JIS X 0208 (1990) and Unicode may be found in the Unihan.txt file in the
+# latest Unicode Character Database.
+#
+# If you have carefully considered the fact that the mappings in
+# this table are only one possible set of mappings between JIS X 0208 (1990)
+# and Unicode and have no normative status, but still feel that you
+# have located an error in the table that requires fixing, you may
+# report any such error to errata@unicode.org.
#
#
# Format: Four tab-separated columns
@@ -58,22 +77,12 @@ BEGIN_MAP
# the kuten form. For example, 0x2121 -> 0x0101 -> 0101;
# 0x7426 -> 0x5406 -> 8406
#
-# Revision History:
-#
-# [v2.0, 2015 December 02]
-# updates to copyright notice and terms of use
-# no changes to character mappings
-#
-# [v1.0, 2011 October 14]
-# Updated terms of use to current wording.
-# Updated contact information.
-# No changes to the mapping data.
+# The kanji mappings are a normative part of ISO/IEC 10646. The
+# non-kanji mappings are provisional, pending definition of
+# official mappings by Japanese standards bodies
#
-# [v0.9, 8 March 1994]
-# First release.
+# Any comments or problems, contact <John_Jenkins@taligent.com>
#
-# Use the Unicode reporting form <http://www.unicode.org/reporting.html>
-# for any questions or comments or to report errors in the data.
#
# NetBSD specific modification:
# 2003-08-18 : add U+FF3C -> 0x2140 conversion.
diff --git a/enc/trans/JIS/UCS%JISX0212.src b/enc/trans/JIS/UCS%JISX0212.src
index 65383a1c9f..f3b2e7089b 100644
--- a/enc/trans/JIS/UCS%JISX0212.src
+++ b/enc/trans/JIS/UCS%JISX0212.src
@@ -12,16 +12,27 @@ BEGIN_MAP
# This mapping data is made from the mapping data provided by Unicode, Inc.
# Original notice:
#
-# JIS0212.TXT
-# Date: 2015-12-02 23:51:00 GMT [KW]
-# © 2015 Unicode®, Inc.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
-#
# Name: JIS X 0212 (1990) to Unicode
# Unicode version: 1.1
-# Table version: 2.0
+# Table version: 0.9
# Table format: Format A
-# Date: 2011 October 14 (header updated: 2015 December 02)
+# Date: 8 March 1994
+#
+# Copyright (c) 1991-1994 Unicode, Inc. All Rights reserved.
+#
+# This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+# No claims are made as to fitness for any particular purpose. No
+# warranties of any kind are expressed or implied. The recipient
+# agrees to determine applicability of information provided. If this
+# file has been provided on magnetic media by Unicode, Inc., the sole
+# remedy for any claim will be exchange of defective media within 90
+# days of receipt.
+#
+# Recipient is granted the right to make copies in any form for
+# internal distribution and to freely use the information supplied
+# in the creation of products supporting Unicode. Unicode, Inc.
+# specifically excludes the right to re-distribute this file directly
+# to third parties or other organizations whether for profit or not.
#
# General notes:
#
@@ -31,7 +42,15 @@ BEGIN_MAP
# same as those used by actual products, nor may they be the best suited
# for all uses. For more information on the mappings between various code
# pages incorporating the repertoire of JIS X 0212 and Unicode, consult the
-# VENDORS mapping data.
+# VENDORS mapping data. Normative information on the mapping between
+# JIS X 0212 and Unicode may be found in the Unihan.txt file in the
+# latest Unicode Character Database.
+#
+# If you have carefully considered the fact that the mappings in
+# this table are only one possible set of mappings between JIS X 0212 and
+# Unicode and have no normative status, but still feel that you
+# have located an error in the table that requires fixing, you may
+# report any such error to errata@unicode.org.
#
#
# Format: Three tab-separated columns
@@ -57,11 +76,17 @@ BEGIN_MAP
# the kuten form. For example, 0x2121 -> 0x0101 -> 0101;
# 0x6D63 -> 0x4D43 -> 7767
#
+# The kanji mappings are a normative part of ISO/IEC 10646. The
+# non-kanji mappings are provisional, pending definition of
+# official mappings by Japanese standards bodies
+#
+# Any comments or problems, contact <John_Jenkins@taligent.com>
+#
# Notes:
#
# 1. JIS X 0212 apparently unified the following two symbols
# into a single character at 0x2922:
-#
+#
# LATIN CAPITAL LETTER D WITH STROKE
# LATIN CAPITAL LETTER ETH
#
@@ -72,24 +97,6 @@ BEGIN_MAP
# Consequently, in the Unicode mapping, 0x2922 is treated as
# LATIN CAPITAL LETTER D WITH STROKE.
#
-# Revision History:
-#
-# [v2.0, 2015 December 02]
-# updates to copyright notice and terms of use
-# no changes to character mappings
-#
-# [v1.0, 2011 October 14]
-# Updated terms of use to current wording.
-# Updated contact information.
-# No changes to the mapping data.
-#
-# [v0.9, 8 March 1994]
-# First release.
-#
-# Use the Unicode reporting form <http://www.unicode.org/reporting.html>
-# for any questions or comments or to report errors in the data.
-#
-#
# Ruby specific modification:
# remove 0x007E to 0x2237 conversion.
#
diff --git a/enc/trans/ebcdic.trans b/enc/trans/ebcdic.trans
deleted file mode 100644
index c5b5dfec87..0000000000
--- a/enc/trans/ebcdic.trans
+++ /dev/null
@@ -1,278 +0,0 @@
-#include "transcode_data.h"
-
-<%
- us_ebcdic_map = [
- ["00", "00"],
- ["01", "01"],
- ["02", "02"],
- ["03", "03"],
- ["37", "04"],
- ["2D", "05"],
- ["2E", "06"],
- ["2F", "07"],
- ["16", "08"],
- ["05", "09"],
- ["25", "0A"],
- ["0B", "0B"],
- ["0C", "0C"],
- ["0D", "0D"],
- ["0E", "0E"],
- ["0F", "0F"],
- ["10", "10"],
- ["11", "11"],
- ["12", "12"],
- ["13", "13"],
- ["3C", "14"],
- ["3D", "15"],
- ["32", "16"],
- ["26", "17"],
- ["18", "18"],
- ["19", "19"],
- ["3F", "1A"],
- ["27", "1B"],
- ["1C", "1C"],
- ["1D", "1D"],
- ["1E", "1E"],
- ["1F", "1F"],
- ["40", "20"],
- ["5A", "21"],
- ["7F", "22"],
- ["7B", "23"],
- ["5B", "24"],
- ["6C", "25"],
- ["50", "26"],
- ["7D", "27"],
- ["4D", "28"],
- ["5D", "29"],
- ["5C", "2A"],
- ["4E", "2B"],
- ["6B", "2C"],
- ["60", "2D"],
- ["4B", "2E"],
- ["61", "2F"],
- ["F0", "30"],
- ["F1", "31"],
- ["F2", "32"],
- ["F3", "33"],
- ["F4", "34"],
- ["F5", "35"],
- ["F6", "36"],
- ["F7", "37"],
- ["F8", "38"],
- ["F9", "39"],
- ["7A", "3A"],
- ["5E", "3B"],
- ["4C", "3C"],
- ["7E", "3D"],
- ["6E", "3E"],
- ["6F", "3F"],
- ["7C", "40"],
- ["C1", "41"],
- ["C2", "42"],
- ["C3", "43"],
- ["C4", "44"],
- ["C5", "45"],
- ["C6", "46"],
- ["C7", "47"],
- ["C8", "48"],
- ["C9", "49"],
- ["D1", "4A"],
- ["D2", "4B"],
- ["D3", "4C"],
- ["D4", "4D"],
- ["D5", "4E"],
- ["D6", "4F"],
- ["D7", "50"],
- ["D8", "51"],
- ["D9", "52"],
- ["E2", "53"],
- ["E3", "54"],
- ["E4", "55"],
- ["E5", "56"],
- ["E6", "57"],
- ["E7", "58"],
- ["E8", "59"],
- ["E9", "5A"],
- ["BA", "5B"],
- ["E0", "5C"],
- ["BB", "5D"],
- ["B0", "5E"],
- ["6D", "5F"],
- ["79", "60"],
- ["81", "61"],
- ["82", "62"],
- ["83", "63"],
- ["84", "64"],
- ["85", "65"],
- ["86", "66"],
- ["87", "67"],
- ["88", "68"],
- ["89", "69"],
- ["91", "6A"],
- ["92", "6B"],
- ["93", "6C"],
- ["94", "6D"],
- ["95", "6E"],
- ["96", "6F"],
- ["97", "70"],
- ["98", "71"],
- ["99", "72"],
- ["A2", "73"],
- ["A3", "74"],
- ["A4", "75"],
- ["A5", "76"],
- ["A6", "77"],
- ["A7", "78"],
- ["A8", "79"],
- ["A9", "7A"],
- ["C0", "7B"],
- ["4F", "7C"],
- ["D0", "7D"],
- ["A1", "7E"],
- ["07", "7F"],
- ["20", "80"],
- ["21", "81"],
- ["22", "82"],
- ["23", "83"],
- ["24", "84"],
- ["15", "85"],
- ["06", "86"],
- ["17", "87"],
- ["28", "88"],
- ["29", "89"],
- ["2A", "8A"],
- ["2B", "8B"],
- ["2C", "8C"],
- ["09", "8D"],
- ["0A", "8E"],
- ["1B", "8F"],
- ["30", "90"],
- ["31", "91"],
- ["1A", "92"],
- ["33", "93"],
- ["34", "94"],
- ["35", "95"],
- ["36", "96"],
- ["08", "97"],
- ["38", "98"],
- ["39", "99"],
- ["3A", "9A"],
- ["3B", "9B"],
- ["04", "9C"],
- ["14", "9D"],
- ["3E", "9E"],
- ["FF", "9F"],
- ["41", "A0"],
- ["AA", "A1"],
- ["4A", "A2"],
- ["B1", "A3"],
- ["9F", "A4"],
- ["B2", "A5"],
- ["6A", "A6"],
- ["B5", "A7"],
- ["BD", "A8"],
- ["B4", "A9"],
- ["9A", "AA"],
- ["8A", "AB"],
- ["5F", "AC"],
- ["CA", "AD"],
- ["AF", "AE"],
- ["BC", "AF"],
- ["90", "B0"],
- ["8F", "B1"],
- ["EA", "B2"],
- ["FA", "B3"],
- ["BE", "B4"],
- ["A0", "B5"],
- ["B6", "B6"],
- ["B3", "B7"],
- ["9D", "B8"],
- ["DA", "B9"],
- ["9B", "BA"],
- ["8B", "BB"],
- ["B7", "BC"],
- ["B8", "BD"],
- ["B9", "BE"],
- ["AB", "BF"],
- ["64", "C0"],
- ["65", "C1"],
- ["62", "C2"],
- ["66", "C3"],
- ["63", "C4"],
- ["67", "C5"],
- ["9E", "C6"],
- ["68", "C7"],
- ["74", "C8"],
- ["71", "C9"],
- ["72", "CA"],
- ["73", "CB"],
- ["78", "CC"],
- ["75", "CD"],
- ["76", "CE"],
- ["77", "CF"],
- ["AC", "D0"],
- ["69", "D1"],
- ["ED", "D2"],
- ["EE", "D3"],
- ["EB", "D4"],
- ["EF", "D5"],
- ["EC", "D6"],
- ["BF", "D7"],
- ["80", "D8"],
- ["FD", "D9"],
- ["FE", "DA"],
- ["FB", "DB"],
- ["FC", "DC"],
- ["AD", "DD"],
- ["AE", "DE"],
- ["59", "DF"],
- ["44", "E0"],
- ["45", "E1"],
- ["42", "E2"],
- ["46", "E3"],
- ["43", "E4"],
- ["47", "E5"],
- ["9C", "E6"],
- ["48", "E7"],
- ["54", "E8"],
- ["51", "E9"],
- ["52", "EA"],
- ["53", "EB"],
- ["58", "EC"],
- ["55", "ED"],
- ["56", "EE"],
- ["57", "EF"],
- ["8C", "F0"],
- ["49", "F1"],
- ["CD", "F2"],
- ["CE", "F3"],
- ["CB", "F4"],
- ["CF", "F5"],
- ["CC", "F6"],
- ["E1", "F7"],
- ["70", "F8"],
- ["DD", "F9"],
- ["DE", "FA"],
- ["DB", "FB"],
- ["DC", "FC"],
- ["8D", "FD"],
- ["8E", "FE"],
- ["DF", "FF"]
-]
-
-def to_nomap (map)
- map.collect do |from, to|
- from == to ? [from, :nomap] : [from, to]
- end
-end
-
-transcode_tblgen "IBM037", "ISO-8859-1", to_nomap(us_ebcdic_map), '{00-ff}', 'asciicompat_decoder'
-transcode_tblgen "ISO-8859-1", "IBM037", to_nomap(us_ebcdic_map.map {|a,b| [b,a] }), '{00-ff}', 'asciicompat_encoder'
-%>
-
-<%= transcode_generated_code %>
-
-TRANS_INIT(ebcdic)
-{
-<%= transcode_register_code %>
-}
diff --git a/enc/trans/escape.trans b/enc/trans/escape.trans
index c76ffa0e06..550e4ac767 100644
--- a/enc/trans/escape.trans
+++ b/enc/trans/escape.trans
@@ -6,19 +6,19 @@
end
transcode_tblgen("", "amp_escape", [
- ["{00-25,27-FF}", :nomap],
+ ["{00-25,27-FF}", :nomap],
["26", hexstr("&amp;")]
], nil)
transcode_tblgen("", "xml_text_escape", [
- ["{00-25,27-3B,3D,3F-FF}", :nomap],
+ ["{00-25,27-3B,3D,3F-FF}", :nomap],
["26", hexstr("&amp;")],
["3C", hexstr("&lt;")],
["3E", hexstr("&gt;")]
], nil)
transcode_tblgen("", "xml_attr_content_escape", [
- ["{00-21,23-25,27-3B,3D,3F-FF}", :nomap],
+ ["{00-21,23-25,27-3B,3D,3F-FF}", :nomap],
["22", hexstr("&quot;")],
["26", hexstr("&amp;")],
["3C", hexstr("&lt;")],
diff --git a/enc/trans/euckr-tbl.rb b/enc/trans/euckr-tbl.rb
index 4ce8521a8a..773cd90122 100644
--- a/enc/trans/euckr-tbl.rb
+++ b/enc/trans/euckr-tbl.rb
@@ -162,8 +162,6 @@ EUCKR_TO_UCS_TBL = [
["A2E3",0x33C2],
["A2E4",0x33D8],
["A2E5",0x2121],
- ["A2E6",0x20AC],
- ["A2E7",0x00AE],
["A3A1",0xFF01],
["A3A2",0xFF02],
["A3A3",0xFF03],
diff --git a/enc/trans/gb18030.trans b/enc/trans/gb18030.trans
index f42f8fd2d5..94c866eb39 100644
--- a/enc/trans/gb18030.trans
+++ b/enc/trans/gb18030.trans
@@ -2,9 +2,9 @@
<%
require "gb18030-tbl"
-
+
def linear(code)
- bytes = [code].pack('H8').unpack 'C4'
+ bytes = [code].pack('H8').unpack 'C4'
((bytes[0]*10+bytes[1])*126+bytes[2])*10+bytes[3]
end
@@ -31,7 +31,7 @@
code
end
end
-
+
def calculate_differences_utf_gb(table)
table_rev = table.map{|a,b| [b,a]}
table_rev.collect do |code|
@@ -123,7 +123,7 @@ fun_sio_to_gb18030(void *statep, const unsigned char *s, size_t l, VALUE info, u
{
unsigned int diff = (unsigned int)(info >> 8);
unsigned int u; /* Unicode Scalar Value */
-
+
u = ((s[0]&0x0F)<<12) | ((s[1]&0x3F)<<6) | (s[2]&0x3F);
if (diff & 0x20000) { /* GB18030 4 bytes */
diff --git a/enc/unicode.c b/enc/unicode.c
index 9c0b326d0b..20990c1e54 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -2,7 +2,7 @@
unicode.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -71,6 +71,8 @@ static const unsigned short EncUNICODE_ISO_8859_1_CtypeTable[256] = {
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2
};
+#include "enc/unicode/name2ctype.h"
+
typedef struct {
int n;
OnigCodePoint code[3];
@@ -101,46 +103,10 @@ typedef struct {
CodePointList2 to;
} CaseUnfold_13_Type;
-static inline int
-bits_of(const OnigCodePoint c, const int n)
-{
- return (c >> (2 - n) * 7) & 127;
-}
-
-static inline int
-bits_at(const OnigCodePoint *c, const int n)
-{
- return bits_of(c[n / 3], n % 3);
-}
-
-static int
-code1_equal(const OnigCodePoint x, const OnigCodePoint y)
-{
- if (x != y) return 0;
- return 1;
-}
-
-static int
-code2_equal(const OnigCodePoint *x, const OnigCodePoint *y)
-{
- if (x[0] != y[0]) return 0;
- if (x[1] != y[1]) return 0;
- return 1;
-}
-
-static int
-code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
-{
- if (x[0] != y[0]) return 0;
- if (x[1] != y[1]) return 0;
- if (x[2] != y[2]) return 0;
- return 1;
-}
-
#include "enc/unicode/casefold.h"
-#include "enc/unicode/name2ctype.h"
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define CODE_RANGES_NUM numberof(CodeRanges)
extern int
@@ -177,21 +143,23 @@ onigenc_unicode_ctype_code_range(int ctype, const OnigCodePoint* ranges[])
extern int
onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
const OnigCodePoint* ranges[],
- OnigEncoding enc ARG_UNUSED)
+ struct OnigEncodingTypeST* enc ARG_UNUSED)
{
*sb_out = 0x00;
return onigenc_unicode_ctype_code_range(ctype, ranges);
}
+#include "ruby/st.h"
+
#define PROPERTY_NAME_MAX_SIZE (MAX_WORD_LENGTH + 1)
extern int
-onigenc_unicode_property_name_to_ctype(OnigEncoding enc, const UChar* name, const UChar* end)
+onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end)
{
int len;
int ctype;
UChar buf[PROPERTY_NAME_MAX_SIZE];
- const UChar *p;
+ UChar *p;
OnigCodePoint code;
len = 0;
@@ -216,21 +184,120 @@ onigenc_unicode_property_name_to_ctype(OnigEncoding enc, const UChar* name, cons
return ctype;
}
-#define onigenc_unicode_fold_lookup onigenc_unicode_CaseFold_11_lookup
-#define onigenc_unicode_unfold1_lookup onigenc_unicode_CaseUnfold_11_lookup
-#define onigenc_unicode_unfold2_lookup onigenc_unicode_CaseUnfold_12_lookup
-#define onigenc_unicode_unfold3_lookup onigenc_unicode_CaseUnfold_13_lookup
+
+static int
+code2_cmp(OnigCodePoint* x, OnigCodePoint* y)
+{
+ if (x[0] == y[0] && x[1] == y[1]) return 0;
+ return 1;
+}
+
+static st_index_t
+code2_hash(OnigCodePoint* x)
+{
+ return (st_index_t )(x[0] + x[1]);
+}
+
+static const struct st_hash_type type_code2_hash = {
+ code2_cmp,
+ code2_hash,
+};
+
+static int
+code3_cmp(OnigCodePoint* x, OnigCodePoint* y)
+{
+ if (x[0] == y[0] && x[1] == y[1] && x[2] == y[2]) return 0;
+ return 1;
+}
+
+static st_index_t
+code3_hash(OnigCodePoint* x)
+{
+ return (st_index_t )(x[0] + x[1] + x[2]);
+}
+
+static const struct st_hash_type type_code3_hash = {
+ code3_cmp,
+ code3_hash,
+};
+
+
+static st_table* FoldTable; /* fold-1, fold-2, fold-3 */
+static st_table* Unfold1Table;
+static st_table* Unfold2Table;
+static st_table* Unfold3Table;
+static int CaseFoldInited = 0;
+
+static int init_case_fold_table(void)
+{
+ const CaseFold_11_Type *p;
+ const CaseUnfold_11_Type *p1;
+ const CaseUnfold_12_Type *p2;
+ const CaseUnfold_13_Type *p3;
+ int i;
+
+ THREAD_ATOMIC_START;
+
+ FoldTable = st_init_numtable_with_size(FOLD_TABLE_SIZE);
+ if (ONIG_IS_NULL(FoldTable)) return ONIGERR_MEMORY;
+ for (i = 0; i < numberof(CaseFold); i++) {
+ p = &CaseFold[i];
+ st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )&(p->to));
+ }
+ for (i = 0; i < numberof(CaseFold_Locale); i++) {
+ p = &CaseFold_Locale[i];
+ st_add_direct(FoldTable, (st_data_t )p->from, (st_data_t )&(p->to));
+ }
+
+ Unfold1Table = st_init_numtable_with_size(UNFOLD1_TABLE_SIZE);
+ if (ONIG_IS_NULL(Unfold1Table)) return ONIGERR_MEMORY;
+
+ for (i = 0; i < numberof(CaseUnfold_11); i++) {
+ p1 = &CaseUnfold_11[i];
+ st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t )&(p1->to));
+ }
+ for (i = 0; i < numberof(CaseUnfold_11_Locale); i++) {
+ p1 = &CaseUnfold_11_Locale[i];
+ st_add_direct(Unfold1Table, (st_data_t )p1->from, (st_data_t )&(p1->to));
+ }
+
+ Unfold2Table = st_init_table_with_size(&type_code2_hash, UNFOLD2_TABLE_SIZE);
+ if (ONIG_IS_NULL(Unfold2Table)) return ONIGERR_MEMORY;
+
+ for (i = 0; i < numberof(CaseUnfold_12); i++) {
+ p2 = &CaseUnfold_12[i];
+ st_add_direct(Unfold2Table, (st_data_t )p2->from, (st_data_t )(&p2->to));
+ }
+ for (i = 0; i < numberof(CaseUnfold_12_Locale); i++) {
+ p2 = &CaseUnfold_12_Locale[i];
+ st_add_direct(Unfold2Table, (st_data_t )p2->from, (st_data_t )(&p2->to));
+ }
+
+ Unfold3Table = st_init_table_with_size(&type_code3_hash, UNFOLD3_TABLE_SIZE);
+ if (ONIG_IS_NULL(Unfold3Table)) return ONIGERR_MEMORY;
+
+ for (i = 0; i < numberof(CaseUnfold_13); i++) {
+ p3 = &CaseUnfold_13[i];
+ st_add_direct(Unfold3Table, (st_data_t )p3->from, (st_data_t )(&p3->to));
+ }
+
+ CaseFoldInited = 1;
+ THREAD_ATOMIC_END;
+ return 0;
+}
extern int
onigenc_unicode_mbc_case_fold(OnigEncoding enc,
OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end,
UChar* fold)
{
- const CodePointList3 *to;
+ CodePointList3 *to;
OnigCodePoint code;
int i, len, rlen;
const UChar *p = *pp;
+ if (CaseFoldInited == 0) init_case_fold_table();
+
code = ONIGENC_MBC_TO_CODE(enc, p, end);
len = enclen(enc, p, end);
*pp += len;
@@ -246,7 +313,7 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
}
#endif
- if ((to = onigenc_unicode_fold_lookup(code)) != 0) {
+ if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0) {
if (to->n == 1) {
return ONIGENC_CODE_TO_MBC(enc, to->code[0], fold);
}
@@ -282,6 +349,8 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
OnigCodePoint code;
int i, j, k, r;
+ /* if (CaseFoldInited == 0) init_case_fold_table(); */
+
for (i = 0; i < numberof(CaseUnfold_11); i++) {
p11 = &CaseUnfold_11[i];
for (j = 0; j < p11->to.n; j++) {
@@ -414,8 +483,10 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
{
int n, i, j, k, len;
OnigCodePoint code, codes[3];
- const CodePointList3 *to, *z3;
- const CodePointList2 *z2;
+ CodePointList3 *to, *z3;
+ CodePointList2 *z2;
+
+ if (CaseFoldInited == 0) init_case_fold_table();
n = 0;
@@ -451,7 +522,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
#endif
- if ((to = onigenc_unicode_fold_lookup(code)) != 0) {
+ if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0) {
if (to->n == 1) {
OnigCodePoint orig_code = code;
@@ -461,7 +532,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
n++;
code = to->code[0];
- if ((to = onigenc_unicode_unfold1_lookup(code)) != 0) {
+ if (onig_st_lookup(Unfold1Table, (st_data_t )code, (void* )&to) != 0) {
for (i = 0; i < to->n; i++) {
if (to->code[i] != orig_code) {
items[n].byte_len = len;
@@ -478,7 +549,8 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
for (fn = 0; fn < to->n; fn++) {
cs[fn][0] = to->code[fn];
- if ((z3 = onigenc_unicode_unfold1_lookup(cs[fn][0])) != 0) {
+ if (onig_st_lookup(Unfold1Table, (st_data_t )cs[fn][0],
+ (void* )&z3) != 0) {
for (i = 0; i < z3->n; i++) {
cs[fn][i+1] = z3->code[i];
}
@@ -499,7 +571,8 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
}
- if ((z2 = onigenc_unicode_unfold2_lookup(to->code)) != 0) {
+ if (onig_st_lookup(Unfold2Table, (st_data_t )to->code,
+ (void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
@@ -524,7 +597,8 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
}
- if ((z2 = onigenc_unicode_unfold3_lookup(to->code)) != 0) {
+ if (onig_st_lookup(Unfold3Table, (st_data_t )to->code,
+ (void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
@@ -541,7 +615,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
}
else {
- if ((to = onigenc_unicode_unfold1_lookup(code)) != 0) {
+ if (onig_st_lookup(Unfold1Table, (st_data_t )code, (void* )&to) != 0) {
for (i = 0; i < to->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
@@ -559,7 +633,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
codes[0] = code;
code = ONIGENC_MBC_TO_CODE(enc, p, end);
- if ((to = onigenc_unicode_fold_lookup(code)) != 0
+ if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
&& to->n == 1) {
codes[1] = to->code[0];
}
@@ -568,7 +642,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
clen = enclen(enc, p, end);
len += clen;
- if ((z2 = onigenc_unicode_unfold2_lookup(codes)) != 0) {
+ if (onig_st_lookup(Unfold2Table, (st_data_t )codes, (void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
@@ -580,7 +654,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
p += clen;
if (p < end) {
code = ONIGENC_MBC_TO_CODE(enc, p, end);
- if ((to = onigenc_unicode_fold_lookup(code)) != 0
+ if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
&& to->n == 1) {
codes[2] = to->code[0];
}
@@ -589,7 +663,8 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
clen = enclen(enc, p, end);
len += clen;
- if ((z2 = onigenc_unicode_unfold3_lookup(codes)) != 0) {
+ if (onig_st_lookup(Unfold3Table, (st_data_t )codes,
+ (void* )&z2) != 0) {
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb
deleted file mode 100755
index d93de6581b..0000000000
--- a/enc/unicode/case-folding.rb
+++ /dev/null
@@ -1,196 +0,0 @@
-#!/usr/bin/ruby
-
-# Usage:
-# $ wget http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
-# $ ruby case-folding.rb CaseFolding.txt -o casefold.h
-
-class CaseFolding
- module Util
- module_function
-
- def hex_seq(v)
- v.map {|i| "0x%04x" % i}.join(", ")
- end
-
- def print_table_1(dest, data)
- for k, v in data = data.sort
- sk = (Array === k and k.length > 1) ? "{#{hex_seq(k)}}" : ("0x%04x" % k)
- dest.print(" {#{sk}, {#{v.length}, {#{hex_seq(v)}}}},\n")
- end
- data
- end
-
- def print_table(dest, type, data)
- dest.print("static const #{type}_Type #{type}_Table[] = {\n")
- i = 0
- ret = data.inject([]) do |a, (n, d)|
- dest.print("#define #{n} (*(#{type}_Type (*)[#{d.size}])(#{type}_Table+#{i}))\n")
- i += d.size
- a.concat(print_table_1(dest, d))
- end
- dest.print("};\n\n")
- ret
- end
- end
-
- include Util
-
- attr_reader :fold, :fold_locale, :unfold, :unfold_locale
-
- def load(filename)
- pattern = /([0-9A-F]{4,6}); ([CFT]); ([0-9A-F]{4,6})(?: ([0-9A-F]{4,6}))?(?: ([0-9A-F]{4,6}))?;/
-
- @fold = fold = {}
- @unfold = unfold = [{}, {}, {}]
- turkic = []
-
- IO.foreach(filename) do |line|
- next unless res = pattern.match(line)
- ch_from = res[1].to_i(16)
-
- if res[2] == 'T'
- # Turkic case folding
- turkic << ch_from
- next
- end
-
- # store folding data
- ch_to = res[3..6].inject([]) do |a, i|
- break a unless i
- a << i.to_i(16)
- end
- fold[ch_from] = ch_to
-
- # store unfolding data
- i = ch_to.length - 1
- (unfold[i][ch_to] ||= []) << ch_from
- end
-
- # move locale dependent data to (un)fold_locale
- @fold_locale = fold_locale = {}
- @unfold_locale = unfold_locale = [{}, {}]
- for ch_from in turkic
- key = fold[ch_from]
- i = key.length - 1
- unfold_locale[i][i == 0 ? key[0] : key] = unfold[i].delete(key)
- fold_locale[ch_from] = fold.delete(ch_from)
- end
- self
- end
-
- def range_check(code)
- "#{code} <= MAX_CODE_VALUE && #{code} >= MIN_CODE_VALUE"
- end
-
- def lookup_hash(key, type, data)
- hash = "onigenc_unicode_#{key}_hash"
- lookup = "onigenc_unicode_#{key}_lookup"
- arity = Array(data[0][0]).size
- gperf = %W"gperf -7 -k#{[*1..(arity*3)].join(",")} -F,-1 -c -j1 -i1 -t -T -E -C -H #{hash} -N #{lookup} -n"
- argname = arity > 1 ? "codes" : "code"
- argdecl = "const OnigCodePoint #{arity > 1 ? "*": ""}#{argname}"
- n = 7
- m = (1 << n) - 1
- min, max = data.map {|c, *|c}.flatten.minmax
- src = IO.popen(gperf, "r+") {|f|
- f << "short\n%%\n"
- data.each_with_index {|(k, _), i|
- k = Array(k)
- ks = k.map {|j| [(j >> n*2) & m, (j >> n) & m, (j) & m]}.flatten.map {|c| "\\x%.2x" % c}.join("")
- f.printf "\"%s\", ::::/*%s*/ %d\n", ks, k.map {|c| "0x%.4x" % c}.join(","), i
- }
- f << "%%\n"
- f.close_write
- f.read
- }
- src.sub!(/^(#{hash})\s*\(.*?\).*?\n\{\n(.*)^\}/m) {
- name = $1
- body = $2
- body.gsub!(/\(unsigned char\)str\[(\d+)\]/, "bits_#{arity > 1 ? 'at' : 'of'}(#{argname}, \\1)")
- "#{name}(#{argdecl})\n{\n#{body}}"
- }
- src.sub!(/const short *\*\n^(#{lookup})\s*\(.*?\).*?\n\{\n(.*)^\}/m) {
- name = $1
- body = $2
- body.sub!(/\benum\s+\{(\n[ \t]+)/, "\\&MIN_CODE_VALUE = 0x#{min.to_s(16)},\\1""MAX_CODE_VALUE = 0x#{max.to_s(16)},\\1")
- body.gsub!(/(#{hash})\s*\(.*?\)/, "\\1(#{argname})")
- body.gsub!(/\{"",-1}/, "-1")
- body.gsub!(/\{"(?:[^"]|\\")+", *::::(.*)\}/, '\1')
- body.sub!(/(\s+if\s)\(len\b.*\)/) do
- "#$1(" <<
- (arity > 1 ? (0...arity).map {|i| range_check("#{argname}[#{i}]")}.join(" &&\n ") : range_check(argname)) <<
- ")"
- end
- v = nil
- body.sub!(/(if\s*\(.*MAX_HASH_VALUE.*\)\n([ \t]*))\{(.*?)\n\2\}/m) {
- pre = $1
- indent = $2
- s = $3
- s.sub!(/const char *\* *(\w+)( *= *wordlist\[\w+\]).\w+/, 'short \1 = wordlist[key]')
- v = $1
- s.sub!(/\bif *\(.*\)/, "if (#{v} >= 0 && code#{arity}_equal(#{argname}, #{key}_Table[#{v}].from))")
- "#{pre}{#{s}\n#{indent}}"
- }
- body.sub!(/\b(return\s+&)([^;]+);/, '\1'"#{key}_Table[#{v}].to;")
- "static const #{type} *\n#{name}(#{argdecl})\n{\n#{body}}"
- }
- src
- end
-
- def display(dest)
- # print the header
- dest.print("/* DO NOT EDIT THIS FILE. */\n")
- dest.print("/* Generated by enc/unicode/case-folding.rb */\n\n")
-
- # print folding data
-
- # CaseFold + CaseFold_Locale
- name = "CaseFold_11"
- data = print_table(dest, name, "CaseFold"=>fold, "CaseFold_Locale"=>fold_locale)
- dest.print lookup_hash(name, "CodePointList3", data)
-
- # print unfolding data
-
- # CaseUnfold_11 + CaseUnfold_11_Locale
- name = "CaseUnfold_11"
- data = print_table(dest, name, name=>unfold[0], "#{name}_Locale"=>unfold_locale[0])
- dest.print lookup_hash(name, "CodePointList3", data)
-
- # CaseUnfold_12 + CaseUnfold_12_Locale
- name = "CaseUnfold_12"
- data = print_table(dest, name, name=>unfold[1], "#{name}_Locale"=>unfold_locale[1])
- dest.print lookup_hash(name, "CodePointList2", data)
-
- # CaseUnfold_13
- name = "CaseUnfold_13"
- data = print_table(dest, name, name=>unfold[2])
- dest.print lookup_hash(name, "CodePointList2", data)
- end
-
- def self.load(*args)
- new.load(*args)
- end
-end
-
-if $0 == __FILE__
- require 'optparse'
- dest = nil
- fold_1 = false
- ARGV.options do |opt|
- opt.banner << " [INPUT]"
- opt.on("--output-file=FILE", "-o", "output to the FILE instead of STDOUT") {|output|
- dest = (output unless output == '-')
- }
- opt.parse!
- abort(opt.to_s) if ARGV.size > 1
- end
- filename = ARGV[0] || 'CaseFolding.txt'
- data = CaseFolding.load(filename)
- if dest
- open(dest, "wb") do |f|
- data.display(f)
- end
- else
- data.display(STDOUT)
- end
-end
diff --git a/enc/unicode/casefold.h b/enc/unicode/casefold.h
index f29f404f0a..b9559de4a3 100644
--- a/enc/unicode/casefold.h
+++ b/enc/unicode/casefold.h
@@ -1,6248 +1,2238 @@
/* DO NOT EDIT THIS FILE. */
-/* Generated by enc/unicode/case-folding.rb */
+/* Generated by tool/CaseFolding.py */
-static const CaseFold_11_Type CaseFold_11_Table[] = {
-#define CaseFold (*(CaseFold_11_Type (*)[1319])(CaseFold_11_Table+0))
- {0x0041, {1, {0x0061}}},
- {0x0042, {1, {0x0062}}},
- {0x0043, {1, {0x0063}}},
- {0x0044, {1, {0x0064}}},
- {0x0045, {1, {0x0065}}},
- {0x0046, {1, {0x0066}}},
- {0x0047, {1, {0x0067}}},
- {0x0048, {1, {0x0068}}},
- {0x004a, {1, {0x006a}}},
- {0x004b, {1, {0x006b}}},
- {0x004c, {1, {0x006c}}},
- {0x004d, {1, {0x006d}}},
- {0x004e, {1, {0x006e}}},
- {0x004f, {1, {0x006f}}},
- {0x0050, {1, {0x0070}}},
- {0x0051, {1, {0x0071}}},
- {0x0052, {1, {0x0072}}},
- {0x0053, {1, {0x0073}}},
- {0x0054, {1, {0x0074}}},
- {0x0055, {1, {0x0075}}},
- {0x0056, {1, {0x0076}}},
- {0x0057, {1, {0x0077}}},
- {0x0058, {1, {0x0078}}},
- {0x0059, {1, {0x0079}}},
- {0x005a, {1, {0x007a}}},
- {0x00b5, {1, {0x03bc}}},
- {0x00c0, {1, {0x00e0}}},
- {0x00c1, {1, {0x00e1}}},
- {0x00c2, {1, {0x00e2}}},
- {0x00c3, {1, {0x00e3}}},
- {0x00c4, {1, {0x00e4}}},
- {0x00c5, {1, {0x00e5}}},
- {0x00c6, {1, {0x00e6}}},
- {0x00c7, {1, {0x00e7}}},
- {0x00c8, {1, {0x00e8}}},
- {0x00c9, {1, {0x00e9}}},
- {0x00ca, {1, {0x00ea}}},
- {0x00cb, {1, {0x00eb}}},
- {0x00cc, {1, {0x00ec}}},
- {0x00cd, {1, {0x00ed}}},
- {0x00ce, {1, {0x00ee}}},
- {0x00cf, {1, {0x00ef}}},
- {0x00d0, {1, {0x00f0}}},
- {0x00d1, {1, {0x00f1}}},
- {0x00d2, {1, {0x00f2}}},
- {0x00d3, {1, {0x00f3}}},
- {0x00d4, {1, {0x00f4}}},
- {0x00d5, {1, {0x00f5}}},
- {0x00d6, {1, {0x00f6}}},
- {0x00d8, {1, {0x00f8}}},
- {0x00d9, {1, {0x00f9}}},
- {0x00da, {1, {0x00fa}}},
- {0x00db, {1, {0x00fb}}},
- {0x00dc, {1, {0x00fc}}},
- {0x00dd, {1, {0x00fd}}},
- {0x00de, {1, {0x00fe}}},
- {0x00df, {2, {0x0073, 0x0073}}},
- {0x0100, {1, {0x0101}}},
- {0x0102, {1, {0x0103}}},
- {0x0104, {1, {0x0105}}},
- {0x0106, {1, {0x0107}}},
- {0x0108, {1, {0x0109}}},
- {0x010a, {1, {0x010b}}},
- {0x010c, {1, {0x010d}}},
- {0x010e, {1, {0x010f}}},
- {0x0110, {1, {0x0111}}},
- {0x0112, {1, {0x0113}}},
- {0x0114, {1, {0x0115}}},
- {0x0116, {1, {0x0117}}},
- {0x0118, {1, {0x0119}}},
- {0x011a, {1, {0x011b}}},
- {0x011c, {1, {0x011d}}},
- {0x011e, {1, {0x011f}}},
- {0x0120, {1, {0x0121}}},
- {0x0122, {1, {0x0123}}},
- {0x0124, {1, {0x0125}}},
- {0x0126, {1, {0x0127}}},
- {0x0128, {1, {0x0129}}},
- {0x012a, {1, {0x012b}}},
- {0x012c, {1, {0x012d}}},
- {0x012e, {1, {0x012f}}},
- {0x0132, {1, {0x0133}}},
- {0x0134, {1, {0x0135}}},
- {0x0136, {1, {0x0137}}},
- {0x0139, {1, {0x013a}}},
- {0x013b, {1, {0x013c}}},
- {0x013d, {1, {0x013e}}},
- {0x013f, {1, {0x0140}}},
- {0x0141, {1, {0x0142}}},
- {0x0143, {1, {0x0144}}},
- {0x0145, {1, {0x0146}}},
- {0x0147, {1, {0x0148}}},
- {0x0149, {2, {0x02bc, 0x006e}}},
- {0x014a, {1, {0x014b}}},
- {0x014c, {1, {0x014d}}},
- {0x014e, {1, {0x014f}}},
- {0x0150, {1, {0x0151}}},
- {0x0152, {1, {0x0153}}},
- {0x0154, {1, {0x0155}}},
- {0x0156, {1, {0x0157}}},
- {0x0158, {1, {0x0159}}},
- {0x015a, {1, {0x015b}}},
- {0x015c, {1, {0x015d}}},
- {0x015e, {1, {0x015f}}},
- {0x0160, {1, {0x0161}}},
- {0x0162, {1, {0x0163}}},
- {0x0164, {1, {0x0165}}},
- {0x0166, {1, {0x0167}}},
- {0x0168, {1, {0x0169}}},
- {0x016a, {1, {0x016b}}},
- {0x016c, {1, {0x016d}}},
- {0x016e, {1, {0x016f}}},
- {0x0170, {1, {0x0171}}},
- {0x0172, {1, {0x0173}}},
- {0x0174, {1, {0x0175}}},
- {0x0176, {1, {0x0177}}},
- {0x0178, {1, {0x00ff}}},
- {0x0179, {1, {0x017a}}},
- {0x017b, {1, {0x017c}}},
- {0x017d, {1, {0x017e}}},
- {0x017f, {1, {0x0073}}},
- {0x0181, {1, {0x0253}}},
- {0x0182, {1, {0x0183}}},
- {0x0184, {1, {0x0185}}},
- {0x0186, {1, {0x0254}}},
- {0x0187, {1, {0x0188}}},
- {0x0189, {1, {0x0256}}},
- {0x018a, {1, {0x0257}}},
- {0x018b, {1, {0x018c}}},
- {0x018e, {1, {0x01dd}}},
- {0x018f, {1, {0x0259}}},
- {0x0190, {1, {0x025b}}},
- {0x0191, {1, {0x0192}}},
- {0x0193, {1, {0x0260}}},
- {0x0194, {1, {0x0263}}},
- {0x0196, {1, {0x0269}}},
- {0x0197, {1, {0x0268}}},
- {0x0198, {1, {0x0199}}},
- {0x019c, {1, {0x026f}}},
- {0x019d, {1, {0x0272}}},
- {0x019f, {1, {0x0275}}},
- {0x01a0, {1, {0x01a1}}},
- {0x01a2, {1, {0x01a3}}},
- {0x01a4, {1, {0x01a5}}},
- {0x01a6, {1, {0x0280}}},
- {0x01a7, {1, {0x01a8}}},
- {0x01a9, {1, {0x0283}}},
- {0x01ac, {1, {0x01ad}}},
- {0x01ae, {1, {0x0288}}},
- {0x01af, {1, {0x01b0}}},
- {0x01b1, {1, {0x028a}}},
- {0x01b2, {1, {0x028b}}},
- {0x01b3, {1, {0x01b4}}},
- {0x01b5, {1, {0x01b6}}},
- {0x01b7, {1, {0x0292}}},
- {0x01b8, {1, {0x01b9}}},
- {0x01bc, {1, {0x01bd}}},
- {0x01c4, {1, {0x01c6}}},
- {0x01c5, {1, {0x01c6}}},
- {0x01c7, {1, {0x01c9}}},
- {0x01c8, {1, {0x01c9}}},
- {0x01ca, {1, {0x01cc}}},
- {0x01cb, {1, {0x01cc}}},
- {0x01cd, {1, {0x01ce}}},
- {0x01cf, {1, {0x01d0}}},
- {0x01d1, {1, {0x01d2}}},
- {0x01d3, {1, {0x01d4}}},
- {0x01d5, {1, {0x01d6}}},
- {0x01d7, {1, {0x01d8}}},
- {0x01d9, {1, {0x01da}}},
- {0x01db, {1, {0x01dc}}},
- {0x01de, {1, {0x01df}}},
- {0x01e0, {1, {0x01e1}}},
- {0x01e2, {1, {0x01e3}}},
- {0x01e4, {1, {0x01e5}}},
- {0x01e6, {1, {0x01e7}}},
- {0x01e8, {1, {0x01e9}}},
- {0x01ea, {1, {0x01eb}}},
- {0x01ec, {1, {0x01ed}}},
- {0x01ee, {1, {0x01ef}}},
- {0x01f0, {2, {0x006a, 0x030c}}},
- {0x01f1, {1, {0x01f3}}},
- {0x01f2, {1, {0x01f3}}},
- {0x01f4, {1, {0x01f5}}},
- {0x01f6, {1, {0x0195}}},
- {0x01f7, {1, {0x01bf}}},
- {0x01f8, {1, {0x01f9}}},
- {0x01fa, {1, {0x01fb}}},
- {0x01fc, {1, {0x01fd}}},
- {0x01fe, {1, {0x01ff}}},
- {0x0200, {1, {0x0201}}},
- {0x0202, {1, {0x0203}}},
- {0x0204, {1, {0x0205}}},
- {0x0206, {1, {0x0207}}},
- {0x0208, {1, {0x0209}}},
- {0x020a, {1, {0x020b}}},
- {0x020c, {1, {0x020d}}},
- {0x020e, {1, {0x020f}}},
- {0x0210, {1, {0x0211}}},
- {0x0212, {1, {0x0213}}},
- {0x0214, {1, {0x0215}}},
- {0x0216, {1, {0x0217}}},
- {0x0218, {1, {0x0219}}},
- {0x021a, {1, {0x021b}}},
- {0x021c, {1, {0x021d}}},
- {0x021e, {1, {0x021f}}},
- {0x0220, {1, {0x019e}}},
- {0x0222, {1, {0x0223}}},
- {0x0224, {1, {0x0225}}},
- {0x0226, {1, {0x0227}}},
- {0x0228, {1, {0x0229}}},
- {0x022a, {1, {0x022b}}},
- {0x022c, {1, {0x022d}}},
- {0x022e, {1, {0x022f}}},
- {0x0230, {1, {0x0231}}},
- {0x0232, {1, {0x0233}}},
- {0x023a, {1, {0x2c65}}},
- {0x023b, {1, {0x023c}}},
- {0x023d, {1, {0x019a}}},
- {0x023e, {1, {0x2c66}}},
- {0x0241, {1, {0x0242}}},
- {0x0243, {1, {0x0180}}},
- {0x0244, {1, {0x0289}}},
- {0x0245, {1, {0x028c}}},
- {0x0246, {1, {0x0247}}},
- {0x0248, {1, {0x0249}}},
- {0x024a, {1, {0x024b}}},
- {0x024c, {1, {0x024d}}},
- {0x024e, {1, {0x024f}}},
- {0x0345, {1, {0x03b9}}},
- {0x0370, {1, {0x0371}}},
- {0x0372, {1, {0x0373}}},
- {0x0376, {1, {0x0377}}},
- {0x037f, {1, {0x03f3}}},
- {0x0386, {1, {0x03ac}}},
- {0x0388, {1, {0x03ad}}},
- {0x0389, {1, {0x03ae}}},
- {0x038a, {1, {0x03af}}},
- {0x038c, {1, {0x03cc}}},
- {0x038e, {1, {0x03cd}}},
- {0x038f, {1, {0x03ce}}},
- {0x0390, {3, {0x03b9, 0x0308, 0x0301}}},
- {0x0391, {1, {0x03b1}}},
- {0x0392, {1, {0x03b2}}},
- {0x0393, {1, {0x03b3}}},
- {0x0394, {1, {0x03b4}}},
- {0x0395, {1, {0x03b5}}},
- {0x0396, {1, {0x03b6}}},
- {0x0397, {1, {0x03b7}}},
- {0x0398, {1, {0x03b8}}},
- {0x0399, {1, {0x03b9}}},
- {0x039a, {1, {0x03ba}}},
- {0x039b, {1, {0x03bb}}},
- {0x039c, {1, {0x03bc}}},
- {0x039d, {1, {0x03bd}}},
- {0x039e, {1, {0x03be}}},
- {0x039f, {1, {0x03bf}}},
- {0x03a0, {1, {0x03c0}}},
- {0x03a1, {1, {0x03c1}}},
- {0x03a3, {1, {0x03c3}}},
- {0x03a4, {1, {0x03c4}}},
- {0x03a5, {1, {0x03c5}}},
- {0x03a6, {1, {0x03c6}}},
- {0x03a7, {1, {0x03c7}}},
- {0x03a8, {1, {0x03c8}}},
- {0x03a9, {1, {0x03c9}}},
- {0x03aa, {1, {0x03ca}}},
- {0x03ab, {1, {0x03cb}}},
- {0x03b0, {3, {0x03c5, 0x0308, 0x0301}}},
- {0x03c2, {1, {0x03c3}}},
- {0x03cf, {1, {0x03d7}}},
- {0x03d0, {1, {0x03b2}}},
- {0x03d1, {1, {0x03b8}}},
- {0x03d5, {1, {0x03c6}}},
- {0x03d6, {1, {0x03c0}}},
- {0x03d8, {1, {0x03d9}}},
- {0x03da, {1, {0x03db}}},
- {0x03dc, {1, {0x03dd}}},
- {0x03de, {1, {0x03df}}},
- {0x03e0, {1, {0x03e1}}},
- {0x03e2, {1, {0x03e3}}},
- {0x03e4, {1, {0x03e5}}},
- {0x03e6, {1, {0x03e7}}},
- {0x03e8, {1, {0x03e9}}},
- {0x03ea, {1, {0x03eb}}},
- {0x03ec, {1, {0x03ed}}},
- {0x03ee, {1, {0x03ef}}},
- {0x03f0, {1, {0x03ba}}},
- {0x03f1, {1, {0x03c1}}},
- {0x03f4, {1, {0x03b8}}},
- {0x03f5, {1, {0x03b5}}},
- {0x03f7, {1, {0x03f8}}},
- {0x03f9, {1, {0x03f2}}},
- {0x03fa, {1, {0x03fb}}},
- {0x03fd, {1, {0x037b}}},
- {0x03fe, {1, {0x037c}}},
- {0x03ff, {1, {0x037d}}},
- {0x0400, {1, {0x0450}}},
- {0x0401, {1, {0x0451}}},
- {0x0402, {1, {0x0452}}},
- {0x0403, {1, {0x0453}}},
- {0x0404, {1, {0x0454}}},
- {0x0405, {1, {0x0455}}},
- {0x0406, {1, {0x0456}}},
- {0x0407, {1, {0x0457}}},
- {0x0408, {1, {0x0458}}},
- {0x0409, {1, {0x0459}}},
- {0x040a, {1, {0x045a}}},
- {0x040b, {1, {0x045b}}},
- {0x040c, {1, {0x045c}}},
- {0x040d, {1, {0x045d}}},
- {0x040e, {1, {0x045e}}},
- {0x040f, {1, {0x045f}}},
- {0x0410, {1, {0x0430}}},
- {0x0411, {1, {0x0431}}},
- {0x0412, {1, {0x0432}}},
- {0x0413, {1, {0x0433}}},
- {0x0414, {1, {0x0434}}},
- {0x0415, {1, {0x0435}}},
- {0x0416, {1, {0x0436}}},
- {0x0417, {1, {0x0437}}},
- {0x0418, {1, {0x0438}}},
- {0x0419, {1, {0x0439}}},
- {0x041a, {1, {0x043a}}},
- {0x041b, {1, {0x043b}}},
- {0x041c, {1, {0x043c}}},
- {0x041d, {1, {0x043d}}},
- {0x041e, {1, {0x043e}}},
- {0x041f, {1, {0x043f}}},
- {0x0420, {1, {0x0440}}},
- {0x0421, {1, {0x0441}}},
- {0x0422, {1, {0x0442}}},
- {0x0423, {1, {0x0443}}},
- {0x0424, {1, {0x0444}}},
- {0x0425, {1, {0x0445}}},
- {0x0426, {1, {0x0446}}},
- {0x0427, {1, {0x0447}}},
- {0x0428, {1, {0x0448}}},
- {0x0429, {1, {0x0449}}},
- {0x042a, {1, {0x044a}}},
- {0x042b, {1, {0x044b}}},
- {0x042c, {1, {0x044c}}},
- {0x042d, {1, {0x044d}}},
- {0x042e, {1, {0x044e}}},
- {0x042f, {1, {0x044f}}},
- {0x0460, {1, {0x0461}}},
- {0x0462, {1, {0x0463}}},
- {0x0464, {1, {0x0465}}},
- {0x0466, {1, {0x0467}}},
- {0x0468, {1, {0x0469}}},
- {0x046a, {1, {0x046b}}},
- {0x046c, {1, {0x046d}}},
- {0x046e, {1, {0x046f}}},
- {0x0470, {1, {0x0471}}},
- {0x0472, {1, {0x0473}}},
- {0x0474, {1, {0x0475}}},
- {0x0476, {1, {0x0477}}},
- {0x0478, {1, {0x0479}}},
- {0x047a, {1, {0x047b}}},
- {0x047c, {1, {0x047d}}},
- {0x047e, {1, {0x047f}}},
- {0x0480, {1, {0x0481}}},
- {0x048a, {1, {0x048b}}},
- {0x048c, {1, {0x048d}}},
- {0x048e, {1, {0x048f}}},
- {0x0490, {1, {0x0491}}},
- {0x0492, {1, {0x0493}}},
- {0x0494, {1, {0x0495}}},
- {0x0496, {1, {0x0497}}},
- {0x0498, {1, {0x0499}}},
- {0x049a, {1, {0x049b}}},
- {0x049c, {1, {0x049d}}},
- {0x049e, {1, {0x049f}}},
- {0x04a0, {1, {0x04a1}}},
- {0x04a2, {1, {0x04a3}}},
- {0x04a4, {1, {0x04a5}}},
- {0x04a6, {1, {0x04a7}}},
- {0x04a8, {1, {0x04a9}}},
- {0x04aa, {1, {0x04ab}}},
- {0x04ac, {1, {0x04ad}}},
- {0x04ae, {1, {0x04af}}},
- {0x04b0, {1, {0x04b1}}},
- {0x04b2, {1, {0x04b3}}},
- {0x04b4, {1, {0x04b5}}},
- {0x04b6, {1, {0x04b7}}},
- {0x04b8, {1, {0x04b9}}},
- {0x04ba, {1, {0x04bb}}},
- {0x04bc, {1, {0x04bd}}},
- {0x04be, {1, {0x04bf}}},
- {0x04c0, {1, {0x04cf}}},
- {0x04c1, {1, {0x04c2}}},
- {0x04c3, {1, {0x04c4}}},
- {0x04c5, {1, {0x04c6}}},
- {0x04c7, {1, {0x04c8}}},
- {0x04c9, {1, {0x04ca}}},
- {0x04cb, {1, {0x04cc}}},
- {0x04cd, {1, {0x04ce}}},
- {0x04d0, {1, {0x04d1}}},
- {0x04d2, {1, {0x04d3}}},
- {0x04d4, {1, {0x04d5}}},
- {0x04d6, {1, {0x04d7}}},
- {0x04d8, {1, {0x04d9}}},
- {0x04da, {1, {0x04db}}},
- {0x04dc, {1, {0x04dd}}},
- {0x04de, {1, {0x04df}}},
- {0x04e0, {1, {0x04e1}}},
- {0x04e2, {1, {0x04e3}}},
- {0x04e4, {1, {0x04e5}}},
- {0x04e6, {1, {0x04e7}}},
- {0x04e8, {1, {0x04e9}}},
- {0x04ea, {1, {0x04eb}}},
- {0x04ec, {1, {0x04ed}}},
- {0x04ee, {1, {0x04ef}}},
- {0x04f0, {1, {0x04f1}}},
- {0x04f2, {1, {0x04f3}}},
- {0x04f4, {1, {0x04f5}}},
- {0x04f6, {1, {0x04f7}}},
- {0x04f8, {1, {0x04f9}}},
- {0x04fa, {1, {0x04fb}}},
- {0x04fc, {1, {0x04fd}}},
- {0x04fe, {1, {0x04ff}}},
- {0x0500, {1, {0x0501}}},
- {0x0502, {1, {0x0503}}},
- {0x0504, {1, {0x0505}}},
- {0x0506, {1, {0x0507}}},
- {0x0508, {1, {0x0509}}},
- {0x050a, {1, {0x050b}}},
- {0x050c, {1, {0x050d}}},
- {0x050e, {1, {0x050f}}},
- {0x0510, {1, {0x0511}}},
- {0x0512, {1, {0x0513}}},
- {0x0514, {1, {0x0515}}},
- {0x0516, {1, {0x0517}}},
- {0x0518, {1, {0x0519}}},
- {0x051a, {1, {0x051b}}},
- {0x051c, {1, {0x051d}}},
- {0x051e, {1, {0x051f}}},
- {0x0520, {1, {0x0521}}},
- {0x0522, {1, {0x0523}}},
- {0x0524, {1, {0x0525}}},
- {0x0526, {1, {0x0527}}},
- {0x0528, {1, {0x0529}}},
- {0x052a, {1, {0x052b}}},
- {0x052c, {1, {0x052d}}},
- {0x052e, {1, {0x052f}}},
- {0x0531, {1, {0x0561}}},
- {0x0532, {1, {0x0562}}},
- {0x0533, {1, {0x0563}}},
- {0x0534, {1, {0x0564}}},
- {0x0535, {1, {0x0565}}},
- {0x0536, {1, {0x0566}}},
- {0x0537, {1, {0x0567}}},
- {0x0538, {1, {0x0568}}},
- {0x0539, {1, {0x0569}}},
- {0x053a, {1, {0x056a}}},
- {0x053b, {1, {0x056b}}},
- {0x053c, {1, {0x056c}}},
- {0x053d, {1, {0x056d}}},
- {0x053e, {1, {0x056e}}},
- {0x053f, {1, {0x056f}}},
- {0x0540, {1, {0x0570}}},
- {0x0541, {1, {0x0571}}},
- {0x0542, {1, {0x0572}}},
- {0x0543, {1, {0x0573}}},
- {0x0544, {1, {0x0574}}},
- {0x0545, {1, {0x0575}}},
- {0x0546, {1, {0x0576}}},
- {0x0547, {1, {0x0577}}},
- {0x0548, {1, {0x0578}}},
- {0x0549, {1, {0x0579}}},
- {0x054a, {1, {0x057a}}},
- {0x054b, {1, {0x057b}}},
- {0x054c, {1, {0x057c}}},
- {0x054d, {1, {0x057d}}},
- {0x054e, {1, {0x057e}}},
- {0x054f, {1, {0x057f}}},
- {0x0550, {1, {0x0580}}},
- {0x0551, {1, {0x0581}}},
- {0x0552, {1, {0x0582}}},
- {0x0553, {1, {0x0583}}},
- {0x0554, {1, {0x0584}}},
- {0x0555, {1, {0x0585}}},
- {0x0556, {1, {0x0586}}},
- {0x0587, {2, {0x0565, 0x0582}}},
- {0x10a0, {1, {0x2d00}}},
- {0x10a1, {1, {0x2d01}}},
- {0x10a2, {1, {0x2d02}}},
- {0x10a3, {1, {0x2d03}}},
- {0x10a4, {1, {0x2d04}}},
- {0x10a5, {1, {0x2d05}}},
- {0x10a6, {1, {0x2d06}}},
- {0x10a7, {1, {0x2d07}}},
- {0x10a8, {1, {0x2d08}}},
- {0x10a9, {1, {0x2d09}}},
- {0x10aa, {1, {0x2d0a}}},
- {0x10ab, {1, {0x2d0b}}},
- {0x10ac, {1, {0x2d0c}}},
- {0x10ad, {1, {0x2d0d}}},
- {0x10ae, {1, {0x2d0e}}},
- {0x10af, {1, {0x2d0f}}},
- {0x10b0, {1, {0x2d10}}},
- {0x10b1, {1, {0x2d11}}},
- {0x10b2, {1, {0x2d12}}},
- {0x10b3, {1, {0x2d13}}},
- {0x10b4, {1, {0x2d14}}},
- {0x10b5, {1, {0x2d15}}},
- {0x10b6, {1, {0x2d16}}},
- {0x10b7, {1, {0x2d17}}},
- {0x10b8, {1, {0x2d18}}},
- {0x10b9, {1, {0x2d19}}},
- {0x10ba, {1, {0x2d1a}}},
- {0x10bb, {1, {0x2d1b}}},
- {0x10bc, {1, {0x2d1c}}},
- {0x10bd, {1, {0x2d1d}}},
- {0x10be, {1, {0x2d1e}}},
- {0x10bf, {1, {0x2d1f}}},
- {0x10c0, {1, {0x2d20}}},
- {0x10c1, {1, {0x2d21}}},
- {0x10c2, {1, {0x2d22}}},
- {0x10c3, {1, {0x2d23}}},
- {0x10c4, {1, {0x2d24}}},
- {0x10c5, {1, {0x2d25}}},
- {0x10c7, {1, {0x2d27}}},
- {0x10cd, {1, {0x2d2d}}},
- {0x13f8, {1, {0x13f0}}},
- {0x13f9, {1, {0x13f1}}},
- {0x13fa, {1, {0x13f2}}},
- {0x13fb, {1, {0x13f3}}},
- {0x13fc, {1, {0x13f4}}},
- {0x13fd, {1, {0x13f5}}},
- {0x1e00, {1, {0x1e01}}},
- {0x1e02, {1, {0x1e03}}},
- {0x1e04, {1, {0x1e05}}},
- {0x1e06, {1, {0x1e07}}},
- {0x1e08, {1, {0x1e09}}},
- {0x1e0a, {1, {0x1e0b}}},
- {0x1e0c, {1, {0x1e0d}}},
- {0x1e0e, {1, {0x1e0f}}},
- {0x1e10, {1, {0x1e11}}},
- {0x1e12, {1, {0x1e13}}},
- {0x1e14, {1, {0x1e15}}},
- {0x1e16, {1, {0x1e17}}},
- {0x1e18, {1, {0x1e19}}},
- {0x1e1a, {1, {0x1e1b}}},
- {0x1e1c, {1, {0x1e1d}}},
- {0x1e1e, {1, {0x1e1f}}},
- {0x1e20, {1, {0x1e21}}},
- {0x1e22, {1, {0x1e23}}},
- {0x1e24, {1, {0x1e25}}},
- {0x1e26, {1, {0x1e27}}},
- {0x1e28, {1, {0x1e29}}},
- {0x1e2a, {1, {0x1e2b}}},
- {0x1e2c, {1, {0x1e2d}}},
- {0x1e2e, {1, {0x1e2f}}},
- {0x1e30, {1, {0x1e31}}},
- {0x1e32, {1, {0x1e33}}},
- {0x1e34, {1, {0x1e35}}},
- {0x1e36, {1, {0x1e37}}},
- {0x1e38, {1, {0x1e39}}},
- {0x1e3a, {1, {0x1e3b}}},
- {0x1e3c, {1, {0x1e3d}}},
- {0x1e3e, {1, {0x1e3f}}},
- {0x1e40, {1, {0x1e41}}},
- {0x1e42, {1, {0x1e43}}},
- {0x1e44, {1, {0x1e45}}},
- {0x1e46, {1, {0x1e47}}},
- {0x1e48, {1, {0x1e49}}},
- {0x1e4a, {1, {0x1e4b}}},
- {0x1e4c, {1, {0x1e4d}}},
- {0x1e4e, {1, {0x1e4f}}},
- {0x1e50, {1, {0x1e51}}},
- {0x1e52, {1, {0x1e53}}},
- {0x1e54, {1, {0x1e55}}},
- {0x1e56, {1, {0x1e57}}},
- {0x1e58, {1, {0x1e59}}},
- {0x1e5a, {1, {0x1e5b}}},
- {0x1e5c, {1, {0x1e5d}}},
- {0x1e5e, {1, {0x1e5f}}},
- {0x1e60, {1, {0x1e61}}},
- {0x1e62, {1, {0x1e63}}},
- {0x1e64, {1, {0x1e65}}},
- {0x1e66, {1, {0x1e67}}},
- {0x1e68, {1, {0x1e69}}},
- {0x1e6a, {1, {0x1e6b}}},
- {0x1e6c, {1, {0x1e6d}}},
- {0x1e6e, {1, {0x1e6f}}},
- {0x1e70, {1, {0x1e71}}},
- {0x1e72, {1, {0x1e73}}},
- {0x1e74, {1, {0x1e75}}},
- {0x1e76, {1, {0x1e77}}},
- {0x1e78, {1, {0x1e79}}},
- {0x1e7a, {1, {0x1e7b}}},
- {0x1e7c, {1, {0x1e7d}}},
- {0x1e7e, {1, {0x1e7f}}},
- {0x1e80, {1, {0x1e81}}},
- {0x1e82, {1, {0x1e83}}},
- {0x1e84, {1, {0x1e85}}},
- {0x1e86, {1, {0x1e87}}},
- {0x1e88, {1, {0x1e89}}},
- {0x1e8a, {1, {0x1e8b}}},
- {0x1e8c, {1, {0x1e8d}}},
- {0x1e8e, {1, {0x1e8f}}},
- {0x1e90, {1, {0x1e91}}},
- {0x1e92, {1, {0x1e93}}},
- {0x1e94, {1, {0x1e95}}},
- {0x1e96, {2, {0x0068, 0x0331}}},
- {0x1e97, {2, {0x0074, 0x0308}}},
- {0x1e98, {2, {0x0077, 0x030a}}},
- {0x1e99, {2, {0x0079, 0x030a}}},
- {0x1e9a, {2, {0x0061, 0x02be}}},
- {0x1e9b, {1, {0x1e61}}},
- {0x1e9e, {2, {0x0073, 0x0073}}},
- {0x1ea0, {1, {0x1ea1}}},
- {0x1ea2, {1, {0x1ea3}}},
- {0x1ea4, {1, {0x1ea5}}},
- {0x1ea6, {1, {0x1ea7}}},
- {0x1ea8, {1, {0x1ea9}}},
- {0x1eaa, {1, {0x1eab}}},
- {0x1eac, {1, {0x1ead}}},
- {0x1eae, {1, {0x1eaf}}},
- {0x1eb0, {1, {0x1eb1}}},
- {0x1eb2, {1, {0x1eb3}}},
- {0x1eb4, {1, {0x1eb5}}},
- {0x1eb6, {1, {0x1eb7}}},
- {0x1eb8, {1, {0x1eb9}}},
- {0x1eba, {1, {0x1ebb}}},
- {0x1ebc, {1, {0x1ebd}}},
- {0x1ebe, {1, {0x1ebf}}},
- {0x1ec0, {1, {0x1ec1}}},
- {0x1ec2, {1, {0x1ec3}}},
- {0x1ec4, {1, {0x1ec5}}},
- {0x1ec6, {1, {0x1ec7}}},
- {0x1ec8, {1, {0x1ec9}}},
- {0x1eca, {1, {0x1ecb}}},
- {0x1ecc, {1, {0x1ecd}}},
- {0x1ece, {1, {0x1ecf}}},
- {0x1ed0, {1, {0x1ed1}}},
- {0x1ed2, {1, {0x1ed3}}},
- {0x1ed4, {1, {0x1ed5}}},
- {0x1ed6, {1, {0x1ed7}}},
- {0x1ed8, {1, {0x1ed9}}},
- {0x1eda, {1, {0x1edb}}},
- {0x1edc, {1, {0x1edd}}},
- {0x1ede, {1, {0x1edf}}},
- {0x1ee0, {1, {0x1ee1}}},
- {0x1ee2, {1, {0x1ee3}}},
- {0x1ee4, {1, {0x1ee5}}},
- {0x1ee6, {1, {0x1ee7}}},
- {0x1ee8, {1, {0x1ee9}}},
- {0x1eea, {1, {0x1eeb}}},
- {0x1eec, {1, {0x1eed}}},
- {0x1eee, {1, {0x1eef}}},
- {0x1ef0, {1, {0x1ef1}}},
- {0x1ef2, {1, {0x1ef3}}},
- {0x1ef4, {1, {0x1ef5}}},
- {0x1ef6, {1, {0x1ef7}}},
- {0x1ef8, {1, {0x1ef9}}},
- {0x1efa, {1, {0x1efb}}},
- {0x1efc, {1, {0x1efd}}},
- {0x1efe, {1, {0x1eff}}},
- {0x1f08, {1, {0x1f00}}},
- {0x1f09, {1, {0x1f01}}},
- {0x1f0a, {1, {0x1f02}}},
- {0x1f0b, {1, {0x1f03}}},
- {0x1f0c, {1, {0x1f04}}},
- {0x1f0d, {1, {0x1f05}}},
- {0x1f0e, {1, {0x1f06}}},
- {0x1f0f, {1, {0x1f07}}},
- {0x1f18, {1, {0x1f10}}},
- {0x1f19, {1, {0x1f11}}},
- {0x1f1a, {1, {0x1f12}}},
- {0x1f1b, {1, {0x1f13}}},
- {0x1f1c, {1, {0x1f14}}},
- {0x1f1d, {1, {0x1f15}}},
- {0x1f28, {1, {0x1f20}}},
- {0x1f29, {1, {0x1f21}}},
- {0x1f2a, {1, {0x1f22}}},
- {0x1f2b, {1, {0x1f23}}},
- {0x1f2c, {1, {0x1f24}}},
- {0x1f2d, {1, {0x1f25}}},
- {0x1f2e, {1, {0x1f26}}},
- {0x1f2f, {1, {0x1f27}}},
- {0x1f38, {1, {0x1f30}}},
- {0x1f39, {1, {0x1f31}}},
- {0x1f3a, {1, {0x1f32}}},
- {0x1f3b, {1, {0x1f33}}},
- {0x1f3c, {1, {0x1f34}}},
- {0x1f3d, {1, {0x1f35}}},
- {0x1f3e, {1, {0x1f36}}},
- {0x1f3f, {1, {0x1f37}}},
- {0x1f48, {1, {0x1f40}}},
- {0x1f49, {1, {0x1f41}}},
- {0x1f4a, {1, {0x1f42}}},
- {0x1f4b, {1, {0x1f43}}},
- {0x1f4c, {1, {0x1f44}}},
- {0x1f4d, {1, {0x1f45}}},
- {0x1f50, {2, {0x03c5, 0x0313}}},
- {0x1f52, {3, {0x03c5, 0x0313, 0x0300}}},
- {0x1f54, {3, {0x03c5, 0x0313, 0x0301}}},
- {0x1f56, {3, {0x03c5, 0x0313, 0x0342}}},
- {0x1f59, {1, {0x1f51}}},
- {0x1f5b, {1, {0x1f53}}},
- {0x1f5d, {1, {0x1f55}}},
- {0x1f5f, {1, {0x1f57}}},
- {0x1f68, {1, {0x1f60}}},
- {0x1f69, {1, {0x1f61}}},
- {0x1f6a, {1, {0x1f62}}},
- {0x1f6b, {1, {0x1f63}}},
- {0x1f6c, {1, {0x1f64}}},
- {0x1f6d, {1, {0x1f65}}},
- {0x1f6e, {1, {0x1f66}}},
- {0x1f6f, {1, {0x1f67}}},
- {0x1f80, {2, {0x1f00, 0x03b9}}},
- {0x1f81, {2, {0x1f01, 0x03b9}}},
- {0x1f82, {2, {0x1f02, 0x03b9}}},
- {0x1f83, {2, {0x1f03, 0x03b9}}},
- {0x1f84, {2, {0x1f04, 0x03b9}}},
- {0x1f85, {2, {0x1f05, 0x03b9}}},
- {0x1f86, {2, {0x1f06, 0x03b9}}},
- {0x1f87, {2, {0x1f07, 0x03b9}}},
- {0x1f88, {2, {0x1f00, 0x03b9}}},
- {0x1f89, {2, {0x1f01, 0x03b9}}},
- {0x1f8a, {2, {0x1f02, 0x03b9}}},
- {0x1f8b, {2, {0x1f03, 0x03b9}}},
- {0x1f8c, {2, {0x1f04, 0x03b9}}},
- {0x1f8d, {2, {0x1f05, 0x03b9}}},
- {0x1f8e, {2, {0x1f06, 0x03b9}}},
- {0x1f8f, {2, {0x1f07, 0x03b9}}},
- {0x1f90, {2, {0x1f20, 0x03b9}}},
- {0x1f91, {2, {0x1f21, 0x03b9}}},
- {0x1f92, {2, {0x1f22, 0x03b9}}},
- {0x1f93, {2, {0x1f23, 0x03b9}}},
- {0x1f94, {2, {0x1f24, 0x03b9}}},
- {0x1f95, {2, {0x1f25, 0x03b9}}},
- {0x1f96, {2, {0x1f26, 0x03b9}}},
- {0x1f97, {2, {0x1f27, 0x03b9}}},
- {0x1f98, {2, {0x1f20, 0x03b9}}},
- {0x1f99, {2, {0x1f21, 0x03b9}}},
- {0x1f9a, {2, {0x1f22, 0x03b9}}},
- {0x1f9b, {2, {0x1f23, 0x03b9}}},
- {0x1f9c, {2, {0x1f24, 0x03b9}}},
- {0x1f9d, {2, {0x1f25, 0x03b9}}},
- {0x1f9e, {2, {0x1f26, 0x03b9}}},
- {0x1f9f, {2, {0x1f27, 0x03b9}}},
- {0x1fa0, {2, {0x1f60, 0x03b9}}},
- {0x1fa1, {2, {0x1f61, 0x03b9}}},
- {0x1fa2, {2, {0x1f62, 0x03b9}}},
- {0x1fa3, {2, {0x1f63, 0x03b9}}},
- {0x1fa4, {2, {0x1f64, 0x03b9}}},
- {0x1fa5, {2, {0x1f65, 0x03b9}}},
- {0x1fa6, {2, {0x1f66, 0x03b9}}},
- {0x1fa7, {2, {0x1f67, 0x03b9}}},
- {0x1fa8, {2, {0x1f60, 0x03b9}}},
- {0x1fa9, {2, {0x1f61, 0x03b9}}},
- {0x1faa, {2, {0x1f62, 0x03b9}}},
- {0x1fab, {2, {0x1f63, 0x03b9}}},
- {0x1fac, {2, {0x1f64, 0x03b9}}},
- {0x1fad, {2, {0x1f65, 0x03b9}}},
- {0x1fae, {2, {0x1f66, 0x03b9}}},
- {0x1faf, {2, {0x1f67, 0x03b9}}},
- {0x1fb2, {2, {0x1f70, 0x03b9}}},
- {0x1fb3, {2, {0x03b1, 0x03b9}}},
- {0x1fb4, {2, {0x03ac, 0x03b9}}},
- {0x1fb6, {2, {0x03b1, 0x0342}}},
- {0x1fb7, {3, {0x03b1, 0x0342, 0x03b9}}},
- {0x1fb8, {1, {0x1fb0}}},
- {0x1fb9, {1, {0x1fb1}}},
- {0x1fba, {1, {0x1f70}}},
- {0x1fbb, {1, {0x1f71}}},
- {0x1fbc, {2, {0x03b1, 0x03b9}}},
- {0x1fbe, {1, {0x03b9}}},
- {0x1fc2, {2, {0x1f74, 0x03b9}}},
- {0x1fc3, {2, {0x03b7, 0x03b9}}},
- {0x1fc4, {2, {0x03ae, 0x03b9}}},
- {0x1fc6, {2, {0x03b7, 0x0342}}},
- {0x1fc7, {3, {0x03b7, 0x0342, 0x03b9}}},
- {0x1fc8, {1, {0x1f72}}},
- {0x1fc9, {1, {0x1f73}}},
- {0x1fca, {1, {0x1f74}}},
- {0x1fcb, {1, {0x1f75}}},
- {0x1fcc, {2, {0x03b7, 0x03b9}}},
- {0x1fd2, {3, {0x03b9, 0x0308, 0x0300}}},
- {0x1fd3, {3, {0x03b9, 0x0308, 0x0301}}},
- {0x1fd6, {2, {0x03b9, 0x0342}}},
- {0x1fd7, {3, {0x03b9, 0x0308, 0x0342}}},
- {0x1fd8, {1, {0x1fd0}}},
- {0x1fd9, {1, {0x1fd1}}},
- {0x1fda, {1, {0x1f76}}},
- {0x1fdb, {1, {0x1f77}}},
- {0x1fe2, {3, {0x03c5, 0x0308, 0x0300}}},
- {0x1fe3, {3, {0x03c5, 0x0308, 0x0301}}},
- {0x1fe4, {2, {0x03c1, 0x0313}}},
- {0x1fe6, {2, {0x03c5, 0x0342}}},
- {0x1fe7, {3, {0x03c5, 0x0308, 0x0342}}},
- {0x1fe8, {1, {0x1fe0}}},
- {0x1fe9, {1, {0x1fe1}}},
- {0x1fea, {1, {0x1f7a}}},
- {0x1feb, {1, {0x1f7b}}},
- {0x1fec, {1, {0x1fe5}}},
- {0x1ff2, {2, {0x1f7c, 0x03b9}}},
- {0x1ff3, {2, {0x03c9, 0x03b9}}},
- {0x1ff4, {2, {0x03ce, 0x03b9}}},
- {0x1ff6, {2, {0x03c9, 0x0342}}},
- {0x1ff7, {3, {0x03c9, 0x0342, 0x03b9}}},
- {0x1ff8, {1, {0x1f78}}},
- {0x1ff9, {1, {0x1f79}}},
- {0x1ffa, {1, {0x1f7c}}},
- {0x1ffb, {1, {0x1f7d}}},
- {0x1ffc, {2, {0x03c9, 0x03b9}}},
- {0x2126, {1, {0x03c9}}},
- {0x212a, {1, {0x006b}}},
- {0x212b, {1, {0x00e5}}},
- {0x2132, {1, {0x214e}}},
- {0x2160, {1, {0x2170}}},
- {0x2161, {1, {0x2171}}},
- {0x2162, {1, {0x2172}}},
- {0x2163, {1, {0x2173}}},
- {0x2164, {1, {0x2174}}},
- {0x2165, {1, {0x2175}}},
- {0x2166, {1, {0x2176}}},
- {0x2167, {1, {0x2177}}},
- {0x2168, {1, {0x2178}}},
- {0x2169, {1, {0x2179}}},
- {0x216a, {1, {0x217a}}},
- {0x216b, {1, {0x217b}}},
- {0x216c, {1, {0x217c}}},
- {0x216d, {1, {0x217d}}},
- {0x216e, {1, {0x217e}}},
- {0x216f, {1, {0x217f}}},
- {0x2183, {1, {0x2184}}},
- {0x24b6, {1, {0x24d0}}},
- {0x24b7, {1, {0x24d1}}},
- {0x24b8, {1, {0x24d2}}},
- {0x24b9, {1, {0x24d3}}},
- {0x24ba, {1, {0x24d4}}},
- {0x24bb, {1, {0x24d5}}},
- {0x24bc, {1, {0x24d6}}},
- {0x24bd, {1, {0x24d7}}},
- {0x24be, {1, {0x24d8}}},
- {0x24bf, {1, {0x24d9}}},
- {0x24c0, {1, {0x24da}}},
- {0x24c1, {1, {0x24db}}},
- {0x24c2, {1, {0x24dc}}},
- {0x24c3, {1, {0x24dd}}},
- {0x24c4, {1, {0x24de}}},
- {0x24c5, {1, {0x24df}}},
- {0x24c6, {1, {0x24e0}}},
- {0x24c7, {1, {0x24e1}}},
- {0x24c8, {1, {0x24e2}}},
- {0x24c9, {1, {0x24e3}}},
- {0x24ca, {1, {0x24e4}}},
- {0x24cb, {1, {0x24e5}}},
- {0x24cc, {1, {0x24e6}}},
- {0x24cd, {1, {0x24e7}}},
- {0x24ce, {1, {0x24e8}}},
- {0x24cf, {1, {0x24e9}}},
- {0x2c00, {1, {0x2c30}}},
- {0x2c01, {1, {0x2c31}}},
- {0x2c02, {1, {0x2c32}}},
- {0x2c03, {1, {0x2c33}}},
- {0x2c04, {1, {0x2c34}}},
- {0x2c05, {1, {0x2c35}}},
- {0x2c06, {1, {0x2c36}}},
- {0x2c07, {1, {0x2c37}}},
- {0x2c08, {1, {0x2c38}}},
- {0x2c09, {1, {0x2c39}}},
- {0x2c0a, {1, {0x2c3a}}},
- {0x2c0b, {1, {0x2c3b}}},
- {0x2c0c, {1, {0x2c3c}}},
- {0x2c0d, {1, {0x2c3d}}},
- {0x2c0e, {1, {0x2c3e}}},
- {0x2c0f, {1, {0x2c3f}}},
- {0x2c10, {1, {0x2c40}}},
- {0x2c11, {1, {0x2c41}}},
- {0x2c12, {1, {0x2c42}}},
- {0x2c13, {1, {0x2c43}}},
- {0x2c14, {1, {0x2c44}}},
- {0x2c15, {1, {0x2c45}}},
- {0x2c16, {1, {0x2c46}}},
- {0x2c17, {1, {0x2c47}}},
- {0x2c18, {1, {0x2c48}}},
- {0x2c19, {1, {0x2c49}}},
- {0x2c1a, {1, {0x2c4a}}},
- {0x2c1b, {1, {0x2c4b}}},
- {0x2c1c, {1, {0x2c4c}}},
- {0x2c1d, {1, {0x2c4d}}},
- {0x2c1e, {1, {0x2c4e}}},
- {0x2c1f, {1, {0x2c4f}}},
- {0x2c20, {1, {0x2c50}}},
- {0x2c21, {1, {0x2c51}}},
- {0x2c22, {1, {0x2c52}}},
- {0x2c23, {1, {0x2c53}}},
- {0x2c24, {1, {0x2c54}}},
- {0x2c25, {1, {0x2c55}}},
- {0x2c26, {1, {0x2c56}}},
- {0x2c27, {1, {0x2c57}}},
- {0x2c28, {1, {0x2c58}}},
- {0x2c29, {1, {0x2c59}}},
- {0x2c2a, {1, {0x2c5a}}},
- {0x2c2b, {1, {0x2c5b}}},
- {0x2c2c, {1, {0x2c5c}}},
- {0x2c2d, {1, {0x2c5d}}},
- {0x2c2e, {1, {0x2c5e}}},
- {0x2c60, {1, {0x2c61}}},
- {0x2c62, {1, {0x026b}}},
- {0x2c63, {1, {0x1d7d}}},
- {0x2c64, {1, {0x027d}}},
- {0x2c67, {1, {0x2c68}}},
- {0x2c69, {1, {0x2c6a}}},
- {0x2c6b, {1, {0x2c6c}}},
- {0x2c6d, {1, {0x0251}}},
- {0x2c6e, {1, {0x0271}}},
- {0x2c6f, {1, {0x0250}}},
- {0x2c70, {1, {0x0252}}},
- {0x2c72, {1, {0x2c73}}},
- {0x2c75, {1, {0x2c76}}},
- {0x2c7e, {1, {0x023f}}},
- {0x2c7f, {1, {0x0240}}},
- {0x2c80, {1, {0x2c81}}},
- {0x2c82, {1, {0x2c83}}},
- {0x2c84, {1, {0x2c85}}},
- {0x2c86, {1, {0x2c87}}},
- {0x2c88, {1, {0x2c89}}},
- {0x2c8a, {1, {0x2c8b}}},
- {0x2c8c, {1, {0x2c8d}}},
- {0x2c8e, {1, {0x2c8f}}},
- {0x2c90, {1, {0x2c91}}},
- {0x2c92, {1, {0x2c93}}},
- {0x2c94, {1, {0x2c95}}},
- {0x2c96, {1, {0x2c97}}},
- {0x2c98, {1, {0x2c99}}},
- {0x2c9a, {1, {0x2c9b}}},
- {0x2c9c, {1, {0x2c9d}}},
- {0x2c9e, {1, {0x2c9f}}},
- {0x2ca0, {1, {0x2ca1}}},
- {0x2ca2, {1, {0x2ca3}}},
- {0x2ca4, {1, {0x2ca5}}},
- {0x2ca6, {1, {0x2ca7}}},
- {0x2ca8, {1, {0x2ca9}}},
- {0x2caa, {1, {0x2cab}}},
- {0x2cac, {1, {0x2cad}}},
- {0x2cae, {1, {0x2caf}}},
- {0x2cb0, {1, {0x2cb1}}},
- {0x2cb2, {1, {0x2cb3}}},
- {0x2cb4, {1, {0x2cb5}}},
- {0x2cb6, {1, {0x2cb7}}},
- {0x2cb8, {1, {0x2cb9}}},
- {0x2cba, {1, {0x2cbb}}},
- {0x2cbc, {1, {0x2cbd}}},
- {0x2cbe, {1, {0x2cbf}}},
- {0x2cc0, {1, {0x2cc1}}},
- {0x2cc2, {1, {0x2cc3}}},
- {0x2cc4, {1, {0x2cc5}}},
- {0x2cc6, {1, {0x2cc7}}},
- {0x2cc8, {1, {0x2cc9}}},
- {0x2cca, {1, {0x2ccb}}},
- {0x2ccc, {1, {0x2ccd}}},
- {0x2cce, {1, {0x2ccf}}},
- {0x2cd0, {1, {0x2cd1}}},
- {0x2cd2, {1, {0x2cd3}}},
- {0x2cd4, {1, {0x2cd5}}},
- {0x2cd6, {1, {0x2cd7}}},
- {0x2cd8, {1, {0x2cd9}}},
- {0x2cda, {1, {0x2cdb}}},
- {0x2cdc, {1, {0x2cdd}}},
- {0x2cde, {1, {0x2cdf}}},
- {0x2ce0, {1, {0x2ce1}}},
- {0x2ce2, {1, {0x2ce3}}},
- {0x2ceb, {1, {0x2cec}}},
- {0x2ced, {1, {0x2cee}}},
- {0x2cf2, {1, {0x2cf3}}},
- {0xa640, {1, {0xa641}}},
- {0xa642, {1, {0xa643}}},
- {0xa644, {1, {0xa645}}},
- {0xa646, {1, {0xa647}}},
- {0xa648, {1, {0xa649}}},
- {0xa64a, {1, {0xa64b}}},
- {0xa64c, {1, {0xa64d}}},
- {0xa64e, {1, {0xa64f}}},
- {0xa650, {1, {0xa651}}},
- {0xa652, {1, {0xa653}}},
- {0xa654, {1, {0xa655}}},
- {0xa656, {1, {0xa657}}},
- {0xa658, {1, {0xa659}}},
- {0xa65a, {1, {0xa65b}}},
- {0xa65c, {1, {0xa65d}}},
- {0xa65e, {1, {0xa65f}}},
- {0xa660, {1, {0xa661}}},
- {0xa662, {1, {0xa663}}},
- {0xa664, {1, {0xa665}}},
- {0xa666, {1, {0xa667}}},
- {0xa668, {1, {0xa669}}},
- {0xa66a, {1, {0xa66b}}},
- {0xa66c, {1, {0xa66d}}},
- {0xa680, {1, {0xa681}}},
- {0xa682, {1, {0xa683}}},
- {0xa684, {1, {0xa685}}},
- {0xa686, {1, {0xa687}}},
- {0xa688, {1, {0xa689}}},
- {0xa68a, {1, {0xa68b}}},
- {0xa68c, {1, {0xa68d}}},
- {0xa68e, {1, {0xa68f}}},
- {0xa690, {1, {0xa691}}},
- {0xa692, {1, {0xa693}}},
- {0xa694, {1, {0xa695}}},
- {0xa696, {1, {0xa697}}},
- {0xa698, {1, {0xa699}}},
- {0xa69a, {1, {0xa69b}}},
- {0xa722, {1, {0xa723}}},
- {0xa724, {1, {0xa725}}},
- {0xa726, {1, {0xa727}}},
- {0xa728, {1, {0xa729}}},
- {0xa72a, {1, {0xa72b}}},
- {0xa72c, {1, {0xa72d}}},
- {0xa72e, {1, {0xa72f}}},
- {0xa732, {1, {0xa733}}},
- {0xa734, {1, {0xa735}}},
- {0xa736, {1, {0xa737}}},
- {0xa738, {1, {0xa739}}},
- {0xa73a, {1, {0xa73b}}},
- {0xa73c, {1, {0xa73d}}},
- {0xa73e, {1, {0xa73f}}},
- {0xa740, {1, {0xa741}}},
- {0xa742, {1, {0xa743}}},
- {0xa744, {1, {0xa745}}},
- {0xa746, {1, {0xa747}}},
- {0xa748, {1, {0xa749}}},
- {0xa74a, {1, {0xa74b}}},
- {0xa74c, {1, {0xa74d}}},
- {0xa74e, {1, {0xa74f}}},
- {0xa750, {1, {0xa751}}},
- {0xa752, {1, {0xa753}}},
- {0xa754, {1, {0xa755}}},
- {0xa756, {1, {0xa757}}},
- {0xa758, {1, {0xa759}}},
- {0xa75a, {1, {0xa75b}}},
- {0xa75c, {1, {0xa75d}}},
- {0xa75e, {1, {0xa75f}}},
- {0xa760, {1, {0xa761}}},
- {0xa762, {1, {0xa763}}},
- {0xa764, {1, {0xa765}}},
- {0xa766, {1, {0xa767}}},
- {0xa768, {1, {0xa769}}},
- {0xa76a, {1, {0xa76b}}},
- {0xa76c, {1, {0xa76d}}},
- {0xa76e, {1, {0xa76f}}},
- {0xa779, {1, {0xa77a}}},
- {0xa77b, {1, {0xa77c}}},
- {0xa77d, {1, {0x1d79}}},
- {0xa77e, {1, {0xa77f}}},
- {0xa780, {1, {0xa781}}},
- {0xa782, {1, {0xa783}}},
- {0xa784, {1, {0xa785}}},
- {0xa786, {1, {0xa787}}},
- {0xa78b, {1, {0xa78c}}},
- {0xa78d, {1, {0x0265}}},
- {0xa790, {1, {0xa791}}},
- {0xa792, {1, {0xa793}}},
- {0xa796, {1, {0xa797}}},
- {0xa798, {1, {0xa799}}},
- {0xa79a, {1, {0xa79b}}},
- {0xa79c, {1, {0xa79d}}},
- {0xa79e, {1, {0xa79f}}},
- {0xa7a0, {1, {0xa7a1}}},
- {0xa7a2, {1, {0xa7a3}}},
- {0xa7a4, {1, {0xa7a5}}},
- {0xa7a6, {1, {0xa7a7}}},
- {0xa7a8, {1, {0xa7a9}}},
- {0xa7aa, {1, {0x0266}}},
- {0xa7ab, {1, {0x025c}}},
- {0xa7ac, {1, {0x0261}}},
- {0xa7ad, {1, {0x026c}}},
- {0xa7b0, {1, {0x029e}}},
- {0xa7b1, {1, {0x0287}}},
- {0xa7b2, {1, {0x029d}}},
- {0xa7b3, {1, {0xab53}}},
- {0xa7b4, {1, {0xa7b5}}},
- {0xa7b6, {1, {0xa7b7}}},
- {0xab70, {1, {0x13a0}}},
- {0xab71, {1, {0x13a1}}},
- {0xab72, {1, {0x13a2}}},
- {0xab73, {1, {0x13a3}}},
- {0xab74, {1, {0x13a4}}},
- {0xab75, {1, {0x13a5}}},
- {0xab76, {1, {0x13a6}}},
- {0xab77, {1, {0x13a7}}},
- {0xab78, {1, {0x13a8}}},
- {0xab79, {1, {0x13a9}}},
- {0xab7a, {1, {0x13aa}}},
- {0xab7b, {1, {0x13ab}}},
- {0xab7c, {1, {0x13ac}}},
- {0xab7d, {1, {0x13ad}}},
- {0xab7e, {1, {0x13ae}}},
- {0xab7f, {1, {0x13af}}},
- {0xab80, {1, {0x13b0}}},
- {0xab81, {1, {0x13b1}}},
- {0xab82, {1, {0x13b2}}},
- {0xab83, {1, {0x13b3}}},
- {0xab84, {1, {0x13b4}}},
- {0xab85, {1, {0x13b5}}},
- {0xab86, {1, {0x13b6}}},
- {0xab87, {1, {0x13b7}}},
- {0xab88, {1, {0x13b8}}},
- {0xab89, {1, {0x13b9}}},
- {0xab8a, {1, {0x13ba}}},
- {0xab8b, {1, {0x13bb}}},
- {0xab8c, {1, {0x13bc}}},
- {0xab8d, {1, {0x13bd}}},
- {0xab8e, {1, {0x13be}}},
- {0xab8f, {1, {0x13bf}}},
- {0xab90, {1, {0x13c0}}},
- {0xab91, {1, {0x13c1}}},
- {0xab92, {1, {0x13c2}}},
- {0xab93, {1, {0x13c3}}},
- {0xab94, {1, {0x13c4}}},
- {0xab95, {1, {0x13c5}}},
- {0xab96, {1, {0x13c6}}},
- {0xab97, {1, {0x13c7}}},
- {0xab98, {1, {0x13c8}}},
- {0xab99, {1, {0x13c9}}},
- {0xab9a, {1, {0x13ca}}},
- {0xab9b, {1, {0x13cb}}},
- {0xab9c, {1, {0x13cc}}},
- {0xab9d, {1, {0x13cd}}},
- {0xab9e, {1, {0x13ce}}},
- {0xab9f, {1, {0x13cf}}},
- {0xaba0, {1, {0x13d0}}},
- {0xaba1, {1, {0x13d1}}},
- {0xaba2, {1, {0x13d2}}},
- {0xaba3, {1, {0x13d3}}},
- {0xaba4, {1, {0x13d4}}},
- {0xaba5, {1, {0x13d5}}},
- {0xaba6, {1, {0x13d6}}},
- {0xaba7, {1, {0x13d7}}},
- {0xaba8, {1, {0x13d8}}},
- {0xaba9, {1, {0x13d9}}},
- {0xabaa, {1, {0x13da}}},
- {0xabab, {1, {0x13db}}},
- {0xabac, {1, {0x13dc}}},
- {0xabad, {1, {0x13dd}}},
- {0xabae, {1, {0x13de}}},
- {0xabaf, {1, {0x13df}}},
- {0xabb0, {1, {0x13e0}}},
- {0xabb1, {1, {0x13e1}}},
- {0xabb2, {1, {0x13e2}}},
- {0xabb3, {1, {0x13e3}}},
- {0xabb4, {1, {0x13e4}}},
- {0xabb5, {1, {0x13e5}}},
- {0xabb6, {1, {0x13e6}}},
- {0xabb7, {1, {0x13e7}}},
- {0xabb8, {1, {0x13e8}}},
- {0xabb9, {1, {0x13e9}}},
- {0xabba, {1, {0x13ea}}},
- {0xabbb, {1, {0x13eb}}},
- {0xabbc, {1, {0x13ec}}},
- {0xabbd, {1, {0x13ed}}},
- {0xabbe, {1, {0x13ee}}},
- {0xabbf, {1, {0x13ef}}},
- {0xfb00, {2, {0x0066, 0x0066}}},
- {0xfb01, {2, {0x0066, 0x0069}}},
- {0xfb02, {2, {0x0066, 0x006c}}},
- {0xfb03, {3, {0x0066, 0x0066, 0x0069}}},
- {0xfb04, {3, {0x0066, 0x0066, 0x006c}}},
- {0xfb05, {2, {0x0073, 0x0074}}},
- {0xfb06, {2, {0x0073, 0x0074}}},
- {0xfb13, {2, {0x0574, 0x0576}}},
- {0xfb14, {2, {0x0574, 0x0565}}},
- {0xfb15, {2, {0x0574, 0x056b}}},
- {0xfb16, {2, {0x057e, 0x0576}}},
- {0xfb17, {2, {0x0574, 0x056d}}},
- {0xff21, {1, {0xff41}}},
- {0xff22, {1, {0xff42}}},
- {0xff23, {1, {0xff43}}},
- {0xff24, {1, {0xff44}}},
- {0xff25, {1, {0xff45}}},
- {0xff26, {1, {0xff46}}},
- {0xff27, {1, {0xff47}}},
- {0xff28, {1, {0xff48}}},
- {0xff29, {1, {0xff49}}},
- {0xff2a, {1, {0xff4a}}},
- {0xff2b, {1, {0xff4b}}},
- {0xff2c, {1, {0xff4c}}},
- {0xff2d, {1, {0xff4d}}},
- {0xff2e, {1, {0xff4e}}},
- {0xff2f, {1, {0xff4f}}},
- {0xff30, {1, {0xff50}}},
- {0xff31, {1, {0xff51}}},
- {0xff32, {1, {0xff52}}},
- {0xff33, {1, {0xff53}}},
- {0xff34, {1, {0xff54}}},
- {0xff35, {1, {0xff55}}},
- {0xff36, {1, {0xff56}}},
- {0xff37, {1, {0xff57}}},
- {0xff38, {1, {0xff58}}},
- {0xff39, {1, {0xff59}}},
- {0xff3a, {1, {0xff5a}}},
- {0x10400, {1, {0x10428}}},
- {0x10401, {1, {0x10429}}},
- {0x10402, {1, {0x1042a}}},
- {0x10403, {1, {0x1042b}}},
- {0x10404, {1, {0x1042c}}},
- {0x10405, {1, {0x1042d}}},
- {0x10406, {1, {0x1042e}}},
- {0x10407, {1, {0x1042f}}},
- {0x10408, {1, {0x10430}}},
- {0x10409, {1, {0x10431}}},
- {0x1040a, {1, {0x10432}}},
- {0x1040b, {1, {0x10433}}},
- {0x1040c, {1, {0x10434}}},
- {0x1040d, {1, {0x10435}}},
- {0x1040e, {1, {0x10436}}},
- {0x1040f, {1, {0x10437}}},
- {0x10410, {1, {0x10438}}},
- {0x10411, {1, {0x10439}}},
- {0x10412, {1, {0x1043a}}},
- {0x10413, {1, {0x1043b}}},
- {0x10414, {1, {0x1043c}}},
- {0x10415, {1, {0x1043d}}},
- {0x10416, {1, {0x1043e}}},
- {0x10417, {1, {0x1043f}}},
- {0x10418, {1, {0x10440}}},
- {0x10419, {1, {0x10441}}},
- {0x1041a, {1, {0x10442}}},
- {0x1041b, {1, {0x10443}}},
- {0x1041c, {1, {0x10444}}},
- {0x1041d, {1, {0x10445}}},
- {0x1041e, {1, {0x10446}}},
- {0x1041f, {1, {0x10447}}},
- {0x10420, {1, {0x10448}}},
- {0x10421, {1, {0x10449}}},
- {0x10422, {1, {0x1044a}}},
- {0x10423, {1, {0x1044b}}},
- {0x10424, {1, {0x1044c}}},
- {0x10425, {1, {0x1044d}}},
- {0x10426, {1, {0x1044e}}},
- {0x10427, {1, {0x1044f}}},
- {0x10c80, {1, {0x10cc0}}},
- {0x10c81, {1, {0x10cc1}}},
- {0x10c82, {1, {0x10cc2}}},
- {0x10c83, {1, {0x10cc3}}},
- {0x10c84, {1, {0x10cc4}}},
- {0x10c85, {1, {0x10cc5}}},
- {0x10c86, {1, {0x10cc6}}},
- {0x10c87, {1, {0x10cc7}}},
- {0x10c88, {1, {0x10cc8}}},
- {0x10c89, {1, {0x10cc9}}},
- {0x10c8a, {1, {0x10cca}}},
- {0x10c8b, {1, {0x10ccb}}},
- {0x10c8c, {1, {0x10ccc}}},
- {0x10c8d, {1, {0x10ccd}}},
- {0x10c8e, {1, {0x10cce}}},
- {0x10c8f, {1, {0x10ccf}}},
- {0x10c90, {1, {0x10cd0}}},
- {0x10c91, {1, {0x10cd1}}},
- {0x10c92, {1, {0x10cd2}}},
- {0x10c93, {1, {0x10cd3}}},
- {0x10c94, {1, {0x10cd4}}},
- {0x10c95, {1, {0x10cd5}}},
- {0x10c96, {1, {0x10cd6}}},
- {0x10c97, {1, {0x10cd7}}},
- {0x10c98, {1, {0x10cd8}}},
- {0x10c99, {1, {0x10cd9}}},
- {0x10c9a, {1, {0x10cda}}},
- {0x10c9b, {1, {0x10cdb}}},
- {0x10c9c, {1, {0x10cdc}}},
- {0x10c9d, {1, {0x10cdd}}},
- {0x10c9e, {1, {0x10cde}}},
- {0x10c9f, {1, {0x10cdf}}},
- {0x10ca0, {1, {0x10ce0}}},
- {0x10ca1, {1, {0x10ce1}}},
- {0x10ca2, {1, {0x10ce2}}},
- {0x10ca3, {1, {0x10ce3}}},
- {0x10ca4, {1, {0x10ce4}}},
- {0x10ca5, {1, {0x10ce5}}},
- {0x10ca6, {1, {0x10ce6}}},
- {0x10ca7, {1, {0x10ce7}}},
- {0x10ca8, {1, {0x10ce8}}},
- {0x10ca9, {1, {0x10ce9}}},
- {0x10caa, {1, {0x10cea}}},
- {0x10cab, {1, {0x10ceb}}},
- {0x10cac, {1, {0x10cec}}},
- {0x10cad, {1, {0x10ced}}},
- {0x10cae, {1, {0x10cee}}},
- {0x10caf, {1, {0x10cef}}},
- {0x10cb0, {1, {0x10cf0}}},
- {0x10cb1, {1, {0x10cf1}}},
- {0x10cb2, {1, {0x10cf2}}},
- {0x118a0, {1, {0x118c0}}},
- {0x118a1, {1, {0x118c1}}},
- {0x118a2, {1, {0x118c2}}},
- {0x118a3, {1, {0x118c3}}},
- {0x118a4, {1, {0x118c4}}},
- {0x118a5, {1, {0x118c5}}},
- {0x118a6, {1, {0x118c6}}},
- {0x118a7, {1, {0x118c7}}},
- {0x118a8, {1, {0x118c8}}},
- {0x118a9, {1, {0x118c9}}},
- {0x118aa, {1, {0x118ca}}},
- {0x118ab, {1, {0x118cb}}},
- {0x118ac, {1, {0x118cc}}},
- {0x118ad, {1, {0x118cd}}},
- {0x118ae, {1, {0x118ce}}},
- {0x118af, {1, {0x118cf}}},
- {0x118b0, {1, {0x118d0}}},
- {0x118b1, {1, {0x118d1}}},
- {0x118b2, {1, {0x118d2}}},
- {0x118b3, {1, {0x118d3}}},
- {0x118b4, {1, {0x118d4}}},
- {0x118b5, {1, {0x118d5}}},
- {0x118b6, {1, {0x118d6}}},
- {0x118b7, {1, {0x118d7}}},
- {0x118b8, {1, {0x118d8}}},
- {0x118b9, {1, {0x118d9}}},
- {0x118ba, {1, {0x118da}}},
- {0x118bb, {1, {0x118db}}},
- {0x118bc, {1, {0x118dc}}},
- {0x118bd, {1, {0x118dd}}},
- {0x118be, {1, {0x118de}}},
- {0x118bf, {1, {0x118df}}},
-#define CaseFold_Locale (*(CaseFold_11_Type (*)[2])(CaseFold_11_Table+1319))
- {0x0049, {1, {0x0069}}},
- {0x0130, {2, {0x0069, 0x0307}}},
+static const CaseFold_11_Type CaseFold[] = {
+ { 0x0041, {1, {0x0061}}},
+ { 0x0042, {1, {0x0062}}},
+ { 0x0043, {1, {0x0063}}},
+ { 0x0044, {1, {0x0064}}},
+ { 0x0045, {1, {0x0065}}},
+ { 0x0046, {1, {0x0066}}},
+ { 0x0047, {1, {0x0067}}},
+ { 0x0048, {1, {0x0068}}},
+ { 0x004a, {1, {0x006a}}},
+ { 0x004b, {1, {0x006b}}},
+ { 0x004c, {1, {0x006c}}},
+ { 0x004d, {1, {0x006d}}},
+ { 0x004e, {1, {0x006e}}},
+ { 0x004f, {1, {0x006f}}},
+ { 0x0050, {1, {0x0070}}},
+ { 0x0051, {1, {0x0071}}},
+ { 0x0052, {1, {0x0072}}},
+ { 0x0053, {1, {0x0073}}},
+ { 0x0054, {1, {0x0074}}},
+ { 0x0055, {1, {0x0075}}},
+ { 0x0056, {1, {0x0076}}},
+ { 0x0057, {1, {0x0077}}},
+ { 0x0058, {1, {0x0078}}},
+ { 0x0059, {1, {0x0079}}},
+ { 0x005a, {1, {0x007a}}},
+ { 0x00b5, {1, {0x03bc}}},
+ { 0x00c0, {1, {0x00e0}}},
+ { 0x00c1, {1, {0x00e1}}},
+ { 0x00c2, {1, {0x00e2}}},
+ { 0x00c3, {1, {0x00e3}}},
+ { 0x00c4, {1, {0x00e4}}},
+ { 0x00c5, {1, {0x00e5}}},
+ { 0x00c6, {1, {0x00e6}}},
+ { 0x00c7, {1, {0x00e7}}},
+ { 0x00c8, {1, {0x00e8}}},
+ { 0x00c9, {1, {0x00e9}}},
+ { 0x00ca, {1, {0x00ea}}},
+ { 0x00cb, {1, {0x00eb}}},
+ { 0x00cc, {1, {0x00ec}}},
+ { 0x00cd, {1, {0x00ed}}},
+ { 0x00ce, {1, {0x00ee}}},
+ { 0x00cf, {1, {0x00ef}}},
+ { 0x00d0, {1, {0x00f0}}},
+ { 0x00d1, {1, {0x00f1}}},
+ { 0x00d2, {1, {0x00f2}}},
+ { 0x00d3, {1, {0x00f3}}},
+ { 0x00d4, {1, {0x00f4}}},
+ { 0x00d5, {1, {0x00f5}}},
+ { 0x00d6, {1, {0x00f6}}},
+ { 0x00d8, {1, {0x00f8}}},
+ { 0x00d9, {1, {0x00f9}}},
+ { 0x00da, {1, {0x00fa}}},
+ { 0x00db, {1, {0x00fb}}},
+ { 0x00dc, {1, {0x00fc}}},
+ { 0x00dd, {1, {0x00fd}}},
+ { 0x00de, {1, {0x00fe}}},
+ { 0x00df, {2, {0x0073, 0x0073}}},
+ { 0x0100, {1, {0x0101}}},
+ { 0x0102, {1, {0x0103}}},
+ { 0x0104, {1, {0x0105}}},
+ { 0x0106, {1, {0x0107}}},
+ { 0x0108, {1, {0x0109}}},
+ { 0x010a, {1, {0x010b}}},
+ { 0x010c, {1, {0x010d}}},
+ { 0x010e, {1, {0x010f}}},
+ { 0x0110, {1, {0x0111}}},
+ { 0x0112, {1, {0x0113}}},
+ { 0x0114, {1, {0x0115}}},
+ { 0x0116, {1, {0x0117}}},
+ { 0x0118, {1, {0x0119}}},
+ { 0x011a, {1, {0x011b}}},
+ { 0x011c, {1, {0x011d}}},
+ { 0x011e, {1, {0x011f}}},
+ { 0x0120, {1, {0x0121}}},
+ { 0x0122, {1, {0x0123}}},
+ { 0x0124, {1, {0x0125}}},
+ { 0x0126, {1, {0x0127}}},
+ { 0x0128, {1, {0x0129}}},
+ { 0x012a, {1, {0x012b}}},
+ { 0x012c, {1, {0x012d}}},
+ { 0x012e, {1, {0x012f}}},
+ { 0x0132, {1, {0x0133}}},
+ { 0x0134, {1, {0x0135}}},
+ { 0x0136, {1, {0x0137}}},
+ { 0x0139, {1, {0x013a}}},
+ { 0x013b, {1, {0x013c}}},
+ { 0x013d, {1, {0x013e}}},
+ { 0x013f, {1, {0x0140}}},
+ { 0x0141, {1, {0x0142}}},
+ { 0x0143, {1, {0x0144}}},
+ { 0x0145, {1, {0x0146}}},
+ { 0x0147, {1, {0x0148}}},
+ { 0x0149, {2, {0x02bc, 0x006e}}},
+ { 0x014a, {1, {0x014b}}},
+ { 0x014c, {1, {0x014d}}},
+ { 0x014e, {1, {0x014f}}},
+ { 0x0150, {1, {0x0151}}},
+ { 0x0152, {1, {0x0153}}},
+ { 0x0154, {1, {0x0155}}},
+ { 0x0156, {1, {0x0157}}},
+ { 0x0158, {1, {0x0159}}},
+ { 0x015a, {1, {0x015b}}},
+ { 0x015c, {1, {0x015d}}},
+ { 0x015e, {1, {0x015f}}},
+ { 0x0160, {1, {0x0161}}},
+ { 0x0162, {1, {0x0163}}},
+ { 0x0164, {1, {0x0165}}},
+ { 0x0166, {1, {0x0167}}},
+ { 0x0168, {1, {0x0169}}},
+ { 0x016a, {1, {0x016b}}},
+ { 0x016c, {1, {0x016d}}},
+ { 0x016e, {1, {0x016f}}},
+ { 0x0170, {1, {0x0171}}},
+ { 0x0172, {1, {0x0173}}},
+ { 0x0174, {1, {0x0175}}},
+ { 0x0176, {1, {0x0177}}},
+ { 0x0178, {1, {0x00ff}}},
+ { 0x0179, {1, {0x017a}}},
+ { 0x017b, {1, {0x017c}}},
+ { 0x017d, {1, {0x017e}}},
+ { 0x017f, {1, {0x0073}}},
+ { 0x0181, {1, {0x0253}}},
+ { 0x0182, {1, {0x0183}}},
+ { 0x0184, {1, {0x0185}}},
+ { 0x0186, {1, {0x0254}}},
+ { 0x0187, {1, {0x0188}}},
+ { 0x0189, {1, {0x0256}}},
+ { 0x018a, {1, {0x0257}}},
+ { 0x018b, {1, {0x018c}}},
+ { 0x018e, {1, {0x01dd}}},
+ { 0x018f, {1, {0x0259}}},
+ { 0x0190, {1, {0x025b}}},
+ { 0x0191, {1, {0x0192}}},
+ { 0x0193, {1, {0x0260}}},
+ { 0x0194, {1, {0x0263}}},
+ { 0x0196, {1, {0x0269}}},
+ { 0x0197, {1, {0x0268}}},
+ { 0x0198, {1, {0x0199}}},
+ { 0x019c, {1, {0x026f}}},
+ { 0x019d, {1, {0x0272}}},
+ { 0x019f, {1, {0x0275}}},
+ { 0x01a0, {1, {0x01a1}}},
+ { 0x01a2, {1, {0x01a3}}},
+ { 0x01a4, {1, {0x01a5}}},
+ { 0x01a6, {1, {0x0280}}},
+ { 0x01a7, {1, {0x01a8}}},
+ { 0x01a9, {1, {0x0283}}},
+ { 0x01ac, {1, {0x01ad}}},
+ { 0x01ae, {1, {0x0288}}},
+ { 0x01af, {1, {0x01b0}}},
+ { 0x01b1, {1, {0x028a}}},
+ { 0x01b2, {1, {0x028b}}},
+ { 0x01b3, {1, {0x01b4}}},
+ { 0x01b5, {1, {0x01b6}}},
+ { 0x01b7, {1, {0x0292}}},
+ { 0x01b8, {1, {0x01b9}}},
+ { 0x01bc, {1, {0x01bd}}},
+ { 0x01c4, {1, {0x01c6}}},
+ { 0x01c5, {1, {0x01c6}}},
+ { 0x01c7, {1, {0x01c9}}},
+ { 0x01c8, {1, {0x01c9}}},
+ { 0x01ca, {1, {0x01cc}}},
+ { 0x01cb, {1, {0x01cc}}},
+ { 0x01cd, {1, {0x01ce}}},
+ { 0x01cf, {1, {0x01d0}}},
+ { 0x01d1, {1, {0x01d2}}},
+ { 0x01d3, {1, {0x01d4}}},
+ { 0x01d5, {1, {0x01d6}}},
+ { 0x01d7, {1, {0x01d8}}},
+ { 0x01d9, {1, {0x01da}}},
+ { 0x01db, {1, {0x01dc}}},
+ { 0x01de, {1, {0x01df}}},
+ { 0x01e0, {1, {0x01e1}}},
+ { 0x01e2, {1, {0x01e3}}},
+ { 0x01e4, {1, {0x01e5}}},
+ { 0x01e6, {1, {0x01e7}}},
+ { 0x01e8, {1, {0x01e9}}},
+ { 0x01ea, {1, {0x01eb}}},
+ { 0x01ec, {1, {0x01ed}}},
+ { 0x01ee, {1, {0x01ef}}},
+ { 0x01f0, {2, {0x006a, 0x030c}}},
+ { 0x01f1, {1, {0x01f3}}},
+ { 0x01f2, {1, {0x01f3}}},
+ { 0x01f4, {1, {0x01f5}}},
+ { 0x01f6, {1, {0x0195}}},
+ { 0x01f7, {1, {0x01bf}}},
+ { 0x01f8, {1, {0x01f9}}},
+ { 0x01fa, {1, {0x01fb}}},
+ { 0x01fc, {1, {0x01fd}}},
+ { 0x01fe, {1, {0x01ff}}},
+ { 0x0200, {1, {0x0201}}},
+ { 0x0202, {1, {0x0203}}},
+ { 0x0204, {1, {0x0205}}},
+ { 0x0206, {1, {0x0207}}},
+ { 0x0208, {1, {0x0209}}},
+ { 0x020a, {1, {0x020b}}},
+ { 0x020c, {1, {0x020d}}},
+ { 0x020e, {1, {0x020f}}},
+ { 0x0210, {1, {0x0211}}},
+ { 0x0212, {1, {0x0213}}},
+ { 0x0214, {1, {0x0215}}},
+ { 0x0216, {1, {0x0217}}},
+ { 0x0218, {1, {0x0219}}},
+ { 0x021a, {1, {0x021b}}},
+ { 0x021c, {1, {0x021d}}},
+ { 0x021e, {1, {0x021f}}},
+ { 0x0220, {1, {0x019e}}},
+ { 0x0222, {1, {0x0223}}},
+ { 0x0224, {1, {0x0225}}},
+ { 0x0226, {1, {0x0227}}},
+ { 0x0228, {1, {0x0229}}},
+ { 0x022a, {1, {0x022b}}},
+ { 0x022c, {1, {0x022d}}},
+ { 0x022e, {1, {0x022f}}},
+ { 0x0230, {1, {0x0231}}},
+ { 0x0232, {1, {0x0233}}},
+ { 0x023a, {1, {0x2c65}}},
+ { 0x023b, {1, {0x023c}}},
+ { 0x023d, {1, {0x019a}}},
+ { 0x023e, {1, {0x2c66}}},
+ { 0x0241, {1, {0x0242}}},
+ { 0x0243, {1, {0x0180}}},
+ { 0x0244, {1, {0x0289}}},
+ { 0x0245, {1, {0x028c}}},
+ { 0x0246, {1, {0x0247}}},
+ { 0x0248, {1, {0x0249}}},
+ { 0x024a, {1, {0x024b}}},
+ { 0x024c, {1, {0x024d}}},
+ { 0x024e, {1, {0x024f}}},
+ { 0x0345, {1, {0x03b9}}},
+ { 0x0370, {1, {0x0371}}},
+ { 0x0372, {1, {0x0373}}},
+ { 0x0376, {1, {0x0377}}},
+ { 0x0386, {1, {0x03ac}}},
+ { 0x0388, {1, {0x03ad}}},
+ { 0x0389, {1, {0x03ae}}},
+ { 0x038a, {1, {0x03af}}},
+ { 0x038c, {1, {0x03cc}}},
+ { 0x038e, {1, {0x03cd}}},
+ { 0x038f, {1, {0x03ce}}},
+ { 0x0390, {3, {0x03b9, 0x0308, 0x0301}}},
+ { 0x0391, {1, {0x03b1}}},
+ { 0x0392, {1, {0x03b2}}},
+ { 0x0393, {1, {0x03b3}}},
+ { 0x0394, {1, {0x03b4}}},
+ { 0x0395, {1, {0x03b5}}},
+ { 0x0396, {1, {0x03b6}}},
+ { 0x0397, {1, {0x03b7}}},
+ { 0x0398, {1, {0x03b8}}},
+ { 0x0399, {1, {0x03b9}}},
+ { 0x039a, {1, {0x03ba}}},
+ { 0x039b, {1, {0x03bb}}},
+ { 0x039c, {1, {0x03bc}}},
+ { 0x039d, {1, {0x03bd}}},
+ { 0x039e, {1, {0x03be}}},
+ { 0x039f, {1, {0x03bf}}},
+ { 0x03a0, {1, {0x03c0}}},
+ { 0x03a1, {1, {0x03c1}}},
+ { 0x03a3, {1, {0x03c3}}},
+ { 0x03a4, {1, {0x03c4}}},
+ { 0x03a5, {1, {0x03c5}}},
+ { 0x03a6, {1, {0x03c6}}},
+ { 0x03a7, {1, {0x03c7}}},
+ { 0x03a8, {1, {0x03c8}}},
+ { 0x03a9, {1, {0x03c9}}},
+ { 0x03aa, {1, {0x03ca}}},
+ { 0x03ab, {1, {0x03cb}}},
+ { 0x03b0, {3, {0x03c5, 0x0308, 0x0301}}},
+ { 0x03c2, {1, {0x03c3}}},
+ { 0x03cf, {1, {0x03d7}}},
+ { 0x03d0, {1, {0x03b2}}},
+ { 0x03d1, {1, {0x03b8}}},
+ { 0x03d5, {1, {0x03c6}}},
+ { 0x03d6, {1, {0x03c0}}},
+ { 0x03d8, {1, {0x03d9}}},
+ { 0x03da, {1, {0x03db}}},
+ { 0x03dc, {1, {0x03dd}}},
+ { 0x03de, {1, {0x03df}}},
+ { 0x03e0, {1, {0x03e1}}},
+ { 0x03e2, {1, {0x03e3}}},
+ { 0x03e4, {1, {0x03e5}}},
+ { 0x03e6, {1, {0x03e7}}},
+ { 0x03e8, {1, {0x03e9}}},
+ { 0x03ea, {1, {0x03eb}}},
+ { 0x03ec, {1, {0x03ed}}},
+ { 0x03ee, {1, {0x03ef}}},
+ { 0x03f0, {1, {0x03ba}}},
+ { 0x03f1, {1, {0x03c1}}},
+ { 0x03f4, {1, {0x03b8}}},
+ { 0x03f5, {1, {0x03b5}}},
+ { 0x03f7, {1, {0x03f8}}},
+ { 0x03f9, {1, {0x03f2}}},
+ { 0x03fa, {1, {0x03fb}}},
+ { 0x03fd, {1, {0x037b}}},
+ { 0x03fe, {1, {0x037c}}},
+ { 0x03ff, {1, {0x037d}}},
+ { 0x0400, {1, {0x0450}}},
+ { 0x0401, {1, {0x0451}}},
+ { 0x0402, {1, {0x0452}}},
+ { 0x0403, {1, {0x0453}}},
+ { 0x0404, {1, {0x0454}}},
+ { 0x0405, {1, {0x0455}}},
+ { 0x0406, {1, {0x0456}}},
+ { 0x0407, {1, {0x0457}}},
+ { 0x0408, {1, {0x0458}}},
+ { 0x0409, {1, {0x0459}}},
+ { 0x040a, {1, {0x045a}}},
+ { 0x040b, {1, {0x045b}}},
+ { 0x040c, {1, {0x045c}}},
+ { 0x040d, {1, {0x045d}}},
+ { 0x040e, {1, {0x045e}}},
+ { 0x040f, {1, {0x045f}}},
+ { 0x0410, {1, {0x0430}}},
+ { 0x0411, {1, {0x0431}}},
+ { 0x0412, {1, {0x0432}}},
+ { 0x0413, {1, {0x0433}}},
+ { 0x0414, {1, {0x0434}}},
+ { 0x0415, {1, {0x0435}}},
+ { 0x0416, {1, {0x0436}}},
+ { 0x0417, {1, {0x0437}}},
+ { 0x0418, {1, {0x0438}}},
+ { 0x0419, {1, {0x0439}}},
+ { 0x041a, {1, {0x043a}}},
+ { 0x041b, {1, {0x043b}}},
+ { 0x041c, {1, {0x043c}}},
+ { 0x041d, {1, {0x043d}}},
+ { 0x041e, {1, {0x043e}}},
+ { 0x041f, {1, {0x043f}}},
+ { 0x0420, {1, {0x0440}}},
+ { 0x0421, {1, {0x0441}}},
+ { 0x0422, {1, {0x0442}}},
+ { 0x0423, {1, {0x0443}}},
+ { 0x0424, {1, {0x0444}}},
+ { 0x0425, {1, {0x0445}}},
+ { 0x0426, {1, {0x0446}}},
+ { 0x0427, {1, {0x0447}}},
+ { 0x0428, {1, {0x0448}}},
+ { 0x0429, {1, {0x0449}}},
+ { 0x042a, {1, {0x044a}}},
+ { 0x042b, {1, {0x044b}}},
+ { 0x042c, {1, {0x044c}}},
+ { 0x042d, {1, {0x044d}}},
+ { 0x042e, {1, {0x044e}}},
+ { 0x042f, {1, {0x044f}}},
+ { 0x0460, {1, {0x0461}}},
+ { 0x0462, {1, {0x0463}}},
+ { 0x0464, {1, {0x0465}}},
+ { 0x0466, {1, {0x0467}}},
+ { 0x0468, {1, {0x0469}}},
+ { 0x046a, {1, {0x046b}}},
+ { 0x046c, {1, {0x046d}}},
+ { 0x046e, {1, {0x046f}}},
+ { 0x0470, {1, {0x0471}}},
+ { 0x0472, {1, {0x0473}}},
+ { 0x0474, {1, {0x0475}}},
+ { 0x0476, {1, {0x0477}}},
+ { 0x0478, {1, {0x0479}}},
+ { 0x047a, {1, {0x047b}}},
+ { 0x047c, {1, {0x047d}}},
+ { 0x047e, {1, {0x047f}}},
+ { 0x0480, {1, {0x0481}}},
+ { 0x048a, {1, {0x048b}}},
+ { 0x048c, {1, {0x048d}}},
+ { 0x048e, {1, {0x048f}}},
+ { 0x0490, {1, {0x0491}}},
+ { 0x0492, {1, {0x0493}}},
+ { 0x0494, {1, {0x0495}}},
+ { 0x0496, {1, {0x0497}}},
+ { 0x0498, {1, {0x0499}}},
+ { 0x049a, {1, {0x049b}}},
+ { 0x049c, {1, {0x049d}}},
+ { 0x049e, {1, {0x049f}}},
+ { 0x04a0, {1, {0x04a1}}},
+ { 0x04a2, {1, {0x04a3}}},
+ { 0x04a4, {1, {0x04a5}}},
+ { 0x04a6, {1, {0x04a7}}},
+ { 0x04a8, {1, {0x04a9}}},
+ { 0x04aa, {1, {0x04ab}}},
+ { 0x04ac, {1, {0x04ad}}},
+ { 0x04ae, {1, {0x04af}}},
+ { 0x04b0, {1, {0x04b1}}},
+ { 0x04b2, {1, {0x04b3}}},
+ { 0x04b4, {1, {0x04b5}}},
+ { 0x04b6, {1, {0x04b7}}},
+ { 0x04b8, {1, {0x04b9}}},
+ { 0x04ba, {1, {0x04bb}}},
+ { 0x04bc, {1, {0x04bd}}},
+ { 0x04be, {1, {0x04bf}}},
+ { 0x04c0, {1, {0x04cf}}},
+ { 0x04c1, {1, {0x04c2}}},
+ { 0x04c3, {1, {0x04c4}}},
+ { 0x04c5, {1, {0x04c6}}},
+ { 0x04c7, {1, {0x04c8}}},
+ { 0x04c9, {1, {0x04ca}}},
+ { 0x04cb, {1, {0x04cc}}},
+ { 0x04cd, {1, {0x04ce}}},
+ { 0x04d0, {1, {0x04d1}}},
+ { 0x04d2, {1, {0x04d3}}},
+ { 0x04d4, {1, {0x04d5}}},
+ { 0x04d6, {1, {0x04d7}}},
+ { 0x04d8, {1, {0x04d9}}},
+ { 0x04da, {1, {0x04db}}},
+ { 0x04dc, {1, {0x04dd}}},
+ { 0x04de, {1, {0x04df}}},
+ { 0x04e0, {1, {0x04e1}}},
+ { 0x04e2, {1, {0x04e3}}},
+ { 0x04e4, {1, {0x04e5}}},
+ { 0x04e6, {1, {0x04e7}}},
+ { 0x04e8, {1, {0x04e9}}},
+ { 0x04ea, {1, {0x04eb}}},
+ { 0x04ec, {1, {0x04ed}}},
+ { 0x04ee, {1, {0x04ef}}},
+ { 0x04f0, {1, {0x04f1}}},
+ { 0x04f2, {1, {0x04f3}}},
+ { 0x04f4, {1, {0x04f5}}},
+ { 0x04f6, {1, {0x04f7}}},
+ { 0x04f8, {1, {0x04f9}}},
+ { 0x04fa, {1, {0x04fb}}},
+ { 0x04fc, {1, {0x04fd}}},
+ { 0x04fe, {1, {0x04ff}}},
+ { 0x0500, {1, {0x0501}}},
+ { 0x0502, {1, {0x0503}}},
+ { 0x0504, {1, {0x0505}}},
+ { 0x0506, {1, {0x0507}}},
+ { 0x0508, {1, {0x0509}}},
+ { 0x050a, {1, {0x050b}}},
+ { 0x050c, {1, {0x050d}}},
+ { 0x050e, {1, {0x050f}}},
+ { 0x0510, {1, {0x0511}}},
+ { 0x0512, {1, {0x0513}}},
+ { 0x0514, {1, {0x0515}}},
+ { 0x0516, {1, {0x0517}}},
+ { 0x0518, {1, {0x0519}}},
+ { 0x051a, {1, {0x051b}}},
+ { 0x051c, {1, {0x051d}}},
+ { 0x051e, {1, {0x051f}}},
+ { 0x0520, {1, {0x0521}}},
+ { 0x0522, {1, {0x0523}}},
+ { 0x0524, {1, {0x0525}}},
+ { 0x0526, {1, {0x0527}}},
+ { 0x0531, {1, {0x0561}}},
+ { 0x0532, {1, {0x0562}}},
+ { 0x0533, {1, {0x0563}}},
+ { 0x0534, {1, {0x0564}}},
+ { 0x0535, {1, {0x0565}}},
+ { 0x0536, {1, {0x0566}}},
+ { 0x0537, {1, {0x0567}}},
+ { 0x0538, {1, {0x0568}}},
+ { 0x0539, {1, {0x0569}}},
+ { 0x053a, {1, {0x056a}}},
+ { 0x053b, {1, {0x056b}}},
+ { 0x053c, {1, {0x056c}}},
+ { 0x053d, {1, {0x056d}}},
+ { 0x053e, {1, {0x056e}}},
+ { 0x053f, {1, {0x056f}}},
+ { 0x0540, {1, {0x0570}}},
+ { 0x0541, {1, {0x0571}}},
+ { 0x0542, {1, {0x0572}}},
+ { 0x0543, {1, {0x0573}}},
+ { 0x0544, {1, {0x0574}}},
+ { 0x0545, {1, {0x0575}}},
+ { 0x0546, {1, {0x0576}}},
+ { 0x0547, {1, {0x0577}}},
+ { 0x0548, {1, {0x0578}}},
+ { 0x0549, {1, {0x0579}}},
+ { 0x054a, {1, {0x057a}}},
+ { 0x054b, {1, {0x057b}}},
+ { 0x054c, {1, {0x057c}}},
+ { 0x054d, {1, {0x057d}}},
+ { 0x054e, {1, {0x057e}}},
+ { 0x054f, {1, {0x057f}}},
+ { 0x0550, {1, {0x0580}}},
+ { 0x0551, {1, {0x0581}}},
+ { 0x0552, {1, {0x0582}}},
+ { 0x0553, {1, {0x0583}}},
+ { 0x0554, {1, {0x0584}}},
+ { 0x0555, {1, {0x0585}}},
+ { 0x0556, {1, {0x0586}}},
+ { 0x0587, {2, {0x0565, 0x0582}}},
+ { 0x10a0, {1, {0x2d00}}},
+ { 0x10a1, {1, {0x2d01}}},
+ { 0x10a2, {1, {0x2d02}}},
+ { 0x10a3, {1, {0x2d03}}},
+ { 0x10a4, {1, {0x2d04}}},
+ { 0x10a5, {1, {0x2d05}}},
+ { 0x10a6, {1, {0x2d06}}},
+ { 0x10a7, {1, {0x2d07}}},
+ { 0x10a8, {1, {0x2d08}}},
+ { 0x10a9, {1, {0x2d09}}},
+ { 0x10aa, {1, {0x2d0a}}},
+ { 0x10ab, {1, {0x2d0b}}},
+ { 0x10ac, {1, {0x2d0c}}},
+ { 0x10ad, {1, {0x2d0d}}},
+ { 0x10ae, {1, {0x2d0e}}},
+ { 0x10af, {1, {0x2d0f}}},
+ { 0x10b0, {1, {0x2d10}}},
+ { 0x10b1, {1, {0x2d11}}},
+ { 0x10b2, {1, {0x2d12}}},
+ { 0x10b3, {1, {0x2d13}}},
+ { 0x10b4, {1, {0x2d14}}},
+ { 0x10b5, {1, {0x2d15}}},
+ { 0x10b6, {1, {0x2d16}}},
+ { 0x10b7, {1, {0x2d17}}},
+ { 0x10b8, {1, {0x2d18}}},
+ { 0x10b9, {1, {0x2d19}}},
+ { 0x10ba, {1, {0x2d1a}}},
+ { 0x10bb, {1, {0x2d1b}}},
+ { 0x10bc, {1, {0x2d1c}}},
+ { 0x10bd, {1, {0x2d1d}}},
+ { 0x10be, {1, {0x2d1e}}},
+ { 0x10bf, {1, {0x2d1f}}},
+ { 0x10c0, {1, {0x2d20}}},
+ { 0x10c1, {1, {0x2d21}}},
+ { 0x10c2, {1, {0x2d22}}},
+ { 0x10c3, {1, {0x2d23}}},
+ { 0x10c4, {1, {0x2d24}}},
+ { 0x10c5, {1, {0x2d25}}},
+ { 0x10c7, {1, {0x2d27}}},
+ { 0x10cd, {1, {0x2d2d}}},
+ { 0x1e00, {1, {0x1e01}}},
+ { 0x1e02, {1, {0x1e03}}},
+ { 0x1e04, {1, {0x1e05}}},
+ { 0x1e06, {1, {0x1e07}}},
+ { 0x1e08, {1, {0x1e09}}},
+ { 0x1e0a, {1, {0x1e0b}}},
+ { 0x1e0c, {1, {0x1e0d}}},
+ { 0x1e0e, {1, {0x1e0f}}},
+ { 0x1e10, {1, {0x1e11}}},
+ { 0x1e12, {1, {0x1e13}}},
+ { 0x1e14, {1, {0x1e15}}},
+ { 0x1e16, {1, {0x1e17}}},
+ { 0x1e18, {1, {0x1e19}}},
+ { 0x1e1a, {1, {0x1e1b}}},
+ { 0x1e1c, {1, {0x1e1d}}},
+ { 0x1e1e, {1, {0x1e1f}}},
+ { 0x1e20, {1, {0x1e21}}},
+ { 0x1e22, {1, {0x1e23}}},
+ { 0x1e24, {1, {0x1e25}}},
+ { 0x1e26, {1, {0x1e27}}},
+ { 0x1e28, {1, {0x1e29}}},
+ { 0x1e2a, {1, {0x1e2b}}},
+ { 0x1e2c, {1, {0x1e2d}}},
+ { 0x1e2e, {1, {0x1e2f}}},
+ { 0x1e30, {1, {0x1e31}}},
+ { 0x1e32, {1, {0x1e33}}},
+ { 0x1e34, {1, {0x1e35}}},
+ { 0x1e36, {1, {0x1e37}}},
+ { 0x1e38, {1, {0x1e39}}},
+ { 0x1e3a, {1, {0x1e3b}}},
+ { 0x1e3c, {1, {0x1e3d}}},
+ { 0x1e3e, {1, {0x1e3f}}},
+ { 0x1e40, {1, {0x1e41}}},
+ { 0x1e42, {1, {0x1e43}}},
+ { 0x1e44, {1, {0x1e45}}},
+ { 0x1e46, {1, {0x1e47}}},
+ { 0x1e48, {1, {0x1e49}}},
+ { 0x1e4a, {1, {0x1e4b}}},
+ { 0x1e4c, {1, {0x1e4d}}},
+ { 0x1e4e, {1, {0x1e4f}}},
+ { 0x1e50, {1, {0x1e51}}},
+ { 0x1e52, {1, {0x1e53}}},
+ { 0x1e54, {1, {0x1e55}}},
+ { 0x1e56, {1, {0x1e57}}},
+ { 0x1e58, {1, {0x1e59}}},
+ { 0x1e5a, {1, {0x1e5b}}},
+ { 0x1e5c, {1, {0x1e5d}}},
+ { 0x1e5e, {1, {0x1e5f}}},
+ { 0x1e60, {1, {0x1e61}}},
+ { 0x1e62, {1, {0x1e63}}},
+ { 0x1e64, {1, {0x1e65}}},
+ { 0x1e66, {1, {0x1e67}}},
+ { 0x1e68, {1, {0x1e69}}},
+ { 0x1e6a, {1, {0x1e6b}}},
+ { 0x1e6c, {1, {0x1e6d}}},
+ { 0x1e6e, {1, {0x1e6f}}},
+ { 0x1e70, {1, {0x1e71}}},
+ { 0x1e72, {1, {0x1e73}}},
+ { 0x1e74, {1, {0x1e75}}},
+ { 0x1e76, {1, {0x1e77}}},
+ { 0x1e78, {1, {0x1e79}}},
+ { 0x1e7a, {1, {0x1e7b}}},
+ { 0x1e7c, {1, {0x1e7d}}},
+ { 0x1e7e, {1, {0x1e7f}}},
+ { 0x1e80, {1, {0x1e81}}},
+ { 0x1e82, {1, {0x1e83}}},
+ { 0x1e84, {1, {0x1e85}}},
+ { 0x1e86, {1, {0x1e87}}},
+ { 0x1e88, {1, {0x1e89}}},
+ { 0x1e8a, {1, {0x1e8b}}},
+ { 0x1e8c, {1, {0x1e8d}}},
+ { 0x1e8e, {1, {0x1e8f}}},
+ { 0x1e90, {1, {0x1e91}}},
+ { 0x1e92, {1, {0x1e93}}},
+ { 0x1e94, {1, {0x1e95}}},
+ { 0x1e96, {2, {0x0068, 0x0331}}},
+ { 0x1e97, {2, {0x0074, 0x0308}}},
+ { 0x1e98, {2, {0x0077, 0x030a}}},
+ { 0x1e99, {2, {0x0079, 0x030a}}},
+ { 0x1e9a, {2, {0x0061, 0x02be}}},
+ { 0x1e9b, {1, {0x1e61}}},
+ { 0x1e9e, {2, {0x0073, 0x0073}}},
+ { 0x1ea0, {1, {0x1ea1}}},
+ { 0x1ea2, {1, {0x1ea3}}},
+ { 0x1ea4, {1, {0x1ea5}}},
+ { 0x1ea6, {1, {0x1ea7}}},
+ { 0x1ea8, {1, {0x1ea9}}},
+ { 0x1eaa, {1, {0x1eab}}},
+ { 0x1eac, {1, {0x1ead}}},
+ { 0x1eae, {1, {0x1eaf}}},
+ { 0x1eb0, {1, {0x1eb1}}},
+ { 0x1eb2, {1, {0x1eb3}}},
+ { 0x1eb4, {1, {0x1eb5}}},
+ { 0x1eb6, {1, {0x1eb7}}},
+ { 0x1eb8, {1, {0x1eb9}}},
+ { 0x1eba, {1, {0x1ebb}}},
+ { 0x1ebc, {1, {0x1ebd}}},
+ { 0x1ebe, {1, {0x1ebf}}},
+ { 0x1ec0, {1, {0x1ec1}}},
+ { 0x1ec2, {1, {0x1ec3}}},
+ { 0x1ec4, {1, {0x1ec5}}},
+ { 0x1ec6, {1, {0x1ec7}}},
+ { 0x1ec8, {1, {0x1ec9}}},
+ { 0x1eca, {1, {0x1ecb}}},
+ { 0x1ecc, {1, {0x1ecd}}},
+ { 0x1ece, {1, {0x1ecf}}},
+ { 0x1ed0, {1, {0x1ed1}}},
+ { 0x1ed2, {1, {0x1ed3}}},
+ { 0x1ed4, {1, {0x1ed5}}},
+ { 0x1ed6, {1, {0x1ed7}}},
+ { 0x1ed8, {1, {0x1ed9}}},
+ { 0x1eda, {1, {0x1edb}}},
+ { 0x1edc, {1, {0x1edd}}},
+ { 0x1ede, {1, {0x1edf}}},
+ { 0x1ee0, {1, {0x1ee1}}},
+ { 0x1ee2, {1, {0x1ee3}}},
+ { 0x1ee4, {1, {0x1ee5}}},
+ { 0x1ee6, {1, {0x1ee7}}},
+ { 0x1ee8, {1, {0x1ee9}}},
+ { 0x1eea, {1, {0x1eeb}}},
+ { 0x1eec, {1, {0x1eed}}},
+ { 0x1eee, {1, {0x1eef}}},
+ { 0x1ef0, {1, {0x1ef1}}},
+ { 0x1ef2, {1, {0x1ef3}}},
+ { 0x1ef4, {1, {0x1ef5}}},
+ { 0x1ef6, {1, {0x1ef7}}},
+ { 0x1ef8, {1, {0x1ef9}}},
+ { 0x1efa, {1, {0x1efb}}},
+ { 0x1efc, {1, {0x1efd}}},
+ { 0x1efe, {1, {0x1eff}}},
+ { 0x1f08, {1, {0x1f00}}},
+ { 0x1f09, {1, {0x1f01}}},
+ { 0x1f0a, {1, {0x1f02}}},
+ { 0x1f0b, {1, {0x1f03}}},
+ { 0x1f0c, {1, {0x1f04}}},
+ { 0x1f0d, {1, {0x1f05}}},
+ { 0x1f0e, {1, {0x1f06}}},
+ { 0x1f0f, {1, {0x1f07}}},
+ { 0x1f18, {1, {0x1f10}}},
+ { 0x1f19, {1, {0x1f11}}},
+ { 0x1f1a, {1, {0x1f12}}},
+ { 0x1f1b, {1, {0x1f13}}},
+ { 0x1f1c, {1, {0x1f14}}},
+ { 0x1f1d, {1, {0x1f15}}},
+ { 0x1f28, {1, {0x1f20}}},
+ { 0x1f29, {1, {0x1f21}}},
+ { 0x1f2a, {1, {0x1f22}}},
+ { 0x1f2b, {1, {0x1f23}}},
+ { 0x1f2c, {1, {0x1f24}}},
+ { 0x1f2d, {1, {0x1f25}}},
+ { 0x1f2e, {1, {0x1f26}}},
+ { 0x1f2f, {1, {0x1f27}}},
+ { 0x1f38, {1, {0x1f30}}},
+ { 0x1f39, {1, {0x1f31}}},
+ { 0x1f3a, {1, {0x1f32}}},
+ { 0x1f3b, {1, {0x1f33}}},
+ { 0x1f3c, {1, {0x1f34}}},
+ { 0x1f3d, {1, {0x1f35}}},
+ { 0x1f3e, {1, {0x1f36}}},
+ { 0x1f3f, {1, {0x1f37}}},
+ { 0x1f48, {1, {0x1f40}}},
+ { 0x1f49, {1, {0x1f41}}},
+ { 0x1f4a, {1, {0x1f42}}},
+ { 0x1f4b, {1, {0x1f43}}},
+ { 0x1f4c, {1, {0x1f44}}},
+ { 0x1f4d, {1, {0x1f45}}},
+ { 0x1f50, {2, {0x03c5, 0x0313}}},
+ { 0x1f52, {3, {0x03c5, 0x0313, 0x0300}}},
+ { 0x1f54, {3, {0x03c5, 0x0313, 0x0301}}},
+ { 0x1f56, {3, {0x03c5, 0x0313, 0x0342}}},
+ { 0x1f59, {1, {0x1f51}}},
+ { 0x1f5b, {1, {0x1f53}}},
+ { 0x1f5d, {1, {0x1f55}}},
+ { 0x1f5f, {1, {0x1f57}}},
+ { 0x1f68, {1, {0x1f60}}},
+ { 0x1f69, {1, {0x1f61}}},
+ { 0x1f6a, {1, {0x1f62}}},
+ { 0x1f6b, {1, {0x1f63}}},
+ { 0x1f6c, {1, {0x1f64}}},
+ { 0x1f6d, {1, {0x1f65}}},
+ { 0x1f6e, {1, {0x1f66}}},
+ { 0x1f6f, {1, {0x1f67}}},
+ { 0x1f80, {2, {0x1f00, 0x03b9}}},
+ { 0x1f81, {2, {0x1f01, 0x03b9}}},
+ { 0x1f82, {2, {0x1f02, 0x03b9}}},
+ { 0x1f83, {2, {0x1f03, 0x03b9}}},
+ { 0x1f84, {2, {0x1f04, 0x03b9}}},
+ { 0x1f85, {2, {0x1f05, 0x03b9}}},
+ { 0x1f86, {2, {0x1f06, 0x03b9}}},
+ { 0x1f87, {2, {0x1f07, 0x03b9}}},
+ { 0x1f88, {2, {0x1f00, 0x03b9}}},
+ { 0x1f89, {2, {0x1f01, 0x03b9}}},
+ { 0x1f8a, {2, {0x1f02, 0x03b9}}},
+ { 0x1f8b, {2, {0x1f03, 0x03b9}}},
+ { 0x1f8c, {2, {0x1f04, 0x03b9}}},
+ { 0x1f8d, {2, {0x1f05, 0x03b9}}},
+ { 0x1f8e, {2, {0x1f06, 0x03b9}}},
+ { 0x1f8f, {2, {0x1f07, 0x03b9}}},
+ { 0x1f90, {2, {0x1f20, 0x03b9}}},
+ { 0x1f91, {2, {0x1f21, 0x03b9}}},
+ { 0x1f92, {2, {0x1f22, 0x03b9}}},
+ { 0x1f93, {2, {0x1f23, 0x03b9}}},
+ { 0x1f94, {2, {0x1f24, 0x03b9}}},
+ { 0x1f95, {2, {0x1f25, 0x03b9}}},
+ { 0x1f96, {2, {0x1f26, 0x03b9}}},
+ { 0x1f97, {2, {0x1f27, 0x03b9}}},
+ { 0x1f98, {2, {0x1f20, 0x03b9}}},
+ { 0x1f99, {2, {0x1f21, 0x03b9}}},
+ { 0x1f9a, {2, {0x1f22, 0x03b9}}},
+ { 0x1f9b, {2, {0x1f23, 0x03b9}}},
+ { 0x1f9c, {2, {0x1f24, 0x03b9}}},
+ { 0x1f9d, {2, {0x1f25, 0x03b9}}},
+ { 0x1f9e, {2, {0x1f26, 0x03b9}}},
+ { 0x1f9f, {2, {0x1f27, 0x03b9}}},
+ { 0x1fa0, {2, {0x1f60, 0x03b9}}},
+ { 0x1fa1, {2, {0x1f61, 0x03b9}}},
+ { 0x1fa2, {2, {0x1f62, 0x03b9}}},
+ { 0x1fa3, {2, {0x1f63, 0x03b9}}},
+ { 0x1fa4, {2, {0x1f64, 0x03b9}}},
+ { 0x1fa5, {2, {0x1f65, 0x03b9}}},
+ { 0x1fa6, {2, {0x1f66, 0x03b9}}},
+ { 0x1fa7, {2, {0x1f67, 0x03b9}}},
+ { 0x1fa8, {2, {0x1f60, 0x03b9}}},
+ { 0x1fa9, {2, {0x1f61, 0x03b9}}},
+ { 0x1faa, {2, {0x1f62, 0x03b9}}},
+ { 0x1fab, {2, {0x1f63, 0x03b9}}},
+ { 0x1fac, {2, {0x1f64, 0x03b9}}},
+ { 0x1fad, {2, {0x1f65, 0x03b9}}},
+ { 0x1fae, {2, {0x1f66, 0x03b9}}},
+ { 0x1faf, {2, {0x1f67, 0x03b9}}},
+ { 0x1fb2, {2, {0x1f70, 0x03b9}}},
+ { 0x1fb3, {2, {0x03b1, 0x03b9}}},
+ { 0x1fb4, {2, {0x03ac, 0x03b9}}},
+ { 0x1fb6, {2, {0x03b1, 0x0342}}},
+ { 0x1fb7, {3, {0x03b1, 0x0342, 0x03b9}}},
+ { 0x1fb8, {1, {0x1fb0}}},
+ { 0x1fb9, {1, {0x1fb1}}},
+ { 0x1fba, {1, {0x1f70}}},
+ { 0x1fbb, {1, {0x1f71}}},
+ { 0x1fbc, {2, {0x03b1, 0x03b9}}},
+ { 0x1fbe, {1, {0x03b9}}},
+ { 0x1fc2, {2, {0x1f74, 0x03b9}}},
+ { 0x1fc3, {2, {0x03b7, 0x03b9}}},
+ { 0x1fc4, {2, {0x03ae, 0x03b9}}},
+ { 0x1fc6, {2, {0x03b7, 0x0342}}},
+ { 0x1fc7, {3, {0x03b7, 0x0342, 0x03b9}}},
+ { 0x1fc8, {1, {0x1f72}}},
+ { 0x1fc9, {1, {0x1f73}}},
+ { 0x1fca, {1, {0x1f74}}},
+ { 0x1fcb, {1, {0x1f75}}},
+ { 0x1fcc, {2, {0x03b7, 0x03b9}}},
+ { 0x1fd2, {3, {0x03b9, 0x0308, 0x0300}}},
+ { 0x1fd3, {3, {0x03b9, 0x0308, 0x0301}}},
+ { 0x1fd6, {2, {0x03b9, 0x0342}}},
+ { 0x1fd7, {3, {0x03b9, 0x0308, 0x0342}}},
+ { 0x1fd8, {1, {0x1fd0}}},
+ { 0x1fd9, {1, {0x1fd1}}},
+ { 0x1fda, {1, {0x1f76}}},
+ { 0x1fdb, {1, {0x1f77}}},
+ { 0x1fe2, {3, {0x03c5, 0x0308, 0x0300}}},
+ { 0x1fe3, {3, {0x03c5, 0x0308, 0x0301}}},
+ { 0x1fe4, {2, {0x03c1, 0x0313}}},
+ { 0x1fe6, {2, {0x03c5, 0x0342}}},
+ { 0x1fe7, {3, {0x03c5, 0x0308, 0x0342}}},
+ { 0x1fe8, {1, {0x1fe0}}},
+ { 0x1fe9, {1, {0x1fe1}}},
+ { 0x1fea, {1, {0x1f7a}}},
+ { 0x1feb, {1, {0x1f7b}}},
+ { 0x1fec, {1, {0x1fe5}}},
+ { 0x1ff2, {2, {0x1f7c, 0x03b9}}},
+ { 0x1ff3, {2, {0x03c9, 0x03b9}}},
+ { 0x1ff4, {2, {0x03ce, 0x03b9}}},
+ { 0x1ff6, {2, {0x03c9, 0x0342}}},
+ { 0x1ff7, {3, {0x03c9, 0x0342, 0x03b9}}},
+ { 0x1ff8, {1, {0x1f78}}},
+ { 0x1ff9, {1, {0x1f79}}},
+ { 0x1ffa, {1, {0x1f7c}}},
+ { 0x1ffb, {1, {0x1f7d}}},
+ { 0x1ffc, {2, {0x03c9, 0x03b9}}},
+ { 0x2126, {1, {0x03c9}}},
+ { 0x212a, {1, {0x006b}}},
+ { 0x212b, {1, {0x00e5}}},
+ { 0x2132, {1, {0x214e}}},
+ { 0x2160, {1, {0x2170}}},
+ { 0x2161, {1, {0x2171}}},
+ { 0x2162, {1, {0x2172}}},
+ { 0x2163, {1, {0x2173}}},
+ { 0x2164, {1, {0x2174}}},
+ { 0x2165, {1, {0x2175}}},
+ { 0x2166, {1, {0x2176}}},
+ { 0x2167, {1, {0x2177}}},
+ { 0x2168, {1, {0x2178}}},
+ { 0x2169, {1, {0x2179}}},
+ { 0x216a, {1, {0x217a}}},
+ { 0x216b, {1, {0x217b}}},
+ { 0x216c, {1, {0x217c}}},
+ { 0x216d, {1, {0x217d}}},
+ { 0x216e, {1, {0x217e}}},
+ { 0x216f, {1, {0x217f}}},
+ { 0x2183, {1, {0x2184}}},
+ { 0x24b6, {1, {0x24d0}}},
+ { 0x24b7, {1, {0x24d1}}},
+ { 0x24b8, {1, {0x24d2}}},
+ { 0x24b9, {1, {0x24d3}}},
+ { 0x24ba, {1, {0x24d4}}},
+ { 0x24bb, {1, {0x24d5}}},
+ { 0x24bc, {1, {0x24d6}}},
+ { 0x24bd, {1, {0x24d7}}},
+ { 0x24be, {1, {0x24d8}}},
+ { 0x24bf, {1, {0x24d9}}},
+ { 0x24c0, {1, {0x24da}}},
+ { 0x24c1, {1, {0x24db}}},
+ { 0x24c2, {1, {0x24dc}}},
+ { 0x24c3, {1, {0x24dd}}},
+ { 0x24c4, {1, {0x24de}}},
+ { 0x24c5, {1, {0x24df}}},
+ { 0x24c6, {1, {0x24e0}}},
+ { 0x24c7, {1, {0x24e1}}},
+ { 0x24c8, {1, {0x24e2}}},
+ { 0x24c9, {1, {0x24e3}}},
+ { 0x24ca, {1, {0x24e4}}},
+ { 0x24cb, {1, {0x24e5}}},
+ { 0x24cc, {1, {0x24e6}}},
+ { 0x24cd, {1, {0x24e7}}},
+ { 0x24ce, {1, {0x24e8}}},
+ { 0x24cf, {1, {0x24e9}}},
+ { 0x2c00, {1, {0x2c30}}},
+ { 0x2c01, {1, {0x2c31}}},
+ { 0x2c02, {1, {0x2c32}}},
+ { 0x2c03, {1, {0x2c33}}},
+ { 0x2c04, {1, {0x2c34}}},
+ { 0x2c05, {1, {0x2c35}}},
+ { 0x2c06, {1, {0x2c36}}},
+ { 0x2c07, {1, {0x2c37}}},
+ { 0x2c08, {1, {0x2c38}}},
+ { 0x2c09, {1, {0x2c39}}},
+ { 0x2c0a, {1, {0x2c3a}}},
+ { 0x2c0b, {1, {0x2c3b}}},
+ { 0x2c0c, {1, {0x2c3c}}},
+ { 0x2c0d, {1, {0x2c3d}}},
+ { 0x2c0e, {1, {0x2c3e}}},
+ { 0x2c0f, {1, {0x2c3f}}},
+ { 0x2c10, {1, {0x2c40}}},
+ { 0x2c11, {1, {0x2c41}}},
+ { 0x2c12, {1, {0x2c42}}},
+ { 0x2c13, {1, {0x2c43}}},
+ { 0x2c14, {1, {0x2c44}}},
+ { 0x2c15, {1, {0x2c45}}},
+ { 0x2c16, {1, {0x2c46}}},
+ { 0x2c17, {1, {0x2c47}}},
+ { 0x2c18, {1, {0x2c48}}},
+ { 0x2c19, {1, {0x2c49}}},
+ { 0x2c1a, {1, {0x2c4a}}},
+ { 0x2c1b, {1, {0x2c4b}}},
+ { 0x2c1c, {1, {0x2c4c}}},
+ { 0x2c1d, {1, {0x2c4d}}},
+ { 0x2c1e, {1, {0x2c4e}}},
+ { 0x2c1f, {1, {0x2c4f}}},
+ { 0x2c20, {1, {0x2c50}}},
+ { 0x2c21, {1, {0x2c51}}},
+ { 0x2c22, {1, {0x2c52}}},
+ { 0x2c23, {1, {0x2c53}}},
+ { 0x2c24, {1, {0x2c54}}},
+ { 0x2c25, {1, {0x2c55}}},
+ { 0x2c26, {1, {0x2c56}}},
+ { 0x2c27, {1, {0x2c57}}},
+ { 0x2c28, {1, {0x2c58}}},
+ { 0x2c29, {1, {0x2c59}}},
+ { 0x2c2a, {1, {0x2c5a}}},
+ { 0x2c2b, {1, {0x2c5b}}},
+ { 0x2c2c, {1, {0x2c5c}}},
+ { 0x2c2d, {1, {0x2c5d}}},
+ { 0x2c2e, {1, {0x2c5e}}},
+ { 0x2c60, {1, {0x2c61}}},
+ { 0x2c62, {1, {0x026b}}},
+ { 0x2c63, {1, {0x1d7d}}},
+ { 0x2c64, {1, {0x027d}}},
+ { 0x2c67, {1, {0x2c68}}},
+ { 0x2c69, {1, {0x2c6a}}},
+ { 0x2c6b, {1, {0x2c6c}}},
+ { 0x2c6d, {1, {0x0251}}},
+ { 0x2c6e, {1, {0x0271}}},
+ { 0x2c6f, {1, {0x0250}}},
+ { 0x2c70, {1, {0x0252}}},
+ { 0x2c72, {1, {0x2c73}}},
+ { 0x2c75, {1, {0x2c76}}},
+ { 0x2c7e, {1, {0x023f}}},
+ { 0x2c7f, {1, {0x0240}}},
+ { 0x2c80, {1, {0x2c81}}},
+ { 0x2c82, {1, {0x2c83}}},
+ { 0x2c84, {1, {0x2c85}}},
+ { 0x2c86, {1, {0x2c87}}},
+ { 0x2c88, {1, {0x2c89}}},
+ { 0x2c8a, {1, {0x2c8b}}},
+ { 0x2c8c, {1, {0x2c8d}}},
+ { 0x2c8e, {1, {0x2c8f}}},
+ { 0x2c90, {1, {0x2c91}}},
+ { 0x2c92, {1, {0x2c93}}},
+ { 0x2c94, {1, {0x2c95}}},
+ { 0x2c96, {1, {0x2c97}}},
+ { 0x2c98, {1, {0x2c99}}},
+ { 0x2c9a, {1, {0x2c9b}}},
+ { 0x2c9c, {1, {0x2c9d}}},
+ { 0x2c9e, {1, {0x2c9f}}},
+ { 0x2ca0, {1, {0x2ca1}}},
+ { 0x2ca2, {1, {0x2ca3}}},
+ { 0x2ca4, {1, {0x2ca5}}},
+ { 0x2ca6, {1, {0x2ca7}}},
+ { 0x2ca8, {1, {0x2ca9}}},
+ { 0x2caa, {1, {0x2cab}}},
+ { 0x2cac, {1, {0x2cad}}},
+ { 0x2cae, {1, {0x2caf}}},
+ { 0x2cb0, {1, {0x2cb1}}},
+ { 0x2cb2, {1, {0x2cb3}}},
+ { 0x2cb4, {1, {0x2cb5}}},
+ { 0x2cb6, {1, {0x2cb7}}},
+ { 0x2cb8, {1, {0x2cb9}}},
+ { 0x2cba, {1, {0x2cbb}}},
+ { 0x2cbc, {1, {0x2cbd}}},
+ { 0x2cbe, {1, {0x2cbf}}},
+ { 0x2cc0, {1, {0x2cc1}}},
+ { 0x2cc2, {1, {0x2cc3}}},
+ { 0x2cc4, {1, {0x2cc5}}},
+ { 0x2cc6, {1, {0x2cc7}}},
+ { 0x2cc8, {1, {0x2cc9}}},
+ { 0x2cca, {1, {0x2ccb}}},
+ { 0x2ccc, {1, {0x2ccd}}},
+ { 0x2cce, {1, {0x2ccf}}},
+ { 0x2cd0, {1, {0x2cd1}}},
+ { 0x2cd2, {1, {0x2cd3}}},
+ { 0x2cd4, {1, {0x2cd5}}},
+ { 0x2cd6, {1, {0x2cd7}}},
+ { 0x2cd8, {1, {0x2cd9}}},
+ { 0x2cda, {1, {0x2cdb}}},
+ { 0x2cdc, {1, {0x2cdd}}},
+ { 0x2cde, {1, {0x2cdf}}},
+ { 0x2ce0, {1, {0x2ce1}}},
+ { 0x2ce2, {1, {0x2ce3}}},
+ { 0x2ceb, {1, {0x2cec}}},
+ { 0x2ced, {1, {0x2cee}}},
+ { 0x2cf2, {1, {0x2cf3}}},
+ { 0xa640, {1, {0xa641}}},
+ { 0xa642, {1, {0xa643}}},
+ { 0xa644, {1, {0xa645}}},
+ { 0xa646, {1, {0xa647}}},
+ { 0xa648, {1, {0xa649}}},
+ { 0xa64a, {1, {0xa64b}}},
+ { 0xa64c, {1, {0xa64d}}},
+ { 0xa64e, {1, {0xa64f}}},
+ { 0xa650, {1, {0xa651}}},
+ { 0xa652, {1, {0xa653}}},
+ { 0xa654, {1, {0xa655}}},
+ { 0xa656, {1, {0xa657}}},
+ { 0xa658, {1, {0xa659}}},
+ { 0xa65a, {1, {0xa65b}}},
+ { 0xa65c, {1, {0xa65d}}},
+ { 0xa65e, {1, {0xa65f}}},
+ { 0xa660, {1, {0xa661}}},
+ { 0xa662, {1, {0xa663}}},
+ { 0xa664, {1, {0xa665}}},
+ { 0xa666, {1, {0xa667}}},
+ { 0xa668, {1, {0xa669}}},
+ { 0xa66a, {1, {0xa66b}}},
+ { 0xa66c, {1, {0xa66d}}},
+ { 0xa680, {1, {0xa681}}},
+ { 0xa682, {1, {0xa683}}},
+ { 0xa684, {1, {0xa685}}},
+ { 0xa686, {1, {0xa687}}},
+ { 0xa688, {1, {0xa689}}},
+ { 0xa68a, {1, {0xa68b}}},
+ { 0xa68c, {1, {0xa68d}}},
+ { 0xa68e, {1, {0xa68f}}},
+ { 0xa690, {1, {0xa691}}},
+ { 0xa692, {1, {0xa693}}},
+ { 0xa694, {1, {0xa695}}},
+ { 0xa696, {1, {0xa697}}},
+ { 0xa722, {1, {0xa723}}},
+ { 0xa724, {1, {0xa725}}},
+ { 0xa726, {1, {0xa727}}},
+ { 0xa728, {1, {0xa729}}},
+ { 0xa72a, {1, {0xa72b}}},
+ { 0xa72c, {1, {0xa72d}}},
+ { 0xa72e, {1, {0xa72f}}},
+ { 0xa732, {1, {0xa733}}},
+ { 0xa734, {1, {0xa735}}},
+ { 0xa736, {1, {0xa737}}},
+ { 0xa738, {1, {0xa739}}},
+ { 0xa73a, {1, {0xa73b}}},
+ { 0xa73c, {1, {0xa73d}}},
+ { 0xa73e, {1, {0xa73f}}},
+ { 0xa740, {1, {0xa741}}},
+ { 0xa742, {1, {0xa743}}},
+ { 0xa744, {1, {0xa745}}},
+ { 0xa746, {1, {0xa747}}},
+ { 0xa748, {1, {0xa749}}},
+ { 0xa74a, {1, {0xa74b}}},
+ { 0xa74c, {1, {0xa74d}}},
+ { 0xa74e, {1, {0xa74f}}},
+ { 0xa750, {1, {0xa751}}},
+ { 0xa752, {1, {0xa753}}},
+ { 0xa754, {1, {0xa755}}},
+ { 0xa756, {1, {0xa757}}},
+ { 0xa758, {1, {0xa759}}},
+ { 0xa75a, {1, {0xa75b}}},
+ { 0xa75c, {1, {0xa75d}}},
+ { 0xa75e, {1, {0xa75f}}},
+ { 0xa760, {1, {0xa761}}},
+ { 0xa762, {1, {0xa763}}},
+ { 0xa764, {1, {0xa765}}},
+ { 0xa766, {1, {0xa767}}},
+ { 0xa768, {1, {0xa769}}},
+ { 0xa76a, {1, {0xa76b}}},
+ { 0xa76c, {1, {0xa76d}}},
+ { 0xa76e, {1, {0xa76f}}},
+ { 0xa779, {1, {0xa77a}}},
+ { 0xa77b, {1, {0xa77c}}},
+ { 0xa77d, {1, {0x1d79}}},
+ { 0xa77e, {1, {0xa77f}}},
+ { 0xa780, {1, {0xa781}}},
+ { 0xa782, {1, {0xa783}}},
+ { 0xa784, {1, {0xa785}}},
+ { 0xa786, {1, {0xa787}}},
+ { 0xa78b, {1, {0xa78c}}},
+ { 0xa78d, {1, {0x0265}}},
+ { 0xa790, {1, {0xa791}}},
+ { 0xa792, {1, {0xa793}}},
+ { 0xa7a0, {1, {0xa7a1}}},
+ { 0xa7a2, {1, {0xa7a3}}},
+ { 0xa7a4, {1, {0xa7a5}}},
+ { 0xa7a6, {1, {0xa7a7}}},
+ { 0xa7a8, {1, {0xa7a9}}},
+ { 0xa7aa, {1, {0x0266}}},
+ { 0xfb00, {2, {0x0066, 0x0066}}},
+ { 0xfb01, {2, {0x0066, 0x0069}}},
+ { 0xfb02, {2, {0x0066, 0x006c}}},
+ { 0xfb03, {3, {0x0066, 0x0066, 0x0069}}},
+ { 0xfb04, {3, {0x0066, 0x0066, 0x006c}}},
+ { 0xfb05, {2, {0x0073, 0x0074}}},
+ { 0xfb06, {2, {0x0073, 0x0074}}},
+ { 0xfb13, {2, {0x0574, 0x0576}}},
+ { 0xfb14, {2, {0x0574, 0x0565}}},
+ { 0xfb15, {2, {0x0574, 0x056b}}},
+ { 0xfb16, {2, {0x057e, 0x0576}}},
+ { 0xfb17, {2, {0x0574, 0x056d}}},
+ { 0xff21, {1, {0xff41}}},
+ { 0xff22, {1, {0xff42}}},
+ { 0xff23, {1, {0xff43}}},
+ { 0xff24, {1, {0xff44}}},
+ { 0xff25, {1, {0xff45}}},
+ { 0xff26, {1, {0xff46}}},
+ { 0xff27, {1, {0xff47}}},
+ { 0xff28, {1, {0xff48}}},
+ { 0xff29, {1, {0xff49}}},
+ { 0xff2a, {1, {0xff4a}}},
+ { 0xff2b, {1, {0xff4b}}},
+ { 0xff2c, {1, {0xff4c}}},
+ { 0xff2d, {1, {0xff4d}}},
+ { 0xff2e, {1, {0xff4e}}},
+ { 0xff2f, {1, {0xff4f}}},
+ { 0xff30, {1, {0xff50}}},
+ { 0xff31, {1, {0xff51}}},
+ { 0xff32, {1, {0xff52}}},
+ { 0xff33, {1, {0xff53}}},
+ { 0xff34, {1, {0xff54}}},
+ { 0xff35, {1, {0xff55}}},
+ { 0xff36, {1, {0xff56}}},
+ { 0xff37, {1, {0xff57}}},
+ { 0xff38, {1, {0xff58}}},
+ { 0xff39, {1, {0xff59}}},
+ { 0xff3a, {1, {0xff5a}}},
+ { 0x10400, {1, {0x10428}}},
+ { 0x10401, {1, {0x10429}}},
+ { 0x10402, {1, {0x1042a}}},
+ { 0x10403, {1, {0x1042b}}},
+ { 0x10404, {1, {0x1042c}}},
+ { 0x10405, {1, {0x1042d}}},
+ { 0x10406, {1, {0x1042e}}},
+ { 0x10407, {1, {0x1042f}}},
+ { 0x10408, {1, {0x10430}}},
+ { 0x10409, {1, {0x10431}}},
+ { 0x1040a, {1, {0x10432}}},
+ { 0x1040b, {1, {0x10433}}},
+ { 0x1040c, {1, {0x10434}}},
+ { 0x1040d, {1, {0x10435}}},
+ { 0x1040e, {1, {0x10436}}},
+ { 0x1040f, {1, {0x10437}}},
+ { 0x10410, {1, {0x10438}}},
+ { 0x10411, {1, {0x10439}}},
+ { 0x10412, {1, {0x1043a}}},
+ { 0x10413, {1, {0x1043b}}},
+ { 0x10414, {1, {0x1043c}}},
+ { 0x10415, {1, {0x1043d}}},
+ { 0x10416, {1, {0x1043e}}},
+ { 0x10417, {1, {0x1043f}}},
+ { 0x10418, {1, {0x10440}}},
+ { 0x10419, {1, {0x10441}}},
+ { 0x1041a, {1, {0x10442}}},
+ { 0x1041b, {1, {0x10443}}},
+ { 0x1041c, {1, {0x10444}}},
+ { 0x1041d, {1, {0x10445}}},
+ { 0x1041e, {1, {0x10446}}},
+ { 0x1041f, {1, {0x10447}}},
+ { 0x10420, {1, {0x10448}}},
+ { 0x10421, {1, {0x10449}}},
+ { 0x10422, {1, {0x1044a}}},
+ { 0x10423, {1, {0x1044b}}},
+ { 0x10424, {1, {0x1044c}}},
+ { 0x10425, {1, {0x1044d}}},
+ { 0x10426, {1, {0x1044e}}},
+ { 0x10427, {1, {0x1044f}}},
};
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -7 -k1,2,3 -F,-1 -c -j1 -i1 -t -T -E -C -H onigenc_unicode_CaseFold_11_hash -N onigenc_unicode_CaseFold_11_lookup -n */
-
-/* maximum key range = 2294, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-/*ARGSUSED*/
-static unsigned int
-onigenc_unicode_CaseFold_11_hash(const OnigCodePoint code)
-{
- static const unsigned short asso_values[] =
- {
- 5, 207, 4, 313, 3, 2304, 97, 155, 2, 208,
- 137, 4, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304,
- 2304, 2304, 2304, 2304, 2304, 11, 2304, 2304, 2304, 2304,
- 2304, 2304, 2304, 204, 2304, 2304, 2304, 2304, 2304, 17,
- 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 308,
- 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304, 2304,
- 13, 10, 290, 1, 2304, 2304, 275, 3, 2304, 2304,
- 2304, 2304, 2304, 458, 2304, 2304, 163, 595, 210, 39,
- 1658, 461, 1716, 421, 1686, 317, 685, 6, 12, 25,
- 1581, 592, 1645, 241, 1544, 115, 1621, 191, 1530, 272,
- 1605, 70, 1388, 53, 1474, 146, 1454, 367, 1448, 210,
- 1587, 132, 1360, 348, 1347, 101, 1312, 84, 177, 561,
- 1199, 504, 1080, 534, 438, 578, 197, 635, 1371, 611,
- 1363, 758, 670, 726, 1069, 694, 1421, 671, 1440, 736,
- 1519, 788, 556, 1310, 949, 1137, 1433, 926, 546, 1290,
- 1321, 913, 713, 813, 1505, 884, 87, 1273, 651, 515,
- 942, 1043, 1536, 1262, 767, 851, 182, 1223, 168, 1212,
- 97, 1404, 24, 1284, 23, 1006, 11, 832, 332, 989,
- 5, 1098, 259, 969, 225, 955, 278, 868, 237, 1102,
- 142, 1208, 26, 1326, 4, 1330, 100, 624, 208, 1559,
- 19, 1494, 1178, 1614, 674, 1392, 296
- };
- return asso_values[bits_of(code, 2)+79] + asso_values[bits_of(code, 1)] + asso_values[bits_of(code, 0)];
-}
-
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-static const CodePointList3 *
-onigenc_unicode_CaseFold_11_lookup(const OnigCodePoint code)
-{
- enum
- {
- MIN_CODE_VALUE = 0x41,
- MAX_CODE_VALUE = 0x118bf,
- TOTAL_KEYWORDS = 1321,
- MIN_WORD_LENGTH = 3,
- MAX_WORD_LENGTH = 3,
- MIN_HASH_VALUE = 10,
- MAX_HASH_VALUE = 2303
- };
-
- static const short wordlist[] =
- {
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1,
- /*0x1ff3*/ 800,
- /*0x10408*/ 1204,
- /*0x1f88*/ 720,
- /*0x0408*/ 305,
- /*0x0208*/ 194,
- /*0x0108*/ 61,
- /*0xab88*/ 1102,
- /*0x10409*/ 1205,
- /*0x1f89*/ 721,
- /*0x0409*/ 306,
- /*0x10c88*/ 1244,
- /*0x1e88*/ 598,
- /*0xab89*/ 1103,
- /*0x2c08*/ 864,
- /*0x1e08*/ 534,
- /*0x1ff9*/ 805,
- /*0x10c89*/ 1245,
- -1,
- /*0x0179*/ 117,
- /*0x2c09*/ 865,
- /*0x1040a*/ 1206,
- /*0x1f8a*/ 722,
- /*0x040a*/ 307,
- /*0x020a*/ 195,
- /*0x010a*/ 62,
- /*0xab8a*/ 1104,
- /*0x2c88*/ 922,
- -1, -1,
- /*0x10c8a*/ 1246,
- /*0x1e8a*/ 599,
- /*0x13f9*/ 525,
- /*0x2c0a*/ 866,
- /*0x1e0a*/ 535,
- /*0x10400*/ 1196,
- /*0x1f80*/ 712,
- /*0x0400*/ 297,
- /*0x0200*/ 190,
- /*0x0100*/ 57,
- /*0xab80*/ 1094,
- -1, -1, -1,
- /*0x10c80*/ 1236,
- /*0x1e80*/ 594,
- /*0x2c8a*/ 923,
- /*0x2c00*/ 856,
- /*0x1e00*/ 530,
- /*0x10418*/ 1220,
- /*0x1f98*/ 736,
- /*0x0418*/ 321,
- /*0x0218*/ 202,
- /*0x0118*/ 69,
- /*0xab98*/ 1118,
- -1, -1, -1,
- /*0x10c98*/ 1260,
- /*0x1e98*/ 607,
- /*0x2c80*/ 918,
- /*0x2c18*/ 880,
- /*0x1e18*/ 542,
- -1, -1, -1,
- /*0x10416*/ 1218,
- /*0x1f96*/ 734,
- /*0x0416*/ 319,
- /*0x0216*/ 201,
- /*0x0116*/ 68,
- /*0xab96*/ 1116,
- -1,
- /*0xa780*/ 1050,
- /*0x2c98*/ 930,
- /*0x10c96*/ 1258,
- /*0x1e96*/ 605,
- -1,
- /*0x2c16*/ 878,
- /*0x1e16*/ 541,
- /*0x10426*/ 1234,
- /*0x1fa6*/ 750,
- /*0x0426*/ 335,
- /*0x0226*/ 209,
- /*0x0126*/ 76,
- /*0xaba6*/ 1132,
- -1,
- /*0xa798*/ 1059,
- /*0x004d*/ 11,
- /*0x10ca6*/ 1274,
- /*0x1ea6*/ 615,
- /*0x2c96*/ 929,
- /*0x2c26*/ 894,
- /*0x1e26*/ 549,
- /*0x1fdb*/ 788,
- -1, -1,
- /*0x10424*/ 1232,
- /*0x1fa4*/ 748,
- /*0x0424*/ 333,
- /*0x0224*/ 208,
- /*0x0124*/ 75,
- /*0xaba4*/ 1130,
- -1,
- /*0xa796*/ 1058,
- /*0x2ca6*/ 937,
- /*0x10ca4*/ 1272,
- /*0x1ea4*/ 614,
- /*0x2c75*/ 915,
- /*0x2c24*/ 892,
- /*0x1e24*/ 548,
- /*0x10410*/ 1212,
- /*0x1f90*/ 728,
- /*0x0410*/ 313,
- /*0x0210*/ 198,
- /*0x0110*/ 65,
- /*0xab90*/ 1110,
- -1,
- /*0xa7a6*/ 1066,
- -1,
- /*0x10c90*/ 1252,
- /*0x1e90*/ 602,
- /*0x2ca4*/ 936,
- /*0x2c10*/ 872,
- /*0x1e10*/ 538,
- -1, -1, -1,
- /*0x10420*/ 1228,
- /*0x1fa0*/ 744,
- /*0x0420*/ 329,
- /*0x0220*/ 206,
- /*0x0120*/ 73,
- /*0xaba0*/ 1126,
- -1,
- /*0xa7a4*/ 1065,
- /*0x2c90*/ 926,
- /*0x10ca0*/ 1268,
- /*0x1ea0*/ 612,
- /*0x0508*/ 425,
- /*0x2c20*/ 888,
- /*0x1e20*/ 546,
- /*0x1041a*/ 1222,
- /*0x1f9a*/ 738,
- /*0x041a*/ 323,
- /*0x021a*/ 203,
- /*0x011a*/ 70,
- /*0xab9a*/ 1120,
- -1,
- /*0xa790*/ 1056,
- /*0x2c6f*/ 912,
- /*0x10c9a*/ 1262,
- /*0x1e9a*/ 609,
- /*0x2ca0*/ 934,
- /*0x2c1a*/ 882,
- /*0x1e1a*/ 543,
- -1,
- /*0x0388*/ 235,
- /*0x050a*/ 426,
- -1, -1, -1, -1,
- /*0x0389*/ 236,
- -1,
- /*0x1fd9*/ 786,
- /*0xa7a0*/ 1063,
- /*0x2c9a*/ 931,
- -1,
- /*0x0059*/ 23,
- /*0x03f9*/ 292,
- -1,
- /*0x0500*/ 421,
- /*0x10427*/ 1235,
- /*0x1fa7*/ 751,
- /*0x0427*/ 336,
- /*0x038a*/ 237,
- /*0x03f1*/ 288,
- /*0xaba7*/ 1133,
- /*0x1fd7*/ 784,
- /*0xa79a*/ 1060,
- -1,
- /*0x10ca7*/ 1275,
- /*0x0057*/ 21,
- -1,
- /*0x2c27*/ 895,
- /*0x0518*/ 433,
- /*0x10412*/ 1214,
- /*0x1f92*/ 730,
- /*0x0412*/ 315,
- /*0x0212*/ 199,
- /*0x0112*/ 66,
- /*0xab92*/ 1112,
- -1,
- /*0x1faf*/ 759,
- /*0x042f*/ 344,
- /*0x10c92*/ 1254,
- /*0x1e92*/ 603,
- /*0xabaf*/ 1141,
- /*0x2c12*/ 874,
- /*0x1e12*/ 539,
- -1,
- /*0x10caf*/ 1283,
- /*0x0516*/ 432,
- /*0x0398*/ 249,
- /*0x1ff7*/ 803,
- /*0x1041e*/ 1226,
- /*0x1f9e*/ 742,
- /*0x041e*/ 327,
- /*0x021e*/ 205,
- /*0x011e*/ 72,
- /*0xab9e*/ 1124,
- /*0x2c92*/ 927,
- -1, -1,
- /*0x10c9e*/ 1266,
- /*0x1e9e*/ 611,
- /*0x0526*/ 440,
- /*0x2c1e*/ 886,
- /*0x1e1e*/ 545,
- /*0x054d*/ 473,
- /*0x0396*/ 247,
- /*0x1fe9*/ 795,
- -1,
- /*0xa779*/ 1046,
- /*0xa792*/ 1057,
- /*0x00df*/ 56,
- /*0x00dd*/ 54,
- -1,
- /*0x048a*/ 362,
- -1,
- /*0x2c9e*/ 933,
- -1,
- /*0x2c69*/ 908,
- /*0x0524*/ 439,
- /*0x03a6*/ 262,
- -1,
- /*0x1040e*/ 1210,
- /*0x1f8e*/ 726,
- /*0x040e*/ 311,
- /*0x020e*/ 197,
- /*0x010e*/ 64,
- /*0xab8e*/ 1108,
- /*0x0480*/ 361,
- /*0xa79e*/ 1062,
- /*0x2c6d*/ 910,
- /*0x10c8e*/ 1250,
- /*0x1e8e*/ 601,
- /*0x0510*/ 429,
- /*0x2c0e*/ 870,
- /*0x1e0e*/ 537,
- /*0x03f5*/ 290,
- /*0x03a4*/ 260,
- -1, -1, -1,
- /*0x1fe7*/ 793,
- /*0x0498*/ 369,
- /*0x2ced*/ 969,
- -1, -1, -1,
- /*0x2c8e*/ 925,
- -1, -1,
- /*0x0520*/ 437,
- /*0x0390*/ 241,
- /*0x2c67*/ 907,
- /*0x10414*/ 1216,
- /*0x1f94*/ 732,
- /*0x0414*/ 317,
- /*0x0214*/ 200,
- /*0x0114*/ 67,
- /*0xab94*/ 1114,
- /*0x0496*/ 368,
- /*0x1feb*/ 797,
- /*0x2165*/ 818,
- /*0x10c94*/ 1256,
- /*0x1e94*/ 604,
- /*0x051a*/ 434,
- /*0x2c14*/ 876,
- /*0x1e14*/ 540,
- /*0x2161*/ 814,
- /*0x03a0*/ 257,
- /*0x10a6*/ 490,
- -1,
- /*0x2c6b*/ 909,
- /*0x10cd*/ 523,
- /*0x04a6*/ 376,
- /*0xa726*/ 1010,
- /*0x00cd*/ 39,
- /*0x04cd*/ 396,
- /*0x1f08*/ 660,
- /*0x2c94*/ 928,
- -1, -1,
- /*0x017f*/ 120,
- /*0x039a*/ 251,
- /*0x1f09*/ 661,
- /*0x2ceb*/ 968,
- /*0x00db*/ 52,
- /*0x10a4*/ 488,
- -1, -1,
- /*0x2c7f*/ 917,
- /*0x04a4*/ 375,
- /*0xa724*/ 1009,
- -1, -1,
- /*0x1f5f*/ 703,
- /*0x1f5d*/ 702,
- /*0x1f0a*/ 662,
- -1,
- /*0x10406*/ 1202,
- /*0x1f86*/ 718,
- /*0x0406*/ 303,
- /*0x0206*/ 193,
- /*0x0106*/ 60,
- /*0xab86*/ 1100,
- /*0x0490*/ 365,
- -1,
- /*0x0189*/ 126,
- /*0x10c86*/ 1242,
- /*0x1e86*/ 597,
- /*0x0512*/ 430,
- /*0x2c06*/ 862,
- /*0x1e06*/ 533,
- -1,
- /*0x03a7*/ 263,
- /*0x1fe3*/ 790,
- -1, -1,
- /*0x10a0*/ 484,
- -1,
- /*0x018a*/ 127,
- /*0x01f1*/ 181,
- /*0x04a0*/ 373,
- -1,
- /*0x2c86*/ 921,
- /*0x1f18*/ 668,
- /*0x2c63*/ 905,
- -1,
- /*0x0392*/ 243,
- /*0x051e*/ 436,
- /*0x10422*/ 1230,
- /*0x1fa2*/ 746,
- /*0x0422*/ 331,
- /*0x0222*/ 207,
- /*0x0122*/ 74,
- /*0xaba2*/ 1128,
- /*0x049a*/ 370,
- /*0xa786*/ 1053,
- -1,
- /*0x10ca2*/ 1270,
- /*0x1ea2*/ 613,
- /*0x2126*/ 809,
- /*0x2c22*/ 890,
- /*0x1e22*/ 547,
- -1,
- /*0x03f7*/ 291,
- -1,
- /*0x039e*/ 255,
- /*0x0198*/ 137,
- /*0x1041c*/ 1224,
- /*0x1f9c*/ 740,
- /*0x041c*/ 325,
- /*0x021c*/ 204,
- /*0x011c*/ 71,
- /*0xab9c*/ 1122,
- /*0x2ca2*/ 935,
- -1,
- /*0x00d9*/ 50,
- /*0x10c9c*/ 1264,
- /*0x1f4d*/ 695,
- /*0x050e*/ 428,
- /*0x2c1c*/ 884,
- /*0x1e1c*/ 544,
- /*0x10a7*/ 491,
- -1,
- /*0x0196*/ 135,
- -1, -1,
- /*0xa7a2*/ 1064,
- /*0x1f5b*/ 701,
- -1, -1,
- /*0x118a6*/ 1293,
- -1,
- /*0x2c9c*/ 932,
- /*0x037f*/ 233,
- -1, -1,
- /*0x038e*/ 239,
- /*0x01a6*/ 144,
- -1,
- /*0x0492*/ 366,
- /*0x01cd*/ 163,
- /*0x10af*/ 499,
- -1, -1, -1,
- /*0xa79c*/ 1061,
- -1,
- /*0x118a4*/ 1291,
- -1,
- /*0x0514*/ 431,
- /*0x01db*/ 170,
- -1, -1, -1,
- /*0x01a4*/ 143,
- -1, -1,
- /*0x216f*/ 828,
- /*0x049e*/ 372,
- -1, -1,
- /*0x10404*/ 1200,
- /*0x1f84*/ 716,
- /*0x0404*/ 301,
- /*0x0204*/ 192,
- /*0x0104*/ 59,
- /*0xab84*/ 1098,
- /*0x0394*/ 245,
- /*0x0190*/ 131,
- -1,
- /*0x10c84*/ 1240,
- /*0x1e84*/ 596,
- /*0x1f6f*/ 711,
- /*0x2c04*/ 860,
- /*0x1e04*/ 532,
- -1,
- /*0x1f1a*/ 670,
- -1,
- /*0x118a0*/ 1287,
- /*0x1fad*/ 757,
- /*0x042d*/ 342,
- -1, -1,
- /*0xabad*/ 1139,
- -1,
- /*0x01a0*/ 141,
- /*0x2c84*/ 920,
- /*0x10cad*/ 1281,
- -1,
- /*0x048e*/ 364,
- /*0x2c2d*/ 901,
- /*0x03ff*/ 296,
- -1, -1,
- /*0x0506*/ 424,
- -1, -1, -1,
- /*0x1f59*/ 700,
- /*0xa784*/ 1052,
- -1,
- /*0x10402*/ 1198,
- /*0x1f82*/ 714,
- /*0x0402*/ 299,
- /*0x0202*/ 191,
- /*0x0102*/ 58,
- /*0xab82*/ 1096,
- -1, -1, -1,
- /*0x10c82*/ 1238,
- /*0x1e82*/ 595,
- /*0x0386*/ 234,
- /*0x2c02*/ 858,
- /*0x1e02*/ 531,
- -1,
- /*0xa7ad*/ 1071,
- -1, -1, -1,
- /*0x0494*/ 367,
- /*0x01d9*/ 169,
- -1,
- /*0x118a7*/ 1294,
- -1,
- /*0x0522*/ 438,
- /*0x2c82*/ 919,
- /*0x1f2f*/ 681,
- -1, -1,
- /*0x01a7*/ 145,
- -1, -1, -1, -1,
- /*0x01d7*/ 168,
- -1, -1, -1,
- /*0xa782*/ 1051,
- /*0x2169*/ 822,
- -1, -1,
- /*0x118af*/ 1302,
- /*0x051c*/ 435,
- /*0x1faa*/ 754,
- /*0x042a*/ 339,
- /*0x022a*/ 211,
- /*0x012a*/ 78,
- /*0xabaa*/ 1136,
- /*0x01af*/ 149,
- -1,
- /*0x216d*/ 826,
- /*0x10caa*/ 1278,
- /*0x1eaa*/ 617,
- /*0x1f69*/ 705,
- /*0x2c2a*/ 898,
- /*0x1e2a*/ 551,
- -1,
- /*0x0150*/ 96,
- /*0x0050*/ 14,
- /*0x01f7*/ 185,
- /*0x039c*/ 253,
- -1,
- /*0xfb00*/ 1158,
- /*0x1ed0*/ 636,
- -1,
- /*0x1f6d*/ 709,
- /*0x1e50*/ 570,
- /*0x2caa*/ 939,
- -1,
- /*0x1f0e*/ 666,
- -1, -1,
- /*0x2167*/ 820,
- /*0x1fac*/ 756,
- /*0x042c*/ 341,
- /*0x022c*/ 212,
- /*0x012c*/ 79,
- /*0xabac*/ 1138,
- /*0x2cd0*/ 958,
- -1,
- /*0xa7aa*/ 1068,
- /*0x10cac*/ 1280,
- /*0x1eac*/ 618,
- /*0x24cd*/ 853,
- /*0x2c2c*/ 900,
- /*0x1e2c*/ 552,
- -1,
- /*0x0245*/ 223,
- /*0x0145*/ 90,
- /*0x0045*/ 4,
- /*0x10a2*/ 486,
- /*0x216b*/ 824,
- /*0x018e*/ 129,
- /*0xfb16*/ 1168,
- /*0x04a2*/ 374,
- /*0xa722*/ 1008,
- /*0x0504*/ 423,
- /*0x2cac*/ 940,
- /*0x013f*/ 87,
- /*0xabbf*/ 1157,
- /*0x1fa8*/ 752,
- /*0x0428*/ 337,
- /*0x0228*/ 210,
- /*0x0128*/ 77,
- /*0xaba8*/ 1134,
- -1,
- /*0x1f6b*/ 707,
- -1,
- /*0x10ca8*/ 1276,
- /*0x1ea8*/ 616,
- /*0xa7ac*/ 1070,
- /*0x2c28*/ 896,
- /*0x1e28*/ 550,
- /*0x049c*/ 371,
- -1, -1, -1,
- /*0x1fae*/ 758,
- /*0x042e*/ 343,
- /*0x022e*/ 213,
- /*0x012e*/ 80,
- /*0xabae*/ 1140,
- -1,
- /*0x0194*/ 134,
- /*0x2ca8*/ 938,
- /*0x10cae*/ 1282,
- /*0x1eae*/ 619,
- /*0xff26*/ 1175,
- /*0x2c2e*/ 902,
- /*0x1e2e*/ 553,
- /*0x1040c*/ 1208,
- /*0x1f8c*/ 724,
- /*0x040c*/ 309,
- /*0x020c*/ 196,
- /*0x010c*/ 63,
- /*0xab8c*/ 1106,
- /*0x0502*/ 422,
- /*0xa7a8*/ 1067,
- /*0xa688*/ 998,
- /*0x10c8c*/ 1248,
- /*0x1e8c*/ 600,
- /*0x2cae*/ 941,
- /*0x2c0c*/ 868,
- /*0x1e0c*/ 536,
- /*0xff24*/ 1173,
- /*0x2163*/ 816,
- -1, -1, -1, -1,
- /*0x1fb2*/ 760,
- -1,
- /*0x0232*/ 215,
- /*0x0132*/ 81,
- /*0xabb2*/ 1144,
- /*0x2c8c*/ 924,
- -1,
- /*0xa68a*/ 999,
- /*0x10cb2*/ 1286,
- /*0x1eb2*/ 621,
- -1, -1,
- /*0x1e32*/ 555,
- /*0x1ff6*/ 802,
- /*0x0476*/ 356,
- -1,
- /*0x0176*/ 115,
- -1,
- /*0x0186*/ 124,
- -1, -1,
- /*0xa680*/ 994,
- /*0x1ef6*/ 655,
- -1,
- /*0x2cb2*/ 943,
- /*0x1e76*/ 589,
- /*0x0230*/ 214,
- /*0x0130*/ 1320,
- /*0xabb0*/ 1142,
- /*0x052a*/ 442,
- /*0x10ad*/ 497,
- /*0x0345*/ 229,
- /*0x10cb0*/ 1284,
- /*0x1eb0*/ 620,
- -1,
- /*0xa698*/ 1006,
- /*0x1e30*/ 554,
- /*0xa7b2*/ 1074,
- -1, -1,
- /*0x0550*/ 476,
- -1,
- /*0x118a2*/ 1289,
- -1,
- /*0x004f*/ 13,
- /*0x1f1c*/ 672,
- -1,
- /*0x03aa*/ 266,
- /*0x2cb0*/ 942,
- /*0x01a2*/ 142,
- -1, -1,
- /*0xa696*/ 1005,
- -1, -1, -1, -1, -1,
- /*0x03d0*/ 271,
- /*0x052c*/ 443,
- /*0x1fba*/ 767,
- /*0xa7b0*/ 1072,
- /*0x023a*/ 216,
- /*0xabb5*/ 1147,
- /*0xabba*/ 1152,
- /*0xa650*/ 979,
- /*0x017d*/ 119,
- -1,
- /*0x019c*/ 138,
- /*0x1eba*/ 625,
- /*0xff27*/ 1176,
- /*0x0545*/ 465,
- /*0x1e3a*/ 559,
- /*0x10407*/ 1203,
- /*0x1f87*/ 719,
- /*0x0407*/ 304,
- /*0xab73*/ 1081,
- /*0x0587*/ 483,
- /*0xab87*/ 1101,
- /*0x13fd*/ 529,
- -1,
- /*0x053f*/ 459,
- /*0x10c87*/ 1243,
- /*0x1fb8*/ 765,
- /*0x2cba*/ 947,
- /*0x2c07*/ 863,
- /*0x0528*/ 441,
- /*0xabb8*/ 1150,
- -1, -1,
- /*0xff2f*/ 1184,
- /*0xab79*/ 1087,
- /*0x1eb8*/ 624,
- -1, -1,
- /*0x1e38*/ 558,
- /*0x10aa*/ 494,
- /*0xa690*/ 1002,
- /*0xab71*/ 1079,
- -1,
- /*0x04aa*/ 378,
- /*0xa72a*/ 1012,
- /*0x1fc9*/ 777,
- /*0x052e*/ 444,
- /*0x03a8*/ 264,
- /*0x0149*/ 92,
- /*0x0049*/ 1319,
- /*0x2cb8*/ 946,
- -1,
- /*0x0376*/ 232,
- /*0x00d0*/ 42,
- /*0x04d0*/ 397,
- /*0xa750*/ 1030,
- -1, -1,
- /*0x1fb6*/ 763,
- /*0x1f2d*/ 679,
- /*0x050c*/ 427,
- /*0x0136*/ 83,
- /*0xabb6*/ 1148,
- -1, -1,
- /*0x0184*/ 123,
- -1,
- /*0x1eb6*/ 623,
- /*0x1fbc*/ 769,
- /*0x10ac*/ 496,
- /*0x1e36*/ 557,
- /*0xa69a*/ 1007,
- /*0xabbc*/ 1154,
- /*0x04ac*/ 379,
- /*0xa72c*/ 1013,
- /*0x118ad*/ 1300,
- -1,
- /*0x1ebc*/ 626,
- /*0x038c*/ 238,
- /*0x0532*/ 446,
- /*0x1e3c*/ 560,
- /*0x10c5*/ 521,
- /*0x2cb6*/ 945,
- -1,
- /*0x00c5*/ 31,
- /*0x04c5*/ 392,
- -1, -1,
- /*0xfb14*/ 1166,
- -1,
- /*0x1fb4*/ 762,
- /*0x10bf*/ 515,
- /*0x2cbc*/ 948,
- /*0x0134*/ 82,
- /*0xabb4*/ 1146,
- /*0xa7b6*/ 1077,
- /*0x10a8*/ 492,
- -1, -1,
- /*0x1eb4*/ 622,
- /*0x04a8*/ 377,
- /*0xa728*/ 1011,
- /*0x1e34*/ 556,
- /*0x0055*/ 19,
- -1,
- /*0x0182*/ 122,
- -1, -1, -1, -1,
- /*0x212a*/ 810,
- -1, -1,
- /*0x10ae*/ 498,
- /*0x2cb4*/ 944,
- /*0xab75*/ 1083,
- /*0xa692*/ 1003,
- /*0x04ae*/ 380,
- /*0xa72e*/ 1014,
- /*0x054f*/ 475,
- /*0x1fbe*/ 770,
- /*0x03b0*/ 268,
- /*0x023e*/ 219,
- -1,
- /*0xabbe*/ 1156,
- /*0x1f2a*/ 676,
- -1,
- /*0xa7b4*/ 1076,
- -1,
- /*0x1ebe*/ 627,
- -1,
- /*0x048c*/ 363,
- /*0x1e3e*/ 561,
- /*0xfb06*/ 1164,
- -1, -1,
- /*0x1f50*/ 696,
- /*0x03cf*/ 270,
- /*0x0535*/ 449,
- /*0x053a*/ 454,
- -1,
- /*0x118aa*/ 1297,
- -1, -1,
- /*0x2cbe*/ 949,
- /*0x1fca*/ 778,
- /*0x10b2*/ 502,
- /*0x024a*/ 226,
- /*0x014a*/ 93,
- /*0x004a*/ 8,
- /*0x04b2*/ 382,
- /*0xa732*/ 1015,
- -1, -1,
- /*0x1eca*/ 633,
- /*0x1f2c*/ 678,
- -1,
- /*0x1e4a*/ 567,
- -1, -1,
- /*0x03fd*/ 294,
- -1,
- /*0x0538*/ 452,
- /*0x04f6*/ 416,
- /*0x1fe2*/ 789,
- /*0x0462*/ 346,
- /*0xa68e*/ 1001,
- /*0x0162*/ 105,
- -1,
- /*0x2cca*/ 955,
- /*0x10b0*/ 500,
- /*0x118ac*/ 1299,
- -1,
- /*0x1ee2*/ 645,
- /*0x04b0*/ 381,
- /*0x2c62*/ 904,
- /*0x1e62*/ 579,
- /*0x1f3f*/ 689,
- /*0x01ac*/ 147,
- -1, -1,
- /*0x0549*/ 469,
- /*0x1f28*/ 674,
- /*0x1fd6*/ 783,
- /*0xff22*/ 1171,
- -1,
- /*0x0156*/ 99,
- /*0x0056*/ 20,
- /*0x2ce2*/ 967,
- /*0x00cf*/ 41,
- /*0x01c5*/ 158,
- -1,
- /*0x1ed6*/ 639,
- /*0x118bf*/ 1318,
- /*0x0536*/ 450,
- /*0x1e56*/ 573,
- -1,
- /*0xa694*/ 1004,
- /*0x118a8*/ 1295,
- /*0x1f2e*/ 680,
- /*0x1fec*/ 798,
- /*0x046c*/ 351,
- -1,
- /*0x016c*/ 110,
- /*0x053c*/ 456,
- /*0x10b5*/ 505,
- /*0x10ba*/ 510,
- /*0x2cd6*/ 961,
- /*0x00b5*/ 25,
- /*0x1eec*/ 650,
- /*0x04ba*/ 386,
- /*0xa73a*/ 1019,
- /*0x1e6c*/ 584,
- /*0x1f0c*/ 664,
- /*0xa77d*/ 1048,
- /*0x118ae*/ 1301,
- /*0x1fcc*/ 780,
- /*0x2132*/ 812,
- /*0x024c*/ 227,
- /*0x014c*/ 94,
- /*0x004c*/ 10,
- -1,
- /*0x01ae*/ 148,
- /*0xab77*/ 1085,
- -1,
- /*0x1ecc*/ 634,
- /*0x0534*/ 448,
- -1,
- /*0x1e4c*/ 568,
- /*0x10b8*/ 508,
- -1, -1, -1,
- /*0x04b8*/ 385,
- /*0xa738*/ 1018,
- /*0x0555*/ 481,
- -1,
- /*0xfb04*/ 1162,
- -1, -1,
- /*0x2ccc*/ 956,
- -1,
- /*0xa686*/ 997,
- -1, -1,
- /*0x1fc8*/ 776,
- -1,
- /*0x0248*/ 225,
- /*0x118b2*/ 1305,
- /*0x0048*/ 7,
- -1,
- /*0x00c9*/ 35,
- /*0x04c9*/ 394,
- /*0x03d5*/ 273,
- /*0x1ec8*/ 632,
- /*0x01b2*/ 151,
- /*0x053e*/ 458,
- /*0x1e48*/ 566,
- /*0x1fc4*/ 773,
- -1,
- /*0x0244*/ 222,
- /*0x10b6*/ 506,
- /*0x0044*/ 3,
- -1, -1,
- /*0x04b6*/ 384,
- /*0xa736*/ 1017,
- /*0x1ec4*/ 630,
- /*0x01f6*/ 184,
- /*0x2cc8*/ 954,
- /*0x1e44*/ 564,
- /*0x10bc*/ 512,
- /*0x118b0*/ 1303,
- -1,
- /*0xff2d*/ 1182,
- /*0x04bc*/ 387,
- /*0xa73c*/ 1020,
- /*0xfb02*/ 1160,
- /*0x0051*/ 15,
- -1, -1,
- /*0x054a*/ 470,
- /*0x2cc4*/ 952,
- /*0x0241*/ 220,
- /*0x0141*/ 88,
- /*0x0041*/ 0,
- -1,
- /*0x1fea*/ 796,
- /*0x046a*/ 350,
- -1,
- /*0x016a*/ 109,
- -1,
- /*0x1f3a*/ 684,
- /*0x10b4*/ 504,
- -1,
- /*0x01cf*/ 164,
- /*0x1eea*/ 649,
- /*0x04b4*/ 383,
- /*0xa734*/ 1016,
- /*0x1e6a*/ 583,
- -1,
- /*0x1fe8*/ 794,
- /*0x0468*/ 349,
- -1,
- /*0x0168*/ 108,
- /*0x00d5*/ 47,
- /*0xa64a*/ 976,
- /*0x118b5*/ 1308,
- /*0x118ba*/ 1313,
- -1,
- /*0x1ee8*/ 648,
- /*0xab7f*/ 1093,
- -1,
- /*0x1e68*/ 582,
- /*0x01b5*/ 153,
- /*0x1f38*/ 682,
- -1, -1,
- /*0x03e2*/ 280,
- /*0x0556*/ 482,
- -1,
- /*0x1fe4*/ 791,
- /*0x0464*/ 347,
- /*0x10be*/ 514,
- /*0x0164*/ 106,
- /*0xa662*/ 988,
- -1,
- /*0x04be*/ 388,
- /*0xa73e*/ 1021,
- /*0x0187*/ 125,
- /*0x1ee4*/ 646,
- /*0x118b8*/ 1311,
- /*0x2c64*/ 906,
- /*0x1e64*/ 580,
- /*0x1f49*/ 691,
- /*0x24c5*/ 845,
- -1,
- /*0x03d6*/ 274,
- /*0x01b8*/ 155,
- /*0x0460*/ 345,
- /*0xff2a*/ 1179,
- /*0x0160*/ 104,
- -1, -1,
- /*0xa656*/ 982,
- /*0x24bf*/ 839,
- /*0xa684*/ 996,
- /*0x1ee0*/ 644,
- -1,
- /*0x2c60*/ 903,
- /*0x1e60*/ 578,
- /*0x00ca*/ 36,
- /*0x054c*/ 472,
- /*0xa74a*/ 1027,
- /*0x03ec*/ 285,
- -1, -1,
- /*0x1f3c*/ 686,
- -1, -1, -1,
- /*0xa66c*/ 993,
- /*0x2ce0*/ 966,
- /*0x118b6*/ 1309,
- -1, -1, -1, -1, -1, -1,
- /*0xff2c*/ 1181,
- /*0x04e2*/ 406,
- /*0xa762*/ 1039,
- /*0x118bc*/ 1315,
- -1,
- /*0x1fd2*/ 781,
- -1,
- /*0xa64c*/ 977,
- /*0x0152*/ 97,
- /*0x0052*/ 16,
- /*0x01bc*/ 156,
- /*0x0548*/ 468,
- -1, -1,
- /*0x1ed2*/ 637,
- -1,
- /*0xa682*/ 995,
- /*0x1e52*/ 571,
- -1,
- /*0x00d6*/ 48,
- /*0x04d6*/ 400,
- /*0xa756*/ 1033,
- -1, -1,
- /*0x0544*/ 464,
- /*0x118b4*/ 1307,
- -1,
- /*0xff28*/ 1177,
- -1,
- /*0x2cd2*/ 959,
- -1,
- /*0x1fb7*/ 764,
- -1, -1, -1,
- /*0xabb7*/ 1149,
- /*0xa648*/ 975,
- /*0x04ec*/ 411,
- /*0xa76c*/ 1044,
- /*0x1f3e*/ 688,
- /*0x0551*/ 477,
- /*0x01d5*/ 167,
- /*0x1fab*/ 755,
- /*0x042b*/ 340,
- /*0xff2e*/ 1183,
- -1,
- /*0xabab*/ 1137,
- /*0x0541*/ 461,
- -1,
- /*0xa644*/ 973,
- /*0x10cab*/ 1279,
- -1,
- /*0x00cc*/ 38,
- /*0x2c2b*/ 899,
- /*0xa74c*/ 1028,
- /*0x118be*/ 1317,
- -1, -1,
- /*0x03d1*/ 272,
- -1,
- /*0x1fe6*/ 792,
- /*0x0466*/ 348,
- -1,
- /*0x0166*/ 107,
- /*0x1f4a*/ 692,
- /*0x046e*/ 352,
- -1,
- /*0x016e*/ 111,
- /*0x2162*/ 815,
- /*0x1ee6*/ 647,
- /*0x24cf*/ 855,
- /*0x03ea*/ 284,
- /*0x1e66*/ 581,
- /*0x1eee*/ 651,
- -1,
- /*0x2c6e*/ 911,
- /*0x1e6e*/ 585,
- /*0xff32*/ 1187,
- /*0xa66a*/ 992,
- /*0xa7ab*/ 1069,
- -1,
- /*0x00c8*/ 34,
- -1,
- /*0xa748*/ 1026,
- -1,
- /*0x03e8*/ 283,
- -1,
- /*0x01ca*/ 161,
- -1, -1,
- /*0x24ba*/ 834,
- /*0x10c4*/ 520,
- /*0xa668*/ 991,
- -1,
- /*0x00c4*/ 30,
- -1,
- /*0xa744*/ 1024,
- -1, -1,
- /*0x1fc2*/ 771,
- -1,
- /*0xff30*/ 1185,
- /*0x1f56*/ 699,
- /*0x0042*/ 1,
- /*0x216c*/ 825,
- /*0x03e4*/ 281,
- /*0x01e2*/ 173,
- -1,
- /*0x1ec2*/ 629,
- -1,
- /*0x00d1*/ 43,
- /*0x1e42*/ 563,
- /*0xa664*/ 989,
- /*0x24b8*/ 832,
- /*0x10c1*/ 517,
- -1, -1,
- /*0x00c1*/ 27,
- /*0x04c1*/ 390,
- /*0x1f6c*/ 708,
- -1, -1,
- /*0x03e0*/ 279,
- /*0x2cc2*/ 951,
- /*0x04ea*/ 410,
- /*0xa76a*/ 1043,
- -1, -1, -1,
- /*0xa660*/ 987,
- -1, -1,
- /*0x24c9*/ 849,
- -1, -1,
- /*0x1f4c*/ 694,
- /*0xff35*/ 1190,
- /*0xff3a*/ 1195,
- /*0x04e8*/ 409,
- /*0xa768*/ 1042,
- /*0x1ffb*/ 807,
- /*0x0552*/ 478,
- /*0x01ec*/ 178,
- /*0x017b*/ 118,
- -1,
- /*0x24b6*/ 830,
- -1,
- /*0xa68c*/ 1000,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x24bc*/ 836,
- /*0x13fb*/ 527,
- -1,
- /*0x04e4*/ 407,
- /*0xa764*/ 1040,
- /*0xff38*/ 1193,
- /*0x1fa9*/ 753,
- /*0x0429*/ 338,
- -1,
- /*0x1f48*/ 690,
- /*0xaba9*/ 1135,
- /*0xa652*/ 980,
- /*0x0537*/ 451,
- -1,
- /*0x10ca9*/ 1277,
- -1,
- /*0x0470*/ 353,
- /*0x2c29*/ 897,
- /*0x0170*/ 112,
- /*0x1fda*/ 787,
- /*0x04e0*/ 405,
- /*0xa760*/ 1038,
- /*0x015a*/ 101,
- /*0x005a*/ 24,
- /*0x1ef0*/ 652,
- -1,
- /*0x2c70*/ 913,
- /*0x1e70*/ 586,
- /*0x1eda*/ 641,
- -1,
- /*0x1fd8*/ 785,
- /*0x1e5a*/ 575,
- /*0x01c8*/ 160,
- /*0x0158*/ 100,
- /*0x0058*/ 22,
- -1,
- /*0x216a*/ 823,
- /*0xff36*/ 1191,
- -1,
- /*0x1ed8*/ 640,
- -1,
- /*0x03ab*/ 267,
- /*0x1e58*/ 574,
- /*0x2cda*/ 963,
- -1,
- /*0x01c4*/ 157,
- -1, -1, -1, -1,
- /*0x2168*/ 821,
- /*0x1f6a*/ 706,
- /*0x24be*/ 838,
- -1,
- /*0x2cd8*/ 962,
- -1,
- /*0x00d2*/ 44,
- /*0x04d2*/ 398,
- /*0xa752*/ 1031,
- /*0x03e6*/ 282,
- -1,
- /*0x01d1*/ 165,
- -1,
- /*0x03ee*/ 286,
- -1,
- /*0x1f68*/ 704,
- /*0xa666*/ 990,
- -1, -1,
- /*0xff34*/ 1189,
- /*0x2164*/ 817,
- -1,
- /*0x0154*/ 98,
- /*0x0054*/ 18,
- /*0x01ea*/ 177,
- -1, -1,
- /*0x24ca*/ 850,
- /*0x1ed4*/ 638,
- /*0x10b7*/ 507,
- /*0x0542*/ 462,
- /*0x1e54*/ 572,
- /*0x024e*/ 228,
- /*0x014e*/ 95,
- /*0x004e*/ 12,
- -1, -1,
- /*0x2160*/ 813,
- /*0x01e8*/ 176,
- /*0x1ece*/ 635,
- /*0x10ab*/ 495,
- -1,
- /*0x1e4e*/ 569,
- /*0x2cd4*/ 960,
- /*0x015e*/ 103,
- -1, -1,
- /*0x1fc6*/ 774,
- /*0x03c2*/ 269,
- /*0x0246*/ 224,
- /*0x1ede*/ 643,
- /*0x0046*/ 5,
- -1,
- /*0x1e5e*/ 577,
- /*0x2cce*/ 957,
- /*0xa642*/ 972,
- /*0x1ec6*/ 631,
- -1,
- /*0x01e4*/ 174,
- /*0x1e46*/ 565,
- -1,
- /*0x0370*/ 230,
- /*0x04e6*/ 408,
- /*0xa766*/ 1041,
- /*0xab76*/ 1084,
- /*0x2cde*/ 965,
- /*0x04ee*/ 412,
- /*0xa76e*/ 1045,
- /*0x10425*/ 1233,
- /*0x1fa5*/ 749,
- /*0x0425*/ 334,
- /*0x2cc6*/ 953,
- -1,
- /*0xaba5*/ 1131,
- -1,
- /*0x01e0*/ 172,
- /*0x1ec0*/ 628,
- /*0x10ca5*/ 1273,
- /*0x1fc7*/ 775,
- /*0x1e40*/ 562,
- /*0x2c25*/ 893,
- /*0x0147*/ 91,
- /*0x0047*/ 6,
- /*0x1ff2*/ 799,
- /*0x0472*/ 354,
- -1,
- /*0x0172*/ 113,
- /*0x1ff4*/ 801,
- /*0x0474*/ 355,
- /*0x1f52*/ 697,
- /*0x0174*/ 114,
- /*0x2cc0*/ 950,
- /*0x1ef2*/ 653,
- -1,
- /*0x2c72*/ 914,
- /*0x1e72*/ 587,
- /*0x1ef4*/ 654,
- /*0x10c2*/ 518,
- /*0x24cc*/ 852,
- /*0x1e74*/ 588,
- /*0x00c2*/ 28,
- -1,
- /*0xa742*/ 1023,
- /*0x10423*/ 1231,
- /*0x1fa3*/ 747,
- /*0x0423*/ 332,
- -1,
- /*0x2cf2*/ 970,
- /*0xaba3*/ 1129,
- -1,
- /*0x03a9*/ 265,
- /*0x212b*/ 811,
- /*0x10ca3*/ 1271,
- -1,
- /*0xab7d*/ 1091,
- /*0x2c23*/ 891,
- /*0x10421*/ 1229,
- /*0x1fa1*/ 745,
- /*0x0421*/ 330,
- /*0x03f0*/ 287,
- /*0x1fb3*/ 761,
- /*0xaba1*/ 1127,
- -1,
- /*0x03da*/ 276,
- /*0xabb3*/ 1145,
- /*0x10ca1*/ 1269,
- /*0x1f2b*/ 677,
- /*0x24c8*/ 848,
- /*0x2c21*/ 889,
- /*0x2166*/ 819,
- /*0xa65a*/ 984,
- /*0x118b7*/ 1310,
- /*0xabb1*/ 1143,
- /*0x216e*/ 827,
- /*0x03d8*/ 275,
- -1,
- /*0x10cb1*/ 1285,
- -1,
- /*0x01b7*/ 154,
- -1,
- /*0x24c4*/ 844,
- /*0xa658*/ 983,
- /*0x118ab*/ 1298,
- /*0xa77b*/ 1047,
- /*0x10417*/ 1219,
- /*0x1f97*/ 735,
- /*0x0417*/ 320,
- -1,
- /*0x1f6e*/ 710,
- /*0xab97*/ 1117,
- /*0x047e*/ 360,
- -1, -1,
- /*0x10c97*/ 1259,
- /*0x1e97*/ 606,
- /*0x0554*/ 480,
- /*0x2c17*/ 879,
- /*0xa7b3*/ 1075,
- /*0x1efe*/ 659,
- /*0x10a9*/ 493,
- /*0x2c7e*/ 916,
- /*0x1e7e*/ 593,
- -1,
- /*0x24c1*/ 841,
- /*0x015c*/ 102,
- /*0xa7b1*/ 1073,
- /*0x054e*/ 474,
- /*0x01e6*/ 175,
- -1, -1,
- /*0x1edc*/ 642,
- /*0x01ee*/ 179,
- /*0x04f0*/ 413,
- /*0x1e5c*/ 576,
- -1,
- /*0x00da*/ 51,
- /*0x04da*/ 402,
- /*0xa75a*/ 1035,
- /*0x1fb9*/ 766,
- /*0x0372*/ 231,
- /*0xa654*/ 981,
- /*0x0139*/ 84,
- /*0xabb9*/ 1151,
- /*0x0546*/ 466,
- -1,
- /*0x2cdc*/ 964,
- /*0x00d8*/ 49,
- /*0x04d8*/ 401,
- /*0xa758*/ 1034,
- -1,
- /*0x1fc3*/ 772,
- /*0xa64e*/ 978,
- /*0x0243*/ 221,
- /*0x0143*/ 89,
- /*0x0043*/ 2,
- /*0x03de*/ 278,
- -1,
- /*0x1fbb*/ 768,
- -1,
- /*0x023b*/ 217,
- /*0x013b*/ 85,
- /*0xabbb*/ 1153,
- /*0xa65e*/ 986,
- /*0x0540*/ 460,
- /*0x1041d*/ 1225,
- /*0x1f9d*/ 741,
- /*0x041d*/ 326,
- -1,
- /*0xa646*/ 974,
- /*0xab9d*/ 1123,
- /*0x1041b*/ 1223,
- /*0x1f9b*/ 739,
- /*0x041b*/ 324,
- /*0x10c9d*/ 1265,
- /*0x0547*/ 467,
- /*0xab9b*/ 1121,
- /*0x2c1d*/ 885,
- -1, -1,
- /*0x10c9b*/ 1263,
- /*0x1e9b*/ 610,
- -1,
- /*0x2c1b*/ 883,
- /*0x03a5*/ 261,
- -1,
- /*0x00d4*/ 46,
- /*0x04d4*/ 399,
- /*0xa754*/ 1032,
- /*0xa640*/ 971,
- -1,
- /*0x10419*/ 1221,
- /*0x1f99*/ 737,
- /*0x0419*/ 322,
- -1, -1,
- /*0xab99*/ 1119,
- /*0x00ce*/ 40,
- -1,
- /*0xa74e*/ 1029,
- /*0x10c99*/ 1261,
- /*0x1e99*/ 608,
- /*0x03f4*/ 289,
- /*0x2c19*/ 881,
- -1, -1,
- /*0x1f29*/ 675,
- -1,
- /*0x00de*/ 55,
- /*0x04de*/ 404,
- /*0xa75e*/ 1037,
- -1,
- /*0x1ffa*/ 806,
- /*0x047a*/ 358,
- /*0x00c6*/ 32,
- -1,
- /*0xa746*/ 1025,
- /*0x0533*/ 447,
- -1,
- /*0x03a3*/ 259,
- -1,
- /*0x1efa*/ 657,
- /*0x118a9*/ 1296,
- /*0x1fcb*/ 779,
- /*0x1e7a*/ 591,
- /*0x0531*/ 445,
- -1,
- /*0x004b*/ 9,
- /*0x13fa*/ 526,
- /*0x01a9*/ 146,
- -1,
- /*0x10c0*/ 516,
- /*0x03a1*/ 258,
- /*0x10a5*/ 489,
- /*0x00c0*/ 26,
- /*0x04c0*/ 389,
- /*0xa740*/ 1022,
- -1,
- /*0x01f0*/ 180,
- /*0x023d*/ 218,
- /*0x013d*/ 86,
- /*0xabbd*/ 1155,
- /*0x10c7*/ 522,
- -1,
- /*0x24b7*/ 831,
- /*0x00c7*/ 33,
- /*0x04c7*/ 393,
- /*0x10413*/ 1215,
- /*0x1f93*/ 731,
- /*0x0413*/ 316,
- -1,
- /*0x04f2*/ 414,
- /*0xab93*/ 1113,
- -1,
- /*0x1fd3*/ 782,
- /*0x04f4*/ 415,
- /*0x10c93*/ 1255,
- -1,
- /*0x0053*/ 17,
- /*0x2c13*/ 875,
- /*0x0397*/ 248,
- /*0x1040f*/ 1211,
- /*0x1f8f*/ 727,
- /*0x040f*/ 312,
- /*0x03fe*/ 295,
- -1,
- /*0xab8f*/ 1109,
- -1,
- /*0x10a3*/ 487,
- /*0x1f54*/ 698,
- /*0x10c8f*/ 1251,
- -1, -1,
- /*0x2c0f*/ 871,
- -1,
- /*0x0539*/ 453,
- /*0x03dc*/ 277,
- /*0x1ff8*/ 804,
- /*0x0478*/ 357,
- -1,
- /*0x0178*/ 116,
- /*0x10a1*/ 485,
- -1,
- /*0xa65c*/ 985,
- /*0x10b3*/ 503,
- -1,
- /*0x1ef8*/ 656,
- /*0x0543*/ 463,
- -1,
- /*0x1e78*/ 590,
- -1,
- /*0xff37*/ 1192,
- /*0x10b1*/ 501,
- /*0x13f8*/ 524,
- /*0x053b*/ 455,
- -1, -1, -1,
- /*0x1040b*/ 1207,
- /*0x1f8b*/ 723,
- /*0x040b*/ 308,
- -1,
- /*0xff2b*/ 1180,
- /*0xab8b*/ 1105,
- /*0x1041f*/ 1227,
- /*0x1f9f*/ 743,
- /*0x041f*/ 328,
- /*0x10c8b*/ 1247,
- -1,
- /*0xab9f*/ 1125,
- /*0x2c0b*/ 867,
- -1,
- /*0x24c2*/ 842,
- /*0x10c9f*/ 1267,
- /*0x01de*/ 171,
- -1,
- /*0x2c1f*/ 887,
- /*0x04fe*/ 420,
- /*0xa77e*/ 1049,
- -1,
- /*0x039d*/ 254,
- -1,
- /*0x10415*/ 1217,
- /*0x1f95*/ 733,
- /*0x0415*/ 318,
- -1,
- /*0x039b*/ 252,
- /*0xab95*/ 1115,
- /*0x00dc*/ 53,
- /*0x04dc*/ 403,
- /*0xa75c*/ 1036,
- /*0x10c95*/ 1257,
- /*0x1ffc*/ 808,
- /*0x047c*/ 359,
- /*0x2c15*/ 877,
- /*0x118a5*/ 1292,
- /*0xa78b*/ 1054,
- -1,
- /*0x10411*/ 1213,
- /*0x1f91*/ 729,
- /*0x0411*/ 314,
- /*0x1efc*/ 658,
- /*0x10b9*/ 509,
- /*0xab91*/ 1111,
- /*0x1e7c*/ 592,
- -1,
- /*0x0399*/ 250,
- /*0x10c91*/ 1253,
- /*0x13fc*/ 528,
- -1,
- /*0x2c11*/ 873,
- /*0x01c7*/ 159,
- -1, -1,
- /*0x10c3*/ 519,
- -1,
- /*0x01f2*/ 182,
- /*0x00c3*/ 29,
- /*0x04c3*/ 391,
- /*0x054b*/ 471,
- /*0x01f4*/ 183,
- /*0x10bb*/ 511,
- /*0x1040d*/ 1209,
- /*0x1f8d*/ 725,
- /*0x040d*/ 310,
- -1,
- /*0x03fa*/ 293,
- /*0xab8d*/ 1107,
- -1, -1,
- /*0x118a3*/ 1290,
- /*0x10c8d*/ 1249,
- -1,
- /*0x053d*/ 457,
- /*0x2c0d*/ 869,
- /*0x10401*/ 1197,
- /*0x1f81*/ 713,
- /*0x0401*/ 298,
- -1, -1,
- /*0xab81*/ 1095,
- -1, -1,
- /*0x118a1*/ 1288,
- /*0x10c81*/ 1237,
- -1,
- /*0x118b3*/ 1306,
- /*0x2c01*/ 857,
- -1, -1,
- /*0x0553*/ 479,
- -1, -1,
- /*0x01b3*/ 152,
- /*0x118b1*/ 1304,
- -1, -1, -1, -1, -1,
- /*0xa78d*/ 1055,
- /*0x01b1*/ 150,
- /*0x0393*/ 244,
- /*0x10405*/ 1201,
- /*0x1f85*/ 717,
- /*0x0405*/ 302,
- -1, -1,
- /*0xab85*/ 1099,
- -1, -1, -1,
- /*0x10c85*/ 1241,
- -1, -1,
- /*0x2c05*/ 861,
- /*0x038f*/ 240,
- -1,
- /*0x0197*/ 136,
- /*0x04fa*/ 418,
- -1,
- /*0xff29*/ 1178,
- /*0x01fe*/ 189,
- -1, -1, -1, -1, -1,
- /*0x1f39*/ 683,
- /*0x00cb*/ 37,
- /*0x04cb*/ 395,
- -1, -1,
- /*0x10403*/ 1199,
- /*0x1f83*/ 715,
- /*0x0403*/ 300,
- /*0x2183*/ 829,
- -1,
- /*0xab83*/ 1097,
- -1,
- /*0x10bd*/ 513,
- -1,
- /*0x10c83*/ 1239,
- -1,
- /*0x118b9*/ 1312,
- /*0x2c03*/ 859,
- -1,
- /*0x1f3b*/ 685,
- /*0x24ce*/ 854,
- -1, -1, -1, -1, -1, -1,
- /*0x1f1d*/ 673,
- -1, -1, -1,
- /*0x039f*/ 256,
- /*0x00d3*/ 45,
- /*0x1f1b*/ 671,
- -1,
- /*0x118bb*/ 1314,
- -1,
- /*0x24c6*/ 846,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1,
- /*0x0395*/ 246,
- /*0x019d*/ 139,
- -1, -1,
- /*0x1f19*/ 669,
- -1, -1,
- /*0x04f8*/ 417,
- /*0x24c0*/ 840,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x0391*/ 242,
- -1, -1,
- /*0x24c7*/ 847,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- /*0x1f4b*/ 693,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1,
- /*0x01fa*/ 187,
- -1,
- /*0x1f3d*/ 687,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0xff25*/ 1174,
- /*0x01cb*/ 162,
- -1, -1, -1,
- /*0x04fc*/ 419,
- -1, -1,
- /*0x118bd*/ 1316,
- -1, -1, -1, -1, -1, -1,
- -1, -1,
- /*0x1f0f*/ 667,
- -1, -1, -1, -1, -1, -1,
- -1, -1,
- /*0x0193*/ 133,
- -1, -1, -1, -1, -1,
- /*0x01d3*/ 166,
- -1, -1,
- /*0xff23*/ 1172,
- -1, -1, -1, -1,
- /*0x018f*/ 130,
- -1, -1, -1, -1,
- /*0xab7b*/ 1089,
- -1, -1,
- /*0xff21*/ 1170,
- -1, -1,
- /*0xff33*/ 1188,
- -1, -1,
- /*0x1f0b*/ 663,
- /*0x01f8*/ 186,
- /*0xfb17*/ 1169,
- -1, -1,
- /*0xff31*/ 1186,
- -1, -1,
- /*0x24b9*/ 833,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1,
- /*0x24c3*/ 843,
- /*0xab70*/ 1078,
- -1,
- /*0x018b*/ 128,
- -1, -1, -1,
- /*0x24bb*/ 835,
- -1,
- /*0x019f*/ 140,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0xff39*/ 1194,
- /*0x01fc*/ 188,
- -1, -1, -1, -1, -1, -1,
- /*0x0191*/ 132,
- /*0x1f0d*/ 665,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- /*0x24cb*/ 851,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x0181*/ 121,
- -1, -1, -1, -1, -1,
- /*0x24bd*/ 837,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1,
- /*0xab72*/ 1080,
- -1, -1, -1,
- /*0xab74*/ 1082,
- /*0xfb13*/ 1165,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- /*0xab7e*/ 1092,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0xfb15*/ 1167,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1,
- /*0xfb01*/ 1159,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- /*0xfb05*/ 1163,
- -1, -1, -1, -1, -1, -1,
- /*0xab7a*/ 1088,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1,
- /*0xfb03*/ 1161,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1,
- /*0xab78*/ 1086,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- /*0xab7c*/ 1090
- };
-
- if (code <= MAX_CODE_VALUE && code >= MIN_CODE_VALUE)
- {
- register int key = onigenc_unicode_CaseFold_11_hash(code);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register short s = wordlist[key];
-
- if (s >= 0 && code1_equal(code, CaseFold_11_Table[s].from))
- return &CaseFold_11_Table[s].to;
- }
- }
- return 0;
-}
-
-static const CaseUnfold_11_Type CaseUnfold_11_Table[] = {
-#define CaseUnfold_11 (*(CaseUnfold_11_Type (*)[1195])(CaseUnfold_11_Table+0))
- {0x0061, {1, {0x0041}}},
- {0x0062, {1, {0x0042}}},
- {0x0063, {1, {0x0043}}},
- {0x0064, {1, {0x0044}}},
- {0x0065, {1, {0x0045}}},
- {0x0066, {1, {0x0046}}},
- {0x0067, {1, {0x0047}}},
- {0x0068, {1, {0x0048}}},
- {0x006a, {1, {0x004a}}},
- {0x006b, {2, {0x004b, 0x212a}}},
- {0x006c, {1, {0x004c}}},
- {0x006d, {1, {0x004d}}},
- {0x006e, {1, {0x004e}}},
- {0x006f, {1, {0x004f}}},
- {0x0070, {1, {0x0050}}},
- {0x0071, {1, {0x0051}}},
- {0x0072, {1, {0x0052}}},
- {0x0073, {2, {0x0053, 0x017f}}},
- {0x0074, {1, {0x0054}}},
- {0x0075, {1, {0x0055}}},
- {0x0076, {1, {0x0056}}},
- {0x0077, {1, {0x0057}}},
- {0x0078, {1, {0x0058}}},
- {0x0079, {1, {0x0059}}},
- {0x007a, {1, {0x005a}}},
- {0x00e0, {1, {0x00c0}}},
- {0x00e1, {1, {0x00c1}}},
- {0x00e2, {1, {0x00c2}}},
- {0x00e3, {1, {0x00c3}}},
- {0x00e4, {1, {0x00c4}}},
- {0x00e5, {2, {0x00c5, 0x212b}}},
- {0x00e6, {1, {0x00c6}}},
- {0x00e7, {1, {0x00c7}}},
- {0x00e8, {1, {0x00c8}}},
- {0x00e9, {1, {0x00c9}}},
- {0x00ea, {1, {0x00ca}}},
- {0x00eb, {1, {0x00cb}}},
- {0x00ec, {1, {0x00cc}}},
- {0x00ed, {1, {0x00cd}}},
- {0x00ee, {1, {0x00ce}}},
- {0x00ef, {1, {0x00cf}}},
- {0x00f0, {1, {0x00d0}}},
- {0x00f1, {1, {0x00d1}}},
- {0x00f2, {1, {0x00d2}}},
- {0x00f3, {1, {0x00d3}}},
- {0x00f4, {1, {0x00d4}}},
- {0x00f5, {1, {0x00d5}}},
- {0x00f6, {1, {0x00d6}}},
- {0x00f8, {1, {0x00d8}}},
- {0x00f9, {1, {0x00d9}}},
- {0x00fa, {1, {0x00da}}},
- {0x00fb, {1, {0x00db}}},
- {0x00fc, {1, {0x00dc}}},
- {0x00fd, {1, {0x00dd}}},
- {0x00fe, {1, {0x00de}}},
- {0x00ff, {1, {0x0178}}},
- {0x0101, {1, {0x0100}}},
- {0x0103, {1, {0x0102}}},
- {0x0105, {1, {0x0104}}},
- {0x0107, {1, {0x0106}}},
- {0x0109, {1, {0x0108}}},
- {0x010b, {1, {0x010a}}},
- {0x010d, {1, {0x010c}}},
- {0x010f, {1, {0x010e}}},
- {0x0111, {1, {0x0110}}},
- {0x0113, {1, {0x0112}}},
- {0x0115, {1, {0x0114}}},
- {0x0117, {1, {0x0116}}},
- {0x0119, {1, {0x0118}}},
- {0x011b, {1, {0x011a}}},
- {0x011d, {1, {0x011c}}},
- {0x011f, {1, {0x011e}}},
- {0x0121, {1, {0x0120}}},
- {0x0123, {1, {0x0122}}},
- {0x0125, {1, {0x0124}}},
- {0x0127, {1, {0x0126}}},
- {0x0129, {1, {0x0128}}},
- {0x012b, {1, {0x012a}}},
- {0x012d, {1, {0x012c}}},
- {0x012f, {1, {0x012e}}},
- {0x0133, {1, {0x0132}}},
- {0x0135, {1, {0x0134}}},
- {0x0137, {1, {0x0136}}},
- {0x013a, {1, {0x0139}}},
- {0x013c, {1, {0x013b}}},
- {0x013e, {1, {0x013d}}},
- {0x0140, {1, {0x013f}}},
- {0x0142, {1, {0x0141}}},
- {0x0144, {1, {0x0143}}},
- {0x0146, {1, {0x0145}}},
- {0x0148, {1, {0x0147}}},
- {0x014b, {1, {0x014a}}},
- {0x014d, {1, {0x014c}}},
- {0x014f, {1, {0x014e}}},
- {0x0151, {1, {0x0150}}},
- {0x0153, {1, {0x0152}}},
- {0x0155, {1, {0x0154}}},
- {0x0157, {1, {0x0156}}},
- {0x0159, {1, {0x0158}}},
- {0x015b, {1, {0x015a}}},
- {0x015d, {1, {0x015c}}},
- {0x015f, {1, {0x015e}}},
- {0x0161, {1, {0x0160}}},
- {0x0163, {1, {0x0162}}},
- {0x0165, {1, {0x0164}}},
- {0x0167, {1, {0x0166}}},
- {0x0169, {1, {0x0168}}},
- {0x016b, {1, {0x016a}}},
- {0x016d, {1, {0x016c}}},
- {0x016f, {1, {0x016e}}},
- {0x0171, {1, {0x0170}}},
- {0x0173, {1, {0x0172}}},
- {0x0175, {1, {0x0174}}},
- {0x0177, {1, {0x0176}}},
- {0x017a, {1, {0x0179}}},
- {0x017c, {1, {0x017b}}},
- {0x017e, {1, {0x017d}}},
- {0x0180, {1, {0x0243}}},
- {0x0183, {1, {0x0182}}},
- {0x0185, {1, {0x0184}}},
- {0x0188, {1, {0x0187}}},
- {0x018c, {1, {0x018b}}},
- {0x0192, {1, {0x0191}}},
- {0x0195, {1, {0x01f6}}},
- {0x0199, {1, {0x0198}}},
- {0x019a, {1, {0x023d}}},
- {0x019e, {1, {0x0220}}},
- {0x01a1, {1, {0x01a0}}},
- {0x01a3, {1, {0x01a2}}},
- {0x01a5, {1, {0x01a4}}},
- {0x01a8, {1, {0x01a7}}},
- {0x01ad, {1, {0x01ac}}},
- {0x01b0, {1, {0x01af}}},
- {0x01b4, {1, {0x01b3}}},
- {0x01b6, {1, {0x01b5}}},
- {0x01b9, {1, {0x01b8}}},
- {0x01bd, {1, {0x01bc}}},
- {0x01bf, {1, {0x01f7}}},
- {0x01c6, {2, {0x01c4, 0x01c5}}},
- {0x01c9, {2, {0x01c7, 0x01c8}}},
- {0x01cc, {2, {0x01ca, 0x01cb}}},
- {0x01ce, {1, {0x01cd}}},
- {0x01d0, {1, {0x01cf}}},
- {0x01d2, {1, {0x01d1}}},
- {0x01d4, {1, {0x01d3}}},
- {0x01d6, {1, {0x01d5}}},
- {0x01d8, {1, {0x01d7}}},
- {0x01da, {1, {0x01d9}}},
- {0x01dc, {1, {0x01db}}},
- {0x01dd, {1, {0x018e}}},
- {0x01df, {1, {0x01de}}},
- {0x01e1, {1, {0x01e0}}},
- {0x01e3, {1, {0x01e2}}},
- {0x01e5, {1, {0x01e4}}},
- {0x01e7, {1, {0x01e6}}},
- {0x01e9, {1, {0x01e8}}},
- {0x01eb, {1, {0x01ea}}},
- {0x01ed, {1, {0x01ec}}},
- {0x01ef, {1, {0x01ee}}},
- {0x01f3, {2, {0x01f1, 0x01f2}}},
- {0x01f5, {1, {0x01f4}}},
- {0x01f9, {1, {0x01f8}}},
- {0x01fb, {1, {0x01fa}}},
- {0x01fd, {1, {0x01fc}}},
- {0x01ff, {1, {0x01fe}}},
- {0x0201, {1, {0x0200}}},
- {0x0203, {1, {0x0202}}},
- {0x0205, {1, {0x0204}}},
- {0x0207, {1, {0x0206}}},
- {0x0209, {1, {0x0208}}},
- {0x020b, {1, {0x020a}}},
- {0x020d, {1, {0x020c}}},
- {0x020f, {1, {0x020e}}},
- {0x0211, {1, {0x0210}}},
- {0x0213, {1, {0x0212}}},
- {0x0215, {1, {0x0214}}},
- {0x0217, {1, {0x0216}}},
- {0x0219, {1, {0x0218}}},
- {0x021b, {1, {0x021a}}},
- {0x021d, {1, {0x021c}}},
- {0x021f, {1, {0x021e}}},
- {0x0223, {1, {0x0222}}},
- {0x0225, {1, {0x0224}}},
- {0x0227, {1, {0x0226}}},
- {0x0229, {1, {0x0228}}},
- {0x022b, {1, {0x022a}}},
- {0x022d, {1, {0x022c}}},
- {0x022f, {1, {0x022e}}},
- {0x0231, {1, {0x0230}}},
- {0x0233, {1, {0x0232}}},
- {0x023c, {1, {0x023b}}},
- {0x023f, {1, {0x2c7e}}},
- {0x0240, {1, {0x2c7f}}},
- {0x0242, {1, {0x0241}}},
- {0x0247, {1, {0x0246}}},
- {0x0249, {1, {0x0248}}},
- {0x024b, {1, {0x024a}}},
- {0x024d, {1, {0x024c}}},
- {0x024f, {1, {0x024e}}},
- {0x0250, {1, {0x2c6f}}},
- {0x0251, {1, {0x2c6d}}},
- {0x0252, {1, {0x2c70}}},
- {0x0253, {1, {0x0181}}},
- {0x0254, {1, {0x0186}}},
- {0x0256, {1, {0x0189}}},
- {0x0257, {1, {0x018a}}},
- {0x0259, {1, {0x018f}}},
- {0x025b, {1, {0x0190}}},
- {0x025c, {1, {0xa7ab}}},
- {0x0260, {1, {0x0193}}},
- {0x0261, {1, {0xa7ac}}},
- {0x0263, {1, {0x0194}}},
- {0x0265, {1, {0xa78d}}},
- {0x0266, {1, {0xa7aa}}},
- {0x0268, {1, {0x0197}}},
- {0x0269, {1, {0x0196}}},
- {0x026b, {1, {0x2c62}}},
- {0x026c, {1, {0xa7ad}}},
- {0x026f, {1, {0x019c}}},
- {0x0271, {1, {0x2c6e}}},
- {0x0272, {1, {0x019d}}},
- {0x0275, {1, {0x019f}}},
- {0x027d, {1, {0x2c64}}},
- {0x0280, {1, {0x01a6}}},
- {0x0283, {1, {0x01a9}}},
- {0x0287, {1, {0xa7b1}}},
- {0x0288, {1, {0x01ae}}},
- {0x0289, {1, {0x0244}}},
- {0x028a, {1, {0x01b1}}},
- {0x028b, {1, {0x01b2}}},
- {0x028c, {1, {0x0245}}},
- {0x0292, {1, {0x01b7}}},
- {0x029d, {1, {0xa7b2}}},
- {0x029e, {1, {0xa7b0}}},
- {0x0371, {1, {0x0370}}},
- {0x0373, {1, {0x0372}}},
- {0x0377, {1, {0x0376}}},
- {0x037b, {1, {0x03fd}}},
- {0x037c, {1, {0x03fe}}},
- {0x037d, {1, {0x03ff}}},
- {0x03ac, {1, {0x0386}}},
- {0x03ad, {1, {0x0388}}},
- {0x03ae, {1, {0x0389}}},
- {0x03af, {1, {0x038a}}},
- {0x03b1, {1, {0x0391}}},
- {0x03b2, {2, {0x0392, 0x03d0}}},
- {0x03b3, {1, {0x0393}}},
- {0x03b4, {1, {0x0394}}},
- {0x03b5, {2, {0x0395, 0x03f5}}},
- {0x03b6, {1, {0x0396}}},
- {0x03b7, {1, {0x0397}}},
- {0x03b8, {3, {0x0398, 0x03d1, 0x03f4}}},
- {0x03b9, {3, {0x0345, 0x0399, 0x1fbe}}},
- {0x03ba, {2, {0x039a, 0x03f0}}},
- {0x03bb, {1, {0x039b}}},
- {0x03bc, {2, {0x00b5, 0x039c}}},
- {0x03bd, {1, {0x039d}}},
- {0x03be, {1, {0x039e}}},
- {0x03bf, {1, {0x039f}}},
- {0x03c0, {2, {0x03a0, 0x03d6}}},
- {0x03c1, {2, {0x03a1, 0x03f1}}},
- {0x03c3, {2, {0x03a3, 0x03c2}}},
- {0x03c4, {1, {0x03a4}}},
- {0x03c5, {1, {0x03a5}}},
- {0x03c6, {2, {0x03a6, 0x03d5}}},
- {0x03c7, {1, {0x03a7}}},
- {0x03c8, {1, {0x03a8}}},
- {0x03c9, {2, {0x03a9, 0x2126}}},
- {0x03ca, {1, {0x03aa}}},
- {0x03cb, {1, {0x03ab}}},
- {0x03cc, {1, {0x038c}}},
- {0x03cd, {1, {0x038e}}},
- {0x03ce, {1, {0x038f}}},
- {0x03d7, {1, {0x03cf}}},
- {0x03d9, {1, {0x03d8}}},
- {0x03db, {1, {0x03da}}},
- {0x03dd, {1, {0x03dc}}},
- {0x03df, {1, {0x03de}}},
- {0x03e1, {1, {0x03e0}}},
- {0x03e3, {1, {0x03e2}}},
- {0x03e5, {1, {0x03e4}}},
- {0x03e7, {1, {0x03e6}}},
- {0x03e9, {1, {0x03e8}}},
- {0x03eb, {1, {0x03ea}}},
- {0x03ed, {1, {0x03ec}}},
- {0x03ef, {1, {0x03ee}}},
- {0x03f2, {1, {0x03f9}}},
- {0x03f3, {1, {0x037f}}},
- {0x03f8, {1, {0x03f7}}},
- {0x03fb, {1, {0x03fa}}},
- {0x0430, {1, {0x0410}}},
- {0x0431, {1, {0x0411}}},
- {0x0432, {1, {0x0412}}},
- {0x0433, {1, {0x0413}}},
- {0x0434, {1, {0x0414}}},
- {0x0435, {1, {0x0415}}},
- {0x0436, {1, {0x0416}}},
- {0x0437, {1, {0x0417}}},
- {0x0438, {1, {0x0418}}},
- {0x0439, {1, {0x0419}}},
- {0x043a, {1, {0x041a}}},
- {0x043b, {1, {0x041b}}},
- {0x043c, {1, {0x041c}}},
- {0x043d, {1, {0x041d}}},
- {0x043e, {1, {0x041e}}},
- {0x043f, {1, {0x041f}}},
- {0x0440, {1, {0x0420}}},
- {0x0441, {1, {0x0421}}},
- {0x0442, {1, {0x0422}}},
- {0x0443, {1, {0x0423}}},
- {0x0444, {1, {0x0424}}},
- {0x0445, {1, {0x0425}}},
- {0x0446, {1, {0x0426}}},
- {0x0447, {1, {0x0427}}},
- {0x0448, {1, {0x0428}}},
- {0x0449, {1, {0x0429}}},
- {0x044a, {1, {0x042a}}},
- {0x044b, {1, {0x042b}}},
- {0x044c, {1, {0x042c}}},
- {0x044d, {1, {0x042d}}},
- {0x044e, {1, {0x042e}}},
- {0x044f, {1, {0x042f}}},
- {0x0450, {1, {0x0400}}},
- {0x0451, {1, {0x0401}}},
- {0x0452, {1, {0x0402}}},
- {0x0453, {1, {0x0403}}},
- {0x0454, {1, {0x0404}}},
- {0x0455, {1, {0x0405}}},
- {0x0456, {1, {0x0406}}},
- {0x0457, {1, {0x0407}}},
- {0x0458, {1, {0x0408}}},
- {0x0459, {1, {0x0409}}},
- {0x045a, {1, {0x040a}}},
- {0x045b, {1, {0x040b}}},
- {0x045c, {1, {0x040c}}},
- {0x045d, {1, {0x040d}}},
- {0x045e, {1, {0x040e}}},
- {0x045f, {1, {0x040f}}},
- {0x0461, {1, {0x0460}}},
- {0x0463, {1, {0x0462}}},
- {0x0465, {1, {0x0464}}},
- {0x0467, {1, {0x0466}}},
- {0x0469, {1, {0x0468}}},
- {0x046b, {1, {0x046a}}},
- {0x046d, {1, {0x046c}}},
- {0x046f, {1, {0x046e}}},
- {0x0471, {1, {0x0470}}},
- {0x0473, {1, {0x0472}}},
- {0x0475, {1, {0x0474}}},
- {0x0477, {1, {0x0476}}},
- {0x0479, {1, {0x0478}}},
- {0x047b, {1, {0x047a}}},
- {0x047d, {1, {0x047c}}},
- {0x047f, {1, {0x047e}}},
- {0x0481, {1, {0x0480}}},
- {0x048b, {1, {0x048a}}},
- {0x048d, {1, {0x048c}}},
- {0x048f, {1, {0x048e}}},
- {0x0491, {1, {0x0490}}},
- {0x0493, {1, {0x0492}}},
- {0x0495, {1, {0x0494}}},
- {0x0497, {1, {0x0496}}},
- {0x0499, {1, {0x0498}}},
- {0x049b, {1, {0x049a}}},
- {0x049d, {1, {0x049c}}},
- {0x049f, {1, {0x049e}}},
- {0x04a1, {1, {0x04a0}}},
- {0x04a3, {1, {0x04a2}}},
- {0x04a5, {1, {0x04a4}}},
- {0x04a7, {1, {0x04a6}}},
- {0x04a9, {1, {0x04a8}}},
- {0x04ab, {1, {0x04aa}}},
- {0x04ad, {1, {0x04ac}}},
- {0x04af, {1, {0x04ae}}},
- {0x04b1, {1, {0x04b0}}},
- {0x04b3, {1, {0x04b2}}},
- {0x04b5, {1, {0x04b4}}},
- {0x04b7, {1, {0x04b6}}},
- {0x04b9, {1, {0x04b8}}},
- {0x04bb, {1, {0x04ba}}},
- {0x04bd, {1, {0x04bc}}},
- {0x04bf, {1, {0x04be}}},
- {0x04c2, {1, {0x04c1}}},
- {0x04c4, {1, {0x04c3}}},
- {0x04c6, {1, {0x04c5}}},
- {0x04c8, {1, {0x04c7}}},
- {0x04ca, {1, {0x04c9}}},
- {0x04cc, {1, {0x04cb}}},
- {0x04ce, {1, {0x04cd}}},
- {0x04cf, {1, {0x04c0}}},
- {0x04d1, {1, {0x04d0}}},
- {0x04d3, {1, {0x04d2}}},
- {0x04d5, {1, {0x04d4}}},
- {0x04d7, {1, {0x04d6}}},
- {0x04d9, {1, {0x04d8}}},
- {0x04db, {1, {0x04da}}},
- {0x04dd, {1, {0x04dc}}},
- {0x04df, {1, {0x04de}}},
- {0x04e1, {1, {0x04e0}}},
- {0x04e3, {1, {0x04e2}}},
- {0x04e5, {1, {0x04e4}}},
- {0x04e7, {1, {0x04e6}}},
- {0x04e9, {1, {0x04e8}}},
- {0x04eb, {1, {0x04ea}}},
- {0x04ed, {1, {0x04ec}}},
- {0x04ef, {1, {0x04ee}}},
- {0x04f1, {1, {0x04f0}}},
- {0x04f3, {1, {0x04f2}}},
- {0x04f5, {1, {0x04f4}}},
- {0x04f7, {1, {0x04f6}}},
- {0x04f9, {1, {0x04f8}}},
- {0x04fb, {1, {0x04fa}}},
- {0x04fd, {1, {0x04fc}}},
- {0x04ff, {1, {0x04fe}}},
- {0x0501, {1, {0x0500}}},
- {0x0503, {1, {0x0502}}},
- {0x0505, {1, {0x0504}}},
- {0x0507, {1, {0x0506}}},
- {0x0509, {1, {0x0508}}},
- {0x050b, {1, {0x050a}}},
- {0x050d, {1, {0x050c}}},
- {0x050f, {1, {0x050e}}},
- {0x0511, {1, {0x0510}}},
- {0x0513, {1, {0x0512}}},
- {0x0515, {1, {0x0514}}},
- {0x0517, {1, {0x0516}}},
- {0x0519, {1, {0x0518}}},
- {0x051b, {1, {0x051a}}},
- {0x051d, {1, {0x051c}}},
- {0x051f, {1, {0x051e}}},
- {0x0521, {1, {0x0520}}},
- {0x0523, {1, {0x0522}}},
- {0x0525, {1, {0x0524}}},
- {0x0527, {1, {0x0526}}},
- {0x0529, {1, {0x0528}}},
- {0x052b, {1, {0x052a}}},
- {0x052d, {1, {0x052c}}},
- {0x052f, {1, {0x052e}}},
- {0x0561, {1, {0x0531}}},
- {0x0562, {1, {0x0532}}},
- {0x0563, {1, {0x0533}}},
- {0x0564, {1, {0x0534}}},
- {0x0565, {1, {0x0535}}},
- {0x0566, {1, {0x0536}}},
- {0x0567, {1, {0x0537}}},
- {0x0568, {1, {0x0538}}},
- {0x0569, {1, {0x0539}}},
- {0x056a, {1, {0x053a}}},
- {0x056b, {1, {0x053b}}},
- {0x056c, {1, {0x053c}}},
- {0x056d, {1, {0x053d}}},
- {0x056e, {1, {0x053e}}},
- {0x056f, {1, {0x053f}}},
- {0x0570, {1, {0x0540}}},
- {0x0571, {1, {0x0541}}},
- {0x0572, {1, {0x0542}}},
- {0x0573, {1, {0x0543}}},
- {0x0574, {1, {0x0544}}},
- {0x0575, {1, {0x0545}}},
- {0x0576, {1, {0x0546}}},
- {0x0577, {1, {0x0547}}},
- {0x0578, {1, {0x0548}}},
- {0x0579, {1, {0x0549}}},
- {0x057a, {1, {0x054a}}},
- {0x057b, {1, {0x054b}}},
- {0x057c, {1, {0x054c}}},
- {0x057d, {1, {0x054d}}},
- {0x057e, {1, {0x054e}}},
- {0x057f, {1, {0x054f}}},
- {0x0580, {1, {0x0550}}},
- {0x0581, {1, {0x0551}}},
- {0x0582, {1, {0x0552}}},
- {0x0583, {1, {0x0553}}},
- {0x0584, {1, {0x0554}}},
- {0x0585, {1, {0x0555}}},
- {0x0586, {1, {0x0556}}},
- {0x13a0, {1, {0xab70}}},
- {0x13a1, {1, {0xab71}}},
- {0x13a2, {1, {0xab72}}},
- {0x13a3, {1, {0xab73}}},
- {0x13a4, {1, {0xab74}}},
- {0x13a5, {1, {0xab75}}},
- {0x13a6, {1, {0xab76}}},
- {0x13a7, {1, {0xab77}}},
- {0x13a8, {1, {0xab78}}},
- {0x13a9, {1, {0xab79}}},
- {0x13aa, {1, {0xab7a}}},
- {0x13ab, {1, {0xab7b}}},
- {0x13ac, {1, {0xab7c}}},
- {0x13ad, {1, {0xab7d}}},
- {0x13ae, {1, {0xab7e}}},
- {0x13af, {1, {0xab7f}}},
- {0x13b0, {1, {0xab80}}},
- {0x13b1, {1, {0xab81}}},
- {0x13b2, {1, {0xab82}}},
- {0x13b3, {1, {0xab83}}},
- {0x13b4, {1, {0xab84}}},
- {0x13b5, {1, {0xab85}}},
- {0x13b6, {1, {0xab86}}},
- {0x13b7, {1, {0xab87}}},
- {0x13b8, {1, {0xab88}}},
- {0x13b9, {1, {0xab89}}},
- {0x13ba, {1, {0xab8a}}},
- {0x13bb, {1, {0xab8b}}},
- {0x13bc, {1, {0xab8c}}},
- {0x13bd, {1, {0xab8d}}},
- {0x13be, {1, {0xab8e}}},
- {0x13bf, {1, {0xab8f}}},
- {0x13c0, {1, {0xab90}}},
- {0x13c1, {1, {0xab91}}},
- {0x13c2, {1, {0xab92}}},
- {0x13c3, {1, {0xab93}}},
- {0x13c4, {1, {0xab94}}},
- {0x13c5, {1, {0xab95}}},
- {0x13c6, {1, {0xab96}}},
- {0x13c7, {1, {0xab97}}},
- {0x13c8, {1, {0xab98}}},
- {0x13c9, {1, {0xab99}}},
- {0x13ca, {1, {0xab9a}}},
- {0x13cb, {1, {0xab9b}}},
- {0x13cc, {1, {0xab9c}}},
- {0x13cd, {1, {0xab9d}}},
- {0x13ce, {1, {0xab9e}}},
- {0x13cf, {1, {0xab9f}}},
- {0x13d0, {1, {0xaba0}}},
- {0x13d1, {1, {0xaba1}}},
- {0x13d2, {1, {0xaba2}}},
- {0x13d3, {1, {0xaba3}}},
- {0x13d4, {1, {0xaba4}}},
- {0x13d5, {1, {0xaba5}}},
- {0x13d6, {1, {0xaba6}}},
- {0x13d7, {1, {0xaba7}}},
- {0x13d8, {1, {0xaba8}}},
- {0x13d9, {1, {0xaba9}}},
- {0x13da, {1, {0xabaa}}},
- {0x13db, {1, {0xabab}}},
- {0x13dc, {1, {0xabac}}},
- {0x13dd, {1, {0xabad}}},
- {0x13de, {1, {0xabae}}},
- {0x13df, {1, {0xabaf}}},
- {0x13e0, {1, {0xabb0}}},
- {0x13e1, {1, {0xabb1}}},
- {0x13e2, {1, {0xabb2}}},
- {0x13e3, {1, {0xabb3}}},
- {0x13e4, {1, {0xabb4}}},
- {0x13e5, {1, {0xabb5}}},
- {0x13e6, {1, {0xabb6}}},
- {0x13e7, {1, {0xabb7}}},
- {0x13e8, {1, {0xabb8}}},
- {0x13e9, {1, {0xabb9}}},
- {0x13ea, {1, {0xabba}}},
- {0x13eb, {1, {0xabbb}}},
- {0x13ec, {1, {0xabbc}}},
- {0x13ed, {1, {0xabbd}}},
- {0x13ee, {1, {0xabbe}}},
- {0x13ef, {1, {0xabbf}}},
- {0x13f0, {1, {0x13f8}}},
- {0x13f1, {1, {0x13f9}}},
- {0x13f2, {1, {0x13fa}}},
- {0x13f3, {1, {0x13fb}}},
- {0x13f4, {1, {0x13fc}}},
- {0x13f5, {1, {0x13fd}}},
- {0x1d79, {1, {0xa77d}}},
- {0x1d7d, {1, {0x2c63}}},
- {0x1e01, {1, {0x1e00}}},
- {0x1e03, {1, {0x1e02}}},
- {0x1e05, {1, {0x1e04}}},
- {0x1e07, {1, {0x1e06}}},
- {0x1e09, {1, {0x1e08}}},
- {0x1e0b, {1, {0x1e0a}}},
- {0x1e0d, {1, {0x1e0c}}},
- {0x1e0f, {1, {0x1e0e}}},
- {0x1e11, {1, {0x1e10}}},
- {0x1e13, {1, {0x1e12}}},
- {0x1e15, {1, {0x1e14}}},
- {0x1e17, {1, {0x1e16}}},
- {0x1e19, {1, {0x1e18}}},
- {0x1e1b, {1, {0x1e1a}}},
- {0x1e1d, {1, {0x1e1c}}},
- {0x1e1f, {1, {0x1e1e}}},
- {0x1e21, {1, {0x1e20}}},
- {0x1e23, {1, {0x1e22}}},
- {0x1e25, {1, {0x1e24}}},
- {0x1e27, {1, {0x1e26}}},
- {0x1e29, {1, {0x1e28}}},
- {0x1e2b, {1, {0x1e2a}}},
- {0x1e2d, {1, {0x1e2c}}},
- {0x1e2f, {1, {0x1e2e}}},
- {0x1e31, {1, {0x1e30}}},
- {0x1e33, {1, {0x1e32}}},
- {0x1e35, {1, {0x1e34}}},
- {0x1e37, {1, {0x1e36}}},
- {0x1e39, {1, {0x1e38}}},
- {0x1e3b, {1, {0x1e3a}}},
- {0x1e3d, {1, {0x1e3c}}},
- {0x1e3f, {1, {0x1e3e}}},
- {0x1e41, {1, {0x1e40}}},
- {0x1e43, {1, {0x1e42}}},
- {0x1e45, {1, {0x1e44}}},
- {0x1e47, {1, {0x1e46}}},
- {0x1e49, {1, {0x1e48}}},
- {0x1e4b, {1, {0x1e4a}}},
- {0x1e4d, {1, {0x1e4c}}},
- {0x1e4f, {1, {0x1e4e}}},
- {0x1e51, {1, {0x1e50}}},
- {0x1e53, {1, {0x1e52}}},
- {0x1e55, {1, {0x1e54}}},
- {0x1e57, {1, {0x1e56}}},
- {0x1e59, {1, {0x1e58}}},
- {0x1e5b, {1, {0x1e5a}}},
- {0x1e5d, {1, {0x1e5c}}},
- {0x1e5f, {1, {0x1e5e}}},
- {0x1e61, {2, {0x1e60, 0x1e9b}}},
- {0x1e63, {1, {0x1e62}}},
- {0x1e65, {1, {0x1e64}}},
- {0x1e67, {1, {0x1e66}}},
- {0x1e69, {1, {0x1e68}}},
- {0x1e6b, {1, {0x1e6a}}},
- {0x1e6d, {1, {0x1e6c}}},
- {0x1e6f, {1, {0x1e6e}}},
- {0x1e71, {1, {0x1e70}}},
- {0x1e73, {1, {0x1e72}}},
- {0x1e75, {1, {0x1e74}}},
- {0x1e77, {1, {0x1e76}}},
- {0x1e79, {1, {0x1e78}}},
- {0x1e7b, {1, {0x1e7a}}},
- {0x1e7d, {1, {0x1e7c}}},
- {0x1e7f, {1, {0x1e7e}}},
- {0x1e81, {1, {0x1e80}}},
- {0x1e83, {1, {0x1e82}}},
- {0x1e85, {1, {0x1e84}}},
- {0x1e87, {1, {0x1e86}}},
- {0x1e89, {1, {0x1e88}}},
- {0x1e8b, {1, {0x1e8a}}},
- {0x1e8d, {1, {0x1e8c}}},
- {0x1e8f, {1, {0x1e8e}}},
- {0x1e91, {1, {0x1e90}}},
- {0x1e93, {1, {0x1e92}}},
- {0x1e95, {1, {0x1e94}}},
- {0x1ea1, {1, {0x1ea0}}},
- {0x1ea3, {1, {0x1ea2}}},
- {0x1ea5, {1, {0x1ea4}}},
- {0x1ea7, {1, {0x1ea6}}},
- {0x1ea9, {1, {0x1ea8}}},
- {0x1eab, {1, {0x1eaa}}},
- {0x1ead, {1, {0x1eac}}},
- {0x1eaf, {1, {0x1eae}}},
- {0x1eb1, {1, {0x1eb0}}},
- {0x1eb3, {1, {0x1eb2}}},
- {0x1eb5, {1, {0x1eb4}}},
- {0x1eb7, {1, {0x1eb6}}},
- {0x1eb9, {1, {0x1eb8}}},
- {0x1ebb, {1, {0x1eba}}},
- {0x1ebd, {1, {0x1ebc}}},
- {0x1ebf, {1, {0x1ebe}}},
- {0x1ec1, {1, {0x1ec0}}},
- {0x1ec3, {1, {0x1ec2}}},
- {0x1ec5, {1, {0x1ec4}}},
- {0x1ec7, {1, {0x1ec6}}},
- {0x1ec9, {1, {0x1ec8}}},
- {0x1ecb, {1, {0x1eca}}},
- {0x1ecd, {1, {0x1ecc}}},
- {0x1ecf, {1, {0x1ece}}},
- {0x1ed1, {1, {0x1ed0}}},
- {0x1ed3, {1, {0x1ed2}}},
- {0x1ed5, {1, {0x1ed4}}},
- {0x1ed7, {1, {0x1ed6}}},
- {0x1ed9, {1, {0x1ed8}}},
- {0x1edb, {1, {0x1eda}}},
- {0x1edd, {1, {0x1edc}}},
- {0x1edf, {1, {0x1ede}}},
- {0x1ee1, {1, {0x1ee0}}},
- {0x1ee3, {1, {0x1ee2}}},
- {0x1ee5, {1, {0x1ee4}}},
- {0x1ee7, {1, {0x1ee6}}},
- {0x1ee9, {1, {0x1ee8}}},
- {0x1eeb, {1, {0x1eea}}},
- {0x1eed, {1, {0x1eec}}},
- {0x1eef, {1, {0x1eee}}},
- {0x1ef1, {1, {0x1ef0}}},
- {0x1ef3, {1, {0x1ef2}}},
- {0x1ef5, {1, {0x1ef4}}},
- {0x1ef7, {1, {0x1ef6}}},
- {0x1ef9, {1, {0x1ef8}}},
- {0x1efb, {1, {0x1efa}}},
- {0x1efd, {1, {0x1efc}}},
- {0x1eff, {1, {0x1efe}}},
- {0x1f00, {1, {0x1f08}}},
- {0x1f01, {1, {0x1f09}}},
- {0x1f02, {1, {0x1f0a}}},
- {0x1f03, {1, {0x1f0b}}},
- {0x1f04, {1, {0x1f0c}}},
- {0x1f05, {1, {0x1f0d}}},
- {0x1f06, {1, {0x1f0e}}},
- {0x1f07, {1, {0x1f0f}}},
- {0x1f10, {1, {0x1f18}}},
- {0x1f11, {1, {0x1f19}}},
- {0x1f12, {1, {0x1f1a}}},
- {0x1f13, {1, {0x1f1b}}},
- {0x1f14, {1, {0x1f1c}}},
- {0x1f15, {1, {0x1f1d}}},
- {0x1f20, {1, {0x1f28}}},
- {0x1f21, {1, {0x1f29}}},
- {0x1f22, {1, {0x1f2a}}},
- {0x1f23, {1, {0x1f2b}}},
- {0x1f24, {1, {0x1f2c}}},
- {0x1f25, {1, {0x1f2d}}},
- {0x1f26, {1, {0x1f2e}}},
- {0x1f27, {1, {0x1f2f}}},
- {0x1f30, {1, {0x1f38}}},
- {0x1f31, {1, {0x1f39}}},
- {0x1f32, {1, {0x1f3a}}},
- {0x1f33, {1, {0x1f3b}}},
- {0x1f34, {1, {0x1f3c}}},
- {0x1f35, {1, {0x1f3d}}},
- {0x1f36, {1, {0x1f3e}}},
- {0x1f37, {1, {0x1f3f}}},
- {0x1f40, {1, {0x1f48}}},
- {0x1f41, {1, {0x1f49}}},
- {0x1f42, {1, {0x1f4a}}},
- {0x1f43, {1, {0x1f4b}}},
- {0x1f44, {1, {0x1f4c}}},
- {0x1f45, {1, {0x1f4d}}},
- {0x1f51, {1, {0x1f59}}},
- {0x1f53, {1, {0x1f5b}}},
- {0x1f55, {1, {0x1f5d}}},
- {0x1f57, {1, {0x1f5f}}},
- {0x1f60, {1, {0x1f68}}},
- {0x1f61, {1, {0x1f69}}},
- {0x1f62, {1, {0x1f6a}}},
- {0x1f63, {1, {0x1f6b}}},
- {0x1f64, {1, {0x1f6c}}},
- {0x1f65, {1, {0x1f6d}}},
- {0x1f66, {1, {0x1f6e}}},
- {0x1f67, {1, {0x1f6f}}},
- {0x1f70, {1, {0x1fba}}},
- {0x1f71, {1, {0x1fbb}}},
- {0x1f72, {1, {0x1fc8}}},
- {0x1f73, {1, {0x1fc9}}},
- {0x1f74, {1, {0x1fca}}},
- {0x1f75, {1, {0x1fcb}}},
- {0x1f76, {1, {0x1fda}}},
- {0x1f77, {1, {0x1fdb}}},
- {0x1f78, {1, {0x1ff8}}},
- {0x1f79, {1, {0x1ff9}}},
- {0x1f7a, {1, {0x1fea}}},
- {0x1f7b, {1, {0x1feb}}},
- {0x1f7c, {1, {0x1ffa}}},
- {0x1f7d, {1, {0x1ffb}}},
- {0x1fb0, {1, {0x1fb8}}},
- {0x1fb1, {1, {0x1fb9}}},
- {0x1fd0, {1, {0x1fd8}}},
- {0x1fd1, {1, {0x1fd9}}},
- {0x1fe0, {1, {0x1fe8}}},
- {0x1fe1, {1, {0x1fe9}}},
- {0x1fe5, {1, {0x1fec}}},
- {0x214e, {1, {0x2132}}},
- {0x2170, {1, {0x2160}}},
- {0x2171, {1, {0x2161}}},
- {0x2172, {1, {0x2162}}},
- {0x2173, {1, {0x2163}}},
- {0x2174, {1, {0x2164}}},
- {0x2175, {1, {0x2165}}},
- {0x2176, {1, {0x2166}}},
- {0x2177, {1, {0x2167}}},
- {0x2178, {1, {0x2168}}},
- {0x2179, {1, {0x2169}}},
- {0x217a, {1, {0x216a}}},
- {0x217b, {1, {0x216b}}},
- {0x217c, {1, {0x216c}}},
- {0x217d, {1, {0x216d}}},
- {0x217e, {1, {0x216e}}},
- {0x217f, {1, {0x216f}}},
- {0x2184, {1, {0x2183}}},
- {0x24d0, {1, {0x24b6}}},
- {0x24d1, {1, {0x24b7}}},
- {0x24d2, {1, {0x24b8}}},
- {0x24d3, {1, {0x24b9}}},
- {0x24d4, {1, {0x24ba}}},
- {0x24d5, {1, {0x24bb}}},
- {0x24d6, {1, {0x24bc}}},
- {0x24d7, {1, {0x24bd}}},
- {0x24d8, {1, {0x24be}}},
- {0x24d9, {1, {0x24bf}}},
- {0x24da, {1, {0x24c0}}},
- {0x24db, {1, {0x24c1}}},
- {0x24dc, {1, {0x24c2}}},
- {0x24dd, {1, {0x24c3}}},
- {0x24de, {1, {0x24c4}}},
- {0x24df, {1, {0x24c5}}},
- {0x24e0, {1, {0x24c6}}},
- {0x24e1, {1, {0x24c7}}},
- {0x24e2, {1, {0x24c8}}},
- {0x24e3, {1, {0x24c9}}},
- {0x24e4, {1, {0x24ca}}},
- {0x24e5, {1, {0x24cb}}},
- {0x24e6, {1, {0x24cc}}},
- {0x24e7, {1, {0x24cd}}},
- {0x24e8, {1, {0x24ce}}},
- {0x24e9, {1, {0x24cf}}},
- {0x2c30, {1, {0x2c00}}},
- {0x2c31, {1, {0x2c01}}},
- {0x2c32, {1, {0x2c02}}},
- {0x2c33, {1, {0x2c03}}},
- {0x2c34, {1, {0x2c04}}},
- {0x2c35, {1, {0x2c05}}},
- {0x2c36, {1, {0x2c06}}},
- {0x2c37, {1, {0x2c07}}},
- {0x2c38, {1, {0x2c08}}},
- {0x2c39, {1, {0x2c09}}},
- {0x2c3a, {1, {0x2c0a}}},
- {0x2c3b, {1, {0x2c0b}}},
- {0x2c3c, {1, {0x2c0c}}},
- {0x2c3d, {1, {0x2c0d}}},
- {0x2c3e, {1, {0x2c0e}}},
- {0x2c3f, {1, {0x2c0f}}},
- {0x2c40, {1, {0x2c10}}},
- {0x2c41, {1, {0x2c11}}},
- {0x2c42, {1, {0x2c12}}},
- {0x2c43, {1, {0x2c13}}},
- {0x2c44, {1, {0x2c14}}},
- {0x2c45, {1, {0x2c15}}},
- {0x2c46, {1, {0x2c16}}},
- {0x2c47, {1, {0x2c17}}},
- {0x2c48, {1, {0x2c18}}},
- {0x2c49, {1, {0x2c19}}},
- {0x2c4a, {1, {0x2c1a}}},
- {0x2c4b, {1, {0x2c1b}}},
- {0x2c4c, {1, {0x2c1c}}},
- {0x2c4d, {1, {0x2c1d}}},
- {0x2c4e, {1, {0x2c1e}}},
- {0x2c4f, {1, {0x2c1f}}},
- {0x2c50, {1, {0x2c20}}},
- {0x2c51, {1, {0x2c21}}},
- {0x2c52, {1, {0x2c22}}},
- {0x2c53, {1, {0x2c23}}},
- {0x2c54, {1, {0x2c24}}},
- {0x2c55, {1, {0x2c25}}},
- {0x2c56, {1, {0x2c26}}},
- {0x2c57, {1, {0x2c27}}},
- {0x2c58, {1, {0x2c28}}},
- {0x2c59, {1, {0x2c29}}},
- {0x2c5a, {1, {0x2c2a}}},
- {0x2c5b, {1, {0x2c2b}}},
- {0x2c5c, {1, {0x2c2c}}},
- {0x2c5d, {1, {0x2c2d}}},
- {0x2c5e, {1, {0x2c2e}}},
- {0x2c61, {1, {0x2c60}}},
- {0x2c65, {1, {0x023a}}},
- {0x2c66, {1, {0x023e}}},
- {0x2c68, {1, {0x2c67}}},
- {0x2c6a, {1, {0x2c69}}},
- {0x2c6c, {1, {0x2c6b}}},
- {0x2c73, {1, {0x2c72}}},
- {0x2c76, {1, {0x2c75}}},
- {0x2c81, {1, {0x2c80}}},
- {0x2c83, {1, {0x2c82}}},
- {0x2c85, {1, {0x2c84}}},
- {0x2c87, {1, {0x2c86}}},
- {0x2c89, {1, {0x2c88}}},
- {0x2c8b, {1, {0x2c8a}}},
- {0x2c8d, {1, {0x2c8c}}},
- {0x2c8f, {1, {0x2c8e}}},
- {0x2c91, {1, {0x2c90}}},
- {0x2c93, {1, {0x2c92}}},
- {0x2c95, {1, {0x2c94}}},
- {0x2c97, {1, {0x2c96}}},
- {0x2c99, {1, {0x2c98}}},
- {0x2c9b, {1, {0x2c9a}}},
- {0x2c9d, {1, {0x2c9c}}},
- {0x2c9f, {1, {0x2c9e}}},
- {0x2ca1, {1, {0x2ca0}}},
- {0x2ca3, {1, {0x2ca2}}},
- {0x2ca5, {1, {0x2ca4}}},
- {0x2ca7, {1, {0x2ca6}}},
- {0x2ca9, {1, {0x2ca8}}},
- {0x2cab, {1, {0x2caa}}},
- {0x2cad, {1, {0x2cac}}},
- {0x2caf, {1, {0x2cae}}},
- {0x2cb1, {1, {0x2cb0}}},
- {0x2cb3, {1, {0x2cb2}}},
- {0x2cb5, {1, {0x2cb4}}},
- {0x2cb7, {1, {0x2cb6}}},
- {0x2cb9, {1, {0x2cb8}}},
- {0x2cbb, {1, {0x2cba}}},
- {0x2cbd, {1, {0x2cbc}}},
- {0x2cbf, {1, {0x2cbe}}},
- {0x2cc1, {1, {0x2cc0}}},
- {0x2cc3, {1, {0x2cc2}}},
- {0x2cc5, {1, {0x2cc4}}},
- {0x2cc7, {1, {0x2cc6}}},
- {0x2cc9, {1, {0x2cc8}}},
- {0x2ccb, {1, {0x2cca}}},
- {0x2ccd, {1, {0x2ccc}}},
- {0x2ccf, {1, {0x2cce}}},
- {0x2cd1, {1, {0x2cd0}}},
- {0x2cd3, {1, {0x2cd2}}},
- {0x2cd5, {1, {0x2cd4}}},
- {0x2cd7, {1, {0x2cd6}}},
- {0x2cd9, {1, {0x2cd8}}},
- {0x2cdb, {1, {0x2cda}}},
- {0x2cdd, {1, {0x2cdc}}},
- {0x2cdf, {1, {0x2cde}}},
- {0x2ce1, {1, {0x2ce0}}},
- {0x2ce3, {1, {0x2ce2}}},
- {0x2cec, {1, {0x2ceb}}},
- {0x2cee, {1, {0x2ced}}},
- {0x2cf3, {1, {0x2cf2}}},
- {0x2d00, {1, {0x10a0}}},
- {0x2d01, {1, {0x10a1}}},
- {0x2d02, {1, {0x10a2}}},
- {0x2d03, {1, {0x10a3}}},
- {0x2d04, {1, {0x10a4}}},
- {0x2d05, {1, {0x10a5}}},
- {0x2d06, {1, {0x10a6}}},
- {0x2d07, {1, {0x10a7}}},
- {0x2d08, {1, {0x10a8}}},
- {0x2d09, {1, {0x10a9}}},
- {0x2d0a, {1, {0x10aa}}},
- {0x2d0b, {1, {0x10ab}}},
- {0x2d0c, {1, {0x10ac}}},
- {0x2d0d, {1, {0x10ad}}},
- {0x2d0e, {1, {0x10ae}}},
- {0x2d0f, {1, {0x10af}}},
- {0x2d10, {1, {0x10b0}}},
- {0x2d11, {1, {0x10b1}}},
- {0x2d12, {1, {0x10b2}}},
- {0x2d13, {1, {0x10b3}}},
- {0x2d14, {1, {0x10b4}}},
- {0x2d15, {1, {0x10b5}}},
- {0x2d16, {1, {0x10b6}}},
- {0x2d17, {1, {0x10b7}}},
- {0x2d18, {1, {0x10b8}}},
- {0x2d19, {1, {0x10b9}}},
- {0x2d1a, {1, {0x10ba}}},
- {0x2d1b, {1, {0x10bb}}},
- {0x2d1c, {1, {0x10bc}}},
- {0x2d1d, {1, {0x10bd}}},
- {0x2d1e, {1, {0x10be}}},
- {0x2d1f, {1, {0x10bf}}},
- {0x2d20, {1, {0x10c0}}},
- {0x2d21, {1, {0x10c1}}},
- {0x2d22, {1, {0x10c2}}},
- {0x2d23, {1, {0x10c3}}},
- {0x2d24, {1, {0x10c4}}},
- {0x2d25, {1, {0x10c5}}},
- {0x2d27, {1, {0x10c7}}},
- {0x2d2d, {1, {0x10cd}}},
- {0xa641, {1, {0xa640}}},
- {0xa643, {1, {0xa642}}},
- {0xa645, {1, {0xa644}}},
- {0xa647, {1, {0xa646}}},
- {0xa649, {1, {0xa648}}},
- {0xa64b, {1, {0xa64a}}},
- {0xa64d, {1, {0xa64c}}},
- {0xa64f, {1, {0xa64e}}},
- {0xa651, {1, {0xa650}}},
- {0xa653, {1, {0xa652}}},
- {0xa655, {1, {0xa654}}},
- {0xa657, {1, {0xa656}}},
- {0xa659, {1, {0xa658}}},
- {0xa65b, {1, {0xa65a}}},
- {0xa65d, {1, {0xa65c}}},
- {0xa65f, {1, {0xa65e}}},
- {0xa661, {1, {0xa660}}},
- {0xa663, {1, {0xa662}}},
- {0xa665, {1, {0xa664}}},
- {0xa667, {1, {0xa666}}},
- {0xa669, {1, {0xa668}}},
- {0xa66b, {1, {0xa66a}}},
- {0xa66d, {1, {0xa66c}}},
- {0xa681, {1, {0xa680}}},
- {0xa683, {1, {0xa682}}},
- {0xa685, {1, {0xa684}}},
- {0xa687, {1, {0xa686}}},
- {0xa689, {1, {0xa688}}},
- {0xa68b, {1, {0xa68a}}},
- {0xa68d, {1, {0xa68c}}},
- {0xa68f, {1, {0xa68e}}},
- {0xa691, {1, {0xa690}}},
- {0xa693, {1, {0xa692}}},
- {0xa695, {1, {0xa694}}},
- {0xa697, {1, {0xa696}}},
- {0xa699, {1, {0xa698}}},
- {0xa69b, {1, {0xa69a}}},
- {0xa723, {1, {0xa722}}},
- {0xa725, {1, {0xa724}}},
- {0xa727, {1, {0xa726}}},
- {0xa729, {1, {0xa728}}},
- {0xa72b, {1, {0xa72a}}},
- {0xa72d, {1, {0xa72c}}},
- {0xa72f, {1, {0xa72e}}},
- {0xa733, {1, {0xa732}}},
- {0xa735, {1, {0xa734}}},
- {0xa737, {1, {0xa736}}},
- {0xa739, {1, {0xa738}}},
- {0xa73b, {1, {0xa73a}}},
- {0xa73d, {1, {0xa73c}}},
- {0xa73f, {1, {0xa73e}}},
- {0xa741, {1, {0xa740}}},
- {0xa743, {1, {0xa742}}},
- {0xa745, {1, {0xa744}}},
- {0xa747, {1, {0xa746}}},
- {0xa749, {1, {0xa748}}},
- {0xa74b, {1, {0xa74a}}},
- {0xa74d, {1, {0xa74c}}},
- {0xa74f, {1, {0xa74e}}},
- {0xa751, {1, {0xa750}}},
- {0xa753, {1, {0xa752}}},
- {0xa755, {1, {0xa754}}},
- {0xa757, {1, {0xa756}}},
- {0xa759, {1, {0xa758}}},
- {0xa75b, {1, {0xa75a}}},
- {0xa75d, {1, {0xa75c}}},
- {0xa75f, {1, {0xa75e}}},
- {0xa761, {1, {0xa760}}},
- {0xa763, {1, {0xa762}}},
- {0xa765, {1, {0xa764}}},
- {0xa767, {1, {0xa766}}},
- {0xa769, {1, {0xa768}}},
- {0xa76b, {1, {0xa76a}}},
- {0xa76d, {1, {0xa76c}}},
- {0xa76f, {1, {0xa76e}}},
- {0xa77a, {1, {0xa779}}},
- {0xa77c, {1, {0xa77b}}},
- {0xa77f, {1, {0xa77e}}},
- {0xa781, {1, {0xa780}}},
- {0xa783, {1, {0xa782}}},
- {0xa785, {1, {0xa784}}},
- {0xa787, {1, {0xa786}}},
- {0xa78c, {1, {0xa78b}}},
- {0xa791, {1, {0xa790}}},
- {0xa793, {1, {0xa792}}},
- {0xa797, {1, {0xa796}}},
- {0xa799, {1, {0xa798}}},
- {0xa79b, {1, {0xa79a}}},
- {0xa79d, {1, {0xa79c}}},
- {0xa79f, {1, {0xa79e}}},
- {0xa7a1, {1, {0xa7a0}}},
- {0xa7a3, {1, {0xa7a2}}},
- {0xa7a5, {1, {0xa7a4}}},
- {0xa7a7, {1, {0xa7a6}}},
- {0xa7a9, {1, {0xa7a8}}},
- {0xa7b5, {1, {0xa7b4}}},
- {0xa7b7, {1, {0xa7b6}}},
- {0xab53, {1, {0xa7b3}}},
- {0xff41, {1, {0xff21}}},
- {0xff42, {1, {0xff22}}},
- {0xff43, {1, {0xff23}}},
- {0xff44, {1, {0xff24}}},
- {0xff45, {1, {0xff25}}},
- {0xff46, {1, {0xff26}}},
- {0xff47, {1, {0xff27}}},
- {0xff48, {1, {0xff28}}},
- {0xff49, {1, {0xff29}}},
- {0xff4a, {1, {0xff2a}}},
- {0xff4b, {1, {0xff2b}}},
- {0xff4c, {1, {0xff2c}}},
- {0xff4d, {1, {0xff2d}}},
- {0xff4e, {1, {0xff2e}}},
- {0xff4f, {1, {0xff2f}}},
- {0xff50, {1, {0xff30}}},
- {0xff51, {1, {0xff31}}},
- {0xff52, {1, {0xff32}}},
- {0xff53, {1, {0xff33}}},
- {0xff54, {1, {0xff34}}},
- {0xff55, {1, {0xff35}}},
- {0xff56, {1, {0xff36}}},
- {0xff57, {1, {0xff37}}},
- {0xff58, {1, {0xff38}}},
- {0xff59, {1, {0xff39}}},
- {0xff5a, {1, {0xff3a}}},
- {0x10428, {1, {0x10400}}},
- {0x10429, {1, {0x10401}}},
- {0x1042a, {1, {0x10402}}},
- {0x1042b, {1, {0x10403}}},
- {0x1042c, {1, {0x10404}}},
- {0x1042d, {1, {0x10405}}},
- {0x1042e, {1, {0x10406}}},
- {0x1042f, {1, {0x10407}}},
- {0x10430, {1, {0x10408}}},
- {0x10431, {1, {0x10409}}},
- {0x10432, {1, {0x1040a}}},
- {0x10433, {1, {0x1040b}}},
- {0x10434, {1, {0x1040c}}},
- {0x10435, {1, {0x1040d}}},
- {0x10436, {1, {0x1040e}}},
- {0x10437, {1, {0x1040f}}},
- {0x10438, {1, {0x10410}}},
- {0x10439, {1, {0x10411}}},
- {0x1043a, {1, {0x10412}}},
- {0x1043b, {1, {0x10413}}},
- {0x1043c, {1, {0x10414}}},
- {0x1043d, {1, {0x10415}}},
- {0x1043e, {1, {0x10416}}},
- {0x1043f, {1, {0x10417}}},
- {0x10440, {1, {0x10418}}},
- {0x10441, {1, {0x10419}}},
- {0x10442, {1, {0x1041a}}},
- {0x10443, {1, {0x1041b}}},
- {0x10444, {1, {0x1041c}}},
- {0x10445, {1, {0x1041d}}},
- {0x10446, {1, {0x1041e}}},
- {0x10447, {1, {0x1041f}}},
- {0x10448, {1, {0x10420}}},
- {0x10449, {1, {0x10421}}},
- {0x1044a, {1, {0x10422}}},
- {0x1044b, {1, {0x10423}}},
- {0x1044c, {1, {0x10424}}},
- {0x1044d, {1, {0x10425}}},
- {0x1044e, {1, {0x10426}}},
- {0x1044f, {1, {0x10427}}},
- {0x10cc0, {1, {0x10c80}}},
- {0x10cc1, {1, {0x10c81}}},
- {0x10cc2, {1, {0x10c82}}},
- {0x10cc3, {1, {0x10c83}}},
- {0x10cc4, {1, {0x10c84}}},
- {0x10cc5, {1, {0x10c85}}},
- {0x10cc6, {1, {0x10c86}}},
- {0x10cc7, {1, {0x10c87}}},
- {0x10cc8, {1, {0x10c88}}},
- {0x10cc9, {1, {0x10c89}}},
- {0x10cca, {1, {0x10c8a}}},
- {0x10ccb, {1, {0x10c8b}}},
- {0x10ccc, {1, {0x10c8c}}},
- {0x10ccd, {1, {0x10c8d}}},
- {0x10cce, {1, {0x10c8e}}},
- {0x10ccf, {1, {0x10c8f}}},
- {0x10cd0, {1, {0x10c90}}},
- {0x10cd1, {1, {0x10c91}}},
- {0x10cd2, {1, {0x10c92}}},
- {0x10cd3, {1, {0x10c93}}},
- {0x10cd4, {1, {0x10c94}}},
- {0x10cd5, {1, {0x10c95}}},
- {0x10cd6, {1, {0x10c96}}},
- {0x10cd7, {1, {0x10c97}}},
- {0x10cd8, {1, {0x10c98}}},
- {0x10cd9, {1, {0x10c99}}},
- {0x10cda, {1, {0x10c9a}}},
- {0x10cdb, {1, {0x10c9b}}},
- {0x10cdc, {1, {0x10c9c}}},
- {0x10cdd, {1, {0x10c9d}}},
- {0x10cde, {1, {0x10c9e}}},
- {0x10cdf, {1, {0x10c9f}}},
- {0x10ce0, {1, {0x10ca0}}},
- {0x10ce1, {1, {0x10ca1}}},
- {0x10ce2, {1, {0x10ca2}}},
- {0x10ce3, {1, {0x10ca3}}},
- {0x10ce4, {1, {0x10ca4}}},
- {0x10ce5, {1, {0x10ca5}}},
- {0x10ce6, {1, {0x10ca6}}},
- {0x10ce7, {1, {0x10ca7}}},
- {0x10ce8, {1, {0x10ca8}}},
- {0x10ce9, {1, {0x10ca9}}},
- {0x10cea, {1, {0x10caa}}},
- {0x10ceb, {1, {0x10cab}}},
- {0x10cec, {1, {0x10cac}}},
- {0x10ced, {1, {0x10cad}}},
- {0x10cee, {1, {0x10cae}}},
- {0x10cef, {1, {0x10caf}}},
- {0x10cf0, {1, {0x10cb0}}},
- {0x10cf1, {1, {0x10cb1}}},
- {0x10cf2, {1, {0x10cb2}}},
- {0x118c0, {1, {0x118a0}}},
- {0x118c1, {1, {0x118a1}}},
- {0x118c2, {1, {0x118a2}}},
- {0x118c3, {1, {0x118a3}}},
- {0x118c4, {1, {0x118a4}}},
- {0x118c5, {1, {0x118a5}}},
- {0x118c6, {1, {0x118a6}}},
- {0x118c7, {1, {0x118a7}}},
- {0x118c8, {1, {0x118a8}}},
- {0x118c9, {1, {0x118a9}}},
- {0x118ca, {1, {0x118aa}}},
- {0x118cb, {1, {0x118ab}}},
- {0x118cc, {1, {0x118ac}}},
- {0x118cd, {1, {0x118ad}}},
- {0x118ce, {1, {0x118ae}}},
- {0x118cf, {1, {0x118af}}},
- {0x118d0, {1, {0x118b0}}},
- {0x118d1, {1, {0x118b1}}},
- {0x118d2, {1, {0x118b2}}},
- {0x118d3, {1, {0x118b3}}},
- {0x118d4, {1, {0x118b4}}},
- {0x118d5, {1, {0x118b5}}},
- {0x118d6, {1, {0x118b6}}},
- {0x118d7, {1, {0x118b7}}},
- {0x118d8, {1, {0x118b8}}},
- {0x118d9, {1, {0x118b9}}},
- {0x118da, {1, {0x118ba}}},
- {0x118db, {1, {0x118bb}}},
- {0x118dc, {1, {0x118bc}}},
- {0x118dd, {1, {0x118bd}}},
- {0x118de, {1, {0x118be}}},
- {0x118df, {1, {0x118bf}}},
-#define CaseUnfold_11_Locale (*(CaseUnfold_11_Type (*)[1])(CaseUnfold_11_Table+1195))
- {0x0069, {1, {0x0049}}},
+static const CaseFold_11_Type CaseFold_Locale[] = {
+ { 0x0049, {1, {0x0069}}},
+ { 0x0130, {2, {0x0069, 0x0307}}},
};
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -7 -k1,2,3 -F,-1 -c -j1 -i1 -t -T -E -C -H onigenc_unicode_CaseUnfold_11_hash -N onigenc_unicode_CaseUnfold_11_lookup -n */
-
-/* maximum key range = 1827, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-/*ARGSUSED*/
-static unsigned int
-onigenc_unicode_CaseUnfold_11_hash(const OnigCodePoint code)
-{
- static const unsigned short asso_values[] =
- {
- 1, 1835, 2, 3, 10, 394, 4, 366, 7, 116,
- 606, 172, 8, 3, 427, 383, 1835, 1835, 1835, 1835,
- 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 2,
- 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835, 1835,
- 1835, 1835, 1835, 6, 1835, 1835, 1835, 1835, 1835, 1835,
- 1835, 1835, 1835, 99, 1835, 1835, 1835, 1835, 1835, 1835,
- 1835, 1835, 17, 1835, 2, 1, 247, 534, 98, 649,
- 515, 641, 50, 852, 359, 1213, 51, 12, 636, 1194,
- 134, 459, 8, 386, 441, 708, 1, 680, 7, 976,
- 40, 899, 70, 5, 433, 1006, 116, 1273, 227, 773,
- 128, 660, 59, 618, 35, 698, 622, 968, 121, 1055,
- 305, 598, 129, 934, 1138, 669, 1398, 397, 1329, 589,
- 1283, 542, 1384, 825, 1364, 1032, 579, 815, 1341, 689,
- 327, 307, 797, 287, 782, 259, 752, 235, 995, 211,
- 1176, 175, 623, 151, 565, 115, 984, 31, 1163, 67,
- 1151, 139, 1108, 55, 1258, 79, 1226, 91, 1217, 192,
- 199, 350, 1299, 19, 1292, 43, 1239, 103, 1141, 370,
- 1250, 417, 1166, 446, 1237, 517, 1333, 506, 1011, 716,
- 903, 485, 947, 739, 983, 1126, 1122, 874, 1069, 847,
- 408, 861, 220, 957
- };
- return asso_values[bits_of(code, 2)+66] + asso_values[bits_of(code, 1)+4] + asso_values[bits_of(code, 0)];
-}
-
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-static const CodePointList3 *
-onigenc_unicode_CaseUnfold_11_lookup(const OnigCodePoint code)
-{
- enum
- {
- MIN_CODE_VALUE = 0x61,
- MAX_CODE_VALUE = 0x118df,
- TOTAL_KEYWORDS = 1196,
- MIN_WORD_LENGTH = 3,
- MAX_WORD_LENGTH = 3,
- MIN_HASH_VALUE = 8,
- MAX_HASH_VALUE = 1834
- };
-
- static const short wordlist[] =
- {
- -1, -1, -1, -1, -1, -1,
- -1, -1,
- /*0x1e1b*/ 577,
- /*0x049b*/ 363,
- /*0x011b*/ 69,
- /*0x2c9b*/ 868,
- -1,
- /*0x021b*/ 178,
- /*0x1e8b*/ 633,
- /*0x1e0b*/ 569,
- /*0x048b*/ 355,
- /*0x010b*/ 61,
- /*0x2c8b*/ 860,
- -1,
- /*0x020b*/ 170,
- /*0x1ee1*/ 671,
- /*0x1e61*/ 612,
- /*0x04e1*/ 398,
- /*0x0161*/ 102,
- /*0x2ce1*/ 903,
- /*0x13e1*/ 541,
- /*0x0261*/ 210,
- /*0x0461*/ 338,
- /*0xa761*/ 1015,
- /*0x0061*/ 0,
- /*0x10ce1*/ 1145,
- /*0x24e1*/ 791,
- /*0x1ed1*/ 663,
- /*0x1e51*/ 604,
- /*0x04d1*/ 390,
- /*0x0151*/ 94,
- /*0x2cd1*/ 895,
- /*0x13d1*/ 525,
- /*0x0251*/ 200,
- /*0x0451*/ 323,
- /*0xa751*/ 1007,
- /*0x13a6*/ 482,
- /*0x10cd1*/ 1129,
- /*0x24d1*/ 775,
- /*0x1ee3*/ 672,
- /*0x1e63*/ 613,
- /*0x04e3*/ 399,
- /*0x0163*/ 103,
- /*0x2ce3*/ 904,
- /*0x13e3*/ 543,
- /*0x0263*/ 211,
- /*0x0463*/ 339,
- /*0xa763*/ 1016,
- /*0x0063*/ 2,
- /*0x10ce3*/ 1147,
- /*0x24e3*/ 793,
- /*0x1ed7*/ 666,
- /*0x1e57*/ 607,
- /*0x04d7*/ 393,
- /*0x0157*/ 97,
- /*0x2cd7*/ 898,
- /*0x13d7*/ 531,
- /*0x0257*/ 205,
- /*0x0457*/ 329,
- /*0xa757*/ 1010,
- /*0x13a4*/ 480,
- /*0x10cd7*/ 1135,
- /*0x24d7*/ 781,
- /*0x1ed3*/ 664,
- /*0x1e53*/ 605,
- /*0x04d3*/ 391,
- /*0x0153*/ 95,
- /*0x2cd3*/ 896,
- /*0x13d3*/ 527,
- /*0x0253*/ 202,
- /*0x0453*/ 325,
- /*0xa753*/ 1008,
- -1,
- /*0x10cd3*/ 1131,
- /*0x24d3*/ 777,
- /*0x1ed9*/ 667,
- /*0x1e59*/ 608,
- /*0x04d9*/ 394,
- /*0x0159*/ 98,
- /*0x2cd9*/ 899,
- /*0x13d9*/ 533,
- /*0x0259*/ 206,
- /*0x0459*/ 331,
- /*0xa759*/ 1011,
- /*0x2c61*/ 847,
- /*0x10cd9*/ 1137,
- /*0x24d9*/ 783,
- /*0x1edb*/ 668,
- /*0x1e5b*/ 609,
- /*0x04db*/ 395,
- /*0x015b*/ 99,
- /*0x2cdb*/ 900,
- /*0x13db*/ 535,
- /*0x025b*/ 207,
- /*0x045b*/ 333,
- /*0xa75b*/ 1012,
- /*0x2c51*/ 833,
- /*0x10cdb*/ 1139,
- /*0x24db*/ 785,
- /*0x1ee5*/ 673,
- /*0x1e65*/ 614,
- /*0x04e5*/ 400,
- /*0x0165*/ 104,
- /*0xab53*/ 1045,
- /*0x13e5*/ 545,
- /*0x0265*/ 212,
- /*0x0465*/ 340,
- /*0xa765*/ 1017,
- /*0x0065*/ 4,
- /*0x10ce5*/ 1149,
- /*0x24e5*/ 795,
- /*0x1ecf*/ 662,
- /*0x1e4f*/ 603,
- /*0x04cf*/ 389,
- /*0x014f*/ 93,
- /*0x2ccf*/ 894,
- /*0x13cf*/ 523,
- /*0x024f*/ 198,
- /*0x044f*/ 321,
- /*0xa74f*/ 1006,
- /*0x2c57*/ 839,
- /*0x10ccf*/ 1127,
- /*0x13aa*/ 486,
- /*0x028b*/ 229,
- -1, -1, -1,
- /*0x1044f*/ 1111,
- -1,
- /*0x13a2*/ 478,
- /*0x13ae*/ 490,
- -1,
- /*0x2c53*/ 835,
- /*0x1042a*/ 1074,
- /*0x118d1*/ 1180,
- /*0x1ed5*/ 665,
- /*0x1e55*/ 606,
- /*0x04d5*/ 392,
- /*0x0155*/ 96,
- /*0x2cd5*/ 897,
- /*0x13d5*/ 529,
- /*0x1042e*/ 1078,
- /*0x0455*/ 327,
- /*0xa755*/ 1009,
- /*0x2c59*/ 841,
- /*0x10cd5*/ 1133,
- /*0x24d5*/ 779,
- /*0x1ecd*/ 661,
- /*0x1e4d*/ 602,
- /*0xa661*/ 964,
- /*0x014d*/ 92,
- /*0x2ccd*/ 893,
- /*0x13cd*/ 521,
- /*0x024d*/ 197,
- /*0x044d*/ 319,
- /*0xa74d*/ 1005,
- /*0x2c5b*/ 843,
- /*0x10ccd*/ 1125,
- /*0x118d7*/ 1186,
- -1, -1,
- /*0xa651*/ 956,
- /*0x028a*/ 228,
- /*0x1044d*/ 1109,
- -1, -1, -1, -1,
- /*0x2c65*/ 848,
- -1,
- /*0x118d3*/ 1182,
- /*0x1ecb*/ 660,
- /*0x1e4b*/ 601,
- /*0xa663*/ 965,
- /*0x014b*/ 91,
- /*0x2ccb*/ 892,
- /*0x13cb*/ 519,
- /*0x024b*/ 196,
- /*0x044b*/ 317,
- /*0xa74b*/ 1004,
- /*0x2c4f*/ 831,
- /*0x10ccb*/ 1123,
- /*0x118d9*/ 1188,
- -1, -1,
- /*0xa657*/ 959,
- /*0x03e1*/ 278,
- /*0x1044b*/ 1107,
- /*0x1edd*/ 669,
- /*0x1e5d*/ 610,
- /*0x04dd*/ 396,
- /*0x015d*/ 100,
- /*0x2cdd*/ 901,
- /*0x13dd*/ 537,
- /*0x118db*/ 1190,
- /*0x045d*/ 335,
- /*0xa75d*/ 1013,
- /*0xa653*/ 957,
- /*0x10cdd*/ 1141,
- /*0x24dd*/ 787,
- /*0x13de*/ 538,
- -1,
- /*0x045e*/ 336,
- -1,
- /*0x2c55*/ 837,
- /*0x10cde*/ 1142,
- /*0x24de*/ 788,
- /*0x1ec9*/ 659,
- /*0x1e49*/ 600,
- /*0xa659*/ 960,
- /*0x03e3*/ 279,
- /*0x2cc9*/ 891,
- /*0x13c9*/ 517,
- /*0x0249*/ 195,
- /*0x0449*/ 315,
- /*0xa749*/ 1003,
- /*0x2c4d*/ 829,
- /*0x10cc9*/ 1121,
- /*0x118cf*/ 1178,
- /*0x017e*/ 116,
- -1,
- /*0xa65b*/ 961,
- /*0x03d7*/ 273,
- /*0x10449*/ 1105,
- -1, -1, -1,
- /*0x029e*/ 233,
- /*0x13a0*/ 476,
- -1, -1,
- /*0x1ec7*/ 658,
- /*0x1e47*/ 599,
- /*0xa665*/ 966,
- -1,
- /*0x2cc7*/ 890,
- /*0x13c7*/ 515,
- /*0x0247*/ 194,
- /*0x0447*/ 313,
- /*0xa747*/ 1002,
- /*0x2c4b*/ 827,
- /*0x10cc7*/ 1119,
- /*0x118d5*/ 1184,
- /*0x1f14*/ 699,
- -1,
- /*0xa64f*/ 955,
- /*0x03d9*/ 274,
- /*0x10447*/ 1103,
- -1, -1,
- /*0x1f10*/ 695,
- -1, -1, -1,
- /*0x118cd*/ 1176,
- /*0x1ec5*/ 657,
- /*0x1e45*/ 598,
- /*0x2c5d*/ 845,
- /*0x03db*/ 275,
- /*0x2cc5*/ 889,
- /*0x13c5*/ 513,
- /*0x1f61*/ 728,
- /*0x0445*/ 311,
- /*0xa745*/ 1001,
- /*0x2c5e*/ 846,
- /*0x10cc5*/ 1117,
- -1, -1, -1,
- /*0xa655*/ 958,
- /*0x03e5*/ 280,
- /*0x10445*/ 1101,
- -1,
- /*0x1f51*/ 723,
- -1, -1,
- /*0x2c49*/ 825,
- /*0x1f26*/ 707,
- /*0x118cb*/ 1174,
- -1, -1,
- /*0xa64d*/ 954,
- -1,
- /*0x1ec3*/ 656,
- /*0x1e43*/ 597,
- /*0x1f63*/ 730,
- -1,
- /*0x2cc3*/ 888,
- /*0x13c3*/ 511,
- -1,
- /*0x0443*/ 309,
- /*0xa743*/ 1000,
- /*0x1f06*/ 693,
- /*0x10cc3*/ 1115,
- -1,
- /*0x118dd*/ 1192,
- /*0x03ae*/ 242,
- /*0x1f57*/ 726,
- -1,
- /*0x10443*/ 1099,
- /*0x2c47*/ 823,
- /*0x1f24*/ 705,
- /*0x118de*/ 1193,
- /*0x1ec1*/ 655,
- /*0x1e41*/ 596,
- /*0xa64b*/ 953,
- /*0x13ac*/ 488,
- /*0x2cc1*/ 887,
- /*0x13c1*/ 509,
- /*0x1f53*/ 724,
- /*0x0441*/ 307,
- /*0xa741*/ 999,
- -1,
- /*0x10cc1*/ 1113,
- /*0x118c9*/ 1172,
- -1, -1,
- /*0x1042c*/ 1076,
- /*0x03cd*/ 271,
- /*0x10441*/ 1097,
- -1, -1,
- /*0xa65d*/ 962,
- -1,
- /*0x2c45*/ 821,
- -1,
- /*0x0140*/ 86,
- -1,
- /*0x13c0*/ 508,
- /*0x0240*/ 192,
- /*0x0440*/ 306,
- -1, -1,
- /*0x10cc0*/ 1112,
- -1, -1, -1, -1,
- /*0x118c7*/ 1170,
- /*0x10440*/ 1096,
- /*0x1f02*/ 689,
- /*0xa649*/ 952,
- /*0x03cb*/ 269,
- -1, -1,
- /*0x1f65*/ 732,
- /*0x1edf*/ 670,
- /*0x1e5f*/ 611,
- /*0x04df*/ 397,
- /*0x015f*/ 101,
- /*0x2cdf*/ 902,
- /*0x13df*/ 539,
- /*0x2c43*/ 819,
- /*0x045f*/ 337,
- /*0xa75f*/ 1014,
- /*0xff51*/ 1062,
- /*0x10cdf*/ 1143,
- /*0x24df*/ 789,
- /*0x0280*/ 223,
- /*0x03dd*/ 276,
- -1, -1,
- /*0x118c5*/ 1168,
- -1, -1,
- /*0xa647*/ 951,
- /*0x1ee7*/ 674,
- /*0x1e67*/ 615,
- /*0x04e7*/ 401,
- /*0x0167*/ 105,
- /*0x1f22*/ 703,
- /*0x13e7*/ 547,
- /*0x2c41*/ 817,
- /*0x0467*/ 341,
- /*0xa767*/ 1018,
- /*0x0067*/ 6,
- /*0x10ce7*/ 1151,
- /*0x24e7*/ 797,
- /*0x03c9*/ 267,
- /*0xff57*/ 1068,
- /*0x01e1*/ 151,
- /*0x1f55*/ 725,
- /*0x1e91*/ 636,
- /*0x1e11*/ 572,
- /*0x0491*/ 358,
- /*0x0111*/ 64,
- /*0x2c91*/ 863,
- /*0xa79b*/ 1035,
- /*0x0211*/ 173,
- /*0xa645*/ 950,
- /*0x118c3*/ 1166,
- /*0xff53*/ 1064,
- /*0x2c40*/ 816,
- /*0x1eb3*/ 648,
- /*0x1e33*/ 589,
- /*0x04b3*/ 375,
- /*0x0133*/ 80,
- /*0x2cb3*/ 880,
- /*0x13b3*/ 495,
- /*0x0233*/ 189,
- /*0x0433*/ 293,
- /*0xa733*/ 992,
- /*0x03c7*/ 265,
- /*0xff59*/ 1070,
- /*0x01e3*/ 152,
- -1, -1,
- /*0x017c*/ 115,
- /*0x00e1*/ 26,
- /*0x10433*/ 1083,
- /*0x118c1*/ 1164,
- -1,
- /*0xa77c*/ 1024,
- /*0x1ee9*/ 675,
- /*0x1e69*/ 616,
- /*0x04e9*/ 402,
- /*0x0169*/ 106,
- /*0xa643*/ 949,
- /*0x13e9*/ 549,
- /*0x0269*/ 215,
- /*0x0469*/ 342,
- /*0xa769*/ 1019,
- /*0x0069*/ 1195,
- /*0x10ce9*/ 1153,
- /*0x24e9*/ 799,
- -1,
- /*0x03c5*/ 263,
- /*0x051b*/ 427,
- /*0x0586*/ 475,
- /*0x2d14*/ 928,
- /*0x118c0*/ 1163,
- /*0x019a*/ 125,
- /*0x00e3*/ 28,
- /*0x2d1b*/ 935,
- /*0x050b*/ 419,
- /*0x2d16*/ 930,
- /*0x2d10*/ 924,
- /*0xa641*/ 948,
- -1,
- /*0xff4f*/ 1060,
- /*0x2d0b*/ 919,
- /*0x0561*/ 438,
- /*0x1eeb*/ 676,
- /*0x1e6b*/ 617,
- /*0x04eb*/ 403,
- /*0x016b*/ 107,
- -1,
- /*0x13eb*/ 551,
- /*0x026b*/ 216,
- /*0x046b*/ 343,
- /*0xa76b*/ 1020,
- /*0x006b*/ 9,
- /*0x10ceb*/ 1155,
- /*0x118df*/ 1194,
- /*0x03c3*/ 261,
- /*0x1e8f*/ 635,
- /*0x1e0f*/ 571,
- /*0x048f*/ 357,
- /*0x010f*/ 63,
- /*0x2c8f*/ 862,
- /*0xa69b*/ 984,
- /*0x020f*/ 172,
- /*0x2c33*/ 803,
- /*0xff55*/ 1066,
- /*0x01e5*/ 153,
- /*0x0563*/ 440,
- -1,
- /*0xa68b*/ 976,
- /*0x2d18*/ 932,
- /*0x1f20*/ 701,
- /*0x0288*/ 226,
- -1,
- /*0x03ac*/ 240,
- -1,
- /*0x03c1*/ 260,
- /*0xff4d*/ 1058,
- /*0x0582*/ 471,
- /*0x019e*/ 126,
- /*0x2d06*/ 914,
- /*0x2d0a*/ 918,
- /*0xa65f*/ 963,
- /*0x1ef3*/ 680,
- /*0x1e73*/ 621,
- /*0x04f3*/ 407,
- /*0x0173*/ 111,
- /*0x2cf3*/ 907,
- /*0x13f3*/ 559,
- /*0x2d24*/ 944,
- /*0x0473*/ 347,
- /*0x1f00*/ 687,
- /*0x0073*/ 17,
- -1,
- /*0x00e5*/ 30,
- -1,
- /*0x03c0*/ 259,
- -1, -1, -1,
- /*0x2d1a*/ 934,
- /*0xff4b*/ 1056,
- /*0xa667*/ 967,
- /*0x1f45*/ 722,
- /*0x1eef*/ 678,
- /*0x1e6f*/ 619,
- /*0x04ef*/ 405,
- /*0x016f*/ 109,
- -1,
- /*0x13ef*/ 555,
- /*0x026f*/ 218,
- /*0x046f*/ 345,
- /*0xa76f*/ 1022,
- /*0x006f*/ 13,
- /*0x10cef*/ 1159,
- /*0x1eed*/ 677,
- /*0x1e6d*/ 618,
- /*0x04ed*/ 404,
- /*0x016d*/ 108,
- /*0x03df*/ 277,
- /*0x13ed*/ 553,
- -1,
- /*0x046d*/ 344,
- /*0xa76d*/ 1021,
- /*0x006d*/ 11,
- /*0x10ced*/ 1157,
- -1,
- /*0x0565*/ 442,
- /*0x2d02*/ 910,
- -1, -1,
- /*0x1f43*/ 720,
- /*0x1e81*/ 628,
- /*0x1e01*/ 564,
- /*0x0481*/ 354,
- /*0x0101*/ 56,
- /*0x2c81*/ 855,
- /*0xff49*/ 1054,
- /*0x0201*/ 165,
- /*0x03e7*/ 281,
- /*0x1eb7*/ 650,
- /*0x1e37*/ 591,
- /*0x04b7*/ 377,
- /*0x0137*/ 82,
- /*0x2cb7*/ 882,
- /*0x13b7*/ 499,
- /*0x2d1e*/ 938,
- /*0x0437*/ 297,
- /*0xa737*/ 994,
- /*0xa669*/ 968,
- /*0x1fe1*/ 754,
- /*0x1f41*/ 718,
- /*0x2c73*/ 853,
- -1,
- /*0x0292*/ 231,
- /*0x01dd*/ 149,
- /*0x10437*/ 1087,
- -1,
- /*0x2d22*/ 942,
- -1, -1,
- /*0xff47*/ 1052,
- /*0x1fd1*/ 752,
- -1,
- /*0x2d0e*/ 922,
- /*0x04ce*/ 388,
- /*0x03b3*/ 246,
- -1,
- /*0x13ce*/ 522,
- -1,
- /*0x044e*/ 320,
- /*0x1f40*/ 717,
- -1,
- /*0x10cce*/ 1126,
- /*0x01c9*/ 139,
- -1, -1, -1,
- /*0xa66b*/ 969,
- /*0x1044e*/ 1110,
- /*0x013c*/ 84,
- -1,
- /*0x13bc*/ 504,
- /*0x023c*/ 190,
- /*0x043c*/ 302,
- /*0xff45*/ 1050,
- /*0x03e9*/ 282,
- /*0x1eb5*/ 649,
- /*0x1e35*/ 590,
- /*0x04b5*/ 376,
- /*0x0135*/ 81,
- /*0x2cb5*/ 881,
- /*0x13b5*/ 497,
- /*0x1043c*/ 1092,
- /*0x0435*/ 295,
- /*0xa735*/ 993,
- /*0x1ead*/ 645,
- /*0x1e2d*/ 586,
- /*0x04ad*/ 372,
- /*0x012d*/ 78,
- /*0x2cad*/ 877,
- /*0x13ad*/ 489,
- /*0x022d*/ 186,
- /*0x10435*/ 1085,
- /*0xa72d*/ 990,
- -1, -1, -1, -1,
- /*0x2c37*/ 807,
- /*0x0180*/ 117,
- /*0x00fe*/ 54,
- /*0x1042d*/ 1077,
- /*0xff43*/ 1048,
- /*0x1f67*/ 734,
- /*0x03eb*/ 283,
- /*0x1ea5*/ 641,
- /*0x1e25*/ 582,
- /*0x04a5*/ 368,
- /*0x0125*/ 74,
- /*0x2ca5*/ 873,
- /*0x13a5*/ 481,
- /*0x0225*/ 182,
- /*0x04cc*/ 387,
- /*0xa725*/ 986,
- /*0x13a8*/ 484,
- /*0x13cc*/ 520,
- /*0x0580*/ 469,
- /*0x044c*/ 318,
- -1,
- /*0x1f11*/ 696,
- /*0x10ccc*/ 1124,
- /*0x2c4e*/ 830,
- /*0xff41*/ 1046,
- /*0x1fe5*/ 755,
- -1,
- /*0x10428*/ 1072,
- /*0x1044c*/ 1108,
- -1,
- /*0x1e85*/ 630,
- /*0x1e05*/ 566,
- /*0x1f33*/ 712,
- /*0x0105*/ 58,
- /*0x2c85*/ 857,
- /*0x057e*/ 467,
- /*0x0205*/ 167,
- /*0x2c3c*/ 812,
- /*0x1e83*/ 629,
- /*0x1e03*/ 565,
- /*0xa66d*/ 970,
- /*0x0103*/ 57,
- /*0x2c83*/ 856,
- /*0x1f7c*/ 747,
- /*0x0203*/ 166,
- /*0x03f3*/ 287,
- -1,
- /*0x2c35*/ 805,
- /*0x2d20*/ 940,
- /*0x1ea3*/ 640,
- /*0x1e23*/ 581,
- /*0x04a3*/ 367,
- /*0x0123*/ 73,
- /*0x2ca3*/ 872,
- /*0x13a3*/ 479,
- /*0x0223*/ 181,
- -1,
- /*0xa723*/ 985,
- /*0x1eb1*/ 647,
- /*0x1e31*/ 588,
- /*0x04b1*/ 374,
- /*0x118ce*/ 1177,
- /*0x2cb1*/ 879,
- /*0x13b1*/ 493,
- /*0x0231*/ 188,
- /*0x0431*/ 291,
- /*0x03ef*/ 285,
- -1,
- /*0x2d00*/ 908,
- /*0x1e95*/ 638,
- /*0x1e15*/ 574,
- /*0x0495*/ 360,
- /*0x0115*/ 66,
- /*0x2c95*/ 865,
- /*0x10431*/ 1081,
- /*0x0215*/ 175,
- /*0x1f12*/ 697,
- /*0x03ed*/ 284,
- /*0x1ebf*/ 654,
- /*0x1e3f*/ 595,
- /*0x04bf*/ 381,
- /*0x2c4c*/ 828,
- /*0x2cbf*/ 886,
- /*0x13bf*/ 507,
- /*0x023f*/ 191,
- /*0x043f*/ 305,
- /*0xa73f*/ 998,
- /*0x1ea7*/ 642,
- /*0x1e27*/ 583,
- /*0x04a7*/ 369,
- /*0x0127*/ 75,
- /*0x2ca7*/ 874,
- /*0x13a7*/ 483,
- /*0x0227*/ 183,
- /*0x1043f*/ 1095,
- /*0xa727*/ 987,
- -1,
- /*0x1e93*/ 637,
- /*0x1e13*/ 573,
- /*0x0493*/ 359,
- /*0x0113*/ 65,
- /*0x2c93*/ 864,
- /*0x03b7*/ 250,
- /*0x0213*/ 174,
- /*0x01df*/ 150,
- /*0x1ef1*/ 679,
- /*0x1e71*/ 620,
- /*0x04f1*/ 406,
- /*0x0171*/ 110,
- -1,
- /*0x13f1*/ 557,
- /*0x0271*/ 219,
- /*0x0471*/ 346,
- /*0x0188*/ 120,
- /*0x0071*/ 15,
- /*0x10cf1*/ 1161,
- -1, -1, -1,
- /*0x118cc*/ 1175,
- /*0x1f73*/ 738,
- -1, -1,
- /*0x217e*/ 771,
- /*0x01e7*/ 154,
- /*0x03ce*/ 272,
- -1,
- /*0x2c31*/ 801,
- /*0x1ef5*/ 681,
- /*0x1e75*/ 622,
- /*0x04f5*/ 408,
- /*0x0175*/ 112,
- -1,
- /*0x13f5*/ 561,
- /*0x0275*/ 221,
- /*0x0475*/ 348,
- -1,
- /*0x0075*/ 19,
- -1,
- /*0x03bc*/ 255,
- /*0x028c*/ 230,
- -1, -1,
- /*0x04c6*/ 384,
- /*0x0146*/ 89,
- -1,
- /*0x13c6*/ 514,
- /*0x2c3f*/ 815,
- /*0x0446*/ 312,
- /*0x03b5*/ 248,
- /*0x1f04*/ 691,
- /*0x10cc6*/ 1118,
- /*0x00e7*/ 32,
- /*0x0283*/ 224,
- -1, -1, -1,
- /*0x10446*/ 1102,
- /*0x03ad*/ 241,
- -1, -1,
- /*0xa791*/ 1031,
- /*0x1ea1*/ 639,
- /*0x1e21*/ 580,
- /*0x04a1*/ 366,
- /*0x0121*/ 72,
- /*0x2ca1*/ 871,
- /*0x13a1*/ 477,
- -1,
- /*0x1f01*/ 688,
- -1,
- /*0x01e9*/ 155,
- -1,
- /*0x04c4*/ 383,
- /*0x0144*/ 88,
- -1,
- /*0x13c4*/ 512,
- /*0x1f37*/ 716,
- /*0x0444*/ 310,
- -1,
- /*0x2d08*/ 916,
- /*0x10cc4*/ 1116,
- -1,
- /*0x03cc*/ 270,
- -1,
- /*0x0567*/ 444,
- -1,
- /*0x10444*/ 1100,
- /*0x04c2*/ 382,
- /*0x0142*/ 87,
- /*0x00fc*/ 52,
- /*0x13c2*/ 510,
- /*0x0242*/ 193,
- /*0x0442*/ 308,
- -1,
- /*0x0192*/ 122,
- /*0x10cc2*/ 1114,
- -1, -1,
- /*0x00e9*/ 34,
- /*0x01eb*/ 156,
- /*0x0511*/ 422,
- /*0x10442*/ 1098,
- -1,
- /*0x1ebd*/ 653,
- /*0x1e3d*/ 594,
- /*0x04bd*/ 380,
- /*0x2d11*/ 925,
- /*0x2cbd*/ 885,
- /*0x13bd*/ 505,
- /*0x2c46*/ 822,
- /*0x043d*/ 303,
- /*0xa73d*/ 997,
- -1,
- /*0x1eb9*/ 651,
- /*0x1e39*/ 592,
- /*0x04b9*/ 378,
- -1,
- /*0x2cb9*/ 883,
- /*0x13b9*/ 501,
- /*0x1043d*/ 1093,
- /*0x0439*/ 299,
- /*0xa739*/ 995,
- /*0x057c*/ 465,
- /*0x1f35*/ 714,
- -1, -1, -1,
- /*0x00eb*/ 36,
- /*0x03b1*/ 244,
- /*0x10439*/ 1089,
- -1,
- /*0x0569*/ 446,
- -1,
- /*0xa691*/ 979,
- -1,
- /*0x1efb*/ 684,
- /*0x1e7b*/ 625,
- /*0x04fb*/ 411,
- /*0x01f3*/ 159,
- /*0x2c44*/ 820,
- /*0x1e87*/ 631,
- /*0x1e07*/ 567,
- /*0x047b*/ 351,
- /*0x0107*/ 59,
- /*0x2c87*/ 858,
- -1,
- /*0x0207*/ 168,
- /*0x118c6*/ 1169,
- /*0x03bf*/ 258,
- /*0x1efd*/ 685,
- /*0x1e7d*/ 626,
- /*0x04fd*/ 412,
- /*0x1f25*/ 706,
- /*0x2d1c*/ 936,
- /*0x2c42*/ 818,
- /*0x027d*/ 222,
- /*0x047d*/ 352,
- -1, -1,
- /*0x01ef*/ 158,
- /*0x056b*/ 448,
- /*0x2d12*/ 926,
- /*0x1ef9*/ 683,
- /*0x1e79*/ 624,
- /*0x04f9*/ 410,
- /*0x1d7d*/ 563,
- /*0x00f3*/ 44,
- -1, -1,
- /*0x0479*/ 350,
- /*0x01ed*/ 157,
- /*0x0079*/ 23,
- /*0x2c3d*/ 813,
- /*0x050f*/ 421,
- -1,
- /*0x1f05*/ 692,
- -1,
- /*0x118c4*/ 1167,
- /*0x1d79*/ 562,
- /*0x2d0f*/ 923,
- -1,
- /*0xff4e*/ 1059,
- /*0x2c39*/ 809,
- /*0x1f03*/ 690,
- -1,
- /*0x0584*/ 473,
- -1,
- /*0x00ef*/ 40,
- /*0x1e19*/ 576,
- /*0x0499*/ 362,
- /*0x0119*/ 68,
- /*0x2c99*/ 867,
- /*0x118c2*/ 1165,
- /*0x0219*/ 177,
- /*0x1f23*/ 704,
- -1,
- /*0x13f2*/ 558,
- /*0x0272*/ 220,
- /*0x00ed*/ 38,
- /*0x0573*/ 456,
- /*0x0072*/ 16,
- /*0x10cf2*/ 1162,
- -1,
- /*0x1f31*/ 710,
- /*0x0581*/ 470,
- -1,
- /*0xa68f*/ 978,
- -1,
- /*0xa781*/ 1026,
- -1,
- /*0x217c*/ 769,
- /*0x03c6*/ 264,
- -1, -1,
- /*0x1f15*/ 700,
- -1,
- /*0xa7b7*/ 1044,
- -1,
- /*0x01ce*/ 141,
- -1,
- /*0x056f*/ 452,
- -1,
- /*0x1eaf*/ 646,
- /*0x1e2f*/ 587,
- /*0x04af*/ 373,
- /*0x012f*/ 79,
- /*0x2caf*/ 878,
- /*0x13af*/ 491,
- /*0x022f*/ 187,
- -1,
- /*0xa72f*/ 991,
- /*0x056d*/ 450,
- /*0x1f27*/ 708,
- -1, -1,
- /*0x2d04*/ 912,
- -1, -1,
- /*0x1042f*/ 1079,
- /*0xff4c*/ 1057,
- /*0x13f4*/ 560,
- /*0x03c4*/ 262,
- /*0x1f13*/ 698,
- -1,
- /*0x0074*/ 18,
- /*0x1eff*/ 686,
- /*0x1e7f*/ 627,
- /*0x04ff*/ 413,
- /*0x0501*/ 414,
- -1,
- /*0x1f71*/ 736,
- /*0x01ad*/ 131,
- /*0x047f*/ 353,
- /*0xa77f*/ 1025,
- /*0x2d01*/ 909,
- /*0x0287*/ 225,
- /*0x1ea9*/ 643,
- /*0x1e29*/ 584,
- /*0x04a9*/ 370,
- /*0x0129*/ 76,
- /*0x2ca9*/ 875,
- /*0x13a9*/ 485,
- /*0x0229*/ 184,
- /*0xa7b5*/ 1043,
- /*0xa729*/ 988,
- /*0x1e17*/ 575,
- /*0x0497*/ 361,
- /*0x0117*/ 67,
- /*0x2c97*/ 866,
- -1,
- /*0x0217*/ 176,
- /*0x01a5*/ 129,
- /*0x10429*/ 1073,
- /*0x1f75*/ 740,
- /*0x03bd*/ 256,
- /*0x01a8*/ 130,
- /*0x01cc*/ 140,
- /*0x13d0*/ 524,
- /*0x0250*/ 199,
- /*0x0450*/ 322,
- /*0x0076*/ 20,
- /*0xa681*/ 971,
- /*0x10cd0*/ 1128,
- /*0x24d0*/ 774,
- /*0x03b9*/ 252,
- /*0x04c8*/ 385,
- /*0x0148*/ 90,
- /*0x2173*/ 760,
- /*0x13c8*/ 516,
- /*0x018c*/ 121,
- /*0x0448*/ 314,
- -1,
- /*0xa7a5*/ 1040,
- /*0x10cc8*/ 1120,
- /*0x0185*/ 119,
- /*0x1e1d*/ 578,
- /*0x049d*/ 364,
- /*0x011d*/ 70,
- /*0x2c9d*/ 869,
- /*0x10448*/ 1104,
- /*0x021d*/ 179,
- /*0x037c*/ 238,
- /*0x0183*/ 118,
- -1,
- /*0x13f0*/ 556,
- -1,
- /*0x03fb*/ 289,
- /*0x1f21*/ 702,
- /*0x0070*/ 14,
- /*0x10cf0*/ 1160,
- /*0xa78c*/ 1030,
- /*0x0585*/ 474,
- /*0x052d*/ 436,
- /*0x01a3*/ 128,
- -1,
- /*0xa785*/ 1028,
- /*0x1f44*/ 721,
- -1,
- /*0x2d2d*/ 947,
- /*0x0583*/ 472,
- /*0x1ebb*/ 652,
- /*0x1e3b*/ 593,
- /*0x04bb*/ 379,
- /*0xa783*/ 1027,
- /*0x2cbb*/ 884,
- /*0x13bb*/ 503,
- -1,
- /*0x043b*/ 301,
- /*0xa73b*/ 996,
- -1, -1,
- /*0x1f42*/ 719,
- /*0x0525*/ 432,
- /*0x0195*/ 123,
- /*0xa7a3*/ 1039,
- -1,
- /*0x1043b*/ 1091,
- -1,
- /*0x2d25*/ 945,
- -1,
- /*0x2c76*/ 854,
- /*0x2c50*/ 832,
- /*0x01bf*/ 137,
- /*0x1eab*/ 644,
- /*0x1e2b*/ 585,
- /*0x04ab*/ 371,
- /*0x012b*/ 77,
- /*0x2cab*/ 876,
- /*0x13ab*/ 487,
- /*0x022b*/ 185,
- -1,
- /*0xa72b*/ 989,
- /*0x2c48*/ 824,
- -1, -1,
- /*0x0505*/ 416,
- /*0x2d0c*/ 920,
- -1, -1,
- /*0x1042b*/ 1075,
- /*0x017a*/ 114,
- /*0x2d05*/ 913,
- /*0x03f2*/ 286,
- /*0x0503*/ 415,
- -1,
- /*0xa77a*/ 1023,
- /*0x007a*/ 24,
- /*0x214e*/ 756,
- /*0xff46*/ 1051,
- /*0x2d03*/ 911,
- -1, -1,
- /*0xa7a7*/ 1041,
- -1,
- /*0x0523*/ 431,
- -1, -1, -1,
- /*0x0373*/ 235,
- /*0x118d0*/ 1179,
- /*0x2d23*/ 943,
- /*0x1f7b*/ 746,
- /*0xa793*/ 1032,
- -1, -1, -1,
- /*0x1f07*/ 694,
- -1,
- /*0xa685*/ 973,
- /*0x2c3b*/ 811,
- /*0x118c8*/ 1171,
- -1,
- /*0x01f5*/ 160,
- /*0x03af*/ 243,
- /*0x0515*/ 424,
- /*0x1f7d*/ 748,
- /*0xa683*/ 972,
- /*0x00f1*/ 42,
- /*0xff44*/ 1049,
- -1,
- /*0x2d15*/ 929,
- /*0x13d6*/ 530,
- /*0x0256*/ 204,
- /*0x0456*/ 328,
- -1,
- /*0x01c6*/ 138,
- /*0x10cd6*/ 1134,
- /*0x24d6*/ 780,
- /*0x1f79*/ 744,
- /*0x029d*/ 232,
- -1, -1,
- /*0x0527*/ 433,
- /*0xff42*/ 1047,
- /*0x1ef7*/ 682,
- /*0x1e77*/ 623,
- /*0x04f7*/ 409,
- /*0x0177*/ 113,
- /*0x2d27*/ 946,
- /*0x0078*/ 22,
- /*0x00f5*/ 46,
- /*0x0477*/ 349,
- /*0x0513*/ 423,
- /*0x0077*/ 21,
- -1, -1,
- /*0x01a1*/ 127,
- /*0xa695*/ 981,
- /*0x2d13*/ 927,
- -1,
- /*0x0571*/ 454,
- /*0x13b0*/ 492,
- -1,
- /*0x0430*/ 290,
- /*0x13e6*/ 546,
- /*0x0266*/ 213,
- -1,
- /*0x1f72*/ 737,
- /*0x0066*/ 5,
- /*0x10ce6*/ 1150,
- /*0x24e6*/ 796,
- -1,
- /*0x10430*/ 1080,
- /*0x2184*/ 773,
- /*0x13d4*/ 528,
- /*0x0254*/ 203,
- /*0x0454*/ 326,
- /*0xa7a1*/ 1038,
- -1,
- /*0x10cd4*/ 1132,
- /*0x24d4*/ 778,
- -1, -1,
- /*0x0575*/ 458,
- /*0x03c8*/ 266,
- /*0xa693*/ 980,
- /*0x13d2*/ 526,
- /*0x0252*/ 201,
- /*0x0452*/ 324,
- /*0x13ea*/ 550,
- -1,
- /*0x10cd2*/ 1130,
- /*0x24d2*/ 776,
- /*0x006a*/ 8,
- /*0x10cea*/ 1154,
- /*0x2c56*/ 838,
- /*0x04ca*/ 386,
- -1,
- /*0x01bd*/ 136,
- /*0x13ca*/ 518,
- -1,
- /*0x044a*/ 316,
- -1, -1,
- /*0x10cca*/ 1122,
- -1, -1, -1,
- /*0x01b9*/ 135,
- -1,
- /*0x1044a*/ 1106,
- /*0x1f74*/ 739,
- /*0x1e8d*/ 634,
- /*0x1e0d*/ 570,
- /*0x048d*/ 356,
- /*0x010d*/ 62,
- /*0x2c8d*/ 861,
- /*0x0521*/ 430,
- /*0x020d*/ 171,
- -1,
- /*0x1fb1*/ 750,
- /*0x03bb*/ 254,
- -1,
- /*0x2d21*/ 941,
- -1,
- /*0x2c30*/ 800,
- -1, -1,
- /*0x2c66*/ 849,
- -1,
- /*0x01fb*/ 162,
- /*0x1e89*/ 632,
- /*0x1e09*/ 568,
- /*0x118d6*/ 1185,
- /*0x0109*/ 60,
- /*0x2c89*/ 859,
- -1,
- /*0x0209*/ 169,
- /*0x2c54*/ 836,
- -1,
- /*0x13dc*/ 536,
- /*0x025c*/ 208,
- /*0x045c*/ 334,
- -1,
- /*0x01fd*/ 163,
- /*0x10cdc*/ 1140,
- /*0x24dc*/ 786,
- /*0x1f76*/ 741,
- /*0x2171*/ 758,
- /*0x13da*/ 534,
- /*0x2c52*/ 834,
- /*0x045a*/ 332,
- -1,
- /*0x2c6a*/ 851,
- /*0x10cda*/ 1138,
- /*0x24da*/ 784,
- /*0xa787*/ 1029,
- /*0x01f9*/ 161,
- /*0x00fb*/ 51,
- /*0x2cec*/ 905,
- /*0x13ec*/ 552,
- /*0x026c*/ 217,
- /*0x13e4*/ 544,
- /*0x2c4a*/ 826,
- /*0x006c*/ 10,
- /*0x10cec*/ 1156,
- /*0x0064*/ 3,
- /*0x10ce4*/ 1148,
- /*0x24e4*/ 794,
- -1, -1,
- /*0x2175*/ 762,
- /*0x00fd*/ 53,
- /*0x13e8*/ 548,
- /*0x0268*/ 214,
- /*0x1f70*/ 735,
- /*0x118d4*/ 1183,
- /*0x0068*/ 7,
- /*0x10ce8*/ 1152,
- /*0x24e8*/ 798,
- -1,
- /*0x13d8*/ 532,
- /*0x0199*/ 124,
- /*0x0458*/ 330,
- -1,
- /*0x00f9*/ 49,
- /*0x10cd8*/ 1136,
- /*0x24d8*/ 782,
- /*0x118d2*/ 1181,
- -1, -1,
- /*0x057b*/ 464,
- /*0x1e1f*/ 579,
- /*0x049f*/ 365,
- /*0x011f*/ 71,
- /*0x2c9f*/ 870,
- /*0x0507*/ 417,
- /*0x021f*/ 180,
- -1, -1, -1,
- /*0x118ca*/ 1173,
- /*0x2d07*/ 915,
- /*0xa799*/ 1034,
- /*0x2c5c*/ 844,
- /*0x057d*/ 466,
- /*0x13b6*/ 498,
- -1,
- /*0x0436*/ 296,
- -1, -1,
- /*0x03f8*/ 288,
- -1,
- /*0x2c5a*/ 842,
- /*0x00f2*/ 43,
- /*0x13e2*/ 542,
- -1,
- /*0x10436*/ 1086,
- /*0x0579*/ 462,
- /*0x0062*/ 1,
- /*0x10ce2*/ 1146,
- /*0x24e2*/ 792,
- /*0x13e0*/ 540,
- /*0x0260*/ 209,
- /*0x2c6c*/ 852,
- -1, -1,
- /*0x10ce0*/ 1144,
- /*0x24e0*/ 790,
- /*0xa687*/ 974,
- /*0xff50*/ 1061,
- -1, -1,
- /*0x1f7a*/ 745,
- -1, -1, -1,
- /*0x2c68*/ 850,
- -1,
- /*0x0371*/ 234,
- /*0x01ff*/ 164,
- /*0xff48*/ 1053,
- /*0x118dc*/ 1191,
- /*0x0519*/ 426,
- -1,
- /*0x2c58*/ 840,
- /*0x0289*/ 227,
- /*0x0572*/ 455,
- -1,
- /*0x2d19*/ 933,
- -1,
- /*0x118da*/ 1189,
- /*0x13b4*/ 496,
- -1,
- /*0x0434*/ 294,
- /*0x2cee*/ 906,
- /*0x13ee*/ 554,
- -1,
- /*0x00f4*/ 45,
- -1,
- /*0x006e*/ 12,
- /*0x10cee*/ 1158,
- /*0x013e*/ 85,
- /*0x10434*/ 1084,
- /*0x13be*/ 506,
- /*0x03ca*/ 268,
- /*0x043e*/ 304,
- /*0x01d0*/ 142,
- /*0x00ff*/ 55,
- -1,
- /*0x2c36*/ 806,
- -1,
- /*0xa7a9*/ 1042,
- -1, -1,
- /*0x1043e*/ 1094,
- /*0xa699*/ 983,
- -1,
- /*0x052f*/ 437,
- /*0x217b*/ 768,
- /*0xa797*/ 1033,
- -1, -1,
- /*0x118d8*/ 1187,
- -1,
- /*0x013a*/ 83,
- /*0x1f78*/ 743,
- /*0x13ba*/ 502,
- -1,
- /*0x043a*/ 300,
- /*0x1f77*/ 742,
- /*0x0574*/ 457,
- -1,
- /*0x217d*/ 770,
- /*0x00f6*/ 47,
- -1, -1, -1,
- /*0x1043a*/ 1090,
- -1, -1,
- /*0x057f*/ 468,
- /*0x1f30*/ 709,
- -1, -1,
- /*0x1f66*/ 733,
- /*0x2179*/ 766,
- /*0x13b8*/ 500,
- -1,
- /*0x0438*/ 298,
- /*0xa79d*/ 1036,
- -1,
- /*0x0529*/ 434,
- -1, -1, -1,
- /*0x2c34*/ 804,
- -1,
- /*0x10438*/ 1088,
- -1,
- /*0x0517*/ 425,
- /*0x13b2*/ 494,
- /*0x00f0*/ 41,
- /*0x0432*/ 292,
- -1, -1,
- /*0x2d17*/ 931,
- /*0x0576*/ 459,
- /*0x2c3e*/ 814,
- -1, -1, -1,
- /*0x10432*/ 1082,
- -1, -1,
- /*0x2172*/ 759,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1,
- /*0x051d*/ 428,
- /*0x2c3a*/ 810,
- -1,
- /*0xa697*/ 982,
- /*0xff56*/ 1067,
- /*0x0570*/ 453,
- /*0x2d1d*/ 937,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x037b*/ 237,
- /*0x2c38*/ 808,
- /*0x03b6*/ 249,
- -1, -1, -1, -1, -1, -1,
- /*0x2174*/ 761,
- /*0x00fa*/ 50,
- -1, -1, -1,
- /*0x037d*/ 239,
- /*0x2c32*/ 802,
- -1, -1, -1,
- /*0x217f*/ 772,
- -1,
- /*0x01d6*/ 145,
- -1, -1, -1, -1, -1,
- /*0xff54*/ 1065,
- -1,
- /*0x052b*/ 435,
- -1, -1, -1,
- /*0x1f64*/ 731,
- -1, -1, -1, -1, -1,
- /*0xff52*/ 1063,
- -1, -1, -1,
- /*0x057a*/ 463,
- -1,
- /*0x2176*/ 763,
- -1, -1,
- /*0x03b4*/ 247,
- -1, -1,
- /*0x01b0*/ 132,
- /*0xff4a*/ 1055,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x03be*/ 257,
- -1, -1,
- /*0x00f8*/ 48,
- /*0x01d4*/ 144,
- /*0x1fd0*/ 751,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x2170*/ 757,
- -1, -1,
- /*0x01d2*/ 143,
- /*0x1f36*/ 715,
- -1, -1, -1, -1,
- /*0x00e6*/ 31,
- /*0x03ba*/ 253,
- -1, -1,
- /*0x1f62*/ 729,
- -1, -1, -1, -1, -1, -1,
- /*0x1f60*/ 727,
- -1, -1,
- /*0x0578*/ 461,
- -1, -1, -1,
- /*0x0577*/ 460,
- -1,
- /*0xff5a*/ 1071,
- /*0x03b8*/ 251,
- -1, -1, -1,
- /*0x00ea*/ 35,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x0566*/ 443,
- -1,
- /*0x03b2*/ 245,
- -1, -1, -1, -1, -1,
- /*0x1f34*/ 713,
- -1, -1, -1, -1, -1, -1,
- /*0x01dc*/ 148,
- /*0x217a*/ 767,
- -1, -1,
- /*0xff58*/ 1069,
- -1, -1, -1, -1,
- /*0x01da*/ 147,
- /*0x056a*/ 447,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- /*0x050d*/ 420,
- -1, -1,
- /*0x01d8*/ 146,
- -1, -1,
- /*0x2d0d*/ 921,
- -1, -1, -1,
- /*0x00ec*/ 37,
- -1,
- /*0x00e4*/ 29,
- -1, -1, -1,
- /*0x2178*/ 765,
- -1, -1,
- /*0x0509*/ 418,
- /*0x2177*/ 764,
- -1, -1,
- /*0x00e8*/ 33,
- /*0x1f32*/ 711,
- /*0x2d09*/ 917,
- -1, -1,
- /*0x01b6*/ 134,
- -1, -1, -1, -1,
- /*0xa68d*/ 977,
- -1, -1, -1, -1, -1,
- /*0xa79f*/ 1037,
- -1, -1, -1,
- /*0x056c*/ 449,
- -1,
- /*0x0564*/ 441,
- -1, -1, -1, -1, -1,
- /*0x1fb0*/ 749,
- /*0xa689*/ 975,
- -1, -1, -1,
- /*0x0568*/ 445,
- -1, -1, -1, -1, -1, -1,
- -1, -1,
- /*0x00e2*/ 27,
- -1, -1, -1, -1, -1, -1,
- /*0x00e0*/ 25,
- -1,
- /*0x01b4*/ 133,
- -1, -1, -1, -1,
- /*0x051f*/ 429,
- -1, -1, -1, -1, -1,
- /*0x2d1f*/ 939,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- /*0x0562*/ 439,
- -1, -1, -1, -1, -1, -1,
- -1,
- /*0x00ee*/ 39,
- -1, -1, -1, -1,
- /*0x0377*/ 236,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- /*0x056e*/ 451,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- /*0x1fe0*/ 753
- };
-
- if (code <= MAX_CODE_VALUE && code >= MIN_CODE_VALUE)
- {
- register int key = onigenc_unicode_CaseUnfold_11_hash(code);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register short s = wordlist[key];
-
- if (s >= 0 && code1_equal(code, CaseUnfold_11_Table[s].from))
- return &CaseUnfold_11_Table[s].to;
- }
- }
- return 0;
-}
-
-static const CaseUnfold_12_Type CaseUnfold_12_Table[] = {
-#define CaseUnfold_12 (*(CaseUnfold_12_Type (*)[58])(CaseUnfold_12_Table+0))
- {{0x0061, 0x02be}, {1, {0x1e9a}}},
- {{0x0066, 0x0066}, {1, {0xfb00}}},
- {{0x0066, 0x0069}, {1, {0xfb01}}},
- {{0x0066, 0x006c}, {1, {0xfb02}}},
- {{0x0068, 0x0331}, {1, {0x1e96}}},
- {{0x006a, 0x030c}, {1, {0x01f0}}},
- {{0x0073, 0x0073}, {2, {0x00df, 0x1e9e}}},
- {{0x0073, 0x0074}, {2, {0xfb05, 0xfb06}}},
- {{0x0074, 0x0308}, {1, {0x1e97}}},
- {{0x0077, 0x030a}, {1, {0x1e98}}},
- {{0x0079, 0x030a}, {1, {0x1e99}}},
- {{0x02bc, 0x006e}, {1, {0x0149}}},
- {{0x03ac, 0x03b9}, {1, {0x1fb4}}},
- {{0x03ae, 0x03b9}, {1, {0x1fc4}}},
- {{0x03b1, 0x0342}, {1, {0x1fb6}}},
- {{0x03b1, 0x03b9}, {2, {0x1fb3, 0x1fbc}}},
- {{0x03b7, 0x0342}, {1, {0x1fc6}}},
- {{0x03b7, 0x03b9}, {2, {0x1fc3, 0x1fcc}}},
- {{0x03b9, 0x0342}, {1, {0x1fd6}}},
- {{0x03c1, 0x0313}, {1, {0x1fe4}}},
- {{0x03c5, 0x0313}, {1, {0x1f50}}},
- {{0x03c5, 0x0342}, {1, {0x1fe6}}},
- {{0x03c9, 0x0342}, {1, {0x1ff6}}},
- {{0x03c9, 0x03b9}, {2, {0x1ff3, 0x1ffc}}},
- {{0x03ce, 0x03b9}, {1, {0x1ff4}}},
- {{0x0565, 0x0582}, {1, {0x0587}}},
- {{0x0574, 0x0565}, {1, {0xfb14}}},
- {{0x0574, 0x056b}, {1, {0xfb15}}},
- {{0x0574, 0x056d}, {1, {0xfb17}}},
- {{0x0574, 0x0576}, {1, {0xfb13}}},
- {{0x057e, 0x0576}, {1, {0xfb16}}},
- {{0x1f00, 0x03b9}, {2, {0x1f80, 0x1f88}}},
- {{0x1f01, 0x03b9}, {2, {0x1f81, 0x1f89}}},
- {{0x1f02, 0x03b9}, {2, {0x1f82, 0x1f8a}}},
- {{0x1f03, 0x03b9}, {2, {0x1f83, 0x1f8b}}},
- {{0x1f04, 0x03b9}, {2, {0x1f84, 0x1f8c}}},
- {{0x1f05, 0x03b9}, {2, {0x1f85, 0x1f8d}}},
- {{0x1f06, 0x03b9}, {2, {0x1f86, 0x1f8e}}},
- {{0x1f07, 0x03b9}, {2, {0x1f87, 0x1f8f}}},
- {{0x1f20, 0x03b9}, {2, {0x1f90, 0x1f98}}},
- {{0x1f21, 0x03b9}, {2, {0x1f91, 0x1f99}}},
- {{0x1f22, 0x03b9}, {2, {0x1f92, 0x1f9a}}},
- {{0x1f23, 0x03b9}, {2, {0x1f93, 0x1f9b}}},
- {{0x1f24, 0x03b9}, {2, {0x1f94, 0x1f9c}}},
- {{0x1f25, 0x03b9}, {2, {0x1f95, 0x1f9d}}},
- {{0x1f26, 0x03b9}, {2, {0x1f96, 0x1f9e}}},
- {{0x1f27, 0x03b9}, {2, {0x1f97, 0x1f9f}}},
- {{0x1f60, 0x03b9}, {2, {0x1fa0, 0x1fa8}}},
- {{0x1f61, 0x03b9}, {2, {0x1fa1, 0x1fa9}}},
- {{0x1f62, 0x03b9}, {2, {0x1fa2, 0x1faa}}},
- {{0x1f63, 0x03b9}, {2, {0x1fa3, 0x1fab}}},
- {{0x1f64, 0x03b9}, {2, {0x1fa4, 0x1fac}}},
- {{0x1f65, 0x03b9}, {2, {0x1fa5, 0x1fad}}},
- {{0x1f66, 0x03b9}, {2, {0x1fa6, 0x1fae}}},
- {{0x1f67, 0x03b9}, {2, {0x1fa7, 0x1faf}}},
- {{0x1f70, 0x03b9}, {1, {0x1fb2}}},
- {{0x1f74, 0x03b9}, {1, {0x1fc2}}},
- {{0x1f7c, 0x03b9}, {1, {0x1ff2}}},
-#define CaseUnfold_12_Locale (*(CaseUnfold_12_Type (*)[1])(CaseUnfold_12_Table+58))
- {{0x0069, 0x0307}, {1, {0x0130}}},
+static const CaseUnfold_11_Type CaseUnfold_11[] = {
+ { 0x0061, {1, {0x0041 }}},
+ { 0x0062, {1, {0x0042 }}},
+ { 0x0063, {1, {0x0043 }}},
+ { 0x0064, {1, {0x0044 }}},
+ { 0x0065, {1, {0x0045 }}},
+ { 0x0066, {1, {0x0046 }}},
+ { 0x0067, {1, {0x0047 }}},
+ { 0x0068, {1, {0x0048 }}},
+ { 0x006a, {1, {0x004a }}},
+ { 0x006b, {2, {0x004b, 0x212a }}},
+ { 0x006c, {1, {0x004c }}},
+ { 0x006d, {1, {0x004d }}},
+ { 0x006e, {1, {0x004e }}},
+ { 0x006f, {1, {0x004f }}},
+ { 0x0070, {1, {0x0050 }}},
+ { 0x0071, {1, {0x0051 }}},
+ { 0x0072, {1, {0x0052 }}},
+ { 0x0073, {2, {0x0053, 0x017f }}},
+ { 0x0074, {1, {0x0054 }}},
+ { 0x0075, {1, {0x0055 }}},
+ { 0x0076, {1, {0x0056 }}},
+ { 0x0077, {1, {0x0057 }}},
+ { 0x0078, {1, {0x0058 }}},
+ { 0x0079, {1, {0x0059 }}},
+ { 0x007a, {1, {0x005a }}},
+ { 0x00e0, {1, {0x00c0 }}},
+ { 0x00e1, {1, {0x00c1 }}},
+ { 0x00e2, {1, {0x00c2 }}},
+ { 0x00e3, {1, {0x00c3 }}},
+ { 0x00e4, {1, {0x00c4 }}},
+ { 0x00e5, {2, {0x00c5, 0x212b }}},
+ { 0x00e6, {1, {0x00c6 }}},
+ { 0x00e7, {1, {0x00c7 }}},
+ { 0x00e8, {1, {0x00c8 }}},
+ { 0x00e9, {1, {0x00c9 }}},
+ { 0x00ea, {1, {0x00ca }}},
+ { 0x00eb, {1, {0x00cb }}},
+ { 0x00ec, {1, {0x00cc }}},
+ { 0x00ed, {1, {0x00cd }}},
+ { 0x00ee, {1, {0x00ce }}},
+ { 0x00ef, {1, {0x00cf }}},
+ { 0x00f0, {1, {0x00d0 }}},
+ { 0x00f1, {1, {0x00d1 }}},
+ { 0x00f2, {1, {0x00d2 }}},
+ { 0x00f3, {1, {0x00d3 }}},
+ { 0x00f4, {1, {0x00d4 }}},
+ { 0x00f5, {1, {0x00d5 }}},
+ { 0x00f6, {1, {0x00d6 }}},
+ { 0x00f8, {1, {0x00d8 }}},
+ { 0x00f9, {1, {0x00d9 }}},
+ { 0x00fa, {1, {0x00da }}},
+ { 0x00fb, {1, {0x00db }}},
+ { 0x00fc, {1, {0x00dc }}},
+ { 0x00fd, {1, {0x00dd }}},
+ { 0x00fe, {1, {0x00de }}},
+ { 0x00ff, {1, {0x0178 }}},
+ { 0x0101, {1, {0x0100 }}},
+ { 0x0103, {1, {0x0102 }}},
+ { 0x0105, {1, {0x0104 }}},
+ { 0x0107, {1, {0x0106 }}},
+ { 0x0109, {1, {0x0108 }}},
+ { 0x010b, {1, {0x010a }}},
+ { 0x010d, {1, {0x010c }}},
+ { 0x010f, {1, {0x010e }}},
+ { 0x0111, {1, {0x0110 }}},
+ { 0x0113, {1, {0x0112 }}},
+ { 0x0115, {1, {0x0114 }}},
+ { 0x0117, {1, {0x0116 }}},
+ { 0x0119, {1, {0x0118 }}},
+ { 0x011b, {1, {0x011a }}},
+ { 0x011d, {1, {0x011c }}},
+ { 0x011f, {1, {0x011e }}},
+ { 0x0121, {1, {0x0120 }}},
+ { 0x0123, {1, {0x0122 }}},
+ { 0x0125, {1, {0x0124 }}},
+ { 0x0127, {1, {0x0126 }}},
+ { 0x0129, {1, {0x0128 }}},
+ { 0x012b, {1, {0x012a }}},
+ { 0x012d, {1, {0x012c }}},
+ { 0x012f, {1, {0x012e }}},
+ { 0x0133, {1, {0x0132 }}},
+ { 0x0135, {1, {0x0134 }}},
+ { 0x0137, {1, {0x0136 }}},
+ { 0x013a, {1, {0x0139 }}},
+ { 0x013c, {1, {0x013b }}},
+ { 0x013e, {1, {0x013d }}},
+ { 0x0140, {1, {0x013f }}},
+ { 0x0142, {1, {0x0141 }}},
+ { 0x0144, {1, {0x0143 }}},
+ { 0x0146, {1, {0x0145 }}},
+ { 0x0148, {1, {0x0147 }}},
+ { 0x014b, {1, {0x014a }}},
+ { 0x014d, {1, {0x014c }}},
+ { 0x014f, {1, {0x014e }}},
+ { 0x0151, {1, {0x0150 }}},
+ { 0x0153, {1, {0x0152 }}},
+ { 0x0155, {1, {0x0154 }}},
+ { 0x0157, {1, {0x0156 }}},
+ { 0x0159, {1, {0x0158 }}},
+ { 0x015b, {1, {0x015a }}},
+ { 0x015d, {1, {0x015c }}},
+ { 0x015f, {1, {0x015e }}},
+ { 0x0161, {1, {0x0160 }}},
+ { 0x0163, {1, {0x0162 }}},
+ { 0x0165, {1, {0x0164 }}},
+ { 0x0167, {1, {0x0166 }}},
+ { 0x0169, {1, {0x0168 }}},
+ { 0x016b, {1, {0x016a }}},
+ { 0x016d, {1, {0x016c }}},
+ { 0x016f, {1, {0x016e }}},
+ { 0x0171, {1, {0x0170 }}},
+ { 0x0173, {1, {0x0172 }}},
+ { 0x0175, {1, {0x0174 }}},
+ { 0x0177, {1, {0x0176 }}},
+ { 0x017a, {1, {0x0179 }}},
+ { 0x017c, {1, {0x017b }}},
+ { 0x017e, {1, {0x017d }}},
+ { 0x0180, {1, {0x0243 }}},
+ { 0x0183, {1, {0x0182 }}},
+ { 0x0185, {1, {0x0184 }}},
+ { 0x0188, {1, {0x0187 }}},
+ { 0x018c, {1, {0x018b }}},
+ { 0x0192, {1, {0x0191 }}},
+ { 0x0195, {1, {0x01f6 }}},
+ { 0x0199, {1, {0x0198 }}},
+ { 0x019a, {1, {0x023d }}},
+ { 0x019e, {1, {0x0220 }}},
+ { 0x01a1, {1, {0x01a0 }}},
+ { 0x01a3, {1, {0x01a2 }}},
+ { 0x01a5, {1, {0x01a4 }}},
+ { 0x01a8, {1, {0x01a7 }}},
+ { 0x01ad, {1, {0x01ac }}},
+ { 0x01b0, {1, {0x01af }}},
+ { 0x01b4, {1, {0x01b3 }}},
+ { 0x01b6, {1, {0x01b5 }}},
+ { 0x01b9, {1, {0x01b8 }}},
+ { 0x01bd, {1, {0x01bc }}},
+ { 0x01bf, {1, {0x01f7 }}},
+ { 0x01c6, {2, {0x01c4, 0x01c5 }}},
+ { 0x01c9, {2, {0x01c7, 0x01c8 }}},
+ { 0x01cc, {2, {0x01ca, 0x01cb }}},
+ { 0x01ce, {1, {0x01cd }}},
+ { 0x01d0, {1, {0x01cf }}},
+ { 0x01d2, {1, {0x01d1 }}},
+ { 0x01d4, {1, {0x01d3 }}},
+ { 0x01d6, {1, {0x01d5 }}},
+ { 0x01d8, {1, {0x01d7 }}},
+ { 0x01da, {1, {0x01d9 }}},
+ { 0x01dc, {1, {0x01db }}},
+ { 0x01dd, {1, {0x018e }}},
+ { 0x01df, {1, {0x01de }}},
+ { 0x01e1, {1, {0x01e0 }}},
+ { 0x01e3, {1, {0x01e2 }}},
+ { 0x01e5, {1, {0x01e4 }}},
+ { 0x01e7, {1, {0x01e6 }}},
+ { 0x01e9, {1, {0x01e8 }}},
+ { 0x01eb, {1, {0x01ea }}},
+ { 0x01ed, {1, {0x01ec }}},
+ { 0x01ef, {1, {0x01ee }}},
+ { 0x01f3, {2, {0x01f1, 0x01f2 }}},
+ { 0x01f5, {1, {0x01f4 }}},
+ { 0x01f9, {1, {0x01f8 }}},
+ { 0x01fb, {1, {0x01fa }}},
+ { 0x01fd, {1, {0x01fc }}},
+ { 0x01ff, {1, {0x01fe }}},
+ { 0x0201, {1, {0x0200 }}},
+ { 0x0203, {1, {0x0202 }}},
+ { 0x0205, {1, {0x0204 }}},
+ { 0x0207, {1, {0x0206 }}},
+ { 0x0209, {1, {0x0208 }}},
+ { 0x020b, {1, {0x020a }}},
+ { 0x020d, {1, {0x020c }}},
+ { 0x020f, {1, {0x020e }}},
+ { 0x0211, {1, {0x0210 }}},
+ { 0x0213, {1, {0x0212 }}},
+ { 0x0215, {1, {0x0214 }}},
+ { 0x0217, {1, {0x0216 }}},
+ { 0x0219, {1, {0x0218 }}},
+ { 0x021b, {1, {0x021a }}},
+ { 0x021d, {1, {0x021c }}},
+ { 0x021f, {1, {0x021e }}},
+ { 0x0223, {1, {0x0222 }}},
+ { 0x0225, {1, {0x0224 }}},
+ { 0x0227, {1, {0x0226 }}},
+ { 0x0229, {1, {0x0228 }}},
+ { 0x022b, {1, {0x022a }}},
+ { 0x022d, {1, {0x022c }}},
+ { 0x022f, {1, {0x022e }}},
+ { 0x0231, {1, {0x0230 }}},
+ { 0x0233, {1, {0x0232 }}},
+ { 0x023c, {1, {0x023b }}},
+ { 0x023f, {1, {0x2c7e }}},
+ { 0x0240, {1, {0x2c7f }}},
+ { 0x0242, {1, {0x0241 }}},
+ { 0x0247, {1, {0x0246 }}},
+ { 0x0249, {1, {0x0248 }}},
+ { 0x024b, {1, {0x024a }}},
+ { 0x024d, {1, {0x024c }}},
+ { 0x024f, {1, {0x024e }}},
+ { 0x0250, {1, {0x2c6f }}},
+ { 0x0251, {1, {0x2c6d }}},
+ { 0x0252, {1, {0x2c70 }}},
+ { 0x0253, {1, {0x0181 }}},
+ { 0x0254, {1, {0x0186 }}},
+ { 0x0256, {1, {0x0189 }}},
+ { 0x0257, {1, {0x018a }}},
+ { 0x0259, {1, {0x018f }}},
+ { 0x025b, {1, {0x0190 }}},
+ { 0x0260, {1, {0x0193 }}},
+ { 0x0263, {1, {0x0194 }}},
+ { 0x0265, {1, {0xa78d }}},
+ { 0x0266, {1, {0xa7aa }}},
+ { 0x0268, {1, {0x0197 }}},
+ { 0x0269, {1, {0x0196 }}},
+ { 0x026b, {1, {0x2c62 }}},
+ { 0x026f, {1, {0x019c }}},
+ { 0x0271, {1, {0x2c6e }}},
+ { 0x0272, {1, {0x019d }}},
+ { 0x0275, {1, {0x019f }}},
+ { 0x027d, {1, {0x2c64 }}},
+ { 0x0280, {1, {0x01a6 }}},
+ { 0x0283, {1, {0x01a9 }}},
+ { 0x0288, {1, {0x01ae }}},
+ { 0x0289, {1, {0x0244 }}},
+ { 0x028a, {1, {0x01b1 }}},
+ { 0x028b, {1, {0x01b2 }}},
+ { 0x028c, {1, {0x0245 }}},
+ { 0x0292, {1, {0x01b7 }}},
+ { 0x0371, {1, {0x0370 }}},
+ { 0x0373, {1, {0x0372 }}},
+ { 0x0377, {1, {0x0376 }}},
+ { 0x037b, {1, {0x03fd }}},
+ { 0x037c, {1, {0x03fe }}},
+ { 0x037d, {1, {0x03ff }}},
+ { 0x03ac, {1, {0x0386 }}},
+ { 0x03ad, {1, {0x0388 }}},
+ { 0x03ae, {1, {0x0389 }}},
+ { 0x03af, {1, {0x038a }}},
+ { 0x03b1, {1, {0x0391 }}},
+ { 0x03b2, {2, {0x0392, 0x03d0 }}},
+ { 0x03b3, {1, {0x0393 }}},
+ { 0x03b4, {1, {0x0394 }}},
+ { 0x03b5, {2, {0x0395, 0x03f5 }}},
+ { 0x03b6, {1, {0x0396 }}},
+ { 0x03b7, {1, {0x0397 }}},
+ { 0x03b8, {3, {0x0398, 0x03d1, 0x03f4 }}},
+ { 0x03b9, {3, {0x0345, 0x0399, 0x1fbe }}},
+ { 0x03ba, {2, {0x039a, 0x03f0 }}},
+ { 0x03bb, {1, {0x039b }}},
+ { 0x03bc, {2, {0x00b5, 0x039c }}},
+ { 0x03bd, {1, {0x039d }}},
+ { 0x03be, {1, {0x039e }}},
+ { 0x03bf, {1, {0x039f }}},
+ { 0x03c0, {2, {0x03a0, 0x03d6 }}},
+ { 0x03c1, {2, {0x03a1, 0x03f1 }}},
+ { 0x03c3, {2, {0x03a3, 0x03c2 }}},
+ { 0x03c4, {1, {0x03a4 }}},
+ { 0x03c5, {1, {0x03a5 }}},
+ { 0x03c6, {2, {0x03a6, 0x03d5 }}},
+ { 0x03c7, {1, {0x03a7 }}},
+ { 0x03c8, {1, {0x03a8 }}},
+ { 0x03c9, {2, {0x03a9, 0x2126 }}},
+ { 0x03ca, {1, {0x03aa }}},
+ { 0x03cb, {1, {0x03ab }}},
+ { 0x03cc, {1, {0x038c }}},
+ { 0x03cd, {1, {0x038e }}},
+ { 0x03ce, {1, {0x038f }}},
+ { 0x03d7, {1, {0x03cf }}},
+ { 0x03d9, {1, {0x03d8 }}},
+ { 0x03db, {1, {0x03da }}},
+ { 0x03dd, {1, {0x03dc }}},
+ { 0x03df, {1, {0x03de }}},
+ { 0x03e1, {1, {0x03e0 }}},
+ { 0x03e3, {1, {0x03e2 }}},
+ { 0x03e5, {1, {0x03e4 }}},
+ { 0x03e7, {1, {0x03e6 }}},
+ { 0x03e9, {1, {0x03e8 }}},
+ { 0x03eb, {1, {0x03ea }}},
+ { 0x03ed, {1, {0x03ec }}},
+ { 0x03ef, {1, {0x03ee }}},
+ { 0x03f2, {1, {0x03f9 }}},
+ { 0x03f8, {1, {0x03f7 }}},
+ { 0x03fb, {1, {0x03fa }}},
+ { 0x0430, {1, {0x0410 }}},
+ { 0x0431, {1, {0x0411 }}},
+ { 0x0432, {1, {0x0412 }}},
+ { 0x0433, {1, {0x0413 }}},
+ { 0x0434, {1, {0x0414 }}},
+ { 0x0435, {1, {0x0415 }}},
+ { 0x0436, {1, {0x0416 }}},
+ { 0x0437, {1, {0x0417 }}},
+ { 0x0438, {1, {0x0418 }}},
+ { 0x0439, {1, {0x0419 }}},
+ { 0x043a, {1, {0x041a }}},
+ { 0x043b, {1, {0x041b }}},
+ { 0x043c, {1, {0x041c }}},
+ { 0x043d, {1, {0x041d }}},
+ { 0x043e, {1, {0x041e }}},
+ { 0x043f, {1, {0x041f }}},
+ { 0x0440, {1, {0x0420 }}},
+ { 0x0441, {1, {0x0421 }}},
+ { 0x0442, {1, {0x0422 }}},
+ { 0x0443, {1, {0x0423 }}},
+ { 0x0444, {1, {0x0424 }}},
+ { 0x0445, {1, {0x0425 }}},
+ { 0x0446, {1, {0x0426 }}},
+ { 0x0447, {1, {0x0427 }}},
+ { 0x0448, {1, {0x0428 }}},
+ { 0x0449, {1, {0x0429 }}},
+ { 0x044a, {1, {0x042a }}},
+ { 0x044b, {1, {0x042b }}},
+ { 0x044c, {1, {0x042c }}},
+ { 0x044d, {1, {0x042d }}},
+ { 0x044e, {1, {0x042e }}},
+ { 0x044f, {1, {0x042f }}},
+ { 0x0450, {1, {0x0400 }}},
+ { 0x0451, {1, {0x0401 }}},
+ { 0x0452, {1, {0x0402 }}},
+ { 0x0453, {1, {0x0403 }}},
+ { 0x0454, {1, {0x0404 }}},
+ { 0x0455, {1, {0x0405 }}},
+ { 0x0456, {1, {0x0406 }}},
+ { 0x0457, {1, {0x0407 }}},
+ { 0x0458, {1, {0x0408 }}},
+ { 0x0459, {1, {0x0409 }}},
+ { 0x045a, {1, {0x040a }}},
+ { 0x045b, {1, {0x040b }}},
+ { 0x045c, {1, {0x040c }}},
+ { 0x045d, {1, {0x040d }}},
+ { 0x045e, {1, {0x040e }}},
+ { 0x045f, {1, {0x040f }}},
+ { 0x0461, {1, {0x0460 }}},
+ { 0x0463, {1, {0x0462 }}},
+ { 0x0465, {1, {0x0464 }}},
+ { 0x0467, {1, {0x0466 }}},
+ { 0x0469, {1, {0x0468 }}},
+ { 0x046b, {1, {0x046a }}},
+ { 0x046d, {1, {0x046c }}},
+ { 0x046f, {1, {0x046e }}},
+ { 0x0471, {1, {0x0470 }}},
+ { 0x0473, {1, {0x0472 }}},
+ { 0x0475, {1, {0x0474 }}},
+ { 0x0477, {1, {0x0476 }}},
+ { 0x0479, {1, {0x0478 }}},
+ { 0x047b, {1, {0x047a }}},
+ { 0x047d, {1, {0x047c }}},
+ { 0x047f, {1, {0x047e }}},
+ { 0x0481, {1, {0x0480 }}},
+ { 0x048b, {1, {0x048a }}},
+ { 0x048d, {1, {0x048c }}},
+ { 0x048f, {1, {0x048e }}},
+ { 0x0491, {1, {0x0490 }}},
+ { 0x0493, {1, {0x0492 }}},
+ { 0x0495, {1, {0x0494 }}},
+ { 0x0497, {1, {0x0496 }}},
+ { 0x0499, {1, {0x0498 }}},
+ { 0x049b, {1, {0x049a }}},
+ { 0x049d, {1, {0x049c }}},
+ { 0x049f, {1, {0x049e }}},
+ { 0x04a1, {1, {0x04a0 }}},
+ { 0x04a3, {1, {0x04a2 }}},
+ { 0x04a5, {1, {0x04a4 }}},
+ { 0x04a7, {1, {0x04a6 }}},
+ { 0x04a9, {1, {0x04a8 }}},
+ { 0x04ab, {1, {0x04aa }}},
+ { 0x04ad, {1, {0x04ac }}},
+ { 0x04af, {1, {0x04ae }}},
+ { 0x04b1, {1, {0x04b0 }}},
+ { 0x04b3, {1, {0x04b2 }}},
+ { 0x04b5, {1, {0x04b4 }}},
+ { 0x04b7, {1, {0x04b6 }}},
+ { 0x04b9, {1, {0x04b8 }}},
+ { 0x04bb, {1, {0x04ba }}},
+ { 0x04bd, {1, {0x04bc }}},
+ { 0x04bf, {1, {0x04be }}},
+ { 0x04c2, {1, {0x04c1 }}},
+ { 0x04c4, {1, {0x04c3 }}},
+ { 0x04c6, {1, {0x04c5 }}},
+ { 0x04c8, {1, {0x04c7 }}},
+ { 0x04ca, {1, {0x04c9 }}},
+ { 0x04cc, {1, {0x04cb }}},
+ { 0x04ce, {1, {0x04cd }}},
+ { 0x04cf, {1, {0x04c0 }}},
+ { 0x04d1, {1, {0x04d0 }}},
+ { 0x04d3, {1, {0x04d2 }}},
+ { 0x04d5, {1, {0x04d4 }}},
+ { 0x04d7, {1, {0x04d6 }}},
+ { 0x04d9, {1, {0x04d8 }}},
+ { 0x04db, {1, {0x04da }}},
+ { 0x04dd, {1, {0x04dc }}},
+ { 0x04df, {1, {0x04de }}},
+ { 0x04e1, {1, {0x04e0 }}},
+ { 0x04e3, {1, {0x04e2 }}},
+ { 0x04e5, {1, {0x04e4 }}},
+ { 0x04e7, {1, {0x04e6 }}},
+ { 0x04e9, {1, {0x04e8 }}},
+ { 0x04eb, {1, {0x04ea }}},
+ { 0x04ed, {1, {0x04ec }}},
+ { 0x04ef, {1, {0x04ee }}},
+ { 0x04f1, {1, {0x04f0 }}},
+ { 0x04f3, {1, {0x04f2 }}},
+ { 0x04f5, {1, {0x04f4 }}},
+ { 0x04f7, {1, {0x04f6 }}},
+ { 0x04f9, {1, {0x04f8 }}},
+ { 0x04fb, {1, {0x04fa }}},
+ { 0x04fd, {1, {0x04fc }}},
+ { 0x04ff, {1, {0x04fe }}},
+ { 0x0501, {1, {0x0500 }}},
+ { 0x0503, {1, {0x0502 }}},
+ { 0x0505, {1, {0x0504 }}},
+ { 0x0507, {1, {0x0506 }}},
+ { 0x0509, {1, {0x0508 }}},
+ { 0x050b, {1, {0x050a }}},
+ { 0x050d, {1, {0x050c }}},
+ { 0x050f, {1, {0x050e }}},
+ { 0x0511, {1, {0x0510 }}},
+ { 0x0513, {1, {0x0512 }}},
+ { 0x0515, {1, {0x0514 }}},
+ { 0x0517, {1, {0x0516 }}},
+ { 0x0519, {1, {0x0518 }}},
+ { 0x051b, {1, {0x051a }}},
+ { 0x051d, {1, {0x051c }}},
+ { 0x051f, {1, {0x051e }}},
+ { 0x0521, {1, {0x0520 }}},
+ { 0x0523, {1, {0x0522 }}},
+ { 0x0525, {1, {0x0524 }}},
+ { 0x0527, {1, {0x0526 }}},
+ { 0x0561, {1, {0x0531 }}},
+ { 0x0562, {1, {0x0532 }}},
+ { 0x0563, {1, {0x0533 }}},
+ { 0x0564, {1, {0x0534 }}},
+ { 0x0565, {1, {0x0535 }}},
+ { 0x0566, {1, {0x0536 }}},
+ { 0x0567, {1, {0x0537 }}},
+ { 0x0568, {1, {0x0538 }}},
+ { 0x0569, {1, {0x0539 }}},
+ { 0x056a, {1, {0x053a }}},
+ { 0x056b, {1, {0x053b }}},
+ { 0x056c, {1, {0x053c }}},
+ { 0x056d, {1, {0x053d }}},
+ { 0x056e, {1, {0x053e }}},
+ { 0x056f, {1, {0x053f }}},
+ { 0x0570, {1, {0x0540 }}},
+ { 0x0571, {1, {0x0541 }}},
+ { 0x0572, {1, {0x0542 }}},
+ { 0x0573, {1, {0x0543 }}},
+ { 0x0574, {1, {0x0544 }}},
+ { 0x0575, {1, {0x0545 }}},
+ { 0x0576, {1, {0x0546 }}},
+ { 0x0577, {1, {0x0547 }}},
+ { 0x0578, {1, {0x0548 }}},
+ { 0x0579, {1, {0x0549 }}},
+ { 0x057a, {1, {0x054a }}},
+ { 0x057b, {1, {0x054b }}},
+ { 0x057c, {1, {0x054c }}},
+ { 0x057d, {1, {0x054d }}},
+ { 0x057e, {1, {0x054e }}},
+ { 0x057f, {1, {0x054f }}},
+ { 0x0580, {1, {0x0550 }}},
+ { 0x0581, {1, {0x0551 }}},
+ { 0x0582, {1, {0x0552 }}},
+ { 0x0583, {1, {0x0553 }}},
+ { 0x0584, {1, {0x0554 }}},
+ { 0x0585, {1, {0x0555 }}},
+ { 0x0586, {1, {0x0556 }}},
+ { 0x1d79, {1, {0xa77d }}},
+ { 0x1d7d, {1, {0x2c63 }}},
+ { 0x1e01, {1, {0x1e00 }}},
+ { 0x1e03, {1, {0x1e02 }}},
+ { 0x1e05, {1, {0x1e04 }}},
+ { 0x1e07, {1, {0x1e06 }}},
+ { 0x1e09, {1, {0x1e08 }}},
+ { 0x1e0b, {1, {0x1e0a }}},
+ { 0x1e0d, {1, {0x1e0c }}},
+ { 0x1e0f, {1, {0x1e0e }}},
+ { 0x1e11, {1, {0x1e10 }}},
+ { 0x1e13, {1, {0x1e12 }}},
+ { 0x1e15, {1, {0x1e14 }}},
+ { 0x1e17, {1, {0x1e16 }}},
+ { 0x1e19, {1, {0x1e18 }}},
+ { 0x1e1b, {1, {0x1e1a }}},
+ { 0x1e1d, {1, {0x1e1c }}},
+ { 0x1e1f, {1, {0x1e1e }}},
+ { 0x1e21, {1, {0x1e20 }}},
+ { 0x1e23, {1, {0x1e22 }}},
+ { 0x1e25, {1, {0x1e24 }}},
+ { 0x1e27, {1, {0x1e26 }}},
+ { 0x1e29, {1, {0x1e28 }}},
+ { 0x1e2b, {1, {0x1e2a }}},
+ { 0x1e2d, {1, {0x1e2c }}},
+ { 0x1e2f, {1, {0x1e2e }}},
+ { 0x1e31, {1, {0x1e30 }}},
+ { 0x1e33, {1, {0x1e32 }}},
+ { 0x1e35, {1, {0x1e34 }}},
+ { 0x1e37, {1, {0x1e36 }}},
+ { 0x1e39, {1, {0x1e38 }}},
+ { 0x1e3b, {1, {0x1e3a }}},
+ { 0x1e3d, {1, {0x1e3c }}},
+ { 0x1e3f, {1, {0x1e3e }}},
+ { 0x1e41, {1, {0x1e40 }}},
+ { 0x1e43, {1, {0x1e42 }}},
+ { 0x1e45, {1, {0x1e44 }}},
+ { 0x1e47, {1, {0x1e46 }}},
+ { 0x1e49, {1, {0x1e48 }}},
+ { 0x1e4b, {1, {0x1e4a }}},
+ { 0x1e4d, {1, {0x1e4c }}},
+ { 0x1e4f, {1, {0x1e4e }}},
+ { 0x1e51, {1, {0x1e50 }}},
+ { 0x1e53, {1, {0x1e52 }}},
+ { 0x1e55, {1, {0x1e54 }}},
+ { 0x1e57, {1, {0x1e56 }}},
+ { 0x1e59, {1, {0x1e58 }}},
+ { 0x1e5b, {1, {0x1e5a }}},
+ { 0x1e5d, {1, {0x1e5c }}},
+ { 0x1e5f, {1, {0x1e5e }}},
+ { 0x1e61, {2, {0x1e60, 0x1e9b }}},
+ { 0x1e63, {1, {0x1e62 }}},
+ { 0x1e65, {1, {0x1e64 }}},
+ { 0x1e67, {1, {0x1e66 }}},
+ { 0x1e69, {1, {0x1e68 }}},
+ { 0x1e6b, {1, {0x1e6a }}},
+ { 0x1e6d, {1, {0x1e6c }}},
+ { 0x1e6f, {1, {0x1e6e }}},
+ { 0x1e71, {1, {0x1e70 }}},
+ { 0x1e73, {1, {0x1e72 }}},
+ { 0x1e75, {1, {0x1e74 }}},
+ { 0x1e77, {1, {0x1e76 }}},
+ { 0x1e79, {1, {0x1e78 }}},
+ { 0x1e7b, {1, {0x1e7a }}},
+ { 0x1e7d, {1, {0x1e7c }}},
+ { 0x1e7f, {1, {0x1e7e }}},
+ { 0x1e81, {1, {0x1e80 }}},
+ { 0x1e83, {1, {0x1e82 }}},
+ { 0x1e85, {1, {0x1e84 }}},
+ { 0x1e87, {1, {0x1e86 }}},
+ { 0x1e89, {1, {0x1e88 }}},
+ { 0x1e8b, {1, {0x1e8a }}},
+ { 0x1e8d, {1, {0x1e8c }}},
+ { 0x1e8f, {1, {0x1e8e }}},
+ { 0x1e91, {1, {0x1e90 }}},
+ { 0x1e93, {1, {0x1e92 }}},
+ { 0x1e95, {1, {0x1e94 }}},
+ { 0x1ea1, {1, {0x1ea0 }}},
+ { 0x1ea3, {1, {0x1ea2 }}},
+ { 0x1ea5, {1, {0x1ea4 }}},
+ { 0x1ea7, {1, {0x1ea6 }}},
+ { 0x1ea9, {1, {0x1ea8 }}},
+ { 0x1eab, {1, {0x1eaa }}},
+ { 0x1ead, {1, {0x1eac }}},
+ { 0x1eaf, {1, {0x1eae }}},
+ { 0x1eb1, {1, {0x1eb0 }}},
+ { 0x1eb3, {1, {0x1eb2 }}},
+ { 0x1eb5, {1, {0x1eb4 }}},
+ { 0x1eb7, {1, {0x1eb6 }}},
+ { 0x1eb9, {1, {0x1eb8 }}},
+ { 0x1ebb, {1, {0x1eba }}},
+ { 0x1ebd, {1, {0x1ebc }}},
+ { 0x1ebf, {1, {0x1ebe }}},
+ { 0x1ec1, {1, {0x1ec0 }}},
+ { 0x1ec3, {1, {0x1ec2 }}},
+ { 0x1ec5, {1, {0x1ec4 }}},
+ { 0x1ec7, {1, {0x1ec6 }}},
+ { 0x1ec9, {1, {0x1ec8 }}},
+ { 0x1ecb, {1, {0x1eca }}},
+ { 0x1ecd, {1, {0x1ecc }}},
+ { 0x1ecf, {1, {0x1ece }}},
+ { 0x1ed1, {1, {0x1ed0 }}},
+ { 0x1ed3, {1, {0x1ed2 }}},
+ { 0x1ed5, {1, {0x1ed4 }}},
+ { 0x1ed7, {1, {0x1ed6 }}},
+ { 0x1ed9, {1, {0x1ed8 }}},
+ { 0x1edb, {1, {0x1eda }}},
+ { 0x1edd, {1, {0x1edc }}},
+ { 0x1edf, {1, {0x1ede }}},
+ { 0x1ee1, {1, {0x1ee0 }}},
+ { 0x1ee3, {1, {0x1ee2 }}},
+ { 0x1ee5, {1, {0x1ee4 }}},
+ { 0x1ee7, {1, {0x1ee6 }}},
+ { 0x1ee9, {1, {0x1ee8 }}},
+ { 0x1eeb, {1, {0x1eea }}},
+ { 0x1eed, {1, {0x1eec }}},
+ { 0x1eef, {1, {0x1eee }}},
+ { 0x1ef1, {1, {0x1ef0 }}},
+ { 0x1ef3, {1, {0x1ef2 }}},
+ { 0x1ef5, {1, {0x1ef4 }}},
+ { 0x1ef7, {1, {0x1ef6 }}},
+ { 0x1ef9, {1, {0x1ef8 }}},
+ { 0x1efb, {1, {0x1efa }}},
+ { 0x1efd, {1, {0x1efc }}},
+ { 0x1eff, {1, {0x1efe }}},
+ { 0x1f00, {1, {0x1f08 }}},
+ { 0x1f01, {1, {0x1f09 }}},
+ { 0x1f02, {1, {0x1f0a }}},
+ { 0x1f03, {1, {0x1f0b }}},
+ { 0x1f04, {1, {0x1f0c }}},
+ { 0x1f05, {1, {0x1f0d }}},
+ { 0x1f06, {1, {0x1f0e }}},
+ { 0x1f07, {1, {0x1f0f }}},
+ { 0x1f10, {1, {0x1f18 }}},
+ { 0x1f11, {1, {0x1f19 }}},
+ { 0x1f12, {1, {0x1f1a }}},
+ { 0x1f13, {1, {0x1f1b }}},
+ { 0x1f14, {1, {0x1f1c }}},
+ { 0x1f15, {1, {0x1f1d }}},
+ { 0x1f20, {1, {0x1f28 }}},
+ { 0x1f21, {1, {0x1f29 }}},
+ { 0x1f22, {1, {0x1f2a }}},
+ { 0x1f23, {1, {0x1f2b }}},
+ { 0x1f24, {1, {0x1f2c }}},
+ { 0x1f25, {1, {0x1f2d }}},
+ { 0x1f26, {1, {0x1f2e }}},
+ { 0x1f27, {1, {0x1f2f }}},
+ { 0x1f30, {1, {0x1f38 }}},
+ { 0x1f31, {1, {0x1f39 }}},
+ { 0x1f32, {1, {0x1f3a }}},
+ { 0x1f33, {1, {0x1f3b }}},
+ { 0x1f34, {1, {0x1f3c }}},
+ { 0x1f35, {1, {0x1f3d }}},
+ { 0x1f36, {1, {0x1f3e }}},
+ { 0x1f37, {1, {0x1f3f }}},
+ { 0x1f40, {1, {0x1f48 }}},
+ { 0x1f41, {1, {0x1f49 }}},
+ { 0x1f42, {1, {0x1f4a }}},
+ { 0x1f43, {1, {0x1f4b }}},
+ { 0x1f44, {1, {0x1f4c }}},
+ { 0x1f45, {1, {0x1f4d }}},
+ { 0x1f51, {1, {0x1f59 }}},
+ { 0x1f53, {1, {0x1f5b }}},
+ { 0x1f55, {1, {0x1f5d }}},
+ { 0x1f57, {1, {0x1f5f }}},
+ { 0x1f60, {1, {0x1f68 }}},
+ { 0x1f61, {1, {0x1f69 }}},
+ { 0x1f62, {1, {0x1f6a }}},
+ { 0x1f63, {1, {0x1f6b }}},
+ { 0x1f64, {1, {0x1f6c }}},
+ { 0x1f65, {1, {0x1f6d }}},
+ { 0x1f66, {1, {0x1f6e }}},
+ { 0x1f67, {1, {0x1f6f }}},
+ { 0x1f70, {1, {0x1fba }}},
+ { 0x1f71, {1, {0x1fbb }}},
+ { 0x1f72, {1, {0x1fc8 }}},
+ { 0x1f73, {1, {0x1fc9 }}},
+ { 0x1f74, {1, {0x1fca }}},
+ { 0x1f75, {1, {0x1fcb }}},
+ { 0x1f76, {1, {0x1fda }}},
+ { 0x1f77, {1, {0x1fdb }}},
+ { 0x1f78, {1, {0x1ff8 }}},
+ { 0x1f79, {1, {0x1ff9 }}},
+ { 0x1f7a, {1, {0x1fea }}},
+ { 0x1f7b, {1, {0x1feb }}},
+ { 0x1f7c, {1, {0x1ffa }}},
+ { 0x1f7d, {1, {0x1ffb }}},
+ { 0x1fb0, {1, {0x1fb8 }}},
+ { 0x1fb1, {1, {0x1fb9 }}},
+ { 0x1fd0, {1, {0x1fd8 }}},
+ { 0x1fd1, {1, {0x1fd9 }}},
+ { 0x1fe0, {1, {0x1fe8 }}},
+ { 0x1fe1, {1, {0x1fe9 }}},
+ { 0x1fe5, {1, {0x1fec }}},
+ { 0x214e, {1, {0x2132 }}},
+ { 0x2170, {1, {0x2160 }}},
+ { 0x2171, {1, {0x2161 }}},
+ { 0x2172, {1, {0x2162 }}},
+ { 0x2173, {1, {0x2163 }}},
+ { 0x2174, {1, {0x2164 }}},
+ { 0x2175, {1, {0x2165 }}},
+ { 0x2176, {1, {0x2166 }}},
+ { 0x2177, {1, {0x2167 }}},
+ { 0x2178, {1, {0x2168 }}},
+ { 0x2179, {1, {0x2169 }}},
+ { 0x217a, {1, {0x216a }}},
+ { 0x217b, {1, {0x216b }}},
+ { 0x217c, {1, {0x216c }}},
+ { 0x217d, {1, {0x216d }}},
+ { 0x217e, {1, {0x216e }}},
+ { 0x217f, {1, {0x216f }}},
+ { 0x2184, {1, {0x2183 }}},
+ { 0x24d0, {1, {0x24b6 }}},
+ { 0x24d1, {1, {0x24b7 }}},
+ { 0x24d2, {1, {0x24b8 }}},
+ { 0x24d3, {1, {0x24b9 }}},
+ { 0x24d4, {1, {0x24ba }}},
+ { 0x24d5, {1, {0x24bb }}},
+ { 0x24d6, {1, {0x24bc }}},
+ { 0x24d7, {1, {0x24bd }}},
+ { 0x24d8, {1, {0x24be }}},
+ { 0x24d9, {1, {0x24bf }}},
+ { 0x24da, {1, {0x24c0 }}},
+ { 0x24db, {1, {0x24c1 }}},
+ { 0x24dc, {1, {0x24c2 }}},
+ { 0x24dd, {1, {0x24c3 }}},
+ { 0x24de, {1, {0x24c4 }}},
+ { 0x24df, {1, {0x24c5 }}},
+ { 0x24e0, {1, {0x24c6 }}},
+ { 0x24e1, {1, {0x24c7 }}},
+ { 0x24e2, {1, {0x24c8 }}},
+ { 0x24e3, {1, {0x24c9 }}},
+ { 0x24e4, {1, {0x24ca }}},
+ { 0x24e5, {1, {0x24cb }}},
+ { 0x24e6, {1, {0x24cc }}},
+ { 0x24e7, {1, {0x24cd }}},
+ { 0x24e8, {1, {0x24ce }}},
+ { 0x24e9, {1, {0x24cf }}},
+ { 0x2c30, {1, {0x2c00 }}},
+ { 0x2c31, {1, {0x2c01 }}},
+ { 0x2c32, {1, {0x2c02 }}},
+ { 0x2c33, {1, {0x2c03 }}},
+ { 0x2c34, {1, {0x2c04 }}},
+ { 0x2c35, {1, {0x2c05 }}},
+ { 0x2c36, {1, {0x2c06 }}},
+ { 0x2c37, {1, {0x2c07 }}},
+ { 0x2c38, {1, {0x2c08 }}},
+ { 0x2c39, {1, {0x2c09 }}},
+ { 0x2c3a, {1, {0x2c0a }}},
+ { 0x2c3b, {1, {0x2c0b }}},
+ { 0x2c3c, {1, {0x2c0c }}},
+ { 0x2c3d, {1, {0x2c0d }}},
+ { 0x2c3e, {1, {0x2c0e }}},
+ { 0x2c3f, {1, {0x2c0f }}},
+ { 0x2c40, {1, {0x2c10 }}},
+ { 0x2c41, {1, {0x2c11 }}},
+ { 0x2c42, {1, {0x2c12 }}},
+ { 0x2c43, {1, {0x2c13 }}},
+ { 0x2c44, {1, {0x2c14 }}},
+ { 0x2c45, {1, {0x2c15 }}},
+ { 0x2c46, {1, {0x2c16 }}},
+ { 0x2c47, {1, {0x2c17 }}},
+ { 0x2c48, {1, {0x2c18 }}},
+ { 0x2c49, {1, {0x2c19 }}},
+ { 0x2c4a, {1, {0x2c1a }}},
+ { 0x2c4b, {1, {0x2c1b }}},
+ { 0x2c4c, {1, {0x2c1c }}},
+ { 0x2c4d, {1, {0x2c1d }}},
+ { 0x2c4e, {1, {0x2c1e }}},
+ { 0x2c4f, {1, {0x2c1f }}},
+ { 0x2c50, {1, {0x2c20 }}},
+ { 0x2c51, {1, {0x2c21 }}},
+ { 0x2c52, {1, {0x2c22 }}},
+ { 0x2c53, {1, {0x2c23 }}},
+ { 0x2c54, {1, {0x2c24 }}},
+ { 0x2c55, {1, {0x2c25 }}},
+ { 0x2c56, {1, {0x2c26 }}},
+ { 0x2c57, {1, {0x2c27 }}},
+ { 0x2c58, {1, {0x2c28 }}},
+ { 0x2c59, {1, {0x2c29 }}},
+ { 0x2c5a, {1, {0x2c2a }}},
+ { 0x2c5b, {1, {0x2c2b }}},
+ { 0x2c5c, {1, {0x2c2c }}},
+ { 0x2c5d, {1, {0x2c2d }}},
+ { 0x2c5e, {1, {0x2c2e }}},
+ { 0x2c61, {1, {0x2c60 }}},
+ { 0x2c65, {1, {0x023a }}},
+ { 0x2c66, {1, {0x023e }}},
+ { 0x2c68, {1, {0x2c67 }}},
+ { 0x2c6a, {1, {0x2c69 }}},
+ { 0x2c6c, {1, {0x2c6b }}},
+ { 0x2c73, {1, {0x2c72 }}},
+ { 0x2c76, {1, {0x2c75 }}},
+ { 0x2c81, {1, {0x2c80 }}},
+ { 0x2c83, {1, {0x2c82 }}},
+ { 0x2c85, {1, {0x2c84 }}},
+ { 0x2c87, {1, {0x2c86 }}},
+ { 0x2c89, {1, {0x2c88 }}},
+ { 0x2c8b, {1, {0x2c8a }}},
+ { 0x2c8d, {1, {0x2c8c }}},
+ { 0x2c8f, {1, {0x2c8e }}},
+ { 0x2c91, {1, {0x2c90 }}},
+ { 0x2c93, {1, {0x2c92 }}},
+ { 0x2c95, {1, {0x2c94 }}},
+ { 0x2c97, {1, {0x2c96 }}},
+ { 0x2c99, {1, {0x2c98 }}},
+ { 0x2c9b, {1, {0x2c9a }}},
+ { 0x2c9d, {1, {0x2c9c }}},
+ { 0x2c9f, {1, {0x2c9e }}},
+ { 0x2ca1, {1, {0x2ca0 }}},
+ { 0x2ca3, {1, {0x2ca2 }}},
+ { 0x2ca5, {1, {0x2ca4 }}},
+ { 0x2ca7, {1, {0x2ca6 }}},
+ { 0x2ca9, {1, {0x2ca8 }}},
+ { 0x2cab, {1, {0x2caa }}},
+ { 0x2cad, {1, {0x2cac }}},
+ { 0x2caf, {1, {0x2cae }}},
+ { 0x2cb1, {1, {0x2cb0 }}},
+ { 0x2cb3, {1, {0x2cb2 }}},
+ { 0x2cb5, {1, {0x2cb4 }}},
+ { 0x2cb7, {1, {0x2cb6 }}},
+ { 0x2cb9, {1, {0x2cb8 }}},
+ { 0x2cbb, {1, {0x2cba }}},
+ { 0x2cbd, {1, {0x2cbc }}},
+ { 0x2cbf, {1, {0x2cbe }}},
+ { 0x2cc1, {1, {0x2cc0 }}},
+ { 0x2cc3, {1, {0x2cc2 }}},
+ { 0x2cc5, {1, {0x2cc4 }}},
+ { 0x2cc7, {1, {0x2cc6 }}},
+ { 0x2cc9, {1, {0x2cc8 }}},
+ { 0x2ccb, {1, {0x2cca }}},
+ { 0x2ccd, {1, {0x2ccc }}},
+ { 0x2ccf, {1, {0x2cce }}},
+ { 0x2cd1, {1, {0x2cd0 }}},
+ { 0x2cd3, {1, {0x2cd2 }}},
+ { 0x2cd5, {1, {0x2cd4 }}},
+ { 0x2cd7, {1, {0x2cd6 }}},
+ { 0x2cd9, {1, {0x2cd8 }}},
+ { 0x2cdb, {1, {0x2cda }}},
+ { 0x2cdd, {1, {0x2cdc }}},
+ { 0x2cdf, {1, {0x2cde }}},
+ { 0x2ce1, {1, {0x2ce0 }}},
+ { 0x2ce3, {1, {0x2ce2 }}},
+ { 0x2cec, {1, {0x2ceb }}},
+ { 0x2cee, {1, {0x2ced }}},
+ { 0x2cf3, {1, {0x2cf2 }}},
+ { 0x2d00, {1, {0x10a0 }}},
+ { 0x2d01, {1, {0x10a1 }}},
+ { 0x2d02, {1, {0x10a2 }}},
+ { 0x2d03, {1, {0x10a3 }}},
+ { 0x2d04, {1, {0x10a4 }}},
+ { 0x2d05, {1, {0x10a5 }}},
+ { 0x2d06, {1, {0x10a6 }}},
+ { 0x2d07, {1, {0x10a7 }}},
+ { 0x2d08, {1, {0x10a8 }}},
+ { 0x2d09, {1, {0x10a9 }}},
+ { 0x2d0a, {1, {0x10aa }}},
+ { 0x2d0b, {1, {0x10ab }}},
+ { 0x2d0c, {1, {0x10ac }}},
+ { 0x2d0d, {1, {0x10ad }}},
+ { 0x2d0e, {1, {0x10ae }}},
+ { 0x2d0f, {1, {0x10af }}},
+ { 0x2d10, {1, {0x10b0 }}},
+ { 0x2d11, {1, {0x10b1 }}},
+ { 0x2d12, {1, {0x10b2 }}},
+ { 0x2d13, {1, {0x10b3 }}},
+ { 0x2d14, {1, {0x10b4 }}},
+ { 0x2d15, {1, {0x10b5 }}},
+ { 0x2d16, {1, {0x10b6 }}},
+ { 0x2d17, {1, {0x10b7 }}},
+ { 0x2d18, {1, {0x10b8 }}},
+ { 0x2d19, {1, {0x10b9 }}},
+ { 0x2d1a, {1, {0x10ba }}},
+ { 0x2d1b, {1, {0x10bb }}},
+ { 0x2d1c, {1, {0x10bc }}},
+ { 0x2d1d, {1, {0x10bd }}},
+ { 0x2d1e, {1, {0x10be }}},
+ { 0x2d1f, {1, {0x10bf }}},
+ { 0x2d20, {1, {0x10c0 }}},
+ { 0x2d21, {1, {0x10c1 }}},
+ { 0x2d22, {1, {0x10c2 }}},
+ { 0x2d23, {1, {0x10c3 }}},
+ { 0x2d24, {1, {0x10c4 }}},
+ { 0x2d25, {1, {0x10c5 }}},
+ { 0x2d27, {1, {0x10c7 }}},
+ { 0x2d2d, {1, {0x10cd }}},
+ { 0xa641, {1, {0xa640 }}},
+ { 0xa643, {1, {0xa642 }}},
+ { 0xa645, {1, {0xa644 }}},
+ { 0xa647, {1, {0xa646 }}},
+ { 0xa649, {1, {0xa648 }}},
+ { 0xa64b, {1, {0xa64a }}},
+ { 0xa64d, {1, {0xa64c }}},
+ { 0xa64f, {1, {0xa64e }}},
+ { 0xa651, {1, {0xa650 }}},
+ { 0xa653, {1, {0xa652 }}},
+ { 0xa655, {1, {0xa654 }}},
+ { 0xa657, {1, {0xa656 }}},
+ { 0xa659, {1, {0xa658 }}},
+ { 0xa65b, {1, {0xa65a }}},
+ { 0xa65d, {1, {0xa65c }}},
+ { 0xa65f, {1, {0xa65e }}},
+ { 0xa661, {1, {0xa660 }}},
+ { 0xa663, {1, {0xa662 }}},
+ { 0xa665, {1, {0xa664 }}},
+ { 0xa667, {1, {0xa666 }}},
+ { 0xa669, {1, {0xa668 }}},
+ { 0xa66b, {1, {0xa66a }}},
+ { 0xa66d, {1, {0xa66c }}},
+ { 0xa681, {1, {0xa680 }}},
+ { 0xa683, {1, {0xa682 }}},
+ { 0xa685, {1, {0xa684 }}},
+ { 0xa687, {1, {0xa686 }}},
+ { 0xa689, {1, {0xa688 }}},
+ { 0xa68b, {1, {0xa68a }}},
+ { 0xa68d, {1, {0xa68c }}},
+ { 0xa68f, {1, {0xa68e }}},
+ { 0xa691, {1, {0xa690 }}},
+ { 0xa693, {1, {0xa692 }}},
+ { 0xa695, {1, {0xa694 }}},
+ { 0xa697, {1, {0xa696 }}},
+ { 0xa723, {1, {0xa722 }}},
+ { 0xa725, {1, {0xa724 }}},
+ { 0xa727, {1, {0xa726 }}},
+ { 0xa729, {1, {0xa728 }}},
+ { 0xa72b, {1, {0xa72a }}},
+ { 0xa72d, {1, {0xa72c }}},
+ { 0xa72f, {1, {0xa72e }}},
+ { 0xa733, {1, {0xa732 }}},
+ { 0xa735, {1, {0xa734 }}},
+ { 0xa737, {1, {0xa736 }}},
+ { 0xa739, {1, {0xa738 }}},
+ { 0xa73b, {1, {0xa73a }}},
+ { 0xa73d, {1, {0xa73c }}},
+ { 0xa73f, {1, {0xa73e }}},
+ { 0xa741, {1, {0xa740 }}},
+ { 0xa743, {1, {0xa742 }}},
+ { 0xa745, {1, {0xa744 }}},
+ { 0xa747, {1, {0xa746 }}},
+ { 0xa749, {1, {0xa748 }}},
+ { 0xa74b, {1, {0xa74a }}},
+ { 0xa74d, {1, {0xa74c }}},
+ { 0xa74f, {1, {0xa74e }}},
+ { 0xa751, {1, {0xa750 }}},
+ { 0xa753, {1, {0xa752 }}},
+ { 0xa755, {1, {0xa754 }}},
+ { 0xa757, {1, {0xa756 }}},
+ { 0xa759, {1, {0xa758 }}},
+ { 0xa75b, {1, {0xa75a }}},
+ { 0xa75d, {1, {0xa75c }}},
+ { 0xa75f, {1, {0xa75e }}},
+ { 0xa761, {1, {0xa760 }}},
+ { 0xa763, {1, {0xa762 }}},
+ { 0xa765, {1, {0xa764 }}},
+ { 0xa767, {1, {0xa766 }}},
+ { 0xa769, {1, {0xa768 }}},
+ { 0xa76b, {1, {0xa76a }}},
+ { 0xa76d, {1, {0xa76c }}},
+ { 0xa76f, {1, {0xa76e }}},
+ { 0xa77a, {1, {0xa779 }}},
+ { 0xa77c, {1, {0xa77b }}},
+ { 0xa77f, {1, {0xa77e }}},
+ { 0xa781, {1, {0xa780 }}},
+ { 0xa783, {1, {0xa782 }}},
+ { 0xa785, {1, {0xa784 }}},
+ { 0xa787, {1, {0xa786 }}},
+ { 0xa78c, {1, {0xa78b }}},
+ { 0xa791, {1, {0xa790 }}},
+ { 0xa793, {1, {0xa792 }}},
+ { 0xa7a1, {1, {0xa7a0 }}},
+ { 0xa7a3, {1, {0xa7a2 }}},
+ { 0xa7a5, {1, {0xa7a4 }}},
+ { 0xa7a7, {1, {0xa7a6 }}},
+ { 0xa7a9, {1, {0xa7a8 }}},
+ { 0xff41, {1, {0xff21 }}},
+ { 0xff42, {1, {0xff22 }}},
+ { 0xff43, {1, {0xff23 }}},
+ { 0xff44, {1, {0xff24 }}},
+ { 0xff45, {1, {0xff25 }}},
+ { 0xff46, {1, {0xff26 }}},
+ { 0xff47, {1, {0xff27 }}},
+ { 0xff48, {1, {0xff28 }}},
+ { 0xff49, {1, {0xff29 }}},
+ { 0xff4a, {1, {0xff2a }}},
+ { 0xff4b, {1, {0xff2b }}},
+ { 0xff4c, {1, {0xff2c }}},
+ { 0xff4d, {1, {0xff2d }}},
+ { 0xff4e, {1, {0xff2e }}},
+ { 0xff4f, {1, {0xff2f }}},
+ { 0xff50, {1, {0xff30 }}},
+ { 0xff51, {1, {0xff31 }}},
+ { 0xff52, {1, {0xff32 }}},
+ { 0xff53, {1, {0xff33 }}},
+ { 0xff54, {1, {0xff34 }}},
+ { 0xff55, {1, {0xff35 }}},
+ { 0xff56, {1, {0xff36 }}},
+ { 0xff57, {1, {0xff37 }}},
+ { 0xff58, {1, {0xff38 }}},
+ { 0xff59, {1, {0xff39 }}},
+ { 0xff5a, {1, {0xff3a }}},
+ { 0x10428, {1, {0x10400 }}},
+ { 0x10429, {1, {0x10401 }}},
+ { 0x1042a, {1, {0x10402 }}},
+ { 0x1042b, {1, {0x10403 }}},
+ { 0x1042c, {1, {0x10404 }}},
+ { 0x1042d, {1, {0x10405 }}},
+ { 0x1042e, {1, {0x10406 }}},
+ { 0x1042f, {1, {0x10407 }}},
+ { 0x10430, {1, {0x10408 }}},
+ { 0x10431, {1, {0x10409 }}},
+ { 0x10432, {1, {0x1040a }}},
+ { 0x10433, {1, {0x1040b }}},
+ { 0x10434, {1, {0x1040c }}},
+ { 0x10435, {1, {0x1040d }}},
+ { 0x10436, {1, {0x1040e }}},
+ { 0x10437, {1, {0x1040f }}},
+ { 0x10438, {1, {0x10410 }}},
+ { 0x10439, {1, {0x10411 }}},
+ { 0x1043a, {1, {0x10412 }}},
+ { 0x1043b, {1, {0x10413 }}},
+ { 0x1043c, {1, {0x10414 }}},
+ { 0x1043d, {1, {0x10415 }}},
+ { 0x1043e, {1, {0x10416 }}},
+ { 0x1043f, {1, {0x10417 }}},
+ { 0x10440, {1, {0x10418 }}},
+ { 0x10441, {1, {0x10419 }}},
+ { 0x10442, {1, {0x1041a }}},
+ { 0x10443, {1, {0x1041b }}},
+ { 0x10444, {1, {0x1041c }}},
+ { 0x10445, {1, {0x1041d }}},
+ { 0x10446, {1, {0x1041e }}},
+ { 0x10447, {1, {0x1041f }}},
+ { 0x10448, {1, {0x10420 }}},
+ { 0x10449, {1, {0x10421 }}},
+ { 0x1044a, {1, {0x10422 }}},
+ { 0x1044b, {1, {0x10423 }}},
+ { 0x1044c, {1, {0x10424 }}},
+ { 0x1044d, {1, {0x10425 }}},
+ { 0x1044e, {1, {0x10426 }}},
+ { 0x1044f, {1, {0x10427 }}},
};
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -7 -k1,2,3,4,5,6 -F,-1 -c -j1 -i1 -t -T -E -C -H onigenc_unicode_CaseUnfold_12_hash -N onigenc_unicode_CaseUnfold_12_lookup -n */
-
-/* maximum key range = 71, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-/*ARGSUSED*/
-static unsigned int
-onigenc_unicode_CaseUnfold_12_hash(const OnigCodePoint *codes)
-{
- static const unsigned char asso_values[] =
- {
- 3, 58, 54, 57, 56, 16, 8, 2, 43, 82,
- 3, 1, 23, 82, 82, 82, 82, 82, 82, 4,
- 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 52, 51, 50, 49, 48, 47, 46, 45,
- 82, 82, 82, 82, 43, 82, 42, 82, 82, 13,
- 82, 82, 82, 82, 82, 11, 82, 1, 82, 82,
- 14, 82, 1, 82, 82, 31, 3, 82, 82, 30,
- 82, 82, 82, 10, 82, 82, 82, 82, 37, 82,
- 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 37, 15, 36, 35,
- 34, 17, 1, 33, 12, 4, 23, 23, 26, 21,
- 13, 82, 27, 82, 82, 2, 5, 82, 11, 16,
- 82, 15, 82, 82, 23, 82, 8, 82
- };
- return asso_values[bits_at(codes, 5)] + asso_values[bits_at(codes, 4)] + asso_values[bits_at(codes, 3)] + asso_values[bits_at(codes, 2)] + asso_values[bits_at(codes, 1)] + asso_values[bits_at(codes, 0)];
-}
-
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-static const CodePointList2 *
-onigenc_unicode_CaseUnfold_12_lookup(const OnigCodePoint *codes)
-{
- enum
- {
- MIN_CODE_VALUE = 0x61,
- MAX_CODE_VALUE = 0x1f7c,
- TOTAL_KEYWORDS = 59,
- MIN_WORD_LENGTH = 6,
- MAX_WORD_LENGTH = 6,
- MIN_HASH_VALUE = 11,
- MAX_HASH_VALUE = 81
- };
-
- static const short wordlist[] =
- {
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1,
- /*0x1f66,0x03b9*/ 53,
- /*0x1f07,0x03b9*/ 38,
- /*0x1f00,0x03b9*/ 31,
- /*0x0066,0x0066*/ 1,
- /*0x1f74,0x03b9*/ 56,
- /*0x0073,0x0073*/ 6,
- /*0x0066,0x0069*/ 2,
- /*0x1f06,0x03b9*/ 37,
- /*0x0073,0x0074*/ 7,
- /*0x03b9,0x0342*/ 18,
- /*0x03c9,0x03b9*/ 23,
- /*0x03b7,0x03b9*/ 17,
- /*0x0069,0x0307*/ 58,
- /*0x03b1,0x03b9*/ 15,
- /*0x1f61,0x03b9*/ 48,
- /*0x1f05,0x03b9*/ 36,
- /*0x1f65,0x03b9*/ 52,
- /*0x0574,0x0576*/ 29,
- /*0x03c9,0x0342*/ 22,
- /*0x03b7,0x0342*/ 16,
- /*0x057e,0x0576*/ 30,
- /*0x03b1,0x0342*/ 14,
- /*0x1f7c,0x03b9*/ 57,
- /*0x0574,0x0565*/ 26,
- /*0x0079,0x030a*/ 10,
- /*0x0077,0x030a*/ 9,
- /*0x1f70,0x03b9*/ 55,
- /*0x0574,0x056d*/ 28,
- /*0x0066,0x006c*/ 3,
- /*0x0574,0x056b*/ 27,
- /*0x0061,0x02be*/ 0,
- /*0x0068,0x0331*/ 4,
- /*0x1f67,0x03b9*/ 54,
- /*0x1f64,0x03b9*/ 51,
- /*0x1f63,0x03b9*/ 50,
- /*0x1f62,0x03b9*/ 49,
- /*0x1f60,0x03b9*/ 47,
- /*0x03ce,0x03b9*/ 24,
- /*0x03c5,0x0342*/ 21,
- /*0x03c5,0x0313*/ 20,
- /*0x03c1,0x0313*/ 19,
- /*0x02bc,0x006e*/ 11,
- /*0x03ae,0x03b9*/ 13,
- /*0x03ac,0x03b9*/ 12,
- /*0x1f27,0x03b9*/ 46,
- /*0x1f26,0x03b9*/ 45,
- /*0x1f25,0x03b9*/ 44,
- /*0x1f24,0x03b9*/ 43,
- /*0x1f23,0x03b9*/ 42,
- /*0x1f22,0x03b9*/ 41,
- /*0x1f21,0x03b9*/ 40,
- /*0x1f20,0x03b9*/ 39,
- /*0x006a,0x030c*/ 5,
- /*0x1f02,0x03b9*/ 33,
- /*0x0074,0x0308*/ 8,
- /*0x1f04,0x03b9*/ 35,
- /*0x1f03,0x03b9*/ 34,
- /*0x1f01,0x03b9*/ 32,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- /*0x0565,0x0582*/ 25
- };
-
- if (codes[0] <= MAX_CODE_VALUE && codes[0] >= MIN_CODE_VALUE &&
- codes[1] <= MAX_CODE_VALUE && codes[1] >= MIN_CODE_VALUE)
- {
- register int key = onigenc_unicode_CaseUnfold_12_hash(codes);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register short s = wordlist[key];
-
- if (s >= 0 && code2_equal(codes, CaseUnfold_12_Table[s].from))
- return &CaseUnfold_12_Table[s].to;
- }
- }
- return 0;
-}
-
-static const CaseUnfold_13_Type CaseUnfold_13_Table[] = {
-#define CaseUnfold_13 (*(CaseUnfold_13_Type (*)[14])(CaseUnfold_13_Table+0))
- {{0x0066, 0x0066, 0x0069}, {1, {0xfb03}}},
- {{0x0066, 0x0066, 0x006c}, {1, {0xfb04}}},
- {{0x03b1, 0x0342, 0x03b9}, {1, {0x1fb7}}},
- {{0x03b7, 0x0342, 0x03b9}, {1, {0x1fc7}}},
- {{0x03b9, 0x0308, 0x0300}, {1, {0x1fd2}}},
- {{0x03b9, 0x0308, 0x0301}, {2, {0x0390, 0x1fd3}}},
- {{0x03b9, 0x0308, 0x0342}, {1, {0x1fd7}}},
- {{0x03c5, 0x0308, 0x0300}, {1, {0x1fe2}}},
- {{0x03c5, 0x0308, 0x0301}, {2, {0x03b0, 0x1fe3}}},
- {{0x03c5, 0x0308, 0x0342}, {1, {0x1fe7}}},
- {{0x03c5, 0x0313, 0x0300}, {1, {0x1f52}}},
- {{0x03c5, 0x0313, 0x0301}, {1, {0x1f54}}},
- {{0x03c5, 0x0313, 0x0342}, {1, {0x1f56}}},
- {{0x03c9, 0x0342, 0x03b9}, {1, {0x1ff7}}},
+static const CaseUnfold_11_Type CaseUnfold_11_Locale[] = {
+ { 0x0069, {1, {0x0049 }}},
};
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -7 -k1,2,3,4,5,6,7,8,9 -F,-1 -c -j1 -i1 -t -T -E -C -H onigenc_unicode_CaseUnfold_13_hash -N onigenc_unicode_CaseUnfold_13_lookup -n */
-
-/* maximum key range = 20, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-/*ARGSUSED*/
-static unsigned int
-onigenc_unicode_CaseUnfold_13_hash(const OnigCodePoint *codes)
-{
- static const unsigned char asso_values[] =
- {
- 7, 4, 47, 47, 47, 47, 1, 1, 2, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 1,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 11,
- 47, 47, 47, 47, 47, 10, 47, 2, 47, 47,
- 47, 47, 47, 47, 47, 47, 1, 47, 47, 1,
- 47, 47, 47, 9, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 1, 47, 47, 2, 47, 47, 1, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47
- };
- return asso_values[bits_at(codes, 8)] + asso_values[bits_at(codes, 7)] + asso_values[bits_at(codes, 6)] + asso_values[bits_at(codes, 5)] + asso_values[bits_at(codes, 4)] + asso_values[bits_at(codes, 3)] + asso_values[bits_at(codes, 2)] + asso_values[bits_at(codes, 1)] + asso_values[bits_at(codes, 0)];
-}
-
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-static const CodePointList2 *
-onigenc_unicode_CaseUnfold_13_lookup(const OnigCodePoint *codes)
-{
- enum
- {
- MIN_CODE_VALUE = 0x66,
- MAX_CODE_VALUE = 0x3c9,
- TOTAL_KEYWORDS = 14,
- MIN_WORD_LENGTH = 9,
- MAX_WORD_LENGTH = 9,
- MIN_HASH_VALUE = 27,
- MAX_HASH_VALUE = 46
- };
-
- static const short wordlist[] =
- {
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- /*0x03c5,0x0313,0x0342*/ 12,
- /*0x03c5,0x0308,0x0342*/ 9,
- /*0x03b9,0x0308,0x0342*/ 6,
- /*0x03c5,0x0313,0x0301*/ 11,
- /*0x03c5,0x0308,0x0301*/ 8,
- /*0x03b9,0x0308,0x0301*/ 5,
- /*0x03c5,0x0313,0x0300*/ 10,
- /*0x03c5,0x0308,0x0300*/ 7,
- /*0x03b9,0x0308,0x0300*/ 4,
- /*0x03c9,0x0342,0x03b9*/ 13,
- /*0x03b7,0x0342,0x03b9*/ 3,
- /*0x03b1,0x0342,0x03b9*/ 2,
- -1, -1, -1, -1, -1, -1,
- /*0x0066,0x0066,0x006c*/ 1,
- /*0x0066,0x0066,0x0069*/ 0
- };
-
- if (codes[0] <= MAX_CODE_VALUE && codes[0] >= MIN_CODE_VALUE &&
- codes[1] <= MAX_CODE_VALUE && codes[1] >= MIN_CODE_VALUE &&
- codes[2] <= MAX_CODE_VALUE && codes[2] >= MIN_CODE_VALUE)
- {
- register int key = onigenc_unicode_CaseUnfold_13_hash(codes);
+static const CaseUnfold_12_Type CaseUnfold_12[] = {
+ { {0x0061, 0x02be}, {1, {0x1e9a }}},
+ { {0x0066, 0x0066}, {1, {0xfb00 }}},
+ { {0x0066, 0x0069}, {1, {0xfb01 }}},
+ { {0x0066, 0x006c}, {1, {0xfb02 }}},
+ { {0x0068, 0x0331}, {1, {0x1e96 }}},
+ { {0x006a, 0x030c}, {1, {0x01f0 }}},
+ { {0x0073, 0x0073}, {2, {0x00df, 0x1e9e }}},
+ { {0x0073, 0x0074}, {2, {0xfb05, 0xfb06 }}},
+ { {0x0074, 0x0308}, {1, {0x1e97 }}},
+ { {0x0077, 0x030a}, {1, {0x1e98 }}},
+ { {0x0079, 0x030a}, {1, {0x1e99 }}},
+ { {0x02bc, 0x006e}, {1, {0x0149 }}},
+ { {0x03ac, 0x03b9}, {1, {0x1fb4 }}},
+ { {0x03ae, 0x03b9}, {1, {0x1fc4 }}},
+ { {0x03b1, 0x0342}, {1, {0x1fb6 }}},
+ { {0x03b1, 0x03b9}, {2, {0x1fb3, 0x1fbc }}},
+ { {0x03b7, 0x0342}, {1, {0x1fc6 }}},
+ { {0x03b7, 0x03b9}, {2, {0x1fc3, 0x1fcc }}},
+ { {0x03b9, 0x0342}, {1, {0x1fd6 }}},
+ { {0x03c1, 0x0313}, {1, {0x1fe4 }}},
+ { {0x03c5, 0x0313}, {1, {0x1f50 }}},
+ { {0x03c5, 0x0342}, {1, {0x1fe6 }}},
+ { {0x03c9, 0x0342}, {1, {0x1ff6 }}},
+ { {0x03c9, 0x03b9}, {2, {0x1ff3, 0x1ffc }}},
+ { {0x03ce, 0x03b9}, {1, {0x1ff4 }}},
+ { {0x0565, 0x0582}, {1, {0x0587 }}},
+ { {0x0574, 0x0565}, {1, {0xfb14 }}},
+ { {0x0574, 0x056b}, {1, {0xfb15 }}},
+ { {0x0574, 0x056d}, {1, {0xfb17 }}},
+ { {0x0574, 0x0576}, {1, {0xfb13 }}},
+ { {0x057e, 0x0576}, {1, {0xfb16 }}},
+ { {0x1f00, 0x03b9}, {2, {0x1f80, 0x1f88 }}},
+ { {0x1f01, 0x03b9}, {2, {0x1f81, 0x1f89 }}},
+ { {0x1f02, 0x03b9}, {2, {0x1f82, 0x1f8a }}},
+ { {0x1f03, 0x03b9}, {2, {0x1f83, 0x1f8b }}},
+ { {0x1f04, 0x03b9}, {2, {0x1f84, 0x1f8c }}},
+ { {0x1f05, 0x03b9}, {2, {0x1f85, 0x1f8d }}},
+ { {0x1f06, 0x03b9}, {2, {0x1f86, 0x1f8e }}},
+ { {0x1f07, 0x03b9}, {2, {0x1f87, 0x1f8f }}},
+ { {0x1f20, 0x03b9}, {2, {0x1f90, 0x1f98 }}},
+ { {0x1f21, 0x03b9}, {2, {0x1f91, 0x1f99 }}},
+ { {0x1f22, 0x03b9}, {2, {0x1f92, 0x1f9a }}},
+ { {0x1f23, 0x03b9}, {2, {0x1f93, 0x1f9b }}},
+ { {0x1f24, 0x03b9}, {2, {0x1f94, 0x1f9c }}},
+ { {0x1f25, 0x03b9}, {2, {0x1f95, 0x1f9d }}},
+ { {0x1f26, 0x03b9}, {2, {0x1f96, 0x1f9e }}},
+ { {0x1f27, 0x03b9}, {2, {0x1f97, 0x1f9f }}},
+ { {0x1f60, 0x03b9}, {2, {0x1fa0, 0x1fa8 }}},
+ { {0x1f61, 0x03b9}, {2, {0x1fa1, 0x1fa9 }}},
+ { {0x1f62, 0x03b9}, {2, {0x1fa2, 0x1faa }}},
+ { {0x1f63, 0x03b9}, {2, {0x1fa3, 0x1fab }}},
+ { {0x1f64, 0x03b9}, {2, {0x1fa4, 0x1fac }}},
+ { {0x1f65, 0x03b9}, {2, {0x1fa5, 0x1fad }}},
+ { {0x1f66, 0x03b9}, {2, {0x1fa6, 0x1fae }}},
+ { {0x1f67, 0x03b9}, {2, {0x1fa7, 0x1faf }}},
+ { {0x1f70, 0x03b9}, {1, {0x1fb2 }}},
+ { {0x1f74, 0x03b9}, {1, {0x1fc2 }}},
+ { {0x1f7c, 0x03b9}, {1, {0x1ff2 }}},
+};
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register short s = wordlist[key];
+static const CaseUnfold_12_Type CaseUnfold_12_Locale[] = {
+ { {0x0069, 0x0307}, {1, {0x0130 }}},
+};
- if (s >= 0 && code3_equal(codes, CaseUnfold_13_Table[s].from))
- return &CaseUnfold_13_Table[s].to;
- }
- }
- return 0;
-}
+static const CaseUnfold_13_Type CaseUnfold_13[] = {
+ { {0x0066, 0x0066, 0x0069}, {1, {0xfb03 }}},
+ { {0x0066, 0x0066, 0x006c}, {1, {0xfb04 }}},
+ { {0x03b1, 0x0342, 0x03b9}, {1, {0x1fb7 }}},
+ { {0x03b7, 0x0342, 0x03b9}, {1, {0x1fc7 }}},
+ { {0x03b9, 0x0308, 0x0300}, {1, {0x1fd2 }}},
+ { {0x03b9, 0x0308, 0x0301}, {2, {0x0390, 0x1fd3 }}},
+ { {0x03b9, 0x0308, 0x0342}, {1, {0x1fd7 }}},
+ { {0x03c5, 0x0308, 0x0300}, {1, {0x1fe2 }}},
+ { {0x03c5, 0x0308, 0x0301}, {2, {0x03b0, 0x1fe3 }}},
+ { {0x03c5, 0x0308, 0x0342}, {1, {0x1fe7 }}},
+ { {0x03c5, 0x0313, 0x0300}, {1, {0x1f52 }}},
+ { {0x03c5, 0x0313, 0x0301}, {1, {0x1f54 }}},
+ { {0x03c5, 0x0313, 0x0342}, {1, {0x1f56 }}},
+ { {0x03c9, 0x0342, 0x03b9}, {1, {0x1ff7 }}},
+};
+#define FOLD_TABLE_SIZE 1357
+#define UNFOLD1_TABLE_SIZE 1207
+#define UNFOLD2_TABLE_SIZE 88
+#define UNFOLD3_TABLE_SIZE 23
diff --git a/enc/unicode/name2ctype.h b/enc/unicode/name2ctype.h
index 8c193dc4a1..2e80edf525 100644
--- a/enc/unicode/name2ctype.h
+++ b/enc/unicode/name2ctype.h
@@ -1,4 +1,4 @@
-/* C code produced by gperf version 3.0.4 */
+/* C code produced by gperf version 3.0.3 */
/* Command-line: gperf -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p */
#ifndef USE_UNICODE_PROPERTIES
/* Computed positions: -k'1,3' */
@@ -44,7 +44,7 @@ static const OnigCodePoint CR_NEWLINE[] = {
/* 'Alpha': [[:Alpha:]] */
static const OnigCodePoint CR_Alpha[] = {
- 617,
+ 540,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -61,14 +61,13 @@ static const OnigCodePoint CR_Alpha[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -96,13 +95,17 @@ static const OnigCodePoint CR_Alpha[] = {
0x0800, 0x0817,
0x081a, 0x082c,
0x0840, 0x0858,
- 0x08a0, 0x08b4,
- 0x08e3, 0x08e9,
- 0x08f0, 0x093b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
0x093d, 0x094c,
0x094e, 0x0950,
0x0955, 0x0963,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -144,7 +147,6 @@ static const OnigCodePoint CR_Alpha[] = {
0x0acb, 0x0acc,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -174,18 +176,19 @@ static const OnigCodePoint CR_Alpha[] = {
0x0bca, 0x0bcc,
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -198,7 +201,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x0cde, 0x0cde,
0x0ce0, 0x0ce3,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -207,7 +210,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x0d4a, 0x0d4c,
0x0d4e, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d7a, 0x0d7f,
0x0d82, 0x0d83,
0x0d85, 0x0d96,
@@ -275,13 +278,12 @@ static const OnigCodePoint CR_Alpha[] = {
0x1318, 0x135a,
0x135f, 0x135f,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1713,
0x1720, 0x1733,
@@ -296,7 +298,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x1938,
0x1950, 0x196d,
@@ -321,7 +323,6 @@ static const OnigCodePoint CR_Alpha[] = {
0x1cee, 0x1cf3,
0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
- 0x1de7, 0x1df4,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -393,7 +394,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
@@ -401,12 +402,14 @@ static const OnigCodePoint CR_Alpha[] = {
0xa62a, 0xa62b,
0xa640, 0xa66e,
0xa674, 0xa67b,
- 0xa67f, 0xa6ef,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa801,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa827,
@@ -414,21 +417,17 @@ static const OnigCodePoint CR_Alpha[] = {
0xa880, 0xa8c3,
0xa8f2, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa90a, 0xa92a,
0xa930, 0xa952,
0xa960, 0xa97c,
0xa980, 0xa9b2,
0xa9b4, 0xa9bf,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaabe,
+ 0xaa80, 0xaabe,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
@@ -439,9 +438,7 @@ static const OnigCodePoint CR_Alpha[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabea,
+ 0xabc0, 0xabea,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
@@ -479,29 +476,19 @@ static const OnigCodePoint CR_Alpha[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -512,84 +499,25 @@ static const OnigCodePoint CR_Alpha[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11000, 0x11045,
0x11082, 0x110b8,
0x110d0, 0x110e8,
0x11100, 0x11132,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11180, 0x111bf,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x11234,
- 0x11237, 0x11237,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112e8,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134c,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11480, 0x114c1,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115b5,
- 0x115b8, 0x115be,
- 0x115d8, 0x115dd,
- 0x11600, 0x1163e,
- 0x11640, 0x11640,
- 0x11644, 0x11644,
0x11680, 0x116b5,
- 0x11700, 0x11719,
- 0x1171d, 0x1172a,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9e, 0x1bc9e,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -620,7 +548,6 @@ static const OnigCodePoint CR_Alpha[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -654,23 +581,20 @@ static const OnigCodePoint CR_Alpha[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_Alpha */
/* 'Blank': [[:Blank:]] */
static const OnigCodePoint CR_Blank[] = {
- 8,
+ 9,
0x0009, 0x0009,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x202f, 0x202f,
0x205f, 0x205f,
@@ -686,7 +610,7 @@ static const OnigCodePoint CR_Cntrl[] = {
/* 'Digit': [[:Digit:]] */
static const OnigCodePoint CR_Digit[] = {
- 51,
+ 42,
0x0030, 0x0039,
0x0660, 0x0669,
0x06f0, 0x06f9,
@@ -700,7 +624,6 @@ static const OnigCodePoint CR_Digit[] = {
0x0c66, 0x0c6f,
0x0ce6, 0x0cef,
0x0d66, 0x0d6f,
- 0x0de6, 0x0def,
0x0e50, 0x0e59,
0x0ed0, 0x0ed9,
0x0f20, 0x0f29,
@@ -720,7 +643,6 @@ static const OnigCodePoint CR_Digit[] = {
0xa8d0, 0xa8d9,
0xa900, 0xa909,
0xa9d0, 0xa9d9,
- 0xa9f0, 0xa9f9,
0xaa50, 0xaa59,
0xabf0, 0xabf9,
0xff10, 0xff19,
@@ -729,36 +651,30 @@ static const OnigCodePoint CR_Digit[] = {
0x110f0, 0x110f9,
0x11136, 0x1113f,
0x111d0, 0x111d9,
- 0x112f0, 0x112f9,
- 0x114d0, 0x114d9,
- 0x11650, 0x11659,
0x116c0, 0x116c9,
- 0x11730, 0x11739,
- 0x118e0, 0x118e9,
- 0x16a60, 0x16a69,
- 0x16b50, 0x16b59,
0x1d7ce, 0x1d7ff,
}; /* CR_Digit */
/* 'Graph': [[:Graph:]] */
static const OnigCodePoint CR_Graph[] = {
- 618,
+ 544,
0x0021, 0x007e,
0x00a1, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x052f,
+ 0x03a3, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x061c,
+ 0x0600, 0x0604,
+ 0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -767,8 +683,12 @@ static const OnigCodePoint CR_Graph[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0983,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -811,7 +731,6 @@ static const OnigCodePoint CR_Graph[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0af1,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -842,20 +761,21 @@ static const OnigCodePoint CR_Graph[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -869,7 +789,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -877,7 +797,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d75,
0x0d79, 0x0d7f,
0x0d82, 0x0d83,
@@ -890,7 +810,6 @@ static const OnigCodePoint CR_Graph[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -939,11 +858,10 @@ static const OnigCodePoint CR_Graph[] = {
0x1318, 0x135a,
0x135d, 0x137c,
0x1380, 0x1399,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1400, 0x167f,
0x1681, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -954,12 +872,12 @@ static const OnigCodePoint CR_Graph[] = {
0x1780, 0x17dd,
0x17e0, 0x17e9,
0x17f0, 0x17f9,
- 0x1800, 0x180e,
+ 0x1800, 0x180d,
0x1810, 0x1819,
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -974,7 +892,6 @@ static const OnigCodePoint CR_Graph[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -983,8 +900,7 @@ static const OnigCodePoint CR_Graph[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -1005,21 +921,18 @@ static const OnigCodePoint CR_Graph[] = {
0x202a, 0x202e,
0x2030, 0x205e,
0x2060, 0x2064,
- 0x2066, 0x2071,
+ 0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20be,
+ 0x20a0, 0x20b9,
0x20d0, 0x20f0,
- 0x2100, 0x218b,
- 0x2190, 0x23fa,
+ 0x2100, 0x2189,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -1037,7 +950,7 @@ static const OnigCodePoint CR_Graph[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -1052,36 +965,38 @@ static const OnigCodePoint CR_Graph[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fd5,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa6f7,
- 0xa700, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa82b,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
+ 0xa700, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fd,
+ 0xa8e0, 0xa8fb,
0xa900, 0xa953,
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
+ 0xaa5c, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab65,
- 0xab70, 0xabed,
+ 0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -1101,7 +1016,8 @@ static const OnigCodePoint CR_Graph[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe52,
+ 0xfe20, 0xfe26,
+ 0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
0xfe70, 0xfe74,
@@ -1124,43 +1040,32 @@ static const OnigCodePoint CR_Graph[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
- 0x108fb, 0x1091b,
+ 0x10857, 0x1085f,
+ 0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
0x10980, 0x109b7,
- 0x109bc, 0x109cf,
- 0x109d2, 0x10a03,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
0x10a15, 0x10a17,
@@ -1168,98 +1073,36 @@ static const OnigCodePoint CR_Graph[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x10cfa, 0x10cff,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x110c1,
+ 0x11080, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
- 0x11150, 0x11176,
- 0x11180, 0x111cd,
- 0x111d0, 0x111df,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a9,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115dd,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x1173f,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
- 0x1d129, 0x1d1e8,
+ 0x1d129, 0x1d1dd,
0x1d200, 0x1d245,
0x1d300, 0x1d356,
0x1d360, 0x1d371,
@@ -1283,11 +1126,7 @@ static const OnigCodePoint CR_Graph[] = {
0x1d54a, 0x1d550,
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1da8b,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
+ 0x1d7ce, 0x1d7ff,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -1325,10 +1164,10 @@ static const OnigCodePoint CR_Graph[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -1336,25 +1175,27 @@ static const OnigCodePoint CR_Graph[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
@@ -1365,7 +1206,7 @@ static const OnigCodePoint CR_Graph[] = {
/* 'Lower': [[:Lower:]] */
static const OnigCodePoint CR_Lower[] = {
- 637,
+ 618,
0x0061, 0x007a,
0x00aa, 0x00aa,
0x00b5, 0x00b5,
@@ -1636,12 +1477,7 @@ static const OnigCodePoint CR_Lower[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
- 0x13f8, 0x13fd,
0x1d00, 0x1dbf,
0x1e01, 0x1e01,
0x1e03, 0x1e03,
@@ -1902,8 +1738,6 @@ static const OnigCodePoint CR_Lower[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69d,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -1952,29 +1786,17 @@ static const OnigCodePoint CR_Lower[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
- 0xa793, 0xa795,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
0xa7a7, 0xa7a7,
0xa7a9, 0xa7a9,
- 0xa7b5, 0xa7b5,
- 0xa7b7, 0xa7b7,
0xa7f8, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabbf,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x10cc0, 0x10cf2,
- 0x118c0, 0x118df,
0x1d41a, 0x1d433,
0x1d44e, 0x1d454,
0x1d456, 0x1d467,
@@ -2007,23 +1829,24 @@ static const OnigCodePoint CR_Lower[] = {
/* 'Print': [[:Print:]] */
static const OnigCodePoint CR_Print[] = {
- 615,
+ 541,
0x0020, 0x007e,
0x00a0, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x052f,
+ 0x03a3, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x061c,
+ 0x0600, 0x0604,
+ 0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -2032,8 +1855,12 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0983,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -2076,7 +1903,6 @@ static const OnigCodePoint CR_Print[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0af1,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -2107,20 +1933,21 @@ static const OnigCodePoint CR_Print[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -2134,7 +1961,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -2142,7 +1969,7 @@ static const OnigCodePoint CR_Print[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d75,
0x0d79, 0x0d7f,
0x0d82, 0x0d83,
@@ -2155,7 +1982,6 @@ static const OnigCodePoint CR_Print[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -2204,10 +2030,9 @@ static const OnigCodePoint CR_Print[] = {
0x1318, 0x135a,
0x135d, 0x137c,
0x1380, 0x1399,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -2223,7 +2048,7 @@ static const OnigCodePoint CR_Print[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -2238,7 +2063,6 @@ static const OnigCodePoint CR_Print[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -2247,8 +2071,7 @@ static const OnigCodePoint CR_Print[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -2267,21 +2090,18 @@ static const OnigCodePoint CR_Print[] = {
0x1ff6, 0x1ffe,
0x2000, 0x2027,
0x202a, 0x2064,
- 0x2066, 0x2071,
+ 0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20be,
+ 0x20a0, 0x20b9,
0x20d0, 0x20f0,
- 0x2100, 0x218b,
- 0x2190, 0x23fa,
+ 0x2100, 0x2189,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -2299,7 +2119,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -2314,36 +2134,38 @@ static const OnigCodePoint CR_Print[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fd5,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa6f7,
- 0xa700, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa82b,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
+ 0xa700, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fd,
+ 0xa8e0, 0xa8fb,
0xa900, 0xa953,
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
+ 0xaa5c, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab65,
- 0xab70, 0xabed,
+ 0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -2363,7 +2185,8 @@ static const OnigCodePoint CR_Print[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe52,
+ 0xfe20, 0xfe26,
+ 0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
0xfe70, 0xfe74,
@@ -2386,43 +2209,32 @@ static const OnigCodePoint CR_Print[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
- 0x108fb, 0x1091b,
+ 0x10857, 0x1085f,
+ 0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
0x10980, 0x109b7,
- 0x109bc, 0x109cf,
- 0x109d2, 0x10a03,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
0x10a15, 0x10a17,
@@ -2430,98 +2242,36 @@ static const OnigCodePoint CR_Print[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x10cfa, 0x10cff,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x110c1,
+ 0x11080, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
- 0x11150, 0x11176,
- 0x11180, 0x111cd,
- 0x111d0, 0x111df,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a9,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115dd,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x1173f,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
- 0x1d129, 0x1d1e8,
+ 0x1d129, 0x1d1dd,
0x1d200, 0x1d245,
0x1d300, 0x1d356,
0x1d360, 0x1d371,
@@ -2545,11 +2295,7 @@ static const OnigCodePoint CR_Print[] = {
0x1d54a, 0x1d550,
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1da8b,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
+ 0x1d7ce, 0x1d7ff,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -2587,10 +2333,10 @@ static const OnigCodePoint CR_Print[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -2598,25 +2344,27 @@ static const OnigCodePoint CR_Print[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
@@ -2627,7 +2375,7 @@ static const OnigCodePoint CR_Print[] = {
/* 'Punct': [[:Punct:]] */
static const OnigCodePoint CR_Punct[] = {
- 161,
+ 140,
0x0021, 0x0023,
0x0025, 0x002a,
0x002c, 0x002f,
@@ -2701,7 +2449,6 @@ static const OnigCodePoint CR_Punct[] = {
0x2053, 0x205e,
0x207d, 0x207e,
0x208d, 0x208e,
- 0x2308, 0x230b,
0x2329, 0x232a,
0x2768, 0x2775,
0x27c5, 0x27c6,
@@ -2713,7 +2460,7 @@ static const OnigCodePoint CR_Punct[] = {
0x2cfe, 0x2cff,
0x2d70, 0x2d70,
0x2e00, 0x2e2e,
- 0x2e30, 0x2e42,
+ 0x2e30, 0x2e3b,
0x3001, 0x3003,
0x3008, 0x3011,
0x3014, 0x301f,
@@ -2729,7 +2476,6 @@ static const OnigCodePoint CR_Punct[] = {
0xa874, 0xa877,
0xa8ce, 0xa8cf,
0xa8f8, 0xa8fa,
- 0xa8fc, 0xa8fc,
0xa92e, 0xa92f,
0xa95f, 0xa95f,
0xa9c1, 0xa9cd,
@@ -2758,47 +2504,29 @@ static const OnigCodePoint CR_Punct[] = {
0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
- 0x1056f, 0x1056f,
0x10857, 0x10857,
0x1091f, 0x1091f,
0x1093f, 0x1093f,
0x10a50, 0x10a58,
0x10a7f, 0x10a7f,
- 0x10af0, 0x10af6,
0x10b39, 0x10b3f,
- 0x10b99, 0x10b9c,
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
0x11140, 0x11143,
- 0x11174, 0x11175,
- 0x111c5, 0x111c9,
- 0x111cd, 0x111cd,
- 0x111db, 0x111db,
- 0x111dd, 0x111df,
- 0x11238, 0x1123d,
- 0x112a9, 0x112a9,
- 0x114c6, 0x114c6,
- 0x115c1, 0x115d7,
- 0x11641, 0x11643,
- 0x1173c, 0x1173e,
- 0x12470, 0x12474,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b3b,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
- 0x1da87, 0x1da8b,
+ 0x111c5, 0x111c8,
+ 0x12470, 0x12473,
}; /* CR_Punct */
/* 'Space': [[:Space:]] */
static const OnigCodePoint CR_Space[] = {
- 10,
+ 11,
0x0009, 0x000d,
0x0020, 0x0020,
0x0085, 0x0085,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x2028, 0x2029,
0x202f, 0x202f,
@@ -2808,7 +2536,7 @@ static const OnigCodePoint CR_Space[] = {
/* 'Upper': [[:Upper:]] */
static const OnigCodePoint CR_Upper[] = {
- 630,
+ 610,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2956,7 +2684,6 @@ static const OnigCodePoint CR_Upper[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -3076,15 +2803,10 @@ static const OnigCodePoint CR_Upper[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13a0, 0x13f5,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -3337,8 +3059,6 @@ static const OnigCodePoint CR_Upper[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -3388,23 +3108,14 @@ static const OnigCodePoint CR_Upper[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b4,
- 0xa7b6, 0xa7b6,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x10c80, 0x10cb2,
- 0x118a0, 0x118bf,
0x1d400, 0x1d419,
0x1d434, 0x1d44d,
0x1d468, 0x1d481,
@@ -3436,9 +3147,6 @@ static const OnigCodePoint CR_Upper[] = {
0x1d756, 0x1d76e,
0x1d790, 0x1d7a8,
0x1d7ca, 0x1d7ca,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Upper */
/* 'XDigit': [[:XDigit:]] */
@@ -3451,7 +3159,7 @@ static const OnigCodePoint CR_XDigit[] = {
/* 'Word': [[:Word:]] */
static const OnigCodePoint CR_Word[] = {
- 654,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -3469,14 +3177,13 @@ static const OnigCodePoint CR_Word[] = {
0x0300, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x0483, 0x052f,
+ 0x0483, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -3500,10 +3207,14 @@ static const OnigCodePoint CR_Word[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0963,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -3546,7 +3257,6 @@ static const OnigCodePoint CR_Word[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0aef,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -3578,19 +3288,20 @@ static const OnigCodePoint CR_Word[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -3604,7 +3315,7 @@ static const OnigCodePoint CR_Word[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -3612,7 +3323,7 @@ static const OnigCodePoint CR_Word[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d6f,
0x0d7a, 0x0d7f,
0x0d82, 0x0d83,
@@ -3625,7 +3336,6 @@ static const OnigCodePoint CR_Word[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -3684,13 +3394,12 @@ static const OnigCodePoint CR_Word[] = {
0x1318, 0x135a,
0x135d, 0x135f,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -3707,7 +3416,7 @@ static const OnigCodePoint CR_Word[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -3721,7 +3430,6 @@ static const OnigCodePoint CR_Word[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -3731,8 +3439,7 @@ static const OnigCodePoint CR_Word[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -3807,36 +3514,37 @@ static const OnigCodePoint CR_Word[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa672,
0xa674, 0xa67d,
- 0xa67f, 0xa6f1,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa827,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
0xa8e0, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa900, 0xa92d,
0xa930, 0xa953,
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaac2,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -3845,9 +3553,7 @@ static const OnigCodePoint CR_Word[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabea,
+ 0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -3869,7 +3575,7 @@ static const OnigCodePoint CR_Word[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfb,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe70, 0xfe74,
@@ -3894,31 +3600,20 @@ static const OnigCodePoint CR_Word[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102e0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -3931,94 +3626,29 @@ static const OnigCodePoint CR_Word[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae6,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11000, 0x11046,
0x11066, 0x1106f,
- 0x1107f, 0x110ba,
+ 0x11080, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
- 0x11150, 0x11173,
- 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111ca, 0x111cc,
- 0x111d0, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x11237,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c0,
- 0x115d8, 0x115dd,
- 0x11600, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x11739,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af4,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -4056,14 +3686,6 @@ static const OnigCodePoint CR_Word[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -4097,20 +3719,16 @@ static const OnigCodePoint CR_Word[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
0xe0100, 0xe01ef,
}; /* CR_Word */
/* 'Alnum': [[:Alnum:]] */
static const OnigCodePoint CR_Alnum[] = {
- 648,
+ 566,
0x0030, 0x0039,
0x0041, 0x005a,
0x0061, 0x007a,
@@ -4128,14 +3746,13 @@ static const OnigCodePoint CR_Alnum[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -4162,14 +3779,18 @@ static const OnigCodePoint CR_Alnum[] = {
0x0800, 0x0817,
0x081a, 0x082c,
0x0840, 0x0858,
- 0x08a0, 0x08b4,
- 0x08e3, 0x08e9,
- 0x08f0, 0x093b,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
0x093d, 0x094c,
0x094e, 0x0950,
0x0955, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -4212,7 +3833,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0aef,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -4244,19 +3864,20 @@ static const OnigCodePoint CR_Alnum[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -4270,7 +3891,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -4279,7 +3900,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0d4a, 0x0d4c,
0x0d4e, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d6f,
0x0d7a, 0x0d7f,
0x0d82, 0x0d83,
@@ -4291,7 +3912,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e46,
@@ -4353,13 +3973,12 @@ static const OnigCodePoint CR_Alnum[] = {
0x1318, 0x135a,
0x135f, 0x135f,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1713,
0x1720, 0x1733,
@@ -4376,7 +3995,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x1938,
0x1946, 0x196d,
@@ -4404,7 +4023,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x1cee, 0x1cf3,
0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
- 0x1de7, 0x1df4,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -4476,19 +4094,21 @@ static const OnigCodePoint CR_Alnum[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66e,
0xa674, 0xa67b,
- 0xa67f, 0xa6ef,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa801,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa827,
@@ -4497,21 +4117,18 @@ static const OnigCodePoint CR_Alnum[] = {
0xa8d0, 0xa8d9,
0xa8f2, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa900, 0xa92a,
0xa930, 0xa952,
0xa960, 0xa97c,
0xa980, 0xa9b2,
0xa9b4, 0xa9bf,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaabe,
+ 0xaa80, 0xaabe,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
@@ -4522,9 +4139,7 @@ static const OnigCodePoint CR_Alnum[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabea,
+ 0xabc0, 0xabea,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -4564,30 +4179,20 @@ static const OnigCodePoint CR_Alnum[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -4598,16 +4203,10 @@ static const OnigCodePoint CR_Alnum[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11000, 0x11045,
0x11066, 0x1106f,
0x11082, 0x110b8,
@@ -4615,77 +4214,19 @@ static const OnigCodePoint CR_Alnum[] = {
0x110f0, 0x110f9,
0x11100, 0x11132,
0x11136, 0x1113f,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11180, 0x111bf,
0x111c1, 0x111c4,
- 0x111d0, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x11234,
- 0x11237, 0x11237,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112e8,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134c,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11480, 0x114c1,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115be,
- 0x115d8, 0x115dd,
- 0x11600, 0x1163e,
- 0x11640, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b5,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172a,
- 0x11730, 0x11739,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9e, 0x1bc9e,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -4717,7 +4258,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -4751,13 +4291,9 @@ static const OnigCodePoint CR_Alnum[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_Alnum */
@@ -4776,22 +4312,23 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 613,
+ 539,
0x0000, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x052f,
+ 0x03a3, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x061c,
+ 0x0600, 0x0604,
+ 0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -4800,8 +4337,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0983,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -4844,7 +4385,6 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0af1,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -4875,20 +4415,21 @@ static const OnigCodePoint CR_Assigned[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -4902,7 +4443,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -4910,7 +4451,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d75,
0x0d79, 0x0d7f,
0x0d82, 0x0d83,
@@ -4923,7 +4464,6 @@ static const OnigCodePoint CR_Assigned[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -4972,10 +4512,9 @@ static const OnigCodePoint CR_Assigned[] = {
0x1318, 0x135a,
0x135d, 0x137c,
0x1380, 0x1399,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -4991,7 +4530,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -5006,7 +4545,6 @@ static const OnigCodePoint CR_Assigned[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -5015,8 +4553,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -5034,21 +4571,18 @@ static const OnigCodePoint CR_Assigned[] = {
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
0x2000, 0x2064,
- 0x2066, 0x2071,
+ 0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20be,
+ 0x20a0, 0x20b9,
0x20d0, 0x20f0,
- 0x2100, 0x218b,
- 0x2190, 0x23fa,
+ 0x2100, 0x2189,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -5066,7 +4600,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -5081,36 +4615,38 @@ static const OnigCodePoint CR_Assigned[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fd5,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa6f7,
- 0xa700, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa82b,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa6f7,
+ 0xa700, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fd,
+ 0xa8e0, 0xa8fb,
0xa900, 0xa953,
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
+ 0xaa5c, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab65,
- 0xab70, 0xabed,
+ 0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -5130,7 +4666,8 @@ static const OnigCodePoint CR_Assigned[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe52,
+ 0xfe20, 0xfe26,
+ 0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
0xfe70, 0xfe74,
@@ -5153,43 +4690,32 @@ static const OnigCodePoint CR_Assigned[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
- 0x108fb, 0x1091b,
+ 0x10857, 0x1085f,
+ 0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
0x10980, 0x109b7,
- 0x109bc, 0x109cf,
- 0x109d2, 0x10a03,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a13,
0x10a15, 0x10a17,
@@ -5197,98 +4723,36 @@ static const OnigCodePoint CR_Assigned[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x10cfa, 0x10cff,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x110c1,
+ 0x11080, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
- 0x11150, 0x11176,
- 0x11180, 0x111cd,
- 0x111d0, 0x111df,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a9,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115dd,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x1173f,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
- 0x1d129, 0x1d1e8,
+ 0x1d129, 0x1d1dd,
0x1d200, 0x1d245,
0x1d300, 0x1d356,
0x1d360, 0x1d371,
@@ -5312,11 +4776,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1d54a, 0x1d550,
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1da8b,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
+ 0x1d7ce, 0x1d7ff,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -5354,10 +4814,10 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -5365,25 +4825,27 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
@@ -5394,20 +4856,20 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 616,
+ 541,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
0x0378, 0x0379,
- 0x0380, 0x0383,
+ 0x037f, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0530, 0x0530,
+ 0x0528, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058c,
+ 0x058b, 0x058e,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
@@ -5422,7 +4884,11 @@ static const OnigCodePoint CR_C[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08b5, 0x08e2,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -5465,8 +4931,7 @@ static const OnigCodePoint CR_C[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af2, 0x0af8,
- 0x0afa, 0x0b00,
+ 0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
0x0b11, 0x0b12,
@@ -5496,20 +4961,21 @@ static const OnigCodePoint CR_C[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0bff,
+ 0x0bfb, 0x0c00,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
0x0c4e, 0x0c54,
0x0c57, 0x0c57,
- 0x0c5b, 0x0c5f,
+ 0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c80,
+ 0x0c80, 0x0c81,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -5523,7 +4989,7 @@ static const OnigCodePoint CR_C[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d00,
+ 0x0cf3, 0x0d01,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -5531,7 +4997,7 @@ static const OnigCodePoint CR_C[] = {
0x0d45, 0x0d45,
0x0d49, 0x0d49,
0x0d4f, 0x0d56,
- 0x0d58, 0x0d5e,
+ 0x0d58, 0x0d5f,
0x0d64, 0x0d65,
0x0d76, 0x0d78,
0x0d80, 0x0d81,
@@ -5544,8 +5010,7 @@ static const OnigCodePoint CR_C[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0de5,
- 0x0df0, 0x0df1,
+ 0x0de0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -5594,10 +5059,9 @@ static const OnigCodePoint CR_C[] = {
0x135b, 0x135c,
0x137d, 0x137f,
0x139a, 0x139f,
- 0x13f6, 0x13f7,
- 0x13fe, 0x13ff,
+ 0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f9, 0x16ff,
+ 0x16f1, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -5608,12 +5072,12 @@ static const OnigCodePoint CR_C[] = {
0x17de, 0x17df,
0x17ea, 0x17ef,
0x17fa, 0x17ff,
- 0x180e, 0x180f,
+ 0x180f, 0x180f,
0x181a, 0x181f,
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191f, 0x191f,
+ 0x191d, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -5627,8 +5091,7 @@ static const OnigCodePoint CR_C[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aaf,
- 0x1abf, 0x1aff,
+ 0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -5636,9 +5099,8 @@ static const OnigCodePoint CR_C[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cf7,
- 0x1cfa, 0x1cff,
- 0x1df6, 0x1dfb,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -5661,18 +5123,15 @@ static const OnigCodePoint CR_C[] = {
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20bf, 0x20cf,
+ 0x20ba, 0x20cf,
0x20f1, 0x20ff,
- 0x218c, 0x218f,
- 0x23fb, 0x23ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2b74, 0x2b75,
- 0x2b96, 0x2b97,
- 0x2bba, 0x2bbc,
- 0x2bc9, 0x2bc9,
- 0x2bd2, 0x2beb,
- 0x2bf0, 0x2bff,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -5690,7 +5149,7 @@ static const OnigCodePoint CR_C[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e43, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -5705,35 +5164,37 @@ static const OnigCodePoint CR_C[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fd6, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
- 0xa7ae, 0xa7af,
- 0xa7b8, 0xa7f6,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
0xa8c5, 0xa8cd,
0xa8da, 0xa8df,
- 0xa8fe, 0xa8ff,
+ 0xa8fc, 0xa8ff,
0xa954, 0xa95e,
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9ff, 0xa9ff,
+ 0xa9e0, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xab2f,
- 0xab66, 0xab6f,
+ 0xab2f, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -5754,6 +5215,7 @@ static const OnigCodePoint CR_C[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -5776,42 +5238,31 @@ static const OnigCodePoint CR_C[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018d, 0x1018f,
- 0x1019c, 0x1019f,
- 0x101a1, 0x101cf,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102df,
- 0x102fc, 0x102ff,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
0x10324, 0x1032f,
- 0x1034b, 0x1034f,
- 0x1037b, 0x1037f,
+ 0x1034b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x104ff,
- 0x10528, 0x1052f,
- 0x10564, 0x1056e,
- 0x10570, 0x105ff,
- 0x10737, 0x1073f,
- 0x10756, 0x1075f,
- 0x10768, 0x107ff,
+ 0x104aa, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x1089f, 0x108a6,
- 0x108b0, 0x108df,
- 0x108f3, 0x108f3,
- 0x108f6, 0x108fa,
+ 0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
- 0x109b8, 0x109bb,
- 0x109d0, 0x109d1,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -5820,100 +5271,38 @@ static const OnigCodePoint CR_C[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10aa0, 0x10abf,
- 0x10ae7, 0x10aea,
- 0x10af7, 0x10aff,
+ 0x10a80, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b92, 0x10b98,
- 0x10b9d, 0x10ba8,
- 0x10bb0, 0x10bff,
- 0x10c49, 0x10c7f,
- 0x10cb3, 0x10cbf,
- 0x10cf3, 0x10cf9,
- 0x10d00, 0x10e5f,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107e,
+ 0x11070, 0x1107f,
0x110bd, 0x110bd,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1114f,
- 0x11177, 0x1117f,
- 0x111ce, 0x111cf,
- 0x111e0, 0x111e0,
- 0x111f5, 0x111ff,
- 0x11212, 0x11212,
- 0x1123e, 0x1127f,
- 0x11287, 0x11287,
- 0x11289, 0x11289,
- 0x1128e, 0x1128e,
- 0x1129e, 0x1129e,
- 0x112aa, 0x112af,
- 0x112eb, 0x112ef,
- 0x112fa, 0x112ff,
- 0x11304, 0x11304,
- 0x1130d, 0x1130e,
- 0x11311, 0x11312,
- 0x11329, 0x11329,
- 0x11331, 0x11331,
- 0x11334, 0x11334,
- 0x1133a, 0x1133b,
- 0x11345, 0x11346,
- 0x11349, 0x1134a,
- 0x1134e, 0x1134f,
- 0x11351, 0x11356,
- 0x11358, 0x1135c,
- 0x11364, 0x11365,
- 0x1136d, 0x1136f,
- 0x11375, 0x1147f,
- 0x114c8, 0x114cf,
- 0x114da, 0x1157f,
- 0x115b6, 0x115b7,
- 0x115de, 0x115ff,
- 0x11645, 0x1164f,
- 0x1165a, 0x1167f,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
0x116b8, 0x116bf,
- 0x116ca, 0x116ff,
- 0x1171a, 0x1171c,
- 0x1172c, 0x1172f,
- 0x11740, 0x1189f,
- 0x118f3, 0x118fe,
- 0x11900, 0x11abf,
- 0x11af9, 0x11fff,
- 0x1239a, 0x123ff,
- 0x1246f, 0x1246f,
- 0x12475, 0x1247f,
- 0x12544, 0x12fff,
- 0x1342f, 0x143ff,
- 0x14647, 0x167ff,
- 0x16a39, 0x16a3f,
- 0x16a5f, 0x16a5f,
- 0x16a6a, 0x16a6d,
- 0x16a70, 0x16acf,
- 0x16aee, 0x16aef,
- 0x16af6, 0x16aff,
- 0x16b46, 0x16b4f,
- 0x16b5a, 0x16b5a,
- 0x16b62, 0x16b62,
- 0x16b78, 0x16b7c,
- 0x16b90, 0x16eff,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1bbff,
- 0x1bc6b, 0x1bc6f,
- 0x1bc7d, 0x1bc7f,
- 0x1bc89, 0x1bc8f,
- 0x1bc9a, 0x1bc9b,
- 0x1bca0, 0x1cfff,
+ 0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d173, 0x1d17a,
- 0x1d1e9, 0x1d1ff,
+ 0x1d1de, 0x1d1ff,
0x1d246, 0x1d2ff,
0x1d357, 0x1d35f,
0x1d372, 0x1d3ff,
@@ -5937,11 +5326,7 @@ static const OnigCodePoint CR_C[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1da8c, 0x1da9a,
- 0x1daa0, 0x1daa0,
- 0x1dab0, 0x1e7ff,
- 0x1e8c5, 0x1e8c6,
- 0x1e8d7, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -5979,10 +5364,10 @@ static const OnigCodePoint CR_C[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0c0, 0x1f0c0,
+ 0x1f0bf, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0f6, 0x1f0ff,
- 0x1f10d, 0x1f10f,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -5990,25 +5375,27 @@ static const OnigCodePoint CR_C[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 0x1f57a, 0x1f57a,
- 0x1f5a4, 0x1f5a4,
- 0x1f6d1, 0x1f6df,
- 0x1f6ed, 0x1f6ef,
- 0x1f6f4, 0x1f6ff,
- 0x1f774, 0x1f77f,
- 0x1f7d5, 0x1f7ff,
- 0x1f80c, 0x1f80f,
- 0x1f848, 0x1f84f,
- 0x1f85a, 0x1f85f,
- 0x1f888, 0x1f88f,
- 0x1f8ae, 0x1f90f,
- 0x1f919, 0x1f97f,
- 0x1f985, 0x1f9bf,
- 0x1f9c1, 0x1ffff,
+ 0x1f321, 0x1f32f,
+ 0x1f336, 0x1f336,
+ 0x1f37d, 0x1f37f,
+ 0x1f394, 0x1f39f,
+ 0x1f3c5, 0x1f3c5,
+ 0x1f3cb, 0x1f3df,
+ 0x1f3f1, 0x1f3ff,
+ 0x1f43f, 0x1f43f,
+ 0x1f441, 0x1f441,
+ 0x1f4f8, 0x1f4f8,
+ 0x1f4fd, 0x1f4ff,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
+ 0x1f568, 0x1f5fa,
+ 0x1f641, 0x1f644,
+ 0x1f650, 0x1f67f,
+ 0x1f6c6, 0x1f6ff,
+ 0x1f774, 0x1ffff,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
- 0x2b81e, 0x2b81f,
- 0x2cea2, 0x2f7ff,
+ 0x2b81e, 0x2f7ff,
0x2fa1e, 0xe00ff,
0xe01f0, 0x10ffff,
}; /* CR_C */
@@ -6018,21 +5405,18 @@ static const OnigCodePoint CR_C[] = {
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 17,
+ 14,
0x00ad, 0x00ad,
- 0x0600, 0x0605,
- 0x061c, 0x061c,
+ 0x0600, 0x0604,
0x06dd, 0x06dd,
0x070f, 0x070f,
- 0x180e, 0x180e,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
- 0x2066, 0x206f,
+ 0x206a, 0x206f,
0xfeff, 0xfeff,
0xfff9, 0xfffb,
0x110bd, 0x110bd,
- 0x1bca0, 0x1bca3,
0x1d173, 0x1d17a,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
@@ -6040,22 +5424,23 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 613,
+ 539,
0x0378, 0x0379,
- 0x0380, 0x0383,
+ 0x037f, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0530, 0x0530,
+ 0x0528, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058c,
+ 0x058b, 0x058e,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x061d, 0x061d,
+ 0x0605, 0x0605,
+ 0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
0x07b2, 0x07bf,
@@ -6064,7 +5449,11 @@ static const OnigCodePoint CR_Cn[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08b5, 0x08e2,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -6107,8 +5496,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af2, 0x0af8,
- 0x0afa, 0x0b00,
+ 0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
0x0b11, 0x0b12,
@@ -6138,20 +5526,21 @@ static const OnigCodePoint CR_Cn[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0bff,
+ 0x0bfb, 0x0c00,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
0x0c4e, 0x0c54,
0x0c57, 0x0c57,
- 0x0c5b, 0x0c5f,
+ 0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c80,
+ 0x0c80, 0x0c81,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -6165,7 +5554,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d00,
+ 0x0cf3, 0x0d01,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -6173,7 +5562,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0d45, 0x0d45,
0x0d49, 0x0d49,
0x0d4f, 0x0d56,
- 0x0d58, 0x0d5e,
+ 0x0d58, 0x0d5f,
0x0d64, 0x0d65,
0x0d76, 0x0d78,
0x0d80, 0x0d81,
@@ -6186,8 +5575,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0de5,
- 0x0df0, 0x0df1,
+ 0x0de0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -6236,10 +5624,9 @@ static const OnigCodePoint CR_Cn[] = {
0x135b, 0x135c,
0x137d, 0x137f,
0x139a, 0x139f,
- 0x13f6, 0x13f7,
- 0x13fe, 0x13ff,
+ 0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f9, 0x16ff,
+ 0x16f1, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -6255,7 +5642,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191f, 0x191f,
+ 0x191d, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -6269,8 +5656,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aaf,
- 0x1abf, 0x1aff,
+ 0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -6278,9 +5664,8 @@ static const OnigCodePoint CR_Cn[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cf7,
- 0x1cfa, 0x1cff,
- 0x1df6, 0x1dfb,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -6297,22 +5682,19 @@ static const OnigCodePoint CR_Cn[] = {
0x1ff0, 0x1ff1,
0x1ff5, 0x1ff5,
0x1fff, 0x1fff,
- 0x2065, 0x2065,
+ 0x2065, 0x2069,
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20bf, 0x20cf,
+ 0x20ba, 0x20cf,
0x20f1, 0x20ff,
- 0x218c, 0x218f,
- 0x23fb, 0x23ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2b74, 0x2b75,
- 0x2b96, 0x2b97,
- 0x2bba, 0x2bbc,
- 0x2bc9, 0x2bc9,
- 0x2bd2, 0x2beb,
- 0x2bf0, 0x2bff,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -6330,7 +5712,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e43, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -6345,35 +5727,37 @@ static const OnigCodePoint CR_Cn[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fd6, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
- 0xa7ae, 0xa7af,
- 0xa7b8, 0xa7f6,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
0xa8c5, 0xa8cd,
0xa8da, 0xa8df,
- 0xa8fe, 0xa8ff,
+ 0xa8fc, 0xa8ff,
0xa954, 0xa95e,
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9ff, 0xa9ff,
+ 0xa9e0, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xab2f,
- 0xab66, 0xab6f,
+ 0xab2f, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -6394,6 +5778,7 @@ static const OnigCodePoint CR_Cn[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -6417,42 +5802,31 @@ static const OnigCodePoint CR_Cn[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018d, 0x1018f,
- 0x1019c, 0x1019f,
- 0x101a1, 0x101cf,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102df,
- 0x102fc, 0x102ff,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
0x10324, 0x1032f,
- 0x1034b, 0x1034f,
- 0x1037b, 0x1037f,
+ 0x1034b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x104ff,
- 0x10528, 0x1052f,
- 0x10564, 0x1056e,
- 0x10570, 0x105ff,
- 0x10737, 0x1073f,
- 0x10756, 0x1075f,
- 0x10768, 0x107ff,
+ 0x104aa, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x1089f, 0x108a6,
- 0x108b0, 0x108df,
- 0x108f3, 0x108f3,
- 0x108f6, 0x108fa,
+ 0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
- 0x109b8, 0x109bb,
- 0x109d0, 0x109d1,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -6461,98 +5835,36 @@ static const OnigCodePoint CR_Cn[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10aa0, 0x10abf,
- 0x10ae7, 0x10aea,
- 0x10af7, 0x10aff,
+ 0x10a80, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b92, 0x10b98,
- 0x10b9d, 0x10ba8,
- 0x10bb0, 0x10bff,
- 0x10c49, 0x10c7f,
- 0x10cb3, 0x10cbf,
- 0x10cf3, 0x10cf9,
- 0x10d00, 0x10e5f,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107e,
+ 0x11070, 0x1107f,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1114f,
- 0x11177, 0x1117f,
- 0x111ce, 0x111cf,
- 0x111e0, 0x111e0,
- 0x111f5, 0x111ff,
- 0x11212, 0x11212,
- 0x1123e, 0x1127f,
- 0x11287, 0x11287,
- 0x11289, 0x11289,
- 0x1128e, 0x1128e,
- 0x1129e, 0x1129e,
- 0x112aa, 0x112af,
- 0x112eb, 0x112ef,
- 0x112fa, 0x112ff,
- 0x11304, 0x11304,
- 0x1130d, 0x1130e,
- 0x11311, 0x11312,
- 0x11329, 0x11329,
- 0x11331, 0x11331,
- 0x11334, 0x11334,
- 0x1133a, 0x1133b,
- 0x11345, 0x11346,
- 0x11349, 0x1134a,
- 0x1134e, 0x1134f,
- 0x11351, 0x11356,
- 0x11358, 0x1135c,
- 0x11364, 0x11365,
- 0x1136d, 0x1136f,
- 0x11375, 0x1147f,
- 0x114c8, 0x114cf,
- 0x114da, 0x1157f,
- 0x115b6, 0x115b7,
- 0x115de, 0x115ff,
- 0x11645, 0x1164f,
- 0x1165a, 0x1167f,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
0x116b8, 0x116bf,
- 0x116ca, 0x116ff,
- 0x1171a, 0x1171c,
- 0x1172c, 0x1172f,
- 0x11740, 0x1189f,
- 0x118f3, 0x118fe,
- 0x11900, 0x11abf,
- 0x11af9, 0x11fff,
- 0x1239a, 0x123ff,
- 0x1246f, 0x1246f,
- 0x12475, 0x1247f,
- 0x12544, 0x12fff,
- 0x1342f, 0x143ff,
- 0x14647, 0x167ff,
- 0x16a39, 0x16a3f,
- 0x16a5f, 0x16a5f,
- 0x16a6a, 0x16a6d,
- 0x16a70, 0x16acf,
- 0x16aee, 0x16aef,
- 0x16af6, 0x16aff,
- 0x16b46, 0x16b4f,
- 0x16b5a, 0x16b5a,
- 0x16b62, 0x16b62,
- 0x16b78, 0x16b7c,
- 0x16b90, 0x16eff,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1bbff,
- 0x1bc6b, 0x1bc6f,
- 0x1bc7d, 0x1bc7f,
- 0x1bc89, 0x1bc8f,
- 0x1bc9a, 0x1bc9b,
- 0x1bca4, 0x1cfff,
+ 0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
- 0x1d1e9, 0x1d1ff,
+ 0x1d1de, 0x1d1ff,
0x1d246, 0x1d2ff,
0x1d357, 0x1d35f,
0x1d372, 0x1d3ff,
@@ -6576,11 +5888,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1da8c, 0x1da9a,
- 0x1daa0, 0x1daa0,
- 0x1dab0, 0x1e7ff,
- 0x1e8c5, 0x1e8c6,
- 0x1e8d7, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -6618,10 +5926,10 @@ static const OnigCodePoint CR_Cn[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0c0, 0x1f0c0,
+ 0x1f0bf, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0f6, 0x1f0ff,
- 0x1f10d, 0x1f10f,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -6629,25 +5937,27 @@ static const OnigCodePoint CR_Cn[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 0x1f57a, 0x1f57a,
- 0x1f5a4, 0x1f5a4,
- 0x1f6d1, 0x1f6df,
- 0x1f6ed, 0x1f6ef,
- 0x1f6f4, 0x1f6ff,
- 0x1f774, 0x1f77f,
- 0x1f7d5, 0x1f7ff,
- 0x1f80c, 0x1f80f,
- 0x1f848, 0x1f84f,
- 0x1f85a, 0x1f85f,
- 0x1f888, 0x1f88f,
- 0x1f8ae, 0x1f90f,
- 0x1f919, 0x1f97f,
- 0x1f985, 0x1f9bf,
- 0x1f9c1, 0x1ffff,
+ 0x1f321, 0x1f32f,
+ 0x1f336, 0x1f336,
+ 0x1f37d, 0x1f37f,
+ 0x1f394, 0x1f39f,
+ 0x1f3c5, 0x1f3c5,
+ 0x1f3cb, 0x1f3df,
+ 0x1f3f1, 0x1f3ff,
+ 0x1f43f, 0x1f43f,
+ 0x1f441, 0x1f441,
+ 0x1f4f8, 0x1f4f8,
+ 0x1f4fd, 0x1f4ff,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
+ 0x1f568, 0x1f5fa,
+ 0x1f641, 0x1f644,
+ 0x1f650, 0x1f67f,
+ 0x1f6c6, 0x1f6ff,
+ 0x1f774, 0x1ffff,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
- 0x2b81e, 0x2b81f,
- 0x2cea2, 0x2f7ff,
+ 0x2b81e, 0x2f7ff,
0x2fa1e, 0xe0000,
0xe0002, 0xe001f,
0xe0080, 0xe00ff,
@@ -6672,7 +5982,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 554,
+ 486,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -6688,14 +5998,13 @@ static const OnigCodePoint CR_L[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -6721,12 +6030,14 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08b4,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0980,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -6757,7 +6068,6 @@ static const OnigCodePoint CR_L[] = {
0x0abd, 0x0abd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0af9, 0x0af9,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
0x0b13, 0x0b28,
@@ -6782,9 +6092,10 @@ static const OnigCodePoint CR_L[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c61,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
@@ -6800,7 +6111,7 @@ static const OnigCodePoint CR_L[] = {
0x0d12, 0x0d3a,
0x0d3d, 0x0d3d,
0x0d4e, 0x0d4e,
- 0x0d5f, 0x0d61,
+ 0x0d60, 0x0d61,
0x0d7a, 0x0d7f,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -6861,13 +6172,11 @@ static const OnigCodePoint CR_L[] = {
0x1312, 0x1315,
0x1318, 0x135a,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16f1, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -6881,11 +6190,11 @@ static const OnigCodePoint CR_L[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
- 0x19b0, 0x19c9,
+ 0x19c1, 0x19c7,
0x1a00, 0x1a16,
0x1a20, 0x1a54,
0x1aa7, 0x1aa7,
@@ -6969,20 +6278,21 @@ static const OnigCodePoint CR_L[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa6a0, 0xa6e5,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa801,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -6990,21 +6300,17 @@ static const OnigCodePoint CR_L[] = {
0xa882, 0xa8b3,
0xa8f2, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa90a, 0xa925,
0xa930, 0xa946,
0xa960, 0xa97c,
0xa984, 0xa9b2,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -7018,9 +6324,7 @@ static const OnigCodePoint CR_L[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabe2,
+ 0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
@@ -7058,29 +6362,19 @@ static const OnigCodePoint CR_L[] = {
0x10080, 0x100fa,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x10340,
0x10342, 0x10349,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -7090,74 +6384,24 @@ static const OnigCodePoint CR_L[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x11350, 0x11350,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x115d8, 0x115db,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x11700, 0x11719,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -7188,7 +6432,6 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -7225,13 +6468,12 @@ static const OnigCodePoint CR_L[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_L */
/* 'LC': General Category */
static const OnigCodePoint CR_LC[] = {
- 122,
+ 113,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -7244,21 +6486,18 @@ static const OnigCodePoint CR_LC[] = {
0x0370, 0x0373,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
0x1d00, 0x1d2b,
0x1d6b, 0x1d77,
0x1d79, 0x1d9a,
@@ -7306,24 +6545,18 @@ static const OnigCodePoint CR_LC[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa69b,
+ 0xa680, 0xa697,
0xa722, 0xa76f,
0xa771, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b7,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xa7fa, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab60, 0xab65,
- 0xab70, 0xabbf,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x118a0, 0x118df,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -7358,7 +6591,7 @@ static const OnigCodePoint CR_LC[] = {
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 630,
+ 611,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -7624,12 +6857,7 @@ static const OnigCodePoint CR_Ll[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
- 0x13f8, 0x13fd,
0x1d00, 0x1d2b,
0x1d6b, 0x1d77,
0x1d79, 0x1d9a,
@@ -7887,8 +7115,6 @@ static const OnigCodePoint CR_Ll[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -7938,29 +7164,17 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
- 0xa793, 0xa795,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
0xa7a7, 0xa7a7,
0xa7a9, 0xa7a9,
- 0xa7b5, 0xa7b5,
- 0xa7b7, 0xa7b7,
0xa7fa, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab60, 0xab65,
- 0xab70, 0xabbf,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x10cc0, 0x10cf2,
- 0x118c0, 0x118df,
0x1d41a, 0x1d433,
0x1d44e, 0x1d454,
0x1d456, 0x1d467,
@@ -7993,7 +7207,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 56,
+ 52,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -8035,26 +7249,22 @@ static const OnigCodePoint CR_Lm[] = {
0xa4f8, 0xa4fd,
0xa60c, 0xa60c,
0xa67f, 0xa67f,
- 0xa69c, 0xa69d,
0xa717, 0xa71f,
0xa770, 0xa770,
0xa788, 0xa788,
0xa7f8, 0xa7f9,
0xa9cf, 0xa9cf,
- 0xa9e6, 0xa9e6,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
0xaaf3, 0xaaf4,
- 0xab5c, 0xab5f,
0xff70, 0xff70,
0xff9e, 0xff9f,
- 0x16b40, 0x16b43,
0x16f93, 0x16f9f,
}; /* CR_Lm */
/* 'Lo': General Category */
static const OnigCodePoint CR_Lo[] = {
- 433,
+ 371,
0x00aa, 0x00aa,
0x00ba, 0x00ba,
0x01bb, 0x01bb,
@@ -8077,12 +7287,14 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
- 0x08a0, 0x08b4,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0972, 0x0980,
+ 0x0972, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -8113,7 +7325,6 @@ static const OnigCodePoint CR_Lo[] = {
0x0abd, 0x0abd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0af9, 0x0af9,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
0x0b13, 0x0b28,
@@ -8138,9 +7349,10 @@ static const OnigCodePoint CR_Lo[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c61,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
@@ -8156,7 +7368,7 @@ static const OnigCodePoint CR_Lo[] = {
0x0d12, 0x0d3a,
0x0d3d, 0x0d3d,
0x0d4e, 0x0d4e,
- 0x0d5f, 0x0d61,
+ 0x0d60, 0x0d61,
0x0d7a, 0x0d7f,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -8213,11 +7425,11 @@ static const OnigCodePoint CR_Lo[] = {
0x1312, 0x1315,
0x1318, 0x135a,
0x1380, 0x138f,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16f1, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -8231,11 +7443,11 @@ static const OnigCodePoint CR_Lo[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
- 0x19b0, 0x19c9,
+ 0x19c1, 0x19c7,
0x1a00, 0x1a16,
0x1a20, 0x1a54,
0x1b05, 0x1b33,
@@ -8271,7 +7483,7 @@ static const OnigCodePoint CR_Lo[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa014,
0xa016, 0xa48c,
0xa4d0, 0xa4f7,
@@ -8280,8 +7492,6 @@ static const OnigCodePoint CR_Lo[] = {
0xa62a, 0xa62b,
0xa66e, 0xa66e,
0xa6a0, 0xa6e5,
- 0xa78f, 0xa78f,
- 0xa7f7, 0xa7f7,
0xa7fb, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
@@ -8290,21 +7500,17 @@ static const OnigCodePoint CR_Lo[] = {
0xa882, 0xa8b3,
0xa8f2, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa90a, 0xa925,
0xa930, 0xa946,
0xa960, 0xa97c,
0xa984, 0xa9b2,
- 0xa9e0, 0xa9e4,
- 0xa9e7, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa6f,
0xaa71, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -8354,29 +7560,19 @@ static const OnigCodePoint CR_Lo[] = {
0x10080, 0x100fa,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x10340,
0x10342, 0x10349,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x10450, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -8386,70 +7582,23 @@ static const OnigCodePoint CR_Lo[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x11350, 0x11350,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x115d8, 0x115db,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x11700, 0x11719,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -8486,7 +7635,6 @@ static const OnigCodePoint CR_Lo[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_Lo */
@@ -8507,7 +7655,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 625,
+ 608,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -8655,7 +7803,6 @@ static const OnigCodePoint CR_Lu[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -8775,15 +7922,10 @@ static const OnigCodePoint CR_Lu[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13a0, 0x13f5,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -9034,8 +8176,6 @@ static const OnigCodePoint CR_Lu[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -9085,23 +8225,14 @@ static const OnigCodePoint CR_Lu[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b4,
- 0xa7b6, 0xa7b6,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x10c80, 0x10cb2,
- 0x118a0, 0x118bf,
0x1d400, 0x1d419,
0x1d434, 0x1d44d,
0x1d468, 0x1d481,
@@ -9137,7 +8268,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 236,
+ 204,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -9161,7 +8292,8 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e3, 0x0903,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
0x0951, 0x0957,
@@ -9199,20 +8331,20 @@ static const OnigCodePoint CR_M[] = {
0x0bc6, 0x0bc8,
0x0bca, 0x0bcd,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c3e, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0cbc, 0x0cbc,
0x0cbe, 0x0cc4,
0x0cc6, 0x0cc8,
0x0cca, 0x0ccd,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d3e, 0x0d44,
0x0d46, 0x0d48,
0x0d4a, 0x0d4d,
@@ -9261,11 +8393,12 @@ static const OnigCodePoint CR_M[] = {
0x18a9, 0x18a9,
0x1920, 0x192b,
0x1930, 0x193b,
+ 0x19b0, 0x19c0,
+ 0x19c8, 0x19c9,
0x1a17, 0x1a1b,
0x1a55, 0x1a5e,
0x1a60, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b04,
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
@@ -9277,8 +8410,7 @@ static const OnigCodePoint CR_M[] = {
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
0x1cf2, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
0x2cef, 0x2cf1,
@@ -9288,7 +8420,7 @@ static const OnigCodePoint CR_M[] = {
0x3099, 0x309a,
0xa66f, 0xa672,
0xa674, 0xa67d,
- 0xa69e, 0xa69f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -9301,11 +8433,10 @@ static const OnigCodePoint CR_M[] = {
0xa947, 0xa953,
0xa980, 0xa983,
0xa9b3, 0xa9c0,
- 0xa9e5, 0xa9e5,
0xaa29, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4d,
- 0xaa7b, 0xaa7d,
+ 0xaa7b, 0xaa7b,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -9317,68 +8448,36 @@ static const OnigCodePoint CR_M[] = {
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11000, 0x11002,
0x11038, 0x11046,
- 0x1107f, 0x11082,
+ 0x11080, 0x11082,
0x110b0, 0x110ba,
0x11100, 0x11102,
0x11127, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11182,
0x111b3, 0x111c0,
- 0x111ca, 0x111cc,
- 0x1122c, 0x11237,
- 0x112df, 0x112ea,
- 0x11300, 0x11303,
- 0x1133c, 0x1133c,
- 0x1133e, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x11362, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b0, 0x114c3,
- 0x115af, 0x115b5,
- 0x115b8, 0x115c0,
- 0x115dc, 0x115dd,
- 0x11630, 0x11640,
0x116ab, 0x116b7,
- 0x1171d, 0x1172b,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
0x16f51, 0x16f7e,
0x16f8f, 0x16f92,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e8d0, 0x1e8d6,
0xe0100, 0xe01ef,
}; /* CR_M */
/* 'Mc': General Category */
static const OnigCodePoint CR_Mc[] = {
- 147,
+ 126,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -9443,7 +8542,9 @@ static const OnigCodePoint CR_Mc[] = {
0x1929, 0x192b,
0x1930, 0x1931,
0x1933, 0x1938,
- 0x1a19, 0x1a1a,
+ 0x19b0, 0x19c0,
+ 0x19c8, 0x19c9,
+ 0x1a19, 0x1a1b,
0x1a55, 0x1a55,
0x1a57, 0x1a57,
0x1a61, 0x1a61,
@@ -9458,6 +8559,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
+ 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -9480,7 +8582,6 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
- 0xaa7d, 0xaa7d,
0xaaeb, 0xaaeb,
0xaaee, 0xaaef,
0xaaf5, 0xaaf5,
@@ -9497,32 +8598,9 @@ static const OnigCodePoint CR_Mc[] = {
0x11182, 0x11182,
0x111b3, 0x111b5,
0x111bf, 0x111c0,
- 0x1122c, 0x1122e,
- 0x11232, 0x11233,
- 0x11235, 0x11235,
- 0x112e0, 0x112e2,
- 0x11302, 0x11303,
- 0x1133e, 0x1133f,
- 0x11341, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x11362, 0x11363,
- 0x114b0, 0x114b2,
- 0x114b9, 0x114b9,
- 0x114bb, 0x114be,
- 0x114c1, 0x114c1,
- 0x115af, 0x115b1,
- 0x115b8, 0x115bb,
- 0x115be, 0x115be,
- 0x11630, 0x11632,
- 0x1163b, 0x1163c,
- 0x1163e, 0x1163e,
0x116ac, 0x116ac,
0x116ae, 0x116af,
0x116b6, 0x116b6,
- 0x11720, 0x11721,
- 0x11726, 0x11726,
0x16f51, 0x16f7e,
0x1d165, 0x1d166,
0x1d16d, 0x1d172,
@@ -9530,9 +8608,8 @@ static const OnigCodePoint CR_Mc[] = {
/* 'Me': General Category */
static const OnigCodePoint CR_Me[] = {
- 5,
+ 4,
0x0488, 0x0489,
- 0x1abe, 0x1abe,
0x20dd, 0x20e0,
0x20e2, 0x20e4,
0xa670, 0xa672,
@@ -9540,7 +8617,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 266,
+ 220,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -9564,7 +8641,8 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e3, 0x0902,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -9600,19 +8678,16 @@ static const OnigCodePoint CR_Mn[] = {
0x0b82, 0x0b82,
0x0bc0, 0x0bc0,
0x0bcd, 0x0bcd,
- 0x0c00, 0x0c00,
0x0c3e, 0x0c40,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c81,
0x0cbc, 0x0cbc,
0x0cbf, 0x0cbf,
0x0cc6, 0x0cc6,
0x0ccc, 0x0ccd,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d01,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
0x0d62, 0x0d63,
@@ -9664,7 +8739,6 @@ static const OnigCodePoint CR_Mn[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
- 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -9672,7 +8746,6 @@ static const OnigCodePoint CR_Mn[] = {
0x1a65, 0x1a6c,
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abd,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -9682,7 +8755,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bad,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -9694,8 +8767,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
0x20e1, 0x20e1,
@@ -9707,7 +8779,7 @@ static const OnigCodePoint CR_Mn[] = {
0x3099, 0x309a,
0xa66f, 0xa66f,
0xa674, 0xa67d,
- 0xa69e, 0xa69f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -9721,13 +8793,11 @@ static const OnigCodePoint CR_Mn[] = {
0xa9b3, 0xa9b3,
0xa9b6, 0xa9b9,
0xa9bc, 0xa9bc,
- 0xa9e5, 0xa9e5,
0xaa29, 0xaa2e,
0xaa31, 0xaa32,
0xaa35, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4c,
- 0xaa7c, 0xaa7c,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -9740,78 +8810,39 @@ static const OnigCodePoint CR_Mn[] = {
0xabed, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x1107f, 0x11081,
+ 0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x11100, 0x11102,
0x11127, 0x1112b,
0x1112d, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11181,
0x111b6, 0x111be,
- 0x111ca, 0x111cc,
- 0x1122f, 0x11231,
- 0x11234, 0x11234,
- 0x11236, 0x11237,
- 0x112df, 0x112df,
- 0x112e3, 0x112ea,
- 0x11300, 0x11301,
- 0x1133c, 0x1133c,
- 0x11340, 0x11340,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b3, 0x114b8,
- 0x114ba, 0x114ba,
- 0x114bf, 0x114c0,
- 0x114c2, 0x114c3,
- 0x115b2, 0x115b5,
- 0x115bc, 0x115bd,
- 0x115bf, 0x115c0,
- 0x115dc, 0x115dd,
- 0x11633, 0x1163a,
- 0x1163d, 0x1163d,
- 0x1163f, 0x11640,
0x116ab, 0x116ab,
0x116ad, 0x116ad,
0x116b0, 0x116b5,
0x116b7, 0x116b7,
- 0x1171d, 0x1171f,
- 0x11722, 0x11725,
- 0x11727, 0x1172b,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
0x16f8f, 0x16f92,
- 0x1bc9d, 0x1bc9e,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e8d0, 0x1e8d6,
0xe0100, 0xe01ef,
}; /* CR_Mn */
/* 'N': Major Category */
static const OnigCodePoint CR_N[] = {
- 111,
+ 88,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -9831,7 +8862,6 @@ static const OnigCodePoint CR_N[] = {
0x0c78, 0x0c7e,
0x0ce6, 0x0cef,
0x0d66, 0x0d75,
- 0x0de6, 0x0def,
0x0e50, 0x0e59,
0x0ed0, 0x0ed9,
0x0f20, 0x0f33,
@@ -9874,55 +8904,33 @@ static const OnigCodePoint CR_N[] = {
0xa8d0, 0xa8d9,
0xa900, 0xa909,
0xa9d0, 0xa9d9,
- 0xa9f0, 0xa9f9,
0xaa50, 0xaa59,
0xabf0, 0xabf9,
0xff10, 0xff19,
0x10107, 0x10133,
0x10140, 0x10178,
- 0x1018a, 0x1018b,
- 0x102e1, 0x102fb,
+ 0x1018a, 0x1018a,
0x10320, 0x10323,
0x10341, 0x10341,
0x1034a, 0x1034a,
0x103d1, 0x103d5,
0x104a0, 0x104a9,
0x10858, 0x1085f,
- 0x10879, 0x1087f,
- 0x108a7, 0x108af,
- 0x108fb, 0x108ff,
0x10916, 0x1091b,
- 0x109bc, 0x109bd,
- 0x109c0, 0x109cf,
- 0x109d2, 0x109ff,
0x10a40, 0x10a47,
0x10a7d, 0x10a7e,
- 0x10a9d, 0x10a9f,
- 0x10aeb, 0x10aef,
0x10b58, 0x10b5f,
0x10b78, 0x10b7f,
- 0x10ba9, 0x10baf,
- 0x10cfa, 0x10cff,
0x10e60, 0x10e7e,
0x11052, 0x1106f,
0x110f0, 0x110f9,
0x11136, 0x1113f,
0x111d0, 0x111d9,
- 0x111e1, 0x111f4,
- 0x112f0, 0x112f9,
- 0x114d0, 0x114d9,
- 0x11650, 0x11659,
0x116c0, 0x116c9,
- 0x11730, 0x1173b,
- 0x118e0, 0x118f2,
- 0x12400, 0x1246e,
- 0x16a60, 0x16a69,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
+ 0x12400, 0x12462,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
- 0x1e8c7, 0x1e8cf,
- 0x1f100, 0x1f10c,
+ 0x1f100, 0x1f10a,
}; /* CR_N */
/* 'Nd': General Category */
@@ -9942,12 +8950,12 @@ static const OnigCodePoint CR_Nl[] = {
0x10341, 0x10341,
0x1034a, 0x1034a,
0x103d1, 0x103d5,
- 0x12400, 0x1246e,
+ 0x12400, 0x12462,
}; /* CR_Nl */
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 58,
+ 42,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -9978,34 +8986,18 @@ static const OnigCodePoint CR_No[] = {
0xa830, 0xa835,
0x10107, 0x10133,
0x10175, 0x10178,
- 0x1018a, 0x1018b,
- 0x102e1, 0x102fb,
+ 0x1018a, 0x1018a,
0x10320, 0x10323,
0x10858, 0x1085f,
- 0x10879, 0x1087f,
- 0x108a7, 0x108af,
- 0x108fb, 0x108ff,
0x10916, 0x1091b,
- 0x109bc, 0x109bd,
- 0x109c0, 0x109cf,
- 0x109d2, 0x109ff,
0x10a40, 0x10a47,
0x10a7d, 0x10a7e,
- 0x10a9d, 0x10a9f,
- 0x10aeb, 0x10aef,
0x10b58, 0x10b5f,
0x10b78, 0x10b7f,
- 0x10ba9, 0x10baf,
- 0x10cfa, 0x10cff,
0x10e60, 0x10e7e,
0x11052, 0x11065,
- 0x111e1, 0x111f4,
- 0x1173a, 0x1173b,
- 0x118ea, 0x118f2,
- 0x16b5b, 0x16b61,
0x1d360, 0x1d371,
- 0x1e8c7, 0x1e8cf,
- 0x1f100, 0x1f10c,
+ 0x1f100, 0x1f10a,
}; /* CR_No */
/* 'P': Major Category */
@@ -10024,7 +9016,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 17,
+ 16,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -10034,7 +9026,6 @@ static const OnigCodePoint CR_Pd[] = {
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
0x2e3a, 0x2e3b,
- 0x2e40, 0x2e40,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -10046,7 +9037,7 @@ static const OnigCodePoint CR_Pd[] = {
/* 'Pe': General Category */
static const OnigCodePoint CR_Pe[] = {
- 72,
+ 70,
0x0029, 0x0029,
0x005d, 0x005d,
0x007d, 0x007d,
@@ -10056,8 +9047,6 @@ static const OnigCodePoint CR_Pe[] = {
0x2046, 0x2046,
0x207e, 0x207e,
0x208e, 0x208e,
- 0x2309, 0x2309,
- 0x230b, 0x230b,
0x232a, 0x232a,
0x2769, 0x2769,
0x276b, 0x276b,
@@ -10100,7 +9089,7 @@ static const OnigCodePoint CR_Pe[] = {
0x3019, 0x3019,
0x301b, 0x301b,
0x301e, 0x301f,
- 0xfd3e, 0xfd3e,
+ 0xfd3f, 0xfd3f,
0xfe18, 0xfe18,
0xfe36, 0xfe36,
0xfe38, 0xfe38,
@@ -10154,7 +9143,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 157,
+ 135,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -10236,8 +9225,6 @@ static const OnigCodePoint CR_Po[] = {
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
0x2e30, 0x2e39,
- 0x2e3c, 0x2e3f,
- 0x2e41, 0x2e41,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -10249,7 +9236,6 @@ static const OnigCodePoint CR_Po[] = {
0xa874, 0xa877,
0xa8ce, 0xa8cf,
0xa8f8, 0xa8fa,
- 0xa8fc, 0xa8fc,
0xa92e, 0xa92f,
0xa95f, 0xa95f,
0xa9c1, 0xa9cd,
@@ -10281,42 +9267,23 @@ static const OnigCodePoint CR_Po[] = {
0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
- 0x1056f, 0x1056f,
0x10857, 0x10857,
0x1091f, 0x1091f,
0x1093f, 0x1093f,
0x10a50, 0x10a58,
0x10a7f, 0x10a7f,
- 0x10af0, 0x10af6,
0x10b39, 0x10b3f,
- 0x10b99, 0x10b9c,
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
0x11140, 0x11143,
- 0x11174, 0x11175,
- 0x111c5, 0x111c9,
- 0x111cd, 0x111cd,
- 0x111db, 0x111db,
- 0x111dd, 0x111df,
- 0x11238, 0x1123d,
- 0x112a9, 0x112a9,
- 0x114c6, 0x114c6,
- 0x115c1, 0x115d7,
- 0x11641, 0x11643,
- 0x1173c, 0x1173e,
- 0x12470, 0x12474,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b3b,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
- 0x1da87, 0x1da8b,
+ 0x111c5, 0x111c8,
+ 0x12470, 0x12473,
}; /* CR_Po */
/* 'Ps': General Category */
static const OnigCodePoint CR_Ps[] = {
- 75,
+ 72,
0x0028, 0x0028,
0x005b, 0x005b,
0x007b, 0x007b,
@@ -10328,8 +9295,6 @@ static const OnigCodePoint CR_Ps[] = {
0x2045, 0x2045,
0x207d, 0x207d,
0x208d, 0x208d,
- 0x2308, 0x2308,
- 0x230a, 0x230a,
0x2329, 0x2329,
0x2768, 0x2768,
0x276a, 0x276a,
@@ -10362,7 +9327,6 @@ static const OnigCodePoint CR_Ps[] = {
0x2e24, 0x2e24,
0x2e26, 0x2e26,
0x2e28, 0x2e28,
- 0x2e42, 0x2e42,
0x3008, 0x3008,
0x300a, 0x300a,
0x300c, 0x300c,
@@ -10373,7 +9337,7 @@ static const OnigCodePoint CR_Ps[] = {
0x3018, 0x3018,
0x301a, 0x301a,
0x301d, 0x301d,
- 0xfd3f, 0xfd3f,
+ 0xfd3e, 0xfd3e,
0xfe17, 0xfe17,
0xfe35, 0xfe35,
0xfe37, 0xfe37,
@@ -10396,7 +9360,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 214,
+ 198,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -10421,7 +9385,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -10465,7 +9429,7 @@ static const OnigCodePoint CR_S[] = {
0x2052, 0x2052,
0x207a, 0x207c,
0x208a, 0x208c,
- 0x20a0, 0x20be,
+ 0x20a0, 0x20b9,
0x2100, 0x2101,
0x2103, 0x2106,
0x2108, 0x2109,
@@ -10480,25 +9444,20 @@ static const OnigCodePoint CR_S[] = {
0x2140, 0x2144,
0x214a, 0x214d,
0x214f, 0x214f,
- 0x218a, 0x218b,
- 0x2190, 0x2307,
- 0x230c, 0x2328,
- 0x232b, 0x23fa,
+ 0x2190, 0x2328,
+ 0x232b, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
- 0x2500, 0x2767,
+ 0x2500, 0x26ff,
+ 0x2701, 0x2767,
0x2794, 0x27c4,
0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
- 0x29fe, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
+ 0x29fe, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
@@ -10528,7 +9487,6 @@ static const OnigCodePoint CR_S[] = {
0xa828, 0xa82b,
0xa836, 0xa839,
0xaa77, 0xaa79,
- 0xab5b, 0xab5b,
0xfb29, 0xfb29,
0xfbb2, 0xfbc1,
0xfdfc, 0xfdfd,
@@ -10547,23 +9505,15 @@ static const OnigCodePoint CR_S[] = {
0xfffc, 0xfffd,
0x10137, 0x1013f,
0x10179, 0x10189,
- 0x1018c, 0x1018c,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fc,
- 0x10877, 0x10878,
- 0x10ac8, 0x10ac8,
- 0x1173f, 0x1173f,
- 0x16b3c, 0x16b3f,
- 0x16b45, 0x16b45,
- 0x1bc9c, 0x1bc9c,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
0x1d16a, 0x1d16c,
0x1d183, 0x1d184,
0x1d18c, 0x1d1a9,
- 0x1d1ae, 0x1d1e8,
+ 0x1d1ae, 0x1d1dd,
0x1d200, 0x1d241,
0x1d245, 0x1d245,
0x1d300, 0x1d356,
@@ -10577,18 +9527,13 @@ static const OnigCodePoint CR_S[] = {
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
- 0x1d800, 0x1d9ff,
- 0x1da37, 0x1da3a,
- 0x1da6d, 0x1da74,
- 0x1da76, 0x1da83,
- 0x1da85, 0x1da86,
0x1eef0, 0x1eef1,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
+ 0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -10596,21 +9541,24 @@ static const OnigCodePoint CR_S[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
}; /* CR_S */
/* 'Sc': General Category */
@@ -10626,7 +9574,7 @@ static const OnigCodePoint CR_Sc[] = {
0x0bf9, 0x0bf9,
0x0e3f, 0x0e3f,
0x17db, 0x17db,
- 0x20a0, 0x20be,
+ 0x20a0, 0x20b9,
0xa838, 0xa838,
0xfdfc, 0xfdfc,
0xfe69, 0xfe69,
@@ -10637,7 +9585,7 @@ static const OnigCodePoint CR_Sc[] = {
/* 'Sk': General Category */
static const OnigCodePoint CR_Sk[] = {
- 29,
+ 27,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -10661,17 +9609,15 @@ static const OnigCodePoint CR_Sk[] = {
0xa700, 0xa716,
0xa720, 0xa721,
0xa789, 0xa78a,
- 0xab5b, 0xab5b,
0xfbb2, 0xfbc1,
0xff3e, 0xff3e,
0xff40, 0xff40,
0xffe3, 0xffe3,
- 0x1f3fb, 0x1f3ff,
}; /* CR_Sk */
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 64,
+ 65,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -10699,6 +9645,7 @@ static const OnigCodePoint CR_Sm[] = {
0x21d2, 0x21d2,
0x21d4, 0x21d4,
0x21f4, 0x22ff,
+ 0x2308, 0x230b,
0x2320, 0x2321,
0x237c, 0x237c,
0x239b, 0x23b3,
@@ -10740,13 +9687,12 @@ static const OnigCodePoint CR_Sm[] = {
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 170,
+ 153,
0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
0x0482, 0x0482,
- 0x058d, 0x058e,
0x060e, 0x060f,
0x06de, 0x06de,
0x06e9, 0x06e9,
@@ -10789,7 +9735,6 @@ static const OnigCodePoint CR_So[] = {
0x214a, 0x214a,
0x214c, 0x214d,
0x214f, 0x214f,
- 0x218a, 0x218b,
0x2195, 0x2199,
0x219c, 0x219f,
0x21a1, 0x21a2,
@@ -10805,7 +9750,7 @@ static const OnigCodePoint CR_So[] = {
0x232b, 0x237b,
0x237d, 0x239a,
0x23b4, 0x23db,
- 0x23e2, 0x23fa,
+ 0x23e2, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
@@ -10813,17 +9758,13 @@ static const OnigCodePoint CR_So[] = {
0x25b8, 0x25c0,
0x25c2, 0x25f7,
0x2600, 0x266e,
- 0x2670, 0x2767,
+ 0x2670, 0x26ff,
+ 0x2701, 0x2767,
0x2794, 0x27bf,
0x2800, 0x28ff,
0x2b00, 0x2b2f,
0x2b45, 0x2b46,
- 0x2b4d, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
+ 0x2b50, 0x2b59,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
@@ -10857,37 +9798,24 @@ static const OnigCodePoint CR_So[] = {
0xfffc, 0xfffd,
0x10137, 0x1013f,
0x10179, 0x10189,
- 0x1018c, 0x1018c,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fc,
- 0x10877, 0x10878,
- 0x10ac8, 0x10ac8,
- 0x1173f, 0x1173f,
- 0x16b3c, 0x16b3f,
- 0x16b45, 0x16b45,
- 0x1bc9c, 0x1bc9c,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
0x1d16a, 0x1d16c,
0x1d183, 0x1d184,
0x1d18c, 0x1d1a9,
- 0x1d1ae, 0x1d1e8,
+ 0x1d1ae, 0x1d1dd,
0x1d200, 0x1d241,
0x1d245, 0x1d245,
0x1d300, 0x1d356,
- 0x1d800, 0x1d9ff,
- 0x1da37, 0x1da3a,
- 0x1da6d, 0x1da74,
- 0x1da76, 0x1da83,
- 0x1da85, 0x1da86,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
+ 0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -10895,30 +9823,33 @@ static const OnigCodePoint CR_So[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f3fa,
- 0x1f400, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
}; /* CR_So */
/* 'Z': Major Category */
static const OnigCodePoint CR_Z[] = {
- 8,
+ 9,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x2028, 0x2029,
0x202f, 0x202f,
@@ -10940,10 +9871,11 @@ static const OnigCodePoint CR_Zp[] = {
/* 'Zs': General Category */
static const OnigCodePoint CR_Zs[] = {
- 7,
+ 8,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x202f, 0x202f,
0x205f, 0x205f,
@@ -11104,7 +10036,7 @@ static const OnigCodePoint CR_Math[] = {
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 131,
+ 119,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -11122,21 +10054,18 @@ static const OnigCodePoint CR_Cased[] = {
0x0370, 0x0373,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
0x1d00, 0x1dbf,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
@@ -11186,23 +10115,17 @@ static const OnigCodePoint CR_Cased[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa69d,
+ 0xa680, 0xa697,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b7,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xa7f8, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabbf,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x118a0, 0x118df,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -11233,14 +10156,11 @@ static const OnigCodePoint CR_Cased[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Cased */
/* 'Case_Ignorable': Derived Property */
static const OnigCodePoint CR_Case_Ignorable[] = {
- 346,
+ 295,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -11264,9 +10184,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0605,
+ 0x0600, 0x0604,
0x0610, 0x061a,
- 0x061c, 0x061c,
0x0640, 0x0640,
0x064b, 0x065f,
0x0670, 0x0670,
@@ -11281,7 +10200,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
- 0x08e3, 0x0902,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -11318,19 +10238,16 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x0b82, 0x0b82,
0x0bc0, 0x0bc0,
0x0bcd, 0x0bcd,
- 0x0c00, 0x0c00,
0x0c3e, 0x0c40,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c81,
0x0cbc, 0x0cbc,
0x0cbf, 0x0cbf,
0x0cc6, 0x0cc6,
0x0ccc, 0x0ccd,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d01,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
0x0d62, 0x0d63,
@@ -11378,7 +10295,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x17c9, 0x17d3,
0x17d7, 0x17d7,
0x17dd, 0x17dd,
- 0x180b, 0x180e,
+ 0x180b, 0x180d,
0x1843, 0x1843,
0x18a9, 0x18a9,
0x1920, 0x1922,
@@ -11386,7 +10303,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
- 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -11395,7 +10311,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -11405,7 +10320,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bad,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -11418,10 +10333,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
- 0x1d9b, 0x1df5,
+ 0x1d9b, 0x1de6,
0x1dfc, 0x1dff,
0x1fbd, 0x1fbd,
0x1fbf, 0x1fc1,
@@ -11435,7 +10349,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x2027, 0x2027,
0x202a, 0x202e,
0x2060, 0x2064,
- 0x2066, 0x206f,
+ 0x206a, 0x206f,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
@@ -11458,7 +10372,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa66f, 0xa672,
0xa674, 0xa67d,
0xa67f, 0xa67f,
- 0xa69c, 0xa69f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
0xa770, 0xa770,
@@ -11477,14 +10391,12 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa9b6, 0xa9b9,
0xa9bc, 0xa9bc,
0xa9cf, 0xa9cf,
- 0xa9e5, 0xa9e6,
0xaa29, 0xaa2e,
0xaa31, 0xaa32,
0xaa35, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4c,
0xaa70, 0xaa70,
- 0xaa7c, 0xaa7c,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -11494,7 +10406,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaaec, 0xaaed,
0xaaf3, 0xaaf4,
0xaaf6, 0xaaf6,
- 0xab5b, 0xab5f,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -11502,7 +10413,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xfbb2, 0xfbc1,
0xfe00, 0xfe0f,
0xfe13, 0xfe13,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0xfe52, 0xfe52,
0xfe55, 0xfe55,
0xfeff, 0xfeff,
@@ -11516,74 +10427,32 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xffe3, 0xffe3,
0xfff9, 0xfffb,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x1107f, 0x11081,
+ 0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x110bd, 0x110bd,
0x11100, 0x11102,
0x11127, 0x1112b,
0x1112d, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11181,
0x111b6, 0x111be,
- 0x111ca, 0x111cc,
- 0x1122f, 0x11231,
- 0x11234, 0x11234,
- 0x11236, 0x11237,
- 0x112df, 0x112df,
- 0x112e3, 0x112ea,
- 0x11300, 0x11301,
- 0x1133c, 0x1133c,
- 0x11340, 0x11340,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b3, 0x114b8,
- 0x114ba, 0x114ba,
- 0x114bf, 0x114c0,
- 0x114c2, 0x114c3,
- 0x115b2, 0x115b5,
- 0x115bc, 0x115bd,
- 0x115bf, 0x115c0,
- 0x115dc, 0x115dd,
- 0x11633, 0x1163a,
- 0x1163d, 0x1163d,
- 0x1163f, 0x11640,
0x116ab, 0x116ab,
0x116ad, 0x116ad,
0x116b0, 0x116b5,
0x116b7, 0x116b7,
- 0x1171d, 0x1171f,
- 0x11722, 0x11725,
- 0x11727, 0x1172b,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
- 0x16b40, 0x16b43,
0x16f8f, 0x16f9f,
- 0x1bc9d, 0x1bc9e,
- 0x1bca0, 0x1bca3,
0x1d167, 0x1d169,
0x1d173, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e8d0, 0x1e8d6,
- 0x1f3fb, 0x1f3ff,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
0xe0100, 0xe01ef,
@@ -11591,7 +10460,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 588,
+ 571,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -11739,7 +10608,6 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -11858,15 +10726,10 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13a0, 0x13f5,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -12112,8 +10975,6 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -12163,28 +11024,19 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b4,
- 0xa7b6, 0xa7b6,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x10c80, 0x10cb2,
- 0x118a0, 0x118bf,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 605,
+ 586,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -12331,21 +11183,20 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x024f, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025c,
- 0x0260, 0x0261,
+ 0x025b, 0x025b,
+ 0x0260, 0x0260,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026c,
+ 0x026b, 0x026b,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0287, 0x028c,
+ 0x0288, 0x028c,
0x0292, 0x0292,
- 0x029d, 0x029e,
0x0345, 0x0345,
0x0371, 0x0371,
0x0373, 0x0373,
@@ -12366,7 +11217,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x03e9, 0x03e9,
0x03eb, 0x03eb,
0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
+ 0x03ef, 0x03f2,
0x03f5, 0x03f5,
0x03f8, 0x03f8,
0x03fb, 0x03fb,
@@ -12466,12 +11317,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
- 0x13f8, 0x13fd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e01, 0x1e01,
@@ -12720,8 +11566,6 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -12770,31 +11614,20 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa78c, 0xa78c,
0xa791, 0xa791,
0xa793, 0xa793,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
0xa7a7, 0xa7a7,
0xa7a9, 0xa7a9,
- 0xa7b5, 0xa7b5,
- 0xa7b7, 0xa7b7,
- 0xab53, 0xab53,
- 0xab70, 0xabbf,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x10cc0, 0x10cf2,
- 0x118c0, 0x118df,
}; /* CR_Changes_When_Uppercased */
/* 'Changes_When_Titlecased': Derived Property */
static const OnigCodePoint CR_Changes_When_Titlecased[] = {
- 606,
+ 587,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -12942,21 +11775,20 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x024f, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025c,
- 0x0260, 0x0261,
+ 0x025b, 0x025b,
+ 0x0260, 0x0260,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026c,
+ 0x026b, 0x026b,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0287, 0x028c,
+ 0x0288, 0x028c,
0x0292, 0x0292,
- 0x029d, 0x029e,
0x0345, 0x0345,
0x0371, 0x0371,
0x0373, 0x0373,
@@ -12977,7 +11809,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x03e9, 0x03e9,
0x03eb, 0x03eb,
0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
+ 0x03ef, 0x03f2,
0x03f5, 0x03f5,
0x03f8, 0x03f8,
0x03fb, 0x03fb,
@@ -13077,12 +11909,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
- 0x13f8, 0x13fd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e01, 0x1e01,
@@ -13331,8 +12158,6 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -13381,31 +12206,20 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa78c, 0xa78c,
0xa791, 0xa791,
0xa793, 0xa793,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
0xa7a7, 0xa7a7,
0xa7a9, 0xa7a9,
- 0xa7b5, 0xa7b5,
- 0xa7b7, 0xa7b7,
- 0xab53, 0xab53,
- 0xab70, 0xabbf,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x10cc0, 0x10cf2,
- 0x118c0, 0x118df,
}; /* CR_Changes_When_Titlecased */
/* 'Changes_When_Casefolded': Derived Property */
static const OnigCodePoint CR_Changes_When_Casefolded[] = {
- 600,
+ 582,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -13556,7 +12370,6 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -13678,16 +12491,11 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x0587, 0x0587,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13f8, 0x13fd,
0x1e00, 0x1e00,
0x1e02, 0x1e02,
0x1e04, 0x1e04,
@@ -13935,8 +12743,6 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -13986,31 +12792,21 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b4,
- 0xa7b6, 0xa7b6,
- 0xab70, 0xabbf,
+ 0xa7aa, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x10c80, 0x10cb2,
- 0x118a0, 0x118bf,
}; /* CR_Changes_When_Casefolded */
/* 'Changes_When_Casemapped': Derived Property */
static const OnigCodePoint CR_Changes_When_Casemapped[] = {
- 113,
+ 104,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -14028,42 +12824,39 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x023a, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025c,
- 0x0260, 0x0261,
+ 0x025b, 0x025b,
+ 0x0260, 0x0260,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026c,
+ 0x026b, 0x026b,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0287, 0x028c,
+ 0x0288, 0x028c,
0x0292, 0x0292,
- 0x029d, 0x029e,
0x0345, 0x0345,
0x0370, 0x0373,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03d1,
- 0x03d5, 0x03f5,
+ 0x03d5, 0x03f2,
+ 0x03f4, 0x03f5,
0x03f7, 0x03fb,
0x03fd, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
0x10cd, 0x10cd,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
0x1e00, 0x1e9b,
@@ -14106,29 +12899,23 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa69b,
+ 0xa680, 0xa697,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
0xa790, 0xa793,
- 0xa796, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xab53, 0xab53,
- 0xab70, 0xabbf,
+ 0xa7a0, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x118a0, 0x118df,
}; /* CR_Changes_When_Casemapped */
/* 'ID_Start': Derived Property */
static const OnigCodePoint CR_ID_Start[] = {
- 555,
+ 488,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -14144,14 +12931,13 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -14177,12 +12963,14 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08b4,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0980,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -14213,7 +13001,6 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0abd, 0x0abd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0af9, 0x0af9,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
0x0b13, 0x0b28,
@@ -14238,9 +13025,10 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c61,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
@@ -14256,7 +13044,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0d12, 0x0d3a,
0x0d3d, 0x0d3d,
0x0d4e, 0x0d4e,
- 0x0d5f, 0x0d61,
+ 0x0d60, 0x0d61,
0x0d7a, 0x0d7f,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -14317,13 +13105,12 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1312, 0x1315,
0x1318, 0x135a,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -14337,11 +13124,11 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
- 0x19b0, 0x19c9,
+ 0x19c1, 0x19c7,
0x1a00, 0x1a16,
0x1a20, 0x1a54,
0x1aa7, 0x1aa7,
@@ -14424,20 +13211,21 @@ static const OnigCodePoint CR_ID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa6a0, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa801,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -14445,21 +13233,17 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa882, 0xa8b3,
0xa8f2, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa90a, 0xa925,
0xa930, 0xa946,
0xa960, 0xa97c,
0xa984, 0xa9b2,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -14473,9 +13257,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabe2,
+ 0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
@@ -14514,29 +13296,19 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -14546,75 +13318,25 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x11350, 0x11350,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x115d8, 0x115db,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x11700, 0x11719,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -14645,7 +13367,6 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -14682,13 +13403,12 @@ static const OnigCodePoint CR_ID_Start[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_ID_Start */
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 651,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -14707,14 +13427,13 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0300, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
0x0483, 0x0487,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -14738,10 +13457,14 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0963,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -14784,7 +13507,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0aef,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -14816,19 +13538,20 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -14842,7 +13565,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -14850,7 +13573,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d6f,
0x0d7a, 0x0d7f,
0x0d82, 0x0d83,
@@ -14863,7 +13586,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -14923,13 +13645,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x135d, 0x135f,
0x1369, 0x1371,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -14946,7 +13667,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -14960,7 +13681,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abd,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -14970,8 +13690,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -15044,36 +13763,37 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
0xa674, 0xa67d,
- 0xa67f, 0xa6f1,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa827,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
0xa8e0, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa900, 0xa92d,
0xa930, 0xa953,
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaac2,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -15082,9 +13802,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabea,
+ 0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -15106,7 +13824,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfb,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe70, 0xfe74,
@@ -15131,31 +13849,20 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102e0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -15168,94 +13875,29 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae6,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11000, 0x11046,
0x11066, 0x1106f,
- 0x1107f, 0x110ba,
+ 0x11080, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
- 0x11150, 0x11173,
- 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111ca, 0x111cc,
- 0x111d0, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x11237,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c0,
- 0x115d8, 0x115dd,
- 0x11600, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x11739,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af4,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -15293,14 +13935,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -15337,14 +13971,13 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
0xe0100, 0xe01ef,
}; /* CR_ID_Continue */
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 562,
+ 495,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -15360,14 +13993,13 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -15393,12 +14025,14 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08b4,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0980,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -15429,7 +14063,6 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0abd, 0x0abd,
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
- 0x0af9, 0x0af9,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
0x0b13, 0x0b28,
@@ -15454,9 +14087,10 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c61,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
@@ -15472,7 +14106,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0d12, 0x0d3a,
0x0d3d, 0x0d3d,
0x0d4e, 0x0d4e,
- 0x0d5f, 0x0d61,
+ 0x0d60, 0x0d61,
0x0d7a, 0x0d7f,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -15533,13 +14167,12 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1312, 0x1315,
0x1318, 0x135a,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -15553,11 +14186,11 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
- 0x19b0, 0x19c9,
+ 0x19c1, 0x19c7,
0x1a00, 0x1a16,
0x1a20, 0x1a54,
0x1aa7, 0x1aa7,
@@ -15640,20 +14273,21 @@ static const OnigCodePoint CR_XID_Start[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa6a0, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa801,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -15661,21 +14295,17 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa882, 0xa8b3,
0xa8f2, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa90a, 0xa925,
0xa930, 0xa946,
0xa960, 0xa97c,
0xa984, 0xa9b2,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -15689,9 +14319,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabe2,
+ 0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
0xd7cb, 0xd7fb,
@@ -15737,29 +14365,19 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -15769,75 +14387,25 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x11350, 0x11350,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x115d8, 0x115db,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x11700, 0x11719,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -15868,7 +14436,6 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -15905,13 +14472,12 @@ static const OnigCodePoint CR_XID_Start[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_XID_Start */
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 658,
+ 571,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -15930,14 +14496,13 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0300, 0x0374,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
0x0483, 0x0487,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -15961,10 +14526,14 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0963,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -16007,7 +14576,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0aef,
- 0x0af9, 0x0af9,
0x0b01, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -16039,19 +14607,20 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -16065,7 +14634,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -16073,7 +14642,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d6f,
0x0d7a, 0x0d7f,
0x0d82, 0x0d83,
@@ -16086,7 +14655,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -16146,13 +14714,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x135d, 0x135f,
0x1369, 0x1371,
0x1380, 0x138f,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1401, 0x166c,
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -16169,7 +14736,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -16183,7 +14750,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abd,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -16193,8 +14759,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -16268,36 +14833,37 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x31a0, 0x31ba,
0x31f0, 0x31ff,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xa000, 0xa48c,
0xa4d0, 0xa4fd,
0xa500, 0xa60c,
0xa610, 0xa62b,
0xa640, 0xa66f,
0xa674, 0xa67d,
- 0xa67f, 0xa6f1,
+ 0xa67f, 0xa697,
+ 0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa827,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
0xa8e0, 0xa8f7,
0xa8fb, 0xa8fb,
- 0xa8fd, 0xa8fd,
0xa900, 0xa92d,
0xa930, 0xa953,
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaac2,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -16306,9 +14872,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab65,
- 0xab70, 0xabea,
+ 0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -16331,7 +14895,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdf9,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe71, 0xfe71,
@@ -16361,31 +14925,20 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102e0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -16398,94 +14951,29 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae6,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
0x11000, 0x11046,
0x11066, 0x1106f,
- 0x1107f, 0x110ba,
+ 0x11080, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
- 0x11150, 0x11173,
- 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111ca, 0x111cc,
- 0x111d0, 0x111da,
- 0x111dc, 0x111dc,
- 0x11200, 0x11211,
- 0x11213, 0x11237,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a8,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c0,
- 0x115d8, 0x115dd,
- 0x11600, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x11739,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af4,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -16523,14 +15011,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -16567,20 +15047,18 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
0xe0100, 0xe01ef,
}; /* CR_XID_Continue */
/* 'Default_Ignorable_Code_Point': Derived Property */
static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
- 17,
+ 15,
0x00ad, 0x00ad,
0x034f, 0x034f,
- 0x061c, 0x061c,
0x115f, 0x1160,
0x17b4, 0x17b5,
- 0x180b, 0x180e,
+ 0x180b, 0x180d,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x206f,
@@ -16589,14 +15067,13 @@ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
0xfeff, 0xfeff,
0xffa0, 0xffa0,
0xfff0, 0xfff8,
- 0x1bca0, 0x1bca3,
0x1d173, 0x1d17a,
0xe0000, 0xe0fff,
}; /* CR_Default_Ignorable_Code_Point */
/* 'Grapheme_Extend': Derived Property */
static const OnigCodePoint CR_Grapheme_Extend[] = {
- 283,
+ 232,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -16620,7 +15097,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e3, 0x0902,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -16660,13 +15138,11 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0bc0, 0x0bc0,
0x0bcd, 0x0bcd,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c00,
0x0c3e, 0x0c40,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c81,
0x0cbc, 0x0cbc,
0x0cbf, 0x0cbf,
0x0cc2, 0x0cc2,
@@ -16674,7 +15150,6 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0ccc, 0x0ccd,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d01,
0x0d3e, 0x0d3e,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
@@ -16730,7 +15205,6 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
- 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -16738,7 +15212,6 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1a65, 0x1a6c,
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -16748,7 +15221,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bad,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -16760,8 +15233,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
0x20d0, 0x20f0,
@@ -16772,7 +15244,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x3099, 0x309a,
0xa66f, 0xa672,
0xa674, 0xa67d,
- 0xa69e, 0xa69f,
+ 0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa802, 0xa802,
0xa806, 0xa806,
@@ -16786,13 +15258,11 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xa9b3, 0xa9b3,
0xa9b6, 0xa9b9,
0xa9bc, 0xa9bc,
- 0xa9e5, 0xa9e5,
0xaa29, 0xaa2e,
0xaa31, 0xaa32,
0xaa35, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4c,
- 0xaa7c, 0xaa7c,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -16805,66 +15275,29 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xabed, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0xff9e, 0xff9f,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x1107f, 0x11081,
+ 0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x11100, 0x11102,
0x11127, 0x1112b,
0x1112d, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11181,
0x111b6, 0x111be,
- 0x111ca, 0x111cc,
- 0x1122f, 0x11231,
- 0x11234, 0x11234,
- 0x11236, 0x11237,
- 0x112df, 0x112df,
- 0x112e3, 0x112ea,
- 0x11300, 0x11301,
- 0x1133c, 0x1133c,
- 0x1133e, 0x1133e,
- 0x11340, 0x11340,
- 0x11357, 0x11357,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b0, 0x114b0,
- 0x114b3, 0x114b8,
- 0x114ba, 0x114ba,
- 0x114bd, 0x114bd,
- 0x114bf, 0x114c0,
- 0x114c2, 0x114c3,
- 0x115af, 0x115af,
- 0x115b2, 0x115b5,
- 0x115bc, 0x115bd,
- 0x115bf, 0x115c0,
- 0x115dc, 0x115dd,
- 0x11633, 0x1163a,
- 0x1163d, 0x1163d,
- 0x1163f, 0x11640,
0x116ab, 0x116ab,
0x116ad, 0x116ad,
0x116b0, 0x116b5,
0x116b7, 0x116b7,
- 0x1171d, 0x1171f,
- 0x11722, 0x11725,
- 0x11727, 0x1172b,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
0x16f8f, 0x16f92,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d165,
0x1d167, 0x1d169,
0x1d16e, 0x1d172,
@@ -16872,34 +15305,27 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1da00, 0x1da36,
- 0x1da3b, 0x1da6c,
- 0x1da75, 0x1da75,
- 0x1da84, 0x1da84,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e8d0, 0x1e8d6,
0xe0100, 0xe01ef,
}; /* CR_Grapheme_Extend */
/* 'Grapheme_Base': Derived Property */
static const OnigCodePoint CR_Grapheme_Base[] = {
- 743,
+ 643,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
0x0370, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x0482,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -16928,14 +15354,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
- 0x08a0, 0x08b4,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
0x0949, 0x094c,
0x094e, 0x0950,
0x0958, 0x0961,
- 0x0964, 0x0980,
+ 0x0964, 0x0977,
+ 0x0979, 0x097f,
0x0982, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
@@ -16977,7 +15405,6 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae1,
0x0ae6, 0x0af1,
- 0x0af9, 0x0af9,
0x0b02, 0x0b03,
0x0b05, 0x0b0c,
0x0b0f, 0x0b10,
@@ -17012,10 +15439,11 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
0x0c41, 0x0c44,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c61,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
@@ -17043,7 +15471,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4c,
0x0d4e, 0x0d4e,
- 0x0d5f, 0x0d61,
+ 0x0d60, 0x0d61,
0x0d66, 0x0d75,
0x0d79, 0x0d7f,
0x0d82, 0x0d83,
@@ -17054,7 +15482,6 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0dc0, 0x0dc6,
0x0dd0, 0x0dd1,
0x0dd8, 0x0dde,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e30,
0x0e32, 0x0e33,
@@ -17122,10 +15549,9 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1318, 0x135a,
0x1360, 0x137c,
0x1380, 0x1399,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
+ 0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -17141,12 +15567,13 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x17e0, 0x17e9,
0x17f0, 0x17f9,
0x1800, 0x180a,
+ 0x180e, 0x180e,
0x1810, 0x1819,
0x1820, 0x1877,
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1923, 0x1926,
0x1929, 0x192b,
0x1930, 0x1931,
@@ -17158,7 +15585,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x19b0, 0x19c9,
0x19d0, 0x19da,
0x19de, 0x1a16,
- 0x1a19, 0x1a1a,
+ 0x1a19, 0x1a1b,
0x1a1e, 0x1a55,
0x1a57, 0x1a57,
0x1a61, 0x1a61,
@@ -17177,7 +15604,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bae, 0x1be5,
+ 0x1bac, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -17215,17 +15642,14 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2070, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20be,
- 0x2100, 0x218b,
- 0x2190, 0x23fa,
+ 0x20a0, 0x20b9,
+ 0x2100, 0x2189,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
@@ -17244,7 +15668,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e42,
+ 0x2e00, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -17260,18 +15684,19 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x31f0, 0x321e,
0x3220, 0x32fe,
0x3300, 0x4db5,
- 0x4dc0, 0x9fd5,
+ 0x4dc0, 0x9fcc,
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
0xa640, 0xa66e,
0xa673, 0xa673,
- 0xa67e, 0xa69d,
+ 0xa67e, 0xa697,
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
- 0xa700, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa801,
+ 0xa700, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -17280,7 +15705,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa840, 0xa877,
0xa880, 0xa8c3,
0xa8ce, 0xa8d9,
- 0xa8f2, 0xa8fd,
+ 0xa8f2, 0xa8fb,
0xa900, 0xa925,
0xa92e, 0xa946,
0xa952, 0xa953,
@@ -17290,8 +15715,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa9ba, 0xa9bb,
0xa9bd, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9e4,
- 0xa9e6, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa28,
0xaa2f, 0xaa30,
0xaa33, 0xaa34,
@@ -17300,7 +15724,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaa4d, 0xaa4d,
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
- 0xaa7d, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -17313,8 +15737,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab65,
- 0xab70, 0xabe4,
+ 0xabc0, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabec,
0xabf0, 0xabf9,
@@ -17360,61 +15783,43 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fc,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e1, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
- 0x108fb, 0x1091b,
+ 0x10857, 0x1085f,
+ 0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
0x10980, 0x109b7,
- 0x109bc, 0x109cf,
- 0x109d2, 0x10a00,
+ 0x109be, 0x109bf,
+ 0x10a00, 0x10a00,
0x10a10, 0x10a13,
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a40, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae4,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x10cfa, 0x10cff,
0x10e60, 0x10e7e,
0x11000, 0x11000,
0x11002, 0x11037,
@@ -17429,98 +15834,23 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x11103, 0x11126,
0x1112c, 0x1112c,
0x11136, 0x11143,
- 0x11150, 0x11172,
- 0x11174, 0x11176,
0x11182, 0x111b5,
- 0x111bf, 0x111c9,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111df,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1122e,
- 0x11232, 0x11233,
- 0x11235, 0x11235,
- 0x11238, 0x1123d,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a9,
- 0x112b0, 0x112de,
- 0x112e0, 0x112e2,
- 0x112f0, 0x112f9,
- 0x11302, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x1133f, 0x1133f,
- 0x11341, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x1135d, 0x11363,
- 0x11480, 0x114af,
- 0x114b1, 0x114b2,
- 0x114b9, 0x114b9,
- 0x114bb, 0x114bc,
- 0x114be, 0x114be,
- 0x114c1, 0x114c1,
- 0x114c4, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115ae,
- 0x115b0, 0x115b1,
- 0x115b8, 0x115bb,
- 0x115be, 0x115be,
- 0x115c1, 0x115db,
- 0x11600, 0x11632,
- 0x1163b, 0x1163c,
- 0x1163e, 0x1163e,
- 0x11641, 0x11644,
- 0x11650, 0x11659,
+ 0x111bf, 0x111c8,
+ 0x111d0, 0x111d9,
0x11680, 0x116aa,
0x116ac, 0x116ac,
0x116ae, 0x116af,
0x116b6, 0x116b6,
0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x11720, 0x11721,
- 0x11726, 0x11726,
- 0x11730, 0x1173f,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x12480, 0x12543,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
- 0x14400, 0x14646,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af5, 0x16af5,
- 0x16b00, 0x16b2f,
- 0x16b37, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bc9c,
- 0x1bc9f, 0x1bc9f,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
@@ -17528,7 +15858,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1d16a, 0x1d16d,
0x1d183, 0x1d184,
0x1d18c, 0x1d1a9,
- 0x1d1ae, 0x1d1e8,
+ 0x1d1ae, 0x1d1dd,
0x1d200, 0x1d241,
0x1d245, 0x1d245,
0x1d300, 0x1d356,
@@ -17553,13 +15883,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1d54a, 0x1d550,
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d9ff,
- 0x1da37, 0x1da3a,
- 0x1da6d, 0x1da74,
- 0x1da76, 0x1da83,
- 0x1da85, 0x1da8b,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8cf,
+ 0x1d7ce, 0x1d7ff,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -17597,10 +15921,10 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -17608,31 +15932,33 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_Grapheme_Base */
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 41,
+ 33,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -17662,23 +15988,15 @@ static const OnigCodePoint CR_Grapheme_Link[] = {
0xabed, 0xabed,
0x10a3f, 0x10a3f,
0x11046, 0x11046,
- 0x1107f, 0x1107f,
0x110b9, 0x110b9,
0x11133, 0x11134,
0x111c0, 0x111c0,
- 0x11235, 0x11235,
- 0x112ea, 0x112ea,
- 0x1134d, 0x1134d,
- 0x114c2, 0x114c2,
- 0x115bf, 0x115bf,
- 0x1163f, 0x1163f,
0x116b6, 0x116b6,
- 0x1172b, 0x1172b,
}; /* CR_Grapheme_Link */
/* 'Common': Script */
static const OnigCodePoint CR_Common[] = {
- 161,
+ 157,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -17694,11 +16012,11 @@ static const OnigCodePoint CR_Common[] = {
0x0385, 0x0385,
0x0387, 0x0387,
0x0589, 0x0589,
- 0x0605, 0x0605,
0x060c, 0x060c,
- 0x061b, 0x061c,
+ 0x061b, 0x061b,
0x061f, 0x061f,
0x0640, 0x0640,
+ 0x0660, 0x0669,
0x06dd, 0x06dd,
0x0964, 0x0965,
0x0e3f, 0x0e3f,
@@ -17715,27 +16033,24 @@ static const OnigCodePoint CR_Common[] = {
0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
- 0x2066, 0x2070,
+ 0x206a, 0x2070,
0x2074, 0x207e,
0x2080, 0x208e,
- 0x20a0, 0x20be,
+ 0x20a0, 0x20b9,
0x2100, 0x2125,
0x2127, 0x2129,
0x212c, 0x2131,
0x2133, 0x214d,
0x214f, 0x215f,
- 0x2189, 0x218b,
- 0x2190, 0x23fa,
+ 0x2189, 0x2189,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x27ff,
- 0x2900, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
- 0x2e00, 0x2e42,
+ 0x2460, 0x26ff,
+ 0x2701, 0x27ff,
+ 0x2900, 0x2b4c,
+ 0x2b50, 0x2b59,
+ 0x2e00, 0x2e3b,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -17754,10 +16069,8 @@ static const OnigCodePoint CR_Common[] = {
0xa700, 0xa721,
0xa788, 0xa78a,
0xa830, 0xa839,
- 0xa92e, 0xa92e,
- 0xa9cf, 0xa9cf,
- 0xab5b, 0xab5b,
0xfd3e, 0xfd3f,
+ 0xfdfd, 0xfdfd,
0xfe10, 0xfe19,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
@@ -17776,15 +16089,13 @@ static const OnigCodePoint CR_Common[] = {
0x10137, 0x1013f,
0x10190, 0x1019b,
0x101d0, 0x101fc,
- 0x102e1, 0x102fb,
- 0x1bca0, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d166,
0x1d16a, 0x1d17a,
0x1d183, 0x1d184,
0x1d18c, 0x1d1a9,
- 0x1d1ae, 0x1d1e8,
+ 0x1d1ae, 0x1d1dd,
0x1d300, 0x1d356,
0x1d360, 0x1d371,
0x1d400, 0x1d454,
@@ -17811,10 +16122,10 @@ static const OnigCodePoint CR_Common[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -17823,28 +16134,31 @@ static const OnigCodePoint CR_Common[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
}; /* CR_Common */
/* 'Latin': Script */
static const OnigCodePoint CR_Latin[] = {
- 31,
+ 30,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -17868,11 +16182,10 @@ static const OnigCodePoint CR_Latin[] = {
0x2160, 0x2188,
0x2c60, 0x2c7f,
0xa722, 0xa787,
- 0xa78b, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa7ff,
- 0xab30, 0xab5a,
- 0xab5c, 0xab64,
+ 0xa78b, 0xa78e,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7ff,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -17880,11 +16193,10 @@ static const OnigCodePoint CR_Latin[] = {
/* 'Greek': Script */
static const OnigCodePoint CR_Greek[] = {
- 36,
+ 33,
0x0370, 0x0373,
0x0375, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0384, 0x0384,
0x0386, 0x0386,
0x0388, 0x038a,
@@ -17913,9 +16225,7 @@ static const OnigCodePoint CR_Greek[] = {
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
0x2126, 0x2126,
- 0xab65, 0xab65,
- 0x10140, 0x1018c,
- 0x101a0, 0x101a0,
+ 0x10140, 0x1018a,
0x1d200, 0x1d245,
}; /* CR_Greek */
@@ -17923,12 +16233,12 @@ static const OnigCodePoint CR_Greek[] = {
static const OnigCodePoint CR_Cyrillic[] = {
7,
0x0400, 0x0484,
- 0x0487, 0x052f,
+ 0x0487, 0x0527,
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa69f,
- 0xfe2e, 0xfe2f,
+ 0xa640, 0xa697,
+ 0xa69f, 0xa69f,
}; /* CR_Cyrillic */
/* 'Armenian': Script */
@@ -17938,7 +16248,7 @@ static const OnigCodePoint CR_Armenian[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -17958,24 +16268,26 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 54,
+ 56,
0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
0x0620, 0x063f,
0x0641, 0x064a,
- 0x0656, 0x066f,
+ 0x0656, 0x065e,
+ 0x066a, 0x066f,
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
- 0x08a0, 0x08b4,
- 0x08e3, 0x08ff,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfd,
+ 0xfdf0, 0xfdfc,
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
@@ -18031,17 +16343,18 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 4,
+ 5,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x097f,
- 0xa8e0, 0xa8fd,
+ 0x0966, 0x0977,
+ 0x0979, 0x097f,
+ 0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
/* 'Bengali': Script */
static const OnigCodePoint CR_Bengali[] = {
14,
- 0x0980, 0x0983,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -18080,7 +16393,7 @@ static const OnigCodePoint CR_Gurmukhi[] = {
/* 'Gujarati': Script */
static const OnigCodePoint CR_Gujarati[] = {
- 14,
+ 13,
0x0a81, 0x0a83,
0x0a85, 0x0a8d,
0x0a8f, 0x0a91,
@@ -18094,7 +16407,6 @@ static const OnigCodePoint CR_Gujarati[] = {
0x0ad0, 0x0ad0,
0x0ae0, 0x0ae3,
0x0ae6, 0x0af1,
- 0x0af9, 0x0af9,
}; /* CR_Gujarati */
/* 'Oriya': Script */
@@ -18139,17 +16451,18 @@ static const OnigCodePoint CR_Tamil[] = {
/* 'Telugu': Script */
static const OnigCodePoint CR_Telugu[] = {
- 13,
- 0x0c00, 0x0c03,
+ 14,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
+ 0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
@@ -18158,7 +16471,7 @@ static const OnigCodePoint CR_Telugu[] = {
/* 'Kannada': Script */
static const OnigCodePoint CR_Kannada[] = {
14,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -18177,7 +16490,7 @@ static const OnigCodePoint CR_Kannada[] = {
/* 'Malayalam': Script */
static const OnigCodePoint CR_Malayalam[] = {
11,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -18185,14 +16498,14 @@ static const OnigCodePoint CR_Malayalam[] = {
0x0d46, 0x0d48,
0x0d4a, 0x0d4e,
0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
+ 0x0d60, 0x0d63,
0x0d66, 0x0d75,
0x0d79, 0x0d7f,
}; /* CR_Malayalam */
/* 'Sinhala': Script */
static const OnigCodePoint CR_Sinhala[] = {
- 13,
+ 11,
0x0d82, 0x0d83,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -18203,9 +16516,7 @@ static const OnigCodePoint CR_Sinhala[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
- 0x111e1, 0x111f4,
}; /* CR_Sinhala */
/* 'Thai': Script */
@@ -18252,10 +16563,9 @@ static const OnigCodePoint CR_Tibetan[] = {
/* 'Myanmar': Script */
static const OnigCodePoint CR_Myanmar[] = {
- 3,
+ 2,
0x1000, 0x109f,
- 0xa9e0, 0xa9fe,
- 0xaa60, 0xaa7f,
+ 0xaa60, 0xaa7b,
}; /* CR_Myanmar */
/* 'Georgian': Script */
@@ -18329,10 +16639,8 @@ static const OnigCodePoint CR_Ethiopic[] = {
/* 'Cherokee': Script */
static const OnigCodePoint CR_Cherokee[] = {
- 3,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
- 0xab70, 0xabbf,
+ 1,
+ 0x13a0, 0x13f4,
}; /* CR_Cherokee */
/* 'Canadian_Aboriginal': Script */
@@ -18352,7 +16660,7 @@ static const OnigCodePoint CR_Ogham[] = {
static const OnigCodePoint CR_Runic[] = {
2,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
}; /* CR_Runic */
/* 'Khmer': Script */
@@ -18407,7 +16715,7 @@ static const OnigCodePoint CR_Bopomofo[] = {
/* 'Han': Script */
static const OnigCodePoint CR_Han[] = {
- 16,
+ 15,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -18416,13 +16724,12 @@ static const OnigCodePoint CR_Han[] = {
0x3021, 0x3029,
0x3038, 0x303b,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_Han */
@@ -18435,8 +16742,9 @@ static const OnigCodePoint CR_Yi[] = {
/* 'Old_Italic': Script */
static const OnigCodePoint CR_Old_Italic[] = {
- 1,
- 0x10300, 0x10323,
+ 2,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
}; /* CR_Old_Italic */
/* 'Gothic': Script */
@@ -18453,29 +16761,27 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 27,
+ 25,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
+ 0x065f, 0x065f,
0x0670, 0x0670,
0x0951, 0x0952,
- 0x1ab0, 0x1abe,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
0x20d0, 0x20f0,
0x302a, 0x302d,
0x3099, 0x309a,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -18513,7 +16819,7 @@ static const OnigCodePoint CR_Tagbanwa[] = {
/* 'Limbu': Script */
static const OnigCodePoint CR_Limbu[] = {
5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -18650,11 +16956,10 @@ static const OnigCodePoint CR_Balinese[] = {
/* 'Cuneiform': Script */
static const OnigCodePoint CR_Cuneiform[] = {
- 4,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x12480, 0x12543,
+ 3,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
}; /* CR_Cuneiform */
/* 'Phoenician': Script */
@@ -18712,9 +17017,8 @@ static const OnigCodePoint CR_Saurashtra[] = {
/* 'Kayah_Li': Script */
static const OnigCodePoint CR_Kayah_Li[] = {
- 2,
- 0xa900, 0xa92d,
- 0xa92f, 0xa92f,
+ 1,
+ 0xa900, 0xa92f,
}; /* CR_Kayah_Li */
/* 'Rejang': Script */
@@ -18806,7 +17110,7 @@ static const OnigCodePoint CR_Bamum[] = {
static const OnigCodePoint CR_Javanese[] = {
3,
0xa980, 0xa9cd,
- 0xa9d0, 0xa9d9,
+ 0xa9cf, 0xa9d9,
0xa9de, 0xa9df,
}; /* CR_Javanese */
@@ -18866,10 +17170,9 @@ static const OnigCodePoint CR_Batak[] = {
/* 'Brahmi': Script */
static const OnigCodePoint CR_Brahmi[] = {
- 3,
+ 2,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x1107f,
}; /* CR_Brahmi */
/* 'Mandaic': Script */
@@ -18888,10 +17191,9 @@ static const OnigCodePoint CR_Chakma[] = {
/* 'Meroitic_Cursive': Script */
static const OnigCodePoint CR_Meroitic_Cursive[] = {
- 3,
+ 2,
0x109a0, 0x109b7,
- 0x109bc, 0x109cf,
- 0x109d2, 0x109ff,
+ 0x109be, 0x109bf,
}; /* CR_Meroitic_Cursive */
/* 'Meroitic_Hieroglyphs': Script */
@@ -18911,8 +17213,8 @@ static const OnigCodePoint CR_Miao[] = {
/* 'Sharada': Script */
static const OnigCodePoint CR_Sharada[] = {
2,
- 0x11180, 0x111cd,
- 0x111d0, 0x111df,
+ 0x11180, 0x111c8,
+ 0x111d0, 0x111d9,
}; /* CR_Sharada */
/* 'Sora_Sompeng': Script */
@@ -18929,241 +17231,14 @@ static const OnigCodePoint CR_Takri[] = {
0x116c0, 0x116c9,
}; /* CR_Takri */
-/* 'Caucasian_Albanian': Script */
-static const OnigCodePoint CR_Caucasian_Albanian[] = {
- 2,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
-}; /* CR_Caucasian_Albanian */
-
-/* 'Bassa_Vah': Script */
-static const OnigCodePoint CR_Bassa_Vah[] = {
- 2,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
-}; /* CR_Bassa_Vah */
-
-/* 'Duployan': Script */
-static const OnigCodePoint CR_Duployan[] = {
- 5,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bc9f,
-}; /* CR_Duployan */
-
-/* 'Elbasan': Script */
-static const OnigCodePoint CR_Elbasan[] = {
- 1,
- 0x10500, 0x10527,
-}; /* CR_Elbasan */
-
-/* 'Grantha': Script */
-static const OnigCodePoint CR_Grantha[] = {
- 15,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
-}; /* CR_Grantha */
-
-/* 'Pahawh_Hmong': Script */
-static const OnigCodePoint CR_Pahawh_Hmong[] = {
- 5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
-}; /* CR_Pahawh_Hmong */
-
-/* 'Khojki': Script */
-static const OnigCodePoint CR_Khojki[] = {
- 2,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
-}; /* CR_Khojki */
-
-/* 'Linear_A': Script */
-static const OnigCodePoint CR_Linear_A[] = {
- 3,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
-}; /* CR_Linear_A */
-
-/* 'Mahajani': Script */
-static const OnigCodePoint CR_Mahajani[] = {
- 1,
- 0x11150, 0x11176,
-}; /* CR_Mahajani */
-
-/* 'Manichaean': Script */
-static const OnigCodePoint CR_Manichaean[] = {
- 2,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
-}; /* CR_Manichaean */
-
-/* 'Mende_Kikakui': Script */
-static const OnigCodePoint CR_Mende_Kikakui[] = {
- 2,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
-}; /* CR_Mende_Kikakui */
-
-/* 'Modi': Script */
-static const OnigCodePoint CR_Modi[] = {
- 2,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
-}; /* CR_Modi */
-
-/* 'Mro': Script */
-static const OnigCodePoint CR_Mro[] = {
- 3,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
-}; /* CR_Mro */
-
-/* 'Old_North_Arabian': Script */
-static const OnigCodePoint CR_Old_North_Arabian[] = {
- 1,
- 0x10a80, 0x10a9f,
-}; /* CR_Old_North_Arabian */
-
-/* 'Nabataean': Script */
-static const OnigCodePoint CR_Nabataean[] = {
- 2,
- 0x10880, 0x1089e,
- 0x108a7, 0x108af,
-}; /* CR_Nabataean */
-
-/* 'Palmyrene': Script */
-static const OnigCodePoint CR_Palmyrene[] = {
- 1,
- 0x10860, 0x1087f,
-}; /* CR_Palmyrene */
-
-/* 'Pau_Cin_Hau': Script */
-static const OnigCodePoint CR_Pau_Cin_Hau[] = {
- 1,
- 0x11ac0, 0x11af8,
-}; /* CR_Pau_Cin_Hau */
-
-/* 'Old_Permic': Script */
-static const OnigCodePoint CR_Old_Permic[] = {
- 1,
- 0x10350, 0x1037a,
-}; /* CR_Old_Permic */
-
-/* 'Psalter_Pahlavi': Script */
-static const OnigCodePoint CR_Psalter_Pahlavi[] = {
- 3,
- 0x10b80, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
-}; /* CR_Psalter_Pahlavi */
-
-/* 'Siddham': Script */
-static const OnigCodePoint CR_Siddham[] = {
- 2,
- 0x11580, 0x115b5,
- 0x115b8, 0x115dd,
-}; /* CR_Siddham */
-
-/* 'Khudawadi': Script */
-static const OnigCodePoint CR_Khudawadi[] = {
- 2,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
-}; /* CR_Khudawadi */
-
-/* 'Tirhuta': Script */
-static const OnigCodePoint CR_Tirhuta[] = {
- 2,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
-}; /* CR_Tirhuta */
-
-/* 'Warang_Citi': Script */
-static const OnigCodePoint CR_Warang_Citi[] = {
- 2,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
-}; /* CR_Warang_Citi */
-
-/* 'Ahom': Script */
-static const OnigCodePoint CR_Ahom[] = {
- 3,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x1173f,
-}; /* CR_Ahom */
-
-/* 'Anatolian_Hieroglyphs': Script */
-static const OnigCodePoint CR_Anatolian_Hieroglyphs[] = {
- 1,
- 0x14400, 0x14646,
-}; /* CR_Anatolian_Hieroglyphs */
-
-/* 'Hatran': Script */
-static const OnigCodePoint CR_Hatran[] = {
- 3,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
- 0x108fb, 0x108ff,
-}; /* CR_Hatran */
-
-/* 'Multani': Script */
-static const OnigCodePoint CR_Multani[] = {
- 5,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a9,
-}; /* CR_Multani */
-
-/* 'Old_Hungarian': Script */
-static const OnigCodePoint CR_Old_Hungarian[] = {
- 3,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x10cfa, 0x10cff,
-}; /* CR_Old_Hungarian */
-
-/* 'SignWriting': Script */
-static const OnigCodePoint CR_SignWriting[] = {
- 3,
- 0x1d800, 0x1da8b,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
-}; /* CR_SignWriting */
-
/* 'White_Space': Binary Property */
#define CR_White_Space CR_Space
/* 'Bidi_Control': Binary Property */
static const OnigCodePoint CR_Bidi_Control[] = {
- 4,
- 0x061c, 0x061c,
+ 2,
0x200e, 0x200f,
0x202a, 0x202e,
- 0x2066, 0x2069,
}; /* CR_Bidi_Control */
/* 'Join_Control': Binary Property */
@@ -19174,7 +17249,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 21,
+ 20,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -19188,7 +17263,6 @@ static const OnigCodePoint CR_Dash[] = {
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
0x2e3a, 0x2e3b,
- 0x2e40, 0x2e40,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -19215,14 +17289,13 @@ static const OnigCodePoint CR_Hyphen[] = {
/* 'Quotation_Mark': Binary Property */
static const OnigCodePoint CR_Quotation_Mark[] = {
- 13,
+ 12,
0x0022, 0x0022,
0x0027, 0x0027,
0x00ab, 0x00ab,
0x00bb, 0x00bb,
0x2018, 0x201f,
0x2039, 0x203a,
- 0x2e42, 0x2e42,
0x300c, 0x300f,
0x301d, 0x301f,
0xfe41, 0xfe44,
@@ -19233,7 +17306,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 90,
+ 70,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -19260,7 +17333,6 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x1361, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
- 0x1735, 0x1736,
0x17d4, 0x17d6,
0x17da, 0x17da,
0x1802, 0x1805,
@@ -19274,8 +17346,6 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x203c, 0x203d,
0x2047, 0x2049,
0x2e2e, 0x2e2e,
- 0x2e3c, 0x2e3c,
- 0x2e41, 0x2e41,
0x3001, 0x3002,
0xa4fe, 0xa4ff,
0xa60d, 0xa60f,
@@ -19301,34 +17371,17 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x103d0, 0x103d0,
0x10857, 0x10857,
0x1091f, 0x1091f,
- 0x10a56, 0x10a57,
- 0x10af0, 0x10af5,
0x10b3a, 0x10b3f,
- 0x10b99, 0x10b9c,
0x11047, 0x1104d,
0x110be, 0x110c1,
0x11141, 0x11143,
0x111c5, 0x111c6,
- 0x111cd, 0x111cd,
- 0x111de, 0x111df,
- 0x11238, 0x1123c,
- 0x112a9, 0x112a9,
- 0x115c2, 0x115c5,
- 0x115c9, 0x115d7,
- 0x11641, 0x11642,
- 0x1173c, 0x1173e,
- 0x12470, 0x12474,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b39,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
- 0x1da87, 0x1da8a,
+ 0x12470, 0x12473,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 134,
+ 133,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -19370,7 +17423,6 @@ static const OnigCodePoint CR_Other_Math[] = {
0x21d5, 0x21db,
0x21dd, 0x21dd,
0x21e4, 0x21e5,
- 0x2308, 0x230b,
0x23b4, 0x23b5,
0x23b7, 0x23b7,
0x23d0, 0x23d0,
@@ -19481,7 +17533,7 @@ static const OnigCodePoint CR_Hex_Digit[] = {
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 178,
+ 158,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -19503,8 +17555,9 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x081b, 0x0823,
0x0825, 0x0827,
0x0829, 0x082c,
- 0x08e3, 0x08e9,
- 0x08f0, 0x0903,
+ 0x08e4, 0x08e9,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
0x094e, 0x094f,
@@ -19539,19 +17592,19 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x0bc6, 0x0bc8,
0x0bca, 0x0bcc,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c3e, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0cbe, 0x0cc4,
0x0cc6, 0x0cc8,
0x0cca, 0x0ccc,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d3e, 0x0d44,
0x0d46, 0x0d48,
0x0d4a, 0x0d4c,
@@ -19591,6 +17644,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x18a9, 0x18a9,
0x1920, 0x192b,
0x1930, 0x1938,
+ 0x19b0, 0x19c0,
+ 0x19c8, 0x19c9,
0x1a17, 0x1a1b,
0x1a55, 0x1a5e,
0x1a61, 0x1a74,
@@ -19602,11 +17657,10 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
0x1cf2, 0x1cf3,
- 0x1de7, 0x1df4,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
0xa674, 0xa67b,
- 0xa69e, 0xa69f,
+ 0xa69f, 0xa69f,
0xa823, 0xa827,
0xa880, 0xa881,
0xa8b4, 0xa8c3,
@@ -19625,7 +17679,6 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
@@ -19637,51 +17690,29 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x11127, 0x11132,
0x11180, 0x11182,
0x111b3, 0x111bf,
- 0x1122c, 0x11234,
- 0x11237, 0x11237,
- 0x112df, 0x112e8,
- 0x11300, 0x11303,
- 0x1133e, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134c,
- 0x11357, 0x11357,
- 0x11362, 0x11363,
- 0x114b0, 0x114c1,
- 0x115af, 0x115b5,
- 0x115b8, 0x115be,
- 0x115dc, 0x115dd,
- 0x11630, 0x1163e,
- 0x11640, 0x11640,
0x116ab, 0x116b5,
- 0x1171d, 0x1172a,
- 0x16b30, 0x16b36,
0x16f51, 0x16f7e,
- 0x1bc9e, 0x1bc9e,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Other_Alphabetic */
/* 'Ideographic': Binary Property */
static const OnigCodePoint CR_Ideographic[] = {
- 12,
+ 11,
0x3006, 0x3007,
0x3021, 0x3029,
0x3038, 0x303a,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xf900, 0xfa6d,
0xfa70, 0xfad9,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
0x2f800, 0x2fa1d,
}; /* CR_Ideographic */
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 147,
+ 125,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -19710,7 +17741,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0x07a6, 0x07b0,
0x07eb, 0x07f5,
0x0818, 0x0819,
- 0x08e3, 0x08fe,
+ 0x08e4, 0x08fe,
0x093c, 0x093c,
0x094d, 0x094d,
0x0951, 0x0954,
@@ -19750,7 +17781,6 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1939, 0x193b,
0x1a75, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abd,
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
@@ -19760,10 +17790,8 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1cd0, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
0x1d2c, 0x1d6a,
0x1dc4, 0x1dcf,
- 0x1df5, 0x1df5,
0x1dfd, 0x1dff,
0x1fbd, 0x1fbd,
0x1fbf, 0x1fc1,
@@ -19779,7 +17807,6 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa66f, 0xa66f,
0xa67c, 0xa67d,
0xa67f, 0xa67f,
- 0xa69c, 0xa69d,
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
@@ -19790,50 +17817,32 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa953, 0xa953,
0xa9b3, 0xa9b3,
0xa9c0, 0xa9c0,
- 0xa9e5, 0xa9e5,
- 0xaa7b, 0xaa7d,
+ 0xaa7b, 0xaa7b,
0xaabf, 0xaac2,
0xaaf6, 0xaaf6,
- 0xab5b, 0xab5f,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
- 0xfe20, 0xfe2f,
+ 0xfe20, 0xfe26,
0xff3e, 0xff3e,
0xff40, 0xff40,
0xff70, 0xff70,
0xff9e, 0xff9f,
0xffe3, 0xffe3,
- 0x102e0, 0x102e0,
- 0x10ae5, 0x10ae6,
0x110b9, 0x110ba,
0x11133, 0x11134,
- 0x11173, 0x11173,
0x111c0, 0x111c0,
- 0x111ca, 0x111cc,
- 0x11235, 0x11236,
- 0x112e9, 0x112ea,
- 0x1133c, 0x1133c,
- 0x1134d, 0x1134d,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114c2, 0x114c3,
- 0x115bf, 0x115c0,
- 0x1163f, 0x1163f,
0x116b6, 0x116b7,
- 0x1172b, 0x1172b,
- 0x16af0, 0x16af4,
0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
- 0x1e8d0, 0x1e8d6,
}; /* CR_Diacritic */
/* 'Extender': Binary Property */
static const OnigCodePoint CR_Extender[] = {
- 26,
+ 22,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
@@ -19852,19 +17861,15 @@ static const OnigCodePoint CR_Extender[] = {
0xa015, 0xa015,
0xa60c, 0xa60c,
0xa9cf, 0xa9cf,
- 0xa9e6, 0xa9e6,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
0xaaf3, 0xaaf4,
0xff70, 0xff70,
- 0x1135d, 0x1135d,
- 0x115c6, 0x115c8,
- 0x16b42, 0x16b43,
}; /* CR_Extender */
/* 'Other_Lowercase': Binary Property */
static const OnigCodePoint CR_Other_Lowercase[] = {
- 20,
+ 18,
0x00aa, 0x00aa,
0x00ba, 0x00ba,
0x02b0, 0x02b8,
@@ -19881,20 +17886,15 @@ static const OnigCodePoint CR_Other_Lowercase[] = {
0x2170, 0x217f,
0x24d0, 0x24e9,
0x2c7c, 0x2c7d,
- 0xa69c, 0xa69d,
0xa770, 0xa770,
0xa7f8, 0xa7f9,
- 0xab5c, 0xab5f,
}; /* CR_Other_Lowercase */
/* 'Other_Uppercase': Binary Property */
static const OnigCodePoint CR_Other_Uppercase[] = {
- 5,
+ 2,
0x2160, 0x216f,
0x24b6, 0x24cf,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Other_Uppercase */
/* 'Noncharacter_Code_Point': Binary Property */
@@ -19922,7 +17922,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 22,
+ 17,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -19938,11 +17938,6 @@ static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
0x200c, 0x200d,
0x302e, 0x302f,
0xff9e, 0xff9f,
- 0x1133e, 0x1133e,
- 0x11357, 0x11357,
- 0x114b0, 0x114b0,
- 0x114bd, 0x114bd,
- 0x115af, 0x115af,
0x1d165, 0x1d165,
0x1d16e, 0x1d172,
}; /* CR_Other_Grapheme_Extend */
@@ -19970,9 +17965,9 @@ static const OnigCodePoint CR_Radical[] = {
/* 'Unified_Ideograph': Binary Property */
static const OnigCodePoint CR_Unified_Ideograph[] = {
- 13,
+ 12,
0x3400, 0x4db5,
- 0x4e00, 0x9fd5,
+ 0x4e00, 0x9fcc,
0xfa0e, 0xfa0f,
0xfa11, 0xfa11,
0xfa13, 0xfa14,
@@ -19983,7 +17978,6 @@ static const OnigCodePoint CR_Unified_Ideograph[] = {
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
}; /* CR_Unified_Ideograph */
/* 'Other_Default_Ignorable_Code_Point': Binary Property */
@@ -19992,7 +17986,7 @@ static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
0x034f, 0x034f,
0x115f, 0x1160,
0x17b4, 0x17b5,
- 0x2065, 0x2065,
+ 0x2065, 0x2069,
0x3164, 0x3164,
0xffa0, 0xffa0,
0xfff0, 0xfff8,
@@ -20013,7 +18007,7 @@ static const OnigCodePoint CR_Deprecated[] = {
0x206a, 0x206f,
0x2329, 0x232a,
0xe0001, 0xe0001,
- 0xe007f, 0xe007f,
+ 0xe0020, 0xe007f,
}; /* CR_Deprecated */
/* 'Soft_Dotted': Binary Property */
@@ -20054,11 +18048,9 @@ static const OnigCodePoint CR_Soft_Dotted[] = {
/* 'Logical_Order_Exception': Binary Property */
static const OnigCodePoint CR_Logical_Order_Exception[] = {
- 7,
+ 5,
0x0e40, 0x0e44,
0x0ec0, 0x0ec4,
- 0x19b5, 0x19b7,
- 0x19ba, 0x19ba,
0xaab5, 0xaab6,
0xaab9, 0xaab9,
0xaabb, 0xaabc,
@@ -20083,10 +18075,12 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 64,
+ 50,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
+ 0x055c, 0x055c,
+ 0x055e, 0x055e,
0x0589, 0x0589,
0x061f, 0x061f,
0x06d4, 0x06d4,
@@ -20109,7 +18103,6 @@ static const OnigCodePoint CR_STerm[] = {
0x203c, 0x203d,
0x2047, 0x2049,
0x2e2e, 0x2e2e,
- 0x2e3c, 0x2e3c,
0x3002, 0x3002,
0xa4ff, 0xa4ff,
0xa60e, 0xa60f,
@@ -20133,21 +18126,6 @@ static const OnigCodePoint CR_STerm[] = {
0x110be, 0x110c1,
0x11141, 0x11143,
0x111c5, 0x111c6,
- 0x111cd, 0x111cd,
- 0x111de, 0x111df,
- 0x11238, 0x11239,
- 0x1123b, 0x1123c,
- 0x112a9, 0x112a9,
- 0x115c2, 0x115c3,
- 0x115c9, 0x115d7,
- 0x11641, 0x11642,
- 0x1173c, 0x1173e,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b38,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
- 0x1da88, 0x1da88,
}; /* CR_STerm */
/* 'Variation_Selector': Binary Property */
@@ -20203,22 +18181,23 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 611,
+ 537,
0x0378, 0x0379,
- 0x0380, 0x0383,
+ 0x037f, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0530, 0x0530,
+ 0x0528, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058c,
+ 0x058b, 0x058e,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x061d, 0x061d,
+ 0x0605, 0x0605,
+ 0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
0x07b2, 0x07bf,
@@ -20227,7 +18206,11 @@ static const OnigCodePoint CR_Unknown[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08b5, 0x08e2,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -20270,8 +18253,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0ace, 0x0acf,
0x0ad1, 0x0adf,
0x0ae4, 0x0ae5,
- 0x0af2, 0x0af8,
- 0x0afa, 0x0b00,
+ 0x0af2, 0x0b00,
0x0b04, 0x0b04,
0x0b0d, 0x0b0e,
0x0b11, 0x0b12,
@@ -20301,20 +18283,21 @@ static const OnigCodePoint CR_Unknown[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0bff,
+ 0x0bfb, 0x0c00,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
0x0c4e, 0x0c54,
0x0c57, 0x0c57,
- 0x0c5b, 0x0c5f,
+ 0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c80,
+ 0x0c80, 0x0c81,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -20328,7 +18311,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d00,
+ 0x0cf3, 0x0d01,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -20336,7 +18319,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0d45, 0x0d45,
0x0d49, 0x0d49,
0x0d4f, 0x0d56,
- 0x0d58, 0x0d5e,
+ 0x0d58, 0x0d5f,
0x0d64, 0x0d65,
0x0d76, 0x0d78,
0x0d80, 0x0d81,
@@ -20349,8 +18332,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0de5,
- 0x0df0, 0x0df1,
+ 0x0de0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -20399,10 +18381,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x135b, 0x135c,
0x137d, 0x137f,
0x139a, 0x139f,
- 0x13f6, 0x13f7,
- 0x13fe, 0x13ff,
+ 0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f9, 0x16ff,
+ 0x16f1, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -20418,7 +18399,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191f, 0x191f,
+ 0x191d, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -20432,8 +18413,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aaf,
- 0x1abf, 0x1aff,
+ 0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -20441,9 +18421,8 @@ static const OnigCodePoint CR_Unknown[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cf7,
- 0x1cfa, 0x1cff,
- 0x1df6, 0x1dfb,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -20460,22 +18439,19 @@ static const OnigCodePoint CR_Unknown[] = {
0x1ff0, 0x1ff1,
0x1ff5, 0x1ff5,
0x1fff, 0x1fff,
- 0x2065, 0x2065,
+ 0x2065, 0x2069,
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20bf, 0x20cf,
+ 0x20ba, 0x20cf,
0x20f1, 0x20ff,
- 0x218c, 0x218f,
- 0x23fb, 0x23ff,
+ 0x218a, 0x218f,
+ 0x23f4, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2b74, 0x2b75,
- 0x2b96, 0x2b97,
- 0x2bba, 0x2bbc,
- 0x2bc9, 0x2bc9,
- 0x2bd2, 0x2beb,
- 0x2bf0, 0x2bff,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -20493,7 +18469,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e43, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -20508,35 +18484,37 @@ static const OnigCodePoint CR_Unknown[] = {
0x321f, 0x321f,
0x32ff, 0x32ff,
0x4db6, 0x4dbf,
- 0x9fd6, 0x9fff,
+ 0x9fcd, 0x9fff,
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
- 0xa7ae, 0xa7af,
- 0xa7b8, 0xa7f6,
+ 0xa78f, 0xa78f,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
0xa8c5, 0xa8cd,
0xa8da, 0xa8df,
- 0xa8fe, 0xa8ff,
+ 0xa8fc, 0xa8ff,
0xa954, 0xa95e,
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9ff, 0xa9ff,
+ 0xa9e0, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xab2f,
- 0xab66, 0xab6f,
+ 0xab2f, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -20557,6 +18535,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
+ 0xfe27, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -20580,42 +18559,31 @@ static const OnigCodePoint CR_Unknown[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018d, 0x1018f,
- 0x1019c, 0x1019f,
- 0x101a1, 0x101cf,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102df,
- 0x102fc, 0x102ff,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
0x10324, 0x1032f,
- 0x1034b, 0x1034f,
- 0x1037b, 0x1037f,
+ 0x1034b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x104ff,
- 0x10528, 0x1052f,
- 0x10564, 0x1056e,
- 0x10570, 0x105ff,
- 0x10737, 0x1073f,
- 0x10756, 0x1075f,
- 0x10768, 0x107ff,
+ 0x104aa, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x1089f, 0x108a6,
- 0x108b0, 0x108df,
- 0x108f3, 0x108f3,
- 0x108f6, 0x108fa,
+ 0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
- 0x109b8, 0x109bb,
- 0x109d0, 0x109d1,
+ 0x109b8, 0x109bd,
+ 0x109c0, 0x109ff,
0x10a04, 0x10a04,
0x10a07, 0x10a0b,
0x10a14, 0x10a14,
@@ -20624,98 +18592,36 @@ static const OnigCodePoint CR_Unknown[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10aa0, 0x10abf,
- 0x10ae7, 0x10aea,
- 0x10af7, 0x10aff,
+ 0x10a80, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b92, 0x10b98,
- 0x10b9d, 0x10ba8,
- 0x10bb0, 0x10bff,
- 0x10c49, 0x10c7f,
- 0x10cb3, 0x10cbf,
- 0x10cf3, 0x10cf9,
- 0x10d00, 0x10e5f,
+ 0x10b80, 0x10bff,
+ 0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107e,
+ 0x11070, 0x1107f,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1114f,
- 0x11177, 0x1117f,
- 0x111ce, 0x111cf,
- 0x111e0, 0x111e0,
- 0x111f5, 0x111ff,
- 0x11212, 0x11212,
- 0x1123e, 0x1127f,
- 0x11287, 0x11287,
- 0x11289, 0x11289,
- 0x1128e, 0x1128e,
- 0x1129e, 0x1129e,
- 0x112aa, 0x112af,
- 0x112eb, 0x112ef,
- 0x112fa, 0x112ff,
- 0x11304, 0x11304,
- 0x1130d, 0x1130e,
- 0x11311, 0x11312,
- 0x11329, 0x11329,
- 0x11331, 0x11331,
- 0x11334, 0x11334,
- 0x1133a, 0x1133b,
- 0x11345, 0x11346,
- 0x11349, 0x1134a,
- 0x1134e, 0x1134f,
- 0x11351, 0x11356,
- 0x11358, 0x1135c,
- 0x11364, 0x11365,
- 0x1136d, 0x1136f,
- 0x11375, 0x1147f,
- 0x114c8, 0x114cf,
- 0x114da, 0x1157f,
- 0x115b6, 0x115b7,
- 0x115de, 0x115ff,
- 0x11645, 0x1164f,
- 0x1165a, 0x1167f,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
0x116b8, 0x116bf,
- 0x116ca, 0x116ff,
- 0x1171a, 0x1171c,
- 0x1172c, 0x1172f,
- 0x11740, 0x1189f,
- 0x118f3, 0x118fe,
- 0x11900, 0x11abf,
- 0x11af9, 0x11fff,
- 0x1239a, 0x123ff,
- 0x1246f, 0x1246f,
- 0x12475, 0x1247f,
- 0x12544, 0x12fff,
- 0x1342f, 0x143ff,
- 0x14647, 0x167ff,
- 0x16a39, 0x16a3f,
- 0x16a5f, 0x16a5f,
- 0x16a6a, 0x16a6d,
- 0x16a70, 0x16acf,
- 0x16aee, 0x16aef,
- 0x16af6, 0x16aff,
- 0x16b46, 0x16b4f,
- 0x16b5a, 0x16b5a,
- 0x16b62, 0x16b62,
- 0x16b78, 0x16b7c,
- 0x16b90, 0x16eff,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
+ 0x1342f, 0x167ff,
+ 0x16a39, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1bbff,
- 0x1bc6b, 0x1bc6f,
- 0x1bc7d, 0x1bc7f,
- 0x1bc89, 0x1bc8f,
- 0x1bc9a, 0x1bc9b,
- 0x1bca4, 0x1cfff,
+ 0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
- 0x1d1e9, 0x1d1ff,
+ 0x1d1de, 0x1d1ff,
0x1d246, 0x1d2ff,
0x1d357, 0x1d35f,
0x1d372, 0x1d3ff,
@@ -20739,11 +18645,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1da8c, 0x1da9a,
- 0x1daa0, 0x1daa0,
- 0x1dab0, 0x1e7ff,
- 0x1e8c5, 0x1e8c6,
- 0x1e8d7, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -20781,10 +18683,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0c0, 0x1f0c0,
+ 0x1f0bf, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0f6, 0x1f0ff,
- 0x1f10d, 0x1f10f,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -20792,32 +18694,33 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 0x1f57a, 0x1f57a,
- 0x1f5a4, 0x1f5a4,
- 0x1f6d1, 0x1f6df,
- 0x1f6ed, 0x1f6ef,
- 0x1f6f4, 0x1f6ff,
- 0x1f774, 0x1f77f,
- 0x1f7d5, 0x1f7ff,
- 0x1f80c, 0x1f80f,
- 0x1f848, 0x1f84f,
- 0x1f85a, 0x1f85f,
- 0x1f888, 0x1f88f,
- 0x1f8ae, 0x1f90f,
- 0x1f919, 0x1f97f,
- 0x1f985, 0x1f9bf,
- 0x1f9c1, 0x1ffff,
+ 0x1f321, 0x1f32f,
+ 0x1f336, 0x1f336,
+ 0x1f37d, 0x1f37f,
+ 0x1f394, 0x1f39f,
+ 0x1f3c5, 0x1f3c5,
+ 0x1f3cb, 0x1f3df,
+ 0x1f3f1, 0x1f3ff,
+ 0x1f43f, 0x1f43f,
+ 0x1f441, 0x1f441,
+ 0x1f4f8, 0x1f4f8,
+ 0x1f4fd, 0x1f4ff,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
+ 0x1f568, 0x1f5fa,
+ 0x1f641, 0x1f644,
+ 0x1f650, 0x1f67f,
+ 0x1f6c6, 0x1f6ff,
+ 0x1f774, 0x1ffff,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
- 0x2b81e, 0x2b81f,
- 0x2cea2, 0x2f7ff,
+ 0x2b81e, 0x2f7ff,
0x2fa1e, 0xe0000,
0xe0002, 0xe001f,
0xe0080, 0xe00ff,
0xe01f0, 0x10ffff,
}; /* CR_Unknown */
-#ifdef USE_UNICODE_AGE_PROPERTIES
/* 'Age_1_1': Derived Age 1.1 */
static const OnigCodePoint CR_Age_1_1[] = {
288,
@@ -26255,2358 +24158,6 @@ static const OnigCodePoint CR_Age_6_1[] = {
0xefffe, 0x10ffff,
}; /* CR_Age_6_1 */
-/* 'Age_6_2': Derived Age 6.2 */
-static const OnigCodePoint CR_Age_6_2[] = {
- 549,
- 0x0000, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058f, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061b,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f4,
- 0x1400, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x206a, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20ba,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcc,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa697,
- 0xa69f, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fb,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018a,
- 0x10190, 0x1019b,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1085f,
- 0x10900, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109be, 0x109bf,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
- 0x10c00, 0x10c48,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x11080, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11180, 0x111c8,
- 0x111d0, 0x111d9,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1dd,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f320,
- 0x1f330, 0x1f335,
- 0x1f337, 0x1f37c,
- 0x1f380, 0x1f393,
- 0x1f3a0, 0x1f3c4,
- 0x1f3c6, 0x1f3ca,
- 0x1f3e0, 0x1f3f0,
- 0x1f400, 0x1f43e,
- 0x1f440, 0x1f440,
- 0x1f442, 0x1f4f7,
- 0x1f4f9, 0x1f4fc,
- 0x1f500, 0x1f53d,
- 0x1f540, 0x1f543,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_6_2 */
-
-/* 'Age_6_3': Derived Age 6.3 */
-static const OnigCodePoint CR_Age_6_3[] = {
- 549,
- 0x0000, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058f, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061c,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f4,
- 0x1400, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x2066, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20ba,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcc,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa697,
- 0xa69f, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fb,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018a,
- 0x10190, 0x1019b,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1085f,
- 0x10900, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109be, 0x109bf,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
- 0x10c00, 0x10c48,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x11080, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11180, 0x111c8,
- 0x111d0, 0x111d9,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1dd,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f320,
- 0x1f330, 0x1f335,
- 0x1f337, 0x1f37c,
- 0x1f380, 0x1f393,
- 0x1f3a0, 0x1f3c4,
- 0x1f3c6, 0x1f3ca,
- 0x1f3e0, 0x1f3f0,
- 0x1f400, 0x1f43e,
- 0x1f440, 0x1f440,
- 0x1f442, 0x1f4f7,
- 0x1f4f9, 0x1f4fc,
- 0x1f500, 0x1f53d,
- 0x1f540, 0x1f543,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_6_3 */
-
-/* 'Age_7_0': Derived Age 7.0 */
-static const OnigCodePoint CR_Age_7_0[] = {
- 610,
- 0x0000, 0x0377,
- 0x037a, 0x037f,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x052f,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058d, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x061c,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f4,
- 0x1400, 0x169c,
- 0x16a0, 0x16f8,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191e,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x2066, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20bd,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23fa,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcc,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa69d,
- 0xa69f, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fb,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xab30, 0xab5f,
- 0xab64, 0xab65,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe2d,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018c,
- 0x10190, 0x1019b,
- 0x101a0, 0x101a0,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
- 0x10330, 0x1034a,
- 0x10350, 0x1037a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x10900, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109be, 0x109bf,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
- 0x10c00, 0x10c48,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x1107f, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11150, 0x11176,
- 0x11180, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c9,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1dd,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
- 0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_7_0 */
-
-/* 'Age_8_0': Derived Age 8.0 */
-static const OnigCodePoint CR_Age_8_0[] = {
- 623,
- 0x0000, 0x0377,
- 0x037a, 0x037f,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x052f,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058d, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x061c,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08b4,
- 0x08e3, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0af9, 0x0af9,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c5a,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d5f, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f5,
- 0x13f8, 0x13fd,
- 0x1400, 0x169c,
- 0x16a0, 0x16f8,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191e,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x2066, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20be,
- 0x20d0, 0x20f0,
- 0x2100, 0x218b,
- 0x2190, 0x23fa,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2bec, 0x2bef,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fd5,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa6f7,
- 0xa700, 0xa7ad,
- 0xa7b0, 0xa7b7,
- 0xa7f7, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fd,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xab30, 0xab65,
- 0xab70, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018c,
- 0x10190, 0x1019b,
- 0x101a0, 0x101a0,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
- 0x10330, 0x1034a,
- 0x10350, 0x1037a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x108e0, 0x108f2,
- 0x108f4, 0x108f5,
- 0x108fb, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109bc, 0x109cf,
- 0x109d2, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
- 0x10c00, 0x10c48,
- 0x10c80, 0x10cb2,
- 0x10cc0, 0x10cf2,
- 0x10cfa, 0x10cff,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x1107f, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11150, 0x11176,
- 0x11180, 0x111cd,
- 0x111d0, 0x111df,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x11280, 0x11286,
- 0x11288, 0x11288,
- 0x1128a, 0x1128d,
- 0x1128f, 0x1129d,
- 0x1129f, 0x112a9,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11300, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11350, 0x11350,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115dd,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x11700, 0x11719,
- 0x1171d, 0x1172b,
- 0x11730, 0x1173f,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12399,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x12480, 0x12543,
- 0x13000, 0x1342e,
- 0x14400, 0x14646,
- 0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1e8,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1da8b,
- 0x1da9b, 0x1da9f,
- 0x1daa1, 0x1daaf,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f6d0,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
- 0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1f910, 0x1f918,
- 0x1f980, 0x1f984,
- 0x1f9c0, 0x1f9c0,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2b820, 0x2cea1,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_8_0 */
-#endif /* USE_UNICODE_AGE_PROPERTIES */
-
/* 'In_Basic_Latin': Block */
#define CR_In_Basic_Latin CR_ASCII
@@ -28934,12 +24485,6 @@ static const OnigCodePoint CR_In_Tai_Tham[] = {
0x1a20, 0x1aaf,
}; /* CR_In_Tai_Tham */
-/* 'In_Combining_Diacritical_Marks_Extended': Block */
-static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Extended[] = {
- 1,
- 0x1ab0, 0x1aff,
-}; /* CR_In_Combining_Diacritical_Marks_Extended */
-
/* 'In_Balinese': Block */
static const OnigCodePoint CR_In_Balinese[] = {
1,
@@ -29376,10 +24921,7 @@ static const OnigCodePoint CR_In_Devanagari_Extended[] = {
}; /* CR_In_Devanagari_Extended */
/* 'In_Kayah_Li': Block */
-static const OnigCodePoint CR_In_Kayah_Li[] = {
- 1,
- 0xa900, 0xa92f,
-}; /* CR_In_Kayah_Li */
+#define CR_In_Kayah_Li CR_Kayah_Li
/* 'In_Rejang': Block */
static const OnigCodePoint CR_In_Rejang[] = {
@@ -29399,12 +24941,6 @@ static const OnigCodePoint CR_In_Javanese[] = {
0xa980, 0xa9df,
}; /* CR_In_Javanese */
-/* 'In_Myanmar_Extended_B': Block */
-static const OnigCodePoint CR_In_Myanmar_Extended_B[] = {
- 1,
- 0xa9e0, 0xa9ff,
-}; /* CR_In_Myanmar_Extended_B */
-
/* 'In_Cham': Block */
static const OnigCodePoint CR_In_Cham[] = {
1,
@@ -29435,18 +24971,6 @@ static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = {
0xab00, 0xab2f,
}; /* CR_In_Ethiopic_Extended_A */
-/* 'In_Latin_Extended_E': Block */
-static const OnigCodePoint CR_In_Latin_Extended_E[] = {
- 1,
- 0xab30, 0xab6f,
-}; /* CR_In_Latin_Extended_E */
-
-/* 'In_Cherokee_Supplement': Block */
-static const OnigCodePoint CR_In_Cherokee_Supplement[] = {
- 1,
- 0xab70, 0xabbf,
-}; /* CR_In_Cherokee_Supplement */
-
/* 'In_Meetei_Mayek': Block */
static const OnigCodePoint CR_In_Meetei_Mayek[] = {
1,
@@ -29603,12 +25127,6 @@ static const OnigCodePoint CR_In_Carian[] = {
0x102a0, 0x102df,
}; /* CR_In_Carian */
-/* 'In_Coptic_Epact_Numbers': Block */
-static const OnigCodePoint CR_In_Coptic_Epact_Numbers[] = {
- 1,
- 0x102e0, 0x102ff,
-}; /* CR_In_Coptic_Epact_Numbers */
-
/* 'In_Old_Italic': Block */
static const OnigCodePoint CR_In_Old_Italic[] = {
1,
@@ -29621,12 +25139,6 @@ static const OnigCodePoint CR_In_Gothic[] = {
0x10330, 0x1034f,
}; /* CR_In_Gothic */
-/* 'In_Old_Permic': Block */
-static const OnigCodePoint CR_In_Old_Permic[] = {
- 1,
- 0x10350, 0x1037f,
-}; /* CR_In_Old_Permic */
-
/* 'In_Ugaritic': Block */
static const OnigCodePoint CR_In_Ugaritic[] = {
1,
@@ -29651,24 +25163,6 @@ static const OnigCodePoint CR_In_Osmanya[] = {
0x10480, 0x104af,
}; /* CR_In_Osmanya */
-/* 'In_Elbasan': Block */
-static const OnigCodePoint CR_In_Elbasan[] = {
- 1,
- 0x10500, 0x1052f,
-}; /* CR_In_Elbasan */
-
-/* 'In_Caucasian_Albanian': Block */
-static const OnigCodePoint CR_In_Caucasian_Albanian[] = {
- 1,
- 0x10530, 0x1056f,
-}; /* CR_In_Caucasian_Albanian */
-
-/* 'In_Linear_A': Block */
-static const OnigCodePoint CR_In_Linear_A[] = {
- 1,
- 0x10600, 0x1077f,
-}; /* CR_In_Linear_A */
-
/* 'In_Cypriot_Syllabary': Block */
static const OnigCodePoint CR_In_Cypriot_Syllabary[] = {
1,
@@ -29681,21 +25175,6 @@ static const OnigCodePoint CR_In_Imperial_Aramaic[] = {
0x10840, 0x1085f,
}; /* CR_In_Imperial_Aramaic */
-/* 'In_Palmyrene': Block */
-#define CR_In_Palmyrene CR_Palmyrene
-
-/* 'In_Nabataean': Block */
-static const OnigCodePoint CR_In_Nabataean[] = {
- 1,
- 0x10880, 0x108af,
-}; /* CR_In_Nabataean */
-
-/* 'In_Hatran': Block */
-static const OnigCodePoint CR_In_Hatran[] = {
- 1,
- 0x108e0, 0x108ff,
-}; /* CR_In_Hatran */
-
/* 'In_Phoenician': Block */
static const OnigCodePoint CR_In_Phoenician[] = {
1,
@@ -29726,15 +25205,6 @@ static const OnigCodePoint CR_In_Kharoshthi[] = {
/* 'In_Old_South_Arabian': Block */
#define CR_In_Old_South_Arabian CR_Old_South_Arabian
-/* 'In_Old_North_Arabian': Block */
-#define CR_In_Old_North_Arabian CR_Old_North_Arabian
-
-/* 'In_Manichaean': Block */
-static const OnigCodePoint CR_In_Manichaean[] = {
- 1,
- 0x10ac0, 0x10aff,
-}; /* CR_In_Manichaean */
-
/* 'In_Avestan': Block */
static const OnigCodePoint CR_In_Avestan[] = {
1,
@@ -29753,24 +25223,12 @@ static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = {
0x10b60, 0x10b7f,
}; /* CR_In_Inscriptional_Pahlavi */
-/* 'In_Psalter_Pahlavi': Block */
-static const OnigCodePoint CR_In_Psalter_Pahlavi[] = {
- 1,
- 0x10b80, 0x10baf,
-}; /* CR_In_Psalter_Pahlavi */
-
/* 'In_Old_Turkic': Block */
static const OnigCodePoint CR_In_Old_Turkic[] = {
1,
0x10c00, 0x10c4f,
}; /* CR_In_Old_Turkic */
-/* 'In_Old_Hungarian': Block */
-static const OnigCodePoint CR_In_Old_Hungarian[] = {
- 1,
- 0x10c80, 0x10cff,
-}; /* CR_In_Old_Hungarian */
-
/* 'In_Rumi_Numeral_Symbols': Block */
static const OnigCodePoint CR_In_Rumi_Numeral_Symbols[] = {
1,
@@ -29801,90 +25259,18 @@ static const OnigCodePoint CR_In_Chakma[] = {
0x11100, 0x1114f,
}; /* CR_In_Chakma */
-/* 'In_Mahajani': Block */
-static const OnigCodePoint CR_In_Mahajani[] = {
- 1,
- 0x11150, 0x1117f,
-}; /* CR_In_Mahajani */
-
/* 'In_Sharada': Block */
static const OnigCodePoint CR_In_Sharada[] = {
1,
0x11180, 0x111df,
}; /* CR_In_Sharada */
-/* 'In_Sinhala_Archaic_Numbers': Block */
-static const OnigCodePoint CR_In_Sinhala_Archaic_Numbers[] = {
- 1,
- 0x111e0, 0x111ff,
-}; /* CR_In_Sinhala_Archaic_Numbers */
-
-/* 'In_Khojki': Block */
-static const OnigCodePoint CR_In_Khojki[] = {
- 1,
- 0x11200, 0x1124f,
-}; /* CR_In_Khojki */
-
-/* 'In_Multani': Block */
-static const OnigCodePoint CR_In_Multani[] = {
- 1,
- 0x11280, 0x112af,
-}; /* CR_In_Multani */
-
-/* 'In_Khudawadi': Block */
-static const OnigCodePoint CR_In_Khudawadi[] = {
- 1,
- 0x112b0, 0x112ff,
-}; /* CR_In_Khudawadi */
-
-/* 'In_Grantha': Block */
-static const OnigCodePoint CR_In_Grantha[] = {
- 1,
- 0x11300, 0x1137f,
-}; /* CR_In_Grantha */
-
-/* 'In_Tirhuta': Block */
-static const OnigCodePoint CR_In_Tirhuta[] = {
- 1,
- 0x11480, 0x114df,
-}; /* CR_In_Tirhuta */
-
-/* 'In_Siddham': Block */
-static const OnigCodePoint CR_In_Siddham[] = {
- 1,
- 0x11580, 0x115ff,
-}; /* CR_In_Siddham */
-
-/* 'In_Modi': Block */
-static const OnigCodePoint CR_In_Modi[] = {
- 1,
- 0x11600, 0x1165f,
-}; /* CR_In_Modi */
-
/* 'In_Takri': Block */
static const OnigCodePoint CR_In_Takri[] = {
1,
0x11680, 0x116cf,
}; /* CR_In_Takri */
-/* 'In_Ahom': Block */
-static const OnigCodePoint CR_In_Ahom[] = {
- 1,
- 0x11700, 0x1173f,
-}; /* CR_In_Ahom */
-
-/* 'In_Warang_Citi': Block */
-static const OnigCodePoint CR_In_Warang_Citi[] = {
- 1,
- 0x118a0, 0x118ff,
-}; /* CR_In_Warang_Citi */
-
-/* 'In_Pau_Cin_Hau': Block */
-static const OnigCodePoint CR_In_Pau_Cin_Hau[] = {
- 1,
- 0x11ac0, 0x11aff,
-}; /* CR_In_Pau_Cin_Hau */
-
/* 'In_Cuneiform': Block */
static const OnigCodePoint CR_In_Cuneiform[] = {
1,
@@ -29897,48 +25283,18 @@ static const OnigCodePoint CR_In_Cuneiform_Numbers_and_Punctuation[] = {
0x12400, 0x1247f,
}; /* CR_In_Cuneiform_Numbers_and_Punctuation */
-/* 'In_Early_Dynastic_Cuneiform': Block */
-static const OnigCodePoint CR_In_Early_Dynastic_Cuneiform[] = {
- 1,
- 0x12480, 0x1254f,
-}; /* CR_In_Early_Dynastic_Cuneiform */
-
/* 'In_Egyptian_Hieroglyphs': Block */
static const OnigCodePoint CR_In_Egyptian_Hieroglyphs[] = {
1,
0x13000, 0x1342f,
}; /* CR_In_Egyptian_Hieroglyphs */
-/* 'In_Anatolian_Hieroglyphs': Block */
-static const OnigCodePoint CR_In_Anatolian_Hieroglyphs[] = {
- 1,
- 0x14400, 0x1467f,
-}; /* CR_In_Anatolian_Hieroglyphs */
-
/* 'In_Bamum_Supplement': Block */
static const OnigCodePoint CR_In_Bamum_Supplement[] = {
1,
0x16800, 0x16a3f,
}; /* CR_In_Bamum_Supplement */
-/* 'In_Mro': Block */
-static const OnigCodePoint CR_In_Mro[] = {
- 1,
- 0x16a40, 0x16a6f,
-}; /* CR_In_Mro */
-
-/* 'In_Bassa_Vah': Block */
-static const OnigCodePoint CR_In_Bassa_Vah[] = {
- 1,
- 0x16ad0, 0x16aff,
-}; /* CR_In_Bassa_Vah */
-
-/* 'In_Pahawh_Hmong': Block */
-static const OnigCodePoint CR_In_Pahawh_Hmong[] = {
- 1,
- 0x16b00, 0x16b8f,
-}; /* CR_In_Pahawh_Hmong */
-
/* 'In_Miao': Block */
static const OnigCodePoint CR_In_Miao[] = {
1,
@@ -29951,18 +25307,6 @@ static const OnigCodePoint CR_In_Kana_Supplement[] = {
0x1b000, 0x1b0ff,
}; /* CR_In_Kana_Supplement */
-/* 'In_Duployan': Block */
-static const OnigCodePoint CR_In_Duployan[] = {
- 1,
- 0x1bc00, 0x1bc9f,
-}; /* CR_In_Duployan */
-
-/* 'In_Shorthand_Format_Controls': Block */
-static const OnigCodePoint CR_In_Shorthand_Format_Controls[] = {
- 1,
- 0x1bca0, 0x1bcaf,
-}; /* CR_In_Shorthand_Format_Controls */
-
/* 'In_Byzantine_Musical_Symbols': Block */
static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = {
1,
@@ -29999,18 +25343,6 @@ static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = {
0x1d400, 0x1d7ff,
}; /* CR_In_Mathematical_Alphanumeric_Symbols */
-/* 'In_Sutton_SignWriting': Block */
-static const OnigCodePoint CR_In_Sutton_SignWriting[] = {
- 1,
- 0x1d800, 0x1daaf,
-}; /* CR_In_Sutton_SignWriting */
-
-/* 'In_Mende_Kikakui': Block */
-static const OnigCodePoint CR_In_Mende_Kikakui[] = {
- 1,
- 0x1e800, 0x1e8df,
-}; /* CR_In_Mende_Kikakui */
-
/* 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */
static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = {
1,
@@ -30047,11 +25379,11 @@ static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = {
0x1f200, 0x1f2ff,
}; /* CR_In_Enclosed_Ideographic_Supplement */
-/* 'In_Miscellaneous_Symbols_and_Pictographs': Block */
-static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Pictographs[] = {
+/* 'In_Miscellaneous_Symbols_And_Pictographs': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_And_Pictographs[] = {
1,
0x1f300, 0x1f5ff,
-}; /* CR_In_Miscellaneous_Symbols_and_Pictographs */
+}; /* CR_In_Miscellaneous_Symbols_And_Pictographs */
/* 'In_Emoticons': Block */
static const OnigCodePoint CR_In_Emoticons[] = {
@@ -30059,17 +25391,11 @@ static const OnigCodePoint CR_In_Emoticons[] = {
0x1f600, 0x1f64f,
}; /* CR_In_Emoticons */
-/* 'In_Ornamental_Dingbats': Block */
-static const OnigCodePoint CR_In_Ornamental_Dingbats[] = {
- 1,
- 0x1f650, 0x1f67f,
-}; /* CR_In_Ornamental_Dingbats */
-
-/* 'In_Transport_and_Map_Symbols': Block */
-static const OnigCodePoint CR_In_Transport_and_Map_Symbols[] = {
+/* 'In_Transport_And_Map_Symbols': Block */
+static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
1,
0x1f680, 0x1f6ff,
-}; /* CR_In_Transport_and_Map_Symbols */
+}; /* CR_In_Transport_And_Map_Symbols */
/* 'In_Alchemical_Symbols': Block */
static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
@@ -30077,24 +25403,6 @@ static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
0x1f700, 0x1f77f,
}; /* CR_In_Alchemical_Symbols */
-/* 'In_Geometric_Shapes_Extended': Block */
-static const OnigCodePoint CR_In_Geometric_Shapes_Extended[] = {
- 1,
- 0x1f780, 0x1f7ff,
-}; /* CR_In_Geometric_Shapes_Extended */
-
-/* 'In_Supplemental_Arrows_C': Block */
-static const OnigCodePoint CR_In_Supplemental_Arrows_C[] = {
- 1,
- 0x1f800, 0x1f8ff,
-}; /* CR_In_Supplemental_Arrows_C */
-
-/* 'In_Supplemental_Symbols_and_Pictographs': Block */
-static const OnigCodePoint CR_In_Supplemental_Symbols_and_Pictographs[] = {
- 1,
- 0x1f900, 0x1f9ff,
-}; /* CR_In_Supplemental_Symbols_and_Pictographs */
-
/* 'In_CJK_Unified_Ideographs_Extension_B': Block */
static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = {
1,
@@ -30113,12 +25421,6 @@ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_D[] = {
0x2b740, 0x2b81f,
}; /* CR_In_CJK_Unified_Ideographs_Extension_D */
-/* 'In_CJK_Unified_Ideographs_Extension_E': Block */
-static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_E[] = {
- 1,
- 0x2b820, 0x2ceaf,
-}; /* CR_In_CJK_Unified_Ideographs_Extension_E */
-
/* 'In_CJK_Compatibility_Ideographs_Supplement': Block */
static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs_Supplement[] = {
1,
@@ -30151,46 +25453,40 @@ static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
/* 'In_No_Block': Block */
static const OnigCodePoint CR_In_No_Block[] = {
- 42,
+ 36,
0x0860, 0x089f,
+ 0x1ab0, 0x1aff,
0x1c80, 0x1cbf,
0x2fe0, 0x2fef,
+ 0xa9e0, 0xa9ff,
+ 0xab30, 0xabbf,
0x10200, 0x1027f,
+ 0x102e0, 0x102ff,
+ 0x10350, 0x1037f,
0x103e0, 0x103ff,
- 0x104b0, 0x104ff,
- 0x10570, 0x105ff,
- 0x10780, 0x107ff,
- 0x108b0, 0x108df,
+ 0x104b0, 0x107ff,
+ 0x10860, 0x108ff,
0x10940, 0x1097f,
- 0x10aa0, 0x10abf,
- 0x10bb0, 0x10bff,
- 0x10c50, 0x10c7f,
- 0x10d00, 0x10e5f,
+ 0x10a80, 0x10aff,
+ 0x10b80, 0x10bff,
+ 0x10c50, 0x10e5f,
0x10e80, 0x10fff,
- 0x11250, 0x1127f,
- 0x11380, 0x1147f,
- 0x114e0, 0x1157f,
- 0x11660, 0x1167f,
- 0x116d0, 0x116ff,
- 0x11740, 0x1189f,
- 0x11900, 0x11abf,
- 0x11b00, 0x11fff,
- 0x12550, 0x12fff,
- 0x13430, 0x143ff,
- 0x14680, 0x167ff,
- 0x16a70, 0x16acf,
- 0x16b90, 0x16eff,
+ 0x11150, 0x1117f,
+ 0x111e0, 0x1167f,
+ 0x116d0, 0x11fff,
+ 0x12480, 0x12fff,
+ 0x13430, 0x167ff,
+ 0x16a40, 0x16eff,
0x16fa0, 0x1afff,
- 0x1b100, 0x1bbff,
- 0x1bcb0, 0x1cfff,
+ 0x1b100, 0x1cfff,
0x1d250, 0x1d2ff,
0x1d380, 0x1d3ff,
- 0x1dab0, 0x1e7ff,
- 0x1e8e0, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ef00, 0x1efff,
- 0x1fa00, 0x1ffff,
+ 0x1f650, 0x1f67f,
+ 0x1f780, 0x1ffff,
0x2a6e0, 0x2a6ff,
- 0x2ceb0, 0x2f7ff,
+ 0x2b820, 0x2f7ff,
0x2fa20, 0xdffff,
0xe0080, 0xe00ff,
0xe01f0, 0xeffff,
@@ -30375,35 +25671,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Sharada,
CR_Sora_Sompeng,
CR_Takri,
- CR_Caucasian_Albanian,
- CR_Bassa_Vah,
- CR_Duployan,
- CR_Elbasan,
- CR_Grantha,
- CR_Pahawh_Hmong,
- CR_Khojki,
- CR_Linear_A,
- CR_Mahajani,
- CR_Manichaean,
- CR_Mende_Kikakui,
- CR_Modi,
- CR_Mro,
- CR_Old_North_Arabian,
- CR_Nabataean,
- CR_Palmyrene,
- CR_Pau_Cin_Hau,
- CR_Old_Permic,
- CR_Psalter_Pahlavi,
- CR_Siddham,
- CR_Khudawadi,
- CR_Tirhuta,
- CR_Warang_Citi,
- CR_Ahom,
- CR_Anatolian_Hieroglyphs,
- CR_Hatran,
- CR_Multani,
- CR_Old_Hungarian,
- CR_SignWriting,
CR_White_Space,
CR_Bidi_Control,
CR_Join_Control,
@@ -30437,7 +25704,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Pattern_White_Space,
CR_Pattern_Syntax,
CR_Unknown,
-#ifdef USE_UNICODE_AGE_PROPERTIES
CR_Age_1_1,
CR_Age_2_0,
CR_Age_2_1,
@@ -30451,11 +25717,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Age_5_2,
CR_Age_6_0,
CR_Age_6_1,
- CR_Age_6_2,
- CR_Age_6_3,
- CR_Age_7_0,
- CR_Age_8_0,
-#endif /* USE_UNICODE_AGE_PROPERTIES */
CR_In_Basic_Latin,
CR_In_Latin_1_Supplement,
CR_In_Latin_Extended_A,
@@ -30511,7 +25772,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_In_Khmer_Symbols,
CR_In_Buginese,
CR_In_Tai_Tham,
- CR_In_Combining_Diacritical_Marks_Extended,
CR_In_Balinese,
CR_In_Sundanese,
CR_In_Batak,
@@ -30590,14 +25850,11 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_In_Rejang,
CR_In_Hangul_Jamo_Extended_A,
CR_In_Javanese,
- CR_In_Myanmar_Extended_B,
CR_In_Cham,
CR_In_Myanmar_Extended_A,
CR_In_Tai_Viet,
CR_In_Meetei_Mayek_Extensions,
CR_In_Ethiopic_Extended_A,
- CR_In_Latin_Extended_E,
- CR_In_Cherokee_Supplement,
CR_In_Meetei_Mayek,
CR_In_Hangul_Syllables,
CR_In_Hangul_Jamo_Extended_B,
@@ -30624,95 +25881,57 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_In_Phaistos_Disc,
CR_In_Lycian,
CR_In_Carian,
- CR_In_Coptic_Epact_Numbers,
CR_In_Old_Italic,
CR_In_Gothic,
- CR_In_Old_Permic,
CR_In_Ugaritic,
CR_In_Old_Persian,
CR_In_Deseret,
CR_In_Shavian,
CR_In_Osmanya,
- CR_In_Elbasan,
- CR_In_Caucasian_Albanian,
- CR_In_Linear_A,
CR_In_Cypriot_Syllabary,
CR_In_Imperial_Aramaic,
- CR_In_Palmyrene,
- CR_In_Nabataean,
- CR_In_Hatran,
CR_In_Phoenician,
CR_In_Lydian,
CR_In_Meroitic_Hieroglyphs,
CR_In_Meroitic_Cursive,
CR_In_Kharoshthi,
CR_In_Old_South_Arabian,
- CR_In_Old_North_Arabian,
- CR_In_Manichaean,
CR_In_Avestan,
CR_In_Inscriptional_Parthian,
CR_In_Inscriptional_Pahlavi,
- CR_In_Psalter_Pahlavi,
CR_In_Old_Turkic,
- CR_In_Old_Hungarian,
CR_In_Rumi_Numeral_Symbols,
CR_In_Brahmi,
CR_In_Kaithi,
CR_In_Sora_Sompeng,
CR_In_Chakma,
- CR_In_Mahajani,
CR_In_Sharada,
- CR_In_Sinhala_Archaic_Numbers,
- CR_In_Khojki,
- CR_In_Multani,
- CR_In_Khudawadi,
- CR_In_Grantha,
- CR_In_Tirhuta,
- CR_In_Siddham,
- CR_In_Modi,
CR_In_Takri,
- CR_In_Ahom,
- CR_In_Warang_Citi,
- CR_In_Pau_Cin_Hau,
CR_In_Cuneiform,
CR_In_Cuneiform_Numbers_and_Punctuation,
- CR_In_Early_Dynastic_Cuneiform,
CR_In_Egyptian_Hieroglyphs,
- CR_In_Anatolian_Hieroglyphs,
CR_In_Bamum_Supplement,
- CR_In_Mro,
- CR_In_Bassa_Vah,
- CR_In_Pahawh_Hmong,
CR_In_Miao,
CR_In_Kana_Supplement,
- CR_In_Duployan,
- CR_In_Shorthand_Format_Controls,
CR_In_Byzantine_Musical_Symbols,
CR_In_Musical_Symbols,
CR_In_Ancient_Greek_Musical_Notation,
CR_In_Tai_Xuan_Jing_Symbols,
CR_In_Counting_Rod_Numerals,
CR_In_Mathematical_Alphanumeric_Symbols,
- CR_In_Sutton_SignWriting,
- CR_In_Mende_Kikakui,
CR_In_Arabic_Mathematical_Alphabetic_Symbols,
CR_In_Mahjong_Tiles,
CR_In_Domino_Tiles,
CR_In_Playing_Cards,
CR_In_Enclosed_Alphanumeric_Supplement,
CR_In_Enclosed_Ideographic_Supplement,
- CR_In_Miscellaneous_Symbols_and_Pictographs,
+ CR_In_Miscellaneous_Symbols_And_Pictographs,
CR_In_Emoticons,
- CR_In_Ornamental_Dingbats,
- CR_In_Transport_and_Map_Symbols,
+ CR_In_Transport_And_Map_Symbols,
CR_In_Alchemical_Symbols,
- CR_In_Geometric_Shapes_Extended,
- CR_In_Supplemental_Arrows_C,
- CR_In_Supplemental_Symbols_and_Pictographs,
CR_In_CJK_Unified_Ideographs_Extension_B,
CR_In_CJK_Unified_Ideographs_Extension_C,
CR_In_CJK_Unified_Ideographs_Extension_D,
- CR_In_CJK_Unified_Ideographs_Extension_E,
CR_In_CJK_Compatibility_Ideographs_Supplement,
CR_In_Tags,
CR_In_Variation_Selectors_Supplement,
@@ -30735,16 +25954,12 @@ static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned
#define MAX_HASH_VALUE 19
/* maximum key range = 14, duplicates = 0 */
#else /* USE_UNICODE_PROPERTIES */
-#ifndef USE_UNICODE_AGE_PROPERTIES
-#define TOTAL_KEYWORDS 710
-#else /* USE_UNICODE_AGE_PROPERTIES */
-#define TOTAL_KEYWORDS 727
-#endif /* USE_UNICODE_AGE_PROPERTIES */
+#define TOTAL_KEYWORDS 625
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 3
-#define MAX_HASH_VALUE 5326
-/* maximum key range = 5324, duplicates = 0 */
+#define MAX_HASH_VALUE 4167
+/* maximum key range = 4165, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
@@ -30780,24 +25995,19 @@ uniname2ctype_hash (str, len)
2, 20, 1, 20, 1, 7, 4, 6, 20, 1,
4, 20, 20, 20, 20, 20, 20, 20
#else /* USE_UNICODE_PROPERTIES */
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
-#ifndef USE_UNICODE_AGE_PROPERTIES
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
-#else /* USE_UNICODE_AGE_PROPERTIES */
- 5327, 5327, 5327, 5327, 5327, 5327, 2, 5327, 14, 1,
- 2, 11, 14, 20, 6, 9, 4, 5327, 5327, 5327,
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327, 5327,
- 5327, 5327, 5327, 5327, 5327, 5327, 5327, 13, 1192, 20,
- 536, 25, 166, 1004, 345, 4, 194, 1391, 147, 7,
- 1, 302, 760, 3, 265, 40, 92, 1327, 124, 78,
- 110, 1040, 8, 5327, 5327, 5327, 5327, 5327
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 1, 4168, 13, 1,
+ 3, 28, 31, 10, 27, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 13, 854, 14,
+ 443, 19, 7, 570, 335, 4, 66, 1159, 102, 34,
+ 1, 178, 474, 1, 192, 2, 64, 1117, 491, 264,
+ 256, 1305, 3, 4168, 4168, 4168, 4168, 4168
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
@@ -30861,748 +26071,630 @@ struct uniname2ctype_pool_t
char uniname2ctype_pool_str19[sizeof("blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("n")];
- char uniname2ctype_pool_str11[sizeof("mn")];
- char uniname2ctype_pool_str15[sizeof("m")];
- char uniname2ctype_pool_str17[sizeof("z")];
- char uniname2ctype_pool_str24[sizeof("cn")];
- char uniname2ctype_pool_str29[sizeof("mani")];
- char uniname2ctype_pool_str30[sizeof("ci")];
- char uniname2ctype_pool_str31[sizeof("inmanichaean")];
- char uniname2ctype_pool_str36[sizeof("zzzz")];
- char uniname2ctype_pool_str37[sizeof("qaai")];
- char uniname2ctype_pool_str41[sizeof("c")];
- char uniname2ctype_pool_str49[sizeof("mc")];
- char uniname2ctype_pool_str53[sizeof("qaac")];
- char uniname2ctype_pool_str56[sizeof("sm")];
- char uniname2ctype_pool_str58[sizeof("incham")];
- char uniname2ctype_pool_str59[sizeof("me")];
- char uniname2ctype_pool_str61[sizeof("inarmenian")];
- char uniname2ctype_pool_str62[sizeof("cc")];
- char uniname2ctype_pool_str65[sizeof("mandaic")];
- char uniname2ctype_pool_str69[sizeof("incuneiform")];
- char uniname2ctype_pool_str77[sizeof("insamaritan")];
- char uniname2ctype_pool_str78[sizeof("cans")];
- char uniname2ctype_pool_str81[sizeof("s")];
- char uniname2ctype_pool_str82[sizeof("sc")];
- char uniname2ctype_pool_str86[sizeof("ascii")];
- char uniname2ctype_pool_str90[sizeof("zs")];
- char uniname2ctype_pool_str93[sizeof("inavestan")];
- char uniname2ctype_pool_str102[sizeof("cs")];
- char uniname2ctype_pool_str106[sizeof("inipaextensions")];
- char uniname2ctype_pool_str110[sizeof("incuneiformnumbersandpunctuation")];
- char uniname2ctype_pool_str114[sizeof("incommonindicnumberforms")];
- char uniname2ctype_pool_str124[sizeof("inthai")];
- char uniname2ctype_pool_str129[sizeof("cwcm")];
- char uniname2ctype_pool_str132[sizeof("mtei")];
- char uniname2ctype_pool_str140[sizeof("inspecials")];
- char uniname2ctype_pool_str141[sizeof("initialpunctuation")];
- char uniname2ctype_pool_str142[sizeof("invai")];
- char uniname2ctype_pool_str144[sizeof("inthaana")];
- char uniname2ctype_pool_str145[sizeof("inancientsymbols")];
- char uniname2ctype_pool_str148[sizeof("vai")];
- char uniname2ctype_pool_str149[sizeof("vaii")];
- char uniname2ctype_pool_str152[sizeof("inmiscellaneousmathematicalsymbolsa")];
- char uniname2ctype_pool_str155[sizeof("newtailue")];
- char uniname2ctype_pool_str159[sizeof("inmusicalsymbols")];
- char uniname2ctype_pool_str163[sizeof("lm")];
- char uniname2ctype_pool_str164[sizeof("taile")];
- char uniname2ctype_pool_str169[sizeof("lina")];
- char uniname2ctype_pool_str174[sizeof("inmyanmarextendeda")];
- char uniname2ctype_pool_str176[sizeof("sterm")];
- char uniname2ctype_pool_str178[sizeof("lana")];
- char uniname2ctype_pool_str180[sizeof("alnum")];
- char uniname2ctype_pool_str185[sizeof("inlycian")];
- char uniname2ctype_pool_str189[sizeof("lc")];
- char uniname2ctype_pool_str190[sizeof("inmalayalam")];
- char uniname2ctype_pool_str192[sizeof("inshavian")];
- char uniname2ctype_pool_str199[sizeof("inmiscellaneoussymbols")];
- char uniname2ctype_pool_str200[sizeof("inlineara")];
- char uniname2ctype_pool_str201[sizeof("intransportandmapsymbols")];
- char uniname2ctype_pool_str206[sizeof("vs")];
- char uniname2ctype_pool_str208[sizeof("inmiscellaneoussymbolsandarrows")];
- char uniname2ctype_pool_str209[sizeof("intaitham")];
- char uniname2ctype_pool_str212[sizeof("innewtailue")];
- char uniname2ctype_pool_str213[sizeof("inmiscellaneoussymbolsandpictographs")];
- char uniname2ctype_pool_str220[sizeof("incontrolpictures")];
- char uniname2ctype_pool_str225[sizeof("sinhala")];
- char uniname2ctype_pool_str237[sizeof("taiviet")];
- char uniname2ctype_pool_str257[sizeof("latn")];
- char uniname2ctype_pool_str259[sizeof("latin")];
- char uniname2ctype_pool_str260[sizeof("ital")];
- char uniname2ctype_pool_str262[sizeof("intamil")];
- char uniname2ctype_pool_str263[sizeof("taml")];
- char uniname2ctype_pool_str264[sizeof("inmultani")];
- char uniname2ctype_pool_str273[sizeof("avst")];
- char uniname2ctype_pool_str274[sizeof("inlinearbideograms")];
- char uniname2ctype_pool_str275[sizeof("avestan")];
- char uniname2ctype_pool_str279[sizeof("intaixuanjingsymbols")];
- char uniname2ctype_pool_str280[sizeof("intaile")];
- char uniname2ctype_pool_str281[sizeof("tale")];
- char uniname2ctype_pool_str285[sizeof("cwt")];
- char uniname2ctype_pool_str288[sizeof("cwcf")];
- char uniname2ctype_pool_str290[sizeof("armn")];
- char uniname2ctype_pool_str291[sizeof("inlatinextendeda")];
- char uniname2ctype_pool_str293[sizeof("armi")];
- char uniname2ctype_pool_str295[sizeof("l")];
- char uniname2ctype_pool_str297[sizeof("nl")];
- char uniname2ctype_pool_str299[sizeof("armenian")];
- char uniname2ctype_pool_str300[sizeof("inmyanmar")];
- char uniname2ctype_pool_str302[sizeof("inrunic")];
- char uniname2ctype_pool_str303[sizeof("incarian")];
- char uniname2ctype_pool_str304[sizeof("zl")];
- char uniname2ctype_pool_str305[sizeof("inlatinextendedc")];
- char uniname2ctype_pool_str306[sizeof("cari")];
- char uniname2ctype_pool_str309[sizeof("inmeeteimayekextensions")];
- char uniname2ctype_pool_str315[sizeof("inlatinextendede")];
- char uniname2ctype_pool_str319[sizeof("carian")];
- char uniname2ctype_pool_str321[sizeof("merc")];
- char uniname2ctype_pool_str322[sizeof("ext")];
- char uniname2ctype_pool_str324[sizeof("incyrillic")];
- char uniname2ctype_pool_str325[sizeof("tavt")];
- char uniname2ctype_pool_str326[sizeof("intaiviet")];
- char uniname2ctype_pool_str329[sizeof("samr")];
- char uniname2ctype_pool_str330[sizeof("miao")];
- char uniname2ctype_pool_str333[sizeof("lt")];
- char uniname2ctype_pool_str338[sizeof("inlowsurrogates")];
- char uniname2ctype_pool_str339[sizeof("samaritan")];
- char uniname2ctype_pool_str340[sizeof("inahom")];
- char uniname2ctype_pool_str341[sizeof("arabic")];
- char uniname2ctype_pool_str342[sizeof("insyriac")];
- char uniname2ctype_pool_str345[sizeof("insharada")];
- char uniname2ctype_pool_str348[sizeof("java")];
- char uniname2ctype_pool_str349[sizeof("inosmanya")];
- char uniname2ctype_pool_str350[sizeof("incherokee")];
- char uniname2ctype_pool_str354[sizeof("cf")];
- char uniname2ctype_pool_str360[sizeof("inmiscellaneoustechnical")];
- char uniname2ctype_pool_str361[sizeof("inruminumeralsymbols")];
- char uniname2ctype_pool_str362[sizeof("zinh")];
- char uniname2ctype_pool_str363[sizeof("han")];
- char uniname2ctype_pool_str366[sizeof("osma")];
- char uniname2ctype_pool_str367[sizeof("hani")];
- char uniname2ctype_pool_str371[sizeof("injavanese")];
- char uniname2ctype_pool_str373[sizeof("wara")];
- char uniname2ctype_pool_str381[sizeof("inwarangciti")];
- char uniname2ctype_pool_str384[sizeof("inmahajani")];
- char uniname2ctype_pool_str389[sizeof("cham")];
- char uniname2ctype_pool_str390[sizeof("javanese")];
- char uniname2ctype_pool_str393[sizeof("term")];
- char uniname2ctype_pool_str394[sizeof("sinh")];
- char uniname2ctype_pool_str395[sizeof("cwl")];
- char uniname2ctype_pool_str397[sizeof("manichaean")];
- char uniname2ctype_pool_str401[sizeof("insmallformvariants")];
- char uniname2ctype_pool_str403[sizeof("connectorpunctuation")];
- char uniname2ctype_pool_str408[sizeof("inenclosedalphanumerics")];
- char uniname2ctype_pool_str409[sizeof("inethiopic")];
- char uniname2ctype_pool_str411[sizeof("tamil")];
- char uniname2ctype_pool_str412[sizeof("cntrl")];
- char uniname2ctype_pool_str413[sizeof("insinhala")];
- char uniname2ctype_pool_str417[sizeof("chakma")];
- char uniname2ctype_pool_str423[sizeof("shavian")];
- char uniname2ctype_pool_str434[sizeof("inlatinextendedadditional")];
- char uniname2ctype_pool_str443[sizeof("ll")];
- char uniname2ctype_pool_str450[sizeof("lineara")];
- char uniname2ctype_pool_str454[sizeof("inideographicdescriptioncharacters")];
- char uniname2ctype_pool_str458[sizeof("thai")];
- char uniname2ctype_pool_str461[sizeof("math")];
- char uniname2ctype_pool_str467[sizeof("thaa")];
- char uniname2ctype_pool_str469[sizeof("inenclosedalphanumericsupplement")];
- char uniname2ctype_pool_str470[sizeof("ethi")];
- char uniname2ctype_pool_str471[sizeof("hatran")];
- char uniname2ctype_pool_str473[sizeof("meroiticcursive")];
- char uniname2ctype_pool_str475[sizeof("inemoticons")];
- char uniname2ctype_pool_str480[sizeof("shaw")];
- char uniname2ctype_pool_str481[sizeof("taitham")];
- char uniname2ctype_pool_str483[sizeof("thaana")];
- char uniname2ctype_pool_str494[sizeof("insinhalaarchaicnumbers")];
- char uniname2ctype_pool_str497[sizeof("ahex")];
- char uniname2ctype_pool_str502[sizeof("loe")];
- char uniname2ctype_pool_str518[sizeof("invariationselectors")];
- char uniname2ctype_pool_str519[sizeof("terminalpunctuation")];
- char uniname2ctype_pool_str527[sizeof("whitespace")];
- char uniname2ctype_pool_str531[sizeof("asciihexdigit")];
- char uniname2ctype_pool_str533[sizeof("inearlydynasticcuneiform")];
- char uniname2ctype_pool_str538[sizeof("inopticalcharacterrecognition")];
- char uniname2ctype_pool_str545[sizeof("joinc")];
- char uniname2ctype_pool_str546[sizeof("di")];
- char uniname2ctype_pool_str552[sizeof("inenclosedcjklettersandmonths")];
- char uniname2ctype_pool_str561[sizeof("mand")];
- char uniname2ctype_pool_str562[sizeof("inmodi")];
- char uniname2ctype_pool_str563[sizeof("mahj")];
- char uniname2ctype_pool_str569[sizeof("dia")];
- char uniname2ctype_pool_str573[sizeof("mend")];
- char uniname2ctype_pool_str578[sizeof("inmandaic")];
- char uniname2ctype_pool_str580[sizeof("invariationselectorssupplement")];
- char uniname2ctype_pool_str583[sizeof("idc")];
- char uniname2ctype_pool_str584[sizeof("mahajani")];
- char uniname2ctype_pool_str585[sizeof("sind")];
- char uniname2ctype_pool_str593[sizeof("hex")];
- char uniname2ctype_pool_str602[sizeof("oriya")];
- char uniname2ctype_pool_str603[sizeof("mero")];
- char uniname2ctype_pool_str605[sizeof("titlecaseletter")];
- char uniname2ctype_pool_str607[sizeof("no")];
- char uniname2ctype_pool_str614[sizeof("inscriptionalparthian")];
- char uniname2ctype_pool_str615[sizeof("innko")];
- char uniname2ctype_pool_str618[sizeof("insundanese")];
- char uniname2ctype_pool_str621[sizeof("inmro")];
- char uniname2ctype_pool_str622[sizeof("intifinagh")];
- char uniname2ctype_pool_str623[sizeof("ids")];
- char uniname2ctype_pool_str624[sizeof("sora")];
- char uniname2ctype_pool_str626[sizeof("co")];
- char uniname2ctype_pool_str629[sizeof("tifinagh")];
- char uniname2ctype_pool_str630[sizeof("indominotiles")];
- char uniname2ctype_pool_str631[sizeof("hira")];
- char uniname2ctype_pool_str633[sizeof("inarrows")];
- char uniname2ctype_pool_str635[sizeof("inmiao")];
- char uniname2ctype_pool_str639[sizeof("common")];
- char uniname2ctype_pool_str646[sizeof("so")];
- char uniname2ctype_pool_str651[sizeof("inhiragana")];
- char uniname2ctype_pool_str659[sizeof("cher")];
- char uniname2ctype_pool_str665[sizeof("hano")];
- char uniname2ctype_pool_str671[sizeof("ahom")];
- char uniname2ctype_pool_str674[sizeof("xidc")];
- char uniname2ctype_pool_str676[sizeof("idst")];
- char uniname2ctype_pool_str679[sizeof("inogham")];
- char uniname2ctype_pool_str685[sizeof("inolchiki")];
- char uniname2ctype_pool_str688[sizeof("idcontinue")];
- char uniname2ctype_pool_str689[sizeof("inmathematicalalphanumericsymbols")];
- char uniname2ctype_pool_str694[sizeof("xids")];
- char uniname2ctype_pool_str696[sizeof("inscriptionalpahlavi")];
- char uniname2ctype_pool_str698[sizeof("indevanagari")];
- char uniname2ctype_pool_str701[sizeof("inlydian")];
- char uniname2ctype_pool_str702[sizeof("deva")];
- char uniname2ctype_pool_str703[sizeof("inspacingmodifierletters")];
- char uniname2ctype_pool_str707[sizeof("indeseret")];
- char uniname2ctype_pool_str708[sizeof("anatolianhieroglyphs")];
- char uniname2ctype_pool_str710[sizeof("tirh")];
- char uniname2ctype_pool_str713[sizeof("devanagari")];
- char uniname2ctype_pool_str716[sizeof("inhatran")];
- char uniname2ctype_pool_str719[sizeof("hatr")];
- char uniname2ctype_pool_str728[sizeof("invedicextensions")];
- char uniname2ctype_pool_str729[sizeof("intirhuta")];
- char uniname2ctype_pool_str752[sizeof("inmahjongtiles")];
- char uniname2ctype_pool_str753[sizeof("lo")];
- char uniname2ctype_pool_str761[sizeof("inlao")];
- char uniname2ctype_pool_str767[sizeof("lao")];
- char uniname2ctype_pool_str768[sizeof("laoo")];
- char uniname2ctype_pool_str769[sizeof("mongolian")];
- char uniname2ctype_pool_str770[sizeof("pi")];
- char uniname2ctype_pool_str776[sizeof("insylotinagri")];
- char uniname2ctype_pool_str797[sizeof("lineseparator")];
- char uniname2ctype_pool_str802[sizeof("pc")];
- char uniname2ctype_pool_str812[sizeof("pe")];
- char uniname2ctype_pool_str820[sizeof("inphaistosdisc")];
- char uniname2ctype_pool_str825[sizeof("letter")];
- char uniname2ctype_pool_str832[sizeof("inanatolianhieroglyphs")];
- char uniname2ctype_pool_str839[sizeof("oalpha")];
- char uniname2ctype_pool_str842[sizeof("ps")];
- char uniname2ctype_pool_str843[sizeof("inverticalforms")];
- char uniname2ctype_pool_str844[sizeof("xdigit")];
- char uniname2ctype_pool_str846[sizeof("lowercase")];
- char uniname2ctype_pool_str849[sizeof("odi")];
- char uniname2ctype_pool_str851[sizeof("diacritic")];
- char uniname2ctype_pool_str853[sizeof("modi")];
- char uniname2ctype_pool_str855[sizeof("xidstart")];
- char uniname2ctype_pool_str856[sizeof("inshorthandformatcontrols")];
- char uniname2ctype_pool_str866[sizeof("oidc")];
- char uniname2ctype_pool_str868[sizeof("space")];
- char uniname2ctype_pool_str871[sizeof("ideo")];
- char uniname2ctype_pool_str878[sizeof("inolditalic")];
- char uniname2ctype_pool_str879[sizeof("mro")];
- char uniname2ctype_pool_str880[sizeof("mroo")];
- char uniname2ctype_pool_str882[sizeof("insundanesesupplement")];
- char uniname2ctype_pool_str886[sizeof("oids")];
- char uniname2ctype_pool_str901[sizeof("nchar")];
- char uniname2ctype_pool_str904[sizeof("decimalnumber")];
- char uniname2ctype_pool_str905[sizeof("incoptic")];
- char uniname2ctype_pool_str931[sizeof("palm")];
- char uniname2ctype_pool_str936[sizeof("format")];
- char uniname2ctype_pool_str937[sizeof("dsrt")];
- char uniname2ctype_pool_str938[sizeof("dash")];
- char uniname2ctype_pool_str940[sizeof("inmodifiertoneletters")];
- char uniname2ctype_pool_str950[sizeof("patws")];
- char uniname2ctype_pool_str951[sizeof("alpha")];
- char uniname2ctype_pool_str952[sizeof("siddham")];
- char uniname2ctype_pool_str953[sizeof("inlepcha")];
- char uniname2ctype_pool_str954[sizeof("wspace")];
- char uniname2ctype_pool_str955[sizeof("inpalmyrene")];
- char uniname2ctype_pool_str956[sizeof("lepc")];
- char uniname2ctype_pool_str957[sizeof("idstart")];
- char uniname2ctype_pool_str960[sizeof("inprivateusearea")];
- char uniname2ctype_pool_str961[sizeof("psalterpahlavi")];
- char uniname2ctype_pool_str964[sizeof("incopticepactnumbers")];
- char uniname2ctype_pool_str966[sizeof("inoldturkic")];
- char uniname2ctype_pool_str967[sizeof("sharada")];
- char uniname2ctype_pool_str971[sizeof("hanunoo")];
- char uniname2ctype_pool_str972[sizeof("incyrillicextendeda")];
- char uniname2ctype_pool_str980[sizeof("joincontrol")];
- char uniname2ctype_pool_str989[sizeof("xidcontinue")];
- char uniname2ctype_pool_str990[sizeof("deseret")];
- char uniname2ctype_pool_str1001[sizeof("radical")];
- char uniname2ctype_pool_str1005[sizeof("canadianaboriginal")];
- char uniname2ctype_pool_str1017[sizeof("omath")];
- char uniname2ctype_pool_str1029[sizeof("inmongolian")];
- char uniname2ctype_pool_str1032[sizeof("casedletter")];
- char uniname2ctype_pool_str1037[sizeof("extender")];
- char uniname2ctype_pool_str1044[sizeof("control")];
- char uniname2ctype_pool_str1045[sizeof("ingrantha")];
- char uniname2ctype_pool_str1050[sizeof("yi")];
- char uniname2ctype_pool_str1052[sizeof("otheridcontinue")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1053[sizeof("age=1.1")];
- char uniname2ctype_pool_str1054[sizeof("age=2.1")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1056[sizeof("yiii")];
- char uniname2ctype_pool_str1057[sizeof("inethiopicextendeda")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1058[sizeof("age=6.1")];
- char uniname2ctype_pool_str1059[sizeof("age=6.2")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1061[sizeof("perm")];
- char uniname2ctype_pool_str1062[sizeof("lower")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1063[sizeof("age=3.1")];
- char uniname2ctype_pool_str1064[sizeof("age=3.2")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1065[sizeof("noncharactercodepoint")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1066[sizeof("age=4.1")];
- char uniname2ctype_pool_str1067[sizeof("age=2.0")];
- char uniname2ctype_pool_str1068[sizeof("age=6.3")];
- char uniname2ctype_pool_str1069[sizeof("age=8.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1070[sizeof("ingeneralpunctuation")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1071[sizeof("age=6.0")];
- char uniname2ctype_pool_str1072[sizeof("age=5.1")];
- char uniname2ctype_pool_str1073[sizeof("age=5.2")];
- char uniname2ctype_pool_str1074[sizeof("age=7.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1075[sizeof("nd")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1076[sizeof("age=3.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1077[sizeof("otheralphabetic")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1079[sizeof("age=4.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1082[sizeof("imperialaramaic")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str1085[sizeof("age=5.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str1094[sizeof("pf")];
- char uniname2ctype_pool_str1096[sizeof("letternumber")];
- char uniname2ctype_pool_str1100[sizeof("inimperialaramaic")];
- char uniname2ctype_pool_str1106[sizeof("inphoenician")];
- char uniname2ctype_pool_str1109[sizeof("finalpunctuation")];
- char uniname2ctype_pool_str1114[sizeof("sd")];
- char uniname2ctype_pool_str1119[sizeof("olditalic")];
- char uniname2ctype_pool_str1120[sizeof("sidd")];
- char uniname2ctype_pool_str1121[sizeof("inenclosedideographicsupplement")];
- char uniname2ctype_pool_str1125[sizeof("prti")];
- char uniname2ctype_pool_str1127[sizeof("sgnw")];
- char uniname2ctype_pool_str1132[sizeof("coptic")];
- char uniname2ctype_pool_str1133[sizeof("insiddham")];
- char uniname2ctype_pool_str1140[sizeof("inoldnortharabian")];
- char uniname2ctype_pool_str1141[sizeof("cprt")];
- char uniname2ctype_pool_str1143[sizeof("inlatin1supplement")];
- char uniname2ctype_pool_str1144[sizeof("tagbanwa")];
- char uniname2ctype_pool_str1150[sizeof("cased")];
- char uniname2ctype_pool_str1155[sizeof("ininscriptionalparthian")];
- char uniname2ctype_pool_str1157[sizeof("ininscriptionalpahlavi")];
- char uniname2ctype_pool_str1164[sizeof("inherited")];
- char uniname2ctype_pool_str1169[sizeof("privateuse")];
- char uniname2ctype_pool_str1178[sizeof("copt")];
- char uniname2ctype_pool_str1179[sizeof("inoldsoutharabian")];
- char uniname2ctype_pool_str1184[sizeof("lowercaseletter")];
- char uniname2ctype_pool_str1185[sizeof("word")];
- char uniname2ctype_pool_str1187[sizeof("intags")];
- char uniname2ctype_pool_str1190[sizeof("shrd")];
- char uniname2ctype_pool_str1194[sizeof("idsbinaryoperator")];
- char uniname2ctype_pool_str1201[sizeof("xpeo")];
- char uniname2ctype_pool_str1202[sizeof("othersymbol")];
- char uniname2ctype_pool_str1203[sizeof("otherlowercase")];
- char uniname2ctype_pool_str1204[sizeof("otheridstart")];
- char uniname2ctype_pool_str1205[sizeof("mlym")];
- char uniname2ctype_pool_str1207[sizeof("inoldhungarian")];
- char uniname2ctype_pool_str1215[sizeof("lyci")];
- char uniname2ctype_pool_str1218[sizeof("print")];
- char uniname2ctype_pool_str1220[sizeof("phnx")];
- char uniname2ctype_pool_str1223[sizeof("innabataean")];
- char uniname2ctype_pool_str1228[sizeof("lycian")];
- char uniname2ctype_pool_str1230[sizeof("ingujarati")];
- char uniname2ctype_pool_str1231[sizeof("bamum")];
- char uniname2ctype_pool_str1236[sizeof("malayalam")];
- char uniname2ctype_pool_str1238[sizeof("variationselector")];
- char uniname2ctype_pool_str1242[sizeof("patternwhitespace")];
- char uniname2ctype_pool_str1245[sizeof("inelbasan")];
- char uniname2ctype_pool_str1249[sizeof("spaceseparator")];
- char uniname2ctype_pool_str1251[sizeof("inarabic")];
- char uniname2ctype_pool_str1252[sizeof("inalphabeticpresentationforms")];
- char uniname2ctype_pool_str1255[sizeof("inbasiclatin")];
- char uniname2ctype_pool_str1260[sizeof("phli")];
- char uniname2ctype_pool_str1263[sizeof("indevanagariextended")];
- char uniname2ctype_pool_str1265[sizeof("innumberforms")];
- char uniname2ctype_pool_str1266[sizeof("caseignorable")];
- char uniname2ctype_pool_str1267[sizeof("tfng")];
- char uniname2ctype_pool_str1274[sizeof("other")];
- char uniname2ctype_pool_str1278[sizeof("inphoneticextensions")];
- char uniname2ctype_pool_str1281[sizeof("othernumber")];
- char uniname2ctype_pool_str1285[sizeof("closepunctuation")];
- char uniname2ctype_pool_str1286[sizeof("oldpersian")];
- char uniname2ctype_pool_str1287[sizeof("gran")];
- char uniname2ctype_pool_str1289[sizeof("bass")];
- char uniname2ctype_pool_str1291[sizeof("patternsyntax")];
- char uniname2ctype_pool_str1292[sizeof("inmathematicaloperators")];
- char uniname2ctype_pool_str1294[sizeof("inpsalterpahlavi")];
- char uniname2ctype_pool_str1295[sizeof("ingurmukhi")];
- char uniname2ctype_pool_str1302[sizeof("nbat")];
- char uniname2ctype_pool_str1304[sizeof("oldpermic")];
- char uniname2ctype_pool_str1309[sizeof("lepcha")];
- char uniname2ctype_pool_str1310[sizeof("inbyzantinemusicalsymbols")];
- char uniname2ctype_pool_str1312[sizeof("olower")];
- char uniname2ctype_pool_str1315[sizeof("inarabicpresentationformsa")];
- char uniname2ctype_pool_str1318[sizeof("mong")];
- char uniname2ctype_pool_str1321[sizeof("nabataean")];
- char uniname2ctype_pool_str1323[sizeof("mymr")];
- char uniname2ctype_pool_str1324[sizeof("intibetan")];
- char uniname2ctype_pool_str1326[sizeof("inyijinghexagramsymbols")];
- char uniname2ctype_pool_str1330[sizeof("ogam")];
- char uniname2ctype_pool_str1331[sizeof("inmiscellaneousmathematicalsymbolsb")];
- char uniname2ctype_pool_str1337[sizeof("inlatinextendedd")];
- char uniname2ctype_pool_str1338[sizeof("sylotinagri")];
- char uniname2ctype_pool_str1340[sizeof("inphoneticextensionssupplement")];
- char uniname2ctype_pool_str1341[sizeof("insorasompeng")];
- char uniname2ctype_pool_str1345[sizeof("insuttonsignwriting")];
- char uniname2ctype_pool_str1348[sizeof("linb")];
- char uniname2ctype_pool_str1349[sizeof("mathsymbol")];
- char uniname2ctype_pool_str1352[sizeof("myanmar")];
- char uniname2ctype_pool_str1353[sizeof("inmyanmarextendedb")];
- char uniname2ctype_pool_str1354[sizeof("limb")];
- char uniname2ctype_pool_str1360[sizeof("bali")];
- char uniname2ctype_pool_str1361[sizeof("hmng")];
- char uniname2ctype_pool_str1364[sizeof("inbraillepatterns")];
- char uniname2ctype_pool_str1365[sizeof("othermath")];
- char uniname2ctype_pool_str1366[sizeof("po")];
- char uniname2ctype_pool_str1367[sizeof("hang")];
- char uniname2ctype_pool_str1369[sizeof("syrc")];
- char uniname2ctype_pool_str1371[sizeof("inoriya")];
- char uniname2ctype_pool_str1375[sizeof("warangciti")];
- char uniname2ctype_pool_str1377[sizeof("separator")];
- char uniname2ctype_pool_str1381[sizeof("elba")];
- char uniname2ctype_pool_str1383[sizeof("inbalinese")];
- char uniname2ctype_pool_str1384[sizeof("tibt")];
- char uniname2ctype_pool_str1386[sizeof("modifierletter")];
- char uniname2ctype_pool_str1389[sizeof("bengali")];
- char uniname2ctype_pool_str1396[sizeof("inlinearbsyllabary")];
- char uniname2ctype_pool_str1401[sizeof("tibetan")];
- char uniname2ctype_pool_str1404[sizeof("syriac")];
- char uniname2ctype_pool_str1406[sizeof("incaucasianalbanian")];
- char uniname2ctype_pool_str1410[sizeof("osmanya")];
- char uniname2ctype_pool_str1411[sizeof("balinese")];
- char uniname2ctype_pool_str1415[sizeof("inyiradicals")];
- char uniname2ctype_pool_str1416[sizeof("sundanese")];
- char uniname2ctype_pool_str1417[sizeof("ingreekandcoptic")];
- char uniname2ctype_pool_str1420[sizeof("inkannada")];
- char uniname2ctype_pool_str1422[sizeof("kana")];
- char uniname2ctype_pool_str1423[sizeof("phoenician")];
- char uniname2ctype_pool_str1424[sizeof("inancientgreekmusicalnotation")];
- char uniname2ctype_pool_str1425[sizeof("elbasan")];
- char uniname2ctype_pool_str1427[sizeof("otherletter")];
- char uniname2ctype_pool_str1435[sizeof("cakm")];
- char uniname2ctype_pool_str1440[sizeof("ingeometricshapes")];
- char uniname2ctype_pool_str1448[sizeof("gothic")];
- char uniname2ctype_pool_str1450[sizeof("inchakma")];
- char uniname2ctype_pool_str1455[sizeof("inancientgreeknumbers")];
- char uniname2ctype_pool_str1456[sizeof("saurashtra")];
- char uniname2ctype_pool_str1459[sizeof("induployan")];
- char uniname2ctype_pool_str1468[sizeof("rjng")];
- char uniname2ctype_pool_str1469[sizeof("mendekikakui")];
- char uniname2ctype_pool_str1474[sizeof("ingothic")];
- char uniname2ctype_pool_str1475[sizeof("narb")];
- char uniname2ctype_pool_str1476[sizeof("cyrl")];
- char uniname2ctype_pool_str1478[sizeof("brai")];
- char uniname2ctype_pool_str1483[sizeof("grext")];
- char uniname2ctype_pool_str1487[sizeof("arab")];
- char uniname2ctype_pool_str1488[sizeof("meeteimayek")];
- char uniname2ctype_pool_str1489[sizeof("inrejang")];
- char uniname2ctype_pool_str1491[sizeof("brahmi")];
- char uniname2ctype_pool_str1504[sizeof("inkaithi")];
- char uniname2ctype_pool_str1506[sizeof("multani")];
- char uniname2ctype_pool_str1507[sizeof("incjkcompatibilityforms")];
- char uniname2ctype_pool_str1509[sizeof("takri")];
- char uniname2ctype_pool_str1512[sizeof("incjkcompatibilityideographs")];
- char uniname2ctype_pool_str1514[sizeof("sarb")];
- char uniname2ctype_pool_str1521[sizeof("p")];
- char uniname2ctype_pool_str1522[sizeof("lisu")];
- char uniname2ctype_pool_str1524[sizeof("inkatakana")];
- char uniname2ctype_pool_str1530[sizeof("zp")];
- char uniname2ctype_pool_str1532[sizeof("inornamentaldingbats")];
- char uniname2ctype_pool_str1533[sizeof("sylo")];
- char uniname2ctype_pool_str1534[sizeof("cuneiform")];
- char uniname2ctype_pool_str1548[sizeof("incjkstrokes")];
- char uniname2ctype_pool_str1552[sizeof("ethiopic")];
- char uniname2ctype_pool_str1558[sizeof("inmeeteimayek")];
- char uniname2ctype_pool_str1559[sizeof("kali")];
- char uniname2ctype_pool_str1567[sizeof("inbrahmi")];
- char uniname2ctype_pool_str1574[sizeof("incjkcompatibilityideographssupplement")];
- char uniname2ctype_pool_str1577[sizeof("mult")];
- char uniname2ctype_pool_str1579[sizeof("inethiopicextended")];
- char uniname2ctype_pool_str1583[sizeof("talu")];
- char uniname2ctype_pool_str1584[sizeof("inhangulsyllables")];
- char uniname2ctype_pool_str1587[sizeof("ingeorgian")];
- char uniname2ctype_pool_str1588[sizeof("hexdigit")];
- char uniname2ctype_pool_str1591[sizeof("xsux")];
- char uniname2ctype_pool_str1592[sizeof("inunifiedcanadianaboriginalsyllabics")];
- char uniname2ctype_pool_str1595[sizeof("telu")];
- char uniname2ctype_pool_str1596[sizeof("indingbats")];
- char uniname2ctype_pool_str1599[sizeof("inblockelements")];
- char uniname2ctype_pool_str1600[sizeof("geor")];
- char uniname2ctype_pool_str1611[sizeof("ingreekextended")];
- char uniname2ctype_pool_str1612[sizeof("inletterlikesymbols")];
- char uniname2ctype_pool_str1617[sizeof("inoldpersian")];
- char uniname2ctype_pool_str1624[sizeof("orya")];
- char uniname2ctype_pool_str1629[sizeof("linearb")];
- char uniname2ctype_pool_str1632[sizeof("inbassavah")];
- char uniname2ctype_pool_str1634[sizeof("inoldpermic")];
- char uniname2ctype_pool_str1635[sizeof("inkanasupplement")];
- char uniname2ctype_pool_str1636[sizeof("incombininghalfmarks")];
- char uniname2ctype_pool_str1638[sizeof("runic")];
- char uniname2ctype_pool_str1640[sizeof("inugaritic")];
- char uniname2ctype_pool_str1642[sizeof("assigned")];
- char uniname2ctype_pool_str1643[sizeof("glagolitic")];
- char uniname2ctype_pool_str1647[sizeof("cyrillic")];
- char uniname2ctype_pool_str1648[sizeof("inmeroitichieroglyphs")];
- char uniname2ctype_pool_str1649[sizeof("saur")];
- char uniname2ctype_pool_str1652[sizeof("hiragana")];
- char uniname2ctype_pool_str1658[sizeof("insuperscriptsandsubscripts")];
- char uniname2ctype_pool_str1670[sizeof("ogham")];
- char uniname2ctype_pool_str1675[sizeof("insaurashtra")];
- char uniname2ctype_pool_str1680[sizeof("mark")];
- char uniname2ctype_pool_str1689[sizeof("symbol")];
- char uniname2ctype_pool_str1694[sizeof("inkharoshthi")];
- char uniname2ctype_pool_str1700[sizeof("inkhmer")];
- char uniname2ctype_pool_str1712[sizeof("plrd")];
- char uniname2ctype_pool_str1714[sizeof("graphemebase")];
- char uniname2ctype_pool_str1716[sizeof("inhanguljamoextendeda")];
- char uniname2ctype_pool_str1723[sizeof("incountingrodnumerals")];
- char uniname2ctype_pool_str1731[sizeof("lydi")];
- char uniname2ctype_pool_str1733[sizeof("digit")];
- char uniname2ctype_pool_str1735[sizeof("bassavah")];
- char uniname2ctype_pool_str1737[sizeof("inarabicmathematicalalphabeticsymbols")];
- char uniname2ctype_pool_str1739[sizeof("grantha")];
- char uniname2ctype_pool_str1744[sizeof("lydian")];
- char uniname2ctype_pool_str1745[sizeof("insupplementalmathematicaloperators")];
- char uniname2ctype_pool_str1747[sizeof("goth")];
- char uniname2ctype_pool_str1749[sizeof("hebrew")];
- char uniname2ctype_pool_str1757[sizeof("meroitichieroglyphs")];
- char uniname2ctype_pool_str1758[sizeof("incyrillicsupplement")];
- char uniname2ctype_pool_str1764[sizeof("intakri")];
- char uniname2ctype_pool_str1765[sizeof("takr")];
- char uniname2ctype_pool_str1767[sizeof("kaithi")];
- char uniname2ctype_pool_str1776[sizeof("idsb")];
- char uniname2ctype_pool_str1777[sizeof("bidic")];
- char uniname2ctype_pool_str1779[sizeof("incherokeesupplement")];
- char uniname2ctype_pool_str1781[sizeof("inalchemicalsymbols")];
- char uniname2ctype_pool_str1784[sizeof("inkhmersymbols")];
- char uniname2ctype_pool_str1795[sizeof("otherpunctuation")];
- char uniname2ctype_pool_str1796[sizeof("braille")];
- char uniname2ctype_pool_str1798[sizeof("logicalorderexception")];
- char uniname2ctype_pool_str1799[sizeof("incurrencysymbols")];
- char uniname2ctype_pool_str1800[sizeof("tirhuta")];
- char uniname2ctype_pool_str1804[sizeof("inphagspa")];
- char uniname2ctype_pool_str1814[sizeof("inarabicextendeda")];
- char uniname2ctype_pool_str1819[sizeof("brah")];
- char uniname2ctype_pool_str1831[sizeof("hebr")];
- char uniname2ctype_pool_str1834[sizeof("pd")];
- char uniname2ctype_pool_str1836[sizeof("kthi")];
- char uniname2ctype_pool_str1843[sizeof("inethiopicsupplement")];
- char uniname2ctype_pool_str1862[sizeof("runr")];
- char uniname2ctype_pool_str1864[sizeof("olck")];
- char uniname2ctype_pool_str1865[sizeof("ideographic")];
- char uniname2ctype_pool_str1871[sizeof("ogrext")];
- char uniname2ctype_pool_str1875[sizeof("olchiki")];
- char uniname2ctype_pool_str1882[sizeof("inhighprivateusesurrogates")];
- char uniname2ctype_pool_str1892[sizeof("softdotted")];
- char uniname2ctype_pool_str1893[sizeof("inhebrew")];
- char uniname2ctype_pool_str1896[sizeof("number")];
- char uniname2ctype_pool_str1901[sizeof("hluw")];
- char uniname2ctype_pool_str1904[sizeof("inkhojki")];
- char uniname2ctype_pool_str1908[sizeof("sund")];
- char uniname2ctype_pool_str1912[sizeof("deprecated")];
- char uniname2ctype_pool_str1913[sizeof("patsyn")];
- char uniname2ctype_pool_str1931[sizeof("unassigned")];
- char uniname2ctype_pool_str1938[sizeof("phagspa")];
- char uniname2ctype_pool_str1944[sizeof("ingeometricshapesextended")];
- char uniname2ctype_pool_str1945[sizeof("knda")];
- char uniname2ctype_pool_str1956[sizeof("insupplementalarrowsa")];
- char uniname2ctype_pool_str1958[sizeof("inmendekikakui")];
- char uniname2ctype_pool_str1963[sizeof("insupplementalarrowsc")];
- char uniname2ctype_pool_str1964[sizeof("sorasompeng")];
- char uniname2ctype_pool_str1971[sizeof("inhanguljamo")];
- char uniname2ctype_pool_str1974[sizeof("kannada")];
- char uniname2ctype_pool_str1977[sizeof("graph")];
- char uniname2ctype_pool_str1984[sizeof("idstrinaryoperator")];
- char uniname2ctype_pool_str1986[sizeof("hangul")];
- char uniname2ctype_pool_str1989[sizeof("inhanunoo")];
- char uniname2ctype_pool_str1991[sizeof("changeswhencasemapped")];
- char uniname2ctype_pool_str1999[sizeof("nko")];
- char uniname2ctype_pool_str2000[sizeof("nkoo")];
- char uniname2ctype_pool_str2003[sizeof("combiningmark")];
- char uniname2ctype_pool_str2006[sizeof("inkatakanaphoneticextensions")];
- char uniname2ctype_pool_str2012[sizeof("khmr")];
- char uniname2ctype_pool_str2016[sizeof("phlp")];
- char uniname2ctype_pool_str2018[sizeof("khar")];
- char uniname2ctype_pool_str2056[sizeof("otherdefaultignorablecodepoint")];
- char uniname2ctype_pool_str2057[sizeof("enclosingmark")];
- char uniname2ctype_pool_str2071[sizeof("inhalfwidthandfullwidthforms")];
- char uniname2ctype_pool_str2072[sizeof("inmeroiticcursive")];
- char uniname2ctype_pool_str2078[sizeof("inglagolitic")];
- char uniname2ctype_pool_str2081[sizeof("changeswhentitlecased")];
- char uniname2ctype_pool_str2084[sizeof("dep")];
- char uniname2ctype_pool_str2089[sizeof("inbuhid")];
- char uniname2ctype_pool_str2092[sizeof("incombiningdiacriticalmarks")];
- char uniname2ctype_pool_str2096[sizeof("inunifiedcanadianaboriginalsyllabicsextended")];
- char uniname2ctype_pool_str2097[sizeof("any")];
- char uniname2ctype_pool_str2102[sizeof("incombiningdiacriticalmarksforsymbols")];
- char uniname2ctype_pool_str2105[sizeof("kharoshthi")];
- char uniname2ctype_pool_str2116[sizeof("cherokee")];
- char uniname2ctype_pool_str2118[sizeof("inarabicsupplement")];
- char uniname2ctype_pool_str2124[sizeof("pauc")];
- char uniname2ctype_pool_str2126[sizeof("phag")];
- char uniname2ctype_pool_str2127[sizeof("intagalog")];
- char uniname2ctype_pool_str2137[sizeof("inplayingcards")];
- char uniname2ctype_pool_str2141[sizeof("inpahawhhmong")];
- char uniname2ctype_pool_str2150[sizeof("changeswhencasefolded")];
- char uniname2ctype_pool_str2151[sizeof("incyrillicextendedb")];
- char uniname2ctype_pool_str2154[sizeof("incombiningdiacriticalmarkssupplement")];
- char uniname2ctype_pool_str2155[sizeof("alphabetic")];
- char uniname2ctype_pool_str2172[sizeof("glag")];
- char uniname2ctype_pool_str2178[sizeof("hyphen")];
- char uniname2ctype_pool_str2203[sizeof("inyisyllables")];
- char uniname2ctype_pool_str2212[sizeof("bidicontrol")];
- char uniname2ctype_pool_str2215[sizeof("inbengali")];
- char uniname2ctype_pool_str2220[sizeof("spacingmark")];
- char uniname2ctype_pool_str2225[sizeof("cypriot")];
- char uniname2ctype_pool_str2226[sizeof("beng")];
- char uniname2ctype_pool_str2227[sizeof("graphemeextend")];
- char uniname2ctype_pool_str2236[sizeof("khoj")];
- char uniname2ctype_pool_str2240[sizeof("inbuginese")];
- char uniname2ctype_pool_str2251[sizeof("tglg")];
- char uniname2ctype_pool_str2259[sizeof("palmyrene")];
- char uniname2ctype_pool_str2268[sizeof("incypriotsyllabary")];
- char uniname2ctype_pool_str2277[sizeof("punct")];
- char uniname2ctype_pool_str2278[sizeof("khmer")];
- char uniname2ctype_pool_str2283[sizeof("incjksymbolsandpunctuation")];
- char uniname2ctype_pool_str2294[sizeof("inaegeannumbers")];
- char uniname2ctype_pool_str2305[sizeof("tagb")];
- char uniname2ctype_pool_str2307[sizeof("orkh")];
- char uniname2ctype_pool_str2316[sizeof("intagbanwa")];
- char uniname2ctype_pool_str2327[sizeof("oldhungarian")];
- char uniname2ctype_pool_str2348[sizeof("georgian")];
- char uniname2ctype_pool_str2368[sizeof("modifiersymbol")];
- char uniname2ctype_pool_str2376[sizeof("changeswhenlowercased")];
- char uniname2ctype_pool_str2383[sizeof("otheruppercase")];
- char uniname2ctype_pool_str2406[sizeof("signwriting")];
- char uniname2ctype_pool_str2460[sizeof("insupplementaryprivateuseareaa")];
- char uniname2ctype_pool_str2462[sizeof("inkayahli")];
- char uniname2ctype_pool_str2468[sizeof("ugaritic")];
- char uniname2ctype_pool_str2476[sizeof("uideo")];
- char uniname2ctype_pool_str2494[sizeof("inarabicpresentationformsb")];
- char uniname2ctype_pool_str2495[sizeof("nonspacingmark")];
- char uniname2ctype_pool_str2499[sizeof("rejang")];
- char uniname2ctype_pool_str2501[sizeof("inkangxiradicals")];
- char uniname2ctype_pool_str2502[sizeof("incjkcompatibility")];
- char uniname2ctype_pool_str2543[sizeof("bamu")];
- char uniname2ctype_pool_str2545[sizeof("inbamum")];
- char uniname2ctype_pool_str2556[sizeof("pahawhhmong")];
- char uniname2ctype_pool_str2557[sizeof("grbase")];
- char uniname2ctype_pool_str2558[sizeof("aghb")];
- char uniname2ctype_pool_str2560[sizeof("bopo")];
- char uniname2ctype_pool_str2569[sizeof("tagalog")];
- char uniname2ctype_pool_str2571[sizeof("inbopomofo")];
- char uniname2ctype_pool_str2596[sizeof("incombiningdiacriticalmarksextended")];
- char uniname2ctype_pool_str2598[sizeof("inkanbun")];
- char uniname2ctype_pool_str2606[sizeof("oldturkic")];
- char uniname2ctype_pool_str2608[sizeof("defaultignorablecodepoint")];
- char uniname2ctype_pool_str2613[sizeof("ugar")];
- char uniname2ctype_pool_str2636[sizeof("caucasianalbanian")];
- char uniname2ctype_pool_str2649[sizeof("inlatinextendedb")];
- char uniname2ctype_pool_str2662[sizeof("othergraphemeextend")];
- char uniname2ctype_pool_str2681[sizeof("hung")];
- char uniname2ctype_pool_str2685[sizeof("inlimbu")];
- char uniname2ctype_pool_str2689[sizeof("grek")];
- char uniname2ctype_pool_str2692[sizeof("batk")];
- char uniname2ctype_pool_str2700[sizeof("inbatak")];
- char uniname2ctype_pool_str2703[sizeof("incjkradicalssupplement")];
- char uniname2ctype_pool_str2745[sizeof("innoblock")];
- char uniname2ctype_pool_str2755[sizeof("cwu")];
- char uniname2ctype_pool_str2760[sizeof("oldnortharabian")];
- char uniname2ctype_pool_str2772[sizeof("insupplementalsymbolsandpictographs")];
- char uniname2ctype_pool_str2774[sizeof("dupl")];
- char uniname2ctype_pool_str2784[sizeof("dashpunctuation")];
- char uniname2ctype_pool_str2788[sizeof("inbamumsupplement")];
- char uniname2ctype_pool_str2794[sizeof("gujr")];
- char uniname2ctype_pool_str2799[sizeof("inhighsurrogates")];
- char uniname2ctype_pool_str2803[sizeof("lu")];
- char uniname2ctype_pool_str2810[sizeof("qmark")];
- char uniname2ctype_pool_str2815[sizeof("gujarati")];
- char uniname2ctype_pool_str2817[sizeof("limbu")];
- char uniname2ctype_pool_str2824[sizeof("sk")];
- char uniname2ctype_pool_str2833[sizeof("egyp")];
- char uniname2ctype_pool_str2852[sizeof("inlisu")];
- char uniname2ctype_pool_str2873[sizeof("bopomofo")];
- char uniname2ctype_pool_str2895[sizeof("inhanguljamoextendedb")];
- char uniname2ctype_pool_str2899[sizeof("inegyptianhieroglyphs")];
- char uniname2ctype_pool_str2906[sizeof("intelugu")];
- char uniname2ctype_pool_str2921[sizeof("katakana")];
- char uniname2ctype_pool_str2947[sizeof("kayahli")];
- char uniname2ctype_pool_str2950[sizeof("oupper")];
- char uniname2ctype_pool_str2972[sizeof("surrogate")];
- char uniname2ctype_pool_str2991[sizeof("currencysymbol")];
- char uniname2ctype_pool_str3010[sizeof("insupplementalpunctuation")];
- char uniname2ctype_pool_str3040[sizeof("ingeorgiansupplement")];
- char uniname2ctype_pool_str3071[sizeof("unifiedideograph")];
- char uniname2ctype_pool_str3107[sizeof("unknown")];
- char uniname2ctype_pool_str3132[sizeof("zyyy")];
- char uniname2ctype_pool_str3135[sizeof("insupplementalarrowsb")];
- char uniname2ctype_pool_str3166[sizeof("uppercase")];
- char uniname2ctype_pool_str3167[sizeof("khudawadi")];
- char uniname2ctype_pool_str3274[sizeof("inkhudawadi")];
- char uniname2ctype_pool_str3282[sizeof("openpunctuation")];
- char uniname2ctype_pool_str3382[sizeof("upper")];
- char uniname2ctype_pool_str3404[sizeof("buhd")];
- char uniname2ctype_pool_str3406[sizeof("quotationmark")];
- char uniname2ctype_pool_str3441[sizeof("paucinhau")];
- char uniname2ctype_pool_str3442[sizeof("paragraphseparator")];
- char uniname2ctype_pool_str3443[sizeof("khojki")];
- char uniname2ctype_pool_str3450[sizeof("inpaucinhau")];
- char uniname2ctype_pool_str3459[sizeof("inbopomofoextended")];
- char uniname2ctype_pool_str3504[sizeof("uppercaseletter")];
- char uniname2ctype_pool_str3519[sizeof("punctuation")];
- char uniname2ctype_pool_str3529[sizeof("egyptianhieroglyphs")];
- char uniname2ctype_pool_str3531[sizeof("bugi")];
- char uniname2ctype_pool_str3556[sizeof("changeswhenuppercased")];
- char uniname2ctype_pool_str3582[sizeof("buginese")];
- char uniname2ctype_pool_str3626[sizeof("incjkunifiedideographsextensiona")];
- char uniname2ctype_pool_str3633[sizeof("incjkunifiedideographsextensionc")];
- char uniname2ctype_pool_str3634[sizeof("inhangulcompatibilityjamo")];
- char uniname2ctype_pool_str3638[sizeof("incjkunifiedideographsextensione")];
- char uniname2ctype_pool_str3639[sizeof("insupplementaryprivateuseareab")];
- char uniname2ctype_pool_str3643[sizeof("incjkunifiedideographs")];
- char uniname2ctype_pool_str3822[sizeof("oldsoutharabian")];
- char uniname2ctype_pool_str3863[sizeof("inboxdrawing")];
- char uniname2ctype_pool_str3927[sizeof("guru")];
- char uniname2ctype_pool_str3928[sizeof("telugu")];
- char uniname2ctype_pool_str3941[sizeof("buhid")];
- char uniname2ctype_pool_str3974[sizeof("duployan")];
- char uniname2ctype_pool_str4081[sizeof("greek")];
- char uniname2ctype_pool_str4084[sizeof("batak")];
- char uniname2ctype_pool_str4139[sizeof("blank")];
- char uniname2ctype_pool_str4149[sizeof("incjkunifiedideographsextensiond")];
- char uniname2ctype_pool_str4205[sizeof("grlink")];
- char uniname2ctype_pool_str4446[sizeof("graphemelink")];
- char uniname2ctype_pool_str4805[sizeof("incjkunifiedideographsextensionb")];
- char uniname2ctype_pool_str5326[sizeof("gurmukhi")];
+ char uniname2ctype_pool_str5[sizeof("s")];
+ char uniname2ctype_pool_str7[sizeof("z")];
+ char uniname2ctype_pool_str9[sizeof("zs")];
+ char uniname2ctype_pool_str16[sizeof("zzzz")];
+ char uniname2ctype_pool_str18[sizeof("cn")];
+ char uniname2ctype_pool_str20[sizeof("cs")];
+ char uniname2ctype_pool_str24[sizeof("ci")];
+ char uniname2ctype_pool_str29[sizeof("c")];
+ char uniname2ctype_pool_str30[sizeof("cf")];
+ char uniname2ctype_pool_str32[sizeof("sc")];
+ char uniname2ctype_pool_str34[sizeof("cans")];
+ char uniname2ctype_pool_str35[sizeof("qaai")];
+ char uniname2ctype_pool_str38[sizeof("mn")];
+ char uniname2ctype_pool_str42[sizeof("ascii")];
+ char uniname2ctype_pool_str44[sizeof("cc")];
+ char uniname2ctype_pool_str45[sizeof("qaac")];
+ char uniname2ctype_pool_str49[sizeof("inavestan")];
+ char uniname2ctype_pool_str52[sizeof("inspecials")];
+ char uniname2ctype_pool_str62[sizeof("inipaextensions")];
+ char uniname2ctype_pool_str64[sizeof("mc")];
+ char uniname2ctype_pool_str66[sizeof("insamaritan")];
+ char uniname2ctype_pool_str69[sizeof("m")];
+ char uniname2ctype_pool_str72[sizeof("sm")];
+ char uniname2ctype_pool_str74[sizeof("me")];
+ char uniname2ctype_pool_str82[sizeof("inarmenian")];
+ char uniname2ctype_pool_str84[sizeof("incuneiform")];
+ char uniname2ctype_pool_str86[sizeof("mandaic")];
+ char uniname2ctype_pool_str90[sizeof("inancientsymbols")];
+ char uniname2ctype_pool_str92[sizeof("incuneiformnumbersandpunctuation")];
+ char uniname2ctype_pool_str96[sizeof("inthai")];
+ char uniname2ctype_pool_str99[sizeof("inmusicalsymbols")];
+ char uniname2ctype_pool_str100[sizeof("inmiscellaneoussymbols")];
+ char uniname2ctype_pool_str106[sizeof("incham")];
+ char uniname2ctype_pool_str109[sizeof("inmiscellaneoussymbolsandarrows")];
+ char uniname2ctype_pool_str113[sizeof("initialpunctuation")];
+ char uniname2ctype_pool_str114[sizeof("inmiscellaneoussymbolsandpictographs")];
+ char uniname2ctype_pool_str116[sizeof("inthaana")];
+ char uniname2ctype_pool_str124[sizeof("taile")];
+ char uniname2ctype_pool_str125[sizeof("mtei")];
+ char uniname2ctype_pool_str132[sizeof("lc")];
+ char uniname2ctype_pool_str133[sizeof("lana")];
+ char uniname2ctype_pool_str134[sizeof("inlycian")];
+ char uniname2ctype_pool_str135[sizeof("intransportandmapsymbols")];
+ char uniname2ctype_pool_str136[sizeof("incontrolpictures")];
+ char uniname2ctype_pool_str142[sizeof("sinhala")];
+ char uniname2ctype_pool_str151[sizeof("incommonindicnumberforms")];
+ char uniname2ctype_pool_str156[sizeof("inmiscellaneousmathematicalsymbolsa")];
+ char uniname2ctype_pool_str158[sizeof("sterm")];
+ char uniname2ctype_pool_str167[sizeof("inmyanmarextendeda")];
+ char uniname2ctype_pool_str172[sizeof("lm")];
+ char uniname2ctype_pool_str175[sizeof("taiviet")];
+ char uniname2ctype_pool_str179[sizeof("inlinearbideograms")];
+ char uniname2ctype_pool_str180[sizeof("intaitham")];
+ char uniname2ctype_pool_str184[sizeof("latn")];
+ char uniname2ctype_pool_str186[sizeof("latin")];
+ char uniname2ctype_pool_str187[sizeof("ital")];
+ char uniname2ctype_pool_str189[sizeof("alnum")];
+ char uniname2ctype_pool_str199[sizeof("inmalayalam")];
+ char uniname2ctype_pool_str201[sizeof("intaile")];
+ char uniname2ctype_pool_str202[sizeof("tale")];
+ char uniname2ctype_pool_str205[sizeof("l")];
+ char uniname2ctype_pool_str207[sizeof("nl")];
+ char uniname2ctype_pool_str209[sizeof("zl")];
+ char uniname2ctype_pool_str216[sizeof("intamil")];
+ char uniname2ctype_pool_str217[sizeof("taml")];
+ char uniname2ctype_pool_str218[sizeof("inlatinextendeda")];
+ char uniname2ctype_pool_str220[sizeof("inlatinextendedc")];
+ char uniname2ctype_pool_str223[sizeof("inrunic")];
+ char uniname2ctype_pool_str224[sizeof("incarian")];
+ char uniname2ctype_pool_str225[sizeof("insyriac")];
+ char uniname2ctype_pool_str227[sizeof("cari")];
+ char uniname2ctype_pool_str230[sizeof("inmeeteimayekextensions")];
+ char uniname2ctype_pool_str231[sizeof("osma")];
+ char uniname2ctype_pool_str232[sizeof("lt")];
+ char uniname2ctype_pool_str233[sizeof("miao")];
+ char uniname2ctype_pool_str234[sizeof("insharada")];
+ char uniname2ctype_pool_str239[sizeof("incyrillic")];
+ char uniname2ctype_pool_str240[sizeof("carian")];
+ char uniname2ctype_pool_str244[sizeof("armn")];
+ char uniname2ctype_pool_str245[sizeof("samr")];
+ char uniname2ctype_pool_str247[sizeof("armi")];
+ char uniname2ctype_pool_str248[sizeof("inideographicdescriptioncharacters")];
+ char uniname2ctype_pool_str252[sizeof("inosmanya")];
+ char uniname2ctype_pool_str253[sizeof("armenian")];
+ char uniname2ctype_pool_str254[sizeof("inmyanmar")];
+ char uniname2ctype_pool_str255[sizeof("samaritan")];
+ char uniname2ctype_pool_str256[sizeof("arabic")];
+ char uniname2ctype_pool_str259[sizeof("incherokee")];
+ char uniname2ctype_pool_str261[sizeof("connectorpunctuation")];
+ char uniname2ctype_pool_str263[sizeof("merc")];
+ char uniname2ctype_pool_str264[sizeof("inmiscellaneoustechnical")];
+ char uniname2ctype_pool_str268[sizeof("inenclosedalphanumerics")];
+ char uniname2ctype_pool_str279[sizeof("inemoticons")];
+ char uniname2ctype_pool_str281[sizeof("joinc")];
+ char uniname2ctype_pool_str288[sizeof("cntrl")];
+ char uniname2ctype_pool_str301[sizeof("inenclosedcjklettersandmonths")];
+ char uniname2ctype_pool_str303[sizeof("cwcf")];
+ char uniname2ctype_pool_str304[sizeof("inruminumeralsymbols")];
+ char uniname2ctype_pool_str308[sizeof("ll")];
+ char uniname2ctype_pool_str313[sizeof("term")];
+ char uniname2ctype_pool_str316[sizeof("inlatinextendedadditional")];
+ char uniname2ctype_pool_str320[sizeof("tamil")];
+ char uniname2ctype_pool_str321[sizeof("loe")];
+ char uniname2ctype_pool_str329[sizeof("newtailue")];
+ char uniname2ctype_pool_str330[sizeof("cwcm")];
+ char uniname2ctype_pool_str339[sizeof("inenclosedalphanumericsupplement")];
+ char uniname2ctype_pool_str346[sizeof("sinh")];
+ char uniname2ctype_pool_str347[sizeof("zinh")];
+ char uniname2ctype_pool_str349[sizeof("meroiticcursive")];
+ char uniname2ctype_pool_str353[sizeof("han")];
+ char uniname2ctype_pool_str357[sizeof("hani")];
+ char uniname2ctype_pool_str358[sizeof("inopticalcharacterrecognition")];
+ char uniname2ctype_pool_str359[sizeof("no")];
+ char uniname2ctype_pool_str360[sizeof("so")];
+ char uniname2ctype_pool_str364[sizeof("innewtailue")];
+ char uniname2ctype_pool_str365[sizeof("insinhala")];
+ char uniname2ctype_pool_str367[sizeof("innko")];
+ char uniname2ctype_pool_str372[sizeof("co")];
+ char uniname2ctype_pool_str375[sizeof("shavian")];
+ char uniname2ctype_pool_str378[sizeof("terminalpunctuation")];
+ char uniname2ctype_pool_str386[sizeof("intaixuanjingsymbols")];
+ char uniname2ctype_pool_str387[sizeof("inethiopic")];
+ char uniname2ctype_pool_str389[sizeof("sora")];
+ char uniname2ctype_pool_str398[sizeof("inarrows")];
+ char uniname2ctype_pool_str400[sizeof("cham")];
+ char uniname2ctype_pool_str403[sizeof("inlowsurrogates")];
+ char uniname2ctype_pool_str405[sizeof("oriya")];
+ char uniname2ctype_pool_str406[sizeof("ext")];
+ char uniname2ctype_pool_str409[sizeof("cwt")];
+ char uniname2ctype_pool_str412[sizeof("common")];
+ char uniname2ctype_pool_str414[sizeof("inmiao")];
+ char uniname2ctype_pool_str420[sizeof("thai")];
+ char uniname2ctype_pool_str425[sizeof("intifinagh")];
+ char uniname2ctype_pool_str426[sizeof("ethi")];
+ char uniname2ctype_pool_str427[sizeof("mero")];
+ char uniname2ctype_pool_str428[sizeof("chakma")];
+ char uniname2ctype_pool_str429[sizeof("thaa")];
+ char uniname2ctype_pool_str430[sizeof("inscriptionalparthian")];
+ char uniname2ctype_pool_str432[sizeof("tifinagh")];
+ char uniname2ctype_pool_str436[sizeof("titlecaseletter")];
+ char uniname2ctype_pool_str445[sizeof("thaana")];
+ char uniname2ctype_pool_str449[sizeof("asciihexdigit")];
+ char uniname2ctype_pool_str450[sizeof("math")];
+ char uniname2ctype_pool_str453[sizeof("di")];
+ char uniname2ctype_pool_str454[sizeof("ids")];
+ char uniname2ctype_pool_str460[sizeof("lo")];
+ char uniname2ctype_pool_str468[sizeof("inlao")];
+ char uniname2ctype_pool_str470[sizeof("taitham")];
+ char uniname2ctype_pool_str474[sizeof("lao")];
+ char uniname2ctype_pool_str475[sizeof("laoo")];
+ char uniname2ctype_pool_str476[sizeof("dia")];
+ char uniname2ctype_pool_str478[sizeof("idc")];
+ char uniname2ctype_pool_str480[sizeof("ps")];
+ char uniname2ctype_pool_str481[sizeof("insundanese")];
+ char uniname2ctype_pool_str484[sizeof("pi")];
+ char uniname2ctype_pool_str485[sizeof("cwl")];
+ char uniname2ctype_pool_str490[sizeof("pf")];
+ char uniname2ctype_pool_str495[sizeof("mand")];
+ char uniname2ctype_pool_str496[sizeof("insylotinagri")];
+ char uniname2ctype_pool_str497[sizeof("vs")];
+ char uniname2ctype_pool_str503[sizeof("mongolian")];
+ char uniname2ctype_pool_str504[sizeof("pc")];
+ char uniname2ctype_pool_str506[sizeof("inmandaic")];
+ char uniname2ctype_pool_str509[sizeof("invai")];
+ char uniname2ctype_pool_str511[sizeof("lineseparator")];
+ char uniname2ctype_pool_str514[sizeof("pe")];
+ char uniname2ctype_pool_str515[sizeof("vai")];
+ char uniname2ctype_pool_str516[sizeof("vaii")];
+ char uniname2ctype_pool_str517[sizeof("idst")];
+ char uniname2ctype_pool_str520[sizeof("indominotiles")];
+ char uniname2ctype_pool_str521[sizeof("inshavian")];
+ char uniname2ctype_pool_str522[sizeof("inspacingmodifierletters")];
+ char uniname2ctype_pool_str524[sizeof("format")];
+ char uniname2ctype_pool_str528[sizeof("inphaistosdisc")];
+ char uniname2ctype_pool_str531[sizeof("hano")];
+ char uniname2ctype_pool_str532[sizeof("space")];
+ char uniname2ctype_pool_str542[sizeof("indeseret")];
+ char uniname2ctype_pool_str545[sizeof("inolchiki")];
+ char uniname2ctype_pool_str548[sizeof("hira")];
+ char uniname2ctype_pool_str553[sizeof("joincontrol")];
+ char uniname2ctype_pool_str555[sizeof("idcontinue")];
+ char uniname2ctype_pool_str558[sizeof("inmahjongtiles")];
+ char uniname2ctype_pool_str560[sizeof("patws")];
+ char uniname2ctype_pool_str563[sizeof("inlydian")];
+ char uniname2ctype_pool_str564[sizeof("cher")];
+ char uniname2ctype_pool_str568[sizeof("inhiragana")];
+ char uniname2ctype_pool_str572[sizeof("inogham")];
+ char uniname2ctype_pool_str574[sizeof("avst")];
+ char uniname2ctype_pool_str575[sizeof("inscriptionalpahlavi")];
+ char uniname2ctype_pool_str579[sizeof("incoptic")];
+ char uniname2ctype_pool_str587[sizeof("java")];
+ char uniname2ctype_pool_str589[sizeof("inmathematicalalphanumericsymbols")];
+ char uniname2ctype_pool_str594[sizeof("letter")];
+ char uniname2ctype_pool_str604[sizeof("injavanese")];
+ char uniname2ctype_pool_str608[sizeof("avestan")];
+ char uniname2ctype_pool_str612[sizeof("age=1.1")];
+ char uniname2ctype_pool_str613[sizeof("lepc")];
+ char uniname2ctype_pool_str614[sizeof("age=2.1")];
+ char uniname2ctype_pool_str616[sizeof("inlepcha")];
+ char uniname2ctype_pool_str617[sizeof("javanese")];
+ char uniname2ctype_pool_str618[sizeof("shaw")];
+ char uniname2ctype_pool_str619[sizeof("finalpunctuation")];
+ char uniname2ctype_pool_str620[sizeof("alpha")];
+ char uniname2ctype_pool_str621[sizeof("age=5.1")];
+ char uniname2ctype_pool_str622[sizeof("inmongolian")];
+ char uniname2ctype_pool_str623[sizeof("age=5.2")];
+ char uniname2ctype_pool_str626[sizeof("age=2.0")];
+ char uniname2ctype_pool_str627[sizeof("ahex")];
+ char uniname2ctype_pool_str630[sizeof("ingeneralpunctuation")];
+ char uniname2ctype_pool_str631[sizeof("oids")];
+ char uniname2ctype_pool_str632[sizeof("odi")];
+ char uniname2ctype_pool_str633[sizeof("age=5.0")];
+ char uniname2ctype_pool_str636[sizeof("tavt")];
+ char uniname2ctype_pool_str637[sizeof("intaiviet")];
+ char uniname2ctype_pool_str638[sizeof("age=6.1")];
+ char uniname2ctype_pool_str639[sizeof("age=3.1")];
+ char uniname2ctype_pool_str640[sizeof("insundanesesupplement")];
+ char uniname2ctype_pool_str641[sizeof("age=3.2")];
+ char uniname2ctype_pool_str642[sizeof("age=4.1")];
+ char uniname2ctype_pool_str643[sizeof("oidc")];
+ char uniname2ctype_pool_str646[sizeof("tfng")];
+ char uniname2ctype_pool_str647[sizeof("insmallformvariants")];
+ char uniname2ctype_pool_str648[sizeof("ideo")];
+ char uniname2ctype_pool_str649[sizeof("intags")];
+ char uniname2ctype_pool_str650[sizeof("age=6.0")];
+ char uniname2ctype_pool_str651[sizeof("age=3.0")];
+ char uniname2ctype_pool_str653[sizeof("whitespace")];
+ char uniname2ctype_pool_str654[sizeof("age=4.0")];
+ char uniname2ctype_pool_str655[sizeof("inolditalic")];
+ char uniname2ctype_pool_str660[sizeof("oalpha")];
+ char uniname2ctype_pool_str668[sizeof("ingujarati")];
+ char uniname2ctype_pool_str672[sizeof("control")];
+ char uniname2ctype_pool_str679[sizeof("diacritic")];
+ char uniname2ctype_pool_str682[sizeof("tagbanwa")];
+ char uniname2ctype_pool_str690[sizeof("inphoenician")];
+ char uniname2ctype_pool_str701[sizeof("ininscriptionalparthian")];
+ char uniname2ctype_pool_str703[sizeof("ininscriptionalpahlavi")];
+ char uniname2ctype_pool_str704[sizeof("coptic")];
+ char uniname2ctype_pool_str705[sizeof("dsrt")];
+ char uniname2ctype_pool_str706[sizeof("inmodifiertoneletters")];
+ char uniname2ctype_pool_str709[sizeof("xids")];
+ char uniname2ctype_pool_str713[sizeof("hanunoo")];
+ char uniname2ctype_pool_str715[sizeof("inoldturkic")];
+ char uniname2ctype_pool_str721[sizeof("xidc")];
+ char uniname2ctype_pool_str725[sizeof("idstart")];
+ char uniname2ctype_pool_str729[sizeof("inimperialaramaic")];
+ char uniname2ctype_pool_str730[sizeof("invariationselectors")];
+ char uniname2ctype_pool_str734[sizeof("copt")];
+ char uniname2ctype_pool_str737[sizeof("caseignorable")];
+ char uniname2ctype_pool_str738[sizeof("prti")];
+ char uniname2ctype_pool_str739[sizeof("nchar")];
+ char uniname2ctype_pool_str746[sizeof("deseret")];
+ char uniname2ctype_pool_str747[sizeof("decimalnumber")];
+ char uniname2ctype_pool_str748[sizeof("cprt")];
+ char uniname2ctype_pool_str750[sizeof("inlatin1supplement")];
+ char uniname2ctype_pool_str771[sizeof("imperialaramaic")];
+ char uniname2ctype_pool_str776[sizeof("privateuse")];
+ char uniname2ctype_pool_str777[sizeof("casedletter")];
+ char uniname2ctype_pool_str778[sizeof("lowercase")];
+ char uniname2ctype_pool_str780[sizeof("spaceseparator")];
+ char uniname2ctype_pool_str784[sizeof("radical")];
+ char uniname2ctype_pool_str787[sizeof("mong")];
+ char uniname2ctype_pool_str788[sizeof("canadianaboriginal")];
+ char uniname2ctype_pool_str792[sizeof("letternumber")];
+ char uniname2ctype_pool_str796[sizeof("insorasompeng")];
+ char uniname2ctype_pool_str797[sizeof("dash")];
+ char uniname2ctype_pool_str798[sizeof("wspace")];
+ char uniname2ctype_pool_str799[sizeof("ogam")];
+ char uniname2ctype_pool_str802[sizeof("invariationselectorssupplement")];
+ char uniname2ctype_pool_str803[sizeof("print")];
+ char uniname2ctype_pool_str811[sizeof("otheridcontinue")];
+ char uniname2ctype_pool_str815[sizeof("ingurmukhi")];
+ char uniname2ctype_pool_str818[sizeof("closepunctuation")];
+ char uniname2ctype_pool_str823[sizeof("olditalic")];
+ char uniname2ctype_pool_str824[sizeof("noncharactercodepoint")];
+ char uniname2ctype_pool_str826[sizeof("sharada")];
+ char uniname2ctype_pool_str827[sizeof("ingeometricshapes")];
+ char uniname2ctype_pool_str830[sizeof("otheralphabetic")];
+ char uniname2ctype_pool_str831[sizeof("patternwhitespace")];
+ char uniname2ctype_pool_str832[sizeof("po")];
+ char uniname2ctype_pool_str833[sizeof("rjng")];
+ char uniname2ctype_pool_str835[sizeof("ingreekandcoptic")];
+ char uniname2ctype_pool_str841[sizeof("xdigit")];
+ char uniname2ctype_pool_str850[sizeof("gothic")];
+ char uniname2ctype_pool_str851[sizeof("inoldsoutharabian")];
+ char uniname2ctype_pool_str852[sizeof("xidstart")];
+ char uniname2ctype_pool_str854[sizeof("inrejang")];
+ char uniname2ctype_pool_str860[sizeof("idsbinaryoperator")];
+ char uniname2ctype_pool_str867[sizeof("olower")];
+ char uniname2ctype_pool_str869[sizeof("hex")];
+ char uniname2ctype_pool_str870[sizeof("inenclosedideographicsupplement")];
+ char uniname2ctype_pool_str874[sizeof("inalphabeticpresentationforms")];
+ char uniname2ctype_pool_str879[sizeof("inbasiclatin")];
+ char uniname2ctype_pool_str884[sizeof("othersymbol")];
+ char uniname2ctype_pool_str889[sizeof("nd")];
+ char uniname2ctype_pool_str890[sizeof("sd")];
+ char uniname2ctype_pool_str900[sizeof("omath")];
+ char uniname2ctype_pool_str901[sizeof("separator")];
+ char uniname2ctype_pool_str907[sizeof("inarabic")];
+ char uniname2ctype_pool_str912[sizeof("xidcontinue")];
+ char uniname2ctype_pool_str913[sizeof("otheridstart")];
+ char uniname2ctype_pool_str914[sizeof("grext")];
+ char uniname2ctype_pool_str917[sizeof("otherlowercase")];
+ char uniname2ctype_pool_str919[sizeof("phli")];
+ char uniname2ctype_pool_str920[sizeof("cased")];
+ char uniname2ctype_pool_str923[sizeof("hang")];
+ char uniname2ctype_pool_str931[sizeof("xpeo")];
+ char uniname2ctype_pool_str933[sizeof("lower")];
+ char uniname2ctype_pool_str936[sizeof("modifierletter")];
+ char uniname2ctype_pool_str938[sizeof("inphoneticextensions")];
+ char uniname2ctype_pool_str939[sizeof("inarabicpresentationformsa")];
+ char uniname2ctype_pool_str943[sizeof("innumberforms")];
+ char uniname2ctype_pool_str945[sizeof("oldpersian")];
+ char uniname2ctype_pool_str946[sizeof("incyrillicextendeda")];
+ char uniname2ctype_pool_str947[sizeof("inverticalforms")];
+ char uniname2ctype_pool_str949[sizeof("p")];
+ char uniname2ctype_pool_str950[sizeof("inbyzantinemusicalsymbols")];
+ char uniname2ctype_pool_str951[sizeof("inmathematicaloperators")];
+ char uniname2ctype_pool_str952[sizeof("intibetan")];
+ char uniname2ctype_pool_str953[sizeof("zp")];
+ char uniname2ctype_pool_str956[sizeof("ingeorgian")];
+ char uniname2ctype_pool_str960[sizeof("inbraillepatterns")];
+ char uniname2ctype_pool_str962[sizeof("lepcha")];
+ char uniname2ctype_pool_str963[sizeof("geor")];
+ char uniname2ctype_pool_str964[sizeof("invedicextensions")];
+ char uniname2ctype_pool_str965[sizeof("linb")];
+ char uniname2ctype_pool_str966[sizeof("other")];
+ char uniname2ctype_pool_str970[sizeof("deva")];
+ char uniname2ctype_pool_str972[sizeof("indevanagari")];
+ char uniname2ctype_pool_str973[sizeof("othernumber")];
+ char uniname2ctype_pool_str974[sizeof("bamum")];
+ char uniname2ctype_pool_str976[sizeof("shrd")];
+ char uniname2ctype_pool_str977[sizeof("bali")];
+ char uniname2ctype_pool_str981[sizeof("devanagari")];
+ char uniname2ctype_pool_str983[sizeof("extender")];
+ char uniname2ctype_pool_str988[sizeof("inherited")];
+ char uniname2ctype_pool_str989[sizeof("glagolitic")];
+ char uniname2ctype_pool_str990[sizeof("tibt")];
+ char uniname2ctype_pool_str994[sizeof("inbalinese")];
+ char uniname2ctype_pool_str996[sizeof("ingothic")];
+ char uniname2ctype_pool_str997[sizeof("inmiscellaneousmathematicalsymbolsb")];
+ char uniname2ctype_pool_str998[sizeof("limb")];
+ char uniname2ctype_pool_str1000[sizeof("bengali")];
+ char uniname2ctype_pool_str1003[sizeof("phoenician")];
+ char uniname2ctype_pool_str1004[sizeof("insuperscriptsandsubscripts")];
+ char uniname2ctype_pool_str1006[sizeof("inmeroitichieroglyphs")];
+ char uniname2ctype_pool_str1007[sizeof("tibetan")];
+ char uniname2ctype_pool_str1010[sizeof("inphoneticextensionssupplement")];
+ char uniname2ctype_pool_str1016[sizeof("balinese")];
+ char uniname2ctype_pool_str1021[sizeof("lowercaseletter")];
+ char uniname2ctype_pool_str1031[sizeof("indingbats")];
+ char uniname2ctype_pool_str1035[sizeof("inprivateusearea")];
+ char uniname2ctype_pool_str1039[sizeof("assigned")];
+ char uniname2ctype_pool_str1044[sizeof("patternsyntax")];
+ char uniname2ctype_pool_str1051[sizeof("inhangulsyllables")];
+ char uniname2ctype_pool_str1065[sizeof("sarb")];
+ char uniname2ctype_pool_str1067[sizeof("brai")];
+ char uniname2ctype_pool_str1069[sizeof("insupplementalmathematicaloperators")];
+ char uniname2ctype_pool_str1070[sizeof("phnx")];
+ char uniname2ctype_pool_str1072[sizeof("ingreekextended")];
+ char uniname2ctype_pool_str1074[sizeof("otherletter")];
+ char uniname2ctype_pool_str1076[sizeof("arab")];
+ char uniname2ctype_pool_str1078[sizeof("inlatinextendedd")];
+ char uniname2ctype_pool_str1081[sizeof("word")];
+ char uniname2ctype_pool_str1084[sizeof("inphagspa")];
+ char uniname2ctype_pool_str1087[sizeof("inblockelements")];
+ char uniname2ctype_pool_str1092[sizeof("ethiopic")];
+ char uniname2ctype_pool_str1094[sizeof("inethiopicextendeda")];
+ char uniname2ctype_pool_str1107[sizeof("brahmi")];
+ char uniname2ctype_pool_str1110[sizeof("logicalorderexception")];
+ char uniname2ctype_pool_str1114[sizeof("inoldpersian")];
+ char uniname2ctype_pool_str1129[sizeof("inletterlikesymbols")];
+ char uniname2ctype_pool_str1133[sizeof("sorasompeng")];
+ char uniname2ctype_pool_str1135[sizeof("hiragana")];
+ char uniname2ctype_pool_str1142[sizeof("inhanguljamoextendeda")];
+ char uniname2ctype_pool_str1147[sizeof("othermath")];
+ char uniname2ctype_pool_str1150[sizeof("digit")];
+ char uniname2ctype_pool_str1151[sizeof("goth")];
+ char uniname2ctype_pool_str1156[sizeof("ogham")];
+ char uniname2ctype_pool_str1162[sizeof("sundanese")];
+ char uniname2ctype_pool_str1170[sizeof("saurashtra")];
+ char uniname2ctype_pool_str1173[sizeof("linearb")];
+ char uniname2ctype_pool_str1179[sizeof("graphemebase")];
+ char uniname2ctype_pool_str1185[sizeof("inunifiedcanadianaboriginalsyllabics")];
+ char uniname2ctype_pool_str1186[sizeof("cuneiform")];
+ char uniname2ctype_pool_str1188[sizeof("inkannada")];
+ char uniname2ctype_pool_str1190[sizeof("kana")];
+ char uniname2ctype_pool_str1195[sizeof("inancientgreeknumbers")];
+ char uniname2ctype_pool_str1196[sizeof("incjkstrokes")];
+ char uniname2ctype_pool_str1198[sizeof("inglagolitic")];
+ char uniname2ctype_pool_str1202[sizeof("inancientgreekmusicalnotation")];
+ char uniname2ctype_pool_str1212[sizeof("inchakma")];
+ char uniname2ctype_pool_str1215[sizeof("plrd")];
+ char uniname2ctype_pool_str1219[sizeof("inbrahmi")];
+ char uniname2ctype_pool_str1224[sizeof("cakm")];
+ char uniname2ctype_pool_str1225[sizeof("incjkcompatibilityforms")];
+ char uniname2ctype_pool_str1229[sizeof("lisu")];
+ char uniname2ctype_pool_str1230[sizeof("incjkcompatibilityideographs")];
+ char uniname2ctype_pool_str1231[sizeof("intagalog")];
+ char uniname2ctype_pool_str1244[sizeof("inkaithi")];
+ char uniname2ctype_pool_str1245[sizeof("insupplementalarrowsa")];
+ char uniname2ctype_pool_str1249[sizeof("takri")];
+ char uniname2ctype_pool_str1253[sizeof("ideographic")];
+ char uniname2ctype_pool_str1256[sizeof("hexdigit")];
+ char uniname2ctype_pool_str1259[sizeof("glag")];
+ char uniname2ctype_pool_str1261[sizeof("softdotted")];
+ char uniname2ctype_pool_str1262[sizeof("variationselector")];
+ char uniname2ctype_pool_str1264[sizeof("inkatakana")];
+ char uniname2ctype_pool_str1265[sizeof("meeteimayek")];
+ char uniname2ctype_pool_str1274[sizeof("otherpunctuation")];
+ char uniname2ctype_pool_str1279[sizeof("inhanguljamo")];
+ char uniname2ctype_pool_str1282[sizeof("kali")];
+ char uniname2ctype_pool_str1289[sizeof("braille")];
+ char uniname2ctype_pool_str1298[sizeof("incombininghalfmarks")];
+ char uniname2ctype_pool_str1300[sizeof("talu")];
+ char uniname2ctype_pool_str1302[sizeof("incjkcompatibilityideographssupplement")];
+ char uniname2ctype_pool_str1306[sizeof("telu")];
+ char uniname2ctype_pool_str1307[sizeof("idsb")];
+ char uniname2ctype_pool_str1310[sizeof("tglg")];
+ char uniname2ctype_pool_str1313[sizeof("inmeeteimayek")];
+ char uniname2ctype_pool_str1315[sizeof("yi")];
+ char uniname2ctype_pool_str1318[sizeof("phagspa")];
+ char uniname2ctype_pool_str1321[sizeof("yiii")];
+ char uniname2ctype_pool_str1323[sizeof("inarabicmathematicalalphabeticsymbols")];
+ char uniname2ctype_pool_str1328[sizeof("saur")];
+ char uniname2ctype_pool_str1330[sizeof("ogrext")];
+ char uniname2ctype_pool_str1334[sizeof("bidic")];
+ char uniname2ctype_pool_str1341[sizeof("inkanasupplement")];
+ char uniname2ctype_pool_str1343[sizeof("runic")];
+ char uniname2ctype_pool_str1344[sizeof("inalchemicalsymbols")];
+ char uniname2ctype_pool_str1350[sizeof("georgian")];
+ char uniname2ctype_pool_str1351[sizeof("inugaritic")];
+ char uniname2ctype_pool_str1354[sizeof("insaurashtra")];
+ char uniname2ctype_pool_str1356[sizeof("inhighprivateusesurrogates")];
+ char uniname2ctype_pool_str1362[sizeof("pd")];
+ char uniname2ctype_pool_str1372[sizeof("incountingrodnumerals")];
+ char uniname2ctype_pool_str1377[sizeof("inarabicextendeda")];
+ char uniname2ctype_pool_str1389[sizeof("inkharoshthi")];
+ char uniname2ctype_pool_str1393[sizeof("idstrinaryoperator")];
+ char uniname2ctype_pool_str1396[sizeof("phag")];
+ char uniname2ctype_pool_str1398[sizeof("brah")];
+ char uniname2ctype_pool_str1402[sizeof("mark")];
+ char uniname2ctype_pool_str1404[sizeof("hebr")];
+ char uniname2ctype_pool_str1411[sizeof("inkhmersymbols")];
+ char uniname2ctype_pool_str1413[sizeof("dep")];
+ char uniname2ctype_pool_str1416[sizeof("inkhmer")];
+ char uniname2ctype_pool_str1422[sizeof("deprecated")];
+ char uniname2ctype_pool_str1424[sizeof("rejang")];
+ char uniname2ctype_pool_str1429[sizeof("lyci")];
+ char uniname2ctype_pool_str1431[sizeof("intakri")];
+ char uniname2ctype_pool_str1432[sizeof("takr")];
+ char uniname2ctype_pool_str1435[sizeof("incyrillicsupplement")];
+ char uniname2ctype_pool_str1436[sizeof("changeswhencasefolded")];
+ char uniname2ctype_pool_str1438[sizeof("indevanagariextended")];
+ char uniname2ctype_pool_str1442[sizeof("lycian")];
+ char uniname2ctype_pool_str1443[sizeof("inbengali")];
+ char uniname2ctype_pool_str1448[sizeof("beng")];
+ char uniname2ctype_pool_str1450[sizeof("graph")];
+ char uniname2ctype_pool_str1452[sizeof("inyijinghexagramsymbols")];
+ char uniname2ctype_pool_str1457[sizeof("olck")];
+ char uniname2ctype_pool_str1460[sizeof("inarabicsupplement")];
+ char uniname2ctype_pool_str1462[sizeof("inbuginese")];
+ char uniname2ctype_pool_str1463[sizeof("changeswhencasemapped")];
+ char uniname2ctype_pool_str1468[sizeof("olchiki")];
+ char uniname2ctype_pool_str1478[sizeof("inaegeannumbers")];
+ char uniname2ctype_pool_str1479[sizeof("mlym")];
+ char uniname2ctype_pool_str1480[sizeof("alphabetic")];
+ char uniname2ctype_pool_str1492[sizeof("sylotinagri")];
+ char uniname2ctype_pool_str1498[sizeof("changeswhentitlecased")];
+ char uniname2ctype_pool_str1504[sizeof("tagalog")];
+ char uniname2ctype_pool_str1505[sizeof("tagb")];
+ char uniname2ctype_pool_str1506[sizeof("runr")];
+ char uniname2ctype_pool_str1510[sizeof("malayalam")];
+ char uniname2ctype_pool_str1512[sizeof("inoriya")];
+ char uniname2ctype_pool_str1516[sizeof("intagbanwa")];
+ char uniname2ctype_pool_str1517[sizeof("syrc")];
+ char uniname2ctype_pool_str1519[sizeof("nko")];
+ char uniname2ctype_pool_str1520[sizeof("nkoo")];
+ char uniname2ctype_pool_str1523[sizeof("inethiopicextended")];
+ char uniname2ctype_pool_str1525[sizeof("kaithi")];
+ char uniname2ctype_pool_str1530[sizeof("mathsymbol")];
+ char uniname2ctype_pool_str1531[sizeof("inyiradicals")];
+ char uniname2ctype_pool_str1536[sizeof("insupplementaryprivateuseareaa")];
+ char uniname2ctype_pool_str1540[sizeof("osmanya")];
+ char uniname2ctype_pool_str1546[sizeof("syriac")];
+ char uniname2ctype_pool_str1548[sizeof("otherdefaultignorablecodepoint")];
+ char uniname2ctype_pool_str1561[sizeof("number")];
+ char uniname2ctype_pool_str1565[sizeof("inlinearbsyllabary")];
+ char uniname2ctype_pool_str1566[sizeof("kthi")];
+ char uniname2ctype_pool_str1567[sizeof("sund")];
+ char uniname2ctype_pool_str1569[sizeof("mymr")];
+ char uniname2ctype_pool_str1571[sizeof("incombiningdiacriticalmarks")];
+ char uniname2ctype_pool_str1578[sizeof("enclosingmark")];
+ char uniname2ctype_pool_str1581[sizeof("incombiningdiacriticalmarksforsymbols")];
+ char uniname2ctype_pool_str1583[sizeof("inethiopicsupplement")];
+ char uniname2ctype_pool_str1590[sizeof("unassigned")];
+ char uniname2ctype_pool_str1591[sizeof("sylo")];
+ char uniname2ctype_pool_str1595[sizeof("combiningmark")];
+ char uniname2ctype_pool_str1598[sizeof("myanmar")];
+ char uniname2ctype_pool_str1605[sizeof("graphemeextend")];
+ char uniname2ctype_pool_str1606[sizeof("bidicontrol")];
+ char uniname2ctype_pool_str1609[sizeof("inhalfwidthandfullwidthforms")];
+ char uniname2ctype_pool_str1617[sizeof("cyrl")];
+ char uniname2ctype_pool_str1620[sizeof("knda")];
+ char uniname2ctype_pool_str1634[sizeof("inunifiedcanadianaboriginalsyllabicsextended")];
+ char uniname2ctype_pool_str1635[sizeof("xsux")];
+ char uniname2ctype_pool_str1636[sizeof("modifiersymbol")];
+ char uniname2ctype_pool_str1643[sizeof("incombiningdiacriticalmarkssupplement")];
+ char uniname2ctype_pool_str1645[sizeof("inhanunoo")];
+ char uniname2ctype_pool_str1648[sizeof("inbuhid")];
+ char uniname2ctype_pool_str1649[sizeof("kannada")];
+ char uniname2ctype_pool_str1658[sizeof("inhebrew")];
+ char uniname2ctype_pool_str1662[sizeof("grbase")];
+ char uniname2ctype_pool_str1664[sizeof("spacingmark")];
+ char uniname2ctype_pool_str1670[sizeof("inkatakanaphoneticextensions")];
+ char uniname2ctype_pool_str1676[sizeof("hangul")];
+ char uniname2ctype_pool_str1683[sizeof("incjksymbolsandpunctuation")];
+ char uniname2ctype_pool_str1688[sizeof("bopo")];
+ char uniname2ctype_pool_str1692[sizeof("orya")];
+ char uniname2ctype_pool_str1699[sizeof("inbopomofo")];
+ char uniname2ctype_pool_str1701[sizeof("kharoshthi")];
+ char uniname2ctype_pool_str1703[sizeof("khar")];
+ char uniname2ctype_pool_str1709[sizeof("changeswhenlowercased")];
+ char uniname2ctype_pool_str1724[sizeof("khmr")];
+ char uniname2ctype_pool_str1725[sizeof("punct")];
+ char uniname2ctype_pool_str1729[sizeof("symbol")];
+ char uniname2ctype_pool_str1732[sizeof("cherokee")];
+ char uniname2ctype_pool_str1737[sizeof("cyrillic")];
+ char uniname2ctype_pool_str1759[sizeof("inkangxiradicals")];
+ char uniname2ctype_pool_str1761[sizeof("hebrew")];
+ char uniname2ctype_pool_str1780[sizeof("inarabicpresentationformsb")];
+ char uniname2ctype_pool_str1787[sizeof("incyrillicextendedb")];
+ char uniname2ctype_pool_str1790[sizeof("ugaritic")];
+ char uniname2ctype_pool_str1829[sizeof("incurrencysymbols")];
+ char uniname2ctype_pool_str1831[sizeof("meroitichieroglyphs")];
+ char uniname2ctype_pool_str1835[sizeof("inhighsurrogates")];
+ char uniname2ctype_pool_str1853[sizeof("nonspacingmark")];
+ char uniname2ctype_pool_str1858[sizeof("lydi")];
+ char uniname2ctype_pool_str1864[sizeof("patsyn")];
+ char uniname2ctype_pool_str1868[sizeof("orkh")];
+ char uniname2ctype_pool_str1871[sizeof("lydian")];
+ char uniname2ctype_pool_str1896[sizeof("ugar")];
+ char uniname2ctype_pool_str1899[sizeof("othergraphemeextend")];
+ char uniname2ctype_pool_str1900[sizeof("inlatinextendedb")];
+ char uniname2ctype_pool_str1904[sizeof("bopomofo")];
+ char uniname2ctype_pool_str1917[sizeof("khmer")];
+ char uniname2ctype_pool_str1925[sizeof("uideo")];
+ char uniname2ctype_pool_str1932[sizeof("otheruppercase")];
+ char uniname2ctype_pool_str1944[sizeof("grek")];
+ char uniname2ctype_pool_str1949[sizeof("gujr")];
+ char uniname2ctype_pool_str1970[sizeof("gujarati")];
+ char uniname2ctype_pool_str1983[sizeof("inhanguljamoextendedb")];
+ char uniname2ctype_pool_str1988[sizeof("defaultignorablecodepoint")];
+ char uniname2ctype_pool_str2005[sizeof("inplayingcards")];
+ char uniname2ctype_pool_str2022[sizeof("bamu")];
+ char uniname2ctype_pool_str2028[sizeof("inkanbun")];
+ char uniname2ctype_pool_str2033[sizeof("incjkradicalssupplement")];
+ char uniname2ctype_pool_str2046[sizeof("cypriot")];
+ char uniname2ctype_pool_str2051[sizeof("inbamum")];
+ char uniname2ctype_pool_str2053[sizeof("inmeroiticcursive")];
+ char uniname2ctype_pool_str2055[sizeof("oldturkic")];
+ char uniname2ctype_pool_str2086[sizeof("insupplementalarrowsb")];
+ char uniname2ctype_pool_str2087[sizeof("surrogate")];
+ char uniname2ctype_pool_str2094[sizeof("batk")];
+ char uniname2ctype_pool_str2102[sizeof("inbatak")];
+ char uniname2ctype_pool_str2119[sizeof("inlimbu")];
+ char uniname2ctype_pool_str2123[sizeof("incypriotsyllabary")];
+ char uniname2ctype_pool_str2129[sizeof("dashpunctuation")];
+ char uniname2ctype_pool_str2130[sizeof("innoblock")];
+ char uniname2ctype_pool_str2141[sizeof("hyphen")];
+ char uniname2ctype_pool_str2162[sizeof("insupplementalpunctuation")];
+ char uniname2ctype_pool_str2165[sizeof("ingeorgiansupplement")];
+ char uniname2ctype_pool_str2178[sizeof("oupper")];
+ char uniname2ctype_pool_str2189[sizeof("paragraphseparator")];
+ char uniname2ctype_pool_str2194[sizeof("inbamumsupplement")];
+ char uniname2ctype_pool_str2299[sizeof("uppercase")];
+ char uniname2ctype_pool_str2313[sizeof("currencysymbol")];
+ char uniname2ctype_pool_str2322[sizeof("sk")];
+ char uniname2ctype_pool_str2338[sizeof("lu")];
+ char uniname2ctype_pool_str2342[sizeof("openpunctuation")];
+ char uniname2ctype_pool_str2349[sizeof("inlisu")];
+ char uniname2ctype_pool_str2371[sizeof("qmark")];
+ char uniname2ctype_pool_str2372[sizeof("egyp")];
+ char uniname2ctype_pool_str2377[sizeof("insupplementaryprivateuseareab")];
+ char uniname2ctype_pool_str2379[sizeof("limbu")];
+ char uniname2ctype_pool_str2400[sizeof("inegyptianhieroglyphs")];
+ char uniname2ctype_pool_str2401[sizeof("unifiedideograph")];
+ char uniname2ctype_pool_str2413[sizeof("intelugu")];
+ char uniname2ctype_pool_str2429[sizeof("katakana")];
+ char uniname2ctype_pool_str2442[sizeof("inhangulcompatibilityjamo")];
+ char uniname2ctype_pool_str2454[sizeof("upper")];
+ char uniname2ctype_pool_str2495[sizeof("inkayahli")];
+ char uniname2ctype_pool_str2515[sizeof("cwu")];
+ char uniname2ctype_pool_str2523[sizeof("incjkcompatibility")];
+ char uniname2ctype_pool_str2542[sizeof("uppercaseletter")];
+ char uniname2ctype_pool_str2549[sizeof("bugi")];
+ char uniname2ctype_pool_str2588[sizeof("buginese")];
+ char uniname2ctype_pool_str2627[sizeof("any")];
+ char uniname2ctype_pool_str2651[sizeof("inyisyllables")];
+ char uniname2ctype_pool_str2671[sizeof("inbopomofoextended")];
+ char uniname2ctype_pool_str2710[sizeof("inboxdrawing")];
+ char uniname2ctype_pool_str2724[sizeof("changeswhenuppercased")];
+ char uniname2ctype_pool_str2727[sizeof("unknown")];
+ char uniname2ctype_pool_str2737[sizeof("quotationmark")];
+ char uniname2ctype_pool_str2753[sizeof("buhd")];
+ char uniname2ctype_pool_str2785[sizeof("punctuation")];
+ char uniname2ctype_pool_str2888[sizeof("oldsoutharabian")];
+ char uniname2ctype_pool_str2925[sizeof("kayahli")];
+ char uniname2ctype_pool_str2940[sizeof("incjkunifiedideographs")];
+ char uniname2ctype_pool_str2961[sizeof("incjkunifiedideographsextensiona")];
+ char uniname2ctype_pool_str2962[sizeof("incjkunifiedideographsextensionc")];
+ char uniname2ctype_pool_str2995[sizeof("telugu")];
+ char uniname2ctype_pool_str3000[sizeof("guru")];
+ char uniname2ctype_pool_str3104[sizeof("greek")];
+ char uniname2ctype_pool_str3189[sizeof("grlink")];
+ char uniname2ctype_pool_str3197[sizeof("buhid")];
+ char uniname2ctype_pool_str3254[sizeof("batak")];
+ char uniname2ctype_pool_str3292[sizeof("blank")];
+ char uniname2ctype_pool_str3391[sizeof("incjkunifiedideographsextensiond")];
+ char uniname2ctype_pool_str3459[sizeof("graphemelink")];
+ char uniname2ctype_pool_str3480[sizeof("egyptianhieroglyphs")];
+ char uniname2ctype_pool_str3802[sizeof("incjkunifiedideographsextensionb")];
+ char uniname2ctype_pool_str3922[sizeof("zyyy")];
+ char uniname2ctype_pool_str4167[sizeof("gurmukhi")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
@@ -31617,768 +26709,650 @@ static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
"upper",
#else /* USE_UNICODE_PROPERTIES */
"n",
- "mn",
- "m",
+ "s",
"z",
+ "zs",
+ "zzzz",
"cn",
- "mani",
+ "cs",
"ci",
- "inmanichaean",
- "zzzz",
- "qaai",
"c",
- "mc",
- "qaac",
- "sm",
- "incham",
- "me",
- "inarmenian",
- "cc",
- "mandaic",
- "incuneiform",
- "insamaritan",
- "cans",
- "s",
+ "cf",
"sc",
+ "cans",
+ "qaai",
+ "mn",
#endif /* USE_UNICODE_PROPERTIES */
"ascii",
#ifdef USE_UNICODE_PROPERTIES
- "zs",
+ "cc",
+ "qaac",
"inavestan",
- "cs",
+ "inspecials",
"inipaextensions",
+ "mc",
+ "insamaritan",
+ "m",
+ "sm",
+ "me",
+ "inarmenian",
+ "incuneiform",
+ "mandaic",
+ "inancientsymbols",
"incuneiformnumbersandpunctuation",
- "incommonindicnumberforms",
"inthai",
- "cwcm",
- "mtei",
- "inspecials",
+ "inmusicalsymbols",
+ "inmiscellaneoussymbols",
+ "incham",
+ "inmiscellaneoussymbolsandarrows",
"initialpunctuation",
- "invai",
+ "inmiscellaneoussymbolsandpictographs",
"inthaana",
- "inancientsymbols",
- "vai",
- "vaii",
- "inmiscellaneousmathematicalsymbolsa",
- "newtailue",
- "inmusicalsymbols",
- "lm",
"taile",
- "lina",
- "inmyanmarextendeda",
- "sterm",
+ "mtei",
+ "lc",
"lana",
- "alnum",
"inlycian",
- "lc",
- "inmalayalam",
- "inshavian",
- "inmiscellaneoussymbols",
- "inlineara",
"intransportandmapsymbols",
- "vs",
- "inmiscellaneoussymbolsandarrows",
- "intaitham",
- "innewtailue",
- "inmiscellaneoussymbolsandpictographs",
"incontrolpictures",
"sinhala",
+ "incommonindicnumberforms",
+ "inmiscellaneousmathematicalsymbolsa",
+ "sterm",
+ "inmyanmarextendeda",
+ "lm",
"taiviet",
+ "inlinearbideograms",
+ "intaitham",
"latn",
"latin",
"ital",
- "intamil",
- "taml",
- "inmultani",
- "avst",
- "inlinearbideograms",
- "avestan",
- "intaixuanjingsymbols",
+ "alnum",
+ "inmalayalam",
"intaile",
"tale",
- "cwt",
- "cwcf",
- "armn",
- "inlatinextendeda",
- "armi",
"l",
"nl",
- "armenian",
- "inmyanmar",
- "inrunic",
- "incarian",
"zl",
+ "intamil",
+ "taml",
+ "inlatinextendeda",
"inlatinextendedc",
+ "inrunic",
+ "incarian",
+ "insyriac",
"cari",
"inmeeteimayekextensions",
- "inlatinextendede",
- "carian",
- "merc",
- "ext",
+ "osma",
+ "lt",
+ "miao",
+ "insharada",
"incyrillic",
- "tavt",
- "intaiviet",
+ "carian",
+ "armn",
"samr",
- "miao",
- "lt",
- "inlowsurrogates",
+ "armi",
+ "inideographicdescriptioncharacters",
+ "inosmanya",
+ "armenian",
+ "inmyanmar",
"samaritan",
- "inahom",
"arabic",
- "insyriac",
- "insharada",
- "java",
- "inosmanya",
"incherokee",
- "cf",
- "inmiscellaneoustechnical",
- "inruminumeralsymbols",
- "zinh",
- "han",
- "osma",
- "hani",
- "injavanese",
- "wara",
- "inwarangciti",
- "inmahajani",
- "cham",
- "javanese",
- "term",
- "sinh",
- "cwl",
- "manichaean",
- "insmallformvariants",
"connectorpunctuation",
+ "merc",
+ "inmiscellaneoustechnical",
"inenclosedalphanumerics",
- "inethiopic",
- "tamil",
+ "inemoticons",
+ "joinc",
#endif /* USE_UNICODE_PROPERTIES */
"cntrl",
#ifdef USE_UNICODE_PROPERTIES
- "insinhala",
- "chakma",
- "shavian",
- "inlatinextendedadditional",
+ "inenclosedcjklettersandmonths",
+ "cwcf",
+ "inruminumeralsymbols",
"ll",
- "lineara",
- "inideographicdescriptioncharacters",
- "thai",
- "math",
- "thaa",
+ "term",
+ "inlatinextendedadditional",
+ "tamil",
+ "loe",
+ "newtailue",
+ "cwcm",
"inenclosedalphanumericsupplement",
- "ethi",
- "hatran",
+ "sinh",
+ "zinh",
"meroiticcursive",
- "inemoticons",
- "shaw",
- "taitham",
- "thaana",
- "insinhalaarchaicnumbers",
- "ahex",
- "loe",
- "invariationselectors",
- "terminalpunctuation",
- "whitespace",
- "asciihexdigit",
- "inearlydynasticcuneiform",
+ "han",
+ "hani",
"inopticalcharacterrecognition",
- "joinc",
- "di",
- "inenclosedcjklettersandmonths",
- "mand",
- "inmodi",
- "mahj",
- "dia",
- "mend",
- "inmandaic",
- "invariationselectorssupplement",
- "idc",
- "mahajani",
- "sind",
- "hex",
- "oriya",
- "mero",
- "titlecaseletter",
"no",
- "inscriptionalparthian",
+ "so",
+ "innewtailue",
+ "insinhala",
"innko",
- "insundanese",
- "inmro",
- "intifinagh",
- "ids",
- "sora",
"co",
- "tifinagh",
- "indominotiles",
- "hira",
+ "shavian",
+ "terminalpunctuation",
+ "intaixuanjingsymbols",
+ "inethiopic",
+ "sora",
"inarrows",
- "inmiao",
+ "cham",
+ "inlowsurrogates",
+ "oriya",
+ "ext",
+ "cwt",
"common",
- "so",
- "inhiragana",
- "cher",
- "hano",
- "ahom",
- "xidc",
- "idst",
- "inogham",
- "inolchiki",
- "idcontinue",
- "inmathematicalalphanumericsymbols",
- "xids",
- "inscriptionalpahlavi",
- "indevanagari",
- "inlydian",
- "deva",
- "inspacingmodifierletters",
- "indeseret",
- "anatolianhieroglyphs",
- "tirh",
- "devanagari",
- "inhatran",
- "hatr",
- "invedicextensions",
- "intirhuta",
- "inmahjongtiles",
+ "inmiao",
+ "thai",
+ "intifinagh",
+ "ethi",
+ "mero",
+ "chakma",
+ "thaa",
+ "inscriptionalparthian",
+ "tifinagh",
+ "titlecaseletter",
+ "thaana",
+ "asciihexdigit",
+ "math",
+ "di",
+ "ids",
"lo",
"inlao",
+ "taitham",
"lao",
"laoo",
- "mongolian",
+ "dia",
+ "idc",
+ "ps",
+ "insundanese",
"pi",
+ "cwl",
+ "pf",
+ "mand",
"insylotinagri",
- "lineseparator",
+ "vs",
+ "mongolian",
"pc",
+ "inmandaic",
+ "invai",
+ "lineseparator",
"pe",
+ "vai",
+ "vaii",
+ "idst",
+ "indominotiles",
+ "inshavian",
+ "inspacingmodifierletters",
+ "format",
"inphaistosdisc",
- "letter",
- "inanatolianhieroglyphs",
- "oalpha",
- "ps",
- "inverticalforms",
- "xdigit",
- "lowercase",
- "odi",
- "diacritic",
- "modi",
- "xidstart",
- "inshorthandformatcontrols",
- "oidc",
+ "hano",
#endif /* USE_UNICODE_PROPERTIES */
"space",
#ifdef USE_UNICODE_PROPERTIES
- "ideo",
- "inolditalic",
- "mro",
- "mroo",
- "insundanesesupplement",
- "oids",
- "nchar",
- "decimalnumber",
- "incoptic",
- "palm",
- "format",
- "dsrt",
- "dash",
- "inmodifiertoneletters",
- "patws",
- "alpha",
- "siddham",
- "inlepcha",
- "wspace",
- "inpalmyrene",
- "lepc",
- "idstart",
- "inprivateusearea",
- "psalterpahlavi",
- "incopticepactnumbers",
- "inoldturkic",
- "sharada",
- "hanunoo",
- "incyrillicextendeda",
+ "indeseret",
+ "inolchiki",
+ "hira",
"joincontrol",
- "xidcontinue",
- "deseret",
- "radical",
- "canadianaboriginal",
- "omath",
- "inmongolian",
- "casedletter",
- "extender",
- "control",
- "ingrantha",
- "yi",
- "otheridcontinue",
-#ifdef USE_UNICODE_AGE_PROPERTIES
+ "idcontinue",
+ "inmahjongtiles",
+ "patws",
+ "inlydian",
+ "cher",
+ "inhiragana",
+ "inogham",
+ "avst",
+ "inscriptionalpahlavi",
+ "incoptic",
+ "java",
+ "inmathematicalalphanumericsymbols",
+ "letter",
+ "injavanese",
+ "avestan",
"age=1.1",
+ "lepc",
"age=2.1",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "yiii",
- "inethiopicextendeda",
-#ifdef USE_UNICODE_AGE_PROPERTIES
+ "inlepcha",
+ "javanese",
+ "shaw",
+ "finalpunctuation",
+ "alpha",
+ "age=5.1",
+ "inmongolian",
+ "age=5.2",
+ "age=2.0",
+ "ahex",
+ "ingeneralpunctuation",
+ "oids",
+ "odi",
+ "age=5.0",
+ "tavt",
+ "intaiviet",
"age=6.1",
- "age=6.2",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "perm",
-#endif /* USE_UNICODE_PROPERTIES */
- "lower",
-#ifndef USE_UNICODE_PROPERTIES
- "graph",
-#else /* USE_UNICODE_PROPERTIES */
-#ifdef USE_UNICODE_AGE_PROPERTIES
"age=3.1",
+ "insundanesesupplement",
"age=3.2",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "noncharactercodepoint",
-#ifdef USE_UNICODE_AGE_PROPERTIES
"age=4.1",
- "age=2.0",
- "age=6.3",
- "age=8.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "ingeneralpunctuation",
-#ifdef USE_UNICODE_AGE_PROPERTIES
+ "oidc",
+ "tfng",
+ "insmallformvariants",
+ "ideo",
+ "intags",
"age=6.0",
- "age=5.1",
- "age=5.2",
- "age=7.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "nd",
-#ifdef USE_UNICODE_AGE_PROPERTIES
"age=3.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "otheralphabetic",
-#ifdef USE_UNICODE_AGE_PROPERTIES
+ "whitespace",
"age=4.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "imperialaramaic",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=5.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "pf",
- "letternumber",
- "inimperialaramaic",
+ "inolditalic",
+ "oalpha",
+ "ingujarati",
+ "control",
+ "diacritic",
+ "tagbanwa",
"inphoenician",
- "finalpunctuation",
- "sd",
- "olditalic",
- "sidd",
- "inenclosedideographicsupplement",
- "prti",
- "sgnw",
+ "ininscriptionalparthian",
+ "ininscriptionalpahlavi",
"coptic",
- "insiddham",
- "inoldnortharabian",
+ "dsrt",
+ "inmodifiertoneletters",
+ "xids",
+ "hanunoo",
+ "inoldturkic",
+ "xidc",
+ "idstart",
+ "inimperialaramaic",
+ "invariationselectors",
+ "copt",
+ "caseignorable",
+ "prti",
+ "nchar",
+ "deseret",
+ "decimalnumber",
"cprt",
"inlatin1supplement",
- "tagbanwa",
- "cased",
- "ininscriptionalparthian",
- "ininscriptionalpahlavi",
- "inherited",
+ "imperialaramaic",
"privateuse",
- "copt",
- "inoldsoutharabian",
- "lowercaseletter",
- "word",
- "intags",
- "shrd",
- "idsbinaryoperator",
- "xpeo",
- "othersymbol",
- "otherlowercase",
- "otheridstart",
- "mlym",
- "inoldhungarian",
- "lyci",
+ "casedletter",
+ "lowercase",
+ "spaceseparator",
+ "radical",
+ "mong",
+ "canadianaboriginal",
+ "letternumber",
+ "insorasompeng",
+ "dash",
+ "wspace",
+ "ogam",
+ "invariationselectorssupplement",
"print",
- "phnx",
- "innabataean",
- "lycian",
- "ingujarati",
- "bamum",
- "malayalam",
- "variationselector",
+ "otheridcontinue",
+ "ingurmukhi",
+ "closepunctuation",
+ "olditalic",
+ "noncharactercodepoint",
+ "sharada",
+ "ingeometricshapes",
+ "otheralphabetic",
"patternwhitespace",
- "inelbasan",
- "spaceseparator",
- "inarabic",
+ "po",
+ "rjng",
+ "ingreekandcoptic",
+ "xdigit",
+ "gothic",
+ "inoldsoutharabian",
+ "xidstart",
+ "inrejang",
+ "idsbinaryoperator",
+ "olower",
+ "hex",
+ "inenclosedideographicsupplement",
"inalphabeticpresentationforms",
"inbasiclatin",
+ "othersymbol",
+ "nd",
+ "sd",
+ "omath",
+ "separator",
+ "inarabic",
+ "xidcontinue",
+ "otheridstart",
+ "grext",
+ "otherlowercase",
"phli",
- "indevanagariextended",
- "innumberforms",
- "caseignorable",
- "tfng",
- "other",
+ "cased",
+ "hang",
+ "xpeo",
+#endif /* USE_UNICODE_PROPERTIES */
+ "lower",
+#ifndef USE_UNICODE_PROPERTIES
+ "graph",
+#else /* USE_UNICODE_PROPERTIES */
+ "modifierletter",
"inphoneticextensions",
- "othernumber",
- "closepunctuation",
+ "inarabicpresentationformsa",
+ "innumberforms",
"oldpersian",
- "gran",
- "bass",
- "patternsyntax",
- "inmathematicaloperators",
- "inpsalterpahlavi",
- "ingurmukhi",
- "nbat",
- "oldpermic",
- "lepcha",
+ "incyrillicextendeda",
+ "inverticalforms",
+ "p",
"inbyzantinemusicalsymbols",
- "olower",
- "inarabicpresentationformsa",
- "mong",
- "nabataean",
- "mymr",
+ "inmathematicaloperators",
"intibetan",
- "inyijinghexagramsymbols",
- "ogam",
- "inmiscellaneousmathematicalsymbolsb",
- "inlatinextendedd",
- "sylotinagri",
- "inphoneticextensionssupplement",
- "insorasompeng",
- "insuttonsignwriting",
+ "zp",
+ "ingeorgian",
+ "inbraillepatterns",
+ "lepcha",
+ "geor",
+ "invedicextensions",
"linb",
- "mathsymbol",
- "myanmar",
- "inmyanmarextendedb",
- "limb",
+ "other",
+ "deva",
+ "indevanagari",
+ "othernumber",
+ "bamum",
+ "shrd",
"bali",
- "hmng",
- "inbraillepatterns",
- "othermath",
- "po",
- "hang",
- "syrc",
- "inoriya",
- "warangciti",
- "separator",
- "elba",
- "inbalinese",
+ "devanagari",
+ "extender",
+ "inherited",
+ "glagolitic",
"tibt",
- "modifierletter",
+ "inbalinese",
+ "ingothic",
+ "inmiscellaneousmathematicalsymbolsb",
+ "limb",
"bengali",
- "inlinearbsyllabary",
+ "phoenician",
+ "insuperscriptsandsubscripts",
+ "inmeroitichieroglyphs",
"tibetan",
- "syriac",
- "incaucasianalbanian",
- "osmanya",
+ "inphoneticextensionssupplement",
"balinese",
- "inyiradicals",
+ "lowercaseletter",
+ "indingbats",
+ "inprivateusearea",
+ "assigned",
+ "patternsyntax",
+ "inhangulsyllables",
+ "sarb",
+ "brai",
+ "insupplementalmathematicaloperators",
+ "phnx",
+ "ingreekextended",
+ "otherletter",
+ "arab",
+ "inlatinextendedd",
+ "word",
+ "inphagspa",
+ "inblockelements",
+ "ethiopic",
+ "inethiopicextendeda",
+ "brahmi",
+ "logicalorderexception",
+ "inoldpersian",
+ "inletterlikesymbols",
+ "sorasompeng",
+ "hiragana",
+ "inhanguljamoextendeda",
+ "othermath",
+#endif /* USE_UNICODE_PROPERTIES */
+ "digit",
+#ifndef USE_UNICODE_PROPERTIES
+ "blank"
+#else /* USE_UNICODE_PROPERTIES */
+ "goth",
+ "ogham",
"sundanese",
- "ingreekandcoptic",
+ "saurashtra",
+ "linearb",
+ "graphemebase",
+ "inunifiedcanadianaboriginalsyllabics",
+ "cuneiform",
"inkannada",
"kana",
- "phoenician",
+ "inancientgreeknumbers",
+ "incjkstrokes",
+ "inglagolitic",
"inancientgreekmusicalnotation",
- "elbasan",
- "otherletter",
- "cakm",
- "ingeometricshapes",
- "gothic",
"inchakma",
- "inancientgreeknumbers",
- "saurashtra",
- "induployan",
- "rjng",
- "mendekikakui",
- "ingothic",
- "narb",
- "cyrl",
- "brai",
- "grext",
- "arab",
- "meeteimayek",
- "inrejang",
- "brahmi",
- "inkaithi",
- "multani",
+ "plrd",
+ "inbrahmi",
+ "cakm",
"incjkcompatibilityforms",
- "takri",
- "incjkcompatibilityideographs",
- "sarb",
- "p",
"lisu",
+ "incjkcompatibilityideographs",
+ "intagalog",
+ "inkaithi",
+ "insupplementalarrowsa",
+ "takri",
+ "ideographic",
+ "hexdigit",
+ "glag",
+ "softdotted",
+ "variationselector",
"inkatakana",
- "zp",
- "inornamentaldingbats",
- "sylo",
- "cuneiform",
- "incjkstrokes",
- "ethiopic",
- "inmeeteimayek",
+ "meeteimayek",
+ "otherpunctuation",
+ "inhanguljamo",
"kali",
- "inbrahmi",
- "incjkcompatibilityideographssupplement",
- "mult",
- "inethiopicextended",
+ "braille",
+ "incombininghalfmarks",
"talu",
- "inhangulsyllables",
- "ingeorgian",
- "hexdigit",
- "xsux",
- "inunifiedcanadianaboriginalsyllabics",
+ "incjkcompatibilityideographssupplement",
"telu",
- "indingbats",
- "inblockelements",
- "geor",
- "ingreekextended",
- "inletterlikesymbols",
- "inoldpersian",
- "orya",
- "linearb",
- "inbassavah",
- "inoldpermic",
+ "idsb",
+ "tglg",
+ "inmeeteimayek",
+ "yi",
+ "phagspa",
+ "yiii",
+ "inarabicmathematicalalphabeticsymbols",
+ "saur",
+ "ogrext",
+ "bidic",
"inkanasupplement",
- "incombininghalfmarks",
"runic",
+ "inalchemicalsymbols",
+ "georgian",
"inugaritic",
- "assigned",
- "glagolitic",
- "cyrillic",
- "inmeroitichieroglyphs",
- "saur",
- "hiragana",
- "insuperscriptsandsubscripts",
- "ogham",
"insaurashtra",
- "mark",
- "symbol",
- "inkharoshthi",
- "inkhmer",
- "plrd",
- "graphemebase",
- "inhanguljamoextendeda",
+ "inhighprivateusesurrogates",
+ "pd",
"incountingrodnumerals",
- "lydi",
-#endif /* USE_UNICODE_PROPERTIES */
- "digit",
-#ifndef USE_UNICODE_PROPERTIES
- "blank"
-#else /* USE_UNICODE_PROPERTIES */
- "bassavah",
- "inarabicmathematicalalphabeticsymbols",
- "grantha",
- "lydian",
- "insupplementalmathematicaloperators",
- "goth",
- "hebrew",
- "meroitichieroglyphs",
- "incyrillicsupplement",
- "intakri",
- "takr",
- "kaithi",
- "idsb",
- "bidic",
- "incherokeesupplement",
- "inalchemicalsymbols",
- "inkhmersymbols",
- "otherpunctuation",
- "braille",
- "logicalorderexception",
- "incurrencysymbols",
- "tirhuta",
- "inphagspa",
"inarabicextendeda",
+ "inkharoshthi",
+ "idstrinaryoperator",
+ "phag",
"brah",
+ "mark",
"hebr",
- "pd",
- "kthi",
- "inethiopicsupplement",
- "runr",
- "olck",
- "ideographic",
- "ogrext",
- "olchiki",
- "inhighprivateusesurrogates",
- "softdotted",
- "inhebrew",
- "number",
- "hluw",
- "inkhojki",
- "sund",
+ "inkhmersymbols",
+ "dep",
+ "inkhmer",
"deprecated",
- "patsyn",
- "unassigned",
- "phagspa",
- "ingeometricshapesextended",
- "knda",
- "insupplementalarrowsa",
- "inmendekikakui",
- "insupplementalarrowsc",
- "sorasompeng",
- "inhanguljamo",
- "kannada",
+ "rejang",
+ "lyci",
+ "intakri",
+ "takr",
+ "incyrillicsupplement",
+ "changeswhencasefolded",
+ "indevanagariextended",
+ "lycian",
+ "inbengali",
+ "beng",
"graph",
- "idstrinaryoperator",
- "hangul",
- "inhanunoo",
+ "inyijinghexagramsymbols",
+ "olck",
+ "inarabicsupplement",
+ "inbuginese",
"changeswhencasemapped",
+ "olchiki",
+ "inaegeannumbers",
+ "mlym",
+ "alphabetic",
+ "sylotinagri",
+ "changeswhentitlecased",
+ "tagalog",
+ "tagb",
+ "runr",
+ "malayalam",
+ "inoriya",
+ "intagbanwa",
+ "syrc",
"nko",
"nkoo",
- "combiningmark",
- "inkatakanaphoneticextensions",
- "khmr",
- "phlp",
- "khar",
+ "inethiopicextended",
+ "kaithi",
+ "mathsymbol",
+ "inyiradicals",
+ "insupplementaryprivateuseareaa",
+ "osmanya",
+ "syriac",
"otherdefaultignorablecodepoint",
+ "number",
+ "inlinearbsyllabary",
+ "kthi",
+ "sund",
+ "mymr",
+ "incombiningdiacriticalmarks",
"enclosingmark",
+ "incombiningdiacriticalmarksforsymbols",
+ "inethiopicsupplement",
+ "unassigned",
+ "sylo",
+ "combiningmark",
+ "myanmar",
+ "graphemeextend",
+ "bidicontrol",
"inhalfwidthandfullwidthforms",
- "inmeroiticcursive",
- "inglagolitic",
- "changeswhentitlecased",
- "dep",
- "inbuhid",
- "incombiningdiacriticalmarks",
+ "cyrl",
+ "knda",
"inunifiedcanadianaboriginalsyllabicsextended",
- "any",
- "incombiningdiacriticalmarksforsymbols",
- "kharoshthi",
- "cherokee",
- "inarabicsupplement",
- "pauc",
- "phag",
- "intagalog",
- "inplayingcards",
- "inpahawhhmong",
- "changeswhencasefolded",
- "incyrillicextendedb",
+ "xsux",
+ "modifiersymbol",
"incombiningdiacriticalmarkssupplement",
- "alphabetic",
- "glag",
- "hyphen",
- "inyisyllables",
- "bidicontrol",
- "inbengali",
+ "inhanunoo",
+ "inbuhid",
+ "kannada",
+ "inhebrew",
+ "grbase",
"spacingmark",
- "cypriot",
- "beng",
- "graphemeextend",
- "khoj",
- "inbuginese",
- "tglg",
- "palmyrene",
- "incypriotsyllabary",
- "punct",
- "khmer",
+ "inkatakanaphoneticextensions",
+ "hangul",
"incjksymbolsandpunctuation",
- "inaegeannumbers",
- "tagb",
- "orkh",
- "intagbanwa",
- "oldhungarian",
- "georgian",
- "modifiersymbol",
+ "bopo",
+ "orya",
+ "inbopomofo",
+ "kharoshthi",
+ "khar",
"changeswhenlowercased",
- "otheruppercase",
- "signwriting",
- "insupplementaryprivateuseareaa",
- "inkayahli",
- "ugaritic",
- "uideo",
+ "khmr",
+ "punct",
+ "symbol",
+ "cherokee",
+ "cyrillic",
+ "inkangxiradicals",
+ "hebrew",
"inarabicpresentationformsb",
+ "incyrillicextendedb",
+ "ugaritic",
+ "incurrencysymbols",
+ "meroitichieroglyphs",
+ "inhighsurrogates",
"nonspacingmark",
- "rejang",
- "inkangxiradicals",
- "incjkcompatibility",
- "bamu",
- "inbamum",
- "pahawhhmong",
- "grbase",
- "aghb",
- "bopo",
- "tagalog",
- "inbopomofo",
- "incombiningdiacriticalmarksextended",
- "inkanbun",
- "oldturkic",
- "defaultignorablecodepoint",
+ "lydi",
+ "patsyn",
+ "orkh",
+ "lydian",
"ugar",
- "caucasianalbanian",
- "inlatinextendedb",
"othergraphemeextend",
- "hung",
- "inlimbu",
+ "inlatinextendedb",
+ "bopomofo",
+ "khmer",
+ "uideo",
+ "otheruppercase",
"grek",
+ "gujr",
+ "gujarati",
+ "inhanguljamoextendedb",
+ "defaultignorablecodepoint",
+ "inplayingcards",
+ "bamu",
+ "inkanbun",
+ "incjkradicalssupplement",
+ "cypriot",
+ "inbamum",
+ "inmeroiticcursive",
+ "oldturkic",
+ "insupplementalarrowsb",
+ "surrogate",
"batk",
"inbatak",
- "incjkradicalssupplement",
- "innoblock",
- "cwu",
- "oldnortharabian",
- "insupplementalsymbolsandpictographs",
- "dupl",
+ "inlimbu",
+ "incypriotsyllabary",
"dashpunctuation",
+ "innoblock",
+ "hyphen",
+ "insupplementalpunctuation",
+ "ingeorgiansupplement",
+ "oupper",
+ "paragraphseparator",
"inbamumsupplement",
- "gujr",
- "inhighsurrogates",
+ "uppercase",
+ "currencysymbol",
+ "sk",
"lu",
+ "openpunctuation",
+ "inlisu",
"qmark",
- "gujarati",
- "limbu",
- "sk",
"egyp",
- "inlisu",
- "bopomofo",
- "inhanguljamoextendedb",
+ "insupplementaryprivateuseareab",
+ "limbu",
"inegyptianhieroglyphs",
+ "unifiedideograph",
"intelugu",
"katakana",
- "kayahli",
- "oupper",
- "surrogate",
- "currencysymbol",
- "insupplementalpunctuation",
- "ingeorgiansupplement",
- "unifiedideograph",
- "unknown",
- "zyyy",
- "insupplementalarrowsb",
- "uppercase",
- "khudawadi",
- "inkhudawadi",
- "openpunctuation",
+ "inhangulcompatibilityjamo",
"upper",
- "buhd",
- "quotationmark",
- "paucinhau",
- "paragraphseparator",
- "khojki",
- "inpaucinhau",
- "inbopomofoextended",
+ "inkayahli",
+ "cwu",
+ "incjkcompatibility",
"uppercaseletter",
- "punctuation",
- "egyptianhieroglyphs",
"bugi",
- "changeswhenuppercased",
"buginese",
+ "any",
+ "inyisyllables",
+ "inbopomofoextended",
+ "inboxdrawing",
+ "changeswhenuppercased",
+ "unknown",
+ "quotationmark",
+ "buhd",
+ "punctuation",
+ "oldsoutharabian",
+ "kayahli",
+ "incjkunifiedideographs",
"incjkunifiedideographsextensiona",
"incjkunifiedideographsextensionc",
- "inhangulcompatibilityjamo",
- "incjkunifiedideographsextensione",
- "insupplementaryprivateuseareab",
- "incjkunifiedideographs",
- "oldsoutharabian",
- "inboxdrawing",
- "guru",
"telugu",
- "buhid",
- "duployan",
+ "guru",
"greek",
+ "grlink",
+ "buhid",
"batak",
"blank",
"incjkunifiedideographsextensiond",
- "grlink",
"graphemelink",
+ "egyptianhieroglyphs",
"incjkunifiedideographsextensionb",
+ "zyyy",
"gurmukhi"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
#ifdef __GNUC__
__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
+#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
@@ -32392,1389 +27366,1169 @@ uniname2ctype_p (str, len)
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 34},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 33},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 30},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 51},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 46},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 51},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 54},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 20},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 185},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 447},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str36, 237},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37, 114},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str41, 17},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 31},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str53, 128},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str56, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 208},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str58, 390},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str59, 32},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 20},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str61, 265},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 18},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str65, 168},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 22},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 473},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str77, 272},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str78, 101},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 60},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 17},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 19},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 47},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 101},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 114},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str81, 46},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 47},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 33},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 14},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 14},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 128},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 54},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 401},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93, 448},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str102, 22},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 259},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str110, 474},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 381},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 377},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124, 285},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str129, 65},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str132, 159},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str140, 414},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str141, 43},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str142, 375},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 226},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str144, 270},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str145, 419},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str148, 143},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str149, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 31},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66, 239},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str152, 340},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 30},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str155, 129},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str159, 487},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str163, 26},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str164, 120},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str169, 183},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str174, 391},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 49},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str176, 233},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 32},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 232},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str178, 151},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 412},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 13},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str185, 421},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 168},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str189, 24},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str190, 283},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 382},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str192, 430},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 413},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 252},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99, 419},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100, 304},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 355},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 312},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str113, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 430},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 237},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124, 120},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str125, 159},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str199, 338},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str200, 434},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201, 503},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str132, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str133, 151},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str134, 384},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str135, 432},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str136, 298},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str142, 92},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str151, 347},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str206, 234},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str156, 306},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str208, 346},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209, 309},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str212, 306},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str213, 500},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 332},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str158, 204},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str167, 356},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str225, 92},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str172, 26},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str237, 152},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 152},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179, 379},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 276},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str184, 75},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 111},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str189, 13},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str199, 250},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str257, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201, 272},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 120},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 23},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str259, 75},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str260, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str207, 36},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str262, 280},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 88},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str264, 463},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str273, 153},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str274, 416},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str275, 153},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209, 52},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str216, 247},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str217, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str218, 224},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 314},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 263},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str224, 385},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str225, 235},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 148},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str230, 358},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str231, 124},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str232, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str233, 172},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str234, 410},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str239, 230},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str240, 148},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279, 489},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str280, 305},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str281, 120},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str244, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str245, 155},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247, 160},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str248, 323},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str285, 63},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 392},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str253, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str254, 255},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 155},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str256, 80},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str288, 64},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str290, 78},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str291, 257},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str259, 260},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str293, 160},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 39},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str295, 23},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 170},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str264, 297},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268, 300},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str297, 36},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279, 431},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str299, 78},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str300, 288},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str281, 178},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str288, 3},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str301, 333},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str302, 296},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 422},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 52},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str305, 348},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str306, 148},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 405},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308, 25},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str313, 182},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str309, 393},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str315, 395},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str316, 287},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str319, 148},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str320, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str321, 201},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str329, 129},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str330, 65},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str339, 428},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346, 92},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str347, 114},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str321, 170},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str322, 218},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 170},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 109},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str357, 109},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358, 299},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str360, 50},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str364, 273},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str365, 251},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str324, 263},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str325, 152},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str326, 392},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str329, 155},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str330, 172},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str333, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 238},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str338, 402},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str339, 155},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str340, 470},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str341, 80},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str342, 268},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 21},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str345, 460},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 123},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str348, 158},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 431},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str350, 293},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str354, 19},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str360, 331},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str361, 454},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str362, 114},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str363, 109},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str378, 182},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386, 421},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str387, 258},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 174},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 295},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str400, 150},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str366, 124},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 109},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str371, 388},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str403, 365},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str373, 198},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str381, 471},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str405, 87},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str406, 189},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str384, 459},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 150},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str390, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str409, 63},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str393, 211},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str394, 92},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str395, 61},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str397, 185},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str401, 411},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 74},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str403, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 416},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420, 93},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str408, 334},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str409, 291},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str425, 317},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str426, 99},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str428, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str429, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430, 162},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str411, 88},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str413, 284},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432, 131},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str417, 169},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str423, 123},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str434, 321},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436, 28},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str443, 25},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str450, 183},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str454, 357},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445, 82},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str458, 93},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str449, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str450, 55},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str461, 55},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str454, 66},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str467, 82},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str469, 498},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str470, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str471, 201},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str473, 170},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str460, 27},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str468, 253},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str475, 501},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 123},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str481, 151},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str470, 151},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str475, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str476, 188},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str483, 82},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str478, 67},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str494, 461},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 45},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str481, 278},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str497, 214},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str484, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485, 61},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str502, 230},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str518, 407},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str519, 211},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str527, 205},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str531, 214},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str533, 475},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str490, 42},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str538, 333},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 207},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str546, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str495, 168},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str496, 346},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str497, 205},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str552, 367},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str561, 168},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str562, 468},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 184},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str569, 217},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str573, 186},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str578, 273},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str503, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str504, 39},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str580, 514},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506, 240},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str583, 67},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str584, 184},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str585, 196},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str593, 213},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str602, 87},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str603, 171},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str605, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str509, 341},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str607, 37},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 162},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str615, 271},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str511, 52},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str618, 312},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str621, 479},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str622, 351},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 66},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str624, 174},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str626, 21},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str514, 41},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str515, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str517, 195},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str629, 131},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str630, 496},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str631, 106},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str520, 426},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521, 391},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str522, 227},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str633, 329},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str635, 482},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str524, 19},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str639, 74},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 50},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str651, 359},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str659, 100},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str665, 116},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str671, 199},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str528, 383},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str674, 69},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str676, 224},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str531, 116},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str532, 9},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 390},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 295},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str685, 315},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 281},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str688, 67},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str689, 491},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str548, 106},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str694, 68},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str553, 178},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str696, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str555, 67},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str558, 425},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str698, 275},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str560, 206},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 441},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str702, 83},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 260},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 396},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str564, 100},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str568, 325},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str572, 262},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str574, 153},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str575, 163},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str707, 429},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str708, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str579, 315},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 158},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str710, 197},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589, 423},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 23},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str604, 354},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 153},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str612, 209},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str613, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 211},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str616, 280},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str618, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str619, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str621, 218},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str622, 269},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 219},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 83},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str626, 210},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 185},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str716, 439},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str630, 289},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str631, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632, 198},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str633, 217},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str719, 201},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str728, 317},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str729, 466},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str752, 495},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str753, 27},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str761, 286},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str767, 94},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str768, 94},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str769, 105},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str770, 43},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str776, 380},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str637, 357},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str638, 221},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str639, 213},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 282},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str641, 214},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str642, 216},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643, 203},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 52},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 131},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647, 374},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str648, 187},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str649, 438},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str650, 220},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str651, 212},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str653, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str654, 215},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str655, 386},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str802, 39},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str812, 41},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660, 186},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str820, 420},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str825, 23},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 477},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str668, 245},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 18},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str839, 215},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 188},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str842, 45},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str843, 408},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str844, 11},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str846, 57},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str849, 227},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str851, 217},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str853, 187},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str855, 68},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str856, 485},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str682, 118},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str690, 395},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str866, 232},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str868, 9},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str871, 216},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str878, 424},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str879, 188},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str880, 188},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 402},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str882, 316},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 403},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str704, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706, 344},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str709, 68},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str886, 231},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 116},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str715, 404},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str901, 221},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str721, 69},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str725, 66},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str729, 394},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str730, 370},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734, 128},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str904, 35},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str905, 349},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str737, 60},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str738, 162},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739, 192},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str746, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str747, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str748, 125},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str750, 223},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str931, 191},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str771, 160},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str936, 19},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str937, 113},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 208},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str776, 21},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str778, 57},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str940, 378},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str950, 235},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str951, 1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str952, 195},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str953, 314},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str954, 205},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str955, 437},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 141},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str957, 66},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 403},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str961, 194},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str780, 54},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str784, 196},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str964, 423},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str966, 452},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str967, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str787, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str788, 101},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str971, 116},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str972, 353},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str980, 207},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str989, 69},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str990, 113},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1001, 225},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792, 36},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1005, 101},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1017, 212},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str796, 408},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str798, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str799, 102},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1029, 302},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1032, 24},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1037, 218},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1044, 18},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1045, 465},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1050, 110},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1052, 232},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1053, 238},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1054, 240},
- {-1},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1056, 110},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1057, 394},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str802, 439},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str803, 7},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str811, 203},
{-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1058, 250},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1059, 251},
- {-1},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1061, 193},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1062, 6},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str815, 244},
{-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1063, 242},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1064, 243},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1065, 221},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 41},
{-1}, {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1066, 245},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1067, 239},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1068, 252},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 254},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 323},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1}, {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1071, 249},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 247},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1073, 248},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1074, 253},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1075, 35},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1076, 241},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1077, 215},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1}, {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str823, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str824, 192},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1079, 244},
- {-1}, {-1},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1082, 160},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#endif /* ! USE_UNICODE_AGE_PROPERTIES */
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str826, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str827, 303},
{-1}, {-1},
-#ifdef USE_UNICODE_AGE_PROPERTIES
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1085, 246},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str830, 186},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831, 206},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str833, 146},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str835, 229},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str841, 11},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1094, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str850, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str851, 400},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str852, 68},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1096, 36},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1100, 436},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str854, 352},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1106, 440},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1109, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str860, 194},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str867, 190},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str870, 429},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str874, 368},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1114, 229},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str879, 222},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1119, 111},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1120, 195},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1121, 499},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1125, 162},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1127, 204},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str884, 50},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1132, 128},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1133, 467},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1140, 446},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1141, 125},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1143, 256},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1144, 118},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str889, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str890, 200},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str900, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str901, 51},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1150, 59},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str907, 234},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1155, 449},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str912, 69},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str913, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str914, 71},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str917, 190},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1157, 450},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1164, 114},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1169, 21},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1178, 128},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1179, 445},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1184, 25},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1185, 12},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str919, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str920, 59},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str923, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str931, 133},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1187, 513},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str933, 6},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str936, 26},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 284},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str939, 369},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1194, 223},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1201, 133},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1202, 50},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1203, 219},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1204, 231},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1205, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str943, 294},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1207, 453},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1215, 147},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1218, 7},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str945, 133},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str946, 319},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str947, 371},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1220, 137},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str949, 38},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str950, 418},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str951, 296},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str952, 254},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str953, 53},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1223, 438},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1228, 147},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1230, 278},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1231, 157},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1236, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 256},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 308},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1238, 234},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str962, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str963, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str964, 283},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str965, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str966, 17},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1242, 235},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1245, 432},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str970, 83},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str972, 242},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str973, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str974, 157},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str977, 135},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1249, 54},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str981, 83},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1251, 267},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1252, 405},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1255, 255},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str983, 189},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1260, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str988, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str989, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str990, 95},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str994, 277},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str996, 387},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str997, 310},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str998, 119},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1000, 84},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1263, 384},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1003, 137},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1004, 290},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1265, 328},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1266, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1267, 131},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1274, 17},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1278, 318},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1006, 397},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1007, 95},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1281, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1010, 285},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1016, 135},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1021, 25},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1031, 305},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1035, 366},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1285, 41},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1286, 133},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1287, 180},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1039, 16},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1044, 207},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1051, 361},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1065, 161},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1289, 177},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1067, 126},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1291, 236},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1292, 330},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 311},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 137},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1294, 451},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1295, 277},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1302, 190},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 288},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1304, 193},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1309, 141},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1310, 486},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1074, 27},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1312, 219},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1076, 80},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1078, 345},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1315, 406},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1081, 12},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 348},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 190},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1323, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1324, 287},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1326, 370},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1330, 102},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1331, 344},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1337, 379},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1338, 132},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1087, 302},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1092, 99},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1340, 319},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1341, 457},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1094, 359},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1345, 492},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1348, 121},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1349, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1107, 167},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1352, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1353, 389},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1354, 119},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1360, 135},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1361, 181},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1364, 342},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1365, 212},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1366, 44},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1367, 98},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1369, 81},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1371, 279},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1110, 201},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1375, 198},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1377, 51},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1114, 389},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1129, 293},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1381, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1133, 174},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1383, 311},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1384, 95},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1386, 26},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 84},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1135, 106},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1396, 415},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1142, 353},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1401, 95},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1147, 183},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1404, 81},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1406, 433},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1410, 124},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1411, 135},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1415, 373},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1416, 140},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1417, 262},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1150, 4},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1151, 112},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1156, 102},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1162, 140},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1170, 144},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1420, 282},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1173, 121},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1179, 72},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1185, 261},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1186, 136},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1422, 107},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1423, 137},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1424, 488},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1425, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1188, 249},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1427, 27},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1435, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 107},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1440, 337},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1448, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1195, 381},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1196, 331},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1450, 458},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1455, 418},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1456, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1198, 313},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1202, 420},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1212, 409},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1459, 484},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1468, 146},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1469, 186},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1474, 425},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1475, 189},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1476, 77},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1478, 126},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1215, 172},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1219, 406},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1483, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1224, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1225, 373},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1487, 80},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1488, 159},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1489, 386},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1491, 167},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1229, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1230, 367},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1231, 264},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1504, 456},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1506, 202},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1507, 410},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1509, 175},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1244, 407},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1245, 307},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1249, 175},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1253, 187},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1512, 404},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1514, 161},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1521, 38},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1522, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1256, 184},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1259, 130},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1524, 360},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1530, 53},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1261, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1262, 205},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1532, 502},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1533, 132},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1534, 136},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1264, 326},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1265, 159},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1274, 44},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1548, 365},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1552, 99},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1558, 397},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1559, 145},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1567, 455},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1574, 512},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1279, 257},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1577, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1282, 145},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1289, 126},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1298, 372},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1300, 129},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1579, 352},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1302, 437},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1583, 129},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1584, 398},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1306, 89},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1307, 194},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1587, 289},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1588, 213},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1310, 115},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1591, 136},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1592, 294},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1313, 360},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1315, 110},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1595, 89},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1596, 339},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 138},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1599, 336},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1600, 97},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 110},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1611, 322},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1612, 327},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1323, 424},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1617, 428},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1624, 87},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1629, 121},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1632, 480},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1634, 426},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1635, 483},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 409},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1638, 103},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1328, 144},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1640, 427},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1642, 16},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1643, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1330, 193},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1647, 77},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1648, 442},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1649, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1334, 177},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1341, 417},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1343, 103},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1344, 433},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1350, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1351, 388},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1652, 106},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1354, 349},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1356, 364},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1658, 324},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1362, 40},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 102},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1675, 383},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1680, 30},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1689, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1372, 422},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1694, 444},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1700, 301},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1377, 241},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1712, 172},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 399},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 195},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1396, 138},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1714, 72},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1398, 167},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1402, 30},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1716, 387},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1404, 79},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1723, 490},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1731, 149},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1733, 4},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1735, 177},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1737, 494},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1411, 274},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1739, 180},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1744, 149},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1745, 345},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1747, 112},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1749, 79},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1757, 171},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1758, 264},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1413, 199},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1416, 268},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1764, 469},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1765, 175},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1422, 199},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1767, 165},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1776, 223},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1777, 206},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1779, 396},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1424, 146},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1429, 147},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1781, 504},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1431, 411},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1432, 175},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1784, 307},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1435, 231},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1436, 64},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1795, 44},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1796, 126},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1798, 230},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1799, 325},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1800, 197},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1438, 350},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1804, 382},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1814, 274},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1442, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1443, 243},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1819, 167},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 79},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1448, 84},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1450, 5},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1452, 336},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1457, 142},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1834, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1460, 236},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1836, 165},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1843, 292},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1462, 275},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1463, 65},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1468, 142},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1478, 380},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1479, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1480, 56},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1862, 103},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1864, 142},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1865, 216},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1492, 132},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1498, 63},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1871, 222},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1504, 115},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1505, 118},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1506, 103},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1875, 142},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1882, 401},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1892, 229},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1893, 266},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1510, 91},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1512, 246},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1516, 267},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1517, 81},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1519, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1520, 139},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1896, 34},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1523, 318},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1525, 165},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1901, 200},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 462},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1908, 140},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1530, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1531, 339},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1536, 440},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1912, 228},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1913, 236},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1931, 20},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1938, 138},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1540, 124},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1944, 505},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1945, 90},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1546, 81},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1548, 198},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1561, 34},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1565, 378},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1566, 165},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1567, 140},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1956, 341},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1569, 96},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1958, 493},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1963, 506},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1964, 174},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1571, 228},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1971, 290},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1578, 32},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1974, 90},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1581, 292},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1583, 259},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1590, 20},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1591, 132},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1595, 30},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1977, 5},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1598, 96},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1984, 224},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1986, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1605, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 177},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1989, 298},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1991, 65},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1609, 376},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1999, 139},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2000, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1617, 77},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2003, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1620, 90},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1634, 270},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1635, 136},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 48},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1643, 286},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1645, 265},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2006, 366},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2012, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1648, 266},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1649, 90},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1658, 233},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2016, 194},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1662, 72},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2018, 134},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2056, 227},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2057, 32},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2071, 413},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2072, 443},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1664, 31},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2078, 347},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2081, 63},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2084, 228},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 332},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1676, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1683, 324},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2089, 299},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2092, 261},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1688, 108},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2096, 303},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2097, 15},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2102, 326},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2105, 134},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1692, 87},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1699, 327},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2116, 100},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1701, 134},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2118, 269},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1703, 134},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2124, 192},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2126, 138},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2127, 297},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1709, 61},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2137, 497},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1724, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1725, 8},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2141, 481},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2150, 64},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2151, 376},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1729, 46},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2154, 320},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2155, 56},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1732, 100},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1737, 77},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2172, 130},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2178, 209},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1759, 322},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1761, 79},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1780, 375},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2203, 372},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2212, 206},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1787, 342},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2215, 276},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2220, 31},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2225, 125},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2226, 84},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2227, 71},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2236, 182},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2240, 308},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1790, 122},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2251, 115},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2259, 191},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2268, 435},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2277, 8},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2278, 104},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2283, 358},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2294, 417},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2305, 118},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2307, 164},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2316, 300},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1829, 291},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2327, 203},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 171},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1835, 363},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1853, 33},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1858, 149},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1864, 207},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1868, 164},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2348, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1871, 149},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2368, 48},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2376, 61},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2383, 220},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1896, 122},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1899, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1900, 225},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 108},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1917, 104},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1925, 197},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1932, 191},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1944, 76},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2406, 204},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1949, 86},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1970, 86},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1983, 362},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1988, 70},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2005, 427},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2460, 515},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2462, 385},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2468, 122},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2476, 226},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2022, 157},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2028, 329},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2033, 321},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2494, 412},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2495, 33},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2499, 146},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2501, 356},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2502, 368},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2046, 125},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2543, 157},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2051, 343},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2545, 377},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2053, 398},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2556, 181},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2557, 72},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2558, 176},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2560, 108},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2569, 115},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2571, 361},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2055, 164},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2086, 309},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2087, 22},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2596, 310},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2598, 363},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2094, 166},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2606, 164},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2608, 70},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2613, 122},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2636, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2102, 279},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2119, 271},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2649, 258},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2123, 393},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2129, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2130, 442},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2662, 222},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2141, 180},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2681, 203},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2685, 304},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2689, 76},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2692, 166},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2700, 313},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2162, 320},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2703, 355},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2165, 316},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2178, 191},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2189, 53},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2194, 415},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2745, 517},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2755, 62},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2760, 189},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2772, 507},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2774, 178},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2784, 40},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2788, 478},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2794, 86},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2799, 400},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2803, 29},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2810, 210},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2815, 86},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2817, 119},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2824, 48},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2833, 154},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2852, 374},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2873, 108},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2895, 399},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2899, 476},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2906, 281},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2921, 107},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2299, 58},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2313, 47},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2322, 48},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2947, 145},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2950, 220},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2338, 29},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2342, 45},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2349, 340},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2972, 22},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2371, 181},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2372, 154},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2377, 441},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2379, 119},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2991, 47},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2400, 414},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2401, 197},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3010, 354},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2413, 248},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2429, 107},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2442, 328},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3040, 350},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2454, 10},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3071, 226},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2495, 351},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3107, 237},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2515, 62},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2523, 334},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2542, 29},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3132, 74},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3135, 343},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2549, 127},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3166, 58},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3167, 196},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2588, 127},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2627, 15},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2651, 338},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2671, 330},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3274, 464},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3282, 45},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2710, 301},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2724, 62},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2727, 208},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2737, 181},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2753, 117},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2785, 38},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3382, 10},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3404, 117},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3406, 210},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3441, 192},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3442, 53},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3443, 182},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3450, 472},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3459, 364},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2888, 161},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3504, 29},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3519, 38},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3529, 154},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3531, 127},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2925, 145},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3556, 62},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2940, 337},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3582, 127},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2961, 335},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2962, 435},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2995, 89},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3000, 85},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3626, 369},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3633, 509},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3634, 362},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3638, 511},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3639, 516},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3643, 371},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -33785,6 +28539,8 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3104, 76},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -33794,63 +28550,58 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3189, 73},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3822, 161},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3197, 117},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3863, 335},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3254, 166},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3927, 85},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3928, 89},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3292, 2},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3941, 117},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3974, 178},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3391, 436},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4081, 76},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4084, 166},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3459, 73},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3480, 154},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4139, 2},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4149, 510},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4205, 73},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -33895,65 +28646,7 @@ uniname2ctype_p (str, len)
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 4},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 2}
#else /* USE_UNICODE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4446, 73},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4805, 508},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3802, 434},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -33967,6 +28660,8 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3922, 74},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -33994,8 +28689,8 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5326, 85}
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4167, 85}
#endif /* USE_UNICODE_PROPERTIES */
};
diff --git a/enc/unicode/name2ctype.h.blt b/enc/unicode/name2ctype.h.blt
index 80b79abc3e..2e80edf525 100644
--- a/enc/unicode/name2ctype.h.blt
+++ b/enc/unicode/name2ctype.h.blt
@@ -44,7 +44,7 @@ static const OnigCodePoint CR_NEWLINE[] = {
/* 'Alpha': [[:Alpha:]] */
static const OnigCodePoint CR_Alpha[] = {
- 600,
+ 540,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -61,14 +61,13 @@ static const OnigCodePoint CR_Alpha[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -96,13 +95,17 @@ static const OnigCodePoint CR_Alpha[] = {
0x0800, 0x0817,
0x081a, 0x082c,
0x0840, 0x0858,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x08e4, 0x08e9,
- 0x08f0, 0x093b,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
0x093d, 0x094c,
0x094e, 0x0950,
0x0955, 0x0963,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -173,18 +176,19 @@ static const OnigCodePoint CR_Alpha[] = {
0x0bca, 0x0bcc,
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
0x0c58, 0x0c59,
0x0c60, 0x0c63,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -197,7 +201,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x0cde, 0x0cde,
0x0ce0, 0x0ce3,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -279,7 +283,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1713,
0x1720, 0x1733,
@@ -294,7 +298,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x1938,
0x1950, 0x196d,
@@ -319,7 +323,6 @@ static const OnigCodePoint CR_Alpha[] = {
0x1cee, 0x1cf3,
0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
- 0x1de7, 0x1df4,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -399,14 +402,14 @@ static const OnigCodePoint CR_Alpha[] = {
0xa62a, 0xa62b,
0xa640, 0xa66e,
0xa674, 0xa67b,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa69f, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa827,
@@ -420,14 +423,11 @@ static const OnigCodePoint CR_Alpha[] = {
0xa980, 0xa9b2,
0xa9b4, 0xa9bf,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaabe,
+ 0xaa80, 0xaabe,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
@@ -438,9 +438,6 @@ static const OnigCodePoint CR_Alpha[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabea,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -479,27 +476,19 @@ static const OnigCodePoint CR_Alpha[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -510,70 +499,25 @@ static const OnigCodePoint CR_Alpha[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11000, 0x11045,
0x11082, 0x110b8,
0x110d0, 0x110e8,
0x11100, 0x11132,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11180, 0x111bf,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x11234,
- 0x11237, 0x11237,
- 0x112b0, 0x112e8,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134c,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11480, 0x114c1,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115b5,
- 0x115b8, 0x115be,
- 0x11600, 0x1163e,
- 0x11640, 0x11640,
- 0x11644, 0x11644,
0x11680, 0x116b5,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9e, 0x1bc9e,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -604,7 +548,6 @@ static const OnigCodePoint CR_Alpha[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -638,9 +581,6 @@ static const OnigCodePoint CR_Alpha[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -649,11 +589,12 @@ static const OnigCodePoint CR_Alpha[] = {
/* 'Blank': [[:Blank:]] */
static const OnigCodePoint CR_Blank[] = {
- 8,
+ 9,
0x0009, 0x0009,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x202f, 0x202f,
0x205f, 0x205f,
@@ -669,7 +610,7 @@ static const OnigCodePoint CR_Cntrl[] = {
/* 'Digit': [[:Digit:]] */
static const OnigCodePoint CR_Digit[] = {
- 50,
+ 42,
0x0030, 0x0039,
0x0660, 0x0669,
0x06f0, 0x06f9,
@@ -683,7 +624,6 @@ static const OnigCodePoint CR_Digit[] = {
0x0c66, 0x0c6f,
0x0ce6, 0x0cef,
0x0d66, 0x0d6f,
- 0x0de6, 0x0def,
0x0e50, 0x0e59,
0x0ed0, 0x0ed9,
0x0f20, 0x0f29,
@@ -703,7 +643,6 @@ static const OnigCodePoint CR_Digit[] = {
0xa8d0, 0xa8d9,
0xa900, 0xa909,
0xa9d0, 0xa9d9,
- 0xa9f0, 0xa9f9,
0xaa50, 0xaa59,
0xabf0, 0xabf9,
0xff10, 0xff19,
@@ -712,35 +651,30 @@ static const OnigCodePoint CR_Digit[] = {
0x110f0, 0x110f9,
0x11136, 0x1113f,
0x111d0, 0x111d9,
- 0x112f0, 0x112f9,
- 0x114d0, 0x114d9,
- 0x11650, 0x11659,
0x116c0, 0x116c9,
- 0x118e0, 0x118e9,
- 0x16a60, 0x16a69,
- 0x16b50, 0x16b59,
0x1d7ce, 0x1d7ff,
}; /* CR_Digit */
/* 'Graph': [[:Graph:]] */
static const OnigCodePoint CR_Graph[] = {
- 605,
+ 544,
0x0021, 0x007e,
0x00a1, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x052f,
+ 0x03a3, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x061c,
+ 0x0600, 0x0604,
+ 0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -749,8 +683,12 @@ static const OnigCodePoint CR_Graph[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0983,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -823,11 +761,12 @@ static const OnigCodePoint CR_Graph[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -836,7 +775,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -850,7 +789,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -871,7 +810,6 @@ static const OnigCodePoint CR_Graph[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -923,7 +861,7 @@ static const OnigCodePoint CR_Graph[] = {
0x13a0, 0x13f4,
0x1400, 0x167f,
0x1681, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -934,12 +872,12 @@ static const OnigCodePoint CR_Graph[] = {
0x1780, 0x17dd,
0x17e0, 0x17e9,
0x17f0, 0x17f9,
- 0x1800, 0x180e,
+ 0x1800, 0x180d,
0x1810, 0x1819,
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -954,7 +892,6 @@ static const OnigCodePoint CR_Graph[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -963,8 +900,7 @@ static const OnigCodePoint CR_Graph[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -985,20 +921,18 @@ static const OnigCodePoint CR_Graph[] = {
0x202a, 0x202e,
0x2030, 0x205e,
0x2060, 0x2064,
- 0x2066, 0x2071,
+ 0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0x20d0, 0x20f0,
0x2100, 0x2189,
- 0x2190, 0x23fa,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -1016,7 +950,7 @@ static const OnigCodePoint CR_Graph[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -1035,12 +969,12 @@ static const OnigCodePoint CR_Graph[] = {
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa69d,
+ 0xa640, 0xa697,
0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -1050,19 +984,18 @@ static const OnigCodePoint CR_Graph[] = {
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
+ 0xaa5c, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -1083,7 +1016,7 @@ static const OnigCodePoint CR_Graph[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
@@ -1107,35 +1040,26 @@ static const OnigCodePoint CR_Graph[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
+ 0x10857, 0x1085f,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -1149,82 +1073,33 @@ static const OnigCodePoint CR_Graph[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x110c1,
+ 0x11080, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
- 0x11150, 0x11176,
0x11180, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c9,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d1dd,
@@ -1252,8 +1127,6 @@ static const OnigCodePoint CR_Graph[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -1291,10 +1164,10 @@ static const OnigCodePoint CR_Graph[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -1302,25 +1175,24 @@ static const OnigCodePoint CR_Graph[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -1334,7 +1206,7 @@ static const OnigCodePoint CR_Graph[] = {
/* 'Lower': [[:Lower:]] */
static const OnigCodePoint CR_Lower[] = {
- 633,
+ 618,
0x0061, 0x007a,
0x00aa, 0x00aa,
0x00b5, 0x00b5,
@@ -1605,10 +1477,6 @@ static const OnigCodePoint CR_Lower[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
0x1d00, 0x1dbf,
0x1e01, 0x1e01,
@@ -1870,8 +1738,6 @@ static const OnigCodePoint CR_Lower[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69d,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -1920,26 +1786,17 @@ static const OnigCodePoint CR_Lower[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
- 0xa793, 0xa795,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
0xa7a7, 0xa7a7,
0xa7a9, 0xa7a9,
0xa7f8, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x118c0, 0x118df,
0x1d41a, 0x1d433,
0x1d44e, 0x1d454,
0x1d456, 0x1d467,
@@ -1972,23 +1829,24 @@ static const OnigCodePoint CR_Lower[] = {
/* 'Print': [[:Print:]] */
static const OnigCodePoint CR_Print[] = {
- 602,
+ 541,
0x0020, 0x007e,
0x00a0, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x052f,
+ 0x03a3, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x061c,
+ 0x0600, 0x0604,
+ 0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -1997,8 +1855,12 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0983,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -2071,11 +1933,12 @@ static const OnigCodePoint CR_Print[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -2084,7 +1947,7 @@ static const OnigCodePoint CR_Print[] = {
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -2098,7 +1961,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -2119,7 +1982,6 @@ static const OnigCodePoint CR_Print[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -2170,7 +2032,7 @@ static const OnigCodePoint CR_Print[] = {
0x1380, 0x1399,
0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -2186,7 +2048,7 @@ static const OnigCodePoint CR_Print[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -2201,7 +2063,6 @@ static const OnigCodePoint CR_Print[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -2210,8 +2071,7 @@ static const OnigCodePoint CR_Print[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -2230,20 +2090,18 @@ static const OnigCodePoint CR_Print[] = {
0x1ff6, 0x1ffe,
0x2000, 0x2027,
0x202a, 0x2064,
- 0x2066, 0x2071,
+ 0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0x20d0, 0x20f0,
0x2100, 0x2189,
- 0x2190, 0x23fa,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -2261,7 +2119,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -2280,12 +2138,12 @@ static const OnigCodePoint CR_Print[] = {
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa69d,
+ 0xa640, 0xa697,
0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -2295,19 +2153,18 @@ static const OnigCodePoint CR_Print[] = {
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
+ 0xaa5c, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -2328,7 +2185,7 @@ static const OnigCodePoint CR_Print[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
@@ -2352,35 +2209,26 @@ static const OnigCodePoint CR_Print[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
+ 0x10857, 0x1085f,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -2394,82 +2242,33 @@ static const OnigCodePoint CR_Print[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x110c1,
+ 0x11080, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
- 0x11150, 0x11176,
0x11180, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c9,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d1dd,
@@ -2497,8 +2296,6 @@ static const OnigCodePoint CR_Print[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -2536,10 +2333,10 @@ static const OnigCodePoint CR_Print[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -2547,25 +2344,24 @@ static const OnigCodePoint CR_Print[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -2579,7 +2375,7 @@ static const OnigCodePoint CR_Print[] = {
/* 'Punct': [[:Punct:]] */
static const OnigCodePoint CR_Punct[] = {
- 155,
+ 140,
0x0021, 0x0023,
0x0025, 0x002a,
0x002c, 0x002f,
@@ -2653,7 +2449,6 @@ static const OnigCodePoint CR_Punct[] = {
0x2053, 0x205e,
0x207d, 0x207e,
0x208d, 0x208e,
- 0x2308, 0x230b,
0x2329, 0x232a,
0x2768, 0x2775,
0x27c5, 0x27c6,
@@ -2665,7 +2460,7 @@ static const OnigCodePoint CR_Punct[] = {
0x2cfe, 0x2cff,
0x2d70, 0x2d70,
0x2e00, 0x2e2e,
- 0x2e30, 0x2e42,
+ 0x2e30, 0x2e3b,
0x3001, 0x3003,
0x3008, 0x3011,
0x3014, 0x301f,
@@ -2709,42 +2504,29 @@ static const OnigCodePoint CR_Punct[] = {
0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
- 0x1056f, 0x1056f,
0x10857, 0x10857,
0x1091f, 0x1091f,
0x1093f, 0x1093f,
0x10a50, 0x10a58,
0x10a7f, 0x10a7f,
- 0x10af0, 0x10af6,
0x10b39, 0x10b3f,
- 0x10b99, 0x10b9c,
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
0x11140, 0x11143,
- 0x11174, 0x11175,
0x111c5, 0x111c8,
- 0x111cd, 0x111cd,
- 0x11238, 0x1123d,
- 0x114c6, 0x114c6,
- 0x115c1, 0x115c9,
- 0x11641, 0x11643,
- 0x12470, 0x12474,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b3b,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
+ 0x12470, 0x12473,
}; /* CR_Punct */
/* 'Space': [[:Space:]] */
static const OnigCodePoint CR_Space[] = {
- 10,
+ 11,
0x0009, 0x000d,
0x0020, 0x0020,
0x0085, 0x0085,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x2028, 0x2029,
0x202f, 0x202f,
@@ -2754,7 +2536,7 @@ static const OnigCodePoint CR_Space[] = {
/* 'Upper': [[:Upper:]] */
static const OnigCodePoint CR_Upper[] = {
- 627,
+ 610,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2902,7 +2684,6 @@ static const OnigCodePoint CR_Upper[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -3022,10 +2803,6 @@ static const OnigCodePoint CR_Upper[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
@@ -3282,8 +3059,6 @@ static const OnigCodePoint CR_Upper[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -3333,21 +3108,14 @@ static const OnigCodePoint CR_Upper[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x118a0, 0x118bf,
0x1d400, 0x1d419,
0x1d434, 0x1d44d,
0x1d468, 0x1d481,
@@ -3379,9 +3147,6 @@ static const OnigCodePoint CR_Upper[] = {
0x1d756, 0x1d76e,
0x1d790, 0x1d7a8,
0x1d7ca, 0x1d7ca,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Upper */
/* 'XDigit': [[:XDigit:]] */
@@ -3394,7 +3159,7 @@ static const OnigCodePoint CR_XDigit[] = {
/* 'Word': [[:Word:]] */
static const OnigCodePoint CR_Word[] = {
- 629,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -3412,14 +3177,13 @@ static const OnigCodePoint CR_Word[] = {
0x0300, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x0483, 0x052f,
+ 0x0483, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -3443,10 +3207,14 @@ static const OnigCodePoint CR_Word[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0963,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -3520,11 +3288,12 @@ static const OnigCodePoint CR_Word[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -3532,7 +3301,7 @@ static const OnigCodePoint CR_Word[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -3546,7 +3315,7 @@ static const OnigCodePoint CR_Word[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -3567,7 +3336,6 @@ static const OnigCodePoint CR_Word[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -3631,7 +3399,7 @@ static const OnigCodePoint CR_Word[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -3648,7 +3416,7 @@ static const OnigCodePoint CR_Word[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -3662,7 +3430,6 @@ static const OnigCodePoint CR_Word[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -3672,8 +3439,7 @@ static const OnigCodePoint CR_Word[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -3755,14 +3521,14 @@ static const OnigCodePoint CR_Word[] = {
0xa610, 0xa62b,
0xa640, 0xa672,
0xa674, 0xa67d,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -3773,12 +3539,12 @@ static const OnigCodePoint CR_Word[] = {
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaac2,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -3787,9 +3553,6 @@ static const OnigCodePoint CR_Word[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
@@ -3812,7 +3575,7 @@ static const OnigCodePoint CR_Word[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfb,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe70, 0xfe74,
@@ -3837,29 +3600,20 @@ static const OnigCodePoint CR_Word[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102e0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -3872,78 +3626,29 @@ static const OnigCodePoint CR_Word[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae6,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11000, 0x11046,
0x11066, 0x1106f,
- 0x1107f, 0x110ba,
+ 0x11080, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
- 0x11150, 0x11173,
- 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111d0, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x11237,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c0,
- 0x11600, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af4,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -3981,8 +3686,6 @@ static const OnigCodePoint CR_Word[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -4016,9 +3719,6 @@ static const OnigCodePoint CR_Word[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -4028,7 +3728,7 @@ static const OnigCodePoint CR_Word[] = {
/* 'Alnum': [[:Alnum:]] */
static const OnigCodePoint CR_Alnum[] = {
- 630,
+ 566,
0x0030, 0x0039,
0x0041, 0x005a,
0x0061, 0x007a,
@@ -4046,14 +3746,13 @@ static const OnigCodePoint CR_Alnum[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -4080,14 +3779,18 @@ static const OnigCodePoint CR_Alnum[] = {
0x0800, 0x0817,
0x081a, 0x082c,
0x0840, 0x0858,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x08e4, 0x08e9,
- 0x08f0, 0x093b,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x093b,
0x093d, 0x094c,
0x094e, 0x0950,
0x0955, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -4161,11 +3864,12 @@ static const OnigCodePoint CR_Alnum[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
@@ -4173,7 +3877,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -4187,7 +3891,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -4208,7 +3912,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e46,
@@ -4275,7 +3978,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1713,
0x1720, 0x1733,
@@ -4292,7 +3995,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x1938,
0x1946, 0x196d,
@@ -4320,7 +4023,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x1cee, 0x1cf3,
0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
- 0x1de7, 0x1df4,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -4399,14 +4101,14 @@ static const OnigCodePoint CR_Alnum[] = {
0xa610, 0xa62b,
0xa640, 0xa66e,
0xa674, 0xa67b,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa69f, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa827,
@@ -4421,14 +4123,12 @@ static const OnigCodePoint CR_Alnum[] = {
0xa980, 0xa9b2,
0xa9b4, 0xa9bf,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaabe,
+ 0xaa80, 0xaabe,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
@@ -4439,9 +4139,6 @@ static const OnigCodePoint CR_Alnum[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabea,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -4482,28 +4179,20 @@ static const OnigCodePoint CR_Alnum[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -4514,13 +4203,9 @@ static const OnigCodePoint CR_Alnum[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11000, 0x11045,
0x11066, 0x1106f,
@@ -4529,64 +4214,19 @@ static const OnigCodePoint CR_Alnum[] = {
0x110f0, 0x110f9,
0x11100, 0x11132,
0x11136, 0x1113f,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11180, 0x111bf,
0x111c1, 0x111c4,
- 0x111d0, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x11234,
- 0x11237, 0x11237,
- 0x112b0, 0x112e8,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134c,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11480, 0x114c1,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115be,
- 0x11600, 0x1163e,
- 0x11640, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b5,
0x116c0, 0x116c9,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9e, 0x1bc9e,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -4618,7 +4258,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -4652,9 +4291,6 @@ static const OnigCodePoint CR_Alnum[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -4676,22 +4312,23 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 600,
+ 539,
0x0000, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x052f,
+ 0x03a3, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x061c,
+ 0x0600, 0x0604,
+ 0x0606, 0x061b,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -4700,8 +4337,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0983,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -4774,11 +4415,12 @@ static const OnigCodePoint CR_Assigned[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -4787,7 +4429,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -4801,7 +4443,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -4822,7 +4464,6 @@ static const OnigCodePoint CR_Assigned[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -4873,7 +4514,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1380, 0x1399,
0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -4889,7 +4530,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -4904,7 +4545,6 @@ static const OnigCodePoint CR_Assigned[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -4913,8 +4553,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -4932,20 +4571,18 @@ static const OnigCodePoint CR_Assigned[] = {
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
0x2000, 0x2064,
- 0x2066, 0x2071,
+ 0x206a, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0x20d0, 0x20f0,
0x2100, 0x2189,
- 0x2190, 0x23fa,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -4963,7 +4600,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
+ 0x2de0, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -4982,12 +4619,12 @@ static const OnigCodePoint CR_Assigned[] = {
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa69d,
+ 0xa640, 0xa697,
0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa82b,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -4997,19 +4634,18 @@ static const OnigCodePoint CR_Assigned[] = {
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
+ 0xaa5c, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -5030,7 +4666,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
@@ -5054,35 +4690,26 @@ static const OnigCodePoint CR_Assigned[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
+ 0x10857, 0x1085f,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -5096,82 +4723,33 @@ static const OnigCodePoint CR_Assigned[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x110c1,
+ 0x11080, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
- 0x11150, 0x11176,
0x11180, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c9,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d1dd,
@@ -5199,8 +4777,6 @@ static const OnigCodePoint CR_Assigned[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -5238,10 +4814,10 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -5249,25 +4825,24 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -5281,20 +4856,20 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 603,
+ 541,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
0x0378, 0x0379,
- 0x0380, 0x0383,
+ 0x037f, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0530, 0x0530,
+ 0x0528, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058c,
+ 0x058b, 0x058e,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
@@ -5309,7 +4884,11 @@ static const OnigCodePoint CR_C[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08b3, 0x08e3,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -5382,11 +4961,12 @@ static const OnigCodePoint CR_C[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0bff,
+ 0x0bfb, 0x0c00,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
@@ -5395,7 +4975,7 @@ static const OnigCodePoint CR_C[] = {
0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c80,
+ 0x0c80, 0x0c81,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -5409,7 +4989,7 @@ static const OnigCodePoint CR_C[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d00,
+ 0x0cf3, 0x0d01,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -5430,8 +5010,7 @@ static const OnigCodePoint CR_C[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0de5,
- 0x0df0, 0x0df1,
+ 0x0de0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -5482,7 +5061,7 @@ static const OnigCodePoint CR_C[] = {
0x139a, 0x139f,
0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f9, 0x16ff,
+ 0x16f1, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -5493,12 +5072,12 @@ static const OnigCodePoint CR_C[] = {
0x17de, 0x17df,
0x17ea, 0x17ef,
0x17fa, 0x17ff,
- 0x180e, 0x180f,
+ 0x180f, 0x180f,
0x181a, 0x181f,
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191f, 0x191f,
+ 0x191d, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -5512,8 +5091,7 @@ static const OnigCodePoint CR_C[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aaf,
- 0x1abf, 0x1aff,
+ 0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -5521,9 +5099,8 @@ static const OnigCodePoint CR_C[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cf7,
- 0x1cfa, 0x1cff,
- 0x1df6, 0x1dfb,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -5546,17 +5123,15 @@ static const OnigCodePoint CR_C[] = {
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20be, 0x20cf,
+ 0x20ba, 0x20cf,
0x20f1, 0x20ff,
0x218a, 0x218f,
- 0x23fb, 0x23ff,
+ 0x23f4, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2b74, 0x2b75,
- 0x2b96, 0x2b97,
- 0x2bba, 0x2bbc,
- 0x2bc9, 0x2bc9,
- 0x2bd2, 0x2bff,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -5574,7 +5149,7 @@ static const OnigCodePoint CR_C[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e43, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -5593,11 +5168,11 @@ static const OnigCodePoint CR_C[] = {
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa69e, 0xa69e,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa7ae, 0xa7af,
- 0xa7b2, 0xa7f6,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -5608,19 +5183,18 @@ static const OnigCodePoint CR_C[] = {
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9ff, 0xa9ff,
+ 0xa9e0, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xab2f,
- 0xab60, 0xab63,
- 0xab66, 0xabbf,
+ 0xab2f, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -5641,7 +5215,7 @@ static const OnigCodePoint CR_C[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
- 0xfe2e, 0xfe2f,
+ 0xfe27, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -5664,35 +5238,26 @@ static const OnigCodePoint CR_C[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018d, 0x1018f,
- 0x1019c, 0x1019f,
- 0x101a1, 0x101cf,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102df,
- 0x102fc, 0x102ff,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
0x10324, 0x1032f,
- 0x1034b, 0x1034f,
- 0x1037b, 0x1037f,
+ 0x1034b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x104ff,
- 0x10528, 0x1052f,
- 0x10564, 0x1056e,
- 0x10570, 0x105ff,
- 0x10737, 0x1073f,
- 0x10756, 0x1075f,
- 0x10768, 0x107ff,
+ 0x104aa, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x1089f, 0x108a6,
- 0x108b0, 0x108ff,
+ 0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
@@ -5706,83 +5271,34 @@ static const OnigCodePoint CR_C[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10aa0, 0x10abf,
- 0x10ae7, 0x10aea,
- 0x10af7, 0x10aff,
+ 0x10a80, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b92, 0x10b98,
- 0x10b9d, 0x10ba8,
- 0x10bb0, 0x10bff,
+ 0x10b80, 0x10bff,
0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107e,
+ 0x11070, 0x1107f,
0x110bd, 0x110bd,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1114f,
- 0x11177, 0x1117f,
- 0x111c9, 0x111cc,
- 0x111ce, 0x111cf,
- 0x111db, 0x111e0,
- 0x111f5, 0x111ff,
- 0x11212, 0x11212,
- 0x1123e, 0x112af,
- 0x112eb, 0x112ef,
- 0x112fa, 0x11300,
- 0x11304, 0x11304,
- 0x1130d, 0x1130e,
- 0x11311, 0x11312,
- 0x11329, 0x11329,
- 0x11331, 0x11331,
- 0x11334, 0x11334,
- 0x1133a, 0x1133b,
- 0x11345, 0x11346,
- 0x11349, 0x1134a,
- 0x1134e, 0x11356,
- 0x11358, 0x1135c,
- 0x11364, 0x11365,
- 0x1136d, 0x1136f,
- 0x11375, 0x1147f,
- 0x114c8, 0x114cf,
- 0x114da, 0x1157f,
- 0x115b6, 0x115b7,
- 0x115ca, 0x115ff,
- 0x11645, 0x1164f,
- 0x1165a, 0x1167f,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
0x116b8, 0x116bf,
- 0x116ca, 0x1189f,
- 0x118f3, 0x118fe,
- 0x11900, 0x11abf,
- 0x11af9, 0x11fff,
- 0x12399, 0x123ff,
- 0x1246f, 0x1246f,
- 0x12475, 0x12fff,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x16a3f,
- 0x16a5f, 0x16a5f,
- 0x16a6a, 0x16a6d,
- 0x16a70, 0x16acf,
- 0x16aee, 0x16aef,
- 0x16af6, 0x16aff,
- 0x16b46, 0x16b4f,
- 0x16b5a, 0x16b5a,
- 0x16b62, 0x16b62,
- 0x16b78, 0x16b7c,
- 0x16b90, 0x16eff,
+ 0x16a39, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1bbff,
- 0x1bc6b, 0x1bc6f,
- 0x1bc7d, 0x1bc7f,
- 0x1bc89, 0x1bc8f,
- 0x1bc9a, 0x1bc9b,
- 0x1bca0, 0x1cfff,
+ 0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d173, 0x1d17a,
@@ -5810,9 +5326,7 @@ static const OnigCodePoint CR_C[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1e7ff,
- 0x1e8c5, 0x1e8c6,
- 0x1e8d7, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -5850,10 +5364,10 @@ static const OnigCodePoint CR_C[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0c0, 0x1f0c0,
+ 0x1f0bf, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0f6, 0x1f0ff,
- 0x1f10d, 0x1f10f,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -5861,25 +5375,24 @@ static const OnigCodePoint CR_C[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 0x1f32d, 0x1f32f,
- 0x1f37e, 0x1f37f,
- 0x1f3cf, 0x1f3d3,
- 0x1f3f8, 0x1f3ff,
- 0x1f4ff, 0x1f4ff,
- 0x1f54b, 0x1f54f,
- 0x1f57a, 0x1f57a,
- 0x1f5a4, 0x1f5a4,
- 0x1f643, 0x1f644,
- 0x1f6d0, 0x1f6df,
- 0x1f6ed, 0x1f6ef,
- 0x1f6f4, 0x1f6ff,
- 0x1f774, 0x1f77f,
- 0x1f7d5, 0x1f7ff,
- 0x1f80c, 0x1f80f,
- 0x1f848, 0x1f84f,
- 0x1f85a, 0x1f85f,
- 0x1f888, 0x1f88f,
- 0x1f8ae, 0x1ffff,
+ 0x1f321, 0x1f32f,
+ 0x1f336, 0x1f336,
+ 0x1f37d, 0x1f37f,
+ 0x1f394, 0x1f39f,
+ 0x1f3c5, 0x1f3c5,
+ 0x1f3cb, 0x1f3df,
+ 0x1f3f1, 0x1f3ff,
+ 0x1f43f, 0x1f43f,
+ 0x1f441, 0x1f441,
+ 0x1f4f8, 0x1f4f8,
+ 0x1f4fd, 0x1f4ff,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
+ 0x1f568, 0x1f5fa,
+ 0x1f641, 0x1f644,
+ 0x1f650, 0x1f67f,
+ 0x1f6c6, 0x1f6ff,
+ 0x1f774, 0x1ffff,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
0x2b81e, 0x2f7ff,
@@ -5892,21 +5405,18 @@ static const OnigCodePoint CR_C[] = {
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 17,
+ 14,
0x00ad, 0x00ad,
- 0x0600, 0x0605,
- 0x061c, 0x061c,
+ 0x0600, 0x0604,
0x06dd, 0x06dd,
0x070f, 0x070f,
- 0x180e, 0x180e,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
- 0x2066, 0x206f,
+ 0x206a, 0x206f,
0xfeff, 0xfeff,
0xfff9, 0xfffb,
0x110bd, 0x110bd,
- 0x1bca0, 0x1bca3,
0x1d173, 0x1d17a,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
@@ -5914,22 +5424,23 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 600,
+ 539,
0x0378, 0x0379,
- 0x0380, 0x0383,
+ 0x037f, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0530, 0x0530,
+ 0x0528, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058c,
+ 0x058b, 0x058e,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x061d, 0x061d,
+ 0x0605, 0x0605,
+ 0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
0x07b2, 0x07bf,
@@ -5938,7 +5449,11 @@ static const OnigCodePoint CR_Cn[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08b3, 0x08e3,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -6011,11 +5526,12 @@ static const OnigCodePoint CR_Cn[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0bff,
+ 0x0bfb, 0x0c00,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
@@ -6024,7 +5540,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c80,
+ 0x0c80, 0x0c81,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -6038,7 +5554,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d00,
+ 0x0cf3, 0x0d01,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -6059,8 +5575,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0de5,
- 0x0df0, 0x0df1,
+ 0x0de0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -6111,7 +5626,7 @@ static const OnigCodePoint CR_Cn[] = {
0x139a, 0x139f,
0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f9, 0x16ff,
+ 0x16f1, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -6127,7 +5642,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191f, 0x191f,
+ 0x191d, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -6141,8 +5656,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aaf,
- 0x1abf, 0x1aff,
+ 0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -6150,9 +5664,8 @@ static const OnigCodePoint CR_Cn[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cf7,
- 0x1cfa, 0x1cff,
- 0x1df6, 0x1dfb,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -6169,21 +5682,19 @@ static const OnigCodePoint CR_Cn[] = {
0x1ff0, 0x1ff1,
0x1ff5, 0x1ff5,
0x1fff, 0x1fff,
- 0x2065, 0x2065,
+ 0x2065, 0x2069,
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20be, 0x20cf,
+ 0x20ba, 0x20cf,
0x20f1, 0x20ff,
0x218a, 0x218f,
- 0x23fb, 0x23ff,
+ 0x23f4, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2b74, 0x2b75,
- 0x2b96, 0x2b97,
- 0x2bba, 0x2bbc,
- 0x2bc9, 0x2bc9,
- 0x2bd2, 0x2bff,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -6201,7 +5712,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e43, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -6220,11 +5731,11 @@ static const OnigCodePoint CR_Cn[] = {
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa69e, 0xa69e,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa7ae, 0xa7af,
- 0xa7b2, 0xa7f6,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -6235,19 +5746,18 @@ static const OnigCodePoint CR_Cn[] = {
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9ff, 0xa9ff,
+ 0xa9e0, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xab2f,
- 0xab60, 0xab63,
- 0xab66, 0xabbf,
+ 0xab2f, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -6268,7 +5778,7 @@ static const OnigCodePoint CR_Cn[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
- 0xfe2e, 0xfe2f,
+ 0xfe27, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -6292,35 +5802,26 @@ static const OnigCodePoint CR_Cn[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018d, 0x1018f,
- 0x1019c, 0x1019f,
- 0x101a1, 0x101cf,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102df,
- 0x102fc, 0x102ff,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
0x10324, 0x1032f,
- 0x1034b, 0x1034f,
- 0x1037b, 0x1037f,
+ 0x1034b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x104ff,
- 0x10528, 0x1052f,
- 0x10564, 0x1056e,
- 0x10570, 0x105ff,
- 0x10737, 0x1073f,
- 0x10756, 0x1075f,
- 0x10768, 0x107ff,
+ 0x104aa, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x1089f, 0x108a6,
- 0x108b0, 0x108ff,
+ 0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
@@ -6334,82 +5835,33 @@ static const OnigCodePoint CR_Cn[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10aa0, 0x10abf,
- 0x10ae7, 0x10aea,
- 0x10af7, 0x10aff,
+ 0x10a80, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b92, 0x10b98,
- 0x10b9d, 0x10ba8,
- 0x10bb0, 0x10bff,
+ 0x10b80, 0x10bff,
0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107e,
+ 0x11070, 0x1107f,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1114f,
- 0x11177, 0x1117f,
- 0x111c9, 0x111cc,
- 0x111ce, 0x111cf,
- 0x111db, 0x111e0,
- 0x111f5, 0x111ff,
- 0x11212, 0x11212,
- 0x1123e, 0x112af,
- 0x112eb, 0x112ef,
- 0x112fa, 0x11300,
- 0x11304, 0x11304,
- 0x1130d, 0x1130e,
- 0x11311, 0x11312,
- 0x11329, 0x11329,
- 0x11331, 0x11331,
- 0x11334, 0x11334,
- 0x1133a, 0x1133b,
- 0x11345, 0x11346,
- 0x11349, 0x1134a,
- 0x1134e, 0x11356,
- 0x11358, 0x1135c,
- 0x11364, 0x11365,
- 0x1136d, 0x1136f,
- 0x11375, 0x1147f,
- 0x114c8, 0x114cf,
- 0x114da, 0x1157f,
- 0x115b6, 0x115b7,
- 0x115ca, 0x115ff,
- 0x11645, 0x1164f,
- 0x1165a, 0x1167f,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
0x116b8, 0x116bf,
- 0x116ca, 0x1189f,
- 0x118f3, 0x118fe,
- 0x11900, 0x11abf,
- 0x11af9, 0x11fff,
- 0x12399, 0x123ff,
- 0x1246f, 0x1246f,
- 0x12475, 0x12fff,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x16a3f,
- 0x16a5f, 0x16a5f,
- 0x16a6a, 0x16a6d,
- 0x16a70, 0x16acf,
- 0x16aee, 0x16aef,
- 0x16af6, 0x16aff,
- 0x16b46, 0x16b4f,
- 0x16b5a, 0x16b5a,
- 0x16b62, 0x16b62,
- 0x16b78, 0x16b7c,
- 0x16b90, 0x16eff,
+ 0x16a39, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1bbff,
- 0x1bc6b, 0x1bc6f,
- 0x1bc7d, 0x1bc7f,
- 0x1bc89, 0x1bc8f,
- 0x1bc9a, 0x1bc9b,
- 0x1bca4, 0x1cfff,
+ 0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d1de, 0x1d1ff,
@@ -6436,9 +5888,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1e7ff,
- 0x1e8c5, 0x1e8c6,
- 0x1e8d7, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -6476,10 +5926,10 @@ static const OnigCodePoint CR_Cn[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0c0, 0x1f0c0,
+ 0x1f0bf, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0f6, 0x1f0ff,
- 0x1f10d, 0x1f10f,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -6487,25 +5937,24 @@ static const OnigCodePoint CR_Cn[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 0x1f32d, 0x1f32f,
- 0x1f37e, 0x1f37f,
- 0x1f3cf, 0x1f3d3,
- 0x1f3f8, 0x1f3ff,
- 0x1f4ff, 0x1f4ff,
- 0x1f54b, 0x1f54f,
- 0x1f57a, 0x1f57a,
- 0x1f5a4, 0x1f5a4,
- 0x1f643, 0x1f644,
- 0x1f6d0, 0x1f6df,
- 0x1f6ed, 0x1f6ef,
- 0x1f6f4, 0x1f6ff,
- 0x1f774, 0x1f77f,
- 0x1f7d5, 0x1f7ff,
- 0x1f80c, 0x1f80f,
- 0x1f848, 0x1f84f,
- 0x1f85a, 0x1f85f,
- 0x1f888, 0x1f88f,
- 0x1f8ae, 0x1ffff,
+ 0x1f321, 0x1f32f,
+ 0x1f336, 0x1f336,
+ 0x1f37d, 0x1f37f,
+ 0x1f394, 0x1f39f,
+ 0x1f3c5, 0x1f3c5,
+ 0x1f3cb, 0x1f3df,
+ 0x1f3f1, 0x1f3ff,
+ 0x1f43f, 0x1f43f,
+ 0x1f441, 0x1f441,
+ 0x1f4f8, 0x1f4f8,
+ 0x1f4fd, 0x1f4ff,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
+ 0x1f568, 0x1f5fa,
+ 0x1f641, 0x1f644,
+ 0x1f650, 0x1f67f,
+ 0x1f6c6, 0x1f6ff,
+ 0x1f774, 0x1ffff,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
0x2b81e, 0x2f7ff,
@@ -6533,7 +5982,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 537,
+ 486,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -6549,14 +5998,13 @@ static const OnigCodePoint CR_L[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -6582,12 +6030,14 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0980,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -6642,7 +6092,8 @@ static const OnigCodePoint CR_L[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -6726,7 +6177,6 @@ static const OnigCodePoint CR_L[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16f1, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -6740,7 +6190,7 @@ static const OnigCodePoint CR_L[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -6835,14 +6285,14 @@ static const OnigCodePoint CR_L[] = {
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa6a0, 0xa6e5,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -6855,15 +6305,12 @@ static const OnigCodePoint CR_L[] = {
0xa960, 0xa97c,
0xa984, 0xa9b2,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -6877,9 +6324,6 @@ static const OnigCodePoint CR_L[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -6918,27 +6362,19 @@ static const OnigCodePoint CR_L[] = {
0x10080, 0x100fa,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x10340,
0x10342, 0x10349,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -6948,61 +6384,24 @@ static const OnigCodePoint CR_L[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
+ 0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -7033,7 +6432,6 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -7075,7 +6473,7 @@ static const OnigCodePoint CR_L[] = {
/* 'LC': General Category */
static const OnigCodePoint CR_LC[] = {
- 117,
+ 113,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -7088,14 +6486,13 @@ static const OnigCodePoint CR_LC[] = {
0x0370, 0x0373,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
@@ -7148,21 +6545,18 @@ static const OnigCodePoint CR_LC[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa69b,
+ 0xa680, 0xa697,
0xa722, 0xa76f,
0xa771, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xa7fa, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab64, 0xab65,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
- 0x118a0, 0x118df,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -7197,7 +6591,7 @@ static const OnigCodePoint CR_LC[] = {
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 625,
+ 611,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -7463,10 +6857,6 @@ static const OnigCodePoint CR_Ll[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
0x1d00, 0x1d2b,
0x1d6b, 0x1d77,
@@ -7725,8 +7115,6 @@ static const OnigCodePoint CR_Ll[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -7776,25 +7164,17 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
- 0xa793, 0xa795,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
+ 0xa793, 0xa793,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
0xa7a7, 0xa7a7,
0xa7a9, 0xa7a9,
0xa7fa, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab64, 0xab65,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x118c0, 0x118df,
0x1d41a, 0x1d433,
0x1d44e, 0x1d454,
0x1d456, 0x1d467,
@@ -7827,7 +7207,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 56,
+ 52,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -7869,26 +7249,22 @@ static const OnigCodePoint CR_Lm[] = {
0xa4f8, 0xa4fd,
0xa60c, 0xa60c,
0xa67f, 0xa67f,
- 0xa69c, 0xa69d,
0xa717, 0xa71f,
0xa770, 0xa770,
0xa788, 0xa788,
0xa7f8, 0xa7f9,
0xa9cf, 0xa9cf,
- 0xa9e6, 0xa9e6,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
0xaaf3, 0xaaf4,
- 0xab5c, 0xab5f,
0xff70, 0xff70,
0xff9e, 0xff9f,
- 0x16b40, 0x16b43,
0x16f93, 0x16f9f,
}; /* CR_Lm */
/* 'Lo': General Category */
static const OnigCodePoint CR_Lo[] = {
- 417,
+ 371,
0x00aa, 0x00aa,
0x00ba, 0x00ba,
0x01bb, 0x01bb,
@@ -7911,12 +7287,14 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0972, 0x0980,
+ 0x0972, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -7971,7 +7349,8 @@ static const OnigCodePoint CR_Lo[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -8051,7 +7430,6 @@ static const OnigCodePoint CR_Lo[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16f1, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -8065,7 +7443,7 @@ static const OnigCodePoint CR_Lo[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -8114,7 +7492,6 @@ static const OnigCodePoint CR_Lo[] = {
0xa62a, 0xa62b,
0xa66e, 0xa66e,
0xa6a0, 0xa6e5,
- 0xa7f7, 0xa7f7,
0xa7fb, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
@@ -8127,16 +7504,13 @@ static const OnigCodePoint CR_Lo[] = {
0xa930, 0xa946,
0xa960, 0xa97c,
0xa984, 0xa9b2,
- 0xa9e0, 0xa9e4,
- 0xa9e7, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa6f,
0xaa71, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -8186,27 +7560,19 @@ static const OnigCodePoint CR_Lo[] = {
0x10080, 0x100fa,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x10340,
0x10342, 0x10349,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x10450, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -8216,59 +7582,23 @@ static const OnigCodePoint CR_Lo[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
+ 0x12000, 0x1236e,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -8325,7 +7655,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 622,
+ 608,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -8473,7 +7803,6 @@ static const OnigCodePoint CR_Lu[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -8593,10 +7922,6 @@ static const OnigCodePoint CR_Lu[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
@@ -8851,8 +8176,6 @@ static const OnigCodePoint CR_Lu[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -8902,21 +8225,14 @@ static const OnigCodePoint CR_Lu[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x118a0, 0x118bf,
0x1d400, 0x1d419,
0x1d434, 0x1d44d,
0x1d468, 0x1d481,
@@ -8952,7 +8268,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 229,
+ 204,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -8976,7 +8292,8 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x0903,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
0x0951, 0x0957,
@@ -9014,20 +8331,20 @@ static const OnigCodePoint CR_M[] = {
0x0bc6, 0x0bc8,
0x0bca, 0x0bcd,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c3e, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0cbc, 0x0cbc,
0x0cbe, 0x0cc4,
0x0cc6, 0x0cc8,
0x0cca, 0x0ccd,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d3e, 0x0d44,
0x0d46, 0x0d48,
0x0d4a, 0x0d4d,
@@ -9082,7 +8399,6 @@ static const OnigCodePoint CR_M[] = {
0x1a55, 0x1a5e,
0x1a60, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b04,
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
@@ -9094,8 +8410,7 @@ static const OnigCodePoint CR_M[] = {
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
0x1cf2, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
0x2cef, 0x2cf1,
@@ -9118,11 +8433,10 @@ static const OnigCodePoint CR_M[] = {
0xa947, 0xa953,
0xa980, 0xa983,
0xa9b3, 0xa9c0,
- 0xa9e5, 0xa9e5,
0xaa29, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4d,
- 0xaa7b, 0xaa7d,
+ 0xaa7b, 0xaa7b,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -9134,59 +8448,36 @@ static const OnigCodePoint CR_M[] = {
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11000, 0x11002,
0x11038, 0x11046,
- 0x1107f, 0x11082,
+ 0x11080, 0x11082,
0x110b0, 0x110ba,
0x11100, 0x11102,
0x11127, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11182,
0x111b3, 0x111c0,
- 0x1122c, 0x11237,
- 0x112df, 0x112ea,
- 0x11301, 0x11303,
- 0x1133c, 0x1133c,
- 0x1133e, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x11362, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b0, 0x114c3,
- 0x115af, 0x115b5,
- 0x115b8, 0x115c0,
- 0x11630, 0x11640,
0x116ab, 0x116b7,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
0x16f51, 0x16f7e,
0x16f8f, 0x16f92,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1e8d0, 0x1e8d6,
0xe0100, 0xe01ef,
}; /* CR_M */
/* 'Mc': General Category */
static const OnigCodePoint CR_Mc[] = {
- 147,
+ 126,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -9253,7 +8544,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1933, 0x1938,
0x19b0, 0x19c0,
0x19c8, 0x19c9,
- 0x1a19, 0x1a1a,
+ 0x1a19, 0x1a1b,
0x1a55, 0x1a55,
0x1a57, 0x1a57,
0x1a61, 0x1a61,
@@ -9268,6 +8559,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
+ 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -9290,7 +8582,6 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
- 0xaa7d, 0xaa7d,
0xaaeb, 0xaaeb,
0xaaee, 0xaaef,
0xaaf5, 0xaaf5,
@@ -9307,27 +8598,6 @@ static const OnigCodePoint CR_Mc[] = {
0x11182, 0x11182,
0x111b3, 0x111b5,
0x111bf, 0x111c0,
- 0x1122c, 0x1122e,
- 0x11232, 0x11233,
- 0x11235, 0x11235,
- 0x112e0, 0x112e2,
- 0x11302, 0x11303,
- 0x1133e, 0x1133f,
- 0x11341, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x11362, 0x11363,
- 0x114b0, 0x114b2,
- 0x114b9, 0x114b9,
- 0x114bb, 0x114be,
- 0x114c1, 0x114c1,
- 0x115af, 0x115b1,
- 0x115b8, 0x115bb,
- 0x115be, 0x115be,
- 0x11630, 0x11632,
- 0x1163b, 0x1163c,
- 0x1163e, 0x1163e,
0x116ac, 0x116ac,
0x116ae, 0x116af,
0x116b6, 0x116b6,
@@ -9338,9 +8608,8 @@ static const OnigCodePoint CR_Mc[] = {
/* 'Me': General Category */
static const OnigCodePoint CR_Me[] = {
- 5,
+ 4,
0x0488, 0x0489,
- 0x1abe, 0x1abe,
0x20dd, 0x20e0,
0x20e2, 0x20e4,
0xa670, 0xa672,
@@ -9348,7 +8617,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 255,
+ 220,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -9372,7 +8641,8 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x0902,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -9408,19 +8678,16 @@ static const OnigCodePoint CR_Mn[] = {
0x0b82, 0x0b82,
0x0bc0, 0x0bc0,
0x0bcd, 0x0bcd,
- 0x0c00, 0x0c00,
0x0c3e, 0x0c40,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c81,
0x0cbc, 0x0cbc,
0x0cbf, 0x0cbf,
0x0cc6, 0x0cc6,
0x0ccc, 0x0ccd,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d01,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
0x0d62, 0x0d63,
@@ -9472,7 +8739,6 @@ static const OnigCodePoint CR_Mn[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
- 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -9480,7 +8746,6 @@ static const OnigCodePoint CR_Mn[] = {
0x1a65, 0x1a6c,
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abd,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -9490,7 +8755,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bad,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -9502,8 +8767,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
0x20e1, 0x20e1,
@@ -9529,13 +8793,11 @@ static const OnigCodePoint CR_Mn[] = {
0xa9b3, 0xa9b3,
0xa9b6, 0xa9b9,
0xa9bc, 0xa9bc,
- 0xa9e5, 0xa9e5,
0xaa29, 0xaa2e,
0xaa31, 0xaa32,
0xaa35, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4c,
- 0xaa7c, 0xaa7c,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -9548,67 +8810,39 @@ static const OnigCodePoint CR_Mn[] = {
0xabed, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x1107f, 0x11081,
+ 0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x11100, 0x11102,
0x11127, 0x1112b,
0x1112d, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11181,
0x111b6, 0x111be,
- 0x1122f, 0x11231,
- 0x11234, 0x11234,
- 0x11236, 0x11237,
- 0x112df, 0x112df,
- 0x112e3, 0x112ea,
- 0x11301, 0x11301,
- 0x1133c, 0x1133c,
- 0x11340, 0x11340,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b3, 0x114b8,
- 0x114ba, 0x114ba,
- 0x114bf, 0x114c0,
- 0x114c2, 0x114c3,
- 0x115b2, 0x115b5,
- 0x115bc, 0x115bd,
- 0x115bf, 0x115c0,
- 0x11633, 0x1163a,
- 0x1163d, 0x1163d,
- 0x1163f, 0x11640,
0x116ab, 0x116ab,
0x116ad, 0x116ad,
0x116b0, 0x116b5,
0x116b7, 0x116b7,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
0x16f8f, 0x16f92,
- 0x1bc9d, 0x1bc9e,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1e8d0, 0x1e8d6,
0xe0100, 0xe01ef,
}; /* CR_Mn */
/* 'N': Major Category */
static const OnigCodePoint CR_N[] = {
- 105,
+ 88,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -9628,7 +8862,6 @@ static const OnigCodePoint CR_N[] = {
0x0c78, 0x0c7e,
0x0ce6, 0x0cef,
0x0d66, 0x0d75,
- 0x0de6, 0x0def,
0x0e50, 0x0e59,
0x0ed0, 0x0ed9,
0x0f20, 0x0f33,
@@ -9671,49 +8904,33 @@ static const OnigCodePoint CR_N[] = {
0xa8d0, 0xa8d9,
0xa900, 0xa909,
0xa9d0, 0xa9d9,
- 0xa9f0, 0xa9f9,
0xaa50, 0xaa59,
0xabf0, 0xabf9,
0xff10, 0xff19,
0x10107, 0x10133,
0x10140, 0x10178,
- 0x1018a, 0x1018b,
- 0x102e1, 0x102fb,
+ 0x1018a, 0x1018a,
0x10320, 0x10323,
0x10341, 0x10341,
0x1034a, 0x1034a,
0x103d1, 0x103d5,
0x104a0, 0x104a9,
0x10858, 0x1085f,
- 0x10879, 0x1087f,
- 0x108a7, 0x108af,
0x10916, 0x1091b,
0x10a40, 0x10a47,
0x10a7d, 0x10a7e,
- 0x10a9d, 0x10a9f,
- 0x10aeb, 0x10aef,
0x10b58, 0x10b5f,
0x10b78, 0x10b7f,
- 0x10ba9, 0x10baf,
0x10e60, 0x10e7e,
0x11052, 0x1106f,
0x110f0, 0x110f9,
0x11136, 0x1113f,
0x111d0, 0x111d9,
- 0x111e1, 0x111f4,
- 0x112f0, 0x112f9,
- 0x114d0, 0x114d9,
- 0x11650, 0x11659,
0x116c0, 0x116c9,
- 0x118e0, 0x118f2,
- 0x12400, 0x1246e,
- 0x16a60, 0x16a69,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
+ 0x12400, 0x12462,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
- 0x1e8c7, 0x1e8cf,
- 0x1f100, 0x1f10c,
+ 0x1f100, 0x1f10a,
}; /* CR_N */
/* 'Nd': General Category */
@@ -9733,12 +8950,12 @@ static const OnigCodePoint CR_Nl[] = {
0x10341, 0x10341,
0x1034a, 0x1034a,
0x103d1, 0x103d5,
- 0x12400, 0x1246e,
+ 0x12400, 0x12462,
}; /* CR_Nl */
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 52,
+ 42,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -9769,28 +8986,18 @@ static const OnigCodePoint CR_No[] = {
0xa830, 0xa835,
0x10107, 0x10133,
0x10175, 0x10178,
- 0x1018a, 0x1018b,
- 0x102e1, 0x102fb,
+ 0x1018a, 0x1018a,
0x10320, 0x10323,
0x10858, 0x1085f,
- 0x10879, 0x1087f,
- 0x108a7, 0x108af,
0x10916, 0x1091b,
0x10a40, 0x10a47,
0x10a7d, 0x10a7e,
- 0x10a9d, 0x10a9f,
- 0x10aeb, 0x10aef,
0x10b58, 0x10b5f,
0x10b78, 0x10b7f,
- 0x10ba9, 0x10baf,
0x10e60, 0x10e7e,
0x11052, 0x11065,
- 0x111e1, 0x111f4,
- 0x118ea, 0x118f2,
- 0x16b5b, 0x16b61,
0x1d360, 0x1d371,
- 0x1e8c7, 0x1e8cf,
- 0x1f100, 0x1f10c,
+ 0x1f100, 0x1f10a,
}; /* CR_No */
/* 'P': Major Category */
@@ -9809,7 +9016,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 17,
+ 16,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -9819,7 +9026,6 @@ static const OnigCodePoint CR_Pd[] = {
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
0x2e3a, 0x2e3b,
- 0x2e40, 0x2e40,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -9831,7 +9037,7 @@ static const OnigCodePoint CR_Pd[] = {
/* 'Pe': General Category */
static const OnigCodePoint CR_Pe[] = {
- 72,
+ 70,
0x0029, 0x0029,
0x005d, 0x005d,
0x007d, 0x007d,
@@ -9841,8 +9047,6 @@ static const OnigCodePoint CR_Pe[] = {
0x2046, 0x2046,
0x207e, 0x207e,
0x208e, 0x208e,
- 0x2309, 0x2309,
- 0x230b, 0x230b,
0x232a, 0x232a,
0x2769, 0x2769,
0x276b, 0x276b,
@@ -9885,7 +9089,7 @@ static const OnigCodePoint CR_Pe[] = {
0x3019, 0x3019,
0x301b, 0x301b,
0x301e, 0x301f,
- 0xfd3e, 0xfd3e,
+ 0xfd3f, 0xfd3f,
0xfe18, 0xfe18,
0xfe36, 0xfe36,
0xfe38, 0xfe38,
@@ -9939,7 +9143,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 151,
+ 135,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -10021,8 +9225,6 @@ static const OnigCodePoint CR_Po[] = {
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
0x2e30, 0x2e39,
- 0x2e3c, 0x2e3f,
- 0x2e41, 0x2e41,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -10065,37 +9267,23 @@ static const OnigCodePoint CR_Po[] = {
0x10100, 0x10102,
0x1039f, 0x1039f,
0x103d0, 0x103d0,
- 0x1056f, 0x1056f,
0x10857, 0x10857,
0x1091f, 0x1091f,
0x1093f, 0x1093f,
0x10a50, 0x10a58,
0x10a7f, 0x10a7f,
- 0x10af0, 0x10af6,
0x10b39, 0x10b3f,
- 0x10b99, 0x10b9c,
0x11047, 0x1104d,
0x110bb, 0x110bc,
0x110be, 0x110c1,
0x11140, 0x11143,
- 0x11174, 0x11175,
0x111c5, 0x111c8,
- 0x111cd, 0x111cd,
- 0x11238, 0x1123d,
- 0x114c6, 0x114c6,
- 0x115c1, 0x115c9,
- 0x11641, 0x11643,
- 0x12470, 0x12474,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b3b,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
+ 0x12470, 0x12473,
}; /* CR_Po */
/* 'Ps': General Category */
static const OnigCodePoint CR_Ps[] = {
- 75,
+ 72,
0x0028, 0x0028,
0x005b, 0x005b,
0x007b, 0x007b,
@@ -10107,8 +9295,6 @@ static const OnigCodePoint CR_Ps[] = {
0x2045, 0x2045,
0x207d, 0x207d,
0x208d, 0x208d,
- 0x2308, 0x2308,
- 0x230a, 0x230a,
0x2329, 0x2329,
0x2768, 0x2768,
0x276a, 0x276a,
@@ -10141,7 +9327,6 @@ static const OnigCodePoint CR_Ps[] = {
0x2e24, 0x2e24,
0x2e26, 0x2e26,
0x2e28, 0x2e28,
- 0x2e42, 0x2e42,
0x3008, 0x3008,
0x300a, 0x300a,
0x300c, 0x300c,
@@ -10152,7 +9337,7 @@ static const OnigCodePoint CR_Ps[] = {
0x3018, 0x3018,
0x301a, 0x301a,
0x301d, 0x301d,
- 0xfd3f, 0xfd3f,
+ 0xfd3e, 0xfd3e,
0xfe17, 0xfe17,
0xfe35, 0xfe35,
0xfe37, 0xfe37,
@@ -10175,7 +9360,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 210,
+ 198,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -10200,7 +9385,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -10244,7 +9429,7 @@ static const OnigCodePoint CR_S[] = {
0x2052, 0x2052,
0x207a, 0x207c,
0x208a, 0x208c,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0x2100, 0x2101,
0x2103, 0x2106,
0x2108, 0x2109,
@@ -10259,23 +9444,20 @@ static const OnigCodePoint CR_S[] = {
0x2140, 0x2144,
0x214a, 0x214d,
0x214f, 0x214f,
- 0x2190, 0x2307,
- 0x230c, 0x2328,
- 0x232b, 0x23fa,
+ 0x2190, 0x2328,
+ 0x232b, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
- 0x2500, 0x2767,
+ 0x2500, 0x26ff,
+ 0x2701, 0x2767,
0x2794, 0x27c4,
0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
- 0x29fe, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
+ 0x29fe, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
@@ -10305,7 +9487,6 @@ static const OnigCodePoint CR_S[] = {
0xa828, 0xa82b,
0xa836, 0xa839,
0xaa77, 0xaa79,
- 0xab5b, 0xab5b,
0xfb29, 0xfb29,
0xfbb2, 0xfbc1,
0xfdfc, 0xfdfd,
@@ -10324,15 +9505,8 @@ static const OnigCodePoint CR_S[] = {
0xfffc, 0xfffd,
0x10137, 0x1013f,
0x10179, 0x10189,
- 0x1018c, 0x1018c,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fc,
- 0x10877, 0x10878,
- 0x10ac8, 0x10ac8,
- 0x16b3c, 0x16b3f,
- 0x16b45, 0x16b45,
- 0x1bc9c, 0x1bc9c,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
@@ -10357,9 +9531,9 @@ static const OnigCodePoint CR_S[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
+ 0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -10367,25 +9541,24 @@ static const OnigCodePoint CR_S[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
}; /* CR_S */
/* 'Sc': General Category */
@@ -10401,7 +9574,7 @@ static const OnigCodePoint CR_Sc[] = {
0x0bf9, 0x0bf9,
0x0e3f, 0x0e3f,
0x17db, 0x17db,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0xa838, 0xa838,
0xfdfc, 0xfdfc,
0xfe69, 0xfe69,
@@ -10412,7 +9585,7 @@ static const OnigCodePoint CR_Sc[] = {
/* 'Sk': General Category */
static const OnigCodePoint CR_Sk[] = {
- 28,
+ 27,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -10436,7 +9609,6 @@ static const OnigCodePoint CR_Sk[] = {
0xa700, 0xa716,
0xa720, 0xa721,
0xa789, 0xa78a,
- 0xab5b, 0xab5b,
0xfbb2, 0xfbc1,
0xff3e, 0xff3e,
0xff40, 0xff40,
@@ -10445,7 +9617,7 @@ static const OnigCodePoint CR_Sk[] = {
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 64,
+ 65,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -10473,6 +9645,7 @@ static const OnigCodePoint CR_Sm[] = {
0x21d2, 0x21d2,
0x21d4, 0x21d4,
0x21f4, 0x22ff,
+ 0x2308, 0x230b,
0x2320, 0x2321,
0x237c, 0x237c,
0x239b, 0x23b3,
@@ -10514,13 +9687,12 @@ static const OnigCodePoint CR_Sm[] = {
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 165,
+ 153,
0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
0x0482, 0x0482,
- 0x058d, 0x058e,
0x060e, 0x060f,
0x06de, 0x06de,
0x06e9, 0x06e9,
@@ -10578,7 +9750,7 @@ static const OnigCodePoint CR_So[] = {
0x232b, 0x237b,
0x237d, 0x239a,
0x23b4, 0x23db,
- 0x23e2, 0x23fa,
+ 0x23e2, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
@@ -10586,16 +9758,13 @@ static const OnigCodePoint CR_So[] = {
0x25b8, 0x25c0,
0x25c2, 0x25f7,
0x2600, 0x266e,
- 0x2670, 0x2767,
+ 0x2670, 0x26ff,
+ 0x2701, 0x2767,
0x2794, 0x27bf,
0x2800, 0x28ff,
0x2b00, 0x2b2f,
0x2b45, 0x2b46,
- 0x2b4d, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
+ 0x2b50, 0x2b59,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
@@ -10629,15 +9798,8 @@ static const OnigCodePoint CR_So[] = {
0xfffc, 0xfffd,
0x10137, 0x1013f,
0x10179, 0x10189,
- 0x1018c, 0x1018c,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fc,
- 0x10877, 0x10878,
- 0x10ac8, 0x10ac8,
- 0x16b3c, 0x16b3f,
- 0x16b45, 0x16b45,
- 0x1bc9c, 0x1bc9c,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
@@ -10651,9 +9813,9 @@ static const OnigCodePoint CR_So[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
+ 0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -10661,33 +9823,33 @@ static const OnigCodePoint CR_So[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
}; /* CR_So */
/* 'Z': Major Category */
static const OnigCodePoint CR_Z[] = {
- 8,
+ 9,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x2028, 0x2029,
0x202f, 0x202f,
@@ -10709,10 +9871,11 @@ static const OnigCodePoint CR_Zp[] = {
/* 'Zs': General Category */
static const OnigCodePoint CR_Zs[] = {
- 7,
+ 8,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
+ 0x180e, 0x180e,
0x2000, 0x200a,
0x202f, 0x202f,
0x205f, 0x205f,
@@ -10873,7 +10036,7 @@ static const OnigCodePoint CR_Math[] = {
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 127,
+ 119,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -10891,14 +10054,13 @@ static const OnigCodePoint CR_Cased[] = {
0x0370, 0x0373,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
@@ -10953,21 +10115,17 @@ static const OnigCodePoint CR_Cased[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa69d,
+ 0xa680, 0xa697,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
0xa7f8, 0xa7fa,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
- 0x118a0, 0x118df,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -10998,14 +10156,11 @@ static const OnigCodePoint CR_Cased[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Cased */
/* 'Case_Ignorable': Derived Property */
static const OnigCodePoint CR_Case_Ignorable[] = {
- 335,
+ 295,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -11029,9 +10184,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0605,
+ 0x0600, 0x0604,
0x0610, 0x061a,
- 0x061c, 0x061c,
0x0640, 0x0640,
0x064b, 0x065f,
0x0670, 0x0670,
@@ -11046,7 +10200,8 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x0902,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -11083,19 +10238,16 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x0b82, 0x0b82,
0x0bc0, 0x0bc0,
0x0bcd, 0x0bcd,
- 0x0c00, 0x0c00,
0x0c3e, 0x0c40,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c81,
0x0cbc, 0x0cbc,
0x0cbf, 0x0cbf,
0x0cc6, 0x0cc6,
0x0ccc, 0x0ccd,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d01,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
0x0d62, 0x0d63,
@@ -11143,7 +10295,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x17c9, 0x17d3,
0x17d7, 0x17d7,
0x17dd, 0x17dd,
- 0x180b, 0x180e,
+ 0x180b, 0x180d,
0x1843, 0x1843,
0x18a9, 0x18a9,
0x1920, 0x1922,
@@ -11151,7 +10303,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
- 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -11160,7 +10311,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -11170,7 +10320,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bad,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -11183,10 +10333,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
- 0x1d9b, 0x1df5,
+ 0x1d9b, 0x1de6,
0x1dfc, 0x1dff,
0x1fbd, 0x1fbd,
0x1fbf, 0x1fc1,
@@ -11200,7 +10349,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x2027, 0x2027,
0x202a, 0x202e,
0x2060, 0x2064,
- 0x2066, 0x206f,
+ 0x206a, 0x206f,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
@@ -11223,7 +10372,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa66f, 0xa672,
0xa674, 0xa67d,
0xa67f, 0xa67f,
- 0xa69c, 0xa69d,
0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
@@ -11243,14 +10391,12 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa9b6, 0xa9b9,
0xa9bc, 0xa9bc,
0xa9cf, 0xa9cf,
- 0xa9e5, 0xa9e6,
0xaa29, 0xaa2e,
0xaa31, 0xaa32,
0xaa35, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4c,
0xaa70, 0xaa70,
- 0xaa7c, 0xaa7c,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -11260,7 +10406,6 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaaec, 0xaaed,
0xaaf3, 0xaaf4,
0xaaf6, 0xaaf6,
- 0xab5b, 0xab5f,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -11268,7 +10413,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xfbb2, 0xfbc1,
0xfe00, 0xfe0f,
0xfe13, 0xfe13,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe52, 0xfe52,
0xfe55, 0xfe55,
0xfeff, 0xfeff,
@@ -11282,62 +10427,32 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xffe3, 0xffe3,
0xfff9, 0xfffb,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x1107f, 0x11081,
+ 0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x110bd, 0x110bd,
0x11100, 0x11102,
0x11127, 0x1112b,
0x1112d, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11181,
0x111b6, 0x111be,
- 0x1122f, 0x11231,
- 0x11234, 0x11234,
- 0x11236, 0x11237,
- 0x112df, 0x112df,
- 0x112e3, 0x112ea,
- 0x11301, 0x11301,
- 0x1133c, 0x1133c,
- 0x11340, 0x11340,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b3, 0x114b8,
- 0x114ba, 0x114ba,
- 0x114bf, 0x114c0,
- 0x114c2, 0x114c3,
- 0x115b2, 0x115b5,
- 0x115bc, 0x115bd,
- 0x115bf, 0x115c0,
- 0x11633, 0x1163a,
- 0x1163d, 0x1163d,
- 0x1163f, 0x11640,
0x116ab, 0x116ab,
0x116ad, 0x116ad,
0x116b0, 0x116b5,
0x116b7, 0x116b7,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
- 0x16b40, 0x16b43,
0x16f8f, 0x16f9f,
- 0x1bc9d, 0x1bc9e,
- 0x1bca0, 0x1bca3,
0x1d167, 0x1d169,
0x1d173, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1e8d0, 0x1e8d6,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
0xe0100, 0xe01ef,
@@ -11345,7 +10460,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 585,
+ 571,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -11493,7 +10608,6 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -11612,10 +10726,6 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x10a0, 0x10c5,
0x10c7, 0x10c7,
@@ -11865,8 +10975,6 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -11916,26 +11024,19 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa7aa, 0xa7aa,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x118a0, 0x118bf,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 599,
+ 586,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -12082,21 +11183,20 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x024f, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025c,
- 0x0260, 0x0261,
+ 0x025b, 0x025b,
+ 0x0260, 0x0260,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026c,
+ 0x026b, 0x026b,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0287, 0x028c,
+ 0x0288, 0x028c,
0x0292, 0x0292,
- 0x029e, 0x029e,
0x0345, 0x0345,
0x0371, 0x0371,
0x0373, 0x0373,
@@ -12117,7 +11217,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x03e9, 0x03e9,
0x03eb, 0x03eb,
0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
+ 0x03ef, 0x03f2,
0x03f5, 0x03f5,
0x03f8, 0x03f8,
0x03fb, 0x03fb,
@@ -12217,10 +11317,6 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
@@ -12470,8 +11566,6 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -12520,11 +11614,6 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa78c, 0xa78c,
0xa791, 0xa791,
0xa793, 0xa793,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -12534,12 +11623,11 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x118c0, 0x118df,
}; /* CR_Changes_When_Uppercased */
/* 'Changes_When_Titlecased': Derived Property */
static const OnigCodePoint CR_Changes_When_Titlecased[] = {
- 600,
+ 587,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -12687,21 +11775,20 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x024f, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025c,
- 0x0260, 0x0261,
+ 0x025b, 0x025b,
+ 0x0260, 0x0260,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026c,
+ 0x026b, 0x026b,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0287, 0x028c,
+ 0x0288, 0x028c,
0x0292, 0x0292,
- 0x029e, 0x029e,
0x0345, 0x0345,
0x0371, 0x0371,
0x0373, 0x0373,
@@ -12722,7 +11809,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x03e9, 0x03e9,
0x03eb, 0x03eb,
0x03ed, 0x03ed,
- 0x03ef, 0x03f3,
+ 0x03ef, 0x03f2,
0x03f5, 0x03f5,
0x03f8, 0x03f8,
0x03fb, 0x03fb,
@@ -12822,10 +11909,6 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x0523, 0x0523,
0x0525, 0x0525,
0x0527, 0x0527,
- 0x0529, 0x0529,
- 0x052b, 0x052b,
- 0x052d, 0x052d,
- 0x052f, 0x052f,
0x0561, 0x0587,
0x1d79, 0x1d79,
0x1d7d, 0x1d7d,
@@ -13075,8 +12158,6 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
- 0xa699, 0xa699,
- 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -13125,11 +12206,6 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa78c, 0xa78c,
0xa791, 0xa791,
0xa793, 0xa793,
- 0xa797, 0xa797,
- 0xa799, 0xa799,
- 0xa79b, 0xa79b,
- 0xa79d, 0xa79d,
- 0xa79f, 0xa79f,
0xa7a1, 0xa7a1,
0xa7a3, 0xa7a3,
0xa7a5, 0xa7a5,
@@ -13139,12 +12215,11 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xfb13, 0xfb17,
0xff41, 0xff5a,
0x10428, 0x1044f,
- 0x118c0, 0x118df,
}; /* CR_Changes_When_Titlecased */
/* 'Changes_When_Casefolded': Derived Property */
static const OnigCodePoint CR_Changes_When_Casefolded[] = {
- 596,
+ 582,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -13295,7 +12370,6 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -13417,10 +12491,6 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0522, 0x0522,
0x0524, 0x0524,
0x0526, 0x0526,
- 0x0528, 0x0528,
- 0x052a, 0x052a,
- 0x052c, 0x052c,
- 0x052e, 0x052e,
0x0531, 0x0556,
0x0587, 0x0587,
0x10a0, 0x10c5,
@@ -13673,8 +12743,6 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
- 0xa698, 0xa698,
- 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -13724,28 +12792,21 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa78d, 0xa78d,
0xa790, 0xa790,
0xa792, 0xa792,
- 0xa796, 0xa796,
- 0xa798, 0xa798,
- 0xa79a, 0xa79a,
- 0xa79c, 0xa79c,
- 0xa79e, 0xa79e,
0xa7a0, 0xa7a0,
0xa7a2, 0xa7a2,
0xa7a4, 0xa7a4,
0xa7a6, 0xa7a6,
0xa7a8, 0xa7a8,
- 0xa7aa, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa7aa, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0x10400, 0x10427,
- 0x118a0, 0x118bf,
}; /* CR_Changes_When_Casefolded */
/* 'Changes_When_Casemapped': Derived Property */
static const OnigCodePoint CR_Changes_When_Casemapped[] = {
- 107,
+ 104,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -13763,35 +12824,34 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x023a, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025c,
- 0x0260, 0x0261,
+ 0x025b, 0x025b,
+ 0x0260, 0x0260,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026c,
+ 0x026b, 0x026b,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0287, 0x028c,
+ 0x0288, 0x028c,
0x0292, 0x0292,
- 0x029e, 0x029e,
0x0345, 0x0345,
0x0370, 0x0373,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03d1,
- 0x03d5, 0x03f5,
+ 0x03d5, 0x03f2,
+ 0x03f4, 0x03f5,
0x03f7, 0x03fb,
0x03fd, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
@@ -13839,25 +12899,23 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa69b,
+ 0xa680, 0xa697,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
0xa790, 0xa793,
- 0xa796, 0xa7ad,
- 0xa7b0, 0xa7b1,
+ 0xa7a0, 0xa7aa,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
- 0x118a0, 0x118df,
}; /* CR_Changes_When_Casemapped */
/* 'ID_Start': Derived Property */
static const OnigCodePoint CR_ID_Start[] = {
- 538,
+ 488,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -13873,14 +12931,13 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -13906,12 +12963,14 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0980,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -13966,7 +13025,8 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -14050,7 +13110,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -14064,7 +13124,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -14158,14 +13218,14 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa6a0, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -14178,15 +13238,12 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa960, 0xa97c,
0xa984, 0xa9b2,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -14200,9 +13257,6 @@ static const OnigCodePoint CR_ID_Start[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -14242,27 +13296,19 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -14272,62 +13318,25 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -14358,7 +13367,6 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -14400,7 +13408,7 @@ static const OnigCodePoint CR_ID_Start[] = {
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 626,
+ 564,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -14419,14 +13427,13 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0300, 0x0374,
0x0376, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
0x0483, 0x0487,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -14450,10 +13457,14 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0963,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -14527,11 +13538,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -14539,7 +13551,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -14553,7 +13565,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -14574,7 +13586,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -14639,7 +13650,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -14656,7 +13667,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -14670,7 +13681,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abd,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -14680,8 +13690,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -14761,14 +13770,14 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xa610, 0xa62b,
0xa640, 0xa66f,
0xa674, 0xa67d,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -14779,12 +13788,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaac2,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -14793,9 +13802,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
@@ -14818,7 +13824,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfb,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe70, 0xfe74,
@@ -14843,29 +13849,20 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102e0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -14878,78 +13875,29 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae6,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11000, 0x11046,
0x11066, 0x1106f,
- 0x1107f, 0x110ba,
+ 0x11080, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
- 0x11150, 0x11173,
- 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111d0, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x11237,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c0,
- 0x11600, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af4,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -14987,8 +13935,6 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -15031,7 +13977,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 545,
+ 495,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -15047,14 +13993,13 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0370, 0x0374,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -15080,12 +14025,14 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0980,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -15140,7 +14087,8 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -15224,7 +14172,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -15238,7 +14186,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -15332,14 +14280,14 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa6a0, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -15352,15 +14300,12 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa960, 0xa97c,
0xa984, 0xa9b2,
0xa9cf, 0xa9cf,
- 0xa9e0, 0xa9e4,
- 0xa9e6, 0xa9ef,
- 0xa9fa, 0xa9fe,
0xaa00, 0xaa28,
0xaa40, 0xaa42,
0xaa44, 0xaa4b,
0xaa60, 0xaa76,
0xaa7a, 0xaa7a,
- 0xaa7e, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -15374,9 +14319,6 @@ static const OnigCodePoint CR_XID_Start[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -15423,27 +14365,19 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -15453,62 +14387,25 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10a15, 0x10a17,
0x10a19, 0x10a33,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae4,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11003, 0x11037,
0x11083, 0x110af,
0x110d0, 0x110e8,
0x11103, 0x11126,
- 0x11150, 0x11172,
- 0x11176, 0x11176,
0x11183, 0x111b2,
0x111c1, 0x111c4,
- 0x111da, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x1122b,
- 0x112b0, 0x112de,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x1135d, 0x11361,
- 0x11480, 0x114af,
- 0x114c4, 0x114c5,
- 0x114c7, 0x114c7,
- 0x11580, 0x115ae,
- 0x11600, 0x1162f,
- 0x11644, 0x11644,
0x11680, 0x116aa,
- 0x118a0, 0x118df,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16ad0, 0x16aed,
- 0x16b00, 0x16b2f,
- 0x16b40, 0x16b43,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f50,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -15539,7 +14436,6 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
- 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -15581,7 +14477,7 @@ static const OnigCodePoint CR_XID_Start[] = {
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 633,
+ 571,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -15600,14 +14496,13 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0300, 0x0374,
0x0376, 0x0377,
0x037b, 0x037d,
- 0x037f, 0x037f,
0x0386, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x03f5,
0x03f7, 0x0481,
0x0483, 0x0487,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -15631,10 +14526,14 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0963,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0983,
+ 0x0971, 0x0977,
+ 0x0979, 0x097f,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -15708,11 +14607,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -15720,7 +14620,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -15734,7 +14634,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -15755,7 +14655,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -15820,7 +14719,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -15837,7 +14736,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -15851,7 +14750,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
- 0x1ab0, 0x1abd,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -15861,8 +14759,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
+ 0x1d00, 0x1de6,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -15943,14 +14840,14 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xa610, 0xa62b,
0xa640, 0xa66f,
0xa674, 0xa67d,
- 0xa67f, 0xa69d,
+ 0xa67f, 0xa697,
0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa827,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -15961,12 +14858,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
- 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaac2,
+ 0xaa7a, 0xaa7b,
+ 0xaa80, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -15975,9 +14872,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
@@ -16001,7 +14895,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdf9,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe71, 0xfe71,
@@ -16031,29 +14925,20 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e0, 0x102e0,
- 0x10300, 0x1031f,
+ 0x10300, 0x1031e,
0x10330, 0x1034a,
- 0x10350, 0x1037a,
0x10380, 0x1039d,
0x103a0, 0x103c3,
0x103c8, 0x103cf,
0x103d1, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10860, 0x10876,
- 0x10880, 0x1089e,
0x10900, 0x10915,
0x10920, 0x10939,
0x10980, 0x109b7,
@@ -16066,78 +14951,29 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
0x10a60, 0x10a7c,
- 0x10a80, 0x10a9c,
- 0x10ac0, 0x10ac7,
- 0x10ac9, 0x10ae6,
0x10b00, 0x10b35,
0x10b40, 0x10b55,
0x10b60, 0x10b72,
- 0x10b80, 0x10b91,
0x10c00, 0x10c48,
0x11000, 0x11046,
0x11066, 0x1106f,
- 0x1107f, 0x110ba,
+ 0x11080, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
- 0x11150, 0x11173,
- 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111d0, 0x111da,
- 0x11200, 0x11211,
- 0x11213, 0x11237,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c5,
- 0x114c7, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c0,
- 0x11600, 0x11640,
- 0x11644, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x118a0, 0x118e9,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af4,
- 0x16b00, 0x16b36,
- 0x16b40, 0x16b43,
- 0x16b50, 0x16b59,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f8f, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
@@ -16175,8 +15011,6 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -16219,13 +15053,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
/* 'Default_Ignorable_Code_Point': Derived Property */
static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
- 17,
+ 15,
0x00ad, 0x00ad,
0x034f, 0x034f,
- 0x061c, 0x061c,
0x115f, 0x1160,
0x17b4, 0x17b5,
- 0x180b, 0x180e,
+ 0x180b, 0x180d,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x206f,
@@ -16234,14 +15067,13 @@ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
0xfeff, 0xfeff,
0xffa0, 0xffa0,
0xfff0, 0xfff8,
- 0x1bca0, 0x1bca3,
0x1d173, 0x1d17a,
0xe0000, 0xe0fff,
}; /* CR_Default_Ignorable_Code_Point */
/* 'Grapheme_Extend': Derived Property */
static const OnigCodePoint CR_Grapheme_Extend[] = {
- 272,
+ 232,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -16265,7 +15097,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x0902,
+ 0x08e4, 0x08fe,
+ 0x0900, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -16305,13 +15138,11 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0bc0, 0x0bc0,
0x0bcd, 0x0bcd,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c00,
0x0c3e, 0x0c40,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c81,
0x0cbc, 0x0cbc,
0x0cbf, 0x0cbf,
0x0cc2, 0x0cc2,
@@ -16319,7 +15150,6 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0ccc, 0x0ccd,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d01,
0x0d3e, 0x0d3e,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
@@ -16375,7 +15205,6 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
- 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -16383,7 +15212,6 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1a65, 0x1a6c,
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abe,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -16393,7 +15221,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bad,
+ 0x1bab, 0x1bab,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -16405,8 +15233,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
0x20d0, 0x20f0,
@@ -16431,13 +15258,11 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xa9b3, 0xa9b3,
0xa9b6, 0xa9b9,
0xa9bc, 0xa9bc,
- 0xa9e5, 0xa9e5,
0xaa29, 0xaa2e,
0xaa31, 0xaa32,
0xaa35, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4c,
- 0xaa7c, 0xaa7c,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -16450,61 +15275,29 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xabed, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xff9e, 0xff9f,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
- 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x1107f, 0x11081,
+ 0x11080, 0x11081,
0x110b3, 0x110b6,
0x110b9, 0x110ba,
0x11100, 0x11102,
0x11127, 0x1112b,
0x1112d, 0x11134,
- 0x11173, 0x11173,
0x11180, 0x11181,
0x111b6, 0x111be,
- 0x1122f, 0x11231,
- 0x11234, 0x11234,
- 0x11236, 0x11237,
- 0x112df, 0x112df,
- 0x112e3, 0x112ea,
- 0x11301, 0x11301,
- 0x1133c, 0x1133c,
- 0x1133e, 0x1133e,
- 0x11340, 0x11340,
- 0x11357, 0x11357,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114b0, 0x114b0,
- 0x114b3, 0x114b8,
- 0x114ba, 0x114ba,
- 0x114bd, 0x114bd,
- 0x114bf, 0x114c0,
- 0x114c2, 0x114c3,
- 0x115af, 0x115af,
- 0x115b2, 0x115b5,
- 0x115bc, 0x115bd,
- 0x115bf, 0x115c0,
- 0x11633, 0x1163a,
- 0x1163d, 0x1163d,
- 0x1163f, 0x11640,
0x116ab, 0x116ab,
0x116ad, 0x116ad,
0x116b0, 0x116b5,
0x116b7, 0x116b7,
- 0x16af0, 0x16af4,
- 0x16b30, 0x16b36,
0x16f8f, 0x16f92,
- 0x1bc9d, 0x1bc9e,
0x1d165, 0x1d165,
0x1d167, 0x1d169,
0x1d16e, 0x1d172,
@@ -16512,28 +15305,27 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
0x1d242, 0x1d244,
- 0x1e8d0, 0x1e8d6,
0xe0100, 0xe01ef,
}; /* CR_Grapheme_Extend */
/* 'Grapheme_Base': Derived Property */
static const OnigCodePoint CR_Grapheme_Base[] = {
- 724,
+ 643,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
0x0370, 0x0377,
- 0x037a, 0x037f,
+ 0x037a, 0x037e,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x0482,
- 0x048a, 0x052f,
+ 0x048a, 0x0527,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -16562,14 +15354,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
- 0x08a0, 0x08b2,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
0x0949, 0x094c,
0x094e, 0x0950,
0x0958, 0x0961,
- 0x0964, 0x0980,
+ 0x0964, 0x0977,
+ 0x0979, 0x097f,
0x0982, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
@@ -16645,7 +15439,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c3d,
0x0c41, 0x0c44,
0x0c58, 0x0c59,
@@ -16687,7 +15482,6 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0dc0, 0x0dc6,
0x0dd0, 0x0dd1,
0x0dd8, 0x0dde,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e30,
0x0e32, 0x0e33,
@@ -16757,7 +15551,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1380, 0x1399,
0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f8,
+ 0x16a0, 0x16f0,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -16773,12 +15567,13 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x17e0, 0x17e9,
0x17f0, 0x17f9,
0x1800, 0x180a,
+ 0x180e, 0x180e,
0x1810, 0x1819,
0x1820, 0x1877,
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1923, 0x1926,
0x1929, 0x192b,
0x1930, 0x1931,
@@ -16790,7 +15585,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x19b0, 0x19c9,
0x19d0, 0x19da,
0x19de, 0x1a16,
- 0x1a19, 0x1a1a,
+ 0x1a19, 0x1a1b,
0x1a1e, 0x1a55,
0x1a57, 0x1a57,
0x1a61, 0x1a61,
@@ -16809,7 +15604,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bae, 0x1be5,
+ 0x1bac, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -16847,16 +15642,14 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2070, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0x2100, 0x2189,
- 0x2190, 0x23fa,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
+ 0x2460, 0x26ff,
+ 0x2701, 0x2b4c,
+ 0x2b50, 0x2b59,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
@@ -16875,7 +15668,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e42,
+ 0x2e00, 0x2e3b,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -16897,13 +15690,13 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa4d0, 0xa62b,
0xa640, 0xa66e,
0xa673, 0xa673,
- 0xa67e, 0xa69d,
+ 0xa67e, 0xa697,
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa801,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -16922,8 +15715,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa9ba, 0xa9bb,
0xa9bd, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9e4,
- 0xa9e6, 0xa9fe,
+ 0xa9de, 0xa9df,
0xaa00, 0xaa28,
0xaa2f, 0xaa30,
0xaa33, 0xaa34,
@@ -16932,7 +15724,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaa4d, 0xaa4d,
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
- 0xaa7d, 0xaaaf,
+ 0xaa80, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -16945,8 +15737,6 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
- 0xab30, 0xab5f,
- 0xab64, 0xab65,
0xabc0, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabec,
@@ -16993,35 +15783,26 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018c,
+ 0x10137, 0x1018a,
0x10190, 0x1019b,
- 0x101a0, 0x101a0,
0x101d0, 0x101fc,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x102e1, 0x102fb,
- 0x10300, 0x10323,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
0x10330, 0x1034a,
- 0x10350, 0x10375,
0x10380, 0x1039d,
0x1039f, 0x103c3,
0x103c8, 0x103d5,
0x10400, 0x1049d,
0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
0x10800, 0x10805,
0x10808, 0x10808,
0x1080a, 0x10835,
0x10837, 0x10838,
0x1083c, 0x1083c,
0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
+ 0x10857, 0x1085f,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -17033,15 +15814,11 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10a19, 0x10a33,
0x10a40, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae4,
- 0x10aeb, 0x10af6,
+ 0x10a60, 0x10a7f,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
+ 0x10b78, 0x10b7f,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x11000,
@@ -17057,86 +15834,23 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x11103, 0x11126,
0x1112c, 0x1112c,
0x11136, 0x11143,
- 0x11150, 0x11172,
- 0x11174, 0x11176,
0x11182, 0x111b5,
0x111bf, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1122e,
- 0x11232, 0x11233,
- 0x11235, 0x11235,
- 0x11238, 0x1123d,
- 0x112b0, 0x112de,
- 0x112e0, 0x112e2,
- 0x112f0, 0x112f9,
- 0x11302, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133d, 0x1133d,
- 0x1133f, 0x1133f,
- 0x11341, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x1135d, 0x11363,
- 0x11480, 0x114af,
- 0x114b1, 0x114b2,
- 0x114b9, 0x114b9,
- 0x114bb, 0x114bc,
- 0x114be, 0x114be,
- 0x114c1, 0x114c1,
- 0x114c4, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115ae,
- 0x115b0, 0x115b1,
- 0x115b8, 0x115bb,
- 0x115be, 0x115be,
- 0x115c1, 0x115c9,
- 0x11600, 0x11632,
- 0x1163b, 0x1163c,
- 0x1163e, 0x1163e,
- 0x11641, 0x11644,
- 0x11650, 0x11659,
+ 0x111d0, 0x111d9,
0x11680, 0x116aa,
0x116ac, 0x116ac,
0x116ae, 0x116af,
0x116b6, 0x116b6,
0x116c0, 0x116c9,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
0x13000, 0x1342e,
0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af5, 0x16af5,
- 0x16b00, 0x16b2f,
- 0x16b37, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
0x16f00, 0x16f44,
0x16f50, 0x16f7e,
0x16f93, 0x16f9f,
0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bc9c,
- 0x1bc9f, 0x1bc9f,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
@@ -17170,8 +15884,6 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8cf,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -17209,10 +15921,10 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -17220,25 +15932,24 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -17247,7 +15958,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 40,
+ 33,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -17277,22 +15988,15 @@ static const OnigCodePoint CR_Grapheme_Link[] = {
0xabed, 0xabed,
0x10a3f, 0x10a3f,
0x11046, 0x11046,
- 0x1107f, 0x1107f,
0x110b9, 0x110b9,
0x11133, 0x11134,
0x111c0, 0x111c0,
- 0x11235, 0x11235,
- 0x112ea, 0x112ea,
- 0x1134d, 0x1134d,
- 0x114c2, 0x114c2,
- 0x115bf, 0x115bf,
- 0x1163f, 0x1163f,
0x116b6, 0x116b6,
}; /* CR_Grapheme_Link */
/* 'Common': Script */
static const OnigCodePoint CR_Common[] = {
- 165,
+ 157,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -17308,9 +16012,8 @@ static const OnigCodePoint CR_Common[] = {
0x0385, 0x0385,
0x0387, 0x0387,
0x0589, 0x0589,
- 0x0605, 0x0605,
0x060c, 0x060c,
- 0x061b, 0x061c,
+ 0x061b, 0x061b,
0x061f, 0x061f,
0x0640, 0x0640,
0x0660, 0x0669,
@@ -17330,26 +16033,24 @@ static const OnigCodePoint CR_Common[] = {
0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
- 0x2066, 0x2070,
+ 0x206a, 0x2070,
0x2074, 0x207e,
0x2080, 0x208e,
- 0x20a0, 0x20bd,
+ 0x20a0, 0x20b9,
0x2100, 0x2125,
0x2127, 0x2129,
0x212c, 0x2131,
0x2133, 0x214d,
0x214f, 0x215f,
0x2189, 0x2189,
- 0x2190, 0x23fa,
+ 0x2190, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x27ff,
- 0x2900, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2e00, 0x2e42,
+ 0x2460, 0x26ff,
+ 0x2701, 0x27ff,
+ 0x2900, 0x2b4c,
+ 0x2b50, 0x2b59,
+ 0x2e00, 0x2e3b,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -17368,10 +16069,8 @@ static const OnigCodePoint CR_Common[] = {
0xa700, 0xa721,
0xa788, 0xa78a,
0xa830, 0xa839,
- 0xa92e, 0xa92e,
- 0xa9cf, 0xa9cf,
- 0xab5b, 0xab5b,
0xfd3e, 0xfd3f,
+ 0xfdfd, 0xfdfd,
0xfe10, 0xfe19,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
@@ -17390,8 +16089,6 @@ static const OnigCodePoint CR_Common[] = {
0x10137, 0x1013f,
0x10190, 0x1019b,
0x101d0, 0x101fc,
- 0x102e1, 0x102fb,
- 0x1bca0, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d166,
@@ -17425,10 +16122,10 @@ static const OnigCodePoint CR_Common[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
+ 0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
+ 0x1f0d1, 0x1f0df,
+ 0x1f100, 0x1f10a,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -17437,32 +16134,31 @@ static const OnigCodePoint CR_Common[] = {
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
+ 0x1f300, 0x1f320,
+ 0x1f330, 0x1f335,
+ 0x1f337, 0x1f37c,
+ 0x1f380, 0x1f393,
+ 0x1f3a0, 0x1f3c4,
+ 0x1f3c6, 0x1f3ca,
+ 0x1f3e0, 0x1f3f0,
+ 0x1f400, 0x1f43e,
+ 0x1f440, 0x1f440,
+ 0x1f442, 0x1f4f7,
+ 0x1f4f9, 0x1f4fc,
+ 0x1f500, 0x1f53d,
+ 0x1f540, 0x1f543,
+ 0x1f550, 0x1f567,
+ 0x1f5fb, 0x1f640,
+ 0x1f645, 0x1f64f,
+ 0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
}; /* CR_Common */
/* 'Latin': Script */
static const OnigCodePoint CR_Latin[] = {
- 33,
+ 30,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -17487,12 +16183,9 @@ static const OnigCodePoint CR_Latin[] = {
0x2c60, 0x2c7f,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa7ff,
- 0xab30, 0xab5a,
- 0xab5c, 0xab5f,
- 0xab64, 0xab64,
+ 0xa790, 0xa793,
+ 0xa7a0, 0xa7aa,
+ 0xa7f8, 0xa7ff,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -17500,11 +16193,10 @@ static const OnigCodePoint CR_Latin[] = {
/* 'Greek': Script */
static const OnigCodePoint CR_Greek[] = {
- 36,
+ 33,
0x0370, 0x0373,
0x0375, 0x0377,
0x037a, 0x037d,
- 0x037f, 0x037f,
0x0384, 0x0384,
0x0386, 0x0386,
0x0388, 0x038a,
@@ -17533,9 +16225,7 @@ static const OnigCodePoint CR_Greek[] = {
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
0x2126, 0x2126,
- 0xab65, 0xab65,
- 0x10140, 0x1018c,
- 0x101a0, 0x101a0,
+ 0x10140, 0x1018a,
0x1d200, 0x1d245,
}; /* CR_Greek */
@@ -17543,11 +16233,11 @@ static const OnigCodePoint CR_Greek[] = {
static const OnigCodePoint CR_Cyrillic[] = {
7,
0x0400, 0x0484,
- 0x0487, 0x052f,
+ 0x0487, 0x0527,
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa69d,
+ 0xa640, 0xa697,
0xa69f, 0xa69f,
}; /* CR_Cyrillic */
@@ -17558,7 +16248,7 @@ static const OnigCodePoint CR_Armenian[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
- 0x058d, 0x058f,
+ 0x058f, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -17578,25 +16268,26 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 55,
+ 56,
0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
0x0620, 0x063f,
0x0641, 0x064a,
- 0x0656, 0x065f,
+ 0x0656, 0x065e,
0x066a, 0x066f,
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
- 0x08a0, 0x08b2,
- 0x08e4, 0x08ff,
+ 0x08a0, 0x08a0,
+ 0x08a2, 0x08ac,
+ 0x08e4, 0x08fe,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfd,
+ 0xfdf0, 0xfdfc,
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
@@ -17652,17 +16343,18 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 4,
+ 5,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x097f,
+ 0x0966, 0x0977,
+ 0x0979, 0x097f,
0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
/* 'Bengali': Script */
static const OnigCodePoint CR_Bengali[] = {
14,
- 0x0980, 0x0983,
+ 0x0981, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -17759,12 +16451,13 @@ static const OnigCodePoint CR_Tamil[] = {
/* 'Telugu': Script */
static const OnigCodePoint CR_Telugu[] = {
- 13,
- 0x0c00, 0x0c03,
+ 14,
+ 0x0c01, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
+ 0x0c2a, 0x0c33,
+ 0x0c35, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -17778,7 +16471,7 @@ static const OnigCodePoint CR_Telugu[] = {
/* 'Kannada': Script */
static const OnigCodePoint CR_Kannada[] = {
14,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -17797,7 +16490,7 @@ static const OnigCodePoint CR_Kannada[] = {
/* 'Malayalam': Script */
static const OnigCodePoint CR_Malayalam[] = {
11,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -17812,7 +16505,7 @@ static const OnigCodePoint CR_Malayalam[] = {
/* 'Sinhala': Script */
static const OnigCodePoint CR_Sinhala[] = {
- 13,
+ 11,
0x0d82, 0x0d83,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -17823,9 +16516,7 @@ static const OnigCodePoint CR_Sinhala[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
0x0df2, 0x0df4,
- 0x111e1, 0x111f4,
}; /* CR_Sinhala */
/* 'Thai': Script */
@@ -17872,10 +16563,9 @@ static const OnigCodePoint CR_Tibetan[] = {
/* 'Myanmar': Script */
static const OnigCodePoint CR_Myanmar[] = {
- 3,
+ 2,
0x1000, 0x109f,
- 0xa9e0, 0xa9fe,
- 0xaa60, 0xaa7f,
+ 0xaa60, 0xaa7b,
}; /* CR_Myanmar */
/* 'Georgian': Script */
@@ -17970,7 +16660,7 @@ static const OnigCodePoint CR_Ogham[] = {
static const OnigCodePoint CR_Runic[] = {
2,
0x16a0, 0x16ea,
- 0x16ee, 0x16f8,
+ 0x16ee, 0x16f0,
}; /* CR_Runic */
/* 'Khmer': Script */
@@ -18052,8 +16742,9 @@ static const OnigCodePoint CR_Yi[] = {
/* 'Old_Italic': Script */
static const OnigCodePoint CR_Old_Italic[] = {
- 1,
- 0x10300, 0x10323,
+ 2,
+ 0x10300, 0x1031e,
+ 0x10320, 0x10323,
}; /* CR_Old_Italic */
/* 'Gothic': Script */
@@ -18070,29 +16761,27 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 27,
+ 25,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
+ 0x065f, 0x065f,
0x0670, 0x0670,
0x0951, 0x0952,
- 0x1ab0, 0x1abe,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
- 0x1dc0, 0x1df5,
+ 0x1dc0, 0x1de6,
0x1dfc, 0x1dff,
0x200c, 0x200d,
0x20d0, 0x20f0,
0x302a, 0x302d,
0x3099, 0x309a,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0x101fd, 0x101fd,
- 0x102e0, 0x102e0,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -18130,7 +16819,7 @@ static const OnigCodePoint CR_Tagbanwa[] = {
/* 'Limbu': Script */
static const OnigCodePoint CR_Limbu[] = {
5,
- 0x1900, 0x191e,
+ 0x1900, 0x191c,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -18268,9 +16957,9 @@ static const OnigCodePoint CR_Balinese[] = {
/* 'Cuneiform': Script */
static const OnigCodePoint CR_Cuneiform[] = {
3,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
+ 0x12000, 0x1236e,
+ 0x12400, 0x12462,
+ 0x12470, 0x12473,
}; /* CR_Cuneiform */
/* 'Phoenician': Script */
@@ -18328,9 +17017,8 @@ static const OnigCodePoint CR_Saurashtra[] = {
/* 'Kayah_Li': Script */
static const OnigCodePoint CR_Kayah_Li[] = {
- 2,
- 0xa900, 0xa92d,
- 0xa92f, 0xa92f,
+ 1,
+ 0xa900, 0xa92f,
}; /* CR_Kayah_Li */
/* 'Rejang': Script */
@@ -18422,7 +17110,7 @@ static const OnigCodePoint CR_Bamum[] = {
static const OnigCodePoint CR_Javanese[] = {
3,
0xa980, 0xa9cd,
- 0xa9d0, 0xa9d9,
+ 0xa9cf, 0xa9d9,
0xa9de, 0xa9df,
}; /* CR_Javanese */
@@ -18482,10 +17170,9 @@ static const OnigCodePoint CR_Batak[] = {
/* 'Brahmi': Script */
static const OnigCodePoint CR_Brahmi[] = {
- 3,
+ 2,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x1107f, 0x1107f,
}; /* CR_Brahmi */
/* 'Mandaic': Script */
@@ -18525,10 +17212,9 @@ static const OnigCodePoint CR_Miao[] = {
/* 'Sharada': Script */
static const OnigCodePoint CR_Sharada[] = {
- 3,
+ 2,
0x11180, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
+ 0x111d0, 0x111d9,
}; /* CR_Sharada */
/* 'Sora_Sompeng': Script */
@@ -18545,192 +17231,14 @@ static const OnigCodePoint CR_Takri[] = {
0x116c0, 0x116c9,
}; /* CR_Takri */
-/* 'Caucasian_Albanian': Script */
-static const OnigCodePoint CR_Caucasian_Albanian[] = {
- 2,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
-}; /* CR_Caucasian_Albanian */
-
-/* 'Bassa_Vah': Script */
-static const OnigCodePoint CR_Bassa_Vah[] = {
- 2,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
-}; /* CR_Bassa_Vah */
-
-/* 'Duployan': Script */
-static const OnigCodePoint CR_Duployan[] = {
- 5,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bc9f,
-}; /* CR_Duployan */
-
-/* 'Elbasan': Script */
-static const OnigCodePoint CR_Elbasan[] = {
- 1,
- 0x10500, 0x10527,
-}; /* CR_Elbasan */
-
-/* 'Grantha': Script */
-static const OnigCodePoint CR_Grantha[] = {
- 14,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
-}; /* CR_Grantha */
-
-/* 'Pahawh_Hmong': Script */
-static const OnigCodePoint CR_Pahawh_Hmong[] = {
- 5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
-}; /* CR_Pahawh_Hmong */
-
-/* 'Khojki': Script */
-static const OnigCodePoint CR_Khojki[] = {
- 2,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
-}; /* CR_Khojki */
-
-/* 'Linear_A': Script */
-static const OnigCodePoint CR_Linear_A[] = {
- 3,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
-}; /* CR_Linear_A */
-
-/* 'Mahajani': Script */
-static const OnigCodePoint CR_Mahajani[] = {
- 1,
- 0x11150, 0x11176,
-}; /* CR_Mahajani */
-
-/* 'Manichaean': Script */
-static const OnigCodePoint CR_Manichaean[] = {
- 2,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
-}; /* CR_Manichaean */
-
-/* 'Mende_Kikakui': Script */
-static const OnigCodePoint CR_Mende_Kikakui[] = {
- 2,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
-}; /* CR_Mende_Kikakui */
-
-/* 'Modi': Script */
-static const OnigCodePoint CR_Modi[] = {
- 2,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
-}; /* CR_Modi */
-
-/* 'Mro': Script */
-static const OnigCodePoint CR_Mro[] = {
- 3,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
-}; /* CR_Mro */
-
-/* 'Old_North_Arabian': Script */
-static const OnigCodePoint CR_Old_North_Arabian[] = {
- 1,
- 0x10a80, 0x10a9f,
-}; /* CR_Old_North_Arabian */
-
-/* 'Nabataean': Script */
-static const OnigCodePoint CR_Nabataean[] = {
- 2,
- 0x10880, 0x1089e,
- 0x108a7, 0x108af,
-}; /* CR_Nabataean */
-
-/* 'Palmyrene': Script */
-static const OnigCodePoint CR_Palmyrene[] = {
- 1,
- 0x10860, 0x1087f,
-}; /* CR_Palmyrene */
-
-/* 'Pau_Cin_Hau': Script */
-static const OnigCodePoint CR_Pau_Cin_Hau[] = {
- 1,
- 0x11ac0, 0x11af8,
-}; /* CR_Pau_Cin_Hau */
-
-/* 'Old_Permic': Script */
-static const OnigCodePoint CR_Old_Permic[] = {
- 1,
- 0x10350, 0x1037a,
-}; /* CR_Old_Permic */
-
-/* 'Psalter_Pahlavi': Script */
-static const OnigCodePoint CR_Psalter_Pahlavi[] = {
- 3,
- 0x10b80, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
-}; /* CR_Psalter_Pahlavi */
-
-/* 'Siddham': Script */
-static const OnigCodePoint CR_Siddham[] = {
- 2,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c9,
-}; /* CR_Siddham */
-
-/* 'Khudawadi': Script */
-static const OnigCodePoint CR_Khudawadi[] = {
- 2,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
-}; /* CR_Khudawadi */
-
-/* 'Tirhuta': Script */
-static const OnigCodePoint CR_Tirhuta[] = {
- 2,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
-}; /* CR_Tirhuta */
-
-/* 'Warang_Citi': Script */
-static const OnigCodePoint CR_Warang_Citi[] = {
- 2,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
-}; /* CR_Warang_Citi */
-
/* 'White_Space': Binary Property */
#define CR_White_Space CR_Space
/* 'Bidi_Control': Binary Property */
static const OnigCodePoint CR_Bidi_Control[] = {
- 4,
- 0x061c, 0x061c,
+ 2,
0x200e, 0x200f,
0x202a, 0x202e,
- 0x2066, 0x2069,
}; /* CR_Bidi_Control */
/* 'Join_Control': Binary Property */
@@ -18741,7 +17249,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 21,
+ 20,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -18755,7 +17263,6 @@ static const OnigCodePoint CR_Dash[] = {
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
0x2e3a, 0x2e3b,
- 0x2e40, 0x2e40,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -18782,14 +17289,13 @@ static const OnigCodePoint CR_Hyphen[] = {
/* 'Quotation_Mark': Binary Property */
static const OnigCodePoint CR_Quotation_Mark[] = {
- 13,
+ 12,
0x0022, 0x0022,
0x0027, 0x0027,
0x00ab, 0x00ab,
0x00bb, 0x00bb,
0x2018, 0x201f,
0x2039, 0x203a,
- 0x2e42, 0x2e42,
0x300c, 0x300f,
0x301d, 0x301f,
0xfe41, 0xfe44,
@@ -18800,7 +17306,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 86,
+ 70,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -18827,7 +17333,6 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x1361, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
- 0x1735, 0x1736,
0x17d4, 0x17d6,
0x17da, 0x17da,
0x1802, 0x1805,
@@ -18841,8 +17346,6 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x203c, 0x203d,
0x2047, 0x2049,
0x2e2e, 0x2e2e,
- 0x2e3c, 0x2e3c,
- 0x2e41, 0x2e41,
0x3001, 0x3002,
0xa4fe, 0xa4ff,
0xa60d, 0xa60f,
@@ -18868,30 +17371,17 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x103d0, 0x103d0,
0x10857, 0x10857,
0x1091f, 0x1091f,
- 0x10a56, 0x10a57,
- 0x10af0, 0x10af5,
0x10b3a, 0x10b3f,
- 0x10b99, 0x10b9c,
0x11047, 0x1104d,
0x110be, 0x110c1,
0x11141, 0x11143,
0x111c5, 0x111c6,
- 0x111cd, 0x111cd,
- 0x11238, 0x1123c,
- 0x115c2, 0x115c5,
- 0x115c9, 0x115c9,
- 0x11641, 0x11642,
- 0x12470, 0x12474,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b39,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
+ 0x12470, 0x12473,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 134,
+ 133,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -18933,7 +17423,6 @@ static const OnigCodePoint CR_Other_Math[] = {
0x21d5, 0x21db,
0x21dd, 0x21dd,
0x21e4, 0x21e5,
- 0x2308, 0x230b,
0x23b4, 0x23b5,
0x23b7, 0x23b7,
0x23d0, 0x23d0,
@@ -19044,7 +17533,7 @@ static const OnigCodePoint CR_Hex_Digit[] = {
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 178,
+ 158,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -19067,7 +17556,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x0825, 0x0827,
0x0829, 0x082c,
0x08e4, 0x08e9,
- 0x08f0, 0x0903,
+ 0x08f0, 0x08fe,
+ 0x0900, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
0x094e, 0x094f,
@@ -19102,19 +17592,19 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x0bc6, 0x0bc8,
0x0bca, 0x0bcc,
0x0bd7, 0x0bd7,
- 0x0c00, 0x0c03,
+ 0x0c01, 0x0c03,
0x0c3e, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c81, 0x0c83,
+ 0x0c82, 0x0c83,
0x0cbe, 0x0cc4,
0x0cc6, 0x0cc8,
0x0cca, 0x0ccc,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d01, 0x0d03,
+ 0x0d02, 0x0d03,
0x0d3e, 0x0d44,
0x0d46, 0x0d48,
0x0d4a, 0x0d4c,
@@ -19167,7 +17657,6 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
0x1cf2, 0x1cf3,
- 0x1de7, 0x1df4,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
0xa674, 0xa67b,
@@ -19190,7 +17679,6 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
- 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
@@ -19202,27 +17690,8 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x11127, 0x11132,
0x11180, 0x11182,
0x111b3, 0x111bf,
- 0x1122c, 0x11234,
- 0x11237, 0x11237,
- 0x112df, 0x112e8,
- 0x11301, 0x11303,
- 0x1133e, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134c,
- 0x11357, 0x11357,
- 0x11362, 0x11363,
- 0x114b0, 0x114c1,
- 0x115af, 0x115b5,
- 0x115b8, 0x115be,
- 0x11630, 0x1163e,
- 0x11640, 0x11640,
0x116ab, 0x116b5,
- 0x16b30, 0x16b36,
0x16f51, 0x16f7e,
- 0x1bc9e, 0x1bc9e,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Other_Alphabetic */
/* 'Ideographic': Binary Property */
@@ -19243,7 +17712,7 @@ static const OnigCodePoint CR_Ideographic[] = {
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 145,
+ 125,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -19312,7 +17781,6 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1939, 0x193b,
0x1a75, 0x1a7c,
0x1a7f, 0x1a7f,
- 0x1ab0, 0x1abd,
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
@@ -19322,10 +17790,8 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1cd0, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1cf8, 0x1cf9,
0x1d2c, 0x1d6a,
0x1dc4, 0x1dcf,
- 0x1df5, 0x1df5,
0x1dfd, 0x1dff,
0x1fbd, 0x1fbd,
0x1fbf, 0x1fc1,
@@ -19341,7 +17807,6 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa66f, 0xa66f,
0xa67c, 0xa67d,
0xa67f, 0xa67f,
- 0xa69c, 0xa69d,
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
@@ -19352,48 +17817,32 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa953, 0xa953,
0xa9b3, 0xa9b3,
0xa9c0, 0xa9c0,
- 0xa9e5, 0xa9e5,
- 0xaa7b, 0xaa7d,
+ 0xaa7b, 0xaa7b,
0xaabf, 0xaac2,
0xaaf6, 0xaaf6,
- 0xab5b, 0xab5f,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
- 0xfe20, 0xfe2d,
+ 0xfe20, 0xfe26,
0xff3e, 0xff3e,
0xff40, 0xff40,
0xff70, 0xff70,
0xff9e, 0xff9f,
0xffe3, 0xffe3,
- 0x102e0, 0x102e0,
- 0x10ae5, 0x10ae6,
0x110b9, 0x110ba,
0x11133, 0x11134,
- 0x11173, 0x11173,
0x111c0, 0x111c0,
- 0x11235, 0x11236,
- 0x112e9, 0x112ea,
- 0x1133c, 0x1133c,
- 0x1134d, 0x1134d,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x114c2, 0x114c3,
- 0x115bf, 0x115c0,
- 0x1163f, 0x1163f,
0x116b6, 0x116b7,
- 0x16af0, 0x16af4,
0x16f8f, 0x16f9f,
0x1d167, 0x1d169,
0x1d16d, 0x1d172,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
0x1d1aa, 0x1d1ad,
- 0x1e8d0, 0x1e8d6,
}; /* CR_Diacritic */
/* 'Extender': Binary Property */
static const OnigCodePoint CR_Extender[] = {
- 26,
+ 22,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
@@ -19412,19 +17861,15 @@ static const OnigCodePoint CR_Extender[] = {
0xa015, 0xa015,
0xa60c, 0xa60c,
0xa9cf, 0xa9cf,
- 0xa9e6, 0xa9e6,
0xaa70, 0xaa70,
0xaadd, 0xaadd,
0xaaf3, 0xaaf4,
0xff70, 0xff70,
- 0x1135d, 0x1135d,
- 0x115c6, 0x115c8,
- 0x16b42, 0x16b43,
}; /* CR_Extender */
/* 'Other_Lowercase': Binary Property */
static const OnigCodePoint CR_Other_Lowercase[] = {
- 20,
+ 18,
0x00aa, 0x00aa,
0x00ba, 0x00ba,
0x02b0, 0x02b8,
@@ -19441,20 +17886,15 @@ static const OnigCodePoint CR_Other_Lowercase[] = {
0x2170, 0x217f,
0x24d0, 0x24e9,
0x2c7c, 0x2c7d,
- 0xa69c, 0xa69d,
0xa770, 0xa770,
0xa7f8, 0xa7f9,
- 0xab5c, 0xab5f,
}; /* CR_Other_Lowercase */
/* 'Other_Uppercase': Binary Property */
static const OnigCodePoint CR_Other_Uppercase[] = {
- 5,
+ 2,
0x2160, 0x216f,
0x24b6, 0x24cf,
- 0x1f130, 0x1f149,
- 0x1f150, 0x1f169,
- 0x1f170, 0x1f189,
}; /* CR_Other_Uppercase */
/* 'Noncharacter_Code_Point': Binary Property */
@@ -19482,7 +17922,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 22,
+ 17,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -19498,11 +17938,6 @@ static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
0x200c, 0x200d,
0x302e, 0x302f,
0xff9e, 0xff9f,
- 0x1133e, 0x1133e,
- 0x11357, 0x11357,
- 0x114b0, 0x114b0,
- 0x114bd, 0x114bd,
- 0x115af, 0x115af,
0x1d165, 0x1d165,
0x1d16e, 0x1d172,
}; /* CR_Other_Grapheme_Extend */
@@ -19551,7 +17986,7 @@ static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
0x034f, 0x034f,
0x115f, 0x1160,
0x17b4, 0x17b5,
- 0x2065, 0x2065,
+ 0x2065, 0x2069,
0x3164, 0x3164,
0xffa0, 0xffa0,
0xfff0, 0xfff8,
@@ -19640,10 +18075,12 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 60,
+ 50,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
+ 0x055c, 0x055c,
+ 0x055e, 0x055e,
0x0589, 0x0589,
0x061f, 0x061f,
0x06d4, 0x06d4,
@@ -19666,7 +18103,6 @@ static const OnigCodePoint CR_STerm[] = {
0x203c, 0x203d,
0x2047, 0x2049,
0x2e2e, 0x2e2e,
- 0x2e3c, 0x2e3c,
0x3002, 0x3002,
0xa4ff, 0xa4ff,
0xa60e, 0xa60f,
@@ -19690,17 +18126,6 @@ static const OnigCodePoint CR_STerm[] = {
0x110be, 0x110c1,
0x11141, 0x11143,
0x111c5, 0x111c6,
- 0x111cd, 0x111cd,
- 0x11238, 0x11239,
- 0x1123b, 0x1123c,
- 0x115c2, 0x115c3,
- 0x115c9, 0x115c9,
- 0x11641, 0x11642,
- 0x16a6e, 0x16a6f,
- 0x16af5, 0x16af5,
- 0x16b37, 0x16b38,
- 0x16b44, 0x16b44,
- 0x1bc9f, 0x1bc9f,
}; /* CR_STerm */
/* 'Variation_Selector': Binary Property */
@@ -19756,22 +18181,23 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 598,
+ 537,
0x0378, 0x0379,
- 0x0380, 0x0383,
+ 0x037f, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0530, 0x0530,
+ 0x0528, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058c,
+ 0x058b, 0x058e,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x061d, 0x061d,
+ 0x0605, 0x0605,
+ 0x061c, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
0x07b2, 0x07bf,
@@ -19780,7 +18206,11 @@ static const OnigCodePoint CR_Unknown[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08b3, 0x08e3,
+ 0x08a1, 0x08a1,
+ 0x08ad, 0x08e3,
+ 0x08ff, 0x08ff,
+ 0x0978, 0x0978,
+ 0x0980, 0x0980,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -19853,11 +18283,12 @@ static const OnigCodePoint CR_Unknown[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0bff,
+ 0x0bfb, 0x0c00,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
+ 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
@@ -19866,7 +18297,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c80,
+ 0x0c80, 0x0c81,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -19880,7 +18311,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d00,
+ 0x0cf3, 0x0d01,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -19901,8 +18332,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0de5,
- 0x0df0, 0x0df1,
+ 0x0de0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -19953,7 +18383,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x139a, 0x139f,
0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f9, 0x16ff,
+ 0x16f1, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -19969,7 +18399,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191f, 0x191f,
+ 0x191d, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -19983,8 +18413,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aaf,
- 0x1abf, 0x1aff,
+ 0x1aae, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -19992,9 +18421,8 @@ static const OnigCodePoint CR_Unknown[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cf7,
- 0x1cfa, 0x1cff,
- 0x1df6, 0x1dfb,
+ 0x1cf7, 0x1cff,
+ 0x1de7, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -20011,21 +18439,19 @@ static const OnigCodePoint CR_Unknown[] = {
0x1ff0, 0x1ff1,
0x1ff5, 0x1ff5,
0x1fff, 0x1fff,
- 0x2065, 0x2065,
+ 0x2065, 0x2069,
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20be, 0x20cf,
+ 0x20ba, 0x20cf,
0x20f1, 0x20ff,
0x218a, 0x218f,
- 0x23fb, 0x23ff,
+ 0x23f4, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2b74, 0x2b75,
- 0x2b96, 0x2b97,
- 0x2bba, 0x2bbc,
- 0x2bc9, 0x2bc9,
- 0x2bd2, 0x2bff,
+ 0x2700, 0x2700,
+ 0x2b4d, 0x2b4f,
+ 0x2b5a, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -20043,7 +18469,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e43, 0x2e7f,
+ 0x2e3c, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -20062,11 +18488,11 @@ static const OnigCodePoint CR_Unknown[] = {
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa69e, 0xa69e,
+ 0xa698, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa7ae, 0xa7af,
- 0xa7b2, 0xa7f6,
+ 0xa794, 0xa79f,
+ 0xa7ab, 0xa7f7,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -20077,19 +18503,18 @@ static const OnigCodePoint CR_Unknown[] = {
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9ff, 0xa9ff,
+ 0xa9e0, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
+ 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xab2f,
- 0xab60, 0xab63,
- 0xab66, 0xabbf,
+ 0xab2f, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -20110,7 +18535,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
- 0xfe2e, 0xfe2f,
+ 0xfe27, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -20134,35 +18559,26 @@ static const OnigCodePoint CR_Unknown[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018d, 0x1018f,
- 0x1019c, 0x1019f,
- 0x101a1, 0x101cf,
+ 0x1018b, 0x1018f,
+ 0x1019c, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102df,
- 0x102fc, 0x102ff,
+ 0x102d1, 0x102ff,
+ 0x1031f, 0x1031f,
0x10324, 0x1032f,
- 0x1034b, 0x1034f,
- 0x1037b, 0x1037f,
+ 0x1034b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x104ff,
- 0x10528, 0x1052f,
- 0x10564, 0x1056e,
- 0x10570, 0x105ff,
- 0x10737, 0x1073f,
- 0x10756, 0x1075f,
- 0x10768, 0x107ff,
+ 0x104aa, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x1089f, 0x108a6,
- 0x108b0, 0x108ff,
+ 0x10860, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
@@ -20176,82 +18592,33 @@ static const OnigCodePoint CR_Unknown[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10aa0, 0x10abf,
- 0x10ae7, 0x10aea,
- 0x10af7, 0x10aff,
+ 0x10a80, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b92, 0x10b98,
- 0x10b9d, 0x10ba8,
- 0x10bb0, 0x10bff,
+ 0x10b80, 0x10bff,
0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107e,
+ 0x11070, 0x1107f,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1114f,
- 0x11177, 0x1117f,
- 0x111c9, 0x111cc,
- 0x111ce, 0x111cf,
- 0x111db, 0x111e0,
- 0x111f5, 0x111ff,
- 0x11212, 0x11212,
- 0x1123e, 0x112af,
- 0x112eb, 0x112ef,
- 0x112fa, 0x11300,
- 0x11304, 0x11304,
- 0x1130d, 0x1130e,
- 0x11311, 0x11312,
- 0x11329, 0x11329,
- 0x11331, 0x11331,
- 0x11334, 0x11334,
- 0x1133a, 0x1133b,
- 0x11345, 0x11346,
- 0x11349, 0x1134a,
- 0x1134e, 0x11356,
- 0x11358, 0x1135c,
- 0x11364, 0x11365,
- 0x1136d, 0x1136f,
- 0x11375, 0x1147f,
- 0x114c8, 0x114cf,
- 0x114da, 0x1157f,
- 0x115b6, 0x115b7,
- 0x115ca, 0x115ff,
- 0x11645, 0x1164f,
- 0x1165a, 0x1167f,
+ 0x11144, 0x1117f,
+ 0x111c9, 0x111cf,
+ 0x111da, 0x1167f,
0x116b8, 0x116bf,
- 0x116ca, 0x1189f,
- 0x118f3, 0x118fe,
- 0x11900, 0x11abf,
- 0x11af9, 0x11fff,
- 0x12399, 0x123ff,
- 0x1246f, 0x1246f,
- 0x12475, 0x12fff,
+ 0x116ca, 0x11fff,
+ 0x1236f, 0x123ff,
+ 0x12463, 0x1246f,
+ 0x12474, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x16a3f,
- 0x16a5f, 0x16a5f,
- 0x16a6a, 0x16a6d,
- 0x16a70, 0x16acf,
- 0x16aee, 0x16aef,
- 0x16af6, 0x16aff,
- 0x16b46, 0x16b4f,
- 0x16b5a, 0x16b5a,
- 0x16b62, 0x16b62,
- 0x16b78, 0x16b7c,
- 0x16b90, 0x16eff,
+ 0x16a39, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1bbff,
- 0x1bc6b, 0x1bc6f,
- 0x1bc7d, 0x1bc7f,
- 0x1bc89, 0x1bc8f,
- 0x1bc9a, 0x1bc9b,
- 0x1bca4, 0x1cfff,
+ 0x1b002, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d1de, 0x1d1ff,
@@ -20278,9 +18645,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1e7ff,
- 0x1e8c5, 0x1e8c6,
- 0x1e8d7, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -20318,10 +18683,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0c0, 0x1f0c0,
+ 0x1f0bf, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0f6, 0x1f0ff,
- 0x1f10d, 0x1f10f,
+ 0x1f0e0, 0x1f0ff,
+ 0x1f10b, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -20329,25 +18694,24 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 0x1f32d, 0x1f32f,
- 0x1f37e, 0x1f37f,
- 0x1f3cf, 0x1f3d3,
- 0x1f3f8, 0x1f3ff,
- 0x1f4ff, 0x1f4ff,
- 0x1f54b, 0x1f54f,
- 0x1f57a, 0x1f57a,
- 0x1f5a4, 0x1f5a4,
- 0x1f643, 0x1f644,
- 0x1f6d0, 0x1f6df,
- 0x1f6ed, 0x1f6ef,
- 0x1f6f4, 0x1f6ff,
- 0x1f774, 0x1f77f,
- 0x1f7d5, 0x1f7ff,
- 0x1f80c, 0x1f80f,
- 0x1f848, 0x1f84f,
- 0x1f85a, 0x1f85f,
- 0x1f888, 0x1f88f,
- 0x1f8ae, 0x1ffff,
+ 0x1f321, 0x1f32f,
+ 0x1f336, 0x1f336,
+ 0x1f37d, 0x1f37f,
+ 0x1f394, 0x1f39f,
+ 0x1f3c5, 0x1f3c5,
+ 0x1f3cb, 0x1f3df,
+ 0x1f3f1, 0x1f3ff,
+ 0x1f43f, 0x1f43f,
+ 0x1f441, 0x1f441,
+ 0x1f4f8, 0x1f4f8,
+ 0x1f4fd, 0x1f4ff,
+ 0x1f53e, 0x1f53f,
+ 0x1f544, 0x1f54f,
+ 0x1f568, 0x1f5fa,
+ 0x1f641, 0x1f644,
+ 0x1f650, 0x1f67f,
+ 0x1f6c6, 0x1f6ff,
+ 0x1f774, 0x1ffff,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
0x2b81e, 0x2f7ff,
@@ -20357,7 +18721,6 @@ static const OnigCodePoint CR_Unknown[] = {
0xe01f0, 0x10ffff,
}; /* CR_Unknown */
-#ifdef USE_UNICODE_AGE_PROPERTIES
/* 'Age_1_1': Derived Age 1.1 */
static const OnigCodePoint CR_Age_1_1[] = {
288,
@@ -25795,1730 +24158,6 @@ static const OnigCodePoint CR_Age_6_1[] = {
0xefffe, 0x10ffff,
}; /* CR_Age_6_1 */
-/* 'Age_6_2': Derived Age 6.2 */
-static const OnigCodePoint CR_Age_6_2[] = {
- 549,
- 0x0000, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058f, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061b,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f4,
- 0x1400, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x206a, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20ba,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcc,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa697,
- 0xa69f, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fb,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018a,
- 0x10190, 0x1019b,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1085f,
- 0x10900, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109be, 0x109bf,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
- 0x10c00, 0x10c48,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x11080, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11180, 0x111c8,
- 0x111d0, 0x111d9,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1dd,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f320,
- 0x1f330, 0x1f335,
- 0x1f337, 0x1f37c,
- 0x1f380, 0x1f393,
- 0x1f3a0, 0x1f3c4,
- 0x1f3c6, 0x1f3ca,
- 0x1f3e0, 0x1f3f0,
- 0x1f400, 0x1f43e,
- 0x1f440, 0x1f440,
- 0x1f442, 0x1f4f7,
- 0x1f4f9, 0x1f4fc,
- 0x1f500, 0x1f53d,
- 0x1f540, 0x1f543,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_6_2 */
-
-/* 'Age_6_3': Derived Age 6.3 */
-static const OnigCodePoint CR_Age_6_3[] = {
- 549,
- 0x0000, 0x0377,
- 0x037a, 0x037e,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x0527,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058f, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061c,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f4,
- 0x1400, 0x169c,
- 0x16a0, 0x16f0,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191c,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x2066, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20ba,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23f3,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcc,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa697,
- 0xa69f, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fb,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018a,
- 0x10190, 0x1019b,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
- 0x10330, 0x1034a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1085f,
- 0x10900, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109be, 0x109bf,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
- 0x10c00, 0x10c48,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x11080, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11180, 0x111c8,
- 0x111d0, 0x111d9,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1dd,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f320,
- 0x1f330, 0x1f335,
- 0x1f337, 0x1f37c,
- 0x1f380, 0x1f393,
- 0x1f3a0, 0x1f3c4,
- 0x1f3c6, 0x1f3ca,
- 0x1f3e0, 0x1f3f0,
- 0x1f400, 0x1f43e,
- 0x1f440, 0x1f440,
- 0x1f442, 0x1f4f7,
- 0x1f4f9, 0x1f4fc,
- 0x1f500, 0x1f53d,
- 0x1f540, 0x1f543,
- 0x1f550, 0x1f567,
- 0x1f5fb, 0x1f640,
- 0x1f645, 0x1f64f,
- 0x1f680, 0x1f6c5,
- 0x1f700, 0x1f773,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_6_3 */
-
-/* 'Age_7_0': Derived Age 7.0 */
-static const OnigCodePoint CR_Age_7_0[] = {
- 610,
- 0x0000, 0x0377,
- 0x037a, 0x037f,
- 0x0384, 0x038a,
- 0x038c, 0x038c,
- 0x038e, 0x03a1,
- 0x03a3, 0x052f,
- 0x0531, 0x0556,
- 0x0559, 0x055f,
- 0x0561, 0x0587,
- 0x0589, 0x058a,
- 0x058d, 0x058f,
- 0x0591, 0x05c7,
- 0x05d0, 0x05ea,
- 0x05f0, 0x05f4,
- 0x0600, 0x061c,
- 0x061e, 0x070d,
- 0x070f, 0x074a,
- 0x074d, 0x07b1,
- 0x07c0, 0x07fa,
- 0x0800, 0x082d,
- 0x0830, 0x083e,
- 0x0840, 0x085b,
- 0x085e, 0x085e,
- 0x08a0, 0x08b2,
- 0x08e4, 0x0983,
- 0x0985, 0x098c,
- 0x098f, 0x0990,
- 0x0993, 0x09a8,
- 0x09aa, 0x09b0,
- 0x09b2, 0x09b2,
- 0x09b6, 0x09b9,
- 0x09bc, 0x09c4,
- 0x09c7, 0x09c8,
- 0x09cb, 0x09ce,
- 0x09d7, 0x09d7,
- 0x09dc, 0x09dd,
- 0x09df, 0x09e3,
- 0x09e6, 0x09fb,
- 0x0a01, 0x0a03,
- 0x0a05, 0x0a0a,
- 0x0a0f, 0x0a10,
- 0x0a13, 0x0a28,
- 0x0a2a, 0x0a30,
- 0x0a32, 0x0a33,
- 0x0a35, 0x0a36,
- 0x0a38, 0x0a39,
- 0x0a3c, 0x0a3c,
- 0x0a3e, 0x0a42,
- 0x0a47, 0x0a48,
- 0x0a4b, 0x0a4d,
- 0x0a51, 0x0a51,
- 0x0a59, 0x0a5c,
- 0x0a5e, 0x0a5e,
- 0x0a66, 0x0a75,
- 0x0a81, 0x0a83,
- 0x0a85, 0x0a8d,
- 0x0a8f, 0x0a91,
- 0x0a93, 0x0aa8,
- 0x0aaa, 0x0ab0,
- 0x0ab2, 0x0ab3,
- 0x0ab5, 0x0ab9,
- 0x0abc, 0x0ac5,
- 0x0ac7, 0x0ac9,
- 0x0acb, 0x0acd,
- 0x0ad0, 0x0ad0,
- 0x0ae0, 0x0ae3,
- 0x0ae6, 0x0af1,
- 0x0b01, 0x0b03,
- 0x0b05, 0x0b0c,
- 0x0b0f, 0x0b10,
- 0x0b13, 0x0b28,
- 0x0b2a, 0x0b30,
- 0x0b32, 0x0b33,
- 0x0b35, 0x0b39,
- 0x0b3c, 0x0b44,
- 0x0b47, 0x0b48,
- 0x0b4b, 0x0b4d,
- 0x0b56, 0x0b57,
- 0x0b5c, 0x0b5d,
- 0x0b5f, 0x0b63,
- 0x0b66, 0x0b77,
- 0x0b82, 0x0b83,
- 0x0b85, 0x0b8a,
- 0x0b8e, 0x0b90,
- 0x0b92, 0x0b95,
- 0x0b99, 0x0b9a,
- 0x0b9c, 0x0b9c,
- 0x0b9e, 0x0b9f,
- 0x0ba3, 0x0ba4,
- 0x0ba8, 0x0baa,
- 0x0bae, 0x0bb9,
- 0x0bbe, 0x0bc2,
- 0x0bc6, 0x0bc8,
- 0x0bca, 0x0bcd,
- 0x0bd0, 0x0bd0,
- 0x0bd7, 0x0bd7,
- 0x0be6, 0x0bfa,
- 0x0c00, 0x0c03,
- 0x0c05, 0x0c0c,
- 0x0c0e, 0x0c10,
- 0x0c12, 0x0c28,
- 0x0c2a, 0x0c39,
- 0x0c3d, 0x0c44,
- 0x0c46, 0x0c48,
- 0x0c4a, 0x0c4d,
- 0x0c55, 0x0c56,
- 0x0c58, 0x0c59,
- 0x0c60, 0x0c63,
- 0x0c66, 0x0c6f,
- 0x0c78, 0x0c7f,
- 0x0c81, 0x0c83,
- 0x0c85, 0x0c8c,
- 0x0c8e, 0x0c90,
- 0x0c92, 0x0ca8,
- 0x0caa, 0x0cb3,
- 0x0cb5, 0x0cb9,
- 0x0cbc, 0x0cc4,
- 0x0cc6, 0x0cc8,
- 0x0cca, 0x0ccd,
- 0x0cd5, 0x0cd6,
- 0x0cde, 0x0cde,
- 0x0ce0, 0x0ce3,
- 0x0ce6, 0x0cef,
- 0x0cf1, 0x0cf2,
- 0x0d01, 0x0d03,
- 0x0d05, 0x0d0c,
- 0x0d0e, 0x0d10,
- 0x0d12, 0x0d3a,
- 0x0d3d, 0x0d44,
- 0x0d46, 0x0d48,
- 0x0d4a, 0x0d4e,
- 0x0d57, 0x0d57,
- 0x0d60, 0x0d63,
- 0x0d66, 0x0d75,
- 0x0d79, 0x0d7f,
- 0x0d82, 0x0d83,
- 0x0d85, 0x0d96,
- 0x0d9a, 0x0db1,
- 0x0db3, 0x0dbb,
- 0x0dbd, 0x0dbd,
- 0x0dc0, 0x0dc6,
- 0x0dca, 0x0dca,
- 0x0dcf, 0x0dd4,
- 0x0dd6, 0x0dd6,
- 0x0dd8, 0x0ddf,
- 0x0de6, 0x0def,
- 0x0df2, 0x0df4,
- 0x0e01, 0x0e3a,
- 0x0e3f, 0x0e5b,
- 0x0e81, 0x0e82,
- 0x0e84, 0x0e84,
- 0x0e87, 0x0e88,
- 0x0e8a, 0x0e8a,
- 0x0e8d, 0x0e8d,
- 0x0e94, 0x0e97,
- 0x0e99, 0x0e9f,
- 0x0ea1, 0x0ea3,
- 0x0ea5, 0x0ea5,
- 0x0ea7, 0x0ea7,
- 0x0eaa, 0x0eab,
- 0x0ead, 0x0eb9,
- 0x0ebb, 0x0ebd,
- 0x0ec0, 0x0ec4,
- 0x0ec6, 0x0ec6,
- 0x0ec8, 0x0ecd,
- 0x0ed0, 0x0ed9,
- 0x0edc, 0x0edf,
- 0x0f00, 0x0f47,
- 0x0f49, 0x0f6c,
- 0x0f71, 0x0f97,
- 0x0f99, 0x0fbc,
- 0x0fbe, 0x0fcc,
- 0x0fce, 0x0fda,
- 0x1000, 0x10c5,
- 0x10c7, 0x10c7,
- 0x10cd, 0x10cd,
- 0x10d0, 0x1248,
- 0x124a, 0x124d,
- 0x1250, 0x1256,
- 0x1258, 0x1258,
- 0x125a, 0x125d,
- 0x1260, 0x1288,
- 0x128a, 0x128d,
- 0x1290, 0x12b0,
- 0x12b2, 0x12b5,
- 0x12b8, 0x12be,
- 0x12c0, 0x12c0,
- 0x12c2, 0x12c5,
- 0x12c8, 0x12d6,
- 0x12d8, 0x1310,
- 0x1312, 0x1315,
- 0x1318, 0x135a,
- 0x135d, 0x137c,
- 0x1380, 0x1399,
- 0x13a0, 0x13f4,
- 0x1400, 0x169c,
- 0x16a0, 0x16f8,
- 0x1700, 0x170c,
- 0x170e, 0x1714,
- 0x1720, 0x1736,
- 0x1740, 0x1753,
- 0x1760, 0x176c,
- 0x176e, 0x1770,
- 0x1772, 0x1773,
- 0x1780, 0x17dd,
- 0x17e0, 0x17e9,
- 0x17f0, 0x17f9,
- 0x1800, 0x180e,
- 0x1810, 0x1819,
- 0x1820, 0x1877,
- 0x1880, 0x18aa,
- 0x18b0, 0x18f5,
- 0x1900, 0x191e,
- 0x1920, 0x192b,
- 0x1930, 0x193b,
- 0x1940, 0x1940,
- 0x1944, 0x196d,
- 0x1970, 0x1974,
- 0x1980, 0x19ab,
- 0x19b0, 0x19c9,
- 0x19d0, 0x19da,
- 0x19de, 0x1a1b,
- 0x1a1e, 0x1a5e,
- 0x1a60, 0x1a7c,
- 0x1a7f, 0x1a89,
- 0x1a90, 0x1a99,
- 0x1aa0, 0x1aad,
- 0x1ab0, 0x1abe,
- 0x1b00, 0x1b4b,
- 0x1b50, 0x1b7c,
- 0x1b80, 0x1bf3,
- 0x1bfc, 0x1c37,
- 0x1c3b, 0x1c49,
- 0x1c4d, 0x1c7f,
- 0x1cc0, 0x1cc7,
- 0x1cd0, 0x1cf6,
- 0x1cf8, 0x1cf9,
- 0x1d00, 0x1df5,
- 0x1dfc, 0x1f15,
- 0x1f18, 0x1f1d,
- 0x1f20, 0x1f45,
- 0x1f48, 0x1f4d,
- 0x1f50, 0x1f57,
- 0x1f59, 0x1f59,
- 0x1f5b, 0x1f5b,
- 0x1f5d, 0x1f5d,
- 0x1f5f, 0x1f7d,
- 0x1f80, 0x1fb4,
- 0x1fb6, 0x1fc4,
- 0x1fc6, 0x1fd3,
- 0x1fd6, 0x1fdb,
- 0x1fdd, 0x1fef,
- 0x1ff2, 0x1ff4,
- 0x1ff6, 0x1ffe,
- 0x2000, 0x2064,
- 0x2066, 0x2071,
- 0x2074, 0x208e,
- 0x2090, 0x209c,
- 0x20a0, 0x20bd,
- 0x20d0, 0x20f0,
- 0x2100, 0x2189,
- 0x2190, 0x23fa,
- 0x2400, 0x2426,
- 0x2440, 0x244a,
- 0x2460, 0x2b73,
- 0x2b76, 0x2b95,
- 0x2b98, 0x2bb9,
- 0x2bbd, 0x2bc8,
- 0x2bca, 0x2bd1,
- 0x2c00, 0x2c2e,
- 0x2c30, 0x2c5e,
- 0x2c60, 0x2cf3,
- 0x2cf9, 0x2d25,
- 0x2d27, 0x2d27,
- 0x2d2d, 0x2d2d,
- 0x2d30, 0x2d67,
- 0x2d6f, 0x2d70,
- 0x2d7f, 0x2d96,
- 0x2da0, 0x2da6,
- 0x2da8, 0x2dae,
- 0x2db0, 0x2db6,
- 0x2db8, 0x2dbe,
- 0x2dc0, 0x2dc6,
- 0x2dc8, 0x2dce,
- 0x2dd0, 0x2dd6,
- 0x2dd8, 0x2dde,
- 0x2de0, 0x2e42,
- 0x2e80, 0x2e99,
- 0x2e9b, 0x2ef3,
- 0x2f00, 0x2fd5,
- 0x2ff0, 0x2ffb,
- 0x3000, 0x303f,
- 0x3041, 0x3096,
- 0x3099, 0x30ff,
- 0x3105, 0x312d,
- 0x3131, 0x318e,
- 0x3190, 0x31ba,
- 0x31c0, 0x31e3,
- 0x31f0, 0x321e,
- 0x3220, 0x32fe,
- 0x3300, 0x4db5,
- 0x4dc0, 0x9fcc,
- 0xa000, 0xa48c,
- 0xa490, 0xa4c6,
- 0xa4d0, 0xa62b,
- 0xa640, 0xa69d,
- 0xa69f, 0xa6f7,
- 0xa700, 0xa78e,
- 0xa790, 0xa7ad,
- 0xa7b0, 0xa7b1,
- 0xa7f7, 0xa82b,
- 0xa830, 0xa839,
- 0xa840, 0xa877,
- 0xa880, 0xa8c4,
- 0xa8ce, 0xa8d9,
- 0xa8e0, 0xa8fb,
- 0xa900, 0xa953,
- 0xa95f, 0xa97c,
- 0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
- 0xa9de, 0xa9fe,
- 0xaa00, 0xaa36,
- 0xaa40, 0xaa4d,
- 0xaa50, 0xaa59,
- 0xaa5c, 0xaac2,
- 0xaadb, 0xaaf6,
- 0xab01, 0xab06,
- 0xab09, 0xab0e,
- 0xab11, 0xab16,
- 0xab20, 0xab26,
- 0xab28, 0xab2e,
- 0xab30, 0xab5f,
- 0xab64, 0xab65,
- 0xabc0, 0xabed,
- 0xabf0, 0xabf9,
- 0xac00, 0xd7a3,
- 0xd7b0, 0xd7c6,
- 0xd7cb, 0xd7fb,
- 0xd800, 0xfa6d,
- 0xfa70, 0xfad9,
- 0xfb00, 0xfb06,
- 0xfb13, 0xfb17,
- 0xfb1d, 0xfb36,
- 0xfb38, 0xfb3c,
- 0xfb3e, 0xfb3e,
- 0xfb40, 0xfb41,
- 0xfb43, 0xfb44,
- 0xfb46, 0xfbc1,
- 0xfbd3, 0xfd3f,
- 0xfd50, 0xfd8f,
- 0xfd92, 0xfdc7,
- 0xfdd0, 0xfdfd,
- 0xfe00, 0xfe19,
- 0xfe20, 0xfe2d,
- 0xfe30, 0xfe52,
- 0xfe54, 0xfe66,
- 0xfe68, 0xfe6b,
- 0xfe70, 0xfe74,
- 0xfe76, 0xfefc,
- 0xfeff, 0xfeff,
- 0xff01, 0xffbe,
- 0xffc2, 0xffc7,
- 0xffca, 0xffcf,
- 0xffd2, 0xffd7,
- 0xffda, 0xffdc,
- 0xffe0, 0xffe6,
- 0xffe8, 0xffee,
- 0xfff9, 0x1000b,
- 0x1000d, 0x10026,
- 0x10028, 0x1003a,
- 0x1003c, 0x1003d,
- 0x1003f, 0x1004d,
- 0x10050, 0x1005d,
- 0x10080, 0x100fa,
- 0x10100, 0x10102,
- 0x10107, 0x10133,
- 0x10137, 0x1018c,
- 0x10190, 0x1019b,
- 0x101a0, 0x101a0,
- 0x101d0, 0x101fd,
- 0x10280, 0x1029c,
- 0x102a0, 0x102d0,
- 0x102e0, 0x102fb,
- 0x10300, 0x10323,
- 0x10330, 0x1034a,
- 0x10350, 0x1037a,
- 0x10380, 0x1039d,
- 0x1039f, 0x103c3,
- 0x103c8, 0x103d5,
- 0x10400, 0x1049d,
- 0x104a0, 0x104a9,
- 0x10500, 0x10527,
- 0x10530, 0x10563,
- 0x1056f, 0x1056f,
- 0x10600, 0x10736,
- 0x10740, 0x10755,
- 0x10760, 0x10767,
- 0x10800, 0x10805,
- 0x10808, 0x10808,
- 0x1080a, 0x10835,
- 0x10837, 0x10838,
- 0x1083c, 0x1083c,
- 0x1083f, 0x10855,
- 0x10857, 0x1089e,
- 0x108a7, 0x108af,
- 0x10900, 0x1091b,
- 0x1091f, 0x10939,
- 0x1093f, 0x1093f,
- 0x10980, 0x109b7,
- 0x109be, 0x109bf,
- 0x10a00, 0x10a03,
- 0x10a05, 0x10a06,
- 0x10a0c, 0x10a13,
- 0x10a15, 0x10a17,
- 0x10a19, 0x10a33,
- 0x10a38, 0x10a3a,
- 0x10a3f, 0x10a47,
- 0x10a50, 0x10a58,
- 0x10a60, 0x10a9f,
- 0x10ac0, 0x10ae6,
- 0x10aeb, 0x10af6,
- 0x10b00, 0x10b35,
- 0x10b39, 0x10b55,
- 0x10b58, 0x10b72,
- 0x10b78, 0x10b91,
- 0x10b99, 0x10b9c,
- 0x10ba9, 0x10baf,
- 0x10c00, 0x10c48,
- 0x10e60, 0x10e7e,
- 0x11000, 0x1104d,
- 0x11052, 0x1106f,
- 0x1107f, 0x110c1,
- 0x110d0, 0x110e8,
- 0x110f0, 0x110f9,
- 0x11100, 0x11134,
- 0x11136, 0x11143,
- 0x11150, 0x11176,
- 0x11180, 0x111c8,
- 0x111cd, 0x111cd,
- 0x111d0, 0x111da,
- 0x111e1, 0x111f4,
- 0x11200, 0x11211,
- 0x11213, 0x1123d,
- 0x112b0, 0x112ea,
- 0x112f0, 0x112f9,
- 0x11301, 0x11303,
- 0x11305, 0x1130c,
- 0x1130f, 0x11310,
- 0x11313, 0x11328,
- 0x1132a, 0x11330,
- 0x11332, 0x11333,
- 0x11335, 0x11339,
- 0x1133c, 0x11344,
- 0x11347, 0x11348,
- 0x1134b, 0x1134d,
- 0x11357, 0x11357,
- 0x1135d, 0x11363,
- 0x11366, 0x1136c,
- 0x11370, 0x11374,
- 0x11480, 0x114c7,
- 0x114d0, 0x114d9,
- 0x11580, 0x115b5,
- 0x115b8, 0x115c9,
- 0x11600, 0x11644,
- 0x11650, 0x11659,
- 0x11680, 0x116b7,
- 0x116c0, 0x116c9,
- 0x118a0, 0x118f2,
- 0x118ff, 0x118ff,
- 0x11ac0, 0x11af8,
- 0x12000, 0x12398,
- 0x12400, 0x1246e,
- 0x12470, 0x12474,
- 0x13000, 0x1342e,
- 0x16800, 0x16a38,
- 0x16a40, 0x16a5e,
- 0x16a60, 0x16a69,
- 0x16a6e, 0x16a6f,
- 0x16ad0, 0x16aed,
- 0x16af0, 0x16af5,
- 0x16b00, 0x16b45,
- 0x16b50, 0x16b59,
- 0x16b5b, 0x16b61,
- 0x16b63, 0x16b77,
- 0x16b7d, 0x16b8f,
- 0x16f00, 0x16f44,
- 0x16f50, 0x16f7e,
- 0x16f8f, 0x16f9f,
- 0x1b000, 0x1b001,
- 0x1bc00, 0x1bc6a,
- 0x1bc70, 0x1bc7c,
- 0x1bc80, 0x1bc88,
- 0x1bc90, 0x1bc99,
- 0x1bc9c, 0x1bca3,
- 0x1d000, 0x1d0f5,
- 0x1d100, 0x1d126,
- 0x1d129, 0x1d1dd,
- 0x1d200, 0x1d245,
- 0x1d300, 0x1d356,
- 0x1d360, 0x1d371,
- 0x1d400, 0x1d454,
- 0x1d456, 0x1d49c,
- 0x1d49e, 0x1d49f,
- 0x1d4a2, 0x1d4a2,
- 0x1d4a5, 0x1d4a6,
- 0x1d4a9, 0x1d4ac,
- 0x1d4ae, 0x1d4b9,
- 0x1d4bb, 0x1d4bb,
- 0x1d4bd, 0x1d4c3,
- 0x1d4c5, 0x1d505,
- 0x1d507, 0x1d50a,
- 0x1d50d, 0x1d514,
- 0x1d516, 0x1d51c,
- 0x1d51e, 0x1d539,
- 0x1d53b, 0x1d53e,
- 0x1d540, 0x1d544,
- 0x1d546, 0x1d546,
- 0x1d54a, 0x1d550,
- 0x1d552, 0x1d6a5,
- 0x1d6a8, 0x1d7cb,
- 0x1d7ce, 0x1d7ff,
- 0x1e800, 0x1e8c4,
- 0x1e8c7, 0x1e8d6,
- 0x1ee00, 0x1ee03,
- 0x1ee05, 0x1ee1f,
- 0x1ee21, 0x1ee22,
- 0x1ee24, 0x1ee24,
- 0x1ee27, 0x1ee27,
- 0x1ee29, 0x1ee32,
- 0x1ee34, 0x1ee37,
- 0x1ee39, 0x1ee39,
- 0x1ee3b, 0x1ee3b,
- 0x1ee42, 0x1ee42,
- 0x1ee47, 0x1ee47,
- 0x1ee49, 0x1ee49,
- 0x1ee4b, 0x1ee4b,
- 0x1ee4d, 0x1ee4f,
- 0x1ee51, 0x1ee52,
- 0x1ee54, 0x1ee54,
- 0x1ee57, 0x1ee57,
- 0x1ee59, 0x1ee59,
- 0x1ee5b, 0x1ee5b,
- 0x1ee5d, 0x1ee5d,
- 0x1ee5f, 0x1ee5f,
- 0x1ee61, 0x1ee62,
- 0x1ee64, 0x1ee64,
- 0x1ee67, 0x1ee6a,
- 0x1ee6c, 0x1ee72,
- 0x1ee74, 0x1ee77,
- 0x1ee79, 0x1ee7c,
- 0x1ee7e, 0x1ee7e,
- 0x1ee80, 0x1ee89,
- 0x1ee8b, 0x1ee9b,
- 0x1eea1, 0x1eea3,
- 0x1eea5, 0x1eea9,
- 0x1eeab, 0x1eebb,
- 0x1eef0, 0x1eef1,
- 0x1f000, 0x1f02b,
- 0x1f030, 0x1f093,
- 0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0bf,
- 0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0f5,
- 0x1f100, 0x1f10c,
- 0x1f110, 0x1f12e,
- 0x1f130, 0x1f16b,
- 0x1f170, 0x1f19a,
- 0x1f1e6, 0x1f202,
- 0x1f210, 0x1f23a,
- 0x1f240, 0x1f248,
- 0x1f250, 0x1f251,
- 0x1f300, 0x1f32c,
- 0x1f330, 0x1f37d,
- 0x1f380, 0x1f3ce,
- 0x1f3d4, 0x1f3f7,
- 0x1f400, 0x1f4fe,
- 0x1f500, 0x1f54a,
- 0x1f550, 0x1f579,
- 0x1f57b, 0x1f5a3,
- 0x1f5a5, 0x1f642,
- 0x1f645, 0x1f6cf,
- 0x1f6e0, 0x1f6ec,
- 0x1f6f0, 0x1f6f3,
- 0x1f700, 0x1f773,
- 0x1f780, 0x1f7d4,
- 0x1f800, 0x1f80b,
- 0x1f810, 0x1f847,
- 0x1f850, 0x1f859,
- 0x1f860, 0x1f887,
- 0x1f890, 0x1f8ad,
- 0x1fffe, 0x2a6d6,
- 0x2a700, 0x2b734,
- 0x2b740, 0x2b81d,
- 0x2f800, 0x2fa1d,
- 0x2fffe, 0x2ffff,
- 0x3fffe, 0x3ffff,
- 0x4fffe, 0x4ffff,
- 0x5fffe, 0x5ffff,
- 0x6fffe, 0x6ffff,
- 0x7fffe, 0x7ffff,
- 0x8fffe, 0x8ffff,
- 0x9fffe, 0x9ffff,
- 0xafffe, 0xaffff,
- 0xbfffe, 0xbffff,
- 0xcfffe, 0xcffff,
- 0xdfffe, 0xdffff,
- 0xe0001, 0xe0001,
- 0xe0020, 0xe007f,
- 0xe0100, 0xe01ef,
- 0xefffe, 0x10ffff,
-}; /* CR_Age_7_0 */
-#endif /* USE_UNICODE_AGE_PROPERTIES */
-
/* 'In_Basic_Latin': Block */
#define CR_In_Basic_Latin CR_ASCII
@@ -27846,12 +24485,6 @@ static const OnigCodePoint CR_In_Tai_Tham[] = {
0x1a20, 0x1aaf,
}; /* CR_In_Tai_Tham */
-/* 'In_Combining_Diacritical_Marks_Extended': Block */
-static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Extended[] = {
- 1,
- 0x1ab0, 0x1aff,
-}; /* CR_In_Combining_Diacritical_Marks_Extended */
-
/* 'In_Balinese': Block */
static const OnigCodePoint CR_In_Balinese[] = {
1,
@@ -28288,10 +24921,7 @@ static const OnigCodePoint CR_In_Devanagari_Extended[] = {
}; /* CR_In_Devanagari_Extended */
/* 'In_Kayah_Li': Block */
-static const OnigCodePoint CR_In_Kayah_Li[] = {
- 1,
- 0xa900, 0xa92f,
-}; /* CR_In_Kayah_Li */
+#define CR_In_Kayah_Li CR_Kayah_Li
/* 'In_Rejang': Block */
static const OnigCodePoint CR_In_Rejang[] = {
@@ -28311,12 +24941,6 @@ static const OnigCodePoint CR_In_Javanese[] = {
0xa980, 0xa9df,
}; /* CR_In_Javanese */
-/* 'In_Myanmar_Extended_B': Block */
-static const OnigCodePoint CR_In_Myanmar_Extended_B[] = {
- 1,
- 0xa9e0, 0xa9ff,
-}; /* CR_In_Myanmar_Extended_B */
-
/* 'In_Cham': Block */
static const OnigCodePoint CR_In_Cham[] = {
1,
@@ -28347,12 +24971,6 @@ static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = {
0xab00, 0xab2f,
}; /* CR_In_Ethiopic_Extended_A */
-/* 'In_Latin_Extended_E': Block */
-static const OnigCodePoint CR_In_Latin_Extended_E[] = {
- 1,
- 0xab30, 0xab6f,
-}; /* CR_In_Latin_Extended_E */
-
/* 'In_Meetei_Mayek': Block */
static const OnigCodePoint CR_In_Meetei_Mayek[] = {
1,
@@ -28509,12 +25127,6 @@ static const OnigCodePoint CR_In_Carian[] = {
0x102a0, 0x102df,
}; /* CR_In_Carian */
-/* 'In_Coptic_Epact_Numbers': Block */
-static const OnigCodePoint CR_In_Coptic_Epact_Numbers[] = {
- 1,
- 0x102e0, 0x102ff,
-}; /* CR_In_Coptic_Epact_Numbers */
-
/* 'In_Old_Italic': Block */
static const OnigCodePoint CR_In_Old_Italic[] = {
1,
@@ -28527,12 +25139,6 @@ static const OnigCodePoint CR_In_Gothic[] = {
0x10330, 0x1034f,
}; /* CR_In_Gothic */
-/* 'In_Old_Permic': Block */
-static const OnigCodePoint CR_In_Old_Permic[] = {
- 1,
- 0x10350, 0x1037f,
-}; /* CR_In_Old_Permic */
-
/* 'In_Ugaritic': Block */
static const OnigCodePoint CR_In_Ugaritic[] = {
1,
@@ -28557,24 +25163,6 @@ static const OnigCodePoint CR_In_Osmanya[] = {
0x10480, 0x104af,
}; /* CR_In_Osmanya */
-/* 'In_Elbasan': Block */
-static const OnigCodePoint CR_In_Elbasan[] = {
- 1,
- 0x10500, 0x1052f,
-}; /* CR_In_Elbasan */
-
-/* 'In_Caucasian_Albanian': Block */
-static const OnigCodePoint CR_In_Caucasian_Albanian[] = {
- 1,
- 0x10530, 0x1056f,
-}; /* CR_In_Caucasian_Albanian */
-
-/* 'In_Linear_A': Block */
-static const OnigCodePoint CR_In_Linear_A[] = {
- 1,
- 0x10600, 0x1077f,
-}; /* CR_In_Linear_A */
-
/* 'In_Cypriot_Syllabary': Block */
static const OnigCodePoint CR_In_Cypriot_Syllabary[] = {
1,
@@ -28587,15 +25175,6 @@ static const OnigCodePoint CR_In_Imperial_Aramaic[] = {
0x10840, 0x1085f,
}; /* CR_In_Imperial_Aramaic */
-/* 'In_Palmyrene': Block */
-#define CR_In_Palmyrene CR_Palmyrene
-
-/* 'In_Nabataean': Block */
-static const OnigCodePoint CR_In_Nabataean[] = {
- 1,
- 0x10880, 0x108af,
-}; /* CR_In_Nabataean */
-
/* 'In_Phoenician': Block */
static const OnigCodePoint CR_In_Phoenician[] = {
1,
@@ -28626,15 +25205,6 @@ static const OnigCodePoint CR_In_Kharoshthi[] = {
/* 'In_Old_South_Arabian': Block */
#define CR_In_Old_South_Arabian CR_Old_South_Arabian
-/* 'In_Old_North_Arabian': Block */
-#define CR_In_Old_North_Arabian CR_Old_North_Arabian
-
-/* 'In_Manichaean': Block */
-static const OnigCodePoint CR_In_Manichaean[] = {
- 1,
- 0x10ac0, 0x10aff,
-}; /* CR_In_Manichaean */
-
/* 'In_Avestan': Block */
static const OnigCodePoint CR_In_Avestan[] = {
1,
@@ -28653,12 +25223,6 @@ static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = {
0x10b60, 0x10b7f,
}; /* CR_In_Inscriptional_Pahlavi */
-/* 'In_Psalter_Pahlavi': Block */
-static const OnigCodePoint CR_In_Psalter_Pahlavi[] = {
- 1,
- 0x10b80, 0x10baf,
-}; /* CR_In_Psalter_Pahlavi */
-
/* 'In_Old_Turkic': Block */
static const OnigCodePoint CR_In_Old_Turkic[] = {
1,
@@ -28695,78 +25259,18 @@ static const OnigCodePoint CR_In_Chakma[] = {
0x11100, 0x1114f,
}; /* CR_In_Chakma */
-/* 'In_Mahajani': Block */
-static const OnigCodePoint CR_In_Mahajani[] = {
- 1,
- 0x11150, 0x1117f,
-}; /* CR_In_Mahajani */
-
/* 'In_Sharada': Block */
static const OnigCodePoint CR_In_Sharada[] = {
1,
0x11180, 0x111df,
}; /* CR_In_Sharada */
-/* 'In_Sinhala_Archaic_Numbers': Block */
-static const OnigCodePoint CR_In_Sinhala_Archaic_Numbers[] = {
- 1,
- 0x111e0, 0x111ff,
-}; /* CR_In_Sinhala_Archaic_Numbers */
-
-/* 'In_Khojki': Block */
-static const OnigCodePoint CR_In_Khojki[] = {
- 1,
- 0x11200, 0x1124f,
-}; /* CR_In_Khojki */
-
-/* 'In_Khudawadi': Block */
-static const OnigCodePoint CR_In_Khudawadi[] = {
- 1,
- 0x112b0, 0x112ff,
-}; /* CR_In_Khudawadi */
-
-/* 'In_Grantha': Block */
-static const OnigCodePoint CR_In_Grantha[] = {
- 1,
- 0x11300, 0x1137f,
-}; /* CR_In_Grantha */
-
-/* 'In_Tirhuta': Block */
-static const OnigCodePoint CR_In_Tirhuta[] = {
- 1,
- 0x11480, 0x114df,
-}; /* CR_In_Tirhuta */
-
-/* 'In_Siddham': Block */
-static const OnigCodePoint CR_In_Siddham[] = {
- 1,
- 0x11580, 0x115ff,
-}; /* CR_In_Siddham */
-
-/* 'In_Modi': Block */
-static const OnigCodePoint CR_In_Modi[] = {
- 1,
- 0x11600, 0x1165f,
-}; /* CR_In_Modi */
-
/* 'In_Takri': Block */
static const OnigCodePoint CR_In_Takri[] = {
1,
0x11680, 0x116cf,
}; /* CR_In_Takri */
-/* 'In_Warang_Citi': Block */
-static const OnigCodePoint CR_In_Warang_Citi[] = {
- 1,
- 0x118a0, 0x118ff,
-}; /* CR_In_Warang_Citi */
-
-/* 'In_Pau_Cin_Hau': Block */
-static const OnigCodePoint CR_In_Pau_Cin_Hau[] = {
- 1,
- 0x11ac0, 0x11aff,
-}; /* CR_In_Pau_Cin_Hau */
-
/* 'In_Cuneiform': Block */
static const OnigCodePoint CR_In_Cuneiform[] = {
1,
@@ -28791,24 +25295,6 @@ static const OnigCodePoint CR_In_Bamum_Supplement[] = {
0x16800, 0x16a3f,
}; /* CR_In_Bamum_Supplement */
-/* 'In_Mro': Block */
-static const OnigCodePoint CR_In_Mro[] = {
- 1,
- 0x16a40, 0x16a6f,
-}; /* CR_In_Mro */
-
-/* 'In_Bassa_Vah': Block */
-static const OnigCodePoint CR_In_Bassa_Vah[] = {
- 1,
- 0x16ad0, 0x16aff,
-}; /* CR_In_Bassa_Vah */
-
-/* 'In_Pahawh_Hmong': Block */
-static const OnigCodePoint CR_In_Pahawh_Hmong[] = {
- 1,
- 0x16b00, 0x16b8f,
-}; /* CR_In_Pahawh_Hmong */
-
/* 'In_Miao': Block */
static const OnigCodePoint CR_In_Miao[] = {
1,
@@ -28821,18 +25307,6 @@ static const OnigCodePoint CR_In_Kana_Supplement[] = {
0x1b000, 0x1b0ff,
}; /* CR_In_Kana_Supplement */
-/* 'In_Duployan': Block */
-static const OnigCodePoint CR_In_Duployan[] = {
- 1,
- 0x1bc00, 0x1bc9f,
-}; /* CR_In_Duployan */
-
-/* 'In_Shorthand_Format_Controls': Block */
-static const OnigCodePoint CR_In_Shorthand_Format_Controls[] = {
- 1,
- 0x1bca0, 0x1bcaf,
-}; /* CR_In_Shorthand_Format_Controls */
-
/* 'In_Byzantine_Musical_Symbols': Block */
static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = {
1,
@@ -28869,12 +25343,6 @@ static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = {
0x1d400, 0x1d7ff,
}; /* CR_In_Mathematical_Alphanumeric_Symbols */
-/* 'In_Mende_Kikakui': Block */
-static const OnigCodePoint CR_In_Mende_Kikakui[] = {
- 1,
- 0x1e800, 0x1e8df,
-}; /* CR_In_Mende_Kikakui */
-
/* 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */
static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = {
1,
@@ -28911,11 +25379,11 @@ static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = {
0x1f200, 0x1f2ff,
}; /* CR_In_Enclosed_Ideographic_Supplement */
-/* 'In_Miscellaneous_Symbols_and_Pictographs': Block */
-static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Pictographs[] = {
+/* 'In_Miscellaneous_Symbols_And_Pictographs': Block */
+static const OnigCodePoint CR_In_Miscellaneous_Symbols_And_Pictographs[] = {
1,
0x1f300, 0x1f5ff,
-}; /* CR_In_Miscellaneous_Symbols_and_Pictographs */
+}; /* CR_In_Miscellaneous_Symbols_And_Pictographs */
/* 'In_Emoticons': Block */
static const OnigCodePoint CR_In_Emoticons[] = {
@@ -28923,17 +25391,11 @@ static const OnigCodePoint CR_In_Emoticons[] = {
0x1f600, 0x1f64f,
}; /* CR_In_Emoticons */
-/* 'In_Ornamental_Dingbats': Block */
-static const OnigCodePoint CR_In_Ornamental_Dingbats[] = {
- 1,
- 0x1f650, 0x1f67f,
-}; /* CR_In_Ornamental_Dingbats */
-
-/* 'In_Transport_and_Map_Symbols': Block */
-static const OnigCodePoint CR_In_Transport_and_Map_Symbols[] = {
+/* 'In_Transport_And_Map_Symbols': Block */
+static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
1,
0x1f680, 0x1f6ff,
-}; /* CR_In_Transport_and_Map_Symbols */
+}; /* CR_In_Transport_And_Map_Symbols */
/* 'In_Alchemical_Symbols': Block */
static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
@@ -28941,18 +25403,6 @@ static const OnigCodePoint CR_In_Alchemical_Symbols[] = {
0x1f700, 0x1f77f,
}; /* CR_In_Alchemical_Symbols */
-/* 'In_Geometric_Shapes_Extended': Block */
-static const OnigCodePoint CR_In_Geometric_Shapes_Extended[] = {
- 1,
- 0x1f780, 0x1f7ff,
-}; /* CR_In_Geometric_Shapes_Extended */
-
-/* 'In_Supplemental_Arrows_C': Block */
-static const OnigCodePoint CR_In_Supplemental_Arrows_C[] = {
- 1,
- 0x1f800, 0x1f8ff,
-}; /* CR_In_Supplemental_Arrows_C */
-
/* 'In_CJK_Unified_Ideographs_Extension_B': Block */
static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = {
1,
@@ -29003,42 +25453,38 @@ static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
/* 'In_No_Block': Block */
static const OnigCodePoint CR_In_No_Block[] = {
- 40,
+ 36,
0x0860, 0x089f,
+ 0x1ab0, 0x1aff,
0x1c80, 0x1cbf,
0x2fe0, 0x2fef,
- 0xab70, 0xabbf,
+ 0xa9e0, 0xa9ff,
+ 0xab30, 0xabbf,
0x10200, 0x1027f,
+ 0x102e0, 0x102ff,
+ 0x10350, 0x1037f,
0x103e0, 0x103ff,
- 0x104b0, 0x104ff,
- 0x10570, 0x105ff,
- 0x10780, 0x107ff,
- 0x108b0, 0x108ff,
+ 0x104b0, 0x107ff,
+ 0x10860, 0x108ff,
0x10940, 0x1097f,
- 0x10aa0, 0x10abf,
- 0x10bb0, 0x10bff,
+ 0x10a80, 0x10aff,
+ 0x10b80, 0x10bff,
0x10c50, 0x10e5f,
0x10e80, 0x10fff,
- 0x11250, 0x112af,
- 0x11380, 0x1147f,
- 0x114e0, 0x1157f,
- 0x11660, 0x1167f,
- 0x116d0, 0x1189f,
- 0x11900, 0x11abf,
- 0x11b00, 0x11fff,
+ 0x11150, 0x1117f,
+ 0x111e0, 0x1167f,
+ 0x116d0, 0x11fff,
0x12480, 0x12fff,
0x13430, 0x167ff,
- 0x16a70, 0x16acf,
- 0x16b90, 0x16eff,
+ 0x16a40, 0x16eff,
0x16fa0, 0x1afff,
- 0x1b100, 0x1bbff,
- 0x1bcb0, 0x1cfff,
+ 0x1b100, 0x1cfff,
0x1d250, 0x1d2ff,
0x1d380, 0x1d3ff,
- 0x1d800, 0x1e7ff,
- 0x1e8e0, 0x1edff,
+ 0x1d800, 0x1edff,
0x1ef00, 0x1efff,
- 0x1f900, 0x1ffff,
+ 0x1f650, 0x1f67f,
+ 0x1f780, 0x1ffff,
0x2a6e0, 0x2a6ff,
0x2b820, 0x2f7ff,
0x2fa20, 0xdffff,
@@ -29225,29 +25671,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Sharada,
CR_Sora_Sompeng,
CR_Takri,
- CR_Caucasian_Albanian,
- CR_Bassa_Vah,
- CR_Duployan,
- CR_Elbasan,
- CR_Grantha,
- CR_Pahawh_Hmong,
- CR_Khojki,
- CR_Linear_A,
- CR_Mahajani,
- CR_Manichaean,
- CR_Mende_Kikakui,
- CR_Modi,
- CR_Mro,
- CR_Old_North_Arabian,
- CR_Nabataean,
- CR_Palmyrene,
- CR_Pau_Cin_Hau,
- CR_Old_Permic,
- CR_Psalter_Pahlavi,
- CR_Siddham,
- CR_Khudawadi,
- CR_Tirhuta,
- CR_Warang_Citi,
CR_White_Space,
CR_Bidi_Control,
CR_Join_Control,
@@ -29281,7 +25704,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Pattern_White_Space,
CR_Pattern_Syntax,
CR_Unknown,
-#ifdef USE_UNICODE_AGE_PROPERTIES
CR_Age_1_1,
CR_Age_2_0,
CR_Age_2_1,
@@ -29295,10 +25717,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_Age_5_2,
CR_Age_6_0,
CR_Age_6_1,
- CR_Age_6_2,
- CR_Age_6_3,
- CR_Age_7_0,
-#endif /* USE_UNICODE_AGE_PROPERTIES */
CR_In_Basic_Latin,
CR_In_Latin_1_Supplement,
CR_In_Latin_Extended_A,
@@ -29354,7 +25772,6 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_In_Khmer_Symbols,
CR_In_Buginese,
CR_In_Tai_Tham,
- CR_In_Combining_Diacritical_Marks_Extended,
CR_In_Balinese,
CR_In_Sundanese,
CR_In_Batak,
@@ -29433,13 +25850,11 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_In_Rejang,
CR_In_Hangul_Jamo_Extended_A,
CR_In_Javanese,
- CR_In_Myanmar_Extended_B,
CR_In_Cham,
CR_In_Myanmar_Extended_A,
CR_In_Tai_Viet,
CR_In_Meetei_Mayek_Extensions,
CR_In_Ethiopic_Extended_A,
- CR_In_Latin_Extended_E,
CR_In_Meetei_Mayek,
CR_In_Hangul_Syllables,
CR_In_Hangul_Jamo_Extended_B,
@@ -29466,83 +25881,54 @@ static const OnigCodePoint* const CodeRanges[] = {
CR_In_Phaistos_Disc,
CR_In_Lycian,
CR_In_Carian,
- CR_In_Coptic_Epact_Numbers,
CR_In_Old_Italic,
CR_In_Gothic,
- CR_In_Old_Permic,
CR_In_Ugaritic,
CR_In_Old_Persian,
CR_In_Deseret,
CR_In_Shavian,
CR_In_Osmanya,
- CR_In_Elbasan,
- CR_In_Caucasian_Albanian,
- CR_In_Linear_A,
CR_In_Cypriot_Syllabary,
CR_In_Imperial_Aramaic,
- CR_In_Palmyrene,
- CR_In_Nabataean,
CR_In_Phoenician,
CR_In_Lydian,
CR_In_Meroitic_Hieroglyphs,
CR_In_Meroitic_Cursive,
CR_In_Kharoshthi,
CR_In_Old_South_Arabian,
- CR_In_Old_North_Arabian,
- CR_In_Manichaean,
CR_In_Avestan,
CR_In_Inscriptional_Parthian,
CR_In_Inscriptional_Pahlavi,
- CR_In_Psalter_Pahlavi,
CR_In_Old_Turkic,
CR_In_Rumi_Numeral_Symbols,
CR_In_Brahmi,
CR_In_Kaithi,
CR_In_Sora_Sompeng,
CR_In_Chakma,
- CR_In_Mahajani,
CR_In_Sharada,
- CR_In_Sinhala_Archaic_Numbers,
- CR_In_Khojki,
- CR_In_Khudawadi,
- CR_In_Grantha,
- CR_In_Tirhuta,
- CR_In_Siddham,
- CR_In_Modi,
CR_In_Takri,
- CR_In_Warang_Citi,
- CR_In_Pau_Cin_Hau,
CR_In_Cuneiform,
CR_In_Cuneiform_Numbers_and_Punctuation,
CR_In_Egyptian_Hieroglyphs,
CR_In_Bamum_Supplement,
- CR_In_Mro,
- CR_In_Bassa_Vah,
- CR_In_Pahawh_Hmong,
CR_In_Miao,
CR_In_Kana_Supplement,
- CR_In_Duployan,
- CR_In_Shorthand_Format_Controls,
CR_In_Byzantine_Musical_Symbols,
CR_In_Musical_Symbols,
CR_In_Ancient_Greek_Musical_Notation,
CR_In_Tai_Xuan_Jing_Symbols,
CR_In_Counting_Rod_Numerals,
CR_In_Mathematical_Alphanumeric_Symbols,
- CR_In_Mende_Kikakui,
CR_In_Arabic_Mathematical_Alphabetic_Symbols,
CR_In_Mahjong_Tiles,
CR_In_Domino_Tiles,
CR_In_Playing_Cards,
CR_In_Enclosed_Alphanumeric_Supplement,
CR_In_Enclosed_Ideographic_Supplement,
- CR_In_Miscellaneous_Symbols_and_Pictographs,
+ CR_In_Miscellaneous_Symbols_And_Pictographs,
CR_In_Emoticons,
- CR_In_Ornamental_Dingbats,
- CR_In_Transport_and_Map_Symbols,
+ CR_In_Transport_And_Map_Symbols,
CR_In_Alchemical_Symbols,
- CR_In_Geometric_Shapes_Extended,
- CR_In_Supplemental_Arrows_C,
CR_In_CJK_Unified_Ideographs_Extension_B,
CR_In_CJK_Unified_Ideographs_Extension_C,
CR_In_CJK_Unified_Ideographs_Extension_D,
@@ -29568,16 +25954,12 @@ static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned
#define MAX_HASH_VALUE 19
/* maximum key range = 14, duplicates = 0 */
#else /* USE_UNICODE_PROPERTIES */
-#ifndef USE_UNICODE_AGE_PROPERTIES
-#define TOTAL_KEYWORDS 689
-#else /* USE_UNICODE_AGE_PROPERTIES */
-#define TOTAL_KEYWORDS 705
-#endif /* USE_UNICODE_AGE_PROPERTIES */
+#define TOTAL_KEYWORDS 625
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 3
-#define MAX_HASH_VALUE 4322
-/* maximum key range = 4320, duplicates = 0 */
+#define MAX_HASH_VALUE 4167
+/* maximum key range = 4165, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
@@ -29613,24 +25995,19 @@ uniname2ctype_hash (str, len)
2, 20, 1, 20, 1, 7, 4, 6, 20, 1,
4, 20, 20, 20, 20, 20, 20, 20
#else /* USE_UNICODE_PROPERTIES */
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
-#ifndef USE_UNICODE_AGE_PROPERTIES
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
-#else /* USE_UNICODE_AGE_PROPERTIES */
- 4323, 4323, 4323, 4323, 4323, 4323, 1, 4323, 12, 1,
- 2, 9, 18, 11, 6, 10, 4323, 4323, 4323, 4323,
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323, 4323,
- 4323, 4323, 4323, 4323, 4323, 4323, 4323, 13, 931, 6,
- 382, 25, 311, 891, 277, 4, 272, 1436, 120, 7,
- 1, 303, 456, 1, 232, 32, 65, 732, 1411, 163,
- 883, 1255, 8, 4323, 4323, 4323, 4323, 4323
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 1, 4168, 13, 1,
+ 3, 28, 31, 10, 27, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168, 4168,
+ 4168, 4168, 4168, 4168, 4168, 4168, 4168, 13, 854, 14,
+ 443, 19, 7, 570, 335, 4, 66, 1159, 102, 34,
+ 1, 178, 474, 1, 192, 2, 64, 1117, 491, 264,
+ 256, 1305, 3, 4168, 4168, 4168, 4168, 4168
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
@@ -29694,722 +26071,630 @@ struct uniname2ctype_pool_t
char uniname2ctype_pool_str19[sizeof("blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("n")];
- char uniname2ctype_pool_str10[sizeof("cn")];
- char uniname2ctype_pool_str11[sizeof("mn")];
- char uniname2ctype_pool_str13[sizeof("c")];
- char uniname2ctype_pool_str15[sizeof("m")];
- char uniname2ctype_pool_str16[sizeof("ci")];
- char uniname2ctype_pool_str17[sizeof("z")];
- char uniname2ctype_pool_str20[sizeof("cc")];
- char uniname2ctype_pool_str21[sizeof("mc")];
- char uniname2ctype_pool_str29[sizeof("mani")];
- char uniname2ctype_pool_str31[sizeof("inmanichaean")];
+ char uniname2ctype_pool_str5[sizeof("s")];
+ char uniname2ctype_pool_str7[sizeof("z")];
+ char uniname2ctype_pool_str9[sizeof("zs")];
+ char uniname2ctype_pool_str16[sizeof("zzzz")];
+ char uniname2ctype_pool_str18[sizeof("cn")];
+ char uniname2ctype_pool_str20[sizeof("cs")];
+ char uniname2ctype_pool_str24[sizeof("ci")];
+ char uniname2ctype_pool_str29[sizeof("c")];
+ char uniname2ctype_pool_str30[sizeof("cf")];
+ char uniname2ctype_pool_str32[sizeof("sc")];
+ char uniname2ctype_pool_str34[sizeof("cans")];
char uniname2ctype_pool_str35[sizeof("qaai")];
- char uniname2ctype_pool_str36[sizeof("zzzz")];
- char uniname2ctype_pool_str37[sizeof("qaac")];
- char uniname2ctype_pool_str44[sizeof("incham")];
- char uniname2ctype_pool_str46[sizeof("sc")];
- char uniname2ctype_pool_str48[sizeof("sm")];
- char uniname2ctype_pool_str51[sizeof("mandaic")];
- char uniname2ctype_pool_str55[sizeof("incuneiform")];
- char uniname2ctype_pool_str56[sizeof("cans")];
- char uniname2ctype_pool_str59[sizeof("me")];
- char uniname2ctype_pool_str61[sizeof("inarmenian")];
- char uniname2ctype_pool_str64[sizeof("ascii")];
- char uniname2ctype_pool_str65[sizeof("s")];
- char uniname2ctype_pool_str69[sizeof("insamaritan")];
- char uniname2ctype_pool_str72[sizeof("cs")];
- char uniname2ctype_pool_str74[sizeof("zs")];
- char uniname2ctype_pool_str85[sizeof("inavestan")];
- char uniname2ctype_pool_str92[sizeof("incommonindicnumberforms")];
- char uniname2ctype_pool_str96[sizeof("incuneiformnumbersandpunctuation")];
- char uniname2ctype_pool_str97[sizeof("inthai")];
- char uniname2ctype_pool_str98[sizeof("inipaextensions")];
- char uniname2ctype_pool_str105[sizeof("mtei")];
- char uniname2ctype_pool_str110[sizeof("inspecials")];
- char uniname2ctype_pool_str114[sizeof("initialpunctuation")];
- char uniname2ctype_pool_str115[sizeof("inancientsymbols")];
- char uniname2ctype_pool_str117[sizeof("inthaana")];
- char uniname2ctype_pool_str130[sizeof("inmiscellaneousmathematicalsymbolsa")];
- char uniname2ctype_pool_str134[sizeof("lc")];
- char uniname2ctype_pool_str135[sizeof("inmusicalsymbols")];
- char uniname2ctype_pool_str136[sizeof("lm")];
- char uniname2ctype_pool_str137[sizeof("taile")];
- char uniname2ctype_pool_str141[sizeof("sterm")];
- char uniname2ctype_pool_str142[sizeof("lina")];
- char uniname2ctype_pool_str144[sizeof("inlycian")];
- char uniname2ctype_pool_str147[sizeof("inmyanmarextendeda")];
- char uniname2ctype_pool_str151[sizeof("lana")];
- char uniname2ctype_pool_str153[sizeof("alnum")];
- char uniname2ctype_pool_str155[sizeof("intaitham")];
- char uniname2ctype_pool_str157[sizeof("incontrolpictures")];
- char uniname2ctype_pool_str161[sizeof("inmiscellaneoussymbols")];
- char uniname2ctype_pool_str163[sizeof("inmalayalam")];
- char uniname2ctype_pool_str166[sizeof("intransportandmapsymbols")];
- char uniname2ctype_pool_str170[sizeof("inmiscellaneoussymbolsandarrows")];
- char uniname2ctype_pool_str173[sizeof("inlineara")];
- char uniname2ctype_pool_str175[sizeof("inmiscellaneoussymbolsandpictographs")];
- char uniname2ctype_pool_str183[sizeof("taiviet")];
- char uniname2ctype_pool_str186[sizeof("cwcm")];
- char uniname2ctype_pool_str190[sizeof("sinhala")];
- char uniname2ctype_pool_str203[sizeof("latn")];
- char uniname2ctype_pool_str205[sizeof("latin")];
- char uniname2ctype_pool_str206[sizeof("ital")];
- char uniname2ctype_pool_str208[sizeof("intamil")];
- char uniname2ctype_pool_str209[sizeof("taml")];
- char uniname2ctype_pool_str223[sizeof("inlatinextendedc")];
- char uniname2ctype_pool_str226[sizeof("intaile")];
- char uniname2ctype_pool_str227[sizeof("tale")];
- char uniname2ctype_pool_str237[sizeof("inlatinextendeda")];
- char uniname2ctype_pool_str239[sizeof("inlinearbideograms")];
- char uniname2ctype_pool_str240[sizeof("newtailue")];
- char uniname2ctype_pool_str241[sizeof("l")];
- char uniname2ctype_pool_str243[sizeof("nl")];
- char uniname2ctype_pool_str247[sizeof("inmeeteimayekextensions")];
- char uniname2ctype_pool_str250[sizeof("zl")];
- char uniname2ctype_pool_str252[sizeof("lt")];
- char uniname2ctype_pool_str255[sizeof("inrunic")];
- char uniname2ctype_pool_str256[sizeof("incarian")];
- char uniname2ctype_pool_str257[sizeof("armn")];
- char uniname2ctype_pool_str259[sizeof("cari")];
- char uniname2ctype_pool_str260[sizeof("armi")];
- char uniname2ctype_pool_str261[sizeof("inlatinextendede")];
- char uniname2ctype_pool_str263[sizeof("incyrillic")];
- char uniname2ctype_pool_str266[sizeof("armenian")];
- char uniname2ctype_pool_str267[sizeof("inmyanmar")];
- char uniname2ctype_pool_str270[sizeof("innewtailue")];
- char uniname2ctype_pool_str272[sizeof("carian")];
- char uniname2ctype_pool_str274[sizeof("merc")];
- char uniname2ctype_pool_str280[sizeof("arabic")];
- char uniname2ctype_pool_str284[sizeof("inmiscellaneoustechnical")];
- char uniname2ctype_pool_str287[sizeof("insyriac")];
- char uniname2ctype_pool_str288[sizeof("samr")];
- char uniname2ctype_pool_str294[sizeof("zinh")];
- char uniname2ctype_pool_str295[sizeof("han")];
- char uniname2ctype_pool_str298[sizeof("samaritan")];
- char uniname2ctype_pool_str299[sizeof("hani")];
- char uniname2ctype_pool_str302[sizeof("cwt")];
- char uniname2ctype_pool_str303[sizeof("incherokee")];
- char uniname2ctype_pool_str304[sizeof("insharada")];
- char uniname2ctype_pool_str307[sizeof("cham")];
- char uniname2ctype_pool_str315[sizeof("manichaean")];
- char uniname2ctype_pool_str316[sizeof("inmahajani")];
- char uniname2ctype_pool_str317[sizeof("cntrl")];
- char uniname2ctype_pool_str318[sizeof("sinh")];
- char uniname2ctype_pool_str320[sizeof("inruminumeralsymbols")];
- char uniname2ctype_pool_str327[sizeof("inethiopic")];
- char uniname2ctype_pool_str330[sizeof("tamil")];
- char uniname2ctype_pool_str331[sizeof("miao")];
- char uniname2ctype_pool_str332[sizeof("inenclosedalphanumerics")];
- char uniname2ctype_pool_str333[sizeof("term")];
- char uniname2ctype_pool_str335[sizeof("chakma")];
- char uniname2ctype_pool_str337[sizeof("insinhala")];
- char uniname2ctype_pool_str347[sizeof("shavian")];
- char uniname2ctype_pool_str350[sizeof("inosmanya")];
- char uniname2ctype_pool_str353[sizeof("inlatinextendedadditional")];
- char uniname2ctype_pool_str359[sizeof("osma")];
- char uniname2ctype_pool_str362[sizeof("ll")];
- char uniname2ctype_pool_str363[sizeof("thai")];
- char uniname2ctype_pool_str366[sizeof("math")];
- char uniname2ctype_pool_str372[sizeof("thaa")];
- char uniname2ctype_pool_str374[sizeof("inenclosedalphanumericsupplement")];
- char uniname2ctype_pool_str375[sizeof("ethi")];
- char uniname2ctype_pool_str376[sizeof("connectorpunctuation")];
- char uniname2ctype_pool_str380[sizeof("inlowsurrogates")];
- char uniname2ctype_pool_str382[sizeof("insinhalaarchaicnumbers")];
- char uniname2ctype_pool_str386[sizeof("taitham")];
- char uniname2ctype_pool_str388[sizeof("thaana")];
- char uniname2ctype_pool_str390[sizeof("lineara")];
- char uniname2ctype_pool_str392[sizeof("di")];
- char uniname2ctype_pool_str401[sizeof("idc")];
- char uniname2ctype_pool_str405[sizeof("meroiticcursive")];
- char uniname2ctype_pool_str407[sizeof("mand")];
- char uniname2ctype_pool_str408[sizeof("inmodi")];
- char uniname2ctype_pool_str410[sizeof("inmandaic")];
- char uniname2ctype_pool_str412[sizeof("cwl")];
- char uniname2ctype_pool_str414[sizeof("asciihexdigit")];
- char uniname2ctype_pool_str415[sizeof("dia")];
- char uniname2ctype_pool_str418[sizeof("terminalpunctuation")];
- char uniname2ctype_pool_str419[sizeof("mend")];
- char uniname2ctype_pool_str423[sizeof("sind")];
- char uniname2ctype_pool_str425[sizeof("wara")];
- char uniname2ctype_pool_str433[sizeof("inwarangciti")];
- char uniname2ctype_pool_str439[sizeof("inideographicdescriptioncharacters")];
- char uniname2ctype_pool_str441[sizeof("inemoticons")];
- char uniname2ctype_pool_str453[sizeof("ids")];
- char uniname2ctype_pool_str456[sizeof("insundanese")];
- char uniname2ctype_pool_str466[sizeof("pi")];
- char uniname2ctype_pool_str468[sizeof("indominotiles")];
- char uniname2ctype_pool_str470[sizeof("pc")];
- char uniname2ctype_pool_str476[sizeof("loe")];
- char uniname2ctype_pool_str477[sizeof("titlecaseletter")];
- char uniname2ctype_pool_str485[sizeof("inopticalcharacterrecognition")];
- char uniname2ctype_pool_str487[sizeof("idst")];
- char uniname2ctype_pool_str489[sizeof("shaw")];
- char uniname2ctype_pool_str490[sizeof("cwcf")];
- char uniname2ctype_pool_str493[sizeof("idcontinue")];
- char uniname2ctype_pool_str502[sizeof("inphaistosdisc")];
- char uniname2ctype_pool_str508[sizeof("pe")];
- char uniname2ctype_pool_str518[sizeof("indeseret")];
- char uniname2ctype_pool_str519[sizeof("inspacingmodifierletters")];
- char uniname2ctype_pool_str520[sizeof("inlydian")];
- char uniname2ctype_pool_str522[sizeof("ps")];
- char uniname2ctype_pool_str530[sizeof("hira")];
- char uniname2ctype_pool_str536[sizeof("whitespace")];
- char uniname2ctype_pool_str540[sizeof("inscriptionalparthian")];
- char uniname2ctype_pool_str544[sizeof("cher")];
- char uniname2ctype_pool_str545[sizeof("inmathematicalalphanumericsymbols")];
- char uniname2ctype_pool_str546[sizeof("incoptic")];
- char uniname2ctype_pool_str550[sizeof("inhiragana")];
- char uniname2ctype_pool_str554[sizeof("inenclosedcjklettersandmonths")];
- char uniname2ctype_pool_str556[sizeof("space")];
- char uniname2ctype_pool_str570[sizeof("oriya")];
- char uniname2ctype_pool_str571[sizeof("mero")];
- char uniname2ctype_pool_str573[sizeof("mahj")];
- char uniname2ctype_pool_str582[sizeof("tirh")];
- char uniname2ctype_pool_str584[sizeof("sora")];
- char uniname2ctype_pool_str587[sizeof("inscriptionalpahlavi")];
- char uniname2ctype_pool_str593[sizeof("inarrows")];
- char uniname2ctype_pool_str594[sizeof("mahajani")];
- char uniname2ctype_pool_str596[sizeof("joinc")];
- char uniname2ctype_pool_str597[sizeof("incopticepactnumbers")];
- char uniname2ctype_pool_str598[sizeof("hano")];
- char uniname2ctype_pool_str600[sizeof("palm")];
- char uniname2ctype_pool_str601[sizeof("intirhuta")];
- char uniname2ctype_pool_str603[sizeof("patws")];
- char uniname2ctype_pool_str604[sizeof("inolchiki")];
- char uniname2ctype_pool_str608[sizeof("inlepcha")];
- char uniname2ctype_pool_str609[sizeof("no")];
- char uniname2ctype_pool_str611[sizeof("lepc")];
- char uniname2ctype_pool_str612[sizeof("inogham")];
- char uniname2ctype_pool_str614[sizeof("co")];
- char uniname2ctype_pool_str617[sizeof("innko")];
+ char uniname2ctype_pool_str38[sizeof("mn")];
+ char uniname2ctype_pool_str42[sizeof("ascii")];
+ char uniname2ctype_pool_str44[sizeof("cc")];
+ char uniname2ctype_pool_str45[sizeof("qaac")];
+ char uniname2ctype_pool_str49[sizeof("inavestan")];
+ char uniname2ctype_pool_str52[sizeof("inspecials")];
+ char uniname2ctype_pool_str62[sizeof("inipaextensions")];
+ char uniname2ctype_pool_str64[sizeof("mc")];
+ char uniname2ctype_pool_str66[sizeof("insamaritan")];
+ char uniname2ctype_pool_str69[sizeof("m")];
+ char uniname2ctype_pool_str72[sizeof("sm")];
+ char uniname2ctype_pool_str74[sizeof("me")];
+ char uniname2ctype_pool_str82[sizeof("inarmenian")];
+ char uniname2ctype_pool_str84[sizeof("incuneiform")];
+ char uniname2ctype_pool_str86[sizeof("mandaic")];
+ char uniname2ctype_pool_str90[sizeof("inancientsymbols")];
+ char uniname2ctype_pool_str92[sizeof("incuneiformnumbersandpunctuation")];
+ char uniname2ctype_pool_str96[sizeof("inthai")];
+ char uniname2ctype_pool_str99[sizeof("inmusicalsymbols")];
+ char uniname2ctype_pool_str100[sizeof("inmiscellaneoussymbols")];
+ char uniname2ctype_pool_str106[sizeof("incham")];
+ char uniname2ctype_pool_str109[sizeof("inmiscellaneoussymbolsandarrows")];
+ char uniname2ctype_pool_str113[sizeof("initialpunctuation")];
+ char uniname2ctype_pool_str114[sizeof("inmiscellaneoussymbolsandpictographs")];
+ char uniname2ctype_pool_str116[sizeof("inthaana")];
+ char uniname2ctype_pool_str124[sizeof("taile")];
+ char uniname2ctype_pool_str125[sizeof("mtei")];
+ char uniname2ctype_pool_str132[sizeof("lc")];
+ char uniname2ctype_pool_str133[sizeof("lana")];
+ char uniname2ctype_pool_str134[sizeof("inlycian")];
+ char uniname2ctype_pool_str135[sizeof("intransportandmapsymbols")];
+ char uniname2ctype_pool_str136[sizeof("incontrolpictures")];
+ char uniname2ctype_pool_str142[sizeof("sinhala")];
+ char uniname2ctype_pool_str151[sizeof("incommonindicnumberforms")];
+ char uniname2ctype_pool_str156[sizeof("inmiscellaneousmathematicalsymbolsa")];
+ char uniname2ctype_pool_str158[sizeof("sterm")];
+ char uniname2ctype_pool_str167[sizeof("inmyanmarextendeda")];
+ char uniname2ctype_pool_str172[sizeof("lm")];
+ char uniname2ctype_pool_str175[sizeof("taiviet")];
+ char uniname2ctype_pool_str179[sizeof("inlinearbideograms")];
+ char uniname2ctype_pool_str180[sizeof("intaitham")];
+ char uniname2ctype_pool_str184[sizeof("latn")];
+ char uniname2ctype_pool_str186[sizeof("latin")];
+ char uniname2ctype_pool_str187[sizeof("ital")];
+ char uniname2ctype_pool_str189[sizeof("alnum")];
+ char uniname2ctype_pool_str199[sizeof("inmalayalam")];
+ char uniname2ctype_pool_str201[sizeof("intaile")];
+ char uniname2ctype_pool_str202[sizeof("tale")];
+ char uniname2ctype_pool_str205[sizeof("l")];
+ char uniname2ctype_pool_str207[sizeof("nl")];
+ char uniname2ctype_pool_str209[sizeof("zl")];
+ char uniname2ctype_pool_str216[sizeof("intamil")];
+ char uniname2ctype_pool_str217[sizeof("taml")];
+ char uniname2ctype_pool_str218[sizeof("inlatinextendeda")];
+ char uniname2ctype_pool_str220[sizeof("inlatinextendedc")];
+ char uniname2ctype_pool_str223[sizeof("inrunic")];
+ char uniname2ctype_pool_str224[sizeof("incarian")];
+ char uniname2ctype_pool_str225[sizeof("insyriac")];
+ char uniname2ctype_pool_str227[sizeof("cari")];
+ char uniname2ctype_pool_str230[sizeof("inmeeteimayekextensions")];
+ char uniname2ctype_pool_str231[sizeof("osma")];
+ char uniname2ctype_pool_str232[sizeof("lt")];
+ char uniname2ctype_pool_str233[sizeof("miao")];
+ char uniname2ctype_pool_str234[sizeof("insharada")];
+ char uniname2ctype_pool_str239[sizeof("incyrillic")];
+ char uniname2ctype_pool_str240[sizeof("carian")];
+ char uniname2ctype_pool_str244[sizeof("armn")];
+ char uniname2ctype_pool_str245[sizeof("samr")];
+ char uniname2ctype_pool_str247[sizeof("armi")];
+ char uniname2ctype_pool_str248[sizeof("inideographicdescriptioncharacters")];
+ char uniname2ctype_pool_str252[sizeof("inosmanya")];
+ char uniname2ctype_pool_str253[sizeof("armenian")];
+ char uniname2ctype_pool_str254[sizeof("inmyanmar")];
+ char uniname2ctype_pool_str255[sizeof("samaritan")];
+ char uniname2ctype_pool_str256[sizeof("arabic")];
+ char uniname2ctype_pool_str259[sizeof("incherokee")];
+ char uniname2ctype_pool_str261[sizeof("connectorpunctuation")];
+ char uniname2ctype_pool_str263[sizeof("merc")];
+ char uniname2ctype_pool_str264[sizeof("inmiscellaneoustechnical")];
+ char uniname2ctype_pool_str268[sizeof("inenclosedalphanumerics")];
+ char uniname2ctype_pool_str279[sizeof("inemoticons")];
+ char uniname2ctype_pool_str281[sizeof("joinc")];
+ char uniname2ctype_pool_str288[sizeof("cntrl")];
+ char uniname2ctype_pool_str301[sizeof("inenclosedcjklettersandmonths")];
+ char uniname2ctype_pool_str303[sizeof("cwcf")];
+ char uniname2ctype_pool_str304[sizeof("inruminumeralsymbols")];
+ char uniname2ctype_pool_str308[sizeof("ll")];
+ char uniname2ctype_pool_str313[sizeof("term")];
+ char uniname2ctype_pool_str316[sizeof("inlatinextendedadditional")];
+ char uniname2ctype_pool_str320[sizeof("tamil")];
+ char uniname2ctype_pool_str321[sizeof("loe")];
+ char uniname2ctype_pool_str329[sizeof("newtailue")];
+ char uniname2ctype_pool_str330[sizeof("cwcm")];
+ char uniname2ctype_pool_str339[sizeof("inenclosedalphanumericsupplement")];
+ char uniname2ctype_pool_str346[sizeof("sinh")];
+ char uniname2ctype_pool_str347[sizeof("zinh")];
+ char uniname2ctype_pool_str349[sizeof("meroiticcursive")];
+ char uniname2ctype_pool_str353[sizeof("han")];
+ char uniname2ctype_pool_str357[sizeof("hani")];
+ char uniname2ctype_pool_str358[sizeof("inopticalcharacterrecognition")];
+ char uniname2ctype_pool_str359[sizeof("no")];
+ char uniname2ctype_pool_str360[sizeof("so")];
+ char uniname2ctype_pool_str364[sizeof("innewtailue")];
+ char uniname2ctype_pool_str365[sizeof("insinhala")];
+ char uniname2ctype_pool_str367[sizeof("innko")];
+ char uniname2ctype_pool_str372[sizeof("co")];
+ char uniname2ctype_pool_str375[sizeof("shavian")];
+ char uniname2ctype_pool_str378[sizeof("terminalpunctuation")];
+ char uniname2ctype_pool_str386[sizeof("intaixuanjingsymbols")];
+ char uniname2ctype_pool_str387[sizeof("inethiopic")];
+ char uniname2ctype_pool_str389[sizeof("sora")];
+ char uniname2ctype_pool_str398[sizeof("inarrows")];
+ char uniname2ctype_pool_str400[sizeof("cham")];
+ char uniname2ctype_pool_str403[sizeof("inlowsurrogates")];
+ char uniname2ctype_pool_str405[sizeof("oriya")];
+ char uniname2ctype_pool_str406[sizeof("ext")];
+ char uniname2ctype_pool_str409[sizeof("cwt")];
+ char uniname2ctype_pool_str412[sizeof("common")];
+ char uniname2ctype_pool_str414[sizeof("inmiao")];
+ char uniname2ctype_pool_str420[sizeof("thai")];
+ char uniname2ctype_pool_str425[sizeof("intifinagh")];
+ char uniname2ctype_pool_str426[sizeof("ethi")];
+ char uniname2ctype_pool_str427[sizeof("mero")];
+ char uniname2ctype_pool_str428[sizeof("chakma")];
+ char uniname2ctype_pool_str429[sizeof("thaa")];
+ char uniname2ctype_pool_str430[sizeof("inscriptionalparthian")];
+ char uniname2ctype_pool_str432[sizeof("tifinagh")];
+ char uniname2ctype_pool_str436[sizeof("titlecaseletter")];
+ char uniname2ctype_pool_str445[sizeof("thaana")];
+ char uniname2ctype_pool_str449[sizeof("asciihexdigit")];
+ char uniname2ctype_pool_str450[sizeof("math")];
+ char uniname2ctype_pool_str453[sizeof("di")];
+ char uniname2ctype_pool_str454[sizeof("ids")];
+ char uniname2ctype_pool_str460[sizeof("lo")];
+ char uniname2ctype_pool_str468[sizeof("inlao")];
+ char uniname2ctype_pool_str470[sizeof("taitham")];
+ char uniname2ctype_pool_str474[sizeof("lao")];
+ char uniname2ctype_pool_str475[sizeof("laoo")];
+ char uniname2ctype_pool_str476[sizeof("dia")];
+ char uniname2ctype_pool_str478[sizeof("idc")];
+ char uniname2ctype_pool_str480[sizeof("ps")];
+ char uniname2ctype_pool_str481[sizeof("insundanese")];
+ char uniname2ctype_pool_str484[sizeof("pi")];
+ char uniname2ctype_pool_str485[sizeof("cwl")];
+ char uniname2ctype_pool_str490[sizeof("pf")];
+ char uniname2ctype_pool_str495[sizeof("mand")];
+ char uniname2ctype_pool_str496[sizeof("insylotinagri")];
+ char uniname2ctype_pool_str497[sizeof("vs")];
+ char uniname2ctype_pool_str503[sizeof("mongolian")];
+ char uniname2ctype_pool_str504[sizeof("pc")];
+ char uniname2ctype_pool_str506[sizeof("inmandaic")];
+ char uniname2ctype_pool_str509[sizeof("invai")];
+ char uniname2ctype_pool_str511[sizeof("lineseparator")];
+ char uniname2ctype_pool_str514[sizeof("pe")];
+ char uniname2ctype_pool_str515[sizeof("vai")];
+ char uniname2ctype_pool_str516[sizeof("vaii")];
+ char uniname2ctype_pool_str517[sizeof("idst")];
+ char uniname2ctype_pool_str520[sizeof("indominotiles")];
+ char uniname2ctype_pool_str521[sizeof("inshavian")];
+ char uniname2ctype_pool_str522[sizeof("inspacingmodifierletters")];
+ char uniname2ctype_pool_str524[sizeof("format")];
+ char uniname2ctype_pool_str528[sizeof("inphaistosdisc")];
+ char uniname2ctype_pool_str531[sizeof("hano")];
+ char uniname2ctype_pool_str532[sizeof("space")];
+ char uniname2ctype_pool_str542[sizeof("indeseret")];
+ char uniname2ctype_pool_str545[sizeof("inolchiki")];
+ char uniname2ctype_pool_str548[sizeof("hira")];
+ char uniname2ctype_pool_str553[sizeof("joincontrol")];
+ char uniname2ctype_pool_str555[sizeof("idcontinue")];
+ char uniname2ctype_pool_str558[sizeof("inmahjongtiles")];
+ char uniname2ctype_pool_str560[sizeof("patws")];
+ char uniname2ctype_pool_str563[sizeof("inlydian")];
+ char uniname2ctype_pool_str564[sizeof("cher")];
+ char uniname2ctype_pool_str568[sizeof("inhiragana")];
+ char uniname2ctype_pool_str572[sizeof("inogham")];
+ char uniname2ctype_pool_str574[sizeof("avst")];
+ char uniname2ctype_pool_str575[sizeof("inscriptionalpahlavi")];
+ char uniname2ctype_pool_str579[sizeof("incoptic")];
+ char uniname2ctype_pool_str587[sizeof("java")];
+ char uniname2ctype_pool_str589[sizeof("inmathematicalalphanumericsymbols")];
+ char uniname2ctype_pool_str594[sizeof("letter")];
+ char uniname2ctype_pool_str604[sizeof("injavanese")];
+ char uniname2ctype_pool_str608[sizeof("avestan")];
+ char uniname2ctype_pool_str612[sizeof("age=1.1")];
+ char uniname2ctype_pool_str613[sizeof("lepc")];
+ char uniname2ctype_pool_str614[sizeof("age=2.1")];
+ char uniname2ctype_pool_str616[sizeof("inlepcha")];
+ char uniname2ctype_pool_str617[sizeof("javanese")];
+ char uniname2ctype_pool_str618[sizeof("shaw")];
+ char uniname2ctype_pool_str619[sizeof("finalpunctuation")];
char uniname2ctype_pool_str620[sizeof("alpha")];
- char uniname2ctype_pool_str622[sizeof("psalterpahlavi")];
- char uniname2ctype_pool_str623[sizeof("inmro")];
- char uniname2ctype_pool_str624[sizeof("inpalmyrene")];
- char uniname2ctype_pool_str627[sizeof("common")];
- char uniname2ctype_pool_str630[sizeof("cf")];
- char uniname2ctype_pool_str637[sizeof("inmiao")];
- char uniname2ctype_pool_str640[sizeof("so")];
- char uniname2ctype_pool_str650[sizeof("diacritic")];
- char uniname2ctype_pool_str658[sizeof("insundanesesupplement")];
- char uniname2ctype_pool_str672[sizeof("intifinagh")];
- char uniname2ctype_pool_str679[sizeof("tifinagh")];
- char uniname2ctype_pool_str696[sizeof("odi")];
- char uniname2ctype_pool_str699[sizeof("oidc")];
- char uniname2ctype_pool_str700[sizeof("modi")];
- char uniname2ctype_pool_str703[sizeof("decimalnumber")];
- char uniname2ctype_pool_str705[sizeof("letter")];
- char uniname2ctype_pool_str708[sizeof("dash")];
- char uniname2ctype_pool_str709[sizeof("insylotinagri")];
- char uniname2ctype_pool_str711[sizeof("inolditalic")];
- char uniname2ctype_pool_str713[sizeof("wspace")];
- char uniname2ctype_pool_str715[sizeof("dsrt")];
- char uniname2ctype_pool_str718[sizeof("ideo")];
- char uniname2ctype_pool_str722[sizeof("siddham")];
- char uniname2ctype_pool_str724[sizeof("perm")];
- char uniname2ctype_pool_str725[sizeof("oids")];
- char uniname2ctype_pool_str727[sizeof("inmahjongtiles")];
- char uniname2ctype_pool_str728[sizeof("lo")];
- char uniname2ctype_pool_str730[sizeof("lineseparator")];
- char uniname2ctype_pool_str731[sizeof("imperialaramaic")];
- char uniname2ctype_pool_str735[sizeof("idstart")];
- char uniname2ctype_pool_str736[sizeof("inlao")];
- char uniname2ctype_pool_str737[sizeof("sharada")];
- char uniname2ctype_pool_str742[sizeof("lao")];
- char uniname2ctype_pool_str743[sizeof("laoo")];
- char uniname2ctype_pool_str744[sizeof("mongolian")];
- char uniname2ctype_pool_str745[sizeof("oalpha")];
- char uniname2ctype_pool_str749[sizeof("inimperialaramaic")];
- char uniname2ctype_pool_str753[sizeof("nchar")];
- char uniname2ctype_pool_str758[sizeof("inlatin1supplement")];
- char uniname2ctype_pool_str761[sizeof("prti")];
- char uniname2ctype_pool_str763[sizeof("cprt")];
- char uniname2ctype_pool_str767[sizeof("nd")];
- char uniname2ctype_pool_str768[sizeof("deseret")];
- char uniname2ctype_pool_str772[sizeof("inoldturkic")];
- char uniname2ctype_pool_str773[sizeof("radical")];
- char uniname2ctype_pool_str777[sizeof("canadianaboriginal")];
- char uniname2ctype_pool_str779[sizeof("inmodifiertoneletters")];
- char uniname2ctype_pool_str783[sizeof("incaucasianalbanian")];
- char uniname2ctype_pool_str787[sizeof("coptic")];
- char uniname2ctype_pool_str796[sizeof("casedletter")];
- char uniname2ctype_pool_str798[sizeof("sd")];
- char uniname2ctype_pool_str803[sizeof("inphoenician")];
- char uniname2ctype_pool_str804[sizeof("sidd")];
- char uniname2ctype_pool_str805[sizeof("privateuse")];
- char uniname2ctype_pool_str813[sizeof("sundanese")];
- char uniname2ctype_pool_str815[sizeof("inancientgreekmusicalnotation")];
- char uniname2ctype_pool_str817[sizeof("insiddham")];
- char uniname2ctype_pool_str820[sizeof("cased")];
- char uniname2ctype_pool_str827[sizeof("print")];
- char uniname2ctype_pool_str830[sizeof("ininscriptionalparthian")];
- char uniname2ctype_pool_str832[sizeof("ininscriptionalpahlavi")];
- char uniname2ctype_pool_str834[sizeof("copt")];
- char uniname2ctype_pool_str838[sizeof("inancientgreeknumbers")];
- char uniname2ctype_pool_str845[sizeof("saurashtra")];
- char uniname2ctype_pool_str848[sizeof("mro")];
- char uniname2ctype_pool_str849[sizeof("mroo")];
- char uniname2ctype_pool_str850[sizeof("inalphabeticpresentationforms")];
- char uniname2ctype_pool_str858[sizeof("lowercase")];
- char uniname2ctype_pool_str861[sizeof("phli")];
- char uniname2ctype_pool_str864[sizeof("patternwhitespace")];
- char uniname2ctype_pool_str866[sizeof("inenclosedideographicsupplement")];
- char uniname2ctype_pool_str869[sizeof("spaceseparator")];
- char uniname2ctype_pool_str871[sizeof("inmathematicaloperators")];
- char uniname2ctype_pool_str882[sizeof("omath")];
- char uniname2ctype_pool_str892[sizeof("lisu")];
- char uniname2ctype_pool_str895[sizeof("inpsalterpahlavi")];
- char uniname2ctype_pool_str898[sizeof("olditalic")];
- char uniname2ctype_pool_str905[sizeof("hanunoo")];
- char uniname2ctype_pool_str909[sizeof("inherited")];
- char uniname2ctype_pool_str910[sizeof("lepcha")];
- char uniname2ctype_pool_str913[sizeof("p")];
- char uniname2ctype_pool_str916[sizeof("inmongolian")];
- char uniname2ctype_pool_str922[sizeof("zp")];
- char uniname2ctype_pool_str923[sizeof("finalpunctuation")];
- char uniname2ctype_pool_str925[sizeof("otheridcontinue")];
- char uniname2ctype_pool_str927[sizeof("shrd")];
- char uniname2ctype_pool_str932[sizeof("ingrantha")];
- char uniname2ctype_pool_str934[sizeof("talu")];
- char uniname2ctype_pool_str936[sizeof("otheralphabetic")];
- char uniname2ctype_pool_str938[sizeof("noncharactercodepoint")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str939[sizeof("age=1.1")];
- char uniname2ctype_pool_str940[sizeof("age=2.1")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str941[sizeof("closepunctuation")];
- char uniname2ctype_pool_str943[sizeof("letternumber")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str944[sizeof("age=6.1")];
- char uniname2ctype_pool_str945[sizeof("age=6.2")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str946[sizeof("telu")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str947[sizeof("age=3.1")];
- char uniname2ctype_pool_str948[sizeof("age=3.2")];
- char uniname2ctype_pool_str949[sizeof("age=5.1")];
- char uniname2ctype_pool_str950[sizeof("age=5.2")];
- char uniname2ctype_pool_str951[sizeof("age=2.0")];
- char uniname2ctype_pool_str952[sizeof("age=6.3")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str953[sizeof("inshorthandformatcontrols")];
- char uniname2ctype_pool_str954[sizeof("inoldnortharabian")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str955[sizeof("age=6.0")];
- char uniname2ctype_pool_str956[sizeof("age=4.1")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str957[sizeof("ingeneralpunctuation")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str958[sizeof("age=3.0")];
- char uniname2ctype_pool_str959[sizeof("age=7.0")];
- char uniname2ctype_pool_str960[sizeof("age=5.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str962[sizeof("innabataean")];
-#ifdef USE_UNICODE_AGE_PROPERTIES
- char uniname2ctype_pool_str967[sizeof("age=4.0")];
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- char uniname2ctype_pool_str970[sizeof("bamum")];
- char uniname2ctype_pool_str972[sizeof("control")];
- char uniname2ctype_pool_str974[sizeof("induployan")];
- char uniname2ctype_pool_str975[sizeof("inlatinextendedd")];
- char uniname2ctype_pool_str976[sizeof("inarabic")];
- char uniname2ctype_pool_str982[sizeof("runic")];
- char uniname2ctype_pool_str984[sizeof("inelbasan")];
- char uniname2ctype_pool_str985[sizeof("inoldsoutharabian")];
- char uniname2ctype_pool_str986[sizeof("inbasiclatin")];
- char uniname2ctype_pool_str995[sizeof("format")];
- char uniname2ctype_pool_str996[sizeof("innumberforms")];
- char uniname2ctype_pool_str998[sizeof("inugaritic")];
- char uniname2ctype_pool_str999[sizeof("separator")];
- char uniname2ctype_pool_str1000[sizeof("idsbinaryoperator")];
- char uniname2ctype_pool_str1004[sizeof("tagbanwa")];
- char uniname2ctype_pool_str1012[sizeof("bass")];
- char uniname2ctype_pool_str1013[sizeof("saur")];
- char uniname2ctype_pool_str1014[sizeof("nbat")];
- char uniname2ctype_pool_str1017[sizeof("intaixuanjingsymbols")];
- char uniname2ctype_pool_str1019[sizeof("joincontrol")];
- char uniname2ctype_pool_str1023[sizeof("otheridstart")];
- char uniname2ctype_pool_str1027[sizeof("inbyzantinemusicalsymbols")];
- char uniname2ctype_pool_str1031[sizeof("intags")];
- char uniname2ctype_pool_str1033[sizeof("nabataean")];
- char uniname2ctype_pool_str1034[sizeof("insuperscriptsandsubscripts")];
- char uniname2ctype_pool_str1036[sizeof("intibetan")];
- char uniname2ctype_pool_str1039[sizeof("insaurashtra")];
- char uniname2ctype_pool_str1040[sizeof("othersymbol")];
- char uniname2ctype_pool_str1041[sizeof("ext")];
- char uniname2ctype_pool_str1046[sizeof("inarabicpresentationformsa")];
- char uniname2ctype_pool_str1048[sizeof("inmiscellaneousmathematicalsymbolsb")];
- char uniname2ctype_pool_str1049[sizeof("otherlowercase")];
- char uniname2ctype_pool_str1052[sizeof("phoenician")];
- char uniname2ctype_pool_str1055[sizeof("lower")];
- char uniname2ctype_pool_str1060[sizeof("linb")];
- char uniname2ctype_pool_str1064[sizeof("po")];
- char uniname2ctype_pool_str1065[sizeof("inmyanmarextendedb")];
- char uniname2ctype_pool_str1066[sizeof("limb")];
- char uniname2ctype_pool_str1068[sizeof("inbraillepatterns")];
- char uniname2ctype_pool_str1069[sizeof("tibt")];
- char uniname2ctype_pool_str1070[sizeof("cuneiform")];
- char uniname2ctype_pool_str1072[sizeof("bali")];
- char uniname2ctype_pool_str1073[sizeof("oldpersian")];
- char uniname2ctype_pool_str1077[sizeof("oldpermic")];
- char uniname2ctype_pool_str1080[sizeof("pf")];
- char uniname2ctype_pool_str1084[sizeof("word")];
- char uniname2ctype_pool_str1086[sizeof("tibetan")];
- char uniname2ctype_pool_str1089[sizeof("incyrillicsupplement")];
- char uniname2ctype_pool_str1093[sizeof("elba")];
- char uniname2ctype_pool_str1094[sizeof("insupplementalmathematicaloperators")];
- char uniname2ctype_pool_str1095[sizeof("inbalinese")];
- char uniname2ctype_pool_str1101[sizeof("bengali")];
- char uniname2ctype_pool_str1104[sizeof("caseignorable")];
- char uniname2ctype_pool_str1107[sizeof("incountingrodnumerals")];
- char uniname2ctype_pool_str1114[sizeof("other")];
- char uniname2ctype_pool_str1118[sizeof("tirhuta")];
- char uniname2ctype_pool_str1121[sizeof("othernumber")];
- char uniname2ctype_pool_str1123[sizeof("balinese")];
- char uniname2ctype_pool_str1129[sizeof("elbasan")];
- char uniname2ctype_pool_str1134[sizeof("inunifiedcanadianaboriginalsyllabics")];
- char uniname2ctype_pool_str1136[sizeof("lowercaseletter")];
- char uniname2ctype_pool_str1140[sizeof("ethiopic")];
- char uniname2ctype_pool_str1141[sizeof("gran")];
- char uniname2ctype_pool_str1149[sizeof("ingurmukhi")];
- char uniname2ctype_pool_str1151[sizeof("sund")];
- char uniname2ctype_pool_str1153[sizeof("inethiopicsupplement")];
- char uniname2ctype_pool_str1160[sizeof("inoldpersian")];
- char uniname2ctype_pool_str1163[sizeof("inoldpermic")];
- char uniname2ctype_pool_str1170[sizeof("othermath")];
- char uniname2ctype_pool_str1174[sizeof("unassigned")];
- char uniname2ctype_pool_str1180[sizeof("hmng")];
- char uniname2ctype_pool_str1181[sizeof("narb")];
- char uniname2ctype_pool_str1184[sizeof("brai")];
- char uniname2ctype_pool_str1186[sizeof("hang")];
- char uniname2ctype_pool_str1187[sizeof("insorasompeng")];
- char uniname2ctype_pool_str1193[sizeof("arab")];
- char uniname2ctype_pool_str1194[sizeof("plrd")];
- char uniname2ctype_pool_str1195[sizeof("ingujarati")];
- char uniname2ctype_pool_str1197[sizeof("brahmi")];
- char uniname2ctype_pool_str1201[sizeof("runr")];
- char uniname2ctype_pool_str1202[sizeof("ahex")];
- char uniname2ctype_pool_str1206[sizeof("mong")];
- char uniname2ctype_pool_str1211[sizeof("pauc")];
- char uniname2ctype_pool_str1212[sizeof("sarb")];
- char uniname2ctype_pool_str1218[sizeof("ogam")];
- char uniname2ctype_pool_str1221[sizeof("olower")];
- char uniname2ctype_pool_str1222[sizeof("pd")];
- char uniname2ctype_pool_str1235[sizeof("number")];
- char uniname2ctype_pool_str1238[sizeof("inbrahmi")];
- char uniname2ctype_pool_str1240[sizeof("otherletter")];
- char uniname2ctype_pool_str1252[sizeof("ingothic")];
- char uniname2ctype_pool_str1254[sizeof("phagspa")];
- char uniname2ctype_pool_str1262[sizeof("inletterlikesymbols")];
- char uniname2ctype_pool_str1265[sizeof("yi")];
- char uniname2ctype_pool_str1269[sizeof("hangul")];
- char uniname2ctype_pool_str1271[sizeof("yiii")];
- char uniname2ctype_pool_str1272[sizeof("tfng")];
- char uniname2ctype_pool_str1273[sizeof("insupplementalarrowsc")];
- char uniname2ctype_pool_str1277[sizeof("ingreekandcoptic")];
- char uniname2ctype_pool_str1279[sizeof("xidc")];
- char uniname2ctype_pool_str1280[sizeof("insupplementalarrowsa")];
- char uniname2ctype_pool_str1281[sizeof("gothic")];
- char uniname2ctype_pool_str1283[sizeof("grext")];
- char uniname2ctype_pool_str1285[sizeof("incombininghalfmarks")];
- char uniname2ctype_pool_str1286[sizeof("deprecated")];
- char uniname2ctype_pool_str1287[sizeof("inbassavah")];
- char uniname2ctype_pool_str1305[sizeof("xids")];
- char uniname2ctype_pool_str1308[sizeof("linearb")];
- char uniname2ctype_pool_str1312[sizeof("ingeometricshapes")];
- char uniname2ctype_pool_str1313[sizeof("phlp")];
- char uniname2ctype_pool_str1314[sizeof("warangciti")];
- char uniname2ctype_pool_str1317[sizeof("inblockelements")];
- char uniname2ctype_pool_str1318[sizeof("modifierletter")];
- char uniname2ctype_pool_str1321[sizeof("indingbats")];
- char uniname2ctype_pool_str1322[sizeof("dep")];
- char uniname2ctype_pool_str1324[sizeof("punct")];
- char uniname2ctype_pool_str1327[sizeof("inhanunoo")];
+ char uniname2ctype_pool_str621[sizeof("age=5.1")];
+ char uniname2ctype_pool_str622[sizeof("inmongolian")];
+ char uniname2ctype_pool_str623[sizeof("age=5.2")];
+ char uniname2ctype_pool_str626[sizeof("age=2.0")];
+ char uniname2ctype_pool_str627[sizeof("ahex")];
+ char uniname2ctype_pool_str630[sizeof("ingeneralpunctuation")];
+ char uniname2ctype_pool_str631[sizeof("oids")];
+ char uniname2ctype_pool_str632[sizeof("odi")];
+ char uniname2ctype_pool_str633[sizeof("age=5.0")];
+ char uniname2ctype_pool_str636[sizeof("tavt")];
+ char uniname2ctype_pool_str637[sizeof("intaiviet")];
+ char uniname2ctype_pool_str638[sizeof("age=6.1")];
+ char uniname2ctype_pool_str639[sizeof("age=3.1")];
+ char uniname2ctype_pool_str640[sizeof("insundanesesupplement")];
+ char uniname2ctype_pool_str641[sizeof("age=3.2")];
+ char uniname2ctype_pool_str642[sizeof("age=4.1")];
+ char uniname2ctype_pool_str643[sizeof("oidc")];
+ char uniname2ctype_pool_str646[sizeof("tfng")];
+ char uniname2ctype_pool_str647[sizeof("insmallformvariants")];
+ char uniname2ctype_pool_str648[sizeof("ideo")];
+ char uniname2ctype_pool_str649[sizeof("intags")];
+ char uniname2ctype_pool_str650[sizeof("age=6.0")];
+ char uniname2ctype_pool_str651[sizeof("age=3.0")];
+ char uniname2ctype_pool_str653[sizeof("whitespace")];
+ char uniname2ctype_pool_str654[sizeof("age=4.0")];
+ char uniname2ctype_pool_str655[sizeof("inolditalic")];
+ char uniname2ctype_pool_str660[sizeof("oalpha")];
+ char uniname2ctype_pool_str668[sizeof("ingujarati")];
+ char uniname2ctype_pool_str672[sizeof("control")];
+ char uniname2ctype_pool_str679[sizeof("diacritic")];
+ char uniname2ctype_pool_str682[sizeof("tagbanwa")];
+ char uniname2ctype_pool_str690[sizeof("inphoenician")];
+ char uniname2ctype_pool_str701[sizeof("ininscriptionalparthian")];
+ char uniname2ctype_pool_str703[sizeof("ininscriptionalpahlavi")];
+ char uniname2ctype_pool_str704[sizeof("coptic")];
+ char uniname2ctype_pool_str705[sizeof("dsrt")];
+ char uniname2ctype_pool_str706[sizeof("inmodifiertoneletters")];
+ char uniname2ctype_pool_str709[sizeof("xids")];
+ char uniname2ctype_pool_str713[sizeof("hanunoo")];
+ char uniname2ctype_pool_str715[sizeof("inoldturkic")];
+ char uniname2ctype_pool_str721[sizeof("xidc")];
+ char uniname2ctype_pool_str725[sizeof("idstart")];
+ char uniname2ctype_pool_str729[sizeof("inimperialaramaic")];
+ char uniname2ctype_pool_str730[sizeof("invariationselectors")];
+ char uniname2ctype_pool_str734[sizeof("copt")];
+ char uniname2ctype_pool_str737[sizeof("caseignorable")];
+ char uniname2ctype_pool_str738[sizeof("prti")];
+ char uniname2ctype_pool_str739[sizeof("nchar")];
+ char uniname2ctype_pool_str746[sizeof("deseret")];
+ char uniname2ctype_pool_str747[sizeof("decimalnumber")];
+ char uniname2ctype_pool_str748[sizeof("cprt")];
+ char uniname2ctype_pool_str750[sizeof("inlatin1supplement")];
+ char uniname2ctype_pool_str771[sizeof("imperialaramaic")];
+ char uniname2ctype_pool_str776[sizeof("privateuse")];
+ char uniname2ctype_pool_str777[sizeof("casedletter")];
+ char uniname2ctype_pool_str778[sizeof("lowercase")];
+ char uniname2ctype_pool_str780[sizeof("spaceseparator")];
+ char uniname2ctype_pool_str784[sizeof("radical")];
+ char uniname2ctype_pool_str787[sizeof("mong")];
+ char uniname2ctype_pool_str788[sizeof("canadianaboriginal")];
+ char uniname2ctype_pool_str792[sizeof("letternumber")];
+ char uniname2ctype_pool_str796[sizeof("insorasompeng")];
+ char uniname2ctype_pool_str797[sizeof("dash")];
+ char uniname2ctype_pool_str798[sizeof("wspace")];
+ char uniname2ctype_pool_str799[sizeof("ogam")];
+ char uniname2ctype_pool_str802[sizeof("invariationselectorssupplement")];
+ char uniname2ctype_pool_str803[sizeof("print")];
+ char uniname2ctype_pool_str811[sizeof("otheridcontinue")];
+ char uniname2ctype_pool_str815[sizeof("ingurmukhi")];
+ char uniname2ctype_pool_str818[sizeof("closepunctuation")];
+ char uniname2ctype_pool_str823[sizeof("olditalic")];
+ char uniname2ctype_pool_str824[sizeof("noncharactercodepoint")];
+ char uniname2ctype_pool_str826[sizeof("sharada")];
+ char uniname2ctype_pool_str827[sizeof("ingeometricshapes")];
+ char uniname2ctype_pool_str830[sizeof("otheralphabetic")];
+ char uniname2ctype_pool_str831[sizeof("patternwhitespace")];
+ char uniname2ctype_pool_str832[sizeof("po")];
+ char uniname2ctype_pool_str833[sizeof("rjng")];
+ char uniname2ctype_pool_str835[sizeof("ingreekandcoptic")];
+ char uniname2ctype_pool_str841[sizeof("xdigit")];
+ char uniname2ctype_pool_str850[sizeof("gothic")];
+ char uniname2ctype_pool_str851[sizeof("inoldsoutharabian")];
+ char uniname2ctype_pool_str852[sizeof("xidstart")];
+ char uniname2ctype_pool_str854[sizeof("inrejang")];
+ char uniname2ctype_pool_str860[sizeof("idsbinaryoperator")];
+ char uniname2ctype_pool_str867[sizeof("olower")];
+ char uniname2ctype_pool_str869[sizeof("hex")];
+ char uniname2ctype_pool_str870[sizeof("inenclosedideographicsupplement")];
+ char uniname2ctype_pool_str874[sizeof("inalphabeticpresentationforms")];
+ char uniname2ctype_pool_str879[sizeof("inbasiclatin")];
+ char uniname2ctype_pool_str884[sizeof("othersymbol")];
+ char uniname2ctype_pool_str889[sizeof("nd")];
+ char uniname2ctype_pool_str890[sizeof("sd")];
+ char uniname2ctype_pool_str900[sizeof("omath")];
+ char uniname2ctype_pool_str901[sizeof("separator")];
+ char uniname2ctype_pool_str907[sizeof("inarabic")];
+ char uniname2ctype_pool_str912[sizeof("xidcontinue")];
+ char uniname2ctype_pool_str913[sizeof("otheridstart")];
+ char uniname2ctype_pool_str914[sizeof("grext")];
+ char uniname2ctype_pool_str917[sizeof("otherlowercase")];
+ char uniname2ctype_pool_str919[sizeof("phli")];
+ char uniname2ctype_pool_str920[sizeof("cased")];
+ char uniname2ctype_pool_str923[sizeof("hang")];
+ char uniname2ctype_pool_str931[sizeof("xpeo")];
+ char uniname2ctype_pool_str933[sizeof("lower")];
+ char uniname2ctype_pool_str936[sizeof("modifierletter")];
+ char uniname2ctype_pool_str938[sizeof("inphoneticextensions")];
+ char uniname2ctype_pool_str939[sizeof("inarabicpresentationformsa")];
+ char uniname2ctype_pool_str943[sizeof("innumberforms")];
+ char uniname2ctype_pool_str945[sizeof("oldpersian")];
+ char uniname2ctype_pool_str946[sizeof("incyrillicextendeda")];
+ char uniname2ctype_pool_str947[sizeof("inverticalforms")];
+ char uniname2ctype_pool_str949[sizeof("p")];
+ char uniname2ctype_pool_str950[sizeof("inbyzantinemusicalsymbols")];
+ char uniname2ctype_pool_str951[sizeof("inmathematicaloperators")];
+ char uniname2ctype_pool_str952[sizeof("intibetan")];
+ char uniname2ctype_pool_str953[sizeof("zp")];
+ char uniname2ctype_pool_str956[sizeof("ingeorgian")];
+ char uniname2ctype_pool_str960[sizeof("inbraillepatterns")];
+ char uniname2ctype_pool_str962[sizeof("lepcha")];
+ char uniname2ctype_pool_str963[sizeof("geor")];
+ char uniname2ctype_pool_str964[sizeof("invedicextensions")];
+ char uniname2ctype_pool_str965[sizeof("linb")];
+ char uniname2ctype_pool_str966[sizeof("other")];
+ char uniname2ctype_pool_str970[sizeof("deva")];
+ char uniname2ctype_pool_str972[sizeof("indevanagari")];
+ char uniname2ctype_pool_str973[sizeof("othernumber")];
+ char uniname2ctype_pool_str974[sizeof("bamum")];
+ char uniname2ctype_pool_str976[sizeof("shrd")];
+ char uniname2ctype_pool_str977[sizeof("bali")];
+ char uniname2ctype_pool_str981[sizeof("devanagari")];
+ char uniname2ctype_pool_str983[sizeof("extender")];
+ char uniname2ctype_pool_str988[sizeof("inherited")];
+ char uniname2ctype_pool_str989[sizeof("glagolitic")];
+ char uniname2ctype_pool_str990[sizeof("tibt")];
+ char uniname2ctype_pool_str994[sizeof("inbalinese")];
+ char uniname2ctype_pool_str996[sizeof("ingothic")];
+ char uniname2ctype_pool_str997[sizeof("inmiscellaneousmathematicalsymbolsb")];
+ char uniname2ctype_pool_str998[sizeof("limb")];
+ char uniname2ctype_pool_str1000[sizeof("bengali")];
+ char uniname2ctype_pool_str1003[sizeof("phoenician")];
+ char uniname2ctype_pool_str1004[sizeof("insuperscriptsandsubscripts")];
+ char uniname2ctype_pool_str1006[sizeof("inmeroitichieroglyphs")];
+ char uniname2ctype_pool_str1007[sizeof("tibetan")];
+ char uniname2ctype_pool_str1010[sizeof("inphoneticextensionssupplement")];
+ char uniname2ctype_pool_str1016[sizeof("balinese")];
+ char uniname2ctype_pool_str1021[sizeof("lowercaseletter")];
+ char uniname2ctype_pool_str1031[sizeof("indingbats")];
+ char uniname2ctype_pool_str1035[sizeof("inprivateusearea")];
+ char uniname2ctype_pool_str1039[sizeof("assigned")];
+ char uniname2ctype_pool_str1044[sizeof("patternsyntax")];
+ char uniname2ctype_pool_str1051[sizeof("inhangulsyllables")];
+ char uniname2ctype_pool_str1065[sizeof("sarb")];
+ char uniname2ctype_pool_str1067[sizeof("brai")];
+ char uniname2ctype_pool_str1069[sizeof("insupplementalmathematicaloperators")];
+ char uniname2ctype_pool_str1070[sizeof("phnx")];
+ char uniname2ctype_pool_str1072[sizeof("ingreekextended")];
+ char uniname2ctype_pool_str1074[sizeof("otherletter")];
+ char uniname2ctype_pool_str1076[sizeof("arab")];
+ char uniname2ctype_pool_str1078[sizeof("inlatinextendedd")];
+ char uniname2ctype_pool_str1081[sizeof("word")];
+ char uniname2ctype_pool_str1084[sizeof("inphagspa")];
+ char uniname2ctype_pool_str1087[sizeof("inblockelements")];
+ char uniname2ctype_pool_str1092[sizeof("ethiopic")];
+ char uniname2ctype_pool_str1094[sizeof("inethiopicextendeda")];
+ char uniname2ctype_pool_str1107[sizeof("brahmi")];
+ char uniname2ctype_pool_str1110[sizeof("logicalorderexception")];
+ char uniname2ctype_pool_str1114[sizeof("inoldpersian")];
+ char uniname2ctype_pool_str1129[sizeof("inletterlikesymbols")];
+ char uniname2ctype_pool_str1133[sizeof("sorasompeng")];
+ char uniname2ctype_pool_str1135[sizeof("hiragana")];
+ char uniname2ctype_pool_str1142[sizeof("inhanguljamoextendeda")];
+ char uniname2ctype_pool_str1147[sizeof("othermath")];
+ char uniname2ctype_pool_str1150[sizeof("digit")];
+ char uniname2ctype_pool_str1151[sizeof("goth")];
+ char uniname2ctype_pool_str1156[sizeof("ogham")];
+ char uniname2ctype_pool_str1162[sizeof("sundanese")];
+ char uniname2ctype_pool_str1170[sizeof("saurashtra")];
+ char uniname2ctype_pool_str1173[sizeof("linearb")];
+ char uniname2ctype_pool_str1179[sizeof("graphemebase")];
+ char uniname2ctype_pool_str1185[sizeof("inunifiedcanadianaboriginalsyllabics")];
+ char uniname2ctype_pool_str1186[sizeof("cuneiform")];
+ char uniname2ctype_pool_str1188[sizeof("inkannada")];
+ char uniname2ctype_pool_str1190[sizeof("kana")];
+ char uniname2ctype_pool_str1195[sizeof("inancientgreeknumbers")];
+ char uniname2ctype_pool_str1196[sizeof("incjkstrokes")];
+ char uniname2ctype_pool_str1198[sizeof("inglagolitic")];
+ char uniname2ctype_pool_str1202[sizeof("inancientgreekmusicalnotation")];
+ char uniname2ctype_pool_str1212[sizeof("inchakma")];
+ char uniname2ctype_pool_str1215[sizeof("plrd")];
+ char uniname2ctype_pool_str1219[sizeof("inbrahmi")];
+ char uniname2ctype_pool_str1224[sizeof("cakm")];
+ char uniname2ctype_pool_str1225[sizeof("incjkcompatibilityforms")];
+ char uniname2ctype_pool_str1229[sizeof("lisu")];
+ char uniname2ctype_pool_str1230[sizeof("incjkcompatibilityideographs")];
+ char uniname2ctype_pool_str1231[sizeof("intagalog")];
+ char uniname2ctype_pool_str1244[sizeof("inkaithi")];
+ char uniname2ctype_pool_str1245[sizeof("insupplementalarrowsa")];
+ char uniname2ctype_pool_str1249[sizeof("takri")];
+ char uniname2ctype_pool_str1253[sizeof("ideographic")];
+ char uniname2ctype_pool_str1256[sizeof("hexdigit")];
+ char uniname2ctype_pool_str1259[sizeof("glag")];
+ char uniname2ctype_pool_str1261[sizeof("softdotted")];
+ char uniname2ctype_pool_str1262[sizeof("variationselector")];
+ char uniname2ctype_pool_str1264[sizeof("inkatakana")];
+ char uniname2ctype_pool_str1265[sizeof("meeteimayek")];
+ char uniname2ctype_pool_str1274[sizeof("otherpunctuation")];
+ char uniname2ctype_pool_str1279[sizeof("inhanguljamo")];
+ char uniname2ctype_pool_str1282[sizeof("kali")];
+ char uniname2ctype_pool_str1289[sizeof("braille")];
+ char uniname2ctype_pool_str1298[sizeof("incombininghalfmarks")];
+ char uniname2ctype_pool_str1300[sizeof("talu")];
+ char uniname2ctype_pool_str1302[sizeof("incjkcompatibilityideographssupplement")];
+ char uniname2ctype_pool_str1306[sizeof("telu")];
+ char uniname2ctype_pool_str1307[sizeof("idsb")];
+ char uniname2ctype_pool_str1310[sizeof("tglg")];
+ char uniname2ctype_pool_str1313[sizeof("inmeeteimayek")];
+ char uniname2ctype_pool_str1315[sizeof("yi")];
+ char uniname2ctype_pool_str1318[sizeof("phagspa")];
+ char uniname2ctype_pool_str1321[sizeof("yiii")];
+ char uniname2ctype_pool_str1323[sizeof("inarabicmathematicalalphabeticsymbols")];
+ char uniname2ctype_pool_str1328[sizeof("saur")];
+ char uniname2ctype_pool_str1330[sizeof("ogrext")];
char uniname2ctype_pool_str1334[sizeof("bidic")];
- char uniname2ctype_pool_str1344[sizeof("ingreekextended")];
- char uniname2ctype_pool_str1353[sizeof("idsb")];
- char uniname2ctype_pool_str1359[sizeof("assigned")];
- char uniname2ctype_pool_str1364[sizeof("otherpunctuation")];
- char uniname2ctype_pool_str1368[sizeof("inhangulsyllables")];
- char uniname2ctype_pool_str1373[sizeof("inarabicmathematicalalphabeticsymbols")];
- char uniname2ctype_pool_str1385[sizeof("inornamentaldingbats")];
- char uniname2ctype_pool_str1387[sizeof("inphagspa")];
- char uniname2ctype_pool_str1389[sizeof("lyci")];
- char uniname2ctype_pool_str1393[sizeof("mlym")];
- char uniname2ctype_pool_str1399[sizeof("inarabicextendeda")];
- char uniname2ctype_pool_str1400[sizeof("rjng")];
- char uniname2ctype_pool_str1402[sizeof("lycian")];
- char uniname2ctype_pool_str1403[sizeof("inalchemicalsymbols")];
- char uniname2ctype_pool_str1409[sizeof("xdigit")];
- char uniname2ctype_pool_str1412[sizeof("digit")];
- char uniname2ctype_pool_str1420[sizeof("xidstart")];
- char uniname2ctype_pool_str1421[sizeof("inrejang")];
- char uniname2ctype_pool_str1424[sizeof("malayalam")];
- char uniname2ctype_pool_str1425[sizeof("idstrinaryoperator")];
- char uniname2ctype_pool_str1429[sizeof("invai")];
- char uniname2ctype_pool_str1435[sizeof("vai")];
- char uniname2ctype_pool_str1436[sizeof("vaii")];
- char uniname2ctype_pool_str1438[sizeof("hiragana")];
- char uniname2ctype_pool_str1442[sizeof("ingeorgian")];
- char uniname2ctype_pool_str1448[sizeof("braille")];
- char uniname2ctype_pool_str1455[sizeof("geor")];
- char uniname2ctype_pool_str1457[sizeof("brah")];
- char uniname2ctype_pool_str1463[sizeof("glagolitic")];
- char uniname2ctype_pool_str1465[sizeof("inkannada")];
- char uniname2ctype_pool_str1466[sizeof("cakm")];
- char uniname2ctype_pool_str1467[sizeof("kana")];
- char uniname2ctype_pool_str1469[sizeof("hebr")];
- char uniname2ctype_pool_str1471[sizeof("inshavian")];
- char uniname2ctype_pool_str1477[sizeof("vs")];
- char uniname2ctype_pool_str1481[sizeof("inchakma")];
- char uniname2ctype_pool_str1490[sizeof("ogham")];
- char uniname2ctype_pool_str1491[sizeof("sylotinagri")];
- char uniname2ctype_pool_str1492[sizeof("inunifiedcanadianaboriginalsyllabicsextended")];
- char uniname2ctype_pool_str1495[sizeof("inmeroitichieroglyphs")];
- char uniname2ctype_pool_str1498[sizeof("grantha")];
- char uniname2ctype_pool_str1500[sizeof("graphemebase")];
- char uniname2ctype_pool_str1502[sizeof("mathsymbol")];
- char uniname2ctype_pool_str1505[sizeof("mymr")];
- char uniname2ctype_pool_str1513[sizeof("insupplementaryprivateuseareaa")];
- char uniname2ctype_pool_str1514[sizeof("mendekikakui")];
- char uniname2ctype_pool_str1516[sizeof("incjkcompatibilityforms")];
- char uniname2ctype_pool_str1518[sizeof("inhalfwidthandfullwidthforms")];
- char uniname2ctype_pool_str1521[sizeof("incjkcompatibilityideographs")];
- char uniname2ctype_pool_str1522[sizeof("inkaithi")];
- char uniname2ctype_pool_str1525[sizeof("avst")];
- char uniname2ctype_pool_str1526[sizeof("inarabicsupplement")];
- char uniname2ctype_pool_str1527[sizeof("takri")];
- char uniname2ctype_pool_str1529[sizeof("syrc")];
- char uniname2ctype_pool_str1533[sizeof("meeteimayek")];
- char uniname2ctype_pool_str1534[sizeof("myanmar")];
- char uniname2ctype_pool_str1535[sizeof("avestan")];
- char uniname2ctype_pool_str1536[sizeof("inhanguljamoextendeda")];
- char uniname2ctype_pool_str1540[sizeof("goth")];
- char uniname2ctype_pool_str1542[sizeof("inkatakana")];
- char uniname2ctype_pool_str1544[sizeof("incyrillicextendeda")];
- char uniname2ctype_pool_str1549[sizeof("alphabetic")];
- char uniname2ctype_pool_str1550[sizeof("syriac")];
- char uniname2ctype_pool_str1551[sizeof("ideographic")];
- char uniname2ctype_pool_str1555[sizeof("incjkstrokes")];
- char uniname2ctype_pool_str1557[sizeof("inlinearbsyllabary")];
- char uniname2ctype_pool_str1558[sizeof("tavt")];
- char uniname2ctype_pool_str1559[sizeof("intaiviet")];
- char uniname2ctype_pool_str1564[sizeof("incjkcompatibilityideographssupplement")];
- char uniname2ctype_pool_str1576[sizeof("inmeeteimayek")];
- char uniname2ctype_pool_str1577[sizeof("kali")];
- char uniname2ctype_pool_str1581[sizeof("inyiradicals")];
- char uniname2ctype_pool_str1586[sizeof("lu")];
- char uniname2ctype_pool_str1587[sizeof("inoriya")];
- char uniname2ctype_pool_str1590[sizeof("hebrew")];
- char uniname2ctype_pool_str1596[sizeof("extender")];
- char uniname2ctype_pool_str1598[sizeof("inhighprivateusesurrogates")];
- char uniname2ctype_pool_str1600[sizeof("limbu")];
- char uniname2ctype_pool_str1606[sizeof("inbuhid")];
- char uniname2ctype_pool_str1608[sizeof("inethiopicextendeda")];
- char uniname2ctype_pool_str1609[sizeof("xidcontinue")];
- char uniname2ctype_pool_str1611[sizeof("inyijinghexagramsymbols")];
- char uniname2ctype_pool_str1612[sizeof("logicalorderexception")];
- char uniname2ctype_pool_str1616[sizeof("inhebrew")];
+ char uniname2ctype_pool_str1341[sizeof("inkanasupplement")];
+ char uniname2ctype_pool_str1343[sizeof("runic")];
+ char uniname2ctype_pool_str1344[sizeof("inalchemicalsymbols")];
+ char uniname2ctype_pool_str1350[sizeof("georgian")];
+ char uniname2ctype_pool_str1351[sizeof("inugaritic")];
+ char uniname2ctype_pool_str1354[sizeof("insaurashtra")];
+ char uniname2ctype_pool_str1356[sizeof("inhighprivateusesurrogates")];
+ char uniname2ctype_pool_str1362[sizeof("pd")];
+ char uniname2ctype_pool_str1372[sizeof("incountingrodnumerals")];
+ char uniname2ctype_pool_str1377[sizeof("inarabicextendeda")];
+ char uniname2ctype_pool_str1389[sizeof("inkharoshthi")];
+ char uniname2ctype_pool_str1393[sizeof("idstrinaryoperator")];
+ char uniname2ctype_pool_str1396[sizeof("phag")];
+ char uniname2ctype_pool_str1398[sizeof("brah")];
+ char uniname2ctype_pool_str1402[sizeof("mark")];
+ char uniname2ctype_pool_str1404[sizeof("hebr")];
+ char uniname2ctype_pool_str1411[sizeof("inkhmersymbols")];
+ char uniname2ctype_pool_str1413[sizeof("dep")];
+ char uniname2ctype_pool_str1416[sizeof("inkhmer")];
+ char uniname2ctype_pool_str1422[sizeof("deprecated")];
+ char uniname2ctype_pool_str1424[sizeof("rejang")];
+ char uniname2ctype_pool_str1429[sizeof("lyci")];
+ char uniname2ctype_pool_str1431[sizeof("intakri")];
+ char uniname2ctype_pool_str1432[sizeof("takr")];
+ char uniname2ctype_pool_str1435[sizeof("incyrillicsupplement")];
+ char uniname2ctype_pool_str1436[sizeof("changeswhencasefolded")];
+ char uniname2ctype_pool_str1438[sizeof("indevanagariextended")];
+ char uniname2ctype_pool_str1442[sizeof("lycian")];
+ char uniname2ctype_pool_str1443[sizeof("inbengali")];
+ char uniname2ctype_pool_str1448[sizeof("beng")];
+ char uniname2ctype_pool_str1450[sizeof("graph")];
+ char uniname2ctype_pool_str1452[sizeof("inyijinghexagramsymbols")];
+ char uniname2ctype_pool_str1457[sizeof("olck")];
+ char uniname2ctype_pool_str1460[sizeof("inarabicsupplement")];
+ char uniname2ctype_pool_str1462[sizeof("inbuginese")];
+ char uniname2ctype_pool_str1463[sizeof("changeswhencasemapped")];
+ char uniname2ctype_pool_str1468[sizeof("olchiki")];
+ char uniname2ctype_pool_str1478[sizeof("inaegeannumbers")];
+ char uniname2ctype_pool_str1479[sizeof("mlym")];
+ char uniname2ctype_pool_str1480[sizeof("alphabetic")];
+ char uniname2ctype_pool_str1492[sizeof("sylotinagri")];
+ char uniname2ctype_pool_str1498[sizeof("changeswhentitlecased")];
+ char uniname2ctype_pool_str1504[sizeof("tagalog")];
+ char uniname2ctype_pool_str1505[sizeof("tagb")];
+ char uniname2ctype_pool_str1506[sizeof("runr")];
+ char uniname2ctype_pool_str1510[sizeof("malayalam")];
+ char uniname2ctype_pool_str1512[sizeof("inoriya")];
+ char uniname2ctype_pool_str1516[sizeof("intagbanwa")];
+ char uniname2ctype_pool_str1517[sizeof("syrc")];
+ char uniname2ctype_pool_str1519[sizeof("nko")];
+ char uniname2ctype_pool_str1520[sizeof("nkoo")];
+ char uniname2ctype_pool_str1523[sizeof("inethiopicextended")];
+ char uniname2ctype_pool_str1525[sizeof("kaithi")];
+ char uniname2ctype_pool_str1530[sizeof("mathsymbol")];
+ char uniname2ctype_pool_str1531[sizeof("inyiradicals")];
+ char uniname2ctype_pool_str1536[sizeof("insupplementaryprivateuseareaa")];
+ char uniname2ctype_pool_str1540[sizeof("osmanya")];
+ char uniname2ctype_pool_str1546[sizeof("syriac")];
+ char uniname2ctype_pool_str1548[sizeof("otherdefaultignorablecodepoint")];
+ char uniname2ctype_pool_str1561[sizeof("number")];
+ char uniname2ctype_pool_str1565[sizeof("inlinearbsyllabary")];
+ char uniname2ctype_pool_str1566[sizeof("kthi")];
+ char uniname2ctype_pool_str1567[sizeof("sund")];
+ char uniname2ctype_pool_str1569[sizeof("mymr")];
+ char uniname2ctype_pool_str1571[sizeof("incombiningdiacriticalmarks")];
+ char uniname2ctype_pool_str1578[sizeof("enclosingmark")];
+ char uniname2ctype_pool_str1581[sizeof("incombiningdiacriticalmarksforsymbols")];
+ char uniname2ctype_pool_str1583[sizeof("inethiopicsupplement")];
+ char uniname2ctype_pool_str1590[sizeof("unassigned")];
+ char uniname2ctype_pool_str1591[sizeof("sylo")];
+ char uniname2ctype_pool_str1595[sizeof("combiningmark")];
+ char uniname2ctype_pool_str1598[sizeof("myanmar")];
+ char uniname2ctype_pool_str1605[sizeof("graphemeextend")];
+ char uniname2ctype_pool_str1606[sizeof("bidicontrol")];
+ char uniname2ctype_pool_str1609[sizeof("inhalfwidthandfullwidthforms")];
char uniname2ctype_pool_str1617[sizeof("cyrl")];
- char uniname2ctype_pool_str1618[sizeof("osmanya")];
- char uniname2ctype_pool_str1621[sizeof("phnx")];
- char uniname2ctype_pool_str1622[sizeof("incombiningdiacriticalmarks")];
- char uniname2ctype_pool_str1626[sizeof("inkanasupplement")];
- char uniname2ctype_pool_str1627[sizeof("inlisu")];
- char uniname2ctype_pool_str1628[sizeof("changeswhencasemapped")];
- char uniname2ctype_pool_str1632[sizeof("incombiningdiacriticalmarksforsymbols")];
- char uniname2ctype_pool_str1636[sizeof("cwu")];
- char uniname2ctype_pool_str1641[sizeof("phag")];
- char uniname2ctype_pool_str1645[sizeof("insmallformvariants")];
- char uniname2ctype_pool_str1656[sizeof("inpahawhhmong")];
- char uniname2ctype_pool_str1661[sizeof("otheruppercase")];
- char uniname2ctype_pool_str1662[sizeof("intelugu")];
- char uniname2ctype_pool_str1665[sizeof("incombiningdiacriticalmarkssupplement")];
- char uniname2ctype_pool_str1670[sizeof("ingeometricshapesextended")];
- char uniname2ctype_pool_str1671[sizeof("xpeo")];
- char uniname2ctype_pool_str1687[sizeof("bamu")];
- char uniname2ctype_pool_str1689[sizeof("inbamum")];
- char uniname2ctype_pool_str1692[sizeof("mark")];
- char uniname2ctype_pool_str1694[sizeof("dupl")];
- char uniname2ctype_pool_str1695[sizeof("graph")];
- char uniname2ctype_pool_str1696[sizeof("dashpunctuation")];
- char uniname2ctype_pool_str1700[sizeof("patternsyntax")];
- char uniname2ctype_pool_str1705[sizeof("changeswhentitlecased")];
- char uniname2ctype_pool_str1706[sizeof("inkharoshthi")];
- char uniname2ctype_pool_str1712[sizeof("inkhmer")];
- char uniname2ctype_pool_str1713[sizeof("java")];
- char uniname2ctype_pool_str1714[sizeof("sylo")];
- char uniname2ctype_pool_str1719[sizeof("ugaritic")];
- char uniname2ctype_pool_str1722[sizeof("otherdefaultignorablecodepoint")];
- char uniname2ctype_pool_str1723[sizeof("softdotted")];
- char uniname2ctype_pool_str1729[sizeof("uideo")];
- char uniname2ctype_pool_str1732[sizeof("inphoneticextensions")];
- char uniname2ctype_pool_str1736[sizeof("injavanese")];
- char uniname2ctype_pool_str1742[sizeof("invariationselectors")];
- char uniname2ctype_pool_str1744[sizeof("kaithi")];
- char uniname2ctype_pool_str1747[sizeof("cyrillic")];
- char uniname2ctype_pool_str1749[sizeof("intakri")];
- char uniname2ctype_pool_str1750[sizeof("takr")];
- char uniname2ctype_pool_str1755[sizeof("javanese")];
- char uniname2ctype_pool_str1757[sizeof("bidicontrol")];
- char uniname2ctype_pool_str1758[sizeof("caucasianalbanian")];
- char uniname2ctype_pool_str1765[sizeof("lydi")];
- char uniname2ctype_pool_str1772[sizeof("insupplementalpunctuation")];
- char uniname2ctype_pool_str1775[sizeof("inphoneticextensionssupplement")];
- char uniname2ctype_pool_str1778[sizeof("lydian")];
- char uniname2ctype_pool_str1784[sizeof("oldturkic")];
- char uniname2ctype_pool_str1785[sizeof("invariationselectorssupplement")];
- char uniname2ctype_pool_str1786[sizeof("kthi")];
- char uniname2ctype_pool_str1792[sizeof("inhanguljamo")];
- char uniname2ctype_pool_str1797[sizeof("patsyn")];
- char uniname2ctype_pool_str1802[sizeof("inlimbu")];
- char uniname2ctype_pool_str1804[sizeof("sorasompeng")];
- char uniname2ctype_pool_str1807[sizeof("orya")];
- char uniname2ctype_pool_str1822[sizeof("inkhmersymbols")];
- char uniname2ctype_pool_str1824[sizeof("inglagolitic")];
- char uniname2ctype_pool_str1831[sizeof("indevanagari")];
- char uniname2ctype_pool_str1835[sizeof("deva")];
- char uniname2ctype_pool_str1836[sizeof("knda")];
- char uniname2ctype_pool_str1841[sizeof("inbengali")];
- char uniname2ctype_pool_str1843[sizeof("symbol")];
- char uniname2ctype_pool_str1846[sizeof("devanagari")];
- char uniname2ctype_pool_str1849[sizeof("inmendekikakui")];
- char uniname2ctype_pool_str1852[sizeof("beng")];
- char uniname2ctype_pool_str1853[sizeof("invedicextensions")];
- char uniname2ctype_pool_str1859[sizeof("graphemeextend")];
- char uniname2ctype_pool_str1865[sizeof("kannada")];
- char uniname2ctype_pool_str1866[sizeof("inbuginese")];
- char uniname2ctype_pool_str1869[sizeof("olck")];
- char uniname2ctype_pool_str1871[sizeof("meroitichieroglyphs")];
- char uniname2ctype_pool_str1872[sizeof("ugar")];
- char uniname2ctype_pool_str1874[sizeof("intagalog")];
- char uniname2ctype_pool_str1878[sizeof("inbamumsupplement")];
- char uniname2ctype_pool_str1880[sizeof("olchiki")];
- char uniname2ctype_pool_str1899[sizeof("incurrencysymbols")];
- char uniname2ctype_pool_str1904[sizeof("tagb")];
- char uniname2ctype_pool_str1912[sizeof("inaegeannumbers")];
- char uniname2ctype_pool_str1915[sizeof("intagbanwa")];
- char uniname2ctype_pool_str1916[sizeof("uppercase")];
- char uniname2ctype_pool_str1917[sizeof("defaultignorablecodepoint")];
- char uniname2ctype_pool_str1919[sizeof("glag")];
- char uniname2ctype_pool_str1921[sizeof("inkatakanaphoneticextensions")];
- char uniname2ctype_pool_str1932[sizeof("changeswhencasefolded")];
- char uniname2ctype_pool_str1942[sizeof("inpaucinhau")];
- char uniname2ctype_pool_str1943[sizeof("inprivateusearea")];
- char uniname2ctype_pool_str1947[sizeof("paucinhau")];
- char uniname2ctype_pool_str1953[sizeof("spacingmark")];
- char uniname2ctype_pool_str1956[sizeof("khmr")];
- char uniname2ctype_pool_str1962[sizeof("khar")];
- char uniname2ctype_pool_str1964[sizeof("inarabicpresentationformsb")];
- char uniname2ctype_pool_str1967[sizeof("changeswhenlowercased")];
- char uniname2ctype_pool_str1971[sizeof("tglg")];
- char uniname2ctype_pool_str1976[sizeof("inethiopicextended")];
- char uniname2ctype_pool_str1980[sizeof("incombiningdiacriticalmarksextended")];
- char uniname2ctype_pool_str1986[sizeof("oupper")];
- char uniname2ctype_pool_str1994[sizeof("incjksymbolsandpunctuation")];
- char uniname2ctype_pool_str1997[sizeof("bopo")];
- char uniname2ctype_pool_str1998[sizeof("punctuation")];
- char uniname2ctype_pool_str2002[sizeof("combiningmark")];
- char uniname2ctype_pool_str2007[sizeof("inplayingcards")];
- char uniname2ctype_pool_str2008[sizeof("inbopomofo")];
- char uniname2ctype_pool_str2021[sizeof("hyphen")];
- char uniname2ctype_pool_str2028[sizeof("inkhojki")];
- char uniname2ctype_pool_str2046[sizeof("nko")];
- char uniname2ctype_pool_str2047[sizeof("nkoo")];
- char uniname2ctype_pool_str2048[sizeof("enclosingmark")];
- char uniname2ctype_pool_str2053[sizeof("openpunctuation")];
- char uniname2ctype_pool_str2061[sizeof("currencysymbol")];
- char uniname2ctype_pool_str2063[sizeof("inverticalforms")];
- char uniname2ctype_pool_str2071[sizeof("hex")];
- char uniname2ctype_pool_str2072[sizeof("modifiersymbol")];
- char uniname2ctype_pool_str2073[sizeof("inlatinextendedb")];
- char uniname2ctype_pool_str2075[sizeof("kharoshthi")];
- char uniname2ctype_pool_str2080[sizeof("cherokee")];
- char uniname2ctype_pool_str2088[sizeof("pahawhhmong")];
- char uniname2ctype_pool_str2096[sizeof("cypriot")];
- char uniname2ctype_pool_str2105[sizeof("incypriotsyllabary")];
- char uniname2ctype_pool_str2110[sizeof("palmyrene")];
- char uniname2ctype_pool_str2113[sizeof("upper")];
- char uniname2ctype_pool_str2116[sizeof("aghb")];
- char uniname2ctype_pool_str2123[sizeof("georgian")];
- char uniname2ctype_pool_str2131[sizeof("gujr")];
- char uniname2ctype_pool_str2142[sizeof("grbase")];
- char uniname2ctype_pool_str2152[sizeof("gujarati")];
- char uniname2ctype_pool_str2153[sizeof("hexdigit")];
- char uniname2ctype_pool_str2189[sizeof("khmer")];
- char uniname2ctype_pool_str2194[sizeof("uppercaseletter")];
- char uniname2ctype_pool_str2198[sizeof("insupplementalarrowsb")];
- char uniname2ctype_pool_str2224[sizeof("surrogate")];
- char uniname2ctype_pool_str2227[sizeof("unifiedideograph")];
- char uniname2ctype_pool_str2237[sizeof("nonspacingmark")];
- char uniname2ctype_pool_str2241[sizeof("othergraphemeextend")];
- char uniname2ctype_pool_str2242[sizeof("indevanagariextended")];
- char uniname2ctype_pool_str2252[sizeof("orkh")];
- char uniname2ctype_pool_str2273[sizeof("ingeorgiansupplement")];
- char uniname2ctype_pool_str2287[sizeof("oldnortharabian")];
- char uniname2ctype_pool_str2290[sizeof("tagalog")];
- char uniname2ctype_pool_str2292[sizeof("khoj")];
- char uniname2ctype_pool_str2311[sizeof("bopomofo")];
- char uniname2ctype_pool_str2318[sizeof("rejang")];
- char uniname2ctype_pool_str2326[sizeof("buhd")];
- char uniname2ctype_pool_str2343[sizeof("incjkradicalssupplement")];
- char uniname2ctype_pool_str2382[sizeof("inkanbun")];
- char uniname2ctype_pool_str2406[sizeof("variationselector")];
- char uniname2ctype_pool_str2417[sizeof("inkangxiradicals")];
- char uniname2ctype_pool_str2421[sizeof("inhighsurrogates")];
- char uniname2ctype_pool_str2431[sizeof("insupplementaryprivateuseareab")];
- char uniname2ctype_pool_str2445[sizeof("ogrext")];
- char uniname2ctype_pool_str2449[sizeof("batk")];
- char uniname2ctype_pool_str2454[sizeof("inhanguljamoextendedb")];
- char uniname2ctype_pool_str2457[sizeof("inbatak")];
- char uniname2ctype_pool_str2462[sizeof("incyrillicextendedb")];
- char uniname2ctype_pool_str2502[sizeof("innoblock")];
- char uniname2ctype_pool_str2527[sizeof("any")];
- char uniname2ctype_pool_str2534[sizeof("xsux")];
- char uniname2ctype_pool_str2562[sizeof("bugi")];
- char uniname2ctype_pool_str2570[sizeof("inkhudawadi")];
- char uniname2ctype_pool_str2571[sizeof("telugu")];
- char uniname2ctype_pool_str2579[sizeof("changeswhenuppercased")];
- char uniname2ctype_pool_str2588[sizeof("grek")];
- char uniname2ctype_pool_str2591[sizeof("guru")];
- char uniname2ctype_pool_str2595[sizeof("paragraphseparator")];
- char uniname2ctype_pool_str2613[sizeof("buginese")];
- char uniname2ctype_pool_str2617[sizeof("inyisyllables")];
- char uniname2ctype_pool_str2631[sizeof("egyp")];
- char uniname2ctype_pool_str2634[sizeof("khudawadi")];
- char uniname2ctype_pool_str2643[sizeof("unknown")];
- char uniname2ctype_pool_str2685[sizeof("bassavah")];
- char uniname2ctype_pool_str2689[sizeof("inegyptianhieroglyphs")];
- char uniname2ctype_pool_str2709[sizeof("buhid")];
- char uniname2ctype_pool_str2722[sizeof("inkayahli")];
- char uniname2ctype_pool_str2732[sizeof("inmeroiticcursive")];
- char uniname2ctype_pool_str2734[sizeof("incjkcompatibility")];
- char uniname2ctype_pool_str2787[sizeof("oldsoutharabian")];
- char uniname2ctype_pool_str2795[sizeof("quotationmark")];
- char uniname2ctype_pool_str2889[sizeof("inhangulcompatibilityjamo")];
- char uniname2ctype_pool_str2898[sizeof("qmark")];
- char uniname2ctype_pool_str2902[sizeof("incjkunifiedideographsextensionc")];
- char uniname2ctype_pool_str2906[sizeof("sk")];
- char uniname2ctype_pool_str2909[sizeof("incjkunifiedideographsextensiona")];
- char uniname2ctype_pool_str2918[sizeof("incjkunifiedideographs")];
- char uniname2ctype_pool_str2984[sizeof("katakana")];
- char uniname2ctype_pool_str3112[sizeof("kayahli")];
- char uniname2ctype_pool_str3137[sizeof("duployan")];
- char uniname2ctype_pool_str3278[sizeof("incjkunifiedideographsextensiond")];
- char uniname2ctype_pool_str3360[sizeof("inbopomofoextended")];
- char uniname2ctype_pool_str3466[sizeof("khojki")];
- char uniname2ctype_pool_str3777[sizeof("zyyy")];
- char uniname2ctype_pool_str3778[sizeof("egyptianhieroglyphs")];
- char uniname2ctype_pool_str3827[sizeof("incjkunifiedideographsextensionb")];
- char uniname2ctype_pool_str3886[sizeof("batak")];
- char uniname2ctype_pool_str3941[sizeof("blank")];
- char uniname2ctype_pool_str3995[sizeof("inboxdrawing")];
- char uniname2ctype_pool_str4025[sizeof("greek")];
- char uniname2ctype_pool_str4035[sizeof("gurmukhi")];
- char uniname2ctype_pool_str4122[sizeof("grlink")];
- char uniname2ctype_pool_str4322[sizeof("graphemelink")];
+ char uniname2ctype_pool_str1620[sizeof("knda")];
+ char uniname2ctype_pool_str1634[sizeof("inunifiedcanadianaboriginalsyllabicsextended")];
+ char uniname2ctype_pool_str1635[sizeof("xsux")];
+ char uniname2ctype_pool_str1636[sizeof("modifiersymbol")];
+ char uniname2ctype_pool_str1643[sizeof("incombiningdiacriticalmarkssupplement")];
+ char uniname2ctype_pool_str1645[sizeof("inhanunoo")];
+ char uniname2ctype_pool_str1648[sizeof("inbuhid")];
+ char uniname2ctype_pool_str1649[sizeof("kannada")];
+ char uniname2ctype_pool_str1658[sizeof("inhebrew")];
+ char uniname2ctype_pool_str1662[sizeof("grbase")];
+ char uniname2ctype_pool_str1664[sizeof("spacingmark")];
+ char uniname2ctype_pool_str1670[sizeof("inkatakanaphoneticextensions")];
+ char uniname2ctype_pool_str1676[sizeof("hangul")];
+ char uniname2ctype_pool_str1683[sizeof("incjksymbolsandpunctuation")];
+ char uniname2ctype_pool_str1688[sizeof("bopo")];
+ char uniname2ctype_pool_str1692[sizeof("orya")];
+ char uniname2ctype_pool_str1699[sizeof("inbopomofo")];
+ char uniname2ctype_pool_str1701[sizeof("kharoshthi")];
+ char uniname2ctype_pool_str1703[sizeof("khar")];
+ char uniname2ctype_pool_str1709[sizeof("changeswhenlowercased")];
+ char uniname2ctype_pool_str1724[sizeof("khmr")];
+ char uniname2ctype_pool_str1725[sizeof("punct")];
+ char uniname2ctype_pool_str1729[sizeof("symbol")];
+ char uniname2ctype_pool_str1732[sizeof("cherokee")];
+ char uniname2ctype_pool_str1737[sizeof("cyrillic")];
+ char uniname2ctype_pool_str1759[sizeof("inkangxiradicals")];
+ char uniname2ctype_pool_str1761[sizeof("hebrew")];
+ char uniname2ctype_pool_str1780[sizeof("inarabicpresentationformsb")];
+ char uniname2ctype_pool_str1787[sizeof("incyrillicextendedb")];
+ char uniname2ctype_pool_str1790[sizeof("ugaritic")];
+ char uniname2ctype_pool_str1829[sizeof("incurrencysymbols")];
+ char uniname2ctype_pool_str1831[sizeof("meroitichieroglyphs")];
+ char uniname2ctype_pool_str1835[sizeof("inhighsurrogates")];
+ char uniname2ctype_pool_str1853[sizeof("nonspacingmark")];
+ char uniname2ctype_pool_str1858[sizeof("lydi")];
+ char uniname2ctype_pool_str1864[sizeof("patsyn")];
+ char uniname2ctype_pool_str1868[sizeof("orkh")];
+ char uniname2ctype_pool_str1871[sizeof("lydian")];
+ char uniname2ctype_pool_str1896[sizeof("ugar")];
+ char uniname2ctype_pool_str1899[sizeof("othergraphemeextend")];
+ char uniname2ctype_pool_str1900[sizeof("inlatinextendedb")];
+ char uniname2ctype_pool_str1904[sizeof("bopomofo")];
+ char uniname2ctype_pool_str1917[sizeof("khmer")];
+ char uniname2ctype_pool_str1925[sizeof("uideo")];
+ char uniname2ctype_pool_str1932[sizeof("otheruppercase")];
+ char uniname2ctype_pool_str1944[sizeof("grek")];
+ char uniname2ctype_pool_str1949[sizeof("gujr")];
+ char uniname2ctype_pool_str1970[sizeof("gujarati")];
+ char uniname2ctype_pool_str1983[sizeof("inhanguljamoextendedb")];
+ char uniname2ctype_pool_str1988[sizeof("defaultignorablecodepoint")];
+ char uniname2ctype_pool_str2005[sizeof("inplayingcards")];
+ char uniname2ctype_pool_str2022[sizeof("bamu")];
+ char uniname2ctype_pool_str2028[sizeof("inkanbun")];
+ char uniname2ctype_pool_str2033[sizeof("incjkradicalssupplement")];
+ char uniname2ctype_pool_str2046[sizeof("cypriot")];
+ char uniname2ctype_pool_str2051[sizeof("inbamum")];
+ char uniname2ctype_pool_str2053[sizeof("inmeroiticcursive")];
+ char uniname2ctype_pool_str2055[sizeof("oldturkic")];
+ char uniname2ctype_pool_str2086[sizeof("insupplementalarrowsb")];
+ char uniname2ctype_pool_str2087[sizeof("surrogate")];
+ char uniname2ctype_pool_str2094[sizeof("batk")];
+ char uniname2ctype_pool_str2102[sizeof("inbatak")];
+ char uniname2ctype_pool_str2119[sizeof("inlimbu")];
+ char uniname2ctype_pool_str2123[sizeof("incypriotsyllabary")];
+ char uniname2ctype_pool_str2129[sizeof("dashpunctuation")];
+ char uniname2ctype_pool_str2130[sizeof("innoblock")];
+ char uniname2ctype_pool_str2141[sizeof("hyphen")];
+ char uniname2ctype_pool_str2162[sizeof("insupplementalpunctuation")];
+ char uniname2ctype_pool_str2165[sizeof("ingeorgiansupplement")];
+ char uniname2ctype_pool_str2178[sizeof("oupper")];
+ char uniname2ctype_pool_str2189[sizeof("paragraphseparator")];
+ char uniname2ctype_pool_str2194[sizeof("inbamumsupplement")];
+ char uniname2ctype_pool_str2299[sizeof("uppercase")];
+ char uniname2ctype_pool_str2313[sizeof("currencysymbol")];
+ char uniname2ctype_pool_str2322[sizeof("sk")];
+ char uniname2ctype_pool_str2338[sizeof("lu")];
+ char uniname2ctype_pool_str2342[sizeof("openpunctuation")];
+ char uniname2ctype_pool_str2349[sizeof("inlisu")];
+ char uniname2ctype_pool_str2371[sizeof("qmark")];
+ char uniname2ctype_pool_str2372[sizeof("egyp")];
+ char uniname2ctype_pool_str2377[sizeof("insupplementaryprivateuseareab")];
+ char uniname2ctype_pool_str2379[sizeof("limbu")];
+ char uniname2ctype_pool_str2400[sizeof("inegyptianhieroglyphs")];
+ char uniname2ctype_pool_str2401[sizeof("unifiedideograph")];
+ char uniname2ctype_pool_str2413[sizeof("intelugu")];
+ char uniname2ctype_pool_str2429[sizeof("katakana")];
+ char uniname2ctype_pool_str2442[sizeof("inhangulcompatibilityjamo")];
+ char uniname2ctype_pool_str2454[sizeof("upper")];
+ char uniname2ctype_pool_str2495[sizeof("inkayahli")];
+ char uniname2ctype_pool_str2515[sizeof("cwu")];
+ char uniname2ctype_pool_str2523[sizeof("incjkcompatibility")];
+ char uniname2ctype_pool_str2542[sizeof("uppercaseletter")];
+ char uniname2ctype_pool_str2549[sizeof("bugi")];
+ char uniname2ctype_pool_str2588[sizeof("buginese")];
+ char uniname2ctype_pool_str2627[sizeof("any")];
+ char uniname2ctype_pool_str2651[sizeof("inyisyllables")];
+ char uniname2ctype_pool_str2671[sizeof("inbopomofoextended")];
+ char uniname2ctype_pool_str2710[sizeof("inboxdrawing")];
+ char uniname2ctype_pool_str2724[sizeof("changeswhenuppercased")];
+ char uniname2ctype_pool_str2727[sizeof("unknown")];
+ char uniname2ctype_pool_str2737[sizeof("quotationmark")];
+ char uniname2ctype_pool_str2753[sizeof("buhd")];
+ char uniname2ctype_pool_str2785[sizeof("punctuation")];
+ char uniname2ctype_pool_str2888[sizeof("oldsoutharabian")];
+ char uniname2ctype_pool_str2925[sizeof("kayahli")];
+ char uniname2ctype_pool_str2940[sizeof("incjkunifiedideographs")];
+ char uniname2ctype_pool_str2961[sizeof("incjkunifiedideographsextensiona")];
+ char uniname2ctype_pool_str2962[sizeof("incjkunifiedideographsextensionc")];
+ char uniname2ctype_pool_str2995[sizeof("telugu")];
+ char uniname2ctype_pool_str3000[sizeof("guru")];
+ char uniname2ctype_pool_str3104[sizeof("greek")];
+ char uniname2ctype_pool_str3189[sizeof("grlink")];
+ char uniname2ctype_pool_str3197[sizeof("buhid")];
+ char uniname2ctype_pool_str3254[sizeof("batak")];
+ char uniname2ctype_pool_str3292[sizeof("blank")];
+ char uniname2ctype_pool_str3391[sizeof("incjkunifiedideographsextensiond")];
+ char uniname2ctype_pool_str3459[sizeof("graphemelink")];
+ char uniname2ctype_pool_str3480[sizeof("egyptianhieroglyphs")];
+ char uniname2ctype_pool_str3802[sizeof("incjkunifiedideographsextensionb")];
+ char uniname2ctype_pool_str3922[sizeof("zyyy")];
+ char uniname2ctype_pool_str4167[sizeof("gurmukhi")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
@@ -30424,736 +26709,644 @@ static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
"upper",
#else /* USE_UNICODE_PROPERTIES */
"n",
- "cn",
- "mn",
- "c",
- "m",
- "ci",
+ "s",
"z",
- "cc",
- "mc",
- "mani",
- "inmanichaean",
- "qaai",
+ "zs",
"zzzz",
- "qaac",
- "incham",
+ "cn",
+ "cs",
+ "ci",
+ "c",
+ "cf",
"sc",
- "sm",
- "mandaic",
- "incuneiform",
"cans",
- "me",
- "inarmenian",
+ "qaai",
+ "mn",
#endif /* USE_UNICODE_PROPERTIES */
"ascii",
#ifdef USE_UNICODE_PROPERTIES
- "s",
- "insamaritan",
- "cs",
- "zs",
+ "cc",
+ "qaac",
"inavestan",
- "incommonindicnumberforms",
+ "inspecials",
+ "inipaextensions",
+ "mc",
+ "insamaritan",
+ "m",
+ "sm",
+ "me",
+ "inarmenian",
+ "incuneiform",
+ "mandaic",
+ "inancientsymbols",
"incuneiformnumbersandpunctuation",
"inthai",
- "inipaextensions",
- "mtei",
- "inspecials",
+ "inmusicalsymbols",
+ "inmiscellaneoussymbols",
+ "incham",
+ "inmiscellaneoussymbolsandarrows",
"initialpunctuation",
- "inancientsymbols",
+ "inmiscellaneoussymbolsandpictographs",
"inthaana",
- "inmiscellaneousmathematicalsymbolsa",
- "lc",
- "inmusicalsymbols",
- "lm",
"taile",
- "sterm",
- "lina",
- "inlycian",
- "inmyanmarextendeda",
+ "mtei",
+ "lc",
"lana",
- "alnum",
- "intaitham",
- "incontrolpictures",
- "inmiscellaneoussymbols",
- "inmalayalam",
+ "inlycian",
"intransportandmapsymbols",
- "inmiscellaneoussymbolsandarrows",
- "inlineara",
- "inmiscellaneoussymbolsandpictographs",
- "taiviet",
- "cwcm",
+ "incontrolpictures",
"sinhala",
+ "incommonindicnumberforms",
+ "inmiscellaneousmathematicalsymbolsa",
+ "sterm",
+ "inmyanmarextendeda",
+ "lm",
+ "taiviet",
+ "inlinearbideograms",
+ "intaitham",
"latn",
"latin",
"ital",
- "intamil",
- "taml",
- "inlatinextendedc",
+ "alnum",
+ "inmalayalam",
"intaile",
"tale",
- "inlatinextendeda",
- "inlinearbideograms",
- "newtailue",
"l",
"nl",
- "inmeeteimayekextensions",
"zl",
- "lt",
+ "intamil",
+ "taml",
+ "inlatinextendeda",
+ "inlatinextendedc",
"inrunic",
"incarian",
- "armn",
+ "insyriac",
"cari",
- "armi",
- "inlatinextendede",
+ "inmeeteimayekextensions",
+ "osma",
+ "lt",
+ "miao",
+ "insharada",
"incyrillic",
- "armenian",
- "inmyanmar",
- "innewtailue",
"carian",
- "merc",
- "arabic",
- "inmiscellaneoustechnical",
- "insyriac",
+ "armn",
"samr",
- "zinh",
- "han",
+ "armi",
+ "inideographicdescriptioncharacters",
+ "inosmanya",
+ "armenian",
+ "inmyanmar",
"samaritan",
- "hani",
- "cwt",
+ "arabic",
"incherokee",
- "insharada",
- "cham",
- "manichaean",
- "inmahajani",
+ "connectorpunctuation",
+ "merc",
+ "inmiscellaneoustechnical",
+ "inenclosedalphanumerics",
+ "inemoticons",
+ "joinc",
#endif /* USE_UNICODE_PROPERTIES */
"cntrl",
#ifdef USE_UNICODE_PROPERTIES
- "sinh",
+ "inenclosedcjklettersandmonths",
+ "cwcf",
"inruminumeralsymbols",
- "inethiopic",
- "tamil",
- "miao",
- "inenclosedalphanumerics",
+ "ll",
"term",
- "chakma",
+ "inlatinextendedadditional",
+ "tamil",
+ "loe",
+ "newtailue",
+ "cwcm",
+ "inenclosedalphanumericsupplement",
+ "sinh",
+ "zinh",
+ "meroiticcursive",
+ "han",
+ "hani",
+ "inopticalcharacterrecognition",
+ "no",
+ "so",
+ "innewtailue",
"insinhala",
+ "innko",
+ "co",
"shavian",
- "inosmanya",
- "inlatinextendedadditional",
- "osma",
- "ll",
+ "terminalpunctuation",
+ "intaixuanjingsymbols",
+ "inethiopic",
+ "sora",
+ "inarrows",
+ "cham",
+ "inlowsurrogates",
+ "oriya",
+ "ext",
+ "cwt",
+ "common",
+ "inmiao",
"thai",
- "math",
- "thaa",
- "inenclosedalphanumericsupplement",
+ "intifinagh",
"ethi",
- "connectorpunctuation",
- "inlowsurrogates",
- "insinhalaarchaicnumbers",
- "taitham",
+ "mero",
+ "chakma",
+ "thaa",
+ "inscriptionalparthian",
+ "tifinagh",
+ "titlecaseletter",
"thaana",
- "lineara",
- "di",
- "idc",
- "meroiticcursive",
- "mand",
- "inmodi",
- "inmandaic",
- "cwl",
"asciihexdigit",
- "dia",
- "terminalpunctuation",
- "mend",
- "sind",
- "wara",
- "inwarangciti",
- "inideographicdescriptioncharacters",
- "inemoticons",
+ "math",
+ "di",
"ids",
+ "lo",
+ "inlao",
+ "taitham",
+ "lao",
+ "laoo",
+ "dia",
+ "idc",
+ "ps",
"insundanese",
"pi",
- "indominotiles",
+ "cwl",
+ "pf",
+ "mand",
+ "insylotinagri",
+ "vs",
+ "mongolian",
"pc",
- "loe",
- "titlecaseletter",
- "inopticalcharacterrecognition",
+ "inmandaic",
+ "invai",
+ "lineseparator",
+ "pe",
+ "vai",
+ "vaii",
"idst",
- "shaw",
- "cwcf",
- "idcontinue",
+ "indominotiles",
+ "inshavian",
+ "inspacingmodifierletters",
+ "format",
"inphaistosdisc",
- "pe",
+ "hano",
+#endif /* USE_UNICODE_PROPERTIES */
+ "space",
+#ifdef USE_UNICODE_PROPERTIES
"indeseret",
- "inspacingmodifierletters",
- "inlydian",
- "ps",
+ "inolchiki",
"hira",
- "whitespace",
- "inscriptionalparthian",
+ "joincontrol",
+ "idcontinue",
+ "inmahjongtiles",
+ "patws",
+ "inlydian",
"cher",
- "inmathematicalalphanumericsymbols",
- "incoptic",
"inhiragana",
- "inenclosedcjklettersandmonths",
-#endif /* USE_UNICODE_PROPERTIES */
- "space",
-#ifdef USE_UNICODE_PROPERTIES
- "oriya",
- "mero",
- "mahj",
- "tirh",
- "sora",
+ "inogham",
+ "avst",
"inscriptionalpahlavi",
- "inarrows",
- "mahajani",
- "joinc",
- "incopticepactnumbers",
- "hano",
- "palm",
- "intirhuta",
- "patws",
- "inolchiki",
- "inlepcha",
- "no",
+ "incoptic",
+ "java",
+ "inmathematicalalphanumericsymbols",
+ "letter",
+ "injavanese",
+ "avestan",
+ "age=1.1",
"lepc",
- "inogham",
- "co",
- "innko",
+ "age=2.1",
+ "inlepcha",
+ "javanese",
+ "shaw",
+ "finalpunctuation",
"alpha",
- "psalterpahlavi",
- "inmro",
- "inpalmyrene",
- "common",
- "cf",
- "inmiao",
- "so",
- "diacritic",
- "insundanesesupplement",
- "intifinagh",
- "tifinagh",
+ "age=5.1",
+ "inmongolian",
+ "age=5.2",
+ "age=2.0",
+ "ahex",
+ "ingeneralpunctuation",
+ "oids",
"odi",
+ "age=5.0",
+ "tavt",
+ "intaiviet",
+ "age=6.1",
+ "age=3.1",
+ "insundanesesupplement",
+ "age=3.2",
+ "age=4.1",
"oidc",
- "modi",
- "decimalnumber",
- "letter",
- "dash",
- "insylotinagri",
+ "tfng",
+ "insmallformvariants",
+ "ideo",
+ "intags",
+ "age=6.0",
+ "age=3.0",
+ "whitespace",
+ "age=4.0",
"inolditalic",
- "wspace",
+ "oalpha",
+ "ingujarati",
+ "control",
+ "diacritic",
+ "tagbanwa",
+ "inphoenician",
+ "ininscriptionalparthian",
+ "ininscriptionalpahlavi",
+ "coptic",
"dsrt",
- "ideo",
- "siddham",
- "perm",
- "oids",
- "inmahjongtiles",
- "lo",
- "lineseparator",
- "imperialaramaic",
+ "inmodifiertoneletters",
+ "xids",
+ "hanunoo",
+ "inoldturkic",
+ "xidc",
"idstart",
- "inlao",
- "sharada",
- "lao",
- "laoo",
- "mongolian",
- "oalpha",
"inimperialaramaic",
- "nchar",
- "inlatin1supplement",
+ "invariationselectors",
+ "copt",
+ "caseignorable",
"prti",
- "cprt",
- "nd",
+ "nchar",
"deseret",
- "inoldturkic",
- "radical",
- "canadianaboriginal",
- "inmodifiertoneletters",
- "incaucasianalbanian",
- "coptic",
- "casedletter",
- "sd",
- "inphoenician",
- "sidd",
+ "decimalnumber",
+ "cprt",
+ "inlatin1supplement",
+ "imperialaramaic",
"privateuse",
- "sundanese",
- "inancientgreekmusicalnotation",
- "insiddham",
- "cased",
- "print",
- "ininscriptionalparthian",
- "ininscriptionalpahlavi",
- "copt",
- "inancientgreeknumbers",
- "saurashtra",
- "mro",
- "mroo",
- "inalphabeticpresentationforms",
+ "casedletter",
"lowercase",
- "phli",
- "patternwhitespace",
- "inenclosedideographicsupplement",
"spaceseparator",
- "inmathematicaloperators",
- "omath",
- "lisu",
- "inpsalterpahlavi",
- "olditalic",
- "hanunoo",
- "inherited",
- "lepcha",
- "p",
- "inmongolian",
- "zp",
- "finalpunctuation",
+ "radical",
+ "mong",
+ "canadianaboriginal",
+ "letternumber",
+ "insorasompeng",
+ "dash",
+ "wspace",
+ "ogam",
+ "invariationselectorssupplement",
+ "print",
"otheridcontinue",
- "shrd",
- "ingrantha",
- "talu",
- "otheralphabetic",
- "noncharactercodepoint",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=1.1",
- "age=2.1",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
+ "ingurmukhi",
"closepunctuation",
- "letternumber",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=6.1",
- "age=6.2",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "telu",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=3.1",
- "age=3.2",
- "age=5.1",
- "age=5.2",
- "age=2.0",
- "age=6.3",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "inshorthandformatcontrols",
- "inoldnortharabian",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=6.0",
- "age=4.1",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "ingeneralpunctuation",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=3.0",
- "age=7.0",
- "age=5.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "innabataean",
-#ifdef USE_UNICODE_AGE_PROPERTIES
- "age=4.0",
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- "bamum",
- "control",
- "induployan",
- "inlatinextendedd",
- "inarabic",
- "runic",
- "inelbasan",
+ "olditalic",
+ "noncharactercodepoint",
+ "sharada",
+ "ingeometricshapes",
+ "otheralphabetic",
+ "patternwhitespace",
+ "po",
+ "rjng",
+ "ingreekandcoptic",
+ "xdigit",
+ "gothic",
"inoldsoutharabian",
+ "xidstart",
+ "inrejang",
+ "idsbinaryoperator",
+ "olower",
+ "hex",
+ "inenclosedideographicsupplement",
+ "inalphabeticpresentationforms",
"inbasiclatin",
- "format",
- "innumberforms",
- "inugaritic",
+ "othersymbol",
+ "nd",
+ "sd",
+ "omath",
"separator",
- "idsbinaryoperator",
- "tagbanwa",
- "bass",
- "saur",
- "nbat",
- "intaixuanjingsymbols",
- "joincontrol",
+ "inarabic",
+ "xidcontinue",
"otheridstart",
- "inbyzantinemusicalsymbols",
- "intags",
- "nabataean",
- "insuperscriptsandsubscripts",
- "intibetan",
- "insaurashtra",
- "othersymbol",
- "ext",
- "inarabicpresentationformsa",
- "inmiscellaneousmathematicalsymbolsb",
+ "grext",
"otherlowercase",
- "phoenician",
+ "phli",
+ "cased",
+ "hang",
+ "xpeo",
#endif /* USE_UNICODE_PROPERTIES */
"lower",
#ifndef USE_UNICODE_PROPERTIES
"graph",
#else /* USE_UNICODE_PROPERTIES */
- "linb",
- "po",
- "inmyanmarextendedb",
- "limb",
+ "modifierletter",
+ "inphoneticextensions",
+ "inarabicpresentationformsa",
+ "innumberforms",
+ "oldpersian",
+ "incyrillicextendeda",
+ "inverticalforms",
+ "p",
+ "inbyzantinemusicalsymbols",
+ "inmathematicaloperators",
+ "intibetan",
+ "zp",
+ "ingeorgian",
"inbraillepatterns",
- "tibt",
- "cuneiform",
+ "lepcha",
+ "geor",
+ "invedicextensions",
+ "linb",
+ "other",
+ "deva",
+ "indevanagari",
+ "othernumber",
+ "bamum",
+ "shrd",
"bali",
- "oldpersian",
- "oldpermic",
- "pf",
- "word",
- "tibetan",
- "incyrillicsupplement",
- "elba",
- "insupplementalmathematicaloperators",
+ "devanagari",
+ "extender",
+ "inherited",
+ "glagolitic",
+ "tibt",
"inbalinese",
+ "ingothic",
+ "inmiscellaneousmathematicalsymbolsb",
+ "limb",
"bengali",
- "caseignorable",
- "incountingrodnumerals",
- "other",
- "tirhuta",
- "othernumber",
+ "phoenician",
+ "insuperscriptsandsubscripts",
+ "inmeroitichieroglyphs",
+ "tibetan",
+ "inphoneticextensionssupplement",
"balinese",
- "elbasan",
- "inunifiedcanadianaboriginalsyllabics",
"lowercaseletter",
- "ethiopic",
- "gran",
- "ingurmukhi",
- "sund",
- "inethiopicsupplement",
- "inoldpersian",
- "inoldpermic",
- "othermath",
- "unassigned",
- "hmng",
- "narb",
- "brai",
- "hang",
- "insorasompeng",
- "arab",
- "plrd",
- "ingujarati",
- "brahmi",
- "runr",
- "ahex",
- "mong",
- "pauc",
- "sarb",
- "ogam",
- "olower",
- "pd",
- "number",
- "inbrahmi",
- "otherletter",
- "ingothic",
- "phagspa",
- "inletterlikesymbols",
- "yi",
- "hangul",
- "yiii",
- "tfng",
- "insupplementalarrowsc",
- "ingreekandcoptic",
- "xidc",
- "insupplementalarrowsa",
- "gothic",
- "grext",
- "incombininghalfmarks",
- "deprecated",
- "inbassavah",
- "xids",
- "linearb",
- "ingeometricshapes",
- "phlp",
- "warangciti",
- "inblockelements",
- "modifierletter",
"indingbats",
- "dep",
- "punct",
- "inhanunoo",
- "bidic",
- "ingreekextended",
- "idsb",
+ "inprivateusearea",
"assigned",
- "otherpunctuation",
+ "patternsyntax",
"inhangulsyllables",
- "inarabicmathematicalalphabeticsymbols",
- "inornamentaldingbats",
+ "sarb",
+ "brai",
+ "insupplementalmathematicaloperators",
+ "phnx",
+ "ingreekextended",
+ "otherletter",
+ "arab",
+ "inlatinextendedd",
+ "word",
"inphagspa",
- "lyci",
- "mlym",
- "inarabicextendeda",
- "rjng",
- "lycian",
- "inalchemicalsymbols",
- "xdigit",
+ "inblockelements",
+ "ethiopic",
+ "inethiopicextendeda",
+ "brahmi",
+ "logicalorderexception",
+ "inoldpersian",
+ "inletterlikesymbols",
+ "sorasompeng",
+ "hiragana",
+ "inhanguljamoextendeda",
+ "othermath",
#endif /* USE_UNICODE_PROPERTIES */
"digit",
#ifndef USE_UNICODE_PROPERTIES
"blank"
#else /* USE_UNICODE_PROPERTIES */
- "xidstart",
- "inrejang",
- "malayalam",
- "idstrinaryoperator",
- "invai",
- "vai",
- "vaii",
- "hiragana",
- "ingeorgian",
- "braille",
- "geor",
- "brah",
- "glagolitic",
+ "goth",
+ "ogham",
+ "sundanese",
+ "saurashtra",
+ "linearb",
+ "graphemebase",
+ "inunifiedcanadianaboriginalsyllabics",
+ "cuneiform",
"inkannada",
- "cakm",
"kana",
- "hebr",
- "inshavian",
- "vs",
+ "inancientgreeknumbers",
+ "incjkstrokes",
+ "inglagolitic",
+ "inancientgreekmusicalnotation",
"inchakma",
- "ogham",
- "sylotinagri",
- "inunifiedcanadianaboriginalsyllabicsextended",
- "inmeroitichieroglyphs",
- "grantha",
- "graphemebase",
- "mathsymbol",
- "mymr",
- "insupplementaryprivateuseareaa",
- "mendekikakui",
+ "plrd",
+ "inbrahmi",
+ "cakm",
"incjkcompatibilityforms",
- "inhalfwidthandfullwidthforms",
+ "lisu",
"incjkcompatibilityideographs",
+ "intagalog",
"inkaithi",
- "avst",
- "inarabicsupplement",
+ "insupplementalarrowsa",
"takri",
- "syrc",
- "meeteimayek",
- "myanmar",
- "avestan",
- "inhanguljamoextendeda",
- "goth",
- "inkatakana",
- "incyrillicextendeda",
- "alphabetic",
- "syriac",
"ideographic",
- "incjkstrokes",
- "inlinearbsyllabary",
- "tavt",
- "intaiviet",
+ "hexdigit",
+ "glag",
+ "softdotted",
+ "variationselector",
+ "inkatakana",
+ "meeteimayek",
+ "otherpunctuation",
+ "inhanguljamo",
+ "kali",
+ "braille",
+ "incombininghalfmarks",
+ "talu",
"incjkcompatibilityideographssupplement",
+ "telu",
+ "idsb",
+ "tglg",
"inmeeteimayek",
- "kali",
- "inyiradicals",
- "lu",
- "inoriya",
- "hebrew",
- "extender",
- "inhighprivateusesurrogates",
- "limbu",
- "inbuhid",
- "inethiopicextendeda",
- "xidcontinue",
- "inyijinghexagramsymbols",
- "logicalorderexception",
- "inhebrew",
- "cyrl",
- "osmanya",
- "phnx",
- "incombiningdiacriticalmarks",
+ "yi",
+ "phagspa",
+ "yiii",
+ "inarabicmathematicalalphabeticsymbols",
+ "saur",
+ "ogrext",
+ "bidic",
"inkanasupplement",
- "inlisu",
- "changeswhencasemapped",
- "incombiningdiacriticalmarksforsymbols",
- "cwu",
+ "runic",
+ "inalchemicalsymbols",
+ "georgian",
+ "inugaritic",
+ "insaurashtra",
+ "inhighprivateusesurrogates",
+ "pd",
+ "incountingrodnumerals",
+ "inarabicextendeda",
+ "inkharoshthi",
+ "idstrinaryoperator",
"phag",
- "insmallformvariants",
- "inpahawhhmong",
- "otheruppercase",
- "intelugu",
- "incombiningdiacriticalmarkssupplement",
- "ingeometricshapesextended",
- "xpeo",
- "bamu",
- "inbamum",
+ "brah",
"mark",
- "dupl",
- "graph",
- "dashpunctuation",
- "patternsyntax",
- "changeswhentitlecased",
- "inkharoshthi",
+ "hebr",
+ "inkhmersymbols",
+ "dep",
"inkhmer",
- "java",
- "sylo",
- "ugaritic",
- "otherdefaultignorablecodepoint",
- "softdotted",
- "uideo",
- "inphoneticextensions",
- "injavanese",
- "invariationselectors",
- "kaithi",
- "cyrillic",
+ "deprecated",
+ "rejang",
+ "lyci",
"intakri",
"takr",
- "javanese",
- "bidicontrol",
- "caucasianalbanian",
- "lydi",
- "insupplementalpunctuation",
- "inphoneticextensionssupplement",
- "lydian",
- "oldturkic",
- "invariationselectorssupplement",
- "kthi",
- "inhanguljamo",
- "patsyn",
- "inlimbu",
- "sorasompeng",
- "orya",
- "inkhmersymbols",
- "inglagolitic",
- "indevanagari",
- "deva",
- "knda",
+ "incyrillicsupplement",
+ "changeswhencasefolded",
+ "indevanagariextended",
+ "lycian",
"inbengali",
- "symbol",
- "devanagari",
- "inmendekikakui",
"beng",
- "invedicextensions",
- "graphemeextend",
- "kannada",
- "inbuginese",
+ "graph",
+ "inyijinghexagramsymbols",
"olck",
- "meroitichieroglyphs",
- "ugar",
- "intagalog",
- "inbamumsupplement",
+ "inarabicsupplement",
+ "inbuginese",
+ "changeswhencasemapped",
"olchiki",
- "incurrencysymbols",
- "tagb",
"inaegeannumbers",
+ "mlym",
+ "alphabetic",
+ "sylotinagri",
+ "changeswhentitlecased",
+ "tagalog",
+ "tagb",
+ "runr",
+ "malayalam",
+ "inoriya",
"intagbanwa",
- "uppercase",
- "defaultignorablecodepoint",
- "glag",
- "inkatakanaphoneticextensions",
- "changeswhencasefolded",
- "inpaucinhau",
- "inprivateusearea",
- "paucinhau",
- "spacingmark",
- "khmr",
- "khar",
- "inarabicpresentationformsb",
- "changeswhenlowercased",
- "tglg",
- "inethiopicextended",
- "incombiningdiacriticalmarksextended",
- "oupper",
- "incjksymbolsandpunctuation",
- "bopo",
- "punctuation",
- "combiningmark",
- "inplayingcards",
- "inbopomofo",
- "hyphen",
- "inkhojki",
+ "syrc",
"nko",
"nkoo",
+ "inethiopicextended",
+ "kaithi",
+ "mathsymbol",
+ "inyiradicals",
+ "insupplementaryprivateuseareaa",
+ "osmanya",
+ "syriac",
+ "otherdefaultignorablecodepoint",
+ "number",
+ "inlinearbsyllabary",
+ "kthi",
+ "sund",
+ "mymr",
+ "incombiningdiacriticalmarks",
"enclosingmark",
- "openpunctuation",
- "currencysymbol",
- "inverticalforms",
- "hex",
+ "incombiningdiacriticalmarksforsymbols",
+ "inethiopicsupplement",
+ "unassigned",
+ "sylo",
+ "combiningmark",
+ "myanmar",
+ "graphemeextend",
+ "bidicontrol",
+ "inhalfwidthandfullwidthforms",
+ "cyrl",
+ "knda",
+ "inunifiedcanadianaboriginalsyllabicsextended",
+ "xsux",
"modifiersymbol",
- "inlatinextendedb",
+ "incombiningdiacriticalmarkssupplement",
+ "inhanunoo",
+ "inbuhid",
+ "kannada",
+ "inhebrew",
+ "grbase",
+ "spacingmark",
+ "inkatakanaphoneticextensions",
+ "hangul",
+ "incjksymbolsandpunctuation",
+ "bopo",
+ "orya",
+ "inbopomofo",
"kharoshthi",
+ "khar",
+ "changeswhenlowercased",
+ "khmr",
+ "punct",
+ "symbol",
"cherokee",
- "pahawhhmong",
- "cypriot",
- "incypriotsyllabary",
- "palmyrene",
- "upper",
- "aghb",
- "georgian",
- "gujr",
- "grbase",
- "gujarati",
- "hexdigit",
- "khmer",
- "uppercaseletter",
- "insupplementalarrowsb",
- "surrogate",
- "unifiedideograph",
+ "cyrillic",
+ "inkangxiradicals",
+ "hebrew",
+ "inarabicpresentationformsb",
+ "incyrillicextendedb",
+ "ugaritic",
+ "incurrencysymbols",
+ "meroitichieroglyphs",
+ "inhighsurrogates",
"nonspacingmark",
- "othergraphemeextend",
- "indevanagariextended",
+ "lydi",
+ "patsyn",
"orkh",
- "ingeorgiansupplement",
- "oldnortharabian",
- "tagalog",
- "khoj",
+ "lydian",
+ "ugar",
+ "othergraphemeextend",
+ "inlatinextendedb",
"bopomofo",
- "rejang",
- "buhd",
- "incjkradicalssupplement",
+ "khmer",
+ "uideo",
+ "otheruppercase",
+ "grek",
+ "gujr",
+ "gujarati",
+ "inhanguljamoextendedb",
+ "defaultignorablecodepoint",
+ "inplayingcards",
+ "bamu",
"inkanbun",
- "variationselector",
- "inkangxiradicals",
- "inhighsurrogates",
- "insupplementaryprivateuseareab",
- "ogrext",
+ "incjkradicalssupplement",
+ "cypriot",
+ "inbamum",
+ "inmeroiticcursive",
+ "oldturkic",
+ "insupplementalarrowsb",
+ "surrogate",
"batk",
- "inhanguljamoextendedb",
"inbatak",
- "incyrillicextendedb",
+ "inlimbu",
+ "incypriotsyllabary",
+ "dashpunctuation",
"innoblock",
- "any",
- "xsux",
- "bugi",
- "inkhudawadi",
- "telugu",
- "changeswhenuppercased",
- "grek",
- "guru",
+ "hyphen",
+ "insupplementalpunctuation",
+ "ingeorgiansupplement",
+ "oupper",
"paragraphseparator",
- "buginese",
- "inyisyllables",
+ "inbamumsupplement",
+ "uppercase",
+ "currencysymbol",
+ "sk",
+ "lu",
+ "openpunctuation",
+ "inlisu",
+ "qmark",
"egyp",
- "khudawadi",
- "unknown",
- "bassavah",
+ "insupplementaryprivateuseareab",
+ "limbu",
"inegyptianhieroglyphs",
- "buhid",
+ "unifiedideograph",
+ "intelugu",
+ "katakana",
+ "inhangulcompatibilityjamo",
+ "upper",
"inkayahli",
- "inmeroiticcursive",
+ "cwu",
"incjkcompatibility",
- "oldsoutharabian",
+ "uppercaseletter",
+ "bugi",
+ "buginese",
+ "any",
+ "inyisyllables",
+ "inbopomofoextended",
+ "inboxdrawing",
+ "changeswhenuppercased",
+ "unknown",
"quotationmark",
- "inhangulcompatibilityjamo",
- "qmark",
- "incjkunifiedideographsextensionc",
- "sk",
- "incjkunifiedideographsextensiona",
- "incjkunifiedideographs",
- "katakana",
+ "buhd",
+ "punctuation",
+ "oldsoutharabian",
"kayahli",
- "duployan",
+ "incjkunifiedideographs",
+ "incjkunifiedideographsextensiona",
+ "incjkunifiedideographsextensionc",
+ "telugu",
+ "guru",
+ "greek",
+ "grlink",
+ "buhid",
+ "batak",
+ "blank",
"incjkunifiedideographsextensiond",
- "inbopomofoextended",
- "khojki",
- "zyyy",
+ "graphemelink",
"egyptianhieroglyphs",
"incjkunifiedideographsextensionb",
- "batak",
- "blank",
- "inboxdrawing",
- "greek",
- "gurmukhi",
- "grlink",
- "graphemelink"
+ "zyyy",
+ "gurmukhi"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
@@ -31173,1296 +27366,1137 @@ uniname2ctype_p (str, len)
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 34},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 20},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 33},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 17},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 46},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 30},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 60},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 51},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 18},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 31},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 51},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 438},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 114},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str36, 231},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 54},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 383},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 208},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46, 47},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 20},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48, 49},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51, 168},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 22},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str55, 461},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str56, 101},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str59, 32},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 60},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 17},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 19},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 47},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str61, 258},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 101},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 114},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 14},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str65, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 33},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 265},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 22},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 54},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 14},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str85, 439},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 374},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 462},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str97, 278},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str98, 252},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str105, 159},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str110, 406},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 128},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 43},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str115, 411},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str117, 263},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 401},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 377},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str130, 333},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str134, 24},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str135, 473},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str136, 26},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str137, 120},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str141, 227},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str142, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 226},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str144, 413},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 31},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66, 239},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str147, 384},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str151, 151},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 30},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 49},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str153, 13},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 32},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 232},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str155, 302},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 412},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str157, 325},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 168},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str161, 331},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 382},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str163, 276},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str166, 488},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 413},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str170, 339},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 252},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str173, 426},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 485},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str183, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99, 419},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100, 304},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 355},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 65},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str190, 92},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 312},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str203, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str113, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 430},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 75},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str206, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 237},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124, 120},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str125, 159},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str132, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str133, 151},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str134, 384},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str135, 432},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str136, 298},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str142, 92},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str151, 347},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str156, 306},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str208, 273},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209, 88},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str158, 204},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str167, 356},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 341},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str172, 26},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str226, 298},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 120},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str237, 250},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str239, 408},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str240, 129},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str241, 23},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str243, 36},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 152},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247, 386},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str250, 52},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str179, 379},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str180, 276},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str184, 75},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 28},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 289},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str256, 414},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str257, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 111},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str259, 148},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str260, 160},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 388},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str189, 13},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str199, 250},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 256},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201, 272},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 120},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str266, 78},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str267, 281},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str270, 299},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 23},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str272, 148},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str207, 36},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str274, 170},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str280, 80},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str284, 324},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str287, 261},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str288, 155},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str294, 114},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str295, 109},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str298, 155},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str299, 109},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str302, 63},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 286},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 450},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str307, 150},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str315, 185},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str316, 449},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str317, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str318, 92},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str320, 444},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209, 52},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str327, 284},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str330, 88},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str331, 172},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str332, 327},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str333, 205},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str216, 247},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str217, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str218, 224},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str335, 169},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str337, 277},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str347, 123},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str350, 423},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 314},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 124},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str362, 25},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str363, 93},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 314},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str366, 55},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 263},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str224, 385},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str225, 235},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str374, 483},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str376, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 148},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str230, 358},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str231, 124},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str232, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str233, 172},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str234, 410},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str239, 230},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str240, 148},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str380, 394},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str244, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str245, 155},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str382, 451},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247, 160},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str248, 323},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386, 151},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str388, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 392},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str253, 78},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str254, 255},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255, 155},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str256, 80},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str259, 260},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str390, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 39},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str392, 70},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str401, 67},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 170},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str264, 297},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str405, 170},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str407, 168},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str408, 457},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268, 300},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str410, 266},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279, 431},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 61},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str281, 178},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str288, 3},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str301, 333},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 208},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str415, 211},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 405},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str308, 25},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str313, 182},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str418, 205},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str419, 186},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str316, 287},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str423, 196},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str425, 198},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str320, 88},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str321, 201},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str433, 459},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str439, 350},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str329, 129},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str330, 65},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str339, 428},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str346, 92},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str347, 114},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str441, 486},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str349, 170},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str353, 109},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str357, 109},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str358, 299},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str359, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str360, 50},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str364, 273},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str365, 251},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str367, 238},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str372, 21},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 66},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 123},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str456, 305},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str466, 43},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str468, 481},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str470, 39},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str476, 224},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str477, 28},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str378, 182},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485, 326},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386, 421},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str387, 258},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str487, 218},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str389, 174},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 295},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str489, 123},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str490, 64},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str400, 150},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str493, 67},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str502, 412},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str508, 41},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str518, 421},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str519, 253},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str520, 432},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str403, 365},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str522, 45},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str530, 106},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str536, 199},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str540, 162},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str544, 100},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 477},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str546, 342},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str550, 352},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str554, 360},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str405, 87},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str406, 189},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str409, 63},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 74},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str556, 9},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 416},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str420, 93},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str570, 87},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str571, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str425, 317},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str426, 99},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str427, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str428, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str429, 82},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str430, 162},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str573, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str432, 131},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str436, 28},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str582, 197},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str584, 174},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str445, 82},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str449, 185},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str450, 55},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 70},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str454, 66},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str593, 322},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 184},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str596, 201},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str597, 415},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str598, 116},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str600, 191},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str601, 455},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str460, 27},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str468, 253},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str603, 229},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str604, 308},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str470, 151},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 307},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str609, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str474, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str475, 94},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str476, 188},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str611, 141},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str612, 288},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str478, 67},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 21},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 45},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str481, 278},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617, 264},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str484, 43},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485, 61},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str490, 42},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str495, 168},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str496, 346},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str497, 205},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str503, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str504, 39},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str506, 240},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str509, 341},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str622, 194},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 465},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str624, 429},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str511, 52},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 74},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str514, 41},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str515, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str516, 143},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str517, 195},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str630, 19},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str637, 468},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str520, 426},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str521, 391},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str522, 227},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str524, 19},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str528, 383},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 50},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str531, 116},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str532, 9},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str650, 211},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str658, 309},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 344},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 131},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str696, 221},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 390},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str699, 226},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str700, 187},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 281},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str548, 106},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str553, 178},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 23},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str555, 67},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str708, 202},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str709, 373},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str711, 416},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str558, 425},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 199},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str715, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str560, 206},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str718, 210},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str722, 195},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str724, 193},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str725, 225},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str727, 480},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str728, 27},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str730, 52},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str731, 160},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str735, 66},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str736, 279},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str737, 173},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str742, 94},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str743, 94},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str744, 105},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str745, 209},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 396},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str564, 100},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str749, 428},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str568, 325},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str753, 215},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str758, 249},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str761, 162},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str572, 262},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str763, 125},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str767, 35},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str768, 113},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str772, 443},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str773, 219},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str574, 153},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str575, 163},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777, 101},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str579, 315},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 158},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str779, 371},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str589, 423},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str594, 23},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str604, 354},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str783, 425},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 153},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str787, 128},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str796, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str612, 209},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str613, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 211},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str798, 223},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str803, 431},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str804, 195},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str805, 21},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str813, 140},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str815, 474},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str817, 456},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str616, 280},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str618, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str619, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str621, 218},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str622, 269},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str623, 219},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str820, 59},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str827, 7},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str626, 210},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 185},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str830, 440},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 441},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str630, 289},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str631, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str632, 198},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str633, 217},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str636, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str637, 357},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str638, 221},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str639, 213},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 282},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str641, 214},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str642, 216},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str643, 203},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str646, 131},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str647, 374},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str648, 187},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str649, 438},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str650, 220},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str651, 212},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str834, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str653, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str654, 215},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str655, 386},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str660, 186},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str668, 245},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str838, 410},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 18},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str845, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 188},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str848, 188},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str849, 188},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str850, 397},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str682, 118},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str858, 57},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str861, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str690, 395},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str701, 402},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 403},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str704, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str706, 344},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str864, 229},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str709, 68},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 116},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str866, 484},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str715, 404},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str721, 69},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str725, 66},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str729, 394},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str730, 370},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str734, 128},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 54},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str737, 60},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str738, 162},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str739, 192},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str746, 113},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str747, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str748, 125},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str871, 323},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str750, 223},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str882, 206},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str892, 156},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str895, 442},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str898, 111},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str905, 116},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str909, 114},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str910, 141},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str913, 38},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str916, 295},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str922, 53},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str923, 42},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str925, 226},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str927, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str771, 160},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str932, 454},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str776, 21},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777, 24},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str778, 57},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str934, 129},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str936, 209},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 215},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str780, 54},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str784, 196},
{-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str939, 232},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str940, 234},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str941, 41},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str943, 36},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str787, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str788, 101},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str792, 36},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str796, 408},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str797, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str798, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str799, 102},
{-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str944, 244},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str945, 245},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str946, 89},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str947, 236},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str948, 237},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str949, 241},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str950, 242},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str951, 233},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str952, 246},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str953, 471},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str954, 437},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str802, 439},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str803, 7},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str811, 203},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str815, 244},
{-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str955, 243},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 239},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str957, 316},
-#ifndef USE_UNICODE_AGE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 41},
{-1}, {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str958, 235},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str959, 247},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 240},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str823, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str824, 192},
{-1},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str962, 430},
-#ifndef USE_UNICODE_AGE_PROPERTIES
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#else /* USE_UNICODE_AGE_PROPERTIES */
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str967, 238},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str826, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str827, 303},
{-1}, {-1},
-#endif /* USE_UNICODE_AGE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str970, 157},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str830, 186},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str831, 206},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 44},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str833, 146},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str972, 18},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str974, 470},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str975, 372},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 260},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str835, 229},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str982, 103},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str984, 424},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str985, 436},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str986, 248},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str841, 11},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str995, 19},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str996, 321},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str850, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str851, 400},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str852, 68},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str998, 419},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str999, 51},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1000, 217},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1004, 118},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1012, 177},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1013, 144},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1014, 190},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1017, 475},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str854, 352},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str860, 194},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str867, 190},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1019, 201},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1023, 225},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str870, 429},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1027, 472},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1031, 496},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1033, 190},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1034, 317},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1036, 280},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1039, 376},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1040, 50},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1041, 212},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str874, 368},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str879, 222},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str884, 50},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str889, 35},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str890, 200},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str900, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str901, 51},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str907, 234},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1046, 398},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str912, 69},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str913, 202},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str914, 71},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str917, 190},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1048, 337},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1049, 213},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str919, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str920, 59},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1052, 137},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str923, 98},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str931, 133},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str933, 6},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1055, 6},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1060, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str936, 26},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 284},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str939, 369},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1064, 44},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1065, 382},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1066, 119},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str943, 294},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1068, 335},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 95},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 136},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str945, 133},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str946, 319},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str947, 371},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 135},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1073, 133},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1077, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str949, 38},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str950, 418},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str951, 296},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str952, 254},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str953, 53},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1080, 42},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 256},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 12},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 308},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1086, 95},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1089, 257},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str962, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str963, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str964, 283},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str965, 121},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str966, 17},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1093, 179},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1094, 338},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1095, 304},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1101, 84},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1104, 60},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1107, 476},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1114, 17},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str970, 83},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str972, 242},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str973, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str974, 157},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str976, 173},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str977, 135},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1118, 197},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1121, 37},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str981, 83},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1123, 135},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1129, 179},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str983, 189},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1134, 287},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1136, 25},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str988, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str989, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str990, 95},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1140, 99},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1141, 180},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1149, 270},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str994, 277},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1151, 140},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str996, 387},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str997, 310},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str998, 119},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1153, 285},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1160, 420},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1000, 84},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1163, 418},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1170, 206},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1174, 20},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1180, 181},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1181, 189},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1184, 126},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1003, 137},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1004, 290},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1186, 98},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1187, 447},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1006, 397},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1007, 95},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1010, 285},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1193, 80},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1194, 172},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1195, 271},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1197, 167},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1016, 135},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1021, 25},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1031, 305},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1201, 103},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1202, 208},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1035, 366},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1206, 105},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1039, 16},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1211, 192},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1212, 161},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1218, 102},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1221, 213},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1222, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1044, 207},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1051, 361},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1235, 34},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1238, 445},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1065, 161},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1240, 27},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1252, 417},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1067, 126},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1254, 138},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1262, 320},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1265, 110},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1269, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 311},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 137},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1271, 110},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1272, 131},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1273, 491},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1277, 255},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 288},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1279, 69},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1280, 334},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1281, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1074, 27},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1283, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1076, 80},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1285, 401},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1286, 222},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1287, 466},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1305, 68},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1078, 345},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1308, 121},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1312, 330},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1313, 194},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1314, 198},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1081, 12},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1317, 329},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 26},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 348},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 332},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1322, 222},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1087, 302},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1092, 99},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1324, 8},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1327, 291},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1334, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1094, 359},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1344, 315},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1353, 217},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1359, 16},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1364, 44},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1368, 390},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1373, 479},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1107, 167},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1385, 487},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1387, 375},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1110, 201},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1114, 389},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1399, 267},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1400, 146},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1129, 293},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1133, 174},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1402, 147},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1403, 489},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1409, 11},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1135, 106},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1142, 353},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1147, 183},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1412, 4},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1150, 4},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1151, 112},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1156, 102},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1162, 140},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1420, 68},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1421, 379},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1170, 144},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1424, 91},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1425, 218},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1429, 368},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1173, 121},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1435, 143},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1436, 143},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1438, 106},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1442, 282},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1179, 72},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1448, 126},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1455, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1185, 261},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1186, 136},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1457, 167},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1463, 130},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1465, 275},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1466, 169},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1467, 107},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1188, 249},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1469, 79},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1190, 107},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1195, 381},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1196, 331},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1471, 422},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1477, 228},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1198, 313},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1481, 448},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1490, 102},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1491, 132},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1492, 296},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1202, 420},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1212, 409},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1215, 172},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1219, 406},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1224, 169},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1225, 373},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1229, 156},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1230, 367},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1231, 264},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1244, 407},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1245, 307},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1249, 175},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1253, 187},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1495, 433},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1256, 184},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1498, 180},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1259, 130},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1500, 72},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1261, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1262, 205},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1502, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1264, 326},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1265, 159},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1274, 44},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1279, 257},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1505, 96},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1513, 498},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1514, 186},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1282, 145},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1289, 126},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1298, 372},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1516, 402},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1300, 129},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1518, 405},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1302, 437},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1306, 89},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1307, 194},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1521, 396},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1522, 446},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1310, 115},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1525, 153},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1526, 262},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1527, 175},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1529, 81},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1533, 159},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1534, 96},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1535, 153},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1536, 380},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1540, 112},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1313, 360},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1542, 353},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1315, 110},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 138},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 110},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1544, 346},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1323, 424},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1549, 56},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1550, 81},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1551, 210},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1328, 144},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1330, 193},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1555, 358},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1334, 177},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1341, 417},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1343, 103},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1344, 433},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1350, 97},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1351, 388},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1354, 349},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1557, 407},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1558, 152},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1559, 385},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1356, 364},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1362, 40},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1372, 422},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1564, 495},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1377, 241},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1576, 389},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1577, 145},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 399},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1581, 366},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1586, 29},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1587, 272},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 195},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1590, 79},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1596, 212},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1396, 138},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1598, 393},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1398, 167},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1402, 30},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1404, 79},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1411, 274},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1600, 119},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1413, 199},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1416, 268},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 292},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1422, 199},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1608, 387},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1609, 69},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1424, 146},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1429, 147},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1611, 363},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1612, 224},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1616, 259},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1617, 77},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1618, 124},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1431, 411},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1432, 175},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1621, 137},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1622, 254},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1626, 469},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1627, 367},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1628, 65},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1632, 319},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1435, 231},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1436, 64},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1438, 350},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 62},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1442, 147},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1443, 243},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1641, 138},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1645, 403},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1448, 84},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1450, 5},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1656, 467},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1452, 336},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1661, 214},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1662, 274},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1457, 142},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1665, 313},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1460, 236},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1462, 275},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1463, 65},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 490},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1671, 133},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1468, 142},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1478, 380},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1479, 91},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1480, 56},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1687, 157},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1689, 370},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1692, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1492, 132},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1498, 63},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1504, 115},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1505, 118},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1506, 103},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1510, 91},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1694, 178},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1695, 5},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1696, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1512, 246},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1700, 230},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1516, 267},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1517, 81},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1519, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1520, 139},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1523, 318},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1525, 165},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1705, 63},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1706, 435},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1712, 294},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1713, 158},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1714, 132},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1530, 49},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1531, 339},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1719, 122},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1722, 221},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1723, 223},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1729, 220},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1732, 311},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1536, 440},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1736, 381},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1540, 124},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1742, 399},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1546, 81},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1744, 165},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1747, 77},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1548, 198},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1561, 34},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1565, 378},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1566, 165},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1567, 140},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1749, 458},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1750, 175},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1755, 158},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1569, 96},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1571, 228},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1578, 32},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1581, 292},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1757, 200},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1758, 176},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1583, 259},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1765, 149},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1590, 20},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1591, 132},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1595, 30},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1598, 96},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1772, 347},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1605, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 177},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1775, 312},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1609, 376},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1617, 77},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1778, 149},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1784, 164},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1785, 497},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1786, 165},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1792, 283},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1797, 230},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1620, 90},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1802, 297},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1634, 270},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1635, 136},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 48},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1643, 286},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1804, 174},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1645, 265},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1807, 87},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1822, 300},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1648, 266},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1649, 90},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1658, 233},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1662, 72},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1824, 340},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1664, 31},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 332},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1676, 98},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 268},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1835, 83},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1836, 90},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1683, 324},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1841, 269},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1688, 108},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1692, 87},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1699, 327},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1843, 46},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1846, 83},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1849, 478},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1852, 84},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1853, 310},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1701, 134},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1703, 134},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1859, 71},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1709, 61},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1865, 90},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1866, 301},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1724, 104},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1725, 8},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1729, 46},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1869, 142},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1871, 171},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1872, 122},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1874, 290},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1732, 100},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1737, 77},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1878, 464},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1759, 322},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1880, 142},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1761, 79},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1899, 318},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 118},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1912, 409},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1780, 375},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1787, 342},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1915, 293},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1916, 58},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1917, 70},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1919, 130},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1921, 359},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1790, 122},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1932, 64},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1942, 460},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1943, 395},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1947, 192},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1953, 31},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1956, 104},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1962, 134},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1829, 291},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1964, 404},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1967, 61},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 171},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1971, 115},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1835, 363},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1853, 33},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1976, 345},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1980, 303},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1858, 149},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1986, 214},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1994, 351},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1864, 207},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1868, 164},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1871, 149},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1896, 122},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1997, 108},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1998, 38},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1899, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1900, 225},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2002, 30},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2007, 482},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2008, 354},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 108},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2021, 203},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1917, 104},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1925, 197},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2028, 452},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1932, 191},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2046, 139},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2047, 139},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2048, 32},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1944, 76},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2053, 45},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2061, 47},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2063, 400},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2071, 207},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2072, 48},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2073, 251},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2075, 134},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1949, 86},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1970, 86},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1983, 362},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2080, 100},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1988, 70},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2088, 181},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2005, 427},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2096, 125},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2105, 427},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2022, 157},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2028, 329},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2110, 191},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2113, 10},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2116, 176},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2123, 97},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2131, 86},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2033, 321},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2046, 125},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2051, 343},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2142, 72},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2152, 86},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2153, 207},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2053, 398},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2055, 164},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2189, 104},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2194, 29},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2198, 336},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2086, 309},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2087, 22},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2094, 166},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2224, 22},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2227, 220},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2102, 279},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2237, 33},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2119, 271},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2241, 216},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2242, 377},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2123, 393},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2129, 40},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2130, 442},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2252, 164},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2141, 180},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2273, 343},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2287, 189},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2162, 320},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2290, 115},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2292, 182},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2165, 316},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2311, 108},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2318, 146},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2326, 117},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2178, 191},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2343, 348},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2189, 53},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2194, 415},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2382, 356},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2406, 228},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2417, 349},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2421, 392},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2431, 499},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2445, 216},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2449, 166},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2454, 391},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2457, 306},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2462, 369},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2299, 58},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2313, 47},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2322, 48},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2338, 29},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2502, 500},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2342, 45},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2349, 340},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2527, 15},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2534, 136},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2371, 181},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2372, 154},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2377, 441},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2379, 119},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2400, 414},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2401, 197},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2562, 127},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2570, 453},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2571, 89},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2579, 62},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2588, 76},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2591, 85},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2595, 53},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2413, 248},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2429, 107},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2613, 127},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2617, 365},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2442, 328},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2631, 154},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2634, 196},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2643, 231},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2454, 10},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2685, 177},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2689, 463},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2495, 351},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2709, 117},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2515, 62},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2523, 334},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2722, 378},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2732, 434},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2734, 361},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2542, 29},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2549, 127},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2588, 127},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2787, 161},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2795, 204},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2627, 15},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2651, 338},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2671, 330},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2889, 355},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2898, 204},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2902, 493},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2906, 48},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2909, 362},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2918, 364},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2710, 301},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2724, 62},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2727, 208},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2737, 181},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2753, 117},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2785, 38},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2984, 107},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32472,20 +28506,28 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2888, 161},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2925, 145},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3112, 145},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2940, 337},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3137, 178},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2961, 335},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2962, 435},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2995, 89},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3000, 85},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32497,9 +28539,9 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3104, 76},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3278, 494},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32508,38 +28550,27 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3189, 73},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3197, 117},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3360, 357},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3254, 166},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3292, 2},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#endif /* USE_UNICODE_PROPERTIES */
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#ifndef USE_UNICODE_PROPERTIES
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str6, 12},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 7},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 8},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 13},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 11},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 10},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 14},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 3},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 9},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 6},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 5},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 4},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 2}
-#else /* USE_UNICODE_PROPERTIES */
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3466, 182},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32547,6 +28578,8 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3391, 436},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32554,8 +28587,12 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3459, 73},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3480, 154},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32574,56 +28611,62 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3777, 74},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3778, 154},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3827, 492},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3886, 166},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3941, 2},
+#endif /* USE_UNICODE_PROPERTIES */
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+#ifndef USE_UNICODE_PROPERTIES
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str6, 12},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 7},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 8},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 13},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 11},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 10},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 14},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 3},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 9},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 6},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 5},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 4},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 2}
+#else /* USE_UNICODE_PROPERTIES */
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3802, 434},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3995, 328},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4025, 76},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4035, 85},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3922, 74},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4122, 73},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
@@ -32647,7 +28690,7 @@ uniname2ctype_p (str, len)
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4322, 73}
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4167, 85}
#endif /* USE_UNICODE_PROPERTIES */
};
diff --git a/enc/us_ascii.c b/enc/us_ascii.c
index f28300ebc6..1b47778391 100644
--- a/enc/us_ascii.c
+++ b/enc/us_ascii.c
@@ -1,15 +1,11 @@
#include "regenc.h"
-#include "encindex.h"
-#ifndef ENCINDEX_US_ASCII
-#define ENCINDEX_US_ASCII 0
-#endif
static int
us_ascii_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
- if (*p & 0x80)
- return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
- return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(1);
+ if (*p & 0x80)
+ return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
+ return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(1);
}
OnigEncodingDefine(us_ascii, US_ASCII) = {
@@ -29,7 +25,7 @@ OnigEncodingDefine(us_ascii, US_ASCII) = {
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
onigenc_always_true_is_allowed_reverse_match,
- ENCINDEX_US_ASCII,
+ 0,
ONIGENC_FLAG_NONE,
};
ENC_ALIAS("ASCII", "US-ASCII")
diff --git a/enc/utf_16_32.h b/enc/utf_16_32.h
index 9f9216d8ff..da58d1b23c 100644
--- a/enc/utf_16_32.h
+++ b/enc/utf_16_32.h
@@ -1,5 +1,5 @@
#include "regenc.h"
-/* dummy for unsupported, stateful encoding */
+/* dummy for unsupported, statefull encoding */
#define ENC_DUMMY_UNICODE(name) ENC_REPLICATE(name, name "BE")
ENC_DUMMY_UNICODE("UTF-16");
ENC_DUMMY_UNICODE("UTF-32");
diff --git a/enc/utf_16be.c b/enc/utf_16be.c
index a61ae00863..8b25d473a7 100644
--- a/enc/utf_16be.c
+++ b/enc/utf_16be.c
@@ -29,7 +29,10 @@
#include "regenc.h"
-#if 0
+#define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
+#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
+#define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8)
+
static const int EncLen_UTF16[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -48,7 +51,6 @@ static const int EncLen_UTF16[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
};
-#endif
static int
utf16be_mbc_enc_len(const UChar* p, const OnigUChar* e ARG_UNUSED,
diff --git a/enc/utf_16le.c b/enc/utf_16le.c
index 7d176e710e..8feb7ad769 100644
--- a/enc/utf_16le.c
+++ b/enc/utf_16le.c
@@ -29,7 +29,10 @@
#include "regenc.h"
-#if 0
+#define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
+#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
+#define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8)
+
static const int EncLen_UTF16[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -48,7 +51,6 @@ static const int EncLen_UTF16[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
};
-#endif
static int
utf16le_mbc_enc_len(const UChar* p, const OnigUChar* e,
diff --git a/enc/utf_32be.c b/enc/utf_32be.c
index 99b1004e0c..43c07e2e8f 100644
--- a/enc/utf_32be.c
+++ b/enc/utf_32be.c
@@ -29,23 +29,11 @@
#include "regenc.h"
-static OnigCodePoint utf32be_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc);
static int
-utf32be_mbc_enc_len(const UChar* p ARG_UNUSED, const OnigUChar* e,
- OnigEncoding enc)
+utf32be_mbc_enc_len(const UChar* p ARG_UNUSED, const OnigUChar* e ARG_UNUSED,
+ OnigEncoding enc ARG_UNUSED)
{
- if (e < p) {
- return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
- }
- else if (e-p < 4) {
- return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(4-(int)(e-p));
- }
- else {
- OnigCodePoint c = utf32be_mbc_to_code(p, e, enc);
- if (!UNICODE_VALID_CODEPOINT_P(c))
- return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
- return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(4);
- }
+ return 4;
}
static int
diff --git a/enc/utf_32le.c b/enc/utf_32le.c
index 58fb3ce0aa..31693eed05 100644
--- a/enc/utf_32le.c
+++ b/enc/utf_32le.c
@@ -29,23 +29,11 @@
#include "regenc.h"
-static OnigCodePoint utf32le_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc);
static int
-utf32le_mbc_enc_len(const UChar* p ARG_UNUSED, const OnigUChar* e,
- OnigEncoding enc)
+utf32le_mbc_enc_len(const UChar* p ARG_UNUSED, const OnigUChar* e ARG_UNUSED,
+ OnigEncoding enc ARG_UNUSED)
{
- if (e < p) {
- return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
- }
- else if (e-p < 4) {
- return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(4-(int)(e-p));
- }
- else {
- OnigCodePoint c = utf32le_mbc_to_code(p, e, enc);
- if (!UNICODE_VALID_CODEPOINT_P(c))
- return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
- return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(4);
- }
+ return 4;
}
static int
diff --git a/enc/utf_7.h b/enc/utf_7.h
index 823b317740..fa9f06b1b3 100644
--- a/enc/utf_7.h
+++ b/enc/utf_7.h
@@ -1,5 +1,5 @@
#include "regenc.h"
-/* dummy for unsupported, stateful encoding */
+/* dummy for unsupported, statefull encoding */
ENC_DUMMY("UTF-7");
ENC_ALIAS("CP65000", "UTF-7");
diff --git a/enc/utf_8.c b/enc/utf_8.c
index ae5258dae2..dae1f3a1bc 100644
--- a/enc/utf_8.c
+++ b/enc/utf_8.c
@@ -28,10 +28,6 @@
*/
#include "regenc.h"
-#include "encindex.h"
-#ifndef ENCINDEX_UTF_8
-#define ENCINDEX_UTF_8 0
-#endif
#define USE_INVALID_CODE_SCHEME
@@ -39,8 +35,8 @@
/* virtual codepoint values for invalid encoding byte 0xfe and 0xff */
#define INVALID_CODE_FE 0xfffffffe
#define INVALID_CODE_FF 0xffffffff
+#define VALID_CODE_LIMIT 0x7fffffff
#endif
-#define VALID_CODE_LIMIT 0x0010ffff
#define utf8_islead(c) ((UChar )((c) & 0xc0) != 0x80)
@@ -301,7 +297,9 @@ code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
if ((code & 0xffffff80) == 0) return 1;
else if ((code & 0xfffff800) == 0) return 2;
else if ((code & 0xffff0000) == 0) return 3;
- else if (code <= VALID_CODE_LIMIT) return 4;
+ else if ((code & 0xffe00000) == 0) return 4;
+ else if ((code & 0xfc000000) == 0) return 5;
+ else if ((code & 0x80000000) == 0) return 6;
#ifdef USE_INVALID_CODE_SCHEME
else if (code == INVALID_CODE_FE) return 1;
else if (code == INVALID_CODE_FF) return 1;
@@ -330,11 +328,24 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
*p++ = (UChar )(((code>>12) & 0x0f) | 0xe0);
*p++ = UTF8_TRAILS(code, 6);
}
- else if (code <= VALID_CODE_LIMIT) {
+ else if ((code & 0xffe00000) == 0) {
*p++ = (UChar )(((code>>18) & 0x07) | 0xf0);
*p++ = UTF8_TRAILS(code, 12);
*p++ = UTF8_TRAILS(code, 6);
}
+ else if ((code & 0xfc000000) == 0) {
+ *p++ = (UChar )(((code>>24) & 0x03) | 0xf8);
+ *p++ = UTF8_TRAILS(code, 18);
+ *p++ = UTF8_TRAILS(code, 12);
+ *p++ = UTF8_TRAILS(code, 6);
+ }
+ else if ((code & 0x80000000) == 0) {
+ *p++ = (UChar )(((code>>30) & 0x01) | 0xfc);
+ *p++ = UTF8_TRAILS(code, 24);
+ *p++ = UTF8_TRAILS(code, 18);
+ *p++ = UTF8_TRAILS(code, 12);
+ *p++ = UTF8_TRAILS(code, 6);
+ }
#ifdef USE_INVALID_CODE_SCHEME
else if (code == INVALID_CODE_FE) {
*p = 0xfe;
@@ -356,7 +367,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
static int
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
- const UChar* end, UChar* fold, OnigEncoding enc)
+ const UChar* end, UChar* fold, OnigEncoding enc)
{
const UChar* p = *pp;
@@ -384,7 +395,7 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
static int
get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out,
- const OnigCodePoint* ranges[], OnigEncoding enc ARG_UNUSED)
+ const OnigCodePoint* ranges[], OnigEncoding enc ARG_UNUSED)
{
*sb_out = 0x80;
return onigenc_unicode_ctype_code_range(ctype, ranges);
@@ -428,7 +439,7 @@ OnigEncodingDefine(utf_8, UTF_8) = {
get_ctype_code_range,
left_adjust_char_head,
onigenc_always_true_is_allowed_reverse_match,
- ENCINDEX_UTF_8,
+ 0,
ONIGENC_FLAG_UNICODE,
};
ENC_ALIAS("CP65001", "UTF-8")
diff --git a/enc/windows_1250.c b/enc/windows_1250.c
deleted file mode 100644
index cb8e2233a2..0000000000
--- a/enc/windows_1250.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/**********************************************************************
- cp1250.c - Oniguruma (regular expression library)
-**********************************************************************/
-/*-
- * Copyright (c) 2006-2007 Byte <byte AT mail DOT kna DOT ru>
- * K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "regenc.h"
-
-#define ENC_CP1250_TO_LOWER_CASE(c) EncCP1250_ToLowerCaseTable[c]
-#define ENC_IS_CP1250_CTYPE(code,ctype) \
- ((EncCP1250_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
-
-static const UChar EncCP1250_ToLowerCaseTable[256] = {
- '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
- '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
- '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
- '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
- '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
- '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\232', '\213', '\234', '\235', '\236', '\237',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
- '\240', '\241', '\242', '\263', '\244', '\271', '\246', '\247',
- '\250', '\251', '\272', '\253', '\254', '\255', '\256', '\277',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\276', '\275', '\276', '\277',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
-};
-
-static const unsigned short EncCP1250_CtypeTable[256] = {
- 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
- 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
- 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
- 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
- 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
- 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
- 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
- 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
- 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
- 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
- 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
- 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
- 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
- 0x00a0, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,/* 8 */
- 0x0008, 0x0008, 0x34a2, 0x0008, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
- 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,/* 9 */
- 0x0008, 0x0008, 0x30e2, 0x0008, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
- 0x0284, 0x01a0, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x00a0, 0x00a0,/* A */
- 0x00a0, 0x00a0, 0x34a2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x34a2,
- 0x00a0, 0x00a0, 0x10a0, 0x30e2, 0x00a0, 0x30e2, 0x00a0, 0x01a0,/* B */
- 0x00a0, 0x30e2, 0x30e2, 0x01a0, 0x34a2, 0x10a0, 0x30e2, 0x30e2,
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,/* C */
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0,/* D */
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2,
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,/* E */
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0,/* F */
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
-};
-
-static int
-cp1250_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
- const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower, OnigEncoding enc ARG_UNUSED)
-{
- const UChar* p = *pp;
-
- *lower = ENC_CP1250_TO_LOWER_CASE(*p);
- (*pp)++;
- return 1;
-}
-
-static int
-cp1250_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED)
-{
- if (code < 256)
- return ENC_IS_CP1250_CTYPE(code, ctype);
- else
- return FALSE;
-}
-
-static const OnigPairCaseFoldCodes CaseFoldMap[] = {
- { 0x8a, 0x9a },
- { 0x8c, 0x9c },
- { 0x8d, 0x9d },
- { 0x8e, 0x9e },
- { 0x8f, 0x9f },
-
- { 0xa3, 0xb3 },
- { 0xa5, 0xb9 },
- { 0xaa, 0xba },
- { 0xaf, 0xbf },
-
- { 0xbc, 0xbe },
-
- { 0xc0, 0xe0 },
- { 0xc1, 0xe1 },
- { 0xc2, 0xe2 },
- { 0xc3, 0xe3 },
- { 0xc4, 0xe4 },
- { 0xc5, 0xe5 },
- { 0xc6, 0xe6 },
- { 0xc7, 0xe7 },
- { 0xc8, 0xe8 },
- { 0xc9, 0xe9 },
- { 0xca, 0xea },
- { 0xcb, 0xeb },
- { 0xcc, 0xec },
- { 0xcd, 0xed },
- { 0xce, 0xee },
- { 0xcf, 0xef },
-
- { 0xd0, 0xf0 },
- { 0xd1, 0xf1 },
- { 0xd2, 0xf2 },
- { 0xd3, 0xf3 },
- { 0xd4, 0xf4 },
- { 0xd5, 0xf5 },
- { 0xd6, 0xf6 },
- { 0xd8, 0xf8 },
- { 0xd9, 0xf9 },
- { 0xda, 0xfa },
- { 0xdb, 0xfb },
- { 0xdc, 0xfc },
- { 0xdd, 0xfd },
- { 0xde, 0xfe },
-};
-
-static int
-cp1250_apply_all_case_fold(OnigCaseFoldType flag,
- OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc ARG_UNUSED)
-{
- return onigenc_apply_all_case_fold_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
- flag, f, arg);
-}
-
-static int
-cp1250_get_case_fold_codes_by_str(OnigCaseFoldType flag,
- const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
-{
- return onigenc_get_case_fold_codes_by_str_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
- flag, p, end, items);
-}
-
-OnigEncodingDefine(windows_1250, Windows_1250) = {
- onigenc_single_byte_mbc_enc_len,
- "Windows-1250", /* name */
- 1, /* max enc length */
- 1, /* min enc length */
- onigenc_is_mbc_newline_0x0a,
- onigenc_single_byte_mbc_to_code,
- onigenc_single_byte_code_to_mbclen,
- onigenc_single_byte_code_to_mbc,
- cp1250_mbc_case_fold,
- cp1250_apply_all_case_fold,
- cp1250_get_case_fold_codes_by_str,
- onigenc_minimum_property_name_to_ctype,
- cp1250_is_code_ctype,
- onigenc_not_support_get_ctype_code_range,
- onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match,
- 0,
- ONIGENC_FLAG_NONE,
-};
-/*
- * Name: windows-1250
- * MIBenum: 2251
- * Link: http://www.iana.org/assignments/character-sets
- * Link: http://www.microsoft.com/globaldev/reference/sbcs/1250.mspx
- * Link: http://en.wikipedia.org/wiki/Windows-1250
- */
-ENC_ALIAS("CP1250", "Windows-1250")
-
diff --git a/enc/windows_1251.c b/enc/windows_1251.c
index 191d631b88..73060962c3 100644
--- a/enc/windows_1251.c
+++ b/enc/windows_1251.c
@@ -167,7 +167,7 @@ cp1251_apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, f, arg);
}
@@ -176,7 +176,7 @@ cp1251_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
- numberof(CaseFoldMap), CaseFoldMap, 0,
+ sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/windows_1252.c b/enc/windows_1252.c
deleted file mode 100644
index 85f2cfbc25..0000000000
--- a/enc/windows_1252.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/**********************************************************************
- cp1252.c - Oniguruma (regular expression library)
-**********************************************************************/
-/*-
- * Copyright (c) 2006-2007 Byte <byte AT mail DOT kna DOT ru>
- * K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "regenc.h"
-
-#define ENC_CP1252_TO_LOWER_CASE(c) EncCP1252_ToLowerCaseTable[c]
-#define ENC_IS_CP1252_CTYPE(code,ctype) \
- ((EncCP1252_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
-
-static const UChar EncCP1252_ToLowerCaseTable[256] = {
- '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
- '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
- '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
- '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
- '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
- '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\232', '\213', '\234', '\215', '\236', '\217',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\377',
- '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
- '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\277',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
-};
-
-static const unsigned short EncCP1252_CtypeTable[256] = {
- 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
- 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
- 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
- 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
- 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
- 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
- 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
- 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
- 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
- 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
- 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
- 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
- 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
- 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
- 0x00a0, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
- 0x0008, 0x0008, 0x34a2, 0x0008, 0x34a2, 0x0000, 0x34a2, 0x0000,
- 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
- 0x0008, 0x0008, 0x30e2, 0x0008, 0x30e2, 0x0000, 0x30e2, 0x34a2,
- 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
- 0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0,
- 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0,
- 0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0,
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0,
- 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2,
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0,
- 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
-};
-
-static int
-cp1252_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
- const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower, OnigEncoding enc ARG_UNUSED)
-{
- const UChar* p = *pp;
-
- *lower = ENC_CP1252_TO_LOWER_CASE(*p);
- (*pp)++;
- return 1;
-}
-
-static int
-cp1252_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED)
-{
- if (code < 256)
- return ENC_IS_CP1252_CTYPE(code, ctype);
- else
- return FALSE;
-}
-
-static const OnigPairCaseFoldCodes CaseFoldMap[] = {
- { 0x8a, 0x9a },
- { 0x8c, 0x9c },
- { 0x8e, 0x9e },
- { 0x9f, 0xff },
-
- { 0xc0, 0xe0 },
- { 0xc1, 0xe1 },
- { 0xc2, 0xe2 },
- { 0xc3, 0xe3 },
- { 0xc4, 0xe4 },
- { 0xc5, 0xe5 },
- { 0xc6, 0xe6 },
- { 0xc7, 0xe7 },
- { 0xc8, 0xe8 },
- { 0xc9, 0xe9 },
- { 0xca, 0xea },
- { 0xcb, 0xeb },
- { 0xcc, 0xec },
- { 0xcd, 0xed },
- { 0xce, 0xee },
- { 0xcf, 0xef },
-
- { 0xd0, 0xf0 },
- { 0xd1, 0xf1 },
- { 0xd2, 0xf2 },
- { 0xd3, 0xf3 },
- { 0xd4, 0xf4 },
- { 0xd5, 0xf5 },
- { 0xd6, 0xf6 },
- { 0xd8, 0xf8 },
- { 0xd9, 0xf9 },
- { 0xda, 0xfa },
- { 0xdb, 0xfb },
- { 0xdc, 0xfc },
- { 0xdd, 0xfd },
- { 0xde, 0xfe },
-};
-
-static int
-cp1252_apply_all_case_fold(OnigCaseFoldType flag,
- OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc ARG_UNUSED)
-{
- return onigenc_apply_all_case_fold_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
- flag, f, arg);
-}
-
-static int
-cp1252_get_case_fold_codes_by_str(OnigCaseFoldType flag,
- const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
-{
- return onigenc_get_case_fold_codes_by_str_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
- flag, p, end, items);
-}
-
-OnigEncodingDefine(windows_1252, Windows_1252) = {
- onigenc_single_byte_mbc_enc_len,
- "Windows-1252", /* name */
- 1, /* max enc length */
- 1, /* min enc length */
- onigenc_is_mbc_newline_0x0a,
- onigenc_single_byte_mbc_to_code,
- onigenc_single_byte_code_to_mbclen,
- onigenc_single_byte_code_to_mbc,
- cp1252_mbc_case_fold,
- cp1252_apply_all_case_fold,
- cp1252_get_case_fold_codes_by_str,
- onigenc_minimum_property_name_to_ctype,
- cp1252_is_code_ctype,
- onigenc_not_support_get_ctype_code_range,
- onigenc_single_byte_left_adjust_char_head,
- onigenc_always_true_is_allowed_reverse_match,
- 0,
- ONIGENC_FLAG_NONE,
-};
-/*
- * Name: windows-1252
- * MIBenum: 2251
- * Link: http://www.iana.org/assignments/character-sets
- * Link: http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
- * Link: http://en.wikipedia.org/wiki/Windows-1252
- */
-ENC_ALIAS("CP1252", "Windows-1252")
diff --git a/encindex.h b/encindex.h
deleted file mode 100644
index dcb1646f3a..0000000000
--- a/encindex.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**********************************************************************
-
- encindex.h -
-
- $Author$
- created at: Tue Sep 15 13:21:14 JST 2015
-
- Copyright (C) 2015 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#ifndef RUBY_ENCINDEX_H
-#define RUBY_ENCINDEX_H 1
-#if defined(__cplusplus)
-extern "C" {
-#if 0
-} /* satisfy cc-mode */
-#endif
-#endif
-
-enum ruby_preserved_encindex {
- RUBY_ENCINDEX_ASCII,
- RUBY_ENCINDEX_UTF_8,
- RUBY_ENCINDEX_US_ASCII,
-
- /* preserved indexes */
- RUBY_ENCINDEX_UTF_16BE,
- RUBY_ENCINDEX_UTF_16LE,
- RUBY_ENCINDEX_UTF_32BE,
- RUBY_ENCINDEX_UTF_32LE,
- RUBY_ENCINDEX_UTF_16,
- RUBY_ENCINDEX_UTF_32,
- RUBY_ENCINDEX_UTF8_MAC,
-
- /* for old options of regexp */
- RUBY_ENCINDEX_EUC_JP,
- RUBY_ENCINDEX_Windows_31J,
-
- RUBY_ENCINDEX_BUILTIN_MAX
-};
-
-#define ENCINDEX_ASCII RUBY_ENCINDEX_ASCII
-#define ENCINDEX_UTF_8 RUBY_ENCINDEX_UTF_8
-#define ENCINDEX_US_ASCII RUBY_ENCINDEX_US_ASCII
-#define ENCINDEX_UTF_16BE RUBY_ENCINDEX_UTF_16BE
-#define ENCINDEX_UTF_16LE RUBY_ENCINDEX_UTF_16LE
-#define ENCINDEX_UTF_32BE RUBY_ENCINDEX_UTF_32BE
-#define ENCINDEX_UTF_32LE RUBY_ENCINDEX_UTF_32LE
-#define ENCINDEX_UTF_16 RUBY_ENCINDEX_UTF_16
-#define ENCINDEX_UTF_32 RUBY_ENCINDEX_UTF_32
-#define ENCINDEX_UTF8_MAC RUBY_ENCINDEX_UTF8_MAC
-#define ENCINDEX_EUC_JP RUBY_ENCINDEX_EUC_JP
-#define ENCINDEX_Windows_31J RUBY_ENCINDEX_Windows_31J
-#define ENCINDEX_BUILTIN_MAX RUBY_ENCINDEX_BUILTIN_MAX
-
-#define rb_ascii8bit_encindex() RUBY_ENCINDEX_ASCII
-#define rb_utf8_encindex() RUBY_ENCINDEX_UTF_8
-#define rb_usascii_encindex() RUBY_ENCINDEX_US_ASCII
-
-#if defined(__cplusplus)
-#if 0
-{ /* satisfy cc-mode */
-#endif
-} /* extern "C" { */
-#endif
-
-#endif /* RUBY_ENCINDEX_H */
diff --git a/encoding.c b/encoding.c
index f2f2b55c6d..fa6e5afaa7 100644
--- a/encoding.c
+++ b/encoding.c
@@ -9,25 +9,17 @@
**********************************************************************/
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "internal.h"
-#include "encindex.h"
#include "regenc.h"
#include <ctype.h>
#include "ruby/util.h"
-#include <assert.h>
-#ifndef ENC_DEBUG
-#define ENC_DEBUG 0
-#endif
-#define ENC_ASSERT (!ENC_DEBUG)?(void)0:assert
-#define MUST_STRING(str) (ENC_ASSERT(RB_TYPE_P(str, T_STRING)), str)
-
#undef rb_ascii8bit_encindex
#undef rb_utf8_encindex
#undef rb_usascii_encindex
-typedef OnigEncodingType rb_raw_encoding;
-
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility push(default)
int rb_enc_register(const char *name, rb_encoding *encoding);
@@ -58,13 +50,6 @@ static struct {
st_table *names;
} enc_table;
-#define ENC_DUMMY_FLAG (1<<24)
-#define ENC_INDEX_MASK (~(~0U<<24))
-
-#define ENC_TO_ENCINDEX(enc) (int)((enc)->ruby_encoding_index & ENC_INDEX_MASK)
-#define ENC_DUMMY_P(enc) ((enc)->ruby_encoding_index & ENC_DUMMY_FLAG)
-#define ENC_SET_DUMMY(enc) ((enc)->ruby_encoding_index |= ENC_DUMMY_FLAG)
-
void rb_enc_init(void);
#define ENCODING_COUNT ENCINDEX_BUILTIN_MAX
@@ -77,25 +62,25 @@ void rb_enc_init(void);
static int load_encoding(const char *name);
+static size_t
+enc_memsize(const void *p)
+{
+ return 0;
+}
+
static const rb_data_type_t encoding_data_type = {
"encoding",
- {0, 0, 0,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ {0, 0, enc_memsize,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#define is_data_encoding(obj) (RTYPEDDATA_P(obj) && RTYPEDDATA_TYPE(obj) == &encoding_data_type)
#define is_obj_encoding(obj) (RB_TYPE_P((obj), T_DATA) && is_data_encoding(obj))
-int
-rb_data_is_encoding(VALUE obj)
-{
- return is_data_encoding(obj);
-}
-
static VALUE
enc_new(rb_encoding *encoding)
{
- return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, (void *)encoding);
+ return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, encoding);
}
static VALUE
@@ -122,18 +107,6 @@ rb_enc_from_encoding(rb_encoding *encoding)
return rb_enc_from_encoding_index(idx);
}
-int
-rb_enc_to_index(rb_encoding *enc)
-{
- return enc ? ENC_TO_ENCINDEX(enc) : 0;
-}
-
-int
-rb_enc_dummy_p(rb_encoding *enc)
-{
- return ENC_DUMMY_P(enc) != 0;
-}
-
static int enc_autoload(rb_encoding *);
static int
@@ -183,7 +156,7 @@ must_encindex(int index)
rb_raise(rb_eEncodingError, "encoding index out of bound: %d",
index);
}
- if (ENC_TO_ENCINDEX(enc) != (int)(index & ENC_INDEX_MASK)) {
+ if (ENC_TO_ENCINDEX(enc) != index) {
rb_raise(rb_eEncodingError, "wrong encoding index %d for %s (expected %d)",
index, rb_enc_name(enc), ENC_TO_ENCINDEX(enc));
}
@@ -281,10 +254,9 @@ enc_table_expand(int newsize)
}
static int
-enc_register_at(int index, const char *name, rb_encoding *base_encoding)
+enc_register_at(int index, const char *name, rb_encoding *encoding)
{
struct rb_encoding_entry *ent = &enc_table.list[index];
- rb_raw_encoding *encoding;
VALUE list;
if (!valid_encoding_name_p(name)) return -1;
@@ -294,19 +266,18 @@ enc_register_at(int index, const char *name, rb_encoding *base_encoding)
else if (STRCASECMP(name, ent->name)) {
return -1;
}
- encoding = (rb_raw_encoding *)ent->enc;
- if (!encoding) {
- encoding = xmalloc(sizeof(rb_encoding));
+ if (!ent->enc) {
+ ent->enc = xmalloc(sizeof(rb_encoding));
}
- if (base_encoding) {
- *encoding = *base_encoding;
+ if (encoding) {
+ *ent->enc = *encoding;
}
else {
- memset(encoding, 0, sizeof(*ent->enc));
+ memset(ent->enc, 0, sizeof(*ent->enc));
}
+ encoding = ent->enc;
encoding->name = name;
encoding->ruby_encoding_index = index;
- ent->enc = encoding;
st_insert(enc_table.names, (st_data_t)name, (st_data_t)index);
list = rb_encoding_list;
if (list && NIL_P(rb_ary_entry(list, index))) {
@@ -377,7 +348,7 @@ set_base_encoding(int index, rb_encoding *base)
rb_encoding *enc = enc_table.list[index].enc;
enc_table.list[index].base = base;
- if (ENC_DUMMY_P(base)) ENC_SET_DUMMY((rb_raw_encoding *)enc);
+ if (rb_enc_dummy_p(base)) ENC_SET_DUMMY(enc);
return enc;
}
@@ -401,7 +372,7 @@ rb_enc_set_dummy(int index)
{
rb_encoding *enc = enc_table.list[index].enc;
- ENC_SET_DUMMY((rb_raw_encoding *)enc);
+ ENC_SET_DUMMY(enc);
return index;
}
@@ -468,7 +439,7 @@ rb_define_dummy_encoding(const char *name)
int index = rb_enc_replicate(name, rb_ascii8bit_encoding());
rb_encoding *enc = enc_table.list[index].enc;
- ENC_SET_DUMMY((rb_raw_encoding *)enc);
+ ENC_SET_DUMMY(enc);
return index;
}
@@ -479,7 +450,7 @@ rb_encdb_dummy(const char *name)
rb_enc_registered(name));
rb_encoding *enc = enc_table.list[index].enc;
- ENC_SET_DUMMY((rb_raw_encoding *)enc);
+ ENC_SET_DUMMY(enc);
return index;
}
@@ -519,7 +490,7 @@ enc_ascii_compatible_p(VALUE enc)
}
/*
- * Returns non-zero when the encoding is Unicode series other than UTF-7 else 0.
+ * Returns 1 when the encoding is Unicode series other than UTF-7 else 0.
*/
int
rb_enc_unicode_p(rb_encoding *enc)
@@ -582,9 +553,12 @@ rb_encdb_alias(const char *alias, const char *orig)
void
rb_encdb_set_unicode(int index)
{
- ((rb_raw_encoding *)rb_enc_from_index(index))->flags |= ONIGENC_FLAG_UNICODE;
+ rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE;
}
+extern rb_encoding OnigEncodingUTF_8;
+extern rb_encoding OnigEncodingUS_ASCII;
+
void
rb_enc_init(void)
{
@@ -618,18 +592,12 @@ rb_enc_from_index(int index)
if (!enc_table.list) {
rb_enc_init();
}
- if (index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK)) {
+ if (index < 0 || enc_table.count <= index) {
return 0;
}
return enc_table.list[index].enc;
}
-rb_encoding *
-rb_enc_get_from_index(int index)
-{
- return must_encindex(index);
-}
-
int
rb_enc_registered(const char *name)
{
@@ -643,6 +611,13 @@ rb_enc_registered(const char *name)
return -1;
}
+static VALUE
+require_enc(VALUE enclib)
+{
+ int safe = rb_safe_level();
+ return rb_require_safe(enclib, safe > 3 ? 3 : safe);
+}
+
static int
load_encoding(const char *name)
{
@@ -650,8 +625,8 @@ load_encoding(const char *name)
VALUE verbose = ruby_verbose;
VALUE debug = ruby_debug;
VALUE errinfo;
+ VALUE loaded;
char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib) - 3;
- int loaded;
int idx;
while (s < e) {
@@ -664,11 +639,11 @@ load_encoding(const char *name)
ruby_verbose = Qfalse;
ruby_debug = Qfalse;
errinfo = rb_errinfo();
- loaded = rb_require_internal(enclib, rb_safe_level());
+ loaded = rb_protect(require_enc, enclib, 0);
ruby_verbose = verbose;
ruby_debug = debug;
rb_set_errinfo(errinfo);
- if (loaded < 0 || 1 < loaded) return -1;
+ if (NIL_P(loaded)) return -1;
if ((idx = rb_enc_registered(name)) < 0) return -1;
if (enc_autoload_p(enc_table.list[idx].enc)) return -1;
return idx;
@@ -690,8 +665,7 @@ enc_autoload(rb_encoding *enc)
}
i = enc->ruby_encoding_index;
enc_register_at(i & ENC_INDEX_MASK, rb_enc_name(enc), base);
- ((rb_raw_encoding *)enc)->ruby_encoding_index = i;
- i &= ENC_INDEX_MASK;
+ enc->ruby_encoding_index = i;
}
else {
i = load_encoding(rb_enc_name(enc));
@@ -740,7 +714,6 @@ enc_capable(VALUE obj)
case T_STRING:
case T_REGEXP:
case T_FILE:
- case T_SYMBOL:
return TRUE;
case T_DATA:
if (is_data_encoding(obj)) return TRUE;
@@ -756,19 +729,6 @@ rb_id_encoding(void)
return id_encoding;
}
-static int
-enc_get_index_str(VALUE str)
-{
- int i = ENCODING_GET_INLINED(str);
- if (i == ENCODING_INLINE_MAX) {
- VALUE iv;
-
- iv = rb_ivar_get(str, rb_id_encoding());
- i = NUM2INT(iv);
- }
- return i;
-}
-
int
rb_enc_get_index(VALUE obj)
{
@@ -777,18 +737,24 @@ rb_enc_get_index(VALUE obj)
if (SPECIAL_CONST_P(obj)) {
if (!SYMBOL_P(obj)) return -1;
- obj = rb_sym2str(obj);
+ obj = rb_id2str(SYM2ID(obj));
}
switch (BUILTIN_TYPE(obj)) {
as_default:
default:
case T_STRING:
case T_REGEXP:
- i = enc_get_index_str(obj);
+ i = ENCODING_GET_INLINED(obj);
+ if (i == ENCODING_INLINE_MAX) {
+ VALUE iv;
+
+ iv = rb_ivar_get(obj, rb_id_encoding());
+ i = NUM2INT(iv);
+ }
break;
case T_FILE:
- tmp = rb_funcallv(obj, rb_intern("internal_encoding"), 0, 0);
- if (NIL_P(tmp)) obj = rb_funcallv(obj, rb_intern("external_encoding"), 0, 0);
+ tmp = rb_funcall(obj, rb_intern("internal_encoding"), 0, 0);
+ if (NIL_P(tmp)) obj = rb_funcall(obj, rb_intern("external_encoding"), 0, 0);
else obj = tmp;
if (NIL_P(obj)) break;
case T_DATA:
@@ -843,8 +809,8 @@ rb_enc_associate_index(VALUE obj, int idx)
}
termlen = rb_enc_mbminlen(enc);
oldtermlen = rb_enc_mbminlen(rb_enc_from_index(oldidx));
- if (oldtermlen != termlen && RB_TYPE_P(obj, T_STRING)) {
- rb_str_change_terminator_length(obj, oldtermlen, termlen);
+ if (oldtermlen < termlen && RB_TYPE_P(obj, T_STRING)) {
+ rb_str_fill_terminator(obj, termlen);
}
enc_set_index(obj, idx);
return obj;
@@ -862,19 +828,6 @@ rb_enc_get(VALUE obj)
return rb_enc_from_index(rb_enc_get_index(obj));
}
-static rb_encoding* enc_compatible_str(VALUE str1, VALUE str2);
-
-rb_encoding*
-rb_enc_check_str(VALUE str1, VALUE str2)
-{
- rb_encoding *enc = enc_compatible_str(MUST_STRING(str1), MUST_STRING(str2));
- if (!enc)
- rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s",
- rb_enc_name(rb_enc_get(str1)),
- rb_enc_name(rb_enc_get(str2)));
- return enc;
-}
-
rb_encoding*
rb_enc_check(VALUE str1, VALUE str2)
{
@@ -886,12 +839,24 @@ rb_enc_check(VALUE str1, VALUE str2)
return enc;
}
-static rb_encoding*
-enc_compatible_latter(VALUE str1, VALUE str2, int idx1, int idx2)
+rb_encoding*
+rb_enc_compatible(VALUE str1, VALUE str2)
{
+ int idx1, idx2;
+ rb_encoding *enc1, *enc2;
int isstr1, isstr2;
- rb_encoding *enc1 = rb_enc_from_index(idx1);
- rb_encoding *enc2 = rb_enc_from_index(idx2);
+
+ idx1 = rb_enc_get_index(str1);
+ idx2 = rb_enc_get_index(str2);
+
+ if (idx1 < 0 || idx2 < 0)
+ return 0;
+
+ if (idx1 == idx2) {
+ return rb_enc_from_index(idx1);
+ }
+ enc1 = rb_enc_from_index(idx1);
+ enc2 = rb_enc_from_index(idx2);
isstr2 = RB_TYPE_P(str2, T_STRING);
if (isstr2 && RSTRING_LEN(str2) == 0)
@@ -941,39 +906,6 @@ enc_compatible_latter(VALUE str1, VALUE str2, int idx1, int idx2)
return 0;
}
-static rb_encoding*
-enc_compatible_str(VALUE str1, VALUE str2)
-{
- int idx1 = enc_get_index_str(str1);
- int idx2 = enc_get_index_str(str2);
-
- if (idx1 < 0 || idx2 < 0)
- return 0;
-
- if (idx1 == idx2) {
- return rb_enc_from_index(idx1);
- }
- else {
- return enc_compatible_latter(str1, str2, idx1, idx2);
- }
-}
-
-rb_encoding*
-rb_enc_compatible(VALUE str1, VALUE str2)
-{
- int idx1 = rb_enc_get_index(str1);
- int idx2 = rb_enc_get_index(str2);
-
- if (idx1 < 0 || idx2 < 0)
- return 0;
-
- if (idx1 == idx2) {
- return rb_enc_from_index(idx1);
- }
-
- return enc_compatible_latter(str1, str2, idx1, idx2);
-}
-
void
rb_enc_copy(VALUE obj1, VALUE obj2)
{
@@ -995,7 +927,7 @@ rb_obj_encoding(VALUE obj)
if (idx < 0) {
rb_raise(rb_eTypeError, "unknown encoding");
}
- return rb_enc_from_encoding_index(idx & ENC_INDEX_MASK);
+ return rb_enc_from_encoding_index(idx);
}
int
@@ -1031,8 +963,7 @@ rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc)
int
rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc)
{
- unsigned int c;
- int l;
+ unsigned int c, l;
if (e <= p)
return -1;
if (rb_enc_asciicompat(enc)) {
@@ -1141,7 +1072,7 @@ enc_inspect(VALUE self)
static VALUE
enc_name(VALUE self)
{
- return rb_fstring_cstr(rb_enc_name((rb_encoding*)DATA_PTR(self)));
+ return rb_usascii_str_new2(rb_enc_name((rb_encoding*)DATA_PTR(self)));
}
static int
@@ -1205,11 +1136,13 @@ enc_list(VALUE klass)
/*
* call-seq:
* Encoding.find(string) -> enc
+ * Encoding.find(symbol) -> enc
*
* Search the encoding with specified <i>name</i>.
- * <i>name</i> should be a string.
+ * <i>name</i> should be a string or symbol.
*
* Encoding.find("US-ASCII") #=> #<Encoding:US-ASCII>
+ * Encoding.find(:Shift_JIS) #=> #<Encoding:Shift_JIS>
*
* Names which this method accept are encoding names and aliases
* including following special aliases
@@ -1273,17 +1206,9 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
/* :nodoc: */
static VALUE
-enc_s_alloc(VALUE klass)
-{
- rb_undefined_alloc(klass);
- return Qnil;
-}
-
-/* :nodoc: */
-static VALUE
enc_dump(int argc, VALUE *argv, VALUE self)
{
- rb_check_arity(argc, 0, 1);
+ rb_scan_args(argc, argv, "01", 0);
return enc_name(self);
}
@@ -1291,13 +1216,6 @@ enc_dump(int argc, VALUE *argv, VALUE self)
static VALUE
enc_load(VALUE klass, VALUE str)
{
- return str;
-}
-
-/* :nodoc: */
-static VALUE
-enc_m_loader(VALUE klass, VALUE str)
-{
return enc_find(klass, str);
}
@@ -1346,14 +1264,16 @@ rb_usascii_encindex(void)
return ENCINDEX_US_ASCII;
}
-int rb_locale_charmap_index(void);
-
int
rb_locale_encindex(void)
{
- int idx = rb_locale_charmap_index();
+ VALUE charmap = rb_locale_charmap(rb_cEncoding);
+ int idx;
- if (idx < 0) idx = ENCINDEX_ASCII;
+ if (NIL_P(charmap))
+ idx = ENCINDEX_US_ASCII;
+ else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0)
+ idx = ENCINDEX_ASCII;
if (rb_enc_registered("locale") < 0) {
# if defined _WIN32
@@ -1394,6 +1314,8 @@ struct default_encoding {
static struct default_encoding default_external = {0};
+extern int Init_enc_set_filesystem_encoding(void);
+
static int
enc_set_default_encoding(struct default_encoding *def, VALUE encoding, const char *name)
{
@@ -1536,11 +1458,13 @@ rb_enc_default_internal(void)
* * File names from Dir
* * Integer#chr
* * String#inspect and Regexp#inspect
+ * * Strings returned from Curses
* * Strings returned from Readline
* * Strings returned from SDBM
* * Time#zone
* * Values from ENV
* * Values in ARGV including $PROGRAM_NAME
+ * * __FILE__
*
* Additionally String#encode and String#encode! use the default internal
* encoding if no encoding is given.
@@ -1585,6 +1509,34 @@ set_default_internal(VALUE klass, VALUE encoding)
return encoding;
}
+/*
+ * call-seq:
+ * Encoding.locale_charmap -> string
+ *
+ * Returns the locale charmap name.
+ * It returns nil if no appropriate information.
+ *
+ * Debian GNU/Linux
+ * LANG=C
+ * Encoding.locale_charmap #=> "ANSI_X3.4-1968"
+ * LANG=ja_JP.EUC-JP
+ * Encoding.locale_charmap #=> "EUC-JP"
+ *
+ * SunOS 5
+ * LANG=C
+ * Encoding.locale_charmap #=> "646"
+ * LANG=ja
+ * Encoding.locale_charmap #=> "eucJP"
+ *
+ * The result is highly platform dependent.
+ * So Encoding.find(Encoding.locale_charmap) may cause an error.
+ * If you need some encoding object even for unknown locale,
+ * Encoding.find("locale") can be used.
+ *
+ */
+VALUE
+rb_locale_charmap(VALUE klass);
+
static void
set_encoding_const(const char *name, rb_encoding *enc)
{
@@ -1640,7 +1592,8 @@ static int
rb_enc_name_list_i(st_data_t name, st_data_t idx, st_data_t arg)
{
VALUE ary = (VALUE)arg;
- VALUE str = rb_fstring_cstr((char *)name);
+ VALUE str = rb_usascii_str_new2((char *)name);
+ OBJ_FREEZE(str);
rb_ary_push(ary, str);
return ST_CONTINUE;
}
@@ -1682,7 +1635,8 @@ rb_enc_aliases_enc_i(st_data_t name, st_data_t orig, st_data_t arg)
if (STRCASECMP((char*)name, rb_enc_name(enc)) == 0) {
return ST_CONTINUE;
}
- str = rb_fstring_cstr(rb_enc_name(enc));
+ str = rb_usascii_str_new2(rb_enc_name(enc));
+ OBJ_FREEZE(str);
rb_ary_store(ary, idx, str);
}
key = rb_usascii_str_new2((char *)name);
@@ -1719,7 +1673,7 @@ rb_enc_aliases(VALUE klass)
* optionally, aliases:
*
* Encoding::ISO_8859_1.name
- * #=> "ISO-8859-1"
+ * #=> #<Encoding:ISO-8859-1>
*
* Encoding::ISO_8859_1.names
* #=> ["ISO-8859-1", "ISO8859-1"]
@@ -1922,7 +1876,7 @@ Init_Encoding(void)
int i;
rb_cEncoding = rb_define_class("Encoding", rb_cObject);
- rb_define_alloc_func(rb_cEncoding, enc_s_alloc);
+ rb_undef_alloc_func(rb_cEncoding);
rb_undef_method(CLASS_OF(rb_cEncoding), "new");
rb_define_method(rb_cEncoding, "to_s", enc_name, 0);
rb_define_method(rb_cEncoding, "inspect", enc_inspect, 0);
@@ -1944,7 +1898,7 @@ Init_Encoding(void)
rb_define_singleton_method(rb_cEncoding, "default_external=", set_default_external, 1);
rb_define_singleton_method(rb_cEncoding, "default_internal", get_default_internal, 0);
rb_define_singleton_method(rb_cEncoding, "default_internal=", set_default_internal, 1);
- rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0); /* in localeinit.c */
+ rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0);
list = rb_ary_new2(enc_table.count);
RBASIC_CLEAR_CLASS(list);
@@ -1954,8 +1908,6 @@ Init_Encoding(void)
for (i = 0; i < enc_table.count; ++i) {
rb_ary_push(list, enc_new(enc_table.list[i].enc));
}
-
- rb_marshal_define_compat(rb_cEncoding, Qnil, NULL, enc_m_loader);
}
/* locale insensitive ctype functions */
diff --git a/enum.c b/enum.c
index 795aaf13a3..ce7d22434b 100644
--- a/enum.c
+++ b/enum.c
@@ -9,9 +9,13 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/util.h"
+#include "node.h"
#include "id.h"
+#include "internal.h"
+
+VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
VALUE rb_mEnumerable;
@@ -26,7 +30,7 @@ static ID id_size;
#define id_lshift idLTLT
VALUE
-rb_enum_values_pack(int argc, const VALUE *argv)
+rb_enum_values_pack(int argc, VALUE *argv)
{
if (argc == 0) return Qnil;
if (argc == 1) return argv[0];
@@ -40,25 +44,25 @@ rb_enum_values_pack(int argc, const VALUE *argv)
#define enum_yield rb_yield_values2
static VALUE
-grep_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (RTEST(rb_funcall(memo->v1, id_eqq, 1, i)) == RTEST(memo->u3.value)) {
- rb_ary_push(memo->v2, i);
+ if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) {
+ rb_ary_push(memo->u2.value, i);
}
return Qnil;
}
static VALUE
-grep_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (RTEST(rb_funcall(memo->v1, id_eqq, 1, i)) == RTEST(memo->u3.value)) {
- rb_ary_push(memo->v2, rb_yield(i));
+ if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) {
+ rb_ary_push(memo->u2.value, rb_yield(i));
}
return Qnil;
}
@@ -85,56 +89,30 @@ static VALUE
enum_grep(VALUE obj, VALUE pat)
{
VALUE ary = rb_ary_new();
- struct MEMO *memo = MEMO_NEW(pat, ary, Qtrue);
+ NODE *memo = NEW_MEMO(pat, ary, 0);
rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)memo);
return ary;
}
-/*
- * call-seq:
- * enum.grep_v(pattern) -> array
- * enum.grep_v(pattern) { |obj| block } -> array
- *
- * Inverted version of Enumerable#grep.
- * Returns an array of every element in <i>enum</i> for which
- * not <code>Pattern === element</code>.
- *
- * (1..10).grep_v 2..5 #=> [1, 6, 7, 8, 9, 10]
- * res =(1..10).grep_v(2..5) { |v| v * 2 }
- * res #=> [2, 12, 14, 16, 18, 20]
- *
- */
-
static VALUE
-enum_grep_v(VALUE obj, VALUE pat)
+count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- VALUE ary = rb_ary_new();
- struct MEMO *memo = MEMO_NEW(pat, ary, Qfalse);
-
- rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)memo);
-
- return ary;
-}
-
-static VALUE
-count_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
-{
- struct MEMO *memo = MEMO_CAST(memop);
+ NODE *memo = RNODE(memop);
ENUM_WANT_SVALUE();
- if (rb_equal(i, memo->v1)) {
+ if (rb_equal(i, memo->u1.value)) {
memo->u3.cnt++;
}
return Qnil;
}
static VALUE
-count_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
+count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(memop);
+ NODE *memo = RNODE(memop);
if (RTEST(enum_yield(argc, argv))) {
memo->u3.cnt++;
@@ -143,9 +121,9 @@ count_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
}
static VALUE
-count_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
+count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(memop);
+ NODE *memo = RNODE(memop);
memo->u3.cnt++;
return Qnil;
@@ -173,7 +151,7 @@ static VALUE
enum_count(int argc, VALUE *argv, VALUE obj)
{
VALUE item = Qnil;
- struct MEMO *memo;
+ NODE *memo;
rb_block_call_func *func;
if (argc == 0) {
@@ -192,19 +170,19 @@ enum_count(int argc, VALUE *argv, VALUE obj)
func = count_i;
}
- memo = MEMO_NEW(item, 0, 0);
+ memo = NEW_MEMO(item, 0, 0);
rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo);
return INT2NUM(memo->u3.cnt);
}
static VALUE
-find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
+find_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
if (RTEST(rb_yield(i))) {
- struct MEMO *memo = MEMO_CAST(memop);
- MEMO_V1_SET(memo, i);
+ NODE *memo = RNODE(memop);
+ memo->u1.value = i;
memo->u3.cnt = 1;
rb_iter_break();
}
@@ -225,39 +203,39 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
*
* If no block is given, an enumerator is returned instead.
*
- * (1..10).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
- * (1..100).find { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
+ * (1..10).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..100).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
*
*/
static VALUE
enum_find(int argc, VALUE *argv, VALUE obj)
{
- struct MEMO *memo;
+ NODE *memo;
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
RETURN_ENUMERATOR(obj, argc, argv);
- memo = MEMO_NEW(Qundef, 0, 0);
+ memo = NEW_MEMO(Qundef, 0, 0);
rb_block_call(obj, id_each, 0, 0, find_i, (VALUE)memo);
if (memo->u3.cnt) {
- return memo->v1;
+ return memo->u1.value;
}
if (!NIL_P(if_none)) {
- return rb_funcallv(if_none, id_call, 0, 0);
+ return rb_funcall(if_none, id_call, 0, 0);
}
return Qnil;
}
static VALUE
-find_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
+find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(memop);
+ NODE *memo = RNODE(memop);
ENUM_WANT_SVALUE();
- if (rb_equal(i, memo->v2)) {
- MEMO_V1_SET(memo, UINT2NUM(memo->u3.cnt));
+ if (rb_equal(i, memo->u2.value)) {
+ memo->u1.value = UINT2NUM(memo->u3.cnt);
rb_iter_break();
}
memo->u3.cnt++;
@@ -265,12 +243,12 @@ find_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
}
static VALUE
-find_index_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
+find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(memop);
+ NODE *memo = RNODE(memop);
if (RTEST(enum_yield(argc, argv))) {
- MEMO_V1_SET(memo, UINT2NUM(memo->u3.cnt));
+ memo->u1.value = UINT2NUM(memo->u3.cnt);
rb_iter_break();
}
memo->u3.cnt++;
@@ -299,7 +277,7 @@ find_index_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
static VALUE
enum_find_index(int argc, VALUE *argv, VALUE obj)
{
- struct MEMO *memo; /* [return value, current index, ] */
+ NODE *memo; /* [return value, current index, ] */
VALUE condition_value = Qnil;
rb_block_call_func *func;
@@ -315,13 +293,13 @@ enum_find_index(int argc, VALUE *argv, VALUE obj)
func = find_index_i;
}
- memo = MEMO_NEW(Qnil, condition_value, 0);
+ memo = NEW_MEMO(Qnil, condition_value, 0);
rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo);
- return memo->v1;
+ return memo->u1.value;
}
static VALUE
-find_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
@@ -339,24 +317,6 @@ enum_size(VALUE self, VALUE args, VALUE eobj)
return (r == Qundef) ? Qnil : r;
}
-static long
-limit_by_enum_size(VALUE obj, long n)
-{
- unsigned long limit;
- VALUE size = rb_check_funcall(obj, id_size, 0, 0);
- if (!FIXNUM_P(size)) return n;
- limit = FIX2ULONG(size);
- return ((unsigned long)n > limit) ? (long)limit : n;
-}
-
-static int
-enum_size_over_p(VALUE obj, long n)
-{
- VALUE size = rb_check_funcall(obj, id_size, 0, 0);
- if (!FIXNUM_P(size)) return 0;
- return ((unsigned long)n > FIX2ULONG(size));
-}
-
/*
* call-seq:
* enum.find_all { |obj| block } -> array
@@ -391,7 +351,7 @@ enum_find_all(VALUE obj)
}
static VALUE
-reject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+reject_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
@@ -432,7 +392,7 @@ enum_reject(VALUE obj)
}
static VALUE
-collect_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+collect_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
rb_ary_push(ary, enum_yield(argc, argv));
@@ -440,7 +400,7 @@ collect_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
}
static VALUE
-collect_all(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+collect_all(VALUE i, VALUE ary, int argc, VALUE *argv)
{
rb_thread_check_ints();
rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@@ -460,7 +420,7 @@ collect_all(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
*
* If no block is given, an enumerator is returned instead.
*
- * (1..4).map { |i| i*i } #=> [1, 4, 9, 16]
+ * (1..4).collect { |i| i*i } #=> [1, 4, 9, 16]
* (1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
*
*/
@@ -479,7 +439,7 @@ enum_collect(VALUE obj)
}
static VALUE
-flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
VALUE tmp;
@@ -550,21 +510,14 @@ enum_to_a(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-enum_to_h_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
+enum_to_h_i(VALUE i, VALUE hash, int argc, VALUE *argv)
{
- VALUE key_value_pair;
ENUM_WANT_SVALUE();
rb_thread_check_ints();
- key_value_pair = rb_check_array_type(i);
- if (NIL_P(key_value_pair)) {
- rb_raise(rb_eTypeError, "wrong element type %s (expected array)",
- rb_builtin_class_name(i));
- }
- if (RARRAY_LEN(key_value_pair) != 2) {
- rb_raise(rb_eArgError, "element has wrong array length (expected 2, was %ld)",
- RARRAY_LEN(key_value_pair));
+ i = rb_check_array_type(i);
+ if (!NIL_P(i) && RARRAY_LEN(i) == 2) {
+ rb_hash_aset(hash, RARRAY_AREF(i, 0), RARRAY_AREF(i, 1));
}
- rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1));
return Qnil;
}
@@ -573,7 +526,8 @@ enum_to_h_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
* enum.to_h(*args) -> hash
*
* Returns the result of interpreting <i>enum</i> as a list of
- * <tt>[key, value]</tt> pairs.
+ * <tt>[key, value]</tt> pairs. Elements other than pairs of
+ * values are ignored.
*
* %i[hello world].each_with_index.to_h
* # => {:hello => 0, :world => 1}
@@ -589,41 +543,42 @@ enum_to_h(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-inject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
+inject_i(VALUE i, VALUE p, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(p);
+ NODE *memo = RNODE(p);
ENUM_WANT_SVALUE();
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, i);
+ if (memo->u2.argc == 0) {
+ memo->u2.argc = 1;
+ memo->u1.value = i;
}
else {
- MEMO_V1_SET(memo, rb_yield_values(2, memo->v1, i));
+ memo->u1.value = rb_yield_values(2, memo->u1.value, i);
}
return Qnil;
}
static VALUE
-inject_op_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
+inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(p);
+ NODE *memo = RNODE(p);
VALUE name;
ENUM_WANT_SVALUE();
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, i);
+ if (memo->u2.argc == 0) {
+ memo->u2.argc = 1;
+ memo->u1.value = i;
}
else if (SYMBOL_P(name = memo->u3.value)) {
- const ID mid = SYM2ID(name);
- MEMO_V1_SET(memo, rb_funcall(memo->v1, mid, 1, i));
+ memo->u1.value = rb_funcall(memo->u1.value, SYM2ID(name), 1, i);
}
else {
VALUE args[2];
args[0] = name;
args[1] = i;
- MEMO_V1_SET(memo, rb_f_send(numberof(args), args, memo->v1));
+ memo->u1.value = rb_f_send(numberof(args), args, memo->u1.value);
}
return Qnil;
}
@@ -674,14 +629,13 @@ inject_op_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
static VALUE
enum_inject(int argc, VALUE *argv, VALUE obj)
{
- struct MEMO *memo;
+ NODE *memo;
VALUE init, op;
- rb_block_call_func *iter = inject_i;
+ VALUE (*iter)(VALUE, VALUE, int, VALUE*) = inject_i;
ID id;
switch (rb_scan_args(argc, argv, "02", &init, &op)) {
case 0:
- init = Qundef;
break;
case 1:
if (rb_block_given_p()) {
@@ -689,7 +643,8 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
}
id = rb_check_id(&init);
op = id ? ID2SYM(id) : init;
- init = Qundef;
+ argc = 0;
+ init = Qnil;
iter = inject_op_i;
break;
case 2:
@@ -701,24 +656,23 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
iter = inject_op_i;
break;
}
- memo = MEMO_NEW(init, Qnil, op);
+ memo = NEW_MEMO(init, argc, op);
rb_block_call(obj, id_each, 0, 0, iter, (VALUE)memo);
- if (memo->v1 == Qundef) return Qnil;
- return memo->v1;
+ return memo->u1.value;
}
static VALUE
-partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arys))
+partition_i(VALUE i, VALUE arys, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(arys);
+ NODE *memo = RNODE(arys);
VALUE ary;
ENUM_WANT_SVALUE();
if (RTEST(rb_yield(i))) {
- ary = memo->v1;
+ ary = memo->u1.value;
}
else {
- ary = memo->v2;
+ ary = memo->u2.value;
}
rb_ary_push(ary, i);
return Qnil;
@@ -742,18 +696,18 @@ partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arys))
static VALUE
enum_partition(VALUE obj)
{
- struct MEMO *memo;
+ NODE *memo;
RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- memo = MEMO_NEW(rb_ary_new(), rb_ary_new(), 0);
+ memo = NEW_MEMO(rb_ary_new(), rb_ary_new(), 0);
rb_block_call(obj, id_each, 0, 0, partition_i, (VALUE)memo);
- return rb_assoc_new(memo->v1, memo->v2);
+ return rb_assoc_new(memo->u1.value, memo->u2.value);
}
static VALUE
-group_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
+group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv)
{
VALUE group;
VALUE values;
@@ -802,12 +756,12 @@ enum_group_by(VALUE obj)
}
static VALUE
-first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params))
+first_i(VALUE i, VALUE params, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(params);
+ NODE *memo = RNODE(params);
ENUM_WANT_SVALUE();
- MEMO_V1_SET(memo, i);
+ memo->u1.value = i;
rb_iter_break();
UNREACHABLE;
@@ -828,22 +782,21 @@ static VALUE enum_take(VALUE obj, VALUE n);
* %w[foo bar baz].first(2) #=> ["foo", "bar"]
* %w[foo bar baz].first(10) #=> ["foo", "bar", "baz"]
* [].first #=> nil
- * [].first(10) #=> []
*
*/
static VALUE
enum_first(int argc, VALUE *argv, VALUE obj)
{
- struct MEMO *memo;
+ NODE *memo;
rb_check_arity(argc, 0, 1);
if (argc > 0) {
return enum_take(obj, argv[0]);
}
else {
- memo = MEMO_NEW(Qnil, 0, 0);
+ memo = NEW_MEMO(Qnil, 0, 0);
rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)memo);
- return memo->v1;
+ return memo->u1.value;
}
}
@@ -873,15 +826,15 @@ enum_sort(VALUE obj)
#define SORT_BY_BUFSIZE 16
struct sort_by_data {
- const VALUE ary;
- const VALUE buf;
+ VALUE ary;
+ VALUE buf;
long n;
};
static VALUE
-sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _data))
+sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv)
{
- struct sort_by_data *data = (struct sort_by_data *)&MEMO_CAST(_data)->v1;
+ struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1;
VALUE ary = data->ary;
VALUE v;
@@ -998,7 +951,7 @@ static VALUE
enum_sort_by(VALUE obj)
{
VALUE ary, buf;
- struct MEMO *memo;
+ NODE *memo;
long i;
struct sort_by_data *data;
@@ -1013,11 +966,11 @@ enum_sort_by(VALUE obj)
RBASIC_CLEAR_CLASS(ary);
buf = rb_ary_tmp_new(SORT_BY_BUFSIZE*2);
rb_ary_store(buf, SORT_BY_BUFSIZE*2-1, Qnil);
- memo = MEMO_NEW(0, 0, 0);
+ memo = NEW_MEMO(0, 0, 0);
OBJ_INFECT(memo, obj);
- data = (struct sort_by_data *)&memo->v1;
- RB_OBJ_WRITE(memo, &data->ary, ary);
- RB_OBJ_WRITE(memo, &data->buf, buf);
+ data = (struct sort_by_data *)&memo->u1;
+ data->ary = ary;
+ data->buf = buf;
data->n = 0;
rb_block_call(obj, id_each, 0, 0, sort_by_i, (VALUE)memo);
ary = data->ary;
@@ -1047,27 +1000,27 @@ enum_sort_by(VALUE obj)
#define ENUMFUNC(name) rb_block_given_p() ? name##_iter_i : name##_i
#define DEFINE_ENUMFUNCS(name) \
-static VALUE enum_##name##_func(VALUE result, struct MEMO *memo); \
+static VALUE enum_##name##_func(VALUE result, NODE *memo); \
\
static VALUE \
-name##_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \
+name##_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
{ \
- return enum_##name##_func(rb_enum_values_pack(argc, argv), MEMO_CAST(memo)); \
+ return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \
} \
\
static VALUE \
-name##_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \
+name##_iter_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
{ \
- return enum_##name##_func(enum_yield(argc, argv), MEMO_CAST(memo)); \
+ return enum_##name##_func(enum_yield(argc, argv), RNODE(memo)); \
} \
\
static VALUE \
-enum_##name##_func(VALUE result, struct MEMO *memo)
+enum_##name##_func(VALUE result, NODE *memo)
DEFINE_ENUMFUNCS(all)
{
if (!RTEST(result)) {
- MEMO_V1_SET(memo, Qfalse);
+ memo->u1.value = Qfalse;
rb_iter_break();
}
return Qnil;
@@ -1093,15 +1046,15 @@ DEFINE_ENUMFUNCS(all)
static VALUE
enum_all(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qtrue, 0, 0);
+ NODE *memo = NEW_MEMO(Qtrue, 0, 0);
rb_block_call(obj, id_each, 0, 0, ENUMFUNC(all), (VALUE)memo);
- return memo->v1;
+ return memo->u1.value;
}
DEFINE_ENUMFUNCS(any)
{
if (RTEST(result)) {
- MEMO_V1_SET(memo, Qtrue);
+ memo->u1.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -1127,229 +1080,25 @@ DEFINE_ENUMFUNCS(any)
static VALUE
enum_any(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qfalse, 0, 0);
+ NODE *memo = NEW_MEMO(Qfalse, 0, 0);
rb_block_call(obj, id_each, 0, 0, ENUMFUNC(any), (VALUE)memo);
- return memo->v1;
+ return memo->u1.value;
}
DEFINE_ENUMFUNCS(one)
{
if (RTEST(result)) {
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, Qtrue);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = Qtrue;
}
- else if (memo->v1 == Qtrue) {
- MEMO_V1_SET(memo, Qfalse);
+ else if (memo->u1.value == Qtrue) {
+ memo->u1.value = Qfalse;
rb_iter_break();
}
}
return Qnil;
}
-struct nmin_data {
- long n;
- long bufmax;
- long curlen;
- VALUE buf;
- VALUE limit;
- int (*cmpfunc)(const void *, const void *, void *);
- int rev; /* max if 1 */
- int by; /* min_by if 1 */
- const char *method;
-};
-
-static int
-nmin_cmp(const void *ap, const void *bp, void *_data)
-{
- struct nmin_data *data = (struct nmin_data *)_data;
- VALUE a = *(const VALUE *)ap, b = *(const VALUE *)bp;
- VALUE cmp = rb_funcall(a, id_cmp, 1, b);
- if (RBASIC(data->buf)->klass) {
- rb_raise(rb_eRuntimeError, "%s reentered", data->method);
- }
- return rb_cmpint(cmp, a, b);
-}
-
-static int
-nmin_block_cmp(const void *ap, const void *bp, void *_data)
-{
- struct nmin_data *data = (struct nmin_data *)_data;
- VALUE a = *(const VALUE *)ap, b = *(const VALUE *)bp;
- VALUE cmp = rb_yield_values(2, a, b);
- if (RBASIC(data->buf)->klass) {
- rb_raise(rb_eRuntimeError, "%s reentered", data->method);
- }
- return rb_cmpint(cmp, a, b);
-}
-
-
-static void
-nmin_filter(struct nmin_data *data)
-{
- long n;
- VALUE *beg;
- int eltsize;
- long numelts;
-
- long left, right;
- long store_index;
-
- long i, j;
-
- if (data->curlen <= data->n)
- return;
-
- n = data->n;
- beg = RARRAY_PTR(data->buf);
- eltsize = data->by ? 2 : 1;
- numelts = data->curlen;
-
- left = 0;
- right = numelts-1;
-
-#define GETPTR(i) (beg+(i)*eltsize)
-
-#define SWAP(i, j) do { \
- VALUE tmp[2]; \
- memcpy(tmp, GETPTR(i), sizeof(VALUE)*eltsize); \
- memcpy(GETPTR(i), GETPTR(j), sizeof(VALUE)*eltsize); \
- memcpy(GETPTR(j), tmp, sizeof(VALUE)*eltsize); \
-} while (0)
-
- while (1) {
- long pivot_index = left + (right-left)/2;
- long num_pivots = 1;
-
- SWAP(pivot_index, right);
- pivot_index = right;
-
- store_index = left;
- i = left;
- while (i <= right-num_pivots) {
- int c = data->cmpfunc(GETPTR(i), GETPTR(pivot_index), data);
- if (data->rev)
- c = -c;
- if (c == 0) {
- SWAP(i, right-num_pivots);
- num_pivots++;
- continue;
- }
- if (c < 0) {
- SWAP(i, store_index);
- store_index++;
- }
- i++;
- }
- j = store_index;
- for (i = right; right-num_pivots < i; i--) {
- if (i <= j)
- break;
- SWAP(j, i);
- j++;
- }
-
- if (store_index <= n && n <= store_index+num_pivots)
- break;
-
- if (n < store_index) {
- right = store_index-1;
- }
- else {
- left = store_index+num_pivots;
- }
- }
-#undef GETPTR
-#undef SWAP
-
- data->limit = RARRAY_PTR(data->buf)[store_index*eltsize]; /* the last pivot */
- data->curlen = data->n;
- rb_ary_resize(data->buf, data->n * eltsize);
-}
-
-static VALUE
-nmin_i(VALUE i, VALUE *_data, int argc, VALUE *argv)
-{
- struct nmin_data *data = (struct nmin_data *)_data;
- VALUE cmpv;
-
- ENUM_WANT_SVALUE();
-
- if (data->by)
- cmpv = rb_yield(i);
- else
- cmpv = i;
-
- if (data->limit != Qundef) {
- int c = data->cmpfunc(&cmpv, &data->limit, data);
- if (data->rev)
- c = -c;
- if (c >= 0)
- return Qnil;
- }
-
- if (data->by)
- rb_ary_push(data->buf, cmpv);
- rb_ary_push(data->buf, i);
-
- data->curlen++;
-
- if (data->curlen == data->bufmax) {
- nmin_filter(data);
- }
-
- return Qnil;
-}
-
-static VALUE
-nmin_run(VALUE obj, VALUE num, int by, int rev)
-{
- VALUE result;
- struct nmin_data data;
-
- data.n = NUM2LONG(num);
- if (data.n < 0)
- rb_raise(rb_eArgError, "negative size (%ld)", data.n);
- if (data.n == 0)
- return rb_ary_new2(0);
- if (LONG_MAX/4/(by ? 2 : 1) < data.n)
- rb_raise(rb_eArgError, "too big size");
- data.bufmax = data.n * 4;
- data.curlen = 0;
- data.buf = rb_ary_tmp_new(data.bufmax * (by ? 2 : 1));
- data.limit = Qundef;
- data.cmpfunc = by ? nmin_cmp :
- rb_block_given_p() ? nmin_block_cmp :
- nmin_cmp;
- data.rev = rev;
- data.by = by;
- data.method = rev ? (by ? "max_by" : "max")
- : (by ? "min_by" : "min");
- rb_block_call(obj, id_each, 0, 0, nmin_i, (VALUE)&data);
- nmin_filter(&data);
- result = data.buf;
- if (by) {
- long i;
- ruby_qsort(RARRAY_PTR(result),
- RARRAY_LEN(result)/2,
- sizeof(VALUE)*2,
- data.cmpfunc, (void *)&data);
- for (i=1; i<RARRAY_LEN(result); i+=2) {
- RARRAY_PTR(result)[i/2] = RARRAY_PTR(result)[i];
- }
- rb_ary_resize(result, RARRAY_LEN(result)/2);
- }
- else {
- ruby_qsort(RARRAY_PTR(result), RARRAY_LEN(result), sizeof(VALUE),
- data.cmpfunc, (void *)&data);
- }
- if (rev) {
- rb_ary_reverse(result);
- }
- *((VALUE *)&RBASIC(result)->klass) = rb_cArray;
- return result;
-
-}
-
/*
* call-seq:
* enum.one? [{ |obj| block }] -> true or false
@@ -1367,14 +1116,15 @@ nmin_run(VALUE obj, VALUE num, int by, int rev)
* [ nil, true, false ].one? #=> true
*
*/
+
static VALUE
enum_one(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qundef, 0, 0);
+ NODE *memo = NEW_MEMO(Qundef, 0, 0);
VALUE result;
rb_block_call(obj, id_each, 0, 0, ENUMFUNC(one), (VALUE)memo);
- result = memo->v1;
+ result = memo->u1.value;
if (result == Qundef) return Qfalse;
return result;
}
@@ -1382,7 +1132,7 @@ enum_one(VALUE obj)
DEFINE_ENUMFUNCS(none)
{
if (RTEST(result)) {
- MEMO_V1_SET(memo, Qfalse);
+ memo->u1.value = Qfalse;
rb_iter_break();
}
return Qnil;
@@ -1402,51 +1152,50 @@ DEFINE_ENUMFUNCS(none)
* [].none? #=> true
* [nil].none? #=> true
* [nil, false].none? #=> true
- * [nil, false, true].none? #=> false
*/
static VALUE
enum_none(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qtrue, 0, 0);
+ NODE *memo = NEW_MEMO(Qtrue, 0, 0);
rb_block_call(obj, id_each, 0, 0, ENUMFUNC(none), (VALUE)memo);
- return memo->v1;
+ return memo->u1.value;
}
static VALUE
-min_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+min_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
VALUE cmp;
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, i);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_funcall(i, id_cmp, 1, memo->v1);
- if (rb_cmpint(cmp, i, memo->v1) < 0) {
- MEMO_V1_SET(memo, i);
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
}
}
return Qnil;
}
static VALUE
-min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+min_ii(VALUE i, VALUE args, int argc, VALUE *argv)
{
VALUE cmp;
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, i);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_yield_values(2, i, memo->v1);
- if (rb_cmpint(cmp, i, memo->v1) < 0) {
- MEMO_V1_SET(memo, i);
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -1455,10 +1204,8 @@ min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
/*
* call-seq:
- * enum.min -> obj
- * enum.min {| a,b | block } -> obj
- * enum.min(n) -> array
- * enum.min(n) {| a,b | block } -> array
+ * enum.min -> obj
+ * enum.min { |a, b| block } -> obj
*
* Returns the object in <i>enum</i> with the minimum value. The
* first form assumes all objects implement <code>Comparable</code>;
@@ -1467,27 +1214,13 @@ min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* a = %w(albatross dog horse)
* a.min #=> "albatross"
* a.min { |a, b| a.length <=> b.length } #=> "dog"
- *
- * If the +n+ argument is given, minimum +n+ elements are returned
- * as a sorted array.
- *
- * a = %w[albatross dog horse]
- * a.min(2) #=> ["albatross", "dog"]
- * a.min(2) {|a, b| a.length <=> b.length } #=> ["dog", "horse"]
- * [5, 1, 3, 4, 2].min(3) #=> [1, 2, 3]
*/
static VALUE
-enum_min(int argc, VALUE *argv, VALUE obj)
+enum_min(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qundef, 0, 0);
+ NODE *memo = NEW_MEMO(Qundef, 0, 0);
VALUE result;
- VALUE num;
-
- rb_scan_args(argc, argv, "01", &num);
-
- if (!NIL_P(num))
- return nmin_run(obj, num, 0, 0);
if (rb_block_given_p()) {
rb_block_call(obj, id_each, 0, 0, min_ii, (VALUE)memo);
@@ -1495,46 +1228,46 @@ enum_min(int argc, VALUE *argv, VALUE obj)
else {
rb_block_call(obj, id_each, 0, 0, min_i, (VALUE)memo);
}
- result = memo->v1;
+ result = memo->u1.value;
if (result == Qundef) return Qnil;
return result;
}
static VALUE
-max_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+max_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
VALUE cmp;
ENUM_WANT_SVALUE();
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, i);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_funcall(i, id_cmp, 1, memo->v1);
- if (rb_cmpint(cmp, i, memo->v1) > 0) {
- MEMO_V1_SET(memo, i);
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
}
}
return Qnil;
}
static VALUE
-max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+max_ii(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
VALUE cmp;
ENUM_WANT_SVALUE();
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, i);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = i;
}
else {
- cmp = rb_yield_values(2, i, memo->v1);
- if (rb_cmpint(cmp, i, memo->v1) > 0) {
- MEMO_V1_SET(memo, i);
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -1542,10 +1275,8 @@ max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
/*
* call-seq:
- * enum.max -> obj
- * enum.max { |a, b| block } -> obj
- * enum.max(n) -> obj
- * enum.max(n) {|a,b| block } -> obj
+ * enum.max -> obj
+ * enum.max { |a, b| block } -> obj
*
* Returns the object in _enum_ with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
@@ -1554,27 +1285,13 @@ max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* a = %w(albatross dog horse)
* a.max #=> "horse"
* a.max { |a, b| a.length <=> b.length } #=> "albatross"
- *
- * If the +n+ argument is given, maximum +n+ elements are returned
- * as an array, sorted in descending order.
- *
- * a = %w[albatross dog horse]
- * a.max(2) #=> ["horse", "dog"]
- * a.max(2) {|a, b| a.length <=> b.length } #=> ["albatross", "horse"]
- * [5, 1, 3, 4, 2].max(3) #=> [5, 4, 3]
*/
static VALUE
-enum_max(int argc, VALUE *argv, VALUE obj)
+enum_max(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qundef, 0, 0);
+ NODE *memo = NEW_MEMO(Qundef, 0, 0);
VALUE result;
- VALUE num;
-
- rb_scan_args(argc, argv, "01", &num);
-
- if (!NIL_P(num))
- return nmin_run(obj, num, 0, 1);
if (rb_block_given_p()) {
rb_block_call(obj, id_each, 0, 0, max_ii, (VALUE)memo);
@@ -1582,7 +1299,7 @@ enum_max(int argc, VALUE *argv, VALUE obj)
else {
rb_block_call(obj, id_each, 0, 0, max_i, (VALUE)memo);
}
- result = memo->v1;
+ result = memo->u1.value;
if (result == Qundef) return Qnil;
return result;
}
@@ -1593,7 +1310,7 @@ struct minmax_t {
VALUE last;
};
-STATIC_ASSERT(minmax_t, sizeof(struct minmax_t) <= sizeof(struct MEMO) - offsetof(struct MEMO, v1));
+STATIC_ASSERT(minmax_t, sizeof(struct minmax_t) <= sizeof(NODE) - offsetof(NODE, u1));
static void
minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
@@ -1617,9 +1334,9 @@ minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
}
static VALUE
-minmax_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
+minmax_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
{
- struct minmax_t *memo = (struct minmax_t *)&MEMO_CAST(_memo)->v1;
+ struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
VALUE j;
@@ -1669,9 +1386,9 @@ minmax_ii_update(VALUE i, VALUE j, struct minmax_t *memo)
}
static VALUE
-minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
+minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv)
{
- struct minmax_t *memo = (struct minmax_t *)&MEMO_CAST(_memo)->v1;
+ struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
VALUE j;
@@ -1704,7 +1421,7 @@ minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
* enum.minmax -> [min, max]
* enum.minmax { |a, b| block } -> [min, max]
*
- * Returns a two element array which contains the minimum and the
+ * Returns two elements array which contains the minimum and the
* maximum value in the enumerable. The first form assumes all
* objects implement <code>Comparable</code>; the second uses the
* block to return <em>a <=> b</em>.
@@ -1717,8 +1434,9 @@ minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
static VALUE
enum_minmax(VALUE obj)
{
- struct MEMO *memo = MEMO_NEW(Qundef, Qundef, Qundef);
- struct minmax_t *m = (struct minmax_t *)&memo->v1;
+ NODE *memo = NEW_MEMO(Qundef, Qundef, Qundef);
+ struct minmax_t *m = (struct minmax_t *)&memo->u1.value;
+ VALUE ary = rb_ary_new3(2, Qnil, Qnil);
m->min = Qundef;
m->last = Qundef;
@@ -1733,37 +1451,36 @@ enum_minmax(VALUE obj)
minmax_i_update(m->last, m->last, m);
}
if (m->min != Qundef) {
- return rb_assoc_new(m->min, m->max);
+ rb_ary_store(ary, 0, m->min);
+ rb_ary_store(ary, 1, m->max);
}
- return rb_assoc_new(Qnil, Qnil);
+ return ary;
}
static VALUE
-min_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+min_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
VALUE v;
ENUM_WANT_SVALUE();
v = rb_yield(i);
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, v);
- MEMO_V2_SET(memo, i);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
- else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->v1), v, memo->v1) < 0) {
- MEMO_V1_SET(memo, v);
- MEMO_V2_SET(memo, i);
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->u1.value), v, memo->u1.value) < 0) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
return Qnil;
}
/*
* call-seq:
- * enum.min_by {|obj| block } -> obj
- * enum.min_by -> an_enumerator
- * enum.min_by(n) {|obj| block } -> array
- * enum.min_by(n) -> an_enumerator
+ * enum.min_by { |obj| block } -> obj
+ * enum.min_by -> an_enumerator
*
* Returns the object in <i>enum</i> that gives the minimum
* value from the given block.
@@ -1772,59 +1489,44 @@ min_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
*
* a = %w(albatross dog horse)
* a.min_by { |x| x.length } #=> "dog"
- *
- * If the +n+ argument is given, minimum +n+ elements are returned
- * as an array. These +n+ elements are sorted by the value from the
- * given block.
- *
- * a = %w[albatross dog horse]
- * p a.min_by(2) {|x| x.length } #=> ["dog", "horse"]
*/
static VALUE
-enum_min_by(int argc, VALUE *argv, VALUE obj)
+enum_min_by(VALUE obj)
{
- struct MEMO *memo;
- VALUE num;
-
- rb_scan_args(argc, argv, "01", &num);
+ NODE *memo;
- RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_size);
-
- if (!NIL_P(num))
- return nmin_run(obj, num, 1, 0);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- memo = MEMO_NEW(Qundef, Qnil, 0);
+ memo = NEW_MEMO(Qundef, Qnil, 0);
rb_block_call(obj, id_each, 0, 0, min_by_i, (VALUE)memo);
- return memo->v2;
+ return memo->u2.value;
}
static VALUE
-max_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+max_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
VALUE v;
ENUM_WANT_SVALUE();
v = rb_yield(i);
- if (memo->v1 == Qundef) {
- MEMO_V1_SET(memo, v);
- MEMO_V2_SET(memo, i);
+ if (memo->u1.value == Qundef) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
- else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->v1), v, memo->v1) > 0) {
- MEMO_V1_SET(memo, v);
- MEMO_V2_SET(memo, i);
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo->u1.value), v, memo->u1.value) > 0) {
+ memo->u1.value = v;
+ memo->u2.value = i;
}
return Qnil;
}
/*
* call-seq:
- * enum.max_by {|obj| block } -> obj
- * enum.max_by -> an_enumerator
- * enum.max_by(n) {|obj| block } -> obj
- * enum.max_by(n) -> an_enumerator
+ * enum.max_by { |obj| block } -> obj
+ * enum.max_by -> an_enumerator
*
* Returns the object in <i>enum</i> that gives the maximum
* value from the given block.
@@ -1833,76 +1535,18 @@ max_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
*
* a = %w(albatross dog horse)
* a.max_by { |x| x.length } #=> "albatross"
- *
- * If the +n+ argument is given, maximum +n+ elements are returned
- * as an array. These +n+ elements are sorted by the value from the
- * given block, in descending order.
- *
- * a = %w[albatross dog horse]
- * a.max_by(2) {|x| x.length } #=> ["albatross", "horse"]
- *
- * enum.max_by(n) can be used to implement weighted random sampling.
- * Following example implements and use Enumerable#wsample.
- *
- * module Enumerable
- * # weighted random sampling.
- * #
- * # Pavlos S. Efraimidis, Paul G. Spirakis
- * # Weighted random sampling with a reservoir
- * # Information Processing Letters
- * # Volume 97, Issue 5 (16 March 2006)
- * def wsample(n)
- * self.max_by(n) {|v| rand ** (1.0/yield(v)) }
- * end
- * end
- * e = (-20..20).to_a*10000
- * a = e.wsample(20000) {|x|
- * Math.exp(-(x/5.0)**2) # normal distribution
- * }
- * # a is 20000 samples from e.
- * p a.length #=> 20000
- * h = a.group_by {|x| x }
- * -10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i if h[x] }
- * #=> *
- * # ***
- * # ******
- * # ***********
- * # ******************
- * # *****************************
- * # *****************************************
- * # ****************************************************
- * # ***************************************************************
- * # ********************************************************************
- * # ***********************************************************************
- * # ***********************************************************************
- * # **************************************************************
- * # ****************************************************
- * # ***************************************
- * # ***************************
- * # ******************
- * # ***********
- * # *******
- * # ***
- * # *
- *
*/
static VALUE
-enum_max_by(int argc, VALUE *argv, VALUE obj)
+enum_max_by(VALUE obj)
{
- struct MEMO *memo;
- VALUE num;
+ NODE *memo;
- rb_scan_args(argc, argv, "01", &num);
-
- RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_size);
-
- if (!NIL_P(num))
- return nmin_run(obj, num, 1, 1);
+ RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
- memo = MEMO_NEW(Qundef, Qnil, 0);
+ memo = NEW_MEMO(Qundef, Qnil, 0);
rb_block_call(obj, id_each, 0, 0, max_by_i, (VALUE)memo);
- return memo->v2;
+ return memo->u2.value;
}
struct minmax_by_t {
@@ -1936,7 +1580,7 @@ minmax_by_i_update(VALUE v1, VALUE v2, VALUE i1, VALUE i2, struct minmax_by_t *m
}
static VALUE
-minmax_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
+minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
{
struct minmax_by_t *memo = MEMO_FOR(struct minmax_by_t, _memo);
VALUE vi, vj, j;
@@ -2012,12 +1656,12 @@ enum_minmax_by(VALUE obj)
}
static VALUE
-member_i(RB_BLOCK_CALL_FUNC_ARGLIST(iter, args))
+member_i(VALUE iter, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
- if (rb_equal(rb_enum_values_pack(argc, argv), memo->v1)) {
- MEMO_V2_SET(memo, Qtrue);
+ if (rb_equal(rb_enum_values_pack(argc, argv), memo->u1.value)) {
+ memo->u2.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -2033,24 +1677,22 @@ member_i(RB_BLOCK_CALL_FUNC_ARGLIST(iter, args))
*
* IO.constants.include? :SEEK_SET #=> true
* IO.constants.include? :SEEK_NO_FURTHER #=> false
- * IO.constants.member? :SEEK_SET #=> true
- * IO.constants.member? :SEEK_NO_FURTHER #=> false
*
*/
static VALUE
enum_member(VALUE obj, VALUE val)
{
- struct MEMO *memo = MEMO_NEW(val, Qfalse, 0);
+ NODE *memo = NEW_MEMO(val, Qfalse, 0);
rb_block_call(obj, id_each, 0, 0, member_i, (VALUE)memo);
- return memo->v2;
+ return memo->u2.value;
}
static VALUE
-each_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
+each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
{
- long n = MEMO_CAST(memo)->u3.cnt++;
+ long n = RNODE(memo)->u3.cnt++;
return rb_yield_values(2, rb_enum_values_pack(argc, argv), INT2NUM(n));
}
@@ -2077,11 +1719,11 @@ each_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
static VALUE
enum_each_with_index(int argc, VALUE *argv, VALUE obj)
{
- struct MEMO *memo;
+ NODE *memo;
RETURN_SIZED_ENUMERATOR(obj, argc, argv, enum_size);
- memo = MEMO_NEW(0, 0, 0);
+ memo = NEW_MEMO(0, 0, 0);
rb_block_call(obj, id_each, argc, argv, each_with_index_i, (VALUE)memo);
return obj;
}
@@ -2124,7 +1766,7 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
static VALUE
-each_val_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
+each_val_i(VALUE i, VALUE p, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
rb_yield(i);
@@ -2168,13 +1810,11 @@ enum_each_entry(int argc, VALUE *argv, VALUE obj)
return obj;
}
-#define dont_recycle_block_arg(arity) ((arity) == 1 || (arity) < 0)
-
static VALUE
-each_slice_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, m))
+each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(m);
- VALUE ary = memo->v1;
+ NODE *memo = RNODE(m);
+ VALUE ary = memo->u1.value;
VALUE v = Qnil;
long size = memo->u3.cnt;
ENUM_WANT_SVALUE();
@@ -2183,13 +1823,7 @@ each_slice_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, m))
if (RARRAY_LEN(ary) == size) {
v = rb_yield(ary);
-
- if (memo->v2) {
- MEMO_V1_SET(memo, rb_ary_new2(size));
- }
- else {
- rb_ary_clear(ary);
- }
+ memo->u1.value = rb_ary_new2(size);
}
return v;
@@ -2230,27 +1864,24 @@ enum_each_slice(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
VALUE ary;
- struct MEMO *memo;
- int arity;
+ NODE *memo;
if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
RETURN_SIZED_ENUMERATOR(obj, 1, &n, enum_each_slice_size);
- size = limit_by_enum_size(obj, size);
ary = rb_ary_new2(size);
- arity = rb_block_arity();
- memo = MEMO_NEW(ary, dont_recycle_block_arg(arity), size);
+ memo = NEW_MEMO(ary, 0, size);
rb_block_call(obj, id_each, 0, 0, each_slice_i, (VALUE)memo);
- ary = memo->v1;
+ ary = memo->u1.value;
if (RARRAY_LEN(ary) > 0) rb_yield(ary);
return Qnil;
}
static VALUE
-each_cons_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
- VALUE ary = memo->v1;
+ NODE *memo = RNODE(args);
+ VALUE ary = memo->u1.value;
VALUE v = Qnil;
long size = memo->u3.cnt;
ENUM_WANT_SVALUE();
@@ -2260,10 +1891,7 @@ each_cons_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
}
rb_ary_push(ary, i);
if (RARRAY_LEN(ary) == size) {
- if (memo->v2) {
- ary = rb_ary_dup(ary);
- }
- v = rb_yield(ary);
+ v = rb_yield(rb_ary_dup(ary));
}
return v;
}
@@ -2307,21 +1935,18 @@ static VALUE
enum_each_cons(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
- struct MEMO *memo;
- int arity;
+ NODE *memo;
if (size <= 0) rb_raise(rb_eArgError, "invalid size");
RETURN_SIZED_ENUMERATOR(obj, 1, &n, enum_each_cons_size);
- arity = rb_block_arity();
- if (enum_size_over_p(obj, size)) return Qnil;
- memo = MEMO_NEW(rb_ary_new2(size), dont_recycle_block_arg(arity), size);
+ memo = NEW_MEMO(rb_ary_new2(size), 0, size);
rb_block_call(obj, id_each, 0, 0, each_cons_i, (VALUE)memo);
return Qnil;
}
static VALUE
-each_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
+each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
return rb_yield_values(2, i, memo);
@@ -2352,13 +1977,12 @@ enum_each_with_object(VALUE obj, VALUE memo)
}
static VALUE
-zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
+zip_ary(VALUE val, NODE *memo, int argc, VALUE *argv)
{
- struct MEMO *memo = (struct MEMO *)memoval;
- VALUE result = memo->v1;
- VALUE args = memo->v2;
+ volatile VALUE result = memo->u1.value;
+ volatile VALUE args = memo->u2.value;
long n = memo->u3.cnt++;
- VALUE tmp;
+ volatile VALUE tmp;
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
@@ -2379,16 +2003,13 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
else {
rb_ary_push(result, tmp);
}
-
- RB_GC_GUARD(args);
-
return Qnil;
}
static VALUE
call_next(VALUE *v)
{
- return v[0] = rb_funcallv(v[1], id_next, 0, 0);
+ return v[0] = rb_funcall(v[1], id_next, 0, 0);
}
static VALUE
@@ -2398,12 +2019,11 @@ call_stop(VALUE *v)
}
static VALUE
-zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
+zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
{
- struct MEMO *memo = (struct MEMO *)memoval;
- VALUE result = memo->v1;
- VALUE args = memo->v2;
- VALUE tmp;
+ volatile VALUE result = memo->u1.value;
+ volatile VALUE args = memo->u2.value;
+ volatile VALUE tmp;
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
@@ -2430,9 +2050,6 @@ zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
else {
rb_ary_push(result, tmp);
}
-
- RB_GC_GUARD(args);
-
return Qnil;
}
@@ -2453,15 +2070,10 @@ zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
* a = [ 4, 5, 6 ]
* b = [ 7, 8, 9 ]
*
- * a.zip(b) #=> [[4, 7], [5, 8], [6, 9]]
* [1, 2, 3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
* [1, 2].zip(a, b) #=> [[1, 4, 7], [2, 5, 8]]
* a.zip([1, 2], [8]) #=> [[4, 1, 8], [5, 2, nil], [6, nil, nil]]
*
- * c = []
- * a.zip(b) { |x, y| c << x + y } #=> nil
- * c #=> [11, 13, 15]
- *
*/
static VALUE
@@ -2469,7 +2081,7 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
{
int i;
ID conv;
- struct MEMO *memo;
+ NODE *memo;
VALUE result = Qnil;
VALUE args = rb_ary_new4(argc, argv);
int allary = TRUE;
@@ -2487,8 +2099,8 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
CONST_ID(conv, "to_enum");
for (i=0; i<argc; i++) {
if (!rb_respond_to(argv[i], id_each)) {
- rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (must respond to :each)",
- rb_obj_class(argv[i]));
+ rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)",
+ rb_obj_classname(argv[i]));
}
argv[i] = rb_funcall(argv[i], conv, 1, ID2SYM(id_each));
}
@@ -2496,19 +2108,18 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
if (!rb_block_given_p()) {
result = rb_ary_new();
}
-
- /* TODO: use NODE_DOT2 as memo(v, v, -) */
- memo = MEMO_NEW(result, args, 0);
+ /* use NODE_DOT2 as memo(v, v, -) */
+ memo = rb_node_newnode(NODE_DOT2, result, args, 0);
rb_block_call(obj, id_each, 0, 0, allary ? zip_ary : zip_i, (VALUE)memo);
return result;
}
static VALUE
-take_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+take_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
- rb_ary_push(memo->v1, rb_enum_values_pack(argc, argv));
+ NODE *memo = RNODE(args);
+ rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
if (--memo->u3.cnt == 0) rb_iter_break();
return Qnil;
}
@@ -2521,14 +2132,13 @@ take_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
*
* a = [1, 2, 3, 4, 5, 0]
* a.take(3) #=> [1, 2, 3]
- * a.take(30) #=> [1, 2, 3, 4, 5, 0]
*
*/
static VALUE
enum_take(VALUE obj, VALUE n)
{
- struct MEMO *memo;
+ NODE *memo;
VALUE result;
long len = NUM2LONG(n);
@@ -2538,14 +2148,14 @@ enum_take(VALUE obj, VALUE n)
if (len == 0) return rb_ary_new2(0);
result = rb_ary_new2(len);
- memo = MEMO_NEW(result, 0, len);
+ memo = NEW_MEMO(result, 0, len);
rb_block_call(obj, id_each, 0, 0, take_i, (VALUE)memo);
return result;
}
static VALUE
-take_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@@ -2579,11 +2189,11 @@ enum_take_while(VALUE obj)
}
static VALUE
-drop_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+drop_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
if (memo->u3.cnt == 0) {
- rb_ary_push(memo->v1, rb_enum_values_pack(argc, argv));
+ rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
}
else {
memo->u3.cnt--;
@@ -2607,7 +2217,7 @@ static VALUE
enum_drop(VALUE obj, VALUE n)
{
VALUE result;
- struct MEMO *memo;
+ NODE *memo;
long len = NUM2LONG(n);
if (len < 0) {
@@ -2615,23 +2225,23 @@ enum_drop(VALUE obj, VALUE n)
}
result = rb_ary_new();
- memo = MEMO_NEW(result, 0, len);
+ memo = NEW_MEMO(result, 0, len);
rb_block_call(obj, id_each, 0, 0, drop_i, (VALUE)memo);
return result;
}
static VALUE
-drop_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+drop_while_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
- struct MEMO *memo = MEMO_CAST(args);
+ NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
if (!memo->u3.state && !RTEST(rb_yield(i))) {
memo->u3.state = TRUE;
}
if (memo->u3.state) {
- rb_ary_push(memo->v1, i);
+ rb_ary_push(memo->u1.value, i);
}
return Qnil;
}
@@ -2656,17 +2266,17 @@ static VALUE
enum_drop_while(VALUE obj)
{
VALUE result;
- struct MEMO *memo;
+ NODE *memo;
RETURN_ENUMERATOR(obj, 0, 0);
result = rb_ary_new();
- memo = MEMO_NEW(result, 0, FALSE);
+ memo = NEW_MEMO(result, 0, FALSE);
rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)memo);
return result;
}
static VALUE
-cycle_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
ENUM_WANT_SVALUE();
@@ -2746,22 +2356,26 @@ enum_cycle(int argc, VALUE *argv, VALUE obj)
struct chunk_arg {
VALUE categorize;
+ VALUE state;
VALUE prev_value;
VALUE prev_elts;
VALUE yielder;
};
static VALUE
-chunk_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
+chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
{
struct chunk_arg *argp = MEMO_FOR(struct chunk_arg, _argp);
- VALUE v, s;
+ VALUE v;
VALUE alone = ID2SYM(rb_intern("_alone"));
VALUE separator = ID2SYM(rb_intern("_separator"));
ENUM_WANT_SVALUE();
- v = rb_funcall(argp->categorize, id_call, 1, i);
+ if (NIL_P(argp->state))
+ v = rb_funcall(argp->categorize, id_call, 1, i);
+ else
+ v = rb_funcall(argp->categorize, id_call, 2, i, argp->state);
if (v == alone) {
if (!NIL_P(argp->prev_value)) {
@@ -2776,7 +2390,7 @@ chunk_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
argp->prev_value = argp->prev_elts = Qnil;
}
}
- else if (SYMBOL_P(v) && (s = rb_sym2str(v), RSTRING_PTR(s)[0] == '_')) {
+ else if (SYMBOL_P(v) && rb_id2name(SYM2ID(v))[0] == '_') {
rb_raise(rb_eRuntimeError, "symbols beginning with an underscore are reserved");
}
else {
@@ -2799,7 +2413,7 @@ chunk_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
}
static VALUE
-chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
+chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
{
VALUE enumerable;
VALUE arg;
@@ -2807,10 +2421,14 @@ chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
enumerable = rb_ivar_get(enumerator, rb_intern("chunk_enumerable"));
memo->categorize = rb_ivar_get(enumerator, rb_intern("chunk_categorize"));
+ memo->state = rb_ivar_get(enumerator, rb_intern("chunk_initial_state"));
memo->prev_value = Qnil;
memo->prev_elts = Qnil;
memo->yielder = yielder;
+ if (!NIL_P(memo->state))
+ memo->state = rb_obj_dup(memo->state);
+
rb_block_call(enumerable, id_each, 0, 0, chunk_ii, arg);
memo = MEMO_FOR(struct chunk_arg, arg);
if (!NIL_P(memo->prev_elts))
@@ -2821,6 +2439,7 @@ chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
/*
* call-seq:
* enum.chunk { |elt| ... } -> an_enumerator
+ * enum.chunk(initial_state) { |elt, state| ... } -> an_enumerator
*
* Enumerates over the items, chunking them together based on the return
* value of the block.
@@ -2904,18 +2523,27 @@ chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
* }
* }
*
+ * If the block needs to maintain state over multiple elements,
+ * an +initial_state+ argument can be used.
+ * If a non-nil value is given,
+ * a reference to it is passed as the 2nd argument of the block for the
+ * +chunk+ method, so state-changes to it persist across block calls.
+ *
*/
static VALUE
-enum_chunk(VALUE enumerable)
+enum_chunk(int argc, VALUE *argv, VALUE enumerable)
{
+ VALUE initial_state;
VALUE enumerator;
if (!rb_block_given_p())
rb_raise(rb_eArgError, "no block given");
+ rb_scan_args(argc, argv, "01", &initial_state);
enumerator = rb_obj_alloc(rb_cEnumerator);
rb_ivar_set(enumerator, rb_intern("chunk_enumerable"), enumerable);
rb_ivar_set(enumerator, rb_intern("chunk_categorize"), rb_block_proc());
+ rb_ivar_set(enumerator, rb_intern("chunk_initial_state"), initial_state);
rb_block_call(enumerator, idInitialize, 0, 0, chunk_i, enumerator);
return enumerator;
}
@@ -2924,12 +2552,13 @@ enum_chunk(VALUE enumerable)
struct slicebefore_arg {
VALUE sep_pred;
VALUE sep_pat;
+ VALUE state;
VALUE prev_elts;
VALUE yielder;
};
static VALUE
-slicebefore_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
+slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
{
struct slicebefore_arg *argp = MEMO_FOR(struct slicebefore_arg, _argp);
VALUE header_p;
@@ -2938,8 +2567,10 @@ slicebefore_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
if (!NIL_P(argp->sep_pat))
header_p = rb_funcall(argp->sep_pat, id_eqq, 1, i);
- else
+ else if (NIL_P(argp->state))
header_p = rb_funcall(argp->sep_pred, id_call, 1, i);
+ else
+ header_p = rb_funcall(argp->sep_pred, id_call, 2, i, argp->state);
if (RTEST(header_p)) {
if (!NIL_P(argp->prev_elts))
rb_funcall(argp->yielder, id_lshift, 1, argp->prev_elts);
@@ -2956,7 +2587,7 @@ slicebefore_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
}
static VALUE
-slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
+slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
{
VALUE enumerable;
VALUE arg;
@@ -2965,9 +2596,13 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
enumerable = rb_ivar_get(enumerator, rb_intern("slicebefore_enumerable"));
memo->sep_pred = rb_attr_get(enumerator, rb_intern("slicebefore_sep_pred"));
memo->sep_pat = NIL_P(memo->sep_pred) ? rb_ivar_get(enumerator, rb_intern("slicebefore_sep_pat")) : Qnil;
+ memo->state = rb_attr_get(enumerator, rb_intern("slicebefore_initial_state"));
memo->prev_elts = Qnil;
memo->yielder = yielder;
+ if (!NIL_P(memo->state))
+ memo->state = rb_obj_dup(memo->state);
+
rb_block_call(enumerable, id_each, 0, 0, slicebefore_ii, arg);
memo = MEMO_FOR(struct slicebefore_arg, arg);
if (!NIL_P(memo->prev_elts))
@@ -2979,6 +2614,7 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
* call-seq:
* enum.slice_before(pattern) -> an_enumerator
* enum.slice_before { |elt| bool } -> an_enumerator
+ * enum.slice_before(initial_state) { |elt, state| bool } -> an_enumerator
*
* Creates an enumerator for each chunked elements.
* The beginnings of chunks are defined by _pattern_ and the block.
@@ -2995,6 +2631,7 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
*
* enum.slice_before(pattern).each { |ary| ... }
* enum.slice_before { |elt| bool }.each { |ary| ... }
+ * enum.slice_before(initial_state) { |elt, state| bool }.each { |ary| ... }
*
* Other methods of the Enumerator class and Enumerable module,
* such as map, etc., are also usable.
@@ -3040,34 +2677,33 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
* }.join(",")
* #=> "0,2-4,6,7,9"
*
- * However local variables should be used carefully
- * if the result enumerator is enumerated twice or more.
- * The local variables should be initialized for each enumeration.
- * Enumerator.new can be used to do it.
+ * However local variables are not appropriate to maintain state
+ * if the result enumerator is used twice or more.
+ * In such a case, the last state of the 1st +each+ is used in the 2nd +each+.
+ * The _initial_state_ argument can be used to avoid this problem.
+ * If non-nil value is given as _initial_state_,
+ * it is duplicated for each +each+ method invocation of the enumerator.
+ * The duplicated object is passed to 2nd argument of the block for
+ * +slice_before+ method.
*
* # Word wrapping. This assumes all characters have same width.
* def wordwrap(words, maxwidth)
- * Enumerator.new {|y|
- * # cols is initialized in Enumerator.new.
- * cols = 0
- * words.slice_before { |w|
- * cols += 1 if cols != 0
- * cols += w.length
- * if maxwidth < cols
- * cols = w.length
- * true
- * else
- * false
- * end
- * }.each {|ws| y.yield ws }
+ * # if cols is a local variable, 2nd "each" may start with non-zero cols.
+ * words.slice_before(cols: 0) { |w, h|
+ * h[:cols] += 1 if h[:cols] != 0
+ * h[:cols] += w.length
+ * if maxwidth < h[:cols]
+ * h[:cols] = w.length
+ * true
+ * else
+ * false
+ * end
* }
* end
* text = (1..20).to_a.join(" ")
* enum = wordwrap(text.split(/\s+/), 10)
* puts "-"*10
- * enum.each { |ws| puts ws.join(" ") } # first enumeration.
- * puts "-"*10
- * enum.each { |ws| puts ws.join(" ") } # second enumeration generates same result as the first.
+ * enum.each { |ws| puts ws.join(" ") }
* puts "-"*10
* #=> ----------
* # 1 2 3 4 5
@@ -3077,13 +2713,6 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
* # 17 18 19
* # 20
* # ----------
- * # 1 2 3 4 5
- * # 6 7 8 9 10
- * # 11 12 13
- * # 14 15 16
- * # 17 18 19
- * # 20
- * # ----------
*
* mbox contains series of mails which start with Unix From line.
* So each mail can be extracted by slice before Unix From line.
@@ -3107,10 +2736,9 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
*
* # split mails in mbox (slice before Unix From line after an empty line)
* open("mbox") { |f|
- * emp = true
- * f.slice_before { |line|
- * prevemp = emp
- * emp = line == "\n"
+ * f.slice_before(emp: true) { |line, h|
+ * prevemp = h[:emp]
+ * h[:emp] = line == "\n"
* prevemp && line.start_with?("From ")
* }.each { |mail|
* mail.pop if mail.last == "\n"
@@ -3125,10 +2753,11 @@ enum_slice_before(int argc, VALUE *argv, VALUE enumerable)
VALUE enumerator;
if (rb_block_given_p()) {
- if (argc != 0)
- rb_error_arity(argc, 0, 0);
+ VALUE initial_state;
+ rb_scan_args(argc, argv, "01", &initial_state);
enumerator = rb_obj_alloc(rb_cEnumerator);
rb_ivar_set(enumerator, rb_intern("slicebefore_sep_pred"), rb_block_proc());
+ rb_ivar_set(enumerator, rb_intern("slicebefore_initial_state"), initial_state);
}
else {
VALUE sep_pat;
@@ -3141,338 +2770,6 @@ enum_slice_before(int argc, VALUE *argv, VALUE enumerable)
return enumerator;
}
-
-struct sliceafter_arg {
- VALUE pat;
- VALUE pred;
- VALUE prev_elts;
- VALUE yielder;
-};
-
-static VALUE
-sliceafter_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
-{
-#define UPDATE_MEMO ((void)(memo = MEMO_FOR(struct sliceafter_arg, _memo)))
- struct sliceafter_arg *memo;
- int split_p;
- UPDATE_MEMO;
-
- ENUM_WANT_SVALUE();
-
- if (NIL_P(memo->prev_elts)) {
- memo->prev_elts = rb_ary_new3(1, i);
- }
- else {
- rb_ary_push(memo->prev_elts, i);
- }
-
- if (NIL_P(memo->pred)) {
- split_p = RTEST(rb_funcall(memo->pat, id_eqq, 1, i));
- UPDATE_MEMO;
- }
- else {
- split_p = RTEST(rb_funcall(memo->pred, id_call, 1, i));
- UPDATE_MEMO;
- }
-
- if (split_p) {
- rb_funcall(memo->yielder, id_lshift, 1, memo->prev_elts);
- UPDATE_MEMO;
- memo->prev_elts = Qnil;
- }
-
- return Qnil;
-#undef UPDATE_MEMO
-}
-
-static VALUE
-sliceafter_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
-{
- VALUE enumerable;
- VALUE arg;
- struct sliceafter_arg *memo = NEW_MEMO_FOR(struct sliceafter_arg, arg);
-
- enumerable = rb_ivar_get(enumerator, rb_intern("sliceafter_enum"));
- memo->pat = rb_ivar_get(enumerator, rb_intern("sliceafter_pat"));
- memo->pred = rb_attr_get(enumerator, rb_intern("sliceafter_pred"));
- memo->prev_elts = Qnil;
- memo->yielder = yielder;
-
- rb_block_call(enumerable, id_each, 0, 0, sliceafter_ii, arg);
- memo = MEMO_FOR(struct sliceafter_arg, arg);
- if (!NIL_P(memo->prev_elts))
- rb_funcall(memo->yielder, id_lshift, 1, memo->prev_elts);
- return Qnil;
-}
-
-/*
- * call-seq:
- * enum.slice_after(pattern) -> an_enumerator
- * enum.slice_after { |elt| bool } -> an_enumerator
- *
- * Creates an enumerator for each chunked elements.
- * The ends of chunks are defined by _pattern_ and the block.
- *
- * If <code>_pattern_ === _elt_</code> returns <code>true</code> or the block
- * returns <code>true</code> for the element, the element is end of a
- * chunk.
- *
- * The <code>===</code> and _block_ is called from the first element to the last
- * element of _enum_.
- *
- * The result enumerator yields the chunked elements as an array.
- * So +each+ method can be called as follows:
- *
- * enum.slice_after(pattern).each { |ary| ... }
- * enum.slice_after { |elt| bool }.each { |ary| ... }
- *
- * Other methods of the Enumerator class and Enumerable module,
- * such as +map+, etc., are also usable.
- *
- * For example, continuation lines (lines end with backslash) can be
- * concatenated as follows:
- *
- * lines = ["foo\n", "bar\\\n", "baz\n", "\n", "qux\n"]
- * e = lines.slice_after(/(?<!\\)\n\z/)
- * p e.to_a
- * #=> [["foo\n"], ["bar\\\n", "baz\n"], ["\n"], ["qux\n"]]
- * p e.map {|ll| ll[0...-1].map {|l| l.sub(/\\\n\z/, "") }.join + ll.last }
- * #=>["foo\n", "barbaz\n", "\n", "qux\n"]
- *
- */
-
-static VALUE
-enum_slice_after(int argc, VALUE *argv, VALUE enumerable)
-{
- VALUE enumerator;
- VALUE pat = Qnil, pred = Qnil;
-
- if (rb_block_given_p()) {
- if (0 < argc)
- rb_raise(rb_eArgError, "both pattern and block are given");
- pred = rb_block_proc();
- }
- else {
- rb_scan_args(argc, argv, "1", &pat);
- }
-
- enumerator = rb_obj_alloc(rb_cEnumerator);
- rb_ivar_set(enumerator, rb_intern("sliceafter_enum"), enumerable);
- rb_ivar_set(enumerator, rb_intern("sliceafter_pat"), pat);
- rb_ivar_set(enumerator, rb_intern("sliceafter_pred"), pred);
-
- rb_block_call(enumerator, idInitialize, 0, 0, sliceafter_i, enumerator);
- return enumerator;
-}
-
-struct slicewhen_arg {
- VALUE pred;
- VALUE prev_elt;
- VALUE prev_elts;
- VALUE yielder;
- int inverted; /* 0 for slice_when and 1 for chunk_while. */
-};
-
-static VALUE
-slicewhen_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
-{
-#define UPDATE_MEMO ((void)(memo = MEMO_FOR(struct slicewhen_arg, _memo)))
- struct slicewhen_arg *memo;
- int split_p;
- UPDATE_MEMO;
-
- ENUM_WANT_SVALUE();
-
- if (memo->prev_elt == Qundef) {
- /* The first element */
- memo->prev_elt = i;
- memo->prev_elts = rb_ary_new3(1, i);
- }
- else {
- split_p = RTEST(rb_funcall(memo->pred, id_call, 2, memo->prev_elt, i));
- UPDATE_MEMO;
-
- if (memo->inverted)
- split_p = !split_p;
-
- if (split_p) {
- rb_funcall(memo->yielder, id_lshift, 1, memo->prev_elts);
- UPDATE_MEMO;
- memo->prev_elts = rb_ary_new3(1, i);
- }
- else {
- rb_ary_push(memo->prev_elts, i);
- }
-
- memo->prev_elt = i;
- }
-
- return Qnil;
-#undef UPDATE_MEMO
-}
-
-static VALUE
-slicewhen_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
-{
- VALUE enumerable;
- VALUE arg;
- struct slicewhen_arg *memo = NEW_MEMO_FOR(struct slicewhen_arg, arg);
-
- enumerable = rb_ivar_get(enumerator, rb_intern("slicewhen_enum"));
- memo->pred = rb_attr_get(enumerator, rb_intern("slicewhen_pred"));
- memo->prev_elt = Qundef;
- memo->prev_elts = Qnil;
- memo->yielder = yielder;
- memo->inverted = RTEST(rb_attr_get(enumerator, rb_intern("slicewhen_inverted")));
-
- rb_block_call(enumerable, id_each, 0, 0, slicewhen_ii, arg);
- memo = MEMO_FOR(struct slicewhen_arg, arg);
- if (!NIL_P(memo->prev_elts))
- rb_funcall(memo->yielder, id_lshift, 1, memo->prev_elts);
- return Qnil;
-}
-
-/*
- * call-seq:
- * enum.slice_when {|elt_before, elt_after| bool } -> an_enumerator
- *
- * Creates an enumerator for each chunked elements.
- * The beginnings of chunks are defined by the block.
- *
- * This method split each chunk using adjacent elements,
- * _elt_before_ and _elt_after_,
- * in the receiver enumerator.
- * This method split chunks between _elt_before_ and _elt_after_ where
- * the block returns true.
- *
- * The block is called the length of the receiver enumerator minus one.
- *
- * The result enumerator yields the chunked elements as an array.
- * So +each+ method can be called as follows:
- *
- * enum.slice_when { |elt_before, elt_after| bool }.each { |ary| ... }
- *
- * Other methods of the Enumerator class and Enumerable module,
- * such as +to_a+, +map+, etc., are also usable.
- *
- * For example, one-by-one increasing subsequence can be chunked as follows:
- *
- * a = [1,2,4,9,10,11,12,15,16,19,20,21]
- * b = a.slice_when {|i, j| i+1 != j }
- * p b.to_a #=> [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]
- * c = b.map {|a| a.length < 3 ? a : "#{a.first}-#{a.last}" }
- * p c #=> [[1, 2], [4], "9-12", [15, 16], "19-21"]
- * d = c.join(",")
- * p d #=> "1,2,4,9-12,15,16,19-21"
- *
- * Near elements (threshold: 6) in sorted array can be chunked as follows:
- *
- * a = [3, 11, 14, 25, 28, 29, 29, 41, 55, 57]
- * p a.slice_when {|i, j| 6 < j - i }.to_a
- * #=> [[3], [11, 14], [25, 28, 29, 29], [41], [55, 57]]
- *
- * Increasing (non-decreasing) subsequence can be chunked as follows:
- *
- * a = [0, 9, 2, 2, 3, 2, 7, 5, 9, 5]
- * p a.slice_when {|i, j| i > j }.to_a
- * #=> [[0, 9], [2, 2, 3], [2, 7], [5, 9], [5]]
- *
- * Adjacent evens and odds can be chunked as follows:
- * (Enumerable#chunk is another way to do it.)
- *
- * a = [7, 5, 9, 2, 0, 7, 9, 4, 2, 0]
- * p a.slice_when {|i, j| i.even? != j.even? }.to_a
- * #=> [[7, 5, 9], [2, 0], [7, 9], [4, 2, 0]]
- *
- * Paragraphs (non-empty lines with trailing empty lines) can be chunked as follows:
- * (See Enumerable#chunk to ignore empty lines.)
- *
- * lines = ["foo\n", "bar\n", "\n", "baz\n", "qux\n"]
- * p lines.slice_when {|l1, l2| /\A\s*\z/ =~ l1 && /\S/ =~ l2 }.to_a
- * #=> [["foo\n", "bar\n", "\n"], ["baz\n", "qux\n"]]
- *
- */
-static VALUE
-enum_slice_when(VALUE enumerable)
-{
- VALUE enumerator;
- VALUE pred;
-
- pred = rb_block_proc();
-
- enumerator = rb_obj_alloc(rb_cEnumerator);
- rb_ivar_set(enumerator, rb_intern("slicewhen_enum"), enumerable);
- rb_ivar_set(enumerator, rb_intern("slicewhen_pred"), pred);
- rb_ivar_set(enumerator, rb_intern("slicewhen_inverted"), Qfalse);
-
- rb_block_call(enumerator, idInitialize, 0, 0, slicewhen_i, enumerator);
- return enumerator;
-}
-
-/*
- * call-seq:
- * enum.chunk_while {|elt_before, elt_after| bool } -> an_enumerator
- *
- * Creates an enumerator for each chunked elements.
- * The beginnings of chunks are defined by the block.
- *
- * This method split each chunk using adjacent elements,
- * _elt_before_ and _elt_after_,
- * in the receiver enumerator.
- * This method split chunks between _elt_before_ and _elt_after_ where
- * the block returns false.
- *
- * The block is called the length of the receiver enumerator minus one.
- *
- * The result enumerator yields the chunked elements as an array.
- * So +each+ method can be called as follows:
- *
- * enum.chunk_while { |elt_before, elt_after| bool }.each { |ary| ... }
- *
- * Other methods of the Enumerator class and Enumerable module,
- * such as +to_a+, +map+, etc., are also usable.
- *
- * For example, one-by-one increasing subsequence can be chunked as follows:
- *
- * a = [1,2,4,9,10,11,12,15,16,19,20,21]
- * b = a.chunk_while {|i, j| i+1 == j }
- * p b.to_a #=> [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]
- * c = b.map {|a| a.length < 3 ? a : "#{a.first}-#{a.last}" }
- * p c #=> [[1, 2], [4], "9-12", [15, 16], "19-21"]
- * d = c.join(",")
- * p d #=> "1,2,4,9-12,15,16,19-21"
- *
- * Increasing (non-decreasing) subsequence can be chunked as follows:
- *
- * a = [0, 9, 2, 2, 3, 2, 7, 5, 9, 5]
- * p a.chunk_while {|i, j| i <= j }.to_a
- * #=> [[0, 9], [2, 2, 3], [2, 7], [5, 9], [5]]
- *
- * Adjacent evens and odds can be chunked as follows:
- * (Enumerable#chunk is another way to do it.)
- *
- * a = [7, 5, 9, 2, 0, 7, 9, 4, 2, 0]
- * p a.chunk_while {|i, j| i.even? == j.even? }.to_a
- * #=> [[7, 5, 9], [2, 0], [7, 9], [4, 2, 0]]
- *
- */
-static VALUE
-enum_chunk_while(VALUE enumerable)
-{
- VALUE enumerator;
- VALUE pred;
-
- pred = rb_block_proc();
-
- enumerator = rb_obj_alloc(rb_cEnumerator);
- rb_ivar_set(enumerator, rb_intern("slicewhen_enum"), enumerable);
- rb_ivar_set(enumerator, rb_intern("slicewhen_pred"), pred);
- rb_ivar_set(enumerator, rb_intern("slicewhen_inverted"), Qtrue);
-
- rb_block_call(enumerator, idInitialize, 0, 0, slicewhen_i, enumerator);
- return enumerator;
-}
-
/*
* The <code>Enumerable</code> mixin provides collection classes with
* several traversal and searching methods, and with the ability to
@@ -3499,7 +2796,6 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "sort", enum_sort, 0);
rb_define_method(rb_mEnumerable, "sort_by", enum_sort_by, 0);
rb_define_method(rb_mEnumerable, "grep", enum_grep, 1);
- rb_define_method(rb_mEnumerable, "grep_v", enum_grep_v, 1);
rb_define_method(rb_mEnumerable, "count", enum_count, -1);
rb_define_method(rb_mEnumerable, "find", enum_find, -1);
rb_define_method(rb_mEnumerable, "detect", enum_find, -1);
@@ -3520,11 +2816,11 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "any?", enum_any, 0);
rb_define_method(rb_mEnumerable, "one?", enum_one, 0);
rb_define_method(rb_mEnumerable, "none?", enum_none, 0);
- rb_define_method(rb_mEnumerable, "min", enum_min, -1);
- rb_define_method(rb_mEnumerable, "max", enum_max, -1);
+ rb_define_method(rb_mEnumerable, "min", enum_min, 0);
+ rb_define_method(rb_mEnumerable, "max", enum_max, 0);
rb_define_method(rb_mEnumerable, "minmax", enum_minmax, 0);
- rb_define_method(rb_mEnumerable, "min_by", enum_min_by, -1);
- rb_define_method(rb_mEnumerable, "max_by", enum_max_by, -1);
+ rb_define_method(rb_mEnumerable, "min_by", enum_min_by, 0);
+ rb_define_method(rb_mEnumerable, "max_by", enum_max_by, 0);
rb_define_method(rb_mEnumerable, "minmax_by", enum_minmax_by, 0);
rb_define_method(rb_mEnumerable, "member?", enum_member, 1);
rb_define_method(rb_mEnumerable, "include?", enum_member, 1);
@@ -3540,11 +2836,8 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "drop", enum_drop, 1);
rb_define_method(rb_mEnumerable, "drop_while", enum_drop_while, 0);
rb_define_method(rb_mEnumerable, "cycle", enum_cycle, -1);
- rb_define_method(rb_mEnumerable, "chunk", enum_chunk, 0);
+ rb_define_method(rb_mEnumerable, "chunk", enum_chunk, -1);
rb_define_method(rb_mEnumerable, "slice_before", enum_slice_before, -1);
- rb_define_method(rb_mEnumerable, "slice_after", enum_slice_after, -1);
- rb_define_method(rb_mEnumerable, "slice_when", enum_slice_when, 0);
- rb_define_method(rb_mEnumerable, "chunk_while", enum_chunk_while, 0);
id_next = rb_intern("next");
id_call = rb_intern("call");
diff --git a/enumerator.c b/enumerator.c
index a59473a88c..a3022ce3bb 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -12,6 +12,8 @@
************************************************/
+#include "ruby/ruby.h"
+#include "node.h"
#include "internal.h"
/*
@@ -156,7 +158,7 @@ enumerator_mark(void *p)
static size_t
enumerator_memsize(const void *p)
{
- return sizeof(struct enumerator);
+ return p ? sizeof(struct enumerator) : 0;
}
static const rb_data_type_t enumerator_data_type = {
@@ -166,7 +168,7 @@ static const rb_data_type_t enumerator_data_type = {
enumerator_free,
enumerator_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct enumerator *
@@ -265,7 +267,7 @@ enumerator_allocate(VALUE klass)
}
static VALUE
-enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn, VALUE size)
+enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn, VALUE size)
{
struct enumerator *ptr;
@@ -396,16 +398,16 @@ enumerator_init_copy(VALUE obj, VALUE orig)
* For backwards compatibility; use rb_enumeratorize_with_size
*/
VALUE
-rb_enumeratorize(VALUE obj, VALUE meth, int argc, const VALUE *argv)
+rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
{
return rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
}
static VALUE
-lazy_to_enum_i(VALUE self, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn);
+lazy_to_enum_i(VALUE self, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn);
VALUE
-rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn)
+rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
{
/* Similar effect as calling obj.to_enum, i.e. dispatching to either
Kernel#to_enum vs Lazy#to_enum */
@@ -420,13 +422,13 @@ static VALUE
enumerator_block_call(VALUE obj, rb_block_call_func *func, VALUE arg)
{
int argc = 0;
- const VALUE *argv = 0;
+ VALUE *argv = 0;
const struct enumerator *e = enumerator_ptr(obj);
ID meth = e->meth;
if (e->args) {
argc = RARRAY_LENINT(e->args);
- argv = RARRAY_CONST_PTR(e->args);
+ argv = RARRAY_PTR(e->args);
}
return rb_block_call(e->obj, meth, argc, argv, func, arg);
}
@@ -491,11 +493,11 @@ enumerator_each(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-enumerator_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
{
- struct MEMO *memo = (struct MEMO *)m;
- VALUE idx = memo->v1;
- MEMO_V1_SET(memo, rb_int_succ(idx));
+ VALUE *memo = (VALUE *)m;
+ VALUE idx = *memo;
+ *memo = rb_int_succ(idx);
if (argc <= 1)
return rb_yield_values(2, val, idx);
@@ -535,7 +537,7 @@ enumerator_with_index(int argc, VALUE *argv, VALUE obj)
memo = INT2FIX(0);
else
memo = rb_to_int(memo);
- return enumerator_block_call(obj, enumerator_with_index_i, (VALUE)MEMO_NEW(memo, 0, 0));
+ return enumerator_block_call(obj, enumerator_with_index_i, (VALUE)&memo);
}
/*
@@ -555,7 +557,7 @@ enumerator_each_with_index(VALUE obj)
}
static VALUE
-enumerator_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memo))
+enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
{
if (argc <= 1)
return rb_yield_values(2, val, memo);
@@ -602,7 +604,7 @@ enumerator_with_object(VALUE obj, VALUE memo)
}
static VALUE
-next_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, obj))
+next_ii(VALUE i, VALUE obj, int argc, VALUE *argv)
{
struct enumerator *e = enumerator_ptr(obj);
VALUE feedvalue = Qnil;
@@ -836,7 +838,7 @@ enumerator_peek_values_m(VALUE obj)
* p e.peek #=> 2
* p e.next #=> 2
* p e.next #=> 3
- * p e.peek #raises StopIteration
+ * p e.next #raises StopIteration
*
*/
@@ -973,15 +975,13 @@ append_method(VALUE obj, VALUE str, ID default_method, VALUE default_args)
method = rb_attr_get(obj, id_method);
if (method != Qfalse) {
+ ID mid = default_method;
if (!NIL_P(method)) {
Check_Type(method, T_SYMBOL);
- method = rb_sym2str(method);
- }
- else {
- method = rb_id2str(default_method);
+ mid = SYM2ID(method);
}
rb_str_buf_cat2(str, ":");
- rb_str_buf_append(str, method);
+ rb_str_buf_append(str, rb_id2str(mid));
}
eargs = rb_attr_get(obj, id_arguments);
@@ -1067,7 +1067,7 @@ yielder_mark(void *p)
static size_t
yielder_memsize(const void *p)
{
- return sizeof(struct yielder);
+ return p ? sizeof(struct yielder) : 0;
}
static const rb_data_type_t yielder_data_type = {
@@ -1077,7 +1077,7 @@ static const rb_data_type_t yielder_data_type = {
yielder_free,
yielder_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct yielder *
@@ -1140,15 +1140,14 @@ yielder_yield(VALUE obj, VALUE args)
}
/* :nodoc: */
-static VALUE
-yielder_yield_push(VALUE obj, VALUE args)
+static VALUE yielder_yield_push(VALUE obj, VALUE args)
{
yielder_yield(obj, args);
return obj;
}
static VALUE
-yielder_yield_i(RB_BLOCK_CALL_FUNC_ARGLIST(obj, memo))
+yielder_yield_i(VALUE obj, VALUE memo, int argc, VALUE *argv)
{
return rb_yield_values2(argc, argv);
}
@@ -1174,7 +1173,7 @@ generator_mark(void *p)
static size_t
generator_memsize(const void *p)
{
- return sizeof(struct generator);
+ return p ? sizeof(struct generator) : 0;
}
static const rb_data_type_t generator_data_type = {
@@ -1184,7 +1183,7 @@ static const rb_data_type_t generator_data_type = {
generator_free,
generator_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct generator *
@@ -1245,8 +1244,8 @@ generator_initialize(int argc, VALUE *argv, VALUE obj)
if (!rb_obj_is_proc(proc))
rb_raise(rb_eTypeError,
- "wrong argument type %"PRIsVALUE" (expected Proc)",
- rb_obj_class(proc));
+ "wrong argument type %s (expected Proc)",
+ rb_obj_classname(proc));
if (rb_block_given_p()) {
rb_warn("given block not used");
@@ -1319,7 +1318,7 @@ lazy_receiver_size(VALUE generator, VALUE args, VALUE lazy)
}
static VALUE
-lazy_init_iterator(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE result;
if (argc == 1) {
@@ -1331,21 +1330,21 @@ lazy_init_iterator(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
else {
VALUE args;
int len = rb_long2int((long)argc + 1);
- VALUE *nargv = ALLOCV_N(VALUE, args, len);
- nargv[0] = m;
+ args = rb_ary_tmp_new(len);
+ rb_ary_push(args, m);
if (argc > 0) {
- MEMCPY(nargv + 1, argv, VALUE, argc);
+ rb_ary_cat(args, argv, argc);
}
- result = rb_yield_values2(len, nargv);
- ALLOCV_END(args);
+ result = rb_yield_values2(len, RARRAY_CONST_PTR(args));
+ RB_GC_GUARD(args);
}
if (result == Qundef) rb_iter_break();
return Qnil;
}
static VALUE
-lazy_init_block_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_init_block_i(VALUE val, VALUE m, int argc, VALUE *argv)
{
rb_block_call(m, id_each, argc-1, argv+1, lazy_init_iterator, val);
return Qnil;
@@ -1423,7 +1422,7 @@ lazy_set_method(VALUE lazy, VALUE args, rb_enumerator_size_func *size_fn)
* e.lazy -> lazy_enumerator
*
* Returns a lazy enumerator, whose methods map/collect,
- * flat_map/collect_concat, select/find_all, reject, grep, grep_v, zip, take,
+ * flat_map/collect_concat, select/find_all, reject, grep, zip, take,
* take_while, drop, and drop_while enumerate values only on an
* as-needed basis. However, if a block is given to zip, values
* are enumerated immediately.
@@ -1459,7 +1458,7 @@ enumerable_lazy(VALUE obj)
}
static VALUE
-lazy_to_enum_i(VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn)
+lazy_to_enum_i(VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
{
return enumerator_init(enumerator_allocate(rb_cLazy),
obj, meth, argc, argv, size_fn, Qnil);
@@ -1505,7 +1504,7 @@ lazy_to_enum(int argc, VALUE *argv, VALUE self)
}
static VALUE
-lazy_map_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
@@ -1526,7 +1525,7 @@ lazy_map(VALUE obj)
}
static VALUE
-lazy_flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, yielder))
+lazy_flat_map_i(VALUE i, VALUE yielder, int argc, VALUE *argv)
{
return rb_funcall2(yielder, id_yield, argc, argv);
}
@@ -1555,7 +1554,7 @@ lazy_flat_map_to_ary(VALUE obj, VALUE yielder)
}
static VALUE
-lazy_flat_map_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (RB_TYPE_P(result, T_ARRAY)) {
@@ -1611,7 +1610,7 @@ lazy_flat_map(VALUE obj)
}
static VALUE
-lazy_select_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_select_func(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@@ -1634,7 +1633,7 @@ lazy_select(VALUE obj)
}
static VALUE
-lazy_reject_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_reject_func(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@@ -1657,7 +1656,7 @@ lazy_reject(VALUE obj)
}
static VALUE
-lazy_grep_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
VALUE result = rb_funcall(m, id_eqq, 1, i);
@@ -1669,7 +1668,7 @@ lazy_grep_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
}
static VALUE
-lazy_grep_iter(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
+lazy_grep_iter(VALUE val, VALUE m, int argc, VALUE *argv)
{
VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
VALUE result = rb_funcall(m, id_eqq, 1, i);
@@ -1691,40 +1690,6 @@ lazy_grep(VALUE obj, VALUE pattern)
}
static VALUE
-lazy_grep_v_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
-{
- VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
- VALUE result = rb_funcall(m, id_eqq, 1, i);
-
- if (!RTEST(result)) {
- rb_funcall(argv[0], id_yield, 1, i);
- }
- return Qnil;
-}
-
-static VALUE
-lazy_grep_v_iter(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
-{
- VALUE i = rb_enum_values_pack(argc - 1, argv + 1);
- VALUE result = rb_funcall(m, id_eqq, 1, i);
-
- if (!RTEST(result)) {
- rb_funcall(argv[0], id_yield, 1, rb_yield(i));
- }
- return Qnil;
-}
-
-static VALUE
-lazy_grep_v(VALUE obj, VALUE pattern)
-{
- return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj,
- rb_block_given_p() ?
- lazy_grep_v_iter : lazy_grep_v_func,
- pattern),
- rb_ary_new3(1, pattern), 0);
-}
-
-static VALUE
call_next(VALUE obj)
{
return rb_funcall(obj, id_next, 0);
@@ -1737,7 +1702,7 @@ next_stopped(VALUE obj)
}
static VALUE
-lazy_zip_arrays_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, arrays))
+lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
{
VALUE yielder, ary, memo;
long i, count;
@@ -1757,7 +1722,7 @@ lazy_zip_arrays_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, arrays))
}
static VALUE
-lazy_zip_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, zip_args))
+lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
{
VALUE yielder, ary, arg, v;
long i;
@@ -1805,8 +1770,8 @@ lazy_zip(int argc, VALUE *argv, VALUE obj)
if (NIL_P(v)) {
for (; i < argc; i++) {
if (!rb_respond_to(argv[i], id_each)) {
- rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (must respond to :each)",
- rb_obj_class(argv[i]));
+ rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)",
+ rb_obj_classname(argv[i]));
}
}
ary = rb_ary_new4(argc, argv);
@@ -1822,7 +1787,7 @@ lazy_zip(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-lazy_take_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
+lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv)
{
long remain;
VALUE memo = rb_attr_get(argv[0], id_memo);
@@ -1871,7 +1836,7 @@ lazy_take(VALUE obj, VALUE n)
}
static VALUE
-lazy_take_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
+lazy_take_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (!RTEST(result)) return Qundef;
@@ -1905,7 +1870,7 @@ lazy_drop_size(VALUE generator, VALUE args, VALUE lazy)
}
static VALUE
-lazy_drop_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
+lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv)
{
long remain;
VALUE memo = rb_attr_get(argv[0], id_memo);
@@ -1935,7 +1900,7 @@ lazy_drop(VALUE obj, VALUE n)
}
static VALUE
-lazy_drop_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
+lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
{
VALUE memo = rb_attr_get(argv[0], id_memo);
if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) {
@@ -2063,7 +2028,6 @@ InitVM_Enumerator(void)
rb_define_method(rb_cLazy, "find_all", lazy_select, 0);
rb_define_method(rb_cLazy, "reject", lazy_reject, 0);
rb_define_method(rb_cLazy, "grep", lazy_grep, 1);
- rb_define_method(rb_cLazy, "grep_v", lazy_grep_v, 1);
rb_define_method(rb_cLazy, "zip", lazy_zip, -1);
rb_define_method(rb_cLazy, "take", lazy_take, 1);
rb_define_method(rb_cLazy, "take_while", lazy_take_while, 0);
@@ -2072,8 +2036,6 @@ InitVM_Enumerator(void)
rb_define_method(rb_cLazy, "lazy", lazy_lazy, 0);
rb_define_method(rb_cLazy, "chunk", lazy_super, -1);
rb_define_method(rb_cLazy, "slice_before", lazy_super, -1);
- rb_define_method(rb_cLazy, "slice_after", lazy_super, -1);
- rb_define_method(rb_cLazy, "slice_when", lazy_super, -1);
rb_define_alias(rb_cLazy, "force", "to_a");
@@ -2098,7 +2060,6 @@ InitVM_Enumerator(void)
rb_provide("enumerator.so"); /* for backward compatibility */
}
-#undef rb_intern
void
Init_Enumerator(void)
{
diff --git a/error.c b/error.c
index 46ae322ebe..ac7b632751 100644
--- a/error.c
+++ b/error.c
@@ -9,8 +9,10 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/st.h"
+#include "ruby/encoding.h"
+#include "internal.h"
#include "vm_core.h"
#include <stdio.h>
@@ -35,23 +37,18 @@
#define WEXITSTATUS(status) (status)
#endif
-VALUE rb_iseqw_local_variables(VALUE iseqval);
-VALUE rb_iseqw_new(const rb_iseq_t *);
-
VALUE rb_eEAGAIN;
VALUE rb_eEWOULDBLOCK;
VALUE rb_eEINPROGRESS;
extern const char ruby_description[];
-static const char REPORTBUG_MSG[] =
+#define REPORTBUG_MSG \
"[NOTE]\n" \
"You may have encountered a bug in the Ruby interpreter" \
" or extension libraries.\n" \
"Bug reports are welcome.\n" \
- ""
"For details: http://www.ruby-lang.org/bugreport.html\n\n" \
- ;
static const char *
rb_strerrno(int err)
@@ -152,20 +149,6 @@ rb_compile_error(const char *file, int line, const char *fmt, ...)
}
void
-rb_compile_error_str(VALUE file, int line, void *enc, const char *fmt, ...)
-{
- va_list args;
- VALUE str;
-
- va_start(args, fmt);
- str = compile_snprintf(enc, NULL,
- NIL_P(file) ? NULL : RSTRING_PTR(file), line,
- fmt, args);
- va_end(args);
- compile_err_append(str);
-}
-
-void
rb_compile_error_append(const char *fmt, ...)
{
va_list args;
@@ -212,14 +195,14 @@ rb_compile_warning(const char *file, int line, const char *fmt, ...)
va_end(args);
}
-static VALUE
-warning_string(rb_encoding *enc, const char *fmt, va_list args)
+static void
+warn_print(const char *fmt, va_list args)
{
- VALUE str = rb_enc_str_new(0, 0, enc);
- int line;
- VALUE file = rb_source_location(&line);
+ VALUE str = rb_str_new(0, 0);
+ VALUE file = rb_sourcefilename();
if (!NIL_P(file)) {
+ int line = rb_sourceline();
str = rb_str_append(str, file);
if (line) rb_str_catf(str, ":%d", line);
rb_str_cat2(str, ": ");
@@ -228,68 +211,34 @@ warning_string(rb_encoding *enc, const char *fmt, va_list args)
rb_str_cat2(str, "warning: ");
rb_str_vcatf(str, fmt, args);
rb_str_cat2(str, "\n");
- return str;
+ rb_write_error_str(str);
}
void
rb_warn(const char *fmt, ...)
{
- VALUE mesg;
va_list args;
if (NIL_P(ruby_verbose)) return;
va_start(args, fmt);
- mesg = warning_string(0, fmt, args);
+ warn_print(fmt, args);
va_end(args);
- rb_write_error_str(mesg);
-}
-
-void
-rb_enc_warn(rb_encoding *enc, const char *fmt, ...)
-{
- VALUE mesg;
- va_list args;
-
- if (NIL_P(ruby_verbose)) return;
-
- va_start(args, fmt);
- mesg = warning_string(enc, fmt, args);
- va_end(args);
- rb_write_error_str(mesg);
}
/* rb_warning() reports only in verbose mode */
void
rb_warning(const char *fmt, ...)
{
- VALUE mesg;
va_list args;
if (!RTEST(ruby_verbose)) return;
va_start(args, fmt);
- mesg = warning_string(0, fmt, args);
+ warn_print(fmt, args);
va_end(args);
- rb_write_error_str(mesg);
}
-#if 0
-void
-rb_enc_warning(rb_encoding *enc, const char *fmt, ...)
-{
- VALUE mesg;
- va_list args;
-
- if (!RTEST(ruby_verbose)) return;
-
- va_start(args, fmt);
- mesg = warning_string(enc, fmt, args);
- va_end(args);
- rb_write_error_str(mesg);
-}
-#endif
-
/*
* call-seq:
* warn(msg, ...) -> nil
@@ -338,106 +287,60 @@ rb_bug_reporter_add(void (*func)(FILE *, void *), void *data)
return 1;
}
-/* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */
-#define REPORT_BUG_BUFSIZ 256
-static FILE *
-bug_report_file(const char *file, int line)
+static void
+report_bug(const char *file, int line, const char *fmt, va_list args)
{
- char buf[REPORT_BUG_BUFSIZ];
+ /* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */
+ char buf[256];
FILE *out = stderr;
- int len = err_position_0(buf, sizeof(buf), file, line);
+ int len = err_position_0(buf, 256, file, line);
if ((ssize_t)fwrite(buf, 1, len, out) == (ssize_t)len ||
(ssize_t)fwrite(buf, 1, len, (out = stdout)) == (ssize_t)len) {
- return out;
- }
- return NULL;
-}
-
-static void
-bug_report_begin(FILE *out, const char *fmt, va_list args)
-{
- char buf[REPORT_BUG_BUFSIZ];
- fputs("[BUG] ", out);
- vsnprintf(buf, sizeof(buf), fmt, args);
- fputs(buf, out);
- snprintf(buf, sizeof(buf), "\n%s\n\n", ruby_description);
- fputs(buf, out);
-}
+ fputs("[BUG] ", out);
+ vsnprintf(buf, 256, fmt, args);
+ fputs(buf, out);
+ snprintf(buf, 256, "\n%s\n\n", ruby_description);
+ fputs(buf, out);
-#define bug_report_begin(out, fmt) do { \
- va_list args; \
- va_start(args, fmt); \
- bug_report_begin(out, fmt, args); \
- va_end(args); \
-} while (0)
+ rb_vm_bugreport();
-static void
-bug_report_end(FILE *out)
-{
- /* call additional bug reporters */
- {
- int i;
- for (i=0; i<bug_reporters_size; i++) {
- struct bug_reporters *reporter = &bug_reporters[i];
- (*reporter->func)(out, reporter->data);
+ /* call additional bug reporters */
+ {
+ int i;
+ for (i=0; i<bug_reporters_size; i++) {
+ struct bug_reporters *reporter = &bug_reporters[i];
+ (*reporter->func)(out, reporter->data);
+ }
}
+ fprintf(out, REPORTBUG_MSG);
}
- fprintf(out, REPORTBUG_MSG);
-}
-
-#define report_bug(file, line, fmt, ctx) do { \
- FILE *out = bug_report_file(file, line); \
- if (out) { \
- bug_report_begin(out, fmt); \
- rb_vm_bugreport(ctx); \
- bug_report_end(out); \
- } \
-} while (0) \
-
-NORETURN(static void die(void));
-static void
-die(void)
-{
-#if defined(_WIN32) && defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 80
- _set_abort_behavior( 0, _CALL_REPORTFAULT);
-#endif
-
- abort();
}
void
rb_bug(const char *fmt, ...)
{
+ va_list args;
const char *file = NULL;
int line = 0;
if (GET_THREAD()) {
- file = rb_source_loc(&line);
+ file = rb_sourcefile();
+ line = rb_sourceline();
}
- report_bug(file, line, fmt, NULL);
-
- die();
-}
-
-void
-rb_bug_context(const void *ctx, const char *fmt, ...)
-{
- const char *file = NULL;
- int line = 0;
-
- if (GET_THREAD()) {
- file = rb_source_loc(&line);
- }
+ va_start(args, fmt);
+ report_bug(file, line, fmt, args);
+ va_end(args);
- report_bug(file, line, fmt, ctx);
+#if defined(_WIN32) && defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 80
+ _set_abort_behavior( 0, _CALL_REPORTFAULT);
+#endif
- die();
+ abort();
}
-
void
rb_bug_errno(const char *mesg, int errno_arg)
{
@@ -486,15 +389,11 @@ rb_async_bug_errno(const char *mesg, int errno_arg)
void
rb_compile_bug(const char *file, int line, const char *fmt, ...)
{
- report_bug(file, line, fmt, NULL);
-
- abort();
-}
+ va_list args;
-void
-rb_compile_bug_str(VALUE file, int line, const char *fmt, ...)
-{
- report_bug(RSTRING_PTR(file), line, fmt, NULL);
+ va_start(args, fmt);
+ report_bug(file, line, fmt, args);
+ va_end(args);
abort();
}
@@ -522,11 +421,12 @@ static const char builtin_types[][10] = {
"false",
"Symbol", /* :symbol */
"Fixnum",
- "undef", /* internal use: #undef; should not happen */
+ "", /* 0x16 */
"", /* 0x17 */
"", /* 0x18 */
"", /* 0x19 */
- "Memo", /* internal use: general memo */
+ "", /* 0x1a */
+ "undef", /* internal use: #undef; should not happen */
"Node", /* internal use: syntax tree node */
"iClass", /* internal use: mixed-in module holder */
};
@@ -541,8 +441,9 @@ rb_builtin_type_name(int t)
return 0;
}
-static const char *
-builtin_class_name(VALUE x)
+#define builtin_class_name rb_builtin_class_name
+const char *
+rb_builtin_class_name(VALUE x)
{
const char *etype;
@@ -562,17 +463,6 @@ builtin_class_name(VALUE x)
etype = "false";
}
else {
- etype = NULL;
- }
- return etype;
-}
-
-const char *
-rb_builtin_class_name(VALUE x)
-{
- const char *etype = builtin_class_name(x);
-
- if (!etype) {
etype = rb_obj_classname(x);
}
return etype;
@@ -591,13 +481,8 @@ rb_check_type(VALUE x, int t)
if (xt != t || (xt == T_DATA && RTYPEDDATA_P(x))) {
const char *tname = rb_builtin_type_name(t);
if (tname) {
- const char *cname = builtin_class_name(x);
- if (cname)
- rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
- cname, tname);
- else
- rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (expected %s)",
- rb_obj_class(x), tname);
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
+ builtin_class_name(x), tname);
}
if (xt > T_MASK && xt <= 0x3f) {
rb_fatal("unknown type 0x%x (0x%x given, probably comes from extension library for ruby 1.8)", t, xt);
@@ -630,23 +515,19 @@ void *
rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
{
const char *etype;
+ static const char mesg[] = "wrong argument type %s (expected %s)";
if (!RB_TYPE_P(obj, T_DATA)) {
- wrong_type:
etype = builtin_class_name(obj);
- if (!etype)
- rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (expected %s)",
- rb_obj_class(obj), data_type->wrap_struct_name);
- wrong_datatype:
- rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
- etype, data_type->wrap_struct_name);
+ rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
}
if (!RTYPEDDATA_P(obj)) {
- goto wrong_type;
+ etype = rb_obj_classname(obj);
+ rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
}
else if (!rb_typeddata_inherited_p(RTYPEDDATA_TYPE(obj), data_type)) {
etype = RTYPEDDATA_TYPE(obj)->wrap_struct_name;
- goto wrong_datatype;
+ rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
}
return DATA_PTR(obj);
}
@@ -681,21 +562,12 @@ VALUE rb_eSystemCallError;
VALUE rb_mErrno;
static VALUE rb_eNOERROR;
-static ID id_new, id_cause, id_message, id_backtrace;
-static ID id_name, id_args, id_Errno, id_errno, id_i_path;
-static ID id_receiver, id_iseq, id_local_variables;
-extern ID ruby_static_id_status;
-#define id_bt idBt
-#define id_bt_locations idBt_locations
-#define id_mesg idMesg
-#define id_status ruby_static_id_status
-
#undef rb_exc_new_cstr
VALUE
rb_exc_new(VALUE etype, const char *ptr, long len)
{
- return rb_funcall(etype, id_new, 1, rb_str_new(ptr, len));
+ return rb_funcall(etype, rb_intern("new"), 1, rb_str_new(ptr, len));
}
VALUE
@@ -708,7 +580,7 @@ VALUE
rb_exc_new_str(VALUE etype, VALUE str)
{
StringValue(str);
- return rb_funcall(etype, id_new, 1, str);
+ return rb_funcall(etype, rb_intern("new"), 1, str);
}
/*
@@ -725,8 +597,8 @@ exc_initialize(int argc, VALUE *argv, VALUE exc)
VALUE arg;
rb_scan_args(argc, argv, "01", &arg);
- rb_ivar_set(exc, id_mesg, arg);
- rb_ivar_set(exc, id_bt, Qnil);
+ rb_iv_set(exc, "mesg", arg);
+ rb_iv_set(exc, "bt", Qnil);
return exc;
}
@@ -768,7 +640,7 @@ exc_exception(int argc, VALUE *argv, VALUE self)
static VALUE
exc_to_s(VALUE exc)
{
- VALUE mesg = rb_attr_get(exc, idMesg);
+ VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
return rb_String(mesg);
@@ -787,7 +659,7 @@ exc_to_s(VALUE exc)
static VALUE
exc_message(VALUE exc)
{
- return rb_funcallv(exc, idTo_s, 0, 0);
+ return rb_funcall(exc, rb_intern("to_s"), 0, 0);
}
/*
@@ -850,60 +722,21 @@ exc_inspect(VALUE exc)
static VALUE
exc_backtrace(VALUE exc)
{
+ ID bt;
VALUE obj;
- obj = rb_attr_get(exc, id_bt);
+ CONST_ID(bt, "bt");
+ obj = rb_attr_get(exc, bt);
if (rb_backtrace_p(obj)) {
obj = rb_backtrace_to_str_ary(obj);
- /* rb_ivar_set(exc, id_bt, obj); */
+ /* rb_iv_set(exc, "bt", obj); */
}
return obj;
}
VALUE
-rb_get_backtrace(VALUE exc)
-{
- ID mid = id_backtrace;
- if (rb_method_basic_definition_p(CLASS_OF(exc), id_backtrace)) {
- VALUE info, klass = rb_eException;
- rb_thread_t *th = GET_THREAD();
- if (NIL_P(exc))
- return Qnil;
- EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, exc, mid, klass, Qundef);
- info = exc_backtrace(exc);
- EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, exc, mid, klass, info);
- if (NIL_P(info))
- return Qnil;
- return rb_check_backtrace(info);
- }
- return rb_funcall(exc, mid, 0, 0);
-}
-
-/*
- * call-seq:
- * exception.backtrace_locations -> array
- *
- * Returns any backtrace associated with the exception. This method is
- * similar to Exception#backtrace, but the backtrace is an array of
- * Thread::Backtrace::Location.
- *
- * Now, this method is not affected by Exception#set_backtrace().
- */
-static VALUE
-exc_backtrace_locations(VALUE exc)
-{
- VALUE obj;
-
- obj = rb_attr_get(exc, id_bt_locations);
- if (!NIL_P(obj)) {
- obj = rb_backtrace_to_location_ary(obj);
- }
- return obj;
-}
-
-VALUE
rb_check_backtrace(VALUE bt)
{
long i;
@@ -938,7 +771,7 @@ rb_check_backtrace(VALUE bt)
static VALUE
exc_set_backtrace(VALUE exc, VALUE bt)
{
- return rb_ivar_set(exc, id_bt, rb_check_backtrace(bt));
+ return rb_iv_set(exc, "bt", rb_check_backtrace(bt));
}
VALUE
@@ -947,25 +780,20 @@ rb_exc_set_backtrace(VALUE exc, VALUE bt)
return exc_set_backtrace(exc, bt);
}
-/*
- * call-seq:
- * exception.cause -> an_exception or nil
- *
- * Returns the previous exception ($!) at the time this exception was raised.
- * This is useful for wrapping exceptions and retaining the original exception
- * information.
- */
-
-static VALUE
+VALUE
exc_cause(VALUE exc)
{
+ ID id_cause;
+ CONST_ID(id_cause, "cause");
return rb_attr_get(exc, id_cause);
}
static VALUE
try_convert_to_exception(VALUE obj)
{
- return rb_check_funcall(obj, idException, 0, 0);
+ ID id_exception;
+ CONST_ID(id_exception, "exception");
+ return rb_check_funcall(obj, id_exception, 0, 0);
}
/*
@@ -981,11 +809,16 @@ static VALUE
exc_equal(VALUE exc, VALUE obj)
{
VALUE mesg, backtrace;
+ ID id_mesg;
if (exc == obj) return Qtrue;
+ CONST_ID(id_mesg, "mesg");
if (rb_obj_class(exc) != rb_obj_class(obj)) {
int status = 0;
+ ID id_message, id_backtrace;
+ CONST_ID(id_message, "message");
+ CONST_ID(id_backtrace, "backtrace");
obj = rb_protect(try_convert_to_exception, obj, &status);
if (status || obj == Qundef) {
@@ -1060,7 +893,7 @@ exit_initialize(int argc, VALUE *argv, VALUE exc)
status = INT2FIX(EXIT_SUCCESS);
}
rb_call_super(argc, argv);
- rb_ivar_set(exc, id_status, status);
+ rb_iv_set(exc, "status", status);
return exc;
}
@@ -1075,7 +908,7 @@ exit_initialize(int argc, VALUE *argv, VALUE exc)
static VALUE
exit_status(VALUE exc)
{
- return rb_attr_get(exc, id_status);
+ return rb_attr_get(exc, rb_intern("status"));
}
@@ -1089,7 +922,7 @@ exit_status(VALUE exc)
static VALUE
exit_success_p(VALUE exc)
{
- VALUE status_val = rb_attr_get(exc, id_status);
+ VALUE status_val = rb_attr_get(exc, rb_intern("status"));
int status;
if (NIL_P(status_val))
@@ -1144,18 +977,10 @@ static VALUE
name_err_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE name;
- VALUE iseqw = Qnil;
name = (argc > 1) ? argv[--argc] : Qnil;
rb_call_super(argc, argv);
- rb_ivar_set(self, id_name, name);
- {
- rb_thread_t *th = GET_THREAD();
- rb_control_frame_t *cfp =
- rb_vm_get_ruby_level_next_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
- if (cfp) iseqw = rb_iseqw_new(cfp->iseq);
- }
- rb_ivar_set(self, id_iseq, iseqw);
+ rb_iv_set(self, "name", name);
return self;
}
@@ -1169,31 +994,7 @@ name_err_initialize(int argc, VALUE *argv, VALUE self)
static VALUE
name_err_name(VALUE self)
{
- return rb_attr_get(self, id_name);
-}
-
-/*
- * call-seq:
- * name_error.local_variables -> array
- *
- * Return a list of the local variable names defined where this
- * NameError exception was raised.
- *
- * Internal use only.
- */
-
-static VALUE
-name_err_local_variables(VALUE self)
-{
- VALUE vars = rb_attr_get(self, id_local_variables);
-
- if (NIL_P(vars)) {
- VALUE iseqw = rb_attr_get(self, id_iseq);
- if (!NIL_P(iseqw)) vars = rb_iseqw_local_variables(iseqw);
- if (NIL_P(vars)) vars = rb_ary_new();
- rb_ivar_set(self, id_local_variables, vars);
- }
- return vars;
+ return rb_attr_get(self, rb_intern("name"));
}
/*
@@ -1211,17 +1012,12 @@ nometh_err_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE args = (argc > 2) ? argv[--argc] : Qnil;
name_err_initialize(argc, argv, self);
- rb_ivar_set(self, id_args, args);
+ rb_iv_set(self, "args", args);
return self;
}
/* :nodoc: */
-enum {
- NAME_ERR_MESG__MESG,
- NAME_ERR_MESG__RECV,
- NAME_ERR_MESG__NAME,
- NAME_ERR_MESG_COUNT
-};
+#define NAME_ERR_MESG_COUNT 3
static void
name_err_mesg_mark(void *p)
@@ -1235,7 +1031,7 @@ name_err_mesg_mark(void *p)
static size_t
name_err_mesg_memsize(const void *p)
{
- return NAME_ERR_MESG_COUNT * sizeof(VALUE);
+ return p ? (NAME_ERR_MESG_COUNT * sizeof(VALUE)) : 0;
}
static const rb_data_type_t name_err_mesg_data_type = {
@@ -1245,34 +1041,26 @@ static const rb_data_type_t name_err_mesg_data_type = {
name_err_mesg_free,
name_err_mesg_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
/* :nodoc: */
VALUE
-rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method)
+rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
{
- VALUE result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, 0);
VALUE *ptr = ALLOC_N(VALUE, NAME_ERR_MESG_COUNT);
-
- ptr[NAME_ERR_MESG__MESG] = mesg;
- ptr[NAME_ERR_MESG__RECV] = recv;
- ptr[NAME_ERR_MESG__NAME] = method;
- RTYPEDDATA_DATA(result) = ptr;
+ VALUE result;
+
+ ptr[0] = mesg;
+ ptr[1] = recv;
+ ptr[2] = method;
+ result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+ RB_GC_GUARD(mesg);
+ RB_GC_GUARD(recv);
+ RB_GC_GUARD(method);
return result;
}
-VALUE
-rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
-{
- VALUE exc = rb_obj_alloc(rb_eNameError);
- rb_ivar_set(exc, id_mesg, rb_name_err_mesg_new(mesg, recv, method));
- rb_ivar_set(exc, id_bt, Qnil);
- rb_ivar_set(exc, id_name, method);
- rb_ivar_set(exc, id_receiver, recv);
- return exc;
-}
-
/* :nodoc: */
static VALUE
name_err_mesg_equal(VALUE obj1, VALUE obj2)
@@ -1300,25 +1088,23 @@ name_err_mesg_to_str(VALUE obj)
VALUE *ptr, mesg;
TypedData_Get_Struct(obj, VALUE, &name_err_mesg_data_type, ptr);
- mesg = ptr[NAME_ERR_MESG__MESG];
+ mesg = ptr[0];
if (NIL_P(mesg)) return Qnil;
else {
- struct RString s_str, d_str;
- VALUE c, s, d = 0, args[4];
- int state = 0, singleton = 0;
- rb_encoding *usascii = rb_usascii_encoding();
+ const char *desc = 0;
+ VALUE d = 0, args[NAME_ERR_MESG_COUNT];
+ int state = 0;
-#define FAKE_CSTR(v, str) rb_setup_fake_str((v), (str), rb_strlen_lit(str), usascii)
- obj = ptr[NAME_ERR_MESG__RECV];
+ obj = ptr[1];
switch (obj) {
case Qnil:
- d = FAKE_CSTR(&d_str, "nil");
+ desc = "nil";
break;
case Qtrue:
- d = FAKE_CSTR(&d_str, "true");
+ desc = "true";
break;
case Qfalse:
- d = FAKE_CSTR(&d_str, "false");
+ desc = "false";
break;
default:
d = rb_protect(rb_inspect, obj, &state);
@@ -1327,22 +1113,18 @@ name_err_mesg_to_str(VALUE obj)
if (NIL_P(d) || RSTRING_LEN(d) > 65) {
d = rb_any_to_s(obj);
}
- singleton = (RSTRING_LEN(d) > 0 && RSTRING_PTR(d)[0] == '#');
- d = QUOTE(d);
+ desc = RSTRING_PTR(d);
break;
}
- if (!singleton) {
- s = FAKE_CSTR(&s_str, ":");
- c = rb_class_name(CLASS_OF(obj));
- }
- else {
- c = s = FAKE_CSTR(&s_str, "");
+ if (desc && desc[0] != '#') {
+ d = d ? rb_str_dup(d) : rb_str_new2(desc);
+ rb_str_cat2(d, ":");
+ rb_str_append(d, rb_class_name(CLASS_OF(obj)));
}
- args[0] = QUOTE(rb_obj_as_string(ptr[NAME_ERR_MESG__NAME]));
- args[1] = d;
- args[2] = s;
- args[3] = c;
- mesg = rb_str_format(4, args, mesg);
+ args[0] = mesg;
+ args[1] = ptr[2];
+ args[2] = d;
+ mesg = rb_f_sprintf(NAME_ERR_MESG_COUNT, args);
}
return mesg;
}
@@ -1363,29 +1145,6 @@ name_err_mesg_load(VALUE klass, VALUE str)
/*
* call-seq:
- * name_error.receiver -> object
- *
- * Return the receiver associated with this NameError exception.
- */
-
-static VALUE
-name_err_receiver(VALUE self)
-{
- VALUE *ptr, recv, mesg;
-
- recv = rb_ivar_lookup(self, id_receiver, Qundef);
- if (recv != Qundef) return recv;
-
- mesg = rb_attr_get(self, id_mesg);
- if (!rb_typeddata_is_kind_of(mesg, &name_err_mesg_data_type)) {
- rb_raise(rb_eArgError, "no receiver is available");
- }
- ptr = DATA_PTR(mesg);
- return ptr[NAME_ERR_MESG__RECV];
-}
-
-/*
- * call-seq:
* no_method_error.args -> obj
*
* Return the arguments passed in as the third parameter to
@@ -1395,7 +1154,7 @@ name_err_receiver(VALUE self)
static VALUE
nometh_err_args(VALUE self)
{
- return rb_attr_get(self, id_args);
+ return rb_attr_get(self, rb_intern("args"));
}
void
@@ -1449,19 +1208,19 @@ set_syserr(int n, const char *name)
/* capture nonblock errnos for WaitReadable/WaitWritable subclasses */
switch (n) {
- case EAGAIN:
- rb_eEAGAIN = error;
+ case EAGAIN:
+ rb_eEAGAIN = error;
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
- break;
- case EWOULDBLOCK:
+#if EAGAIN != EWOULDBLOCK
+ break;
+ case EWOULDBLOCK:
#endif
- rb_eEWOULDBLOCK = error;
- break;
- case EINPROGRESS:
- rb_eEINPROGRESS = error;
- break;
+ rb_eEWOULDBLOCK = error;
+ break;
+ case EINPROGRESS:
+ rb_eEINPROGRESS = error;
+ break;
}
rb_define_const(error, "Errno", INT2NUM(n));
@@ -1505,7 +1264,7 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
char *strerror();
#endif
const char *err;
- VALUE mesg, error, func, errmsg;
+ VALUE mesg, error, func;
VALUE klass = rb_obj_class(self);
if (klass == rb_eSystemCallError) {
@@ -1525,23 +1284,31 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
}
else {
rb_scan_args(argc, argv, "02", &mesg, &func);
- error = rb_const_get(klass, id_Errno);
+ error = rb_const_get(klass, rb_intern("Errno"));
}
if (!NIL_P(error)) err = strerror(NUM2INT(error));
else err = "unknown error";
-
- errmsg = rb_enc_str_new_cstr(err, rb_locale_encoding());
if (!NIL_P(mesg)) {
+ rb_encoding *le = rb_locale_encoding();
VALUE str = StringValue(mesg);
-
- if (!NIL_P(func)) rb_str_catf(errmsg, " @ %"PRIsVALUE, func);
- rb_str_catf(errmsg, " - %"PRIsVALUE, str);
- OBJ_INFECT(errmsg, mesg);
+ rb_encoding *me = rb_enc_get(mesg);
+
+ if (NIL_P(func))
+ mesg = rb_sprintf("%s - %"PRIsVALUE, err, mesg);
+ else
+ mesg = rb_sprintf("%s @ %"PRIsVALUE" - %"PRIsVALUE, err, func, mesg);
+ if (le != me && rb_enc_asciicompat(me)) {
+ le = me;
+ }/* else assume err is non ASCII string. */
+ OBJ_INFECT(mesg, str);
+ rb_enc_associate(mesg, le);
+ }
+ else {
+ mesg = rb_str_new2(err);
+ rb_enc_associate(mesg, rb_locale_encoding());
}
- mesg = errmsg;
-
rb_call_super(1, &mesg);
- rb_ivar_set(self, id_errno, error);
+ rb_iv_set(self, "errno", error);
return self;
}
@@ -1555,7 +1322,7 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
static VALUE
syserr_errno(VALUE self)
{
- return rb_attr_get(self, id_errno);
+ return rb_attr_get(self, rb_intern("errno"));
}
/*
@@ -1570,17 +1337,20 @@ static VALUE
syserr_eqq(VALUE self, VALUE exc)
{
VALUE num, e;
+ ID en;
+
+ CONST_ID(en, "errno");
if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
- if (!rb_respond_to(exc, id_errno)) return Qfalse;
+ if (!rb_respond_to(exc, en)) return Qfalse;
}
else if (self == rb_eSystemCallError) return Qtrue;
- num = rb_attr_get(exc, id_errno);
+ num = rb_attr_get(exc, rb_intern("errno"));
if (NIL_P(num)) {
- num = rb_funcallv(exc, id_errno, 0, 0);
+ num = rb_funcall(exc, en, 0, 0);
}
- e = rb_const_get(self, id_Errno);
+ e = rb_const_get(self, rb_intern("Errno"));
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
return Qtrue;
return Qfalse;
@@ -1680,7 +1450,7 @@ syserr_eqq(VALUE self, VALUE exc)
*
* <em>raises the exception:</em>
*
- * ArgumentError: wrong number of arguments (given 2, expected 1)
+ * ArgumentError: wrong number of arguments (2 for 1)
*
* Ex: passing an argument that is not acceptable:
*
@@ -1817,7 +1587,7 @@ syserr_eqq(VALUE self, VALUE exc)
*
* <em>raises the exception:</em>
*
- * RuntimeError: can't modify frozen Array
+ * RuntimeError: can't modify frozen array
*
* Kernel.raise will raise a RuntimeError if no Exception class is
* specified.
@@ -1941,19 +1711,14 @@ syserr_eqq(VALUE self, VALUE exc)
* * LoadError
* * NotImplementedError
* * SyntaxError
- * * SecurityError
* * SignalException
* * Interrupt
* * StandardError -- default for +rescue+
* * ArgumentError
- * * UncaughtThrowError
- * * EncodingError
- * * FiberError
- * * IOError
- * * EOFError
* * IndexError
- * * KeyError
* * StopIteration
+ * * IOError
+ * * EOFError
* * LocalJumpError
* * NameError
* * NoMethodError
@@ -1961,13 +1726,14 @@ syserr_eqq(VALUE self, VALUE exc)
* * FloatDomainError
* * RegexpError
* * RuntimeError -- default for +raise+
+ * * SecurityError
* * SystemCallError
* * Errno::*
+ * * SystemStackError
* * ThreadError
* * TypeError
* * ZeroDivisionError
* * SystemExit
- * * SystemStackError
* * fatal -- impossible to rescue
*/
@@ -1983,7 +1749,6 @@ Init_Exception(void)
rb_define_method(rb_eException, "message", exc_message, 0);
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
- rb_define_method(rb_eException, "backtrace_locations", exc_backtrace_locations, 0);
rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1);
rb_define_method(rb_eException, "cause", exc_cause, 0);
@@ -2008,16 +1773,15 @@ Init_Exception(void)
rb_eLoadError = rb_define_class("LoadError", rb_eScriptError);
/* the path failed to load */
- rb_attr(rb_eLoadError, rb_intern_const("path"), 1, 0, Qfalse);
+ rb_attr(rb_eLoadError, rb_intern("path"), 1, 0, Qfalse);
rb_eNotImpError = rb_define_class("NotImplementedError", rb_eScriptError);
rb_eNameError = rb_define_class("NameError", rb_eStandardError);
rb_define_method(rb_eNameError, "initialize", name_err_initialize, -1);
rb_define_method(rb_eNameError, "name", name_err_name, 0);
- rb_define_method(rb_eNameError, "receiver", name_err_receiver, 0);
- rb_define_method(rb_eNameError, "local_variables", name_err_local_variables, 0);
rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cData);
+ rb_define_singleton_method(rb_cNameErrorMesg, "!", rb_name_err_mesg_new, NAME_ERR_MESG_COUNT);
rb_define_method(rb_cNameErrorMesg, "==", name_err_mesg_equal, 1);
rb_define_method(rb_cNameErrorMesg, "to_str", name_err_mesg_to_str, 0);
rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_dump, 1);
@@ -2041,19 +1805,6 @@ Init_Exception(void)
rb_mErrno = rb_define_module("Errno");
rb_define_global_function("warn", rb_warn_m, -1);
-
- id_new = rb_intern_const("new");
- id_cause = rb_intern_const("cause");
- id_message = rb_intern_const("message");
- id_backtrace = rb_intern_const("backtrace");
- id_name = rb_intern_const("name");
- id_args = rb_intern_const("args");
- id_receiver = rb_intern_const("receiver");
- id_local_variables = rb_intern_const("local_variables");
- id_Errno = rb_intern_const("Errno");
- id_errno = rb_intern_const("errno");
- id_i_path = rb_intern_const("@path");
- id_iseq = rb_make_internal_id();
}
void
@@ -2087,7 +1838,7 @@ static void
raise_loaderror(VALUE path, VALUE mesg)
{
VALUE err = rb_exc_new3(rb_eLoadError, mesg);
- rb_ivar_set(err, id_i_path, path);
+ rb_ivar_set(err, rb_intern("@path"), path);
rb_exc_raise(err);
}
@@ -2119,8 +1870,8 @@ void
rb_notimplement(void)
{
rb_raise(rb_eNotImpError,
- "%"PRIsVALUE"() function is unimplemented on this machine",
- rb_id2str(rb_frame_this_func()));
+ "%s() function is unimplemented on this machine",
+ rb_id2name(rb_frame_this_func()));
}
void
@@ -2263,7 +2014,7 @@ rb_mod_syserr_fail_str(VALUE mod, int e, VALUE mesg)
void
rb_sys_warning(const char *fmt, ...)
{
- VALUE mesg;
+ char buf[BUFSIZ];
va_list args;
int errno_save;
@@ -2271,32 +2022,12 @@ rb_sys_warning(const char *fmt, ...)
if (!RTEST(ruby_verbose)) return;
- va_start(args, fmt);
- mesg = warning_string(0, fmt, args);
- va_end(args);
- rb_str_set_len(mesg, RSTRING_LEN(mesg)-1);
- rb_str_catf(mesg, ": %s\n", strerror(errno_save));
- rb_write_error_str(mesg);
- errno = errno_save;
-}
-
-void
-rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...)
-{
- VALUE mesg;
- va_list args;
- int errno_save;
-
- errno_save = errno;
-
- if (!RTEST(ruby_verbose)) return;
+ snprintf(buf, BUFSIZ, "warning: %s", fmt);
+ snprintf(buf+strlen(buf), BUFSIZ-strlen(buf), ": %s", strerror(errno_save));
va_start(args, fmt);
- mesg = warning_string(enc, fmt, args);
+ warn_print(buf, args);
va_end(args);
- rb_str_set_len(mesg, RSTRING_LEN(mesg)-1);
- rb_str_catf(mesg, ": %s\n", strerror(errno_save));
- rb_write_error_str(mesg);
errno = errno_save;
}
@@ -2315,25 +2046,6 @@ rb_error_frozen(const char *what)
rb_raise(rb_eRuntimeError, "can't modify frozen %s", what);
}
-void
-rb_error_frozen_object(VALUE frozen_obj)
-{
- VALUE debug_info;
- const ID created_info = id_debug_created_info;
-
- if (!NIL_P(debug_info = rb_attr_get(frozen_obj, created_info))) {
- VALUE path = rb_ary_entry(debug_info, 0);
- VALUE line = rb_ary_entry(debug_info, 1);
-
- rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
- CLASS_OF(frozen_obj), path, line);
- }
- else {
- rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE,
- CLASS_OF(frozen_obj));
- }
-}
-
#undef rb_check_frozen
void
rb_check_frozen(VALUE obj)
diff --git a/eval.c b/eval.c
index 53609d1f7b..15b0db2ce8 100644
--- a/eval.c
+++ b/eval.c
@@ -11,24 +11,22 @@
**********************************************************************/
-#include "internal.h"
#include "eval_intern.h"
#include "iseq.h"
#include "gc.h"
#include "ruby/vm.h"
+#include "ruby/encoding.h"
+#include "internal.h"
#include "vm_core.h"
#include "probes_helper.h"
-NORETURN(void rb_raise_jump(VALUE, VALUE));
+NORETURN(void rb_raise_jump(VALUE));
+
+NODE *rb_vm_get_cref(const rb_iseq_t *, const VALUE *);
VALUE rb_eLocalJumpError;
VALUE rb_eSysStackError;
-ID ruby_static_id_signo, ruby_static_id_status;
-static ID id_cause;
-#define id_signo ruby_static_id_signo
-#define id_status ruby_static_id_status
-
#define exception_error GET_VM()->special_exceptions[ruby_error_reenter]
#include "eval_error.c"
@@ -45,15 +43,16 @@ static ID id_cause;
int
ruby_setup(void)
{
+ static int initialized = 0;
int state;
- if (GET_VM())
+ if (initialized)
return 0;
+ initialized = 1;
ruby_init_stack((void *)&state);
Init_BareVM();
Init_heap();
- Init_vm_objects();
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
@@ -75,8 +74,7 @@ ruby_init(void)
{
int state = ruby_setup();
if (state) {
- if (RTEST(ruby_debug))
- error_print();
+ error_print();
exit(EXIT_FAILURE);
}
}
@@ -84,7 +82,7 @@ ruby_init(void)
/*! Processes command line arguments and compiles the Ruby source to execute.
*
* This function does:
- * \li Processes the given command line flags and arguments for ruby(1)
+ * \li Processes the given command line flags and arguments for ruby(1)
* \li compiles the source code from the given argument, -e or stdin, and
* \li returns the compiled source as an opaque pointer to an internal data structure
*
@@ -162,31 +160,30 @@ ruby_cleanup(volatile int ex)
volatile VALUE errs[2];
rb_thread_t *th = GET_THREAD();
int nerr;
- volatile int sysex = EXIT_SUCCESS;
rb_threadptr_interrupt(th);
rb_threadptr_check_signal(th);
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, { RUBY_VM_CHECK_INTS(th); });
}
- TH_POP_TAG();
+ POP_TAG();
errs[1] = th->errinfo;
th->safe_level = 0;
ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]);
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, ruby_finalize_0());
}
- TH_POP_TAG();
+ POP_TAG();
/* protect from Thread#raise */
th->status = THREAD_KILLED;
errs[0] = th->errinfo;
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, rb_thread_terminate_all());
}
@@ -194,60 +191,70 @@ ruby_cleanup(volatile int ex)
ex = state;
}
th->errinfo = errs[1];
- sysex = error_handle(ex);
+ ex = error_handle(ex);
+ ruby_finalize_1();
+
+ /* unlock again if finalizer took mutexes. */
+ rb_threadptr_unlock_all_locking_mutexes(GET_THREAD());
+ POP_TAG();
+ rb_thread_stop_timer_thread(1);
+
+#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
+ switch (ex) {
+#if EXIT_SUCCESS != 0
+ case 0: ex = EXIT_SUCCESS; break;
+#endif
+#if EXIT_FAILURE != 1
+ case 1: ex = EXIT_FAILURE; break;
+#endif
+ }
+#endif
state = 0;
for (nerr = 0; nerr < numberof(errs); ++nerr) {
- VALUE err = ATOMIC_VALUE_EXCHANGE(errs[nerr], Qnil);
+ VALUE err = errs[nerr];
if (!RTEST(err)) continue;
/* th->errinfo contains a NODE while break'ing */
- if (THROW_DATA_P(err)) continue;
+ if (RB_TYPE_P(err, T_NODE)) continue;
if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
- sysex = sysexit_status(err);
+ ex = sysexit_status(err);
break;
}
else if (rb_obj_is_kind_of(err, rb_eSignal)) {
- VALUE sig = rb_ivar_get(err, id_signo);
+ VALUE sig = rb_iv_get(err, "signo");
state = NUM2INT(sig);
break;
}
- else if (sysex == EXIT_SUCCESS) {
- sysex = EXIT_FAILURE;
+ else if (ex == EXIT_SUCCESS) {
+ ex = EXIT_FAILURE;
}
}
-
- ruby_finalize_1();
-
- /* unlock again if finalizer took mutexes. */
- rb_threadptr_unlock_all_locking_mutexes(GET_THREAD());
- TH_POP_TAG();
- rb_thread_stop_timer_thread();
ruby_vm_destruct(GET_VM());
if (state) ruby_default_signal(state);
- return sysex;
+ return ex;
}
static int
ruby_exec_internal(void *n)
{
volatile int state;
- rb_iseq_t *iseq = (rb_iseq_t *)n;
+ VALUE iseq = (VALUE)n;
rb_thread_t *th = GET_THREAD();
if (!n) return 0;
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, {
th->base_block = 0;
rb_iseq_eval_main(iseq);
});
}
- TH_POP_TAG();
+ POP_TAG();
return state;
}
@@ -329,15 +336,15 @@ static VALUE
rb_mod_nesting(void)
{
VALUE ary = rb_ary_new();
- const rb_cref_t *cref = rb_vm_cref();
+ const NODE *cref = rb_vm_cref();
- while (cref && CREF_NEXT(cref)) {
- VALUE klass = CREF_CLASS(cref);
- if (!CREF_PUSHED_BY_EVAL(cref) &&
+ while (cref && cref->nd_next) {
+ VALUE klass = cref->nd_clss;
+ if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
!NIL_P(klass)) {
rb_ary_push(ary, klass);
}
- cref = CREF_NEXT(cref);
+ cref = cref->nd_next;
}
return ary;
}
@@ -367,25 +374,25 @@ rb_mod_nesting(void)
static VALUE
rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
{
- const rb_cref_t *cref = rb_vm_cref();
+ const NODE *cref = rb_vm_cref();
VALUE klass;
VALUE cbase = 0;
void *data = 0;
- if (argc > 0 || mod != rb_cModule) {
- return rb_mod_constants(argc, argv, mod);
+ if (argc > 0) {
+ return rb_mod_constants(argc, argv, rb_cModule);
}
while (cref) {
- klass = CREF_CLASS(cref);
- if (!CREF_PUSHED_BY_EVAL(cref) &&
+ klass = cref->nd_clss;
+ if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
!NIL_P(klass)) {
- data = rb_mod_const_at(CREF_CLASS(cref), data);
+ data = rb_mod_const_at(cref->nd_clss, data);
if (!cbase) {
cbase = klass;
}
}
- cref = CREF_NEXT(cref);
+ cref = cref->nd_next;
}
if (cbase) {
@@ -404,21 +411,8 @@ rb_frozen_class_p(VALUE klass)
if (OBJ_FROZEN(klass)) {
const char *desc;
- if (FL_TEST(klass, FL_SINGLETON)) {
+ if (FL_TEST(klass, FL_SINGLETON))
desc = "object";
- klass = rb_ivar_get(klass, id__attached__);
- if (!SPECIAL_CONST_P(klass)) {
- switch (BUILTIN_TYPE(klass)) {
- case T_MODULE:
- case T_ICLASS:
- desc = "Module";
- break;
- case T_CLASS:
- desc = "Class";
- break;
- }
- }
- }
else {
switch (BUILTIN_TYPE(klass)) {
case T_MODULE:
@@ -436,13 +430,16 @@ rb_frozen_class_p(VALUE klass)
}
}
-NORETURN(static void rb_longjmp(int, volatile VALUE, VALUE));
+NORETURN(static void rb_longjmp(int, volatile VALUE));
static VALUE get_errinfo(void);
static VALUE get_thread_errinfo(rb_thread_t *th);
static VALUE
exc_setup_cause(VALUE exc, VALUE cause)
{
+ ID id_cause;
+ CONST_ID(id_cause, "cause");
+
#if SUPPORT_JOKE
if (NIL_P(cause)) {
ID id_true_cause;
@@ -458,92 +455,47 @@ exc_setup_cause(VALUE exc, VALUE cause)
}
#endif
if (!NIL_P(cause) && cause != exc) {
- if (OBJ_FROZEN(exc))
- exc = rb_obj_dup(exc);
rb_ivar_set(exc, id_cause, cause);
}
return exc;
}
-static inline int
-sysstack_error_p(VALUE exc)
-{
- return exc == sysstack_error || (!SPECIAL_CONST_P(exc) && RBASIC_CLASS(exc) == rb_eSysStackError);
-}
-
-static inline int
-special_exception_p(rb_thread_t *th, VALUE exc)
-{
- enum ruby_special_exceptions i;
- const VALUE *exceptions = th->vm->special_exceptions;
- for (i = 0; i < ruby_special_error_count; ++i) {
- if (exceptions[i] == exc) return TRUE;
- }
- return FALSE;
-}
-
static void
-setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
+setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
{
+ VALUE at;
VALUE e;
- const char *file = 0;
- int line;
- int nocause = 0;
+ const char *file;
+ volatile int line = 0;
if (NIL_P(mesg)) {
mesg = th->errinfo;
if (INTERNAL_EXCEPTION_P(mesg)) JUMP_TAG(TAG_FATAL);
- nocause = 1;
}
if (NIL_P(mesg)) {
mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
- nocause = 0;
- }
- else if (special_exception_p(th, mesg)) {
- mesg = ruby_vm_special_exception_copy(mesg);
- }
- if (cause != Qundef) {
- mesg = exc_setup_cause(mesg, cause);
- }
- else if (nocause) {
- mesg = exc_setup_cause(mesg, Qnil);
- }
- else if (!rb_ivar_defined(mesg, id_cause)) {
- mesg = exc_setup_cause(mesg, get_thread_errinfo(th));
}
+ exc_setup_cause(mesg, get_thread_errinfo(th));
- file = rb_source_loc(&line);
+ file = rb_sourcefile();
+ if (file) line = rb_sourceline();
if (file && !NIL_P(mesg)) {
- VALUE at;
- if (sysstack_error_p(mesg)) {
- if (NIL_P(rb_attr_get(mesg, idBt))) {
- at = rb_vm_backtrace_object();
- rb_ivar_set(mesg, idBt, at);
- rb_ivar_set(mesg, idBt_locations, at);
- }
+ if (mesg == sysstack_error) {
+ at = rb_enc_sprintf(rb_usascii_encoding(), "%s:%d", file, line);
+ at = rb_ary_new3(1, at);
+ rb_iv_set(mesg, "bt", at);
}
else {
- int status;
-
- TH_PUSH_TAG(th);
- if ((status = EXEC_TAG()) == 0) {
- VALUE bt;
- if (rb_threadptr_set_raised(th)) goto fatal;
- bt = rb_get_backtrace(mesg);
- if (NIL_P(bt)) {
- at = rb_vm_backtrace_object();
- if (OBJ_FROZEN(mesg)) {
- mesg = rb_obj_dup(mesg);
- }
- rb_ivar_set(mesg, idBt_locations, at);
- set_backtrace(mesg, at);
+ at = get_backtrace(mesg);
+ if (NIL_P(at)) {
+ at = rb_vm_backtrace_object();
+ if (OBJ_FROZEN(mesg)) {
+ mesg = rb_obj_dup(mesg);
}
- rb_threadptr_reset_raised(th);
+ set_backtrace(mesg, at);
}
- TH_POP_TAG();
}
}
-
if (!NIL_P(mesg)) {
th->errinfo = mesg;
}
@@ -552,26 +504,23 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
int status;
- mesg = e;
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
- th->errinfo = Qnil;
- e = rb_obj_as_string(mesg);
- th->errinfo = mesg;
+ RB_GC_GUARD(e) = rb_obj_as_string(e);
if (file && line) {
- warn_printf("Exception `%"PRIsVALUE"' at %s:%d - %"PRIsVALUE"\n",
- rb_obj_class(mesg), file, line, e);
+ warn_printf("Exception `%s' at %s:%d - %"PRIsVALUE"\n",
+ rb_obj_classname(th->errinfo), file, line, e);
}
else if (file) {
- warn_printf("Exception `%"PRIsVALUE"' at %s - %"PRIsVALUE"\n",
- rb_obj_class(mesg), file, e);
+ warn_printf("Exception `%s' at %s - %"PRIsVALUE"\n",
+ rb_obj_classname(th->errinfo), file, e);
}
else {
- warn_printf("Exception `%"PRIsVALUE"' - %"PRIsVALUE"\n",
- rb_obj_class(mesg), e);
+ warn_printf("Exception `%s' - %"PRIsVALUE"\n",
+ rb_obj_classname(th->errinfo), e);
}
}
- TH_POP_TAG();
+ POP_TAG();
if (status == TAG_FATAL && th->errinfo == exception_error) {
th->errinfo = mesg;
}
@@ -582,39 +531,31 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
}
if (rb_threadptr_set_raised(th)) {
- fatal:
th->errinfo = exception_error;
rb_threadptr_reset_raised(th);
JUMP_TAG(TAG_FATAL);
}
if (tag != TAG_FATAL) {
- RUBY_DTRACE_HOOK(RAISE, rb_obj_classname(th->errinfo));
+ if (RUBY_DTRACE_RAISE_ENABLED()) {
+ RUBY_DTRACE_RAISE(rb_obj_classname(th->errinfo),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0, mesg);
}
}
-void
-rb_threadptr_setup_exception(rb_thread_t *th, VALUE mesg, VALUE cause)
-{
- if (cause == Qundef) {
- cause = get_thread_errinfo(th);
- }
- if (cause != mesg) {
- rb_ivar_set(mesg, id_cause, cause);
- }
-}
-
static void
-rb_longjmp(int tag, volatile VALUE mesg, VALUE cause)
+rb_longjmp(int tag, volatile VALUE mesg)
{
rb_thread_t *th = GET_THREAD();
- setup_exception(th, tag, mesg, cause);
+ setup_exception(th, tag, mesg);
rb_thread_raised_clear(th);
JUMP_TAG(tag);
}
-static VALUE make_exception(int argc, const VALUE *argv, int isstr);
+static VALUE make_exception(int argc, VALUE *argv, int isstr);
void
rb_exc_raise(VALUE mesg)
@@ -622,7 +563,7 @@ rb_exc_raise(VALUE mesg)
if (!NIL_P(mesg)) {
mesg = make_exception(1, &mesg, FALSE);
}
- rb_longjmp(TAG_RAISE, mesg, Qundef);
+ rb_longjmp(TAG_RAISE, mesg);
}
void
@@ -631,7 +572,7 @@ rb_exc_fatal(VALUE mesg)
if (!NIL_P(mesg)) {
mesg = make_exception(1, &mesg, FALSE);
}
- rb_longjmp(TAG_FATAL, mesg, Qnil);
+ rb_longjmp(TAG_FATAL, mesg);
}
void
@@ -640,30 +581,6 @@ rb_interrupt(void)
rb_raise(rb_eInterrupt, "%s", "");
}
-enum {raise_opt_cause, raise_max_opt};
-
-static int
-extract_raise_opts(int argc, VALUE *argv, VALUE *opts)
-{
- int i;
- if (argc > 0) {
- VALUE opt = argv[argc-1];
- if (RB_TYPE_P(opt, T_HASH)) {
- if (!RHASH_EMPTY_P(opt)) {
- ID keywords[1];
- CONST_ID(keywords[0], "cause");
- rb_get_kwargs(opt, keywords, 0, -1-raise_max_opt, opts);
- if (RHASH_EMPTY_P(opt)) --argc;
- return argc;
- }
- }
- }
- for (i = 0; i < raise_max_opt; ++i) {
- opts[i] = Qundef;
- }
- return argc;
-}
-
/*
* call-seq:
* raise
@@ -692,28 +609,23 @@ static VALUE
rb_f_raise(int argc, VALUE *argv)
{
VALUE err;
- VALUE opts[raise_max_opt], *const cause = &opts[raise_opt_cause];
-
- argc = extract_raise_opts(argc, argv, opts);
if (argc == 0) {
- if (*cause != Qundef) {
- rb_raise(rb_eArgError, "only cause is given with no arguments");
- }
err = get_errinfo();
if (!NIL_P(err)) {
argc = 1;
argv = &err;
}
}
- rb_raise_jump(rb_make_exception(argc, argv), *cause);
+ rb_raise_jump(rb_make_exception(argc, argv));
UNREACHABLE;
}
static VALUE
-make_exception(int argc, const VALUE *argv, int isstr)
+make_exception(int argc, VALUE *argv, int isstr)
{
VALUE mesg, exc;
+ ID exception;
int n;
mesg = Qnil;
@@ -739,8 +651,9 @@ make_exception(int argc, const VALUE *argv, int isstr)
exc = argv[0];
n = 1;
exception_call:
- if (sysstack_error_p(exc)) return exc;
- mesg = rb_check_funcall(exc, idException, n, argv+1);
+ if (exc == sysstack_error) return exc;
+ CONST_ID(exception, "exception");
+ mesg = rb_check_funcall(exc, exception, n, argv+1);
if (mesg == Qundef) {
rb_raise(rb_eTypeError, "exception class/object expected");
}
@@ -760,26 +673,25 @@ make_exception(int argc, const VALUE *argv, int isstr)
}
VALUE
-rb_make_exception(int argc, const VALUE *argv)
+rb_make_exception(int argc, VALUE *argv)
{
return make_exception(argc, argv, TRUE);
}
void
-rb_raise_jump(VALUE mesg, VALUE cause)
+rb_raise_jump(VALUE mesg)
{
rb_thread_t *th = GET_THREAD();
- const rb_control_frame_t *cfp = th->cfp;
- const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
- VALUE klass = me->owner;
+ rb_control_frame_t *cfp = th->cfp;
+ VALUE klass = cfp->me->klass;
VALUE self = cfp->self;
- ID mid = me->called_id;
+ ID mid = cfp->me->called_id;
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
- EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, me->def->original_id, klass, Qnil);
- setup_exception(th, TAG_RAISE, mesg, cause);
+ setup_exception(th, TAG_RAISE, mesg);
+ EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
rb_thread_raised_clear(th);
JUMP_TAG(TAG_RAISE);
}
@@ -787,9 +699,6 @@ rb_raise_jump(VALUE mesg, VALUE cause)
void
rb_jump_tag(int tag)
{
- if (UNLIKELY(tag < TAG_RETURN || tag > TAG_FATAL)) {
- unknown_longjmp_status(tag);
- }
JUMP_TAG(tag);
}
@@ -828,8 +737,8 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
{
int state;
rb_thread_t *th = GET_THREAD();
- rb_control_frame_t *volatile cfp = th->cfp;
- volatile VALUE result = Qfalse;
+ rb_control_frame_t *cfp = th->cfp;
+ volatile VALUE result;
volatile VALUE e_info = th->errinfo;
va_list args;
@@ -838,17 +747,8 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
retry_entry:
result = (*b_proc) (data1);
}
- else if (result) {
- /* escape from r_proc */
- if (state == TAG_RETRY) {
- state = 0;
- th->errinfo = Qnil;
- result = Qfalse;
- goto retry_entry;
- }
- }
else {
- rb_vm_rewind_cfp(th, cfp);
+ th->cfp = cfp; /* restore */
if (state == TAG_RAISE) {
int handle = FALSE;
@@ -864,12 +764,25 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
va_end(args);
if (handle) {
- result = Qnil;
- state = 0;
if (r_proc) {
- result = (*r_proc) (data2, th->errinfo);
+ PUSH_TAG();
+ if ((state = EXEC_TAG()) == 0) {
+ result = (*r_proc) (data2, th->errinfo);
+ }
+ POP_TAG();
+ if (state == TAG_RETRY) {
+ state = 0;
+ th->errinfo = Qnil;
+ goto retry_entry;
+ }
+ }
+ else {
+ result = Qnil;
+ state = 0;
+ }
+ if (state == 0) {
+ th->errinfo = e_info;
}
- th->errinfo = e_info;
}
}
}
@@ -894,7 +807,7 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
volatile VALUE result = Qnil;
volatile int status;
rb_thread_t *th = GET_THREAD();
- rb_control_frame_t *volatile cfp = th->cfp;
+ rb_control_frame_t *cfp = th->cfp;
struct rb_vm_protect_tag protect_tag;
rb_jmpbuf_t org_jmpbuf;
@@ -907,7 +820,7 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
SAVE_ROOT_JMPBUF(th, result = (*proc) (data));
}
else {
- rb_vm_rewind_cfp(th, cfp);
+ th->cfp = cfp;
}
MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1);
th->protect_tag = protect_tag.prev;
@@ -933,11 +846,13 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
ensure_list.entry.data2 = data2;
ensure_list.next = th->ensure_list;
th->ensure_list = &ensure_list;
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*b_proc) (data1);
}
- TH_POP_TAG();
+ POP_TAG();
+ /* TODO: fix me */
+ /* retval = prot_tag ? prot_tag->retval : Qnil; */ /* save retval */
errinfo = th->errinfo;
th->ensure_list=ensure_list.next;
(*ensure_list.entry.e_proc)(ensure_list.entry.data2);
@@ -947,30 +862,79 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
return result;
}
+static const rb_method_entry_t *
+method_entry_of_iseq(rb_control_frame_t *cfp, rb_iseq_t *iseq)
+{
+ rb_thread_t *th = GET_THREAD();
+ rb_control_frame_t *cfp_limit;
+
+ cfp_limit = (rb_control_frame_t *)(th->stack + th->stack_size);
+ while (cfp_limit > cfp) {
+ if (cfp->iseq == iseq)
+ return cfp->me;
+ cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
+ }
+ return 0;
+}
+
static ID
frame_func_id(rb_control_frame_t *cfp)
{
- const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
-
- if (me) {
- return me->def->original_id;
+ const rb_method_entry_t *me_local;
+ rb_iseq_t *iseq = cfp->iseq;
+ if (cfp->me) {
+ return cfp->me->def->original_id;
}
- else {
- return 0;
+ while (iseq) {
+ if (RUBY_VM_IFUNC_P(iseq)) {
+ NODE *ifunc = (NODE *)iseq;
+ if (ifunc->nd_aid) return ifunc->nd_aid;
+ return idIFUNC;
+ }
+ me_local = method_entry_of_iseq(cfp, iseq);
+ if (me_local) {
+ cfp->me = me_local;
+ return me_local->def->original_id;
+ }
+ if (iseq->defined_method_id) {
+ return iseq->defined_method_id;
+ }
+ if (iseq->local_iseq == iseq) {
+ break;
+ }
+ iseq = iseq->parent_iseq;
}
+ return 0;
}
static ID
frame_called_id(rb_control_frame_t *cfp)
{
- const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
-
- if (me) {
- return me->called_id;
+ const rb_method_entry_t *me_local;
+ rb_iseq_t *iseq = cfp->iseq;
+ if (cfp->me) {
+ return cfp->me->called_id;
}
- else {
- return 0;
+ while (iseq) {
+ if (RUBY_VM_IFUNC_P(iseq)) {
+ NODE *ifunc = (NODE *)iseq;
+ if (ifunc->nd_aid) return ifunc->nd_aid;
+ return idIFUNC;
+ }
+ me_local = method_entry_of_iseq(cfp, iseq);
+ if (me_local) {
+ cfp->me = me_local;
+ return me_local->called_id;
+ }
+ if (iseq->defined_method_id) {
+ return iseq->defined_method_id;
+ }
+ if (iseq->local_iseq == iseq) {
+ break;
+ }
+ iseq = iseq->parent_iseq;
}
+ return 0;
}
ID
@@ -1012,17 +976,11 @@ prev_frame_func(void)
return frame_func_id(prev_cfp);
}
-ID
-rb_frame_last_func(void)
+void
+rb_frame_pop(void)
{
rb_thread_t *th = GET_THREAD();
- rb_control_frame_t *cfp = th->cfp;
- ID mid;
-
- while (!(mid = frame_func_id(cfp)) &&
- (cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp),
- !RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)));
- return mid;
+ th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
}
/*
@@ -1121,30 +1079,31 @@ rb_mod_prepend(int argc, VALUE *argv, VALUE module)
}
static VALUE
-hidden_identity_hash_new(void)
+hidden_identity_hash_new()
{
- VALUE hash = rb_ident_hash_new();
+ VALUE hash = rb_hash_new();
+ rb_funcall(hash, rb_intern("compare_by_identity"), 0);
RBASIC_CLEAR_CLASS(hash); /* hide from ObjectSpace */
return hash;
}
void
-rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
+rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
{
VALUE iclass, c, superclass = klass;
Check_Type(klass, T_CLASS);
Check_Type(module, T_MODULE);
- if (NIL_P(CREF_REFINEMENTS(cref))) {
- CREF_REFINEMENTS_SET(cref, hidden_identity_hash_new());
+ if (NIL_P(cref->nd_refinements)) {
+ cref->nd_refinements = hidden_identity_hash_new();
}
else {
- if (CREF_OMOD_SHARED(cref)) {
- CREF_REFINEMENTS_SET(cref, rb_hash_dup(CREF_REFINEMENTS(cref)));
- CREF_OMOD_SHARED_UNSET(cref);
+ if (cref->flags & NODE_FL_CREF_OMOD_SHARED) {
+ cref->nd_refinements = rb_hash_dup(cref->nd_refinements);
+ cref->flags &= ~NODE_FL_CREF_OMOD_SHARED;
}
- if (!NIL_P(c = rb_hash_lookup(CREF_REFINEMENTS(cref), klass))) {
+ if (!NIL_P(c = rb_hash_lookup(cref->nd_refinements, klass))) {
superclass = c;
while (c && RB_TYPE_P(c, T_ICLASS)) {
if (RBASIC(c)->klass == module) {
@@ -1159,8 +1118,7 @@ rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
c = iclass = rb_include_class_new(module, superclass);
RCLASS_REFINED_CLASS(c) = klass;
- RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) =
- RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: check unprotecting */
+ RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) = RCLASS_M_TBL(OBJ_WB_UNPROTECT(module));
module = RCLASS_SUPER(module);
while (module && module != klass) {
@@ -1169,20 +1127,20 @@ rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
RCLASS_REFINED_CLASS(c) = klass;
module = RCLASS_SUPER(module);
}
- rb_hash_aset(CREF_REFINEMENTS(cref), klass, iclass);
+ rb_hash_aset(cref->nd_refinements, klass, iclass);
}
static int
using_refinement(VALUE klass, VALUE module, VALUE arg)
{
- rb_cref_t *cref = (rb_cref_t *) arg;
+ NODE *cref = (NODE *) arg;
rb_using_refinement(cref, klass, module);
return ST_CONTINUE;
}
static void
-using_module_recursive(const rb_cref_t *cref, VALUE klass)
+using_module_recursive(NODE *cref, VALUE klass)
{
ID id_refinements;
VALUE super, module, refinements;
@@ -1192,15 +1150,15 @@ using_module_recursive(const rb_cref_t *cref, VALUE klass)
using_module_recursive(cref, super);
}
switch (BUILTIN_TYPE(klass)) {
- case T_MODULE:
+ case T_MODULE:
module = klass;
break;
- case T_ICLASS:
+ case T_ICLASS:
module = RBASIC(klass)->klass;
break;
- default:
+ default:
rb_raise(rb_eTypeError, "wrong argument type %s (expected Module)",
rb_obj_classname(klass));
break;
@@ -1212,11 +1170,10 @@ using_module_recursive(const rb_cref_t *cref, VALUE klass)
}
void
-rb_using_module(const rb_cref_t *cref, VALUE module)
+rb_using_module(NODE *cref, VALUE module)
{
Check_Type(module, T_MODULE);
using_module_recursive(cref, module);
- rb_clear_method_cache_by_class(rb_cObject);
}
VALUE
@@ -1248,7 +1205,7 @@ add_activated_refinement(VALUE activated_refinements,
c = iclass = rb_include_class_new(refinement, superclass);
RCLASS_REFINED_CLASS(c) = klass;
refinement = RCLASS_SUPER(refinement);
- while (refinement && refinement != klass) {
+ while (refinement) {
FL_SET(refinement, RMODULE_IS_OVERLAID);
c = RCLASS_SET_SUPER(c, rb_include_class_new(refinement, RCLASS_SUPER(c)));
RCLASS_REFINED_CLASS(c) = klass;
@@ -1257,6 +1214,8 @@ add_activated_refinement(VALUE activated_refinements,
rb_hash_aset(activated_refinements, klass, iclass);
}
+VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
+
/*
* call-seq:
* refine(klass) { block } -> module
@@ -1324,6 +1283,7 @@ rb_mod_refine(VALUE module, VALUE klass)
static VALUE
mod_using(VALUE self, VALUE module)
{
+ NODE *cref = rb_vm_cref();
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
if (prev_frame_func()) {
@@ -1333,12 +1293,14 @@ mod_using(VALUE self, VALUE module)
if (prev_cfp && prev_cfp->self != self) {
rb_raise(rb_eRuntimeError, "Module#using is not called on self");
}
- rb_using_module(rb_vm_cref_replace_with_duplicated_cref(), module);
+ Check_Type(module, T_MODULE);
+ rb_using_module(cref, module);
+ rb_clear_method_cache_by_class(rb_cObject);
return self;
}
void
-rb_obj_call_init(VALUE obj, int argc, const VALUE *argv)
+rb_obj_call_init(VALUE obj, int argc, VALUE *argv)
{
PASS_PASSED_BLOCK();
rb_funcall2(obj, idInitialize, argc, argv);
@@ -1460,13 +1422,16 @@ top_include(int argc, VALUE *argv, VALUE self)
static VALUE
top_using(VALUE self, VALUE module)
{
- const rb_cref_t *cref = rb_vm_cref();
+ NODE *cref = rb_vm_cref();
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
- if (CREF_NEXT(cref) || (prev_cfp && rb_vm_frame_method_entry(prev_cfp))) {
- rb_raise(rb_eRuntimeError, "main.using is permitted only at toplevel");
+ if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
+ rb_raise(rb_eRuntimeError,
+ "main.using is permitted only at toplevel");
}
- rb_using_module(rb_vm_cref_replace_with_duplicated_cref(), module);
+ Check_Type(module, T_MODULE);
+ rb_using_module(cref, module);
+ rb_clear_method_cache_by_class(rb_cObject);
return self;
}
@@ -1478,11 +1443,11 @@ errinfo_place(rb_thread_t *th)
while (RUBY_VM_VALID_CONTROL_FRAME_P(cfp, end_cfp)) {
if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
- if (cfp->iseq->body->type == ISEQ_TYPE_RESCUE) {
+ if (cfp->iseq->type == ISEQ_TYPE_RESCUE) {
return &cfp->ep[-2];
}
- else if (cfp->iseq->body->type == ISEQ_TYPE_ENSURE &&
- !THROW_DATA_P(cfp->ep[-2]) &&
+ else if (cfp->iseq->type == ISEQ_TYPE_ENSURE &&
+ !RB_TYPE_P(cfp->ep[-2], T_NODE) &&
!FIXNUM_P(cfp->ep[-2])) {
return &cfp->ep[-2];
}
@@ -1562,7 +1527,7 @@ errat_getter(ID id)
{
VALUE err = get_errinfo();
if (!NIL_P(err)) {
- return rb_get_backtrace(err);
+ return get_backtrace(err);
}
else {
return Qnil;
@@ -1688,9 +1653,8 @@ Init_eval(void)
rb_define_global_function("trace_var", rb_f_trace_var, -1); /* in variable.c */
rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */
- rb_vm_register_special_exception(ruby_error_reenter, rb_eFatal, "exception reentered");
-
- id_signo = rb_intern_const("signo");
- id_status = rb_intern_const("status");
- id_cause = rb_intern_const("cause");
+ exception_error = rb_exc_new3(rb_eFatal,
+ rb_obj_freeze(rb_str_new2("exception reentered")));
+ OBJ_TAINT(exception_error);
+ OBJ_FREEZE(exception_error);
}
diff --git a/eval_error.c b/eval_error.c
index 6708559f31..2ce661204c 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -22,24 +22,41 @@ warn_printf(const char *fmt, ...)
static void
error_pos(void)
{
- int sourceline;
- VALUE sourcefile = rb_source_location(&sourceline);
+ const char *sourcefile = rb_sourcefile();
+ int sourceline = rb_sourceline();
if (sourcefile) {
ID caller_name;
if (sourceline == 0) {
- warn_printf("%"PRIsVALUE, sourcefile);
+ warn_printf("%s", sourcefile);
}
else if ((caller_name = rb_frame_callee()) != 0) {
- warn_printf("%"PRIsVALUE":%d:in `%"PRIsVALUE"'", sourcefile, sourceline,
- rb_id2str(caller_name));
+ warn_printf("%s:%d:in `%s'", sourcefile, sourceline,
+ rb_id2name(caller_name));
}
else {
- warn_printf("%"PRIsVALUE":%d", sourcefile, sourceline);
+ warn_printf("%s:%d", sourcefile, sourceline);
}
}
}
+static VALUE
+get_backtrace(VALUE info)
+{
+ if (NIL_P(info))
+ return Qnil;
+ info = rb_funcall(info, rb_intern("backtrace"), 0);
+ if (NIL_P(info))
+ return Qnil;
+ return rb_check_backtrace(info);
+}
+
+VALUE
+rb_get_backtrace(VALUE info)
+{
+ return get_backtrace(info);
+}
+
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
static void
@@ -56,7 +73,7 @@ set_backtrace(VALUE info, VALUE bt)
bt = rb_backtrace_to_str_ary(bt);
}
}
- rb_check_funcall(info, set_backtrace, 1, &bt);
+ rb_funcall(info, rb_intern("set_backtrace"), 1, bt);
}
static void
@@ -65,7 +82,7 @@ error_print(void)
volatile VALUE errat = Qundef;
rb_thread_t *th = GET_THREAD();
VALUE errinfo = th->errinfo;
- volatile int raised_flag = th->raised_flag;
+ int raised_flag = th->raised_flag;
volatile VALUE eclass = Qundef, e = Qundef;
const char *volatile einfo;
volatile long elen;
@@ -76,7 +93,7 @@ error_print(void)
TH_PUSH_TAG(th);
if (TH_EXEC_TAG() == 0) {
- errat = rb_get_backtrace(errinfo);
+ errat = get_backtrace(errinfo);
}
else if (errat == Qundef) {
errat = Qnil;
@@ -88,8 +105,8 @@ error_print(void)
goto no_message;
}
if (NIL_P(errat)) {
- int line;
- const char *file = rb_source_loc(&line);
+ const char *file = rb_sourcefile();
+ int line = rb_sourceline();
if (!file)
warn_printf("%d", line);
else if (!line)
@@ -145,16 +162,16 @@ error_print(void)
tail++; /* skip newline */
}
warn_print(": ");
- warn_print_str(tail ? rb_str_subseq(e, 0, len) : e);
+ warn_print2(einfo, len);
if (epath) {
warn_print(" (");
warn_print_str(epath);
warn_print(")\n");
}
if (tail) {
- warn_print_str(rb_str_subseq(e, tail - einfo, elen - len - 1));
+ warn_print2(tail, elen - len - 1);
+ if (einfo[elen-1] != '\n') warn_print2("\n", 1);
}
- if (tail ? einfo[elen-1] != '\n' : !epath) warn_print2("\n", 1);
}
}
@@ -191,65 +208,39 @@ ruby_error_print(void)
error_print();
}
-#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'")
-#define undef_mesg(v) ( \
- is_mod ? \
- undef_mesg_for(v, "module") : \
- undef_mesg_for(v, "class"))
-
void
-rb_print_undef(VALUE klass, ID id, int visi)
+rb_print_undef(VALUE klass, ID id, int scope)
{
- const int is_mod = RB_TYPE_P(klass, T_MODULE);
- VALUE mesg;
- switch (visi & METHOD_VISI_MASK) {
- case METHOD_VISI_UNDEF:
- case METHOD_VISI_PUBLIC: mesg = undef_mesg(""); break;
- case METHOD_VISI_PRIVATE: mesg = undef_mesg(" private"); break;
- case METHOD_VISI_PROTECTED: mesg = undef_mesg(" protected"); break;
- default: UNREACHABLE;
+ const char *v;
+
+ switch (scope) {
+ default:
+ case NOEX_PUBLIC: v = ""; break;
+ case NOEX_PRIVATE: v = " private"; break;
+ case NOEX_PROTECTED: v = " protected"; break;
}
- rb_name_err_raise_str(mesg, klass, ID2SYM(id));
+ rb_name_error(id, "undefined%s method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'", v,
+ QUOTE_ID(id),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass));
}
void
rb_print_undef_str(VALUE klass, VALUE name)
{
- const int is_mod = RB_TYPE_P(klass, T_MODULE);
- rb_name_err_raise_str(undef_mesg(""), klass, name);
-}
-
-#define inaccessible_mesg_for(v, k) rb_fstring_cstr("method `%1$s' for "k" `%2$s' is "v)
-#define inaccessible_mesg(v) ( \
- is_mod ? \
- inaccessible_mesg_for(v, "module") : \
- inaccessible_mesg_for(v, "class"))
-
-void
-rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
-{
- const int is_mod = RB_TYPE_P(klass, T_MODULE);
- VALUE mesg;
- switch (visi & METHOD_VISI_MASK) {
- case METHOD_VISI_UNDEF:
- case METHOD_VISI_PUBLIC: mesg = inaccessible_mesg(""); break;
- case METHOD_VISI_PRIVATE: mesg = inaccessible_mesg(" private"); break;
- case METHOD_VISI_PROTECTED: mesg = inaccessible_mesg(" protected"); break;
- default: UNREACHABLE;
- }
- rb_name_err_raise_str(mesg, klass, ID2SYM(id));
+ rb_name_error_str(name, "undefined method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'",
+ QUOTE(name),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass));
}
static int
sysexit_status(VALUE err)
{
- VALUE st = rb_ivar_get(err, id_status);
+ VALUE st = rb_iv_get(err, "status");
return NUM2INT(st);
}
-#define unknown_longjmp_status(status) \
- rb_bug("Unknown longjmp status %d", status)
-
static int
error_handle(int ex)
{
@@ -293,8 +284,7 @@ error_handle(int ex)
if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
status = sysexit_status(errinfo);
}
- else if (rb_obj_is_instance_of(errinfo, rb_eSignal) &&
- rb_ivar_get(errinfo, id_signo) != INT2FIX(SIGSEGV)) {
+ else if (rb_obj_is_instance_of(errinfo, rb_eSignal)) {
/* no message when exiting by signal */
}
else {
@@ -306,7 +296,7 @@ error_handle(int ex)
error_print();
break;
default:
- unknown_longjmp_status(ex);
+ rb_bug("Unknown longjmp status %d", ex);
break;
}
rb_threadptr_reset_raised(th);
diff --git a/eval_intern.h b/eval_intern.h
index 85c606ecb2..a0ecb5086b 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -4,14 +4,15 @@
#include "ruby/ruby.h"
#include "vm_core.h"
-static inline void
-pass_passed_block(rb_thread_t *th)
-{
- th->passed_block = rb_vm_control_frame_block_ptr(th->cfp);
- th->cfp->flag |= VM_FRAME_FLAG_PASSED;
-}
-#define PASS_PASSED_BLOCK_TH(th) pass_passed_block(th)
-#define PASS_PASSED_BLOCK() pass_passed_block(GET_THREAD())
+#define PASS_PASSED_BLOCK_TH(th) do { \
+ (th)->passed_block = rb_vm_control_frame_block_ptr(th->cfp); \
+ (th)->cfp->flag |= VM_FRAME_FLAG_PASSED; \
+} while (0)
+
+#define PASS_PASSED_BLOCK() do { \
+ rb_thread_t * const __th__ = GET_THREAD(); \
+ PASS_PASSED_BLOCK_TH(__th__); \
+} while (0)
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -94,15 +95,6 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
EXCEPTION_CONTINUE_SEARCH) { \
/* never reaches here */ \
}
-#elif defined(__MINGW32__)
-LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
-#define SAVE_ROOT_JMPBUF_BEFORE_STMT \
- do { \
- PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler);
-
-#define SAVE_ROOT_JMPBUF_AFTER_STMT \
- RemoveVectoredExceptionHandler(_handler); \
- } while (0);
#else
#define SAVE_ROOT_JMPBUF_BEFORE_STMT
#define SAVE_ROOT_JMPBUF_AFTER_STMT
@@ -121,29 +113,25 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
#define TH_PUSH_TAG(th) do { \
rb_thread_t * const _th = (th); \
struct rb_vm_tag _tag; \
- _tag.tag = Qundef; \
+ _tag.tag = 0; \
_tag.prev = _th->tag;
#define TH_POP_TAG() \
_th->tag = _tag.prev; \
} while (0)
-#define TH_TMPPOP_TAG() \
+#define TH_POP_TAG2() \
_th->tag = _tag.prev
-#define TH_REPUSH_TAG() (void)(_th->tag = &_tag)
+#define TH_PUSH_TAG2() (_th->tag = &_tag, 0)
+
+#define TH_TMPPOP_TAG() TH_POP_TAG2()
+
+#define TH_REPUSH_TAG() TH_PUSH_TAG2()
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
#define POP_TAG() TH_POP_TAG()
-#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8)
-# define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
-# define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
-#else
-# define VAR_FROM_MEMORY(var) (var)
-# define VAR_INITIALIZED(var) ((void)&(var))
-#endif
-
/* clear th->state, and return the value */
static inline int
rb_threadptr_tag_state(rb_thread_t *th)
@@ -157,8 +145,7 @@ NORETURN(static inline void rb_threadptr_tag_jump(rb_thread_t *, int));
static inline void
rb_threadptr_tag_jump(rb_thread_t *th, int st)
{
- th->state = st;
- ruby_longjmp(th->tag->buf, 1);
+ ruby_longjmp(th->tag->buf, (th->state = st));
}
/*
@@ -166,7 +153,7 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
[ISO/IEC 9899:1999] 7.13.1.1
*/
#define TH_EXEC_TAG() \
- (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(VAR_FROM_MEMORY(_th)) : (TH_REPUSH_TAG(), 0))
+ (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(_th) : TH_PUSH_TAG2())
#define EXEC_TAG() \
TH_EXEC_TAG()
@@ -177,70 +164,41 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
#define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc)
-/* CREF operators */
-
-#define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1
-#define CREF_FL_OMOD_SHARED IMEMO_FL_USER2
-
-static inline VALUE
-CREF_CLASS(const rb_cref_t *cref)
-{
- return cref->klass;
-}
-
-static inline rb_cref_t *
-CREF_NEXT(const rb_cref_t *cref)
-{
- return cref->next;
-}
-
-static inline const rb_scope_visibility_t *
-CREF_SCOPE_VISI(const rb_cref_t *cref)
-{
- return &cref->scope_visi;
-}
-
-static inline VALUE
-CREF_REFINEMENTS(const rb_cref_t *cref)
-{
- return cref->refinements;
-}
-
-static inline void
-CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
-{
- RB_OBJ_WRITE(cref, &cref->refinements, refs);
-}
-
-static inline int
-CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
-{
- return cref->flags & CREF_FL_PUSHED_BY_EVAL;
-}
-
-static inline void
-CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
-{
- cref->flags |= CREF_FL_PUSHED_BY_EVAL;
-}
-
-static inline int
-CREF_OMOD_SHARED(const rb_cref_t *cref)
-{
- return cref->flags & CREF_FL_OMOD_SHARED;
-}
-
-static inline void
-CREF_OMOD_SHARED_SET(rb_cref_t *cref)
-{
- cref->flags |= CREF_FL_OMOD_SHARED;
-}
-
-static inline void
-CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
-{
- cref->flags &= ~CREF_FL_OMOD_SHARED;
-}
+enum ruby_tag_type {
+ RUBY_TAG_RETURN = 0x1,
+ RUBY_TAG_BREAK = 0x2,
+ RUBY_TAG_NEXT = 0x3,
+ RUBY_TAG_RETRY = 0x4,
+ RUBY_TAG_REDO = 0x5,
+ RUBY_TAG_RAISE = 0x6,
+ RUBY_TAG_THROW = 0x7,
+ RUBY_TAG_FATAL = 0x8,
+ RUBY_TAG_MASK = 0xf
+};
+#define TAG_RETURN RUBY_TAG_RETURN
+#define TAG_BREAK RUBY_TAG_BREAK
+#define TAG_NEXT RUBY_TAG_NEXT
+#define TAG_RETRY RUBY_TAG_RETRY
+#define TAG_REDO RUBY_TAG_REDO
+#define TAG_RAISE RUBY_TAG_RAISE
+#define TAG_THROW RUBY_TAG_THROW
+#define TAG_FATAL RUBY_TAG_FATAL
+#define TAG_MASK RUBY_TAG_MASK
+
+#define NEW_THROW_OBJECT(val, pt, st) \
+ ((VALUE)rb_node_newnode(NODE_LIT, (VALUE)(val), (VALUE)(pt), (VALUE)(st)))
+#define SET_THROWOBJ_CATCH_POINT(obj, val) \
+ (RNODE((obj))->u2.value = (val))
+#define SET_THROWOBJ_STATE(obj, val) \
+ (RNODE((obj))->u3.value = (val))
+
+#define GET_THROWOBJ_VAL(obj) ((VALUE)RNODE((obj))->u1.value)
+#define GET_THROWOBJ_CATCH_POINT(obj) ((VALUE*)RNODE((obj))->u2.value)
+#define GET_THROWOBJ_STATE(obj) ((int)RNODE((obj))->u3.value)
+
+#define SCOPE_TEST(f) (rb_vm_cref()->nd_visi & (f))
+#define SCOPE_CHECK(f) (rb_vm_cref()->nd_visi == (f))
+#define SCOPE_SET(f) (rb_vm_cref()->nd_visi = (f))
void rb_thread_cleanup(void);
void rb_thread_wait_other_threads(void);
@@ -257,8 +215,8 @@ int rb_threadptr_reset_raised(rb_thread_t *th);
#define rb_thread_raised_p(th, f) (((th)->raised_flag & (f)) != 0)
#define rb_thread_raised_clear(th) ((th)->raised_flag = 0)
-VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
-VALUE rb_make_exception(int argc, const VALUE *argv);
+VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
+VALUE rb_make_exception(int argc, VALUE *argv);
NORETURN(void rb_method_name_error(VALUE, VALUE));
@@ -266,15 +224,13 @@ NORETURN(void rb_fiber_start(void));
NORETURN(void rb_print_undef(VALUE, ID, int));
NORETURN(void rb_print_undef_str(VALUE, VALUE));
-NORETURN(void rb_print_inaccessible(VALUE, ID, rb_method_visibility_t));
NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
NORETURN(void rb_vm_jump_tag_but_local_jump(int));
-NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
+NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv,
VALUE obj, int call_status));
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
-rb_cref_t *rb_vm_cref(void);
-rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
+NODE *rb_vm_cref(void);
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
void rb_vm_set_progname(VALUE filename);
void rb_thread_terminate_all(void);
diff --git a/eval_jump.c b/eval_jump.c
index 59dae109ce..30094e9176 100644
--- a/eval_jump.c
+++ b/eval_jump.c
@@ -94,11 +94,10 @@ rb_mark_end_proc(void)
}
static void
-exec_end_procs_chain(struct end_proc_data *volatile *procs, VALUE *errp)
+exec_end_procs_chain(struct end_proc_data *volatile *procs)
{
struct end_proc_data volatile endproc;
struct end_proc_data *link;
- VALUE errinfo = *errp;
while ((link = *procs) != 0) {
*procs = link->next;
@@ -106,7 +105,6 @@ exec_end_procs_chain(struct end_proc_data *volatile *procs, VALUE *errp)
xfree(link);
rb_set_safe_level_force(endproc.safe);
(*endproc.func) (endproc.data);
- *errp = errinfo;
}
}
@@ -118,21 +116,20 @@ rb_exec_end_proc(void)
rb_thread_t *th = GET_THREAD();
volatile VALUE errinfo = th->errinfo;
- TH_PUSH_TAG(th);
+ PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
again:
- exec_end_procs_chain(&ephemeral_end_procs, &th->errinfo);
- exec_end_procs_chain(&end_procs, &th->errinfo);
+ exec_end_procs_chain(&ephemeral_end_procs);
+ exec_end_procs_chain(&end_procs);
}
else {
- VAR_INITIALIZED(th);
TH_TMPPOP_TAG();
error_handle(status);
if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
TH_REPUSH_TAG();
goto again;
}
- TH_POP_TAG();
+ POP_TAG();
rb_set_safe_level_force(safe);
th->errinfo = errinfo;
diff --git a/ext/-test-/array/resize/extconf.rb b/ext/-test-/array/resize/extconf.rb
index bc827e1170..6500a878fc 100644
--- a/ext/-test-/array/resize/extconf.rb
+++ b/ext/-test-/array/resize/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/array/resize")
diff --git a/ext/-test-/bignum/big2str.c b/ext/-test-/bignum/big2str.c
index ec4bde2915..ce71fe37e2 100644
--- a/ext/-test-/bignum/big2str.c
+++ b/ext/-test-/bignum/big2str.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
static VALUE
diff --git a/ext/-test-/bignum/bigzero.c b/ext/-test-/bignum/bigzero.c
index 35117db7ae..2f7c272744 100644
--- a/ext/-test-/bignum/bigzero.c
+++ b/ext/-test-/bignum/bigzero.c
@@ -1,11 +1,11 @@
-#include "internal.h"
+#include "ruby.h"
static VALUE
bug_big_zero(VALUE self, VALUE length)
{
long len = NUM2ULONG(length);
VALUE z = rb_big_new(len, 1);
- MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len);
+ MEMZERO(RBIGNUM_DIGITS(z), BDIGIT, len);
return z;
}
@@ -14,7 +14,7 @@ bug_big_negzero(VALUE self, VALUE length)
{
long len = NUM2ULONG(length);
VALUE z = rb_big_new(len, 0);
- MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len);
+ MEMZERO(RBIGNUM_DIGITS(z), BDIGIT, len);
return z;
}
diff --git a/ext/-test-/bignum/depend b/ext/-test-/bignum/depend
index 26cb890dbf..c65482236a 100644
--- a/ext/-test-/bignum/depend
+++ b/ext/-test-/bignum/depend
@@ -1,102 +1,7 @@
-big2str.o: big2str.c
-div.o: div.c
-intpack.o: intpack.c
-mul.o: mul.c
-str2big.o: str2big.c
+$(OBJS): $(HDRS) $(ruby_headers)
-# AUTOGENERATED DEPENDENCIES START
-big2str.o: $(RUBY_EXTCONF_H)
-big2str.o: $(arch_hdrdir)/ruby/config.h
-big2str.o: $(hdrdir)/ruby/defines.h
-big2str.o: $(hdrdir)/ruby/encoding.h
-big2str.o: $(hdrdir)/ruby/intern.h
-big2str.o: $(hdrdir)/ruby/io.h
-big2str.o: $(hdrdir)/ruby/missing.h
-big2str.o: $(hdrdir)/ruby/oniguruma.h
-big2str.o: $(hdrdir)/ruby/ruby.h
-big2str.o: $(hdrdir)/ruby/st.h
-big2str.o: $(hdrdir)/ruby/subst.h
-big2str.o: $(top_srcdir)/include/ruby.h
-big2str.o: $(top_srcdir)/internal.h
-big2str.o: big2str.c
-bigzero.o: $(RUBY_EXTCONF_H)
-bigzero.o: $(arch_hdrdir)/ruby/config.h
-bigzero.o: $(hdrdir)/ruby/defines.h
-bigzero.o: $(hdrdir)/ruby/encoding.h
-bigzero.o: $(hdrdir)/ruby/intern.h
-bigzero.o: $(hdrdir)/ruby/io.h
-bigzero.o: $(hdrdir)/ruby/missing.h
-bigzero.o: $(hdrdir)/ruby/oniguruma.h
-bigzero.o: $(hdrdir)/ruby/ruby.h
-bigzero.o: $(hdrdir)/ruby/st.h
-bigzero.o: $(hdrdir)/ruby/subst.h
-bigzero.o: $(top_srcdir)/include/ruby.h
-bigzero.o: $(top_srcdir)/internal.h
-bigzero.o: bigzero.c
-div.o: $(RUBY_EXTCONF_H)
-div.o: $(arch_hdrdir)/ruby/config.h
-div.o: $(hdrdir)/ruby/defines.h
-div.o: $(hdrdir)/ruby/encoding.h
-div.o: $(hdrdir)/ruby/intern.h
-div.o: $(hdrdir)/ruby/io.h
-div.o: $(hdrdir)/ruby/missing.h
-div.o: $(hdrdir)/ruby/oniguruma.h
-div.o: $(hdrdir)/ruby/ruby.h
-div.o: $(hdrdir)/ruby/st.h
-div.o: $(hdrdir)/ruby/subst.h
-div.o: $(top_srcdir)/include/ruby.h
-div.o: $(top_srcdir)/internal.h
-div.o: div.c
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: init.c
-intpack.o: $(RUBY_EXTCONF_H)
-intpack.o: $(arch_hdrdir)/ruby/config.h
-intpack.o: $(hdrdir)/ruby/defines.h
-intpack.o: $(hdrdir)/ruby/encoding.h
-intpack.o: $(hdrdir)/ruby/intern.h
-intpack.o: $(hdrdir)/ruby/io.h
-intpack.o: $(hdrdir)/ruby/missing.h
-intpack.o: $(hdrdir)/ruby/oniguruma.h
-intpack.o: $(hdrdir)/ruby/ruby.h
-intpack.o: $(hdrdir)/ruby/st.h
-intpack.o: $(hdrdir)/ruby/subst.h
-intpack.o: $(top_srcdir)/include/ruby.h
-intpack.o: $(top_srcdir)/internal.h
-intpack.o: intpack.c
-mul.o: $(RUBY_EXTCONF_H)
-mul.o: $(arch_hdrdir)/ruby/config.h
-mul.o: $(hdrdir)/ruby/defines.h
-mul.o: $(hdrdir)/ruby/encoding.h
-mul.o: $(hdrdir)/ruby/intern.h
-mul.o: $(hdrdir)/ruby/io.h
-mul.o: $(hdrdir)/ruby/missing.h
-mul.o: $(hdrdir)/ruby/oniguruma.h
-mul.o: $(hdrdir)/ruby/ruby.h
-mul.o: $(hdrdir)/ruby/st.h
-mul.o: $(hdrdir)/ruby/subst.h
-mul.o: $(top_srcdir)/include/ruby.h
-mul.o: $(top_srcdir)/internal.h
-mul.o: mul.c
-str2big.o: $(RUBY_EXTCONF_H)
-str2big.o: $(arch_hdrdir)/ruby/config.h
-str2big.o: $(hdrdir)/ruby/defines.h
-str2big.o: $(hdrdir)/ruby/encoding.h
-str2big.o: $(hdrdir)/ruby/intern.h
-str2big.o: $(hdrdir)/ruby/io.h
-str2big.o: $(hdrdir)/ruby/missing.h
-str2big.o: $(hdrdir)/ruby/oniguruma.h
-str2big.o: $(hdrdir)/ruby/ruby.h
-str2big.o: $(hdrdir)/ruby/st.h
-str2big.o: $(hdrdir)/ruby/subst.h
-str2big.o: $(top_srcdir)/include/ruby.h
-str2big.o: $(top_srcdir)/internal.h
-str2big.o: str2big.c
-# AUTOGENERATED DEPENDENCIES END
+intpack.o: intpack.c $(top_srcdir)/internal.h
+mul.o: mul.c $(top_srcdir)/internal.h
+div.o: div.c $(top_srcdir)/internal.h
+big2str.o: big2str.c $(top_srcdir)/internal.h
+str2big.o: big2str.c $(top_srcdir)/internal.h
diff --git a/ext/-test-/bignum/div.c b/ext/-test-/bignum/div.c
index a1db21dc30..2853ebef1c 100644
--- a/ext/-test-/bignum/div.c
+++ b/ext/-test-/bignum/div.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
static VALUE
diff --git a/ext/-test-/bignum/extconf.rb b/ext/-test-/bignum/extconf.rb
index 34f503ca87..e8c1febc82 100644
--- a/ext/-test-/bignum/extconf.rb
+++ b/ext/-test-/bignum/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
diff --git a/ext/-test-/bignum/intpack.c b/ext/-test-/bignum/intpack.c
index 2d19442cf2..03023196e6 100644
--- a/ext/-test-/bignum/intpack.c
+++ b/ext/-test-/bignum/intpack.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
static VALUE
@@ -48,7 +49,7 @@ static VALUE
rb_integer_test_numbits_2comp_without_sign(VALUE val)
{
size_t size;
- int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val);
+ int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : RBIGNUM_NEGATIVE_P(val);
size = rb_absint_numwords(val, 1, NULL) - (neg && rb_absint_singlebit_p(val));
return SIZET2NUM(size);
}
@@ -56,7 +57,7 @@ rb_integer_test_numbits_2comp_without_sign(VALUE val)
static VALUE
rb_integer_test_numbytes_2comp_with_sign(VALUE val)
{
- int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val);
+ int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : RBIGNUM_NEGATIVE_P(val);
int nlz_bits;
size_t size = rb_absint_size(val, &nlz_bits);
if (nlz_bits == 0 && !(neg && rb_absint_singlebit_p(val)))
diff --git a/ext/-test-/bignum/mul.c b/ext/-test-/bignum/mul.c
index d34e98fabb..758465b567 100644
--- a/ext/-test-/bignum/mul.c
+++ b/ext/-test-/bignum/mul.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
static VALUE
@@ -54,8 +55,8 @@ mul_gmp(VALUE x, VALUE y)
void
Init_mul(VALUE klass)
{
- rb_define_const(rb_cBignum, "SIZEOF_BDIGIT", INT2NUM(SIZEOF_BDIGIT));
- rb_define_const(rb_cBignum, "BITSPERDIG", INT2NUM(SIZEOF_BDIGIT * CHAR_BIT));
+ rb_define_const(rb_cBignum, "SIZEOF_BDIGITS", INT2NUM(SIZEOF_BDIGITS));
+ rb_define_const(rb_cBignum, "BITSPERDIG", INT2NUM(SIZEOF_BDIGITS * CHAR_BIT));
rb_define_method(rb_cInteger, "big_mul_normal", mul_normal, 1);
rb_define_method(rb_cInteger, "big_sq_fast", sq_fast, 0);
rb_define_method(rb_cInteger, "big_mul_balance", mul_balance, 1);
diff --git a/ext/-test-/bignum/str2big.c b/ext/-test-/bignum/str2big.c
index bc79ef0329..0fdcb53290 100644
--- a/ext/-test-/bignum/str2big.c
+++ b/ext/-test-/bignum/str2big.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
static VALUE
diff --git a/ext/-test-/bug-3571/bug.c b/ext/-test-/bug-3571/bug.c
index 87a5df0588..72d6bd1021 100644
--- a/ext/-test-/bug-3571/bug.c
+++ b/ext/-test-/bug-3571/bug.c
@@ -1,7 +1,7 @@
#include <ruby.h>
static VALUE
-bug_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+bug_i(VALUE i, VALUE arg)
{
rb_notimplement();
return ID2SYM(rb_frame_this_func());
diff --git a/ext/-test-/bug-3571/extconf.rb b/ext/-test-/bug-3571/extconf.rb
index 10b3bb304b..6390fce219 100644
--- a/ext/-test-/bug-3571/extconf.rb
+++ b/ext/-test-/bug-3571/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/bug-3571/bug")
diff --git a/ext/-test-/notimplement/bug.c b/ext/-test-/bug-3662/bug.c
index 34731bc2e6..9375dace10 100644
--- a/ext/-test-/notimplement/bug.c
+++ b/ext/-test-/bug-3662/bug.c
@@ -8,7 +8,7 @@ bug_funcall(int argc, VALUE *argv, VALUE self)
}
void
-Init_notimplement(void)
+Init_bug(void)
{
VALUE mBug = rb_define_module("Bug");
rb_define_module_function(mBug, "funcall", bug_funcall, -1);
diff --git a/ext/-test-/bug-3662/extconf.rb b/ext/-test-/bug-3662/extconf.rb
new file mode 100644
index 0000000000..7a1b73023c
--- /dev/null
+++ b/ext/-test-/bug-3662/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/bug-3662/bug")
diff --git a/ext/-test-/bug-5832/extconf.rb b/ext/-test-/bug-5832/extconf.rb
index 948e7791b6..55a4b7d93f 100644
--- a/ext/-test-/bug-5832/extconf.rb
+++ b/ext/-test-/bug-5832/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/bug-5832/bug")
diff --git a/ext/-test-/bug_reporter/extconf.rb b/ext/-test-/bug_reporter/extconf.rb
index fb2ed40342..0fccd81a41 100644
--- a/ext/-test-/bug_reporter/extconf.rb
+++ b/ext/-test-/bug_reporter/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/bug_reporter/bug_reporter")
diff --git a/ext/-test-/class/extconf.rb b/ext/-test-/class/extconf.rb
index 1c7837d07a..a07d660b87 100644
--- a/ext/-test-/class/extconf.rb
+++ b/ext/-test-/class/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
diff --git a/ext/-test-/debug/depend b/ext/-test-/debug/depend
index 5178d85673..d5a2ef9a52 100644
--- a/ext/-test-/debug/depend
+++ b/ext/-test-/debug/depend
@@ -1,32 +1,3 @@
-# AUTOGENERATED DEPENDENCIES START
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: init.c
-inspector.o: $(RUBY_EXTCONF_H)
-inspector.o: $(arch_hdrdir)/ruby/config.h
-inspector.o: $(hdrdir)/ruby/debug.h
-inspector.o: $(hdrdir)/ruby/defines.h
-inspector.o: $(hdrdir)/ruby/intern.h
-inspector.o: $(hdrdir)/ruby/missing.h
-inspector.o: $(hdrdir)/ruby/ruby.h
-inspector.o: $(hdrdir)/ruby/st.h
-inspector.o: $(hdrdir)/ruby/subst.h
-inspector.o: inspector.c
-profile_frames.o: $(RUBY_EXTCONF_H)
-profile_frames.o: $(arch_hdrdir)/ruby/config.h
-profile_frames.o: $(hdrdir)/ruby/debug.h
-profile_frames.o: $(hdrdir)/ruby/defines.h
-profile_frames.o: $(hdrdir)/ruby/intern.h
-profile_frames.o: $(hdrdir)/ruby/missing.h
-profile_frames.o: $(hdrdir)/ruby/ruby.h
-profile_frames.o: $(hdrdir)/ruby/st.h
-profile_frames.o: $(hdrdir)/ruby/subst.h
-profile_frames.o: profile_frames.c
-# AUTOGENERATED DEPENDENCIES END
+init.o: $(HDRS) $(ruby_headers)
+inspector.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
+profile_frames.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
diff --git a/ext/-test-/debug/extconf.rb b/ext/-test-/debug/extconf.rb
index 0f34383165..8f7922e1a6 100644
--- a/ext/-test-/debug/extconf.rb
+++ b/ext/-test-/debug/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
diff --git a/ext/-test-/dln/empty/empty.c b/ext/-test-/dln/empty/empty.c
deleted file mode 100644
index c4f94f1644..0000000000
--- a/ext/-test-/dln/empty/empty.c
+++ /dev/null
@@ -1,4 +0,0 @@
-void
-Init_empty(void)
-{
-}
diff --git a/ext/-test-/dln/empty/extconf.rb b/ext/-test-/dln/empty/extconf.rb
deleted file mode 100644
index 20310b6dde..0000000000
--- a/ext/-test-/dln/empty/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-create_makefile("-test-/dln/empty")
diff --git a/ext/-test-/exception/dataerror.c b/ext/-test-/exception/dataerror.c
deleted file mode 100644
index d8beba8aa4..0000000000
--- a/ext/-test-/exception/dataerror.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <ruby/ruby.h>
-
-static void
-dataerror_mark(void *ptr)
-{
- rb_gc_mark((VALUE)ptr);
-}
-
-static void
-dataerror_free(void *ptr)
-{
-}
-
-static const rb_data_type_t dataerror_type = {
- "Bug #9167",
- {dataerror_mark, dataerror_free},
-};
-
-static VALUE
-dataerror_alloc(VALUE klass)
-{
- VALUE n = rb_str_new_cstr("[Bug #9167] error");
- return TypedData_Wrap_Struct(klass, &dataerror_type, (void *)n);
-}
-
-void
-Init_dataerror(VALUE klass)
-{
- VALUE rb_eDataErr = rb_define_class_under(klass, "DataError", rb_eStandardError);
- rb_define_alloc_func(rb_eDataErr, dataerror_alloc);
-}
diff --git a/ext/-test-/exception/depend b/ext/-test-/exception/depend
index a89ecf7a4f..79b6c53f50 100644
--- a/ext/-test-/exception/depend
+++ b/ext/-test-/exception/depend
@@ -1,43 +1,3 @@
-# AUTOGENERATED DEPENDENCIES START
-dataerror.o: $(RUBY_EXTCONF_H)
-dataerror.o: $(arch_hdrdir)/ruby/config.h
-dataerror.o: $(hdrdir)/ruby/defines.h
-dataerror.o: $(hdrdir)/ruby/intern.h
-dataerror.o: $(hdrdir)/ruby/missing.h
-dataerror.o: $(hdrdir)/ruby/ruby.h
-dataerror.o: $(hdrdir)/ruby/st.h
-dataerror.o: $(hdrdir)/ruby/subst.h
-dataerror.o: dataerror.c
-enc_raise.o: $(RUBY_EXTCONF_H)
-enc_raise.o: $(arch_hdrdir)/ruby/config.h
-enc_raise.o: $(hdrdir)/ruby/defines.h
-enc_raise.o: $(hdrdir)/ruby/encoding.h
-enc_raise.o: $(hdrdir)/ruby/intern.h
-enc_raise.o: $(hdrdir)/ruby/missing.h
-enc_raise.o: $(hdrdir)/ruby/oniguruma.h
-enc_raise.o: $(hdrdir)/ruby/ruby.h
-enc_raise.o: $(hdrdir)/ruby/st.h
-enc_raise.o: $(hdrdir)/ruby/subst.h
-enc_raise.o: $(top_srcdir)/include/ruby.h
-enc_raise.o: enc_raise.c
-ensured.o: $(RUBY_EXTCONF_H)
-ensured.o: $(arch_hdrdir)/ruby/config.h
-ensured.o: $(hdrdir)/ruby/defines.h
-ensured.o: $(hdrdir)/ruby/intern.h
-ensured.o: $(hdrdir)/ruby/missing.h
-ensured.o: $(hdrdir)/ruby/ruby.h
-ensured.o: $(hdrdir)/ruby/st.h
-ensured.o: $(hdrdir)/ruby/subst.h
-ensured.o: $(top_srcdir)/include/ruby.h
-ensured.o: ensured.c
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: init.c
-# AUTOGENERATED DEPENDENCIES END
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/-test-/exception/extconf.rb b/ext/-test-/exception/extconf.rb
index 55bbb1fc3e..0faf6d53ed 100644
--- a/ext/-test-/exception/extconf.rb
+++ b/ext/-test-/exception/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
diff --git a/ext/-test-/fatal/extconf.rb b/ext/-test-/fatal/extconf.rb
index d5849c0733..e0cfeb2095 100644
--- a/ext/-test-/fatal/extconf.rb
+++ b/ext/-test-/fatal/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/fatal/rb_fatal")
diff --git a/ext/-test-/file/depend b/ext/-test-/file/depend
index a43b4275dc..7555a235b5 100644
--- a/ext/-test-/file/depend
+++ b/ext/-test-/file/depend
@@ -1,36 +1,2 @@
-# AUTOGENERATED DEPENDENCIES START
-fs.o: $(RUBY_EXTCONF_H)
-fs.o: $(arch_hdrdir)/ruby/config.h
-fs.o: $(hdrdir)/ruby/defines.h
-fs.o: $(hdrdir)/ruby/encoding.h
-fs.o: $(hdrdir)/ruby/intern.h
-fs.o: $(hdrdir)/ruby/io.h
-fs.o: $(hdrdir)/ruby/missing.h
-fs.o: $(hdrdir)/ruby/oniguruma.h
-fs.o: $(hdrdir)/ruby/ruby.h
-fs.o: $(hdrdir)/ruby/st.h
-fs.o: $(hdrdir)/ruby/subst.h
-fs.o: fs.c
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: init.c
-stat.o: $(RUBY_EXTCONF_H)
-stat.o: $(arch_hdrdir)/ruby/config.h
-stat.o: $(hdrdir)/ruby/defines.h
-stat.o: $(hdrdir)/ruby/encoding.h
-stat.o: $(hdrdir)/ruby/intern.h
-stat.o: $(hdrdir)/ruby/io.h
-stat.o: $(hdrdir)/ruby/missing.h
-stat.o: $(hdrdir)/ruby/oniguruma.h
-stat.o: $(hdrdir)/ruby/ruby.h
-stat.o: $(hdrdir)/ruby/st.h
-stat.o: $(hdrdir)/ruby/subst.h
-stat.o: stat.c
-# AUTOGENERATED DEPENDENCIES END
+init.o: $(HDRS) $(ruby_headers)
+stat.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/io.h $(hdrdir)/ruby/encoding.h $(hdrdir)/oniguruma.h
diff --git a/ext/-test-/file/extconf.rb b/ext/-test-/file/extconf.rb
index c1c26f215d..4e134dd1bf 100644
--- a/ext/-test-/file/extconf.rb
+++ b/ext/-test-/file/extconf.rb
@@ -1,20 +1,4 @@
-# frozen_string_literal: false
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-
-headers = %w[sys/param.h sys/mount.h sys/vfs.h].select {|h| have_header(h)}
-if have_type("struct statfs", headers)
- have_struct_member("struct statfs", "f_fstypename", headers)
- have_struct_member("struct statfs", "f_type", headers)
- have_struct_member("struct statfs", "f_flags", headers)
-end
-
-headers = %w[sys/statvfs.h].select {|h| have_header(h)}
-if have_type("struct statvfs", headers)
- have_struct_member("struct statvfs", "f_fstypename", headers)
- have_struct_member("struct statvfs", "f_basetype", headers)
- have_struct_member("struct statvfs", "f_type", headers)
-end
-
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
diff --git a/ext/-test-/file/fs.c b/ext/-test-/file/fs.c
deleted file mode 100644
index c9c3473257..0000000000
--- a/ext/-test-/file/fs.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "ruby/ruby.h"
-#include "ruby/io.h"
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#ifdef HAVE_SYS_STATVFS_H
-#include <sys/statvfs.h>
-#endif
-
-#if defined HAVE_STRUCT_STATFS_F_FSTYPENAME
-typedef struct statfs statfs_t;
-# define STATFS(f, s) statfs((f), (s))
-# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
-# if defined HAVE_STRUCT_STATFS_F_TYPE
-# define HAVE_STRUCT_STATFS_T_F_TYPE 1
-# endif
-#elif defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) /* NetBSD */
-typedef struct statvfs statfs_t;
-# define STATFS(f, s) statvfs((f), (s))
-# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
-# if defined HAVE_STRUCT_STATVFS_F_TYPE
-# define HAVE_STRUCT_STATFS_T_F_TYPE 1
-# endif
-#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) /* AIX, HP-UX, Solaris */
-typedef struct statvfs statfs_t;
-# define STATFS(f, s) statvfs((f), (s))
-# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
-# define f_fstypename f_basetype
-# if defined HAVE_STRUCT_STATVFS_F_TYPE
-# define HAVE_STRUCT_STATFS_T_F_TYPE 1
-# endif
-#elif defined(HAVE_STRUCT_STATFS_F_TYPE) /* Linux */
-typedef struct statfs statfs_t;
-# define STATFS(f, s) statfs((f), (s))
-# if defined HAVE_STRUCT_STATFS_F_TYPE
-# define HAVE_STRUCT_STATFS_T_F_TYPE 1
-# endif
-#endif
-
-VALUE
-get_fsname(VALUE self, VALUE str)
-{
-#ifdef STATFS
- statfs_t st;
-# define CSTR(s) rb_str_new_cstr(s)
-
- FilePathValue(str);
- str = rb_str_encode_ospath(str);
- if (STATFS(StringValueCStr(str), &st) == -1) {
- rb_sys_fail_str(str);
- }
-# ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
- if (st.f_fstypename[0])
- return CSTR(st.f_fstypename);
-# endif
-# ifdef HAVE_STRUCT_STATFS_T_F_TYPE
- switch (st.f_type) {
- case 0x9123683E: /* BTRFS_SUPER_MAGIC */
- return CSTR("btrfs");
- case 0x7461636f: /* OCFS2_SUPER_MAGIC */
- return CSTR("ocfs");
- case 0xEF53: /* EXT2_SUPER_MAGIC EXT3_SUPER_MAGIC EXT4_SUPER_MAGIC */
- return CSTR("ext4");
- case 0x58465342: /* XFS_SUPER_MAGIC */
- return CSTR("xfs");
- case 0x01021994: /* TMPFS_MAGIC */
- return CSTR("tmpfs");
- }
-# endif
-#endif
- return Qnil;
-}
-
-VALUE
-get_noatime_p(VALUE self, VALUE str)
-{
-#ifdef STATFS
- statfs_t st;
- FilePathValue(str);
- str = rb_str_encode_ospath(str);
- if (STATFS(StringValueCStr(str), &st) == -1) {
- rb_sys_fail_str(str);
- }
-# ifdef HAVE_STRUCT_STATFS_F_FLAGS
-# ifdef MNT_NOATIME
- return st.f_flags & MNT_NOATIME ? Qtrue : Qfalse;
-# elif defined(ST_NOATIME)
- return st.f_flags & ST_NOATIME ? Qtrue : Qfalse;
-# endif
-# endif
-#endif
- return Qnil;
-}
-
-void
-Init_fs(VALUE module)
-{
- VALUE fs = rb_define_module_under(module, "Fs");
- rb_define_module_function(fs, "fsname", get_fsname, 1);
- rb_define_module_function(fs, "noatime?", get_noatime_p, 1);
-}
diff --git a/ext/-test-/float/depend b/ext/-test-/float/depend
deleted file mode 100644
index dff14550f7..0000000000
--- a/ext/-test-/float/depend
+++ /dev/null
@@ -1,3 +0,0 @@
-$(OBJS): $(HDRS) $(ruby_headers)
-
-nextafter.o: nextafter.c $(top_srcdir)/missing/nextafter.c
diff --git a/ext/-test-/float/extconf.rb b/ext/-test-/float/extconf.rb
deleted file mode 100644
index 15709a1def..0000000000
--- a/ext/-test-/float/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/float")
diff --git a/ext/-test-/float/init.c b/ext/-test-/float/init.c
deleted file mode 100644
index d962108e39..0000000000
--- a/ext/-test-/float/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_float(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_class_under(mBug, "Float", rb_cObject);
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/float/nextafter.c b/ext/-test-/float/nextafter.c
deleted file mode 100644
index 30fb71f520..0000000000
--- a/ext/-test-/float/nextafter.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "ruby.h"
-
-static VALUE
-system_nextafter_m(VALUE klass, VALUE vx, VALUE vy)
-{
- double x, y, z;
-
- x = NUM2DBL(vx);
- y = NUM2DBL(vy);
- z = nextafter(x, y);
-
- return DBL2NUM(z);
-}
-
-#define nextafter missing_nextafter
-#include "../../../missing/nextafter.c"
-#undef nextafter
-
-static VALUE
-missing_nextafter_m(VALUE klass, VALUE vx, VALUE vy)
-{
- double x, y, z;
-
- x = NUM2DBL(vx);
- y = NUM2DBL(vy);
- z = missing_nextafter(x, y);
-
- return DBL2NUM(z);
-}
-
-void
-Init_nextafter(VALUE klass)
-{
- rb_define_singleton_method(klass, "system_nextafter", system_nextafter_m, 2);
- rb_define_singleton_method(klass, "missing_nextafter", missing_nextafter_m, 2);
-}
diff --git a/ext/-test-/funcall/extconf.rb b/ext/-test-/funcall/extconf.rb
index 35c3078bf5..8a9179ab2f 100644
--- a/ext/-test-/funcall/extconf.rb
+++ b/ext/-test-/funcall/extconf.rb
@@ -1,3 +1,2 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile("-test-/funcall/funcall")
diff --git a/ext/-test-/gvl/call_without_gvl/call_without_gvl.c b/ext/-test-/gvl/call_without_gvl/call_without_gvl.c
deleted file mode 100644
index f3071d5768..0000000000
--- a/ext/-test-/gvl/call_without_gvl/call_without_gvl.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "ruby/ruby.h"
-#include "ruby/thread.h"
-
-static void*
-native_sleep_callback(void *data)
-{
- struct timeval *timeval = data;
- select(0, NULL, NULL, NULL, timeval);
-
- return NULL;
-}
-
-
-static VALUE
-thread_runnable_sleep(VALUE thread, VALUE timeout)
-{
- struct timeval timeval;
-
- if (NIL_P(timeout)) {
- rb_raise(rb_eArgError, "timeout must be non nil");
- }
-
- timeval = rb_time_interval(timeout);
-
- rb_thread_call_without_gvl(native_sleep_callback, &timeval, RUBY_UBF_IO, NULL);
-
- return thread;
-}
-
-void
-Init_call_without_gvl(void)
-{
- rb_define_method(rb_cThread, "__runnable_sleep__", thread_runnable_sleep, 1);
-}
diff --git a/ext/-test-/gvl/call_without_gvl/extconf.rb b/ext/-test-/gvl/call_without_gvl/extconf.rb
deleted file mode 100644
index 56181b6773..0000000000
--- a/ext/-test-/gvl/call_without_gvl/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-create_makefile("-test-/gvl/call_without_gvl")
diff --git a/ext/-test-/hash/delete.c b/ext/-test-/hash/delete.c
deleted file mode 100644
index 10d4aec6e7..0000000000
--- a/ext/-test-/hash/delete.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "ruby.h"
-
-extern VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
-
-static VALUE
-hash_delete(VALUE hash, VALUE key)
-{
- VALUE ret = rb_hash_delete_entry(hash, key);
- return ret == Qundef ? Qnil : rb_ary_new_from_values(1, &ret);
-}
-
-void
-Init_delete(VALUE klass)
-{
- rb_define_method(klass, "delete!", hash_delete, 1);
-}
diff --git a/ext/-test-/hash/extconf.rb b/ext/-test-/hash/extconf.rb
deleted file mode 100644
index c823cb95b2..0000000000
--- a/ext/-test-/hash/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/hash")
diff --git a/ext/-test-/hash/init.c b/ext/-test-/hash/init.c
deleted file mode 100644
index 9f6cbde652..0000000000
--- a/ext/-test-/hash/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_hash(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_class_under(mBug, "Hash", rb_cHash);
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/iseq_load/extconf.rb b/ext/-test-/iseq_load/extconf.rb
deleted file mode 100644
index c5bd6c0569..0000000000
--- a/ext/-test-/iseq_load/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-create_makefile("-test-/iseq_load/iseq_load")
diff --git a/ext/-test-/iseq_load/iseq_load.c b/ext/-test-/iseq_load/iseq_load.c
deleted file mode 100644
index b4b9a8aa3d..0000000000
--- a/ext/-test-/iseq_load/iseq_load.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <ruby.h>
-
-VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
-
-static VALUE
-iseq_load(int argc, VALUE *argv, VALUE self)
-{
- VALUE data, opt = Qnil;
-
- rb_scan_args(argc, argv, "11", &data, &opt);
-
- return rb_iseq_load(data, 0, opt);
-}
-
-void
-Init_iseq_load(void)
-{
- VALUE rb_cISeq = rb_path2class("RubyVM::InstructionSequence");
-
- rb_define_singleton_method(rb_cISeq, "iseq_load", iseq_load, -1);
-}
diff --git a/ext/-test-/iter/break.c b/ext/-test-/iter/break.c
index 66ed26a9b8..56ba7e7ffd 100644
--- a/ext/-test-/iter/break.c
+++ b/ext/-test-/iter/break.c
@@ -17,9 +17,9 @@ iter_break_value(VALUE self, VALUE val)
}
void
-Init_break(VALUE klass)
+Init_break(void)
{
- VALUE breakable = rb_define_module_under(klass, "Breakable");
+ VALUE breakable = rb_define_module_under(rb_define_module("Bug"), "Breakable");
rb_define_module_function(breakable, "iter_break", iter_break, 0);
rb_define_module_function(breakable, "iter_break_value", iter_break_value, 1);
}
diff --git a/ext/-test-/iter/extconf.rb b/ext/-test-/iter/extconf.rb
index a0f03e23a9..695b5e9f6d 100644
--- a/ext/-test-/iter/extconf.rb
+++ b/ext/-test-/iter/extconf.rb
@@ -1,8 +1 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/iter")
+create_makefile("-test-/iter/break")
diff --git a/ext/-test-/iter/init.c b/ext/-test-/iter/init.c
deleted file mode 100644
index a074ec46a9..0000000000
--- a/ext/-test-/iter/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_iter(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_module_under(mBug, "Iter");
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/iter/yield.c b/ext/-test-/iter/yield.c
deleted file mode 100644
index 3cd408a928..0000000000
--- a/ext/-test-/iter/yield.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <ruby.h>
-
-static VALUE
-yield_block(int argc, VALUE *argv, VALUE self)
-{
- rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
- return rb_block_call(self, rb_to_id(argv[0]), argc-1, argv+1, rb_yield_block, 0);
-}
-
-void
-Init_yield(VALUE klass)
-{
- VALUE yield = rb_define_module_under(klass, "Yield");
-
- rb_define_method(yield, "yield_block", yield_block, -1);
-}
diff --git a/ext/-test-/load/dot.dot/extconf.rb b/ext/-test-/load/dot.dot/extconf.rb
index b5292c77f0..6287db6bd8 100644
--- a/ext/-test-/load/dot.dot/extconf.rb
+++ b/ext/-test-/load/dot.dot/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/load/dot.dot/dot.dot")
diff --git a/ext/-test-/marshal/compat/extconf.rb b/ext/-test-/marshal/compat/extconf.rb
index 9bf44b473a..bb11ebfb8c 100644
--- a/ext/-test-/marshal/compat/extconf.rb
+++ b/ext/-test-/marshal/compat/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/marshal/compat")
diff --git a/ext/-test-/marshal/internal_ivar/extconf.rb b/ext/-test-/marshal/internal_ivar/extconf.rb
deleted file mode 100644
index cb3f825dbd..0000000000
--- a/ext/-test-/marshal/internal_ivar/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-create_makefile("-test-/marshal/internal_ivar")
diff --git a/ext/-test-/marshal/internal_ivar/internal_ivar.c b/ext/-test-/marshal/internal_ivar/internal_ivar.c
deleted file mode 100644
index 299da27f23..0000000000
--- a/ext/-test-/marshal/internal_ivar/internal_ivar.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <ruby.h>
-
-static ID id_normal_ivar, id_internal_ivar;
-
-static VALUE
-init(VALUE self, VALUE arg1, VALUE arg2)
-{
- rb_ivar_set(self, id_normal_ivar, arg1);
- rb_ivar_set(self, id_internal_ivar, arg2);
- return self;
-}
-
-static VALUE
-get_normal(VALUE self)
-{
- return rb_attr_get(self, id_normal_ivar);
-}
-
-static VALUE
-get_internal(VALUE self)
-{
- return rb_attr_get(self, id_internal_ivar);
-}
-
-void
-Init_internal_ivar(void)
-{
- VALUE mMarshal = rb_define_module_under(rb_define_module("Bug"), "Marshal");
- VALUE newclass = rb_define_class_under(mMarshal, "InternalIVar", rb_cObject);
-
- id_normal_ivar = rb_intern_const("normal");
-#if 0
- /* leave id_internal_ivar being 0 */
- id_internal_ivar = rb_make_internal_id();
-#endif
- rb_define_method(newclass, "initialize", init, 2);
- rb_define_method(newclass, "normal", get_normal, 0);
- rb_define_method(newclass, "internal", get_internal, 0);
-}
diff --git a/ext/-test-/marshal/usr/extconf.rb b/ext/-test-/marshal/usr/extconf.rb
index b7886b9eea..c662b23dd5 100644
--- a/ext/-test-/marshal/usr/extconf.rb
+++ b/ext/-test-/marshal/usr/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/marshal/usr")
diff --git a/ext/-test-/marshal/usr/usrmarshal.c b/ext/-test-/marshal/usr/usrmarshal.c
index 0c9e079af2..b30bd52c13 100644
--- a/ext/-test-/marshal/usr/usrmarshal.c
+++ b/ext/-test-/marshal/usr/usrmarshal.c
@@ -1,38 +1,23 @@
#include <ruby.h>
-static size_t
-usr_size(const void *ptr)
-{
- return sizeof(int);
-}
-
-static const rb_data_type_t usrmarshal_type = {
- "UsrMarshal",
- {0, RUBY_DEFAULT_FREE, usr_size,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED,
-};
-
static VALUE
usr_alloc(VALUE klass)
{
int *p;
- return TypedData_Make_Struct(klass, int, &usrmarshal_type, p);
+ return Data_Make_Struct(klass, int, 0, RUBY_DEFAULT_FREE, p);
}
static VALUE
usr_init(VALUE self, VALUE val)
{
- int *ptr = Check_TypedStruct(self, &usrmarshal_type);
- *ptr = NUM2INT(val);
+ *(int *)DATA_PTR(self) = NUM2INT(val);
return self;
}
static VALUE
usr_value(VALUE self)
{
- int *ptr = Check_TypedStruct(self, &usrmarshal_type);
- int val = *ptr;
+ int val = *(int *)DATA_PTR(self);
return INT2NUM(val);
}
diff --git a/ext/-test-/method/extconf.rb b/ext/-test-/method/extconf.rb
index 3a52c1a822..658b7af1f1 100644
--- a/ext/-test-/method/extconf.rb
+++ b/ext/-test-/method/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
diff --git a/ext/-test-/notimplement/extconf.rb b/ext/-test-/notimplement/extconf.rb
deleted file mode 100644
index 54403cd7ce..0000000000
--- a/ext/-test-/notimplement/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-create_makefile("-test-/notimplement")
diff --git a/ext/-test-/num2int/extconf.rb b/ext/-test-/num2int/extconf.rb
index c585462921..2bc820e480 100644
--- a/ext/-test-/num2int/extconf.rb
+++ b/ext/-test-/num2int/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/num2int/num2int")
diff --git a/ext/-test-/old_thread_select/depend b/ext/-test-/old_thread_select/depend
new file mode 100644
index 0000000000..e786dc71d2
--- /dev/null
+++ b/ext/-test-/old_thread_select/depend
@@ -0,0 +1,4 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/-test-/old_thread_select/extconf.rb b/ext/-test-/old_thread_select/extconf.rb
new file mode 100644
index 0000000000..730d9ec901
--- /dev/null
+++ b/ext/-test-/old_thread_select/extconf.rb
@@ -0,0 +1,4 @@
+$warnflags = "-Wno-deprecated-declarations"
+$warnflags = "" unless try_compile("", $warnflags)
+
+create_makefile("-test-/old_thread_select/old_thread_select")
diff --git a/ext/-test-/old_thread_select/old_thread_select.c b/ext/-test-/old_thread_select/old_thread_select.c
new file mode 100644
index 0000000000..e374f02355
--- /dev/null
+++ b/ext/-test-/old_thread_select/old_thread_select.c
@@ -0,0 +1,75 @@
+/* test case for deprecated C API */
+#include "ruby/ruby.h"
+#include "ruby/io.h"
+
+static fd_set * array2fdset(fd_set *fds, VALUE ary, int *max)
+{
+ long i;
+
+ if (NIL_P(ary))
+ return NULL;
+
+ FD_ZERO(fds);
+ Check_Type(ary, T_ARRAY);
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
+ VALUE val = RARRAY_PTR(ary)[i];
+ int fd;
+
+ Check_Type(val, T_FIXNUM);
+ fd = FIX2INT(val);
+ if (fd >= *max)
+ *max = fd + 1;
+ FD_SET(fd, fds);
+ }
+
+ return fds;
+}
+
+static void fdset2array(VALUE dst, fd_set *fds, int max)
+{
+ int i;
+
+ rb_ary_clear(dst);
+
+ for (i = 0; i < max; i++) {
+ if (FD_ISSET(i, fds))
+ rb_ary_push(dst, INT2NUM(i));
+ }
+}
+
+static VALUE
+old_thread_select(VALUE klass, VALUE r, VALUE w, VALUE e, VALUE timeout)
+{
+ struct timeval tv;
+ struct timeval *tvp = NULL;
+ fd_set rfds, wfds, efds;
+ fd_set *rp, *wp, *ep;
+ int rc;
+ int max = 0;
+
+ if (!NIL_P(timeout)) {
+ tv = rb_time_timeval(timeout);
+ tvp = &tv;
+ }
+ rp = array2fdset(&rfds, r, &max);
+ wp = array2fdset(&wfds, w, &max);
+ ep = array2fdset(&efds, e, &max);
+ rc = rb_thread_select(max, rp, wp, ep, tvp);
+ if (rc == -1)
+ rb_sys_fail("rb_wait_for_single_fd");
+
+ if (rp)
+ fdset2array(r, &rfds, max);
+ if (wp)
+ fdset2array(w, &wfds, max);
+ if (ep)
+ fdset2array(e, &efds, max);
+ return INT2NUM(rc);
+}
+
+void
+Init_old_thread_select(void)
+{
+ rb_define_singleton_method(rb_cIO, "old_thread_select",
+ old_thread_select, 4);
+}
diff --git a/ext/-test-/path_to_class/extconf.rb b/ext/-test-/path_to_class/extconf.rb
index 8f05248d87..e1072b1443 100644
--- a/ext/-test-/path_to_class/extconf.rb
+++ b/ext/-test-/path_to_class/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
diff --git a/ext/-test-/popen_deadlock/extconf.rb b/ext/-test-/popen_deadlock/extconf.rb
deleted file mode 100644
index 24a7d79931..0000000000
--- a/ext/-test-/popen_deadlock/extconf.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: false
-case RUBY_PLATFORM
-when /solaris/i, /linux/i
- create_makefile("-test-/popen_deadlock/infinite_loop_dlsym")
-end
diff --git a/ext/-test-/popen_deadlock/infinite_loop_dlsym.c b/ext/-test-/popen_deadlock/infinite_loop_dlsym.c
deleted file mode 100644
index 1d95a7cc9a..0000000000
--- a/ext/-test-/popen_deadlock/infinite_loop_dlsym.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "ruby/ruby.h"
-#include "ruby/thread.h"
-#include <dlfcn.h>
-
-struct data_for_loop_dlsym {
- const char *name;
- volatile int stop;
-};
-
-static void*
-native_loop_dlsym(void *data)
-{
- struct data_for_loop_dlsym *s = data;
-
- while (!(s->stop)) {
- dlsym(RTLD_DEFAULT, s->name);
- }
-
- return NULL;
-}
-
-static void
-ubf_for_loop_dlsym(void *data)
-{
- struct data_for_loop_dlsym *s = data;
-
- s->stop = 1;
-
- return;
-}
-
-static VALUE
-loop_dlsym(VALUE self, VALUE name)
-{
- struct data_for_loop_dlsym d;
-
- d.stop = 0;
- d.name = StringValuePtr(name);
-
- rb_thread_call_without_gvl(native_loop_dlsym, &d,
- ubf_for_loop_dlsym, &d);
-
- return self;
-}
-
-void
-Init_infinite_loop_dlsym(void)
-{
- rb_define_method(rb_cThread, "__infinite_loop_dlsym__", loop_dlsym, 1);
-}
diff --git a/ext/-test-/postponed_job/extconf.rb b/ext/-test-/postponed_job/extconf.rb
index 58fbd3b461..aa29b593f4 100644
--- a/ext/-test-/postponed_job/extconf.rb
+++ b/ext/-test-/postponed_job/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile('-test-/postponed_job')
diff --git a/ext/-test-/printf/extconf.rb b/ext/-test-/printf/extconf.rb
index fb8fa8de36..7b96da0c85 100644
--- a/ext/-test-/printf/extconf.rb
+++ b/ext/-test-/printf/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/printf")
diff --git a/ext/-test-/printf/printf.c b/ext/-test-/printf/printf.c
index 666f5592e5..fd60b0f593 100644
--- a/ext/-test-/printf/printf.c
+++ b/ext/-test-/printf/printf.c
@@ -2,6 +2,14 @@
#include <ruby/encoding.h>
static VALUE
+printf_test_i(VALUE self, VALUE obj)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "<%"PRIsVALUE">", obj);
+ return rb_usascii_str_new2(buf);
+}
+
+static VALUE
printf_test_s(VALUE self, VALUE obj)
{
return rb_enc_sprintf(rb_usascii_encoding(), "<%"PRIsVALUE">", obj);
@@ -20,7 +28,7 @@ printf_test_q(VALUE self, VALUE obj)
}
static char *
-uint_to_str(char *p, char *e, unsigned int x)
+utoa(char *p, char *e, unsigned int x)
{
char *e0 = e;
if (e <= p) return p;
@@ -34,23 +42,18 @@ uint_to_str(char *p, char *e, unsigned int x)
static VALUE
printf_test_call(int argc, VALUE *argv, VALUE self)
{
- VALUE opt, type, num, result;
+ VALUE opt, type, num;
char format[sizeof(int) * 6 + 8], *p = format, cnv;
- int n = 0;
- const char *s = 0;
+ int n;
rb_scan_args(argc, argv, "2:", &type, &num, &opt);
Check_Type(type, T_STRING);
if (RSTRING_LEN(type) != 1) rb_raise(rb_eArgError, "wrong length(%ld)", RSTRING_LEN(type));
switch (cnv = RSTRING_PTR(type)[0]) {
- case 'd': case 'x': case 'o': case 'X':
- n = NUM2INT(num);
- break;
- case 's':
- s = StringValueCStr(num);
- break;
+ case 'd': case 'x': case 'o': case 'X': break;
default: rb_raise(rb_eArgError, "wrong conversion(%c)", cnv);
}
+ n = NUM2INT(num);
*p++ = '%';
if (!NIL_P(opt)) {
VALUE v;
@@ -71,29 +74,25 @@ printf_test_call(int argc, VALUE *argv, VALUE self)
*p++ = '0';
}
if (!NIL_P(v = rb_hash_aref(opt, ID2SYM(rb_intern("width"))))) {
- p = uint_to_str(p, format + sizeof(format), NUM2UINT(v));
+ p = utoa(p, format + sizeof(format), NUM2UINT(v));
}
if (!NIL_P(v = rb_hash_aref(opt, ID2SYM(rb_intern("prec"))))) {
*p++ = '.';
if (FIXNUM_P(v))
- p = uint_to_str(p, format + sizeof(format), NUM2UINT(v));
+ p = utoa(p, format + sizeof(format), NUM2UINT(v));
}
}
*p++ = cnv;
*p++ = '\0';
- if (cnv == 's') {
- result = rb_enc_sprintf(rb_usascii_encoding(), format, s);
- }
- else {
- result = rb_enc_sprintf(rb_usascii_encoding(), format, n);
- }
- return rb_assoc_new(result, rb_usascii_str_new_cstr(format));
+ return rb_assoc_new(rb_enc_sprintf(rb_usascii_encoding(), format, n),
+ rb_usascii_str_new_cstr(format));
}
void
Init_printf(void)
{
VALUE m = rb_define_module_under(rb_define_module("Bug"), "Printf");
+ rb_define_singleton_method(m, "i", printf_test_i, 1);
rb_define_singleton_method(m, "s", printf_test_s, 1);
rb_define_singleton_method(m, "v", printf_test_v, 1);
rb_define_singleton_method(m, "q", printf_test_q, 1);
diff --git a/ext/-test-/proc/extconf.rb b/ext/-test-/proc/extconf.rb
deleted file mode 100644
index 9f87575749..0000000000
--- a/ext/-test-/proc/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/proc")
diff --git a/ext/-test-/proc/init.c b/ext/-test-/proc/init.c
deleted file mode 100644
index 814c55d98b..0000000000
--- a/ext/-test-/proc/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_proc(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_module_under(mBug, "Proc");
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/proc/receiver.c b/ext/-test-/proc/receiver.c
deleted file mode 100644
index fe44a2246c..0000000000
--- a/ext/-test-/proc/receiver.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "ruby.h"
-
-VALUE rb_current_receiver(void);
-
-static VALUE
-bug_proc_call_receiver(RB_BLOCK_CALL_FUNC_ARGLIST(yieldarg, procarg))
-{
- return rb_current_receiver();
-}
-
-static VALUE
-bug_proc_make_call_receiver(VALUE self, VALUE procarg)
-{
- return rb_proc_new(bug_proc_call_receiver, procarg);
-}
-
-void
-Init_receiver(VALUE klass)
-{
- rb_define_singleton_method(klass, "make_call_receiver", bug_proc_make_call_receiver, 1);
-}
diff --git a/ext/-test-/proc/super.c b/ext/-test-/proc/super.c
deleted file mode 100644
index dbe8af08f1..0000000000
--- a/ext/-test-/proc/super.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "ruby.h"
-
-static VALUE
-bug_proc_call_super(RB_BLOCK_CALL_FUNC_ARGLIST(yieldarg, procarg))
-{
- VALUE args[2];
- VALUE ret;
- args[0] = yieldarg;
- args[1] = procarg;
- ret = rb_call_super(2, args);
- if (!NIL_P(blockarg)) {
- ret = rb_proc_call(blockarg, ret);
- }
- return ret;
-}
-
-static VALUE
-bug_proc_make_call_super(VALUE self, VALUE procarg)
-{
- return rb_proc_new(bug_proc_call_super, procarg);
-}
-
-void
-Init_super(VALUE klass)
-{
- rb_define_singleton_method(klass, "make_call_super", bug_proc_make_call_super, 1);
-}
diff --git a/ext/-test-/rational/depend b/ext/-test-/rational/depend
index bff4981ed6..a43589042b 100644
--- a/ext/-test-/rational/depend
+++ b/ext/-test-/rational/depend
@@ -1,20 +1,3 @@
$(OBJS): $(HDRS) $(ruby_headers)
rat.o: rat.c $(top_srcdir)/internal.h
-
-# AUTOGENERATED DEPENDENCIES START
-rat.o: $(RUBY_EXTCONF_H)
-rat.o: $(arch_hdrdir)/ruby/config.h
-rat.o: $(hdrdir)/ruby/defines.h
-rat.o: $(hdrdir)/ruby/encoding.h
-rat.o: $(hdrdir)/ruby/intern.h
-rat.o: $(hdrdir)/ruby/io.h
-rat.o: $(hdrdir)/ruby/missing.h
-rat.o: $(hdrdir)/ruby/oniguruma.h
-rat.o: $(hdrdir)/ruby/ruby.h
-rat.o: $(hdrdir)/ruby/st.h
-rat.o: $(hdrdir)/ruby/subst.h
-rat.o: $(top_srcdir)/include/ruby.h
-rat.o: $(top_srcdir)/internal.h
-rat.o: rat.c
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/-test-/rational/extconf.rb b/ext/-test-/rational/extconf.rb
index 28c5d690c1..bd658def46 100644
--- a/ext/-test-/rational/extconf.rb
+++ b/ext/-test-/rational/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
diff --git a/ext/-test-/rational/rat.c b/ext/-test-/rational/rat.c
index 772546fca8..63ca849816 100644
--- a/ext/-test-/rational/rat.c
+++ b/ext/-test-/rational/rat.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
diff --git a/ext/-test-/recursion/extconf.rb b/ext/-test-/recursion/extconf.rb
deleted file mode 100644
index 13828113f0..0000000000
--- a/ext/-test-/recursion/extconf.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-# frozen_string_literal: false
-require 'mkmf'
-create_makefile("-test-/recursion")
diff --git a/ext/-test-/recursion/recursion.c b/ext/-test-/recursion/recursion.c
deleted file mode 100644
index 13d41f0ba8..0000000000
--- a/ext/-test-/recursion/recursion.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <ruby.h>
-
-static VALUE
-recursive_i(VALUE obj, VALUE mid, int recur)
-{
- if (recur) return Qnil;
- return rb_funcallv(obj, rb_to_id(mid), 0, 0);
-}
-
-static VALUE
-exec_recursive(VALUE self, VALUE mid)
-{
- return rb_exec_recursive(recursive_i, self, mid);
-}
-
-static VALUE
-exec_recursive_outer(VALUE self, VALUE mid)
-{
- return rb_exec_recursive_outer(recursive_i, self, mid);
-}
-
-void
-Init_recursion(void)
-{
- VALUE m = rb_define_module_under(rb_define_module("Bug"), "Recursive");
- rb_define_method(m, "exec_recursive", exec_recursive, 1);
- rb_define_method(m, "exec_recursive_outer", exec_recursive_outer, 1);
-}
diff --git a/ext/-test-/st/foreach/extconf.rb b/ext/-test-/st/foreach/extconf.rb
deleted file mode 100644
index a7346203c4..0000000000
--- a/ext/-test-/st/foreach/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-create_makefile("-test-/st/foreach")
diff --git a/ext/-test-/st/foreach/foreach.c b/ext/-test-/st/foreach/foreach.c
deleted file mode 100644
index 1e0fd515c9..0000000000
--- a/ext/-test-/st/foreach/foreach.c
+++ /dev/null
@@ -1,175 +0,0 @@
-#include <ruby.h>
-#include <ruby/st.h>
-
-static st_data_t expect_size = 32;
-struct checker {
- st_table *tbl;
- st_index_t nr;
- VALUE test;
-};
-
-static void
-force_unpack_check(struct checker *c, st_data_t key, st_data_t val)
-{
- if (c->nr == 0) {
- st_data_t i;
-
- if (!c->tbl->entries_packed) rb_bug("should be packed\n");
-
- /* force unpacking during iteration: */
- for (i = 1; i < expect_size; i++)
- st_add_direct(c->tbl, i, i);
-
- if (c->tbl->entries_packed) rb_bug("should be unpacked\n");
- }
-
- if (key != c->nr) {
- rb_bug("unexpected key: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)key, (VALUE)c->nr);
- }
- if (val != c->nr) {
- rb_bug("unexpected val: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)val, (VALUE)c->nr);
- }
-
- c->nr++;
-}
-
-static int
-unp_fec_i(st_data_t key, st_data_t val, st_data_t args, int error)
-{
- struct checker *c = (struct checker *)args;
-
- if (error) {
- if (c->test == ID2SYM(rb_intern("delete2")))
- return ST_STOP;
-
- rb_bug("unexpected error");
- }
-
- force_unpack_check(c, key, val);
-
- if (c->test == ID2SYM(rb_intern("check"))) {
- return ST_CHECK;
- }
- if (c->test == ID2SYM(rb_intern("delete1"))) {
- if (c->nr == 1) return ST_DELETE;
- return ST_CHECK;
- }
- if (c->test == ID2SYM(rb_intern("delete2"))) {
- if (c->nr == 1) {
- st_data_t k = 0;
- st_data_t v;
-
- if (!st_delete(c->tbl, &k, &v)) {
- rb_bug("failed to delete\n");
- }
- if (v != 0) {
- rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v);
- }
- }
- return ST_CHECK;
- }
-
- rb_raise(rb_eArgError, "unexpected arg: %+"PRIsVALUE, c->test);
-}
-
-static VALUE
-unp_fec(VALUE self, VALUE test)
-{
- st_table *tbl = st_init_numtable();
- struct checker c;
-
- c.tbl = tbl;
- c.nr = 0;
- c.test = test;
-
- st_add_direct(tbl, 0, 0);
-
- if (!tbl->entries_packed) rb_bug("should still be packed\n");
-
- st_foreach_check(tbl, unp_fec_i, (st_data_t)&c, -1);
-
- if (c.test == ID2SYM(rb_intern("delete2"))) {
- if (c.nr != 1) {
- rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr);
- }
- }
- else if (c.nr != expect_size) {
- rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE")\n",
- (VALUE)c.nr, (VALUE)expect_size);
- }
-
- if (tbl->entries_packed) rb_bug("should be unpacked\n");
-
- st_free_table(tbl);
-
- return Qnil;
-}
-
-static int
-unp_fe_i(st_data_t key, st_data_t val, st_data_t args, int error)
-{
- struct checker *c = (struct checker *)args;
-
- force_unpack_check(c, key, val);
- if (c->test == ID2SYM(rb_intern("unpacked"))) {
- return ST_CONTINUE;
- }
- else if (c->test == ID2SYM(rb_intern("unpack_delete"))) {
- if (c->nr == 1) {
- st_data_t k = 0;
- st_data_t v;
-
- if (!st_delete(c->tbl, &k, &v)) {
- rb_bug("failed to delete\n");
- }
- if (v != 0) {
- rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v);
- }
- return ST_CONTINUE;
- }
- rb_bug("should never get here\n");
- }
-
- rb_raise(rb_eArgError, "unexpected arg: %+"PRIsVALUE, c->test);
-}
-
-static VALUE
-unp_fe(VALUE self, VALUE test)
-{
- st_table *tbl = st_init_numtable();
- struct checker c;
-
- c.tbl = tbl;
- c.nr = 0;
- c.test = test;
-
- st_add_direct(tbl, 0, 0);
-
- if (!tbl->entries_packed) rb_bug("should still be packed\n");
-
- st_foreach(tbl, unp_fe_i, (st_data_t)&c);
-
- if (c.test == ID2SYM(rb_intern("unpack_delete"))) {
- if (c.nr != 1) {
- rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr);
- }
- }
- else if (c.nr != expect_size) {
- rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE"o)\n",
- (VALUE)c.nr, (VALUE)expect_size);
- }
-
- if (tbl->entries_packed) rb_bug("should be unpacked\n");
-
- st_free_table(tbl);
-
- return Qnil;
-}
-
-void
-Init_foreach(void)
-{
- VALUE bug = rb_define_module("Bug");
- rb_define_singleton_method(bug, "unp_st_foreach_check", unp_fec, 1);
- rb_define_singleton_method(bug, "unp_st_foreach", unp_fe, 1);
-}
diff --git a/ext/-test-/st/numhash/extconf.rb b/ext/-test-/st/numhash/extconf.rb
index 27d28a0a77..867fd75d2a 100644
--- a/ext/-test-/st/numhash/extconf.rb
+++ b/ext/-test-/st/numhash/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/st/numhash")
diff --git a/ext/-test-/st/numhash/numhash.c b/ext/-test-/st/numhash/numhash.c
index fc35f476cd..d4dbd1a0ce 100644
--- a/ext/-test-/st/numhash/numhash.c
+++ b/ext/-test-/st/numhash/numhash.c
@@ -7,29 +7,16 @@ numhash_free(void *ptr)
if (ptr) st_free_table(ptr);
}
-static size_t
-numhash_memsize(const void *ptr)
-{
- return st_memsize(ptr);
-}
-
-static const rb_data_type_t numhash_type = {
- "numhash",
- {0, numhash_free, numhash_memsize,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED,
-};
-
static VALUE
numhash_alloc(VALUE klass)
{
- return TypedData_Wrap_Struct(klass, &numhash_type, 0);
+ return Data_Wrap_Struct(klass, 0, numhash_free, 0);
}
static VALUE
numhash_init(VALUE self)
{
- st_table *tbl = (st_table *)Check_TypedStruct(self, &numhash_type);
+ st_table *tbl = (st_table *)DATA_PTR(self);
if (tbl) st_free_table(tbl);
DATA_PTR(self) = st_init_numtable();
return self;
@@ -39,9 +26,8 @@ static VALUE
numhash_aref(VALUE self, VALUE key)
{
st_data_t data;
- st_table *tbl = (st_table *)Check_TypedStruct(self, &numhash_type);
if (!SPECIAL_CONST_P(key)) rb_raise(rb_eArgError, "not a special const");
- if (st_lookup(tbl, (st_data_t)key, &data))
+ if (st_lookup((st_table *)DATA_PTR(self), (st_data_t)key, &data))
return (VALUE)data;
return Qnil;
}
@@ -49,10 +35,9 @@ numhash_aref(VALUE self, VALUE key)
static VALUE
numhash_aset(VALUE self, VALUE key, VALUE data)
{
- st_table *tbl = (st_table *)Check_TypedStruct(self, &numhash_type);
if (!SPECIAL_CONST_P(key)) rb_raise(rb_eArgError, "not a special const");
if (!SPECIAL_CONST_P(data)) rb_raise(rb_eArgError, "not a special const");
- st_insert(tbl, (st_data_t)key, (st_data_t)data);
+ st_insert((st_table *)DATA_PTR(self), (st_data_t)key, (st_data_t)data);
return self;
}
@@ -68,7 +53,7 @@ numhash_i(st_data_t key, st_data_t value, st_data_t arg)
static VALUE
numhash_each(VALUE self)
{
- st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type);
+ st_table *table = DATA_PTR(self);
st_data_t data = (st_data_t)self;
return st_foreach_check(table, numhash_i, data, data) ? Qtrue : Qfalse;
}
@@ -91,8 +76,7 @@ update_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
static VALUE
numhash_update(VALUE self, VALUE key)
{
- st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type);
- if (st_update(table, (st_data_t)key, update_func, 0))
+ if (st_update((st_table *)DATA_PTR(self), (st_data_t)key, update_func, 0))
return Qtrue;
else
return Qfalse;
@@ -107,16 +91,14 @@ numhash_update(VALUE self, VALUE key)
static VALUE
numhash_size(VALUE self)
{
- st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type);
- return ST2NUM(table->num_entries);
+ return ST2NUM(((st_table *)DATA_PTR(self))->num_entries);
}
static VALUE
numhash_delete_safe(VALUE self, VALUE key)
{
- st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type);
st_data_t val, k = (st_data_t)key;
- if (st_delete_safe(table, &k, &val, (st_data_t)self)) {
+ if (st_delete_safe((st_table *)DATA_PTR(self), &k, &val, (st_data_t)self)) {
return val;
}
return Qnil;
diff --git a/ext/-test-/st/update/extconf.rb b/ext/-test-/st/update/extconf.rb
index 5152b24229..96dbae43ab 100644
--- a/ext/-test-/st/update/extconf.rb
+++ b/ext/-test-/st/update/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/st/update")
diff --git a/ext/-test-/string/coderange.c b/ext/-test-/string/coderange.c
index b93172d72d..2f1e6a06a8 100644
--- a/ext/-test-/string/coderange.c
+++ b/ext/-test-/string/coderange.c
@@ -2,11 +2,10 @@
#include "ruby/encoding.h"
static VALUE sym_7bit, sym_valid, sym_unknown, sym_broken;
-
static VALUE
-coderange_int2sym(int coderange)
+str_coderange(VALUE str)
{
- switch (coderange) {
+ switch (ENC_CODERANGE(str)) {
case ENC_CODERANGE_7BIT:
return sym_7bit;
case ENC_CODERANGE_VALID:
@@ -20,21 +19,6 @@ coderange_int2sym(int coderange)
UNREACHABLE;
}
-/* return coderange without scan */
-static VALUE
-str_coderange(VALUE str)
-{
- return coderange_int2sym(ENC_CODERANGE(str));
-}
-
-/* scan coderange and return the result */
-static VALUE
-str_coderange_scan(VALUE str)
-{
- ENC_CODERANGE_SET(str, ENC_CODERANGE_UNKNOWN);
- return coderange_int2sym(rb_enc_str_coderange(str));
-}
-
void
Init_coderange(VALUE klass)
{
@@ -43,5 +27,4 @@ Init_coderange(VALUE klass)
sym_unknown = ID2SYM(rb_intern("unknown"));
sym_broken = ID2SYM(rb_intern("broken"));
rb_define_method(klass, "coderange", str_coderange, 0);
- rb_define_method(klass, "coderange_scan", str_coderange_scan, 0);
}
diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c
index 9bd33a344e..c2ed410b41 100644
--- a/ext/-test-/string/cstr.c
+++ b/ext/-test-/string/cstr.c
@@ -1,4 +1,5 @@
-#include "internal.h"
+#include "ruby.h"
+#include "ruby/encoding.h"
static VALUE
bug_str_cstr_term(VALUE str)
@@ -8,7 +9,9 @@ bug_str_cstr_term(VALUE str)
int c;
rb_encoding *enc;
+ rb_str_modify(str);
len = RSTRING_LEN(str);
+ RSTRING_PTR(str)[len] = 'x';
s = StringValueCStr(str);
rb_gc();
enc = rb_enc_get(str);
@@ -16,108 +19,8 @@ bug_str_cstr_term(VALUE str)
return INT2NUM(c);
}
-static VALUE
-bug_str_cstr_unterm(VALUE str, VALUE c)
-{
- long len;
-
- rb_str_modify(str);
- len = RSTRING_LEN(str);
- RSTRING_PTR(str)[len] = NUM2CHR(c);
- return str;
-}
-
-static VALUE
-bug_str_cstr_term_char(VALUE str)
-{
- long len;
- char *s;
- int c;
- rb_encoding *enc = rb_enc_get(str);
-
- RSTRING_GETMEM(str, s, len);
- s += len;
- len = rb_enc_mbminlen(enc);
- c = rb_enc_precise_mbclen(s, s + len, enc);
- if (!MBCLEN_CHARFOUND_P(c)) {
- c = (unsigned char)*s;
- }
- else {
- c = rb_enc_mbc_to_codepoint(s, s + len, enc);
- if (!c) return Qnil;
- }
- return rb_enc_uint_chr((unsigned int)c, enc);
-}
-
-static VALUE
-bug_str_s_cstr_term(VALUE self, VALUE str)
-{
- Check_Type(str, T_STRING);
- return bug_str_cstr_term(str);
-}
-
-static VALUE
-bug_str_s_cstr_unterm(VALUE self, VALUE str, VALUE c)
-{
- Check_Type(str, T_STRING);
- return bug_str_cstr_unterm(str, c);
-}
-
-static VALUE
-bug_str_s_cstr_term_char(VALUE self, VALUE str)
-{
- Check_Type(str, T_STRING);
- return bug_str_cstr_term_char(str);
-}
-
-#define TERM_LEN(str) rb_enc_mbminlen(rb_enc_get(str))
-#define TERM_FILL(ptr, termlen) do {\
- char *const term_fill_ptr = (ptr);\
- const int term_fill_len = (termlen);\
- *term_fill_ptr = '\0';\
- if (UNLIKELY(term_fill_len > 1))\
- memset(term_fill_ptr, 0, term_fill_len);\
-} while (0)
-
-static VALUE
-bug_str_s_cstr_noembed(VALUE self, VALUE str)
-{
- VALUE str2 = rb_str_new(NULL, 0);
- long capacity = RSTRING_LEN(str) + TERM_LEN(str);
- char *buf = ALLOC_N(char, capacity);
- Check_Type(str, T_STRING);
- FL_SET((str2), STR_NOEMBED);
- memcpy(buf, RSTRING_PTR(str), capacity);
- RBASIC(str2)->flags &= ~RSTRING_EMBED_LEN_MASK;
- RSTRING(str2)->as.heap.aux.capa = capacity;
- RSTRING(str2)->as.heap.ptr = buf;
- RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
- TERM_FILL(RSTRING_END(str2), TERM_LEN(str));
- return str2;
-}
-
-static VALUE
-bug_str_s_cstr_embedded_p(VALUE self, VALUE str)
-{
- return STR_EMBED_P(str) ? Qtrue : Qfalse;
-}
-
-static VALUE
-bug_str_s_rb_str_new_frozen(VALUE self, VALUE str)
-{
- return rb_str_new_frozen(str);
-}
-
void
Init_cstr(VALUE klass)
{
rb_define_method(klass, "cstr_term", bug_str_cstr_term, 0);
- rb_define_method(klass, "cstr_unterm", bug_str_cstr_unterm, 1);
- rb_define_method(klass, "cstr_term_char", bug_str_cstr_term_char, 0);
- rb_define_singleton_method(klass, "cstr_term", bug_str_s_cstr_term, 1);
- rb_define_singleton_method(klass, "cstr_unterm", bug_str_s_cstr_unterm, 2);
- rb_define_singleton_method(klass, "cstr_term_char", bug_str_s_cstr_term_char, 1);
- rb_define_singleton_method(klass, "cstr_noembed", bug_str_s_cstr_noembed, 1);
- rb_define_singleton_method(klass, "cstr_embedded?", bug_str_s_cstr_embedded_p, 1);
- rb_define_singleton_method(klass, "rb_str_new_frozen", bug_str_s_rb_str_new_frozen, 1);
}
diff --git a/ext/-test-/string/depend b/ext/-test-/string/depend
index ef13e44df5..86617ff289 100644
--- a/ext/-test-/string/depend
+++ b/ext/-test-/string/depend
@@ -1,115 +1,5 @@
-# AUTOGENERATED DEPENDENCIES START
-coderange.o: $(RUBY_EXTCONF_H)
-coderange.o: $(arch_hdrdir)/ruby/config.h
-coderange.o: $(hdrdir)/ruby/defines.h
-coderange.o: $(hdrdir)/ruby/encoding.h
-coderange.o: $(hdrdir)/ruby/intern.h
-coderange.o: $(hdrdir)/ruby/missing.h
-coderange.o: $(hdrdir)/ruby/oniguruma.h
-coderange.o: $(hdrdir)/ruby/ruby.h
-coderange.o: $(hdrdir)/ruby/st.h
-coderange.o: $(hdrdir)/ruby/subst.h
-coderange.o: coderange.c
-cstr.o: $(RUBY_EXTCONF_H)
-cstr.o: $(arch_hdrdir)/ruby/config.h
-cstr.o: $(hdrdir)/ruby/defines.h
-cstr.o: $(hdrdir)/ruby/encoding.h
-cstr.o: $(hdrdir)/ruby/intern.h
-cstr.o: $(hdrdir)/ruby/missing.h
-cstr.o: $(hdrdir)/ruby/oniguruma.h
-cstr.o: $(hdrdir)/ruby/ruby.h
-cstr.o: $(hdrdir)/ruby/st.h
-cstr.o: $(hdrdir)/ruby/subst.h
-cstr.o: $(top_srcdir)/include/ruby.h
-cstr.o: cstr.c
-ellipsize.o: $(RUBY_EXTCONF_H)
-ellipsize.o: $(arch_hdrdir)/ruby/config.h
-ellipsize.o: $(hdrdir)/ruby/defines.h
-ellipsize.o: $(hdrdir)/ruby/intern.h
-ellipsize.o: $(hdrdir)/ruby/missing.h
-ellipsize.o: $(hdrdir)/ruby/ruby.h
-ellipsize.o: $(hdrdir)/ruby/st.h
-ellipsize.o: $(hdrdir)/ruby/subst.h
-ellipsize.o: $(top_srcdir)/include/ruby.h
-ellipsize.o: ellipsize.c
-enc_associate.o: $(RUBY_EXTCONF_H)
-enc_associate.o: $(arch_hdrdir)/ruby/config.h
-enc_associate.o: $(hdrdir)/ruby/defines.h
-enc_associate.o: $(hdrdir)/ruby/encoding.h
-enc_associate.o: $(hdrdir)/ruby/intern.h
-enc_associate.o: $(hdrdir)/ruby/missing.h
-enc_associate.o: $(hdrdir)/ruby/oniguruma.h
-enc_associate.o: $(hdrdir)/ruby/ruby.h
-enc_associate.o: $(hdrdir)/ruby/st.h
-enc_associate.o: $(hdrdir)/ruby/subst.h
-enc_associate.o: $(top_srcdir)/include/ruby.h
-enc_associate.o: enc_associate.c
-enc_str_buf_cat.o: $(RUBY_EXTCONF_H)
-enc_str_buf_cat.o: $(arch_hdrdir)/ruby/config.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/defines.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/encoding.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/intern.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/missing.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/oniguruma.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/ruby.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/st.h
-enc_str_buf_cat.o: $(hdrdir)/ruby/subst.h
-enc_str_buf_cat.o: enc_str_buf_cat.c
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: init.c
-modify.o: $(RUBY_EXTCONF_H)
-modify.o: $(arch_hdrdir)/ruby/config.h
-modify.o: $(hdrdir)/ruby/defines.h
-modify.o: $(hdrdir)/ruby/intern.h
-modify.o: $(hdrdir)/ruby/missing.h
-modify.o: $(hdrdir)/ruby/ruby.h
-modify.o: $(hdrdir)/ruby/st.h
-modify.o: $(hdrdir)/ruby/subst.h
-modify.o: $(top_srcdir)/include/ruby.h
-modify.o: modify.c
-normalize.o: $(RUBY_EXTCONF_H)
-normalize.o: $(arch_hdrdir)/ruby/config.h
-normalize.o: $(hdrdir)/ruby/defines.h
-normalize.o: $(hdrdir)/ruby/encoding.h
-normalize.o: $(hdrdir)/ruby/intern.h
-normalize.o: $(hdrdir)/ruby/io.h
-normalize.o: $(hdrdir)/ruby/missing.h
-normalize.o: $(hdrdir)/ruby/oniguruma.h
-normalize.o: $(hdrdir)/ruby/ruby.h
-normalize.o: $(hdrdir)/ruby/st.h
-normalize.o: $(hdrdir)/ruby/subst.h
-normalize.o: $(top_srcdir)/include/ruby.h
-normalize.o: $(top_srcdir)/internal.h
-normalize.o: normalize.c
-qsort.o: $(RUBY_EXTCONF_H)
-qsort.o: $(arch_hdrdir)/ruby/config.h
-qsort.o: $(hdrdir)/ruby/defines.h
-qsort.o: $(hdrdir)/ruby/encoding.h
-qsort.o: $(hdrdir)/ruby/intern.h
-qsort.o: $(hdrdir)/ruby/missing.h
-qsort.o: $(hdrdir)/ruby/oniguruma.h
-qsort.o: $(hdrdir)/ruby/ruby.h
-qsort.o: $(hdrdir)/ruby/st.h
-qsort.o: $(hdrdir)/ruby/subst.h
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
qsort.o: $(hdrdir)/ruby/util.h
-qsort.o: $(top_srcdir)/include/ruby.h
-qsort.o: qsort.c
-set_len.o: $(RUBY_EXTCONF_H)
-set_len.o: $(arch_hdrdir)/ruby/config.h
-set_len.o: $(hdrdir)/ruby/defines.h
-set_len.o: $(hdrdir)/ruby/intern.h
-set_len.o: $(hdrdir)/ruby/missing.h
-set_len.o: $(hdrdir)/ruby/ruby.h
-set_len.o: $(hdrdir)/ruby/st.h
-set_len.o: $(hdrdir)/ruby/subst.h
-set_len.o: $(top_srcdir)/include/ruby.h
-set_len.o: set_len.c
-# AUTOGENERATED DEPENDENCIES END
+normalize.o: $(top_srcdir)/internal.h
diff --git a/ext/-test-/string/enc_associate.c b/ext/-test-/string/enc_associate.c
index 53811620a0..d6614fb298 100644
--- a/ext/-test-/string/enc_associate.c
+++ b/ext/-test-/string/enc_associate.c
@@ -7,16 +7,8 @@ bug_str_enc_associate(VALUE str, VALUE enc)
return rb_enc_associate(str, rb_to_encoding(enc));
}
-VALUE
-bug_str_encoding_index(VALUE self, VALUE str)
-{
- int idx = rb_enc_get_index(str);
- return INT2NUM(idx);
-}
-
void
Init_enc_associate(VALUE klass)
{
rb_define_method(klass, "associate_encoding!", bug_str_enc_associate, 1);
- rb_define_singleton_method(klass, "encoding_index", bug_str_encoding_index, 1);
}
diff --git a/ext/-test-/string/extconf.rb b/ext/-test-/string/extconf.rb
index 5e8b709c8a..10d33cbab9 100644
--- a/ext/-test-/string/extconf.rb
+++ b/ext/-test-/string/extconf.rb
@@ -1,8 +1,7 @@
-# frozen_string_literal: false
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
inits.map! {|s|"X(#{s})"}
$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/string")
+create_makefile("-test-/string/string")
diff --git a/ext/-test-/string/fstring.c b/ext/-test-/string/fstring.c
deleted file mode 100644
index b65c98ce6d..0000000000
--- a/ext/-test-/string/fstring.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "ruby.h"
-
-VALUE rb_fstring(VALUE str);
-
-VALUE
-bug_s_fstring(VALUE self, VALUE str)
-{
- return rb_fstring(str);
-}
-
-void
-Init_fstring(VALUE klass)
-{
- rb_define_singleton_method(klass, "fstring", bug_s_fstring, 1);
-}
diff --git a/ext/-test-/string/nofree.c b/ext/-test-/string/nofree.c
deleted file mode 100644
index d3d8071ff9..0000000000
--- a/ext/-test-/string/nofree.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "ruby.h"
-
-VALUE
-bug_str_nofree(VALUE self)
-{
- return rb_str_new_cstr("abcdef");
-}
-
-void
-Init_nofree(VALUE klass)
-{
- rb_define_singleton_method(klass, "nofree", bug_str_nofree, 0);
-}
diff --git a/ext/-test-/string/normalize.c b/ext/-test-/string/normalize.c
index 2e16a4616f..22bb6d7887 100644
--- a/ext/-test-/string/normalize.c
+++ b/ext/-test-/string/normalize.c
@@ -1,3 +1,4 @@
+#include "ruby.h"
#include "internal.h"
#ifdef __APPLE__
diff --git a/ext/-test-/struct/duplicate.c b/ext/-test-/struct/duplicate.c
deleted file mode 100644
index 596d32aad8..0000000000
--- a/ext/-test-/struct/duplicate.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "ruby.h"
-
-static VALUE
-bug_struct_new_duplicate(VALUE obj, VALUE name, VALUE mem)
-{
- const char *n = NIL_P(name) ? 0 : StringValueCStr(name);
- const char *m = StringValueCStr(mem);
- return rb_struct_define(n, m, m, NULL);
-}
-
-static VALUE
-bug_struct_new_duplicate_under(VALUE obj, VALUE name, VALUE mem)
-{
- const char *n = StringValueCStr(name);
- const char *m = StringValueCStr(mem);
- return rb_struct_define_under(obj, n, m, m, NULL);
-}
-
-void
-Init_duplicate(VALUE klass)
-{
- rb_define_singleton_method(klass, "new_duplicate", bug_struct_new_duplicate, 2);
- rb_define_singleton_method(klass, "new_duplicate_under", bug_struct_new_duplicate_under, 2);
-}
diff --git a/ext/-test-/struct/extconf.rb b/ext/-test-/struct/extconf.rb
deleted file mode 100644
index 3b01a193fc..0000000000
--- a/ext/-test-/struct/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/struct")
diff --git a/ext/-test-/struct/init.c b/ext/-test-/struct/init.c
deleted file mode 100644
index 459a939e79..0000000000
--- a/ext/-test-/struct/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_struct(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_class_under(mBug, "Struct", rb_cStruct);
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/struct/member.c b/ext/-test-/struct/member.c
deleted file mode 100644
index 1d404039b4..0000000000
--- a/ext/-test-/struct/member.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "ruby.h"
-
-static VALUE
-bug_struct_get(VALUE obj, VALUE name)
-{
- ID id = rb_check_id(&name);
-
- if (!id) {
- rb_name_error_str(name, "`%"PRIsVALUE"' is not a struct member", name);
- }
- return rb_struct_getmember(obj, id);
-}
-
-void
-Init_member(VALUE klass)
-{
- rb_define_method(klass, "get", bug_struct_get, 1);
-}
diff --git a/ext/-test-/symbol/extconf.rb b/ext/-test-/symbol/extconf.rb
index f62fd47c11..0b7c3876fa 100644
--- a/ext/-test-/symbol/extconf.rb
+++ b/ext/-test-/symbol/extconf.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: false
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
inits.map! {|s|"X(#{s})"}
$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-have_func("rb_pin_dynamic_symbol")
create_makefile("-test-/symbol")
diff --git a/ext/-test-/symbol/init.c b/ext/-test-/symbol/init.c
index 9e42e1a38b..e740345f2a 100644
--- a/ext/-test-/symbol/init.c
+++ b/ext/-test-/symbol/init.c
@@ -2,24 +2,10 @@
#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-static VALUE
-sym_find(VALUE dummy, VALUE sym)
-{
- return rb_check_symbol(&sym);
-}
-
-static VALUE
-sym_pinneddown_p(VALUE dummy, VALUE sym)
-{
- return rb_check_id(&sym) ? Qtrue : Qfalse;
-}
-
void
Init_symbol(void)
{
VALUE mBug = rb_define_module("Bug");
VALUE klass = rb_define_class_under(mBug, "Symbol", rb_cSymbol);
- rb_define_singleton_method(klass, "find", sym_find, 1);
- rb_define_singleton_method(klass, "pinneddown?", sym_pinneddown_p, 1);
TEST_INIT_FUNCS(init);
}
diff --git a/ext/-test-/symbol/intern.c b/ext/-test-/symbol/intern.c
new file mode 100644
index 0000000000..6ae86a6104
--- /dev/null
+++ b/ext/-test-/symbol/intern.c
@@ -0,0 +1,14 @@
+#include "ruby.h"
+
+static VALUE
+bug_sym_interned_p(VALUE self, VALUE name)
+{
+ ID id = rb_check_id(&name);
+ return id ? Qtrue : Qfalse;
+}
+
+void
+Init_intern(VALUE klass)
+{
+ rb_define_singleton_method(klass, "interned?", bug_sym_interned_p, 1);
+}
diff --git a/ext/-test-/symbol/type.c b/ext/-test-/symbol/type.c
index e51e09eb26..e0b2fff2f9 100644
--- a/ext/-test-/symbol/type.c
+++ b/ext/-test-/symbol/type.c
@@ -35,44 +35,9 @@ bug_sym_attrset(VALUE self, VALUE name)
return ID2SYM(id);
}
-static VALUE
-bug_id2str(VALUE self, VALUE sym)
-{
- return rb_sym2str(sym);
-}
-
-static VALUE
-bug_static_p(VALUE self, VALUE sym)
-{
- return STATIC_SYM_P(sym) ? Qtrue : Qfalse;
-}
-
-static VALUE
-bug_dynamic_p(VALUE self, VALUE sym)
-{
- return DYNAMIC_SYM_P(sym) ? Qtrue : Qfalse;
-}
-
-#ifdef HAVE_RB_PIN_DYNAMIC_SYMBOL
-ID rb_pin_dynamic_symbol(VALUE);
-
-static VALUE
-bug_pindown(VALUE self, VALUE sym)
-{
- rb_pin_dynamic_symbol(sym);
- return sym;
-}
-#endif
-
void
Init_type(VALUE klass)
{
FOREACH_ID_TYPES(declare_symbol_type_p);
rb_define_singleton_method(klass, "attrset", bug_sym_attrset, 1);
- rb_define_singleton_method(klass, "id2str", bug_id2str, 1);
- rb_define_singleton_method(klass, "static?", bug_static_p, 1);
- rb_define_singleton_method(klass, "dynamic?", bug_dynamic_p, 1);
-#ifdef HAVE_RB_PIN_DYNAMIC_SYMBOL
- rb_define_singleton_method(klass, "pindown", bug_pindown, 1);
-#endif
}
diff --git a/ext/-test-/thread_fd_close/depend b/ext/-test-/thread_fd_close/depend
deleted file mode 100644
index 091074309a..0000000000
--- a/ext/-test-/thread_fd_close/depend
+++ /dev/null
@@ -1,14 +0,0 @@
-# AUTOGENERATED DEPENDENCIES START
-thread_fd_close.o: $(RUBY_EXTCONF_H)
-thread_fd_close.o: $(arch_hdrdir)/ruby/config.h
-thread_fd_close.o: $(hdrdir)/ruby/defines.h
-thread_fd_close.o: $(hdrdir)/ruby/encoding.h
-thread_fd_close.o: $(hdrdir)/ruby/intern.h
-thread_fd_close.o: $(hdrdir)/ruby/io.h
-thread_fd_close.o: $(hdrdir)/ruby/missing.h
-thread_fd_close.o: $(hdrdir)/ruby/oniguruma.h
-thread_fd_close.o: $(hdrdir)/ruby/ruby.h
-thread_fd_close.o: $(hdrdir)/ruby/st.h
-thread_fd_close.o: $(hdrdir)/ruby/subst.h
-thread_fd_close.o: thread_fd_close.c
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/-test-/thread_fd_close/extconf.rb b/ext/-test-/thread_fd_close/extconf.rb
deleted file mode 100644
index 0d9694539c..0000000000
--- a/ext/-test-/thread_fd_close/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: true
-create_makefile('-test-/thread_fd_close')
diff --git a/ext/-test-/thread_fd_close/thread_fd_close.c b/ext/-test-/thread_fd_close/thread_fd_close.c
deleted file mode 100644
index 4fd967c5b3..0000000000
--- a/ext/-test-/thread_fd_close/thread_fd_close.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "ruby/ruby.h"
-
-static VALUE
-thread_fd_close(VALUE ign, VALUE fd)
-{
- rb_thread_fd_close(NUM2INT(fd));
- return Qnil;
-}
-
-void
-Init_thread_fd_close(void)
-{
- rb_define_singleton_method(rb_cIO, "thread_fd_close", thread_fd_close, 1);
-}
diff --git a/ext/-test-/time/extconf.rb b/ext/-test-/time/extconf.rb
deleted file mode 100644
index c0b193445c..0000000000
--- a/ext/-test-/time/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/time")
diff --git a/ext/-test-/time/init.c b/ext/-test-/time/init.c
deleted file mode 100644
index 01a20b8b3d..0000000000
--- a/ext/-test-/time/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_time(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_class_under(mBug, "Time", rb_cTime);
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/time/new.c b/ext/-test-/time/new.c
deleted file mode 100644
index 0f71a5542b..0000000000
--- a/ext/-test-/time/new.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "ruby.h"
-
-static VALUE
-bug_time_s_nano_new(VALUE klass, VALUE sec, VALUE nsec)
-{
- return rb_time_nano_new(NUM2TIMET(sec), NUM2LONG(nsec));
-}
-
-static VALUE
-bug_time_s_timespec_new(VALUE klass, VALUE sec, VALUE nsec, VALUE gmtoff)
-{
- struct timespec ts;
- ts.tv_sec = NUM2TIMET(sec);
- ts.tv_nsec = NUM2LONG(nsec);
- return rb_time_timespec_new(&ts, NUM2INT(gmtoff));
-}
-
-static VALUE
-bug_time_s_timespec_now(VALUE klass)
-{
- struct timespec ts;
- VALUE v;
- rb_timespec_now(&ts);
- v = rb_Rational(LONG2NUM(ts.tv_nsec), LONG2NUM(1000000000L));
- return rb_num_coerce_bin(TIMET2NUM(ts.tv_sec), v, '+');
-}
-
-void
-Init_new(VALUE klass)
-{
- rb_define_singleton_method(klass, "nano_new", bug_time_s_nano_new, 2);
- rb_define_singleton_method(klass, "timespec_new", bug_time_s_timespec_new, 3);
- rb_define_singleton_method(klass, "timespec_now", bug_time_s_timespec_now, 0);
-}
diff --git a/ext/-test-/tracepoint/depend b/ext/-test-/tracepoint/depend
index 741bad0386..8d4e5ab343 100644
--- a/ext/-test-/tracepoint/depend
+++ b/ext/-test-/tracepoint/depend
@@ -1,22 +1 @@
-# AUTOGENERATED DEPENDENCIES START
-gc_hook.o: $(RUBY_EXTCONF_H)
-gc_hook.o: $(arch_hdrdir)/ruby/config.h
-gc_hook.o: $(hdrdir)/ruby/debug.h
-gc_hook.o: $(hdrdir)/ruby/defines.h
-gc_hook.o: $(hdrdir)/ruby/intern.h
-gc_hook.o: $(hdrdir)/ruby/missing.h
-gc_hook.o: $(hdrdir)/ruby/ruby.h
-gc_hook.o: $(hdrdir)/ruby/st.h
-gc_hook.o: $(hdrdir)/ruby/subst.h
-gc_hook.o: gc_hook.c
-tracepoint.o: $(RUBY_EXTCONF_H)
-tracepoint.o: $(arch_hdrdir)/ruby/config.h
-tracepoint.o: $(hdrdir)/ruby/debug.h
-tracepoint.o: $(hdrdir)/ruby/defines.h
-tracepoint.o: $(hdrdir)/ruby/intern.h
-tracepoint.o: $(hdrdir)/ruby/missing.h
-tracepoint.o: $(hdrdir)/ruby/ruby.h
-tracepoint.o: $(hdrdir)/ruby/st.h
-tracepoint.o: $(hdrdir)/ruby/subst.h
-tracepoint.o: tracepoint.c
-# AUTOGENERATED DEPENDENCIES END
+tracepoint.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
diff --git a/ext/-test-/tracepoint/extconf.rb b/ext/-test-/tracepoint/extconf.rb
index 2b7258d072..c0c2399eb4 100644
--- a/ext/-test-/tracepoint/extconf.rb
+++ b/ext/-test-/tracepoint/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/tracepoint")
diff --git a/ext/-test-/tracepoint/gc_hook.c b/ext/-test-/tracepoint/gc_hook.c
deleted file mode 100644
index 6d8485ecb1..0000000000
--- a/ext/-test-/tracepoint/gc_hook.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "ruby/ruby.h"
-#include "ruby/debug.h"
-
-static int invoking; /* TODO: should not be global variable */
-
-static VALUE
-invoke_proc_ensure(void *dmy)
-{
- invoking = 0;
- return Qnil;
-}
-
-static VALUE
-invoke_proc_begin(VALUE proc)
-{
- return rb_proc_call(proc, rb_ary_new());
-}
-
-static void
-invoke_proc(void *data)
-{
- VALUE proc = (VALUE)data;
- invoking += 1;
- rb_ensure(invoke_proc_begin, proc, invoke_proc_ensure, 0);
-}
-
-static void
-gc_start_end_i(VALUE tpval, void *data)
-{
- if (0) {
- rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
- fprintf(stderr, "trace: %s\n", rb_tracearg_event_flag(tparg) == RUBY_INTERNAL_EVENT_GC_START ? "gc_start" : "gc_end");
- }
-
- if (invoking == 0) {
- rb_postponed_job_register(0, invoke_proc, data);
- }
-}
-
-static VALUE
-set_gc_hook(VALUE module, VALUE proc, rb_event_flag_t event, const char *tp_str, const char *proc_str)
-{
- VALUE tpval;
- ID tp_key = rb_intern(tp_str);
- ID proc_key = rb_intern(proc_str);
-
- /* disable previous keys */
- if (rb_ivar_defined(module, tp_key) != 0 &&
- RTEST(tpval = rb_ivar_get(module, tp_key))) {
- rb_tracepoint_disable(tpval);
- rb_ivar_set(module, tp_key, Qnil);
- rb_ivar_set(module, proc_key, Qnil);
- }
-
- if (RTEST(proc)) {
- if (!rb_obj_is_proc(proc)) {
- rb_raise(rb_eTypeError, "trace_func needs to be Proc");
- }
-
- tpval = rb_tracepoint_new(0, event, gc_start_end_i, (void *)proc);
- rb_ivar_set(module, tp_key, tpval);
- rb_ivar_set(module, proc_key, proc); /* GC guard */
- rb_tracepoint_enable(tpval);
- }
-
- return proc;
-}
-
-static VALUE
-set_after_gc_start(VALUE module, VALUE proc)
-{
- return set_gc_hook(module, proc, RUBY_INTERNAL_EVENT_GC_START,
- "__set_after_gc_start_tpval__", "__set_after_gc_start_proc__");
-}
-
-void
-Init_gc_hook(VALUE module)
-{
- rb_define_module_function(module, "after_gc_start_hook=", set_after_gc_start, 1);
-}
diff --git a/ext/-test-/tracepoint/tracepoint.c b/ext/-test-/tracepoint/tracepoint.c
index aa8c212f99..a974c2c611 100644
--- a/ext/-test-/tracepoint/tracepoint.c
+++ b/ext/-test-/tracepoint/tracepoint.c
@@ -5,8 +5,7 @@ struct tracepoint_track {
size_t newobj_count;
size_t free_count;
size_t gc_start_count;
- size_t gc_end_mark_count;
- size_t gc_end_sweep_count;
+ size_t gc_end_count;
size_t objects_count;
VALUE objects[10];
};
@@ -38,14 +37,9 @@ tracepoint_track_objspace_events_i(VALUE tpval, void *data)
track->gc_start_count++;
break;
}
- case RUBY_INTERNAL_EVENT_GC_END_MARK:
+ case RUBY_INTERNAL_EVENT_GC_END:
{
- track->gc_end_mark_count++;
- break;
- }
- case RUBY_INTERNAL_EVENT_GC_END_SWEEP:
- {
- track->gc_end_sweep_count++;
+ track->gc_end_count++;
break;
}
default:
@@ -58,39 +52,26 @@ tracepoint_track_objspace_events(VALUE self)
{
struct tracepoint_track track = {0, 0, 0, 0, 0,};
VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_INTERNAL_EVENT_FREEOBJ |
- RUBY_INTERNAL_EVENT_GC_START | RUBY_INTERNAL_EVENT_GC_END_MARK |
- RUBY_INTERNAL_EVENT_GC_END_SWEEP,
+ RUBY_INTERNAL_EVENT_GC_START | RUBY_INTERNAL_EVENT_GC_END,
tracepoint_track_objspace_events_i, &track);
VALUE result = rb_ary_new();
rb_tracepoint_enable(tpval);
- rb_ensure(rb_yield, Qundef, rb_tracepoint_disable, tpval);
+ rb_yield(Qundef);
+ rb_tracepoint_disable(tpval);
rb_ary_push(result, SIZET2NUM(track.newobj_count));
rb_ary_push(result, SIZET2NUM(track.free_count));
rb_ary_push(result, SIZET2NUM(track.gc_start_count));
- rb_ary_push(result, SIZET2NUM(track.gc_end_mark_count));
- rb_ary_push(result, SIZET2NUM(track.gc_end_sweep_count));
+ rb_ary_push(result, SIZET2NUM(track.gc_end_count));
rb_ary_cat(result, track.objects, track.objects_count);
return result;
}
-static VALUE
-tracepoint_specify_normal_and_internal_events(VALUE self)
-{
- VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_EVENT_CALL, 0, 0);
- rb_tracepoint_enable(tpval);
- return Qnil; /* should not be reached */
-}
-
-void Init_gc_hook(VALUE);
-
void
Init_tracepoint(void)
{
VALUE mBug = rb_define_module("Bug");
- Init_gc_hook(mBug);
rb_define_module_function(mBug, "tracepoint_track_objspace_events", tracepoint_track_objspace_events, 0);
- rb_define_module_function(mBug, "tracepoint_specify_normal_and_internal_events", tracepoint_specify_normal_and_internal_events, 0);
}
diff --git a/ext/-test-/typeddata/extconf.rb b/ext/-test-/typeddata/extconf.rb
index 84b92c7530..02e3e41c8b 100644
--- a/ext/-test-/typeddata/extconf.rb
+++ b/ext/-test-/typeddata/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/typeddata/typeddata")
diff --git a/ext/-test-/typeddata/typeddata.c b/ext/-test-/typeddata/typeddata.c
index ae060960cd..1c5d677713 100644
--- a/ext/-test-/typeddata/typeddata.c
+++ b/ext/-test-/typeddata/typeddata.c
@@ -2,43 +2,19 @@
static const rb_data_type_t test_data = {
"typed_data",
- {NULL, ruby_xfree, NULL},
- NULL, NULL,
- 0/* deferred free */,
};
static VALUE
-test_alloc(VALUE klass)
-{
- char *p;
- return TypedData_Make_Struct(klass, char, &test_data, p);
-}
-
-static VALUE
test_check(VALUE self, VALUE obj)
{
rb_check_typeddata(obj, &test_data);
return obj;
}
-static VALUE
-test_make(VALUE klass, VALUE num)
-{
- unsigned long i, n = NUM2UINT(num);
-
- for (i = 0; i < n; i++) {
- test_alloc(klass);
- }
-
- return Qnil;
-}
-
void
Init_typeddata(void)
{
VALUE mBug = rb_define_module("Bug");
VALUE klass = rb_define_class_under(mBug, "TypedData", rb_cData);
- rb_define_alloc_func(klass, test_alloc);
rb_define_singleton_method(klass, "check", test_check, 1);
- rb_define_singleton_method(klass, "make", test_make, 1);
}
diff --git a/ext/-test-/vm/at_exit.c b/ext/-test-/vm/at_exit.c
deleted file mode 100644
index 6cfbfafa9e..0000000000
--- a/ext/-test-/vm/at_exit.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <ruby/ruby.h>
-#include <ruby/vm.h>
-
-static void
-do_nothing(ruby_vm_t *vm)
-{
-}
-
-static void
-print_begin(ruby_vm_t *vm)
-{
- printf("begin\n");
-}
-
-static void
-print_end(ruby_vm_t *vm)
-{
- printf("end\n");
-}
-
-static VALUE
-register_at_exit(VALUE self, VALUE t)
-{
- switch (t) {
- case Qtrue:
- ruby_vm_at_exit(print_begin);
- break;
- case Qfalse:
- ruby_vm_at_exit(print_end);
- break;
- default:
- ruby_vm_at_exit(do_nothing);
- break;
- }
- return self;
-}
-
-void
-Init_at_exit(void)
-{
- VALUE m = rb_define_module("Bug");
- VALUE c = rb_define_class_under(m, "VM", rb_cObject);
- rb_define_singleton_method(c, "register_at_exit", register_at_exit, 1);
-}
diff --git a/ext/-test-/vm/extconf.rb b/ext/-test-/vm/extconf.rb
deleted file mode 100644
index 614ec960d8..0000000000
--- a/ext/-test-/vm/extconf.rb
+++ /dev/null
@@ -1 +0,0 @@
-create_makefile('-test-/vm/at_exit')
diff --git a/ext/-test-/wait_for_single_fd/depend b/ext/-test-/wait_for_single_fd/depend
index fddd41053f..b94e507631 100644
--- a/ext/-test-/wait_for_single_fd/depend
+++ b/ext/-test-/wait_for_single_fd/depend
@@ -1,14 +1,4 @@
-# AUTOGENERATED DEPENDENCIES START
-wait_for_single_fd.o: $(RUBY_EXTCONF_H)
-wait_for_single_fd.o: $(arch_hdrdir)/ruby/config.h
-wait_for_single_fd.o: $(hdrdir)/ruby/defines.h
-wait_for_single_fd.o: $(hdrdir)/ruby/encoding.h
-wait_for_single_fd.o: $(hdrdir)/ruby/intern.h
-wait_for_single_fd.o: $(hdrdir)/ruby/io.h
-wait_for_single_fd.o: $(hdrdir)/ruby/missing.h
-wait_for_single_fd.o: $(hdrdir)/ruby/oniguruma.h
-wait_for_single_fd.o: $(hdrdir)/ruby/ruby.h
-wait_for_single_fd.o: $(hdrdir)/ruby/st.h
-wait_for_single_fd.o: $(hdrdir)/ruby/subst.h
-wait_for_single_fd.o: wait_for_single_fd.c
-# AUTOGENERATED DEPENDENCIES END
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/io.h
diff --git a/ext/-test-/wait_for_single_fd/extconf.rb b/ext/-test-/wait_for_single_fd/extconf.rb
index edb18746d1..1a28b23da3 100644
--- a/ext/-test-/wait_for_single_fd/extconf.rb
+++ b/ext/-test-/wait_for_single_fd/extconf.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
create_makefile("-test-/wait_for_single_fd/wait_for_single_fd")
diff --git a/ext/-test-/win32/console/attribute.c b/ext/-test-/win32/console/attribute.c
deleted file mode 100644
index a2c07fc4fe..0000000000
--- a/ext/-test-/win32/console/attribute.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <ruby.h>
-
-static VALUE rb_cConsoleScreenBufferInfo;
-
-static VALUE
-console_info(VALUE io)
-{
- int fd = NUM2INT(rb_funcallv(io, rb_intern("fileno"), 0, 0));
- HANDLE h = (HANDLE)rb_w32_get_osfhandle(fd);
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- if (h == (HANDLE)-1) rb_raise(rb_eIOError, "invalid io");
- if (!GetConsoleScreenBufferInfo(h, &csbi))
- rb_syserr_fail(rb_w32_map_errno(GetLastError()), "not console");
- return rb_struct_new(rb_cConsoleScreenBufferInfo,
- INT2FIX(csbi.dwSize.X), INT2FIX(csbi.dwSize.Y),
- INT2FIX(csbi.dwCursorPosition.X), INT2FIX(csbi.dwCursorPosition.Y),
- INT2FIX(csbi.wAttributes));
-}
-
-static VALUE
-console_set_attribute(VALUE io, VALUE attr)
-{
- int fd = NUM2INT(rb_funcallv(io, rb_intern("fileno"), 0, 0));
- HANDLE h = (HANDLE)rb_w32_get_osfhandle(fd);
-
- if (h == (HANDLE)-1) rb_raise(rb_eIOError, "invalid io");
- SetConsoleTextAttribute(h, (WORD)NUM2INT(attr));
- return Qnil;
-}
-
-#define FOREGROUND_MASK (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
-#define BACKGROUND_MASK (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
-
-void
-Init_attribute(VALUE m)
-{
- rb_cConsoleScreenBufferInfo = rb_struct_define_under(m, "ConsoleScreenBufferInfo",
- "size_x", "size_y",
- "cur_x", "cur_y",
- "attr", NULL);
- rb_define_method(rb_cIO, "console_info", console_info, 0);
- rb_define_method(rb_cIO, "console_attribute", console_set_attribute, 1);
-
- rb_define_const(m, "FOREGROUND_MASK", INT2FIX(FOREGROUND_MASK));
- rb_define_const(m, "FOREGROUND_BLUE", INT2FIX(FOREGROUND_BLUE));
- rb_define_const(m, "FOREGROUND_GREEN", INT2FIX(FOREGROUND_GREEN));
- rb_define_const(m, "FOREGROUND_RED", INT2FIX(FOREGROUND_RED));
- rb_define_const(m, "FOREGROUND_INTENSITY", INT2FIX(FOREGROUND_INTENSITY));
-
- rb_define_const(m, "BACKGROUND_MASK", INT2FIX(BACKGROUND_MASK));
- rb_define_const(m, "BACKGROUND_BLUE", INT2FIX(BACKGROUND_BLUE));
- rb_define_const(m, "BACKGROUND_GREEN", INT2FIX(BACKGROUND_GREEN));
- rb_define_const(m, "BACKGROUND_RED", INT2FIX(BACKGROUND_RED));
- rb_define_const(m, "BACKGROUND_INTENSITY", INT2FIX(BACKGROUND_INTENSITY));
-}
diff --git a/ext/-test-/win32/console/depend b/ext/-test-/win32/console/depend
deleted file mode 100644
index f4f65adf9a..0000000000
--- a/ext/-test-/win32/console/depend
+++ /dev/null
@@ -1 +0,0 @@
-attribute.o: $(ruby_headers) $(hdrdir)/ruby/win32.h
diff --git a/ext/-test-/win32/console/extconf.rb b/ext/-test-/win32/console/extconf.rb
deleted file mode 100644
index fb9ef9d524..0000000000
--- a/ext/-test-/win32/console/extconf.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: false
-if $mingw or $mswin
- $srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
- inits = $srcs.map {|s| File.basename(s, ".*")}
- inits.delete("init")
- inits.map! {|s|"X(#{s})"}
- $defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
- create_makefile("-test-/win32/console")
-end
diff --git a/ext/-test-/win32/console/init.c b/ext/-test-/win32/console/init.c
deleted file mode 100644
index f2e0d1c821..0000000000
--- a/ext/-test-/win32/console/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE m); Init_##n(m);}
-
-void
-Init_console(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE m = rb_define_module_under(mBug, "Win32");
- TEST_INIT_FUNCS(init);
-}
diff --git a/ext/-test-/win32/dln/depend b/ext/-test-/win32/dln/depend
deleted file mode 100644
index 712fefa29a..0000000000
--- a/ext/-test-/win32/dln/depend
+++ /dev/null
@@ -1,9 +0,0 @@
-$(TARGET_SO): $(DLNTESTLIB)
-
-$(DLNTESTLIB): $(topdir)/dlntest.dll
-
-$(topdir)/dlntest.dll: libdlntest.o libdlntest.def
- $(ECHO) linking shared-object $(@F)
- -$(Q)$(RM) $@
- -$(Q)$(MAKEDIRS) $(@D)
- $(Q) $(DLNTEST_LDSHARED)
diff --git a/ext/-test-/win32/dln/extconf.rb b/ext/-test-/win32/dln/extconf.rb
index 55c2d16d1e..57cee23b40 100644
--- a/ext/-test-/win32/dln/extconf.rb
+++ b/ext/-test-/win32/dln/extconf.rb
@@ -1,33 +1,37 @@
-# frozen_string_literal: false
if $mingw or $mswin
- dlntestlib = "dlntest.#{$LIBEXT}"
- $LOCAL_LIBS << " #{dlntestlib}"
- $srcs = ["dlntest.c"]
$objs = ["dlntest.o"]
testdll = "$(topdir)/dlntest.dll"
$cleanfiles << testdll
$cleanfiles << "dlntest.#{$LIBEXT}"
config_string('cleanobjs') {|t| $cleanfiles.concat(t.gsub(/\$\*/, 'dlntest').split)}
- create_makefile("-test-/win32/dln") do |m|
- m << "\n""DLNTESTLIB = #{dlntestlib}\n"
+ create_makefile("-test-/win32/dln")
+ m = File.read("Makefile")
+ dlntestlib = "dlntest.#{$LIBEXT}"
+ m.sub!(/^OBJS =.*/) {"#{$&} #{dlntestlib}"}
+ FileUtils.rm_f(RbConfig.expand(testdll.dup))
+ open("Makefile", "wb") do |mf|
+ mf.puts m, "\n"
+ sodir = $extout ? "$(RUBYARCHDIR)/" : ''
+ mf.print "#{sodir}$(DLLIB): #{dlntestlib}"
+ mf.puts
+ mf.puts "#{dlntestlib}: $(topdir)/dlntest.dll"
+ mf.puts
if $mingw
- m << "\n"
- m << "$(topdir)/dlntest.dll: DEFFILE := $(srcdir)/libdlntest.def\n"
- m << "$(topdir)/dlntest.dll: DLDFLAGS += -Wl,--out-implib,$(DLNTESTLIB)\n"
+ mf.puts "$(topdir)/dlntest.dll: DEFFILE := $(srcdir)/libdlntest.def"
+ mf.puts "$(topdir)/dlntest.dll: DLDFLAGS += -Wl,--out-implib,#{dlntestlib}"
end
- m
- end
- m = File.read("Makefile")
- m.sub!(/(.*)\$\(DLNTEST_LDSHARED\)$/) do
- pre = $1
- link_so = LINK_SO.gsub(/^/) {pre}
+ mf.puts depend_rules("$(topdir)/dlntest.dll: libdlntest.o libdlntest.def")
+ mf.puts "\t$(ECHO) linking shared-object $(@F)\n"
+ mf.print "\t-$(Q)$(RM) $@\n"
+ mf.print "\t-$(Q)$(MAKEDIRS) $(@D)\n" if $extout
+ link_so = LINK_SO.gsub(/^/, "\t$(Q) ")
link_so.sub!(/\$\(LOCAL_LIBS\)/, '')
link_so.gsub!(/-\$\(arch\)/, '')
link_so.gsub!(/:.so=/, ':.dll=')
link_so.sub!(/\$\(OBJS\)/, "libdlntest.#{$OBJEXT}")
link_so.sub!(/\$\(DEFFILE\)/, "$(srcdir)/libdlntest.def")
- link_so
- end and File.binwrite("Makefile", m)
- FileUtils.rm_f(RbConfig.expand(testdll.dup))
+ mf.puts link_so
+ mf.puts
+ end
end
diff --git a/ext/-test-/win32/dln/libdlntest.c b/ext/-test-/win32/dln/libdlntest.c
index 5923b732c8..040ae8125d 100644
--- a/ext/-test-/win32/dln/libdlntest.c
+++ b/ext/-test-/win32/dln/libdlntest.c
@@ -1,4 +1,4 @@
-void
+extern __declspec(dllexport) void
dlntest_ordinal(void)
{
}
diff --git a/ext/-test-/win32/fd_setsize/depend b/ext/-test-/win32/fd_setsize/depend
index 7d40e8d572..4936d6b28c 100644
--- a/ext/-test-/win32/fd_setsize/depend
+++ b/ext/-test-/win32/fd_setsize/depend
@@ -1 +1,2 @@
-fd_setsize.o: $(ruby_headers) $(hdrdir)/ruby/win32.h
+fd_setsize.o: $(top_srcdir)/win32/win32.c \
+ $(hdrdir)/ruby/ruby.h
diff --git a/ext/-test-/win32/fd_setsize/extconf.rb b/ext/-test-/win32/fd_setsize/extconf.rb
index caa4b85a1b..ed40f8b1d7 100644
--- a/ext/-test-/win32/fd_setsize/extconf.rb
+++ b/ext/-test-/win32/fd_setsize/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
if $mingw or $mswin
create_makefile("-test-/win32/fd_setsize")
end
diff --git a/ext/.document b/ext/.document
index 2e6fc78879..4a8e06e498 100644
--- a/ext/.document
+++ b/ext/.document
@@ -4,6 +4,7 @@ bigdecimal/bigdecimal.c
bigdecimal/lib
continuation/continuation.c
coverage/coverage.c
+curses/curses.c
date/date_core.c
dbm/dbm.c
digest/bubblebabble/bubblebabble.c
@@ -43,7 +44,6 @@ mathn/rational/rational.c
nkf/lib
nkf/nkf.c
objspace/objspace.c
-objspace/objspace_dump.c
objspace/object_tracing.c
openssl/lib
openssl/ossl.c
@@ -89,6 +89,7 @@ pty/lib
pty/pty.c
racc/cparse/cparse.c
readline/readline.c
+refinement/refinement.c
ripper/lib
ripper/ripper.c
sdbm/init.c
@@ -96,8 +97,6 @@ socket
stringio/stringio.c
strscan/strscan.c
syslog/syslog.c
-syslog/lib
-thread/thread.c
win32ole/lib
-win32ole/*.c
+win32ole/win32ole.c
zlib/zlib.c
diff --git a/ext/Setup b/ext/Setup
index 05998e3363..6870035e45 100644
--- a/ext/Setup
+++ b/ext/Setup
@@ -1,38 +1,23 @@
#option nodynamic
+#Win32API
#bigdecimal
-#cgi/escape
-#continuation
-#coverage
-#date
+#curses
#dbm
-#digest/bubblebabble
#digest
#digest/md5
#digest/rmd160
#digest/sha1
#digest/sha2
+#dl
#etc
#fcntl
-#fiber
-#fiddle
#gdbm
-#io/console
-#io/nonblock
#io/wait
-#json
-#json/generator
-#json/parser
-#mathn/complex
-#mathn/rational
#nkf
-#objspace
#openssl
-#pathname
-#psych
#pty
#racc/cparse
-#rbconfig/sizeof
#readline
#ripper
#sdbm
@@ -40,9 +25,6 @@
#stringio
#strscan
#syslog
-#thread
#tk
-#tk/tkutil
-#win32
#win32ole
#zlib
diff --git a/ext/Setup.atheos b/ext/Setup.atheos
index 5e39de8e15..c4028ef1f2 100644
--- a/ext/Setup.atheos
+++ b/ext/Setup.atheos
@@ -2,13 +2,14 @@ option nodynamic
#Win32API
bigdecimal
-cgi/escape
+curses
dbm
digest
digest/md5
digest/rmd160
digest/sha1
digest/sha2
+dl
enumerator
etc
fcntl
diff --git a/ext/Setup.emx b/ext/Setup.emx
new file mode 100644
index 0000000000..bd46a55ecb
--- /dev/null
+++ b/ext/Setup.emx
@@ -0,0 +1,33 @@
+# OS/2 environment w/ Autoconf 2.1x for EMX
+option platform os2-emx
+option nodynamic
+
+#Win32API
+bigdecimal
+curses
+#dbm
+digest
+digest/md5
+digest/rmd160
+digest/sha1
+digest/sha2
+#dl
+enumerator
+etc
+fcntl
+#gdbm
+#io/wait
+nkf
+#openssl
+#pty
+racc/cparse
+#readline
+#ripper
+#sdbm
+socket
+stringio
+strscan
+#syslog
+#tk
+#win32ole
+#zlib
diff --git a/ext/Setup.nacl b/ext/Setup.nacl
index f205e367c6..3e7f469f92 100644
--- a/ext/Setup.nacl
+++ b/ext/Setup.nacl
@@ -1,10 +1,10 @@
# #option nodynamic
-#
+#
# #Win32API
# bigdecimal
-# cgi/escape
# continuation
# coverage
+# #curses
# date
# #dbm
# digest/bubblebabble
@@ -13,6 +13,9 @@
# digest/rmd160
# digest/sha1
# digest/sha2
+# dl
+# dl/callback
+# #dl/win32
# etc
# fcntl
# fiber
diff --git a/ext/Setup.nt b/ext/Setup.nt
index 4812893eef..fe3feaad18 100644
--- a/ext/Setup.nt
+++ b/ext/Setup.nt
@@ -3,13 +3,14 @@
Win32API
bigdecimal
-cgi/escape
+#curses
#dbm
digest
digest/md5
digest/rmd160
digest/sha1
digest/sha2
+dl
enumerator
etc
fcntl
diff --git a/ext/bigdecimal/README b/ext/bigdecimal/README
new file mode 100644
index 0000000000..7a4362826c
--- /dev/null
+++ b/ext/bigdecimal/README
@@ -0,0 +1,60 @@
+
+ Ruby BIGDECIMAL(Variable Precision) extension library.
+ Copyright (C) 1999 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
+
+BigDecimal is copyrighted free software by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.
+You can redistribute it and/or modify it under either the terms of the GPL
+(see COPYING file), or the conditions below:
+
+ 1. You may make and give away verbatim copies of the source form of the
+ software without restriction, provided that you duplicate all of the
+ original copyright notices and associated disclaimers.
+
+ 2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
+
+ b) use the modified software only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided.
+
+ d) make other distribution arrangements with the author.
+
+ 3. You may distribute the software in object code or executable
+ form, provided that you do at least ONE of the following:
+
+ a) distribute the executables and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
+
+ b) accompany the distribution with the machine-readable source of
+ the software.
+
+ c) give non-standard executables non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d) make other distribution arrangements with the author.
+
+ 4. You may modify and include the part of the software into any other
+ software (possibly commercial).
+
+ 5. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+* The Author
+
+Feel free to send comments and bug reports to the ruby-core team.
+
+ http://bugs.ruby-lang.org
+
+-------------------------------------------------------
+created at: Thu Dec 22 1999
+updated at: Wed Sep 28 2011
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index e24f05782c..f630c0a167 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -4,6 +4,13 @@
*
* Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
*
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file
+ * of this BigDecimal distribution.
+ *
+ * NOTE: Change log in this source removed to reduce source code size.
+ * See rev. 1.25 if needed.
+ *
*/
/* #define BIGDECIMAL_DEBUG 1 */
@@ -11,7 +18,6 @@
# define BIGDECIMAL_ENABLE_VPRINT 1
#endif
#include "bigdecimal.h"
-#include "ruby/util.h"
#ifndef BIGDECIMAL_DEBUG
# define NDEBUG
@@ -65,9 +71,9 @@ static ID id_eq;
/* MACRO's to guard objects from GC by keeping them in stack */
#define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
-#define PUSH(x) (vStack[iStack++] = (VALUE)(x))
-#define SAVE(p) PUSH((p)->obj)
-#define GUARD_OBJ(p,y) ((p)=(y), SAVE(p))
+#define PUSH(x) vStack[iStack++] = (VALUE)(x);
+#define SAVE(p) PUSH(p->obj);
+#define GUARD_OBJ(p,y) {p=y;SAVE(p);}
#define BASE_FIG RMPD_COMPONENT_FIGURES
#define BASE RMPD_BASE
@@ -79,53 +85,19 @@ static ID id_eq;
#define DBLE_FIG (DBL_DIG+1) /* figure of double */
#endif
+#ifndef RBIGNUM_ZERO_P
+# define RBIGNUM_ZERO_P(x) rb_bigzero_p(x)
+#endif
+
#ifndef RRATIONAL_ZERO_P
-# define RRATIONAL_ZERO_P(x) (FIXNUM_P(rb_rational_num(x)) && \
- FIX2LONG(rb_rational_num(x)) == 0)
+# define RRATIONAL_ZERO_P(x) (FIXNUM_P(RRATIONAL(x)->num) && \
+ FIX2LONG(RRATIONAL(x)->num) == 0)
#endif
#ifndef RRATIONAL_NEGATIVE_P
# define RRATIONAL_NEGATIVE_P(x) RTEST(rb_funcall((x), '<', 1, INT2FIX(0)))
#endif
-#ifndef DECIMAL_SIZE_OF_BITS
-#define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999)
-/* an approximation of ceil(n * log10(2)), upto 65536 at least */
-#endif
-
-#ifdef PRIsVALUE
-# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
-# define RB_OBJ_STRING(obj) (obj)
-#else
-# define PRIsVALUE "s"
-# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
-# define RB_OBJ_STRING(obj) StringValueCStr(obj)
-#endif
-
-#ifndef HAVE_RB_RATIONAL_NUM
-static inline VALUE
-rb_rational_num(VALUE rat)
-{
-#ifdef HAVE_TYPE_STRUCT_RRATIONAL
- return RRATIONAL(rat)->num;
-#else
- return rb_funcall(rat, rb_intern("numerator"));
-#endif
-}
-#endif
-
-#ifndef HAVE_RB_RATIONAL_DEN
-static inline VALUE
-rb_rational_den(VALUE rat)
-{
-#ifdef HAVE_TYPE_STRUCT_RRATIONAL
- return RRATIONAL(rat)->den;
-#else
- return rb_funcall(rat, rb_intern("denominator"));
-#endif
-}
-#endif
-
/*
* ================== Ruby Interface part ==========================
*/
@@ -154,10 +126,6 @@ static void VpInternalRound(Real *c, size_t ixDigit, BDIGIT vPrev, BDIGIT v);
static int VpLimitRound(Real *c, size_t ixDigit);
static Real *VpCopy(Real *pv, Real const* const x);
-#ifdef BIGDECIMAL_ENABLE_VPRINT
-static int VPrint(FILE *fp,const char *cntl_chr,Real *a);
-#endif
-
/*
* **** BigDecimal part ****
*/
@@ -172,14 +140,14 @@ static size_t
BigDecimal_memsize(const void *ptr)
{
const Real *pv = ptr;
- return (sizeof(*pv) + pv->MaxPrec * sizeof(BDIGIT));
+ return pv ? (sizeof(*pv) + pv->MaxPrec * sizeof(BDIGIT)) : 0;
}
static const rb_data_type_t BigDecimal_data_type = {
"BigDecimal",
{ 0, BigDecimal_delete, BigDecimal_memsize, },
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
#endif
};
@@ -222,47 +190,34 @@ cannot_be_coerced_into_BigDecimal(VALUE exc_class, VALUE v)
rb_exc_raise(rb_exc_new3(exc_class, str));
}
-static inline VALUE BigDecimal_div2(VALUE, VALUE, VALUE);
+static VALUE BigDecimal_div2(int, VALUE*, VALUE);
static Real*
GetVpValueWithPrec(VALUE v, long prec, int must)
{
Real *pv;
- VALUE num, bg;
+ VALUE num, bg, args[2];
char szD[128];
VALUE orig = Qundef;
- double d;
again:
switch(TYPE(v)) {
case T_FLOAT:
if (prec < 0) goto unable_to_coerce_without_prec;
if (prec > DBL_DIG+1) goto SomeOneMayDoIt;
- d = RFLOAT_VALUE(v);
- if (!isfinite(d)) {
- pv = VpCreateRbObject(prec, NULL);
- pv->sign = isnan(d) ? VP_SIGN_NaN :
- d > 0 ? VP_SIGN_POSITIVE_INFINITE : VP_SIGN_NEGATIVE_FINITE;
- return pv;
- }
- if (d != 0.0) {
- v = rb_funcall(v, id_to_r, 0);
- goto again;
- }
- if (1/d < 0.0) {
- return VpCreateRbObject(prec, "-0");
- }
- return VpCreateRbObject(prec, "0");
-
+ v = rb_funcall(v, id_to_r, 0);
+ goto again;
case T_RATIONAL:
if (prec < 0) goto unable_to_coerce_without_prec;
if (orig == Qundef ? (orig = v, 1) : orig != v) {
- num = rb_rational_num(v);
+ num = RRATIONAL(v)->num;
pv = GetVpValueWithPrec(num, -1, must);
if (pv == NULL) goto SomeOneMayDoIt;
- v = BigDecimal_div2(ToValue(pv), rb_rational_den(v), LONG2NUM(prec));
+ args[0] = RRATIONAL(v)->den;
+ args[1] = LONG2NUM(prec);
+ v = BigDecimal_div2(2, args, ToValue(pv));
goto again;
}
@@ -307,8 +262,8 @@ SomeOneMayDoIt:
unable_to_coerce_without_prec:
if (must) {
rb_raise(rb_eArgError,
- "%"PRIsVALUE" can't be coerced into BigDecimal without a precision",
- RB_OBJ_CLASSNAME(v));
+ "%s can't be coerced into BigDecimal without a precision",
+ rb_obj_classname(v));
}
return NULL;
}
@@ -376,7 +331,7 @@ BigDecimal_hash(VALUE self)
hash ^= rb_memhash(p->frac, sizeof(BDIGIT)*p->Prec);
hash += p->exponent;
}
- return LONG2FIX((long)hash);
+ return INT2FIX(hash);
}
/*
@@ -385,9 +340,9 @@ BigDecimal_hash(VALUE self)
* Method used to provide marshalling support.
*
* inf = BigDecimal.new('Infinity')
- * #=> #<BigDecimal:1e16fa8,'Infinity',9(9)>
+ * => #<BigDecimal:1e16fa8,'Infinity',9(9)>
* BigDecimal._load(inf._dump)
- * #=> #<BigDecimal:1df8dc8,'Infinity',9(9)>
+ * => #<BigDecimal:1df8dc8,'Infinity',9(9)>
*
* See the Marshal module.
*/
@@ -604,17 +559,17 @@ GetPositiveInt(VALUE v)
VP_EXPORT Real *
VpNewRbClass(size_t mx, const char *str, VALUE klass)
{
- VALUE obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, 0);
Real *pv = VpAlloc(mx,str);
- RTYPEDDATA_DATA(obj) = pv;
- pv->obj = obj;
+ pv->obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, pv);
return pv;
}
VP_EXPORT Real *
VpCreateRbObject(size_t mx, const char *str)
{
- return VpNewRbClass(mx, str, rb_cBigDecimal);
+ Real *pv = VpAlloc(mx,str);
+ pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
+ return pv;
}
#define VpAllocReal(prec) (Real *)VpMemAlloc(offsetof(Real, frac) + (prec) * sizeof(BDIGIT))
@@ -636,7 +591,7 @@ VpCopy(Real *pv, Real const* const x)
return pv;
}
-/* Returns True if the value is Not a Number. */
+/* Returns True if the value is Not a Number */
static VALUE
BigDecimal_IsNaN(VALUE self)
{
@@ -657,7 +612,7 @@ BigDecimal_IsInfinite(VALUE self)
return Qnil;
}
-/* Returns True if the value is finite (not NaN or infinite). */
+/* Returns True if the value is finite (not NaN or infinite) */
static VALUE
BigDecimal_IsFinite(VALUE self)
{
@@ -705,7 +660,7 @@ BigDecimal_to_i(VALUE self)
}
else {
VALUE a = BigDecimal_split(self);
- VALUE digits = RARRAY_AREF(a, 1);
+ VALUE digits = RARRAY_PTR(a)[1];
VALUE numerator = rb_funcall(digits, rb_intern("to_i"), 0);
VALUE ret;
ssize_t dpower = e - (ssize_t)RSTRING_LEN(digits);
@@ -794,7 +749,7 @@ BigDecimal_to_r(VALUE self)
sign = VpGetSign(p);
power = VpExponent10(p);
a = BigDecimal_split(self);
- digits = RARRAY_AREF(a, 1);
+ digits = RARRAY_PTR(a)[1];
denomi_power = power - RSTRING_LEN(digits);
numerator = rb_funcall(digits, rb_intern("to_i"), 0);
@@ -821,8 +776,8 @@ BigDecimal_to_r(VALUE self)
* be coerced into a BigDecimal value.
*
* e.g.
- * a = BigDecimal.new("1.0")
- * b = a / 2.0 #=> 0.5
+ * a = BigDecimal.new("1.0")
+ * b = a / 2.0 -> 0.5
*
* Note that coercing a String to a BigDecimal is not supported by default;
* it requires a special compile-time option when building Ruby.
@@ -835,8 +790,7 @@ BigDecimal_coerce(VALUE self, VALUE other)
Real *b;
if (RB_TYPE_P(other, T_FLOAT)) {
- GUARD_OBJ(b, GetVpValueWithPrec(other, DBL_DIG+1, 1));
- obj = rb_assoc_new(ToValue(b), self);
+ obj = rb_assoc_new(other, BigDecimal_to_f(self));
}
else {
if (RB_TYPE_P(other, T_RATIONAL)) {
@@ -880,8 +834,8 @@ BigDecimal_uplus(VALUE self)
* c = a + b
*
* digits:: If specified and less than the number of significant digits of the
- * result, the result is rounded to that number of digits, according
- * to BigDecimal.mode.
+ * result, the result is rounded to that number of digits, according to
+ * BigDecimal.mode.
*/
static VALUE
BigDecimal_add(VALUE self, VALUE r)
@@ -925,7 +879,7 @@ BigDecimal_add(VALUE self, VALUE r)
}
/* call-seq:
- * a - b -> bigdecimal
+ * value - digits -> bigdecimal
*
* Subtract the specified value.
*
@@ -1109,7 +1063,7 @@ BigDecimal_comp(VALUE self, VALUE r)
*
* Values may be coerced to perform the comparison:
*
- * BigDecimal.new('1.0') == 1.0 #=> true
+ * BigDecimal.new('1.0') == 1.0 -> true
*/
static VALUE
BigDecimal_eq(VALUE self, VALUE r)
@@ -1201,8 +1155,8 @@ BigDecimal_neg(VALUE self)
* c = a * b
*
* digits:: If specified and less than the number of significant digits of the
- * result, the result is rounded to that number of digits, according
- * to BigDecimal.mode.
+ * result, the result is rounded to that number of digits, according to
+ * BigDecimal.mode.
*/
static VALUE
BigDecimal_mult(VALUE self, VALUE r)
@@ -1255,10 +1209,8 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
*div = b;
mx = a->Prec + vabs(a->exponent);
- if (mx < b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
- mx++; /* NOTE: An additional digit is needed for the compatibility to
- the version 1.2.1 and the former. */
- mx = (mx + 1) * VpBaseFig();
+ if (mx<b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
+ mx =(mx + 1) * VpBaseFig();
GUARD_OBJ((*c), VpCreateRbObject(mx, "#0"));
GUARD_OBJ((*res), VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
VpDivd(*c, *res, a, b);
@@ -1275,8 +1227,8 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
* c = a.div(b,n)
*
* digits:: If specified and less than the number of significant digits of the
- * result, the result is rounded to that number of digits, according
- * to BigDecimal.mode.
+ * result, the result is rounded to that number of digits, according to
+ * BigDecimal.mode.
*
* If digits is 0, the result is the same as the / operator. If not, the
* result is an integer BigDecimal, by analogy with Float#div.
@@ -1455,10 +1407,7 @@ BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv)
return Qnil;
}
-/* call-seq:
- * remainder(value)
- *
- * Returns the remainder from dividing by the value.
+/* Returns the remainder from dividing by the value.
*
* x.remainder(y) means x-y*(x/y).truncate
*/
@@ -1472,24 +1421,21 @@ BigDecimal_remainder(VALUE self, VALUE r) /* remainder */
return ToValue(rv);
}
-/* call-seq:
- * divmod(value)
- *
- * Divides by the specified value, and returns the quotient and modulus
+/* Divides by the specified value, and returns the quotient and modulus
* as BigDecimal numbers. The quotient is rounded towards negative infinity.
*
* For example:
*
- * require 'bigdecimal'
+ * require 'bigdecimal'
*
- * a = BigDecimal.new("42")
- * b = BigDecimal.new("9")
+ * a = BigDecimal.new("42")
+ * b = BigDecimal.new("9")
*
- * q, m = a.divmod(b)
+ * q,m = a.divmod(b)
*
- * c = q * b + m
+ * c = q * b + m
*
- * a == c #=> true
+ * a == c -> true
*
* The quotient q is (a/b).floor, and the modulus is the amount that must be
* added to q * b to get a.
@@ -1510,53 +1456,40 @@ BigDecimal_divmod(VALUE self, VALUE r)
/*
* See BigDecimal#quo
*/
-static inline VALUE
-BigDecimal_div2(VALUE self, VALUE b, VALUE n)
-{
- ENTER(5);
- SIGNED_VALUE ix;
-
- if (NIL_P(n)) { /* div in Float sense */
- Real *div = NULL;
- Real *mod;
- if (BigDecimal_DoDivmod(self, b, &div, &mod)) {
- return BigDecimal_to_i(ToValue(div));
- }
- return DoSomeOne(self, b, rb_intern("div"));
- }
-
- /* div in BigDecimal sense */
- ix = GetPositiveInt(n);
- if (ix == 0) {
- return BigDecimal_div(self, b);
- }
- else {
- Real *res = NULL;
- Real *av = NULL, *bv = NULL, *cv = NULL;
- size_t mx = ix + VpBaseFig()*2;
- size_t pl = VpSetPrecLimit(0);
-
- GUARD_OBJ(cv, VpCreateRbObject(mx, "0"));
- GUARD_OBJ(av, GetVpValue(self, 1));
- GUARD_OBJ(bv, GetVpValue(b, 1));
- mx = av->Prec + bv->Prec + 2;
- if (mx <= cv->MaxPrec) mx = cv->MaxPrec + 1;
- GUARD_OBJ(res, VpCreateRbObject((mx * 2 + 2)*VpBaseFig(), "#0"));
- VpDivd(cv, res, av, bv);
- VpSetPrecLimit(pl);
- VpLeftRound(cv, VpGetRoundMode(), ix);
- return ToValue(cv);
- }
-}
-
static VALUE
-BigDecimal_div3(int argc, VALUE *argv, VALUE self)
+BigDecimal_div2(int argc, VALUE *argv, VALUE self)
{
+ ENTER(5);
VALUE b,n;
+ int na = rb_scan_args(argc, argv, "11", &b, &n);
+ if (na == 1) { /* div in Float sense */
+ Real *div = NULL;
+ Real *mod;
+ if (BigDecimal_DoDivmod(self, b, &div, &mod)) {
+ return BigDecimal_to_i(ToValue(div));
+ }
+ return DoSomeOne(self, b, rb_intern("div"));
+ } else { /* div in BigDecimal sense */
+ SIGNED_VALUE ix = GetPositiveInt(n);
+ if (ix == 0) return BigDecimal_div(self, b);
+ else {
+ Real *res = NULL;
+ Real *av = NULL, *bv = NULL, *cv = NULL;
+ size_t mx = ix + VpBaseFig()*2;
+ size_t pl = VpSetPrecLimit(0);
- rb_scan_args(argc, argv, "11", &b, &n);
-
- return BigDecimal_div2(self, b, n);
+ GUARD_OBJ(cv, VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(av, GetVpValue(self, 1));
+ GUARD_OBJ(bv, GetVpValue(b, 1));
+ mx = av->Prec + bv->Prec + 2;
+ if (mx <= cv->MaxPrec) mx = cv->MaxPrec + 1;
+ GUARD_OBJ(res, VpCreateRbObject((mx * 2 + 2)*VpBaseFig(), "#0"));
+ VpDivd(cv, res, av, bv);
+ VpSetPrecLimit(pl);
+ VpLeftRound(cv, VpGetRoundMode(), ix);
+ return ToValue(cv);
+ }
+ }
}
static VALUE
@@ -1576,7 +1509,7 @@ BigDecimal_add2(VALUE self, VALUE b, VALUE n)
}
}
-/* call-seq:
+/*
* sub(value, digits) -> bigdecimal
*
* Subtract the specified value.
@@ -1585,8 +1518,8 @@ BigDecimal_add2(VALUE self, VALUE b, VALUE n)
* c = a.sub(b,n)
*
* digits:: If specified and less than the number of significant digits of the
- * result, the result is rounded to that number of digits, according
- * to BigDecimal.mode.
+ * result, the result is rounded to that number of digits, according to
+ * BigDecimal.mode.
*
*/
static VALUE
@@ -1624,10 +1557,11 @@ BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
}
}
-/* Returns the absolute value, as a BigDecimal.
+/* Returns the absolute value.
*
- * BigDecimal('5').abs #=> 5
- * BigDecimal('-3').abs #=> 3
+ * BigDecimal('5').abs -> 5
+ *
+ * BigDecimal('-3').abs -> 3
*/
static VALUE
BigDecimal_abs(VALUE self)
@@ -1668,7 +1602,7 @@ BigDecimal_sqrt(VALUE self, VALUE nFig)
return ToValue(c);
}
-/* Return the integer part of the number, as a BigDecimal.
+/* Return the integer part of the number.
*/
static VALUE
BigDecimal_fix(VALUE self)
@@ -1687,12 +1621,10 @@ BigDecimal_fix(VALUE self)
/* call-seq:
* round(n, mode)
*
- * Round to the nearest integer (by default), returning the result as a
- * BigDecimal.
+ * Round to the nearest 1 (by default), returning the result as a BigDecimal.
*
* BigDecimal('3.14159').round #=> 3
* BigDecimal('8.7').round #=> 9
- * BigDecimal('-9.9').round #=> -10
*
* If n is specified and positive, the fractional part of the result has no
* more than that many digits.
@@ -1750,12 +1682,10 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
/* call-seq:
* truncate(n)
*
- * Truncate to the nearest integer (by default), returning the result as a
- * BigDecimal.
+ * Truncate to the nearest 1, returning the result as a BigDecimal.
*
* BigDecimal('3.14159').truncate #=> 3
* BigDecimal('8.7').truncate #=> 8
- * BigDecimal('-9.9').truncate #=> -9
*
* If n is specified and positive, the fractional part of the result has no
* more than that many digits.
@@ -1794,7 +1724,7 @@ BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
return ToValue(c);
}
-/* Return the fractional part of the number, as a BigDecimal.
+/* Return the fractional part of the number.
*/
static VALUE
BigDecimal_frac(VALUE self)
@@ -1926,14 +1856,14 @@ BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
*
* Examples:
*
- * BigDecimal.new('-123.45678901234567890').to_s('5F')
- * #=> '-123.45678 90123 45678 9'
+ * BigDecimal.new('-123.45678901234567890').to_s('5F')
+ * #=> '-123.45678 90123 45678 9'
*
- * BigDecimal.new('123.45678901234567890').to_s('+8F')
- * #=> '+123.45678901 23456789'
+ * BigDecimal.new('123.45678901234567890').to_s('+8F')
+ * #=> '+123.45678901 23456789'
*
- * BigDecimal.new('123.45678901234567890').to_s(' F')
- * #=> ' 123.4567890123456789'
+ * BigDecimal.new('123.45678901234567890').to_s(' F')
+ * #=> ' 123.4567890123456789'
*/
static VALUE
BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
@@ -2073,8 +2003,8 @@ BigDecimal_exponent(VALUE self)
/* Returns debugging information about the value as a string of comma-separated
* values in angle brackets with a leading #:
*
- * BigDecimal.new("1234.5678").inspect
- * #=> "#<BigDecimal:b7ea1130,'0.12345678E4',8(12)>"
+ * BigDecimal.new("1234.5678").inspect ->
+ * "#<BigDecimal:b7ea1130,'0.12345678E4',8(12)>"
*
* The first part is the address, the second is the value as a string, and
* the final part ss(mm) is the current number of significant digits and the
@@ -2123,7 +2053,7 @@ is_negative(VALUE x)
return FIX2LONG(x) < 0;
}
else if (RB_TYPE_P(x, T_BIGNUM)) {
- return FIX2INT(rb_big_cmp(x, INT2FIX(0))) < 0;
+ return RBIGNUM_NEGATIVE_P(x);
}
else if (RB_TYPE_P(x, T_FLOAT)) {
return RFLOAT_VALUE(x) < 0.0;
@@ -2146,7 +2076,7 @@ is_zero(VALUE x)
return Qfalse;
case T_RATIONAL:
- num = rb_rational_num(x);
+ num = RRATIONAL(x)->num;
return FIXNUM_P(num) && FIX2LONG(num) == 0;
default:
@@ -2169,8 +2099,8 @@ is_one(VALUE x)
return Qfalse;
case T_RATIONAL:
- num = rb_rational_num(x);
- den = rb_rational_den(x);
+ num = RRATIONAL(x)->num;
+ den = RRATIONAL(x)->den;
return FIXNUM_P(den) && FIX2LONG(den) == 1 &&
FIXNUM_P(num) && FIX2LONG(num) == 1;
@@ -2228,7 +2158,7 @@ rmpd_power_by_big_decimal(Real const* x, Real const* exp, ssize_t const n)
*
* Note that n must be an Integer.
*
- * Also available as the operator **.
+ * Also available as the operator **
*/
static VALUE
BigDecimal_power(int argc, VALUE*argv, VALUE self)
@@ -2253,7 +2183,7 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
return ToValue(y);
}
- retry:
+retry:
switch (TYPE(vexp)) {
case T_FIXNUM:
break;
@@ -2276,14 +2206,14 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
break;
case T_RATIONAL:
- if (is_zero(rb_rational_num(vexp))) {
+ if (is_zero(RRATIONAL(vexp)->num)) {
if (is_positive(vexp)) {
vexp = INT2FIX(0);
goto retry;
}
}
- else if (is_one(rb_rational_den(vexp))) {
- vexp = rb_rational_num(vexp);
+ else if (is_one(RRATIONAL(vexp)->den)) {
+ vexp = RRATIONAL(vexp)->num;
goto retry;
}
exp = GetVpValueWithPrec(vexp, n, 1);
@@ -2303,8 +2233,8 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
/* fall through */
default:
rb_raise(rb_eTypeError,
- "wrong argument type %"PRIsVALUE" (expected scalar Numeric)",
- RB_OBJ_CLASSNAME(vexp));
+ "wrong argument type %s (expected scalar Numeric)",
+ rb_obj_classname(vexp));
}
if (VpIsZero(x)) {
@@ -2440,7 +2370,7 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
}
}
- int_exp = FIX2LONG(vexp);
+ int_exp = FIX2INT(vexp);
ma = int_exp;
if (ma < 0) ma = -ma;
if (ma == 0) ma = 1;
@@ -2460,11 +2390,9 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
}
/* call-seq:
- * a ** n -> bigdecimal
- *
- * Returns the value raised to the power of n.
+ * big_decimal ** exp -> big_decimal
*
- * See BigDecimal#power.
+ * It is a synonym of BigDecimal#power(exp).
*/
static VALUE
BigDecimal_power_op(VALUE self, VALUE exp)
@@ -2497,28 +2425,13 @@ static Real *BigDecimal_new(int argc, VALUE *argv);
*
* The actual number of significant digits used in computation is usually
* larger than the specified number.
- *
- * ==== Exceptions
- *
- * TypeError:: If the +initial+ type is neither Fixnum, Bignum, Float,
- * Rational, nor BigDecimal, this exception is raised.
- *
- * TypeError:: If the +digits+ is not a Fixnum, this exception is raised.
- *
- * ArgumentError:: If +initial+ is a Float, and the +digits+ is larger than
- * Float::DIG + 1, this exception is raised.
- *
- * ArgumentError:: If the +initial+ is a Float or Rational, and the +digits+
- * value is omitted, this exception is raised.
*/
static VALUE
BigDecimal_initialize(int argc, VALUE *argv, VALUE self)
{
- ENTER(1);
Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
- Real *x;
+ Real *x = BigDecimal_new(argc, argv);
- GUARD_OBJ(x, BigDecimal_new(argc, argv));
if (ToValue(x)) {
pv = VpCopy(pv, x);
}
@@ -2533,7 +2446,7 @@ BigDecimal_initialize(int argc, VALUE *argv, VALUE self)
/* :nodoc:
*
- * private method for dup and clone the provided BigDecimal +other+
+ * private method to dup and clone the provided BigDecimal +other+
*/
static VALUE
BigDecimal_initialize_copy(VALUE self, VALUE other)
@@ -2541,9 +2454,7 @@ BigDecimal_initialize_copy(VALUE self, VALUE other)
Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
Real *x = rb_check_typeddata(other, &BigDecimal_data_type);
- if (self != other) {
- DATA_PTR(self) = VpCopy(pv, x);
- }
+ DATA_PTR(self) = VpCopy(pv, x);
return self;
}
@@ -2581,8 +2492,8 @@ BigDecimal_new(int argc, VALUE *argv)
case T_RATIONAL:
if (NIL_P(nFig)) {
rb_raise(rb_eArgError,
- "can't omit precision for a %"PRIsVALUE".",
- RB_OBJ_CLASSNAME(iniValue));
+ "can't omit precision for a %s.",
+ rb_class2name(CLASS_OF(iniValue)));
}
return GetVpValueWithPrec(iniValue, mf, 1);
@@ -2595,19 +2506,14 @@ BigDecimal_new(int argc, VALUE *argv)
return VpAlloc(mf, RSTRING_PTR(iniValue));
}
-/* See also BigDecimal.new */
+/* See also BigDecimal::new */
static VALUE
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
{
- ENTER(1);
- Real *pv;
- VALUE obj;
-
- obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, 0);
- GUARD_OBJ(pv, BigDecimal_new(argc, argv));
+ Real *pv = BigDecimal_new(argc, argv);
if (ToValue(pv)) pv = VpCopy(NULL, pv);
- RTYPEDDATA_DATA(obj) = pv;
- return pv->obj = obj;
+ pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
+ return pv->obj;
}
/* call-seq:
@@ -2758,7 +2664,7 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
{
ssize_t prec, n, i;
Real* vx = NULL;
- VALUE one, d, y;
+ VALUE one, d, x1, y, z;
int negative = 0;
int infinite = 0;
int nan = 0;
@@ -2769,7 +2675,7 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
rb_raise(rb_eArgError, "Zero or negative precision for exp");
}
- /* TODO: the following switch statement is almost same as one in the
+ /* TODO: the following switch statement is almostly the same as one in the
* BigDecimalCmp function. */
switch (TYPE(x)) {
case T_DATA:
@@ -2834,11 +2740,14 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
}
one = ToValue(VpCreateRbObject(1, "1"));
+ x1 = one;
y = one;
d = y;
- i = 1;
+ z = one;
+ i = 0;
while (!VpIsZero((Real*)DATA_PTR(d))) {
+ VALUE argv[2];
SIGNED_VALUE const ey = VpExponent10(DATA_PTR(y));
SIGNED_VALUE const ed = VpExponent10(DATA_PTR(d));
ssize_t m = n - vabs(ey - ed);
@@ -2852,14 +2761,20 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
m = rmpd_double_figures();
}
- d = BigDecimal_mult(d, x); /* d <- d * x */
- d = BigDecimal_div2(d, SSIZET2NUM(i), SSIZET2NUM(m)); /* d <- d / i */
- y = BigDecimal_add(y, d); /* y <- y + d */
- ++i; /* i <- i + 1 */
+ x1 = BigDecimal_mult2(x1, x, SSIZET2NUM(n));
+ ++i;
+ z = BigDecimal_mult(z, SSIZET2NUM(i));
+ argv[0] = z;
+ argv[1] = SSIZET2NUM(m);
+ d = BigDecimal_div2(2, argv, x1);
+ y = BigDecimal_add(y, d);
}
if (negative) {
- return BigDecimal_div2(one, y, vprec);
+ VALUE argv[2];
+ argv[0] = y;
+ argv[1] = vprec;
+ return BigDecimal_div2(2, argv, one);
}
else {
vprec = SSIZET2NUM(prec - VpExponent10(DATA_PTR(y)));
@@ -2868,8 +2783,10 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
RB_GC_GUARD(one);
RB_GC_GUARD(x);
+ RB_GC_GUARD(x1);
RB_GC_GUARD(y);
RB_GC_GUARD(d);
+ RB_GC_GUARD(z);
}
/* call-seq:
@@ -2890,7 +2807,7 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
ssize_t prec, n, i;
SIGNED_VALUE expo;
Real* vx = NULL;
- VALUE vn, one, two, w, x2, y, d;
+ VALUE argv[2], vn, one, two, w, x2, y, d;
int zero = 0;
int negative = 0;
int infinite = 0;
@@ -2907,7 +2824,7 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
rb_raise(rb_eArgError, "Zero or negative precision for exp");
}
- /* TODO: the following switch statement is almost same as one in the
+ /* TODO: the following switch statement is almostly the same as one in the
* BigDecimalCmp function. */
switch (TYPE(x)) {
case T_DATA:
@@ -2926,9 +2843,8 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
goto get_vp_value;
case T_BIGNUM:
- i = FIX2INT(rb_big_cmp(x, INT2FIX(0)));
- zero = i == 0;
- negative = i < 0;
+ zero = RBIGNUM_ZERO_P(x);
+ negative = RBIGNUM_NEGATIVE_P(x);
get_vp_value:
if (zero || negative) break;
vx = GetVpValue(x, 0);
@@ -2989,15 +2905,17 @@ get_vp_value:
RB_GC_GUARD(vn) = SSIZET2NUM(n);
expo = VpExponent10(vx);
if (expo < 0 || expo >= 3) {
- char buf[DECIMAL_SIZE_OF_BITS(SIZEOF_VALUE * CHAR_BIT) + 4];
- snprintf(buf, sizeof(buf), "1E%"PRIdVALUE, -expo);
+ char buf[16];
+ snprintf(buf, 16, "1E%"PRIdVALUE, -expo);
x = BigDecimal_mult2(x, ToValue(VpCreateRbObject(1, buf)), vn);
}
else {
expo = 0;
}
w = BigDecimal_sub(x, one);
- x = BigDecimal_div2(w, BigDecimal_add(x, one), vn);
+ argv[0] = BigDecimal_add(x, one);
+ argv[1] = vn;
+ x = BigDecimal_div2(2, argv, w);
RB_GC_GUARD(x2) = BigDecimal_mult2(x, x, vn);
RB_GC_GUARD(y) = x;
RB_GC_GUARD(d) = y;
@@ -3015,7 +2933,9 @@ get_vp_value:
x = BigDecimal_mult2(x2, x, vn);
i += 2;
- d = BigDecimal_div2(x, SSIZET2NUM(i), SSIZET2NUM(m));
+ argv[0] = SSIZET2NUM(i);
+ argv[1] = SSIZET2NUM(m);
+ d = BigDecimal_div2(2, argv, x);
y = BigDecimal_add(y, d);
}
@@ -3135,8 +3055,9 @@ get_vp_value:
*
* Copyright (C) 2002 by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.
*
- * BigDecimal is released under the Ruby and 2-clause BSD licenses.
- * See LICENSE.txt for details.
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file
+ * of the BigDecimal distribution.
*
* Maintained by mrkn <mrkn@mrkn.jp> and ruby-core members.
*
@@ -3293,7 +3214,7 @@ Init_bigdecimal(void)
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2);
rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2);
- rb_define_method(rb_cBigDecimal, "div", BigDecimal_div3, -1);
+ rb_define_method(rb_cBigDecimal, "div", BigDecimal_div2, -1);
rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0);
rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1);
rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0);
@@ -3831,10 +3752,10 @@ VpInit(BDIGIT BaseVal)
#ifdef BIGDECIMAL_DEBUG
if (gfDebug) {
- printf("VpInit: BaseVal = %"PRIuBDIGIT"\n", BaseVal);
- printf(" BASE = %"PRIuBDIGIT"\n", BASE);
- printf(" HALF_BASE = %"PRIuBDIGIT"\n", HALF_BASE);
- printf(" BASE1 = %"PRIuBDIGIT"\n", BASE1);
+ printf("VpInit: BaseVal = %lu\n", BaseVal);
+ printf(" BASE = %lu\n", BASE);
+ printf(" HALF_BASE = %lu\n", HALF_BASE);
+ printf(" BASE1 = %lu\n", BASE1);
printf(" BASE_FIG = %u\n", BASE_FIG);
printf(" DBLE_FIG = %d\n", DBLE_FIG);
}
@@ -3863,7 +3784,7 @@ AddExponent(Real *a, SIGNED_VALUE n)
goto overflow;
mb = m*(SIGNED_VALUE)BASE_FIG;
eb = e*(SIGNED_VALUE)BASE_FIG;
- if (eb - mb > 0) goto overflow;
+ if (mb < eb) goto overflow;
}
}
else if (n < 0) {
@@ -3872,7 +3793,7 @@ AddExponent(Real *a, SIGNED_VALUE n)
goto underflow;
mb = m*(SIGNED_VALUE)BASE_FIG;
eb = e*(SIGNED_VALUE)BASE_FIG;
- if (mb - eb > 0) goto underflow;
+ if (mb > eb) goto underflow;
}
a->exponent = m;
return 1;
@@ -3914,28 +3835,28 @@ VpAlloc(size_t mx, const char *szVal)
if (mx == 0) ++mx;
if (szVal) {
- while (ISSPACE(*szVal)) szVal++;
- if (*szVal != '#') {
- if (mf) {
- mf = (mf + BASE_FIG - 1) / BASE_FIG + 2; /* Needs 1 more for div */
- if (mx > mf) {
- mx = mf;
- }
- }
- }
- else {
- ++szVal;
- }
+ while (ISSPACE(*szVal)) szVal++;
+ if (*szVal != '#') {
+ if (mf) {
+ mf = (mf + BASE_FIG - 1) / BASE_FIG + 2; /* Needs 1 more for div */
+ if (mx > mf) {
+ mx = mf;
+ }
+ }
+ }
+ else {
+ ++szVal;
+ }
}
else {
- /* necessary to be able to store */
- /* at least mx digits. */
- /* szVal==NULL ==> allocate zero value. */
- vp = VpAllocReal(mx);
- /* xmalloc() alway returns(or throw interruption) */
- vp->MaxPrec = mx; /* set max precision */
- VpSetZero(vp, 1); /* initialize vp to zero. */
- return vp;
+ /* necessary to be able to store */
+ /* at least mx digits. */
+ /* szVal==NULL ==> allocate zero value. */
+ vp = VpAllocReal(mx);
+ /* xmalloc() alway returns(or throw interruption) */
+ vp->MaxPrec = mx; /* set max precision */
+ VpSetZero(vp, 1); /* initialize vp to zero. */
+ return vp;
}
/* Skip all '_' after digit: 2006-6-30 */
@@ -3945,42 +3866,43 @@ VpAlloc(size_t mx, const char *szVal)
i = 0;
ipn = 0;
while ((psz[i] = szVal[ipn]) != 0) {
- if (ISSPACE(psz[i])) {
- psz[i] = 0;
- break;
- }
- if (ISDIGIT(psz[i])) ++ni;
- if (psz[i] == '_') {
- if (ni > 0) {
- ipn++;
- continue;
- }
- psz[i] = 0;
- break;
- }
- ++i;
- ++ipn;
+ if (ISDIGIT(psz[i])) ++ni;
+ if (psz[i] == '_') {
+ if (ni > 0) {
+ ipn++;
+ continue;
+ }
+ psz[i] = 0;
+ break;
+ }
+ ++i;
+ ++ipn;
+ }
+ /* Skip trailing spaces */
+ while (--i > 0) {
+ if (ISSPACE(psz[i])) psz[i] = 0;
+ else break;
}
szVal = psz;
/* Check on Inf & NaN */
if (StrCmp(szVal, SZ_PINF) == 0 || StrCmp(szVal, SZ_INF) == 0 ) {
- vp = VpAllocReal(1);
- vp->MaxPrec = 1; /* set max precision */
- VpSetPosInf(vp);
- return vp;
+ vp = VpAllocReal(1);
+ vp->MaxPrec = 1; /* set max precision */
+ VpSetPosInf(vp);
+ return vp;
}
if (StrCmp(szVal, SZ_NINF) == 0) {
- vp = VpAllocReal(1);
- vp->MaxPrec = 1; /* set max precision */
- VpSetNegInf(vp);
- return vp;
+ vp = VpAllocReal(1);
+ vp->MaxPrec = 1; /* set max precision */
+ VpSetNegInf(vp);
+ return vp;
}
if (StrCmp(szVal, SZ_NaN) == 0) {
- vp = VpAllocReal(1);
- vp->MaxPrec = 1; /* set max precision */
- VpSetNaN(vp);
- return vp;
+ vp = VpAllocReal(1);
+ vp->MaxPrec = 1; /* set max precision */
+ VpSetNaN(vp);
+ return vp;
}
/* check on number szVal[] */
@@ -3990,45 +3912,45 @@ VpAlloc(size_t mx, const char *szVal)
/* Skip digits */
ni = 0; /* digits in mantissa */
while ((v = szVal[i]) != 0) {
- if (!ISDIGIT(v)) break;
- ++i;
- ++ni;
+ if (!ISDIGIT(v)) break;
+ ++i;
+ ++ni;
}
nf = 0;
ipf = 0;
ipe = 0;
ne = 0;
if (v) {
- /* other than digit nor \0 */
- if (szVal[i] == '.') { /* xxx. */
- ++i;
- ipf = i;
- while ((v = szVal[i]) != 0) { /* get fraction part. */
- if (!ISDIGIT(v)) break;
- ++i;
- ++nf;
- }
- }
- ipe = 0; /* Exponent */
-
- switch (szVal[i]) {
- case '\0':
- break;
- case 'e': case 'E':
- case 'd': case 'D':
- ++i;
- ipe = i;
- v = szVal[i];
- if ((v == '-') || (v == '+')) ++i;
- while ((v=szVal[i]) != 0) {
- if (!ISDIGIT(v)) break;
- ++i;
- ++ne;
- }
- break;
- default:
- break;
- }
+ /* other than digit nor \0 */
+ if (szVal[i] == '.') { /* xxx. */
+ ++i;
+ ipf = i;
+ while ((v = szVal[i]) != 0) { /* get fraction part. */
+ if (!ISDIGIT(v)) break;
+ ++i;
+ ++nf;
+ }
+ }
+ ipe = 0; /* Exponent */
+
+ switch (szVal[i]) {
+ case '\0':
+ break;
+ case 'e': case 'E':
+ case 'd': case 'D':
+ ++i;
+ ipe = i;
+ v = szVal[i];
+ if ((v == '-') || (v == '+')) ++i;
+ while ((v=szVal[i]) != 0) {
+ if (!ISDIGIT(v)) break;
+ ++i;
+ ++ne;
+ }
+ break;
+ default:
+ break;
+ }
}
nalloc = (ni + nf + BASE_FIG - 1) / BASE_FIG + 1; /* set effective allocation */
/* units for szVal[] */
@@ -4097,7 +4019,7 @@ VpAsgn(Real *c, Real *a, int isw)
/*
* c = a + b when operation = 1 or 2
- * c = a - b when operation = -1 or -2.
+ * = a - b when operation = -1 or -2.
* Returns number of significant digits of c
*/
VP_EXPORT size_t
@@ -4230,7 +4152,7 @@ end_if:
}
/*
- * Addition of two values with variable precision
+ * Addition of two variable precisional variables
* a and b assuming abs(a)>abs(b).
* c = abs(a) + abs(b) ; where |a|>=|b|
*/
@@ -4257,7 +4179,6 @@ VpAddAbs(Real *a, Real *b, Real *c)
a_pos = ap;
b_pos = bp;
c_pos = cp;
-
if (word_shift == (size_t)-1L) return 0; /* Overflow */
if (b_pos == (size_t)-1L) goto Assign_a;
@@ -4265,14 +4186,14 @@ VpAddAbs(Real *a, Real *b, Real *c)
/* Just assign the last few digits of b to c because a has no */
/* corresponding digits to be added. */
- if (b_pos > 0) {
- while (b_pos > 0 && b_pos + word_shift > a_pos) {
- c->frac[--c_pos] = b->frac[--b_pos];
+ while (b_pos + word_shift > a_pos) {
+ --c_pos;
+ if (b_pos > 0) {
+ c->frac[c_pos] = b->frac[--b_pos];
}
- }
- if (b_pos == 0 && word_shift > a_pos) {
- while (word_shift-- > a_pos) {
- c->frac[--c_pos] = 0;
+ else {
+ --word_shift;
+ c->frac[c_pos] = 0;
}
}
@@ -4368,16 +4289,16 @@ VpSubAbs(Real *a, Real *b, Real *c)
/* each of the last few digits of the b because the a has no */
/* corresponding digits to be subtracted. */
if (b_pos + word_shift > a_pos) {
- while (b_pos > 0 && b_pos + word_shift > a_pos) {
- c->frac[--c_pos] = BASE - b->frac[--b_pos] - borrow;
- borrow = 1;
- }
- if (b_pos == 0) {
- while (word_shift > a_pos) {
+ while (b_pos + word_shift > a_pos) {
+ --c_pos;
+ if (b_pos > 0) {
+ c->frac[c_pos] = BASE - b->frac[--b_pos] - borrow;
+ }
+ else {
--word_shift;
- c->frac[--c_pos] = BASE - borrow;
- borrow = 1;
+ c->frac[c_pos] = BASE - borrow;
}
+ borrow = 1;
}
}
/* Just assign the last few digits of a to c because b has no */
@@ -4449,19 +4370,12 @@ static size_t
VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos, BDIGIT *av, BDIGIT *bv)
{
size_t left_word, right_word, word_shift;
-
- size_t const round_limit = (VpGetPrecLimit() + BASE_FIG - 1) / BASE_FIG;
-
- assert(a->exponent >= b->exponent);
-
c->frac[0] = 0;
*av = *bv = 0;
-
word_shift = (a->exponent - b->exponent);
left_word = b->Prec + word_shift;
right_word = Max(a->Prec, left_word);
left_word = c->MaxPrec - 1; /* -1 ... prepare for round up */
-
/*
* check if 'round' is needed.
*/
@@ -4484,9 +4398,7 @@ VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos,
* a_pos = |
*/
*a_pos = left_word;
- if (*a_pos <= round_limit) {
- *av = a->frac[*a_pos]; /* av is 'A' shown in above. */
- }
+ *av = a->frac[*a_pos]; /* av is 'A' shown in above. */
}
else {
/*
@@ -4505,9 +4417,7 @@ VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos,
*/
if (c->MaxPrec >= word_shift + 1) {
*b_pos = c->MaxPrec - word_shift - 1;
- if (*b_pos + word_shift <= round_limit) {
- *bv = b->frac[*b_pos];
- }
+ *bv = b->frac[*b_pos];
}
else {
*b_pos = -1L;
@@ -4876,11 +4786,11 @@ out_side:
space_error:
#ifdef BIGDECIMAL_DEBUG
if (gfDebug) {
- printf(" word_a=%"PRIuSIZE"\n", word_a);
- printf(" word_b=%"PRIuSIZE"\n", word_b);
- printf(" word_c=%"PRIuSIZE"\n", word_c);
- printf(" word_r=%"PRIuSIZE"\n", word_r);
- printf(" ind_r =%"PRIuSIZE"\n", ind_r);
+ printf(" word_a=%lu\n", word_a);
+ printf(" word_b=%lu\n", word_b);
+ printf(" word_c=%lu\n", word_c);
+ printf(" word_r=%lu\n", word_r);
+ printf(" ind_r =%lu\n", ind_r);
}
#endif /* BIGDECIMAL_DEBUG */
rb_bug("ERROR(VpDivd): space for remainder too small.");
@@ -4989,7 +4899,7 @@ VpComp(Real *a, Real *b)
goto Exit;
}
- /* a and b have same exponent, then compare their significand. */
+ /* a and b have same exponent, then compare significand. */
mx = (a->Prec < b->Prec) ? a->Prec : b->Prec;
ind = 0;
while (ind < mx) {
@@ -5024,6 +4934,7 @@ Exit:
return (int)val;
}
+#ifdef BIGDECIMAL_ENABLE_VPRINT
/*
* cntl_chr ... ASCIIZ Character, print control characters
* Available control codes:
@@ -5031,14 +4942,13 @@ Exit:
* \n ... new line
* \b ... backspace
* ... tab
- * Note: % must not appear more than once
+ * Note: % must must not appear more than once
* a ... VP variable to be printed
*/
-#ifdef BIGDECIMAL_ENABLE_VPRINT
-static int
+ VP_EXPORT int
VPrint(FILE *fp, const char *cntl_chr, Real *a)
{
- size_t i, j, nc, nd, ZeroSup, sep = 10;
+ size_t i, j, nc, nd, ZeroSup;
BDIGIT m, e, nn;
/* Check if NaN & Inf. */
@@ -5073,16 +4983,6 @@ VPrint(FILE *fp, const char *cntl_chr, Real *a)
++nc;
}
nc += fprintf(fp, "0.");
- switch (*(cntl_chr + j + 1)) {
- default:
- break;
-
- case '0': case 'z':
- ZeroSup = 0;
- ++j;
- sep = cntl_chr[j] == 'z' ? RMPD_COMPONENT_FIGURES : 10;
- break;
- }
for (i = 0; i < a->Prec; ++i) {
m = BASE1;
e = a->frac[i];
@@ -5095,7 +4995,7 @@ VPrint(FILE *fp, const char *cntl_chr, Real *a)
++nd;
ZeroSup = 0; /* Set to print succeeding zeros */
}
- if (nd >= sep) { /* print ' ' after every 10 digits */
+ if (nd >= 10) { /* print ' ' after every 10 digits */
nd = 0;
nc += fprintf(fp, " ");
}
@@ -5104,7 +5004,6 @@ VPrint(FILE *fp, const char *cntl_chr, Real *a)
}
}
nc += fprintf(fp, "E%"PRIdSIZE, VpExponent10(a));
- nc += fprintf(fp, " (%"PRIdVALUE", %lu, %lu)", a->exponent, a->Prec, a->MaxPrec);
}
else {
nc += fprintf(fp, "0.0");
@@ -5138,10 +5037,9 @@ VPrint(FILE *fp, const char *cntl_chr, Real *a)
}
j++;
}
-
return (int)nc;
}
-#endif
+#endif /* BIGDECIMAL_ENABLE_VPRINT */
static void
VpFormatSt(char *psz, size_t fFmt)
@@ -6260,7 +6158,7 @@ Exit:
if (gfDebug) {
VPrint(stdout, "VpPower y=%\n", y);
VPrint(stdout, "VpPower x=%\n", x);
- printf(" n=%"PRIdVALUE"\n", n);
+ printf(" n=%d\n", n);
}
#endif /* BIGDECIMAL_DEBUG */
VpFree(w2);
@@ -6295,10 +6193,10 @@ VpVarCheck(Real * v)
for (i = 0; i < v->Prec; ++i) {
if (v->frac[i] >= BASE) {
printf("ERROR(VpVarCheck): Illegal fraction\n");
- printf(" Frac[%"PRIuSIZE"]=%"PRIuBDIGIT"\n", i, v->frac[i]);
+ printf(" Frac[%"PRIuSIZE"]=%lu\n", i, v->frac[i]);
printf(" Prec. =%"PRIuSIZE"\n", v->Prec);
printf(" Exp. =%"PRIdVALUE"\n", v->exponent);
- printf(" BASE =%"PRIuBDIGIT"\n", BASE);
+ printf(" BASE =%lu\n", BASE);
return 3;
}
}
diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec
index 1666325d45..7131c21b3b 100644
--- a/ext/bigdecimal/bigdecimal.gemspec
+++ b/ext/bigdecimal/bigdecimal.gemspec
@@ -1,22 +1,21 @@
# -*- ruby -*-
-_VERSION = "1.2.8"
-date = %w$Date:: $[1]
+_VERSION = "1.2.2"
Gem::Specification.new do |s|
s.name = "bigdecimal"
s.version = _VERSION
- s.date = date
- s.license = 'ruby'
+ s.date = "2012-02-19"
s.summary = "Arbitrary-precision decimal floating-point number library."
s.homepage = "http://www.ruby-lang.org"
s.email = "mrkn@mrkn.jp"
s.description = "This library provides arbitrary-precision decimal floating-point number class."
s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
- s.require_path = %[lib]
+ s.require_path = %[.]
s.files = %w[
bigdecimal.gemspec
bigdecimal.c
bigdecimal.h
+ README
depend extconf.rb
lib/bigdecimal/jacobian.rb
lib/bigdecimal/ludcmp.rb
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index f85c3e55ad..e7a8bccee7 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -4,6 +4,13 @@
*
* Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
*
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file
+ * of this BigDecimal distribution.
+ *
+ * NOTES:
+ * 2003-03-28 V1.0 checked in.
+ *
*/
#ifndef RUBY_BIG_DECIMAL_H
@@ -36,35 +43,13 @@
# define BDIGIT_DBL uint64_t
# define BDIGIT_DBL_SIGNED int64_t
# define SIZEOF_BDIGITS 4
-# define PRI_BDIGIT_PREFIX ""
-# ifdef PRI_LL_PREFIX
-# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
-# else
-# define PRI_BDIGIT_DBL_PREFIX "l"
-# endif
#else
# define BDIGIT uint16_t
# define BDIGIT_DBL uint32_t
# define BDIGIT_DBL_SIGNED int32_t
# define SIZEOF_BDIGITS 2
-# define PRI_BDIGIT_PREFIX "h"
-# define PRI_BDIGIT_DBL_PREFIX ""
#endif
-#define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
-#define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
-#define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
-#define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
-#define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
-#define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
-
-#define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
-#define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
-#define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
-#define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
-#define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
-#define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
-
#if defined(__cplusplus)
extern "C" {
#if 0
@@ -306,7 +291,7 @@ VP_EXPORT Real *VpOne(void);
#define VpIsZero(a) (VpIsPosZero(a) || VpIsNegZero(a))
#define VpSetPosZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_ZERO)
#define VpSetNegZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_ZERO)
-#define VpSetZero(a,s) (void)(((s)>0)?VpSetPosZero(a):VpSetNegZero(a))
+#define VpSetZero(a,s) ( ((s)>0)?VpSetPosZero(a):VpSetNegZero(a) )
/* NaN */
#define VpIsNaN(a) ((a)->sign==VP_SIGN_NaN)
@@ -319,12 +304,13 @@ VP_EXPORT Real *VpOne(void);
#define VpIsDef(a) ( !(VpIsNaN(a)||VpIsInf(a)) )
#define VpSetPosInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_INFINITE)
#define VpSetNegInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_INFINITE)
-#define VpSetInf(a,s) (void)(((s)>0)?VpSetPosInf(a):VpSetNegInf(a))
+#define VpSetInf(a,s) ( ((s)>0)?VpSetPosInf(a):VpSetNegInf(a) )
#define VpHasVal(a) (a->frac[0])
#define VpIsOne(a) ((a->Prec==1)&&(a->frac[0]==1)&&(a->exponent==1))
#define VpExponent(a) (a->exponent)
#ifdef BIGDECIMAL_DEBUG
int VpVarCheck(Real * v);
+VP_EXPORT int VPrint(FILE *fp,const char *cntl_chr,Real *a);
#endif /* BIGDECIMAL_DEBUG */
#if defined(__cplusplus)
diff --git a/ext/bigdecimal/depend b/ext/bigdecimal/depend
index d9c6600b80..a68128478c 100644
--- a/ext/bigdecimal/depend
+++ b/ext/bigdecimal/depend
@@ -1,13 +1 @@
-# AUTOGENERATED DEPENDENCIES START
-bigdecimal.o: $(RUBY_EXTCONF_H)
-bigdecimal.o: $(arch_hdrdir)/ruby/config.h
-bigdecimal.o: $(hdrdir)/ruby/defines.h
-bigdecimal.o: $(hdrdir)/ruby/intern.h
-bigdecimal.o: $(hdrdir)/ruby/missing.h
-bigdecimal.o: $(hdrdir)/ruby/st.h
-bigdecimal.o: $(hdrdir)/ruby/subst.h
-bigdecimal.o: $(hdrdir)/ruby/util.h
-bigdecimal.o: $(hdrdir)/ruby/ruby.h
-bigdecimal.o: bigdecimal.c
-bigdecimal.o: bigdecimal.h
-# AUTOGENERATED DEPENDENCIES END
+bigdecimal.o: bigdecimal.c bigdecimal.h $(HDRS) $(ruby_headers)
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index 3799e685bc..d6be3e584e 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -1,11 +1,6 @@
-# frozen_string_literal: false
require 'mkmf'
have_func("labs", "stdlib.h")
have_func("llabs", "stdlib.h")
-have_type("struct RRational", "ruby.h")
-have_func("rb_rational_num", "ruby.h")
-have_func("rb_rational_den", "ruby.h")
-
create_makefile('bigdecimal')
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index 9cad06c09b..eb9b1c9fc5 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# require 'bigdecimal/jacobian'
#
@@ -76,7 +75,7 @@ module Jacobian
# Computes the Jacobian of f at x. fx is the value of f at x.
def jacobian(f,fx,x)
n = x.size
- dfdx = Array.new(n*n)
+ dfdx = Array::new(n*n)
for i in 0...n do
df = dfdxi(f,fx,x,i)
for j in 0...n do
diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
index dd265e482a..6cbe29b6da 100644
--- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
+++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'bigdecimal'
#
diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb
index 3ddde6a9a0..4504ccb2b0 100644
--- a/ext/bigdecimal/lib/bigdecimal/math.rb
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'bigdecimal'
#
@@ -37,8 +36,8 @@ module BigMath
# Computes the square root of +decimal+ to the specified number of digits of
# precision, +numeric+.
#
- # BigMath.sqrt(BigDecimal.new('2'), 16).to_s
- # #=> "0.1414213562373095048801688724E1"
+ # BigMath::sqrt(BigDecimal.new('2'), 16).to_s
+ # #=> "0.14142135623730950488016887242096975E1"
#
def sqrt(x, prec)
x.sqrt(prec)
@@ -52,7 +51,7 @@ module BigMath
#
# If +decimal+ is Infinity or NaN, returns NaN.
#
- # BigMath.sin(BigMath.PI(5)/4, 5).to_s
+ # BigMath::sin(BigMath::PI(5)/4, 5).to_s
# #=> "0.70710678118654752440082036563292800375E0"
#
def sin(x, prec)
@@ -96,7 +95,7 @@ module BigMath
#
# If +decimal+ is Infinity or NaN, returns NaN.
#
- # BigMath.cos(BigMath.PI(4), 16).to_s
+ # BigMath::cos(BigMath::PI(4), 16).to_s
# #=> "-0.999999999999999999999999999999856613163740061349E0"
#
def cos(x, prec)
@@ -140,7 +139,7 @@ module BigMath
#
# If +decimal+ is NaN, returns NaN.
#
- # BigMath.atan(BigDecimal.new('-1'), 16).to_s
+ # BigMath::atan(BigDecimal.new('-1'), 16).to_s
# #=> "-0.785398163397448309615660845819878471907514682065E0"
#
def atan(x, prec)
@@ -177,11 +176,11 @@ module BigMath
# Computes the value of pi to the specified number of digits of precision,
# +numeric+.
#
- # BigMath.PI(10).to_s
+ # BigMath::PI(10).to_s
# #=> "0.3141592653589793238462643388813853786957412E1"
#
def PI(prec)
- raise ArgumentError, "Zero or negative precision for PI" if prec <= 0
+ raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
n = prec + BigDecimal.double_fig
zero = BigDecimal("0")
one = BigDecimal("1")
@@ -222,11 +221,24 @@ module BigMath
# Computes e (the base of natural logarithms) to the specified number of
# digits of precision, +numeric+.
#
- # BigMath.E(10).to_s
+ # BigMath::E(10).to_s
# #=> "0.271828182845904523536028752390026306410273E1"
#
def E(prec)
raise ArgumentError, "Zero or negative precision for E" if prec <= 0
- BigMath.exp(1, prec)
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ y = one
+ d = y
+ z = one
+ i = 0
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ i += 1
+ z *= i
+ d = one.div(z,m)
+ y += d
+ end
+ y
end
end
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
index 85bacb7f2e..db1a5ad99e 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "bigdecimal/ludcmp"
require "bigdecimal/jacobian"
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
index 0c4e486c00..82c82c8e1e 100644
--- a/ext/bigdecimal/lib/bigdecimal/util.rb
+++ b/ext/bigdecimal/lib/bigdecimal/util.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# BigDecimal extends the native Integer class to provide the #to_d method.
#
# When you require the BigDecimal library in your application, this methodwill
diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb
index 3b23269f8a..93d558b539 100644
--- a/ext/bigdecimal/sample/linear.rb
+++ b/ext/bigdecimal/sample/linear.rb
@@ -1,5 +1,4 @@
#!/usr/local/bin/ruby
-# frozen_string_literal: false
#
# linear.rb
@@ -17,8 +16,8 @@ require "bigdecimal/ludcmp"
#
# NOTE:
-# Change following BigDecimal.limit() if needed.
-BigDecimal.limit(100)
+# Change following BigDecimal::limit() if needed.
+BigDecimal::limit(100)
#
include LUSolve
@@ -28,8 +27,8 @@ def rd_order(na)
end
na = ARGV.size
-zero = BigDecimal.new("0.0")
-one = BigDecimal.new("1.0")
+zero = BigDecimal::new("0.0")
+one = BigDecimal::new("1.0")
while (n=rd_order(na))>0
a = []
@@ -41,10 +40,10 @@ while (n=rd_order(na))>0
for i in 0...n do
for j in 0...n do
printf("A[%d,%d]? ",i,j); s = ARGF.gets
- a << BigDecimal.new(s);
- as << BigDecimal.new(s);
+ a << BigDecimal::new(s);
+ as << BigDecimal::new(s);
end
- printf("Contatant vector element b[%d] ? ",i); b << BigDecimal.new(ARGF.gets);
+ printf("Contatant vector element b[%d] ? ",i); b << BigDecimal::new(ARGF.gets);
end
else
# Read data from specified file.
@@ -54,10 +53,10 @@ while (n=rd_order(na))>0
printf("%d) %s",i,s)
s = s.split
for j in 0...n do
- a << BigDecimal.new(s[j]);
- as << BigDecimal.new(s[j]);
+ a << BigDecimal::new(s[j]);
+ as << BigDecimal::new(s[j]);
end
- b << BigDecimal.new(s[n]);
+ b << BigDecimal::new(s[n]);
end
end
x = lusolve(a,b,ludecomp(a,n,zero,one),zero)
diff --git a/ext/bigdecimal/sample/nlsolve.rb b/ext/bigdecimal/sample/nlsolve.rb
index b1dd08e0a3..692a5023cc 100644
--- a/ext/bigdecimal/sample/nlsolve.rb
+++ b/ext/bigdecimal/sample/nlsolve.rb
@@ -1,5 +1,4 @@
#!/usr/local/bin/ruby
-# frozen_string_literal: false
#
# nlsolve.rb
@@ -12,11 +11,11 @@ include Newton
class Function # :nodoc: all
def initialize()
- @zero = BigDecimal.new("0.0")
- @one = BigDecimal.new("1.0")
- @two = BigDecimal.new("2.0")
- @ten = BigDecimal.new("10.0")
- @eps = BigDecimal.new("1.0e-16")
+ @zero = BigDecimal::new("0.0")
+ @one = BigDecimal::new("1.0")
+ @two = BigDecimal::new("2.0")
+ @ten = BigDecimal::new("10.0")
+ @eps = BigDecimal::new("1.0e-16")
end
def zero;@zero;end
def one ;@one ;end
@@ -32,9 +31,8 @@ class Function # :nodoc: all
f
end
end
-
-f = BigDecimal.limit(100)
-f = Function.new
-x = [f.zero,f.zero] # Initial values
-n = nlsolve(f,x)
-p x
+ f = BigDecimal::limit(100)
+ f = Function.new
+ x = [f.zero,f.zero] # Initial values
+ n = nlsolve(f,x)
+ p x
diff --git a/ext/bigdecimal/sample/pi.rb b/ext/bigdecimal/sample/pi.rb
index ea9663896c..2f7dd27d60 100644
--- a/ext/bigdecimal/sample/pi.rb
+++ b/ext/bigdecimal/sample/pi.rb
@@ -1,5 +1,4 @@
#!/usr/local/bin/ruby
-# frozen_string_literal: false
#
# pi.rb
diff --git a/ext/cgi/escape/escape.c b/ext/cgi/escape/escape.c
deleted file mode 100644
index e8f64f6dcc..0000000000
--- a/ext/cgi/escape/escape.c
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "ruby.h"
-#include "ruby/encoding.h"
-
-static VALUE rb_cCGI, rb_mUtil, rb_mEscape;
-
-static void
-html_escaped_cat(VALUE str, char c)
-{
- switch (c) {
- case '\'':
- rb_str_cat_cstr(str, "&#39;");
- break;
- case '&':
- rb_str_cat_cstr(str, "&amp;");
- break;
- case '"':
- rb_str_cat_cstr(str, "&quot;");
- break;
- case '<':
- rb_str_cat_cstr(str, "&lt;");
- break;
- case '>':
- rb_str_cat_cstr(str, "&gt;");
- break;
- }
-}
-
-static inline void
-preserve_original_state(VALUE orig, VALUE dest)
-{
- rb_enc_associate(dest, rb_enc_get(orig));
-
- RB_OBJ_INFECT_RAW(dest, orig);
-}
-
-static VALUE
-optimized_escape_html(VALUE str)
-{
- long i, len, modified = 0, beg = 0;
- VALUE dest;
- const char *cstr;
-
- len = RSTRING_LEN(str);
- cstr = RSTRING_PTR(str);
-
- for (i = 0; i < len; i++) {
- switch (cstr[i]) {
- case '\'':
- case '&':
- case '"':
- case '<':
- case '>':
- if (!modified) {
- modified = 1;
- dest = rb_str_buf_new(len);
- }
-
- rb_str_cat(dest, cstr + beg, i - beg);
- beg = i + 1;
-
- html_escaped_cat(dest, cstr[i]);
- break;
- }
- }
-
- if (modified) {
- rb_str_cat(dest, cstr + beg, len - beg);
- preserve_original_state(str, dest);
- return dest;
- }
- else {
- return rb_str_dup(str);
- }
-}
-
-/*
- * call-seq:
- * CGI.escapeHTML(string) -> string
- *
- * Returns HTML-escaped string.
- *
- */
-static VALUE
-cgiesc_escape_html(VALUE self, VALUE str)
-{
- StringValue(str);
-
- if (rb_enc_str_asciicompat_p(str)) {
- return optimized_escape_html(str);
- }
- else {
- return rb_call_super(1, &str);
- }
-}
-
-void
-Init_escape(void)
-{
- rb_cCGI = rb_define_class("CGI", rb_cObject);
- rb_mEscape = rb_define_module_under(rb_cCGI, "Escape");
- rb_mUtil = rb_define_module_under(rb_cCGI, "Util");
- rb_define_method(rb_mEscape, "escapeHTML", cgiesc_escape_html, 1);
- rb_prepend_module(rb_mUtil, rb_mEscape);
- rb_extend_object(rb_cCGI, rb_mEscape);
-}
diff --git a/ext/cgi/escape/extconf.rb b/ext/cgi/escape/extconf.rb
deleted file mode 100644
index 16e8ff224d..0000000000
--- a/ext/cgi/escape/extconf.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'mkmf'
-
-create_makefile 'cgi/escape'
diff --git a/ext/continuation/continuation.c b/ext/continuation/continuation.c
index c678371cca..ae69b66cd8 100644
--- a/ext/continuation/continuation.c
+++ b/ext/continuation/continuation.c
@@ -1,13 +1,8 @@
-#include "ruby/ruby.h"
-
void ruby_Init_Continuation_body(void);
void
Init_continuation(void)
{
-#ifndef RUBY_EXPORT
- rb_warn("callcc is obsolete; use Fiber instead");
-#endif
ruby_Init_Continuation_body();
}
diff --git a/ext/continuation/extconf.rb b/ext/continuation/extconf.rb
index 6d54ec01a5..17e2d056db 100644
--- a/ext/continuation/extconf.rb
+++ b/ext/continuation/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('continuation')
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
index f621280ca6..93cb2a5c9e 100644
--- a/ext/coverage/coverage.c
+++ b/ext/coverage/coverage.c
@@ -32,22 +32,14 @@ rb_coverage_start(VALUE klass)
return Qnil;
}
-/* Make coverage arrays empty so old covered files are no longer tracked. */
static int
-coverage_clear_result_i(st_data_t key, st_data_t val, st_data_t h)
-{
- VALUE coverage = (VALUE)val;
- rb_ary_clear(coverage);
- return ST_CONTINUE;
-}
-
-static int
-coverage_peek_result_i(st_data_t key, st_data_t val, st_data_t h)
+coverage_result_i(st_data_t key, st_data_t val, st_data_t h)
{
VALUE path = (VALUE)key;
VALUE coverage = (VALUE)val;
VALUE coverages = (VALUE)h;
coverage = rb_ary_dup(coverage);
+ rb_ary_clear((VALUE)val);
rb_ary_freeze(coverage);
rb_hash_aset(coverages, path, coverage);
return ST_CONTINUE;
@@ -55,36 +47,21 @@ coverage_peek_result_i(st_data_t key, st_data_t val, st_data_t h)
/*
* call-seq:
- * Coverage.peek_result => hash
+ * Coverage.result => hash
*
- * Returns a hash that contains filename as key and coverage array as value.
+ * Returns a hash that contains filename as key and coverage array as value
+ * and disables coverage measurement.
*/
static VALUE
-rb_coverage_peek_result(VALUE klass)
+rb_coverage_result(VALUE klass)
{
VALUE coverages = rb_get_coverages();
VALUE ncoverages = rb_hash_new();
if (!RTEST(coverages)) {
rb_raise(rb_eRuntimeError, "coverage measurement is not enabled");
}
- st_foreach(RHASH_TBL(coverages), coverage_peek_result_i, ncoverages);
+ st_foreach(RHASH_TBL(coverages), coverage_result_i, ncoverages);
rb_hash_freeze(ncoverages);
- return ncoverages;
-}
-
-/*
- * call-seq:
- * Coverage.result => hash
- *
- * Returns a hash that contains filename as key and coverage array as value
- * and disables coverage measurement.
- */
-static VALUE
-rb_coverage_result(VALUE klass)
-{
- VALUE ncoverages = rb_coverage_peek_result(klass);
- VALUE coverages = rb_get_coverages();
- st_foreach(RHASH_TBL(coverages), coverage_clear_result_i, ncoverages);
rb_reset_coverages();
return ncoverages;
}
@@ -94,7 +71,7 @@ rb_coverage_result(VALUE klass)
*
* = Usage
*
- * 1. require "coverage"
+ * 1. require "coverage.so"
* 2. do Coverage.start
* 3. require or load Ruby source file
* 4. Coverage.result will return a hash that contains filename as key and
@@ -117,7 +94,7 @@ rb_coverage_result(VALUE klass)
* end
* [EOF]
*
- * require "coverage"
+ * require "coverage.so"
* Coverage.start
* require "foo.rb"
* p Coverage.result #=> {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
@@ -128,6 +105,5 @@ Init_coverage(void)
VALUE rb_mCoverage = rb_define_module("Coverage");
rb_define_module_function(rb_mCoverage, "start", rb_coverage_start, 0);
rb_define_module_function(rb_mCoverage, "result", rb_coverage_result, 0);
- rb_define_module_function(rb_mCoverage, "peek_result", rb_coverage_peek_result, 0);
rb_gc_register_address(&rb_coverages);
}
diff --git a/ext/coverage/depend b/ext/coverage/depend
index 04eaf10d0a..1227a5c9ae 100644
--- a/ext/coverage/depend
+++ b/ext/coverage/depend
@@ -8,34 +8,4 @@ $(OBJS): $(HDRS) $(ruby_headers) \
$(top_srcdir)/ruby_atomic.h \
$(top_srcdir)/thread_pthread.h \
$(top_srcdir)/internal.h \
- $(top_srcdir)/include/ruby/thread_native.h
-
-# AUTOGENERATED DEPENDENCIES START
-coverage.o: $(RUBY_EXTCONF_H)
-coverage.o: $(arch_hdrdir)/ruby/config.h
-coverage.o: $(hdrdir)/ruby/defines.h
-coverage.o: $(hdrdir)/ruby/encoding.h
-coverage.o: $(hdrdir)/ruby/intern.h
-coverage.o: $(hdrdir)/ruby/io.h
-coverage.o: $(hdrdir)/ruby/missing.h
-coverage.o: $(hdrdir)/ruby/oniguruma.h
-coverage.o: $(hdrdir)/ruby/ruby.h
-coverage.o: $(hdrdir)/ruby/st.h
-coverage.o: $(hdrdir)/ruby/subst.h
-coverage.o: $(hdrdir)/ruby/thread_native.h
-coverage.o: $(top_srcdir)/ccan/check_type/check_type.h
-coverage.o: $(top_srcdir)/ccan/container_of/container_of.h
-coverage.o: $(top_srcdir)/ccan/list/list.h
-coverage.o: $(top_srcdir)/ccan/str/str.h
-coverage.o: $(top_srcdir)/include/ruby.h
-coverage.o: $(top_srcdir)/internal.h
-coverage.o: $(top_srcdir)/method.h
-coverage.o: $(top_srcdir)/node.h
-coverage.o: $(top_srcdir)/ruby_atomic.h
-coverage.o: $(top_srcdir)/thread_pthread.h
-coverage.o: $(top_srcdir)/vm_core.h
-coverage.o: $(top_srcdir)/vm_debug.h
-coverage.o: $(top_srcdir)/vm_opts.h
-coverage.o: coverage.c
-coverage.o: {$(VPATH)}id.h
-# AUTOGENERATED DEPENDENCIES END
+ $(top_srcdir)/thread_native.h
diff --git a/ext/coverage/extconf.rb b/ext/coverage/extconf.rb
index 3a6f530a92..769f85b6ef 100644
--- a/ext/coverage/extconf.rb
+++ b/ext/coverage/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
$VPATH << '$(topdir)' << '$(top_srcdir)'
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
new file mode 100644
index 0000000000..22b6823ff1
--- /dev/null
+++ b/ext/curses/curses.c
@@ -0,0 +1,4348 @@
+/* -*- C -*-
+ * $Id$
+ *
+ * ext/curses/curses.c
+ *
+ * by MAEDA Shugo (ender@pic-internet.or.jp)
+ * modified by Yukihiro Matsumoto (matz@netlab.co.jp),
+ * Toki Yoshinori,
+ * Hitoshi Takahashi,
+ * and Takaaki Tateishi (ttate@kt.jaist.ac.jp)
+ *
+ * maintainers:
+ * - Takaaki Tateishi (ttate@kt.jaist.ac.jp)
+ *
+ * documentation:
+ * - Vincent Batts (vbatts@hashbangbash.com)
+ */
+
+#include "ruby.h"
+#include "ruby/io.h"
+#include "ruby/thread.h"
+
+#if defined(HAVE_NCURSES_H)
+# include <ncurses.h>
+#elif defined(HAVE_NCURSES_CURSES_H)
+# include <ncurses/curses.h>
+#elif defined(HAVE_CURSES_COLR_CURSES_H)
+# ifdef HAVE_STDARG_PROTOTYPES
+# include <stdarg.h>
+# else
+# include <varargs.h>
+# endif
+# include <curses_colr/curses.h>
+#else
+# include <curses.h>
+# if defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)
+# if !defined(_maxx)
+# define _maxx maxx
+# endif
+# if !defined(_maxy)
+# define _maxy maxy
+# endif
+# if !defined(_begx)
+# define _begx begx
+# endif
+# if !defined(_begy)
+# define _begy begy
+# endif
+# endif
+#endif
+
+#ifdef HAVE_INIT_COLOR
+# define USE_COLOR 1
+#endif
+
+/* supports only ncurses mouse routines */
+#ifdef NCURSES_MOUSE_VERSION
+# define USE_MOUSE 1
+#endif
+
+#if CHTYPE_IS_ULONG
+# define NUM2CH NUM2ULONG
+# define CH2NUM ULONG2NUM
+#else
+# if CHTYPE_IS_UINT
+# define NUM2CH NUM2UINT
+# define CH2NUM UINT2NUM
+# else
+# define NUM2CH NUM2CHR
+# define CH2NUM CHR2FIX
+# endif
+#endif
+
+static VALUE mCurses;
+static VALUE mKey;
+static VALUE cWindow;
+static VALUE cPad;
+#ifdef USE_MOUSE
+static VALUE cMouseEvent;
+#endif
+
+static VALUE rb_stdscr;
+
+struct windata {
+ WINDOW *window;
+};
+
+static VALUE window_attroff(VALUE obj, VALUE attrs);
+static VALUE window_attron(VALUE obj, VALUE attrs);
+static VALUE window_attrset(VALUE obj, VALUE attrs);
+
+static void
+no_window(void)
+{
+ rb_raise(rb_eRuntimeError, "already closed window");
+}
+
+#define GetWINDOW(obj, winp) do {\
+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted window");\
+ TypedData_Get_Struct((obj), struct windata, &windata_type, (winp));\
+ if ((winp)->window == 0) no_window();\
+} while (0)
+
+static void
+window_free(void *p)
+{
+ struct windata *winp = p;
+ if (winp->window && winp->window != stdscr) delwin(winp->window);
+ winp->window = 0;
+ xfree(winp);
+}
+
+static size_t
+window_memsize(const void *p)
+{
+ const struct windata *winp = p;
+ size_t size = sizeof(*winp);
+ if (!winp) return 0;
+ if (winp->window && winp->window != stdscr) size += sizeof(winp->window);
+ return size;
+}
+
+static const rb_data_type_t windata_type = {
+ "windata",
+ {0, window_free, window_memsize,}
+};
+
+static VALUE
+prep_window(VALUE class, WINDOW *window)
+{
+ VALUE obj;
+ struct windata *winp;
+
+ if (window == NULL) {
+ rb_raise(rb_eRuntimeError, "failed to create window");
+ }
+
+ obj = rb_obj_alloc(class);
+ TypedData_Get_Struct(obj, struct windata, &windata_type, winp);
+ winp->window = window;
+
+ return obj;
+}
+
+/*-------------------------- module Curses --------------------------*/
+
+/*
+ * Document-method: Curses.init_screen
+ *
+ * Initialize a standard screen
+ *
+ * see also Curses.stdscr
+ */
+static VALUE
+curses_init_screen(void)
+{
+ if (rb_stdscr) return rb_stdscr;
+ initscr();
+ if (stdscr == 0) {
+ rb_raise(rb_eRuntimeError, "can't initialize curses");
+ }
+ clear();
+ rb_stdscr = prep_window(cWindow, stdscr);
+ return rb_stdscr;
+}
+
+/*
+ * Document-method: Curses.stdscr
+ *
+ * The Standard Screen.
+ *
+ * Upon initializing curses, a default window called stdscr,
+ * which is the size of the terminal screen, is created.
+ *
+ * Many curses functions use this window.
+ */
+#define curses_stdscr curses_init_screen
+
+/*
+ * Document-method: Curses.close_screen
+ *
+ * A program should always call Curses.close_screen before exiting or
+ * escaping from curses mode temporarily. This routine
+ * restores tty modes, moves the cursor to the lower
+ * left-hand corner of the screen and resets the terminal
+ * into the proper non-visual mode.
+ *
+ * Calling Curses.refresh or Curses.doupdate after a temporary
+ * escape causes the program to resume visual mode.
+ *
+ */
+static VALUE
+curses_close_screen(void)
+{
+ curses_stdscr();
+#ifdef HAVE_ISENDWIN
+ if (!isendwin())
+#endif
+ endwin();
+ rb_stdscr = 0;
+ return Qnil;
+}
+
+/*
+ * This is no runtime method,
+ * but a function called before the proc ends
+ *
+ * Similar to Curses.close_screen, except that it also
+ * garbage collects/unregisters the Curses.stdscr
+ */
+static void
+curses_finalize(VALUE dummy)
+{
+ if (stdscr
+#ifdef HAVE_ISENDWIN
+ && !isendwin()
+#endif
+ )
+ endwin();
+ rb_stdscr = 0;
+ rb_gc_unregister_address(&rb_stdscr);
+}
+
+#ifdef HAVE_ISENDWIN
+/*
+ * Document-method: Curses.closed?
+ *
+ * Returns +true+ if the window/screen has been closed,
+ * without any subsequent Curses.refresh calls,
+ * returns +false+ otherwise.
+ */
+static VALUE
+curses_closed(void)
+{
+ curses_stdscr();
+ if (isendwin()) {
+ return Qtrue;
+ }
+ return Qfalse;
+}
+#else
+#define curses_closed rb_f_notimplement
+#endif
+
+/*
+ * Document-method: Curses.clear
+ *
+ * Clears every position on the screen completely,
+ * so that a subsequent call by Curses.refresh for the screen/window
+ * will be repainted from scratch.
+ */
+static VALUE
+curses_clear(VALUE obj)
+{
+ curses_stdscr();
+ wclear(stdscr);
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.clrtoeol
+ *
+ * Clears to the end of line, that the cursor is currently on.
+ */
+static VALUE
+curses_clrtoeol(void)
+{
+ curses_stdscr();
+ clrtoeol();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.refresh
+ *
+ * Refreshes the windows and lines.
+ *
+ */
+static VALUE
+curses_refresh(VALUE obj)
+{
+ curses_stdscr();
+ refresh();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.doupdate
+ *
+ * Refreshes the windows and lines.
+ *
+ * Curses.doupdate allows multiple updates with
+ * more efficiency than Curses.refresh alone.
+ */
+static VALUE
+curses_doupdate(VALUE obj)
+{
+ curses_stdscr();
+#ifdef HAVE_DOUPDATE
+ doupdate();
+#else
+ refresh();
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.echo
+ *
+ * Enables characters typed by the user
+ * to be echoed by Curses.getch as they are typed.
+ */
+static VALUE
+curses_echo(VALUE obj)
+{
+ curses_stdscr();
+ echo();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.noecho
+ *
+ * Disables characters typed by the user
+ * to be echoed by Curses.getch as they are typed.
+ */
+static VALUE
+curses_noecho(VALUE obj)
+{
+ curses_stdscr();
+ noecho();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.raw
+ *
+ * Put the terminal into raw mode.
+ *
+ * Raw mode is similar to Curses.cbreak mode, in that characters typed
+ * are immediately passed through to the user program.
+ *
+ * The differences are that in raw mode, the interrupt, quit,
+ * suspend, and flow control characters are all passed through
+ * uninterpreted, instead of generating a signal. The behavior
+ * of the BREAK key depends on other bits in the tty driver
+ * that are not set by curses.
+ */
+static VALUE
+curses_raw(VALUE obj)
+{
+ curses_stdscr();
+ raw();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.noraw
+ *
+ * Put the terminal out of raw mode.
+ *
+ * see Curses.raw for more detail
+ */
+static VALUE
+curses_noraw(VALUE obj)
+{
+ curses_stdscr();
+ noraw();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.cbreak
+ *
+ * Put the terminal into cbreak mode.
+ *
+ * Normally, the tty driver buffers typed characters until
+ * a newline or carriage return is typed. The Curses.cbreak
+ * routine disables line buffering and erase/kill
+ * character-processing (interrupt and flow control characters
+ * are unaffected), making characters typed by the user
+ * immediately available to the program.
+ *
+ * The Curses.nocbreak routine returns the terminal to normal (cooked) mode.
+ *
+ * Initially the terminal may or may not be in cbreak mode,
+ * as the mode is inherited; therefore, a program should
+ * call Curses.cbreak or Curses.nocbreak explicitly.
+ * Most interactive programs using curses set the cbreak mode.
+ * Note that Curses.cbreak overrides Curses.raw.
+ *
+ * see also Curses.raw
+ */
+static VALUE
+curses_cbreak(VALUE obj)
+{
+ curses_stdscr();
+ cbreak();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.nocbreak
+ *
+ * Put the terminal into normal mode (out of cbreak mode).
+ *
+ * See Curses.cbreak for more detail.
+ */
+static VALUE
+curses_nocbreak(VALUE obj)
+{
+ curses_stdscr();
+ nocbreak();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.nl
+ *
+ * Enable the underlying display device to translate
+ * the return key into newline on input, and whether it
+ * translates newline into return and line-feed on output
+ * (in either case, the call Curses.addch('\n') does the
+ * equivalent of return and line feed on the virtual screen).
+ *
+ * Initially, these translations do occur. If you disable
+ * them using Curses.nonl, curses will be able to make better use
+ * of the line-feed capability, resulting in faster cursor
+ * motion. Also, curses will then be able to detect the return key.
+ */
+static VALUE
+curses_nl(VALUE obj)
+{
+ curses_stdscr();
+ nl();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.nl
+ *
+ * Disable the underlying display device to translate
+ * the return key into newline on input
+ *
+ * See Curses.nl for more detail
+ */
+static VALUE
+curses_nonl(VALUE obj)
+{
+ curses_stdscr();
+ nonl();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.beep
+ *
+ * Sounds an audible alarm on the terminal, if possible;
+ * otherwise it flashes the screen (visual bell).
+ *
+ * see also Curses.flash
+ */
+static VALUE
+curses_beep(VALUE obj)
+{
+#ifdef HAVE_BEEP
+ curses_stdscr();
+ beep();
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.flash
+ *
+ * Flashes the screen, for visual alarm on the terminal, if possible;
+ * otherwise it sounds the alert.
+ *
+ * see also Curses.beep
+ */
+static VALUE
+curses_flash(VALUE obj)
+{
+#ifdef HAVE_FLASH
+ curses_stdscr();
+ flash();
+#endif
+ return Qnil;
+}
+
+static int
+curses_char(VALUE c)
+{
+ if (FIXNUM_P(c)) {
+ return NUM2INT(c);
+ }
+ else {
+ int cc;
+
+ StringValue(c);
+ if (RSTRING_LEN(c) == 0 || RSTRING_LEN(c) > 1) {
+ rb_raise(rb_eArgError, "string not corresponding a character");
+ }
+ cc = RSTRING_PTR(c)[0];
+ if (cc > 0x7f) {
+ rb_raise(rb_eArgError, "no multibyte string supported (yet)");
+ }
+ return cc;
+ }
+}
+
+#ifdef HAVE_UNGETCH
+/*
+ * Document-method: Curses.ungetch
+ * call-seq: ungetch(ch)
+ *
+ * Places +ch+ back onto the input queue to be returned by
+ * the next call to Curses.getch.
+ *
+ * There is just one input queue for all windows.
+ */
+static VALUE
+curses_ungetch(VALUE obj, VALUE ch)
+{
+ int c = curses_char(ch);
+ curses_stdscr();
+ ungetch(c);
+ return Qnil;
+}
+#else
+#define curses_ungetch rb_f_notimplement
+#endif
+
+/*
+ * Document-method: Curses.setpos
+ * call-seq: setpos(y, x)
+ *
+ * A setter for the position of the cursor,
+ * using coordinates +x+ and +y+
+ *
+ */
+static VALUE
+curses_setpos(VALUE obj, VALUE y, VALUE x)
+{
+ curses_stdscr();
+ move(NUM2INT(y), NUM2INT(x));
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.standout
+ *
+ * Enables the best highlighting mode of the terminal.
+ *
+ * This is equivalent to Curses:Window.attron(A_STANDOUT)
+ *
+ * see also Curses::Window.attrset additional information
+ */
+static VALUE
+curses_standout(VALUE obj)
+{
+ curses_stdscr();
+ standout();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.standend
+ *
+ * Enables the Normal display (no highlight)
+ *
+ * This is equivalent to Curses.attron(A_NORMAL)
+ *
+ * see also Curses::Window.attrset for additional information.
+ */
+static VALUE
+curses_standend(VALUE obj)
+{
+ curses_stdscr();
+ standend();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.inch
+ *
+ * Returns the character at the current position.
+ */
+static VALUE
+curses_inch(VALUE obj)
+{
+ curses_stdscr();
+ return CH2NUM(inch());
+}
+
+/*
+ * Document-method: Curses.addch
+ * call-seq: addch(ch)
+ *
+ * Add a character +ch+, with attributes, then advance the cursor.
+ *
+ * see also the system manual for curs_addch(3)
+ */
+static VALUE
+curses_addch(VALUE obj, VALUE ch)
+{
+ curses_stdscr();
+ addch(NUM2CH(ch));
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.insch
+ * call-seq: insch(ch)
+ *
+ * Insert a character +ch+, before the cursor.
+ *
+ */
+static VALUE
+curses_insch(VALUE obj, VALUE ch)
+{
+ curses_stdscr();
+ insch(NUM2CH(ch));
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.addstr
+ * call-seq: addstr(str)
+ *
+ * add a string of characters +str+, to the window and advance cursor
+ *
+ */
+static VALUE
+curses_addstr(VALUE obj, VALUE str)
+{
+ StringValue(str);
+ str = rb_str_export_locale(str);
+ curses_stdscr();
+ if (!NIL_P(str)) {
+ addstr(StringValueCStr(str));
+ }
+ return Qnil;
+}
+
+static void *
+getch_func(void *arg)
+{
+ int *ip = (int *)arg;
+ *ip = getch();
+ return 0;
+}
+
+/*
+ * Document-method: Curses.getch
+ *
+ * Read and returns a character from the window.
+ *
+ * See Curses::Key to all the function KEY_* available
+ *
+ */
+static VALUE
+curses_getch(VALUE obj)
+{
+ int c;
+
+ curses_stdscr();
+ rb_thread_call_without_gvl(getch_func, &c, RUBY_UBF_IO, 0);
+ if (c == EOF) return Qnil;
+ if (rb_isprint(c)) {
+ char ch = (char)c;
+
+ return rb_locale_str_new(&ch, 1);
+ }
+ return UINT2NUM(c);
+}
+
+/* This should be big enough.. I hope */
+#define GETSTR_BUF_SIZE 1024
+
+static void *
+getstr_func(void *arg)
+{
+ char *rtn = (char *)arg;
+#if defined(HAVE_GETNSTR)
+ getnstr(rtn,GETSTR_BUF_SIZE-1);
+#else
+ getstr(rtn);
+#endif
+ return 0;
+}
+
+/*
+ * Document-method: Curses.getstr
+ *
+ * This is equivalent to a series of Curses::Window.getch calls
+ *
+ */
+static VALUE
+curses_getstr(VALUE obj)
+{
+ char rtn[GETSTR_BUF_SIZE];
+
+ curses_stdscr();
+ rb_thread_call_without_gvl(getstr_func, rtn, RUBY_UBF_IO, 0);
+ return rb_locale_str_new_cstr(rtn);
+}
+
+/*
+ * Document-method: Curses.delch
+ *
+ * Delete the character under the cursor
+ *
+ */
+static VALUE
+curses_delch(VALUE obj)
+{
+ curses_stdscr();
+ delch();
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.deleteln
+ *
+ * Delete the line under the cursor.
+ *
+ */
+static VALUE
+curses_deleteln(VALUE obj)
+{
+ curses_stdscr();
+#if defined(HAVE_DELETELN) || defined(deleteln)
+ deleteln();
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.insertln
+ *
+ * Inserts a line above the cursor, and the bottom line is lost
+ *
+ */
+static VALUE
+curses_insertln(VALUE obj)
+{
+ curses_stdscr();
+#if defined(HAVE_INSERTLN) || defined(insertln)
+ insertln();
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses.keyname
+ * call-seq: keyname(c)
+ *
+ * Returns the character string corresponding to key +c+
+ */
+static VALUE
+curses_keyname(VALUE obj, VALUE c)
+{
+#ifdef HAVE_KEYNAME
+ int cc = curses_char(c);
+ const char *name;
+
+ curses_stdscr();
+ name = keyname(cc);
+ if (name) {
+ return rb_str_new_cstr(name);
+ }
+ else {
+ return Qnil;
+ }
+#else
+ return Qnil;
+#endif
+}
+
+/*
+ * Document-method: Curses.lines
+ *
+ * Returns the number of lines on the screen
+ */
+static VALUE
+curses_lines(void)
+{
+ return INT2FIX(LINES);
+}
+
+/*
+ * Document-method: Curses.cols
+ *
+ * Returns the number of columns on the screen
+ */
+static VALUE
+curses_cols(void)
+{
+ return INT2FIX(COLS);
+}
+
+/*
+ * Document-method: Curses.curs_set
+ * call-seq: curs_set(visibility)
+ *
+ * Sets Cursor Visibility.
+ * 0: invisible
+ * 1: visible
+ * 2: very visible
+ */
+static VALUE
+curses_curs_set(VALUE obj, VALUE visibility)
+{
+#ifdef HAVE_CURS_SET
+ int n;
+ curses_stdscr();
+ return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil;
+#else
+ return Qnil;
+#endif
+}
+
+/*
+ * Document-method: Curses.scrl
+ * call-seq: scrl(num)
+ *
+ * Scrolls the current window Fixnum +num+ lines.
+ * The current cursor position is not changed.
+ *
+ * For positive +num+, it scrolls up.
+ *
+ * For negative +num+, it scrolls down.
+ *
+ */
+static VALUE
+curses_scrl(VALUE obj, VALUE n)
+{
+ /* may have to raise exception on ERR */
+#ifdef HAVE_SCRL
+ curses_stdscr();
+ return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+/*
+ * Document-method: Curses.setscrreg
+ *
+ * call-seq:
+ * setscrreg(top, bottom)
+ *
+ * Set a software scrolling region in a window.
+ * +top+ and +bottom+ are lines numbers of the margin.
+ *
+ * If this option and Curses.scrollok are enabled, an attempt to move off
+ * the bottom margin line causes all lines in the scrolling region
+ * to scroll one line in the direction of the first line.
+ * Only the text of the window is scrolled.
+ *
+ */
+static VALUE
+curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
+{
+ /* may have to raise exception on ERR */
+#ifdef HAVE_SETSCRREG
+ curses_stdscr();
+ return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+/*
+ * Document-method: Curses.attroff
+ * call-seq: attroff(attrs)
+ *
+ * Turns on the named attributes +attrs+ without affecting any others.
+ *
+ * See also Curses::Window.attrset for additional information.
+ */
+static VALUE
+curses_attroff(VALUE obj, VALUE attrs)
+{
+ curses_stdscr();
+ return window_attroff(rb_stdscr,attrs);
+ /* return INT2FIX(attroff(NUM2INT(attrs))); */
+}
+
+/*
+ * Document-method: Curses.attron
+ * call-seq: attron(attrs)
+ *
+ * Turns off the named attributes +attrs+
+ * without turning any other attributes on or off.
+ *
+ * See also Curses::Window.attrset for additional information.
+ */
+static VALUE
+curses_attron(VALUE obj, VALUE attrs)
+{
+ curses_stdscr();
+ return window_attron(rb_stdscr,attrs);
+ /* return INT2FIX(attroff(NUM2INT(attrs))); */
+}
+
+/*
+ * Document-method: Curses.attrset
+ * call-seq: attrset(attrs)
+ *
+ * Sets the current attributes of the given window to +attrs+.
+ *
+ * see also Curses::Window.attrset
+ *
+ */
+static VALUE
+curses_attrset(VALUE obj, VALUE attrs)
+{
+ curses_stdscr();
+ return window_attrset(rb_stdscr,attrs);
+ /* return INT2FIX(attroff(NUM2INT(attrs))); */
+}
+
+/*
+ * Document-method: Curses.bkgdset
+ * call-seq: bkgdset(ch)
+ *
+ * Manipulate the background of the named window
+ * with character Integer +ch+
+ *
+ * The background becomes a property of the character
+ * and moves with the character through any scrolling
+ * and insert/delete line/character operations.
+ *
+ * see also the system manual for curs_bkgd(3)
+ */
+static VALUE
+curses_bkgdset(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_BKGDSET
+ curses_stdscr();
+ bkgdset(NUM2CH(ch));
+#endif
+ return Qnil;
+}
+
+/*
+ * call-seq: bkgd(ch)
+ *
+ * Window background manipulation routines.
+ *
+ * Set the background property of the current
+ * and then apply the character Integer +ch+ setting
+ * to every character position in that window.
+ *
+ * see also the system manual for curs_bkgd(3)
+ */
+static VALUE
+curses_bkgd(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_BKGD
+ curses_stdscr();
+ return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+#if defined(HAVE_USE_DEFAULT_COLORS)
+/*
+ * tells the curses library to use terminal's default colors.
+ *
+ * see also the system manual for default_colors(3)
+ */
+static VALUE
+curses_use_default_colors(VALUE obj)
+{
+ curses_stdscr();
+ use_default_colors();
+ return Qnil;
+}
+#else
+#define curses_use_default_colors rb_f_notimplement
+#endif
+
+#if defined(HAVE_TABSIZE)
+/*
+ * Document-method: Curses.TABSIZE=
+ * call-seq: TABSIZE=(value)
+ *
+ * Sets the TABSIZE to Integer +value+
+ */
+static VALUE
+curses_tabsize_set(VALUE obj, VALUE val)
+{
+ TABSIZE = NUM2INT(val);
+ return INT2NUM(TABSIZE);
+}
+#else
+#define curses_tabsize_set rb_f_notimplement
+#endif
+
+#if defined(HAVE_TABSIZE)
+/*
+ * Returns the number of positions in a tab.
+ */
+static VALUE
+curses_tabsize_get(VALUE ojb)
+{
+ return INT2NUM(TABSIZE);
+}
+#else
+#define curses_tabsize_get rb_f_notimplement
+#endif
+
+#if defined(HAVE_ESCDELAY)
+/*
+ * call-seq: Curses.ESCDELAY=(value)
+ *
+ * Sets the ESCDELAY to Integer +value+
+ */
+static VALUE
+curses_escdelay_set(VALUE obj, VALUE val)
+{
+ ESCDELAY = NUM2INT(val);
+ return INT2NUM(ESCDELAY);
+}
+#else
+#define curses_escdelay_set rb_f_notimplement
+#endif
+
+#if defined(HAVE_ESCDELAY)
+/*
+ * Returns the total time, in milliseconds, for which
+ * curses will await a character sequence, e.g., a function key
+ */
+static VALUE
+curses_escdelay_get(VALUE obj)
+{
+ return INT2NUM(ESCDELAY);
+}
+#else
+#define curses_escdelay_get rb_f_notimplement
+#endif
+
+/*
+ * Document-method: Curses.resize
+ * call-seq: resize(lines, cols)
+ *
+ * alias for Curses.resizeterm
+ *
+ */
+
+/*
+ * Document-method: Curses.resizeterm
+ * call-seq: resizeterm(lines, cols)
+ *
+ * Resize the current term to Fixnum +lines+ and Fixnum +cols+
+ *
+ */
+static VALUE
+curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
+{
+#if defined(HAVE_RESIZETERM)
+ curses_stdscr();
+ return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qnil;
+#endif
+}
+
+#ifdef USE_COLOR
+/*
+ * Document-method: Curses.start_color
+ *
+ * Initializes the color attributes, for terminals that support it.
+ *
+ * This must be called, in order to use color attributes.
+ * It is good practice to call it just after Curses.init_screen
+ */
+static VALUE
+curses_start_color(VALUE obj)
+{
+ /* may have to raise exception on ERR */
+ curses_stdscr();
+ return (start_color() == OK) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses.init_pair
+ * call-seq: init_pair(pair, f, b)
+ *
+ * Changes the definition of a color-pair.
+ *
+ * It takes three arguments: the number of the color-pair to be changed +pair+,
+ * the foreground color number +f+, and the background color number +b+.
+ *
+ * If the color-pair was previously initialized, the screen is
+ * refreshed and all occurrences of that color-pair are changed
+ * to the new definition.
+ *
+ */
+static VALUE
+curses_init_pair(VALUE obj, VALUE pair, VALUE f, VALUE b)
+{
+ /* may have to raise exception on ERR */
+ curses_stdscr();
+ return (init_pair(NUM2INT(pair),NUM2INT(f),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses.init_color
+ * call-seq: init_color(color, r, g, b)
+ *
+ * Changes the definition of a color. It takes four arguments:
+ * * the number of the color to be changed, +color+
+ * * the amount of red, +r+
+ * * the amount of green, +g+
+ * * the amount of blue, +b+
+ *
+ * The value of the first argument must be between 0 and COLORS.
+ * (See the section Colors for the default color index.) Each
+ * of the last three arguments must be a value between 0 and 1000.
+ * When Curses.init_color is used, all occurrences of that color
+ * on the screen immediately change to the new definition.
+ */
+static VALUE
+curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b)
+{
+ /* may have to raise exception on ERR */
+ curses_stdscr();
+ return (init_color(NUM2INT(color),NUM2INT(r),
+ NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses.has_colors?
+ *
+ * Returns +true+ or +false+ depending on whether the terminal has color capabilities.
+ */
+static VALUE
+curses_has_colors(VALUE obj)
+{
+ curses_stdscr();
+ return has_colors() ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses.can_change_color?
+ *
+ * Returns +true+ or +false+ depending on whether the terminal can change color attributes
+ */
+static VALUE
+curses_can_change_color(VALUE obj)
+{
+ curses_stdscr();
+ return can_change_color() ? Qtrue : Qfalse;
+}
+
+#if defined(HAVE_COLORS)
+/*
+ * Document-method: Curses.color
+ *
+ * returns COLORS
+ */
+static VALUE
+curses_colors(VALUE obj)
+{
+ return INT2FIX(COLORS);
+}
+#else
+#define curses_colors rb_f_notimplement
+#endif
+
+/*
+ * Document-method: Curses.color_content
+ * call-seq: color_content(color)
+ *
+ * Returns an 3 item Array of the RGB values in +color+
+ */
+static VALUE
+curses_color_content(VALUE obj, VALUE color)
+{
+ short r,g,b;
+
+ curses_stdscr();
+ color_content(NUM2INT(color),&r,&g,&b);
+ return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b));
+}
+
+
+#if defined(HAVE_COLOR_PAIRS)
+/*
+ * Document-method: Curses.color_pairs
+ *
+ * Returns the COLOR_PAIRS available, if the curses library supports it.
+ */
+static VALUE
+curses_color_pairs(VALUE obj)
+{
+ return INT2FIX(COLOR_PAIRS);
+}
+#else
+#define curses_color_pairs rb_f_notimplement
+#endif
+
+/*
+ * Document-method: Curses.pair_content
+ * call-seq: pair_content(pair)
+ *
+ * Returns a 2 item Array, with the foreground and
+ * background color, in +pair+
+ */
+static VALUE
+curses_pair_content(VALUE obj, VALUE pair)
+{
+ short f,b;
+
+ curses_stdscr();
+ pair_content(NUM2INT(pair),&f,&b);
+ return rb_ary_new3(2,INT2FIX(f),INT2FIX(b));
+}
+
+/*
+ * Document-method: Curses.color_pair
+ * call-seq: color_pair(attrs)
+ *
+ * Sets the color pair attributes to +attrs+.
+ *
+ * This should be equivalent to Curses.attrset(COLOR_PAIR(+attrs+))
+ *
+ * TODO: validate that equivalency
+ */
+static VALUE
+curses_color_pair(VALUE obj, VALUE attrs)
+{
+ return INT2FIX(COLOR_PAIR(NUM2INT(attrs)));
+}
+
+/*
+ * Document-method: Curses.pair_number
+ * call-seq: pair_number(attrs)
+ *
+ * Returns the Fixnum color pair number of attributes +attrs+.
+ */
+static VALUE
+curses_pair_number(VALUE obj, VALUE attrs)
+{
+ curses_stdscr();
+ return INT2FIX(PAIR_NUMBER(NUM2LONG(attrs)));
+}
+#endif /* USE_COLOR */
+
+#ifdef USE_MOUSE
+struct mousedata {
+ MEVENT *mevent;
+};
+
+static void
+no_mevent(void)
+{
+ rb_raise(rb_eRuntimeError, "no such mouse event");
+}
+
+#define GetMOUSE(obj, data) do {\
+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted mouse");\
+ TypedData_Get_Struct((obj), struct mousedata, &mousedata_type, (data));\
+ if ((data)->mevent == 0) no_mevent();\
+} while (0)
+
+static void
+curses_mousedata_free(void *p)
+{
+ struct mousedata *mdata = p;
+ if (mdata->mevent)
+ xfree(mdata->mevent);
+}
+
+static size_t
+curses_mousedata_memsize(const void *p)
+{
+ const struct mousedata *mdata = p;
+ size_t size = sizeof(*mdata);
+ if (!mdata) return 0;
+ if (mdata->mevent) size += sizeof(mdata->mevent);
+ return size;
+}
+
+static const rb_data_type_t mousedata_type = {
+ "mousedata",
+ {0, curses_mousedata_free, curses_mousedata_memsize,}
+};
+
+/*
+ * Document-method: Curses.getmouse
+ *
+ * Returns coordinates of the mouse.
+ *
+ * This will read and pop the mouse event data off the queue
+ *
+ * See the BUTTON*, ALL_MOUSE_EVENTS and REPORT_MOUSE_POSITION constants,
+ * to examine the mask of the event
+ */
+static VALUE
+curses_getmouse(VALUE obj)
+{
+ struct mousedata *mdata;
+ VALUE val;
+
+ curses_stdscr();
+ val = TypedData_Make_Struct(cMouseEvent,struct mousedata,
+ &mousedata_type,mdata);
+ mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT));
+ return (getmouse(mdata->mevent) == OK) ? val : Qnil;
+}
+
+/*
+ * Document-method: Curses.ungetmouse
+ *
+ * It pushes a KEY_MOUSE event onto the input queue, and associates with that
+ * event the given state data and screen-relative character-cell coordinates.
+ *
+ * The Curses.ungetmouse function behaves analogously to Curses.ungetch.
+ */
+static VALUE
+curses_ungetmouse(VALUE obj, VALUE mevent)
+{
+ struct mousedata *mdata;
+
+ curses_stdscr();
+ GetMOUSE(mevent,mdata);
+ return (ungetmouse(mdata->mevent) == OK) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses.mouseinterval
+ * call-seq: mouseinterval(interval)
+ *
+ * The Curses.mouseinterval function sets the maximum time
+ * (in thousands of a second) that can elapse between press
+ * and release events for them to be recognized as a click.
+ *
+ * Use Curses.mouseinterval(0) to disable click resolution.
+ * This function returns the previous interval value.
+ *
+ * Use Curses.mouseinterval(-1) to obtain the interval without
+ * altering it.
+ *
+ * The default is one sixth of a second.
+ */
+static VALUE
+curses_mouseinterval(VALUE obj, VALUE interval)
+{
+ curses_stdscr();
+ return mouseinterval(NUM2INT(interval)) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses.mousemask
+ * call-seq: mousemask(mask)
+ *
+ * Returns the +mask+ of the reportable events
+ */
+static VALUE
+curses_mousemask(VALUE obj, VALUE mask)
+{
+ curses_stdscr();
+ return INT2NUM(mousemask(NUM2UINT(mask),NULL));
+}
+
+#define DEFINE_MOUSE_GET_MEMBER(func_name,mem) \
+static VALUE func_name (VALUE mouse) \
+{ \
+ struct mousedata *mdata; \
+ GetMOUSE(mouse, mdata); \
+ return (UINT2NUM(mdata->mevent -> mem)); \
+}
+
+/*
+ * Document-method: Curses::MouseEvent.eid
+ *
+ * Returns the current mouse id
+ */
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_id, id)
+/*
+ * Document-method: Curses::MouseEvent.x
+ *
+ * Returns the current mouse's X coordinate
+ */
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_x, x)
+/*
+ * Document-method: Curses::MouseEvent.y
+ *
+ * Returns the current mouse's Y coordinate
+ */
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_y, y)
+/*
+ * Document-method: Curses::MouseEvent.z
+ *
+ * Returns the current mouse's Z coordinate
+ */
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_z, z)
+/*
+ * Document-method: Curses::MouseEvent.bstate
+ *
+ * Returns the current mouse's button state. Use this with the button state
+ * constants to determine which buttons were pressed.
+ */
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_bstate, bstate)
+#undef define_curs_mouse_member
+#endif /* USE_MOUSE */
+
+#ifdef HAVE_TIMEOUT
+/*
+ * Document-method: Curses.timeout=
+ * call-seq: timeout=(delay)
+ *
+ * Sets block and non-blocking reads for the window.
+ * - If delay is negative, blocking read is used (i.e., waits indefinitely for input).
+ * - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting).
+ * - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input.
+ *
+ */
+static VALUE
+curses_timeout(VALUE obj, VALUE delay)
+{
+ curses_stdscr();
+ timeout(NUM2INT(delay));
+ return Qnil;
+}
+#else
+#define curses_timeout rb_f_notimplement
+#endif
+
+#ifdef HAVE_DEF_PROG_MODE
+/*
+ * Document-method: Curses.def_prog_mode
+ *
+ * Save the current terminal modes as the "program"
+ * state for use by the Curses.reset_prog_mode
+ *
+ * This is done automatically by Curses.init_screen
+ */
+static VALUE
+curses_def_prog_mode(VALUE obj)
+{
+ curses_stdscr();
+ return def_prog_mode() == OK ? Qtrue : Qfalse;
+}
+#else
+#define curses_def_prog_mode rb_f_notimplement
+#endif
+
+#ifdef HAVE_RESET_PROG_MODE
+/*
+ * Document-method: Curses.reset_prog_mode
+ *
+ * Reset the current terminal modes to the saved state
+ * by the Curses.def_prog_mode
+ *
+ * This is done automatically by Curses.close_screen
+ */
+static VALUE
+curses_reset_prog_mode(VALUE obj)
+{
+ curses_stdscr();
+ return reset_prog_mode() == OK ? Qtrue : Qfalse;
+}
+#else
+#define curses_reset_prog_mode rb_f_notimplement
+#endif
+
+/*-------------------------- class Window --------------------------*/
+
+/* returns a Curses::Window object */
+static VALUE
+window_s_allocate(VALUE class)
+{
+ struct windata *winp;
+
+ return TypedData_Make_Struct(class, struct windata, &windata_type, winp);
+}
+
+/*
+ * Document-method: Curses::Window.new
+ * call-seq: new(height, width, top, left)
+ *
+ * Construct a new Curses::Window with constraints of
+ * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most
+ * column.
+ *
+ * A new window using full screen is called as
+ * Curses::Window.new(0,0,0,0)
+ *
+ */
+static VALUE
+window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
+{
+ struct windata *winp;
+ WINDOW *window;
+
+ curses_init_screen();
+ TypedData_Get_Struct(obj, struct windata, &windata_type, winp);
+ if (winp->window) delwin(winp->window);
+ window = newwin(NUM2INT(h), NUM2INT(w), NUM2INT(top), NUM2INT(left));
+ wclear(window);
+ winp->window = window;
+
+ return obj;
+}
+
+/*
+ * Document-method: Curses::Window.subwin
+ * call-seq: subwin(height, width, top, left)
+ *
+ * Construct a new sub-window with constraints of
+ * +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most
+ * column.
+ *
+ */
+static VALUE
+window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left)
+{
+ struct windata *winp;
+ WINDOW *window;
+ VALUE win;
+ int h, w, t, l;
+
+ h = NUM2INT(height);
+ w = NUM2INT(width);
+ t = NUM2INT(top);
+ l = NUM2INT(left);
+ GetWINDOW(obj, winp);
+ window = subwin(winp->window, h, w, t, l);
+ win = prep_window(rb_obj_class(obj), window);
+
+ return win;
+}
+
+/*
+ * Document-method: Curses::Window.close
+ *
+ * Deletes the window, and frees the memory
+ */
+static VALUE
+window_close(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ delwin(winp->window);
+ winp->window = 0;
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.clear
+ *
+ * Clear the window.
+ */
+static VALUE
+window_clear(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wclear(winp->window);
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.clrtoeol
+ *
+ * Clear the window to the end of line, that the cursor is currently on.
+ */
+static VALUE
+window_clrtoeol(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wclrtoeol(winp->window);
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.refresh
+ *
+ * Refreshes the windows and lines.
+ *
+ */
+static VALUE
+window_refresh(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wrefresh(winp->window);
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.noutrefresh
+ *
+ * Refreshes the windows and lines.
+ *
+ * Curses::Window.noutrefresh allows multiple updates with
+ * more efficiency than Curses::Window.refresh alone.
+ */
+static VALUE
+window_noutrefresh(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+#ifdef HAVE_DOUPDATE
+ wnoutrefresh(winp->window);
+#else
+ wrefresh(winp->window);
+#endif
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.move
+ * call-seq: move(y,x)
+ *
+ * Moves the window so that the upper left-hand corner is at position (+y+, +x+)
+ */
+static VALUE
+window_move(VALUE obj, VALUE y, VALUE x)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ mvwin(winp->window, NUM2INT(y), NUM2INT(x));
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.setpos
+ * call-seq: setpos(y, x)
+ *
+ * A setter for the position of the cursor
+ * in the current window,
+ * using coordinates +x+ and +y+
+ *
+ */
+static VALUE
+window_setpos(VALUE obj, VALUE y, VALUE x)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wmove(winp->window, NUM2INT(y), NUM2INT(x));
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.cury
+ *
+ * A getter for the current line (Y coordinate) of the window
+ */
+static VALUE
+window_cury(VALUE obj)
+{
+ struct windata *winp;
+ int RB_UNUSED_VAR(x), y;
+
+ GetWINDOW(obj, winp);
+ getyx(winp->window, y, x);
+ return INT2FIX(y);
+}
+
+/*
+ * Document-method: Curses::Window.curx
+ *
+ * A getter for the current column (X coordinate) of the window
+ */
+static VALUE
+window_curx(VALUE obj)
+{
+ struct windata *winp;
+ int x, RB_UNUSED_VAR(y);
+
+ GetWINDOW(obj, winp);
+ getyx(winp->window, y, x);
+ return INT2FIX(x);
+}
+
+/*
+ * Document-method: Curses::Window.maxy
+ *
+ * A getter for the maximum lines for the window
+ */
+static VALUE
+window_maxy(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+#if defined(getmaxy)
+ return INT2FIX(getmaxy(winp->window));
+#elif defined(getmaxyx)
+ {
+ int x, y;
+ getmaxyx(winp->window, y, x);
+ return INT2FIX(y);
+ }
+#else
+ return INT2FIX(winp->window->_maxy+1);
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.maxx
+ *
+ * A getter for the maximum columns for the window
+ */
+static VALUE
+window_maxx(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+#if defined(getmaxx)
+ return INT2FIX(getmaxx(winp->window));
+#elif defined(getmaxyx)
+ {
+ int x, y;
+ getmaxyx(winp->window, y, x);
+ return INT2FIX(x);
+ }
+#else
+ return INT2FIX(winp->window->_maxx+1);
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.begy
+ *
+ * A getter for the beginning line (Y coordinate) of the window
+ */
+static VALUE
+window_begy(VALUE obj)
+{
+ struct windata *winp;
+ int RB_UNUSED_VAR(x), y;
+
+ GetWINDOW(obj, winp);
+#ifdef getbegyx
+ getbegyx(winp->window, y, x);
+#else
+ y = winp->window->_begy;
+#endif
+ return INT2FIX(y);
+}
+
+/*
+ * Document-method: Curses::Window.begx
+ *
+ * A getter for the beginning column (X coordinate) of the window
+ */
+static VALUE
+window_begx(VALUE obj)
+{
+ struct windata *winp;
+ int x, RB_UNUSED_VAR(y);
+
+ GetWINDOW(obj, winp);
+#ifdef getbegyx
+ getbegyx(winp->window, y, x);
+#else
+ x = winp->window->_begx;
+#endif
+ return INT2FIX(x);
+}
+
+/*
+ * Document-method: Curses::Window.box
+ * call-seq: box(vert, hor)
+ *
+ * set the characters to frame the window in.
+ * The vertical +vert+ and horizontal +hor+ character.
+ *
+ * win = Curses::Window.new(5,5,5,5)
+ * win.box(?|, ?-)
+ *
+ */
+static VALUE
+window_box(int argc, VALUE *argv, VALUE self)
+{
+ struct windata *winp;
+ VALUE vert, hor, corn;
+
+ rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
+
+ GetWINDOW(self, winp);
+ box(winp->window, NUM2CH(vert), NUM2CH(hor));
+
+ if (!NIL_P(corn)) {
+ int cur_x, cur_y, x, y;
+ chtype c;
+
+ c = NUM2CH(corn);
+ getyx(winp->window, cur_y, cur_x);
+ x = NUM2INT(window_maxx(self)) - 1;
+ y = NUM2INT(window_maxy(self)) - 1;
+ wmove(winp->window, 0, 0);
+ waddch(winp->window, c);
+ wmove(winp->window, y, 0);
+ waddch(winp->window, c);
+ wmove(winp->window, y, x);
+ waddch(winp->window, c);
+ wmove(winp->window, 0, x);
+ waddch(winp->window, c);
+ wmove(winp->window, cur_y, cur_x);
+ }
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.standout
+ *
+ * Enables the best highlighting mode of the terminal.
+ *
+ * This is equivalent to Curses::Window.attron(A_STANDOUT)
+ *
+ * see also Curses::Window.attrset
+ */
+static VALUE
+window_standout(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wstandout(winp->window);
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.standend
+ *
+ * Enables the Normal display (no highlight)
+ *
+ * This is equivalent to Curses::Window.attron(A_NORMAL)
+ *
+ * see also Curses::Window.attrset
+ */
+static VALUE
+window_standend(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wstandend(winp->window);
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.inch
+ *
+ * Returns the character at the current position of the window.
+ */
+static VALUE
+window_inch(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ return CH2NUM(winch(winp->window));
+}
+
+/*
+ * Document-method: Curses::Window.addch
+ * call-seq: addch(ch)
+ *
+ * Add a character +ch+, with attributes, to the window, then advance the
+ * cursor.
+ *
+ * see also the system manual for curs_addch(3)
+ */
+static VALUE
+window_addch(VALUE obj, VALUE ch)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ waddch(winp->window, NUM2CH(ch));
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.insch
+ * call-seq: insch(ch)
+ *
+ * Insert a character +ch+, before the cursor, in the current window
+ *
+ */
+static VALUE
+window_insch(VALUE obj, VALUE ch)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ winsch(winp->window, NUM2CH(ch));
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.addstr
+ * call-seq: addstr(str)
+ *
+ * add a string of characters +str+, to the window and advance cursor
+ *
+ */
+static VALUE
+window_addstr(VALUE obj, VALUE str)
+{
+ if (!NIL_P(str)) {
+ struct windata *winp;
+
+ StringValue(str);
+ str = rb_str_export_locale(str);
+ GetWINDOW(obj, winp);
+ waddstr(winp->window, StringValueCStr(str));
+ }
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.<<
+ *
+ * call-seq:
+ * <<(str)
+ *
+ * Add String +str+ to the current string.
+ *
+ * See also Curses::Window.addstr
+ */
+static VALUE
+window_addstr2(VALUE obj, VALUE str)
+{
+ window_addstr(obj, str);
+ return obj;
+}
+
+struct wgetch_arg {
+ WINDOW *win;
+ int c;
+};
+
+static void *
+wgetch_func(void *_arg)
+{
+ struct wgetch_arg *arg = (struct wgetch_arg *)_arg;
+ arg->c = wgetch(arg->win);
+ return 0;
+}
+
+/*
+ * Document-method: Curses::Window.getch
+ *
+ * Read and returns a character from the window.
+ *
+ * See Curses::Key to all the function KEY_* available
+ *
+ */
+static VALUE
+window_getch(VALUE obj)
+{
+ struct windata *winp;
+ struct wgetch_arg arg;
+ int c;
+
+ GetWINDOW(obj, winp);
+ arg.win = winp->window;
+ rb_thread_call_without_gvl(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0);
+ c = arg.c;
+ if (c == EOF) return Qnil;
+ if (rb_isprint(c)) {
+ char ch = (char)c;
+
+ return rb_locale_str_new(&ch, 1);
+ }
+ return UINT2NUM(c);
+}
+
+struct wgetstr_arg {
+ WINDOW *win;
+ char rtn[GETSTR_BUF_SIZE];
+};
+
+static void *
+wgetstr_func(void *_arg)
+{
+ struct wgetstr_arg *arg = (struct wgetstr_arg *)_arg;
+#if defined(HAVE_WGETNSTR)
+ wgetnstr(arg->win, arg->rtn, GETSTR_BUF_SIZE-1);
+#else
+ wgetstr(arg->win, arg->rtn);
+#endif
+ return 0;
+}
+
+/*
+ * Document-method: Curses::Window.getstr
+ *
+ * This is equivalent to a series of Curses::Window.getch calls
+ *
+ */
+static VALUE
+window_getstr(VALUE obj)
+{
+ struct windata *winp;
+ struct wgetstr_arg arg;
+
+ GetWINDOW(obj, winp);
+ arg.win = winp->window;
+ rb_thread_call_without_gvl(wgetstr_func, (void *)&arg, RUBY_UBF_IO, 0);
+ return rb_locale_str_new_cstr(arg.rtn);
+}
+
+/*
+ * Document-method: Curses::Window.delch
+ *
+ * Delete the character under the cursor
+ *
+ */
+static VALUE
+window_delch(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wdelch(winp->window);
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.deleteln
+ *
+ * Delete the line under the cursor.
+ *
+ */
+static VALUE
+window_deleteln(VALUE obj)
+{
+#if defined(HAVE_WDELETELN) || defined(wdeleteln)
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ wdeleteln(winp->window);
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.insertln
+ *
+ * Inserts a line above the cursor, and the bottom line is lost
+ *
+ */
+static VALUE
+window_insertln(VALUE obj)
+{
+#if defined(HAVE_WINSERTLN) || defined(winsertln)
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ winsertln(winp->window);
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.scrollok
+ * call-seq: scrollok(bool)
+ *
+ * Controls what happens when the cursor of a window
+ * is moved off the edge of the window or scrolling region,
+ * either as a result of a newline action on the bottom line,
+ * or typing the last character of the last line.
+ *
+ * If disabled, (+bool+ is false), the cursor is left on the bottom line.
+ *
+ * If enabled, (+bool+ is true), the window is scrolled up one line
+ * (Note that to get the physical scrolling effect on the terminal,
+ * it is also necessary to call Curses::Window.idlok)
+ */
+static VALUE
+window_scrollok(VALUE obj, VALUE bf)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ scrollok(winp->window, RTEST(bf) ? TRUE : FALSE);
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.idlok
+ * call-seq: idlok(bool)
+ *
+ * If +bool+ is +true+ curses considers using the hardware insert/delete
+ * line feature of terminals so equipped.
+ *
+ * If +bool+ is +false+, disables use of line insertion and deletion.
+ * This option should be enabled only if the application needs insert/delete
+ * line, for example, for a screen editor.
+ *
+ * It is disabled by default because insert/delete line tends to be visually
+ * annoying when used in applications where it is not really needed.
+ * If insert/delete line cannot be used, curses redraws the changed portions of
+ * all lines.
+ *
+ */
+static VALUE
+window_idlok(VALUE obj, VALUE bf)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ idlok(winp->window, RTEST(bf) ? TRUE : FALSE);
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.setscrreg
+ * call-seq:
+ * setscrreg(top, bottom)
+ *
+ * Set a software scrolling region in a window.
+ * +top+ and +bottom+ are lines numbers of the margin.
+ *
+ * If this option and Curses::Window.scrollok are enabled, an attempt to move
+ * off the bottom margin line causes all lines in the scrolling region to
+ * scroll one line in the direction of the first line. Only the text of the
+ * window is scrolled.
+ *
+ */
+static VALUE
+window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
+{
+#ifdef HAVE_WSETSCRREG
+ struct windata *winp;
+ int res;
+
+ GetWINDOW(obj, winp);
+ res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom));
+ /* may have to raise exception on ERR */
+ return (res == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+#if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET)
+/*
+ * Document-method: Curses::Window.color_set
+ * call-seq: color_set(col)
+ *
+ * Sets the current color of the given window to the
+ * foreground/background combination described by the Fixnum +col+.
+ */
+static VALUE
+window_color_set(VALUE obj, VALUE col)
+{
+ struct windata *winp;
+ int res;
+
+ GetWINDOW(obj, winp);
+ res = wcolor_set(winp->window, NUM2INT(col), NULL);
+ return (res == OK) ? Qtrue : Qfalse;
+}
+#endif /* defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) */
+
+/*
+ * Document-method: Curses::Window.scroll
+ *
+ * Scrolls the current window up one line.
+ */
+static VALUE
+window_scroll(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ /* may have to raise exception on ERR */
+ return (scroll(winp->window) == OK) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Curses::Window.scrl
+ * call-seq: scrl(num)
+ *
+ * Scrolls the current window Fixnum +num+ lines.
+ * The current cursor position is not changed.
+ *
+ * For positive +num+, it scrolls up.
+ *
+ * For negative +num+, it scrolls down.
+ *
+ */
+static VALUE
+window_scrl(VALUE obj, VALUE n)
+{
+#ifdef HAVE_WSCRL
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ /* may have to raise exception on ERR */
+ return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.attroff
+ * call-seq: attroff(attrs)
+ *
+ * Turns on the named attributes +attrs+ without affecting any others.
+ *
+ * See also Curses::Window.attrset
+ */
+static VALUE
+window_attroff(VALUE obj, VALUE attrs)
+{
+#ifdef HAVE_WATTROFF
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return INT2FIX(wattroff(winp->window,NUM2INT(attrs)));
+#else
+ return Qtrue;
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.attron
+ * call-seq: attron(attrs)
+ *
+ * Turns off the named attributes +attrs+
+ * without turning any other attributes on or off.
+ *
+ * See also Curses::Window.attrset
+ */
+static VALUE
+window_attron(VALUE obj, VALUE attrs)
+{
+#ifdef HAVE_WATTRON
+ struct windata *winp;
+ VALUE val;
+
+ GetWINDOW(obj,winp);
+ val = INT2FIX(wattron(winp->window,NUM2INT(attrs)));
+ if (rb_block_given_p()) {
+ rb_yield(val);
+ wattroff(winp->window,NUM2INT(attrs));
+ return val;
+ }
+ else{
+ return val;
+ }
+#else
+ return Qtrue;
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.attrset
+ * call-seq: attrset(attrs)
+ *
+ * Sets the current attributes of the given window to +attrs+.
+ *
+ * The following video attributes, defined in <curses.h>, can
+ * be passed to the routines Curses::Window.attron, Curses::Window.attroff,
+ * and Curses::Window.attrset, or OR'd with the characters passed to addch.
+ * A_NORMAL Normal display (no highlight)
+ * A_STANDOUT Best highlighting mode of the terminal.
+ * A_UNDERLINE Underlining
+ * A_REVERSE Reverse video
+ * A_BLINK Blinking
+ * A_DIM Half bright
+ * A_BOLD Extra bright or bold
+ * A_PROTECT Protected mode
+ * A_INVIS Invisible or blank mode
+ * A_ALTCHARSET Alternate character set
+ * A_CHARTEXT Bit-mask to extract a character
+ * COLOR_PAIR(n) Color-pair number n
+ *
+ * TODO: provide some examples here.
+ *
+ * see also system manual curs_attr(3)
+ */
+static VALUE
+window_attrset(VALUE obj, VALUE attrs)
+{
+#ifdef HAVE_WATTRSET
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return INT2FIX(wattrset(winp->window,NUM2INT(attrs)));
+#else
+ return Qtrue;
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.bkgdset
+ * call-seq: bkgdset(ch)
+ *
+ * Manipulate the background of the current window
+ * with character Integer +ch+
+ *
+ * see also Curses.bkgdset
+ */
+static VALUE
+window_bkgdset(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_WBKGDSET
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ wbkgdset(winp->window, NUM2CH(ch));
+#endif
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Window.bkgd
+ * call-seq: bkgd(ch)
+ *
+ * Set the background of the current window
+ * and apply character Integer +ch+ to every character.
+ *
+ * see also Curses.bkgd
+ */
+static VALUE
+window_bkgd(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_WBKGD
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.getbkgd
+ *
+ * Returns an Integer (+ch+) for the character property in the current window.
+ */
+static VALUE
+window_getbkgd(VALUE obj)
+{
+#ifdef HAVE_WGETBKGD
+ chtype c;
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return (c = getbkgd(winp->window) != ERR) ? CH2NUM(c) : Qnil;
+#else
+ return Qnil;
+#endif
+}
+
+/*
+ * Document-method: Curses::Window.resize
+ * call-seq: resize(lines, cols)
+ *
+ * Resize the current window to Fixnum +lines+ and Fixnum +cols+
+ *
+ */
+static VALUE
+window_resize(VALUE obj, VALUE lin, VALUE col)
+{
+#if defined(HAVE_WRESIZE)
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse;
+#else
+ return Qnil;
+#endif
+}
+
+
+#ifdef HAVE_KEYPAD
+/*
+ * Document-method: Curses::Window.keypad=
+ * call-seq:
+ * keypad=(bool)
+ *
+ * See Curses::Window.keypad
+ */
+
+/*
+ * Document-method: Curses::Window.keypad
+ * call-seq:
+ * keypad(bool)
+ *
+ * Enables the keypad of the user's terminal.
+ *
+ * If enabled (+bool+ is +true+), the user can press a function key
+ * (such as an arrow key) and wgetch returns a single value representing
+ * the function key, as in KEY_LEFT. If disabled (+bool+ is +false+),
+ * curses does not treat function keys specially and the program has to
+ * interpret the escape sequences itself. If the keypad in the terminal
+ * can be turned on (made to transmit) and off (made to work locally),
+ * turning on this option causes the terminal keypad to be turned on when
+ * Curses::Window.getch is called.
+ *
+ * The default value for keypad is false.
+ *
+ */
+static VALUE
+window_keypad(VALUE obj, VALUE val)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ /* keypad() of NetBSD's libcurses returns no value */
+#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
+ keypad(winp->window,(RTEST(val) ? TRUE : FALSE));
+ return Qnil;
+#else
+ /* may have to raise exception on ERR */
+ return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ?
+ Qtrue : Qfalse;
+#endif
+}
+#else
+#define window_keypad rb_f_notimplement
+#endif
+
+#ifdef HAVE_NODELAY
+/*
+ * Document-method: Curses::Window.nodelay
+ * call-seq:
+ * window.nodelay = bool
+ *
+ * When in no-delay mode Curses::Window#getch is a non-blocking call. If no
+ * input is ready #getch returns ERR.
+ *
+ * When in delay mode (+bool+ is +false+ which is the default),
+ * Curses::Window#getch blocks until a key is pressed.
+ *
+ */
+static VALUE
+window_nodelay(VALUE obj, VALUE val)
+{
+ struct windata *winp;
+ GetWINDOW(obj,winp);
+
+ /* nodelay() of NetBSD's libcurses returns no value */
+#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
+ nodelay(winp->window, RTEST(val) ? TRUE : FALSE);
+ return Qnil;
+#else
+ return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse;
+#endif
+}
+#else
+#define window_nodelay rb_f_notimplement
+#endif
+
+#ifdef HAVE_WTIMEOUT
+/*
+ * Document-method: Curses::Window.timeout=
+ * call-seq: timeout=(delay)
+ *
+ * Sets block and non-blocking reads for the window.
+ * - If delay is negative, blocking read is used (i.e., waits indefinitely for
+ * input).
+ * - If delay is zero, then non-blocking read is used (i.e., read returns ERR
+ * if no input is waiting).
+ * - If delay is positive, then read blocks for delay milliseconds, and returns
+ * ERR if there is still no input.
+ *
+ */
+static VALUE
+window_timeout(VALUE obj, VALUE delay)
+{
+ struct windata *winp;
+ GetWINDOW(obj,winp);
+
+ wtimeout(winp->window,NUM2INT(delay));
+ return Qnil;
+}
+#else
+#define window_timeout rb_f_notimplement
+#endif
+
+/*--------------------------- class Pad ----------------------------*/
+
+#ifdef HAVE_NEWPAD
+/*
+ * Document-method: Curses::Pad.new
+ *
+ * call-seq:
+ * new(height, width)
+ *
+ * Construct a new Curses::Pad with constraints of +height+ lines, +width+
+ * columns
+ *
+ */
+static VALUE
+pad_initialize(VALUE obj, VALUE h, VALUE w)
+{
+ struct windata *padp;
+ WINDOW *window;
+
+ curses_init_screen();
+ TypedData_Get_Struct(obj, struct windata, &windata_type, padp);
+ if (padp->window) delwin(padp->window);
+ window = newpad(NUM2INT(h), NUM2INT(w));
+ wclear(window);
+ padp->window = window;
+
+ return obj;
+}
+
+#if 1
+#define pad_subpad window_subwin
+#else
+/*
+ * Document-method: Curses::Pad.subpad
+ * call-seq:
+ * subpad(height, width, begin_x, begin_y)
+ *
+ * Construct a new subpad with constraints of +height+ lines, +width+ columns,
+ * begin at +begin_x+ line, and +begin_y+ columns on the pad.
+ *
+ */
+static VALUE
+pad_subpad(VALUE obj, VALUE height, VALUE width, VALUE begin_x, VALUE begin_y)
+{
+ struct windata *padp;
+ WINDOW *subpad;
+ VALUE pad;
+ int h, w, x, y;
+
+ h = NUM2INT(height);
+ w = NUM2INT(width);
+ x = NUM2INT(begin_x);
+ y = NUM2INT(begin_y);
+ GetWINDOW(obj, padp);
+ subpad = subwin(padp->window, h, w, x, y);
+ pad = prep_window(rb_obj_class(obj), subpad);
+
+ return pad;
+}
+#endif
+
+/*
+ * Document-method: Curses::Pad.refresh
+ *
+ * call-seq:
+ * pad.refresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol)
+ *
+ * Refreshes the pad. +pad_minrow+ and pad_mincol+ define the upper-left
+ * corner of the rectangle to be displayed. +screen_minrow+, +screen_mincol+,
+ * +screen_maxrow+, +screen_maxcol+ define the edges of the rectangle to be
+ * displayed on the screen.
+ *
+ */
+static VALUE
+pad_refresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
+ VALUE smincol, VALUE smaxrow, VALUE smaxcol)
+{
+ struct windata *padp;
+ int pmr, pmc, smr, smc, sxr, sxc;
+
+ pmr = NUM2INT(pminrow);
+ pmc = NUM2INT(pmincol);
+ smr = NUM2INT(sminrow);
+ smc = NUM2INT(smincol);
+ sxr = NUM2INT(smaxrow);
+ sxc = NUM2INT(smaxcol);
+
+ GetWINDOW(obj, padp);
+ prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
+
+ return Qnil;
+}
+
+/*
+ * Document-method: Curses::Pad.noutrefresh
+ *
+ * call-seq:
+ * pad.noutrefresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol)
+ *
+ * Refreshes the pad. +pad_minrow+ and pad_mincol+ define the upper-left
+ * corner of the rectangle to be displayed. +screen_minrow+, +screen_mincol+,
+ * +screen_maxrow+, +screen_maxcol+ define the edges of the rectangle to be
+ * displayed on the screen.
+ *
+ */
+static VALUE
+pad_noutrefresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
+ VALUE smincol, VALUE smaxrow, VALUE smaxcol)
+{
+ struct windata *padp;
+ int pmr, pmc, smr, smc, sxr, sxc;
+
+ pmr = NUM2INT(pminrow);
+ pmc = NUM2INT(pmincol);
+ smr = NUM2INT(sminrow);
+ smc = NUM2INT(smincol);
+ sxr = NUM2INT(smaxrow);
+ sxc = NUM2INT(smaxcol);
+
+ GetWINDOW(obj, padp);
+#ifdef HAVE_DOUPDATE
+ pnoutrefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
+#else
+ prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
+#endif
+
+ return Qnil;
+}
+#endif /* HAVE_NEWPAD */
+
+/*------------------------- Initialization -------------------------*/
+
+/*
+ * Document-module: Curses
+ *
+ * == Description
+ * An implementation of the CRT screen handling and optimization library.
+ *
+ * == Structures and such
+ *
+ * === Classes
+ *
+ * * Curses::Window - class with the means to draw a window or box
+ * * Curses::MouseEvent - class for collecting mouse events
+ *
+ * === Modules
+ *
+ * Curses:: The curses implementation
+ * Curses::Key:: Collection of constants for keypress events
+ *
+ * == Examples
+ *
+ * * hello.rb
+ * :include: sample/curses/hello.rb
+ *
+ *
+ * * rain.rb
+ * :include: sample/curses/rain.rb
+ *
+ *
+ */
+void
+Init_curses(void)
+{
+ mCurses = rb_define_module("Curses");
+
+ /*
+ * Document-module: Curses::Key
+ *
+ *
+ * a container for the KEY_* values.
+ *
+ * See also system manual for getch(3)
+ *
+ */
+ mKey = rb_define_module_under(mCurses, "Key");
+
+ rb_gc_register_address(&rb_stdscr);
+
+#ifdef USE_MOUSE
+ /*
+ * Document-class: Curses::MouseEvent
+ *
+ * == Description
+ *
+ * Curses::MouseEvent
+ *
+ * == Example
+ *
+ * * mouse.rb
+ * :include: sample/curses/mouse.rb
+ *
+ */
+ cMouseEvent = rb_define_class_under(mCurses,"MouseEvent",rb_cObject);
+ rb_undef_method(CLASS_OF(cMouseEvent),"new");
+ rb_define_method(cMouseEvent, "eid", curs_mouse_id, 0);
+ rb_define_method(cMouseEvent, "x", curs_mouse_x, 0);
+ rb_define_method(cMouseEvent, "y", curs_mouse_y, 0);
+ rb_define_method(cMouseEvent, "z", curs_mouse_z, 0);
+ rb_define_method(cMouseEvent, "bstate", curs_mouse_bstate, 0);
+#endif /* USE_MOUSE */
+
+ rb_define_module_function(mCurses, "ESCDELAY=", curses_escdelay_set, 1);
+ rb_define_module_function(mCurses, "ESCDELAY", curses_escdelay_get, 0);
+ rb_define_module_function(mCurses, "TABSIZE", curses_tabsize_get, 0);
+ rb_define_module_function(mCurses, "TABSIZE=", curses_tabsize_set, 1);
+
+ rb_define_module_function(mCurses, "use_default_colors", curses_use_default_colors, 0);
+ rb_define_module_function(mCurses, "init_screen", curses_init_screen, 0);
+ rb_define_module_function(mCurses, "close_screen", curses_close_screen, 0);
+ rb_define_module_function(mCurses, "closed?", curses_closed, 0);
+ rb_define_module_function(mCurses, "stdscr", curses_stdscr, 0);
+ rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
+ rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
+ rb_define_module_function(mCurses, "clear", curses_clear, 0);
+ rb_define_module_function(mCurses, "clrtoeol", curses_clrtoeol, 0);
+ rb_define_module_function(mCurses, "echo", curses_echo, 0);
+ rb_define_module_function(mCurses, "noecho", curses_noecho, 0);
+ rb_define_module_function(mCurses, "raw", curses_raw, 0);
+ rb_define_module_function(mCurses, "noraw", curses_noraw, 0);
+ rb_define_module_function(mCurses, "cbreak", curses_cbreak, 0);
+ rb_define_module_function(mCurses, "nocbreak", curses_nocbreak, 0);
+ rb_define_module_function(mCurses, "crmode", curses_cbreak, 0);
+ rb_define_module_function(mCurses, "nocrmode", curses_nocbreak, 0);
+ rb_define_module_function(mCurses, "nl", curses_nl, 0);
+ rb_define_module_function(mCurses, "nonl", curses_nonl, 0);
+ rb_define_module_function(mCurses, "beep", curses_beep, 0);
+ rb_define_module_function(mCurses, "flash", curses_flash, 0);
+ rb_define_module_function(mCurses, "ungetch", curses_ungetch, 1);
+ rb_define_module_function(mCurses, "setpos", curses_setpos, 2);
+ rb_define_module_function(mCurses, "standout", curses_standout, 0);
+ rb_define_module_function(mCurses, "standend", curses_standend, 0);
+ rb_define_module_function(mCurses, "inch", curses_inch, 0);
+ rb_define_module_function(mCurses, "addch", curses_addch, 1);
+ rb_define_module_function(mCurses, "insch", curses_insch, 1);
+ rb_define_module_function(mCurses, "addstr", curses_addstr, 1);
+ rb_define_module_function(mCurses, "getch", curses_getch, 0);
+ rb_define_module_function(mCurses, "getstr", curses_getstr, 0);
+ rb_define_module_function(mCurses, "delch", curses_delch, 0);
+ rb_define_module_function(mCurses, "deleteln", curses_deleteln, 0);
+ rb_define_module_function(mCurses, "insertln", curses_insertln, 0);
+ rb_define_module_function(mCurses, "keyname", curses_keyname, 1);
+ rb_define_module_function(mCurses, "lines", curses_lines, 0);
+ rb_define_module_function(mCurses, "cols", curses_cols, 0);
+ rb_define_module_function(mCurses, "curs_set", curses_curs_set, 1);
+ rb_define_module_function(mCurses, "scrl", curses_scrl, 1);
+ rb_define_module_function(mCurses, "setscrreg", curses_setscrreg, 2);
+ rb_define_module_function(mCurses, "attroff", curses_attroff, 1);
+ rb_define_module_function(mCurses, "attron", curses_attron, 1);
+ rb_define_module_function(mCurses, "attrset", curses_attrset, 1);
+ rb_define_module_function(mCurses, "bkgdset", curses_bkgdset, 1);
+ rb_define_module_function(mCurses, "bkgd", curses_bkgd, 1);
+ rb_define_module_function(mCurses, "resizeterm", curses_resizeterm, 2);
+ rb_define_module_function(mCurses, "resize", curses_resizeterm, 2);
+#ifdef USE_COLOR
+ rb_define_module_function(mCurses, "start_color", curses_start_color, 0);
+ rb_define_module_function(mCurses, "init_pair", curses_init_pair, 3);
+ rb_define_module_function(mCurses, "init_color", curses_init_color, 4);
+ rb_define_module_function(mCurses, "has_colors?", curses_has_colors, 0);
+ rb_define_module_function(mCurses, "can_change_color?",
+ curses_can_change_color, 0);
+ rb_define_module_function(mCurses, "colors", curses_colors, 0);
+ rb_define_module_function(mCurses, "color_content", curses_color_content, 1);
+ rb_define_module_function(mCurses, "color_pairs", curses_color_pairs, 0);
+ rb_define_module_function(mCurses, "pair_content", curses_pair_content, 1);
+ rb_define_module_function(mCurses, "color_pair", curses_color_pair, 1);
+ rb_define_module_function(mCurses, "pair_number", curses_pair_number, 1);
+#endif /* USE_COLOR */
+#ifdef USE_MOUSE
+ rb_define_module_function(mCurses, "getmouse", curses_getmouse, 0);
+ rb_define_module_function(mCurses, "ungetmouse", curses_ungetmouse, 1);
+ rb_define_module_function(mCurses, "mouseinterval", curses_mouseinterval, 1);
+ rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1);
+#endif /* USE_MOUSE */
+
+ rb_define_module_function(mCurses, "timeout=", curses_timeout, 1);
+ rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
+ rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
+
+ {
+ VALUE version;
+#if defined(HAVE_FUNC_CURSES_VERSION)
+ /* ncurses and PDcurses */
+ version = rb_str_new2(curses_version());
+#elif defined(HAVE_VAR_CURSES_VERSION)
+ /* SVR4 curses has an undocumented and undeclared variable, curses_version.
+ * It contains a string, "SVR4". */
+ RUBY_EXTERN char *curses_version;
+ version = rb_sprintf("curses (%s)", curses_version);
+#else
+ /* BSD curses, perhaps. NetBSD 5 still use it. */
+ version = rb_str_new2("curses (unknown)");
+#endif
+ /*
+ * Identifies curses library version.
+ *
+ * - "ncurses 5.9.20110404"
+ * - "PDCurses 3.4 - Public Domain 2008"
+ * - "curses (SVR4)" (System V curses)
+ * - "curses (unknown)" (The original BSD curses? NetBSD maybe.)
+ *
+ */
+ rb_define_const(mCurses, "VERSION", version);
+ }
+
+ /*
+ * Document-class: Curses::Window
+ *
+ * == Description
+ *
+ * The means by which to create and manage frames or windows.
+ * While there may be more than one window at a time, only one window
+ * will receive input.
+ *
+ * == Usage
+ *
+ * require 'curses'
+ *
+ * Curses.init_screen()
+ *
+ * my_str = "LOOK! PONIES!"
+ * bwin = Curses::Window.new( 10, (my_str.length + 10),
+ * (Curses.lines - 10) / 2,
+ * (Curses.cols - (my_str.length + 10)) / 2 )
+ * bwin.box("\\", "/")
+ * bwin.refresh
+ * win = bwin.subwin( 6, my_str.length + 6,
+ * (Curses.lines - 6) / 2,
+ * (Curses.cols - (my_str.length + 6)) / 2 )
+ * win.setpos(2,3)
+ * win.addstr(my_str)
+ * # or even
+ * win << "\nORLY"
+ * win << "\nYES!! " + my_str
+ * win.refresh
+ * win.getch
+ * win.close
+ *
+ */
+ cWindow = rb_define_class_under(mCurses, "Window", rb_cData);
+ rb_define_alloc_func(cWindow, window_s_allocate);
+ rb_define_method(cWindow, "initialize", window_initialize, 4);
+ rb_define_method(cWindow, "subwin", window_subwin, 4);
+ rb_define_method(cWindow, "close", window_close, 0);
+ rb_define_method(cWindow, "clear", window_clear, 0);
+ rb_define_method(cWindow, "clrtoeol", window_clrtoeol, 0);
+ rb_define_method(cWindow, "refresh", window_refresh, 0);
+ rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0);
+ rb_define_method(cWindow, "box", window_box, -1);
+ rb_define_method(cWindow, "move", window_move, 2);
+ rb_define_method(cWindow, "setpos", window_setpos, 2);
+#if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET)
+ rb_define_method(cWindow, "color_set", window_color_set, 1);
+#endif /* USE_COLOR && HAVE_WCOLOR_SET */
+ rb_define_method(cWindow, "cury", window_cury, 0);
+ rb_define_method(cWindow, "curx", window_curx, 0);
+ rb_define_method(cWindow, "maxy", window_maxy, 0);
+ rb_define_method(cWindow, "maxx", window_maxx, 0);
+ rb_define_method(cWindow, "begy", window_begy, 0);
+ rb_define_method(cWindow, "begx", window_begx, 0);
+ rb_define_method(cWindow, "standout", window_standout, 0);
+ rb_define_method(cWindow, "standend", window_standend, 0);
+ rb_define_method(cWindow, "inch", window_inch, 0);
+ rb_define_method(cWindow, "addch", window_addch, 1);
+ rb_define_method(cWindow, "insch", window_insch, 1);
+ rb_define_method(cWindow, "addstr", window_addstr, 1);
+ rb_define_method(cWindow, "<<", window_addstr2, 1);
+ rb_define_method(cWindow, "getch", window_getch, 0);
+ rb_define_method(cWindow, "getstr", window_getstr, 0);
+ rb_define_method(cWindow, "delch", window_delch, 0);
+ rb_define_method(cWindow, "deleteln", window_deleteln, 0);
+ rb_define_method(cWindow, "insertln", window_insertln, 0);
+ rb_define_method(cWindow, "scroll", window_scroll, 0);
+ rb_define_method(cWindow, "scrollok", window_scrollok, 1);
+ rb_define_method(cWindow, "idlok", window_idlok, 1);
+ rb_define_method(cWindow, "setscrreg", window_setscrreg, 2);
+ rb_define_method(cWindow, "scrl", window_scrl, 1);
+ rb_define_method(cWindow, "resize", window_resize, 2);
+ rb_define_method(cWindow, "keypad", window_keypad, 1);
+ rb_define_method(cWindow, "keypad=", window_keypad, 1);
+
+ rb_define_method(cWindow, "attroff", window_attroff, 1);
+ rb_define_method(cWindow, "attron", window_attron, 1);
+ rb_define_method(cWindow, "attrset", window_attrset, 1);
+ rb_define_method(cWindow, "bkgdset", window_bkgdset, 1);
+ rb_define_method(cWindow, "bkgd", window_bkgd, 1);
+ rb_define_method(cWindow, "getbkgd", window_getbkgd, 0);
+
+ rb_define_method(cWindow, "nodelay=", window_nodelay, 1);
+ rb_define_method(cWindow, "timeout=", window_timeout, 1);
+
+#ifdef HAVE_NEWPAD
+ /*
+ * Document-class: Curses::Pad
+ *
+ * == Description
+ *
+ * A Pad is like a Window but allows for scrolling of contents that cannot
+ * fit on the screen. Pads do not refresh automatically, use Pad#refresh
+ * or Pad#noutrefresh instead.
+ *
+ */
+ cPad = rb_define_class_under(mCurses, "Pad", cWindow);
+ /* inherits alloc_func from cWindow */
+ rb_define_method(cPad, "initialize", pad_initialize, 2);
+ rb_define_method(cPad, "subpad", pad_subpad, 4);
+ rb_define_method(cPad, "refresh", pad_refresh, 6);
+ rb_define_method(cPad, "noutrefresh", pad_noutrefresh, 6);
+ rb_undef_method(cPad, "subwin");
+#endif
+
+#define rb_curses_define_const(c) rb_define_const(mCurses,#c,UINT2NUM(c))
+
+#ifdef USE_COLOR
+ /* Document-const: A_ATTRIBUTES
+ *
+ * Character attribute mask:
+ * Bit-mask to extract attributes
+ *
+ * See Curses.inch or Curses::Window.inch
+ */
+ rb_curses_define_const(A_ATTRIBUTES);
+#ifdef A_NORMAL
+ /* Document-const: A_NORMAL
+ *
+ * Attribute mask:
+ * Normal display (no highlight)
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_NORMAL);
+#endif
+ /* Document-const: A_STANDOUT
+ *
+ * Attribute mask:
+ * Best highlighting mode of the terminal.
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_STANDOUT);
+ /* Document-const: A_UNDERLINE
+ *
+ * Attribute mask:
+ * Underlining
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_UNDERLINE);
+ /* Document-const: A_REVERSE
+ *
+ * Attribute mask:
+ * Reverse video
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_REVERSE);
+ /* Document-const: A_BLINK
+ *
+ * Attribute mask:
+ * Blinking
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_BLINK);
+ /* Document-const: A_DIM
+ *
+ * Attribute mask:
+ * Half bright
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_DIM);
+ /* Document-const: A_BOLD
+ *
+ * Attribute mask:
+ * Extra bright or bold
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_BOLD);
+ /* Document-const: A_PROTECT
+ *
+ * Attribute mask:
+ * Protected mode
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_PROTECT);
+#ifdef A_INVIS /* for NetBSD */
+ /* Document-const: A_INVIS
+ *
+ * Attribute mask:
+ * Invisible or blank mode
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_INVIS);
+#endif
+ /* Document-const: A_ALTCHARSET
+ *
+ * Attribute mask:
+ * Alternate character set
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_ALTCHARSET);
+ /* Document-const: A_CHARTEXT
+ *
+ * Attribute mask:
+ * Bit-mask to extract a character
+ *
+ * See Curses.attrset
+ */
+ rb_curses_define_const(A_CHARTEXT);
+#ifdef A_HORIZONTAL
+ /* Document-const: A_HORIZONTAL
+ *
+ * Attribute mask:
+ * horizontal highlight
+ *
+ * Check system curs_attr(3x) for support
+ */
+ rb_curses_define_const(A_HORIZONTAL);
+#endif
+#ifdef A_LEFT
+ /* Document-const: A_LEFT
+ *
+ * Attribute mask:
+ * left highlight
+ *
+ * Check system curs_attr(3x) for support
+ */
+ rb_curses_define_const(A_LEFT);
+#endif
+#ifdef A_LOW
+ /* Document-const: A_LOW
+ *
+ * Attribute mask:
+ * low highlight
+ *
+ * Check system curs_attr(3x) for support
+ */
+ rb_curses_define_const(A_LOW);
+#endif
+#ifdef A_RIGHT
+ /* Document-const: A_RIGHT
+ *
+ * Attribute mask:
+ * right highlight
+ *
+ * Check system curs_attr(3x) for support
+ */
+ rb_curses_define_const(A_RIGHT);
+#endif
+#ifdef A_TOP
+ /* Document-const: A_TOP
+ *
+ * Attribute mask:
+ * top highlight
+ *
+ * Check system curs_attr(3x) for support
+ */
+ rb_curses_define_const(A_TOP);
+#endif
+#ifdef A_VERTICAL
+ /* Document-const: A_VERTICAL
+ *
+ * Attribute mask:
+ * vertical highlight
+ *
+ * Check system curs_attr(3x) for support
+ */
+ rb_curses_define_const(A_VERTICAL);
+#endif
+ /* Document-const: A_COLOR
+ *
+ * Character attribute mask:
+ * Bit-mask to extract color-pair field information
+ *
+ * See Curses.inch or Curses::Window.inch
+ */
+ rb_curses_define_const(A_COLOR);
+
+#ifdef COLORS
+ /*
+ * Document-const: Curses::COLORS
+ *
+ * Number of the colors available
+ */
+ rb_curses_define_const(COLORS);
+#endif
+ /*
+ * Document-const: Curses::COLOR_BLACK
+ *
+ * Value of the color black
+ */
+ rb_curses_define_const(COLOR_BLACK);
+ /*
+ * Document-const: COLOR_RED
+ *
+ * Value of the color red
+ */
+ rb_curses_define_const(COLOR_RED);
+ /*
+ * Document-const: COLOR_GREEN
+ *
+ * Value of the color green
+ */
+ rb_curses_define_const(COLOR_GREEN);
+ /*
+ * Document-const: COLOR_YELLOW
+ *
+ * Value of the color yellow
+ */
+ rb_curses_define_const(COLOR_YELLOW);
+ /*
+ * Document-const: COLOR_BLUE
+ *
+ * Value of the color blue
+ */
+ rb_curses_define_const(COLOR_BLUE);
+ /*
+ * Document-const: COLOR_MAGENTA
+ *
+ * Value of the color magenta
+ */
+ rb_curses_define_const(COLOR_MAGENTA);
+ /*
+ * Document-const: COLOR_CYAN
+ *
+ * Value of the color cyan
+ */
+ rb_curses_define_const(COLOR_CYAN);
+ /*
+ * Document-const: COLOR_WHITE
+ *
+ * Value of the color white
+ */
+ rb_curses_define_const(COLOR_WHITE);
+#endif /* USE_COLOR */
+#ifdef USE_MOUSE
+#ifdef BUTTON1_PRESSED
+ /* Document-const: BUTTON1_PRESSED
+ *
+ * Mouse event mask:
+ * mouse button 1 down
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON1_PRESSED);
+#endif
+#ifdef BUTTON1_RELEASED
+ /* Document-const: BUTTON1_RELEASED
+ *
+ * Mouse event mask:
+ * mouse button 1 up
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON1_RELEASED);
+#endif
+#ifdef BUTTON1_CLICKED
+ /* Document-const: BUTTON1_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 1 clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON1_CLICKED);
+#endif
+#ifdef BUTTON1_DOUBLE_CLICKED
+ /* Document-const: BUTTON1_DOUBLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 1 double clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON1_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON1_TRIPLE_CLICKED
+ /* Document-const: BUTTON1_TRIPLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 1 triple clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON1_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON2_PRESSED
+ /* Document-const: BUTTON2_PRESSED
+ *
+ * Mouse event mask:
+ * mouse button 2 down
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON2_PRESSED);
+#endif
+#ifdef BUTTON2_RELEASED
+ /* Document-const: BUTTON2_RELEASED
+ *
+ * Mouse event mask:
+ * mouse button 2 up
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON2_RELEASED);
+#endif
+#ifdef BUTTON2_CLICKED
+ /* Document-const: BUTTON2_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 2 clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON2_CLICKED);
+#endif
+#ifdef BUTTON2_DOUBLE_CLICKED
+ /* Document-const: BUTTON2_DOUBLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 2 double clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON2_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON2_TRIPLE_CLICKED
+ /* Document-const: BUTTON2_TRIPLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 2 triple clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON2_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON3_PRESSED
+ /* Document-const: BUTTON3_PRESSED
+ *
+ * Mouse event mask:
+ * mouse button 3 down
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON3_PRESSED);
+#endif
+#ifdef BUTTON3_RELEASED
+ /* Document-const: BUTTON3_RELEASED
+ *
+ * Mouse event mask:
+ * mouse button 3 up
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON3_RELEASED);
+#endif
+#ifdef BUTTON3_CLICKED
+ /* Document-const: BUTTON3_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 3 clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON3_CLICKED);
+#endif
+#ifdef BUTTON3_DOUBLE_CLICKED
+ /* Document-const: BUTTON3_DOUBLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 3 double clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON3_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON3_TRIPLE_CLICKED
+ /* Document-const: BUTTON3_TRIPLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 3 triple clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON3_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON4_PRESSED
+ /* Document-const: BUTTON4_PRESSED
+ *
+ * Mouse event mask:
+ * mouse button 4 down
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON4_PRESSED);
+#endif
+#ifdef BUTTON4_RELEASED
+ /* Document-const: BUTTON4_RELEASED
+ *
+ * Mouse event mask:
+ * mouse button 4 up
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON4_RELEASED);
+#endif
+#ifdef BUTTON4_CLICKED
+ /* Document-const: BUTTON4_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 4 clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON4_CLICKED);
+#endif
+#ifdef BUTTON4_DOUBLE_CLICKED
+ /* Document-const: BUTTON4_DOUBLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 4 double clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON4_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON4_TRIPLE_CLICKED
+ /* Document-const: BUTTON4_TRIPLE_CLICKED
+ *
+ * Mouse event mask:
+ * mouse button 4 triple clicked
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON4_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON_SHIFT
+ /* Document-const: BUTTON_SHIFT
+ *
+ * Mouse event mask:
+ * shift was down during button state change
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON_SHIFT);
+#endif
+#ifdef BUTTON_CTRL
+ /* Document-const: BUTTON_CTRL
+ *
+ * Mouse event mask:
+ * control was down during button state change
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON_CTRL);
+#endif
+#ifdef BUTTON_ALT
+ /* Document-const: BUTTON_ALT
+ *
+ * Mouse event mask:
+ * alt was down during button state change
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(BUTTON_ALT);
+#endif
+#ifdef ALL_MOUSE_EVENTS
+ /* Document-const: ALL_MOUSE_EVENTS
+ *
+ * Mouse event mask:
+ * report all button state changes
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(ALL_MOUSE_EVENTS);
+#endif
+#ifdef REPORT_MOUSE_POSITION
+ /* Document-const: REPORT_MOUSE_POSITION
+ *
+ * Mouse event mask:
+ * report mouse movement
+ *
+ * See Curses.getmouse
+ */
+ rb_curses_define_const(REPORT_MOUSE_POSITION);
+#endif
+#endif /* USE_MOUSE */
+
+#if defined(KEY_MOUSE) && defined(USE_MOUSE)
+ /* Document-const: KEY_MOUSE
+ * Mouse event read
+ */
+ /* Document-const: MOUSE
+ * Mouse event read
+ */
+ rb_curses_define_const(KEY_MOUSE);
+ rb_define_const(mKey, "MOUSE", INT2NUM(KEY_MOUSE));
+#endif
+#ifdef KEY_MIN
+ /* Document-const: KEY_MIN
+ * The minimum allowed curses key value.
+ */
+ /* Document-const: MIN
+ * The minimum allowed curses key value.
+ */
+ rb_curses_define_const(KEY_MIN);
+ rb_define_const(mKey, "MIN", INT2NUM(KEY_MIN));
+#endif
+#ifdef KEY_BREAK
+ /* Document-const: KEY_BREAK
+ * Break key
+ */
+ /* Document-const: BREAK
+ * Break key
+ */
+ rb_curses_define_const(KEY_BREAK);
+ rb_define_const(mKey, "BREAK", INT2NUM(KEY_BREAK));
+#endif
+#ifdef KEY_DOWN
+ /* Document-const: KEY_DOWN
+ * the down arrow key
+ */
+ /* Document-const: DOWN
+ * the down arrow key
+ */
+ rb_curses_define_const(KEY_DOWN);
+ rb_define_const(mKey, "DOWN", INT2NUM(KEY_DOWN));
+#endif
+#ifdef KEY_UP
+ /* Document-const: KEY_UP
+ * the up arrow key
+ */
+ /* Document-const: UP
+ * the up arrow key
+ */
+ rb_curses_define_const(KEY_UP);
+ rb_define_const(mKey, "UP", INT2NUM(KEY_UP));
+#endif
+#ifdef KEY_LEFT
+ /* Document-const: KEY_LEFT
+ * the left arrow key
+ */
+ /* Document-const: LEFT
+ * the left arrow key
+ */
+ rb_curses_define_const(KEY_LEFT);
+ rb_define_const(mKey, "LEFT", INT2NUM(KEY_LEFT));
+#endif
+#ifdef KEY_RIGHT
+ /* Document-const: KEY_RIGHT
+ * the right arrow key
+ */
+ /* Document-const: RIGHT
+ * the right arrow key
+ */
+ rb_curses_define_const(KEY_RIGHT);
+ rb_define_const(mKey, "RIGHT", INT2NUM(KEY_RIGHT));
+#endif
+#ifdef KEY_HOME
+ /* Document-const: KEY_HOME
+ * Home key (upward+left arrow)
+ */
+ /* Document-const: HOME
+ * Home key (upward+left arrow)
+ */
+ rb_curses_define_const(KEY_HOME);
+ rb_define_const(mKey, "HOME", INT2NUM(KEY_HOME));
+#endif
+#ifdef KEY_BACKSPACE
+ /* Document-const: KEY_BACKSPACE
+ * Backspace
+ */
+ /* Document-const: BACKSPACE
+ * Backspace
+ */
+ rb_curses_define_const(KEY_BACKSPACE);
+ rb_define_const(mKey, "BACKSPACE", INT2NUM(KEY_BACKSPACE));
+#endif
+#ifdef KEY_F
+ /* KEY_F(n) : 0 <= n <= 63 */
+ {
+ int i;
+ char c[8];
+ for (i=0; i<64; i++) {
+ sprintf(c, "KEY_F%d", i);
+ rb_define_const(mCurses, c, INT2NUM(KEY_F(i)));
+ sprintf(c, "F%d", i);
+ rb_define_const(mKey, c, INT2NUM(KEY_F(i)));
+ }
+ }
+#endif
+#ifdef KEY_DL
+ /* Document-const: KEY_DL
+ * Delete line
+ */
+ /* Document-const: DL
+ * Delete line
+ */
+ rb_curses_define_const(KEY_DL);
+ rb_define_const(mKey, "DL", INT2NUM(KEY_DL));
+#endif
+#ifdef KEY_IL
+ /* Document-const: KEY_IL
+ * Insert line
+ */
+ /* Document-const: IL
+ * Insert line
+ */
+ rb_curses_define_const(KEY_IL);
+ rb_define_const(mKey, "IL", INT2NUM(KEY_IL));
+#endif
+#ifdef KEY_DC
+ /* Document-const: KEY_DC
+ * Delete character
+ */
+ /* Document-const: DC
+ * Delete character
+ */
+ rb_curses_define_const(KEY_DC);
+ rb_define_const(mKey, "DC", INT2NUM(KEY_DC));
+#endif
+#ifdef KEY_IC
+ /* Document-const: KEY_IC
+ * Insert char or enter insert mode
+ */
+ /* Document-const: IC
+ * Insert char or enter insert mode
+ */
+ rb_curses_define_const(KEY_IC);
+ rb_define_const(mKey, "IC", INT2NUM(KEY_IC));
+#endif
+#ifdef KEY_EIC
+ /* Document-const: KEY_EIC
+ * Enter insert char mode
+ */
+ /* Document-const: EIC
+ * Enter insert char mode
+ */
+ rb_curses_define_const(KEY_EIC);
+ rb_define_const(mKey, "EIC", INT2NUM(KEY_EIC));
+#endif
+#ifdef KEY_CLEAR
+ /* Document-const: KEY_CLEAR
+ * Clear Screen
+ */
+ /* Document-const: CLEAR
+ * Clear Screen
+ */
+ rb_curses_define_const(KEY_CLEAR);
+ rb_define_const(mKey, "CLEAR", INT2NUM(KEY_CLEAR));
+#endif
+#ifdef KEY_EOS
+ /* Document-const: KEY_EOS
+ * Clear to end of screen
+ */
+ /* Document-const: EOS
+ * Clear to end of screen
+ */
+ rb_curses_define_const(KEY_EOS);
+ rb_define_const(mKey, "EOS", INT2NUM(KEY_EOS));
+#endif
+#ifdef KEY_EOL
+ /* Document-const: KEY_EOL
+ * Clear to end of line
+ */
+ /* Document-const: EOL
+ * Clear to end of line
+ */
+ rb_curses_define_const(KEY_EOL);
+ rb_define_const(mKey, "EOL", INT2NUM(KEY_EOL));
+#endif
+#ifdef KEY_SF
+ /* Document-const: KEY_SF
+ * Scroll 1 line forward
+ */
+ /* Document-const: SF
+ * Scroll 1 line forward
+ */
+ rb_curses_define_const(KEY_SF);
+ rb_define_const(mKey, "SF", INT2NUM(KEY_SF));
+#endif
+#ifdef KEY_SR
+ /* Document-const: KEY_SR
+ * Scroll 1 line backward (reverse)
+ */
+ /* Document-const: SR
+ * Scroll 1 line backward (reverse)
+ */
+ rb_curses_define_const(KEY_SR);
+ rb_define_const(mKey, "SR", INT2NUM(KEY_SR));
+#endif
+#ifdef KEY_NPAGE
+ /* Document-const: KEY_NPAGE
+ * Next page
+ */
+ /* Document-const: NPAGE
+ * Next page
+ */
+ rb_curses_define_const(KEY_NPAGE);
+ rb_define_const(mKey, "NPAGE", INT2NUM(KEY_NPAGE));
+#endif
+#ifdef KEY_PPAGE
+ /* Document-const: KEY_PPAGE
+ * Previous page
+ */
+ /* Document-const: PPAGE
+ * Previous page
+ */
+ rb_curses_define_const(KEY_PPAGE);
+ rb_define_const(mKey, "PPAGE", INT2NUM(KEY_PPAGE));
+#endif
+#ifdef KEY_STAB
+ /* Document-const: KEY_STAB
+ * Set tab
+ */
+ /* Document-const: STAB
+ * Set tab
+ */
+ rb_curses_define_const(KEY_STAB);
+ rb_define_const(mKey, "STAB", INT2NUM(KEY_STAB));
+#endif
+#ifdef KEY_CTAB
+ /* Document-const: KEY_CTAB
+ * Clear tab
+ */
+ /* Document-const: CTAB
+ * Clear tab
+ */
+ rb_curses_define_const(KEY_CTAB);
+ rb_define_const(mKey, "CTAB", INT2NUM(KEY_CTAB));
+#endif
+#ifdef KEY_CATAB
+ /* Document-const: KEY_CATAB
+ * Clear all tabs
+ */
+ /* Document-const: CATAB
+ * Clear all tabs
+ */
+ rb_curses_define_const(KEY_CATAB);
+ rb_define_const(mKey, "CATAB", INT2NUM(KEY_CATAB));
+#endif
+#ifdef KEY_ENTER
+ /* Document-const: KEY_ENTER
+ * Enter or send
+ */
+ /* Document-const: ENTER
+ * Enter or send
+ */
+ rb_curses_define_const(KEY_ENTER);
+ rb_define_const(mKey, "ENTER", INT2NUM(KEY_ENTER));
+#endif
+#ifdef KEY_SRESET
+ /* Document-const: KEY_SRESET
+ * Soft (partial) reset
+ */
+ /* Document-const: SRESET
+ * Soft (partial) reset
+ */
+ rb_curses_define_const(KEY_SRESET);
+ rb_define_const(mKey, "SRESET", INT2NUM(KEY_SRESET));
+#endif
+#ifdef KEY_RESET
+ /* Document-const: KEY_RESET
+ * Reset or hard reset
+ */
+ /* Document-const: RESET
+ * Reset or hard reset
+ */
+ rb_curses_define_const(KEY_RESET);
+ rb_define_const(mKey, "RESET", INT2NUM(KEY_RESET));
+#endif
+#ifdef KEY_PRINT
+ /* Document-const: KEY_PRINT
+ * Print or copy
+ */
+ /* Document-const: PRINT
+ * Print or copy
+ */
+ rb_curses_define_const(KEY_PRINT);
+ rb_define_const(mKey, "PRINT", INT2NUM(KEY_PRINT));
+#endif
+#ifdef KEY_LL
+ /* Document-const: KEY_LL
+ * Home down or bottom (lower left)
+ */
+ /* Document-const: LL
+ * Home down or bottom (lower left)
+ */
+ rb_curses_define_const(KEY_LL);
+ rb_define_const(mKey, "LL", INT2NUM(KEY_LL));
+#endif
+#ifdef KEY_A1
+ /* Document-const: KEY_A1
+ * Upper left of keypad
+ */
+ /* Document-const: A1
+ * Upper left of keypad
+ */
+ rb_curses_define_const(KEY_A1);
+ rb_define_const(mKey, "A1", INT2NUM(KEY_A1));
+#endif
+#ifdef KEY_A3
+ /* Document-const: KEY_A3
+ * Upper right of keypad
+ */
+ /* Document-const: A3
+ * Upper right of keypad
+ */
+ rb_curses_define_const(KEY_A3);
+ rb_define_const(mKey, "A3", INT2NUM(KEY_A3));
+#endif
+#ifdef KEY_B2
+ /* Document-const: KEY_B2
+ * Center of keypad
+ */
+ /* Document-const: B2
+ * Center of keypad
+ */
+ rb_curses_define_const(KEY_B2);
+ rb_define_const(mKey, "B2", INT2NUM(KEY_B2));
+#endif
+#ifdef KEY_C1
+ /* Document-const: KEY_C1
+ * Lower left of keypad
+ */
+ /* Document-const: C1
+ * Lower left of keypad
+ */
+ rb_curses_define_const(KEY_C1);
+ rb_define_const(mKey, "C1", INT2NUM(KEY_C1));
+#endif
+#ifdef KEY_C3
+ /* Document-const: KEY_C3
+ * Lower right of keypad
+ */
+ /* Document-const: C3
+ * Lower right of keypad
+ */
+ rb_curses_define_const(KEY_C3);
+ rb_define_const(mKey, "C3", INT2NUM(KEY_C3));
+#endif
+#ifdef KEY_BTAB
+ /* Document-const: BTAB
+ * Back tab key
+ */
+ /* Document-const: KEY_BTAB
+ * Back tab key
+ */
+ rb_curses_define_const(KEY_BTAB);
+ rb_define_const(mKey, "BTAB", INT2NUM(KEY_BTAB));
+#endif
+#ifdef KEY_BEG
+ /* Document-const: KEY_BEG
+ * Beginning key
+ */
+ /* Document-const: BEG
+ * Beginning key
+ */
+ rb_curses_define_const(KEY_BEG);
+ rb_define_const(mKey, "BEG", INT2NUM(KEY_BEG));
+#endif
+#ifdef KEY_CANCEL
+ /* Document-const: KEY_CANCEL
+ * Cancel key
+ */
+ /* Document-const: CANCEL
+ * Cancel key
+ */
+ rb_curses_define_const(KEY_CANCEL);
+ rb_define_const(mKey, "CANCEL", INT2NUM(KEY_CANCEL));
+#endif
+#ifdef KEY_CLOSE
+ /* Document-const: KEY_CLOSE
+ * Close key
+ */
+ /* Document-const: CLOSE
+ * Close key
+ */
+ rb_curses_define_const(KEY_CLOSE);
+ rb_define_const(mKey, "CLOSE", INT2NUM(KEY_CLOSE));
+#endif
+#ifdef KEY_COMMAND
+ /* Document-const: KEY_COMMAND
+ * Cmd (command) key
+ */
+ /* Document-const: COMMAND
+ * Cmd (command) key
+ */
+ rb_curses_define_const(KEY_COMMAND);
+ rb_define_const(mKey, "COMMAND", INT2NUM(KEY_COMMAND));
+#endif
+#ifdef KEY_COPY
+ /* Document-const: KEY_COPY
+ * Copy key
+ */
+ /* Document-const: COPY
+ * Copy key
+ */
+ rb_curses_define_const(KEY_COPY);
+ rb_define_const(mKey, "COPY", INT2NUM(KEY_COPY));
+#endif
+#ifdef KEY_CREATE
+ /* Document-const: KEY_CREATE
+ * Create key
+ */
+ /* Document-const: CREATE
+ * Create key
+ */
+ rb_curses_define_const(KEY_CREATE);
+ rb_define_const(mKey, "CREATE", INT2NUM(KEY_CREATE));
+#endif
+#ifdef KEY_END
+ /* Document-const: KEY_END
+ * End key
+ */
+ /* Document-const: END
+ * End key
+ */
+ rb_curses_define_const(KEY_END);
+ rb_define_const(mKey, "END", INT2NUM(KEY_END));
+#endif
+#ifdef KEY_EXIT
+ /* Document-const: KEY_EXIT
+ * Exit key
+ */
+ /* Document-const: EXIT
+ * Exit key
+ */
+ rb_curses_define_const(KEY_EXIT);
+ rb_define_const(mKey, "EXIT", INT2NUM(KEY_EXIT));
+#endif
+#ifdef KEY_FIND
+ /* Document-const: KEY_FIND
+ * Find key
+ */
+ /* Document-const: FIND
+ * Find key
+ */
+ rb_curses_define_const(KEY_FIND);
+ rb_define_const(mKey, "FIND", INT2NUM(KEY_FIND));
+#endif
+#ifdef KEY_HELP
+ /* Document-const: KEY_HELP
+ * Help key
+ */
+ /* Document-const: HELP
+ * Help key
+ */
+ rb_curses_define_const(KEY_HELP);
+ rb_define_const(mKey, "HELP", INT2NUM(KEY_HELP));
+#endif
+#ifdef KEY_MARK
+ /* Document-const: KEY_MARK
+ * Mark key
+ */
+ /* Document-const: MARK
+ * Mark key
+ */
+ rb_curses_define_const(KEY_MARK);
+ rb_define_const(mKey, "MARK", INT2NUM(KEY_MARK));
+#endif
+#ifdef KEY_MESSAGE
+ /* Document-const: KEY_MESSAGE
+ * Message key
+ */
+ /* Document-const: MESSAGE
+ * Message key
+ */
+ rb_curses_define_const(KEY_MESSAGE);
+ rb_define_const(mKey, "MESSAGE", INT2NUM(KEY_MESSAGE));
+#endif
+#ifdef KEY_MOVE
+ /* Document-const: KEY_MOVE
+ * Move key
+ */
+ /* Document-const: MOVE
+ * Move key
+ */
+ rb_curses_define_const(KEY_MOVE);
+ rb_define_const(mKey, "MOVE", INT2NUM(KEY_MOVE));
+#endif
+#ifdef KEY_NEXT
+ /* Document-const: KEY_NEXT
+ * Next object key
+ */
+ /* Document-const: NEXT
+ * Next object key
+ */
+ rb_curses_define_const(KEY_NEXT);
+ rb_define_const(mKey, "NEXT", INT2NUM(KEY_NEXT));
+#endif
+#ifdef KEY_OPEN
+ /* Document-const: KEY_OPEN
+ * Open key
+ */
+ /* Document-const: OPEN
+ * Open key
+ */
+ rb_curses_define_const(KEY_OPEN);
+ rb_define_const(mKey, "OPEN", INT2NUM(KEY_OPEN));
+#endif
+#ifdef KEY_OPTIONS
+ /* Document-const: KEY_OPTIONS
+ * Options key
+ */
+ /* Document-const: OPTIONS
+ * Options key
+ */
+ rb_curses_define_const(KEY_OPTIONS);
+ rb_define_const(mKey, "OPTIONS", INT2NUM(KEY_OPTIONS));
+#endif
+#ifdef KEY_PREVIOUS
+ /* Document-const: KEY_PREVIOUS
+ * Previous object key
+ */
+ /* Document-const: PREVIOUS
+ * Previous object key
+ */
+ rb_curses_define_const(KEY_PREVIOUS);
+ rb_define_const(mKey, "PREVIOUS", INT2NUM(KEY_PREVIOUS));
+#endif
+#ifdef KEY_REDO
+ /* Document-const: KEY_REDO
+ * Redo key
+ */
+ /* Document-const: REDO
+ * Redo key
+ */
+ rb_curses_define_const(KEY_REDO);
+ rb_define_const(mKey, "REDO", INT2NUM(KEY_REDO));
+#endif
+#ifdef KEY_REFERENCE
+ /* Document-const: KEY_REFERENCE
+ * Reference key
+ */
+ /* Document-const: REFERENCE
+ * Reference key
+ */
+ rb_curses_define_const(KEY_REFERENCE);
+ rb_define_const(mKey, "REFERENCE", INT2NUM(KEY_REFERENCE));
+#endif
+#ifdef KEY_REFRESH
+ /* Document-const: KEY_REFRESH
+ * Refresh key
+ */
+ /* Document-const: REFRESH
+ * Refresh key
+ */
+ rb_curses_define_const(KEY_REFRESH);
+ rb_define_const(mKey, "REFRESH", INT2NUM(KEY_REFRESH));
+#endif
+#ifdef KEY_REPLACE
+ /* Document-const: KEY_REPLACE
+ * Replace key
+ */
+ /* Document-const: REPLACE
+ * Replace key
+ */
+ rb_curses_define_const(KEY_REPLACE);
+ rb_define_const(mKey, "REPLACE", INT2NUM(KEY_REPLACE));
+#endif
+#ifdef KEY_RESTART
+ /* Document-const: KEY_RESTART
+ * Restart key
+ */
+ /* Document-const: RESTART
+ * Restart key
+ */
+ rb_curses_define_const(KEY_RESTART);
+ rb_define_const(mKey, "RESTART", INT2NUM(KEY_RESTART));
+#endif
+#ifdef KEY_RESUME
+ /* Document-const: KEY_RESUME
+ * Resume key
+ */
+ /* Document-const: RESUME
+ * Resume key
+ */
+ rb_curses_define_const(KEY_RESUME);
+ rb_define_const(mKey, "RESUME", INT2NUM(KEY_RESUME));
+#endif
+#ifdef KEY_SAVE
+ /* Document-const: KEY_SAVE
+ * Save key
+ */
+ /* Document-const: SAVE
+ * Save key
+ */
+ rb_curses_define_const(KEY_SAVE);
+ rb_define_const(mKey, "SAVE", INT2NUM(KEY_SAVE));
+#endif
+#ifdef KEY_SBEG
+ /* Document-const: KEY_SBEG
+ * Shifted beginning key
+ */
+ /* Document-const: SBEG
+ * Shifted beginning key
+ */
+ rb_curses_define_const(KEY_SBEG);
+ rb_define_const(mKey, "SBEG", INT2NUM(KEY_SBEG));
+#endif
+#ifdef KEY_SCANCEL
+ /* Document-const: KEY_SCANCEL
+ * Shifted cancel key
+ */
+ /* Document-const: SCANCEL
+ * Shifted cancel key
+ */
+ rb_curses_define_const(KEY_SCANCEL);
+ rb_define_const(mKey, "SCANCEL", INT2NUM(KEY_SCANCEL));
+#endif
+#ifdef KEY_SCOMMAND
+ /* Document-const: KEY_SCOMMAND
+ * Shifted command key
+ */
+ /* Document-const: SCOMMAND
+ * Shifted command key
+ */
+ rb_curses_define_const(KEY_SCOMMAND);
+ rb_define_const(mKey, "SCOMMAND", INT2NUM(KEY_SCOMMAND));
+#endif
+#ifdef KEY_SCOPY
+ /* Document-const: KEY_SCOPY
+ * Shifted copy key
+ */
+ /* Document-const: SCOPY
+ * Shifted copy key
+ */
+ rb_curses_define_const(KEY_SCOPY);
+ rb_define_const(mKey, "SCOPY", INT2NUM(KEY_SCOPY));
+#endif
+#ifdef KEY_SCREATE
+ /* Document-const: KEY_SCREATE
+ * Shifted create key
+ */
+ /* Document-const: SCREATE
+ * Shifted create key
+ */
+ rb_curses_define_const(KEY_SCREATE);
+ rb_define_const(mKey, "SCREATE", INT2NUM(KEY_SCREATE));
+#endif
+#ifdef KEY_SDC
+ /* Document-const: KEY_SDC
+ * Shifted delete char key
+ */
+ /* Document-const: SDC
+ * Shifted delete char key
+ */
+ rb_curses_define_const(KEY_SDC);
+ rb_define_const(mKey, "SDC", INT2NUM(KEY_SDC));
+#endif
+#ifdef KEY_SDL
+ /* Document-const: KEY_SDL
+ * Shifted delete line key
+ */
+ /* Document-const: SDL
+ * Shifted delete line key
+ */
+ rb_curses_define_const(KEY_SDL);
+ rb_define_const(mKey, "SDL", INT2NUM(KEY_SDL));
+#endif
+#ifdef KEY_SELECT
+ /* Document-const: KEY_SELECT
+ * Select key
+ */
+ /* Document-const: SELECT
+ * Select key
+ */
+ rb_curses_define_const(KEY_SELECT);
+ rb_define_const(mKey, "SELECT", INT2NUM(KEY_SELECT));
+#endif
+#ifdef KEY_SEND
+ /* Document-const: KEY_SEND
+ * Shifted end key
+ */
+ /* Document-const: SEND
+ * Shifted end key
+ */
+ rb_curses_define_const(KEY_SEND);
+ rb_define_const(mKey, "SEND", INT2NUM(KEY_SEND));
+#endif
+#ifdef KEY_SEOL
+ /* Document-const: KEY_SEOL
+ * Shifted clear line key
+ */
+ /* Document-const: SEOL
+ * Shifted clear line key
+ */
+ rb_curses_define_const(KEY_SEOL);
+ rb_define_const(mKey, "SEOL", INT2NUM(KEY_SEOL));
+#endif
+#ifdef KEY_SEXIT
+ /* Document-const: KEY_SEXIT
+ * Shifted exit key
+ */
+ /* Document-const: SEXIT
+ * Shifted exit key
+ */
+ rb_curses_define_const(KEY_SEXIT);
+ rb_define_const(mKey, "SEXIT", INT2NUM(KEY_SEXIT));
+#endif
+#ifdef KEY_SFIND
+ /* Document-const: KEY_SFIND
+ * Shifted find key
+ */
+ /* Document-const: SFIND
+ * Shifted find key
+ */
+ rb_curses_define_const(KEY_SFIND);
+ rb_define_const(mKey, "SFIND", INT2NUM(KEY_SFIND));
+#endif
+#ifdef KEY_SHELP
+ /* Document-const: KEY_SHELP
+ * Shifted help key
+ */
+ /* Document-const: SHELP
+ * Shifted help key
+ */
+ rb_curses_define_const(KEY_SHELP);
+ rb_define_const(mKey, "SHELP", INT2NUM(KEY_SHELP));
+#endif
+#ifdef KEY_SHOME
+ /* Document-const: KEY_SHOME
+ * Shifted home key
+ */
+ /* Document-const: SHOME
+ * Shifted home key
+ */
+ rb_curses_define_const(KEY_SHOME);
+ rb_define_const(mKey, "SHOME", INT2NUM(KEY_SHOME));
+#endif
+#ifdef KEY_SIC
+ /* Document-const: KEY_SIC
+ * Shifted input key
+ */
+ /* Document-const: SIC
+ * Shifted input key
+ */
+ rb_curses_define_const(KEY_SIC);
+ rb_define_const(mKey, "SIC", INT2NUM(KEY_SIC));
+#endif
+#ifdef KEY_SLEFT
+ /* Document-const: KEY_SLEFT
+ * Shifted left arrow key
+ */
+ /* Document-const: SLEFT
+ * Shifted left arrow key
+ */
+ rb_curses_define_const(KEY_SLEFT);
+ rb_define_const(mKey, "SLEFT", INT2NUM(KEY_SLEFT));
+#endif
+#ifdef KEY_SMESSAGE
+ /* Document-const: KEY_SMESSAGE
+ * Shifted message key
+ */
+ /* Document-const: SMESSAGE
+ * Shifted message key
+ */
+ rb_curses_define_const(KEY_SMESSAGE);
+ rb_define_const(mKey, "SMESSAGE", INT2NUM(KEY_SMESSAGE));
+#endif
+#ifdef KEY_SMOVE
+ /* Document-const: KEY_SMOVE
+ * Shifted move key
+ */
+ /* Document-const: SMOVE
+ * Shifted move key
+ */
+ rb_curses_define_const(KEY_SMOVE);
+ rb_define_const(mKey, "SMOVE", INT2NUM(KEY_SMOVE));
+#endif
+#ifdef KEY_SNEXT
+ /* Document-const: KEY_SNEXT
+ * Shifted next key
+ */
+ /* Document-const: SNEXT
+ * Shifted next key
+ */
+ rb_curses_define_const(KEY_SNEXT);
+ rb_define_const(mKey, "SNEXT", INT2NUM(KEY_SNEXT));
+#endif
+#ifdef KEY_SOPTIONS
+ /* Document-const: KEY_SOPTIONS
+ * Shifted options key
+ */
+ /* Document-const: SOPTIONS
+ * Shifted options key
+ */
+ rb_curses_define_const(KEY_SOPTIONS);
+ rb_define_const(mKey, "SOPTIONS", INT2NUM(KEY_SOPTIONS));
+#endif
+#ifdef KEY_SPREVIOUS
+ /* Document-const: KEY_SPREVIOUS
+ * Shifted previous key
+ */
+ /* Document-const: SPREVIOUS
+ * Shifted previous key
+ */
+ rb_curses_define_const(KEY_SPREVIOUS);
+ rb_define_const(mKey, "SPREVIOUS", INT2NUM(KEY_SPREVIOUS));
+#endif
+#ifdef KEY_SPRINT
+ /* Document-const: KEY_SPRINT
+ * Shifted print key
+ */
+ /* Document-const: SPRINT
+ * Shifted print key
+ */
+ rb_curses_define_const(KEY_SPRINT);
+ rb_define_const(mKey, "SPRINT", INT2NUM(KEY_SPRINT));
+#endif
+#ifdef KEY_SREDO
+ /* Document-const: KEY_SREDO
+ * Shifted redo key
+ */
+ /* Document-const: SREDO
+ * Shifted redo key
+ */
+ rb_curses_define_const(KEY_SREDO);
+ rb_define_const(mKey, "SREDO", INT2NUM(KEY_SREDO));
+#endif
+#ifdef KEY_SREPLACE
+ /* Document-const: KEY_SREPLACE
+ * Shifted replace key
+ */
+ /* Document-const: SREPLACE
+ * Shifted replace key
+ */
+ rb_curses_define_const(KEY_SREPLACE);
+ rb_define_const(mKey, "SREPLACE", INT2NUM(KEY_SREPLACE));
+#endif
+#ifdef KEY_SRIGHT
+ /* Document-const: KEY_SRIGHT
+ * Shifted right arrow key
+ */
+ /* Document-const: SRIGHT
+ * Shifted right arrow key
+ */
+ rb_curses_define_const(KEY_SRIGHT);
+ rb_define_const(mKey, "SRIGHT", INT2NUM(KEY_SRIGHT));
+#endif
+#ifdef KEY_SRSUME
+ /* Document-const: KEY_SRSUME
+ * Shifted resume key
+ */
+ /* Document-const: SRSUME
+ * Shifted resume key
+ */
+ rb_curses_define_const(KEY_SRSUME);
+ rb_define_const(mKey, "SRSUME", INT2NUM(KEY_SRSUME));
+#endif
+#ifdef KEY_SSAVE
+ /* Document-const: KEY_SSAVE
+ * Shifted save key
+ */
+ /* Document-const: SSAVE
+ * Shifted save key
+ */
+ rb_curses_define_const(KEY_SSAVE);
+ rb_define_const(mKey, "SSAVE", INT2NUM(KEY_SSAVE));
+#endif
+#ifdef KEY_SSUSPEND
+ /* Document-const: KEY_SSUSPEND
+ * Shifted suspend key
+ */
+ /* Document-const: SSUSPEND
+ * Shifted suspend key
+ */
+ rb_curses_define_const(KEY_SSUSPEND);
+ rb_define_const(mKey, "SSUSPEND", INT2NUM(KEY_SSUSPEND));
+#endif
+#ifdef KEY_SUNDO
+ /* Document-const: KEY_SUNDO
+ * Shifted undo key
+ */
+ /* Document-const: SUNDO
+ * Shifted undo key
+ */
+ rb_curses_define_const(KEY_SUNDO);
+ rb_define_const(mKey, "SUNDO", INT2NUM(KEY_SUNDO));
+#endif
+#ifdef KEY_SUSPEND
+ /* Document-const: KEY_SUSPEND
+ * Suspend key
+ */
+ /* Document-const: SUSPEND
+ * Suspend key
+ */
+ rb_curses_define_const(KEY_SUSPEND);
+ rb_define_const(mKey, "SUSPEND", INT2NUM(KEY_SUSPEND));
+#endif
+#ifdef KEY_UNDO
+ /* Document-const: KEY_UNDO
+ * Undo key
+ */
+ /* Document-const: UNDO
+ * Undo key
+ */
+ rb_curses_define_const(KEY_UNDO);
+ rb_define_const(mKey, "UNDO", INT2NUM(KEY_UNDO));
+#endif
+#ifdef KEY_RESIZE
+ /* Document-const: KEY_RESIZE
+ * Screen Resized
+ */
+ /* Document-const: RESIZE
+ * Screen Resized
+ */
+ rb_curses_define_const(KEY_RESIZE);
+ rb_define_const(mKey, "RESIZE", INT2NUM(KEY_RESIZE));
+#endif
+#ifdef KEY_MAX
+ /* Document-const: KEY_MAX
+ * The maximum allowed curses key value.
+ */
+ /* Document-const: MAX
+ * The maximum allowed curses key value.
+ */
+ rb_curses_define_const(KEY_MAX);
+ rb_define_const(mKey, "MAX", INT2NUM(KEY_MAX));
+#endif
+ {
+ int c;
+ char name[] = "KEY_CTRL_x";
+ for (c = 'A'; c <= 'Z'; c++) {
+ name[sizeof(name) - 2] = c;
+ rb_define_const(mCurses, name, INT2FIX(c - 'A' + 1));
+ }
+ }
+#undef rb_curses_define_const
+
+ rb_set_end_proc(curses_finalize, 0);
+}
diff --git a/ext/curses/depend b/ext/curses/depend
new file mode 100644
index 0000000000..9d47df2a8d
--- /dev/null
+++ b/ext/curses/depend
@@ -0,0 +1,5 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/thread.h
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
new file mode 100644
index 0000000000..a95b49ffea
--- /dev/null
+++ b/ext/curses/extconf.rb
@@ -0,0 +1,141 @@
+require 'mkmf'
+
+def have_all(*args) # :nodoc:
+ old_libs = $libs.dup
+ old_defs = $defs.dup
+ result = []
+ begin
+ args.each {|arg|
+ r = arg.call(*result)
+ if !r
+ return nil
+ end
+ result << r
+ }
+ result
+ ensure
+ if result.length != args.length
+ $libs = old_libs
+ $defs = old_defs
+ end
+ end
+end
+
+dir_config('curses')
+dir_config('ncurses')
+dir_config('termcap')
+
+have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
+have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
+
+header_library = nil
+[
+ ["ncurses.h", ["ncursesw", "ncurses"]],
+ ["ncurses/curses.h", ["ncurses"]],
+ ["curses_colr/curses.h", ["cur_colr"]],
+ ["curses.h", ["curses", "pdcurses"]],
+ # ["xcurses.h", ["XCurses"]], # XCurses (PDCurses for X11)
+].each {|hdr, libs|
+ header_library = have_all(
+ lambda { have_header(hdr) && hdr },
+ lambda {|h| libs.find {|lib| have_library(lib, "initscr", h) } })
+ if header_library
+ break;
+ end
+}
+
+if header_library
+ header, library = header_library
+ puts "header: #{header}"
+ puts "library: #{library}"
+
+ curses = [header]
+ if header == 'curses_colr/curses.h'
+ curses.unshift("varargs.h")
+ end
+
+ for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash
+ getbkgd getnstr init isendwin keyname keypad resizeterm
+ scrl set setscrreg ungetch
+ wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr
+ wresize wscrl wsetscrreg
+ def_prog_mode reset_prog_mode timeout wtimeout nodelay
+ init_color wcolor_set use_default_colors newpad)
+ have_func(f) || (have_macro(f, curses) && $defs.push(format("-DHAVE_%s", f.upcase)))
+ end
+ flag = "-D_XOPEN_SOURCE_EXTENDED"
+ if try_static_assert("sizeof(char*)>sizeof(int)",
+ %w[stdio.h stdlib.h]+curses,
+ flag)
+ $defs << flag
+ end
+ have_var("ESCDELAY", curses)
+ have_var("TABSIZE", curses)
+ have_var("COLORS", curses)
+ have_var("COLOR_PAIRS", curses)
+
+ # SVR4 curses has a (undocumented) variable char *curses_version.
+ # ncurses and PDcurses has a function char *curses_version().
+ # Note that the original BSD curses doesn't provide version information.
+ #
+ # configure option:
+ # --with-curses-version=function for SVR4
+ # --with-curses-version=variable for ncurses and PDcurses
+ # (not given) automatically determined
+
+ case with_curses_version = with_config("curses-version")
+ when "function"
+ $defs << '-DHAVE_FUNC_CURSES_VERSION'
+ when "variable"
+ $defs << '-DHAVE_VAR_CURSES_VERSION'
+ when nil
+ func_test_program = cpp_include(curses) + <<-"End"
+ int main(int argc, char *argv[])
+ {
+ curses_version();
+ return EXIT_SUCCESS;
+ }
+ End
+ var_test_program = cpp_include(curses) + <<-"End"
+ extern char *curses_version;
+ int main(int argc, char *argv[])
+ {
+ int i = 0;
+ for (i = 0; i < 100; i++) {
+ if (curses_version[i] == 0)
+ return 0 < i ? EXIT_SUCCESS : EXIT_FAILURE;
+ if (curses_version[i] & 0x80)
+ return EXIT_FAILURE;
+ }
+ return EXIT_FAILURE;
+ }
+ End
+ try = method(CROSS_COMPILING ? :try_link : :try_run)
+ function_p = checking_for(checking_message('function curses_version', curses)) { try[func_test_program] }
+ variable_p = checking_for(checking_message('variable curses_version', curses)) { try[var_test_program] }
+ if function_p and variable_p
+ if [header, library].grep(/ncurses|pdcurses|xcurses/i)
+ variable_p = false
+ else
+ warn "found curses_version but cannot determin whether it is a"
+ warn "function or a variable, so assume a variable in old SVR4"
+ warn "ncurses."
+ function_p = false
+ end
+ end
+ $defs << '-DHAVE_FUNC_CURSES_VERSION' if function_p
+ $defs << '-DHAVE_VAR_CURSES_VERSION' if variable_p
+ else
+ warn "unexpeted value for --with-curses-version: #{with_curses_version}"
+ end
+
+ for type in ["long", "int"]
+ if try_static_assert("sizeof(chtype) == sizeof(unsigned #{type})",
+ %w[stdio.h stdlib.h]+curses)
+ $defs << "-DCHTYPE_IS_U#{type.upcase}"
+ break
+ end
+ end
+
+ create_makefile("curses")
+end
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index eb1d385a7b..176c76ef0c 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -1,5 +1,5 @@
/*
- date_core.c: Coded by Tadayoshi Funaba 2010-2014
+ date_core.c: Coded by Tadayoshi Funaba 2010-2013
*/
#include "ruby.h"
@@ -114,7 +114,7 @@ f_zero_p(VALUE x)
return Qfalse;
case T_RATIONAL:
{
- VALUE num = rb_rational_num(x);
+ VALUE num = RRATIONAL(x)->num;
return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0);
}
}
@@ -286,36 +286,36 @@ union DateData {
#define get_d1(x)\
union DateData *dat;\
- TypedData_Get_Struct(x, union DateData, &d_lite_type, dat);
+ Data_Get_Struct(x, union DateData, dat);
#define get_d1a(x)\
union DateData *adat;\
- TypedData_Get_Struct(x, union DateData, &d_lite_type, adat);
+ Data_Get_Struct(x, union DateData, adat);
#define get_d1b(x)\
union DateData *bdat;\
- TypedData_Get_Struct(x, union DateData, &d_lite_type, bdat);
+ Data_Get_Struct(x, union DateData, bdat);
#define get_d2(x,y)\
union DateData *adat, *bdat;\
- TypedData_Get_Struct(x, union DateData, &d_lite_type, adat);\
- TypedData_Get_Struct(y, union DateData, &d_lite_type, bdat);
+ Data_Get_Struct(x, union DateData, adat);\
+ Data_Get_Struct(y, union DateData, bdat);
inline static VALUE
canon(VALUE x)
{
- if (RB_TYPE_P(x, T_RATIONAL)) {
- VALUE den = rb_rational_den(x);
+ if (TYPE(x) == T_RATIONAL) {
+ VALUE den = RRATIONAL(x)->den;
if (FIXNUM_P(den) && FIX2LONG(den) == 1)
- return rb_rational_num(x);
+ return RRATIONAL(x)->num;
}
return x;
}
#ifndef USE_PACK
-#define set_to_simple(obj, x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \
+#define set_to_simple(x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth)); \
+ (x)->nth = canon(_nth);\
(x)->jd = _jd;\
(x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
@@ -324,9 +324,9 @@ canon(VALUE x)
(x)->flags = _flags;\
}
#else
-#define set_to_simple(obj, x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \
+#define set_to_simple(x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth)); \
+ (x)->nth = canon(_nth);\
(x)->jd = _jd;\
(x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
@@ -336,13 +336,13 @@ canon(VALUE x)
#endif
#ifndef USE_PACK
-#define set_to_complex(obj, x, _nth, _jd ,_df, _sf, _of, _sg,\
+#define set_to_complex(x, _nth, _jd ,_df, _sf, _of, _sg,\
_year, _mon, _mday, _hour, _min, _sec, _flags) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth));\
+ (x)->nth = canon(_nth);\
(x)->jd = _jd;\
(x)->df = _df;\
- RB_OBJ_WRITE((obj), &(x)->sf, canon(_sf));\
+ (x)->sf = canon(_sf);\
(x)->of = _of;\
(x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
@@ -354,13 +354,13 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->flags = _flags;\
}
#else
-#define set_to_complex(obj, x, _nth, _jd ,_df, _sf, _of, _sg,\
+#define set_to_complex(x, _nth, _jd ,_df, _sf, _of, _sg,\
_year, _mon, _mday, _hour, _min, _sec, _flags) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth));\
+ (x)->nth = canon(_nth);\
(x)->jd = _jd;\
(x)->df = _df;\
- RB_OBJ_WRITE((obj), &(x)->sf, canon(_sf));\
+ (x)->sf = canon(_sf);\
(x)->of = _of;\
(x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
@@ -370,9 +370,9 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
#endif
#ifndef USE_PACK
-#define copy_simple_to_complex(obj, x, y) \
+#define copy_simple_to_complex(x, y) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\
+ (x)->nth = (y)->nth;\
(x)->jd = (y)->jd;\
(x)->df = 0;\
(x)->sf = INT2FIX(0);\
@@ -387,12 +387,12 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->flags = (y)->flags;\
}
#else
-#define copy_simple_to_complex(obj, x, y) \
+#define copy_simple_to_complex(x, y) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\
+ (x)->nth = (y)->nth;\
(x)->jd = (y)->jd;\
(x)->df = 0;\
- RB_OBJ_WRITE((obj), &(x)->sf, INT2FIX(0));\
+ (x)->sf = INT2FIX(0);\
(x)->of = 0;\
(x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
@@ -402,9 +402,9 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
#endif
#ifndef USE_PACK
-#define copy_complex_to_simple(obj, x, y) \
+#define copy_complex_to_simple(x, y) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\
+ (x)->nth = (y)->nth;\
(x)->jd = (y)->jd;\
(x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
@@ -413,9 +413,9 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \
(x)->flags = (y)->flags;\
}
#else
-#define copy_complex_to_simple(obj, x, y) \
+#define copy_complex_to_simple(x, y) \
{\
- RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\
+ (x)->nth = (y)->nth;\
(x)->jd = (y)->jd;\
(x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
@@ -1120,13 +1120,11 @@ m_virtual_sg(union DateData *x)
}
inline static void
-canonicalize_s_jd(VALUE obj, union DateData *x)
+canonicalize_s_jd(union DateData *x)
{
int j = x->s.jd;
- VALUE nth = x->s.nth;
assert(have_jd_p(x));
- canonicalize_jd(nth, x->s.jd);
- RB_OBJ_WRITE(obj, &x->s.nth, nth);
+ canonicalize_jd(x->s.nth, x->s.jd);
if (x->s.jd != j)
x->flags &= ~HAVE_CIVIL;
}
@@ -1216,13 +1214,11 @@ get_c_time(union DateData *x)
}
inline static void
-canonicalize_c_jd(VALUE obj, union DateData *x)
+canonicalize_c_jd(union DateData *x)
{
int j = x->c.jd;
- VALUE nth = x->c.nth;
assert(have_jd_p(x));
- canonicalize_jd(nth, x->c.jd);
- RB_OBJ_WRITE(obj, &x->c.nth, nth);
+ canonicalize_jd(x->c.nth, x->c.jd);
if (x->c.jd != j)
x->flags &= ~HAVE_CIVIL;
}
@@ -1401,15 +1397,15 @@ guess_style(VALUE y, double sg) /* -/+oo or zero */
}
inline static void
-m_canonicalize_jd(VALUE obj, union DateData *x)
+m_canonicalize_jd(union DateData *x)
{
if (simple_dat_p(x)) {
get_s_jd(x);
- canonicalize_s_jd(obj, x);
+ canonicalize_s_jd(x);
}
else {
get_c_jd(x);
- canonicalize_c_jd(obj, x);
+ canonicalize_c_jd(x);
}
}
@@ -1727,6 +1723,23 @@ m_real_year(union DateData *x)
return ry;
}
+
+#ifdef USE_PACK
+inline static int
+m_pc(union DateData *x)
+{
+ if (simple_dat_p(x)) {
+ get_s_civil(x);
+ return x->s.pc;
+ }
+ else {
+ get_c_civil(x);
+ get_c_time(x);
+ return x->c.pc;
+ }
+}
+#endif
+
inline static int
m_mon(union DateData *x)
{
@@ -1967,6 +1980,12 @@ k_date_p(VALUE x)
}
inline static VALUE
+k_datetime_p(VALUE x)
+{
+ return f_kind_of_p(x, cDateTime);
+}
+
+inline static VALUE
k_numeric_p(VALUE x)
{
return f_kind_of_p(x, rb_cNumeric);
@@ -1978,13 +1997,6 @@ k_rational_p(VALUE x)
return f_kind_of_p(x, rb_cRational);
}
-static inline void
-expect_numeric(VALUE x)
-{
- if (!k_numeric_p(x))
- rb_raise(rb_eTypeError, "expected numeric");
-}
-
#ifndef NDEBUG
static void
civil_to_jd(VALUE y, int m, int d, double sg,
@@ -2358,7 +2370,8 @@ offset_to_sec(VALUE vof, int *rof)
return 1;
}
default:
- expect_numeric(vof);
+ if (!k_numeric_p(vof))
+ rb_raise(rb_eTypeError, "expected numeric");
vof = f_to_r(vof);
#ifdef CANONICALIZATION_FOR_MATHN
if (!k_rational_p(vof))
@@ -2383,8 +2396,8 @@ offset_to_sec(VALUE vof, int *rof)
return 1;
}
#endif
- vn = rb_rational_num(vs);
- vd = rb_rational_den(vs);
+ vn = RRATIONAL(vs)->num;
+ vd = RRATIONAL(vs)->den;
if (FIXNUM_P(vn) && FIXNUM_P(vd) && (FIX2LONG(vd) == 1))
n = FIX2LONG(vn);
@@ -2932,31 +2945,17 @@ date_s_gregorian_leap_p(VALUE klass, VALUE y)
}
static void
-d_lite_gc_mark(void *ptr)
+d_lite_gc_mark(union DateData *dat)
{
- union DateData *dat = ptr;
if (simple_dat_p(dat))
rb_gc_mark(dat->s.nth);
else {
rb_gc_mark(dat->c.nth);
rb_gc_mark(dat->c.sf);
- }
-}
-static size_t
-d_lite_memsize(const void *ptr)
-{
- const union DateData *dat = ptr;
- return complex_dat_p(dat) ? sizeof(struct ComplexDateData) : sizeof(struct SimpleDateData);
+ }
}
-static const rb_data_type_t d_lite_type = {
- "Date",
- {d_lite_gc_mark, RUBY_TYPED_DEFAULT_FREE, d_lite_memsize,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED,
-};
-
inline static VALUE
d_simple_new_internal(VALUE klass,
VALUE nth, int jd,
@@ -2967,9 +2966,9 @@ d_simple_new_internal(VALUE klass,
struct SimpleDateData *dat;
VALUE obj;
- obj = TypedData_Make_Struct(klass, struct SimpleDateData,
- &d_lite_type, dat);
- set_to_simple(obj, dat, nth, jd, sg, y, m, d, flags & ~COMPLEX_DAT);
+ obj = Data_Make_Struct(klass, struct SimpleDateData,
+ d_lite_gc_mark, -1, dat);
+ set_to_simple(dat, nth, jd, sg, y, m, d, flags & ~COMPLEX_DAT);
assert(have_jd_p(dat) || have_civil_p(dat));
@@ -2988,9 +2987,9 @@ d_complex_new_internal(VALUE klass,
struct ComplexDateData *dat;
VALUE obj;
- obj = TypedData_Make_Struct(klass, struct ComplexDateData,
- &d_lite_type, dat);
- set_to_complex(obj, dat, nth, jd, df, sf, of, sg,
+ obj = Data_Make_Struct(klass, struct ComplexDateData,
+ d_lite_gc_mark, -1, dat);
+ set_to_complex(dat, nth, jd, df, sf, of, sg,
y, m, d, h, min, s, flags | COMPLEX_DAT);
assert(have_jd_p(dat) || have_civil_p(dat));
@@ -3121,7 +3120,7 @@ wholenum_p(VALUE x)
break;
case T_RATIONAL:
{
- VALUE den = rb_rational_den(x);
+ VALUE den = RRATIONAL(x)->den;
return FIXNUM_P(den) && FIX2LONG(den) == 1;
}
break;
@@ -3691,11 +3690,7 @@ rt_rewrite_frags(VALUE hash)
seconds = ref_hash("seconds");
if (!NIL_P(seconds)) {
- VALUE offset, d, h, min, s, fr;
-
- offset = ref_hash("offset");
- if (!NIL_P(offset))
- seconds = f_add(seconds, offset);
+ VALUE d, h, min, s, fr;
d = f_idiv(seconds, INT2FIX(DAY_IN_SECONDS));
fr = f_mod(seconds, INT2FIX(DAY_IN_SECONDS));
@@ -3715,6 +3710,7 @@ rt_rewrite_frags(VALUE hash)
set_hash("sec", s);
set_hash("sec_fraction", fr);
del_hash("seconds");
+ del_hash("offset");
}
return hash;
}
@@ -3729,8 +3725,7 @@ static VALUE
rt_complete_frags(VALUE klass, VALUE hash)
{
static VALUE tab = Qnil;
- int g;
- long e;
+ int g, e;
VALUE k, a, d;
if (NIL_P(tab)) {
@@ -3827,19 +3822,19 @@ rt_complete_frags(VALUE klass, VALUE hash)
}
{
- long i, eno = 0, idx = 0;
+ int i, eno = 0, idx = 0;
- for (i = 0; i < RARRAY_LEN(tab); i++) {
+ for (i = 0; i < RARRAY_LENINT(tab); i++) {
VALUE x, a;
- x = RARRAY_AREF(tab, i);
- a = RARRAY_AREF(x, 1);
+ x = RARRAY_PTR(tab)[i];
+ a = RARRAY_PTR(x)[1];
{
- long j, n = 0;
+ int j, n = 0;
- for (j = 0; j < RARRAY_LEN(a); j++)
- if (!NIL_P(ref_hash0(RARRAY_AREF(a, j))))
+ for (j = 0; j < RARRAY_LENINT(a); j++)
+ if (!NIL_P(ref_hash0(RARRAY_PTR(a)[j])))
n++;
if (n > eno) {
eno = n;
@@ -3851,15 +3846,15 @@ rt_complete_frags(VALUE klass, VALUE hash)
g = 0;
else {
g = 1;
- k = RARRAY_AREF(RARRAY_AREF(tab, idx), 0);
- a = RARRAY_AREF(RARRAY_AREF(tab, idx), 1);
+ k = RARRAY_PTR(RARRAY_PTR(tab)[idx])[0];
+ a = RARRAY_PTR(RARRAY_PTR(tab)[idx])[1];
e = eno;
}
}
d = Qnil;
- if (g && !NIL_P(k) && (RARRAY_LEN(a) - e)) {
+ if (g && !NIL_P(k) && (RARRAY_LENINT(a) - e)) {
if (k == sym("ordinal")) {
if (NIL_P(ref_hash("year"))) {
if (NIL_P(d))
@@ -3870,10 +3865,10 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("yday", INT2FIX(1));
}
else if (k == sym("civil")) {
- long i;
+ int i;
- for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_AREF(a, i);
+ for (i = 0; i < RARRAY_LENINT(a); i++) {
+ VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -3887,10 +3882,10 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("mday", INT2FIX(1));
}
else if (k == sym("commercial")) {
- long i;
+ int i;
- for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_AREF(a, i);
+ for (i = 0; i < RARRAY_LENINT(a); i++) {
+ VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -3911,10 +3906,10 @@ rt_complete_frags(VALUE klass, VALUE hash)
ref_hash("wday"))));
}
else if (k == sym("wnum0")) {
- long i;
+ int i;
- for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_AREF(a, i);
+ for (i = 0; i < RARRAY_LENINT(a); i++) {
+ VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -3928,10 +3923,10 @@ rt_complete_frags(VALUE klass, VALUE hash)
set_hash("wday", INT2FIX(0));
}
else if (k == sym("wnum1")) {
- long i;
+ int i;
- for (i = 0; i < RARRAY_LEN(a); i++) {
- VALUE e = RARRAY_AREF(a, i);
+ for (i = 0; i < RARRAY_LENINT(a); i++) {
+ VALUE e = RARRAY_PTR(a)[i];
if (!NIL_P(ref_hash0(e)))
break;
@@ -4649,7 +4644,6 @@ dup_obj(VALUE self)
{
get_d1b(new);
bdat->s = adat->s;
- RB_OBJ_WRITTEN(new, Qundef, bdat->s.nth);
return new;
}
}
@@ -4658,8 +4652,6 @@ dup_obj(VALUE self)
{
get_d1b(new);
bdat->c = adat->c;
- RB_OBJ_WRITTEN(new, Qundef, bdat->c.nth);
- RB_OBJ_WRITTEN(new, Qundef, bdat->c.sf);
return new;
}
}
@@ -4674,7 +4666,7 @@ dup_obj_as_complex(VALUE self)
VALUE new = d_lite_s_alloc_complex(rb_obj_class(self));
{
get_d1b(new);
- copy_simple_to_complex(new, &bdat->c, &adat->s);
+ copy_simple_to_complex(&bdat->c, &adat->s);
bdat->c.flags |= HAVE_DF | COMPLEX_DAT;
return new;
}
@@ -4684,8 +4676,6 @@ dup_obj_as_complex(VALUE self)
{
get_d1b(new);
bdat->c = adat->c;
- RB_OBJ_WRITTEN(new, Qundef, bdat->c.nth);
- RB_OBJ_WRITTEN(new, Qundef, bdat->c.sf);
return new;
}
}
@@ -4744,7 +4734,7 @@ d_lite_initialize(int argc, VALUE *argv, VALUE self)
decode_jd(jd, &nth, &rjd);
if (!df && f_zero_p(sf) && !of) {
- set_to_simple(self, &dat->s, nth, rjd, sg, 0, 0, 0, HAVE_JD);
+ set_to_simple(&dat->s, nth, rjd, sg, 0, 0, 0, HAVE_JD);
}
else {
if (!complex_dat_p(dat))
@@ -5723,7 +5713,8 @@ d_lite_plus(VALUE self, VALUE other)
}
break;
default:
- expect_numeric(other);
+ if (!k_numeric_p(other))
+ rb_raise(rb_eTypeError, "expected numeric");
other = f_to_r(other);
#ifdef CANONICALIZATION_FOR_MATHN
if (!k_rational_p(other))
@@ -5736,7 +5727,7 @@ d_lite_plus(VALUE self, VALUE other)
int jd, df, s;
if (wholenum_p(other))
- return d_lite_plus(self, rb_rational_num(other));
+ return d_lite_plus(self, RRATIONAL(other)->num);
if (f_positive_p(other))
s = +1;
@@ -5872,7 +5863,7 @@ minus_dd(VALUE self, VALUE other)
if (f_nonzero_p(sf))
r = f_add(r, ns_to_day(sf));
- if (RB_TYPE_P(r, T_RATIONAL))
+ if (TYPE(r) == T_RATIONAL)
return r;
return rb_rational_new1(r);
}
@@ -5907,7 +5898,8 @@ d_lite_minus(VALUE self, VALUE other)
case T_FLOAT:
return d_lite_plus(self, DBL2NUM(-RFLOAT_VALUE(other)));
default:
- expect_numeric(other);
+ if (!k_numeric_p(other))
+ rb_raise(rb_eTypeError, "expected numeric");
/* fall through */
case T_BIGNUM:
case T_RATIONAL:
@@ -6026,7 +6018,6 @@ d_lite_rshift(VALUE self, VALUE other)
static VALUE
d_lite_lshift(VALUE self, VALUE other)
{
- expect_numeric(other);
return d_lite_rshift(self, f_negate(other));
}
@@ -6219,8 +6210,8 @@ cmp_dd(VALUE self, VALUE other)
int a_jd, b_jd,
a_df, b_df;
- m_canonicalize_jd(self, adat);
- m_canonicalize_jd(other, bdat);
+ m_canonicalize_jd(adat);
+ m_canonicalize_jd(bdat);
a_nth = m_nth(adat);
b_nth = m_nth(bdat);
if (f_eqeq_p(a_nth, b_nth)) {
@@ -6298,8 +6289,8 @@ d_lite_cmp(VALUE self, VALUE other)
VALUE a_nth, b_nth;
int a_jd, b_jd;
- m_canonicalize_jd(self, adat);
- m_canonicalize_jd(other, bdat);
+ m_canonicalize_jd(adat);
+ m_canonicalize_jd(bdat);
a_nth = m_nth(adat);
b_nth = m_nth(bdat);
if (f_eqeq_p(a_nth, b_nth)) {
@@ -6315,7 +6306,7 @@ d_lite_cmp(VALUE self, VALUE other)
return INT2FIX(1);
}
}
- else if (f_lt_p(a_nth, b_nth)) {
+ else if (a_nth < b_nth) {
return INT2FIX(-1);
}
else {
@@ -6370,8 +6361,8 @@ d_lite_equal(VALUE self, VALUE other)
VALUE a_nth, b_nth;
int a_jd, b_jd;
- m_canonicalize_jd(self, adat);
- m_canonicalize_jd(other, bdat);
+ m_canonicalize_jd(adat);
+ m_canonicalize_jd(bdat);
a_nth = m_nth(adat);
b_nth = m_nth(bdat);
a_jd = m_local_jd(adat);
@@ -6405,7 +6396,7 @@ d_lite_hash(VALUE self)
h[2] = m_df(dat);
h[3] = m_sf(dat);
v = rb_memhash(h, sizeof(h));
- return LONG2FIX((long)v);
+ return LONG2FIX(v);
}
#include "date_tmx.h"
@@ -6787,7 +6778,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
* %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
* %:::z - hour, minute and second offset from UTC
* (e.g. +09, +09:30, +09:30:30)
- * %Z - Equivalent to %:z (e.g. +09:00)
+ * %Z - Time zone abbreviation name or something similar information.
*
* Weekday:
* %A - The full weekday name (``Sunday'')
@@ -7077,7 +7068,7 @@ d_lite_marshal_load(VALUE self, VALUE a)
rb_check_frozen(self);
rb_check_trusted(self);
- if (!RB_TYPE_P(a, T_ARRAY))
+ if (TYPE(a) != T_ARRAY)
rb_raise(rb_eTypeError, "expected an array");
switch (RARRAY_LEN(a)) {
@@ -7090,29 +7081,29 @@ d_lite_marshal_load(VALUE self, VALUE a)
if (RARRAY_LEN(a) == 2) {
- ajd = f_sub(RARRAY_AREF(a, 0), half_days_in_day);
+ ajd = f_sub(RARRAY_PTR(a)[0], half_days_in_day);
of = INT2FIX(0);
- sg = RARRAY_AREF(a, 1);
+ sg = RARRAY_PTR(a)[1];
if (!k_numeric_p(sg))
sg = DBL2NUM(RTEST(sg) ? GREGORIAN : JULIAN);
}
else {
- ajd = RARRAY_AREF(a, 0);
- of = RARRAY_AREF(a, 1);
- sg = RARRAY_AREF(a, 2);
+ ajd = RARRAY_PTR(a)[0];
+ of = RARRAY_PTR(a)[1];
+ sg = RARRAY_PTR(a)[2];
}
old_to_new(ajd, of, sg,
&nth, &jd, &df, &sf, &rof, &rsg);
if (!df && f_zero_p(sf) && !rof) {
- set_to_simple(self, &dat->s, nth, jd, rsg, 0, 0, 0, HAVE_JD);
+ set_to_simple(&dat->s, nth, jd, rsg, 0, 0, 0, HAVE_JD);
} else {
if (!complex_dat_p(dat))
rb_raise(rb_eArgError,
"cannot load complex into simple");
- set_to_complex(self, &dat->c, nth, jd, df, sf, rof, rsg,
+ set_to_complex(&dat->c, nth, jd, df, sf, rof, rsg,
0, 0, 0, 0, 0, 0,
HAVE_JD | HAVE_DF | COMPLEX_DAT);
}
@@ -7124,20 +7115,20 @@ d_lite_marshal_load(VALUE self, VALUE a)
int jd, df, of;
double sg;
- nth = RARRAY_AREF(a, 0);
- jd = NUM2INT(RARRAY_AREF(a, 1));
- df = NUM2INT(RARRAY_AREF(a, 2));
- sf = RARRAY_AREF(a, 3);
- of = NUM2INT(RARRAY_AREF(a, 4));
- sg = NUM2DBL(RARRAY_AREF(a, 5));
+ nth = RARRAY_PTR(a)[0];
+ jd = NUM2INT(RARRAY_PTR(a)[1]);
+ df = NUM2INT(RARRAY_PTR(a)[2]);
+ sf = RARRAY_PTR(a)[3];
+ of = NUM2INT(RARRAY_PTR(a)[4]);
+ sg = NUM2DBL(RARRAY_PTR(a)[5]);
if (!df && f_zero_p(sf) && !of) {
- set_to_simple(self, &dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD);
+ set_to_simple(&dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD);
} else {
if (!complex_dat_p(dat))
rb_raise(rb_eArgError,
"cannot load complex into simple");
- set_to_complex(self, &dat->c, nth, jd, df, sf, of, sg,
+ set_to_complex(&dat->c, nth, jd, df, sf, of, sg,
0, 0, 0, 0, 0, 0,
HAVE_JD | HAVE_DF | COMPLEX_DAT);
}
@@ -8218,7 +8209,7 @@ dt_lite_to_s(VALUE self)
* %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
* %:::z - hour, minute and second offset from UTC
* (e.g. +09, +09:30, +09:30:30)
- * %Z - Equivalent to %:z (e.g. +09:00)
+ * %Z - Time zone abbreviation name or something similar information.
*
* Weekday:
* %A - The full weekday name (``Sunday'')
@@ -8563,7 +8554,7 @@ date_to_datetime(VALUE self)
get_d1b(new);
bdat->c = adat->c;
bdat->c.df = 0;
- RB_OBJ_WRITE(new, &bdat->c.sf, INT2FIX(0));
+ bdat->c.sf = INT2FIX(0);
#ifndef USE_PACK
bdat->c.hour = 0;
bdat->c.min = 0;
@@ -8629,7 +8620,7 @@ datetime_to_date(VALUE self)
VALUE new = d_lite_s_alloc_simple(cDate);
{
get_d1b(new);
- copy_complex_to_simple(new, &bdat->s, &adat->c)
+ copy_complex_to_simple(&bdat->s, &adat->c)
bdat->s.jd = m_local_jd(adat);
bdat->s.flags &= ~(HAVE_DF | HAVE_TIME | COMPLEX_DAT);
return new;
@@ -9057,7 +9048,7 @@ Init_date_core(void)
* The calendar week is a seven day period within a calendar year,
* starting on a Monday and identified by its ordinal number within
* the year; the first calendar week of the year is the one that
- * includes the first Thursday of that year. In the Gregorian
+ * includes the first Thursday of that year. In the Gregorian
* calendar, this is equivalent to the week which includes January 4.
*
* In those classes, this so-called "commercial".
@@ -9068,8 +9059,8 @@ Init_date_core(void)
* time) on January 1, 4713 BCE (in the Julian calendar).
*
* In this document, the astronomical Julian day number is same as the
- * original Julian day number. And the chronological Julian day
- * number is a variation of the Julian day number. Its days begin at
+ * original Julian day number. And the chronological Julian day
+ * number is a variation of the Julian day number. Its days begin at
* midnight on local time.
*
* In this document, when the term "Julian day number" simply appears,
@@ -9085,9 +9076,9 @@ Init_date_core(void)
* Gregorian calendar).
*
* In this document, the astronomical modified Julian day number is
- * same as the original modified Julian day number. And the
+ * same as the original modified Julian day number. And the
* chronological modified Julian day number is a variation of the
- * modified Julian day number. Its days begin at midnight on local
+ * modified Julian day number. Its days begin at midnight on local
* time.
*
* In this document, when the term "modified Julian day number" simply
@@ -9096,9 +9087,10 @@ Init_date_core(void)
*
* In those classes, this is so-called "mjd".
*
+ *
* == Date
*
- * A subclass of Object that includes Comparable module and easily handles
+ * A subclass of Object includes Comparable module, easily handles
* date.
*
* Date object is created with Date::new, Date::jd, Date::ordinal,
@@ -9107,20 +9099,14 @@ Init_date_core(void)
*
* require 'date'
*
- * Date.new(2001,2,3)
- * #=> #<Date: 2001-02-03 ...>
- * Date.jd(2451944)
- * #=> #<Date: 2001-02-03 ...>
- * Date.ordinal(2001,34)
- * #=> #<Date: 2001-02-03 ...>
- * Date.commercial(2001,5,6)
- * #=> #<Date: 2001-02-03 ...>
- * Date.parse('2001-02-03')
- * #=> #<Date: 2001-02-03 ...>
+ * Date.new(2001,2,3) #=> #<Date: 2001-02-03 ...>
+ * Date.jd(2451944) #=> #<Date: 2001-02-03 ...>
+ * Date.ordinal(2001,34) #=> #<Date: 2001-02-03 ...>
+ * Date.commercial(2001,5,6) #=> #<Date: 2001-02-03 ...>
+ * Date.parse('2001-02-03') #=> #<Date: 2001-02-03 ...>
* Date.strptime('03-02-2001', '%d-%m-%Y')
- * #=> #<Date: 2001-02-03 ...>
- * Time.new(2001,2,3).to_date
- * #=> #<Date: 2001-02-03 ...>
+ * #=> #<Date: 2001-02-03 ...>
+ * Time.new(2001,2,3).to_date #=> #<Date: 2001-02-03 ...>
*
* All date objects are immutable; hence cannot modify themselves.
*
@@ -9128,11 +9114,11 @@ Init_date_core(void)
* of the day count, the offset and the day of calendar reform.
*
* The day count denotes the absolute position of a temporal
- * dimension. The offset is relative adjustment, which determines
- * decoded local time with the day count. The day of calendar
- * reform denotes the start day of the new style. The old style
+ * dimension. The offset is relative adjustment, which determines
+ * decoded local time with the day count. The day of calendar
+ * reform denotes the start day of the new style. The old style
* of the West is the Julian calendar which was adopted by
- * Caesar. The new style is the Gregorian calendar, which is the
+ * Caersar. The new style is the Gregorian calendar, which is the
* current civil calendar of many countries.
*
* The day count is virtually the astronomical Julian day number.
@@ -9170,6 +9156,66 @@ Init_date_core(void)
* d += 1 #=> #<Date: 2001-02-04 ...>
* d.strftime('%a %d %b %Y') #=> "Sun 04 Feb 2001"
*
+ *
+ * == DateTime
+ *
+ * A subclass of Date easily handles date, hour, minute, second and
+ * offset.
+ *
+ * DateTime does not consider any leapseconds, does not track
+ * any summer time rules.
+ *
+ * DateTime object is created with DateTime::new, DateTime::jd,
+ * DateTime::ordinal, DateTime::commercial, DateTime::parse,
+ * DateTime::strptime, DateTime::now, Time#to_datetime or etc.
+ *
+ * require 'date'
+ *
+ * DateTime.new(2001,2,3,4,5,6)
+ * #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
+ *
+ * The last element of day, hour, minute or senond can be
+ * fractional number. The fractional number's precision is assumed
+ * at most nanosecond.
+ *
+ * DateTime.new(2001,2,3.5)
+ * #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...>
+ *
+ * An optional argument the offset indicates the difference
+ * between the local time and UTC. For example, Rational(3,24)
+ * represents ahead of 3 hours of UTC, Rational(-5,24) represents
+ * behind of 5 hours of UTC. The offset should be -1 to +1, and
+ * its precision is assumed at most second. The default value is
+ * zero (equals to UTC).
+ *
+ * DateTime.new(2001,2,3,4,5,6,Rational(3,24))
+ * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
+ * also accepts string form.
+ *
+ * DateTime.new(2001,2,3,4,5,6,'+03:00')
+ * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
+ *
+ * An optional argument the day of calendar reform (start) denotes
+ * a Julian day number, which should be 2298874 to 2426355 or
+ * -/+oo. The default value is Date::ITALY (2299161=1582-10-15).
+ *
+ * DateTime object has various methods. See each reference.
+ *
+ * d = DateTime.parse('3rd Feb 2001 04:05:06+03:30')
+ * #=> #<DateTime: 2001-02-03T04:05:06+03:30 ...>
+ * d.hour #=> 4
+ * d.min #=> 5
+ * d.sec #=> 6
+ * d.offset #=> (7/48)
+ * d.zone #=> "+03:30"
+ * d += Rational('1.5')
+ * #=> #<DateTime: 2001-02-04%16:05:06+03:30 ...>
+ * d = d.new_offset('+09:00')
+ * #=> #<DateTime: 2001-02-04%21:35:06+09:00 ...>
+ * d.strftime('%I:%M:%S %p')
+ * #=> "09:35:06 PM"
+ * d > DateTime.new(1999)
+ * #=> true
*/
cDate = rb_define_class("Date", rb_cObject);
@@ -9417,144 +9463,7 @@ Init_date_core(void)
rb_define_method(cDate, "marshal_load", d_lite_marshal_load, 1);
rb_define_singleton_method(cDate, "_load", date_s__load, 1);
- /*
- * == DateTime
- *
- * A subclass of Date that easily handles date, hour, minute, second and
- * offset.
- *
- * DateTime does not consider any leap seconds, does not track
- * any summer time rules.
- *
- * DateTime object is created with DateTime::new, DateTime::jd,
- * DateTime::ordinal, DateTime::commercial, DateTime::parse,
- * DateTime::strptime, DateTime::now, Time#to_datetime or etc.
- *
- * require 'date'
- *
- * DateTime.new(2001,2,3,4,5,6)
- * #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
- *
- * The last element of day, hour, minute or second can be
- * fractional number. The fractional number's precision is assumed
- * at most nanosecond.
- *
- * DateTime.new(2001,2,3.5)
- * #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...>
- *
- * An optional argument the offset indicates the difference
- * between the local time and UTC. For example, <tt>Rational(3,24)</tt>
- * represents ahead of 3 hours of UTC, <tt>Rational(-5,24)</tt> represents
- * behind of 5 hours of UTC. The offset should be -1 to +1, and
- * its precision is assumed at most second. The default value is
- * zero(equals to UTC).
- *
- * DateTime.new(2001,2,3,4,5,6,Rational(3,24))
- * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
- *
- * also accepts string form.
- *
- * DateTime.new(2001,2,3,4,5,6,'+03:00')
- * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
- *
- * An optional argument the day of calendar reform (start) denotes
- * a Julian day number, which should be 2298874 to 2426355 or
- * -/+oo. The default value is +Date::ITALY+ (2299161=1582-10-15).
- *
- * DateTime object has various methods. See each reference.
- *
- * d = DateTime.parse('3rd Feb 2001 04:05:06+03:30')
- * #=> #<DateTime: 2001-02-03T04:05:06+03:30 ...>
- * d.hour #=> 4
- * d.min #=> 5
- * d.sec #=> 6
- * d.offset #=> (7/48)
- * d.zone #=> "+03:30"
- * d += Rational('1.5')
- * #=> #<DateTime: 2001-02-04%16:05:06+03:30 ...>
- * d = d.new_offset('+09:00')
- * #=> #<DateTime: 2001-02-04%21:35:06+09:00 ...>
- * d.strftime('%I:%M:%S %p')
- * #=> "09:35:06 PM"
- * d > DateTime.new(1999)
- * #=> true
- *
- * === When should you use DateTime and when should you use Time?
- *
- * It's a common misconception that
- * {William Shakespeare}[http://en.wikipedia.org/wiki/William_Shakespeare]
- * and
- * {Miguel de Cervantes}[http://en.wikipedia.org/wiki/Miguel_de_Cervantes]
- * died on the same day in history -
- * so much so that UNESCO named April 23 as
- * {World Book Day because of this fact}[http://en.wikipedia.org/wiki/World_Book_Day].
- * However because England hadn't yet adopted
- * {Gregorian Calendar Reform}[http://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform]
- * (and wouldn't until {1752}[http://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750])
- * their deaths are actually 10 days apart.
- * Since Ruby's Time class implements a
- * {proleptic Gregorian calendar}[http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar]
- * and has no concept of calendar reform then there's no way
- * to express this. This is where DateTime steps in:
- *
- * shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
- * #=> Tue, 23 Apr 1616 00:00:00 +0000
- * cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
- * #=> Sat, 23 Apr 1616 00:00:00 +0000
- *
- * Already you can see something's weird - the days of the week
- * are different, taking this further:
- *
- * cervantes == shakespeare
- * #=> false
- * (shakespeare - cervantes).to_i
- * #=> 10
- *
- * This shows that in fact they died 10 days apart (in reality
- * 11 days since Cervantes died a day earlier but was buried on
- * the 23rd). We can see the actual date of Shakespeare's death by
- * using the #gregorian method to convert it:
- *
- * shakespeare.gregorian
- * #=> Tue, 03 May 1616 00:00:00 +0000
- *
- * So there's an argument that all the celebrations that take
- * place on the 23rd April in Stratford-upon-Avon are actually
- * the wrong date since England is now using the Gregorian calendar.
- * You can see why when we transition across the reform
- * date boundary:
- *
- * # start off with the anniversary of Shakespeare's birth in 1751
- * shakespeare = DateTime.iso8601('1751-04-23', Date::ENGLAND)
- * #=> Tue, 23 Apr 1751 00:00:00 +0000
- *
- * # add 366 days since 1752 is a leap year and April 23 is after February 29
- * shakespeare + 366
- * #=> Thu, 23 Apr 1752 00:00:00 +0000
- *
- * # add another 365 days to take us to the anniversary in 1753
- * shakespeare + 366 + 365
- * #=> Fri, 04 May 1753 00:00:00 +0000
- *
- * As you can see, if we're accurately tracking the number of
- * {solar years}[http://en.wikipedia.org/wiki/Tropical_year]
- * since Shakespeare's birthday then the correct anniversary date
- * would be the 4th May and not the 23rd April.
- *
- * So when should you use DateTime in Ruby and when should
- * you use Time? Almost certainly you'll want to use Time
- * since your app is probably dealing with current dates and
- * times. However, if you need to deal with dates and times in a
- * historical context you'll want to use DateTime to avoid
- * making the same mistakes as UNESCO. If you also have to deal
- * with timezones then best of luck - just bear in mind that
- * you'll probably be dealing with
- * {local solar times}[http://en.wikipedia.org/wiki/Solar_time],
- * since it wasn't until the 19th century that the introduction
- * of the railways necessitated the need for
- * {Standard Time}[http://en.wikipedia.org/wiki/Standard_time#Great_Britain]
- * and eventually timezones.
- */
+ /* datetime */
cDateTime = rb_define_class("DateTime", cDate);
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 17ce460877..29dbb239bb 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -68,10 +68,9 @@ static const char *abbr_months[] = {
static void
s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
{
- VALUE vbuf = 0;
VALUE c = Qnil;
- if (!RB_TYPE_P(m, T_STRING))
+ if (TYPE(m) != T_STRING)
m = f_to_s(m);
if (!NIL_P(y) && !NIL_P(m) && NIL_P(d)) {
@@ -165,11 +164,10 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
{
char *buf;
- buf = ALLOCV_N(char, vbuf, ep - bp + 1);
+ buf = ALLOCA_N(char, ep - bp + 1);
memcpy(buf, bp, ep - bp);
buf[ep - bp] = '\0';
iy = cstr2num(buf);
- ALLOCV_END(vbuf);
}
set_hash("year", iy);
}
@@ -191,11 +189,10 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
{
char *buf;
- buf = ALLOCV_N(char, vbuf, ep - bp + 1);
+ buf = ALLOCA_N(char, ep - bp + 1);
memcpy(buf, bp, ep - bp);
buf[ep - bp] = '\0';
im = cstr2num(buf);
- ALLOCV_END(vbuf);
}
set_hash("mon", im);
}
@@ -214,11 +211,10 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
{
char *buf;
- buf = ALLOCV_N(char, vbuf, ep - bp + 1);
+ buf = ALLOCA_N(char, ep - bp + 1);
memcpy(buf, bp, ep - bp);
buf[ep - bp] = '\0';
id = cstr2num(buf);
- ALLOCV_END(vbuf);
}
set_hash("mday", id);
}
@@ -424,7 +420,6 @@ VALUE
date_zone_to_diff(VALUE str)
{
VALUE offset = Qnil;
- VALUE vbuf = 0;
long l, i;
char *s, *dest, *d;
@@ -433,7 +428,7 @@ date_zone_to_diff(VALUE str)
l = RSTRING_LEN(str);
s = RSTRING_PTR(str);
- dest = d = ALLOCV_N(char, vbuf, l + 1);
+ dest = d = ALLOCA_N(char, l + 1);
for (i = 0; i < l; i++) {
if (isspace((unsigned char)s[i]) || s[i] == '\0') {
@@ -530,13 +525,13 @@ date_zone_to_diff(VALUE str)
str = rb_str_new2(s);
- if ((p = strchr(s, ':')) != NULL) {
+ if (p = strchr(s, ':')) {
hour = rb_str_new(s, p - s);
s = ++p;
- if ((p = strchr(s, ':')) != NULL) {
+ if (p = strchr(s, ':')) {
min = rb_str_new(s, p - s);
s = ++p;
- if ((p = strchr(s, ':')) != NULL) {
+ if (p = strchr(s, ':')) {
sec = rb_str_new(s, p - s);
}
else
@@ -548,10 +543,9 @@ date_zone_to_diff(VALUE str)
goto num;
}
if (strpbrk(RSTRING_PTR(str), ",.")) {
- VALUE astr = 0;
char *a, *b;
- a = ALLOCV_N(char, astr, RSTRING_LEN(str) + 1);
+ a = ALLOCA_N(char, RSTRING_LEN(str) + 1);
strcpy(a, RSTRING_PTR(str));
b = strpbrk(a, ",.");
*b = '\0';
@@ -563,7 +557,6 @@ date_zone_to_diff(VALUE str)
f_expt(INT2FIX(10),
LONG2NUM((long)strlen(b)))),
INT2FIX(60));
- ALLOCV_END(astr);
goto num;
}
{
@@ -592,12 +585,12 @@ date_zone_to_diff(VALUE str)
if (NIL_P(hour))
offset = INT2FIX(0);
else {
- if (RB_TYPE_P(hour, T_STRING))
+ if (TYPE(hour) == T_STRING)
hour = str2num(hour);
offset = f_mul(hour, INT2FIX(3600));
}
if (!NIL_P(min)) {
- if (RB_TYPE_P(min, T_STRING))
+ if (TYPE(min) == T_STRING)
min = str2num(min);
offset = f_add(offset, f_mul(min, INT2FIX(60)));
}
@@ -612,7 +605,6 @@ date_zone_to_diff(VALUE str)
}
RB_GC_GUARD(str);
ok:
- ALLOCV_END(vbuf);
return offset;
}
@@ -773,9 +765,9 @@ parse_time(VALUE str, VALUE hash)
"("
"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
"|"
- "(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\stime\\b"
+ "[[:alpha:].\\s]+(?:standard|daylight)\\stime\\b"
"|"
- "(?-i:[[:alpha:]]+)(?:\\sdst)?\\b"
+ "[[:alpha:]]+(?:\\sdst)?\\b"
")"
")?";
static VALUE pat = Qnil;
@@ -1983,8 +1975,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
set_hash("zone", s5);
if (*cs5 == '[') {
- VALUE vbuf = 0;
- char *buf = ALLOCV_N(char, vbuf, l5 + 1);
+ char *buf = ALLOCA_N(char, l5 + 1);
char *s1, *s2, *s3;
VALUE zone;
@@ -2006,7 +1997,6 @@ parse_ddd_cb(VALUE m, VALUE hash)
if (isdigit((unsigned char)*s1))
*--s1 = '+';
set_hash("offset", date_zone_to_diff(rb_str_new2(s1)));
- ALLOCV_END(vbuf);
}
RB_GC_GUARD(s5);
}
diff --git a/ext/date/date_strftime.c b/ext/date/date_strftime.c
index 9d8167b612..20931a3124 100644
--- a/ext/date/date_strftime.c
+++ b/ext/date/date_strftime.c
@@ -48,7 +48,7 @@ downcase(char *s, size_t i)
/* strftime --- produce formatted time */
static size_t
-date_strftime_with_tmx(char *s, const size_t maxsize, const char *format,
+date_strftime_with_tmx(char *s, size_t maxsize, const char *format,
const struct tmx *tmx)
{
char *endp = s + maxsize;
@@ -575,12 +575,7 @@ date_strftime_with_tmx(char *s, const size_t maxsize, const char *format,
case '5': case '6': case '7': case '8': case '9':
{
char *e;
- unsigned long prec = strtoul(format, &e, 10);
- if (prec > INT_MAX || prec > maxsize) {
- errno = ERANGE;
- return 0;
- }
- precision = (int)prec;
+ precision = (int)strtoul(format, &e, 10);
format = e - 1;
goto again;
}
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index 4f93219317..c6a5969172 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -103,12 +103,10 @@ read_digits(const char *s, VALUE *n, size_t width)
return l;
}
else {
- VALUE vbuf = 0;
- char *s2 = ALLOCV_N(char, vbuf, l + 1);
+ char *s2 = ALLOCA_N(char, l + 1);
memcpy(s2, s, l);
s2[l] = '\0';
*n = rb_cstr_to_inum(s2, 10, 0);
- ALLOCV_END(vbuf);
return l;
}
}
@@ -293,9 +291,8 @@ date__strptime_internal(const char *str, size_t slen,
if (!valid_range_p(n, 0, 99))
fail();
set_hash("cwyear",n);
- if (NIL_P(ref_hash("_cent")))
- set_hash("_cent",
- INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
+ set_hash("_cent",
+ INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
goto matched;
}
@@ -559,9 +556,8 @@ date__strptime_internal(const char *str, size_t slen,
if (sign == -1)
n = f_negate(n);
set_hash("year", n);
- if (NIL_P(ref_hash("_cent")))
- set_hash("_cent",
- INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
+ set_hash("_cent",
+ INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
goto matched;
}
@@ -571,8 +567,8 @@ date__strptime_internal(const char *str, size_t slen,
static const char pat_source[] =
"\\A("
"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
- "|(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\s+time\\b"
- "|(?-i:[[:alpha:]]+)(?:\\s+dst)?\\b"
+ "|[[:alpha:].\\s]+(?:standard|daylight)\\s+time\\b"
+ "|[[:alpha:]]+(?:\\s+dst)?\\b"
")";
static VALUE pat = Qnil;
VALUE m, b;
diff --git a/ext/date/depend b/ext/date/depend
index a5444e3ed9..3a13fcc9a9 100644
--- a/ext/date/depend
+++ b/ext/date/depend
@@ -1,53 +1,7 @@
-# AUTOGENERATED DEPENDENCIES START
-date_core.o: $(RUBY_EXTCONF_H)
-date_core.o: $(arch_hdrdir)/ruby/config.h
-date_core.o: $(hdrdir)/ruby/defines.h
-date_core.o: $(hdrdir)/ruby/encoding.h
-date_core.o: $(hdrdir)/ruby/intern.h
-date_core.o: $(hdrdir)/ruby/missing.h
-date_core.o: $(hdrdir)/ruby/oniguruma.h
-date_core.o: $(hdrdir)/ruby/ruby.h
-date_core.o: $(hdrdir)/ruby/st.h
-date_core.o: $(hdrdir)/ruby/subst.h
-date_core.o: $(top_srcdir)/include/ruby.h
-date_core.o: date_core.c
-date_core.o: date_tmx.h
-date_parse.o: $(RUBY_EXTCONF_H)
-date_parse.o: $(arch_hdrdir)/ruby/config.h
-date_parse.o: $(hdrdir)/ruby/defines.h
-date_parse.o: $(hdrdir)/ruby/encoding.h
-date_parse.o: $(hdrdir)/ruby/intern.h
-date_parse.o: $(hdrdir)/ruby/missing.h
-date_parse.o: $(hdrdir)/ruby/oniguruma.h
-date_parse.o: $(hdrdir)/ruby/re.h
-date_parse.o: $(hdrdir)/ruby/regex.h
-date_parse.o: $(hdrdir)/ruby/ruby.h
-date_parse.o: $(hdrdir)/ruby/st.h
-date_parse.o: $(hdrdir)/ruby/subst.h
-date_parse.o: $(top_srcdir)/include/ruby.h
-date_parse.o: date_parse.c
-date_strftime.o: $(RUBY_EXTCONF_H)
-date_strftime.o: $(arch_hdrdir)/ruby/config.h
-date_strftime.o: $(hdrdir)/ruby/defines.h
-date_strftime.o: $(hdrdir)/ruby/intern.h
-date_strftime.o: $(hdrdir)/ruby/missing.h
-date_strftime.o: $(hdrdir)/ruby/ruby.h
-date_strftime.o: $(hdrdir)/ruby/st.h
-date_strftime.o: $(hdrdir)/ruby/subst.h
-date_strftime.o: date_strftime.c
+$(OBJS): $(ruby_headers)
+date_core.o: date_tmx.h $(hdrdir)/ruby/encoding.h $(hdrdir)/ruby/oniguruma.h
date_strftime.o: date_tmx.h
-date_strptime.o: $(RUBY_EXTCONF_H)
-date_strptime.o: $(arch_hdrdir)/ruby/config.h
-date_strptime.o: $(hdrdir)/ruby/defines.h
-date_strptime.o: $(hdrdir)/ruby/encoding.h
-date_strptime.o: $(hdrdir)/ruby/intern.h
-date_strptime.o: $(hdrdir)/ruby/missing.h
-date_strptime.o: $(hdrdir)/ruby/oniguruma.h
-date_strptime.o: $(hdrdir)/ruby/re.h
-date_strptime.o: $(hdrdir)/ruby/regex.h
-date_strptime.o: $(hdrdir)/ruby/ruby.h
-date_strptime.o: $(hdrdir)/ruby/st.h
-date_strptime.o: $(hdrdir)/ruby/subst.h
-date_strptime.o: $(top_srcdir)/include/ruby.h
-date_strptime.o: date_strptime.c
-# AUTOGENERATED DEPENDENCIES END
+date_parse.o: $(hdrdir)/ruby/encoding.h $(hdrdir)/ruby/oniguruma.h $(hdrdir)/ruby/re.h $(hdrdir)/ruby/regex.h
+date_strptime.o: $(hdrdir)/ruby/encoding.h $(hdrdir)/ruby/oniguruma.h $(hdrdir)/ruby/re.h $(hdrdir)/ruby/regex.h
+
+
diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb
index e8596952de..9f7d3e8f0b 100644
--- a/ext/date/extconf.rb
+++ b/ext/date/extconf.rb
@@ -1,4 +1,2 @@
-# frozen_string_literal: false
require 'mkmf'
-config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
create_makefile('date_core')
diff --git a/ext/date/lib/date.rb b/ext/date/lib/date.rb
index 48ce6316bd..d235d76e6f 100644
--- a/ext/date/lib/date.rb
+++ b/ext/date/lib/date.rb
@@ -1,7 +1,7 @@
-# frozen_string_literal: false
# date.rb: Written by Tadayoshi Funaba 1998-2011
require 'date_core'
+require 'date/format'
class Date
@@ -30,11 +30,11 @@ class Date
when Infinity; return d <=> other.d
when Numeric; return d
else
- begin
- l, r = other.coerce(self)
- return l <=> r
- rescue NoMethodError
- end
+ begin
+ l, r = other.coerce(self)
+ return l <=> r
+ rescue NoMethodError
+ end
end
nil
end
@@ -43,16 +43,16 @@ class Date
case other
when Numeric; return -d, d
else
- super
+ super
end
end
def to_f
return 0 if @d == 0
if @d > 0
- Float::INFINITY
+ Float::INFINITY
else
- -Float::INFINITY
+ -Float::INFINITY
end
end
diff --git a/ext/date/lib/date/format.rb b/ext/date/lib/date/format.rb
new file mode 100644
index 0000000000..892e7aacaa
--- /dev/null
+++ b/ext/date/lib/date/format.rb
@@ -0,0 +1 @@
+# format.rb: Written by Tadayoshi Funaba 1999-2011
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 7f9d96e3fd..c77897ece5 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -45,46 +45,26 @@ closed_dbm(void)
rb_raise(rb_eDBMError, "closed DBM file");
}
-#define GetDBM(obj, dbmp) do {\
- TypedData_Get_Struct((obj), struct dbmdata, &dbm_type, (dbmp));\
+#define GetDBM(obj, dbmp) {\
+ Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_dbm();\
if ((dbmp)->di_dbm == 0) closed_dbm();\
-} while (0)
+}
-#define GetDBM2(obj, dbmp, dbm) do {\
- GetDBM((obj), (dbmp));\
- (dbm) = (dbmp)->di_dbm;\
-} while (0)
+#define GetDBM2(obj, data, dbm) {\
+ GetDBM((obj), (data));\
+ (dbm) = dbmp->di_dbm;\
+}
static void
-free_dbm(void *ptr)
+free_dbm(struct dbmdata *dbmp)
{
- struct dbmdata *dbmp = ptr;
if (dbmp) {
if (dbmp->di_dbm) dbm_close(dbmp->di_dbm);
xfree(dbmp);
}
}
-static size_t
-memsize_dbm(const void *ptr)
-{
- size_t size = 0;
- const struct dbmdata *dbmp = ptr;
- if (dbmp) {
- size += sizeof(*dbmp);
- if (dbmp->di_dbm) size += DBM_SIZEOF_DBM;
- }
- return size;
-}
-
-static const rb_data_type_t dbm_type = {
- "dbm",
- {0, free_dbm, memsize_dbm,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* call-seq:
* dbm.close
@@ -114,7 +94,7 @@ fdbm_closed(VALUE obj)
{
struct dbmdata *dbmp;
- TypedData_Get_Struct(obj, struct dbmdata, &dbm_type, dbmp);
+ Data_Get_Struct(obj, struct dbmdata, dbmp);
if (dbmp == 0)
return Qtrue;
if (dbmp->di_dbm == 0)
@@ -126,7 +106,7 @@ fdbm_closed(VALUE obj)
static VALUE
fdbm_alloc(VALUE klass)
{
- return TypedData_Wrap_Struct(klass, &dbm_type, 0);
+ return Data_Wrap_Struct(klass, 0, free_dbm, 0);
}
/*
@@ -248,7 +228,7 @@ fdbm_initialize(int argc, VALUE *argv, VALUE obj)
static VALUE
fdbm_s_open(int argc, VALUE *argv, VALUE klass)
{
- VALUE obj = fdbm_alloc(klass);
+ VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
if (NIL_P(fdbm_initialize(argc, argv, obj))) {
return Qnil;
@@ -279,11 +259,8 @@ fdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
value = dbm_fetch(dbm, key);
if (value.dptr == 0) {
not_found:
- if (NIL_P(ifnone) && rb_block_given_p()) {
- keystr = rb_str_dup(keystr);
- OBJ_TAINT(keystr);
- return rb_yield(keystr);
- }
+ if (ifnone == Qnil && rb_block_given_p())
+ return rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
return ifnone;
}
return rb_tainted_str_new(value.dptr, value.dsize);
@@ -508,8 +485,8 @@ fdbm_delete_if(VALUE obj)
DBM *dbm;
VALUE keystr, valstr;
VALUE ret, ary = rb_ary_tmp_new(0);
- int status = 0;
- long i, n;
+ int i, status = 0;
+ long n;
fdbm_modify(obj);
GetDBM2(obj, dbmp, dbm);
@@ -528,7 +505,7 @@ fdbm_delete_if(VALUE obj)
}
for (i = 0; i < RARRAY_LEN(ary); i++) {
- keystr = RARRAY_AREF(ary, i);
+ keystr = RARRAY_PTR(ary)[i];
key.dptr = RSTRING_PTR(keystr);
key.dsize = (DSIZE_TYPE)RSTRING_LEN(keystr);
if (dbm_delete(dbm, key)) {
@@ -597,15 +574,13 @@ fdbm_invert(VALUE obj)
static VALUE fdbm_store(VALUE,VALUE,VALUE);
static VALUE
-update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
+update_i(VALUE pair, VALUE dbm)
{
- const VALUE *ptr;
Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) {
rb_raise(rb_eArgError, "pair must be [key, value]");
}
- ptr = RARRAY_CONST_PTR(pair);
- fdbm_store(dbm, ptr[0], ptr[1]);
+ fdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]);
return Qnil;
}
@@ -1036,7 +1011,7 @@ fdbm_reject(VALUE obj)
* == Example
*
* require 'dbm'
- * db = DBM.open('rfcs', 0666, DBM::WRCREAT)
+ * db = DBM.open('rfcs', 666, DBM::WRCREAT)
* db['822'] = 'Standard for the Format of ARPA Internet Text Messages'
* db['1123'] = 'Requirements for Internet Hosts - Application and Support'
* db['3068'] = 'An Anycast Prefix for 6to4 Relay Routers'
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 04f751d776..68070c9970 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# configure option:
# --with-dbm-type=COMMA-SEPARATED-NDBM-TYPES
#
@@ -268,23 +267,6 @@ if dblib.any? {|db| headers.fetch(db, ["ndbm.h"]).any? {|hdr| headers.db_check(d
have_func("dbm_pagfno((DBM *)0)", headers.found, headers.defs)
have_func("dbm_dirfno((DBM *)0)", headers.found, headers.defs)
convertible_int("datum.dsize", headers.found, headers.defs)
- checking_for("sizeof(DBM) is available") {
- if try_compile(<<SRC)
-#ifdef HAVE_CDEFS_H
-# include <cdefs.h>
-#endif
-#ifdef HAVE_SYS_CDEFS_H
-# include <sys/cdefs.h>
-#endif
-#include DBM_HDR
-
-const int sizeof_DBM = (int)sizeof(DBM);
-SRC
- $defs << '-DDBM_SIZEOF_DBM=sizeof(DBM)'
- else
- $defs << '-DDBM_SIZEOF_DBM=0'
- end
- }
create_makefile("dbm")
end
# :startdoc:
diff --git a/ext/digest/bubblebabble/bubblebabble.c b/ext/digest/bubblebabble/bubblebabble.c
index 4b8263de5a..4bccd221b8 100644
--- a/ext/digest/bubblebabble/bubblebabble.c
+++ b/ext/digest/bubblebabble/bubblebabble.c
@@ -11,8 +11,8 @@
************************************************/
-#include <ruby/ruby.h>
-#include "../digest.h"
+#include "ruby.h"
+#include "digest.h"
static ID id_digest;
diff --git a/ext/digest/bubblebabble/depend b/ext/digest/bubblebabble/depend
index 59c6d0ce74..d13a156ce1 100644
--- a/ext/digest/bubblebabble/depend
+++ b/ext/digest/bubblebabble/depend
@@ -1,13 +1 @@
-# AUTOGENERATED DEPENDENCIES START
-bubblebabble.o: $(RUBY_EXTCONF_H)
-bubblebabble.o: $(arch_hdrdir)/ruby/config.h
-bubblebabble.o: $(hdrdir)/ruby/defines.h
-bubblebabble.o: $(hdrdir)/ruby/intern.h
-bubblebabble.o: $(hdrdir)/ruby/missing.h
-bubblebabble.o: $(hdrdir)/ruby/ruby.h
-bubblebabble.o: $(hdrdir)/ruby/st.h
-bubblebabble.o: $(hdrdir)/ruby/subst.h
-bubblebabble.o: $(top_srcdir)/ext/digest/digest.h
-bubblebabble.o: $(top_srcdir)/include/ruby.h
-bubblebabble.o: bubblebabble.c
-# AUTOGENERATED DEPENDENCIES END
+bubblebabble.o: bubblebabble.c $(srcdir)/../digest.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
diff --git a/ext/digest/bubblebabble/extconf.rb b/ext/digest/bubblebabble/extconf.rb
index 21feed57fb..53cb83934a 100644
--- a/ext/digest/bubblebabble/extconf.rb
+++ b/ext/digest/bubblebabble/extconf.rb
@@ -1,6 +1,6 @@
-# frozen_string_literal: false
require 'mkmf'
$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
create_makefile('digest/bubblebabble')
diff --git a/ext/digest/depend b/ext/digest/depend
index dbc2bba3cc..2fbc6d9adf 100644
--- a/ext/digest/depend
+++ b/ext/digest/depend
@@ -1,13 +1 @@
-# AUTOGENERATED DEPENDENCIES START
-digest.o: $(RUBY_EXTCONF_H)
-digest.o: $(arch_hdrdir)/ruby/config.h
-digest.o: $(hdrdir)/ruby/defines.h
-digest.o: $(hdrdir)/ruby/intern.h
-digest.o: $(hdrdir)/ruby/missing.h
-digest.o: $(hdrdir)/ruby/ruby.h
-digest.o: $(hdrdir)/ruby/st.h
-digest.o: $(hdrdir)/ruby/subst.h
-digest.o: $(top_srcdir)/include/ruby.h
-digest.o: digest.c
-digest.o: digest.h
-# AUTOGENERATED DEPENDENCIES END
+digest.o: digest.c digest.h $(HDRS) $(ruby_headers)
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index a02eb12cd6..527d0ed1fe 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -124,8 +124,6 @@ hexencode_str_new(VALUE str_digest)
p[i + i + 1] = hex[byte & 0x0f];
}
- RB_GC_GUARD(str_digest);
-
return str;
}
@@ -374,8 +372,7 @@ rb_digest_instance_equal(VALUE self, VALUE other)
str2 = rb_digest_instance_digest(0, 0, other);
} else {
str1 = rb_digest_instance_to_s(self);
- str2 = rb_check_string_type(other);
- if (NIL_P(str2)) return Qfalse;
+ str2 = other;
}
/* never blindly assume that subclass methods return strings */
@@ -520,12 +517,10 @@ get_digest_base_metadata(VALUE klass)
if (NIL_P(p))
rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
switch (algo->api_version) {
- case 3:
+ case 2:
break;
/*
@@ -539,21 +534,6 @@ get_digest_base_metadata(VALUE klass)
return algo;
}
-static const rb_data_type_t digest_type = {
- "digest",
- {0, RUBY_TYPED_DEFAULT_FREE, 0,},
- 0, 0,
- (RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED),
-};
-
-static inline void
-algo_init(const rb_digest_metadata_t *algo, void *pctx)
-{
- if (algo->init_func(pctx) != 1) {
- rb_raise(rb_eRuntimeError, "Digest initialization failed.");
- }
-}
-
static VALUE
rb_digest_base_alloc(VALUE klass)
{
@@ -567,9 +547,10 @@ rb_digest_base_alloc(VALUE klass)
algo = get_digest_base_metadata(klass);
- obj = rb_data_typed_object_zalloc(klass, algo->ctx_size, &digest_type);
- pctx = RTYPEDDATA_DATA(obj);
- algo_init(algo, pctx);
+ pctx = xmalloc(algo->ctx_size);
+ algo->init_func(pctx);
+
+ obj = Data_Wrap_Struct(klass, 0, xfree, pctx);
return obj;
}
@@ -586,11 +567,9 @@ rb_digest_base_copy(VALUE copy, VALUE obj)
rb_check_frozen(copy);
algo = get_digest_base_metadata(rb_obj_class(copy));
- if (algo != get_digest_base_metadata(rb_obj_class(obj)))
- rb_raise(rb_eTypeError, "different algorithms");
- TypedData_Get_Struct(obj, void, &digest_type, pctx1);
- TypedData_Get_Struct(copy, void, &digest_type, pctx2);
+ Data_Get_Struct(obj, void, pctx1);
+ Data_Get_Struct(copy, void, pctx2);
memcpy(pctx2, pctx1, algo->ctx_size);
return copy;
@@ -605,9 +584,9 @@ rb_digest_base_reset(VALUE self)
algo = get_digest_base_metadata(rb_obj_class(self));
- TypedData_Get_Struct(self, void, &digest_type, pctx);
+ Data_Get_Struct(self, void, pctx);
- algo_init(algo, pctx);
+ algo->init_func(pctx);
return self;
}
@@ -621,11 +600,10 @@ rb_digest_base_update(VALUE self, VALUE str)
algo = get_digest_base_metadata(rb_obj_class(self));
- TypedData_Get_Struct(self, void, &digest_type, pctx);
+ Data_Get_Struct(self, void, pctx);
StringValue(str);
algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
- RB_GC_GUARD(str);
return self;
}
@@ -640,13 +618,13 @@ rb_digest_base_finish(VALUE self)
algo = get_digest_base_metadata(rb_obj_class(self));
- TypedData_Get_Struct(self, void, &digest_type, pctx);
+ Data_Get_Struct(self, void, pctx);
str = rb_str_new(0, algo->digest_len);
algo->finish_func(pctx, (unsigned char *)RSTRING_PTR(str));
/* avoid potential coredump caused by use of a finished context */
- algo_init(algo, pctx);
+ algo->init_func(pctx);
return str;
}
diff --git a/ext/digest/digest.h b/ext/digest/digest.h
index 30359ad348..6e4906c859 100644
--- a/ext/digest/digest.h
+++ b/ext/digest/digest.h
@@ -15,11 +15,11 @@
#include "ruby.h"
-#define RUBY_DIGEST_API_VERSION 3
+#define RUBY_DIGEST_API_VERSION 2
-typedef int (*rb_digest_hash_init_func_t)(void *);
+typedef void (*rb_digest_hash_init_func_t)(void *);
typedef void (*rb_digest_hash_update_func_t)(void *, unsigned char *, size_t);
-typedef int (*rb_digest_hash_finish_func_t)(void *, unsigned char *);
+typedef void (*rb_digest_hash_finish_func_t)(void *, unsigned char *);
typedef struct {
int api_version;
@@ -30,22 +30,3 @@ typedef struct {
rb_digest_hash_update_func_t update_func;
rb_digest_hash_finish_func_t finish_func;
} rb_digest_metadata_t;
-
-#define DEFINE_UPDATE_FUNC_FOR_UINT(name) \
-void \
-rb_digest_##name##_update(void *ctx, unsigned char *ptr, size_t size) \
-{ \
- const unsigned int stride = 16384; \
- \
- for (; size > stride; size -= stride, ptr += stride) { \
- name##_Update(ctx, ptr, stride); \
- } \
- if (size > 0) name##_Update(ctx, ptr, size); \
-}
-
-#define DEFINE_FINISH_FUNC_FROM_FINAL(name) \
-int \
-rb_digest_##name##_finish(void *ctx, unsigned char *ptr) \
-{ \
- return name##_Final(ptr, ctx); \
-}
diff --git a/ext/digest/digest_conf.rb b/ext/digest/digest_conf.rb
deleted file mode 100644
index 432652852f..0000000000
--- a/ext/digest/digest_conf.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: false
-def digest_conf(name, hdr = name, funcs = nil, types = nil)
- unless with_config("bundled-#{name}")
- cc = with_config("common-digest")
- if cc == true or /\b#{name}\b/ =~ cc
- if File.exist?("#$srcdir/#{name}cc.h") and
- have_header("CommonCrypto/CommonDigest.h")
- $defs << "-D#{name.upcase}_USE_COMMONDIGEST"
- return :commondigest
- end
- end
-
- dir_config("openssl")
- pkg_config("openssl")
- require File.expand_path('../../openssl/deprecation', __FILE__)
- if have_library("crypto")
- funcs ||= name.upcase
- funcs = Array(funcs)
- types ||= funcs
- hdr = "openssl/#{hdr}.h"
- if funcs.all? {|func| OpenSSL.check_func("#{func}_Transform", hdr)} &&
- types.all? {|type| have_type("#{type}_CTX", hdr)}
- $defs << "-D#{name.upcase}_USE_OPENSSL"
- return :ossl
- end
- end
- end
- $objs << "#{name}.#{$OBJEXT}"
- return
-end
diff --git a/ext/digest/extconf.rb b/ext/digest/extconf.rb
index a8c68850a2..a20ca8d68f 100644
--- a/ext/digest/extconf.rb
+++ b/ext/digest/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# $RoughId: extconf.rb,v 1.6 2001/07/13 15:38:27 knu Exp $
# $Id$
diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb
index d6daf36f80..5f7ebc2237 100644
--- a/ext/digest/lib/digest.rb
+++ b/ext/digest/lib/digest.rb
@@ -1,10 +1,6 @@
-# frozen_string_literal: false
require 'digest.so'
module Digest
- # A mutex for Digest().
- REQUIRE_MUTEX = Mutex.new
-
def self.const_missing(name) # :nodoc:
case name
when :SHA256, :SHA384, :SHA512
@@ -80,30 +76,15 @@ end
# call-seq:
# Digest(name) -> digest_subclass
#
-# Returns a Digest subclass by +name+ in a thread-safe manner even
-# when on-demand loading is involved.
+# Returns a Digest subclass by +name+.
#
# require 'digest'
#
# Digest("MD5")
# # => Digest::MD5
#
-# Digest(:SHA256)
-# # => Digest::SHA256
-#
-# Digest(:Foo)
+# Digest("Foo")
# # => LoadError: library not found for class Digest::Foo -- digest/foo
def Digest(name)
- const = name.to_sym
- Digest::REQUIRE_MUTEX.synchronize {
- # Ignore autoload's because it is void when we have #const_missing
- Digest.const_missing(const)
- }
-rescue LoadError
- # Constants do not necessarily rely on digest/*.
- if Digest.const_defined?(const)
- Digest.const_get(const)
- else
- raise
- end
+ Digest.const_get(name)
end
diff --git a/ext/digest/lib/digest/hmac.rb b/ext/digest/lib/digest/hmac.rb
new file mode 100644
index 0000000000..3883badc45
--- /dev/null
+++ b/ext/digest/lib/digest/hmac.rb
@@ -0,0 +1,302 @@
+# == License
+#
+# Copyright (c) 2006 Akinori MUSHA <knu@iDaemons.org>
+#
+# Documentation by Akinori MUSHA
+#
+# All rights reserved. You can redistribute and/or modify it under
+# the same terms as Ruby.
+#
+# $Id$
+#
+
+warn "use of the experimetal library 'digest/hmac' is discouraged; require 'openssl' and use OpenSSL::HMAC instead." if $VERBOSE
+
+require 'digest'
+
+module Digest
+ # = digest/hmac.rb
+ #
+ # An experimental implementation of HMAC keyed-hashing algorithm
+ #
+ # == Overview
+ #
+ # CAUTION: Use of this library is discouraged, because this
+ # implementation was meant to be experimental but somehow got into the
+ # 1.9 series without being noticed. Please use OpenSSL::HMAC in the
+ # "openssl" library instead.
+ #
+ # == Examples
+ #
+ # require 'digest/hmac'
+ #
+ # # one-liner example
+ # puts Digest::HMAC.hexdigest("data", "hash key", Digest::SHA1)
+ #
+ # # rather longer one
+ # hmac = Digest::HMAC.new("foo", Digest::RMD160)
+ #
+ # buf = ""
+ # while stream.read(16384, buf)
+ # hmac.update(buf)
+ # end
+ #
+ # puts hmac.hexdigest
+ #
+ class HMAC < Digest::Class
+
+ # Creates a Digest::HMAC instance.
+
+ def initialize(key, digester)
+ @md = digester.new
+
+ block_len = @md.block_length
+
+ if key.bytesize > block_len
+ key = @md.digest(key)
+ end
+
+ ipad = Array.new(block_len, 0x36)
+ opad = Array.new(block_len, 0x5c)
+
+ key.bytes.each_with_index { |c, i|
+ ipad[i] ^= c
+ opad[i] ^= c
+ }
+
+ @key = key.freeze
+ @ipad = ipad.pack('C*').freeze
+ @opad = opad.pack('C*').freeze
+ @md.update(@ipad)
+ end
+
+ def initialize_copy(other) # :nodoc:
+ @md = other.instance_eval { @md.clone }
+ end
+
+ # call-seq:
+ # hmac.update(string) -> hmac
+ # hmac << string -> hmac
+ #
+ # Updates the hmac using a given +string+ and returns self.
+ def update(text)
+ @md.update(text)
+ self
+ end
+ alias << update
+
+ # call-seq:
+ # hmac.reset -> hmac
+ #
+ # Resets the hmac to the initial state and returns self.
+ def reset
+ @md.reset
+ @md.update(@ipad)
+ self
+ end
+
+ def finish # :nodoc:
+ d = @md.digest!
+ @md.update(@opad)
+ @md.update(d)
+ @md.digest!
+ end
+ private :finish
+
+ # call-seq:
+ # hmac.digest_length -> Integer
+ #
+ # Returns the length in bytes of the hash value of the digest.
+ def digest_length
+ @md.digest_length
+ end
+
+ # call-seq:
+ # hmac.block_length -> Integer
+ #
+ # Returns the block length in bytes of the hmac.
+ def block_length
+ @md.block_length
+ end
+
+ # call-seq:
+ # hmac.inspect -> string
+ #
+ # Creates a printable version of the hmac object.
+ def inspect
+ sprintf('#<%s: key=%s, digest=%s>', self.class.name, @key.inspect, @md.inspect.sub(/^\#<(.*)>$/) { $1 });
+ end
+ end
+end
+
+if $0 == __FILE__
+ eval DATA.gets(nil), nil, $0, DATA.lineno
+end
+
+__END__
+
+require 'test/unit'
+
+module TM_HMAC
+ def test_s_hexdigest
+ cases.each { |h|
+ digesters.each { |d|
+ assert_equal(h[:hexdigest], Digest::HMAC.hexdigest(h[:data], h[:key], d))
+ }
+ }
+ end
+
+ def test_hexdigest
+ cases.each { |h|
+ digesters.each { |d|
+ hmac = Digest::HMAC.new(h[:key], d)
+
+ hmac.update(h[:data])
+
+ assert_equal(h[:hexdigest], hmac.hexdigest)
+ }
+ }
+ end
+
+ def test_reset
+ cases.each { |h|
+ digesters.each { |d|
+ hmac = Digest::HMAC.new(h[:key], d)
+ hmac.update("test")
+ hmac.reset
+ hmac.update(h[:data])
+
+ assert_equal(h[:hexdigest], hmac.hexdigest)
+ }
+ }
+ end
+end
+
+class TC_HMAC_MD5 < Test::Unit::TestCase
+ include TM_HMAC
+
+ def digesters
+ [Digest::MD5, Digest::MD5.new]
+ end
+
+ # Taken from RFC 2202: Test Cases for HMAC-MD5 and HMAC-SHA-1
+ def cases
+ [
+ {
+ :key => "\x0b" * 16,
+ :data => "Hi There",
+ :hexdigest => "9294727a3638bb1c13f48ef8158bfc9d",
+ }, {
+ :key => "Jefe",
+ :data => "what do ya want for nothing?",
+ :hexdigest => "750c783e6ab0b503eaa86e310a5db738",
+ }, {
+ :key => "\xaa" * 16,
+ :data => "\xdd" * 50,
+ :hexdigest => "56be34521d144c88dbb8c733f0e8b3f6",
+ }, {
+ :key => "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
+ :data => "\xcd" * 50,
+ :hexdigest => "697eaf0aca3a3aea3a75164746ffaa79",
+ }, {
+ :key => "\x0c" * 16,
+ :data => "Test With Truncation",
+ :hexdigest => "56461ef2342edc00f9bab995690efd4c",
+ }, {
+ :key => "\xaa" * 80,
+ :data => "Test Using Larger Than Block-Size Key - Hash Key First",
+ :hexdigest => "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd",
+ }, {
+ :key => "\xaa" * 80,
+ :data => "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
+ :hexdigest => "6f630fad67cda0ee1fb1f562db3aa53e",
+ }
+ ]
+ end
+end
+
+class TC_HMAC_SHA1 < Test::Unit::TestCase
+ include TM_HMAC
+
+ def digesters
+ [Digest::SHA1, Digest::SHA1.new]
+ end
+
+ # Taken from RFC 2202: Test Cases for HMAC-MD5 and HMAC-SHA-1
+ def cases
+ [
+ {
+ :key => "\x0b" * 20,
+ :data => "Hi There",
+ :hexdigest => "b617318655057264e28bc0b6fb378c8ef146be00",
+ }, {
+ :key => "Jefe",
+ :data => "what do ya want for nothing?",
+ :hexdigest => "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79",
+ }, {
+ :key => "\xaa" * 20,
+ :data => "\xdd" * 50,
+ :hexdigest => "125d7342b9ac11cd91a39af48aa17b4f63f175d3",
+ }, {
+ :key => "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
+ :data => "\xcd" * 50,
+ :hexdigest => "4c9007f4026250c6bc8414f9bf50c86c2d7235da",
+ }, {
+ :key => "\x0c" * 20,
+ :data => "Test With Truncation",
+ :hexdigest => "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04",
+ }, {
+ :key => "\xaa" * 80,
+ :data => "Test Using Larger Than Block-Size Key - Hash Key First",
+ :hexdigest => "aa4ae5e15272d00e95705637ce8a3b55ed402112",
+ }, {
+ :key => "\xaa" * 80,
+ :data => "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
+ :hexdigest => "e8e99d0f45237d786d6bbaa7965c7808bbff1a91",
+ }
+ ]
+ end
+end
+
+class TC_HMAC_RMD160 < Test::Unit::TestCase
+ include TM_HMAC
+
+ def digesters
+ [Digest::RMD160, Digest::RMD160.new]
+ end
+
+ # Taken from RFC 2286: Test Cases for HMAC-RIPEMD160 and HMAC-RIPEMD128
+ def cases
+ [
+ {
+ :key => "\x0b" * 20,
+ :data => "Hi There",
+ :hexdigest => "24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668",
+ }, {
+ :key => "Jefe",
+ :data => "what do ya want for nothing?",
+ :hexdigest => "dda6c0213a485a9e24f4742064a7f033b43c4069",
+ }, {
+ :key => "\xaa" * 20,
+ :data => "\xdd" * 50,
+ :hexdigest => "b0b105360de759960ab4f35298e116e295d8e7c1",
+ }, {
+ :key => "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
+ :data => "\xcd" * 50,
+ :hexdigest => "d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4",
+ }, {
+ :key => "\x0c" * 20,
+ :data => "Test With Truncation",
+ :hexdigest => "7619693978f91d90539ae786500ff3d8e0518e39",
+ }, {
+ :key => "\xaa" * 80,
+ :data => "Test Using Larger Than Block-Size Key - Hash Key First",
+ :hexdigest => "6466ca07ac5eac29e1bd523e5ada7605b791fd8b",
+ }, {
+ :key => "\xaa" * 80,
+ :data => "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
+ :hexdigest => "69ea60798d71616cce5fd0871e23754cd75d5a0a",
+ }
+ ]
+ end
+end
diff --git a/ext/digest/md5/depend b/ext/digest/md5/depend
index 288c30aa15..ca30d310e9 100644
--- a/ext/digest/md5/depend
+++ b/ext/digest/md5/depend
@@ -1,18 +1,3 @@
md5.o: md5.c md5.h $(srcdir)/../defs.h
-
-# AUTOGENERATED DEPENDENCIES START
-md5init.o: $(RUBY_EXTCONF_H)
-md5init.o: $(arch_hdrdir)/ruby/config.h
-md5init.o: $(hdrdir)/ruby/defines.h
-md5init.o: $(hdrdir)/ruby/intern.h
-md5init.o: $(hdrdir)/ruby/missing.h
-md5init.o: $(hdrdir)/ruby/ruby.h
-md5init.o: $(hdrdir)/ruby/st.h
-md5init.o: $(hdrdir)/ruby/subst.h
-md5init.o: $(top_srcdir)/ext/digest/digest.h
-md5init.o: $(top_srcdir)/include/ruby.h
-md5init.o: md5init.c
-md5init.o: md5ossl.h
-md5ossl.o: md5ossl.c
+md5init.o: md5init.c md5.h $(srcdir)/../digest.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
md5ossl.o: md5ossl.h
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb
index dead9a228b..5a57fd3eea 100644
--- a/ext/digest/md5/extconf.rb
+++ b/ext/digest/md5/extconf.rb
@@ -1,16 +1,25 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id$
require "mkmf"
-require File.expand_path("../../digest_conf", __FILE__)
$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "md5init.#{$OBJEXT}" ]
-digest_conf("md5")
+dir_config("openssl")
+pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
+
+if !with_config("bundled-md5") &&
+ have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
+ $objs << "md5ossl.#{$OBJEXT}"
+
+else
+ $objs << "md5.#{$OBJEXT}"
+end
have_header("sys/cdefs.h")
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index 19fe54a693..8d7d33c5a6 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -61,7 +61,7 @@
*/
#include <string.h>
int
-main(void)
+main()
{
static const char *const test[7*2] = {
"", "d41d8cd98f00b204e9800998ecf8427e",
@@ -102,7 +102,7 @@ main(void)
#ifdef COMPUTE_T_VALUES
#include <math.h>
int
-main(void)
+main()
{
int i;
for (i = 1; i <= 64; ++i) {
@@ -350,7 +350,7 @@ md5_process(MD5_CTX *pms, const uint8_t *data /*[64]*/)
pms->state[3] += d;
}
-int
+void
MD5_Init(MD5_CTX *pms)
{
pms->count[0] = pms->count[1] = 0;
@@ -358,7 +358,6 @@ MD5_Init(MD5_CTX *pms)
pms->state[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
pms->state[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
pms->state[3] = 0x10325476;
- return 1;
}
void
@@ -399,7 +398,7 @@ MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)
memcpy(pms->buffer, p, left);
}
-int
+void
MD5_Finish(MD5_CTX *pms, uint8_t *digest)
{
static const uint8_t pad[64] = {
@@ -420,5 +419,4 @@ MD5_Finish(MD5_CTX *pms, uint8_t *digest)
MD5_Update(pms, data, 8);
for (i = 0; i < 16; ++i)
digest[i] = (uint8_t)(pms->state[i >> 2] >> ((i & 3) << 3));
- return 1;
}
diff --git a/ext/digest/md5/md5.h b/ext/digest/md5/md5.h
index 1b3383c5ee..f4580ef5e7 100644
--- a/ext/digest/md5/md5.h
+++ b/ext/digest/md5/md5.h
@@ -46,7 +46,7 @@
#ifndef MD5_INCLUDED
# define MD5_INCLUDED
-#include "../defs.h"
+#include "defs.h"
/*
* This code has some adaptations for the Ghostscript environment, but it
@@ -69,9 +69,9 @@ typedef struct md5_state_s {
#define MD5_Finish rb_Digest_MD5_Finish
#endif
-int MD5_Init _((MD5_CTX *pms));
+void MD5_Init _((MD5_CTX *pms));
void MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes));
-int MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
+void MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
#define MD5_BLOCK_LENGTH 64
#define MD5_DIGEST_LENGTH 16
diff --git a/ext/digest/md5/md5cc.h b/ext/digest/md5/md5cc.h
deleted file mode 100644
index 35652eac6a..0000000000
--- a/ext/digest/md5/md5cc.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#define COMMON_DIGEST_FOR_OPENSSL 1
-#include <CommonCrypto/CommonDigest.h>
-
-#define MD5_BLOCK_LENGTH CC_MD5_BLOCK_BYTES
-
-static DEFINE_UPDATE_FUNC_FOR_UINT(MD5)
-static DEFINE_FINISH_FUNC_FROM_FINAL(MD5)
-
-#undef MD5_Update
-#undef MD5_Finish
-#define MD5_Update rb_digest_MD5_update
-#define MD5_Finish rb_digest_MD5_finish
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index a6afedef69..3591782f6e 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -1,12 +1,9 @@
/* $RoughId: md5init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
/* $Id$ */
-#include <ruby/ruby.h>
-#include "../digest.h"
-#if defined(MD5_USE_OPENSSL)
+#include "digest.h"
+#if defined(HAVE_OPENSSL_MD5_H)
#include "md5ossl.h"
-#elif defined(MD5_USE_COMMONDIGEST)
-#include "md5cc.h"
#else
#include "md5.h"
#endif
@@ -27,7 +24,7 @@ static const rb_digest_metadata_t md5 = {
* RFC1321.
*/
void
-Init_md5(void)
+Init_md5()
{
VALUE mDigest, cDigest_Base, cDigest_MD5;
@@ -41,8 +38,6 @@ Init_md5(void)
cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
- rb_iv_set(cDigest_MD5, "metadata",
- Data_Wrap_Struct(0, 0, 0, (void *)&md5));
+ rb_ivar_set(cDigest_MD5, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&md5));
}
diff --git a/ext/digest/md5/md5ossl.c b/ext/digest/md5/md5ossl.c
new file mode 100644
index 0000000000..d94ae2cd2f
--- /dev/null
+++ b/ext/digest/md5/md5ossl.c
@@ -0,0 +1,9 @@
+/* $Id$ */
+
+#include "md5ossl.h"
+
+void
+MD5_Finish(MD5_CTX *pctx, unsigned char *digest)
+{
+ MD5_Final(digest, pctx);
+}
diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h
index 94aa7ae77b..1680c4f5c9 100644
--- a/ext/digest/md5/md5ossl.h
+++ b/ext/digest/md5/md5ossl.h
@@ -8,8 +8,6 @@
#define MD5_BLOCK_LENGTH MD5_CBLOCK
-static DEFINE_FINISH_FUNC_FROM_FINAL(MD5)
-#undef MD5_Finish
-#define MD5_Finish rb_digest_MD5_finish
+void MD5_Finish(MD5_CTX *pctx, unsigned char *digest);
#endif
diff --git a/ext/digest/rmd160/depend b/ext/digest/rmd160/depend
index 49cf2afc6f..c5524be459 100644
--- a/ext/digest/rmd160/depend
+++ b/ext/digest/rmd160/depend
@@ -1,28 +1,3 @@
rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
-
-# AUTOGENERATED DEPENDENCIES START
-rmd160init.o: $(RUBY_EXTCONF_H)
-rmd160init.o: $(arch_hdrdir)/ruby/config.h
-rmd160init.o: $(hdrdir)/ruby/defines.h
-rmd160init.o: $(hdrdir)/ruby/intern.h
-rmd160init.o: $(hdrdir)/ruby/missing.h
-rmd160init.o: $(hdrdir)/ruby/ruby.h
-rmd160init.o: $(hdrdir)/ruby/st.h
-rmd160init.o: $(hdrdir)/ruby/subst.h
-rmd160init.o: $(top_srcdir)/ext/digest/digest.h
-rmd160init.o: $(top_srcdir)/include/ruby.h
-rmd160init.o: rmd160init.c
-rmd160init.o: rmd160ossl.h
-rmd160ossl.o: $(RUBY_EXTCONF_H)
-rmd160ossl.o: $(arch_hdrdir)/ruby/config.h
-rmd160ossl.o: $(hdrdir)/ruby/defines.h
-rmd160ossl.o: $(hdrdir)/ruby/intern.h
-rmd160ossl.o: $(hdrdir)/ruby/missing.h
-rmd160ossl.o: $(hdrdir)/ruby/ruby.h
-rmd160ossl.o: $(hdrdir)/ruby/st.h
-rmd160ossl.o: $(hdrdir)/ruby/subst.h
-rmd160ossl.o: $(top_srcdir)/ext/digest/defs.h
-rmd160ossl.o: $(top_srcdir)/include/ruby.h
-rmd160ossl.o: rmd160ossl.c
-rmd160ossl.o: rmd160ossl.h
-# AUTOGENERATED DEPENDENCIES END
+rmd160init.o: rmd160init.c rmd160.h $(srcdir)/../digest.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+rmd160ossl.o: rmd160ossl.h $(srcdir)/../defs.h
diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb
index a02ba56169..d487d6da80 100644
--- a/ext/digest/rmd160/extconf.rb
+++ b/ext/digest/rmd160/extconf.rb
@@ -1,16 +1,24 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id$
require "mkmf"
-require File.expand_path("../../digest_conf", __FILE__)
$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "rmd160init.#{$OBJEXT}" ]
-digest_conf("rmd160", "ripemd", "RIPEMD160")
+dir_config("openssl")
+pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
+
+if !with_config("bundled-rmd160") &&
+ have_library("crypto") && OpenSSL.check_func("RMD160_Transform", "openssl/ripemd.h")
+ $objs << "rmd160ossl.#{$OBJEXT}"
+else
+ $objs << "rmd160.#{$OBJEXT}"
+end
have_header("sys/cdefs.h")
diff --git a/ext/digest/rmd160/rmd160.c b/ext/digest/rmd160/rmd160.c
index 058d004f3a..bac77833b1 100644
--- a/ext/digest/rmd160/rmd160.c
+++ b/ext/digest/rmd160/rmd160.c
@@ -124,7 +124,7 @@
/********************************************************************/
-int
+void
RMD160_Init(RMD160_CTX *context)
{
@@ -138,7 +138,6 @@ RMD160_Init(RMD160_CTX *context)
context->state[4] = 0xc3d2e1f0U;
context->length[0] = context->length[1] = 0;
context->buflen = 0;
- return 1;
}
/********************************************************************/
@@ -413,7 +412,7 @@ RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
/********************************************************************/
-int
+void
RMD160_Finish(RMD160_CTX *context, uint8_t digest[20])
{
uint32_t i;
@@ -457,7 +456,6 @@ RMD160_Finish(RMD160_CTX *context, uint8_t digest[20])
digest[i + 3] = (context->state[i>>2] >> 24);
}
}
- return 1;
}
/************************ end of file rmd160.c **********************/
diff --git a/ext/digest/rmd160/rmd160.h b/ext/digest/rmd160/rmd160.h
index 6324709d96..2c98f11cd0 100644
--- a/ext/digest/rmd160/rmd160.h
+++ b/ext/digest/rmd160/rmd160.h
@@ -26,7 +26,7 @@
#ifndef _RMD160_H_
#define _RMD160_H_
-#include "../defs.h"
+#include "defs.h"
typedef struct {
uint32_t state[5]; /* state (ABCDE) */
@@ -43,10 +43,10 @@ typedef struct {
#endif
__BEGIN_DECLS
-int RMD160_Init _((RMD160_CTX *));
+void RMD160_Init _((RMD160_CTX *));
void RMD160_Transform _((uint32_t[5], const uint32_t[16]));
void RMD160_Update _((RMD160_CTX *, const uint8_t *, size_t));
-int RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
+void RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
__END_DECLS
#define RMD160_BLOCK_LENGTH 64
diff --git a/ext/digest/rmd160/rmd160init.c b/ext/digest/rmd160/rmd160init.c
index c1e753cc11..c214ca9f33 100644
--- a/ext/digest/rmd160/rmd160init.c
+++ b/ext/digest/rmd160/rmd160init.c
@@ -1,9 +1,8 @@
/* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
/* $Id$ */
-#include <ruby/ruby.h>
-#include "../digest.h"
-#if defined(RMD160_USE_OPENSSL)
+#include "digest.h"
+#if defined(HAVE_OPENSSL_RIPEMD_H)
#include "rmd160ossl.h"
#else
#include "rmd160.h"
@@ -25,7 +24,7 @@ static const rb_digest_metadata_t rmd160 = {
* Bosselaers, and Bart Preneel.
*/
void
-Init_rmd160(void)
+Init_rmd160()
{
VALUE mDigest, cDigest_Base, cDigest_RMD160;
@@ -39,8 +38,6 @@ Init_rmd160(void)
cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
- rb_iv_set(cDigest_RMD160, "metadata",
- Data_Wrap_Struct(0, 0, 0, (void *)&rmd160));
+ rb_ivar_set(cDigest_RMD160, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&rmd160));
}
diff --git a/ext/digest/rmd160/rmd160ossl.c b/ext/digest/rmd160/rmd160ossl.c
new file mode 100644
index 0000000000..f24e63e3d8
--- /dev/null
+++ b/ext/digest/rmd160/rmd160ossl.c
@@ -0,0 +1,8 @@
+/* $Id$ */
+
+#include "defs.h"
+#include "rmd160ossl.h"
+
+void RMD160_Finish(RMD160_CTX *ctx, char *buf) {
+ RIPEMD160_Final((unsigned char *)buf, ctx);
+}
diff --git a/ext/digest/rmd160/rmd160ossl.h b/ext/digest/rmd160/rmd160ossl.h
index e6bf5ea8d0..3df38a01c0 100644
--- a/ext/digest/rmd160/rmd160ossl.h
+++ b/ext/digest/rmd160/rmd160ossl.h
@@ -14,7 +14,6 @@
#define RMD160_BLOCK_LENGTH RIPEMD160_CBLOCK
#define RMD160_DIGEST_LENGTH RIPEMD160_DIGEST_LENGTH
-static DEFINE_FINISH_FUNC_FROM_FINAL(RIPEMD160)
-#define RMD160_Finish rb_digest_RIPEMD160_finish
+void RMD160_Finish(RMD160_CTX *ctx, char *buf);
#endif
diff --git a/ext/digest/sha1/depend b/ext/digest/sha1/depend
index 2ce73c4238..6b6ee6a0bf 100644
--- a/ext/digest/sha1/depend
+++ b/ext/digest/sha1/depend
@@ -1,28 +1,3 @@
sha1.o: sha1.c sha1.h $(srcdir)/../defs.h
-
-# AUTOGENERATED DEPENDENCIES START
-sha1init.o: $(RUBY_EXTCONF_H)
-sha1init.o: $(arch_hdrdir)/ruby/config.h
-sha1init.o: $(hdrdir)/ruby/defines.h
-sha1init.o: $(hdrdir)/ruby/intern.h
-sha1init.o: $(hdrdir)/ruby/missing.h
-sha1init.o: $(hdrdir)/ruby/ruby.h
-sha1init.o: $(hdrdir)/ruby/st.h
-sha1init.o: $(hdrdir)/ruby/subst.h
-sha1init.o: $(top_srcdir)/ext/digest/digest.h
-sha1init.o: $(top_srcdir)/include/ruby.h
-sha1init.o: sha1init.c
-sha1init.o: sha1ossl.h
-sha1ossl.o: $(RUBY_EXTCONF_H)
-sha1ossl.o: $(arch_hdrdir)/ruby/config.h
-sha1ossl.o: $(hdrdir)/ruby/defines.h
-sha1ossl.o: $(hdrdir)/ruby/intern.h
-sha1ossl.o: $(hdrdir)/ruby/missing.h
-sha1ossl.o: $(hdrdir)/ruby/ruby.h
-sha1ossl.o: $(hdrdir)/ruby/st.h
-sha1ossl.o: $(hdrdir)/ruby/subst.h
-sha1ossl.o: $(top_srcdir)/ext/digest/defs.h
-sha1ossl.o: $(top_srcdir)/include/ruby.h
-sha1ossl.o: sha1ossl.c
-sha1ossl.o: sha1ossl.h
-# AUTOGENERATED DEPENDENCIES END
+sha1init.o: sha1init.c sha1.h $(srcdir)/../digest.h sha1.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+sha1ossl.o: sha1ossl.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb
index 0ff4158bef..d7e52fe731 100644
--- a/ext/digest/sha1/extconf.rb
+++ b/ext/digest/sha1/extconf.rb
@@ -1,16 +1,24 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
# $Id$
require "mkmf"
-require File.expand_path("../../digest_conf", __FILE__)
$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha1init.#{$OBJEXT}" ]
-digest_conf("sha1", "sha", nil, %w[SHA])
+dir_config("openssl")
+pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
+
+if !with_config("bundled-sha1") &&
+ have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
+ $objs << "sha1ossl.#{$OBJEXT}"
+else
+ $objs << "sha1.#{$OBJEXT}"
+end
have_header("sys/cdefs.h")
diff --git a/ext/digest/sha1/sha1.c b/ext/digest/sha1/sha1.c
index 5311227549..6196ca6b82 100644
--- a/ext/digest/sha1/sha1.c
+++ b/ext/digest/sha1/sha1.c
@@ -199,7 +199,7 @@ void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
/*
* SHA1_Init - Initialize new context
*/
-int SHA1_Init(SHA1_CTX *context)
+void SHA1_Init(SHA1_CTX *context)
{
_DIAGASSERT(context != 0);
@@ -211,7 +211,6 @@ int SHA1_Init(SHA1_CTX *context)
context->state[3] = 0x10325476;
context->state[4] = 0xC3D2E1F0;
context->count[0] = context->count[1] = 0;
- return 1;
}
@@ -245,7 +244,7 @@ void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
/*
* Add padding and return the message digest.
*/
-int SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
+void SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
{
size_t i;
uint8_t finalcount[8];
@@ -267,5 +266,4 @@ int SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
digest[i] = (uint8_t)
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
}
- return 1;
}
diff --git a/ext/digest/sha1/sha1.h b/ext/digest/sha1/sha1.h
index 2accc46d46..55997e73dd 100644
--- a/ext/digest/sha1/sha1.h
+++ b/ext/digest/sha1/sha1.h
@@ -11,7 +11,7 @@
#ifndef _SYS_SHA1_H_
#define _SYS_SHA1_H_
-#include "../defs.h"
+#include "defs.h"
typedef struct {
uint32_t state[5];
@@ -28,9 +28,9 @@ typedef struct {
#endif
void SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
-int SHA1_Init _((SHA1_CTX *context));
+void SHA1_Init _((SHA1_CTX *context));
void SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
-int SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
+void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
#define SHA1_BLOCK_LENGTH 64
#define SHA1_DIGEST_LENGTH 20
diff --git a/ext/digest/sha1/sha1cc.h b/ext/digest/sha1/sha1cc.h
deleted file mode 100644
index 2ed8d646ab..0000000000
--- a/ext/digest/sha1/sha1cc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#define COMMON_DIGEST_FOR_OPENSSL 1
-#include <CommonCrypto/CommonDigest.h>
-
-#define SHA1_BLOCK_LENGTH CC_SHA1_BLOCK_BYTES
-#define SHA1_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH
-#define SHA1_CTX CC_SHA1_CTX
-
-static DEFINE_UPDATE_FUNC_FOR_UINT(SHA1)
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA1)
-
-#undef SHA1_Update
-#undef SHA1_Finish
-#define SHA1_Update rb_digest_SHA1_update
-#define SHA1_Finish rb_digest_SHA1_finish
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
index 1f8b89e276..d52eef58b3 100644
--- a/ext/digest/sha1/sha1init.c
+++ b/ext/digest/sha1/sha1init.c
@@ -1,12 +1,9 @@
/* $RoughId: sha1init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
/* $Id$ */
-#include <ruby/ruby.h>
-#include "../digest.h"
-#if defined(SHA1_USE_OPENSSL)
+#include "digest.h"
+#if defined(HAVE_OPENSSL_SHA_H)
#include "sha1ossl.h"
-#elif defined(SHA1_USE_COMMONDIGEST)
-#include "sha1cc.h"
#else
#include "sha1.h"
#endif
@@ -27,7 +24,7 @@ static const rb_digest_metadata_t sha1 = {
* Technology), described in FIPS PUB 180-1.
*/
void
-Init_sha1(void)
+Init_sha1()
{
VALUE mDigest, cDigest_Base, cDigest_SHA1;
@@ -41,8 +38,6 @@ Init_sha1(void)
cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
- rb_iv_set(cDigest_SHA1, "metadata",
- Data_Wrap_Struct(0, 0, 0, (void *)&sha1));
+ rb_ivar_set(cDigest_SHA1, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&sha1));
}
diff --git a/ext/digest/sha1/sha1ossl.c b/ext/digest/sha1/sha1ossl.c
new file mode 100644
index 0000000000..452cf35084
--- /dev/null
+++ b/ext/digest/sha1/sha1ossl.c
@@ -0,0 +1,10 @@
+/* $Id$ */
+
+#include "defs.h"
+#include "sha1ossl.h"
+
+void
+SHA1_Finish(SHA1_CTX *ctx, char *buf)
+{
+ SHA1_Final((unsigned char *)buf, ctx);
+}
diff --git a/ext/digest/sha1/sha1ossl.h b/ext/digest/sha1/sha1ossl.h
index 599efe9a2f..8f9984cc64 100644
--- a/ext/digest/sha1/sha1ossl.h
+++ b/ext/digest/sha1/sha1ossl.h
@@ -15,8 +15,6 @@
#endif
#define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA1)
-#undef SHA1_Finish
-#define SHA1_Finish rb_digest_SHA1_finish
+void SHA1_Finish(SHA1_CTX *ctx, char *buf);
#endif
diff --git a/ext/digest/sha2/depend b/ext/digest/sha2/depend
index 3a47a76532..7373f46fc2 100644
--- a/ext/digest/sha2/depend
+++ b/ext/digest/sha2/depend
@@ -1,28 +1,3 @@
sha2.o: sha2.c sha2.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
-
-# AUTOGENERATED DEPENDENCIES START
-sha2init.o: $(RUBY_EXTCONF_H)
-sha2init.o: $(arch_hdrdir)/ruby/config.h
-sha2init.o: $(hdrdir)/ruby/defines.h
-sha2init.o: $(hdrdir)/ruby/intern.h
-sha2init.o: $(hdrdir)/ruby/missing.h
-sha2init.o: $(hdrdir)/ruby/ruby.h
-sha2init.o: $(hdrdir)/ruby/st.h
-sha2init.o: $(hdrdir)/ruby/subst.h
-sha2init.o: $(top_srcdir)/ext/digest/digest.h
-sha2init.o: $(top_srcdir)/include/ruby.h
-sha2init.o: sha2init.c
-sha2init.o: sha2ossl.h
-sha2ossl.o: $(RUBY_EXTCONF_H)
-sha2ossl.o: $(arch_hdrdir)/ruby/config.h
-sha2ossl.o: $(hdrdir)/ruby/defines.h
-sha2ossl.o: $(hdrdir)/ruby/intern.h
-sha2ossl.o: $(hdrdir)/ruby/missing.h
-sha2ossl.o: $(hdrdir)/ruby/ruby.h
-sha2ossl.o: $(hdrdir)/ruby/st.h
-sha2ossl.o: $(hdrdir)/ruby/subst.h
-sha2ossl.o: $(top_srcdir)/ext/digest/defs.h
-sha2ossl.o: $(top_srcdir)/include/ruby.h
-sha2ossl.o: sha2ossl.c
-sha2ossl.o: sha2ossl.h
-# AUTOGENERATED DEPENDENCIES END
+sha2init.o: sha2init.c sha2.h $(srcdir)/../digest.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+sha2ossl.o: sha2ossl.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb
index 5c7f76c7f3..5ab2d35af5 100644
--- a/ext/digest/sha2/extconf.rb
+++ b/ext/digest/sha2/extconf.rb
@@ -1,21 +1,33 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
# $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $
# $Id$
require "mkmf"
-require File.expand_path("../../digest_conf", __FILE__)
$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha2init.#{$OBJEXT}" ]
-unless digest_conf("sha2", "sha", %w[SHA256 SHA512])
+dir_config("openssl")
+pkg_config("openssl")
+require File.expand_path('../../../openssl/deprecation', __FILE__)
+
+if !with_config("bundled-sha2") &&
+ have_library("crypto") &&
+ %w[SHA256 SHA512].all? {|d| OpenSSL.check_func("#{d}_Transform", "openssl/sha.h")} &&
+ %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}
+ $objs << "sha2ossl.#{$OBJEXT}"
+ $defs << "-DSHA2_USE_OPENSSL"
+else
have_type("u_int8_t")
+ $objs << "sha2.#{$OBJEXT}"
end
have_header("sys/cdefs.h")
$preload = %w[digest]
-create_makefile("digest/sha2")
+if have_type("uint64_t", "defs.h", $defs.join(' '))
+ create_makefile("digest/sha2")
+end
diff --git a/ext/digest/sha2/lib/sha2.rb b/ext/digest/sha2/lib/sha2.rb
index 58ff9f5cf0..58d12e9b09 100644
--- a/ext/digest/sha2/lib/sha2.rb
+++ b/ext/digest/sha2/lib/sha2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# sha2.rb - defines Digest::SHA2 class which wraps up the SHA256,
# SHA384, and SHA512 classes.
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c
index c86eab37a0..3457790eea 100644
--- a/ext/digest/sha2/sha2.c
+++ b/ext/digest/sha2/sha2.c
@@ -34,7 +34,7 @@
* $Id$
*/
-#include "../defs.h"
+#include "defs.h"
#include <string.h> /* memcpy()/memset() or bcopy()/bzero() */
#include <assert.h> /* assert() */
#include "sha2.h"
@@ -67,7 +67,7 @@
* Please make sure that your system defines BYTE_ORDER. If your
* architecture is little-endian, make sure it also defines
* LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are
- * equivalent.
+ * equivilent.
*
* If your system does not define the above, then you can do so by
* hand like this:
@@ -341,14 +341,13 @@ static const char *sha2_hex_digits = "0123456789abcdef";
/*** SHA-256: *********************************************************/
-int SHA256_Init(SHA256_CTX* context) {
+void SHA256_Init(SHA256_CTX* context) {
if (context == (SHA256_CTX*)0) {
- return 0;
+ return;
}
MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH);
context->bitcount = 0;
- return 1;
}
#ifdef SHA2_UNROLL_TRANSFORM
@@ -575,7 +574,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
usedspace = freespace = 0;
}
-int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
+void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
sha2_word32 *d = (sha2_word32*)digest;
unsigned int usedspace;
@@ -637,7 +636,6 @@ int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
/* Clean up state data: */
MEMSET_BZERO(context, sizeof(*context));
usedspace = 0;
- return 1;
}
char *SHA256_End(SHA256_CTX* context, char buffer[]) {
@@ -672,14 +670,13 @@ char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_S
/*** SHA-512: *********************************************************/
-int SHA512_Init(SHA512_CTX* context) {
+void SHA512_Init(SHA512_CTX* context) {
if (context == (SHA512_CTX*)0) {
- return 0;
+ return;
}
MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
- return 1;
}
#ifdef SHA2_UNROLL_TRANSFORM
@@ -943,7 +940,7 @@ void SHA512_Last(SHA512_CTX* context) {
SHA512_Transform(context, (sha2_word64*)context->buffer);
}
-int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
+void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -970,7 +967,6 @@ int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
/* Zero out state data */
MEMSET_BZERO(context, sizeof(*context));
- return 1;
}
char *SHA512_End(SHA512_CTX* context, char buffer[]) {
@@ -1005,21 +1001,20 @@ char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_S
/*** SHA-384: *********************************************************/
-int SHA384_Init(SHA384_CTX* context) {
+void SHA384_Init(SHA384_CTX* context) {
if (context == (SHA384_CTX*)0) {
- return 0;
+ return;
}
MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
context->bitcount[0] = context->bitcount[1] = 0;
- return 1;
}
void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
SHA512_Update((SHA512_CTX*)context, data, len);
}
-int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
+void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -1046,7 +1041,6 @@ int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
/* Zero out state data */
MEMSET_BZERO(context, sizeof(*context));
- return 1;
}
char *SHA384_End(SHA384_CTX* context, char buffer[]) {
diff --git a/ext/digest/sha2/sha2.h b/ext/digest/sha2/sha2.h
index e58f15ae12..465398ee19 100644
--- a/ext/digest/sha2/sha2.h
+++ b/ext/digest/sha2/sha2.h
@@ -165,52 +165,52 @@ typedef SHA512_CTX SHA384_CTX;
#ifndef NOPROTO
-int SHA256_Init(SHA256_CTX *);
+void SHA256_Init(SHA256_CTX *);
void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
-int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
+void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
char* SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
-int SHA384_Init(SHA384_CTX*);
+void SHA384_Init(SHA384_CTX*);
void SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
-int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
+void SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
char* SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
-int SHA512_Init(SHA512_CTX*);
+void SHA512_Init(SHA512_CTX*);
void SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
-int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
+void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
#else /* NOPROTO */
-int SHA256_Init();
+void SHA256_Init();
void SHA256_Update();
#ifdef RUBY
-int SHA256_Finish();
+void SHA256_Finish();
#else
-int SHA256_Final();
+void SHA256_Final();
#endif /* RUBY */
char* SHA256_End();
char* SHA256_Data();
-int SHA384_Init();
+void SHA384_Init();
void SHA384_Update();
#ifdef RUBY
-int SHA384_Finish();
+void SHA384_Finish();
#else
-int SHA384_Final();
+void SHA384_Final();
#endif /* RUBY */
char* SHA384_End();
char* SHA384_Data();
-int SHA512_Init();
+void SHA512_Init();
void SHA512_Update();
#ifdef RUBY
-int SHA512_Finish();
+void SHA512_Finish();
#else
-int SHA512_Final();
+void SHA512_Final();
#endif /* RUBY */
char* SHA512_End();
char* SHA512_Data();
diff --git a/ext/digest/sha2/sha2cc.h b/ext/digest/sha2/sha2cc.h
deleted file mode 100644
index 3f99604465..0000000000
--- a/ext/digest/sha2/sha2cc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#define COMMON_DIGEST_FOR_OPENSSL 1
-#include <CommonCrypto/CommonDigest.h>
-
-#define SHA256_BLOCK_LENGTH CC_SHA256_BLOCK_BYTES
-#define SHA384_BLOCK_LENGTH CC_SHA384_BLOCK_BYTES
-#define SHA512_BLOCK_LENGTH CC_SHA512_BLOCK_BYTES
-
-#define SHA384_CTX CC_SHA512_CTX
-
-static DEFINE_UPDATE_FUNC_FOR_UINT(SHA256)
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA256)
-static DEFINE_UPDATE_FUNC_FOR_UINT(SHA384)
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA384)
-static DEFINE_UPDATE_FUNC_FOR_UINT(SHA512)
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA512)
-
-
-#undef SHA256_Update
-#undef SHA256_Finish
-#define SHA256_Update rb_digest_SHA256_update
-#define SHA256_Finish rb_digest_SHA256_finish
-
-#undef SHA384_Update
-#undef SHA384_Finish
-#define SHA384_Update rb_digest_SHA384_update
-#define SHA384_Finish rb_digest_SHA384_finish
-
-#undef SHA512_Update
-#undef SHA512_Finish
-#define SHA512_Update rb_digest_SHA512_update
-#define SHA512_Finish rb_digest_SHA512_finish
diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c
index 9fd8ece7fe..13df4bcb78 100644
--- a/ext/digest/sha2/sha2init.c
+++ b/ext/digest/sha2/sha2init.c
@@ -1,12 +1,9 @@
/* $RoughId: sha2init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
/* $Id$ */
-#include <ruby/ruby.h>
-#include "../digest.h"
+#include "digest.h"
#if defined(SHA2_USE_OPENSSL)
#include "sha2ossl.h"
-#elif defined(SHA2_USE_COMMONDIGEST)
-#include "sha2cc.h"
#else
#include "sha2.h"
#endif
@@ -32,7 +29,7 @@ FOREACH_BITLEN(DEFINE_ALGO_METADATA)
* Standards and Technology), described in FIPS PUB 180-2.
*/
void
-Init_sha2(void)
+Init_sha2()
{
VALUE mDigest, cDigest_Base;
ID id_metadata;
@@ -44,7 +41,7 @@ Init_sha2(void)
rb_require("digest");
- id_metadata = rb_intern_const("metadata");
+ id_metadata = rb_intern("metadata");
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
@@ -53,9 +50,7 @@ Init_sha2(void)
cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
\
rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
- Data_Wrap_Struct(0, 0, 0, (void *)&sha##bitlen));
+ Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&sha##bitlen));
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
FOREACH_BITLEN(DEFINE_ALGO_CLASS)
}
diff --git a/ext/digest/sha2/sha2ossl.c b/ext/digest/sha2/sha2ossl.c
new file mode 100644
index 0000000000..34353be8b8
--- /dev/null
+++ b/ext/digest/sha2/sha2ossl.c
@@ -0,0 +1,13 @@
+#include "defs.h"
+#include "sha2ossl.h"
+
+#define SHA_Finish(bit) \
+ void SHA##bit##_Finish(SHA##bit##_CTX *ctx, char *buf) \
+ { SHA##bit##_Final((unsigned char *)buf, ctx);}
+#ifndef __DragonFly__
+#define SHA384_Final SHA512_Final
+#endif
+
+SHA_Finish(256)
+SHA_Finish(384)
+SHA_Finish(512)
diff --git a/ext/digest/sha2/sha2ossl.h b/ext/digest/sha2/sha2ossl.h
index 8dd0530107..4229d14cf9 100644
--- a/ext/digest/sha2/sha2ossl.h
+++ b/ext/digest/sha2/sha2ossl.h
@@ -8,20 +8,10 @@
#define SHA384_BLOCK_LENGTH SHA512_CBLOCK
#define SHA512_BLOCK_LENGTH SHA512_CBLOCK
-#ifndef __DragonFly__
-#define SHA384_Final SHA512_Final
-#endif
-
typedef SHA512_CTX SHA384_CTX;
-#undef SHA256_Finish
-#undef SHA384_Finish
-#undef SHA512_Finish
-#define SHA256_Finish rb_digest_SHA256_finish
-#define SHA384_Finish rb_digest_SHA384_finish
-#define SHA512_Finish rb_digest_SHA512_finish
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA256)
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA384)
-static DEFINE_FINISH_FUNC_FROM_FINAL(SHA512)
+void SHA256_Finish(SHA256_CTX *ctx, char *buf);
+void SHA384_Finish(SHA384_CTX *ctx, char *buf);
+void SHA512_Finish(SHA512_CTX *ctx, char *buf);
#endif
diff --git a/ext/dl/callback/depend b/ext/dl/callback/depend
new file mode 100644
index 0000000000..c3b4fef1db
--- /dev/null
+++ b/ext/dl/callback/depend
@@ -0,0 +1,15 @@
+src: callback.c \
+ callback-0.c callback-1.c callback-2.c \
+ callback-3.c callback-4.c callback-5.c \
+ callback-6.c callback-7.c callback-8.c
+
+$(OBJS): $(srcdir)/../dl.h $(HDRS) $(ruby_headers)
+
+callback-0.c callback-1.c callback-2.c \
+callback-3.c callback-4.c callback-5.c \
+callback-6.c callback-7.c callback-8.c \
+ : callback.c
+
+callback.c: $(srcdir)/mkcallback.rb $(srcdir)/../dl.h
+ @echo "generating callback.c"
+ @$(RUBY) $(srcdir)/mkcallback.rb -output=callback $(srcdir)/../dl.h
diff --git a/ext/dl/callback/extconf.rb b/ext/dl/callback/extconf.rb
new file mode 100644
index 0000000000..6c3387670d
--- /dev/null
+++ b/ext/dl/callback/extconf.rb
@@ -0,0 +1,14 @@
+require 'mkmf'
+
+if compiled?("dl")
+ callbacks = (0..8).map{|i| "callback-#{i}"}.unshift("callback")
+ callback_srcs = callbacks.map{|basename| "#{basename}.c"}
+ callback_objs = callbacks.map{|basename| "#{basename}.o"}
+
+ $distcleanfiles << '$(SRCS)'
+ $srcs = callback_srcs
+ $objs = callback_objs
+ $INCFLAGS << " -I$(srcdir)/.."
+
+ create_makefile("dl/callback")
+end
diff --git a/ext/dl/callback/mkcallback.rb b/ext/dl/callback/mkcallback.rb
new file mode 100644
index 0000000000..e94a196247
--- /dev/null
+++ b/ext/dl/callback/mkcallback.rb
@@ -0,0 +1,242 @@
+#!ruby -s
+$output ||= "callback"
+$out = open("#{$output}.c", "w")
+
+$dl_h = ARGV[0] || "dl.h"
+
+# import DLSTACK_SIZE, DLSTACK_ARGS and so on
+File.open($dl_h){|f|
+ pre = ""
+ f.each{|line|
+ line.chop!
+ if( line[-1] == ?\\ )
+ line.chop!
+ line.concat(" ")
+ pre += line
+ next
+ end
+ if( pre.size > 0 )
+ line = pre + line
+ pre = ""
+ end
+ case line
+ when /#define\s+DLSTACK_SIZE\s+\(?(\d+)\)?/
+ DLSTACK_SIZE = $1.to_i
+ when /#define\s+DLSTACK_ARGS\s+(.+)/
+ DLSTACK_ARGS = $1.to_i
+ when /#define\s+DLTYPE_([A-Z_]+)\s+\(?(\d+)\)?/
+ eval("#{$1} = #{$2}")
+ when /#define\s+MAX_DLTYPE\s+\(?(\d+)\)?/
+ MAX_DLTYPE = $1.to_i
+ when /#define\s+MAX_CALLBACK\s+\(?(\d+)\)?/
+ MAX_CALLBACK = $1.to_i
+ end
+ }
+}
+
+CDECL = "cdecl"
+STDCALL = "stdcall"
+
+CALLTYPES = [CDECL, STDCALL]
+
+DLTYPE = {
+ VOID => {
+ :name => 'void',
+ :type => 'void',
+ :conv => nil,
+ },
+ CHAR => {
+ :name => 'char',
+ :type => 'char',
+ :conv => 'NUM2CHR(%s)'
+ },
+ SHORT => {
+ :name => 'short',
+ :type => 'short',
+ :conv => 'NUM2INT(%s)',
+ },
+ INT => {
+ :name => 'int',
+ :type => 'int',
+ :conv => 'NUM2INT(%s)',
+ },
+ LONG => {
+ :name => 'long',
+ :type => 'long',
+ :conv => 'NUM2LONG(%s)',
+ },
+ LONG_LONG => {
+ :name => 'long_long',
+ :type => 'LONG_LONG',
+ :conv => 'NUM2LL(%s)',
+ },
+ FLOAT => {
+ :name => 'float',
+ :type => 'float',
+ :conv => '(float)RFLOAT_VALUE(%s)',
+ },
+ DOUBLE => {
+ :name => 'double',
+ :type => 'double',
+ :conv => 'RFLOAT_VALUE(%s)',
+ },
+ VOIDP => {
+ :name => 'ptr',
+ :type => 'void *',
+ :conv => 'NUM2PTR(%s)',
+ },
+}
+
+
+def func_name(ty, argc, n, calltype)
+ "rb_dl_callback_#{DLTYPE[ty][:name]}_#{argc}_#{n}_#{calltype}"
+end
+
+$out << (<<EOS)
+#include "ruby.h"
+
+VALUE rb_DLCdeclCallbackAddrs, rb_DLCdeclCallbackProcs;
+#ifdef FUNC_STDCALL
+VALUE rb_DLStdcallCallbackAddrs, rb_DLStdcallCallbackProcs;
+#endif
+/*static void *cdecl_callbacks[MAX_DLTYPE][MAX_CALLBACK];*/
+#ifdef FUNC_STDCALL
+/*static void *stdcall_callbacks[MAX_DLTYPE][MAX_CALLBACK];*/
+#endif
+ID rb_dl_cb_call;
+EOS
+
+def foreach_proc_entry
+ for calltype in CALLTYPES
+ case calltype
+ when CDECL
+ proc_entry = "rb_DLCdeclCallbackProcs"
+ when STDCALL
+ proc_entry = "rb_DLStdcallCallbackProcs"
+ else
+ raise "unknown calltype: #{calltype}"
+ end
+ yield calltype, proc_entry
+ end
+end
+
+def gencallback(ty, calltype, proc_entry, argc, n)
+ dltype = DLTYPE[ty]
+ ret = dltype[:conv]
+ src = <<-EOS
+#{calltype == STDCALL ? "\n#ifdef FUNC_STDCALL" : ""}
+static #{dltype[:type]}
+FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack#{i}"}.join(", ")})
+{
+ VALUE #{ret ? "ret, " : ""}cb#{argc > 0 ? ", args[#{argc}]" : ""};
+#{
+ (0...argc).collect{|i|
+ "\n args[#{i}] = PTR2NUM(stack#{i});"
+ }.join("")
+}
+ cb = rb_ary_entry(rb_ary_entry(#{proc_entry}, #{ty}), #{(n * DLSTACK_SIZE) + argc});
+ #{ret ? "ret = " : ""}rb_funcall2(cb, rb_dl_cb_call, #{argc}, #{argc > 0 ? 'args' : 'NULL'});
+ EOS
+ src << " return #{ret % "ret"};\n" if ret
+ src << <<-EOS
+}
+#{calltype == STDCALL ? "#endif\n" : ""}
+ EOS
+end
+
+def gen_push_proc_ary(ty, aryname)
+ sprintf(" rb_ary_push(#{aryname}, rb_ary_new3(%d,%s));",
+ MAX_CALLBACK * DLSTACK_SIZE,
+ (0...MAX_CALLBACK).collect{
+ (0...DLSTACK_SIZE).collect{ "Qnil" }.join(",")
+ }.join(","))
+end
+
+def gen_push_addr_ary(ty, aryname, calltype)
+ sprintf(" rb_ary_push(#{aryname}, rb_ary_new3(%d,%s));",
+ MAX_CALLBACK * DLSTACK_SIZE,
+ (0...MAX_CALLBACK).collect{|i|
+ (0...DLSTACK_SIZE).collect{|argc|
+ "PTR2NUM(%s)" % func_name(ty,argc,i,calltype)
+ }.join(",")
+ }.join(","))
+end
+
+def gen_callback_file(ty)
+ filename = "#{$output}-#{ty}.c"
+ initname = "rb_dl_init_callbacks_#{ty}"
+ body = <<-EOS
+#include "dl.h"
+
+extern VALUE rb_DLCdeclCallbackAddrs, rb_DLCdeclCallbackProcs;
+#ifdef FUNC_STDCALL
+extern VALUE rb_DLStdcallCallbackAddrs, rb_DLStdcallCallbackProcs;
+#endif
+extern ID rb_dl_cb_call;
+ EOS
+ yield body
+ body << <<-EOS
+void
+#{initname}()
+{
+#{gen_push_proc_ary(ty, "rb_DLCdeclCallbackProcs")}
+#{gen_push_addr_ary(ty, "rb_DLCdeclCallbackAddrs", CDECL)}
+#ifdef FUNC_STDCALL
+#{gen_push_proc_ary(ty, "rb_DLStdcallCallbackProcs")}
+#{gen_push_addr_ary(ty, "rb_DLStdcallCallbackAddrs", STDCALL)}
+#endif
+}
+ EOS
+ [filename, initname, body]
+end
+
+callbacks = []
+for ty in 0...MAX_DLTYPE
+ filename, initname, body = gen_callback_file(ty) {|f|
+ foreach_proc_entry do |calltype, proc_entry|
+ for argc in 0...DLSTACK_SIZE
+ for n in 0...MAX_CALLBACK
+ f << gencallback(ty, calltype, proc_entry, argc, n)
+ end
+ end
+ end
+ }
+ $out << "void #{initname}();\n"
+ callbacks << [filename, body]
+end
+
+$out << (<<EOS)
+void
+Init_callback(void)
+{
+ VALUE tmp;
+ VALUE rb_mDL = rb_path2class("DL");
+
+ rb_dl_cb_call = rb_intern("call");
+
+ tmp = rb_DLCdeclCallbackProcs = rb_ary_new();
+ rb_define_const(rb_mDL, "CdeclCallbackProcs", tmp);
+
+ tmp = rb_DLCdeclCallbackAddrs = rb_ary_new();
+ rb_define_const(rb_mDL, "CdeclCallbackAddrs", tmp);
+
+#ifdef FUNC_STDCALL
+ tmp = rb_DLStdcallCallbackProcs = rb_ary_new();
+ rb_define_const(rb_mDL, "StdcallCallbackProcs", tmp);
+
+ tmp = rb_DLStdcallCallbackAddrs = rb_ary_new();
+ rb_define_const(rb_mDL, "StdcallCallbackAddrs", tmp);
+#endif
+
+#{
+ (0...MAX_DLTYPE).collect{|ty|
+ " rb_dl_init_callbacks_#{ty}();"
+ }.join("\n")
+}
+}
+EOS
+$out.close
+
+for filename, body in callbacks
+ open(filename, "wb") {|f| f.puts body}
+end
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
new file mode 100644
index 0000000000..1f4958bbdc
--- /dev/null
+++ b/ext/dl/cfunc.c
@@ -0,0 +1,677 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby/ruby.h>
+#include <ruby/util.h>
+#include <errno.h>
+#include "dl.h"
+
+VALUE rb_cDLCFunc;
+
+static ID id_last_error;
+
+static VALUE
+rb_dl_get_last_error(VALUE self)
+{
+ return rb_thread_local_aref(rb_thread_current(), id_last_error);
+}
+
+static VALUE
+rb_dl_set_last_error(VALUE self, VALUE val)
+{
+ rb_thread_local_aset(rb_thread_current(), id_last_error, val);
+ return Qnil;
+}
+
+#if defined(_WIN32)
+#include <windows.h>
+static ID id_win32_last_error;
+
+static VALUE
+rb_dl_get_win32_last_error(VALUE self)
+{
+ return rb_thread_local_aref(rb_thread_current(), id_win32_last_error);
+}
+
+static VALUE
+rb_dl_set_win32_last_error(VALUE self, VALUE val)
+{
+ rb_thread_local_aset(rb_thread_current(), id_win32_last_error, val);
+ return Qnil;
+}
+#endif
+
+static void
+dlcfunc_mark(void *ptr)
+{
+ struct cfunc_data *data = ptr;
+ if (data->wrap) {
+ rb_gc_mark(data->wrap);
+ }
+}
+
+static void
+dlcfunc_free(void *ptr)
+{
+ struct cfunc_data *data = ptr;
+ if( data->name ){
+ xfree(data->name);
+ }
+ xfree(data);
+}
+
+static size_t
+dlcfunc_memsize(const void *ptr)
+{
+ const struct cfunc_data *data = ptr;
+ size_t size = 0;
+ if( data ){
+ size += sizeof(*data);
+ if( data->name ){
+ size += strlen(data->name) + 1;
+ }
+ }
+ return size;
+}
+
+const rb_data_type_t dlcfunc_data_type = {
+ "dl/cfunc",
+ {dlcfunc_mark, dlcfunc_free, dlcfunc_memsize,},
+};
+
+VALUE
+rb_dlcfunc_new(void (*func)(), int type, const char *name, ID calltype)
+{
+ VALUE val;
+ struct cfunc_data *data;
+
+ if( func ){
+ val = TypedData_Make_Struct(rb_cDLCFunc, struct cfunc_data, &dlcfunc_data_type, data);
+ data->ptr = (void *)(VALUE)func;
+ data->name = name ? strdup(name) : NULL;
+ data->type = type;
+ data->calltype = calltype;
+ }
+ else{
+ val = Qnil;
+ }
+
+ return val;
+}
+
+void *
+rb_dlcfunc2ptr(VALUE val)
+{
+ struct cfunc_data *data;
+ void * func;
+
+ if( rb_typeddata_is_kind_of(val, &dlcfunc_data_type) ){
+ data = DATA_PTR(val);
+ func = data->ptr;
+ }
+ else if( val == Qnil ){
+ func = NULL;
+ }
+ else{
+ rb_raise(rb_eTypeError, "DL::CFunc was expected");
+ }
+
+ return func;
+}
+
+static VALUE
+rb_dlcfunc_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct cfunc_data *data;
+
+ obj = TypedData_Make_Struct(klass, struct cfunc_data, &dlcfunc_data_type, data);
+ data->ptr = 0;
+ data->name = 0;
+ data->type = 0;
+ data->calltype = CFUNC_CDECL;
+
+ return obj;
+}
+
+int
+rb_dlcfunc_kind_p(VALUE func)
+{
+ return rb_typeddata_is_kind_of(func, &dlcfunc_data_type);
+}
+
+/*
+ * call-seq:
+ * DL::CFunc.new(address, type=DL::TYPE_VOID, name=nil, calltype=:cdecl)
+ *
+ * Create a new function that points to +address+ with an optional return type
+ * of +type+, a name of +name+ and a calltype of +calltype+.
+ */
+static VALUE
+rb_dlcfunc_initialize(int argc, VALUE argv[], VALUE self)
+{
+ VALUE addr, name, type, calltype, addrnum;
+ struct cfunc_data *data;
+ void *saddr;
+ const char *sname;
+
+ rb_scan_args(argc, argv, "13", &addr, &type, &name, &calltype);
+
+ addrnum = rb_Integer(addr);
+ saddr = (void*)(NUM2PTR(addrnum));
+ sname = NIL_P(name) ? NULL : StringValuePtr(name);
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, data);
+ if( data->name ) xfree(data->name);
+ data->ptr = saddr;
+ data->name = sname ? strdup(sname) : 0;
+ data->type = NIL_P(type) ? DLTYPE_VOID : NUM2INT(type);
+ data->calltype = NIL_P(calltype) ? CFUNC_CDECL : SYM2ID(calltype);
+ data->wrap = (addrnum == addr) ? 0 : addr;
+
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * name => str
+ *
+ * Get the name of this function
+ */
+static VALUE
+rb_dlcfunc_name(VALUE self)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ return cfunc->name ? rb_tainted_str_new2(cfunc->name) : Qnil;
+}
+
+/*
+ * call-seq:
+ * cfunc.ctype => num
+ *
+ * Get the C function return value type. See DL for a list of constants
+ * corresponding to this method's return value.
+ */
+static VALUE
+rb_dlcfunc_ctype(VALUE self)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ return INT2NUM(cfunc->type);
+}
+
+/*
+ * call-seq:
+ * cfunc.ctype = type
+ *
+ * Set the C function return value type to +type+.
+ */
+static VALUE
+rb_dlcfunc_set_ctype(VALUE self, VALUE ctype)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ cfunc->type = NUM2INT(ctype);
+ return ctype;
+}
+
+/*
+ * call-seq:
+ * cfunc.calltype => symbol
+ *
+ * Get the call type of this function.
+ */
+static VALUE
+rb_dlcfunc_calltype(VALUE self)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ return ID2SYM(cfunc->calltype);
+}
+
+/*
+ * call-seq:
+ * cfunc.calltype = symbol
+ *
+ * Set the call type for this function.
+ */
+static VALUE
+rb_dlcfunc_set_calltype(VALUE self, VALUE sym)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ cfunc->calltype = SYM2ID(sym);
+ return sym;
+}
+
+/*
+ * call-seq:
+ * cfunc.ptr
+ *
+ * Get the underlying function pointer as a DL::CPtr object.
+ */
+static VALUE
+rb_dlcfunc_ptr(VALUE self)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ return PTR2NUM(cfunc->ptr);
+}
+
+/*
+ * call-seq:
+ * cfunc.ptr = pointer
+ *
+ * Set the underlying function pointer to a DL::CPtr named +pointer+.
+ */
+static VALUE
+rb_dlcfunc_set_ptr(VALUE self, VALUE addr)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ cfunc->ptr = NUM2PTR(addr);
+
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * inspect
+ * to_s
+ *
+ * Returns a string formatted with an easily readable representation of the
+ * internal state of the DL::CFunc
+ */
+static VALUE
+rb_dlcfunc_inspect(VALUE self)
+{
+ VALUE val;
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+
+ val = rb_sprintf("#<DL::CFunc:%p ptr=%p type=%d name='%s'>",
+ cfunc,
+ cfunc->ptr,
+ cfunc->type,
+ cfunc->name ? cfunc->name : "");
+ OBJ_TAINT(val);
+ return val;
+}
+
+
+# define DECL_FUNC_CDECL(f,ret,args,val) \
+ ret (FUNC_CDECL(*(f)))(args) = (ret (FUNC_CDECL(*))(args))(VALUE)(val)
+#ifdef FUNC_STDCALL
+# define DECL_FUNC_STDCALL(f,ret,args,val) \
+ ret (FUNC_STDCALL(*(f)))(args) = (ret (FUNC_STDCALL(*))(args))(VALUE)(val)
+#endif
+
+#define CALL_CASE switch( RARRAY_LEN(ary) ){ \
+ CASE(0); break; \
+ CASE(1); break; CASE(2); break; CASE(3); break; CASE(4); break; CASE(5); break; \
+ CASE(6); break; CASE(7); break; CASE(8); break; CASE(9); break; CASE(10);break; \
+ CASE(11);break; CASE(12);break; CASE(13);break; CASE(14);break; CASE(15);break; \
+ CASE(16);break; CASE(17);break; CASE(18);break; CASE(19);break; CASE(20);break; \
+ default: rb_raise(rb_eArgError, "too many arguments"); \
+}
+
+
+#if defined(_MSC_VER) && defined(_M_AMD64) && _MSC_VER >= 1400 && _MSC_VER < 1600
+# pragma optimize("", off)
+#endif
+/*
+ * call-seq:
+ * dlcfunc.call(ary) => some_value
+ * dlcfunc[ary] => some_value
+ *
+ * Calls the function pointer passing in +ary+ as values to the underlying
+ * C function. The return value depends on the ctype.
+ */
+static VALUE
+rb_dlcfunc_call(VALUE self, VALUE ary)
+{
+ struct cfunc_data *cfunc;
+ int i;
+ DLSTACK_TYPE stack[DLSTACK_SIZE];
+ VALUE result = Qnil;
+
+ memset(stack, 0, sizeof(DLSTACK_TYPE) * DLSTACK_SIZE);
+ Check_Type(ary, T_ARRAY);
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+
+ if( cfunc->ptr == 0 ){
+ rb_raise(rb_eDLError, "can't call null-function");
+ return Qnil;
+ }
+
+ for( i = 0; i < RARRAY_LEN(ary); i++ ){
+ VALUE arg;
+ if( i >= DLSTACK_SIZE ){
+ rb_raise(rb_eDLError, "too many arguments (stack overflow)");
+ }
+ arg = rb_to_int(RARRAY_PTR(ary)[i]);
+ rb_check_safe_obj(arg);
+ if (FIXNUM_P(arg)) {
+ stack[i] = (DLSTACK_TYPE)FIX2LONG(arg);
+ }
+ else if (RB_TYPE_P(arg, T_BIGNUM)) {
+ unsigned long ls[(sizeof(DLSTACK_TYPE) + sizeof(long) - 1)/sizeof(long)];
+ DLSTACK_TYPE d;
+ int j;
+ rb_big_pack(arg, ls, sizeof(ls)/sizeof(*ls));
+ d = 0;
+ for (j = 0; j < (int)(sizeof(ls)/sizeof(*ls)); j++)
+ d |= (DLSTACK_TYPE)ls[j] << (j * sizeof(long) * CHAR_BIT);
+ stack[i] = d;
+ }
+ else {
+ Check_Type(arg, T_FIXNUM);
+ }
+ }
+
+ /* calltype == CFUNC_CDECL */
+ if( cfunc->calltype == CFUNC_CDECL
+#ifndef FUNC_STDCALL
+ || cfunc->calltype == CFUNC_STDCALL
+#endif
+ ){
+ switch( cfunc->type ){
+ case DLTYPE_VOID:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,void,DLSTACK_PROTO##n,cfunc->ptr); \
+ f(DLSTACK_ARGS##n(stack)); \
+ result = Qnil; \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_VOIDP:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,void*,DLSTACK_PROTO##n,cfunc->ptr); \
+ void * ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = PTR2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_CHAR:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,char,DLSTACK_PROTO##n,cfunc->ptr); \
+ char ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = CHR2FIX(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_SHORT:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,short,DLSTACK_PROTO##n,cfunc->ptr); \
+ short ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = INT2NUM((int)ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_INT:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,int,DLSTACK_PROTO##n,cfunc->ptr); \
+ int ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = INT2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_LONG:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,long,DLSTACK_PROTO##n,cfunc->ptr); \
+ long ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = LONG2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+#if HAVE_LONG_LONG /* used in ruby.h */
+ case DLTYPE_LONG_LONG:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,LONG_LONG,DLSTACK_PROTO##n,cfunc->ptr); \
+ LONG_LONG ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = LL2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+#endif
+ case DLTYPE_FLOAT:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,float,DLSTACK_PROTO##n,cfunc->ptr); \
+ float ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = rb_float_new(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_DOUBLE:
+#define CASE(n) case n: { \
+ DECL_FUNC_CDECL(f,double,DLSTACK_PROTO##n,cfunc->ptr); \
+ double ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = rb_float_new(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unknown type %d", cfunc->type);
+ }
+ }
+#ifdef FUNC_STDCALL
+ else if( cfunc->calltype == CFUNC_STDCALL ){
+ /* calltype == CFUNC_STDCALL */
+ switch( cfunc->type ){
+ case DLTYPE_VOID:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,void,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ f(DLSTACK_ARGS##n(stack)); \
+ result = Qnil; \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_VOIDP:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,void*,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ void * ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = PTR2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_CHAR:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,char,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ char ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = CHR2FIX(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_SHORT:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,short,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ short ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = INT2NUM((int)ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_INT:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,int,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ int ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = INT2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_LONG:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,long,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ long ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = LONG2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+#if HAVE_LONG_LONG /* used in ruby.h */
+ case DLTYPE_LONG_LONG:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,LONG_LONG,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ LONG_LONG ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = LL2NUM(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+#endif
+ case DLTYPE_FLOAT:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,float,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ float ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = rb_float_new(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ case DLTYPE_DOUBLE:
+#define CASE(n) case n: { \
+ DECL_FUNC_STDCALL(f,double,DLSTACK_PROTO##n##_,cfunc->ptr); \
+ double ret; \
+ ret = f(DLSTACK_ARGS##n(stack)); \
+ result = rb_float_new(ret); \
+}
+ CALL_CASE;
+#undef CASE
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unknown type %d", cfunc->type);
+ }
+ }
+#endif
+ else{
+ const char *name = rb_id2name(cfunc->calltype);
+ if( name ){
+ rb_raise(rb_eDLError, "unsupported call type: %s",
+ name);
+ }
+ else{
+ rb_raise(rb_eDLError, "unsupported call type: %"PRIxVALUE,
+ cfunc->calltype);
+ }
+ }
+
+ rb_dl_set_last_error(self, INT2NUM(errno));
+#if defined(_WIN32)
+ rb_dl_set_win32_last_error(self, INT2NUM(GetLastError()));
+#endif
+
+ return result;
+}
+#if defined(_MSC_VER) && defined(_M_AMD64) && _MSC_VER >= 1400 && _MSC_VER < 1600
+# pragma optimize("", on)
+#endif
+
+/*
+ * call-seq:
+ * dlfunc.to_i => integer
+ *
+ * Returns the memory location of this function pointer as an integer.
+ */
+static VALUE
+rb_dlcfunc_to_i(VALUE self)
+{
+ struct cfunc_data *cfunc;
+
+ TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
+ return PTR2NUM(cfunc->ptr);
+}
+
+void
+Init_dlcfunc(void)
+{
+ id_last_error = rb_intern("__DL2_LAST_ERROR__");
+#if defined(_WIN32)
+ id_win32_last_error = rb_intern("__DL2_WIN32_LAST_ERROR__");
+#endif
+
+ /*
+ * Document-class: DL::CFunc
+ *
+ * A direct accessor to a function in a C library
+ *
+ * == Example
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ * libc = DL::dlopen(libc_so)
+ * => #<DL::Handle:0x00000000e05b00>
+ * @cfunc = DL::CFunc.new(libc['strcpy'], DL::TYPE_VOIDP, 'strcpy')
+ * => #<DL::CFunc:0x000000012daec0 ptr=0x007f62ca5a8300 type=1 name='strcpy'>
+ *
+ */
+ rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject);
+ rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate);
+
+ /*
+ * Document-method: last_error
+ *
+ * Returns the last error for the current executing thread
+ */
+ rb_define_module_function(rb_cDLCFunc, "last_error", rb_dl_get_last_error, 0);
+#if defined(_WIN32)
+
+ /*
+ * Document-method: win32_last_error
+ *
+ * Returns the last win32 error for the current executing thread
+ */
+ rb_define_module_function(rb_cDLCFunc, "win32_last_error", rb_dl_get_win32_last_error, 0);
+#endif
+ rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1);
+ rb_define_method(rb_cDLCFunc, "call", rb_dlcfunc_call, 1);
+ rb_define_method(rb_cDLCFunc, "[]", rb_dlcfunc_call, 1);
+ rb_define_method(rb_cDLCFunc, "name", rb_dlcfunc_name, 0);
+ rb_define_method(rb_cDLCFunc, "ctype", rb_dlcfunc_ctype, 0);
+ rb_define_method(rb_cDLCFunc, "ctype=", rb_dlcfunc_set_ctype, 1);
+ rb_define_method(rb_cDLCFunc, "calltype", rb_dlcfunc_calltype, 0);
+ rb_define_method(rb_cDLCFunc, "calltype=", rb_dlcfunc_set_calltype, 1);
+ rb_define_method(rb_cDLCFunc, "ptr", rb_dlcfunc_ptr, 0);
+ rb_define_method(rb_cDLCFunc, "ptr=", rb_dlcfunc_set_ptr, 1);
+ rb_define_method(rb_cDLCFunc, "inspect", rb_dlcfunc_inspect, 0);
+ rb_define_method(rb_cDLCFunc, "to_s", rb_dlcfunc_inspect, 0);
+ rb_define_method(rb_cDLCFunc, "to_i", rb_dlcfunc_to_i, 0);
+}
diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c
new file mode 100644
index 0000000000..9e59139fc9
--- /dev/null
+++ b/ext/dl/cptr.c
@@ -0,0 +1,670 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby/ruby.h>
+#include <ruby/io.h>
+#include <ctype.h>
+#include "dl.h"
+
+VALUE rb_cDLCPtr;
+
+static inline freefunc_t
+get_freefunc(VALUE func, volatile VALUE *wrap)
+{
+ VALUE addrnum;
+ if (NIL_P(func)) {
+ *wrap = 0;
+ return NULL;
+ }
+ if (rb_dlcfunc_kind_p(func)) {
+ *wrap = func;
+ return (freefunc_t)(VALUE)RCFUNC_DATA(func)->ptr;
+ }
+ addrnum = rb_Integer(func);
+ *wrap = (addrnum != func) ? func : 0;
+ return (freefunc_t)(VALUE)NUM2PTR(addrnum);
+}
+
+static ID id_to_ptr;
+
+static void
+dlptr_mark(void *ptr)
+{
+ struct ptr_data *data = ptr;
+ if (data->wrap[0]) {
+ rb_gc_mark(data->wrap[0]);
+ }
+ if (data->wrap[1]) {
+ rb_gc_mark(data->wrap[1]);
+ }
+}
+
+static void
+dlptr_free(void *ptr)
+{
+ struct ptr_data *data = ptr;
+ if (data->ptr) {
+ if (data->free) {
+ (*(data->free))(data->ptr);
+ }
+ }
+}
+
+static size_t
+dlptr_memsize(const void *ptr)
+{
+ const struct ptr_data *data = ptr;
+ return data ? sizeof(*data) + data->size : 0;
+}
+
+static const rb_data_type_t dlptr_data_type = {
+ "dl/ptr",
+ {dlptr_mark, dlptr_free, dlptr_memsize,},
+};
+
+VALUE
+rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
+{
+ struct ptr_data *data;
+ VALUE val;
+
+ val = TypedData_Make_Struct(klass, struct ptr_data, &dlptr_data_type, data);
+ data->ptr = ptr;
+ data->free = func;
+ data->size = size;
+ OBJ_TAINT(val);
+
+ return val;
+}
+
+VALUE
+rb_dlptr_new(void *ptr, long size, freefunc_t func)
+{
+ return rb_dlptr_new2(rb_cDLCPtr, ptr, size, func);
+}
+
+VALUE
+rb_dlptr_malloc(long size, freefunc_t func)
+{
+ void *ptr;
+
+ ptr = ruby_xmalloc((size_t)size);
+ memset(ptr,0,(size_t)size);
+ return rb_dlptr_new(ptr, size, func);
+}
+
+void *
+rb_dlptr2cptr(VALUE val)
+{
+ struct ptr_data *data;
+ void *ptr;
+
+ if (rb_obj_is_kind_of(val, rb_cDLCPtr)) {
+ TypedData_Get_Struct(val, struct ptr_data, &dlptr_data_type, data);
+ ptr = data->ptr;
+ }
+ else if (val == Qnil) {
+ ptr = NULL;
+ }
+ else{
+ rb_raise(rb_eTypeError, "DL::PtrData was expected");
+ }
+
+ return ptr;
+}
+
+static VALUE
+rb_dlptr_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct ptr_data *data;
+
+ obj = TypedData_Make_Struct(klass, struct ptr_data, &dlptr_data_type, data);
+ data->ptr = 0;
+ data->size = 0;
+ data->free = 0;
+
+ return obj;
+}
+
+/*
+ * call-seq:
+ * DL::CPtr.new(address) => dl_cptr
+ * DL::CPtr.new(address, size) => dl_cptr
+ * DL::CPtr.new(address, size, freefunc) => dl_cptr
+ *
+ * Create a new pointer to +address+ with an optional +size+ and +freefunc+.
+ * +freefunc+ will be called when the instance is garbage collected.
+ */
+static VALUE
+rb_dlptr_initialize(int argc, VALUE argv[], VALUE self)
+{
+ VALUE ptr, sym, size, wrap = 0, funcwrap = 0;
+ struct ptr_data *data;
+ void *p = NULL;
+ freefunc_t f = NULL;
+ long s = 0;
+
+ if (rb_scan_args(argc, argv, "12", &ptr, &size, &sym) >= 1) {
+ VALUE addrnum = rb_Integer(ptr);
+ if (addrnum != ptr) wrap = ptr;
+ p = NUM2PTR(addrnum);
+ }
+ if (argc >= 2) {
+ s = NUM2LONG(size);
+ }
+ if (argc >= 3) {
+ f = get_freefunc(sym, &funcwrap);
+ }
+
+ if (p) {
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ if (data->ptr && data->free) {
+ /* Free previous memory. Use of inappropriate initialize may cause SEGV. */
+ (*(data->free))(data->ptr);
+ }
+ data->wrap[0] = wrap;
+ data->wrap[1] = funcwrap;
+ data->ptr = p;
+ data->size = s;
+ data->free = f;
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ *
+ * DL::CPtr.malloc(size, freefunc = nil) => dl cptr instance
+ *
+ * Allocate +size+ bytes of memory and associate it with an optional
+ * +freefunc+ that will be called when the pointer is garbage collected.
+ * +freefunc+ must be an address pointing to a function or an instance of
+ * DL::CFunc
+ */
+static VALUE
+rb_dlptr_s_malloc(int argc, VALUE argv[], VALUE klass)
+{
+ VALUE size, sym, obj, wrap = 0;
+ long s;
+ freefunc_t f;
+
+ switch (rb_scan_args(argc, argv, "11", &size, &sym)) {
+ case 1:
+ s = NUM2LONG(size);
+ f = NULL;
+ break;
+ case 2:
+ s = NUM2LONG(size);
+ f = get_freefunc(sym, &wrap);
+ break;
+ default:
+ rb_bug("rb_dlptr_s_malloc");
+ }
+
+ obj = rb_dlptr_malloc(s,f);
+ if (wrap) RPTR_DATA(obj)->wrap[1] = wrap;
+
+ return obj;
+}
+
+/*
+ * call-seq: to_i
+ *
+ * Returns the integer memory location of this DL::CPtr.
+ */
+static VALUE
+rb_dlptr_to_i(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ return PTR2NUM(data->ptr);
+}
+
+/*
+ * call-seq: to_value
+ *
+ * Cast this CPtr to a ruby object.
+ */
+static VALUE
+rb_dlptr_to_value(VALUE self)
+{
+ struct ptr_data *data;
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ return (VALUE)(data->ptr);
+}
+
+/*
+ * call-seq: ptr
+ *
+ * Returns a DL::CPtr that is a dereferenced pointer for this DL::CPtr.
+ * Analogous to the star operator in C.
+ */
+VALUE
+rb_dlptr_ptr(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ return rb_dlptr_new(*((void**)(data->ptr)),0,0);
+}
+
+/*
+ * call-seq: ref
+ *
+ * Returns a DL::CPtr that is a reference pointer for this DL::CPtr.
+ * Analogous to the ampersand operator in C.
+ */
+VALUE
+rb_dlptr_ref(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ return rb_dlptr_new(&(data->ptr),0,0);
+}
+
+/*
+ * call-seq: null?
+ *
+ * Returns true if this is a null pointer.
+ */
+VALUE
+rb_dlptr_null_p(VALUE self)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ return data->ptr ? Qfalse : Qtrue;
+}
+
+/*
+ * call-seq: free=(function)
+ *
+ * Set the free function for this pointer to the DL::CFunc in +function+.
+ */
+static VALUE
+rb_dlptr_free_set(VALUE self, VALUE val)
+{
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ data->free = get_freefunc(val, &data->wrap[1]);
+
+ return Qnil;
+}
+
+/*
+ * call-seq: free
+ *
+ * Get the free function for this pointer. Returns DL::CFunc or nil.
+ */
+static VALUE
+rb_dlptr_free_get(VALUE self)
+{
+ struct ptr_data *pdata;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, pdata);
+
+ return rb_dlcfunc_new(pdata->free, DLTYPE_VOID, "free<anonymous>", CFUNC_CDECL);
+}
+
+/*
+ * call-seq:
+ *
+ * ptr.to_s => string
+ * ptr.to_s(len) => string
+ *
+ * Returns the pointer contents as a string. When called with no arguments,
+ * this method will return the contents until the first NULL byte. When
+ * called with +len+, a string of +len+ bytes will be returned.
+ */
+static VALUE
+rb_dlptr_to_s(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ VALUE arg1, val;
+ int len;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ switch (rb_scan_args(argc, argv, "01", &arg1)) {
+ case 0:
+ val = rb_tainted_str_new2((char*)(data->ptr));
+ break;
+ case 1:
+ len = NUM2INT(arg1);
+ val = rb_tainted_str_new((char*)(data->ptr), len);
+ break;
+ default:
+ rb_bug("rb_dlptr_to_s");
+ }
+
+ return val;
+}
+
+/*
+ * call-seq:
+ *
+ * ptr.to_str => string
+ * ptr.to_str(len) => string
+ *
+ * Returns the pointer contents as a string. When called with no arguments,
+ * this method will return the contents with the length of this pointer's
+ * +size+. When called with +len+, a string of +len+ bytes will be returned.
+ */
+static VALUE
+rb_dlptr_to_str(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ VALUE arg1, val;
+ int len;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ switch (rb_scan_args(argc, argv, "01", &arg1)) {
+ case 0:
+ val = rb_tainted_str_new((char*)(data->ptr),data->size);
+ break;
+ case 1:
+ len = NUM2INT(arg1);
+ val = rb_tainted_str_new((char*)(data->ptr), len);
+ break;
+ default:
+ rb_bug("rb_dlptr_to_str");
+ }
+
+ return val;
+}
+
+/*
+ * call-seq: inspect
+ *
+ * Returns a string formatted with an easily readable representation of the
+ * internal state of the DL::CPtr
+ */
+static VALUE
+rb_dlptr_inspect(VALUE self)
+{
+ struct ptr_data *data;
+ char str[1024];
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ snprintf(str, 1023, "#<%s:%p ptr=%p size=%ld free=%p>",
+ rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
+ return rb_str_new2(str);
+}
+
+/*
+ * call-seq:
+ * ptr == other => true or false
+ * ptr.eql?(other) => true or false
+ *
+ * Returns true if +other+ wraps the same pointer, otherwise returns
+ * false.
+ */
+VALUE
+rb_dlptr_eql(VALUE self, VALUE other)
+{
+ void *ptr1, *ptr2;
+
+ if(!rb_obj_is_kind_of(other, rb_cDLCPtr)) return Qfalse;
+
+ ptr1 = rb_dlptr2cptr(self);
+ ptr2 = rb_dlptr2cptr(other);
+
+ return ptr1 == ptr2 ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * ptr <=> other => -1, 0, 1, or nil
+ *
+ * Returns -1 if less than, 0 if equal to, 1 if greater than +other+. Returns
+ * nil if +ptr+ cannot be compared to +other+.
+ */
+static VALUE
+rb_dlptr_cmp(VALUE self, VALUE other)
+{
+ void *ptr1, *ptr2;
+ SIGNED_VALUE diff;
+
+ if(!rb_obj_is_kind_of(other, rb_cDLCPtr)) return Qnil;
+
+ ptr1 = rb_dlptr2cptr(self);
+ ptr2 = rb_dlptr2cptr(other);
+ diff = (SIGNED_VALUE)ptr1 - (SIGNED_VALUE)ptr2;
+ if (!diff) return INT2FIX(0);
+ return diff > 0 ? INT2NUM(1) : INT2NUM(-1);
+}
+
+/*
+ * call-seq:
+ * ptr + n => new cptr
+ *
+ * Returns a new DL::CPtr that has been advanced +n+ bytes.
+ */
+static VALUE
+rb_dlptr_plus(VALUE self, VALUE other)
+{
+ void *ptr;
+ long num, size;
+
+ ptr = rb_dlptr2cptr(self);
+ size = RPTR_DATA(self)->size;
+ num = NUM2LONG(other);
+ return rb_dlptr_new((char *)ptr + num, size - num, 0);
+}
+
+/*
+ * call-seq:
+ * ptr - n => new cptr
+ *
+ * Returns a new DL::CPtr that has been moved back +n+ bytes.
+ */
+static VALUE
+rb_dlptr_minus(VALUE self, VALUE other)
+{
+ void *ptr;
+ long num, size;
+
+ ptr = rb_dlptr2cptr(self);
+ size = RPTR_DATA(self)->size;
+ num = NUM2LONG(other);
+ return rb_dlptr_new((char *)ptr - num, size + num, 0);
+}
+
+/*
+ * call-seq:
+ * ptr[index] -> an_integer
+ * ptr[start, length] -> a_string
+ *
+ * Returns integer stored at _index_. If _start_ and _length_ are given,
+ * a string containing the bytes from _start_ of length _length_ will be
+ * returned.
+ */
+VALUE
+rb_dlptr_aref(int argc, VALUE argv[], VALUE self)
+{
+ VALUE arg0, arg1;
+ VALUE retval = Qnil;
+ size_t offset, len;
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ if (!data->ptr) rb_raise(rb_eDLError, "NULL pointer dereference");
+ switch( rb_scan_args(argc, argv, "11", &arg0, &arg1) ){
+ case 1:
+ offset = NUM2ULONG(arg0);
+ retval = INT2NUM(*((char *)data->ptr + offset));
+ break;
+ case 2:
+ offset = NUM2ULONG(arg0);
+ len = NUM2ULONG(arg1);
+ retval = rb_tainted_str_new((char *)data->ptr + offset, len);
+ break;
+ default:
+ rb_bug("rb_dlptr_aref()");
+ }
+ return retval;
+}
+
+/*
+ * call-seq:
+ * ptr[index] = int -> int
+ * ptr[start, length] = string or cptr or addr -> string or dl_cptr or addr
+ *
+ * Set the value at +index+ to +int+. Or, set the memory at +start+ until
+ * +length+ with the contents of +string+, the memory from +dl_cptr+, or the
+ * memory pointed at by the memory address +addr+.
+ */
+VALUE
+rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
+{
+ VALUE arg0, arg1, arg2;
+ VALUE retval = Qnil;
+ size_t offset, len;
+ void *mem;
+ struct ptr_data *data;
+
+ TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
+ if (!data->ptr) rb_raise(rb_eDLError, "NULL pointer dereference");
+ switch( rb_scan_args(argc, argv, "21", &arg0, &arg1, &arg2) ){
+ case 2:
+ offset = NUM2ULONG(arg0);
+ ((char*)data->ptr)[offset] = NUM2UINT(arg1);
+ retval = arg1;
+ break;
+ case 3:
+ offset = NUM2ULONG(arg0);
+ len = NUM2ULONG(arg1);
+ if (RB_TYPE_P(arg2, T_STRING)) {
+ mem = StringValuePtr(arg2);
+ }
+ else if( rb_obj_is_kind_of(arg2, rb_cDLCPtr) ){
+ mem = rb_dlptr2cptr(arg2);
+ }
+ else{
+ mem = NUM2PTR(arg2);
+ }
+ memcpy((char *)data->ptr + offset, mem, len);
+ retval = arg2;
+ break;
+ default:
+ rb_bug("rb_dlptr_aset()");
+ }
+ return retval;
+}
+
+/*
+ * call-seq: size=(size)
+ *
+ * Set the size of this pointer to +size+
+ */
+static VALUE
+rb_dlptr_size_set(VALUE self, VALUE size)
+{
+ RPTR_DATA(self)->size = NUM2LONG(size);
+ return size;
+}
+
+/*
+ * call-seq: size
+ *
+ * Get the size of this pointer.
+ */
+static VALUE
+rb_dlptr_size_get(VALUE self)
+{
+ return LONG2NUM(RPTR_DATA(self)->size);
+}
+
+/*
+ * call-seq:
+ * DL::CPtr.to_ptr(val) => cptr
+ * DL::CPtr[val] => cptr
+ *
+ * Get the underlying pointer for ruby object +val+ and return it as a
+ * DL::CPtr object.
+ */
+static VALUE
+rb_dlptr_s_to_ptr(VALUE self, VALUE val)
+{
+ VALUE ptr, wrap = val, vptr;
+
+ if (RTEST(rb_obj_is_kind_of(val, rb_cIO))){
+ rb_io_t *fptr;
+ FILE *fp;
+ GetOpenFile(val, fptr);
+ fp = rb_io_stdio_file(fptr);
+ ptr = rb_dlptr_new(fp, 0, NULL);
+ }
+ else if (RTEST(rb_obj_is_kind_of(val, rb_cString))){
+ char *str = StringValuePtr(val);
+ ptr = rb_dlptr_new(str, RSTRING_LEN(val), NULL);
+ }
+ else if ((vptr = rb_check_funcall(val, id_to_ptr, 0, 0)) != Qundef){
+ if (rb_obj_is_kind_of(vptr, rb_cDLCPtr)){
+ ptr = vptr;
+ wrap = 0;
+ }
+ else{
+ rb_raise(rb_eDLError, "to_ptr should return a CPtr object");
+ }
+ }
+ else{
+ VALUE num = rb_Integer(val);
+ if (num == val) wrap = 0;
+ ptr = rb_dlptr_new(NUM2PTR(num), 0, NULL);
+ }
+ OBJ_INFECT(ptr, val);
+ if (wrap) RPTR_DATA(ptr)->wrap[0] = wrap;
+ return ptr;
+}
+
+void
+Init_dlptr(void)
+{
+ id_to_ptr = rb_intern("to_ptr");
+
+ /* Document-class: DL::CPtr
+ *
+ * CPtr is a class to handle C pointers
+ *
+ */
+ rb_cDLCPtr = rb_define_class_under(rb_mDL, "CPtr", rb_cObject);
+ rb_define_alloc_func(rb_cDLCPtr, rb_dlptr_s_allocate);
+ rb_define_singleton_method(rb_cDLCPtr, "malloc", rb_dlptr_s_malloc, -1);
+ rb_define_singleton_method(rb_cDLCPtr, "to_ptr", rb_dlptr_s_to_ptr, 1);
+ rb_define_singleton_method(rb_cDLCPtr, "[]", rb_dlptr_s_to_ptr, 1);
+ rb_define_method(rb_cDLCPtr, "initialize", rb_dlptr_initialize, -1);
+ rb_define_method(rb_cDLCPtr, "free=", rb_dlptr_free_set, 1);
+ rb_define_method(rb_cDLCPtr, "free", rb_dlptr_free_get, 0);
+ rb_define_method(rb_cDLCPtr, "to_i", rb_dlptr_to_i, 0);
+ rb_define_method(rb_cDLCPtr, "to_int", rb_dlptr_to_i, 0);
+ rb_define_method(rb_cDLCPtr, "to_value", rb_dlptr_to_value, 0);
+ rb_define_method(rb_cDLCPtr, "ptr", rb_dlptr_ptr, 0);
+ rb_define_method(rb_cDLCPtr, "+@", rb_dlptr_ptr, 0);
+ rb_define_method(rb_cDLCPtr, "ref", rb_dlptr_ref, 0);
+ rb_define_method(rb_cDLCPtr, "-@", rb_dlptr_ref, 0);
+ rb_define_method(rb_cDLCPtr, "null?", rb_dlptr_null_p, 0);
+ rb_define_method(rb_cDLCPtr, "to_s", rb_dlptr_to_s, -1);
+ rb_define_method(rb_cDLCPtr, "to_str", rb_dlptr_to_str, -1);
+ rb_define_method(rb_cDLCPtr, "inspect", rb_dlptr_inspect, 0);
+ rb_define_method(rb_cDLCPtr, "<=>", rb_dlptr_cmp, 1);
+ rb_define_method(rb_cDLCPtr, "==", rb_dlptr_eql, 1);
+ rb_define_method(rb_cDLCPtr, "eql?", rb_dlptr_eql, 1);
+ rb_define_method(rb_cDLCPtr, "+", rb_dlptr_plus, 1);
+ rb_define_method(rb_cDLCPtr, "-", rb_dlptr_minus, 1);
+ rb_define_method(rb_cDLCPtr, "[]", rb_dlptr_aref, -1);
+ rb_define_method(rb_cDLCPtr, "[]=", rb_dlptr_aset, -1);
+ rb_define_method(rb_cDLCPtr, "size", rb_dlptr_size_get, 0);
+ rb_define_method(rb_cDLCPtr, "size=", rb_dlptr_size_set, 1);
+
+ /* Document-const: NULL
+ *
+ * A NULL pointer
+ */
+ rb_define_const(rb_mDL, "NULL", rb_dlptr_new(0, 0, 0));
+}
diff --git a/ext/dl/depend b/ext/dl/depend
new file mode 100644
index 0000000000..d0a3ab8ef0
--- /dev/null
+++ b/ext/dl/depend
@@ -0,0 +1,14 @@
+cfunc.o: cfunc.c dl.h $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/util.h
+
+cptr.o: cptr.c dl.h $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
+
+handle.o: handle.c dl.h $(HDRS) $(ruby_headers)
+
+dl.o: dl.c dl.h $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
new file mode 100644
index 0000000000..23f5d7fe6e
--- /dev/null
+++ b/ext/dl/dl.c
@@ -0,0 +1,569 @@
+/*
+ * ext/dl/dl.c
+ *
+ * documentation:
+ * - Vincent Batts (vbatts@hashbangbash.com)
+ *
+ */
+#include <ruby/ruby.h>
+#include <ruby/io.h>
+#include <ctype.h>
+#include "dl.h"
+
+VALUE rb_mDL;
+VALUE rb_eDLError;
+VALUE rb_eDLTypeError;
+
+ID rbdl_id_cdecl;
+ID rbdl_id_stdcall;
+
+#ifndef DLTYPE_SSIZE_T
+# if SIZEOF_SIZE_T == SIZEOF_INT
+# define DLTYPE_SSIZE_T DLTYPE_INT
+# elif SIZEOF_SIZE_T == SIZEOF_LONG
+# define DLTYPE_SSIZE_T DLTYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
+# define DLTYPE_SSIZE_T DLTYPE_LONG_LONG
+# endif
+#endif
+#define DLTYPE_SIZE_T (-1*SIGNEDNESS_OF_SIZE_T*DLTYPE_SSIZE_T)
+
+#ifndef DLTYPE_PTRDIFF_T
+# if SIZEOF_PTRDIFF_T == SIZEOF_INT
+# define DLTYPE_PTRDIFF_T DLTYPE_INT
+# elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
+# define DLTYPE_PTRDIFF_T DLTYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
+# define DLTYPE_PTRDIFF_T DLTYPE_LONG_LONG
+# endif
+#endif
+
+#ifndef DLTYPE_INTPTR_T
+# if SIZEOF_INTPTR_T == SIZEOF_INT
+# define DLTYPE_INTPTR_T DLTYPE_INT
+# elif SIZEOF_INTPTR_T == SIZEOF_LONG
+# define DLTYPE_INTPTR_T DLTYPE_LONG
+# elif defined HAVE_LONG_LONG && SIZEOF_INTPTR_T == SIZEOF_LONG_LONG
+# define DLTYPE_INTPTR_T DLTYPE_LONG_LONG
+# endif
+#endif
+#define DLTYPE_UINTPTR_T (-DLTYPE_INTPTR_T)
+
+/*
+ * call-seq: DL.dlopen(so_lib)
+ *
+ * An interface to the dynamic linking loader
+ *
+ * This is a shortcut to DL::Handle.new and takes the same arguments.
+ *
+ * Example:
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ *
+ * libc = DL.dlopen(libc_so)
+ * => #<DL::Handle:0x00000000e05b00>
+ */
+VALUE
+rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
+{
+ return rb_class_new_instance(argc, argv, rb_cDLHandle);
+}
+
+/*
+ * call-seq: DL.malloc(size)
+ *
+ * Allocate +size+ bytes of memory and return the integer memory address
+ * for the allocated memory.
+ */
+VALUE
+rb_dl_malloc(VALUE self, VALUE size)
+{
+ void *ptr;
+
+ ptr = (void*)ruby_xmalloc(NUM2INT(size));
+ return PTR2NUM(ptr);
+}
+
+/*
+ * call-seq: DL.realloc(addr, size)
+ *
+ * Change the size of the memory allocated at the memory location +addr+ to
+ * +size+ bytes. Returns the memory address of the reallocated memory, which
+ * may be different than the address passed in.
+ */
+VALUE
+rb_dl_realloc(VALUE self, VALUE addr, VALUE size)
+{
+ void *ptr = NUM2PTR(addr);
+
+ ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
+ return PTR2NUM(ptr);
+}
+
+/*
+ * call-seq: DL.free(addr)
+ *
+ * Free the memory at address +addr+
+ */
+VALUE
+rb_dl_free(VALUE self, VALUE addr)
+{
+ void *ptr = NUM2PTR(addr);
+
+ ruby_xfree(ptr);
+ return Qnil;
+}
+
+/*
+ * call-seq: DL.dlunwrap(addr)
+ *
+ * Returns the hexadecimal representation of a memory pointer address +addr+
+ *
+ * Example:
+ *
+ * lib = DL.dlopen('/lib64/libc-2.15.so')
+ * => #<DL::Handle:0x00000001342460>
+ *
+ * lib['strcpy'].to_s(16)
+ * => "7f59de6dd240"
+ *
+ * DL.dlunwrap(DL.dlwrap(lib['strcpy'].to_s(16)))
+ * => "7f59de6dd240"
+ */
+VALUE
+rb_dl_ptr2value(VALUE self, VALUE addr)
+{
+ return (VALUE)NUM2PTR(addr);
+}
+
+/*
+ * call-seq: DL.dlwrap(val)
+ *
+ * Returns a memory pointer of a function's hexadecimal address location +val+
+ *
+ * Example:
+ *
+ * lib = DL.dlopen('/lib64/libc-2.15.so')
+ * => #<DL::Handle:0x00000001342460>
+ *
+ * DL.dlwrap(lib['strcpy'].to_s(16))
+ * => 25522520
+ */
+VALUE
+rb_dl_value2ptr(VALUE self, VALUE val)
+{
+ return PTR2NUM((void*)val);
+}
+
+static void
+rb_dl_init_callbacks(VALUE dl)
+{
+ static const char cb[] = "dl/callback.so";
+
+ rb_autoload(dl, rb_intern_const("CdeclCallbackAddrs"), cb);
+ rb_autoload(dl, rb_intern_const("CdeclCallbackProcs"), cb);
+#ifdef FUNC_STDCALL
+ rb_autoload(dl, rb_intern_const("StdcallCallbackAddrs"), cb);
+ rb_autoload(dl, rb_intern_const("StdcallCallbackProcs"), cb);
+#endif
+}
+
+void
+Init_dl(void)
+{
+ void Init_dlhandle(void);
+ void Init_dlcfunc(void);
+ void Init_dlptr(void);
+
+ rbdl_id_cdecl = rb_intern_const("cdecl");
+ rbdl_id_stdcall = rb_intern_const("stdcall");
+
+ /* Document-module: DL
+ *
+ * A bridge to the dlopen() or dynamic library linker function.
+ *
+ * == Example
+ *
+ * bash $> cat > sum.c <<EOF
+ * double sum(double *arry, int len)
+ * {
+ * double ret = 0;
+ * int i;
+ * for(i = 0; i < len; i++){
+ * ret = ret + arry[i];
+ * }
+ * return ret;
+ * }
+ *
+ * double split(double num)
+ * {
+ * double ret = 0;
+ * ret = num / 2;
+ * return ret;
+ * }
+ * EOF
+ * bash $> gcc -o libsum.so -shared sum.c
+ * bash $> cat > sum.rb <<EOF
+ * require 'dl'
+ * require 'dl/import'
+ *
+ * module LibSum
+ * extend DL::Importer
+ * dlload './libsum.so'
+ * extern 'double sum(double*, int)'
+ * extern 'double split(double)'
+ * end
+ *
+ * a = [2.0, 3.0, 4.0]
+ *
+ * sum = LibSum.sum(a.pack("d*"), a.count)
+ * p LibSum.split(sum)
+ * EOF
+ * bash $> ruby sum.rb
+ * 4.5
+ *
+ * WIN! :-)
+ */
+ rb_mDL = rb_define_module("DL");
+
+ /*
+ * Document-class: DL::DLError
+ *
+ * standard dynamic load exception
+ */
+ rb_eDLError = rb_define_class_under(rb_mDL, "DLError", rb_eStandardError);
+
+ /*
+ * Document-class: DL::DLTypeError
+ *
+ * dynamic load incorrect type exception
+ */
+ rb_eDLTypeError = rb_define_class_under(rb_mDL, "DLTypeError", rb_eDLError);
+
+ /* Document-const: MAX_CALLBACK
+ *
+ * Maximum number of callbacks
+ */
+ rb_define_const(rb_mDL, "MAX_CALLBACK", INT2NUM(MAX_CALLBACK));
+
+ /* Document-const: DLSTACK_SIZE
+ *
+ * Dynamic linker stack size
+ */
+ rb_define_const(rb_mDL, "DLSTACK_SIZE", INT2NUM(DLSTACK_SIZE));
+
+ rb_dl_init_callbacks(rb_mDL);
+
+ /* Document-const: RTLD_GLOBAL
+ *
+ * rtld DL::Handle flag.
+ *
+ * The symbols defined by this library will be made available for symbol
+ * resolution of subsequently loaded libraries.
+ */
+ rb_define_const(rb_mDL, "RTLD_GLOBAL", INT2NUM(RTLD_GLOBAL));
+
+ /* Document-const: RTLD_LAZY
+ *
+ * rtld DL::Handle flag.
+ *
+ * Perform lazy binding. Only resolve symbols as the code that references
+ * them is executed. If the symbol is never referenced, then it is never
+ * resolved. (Lazy binding is only performed for function references;
+ * references to variables are always immediately bound when the library
+ * is loaded.)
+ */
+ rb_define_const(rb_mDL, "RTLD_LAZY", INT2NUM(RTLD_LAZY));
+
+ /* Document-const: RTLD_NOW
+ *
+ * rtld DL::Handle flag.
+ *
+ * If this value is specified or the environment variable LD_BIND_NOW is
+ * set to a nonempty string, all undefined symbols in the library are
+ * resolved before dlopen() returns. If this cannot be done an error is
+ * returned.
+ */
+ rb_define_const(rb_mDL, "RTLD_NOW", INT2NUM(RTLD_NOW));
+
+ /* Document-const: TYPE_VOID
+ *
+ * DL::CFunc type - void
+ */
+ rb_define_const(rb_mDL, "TYPE_VOID", INT2NUM(DLTYPE_VOID));
+
+ /* Document-const: TYPE_VOIDP
+ *
+ * DL::CFunc type - void*
+ */
+ rb_define_const(rb_mDL, "TYPE_VOIDP", INT2NUM(DLTYPE_VOIDP));
+
+ /* Document-const: TYPE_CHAR
+ *
+ * DL::CFunc type - char
+ */
+ rb_define_const(rb_mDL, "TYPE_CHAR", INT2NUM(DLTYPE_CHAR));
+
+ /* Document-const: TYPE_SHORT
+ *
+ * DL::CFunc type - short
+ */
+ rb_define_const(rb_mDL, "TYPE_SHORT", INT2NUM(DLTYPE_SHORT));
+
+ /* Document-const: TYPE_INT
+ *
+ * DL::CFunc type - int
+ */
+ rb_define_const(rb_mDL, "TYPE_INT", INT2NUM(DLTYPE_INT));
+
+ /* Document-const: TYPE_LONG
+ *
+ * DL::CFunc type - long
+ */
+ rb_define_const(rb_mDL, "TYPE_LONG", INT2NUM(DLTYPE_LONG));
+
+#if HAVE_LONG_LONG
+ /* Document-const: TYPE_LONG_LONG
+ *
+ * DL::CFunc type - long long
+ */
+ rb_define_const(rb_mDL, "TYPE_LONG_LONG", INT2NUM(DLTYPE_LONG_LONG));
+#endif
+
+ /* Document-const: TYPE_FLOAT
+ *
+ * DL::CFunc type - float
+ */
+ rb_define_const(rb_mDL, "TYPE_FLOAT", INT2NUM(DLTYPE_FLOAT));
+
+ /* Document-const: TYPE_DOUBLE
+ *
+ * DL::CFunc type - double
+ */
+ rb_define_const(rb_mDL, "TYPE_DOUBLE", INT2NUM(DLTYPE_DOUBLE));
+
+ /* Document-const: TYPE_SIZE_T
+ *
+ * DL::CFunc type - size_t
+ */
+ rb_define_const(rb_mDL, "TYPE_SIZE_T", INT2NUM(DLTYPE_SIZE_T));
+
+ /* Document-const: TYPE_SSIZE_T
+ *
+ * DL::CFunc type - ssize_t
+ */
+ rb_define_const(rb_mDL, "TYPE_SSIZE_T", INT2NUM(DLTYPE_SSIZE_T));
+
+ /* Document-const: TYPE_PTRDIFF_T
+ *
+ * DL::CFunc type - ptrdiff_t
+ */
+ rb_define_const(rb_mDL, "TYPE_PTRDIFF_T", INT2NUM(DLTYPE_PTRDIFF_T));
+
+ /* Document-const: TYPE_INTPTR_T
+ *
+ * DL::CFunc type - intptr_t
+ */
+ rb_define_const(rb_mDL, "TYPE_INTPTR_T", INT2NUM(DLTYPE_INTPTR_T));
+
+ /* Document-const: TYPE_UINTPTR_T
+ *
+ * DL::CFunc type - uintptr_t
+ */
+ rb_define_const(rb_mDL, "TYPE_UINTPTR_T", INT2NUM(DLTYPE_UINTPTR_T));
+
+ /* Document-const: ALIGN_VOIDP
+ *
+ * The alignment size of a void*
+ */
+ rb_define_const(rb_mDL, "ALIGN_VOIDP", INT2NUM(ALIGN_VOIDP));
+
+ /* Document-const: ALIGN_CHAR
+ *
+ * The alignment size of a char
+ */
+ rb_define_const(rb_mDL, "ALIGN_CHAR", INT2NUM(ALIGN_CHAR));
+
+ /* Document-const: ALIGN_SHORT
+ *
+ * The alignment size of a short
+ */
+ rb_define_const(rb_mDL, "ALIGN_SHORT", INT2NUM(ALIGN_SHORT));
+
+ /* Document-const: ALIGN_INT
+ *
+ * The alignment size of an int
+ */
+ rb_define_const(rb_mDL, "ALIGN_INT", INT2NUM(ALIGN_INT));
+
+ /* Document-const: ALIGN_LONG
+ *
+ * The alignment size of a long
+ */
+ rb_define_const(rb_mDL, "ALIGN_LONG", INT2NUM(ALIGN_LONG));
+
+#if HAVE_LONG_LONG
+ /* Document-const: ALIGN_LONG_LONG
+ *
+ * The alignment size of a long long
+ */
+ rb_define_const(rb_mDL, "ALIGN_LONG_LONG", INT2NUM(ALIGN_LONG_LONG));
+#endif
+
+ /* Document-const: ALIGN_FLOAT
+ *
+ * The alignment size of a float
+ */
+ rb_define_const(rb_mDL, "ALIGN_FLOAT", INT2NUM(ALIGN_FLOAT));
+
+ /* Document-const: ALIGN_DOUBLE
+ *
+ * The alignment size of a double
+ */
+ rb_define_const(rb_mDL, "ALIGN_DOUBLE",INT2NUM(ALIGN_DOUBLE));
+
+ /* Document-const: ALIGN_SIZE_T
+ *
+ * The alignment size of a size_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_SIZE_T", INT2NUM(ALIGN_OF(size_t)));
+
+ /* Document-const: ALIGN_SSIZE_T
+ *
+ * The alignment size of a ssize_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_SSIZE_T", INT2NUM(ALIGN_OF(size_t))); /* same as size_t */
+
+ /* Document-const: ALIGN_PTRDIFF_T
+ *
+ * The alignment size of a ptrdiff_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_PTRDIFF_T", INT2NUM(ALIGN_OF(ptrdiff_t)));
+
+ /* Document-const: ALIGN_INTPTR_T
+ *
+ * The alignment size of a intptr_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_INTPTR_T", INT2NUM(ALIGN_OF(intptr_t)));
+
+ /* Document-const: ALIGN_UINTPTR_T
+ *
+ * The alignment size of a uintptr_t
+ */
+ rb_define_const(rb_mDL, "ALIGN_UINTPTR_T", INT2NUM(ALIGN_OF(uintptr_t)));
+
+ /* Document-const: SIZEOF_VOIDP
+ *
+ * size of a void*
+ */
+ rb_define_const(rb_mDL, "SIZEOF_VOIDP", INT2NUM(sizeof(void*)));
+
+ /* Document-const: SIZEOF_CHAR
+ *
+ * size of a char
+ */
+ rb_define_const(rb_mDL, "SIZEOF_CHAR", INT2NUM(sizeof(char)));
+
+ /* Document-const: SIZEOF_SHORT
+ *
+ * size of a short
+ */
+ rb_define_const(rb_mDL, "SIZEOF_SHORT", INT2NUM(sizeof(short)));
+
+ /* Document-const: SIZEOF_INT
+ *
+ * size of an int
+ */
+ rb_define_const(rb_mDL, "SIZEOF_INT", INT2NUM(sizeof(int)));
+
+ /* Document-const: SIZEOF_LONG
+ *
+ * size of a long
+ */
+ rb_define_const(rb_mDL, "SIZEOF_LONG", INT2NUM(sizeof(long)));
+
+#if HAVE_LONG_LONG
+ /* Document-const: SIZEOF_LONG_LONG
+ *
+ * size of a long long
+ */
+ rb_define_const(rb_mDL, "SIZEOF_LONG_LONG", INT2NUM(sizeof(LONG_LONG)));
+#endif
+
+ /* Document-const: SIZEOF_FLOAT
+ *
+ * size of a float
+ */
+ rb_define_const(rb_mDL, "SIZEOF_FLOAT", INT2NUM(sizeof(float)));
+
+ /* Document-const: SIZEOF_DOUBLE
+ *
+ * size of a double
+ */
+ rb_define_const(rb_mDL, "SIZEOF_DOUBLE",INT2NUM(sizeof(double)));
+
+ /* Document-const: SIZEOF_SIZE_T
+ *
+ * size of a size_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_SIZE_T", INT2NUM(sizeof(size_t)));
+
+ /* Document-const: SIZEOF_SSIZE_T
+ *
+ * size of a ssize_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_SSIZE_T", INT2NUM(sizeof(size_t))); /* same as size_t */
+
+ /* Document-const: SIZEOF_PTRDIFF_T
+ *
+ * size of a ptrdiff_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_PTRDIFF_T", INT2NUM(sizeof(ptrdiff_t)));
+
+ /* Document-const: SIZEOF_INTPTR_T
+ *
+ * size of a intptr_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_INTPTR_T", INT2NUM(sizeof(intptr_t)));
+
+ /* Document-const: SIZEOF_UINTPTR_T
+ *
+ * size of a uintptr_t
+ */
+ rb_define_const(rb_mDL, "SIZEOF_UINTPTR_T", INT2NUM(sizeof(uintptr_t)));
+
+ rb_define_module_function(rb_mDL, "dlwrap", rb_dl_value2ptr, 1);
+ rb_define_module_function(rb_mDL, "dlunwrap", rb_dl_ptr2value, 1);
+
+ rb_define_module_function(rb_mDL, "dlopen", rb_dl_dlopen, -1);
+ rb_define_module_function(rb_mDL, "malloc", rb_dl_malloc, 1);
+ rb_define_module_function(rb_mDL, "realloc", rb_dl_realloc, 2);
+ rb_define_module_function(rb_mDL, "free", rb_dl_free, 1);
+
+ /* Document-const: RUBY_FREE
+ *
+ * Address of the ruby_xfree() function
+ */
+ rb_define_const(rb_mDL, "RUBY_FREE", PTR2NUM(ruby_xfree));
+
+ /* Document-const: BUILD_RUBY_PLATFORM
+ *
+ * Platform built against (i.e. "x86_64-linux", etc.)
+ *
+ * See also RUBY_PLATFORM
+ */
+ rb_define_const(rb_mDL, "BUILD_RUBY_PLATFORM", rb_str_new2(RUBY_PLATFORM));
+
+ /* Document-const: BUILD_RUBY_VERSION
+ *
+ * Ruby Version built. (i.e. "1.9.3")
+ *
+ * See also RUBY_VERSION
+ */
+ rb_define_const(rb_mDL, "BUILD_RUBY_VERSION", rb_str_new2(RUBY_VERSION));
+
+ Init_dlhandle();
+ Init_dlcfunc();
+ Init_dlptr();
+}
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
new file mode 100644
index 0000000000..f8380a8471
--- /dev/null
+++ b/ext/dl/dl.h
@@ -0,0 +1,217 @@
+#ifndef RUBY_DL_H
+#define RUBY_DL_H
+
+#include <ruby.h>
+
+#if !defined(FUNC_CDECL)
+# define FUNC_CDECL(x) x
+#endif
+
+#if defined(HAVE_DLFCN_H)
+# include <dlfcn.h>
+# /* some stranger systems may not define all of these */
+#ifndef RTLD_LAZY
+#define RTLD_LAZY 0
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#else
+# if defined(_WIN32)
+# include <windows.h>
+# define dlopen(name,flag) ((void)(flag),(void*)LoadLibrary(name))
+# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
+# define dlsym(handle,name) ((void*)GetProcAddress((handle),(name)))
+# define RTLD_LAZY -1
+# define RTLD_NOW -1
+# define RTLD_GLOBAL -1
+# endif
+#endif
+
+#define MAX_CALLBACK 5
+#define DLSTACK_TYPE SIGNED_VALUE
+#define DLSTACK_SIZE (20)
+#define DLSTACK_PROTO \
+ DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,\
+ DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,\
+ DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,\
+ DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE,DLSTACK_TYPE
+#define DLSTACK_ARGS(stack) \
+ (stack)[0],(stack)[1],(stack)[2],(stack)[3],(stack)[4],\
+ (stack)[5],(stack)[6],(stack)[7],(stack)[8],(stack)[9],\
+ (stack)[10],(stack)[11],(stack)[12],(stack)[13],(stack)[14],\
+ (stack)[15],(stack)[16],(stack)[17],(stack)[18],(stack)[19]
+
+#define DLSTACK_PROTO0_ void
+#define DLSTACK_PROTO1_ DLSTACK_TYPE
+#define DLSTACK_PROTO2_ DLSTACK_PROTO1_, DLSTACK_TYPE
+#define DLSTACK_PROTO3_ DLSTACK_PROTO2_, DLSTACK_TYPE
+#define DLSTACK_PROTO4_ DLSTACK_PROTO3_, DLSTACK_TYPE
+#define DLSTACK_PROTO4_ DLSTACK_PROTO3_, DLSTACK_TYPE
+#define DLSTACK_PROTO5_ DLSTACK_PROTO4_, DLSTACK_TYPE
+#define DLSTACK_PROTO6_ DLSTACK_PROTO5_, DLSTACK_TYPE
+#define DLSTACK_PROTO7_ DLSTACK_PROTO6_, DLSTACK_TYPE
+#define DLSTACK_PROTO8_ DLSTACK_PROTO7_, DLSTACK_TYPE
+#define DLSTACK_PROTO9_ DLSTACK_PROTO8_, DLSTACK_TYPE
+#define DLSTACK_PROTO10_ DLSTACK_PROTO9_, DLSTACK_TYPE
+#define DLSTACK_PROTO11_ DLSTACK_PROTO10_, DLSTACK_TYPE
+#define DLSTACK_PROTO12_ DLSTACK_PROTO11_, DLSTACK_TYPE
+#define DLSTACK_PROTO13_ DLSTACK_PROTO12_, DLSTACK_TYPE
+#define DLSTACK_PROTO14_ DLSTACK_PROTO13_, DLSTACK_TYPE
+#define DLSTACK_PROTO14_ DLSTACK_PROTO13_, DLSTACK_TYPE
+#define DLSTACK_PROTO15_ DLSTACK_PROTO14_, DLSTACK_TYPE
+#define DLSTACK_PROTO16_ DLSTACK_PROTO15_, DLSTACK_TYPE
+#define DLSTACK_PROTO17_ DLSTACK_PROTO16_, DLSTACK_TYPE
+#define DLSTACK_PROTO18_ DLSTACK_PROTO17_, DLSTACK_TYPE
+#define DLSTACK_PROTO19_ DLSTACK_PROTO18_, DLSTACK_TYPE
+#define DLSTACK_PROTO20_ DLSTACK_PROTO19_, DLSTACK_TYPE
+
+/*
+ * Add ",..." as the last argument.
+ * This is required for variable argument functions such
+ * as fprintf() on x86_64-linux.
+ *
+ * http://refspecs.linuxfoundation.org/elf/x86_64-abi-0.95.pdf
+ * page 19:
+ *
+ * For calls that may call functions that use varargs or stdargs
+ * (prototype-less calls or calls to functions containing ellipsis
+ * (...) in the declaration) %al is used as hidden argument to
+ * specify the number of SSE registers used.
+ */
+#define DLSTACK_PROTO0 void
+#define DLSTACK_PROTO1 DLSTACK_PROTO1_, ...
+#define DLSTACK_PROTO2 DLSTACK_PROTO2_, ...
+#define DLSTACK_PROTO3 DLSTACK_PROTO3_, ...
+#define DLSTACK_PROTO4 DLSTACK_PROTO4_, ...
+#define DLSTACK_PROTO4 DLSTACK_PROTO4_, ...
+#define DLSTACK_PROTO5 DLSTACK_PROTO5_, ...
+#define DLSTACK_PROTO6 DLSTACK_PROTO6_, ...
+#define DLSTACK_PROTO7 DLSTACK_PROTO7_, ...
+#define DLSTACK_PROTO8 DLSTACK_PROTO8_, ...
+#define DLSTACK_PROTO9 DLSTACK_PROTO9_, ...
+#define DLSTACK_PROTO10 DLSTACK_PROTO10_, ...
+#define DLSTACK_PROTO11 DLSTACK_PROTO11_, ...
+#define DLSTACK_PROTO12 DLSTACK_PROTO12_, ...
+#define DLSTACK_PROTO13 DLSTACK_PROTO13_, ...
+#define DLSTACK_PROTO14 DLSTACK_PROTO14_, ...
+#define DLSTACK_PROTO14 DLSTACK_PROTO14_, ...
+#define DLSTACK_PROTO15 DLSTACK_PROTO15_, ...
+#define DLSTACK_PROTO16 DLSTACK_PROTO16_, ...
+#define DLSTACK_PROTO17 DLSTACK_PROTO17_, ...
+#define DLSTACK_PROTO18 DLSTACK_PROTO18_, ...
+#define DLSTACK_PROTO19 DLSTACK_PROTO19_, ...
+#define DLSTACK_PROTO20 DLSTACK_PROTO20_, ...
+
+#define DLSTACK_ARGS0(stack)
+#define DLSTACK_ARGS1(stack) (stack)[0]
+#define DLSTACK_ARGS2(stack) DLSTACK_ARGS1(stack), (stack)[1]
+#define DLSTACK_ARGS3(stack) DLSTACK_ARGS2(stack), (stack)[2]
+#define DLSTACK_ARGS4(stack) DLSTACK_ARGS3(stack), (stack)[3]
+#define DLSTACK_ARGS5(stack) DLSTACK_ARGS4(stack), (stack)[4]
+#define DLSTACK_ARGS6(stack) DLSTACK_ARGS5(stack), (stack)[5]
+#define DLSTACK_ARGS7(stack) DLSTACK_ARGS6(stack), (stack)[6]
+#define DLSTACK_ARGS8(stack) DLSTACK_ARGS7(stack), (stack)[7]
+#define DLSTACK_ARGS9(stack) DLSTACK_ARGS8(stack), (stack)[8]
+#define DLSTACK_ARGS10(stack) DLSTACK_ARGS9(stack), (stack)[9]
+#define DLSTACK_ARGS11(stack) DLSTACK_ARGS10(stack), (stack)[10]
+#define DLSTACK_ARGS12(stack) DLSTACK_ARGS11(stack), (stack)[11]
+#define DLSTACK_ARGS13(stack) DLSTACK_ARGS12(stack), (stack)[12]
+#define DLSTACK_ARGS14(stack) DLSTACK_ARGS13(stack), (stack)[13]
+#define DLSTACK_ARGS15(stack) DLSTACK_ARGS14(stack), (stack)[14]
+#define DLSTACK_ARGS16(stack) DLSTACK_ARGS15(stack), (stack)[15]
+#define DLSTACK_ARGS17(stack) DLSTACK_ARGS16(stack), (stack)[16]
+#define DLSTACK_ARGS18(stack) DLSTACK_ARGS17(stack), (stack)[17]
+#define DLSTACK_ARGS19(stack) DLSTACK_ARGS18(stack), (stack)[18]
+#define DLSTACK_ARGS20(stack) DLSTACK_ARGS19(stack), (stack)[19]
+
+extern VALUE rb_mDL;
+extern VALUE rb_cDLHandle;
+extern VALUE rb_cDLSymbol;
+extern VALUE rb_eDLError;
+extern VALUE rb_eDLTypeError;
+
+#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x)
+
+#define ALIGN_VOIDP ALIGN_OF(void*)
+#define ALIGN_SHORT ALIGN_OF(short)
+#define ALIGN_CHAR ALIGN_OF(char)
+#define ALIGN_INT ALIGN_OF(int)
+#define ALIGN_LONG ALIGN_OF(long)
+#if HAVE_LONG_LONG
+#define ALIGN_LONG_LONG ALIGN_OF(LONG_LONG)
+#endif
+#define ALIGN_FLOAT ALIGN_OF(float)
+#define ALIGN_DOUBLE ALIGN_OF(double)
+
+#define DLALIGN(ptr,offset,align) \
+ ((offset) += ((align) - ((uintptr_t)((char *)(ptr) + (offset))) % (align)) % (align))
+
+
+#define DLTYPE_VOID 0
+#define DLTYPE_VOIDP 1
+#define DLTYPE_CHAR 2
+#define DLTYPE_SHORT 3
+#define DLTYPE_INT 4
+#define DLTYPE_LONG 5
+#if HAVE_LONG_LONG
+#define DLTYPE_LONG_LONG 6
+#endif
+#define DLTYPE_FLOAT 7
+#define DLTYPE_DOUBLE 8
+#define MAX_DLTYPE 9
+
+#if SIZEOF_VOIDP == SIZEOF_LONG
+# define PTR2NUM(x) (ULONG2NUM((unsigned long)(x)))
+# define NUM2PTR(x) ((void*)(NUM2ULONG(x)))
+#else
+/* # error --->> Ruby/DL2 requires sizeof(void*) == sizeof(long) to be compiled. <<--- */
+# define PTR2NUM(x) (ULL2NUM((unsigned long long)(x)))
+# define NUM2PTR(x) ((void*)(NUM2ULL(x)))
+#endif
+
+#define BOOL2INT(x) (((x) == Qtrue)?1:0)
+#define INT2BOOL(x) ((x)?Qtrue:Qfalse)
+
+typedef void (*freefunc_t)(void*);
+
+struct dl_handle {
+ void *ptr;
+ int open;
+ int enable_close;
+};
+
+
+struct cfunc_data {
+ void *ptr;
+ char *name;
+ int type;
+ ID calltype;
+ VALUE wrap;
+};
+extern ID rbdl_id_cdecl;
+extern ID rbdl_id_stdcall;
+#define CFUNC_CDECL (rbdl_id_cdecl)
+#define CFUNC_STDCALL (rbdl_id_stdcall)
+
+struct ptr_data {
+ void *ptr;
+ long size;
+ freefunc_t free;
+ VALUE wrap[2];
+};
+
+#define RDL_HANDLE(obj) ((struct dl_handle *)(DATA_PTR(obj)))
+#define RCFUNC_DATA(obj) ((struct cfunc_data *)(DATA_PTR(obj)))
+#define RPTR_DATA(obj) ((struct ptr_data *)(DATA_PTR(obj)))
+
+VALUE rb_dlcfunc_new(void (*func)(), int dltype, const char * name, ID calltype);
+int rb_dlcfunc_kind_p(VALUE func);
+VALUE rb_dlptr_new(void *ptr, long size, freefunc_t func);
+VALUE rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func);
+VALUE rb_dlptr_malloc(long size, freefunc_t func);
+
+#endif
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
new file mode 100644
index 0000000000..4ef46f85fb
--- /dev/null
+++ b/ext/dl/extconf.rb
@@ -0,0 +1,43 @@
+require 'mkmf'
+
+if RbConfig::CONFIG['GCC'] == 'yes'
+ (have_macro("__clang__") ? $LDFLAGS : $CFLAGS) << " -fno-defer-pop"
+ $CFLAGS << " -fno-omit-frame-pointer"
+end
+
+$INSTALLFILES = [
+ ["dl.h", "$(HDRDIR)"],
+]
+
+check = true
+if( have_header("dlfcn.h") )
+ have_library("dl")
+ check &&= have_func("dlopen")
+ check &&= have_func("dlclose")
+ check &&= have_func("dlsym")
+ have_func("dlerror")
+elsif( have_header("windows.h") )
+ check &&= have_func("LoadLibrary")
+ check &&= have_func("FreeLibrary")
+ check &&= have_func("GetProcAddress")
+else
+ check = false
+end
+
+if check
+ config = File.read(RbConfig.expand(File.join($arch_hdrdir, "ruby/config.h")))
+ types = {"SIZE_T"=>"SSIZE_T", "PTRDIFF_T"=>nil, "INTPTR_T"=>nil}
+ types.each do |type, signed|
+ if /^\#define\s+SIZEOF_#{type}\s+(SIZEOF_(.+)|\d+)/ =~ config
+ if size = $2 and size != 'VOIDP'
+ size = types.fetch(size) {size}
+ $defs << format("-DDLTYPE_%s=DLTYPE_%s", signed||type, size)
+ end
+ if signed
+ check_signedness(type.downcase, "stddef.h")
+ end
+ end
+ end
+ $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"]
+ create_makefile("dl")
+end
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
new file mode 100644
index 0000000000..ef182e816f
--- /dev/null
+++ b/ext/dl/handle.c
@@ -0,0 +1,430 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby.h>
+#include "dl.h"
+
+VALUE rb_cDLHandle;
+
+#ifdef _WIN32
+# ifndef _WIN32_WCE
+static void *
+w32_coredll(void)
+{
+ MEMORY_BASIC_INFORMATION m;
+ memset(&m, 0, sizeof(m));
+ if( !VirtualQuery(_errno, &m, sizeof(m)) ) return NULL;
+ return m.AllocationBase;
+}
+# endif
+
+static int
+w32_dlclose(void *ptr)
+{
+# ifndef _WIN32_WCE
+ if( ptr == w32_coredll() ) return 0;
+# endif
+ if( FreeLibrary((HMODULE)ptr) ) return 0;
+ return errno = rb_w32_map_errno(GetLastError());
+}
+#define dlclose(ptr) w32_dlclose(ptr)
+#endif
+
+static void
+dlhandle_free(void *ptr)
+{
+ struct dl_handle *dlhandle = ptr;
+ if( dlhandle->ptr && dlhandle->open && dlhandle->enable_close ){
+ dlclose(dlhandle->ptr);
+ }
+}
+
+static size_t
+dlhandle_memsize(const void *ptr)
+{
+ return ptr ? sizeof(struct dl_handle) : 0;
+}
+
+static const rb_data_type_t dlhandle_data_type = {
+ "dl/handle",
+ {0, dlhandle_free, dlhandle_memsize,},
+};
+
+/*
+ * call-seq: close
+ *
+ * Close this DL::Handle. Calling close more than once will raise a
+ * DL::DLError exception.
+ */
+VALUE
+rb_dlhandle_close(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+ if(dlhandle->open) {
+ int ret = dlclose(dlhandle->ptr);
+ dlhandle->open = 0;
+
+ /* Check dlclose for successful return value */
+ if(ret) {
+#if defined(HAVE_DLERROR)
+ rb_raise(rb_eDLError, "%s", dlerror());
+#else
+ rb_raise(rb_eDLError, "could not close handle");
+#endif
+ }
+ return INT2NUM(ret);
+ }
+ rb_raise(rb_eDLError, "dlclose() called too many times");
+
+ UNREACHABLE;
+}
+
+VALUE
+rb_dlhandle_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct dl_handle *dlhandle;
+
+ obj = TypedData_Make_Struct(rb_cDLHandle, struct dl_handle, &dlhandle_data_type, dlhandle);
+ dlhandle->ptr = 0;
+ dlhandle->open = 0;
+ dlhandle->enable_close = 0;
+
+ return obj;
+}
+
+static VALUE
+predefined_dlhandle(void *handle)
+{
+ VALUE obj = rb_dlhandle_s_allocate(rb_cDLHandle);
+ struct dl_handle *dlhandle = DATA_PTR(obj);
+
+ dlhandle->ptr = handle;
+ dlhandle->open = 1;
+ OBJ_FREEZE(obj);
+ return obj;
+}
+
+/*
+ * call-seq:
+ * initialize(lib = nil, flags = DL::RTLD_LAZY | DL::RTLD_GLOBAL)
+ *
+ * Create a new handler that opens library named +lib+ with +flags+. If no
+ * library is specified, RTLD_DEFAULT is used.
+ */
+VALUE
+rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
+{
+ void *ptr;
+ struct dl_handle *dlhandle;
+ VALUE lib, flag;
+ char *clib;
+ int cflag;
+ const char *err;
+
+ switch( rb_scan_args(argc, argv, "02", &lib, &flag) ){
+ case 0:
+ clib = NULL;
+ cflag = RTLD_LAZY | RTLD_GLOBAL;
+ break;
+ case 1:
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
+ cflag = RTLD_LAZY | RTLD_GLOBAL;
+ break;
+ case 2:
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
+ cflag = NUM2INT(flag);
+ break;
+ default:
+ rb_bug("rb_dlhandle_new");
+ }
+
+ rb_secure(2);
+
+#if defined(_WIN32)
+ if( !clib ){
+ HANDLE rb_libruby_handle(void);
+ ptr = rb_libruby_handle();
+ }
+ else if( STRCASECMP(clib, "libc") == 0
+# ifdef RUBY_COREDLL
+ || STRCASECMP(clib, RUBY_COREDLL) == 0
+ || STRCASECMP(clib, RUBY_COREDLL".dll") == 0
+# endif
+ ){
+# ifdef _WIN32_WCE
+ ptr = dlopen("coredll.dll", cflag);
+# else
+ ptr = w32_coredll();
+# endif
+ }
+ else
+#endif
+ ptr = dlopen(clib, cflag);
+#if defined(HAVE_DLERROR)
+ if( !ptr && (err = dlerror()) ){
+ rb_raise(rb_eDLError, "%s", err);
+ }
+#else
+ if( !ptr ){
+ err = dlerror();
+ rb_raise(rb_eDLError, "%s", err);
+ }
+#endif
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+ if( dlhandle->ptr && dlhandle->open && dlhandle->enable_close ){
+ dlclose(dlhandle->ptr);
+ }
+ dlhandle->ptr = ptr;
+ dlhandle->open = 1;
+ dlhandle->enable_close = 0;
+
+ if( rb_block_given_p() ){
+ rb_ensure(rb_yield, self, rb_dlhandle_close, self);
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq: enable_close
+ *
+ * Enable a call to dlclose() when this DL::Handle is garbage collected.
+ */
+VALUE
+rb_dlhandle_enable_close(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+ dlhandle->enable_close = 1;
+ return Qnil;
+}
+
+/*
+ * call-seq: disable_close
+ *
+ * Disable a call to dlclose() when this DL::Handle is garbage collected.
+ */
+VALUE
+rb_dlhandle_disable_close(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+ dlhandle->enable_close = 0;
+ return Qnil;
+}
+
+/*
+ * call-seq: close_enabled?
+ *
+ * Returns +true+ if dlclose() will be called when this DL::Handle is
+ * garbage collected.
+ */
+static VALUE
+rb_dlhandle_close_enabled_p(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+
+ if(dlhandle->enable_close) return Qtrue;
+ return Qfalse;
+}
+
+/*
+ * call-seq: to_i
+ *
+ * Returns the memory address for this handle.
+ */
+VALUE
+rb_dlhandle_to_i(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+ return PTR2NUM(dlhandle);
+}
+
+static VALUE dlhandle_sym(void *handle, const char *symbol);
+
+/*
+ * Document-method: sym
+ * Document-method: []
+ *
+ * call-seq: sym(name)
+ *
+ * Get the address as an Integer for the function named +name+.
+ */
+VALUE
+rb_dlhandle_sym(VALUE self, VALUE sym)
+{
+ struct dl_handle *dlhandle;
+
+ TypedData_Get_Struct(self, struct dl_handle, &dlhandle_data_type, dlhandle);
+ if( ! dlhandle->open ){
+ rb_raise(rb_eDLError, "closed handle");
+ }
+
+ return dlhandle_sym(dlhandle->ptr, StringValueCStr(sym));
+}
+
+#ifndef RTLD_NEXT
+#define RTLD_NEXT NULL
+#endif
+#ifndef RTLD_DEFAULT
+#define RTLD_DEFAULT NULL
+#endif
+
+/*
+ * Document-method: sym
+ * Document-method: []
+ *
+ * call-seq: sym(name)
+ *
+ * Get the address as an Integer for the function named +name+. The function
+ * is searched via dlsym on RTLD_NEXT. See man(3) dlsym() for more info.
+ */
+VALUE
+rb_dlhandle_s_sym(VALUE self, VALUE sym)
+{
+ return dlhandle_sym(RTLD_NEXT, StringValueCStr(sym));
+}
+
+static VALUE
+dlhandle_sym(void *handle, const char *name)
+{
+#if defined(HAVE_DLERROR)
+ const char *err;
+# define CHECK_DLERROR if( err = dlerror() ){ func = 0; }
+#else
+# define CHECK_DLERROR
+#endif
+ void (*func)();
+
+ rb_secure(2);
+#ifdef HAVE_DLERROR
+ dlerror();
+#endif
+ func = (void (*)())(VALUE)dlsym(handle, name);
+ CHECK_DLERROR;
+#if defined(FUNC_STDCALL)
+ if( !func ){
+ int i;
+ int len = (int)strlen(name);
+ char *name_n;
+#if defined(__CYGWIN__) || defined(_WIN32) || defined(__MINGW32__)
+ {
+ char *name_a = (char*)xmalloc(len+2);
+ strcpy(name_a, name);
+ name_n = name_a;
+ name_a[len] = 'A';
+ name_a[len+1] = '\0';
+ func = dlsym(handle, name_a);
+ CHECK_DLERROR;
+ if( func ) goto found;
+ name_n = xrealloc(name_a, len+6);
+ }
+#else
+ name_n = (char*)xmalloc(len+6);
+#endif
+ memcpy(name_n, name, len);
+ name_n[len++] = '@';
+ for( i = 0; i < 256; i += 4 ){
+ sprintf(name_n + len, "%d", i);
+ func = dlsym(handle, name_n);
+ CHECK_DLERROR;
+ if( func ) break;
+ }
+ if( func ) goto found;
+ name_n[len-1] = 'A';
+ name_n[len++] = '@';
+ for( i = 0; i < 256; i += 4 ){
+ sprintf(name_n + len, "%d", i);
+ func = dlsym(handle, name_n);
+ CHECK_DLERROR;
+ if( func ) break;
+ }
+ found:
+ xfree(name_n);
+ }
+#endif
+ if( !func ){
+ rb_raise(rb_eDLError, "unknown symbol \"%s\"", name);
+ }
+
+ return PTR2NUM(func);
+}
+
+void
+Init_dlhandle(void)
+{
+ /*
+ * Document-class: DL::Handle
+ *
+ * The DL::Handle is the manner to access the dynamic library
+ *
+ * == Example
+ *
+ * === Setup
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ * @handle = DL::Handle.new(libc_so)
+ * => #<DL::Handle:0x00000000d69ef8>
+ *
+ * === Setup, with flags
+ *
+ * libc_so = "/lib64/libc.so.6"
+ * => "/lib64/libc.so.6"
+ * @handle = DL::Handle.new(libc_so, DL::RTLD_LAZY | DL::RTLD_GLOBAL)
+ * => #<DL::Handle:0x00000000d69ef8>
+ *
+ * === Addresses to symbols
+ *
+ * strcpy_addr = @handle['strcpy']
+ * => 140062278451968
+ *
+ * or
+ *
+ * strcpy_addr = @handle.sym('strcpy')
+ * => 140062278451968
+ *
+ */
+ rb_cDLHandle = rb_define_class_under(rb_mDL, "Handle", rb_cObject);
+ rb_define_alloc_func(rb_cDLHandle, rb_dlhandle_s_allocate);
+ rb_define_singleton_method(rb_cDLHandle, "sym", rb_dlhandle_s_sym, 1);
+ rb_define_singleton_method(rb_cDLHandle, "[]", rb_dlhandle_s_sym, 1);
+
+ /* Document-const: NEXT
+ *
+ * A predefined pseudo-handle of RTLD_NEXT
+ *
+ * Which will find the next occurrence of a function in the search order
+ * after the current library.
+ */
+ rb_define_const(rb_cDLHandle, "NEXT", predefined_dlhandle(RTLD_NEXT));
+
+ /* Document-const: DEFAULT
+ *
+ * A predefined pseudo-handle of RTLD_DEFAULT
+ *
+ * Which will find the first occurrence of the desired symbol using the
+ * default library search order
+ */
+ rb_define_const(rb_cDLHandle, "DEFAULT", predefined_dlhandle(RTLD_DEFAULT));
+ rb_define_method(rb_cDLHandle, "initialize", rb_dlhandle_initialize, -1);
+ rb_define_method(rb_cDLHandle, "to_i", rb_dlhandle_to_i, 0);
+ rb_define_method(rb_cDLHandle, "close", rb_dlhandle_close, 0);
+ rb_define_method(rb_cDLHandle, "sym", rb_dlhandle_sym, 1);
+ rb_define_method(rb_cDLHandle, "[]", rb_dlhandle_sym, 1);
+ rb_define_method(rb_cDLHandle, "disable_close", rb_dlhandle_disable_close, 0);
+ rb_define_method(rb_cDLHandle, "enable_close", rb_dlhandle_enable_close, 0);
+ rb_define_method(rb_cDLHandle, "close_enabled?", rb_dlhandle_close_enabled_p, 0);
+}
+
+/* mode: c; tab-with=8; sw=4; ts=8; noexpandtab: */
diff --git a/ext/dl/lib/dl.rb b/ext/dl/lib/dl.rb
new file mode 100644
index 0000000000..8e615ae718
--- /dev/null
+++ b/ext/dl/lib/dl.rb
@@ -0,0 +1,15 @@
+require 'dl.so'
+
+begin
+ require 'fiddle' unless Object.const_defined?(:Fiddle)
+rescue LoadError
+end
+
+warn "DL is deprecated, please use Fiddle"
+
+module DL
+ # Returns true if DL is using Fiddle, the libffi wrapper.
+ def self.fiddle?
+ Object.const_defined?(:Fiddle)
+ end
+end
diff --git a/ext/dl/lib/dl/callback.rb b/ext/dl/lib/dl/callback.rb
new file mode 100644
index 0000000000..1722d3c6b9
--- /dev/null
+++ b/ext/dl/lib/dl/callback.rb
@@ -0,0 +1,112 @@
+require 'dl'
+require 'thread'
+
+module DL
+ # The mutual exclusion (Mutex) semaphore for the DL module
+ SEM = Mutex.new # :nodoc:
+
+ if DL.fiddle?
+ # A Hash of callback Procs
+ #
+ # Uses Fiddle
+ CdeclCallbackProcs = {} # :nodoc:
+
+ # A Hash of the addresses of callback Proc
+ #
+ # Uses Fiddle
+ CdeclCallbackAddrs = {} # :nodoc:
+
+ # A Hash of Stdcall callback Procs
+ #
+ # Uses Fiddle on win32
+ StdcallCallbackProcs = {} # :nodoc:
+
+ # A Hash of the addresses of Stdcall callback Procs
+ #
+ # Uses Fiddle on win32
+ StdcallCallbackAddrs = {} # :nodoc:
+ end
+
+ def set_callback_internal(proc_entry, addr_entry, argc, ty, abi = nil, &cbp)
+ if( argc < 0 )
+ raise(ArgumentError, "arity should not be less than 0.")
+ end
+ addr = nil
+
+ if DL.fiddle?
+ abi ||= Fiddle::Function::DEFAULT
+ closure = Fiddle::Closure::BlockCaller.new(ty, [TYPE_VOIDP] * argc, abi, &cbp)
+ proc_entry[closure.to_i] = closure
+ addr = closure.to_i
+ else
+ SEM.synchronize{
+ ary = proc_entry[ty]
+ (0...MAX_CALLBACK).each{|n|
+ idx = (n * DLSTACK_SIZE) + argc
+ if( ary[idx].nil? )
+ ary[idx] = cbp
+ addr = addr_entry[ty][idx]
+ break
+ end
+ }
+ }
+ end
+
+ addr
+ end
+
+ def set_cdecl_callback(ty, argc, &cbp)
+ set_callback_internal(CdeclCallbackProcs, CdeclCallbackAddrs, argc, ty, &cbp)
+ end
+
+ def set_stdcall_callback(ty, argc, &cbp)
+ if DL.fiddle?
+ set_callback_internal(StdcallCallbackProcs, StdcallCallbackAddrs, argc, ty, Fiddle::Function::STDCALL, &cbp)
+ else
+ set_callback_internal(StdcallCallbackProcs, StdcallCallbackAddrs, argc, ty, &cbp)
+ end
+ end
+
+ def remove_callback_internal(proc_entry, addr_entry, addr, ctype = nil)
+ if DL.fiddle?
+ addr = addr.to_i
+ return false unless proc_entry.key?(addr)
+ proc_entry.delete(addr)
+ true
+ else
+ index = nil
+ if( ctype )
+ addr_entry[ctype].each_with_index{|xaddr, idx|
+ if( xaddr == addr )
+ index = idx
+ end
+ }
+ else
+ addr_entry.each{|ty,entry|
+ entry.each_with_index{|xaddr, idx|
+ if( xaddr == addr )
+ index = idx
+ end
+ }
+ }
+ end
+ if( index and proc_entry[ctype][index] )
+ proc_entry[ctype][index] = nil
+ return true
+ else
+ return false
+ end
+ end
+ end
+
+ def remove_cdecl_callback(addr, ctype = nil)
+ remove_callback_internal(CdeclCallbackProcs, CdeclCallbackAddrs, addr, ctype)
+ end
+
+ def remove_stdcall_callback(addr, ctype = nil)
+ remove_callback_internal(StdcallCallbackProcs, StdcallCallbackAddrs, addr, ctype)
+ end
+
+ alias set_callback set_cdecl_callback
+ alias remove_callback remove_cdecl_callback
+end
diff --git a/ext/dl/lib/dl/cparser.rb b/ext/dl/lib/dl/cparser.rb
new file mode 100644
index 0000000000..e70e0f1dc1
--- /dev/null
+++ b/ext/dl/lib/dl/cparser.rb
@@ -0,0 +1,156 @@
+module DL
+ # Methods for parsing C struct and C prototype signatures.
+ module CParser
+ # Parses a C struct's members
+ #
+ # Example:
+ #
+ # parse_struct_signature(['int i', 'char c'])
+ # => [[DL::TYPE_INT, DL::TYPE_CHAR], ["i", "c"]]
+ #
+ def parse_struct_signature(signature, tymap=nil)
+ if( signature.is_a?(String) )
+ signature = signature.split(/\s*,\s*/)
+ end
+ mems = []
+ tys = []
+ signature.each{|msig|
+ tks = msig.split(/\s+(\*)?/)
+ ty = tks[0..-2].join(" ")
+ member = tks[-1]
+
+ case ty
+ when /\[(\d+)\]/
+ n = $1.to_i
+ ty.gsub!(/\s*\[\d+\]/,"")
+ ty = [ty, n]
+ when /\[\]/
+ ty.gsub!(/\s*\[\]/, "*")
+ end
+
+ case member
+ when /\[(\d+)\]/
+ ty = [ty, $1.to_i]
+ member.gsub!(/\s*\[\d+\]/,"")
+ when /\[\]/
+ ty = ty + "*"
+ member.gsub!(/\s*\[\]/, "")
+ end
+
+ mems.push(member)
+ tys.push(parse_ctype(ty,tymap))
+ }
+ return tys, mems
+ end
+
+ # Parses a C prototype signature
+ #
+ # Example:
+ #
+ # include DL::CParser
+ # => Object
+ #
+ # parse_signature('double sum(double, double)')
+ # => ["sum", DL::TYPE_DOUBLE, [DL::TYPE_DOUBLE, DL::TYPE_DOUBLE]]
+ #
+ def parse_signature(signature, tymap=nil)
+ tymap ||= {}
+ signature = signature.gsub(/\s+/, " ").strip
+ case signature
+ when /^([\w@\*\s]+)\(([\w\*\s\,\[\]]*)\)$/
+ ret = $1
+ (args = $2).strip!
+ ret = ret.split(/\s+/)
+ args = args.split(/\s*,\s*/)
+ func = ret.pop
+ if( func =~ /^\*/ )
+ func.gsub!(/^\*+/,"")
+ ret.push("*")
+ end
+ ret = ret.join(" ")
+ return [func, parse_ctype(ret, tymap), args.collect{|arg| parse_ctype(arg, tymap)}]
+ else
+ raise(RuntimeError,"can't parse the function prototype: #{signature}")
+ end
+ end
+
+ # Given a String of C type +ty+, return the corresponding DL constant.
+ #
+ # +ty+ can also accept an Array of C type Strings, and will returned in a
+ # corresponding Array.
+ #
+ # If Hash +tymap+ is provided, +ty+ is expected to be the key, and the
+ # value will be the C type to be looked up.
+ #
+ # Example:
+ #
+ # parse_ctype('int')
+ # => DL::TYPE_INT
+ #
+ # parse_ctype('double')
+ # => DL::TYPE_DOUBLE
+ #
+ # parse_ctype('unsigned char')
+ # => -DL::TYPE_CHAR
+ #
+ def parse_ctype(ty, tymap=nil)
+ tymap ||= {}
+ case ty
+ when Array
+ return [parse_ctype(ty[0], tymap), ty[1]]
+ when "void"
+ return TYPE_VOID
+ when "char"
+ return TYPE_CHAR
+ when "unsigned char"
+ return -TYPE_CHAR
+ when "short"
+ return TYPE_SHORT
+ when "unsigned short"
+ return -TYPE_SHORT
+ when "int"
+ return TYPE_INT
+ when "unsigned int", 'uint'
+ return -TYPE_INT
+ when "long"
+ return TYPE_LONG
+ when "unsigned long"
+ return -TYPE_LONG
+ when "long long"
+ if( defined?(TYPE_LONG_LONG) )
+ return TYPE_LONG_LONG
+ else
+ raise(RuntimeError, "unsupported type: #{ty}")
+ end
+ when "unsigned long long"
+ if( defined?(TYPE_LONG_LONG) )
+ return -TYPE_LONG_LONG
+ else
+ raise(RuntimeError, "unsupported type: #{ty}")
+ end
+ when "float"
+ return TYPE_FLOAT
+ when "double"
+ return TYPE_DOUBLE
+ when "size_t"
+ return TYPE_SIZE_T
+ when "ssize_t"
+ return TYPE_SSIZE_T
+ when "ptrdiff_t"
+ return TYPE_PTRDIFF_T
+ when "intptr_t"
+ return TYPE_INTPTR_T
+ when "uintptr_t"
+ return TYPE_UINTPTR_T
+ when /\*/, /\[\s*\]/
+ return TYPE_VOIDP
+ else
+ if( tymap[ty] )
+ return parse_ctype(tymap[ty], tymap)
+ else
+ raise(DLError, "unknown type: #{ty}")
+ end
+ end
+ end
+ end
+end
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
new file mode 100644
index 0000000000..543711f651
--- /dev/null
+++ b/ext/dl/lib/dl/func.rb
@@ -0,0 +1,251 @@
+require 'dl'
+require 'dl/callback'
+require 'dl/stack'
+require 'dl/value'
+require 'thread'
+
+module DL
+ parent = DL.fiddle? ? Fiddle::Function : Object
+
+ class Function < parent
+ include DL
+ include ValueUtil
+
+ if DL.fiddle?
+ # :stopdoc:
+ CALL_TYPE_TO_ABI = Hash.new { |h, k|
+ raise RuntimeError, "unsupported call type: #{k}"
+ }.merge({ :stdcall =>
+ (Fiddle::Function::STDCALL rescue Fiddle::Function::DEFAULT),
+ :cdecl => Fiddle::Function::DEFAULT,
+ nil => Fiddle::Function::DEFAULT
+ }).freeze
+ private_constant :CALL_TYPE_TO_ABI
+ # :startdoc:
+
+ def self.call_type_to_abi(call_type) # :nodoc:
+ CALL_TYPE_TO_ABI[call_type]
+ end
+ private_class_method :call_type_to_abi
+
+ class FiddleClosureCFunc < Fiddle::Closure # :nodoc: all
+ def initialize ctype, arg, abi, name
+ @name = name
+ super(ctype, arg, abi)
+ end
+ def name
+ @name
+ end
+ def ptr
+ to_i
+ end
+ end
+ private_constant :FiddleClosureCFunc
+
+ def self.class_fiddle_closure_cfunc # :nodoc:
+ FiddleClosureCFunc
+ end
+ private_class_method :class_fiddle_closure_cfunc
+ end
+
+ def initialize cfunc, argtypes, abi = nil, &block
+ if DL.fiddle?
+ abi ||= CALL_TYPE_TO_ABI[(cfunc.calltype rescue nil)]
+ if block_given?
+ @cfunc = Class.new(FiddleClosureCFunc) {
+ define_method(:call, block)
+ }.new(cfunc.ctype, argtypes, abi, cfunc.name)
+ else
+ @cfunc = cfunc
+ end
+
+ @args = argtypes
+ super(@cfunc, @args.reject { |x| x == TYPE_VOID }, cfunc.ctype, abi)
+ else
+ @cfunc = cfunc
+ @stack = Stack.new(argtypes.collect{|ty| ty.abs})
+ if( @cfunc.ctype < 0 )
+ @cfunc.ctype = @cfunc.ctype.abs
+ @unsigned = true
+ else
+ @unsigned = false
+ end
+ if block_given?
+ bind(&block)
+ end
+ end
+ end
+
+ def to_i()
+ @cfunc.to_i
+ end
+
+ def name
+ @cfunc.name
+ end
+
+ def call(*args, &block)
+ if DL.fiddle?
+ if block_given?
+ args.find { |a| DL::Function === a }.bind_at_call(&block)
+ end
+ super
+ else
+ funcs = []
+ if $SAFE >= 1 && args.any? { |x| x.tainted? }
+ raise SecurityError, "tainted parameter not allowed"
+ end
+ _args = wrap_args(args, @stack.types, funcs, &block)
+ r = @cfunc.call(@stack.pack(_args))
+ funcs.each{|f| f.unbind_at_call()}
+ return wrap_result(r)
+ end
+ end
+
+ def wrap_result(r)
+ case @cfunc.ctype
+ when TYPE_VOIDP
+ r = CPtr.new(r)
+ else
+ if( @unsigned )
+ r = unsigned_value(r, @cfunc.ctype)
+ end
+ end
+ r
+ end
+
+ def bind(&block)
+ if DL.fiddle?
+ @cfunc = Class.new(FiddleClosureCFunc) {
+ def initialize ctype, args, abi, name, block
+ super(ctype, args, abi, name)
+ @block = block
+ end
+
+ def call *args
+ @block.call(*args)
+ end
+ }.new(@cfunc.ctype, @args, abi, name, block)
+ @ptr = @cfunc
+ return nil
+ else
+ if( !block )
+ raise(RuntimeError, "block must be given.")
+ end
+ unless block.lambda?
+ block = Class.new(self.class){define_method(:call, block); def initialize(obj); obj.instance_variables.each{|s| instance_variable_set(s, obj.instance_variable_get(s))}; end}.new(self).method(:call)
+ end
+ if( @cfunc.ptr == 0 )
+ cb = Proc.new{|*args|
+ ary = @stack.unpack(args)
+ @stack.types.each_with_index{|ty, idx|
+ case ty
+ when TYPE_VOIDP
+ ary[idx] = CPtr.new(ary[idx])
+ end
+ }
+ r = block.call(*ary)
+ wrap_arg(r, @cfunc.ctype, [])
+ }
+ case @cfunc.calltype
+ when :cdecl
+ @cfunc.ptr = set_cdecl_callback(@cfunc.ctype, @stack.size, &cb)
+ when :stdcall
+ @cfunc.ptr = set_stdcall_callback(@cfunc.ctype, @stack.size, &cb)
+ else
+ raise(RuntimeError, "unsupported calltype: #{@cfunc.calltype}")
+ end
+ if( @cfunc.ptr == 0 )
+ raise(RuntimeException, "can't bind C function.")
+ end
+ end
+ end
+ end
+
+ def unbind()
+ if DL.fiddle? then
+ if @cfunc.kind_of?(Fiddle::Closure) and @cfunc.ptr != 0 then
+ call_type = case abi
+ when CALL_TYPE_TO_ABI[nil]
+ nil
+ when CALL_TYPE_TO_ABI[:stdcall]
+ :stdcall
+ else
+ raise(RuntimeError, "unsupported abi: #{abi}")
+ end
+ @cfunc = CFunc.new(0, @cfunc.ctype, name, call_type)
+ return 0
+ elsif @cfunc.ptr != 0 then
+ @cfunc.ptr = 0
+ return 0
+ else
+ return nil
+ end
+ end
+ if( @cfunc.ptr != 0 )
+ case @cfunc.calltype
+ when :cdecl
+ remove_cdecl_callback(@cfunc.ptr, @cfunc.ctype)
+ when :stdcall
+ remove_stdcall_callback(@cfunc.ptr, @cfunc.ctype)
+ else
+ raise(RuntimeError, "unsupported calltype: #{@cfunc.calltype}")
+ end
+ @cfunc.ptr = 0
+ end
+ end
+
+ def bound?()
+ @cfunc.ptr != 0
+ end
+
+ def bind_at_call(&block)
+ bind(&block)
+ end
+
+ def unbind_at_call()
+ end
+ end
+
+ class TempFunction < Function
+ def bind_at_call(&block)
+ bind(&block)
+ end
+
+ def unbind_at_call()
+ unbind()
+ end
+ end
+
+ class CarriedFunction < Function
+ def initialize(cfunc, argtypes, n)
+ super(cfunc, argtypes)
+ @carrier = []
+ @index = n
+ @mutex = Mutex.new
+ end
+
+ def create_carrier(data)
+ ary = []
+ userdata = [ary, data]
+ @mutex.lock()
+ @carrier.push(userdata)
+ return dlwrap(userdata)
+ end
+
+ def bind_at_call(&block)
+ userdata = @carrier[-1]
+ userdata[0].push(block)
+ bind{|*args|
+ ptr = args[@index]
+ if( !ptr )
+ raise(RuntimeError, "The index of userdata should be lower than #{args.size}.")
+ end
+ userdata = dlunwrap(Integer(ptr))
+ args[@index] = userdata[1]
+ userdata[0][0].call(*args)
+ }
+ @mutex.unlock()
+ end
+ end
+end
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
new file mode 100644
index 0000000000..6f157ccf28
--- /dev/null
+++ b/ext/dl/lib/dl/import.rb
@@ -0,0 +1,268 @@
+require 'dl'
+require 'dl/func.rb'
+require 'dl/struct.rb'
+require 'dl/cparser.rb'
+
+module DL
+ class CompositeHandler
+ def initialize(handlers)
+ @handlers = handlers
+ end
+
+ def handlers()
+ @handlers
+ end
+
+ def sym(symbol)
+ @handlers.each{|handle|
+ if( handle )
+ begin
+ addr = handle.sym(symbol)
+ return addr
+ rescue DLError
+ end
+ end
+ }
+ return nil
+ end
+
+ def [](symbol)
+ sym(symbol)
+ end
+ end
+
+ # DL::Importer includes the means to dynamically load libraries and build
+ # modules around them including calling extern functions within the C
+ # library that has been loaded.
+ #
+ # == Example
+ #
+ # require 'dl'
+ # require 'dl/import'
+ #
+ # module LibSum
+ # extend DL::Importer
+ # dlload './libsum.so'
+ # extern 'double sum(double*, int)'
+ # extern 'double split(double)'
+ # end
+ #
+ module Importer
+ include DL
+ include CParser
+ extend Importer
+
+ def dlload(*libs)
+ handles = libs.collect{|lib|
+ case lib
+ when nil
+ nil
+ when Handle
+ lib
+ when Importer
+ lib.handlers
+ else
+ begin
+ DL.dlopen(lib)
+ rescue DLError
+ raise(DLError, "can't load #{lib}")
+ end
+ end
+ }.flatten()
+ @handler = CompositeHandler.new(handles)
+ @func_map = {}
+ @type_alias = {}
+ end
+
+ def typealias(alias_type, orig_type)
+ @type_alias[alias_type] = orig_type
+ end
+
+ def sizeof(ty)
+ @type_alias ||= nil
+ case ty
+ when String
+ ty = parse_ctype(ty, @type_alias).abs()
+ case ty
+ when TYPE_CHAR
+ return SIZEOF_CHAR
+ when TYPE_SHORT
+ return SIZEOF_SHORT
+ when TYPE_INT
+ return SIZEOF_INT
+ when TYPE_LONG
+ return SIZEOF_LONG
+ when TYPE_LONG_LONG
+ return SIZEOF_LONG_LON
+ when TYPE_FLOAT
+ return SIZEOF_FLOAT
+ when TYPE_DOUBLE
+ return SIZEOF_DOUBLE
+ when TYPE_VOIDP
+ return SIZEOF_VOIDP
+ else
+ raise(DLError, "unknown type: #{ty}")
+ end
+ when Class
+ if( ty.instance_methods().include?(:to_ptr) )
+ return ty.size()
+ end
+ end
+ return CPtr[ty].size()
+ end
+
+ def parse_bind_options(opts)
+ h = {}
+ while( opt = opts.shift() )
+ case opt
+ when :stdcall, :cdecl
+ h[:call_type] = opt
+ when :carried, :temp, :temporal, :bind
+ h[:callback_type] = opt
+ h[:carrier] = opts.shift()
+ else
+ h[opt] = true
+ end
+ end
+ h
+ end
+ private :parse_bind_options
+
+ def extern(signature, *opts)
+ @type_alias ||= nil
+ symname, ctype, argtype = parse_signature(signature, @type_alias)
+ opt = parse_bind_options(opts)
+ f = import_function(symname, ctype, argtype, opt[:call_type])
+ name = symname.gsub(/@.+/,'')
+ @func_map[name] = f
+ # define_method(name){|*args,&block| f.call(*args,&block)}
+ begin
+ /^(.+?):(\d+)/ =~ caller.first
+ file, line = $1, $2.to_i
+ rescue
+ file, line = __FILE__, __LINE__+3
+ end
+ module_eval(<<-EOS, file, line)
+ def #{name}(*args, &block)
+ @func_map['#{name}'].call(*args,&block)
+ end
+ EOS
+ module_function(name)
+ f
+ end
+
+ def bind(signature, *opts, &blk)
+ @type_alias ||= nil
+ name, ctype, argtype = parse_signature(signature, @type_alias)
+ h = parse_bind_options(opts)
+ case h[:callback_type]
+ when :bind, nil
+ f = bind_function(name, ctype, argtype, h[:call_type], &blk)
+ when :temp, :temporal
+ f = create_temp_function(name, ctype, argtype, h[:call_type])
+ when :carried
+ f = create_carried_function(name, ctype, argtype, h[:call_type], h[:carrier])
+ else
+ raise(RuntimeError, "unknown callback type: #{h[:callback_type]}")
+ end
+ @func_map[name] = f
+ #define_method(name){|*args,&block| f.call(*args,&block)}
+ begin
+ /^(.+?):(\d+)/ =~ caller.first
+ file, line = $1, $2.to_i
+ rescue
+ file, line = __FILE__, __LINE__+3
+ end
+ module_eval(<<-EOS, file, line)
+ def #{name}(*args,&block)
+ @func_map['#{name}'].call(*args,&block)
+ end
+ EOS
+ module_function(name)
+ f
+ end
+
+ # Creates a class to wrap the C struct described by +signature+.
+ #
+ # MyStruct = struct ['int i', 'char c']
+ def struct(signature)
+ @type_alias ||= nil
+ tys, mems = parse_struct_signature(signature, @type_alias)
+ DL::CStructBuilder.create(CStruct, tys, mems)
+ end
+
+ # Creates a class to wrap the C union described by +signature+.
+ #
+ # MyUnion = union ['int i', 'char c']
+ def union(signature)
+ @type_alias ||= nil
+ tys, mems = parse_struct_signature(signature, @type_alias)
+ DL::CStructBuilder.create(CUnion, tys, mems)
+ end
+
+ def [](name)
+ @func_map[name]
+ end
+
+ def create_value(ty, val=nil)
+ s = struct([ty + " value"])
+ ptr = s.malloc()
+ if( val )
+ ptr.value = val
+ end
+ return ptr
+ end
+ alias value create_value
+
+ def import_value(ty, addr)
+ s = struct([ty + " value"])
+ ptr = s.new(addr)
+ return ptr
+ end
+
+ def handler
+ defined?(@handler) or raise "call dlload before importing symbols and functions"
+ @handler
+ end
+
+ def import_symbol(name)
+ addr = handler.sym(name)
+ if( !addr )
+ raise(DLError, "cannot find the symbol: #{name}")
+ end
+ CPtr.new(addr)
+ end
+
+ def import_function(name, ctype, argtype, call_type = nil)
+ addr = handler.sym(name)
+ if( !addr )
+ raise(DLError, "cannot find the function: #{name}()")
+ end
+ Function.new(CFunc.new(addr, ctype, name, call_type || :cdecl), argtype)
+ end
+
+ def bind_function(name, ctype, argtype, call_type = nil, &block)
+ if DL.fiddle?
+ klass = Function.instance_eval { class_fiddle_closure_cfunc }
+ abi = Function.instance_eval { call_type_to_abi(call_type) }
+ closure = Class.new(klass) {
+ define_method(:call, block)
+ }.new(ctype, argtype, abi, name)
+
+ Function.new(closure, argtype, abi)
+ else
+ f = Function.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype)
+ f.bind(&block)
+ f
+ end
+ end
+
+ def create_temp_function(name, ctype, argtype, call_type = nil)
+ TempFunction.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype)
+ end
+
+ def create_carried_function(name, ctype, argtype, call_type = nil, n = 0)
+ CarriedFunction.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype, n)
+ end
+ end
+end
diff --git a/ext/dl/lib/dl/pack.rb b/ext/dl/lib/dl/pack.rb
new file mode 100644
index 0000000000..7fbc802b0f
--- /dev/null
+++ b/ext/dl/lib/dl/pack.rb
@@ -0,0 +1,128 @@
+require 'dl'
+
+module DL
+ module PackInfo
+ ALIGN_MAP = {
+ TYPE_VOIDP => ALIGN_VOIDP,
+ TYPE_CHAR => ALIGN_CHAR,
+ TYPE_SHORT => ALIGN_SHORT,
+ TYPE_INT => ALIGN_INT,
+ TYPE_LONG => ALIGN_LONG,
+ TYPE_FLOAT => ALIGN_FLOAT,
+ TYPE_DOUBLE => ALIGN_DOUBLE,
+ -TYPE_CHAR => ALIGN_CHAR,
+ -TYPE_SHORT => ALIGN_SHORT,
+ -TYPE_INT => ALIGN_INT,
+ -TYPE_LONG => ALIGN_LONG,
+ }
+
+ PACK_MAP = {
+ TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG) ? "q" : "l!"),
+ TYPE_CHAR => "c",
+ TYPE_SHORT => "s!",
+ TYPE_INT => "i!",
+ TYPE_LONG => "l!",
+ TYPE_FLOAT => "f",
+ TYPE_DOUBLE => "d",
+ -TYPE_CHAR => "c",
+ -TYPE_SHORT => "s!",
+ -TYPE_INT => "i!",
+ -TYPE_LONG => "l!",
+ }
+
+ SIZE_MAP = {
+ TYPE_VOIDP => SIZEOF_VOIDP,
+ TYPE_CHAR => SIZEOF_CHAR,
+ TYPE_SHORT => SIZEOF_SHORT,
+ TYPE_INT => SIZEOF_INT,
+ TYPE_LONG => SIZEOF_LONG,
+ TYPE_FLOAT => SIZEOF_FLOAT,
+ TYPE_DOUBLE => SIZEOF_DOUBLE,
+ -TYPE_CHAR => SIZEOF_CHAR,
+ -TYPE_SHORT => SIZEOF_SHORT,
+ -TYPE_INT => SIZEOF_INT,
+ -TYPE_LONG => SIZEOF_LONG,
+ }
+ if defined?(TYPE_LONG_LONG)
+ ALIGN_MAP[TYPE_LONG_LONG] = ALIGN_MAP[-TYPE_LONG_LONG] = ALIGN_LONG_LONG
+ PACK_MAP[TYPE_LONG_LONG] = PACK_MAP[-TYPE_LONG_LONG] = "q"
+ SIZE_MAP[TYPE_LONG_LONG] = SIZE_MAP[-TYPE_LONG_LONG] = SIZEOF_LONG_LONG
+ end
+
+ def align(addr, align)
+ d = addr % align
+ if( d == 0 )
+ addr
+ else
+ addr + (align - d)
+ end
+ end
+ module_function :align
+ end
+
+ class Packer
+ include PackInfo
+
+ def self.[](*types)
+ new(types)
+ end
+
+ def initialize(types)
+ parse_types(types)
+ end
+
+ def size()
+ @size
+ end
+
+ def pack(ary)
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ ary.pack(@template)
+ when SIZEOF_LONG_LONG
+ ary.pack(@template)
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+
+ def unpack(ary)
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ ary.join().unpack(@template)
+ when SIZEOF_LONG_LONG
+ ary.join().unpack(@template)
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+
+ private
+
+ def parse_types(types)
+ @template = ""
+ addr = 0
+ types.each{|t|
+ orig_addr = addr
+ if( t.is_a?(Array) )
+ addr = align(orig_addr, ALIGN_MAP[TYPE_VOIDP])
+ else
+ addr = align(orig_addr, ALIGN_MAP[t])
+ end
+ d = addr - orig_addr
+ if( d > 0 )
+ @template << "x#{d}"
+ end
+ if( t.is_a?(Array) )
+ @template << (PACK_MAP[t[0]] * t[1])
+ addr += (SIZE_MAP[t[0]] * t[1])
+ else
+ @template << PACK_MAP[t]
+ addr += SIZE_MAP[t]
+ end
+ }
+ addr = align(addr, ALIGN_MAP[TYPE_VOIDP])
+ @size = addr
+ end
+ end
+end
diff --git a/ext/dl/lib/dl/stack.rb b/ext/dl/lib/dl/stack.rb
new file mode 100644
index 0000000000..dc22378fcb
--- /dev/null
+++ b/ext/dl/lib/dl/stack.rb
@@ -0,0 +1,116 @@
+require 'dl'
+
+module DL
+ class Stack
+ def self.[](*types)
+ new(types)
+ end
+
+ def initialize(types)
+ parse_types(types)
+ end
+
+ def size()
+ @size
+ end
+
+ def types()
+ @types
+ end
+
+ def pack(ary)
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ ary.pack(@template).unpack('l!*')
+ when SIZEOF_LONG_LONG
+ ary.pack(@template).unpack('q*')
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+
+ def unpack(ary)
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ ary.pack('l!*').unpack(@template)
+ when SIZEOF_LONG_LONG
+ ary.pack('q*').unpack(@template)
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+
+ private
+
+ def align(addr, align)
+ d = addr % align
+ if( d == 0 )
+ addr
+ else
+ addr + (align - d)
+ end
+ end
+
+ ALIGN_MAP = {
+ TYPE_VOIDP => ALIGN_VOIDP,
+ TYPE_CHAR => ALIGN_VOIDP,
+ TYPE_SHORT => ALIGN_VOIDP,
+ TYPE_INT => ALIGN_VOIDP,
+ TYPE_LONG => ALIGN_VOIDP,
+ TYPE_FLOAT => ALIGN_FLOAT,
+ TYPE_DOUBLE => ALIGN_DOUBLE,
+ }
+
+ PACK_MAP = {
+ TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG)? "q" : "l!"),
+ TYPE_CHAR => "c",
+ TYPE_SHORT => "s!",
+ TYPE_INT => "i!",
+ TYPE_LONG => "l!",
+ TYPE_FLOAT => "f",
+ TYPE_DOUBLE => "d",
+ }
+
+ SIZE_MAP = {
+ TYPE_VOIDP => SIZEOF_VOIDP,
+ TYPE_CHAR => SIZEOF_CHAR,
+ TYPE_SHORT => SIZEOF_SHORT,
+ TYPE_INT => SIZEOF_INT,
+ TYPE_LONG => SIZEOF_LONG,
+ TYPE_FLOAT => SIZEOF_FLOAT,
+ TYPE_DOUBLE => SIZEOF_DOUBLE,
+ }
+ if defined?(TYPE_LONG_LONG)
+ ALIGN_MAP[TYPE_LONG_LONG] = ALIGN_LONG_LONG
+ PACK_MAP[TYPE_LONG_LONG] = "q"
+ SIZE_MAP[TYPE_LONG_LONG] = SIZEOF_LONG_LONG
+ end
+
+ def parse_types(types)
+ @types = types
+ @template = ""
+ addr = 0
+ types.each{|t|
+ addr = add_padding(addr, ALIGN_MAP[t])
+ @template << PACK_MAP[t]
+ addr += SIZE_MAP[t]
+ }
+ addr = add_padding(addr, ALIGN_MAP[SIZEOF_VOIDP])
+ if( addr % SIZEOF_VOIDP == 0 )
+ @size = addr / SIZEOF_VOIDP
+ else
+ @size = (addr / SIZEOF_VOIDP) + 1
+ end
+ end
+
+ def add_padding(addr, align)
+ orig_addr = addr
+ addr = align(orig_addr, align)
+ d = addr - orig_addr
+ if( d > 0 )
+ @template << "x#{d}"
+ end
+ addr
+ end
+ end
+end
diff --git a/ext/dl/lib/dl/struct.rb b/ext/dl/lib/dl/struct.rb
new file mode 100644
index 0000000000..e2d91a6d14
--- /dev/null
+++ b/ext/dl/lib/dl/struct.rb
@@ -0,0 +1,236 @@
+require 'dl'
+require 'dl/value'
+require 'dl/pack.rb'
+
+module DL
+ # C struct shell
+ class CStruct
+ # accessor to DL::CStructEntity
+ def CStruct.entity_class()
+ CStructEntity
+ end
+ end
+
+ # C union shell
+ class CUnion
+ # accessor to DL::CUnionEntity
+ def CUnion.entity_class()
+ CUnionEntity
+ end
+ end
+
+ # Used to construct C classes (CUnion, CStruct, etc)
+ #
+ # DL::Importer#struct and DL::Importer#union wrap this functionality in an
+ # easy-to-use manner.
+ module CStructBuilder
+ # Construct a new class given a C:
+ # * class +klass+ (CUnion, CStruct, or other that provide an
+ # #entity_class)
+ # * +types+ (DL:TYPE_INT, DL::TYPE_SIZE_T, etc., see the C types
+ # constants)
+ # * corresponding +members+
+ #
+ # DL::Importer#struct and DL::Importer#union wrap this functionality in an
+ # easy-to-use manner.
+ #
+ # Example:
+ #
+ # require 'dl/struct'
+ # require 'dl/cparser'
+ #
+ # include DL::CParser
+ #
+ # types, members = parse_struct_signature(['int i','char c'])
+ #
+ # MyStruct = DL::CStructBuilder.create(CUnion, types, members)
+ #
+ # obj = MyStruct.allocate
+ #
+ def create(klass, types, members)
+ new_class = Class.new(klass){
+ define_method(:initialize){|addr|
+ @entity = klass.entity_class.new(addr, types)
+ @entity.assign_names(members)
+ }
+ define_method(:to_ptr){ @entity }
+ define_method(:to_i){ @entity.to_i }
+ members.each{|name|
+ define_method(name){ @entity[name] }
+ define_method(name + "="){|val| @entity[name] = val }
+ }
+ }
+ size = klass.entity_class.size(types)
+ new_class.module_eval(<<-EOS, __FILE__, __LINE__+1)
+ def new_class.size()
+ #{size}
+ end
+ def new_class.malloc()
+ addr = DL.malloc(#{size})
+ new(addr)
+ end
+ EOS
+ return new_class
+ end
+ module_function :create
+ end
+
+ # A C struct wrapper
+ class CStructEntity < (DL.fiddle? ? Fiddle::Pointer : CPtr)
+ include PackInfo
+ include ValueUtil
+
+ # Allocates a C struct the +types+ provided. The C function +func+ is
+ # called when the instance is garbage collected.
+ def CStructEntity.malloc(types, func = nil)
+ addr = DL.malloc(CStructEntity.size(types))
+ CStructEntity.new(addr, types, func)
+ end
+
+ # Given +types+, returns the offset for the packed sizes of those types
+ #
+ # DL::CStructEntity.size([DL::TYPE_DOUBLE, DL::TYPE_INT, DL::TYPE_CHAR,
+ # DL::TYPE_VOIDP])
+ # => 24
+ def CStructEntity.size(types)
+ offset = 0
+
+ max_align = types.map { |type, count = 1|
+ last_offset = offset
+
+ align = PackInfo::ALIGN_MAP[type]
+ offset = PackInfo.align(last_offset, align) +
+ (PackInfo::SIZE_MAP[type] * count)
+
+ align
+ }.max
+
+ PackInfo.align(offset, max_align)
+ end
+
+ # Wraps the C pointer +addr+ as a C struct with the given +types+. The C
+ # function +func+ is called when the instance is garbage collected.
+ #
+ # See also DL::CPtr.new
+ def initialize(addr, types, func = nil)
+ set_ctypes(types)
+ super(addr, @size, func)
+ end
+
+ # Set the names of the +members+ in this C struct
+ def assign_names(members)
+ @members = members
+ end
+
+ # Given +types+, calculate the offsets and sizes for the types in the
+ # struct.
+ def set_ctypes(types)
+ @ctypes = types
+ @offset = []
+ offset = 0
+
+ max_align = types.map { |type, count = 1|
+ orig_offset = offset
+ align = ALIGN_MAP[type]
+ offset = PackInfo.align(orig_offset, align)
+
+ @offset << offset
+
+ offset += (SIZE_MAP[type] * count)
+
+ align
+ }.max
+
+ @size = PackInfo.align(offset, max_align)
+ end
+
+ # Fetch struct member +name+
+ def [](name)
+ idx = @members.index(name)
+ if( idx.nil? )
+ raise(ArgumentError, "no such member: #{name}")
+ end
+ ty = @ctypes[idx]
+ if( ty.is_a?(Array) )
+ r = super(@offset[idx], SIZE_MAP[ty[0]] * ty[1])
+ else
+ r = super(@offset[idx], SIZE_MAP[ty.abs])
+ end
+ packer = Packer.new([ty])
+ val = packer.unpack([r])
+ case ty
+ when Array
+ case ty[0]
+ when TYPE_VOIDP
+ val = val.collect{|v| CPtr.new(v)}
+ end
+ when TYPE_VOIDP
+ val = CPtr.new(val[0])
+ else
+ val = val[0]
+ end
+ if( ty.is_a?(Integer) && (ty < 0) )
+ return unsigned_value(val, ty)
+ elsif( ty.is_a?(Array) && (ty[0] < 0) )
+ return val.collect{|v| unsigned_value(v,ty[0])}
+ else
+ return val
+ end
+ end
+
+ # Set struct member +name+, to value +val+
+ def []=(name, val)
+ idx = @members.index(name)
+ if( idx.nil? )
+ raise(ArgumentError, "no such member: #{name}")
+ end
+ ty = @ctypes[idx]
+ packer = Packer.new([ty])
+ val = wrap_arg(val, ty, [])
+ buff = packer.pack([val].flatten())
+ super(@offset[idx], buff.size, buff)
+ if( ty.is_a?(Integer) && (ty < 0) )
+ return unsigned_value(val, ty)
+ elsif( ty.is_a?(Array) && (ty[0] < 0) )
+ return val.collect{|v| unsigned_value(v,ty[0])}
+ else
+ return val
+ end
+ end
+
+ def to_s() # :nodoc:
+ super(@size)
+ end
+ end
+
+ # A C union wrapper
+ class CUnionEntity < CStructEntity
+ include PackInfo
+
+ # Allocates a C union the +types+ provided. The C function +func+ is
+ # called when the instance is garbage collected.
+ def CUnionEntity.malloc(types, func=nil)
+ addr = DL.malloc(CUnionEntity.size(types))
+ CUnionEntity.new(addr, types, func)
+ end
+
+ # Given +types+, returns the size needed for the union.
+ #
+ # DL::CUnionEntity.size([DL::TYPE_DOUBLE, DL::TYPE_INT, DL::TYPE_CHAR,
+ # DL::TYPE_VOIDP])
+ # => 8
+ def CUnionEntity.size(types)
+ types.map { |type, count = 1|
+ PackInfo::SIZE_MAP[type] * count
+ }.max
+ end
+
+ # Given +types+, calculate the necessary offset and for each union member
+ def set_ctypes(types)
+ @ctypes = types
+ @offset = Array.new(types.length, 0)
+ @size = self.class.size types
+ end
+ end
+end
+
diff --git a/ext/dl/lib/dl/types.rb b/ext/dl/lib/dl/types.rb
new file mode 100644
index 0000000000..d5724e407b
--- /dev/null
+++ b/ext/dl/lib/dl/types.rb
@@ -0,0 +1,71 @@
+module DL
+ # Adds Windows type aliases to the including class for use with
+ # DL::Importer.
+ #
+ # The aliases added are:
+ # * ATOM
+ # * BOOL
+ # * BYTE
+ # * DWORD
+ # * DWORD32
+ # * DWORD64
+ # * HANDLE
+ # * HDC
+ # * HINSTANCE
+ # * HWND
+ # * LPCSTR
+ # * LPSTR
+ # * PBYTE
+ # * PDWORD
+ # * PHANDLE
+ # * PVOID
+ # * PWORD
+ # * UCHAR
+ # * UINT
+ # * ULONG
+ # * WORD
+ module Win32Types
+ def included(m) # :nodoc:
+ m.module_eval{
+ typealias "DWORD", "unsigned long"
+ typealias "PDWORD", "unsigned long *"
+ typealias "DWORD32", "unsigned long"
+ typealias "DWORD64", "unsigned long long"
+ typealias "WORD", "unsigned short"
+ typealias "PWORD", "unsigned short *"
+ typealias "BOOL", "int"
+ typealias "ATOM", "int"
+ typealias "BYTE", "unsigned char"
+ typealias "PBYTE", "unsigned char *"
+ typealias "UINT", "unsigned int"
+ typealias "ULONG", "unsigned long"
+ typealias "UCHAR", "unsigned char"
+ typealias "HANDLE", "uintptr_t"
+ typealias "PHANDLE", "void*"
+ typealias "PVOID", "void*"
+ typealias "LPCSTR", "char*"
+ typealias "LPSTR", "char*"
+ typealias "HINSTANCE", "unsigned int"
+ typealias "HDC", "unsigned int"
+ typealias "HWND", "unsigned int"
+ }
+ end
+ module_function :included
+ end
+
+ # Adds basic type aliases to the including class for use with DL::Importer.
+ #
+ # The aliases added are +uint+ and +u_int+ (<tt>unsigned int</tt>) and
+ # +ulong+ and +u_long+ (<tt>unsigned long</tt>)
+ module BasicTypes
+ def included(m) # :nodoc:
+ m.module_eval{
+ typealias "uint", "unsigned int"
+ typealias "u_int", "unsigned int"
+ typealias "ulong", "unsigned long"
+ typealias "u_long", "unsigned long"
+ }
+ end
+ module_function :included
+ end
+end
diff --git a/ext/dl/lib/dl/value.rb b/ext/dl/lib/dl/value.rb
new file mode 100644
index 0000000000..147d9d120a
--- /dev/null
+++ b/ext/dl/lib/dl/value.rb
@@ -0,0 +1,114 @@
+require 'dl'
+
+module DL
+ module ValueUtil
+ def unsigned_value(val, ty)
+ case ty.abs
+ when TYPE_CHAR
+ [val].pack("c").unpack("C")[0]
+ when TYPE_SHORT
+ [val].pack("s!").unpack("S!")[0]
+ when TYPE_INT
+ [val].pack("i!").unpack("I!")[0]
+ when TYPE_LONG
+ [val].pack("l!").unpack("L!")[0]
+ when TYPE_LONG_LONG
+ [val].pack("q").unpack("Q")[0]
+ else
+ val
+ end
+ end
+
+ def signed_value(val, ty)
+ case ty.abs
+ when TYPE_CHAR
+ [val].pack("C").unpack("c")[0]
+ when TYPE_SHORT
+ [val].pack("S!").unpack("s!")[0]
+ when TYPE_INT
+ [val].pack("I!").unpack("i!")[0]
+ when TYPE_LONG
+ [val].pack("L!").unpack("l!")[0]
+ when TYPE_LONG_LONG
+ [val].pack("Q").unpack("q")[0]
+ else
+ val
+ end
+ end
+
+ def wrap_args(args, tys, funcs, &block)
+ result = []
+ tys ||= []
+ args.each_with_index{|arg, idx|
+ result.push(wrap_arg(arg, tys[idx], funcs, &block))
+ }
+ result
+ end
+
+ def wrap_arg(arg, ty, funcs = [], &block)
+ require 'dl/func'
+
+ funcs ||= []
+ case arg
+ when nil
+ return 0
+ when CPtr
+ return arg.to_i
+ when IO
+ case ty
+ when TYPE_VOIDP
+ return CPtr[arg].to_i
+ else
+ return arg.to_i
+ end
+ when Function
+ if( block )
+ arg.bind_at_call(&block)
+ funcs.push(arg)
+ elsif !arg.bound?
+ raise(RuntimeError, "block must be given.")
+ end
+ return arg.to_i
+ when String
+ if( ty.is_a?(Array) )
+ return arg.unpack('C*')
+ else
+ case SIZEOF_VOIDP
+ when SIZEOF_LONG
+ return [arg].pack("p").unpack("l!")[0]
+ when SIZEOF_LONG_LONG
+ return [arg].pack("p").unpack("q")[0]
+ else
+ raise(RuntimeError, "sizeof(void*)?")
+ end
+ end
+ when Float, Integer
+ return arg
+ when Array
+ if( ty.is_a?(Array) ) # used only by struct
+ case ty[0]
+ when TYPE_VOIDP
+ return arg.collect{|v| Integer(v)}
+ when TYPE_CHAR
+ if( arg.is_a?(String) )
+ return val.unpack('C*')
+ end
+ end
+ return arg
+ else
+ return arg
+ end
+ else
+ if( arg.respond_to?(:to_ptr) )
+ return arg.to_ptr.to_i
+ else
+ begin
+ return Integer(arg)
+ rescue
+ raise(ArgumentError, "unknown argument type: #{arg.class}")
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/ext/etc/depend b/ext/etc/depend
index a73a18465a..2db89d969c 100644
--- a/ext/etc/depend
+++ b/ext/etc/depend
@@ -1,9 +1,3 @@
-etc.o : etc.c constdefs.h $(HDRS) $(ruby_headers) \
- $(hdrdir)/ruby/io.h \
+etc.o : etc.c $(HDRS) $(ruby_headers) \
$(hdrdir)/ruby/encoding.h \
$(hdrdir)/ruby/oniguruma.h
-
-constdefs.h : $(srcdir)/mkconstants.rb
- @echo "generating constant definitions"
- @$(RUBY) $(srcdir)/mkconstants.rb -o constdefs.h
-
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index ddd9441f9d..18d425a8bf 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -9,7 +9,6 @@
#include "ruby.h"
#include "ruby/encoding.h"
-#include "ruby/io.h"
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
@@ -24,16 +23,6 @@
#include <grp.h>
#endif
-#include <errno.h>
-
-#ifdef HAVE_SYS_UTSNAME_H
-#include <sys/utsname.h>
-#endif
-
-#ifdef HAVE_SCHED_GETAFFINITY
-#include <sched.h>
-#endif
-
static VALUE sPasswd;
#ifdef HAVE_GETGRENT
static VALUE sGroup;
@@ -44,7 +33,6 @@ static VALUE sGroup;
#ifndef CSIDL_COMMON_APPDATA
#define CSIDL_COMMON_APPDATA 35
#endif
-#define HAVE_UNAME 1
#endif
#ifndef _WIN32
@@ -52,8 +40,6 @@ char *getenv();
#endif
char *getlogin();
-#include "constdefs.h"
-
/* call-seq:
* getlogin -> String
*
@@ -81,15 +67,8 @@ etc_getlogin(VALUE obj)
login = getenv("USER");
#endif
- if (login) {
-#ifdef _WIN32
- rb_encoding *extenc = rb_utf8_encoding();
-#else
- rb_encoding *extenc = rb_locale_encoding();
-#endif
- return rb_external_str_new_with_enc(login, strlen(login), extenc);
- }
-
+ if (login)
+ return rb_tainted_str_new2(login);
return Qnil;
}
@@ -241,7 +220,7 @@ passwd_iterate(void)
struct passwd *pw;
setpwent();
- while ((pw = getpwent()) != 0) {
+ while (pw = getpwent()) {
rb_yield(setup_passwd(pw));
}
return Qnil;
@@ -287,7 +266,7 @@ etc_passwd(VALUE obj)
if (rb_block_given_p()) {
each_passwd();
}
- else if ((pw = getpwent()) != 0) {
+ else if (pw = getpwent()) {
return setup_passwd(pw);
}
#endif
@@ -369,7 +348,7 @@ etc_getpwent(VALUE obj)
#ifdef HAVE_GETPWENT
struct passwd *pw;
- if ((pw = getpwent()) != 0) {
+ if (pw = getpwent()) {
return setup_passwd(pw);
}
#endif
@@ -485,7 +464,7 @@ group_iterate(void)
struct group *pw;
setgrent();
- while ((pw = getgrent()) != 0) {
+ while (pw = getgrent()) {
rb_yield(setup_group(pw));
}
return Qnil;
@@ -527,7 +506,7 @@ etc_group(VALUE obj)
if (rb_block_given_p()) {
each_group();
}
- else if ((grp = getgrent()) != 0) {
+ else if (grp = getgrent()) {
return setup_group(grp);
}
#endif
@@ -606,7 +585,7 @@ etc_getgrent(VALUE obj)
#ifdef HAVE_GETGRENT
struct group *gr;
- if ((gr = getgrent()) != 0) {
+ if (gr = getgrent()) {
return setup_group(gr);
}
#endif
@@ -651,382 +630,12 @@ etc_systmpdir(void)
if (!len) return Qnil;
tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
#else
- const char default_tmp[] = "/tmp";
- const char *tmpstr = default_tmp;
- size_t tmplen = strlen(default_tmp);
-# if defined _CS_DARWIN_USER_TEMP_DIR
- #ifndef MAXPATHLEN
- #define MAXPATHLEN 1024
- #endif
- char path[MAXPATHLEN];
- size_t len;
- len = confstr(_CS_DARWIN_USER_TEMP_DIR, path, sizeof(path));
- if (len > 0) {
- tmpstr = path;
- tmplen = len - 1;
- }
-# endif
- tmpdir = rb_filesystem_str_new(tmpstr, tmplen);
+ tmpdir = rb_filesystem_str_new_cstr("/tmp");
#endif
FL_UNSET(tmpdir, FL_TAINT);
return tmpdir;
}
-#ifdef HAVE_UNAME
-/*
- * Returns the system information obtained by uname system call.
- *
- * The return value is a hash which has 5 keys at least:
- * :sysname, :nodename, :release, :version, :machine
- *
- * Example:
- *
- * require 'etc'
- * require 'pp'
- *
- * pp Etc.uname
- * #=> {:sysname=>"Linux",
- * # :nodename=>"boron",
- * # :release=>"2.6.18-6-xen-686",
- * # :version=>"#1 SMP Thu Nov 5 19:54:42 UTC 2009",
- * # :machine=>"i686"}
- *
- */
-static VALUE
-etc_uname(VALUE obj)
-{
-#ifdef _WIN32
- OSVERSIONINFOW v;
- SYSTEM_INFO s;
- const char *sysname, *mach;
- VALUE result, release, version;
- VALUE vbuf, nodename = Qnil;
- DWORD len = 0;
- WCHAR *buf;
-
- v.dwOSVersionInfoSize = sizeof(v);
- if (!GetVersionExW(&v))
- rb_sys_fail("GetVersionEx");
-
- result = rb_hash_new();
- switch (v.dwPlatformId) {
- case VER_PLATFORM_WIN32s:
- sysname = "Win32s";
- break;
- case VER_PLATFORM_WIN32_NT:
- sysname = "Windows_NT";
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- default:
- sysname = "Windows";
- break;
- }
- rb_hash_aset(result, ID2SYM(rb_intern("sysname")), rb_str_new_cstr(sysname));
- release = rb_sprintf("%lu.%lu.%lu", v.dwMajorVersion, v.dwMinorVersion, v.dwBuildNumber);
- rb_hash_aset(result, ID2SYM(rb_intern("release")), release);
- version = rb_sprintf("%s Version %"PRIsVALUE": %"PRIsVALUE, sysname, release,
- rb_w32_conv_from_wchar(v.szCSDVersion, rb_utf8_encoding()));
- rb_hash_aset(result, ID2SYM(rb_intern("version")), version);
-
-# if defined _MSC_VER && _MSC_VER < 1300
-# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameW(ptr, plen)
-# else
-# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameExW(ComputerNameDnsFullyQualified, ptr, plen)
-# endif
- GET_COMPUTER_NAME(NULL, &len);
- buf = ALLOCV_N(WCHAR, vbuf, len);
- if (GET_COMPUTER_NAME(buf, &len)) {
- nodename = rb_w32_conv_from_wchar(buf, rb_utf8_encoding());
- }
- ALLOCV_END(vbuf);
- if (NIL_P(nodename)) nodename = rb_str_new(0, 0);
- rb_hash_aset(result, ID2SYM(rb_intern("nodename")), nodename);
-
-# ifndef PROCESSOR_ARCHITECTURE_AMD64
-# define PROCESSOR_ARCHITECTURE_AMD64 9
-# endif
-# ifndef PROCESSOR_ARCHITECTURE_IA64
-# define PROCESSOR_ARCHITECTURE_IA64 6
-# endif
-# ifndef PROCESSOR_ARCHITECTURE_INTEL
-# define PROCESSOR_ARCHITECTURE_INTEL 0
-# endif
- GetSystemInfo(&s);
- switch (s.wProcessorArchitecture) {
- case PROCESSOR_ARCHITECTURE_AMD64:
- mach = "x64";
- break;
- case PROCESSOR_ARCHITECTURE_ARM:
- mach = "ARM";
- break;
- case PROCESSOR_ARCHITECTURE_IA64:
- mach = "IA64";
- break;
- case PROCESSOR_ARCHITECTURE_INTEL:
- mach = "x86";
- break;
- default:
- mach = "unknown";
- break;
- }
-
- rb_hash_aset(result, ID2SYM(rb_intern("machine")), rb_str_new_cstr(mach));
-#else
- struct utsname u;
- int ret;
- VALUE result;
-
- ret = uname(&u);
- if (ret == -1)
- rb_sys_fail("uname");
-
- result = rb_hash_new();
- rb_hash_aset(result, ID2SYM(rb_intern("sysname")), rb_str_new_cstr(u.sysname));
- rb_hash_aset(result, ID2SYM(rb_intern("nodename")), rb_str_new_cstr(u.nodename));
- rb_hash_aset(result, ID2SYM(rb_intern("release")), rb_str_new_cstr(u.release));
- rb_hash_aset(result, ID2SYM(rb_intern("version")), rb_str_new_cstr(u.version));
- rb_hash_aset(result, ID2SYM(rb_intern("machine")), rb_str_new_cstr(u.machine));
-#endif
-
- return result;
-}
-#else
-#define etc_uname rb_f_notimplement
-#endif
-
-#ifdef HAVE_SYSCONF
-/*
- * Returns system configuration variable using sysconf().
- *
- * _name_ should be a constant under <code>Etc</code> which begins with <code>SC_</code>.
- *
- * The return value is an integer or nil.
- * nil means indefinite limit. (sysconf() returns -1 but errno is not set.)
- *
- * Etc.sysconf(Etc::SC_ARG_MAX) #=> 2097152
- * Etc.sysconf(Etc::SC_LOGIN_NAME_MAX) #=> 256
- *
- */
-static VALUE
-etc_sysconf(VALUE obj, VALUE arg)
-{
- int name;
- long ret;
-
- name = NUM2INT(arg);
-
- errno = 0;
- ret = sysconf(name);
- if (ret == -1) {
- if (errno == 0) /* no limit */
- return Qnil;
- rb_sys_fail("sysconf");
- }
- return LONG2NUM(ret);
-}
-#else
-#define etc_sysconf rb_f_notimplement
-#endif
-
-#ifdef HAVE_CONFSTR
-/*
- * Returns system configuration variable using confstr().
- *
- * _name_ should be a constant under <code>Etc</code> which begins with <code>CS_</code>.
- *
- * The return value is a string or nil.
- * nil means no configuration-defined value. (confstr() returns 0 but errno is not set.)
- *
- * Etc.confstr(Etc::CS_PATH) #=> "/bin:/usr/bin"
- *
- * # GNU/Linux
- * Etc.confstr(Etc::CS_GNU_LIBC_VERSION) #=> "glibc 2.18"
- * Etc.confstr(Etc::CS_GNU_LIBPTHREAD_VERSION) #=> "NPTL 2.18"
- *
- */
-static VALUE
-etc_confstr(VALUE obj, VALUE arg)
-{
- int name;
- char localbuf[128], *buf = localbuf;
- size_t bufsize = sizeof(localbuf), ret;
- VALUE tmp;
-
- name = NUM2INT(arg);
-
- errno = 0;
- ret = confstr(name, buf, bufsize);
- if (bufsize < ret) {
- bufsize = ret;
- buf = ALLOCV_N(char, tmp, bufsize);
- errno = 0;
- ret = confstr(name, buf, bufsize);
- }
- if (bufsize < ret)
- rb_bug("required buffer size for confstr() changed dynamically.");
- if (ret == 0) {
- if (errno == 0) /* no configuration-defined value */
- return Qnil;
- rb_sys_fail("confstr");
- }
- return rb_str_new_cstr(buf);
-}
-#else
-#define etc_confstr rb_f_notimplement
-#endif
-
-#ifdef HAVE_FPATHCONF
-/*
- * Returns pathname configuration variable using fpathconf().
- *
- * _name_ should be a constant under <code>Etc</code> which begins with <code>PC_</code>.
- *
- * The return value is an integer or nil.
- * nil means indefinite limit. (fpathconf() returns -1 but errno is not set.)
- *
- * require 'etc'
- * IO.pipe {|r, w|
- * p w.pathconf(Etc::PC_PIPE_BUF) #=> 4096
- * }
- *
- */
-static VALUE
-io_pathconf(VALUE io, VALUE arg)
-{
- int name;
- long ret;
- rb_io_t *fptr;
-
- name = NUM2INT(arg);
-
- GetOpenFile(io, fptr);
-
- errno = 0;
- ret = fpathconf(fptr->fd, name);
- if (ret == -1) {
- if (errno == 0) /* no limit */
- return Qnil;
- rb_sys_fail("fpathconf");
- }
- return LONG2NUM(ret);
-}
-#else
-#define io_pathconf rb_f_notimplement
-#endif
-
-#if (defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)) || defined(_WIN32)
-
-#if defined(HAVE_SCHED_GETAFFINITY) && defined(CPU_ALLOC)
-static int
-etc_nprocessors_affin(void)
-{
- cpu_set_t *cpuset;
- size_t size;
- int ret;
- int n;
-
- /*
- * XXX:
- * man page says CPU_ALLOC takes number of cpus. But it is not accurate
- * explanation. sched_getaffinity() returns EINVAL if cpuset bitmap is
- * smaller than kernel internal bitmap.
- * That said, sched_getaffinity() can fail when a kernel have sparse bitmap
- * even if cpuset bitmap is larger than number of cpus.
- * The precious way is to use /sys/devices/system/cpu/online. But there are
- * two problems,
- * - Costly calculation
- * It is a minor issue, but possibly kill a benefit of a parallel processing.
- * - No guarantee to exist /sys/devices/system/cpu/online
- * This is an issue especially when using Linux containers.
- * So, we use hardcode number for a workaround. Current linux kernel
- * (Linux 3.17) support 8192 cpus at maximum. Then 16384 must be enough.
- */
- for (n=64; n <= 16384; n *= 2) {
- size = CPU_ALLOC_SIZE(n);
- if (size >= 1024) {
- cpuset = xcalloc(1, size);
- if (!cpuset)
- return -1;
- } else {
- cpuset = alloca(size);
- CPU_ZERO_S(size, cpuset);
- }
-
- ret = sched_getaffinity(0, size, cpuset);
- if (ret == 0) {
- /* On success, count number of cpus. */
- ret = CPU_COUNT_S(size, cpuset);
- }
-
- if (size >= 1024) {
- xfree(cpuset);
- }
- if (ret > 0) {
- return ret;
- }
- }
-
- return ret;
-}
-#endif
-
-/*
- * Returns the number of online processors.
- *
- * The result is intended as the number of processes to
- * use all available processors.
- *
- * This method is implemented using:
- * - sched_getaffinity(): Linux
- * - sysconf(_SC_NPROCESSORS_ONLN): GNU/Linux, NetBSD, FreeBSD, OpenBSD, DragonFly BSD, OpenIndiana, Mac OS X, AIX
- *
- * Example:
- *
- * require 'etc'
- * p Etc.nprocessors #=> 4
- *
- * The result might be smaller number than physical cpus especially when ruby
- * process is bound to specific cpus. This is intended for getting better
- * parallel processing.
- *
- * Example: (Linux)
- *
- * linux$ taskset 0x3 ./ruby -retc -e "p Etc.nprocessors" #=> 2
- *
- */
-static VALUE
-etc_nprocessors(VALUE obj)
-{
- long ret;
-
-#if !defined(_WIN32)
-
-#if defined(HAVE_SCHED_GETAFFINITY) && defined(CPU_ALLOC)
- int ncpus;
-
- ncpus = etc_nprocessors_affin();
- if (ncpus != -1) {
- return INT2NUM(ncpus);
- }
- /* fallback to _SC_NPROCESSORS_ONLN */
-#endif
-
- errno = 0;
- ret = sysconf(_SC_NPROCESSORS_ONLN);
- if (ret == -1) {
- rb_sys_fail("sysconf(_SC_NPROCESSORS_ONLN)");
- }
-#else
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- ret = (long)si.dwNumberOfProcessors;
-#endif
- return LONG2NUM(ret);
-}
-#else
-#define etc_nprocessors rb_f_notimplement
-#endif
-
/*
* The Etc module provides access to information typically stored in
* files in the /etc directory on Unix systems.
@@ -1059,8 +668,6 @@ Init_etc(void)
VALUE mEtc;
mEtc = rb_define_module("Etc");
- init_constants(mEtc);
-
rb_define_module_function(mEtc, "getlogin", etc_getlogin, 0);
rb_define_module_function(mEtc, "getpwuid", etc_getpwuid, -1);
@@ -1078,11 +685,6 @@ Init_etc(void)
rb_define_module_function(mEtc, "getgrent", etc_getgrent, 0);
rb_define_module_function(mEtc, "sysconfdir", etc_sysconfdir, 0);
rb_define_module_function(mEtc, "systmpdir", etc_systmpdir, 0);
- rb_define_module_function(mEtc, "uname", etc_uname, 0);
- rb_define_module_function(mEtc, "sysconf", etc_sysconf, 1);
- rb_define_module_function(mEtc, "confstr", etc_confstr, 1);
- rb_define_method(rb_cIO, "pathconf", io_pathconf, 1);
- rb_define_module_function(mEtc, "nprocessors", etc_nprocessors, 0);
sPasswd = rb_struct_define_under(mEtc, "Passwd",
"name",
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 11bc9458c0..1967560cd4 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -1,44 +1,30 @@
-# frozen_string_literal: false
require 'mkmf'
-headers = []
-%w[sys/utsname.h].each {|h|
- if have_header(h, headers)
- headers << h
- end
-}
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
-have_func("uname((struct utsname *)NULL)", headers)
-have_func("getlogin")
-have_func("getpwent")
-have_func("getgrent")
+a = have_func("getlogin")
+b = have_func("getpwent")
+c = have_func("getgrent")
sysconfdir = RbConfig.expand(RbConfig::CONFIG["sysconfdir"].dup, "prefix"=>"", "DESTDIR"=>"")
$defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
-
-have_func("sysconf")
-have_func("confstr")
-have_func("fpathconf")
-
-have_struct_member('struct passwd', 'pw_gecos', 'pwd.h')
-have_struct_member('struct passwd', 'pw_change', 'pwd.h')
-have_struct_member('struct passwd', 'pw_quota', 'pwd.h')
-if have_struct_member('struct passwd', 'pw_age', 'pwd.h')
- case what_type?('struct passwd', 'pw_age', 'pwd.h')
- when "string"
- f = "safe_setup_str"
- when "long long"
- f = "LL2NUM"
- else
- f = "INT2NUM"
+if a or b or c or sysconfdir
+ have_struct_member('struct passwd', 'pw_gecos', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_change', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_quota', 'pwd.h')
+ if have_struct_member('struct passwd', 'pw_age', 'pwd.h')
+ case what_type?('struct passwd', 'pw_age', 'pwd.h')
+ when "string"
+ f = "safe_setup_str"
+ when "long long"
+ f = "LL2NUM"
+ else
+ f = "INT2NUM"
+ end
+ $defs.push("-DPW_AGE2VAL="+f)
end
- $defs.push("-DPW_AGE2VAL="+f)
+ have_struct_member('struct passwd', 'pw_class', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
+ have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
+ have_struct_member('struct group', 'gr_passwd', 'grp.h')
+ create_makefile("etc")
end
-have_struct_member('struct passwd', 'pw_class', 'pwd.h')
-have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
-have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
-have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
-have_struct_member('struct group', 'gr_passwd', 'grp.h')
-
-$distcleanfiles << "constdefs.h"
-
-create_makefile("etc")
diff --git a/ext/etc/mkconstants.rb b/ext/etc/mkconstants.rb
deleted file mode 100644
index 0c4d17e6f9..0000000000
--- a/ext/etc/mkconstants.rb
+++ /dev/null
@@ -1,332 +0,0 @@
-# frozen_string_literal: false
-require 'optparse'
-require 'erb'
-
-C_ESC = {
- "\\" => "\\\\",
- '"' => '\"',
- "\n" => '\n',
-}
-
-0x00.upto(0x1f) {|ch| C_ESC[[ch].pack("C")] ||= "\\%03o" % ch }
-0x7f.upto(0xff) {|ch| C_ESC[[ch].pack("C")] = "\\%03o" % ch }
-C_ESC_PAT = Regexp.union(*C_ESC.keys)
-
-def c_str(str)
- '"' + str.gsub(C_ESC_PAT) {|s| C_ESC[s]} + '"'
-end
-
-opt = OptionParser.new
-
-opt.def_option('-h', 'help') {
- puts opt
- exit 0
-}
-
-opt_o = nil
-opt.def_option('-o FILE', 'specify output file') {|filename|
- opt_o = filename
-}
-
-opt_H = nil
-opt.def_option('-H FILE', 'specify output header file') {|filename|
- opt_H = filename
-}
-
-opt.parse!
-
-h = {}
-COMMENTS = {}
-
-DATA.each_line {|s|
- next if /\A\s*(\#|\z)/ =~ s
- name, default_value, comment = s.chomp.split(/\s+/, 3)
-
- default_value = nil if default_value == 'nil'
-
- if h.has_key? name
- warn "#{$.}: warning: duplicate name: #{name}"
- next
- end
- h[name] = default_value
- COMMENTS[name] = comment if comment
-}
-DEFS = h.to_a
-
-def each_const
- DEFS.each {|name, default_value|
- yield name, default_value
- }
-end
-
-def each_name(pat)
- DEFS.each {|name, default_value|
- next if pat !~ name
- yield name
- }
-end
-
-ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_decls")
-% each_const {|name, default_value|
-#if !defined(<%=name%>)
-# if defined(HAVE_CONST_<%=name.upcase%>)
-# define <%=name%> <%=name%>
-%if default_value
-# else
-# define <%=name%> <%=default_value%>
-%end
-# endif
-#endif
-% }
-EOS
-
-ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs")
-% each_const {|name, default_value|
-#if defined(<%=name%>)
-% if comment = COMMENTS[name]
- /* <%=comment%> */
-% end
- rb_define_const(mod, <%=c_str name.sub(/\A_*/, '')%>, INTEGER2NUM(<%=name%>));
-#endif
-% }
-EOS
-
-header_result = ERB.new(<<'EOS', nil, '%').result(binding)
-/* autogenerated file */
-
-<%= gen_const_decls %>
-EOS
-
-result = ERB.new(<<'EOS', nil, '%').result(binding)
-/* autogenerated file */
-
-#ifdef HAVE_LONG_LONG
-#define INTEGER2NUM(n) \
- (FIXNUM_MAX < (n) ? ULL2NUM(n) : \
- FIXNUM_MIN > (LONG_LONG)(n) ? LL2NUM(n) : \
- LONG2FIX(n))
-#else
-#define INTEGER2NUM(n) \
- (FIXNUM_MAX < (n) ? ULONG2NUM(n) : \
- FIXNUM_MIN > (long)(n) ? LONG2NUM(n) : \
- LONG2FIX(n))
-#endif
-
-static void
-init_constants(VALUE mod)
-{
-<%= gen_const_defs %>
-}
-EOS
-
-if opt_H
- File.open(opt_H, 'w') {|f|
- f << header_result
- }
-else
- result = header_result + result
-end
-
-if opt_o
- File.open(opt_o, 'w') {|f|
- f << result
- }
-else
- $stdout << result
-end
-
-__END__
-# SUSv4
-_SC_AIO_LISTIO_MAX
-_SC_AIO_MAX
-_SC_AIO_PRIO_DELTA_MAX
-_SC_ARG_MAX
-_SC_ATEXIT_MAX
-_SC_BC_BASE_MAX
-_SC_BC_DIM_MAX
-_SC_BC_SCALE_MAX
-_SC_BC_STRING_MAX
-_SC_CHILD_MAX
-_SC_CLK_TCK
-_SC_COLL_WEIGHTS_MAX
-_SC_DELAYTIMER_MAX
-_SC_EXPR_NEST_MAX
-_SC_HOST_NAME_MAX
-_SC_IOV_MAX
-_SC_LINE_MAX
-_SC_LOGIN_NAME_MAX
-_SC_NGROUPS_MAX
-_SC_GETGR_R_SIZE_MAX
-_SC_GETPW_R_SIZE_MAX
-_SC_MQ_OPEN_MAX
-_SC_MQ_PRIO_MAX
-_SC_OPEN_MAX
-_SC_ADVISORY_INFO
-_SC_BARRIERS
-_SC_ASYNCHRONOUS_IO
-_SC_CLOCK_SELECTION
-_SC_CPUTIME
-_SC_FSYNC
-_SC_IPV6
-_SC_JOB_CONTROL
-_SC_MAPPED_FILES
-_SC_MEMLOCK
-_SC_MEMLOCK_RANGE
-_SC_MEMORY_PROTECTION
-_SC_MESSAGE_PASSING
-_SC_MONOTONIC_CLOCK
-_SC_PRIORITIZED_IO
-_SC_PRIORITY_SCHEDULING
-_SC_RAW_SOCKETS
-_SC_READER_WRITER_LOCKS
-_SC_REALTIME_SIGNALS
-_SC_REGEXP
-_SC_SAVED_IDS
-_SC_SEMAPHORES
-_SC_SHARED_MEMORY_OBJECTS
-_SC_SHELL
-_SC_SPAWN
-_SC_SPIN_LOCKS
-_SC_SPORADIC_SERVER
-_SC_SS_REPL_MAX
-_SC_SYNCHRONIZED_IO
-_SC_THREAD_ATTR_STACKADDR
-_SC_THREAD_ATTR_STACKSIZE
-_SC_THREAD_CPUTIME
-_SC_THREAD_PRIO_INHERIT
-_SC_THREAD_PRIO_PROTECT
-_SC_THREAD_PRIORITY_SCHEDULING
-_SC_THREAD_PROCESS_SHARED
-_SC_THREAD_ROBUST_PRIO_INHERIT
-_SC_THREAD_ROBUST_PRIO_PROTECT
-_SC_THREAD_SAFE_FUNCTIONS
-_SC_THREAD_SPORADIC_SERVER
-_SC_THREADS
-_SC_TIMEOUTS
-_SC_TIMERS
-_SC_TRACE
-_SC_TRACE_EVENT_FILTER
-_SC_TRACE_EVENT_NAME_MAX
-_SC_TRACE_INHERIT
-_SC_TRACE_LOG
-_SC_TRACE_NAME_MAX
-_SC_TRACE_SYS_MAX
-_SC_TRACE_USER_EVENT_MAX
-_SC_TYPED_MEMORY_OBJECTS
-_SC_VERSION
-_SC_V7_ILP32_OFF32
-_SC_V7_ILP32_OFFBIG
-_SC_V7_LP64_OFF64
-_SC_V7_LPBIG_OFFBIG
-_SC_V6_ILP32_OFF32
-_SC_V6_ILP32_OFFBIG
-_SC_V6_LP64_OFF64
-_SC_V6_LPBIG_OFFBIG
-_SC_2_C_BIND
-_SC_2_C_DEV
-_SC_2_CHAR_TERM
-_SC_2_FORT_DEV
-_SC_2_FORT_RUN
-_SC_2_LOCALEDEF
-_SC_2_PBS
-_SC_2_PBS_ACCOUNTING
-_SC_2_PBS_CHECKPOINT
-_SC_2_PBS_LOCATE
-_SC_2_PBS_MESSAGE
-_SC_2_PBS_TRACK
-_SC_2_SW_DEV
-_SC_2_UPE
-_SC_2_VERSION
-_SC_PAGE_SIZE
-_SC_PAGESIZE
-_SC_THREAD_DESTRUCTOR_ITERATIONS
-_SC_THREAD_KEYS_MAX
-_SC_THREAD_STACK_MIN
-_SC_THREAD_THREADS_MAX
-_SC_RE_DUP_MAX
-_SC_RTSIG_MAX
-_SC_SEM_NSEMS_MAX
-_SC_SEM_VALUE_MAX
-_SC_SIGQUEUE_MAX
-_SC_STREAM_MAX
-_SC_SYMLOOP_MAX
-_SC_TIMER_MAX
-_SC_TTY_NAME_MAX
-_SC_TZNAME_MAX
-_SC_XOPEN_CRYPT
-_SC_XOPEN_ENH_I18N
-_SC_XOPEN_REALTIME
-_SC_XOPEN_REALTIME_THREADS
-_SC_XOPEN_SHM
-_SC_XOPEN_STREAMS
-_SC_XOPEN_UNIX
-_SC_XOPEN_UUCP
-_SC_XOPEN_VERSION
-
-# non-standard
-_SC_PHYS_PAGES
-_SC_AVPHYS_PAGES
-_SC_NPROCESSORS_CONF
-_SC_NPROCESSORS_ONLN
-_SC_CPUSET_SIZE
-
-# SUSv4
-_CS_PATH
-_CS_POSIX_V7_ILP32_OFF32_CFLAGS
-_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
-_CS_POSIX_V7_ILP32_OFF32_LIBS
-_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
-_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
-_CS_POSIX_V7_ILP32_OFFBIG_LIBS
-_CS_POSIX_V7_LP64_OFF64_CFLAGS
-_CS_POSIX_V7_LP64_OFF64_LDFLAGS
-_CS_POSIX_V7_LP64_OFF64_LIBS
-_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
-_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
-_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
-_CS_POSIX_V7_THREADS_CFLAGS
-_CS_POSIX_V7_THREADS_LDFLAGS
-_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
-_CS_V7_ENV
-_CS_POSIX_V6_ILP32_OFF32_CFLAGS
-_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
-_CS_POSIX_V6_ILP32_OFF32_LIBS
-_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
-_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
-_CS_POSIX_V6_ILP32_OFFBIG_LIBS
-_CS_POSIX_V6_LP64_OFF64_CFLAGS
-_CS_POSIX_V6_LP64_OFF64_LDFLAGS
-_CS_POSIX_V6_LP64_OFF64_LIBS
-_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
-_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
-_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
-_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
-_CS_V6_ENV
-
-# non-standard
-_CS_GNU_LIBC_VERSION
-_CS_GNU_LIBPTHREAD_VERSION
-
-# SUSv4
-_PC_FILESIZEBITS
-_PC_LINK_MAX
-_PC_MAX_CANON
-_PC_MAX_INPUT
-_PC_NAME_MAX
-_PC_PATH_MAX
-_PC_PIPE_BUF
-_PC_2_SYMLINKS
-_PC_ALLOC_SIZE_MIN
-_PC_REC_INCR_XFER_SIZE
-_PC_REC_MAX_XFER_SIZE
-_PC_REC_MIN_XFER_SIZE
-_PC_REC_XFER_ALIGN
-_PC_SYMLINK_MAX
-_PC_CHOWN_RESTRICTED
-_PC_NO_TRUNC
-_PC_VDISABLE
-_PC_ASYNC_IO
-_PC_PRIO_IO
-_PC_SYNC_IO
-_PC_TIMESTAMP_RESOLUTION
-
diff --git a/ext/extmk.rb b/ext/extmk.rb
index ac77641fc3..ef9afa0676 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -1,6 +1,5 @@
#! /usr/local/bin/ruby
# -*- mode: ruby; coding: us-ascii -*-
-# frozen_string_literal: false
# :stopdoc:
$extension = nil
@@ -51,6 +50,7 @@ elsif !File.chardev?(@null = "/dev/null")
end
def sysquote(x)
+ @quote ||= /os2/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
@quote ? x.quote : x
end
@@ -69,22 +69,8 @@ def system(*args)
super
end
-def atomic_write_open(filename)
- filename_new = filename + ".new.#$$"
- open(filename_new, "wb") do |f|
- yield f
- end
- if File.binread(filename_new) != (File.binread(filename) rescue nil)
- File.rename(filename_new, filename)
- else
- File.unlink(filename_new)
- end
-end
-
def extract_makefile(makefile, keep = true)
m = File.read(makefile)
- s = m[/^CLEANFILES[ \t]*=[ \t](.*)/, 1] and $cleanfiles = s.split
- s = m[/^DISTCLEANFILES[ \t]*=[ \t](.*)/, 1] and $distcleanfiles = s.split
if !(target = m[/^TARGET[ \t]*=[ \t]*(\S*)/, 1])
return keep
end
@@ -129,6 +115,7 @@ def extract_makefile(makefile, keep = true)
end
$objs = (m[/^OBJS[ \t]*=[ \t](.*)/, 1] || "").split
$srcs = (m[/^SRCS[ \t]*=[ \t](.*)/, 1] || "").split
+ $distcleanfiles = (m[/^DISTCLEANFILES[ \t]*=[ \t](.*)/, 1] || "").split
$LOCAL_LIBS = m[/^LOCAL_LIBS[ \t]*=[ \t]*(.*)/, 1] || ""
$LIBPATH = Shellwords.shellwords(m[/^libpath[ \t]*=[ \t]*(.*)/, 1] || "") - %w[$(libdir) $(topdir)]
true
@@ -142,16 +129,6 @@ def extmake(target)
FileUtils.mkpath target unless File.directory?(target)
begin
- # don't build if parent library isn't build
- parent = true
- d = target
- until (d = File.dirname(d)) == '.'
- if File.exist?("#{$top_srcdir}/ext/#{d}/extconf.rb")
- parent = (/^all:\s*install/ =~ IO.read("#{d}/Makefile") rescue false)
- break
- end
- end
-
dir = Dir.pwd
FileUtils.mkpath target unless File.directory?(target)
Dir.chdir target
@@ -172,8 +149,8 @@ def extmake(target)
makefile = "./Makefile"
static = $static
$static = nil if noinstall = File.fnmatch?("-*", target)
- ok = parent && File.exist?(makefile)
- if parent && !$ignore
+ ok = File.exist?(makefile)
+ unless $ignore
rbconfig0 = RbConfig::CONFIG
mkconfig0 = CONFIG
rbconfig = {
@@ -202,7 +179,7 @@ def extmake(target)
$extconf_h = nil
ok &&= extract_makefile(makefile)
old_objs = $objs
- old_cleanfiles = $distcleanfiles | $cleanfiles
+ old_cleanfiles = $distcleanfiles
conf = ["#{$srcdir}/makefile.rb", "#{$srcdir}/extconf.rb"].find {|f| File.exist?(f)}
if (!ok || ($extconf_h && !File.exist?($extconf_h)) ||
!(t = modified?(makefile, MTIMES)) ||
@@ -242,16 +219,21 @@ def extmake(target)
$0 = $PROGRAM_NAME
end
end
- ok &&= File.open(makefile){|f| s = f.gets and !s[DUMMY_SIGNATURE]}
+ ok &&= File.open(makefile){|f| !f.gets[DUMMY_SIGNATURE]}
ok = yield(ok) if block_given?
- unless ok
- atomic_write_open(makefile) do |f|
+ if ok
+ open(makefile, "r+b") do |f|
+ s = f.read.sub!(/^(static:)\s(?!all\b).*/, '\1 all') or break
+ f.rewind
+ f.print(s)
+ f.truncate(f.pos)
+ end unless $static
+ else
+ open(makefile, "wb") do |f|
f.puts "# " + DUMMY_SIGNATURE
f.print(*dummy_makefile(CONFIG["srcdir"]))
end
- return true if !error and target.start_with?("-")
-
mess = "Failed to configure #{target}. It will not be installed.\n"
if error
mess = "#{error}\n#{mess}"
@@ -270,7 +252,7 @@ def extmake(target)
args += ["static"] unless $clean
$extlist.push [$static, target, $target, $preload]
end
- FileUtils.rm_f(old_cleanfiles - $distcleanfiles - $cleanfiles)
+ FileUtils.rm_f(old_cleanfiles - $distcleanfiles)
FileUtils.rm_f(old_objs - $objs)
unless $configure_only or system($make, *args)
$ignore or $continue or return false
@@ -289,20 +271,18 @@ def extmake(target)
unless $mswin
$extflags = split_libs($extflags, $DLDFLAGS, $LDFLAGS).uniq.join(" ")
end
- $extlibs = merge_libs($extlibs, split_libs($libs, $LOCAL_LIBS).map {|lib| lib.sub(/\A\.\//, "ext/#{target}/")})
+ $extlibs = merge_libs($extlibs, split_libs($libs), split_libs($LOCAL_LIBS))
$extpath |= $LIBPATH
end
ensure
Logging::log_close
- if rbconfig0
+ unless $ignore
RbConfig.module_eval {
remove_const(:CONFIG)
const_set(:CONFIG, rbconfig0)
remove_const(:MAKEFILE_CONFIG)
const_set(:MAKEFILE_CONFIG, mkconfig0)
}
- end
- if mkconfig0
MakeMakefile.class_eval {
remove_const(:CONFIG)
const_set(:CONFIG, mkconfig0)
@@ -367,12 +347,6 @@ def parse_args()
opts.on('--command-output=FILE', String) do |v|
$command_output = v
end
- opts.on('--gnumake=yes|no', true) do |v|
- $gnumake = v
- end
- opts.on('--extflags=FLAGS') do |v|
- $extflags = v || ""
- end
end
begin
$optparser.parse!(ARGV)
@@ -493,29 +467,24 @@ end unless $extstatic
ext_prefix = "#{$top_srcdir}/ext"
exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
-default_exclude_exts =
- case
- when $cygwin
- %w''
- when $mswin, $mingw
- %w'pty syslog'
- else
- %w'*win32*'
- end
-withes, withouts = [["--with", nil], ["--without", default_exclude_exts]].collect {|w, d|
+withes, withouts = %w[--with --without].collect {|w|
if !(w = %w[-extensions -ext].collect {|o|arg_config(w+o)}).any?
- d ? proc {|c1| d.any?(&c1)} : proc {true}
+ nil
elsif (w = w.grep(String)).empty?
proc {true}
else
- w = w.collect {|o| o.split(/,/)}.flatten
- w.collect! {|o| o == '+' ? d : o}.flatten! if d
- proc {|c1| w.any?(&c1)}
+ proc {|c1| w.collect {|o| o.split(/,/)}.flatten.any?(&c1)}
end
}
+if withes
+ withouts ||= proc {true}
+else
+ withes = proc {false}
+ withouts ||= withes
+end
cond = proc {|ext, *|
cond1 = proc {|n| File.fnmatch(n, ext)}
- withes.call(cond1) and !withouts.call(cond1)
+ withes.call(cond1) or !withouts.call(cond1)
}
($extension || %w[*]).each do |e|
e = e.sub(/\A(?:\.\/)+/, '')
@@ -526,9 +495,6 @@ cond = proc {|ext, *|
}.find_all {|ext|
with_config(ext, &cond)
}.sort
- if $LIBRUBYARG_SHARED.empty? and CONFIG["EXTSTATIC"] == "static"
- exts.delete_if {|d| File.fnmatch?("-*", d)}
- end
end
if $extout
@@ -545,7 +511,7 @@ Dir::chdir('ext')
hdrdir = $hdrdir
$hdrdir = ($top_srcdir = relative_from(srcdir, $topdir = "..")) + "/include"
exts.each do |d|
- $static = $force_static ? true : $static_ext[d]
+ $static = $force_static ? true : $static_ext[target]
if $ignore or !$nodynamic or $static
extmake(d) or abort
@@ -620,6 +586,9 @@ void Init_ext(void)\n{\n#$extinit}
open(extinit.c, "w") {|fe| fe.print src}
end
+ if RUBY_PLATFORM =~ /beos/
+ $extflags.delete("-L/usr/local/lib")
+ end
$extpath.delete("$(topdir)")
$extflags = libpathflag($extpath) << " " << $extflags.strip
conf = [
@@ -667,7 +636,7 @@ $mflags.unshift("topdir=#$topdir")
ENV.delete("RUBYOPT")
if $configure_only and $command_output
exts.map! {|d| "ext/#{d}/."}
- atomic_write_open($command_output) do |mf|
+ open($command_output, "wb") do |mf|
mf.puts "V = 0"
mf.puts "Q1 = $(V:1=)"
mf.puts "Q = $(Q1:0=@)"
@@ -697,17 +666,14 @@ if $configure_only and $command_output
mf.macro "EXTLDFLAGS", $extflags.split
submakeopts = []
if enable_config("shared", $enable_shared)
- submakeopts << 'DLDOBJS="$(EXTOBJS) $(EXTENCS)"'
- submakeopts << 'EXTOBJS='
+ submakeopts << 'DLDOBJS="$(EXTOBJS) $(ENCOBJS)"'
submakeopts << 'EXTSOLIBS="$(EXTLIBS)"'
submakeopts << 'LIBRUBY_SO_UPDATE=$(LIBRUBY_EXTS)'
else
- submakeopts << 'EXTOBJS="$(EXTOBJS) $(EXTENCS)"'
+ submakeopts << 'EXTOBJS="$(EXTOBJS) $(ENCOBJS)"'
submakeopts << 'EXTLIBS="$(EXTLIBS)"'
end
submakeopts << 'EXTLDFLAGS="$(EXTLDFLAGS)"'
- submakeopts << 'UPDATE_LIBRARIES="$(UPDATE_LIBRARIES)"'
- submakeopts << 'SHOWFLAGS='
mf.macro "SUBMAKEOPTS", submakeopts
mf.puts
targets = %w[all install static install-so install-rb clean distclean realclean]
@@ -720,27 +686,15 @@ if $configure_only and $command_output
mf.puts
mf.puts "#{rubies.join(' ')}: $(extensions:/.=/#{$force_static ? 'static' : 'all'})"
submake = "$(Q)$(MAKE) $(MFLAGS) $(SUBMAKEOPTS)"
- mf.puts "all static: #{rubies.join(' ')}\n"
- $extobjs.each do |tgt|
- mf.puts "#{tgt}: #{File.dirname(tgt)}/static"
- end
- mf.puts "#{rubies.join(' ')}: $(EXTOBJS)#{' libencs' if CONFIG['ENCSTATIC'] == 'static'}"
+ mf.puts "all static:\n\t#{submake} #{rubies.join(' ')}\n"
rubies.each do |tgt|
mf.puts "#{tgt}:\n\t#{submake} $@"
end
- mf.puts "libencs:\n\t$(Q)$(MAKE) -f enc.mk V=$(V) $@"
- mf.puts "ext/extinit.#{$OBJEXT}:\n\t$(Q)$(MAKE) $(MFLAGS) V=$(V) $@" if $static
mf.puts
- if $gnumake == "yes"
- submake = "$(MAKE) -C $(@D)"
- else
- submake = "cd $(@D) && "
- config_string("exec") {|str| submake << str << " "}
- submake << "$(MAKE)"
- end
+ exec = config_string("exec") {|str| str + " "}
targets.each do |tgt|
exts.each do |d|
- mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)"
+ mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)cd $(@D) && #{exec}$(MAKE) $(MFLAGS) V=$(V) $(@F)"
end
end
end
diff --git a/ext/fcntl/extconf.rb b/ext/fcntl/extconf.rb
index 35371ebe18..8b717d4a5b 100644
--- a/ext/fcntl/extconf.rb
+++ b/ext/fcntl/extconf.rb
@@ -1,3 +1,2 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('fcntl')
diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c
index 62780b78c0..3538d94948 100644
--- a/ext/fcntl/fcntl.c
+++ b/ext/fcntl/fcntl.c
@@ -62,7 +62,7 @@ pack up your own arguments to pass as args for locking functions, etc.
*
*/
void
-Init_fcntl(void)
+Init_fcntl()
{
VALUE mFcntl = rb_define_module("Fcntl");
#ifdef F_DUPFD
diff --git a/ext/fiber/extconf.rb b/ext/fiber/extconf.rb
index 7f11e0dafa..904ab94a9c 100644
--- a/ext/fiber/extconf.rb
+++ b/ext/fiber/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('fiber')
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
index f19091b29b..121a08ea19 100644
--- a/ext/fiddle/closure.c
+++ b/ext/fiddle/closure.c
@@ -1,6 +1,4 @@
#include <fiddle.h>
-#include <ruby/thread.h>
-#include "internal.h" /* rb_thread_has_gvl_p */
VALUE cFiddleClosure;
@@ -29,7 +27,7 @@ dealloc(void * ptr)
#if USE_FFI_CLOSURE_ALLOC
ffi_closure_free(cls->pcl);
#else
- munmap(cls->pcl, sizeof(*cls->pcl));
+ munmap(cls->pcl, sizeof(cls->pcl));
#endif
if (cls->argv) xfree(cls->argv);
xfree(cls);
@@ -41,13 +39,14 @@ closure_memsize(const void * ptr)
fiddle_closure * cls = (fiddle_closure *)ptr;
size_t size = 0;
- size += sizeof(*cls);
+ if (ptr) {
+ size += sizeof(*cls);
#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API
- size += ffi_raw_size(&cls->cif);
+ size += ffi_raw_size(&cls->cif);
#endif
- size += sizeof(*cls->argv);
- size += sizeof(ffi_closure);
-
+ size += sizeof(*cls->argv);
+ size += sizeof(ffi_closure);
+ }
return size;
}
@@ -56,19 +55,10 @@ const rb_data_type_t closure_data_type = {
{0, dealloc, closure_memsize,},
};
-struct callback_args {
- ffi_cif *cif;
- void *resp;
- void **args;
- void *ctx;
-};
-
-static void *
-with_gvl_callback(void *ptr)
+void
+callback(ffi_cif *cif, void *resp, void **args, void *ctx)
{
- struct callback_args *x = ptr;
-
- VALUE self = (VALUE)x->ctx;
+ VALUE self = (VALUE)ctx;
VALUE rbargs = rb_iv_get(self, "@args");
VALUE ctype = rb_iv_get(self, "@ctype");
int argc = RARRAY_LENINT(rbargs);
@@ -80,52 +70,52 @@ with_gvl_callback(void *ptr)
cPointer = rb_const_get(mFiddle, rb_intern("Pointer"));
for (i = 0; i < argc; i++) {
- type = NUM2INT(RARRAY_AREF(rbargs, i));
+ type = NUM2INT(RARRAY_PTR(rbargs)[i]);
switch (type) {
case TYPE_VOID:
argc = 0;
break;
case TYPE_INT:
- rb_ary_push(params, INT2NUM(*(int *)x->args[i]));
+ rb_ary_push(params, INT2NUM(*(int *)args[i]));
break;
case -TYPE_INT:
- rb_ary_push(params, UINT2NUM(*(unsigned int *)x->args[i]));
+ rb_ary_push(params, UINT2NUM(*(unsigned int *)args[i]));
break;
case TYPE_VOIDP:
rb_ary_push(params,
rb_funcall(cPointer, rb_intern("[]"), 1,
- PTR2NUM(*(void **)x->args[i])));
+ PTR2NUM(*(void **)args[i])));
break;
case TYPE_LONG:
- rb_ary_push(params, LONG2NUM(*(long *)x->args[i]));
+ rb_ary_push(params, LONG2NUM(*(long *)args[i]));
break;
case -TYPE_LONG:
- rb_ary_push(params, ULONG2NUM(*(unsigned long *)x->args[i]));
+ rb_ary_push(params, ULONG2NUM(*(unsigned long *)args[i]));
break;
case TYPE_CHAR:
- rb_ary_push(params, INT2NUM(*(signed char *)x->args[i]));
+ rb_ary_push(params, INT2NUM(*(signed char *)args[i]));
break;
case -TYPE_CHAR:
- rb_ary_push(params, UINT2NUM(*(unsigned char *)x->args[i]));
+ rb_ary_push(params, UINT2NUM(*(unsigned char *)args[i]));
break;
case TYPE_SHORT:
- rb_ary_push(params, INT2NUM(*(signed short *)x->args[i]));
+ rb_ary_push(params, INT2NUM(*(signed short *)args[i]));
break;
case -TYPE_SHORT:
- rb_ary_push(params, UINT2NUM(*(unsigned short *)x->args[i]));
+ rb_ary_push(params, UINT2NUM(*(unsigned short *)args[i]));
break;
case TYPE_DOUBLE:
- rb_ary_push(params, rb_float_new(*(double *)x->args[i]));
+ rb_ary_push(params, rb_float_new(*(double *)args[i]));
break;
case TYPE_FLOAT:
- rb_ary_push(params, rb_float_new(*(float *)x->args[i]));
+ rb_ary_push(params, rb_float_new(*(float *)args[i]));
break;
#if HAVE_LONG_LONG
case TYPE_LONG_LONG:
- rb_ary_push(params, LL2NUM(*(LONG_LONG *)x->args[i]));
+ rb_ary_push(params, LL2NUM(*(LONG_LONG *)args[i]));
break;
case -TYPE_LONG_LONG:
- rb_ary_push(params, ULL2NUM(*(unsigned LONG_LONG *)x->args[i]));
+ rb_ary_push(params, ULL2NUM(*(unsigned LONG_LONG *)args[i]));
break;
#endif
default:
@@ -133,7 +123,7 @@ with_gvl_callback(void *ptr)
}
}
- ret = rb_funcall2(self, rb_intern("call"), argc, RARRAY_CONST_PTR(params));
+ ret = rb_funcall2(self, rb_intern("call"), argc, RARRAY_PTR(params));
RB_GC_GUARD(params);
type = NUM2INT(ctype);
@@ -141,59 +131,41 @@ with_gvl_callback(void *ptr)
case TYPE_VOID:
break;
case TYPE_LONG:
- *(long *)x->resp = NUM2LONG(ret);
+ *(long *)resp = NUM2LONG(ret);
break;
case -TYPE_LONG:
- *(unsigned long *)x->resp = NUM2ULONG(ret);
+ *(unsigned long *)resp = NUM2ULONG(ret);
break;
case TYPE_CHAR:
case TYPE_SHORT:
case TYPE_INT:
- *(ffi_sarg *)x->resp = NUM2INT(ret);
+ *(ffi_sarg *)resp = NUM2INT(ret);
break;
case -TYPE_CHAR:
case -TYPE_SHORT:
case -TYPE_INT:
- *(ffi_arg *)x->resp = NUM2UINT(ret);
+ *(ffi_arg *)resp = NUM2UINT(ret);
break;
case TYPE_VOIDP:
- *(void **)x->resp = NUM2PTR(ret);
+ *(void **)resp = NUM2PTR(ret);
break;
case TYPE_DOUBLE:
- *(double *)x->resp = NUM2DBL(ret);
+ *(double *)resp = NUM2DBL(ret);
break;
case TYPE_FLOAT:
- *(float *)x->resp = (float)NUM2DBL(ret);
+ *(float *)resp = (float)NUM2DBL(ret);
break;
#if HAVE_LONG_LONG
case TYPE_LONG_LONG:
- *(LONG_LONG *)x->resp = NUM2LL(ret);
+ *(LONG_LONG *)resp = NUM2LL(ret);
break;
case -TYPE_LONG_LONG:
- *(unsigned LONG_LONG *)x->resp = NUM2ULL(ret);
+ *(unsigned LONG_LONG *)resp = NUM2ULL(ret);
break;
#endif
default:
rb_raise(rb_eRuntimeError, "closure retval: %d", type);
}
- return 0;
-}
-
-static void
-callback(ffi_cif *cif, void *resp, void **args, void *ctx)
-{
- struct callback_args x;
-
- x.cif = cif;
- x.resp = resp;
- x.args = args;
- x.ctx = ctx;
-
- if (ruby_thread_has_gvl_p()) {
- (void)with_gvl_callback(&x);
- } else {
- (void)rb_thread_call_with_gvl(with_gvl_callback, &x);
- }
}
static VALUE
@@ -238,7 +210,7 @@ initialize(int rbargc, VALUE argv[], VALUE self)
cl->argv = (ffi_type **)xcalloc(argc + 1, sizeof(ffi_type *));
for (i = 0; i < argc; i++) {
- int type = NUM2INT(RARRAY_AREF(args, i));
+ int type = NUM2INT(RARRAY_PTR(args)[i]);
cl->argv[i] = INT2FFI_TYPE(type);
}
cl->argv[argc] = NULL;
@@ -262,7 +234,7 @@ initialize(int rbargc, VALUE argv[], VALUE self)
#else
result = ffi_prep_closure(pcl, cif, callback, (void *)self);
cl->code = (void *)pcl;
- i = mprotect(pcl, sizeof(*pcl), PROT_READ | PROT_EXEC);
+ i = mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC);
if (i) {
rb_sys_fail("mprotect");
}
@@ -288,7 +260,7 @@ to_i(VALUE self)
}
void
-Init_fiddle_closure(void)
+Init_fiddle_closure()
{
#if 0
mFiddle = rb_define_module("Fiddle"); /* let rdoc know about mFiddle */
diff --git a/ext/fiddle/closure.h b/ext/fiddle/closure.h
index d0a8be6180..1e870e2285 100644
--- a/ext/fiddle/closure.h
+++ b/ext/fiddle/closure.h
@@ -3,6 +3,6 @@
#include <fiddle.h>
-void Init_fiddle_closure(void);
+void Init_fiddle_closure();
#endif
diff --git a/ext/fiddle/conversions.h b/ext/fiddle/conversions.h
index cbc610bad2..d0a08d6bc0 100644
--- a/ext/fiddle/conversions.h
+++ b/ext/fiddle/conversions.h
@@ -33,11 +33,11 @@ VALUE generic_to_value(VALUE rettype, fiddle_generic retval);
#define GENERIC2VALUE(_type, _retval) generic_to_value((_type), (_retval))
#if SIZEOF_VOIDP == SIZEOF_LONG
-# define PTR2NUM(x) (LONG2NUM((long)(x)))
+# define PTR2NUM(x) (ULONG2NUM((unsigned long)(x)))
# define NUM2PTR(x) ((void*)(NUM2ULONG(x)))
#else
/* # error --->> Ruby/DL2 requires sizeof(void*) == sizeof(long) to be compiled. <<--- */
-# define PTR2NUM(x) (LL2NUM((LONG_LONG)(x)))
+# define PTR2NUM(x) (ULL2NUM((unsigned long long)(x)))
# define NUM2PTR(x) ((void*)(NUM2ULL(x)))
#endif
diff --git a/ext/fiddle/depend b/ext/fiddle/depend
index bf264a18eb..e786dc71d2 100644
--- a/ext/fiddle/depend
+++ b/ext/fiddle/depend
@@ -1,57 +1,4 @@
-PWD =
-
-CONFIGURE_LIBFFI = \
- $(LIBFFI_CONFIGURE) --disable-shared \
- --host=$(LIBFFI_ARCH) --enable-builddir=$(arch) \
- CC="$(CC)" CFLAGS="$(LIBFFI_CFLAGS)" \
- LD="$(LD)" LDFLAGS="$(LIBFFI_LDFLAGS)"
-
$(OBJS): $(HDRS) $(ruby_headers) \
$(hdrdir)/ruby/io.h \
$(hdrdir)/ruby/encoding.h \
- $(hdrdir)/ruby/oniguruma.h \
- $(hdrdir)/ruby/thread.h \
- $(top_srcdir)/internal.h
-
-$(STATIC_LIB) $(RUBYARCHDIR)/$(DLLIB) $(DLLIB): $(LIBFFI_A)
-
-$(OBJS): $(FFI_H)
-
-.PHONY: .FORCE hdr
-
-.FORCE:
-
-hdr: $(FFI_H)
-
-configure-libffi build-libffi: .FORCE
-configure-libffi \
-$(LIBFFI_DIR)/include/ffi.h \
-$(LIBFFI_DIR)/include/ffitarget.h \
-$(LIBFFI_DIR)/fficonfig.h \
-$(LIBFFI_DIR)/Makefile:
- $(Q) $(MAKEDIRS) $(LIBFFI_DIR)
- $(Q) $(CONFIGURE_LIBFFI)
-
-build-libffi: $(LIBFFI_A)
-build-libffi $(LIBFFI_A):
- $(Q) $(SUBMAKE_LIBFFI)
-
-clean-libffi:
- $(Q) $(SUBMAKE_LIBFFI) clean
-
-distclean-libffi:
- $(Q) $(SUBMAKE_LIBFFI) distclean
- $(Q) $(RM) $(LIBFFI_DIR)/local.exp
- $(Q) $(RUBY) -rfileutils -e "FileUtils.rmdir(Dir.glob(ARGV[0]+'/**/{,.*/}'), :parents=>true)" $(LIBFFI_DIR)
-
-realclean-libffi:
- $(Q) $(RMALL) $(LIBFFI_DIR)
-
-.PHONY: clean-libffi distclean-libffi realclean-libffi
-.PHONY: clean-none distclean-none realclean-none
-
-clean: clean-$(LIBFFI_CLEAN)
-distclean: distclean-$(LIBFFI_CLEAN)
-realclean: realclean-$(LIBFFI_CLEAN)
-
-.PHONY: configure configure-libffi
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb
index 0359355193..2190aa907f 100644
--- a/ext/fiddle/extconf.rb
+++ b/ext/fiddle/extconf.rb
@@ -1,111 +1,25 @@
-# frozen_string_literal: false
require 'mkmf'
# :stopdoc:
-bundle = enable_config('bundled-libffi')
-if ! bundle
- dir_config 'libffi'
+dir_config 'libffi'
- pkg_config("libffi") and
- ver = pkg_config("libffi", "modversion")
+pkg_config("libffi")
+if ver = pkg_config("libffi", "modversion")
+ ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored.
+ $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver.split('.') }})
+end
- if have_header(ffi_header = 'ffi.h')
- true
- elsif have_header(ffi_header = 'ffi/ffi.h')
+unless have_header('ffi.h')
+ if have_header('ffi/ffi.h')
$defs.push(format('-DUSE_HEADER_HACKS'))
- true
- end and (have_library('ffi') || have_library('libffi'))
-end or
-begin
- ver = bundle != false &&
- Dir.glob("#{$srcdir}/libffi-*/")
- .map {|n| File.basename(n)}
- .max_by {|n| n.scan(/\d+/).map(&:to_i)}
- unless ver
- raise "missing libffi. Please install libffi."
- end
-
- srcdir = "#{$srcdir}/#{ver}"
- ffi_header = 'ffi.h'
- libffi = Struct.new(*%I[dir srcdir builddir include lib a cflags ldflags opt arch]).new
- libffi.dir = ver
- if $srcdir == "."
- libffi.builddir = "#{ver}/#{RUBY_PLATFORM}"
- libffi.srcdir = "."
else
- libffi.builddir = libffi.dir
- libffi.srcdir = relative_from(srcdir, "..")
- end
- libffi.include = "#{libffi.builddir}/include"
- libffi.lib = "#{libffi.builddir}/.libs"
- libffi.a = "#{libffi.lib}/libffi_convenience.#{$LIBEXT}"
- nowarn = CONFIG.merge("warnflags"=>"")
- libffi.cflags = RbConfig.expand("$(CFLAGS)", nowarn)
- ver = ver[/libffi-(.*)/, 1]
-
- FileUtils.mkdir_p(libffi.dir)
- libffi.opt = CONFIG['configure_args'][/'(-C)'/, 1]
- libffi.ldflags = RbConfig.expand("$(LDFLAGS) #{libpathflag([relative_from($topdir, "..")])} #{$LIBRUBYARG}")
- libffi.arch = RbConfig::CONFIG['host']
- if $mswin
- unless find_executable(as = /x64/ =~ libffi.arch ? "ml64" : "ml")
- raise "missing #{as} command."
- end
- $defs << "-DFFI_BUILDING"
- libffi_config = "#{relative_from($srcdir, '..')}/win32/libffi-config.rb"
- config = CONFIG.merge("top_srcdir" => $top_srcdir)
- args = $ruby.gsub(/:\/=\\/, '')
- args.gsub!(/\)\\/, ')/')
- args = args.shellsplit
- args.map! {|s| RbConfig.expand(s, config)}
- args << '-C' << libffi.dir << libffi_config
- opts = {}
- else
- args = %W[sh #{libffi.srcdir}/configure ]
- opts = {chdir: libffi.dir}
- end
- cc = RbConfig::CONFIG['CC']
- cxx = RbConfig::CONFIG['CXX']
- ld = RbConfig::CONFIG['LD']
- args.concat %W[
- --srcdir=#{libffi.srcdir}
- --host=#{libffi.arch}
- --enable-builddir=#{RUBY_PLATFORM}
- ]
- args << ($enable_shared || !$static ? '--enable-shared' : '--enable-static')
- args << libffi.opt if libffi.opt
- args.concat %W[
- CC=#{cc} CFLAGS=#{libffi.cflags}
- CXX=#{cxx} CXXFLAGS=#{RbConfig.expand("$(CXXFLAGS)", nowarn)}
- LD=#{ld} LDFLAGS=#{libffi.ldflags}
- ]
-
- FileUtils.rm_f("#{libffi.include}/ffitarget.h")
- Logging::open do
- Logging.message("%p in %p\n", args, opts)
- unless system(*args, **opts)
- begin
- IO.copy_stream(libffi.dir + "/config.log", Logging.instance_variable_get(:@logfile))
- rescue SystemCallError => e
- Logfile.message("%s\n", e.message)
- end
- raise "failed to configure libffi. Please install libffi."
- end
+ raise "ffi.h is missing. Please install libffi."
end
- if $mswin && File.file?("#{libffi.include}/ffitarget.h")
- FileUtils.rm_f("#{libffi.include}/ffitarget.h")
- end
- unless File.file?("#{libffi.include}/ffitarget.h")
- FileUtils.cp("#{srcdir}/src/x86/ffitarget.h", libffi.include, preserve: true)
- end
- $INCFLAGS << " -I" << libffi.include
end
-if ver
- ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored.
- ver = (ver.split('.') + [0,0])[0,3]
- $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver }})
+unless have_library('ffi') || have_library('libffi')
+ raise "libffi is missing. Please install libffi."
end
have_header 'sys/mman.h'
@@ -124,7 +38,7 @@ elsif have_header "windows.h"
end
end
-have_const('FFI_STDCALL', ffi_header)
+have_const('FFI_STDCALL', 'ffi.h') || have_const('FFI_STDCALL', 'ffi/ffi.h')
config = File.read(RbConfig.expand(File.join($arch_hdrdir, "ruby/config.h")))
types = {"SIZE_T"=>"SSIZE_T", "PTRDIFF_T"=>nil, "INTPTR_T"=>nil}
@@ -140,43 +54,6 @@ types.each do |type, signed|
end
end
-if libffi
- $LOCAL_LIBS.prepend("./#{libffi.a} ").strip! # to exts.mk
- $INCFLAGS.gsub!(/-I#{libffi.dir}/, '-I$(LIBFFI_DIR)')
-end
-$INCFLAGS << " -I$(top_srcdir)"
-create_makefile 'fiddle' do |conf|
- if !libffi
- next conf << "LIBFFI_CLEAN = none\n"
- elsif $gnumake && !$nmake
- submake = "$(MAKE) -C $(LIBFFI_DIR)\n"
- else
- submake = "cd $(LIBFFI_DIR) && \\\n\t\t" << "#{config_string("exec")} $(MAKE)".strip
- end
- if $nmake
- cmd = "$(RUBY) -C $(LIBFFI_DIR) #{libffi_config} --srcdir=$(LIBFFI_SRCDIR)"
- else
- cmd = "cd $(LIBFFI_DIR) && #$exec $(LIBFFI_SRCDIR)/configure #{libffi.opt}"
- end
- sep = "/"
- seprpl = config_string('BUILD_FILE_SEPARATOR') {|s| sep = s; ":/=#{s}" if s != "/"} || ""
- conf << <<-MK.gsub(/^ +| +$/, '')
- PWD =
- LIBFFI_CONFIGURE = #{cmd}
- LIBFFI_ARCH = #{libffi.arch}
- LIBFFI_SRCDIR = #{libffi.srcdir.sub(libffi.dir, '$(LIBFFI_DIR)')}
- LIBFFI_DIR = #{libffi.dir}
- LIBFFI_A = #{libffi.a.sub(libffi.dir, '$(LIBFFI_DIR)')}
- LIBFFI_CFLAGS = #{libffi.cflags}
- LIBFFI_LDFLAGS = #{libffi.ldflags}
- FFI_H = $(LIBFFI_DIR)/include/ffi.h
- SUBMAKE_LIBFFI = #{submake}
- LIBFFI_CLEAN = libffi
- MK
-end
-
-if libffi
- $LIBPATH.pop
-end
+create_makefile 'fiddle'
# :startdoc:
diff --git a/ext/fiddle/extlibs b/ext/fiddle/extlibs
deleted file mode 100644
index 7d5fda5247..0000000000
--- a/ext/fiddle/extlibs
+++ /dev/null
@@ -1,2 +0,0 @@
-ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz md5:83b89587607e3eb65c70d361f13bab43
- win32/libffi-3.2.1-mswin.patch -p0
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 9f3d1537d6..7a7c708245 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -48,7 +48,7 @@ rb_fiddle_malloc(VALUE self, VALUE size)
{
void *ptr;
- ptr = (void*)ruby_xmalloc(NUM2SIZET(size));
+ ptr = (void*)ruby_xmalloc(NUM2INT(size));
return PTR2NUM(ptr);
}
@@ -64,7 +64,7 @@ rb_fiddle_realloc(VALUE self, VALUE addr, VALUE size)
{
void *ptr = NUM2PTR(addr);
- ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
+ ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
return PTR2NUM(ptr);
}
diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h
index d2583c1cbf..b37c37bc65 100644
--- a/ext/fiddle/fiddle.h
+++ b/ext/fiddle/fiddle.h
@@ -104,6 +104,11 @@
#include <conversions.h>
#include <function.h>
+/* FIXME
+ * These constants need to match up with DL. We need to refactor this to use
+ * the DL header files or vice versa.
+ */
+
#define TYPE_VOID 0
#define TYPE_VOIDP 1
#define TYPE_CHAR 2
diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c
index 8e280567db..4a5a5892a6 100644
--- a/ext/fiddle/function.c
+++ b/ext/fiddle/function.c
@@ -1,33 +1,7 @@
#include <fiddle.h>
-#include <ruby/thread.h>
-
-#ifdef PRIsVALUE
-# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
-# define RB_OBJ_STRING(obj) (obj)
-#else
-# define PRIsVALUE "s"
-# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
-# define RB_OBJ_STRING(obj) StringValueCStr(obj)
-#endif
VALUE cFiddleFunction;
-#define MAX_ARGS (SIZE_MAX / (sizeof(void *) + sizeof(fiddle_generic)) - 1)
-
-#define Check_Max_Args(name, len) \
- Check_Max_Args_(name, len, "")
-#define Check_Max_Args_Long(name, len) \
- Check_Max_Args_(name, len, "l")
-#define Check_Max_Args_(name, len, fmt) \
- if ((size_t)(len) < MAX_ARGS) { \
- /* OK */ \
- } \
- else { \
- rb_raise(rb_eTypeError, \
- name" is so large that it can cause integer overflow (%"fmt"d)", \
- (len)); \
- }
-
static void
deallocate(void *p)
{
@@ -42,11 +16,12 @@ function_memsize(const void *p)
/* const */ffi_cif *ptr = (ffi_cif *)p;
size_t size = 0;
- size += sizeof(*ptr);
+ if (ptr) {
+ size += sizeof(*ptr);
#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API
- size += ffi_raw_size(ptr);
+ size += ffi_raw_size(ptr);
#endif
-
+ }
return size;
}
@@ -78,47 +53,27 @@ rb_fiddle_new_function(VALUE address, VALUE arg_types, VALUE ret_type)
static int
parse_keyword_arg_i(VALUE key, VALUE value, VALUE self)
{
- if (key == ID2SYM(rb_intern("name"))) {
- rb_iv_set(self, "@name", value);
- } else {
- rb_raise(rb_eArgError, "unknown keyword: %"PRIsVALUE,
- RB_OBJ_STRING(key));
- }
- return ST_CONTINUE;
+ if (key == ID2SYM(rb_intern("name"))) {
+ rb_iv_set(self, "@name", value);
+ } else {
+ rb_raise(rb_eArgError, "unknown keyword: %"PRIsVALUE, key);
+ }
+ return ST_CONTINUE;
}
static VALUE
initialize(int argc, VALUE argv[], VALUE self)
{
ffi_cif * cif;
- ffi_type **arg_types, *rtype;
+ ffi_type **arg_types;
ffi_status result;
- VALUE ptr, args, ret_type, abi, kwds, ary;
- int i, len;
- int nabi;
- void *cfunc;
+ VALUE ptr, args, ret_type, abi, kwds;
+ int i;
rb_scan_args(argc, argv, "31:", &ptr, &args, &ret_type, &abi, &kwds);
- ptr = rb_Integer(ptr);
- cfunc = NUM2PTR(ptr);
- PTR2NUM(cfunc);
- nabi = NIL_P(abi) ? FFI_DEFAULT_ABI : NUM2INT(abi);
- abi = INT2FIX(nabi);
- i = NUM2INT(ret_type);
- rtype = INT2FFI_TYPE(i);
- ret_type = INT2FIX(i);
+ if(NIL_P(abi)) abi = INT2NUM(FFI_DEFAULT_ABI);
Check_Type(args, T_ARRAY);
- len = RARRAY_LENINT(args);
- Check_Max_Args("args", len);
- ary = rb_ary_subseq(args, 0, len);
- for (i = 0; i < RARRAY_LEN(args); i++) {
- VALUE a = RARRAY_PTR(args)[i];
- int type = NUM2INT(a);
- (void)INT2FFI_TYPE(type); /* raise */
- if (INT2FIX(type) != a) rb_ary_store(ary, i, INT2FIX(type));
- }
- OBJ_FREEZE(ary);
rb_iv_set(self, "@ptr", ptr);
rb_iv_set(self, "@args", args);
@@ -129,15 +84,20 @@ initialize(int argc, VALUE argv[], VALUE self)
TypedData_Get_Struct(self, ffi_cif, &function_data_type, cif);
- arg_types = xcalloc(len + 1, sizeof(ffi_type *));
+ arg_types = xcalloc(RARRAY_LEN(args) + 1, sizeof(ffi_type *));
for (i = 0; i < RARRAY_LEN(args); i++) {
- int type = NUM2INT(RARRAY_AREF(args, i));
+ int type = NUM2INT(RARRAY_PTR(args)[i]);
arg_types[i] = INT2FFI_TYPE(type);
}
- arg_types[len] = NULL;
+ arg_types[RARRAY_LEN(args)] = NULL;
- result = ffi_prep_cif(cif, nabi, len, rtype, arg_types);
+ result = ffi_prep_cif (
+ cif,
+ NUM2INT(abi),
+ RARRAY_LENINT(args),
+ INT2FFI_TYPE(NUM2INT(ret_type)),
+ arg_types);
if (result)
rb_raise(rb_eRuntimeError, "error creating CIF %d", result);
@@ -145,42 +105,26 @@ initialize(int argc, VALUE argv[], VALUE self)
return self;
}
-struct nogvl_ffi_call_args {
- ffi_cif *cif;
- void (*fn)(void);
- void **values;
- fiddle_generic retval;
-};
-
-static void *
-nogvl_ffi_call(void *ptr)
-{
- struct nogvl_ffi_call_args *args = ptr;
-
- ffi_call(args->cif, args->fn, &args->retval, args->values);
-
- return NULL;
-}
-
static VALUE
function_call(int argc, VALUE argv[], VALUE self)
{
- struct nogvl_ffi_call_args args = { 0 };
+ ffi_cif * cif;
+ fiddle_generic retval;
fiddle_generic *generic_args;
+ void **values;
VALUE cfunc, types, cPointer;
int i;
- VALUE alloc_buffer = 0;
cfunc = rb_iv_get(self, "@ptr");
types = rb_iv_get(self, "@args");
cPointer = rb_const_get(mFiddle, rb_intern("Pointer"));
- Check_Max_Args("number of arguments", argc);
- if (argc != (i = RARRAY_LENINT(types))) {
- rb_error_arity(argc, i, i);
+ if(argc != RARRAY_LENINT(types)) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+ argc, RARRAY_LENINT(types));
}
- TypedData_Get_Struct(self, ffi_cif, &function_data_type, args.cif);
+ TypedData_Get_Struct(self, ffi_cif, &function_data_type, cif);
if (rb_safe_level() >= 1) {
for (i = 0; i < argc; i++) {
@@ -191,17 +135,14 @@ function_call(int argc, VALUE argv[], VALUE self)
}
}
- generic_args = ALLOCV(alloc_buffer,
- (size_t)(argc + 1) * sizeof(void *) + (size_t)argc * sizeof(fiddle_generic));
- args.values = (void **)((char *)generic_args +
- (size_t)argc * sizeof(fiddle_generic));
+ values = xcalloc((size_t)argc + 1, (size_t)sizeof(void *));
+ generic_args = xcalloc((size_t)argc, (size_t)sizeof(fiddle_generic));
for (i = 0; i < argc; i++) {
- VALUE type = RARRAY_AREF(types, i);
+ VALUE type = RARRAY_PTR(types)[i];
VALUE src = argv[i];
- int argtype = FIX2INT(type);
- if (argtype == TYPE_VOIDP) {
+ if(NUM2INT(type) == TYPE_VOIDP) {
if(NIL_P(src)) {
src = INT2FIX(0);
} else if(cPointer != CLASS_OF(src)) {
@@ -210,22 +151,22 @@ function_call(int argc, VALUE argv[], VALUE self)
src = rb_Integer(src);
}
- VALUE2GENERIC(argtype, src, &generic_args[i]);
- args.values[i] = (void *)&generic_args[i];
+ VALUE2GENERIC(NUM2INT(type), src, &generic_args[i]);
+ values[i] = (void *)&generic_args[i];
}
- args.values[argc] = NULL;
- args.fn = NUM2PTR(cfunc);
+ values[argc] = NULL;
- (void)rb_thread_call_without_gvl(nogvl_ffi_call, &args, 0, 0);
+ ffi_call(cif, NUM2PTR(rb_Integer(cfunc)), &retval, values);
rb_funcall(mFiddle, rb_intern("last_error="), 1, INT2NUM(errno));
#if defined(_WIN32)
rb_funcall(mFiddle, rb_intern("win32_last_error="), 1, INT2NUM(errno));
#endif
- ALLOCV_END(alloc_buffer);
+ xfree(values);
+ xfree(generic_args);
- return GENERIC2VALUE(rb_iv_get(self, "@return_type"), args.retval);
+ return GENERIC2VALUE(rb_iv_get(self, "@return_type"), retval);
}
void
@@ -258,7 +199,7 @@ Init_fiddle_function(void)
*
* === ABI check
*
- * @libc = Fiddle.dlopen "/lib/libc.so.6"
+ * @libc = DL.dlopen "/lib/libc.so.6"
* #=> #<Fiddle::Handle:0x00000001d7a8d8>
* f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
* #=> #<Fiddle::Function:0x00000001d8ee00>
@@ -290,9 +231,7 @@ Init_fiddle_function(void)
/*
* Document-method: call
*
- * Calls the constructed Function, with +args+.
- * Caller must ensure the underlying function is called in a
- * thread-safe manner if running in a multi-threaded process.
+ * Calls the constructed Function, with +args+
*
* For an example see Fiddle::Function
*
diff --git a/ext/fiddle/function.h b/ext/fiddle/function.h
index 829e592c8a..e5465ab64f 100644
--- a/ext/fiddle/function.h
+++ b/ext/fiddle/function.h
@@ -3,6 +3,6 @@
#include <fiddle.h>
-void Init_fiddle_function(void);
+void Init_fiddle_function();
#endif
diff --git a/ext/fiddle/handle.c b/ext/fiddle/handle.c
index e727ccfd00..330dbafe67 100644
--- a/ext/fiddle/handle.c
+++ b/ext/fiddle/handle.c
@@ -1,8 +1,6 @@
#include <ruby.h>
#include <fiddle.h>
-#define SafeStringValueCStr(v) (rb_check_safe_obj(rb_string_value(&v)), StringValueCStr(v))
-
VALUE rb_cHandle;
struct dl_handle {
@@ -42,13 +40,12 @@ fiddle_handle_free(void *ptr)
if( fiddle_handle->ptr && fiddle_handle->open && fiddle_handle->enable_close ){
dlclose(fiddle_handle->ptr);
}
- xfree(ptr);
}
static size_t
fiddle_handle_memsize(const void *ptr)
{
- return sizeof(struct dl_handle);
+ return ptr ? sizeof(struct dl_handle) : 0;
}
static const rb_data_type_t fiddle_handle_data_type = {
@@ -145,17 +142,19 @@ rb_fiddle_handle_initialize(int argc, VALUE argv[], VALUE self)
cflag = RTLD_LAZY | RTLD_GLOBAL;
break;
case 1:
- clib = NIL_P(lib) ? NULL : SafeStringValueCStr(lib);
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
cflag = RTLD_LAZY | RTLD_GLOBAL;
break;
case 2:
- clib = NIL_P(lib) ? NULL : SafeStringValueCStr(lib);
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
cflag = NUM2INT(flag);
break;
default:
rb_bug("rb_fiddle_handle_new");
}
+ rb_secure(2);
+
#if defined(_WIN32)
if( !clib ){
HANDLE rb_libruby_handle(void);
@@ -170,7 +169,6 @@ rb_fiddle_handle_initialize(int argc, VALUE argv[], VALUE self)
# ifdef _WIN32_WCE
ptr = dlopen("coredll.dll", cflag);
# else
- (void)cflag;
ptr = w32_coredll();
# endif
}
@@ -264,7 +262,7 @@ rb_fiddle_handle_to_i(VALUE self)
return PTR2NUM(fiddle_handle);
}
-static VALUE fiddle_handle_sym(void *handle, VALUE symbol);
+static VALUE fiddle_handle_sym(void *handle, const char *symbol);
/*
* Document-method: sym
@@ -283,7 +281,7 @@ rb_fiddle_handle_sym(VALUE self, VALUE sym)
rb_raise(rb_eFiddleError, "closed handle");
}
- return fiddle_handle_sym(fiddle_handle->ptr, sym);
+ return fiddle_handle_sym(fiddle_handle->ptr, StringValueCStr(sym));
}
#ifndef RTLD_NEXT
@@ -306,21 +304,21 @@ rb_fiddle_handle_sym(VALUE self, VALUE sym)
static VALUE
rb_fiddle_handle_s_sym(VALUE self, VALUE sym)
{
- return fiddle_handle_sym(RTLD_NEXT, sym);
+ return fiddle_handle_sym(RTLD_NEXT, StringValueCStr(sym));
}
static VALUE
-fiddle_handle_sym(void *handle, VALUE symbol)
+fiddle_handle_sym(void *handle, const char *name)
{
#if defined(HAVE_DLERROR)
const char *err;
-# define CHECK_DLERROR if ((err = dlerror()) != 0) { func = 0; }
+# define CHECK_DLERROR if( err = dlerror() ){ func = 0; }
#else
# define CHECK_DLERROR
#endif
void (*func)();
- const char *name = SafeStringValueCStr(symbol);
+ rb_secure(2);
#ifdef HAVE_DLERROR
dlerror();
#endif
@@ -368,7 +366,7 @@ fiddle_handle_sym(void *handle, VALUE symbol)
}
#endif
if( !func ){
- rb_raise(rb_eFiddleError, "unknown symbol \"%"PRIsVALUE"\"", symbol);
+ rb_raise(rb_eFiddleError, "unknown symbol \"%s\"", name);
}
return PTR2NUM(func);
diff --git a/ext/fiddle/lib/fiddle.rb b/ext/fiddle/lib/fiddle.rb
index 5208eb9328..ae6e299637 100644
--- a/ext/fiddle/lib/fiddle.rb
+++ b/ext/fiddle/lib/fiddle.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'fiddle.so'
require 'fiddle/function'
require 'fiddle/closure'
diff --git a/ext/fiddle/lib/fiddle/closure.rb b/ext/fiddle/lib/fiddle/closure.rb
index 0b9adbb60a..beb90ecbe5 100644
--- a/ext/fiddle/lib/fiddle/closure.rb
+++ b/ext/fiddle/lib/fiddle/closure.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Fiddle
class Closure
diff --git a/ext/fiddle/lib/fiddle/cparser.rb b/ext/fiddle/lib/fiddle/cparser.rb
index 6b9da9fa7c..43fb184a12 100644
--- a/ext/fiddle/lib/fiddle/cparser.rb
+++ b/ext/fiddle/lib/fiddle/cparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Fiddle
# A mixin that provides methods for parsing C struct and prototype signatures.
#
@@ -8,14 +7,8 @@ module Fiddle
# include Fiddle::CParser
# #=> Object
#
- # parse_ctype('int')
- # #=> Fiddle::TYPE_INT
- #
- # parse_struct_signature(['int i', 'char c'])
- # #=> [[Fiddle::TYPE_INT, Fiddle::TYPE_CHAR], ["i", "c"]]
- #
- # parse_signature('double sum(double, double)')
- # #=> ["sum", Fiddle::TYPE_DOUBLE, [Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]]
+ # parse_ctype('int increment(int)')
+ # #=> ["increment", Fiddle::TYPE_INT, [Fiddle::TYPE_INT]]
#
module CParser
# Parses a C struct's members
@@ -28,33 +21,37 @@ module Fiddle
# parse_struct_signature(['int i', 'char c'])
# #=> [[Fiddle::TYPE_INT, Fiddle::TYPE_CHAR], ["i", "c"]]
#
- # parse_struct_signature(['char buffer[80]'])
- # #=> [[[Fiddle::TYPE_CHAR, 80]], ["buffer"]]
- #
def parse_struct_signature(signature, tymap=nil)
- if signature.is_a?(String)
- signature = split_arguments(signature, /[,;]/)
+ if( signature.is_a?(String) )
+ signature = signature.split(/\s*,\s*/)
end
mems = []
tys = []
signature.each{|msig|
- msig = compact(msig)
- case msig
- when /^[\w\*\s]+[\*\s](\w+)$/
- mems.push($1)
- tys.push(parse_ctype(msig, tymap))
- when /^[\w\*\s]+\(\*(\w+)\)\(.*?\)$/
- mems.push($1)
- tys.push(parse_ctype(msig, tymap))
- when /^([\w\*\s]+[\*\s])(\w+)\[(\d+)\]$/
- mems.push($2)
- tys.push([parse_ctype($1.strip, tymap), $3.to_i])
- when /^([\w\*\s]+)\[(\d+)\](\w+)$/
- mems.push($3)
- tys.push([parse_ctype($1.strip, tymap), $2.to_i])
- else
- raise(RuntimeError,"can't parse the struct member: #{msig}")
+ tks = msig.split(/\s+(\*)?/)
+ ty = tks[0..-2].join(" ")
+ member = tks[-1]
+
+ case ty
+ when /\[(\d+)\]/
+ n = $1.to_i
+ ty.gsub!(/\s*\[\d+\]/,"")
+ ty = [ty, n]
+ when /\[\]/
+ ty.gsub!(/\s*\[\]/, "*")
end
+
+ case member
+ when /\[(\d+)\]/
+ ty = [ty, $1.to_i]
+ member.gsub!(/\s*\[\d+\]/,"")
+ when /\[\]/
+ ty = ty + "*"
+ member.gsub!(/\s*\[\]/, "")
+ end
+
+ mems.push(member)
+ tys.push(parse_ctype(ty,tymap))
}
return tys, mems
end
@@ -73,21 +70,22 @@ module Fiddle
# parse_signature('double sum(double, double)')
# #=> ["sum", Fiddle::TYPE_DOUBLE, [Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]]
#
- # parse_signature('void update(void (*cb)(int code))')
- # #=> ["update", Fiddle::TYPE_VOID, [Fiddle::TYPE_VOIDP]]
- #
- # parse_signature('char (*getbuffer(void))[80]')
- # #=> ["getbuffer", Fiddle::TYPE_VOIDP, []]
- #
def parse_signature(signature, tymap=nil)
tymap ||= {}
- case compact(signature)
- when /^(?:[\w\*\s]+)\(\*(\w+)\((.*?)\)\)(?:\[\w*\]|\(.*?\));?$/
- func, args = $1, $2
- return [func, TYPE_VOIDP, split_arguments(args).collect {|arg| parse_ctype(arg, tymap)}]
- when /^([\w\*\s]+[\*\s])(\w+)\((.*?)\);?$/
- ret, func, args = $1.strip, $2, $3
- return [func, parse_ctype(ret, tymap), split_arguments(args).collect {|arg| parse_ctype(arg, tymap)}]
+ signature = signature.gsub(/\s+/, " ").strip
+ case signature
+ when /^([\w@\*\s]+)\(([\w\*\s\,\[\]]*)\)$/
+ ret = $1
+ (args = $2).strip!
+ ret = ret.split(/\s+/)
+ args = args.split(/\s*,\s*/)
+ func = ret.pop
+ if( func =~ /^\*/ )
+ func.gsub!(/^\*+/,"")
+ ret.push("*")
+ end
+ ret = ret.join(" ")
+ return [func, parse_ctype(ret, tymap), args.collect{|arg| parse_ctype(arg, tymap)}]
else
raise(RuntimeError,"can't parse the function prototype: #{signature}")
end
@@ -109,68 +107,64 @@ module Fiddle
# parse_ctype('int')
# #=> Fiddle::TYPE_INT
#
- # parse_ctype('double diff')
+ # parse_ctype('double')
# #=> Fiddle::TYPE_DOUBLE
#
- # parse_ctype('unsigned char byte')
+ # parse_ctype('unsigned char')
# #=> -Fiddle::TYPE_CHAR
#
- # parse_ctype('const char* const argv[]')
- # #=> -Fiddle::TYPE_VOIDP
- #
def parse_ctype(ty, tymap=nil)
tymap ||= {}
case ty
when Array
return [parse_ctype(ty[0], tymap), ty[1]]
- when 'void'
+ when "void"
return TYPE_VOID
- when /^(?:(?:signed\s+)?long\s+long(?:\s+int\s+)?|int64_t)(?:\s+\w+)?$/
+ when "char"
+ return TYPE_CHAR
+ when "unsigned char"
+ return -TYPE_CHAR
+ when "short"
+ return TYPE_SHORT
+ when "unsigned short"
+ return -TYPE_SHORT
+ when "int"
+ return TYPE_INT
+ when "unsigned int", 'uint'
+ return -TYPE_INT
+ when "long"
+ return TYPE_LONG
+ when "unsigned long"
+ return -TYPE_LONG
+ when "long long"
if( defined?(TYPE_LONG_LONG) )
return TYPE_LONG_LONG
else
raise(RuntimeError, "unsupported type: #{ty}")
end
- when /^(?:unsigned\s+long\s+long(?:\s+int\s+)?|uint64_t)(?:\s+\w+)?$/
+ when "unsigned long long"
if( defined?(TYPE_LONG_LONG) )
return -TYPE_LONG_LONG
else
raise(RuntimeError, "unsupported type: #{ty}")
end
- when /^(?:signed\s+)?long(?:\s+int\s+)?(?:\s+\w+)?$/
- return TYPE_LONG
- when /^unsigned\s+long(?:\s+int\s+)?(?:\s+\w+)?$/
- return -TYPE_LONG
- when /^(?:signed\s+)?int(?:\s+\w+)?$/
- return TYPE_INT
- when /^(?:unsigned\s+int|uint)(?:\s+\w+)?$/
- return -TYPE_INT
- when /^(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?$/
- return TYPE_SHORT
- when /^unsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?$/
- return -TYPE_SHORT
- when /^(?:signed\s+)?char(?:\s+\w+)?$/
- return TYPE_CHAR
- when /^unsigned\s+char(?:\s+\w+)?$/
- return -TYPE_CHAR
- when /^float(?:\s+\w+)?$/
+ when "float"
return TYPE_FLOAT
- when /^double(?:\s+\w+)?$/
+ when "double"
return TYPE_DOUBLE
- when /^size_t(?:\s+\w+)?$/
+ when "size_t"
return TYPE_SIZE_T
- when /^ssize_t(?:\s+\w+)?$/
+ when "ssize_t"
return TYPE_SSIZE_T
- when /^ptrdiff_t(?:\s+\w+)?$/
+ when "ptrdiff_t"
return TYPE_PTRDIFF_T
- when /^intptr_t(?:\s+\w+)?$/
+ when "intptr_t"
return TYPE_INTPTR_T
- when /^uintptr_t(?:\s+\w+)?$/
+ when "uintptr_t"
return TYPE_UINTPTR_T
- when /\*/, /\[[\s\d]*\]/
+ when /\*/, /\[\s*\]/
return TYPE_VOIDP
else
- ty = ty.split(' ', 2)[0]
if( tymap[ty] )
return parse_ctype(tymap[ty], tymap)
else
@@ -178,17 +172,5 @@ module Fiddle
end
end
end
-
- private
-
- def split_arguments(arguments, sep=',')
- return [] if arguments.strip == 'void'
- arguments.scan(/([\w\*\s]+\(\*\w*\)\(.*?\)|[\w\*\s\[\]]+)(?:#{sep}\s*|$)/).collect {|m| m[0]}
- end
-
- def compact(signature)
- signature.gsub(/\s+/, ' ').gsub(/\s*([\(\)\[\]\*,;])\s*/, '\1').strip
- end
-
end
end
diff --git a/ext/fiddle/lib/fiddle/function.rb b/ext/fiddle/lib/fiddle/function.rb
index fcd90dfd26..ab7496e944 100644
--- a/ext/fiddle/lib/fiddle/function.rb
+++ b/ext/fiddle/lib/fiddle/function.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Fiddle
class Function
# The ABI of the Function.
diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb
index 7f959ed20b..8b948e8f23 100644
--- a/ext/fiddle/lib/fiddle/import.rb
+++ b/ext/fiddle/lib/fiddle/import.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'fiddle'
require 'fiddle/struct'
require 'fiddle/cparser'
@@ -64,7 +63,7 @@ module Fiddle
extend Importer
# Creates an array of handlers for the given +libs+, can be an instance of
- # Fiddle::Handle, Fiddle::Importer, or will create a new instance of
+ # Fiddle::Handle, Fiddle::Importer, or will create a new istance of
# Fiddle::Handle using Fiddle.dlopen
#
# Raises a DLError if the library cannot be loaded.
@@ -113,7 +112,7 @@ module Fiddle
when TYPE_LONG
return SIZEOF_LONG
when TYPE_LONG_LONG
- return SIZEOF_LONG_LONG
+ return SIZEOF_LONG_LON
when TYPE_FLOAT
return SIZEOF_FLOAT
when TYPE_DOUBLE
diff --git a/ext/fiddle/lib/fiddle/pack.rb b/ext/fiddle/lib/fiddle/pack.rb
index 6301068450..e4e9542cc0 100644
--- a/ext/fiddle/lib/fiddle/pack.rb
+++ b/ext/fiddle/lib/fiddle/pack.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'fiddle'
module Fiddle
diff --git a/ext/fiddle/lib/fiddle/struct.rb b/ext/fiddle/lib/fiddle/struct.rb
index 233a987269..695a4d2247 100644
--- a/ext/fiddle/lib/fiddle/struct.rb
+++ b/ext/fiddle/lib/fiddle/struct.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'fiddle'
require 'fiddle/value'
require 'fiddle/pack'
diff --git a/ext/fiddle/lib/fiddle/types.rb b/ext/fiddle/lib/fiddle/types.rb
index 8a72635a69..02c1d25a37 100644
--- a/ext/fiddle/lib/fiddle/types.rb
+++ b/ext/fiddle/lib/fiddle/types.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Fiddle
# Adds Windows type aliases to the including class for use with
# Fiddle::Importer.
diff --git a/ext/fiddle/lib/fiddle/value.rb b/ext/fiddle/lib/fiddle/value.rb
index ac318cf2c4..8d71e47ce6 100644
--- a/ext/fiddle/lib/fiddle/value.rb
+++ b/ext/fiddle/lib/fiddle/value.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'fiddle'
module Fiddle
diff --git a/ext/fiddle/pointer.c b/ext/fiddle/pointer.c
index 932bc576c5..4f4842fc33 100644
--- a/ext/fiddle/pointer.c
+++ b/ext/fiddle/pointer.c
@@ -7,15 +7,6 @@
#include <ctype.h>
#include <fiddle.h>
-#ifdef PRIsVALUE
-# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
-# define RB_OBJ_STRING(obj) (obj)
-#else
-# define PRIsVALUE "s"
-# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
-# define RB_OBJ_STRING(obj) StringValueCStr(obj)
-#endif
-
VALUE rb_cPointer;
typedef void (*freefunc_t)(void*);
@@ -65,14 +56,13 @@ fiddle_ptr_free(void *ptr)
(*(data->free))(data->ptr);
}
}
- xfree(ptr);
}
static size_t
fiddle_ptr_memsize(const void *ptr)
{
const struct ptr_data *data = ptr;
- return sizeof(*data) + data->size;
+ return data ? sizeof(*data) + data->size : 0;
}
static const rb_data_type_t fiddle_ptr_data_type = {
@@ -437,10 +427,12 @@ static VALUE
rb_fiddle_ptr_inspect(VALUE self)
{
struct ptr_data *data;
+ char str[1024];
TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
- return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
- RB_OBJ_CLASSNAME(self), data, data->ptr, data->size, data->free);
+ snprintf(str, 1023, "#<%s:%p ptr=%p size=%ld free=%p>",
+ rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
+ return rb_str_new2(str);
}
/*
diff --git a/ext/fiddle/win32/fficonfig.h b/ext/fiddle/win32/fficonfig.h
deleted file mode 100755
index 776808159c..0000000000
--- a/ext/fiddle/win32/fficonfig.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#define HAVE_ALLOCA 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TYPES_H 1
-#if _MSC_VER >= 1600
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#endif
-
-#define SIZEOF_DOUBLE 8
-#if defined(X86_WIN64)
-#define SIZEOF_SIZE_T 8
-#else
-#define SIZEOF_SIZE_T 4
-#endif
-
-#define STACK_DIRECTION -1
-
-#define STDC_HEADERS 1
-
-#ifdef LIBFFI_ASM
-#define FFI_HIDDEN(name)
-#else
-#define FFI_HIDDEN
-#endif
-
diff --git a/ext/fiddle/win32/libffi-3.2.1-mswin.patch b/ext/fiddle/win32/libffi-3.2.1-mswin.patch
deleted file mode 100644
index f9100e703d..0000000000
--- a/ext/fiddle/win32/libffi-3.2.1-mswin.patch
+++ /dev/null
@@ -1,191 +0,0 @@
-diff -ru libffi-3.2.1/src/x86/ffi.c libffi-3.2.1/src/x86/ffi.c
---- libffi-3.2.1/src/x86/ffi.c 2014-11-08 21:47:24.000000000 +0900
-+++ libffi-3.2.1/src/x86/ffi.c 2014-12-25 18:46:14.806761900 +0900
-@@ -99,11 +99,13 @@
- i != 0;
- i--, p_arg += dir, p_argv += dir)
- {
-+ size_t z;
-+
- /* Align if necessary */
- if ((sizeof(void*) - 1) & (size_t) argp)
- argp = (char *) ALIGN(argp, sizeof(void*));
-
-- size_t z = (*p_arg)->size;
-+ z = (*p_arg)->size;
-
- #ifdef X86_WIN64
- if (z > FFI_SIZEOF_ARG
-@@ -202,6 +204,7 @@
- on top of stack, so that those can be moved to registers by call-handler. */
- if (stack_args_count > 0)
- {
-+ int i;
- if (dir < 0 && stack_args_count > 1)
- {
- /* Reverse order if iterating arguments backwards */
-@@ -210,7 +213,6 @@
- *(ffi_arg*) p_stack_data[stack_args_count - 1] = tmp;
- }
-
-- int i;
- for (i = 0; i < stack_args_count; i++)
- {
- if (p_stack_data[i] != argp2)
-@@ -569,11 +571,12 @@
- i < cif->nargs && passed_regs < max_stack_count;
- i++, p_arg++)
- {
-+ size_t sz;
- if ((*p_arg)->type == FFI_TYPE_FLOAT
- || (*p_arg)->type == FFI_TYPE_STRUCT)
- continue;
-
-- size_t sz = (*p_arg)->size;
-+ sz = (*p_arg)->size;
- if(sz == 0 || sz > FFI_SIZEOF_ARG)
- continue;
-
-@@ -599,11 +602,13 @@
- i != 0;
- i--, p_arg += dir, p_argv += dir)
- {
-+ size_t z;
-+
- /* Align if necessary */
- if ((sizeof(void*) - 1) & (size_t) argp)
- argp = (char *) ALIGN(argp, sizeof(void*));
-
-- size_t z = (*p_arg)->size;
-+ z = (*p_arg)->size;
-
- #ifdef X86_WIN64
- if (z > FFI_SIZEOF_ARG
-@@ -642,7 +647,7 @@
- #endif
- }
-
-- return (size_t)argp - (size_t)stack;
-+ return (int)((size_t)argp - (size_t)stack);
- }
-
- #define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \
-@@ -855,11 +860,12 @@
-
- for (i = 0; i < cif->nargs && passed_regs <= max_regs; i++)
- {
-+ size_t sz;
- if (cif->arg_types[i]->type == FFI_TYPE_FLOAT
- || cif->arg_types[i]->type == FFI_TYPE_STRUCT)
- continue;
-
-- size_t sz = cif->arg_types[i]->size;
-+ sz = cif->arg_types[i]->size;
- if (sz == 0 || sz > FFI_SIZEOF_ARG)
- continue;
-
-diff -ru libffi-3.2.1/src/x86/ffitarget.h libffi-3.2.1/src/x86/ffitarget.h
---- libffi-3.2.1/src/x86/ffitarget.h 2014-11-08 21:47:24.000000000 +0900
-+++ libffi-3.2.1/src/x86/ffitarget.h 2014-12-22 15:45:54.000000000 +0900
-@@ -50,7 +50,9 @@
- #endif
-
- #define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
-+#ifndef _MSC_VER
- #define FFI_TARGET_HAS_COMPLEX_TYPE
-+#endif
-
- /* ---- Generic type definitions ----------------------------------------- */
-
-diff -ru libffi-3.2.1/src/x86/win64.S libffi-3.2.1/src/x86/win64.S
---- libffi-3.2.1/src/x86/win64.S 2014-11-08 21:47:24.000000000 +0900
-+++ libffi-3.2.1/src/x86/win64.S 2014-12-22 16:14:40.000000000 +0900
-@@ -127,7 +127,7 @@
-
- mov rcx, QWORD PTR RVALUE[rbp]
- mov DWORD PTR [rcx], eax
-- jmp ret_void$
-+ jmp SHORT ret_void$
-
- ret_struct2b$:
- cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B
-@@ -135,7 +135,7 @@
-
- mov rcx, QWORD PTR RVALUE[rbp]
- mov WORD PTR [rcx], ax
-- jmp ret_void$
-+ jmp SHORT ret_void$
-
- ret_struct1b$:
- cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B
-@@ -143,7 +143,7 @@
-
- mov rcx, QWORD PTR RVALUE[rbp]
- mov BYTE PTR [rcx], al
-- jmp ret_void$
-+ jmp SHORT ret_void$
-
- ret_uint8$:
- cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8
-@@ -152,7 +152,7 @@
- mov rcx, QWORD PTR RVALUE[rbp]
- movzx rax, al
- mov QWORD PTR [rcx], rax
-- jmp ret_void$
-+ jmp SHORT ret_void$
-
- ret_sint8$:
- cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8
-@@ -161,7 +161,7 @@
- mov rcx, QWORD PTR RVALUE[rbp]
- movsx rax, al
- mov QWORD PTR [rcx], rax
-- jmp ret_void$
-+ jmp SHORT ret_void$
-
- ret_uint16$:
- cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16
-@@ -188,7 +188,13 @@
- mov rcx, QWORD PTR RVALUE[rbp]
- mov eax, eax
- mov QWORD PTR [rcx], rax
-- jmp SHORT ret_void$
-+
-+ret_void$:
-+ xor rax, rax
-+
-+ lea rsp, QWORD PTR [rbp+16]
-+ pop rbp
-+ ret 0
-
- ret_sint32$:
- cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32
-@@ -247,13 +253,6 @@
- cdqe
- mov QWORD PTR [rcx], rax
- jmp SHORT ret_void$
--
--ret_void$:
-- xor rax, rax
--
-- lea rsp, QWORD PTR [rbp+16]
-- pop rbp
-- ret 0
- ffi_call_win64 ENDP
- _TEXT ENDS
- END
-diff -ru libffi-3.2.1/include/ffi.h.in libffi-3.2.1/include/ffi.h.in
---- libffi-3.2.1/include/ffi.h.in 2014-11-08 21:47:24.000000000 +0900
-+++ libffi-3.2.1/include/ffi.h.in 2015-01-11 12:35:30.000000000 +0900
-@@ -103,6 +103,11 @@
- # undef FFI_64_BIT_MAX
- # define FFI_64_BIT_MAX 9223372036854775807LL
- # endif
-+# ifdef _MSC_VER
-+# define FFI_LONG_LONG_MAX _I64_MAX
-+# undef FFI_64_BIT_MAX
-+# define FFI_64_BIT_MAX 9223372036854775807I64
-+# endif
- # endif
- #endif
-
diff --git a/ext/fiddle/win32/libffi-config.rb b/ext/fiddle/win32/libffi-config.rb
deleted file mode 100755
index 7a32a91517..0000000000
--- a/ext/fiddle/win32/libffi-config.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/ruby
-# frozen_string_literal: false
-require 'fileutils'
-
-basedir = File.dirname(__FILE__)
-conf = {}
-enable = {}
-until ARGV.empty?
- arg = ARGV.shift
- case arg
- when '-C'
- # ignore
- when /\A--srcdir=(.*)/
- conf['SRCDIR'] = srcdir = $1
- when /\A(CC|CFLAGS|CXX|CXXFLAGS|LD|LDFLAGS)=(.*)/
- conf[$1] = $2
- when /\A--host=(.*)/
- host = $1
- when /\A--enable-([^=]+)(?:=(.*))?/
- enable[$1] = $2 || true
- when /\A--disable-([^=]+)/
- enable[$1] = false
- end
-end
-
-IO.foreach("#{srcdir}/configure.ac") do |line|
- if /^AC_INIT\((.*)\)/ =~ line
- version = $1.split(/,\s*/)[1]
- version.gsub!(/\A\[|\]\z/, '')
- conf['VERSION'] = version
- break
- end
-end
-
-builddir = srcdir == "." ? enable['builddir'] : "."
-conf['TARGET'] = /^x64/ =~ host ? "X86_WIN64" : "X86_WIN32"
-
-FileUtils.mkdir_p([builddir, "#{builddir}/include", "#{builddir}/src/x86"])
-FileUtils.cp("#{basedir}/fficonfig.h", ".", preserve: true)
-
-hdr = IO.binread("#{srcdir}/include/ffi.h.in")
-hdr.gsub!(/@(\w+)@/) {conf[$1] || $&}
-hdr.gsub!(/^(#if\s+)@\w+@/, '\10')
-IO.binwrite("#{builddir}/include/ffi.h", hdr)
-
-mk = IO.binread("#{basedir}/libffi.mk.tmpl")
-mk.gsub!(/@(\w+)@/) {conf[$1] || $&}
-IO.binwrite("Makefile", mk)
diff --git a/ext/fiddle/win32/libffi.mk.tmpl b/ext/fiddle/win32/libffi.mk.tmpl
deleted file mode 100755
index 2a16e8efec..0000000000
--- a/ext/fiddle/win32/libffi.mk.tmpl
+++ /dev/null
@@ -1,96 +0,0 @@
-# -*- makefile -*-
-# ====================================================================
-#
-# libffi Windows Makefile
-#
-#
-# ====================================================================
-#
-NAME = ffi
-TARGET = @TARGET@
-CC = cl
-!if "$(TARGET)" == "X86_WIN64"
-AS = ml64
-!else
-AS = ml
-!endif
-AR = link
-DLEXT = dll
-OBJEXT = obj
-LIBEXT = lib
-TOPDIR = @SRCDIR@
-CPP = $(CC) -EP
-CFLAGS = @CFLAGS@
-ARFLAGS = -lib
-ASFLAGS = -coff -W3 -Cx
-INCLUDES= -I. -I./include -I./src/x86 \
- -I$(TOPDIR)/include -I$(TOPDIR)/include/src/x86
-
-SRCDIR = $(TOPDIR)/src
-WORKDIR = ./.libs
-BUILDDIR= ./src
-LIBNAME = lib$(NAME)
-STATICLIB= $(WORKDIR)/$(LIBNAME)_convenience.$(LIBEXT)
-
-HEADERS = \
- ./fficonfig.h
-FFI_HEADERS = \
- ./include/ffi.h \
- ./include/ffitarget.h
-
-!if "$(TARGET)" == "X86_WIN32"
-OSSRC = win32
-!else if "$(TARGET)" == "X86_WIN64"
-OSSRC = win64
-!else
-! error unknown target: $(TARGET)
-!endif
-
-OBJECTS = \
- $(BUILDDIR)/closures.$(OBJEXT) \
- $(BUILDDIR)/debug.$(OBJEXT) \
- $(BUILDDIR)/java_raw_api.$(OBJEXT) \
- $(BUILDDIR)/prep_cif.$(OBJEXT) \
- $(BUILDDIR)/raw_api.$(OBJEXT) \
- $(BUILDDIR)/types.$(OBJEXT) \
- $(BUILDDIR)/x86/ffi.$(OBJEXT) \
- $(BUILDDIR)/x86/$(OSSRC).$(OBJEXT)
-ASMSRCS = \
- $(BUILDDIR)/x86/$(OSSRC).asm
-
-.SUFFIXES : .S .asm
-
-all: $(WORKDIR) $(STATICLIB)
-
-{$(SRCDIR)}.c{$(BUILDDIR)}.$(OBJEXT):
- $(CC) -c $(CFLAGS) $(INCLUDES) -Fo$(@:\=/) -Fd$(WORKDIR)/$(NAME)-src $(<:\=/)
-
-{$(SRCDIR)/x86}.c{$(BUILDDIR)/x86}.$(OBJEXT):
- $(CC) -c $(CFLAGS) $(INCLUDES) -Fo$(@:\=/) -Fd$(WORKDIR)/$(NAME)-src $(<:\=/)
-
-{$(SRCDIR)/x86}.S{$(BUILDDIR)/x86}.asm:
- $(CPP) $(CFLAGS) $(INCLUDES) $(<:\=/) >$(@:\=/)
-
-{$(BUILDDIR)/x86}.asm{$(BUILDDIR)/x86}.$(OBJEXT):
- cd $(@D) && $(AS) -c $(ASFLAGS) -Fo $(@F) $(<F)
-
-$(BUILDDIR)/x86/$(OSSRC).asm: $(SRCDIR)/x86/$(OSSRC).S
-
-$(OBJECTS): $(FFI_HEADERS) $(HEADERS)
-
-$(WORKDIR):
- -@if not exist "$(WORKDIR:/=\)\$(NULL)" mkdir $(WORKDIR:/=\)
-
-$(STATICLIB): $(WORKDIR) $(OBJECTS)
- $(AR) $(ARFLAGS) -out:$(STATICLIB) @<<
- $(OBJECTS)
-<<
-
-clean:
- -@del /Q $(OBJECTS:/=\) 2>NUL
- -@del /Q $(ASMSRCS:/=\) 2>NUL
- -@del /Q /S $(WORKDIR:/=\) 2>NUL
-
-distclean: clean
- -@del /Q $(HEADERS:/=\) $(FFI_HEADERS:/=\) 2>NUL
- -@del /Q Makefile 2>NUL
diff --git a/ext/gdbm/extconf.rb b/ext/gdbm/extconf.rb
index d1908ffa5c..5a09492e5e 100644
--- a/ext/gdbm/extconf.rb
+++ b/ext/gdbm/extconf.rb
@@ -1,19 +1,7 @@
-# frozen_string_literal: false
require 'mkmf'
dir_config("gdbm")
if have_library("gdbm", "gdbm_open") and
have_header("gdbm.h")
- checking_for("sizeof(DBM) is available") {
- if try_compile(<<SRC)
-#include <gdbm.h>
-
-const int sizeof_DBM = (int)sizeof(DBM);
-SRC
- $defs << '-DDBM_SIZEOF_DBM=sizeof(DBM)'
- else
- $defs << '-DDBM_SIZEOF_DBM=0'
- end
- }
create_makefile("gdbm")
end
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 709f466cd8..ff0a6524bf 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -101,45 +101,25 @@ closed_dbm(void)
}
#define GetDBM(obj, dbmp) do {\
- TypedData_Get_Struct((obj), struct dbmdata, &dbm_type, (dbmp));\
+ Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_dbm();\
if ((dbmp)->di_dbm == 0) closed_dbm();\
} while (0)
-#define GetDBM2(obj, dbmp, dbm) do {\
- GetDBM((obj), (dbmp));\
- (dbm) = (dbmp)->di_dbm;\
-} while (0)
+#define GetDBM2(obj, data, dbm) {\
+ GetDBM((obj), (data));\
+ (dbm) = dbmp->di_dbm;\
+}
static void
-free_dbm(void *ptr)
+free_dbm(struct dbmdata *dbmp)
{
- struct dbmdata *dbmp = ptr;
if (dbmp) {
if (dbmp->di_dbm) gdbm_close(dbmp->di_dbm);
xfree(dbmp);
}
}
-static size_t
-memsize_dbm(const void *ptr)
-{
- size_t size = 0;
- const struct dbmdata *dbmp = ptr;
- if (dbmp) {
- size += sizeof(*dbmp);
- if (dbmp->di_dbm) size += DBM_SIZEOF_DBM;
- }
- return size;
-}
-
-static const rb_data_type_t dbm_type = {
- "gdbm",
- {0, free_dbm, memsize_dbm,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* call-seq:
* gdbm.close -> nil
@@ -169,7 +149,7 @@ fgdbm_closed(VALUE obj)
{
struct dbmdata *dbmp;
- TypedData_Get_Struct(obj, struct dbmdata, &dbm_type, dbmp);
+ Data_Get_Struct(obj, struct dbmdata, dbmp);
if (dbmp == 0)
return Qtrue;
if (dbmp->di_dbm == 0)
@@ -181,7 +161,7 @@ fgdbm_closed(VALUE obj)
static VALUE
fgdbm_s_alloc(VALUE klass)
{
- return TypedData_Wrap_Struct(klass, &dbm_type, 0);
+ return Data_Wrap_Struct(klass, 0, free_dbm, 0);
}
/*
@@ -299,7 +279,7 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
static VALUE
fgdbm_s_open(int argc, VALUE *argv, VALUE klass)
{
- VALUE obj = fgdbm_s_alloc(klass);
+ VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
if (NIL_P(fgdbm_initialize(argc, argv, obj))) {
return Qnil;
@@ -614,8 +594,7 @@ fgdbm_delete_if(VALUE obj)
GDBM_FILE dbm;
VALUE keystr, valstr;
VALUE ret, ary = rb_ary_tmp_new(0);
- long i;
- int status = 0, n;
+ int i, status = 0, n;
rb_gdbm_modify(obj);
GetDBM2(obj, dbmp, dbm);
@@ -634,7 +613,7 @@ fgdbm_delete_if(VALUE obj)
}
for (i = 0; i < RARRAY_LEN(ary); i++)
- rb_gdbm_delete(obj, RARRAY_AREF(ary, i));
+ rb_gdbm_delete(obj, RARRAY_PTR(ary)[i]);
if (status) rb_jump_tag(status);
if (n > 0) dbmp->di_size = n - (int)RARRAY_LEN(ary);
rb_ary_clear(ary);
@@ -745,15 +724,13 @@ fgdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
}
static VALUE
-update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
+update_i(VALUE pair, VALUE dbm)
{
- const VALUE *ptr;
Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) {
rb_raise(rb_eArgError, "pair must be [key, value]");
}
- ptr = RARRAY_CONST_PTR(pair);
- fgdbm_store(dbm, ptr[0], ptr[1]);
+ fgdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]);
return Qnil;
}
@@ -901,7 +878,7 @@ fgdbm_each_key(VALUE obj)
* gdbm.each_pair { |key, value| block } -> gdbm
*
* Executes _block_ for each key in the database, passing the _key_ and the
- * corresponding _value_ as a parameter.
+ * correspoding _value_ as a parameter.
*/
static VALUE
fgdbm_each_pair(VALUE obj)
@@ -1085,7 +1062,7 @@ fgdbm_reorganize(VALUE obj)
* gdbm.sync -> gdbm
*
* Unless the _gdbm_ object has been opened with the *SYNC* flag, it is not
- * guaranteed that database modification operations are immediately applied to
+ * guarenteed that database modification operations are immediately applied to
* the database file. This method ensures that all recent modifications
* to the database are written to the file. Blocks until all writing operations
* to the disk have been finished.
diff --git a/ext/io/console/buildgem.sh b/ext/io/console/buildgem.sh
deleted file mode 100755
index 65fe545e1e..0000000000
--- a/ext/io/console/buildgem.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -e
-cd ${0%/*}
-trap "mv depend.$$ depend" 0 2
-${RUBY-ruby} -i.$$ -pe 'exit if /^win32_vk/' depend
-${GEM-gem} build io-console.gemspec
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index a408fd0870..f3379ffd8d 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -3,7 +3,17 @@
* console IO module
*/
#include "ruby.h"
+#ifdef HAVE_RUBY_IO_H
#include "ruby/io.h"
+#else
+#include "rubyio.h"
+/* assumes rb_io_t doesn't have pathv */
+#include "util.h" /* for ruby_strdup() */
+#endif
+
+#ifndef HAVE_RB_IO_T
+typedef OpenFile rb_io_t;
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -15,6 +25,10 @@
#include <sys/ioctl.h>
#endif
+#ifndef RB_TYPE_P
+#define RB_TYPE_P(obj, type) (TYPE(obj) == type)
+#endif
+
#if defined HAVE_TERMIOS_H
# include <termios.h>
typedef struct termios conmode;
@@ -50,7 +64,11 @@ typedef struct sgttyb conmode;
#include <winioctl.h>
typedef DWORD conmode;
+#ifdef HAVE_RB_W32_MAP_ERRNO
#define LAST_ERROR rb_w32_map_errno(GetLastError())
+#else
+#define LAST_ERROR EBADF
+#endif
#define SET_LAST_ERROR (errno = LAST_ERROR, 0)
static int
@@ -73,29 +91,11 @@ getattr(int fd, conmode *t)
#define SET_LAST_ERROR (0)
#endif
-static ID id_getc, id_console, id_close, id_min, id_time;
-#if ENABLE_IO_GETPASS
-static ID id_gets;
+#ifndef InitVM
+#define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();}
#endif
-#ifndef HAVE_RB_F_SEND
-static ID id___send__;
-
-static VALUE
-rb_f_send(int argc, VALUE *argv, VALUE recv)
-{
- VALUE sym = argv[0];
- ID vid = rb_check_id(&sym);
- if (vid) {
- --argc;
- ++argv;
- }
- else {
- vid = id___send__;
- }
- return rb_funcallv(recv, vid, argc, argv);
-}
-#endif
+static ID id_getc, id_console;
typedef struct {
int vmin;
@@ -107,10 +107,26 @@ rawmode_opt(int argc, VALUE *argv, rawmode_arg_t *opts)
{
rawmode_arg_t *optp = NULL;
VALUE vopts;
+#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
rb_scan_args(argc, argv, "0:", &vopts);
+#else
+ vopts = Qnil;
+ if (argc > 0) {
+ vopts = argv[--argc];
+ if (!NIL_P(vopts)) {
+# ifdef HAVE_RB_CHECK_HASH_TYPE
+ vopts = rb_check_hash_type(vopts);
+ if (NIL_P(vopts)) ++argc;
+# else
+ Check_Type(vopts, T_HASH);
+# endif
+ }
+ }
+ rb_scan_args(argc, argv, "0");
+#endif
if (!NIL_P(vopts)) {
- VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min));
- VALUE vtime = rb_hash_aref(vopts, ID2SYM(id_time));
+ VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
+ VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
/* default values by `stty raw` */
opts->vmin = 1;
opts->vtime = 0;
@@ -216,8 +232,15 @@ set_ttymode(int fd, conmode *t, void (*setter)(conmode *, void *), void *arg)
return setattr(fd, &r);
}
+#ifdef GetReadFile
+#define GetReadFD(fptr) fileno(GetReadFile(fptr))
+#else
#define GetReadFD(fptr) ((fptr)->fd)
+#endif
+#ifdef GetWriteFile
+#define GetWriteFD(fptr) fileno(GetWriteFile(fptr))
+#else
static inline int
get_write_fd(const rb_io_t *fptr)
{
@@ -228,6 +251,7 @@ get_write_fd(const rb_io_t *fptr)
return ofptr->fd;
}
#define GetWriteFD(fptr) get_write_fd(fptr)
+#endif
#define FD_PER_IO 2
@@ -280,7 +304,8 @@ ttymode(VALUE io, VALUE (*func)(VALUE), void (*setter)(conmode *, void *), void
}
if (status) {
if (status == -1) {
- rb_syserr_fail(error, 0);
+ errno = error;
+ rb_sys_fail(0);
}
rb_jump_tag(status);
}
@@ -523,22 +548,16 @@ console_set_winsize(VALUE io, VALUE size)
int newrow, newcol;
#endif
VALUE row, col, xpixel, ypixel;
- const VALUE *sz;
+#if defined TIOCSWINSZ
int fd;
- long sizelen;
+#endif
GetOpenFile(io, fptr);
size = rb_Array(size);
- if ((sizelen = RARRAY_LEN(size)) != 2 && sizelen != 4) {
- rb_raise(rb_eArgError,
- "wrong number of arguments (given %ld, expected 2 or 4)",
- sizelen);
- }
- sz = RARRAY_CONST_PTR(size);
- row = sz[0], col = sz[1], xpixel = ypixel = Qnil;
- if (sizelen == 4) xpixel = sz[2], ypixel = sz[3];
- fd = GetWriteFD(fptr);
+ rb_scan_args((int)RARRAY_LEN(size), RARRAY_PTR(size), "22",
+ &row, &col, &xpixel, &ypixel);
#if defined TIOCSWINSZ
+ fd = GetWriteFD(fptr);
ws.ws_row = ws.ws_col = ws.ws_xpixel = ws.ws_ypixel = 0;
#define SET(m) ws.ws_##m = NIL_P(m) ? 0 : (unsigned short)NUM2UINT(m)
SET(row);
@@ -548,28 +567,24 @@ console_set_winsize(VALUE io, VALUE size)
#undef SET
if (!setwinsize(fd, &ws)) rb_sys_fail(0);
#elif defined _WIN32
- wh = (HANDLE)rb_w32_get_osfhandle(fd);
-#define SET(m) new##m = NIL_P(m) ? 0 : (unsigned short)NUM2UINT(m)
- SET(row);
- SET(col);
-#undef SET
- if (!NIL_P(xpixel)) (void)NUM2UINT(xpixel);
- if (!NIL_P(ypixel)) (void)NUM2UINT(ypixel);
- if (!GetConsoleScreenBufferInfo(wh, &ws)) {
- rb_syserr_fail(LAST_ERROR, "GetConsoleScreenBufferInfo");
+ wh = (HANDLE)rb_w32_get_osfhandle(GetReadFD(fptr));
+ newrow = (SHORT)NUM2UINT(row);
+ newcol = (SHORT)NUM2UINT(col);
+ if (!getwinsize(GetReadFD(fptr), &ws)) {
+ rb_sys_fail("GetConsoleScreenBufferInfo");
}
if ((ws.dwSize.X < newcol && (ws.dwSize.X = newcol, 1)) ||
(ws.dwSize.Y < newrow && (ws.dwSize.Y = newrow, 1))) {
- if (!SetConsoleScreenBufferSize(wh, ws.dwSize)) {
- rb_syserr_fail(LAST_ERROR, "SetConsoleScreenBufferInfo");
+ if (!(SetConsoleScreenBufferSize(wh, ws.dwSize) || SET_LAST_ERROR)) {
+ rb_sys_fail("SetConsoleScreenBufferInfo");
}
}
ws.srWindow.Left = 0;
ws.srWindow.Top = 0;
ws.srWindow.Right = newcol;
ws.srWindow.Bottom = newrow;
- if (!SetConsoleWindowInfo(wh, FALSE, &ws.srWindow)) {
- rb_syserr_fail(LAST_ERROR, "SetConsoleWindowInfo");
+ if (!(SetConsoleWindowInfo(wh, FALSE, &ws.srWindow) || SET_LAST_ERROR)) {
+ rb_sys_fail("SetConsoleWindowInfo");
}
#endif
return io;
@@ -653,141 +668,30 @@ console_ioflush(VALUE io)
return io;
}
-static VALUE
-console_beep(VALUE io)
-{
- rb_io_t *fptr;
- int fd;
-
- GetOpenFile(io, fptr);
- fd = GetWriteFD(fptr);
-#ifdef _WIN32
- (void)fd;
- MessageBeep(0);
-#else
- if (write(fd, "\a", 1) < 0)
- rb_sys_fail(0);
-#endif
- return io;
-}
-
-#if defined _WIN32
-static VALUE
-console_goto(VALUE io, VALUE x, VALUE y)
-{
- rb_io_t *fptr;
- int fd;
- COORD pos;
-
- GetOpenFile(io, fptr);
- fd = GetWriteFD(fptr);
- pos.X = NUM2UINT(x);
- pos.Y = NUM2UINT(y);
- if (!SetConsoleCursorPosition((HANDLE)rb_w32_get_osfhandle(fd), pos)) {
- rb_syserr_fail(LAST_ERROR, 0);
- }
- return io;
-}
-
-static VALUE
-console_cursor_pos(VALUE io)
-{
- rb_io_t *fptr;
- int fd;
- rb_console_size_t ws;
-
- GetOpenFile(io, fptr);
- fd = GetWriteFD(fptr);
- if (!GetConsoleScreenBufferInfo((HANDLE)rb_w32_get_osfhandle(fd), &ws)) {
- rb_syserr_fail(LAST_ERROR, 0);
- }
- return rb_assoc_new(UINT2NUM(ws.dwCursorPosition.X), UINT2NUM(ws.dwCursorPosition.Y));
-}
-
-static VALUE
-console_cursor_set(VALUE io, VALUE cpos)
-{
- cpos = rb_convert_type(cpos, T_ARRAY, "Array", "to_ary");
- if (RARRAY_LEN(cpos) != 2) rb_raise(rb_eArgError, "expected 2D coordinate");
- return console_goto(io, RARRAY_AREF(cpos, 0), RARRAY_AREF(cpos, 1));
-}
-
-#include "win32_vk.inc"
-
-static VALUE
-console_key_pressed_p(VALUE io, VALUE k)
-{
- int vk = -1;
-
- if (FIXNUM_P(k)) {
- vk = NUM2UINT(k);
- }
- else {
- const struct vktable *t;
- if (SYMBOL_P(k)) {
- k = rb_sym2str(k);
- }
- else {
- StringValueCStr(k);
- }
- t = console_win32_vk(RSTRING_PTR(k), RSTRING_LEN(k));
- if (!t || (vk = (short)t->vk) == -1) {
- rb_raise(rb_eArgError, "unknown virtual key code: %"PRIsVALUE, k);
- }
- }
- return GetKeyState(vk) & 0x80 ? Qtrue : Qfalse;
-}
-#else
-# define console_goto rb_f_notimplement
-# define console_cursor_pos rb_f_notimplement
-# define console_cursor_set rb_f_notimplement
-# define console_key_pressed_p rb_f_notimplement
-#endif
-
/*
* call-seq:
* IO.console -> #<File:/dev/tty>
- * IO.console(sym, *args)
*
* Returns an File instance opened console.
*
- * If +sym+ is given, it will be sent to the opened console with
- * +args+ and the result will be returned instead of the console IO
- * itself.
- *
* You must require 'io/console' to use this method.
*/
static VALUE
-console_dev(int argc, VALUE *argv, VALUE klass)
+console_dev(VALUE klass)
{
VALUE con = 0;
rb_io_t *fptr;
- VALUE sym = 0;
- rb_check_arity(argc, 0, UNLIMITED_ARGUMENTS);
- if (argc) {
- Check_Type(sym = argv[0], T_SYMBOL);
- }
if (klass == rb_cIO) klass = rb_cFile;
if (rb_const_defined(klass, id_console)) {
con = rb_const_get(klass, id_console);
- if (!RB_TYPE_P(con, T_FILE) ||
- (!(fptr = RFILE(con)->fptr) || GetReadFD(fptr) == -1)) {
- rb_const_remove(klass, id_console);
- con = 0;
- }
- }
- if (sym) {
- if (sym == ID2SYM(id_close) && argc == 1) {
- if (con) {
- rb_io_close(con);
- rb_const_remove(klass, id_console);
- con = 0;
- }
- return Qnil;
+ if (RB_TYPE_P(con, T_FILE)) {
+ if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1)
+ return con;
}
+ rb_mod_remove_const(klass, ID2SYM(id_console));
}
- if (!con) {
+ {
VALUE args[2];
#if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H || defined HAVE_SGTTY_H
# define CONSOLE_DEVICE "/dev/tty"
@@ -806,7 +710,7 @@ console_dev(int argc, VALUE *argv, VALUE klass)
int fd;
#ifdef CONSOLE_DEVICE_FOR_WRITING
- fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_RDWR, 0);
+ fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_WRONLY, 0);
if (fd < 0) return Qnil;
rb_update_max_fd(fd);
args[1] = INT2FIX(O_WRONLY);
@@ -825,19 +729,25 @@ console_dev(int argc, VALUE *argv, VALUE klass)
args[0] = INT2NUM(fd);
con = rb_class_new_instance(2, args, klass);
GetOpenFile(con, fptr);
+#ifdef HAVE_RUBY_IO_H
fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE));
+#else
+ fptr->path = ruby_strdup(CONSOLE_DEVICE);
+#endif
#ifdef CONSOLE_DEVICE_FOR_WRITING
GetOpenFile(out, ofptr);
+# ifdef HAVE_RB_IO_GET_WRITE_IO
ofptr->pathv = fptr->pathv;
fptr->tied_io_for_writing = out;
+# else
+ fptr->f2 = ofptr->f;
+ ofptr->f = 0;
+# endif
ofptr->mode |= FMODE_SYNC;
#endif
fptr->mode |= FMODE_SYNC;
rb_const_set(klass, id_console, con);
}
- if (sym) {
- return rb_f_send(argc, argv, con);
- }
return con;
}
@@ -850,101 +760,17 @@ console_dev(int argc, VALUE *argv, VALUE klass)
static VALUE
io_getch(int argc, VALUE *argv, VALUE io)
{
- return rb_funcall2(io, id_getc, argc, argv);
-}
-
-#if ENABLE_IO_GETPASS
-static VALUE
-puts_call(VALUE io)
-{
- return rb_io_write(io, rb_default_rs);
-}
-
-static VALUE
-getpass_call(VALUE io)
-{
- return ttymode(io, rb_io_gets, set_noecho, NULL);
-}
-
-static void
-prompt(int argc, VALUE *argv, VALUE io)
-{
- if (argc > 0 && !NIL_P(argv[0])) {
- VALUE str = argv[0];
- StringValueCStr(str);
- rb_check_safe_obj(str);
- rb_io_write(io, str);
- }
-}
-
-static VALUE
-str_chomp(VALUE str)
-{
- if (!NIL_P(str)) {
- str = rb_funcallv(str, rb_intern("chomp!"), 0, 0);
- }
- return str;
+ return rb_funcall2(io, rb_intern("getc"), argc, argv);
}
/*
- * call-seq:
- * io.getpass(prompt=nil) -> string
- *
- * Reads and returns a line without echo back.
- * Prints +prompt+ unless it is +nil+.
- *
- * You must require 'io/console' to use this method.
- */
-static VALUE
-console_getpass(int argc, VALUE *argv, VALUE io)
-{
- VALUE str, wio;
-
- rb_check_arity(argc, 0, 1);
- wio = rb_io_get_write_io(io);
- if (wio == io && io == rb_stdin) wio = rb_stderr;
- prompt(argc, argv, wio);
- str = rb_ensure(getpass_call, io, puts_call, wio);
- return str_chomp(str);
-}
-
-/*
- * call-seq:
- * io.getpass(prompt=nil) -> string
- *
- * See IO#getpass.
- */
-static VALUE
-io_getpass(int argc, VALUE *argv, VALUE io)
-{
- VALUE str;
-
- rb_check_arity(argc, 0, 1);
- prompt(argc, argv, io);
- str = str_chomp(rb_funcallv(io, id_gets, 0, 0));
- puts_call(io);
- return str;
-}
-#endif
-
-/*
* IO console methods
*/
void
Init_console(void)
{
-#undef rb_intern
id_getc = rb_intern("getc");
-#if ENABLE_IO_GETPASS
- id_gets = rb_intern("gets");
-#endif
id_console = rb_intern("console");
- id_close = rb_intern("close");
- id_min = rb_intern("min");
- id_time = rb_intern("time");
-#ifndef HAVE_RB_F_SEND
- id___send__ = rb_intern("__send__");
-#endif
InitVM(console);
}
@@ -964,20 +790,9 @@ InitVM_console(void)
rb_define_method(rb_cIO, "iflush", console_iflush, 0);
rb_define_method(rb_cIO, "oflush", console_oflush, 0);
rb_define_method(rb_cIO, "ioflush", console_ioflush, 0);
- rb_define_method(rb_cIO, "beep", console_beep, 0);
- rb_define_method(rb_cIO, "goto", console_goto, 2);
- rb_define_method(rb_cIO, "cursor", console_cursor_pos, 0);
- rb_define_method(rb_cIO, "cursor=", console_cursor_set, 1);
- rb_define_method(rb_cIO, "pressed?", console_key_pressed_p, 1);
-#if ENABLE_IO_GETPASS
- rb_define_method(rb_cIO, "getpass", console_getpass, -1);
-#endif
- rb_define_singleton_method(rb_cIO, "console", console_dev, -1);
+ rb_define_singleton_method(rb_cIO, "console", console_dev, 0);
{
VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
rb_define_method(mReadable, "getch", io_getch, -1);
-#if ENABLE_IO_GETPASS
- rb_define_method(mReadable, "getpass", io_getpass, -1);
-#endif
}
}
diff --git a/ext/io/console/depend b/ext/io/console/depend
index 40eacd21e1..e786dc71d2 100644
--- a/ext/io/console/depend
+++ b/ext/io/console/depend
@@ -1,25 +1,4 @@
$(OBJS): $(HDRS) $(ruby_headers) \
- $(VK_HEADER) \
$(hdrdir)/ruby/io.h \
$(hdrdir)/ruby/encoding.h \
$(hdrdir)/ruby/oniguruma.h
-
-win32_vk.inc: win32_vk.list
-
-.list.inc:
- ( \
- $(RUBY) -anF, \
- -e 'BEGIN {puts "#define UNDEFINED_VK (unsigned short)-1"}' \
- -e 'n=$$F[1] and (n.strip!; /\AVK_/=~n) and' \
- -e 'puts(%[#ifndef #{n}\n# define #{n} UNDEFINED_VK\n#endif])' \
- $< && \
- gperf --ignore-case -E -C -P -p -j1 -i 1 -g -o -t -K ofs -N console_win32_vk -k* $< \
- | sed 's/(int)(long)&((\(struct stringpool_t\) *\*)0)->\(stringpool_[a-z0-9]*\)/offsetof(\1, \2)/g' \
- ) > $(@F)
-
-.SUFFIXES: .chksum .list .inc
-
-.list.chksum:
- @$(RUBY) -I$(top_srcdir)/tool -rchecksum \
- -e "Checksum.update(ARGV) {|k|k.copy(k.target) rescue k.make(k.target)}" \
- -- --make=$(MAKE) -I$(srcdir) $(<F) $(@F:.chksum=.inc)
diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb
index 381520a92c..bbd1235986 100644
--- a/ext/io/console/extconf.rb
+++ b/ext/io/console/extconf.rb
@@ -1,13 +1,10 @@
-# frozen_string_literal: false
require 'mkmf'
ok = true
hdr = nil
case
when macro_defined?("_WIN32", "")
- # rb_w32_map_errno: 1.8.7
- vk_header = File.exist?("#$srcdir/win32_vk.list") ? "chksum" : "inc"
- vk_header = "#{'{$(srcdir)}' if $nmake == ?m}win32_vk.#{vk_header}"
+ have_func("rb_w32_map_errno", "ruby.h")
when hdr = %w"termios.h termio.h".find {|h| have_header(h)}
have_func("cfmakeraw", hdr)
when have_header(hdr = "sgtty.h")
@@ -15,13 +12,15 @@ when have_header(hdr = "sgtty.h")
else
ok = false
end
+ok &&= enable_config("io-console-force-compatible-with-1.8") ||
+ macro_defined?("HAVE_RUBY_IO_H", cpp_include("ruby.h"))
if ok
- have_header("sys/ioctl.h") if hdr
- # rb_check_hash_type: 1.9.3
- # rb_io_get_write_io: 1.9.1
- # rb_cloexec_open: 2.0.0
- $defs << "-D""ENABLE_IO_GETPASS=1"
- create_makefile("io/console") {|conf|
- conf << "\n""VK_HEADER = #{vk_header}\n"
- }
+ have_header("sys/ioctl.h")
+ have_func("rb_check_hash_type", "ruby.h")
+ have_func("rb_io_get_write_io", "ruby/io.h")
+ have_func("rb_cloexec_open", "ruby/io.h")
+ if enable_config("io-console-rb_scan_args-optional-hash", true)
+ $defs << "-DHAVE_RB_SCAN_ARGS_OPTIONAL_HASH=1"
+ end
+ create_makefile("io/console")
end
diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec
index 2c5ce6b578..f71e1b9b8f 100644
--- a/ext/io/console/io-console.gemspec
+++ b/ext/io/console/io-console.gemspec
@@ -1,5 +1,5 @@
# -*- ruby -*-
-_VERSION = "0.4.5"
+_VERSION = "0.4.2"
date = %w$Date:: $[1]
Gem::Specification.new do |s|
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 2.0.0"
s.homepage = "http://www.ruby-lang.org"
s.authors = ["Nobu Nakada"]
- s.require_path = %[lib]
- s.files = %w[console.c depend extconf.rb lib/console/size.rb win32_vk.inc]
+ s.require_path = %[.]
+ s.files = %w[console.c extconf.rb lib/console/size.rb]
s.extensions = %w[extconf.rb]
- s.license = "BSD-2-Clause"
+ s.licenses = "ruby"
s.cert_chain = %w[certs/nobu.pem]
s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
end
diff --git a/ext/io/console/lib/console/size.rb b/ext/io/console/lib/console/size.rb
index f17206dfcf..519bc3be6d 100644
--- a/ext/io/console/lib/console/size.rb
+++ b/ext/io/console/lib/console/size.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# fallback to console window size
def IO.default_console_size
[
diff --git a/ext/io/console/win32_vk.chksum b/ext/io/console/win32_vk.chksum
deleted file mode 100644
index bc9fff7560..0000000000
--- a/ext/io/console/win32_vk.chksum
+++ /dev/null
@@ -1 +0,0 @@
-src="win32_vk.list", len=3269, checksum=34076
diff --git a/ext/io/console/win32_vk.inc b/ext/io/console/win32_vk.inc
deleted file mode 100644
index a098158e27..0000000000
--- a/ext/io/console/win32_vk.inc
+++ /dev/null
@@ -1,1400 +0,0 @@
-#define UNDEFINED_VK (unsigned short)-1
-#ifndef VK_LBUTTON
-# define VK_LBUTTON UNDEFINED_VK
-#endif
-#ifndef VK_RBUTTON
-# define VK_RBUTTON UNDEFINED_VK
-#endif
-#ifndef VK_CANCEL
-# define VK_CANCEL UNDEFINED_VK
-#endif
-#ifndef VK_MBUTTON
-# define VK_MBUTTON UNDEFINED_VK
-#endif
-#ifndef VK_XBUTTON1
-# define VK_XBUTTON1 UNDEFINED_VK
-#endif
-#ifndef VK_XBUTTON2
-# define VK_XBUTTON2 UNDEFINED_VK
-#endif
-#ifndef VK_BACK
-# define VK_BACK UNDEFINED_VK
-#endif
-#ifndef VK_TAB
-# define VK_TAB UNDEFINED_VK
-#endif
-#ifndef VK_CLEAR
-# define VK_CLEAR UNDEFINED_VK
-#endif
-#ifndef VK_RETURN
-# define VK_RETURN UNDEFINED_VK
-#endif
-#ifndef VK_SHIFT
-# define VK_SHIFT UNDEFINED_VK
-#endif
-#ifndef VK_CONTROL
-# define VK_CONTROL UNDEFINED_VK
-#endif
-#ifndef VK_MENU
-# define VK_MENU UNDEFINED_VK
-#endif
-#ifndef VK_PAUSE
-# define VK_PAUSE UNDEFINED_VK
-#endif
-#ifndef VK_CAPITAL
-# define VK_CAPITAL UNDEFINED_VK
-#endif
-#ifndef VK_KANA
-# define VK_KANA UNDEFINED_VK
-#endif
-#ifndef VK_HANGEUL
-# define VK_HANGEUL UNDEFINED_VK
-#endif
-#ifndef VK_HANGUL
-# define VK_HANGUL UNDEFINED_VK
-#endif
-#ifndef VK_JUNJA
-# define VK_JUNJA UNDEFINED_VK
-#endif
-#ifndef VK_FINAL
-# define VK_FINAL UNDEFINED_VK
-#endif
-#ifndef VK_HANJA
-# define VK_HANJA UNDEFINED_VK
-#endif
-#ifndef VK_KANJI
-# define VK_KANJI UNDEFINED_VK
-#endif
-#ifndef VK_ESCAPE
-# define VK_ESCAPE UNDEFINED_VK
-#endif
-#ifndef VK_CONVERT
-# define VK_CONVERT UNDEFINED_VK
-#endif
-#ifndef VK_NONCONVERT
-# define VK_NONCONVERT UNDEFINED_VK
-#endif
-#ifndef VK_ACCEPT
-# define VK_ACCEPT UNDEFINED_VK
-#endif
-#ifndef VK_MODECHANGE
-# define VK_MODECHANGE UNDEFINED_VK
-#endif
-#ifndef VK_SPACE
-# define VK_SPACE UNDEFINED_VK
-#endif
-#ifndef VK_PRIOR
-# define VK_PRIOR UNDEFINED_VK
-#endif
-#ifndef VK_NEXT
-# define VK_NEXT UNDEFINED_VK
-#endif
-#ifndef VK_END
-# define VK_END UNDEFINED_VK
-#endif
-#ifndef VK_HOME
-# define VK_HOME UNDEFINED_VK
-#endif
-#ifndef VK_LEFT
-# define VK_LEFT UNDEFINED_VK
-#endif
-#ifndef VK_UP
-# define VK_UP UNDEFINED_VK
-#endif
-#ifndef VK_RIGHT
-# define VK_RIGHT UNDEFINED_VK
-#endif
-#ifndef VK_DOWN
-# define VK_DOWN UNDEFINED_VK
-#endif
-#ifndef VK_SELECT
-# define VK_SELECT UNDEFINED_VK
-#endif
-#ifndef VK_PRINT
-# define VK_PRINT UNDEFINED_VK
-#endif
-#ifndef VK_EXECUTE
-# define VK_EXECUTE UNDEFINED_VK
-#endif
-#ifndef VK_SNAPSHOT
-# define VK_SNAPSHOT UNDEFINED_VK
-#endif
-#ifndef VK_INSERT
-# define VK_INSERT UNDEFINED_VK
-#endif
-#ifndef VK_DELETE
-# define VK_DELETE UNDEFINED_VK
-#endif
-#ifndef VK_HELP
-# define VK_HELP UNDEFINED_VK
-#endif
-#ifndef VK_LWIN
-# define VK_LWIN UNDEFINED_VK
-#endif
-#ifndef VK_RWIN
-# define VK_RWIN UNDEFINED_VK
-#endif
-#ifndef VK_APPS
-# define VK_APPS UNDEFINED_VK
-#endif
-#ifndef VK_SLEEP
-# define VK_SLEEP UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD0
-# define VK_NUMPAD0 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD1
-# define VK_NUMPAD1 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD2
-# define VK_NUMPAD2 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD3
-# define VK_NUMPAD3 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD4
-# define VK_NUMPAD4 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD5
-# define VK_NUMPAD5 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD6
-# define VK_NUMPAD6 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD7
-# define VK_NUMPAD7 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD8
-# define VK_NUMPAD8 UNDEFINED_VK
-#endif
-#ifndef VK_NUMPAD9
-# define VK_NUMPAD9 UNDEFINED_VK
-#endif
-#ifndef VK_MULTIPLY
-# define VK_MULTIPLY UNDEFINED_VK
-#endif
-#ifndef VK_ADD
-# define VK_ADD UNDEFINED_VK
-#endif
-#ifndef VK_SEPARATOR
-# define VK_SEPARATOR UNDEFINED_VK
-#endif
-#ifndef VK_SUBTRACT
-# define VK_SUBTRACT UNDEFINED_VK
-#endif
-#ifndef VK_DECIMAL
-# define VK_DECIMAL UNDEFINED_VK
-#endif
-#ifndef VK_DIVIDE
-# define VK_DIVIDE UNDEFINED_VK
-#endif
-#ifndef VK_F1
-# define VK_F1 UNDEFINED_VK
-#endif
-#ifndef VK_F2
-# define VK_F2 UNDEFINED_VK
-#endif
-#ifndef VK_F3
-# define VK_F3 UNDEFINED_VK
-#endif
-#ifndef VK_F4
-# define VK_F4 UNDEFINED_VK
-#endif
-#ifndef VK_F5
-# define VK_F5 UNDEFINED_VK
-#endif
-#ifndef VK_F6
-# define VK_F6 UNDEFINED_VK
-#endif
-#ifndef VK_F7
-# define VK_F7 UNDEFINED_VK
-#endif
-#ifndef VK_F8
-# define VK_F8 UNDEFINED_VK
-#endif
-#ifndef VK_F9
-# define VK_F9 UNDEFINED_VK
-#endif
-#ifndef VK_F10
-# define VK_F10 UNDEFINED_VK
-#endif
-#ifndef VK_F11
-# define VK_F11 UNDEFINED_VK
-#endif
-#ifndef VK_F12
-# define VK_F12 UNDEFINED_VK
-#endif
-#ifndef VK_F13
-# define VK_F13 UNDEFINED_VK
-#endif
-#ifndef VK_F14
-# define VK_F14 UNDEFINED_VK
-#endif
-#ifndef VK_F15
-# define VK_F15 UNDEFINED_VK
-#endif
-#ifndef VK_F16
-# define VK_F16 UNDEFINED_VK
-#endif
-#ifndef VK_F17
-# define VK_F17 UNDEFINED_VK
-#endif
-#ifndef VK_F18
-# define VK_F18 UNDEFINED_VK
-#endif
-#ifndef VK_F19
-# define VK_F19 UNDEFINED_VK
-#endif
-#ifndef VK_F20
-# define VK_F20 UNDEFINED_VK
-#endif
-#ifndef VK_F21
-# define VK_F21 UNDEFINED_VK
-#endif
-#ifndef VK_F22
-# define VK_F22 UNDEFINED_VK
-#endif
-#ifndef VK_F23
-# define VK_F23 UNDEFINED_VK
-#endif
-#ifndef VK_F24
-# define VK_F24 UNDEFINED_VK
-#endif
-#ifndef VK_NUMLOCK
-# define VK_NUMLOCK UNDEFINED_VK
-#endif
-#ifndef VK_SCROLL
-# define VK_SCROLL UNDEFINED_VK
-#endif
-#ifndef VK_OEM_NEC_EQUAL
-# define VK_OEM_NEC_EQUAL UNDEFINED_VK
-#endif
-#ifndef VK_OEM_FJ_JISHO
-# define VK_OEM_FJ_JISHO UNDEFINED_VK
-#endif
-#ifndef VK_OEM_FJ_MASSHOU
-# define VK_OEM_FJ_MASSHOU UNDEFINED_VK
-#endif
-#ifndef VK_OEM_FJ_TOUROKU
-# define VK_OEM_FJ_TOUROKU UNDEFINED_VK
-#endif
-#ifndef VK_OEM_FJ_LOYA
-# define VK_OEM_FJ_LOYA UNDEFINED_VK
-#endif
-#ifndef VK_OEM_FJ_ROYA
-# define VK_OEM_FJ_ROYA UNDEFINED_VK
-#endif
-#ifndef VK_LSHIFT
-# define VK_LSHIFT UNDEFINED_VK
-#endif
-#ifndef VK_RSHIFT
-# define VK_RSHIFT UNDEFINED_VK
-#endif
-#ifndef VK_LCONTROL
-# define VK_LCONTROL UNDEFINED_VK
-#endif
-#ifndef VK_RCONTROL
-# define VK_RCONTROL UNDEFINED_VK
-#endif
-#ifndef VK_LMENU
-# define VK_LMENU UNDEFINED_VK
-#endif
-#ifndef VK_RMENU
-# define VK_RMENU UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_BACK
-# define VK_BROWSER_BACK UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_FORWARD
-# define VK_BROWSER_FORWARD UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_REFRESH
-# define VK_BROWSER_REFRESH UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_STOP
-# define VK_BROWSER_STOP UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_SEARCH
-# define VK_BROWSER_SEARCH UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_FAVORITES
-# define VK_BROWSER_FAVORITES UNDEFINED_VK
-#endif
-#ifndef VK_BROWSER_HOME
-# define VK_BROWSER_HOME UNDEFINED_VK
-#endif
-#ifndef VK_VOLUME_MUTE
-# define VK_VOLUME_MUTE UNDEFINED_VK
-#endif
-#ifndef VK_VOLUME_DOWN
-# define VK_VOLUME_DOWN UNDEFINED_VK
-#endif
-#ifndef VK_VOLUME_UP
-# define VK_VOLUME_UP UNDEFINED_VK
-#endif
-#ifndef VK_MEDIA_NEXT_TRACK
-# define VK_MEDIA_NEXT_TRACK UNDEFINED_VK
-#endif
-#ifndef VK_MEDIA_PREV_TRACK
-# define VK_MEDIA_PREV_TRACK UNDEFINED_VK
-#endif
-#ifndef VK_MEDIA_STOP
-# define VK_MEDIA_STOP UNDEFINED_VK
-#endif
-#ifndef VK_MEDIA_PLAY_PAUSE
-# define VK_MEDIA_PLAY_PAUSE UNDEFINED_VK
-#endif
-#ifndef VK_LAUNCH_MAIL
-# define VK_LAUNCH_MAIL UNDEFINED_VK
-#endif
-#ifndef VK_LAUNCH_MEDIA_SELECT
-# define VK_LAUNCH_MEDIA_SELECT UNDEFINED_VK
-#endif
-#ifndef VK_LAUNCH_APP1
-# define VK_LAUNCH_APP1 UNDEFINED_VK
-#endif
-#ifndef VK_LAUNCH_APP2
-# define VK_LAUNCH_APP2 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_1
-# define VK_OEM_1 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_PLUS
-# define VK_OEM_PLUS UNDEFINED_VK
-#endif
-#ifndef VK_OEM_COMMA
-# define VK_OEM_COMMA UNDEFINED_VK
-#endif
-#ifndef VK_OEM_MINUS
-# define VK_OEM_MINUS UNDEFINED_VK
-#endif
-#ifndef VK_OEM_PERIOD
-# define VK_OEM_PERIOD UNDEFINED_VK
-#endif
-#ifndef VK_OEM_2
-# define VK_OEM_2 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_3
-# define VK_OEM_3 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_4
-# define VK_OEM_4 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_5
-# define VK_OEM_5 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_6
-# define VK_OEM_6 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_7
-# define VK_OEM_7 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_8
-# define VK_OEM_8 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_AX
-# define VK_OEM_AX UNDEFINED_VK
-#endif
-#ifndef VK_OEM_102
-# define VK_OEM_102 UNDEFINED_VK
-#endif
-#ifndef VK_ICO_HELP
-# define VK_ICO_HELP UNDEFINED_VK
-#endif
-#ifndef VK_ICO_00
-# define VK_ICO_00 UNDEFINED_VK
-#endif
-#ifndef VK_PROCESSKEY
-# define VK_PROCESSKEY UNDEFINED_VK
-#endif
-#ifndef VK_ICO_CLEAR
-# define VK_ICO_CLEAR UNDEFINED_VK
-#endif
-#ifndef VK_PACKET
-# define VK_PACKET UNDEFINED_VK
-#endif
-#ifndef VK_OEM_RESET
-# define VK_OEM_RESET UNDEFINED_VK
-#endif
-#ifndef VK_OEM_JUMP
-# define VK_OEM_JUMP UNDEFINED_VK
-#endif
-#ifndef VK_OEM_PA1
-# define VK_OEM_PA1 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_PA2
-# define VK_OEM_PA2 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_PA3
-# define VK_OEM_PA3 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_WSCTRL
-# define VK_OEM_WSCTRL UNDEFINED_VK
-#endif
-#ifndef VK_OEM_CUSEL
-# define VK_OEM_CUSEL UNDEFINED_VK
-#endif
-#ifndef VK_OEM_ATTN
-# define VK_OEM_ATTN UNDEFINED_VK
-#endif
-#ifndef VK_OEM_FINISH
-# define VK_OEM_FINISH UNDEFINED_VK
-#endif
-#ifndef VK_OEM_COPY
-# define VK_OEM_COPY UNDEFINED_VK
-#endif
-#ifndef VK_OEM_AUTO
-# define VK_OEM_AUTO UNDEFINED_VK
-#endif
-#ifndef VK_OEM_ENLW
-# define VK_OEM_ENLW UNDEFINED_VK
-#endif
-#ifndef VK_OEM_BACKTAB
-# define VK_OEM_BACKTAB UNDEFINED_VK
-#endif
-#ifndef VK_ATTN
-# define VK_ATTN UNDEFINED_VK
-#endif
-#ifndef VK_CRSEL
-# define VK_CRSEL UNDEFINED_VK
-#endif
-#ifndef VK_EXSEL
-# define VK_EXSEL UNDEFINED_VK
-#endif
-#ifndef VK_EREOF
-# define VK_EREOF UNDEFINED_VK
-#endif
-#ifndef VK_PLAY
-# define VK_PLAY UNDEFINED_VK
-#endif
-#ifndef VK_ZOOM
-# define VK_ZOOM UNDEFINED_VK
-#endif
-#ifndef VK_NONAME
-# define VK_NONAME UNDEFINED_VK
-#endif
-#ifndef VK_PA1
-# define VK_PA1 UNDEFINED_VK
-#endif
-#ifndef VK_OEM_CLEAR
-# define VK_OEM_CLEAR UNDEFINED_VK
-#endif
-/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf --ignore-case -E -C -P -p -j1 -i 1 -g -o -t -K ofs -N console_win32_vk -k'*' win32_vk.list */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "win32_vk.list"
-
-struct vktable {short ofs; unsigned short vk;};
-static const struct vktable *console_win32_vk(const char *, unsigned int);
-#line 5 "win32_vk.list"
-struct vktable;
-/* maximum key range = 245, duplicates = 0 */
-
-#ifndef GPERF_DOWNCASE
-#define GPERF_DOWNCASE 1
-static unsigned char gperf_downcase[256] =
- {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
- 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
- 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
- 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
- 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
- 255
- };
-#endif
-
-#ifndef GPERF_CASE_STRCMP
-#define GPERF_CASE_STRCMP 1
-static int
-gperf_case_strcmp (s1, s2)
- register const char *s1;
- register const char *s2;
-{
- for (;;)
- {
- unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
- unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
- if (c1 != 0 && c1 == c2)
- continue;
- return (int)c1 - (int)c2;
- }
-}
-#endif
-
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)
-inline
-#elif defined(__GNUC__)
-__inline
-#endif
-static unsigned int
-hash (str, len)
- register const char *str;
- register unsigned int len;
-{
- static const unsigned short asso_values[] =
- {
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 51, 74,
- 80, 116, 127, 124, 95, 140, 77, 53, 7, 3,
- 257, 257, 257, 257, 257, 1, 11, 1, 55, 1,
- 25, 84, 31, 33, 13, 16, 2, 28, 8, 1,
- 6, 10, 1, 1, 3, 4, 45, 18, 73, 79,
- 30, 257, 257, 257, 257, 5, 257, 1, 11, 1,
- 55, 1, 25, 84, 31, 33, 13, 16, 2, 28,
- 8, 1, 6, 10, 1, 1, 3, 4, 45, 18,
- 73, 79, 30, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257
- };
- register int hval = len;
-
- switch (hval)
- {
- default:
- hval += asso_values[(unsigned char)str[18]];
- /*FALLTHROUGH*/
- case 18:
- hval += asso_values[(unsigned char)str[17]];
- /*FALLTHROUGH*/
- case 17:
- hval += asso_values[(unsigned char)str[16]];
- /*FALLTHROUGH*/
- case 16:
- hval += asso_values[(unsigned char)str[15]];
- /*FALLTHROUGH*/
- case 15:
- hval += asso_values[(unsigned char)str[14]];
- /*FALLTHROUGH*/
- case 14:
- hval += asso_values[(unsigned char)str[13]];
- /*FALLTHROUGH*/
- case 13:
- hval += asso_values[(unsigned char)str[12]];
- /*FALLTHROUGH*/
- case 12:
- hval += asso_values[(unsigned char)str[11]];
- /*FALLTHROUGH*/
- case 11:
- hval += asso_values[(unsigned char)str[10]];
- /*FALLTHROUGH*/
- case 10:
- hval += asso_values[(unsigned char)str[9]];
- /*FALLTHROUGH*/
- case 9:
- hval += asso_values[(unsigned char)str[8]];
- /*FALLTHROUGH*/
- case 8:
- hval += asso_values[(unsigned char)str[7]];
- /*FALLTHROUGH*/
- case 7:
- hval += asso_values[(unsigned char)str[6]];
- /*FALLTHROUGH*/
- case 6:
- hval += asso_values[(unsigned char)str[5]];
- /*FALLTHROUGH*/
- case 5:
- hval += asso_values[(unsigned char)str[4]];
- /*FALLTHROUGH*/
- case 4:
- hval += asso_values[(unsigned char)str[3]];
- /*FALLTHROUGH*/
- case 3:
- hval += asso_values[(unsigned char)str[2]+2];
- /*FALLTHROUGH*/
- case 2:
- hval += asso_values[(unsigned char)str[1]];
- /*FALLTHROUGH*/
- case 1:
- hval += asso_values[(unsigned char)str[0]];
- break;
- }
- return hval;
-}
-
-struct stringpool_t
- {
- char stringpool_str12[sizeof("UP")];
- char stringpool_str13[sizeof("APPS")];
- char stringpool_str14[sizeof("CRSEL")];
- char stringpool_str15[sizeof("SPACE")];
- char stringpool_str16[sizeof("SCROLL")];
- char stringpool_str17[sizeof("ESCAPE")];
- char stringpool_str18[sizeof("CANCEL")];
- char stringpool_str19[sizeof("ACCEPT")];
- char stringpool_str20[sizeof("SEPARATOR")];
- char stringpool_str21[sizeof("SELECT")];
- char stringpool_str22[sizeof("CONTROL")];
- char stringpool_str23[sizeof("OEM_CLEAR")];
- char stringpool_str24[sizeof("OEM_RESET")];
- char stringpool_str25[sizeof("OEM_AUTO")];
- char stringpool_str26[sizeof("OEM_CUSEL")];
- char stringpool_str28[sizeof("KANA")];
- char stringpool_str29[sizeof("OEM_PLUS")];
- char stringpool_str30[sizeof("PRIOR")];
- char stringpool_str31[sizeof("OEM_ATTN")];
- char stringpool_str32[sizeof("PAUSE")];
- char stringpool_str33[sizeof("BACK")];
- char stringpool_str34[sizeof("PACKET")];
- char stringpool_str35[sizeof("RCONTROL")];
- char stringpool_str36[sizeof("LCONTROL")];
- char stringpool_str37[sizeof("END")];
- char stringpool_str38[sizeof("HOME")];
- char stringpool_str39[sizeof("PRINT")];
- char stringpool_str40[sizeof("NUMLOCK")];
- char stringpool_str41[sizeof("LEFT")];
- char stringpool_str42[sizeof("JUNJA")];
- char stringpool_str43[sizeof("MENU")];
- char stringpool_str44[sizeof("OEM_WSCTRL")];
- char stringpool_str45[sizeof("OEM_ENLW")];
- char stringpool_str46[sizeof("NEXT")];
- char stringpool_str47[sizeof("RWIN")];
- char stringpool_str48[sizeof("LWIN")];
- char stringpool_str49[sizeof("CAPITAL")];
- char stringpool_str50[sizeof("HELP")];
- char stringpool_str51[sizeof("NONAME")];
- char stringpool_str52[sizeof("RBUTTON")];
- char stringpool_str53[sizeof("LBUTTON")];
- char stringpool_str54[sizeof("OEM_NEC_EQUAL")];
- char stringpool_str56[sizeof("INSERT")];
- char stringpool_str57[sizeof("HANJA")];
- char stringpool_str60[sizeof("SNAPSHOT")];
- char stringpool_str61[sizeof("ATTN")];
- char stringpool_str62[sizeof("TAB")];
- char stringpool_str63[sizeof("OEM_BACKTAB")];
- char stringpool_str64[sizeof("ICO_CLEAR")];
- char stringpool_str65[sizeof("CONVERT")];
- char stringpool_str66[sizeof("RETURN")];
- char stringpool_str67[sizeof("OEM_JUMP")];
- char stringpool_str71[sizeof("BROWSER_STOP")];
- char stringpool_str72[sizeof("FINAL")];
- char stringpool_str73[sizeof("ZOOM")];
- char stringpool_str74[sizeof("KANJI")];
- char stringpool_str75[sizeof("DELETE")];
- char stringpool_str76[sizeof("OEM_COMMA")];
- char stringpool_str77[sizeof("SUBTRACT")];
- char stringpool_str79[sizeof("MBUTTON")];
- char stringpool_str80[sizeof("F9")];
- char stringpool_str81[sizeof("SHIFT")];
- char stringpool_str82[sizeof("RSHIFT")];
- char stringpool_str83[sizeof("LSHIFT")];
- char stringpool_str84[sizeof("ADD")];
- char stringpool_str85[sizeof("NONCONVERT")];
- char stringpool_str86[sizeof("EXSEL")];
- char stringpool_str87[sizeof("OEM_1")];
- char stringpool_str88[sizeof("OEM_AX")];
- char stringpool_str89[sizeof("BROWSER_BACK")];
- char stringpool_str90[sizeof("OEM_8")];
- char stringpool_str91[sizeof("OEM_MINUS")];
- char stringpool_str92[sizeof("PLAY")];
- char stringpool_str93[sizeof("OEM_2")];
- char stringpool_str94[sizeof("CLEAR")];
- char stringpool_str95[sizeof("OEM_FJ_TOUROKU")];
- char stringpool_str96[sizeof("OEM_PA1")];
- char stringpool_str97[sizeof("ICO_HELP")];
- char stringpool_str98[sizeof("BROWSER_SEARCH")];
- char stringpool_str99[sizeof("SLEEP")];
- char stringpool_str101[sizeof("F1")];
- char stringpool_str102[sizeof("OEM_PA2")];
- char stringpool_str103[sizeof("OEM_COPY")];
- char stringpool_str104[sizeof("F8")];
- char stringpool_str105[sizeof("F19")];
- char stringpool_str106[sizeof("RIGHT")];
- char stringpool_str107[sizeof("F2")];
- char stringpool_str108[sizeof("OEM_6")];
- char stringpool_str109[sizeof("F18")];
- char stringpool_str111[sizeof("VOLUME_UP")];
- char stringpool_str114[sizeof("MEDIA_STOP")];
- char stringpool_str115[sizeof("OEM_PERIOD")];
- char stringpool_str117[sizeof("EREOF")];
- char stringpool_str121[sizeof("BROWSER_HOME")];
- char stringpool_str122[sizeof("F6")];
- char stringpool_str124[sizeof("BROWSER_REFRESH")];
- char stringpool_str126[sizeof("PA1")];
- char stringpool_str127[sizeof("PROCESSKEY")];
- char stringpool_str128[sizeof("DECIMAL")];
- char stringpool_str129[sizeof("OEM_3")];
- char stringpool_str130[sizeof("RMENU")];
- char stringpool_str131[sizeof("LMENU")];
- char stringpool_str132[sizeof("OEM_FJ_MASSHOU")];
- char stringpool_str133[sizeof("NUMPAD0")];
- char stringpool_str134[sizeof("HANGUL")];
- char stringpool_str135[sizeof("NUMPAD9")];
- char stringpool_str136[sizeof("HANGEUL")];
- char stringpool_str137[sizeof("OEM_5")];
- char stringpool_str138[sizeof("OEM_PA3")];
- char stringpool_str139[sizeof("VOLUME_MUTE")];
- char stringpool_str140[sizeof("OEM_4")];
- char stringpool_str141[sizeof("LAUNCH_MAIL")];
- char stringpool_str142[sizeof("OEM_FJ_JISHO")];
- char stringpool_str143[sizeof("F3")];
- char stringpool_str144[sizeof("OEM_FJ_ROYA")];
- char stringpool_str145[sizeof("OEM_FJ_LOYA")];
- char stringpool_str147[sizeof("DOWN")];
- char stringpool_str149[sizeof("OEM_FINISH")];
- char stringpool_str151[sizeof("F5")];
- char stringpool_str153[sizeof("OEM_7")];
- char stringpool_str154[sizeof("F4")];
- char stringpool_str155[sizeof("F17")];
- char stringpool_str156[sizeof("NUMPAD1")];
- char stringpool_str157[sizeof("ICO_00")];
- char stringpool_str159[sizeof("NUMPAD8")];
- char stringpool_str162[sizeof("NUMPAD2")];
- char stringpool_str164[sizeof("LAUNCH_APP1")];
- char stringpool_str165[sizeof("BROWSER_FORWARD")];
- char stringpool_str167[sizeof("F7")];
- char stringpool_str170[sizeof("LAUNCH_APP2")];
- char stringpool_str171[sizeof("MULTIPLY")];
- char stringpool_str174[sizeof("EXECUTE")];
- char stringpool_str176[sizeof("BROWSER_FAVORITES")];
- char stringpool_str177[sizeof("NUMPAD6")];
- char stringpool_str179[sizeof("F16")];
- char stringpool_str182[sizeof("F10")];
- char stringpool_str185[sizeof("VOLUME_DOWN")];
- char stringpool_str188[sizeof("F20")];
- char stringpool_str189[sizeof("MEDIA_PREV_TRACK")];
- char stringpool_str191[sizeof("MODECHANGE")];
- char stringpool_str197[sizeof("F14")];
- char stringpool_str198[sizeof("NUMPAD3")];
- char stringpool_str199[sizeof("XBUTTON1")];
- char stringpool_str203[sizeof("F24")];
- char stringpool_str205[sizeof("XBUTTON2")];
- char stringpool_str206[sizeof("NUMPAD5")];
- char stringpool_str209[sizeof("NUMPAD4")];
- char stringpool_str215[sizeof("MEDIA_PLAY_PAUSE")];
- char stringpool_str217[sizeof("LAUNCH_MEDIA_SELECT")];
- char stringpool_str218[sizeof("F11")];
- char stringpool_str220[sizeof("OEM_102")];
- char stringpool_str221[sizeof("MEDIA_NEXT_TRACK")];
- char stringpool_str222[sizeof("NUMPAD7")];
- char stringpool_str224[sizeof("F21")];
- char stringpool_str226[sizeof("F13")];
- char stringpool_str229[sizeof("F12")];
- char stringpool_str232[sizeof("F23")];
- char stringpool_str235[sizeof("F22")];
- char stringpool_str242[sizeof("F15")];
- char stringpool_str256[sizeof("DIVIDE")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "UP",
- "APPS",
- "CRSEL",
- "SPACE",
- "SCROLL",
- "ESCAPE",
- "CANCEL",
- "ACCEPT",
- "SEPARATOR",
- "SELECT",
- "CONTROL",
- "OEM_CLEAR",
- "OEM_RESET",
- "OEM_AUTO",
- "OEM_CUSEL",
- "KANA",
- "OEM_PLUS",
- "PRIOR",
- "OEM_ATTN",
- "PAUSE",
- "BACK",
- "PACKET",
- "RCONTROL",
- "LCONTROL",
- "END",
- "HOME",
- "PRINT",
- "NUMLOCK",
- "LEFT",
- "JUNJA",
- "MENU",
- "OEM_WSCTRL",
- "OEM_ENLW",
- "NEXT",
- "RWIN",
- "LWIN",
- "CAPITAL",
- "HELP",
- "NONAME",
- "RBUTTON",
- "LBUTTON",
- "OEM_NEC_EQUAL",
- "INSERT",
- "HANJA",
- "SNAPSHOT",
- "ATTN",
- "TAB",
- "OEM_BACKTAB",
- "ICO_CLEAR",
- "CONVERT",
- "RETURN",
- "OEM_JUMP",
- "BROWSER_STOP",
- "FINAL",
- "ZOOM",
- "KANJI",
- "DELETE",
- "OEM_COMMA",
- "SUBTRACT",
- "MBUTTON",
- "F9",
- "SHIFT",
- "RSHIFT",
- "LSHIFT",
- "ADD",
- "NONCONVERT",
- "EXSEL",
- "OEM_1",
- "OEM_AX",
- "BROWSER_BACK",
- "OEM_8",
- "OEM_MINUS",
- "PLAY",
- "OEM_2",
- "CLEAR",
- "OEM_FJ_TOUROKU",
- "OEM_PA1",
- "ICO_HELP",
- "BROWSER_SEARCH",
- "SLEEP",
- "F1",
- "OEM_PA2",
- "OEM_COPY",
- "F8",
- "F19",
- "RIGHT",
- "F2",
- "OEM_6",
- "F18",
- "VOLUME_UP",
- "MEDIA_STOP",
- "OEM_PERIOD",
- "EREOF",
- "BROWSER_HOME",
- "F6",
- "BROWSER_REFRESH",
- "PA1",
- "PROCESSKEY",
- "DECIMAL",
- "OEM_3",
- "RMENU",
- "LMENU",
- "OEM_FJ_MASSHOU",
- "NUMPAD0",
- "HANGUL",
- "NUMPAD9",
- "HANGEUL",
- "OEM_5",
- "OEM_PA3",
- "VOLUME_MUTE",
- "OEM_4",
- "LAUNCH_MAIL",
- "OEM_FJ_JISHO",
- "F3",
- "OEM_FJ_ROYA",
- "OEM_FJ_LOYA",
- "DOWN",
- "OEM_FINISH",
- "F5",
- "OEM_7",
- "F4",
- "F17",
- "NUMPAD1",
- "ICO_00",
- "NUMPAD8",
- "NUMPAD2",
- "LAUNCH_APP1",
- "BROWSER_FORWARD",
- "F7",
- "LAUNCH_APP2",
- "MULTIPLY",
- "EXECUTE",
- "BROWSER_FAVORITES",
- "NUMPAD6",
- "F16",
- "F10",
- "VOLUME_DOWN",
- "F20",
- "MEDIA_PREV_TRACK",
- "MODECHANGE",
- "F14",
- "NUMPAD3",
- "XBUTTON1",
- "F24",
- "XBUTTON2",
- "NUMPAD5",
- "NUMPAD4",
- "MEDIA_PLAY_PAUSE",
- "LAUNCH_MEDIA_SELECT",
- "F11",
- "OEM_102",
- "MEDIA_NEXT_TRACK",
- "NUMPAD7",
- "F21",
- "F13",
- "F12",
- "F23",
- "F22",
- "F15",
- "DIVIDE"
- };
-#define stringpool ((const char *) &stringpool_contents)
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct vktable *
-console_win32_vk (str, len)
- register const char *str;
- register unsigned int len;
-{
- enum
- {
- TOTAL_KEYWORDS = 160,
- MIN_WORD_LENGTH = 2,
- MAX_WORD_LENGTH = 19,
- MIN_HASH_VALUE = 12,
- MAX_HASH_VALUE = 256
- };
-
- static const struct vktable wordlist[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1},
-#line 40 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str12), VK_UP},
-#line 52 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str13), VK_APPS},
-#line 159 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str14), VK_CRSEL},
-#line 34 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str15), VK_SPACE},
-#line 95 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str16), VK_SCROLL},
-#line 29 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str17), VK_ESCAPE},
-#line 9 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str18), VK_CANCEL},
-#line 32 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str19), VK_ACCEPT},
-#line 66 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str20), VK_SEPARATOR},
-#line 43 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str21), VK_SELECT},
-#line 18 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str22), VK_CONTROL},
-#line 166 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str23), VK_OEM_CLEAR},
-#line 145 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str24), VK_OEM_RESET},
-#line 155 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str25), VK_OEM_AUTO},
-#line 151 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str26), VK_OEM_CUSEL},
- {-1},
-#line 22 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str28), VK_KANA},
-#line 127 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str29), VK_OEM_PLUS},
-#line 35 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str30), VK_PRIOR},
-#line 152 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str31), VK_OEM_ATTN},
-#line 20 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str32), VK_PAUSE},
-#line 13 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str33), VK_BACK},
-#line 144 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str34), VK_PACKET},
-#line 105 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str35), VK_RCONTROL},
-#line 104 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str36), VK_LCONTROL},
-#line 37 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str37), VK_END},
-#line 38 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str38), VK_HOME},
-#line 44 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str39), VK_PRINT},
-#line 94 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str40), VK_NUMLOCK},
-#line 39 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str41), VK_LEFT},
-#line 25 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str42), VK_JUNJA},
-#line 19 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str43), VK_MENU},
-#line 150 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str44), VK_OEM_WSCTRL},
-#line 156 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str45), VK_OEM_ENLW},
-#line 36 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str46), VK_NEXT},
-#line 51 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str47), VK_RWIN},
-#line 50 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str48), VK_LWIN},
-#line 21 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str49), VK_CAPITAL},
-#line 49 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str50), VK_HELP},
-#line 164 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str51), VK_NONAME},
-#line 8 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str52), VK_RBUTTON},
-#line 7 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str53), VK_LBUTTON},
-#line 96 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str54), VK_OEM_NEC_EQUAL},
- {-1},
-#line 47 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str56), VK_INSERT},
-#line 27 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str57), VK_HANJA},
- {-1}, {-1},
-#line 46 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str60), VK_SNAPSHOT},
-#line 158 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str61), VK_ATTN},
-#line 14 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str62), VK_TAB},
-#line 157 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str63), VK_OEM_BACKTAB},
-#line 143 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str64), VK_ICO_CLEAR},
-#line 30 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str65), VK_CONVERT},
-#line 16 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str66), VK_RETURN},
-#line 146 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str67), VK_OEM_JUMP},
- {-1}, {-1}, {-1},
-#line 111 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str71), VK_BROWSER_STOP},
-#line 26 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str72), VK_FINAL},
-#line 163 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str73), VK_ZOOM},
-#line 28 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str74), VK_KANJI},
-#line 48 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str75), VK_DELETE},
-#line 128 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str76), VK_OEM_COMMA},
-#line 67 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str77), VK_SUBTRACT},
- {-1},
-#line 10 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str79), VK_MBUTTON},
-#line 78 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str80), VK_F9},
-#line 17 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str81), VK_SHIFT},
-#line 103 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str82), VK_RSHIFT},
-#line 102 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str83), VK_LSHIFT},
-#line 65 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str84), VK_ADD},
-#line 31 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str85), VK_NONCONVERT},
-#line 160 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str86), VK_EXSEL},
-#line 126 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str87), VK_OEM_1},
-#line 138 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str88), VK_OEM_AX},
-#line 108 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str89), VK_BROWSER_BACK},
-#line 137 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str90), VK_OEM_8},
-#line 129 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str91), VK_OEM_MINUS},
-#line 162 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str92), VK_PLAY},
-#line 131 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str93), VK_OEM_2},
-#line 15 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str94), VK_CLEAR},
-#line 99 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str95), VK_OEM_FJ_TOUROKU},
-#line 147 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str96), VK_OEM_PA1},
-#line 140 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str97), VK_ICO_HELP},
-#line 112 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str98), VK_BROWSER_SEARCH},
-#line 53 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str99), VK_SLEEP},
- {-1},
-#line 70 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str101), VK_F1},
-#line 148 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str102), VK_OEM_PA2},
-#line 154 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str103), VK_OEM_COPY},
-#line 77 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str104), VK_F8},
-#line 88 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str105), VK_F19},
-#line 41 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str106), VK_RIGHT},
-#line 71 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str107), VK_F2},
-#line 135 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str108), VK_OEM_6},
-#line 87 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str109), VK_F18},
- {-1},
-#line 117 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str111), VK_VOLUME_UP},
- {-1}, {-1},
-#line 120 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str114), VK_MEDIA_STOP},
-#line 130 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str115), VK_OEM_PERIOD},
- {-1},
-#line 161 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str117), VK_EREOF},
- {-1}, {-1}, {-1},
-#line 114 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str121), VK_BROWSER_HOME},
-#line 75 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str122), VK_F6},
- {-1},
-#line 110 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str124), VK_BROWSER_REFRESH},
- {-1},
-#line 165 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str126), VK_PA1},
-#line 142 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str127), VK_PROCESSKEY},
-#line 68 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str128), VK_DECIMAL},
-#line 132 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str129), VK_OEM_3},
-#line 107 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str130), VK_RMENU},
-#line 106 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str131), VK_LMENU},
-#line 98 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str132), VK_OEM_FJ_MASSHOU},
-#line 54 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str133), VK_NUMPAD0},
-#line 24 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str134), VK_HANGUL},
-#line 63 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str135), VK_NUMPAD9},
-#line 23 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str136), VK_HANGEUL},
-#line 134 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str137), VK_OEM_5},
-#line 149 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str138), VK_OEM_PA3},
-#line 115 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str139), VK_VOLUME_MUTE},
-#line 133 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str140), VK_OEM_4},
-#line 122 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str141), VK_LAUNCH_MAIL},
-#line 97 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str142), VK_OEM_FJ_JISHO},
-#line 72 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str143), VK_F3},
-#line 101 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str144), VK_OEM_FJ_ROYA},
-#line 100 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str145), VK_OEM_FJ_LOYA},
- {-1},
-#line 42 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str147), VK_DOWN},
- {-1},
-#line 153 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str149), VK_OEM_FINISH},
- {-1},
-#line 74 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str151), VK_F5},
- {-1},
-#line 136 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str153), VK_OEM_7},
-#line 73 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str154), VK_F4},
-#line 86 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str155), VK_F17},
-#line 55 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str156), VK_NUMPAD1},
-#line 141 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str157), VK_ICO_00},
- {-1},
-#line 62 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str159), VK_NUMPAD8},
- {-1}, {-1},
-#line 56 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str162), VK_NUMPAD2},
- {-1},
-#line 124 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str164), VK_LAUNCH_APP1},
-#line 109 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str165), VK_BROWSER_FORWARD},
- {-1},
-#line 76 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str167), VK_F7},
- {-1}, {-1},
-#line 125 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str170), VK_LAUNCH_APP2},
-#line 64 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str171), VK_MULTIPLY},
- {-1}, {-1},
-#line 45 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str174), VK_EXECUTE},
- {-1},
-#line 113 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str176), VK_BROWSER_FAVORITES},
-#line 60 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str177), VK_NUMPAD6},
- {-1},
-#line 85 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str179), VK_F16},
- {-1}, {-1},
-#line 79 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str182), VK_F10},
- {-1}, {-1},
-#line 116 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str185), VK_VOLUME_DOWN},
- {-1}, {-1},
-#line 89 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str188), VK_F20},
-#line 119 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str189), VK_MEDIA_PREV_TRACK},
- {-1},
-#line 33 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str191), VK_MODECHANGE},
- {-1}, {-1}, {-1}, {-1}, {-1},
-#line 83 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str197), VK_F14},
-#line 57 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str198), VK_NUMPAD3},
-#line 11 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str199), VK_XBUTTON1},
- {-1}, {-1}, {-1},
-#line 93 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str203), VK_F24},
- {-1},
-#line 12 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str205), VK_XBUTTON2},
-#line 59 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str206), VK_NUMPAD5},
- {-1}, {-1},
-#line 58 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str209), VK_NUMPAD4},
- {-1}, {-1}, {-1}, {-1}, {-1},
-#line 121 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str215), VK_MEDIA_PLAY_PAUSE},
- {-1},
-#line 123 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str217), VK_LAUNCH_MEDIA_SELECT},
-#line 80 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str218), VK_F11},
- {-1},
-#line 139 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str220), VK_OEM_102},
-#line 118 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str221), VK_MEDIA_NEXT_TRACK},
-#line 61 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str222), VK_NUMPAD7},
- {-1},
-#line 90 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str224), VK_F21},
- {-1},
-#line 82 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str226), VK_F13},
- {-1}, {-1},
-#line 81 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str229), VK_F12},
- {-1}, {-1},
-#line 92 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str232), VK_F23},
- {-1}, {-1},
-#line 91 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str235), VK_F22},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 84 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str242), VK_F15},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-1}, {-1}, {-1}, {-1},
-#line 69 "win32_vk.list"
- {offsetof(struct stringpool_t, stringpool_str256), VK_DIVIDE}
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = wordlist[key].ofs;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
-
- if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s))
- return &wordlist[key];
- }
- }
- }
- return 0;
-}
diff --git a/ext/io/console/win32_vk.list b/ext/io/console/win32_vk.list
deleted file mode 100644
index 28bc9545ec..0000000000
--- a/ext/io/console/win32_vk.list
+++ /dev/null
@@ -1,166 +0,0 @@
-%{
-struct vktable {short ofs; unsigned short vk;};
-static const struct vktable *console_win32_vk(const char *, unsigned int);
-%}
-struct vktable
-%%
-LBUTTON, VK_LBUTTON
-RBUTTON, VK_RBUTTON
-CANCEL, VK_CANCEL
-MBUTTON, VK_MBUTTON
-XBUTTON1, VK_XBUTTON1
-XBUTTON2, VK_XBUTTON2
-BACK, VK_BACK
-TAB, VK_TAB
-CLEAR, VK_CLEAR
-RETURN, VK_RETURN
-SHIFT, VK_SHIFT
-CONTROL, VK_CONTROL
-MENU, VK_MENU
-PAUSE, VK_PAUSE
-CAPITAL, VK_CAPITAL
-KANA, VK_KANA
-HANGEUL, VK_HANGEUL
-HANGUL, VK_HANGUL
-JUNJA, VK_JUNJA
-FINAL, VK_FINAL
-HANJA, VK_HANJA
-KANJI, VK_KANJI
-ESCAPE, VK_ESCAPE
-CONVERT, VK_CONVERT
-NONCONVERT, VK_NONCONVERT
-ACCEPT, VK_ACCEPT
-MODECHANGE, VK_MODECHANGE
-SPACE, VK_SPACE
-PRIOR, VK_PRIOR
-NEXT, VK_NEXT
-END, VK_END
-HOME, VK_HOME
-LEFT, VK_LEFT
-UP, VK_UP
-RIGHT, VK_RIGHT
-DOWN, VK_DOWN
-SELECT, VK_SELECT
-PRINT, VK_PRINT
-EXECUTE, VK_EXECUTE
-SNAPSHOT, VK_SNAPSHOT
-INSERT, VK_INSERT
-DELETE, VK_DELETE
-HELP, VK_HELP
-LWIN, VK_LWIN
-RWIN, VK_RWIN
-APPS, VK_APPS
-SLEEP, VK_SLEEP
-NUMPAD0, VK_NUMPAD0
-NUMPAD1, VK_NUMPAD1
-NUMPAD2, VK_NUMPAD2
-NUMPAD3, VK_NUMPAD3
-NUMPAD4, VK_NUMPAD4
-NUMPAD5, VK_NUMPAD5
-NUMPAD6, VK_NUMPAD6
-NUMPAD7, VK_NUMPAD7
-NUMPAD8, VK_NUMPAD8
-NUMPAD9, VK_NUMPAD9
-MULTIPLY, VK_MULTIPLY
-ADD, VK_ADD
-SEPARATOR, VK_SEPARATOR
-SUBTRACT, VK_SUBTRACT
-DECIMAL, VK_DECIMAL
-DIVIDE, VK_DIVIDE
-F1, VK_F1
-F2, VK_F2
-F3, VK_F3
-F4, VK_F4
-F5, VK_F5
-F6, VK_F6
-F7, VK_F7
-F8, VK_F8
-F9, VK_F9
-F10, VK_F10
-F11, VK_F11
-F12, VK_F12
-F13, VK_F13
-F14, VK_F14
-F15, VK_F15
-F16, VK_F16
-F17, VK_F17
-F18, VK_F18
-F19, VK_F19
-F20, VK_F20
-F21, VK_F21
-F22, VK_F22
-F23, VK_F23
-F24, VK_F24
-NUMLOCK, VK_NUMLOCK
-SCROLL, VK_SCROLL
-OEM_NEC_EQUAL, VK_OEM_NEC_EQUAL
-OEM_FJ_JISHO, VK_OEM_FJ_JISHO
-OEM_FJ_MASSHOU, VK_OEM_FJ_MASSHOU
-OEM_FJ_TOUROKU, VK_OEM_FJ_TOUROKU
-OEM_FJ_LOYA, VK_OEM_FJ_LOYA
-OEM_FJ_ROYA, VK_OEM_FJ_ROYA
-LSHIFT, VK_LSHIFT
-RSHIFT, VK_RSHIFT
-LCONTROL, VK_LCONTROL
-RCONTROL, VK_RCONTROL
-LMENU, VK_LMENU
-RMENU, VK_RMENU
-BROWSER_BACK, VK_BROWSER_BACK
-BROWSER_FORWARD, VK_BROWSER_FORWARD
-BROWSER_REFRESH, VK_BROWSER_REFRESH
-BROWSER_STOP, VK_BROWSER_STOP
-BROWSER_SEARCH, VK_BROWSER_SEARCH
-BROWSER_FAVORITES, VK_BROWSER_FAVORITES
-BROWSER_HOME, VK_BROWSER_HOME
-VOLUME_MUTE, VK_VOLUME_MUTE
-VOLUME_DOWN, VK_VOLUME_DOWN
-VOLUME_UP, VK_VOLUME_UP
-MEDIA_NEXT_TRACK, VK_MEDIA_NEXT_TRACK
-MEDIA_PREV_TRACK, VK_MEDIA_PREV_TRACK
-MEDIA_STOP, VK_MEDIA_STOP
-MEDIA_PLAY_PAUSE, VK_MEDIA_PLAY_PAUSE
-LAUNCH_MAIL, VK_LAUNCH_MAIL
-LAUNCH_MEDIA_SELECT, VK_LAUNCH_MEDIA_SELECT
-LAUNCH_APP1, VK_LAUNCH_APP1
-LAUNCH_APP2, VK_LAUNCH_APP2
-OEM_1, VK_OEM_1
-OEM_PLUS, VK_OEM_PLUS
-OEM_COMMA, VK_OEM_COMMA
-OEM_MINUS, VK_OEM_MINUS
-OEM_PERIOD, VK_OEM_PERIOD
-OEM_2, VK_OEM_2
-OEM_3, VK_OEM_3
-OEM_4, VK_OEM_4
-OEM_5, VK_OEM_5
-OEM_6, VK_OEM_6
-OEM_7, VK_OEM_7
-OEM_8, VK_OEM_8
-OEM_AX, VK_OEM_AX
-OEM_102, VK_OEM_102
-ICO_HELP, VK_ICO_HELP
-ICO_00, VK_ICO_00
-PROCESSKEY, VK_PROCESSKEY
-ICO_CLEAR, VK_ICO_CLEAR
-PACKET, VK_PACKET
-OEM_RESET, VK_OEM_RESET
-OEM_JUMP, VK_OEM_JUMP
-OEM_PA1, VK_OEM_PA1
-OEM_PA2, VK_OEM_PA2
-OEM_PA3, VK_OEM_PA3
-OEM_WSCTRL, VK_OEM_WSCTRL
-OEM_CUSEL, VK_OEM_CUSEL
-OEM_ATTN, VK_OEM_ATTN
-OEM_FINISH, VK_OEM_FINISH
-OEM_COPY, VK_OEM_COPY
-OEM_AUTO, VK_OEM_AUTO
-OEM_ENLW, VK_OEM_ENLW
-OEM_BACKTAB, VK_OEM_BACKTAB
-ATTN, VK_ATTN
-CRSEL, VK_CRSEL
-EXSEL, VK_EXSEL
-EREOF, VK_EREOF
-PLAY, VK_PLAY
-ZOOM, VK_ZOOM
-NONAME, VK_NONAME
-PA1, VK_PA1
-OEM_CLEAR, VK_OEM_CLEAR
diff --git a/ext/io/nonblock/extconf.rb b/ext/io/nonblock/extconf.rb
index d813a01e7c..aecdc16cea 100644
--- a/ext/io/nonblock/extconf.rb
+++ b/ext/io/nonblock/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
target = "io/nonblock"
diff --git a/ext/io/nonblock/nonblock.c b/ext/io/nonblock/nonblock.c
index 2509329f6c..ccd8728a31 100644
--- a/ext/io/nonblock/nonblock.c
+++ b/ext/io/nonblock/nonblock.c
@@ -50,22 +50,21 @@ rb_io_nonblock_p(VALUE io)
#endif
#ifdef F_SETFL
-static int
+static void
io_nonblock_set(int fd, int f, int nb)
{
if (nb) {
if ((f & O_NONBLOCK) != 0)
- return 0;
+ return;
f |= O_NONBLOCK;
}
else {
if ((f & O_NONBLOCK) == 0)
- return 0;
+ return;
f &= ~O_NONBLOCK;
}
if (fcntl(fd, F_SETFL, f) == -1)
rb_sys_fail(0);
- return 1;
}
/*
@@ -80,10 +79,7 @@ rb_io_nonblock_set(VALUE io, VALUE nb)
{
rb_io_t *fptr;
GetOpenFile(io, fptr);
- if (RTEST(nb))
- rb_io_set_nonblock(fptr);
- else
- io_nonblock_set(fptr->fd, io_nonblock_mode(fptr->fd), RTEST(nb));
+ io_nonblock_set(fptr->fd, io_nonblock_mode(fptr->fd), RTEST(nb));
return io;
}
@@ -122,8 +118,7 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE io)
f = io_nonblock_mode(fptr->fd);
restore[0] = fptr->fd;
restore[1] = f;
- if (!io_nonblock_set(fptr->fd, f, nb))
- return rb_yield(io);
+ io_nonblock_set(fptr->fd, f, nb);
return rb_ensure(rb_yield, io, io_nonblock_restore, (VALUE)restore);
}
#else
diff --git a/ext/io/wait/extconf.rb b/ext/io/wait/extconf.rb
index b5d36c3fe3..eed3543124 100644
--- a/ext/io/wait/extconf.rb
+++ b/ext/io/wait/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
target = "io/wait"
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index 99435460d4..d8bb55fc47 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -44,30 +44,6 @@ static VALUE io_wait_readable _((int argc, VALUE *argv, VALUE io));
static VALUE io_wait_writable _((int argc, VALUE *argv, VALUE io));
void Init_wait _((void));
-static struct timeval *
-get_timeout(int argc, VALUE *argv, struct timeval *timerec)
-{
- VALUE timeout = Qnil;
- rb_check_arity(argc, 0, 1);
- if (!argc || NIL_P(timeout = argv[0])) {
- return NULL;
- }
- else {
- *timerec = rb_time_interval(timeout);
- return timerec;
- }
-}
-
-static int
-wait_for_single_fd(rb_io_t *fptr, int events, struct timeval *tv)
-{
- int i = rb_wait_for_single_fd(fptr->fd, events, tv);
- if (i < 0)
- rb_sys_fail(0);
- rb_io_check_closed(fptr);
- return (i & events);
-}
-
/*
* call-seq:
* io.nread -> int
@@ -86,7 +62,7 @@ io_nread(VALUE io)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
len = rb_io_read_pending(fptr);
- if (len > 0) return INT2FIX(len);
+ if (len > 0) return len;
if (!FIONREAD_POSSIBLE_P(fptr->fd)) return INT2FIX(0);
if (ioctl(fptr->fd, FIONREAD, &n)) return INT2FIX(0);
if (n > 0) return ioctl_arg2num(n);
@@ -105,42 +81,57 @@ static VALUE
io_ready_p(VALUE io)
{
rb_io_t *fptr;
- struct timeval tv = {0, 0};
+ ioctl_arg n;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
if (rb_io_read_pending(fptr)) return Qtrue;
- if (wait_for_single_fd(fptr, RB_WAITFD_IN, &tv))
- return Qtrue;
+ if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qnil;
+ if (ioctl(fptr->fd, FIONREAD, &n)) return Qnil;
+ if (n > 0) return Qtrue;
return Qfalse;
}
/*
* call-seq:
- * io.wait -> IO, true or nil
- * io.wait(timeout) -> IO, true or nil
- * io.wait_readable -> IO, true or nil
- * io.wait_readable(timeout) -> IO, true or nil
+ * io.wait -> IO, true, false or nil
+ * io.wait(timeout) -> IO, true, false or nil
+ * io.wait_readable -> IO, true, false or nil
+ * io.wait_readable(timeout) -> IO, true, false or nil
*
- * Waits until IO is readable without blocking and returns +self+, or
- * +nil+ when times out.
- * Returns +true+ immediately when buffered data is available.
+ * Waits until input is available or times out and returns self or nil when
+ * EOF is reached.
*/
static VALUE
io_wait_readable(int argc, VALUE *argv, VALUE io)
{
rb_io_t *fptr;
+ int i;
+ ioctl_arg n;
+ VALUE timeout;
struct timeval timerec;
struct timeval *tv;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
- tv = get_timeout(argc, argv, &timerec);
- if (rb_io_read_pending(fptr)) return Qtrue;
- if (wait_for_single_fd(fptr, RB_WAITFD_IN, tv)) {
- return io;
+ rb_scan_args(argc, argv, "01", &timeout);
+ if (NIL_P(timeout)) {
+ tv = NULL;
}
+ else {
+ timerec = rb_time_interval(timeout);
+ tv = &timerec;
+ }
+
+ if (rb_io_read_pending(fptr)) return Qtrue;
+ if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
+ i = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_IN, tv);
+ if (i < 0)
+ rb_sys_fail(0);
+ rb_io_check_closed(fptr);
+ if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0);
+ if (n > 0) return io;
return Qnil;
}
@@ -149,22 +140,35 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)
* io.wait_writable -> IO
* io.wait_writable(timeout) -> IO or nil
*
- * Waits until IO is writable without blocking and returns +self+ or
- * +nil+ when times out.
+ * Waits until IO writable is available or times out and returns self or
+ * nil when EOF is reached.
*/
static VALUE
io_wait_writable(int argc, VALUE *argv, VALUE io)
{
rb_io_t *fptr;
+ int i;
+ VALUE timeout;
struct timeval timerec;
struct timeval *tv;
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
- tv = get_timeout(argc, argv, &timerec);
- if (wait_for_single_fd(fptr, RB_WAITFD_OUT, tv)) {
- return io;
+ rb_scan_args(argc, argv, "01", &timeout);
+ if (NIL_P(timeout)) {
+ tv = NULL;
}
+ else {
+ timerec = rb_time_interval(timeout);
+ tv = &timerec;
+ }
+
+ i = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_OUT, tv);
+ if (i < 0)
+ rb_sys_fail(0);
+ rb_io_check_closed(fptr);
+ if (i & RB_WAITFD_OUT)
+ return io;
return Qnil;
}
@@ -173,7 +177,7 @@ io_wait_writable(int argc, VALUE *argv, VALUE io)
*/
void
-Init_wait(void)
+Init_wait()
{
rb_define_method(rb_cIO, "nread", io_nread, 0);
rb_define_method(rb_cIO, "ready?", io_ready_p, 0);
diff --git a/ext/json/extconf.rb b/ext/json/extconf.rb
index ad1ef9ba82..850798c643 100644
--- a/ext/json/extconf.rb
+++ b/ext/json/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('json')
diff --git a/ext/json/fbuffer/fbuffer.h b/ext/json/fbuffer/fbuffer.h
index 5a0a27cda5..af74187566 100644
--- a/ext/json/fbuffer/fbuffer.h
+++ b/ext/json/fbuffer/fbuffer.h
@@ -25,15 +25,6 @@
#define RSTRING_LEN(string) RSTRING(string)->len
#endif
-#ifdef PRIsVALUE
-# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
-# define RB_OBJ_STRING(obj) (obj)
-#else
-# define PRIsVALUE "s"
-# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
-# define RB_OBJ_STRING(obj) StringValueCStr(obj)
-#endif
-
#ifdef HAVE_RUBY_ENCODING_H
#include "ruby/encoding.h"
#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding())
@@ -181,7 +172,7 @@ static FBuffer *fbuffer_dup(FBuffer *fb)
static VALUE fbuffer_to_s(FBuffer *fb)
{
- VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));
+ VALUE result = rb_str_new(FBUFFER_PAIR(fb));
fbuffer_free(fb);
FORCE_UTF8(result);
return result;
diff --git a/ext/json/generator/depend b/ext/json/generator/depend
index b7373cde1f..1a042a2501 100644
--- a/ext/json/generator/depend
+++ b/ext/json/generator/depend
@@ -1,21 +1 @@
-$(OBJS): $(ruby_headers)
generator.o: generator.c generator.h $(srcdir)/../fbuffer/fbuffer.h
-
-# AUTOGENERATED DEPENDENCIES START
-generator.o: $(RUBY_EXTCONF_H)
-generator.o: $(arch_hdrdir)/ruby/config.h
-generator.o: $(hdrdir)/ruby/defines.h
-generator.o: $(hdrdir)/ruby/encoding.h
-generator.o: $(hdrdir)/ruby/intern.h
-generator.o: $(hdrdir)/ruby/missing.h
-generator.o: $(hdrdir)/ruby/oniguruma.h
-generator.o: $(hdrdir)/ruby/re.h
-generator.o: $(hdrdir)/ruby/regex.h
-generator.o: $(hdrdir)/ruby/ruby.h
-generator.o: $(hdrdir)/ruby/st.h
-generator.o: $(hdrdir)/ruby/subst.h
-generator.o: $(top_srcdir)/ext/json/fbuffer/fbuffer.h
-generator.o: $(top_srcdir)/include/ruby.h
-generator.o: generator.c
-generator.o: generator.h
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/json/generator/extconf.rb b/ext/json/generator/extconf.rb
index fd5c4a7f49..8627c5f4bd 100644
--- a/ext/json/generator/extconf.rb
+++ b/ext/json/generator/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
$defs << "-DJSON_GENERATOR"
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c
index 2cdca5685f..ed7bb82887 100644
--- a/ext/json/generator/generator.c
+++ b/ext/json/generator/generator.c
@@ -301,7 +301,7 @@ static char *fstrndup(const char *ptr, unsigned long len) {
char *result;
if (len <= 0) return NULL;
result = ALLOC_N(char, len);
- memcpy(result, ptr, len);
+ memccpy(result, ptr, 0, len);
return result;
}
@@ -486,9 +486,8 @@ static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self)
return cState_partial_generate(state, string);
}
-static void State_free(void *ptr)
+static void State_free(JSON_Generator_State *state)
{
- JSON_Generator_State *state = ptr;
if (state->indent) ruby_xfree(state->indent);
if (state->space) ruby_xfree(state->space);
if (state->space_before) ruby_xfree(state->space_before);
@@ -500,37 +499,17 @@ static void State_free(void *ptr)
ruby_xfree(state);
}
-static size_t State_memsize(const void *ptr)
-{
- const JSON_Generator_State *state = ptr;
- size_t size = sizeof(*state);
- if (state->indent) size += state->indent_len + 1;
- if (state->space) size += state->space_len + 1;
- if (state->space_before) size += state->space_before_len + 1;
- if (state->object_nl) size += state->object_nl_len + 1;
- if (state->array_nl) size += state->array_nl_len + 1;
- if (state->array_delim) size += FBUFFER_CAPA(state->array_delim);
- if (state->object_delim) size += FBUFFER_CAPA(state->object_delim);
- if (state->object_delim2) size += FBUFFER_CAPA(state->object_delim2);
- return size;
-}
-
-#ifdef NEW_TYPEDDATA_WRAPPER
-static const rb_data_type_t JSON_Generator_State_type = {
- "JSON/Generator/State",
- {NULL, State_free, State_memsize,},
-#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-#endif
-};
-#endif
+static JSON_Generator_State *State_allocate()
+{
+ JSON_Generator_State *state = ALLOC(JSON_Generator_State);
+ MEMZERO(state, JSON_Generator_State, 1);
+ return state;
+}
static VALUE cState_s_allocate(VALUE klass)
{
- JSON_Generator_State *state;
- return TypedData_Make_Struct(klass, JSON_Generator_State,
- &JSON_Generator_State_type, state);
+ JSON_Generator_State *state = State_allocate();
+ return Data_Wrap_Struct(klass, NULL, State_free, state);
}
/*
@@ -667,7 +646,7 @@ static VALUE cState_to_h(VALUE self)
/*
* call-seq: [](name)
*
-* Returns the value returned by method +name+.
+* Return the value returned by method +name+.
*/
static VALUE cState_aref(VALUE self, VALUE name)
{
@@ -682,7 +661,7 @@ static VALUE cState_aref(VALUE self, VALUE name)
/*
* call-seq: []=(name, value)
*
-* Sets the attribute name to value.
+* Set the attribute name to value.
*/
static VALUE cState_aset(VALUE self, VALUE name, VALUE value)
{
@@ -833,10 +812,10 @@ static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_St
if (!allow_nan) {
if (isinf(value)) {
fbuffer_free(buffer);
- rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
+ rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
} else if (isnan(value)) {
fbuffer_free(buffer);
- rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
+ rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
}
}
fbuffer_append_str(buffer, tmp);
@@ -871,7 +850,7 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s
} else {
tmp = rb_funcall(obj, i_to_s, 0);
Check_Type(tmp, T_STRING);
- generate_json_string(buffer, Vstate, state, tmp);
+ generate_json(buffer, Vstate, state, tmp);
}
}
@@ -892,7 +871,6 @@ static FBuffer *cState_prepare_buffer(VALUE self)
} else {
state->object_delim2 = fbuffer_alloc(16);
}
- if (state->space_before) fbuffer_append(state->object_delim2, state->space_before, state->space_before_len);
fbuffer_append_char(state->object_delim2, ':');
if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len);
@@ -980,16 +958,15 @@ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
/*
* call-seq: initialize_copy(orig)
*
- * Initializes this object from orig if it can be duplicated/cloned and returns
+ * Initializes this object from orig if it to be duplicated/cloned and returns
* it.
*/
static VALUE cState_init_copy(VALUE obj, VALUE orig)
{
JSON_Generator_State *objState, *origState;
- if (obj == orig) return obj;
- GET_STATE_TO(obj, objState);
- GET_STATE_TO(orig, origState);
+ Data_Get_Struct(obj, JSON_Generator_State, objState);
+ Data_Get_Struct(orig, JSON_Generator_State, origState);
if (!objState) rb_raise(rb_eArgError, "unallocated JSON::State");
MEMCPY(objState, origState, JSON_Generator_State, 1);
@@ -1028,7 +1005,7 @@ static VALUE cState_from_state_s(VALUE self, VALUE opts)
/*
* call-seq: indent()
*
- * Returns the string that is used to indent levels in the JSON text.
+ * This string is used to indent levels in the JSON text.
*/
static VALUE cState_indent(VALUE self)
{
@@ -1039,7 +1016,7 @@ static VALUE cState_indent(VALUE self)
/*
* call-seq: indent=(indent)
*
- * Sets the string that is used to indent levels in the JSON text.
+ * This string is used to indent levels in the JSON text.
*/
static VALUE cState_indent_set(VALUE self, VALUE indent)
{
@@ -1055,7 +1032,7 @@ static VALUE cState_indent_set(VALUE self, VALUE indent)
}
} else {
if (state->indent) ruby_xfree(state->indent);
- state->indent = fstrndup(RSTRING_PTR(indent), len);
+ state->indent = strdup(RSTRING_PTR(indent));
state->indent_len = len;
}
return Qnil;
@@ -1064,7 +1041,7 @@ static VALUE cState_indent_set(VALUE self, VALUE indent)
/*
* call-seq: space()
*
- * Returns the string that is used to insert a space between the tokens in a JSON
+ * This string is used to insert a space between the tokens in a JSON
* string.
*/
static VALUE cState_space(VALUE self)
@@ -1076,7 +1053,7 @@ static VALUE cState_space(VALUE self)
/*
* call-seq: space=(space)
*
- * Sets _space_ to the string that is used to insert a space between the tokens in a JSON
+ * This string is used to insert a space between the tokens in a JSON
* string.
*/
static VALUE cState_space_set(VALUE self, VALUE space)
@@ -1093,7 +1070,7 @@ static VALUE cState_space_set(VALUE self, VALUE space)
}
} else {
if (state->space) ruby_xfree(state->space);
- state->space = fstrndup(RSTRING_PTR(space), len);
+ state->space = strdup(RSTRING_PTR(space));
state->space_len = len;
}
return Qnil;
@@ -1102,7 +1079,7 @@ static VALUE cState_space_set(VALUE self, VALUE space)
/*
* call-seq: space_before()
*
- * Returns the string that is used to insert a space before the ':' in JSON objects.
+ * This string is used to insert a space before the ':' in JSON objects.
*/
static VALUE cState_space_before(VALUE self)
{
@@ -1113,7 +1090,7 @@ static VALUE cState_space_before(VALUE self)
/*
* call-seq: space_before=(space_before)
*
- * Sets the string that is used to insert a space before the ':' in JSON objects.
+ * This string is used to insert a space before the ':' in JSON objects.
*/
static VALUE cState_space_before_set(VALUE self, VALUE space_before)
{
@@ -1129,7 +1106,7 @@ static VALUE cState_space_before_set(VALUE self, VALUE space_before)
}
} else {
if (state->space_before) ruby_xfree(state->space_before);
- state->space_before = fstrndup(RSTRING_PTR(space_before), len);
+ state->space_before = strdup(RSTRING_PTR(space_before));
state->space_before_len = len;
}
return Qnil;
@@ -1166,7 +1143,7 @@ static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
}
} else {
if (state->object_nl) ruby_xfree(state->object_nl);
- state->object_nl = fstrndup(RSTRING_PTR(object_nl), len);
+ state->object_nl = strdup(RSTRING_PTR(object_nl));
state->object_nl_len = len;
}
return Qnil;
@@ -1201,7 +1178,7 @@ static VALUE cState_array_nl_set(VALUE self, VALUE array_nl)
}
} else {
if (state->array_nl) ruby_xfree(state->array_nl);
- state->array_nl = fstrndup(RSTRING_PTR(array_nl), len);
+ state->array_nl = strdup(RSTRING_PTR(array_nl));
state->array_nl_len = len;
}
return Qnil;
@@ -1320,7 +1297,7 @@ static VALUE cState_depth_set(VALUE self, VALUE depth)
/*
* call-seq: buffer_initial_length
*
- * This integer returns the current initial length of the buffer.
+ * This integer returns the current inital length of the buffer.
*/
static VALUE cState_buffer_initial_length(VALUE self)
{
@@ -1349,7 +1326,7 @@ static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_l
/*
*
*/
-void Init_generator(void)
+void Init_generator()
{
rb_require("json/common");
diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h
index 6bbf817b7d..b58cc4bc2f 100644
--- a/ext/json/generator/generator.h
+++ b/ext/json/generator/generator.h
@@ -1,6 +1,7 @@
#ifndef _GENERATOR_H_
#define _GENERATOR_H_
+#include <string.h>
#include <math.h>
#include <ctype.h>
@@ -22,7 +23,7 @@
#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
-/* unicode definitions */
+/* unicode defintions */
#define UNI_STRICT_CONVERSION 1
@@ -77,12 +78,9 @@ typedef struct JSON_Generator_StateStruct {
long buffer_initial_length;
} JSON_Generator_State;
-#define GET_STATE_TO(self, state) \
- TypedData_Get_Struct(self, JSON_Generator_State, &JSON_Generator_State_type, state)
-
#define GET_STATE(self) \
JSON_Generator_State *state; \
- GET_STATE_TO(self, state)
+ Data_Get_Struct(self, JSON_Generator_State, state)
#define GENERATE_JSON(type) \
FBuffer *buffer; \
@@ -91,7 +89,7 @@ typedef struct JSON_Generator_StateStruct {
\
rb_scan_args(argc, argv, "01", &Vstate); \
Vstate = cState_from_state_s(cState, Vstate); \
- TypedData_Get_Struct(Vstate, JSON_Generator_State, &JSON_Generator_State_type, state); \
+ Data_Get_Struct(Vstate, JSON_Generator_State, state); \
buffer = cState_prepare_buffer(Vstate); \
generate_json_##type(buffer, Vstate, state, self); \
return fbuffer_to_s(buffer)
@@ -110,7 +108,8 @@ static VALUE mTrueClass_to_json(int argc, VALUE *argv, VALUE self);
static VALUE mFalseClass_to_json(int argc, VALUE *argv, VALUE self);
static VALUE mNilClass_to_json(int argc, VALUE *argv, VALUE self);
static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self);
-static void State_free(void *state);
+static void State_free(JSON_Generator_State *state);
+static JSON_Generator_State *State_allocate();
static VALUE cState_s_allocate(VALUE klass);
static VALUE cState_configure(VALUE self, VALUE opts);
static VALUE cState_to_h(VALUE self);
@@ -145,21 +144,5 @@ static VALUE cState_ascii_only_p(VALUE self);
static VALUE cState_depth(VALUE self);
static VALUE cState_depth_set(VALUE self, VALUE depth);
static FBuffer *cState_prepare_buffer(VALUE self);
-#ifndef ZALLOC
-#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
-static inline void *ruby_zalloc(size_t n)
-{
- void *p = ruby_xmalloc(n);
- memset(p, 0, n);
- return p;
-}
-#endif
-#ifdef TypedData_Make_Struct
-static const rb_data_type_t JSON_Generator_State_type;
-#define NEW_TYPEDDATA_WRAPPER 1
-#else
-#define TypedData_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, State_free, json)
-#define TypedData_Get_Struct(self, JSON_Generator_State, ignore, json) Data_Get_Struct(self, JSON_Generator_State, json)
-#endif
#endif
diff --git a/ext/json/json.gemspec b/ext/json/json.gemspec
deleted file mode 100644
index e3c897a977..0000000000
--- a/ext/json/json.gemspec
+++ /dev/null
@@ -1,7 +0,0 @@
-Gem::Specification.new do |s|
- s.name = "json"
- s.version = "1.8.3.1"
- s.summary = "This json is bundled with Ruby"
- s.executables = []
- s.files = ["json.rb", "json/add/bigdecimal.rb", "json/add/complex.rb", "json/add/core.rb", "json/add/date.rb", "json/add/date_time.rb", "json/add/exception.rb", "json/add/ostruct.rb", "json/add/range.rb", "json/add/rational.rb", "json/add/regexp.rb", "json/add/struct.rb", "json/add/symbol.rb", "json/add/time.rb", "json/common.rb", "json/ext.rb", "json/ext/generator.bundle", "json/ext/parser.bundle", "json/generic_object.rb", "json/version.rb"]
-end
diff --git a/ext/json/lib/json.rb b/ext/json/lib/json.rb
index 61bb8fae0e..24aa385c91 100644
--- a/ext/json/lib/json.rb
+++ b/ext/json/lib/json.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'json/common'
##
diff --git a/ext/json/lib/json/add/bigdecimal.rb b/ext/json/lib/json/add/bigdecimal.rb
index a7646860a2..0ef69f12e0 100644
--- a/ext/json/lib/json/add/bigdecimal.rb
+++ b/ext/json/lib/json/add/bigdecimal.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
diff --git a/ext/json/lib/json/add/complex.rb b/ext/json/lib/json/add/complex.rb
index 65d388b48a..d7ebebf5f7 100644
--- a/ext/json/lib/json/add/complex.rb
+++ b/ext/json/lib/json/add/complex.rb
@@ -1,19 +1,13 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
defined?(::Complex) or require 'complex'
class Complex
-
- # Deserializes JSON string by converting Real value <tt>r</tt>, imaginary
- # value <tt>i</tt>, to a Complex object.
def self.json_create(object)
Complex(object['r'], object['i'])
end
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
def as_json(*)
{
JSON.create_id => self.class.name,
@@ -22,7 +16,6 @@ class Complex
}
end
- # Stores class name (Complex) along with real value <tt>r</tt> and imaginary value <tt>i</tt> as JSON string
def to_json(*)
as_json.to_json
end
diff --git a/ext/json/lib/json/add/core.rb b/ext/json/lib/json/add/core.rb
index 93b2bff424..77d9dc0b20 100644
--- a/ext/json/lib/json/add/core.rb
+++ b/ext/json/lib/json/add/core.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# This file requires the implementations of ruby core's custom objects for
# serialisation/deserialisation.
diff --git a/ext/json/lib/json/add/date.rb b/ext/json/lib/json/add/date.rb
index b58af76e10..4288237db1 100644
--- a/ext/json/lib/json/add/date.rb
+++ b/ext/json/lib/json/add/date.rb
@@ -1,9 +1,9 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
require 'date'
+# Date serialization/deserialization
class Date
# Deserializes JSON string by converting Julian year <tt>y</tt>, month
diff --git a/ext/json/lib/json/add/date_time.rb b/ext/json/lib/json/add/date_time.rb
index f794eb3d7d..5ea42ea656 100644
--- a/ext/json/lib/json/add/date_time.rb
+++ b/ext/json/lib/json/add/date_time.rb
@@ -1,9 +1,9 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
require 'date'
+# DateTime serialization/deserialization
class DateTime
# Deserializes JSON string by converting year <tt>y</tt>, month <tt>m</tt>,
diff --git a/ext/json/lib/json/add/exception.rb b/ext/json/lib/json/add/exception.rb
index caac713c6a..e6ad257abf 100644
--- a/ext/json/lib/json/add/exception.rb
+++ b/ext/json/lib/json/add/exception.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
+# Exception serialization/deserialization
class Exception
# Deserializes JSON string by constructing new Exception object with message
diff --git a/ext/json/lib/json/add/ostruct.rb b/ext/json/lib/json/add/ostruct.rb
index 1f9ce7b3b4..da81e107a7 100644
--- a/ext/json/lib/json/add/ostruct.rb
+++ b/ext/json/lib/json/add/ostruct.rb
@@ -1,9 +1,9 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
require 'ostruct'
+# OpenStruct serialization/deserialization
class OpenStruct
# Deserializes JSON string by constructing new Struct object with values
diff --git a/ext/json/lib/json/add/range.rb b/ext/json/lib/json/add/range.rb
index 3ef20150bf..e61e553cdb 100644
--- a/ext/json/lib/json/add/range.rb
+++ b/ext/json/lib/json/add/range.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
+# Range serialization/deserialization
class Range
# Deserializes JSON string by constructing new Range object with arguments
diff --git a/ext/json/lib/json/add/rational.rb b/ext/json/lib/json/add/rational.rb
index e83a532775..867cd92f05 100644
--- a/ext/json/lib/json/add/rational.rb
+++ b/ext/json/lib/json/add/rational.rb
@@ -1,18 +1,13 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
defined?(::Rational) or require 'rational'
class Rational
- # Deserializes JSON string by converting numerator value <tt>n</tt>,
- # denominator value <tt>d</tt>, to a Rational object.
def self.json_create(object)
Rational(object['n'], object['d'])
end
- # Returns a hash, that will be turned into a JSON object and represent this
- # object.
def as_json(*)
{
JSON.create_id => self.class.name,
@@ -21,7 +16,6 @@ class Rational
}
end
- # Stores class name (Rational) along with numerator value <tt>n</tt> and denominator value <tt>d</tt> as JSON string
def to_json(*)
as_json.to_json
end
diff --git a/ext/json/lib/json/add/regexp.rb b/ext/json/lib/json/add/regexp.rb
index 41b260f307..2fcbb6fb14 100644
--- a/ext/json/lib/json/add/regexp.rb
+++ b/ext/json/lib/json/add/regexp.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
+# Regexp serialization/deserialization
class Regexp
# Deserializes JSON string by constructing new Regexp object with source
diff --git a/ext/json/lib/json/add/struct.rb b/ext/json/lib/json/add/struct.rb
index d08d88237a..6847cde99b 100644
--- a/ext/json/lib/json/add/struct.rb
+++ b/ext/json/lib/json/add/struct.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
+# Struct serialization/deserialization
class Struct
# Deserializes JSON string by constructing new Struct object with values
diff --git a/ext/json/lib/json/add/symbol.rb b/ext/json/lib/json/add/symbol.rb
index 31b56a294f..03dc9a56a5 100644
--- a/ext/json/lib/json/add/symbol.rb
+++ b/ext/json/lib/json/add/symbol.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
+# Symbol serialization/deserialization
class Symbol
# Returns a hash, that will be turned into a JSON object and represent this
# object.
diff --git a/ext/json/lib/json/add/time.rb b/ext/json/lib/json/add/time.rb
index 80b6434f17..338209d899 100644
--- a/ext/json/lib/json/add/time.rb
+++ b/ext/json/lib/json/add/time.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
require 'json'
end
+# Time serialization/deserialization
class Time
# Deserializes JSON string by converting time since epoch to Time
@@ -10,7 +10,7 @@ class Time
if usec = object.delete('u') # used to be tv_usec -> tv_nsec
object['n'] = usec * 1000
end
- if method_defined?(:tv_nsec)
+ if instance_methods.include?(:tv_nsec)
at(object['s'], Rational(object['n'], 1000))
else
at(object['s'], object['n'] / 1000)
diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb
index 020615fc1d..e24f637f61 100644
--- a/ext/json/lib/json/common.rb
+++ b/ext/json/lib/json/common.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'json/version'
require 'json/generic_object'
@@ -149,7 +148,7 @@ module JSON
# the default.
# * *create_additions*: If set to false, the Parser doesn't create
# additions even if a matching class and create_id was found. This option
- # defaults to false.
+ # defaults to true.
# * *object_class*: Defaults to Hash
# * *array_class*: Defaults to Array
def parse(source, opts = {})
@@ -170,7 +169,7 @@ module JSON
# to true.
# * *create_additions*: If set to false, the Parser doesn't create
# additions even if a matching class and create_id was found. This option
- # defaults to false.
+ # defaults to true.
def parse!(source, opts = {})
opts = {
:max_nesting => false,
@@ -391,7 +390,7 @@ module JSON
end
end
opts = JSON.dump_default_options
- opts = opts.merge(:max_nesting => limit) if limit
+ limit and opts.update(:max_nesting => limit)
result = generate(obj, opts)
if anIO
anIO.write result
@@ -412,7 +411,7 @@ module JSON
string
end
- # Shortcut for iconv.
+ # Shortuct for iconv.
if ::String.method_defined?(:encode)
# Encodes string using Ruby's _String.encode_
def self.iconv(to, from, string)
@@ -449,7 +448,7 @@ module ::Kernel
nil
end
- # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
+ # Ouputs _objs_ to STDOUT as JSON strings in a pretty format, with
# indentation and over many lines.
def jj(*objs)
objs.each do |obj|
diff --git a/ext/json/lib/json/ext.rb b/ext/json/lib/json/ext.rb
index 2486f084cd..c5f813181d 100644
--- a/ext/json/lib/json/ext.rb
+++ b/ext/json/lib/json/ext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
if ENV['SIMPLECOV_COVERAGE'].to_i == 1
require 'simplecov'
SimpleCov.start do
diff --git a/ext/json/lib/json/generic_object.rb b/ext/json/lib/json/generic_object.rb
index 2241f6c7ce..8b8fd53bef 100644
--- a/ext/json/lib/json/generic_object.rb
+++ b/ext/json/lib/json/generic_object.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'ostruct'
module JSON
@@ -48,6 +47,14 @@ module JSON
table
end
+ def [](name)
+ table[name.to_sym]
+ end
+
+ def []=(name, value)
+ __send__ "#{name}=", value
+ end
+
def |(other)
self.class[other.to_hash.merge(to_hash)]
end
diff --git a/ext/json/lib/json/version.rb b/ext/json/lib/json/version.rb
index cd7ddf8777..47cdcd607c 100644
--- a/ext/json/lib/json/version.rb
+++ b/ext/json/lib/json/version.rb
@@ -1,7 +1,6 @@
-# frozen_string_literal: false
module JSON
# JSON version
- VERSION = '1.8.3.1'
+ VERSION = '1.8.1'
VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
diff --git a/ext/json/parser/depend b/ext/json/parser/depend
index bc5db06404..498ffa964c 100644
--- a/ext/json/parser/depend
+++ b/ext/json/parser/depend
@@ -1,20 +1 @@
-$(OBJS): $(ruby_headers)
parser.o: parser.c parser.h $(srcdir)/../fbuffer/fbuffer.h
-
-# AUTOGENERATED DEPENDENCIES START
-parser.o: $(RUBY_EXTCONF_H)
-parser.o: $(arch_hdrdir)/ruby/config.h
-parser.o: $(hdrdir)/ruby/defines.h
-parser.o: $(hdrdir)/ruby/encoding.h
-parser.o: $(hdrdir)/ruby/intern.h
-parser.o: $(hdrdir)/ruby/missing.h
-parser.o: $(hdrdir)/ruby/oniguruma.h
-parser.o: $(hdrdir)/ruby/ruby.h
-parser.o: $(hdrdir)/ruby/st.h
-parser.o: $(hdrdir)/ruby/subst.h
-parser.o: $(top_srcdir)/ext/json/fbuffer/fbuffer.h
-parser.o: $(top_srcdir)/include/ruby.h
-parser.o: parser.c
-parser.o: parser.h
-parser.o: parser.rl
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/json/parser/extconf.rb b/ext/json/parser/extconf.rb
index f7360d46b2..ae4f861c79 100644
--- a/ext/json/parser/extconf.rb
+++ b/ext/json/parser/extconf.rb
@@ -1,6 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
-have_func("rb_enc_raise", "ruby.h")
-
create_makefile 'json/ext/parser'
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c
index 773605cf7c..df89f2c58b 100644
--- a/ext/json/parser/parser.c
+++ b/ext/json/parser/parser.c
@@ -3,28 +3,6 @@
#include "../fbuffer/fbuffer.h"
#include "parser.h"
-#if defined HAVE_RUBY_ENCODING_H
-# define EXC_ENCODING UTF_8,
-# ifndef HAVE_RB_ENC_RAISE
-static void
-enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...)
-{
- va_list args;
- VALUE mesg;
-
- va_start(args, fmt);
- mesg = rb_enc_vsprintf(enc, fmt, args);
- va_end(args);
-
- rb_exc_raise(rb_exc_new3(exc, mesg));
-}
-# define rb_enc_raise enc_raise
-# endif
-#else
-# define EXC_ENCODING /* nothing */
-# define rb_enc_raise rb_raise
-#endif
-
/* unicode */
static const char digit_values[256] = {
@@ -50,16 +28,16 @@ static UTF32 unescape_unicode(const unsigned char *p)
UTF32 result = 0;
b = digit_values[p[0]];
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
+ result = (result << 4) | b;
b = digit_values[p[1]];
+ result = (result << 4) | b;
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
b = digit_values[p[2]];
+ result = (result << 4) | b;
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
b = digit_values[p[3]];
+ result = (result << 4) | b;
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
return result;
}
@@ -90,7 +68,9 @@ static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
}
#ifdef HAVE_RUBY_ENCODING_H
-static rb_encoding *UTF_8, *UTF_16BE, *UTF_16LE, *UTF_32BE, *UTF_32LE;
+static VALUE CEncoding_ASCII_8BIT, CEncoding_UTF_8, CEncoding_UTF_16BE,
+ CEncoding_UTF_16LE, CEncoding_UTF_32BE, CEncoding_UTF_32LE;
+static ID i_encoding, i_encode;
#else
static ID i_iconv;
#endif
@@ -104,19 +84,19 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
i_match_string, i_aset, i_aref, i_leftshift;
-#line 130 "parser.rl"
+#line 110 "parser.rl"
-#line 112 "parser.c"
-enum {JSON_object_start = 1};
-enum {JSON_object_first_final = 27};
-enum {JSON_object_error = 0};
+#line 92 "parser.c"
+static const int JSON_object_start = 1;
+static const int JSON_object_first_final = 27;
+static const int JSON_object_error = 0;
-enum {JSON_object_en_main = 1};
+static const int JSON_object_en_main = 1;
-#line 171 "parser.rl"
+#line 151 "parser.rl"
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -132,14 +112,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
*result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class);
-#line 136 "parser.c"
+#line 116 "parser.c"
{
cs = JSON_object_start;
}
-#line 186 "parser.rl"
+#line 166 "parser.rl"
-#line 143 "parser.c"
+#line 123 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -167,7 +147,7 @@ case 2:
goto st2;
goto st0;
tr2:
-#line 153 "parser.rl"
+#line 133 "parser.rl"
{
char *np;
json->parsing_name = 1;
@@ -180,7 +160,7 @@ st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
-#line 184 "parser.c"
+#line 164 "parser.c"
switch( (*p) ) {
case 13: goto st3;
case 32: goto st3;
@@ -247,7 +227,7 @@ case 8:
goto st8;
goto st0;
tr11:
-#line 138 "parser.rl"
+#line 118 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
@@ -267,7 +247,7 @@ st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
-#line 271 "parser.c"
+#line 251 "parser.c"
switch( (*p) ) {
case 13: goto st9;
case 32: goto st9;
@@ -356,14 +336,14 @@ case 18:
goto st9;
goto st18;
tr4:
-#line 161 "parser.rl"
+#line 141 "parser.rl"
{ p--; {p++; cs = 27; goto _out;} }
goto st27;
st27:
if ( ++p == pe )
goto _test_eof27;
case 27:
-#line 367 "parser.c"
+#line 347 "parser.c"
goto st0;
st19:
if ( ++p == pe )
@@ -461,7 +441,7 @@ case 26:
_out: {}
}
-#line 187 "parser.rl"
+#line 167 "parser.rl"
if (cs >= JSON_object_first_final) {
if (json->create_additions) {
@@ -486,15 +466,15 @@ case 26:
-#line 490 "parser.c"
-enum {JSON_value_start = 1};
-enum {JSON_value_first_final = 21};
-enum {JSON_value_error = 0};
+#line 470 "parser.c"
+static const int JSON_value_start = 1;
+static const int JSON_value_first_final = 21;
+static const int JSON_value_error = 0;
-enum {JSON_value_en_main = 1};
+static const int JSON_value_en_main = 1;
-#line 291 "parser.rl"
+#line 271 "parser.rl"
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -502,14 +482,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
int cs = EVIL;
-#line 506 "parser.c"
+#line 486 "parser.c"
{
cs = JSON_value_start;
}
-#line 298 "parser.rl"
+#line 278 "parser.rl"
-#line 513 "parser.c"
+#line 493 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -534,14 +514,14 @@ st0:
cs = 0;
goto _out;
tr0:
-#line 239 "parser.rl"
+#line 219 "parser.rl"
{
char *np = JSON_parse_string(json, p, pe, result);
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
}
goto st21;
tr2:
-#line 244 "parser.rl"
+#line 224 "parser.rl"
{
char *np;
if(pe > p + 9 - json->quirks_mode && !strncmp(MinusInfinity, p, 9)) {
@@ -550,7 +530,7 @@ tr2:
{p = (( p + 10))-1;}
p--; {p++; cs = 21; goto _out;}
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
}
}
np = JSON_parse_float(json, p, pe, result);
@@ -561,7 +541,7 @@ tr2:
}
goto st21;
tr5:
-#line 262 "parser.rl"
+#line 242 "parser.rl"
{
char *np;
json->current_nesting++;
@@ -571,7 +551,7 @@ tr5:
}
goto st21;
tr9:
-#line 270 "parser.rl"
+#line 250 "parser.rl"
{
char *np;
json->current_nesting++;
@@ -581,39 +561,39 @@ tr9:
}
goto st21;
tr16:
-#line 232 "parser.rl"
+#line 212 "parser.rl"
{
if (json->allow_nan) {
*result = CInfinity;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
}
}
goto st21;
tr18:
-#line 225 "parser.rl"
+#line 205 "parser.rl"
{
if (json->allow_nan) {
*result = CNaN;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
}
}
goto st21;
tr22:
-#line 219 "parser.rl"
+#line 199 "parser.rl"
{
*result = Qfalse;
}
goto st21;
tr25:
-#line 216 "parser.rl"
+#line 196 "parser.rl"
{
*result = Qnil;
}
goto st21;
tr28:
-#line 222 "parser.rl"
+#line 202 "parser.rl"
{
*result = Qtrue;
}
@@ -622,9 +602,9 @@ st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
-#line 278 "parser.rl"
+#line 258 "parser.rl"
{ p--; {p++; cs = 21; goto _out;} }
-#line 628 "parser.c"
+#line 608 "parser.c"
goto st0;
st2:
if ( ++p == pe )
@@ -785,7 +765,7 @@ case 20:
_out: {}
}
-#line 299 "parser.rl"
+#line 279 "parser.rl"
if (cs >= JSON_value_first_final) {
return p;
@@ -795,15 +775,15 @@ case 20:
}
-#line 799 "parser.c"
-enum {JSON_integer_start = 1};
-enum {JSON_integer_first_final = 3};
-enum {JSON_integer_error = 0};
+#line 779 "parser.c"
+static const int JSON_integer_start = 1;
+static const int JSON_integer_first_final = 3;
+static const int JSON_integer_error = 0;
-enum {JSON_integer_en_main = 1};
+static const int JSON_integer_en_main = 1;
-#line 315 "parser.rl"
+#line 295 "parser.rl"
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -811,15 +791,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
int cs = EVIL;
-#line 815 "parser.c"
+#line 795 "parser.c"
{
cs = JSON_integer_start;
}
-#line 322 "parser.rl"
+#line 302 "parser.rl"
json->memo = p;
-#line 823 "parser.c"
+#line 803 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -853,14 +833,14 @@ case 3:
goto st0;
goto tr4;
tr4:
-#line 312 "parser.rl"
+#line 292 "parser.rl"
{ p--; {p++; cs = 4; goto _out;} }
goto st4;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
-#line 864 "parser.c"
+#line 844 "parser.c"
goto st0;
st5:
if ( ++p == pe )
@@ -879,7 +859,7 @@ case 5:
_out: {}
}
-#line 324 "parser.rl"
+#line 304 "parser.rl"
if (cs >= JSON_integer_first_final) {
long len = p - json->memo;
@@ -894,15 +874,15 @@ case 5:
}
-#line 898 "parser.c"
-enum {JSON_float_start = 1};
-enum {JSON_float_first_final = 8};
-enum {JSON_float_error = 0};
+#line 878 "parser.c"
+static const int JSON_float_start = 1;
+static const int JSON_float_first_final = 8;
+static const int JSON_float_error = 0;
-enum {JSON_float_en_main = 1};
+static const int JSON_float_en_main = 1;
-#line 349 "parser.rl"
+#line 329 "parser.rl"
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -910,15 +890,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
int cs = EVIL;
-#line 914 "parser.c"
+#line 894 "parser.c"
{
cs = JSON_float_start;
}
-#line 356 "parser.rl"
+#line 336 "parser.rl"
json->memo = p;
-#line 922 "parser.c"
+#line 902 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -976,14 +956,14 @@ case 8:
goto st0;
goto tr9;
tr9:
-#line 343 "parser.rl"
+#line 323 "parser.rl"
{ p--; {p++; cs = 9; goto _out;} }
goto st9;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
-#line 987 "parser.c"
+#line 967 "parser.c"
goto st0;
st5:
if ( ++p == pe )
@@ -1044,7 +1024,7 @@ case 7:
_out: {}
}
-#line 358 "parser.rl"
+#line 338 "parser.rl"
if (cs >= JSON_float_first_final) {
long len = p - json->memo;
@@ -1060,15 +1040,15 @@ case 7:
-#line 1064 "parser.c"
-enum {JSON_array_start = 1};
-enum {JSON_array_first_final = 17};
-enum {JSON_array_error = 0};
+#line 1044 "parser.c"
+static const int JSON_array_start = 1;
+static const int JSON_array_first_final = 17;
+static const int JSON_array_error = 0;
-enum {JSON_array_en_main = 1};
+static const int JSON_array_en_main = 1;
-#line 401 "parser.rl"
+#line 381 "parser.rl"
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -1082,14 +1062,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
*result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
-#line 1086 "parser.c"
+#line 1066 "parser.c"
{
cs = JSON_array_start;
}
-#line 414 "parser.rl"
+#line 394 "parser.rl"
-#line 1093 "parser.c"
+#line 1073 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1128,7 +1108,7 @@ case 2:
goto st2;
goto st0;
tr2:
-#line 378 "parser.rl"
+#line 358 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
@@ -1148,7 +1128,7 @@ st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
-#line 1152 "parser.c"
+#line 1132 "parser.c"
switch( (*p) ) {
case 13: goto st3;
case 32: goto st3;
@@ -1248,14 +1228,14 @@ case 12:
goto st3;
goto st12;
tr4:
-#line 393 "parser.rl"
+#line 373 "parser.rl"
{ p--; {p++; cs = 17; goto _out;} }
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
-#line 1259 "parser.c"
+#line 1239 "parser.c"
goto st0;
st13:
if ( ++p == pe )
@@ -1311,12 +1291,12 @@ case 16:
_out: {}
}
-#line 415 "parser.rl"
+#line 395 "parser.rl"
if(cs >= JSON_array_first_final) {
return p + 1;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
return NULL;
}
}
@@ -1392,15 +1372,15 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
}
-#line 1396 "parser.c"
-enum {JSON_string_start = 1};
-enum {JSON_string_first_final = 8};
-enum {JSON_string_error = 0};
+#line 1376 "parser.c"
+static const int JSON_string_start = 1;
+static const int JSON_string_first_final = 8;
+static const int JSON_string_error = 0;
-enum {JSON_string_en_main = 1};
+static const int JSON_string_en_main = 1;
-#line 514 "parser.rl"
+#line 494 "parser.rl"
static int
@@ -1422,15 +1402,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
*result = rb_str_buf_new(0);
-#line 1426 "parser.c"
+#line 1406 "parser.c"
{
cs = JSON_string_start;
}
-#line 535 "parser.rl"
+#line 515 "parser.rl"
json->memo = p;
-#line 1434 "parser.c"
+#line 1414 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1455,7 +1435,7 @@ case 2:
goto st0;
goto st2;
tr2:
-#line 500 "parser.rl"
+#line 480 "parser.rl"
{
*result = json_string_unescape(*result, json->memo + 1, p);
if (NIL_P(*result)) {
@@ -1466,14 +1446,14 @@ tr2:
{p = (( p + 1))-1;}
}
}
-#line 511 "parser.rl"
+#line 491 "parser.rl"
{ p--; {p++; cs = 8; goto _out;} }
goto st8;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
-#line 1477 "parser.c"
+#line 1457 "parser.c"
goto st0;
st3:
if ( ++p == pe )
@@ -1549,7 +1529,7 @@ case 7:
_out: {}
}
-#line 537 "parser.rl"
+#line 517 "parser.rl"
if (json->create_additions && RTEST(match_string = json->match_string)) {
VALUE klass;
@@ -1586,29 +1566,29 @@ case 7:
static VALUE convert_encoding(VALUE source)
{
- const char *ptr = RSTRING_PTR(source);
+ char *ptr = RSTRING_PTR(source);
long len = RSTRING_LEN(source);
if (len < 2) {
rb_raise(eParserError, "A JSON text must at least contain two octets!");
}
#ifdef HAVE_RUBY_ENCODING_H
{
- rb_encoding *enc = rb_enc_get(source);
- if (enc == rb_ascii8bit_encoding()) {
+ VALUE encoding = rb_funcall(source, i_encoding, 0);
+ if (encoding == CEncoding_ASCII_8BIT) {
if (len >= 4 && ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0) {
- source = rb_str_conv_enc(source, UTF_32BE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_32BE);
} else if (len >= 4 && ptr[0] == 0 && ptr[2] == 0) {
- source = rb_str_conv_enc(source, UTF_16BE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16BE);
} else if (len >= 4 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) {
- source = rb_str_conv_enc(source, UTF_32LE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_32LE);
} else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
- source = rb_str_conv_enc(source, UTF_16LE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16LE);
} else {
source = rb_str_dup(source);
FORCE_UTF8(source);
}
} else {
- source = rb_str_conv_enc(source, NULL, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 1, CEncoding_UTF_8);
}
}
#else
@@ -1646,8 +1626,8 @@ static VALUE convert_encoding(VALUE source)
* (keys) in a JSON object. Otherwise strings are returned, which is also
* the default.
* * *create_additions*: If set to false, the Parser doesn't create
- * additions even if a matching class and create_id was found. This option
- * defaults to false.
+ * additions even if a matchin class and create_id was found. This option
+ * defaults to true.
* * *object_class*: Defaults to Hash
* * *array_class*: Defaults to Array
*/
@@ -1659,18 +1639,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
if (json->Vsource) {
rb_raise(rb_eTypeError, "already initialized instance");
}
-#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
- rb_scan_args(argc, argv, "1:", &source, &opts);
-#else
rb_scan_args(argc, argv, "11", &source, &opts);
-#endif
if (!NIL_P(opts)) {
-#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
if (NIL_P(opts)) {
rb_raise(rb_eArgError, "opts needs to be like a hash");
} else {
-#endif
VALUE tmp = ID2SYM(i_max_nesting);
if (option_given_p(opts, tmp)) {
VALUE max_nesting = rb_hash_aref(opts, tmp);
@@ -1733,9 +1707,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
} else {
json->match_string = Qnil;
}
-#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
}
-#endif
} else {
json->max_nesting = 100;
json->allow_nan = 0;
@@ -1744,11 +1716,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
json->object_class = Qnil;
json->array_class = Qnil;
}
- StringValue(source);
+ source = rb_convert_type(source, T_STRING, "String", "to_str");
if (!json->quirks_mode) {
- source = convert_encoding(source);
+ source = convert_encoding(StringValue(source));
}
json->current_nesting = 0;
+ StringValue(source);
json->len = RSTRING_LEN(source);
json->source = RSTRING_PTR(source);;
json->Vsource = source;
@@ -1756,15 +1729,15 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
}
-#line 1760 "parser.c"
-enum {JSON_start = 1};
-enum {JSON_first_final = 10};
-enum {JSON_error = 0};
+#line 1733 "parser.c"
+static const int JSON_start = 1;
+static const int JSON_first_final = 10;
+static const int JSON_error = 0;
-enum {JSON_en_main = 1};
+static const int JSON_en_main = 1;
-#line 767 "parser.rl"
+#line 740 "parser.rl"
static VALUE cParser_parse_strict(VALUE self)
@@ -1775,16 +1748,16 @@ static VALUE cParser_parse_strict(VALUE self)
GET_PARSER;
-#line 1779 "parser.c"
+#line 1752 "parser.c"
{
cs = JSON_start;
}
-#line 777 "parser.rl"
+#line 750 "parser.rl"
p = json->source;
pe = p + json->len;
-#line 1788 "parser.c"
+#line 1761 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1840,7 +1813,7 @@ case 5:
goto st1;
goto st5;
tr3:
-#line 756 "parser.rl"
+#line 729 "parser.rl"
{
char *np;
json->current_nesting = 1;
@@ -1849,7 +1822,7 @@ tr3:
}
goto st10;
tr4:
-#line 749 "parser.rl"
+#line 722 "parser.rl"
{
char *np;
json->current_nesting = 1;
@@ -1861,7 +1834,7 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 1865 "parser.c"
+#line 1838 "parser.c"
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -1918,27 +1891,27 @@ case 9:
_out: {}
}
-#line 780 "parser.rl"
+#line 753 "parser.rl"
if (cs >= JSON_first_final && p == pe) {
return result;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
return Qnil;
}
}
-#line 1934 "parser.c"
-enum {JSON_quirks_mode_start = 1};
-enum {JSON_quirks_mode_first_final = 10};
-enum {JSON_quirks_mode_error = 0};
+#line 1907 "parser.c"
+static const int JSON_quirks_mode_start = 1;
+static const int JSON_quirks_mode_first_final = 10;
+static const int JSON_quirks_mode_error = 0;
-enum {JSON_quirks_mode_en_main = 1};
+static const int JSON_quirks_mode_en_main = 1;
-#line 805 "parser.rl"
+#line 778 "parser.rl"
static VALUE cParser_parse_quirks_mode(VALUE self)
@@ -1949,16 +1922,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
GET_PARSER;
-#line 1953 "parser.c"
+#line 1926 "parser.c"
{
cs = JSON_quirks_mode_start;
}
-#line 815 "parser.rl"
+#line 788 "parser.rl"
p = json->source;
pe = p + json->len;
-#line 1962 "parser.c"
+#line 1935 "parser.c"
{
if ( p == pe )
goto _test_eof;
@@ -1992,7 +1965,7 @@ st0:
cs = 0;
goto _out;
tr2:
-#line 797 "parser.rl"
+#line 770 "parser.rl"
{
char *np = JSON_parse_value(json, p, pe, &result);
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -2002,7 +1975,7 @@ st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
-#line 2006 "parser.c"
+#line 1979 "parser.c"
switch( (*p) ) {
case 13: goto st10;
case 32: goto st10;
@@ -2091,12 +2064,12 @@ case 9:
_out: {}
}
-#line 818 "parser.rl"
+#line 791 "parser.rl"
if (cs >= JSON_quirks_mode_first_final && p == pe) {
return result;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
return Qnil;
}
}
@@ -2118,9 +2091,17 @@ static VALUE cParser_parse(VALUE self)
}
}
-static void JSON_mark(void *ptr)
+
+static JSON_Parser *JSON_allocate()
+{
+ JSON_Parser *json = ALLOC(JSON_Parser);
+ MEMZERO(json, JSON_Parser, 1);
+ json->fbuffer = fbuffer_alloc(0);
+ return json;
+}
+
+static void JSON_mark(JSON_Parser *json)
{
- JSON_Parser *json = ptr;
rb_gc_mark_maybe(json->Vsource);
rb_gc_mark_maybe(json->create_id);
rb_gc_mark_maybe(json->object_class);
@@ -2128,36 +2109,16 @@ static void JSON_mark(void *ptr)
rb_gc_mark_maybe(json->match_string);
}
-static void JSON_free(void *ptr)
+static void JSON_free(JSON_Parser *json)
{
- JSON_Parser *json = ptr;
fbuffer_free(json->fbuffer);
ruby_xfree(json);
}
-static size_t JSON_memsize(const void *ptr)
-{
- const JSON_Parser *json = ptr;
- return sizeof(*json) + FBUFFER_CAPA(json->fbuffer);
-}
-
-#ifdef NEW_TYPEDDATA_WRAPPER
-static const rb_data_type_t JSON_Parser_type = {
- "JSON/Parser",
- {JSON_mark, JSON_free, JSON_memsize,},
-#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-#endif
-};
-#endif
-
static VALUE cJSON_parser_s_allocate(VALUE klass)
{
- JSON_Parser *json;
- VALUE obj = TypedData_Make_Struct(klass, JSON_Parser, &JSON_Parser_type, json);
- json->fbuffer = fbuffer_alloc(0);
- return obj;
+ JSON_Parser *json = JSON_allocate();
+ return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
}
/*
@@ -2184,7 +2145,7 @@ static VALUE cParser_quirks_mode_p(VALUE self)
}
-void Init_parser(void)
+void Init_parser()
{
rb_require("json/common");
mJSON = rb_define_module("JSON");
@@ -2221,11 +2182,14 @@ void Init_parser(void)
i_aref = rb_intern("[]");
i_leftshift = rb_intern("<<");
#ifdef HAVE_RUBY_ENCODING_H
- UTF_8 = rb_utf8_encoding();
- UTF_16BE = rb_enc_find("utf-16be");
- UTF_16LE = rb_enc_find("utf-16le");
- UTF_32BE = rb_enc_find("utf-32be");
- UTF_32LE = rb_enc_find("utf-32le");
+ CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
+ CEncoding_UTF_16BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16be"));
+ CEncoding_UTF_16LE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16le"));
+ CEncoding_UTF_32BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-32be"));
+ CEncoding_UTF_32LE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-32le"));
+ CEncoding_ASCII_8BIT = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("ascii-8bit"));
+ i_encoding = rb_intern("encoding");
+ i_encode = rb_intern("encode");
#else
i_iconv = rb_intern("iconv");
#endif
diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h
index abcc2571f1..b192064c09 100644
--- a/ext/json/parser/parser.h
+++ b/ext/json/parser/parser.h
@@ -51,7 +51,7 @@ typedef struct JSON_ParserStruct {
if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance")
#define GET_PARSER_INIT \
JSON_Parser *json; \
- TypedData_Get_Struct(self, JSON_Parser, &JSON_Parser_type, json)
+ Data_Get_Struct(self, JSON_Parser, json)
#define MinusInfinity "-Infinity"
#define EVIL 0x666
@@ -68,25 +68,10 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
static VALUE convert_encoding(VALUE source);
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self);
static VALUE cParser_parse(VALUE self);
-static void JSON_mark(void *json);
-static void JSON_free(void *json);
+static JSON_Parser *JSON_allocate();
+static void JSON_mark(JSON_Parser *json);
+static void JSON_free(JSON_Parser *json);
static VALUE cJSON_parser_s_allocate(VALUE klass);
static VALUE cParser_source(VALUE self);
-#ifndef ZALLOC
-#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
-static inline void *ruby_zalloc(size_t n)
-{
- void *p = ruby_xmalloc(n);
- memset(p, 0, n);
- return p;
-}
-#endif
-#ifdef TypedData_Make_Struct
-static const rb_data_type_t JSON_Parser_type;
-#define NEW_TYPEDDATA_WRAPPER 1
-#else
-#define TypedData_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, JSON_free, json)
-#define TypedData_Get_Struct(self, JSON_Parser, ignore, json) Data_Get_Struct(self, JSON_Parser, json)
-#endif
#endif
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index 2fa0caee7a..ab8d318173 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -1,28 +1,6 @@
#include "../fbuffer/fbuffer.h"
#include "parser.h"
-#if defined HAVE_RUBY_ENCODING_H
-# define EXC_ENCODING UTF_8,
-# ifndef HAVE_RB_ENC_RAISE
-static void
-enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...)
-{
- va_list args;
- VALUE mesg;
-
- va_start(args, fmt);
- mesg = rb_enc_vsprintf(enc, fmt, args);
- va_end(args);
-
- rb_exc_raise(rb_exc_new3(exc, mesg));
-}
-# define rb_enc_raise enc_raise
-# endif
-#else
-# define EXC_ENCODING /* nothing */
-# define rb_enc_raise rb_raise
-#endif
-
/* unicode */
static const char digit_values[256] = {
@@ -48,16 +26,16 @@ static UTF32 unescape_unicode(const unsigned char *p)
UTF32 result = 0;
b = digit_values[p[0]];
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
+ result = (result << 4) | b;
b = digit_values[p[1]];
+ result = (result << 4) | b;
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
b = digit_values[p[2]];
+ result = (result << 4) | b;
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
b = digit_values[p[3]];
+ result = (result << 4) | b;
if (b < 0) return UNI_REPLACEMENT_CHAR;
- result = (result << 4) | (unsigned char)b;
return result;
}
@@ -88,7 +66,9 @@ static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
}
#ifdef HAVE_RUBY_ENCODING_H
-static rb_encoding *UTF_8, *UTF_16BE, *UTF_16LE, *UTF_32BE, *UTF_32LE;
+static VALUE CEncoding_ASCII_8BIT, CEncoding_UTF_8, CEncoding_UTF_16BE,
+ CEncoding_UTF_16LE, CEncoding_UTF_32BE, CEncoding_UTF_32LE;
+static ID i_encoding, i_encode;
#else
static ID i_iconv;
#endif
@@ -226,14 +206,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
if (json->allow_nan) {
*result = CNaN;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
}
}
action parse_infinity {
if (json->allow_nan) {
*result = CInfinity;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
}
}
action parse_string {
@@ -249,7 +229,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
fexec p + 10;
fhold; fbreak;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
}
}
np = JSON_parse_float(json, fpc, pe, result);
@@ -416,7 +396,7 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
if(cs >= JSON_array_first_final) {
return p + 1;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
return NULL;
}
}
@@ -570,29 +550,29 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
static VALUE convert_encoding(VALUE source)
{
- const char *ptr = RSTRING_PTR(source);
+ char *ptr = RSTRING_PTR(source);
long len = RSTRING_LEN(source);
if (len < 2) {
rb_raise(eParserError, "A JSON text must at least contain two octets!");
}
#ifdef HAVE_RUBY_ENCODING_H
{
- rb_encoding *enc = rb_enc_get(source);
- if (enc == rb_ascii8bit_encoding()) {
+ VALUE encoding = rb_funcall(source, i_encoding, 0);
+ if (encoding == CEncoding_ASCII_8BIT) {
if (len >= 4 && ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0) {
- source = rb_str_conv_enc(source, UTF_32BE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_32BE);
} else if (len >= 4 && ptr[0] == 0 && ptr[2] == 0) {
- source = rb_str_conv_enc(source, UTF_16BE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16BE);
} else if (len >= 4 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) {
- source = rb_str_conv_enc(source, UTF_32LE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_32LE);
} else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
- source = rb_str_conv_enc(source, UTF_16LE, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 2, CEncoding_UTF_8, CEncoding_UTF_16LE);
} else {
source = rb_str_dup(source);
FORCE_UTF8(source);
}
} else {
- source = rb_str_conv_enc(source, NULL, rb_utf8_encoding());
+ source = rb_funcall(source, i_encode, 1, CEncoding_UTF_8);
}
}
#else
@@ -630,8 +610,8 @@ static VALUE convert_encoding(VALUE source)
* (keys) in a JSON object. Otherwise strings are returned, which is also
* the default.
* * *create_additions*: If set to false, the Parser doesn't create
- * additions even if a matching class and create_id was found. This option
- * defaults to false.
+ * additions even if a matchin class and create_id was found. This option
+ * defaults to true.
* * *object_class*: Defaults to Hash
* * *array_class*: Defaults to Array
*/
@@ -643,18 +623,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
if (json->Vsource) {
rb_raise(rb_eTypeError, "already initialized instance");
}
-#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
- rb_scan_args(argc, argv, "1:", &source, &opts);
-#else
rb_scan_args(argc, argv, "11", &source, &opts);
-#endif
if (!NIL_P(opts)) {
-#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
if (NIL_P(opts)) {
rb_raise(rb_eArgError, "opts needs to be like a hash");
} else {
-#endif
VALUE tmp = ID2SYM(i_max_nesting);
if (option_given_p(opts, tmp)) {
VALUE max_nesting = rb_hash_aref(opts, tmp);
@@ -717,9 +691,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
} else {
json->match_string = Qnil;
}
-#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
}
-#endif
} else {
json->max_nesting = 100;
json->allow_nan = 0;
@@ -728,11 +700,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
json->object_class = Qnil;
json->array_class = Qnil;
}
- StringValue(source);
+ source = rb_convert_type(source, T_STRING, "String", "to_str");
if (!json->quirks_mode) {
- source = convert_encoding(source);
+ source = convert_encoding(StringValue(source));
}
json->current_nesting = 0;
+ StringValue(source);
json->len = RSTRING_LEN(source);
json->source = RSTRING_PTR(source);;
json->Vsource = source;
@@ -781,7 +754,7 @@ static VALUE cParser_parse_strict(VALUE self)
if (cs >= JSON_first_final && p == pe) {
return result;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
return Qnil;
}
}
@@ -819,7 +792,7 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
if (cs >= JSON_quirks_mode_first_final && p == pe) {
return result;
} else {
- rb_enc_raise(EXC_ENCODING eParserError, "%u: unexpected token at '%s'", __LINE__, p);
+ rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
return Qnil;
}
}
@@ -841,9 +814,17 @@ static VALUE cParser_parse(VALUE self)
}
}
-static void JSON_mark(void *ptr)
+
+static JSON_Parser *JSON_allocate()
+{
+ JSON_Parser *json = ALLOC(JSON_Parser);
+ MEMZERO(json, JSON_Parser, 1);
+ json->fbuffer = fbuffer_alloc(0);
+ return json;
+}
+
+static void JSON_mark(JSON_Parser *json)
{
- JSON_Parser *json = ptr;
rb_gc_mark_maybe(json->Vsource);
rb_gc_mark_maybe(json->create_id);
rb_gc_mark_maybe(json->object_class);
@@ -851,36 +832,16 @@ static void JSON_mark(void *ptr)
rb_gc_mark_maybe(json->match_string);
}
-static void JSON_free(void *ptr)
+static void JSON_free(JSON_Parser *json)
{
- JSON_Parser *json = ptr;
fbuffer_free(json->fbuffer);
ruby_xfree(json);
}
-static size_t JSON_memsize(const void *ptr)
-{
- const JSON_Parser *json = ptr;
- return sizeof(*json) + FBUFFER_CAPA(json->fbuffer);
-}
-
-#ifdef NEW_TYPEDDATA_WRAPPER
-static const rb_data_type_t JSON_Parser_type = {
- "JSON/Parser",
- {JSON_mark, JSON_free, JSON_memsize,},
-#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-#endif
-};
-#endif
-
static VALUE cJSON_parser_s_allocate(VALUE klass)
{
- JSON_Parser *json;
- VALUE obj = TypedData_Make_Struct(klass, JSON_Parser, &JSON_Parser_type, json);
- json->fbuffer = fbuffer_alloc(0);
- return obj;
+ JSON_Parser *json = JSON_allocate();
+ return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
}
/*
@@ -907,7 +868,7 @@ static VALUE cParser_quirks_mode_p(VALUE self)
}
-void Init_parser(void)
+void Init_parser()
{
rb_require("json/common");
mJSON = rb_define_module("JSON");
@@ -944,11 +905,14 @@ void Init_parser(void)
i_aref = rb_intern("[]");
i_leftshift = rb_intern("<<");
#ifdef HAVE_RUBY_ENCODING_H
- UTF_8 = rb_utf8_encoding();
- UTF_16BE = rb_enc_find("utf-16be");
- UTF_16LE = rb_enc_find("utf-16le");
- UTF_32BE = rb_enc_find("utf-32be");
- UTF_32LE = rb_enc_find("utf-32le");
+ CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
+ CEncoding_UTF_16BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16be"));
+ CEncoding_UTF_16LE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-16le"));
+ CEncoding_UTF_32BE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-32be"));
+ CEncoding_UTF_32LE = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-32le"));
+ CEncoding_ASCII_8BIT = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("ascii-8bit"));
+ i_encoding = rb_intern("encoding");
+ i_encode = rb_intern("encode");
#else
i_iconv = rb_intern("iconv");
#endif
diff --git a/ext/json/parser/prereq.mk b/ext/json/parser/prereq.mk
index be7bcb4319..440ef4017e 100644
--- a/ext/json/parser/prereq.mk
+++ b/ext/json/parser/prereq.mk
@@ -4,7 +4,6 @@ RAGEL = ragel
.rl.c:
$(RAGEL) -G2 $<
- $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' \
- -e '$$_.sub!(/^static const int (JSON_.*=.*);$$/, "enum {\\1};")' $@
+ $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' $@
parser.c:
diff --git a/ext/mathn/complex/extconf.rb b/ext/mathn/complex/extconf.rb
index a3f45ac4fc..d4d14ffcb8 100644
--- a/ext/mathn/complex/extconf.rb
+++ b/ext/mathn/complex/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "mkmf"
create_makefile "mathn/complex"
diff --git a/ext/mathn/rational/extconf.rb b/ext/mathn/rational/extconf.rb
index 4e4cc5f621..ba76306b7b 100644
--- a/ext/mathn/rational/extconf.rb
+++ b/ext/mathn/rational/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "mkmf"
create_makefile "mathn/rational"
diff --git a/ext/nkf/depend b/ext/nkf/depend
index 16421508b1..f368cd51d7 100644
--- a/ext/nkf/depend
+++ b/ext/nkf/depend
@@ -1,22 +1,6 @@
-# BSD make needs "nkf.o: nkf.c" dependency BEFORE "nkf.o: nkf-utf8/nkf.c".
-# It seems BSD make searches the target for implicit rule in dependencies at first.
-nkf.o: nkf.c
-
-# AUTOGENERATED DEPENDENCIES START
-nkf.o: $(RUBY_EXTCONF_H)
-nkf.o: $(arch_hdrdir)/ruby/config.h
-nkf.o: $(hdrdir)/ruby/defines.h
-nkf.o: $(hdrdir)/ruby/encoding.h
-nkf.o: $(hdrdir)/ruby/intern.h
-nkf.o: $(hdrdir)/ruby/missing.h
-nkf.o: $(hdrdir)/ruby/oniguruma.h
-nkf.o: $(hdrdir)/ruby/ruby.h
-nkf.o: $(hdrdir)/ruby/st.h
-nkf.o: $(hdrdir)/ruby/subst.h
-nkf.o: nkf-utf8/config.h
-nkf.o: nkf-utf8/nkf.c
-nkf.o: nkf-utf8/nkf.h
-nkf.o: nkf-utf8/utf8tbl.c
-nkf.o: nkf-utf8/utf8tbl.h
-nkf.o: nkf.c
-# AUTOGENERATED DEPENDENCIES END
+nkf.o : nkf.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(srcdir)/nkf-utf8/nkf.c $(srcdir)/nkf-utf8/nkf.h \
+ $(srcdir)/nkf-utf8/utf8tbl.c $(srcdir)/nkf-utf8/utf8tbl.h \
+ $(srcdir)/nkf-utf8/config.h
diff --git a/ext/nkf/extconf.rb b/ext/nkf/extconf.rb
index f41f6b11dc..710662f19c 100644
--- a/ext/nkf/extconf.rb
+++ b/ext/nkf/extconf.rb
@@ -1,3 +1,2 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('nkf')
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index f52b755288..f8c1ae8f59 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# kconv.rb - Kanji Converter.
#
diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c
index 3e46c33f7d..ca3e438220 100644
--- a/ext/nkf/nkf-utf8/nkf.c
+++ b/ext/nkf/nkf-utf8/nkf.c
@@ -20,11 +20,11 @@
*
* 3. This notice may not be removed or altered from any source distribution.
*/
-#define NKF_VERSION "2.1.4"
-#define NKF_RELEASE_DATE "2015-12-12"
+#define NKF_VERSION "2.1.3"
+#define NKF_RELEASE_DATE "2013-11-22"
#define COPY_RIGHT \
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
- "Copyright (C) 1996-2015, The nkf Project."
+ "Copyright (C) 1996-2013, The nkf Project."
#include "config.h"
#include "nkf.h"
@@ -774,7 +774,7 @@ nkf_enc_find(const char *name)
#ifdef DEFAULT_CODE_LOCALE
static const char*
-nkf_locale_charmap(void)
+nkf_locale_charmap()
{
#ifdef HAVE_LANGINFO_H
return nl_langinfo(CODESET);
@@ -802,7 +802,7 @@ nkf_locale_charmap(void)
}
static nkf_encoding*
-nkf_locale_encoding(void)
+nkf_locale_encoding()
{
nkf_encoding *enc = 0;
const char *encname = nkf_locale_charmap();
@@ -813,13 +813,13 @@ nkf_locale_encoding(void)
#endif /* DEFAULT_CODE_LOCALE */
static nkf_encoding*
-nkf_utf8_encoding(void)
+nkf_utf8_encoding()
{
return &nkf_encoding_table[UTF_8];
}
static nkf_encoding*
-nkf_default_encoding(void)
+nkf_default_encoding()
{
nkf_encoding *enc = 0;
#ifdef DEFAULT_CODE_LOCALE
@@ -3575,7 +3575,6 @@ static void
check_bom(FILE *f)
{
int c2;
- input_bom_f = FALSE;
switch(c2 = (*i_getc)(f)){
case 0x00:
if((c2 = (*i_getc)(f)) == 0x00){
@@ -3834,8 +3833,8 @@ fold_conv(nkf_char c2, nkf_char c1)
f_prev = c1;
f_line = 0;
fold_state = CR;
- } else if ((f_prev == c1)
- || (f_prev == LF)
+ } else if ((f_prev == c1 && !fold_preserve_f)
+ || (f_prev == LF && fold_preserve_f)
) { /* duplicate newline */
if (f_line) {
f_line = 0;
@@ -4341,7 +4340,7 @@ mime_ungetc_buf(nkf_char c, FILE *f)
static nkf_char
mime_getc_buf(FILE *f)
{
- /* we don't keep eof of mime_input_buf, because it contains ?= as
+ /* we don't keep eof of mime_input_buf, becase it contains ?= as
a terminator. It was checked in mime_integrity. */
return ((mimebuf_f)?
(*i_mgetc_buf)(f):mime_input_buf(mime_input_state.input++));
@@ -5436,8 +5435,8 @@ mime_putc(nkf_char c)
mimeout_state.buf[mimeout_state.count++] = (char)c;
if (mimeout_state.count>MIMEOUT_BUF_LENGTH) {
eof_mime();
- for (j=0;j<mimeout_state.count;j++) {
- (*o_mputc)(mimeout_state.buf[j]);
+ for (i=0;i<mimeout_state.count;i++) {
+ (*o_mputc)(mimeout_state.buf[i]);
base64_count++;
}
mimeout_state.count = 0;
@@ -5491,7 +5490,7 @@ typedef struct nkf_iconv_t {
size_t input_buffer_size;
char *output_buffer;
size_t output_buffer_size;
-};
+}
static nkf_iconv_t
nkf_iconv_new(char *tocode, char *fromcode)
@@ -5714,9 +5713,9 @@ module_connection(void)
x0201_f = X0201_DEFAULT;
}
- /* replace continuation module, from output side */
+ /* replace continucation module, from output side */
- /* output redirection */
+ /* output redicrection */
#ifdef CHECK_OPTION
if (noout_f || guess_f){
o_putc = no_putc;
@@ -5753,7 +5752,7 @@ module_connection(void)
i_getc = std_getc;
i_ungetc = std_ungetc;
- /* input redirection */
+ /* input redicrection */
#ifdef INPUT_OPTION
if (cap_f){
i_cgetc = i_getc; i_getc = cap_getc;
@@ -5915,7 +5914,7 @@ kanji_convert(FILE *f)
/* in case of 8th bit is on */
if (!estab_f&&!mime_decode_mode) {
/* in case of not established yet */
- /* It is still ambiguous */
+ /* It is still ambiguious */
if (h_conv(f, c2, c1)==EOF) {
LAST;
}
@@ -6899,7 +6898,7 @@ options(unsigned char *cp)
continue;
#endif
case SP:
- /* module multiple options in a string are allowed for Perl module */
+ /* module muliple options in a string are allowed for Perl moudle */
while(*cp && *cp++!='-');
continue;
default:
diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c
index 3821c59468..e493c6beb5 100644
--- a/ext/nkf/nkf-utf8/utf8tbl.c
+++ b/ext/nkf/nkf-utf8/utf8tbl.c
@@ -1,5 +1,5 @@
/*
- * utf8tbl.c - Conversion Table for nkf
+ * utf8tbl.c - Convertion Table for nkf
*
*/
diff --git a/ext/nkf/nkf-utf8/utf8tbl.h b/ext/nkf/nkf-utf8/utf8tbl.h
index 54a34271dd..96b61ed5a4 100644
--- a/ext/nkf/nkf-utf8/utf8tbl.h
+++ b/ext/nkf/nkf-utf8/utf8tbl.h
@@ -1,5 +1,5 @@
/*
- * utf8tbl.h - Header file for Conversion Table
+ * utf8tbl.h - Header file for Convertion Table
*
*/
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 9613a925ce..2f36866ac4 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -478,7 +478,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
*/
void
-Init_nkf(void)
+Init_nkf()
{
VALUE mNKF = rb_define_module("NKF");
diff --git a/ext/objspace/depend b/ext/objspace/depend
index 32af521ba5..270bd911d3 100644
--- a/ext/objspace/depend
+++ b/ext/objspace/depend
@@ -1,66 +1,14 @@
-# AUTOGENERATED DEPENDENCIES START
-object_tracing.o: $(RUBY_EXTCONF_H)
-object_tracing.o: $(arch_hdrdir)/ruby/config.h
-object_tracing.o: $(hdrdir)/ruby/debug.h
-object_tracing.o: $(hdrdir)/ruby/defines.h
-object_tracing.o: $(hdrdir)/ruby/encoding.h
-object_tracing.o: $(hdrdir)/ruby/intern.h
-object_tracing.o: $(hdrdir)/ruby/io.h
-object_tracing.o: $(hdrdir)/ruby/missing.h
-object_tracing.o: $(hdrdir)/ruby/oniguruma.h
-object_tracing.o: $(hdrdir)/ruby/ruby.h
-object_tracing.o: $(hdrdir)/ruby/st.h
-object_tracing.o: $(hdrdir)/ruby/subst.h
-object_tracing.o: $(top_srcdir)/include/ruby.h
-object_tracing.o: $(top_srcdir)/internal.h
-object_tracing.o: object_tracing.c
-object_tracing.o: objspace.h
-objspace.o: $(RUBY_EXTCONF_H)
-objspace.o: $(arch_hdrdir)/ruby/config.h
-objspace.o: $(hdrdir)/ruby/defines.h
-objspace.o: $(hdrdir)/ruby/encoding.h
-objspace.o: $(hdrdir)/ruby/intern.h
-objspace.o: $(hdrdir)/ruby/io.h
-objspace.o: $(hdrdir)/ruby/missing.h
-objspace.o: $(hdrdir)/ruby/oniguruma.h
-objspace.o: $(hdrdir)/ruby/re.h
-objspace.o: $(hdrdir)/ruby/regex.h
-objspace.o: $(hdrdir)/ruby/ruby.h
-objspace.o: $(hdrdir)/ruby/st.h
-objspace.o: $(hdrdir)/ruby/subst.h
-objspace.o: $(top_srcdir)/gc.h
-objspace.o: $(top_srcdir)/include/ruby.h
-objspace.o: $(top_srcdir)/internal.h
-objspace.o: $(top_srcdir)/node.h
-objspace.o: objspace.c
-objspace_dump.o: $(RUBY_EXTCONF_H)
-objspace_dump.o: $(arch_hdrdir)/ruby/config.h
-objspace_dump.o: $(hdrdir)/ruby/debug.h
-objspace_dump.o: $(hdrdir)/ruby/defines.h
-objspace_dump.o: $(hdrdir)/ruby/encoding.h
-objspace_dump.o: $(hdrdir)/ruby/intern.h
-objspace_dump.o: $(hdrdir)/ruby/io.h
-objspace_dump.o: $(hdrdir)/ruby/missing.h
-objspace_dump.o: $(hdrdir)/ruby/oniguruma.h
-objspace_dump.o: $(hdrdir)/ruby/ruby.h
-objspace_dump.o: $(hdrdir)/ruby/st.h
-objspace_dump.o: $(hdrdir)/ruby/subst.h
-objspace_dump.o: $(hdrdir)/ruby/thread_native.h
-objspace_dump.o: $(top_srcdir)/ccan/check_type/check_type.h
-objspace_dump.o: $(top_srcdir)/ccan/container_of/container_of.h
-objspace_dump.o: $(top_srcdir)/ccan/list/list.h
-objspace_dump.o: $(top_srcdir)/ccan/str/str.h
-objspace_dump.o: $(top_srcdir)/gc.h
-objspace_dump.o: $(top_srcdir)/include/ruby.h
-objspace_dump.o: $(top_srcdir)/internal.h
-objspace_dump.o: $(top_srcdir)/method.h
-objspace_dump.o: $(top_srcdir)/node.h
-objspace_dump.o: $(top_srcdir)/ruby_atomic.h
-objspace_dump.o: $(top_srcdir)/thread_pthread.h
-objspace_dump.o: $(top_srcdir)/vm_core.h
-objspace_dump.o: $(top_srcdir)/vm_debug.h
-objspace_dump.o: $(top_srcdir)/vm_opts.h
-objspace_dump.o: objspace.h
-objspace_dump.o: objspace_dump.c
-objspace_dump.o: {$(VPATH)}id.h
-# AUTOGENERATED DEPENDENCIES END
+objspace.o: $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/regex.h \
+ $(top_srcdir)/regenc.h \
+ $(top_srcdir)/node.h $(top_srcdir)/gc.h \
+ $(hdrdir)/ruby/re.h $(top_srcdir)/node.h $(top_srcdir)/gc.h \
+ $(top_srcdir)/regint.h $(top_srcdir)/internal.h
+gc_hook.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
+object_tracing.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
+objspace_dump.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h \
+ $(hdrdir)/ruby/encoding.h $(hdrdir)/ruby/io.h \
+ $(top_srcdir)/node.h $(top_srcdir)/vm_core.h $(top_srcdir)/gc.h
diff --git a/ext/objspace/extconf.rb b/ext/objspace/extconf.rb
index adb8ef9169..23a42c4c20 100644
--- a/ext/objspace/extconf.rb
+++ b/ext/objspace/extconf.rb
@@ -1,4 +1,2 @@
-# frozen_string_literal: false
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$VPATH << '$(topdir)' << '$(top_srcdir)' # for id.h.
create_makefile('objspace')
diff --git a/ext/objspace/gc_hook.c b/ext/objspace/gc_hook.c
new file mode 100644
index 0000000000..cf3dc0cc9d
--- /dev/null
+++ b/ext/objspace/gc_hook.c
@@ -0,0 +1,103 @@
+/**********************************************************************
+
+ gc_hook.c - GC hook mechanism/ObjectSpace extender for MRI.
+
+ $Author$
+ created at: Tue May 28 01:34:25 2013
+
+ NOTE: This extension library is not expected to exist except C Ruby.
+ NOTE: This feature is an example usage of internal event tracing APIs.
+
+ All the files in this distribution are covered under the Ruby's
+ license (see the file COPYING).
+
+**********************************************************************/
+
+#include "ruby/ruby.h"
+#include "ruby/debug.h"
+
+static int invoking; /* TODO: should not be global variable */
+
+static VALUE
+invoke_proc_ensure(void *dmy)
+{
+ invoking = 0;
+ return Qnil;
+}
+
+static VALUE
+invoke_proc_begin(VALUE proc)
+{
+ return rb_proc_call(proc, rb_ary_new());
+}
+
+static void
+invoke_proc(void *data)
+{
+ VALUE proc = (VALUE)data;
+ invoking += 1;
+ rb_ensure(invoke_proc_begin, proc, invoke_proc_ensure, 0);
+}
+
+static void
+gc_start_end_i(VALUE tpval, void *data)
+{
+ if (0) {
+ rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
+ fprintf(stderr, "trace: %s\n", rb_tracearg_event_flag(tparg) == RUBY_INTERNAL_EVENT_GC_START ? "gc_start" : "gc_end");
+ }
+
+ if (invoking == 0) {
+ rb_postponed_job_register(0, invoke_proc, data);
+ }
+}
+
+static VALUE
+set_gc_hook(VALUE rb_mObjSpace, VALUE proc, rb_event_flag_t event, const char *tp_str, const char *proc_str)
+{
+ VALUE tpval;
+ ID tp_key = rb_intern(tp_str);
+ ID proc_key = rb_intern(proc_str);
+
+ /* disable previous keys */
+ if (rb_ivar_defined(rb_mObjSpace, tp_key) != 0 &&
+ RTEST(tpval = rb_ivar_get(rb_mObjSpace, tp_key))) {
+ rb_tracepoint_disable(tpval);
+ rb_ivar_set(rb_mObjSpace, tp_key, Qnil);
+ rb_ivar_set(rb_mObjSpace, proc_key, Qnil);
+ }
+
+ if (RTEST(proc)) {
+ if (!rb_obj_is_proc(proc)) {
+ rb_raise(rb_eTypeError, "trace_func needs to be Proc");
+ }
+
+ tpval = rb_tracepoint_new(0, event, gc_start_end_i, (void *)proc);
+ rb_ivar_set(rb_mObjSpace, tp_key, tpval);
+ rb_ivar_set(rb_mObjSpace, proc_key, proc); /* GC guard */
+ rb_tracepoint_enable(tpval);
+ }
+
+ return proc;
+}
+
+static VALUE
+set_after_gc_start(VALUE rb_mObjSpace, VALUE proc)
+{
+ return set_gc_hook(rb_mObjSpace, proc, RUBY_INTERNAL_EVENT_GC_START,
+ "__set_after_gc_start_tpval__", "__set_after_gc_start_proc__");
+}
+
+static VALUE
+set_after_gc_end(VALUE rb_mObjSpace, VALUE proc)
+{
+ return set_gc_hook(rb_mObjSpace, proc, RUBY_INTERNAL_EVENT_GC_END,
+ "__set_after_gc_end_tpval__", "__set_after_gc_end_proc__");
+}
+
+void
+Init_gc_hook(VALUE rb_mObjSpace)
+{
+ rb_define_module_function(rb_mObjSpace, "after_gc_start_hook=", set_after_gc_start, 1);
+ rb_define_module_function(rb_mObjSpace, "after_gc_end_hook=", set_after_gc_end, 1);
+}
diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c
index 3a7f54427d..2475623410 100644
--- a/ext/objspace/object_tracing.c
+++ b/ext/objspace/object_tracing.c
@@ -13,9 +13,10 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/debug.h"
#include "objspace.h"
+#include "internal.h"
struct traceobj_arg {
int running;
@@ -80,7 +81,7 @@ newobj_i(VALUE tpval, void *data)
VALUE klass = rb_tracearg_defined_class(tparg);
struct allocation_info *info;
const char *path_cstr = RTEST(path) ? make_unique_str(arg->str_table, RSTRING_PTR(path), RSTRING_LEN(path)) : 0;
- VALUE class_path = (RTEST(klass) && !OBJ_FROZEN(klass)) ? rb_class_path_cached(klass) : Qnil;
+ VALUE class_path = RTEST(klass) ? rb_class_path(klass) : Qnil;
const char *class_path_cstr = RTEST(class_path) ? make_unique_str(arg->str_table, RSTRING_PTR(class_path), RSTRING_LEN(class_path)) : 0;
if (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) {
@@ -273,7 +274,7 @@ trace_object_allocations(VALUE self)
}
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
-static int object_allocations_reporter_registered = 0;
+static int object_allocations_reporter_registerd = 0;
static int
object_allocations_reporter_i(st_data_t key, st_data_t val, st_data_t ptr)
@@ -286,10 +287,7 @@ object_allocations_reporter_i(st_data_t key, st_data_t val, st_data_t ptr)
if (info->class_path) fprintf(out, "C: %s", info->class_path);
else fprintf(out, "C: %p", (void *)info->klass);
fprintf(out, "@%s:%lu", info->path ? info->path : "", info->line);
- if (!NIL_P(info->mid)) {
- VALUE m = rb_sym2str(info->mid);
- fprintf(out, " (%s)", RSTRING_PTR(m));
- }
+ if (!NIL_P(info->mid)) fprintf(out, " (%s)", rb_id2name(SYM2ID(info->mid)));
fprintf(out, ")\n");
return ST_CONTINUE;
@@ -309,8 +307,8 @@ static VALUE
trace_object_allocations_debug_start(VALUE self)
{
tmp_keep_remains = 1;
- if (object_allocations_reporter_registered == 0) {
- object_allocations_reporter_registered = 1;
+ if (object_allocations_reporter_registerd == 0) {
+ object_allocations_reporter_registerd = 1;
rb_bug_reporter_add(object_allocations_reporter, 0);
}
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index eff9d0c7f8..f9fa833c99 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -12,13 +12,13 @@
**********************************************************************/
-#include "internal.h"
+#include <ruby/ruby.h>
#include <ruby/st.h>
#include <ruby/io.h>
#include <ruby/re.h>
#include "node.h"
#include "gc.h"
-#include "symbol.h"
+#include "internal.h"
/*
* call-seq:
@@ -31,9 +31,6 @@
* correct.
*
* This method is only expected to work with C Ruby.
- *
- * From Ruby 2.2, memsize_of(obj) returns a memory size includes
- * sizeof(RVALUE).
*/
static VALUE
@@ -57,11 +54,13 @@ total_i(void *vstart, void *vend, size_t stride, void *ptr)
if (RBASIC(v)->flags) {
switch (BUILTIN_TYPE(v)) {
case T_NONE:
- case T_IMEMO:
case T_ICLASS:
case T_NODE:
case T_ZOMBIE:
continue;
+ case T_CLASS:
+ if (FL_TEST(v, FL_SINGLETON))
+ continue;
default:
if (data->klass == 0 || rb_obj_is_kind_of(v, data->klass)) {
data->total += rb_obj_memsize_of(v);
@@ -123,26 +122,6 @@ set_zero_i(st_data_t key, st_data_t val, st_data_t arg)
return ST_CONTINUE;
}
-static VALUE
-setup_hash(int argc, VALUE *argv)
-{
- VALUE hash;
-
- if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (!RB_TYPE_P(hash, T_HASH))
- rb_raise(rb_eTypeError, "non-hash given");
- }
-
- if (hash == Qnil) {
- hash = rb_hash_new();
- }
- else if (!RHASH_EMPTY_P(hash)) {
- st_foreach(RHASH_TBL(hash), set_zero_i, hash);
- }
-
- return hash;
-}
-
static int
cos_i(void *vstart, void *vend, size_t stride, void *data)
{
@@ -185,7 +164,6 @@ type2sym(enum ruby_value_type i)
CASE_TYPE(T_SYMBOL);
CASE_TYPE(T_FIXNUM);
CASE_TYPE(T_UNDEF);
- CASE_TYPE(T_IMEMO);
CASE_TYPE(T_NODE);
CASE_TYPE(T_ICLASS);
CASE_TYPE(T_ZOMBIE);
@@ -224,7 +202,12 @@ count_objects_size(int argc, VALUE *argv, VALUE os)
size_t counts[T_MASK+1];
size_t total = 0;
enum ruby_value_type i;
- VALUE hash = setup_hash(argc, argv);
+ VALUE hash;
+
+ if (rb_scan_args(argc, argv, "01", &hash) == 1) {
+ if (!RB_TYPE_P(hash, T_HASH))
+ rb_raise(rb_eTypeError, "non-hash given");
+ }
for (i = 0; i <= T_MASK; i++) {
counts[i] = 0;
@@ -250,84 +233,6 @@ count_objects_size(int argc, VALUE *argv, VALUE os)
return hash;
}
-struct dynamic_symbol_counts {
- size_t mortal;
- size_t immortal;
-};
-
-static int
-cs_i(void *vstart, void *vend, size_t stride, void *n)
-{
- struct dynamic_symbol_counts *counts = (struct dynamic_symbol_counts *)n;
- VALUE v = (VALUE)vstart;
-
- for (; v != (VALUE)vend; v += stride) {
- if (RBASIC(v)->flags && BUILTIN_TYPE(v) == T_SYMBOL) {
- ID id = RSYMBOL(v)->id;
- if ((id & ~ID_SCOPE_MASK) == 0) {
- counts->mortal++;
- }
- else {
- counts->immortal++;
- }
- }
- }
-
- return 0;
-}
-
-size_t rb_sym_immortal_count(void);
-
-/*
- * call-seq:
- * ObjectSpace.count_symbols([result_hash]) -> hash
- *
- * Counts symbols for each Symbol type.
- *
- * This method is only for MRI developers interested in performance and memory
- * usage of Ruby programs.
- *
- * If the optional argument, result_hash, is given, it is overwritten and
- * returned. This is intended to avoid probe effect.
- *
- * Note:
- * The contents of the returned hash is implementation defined.
- * It may be changed in future.
- *
- * This method is only expected to work with C Ruby.
- *
- * On this version of MRI, they have 3 types of Symbols (and 1 total counts).
- *
- * * mortal_dynamic_symbol: GC target symbols (collected by GC)
- * * immortal_dynamic_symbol: Immortal symbols promoted from dynamic symbols (do not collected by GC)
- * * immortal_static_symbol: Immortal symbols (do not collected by GC)
- * * immortal_symbol: total immortal symbols (immortal_dynamic_symbol+immortal_static_symbol)
- */
-
-static VALUE
-count_symbols(int argc, VALUE *argv, VALUE os)
-{
- struct dynamic_symbol_counts dynamic_counts = {0, 0};
- VALUE hash = setup_hash(argc, argv);
-
- size_t immortal_symbols = rb_sym_immortal_count();
- rb_objspace_each_objects(cs_i, &dynamic_counts);
-
- if (hash == Qnil) {
- hash = rb_hash_new();
- }
- else if (!RHASH_EMPTY_P(hash)) {
- st_foreach(RHASH_TBL(hash), set_zero_i, hash);
- }
-
- rb_hash_aset(hash, ID2SYM(rb_intern("mortal_dynamic_symbol")), SIZET2NUM(dynamic_counts.mortal));
- rb_hash_aset(hash, ID2SYM(rb_intern("immortal_dynamic_symbol")), SIZET2NUM(dynamic_counts.immortal));
- rb_hash_aset(hash, ID2SYM(rb_intern("immortal_static_symbol")), SIZET2NUM(immortal_symbols - dynamic_counts.immortal));
- rb_hash_aset(hash, ID2SYM(rb_intern("immortal_symbol")), SIZET2NUM(immortal_symbols));
-
- return hash;
-}
-
static int
cn_i(void *vstart, void *vend, size_t stride, void *n)
{
@@ -372,7 +277,12 @@ count_nodes(int argc, VALUE *argv, VALUE os)
{
size_t nodes[NODE_LAST+1];
size_t i;
- VALUE hash = setup_hash(argc, argv);
+ VALUE hash;
+
+ if (rb_scan_args(argc, argv, "01", &hash) == 1) {
+ if (!RB_TYPE_P(hash, T_HASH))
+ rb_raise(rb_eTypeError, "non-hash given");
+ }
for (i = 0; i <= NODE_LAST; i++) {
nodes[i] = 0;
@@ -478,6 +388,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_SCLASS);
COUNT_NODE(NODE_COLON2);
COUNT_NODE(NODE_COLON3);
+ COUNT_NODE(NODE_CREF);
COUNT_NODE(NODE_DOT2);
COUNT_NODE(NODE_DOT3);
COUNT_NODE(NODE_FLIP2);
@@ -491,6 +402,8 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_POSTEXE);
COUNT_NODE(NODE_ALLOCA);
COUNT_NODE(NODE_BMETHOD);
+ COUNT_NODE(NODE_MEMO);
+ COUNT_NODE(NODE_IFUNC);
COUNT_NODE(NODE_DSYM);
COUNT_NODE(NODE_ATTRASGN);
COUNT_NODE(NODE_PRELUDE);
@@ -571,85 +484,21 @@ cto_i(void *vstart, void *vend, size_t stride, void *data)
static VALUE
count_tdata_objects(int argc, VALUE *argv, VALUE self)
{
- VALUE hash = setup_hash(argc, argv);
- rb_objspace_each_objects(cto_i, (void *)hash);
- return hash;
-}
-
-static ID imemo_type_ids[imemo_mask+1];
-
-static int
-count_imemo_objects_i(void *vstart, void *vend, size_t stride, void *data)
-{
- VALUE hash = (VALUE)data;
- VALUE v = (VALUE)vstart;
-
- for (; v != (VALUE)vend; v += stride) {
- if (RBASIC(v)->flags && BUILTIN_TYPE(v) == T_IMEMO) {
- VALUE counter;
- VALUE key = ID2SYM(imemo_type_ids[imemo_type(v)]);
-
- counter = rb_hash_aref(hash, key);
-
- if (NIL_P(counter)) {
- counter = INT2FIX(1);
- }
- else {
- counter = INT2FIX(FIX2INT(counter) + 1);
- }
+ VALUE hash;
- rb_hash_aset(hash, key, counter);
- }
+ if (rb_scan_args(argc, argv, "01", &hash) == 1) {
+ if (!RB_TYPE_P(hash, T_HASH))
+ rb_raise(rb_eTypeError, "non-hash given");
}
- return 0;
-}
-
-/*
- * call-seq:
- * ObjectSpace.count_imemo_objects([result_hash]) -> hash
- *
- * Counts objects for each +T_IMEMO+ type.
- *
- * This method is only for MRI developers interested in performance and memory
- * usage of Ruby programs.
- *
- * It returns a hash as:
- *
- * {:imemo_ifunc=>8,
- * :imemo_svar=>7,
- * :imemo_cref=>509,
- * :imemo_memo=>1,
- * :imemo_throw_data=>1}
- *
- * If the optional argument, result_hash, is given, it is overwritten and
- * returned. This is intended to avoid probe effect.
- *
- * The contents of the returned hash is implementation specific and may change
- * in the future.
- *
- * In this version, keys are symbol objects.
- *
- * This method is only expected to work with C Ruby.
- */
-
-static VALUE
-count_imemo_objects(int argc, VALUE *argv, VALUE self)
-{
- VALUE hash = setup_hash(argc, argv);
-
- if (imemo_type_ids[0] == 0) {
- imemo_type_ids[0] = rb_intern("imemo_none");
- imemo_type_ids[1] = rb_intern("imemo_cref");
- imemo_type_ids[2] = rb_intern("imemo_svar");
- imemo_type_ids[3] = rb_intern("imemo_throw_data");
- imemo_type_ids[4] = rb_intern("imemo_ifunc");
- imemo_type_ids[5] = rb_intern("imemo_memo");
- imemo_type_ids[6] = rb_intern("imemo_ment");
- imemo_type_ids[7] = rb_intern("imemo_iseq");
+ if (hash == Qnil) {
+ hash = rb_hash_new();
+ }
+ else if (!RHASH_EMPTY_P(hash)) {
+ st_foreach(RHASH_TBL(hash), set_zero_i, hash);
}
- rb_objspace_each_objects(count_imemo_objects_i, (void *)hash);
+ rb_objspace_each_objects(cto_i, (void *)hash);
return hash;
}
@@ -670,7 +519,7 @@ iow_size(const void *ptr)
static const rb_data_type_t iow_data_type = {
"ObjectSpace::InternalObjectWrapper",
{iow_mark, 0, iow_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE rb_mInternalObjectWrapper;
@@ -678,7 +527,7 @@ static VALUE rb_mInternalObjectWrapper;
static VALUE
iow_newobj(VALUE obj)
{
- return TypedData_Wrap_Struct(rb_mInternalObjectWrapper, &iow_data_type, (void *)obj);
+ return rb_data_typed_object_alloc(rb_mInternalObjectWrapper, (void *)obj, &iow_data_type);
}
/* Returns the type of the internal object. */
@@ -696,7 +545,7 @@ iow_inspect(VALUE self)
VALUE obj = (VALUE)DATA_PTR(self);
VALUE type = type2sym(BUILTIN_TYPE(obj));
- return rb_sprintf("#<InternalObject:%p %"PRIsVALUE">", (void *)obj, rb_sym2str(type));
+ return rb_sprintf("#<InternalObject:%p %s>", (void *)obj, rb_id2name(SYM2ID(type)));
}
/* Returns the Object#object_id of the internal object. */
@@ -823,16 +672,14 @@ reachable_object_from_root_i(const char *category, VALUE obj, void *ptr)
else {
data->last_category = category;
category_str = data->last_category_str = rb_str_new2(category);
- category_objects = data->last_category_objects = rb_ident_hash_new();
+ category_objects = data->last_category_objects = rb_hash_new();
if (!NIL_P(rb_hash_lookup(data->categories, category_str))) {
rb_bug("reachable_object_from_root_i: category should insert at once");
}
rb_hash_aset(data->categories, category_str, category_objects);
}
- if (rb_objspace_markable_object_p(obj) &&
- obj != data->categories &&
- obj != data->last_category_objects) {
+ if (rb_objspace_markable_object_p(obj)) {
if (rb_objspace_internal_object_p(obj)) {
obj = iow_newobj(obj);
}
@@ -859,7 +706,7 @@ static VALUE
reachable_objects_from_root(VALUE self)
{
struct rofr_data data;
- VALUE hash = data.categories = rb_ident_hash_new();
+ VALUE hash = data.categories = rb_hash_new();
data.last_category = 0;
rb_objspace_reachable_objects_from_root(reachable_object_from_root_i, &data);
@@ -868,74 +715,8 @@ reachable_objects_from_root(VALUE self)
return hash;
}
-static VALUE
-wrap_klass_iow(VALUE klass)
-{
- if (!RTEST(klass)) {
- return Qnil;
- }
- else if (RB_TYPE_P(klass, T_ICLASS)) {
- return iow_newobj(klass);
- }
- else {
- return klass;
- }
-}
-
-/*
- * call-seq:
- * ObjectSpace.internal_class_of(obj) -> Class or Module
- *
- * [MRI specific feature] Return internal class of obj.
- * obj can be an instance of InternalObjectWrapper.
- *
- * Note that you should not use this method in your application.
- */
-static VALUE
-objspace_internal_class_of(VALUE self, VALUE obj)
-{
- VALUE klass;
-
- if (rb_typeddata_is_kind_of(obj, &iow_data_type)) {
- obj = (VALUE)DATA_PTR(obj);
- }
-
- klass = CLASS_OF(obj);
- return wrap_klass_iow(klass);
-}
-
-/*
- * call-seq:
- * ObjectSpace.internal_super_of(cls) -> Class or Module
- *
- * [MRI specific feature] Return internal super class of cls (Class or Module).
- * obj can be an instance of InternalObjectWrapper.
- *
- * Note that you should not use this method in your application.
- */
-static VALUE
-objspace_internal_super_of(VALUE self, VALUE obj)
-{
- VALUE super;
-
- if (rb_typeddata_is_kind_of(obj, &iow_data_type)) {
- obj = (VALUE)DATA_PTR(obj);
- }
-
- switch (TYPE(obj)) {
- case T_MODULE:
- case T_CLASS:
- case T_ICLASS:
- super = RCLASS_SUPER(obj);
- break;
- default:
- rb_raise(rb_eArgError, "class or module is expected");
- }
-
- return wrap_klass_iow(super);
-}
-
void Init_object_tracing(VALUE rb_mObjSpace);
+void Init_gc_hook(VALUE rb_mObjSpace);
void Init_objspace_dump(VALUE rb_mObjSpace);
/*
@@ -966,17 +747,12 @@ Init_objspace(void)
rb_define_module_function(rb_mObjSpace, "memsize_of_all", memsize_of_all_m, -1);
rb_define_module_function(rb_mObjSpace, "count_objects_size", count_objects_size, -1);
- rb_define_module_function(rb_mObjSpace, "count_symbols", count_symbols, -1);
rb_define_module_function(rb_mObjSpace, "count_nodes", count_nodes, -1);
rb_define_module_function(rb_mObjSpace, "count_tdata_objects", count_tdata_objects, -1);
- rb_define_module_function(rb_mObjSpace, "count_imemo_objects", count_imemo_objects, -1);
rb_define_module_function(rb_mObjSpace, "reachable_objects_from", reachable_objects_from, 1);
rb_define_module_function(rb_mObjSpace, "reachable_objects_from_root", reachable_objects_from_root, 0);
- rb_define_module_function(rb_mObjSpace, "internal_class_of", objspace_internal_class_of, 1);
- rb_define_module_function(rb_mObjSpace, "internal_super_of", objspace_internal_super_of, 1);
-
/*
* This class is used as a return value from
* ObjectSpace::reachable_objects_from.
@@ -992,5 +768,6 @@ Init_objspace(void)
rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
Init_object_tracing(rb_mObjSpace);
+ Init_gc_hook(rb_mObjSpace);
Init_objspace_dump(rb_mObjSpace);
}
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c
index 3b73b81499..df1395d07a 100644
--- a/ext/objspace/objspace_dump.c
+++ b/ext/objspace/objspace_dump.c
@@ -12,8 +12,9 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/debug.h"
+#include "ruby/encoding.h"
#include "ruby/io.h"
#include "gc.h"
#include "node.h"
@@ -41,6 +42,7 @@ dump_append(struct dump_config *dc, const char *format, ...)
if (dc->stream) {
vfprintf(dc->stream, format, vl);
+ fflush(dc->stream);
}
else if (dc->string)
rb_str_vcatf(dc->string, format, vl);
@@ -51,9 +53,8 @@ dump_append(struct dump_config *dc, const char *format, ...)
static void
dump_append_string_value(struct dump_config *dc, VALUE obj)
{
- long i;
- char c;
- const char *value;
+ int i;
+ char c, *value;
dump_append(dc, "\"");
for (i = 0, value = RSTRING_PTR(obj); i < RSTRING_LEN(obj); i++) {
@@ -81,23 +82,12 @@ dump_append_string_value(struct dump_config *dc, VALUE obj)
dump_append(dc, "\\r");
break;
default:
- if (c <= 0x1f)
- dump_append(dc, "\\u%04d", c);
- else
- dump_append(dc, "%c", c);
+ dump_append(dc, "%c", c);
}
}
dump_append(dc, "\"");
}
-static void
-dump_append_symbol_value(struct dump_config *dc, VALUE obj)
-{
- dump_append(dc, "{\"type\":\"SYMBOL\", \"value\":");
- dump_append_string_value(dc, rb_sym2str(obj));
- dump_append(dc, "}");
-}
-
static inline const char *
obj_type(VALUE obj)
{
@@ -125,7 +115,6 @@ obj_type(VALUE obj)
CASE_TYPE(SYMBOL);
CASE_TYPE(RATIONAL);
CASE_TYPE(COMPLEX);
- CASE_TYPE(IMEMO);
CASE_TYPE(UNDEF);
CASE_TYPE(NODE);
CASE_TYPE(ZOMBIE);
@@ -135,32 +124,6 @@ obj_type(VALUE obj)
}
static void
-dump_append_special_const(struct dump_config *dc, VALUE value)
-{
- if (value == Qtrue) {
- dump_append(dc, "true");
- }
- else if (value == Qfalse) {
- dump_append(dc, "false");
- }
- else if (value == Qnil) {
- dump_append(dc, "null");
- }
- else if (FIXNUM_P(value)) {
- dump_append(dc, "%ld", FIX2LONG(value));
- }
- else if (FLONUM_P(value)) {
- dump_append(dc, "%#g", RFLOAT_VALUE(value));
- }
- else if (SYMBOL_P(value)) {
- dump_append_symbol_value(dc, value);
- }
- else {
- dump_append(dc, "{}");
- }
-}
-
-static void
reachable_object_i(VALUE ref, void *data)
{
struct dump_config *dc = (struct dump_config *)data;
@@ -177,31 +140,11 @@ reachable_object_i(VALUE ref, void *data)
}
static void
-dump_append_string_content(struct dump_config *dc, VALUE obj)
-{
- dump_append(dc, ", \"bytesize\":%ld", RSTRING_LEN(obj));
- if (!STR_EMBED_P(obj) && !STR_SHARED_P(obj) && (long)rb_str_capacity(obj) != RSTRING_LEN(obj))
- dump_append(dc, ", \"capacity\":%ld", rb_str_capacity(obj));
-
- if (is_ascii_string(obj)) {
- dump_append(dc, ", \"value\":");
- dump_append_string_value(dc, obj);
- }
-}
-
-static void
dump_object(VALUE obj, struct dump_config *dc)
{
size_t memsize;
struct allocation_info *ainfo;
rb_io_t *fptr;
- ID flags[RB_OBJ_GC_FLAGS_MAX];
- size_t n, i;
-
- if (SPECIAL_CONST_P(obj)) {
- dump_append_special_const(dc, obj);
- return;
- }
dc->cur_obj = obj;
dc->cur_obj_references = 0;
@@ -222,21 +165,25 @@ dump_object(VALUE obj, struct dump_config *dc)
dump_append(dc, ", \"node_type\":\"%s\"", ruby_node_name(nd_type(obj)));
break;
- case T_SYMBOL:
- dump_append_string_content(dc, rb_sym2str(obj));
- break;
-
case T_STRING:
if (STR_EMBED_P(obj))
dump_append(dc, ", \"embedded\":true");
+ if (STR_ASSOC_P(obj))
+ dump_append(dc, ", \"associated\":true");
if (is_broken_string(obj))
dump_append(dc, ", \"broken\":true");
- if (FL_TEST(obj, RSTRING_FSTR))
- dump_append(dc, ", \"fstring\":true");
if (STR_SHARED_P(obj))
dump_append(dc, ", \"shared\":true");
- else
- dump_append_string_content(dc, obj);
+ else {
+ dump_append(dc, ", \"bytesize\":%ld", RSTRING_LEN(obj));
+ if (!STR_EMBED_P(obj) && !STR_NOCAPA_P(obj) && (long)rb_str_capacity(obj) != RSTRING_LEN(obj))
+ dump_append(dc, ", \"capacity\":%ld", rb_str_capacity(obj));
+
+ if (is_ascii_string(obj)) {
+ dump_append(dc, ", \"value\":");
+ dump_append_string_value(dc, obj);
+ }
+ }
if (!ENCODING_IS_ASCII8BIT(obj))
dump_append(dc, ", \"encoding\":\"%s\"", rb_enc_name(rb_enc_from_index(ENCODING_GET(obj))));
@@ -277,8 +224,7 @@ dump_object(VALUE obj, struct dump_config *dc)
case T_FILE:
fptr = RFILE(obj)->fptr;
- if (fptr)
- dump_append(dc, ", \"fd\":%d", fptr->fd);
+ dump_append(dc, ", \"fd\":%d", fptr->fd);
break;
case T_ZOMBIE:
@@ -292,24 +238,13 @@ dump_object(VALUE obj, struct dump_config *dc)
if ((ainfo = objspace_lookup_allocation_info(obj))) {
dump_append(dc, ", \"file\":\"%s\", \"line\":%lu", ainfo->path, ainfo->line);
- if (RTEST(ainfo->mid)) {
- VALUE m = rb_sym2str(ainfo->mid);
- dump_append(dc, ", \"method\":\"%s\"", RSTRING_PTR(m));
- }
- dump_append(dc, ", \"generation\":%"PRIuSIZE, ainfo->generation);
+ if (RTEST(ainfo->mid))
+ dump_append(dc, ", \"method\":\"%s\"", rb_id2name(SYM2ID(ainfo->mid)));
+ dump_append(dc, ", \"generation\":%zu", ainfo->generation);
}
if ((memsize = rb_obj_memsize_of(obj)) > 0)
- dump_append(dc, ", \"memsize\":%"PRIuSIZE, memsize);
-
- if ((n = rb_obj_gc_flags(obj, flags, sizeof(flags))) > 0) {
- dump_append(dc, ", \"flags\":{");
- for (i=0; i<n; i++) {
- dump_append(dc, "\"%s\":true", rb_id2name(flags[i]));
- if (i != n-1) dump_append(dc, ", ");
- }
- dump_append(dc, "}");
- }
+ dump_append(dc, ", \"memsize\":%zu", memsize);
dump_append(dc, "}\n");
}
@@ -395,8 +330,8 @@ dump_result(struct dump_config *dc, VALUE output)
/*
* call-seq:
* ObjectSpace.dump(obj[, output: :string]) # => "{ ... }"
- * ObjectSpace.dump(obj, output: :file) # => #<File:/tmp/rubyobj20131125-88733-1xkfmpv.json>
- * ObjectSpace.dump(obj, output: :stdout) # => nil
+ * ObjectSpace.dump(obj, output: :file) # => "/tmp/rubyobj000000"
+ * ObjectSpace.dump(obj, output: :stdout) # => nil
*
* Dump the contents of a ruby object as JSON.
*
@@ -424,11 +359,9 @@ objspace_dump(int argc, VALUE *argv, VALUE os)
/*
* call-seq:
- * ObjectSpace.dump_all([output: :file]) # => #<File:/tmp/rubyheap20131125-88469-laoj3v.json>
+ * ObjectSpace.dump_all([output: :file]) # => "/tmp/rubyheap000000"
* ObjectSpace.dump_all(output: :stdout) # => nil
* ObjectSpace.dump_all(output: :string) # => "{...}\n{...}\n..."
- * ObjectSpace.dump_all(output:
- * File.open('heap.json','w')) # => #<File:heap.json>
*
* Dump the contents of the ruby heap as JSON.
*
@@ -473,7 +406,4 @@ Init_objspace_dump(VALUE rb_mObjSpace)
sym_stdout = ID2SYM(rb_intern("stdout"));
sym_string = ID2SYM(rb_intern("string"));
sym_file = ID2SYM(rb_intern("file"));
-
- /* force create static IDs */
- rb_obj_gc_flags(rb_mObjSpace, 0, 0);
}
diff --git a/ext/openssl/depend b/ext/openssl/depend
index 21ba20abde..7991159f2e 100644
--- a/ext/openssl/depend
+++ b/ext/openssl/depend
@@ -1,1091 +1,6 @@
-# AUTOGENERATED DEPENDENCIES START
-openssl_missing.o: $(RUBY_EXTCONF_H)
-openssl_missing.o: openssl_missing.c
-openssl_missing.o: openssl_missing.h
-ossl.o: $(RUBY_EXTCONF_H)
-ossl.o: $(arch_hdrdir)/ruby/config.h
-ossl.o: $(hdrdir)/ruby/defines.h
-ossl.o: $(hdrdir)/ruby/encoding.h
-ossl.o: $(hdrdir)/ruby/intern.h
-ossl.o: $(hdrdir)/ruby/io.h
-ossl.o: $(hdrdir)/ruby/missing.h
-ossl.o: $(hdrdir)/ruby/oniguruma.h
-ossl.o: $(hdrdir)/ruby/ruby.h
-ossl.o: $(hdrdir)/ruby/st.h
-ossl.o: $(hdrdir)/ruby/subst.h
-ossl.o: $(hdrdir)/ruby/thread.h
-ossl.o: $(hdrdir)/ruby/thread_native.h
-ossl.o: $(top_srcdir)/include/ruby.h
-ossl.o: openssl_missing.h
-ossl.o: ossl.c
-ossl.o: ossl.h
-ossl.o: ossl_asn1.h
-ossl.o: ossl_bio.h
-ossl.o: ossl_bn.h
-ossl.o: ossl_cipher.h
-ossl.o: ossl_config.h
-ossl.o: ossl_digest.h
-ossl.o: ossl_engine.h
-ossl.o: ossl_hmac.h
-ossl.o: ossl_ns_spki.h
-ossl.o: ossl_ocsp.h
-ossl.o: ossl_pkcs12.h
-ossl.o: ossl_pkcs5.h
-ossl.o: ossl_pkcs7.h
-ossl.o: ossl_pkey.h
-ossl.o: ossl_rand.h
-ossl.o: ossl_ssl.h
-ossl.o: ossl_version.h
-ossl.o: ossl_x509.h
-ossl.o: ruby_missing.h
-ossl_asn1.o: $(RUBY_EXTCONF_H)
-ossl_asn1.o: $(arch_hdrdir)/ruby/config.h
-ossl_asn1.o: $(hdrdir)/ruby/defines.h
-ossl_asn1.o: $(hdrdir)/ruby/encoding.h
-ossl_asn1.o: $(hdrdir)/ruby/intern.h
-ossl_asn1.o: $(hdrdir)/ruby/io.h
-ossl_asn1.o: $(hdrdir)/ruby/missing.h
-ossl_asn1.o: $(hdrdir)/ruby/oniguruma.h
-ossl_asn1.o: $(hdrdir)/ruby/ruby.h
-ossl_asn1.o: $(hdrdir)/ruby/st.h
-ossl_asn1.o: $(hdrdir)/ruby/subst.h
-ossl_asn1.o: $(hdrdir)/ruby/thread.h
-ossl_asn1.o: $(top_srcdir)/include/ruby.h
-ossl_asn1.o: openssl_missing.h
-ossl_asn1.o: ossl.h
-ossl_asn1.o: ossl_asn1.c
-ossl_asn1.o: ossl_asn1.h
-ossl_asn1.o: ossl_bio.h
-ossl_asn1.o: ossl_bn.h
-ossl_asn1.o: ossl_cipher.h
-ossl_asn1.o: ossl_config.h
-ossl_asn1.o: ossl_digest.h
-ossl_asn1.o: ossl_engine.h
-ossl_asn1.o: ossl_hmac.h
-ossl_asn1.o: ossl_ns_spki.h
-ossl_asn1.o: ossl_ocsp.h
-ossl_asn1.o: ossl_pkcs12.h
-ossl_asn1.o: ossl_pkcs5.h
-ossl_asn1.o: ossl_pkcs7.h
-ossl_asn1.o: ossl_pkey.h
-ossl_asn1.o: ossl_rand.h
-ossl_asn1.o: ossl_ssl.h
-ossl_asn1.o: ossl_version.h
-ossl_asn1.o: ossl_x509.h
-ossl_asn1.o: ruby_missing.h
-ossl_bio.o: $(RUBY_EXTCONF_H)
-ossl_bio.o: $(arch_hdrdir)/ruby/config.h
-ossl_bio.o: $(hdrdir)/ruby/defines.h
-ossl_bio.o: $(hdrdir)/ruby/encoding.h
-ossl_bio.o: $(hdrdir)/ruby/intern.h
-ossl_bio.o: $(hdrdir)/ruby/io.h
-ossl_bio.o: $(hdrdir)/ruby/missing.h
-ossl_bio.o: $(hdrdir)/ruby/oniguruma.h
-ossl_bio.o: $(hdrdir)/ruby/ruby.h
-ossl_bio.o: $(hdrdir)/ruby/st.h
-ossl_bio.o: $(hdrdir)/ruby/subst.h
-ossl_bio.o: $(hdrdir)/ruby/thread.h
-ossl_bio.o: $(top_srcdir)/include/ruby.h
-ossl_bio.o: openssl_missing.h
-ossl_bio.o: ossl.h
-ossl_bio.o: ossl_asn1.h
-ossl_bio.o: ossl_bio.c
-ossl_bio.o: ossl_bio.h
-ossl_bio.o: ossl_bn.h
-ossl_bio.o: ossl_cipher.h
-ossl_bio.o: ossl_config.h
-ossl_bio.o: ossl_digest.h
-ossl_bio.o: ossl_engine.h
-ossl_bio.o: ossl_hmac.h
-ossl_bio.o: ossl_ns_spki.h
-ossl_bio.o: ossl_ocsp.h
-ossl_bio.o: ossl_pkcs12.h
-ossl_bio.o: ossl_pkcs5.h
-ossl_bio.o: ossl_pkcs7.h
-ossl_bio.o: ossl_pkey.h
-ossl_bio.o: ossl_rand.h
-ossl_bio.o: ossl_ssl.h
-ossl_bio.o: ossl_version.h
-ossl_bio.o: ossl_x509.h
-ossl_bio.o: ruby_missing.h
-ossl_bn.o: $(RUBY_EXTCONF_H)
-ossl_bn.o: $(arch_hdrdir)/ruby/config.h
-ossl_bn.o: $(hdrdir)/ruby/defines.h
-ossl_bn.o: $(hdrdir)/ruby/encoding.h
-ossl_bn.o: $(hdrdir)/ruby/intern.h
-ossl_bn.o: $(hdrdir)/ruby/io.h
-ossl_bn.o: $(hdrdir)/ruby/missing.h
-ossl_bn.o: $(hdrdir)/ruby/oniguruma.h
-ossl_bn.o: $(hdrdir)/ruby/ruby.h
-ossl_bn.o: $(hdrdir)/ruby/st.h
-ossl_bn.o: $(hdrdir)/ruby/subst.h
-ossl_bn.o: $(hdrdir)/ruby/thread.h
-ossl_bn.o: $(top_srcdir)/include/ruby.h
-ossl_bn.o: openssl_missing.h
-ossl_bn.o: ossl.h
-ossl_bn.o: ossl_asn1.h
-ossl_bn.o: ossl_bio.h
-ossl_bn.o: ossl_bn.c
-ossl_bn.o: ossl_bn.h
-ossl_bn.o: ossl_cipher.h
-ossl_bn.o: ossl_config.h
-ossl_bn.o: ossl_digest.h
-ossl_bn.o: ossl_engine.h
-ossl_bn.o: ossl_hmac.h
-ossl_bn.o: ossl_ns_spki.h
-ossl_bn.o: ossl_ocsp.h
-ossl_bn.o: ossl_pkcs12.h
-ossl_bn.o: ossl_pkcs5.h
-ossl_bn.o: ossl_pkcs7.h
-ossl_bn.o: ossl_pkey.h
-ossl_bn.o: ossl_rand.h
-ossl_bn.o: ossl_ssl.h
-ossl_bn.o: ossl_version.h
-ossl_bn.o: ossl_x509.h
-ossl_bn.o: ruby_missing.h
-ossl_cipher.o: $(RUBY_EXTCONF_H)
-ossl_cipher.o: $(arch_hdrdir)/ruby/config.h
-ossl_cipher.o: $(hdrdir)/ruby/defines.h
-ossl_cipher.o: $(hdrdir)/ruby/encoding.h
-ossl_cipher.o: $(hdrdir)/ruby/intern.h
-ossl_cipher.o: $(hdrdir)/ruby/io.h
-ossl_cipher.o: $(hdrdir)/ruby/missing.h
-ossl_cipher.o: $(hdrdir)/ruby/oniguruma.h
-ossl_cipher.o: $(hdrdir)/ruby/ruby.h
-ossl_cipher.o: $(hdrdir)/ruby/st.h
-ossl_cipher.o: $(hdrdir)/ruby/subst.h
-ossl_cipher.o: $(hdrdir)/ruby/thread.h
-ossl_cipher.o: $(top_srcdir)/include/ruby.h
-ossl_cipher.o: openssl_missing.h
-ossl_cipher.o: ossl.h
-ossl_cipher.o: ossl_asn1.h
-ossl_cipher.o: ossl_bio.h
-ossl_cipher.o: ossl_bn.h
-ossl_cipher.o: ossl_cipher.c
-ossl_cipher.o: ossl_cipher.h
-ossl_cipher.o: ossl_config.h
-ossl_cipher.o: ossl_digest.h
-ossl_cipher.o: ossl_engine.h
-ossl_cipher.o: ossl_hmac.h
-ossl_cipher.o: ossl_ns_spki.h
-ossl_cipher.o: ossl_ocsp.h
-ossl_cipher.o: ossl_pkcs12.h
-ossl_cipher.o: ossl_pkcs5.h
-ossl_cipher.o: ossl_pkcs7.h
-ossl_cipher.o: ossl_pkey.h
-ossl_cipher.o: ossl_rand.h
-ossl_cipher.o: ossl_ssl.h
-ossl_cipher.o: ossl_version.h
-ossl_cipher.o: ossl_x509.h
-ossl_cipher.o: ruby_missing.h
-ossl_config.o: $(RUBY_EXTCONF_H)
-ossl_config.o: $(arch_hdrdir)/ruby/config.h
-ossl_config.o: $(hdrdir)/ruby/defines.h
-ossl_config.o: $(hdrdir)/ruby/encoding.h
-ossl_config.o: $(hdrdir)/ruby/intern.h
-ossl_config.o: $(hdrdir)/ruby/io.h
-ossl_config.o: $(hdrdir)/ruby/missing.h
-ossl_config.o: $(hdrdir)/ruby/oniguruma.h
-ossl_config.o: $(hdrdir)/ruby/ruby.h
-ossl_config.o: $(hdrdir)/ruby/st.h
-ossl_config.o: $(hdrdir)/ruby/subst.h
-ossl_config.o: $(hdrdir)/ruby/thread.h
-ossl_config.o: $(top_srcdir)/include/ruby.h
-ossl_config.o: openssl_missing.h
-ossl_config.o: ossl.h
-ossl_config.o: ossl_asn1.h
-ossl_config.o: ossl_bio.h
-ossl_config.o: ossl_bn.h
-ossl_config.o: ossl_cipher.h
-ossl_config.o: ossl_config.c
-ossl_config.o: ossl_config.h
-ossl_config.o: ossl_digest.h
-ossl_config.o: ossl_engine.h
-ossl_config.o: ossl_hmac.h
-ossl_config.o: ossl_ns_spki.h
-ossl_config.o: ossl_ocsp.h
-ossl_config.o: ossl_pkcs12.h
-ossl_config.o: ossl_pkcs5.h
-ossl_config.o: ossl_pkcs7.h
-ossl_config.o: ossl_pkey.h
-ossl_config.o: ossl_rand.h
-ossl_config.o: ossl_ssl.h
-ossl_config.o: ossl_version.h
-ossl_config.o: ossl_x509.h
-ossl_config.o: ruby_missing.h
-ossl_digest.o: $(RUBY_EXTCONF_H)
-ossl_digest.o: $(arch_hdrdir)/ruby/config.h
-ossl_digest.o: $(hdrdir)/ruby/defines.h
-ossl_digest.o: $(hdrdir)/ruby/encoding.h
-ossl_digest.o: $(hdrdir)/ruby/intern.h
-ossl_digest.o: $(hdrdir)/ruby/io.h
-ossl_digest.o: $(hdrdir)/ruby/missing.h
-ossl_digest.o: $(hdrdir)/ruby/oniguruma.h
-ossl_digest.o: $(hdrdir)/ruby/ruby.h
-ossl_digest.o: $(hdrdir)/ruby/st.h
-ossl_digest.o: $(hdrdir)/ruby/subst.h
-ossl_digest.o: $(hdrdir)/ruby/thread.h
-ossl_digest.o: $(top_srcdir)/include/ruby.h
-ossl_digest.o: openssl_missing.h
-ossl_digest.o: ossl.h
-ossl_digest.o: ossl_asn1.h
-ossl_digest.o: ossl_bio.h
-ossl_digest.o: ossl_bn.h
-ossl_digest.o: ossl_cipher.h
-ossl_digest.o: ossl_config.h
-ossl_digest.o: ossl_digest.c
-ossl_digest.o: ossl_digest.h
-ossl_digest.o: ossl_engine.h
-ossl_digest.o: ossl_hmac.h
-ossl_digest.o: ossl_ns_spki.h
-ossl_digest.o: ossl_ocsp.h
-ossl_digest.o: ossl_pkcs12.h
-ossl_digest.o: ossl_pkcs5.h
-ossl_digest.o: ossl_pkcs7.h
-ossl_digest.o: ossl_pkey.h
-ossl_digest.o: ossl_rand.h
-ossl_digest.o: ossl_ssl.h
-ossl_digest.o: ossl_version.h
-ossl_digest.o: ossl_x509.h
-ossl_digest.o: ruby_missing.h
-ossl_engine.o: $(RUBY_EXTCONF_H)
-ossl_engine.o: $(arch_hdrdir)/ruby/config.h
-ossl_engine.o: $(hdrdir)/ruby/defines.h
-ossl_engine.o: $(hdrdir)/ruby/encoding.h
-ossl_engine.o: $(hdrdir)/ruby/intern.h
-ossl_engine.o: $(hdrdir)/ruby/io.h
-ossl_engine.o: $(hdrdir)/ruby/missing.h
-ossl_engine.o: $(hdrdir)/ruby/oniguruma.h
-ossl_engine.o: $(hdrdir)/ruby/ruby.h
-ossl_engine.o: $(hdrdir)/ruby/st.h
-ossl_engine.o: $(hdrdir)/ruby/subst.h
-ossl_engine.o: $(hdrdir)/ruby/thread.h
-ossl_engine.o: $(top_srcdir)/include/ruby.h
-ossl_engine.o: openssl_missing.h
-ossl_engine.o: ossl.h
-ossl_engine.o: ossl_asn1.h
-ossl_engine.o: ossl_bio.h
-ossl_engine.o: ossl_bn.h
-ossl_engine.o: ossl_cipher.h
-ossl_engine.o: ossl_config.h
-ossl_engine.o: ossl_digest.h
-ossl_engine.o: ossl_engine.c
-ossl_engine.o: ossl_engine.h
-ossl_engine.o: ossl_hmac.h
-ossl_engine.o: ossl_ns_spki.h
-ossl_engine.o: ossl_ocsp.h
-ossl_engine.o: ossl_pkcs12.h
-ossl_engine.o: ossl_pkcs5.h
-ossl_engine.o: ossl_pkcs7.h
-ossl_engine.o: ossl_pkey.h
-ossl_engine.o: ossl_rand.h
-ossl_engine.o: ossl_ssl.h
-ossl_engine.o: ossl_version.h
-ossl_engine.o: ossl_x509.h
-ossl_engine.o: ruby_missing.h
-ossl_hmac.o: $(RUBY_EXTCONF_H)
-ossl_hmac.o: $(arch_hdrdir)/ruby/config.h
-ossl_hmac.o: $(hdrdir)/ruby/defines.h
-ossl_hmac.o: $(hdrdir)/ruby/encoding.h
-ossl_hmac.o: $(hdrdir)/ruby/intern.h
-ossl_hmac.o: $(hdrdir)/ruby/io.h
-ossl_hmac.o: $(hdrdir)/ruby/missing.h
-ossl_hmac.o: $(hdrdir)/ruby/oniguruma.h
-ossl_hmac.o: $(hdrdir)/ruby/ruby.h
-ossl_hmac.o: $(hdrdir)/ruby/st.h
-ossl_hmac.o: $(hdrdir)/ruby/subst.h
-ossl_hmac.o: $(hdrdir)/ruby/thread.h
-ossl_hmac.o: $(top_srcdir)/include/ruby.h
-ossl_hmac.o: openssl_missing.h
-ossl_hmac.o: ossl.h
-ossl_hmac.o: ossl_asn1.h
-ossl_hmac.o: ossl_bio.h
-ossl_hmac.o: ossl_bn.h
-ossl_hmac.o: ossl_cipher.h
-ossl_hmac.o: ossl_config.h
-ossl_hmac.o: ossl_digest.h
-ossl_hmac.o: ossl_engine.h
-ossl_hmac.o: ossl_hmac.c
-ossl_hmac.o: ossl_hmac.h
-ossl_hmac.o: ossl_ns_spki.h
-ossl_hmac.o: ossl_ocsp.h
-ossl_hmac.o: ossl_pkcs12.h
-ossl_hmac.o: ossl_pkcs5.h
-ossl_hmac.o: ossl_pkcs7.h
-ossl_hmac.o: ossl_pkey.h
-ossl_hmac.o: ossl_rand.h
-ossl_hmac.o: ossl_ssl.h
-ossl_hmac.o: ossl_version.h
-ossl_hmac.o: ossl_x509.h
-ossl_hmac.o: ruby_missing.h
-ossl_ns_spki.o: $(RUBY_EXTCONF_H)
-ossl_ns_spki.o: $(arch_hdrdir)/ruby/config.h
-ossl_ns_spki.o: $(hdrdir)/ruby/defines.h
-ossl_ns_spki.o: $(hdrdir)/ruby/encoding.h
-ossl_ns_spki.o: $(hdrdir)/ruby/intern.h
-ossl_ns_spki.o: $(hdrdir)/ruby/io.h
-ossl_ns_spki.o: $(hdrdir)/ruby/missing.h
-ossl_ns_spki.o: $(hdrdir)/ruby/oniguruma.h
-ossl_ns_spki.o: $(hdrdir)/ruby/ruby.h
-ossl_ns_spki.o: $(hdrdir)/ruby/st.h
-ossl_ns_spki.o: $(hdrdir)/ruby/subst.h
-ossl_ns_spki.o: $(hdrdir)/ruby/thread.h
-ossl_ns_spki.o: $(top_srcdir)/include/ruby.h
-ossl_ns_spki.o: openssl_missing.h
-ossl_ns_spki.o: ossl.h
-ossl_ns_spki.o: ossl_asn1.h
-ossl_ns_spki.o: ossl_bio.h
-ossl_ns_spki.o: ossl_bn.h
-ossl_ns_spki.o: ossl_cipher.h
-ossl_ns_spki.o: ossl_config.h
-ossl_ns_spki.o: ossl_digest.h
-ossl_ns_spki.o: ossl_engine.h
-ossl_ns_spki.o: ossl_hmac.h
-ossl_ns_spki.o: ossl_ns_spki.c
-ossl_ns_spki.o: ossl_ns_spki.h
-ossl_ns_spki.o: ossl_ocsp.h
-ossl_ns_spki.o: ossl_pkcs12.h
-ossl_ns_spki.o: ossl_pkcs5.h
-ossl_ns_spki.o: ossl_pkcs7.h
-ossl_ns_spki.o: ossl_pkey.h
-ossl_ns_spki.o: ossl_rand.h
-ossl_ns_spki.o: ossl_ssl.h
-ossl_ns_spki.o: ossl_version.h
-ossl_ns_spki.o: ossl_x509.h
-ossl_ns_spki.o: ruby_missing.h
-ossl_ocsp.o: $(RUBY_EXTCONF_H)
-ossl_ocsp.o: $(arch_hdrdir)/ruby/config.h
-ossl_ocsp.o: $(hdrdir)/ruby/defines.h
-ossl_ocsp.o: $(hdrdir)/ruby/encoding.h
-ossl_ocsp.o: $(hdrdir)/ruby/intern.h
-ossl_ocsp.o: $(hdrdir)/ruby/io.h
-ossl_ocsp.o: $(hdrdir)/ruby/missing.h
-ossl_ocsp.o: $(hdrdir)/ruby/oniguruma.h
-ossl_ocsp.o: $(hdrdir)/ruby/ruby.h
-ossl_ocsp.o: $(hdrdir)/ruby/st.h
-ossl_ocsp.o: $(hdrdir)/ruby/subst.h
-ossl_ocsp.o: $(hdrdir)/ruby/thread.h
-ossl_ocsp.o: $(top_srcdir)/include/ruby.h
-ossl_ocsp.o: openssl_missing.h
-ossl_ocsp.o: ossl.h
-ossl_ocsp.o: ossl_asn1.h
-ossl_ocsp.o: ossl_bio.h
-ossl_ocsp.o: ossl_bn.h
-ossl_ocsp.o: ossl_cipher.h
-ossl_ocsp.o: ossl_config.h
-ossl_ocsp.o: ossl_digest.h
-ossl_ocsp.o: ossl_engine.h
-ossl_ocsp.o: ossl_hmac.h
-ossl_ocsp.o: ossl_ns_spki.h
-ossl_ocsp.o: ossl_ocsp.c
-ossl_ocsp.o: ossl_ocsp.h
-ossl_ocsp.o: ossl_pkcs12.h
-ossl_ocsp.o: ossl_pkcs5.h
-ossl_ocsp.o: ossl_pkcs7.h
-ossl_ocsp.o: ossl_pkey.h
-ossl_ocsp.o: ossl_rand.h
-ossl_ocsp.o: ossl_ssl.h
-ossl_ocsp.o: ossl_version.h
-ossl_ocsp.o: ossl_x509.h
-ossl_ocsp.o: ruby_missing.h
-ossl_pkcs12.o: $(RUBY_EXTCONF_H)
-ossl_pkcs12.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkcs12.o: $(hdrdir)/ruby/defines.h
-ossl_pkcs12.o: $(hdrdir)/ruby/encoding.h
-ossl_pkcs12.o: $(hdrdir)/ruby/intern.h
-ossl_pkcs12.o: $(hdrdir)/ruby/io.h
-ossl_pkcs12.o: $(hdrdir)/ruby/missing.h
-ossl_pkcs12.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkcs12.o: $(hdrdir)/ruby/ruby.h
-ossl_pkcs12.o: $(hdrdir)/ruby/st.h
-ossl_pkcs12.o: $(hdrdir)/ruby/subst.h
-ossl_pkcs12.o: $(hdrdir)/ruby/thread.h
-ossl_pkcs12.o: $(top_srcdir)/include/ruby.h
-ossl_pkcs12.o: openssl_missing.h
-ossl_pkcs12.o: ossl.h
-ossl_pkcs12.o: ossl_asn1.h
-ossl_pkcs12.o: ossl_bio.h
-ossl_pkcs12.o: ossl_bn.h
-ossl_pkcs12.o: ossl_cipher.h
-ossl_pkcs12.o: ossl_config.h
-ossl_pkcs12.o: ossl_digest.h
-ossl_pkcs12.o: ossl_engine.h
-ossl_pkcs12.o: ossl_hmac.h
-ossl_pkcs12.o: ossl_ns_spki.h
-ossl_pkcs12.o: ossl_ocsp.h
-ossl_pkcs12.o: ossl_pkcs12.c
-ossl_pkcs12.o: ossl_pkcs12.h
-ossl_pkcs12.o: ossl_pkcs5.h
-ossl_pkcs12.o: ossl_pkcs7.h
-ossl_pkcs12.o: ossl_pkey.h
-ossl_pkcs12.o: ossl_rand.h
-ossl_pkcs12.o: ossl_ssl.h
-ossl_pkcs12.o: ossl_version.h
-ossl_pkcs12.o: ossl_x509.h
-ossl_pkcs12.o: ruby_missing.h
-ossl_pkcs5.o: $(RUBY_EXTCONF_H)
-ossl_pkcs5.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkcs5.o: $(hdrdir)/ruby/defines.h
-ossl_pkcs5.o: $(hdrdir)/ruby/encoding.h
-ossl_pkcs5.o: $(hdrdir)/ruby/intern.h
-ossl_pkcs5.o: $(hdrdir)/ruby/io.h
-ossl_pkcs5.o: $(hdrdir)/ruby/missing.h
-ossl_pkcs5.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkcs5.o: $(hdrdir)/ruby/ruby.h
-ossl_pkcs5.o: $(hdrdir)/ruby/st.h
-ossl_pkcs5.o: $(hdrdir)/ruby/subst.h
-ossl_pkcs5.o: $(hdrdir)/ruby/thread.h
-ossl_pkcs5.o: $(top_srcdir)/include/ruby.h
-ossl_pkcs5.o: openssl_missing.h
-ossl_pkcs5.o: ossl.h
-ossl_pkcs5.o: ossl_asn1.h
-ossl_pkcs5.o: ossl_bio.h
-ossl_pkcs5.o: ossl_bn.h
-ossl_pkcs5.o: ossl_cipher.h
-ossl_pkcs5.o: ossl_config.h
-ossl_pkcs5.o: ossl_digest.h
-ossl_pkcs5.o: ossl_engine.h
-ossl_pkcs5.o: ossl_hmac.h
-ossl_pkcs5.o: ossl_ns_spki.h
-ossl_pkcs5.o: ossl_ocsp.h
-ossl_pkcs5.o: ossl_pkcs12.h
-ossl_pkcs5.o: ossl_pkcs5.c
-ossl_pkcs5.o: ossl_pkcs5.h
-ossl_pkcs5.o: ossl_pkcs7.h
-ossl_pkcs5.o: ossl_pkey.h
-ossl_pkcs5.o: ossl_rand.h
-ossl_pkcs5.o: ossl_ssl.h
-ossl_pkcs5.o: ossl_version.h
-ossl_pkcs5.o: ossl_x509.h
-ossl_pkcs5.o: ruby_missing.h
-ossl_pkcs7.o: $(RUBY_EXTCONF_H)
-ossl_pkcs7.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkcs7.o: $(hdrdir)/ruby/defines.h
-ossl_pkcs7.o: $(hdrdir)/ruby/encoding.h
-ossl_pkcs7.o: $(hdrdir)/ruby/intern.h
-ossl_pkcs7.o: $(hdrdir)/ruby/io.h
-ossl_pkcs7.o: $(hdrdir)/ruby/missing.h
-ossl_pkcs7.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkcs7.o: $(hdrdir)/ruby/ruby.h
-ossl_pkcs7.o: $(hdrdir)/ruby/st.h
-ossl_pkcs7.o: $(hdrdir)/ruby/subst.h
-ossl_pkcs7.o: $(hdrdir)/ruby/thread.h
-ossl_pkcs7.o: $(top_srcdir)/include/ruby.h
-ossl_pkcs7.o: openssl_missing.h
-ossl_pkcs7.o: ossl.h
-ossl_pkcs7.o: ossl_asn1.h
-ossl_pkcs7.o: ossl_bio.h
-ossl_pkcs7.o: ossl_bn.h
-ossl_pkcs7.o: ossl_cipher.h
-ossl_pkcs7.o: ossl_config.h
-ossl_pkcs7.o: ossl_digest.h
-ossl_pkcs7.o: ossl_engine.h
-ossl_pkcs7.o: ossl_hmac.h
-ossl_pkcs7.o: ossl_ns_spki.h
-ossl_pkcs7.o: ossl_ocsp.h
-ossl_pkcs7.o: ossl_pkcs12.h
-ossl_pkcs7.o: ossl_pkcs5.h
-ossl_pkcs7.o: ossl_pkcs7.c
-ossl_pkcs7.o: ossl_pkcs7.h
-ossl_pkcs7.o: ossl_pkey.h
-ossl_pkcs7.o: ossl_rand.h
-ossl_pkcs7.o: ossl_ssl.h
-ossl_pkcs7.o: ossl_version.h
-ossl_pkcs7.o: ossl_x509.h
-ossl_pkcs7.o: ruby_missing.h
-ossl_pkey.o: $(RUBY_EXTCONF_H)
-ossl_pkey.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkey.o: $(hdrdir)/ruby/defines.h
-ossl_pkey.o: $(hdrdir)/ruby/encoding.h
-ossl_pkey.o: $(hdrdir)/ruby/intern.h
-ossl_pkey.o: $(hdrdir)/ruby/io.h
-ossl_pkey.o: $(hdrdir)/ruby/missing.h
-ossl_pkey.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkey.o: $(hdrdir)/ruby/ruby.h
-ossl_pkey.o: $(hdrdir)/ruby/st.h
-ossl_pkey.o: $(hdrdir)/ruby/subst.h
-ossl_pkey.o: $(hdrdir)/ruby/thread.h
-ossl_pkey.o: $(top_srcdir)/include/ruby.h
-ossl_pkey.o: openssl_missing.h
-ossl_pkey.o: ossl.h
-ossl_pkey.o: ossl_asn1.h
-ossl_pkey.o: ossl_bio.h
-ossl_pkey.o: ossl_bn.h
-ossl_pkey.o: ossl_cipher.h
-ossl_pkey.o: ossl_config.h
-ossl_pkey.o: ossl_digest.h
-ossl_pkey.o: ossl_engine.h
-ossl_pkey.o: ossl_hmac.h
-ossl_pkey.o: ossl_ns_spki.h
-ossl_pkey.o: ossl_ocsp.h
-ossl_pkey.o: ossl_pkcs12.h
-ossl_pkey.o: ossl_pkcs5.h
-ossl_pkey.o: ossl_pkcs7.h
-ossl_pkey.o: ossl_pkey.c
-ossl_pkey.o: ossl_pkey.h
-ossl_pkey.o: ossl_rand.h
-ossl_pkey.o: ossl_ssl.h
-ossl_pkey.o: ossl_version.h
-ossl_pkey.o: ossl_x509.h
-ossl_pkey.o: ruby_missing.h
-ossl_pkey_dh.o: $(RUBY_EXTCONF_H)
-ossl_pkey_dh.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/defines.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/encoding.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/intern.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/io.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/missing.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/ruby.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/st.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/subst.h
-ossl_pkey_dh.o: $(hdrdir)/ruby/thread.h
-ossl_pkey_dh.o: $(top_srcdir)/include/ruby.h
-ossl_pkey_dh.o: openssl_missing.h
-ossl_pkey_dh.o: ossl.h
-ossl_pkey_dh.o: ossl_asn1.h
-ossl_pkey_dh.o: ossl_bio.h
-ossl_pkey_dh.o: ossl_bn.h
-ossl_pkey_dh.o: ossl_cipher.h
-ossl_pkey_dh.o: ossl_config.h
-ossl_pkey_dh.o: ossl_digest.h
-ossl_pkey_dh.o: ossl_engine.h
-ossl_pkey_dh.o: ossl_hmac.h
-ossl_pkey_dh.o: ossl_ns_spki.h
-ossl_pkey_dh.o: ossl_ocsp.h
-ossl_pkey_dh.o: ossl_pkcs12.h
-ossl_pkey_dh.o: ossl_pkcs5.h
-ossl_pkey_dh.o: ossl_pkcs7.h
-ossl_pkey_dh.o: ossl_pkey.h
-ossl_pkey_dh.o: ossl_pkey_dh.c
-ossl_pkey_dh.o: ossl_rand.h
-ossl_pkey_dh.o: ossl_ssl.h
-ossl_pkey_dh.o: ossl_version.h
-ossl_pkey_dh.o: ossl_x509.h
-ossl_pkey_dh.o: ruby_missing.h
-ossl_pkey_dsa.o: $(RUBY_EXTCONF_H)
-ossl_pkey_dsa.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/defines.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/encoding.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/intern.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/io.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/missing.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/ruby.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/st.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/subst.h
-ossl_pkey_dsa.o: $(hdrdir)/ruby/thread.h
-ossl_pkey_dsa.o: $(top_srcdir)/include/ruby.h
-ossl_pkey_dsa.o: openssl_missing.h
-ossl_pkey_dsa.o: ossl.h
-ossl_pkey_dsa.o: ossl_asn1.h
-ossl_pkey_dsa.o: ossl_bio.h
-ossl_pkey_dsa.o: ossl_bn.h
-ossl_pkey_dsa.o: ossl_cipher.h
-ossl_pkey_dsa.o: ossl_config.h
-ossl_pkey_dsa.o: ossl_digest.h
-ossl_pkey_dsa.o: ossl_engine.h
-ossl_pkey_dsa.o: ossl_hmac.h
-ossl_pkey_dsa.o: ossl_ns_spki.h
-ossl_pkey_dsa.o: ossl_ocsp.h
-ossl_pkey_dsa.o: ossl_pkcs12.h
-ossl_pkey_dsa.o: ossl_pkcs5.h
-ossl_pkey_dsa.o: ossl_pkcs7.h
-ossl_pkey_dsa.o: ossl_pkey.h
-ossl_pkey_dsa.o: ossl_pkey_dsa.c
-ossl_pkey_dsa.o: ossl_rand.h
-ossl_pkey_dsa.o: ossl_ssl.h
-ossl_pkey_dsa.o: ossl_version.h
-ossl_pkey_dsa.o: ossl_x509.h
-ossl_pkey_dsa.o: ruby_missing.h
-ossl_pkey_ec.o: $(RUBY_EXTCONF_H)
-ossl_pkey_ec.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/defines.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/encoding.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/intern.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/io.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/missing.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/ruby.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/st.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/subst.h
-ossl_pkey_ec.o: $(hdrdir)/ruby/thread.h
-ossl_pkey_ec.o: $(top_srcdir)/include/ruby.h
-ossl_pkey_ec.o: openssl_missing.h
-ossl_pkey_ec.o: ossl.h
-ossl_pkey_ec.o: ossl_asn1.h
-ossl_pkey_ec.o: ossl_bio.h
-ossl_pkey_ec.o: ossl_bn.h
-ossl_pkey_ec.o: ossl_cipher.h
-ossl_pkey_ec.o: ossl_config.h
-ossl_pkey_ec.o: ossl_digest.h
-ossl_pkey_ec.o: ossl_engine.h
-ossl_pkey_ec.o: ossl_hmac.h
-ossl_pkey_ec.o: ossl_ns_spki.h
-ossl_pkey_ec.o: ossl_ocsp.h
-ossl_pkey_ec.o: ossl_pkcs12.h
-ossl_pkey_ec.o: ossl_pkcs5.h
-ossl_pkey_ec.o: ossl_pkcs7.h
-ossl_pkey_ec.o: ossl_pkey.h
-ossl_pkey_ec.o: ossl_pkey_ec.c
-ossl_pkey_ec.o: ossl_rand.h
-ossl_pkey_ec.o: ossl_ssl.h
-ossl_pkey_ec.o: ossl_version.h
-ossl_pkey_ec.o: ossl_x509.h
-ossl_pkey_ec.o: ruby_missing.h
-ossl_pkey_rsa.o: $(RUBY_EXTCONF_H)
-ossl_pkey_rsa.o: $(arch_hdrdir)/ruby/config.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/defines.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/encoding.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/intern.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/io.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/missing.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/oniguruma.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/ruby.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/st.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/subst.h
-ossl_pkey_rsa.o: $(hdrdir)/ruby/thread.h
-ossl_pkey_rsa.o: $(top_srcdir)/include/ruby.h
-ossl_pkey_rsa.o: openssl_missing.h
-ossl_pkey_rsa.o: ossl.h
-ossl_pkey_rsa.o: ossl_asn1.h
-ossl_pkey_rsa.o: ossl_bio.h
-ossl_pkey_rsa.o: ossl_bn.h
-ossl_pkey_rsa.o: ossl_cipher.h
-ossl_pkey_rsa.o: ossl_config.h
-ossl_pkey_rsa.o: ossl_digest.h
-ossl_pkey_rsa.o: ossl_engine.h
-ossl_pkey_rsa.o: ossl_hmac.h
-ossl_pkey_rsa.o: ossl_ns_spki.h
-ossl_pkey_rsa.o: ossl_ocsp.h
-ossl_pkey_rsa.o: ossl_pkcs12.h
-ossl_pkey_rsa.o: ossl_pkcs5.h
-ossl_pkey_rsa.o: ossl_pkcs7.h
-ossl_pkey_rsa.o: ossl_pkey.h
-ossl_pkey_rsa.o: ossl_pkey_rsa.c
-ossl_pkey_rsa.o: ossl_rand.h
-ossl_pkey_rsa.o: ossl_ssl.h
-ossl_pkey_rsa.o: ossl_version.h
-ossl_pkey_rsa.o: ossl_x509.h
-ossl_pkey_rsa.o: ruby_missing.h
-ossl_rand.o: $(RUBY_EXTCONF_H)
-ossl_rand.o: $(arch_hdrdir)/ruby/config.h
-ossl_rand.o: $(hdrdir)/ruby/defines.h
-ossl_rand.o: $(hdrdir)/ruby/encoding.h
-ossl_rand.o: $(hdrdir)/ruby/intern.h
-ossl_rand.o: $(hdrdir)/ruby/io.h
-ossl_rand.o: $(hdrdir)/ruby/missing.h
-ossl_rand.o: $(hdrdir)/ruby/oniguruma.h
-ossl_rand.o: $(hdrdir)/ruby/ruby.h
-ossl_rand.o: $(hdrdir)/ruby/st.h
-ossl_rand.o: $(hdrdir)/ruby/subst.h
-ossl_rand.o: $(hdrdir)/ruby/thread.h
-ossl_rand.o: $(top_srcdir)/include/ruby.h
-ossl_rand.o: openssl_missing.h
-ossl_rand.o: ossl.h
-ossl_rand.o: ossl_asn1.h
-ossl_rand.o: ossl_bio.h
-ossl_rand.o: ossl_bn.h
-ossl_rand.o: ossl_cipher.h
-ossl_rand.o: ossl_config.h
-ossl_rand.o: ossl_digest.h
-ossl_rand.o: ossl_engine.h
-ossl_rand.o: ossl_hmac.h
-ossl_rand.o: ossl_ns_spki.h
-ossl_rand.o: ossl_ocsp.h
-ossl_rand.o: ossl_pkcs12.h
-ossl_rand.o: ossl_pkcs5.h
-ossl_rand.o: ossl_pkcs7.h
-ossl_rand.o: ossl_pkey.h
-ossl_rand.o: ossl_rand.c
-ossl_rand.o: ossl_rand.h
-ossl_rand.o: ossl_ssl.h
-ossl_rand.o: ossl_version.h
-ossl_rand.o: ossl_x509.h
-ossl_rand.o: ruby_missing.h
-ossl_ssl.o: $(RUBY_EXTCONF_H)
-ossl_ssl.o: $(arch_hdrdir)/ruby/config.h
-ossl_ssl.o: $(hdrdir)/ruby/defines.h
-ossl_ssl.o: $(hdrdir)/ruby/encoding.h
-ossl_ssl.o: $(hdrdir)/ruby/intern.h
-ossl_ssl.o: $(hdrdir)/ruby/io.h
-ossl_ssl.o: $(hdrdir)/ruby/missing.h
-ossl_ssl.o: $(hdrdir)/ruby/oniguruma.h
-ossl_ssl.o: $(hdrdir)/ruby/ruby.h
-ossl_ssl.o: $(hdrdir)/ruby/st.h
-ossl_ssl.o: $(hdrdir)/ruby/subst.h
-ossl_ssl.o: $(hdrdir)/ruby/thread.h
-ossl_ssl.o: $(top_srcdir)/include/ruby.h
-ossl_ssl.o: openssl_missing.h
-ossl_ssl.o: ossl.h
-ossl_ssl.o: ossl_asn1.h
-ossl_ssl.o: ossl_bio.h
-ossl_ssl.o: ossl_bn.h
-ossl_ssl.o: ossl_cipher.h
-ossl_ssl.o: ossl_config.h
-ossl_ssl.o: ossl_digest.h
-ossl_ssl.o: ossl_engine.h
-ossl_ssl.o: ossl_hmac.h
-ossl_ssl.o: ossl_ns_spki.h
-ossl_ssl.o: ossl_ocsp.h
-ossl_ssl.o: ossl_pkcs12.h
-ossl_ssl.o: ossl_pkcs5.h
-ossl_ssl.o: ossl_pkcs7.h
-ossl_ssl.o: ossl_pkey.h
-ossl_ssl.o: ossl_rand.h
-ossl_ssl.o: ossl_ssl.c
-ossl_ssl.o: ossl_ssl.h
-ossl_ssl.o: ossl_version.h
-ossl_ssl.o: ossl_x509.h
-ossl_ssl.o: ruby_missing.h
-ossl_ssl_session.o: $(RUBY_EXTCONF_H)
-ossl_ssl_session.o: $(arch_hdrdir)/ruby/config.h
-ossl_ssl_session.o: $(hdrdir)/ruby/defines.h
-ossl_ssl_session.o: $(hdrdir)/ruby/encoding.h
-ossl_ssl_session.o: $(hdrdir)/ruby/intern.h
-ossl_ssl_session.o: $(hdrdir)/ruby/io.h
-ossl_ssl_session.o: $(hdrdir)/ruby/missing.h
-ossl_ssl_session.o: $(hdrdir)/ruby/oniguruma.h
-ossl_ssl_session.o: $(hdrdir)/ruby/ruby.h
-ossl_ssl_session.o: $(hdrdir)/ruby/st.h
-ossl_ssl_session.o: $(hdrdir)/ruby/subst.h
-ossl_ssl_session.o: $(hdrdir)/ruby/thread.h
-ossl_ssl_session.o: $(top_srcdir)/include/ruby.h
-ossl_ssl_session.o: openssl_missing.h
-ossl_ssl_session.o: ossl.h
-ossl_ssl_session.o: ossl_asn1.h
-ossl_ssl_session.o: ossl_bio.h
-ossl_ssl_session.o: ossl_bn.h
-ossl_ssl_session.o: ossl_cipher.h
-ossl_ssl_session.o: ossl_config.h
-ossl_ssl_session.o: ossl_digest.h
-ossl_ssl_session.o: ossl_engine.h
-ossl_ssl_session.o: ossl_hmac.h
-ossl_ssl_session.o: ossl_ns_spki.h
-ossl_ssl_session.o: ossl_ocsp.h
-ossl_ssl_session.o: ossl_pkcs12.h
-ossl_ssl_session.o: ossl_pkcs5.h
-ossl_ssl_session.o: ossl_pkcs7.h
-ossl_ssl_session.o: ossl_pkey.h
-ossl_ssl_session.o: ossl_rand.h
-ossl_ssl_session.o: ossl_ssl.h
-ossl_ssl_session.o: ossl_ssl_session.c
-ossl_ssl_session.o: ossl_version.h
-ossl_ssl_session.o: ossl_x509.h
-ossl_ssl_session.o: ruby_missing.h
-ossl_x509.o: $(RUBY_EXTCONF_H)
-ossl_x509.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509.o: $(hdrdir)/ruby/defines.h
-ossl_x509.o: $(hdrdir)/ruby/encoding.h
-ossl_x509.o: $(hdrdir)/ruby/intern.h
-ossl_x509.o: $(hdrdir)/ruby/io.h
-ossl_x509.o: $(hdrdir)/ruby/missing.h
-ossl_x509.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509.o: $(hdrdir)/ruby/ruby.h
-ossl_x509.o: $(hdrdir)/ruby/st.h
-ossl_x509.o: $(hdrdir)/ruby/subst.h
-ossl_x509.o: $(hdrdir)/ruby/thread.h
-ossl_x509.o: $(top_srcdir)/include/ruby.h
-ossl_x509.o: openssl_missing.h
-ossl_x509.o: ossl.h
-ossl_x509.o: ossl_asn1.h
-ossl_x509.o: ossl_bio.h
-ossl_x509.o: ossl_bn.h
-ossl_x509.o: ossl_cipher.h
-ossl_x509.o: ossl_config.h
-ossl_x509.o: ossl_digest.h
-ossl_x509.o: ossl_engine.h
-ossl_x509.o: ossl_hmac.h
-ossl_x509.o: ossl_ns_spki.h
-ossl_x509.o: ossl_ocsp.h
-ossl_x509.o: ossl_pkcs12.h
-ossl_x509.o: ossl_pkcs5.h
-ossl_x509.o: ossl_pkcs7.h
-ossl_x509.o: ossl_pkey.h
-ossl_x509.o: ossl_rand.h
-ossl_x509.o: ossl_ssl.h
-ossl_x509.o: ossl_version.h
-ossl_x509.o: ossl_x509.c
-ossl_x509.o: ossl_x509.h
-ossl_x509.o: ruby_missing.h
-ossl_x509attr.o: $(RUBY_EXTCONF_H)
-ossl_x509attr.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509attr.o: $(hdrdir)/ruby/defines.h
-ossl_x509attr.o: $(hdrdir)/ruby/encoding.h
-ossl_x509attr.o: $(hdrdir)/ruby/intern.h
-ossl_x509attr.o: $(hdrdir)/ruby/io.h
-ossl_x509attr.o: $(hdrdir)/ruby/missing.h
-ossl_x509attr.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509attr.o: $(hdrdir)/ruby/ruby.h
-ossl_x509attr.o: $(hdrdir)/ruby/st.h
-ossl_x509attr.o: $(hdrdir)/ruby/subst.h
-ossl_x509attr.o: $(hdrdir)/ruby/thread.h
-ossl_x509attr.o: $(top_srcdir)/include/ruby.h
-ossl_x509attr.o: openssl_missing.h
-ossl_x509attr.o: ossl.h
-ossl_x509attr.o: ossl_asn1.h
-ossl_x509attr.o: ossl_bio.h
-ossl_x509attr.o: ossl_bn.h
-ossl_x509attr.o: ossl_cipher.h
-ossl_x509attr.o: ossl_config.h
-ossl_x509attr.o: ossl_digest.h
-ossl_x509attr.o: ossl_engine.h
-ossl_x509attr.o: ossl_hmac.h
-ossl_x509attr.o: ossl_ns_spki.h
-ossl_x509attr.o: ossl_ocsp.h
-ossl_x509attr.o: ossl_pkcs12.h
-ossl_x509attr.o: ossl_pkcs5.h
-ossl_x509attr.o: ossl_pkcs7.h
-ossl_x509attr.o: ossl_pkey.h
-ossl_x509attr.o: ossl_rand.h
-ossl_x509attr.o: ossl_ssl.h
-ossl_x509attr.o: ossl_version.h
-ossl_x509attr.o: ossl_x509.h
-ossl_x509attr.o: ossl_x509attr.c
-ossl_x509attr.o: ruby_missing.h
-ossl_x509cert.o: $(RUBY_EXTCONF_H)
-ossl_x509cert.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509cert.o: $(hdrdir)/ruby/defines.h
-ossl_x509cert.o: $(hdrdir)/ruby/encoding.h
-ossl_x509cert.o: $(hdrdir)/ruby/intern.h
-ossl_x509cert.o: $(hdrdir)/ruby/io.h
-ossl_x509cert.o: $(hdrdir)/ruby/missing.h
-ossl_x509cert.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509cert.o: $(hdrdir)/ruby/ruby.h
-ossl_x509cert.o: $(hdrdir)/ruby/st.h
-ossl_x509cert.o: $(hdrdir)/ruby/subst.h
-ossl_x509cert.o: $(hdrdir)/ruby/thread.h
-ossl_x509cert.o: $(top_srcdir)/include/ruby.h
-ossl_x509cert.o: openssl_missing.h
-ossl_x509cert.o: ossl.h
-ossl_x509cert.o: ossl_asn1.h
-ossl_x509cert.o: ossl_bio.h
-ossl_x509cert.o: ossl_bn.h
-ossl_x509cert.o: ossl_cipher.h
-ossl_x509cert.o: ossl_config.h
-ossl_x509cert.o: ossl_digest.h
-ossl_x509cert.o: ossl_engine.h
-ossl_x509cert.o: ossl_hmac.h
-ossl_x509cert.o: ossl_ns_spki.h
-ossl_x509cert.o: ossl_ocsp.h
-ossl_x509cert.o: ossl_pkcs12.h
-ossl_x509cert.o: ossl_pkcs5.h
-ossl_x509cert.o: ossl_pkcs7.h
-ossl_x509cert.o: ossl_pkey.h
-ossl_x509cert.o: ossl_rand.h
-ossl_x509cert.o: ossl_ssl.h
-ossl_x509cert.o: ossl_version.h
-ossl_x509cert.o: ossl_x509.h
-ossl_x509cert.o: ossl_x509cert.c
-ossl_x509cert.o: ruby_missing.h
-ossl_x509crl.o: $(RUBY_EXTCONF_H)
-ossl_x509crl.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509crl.o: $(hdrdir)/ruby/defines.h
-ossl_x509crl.o: $(hdrdir)/ruby/encoding.h
-ossl_x509crl.o: $(hdrdir)/ruby/intern.h
-ossl_x509crl.o: $(hdrdir)/ruby/io.h
-ossl_x509crl.o: $(hdrdir)/ruby/missing.h
-ossl_x509crl.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509crl.o: $(hdrdir)/ruby/ruby.h
-ossl_x509crl.o: $(hdrdir)/ruby/st.h
-ossl_x509crl.o: $(hdrdir)/ruby/subst.h
-ossl_x509crl.o: $(hdrdir)/ruby/thread.h
-ossl_x509crl.o: $(top_srcdir)/include/ruby.h
-ossl_x509crl.o: openssl_missing.h
-ossl_x509crl.o: ossl.h
-ossl_x509crl.o: ossl_asn1.h
-ossl_x509crl.o: ossl_bio.h
-ossl_x509crl.o: ossl_bn.h
-ossl_x509crl.o: ossl_cipher.h
-ossl_x509crl.o: ossl_config.h
-ossl_x509crl.o: ossl_digest.h
-ossl_x509crl.o: ossl_engine.h
-ossl_x509crl.o: ossl_hmac.h
-ossl_x509crl.o: ossl_ns_spki.h
-ossl_x509crl.o: ossl_ocsp.h
-ossl_x509crl.o: ossl_pkcs12.h
-ossl_x509crl.o: ossl_pkcs5.h
-ossl_x509crl.o: ossl_pkcs7.h
-ossl_x509crl.o: ossl_pkey.h
-ossl_x509crl.o: ossl_rand.h
-ossl_x509crl.o: ossl_ssl.h
-ossl_x509crl.o: ossl_version.h
-ossl_x509crl.o: ossl_x509.h
-ossl_x509crl.o: ossl_x509crl.c
-ossl_x509crl.o: ruby_missing.h
-ossl_x509ext.o: $(RUBY_EXTCONF_H)
-ossl_x509ext.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509ext.o: $(hdrdir)/ruby/defines.h
-ossl_x509ext.o: $(hdrdir)/ruby/encoding.h
-ossl_x509ext.o: $(hdrdir)/ruby/intern.h
-ossl_x509ext.o: $(hdrdir)/ruby/io.h
-ossl_x509ext.o: $(hdrdir)/ruby/missing.h
-ossl_x509ext.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509ext.o: $(hdrdir)/ruby/ruby.h
-ossl_x509ext.o: $(hdrdir)/ruby/st.h
-ossl_x509ext.o: $(hdrdir)/ruby/subst.h
-ossl_x509ext.o: $(hdrdir)/ruby/thread.h
-ossl_x509ext.o: $(top_srcdir)/include/ruby.h
-ossl_x509ext.o: openssl_missing.h
-ossl_x509ext.o: ossl.h
-ossl_x509ext.o: ossl_asn1.h
-ossl_x509ext.o: ossl_bio.h
-ossl_x509ext.o: ossl_bn.h
-ossl_x509ext.o: ossl_cipher.h
-ossl_x509ext.o: ossl_config.h
-ossl_x509ext.o: ossl_digest.h
-ossl_x509ext.o: ossl_engine.h
-ossl_x509ext.o: ossl_hmac.h
-ossl_x509ext.o: ossl_ns_spki.h
-ossl_x509ext.o: ossl_ocsp.h
-ossl_x509ext.o: ossl_pkcs12.h
-ossl_x509ext.o: ossl_pkcs5.h
-ossl_x509ext.o: ossl_pkcs7.h
-ossl_x509ext.o: ossl_pkey.h
-ossl_x509ext.o: ossl_rand.h
-ossl_x509ext.o: ossl_ssl.h
-ossl_x509ext.o: ossl_version.h
-ossl_x509ext.o: ossl_x509.h
-ossl_x509ext.o: ossl_x509ext.c
-ossl_x509ext.o: ruby_missing.h
-ossl_x509name.o: $(RUBY_EXTCONF_H)
-ossl_x509name.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509name.o: $(hdrdir)/ruby/defines.h
-ossl_x509name.o: $(hdrdir)/ruby/encoding.h
-ossl_x509name.o: $(hdrdir)/ruby/intern.h
-ossl_x509name.o: $(hdrdir)/ruby/io.h
-ossl_x509name.o: $(hdrdir)/ruby/missing.h
-ossl_x509name.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509name.o: $(hdrdir)/ruby/ruby.h
-ossl_x509name.o: $(hdrdir)/ruby/st.h
-ossl_x509name.o: $(hdrdir)/ruby/subst.h
-ossl_x509name.o: $(hdrdir)/ruby/thread.h
-ossl_x509name.o: $(top_srcdir)/include/ruby.h
-ossl_x509name.o: openssl_missing.h
-ossl_x509name.o: ossl.h
-ossl_x509name.o: ossl_asn1.h
-ossl_x509name.o: ossl_bio.h
-ossl_x509name.o: ossl_bn.h
-ossl_x509name.o: ossl_cipher.h
-ossl_x509name.o: ossl_config.h
-ossl_x509name.o: ossl_digest.h
-ossl_x509name.o: ossl_engine.h
-ossl_x509name.o: ossl_hmac.h
-ossl_x509name.o: ossl_ns_spki.h
-ossl_x509name.o: ossl_ocsp.h
-ossl_x509name.o: ossl_pkcs12.h
-ossl_x509name.o: ossl_pkcs5.h
-ossl_x509name.o: ossl_pkcs7.h
-ossl_x509name.o: ossl_pkey.h
-ossl_x509name.o: ossl_rand.h
-ossl_x509name.o: ossl_ssl.h
-ossl_x509name.o: ossl_version.h
-ossl_x509name.o: ossl_x509.h
-ossl_x509name.o: ossl_x509name.c
-ossl_x509name.o: ruby_missing.h
-ossl_x509req.o: $(RUBY_EXTCONF_H)
-ossl_x509req.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509req.o: $(hdrdir)/ruby/defines.h
-ossl_x509req.o: $(hdrdir)/ruby/encoding.h
-ossl_x509req.o: $(hdrdir)/ruby/intern.h
-ossl_x509req.o: $(hdrdir)/ruby/io.h
-ossl_x509req.o: $(hdrdir)/ruby/missing.h
-ossl_x509req.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509req.o: $(hdrdir)/ruby/ruby.h
-ossl_x509req.o: $(hdrdir)/ruby/st.h
-ossl_x509req.o: $(hdrdir)/ruby/subst.h
-ossl_x509req.o: $(hdrdir)/ruby/thread.h
-ossl_x509req.o: $(top_srcdir)/include/ruby.h
-ossl_x509req.o: openssl_missing.h
-ossl_x509req.o: ossl.h
-ossl_x509req.o: ossl_asn1.h
-ossl_x509req.o: ossl_bio.h
-ossl_x509req.o: ossl_bn.h
-ossl_x509req.o: ossl_cipher.h
-ossl_x509req.o: ossl_config.h
-ossl_x509req.o: ossl_digest.h
-ossl_x509req.o: ossl_engine.h
-ossl_x509req.o: ossl_hmac.h
-ossl_x509req.o: ossl_ns_spki.h
-ossl_x509req.o: ossl_ocsp.h
-ossl_x509req.o: ossl_pkcs12.h
-ossl_x509req.o: ossl_pkcs5.h
-ossl_x509req.o: ossl_pkcs7.h
-ossl_x509req.o: ossl_pkey.h
-ossl_x509req.o: ossl_rand.h
-ossl_x509req.o: ossl_ssl.h
-ossl_x509req.o: ossl_version.h
-ossl_x509req.o: ossl_x509.h
-ossl_x509req.o: ossl_x509req.c
-ossl_x509req.o: ruby_missing.h
-ossl_x509revoked.o: $(RUBY_EXTCONF_H)
-ossl_x509revoked.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509revoked.o: $(hdrdir)/ruby/defines.h
-ossl_x509revoked.o: $(hdrdir)/ruby/encoding.h
-ossl_x509revoked.o: $(hdrdir)/ruby/intern.h
-ossl_x509revoked.o: $(hdrdir)/ruby/io.h
-ossl_x509revoked.o: $(hdrdir)/ruby/missing.h
-ossl_x509revoked.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509revoked.o: $(hdrdir)/ruby/ruby.h
-ossl_x509revoked.o: $(hdrdir)/ruby/st.h
-ossl_x509revoked.o: $(hdrdir)/ruby/subst.h
-ossl_x509revoked.o: $(hdrdir)/ruby/thread.h
-ossl_x509revoked.o: $(top_srcdir)/include/ruby.h
-ossl_x509revoked.o: openssl_missing.h
-ossl_x509revoked.o: ossl.h
-ossl_x509revoked.o: ossl_asn1.h
-ossl_x509revoked.o: ossl_bio.h
-ossl_x509revoked.o: ossl_bn.h
-ossl_x509revoked.o: ossl_cipher.h
-ossl_x509revoked.o: ossl_config.h
-ossl_x509revoked.o: ossl_digest.h
-ossl_x509revoked.o: ossl_engine.h
-ossl_x509revoked.o: ossl_hmac.h
-ossl_x509revoked.o: ossl_ns_spki.h
-ossl_x509revoked.o: ossl_ocsp.h
-ossl_x509revoked.o: ossl_pkcs12.h
-ossl_x509revoked.o: ossl_pkcs5.h
-ossl_x509revoked.o: ossl_pkcs7.h
-ossl_x509revoked.o: ossl_pkey.h
-ossl_x509revoked.o: ossl_rand.h
-ossl_x509revoked.o: ossl_ssl.h
-ossl_x509revoked.o: ossl_version.h
-ossl_x509revoked.o: ossl_x509.h
-ossl_x509revoked.o: ossl_x509revoked.c
-ossl_x509revoked.o: ruby_missing.h
-ossl_x509store.o: $(RUBY_EXTCONF_H)
-ossl_x509store.o: $(arch_hdrdir)/ruby/config.h
-ossl_x509store.o: $(hdrdir)/ruby/defines.h
-ossl_x509store.o: $(hdrdir)/ruby/encoding.h
-ossl_x509store.o: $(hdrdir)/ruby/intern.h
-ossl_x509store.o: $(hdrdir)/ruby/io.h
-ossl_x509store.o: $(hdrdir)/ruby/missing.h
-ossl_x509store.o: $(hdrdir)/ruby/oniguruma.h
-ossl_x509store.o: $(hdrdir)/ruby/ruby.h
-ossl_x509store.o: $(hdrdir)/ruby/st.h
-ossl_x509store.o: $(hdrdir)/ruby/subst.h
-ossl_x509store.o: $(hdrdir)/ruby/thread.h
-ossl_x509store.o: $(top_srcdir)/include/ruby.h
-ossl_x509store.o: openssl_missing.h
-ossl_x509store.o: ossl.h
-ossl_x509store.o: ossl_asn1.h
-ossl_x509store.o: ossl_bio.h
-ossl_x509store.o: ossl_bn.h
-ossl_x509store.o: ossl_cipher.h
-ossl_x509store.o: ossl_config.h
-ossl_x509store.o: ossl_digest.h
-ossl_x509store.o: ossl_engine.h
-ossl_x509store.o: ossl_hmac.h
-ossl_x509store.o: ossl_ns_spki.h
-ossl_x509store.o: ossl_ocsp.h
-ossl_x509store.o: ossl_pkcs12.h
-ossl_x509store.o: ossl_pkcs5.h
-ossl_x509store.o: ossl_pkcs7.h
-ossl_x509store.o: ossl_pkey.h
-ossl_x509store.o: ossl_rand.h
-ossl_x509store.o: ossl_ssl.h
-ossl_x509store.o: ossl_version.h
-ossl_x509store.o: ossl_x509.h
-ossl_x509store.o: ossl_x509store.c
-ossl_x509store.o: ruby_missing.h
-# AUTOGENERATED DEPENDENCIES END
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/thread.h
+ossl.o: $(top_srcdir)/thread_native.h $(top_srcdir)/thread_$(THREAD_MODEL).h
diff --git a/ext/openssl/deprecation.rb b/ext/openssl/deprecation.rb
index d77353678a..39ebfa0d37 100644
--- a/ext/openssl/deprecation.rb
+++ b/ext/openssl/deprecation.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module OpenSSL
def self.deprecated_warning_flag
unless flag = (@deprecated_warning_flag ||= nil)
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 0b7fa2aaf9..e272cba092 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -1,14 +1,18 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
=begin
+= $RCSfile$ -- Generator for Makefile
+
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
All rights reserved.
= Licence
- This program is licensed under the same licence as Ruby.
+ This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
+
+= Version
+ $Id$
=end
require "mkmf"
@@ -83,7 +87,6 @@ have_func("HMAC_CTX_init")
have_func("PEM_def_callback")
have_func("PKCS5_PBKDF2_HMAC")
have_func("PKCS5_PBKDF2_HMAC_SHA1")
-have_func("RAND_egd")
have_func("X509V3_set_nconf")
have_func("X509V3_EXT_nconf_nid")
have_func("X509_CRL_add0_revoked")
@@ -100,17 +103,13 @@ have_func("OPENSSL_cleanse")
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
-have_func("SSLv3_method")
-have_func("SSLv3_server_method")
-have_func("SSLv3_client_method")
have_func("TLSv1_1_method")
have_func("TLSv1_1_server_method")
have_func("TLSv1_1_client_method")
have_func("TLSv1_2_method")
have_func("TLSv1_2_server_method")
have_func("TLSv1_2_client_method")
-have_func("SSL_CTX_set_alpn_select_cb")
-have_func("SSL_CTX_set_next_proto_select_cb")
+have_macro("OPENSSL_NPN_NEGOTIATED", ['openssl/ssl.h']) && $defs.push("-DHAVE_OPENSSL_NPN_NEGOTIATED")
unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TLSEXT_HOST_NAME")
end
diff --git a/ext/openssl/lib/openssl.rb b/ext/openssl/lib/openssl.rb
index 26d167a9b4..19a4382d0d 100644
--- a/ext/openssl/lib/openssl.rb
+++ b/ext/openssl/lib/openssl.rb
@@ -1,19 +1,22 @@
-# frozen_string_literal: false
=begin
+= $RCSfile$ -- Loader for all OpenSSL C-space and Ruby-space definitions
+
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
All rights reserved.
= Licence
- This program is licensed under the same licence as Ruby.
+ This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
+
+= Version
+ $Id$
=end
require 'openssl.so'
require 'openssl/bn'
-require 'openssl/pkey'
require 'openssl/cipher'
require 'openssl/config'
require 'openssl/digest'
diff --git a/ext/openssl/lib/openssl/bn.rb b/ext/openssl/lib/openssl/bn.rb
index 6d6c96e42d..0e19c20d34 100644
--- a/ext/openssl/lib/openssl/bn.rb
+++ b/ext/openssl/lib/openssl/bn.rb
@@ -1,6 +1,7 @@
-# frozen_string_literal: false
#--
#
+# $RCSfile$
+#
# = Ruby-space definitions that completes C-space funcs for BN
#
# = Info
@@ -9,20 +10,17 @@
# All rights reserved.
#
# = Licence
-# This program is licensed under the same licence as Ruby.
+# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
+#
+# = Version
+# $Id$
+#
#++
module OpenSSL
class BN
include Comparable
-
- def pretty_print(q)
- q.object_group(self) {
- q.text ' '
- q.text to_i.to_s
- }
- end
end # BN
end # OpenSSL
@@ -37,3 +35,4 @@ class Integer
OpenSSL::BN::new(self)
end
end # Integer
+
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index d082199000..85cf8af31c 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -1,15 +1,18 @@
-# coding: binary
-# frozen_string_literal: false
-#--
-#= Info
-# 'OpenSSL for Ruby 2' project
-# Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
-# All rights reserved.
-#
-#= Licence
-# This program is licensed under the same licence as Ruby.
-# (See the file 'LICENCE'.)
-#++
+<<EOL
+= $RCSfile$ -- Buffering mix-in module.
+
+= Info
+ 'OpenSSL for Ruby 2' project
+ Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
+ All rights reserved.
+
+= Licence
+ This program is licenced under the same licence as Ruby.
+ (See the file 'LICENCE'.)
+
+= Version
+ $Id$
+EOL
##
# OpenSSL IO buffering mix-in module.
@@ -209,7 +212,7 @@ module OpenSSL::Buffering
else
size = idx ? idx+eol.size : nil
end
- if size && limit && limit >= 0
+ if limit and limit >= 0
size = [size, limit].min
end
consume_rbuff(size)
diff --git a/ext/openssl/lib/openssl/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index a69d5ac827..b3340ff52a 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -1,5 +1,7 @@
-# frozen_string_literal: false
#--
+#
+# $RCSfile$
+#
# = Ruby-space predefined Cipher subclasses
#
# = Info
@@ -8,8 +10,12 @@
# All rights reserved.
#
# = Licence
-# This program is licensed under the same licence as Ruby.
+# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
+#
+# = Version
+# $Id$
+#
#++
module OpenSSL
diff --git a/ext/openssl/lib/openssl/config.rb b/ext/openssl/lib/openssl/config.rb
index 8822545192..5716d59fd6 100644
--- a/ext/openssl/lib/openssl/config.rb
+++ b/ext/openssl/lib/openssl/config.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
=begin
= Ruby-space definitions that completes C-space funcs for Config
@@ -6,7 +5,7 @@
Copyright (C) 2010 Hiroshi Nakamura <nahi@ruby-lang.org>
= Licence
- This program is licensed under the same licence as Ruby.
+ This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
=end
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb
index 1240bf596b..80b58af5da 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -1,5 +1,7 @@
-# frozen_string_literal: false
#--
+#
+# $RCSfile$
+#
# = Ruby-space predefined Digest subclasses
#
# = Info
@@ -8,8 +10,12 @@
# All rights reserved.
#
# = Licence
-# This program is licensed under the same licence as Ruby.
+# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
+#
+# = Version
+# $Id$
+#
#++
module OpenSSL
@@ -32,30 +38,36 @@ module OpenSSL
# OpenSSL::Digest::SHA256.digest("abc")
def self.digest(name, data)
- super(data, name)
+ super(data, name)
end
alg.each{|name|
- klass = Class.new(self) {
- define_method(:initialize, ->(data = nil) {super(name, data)})
+ klass = Class.new(Digest){
+ define_method(:initialize){|*data|
+ if data.length > 1
+ raise ArgumentError,
+ "wrong number of arguments (#{data.length} for 1)"
+ end
+ super(name, data.first)
+ }
}
singleton = (class << klass; self; end)
singleton.class_eval{
- define_method(:digest){|data| new.digest(data) }
- define_method(:hexdigest){|data| new.hexdigest(data) }
+ define_method(:digest){|data| Digest.digest(name, data) }
+ define_method(:hexdigest){|data| Digest.hexdigest(name, data) }
}
const_set(name, klass)
}
- # Deprecated.
- #
# This class is only provided for backwards compatibility.
+ #
+ # Use OpenSSL::Digest in the future.
class Digest < Digest # :nodoc:
# Deprecated.
#
# See OpenSSL::Digest.new
def initialize(*args)
- warn('Digest::Digest is deprecated; use Digest')
+ # add warning
super(*args)
end
end
@@ -79,3 +91,4 @@ module OpenSSL
module_function :Digest
end # OpenSSL
+
diff --git a/ext/openssl/lib/openssl/pkey.rb b/ext/openssl/lib/openssl/pkey.rb
deleted file mode 100644
index 3f65adadb5..0000000000
--- a/ext/openssl/lib/openssl/pkey.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: false
-module OpenSSL
- module PKey
- if defined?(OpenSSL::PKey::DH)
-
- class DH
- DEFAULT_512 = new <<-_end_of_pem_
------BEGIN DH PARAMETERS-----
-MEYCQQD0zXHljRg/mJ9PYLACLv58Cd8VxBxxY7oEuCeURMiTqEhMym16rhhKgZG2
-zk2O9uUIBIxSj+NKMURHGaFKyIvLAgEC
------END DH PARAMETERS-----
- _end_of_pem_
-
- DEFAULT_1024 = new <<-_end_of_pem_
------BEGIN DH PARAMETERS-----
-MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ
-AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR
-T4h7KZ/2zmjvV+eF8kBUHBJAojUlzxKj4QeO2x20FP9X5xmNUXeDAgEC
------END DH PARAMETERS-----
- _end_of_pem_
- end
-
- DEFAULT_TMP_DH_CALLBACK = lambda { |ctx, is_export, keylen|
- warn "using default DH parameters." if $VERBOSE
- case keylen
- when 512 then OpenSSL::PKey::DH::DEFAULT_512
- when 1024 then OpenSSL::PKey::DH::DEFAULT_1024
- else
- nil
- end
- }
-
- else
- DEFAULT_TMP_DH_CALLBACK = nil
- end
- end
-end
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 9893757011..014e1137bc 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -1,17 +1,21 @@
-# frozen_string_literal: false
=begin
+= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for SSL
+
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
All rights reserved.
= Licence
- This program is licensed under the same licence as Ruby.
+ This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
+
+= Version
+ $Id$
=end
require "openssl/buffering"
-require "io/nonblock"
+require "fcntl"
module OpenSSL
module SSL
@@ -19,49 +23,10 @@ module OpenSSL
DEFAULT_PARAMS = {
:ssl_version => "SSLv23",
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
- :ciphers => %w{
- ECDHE-ECDSA-AES128-GCM-SHA256
- ECDHE-RSA-AES128-GCM-SHA256
- ECDHE-ECDSA-AES256-GCM-SHA384
- ECDHE-RSA-AES256-GCM-SHA384
- DHE-RSA-AES128-GCM-SHA256
- DHE-DSS-AES128-GCM-SHA256
- DHE-RSA-AES256-GCM-SHA384
- DHE-DSS-AES256-GCM-SHA384
- ECDHE-ECDSA-AES128-SHA256
- ECDHE-RSA-AES128-SHA256
- ECDHE-ECDSA-AES128-SHA
- ECDHE-RSA-AES128-SHA
- ECDHE-ECDSA-AES256-SHA384
- ECDHE-RSA-AES256-SHA384
- ECDHE-ECDSA-AES256-SHA
- ECDHE-RSA-AES256-SHA
- DHE-RSA-AES128-SHA256
- DHE-RSA-AES256-SHA256
- DHE-RSA-AES128-SHA
- DHE-RSA-AES256-SHA
- DHE-DSS-AES128-SHA256
- DHE-DSS-AES256-SHA256
- DHE-DSS-AES128-SHA
- DHE-DSS-AES256-SHA
- AES128-GCM-SHA256
- AES256-GCM-SHA384
- AES128-SHA256
- AES256-SHA256
- AES128-SHA
- AES256-SHA
- ECDHE-ECDSA-RC4-SHA
- ECDHE-RSA-RC4-SHA
- RC4-SHA
- }.join(":"),
- :options => -> {
- opts = OpenSSL::SSL::OP_ALL
- opts &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
- opts |= OpenSSL::SSL::OP_NO_COMPRESSION if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
- opts |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2)
- opts |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
- opts
- }.call
+ :ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
+ :options => defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS) ?
+ OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS :
+ OpenSSL::SSL::OP_ALL,
}
DEFAULT_CERT_STORE = OpenSSL::X509::Store.new
@@ -70,48 +35,6 @@ module OpenSSL
DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
end
- INIT_VARS = ["cert", "key", "client_ca", "ca_file", "ca_path",
- "timeout", "verify_mode", "verify_depth", "renegotiation_cb",
- "verify_callback", "cert_store", "extra_chain_cert",
- "client_cert_cb", "session_id_context", "tmp_dh_callback",
- "session_get_cb", "session_new_cb", "session_remove_cb",
- "tmp_ecdh_callback", "servername_cb", "npn_protocols",
- "alpn_protocols", "alpn_select_cb",
- "npn_select_cb"].map { |x| "@#{x}" }
-
- # A callback invoked when DH parameters are required.
- #
- # The callback is invoked with the Session for the key exchange, an
- # flag indicating the use of an export cipher and the keylength
- # required.
- #
- # The callback must return an OpenSSL::PKey::DH instance of the correct
- # key length.
-
- attr_accessor :tmp_dh_callback
-
- if ExtConfig::HAVE_TLSEXT_HOST_NAME
- # A callback invoked at connect time to distinguish between multiple
- # server names.
- #
- # The callback is invoked with an SSLSocket and a server name. The
- # callback must return an SSLContext for the server name or nil.
- attr_accessor :servername_cb
- end
-
- # call-seq:
- # SSLContext.new => ctx
- # SSLContext.new(:TLSv1) => ctx
- # SSLContext.new("SSLv23_client") => ctx
- #
- # You can get a list of valid methods with OpenSSL::SSL::SSLContext::METHODS
- def initialize(version = nil)
- INIT_VARS.each { |v| instance_variable_set v, nil }
- self.options = self.options | OpenSSL::SSL::OP_ALL
- return unless version
- self.ssl_version = version
- end
-
##
# Sets the parameters for this SSL context to the values in +params+.
# The keys in +params+ must be assignment methods on SSLContext.
@@ -162,6 +85,15 @@ module OpenSSL
end
end
+ module Nonblock
+ def initialize(*args)
+ flag = File::NONBLOCK
+ flag |= @io.fcntl(Fcntl::F_GETFL) if defined?(Fcntl::F_GETFL)
+ @io.fcntl(Fcntl::F_SETFL, flag)
+ super
+ end
+ end
+
def verify_certificate_identity(cert, hostname)
should_verify_common_name = true
cert.extensions.each{|ext|
@@ -172,7 +104,8 @@ module OpenSSL
case san.tag
when 2 # dNSName in GeneralName (RFC5280)
should_verify_common_name = false
- return true if verify_hostname(hostname, san.value)
+ reg = Regexp.escape(san.value).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
when 7 # iPAddress in GeneralName (RFC5280)
should_verify_common_name = false
# follows GENERAL_NAME_print() in x509v3/v3_alt.c
@@ -187,7 +120,8 @@ module OpenSSL
if should_verify_common_name
cert.subject.to_a.each{|oid, value|
if oid == "CN"
- return true if verify_hostname(hostname, value)
+ reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
end
}
end
@@ -195,125 +129,12 @@ module OpenSSL
end
module_function :verify_certificate_identity
- def verify_hostname(hostname, san) # :nodoc:
- # RFC 5280, IA5String is limited to the set of ASCII characters
- return false unless san.ascii_only?
- return false unless hostname.ascii_only?
-
- # See RFC 6125, section 6.4.1
- # Matching is case-insensitive.
- san_parts = san.downcase.split(".")
-
- # TODO: this behavior should probably be more strict
- return san == hostname if san_parts.size < 2
-
- # Matching is case-insensitive.
- host_parts = hostname.downcase.split(".")
-
- # RFC 6125, section 6.4.3, subitem 2.
- # If the wildcard character is the only character of the left-most
- # label in the presented identifier, the client SHOULD NOT compare
- # against anything but the left-most label of the reference
- # identifier (e.g., *.example.com would match foo.example.com but
- # not bar.foo.example.com or example.com).
- return false unless san_parts.size == host_parts.size
-
- # RFC 6125, section 6.4.3, subitem 1.
- # The client SHOULD NOT attempt to match a presented identifier in
- # which the wildcard character comprises a label other than the
- # left-most label (e.g., do not match bar.*.example.net).
- return false unless verify_wildcard(host_parts.shift, san_parts.shift)
-
- san_parts.join(".") == host_parts.join(".")
- end
- module_function :verify_hostname
-
- def verify_wildcard(domain_component, san_component) # :nodoc:
- parts = san_component.split("*", -1)
-
- return false if parts.size > 2
- return san_component == domain_component if parts.size == 1
-
- # RFC 6125, section 6.4.3, subitem 3.
- # The client SHOULD NOT attempt to match a presented identifier
- # where the wildcard character is embedded within an A-label or
- # U-label of an internationalized domain name.
- return false if domain_component.start_with?("xn--") && san_component != "*"
-
- parts[0].length + parts[1].length < domain_component.length &&
- domain_component.start_with?(parts[0]) &&
- domain_component.end_with?(parts[1])
- end
- module_function :verify_wildcard
-
class SSLSocket
include Buffering
include SocketForwarder
+ include Nonblock
- if ExtConfig::OPENSSL_NO_SOCK
- def initialize(io, ctx = nil); raise NotImplementedError; end
- else
- if ExtConfig::HAVE_TLSEXT_HOST_NAME
- attr_accessor :hostname
- end
-
- attr_reader :io, :context
- attr_accessor :sync_close
- alias :to_io :io
-
- # call-seq:
- # SSLSocket.new(io) => aSSLSocket
- # SSLSocket.new(io, ctx) => aSSLSocket
- #
- # Creates a new SSL socket from +io+ which must be a real ruby object (not an
- # IO-like object that responds to read/write).
- #
- # If +ctx+ is provided the SSL Sockets initial params will be taken from
- # the context.
- #
- # The OpenSSL::Buffering module provides additional IO methods.
- #
- # This method will freeze the SSLContext if one is provided;
- # however, session management is still allowed in the frozen SSLContext.
-
- def initialize(io, context = OpenSSL::SSL::SSLContext.new)
- @io = io
- @context = context
- @sync_close = false
- @hostname = nil
- @io.nonblock = true if @io.respond_to?(:nonblock=)
- context.setup
- super()
- end
- end
-
- # call-seq:
- # ssl.sysclose => nil
- #
- # Sends "close notify" to the peer and tries to shut down the SSL
- # connection gracefully.
- #
- # If sync_close is set to +true+, the underlying IO is also closed.
- def sysclose
- return if closed?
- stop
- io.close if sync_close
- end
-
- ##
- # Perform hostname verification after an SSL connection is established
- #
- # This method MUST be called after calling #connect to ensure that the
- # hostname of a remote peer has been verified.
def post_connection_check(hostname)
- if peer_cert.nil?
- msg = "Peer verification enabled, but no certificate received."
- if using_anon_cipher?
- msg += " Anonymous cipher suite #{cipher[0]} was negotiated. Anonymous suites must be disabled to use peer verification."
- end
- raise SSLError, msg
- end
-
unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname)
raise SSLError, "hostname \"#{hostname}\" does not match the server certificate"
end
@@ -325,34 +146,6 @@ module OpenSSL
rescue SSL::Session::SessionError
nil
end
-
- private
-
- def using_anon_cipher?
- ctx = OpenSSL::SSL::SSLContext.new
- ctx.ciphers = "aNULL"
- ctx.ciphers.include?(cipher)
- end
-
- def client_cert_cb
- @context.client_cert_cb
- end
-
- def tmp_dh_callback
- @context.tmp_dh_callback || OpenSSL::PKey::DEFAULT_TMP_DH_CALLBACK
- end
-
- def tmp_ecdh_callback
- @context.tmp_ecdh_callback
- end
-
- def session_new_cb
- @context.session_new_cb
- end
-
- def session_get_cb
- @context.session_get_cb
- end
end
##
@@ -394,21 +187,14 @@ module OpenSSL
# Works similar to TCPServer#accept.
def accept
- # Socket#accept returns [socket, addrinfo].
- # TCPServer#accept returns a socket.
- # The following comma strips addrinfo.
- sock, = @svr.accept
+ sock = @svr.accept
begin
ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
ssl.sync_close = true
ssl.accept if @start_immediately
ssl
- rescue Exception => ex
- if ssl
- ssl.close
- else
- sock.close
- end
+ rescue SSLError => ex
+ sock.close
raise ex
end
end
diff --git a/ext/openssl/lib/openssl/x509.rb b/ext/openssl/lib/openssl/x509.rb
index aef3456e0f..31a4381db4 100644
--- a/ext/openssl/lib/openssl/x509.rb
+++ b/ext/openssl/lib/openssl/x509.rb
@@ -1,5 +1,7 @@
-# frozen_string_literal: false
#--
+#
+# $RCSfile$
+#
# = Ruby-space definitions that completes C-space funcs for X509 and subclasses
#
# = Info
@@ -8,8 +10,12 @@
# All rights reserved.
#
# = Licence
-# This program is licensed under the same licence as Ruby.
+# This program is licenced under the same licence as Ruby.
# (See the file 'LICENCE'.)
+#
+# = Version
+# $Id$
+#
#++
module OpenSSL
@@ -64,7 +70,7 @@ module OpenSSL
HexPair = /#{HexChar}#{HexChar}/
HexString = /#{HexPair}+/
Pair = /\\(?:[#{Special}]|\\|"|#{HexPair})/
- StringChar = /[^\\"#{Special}]/
+ StringChar = /[^#{Special}\\"]/
QuoteChar = /[^\\"]/
AttributeType = /[a-zA-Z][0-9a-zA-Z]*|[0-9]+(?:\.[0-9]+)*/
AttributeValue = /
@@ -145,13 +151,6 @@ module OpenSSL
alias parse parse_openssl
end
-
- def pretty_print(q)
- q.object_group(self) {
- q.text ' '
- q.text to_s(OpenSSL::X509::Name::RFC2253)
- }
- end
end
class StoreContext
@@ -159,18 +158,5 @@ module OpenSSL
warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
end
end
-
- class Certificate
- def pretty_print(q)
- q.object_group(self) {
- q.breakable
- q.text 'subject='; q.pp self.subject; q.text ','; q.breakable
- q.text 'issuer='; q.pp self.issuer; q.text ','; q.breakable
- q.text 'serial='; q.pp self.serial; q.text ','; q.breakable
- q.text 'not_before='; q.pp self.not_before; q.text ','; q.breakable
- q.text 'not_after='; q.pp self.not_after
- }
- end
- end
end
end
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c
index 31f2d0a5f9..b5efaaf15d 100644
--- a/ext/openssl/openssl_missing.c
+++ b/ext/openssl/openssl_missing.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include RUBY_EXTCONF_H
@@ -34,6 +35,20 @@ HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
#endif /* HAVE_HMAC_CTX_COPY */
#endif /* NO_HMAC */
+#if !defined(HAVE_X509_STORE_SET_EX_DATA)
+int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data)
+{
+ return CRYPTO_set_ex_data(&str->ex_data, idx, data);
+}
+#endif
+
+#if !defined(HAVE_X509_STORE_GET_EX_DATA)
+void *X509_STORE_get_ex_data(X509_STORE *str, int idx)
+{
+ return CRYPTO_get_ex_data(&str->ex_data, idx);
+}
+#endif
+
#if !defined(HAVE_EVP_MD_CTX_CREATE)
EVP_MD_CTX *
EVP_MD_CTX_create(void)
@@ -338,3 +353,4 @@ ASN1_put_eoc(unsigned char **pp)
return 2;
}
#endif
+
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index 955579cf9f..3635f88b73 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_OPENSSL_MISSING_H_)
@@ -133,16 +134,11 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
#endif
#if !defined(HAVE_X509_STORE_GET_EX_DATA)
-# define X509_STORE_get_ex_data(x, idx) \
- CRYPTO_get_ex_data(&(x)->ex_data, (idx))
+void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
#endif
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
-# define X509_STORE_set_ex_data(x, idx, data) \
- CRYPTO_set_ex_data(&(x)->ex_data, (idx), (data))
-# define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
- CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, (l), (p), \
- (newf), (dupf), (freef))
+int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
#endif
#if !defined(HAVE_X509_CRL_SET_VERSION)
@@ -199,3 +195,4 @@ int ASN1_put_eoc(unsigned char **pp);
#endif /* _OSSL_OPENSSL_MISSING_H_ */
+
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index fb8f2c8171..43ccf4c3fd 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -17,12 +18,11 @@ int
string2hex(const unsigned char *buf, int buf_len, char **hexbuf, int *hexbuf_len)
{
static const char hex[]="0123456789abcdef";
- int i, len;
+ int i, len = 2 * buf_len;
- if (buf_len < 0 || buf_len > INT_MAX / 2) { /* PARANOIA? */
+ if (buf_len < 0 || len < buf_len) { /* PARANOIA? */
return -1;
}
- len = 2 * buf_len;
if (!hexbuf) { /* if no buf, return calculated len */
if (hexbuf_len) {
*hexbuf_len = len;
@@ -198,8 +198,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
/*
* Verify callback
*/
-int ossl_store_ctx_ex_verify_cb_idx;
-int ossl_store_ex_verify_cb_idx;
+int ossl_verify_cb_idx;
VALUE
ossl_call_verify_cb_proc(struct ossl_verify_cb_args *args)
@@ -215,10 +214,10 @@ ossl_verify_cb(int ok, X509_STORE_CTX *ctx)
struct ossl_verify_cb_args args;
int state = 0;
- proc = (VALUE)X509_STORE_CTX_get_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx);
- if (!proc)
- proc = (VALUE)X509_STORE_get_ex_data(ctx->ctx, ossl_store_ex_verify_cb_idx);
- if (!proc)
+ proc = (VALUE)X509_STORE_CTX_get_ex_data(ctx, ossl_verify_cb_idx);
+ if ((void*)proc == 0)
+ proc = (VALUE)X509_STORE_get_ex_data(ctx->ctx, ossl_verify_cb_idx);
+ if ((void*)proc == 0)
return ok;
if (!NIL_P(proc)) {
ret = Qfalse;
@@ -294,9 +293,10 @@ ossl_to_der_if_possible(VALUE obj)
static VALUE
ossl_make_error(VALUE exc, const char *fmt, va_list args)
{
- VALUE str = Qnil;
+ char buf[BUFSIZ];
const char *msg;
long e;
+ int len = 0;
#ifdef HAVE_ERR_PEEK_LAST_ERROR
e = ERR_peek_last_error();
@@ -304,20 +304,14 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
e = ERR_peek_error();
#endif
if (fmt) {
- str = rb_vsprintf(fmt, args);
+ len = vsnprintf(buf, BUFSIZ, fmt, args);
}
- if (e) {
+ if (len < BUFSIZ && e) {
if (dOSSL == Qtrue) /* FULL INFO */
msg = ERR_error_string(e, NULL);
else
msg = ERR_reason_error_string(e);
- if (NIL_P(str)) {
- if (msg) str = rb_str_new_cstr(msg);
- }
- else {
- if (RSTRING_LEN(str)) rb_str_cat2(str, ": ");
- rb_str_cat2(str, msg ? msg : "(null)");
- }
+ len += snprintf(buf+len, BUFSIZ-len, "%s%s", (len ? ": " : ""), msg);
}
if (dOSSL == Qtrue){ /* show all errors on the stack */
while ((e = ERR_get_error()) != 0){
@@ -326,8 +320,8 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
}
ERR_clear_error();
- if (NIL_P(str)) str = rb_str_new(0, 0);
- return rb_exc_new3(exc, str);
+ if(len > BUFSIZ) len = rb_long2int(strlen(buf));
+ return rb_exc_new(exc, buf, len);
}
void
@@ -361,7 +355,7 @@ ossl_exc_new(VALUE exc, const char *fmt, ...)
* Any errors you see here are probably due to a bug in ruby's OpenSSL implementation.
*/
VALUE
-ossl_get_errors(void)
+ossl_get_errors()
{
VALUE ary;
long e;
@@ -467,7 +461,7 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
/**
* Stores locks needed for OpenSSL thread safety
*/
-#include "ruby/thread_native.h"
+#include "../../thread_native.h"
static rb_nativethread_lock_t *ossl_locks;
static void
@@ -556,20 +550,6 @@ static void Init_ossl_locks(void)
* OpenSSL provides SSL, TLS and general purpose cryptography. It wraps the
* OpenSSL[http://www.openssl.org/] library.
*
- * = Install
- *
- * OpenSSL comes bundled with the Standard Library of Ruby.
- *
- * This means the OpenSSL extension is compiled with Ruby and packaged on
- * build. During compile time, Ruby will need to link against the OpenSSL
- * library on your system. However, you cannot use openssl provided by Apple to
- * build standard library openssl.
- *
- * If you use OSX, you should install another openssl and run ```./configure
- * --with-openssl-dir=/path/to/another-openssl```. For Homebrew user, run `brew
- * install openssl` and then ```./configure --with-openssl-dir=`brew --prefix
- * openssl` ```.
- *
* = Examples
*
* All examples assume you have loaded OpenSSL with:
@@ -762,27 +742,27 @@ static void Init_ossl_locks(void)
*
* First set up the cipher for encryption
*
- * encryptor = OpenSSL::Cipher.new 'AES-128-CBC'
- * encryptor.encrypt
- * encryptor.pkcs5_keyivgen pass_phrase, salt
+ * encrypter = OpenSSL::Cipher.new 'AES-128-CBC'
+ * encrypter.encrypt
+ * encrypter.pkcs5_keyivgen pass_phrase, salt
*
* Then pass the data you want to encrypt through
*
- * encrypted = encryptor.update 'top secret document'
- * encrypted << encryptor.final
+ * encrypted = encrypter.update 'top secret document'
+ * encrypted << encrypter.final
*
* === Decryption
*
* Use a new Cipher instance set up for decryption
*
- * decryptor = OpenSSL::Cipher.new 'AES-128-CBC'
- * decryptor.decrypt
- * decryptor.pkcs5_keyivgen pass_phrase, salt
+ * decrypter = OpenSSL::Cipher.new 'AES-128-CBC'
+ * decrypter.decrypt
+ * decrypter.pkcs5_keyivgen pass_phrase, salt
*
* Then pass the data you want to decrypt through
*
- * plain = decryptor.update encrypted
- * plain << decryptor.final
+ * plain = decrypter.update encrypted
+ * plain << decrypter.final
*
* == X509 Certificates
*
@@ -1048,7 +1028,7 @@ static void Init_ossl_locks(void)
*
*/
void
-Init_openssl(void)
+Init_openssl()
{
/*
* Init timezone info
@@ -1098,11 +1078,6 @@ Init_openssl(void)
rb_define_const(mOSSL, "OPENSSL_VERSION", rb_str_new2(OPENSSL_VERSION_TEXT));
/*
- * Version of OpenSSL the ruby OpenSSL extension is running with
- */
- rb_define_const(mOSSL, "OPENSSL_LIBRARY_VERSION", rb_str_new2(SSLeay_version(SSLEAY_VERSION)));
-
- /*
* Version number of OpenSSL the ruby OpenSSL extension was built with
* (base 16)
*/
@@ -1128,10 +1103,8 @@ Init_openssl(void)
/*
* Verify callback Proc index for ext-data
*/
- if ((ossl_store_ctx_ex_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_store_ctx_ex_verify_cb_idx", 0, 0, 0)) < 0)
+ if ((ossl_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_verify_cb_idx", 0, 0, 0)) < 0)
ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index");
- if ((ossl_store_ex_verify_cb_idx = X509_STORE_get_ex_new_index(0, (void *)"ossl_store_ex_verify_cb_idx", 0, 0, 0)) < 0)
- ossl_raise(eOSSLError, "X509_STORE_get_ex_new_index");
/*
* Init debug core
@@ -1181,3 +1154,4 @@ main(int argc, char *argv[])
return 0;
}
#endif /* OSSL_DEBUG */
+
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index 8e6f2ce7e3..96d0ade11e 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_H_)
@@ -44,7 +45,7 @@ extern "C" {
# define assert(condition)
#endif
-#if defined(_WIN32) && !defined(LIBRESSL_VERSION_NUMBER)
+#if defined(_WIN32)
# include <openssl/e_os2.h>
# define OSSL_NO_CONF_API 1
# if !defined(OPENSSL_SYS_WIN32)
@@ -63,9 +64,6 @@ extern "C" {
#include <openssl/rand.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
-#if !defined(_WIN32)
-# include <openssl/crypto.h>
-#endif
#undef X509_NAME
#undef PKCS7_SIGNER_INFO
#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
@@ -97,15 +95,15 @@ extern VALUE eOSSLError;
*/
#define OSSL_Check_Kind(obj, klass) do {\
if (!rb_obj_is_kind_of((obj), (klass))) {\
- ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
- rb_obj_class(obj), (klass));\
+ ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected kind of %s)",\
+ rb_obj_classname(obj), rb_class2name(klass));\
}\
} while (0)
#define OSSL_Check_Instance(obj, klass) do {\
if (!rb_obj_is_instance_of((obj), (klass))) {\
- ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected instance of %"PRIsVALUE")",\
- rb_obj_class(obj), (klass));\
+ ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected instance of %s)",\
+ rb_obj_classname(obj), rb_class2name(klass));\
}\
} while (0)
@@ -139,8 +137,8 @@ VALUE ossl_x509name_sk2ary(STACK_OF(X509_NAME) *names);
VALUE ossl_buf2str(char *buf, int len);
#define ossl_str_adjust(str, p) \
do{\
- long len = RSTRING_LEN(str);\
- long newlen = (long)((p) - (unsigned char*)RSTRING_PTR(str));\
+ int len = RSTRING_LENINT(str);\
+ int newlen = rb_long2int((p) - (unsigned char*)RSTRING_PTR(str));\
assert(newlen <= len);\
rb_str_set_len((str), newlen);\
}while(0)
@@ -167,8 +165,7 @@ VALUE ossl_exc_new(VALUE, const char *, ...);
/*
* Verify callback
*/
-extern int ossl_store_ctx_ex_verify_cb_idx;
-extern int ossl_store_ex_verify_cb_idx;
+extern int ossl_verify_cb_idx;
struct ossl_verify_cb_args {
VALUE proc;
@@ -247,3 +244,4 @@ void Init_openssl(void);
#endif
#endif /* _OSSL_H_ */
+
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 444440125c..8aa8422b84 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -494,7 +495,7 @@ typedef struct {
VALUE *klass;
} ossl_asn1_info_t;
-static const ossl_asn1_info_t ossl_asn1_info[] = {
+static ossl_asn1_info_t ossl_asn1_info[] = {
{ "EOC", &cASN1EndOfContent, }, /* 0 */
{ "BOOLEAN", &cASN1Boolean, }, /* 1 */
{ "INTEGER", &cASN1Integer, }, /* 2 */
@@ -528,7 +529,7 @@ static const ossl_asn1_info_t ossl_asn1_info[] = {
{ "BMPSTRING", &cASN1BMPString, }, /* 30 */
};
-enum {ossl_asn1_info_size = (sizeof(ossl_asn1_info)/sizeof(ossl_asn1_info[0]))};
+int ossl_asn1_info_size = (sizeof(ossl_asn1_info)/sizeof(ossl_asn1_info[0]));
static VALUE class_tag_map;
@@ -623,8 +624,8 @@ ossl_asn1_default_tag(VALUE obj)
}
tmp_class = rb_class_superclass(tmp_class);
}
- ossl_raise(eASN1Error, "universal tag for %"PRIsVALUE" not found",
- rb_obj_class(obj));
+ ossl_raise(eASN1Error, "universal tag for %s not found",
+ rb_class2name(CLASS_OF(obj)));
return -1; /* dummy */
}
@@ -732,7 +733,7 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
}
static VALUE
-join_der_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, str))
+join_der_i(VALUE i, VALUE str)
{
i = ossl_to_der_if_possible(i);
StringValue(i);
@@ -870,18 +871,19 @@ int_ossl_asn1_decode0_cons(unsigned char **pp, long max_len, long length,
{
VALUE value, asn1data, ary;
int infinite;
- long available_len, off = *offset;
+ long off = *offset;
infinite = (j == 0x21);
ary = rb_ary_new();
- available_len = infinite ? max_len : length;
- while (available_len > 0) {
+ while (length > 0 || infinite) {
long inner_read = 0;
- value = ossl_asn1_decode0(pp, available_len, &off, depth + 1, yield, &inner_read);
+ value = ossl_asn1_decode0(pp, max_len, &off, depth + 1, yield, &inner_read);
*num_read += inner_read;
- available_len -= inner_read;
+ max_len -= inner_read;
rb_ary_push(ary, value);
+ if (length > 0)
+ length -= inner_read;
if (infinite &&
NUM2INT(ossl_asn1_get_tag(value)) == V_ASN1_EOC &&
@@ -972,7 +974,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, int depth,
if(j & V_ASN1_CONSTRUCTED) {
*pp += hlen;
off += hlen;
- asn1data = int_ossl_asn1_decode0_cons(pp, length - hlen, len, &off, depth, yield, j, tag, tag_class, &inner_read);
+ asn1data = int_ossl_asn1_decode0_cons(pp, length, len, &off, depth, yield, j, tag, tag_class, &inner_read);
inner_read += hlen;
}
else {
@@ -1027,7 +1029,7 @@ static VALUE
ossl_asn1_traverse(VALUE self, VALUE obj)
{
unsigned char *p;
- VALUE tmp;
+ volatile VALUE tmp;
long len, read = 0, offset = 0;
obj = ossl_to_der_if_possible(obj);
@@ -1035,7 +1037,6 @@ ossl_asn1_traverse(VALUE self, VALUE obj)
p = (unsigned char *)RSTRING_PTR(tmp);
len = RSTRING_LEN(tmp);
ossl_asn1_decode0(&p, len, &offset, 0, 1, &read);
- RB_GC_GUARD(tmp);
int_ossl_decode_sanity_check(len, read, offset);
return Qnil;
}
@@ -1057,7 +1058,7 @@ ossl_asn1_decode(VALUE self, VALUE obj)
{
VALUE ret;
unsigned char *p;
- VALUE tmp;
+ volatile VALUE tmp;
long len, read = 0, offset = 0;
obj = ossl_to_der_if_possible(obj);
@@ -1065,7 +1066,6 @@ ossl_asn1_decode(VALUE self, VALUE obj)
p = (unsigned char *)RSTRING_PTR(tmp);
len = RSTRING_LEN(tmp);
ret = ossl_asn1_decode0(&p, len, &offset, 0, 0, &read);
- RB_GC_GUARD(tmp);
int_ossl_decode_sanity_check(len, read, offset);
return ret;
}
@@ -1089,7 +1089,7 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
VALUE ary, val;
unsigned char *p;
long len, tmp_len = 0, read = 0, offset = 0;
- VALUE tmp;
+ volatile VALUE tmp;
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
@@ -1104,7 +1104,6 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
read += tmp_read;
tmp_len -= tmp_read;
}
- RB_GC_GUARD(tmp);
int_ossl_decode_sanity_check(len, read, offset);
return ary;
}
@@ -1151,7 +1150,7 @@ ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
}
if(!SYMBOL_P(tag_class))
ossl_raise(eASN1Error, "invalid tag class");
- if(!NIL_P(tagging) && SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
+ if(SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
ossl_raise(eASN1Error, "tag number for Universal too large");
}
else{
@@ -1361,13 +1360,13 @@ ossl_asn1cons_each(VALUE self)
/*
* call-seq:
- * OpenSSL::ASN1::ObjectId.register(object_id, short_name, long_name)
+ * ObjectId.register(object_id, short_name, long_name)
*
* This adds a new ObjectId to the internal tables. Where +object_id+ is the
* numerical form, +short_name+ is the short name, and +long_name+ is the long
* name.
*
- * Returns +true+ if successful. Raises an OpenSSL::ASN1::ASN1Error if it fails.
+ * Returns +true+ if successful. Raises an ASN1Error otherwise.
*
*/
static VALUE
@@ -1385,11 +1384,11 @@ ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
/* Document-method: OpenSSL::ASN1::ObjectId#sn
*
- * The short name of the ObjectId, as defined in <openssl/objects.h>.
+ * The short name of the ObjectId, as defined in +openssl/objects.h+.
*/
/* Document-method: OpenSSL::ASN1::ObjectId#short_name
*
- * +short_name+ is an alias to +sn+
+ * #short_name is an alias to #sn
*/
static VALUE
ossl_asn1obj_get_sn(VALUE self)
@@ -1406,11 +1405,11 @@ ossl_asn1obj_get_sn(VALUE self)
/* Document-method: OpenSSL::ASN1::ObjectId#ln
*
- * The long name of the ObjectId, as defined in <openssl/objects.h>.
+ * The long name of the ObjectId, as defined in +openssl/objects.h+.
*/
-/* Document-method: OpenSSL::ASN1::ObjectId#long_name
+/* Document-method: OpenSSL::ASN1::ObjectId.long_name
*
- * +long_name+ is an alias to +ln+
+ * #long_name is an alias to #ln
*/
static VALUE
ossl_asn1obj_get_ln(VALUE self)
@@ -1427,7 +1426,7 @@ ossl_asn1obj_get_ln(VALUE self)
/* Document-method: OpenSSL::ASN1::ObjectId#oid
*
- * The object identifier as a +String+, e.g. "1.2.3.4.5"
+ * The object identifier as a String.
*/
static VALUE
ossl_asn1obj_get_oid(VALUE self)
@@ -1473,7 +1472,7 @@ OSSL_ASN1_IMPL_FACTORY_METHOD(Set)
OSSL_ASN1_IMPL_FACTORY_METHOD(EndOfContent)
void
-Init_ossl_asn1(void)
+Init_ossl_asn1()
{
VALUE ary;
int i;
@@ -1810,12 +1809,8 @@ Init_ossl_asn1(void)
*
* == OpenSSL::ASN1::ObjectId
*
- * NOTE: While OpenSSL::ASN1::ObjectId.new will allocate a new ObjectId,
- * it is not typically allocated this way, but rather that are received from
- * parsed ASN1 encodings.
- *
* While OpenSSL::ASN1::ObjectId.new will allocate a new ObjectId, it is
- * not typically allocated this way, but rather that are received from
+ * not typically allocated this way, but rather that are recieved from
* parsed ASN1 encodings.
*
* === Additional attributes
diff --git a/ext/openssl/ossl_asn1.h b/ext/openssl/ossl_asn1.h
index 8250746c79..718f43f068 100644
--- a/ext/openssl/ossl_asn1.h
+++ b/ext/openssl/ossl_asn1.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_ASN1_H_)
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index cd2582646b..a11c08c1a3 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -17,7 +18,7 @@ ossl_obj2bio(VALUE obj)
{
BIO *bio;
- if (RB_TYPE_P(obj, T_FILE)) {
+ if (TYPE(obj) == T_FILE) {
rb_io_t *fptr;
FILE *fp;
int fd;
@@ -29,9 +30,8 @@ ossl_obj2bio(VALUE obj)
}
rb_update_max_fd(fd);
if (!(fp = fdopen(fd, "r"))){
- int e = errno;
close(fd);
- rb_syserr_fail(e, 0);
+ rb_sys_fail(0);
}
if (!(bio = BIO_new_fp(fp, BIO_CLOSE))){
fclose(fp);
diff --git a/ext/openssl/ossl_bio.h b/ext/openssl/ossl_bio.h
index 1705d0ac89..2d8f675c5b 100644
--- a/ext/openssl/ossl_bio.h
+++ b/ext/openssl/ossl_bio.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_BIO_H_)
@@ -17,3 +18,4 @@ VALUE ossl_membio2str(BIO*);
VALUE ossl_protect_membio2str(BIO*,int*);
#endif
+
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 57bb68099a..05473635ae 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -1,26 +1,25 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Technorama team <oss-ruby@technorama.net>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
/* modified by Michal Rokos <m.rokos@sh.cvut.cz> */
#include "ossl.h"
-#define NewBN(klass) \
- TypedData_Wrap_Struct((klass), &ossl_bn_type, 0)
-#define SetBN(obj, bn) do { \
+#define WrapBN(klass, obj, bn) do { \
if (!(bn)) { \
ossl_raise(rb_eRuntimeError, "BN wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (bn); \
+ (obj) = Data_Wrap_Struct((klass), 0, BN_clear_free, (bn)); \
} while (0)
#define GetBN(obj, bn) do { \
- TypedData_Get_Struct((obj), BIGNUM, &ossl_bn_type, (bn)); \
+ Data_Get_Struct((obj), BIGNUM, (bn)); \
if (!(bn)) { \
ossl_raise(rb_eRuntimeError, "BN wasn't initialized!"); \
} \
@@ -31,36 +30,10 @@
GetBN((obj), (bn)); \
} while (0)
-static void
-ossl_bn_free(void *ptr)
-{
- BN_clear_free(ptr);
-}
-
-static size_t
-ossl_bn_size(const void *ptr)
-{
- return sizeof(BIGNUM);
-}
-
-static const rb_data_type_t ossl_bn_type = {
- "OpenSSL/BN",
- {0, ossl_bn_free, ossl_bn_size,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Classes
*/
VALUE cBN;
-
-/* Document-class: OpenSSL::BNError
- *
- * BNError < OpenSSLError
- *
- * Generic Error for all of OpenSSL::BN (big num)
- */
VALUE eBNError;
/*
@@ -72,21 +45,19 @@ ossl_bn_new(const BIGNUM *bn)
BIGNUM *newbn;
VALUE obj;
- obj = NewBN(cBN);
newbn = bn ? BN_dup(bn) : BN_new();
if (!newbn) {
ossl_raise(eBNError, NULL);
}
- SetBN(obj, newbn);
+ WrapBN(cBN, obj, newbn);
return obj;
}
-static BIGNUM *
-try_convert_to_bnptr(VALUE obj)
+BIGNUM *
+GetBNPtr(VALUE obj)
{
BIGNUM *bn = NULL;
- VALUE newobj;
if (RTEST(rb_obj_is_kind_of(obj, cBN))) {
GetBN(obj, bn);
@@ -94,23 +65,16 @@ try_convert_to_bnptr(VALUE obj)
case T_FIXNUM:
case T_BIGNUM:
obj = rb_String(obj);
- newobj = NewBN(cBN); /* GC bug */
if (!BN_dec2bn(&bn, StringValuePtr(obj))) {
ossl_raise(eBNError, NULL);
}
- SetBN(newobj, bn); /* Handle potencial mem leaks */
+ WrapBN(cBN, obj, bn); /* Handle potencial mem leaks */
break;
- }
- return bn;
-}
-
-BIGNUM *
-GetBNPtr(VALUE obj)
-{
- BIGNUM *bn = try_convert_to_bnptr(obj);
- if (!bn)
+ case T_NIL:
+ break;
+ default:
ossl_raise(rb_eTypeError, "Cannot convert into OpenSSL::BN");
-
+ }
return bn;
}
@@ -128,25 +92,23 @@ static VALUE
ossl_bn_alloc(VALUE klass)
{
BIGNUM *bn;
- VALUE obj = NewBN(klass);
+ VALUE obj;
if (!(bn = BN_new())) {
ossl_raise(eBNError, NULL);
}
- SetBN(obj, bn);
+ WrapBN(klass, obj, bn);
return obj;
}
-/* Document-method: OpenSSL::BN.new
- *
- * OpenSSL::BN.new => aBN
- * OpenSSL::BN.new(bn) => aBN
- * OpenSSL::BN.new(integer) => aBN
- * OpenSSL::BN.new(string) => aBN
- * OpenSSL::BN.new(string, 0 | 2 | 10 | 16) => aBN
- *
- * Construct a new OpenSSL BigNum object.
+/*
+ * call-seq:
+ * BN.new => aBN
+ * BN.new(bn) => aBN
+ * BN.new(integer) => aBN
+ * BN.new(string) => aBN
+ * BN.new(string, 0 | 2 | 10 | 16) => aBN
*/
static VALUE
ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
@@ -178,24 +140,26 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
else if (RB_TYPE_P(str, T_BIGNUM)) {
- size_t len = rb_absint_size(str, NULL);
- unsigned char *bin;
+ int i, j, len = RBIGNUM_LENINT(str);
+ BDIGIT *ds = RBIGNUM_DIGITS(str);
VALUE buf;
- int sign;
-
- if (INT_MAX < len) {
- rb_raise(eBNError, "bignum too long");
- }
- bin = (unsigned char*)ALLOCV_N(unsigned char, buf, len);
- sign = rb_integer_pack(str, bin, len, 1, 0, INTEGER_PACK_BIG_ENDIAN);
+ unsigned char *bin = (unsigned char*)ALLOCV_N(BDIGIT, buf, len);
+
+ for (i = 0; len > i; i++) {
+ BDIGIT v = ds[i];
+ for (j = SIZEOF_BDIGITS - 1; 0 <= j; j--) {
+ bin[(len-1-i)*SIZEOF_BDIGITS+j] = v&0xff;
+ v >>= 8;
+ }
+ }
GetBN(self, bn);
- if (!BN_bin2bn(bin, (int)len, bn)) {
+ if (!BN_bin2bn(bin, (int)SIZEOF_BDIGITS*len, bn)) {
ALLOCV_END(buf);
ossl_raise(eBNError, NULL);
}
ALLOCV_END(buf);
- if (sign < 0) BN_set_negative(bn, 1);
+ if (!RBIGNUM_SIGN(str)) BN_set_negative(bn, 1);
return self;
}
if (RTEST(rb_obj_is_kind_of(str, cBN))) {
@@ -339,6 +303,11 @@ ossl_bn_coerce(VALUE self, VALUE other)
}
#define BIGNUM_BOOL1(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> true | false \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -349,33 +318,22 @@ ossl_bn_coerce(VALUE self, VALUE other)
} \
return Qfalse; \
}
-
-/*
- * Document-method: OpenSSL::BN#zero?
- * bn.zero? => true | false
- */
BIGNUM_BOOL1(is_zero)
-
-/*
- * Document-method: OpenSSL::BN#one?
- * bn.one? => true | false
- */
BIGNUM_BOOL1(is_one)
-
-/*
- * Document-method: OpenSSL::BN#odd?
- * bn.odd? => true | false
- */
BIGNUM_BOOL1(is_odd)
#define BIGNUM_1c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
BIGNUM *bn, *result; \
VALUE obj; \
GetBN(self, bn); \
- obj = NewBN(CLASS_OF(self)); \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -383,24 +341,23 @@ BIGNUM_BOOL1(is_odd)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(CLASS_OF(self), obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN#sqr
- * bn.sqr => aBN
- */
BIGNUM_1c(sqr)
#define BIGNUM_2(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
BIGNUM *bn1, *bn2 = GetBNPtr(other), *result; \
VALUE obj; \
GetBN(self, bn1); \
- obj = NewBN(CLASS_OF(self)); \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -408,30 +365,24 @@ BIGNUM_1c(sqr)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(CLASS_OF(self), obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN#+
- * bn + bn2 => aBN
- */
BIGNUM_2(add)
-
-/*
- * Document-method: OpenSSL::BN#-
- * bn - bn2 => aBN
- */
BIGNUM_2(sub)
#define BIGNUM_2c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
BIGNUM *bn1, *bn2 = GetBNPtr(other), *result; \
VALUE obj; \
GetBN(self, bn1); \
- obj = NewBN(CLASS_OF(self)); \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -439,51 +390,19 @@ BIGNUM_2(sub)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(CLASS_OF(self), obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN#*
- * bn * bn2 => aBN
- */
BIGNUM_2c(mul)
-
-/*
- * Document-method: OpenSSL::BN#%
- * bn % bn2 => aBN
- */
BIGNUM_2c(mod)
-
-/*
- * Document-method: OpenSSL::BN#**
- * bn ** bn2 => aBN
- */
BIGNUM_2c(exp)
-
-/*
- * Document-method: OpenSSL::BN#gcd
- * bn.gcd(bn2) => aBN
- */
BIGNUM_2c(gcd)
-
-/*
- * Document-method: OpenSSL::BN#mod_sqr
- * bn.mod_sqr(bn2) => aBN
- */
BIGNUM_2c(mod_sqr)
-
-/*
- * Document-method: OpenSSL::BN#mod_inverse
- * bn.mod_inverse(bn2) => aBN
- */
BIGNUM_2c(mod_inverse)
/*
- * Document-method: OpenSSL::BN#/
+ * call-seq:
* bn1 / bn2 => [result, remainder]
- *
- * Division of OpenSSL::BN instances
*/
static VALUE
ossl_bn_div(VALUE self, VALUE other)
@@ -493,8 +412,6 @@ ossl_bn_div(VALUE self, VALUE other)
GetBN(self, bn1);
- obj1 = NewBN(CLASS_OF(self));
- obj2 = NewBN(CLASS_OF(self));
if (!(r1 = BN_new())) {
ossl_raise(eBNError, NULL);
}
@@ -507,13 +424,18 @@ ossl_bn_div(VALUE self, VALUE other)
BN_free(r2);
ossl_raise(eBNError, NULL);
}
- SetBN(obj1, r1);
- SetBN(obj2, r2);
+ WrapBN(CLASS_OF(self), obj1, r1);
+ WrapBN(CLASS_OF(self), obj2, r2);
return rb_ary_new3(2, obj1, obj2);
}
#define BIGNUM_3c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn1, bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other1, VALUE other2) \
{ \
@@ -521,7 +443,6 @@ ossl_bn_div(VALUE self, VALUE other)
BIGNUM *bn3 = GetBNPtr(other2), *result; \
VALUE obj; \
GetBN(self, bn1); \
- obj = NewBN(CLASS_OF(self)); \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -529,35 +450,20 @@ ossl_bn_div(VALUE self, VALUE other)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(CLASS_OF(self), obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN#mod_add
- * bn.mod_add(bn1, bn2) -> aBN
- */
BIGNUM_3c(mod_add)
-
-/*
- * Document-method: OpenSSL::BN#mod_sub
- * bn.mod_sub(bn1, bn2) -> aBN
- */
BIGNUM_3c(mod_sub)
-
-/*
- * Document-method: OpenSSL::BN#mod_mul
- * bn.mod_mul(bn1, bn2) -> aBN
- */
BIGNUM_3c(mod_mul)
-
-/*
- * Document-method: OpenSSL::BN#mod_exp
- * bn.mod_exp(bn1, bn2) -> aBN
- */
BIGNUM_3c(mod_exp)
#define BIGNUM_BIT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bit) -> self \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE bit) \
{ \
@@ -568,32 +474,13 @@ BIGNUM_3c(mod_exp)
} \
return self; \
}
-
-/*
- * Document-method: OpenSSL::BN#set_bit!
- * bn.set_bit!(bit) -> self
- */
BIGNUM_BIT(set_bit)
-
-/*
- * Document-method: OpenSSL::BN#clear_bit!
- * bn.clear_bit!(bit) -> self
- */
BIGNUM_BIT(clear_bit)
-
-/*
- * Document-method: OpenSSL::BN#mask_bit!
- * bn.mask_bit!(bit) -> self
- */
BIGNUM_BIT(mask_bits)
-/* Document-method: OpenSSL::BN#bit_set?
- *
- * Returns boolean of whether +bit+ is set.
- * Bitwise operations for openssl BIGNUMs.
- *
+/*
+ * call-seq:
* bn.bit_set?(bit) => true | false
- *
*/
static VALUE
ossl_bn_is_bit_set(VALUE self, VALUE bit)
@@ -610,6 +497,11 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
}
#define BIGNUM_SHIFT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bits) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE bits) \
{ \
@@ -618,7 +510,6 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
VALUE obj; \
b = NUM2INT(bits); \
GetBN(self, bn); \
- obj = NewBN(CLASS_OF(self)); \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -626,25 +517,18 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(CLASS_OF(self), obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN#<<
- * call-seq:
- * bn << bits -> aBN
- */
BIGNUM_SHIFT(lshift)
-
-/*
- * Document-method: OpenSSL::BN#>>
- * call-seq:
- * bn >> bits -> aBN
- */
BIGNUM_SHIFT(rshift)
#define BIGNUM_SELF_SHIFT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func!(bits) -> self \
+ * \
+ */ \
static VALUE \
ossl_bn_self_##func(VALUE self, VALUE bits) \
{ \
@@ -656,20 +540,15 @@ BIGNUM_SHIFT(rshift)
ossl_raise(eBNError, NULL); \
return self; \
}
-
-/*
- * Document-method: OpenSSL::BN#lshift!
- * bn.lshift!(bits) -> self
- */
BIGNUM_SELF_SHIFT(lshift)
-
-/*
- * Document-method: OpenSSL::BN#rshift!
- * bn.rshift!(bits) -> self
- */
BIGNUM_SELF_SHIFT(rshift)
#define BIGNUM_RAND(func) \
+ /* \
+ * call-seq: \
+ * BN.##func(bits [, fill [, odd]]) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_s_##func(int argc, VALUE *argv, VALUE klass) \
{ \
@@ -685,7 +564,6 @@ BIGNUM_SELF_SHIFT(rshift)
top = NUM2INT(fill); \
} \
b = NUM2INT(bits); \
- obj = NewBN(klass); \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -693,28 +571,23 @@ BIGNUM_SELF_SHIFT(rshift)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(klass, obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN.rand
- * BN.rand(bits [, fill [, odd]]) -> aBN
- */
BIGNUM_RAND(rand)
-
-/*
- * Document-method: OpenSSL::BN.pseudo_rand
- * BN.pseudo_rand(bits [, fill [, odd]]) -> aBN
- */
BIGNUM_RAND(pseudo_rand)
#define BIGNUM_RAND_RANGE(func) \
+ /* \
+ * call-seq: \
+ * BN.##func(range) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_s_##func##_range(VALUE klass, VALUE range) \
{ \
BIGNUM *bn = GetBNPtr(range), *result; \
- VALUE obj = NewBN(klass); \
+ VALUE obj; \
if (!(result = BN_new())) { \
ossl_raise(eBNError, NULL); \
} \
@@ -722,22 +595,10 @@ BIGNUM_RAND(pseudo_rand)
BN_free(result); \
ossl_raise(eBNError, NULL); \
} \
- SetBN(obj, result); \
+ WrapBN(klass, obj, result); \
return obj; \
}
-
-/*
- * Document-method: OpenSSL::BN.rand_range
- * BN.rand_range(range) -> aBN
- *
- */
BIGNUM_RAND_RANGE(rand)
-
-/*
- * Document-method: OpenSSL::BN.pseudo_rand_range
- * BN.pseudo_rand_range(range) -> aBN
- *
- */
BIGNUM_RAND_RANGE(pseudo_rand)
/*
@@ -768,7 +629,6 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
add = GetBNPtr(vadd);
rem = NIL_P(vrem) ? NULL : GetBNPtr(vrem);
}
- obj = NewBN(klass);
if (!(result = BN_new())) {
ossl_raise(eBNError, NULL);
}
@@ -776,12 +636,17 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
BN_free(result);
ossl_raise(eBNError, NULL);
}
- SetBN(obj, result);
+ WrapBN(klass, obj, result);
return obj;
}
#define BIGNUM_NUM(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> integer \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -789,17 +654,7 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
GetBN(self, bn); \
return INT2FIX(BN_##func(bn)); \
}
-
-/*
- * Document-method: OpenSSL::BN#num_bytes
- * bn.num_bytes => integer
- */
BIGNUM_NUM(num_bytes)
-
-/*
- * Document-method: OpenSSL::BN#num_bits
- * bn.num_bits => integer
- */
BIGNUM_NUM(num_bits)
static VALUE
@@ -821,6 +676,11 @@ ossl_bn_copy(VALUE self, VALUE other)
}
#define BIGNUM_CMP(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> integer \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -828,97 +688,19 @@ ossl_bn_copy(VALUE self, VALUE other)
GetBN(self, bn1); \
return INT2FIX(BN_##func(bn1, bn2)); \
}
-
-/*
- * Document-method: OpenSSL::BN#cmp
- * bn.cmp(bn2) => integer
- */
-/*
- * Document-method: OpenSSL::BN#<=>
- * bn <=> bn2 => integer
- */
BIGNUM_CMP(cmp)
-
-/*
- * Document-method: OpenSSL::BN#ucmp
- * bn.ucmp(bn2) => integer
- */
BIGNUM_CMP(ucmp)
-/*
- * call-seq:
- * bn == obj => true or false
- *
- * Returns +true+ only if +obj+ has the same value as +bn+. Contrast this
- * with OpenSSL::BN#eql?, which requires obj to be OpenSSL::BN.
- */
static VALUE
-ossl_bn_eq(VALUE self, VALUE other)
+ossl_bn_eql(VALUE self, VALUE other)
{
- BIGNUM *bn1, *bn2;
-
- GetBN(self, bn1);
- /* BNPtr may raise, so we can't use here */
- bn2 = try_convert_to_bnptr(other);
-
- if (bn2 && !BN_cmp(bn1, bn2)) {
+ if (ossl_bn_cmp(self, other) == INT2FIX(0)) {
return Qtrue;
}
return Qfalse;
}
/*
- * call-seq:
- * bn.eql?(obj) => true or false
- *
- * Returns <code>true</code> only if <i>obj</i> is a
- * <code>OpenSSL::BN</code> with the same value as <i>big</i>. Contrast this
- * with OpenSSL::BN#==, which performs type conversions.
- */
-static VALUE
-ossl_bn_eql(VALUE self, VALUE other)
-{
- BIGNUM *bn1, *bn2;
-
- if (!rb_obj_is_kind_of(other, cBN))
- return Qfalse;
- GetBN(self, bn1);
- GetBN(other, bn2);
-
- return BN_cmp(bn1, bn2) ? Qfalse : Qtrue;
-}
-
-/*
- * call-seq:
- * bn.hash => Integer
- *
- * Returns a hash code for this object.
- *
- * See also Object#hash.
- */
-static VALUE
-ossl_bn_hash(VALUE self)
-{
- BIGNUM *bn;
- VALUE hash;
- unsigned char *buf;
- int len;
-
- GetBN(self, bn);
- len = BN_num_bytes(bn);
- buf = xmalloc(len);
- if (BN_bn2bin(bn, buf) != len) {
- xfree(buf);
- ossl_raise(eBNError, NULL);
- }
-
- hash = LONG2FIX((long)rb_memhash(buf, len));
- xfree(buf);
-
- return hash;
-}
-
-/*
* call-seq:
* bn.prime? => true | false
* bn.prime?(checks) => true | false
@@ -993,7 +775,7 @@ ossl_bn_is_prime_fasttest(int argc, VALUE *argv, VALUE self)
* (NOTE: ordering of methods is the same as in 'man bn')
*/
void
-Init_ossl_bn(void)
+Init_ossl_bn()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
@@ -1045,9 +827,8 @@ Init_ossl_bn(void)
rb_define_alias(cBN, "<=>", "cmp");
rb_define_method(cBN, "ucmp", ossl_bn_ucmp, 1);
rb_define_method(cBN, "eql?", ossl_bn_eql, 1);
- rb_define_method(cBN, "hash", ossl_bn_hash, 0);
- rb_define_method(cBN, "==", ossl_bn_eq, 1);
- rb_define_alias(cBN, "===", "==");
+ rb_define_alias(cBN, "==", "eql?");
+ rb_define_alias(cBN, "===", "eql?");
rb_define_method(cBN, "zero?", ossl_bn_is_zero, 0);
rb_define_method(cBN, "one?", ossl_bn_is_one, 0);
/* is_word */
@@ -1114,3 +895,4 @@ Init_ossl_bn(void)
*/
rb_define_method(cBN, "prime_fasttest?", ossl_bn_is_prime_fasttest, -1);
}
+
diff --git a/ext/openssl/ossl_bn.h b/ext/openssl/ossl_bn.h
index 4cd9d0600a..d6c396227b 100644
--- a/ext/openssl/ossl_bn.h
+++ b/ext/openssl/ossl_bn.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_BN_H_)
@@ -21,3 +22,4 @@ void Init_ossl_bn(void);
#endif /* _OSS_BN_H_ */
+
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 24caba6e37..03374372ad 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -1,22 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewCipher(klass) \
- TypedData_Wrap_Struct((klass), &ossl_cipher_type, 0)
+#define WrapCipher(obj, klass, ctx) \
+ (obj) = Data_Wrap_Struct((klass), 0, ossl_cipher_free, (ctx))
#define MakeCipher(obj, klass, ctx) \
- (obj) = TypedData_Make_Struct((klass), EVP_CIPHER_CTX, &ossl_cipher_type, (ctx))
+ (obj) = Data_Make_Struct((klass), EVP_CIPHER_CTX, 0, ossl_cipher_free, (ctx))
#define AllocCipher(obj, ctx) \
- (DATA_PTR(obj) = (ctx) = ZALLOC(EVP_CIPHER_CTX))
+ memset(DATA_PTR(obj) = (ctx) = ALLOC(EVP_CIPHER_CTX), 0, sizeof(EVP_CIPHER_CTX))
#define GetCipherInit(obj, ctx) do { \
- TypedData_Get_Struct((obj), EVP_CIPHER_CTX, &ossl_cipher_type, (ctx)); \
+ Data_Get_Struct((obj), EVP_CIPHER_CTX, (ctx)); \
} while (0)
#define GetCipher(obj, ctx) do { \
GetCipherInit((obj), (ctx)); \
@@ -34,18 +35,8 @@
*/
VALUE cCipher;
VALUE eCipherError;
-static ID id_key_set;
static VALUE ossl_cipher_alloc(VALUE klass);
-static void ossl_cipher_free(void *ptr);
-static size_t ossl_cipher_memsize(const void *ptr);
-
-static const rb_data_type_t ossl_cipher_type = {
- "OpenSSL/Cipher",
- {0, ossl_cipher_free, ossl_cipher_memsize,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-};
/*
* PUBLIC
@@ -79,26 +70,22 @@ ossl_cipher_new(const EVP_CIPHER *cipher)
* PRIVATE
*/
static void
-ossl_cipher_free(void *ptr)
+ossl_cipher_free(EVP_CIPHER_CTX *ctx)
{
- EVP_CIPHER_CTX *ctx = ptr;
if (ctx) {
EVP_CIPHER_CTX_cleanup(ctx);
ruby_xfree(ctx);
}
}
-static size_t
-ossl_cipher_memsize(const void *ptr)
-{
- const EVP_CIPHER_CTX *ctx = ptr;
- return sizeof(*ctx);
-}
-
static VALUE
ossl_cipher_alloc(VALUE klass)
{
- return NewCipher(klass);
+ VALUE obj;
+
+ WrapCipher(obj, klass, 0);
+
+ return obj;
}
/*
@@ -115,6 +102,7 @@ ossl_cipher_initialize(VALUE self, VALUE str)
EVP_CIPHER_CTX *ctx;
const EVP_CIPHER *cipher;
char *name;
+ unsigned char key[EVP_MAX_KEY_LENGTH];
name = StringValuePtr(str);
GetCipherInit(self, ctx);
@@ -126,7 +114,14 @@ ossl_cipher_initialize(VALUE self, VALUE str)
if (!(cipher = EVP_get_cipherbyname(name))) {
ossl_raise(rb_eRuntimeError, "unsupported cipher algorithm (%s)", name);
}
- if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, -1) != 1)
+ /*
+ * The EVP which has EVP_CIPH_RAND_KEY flag (such as DES3) allows
+ * uninitialized key, but other EVPs (such as AES) does not allow it.
+ * Calling EVP_CipherUpdate() without initializing key causes SEGV so we
+ * set the data filled with "\0" as the key by default.
+ */
+ memset(key, 0, EVP_MAX_KEY_LENGTH);
+ if (EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, -1) != 1)
ossl_raise(eCipherError, NULL);
return self;
@@ -163,7 +158,7 @@ add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary)
#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED
/*
* call-seq:
- * OpenSSL::Cipher.ciphers -> array[string...]
+ * Cipher.ciphers -> array[string...]
*
* Returns the names of all available ciphers in an array.
*/
@@ -188,7 +183,7 @@ ossl_s_ciphers(VALUE self)
* cipher.reset -> self
*
* Fully resets the internal state of the Cipher. By using this, the same
- * Cipher instance may be used several times for encryption or decryption tasks.
+ * Cipher instance may be used several times for en- or decryption tasks.
*
* Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).
*/
@@ -218,9 +213,9 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
* We deprecated the arguments for this method, but we decided
* keeping this behaviour for backward compatibility.
*/
- VALUE cname = rb_class_path(rb_obj_class(self));
- rb_warn("arguments for %"PRIsVALUE"#encrypt and %"PRIsVALUE"#decrypt were deprecated; "
- "use %"PRIsVALUE"#pkcs5_keyivgen to derive key and IV",
+ const char *cname = rb_class2name(rb_obj_class(self));
+ rb_warn("arguments for %s#encrypt and %s#decrypt were deprecated; "
+ "use %s#pkcs5_keyivgen to derive key and IV",
cname, cname, cname);
StringValue(pass);
GetCipher(self, ctx);
@@ -245,9 +240,6 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
ossl_raise(eCipherError, NULL);
}
- if (p_key)
- rb_ivar_set(self, id_key_set, Qtrue);
-
return self;
}
@@ -334,38 +326,9 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
OPENSSL_cleanse(key, sizeof key);
OPENSSL_cleanse(iv, sizeof iv);
- rb_ivar_set(self, id_key_set, Qtrue);
-
return Qnil;
}
-static int
-ossl_cipher_update_long(EVP_CIPHER_CTX *ctx, unsigned char *out, long *out_len_ptr,
- const unsigned char *in, long in_len)
-{
- int out_part_len;
- long out_len = 0;
-#define UPDATE_LENGTH_LIMIT INT_MAX
-
-#if SIZEOF_LONG > UPDATE_LENGTH_LIMIT
- if (in_len > UPDATE_LENGTH_LIMIT) {
- const int in_part_len = (UPDATE_LENGTH_LIMIT / 2 + 1) & ~1;
- do {
- if (!EVP_CipherUpdate(ctx, out ? (out + out_len) : 0,
- &out_part_len, in, in_part_len))
- return 0;
- out_len += out_part_len;
- in += in_part_len;
- } while ((in_len -= in_part_len) > UPDATE_LENGTH_LIMIT);
- }
-#endif
- if (!EVP_CipherUpdate(ctx, out ? (out + out_len) : 0,
- &out_part_len, in, (int)in_len))
- return 0;
- if (out_len_ptr) *out_len_ptr = out_len += out_part_len;
- return 1;
-}
-
/*
* call-seq:
* cipher.update(data [, buffer]) -> string or buffer
@@ -384,24 +347,17 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self)
{
EVP_CIPHER_CTX *ctx;
unsigned char *in;
- long in_len, out_len;
+ int in_len, out_len;
VALUE data, str;
rb_scan_args(argc, argv, "11", &data, &str);
- if (!RTEST(rb_attr_get(self, id_key_set)))
- ossl_raise(eCipherError, "key not set");
-
StringValue(data);
in = (unsigned char *)RSTRING_PTR(data);
- if ((in_len = RSTRING_LEN(data)) == 0)
+ if ((in_len = RSTRING_LENINT(data)) == 0)
ossl_raise(rb_eArgError, "data must not be empty");
GetCipher(self, ctx);
out_len = in_len+EVP_CIPHER_CTX_block_size(ctx);
- if (out_len <= 0) {
- ossl_raise(rb_eRangeError,
- "data too big to make output buffer: %ld bytes", in_len);
- }
if (NIL_P(str)) {
str = rb_str_new(0, out_len);
@@ -410,7 +366,7 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self)
rb_str_resize(str, out_len);
}
- if (!ossl_cipher_update_long(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len))
+ if (!EVP_CipherUpdate(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len))
ossl_raise(eCipherError, NULL);
assert(out_len < RSTRING_LEN(str));
rb_str_set_len(str, out_len);
@@ -491,8 +447,6 @@ ossl_cipher_set_key(VALUE self, VALUE key)
if (EVP_CipherInit_ex(ctx, NULL, NULL, (unsigned char *)RSTRING_PTR(key), NULL, -1) != 1)
ossl_raise(eCipherError, NULL);
- rb_ivar_set(self, id_key_set, Qtrue);
-
return key;
}
@@ -552,16 +506,17 @@ ossl_cipher_set_auth_data(VALUE self, VALUE data)
{
EVP_CIPHER_CTX *ctx;
unsigned char *in;
- long in_len, out_len;
+ int in_len;
+ int out_len;
StringValue(data);
in = (unsigned char *) RSTRING_PTR(data);
- in_len = RSTRING_LEN(data);
+ in_len = RSTRING_LENINT(data);
GetCipher(self, ctx);
- if (!ossl_cipher_update_long(ctx, NULL, &out_len, in, in_len))
+ if (!EVP_CipherUpdate(ctx, NULL, &out_len, in, in_len))
ossl_raise(eCipherError, "couldn't set additional authenticated data");
return data;
@@ -1011,6 +966,5 @@ Init_ossl_cipher(void)
rb_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0);
rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
-
- id_key_set = rb_intern_const("key_set");
}
+
diff --git a/ext/openssl/ossl_cipher.h b/ext/openssl/ossl_cipher.h
index c444089fc2..bed4fa853b 100644
--- a/ext/openssl/ossl_cipher.h
+++ b/ext/openssl/ossl_cipher.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_CIPHER_H_)
@@ -18,3 +19,4 @@ VALUE ossl_cipher_new(const EVP_CIPHER *);
void Init_ossl_cipher(void);
#endif /* _OSSL_CIPHER_H_ */
+
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index 47d2658453..0f25a19e50 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -16,7 +17,7 @@
VALUE cConfig;
/* Document-class: OpenSSL::ConfigError
*
- * General error for openssl library configuration files. Including formatting,
+ * General error for openssl library configuration files. Including formating,
* parsing errors, etc.
*/
VALUE eConfigError;
@@ -26,13 +27,13 @@ VALUE eConfigError;
*/
/*
- * DupConfigPtr is a public C-level function for getting OpenSSL CONF struct
+ * GetConfigPtr is a public C-level function for getting OpenSSL CONF struct
* from an OpenSSL::Config(eConfig) instance. We decided to implement
* OpenSSL::Config in Ruby level but we need to pass native CONF struct for
* some OpenSSL features such as X509V3_EXT_*.
*/
CONF *
-DupConfigPtr(VALUE obj)
+GetConfigPtr(VALUE obj)
{
CONF *conf;
VALUE str;
@@ -50,10 +51,9 @@ DupConfigPtr(VALUE obj)
if(!NCONF_load_bio(conf, bio, &eline)){
BIO_free(bio);
NCONF_free(conf);
- if (eline <= 0)
- ossl_raise(eConfigError, "wrong config format");
- else
- ossl_raise(eConfigError, "error in line %d", eline);
+ if (eline <= 0) ossl_raise(eConfigError, "wrong config format");
+ else ossl_raise(eConfigError, "error in line %d", eline);
+ ossl_raise(eConfigError, NULL);
}
BIO_free(bio);
@@ -69,7 +69,7 @@ DupConfigPtr(VALUE obj)
* INIT
*/
void
-Init_ossl_config(void)
+Init_ossl_config()
{
char *default_config_file;
eConfigError = rb_define_class_under(mOSSL, "ConfigError", eOSSLError);
diff --git a/ext/openssl/ossl_config.h b/ext/openssl/ossl_config.h
index 627d297ba3..cb226b27e5 100644
--- a/ext/openssl/ossl_config.h
+++ b/ext/openssl/ossl_config.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_CONFIG_H_)
@@ -13,7 +14,9 @@
extern VALUE cConfig;
extern VALUE eConfigError;
+CONF* GetConfigPtr(VALUE obj);
CONF* DupConfigPtr(VALUE obj);
void Init_ossl_config(void);
#endif /* _OSSL_CONFIG_H_ */
+
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index 44968dd9e5..fdf13e98e5 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -1,16 +1,17 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
#define GetDigest(obj, ctx) do { \
- TypedData_Get_Struct((obj), EVP_MD_CTX, &ossl_digest_type, (ctx)); \
+ Data_Get_Struct((obj), EVP_MD_CTX, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "Digest CTX wasn't initialized!"); \
} \
@@ -28,20 +29,6 @@ VALUE eDigestError;
static VALUE ossl_digest_alloc(VALUE klass);
-static void
-ossl_digest_free(void *ctx)
-{
- EVP_MD_CTX_destroy(ctx);
-}
-
-static const rb_data_type_t ossl_digest_type = {
- "OpenSSL/Digest",
- {
- 0, ossl_digest_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
*/
@@ -51,7 +38,7 @@ GetDigestPtr(VALUE obj)
const EVP_MD *md;
ASN1_OBJECT *oid = NULL;
- if (RB_TYPE_P(obj, T_STRING)) {
+ if (TYPE(obj) == T_STRING) {
const char *name = StringValueCStr(obj);
md = EVP_get_digestbyname(name);
@@ -94,11 +81,13 @@ ossl_digest_new(const EVP_MD *md)
static VALUE
ossl_digest_alloc(VALUE klass)
{
- VALUE obj = TypedData_Wrap_Struct(klass, &ossl_digest_type, 0);
- EVP_MD_CTX *ctx = EVP_MD_CTX_create();
+ EVP_MD_CTX *ctx;
+ VALUE obj;
+
+ ctx = EVP_MD_CTX_create();
if (ctx == NULL)
ossl_raise(rb_eRuntimeError, "EVP_MD_CTX_create() failed");
- RTYPEDDATA_DATA(obj) = ctx;
+ obj = Data_Wrap_Struct(klass, 0, EVP_MD_CTX_destroy, ctx);
return obj;
}
@@ -305,7 +294,7 @@ ossl_digest_block_length(VALUE self)
* INIT
*/
void
-Init_ossl_digest(void)
+Init_ossl_digest()
{
rb_require("digest");
diff --git a/ext/openssl/ossl_digest.h b/ext/openssl/ossl_digest.h
index 512f7d3a39..8cc5b1bc56 100644
--- a/ext/openssl/ossl_digest.h
+++ b/ext/openssl/ossl_digest.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_DIGEST_H_)
@@ -18,3 +19,4 @@ VALUE ossl_digest_new(const EVP_MD *);
void Init_ossl_digest(void);
#endif /* _OSSL_DIGEST_H_ */
+
diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c
index 890ec724e5..da1a3c7a74 100644
--- a/ext/openssl/ossl_engine.c
+++ b/ext/openssl/ossl_engine.c
@@ -1,26 +1,25 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
#if defined(OSSL_ENGINE_ENABLED)
-#define NewEngine(klass) \
- TypedData_Wrap_Struct((klass), &ossl_engine_type, 0)
-#define SetEngine(obj, engine) do { \
+#define WrapEngine(klass, obj, engine) do { \
if (!(engine)) { \
ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
} \
- RTYPEDDATA_DATA(obj) = (engine); \
+ (obj) = Data_Wrap_Struct((klass), 0, ENGINE_free, (engine)); \
} while(0)
#define GetEngine(obj, engine) do { \
- TypedData_Get_Struct((obj), ENGINE, &ossl_engine_type, (engine)); \
+ Data_Get_Struct((obj), ENGINE, (engine)); \
if (!(engine)) { \
ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
} \
@@ -58,20 +57,6 @@ do{\
}\
}while(0)
-static void
-ossl_engine_free(void *engine)
-{
- ENGINE_free(engine);
-}
-
-static const rb_data_type_t ossl_engine_type = {
- "OpenSSL/Engine",
- {
- 0, ossl_engine_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/* Document-method: OpenSSL::Engine.load
*
* call-seq:
@@ -183,12 +168,11 @@ ossl_engine_s_engines(VALUE klass)
ary = rb_ary_new();
for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)){
- obj = NewEngine(klass);
/* Need a ref count of two here because of ENGINE_free being
* called internally by OpenSSL when moving to the next ENGINE
* and by us when releasing the ENGINE reference */
ENGINE_up_ref(e);
- SetEngine(obj, e);
+ WrapEngine(klass, obj, e);
rb_ary_push(ary, obj);
}
@@ -215,10 +199,9 @@ ossl_engine_s_by_id(VALUE klass, VALUE id)
StringValue(id);
ossl_engine_s_load(1, &id, klass);
- obj = NewEngine(klass);
if(!(e = ENGINE_by_id(RSTRING_PTR(id))))
ossl_raise(eEngineError, NULL);
- SetEngine(obj, e);
+ WrapEngine(klass, obj, e);
if(rb_block_given_p()) rb_yield(obj);
if(!ENGINE_init(e))
ossl_raise(eEngineError, NULL);
@@ -235,11 +218,10 @@ ossl_engine_s_alloc(VALUE klass)
ENGINE *e;
VALUE obj;
- obj = NewEngine(klass);
if (!(e = ENGINE_new())) {
ossl_raise(eEngineError, NULL);
}
- SetEngine(obj, e);
+ WrapEngine(klass, obj, e);
return obj;
}
@@ -541,17 +523,24 @@ ossl_engine_get_cmds(VALUE self)
static VALUE
ossl_engine_inspect(VALUE self)
{
- ENGINE *e;
-
- GetEngine(self, e);
- return rb_sprintf("#<%"PRIsVALUE" id=\"%s\" name=\"%s\">",
- rb_obj_class(self), ENGINE_get_id(e), ENGINE_get_name(e));
+ VALUE str;
+ const char *cname = rb_class2name(rb_obj_class(self));
+
+ str = rb_str_new2("#<");
+ rb_str_cat2(str, cname);
+ rb_str_cat2(str, " id=\"");
+ rb_str_append(str, ossl_engine_get_id(self));
+ rb_str_cat2(str, "\" name=\"");
+ rb_str_append(str, ossl_engine_get_name(self));
+ rb_str_cat2(str, "\">");
+
+ return str;
}
#define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))
void
-Init_ossl_engine(void)
+Init_ossl_engine()
{
cEngine = rb_define_class_under(mOSSL, "Engine", rb_cObject);
eEngineError = rb_define_class_under(cEngine, "EngineError", eOSSLError);
@@ -596,7 +585,7 @@ Init_ossl_engine(void)
}
#else
void
-Init_ossl_engine(void)
+Init_ossl_engine()
{
}
#endif
diff --git a/ext/openssl/ossl_engine.h b/ext/openssl/ossl_engine.h
index cd548beea3..ea2f256912 100644
--- a/ext/openssl/ossl_engine.h
+++ b/ext/openssl/ossl_engine.h
@@ -1,11 +1,12 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(OSSL_ENGINE_H)
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index 5513cb20de..0bba44d783 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(OPENSSL_NO_HMAC)
@@ -12,9 +13,9 @@
#include "ossl.h"
#define MakeHMAC(obj, klass, ctx) \
- (obj) = TypedData_Make_Struct((klass), HMAC_CTX, &ossl_hmac_type, (ctx))
+ (obj) = Data_Make_Struct((klass), HMAC_CTX, 0, ossl_hmac_free, (ctx))
#define GetHMAC(obj, ctx) do { \
- TypedData_Get_Struct((obj), HMAC_CTX, &ossl_hmac_type, (ctx)); \
+ Data_Get_Struct((obj), HMAC_CTX, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "HMAC wasn't initialized"); \
} \
@@ -38,20 +39,12 @@ VALUE eHMACError;
* Private
*/
static void
-ossl_hmac_free(void *ctx)
+ossl_hmac_free(HMAC_CTX *ctx)
{
HMAC_CTX_cleanup(ctx);
ruby_xfree(ctx);
}
-static const rb_data_type_t ossl_hmac_type = {
- "OpenSSL/HMAC",
- {
- 0, ossl_hmac_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
ossl_hmac_alloc(VALUE klass)
{
@@ -334,7 +327,7 @@ ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
* INIT
*/
void
-Init_ossl_hmac(void)
+Init_ossl_hmac()
{
#if 0
/* :nodoc: */
@@ -364,8 +357,8 @@ Init_ossl_hmac(void)
#else /* NO_HMAC */
# warning >>> OpenSSL is compiled without HMAC support <<<
void
-Init_ossl_hmac(void)
+Init_ossl_hmac()
{
- rb_warning("HMAC is not available: OpenSSL is compiled without HMAC.");
+ rb_warning("HMAC will NOT be avaible: OpenSSL is compiled without HMAC.");
}
#endif /* NO_HMAC */
diff --git a/ext/openssl/ossl_hmac.h b/ext/openssl/ossl_hmac.h
index 7c51f4722d..1a2978b39a 100644
--- a/ext/openssl/ossl_hmac.h
+++ b/ext/openssl/ossl_hmac.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_HMAC_H_)
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index 35c2e3e542..b80984cfee 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewSPKI(klass) \
- TypedData_Wrap_Struct((klass), &ossl_netscape_spki_type, 0)
-#define SetSPKI(obj, spki) do { \
+#define WrapSPKI(klass, obj, spki) do { \
if (!(spki)) { \
ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (spki); \
+ (obj) = Data_Wrap_Struct((klass), 0, NETSCAPE_SPKI_free, (spki)); \
} while (0)
#define GetSPKI(obj, spki) do { \
- TypedData_Get_Struct((obj), NETSCAPE_SPKI, &ossl_netscape_spki_type, (spki)); \
+ Data_Get_Struct((obj), NETSCAPE_SPKI, (spki)); \
if (!(spki)) { \
ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
} \
@@ -38,32 +37,16 @@ VALUE eSPKIError;
/*
* Private functions
*/
-
-static void
-ossl_netscape_spki_free(void *spki)
-{
- NETSCAPE_SPKI_free(spki);
-}
-
-static const rb_data_type_t ossl_netscape_spki_type = {
- "OpenSSL/NETSCAPE_SPKI",
- {
- 0, ossl_netscape_spki_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
ossl_spki_alloc(VALUE klass)
{
NETSCAPE_SPKI *spki;
VALUE obj;
- obj = NewSPKI(klass);
if (!(spki = NETSCAPE_SPKI_new())) {
ossl_raise(eSPKIError, NULL);
}
- SetSPKI(obj, spki);
+ WrapSPKI(klass, obj, spki);
return obj;
}
@@ -377,7 +360,7 @@ ossl_spki_verify(VALUE self, VALUE key)
*/
void
-Init_ossl_ns_spki(void)
+Init_ossl_ns_spki()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
@@ -403,3 +386,4 @@ Init_ossl_ns_spki(void)
rb_define_method(cSPKI, "challenge", ossl_spki_get_challenge, 0);
rb_define_method(cSPKI, "challenge=", ossl_spki_set_challenge, 1);
}
+
diff --git a/ext/openssl/ossl_ns_spki.h b/ext/openssl/ossl_ns_spki.h
index 62ba8cb163..9977035a9c 100644
--- a/ext/openssl/ossl_ns_spki.h
+++ b/ext/openssl/ossl_ns_spki.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_NS_SPKI_H_)
@@ -17,3 +18,4 @@ extern VALUE eSPKIError;
void Init_ossl_ns_spki(void);
#endif /* _OSSL_NS_SPKI_H_ */
+
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c
index b97e26cf92..4e2e8394a4 100644
--- a/ext/openssl/ossl_ocsp.c
+++ b/ext/openssl/ossl_ocsp.c
@@ -1,25 +1,24 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
#if defined(OSSL_OCSP_ENABLED)
-#define NewOCSPReq(klass) \
- TypedData_Wrap_Struct((klass), &ossl_ocsp_request_type, 0)
-#define SetOCSPReq(obj, req) do { \
+#define WrapOCSPReq(klass, obj, req) do { \
if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
- RTYPEDDATA_DATA(obj) = (req); \
+ (obj) = Data_Wrap_Struct((klass), 0, OCSP_REQUEST_free, (req)); \
} while (0)
#define GetOCSPReq(obj, req) do { \
- TypedData_Get_Struct((obj), OCSP_REQUEST, &ossl_ocsp_request_type, (req)); \
+ Data_Get_Struct((obj), OCSP_REQUEST, (req)); \
if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
} while (0)
#define SafeGetOCSPReq(obj, req) do { \
@@ -27,14 +26,12 @@
GetOCSPReq((obj), (req)); \
} while (0)
-#define NewOCSPRes(klass) \
- TypedData_Wrap_Struct((klass), &ossl_ocsp_response_type, 0)
-#define SetOCSPRes(obj, res) do { \
+#define WrapOCSPRes(klass, obj, res) do { \
if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
- RTYPEDDATA_DATA(obj) = (res); \
+ (obj) = Data_Wrap_Struct((klass), 0, OCSP_RESPONSE_free, (res)); \
} while (0)
#define GetOCSPRes(obj, res) do { \
- TypedData_Get_Struct((obj), OCSP_RESPONSE, &ossl_ocsp_response_type, (res)); \
+ Data_Get_Struct((obj), OCSP_RESPONSE, (res)); \
if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
} while (0)
#define SafeGetOCSPRes(obj, res) do { \
@@ -42,14 +39,12 @@
GetOCSPRes((obj), (res)); \
} while (0)
-#define NewOCSPBasicRes(klass) \
- TypedData_Wrap_Struct((klass), &ossl_ocsp_basicresp_type, 0)
-#define SetOCSPBasicRes(obj, res) do { \
+#define WrapOCSPBasicRes(klass, obj, res) do { \
if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
- RTYPEDDATA_DATA(obj) = (res); \
+ (obj) = Data_Wrap_Struct((klass), 0, OCSP_BASICRESP_free, (res)); \
} while (0)
#define GetOCSPBasicRes(obj, res) do { \
- TypedData_Get_Struct((obj), OCSP_BASICRESP, &ossl_ocsp_basicresp_type, (res)); \
+ Data_Get_Struct((obj), OCSP_BASICRESP, (res)); \
if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
} while (0)
#define SafeGetOCSPBasicRes(obj, res) do { \
@@ -57,14 +52,12 @@
GetOCSPBasicRes((obj), (res)); \
} while (0)
-#define NewOCSPCertId(klass) \
- TypedData_Wrap_Struct((klass), &ossl_ocsp_certid_type, 0)
-#define SetOCSPCertId(obj, cid) do { \
+#define WrapOCSPCertId(klass, obj, cid) do { \
if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
- RTYPEDDATA_DATA(obj) = (cid); \
+ (obj) = Data_Wrap_Struct((klass), 0, OCSP_CERTID_free, (cid)); \
} while (0)
#define GetOCSPCertId(obj, cid) do { \
- TypedData_Get_Struct((obj), OCSP_CERTID, &ossl_ocsp_certid_type, (cid)); \
+ Data_Get_Struct((obj), OCSP_CERTID, (cid)); \
if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
} while (0)
#define SafeGetOCSPCertId(obj, cid) do { \
@@ -79,70 +72,14 @@ VALUE cOCSPRes;
VALUE cOCSPBasicRes;
VALUE cOCSPCertId;
-static void
-ossl_ocsp_request_free(void *ptr)
-{
- OCSP_REQUEST_free(ptr);
-}
-
-static const rb_data_type_t ossl_ocsp_request_type = {
- "OpenSSL/OCSP/REQUEST",
- {
- 0, ossl_ocsp_request_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
-static void
-ossl_ocsp_response_free(void *ptr)
-{
- OCSP_RESPONSE_free(ptr);
-}
-
-static const rb_data_type_t ossl_ocsp_response_type = {
- "OpenSSL/OCSP/RESPONSE",
- {
- 0, ossl_ocsp_response_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
-static void
-ossl_ocsp_basicresp_free(void *ptr)
-{
- OCSP_BASICRESP_free(ptr);
-}
-
-static const rb_data_type_t ossl_ocsp_basicresp_type = {
- "OpenSSL/OCSP/BASICRESP",
- {
- 0, ossl_ocsp_basicresp_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
-static void
-ossl_ocsp_certid_free(void *ptr)
-{
- OCSP_CERTID_free(ptr);
-}
-
-static const rb_data_type_t ossl_ocsp_certid_type = {
- "OpenSSL/OCSP/CERTID",
- {
- 0, ossl_ocsp_certid_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
*/
static VALUE
ossl_ocspcertid_new(OCSP_CERTID *cid)
{
- VALUE obj = NewOCSPCertId(cOCSPCertId);
- SetOCSPCertId(obj, cid);
+ VALUE obj;
+ WrapOCSPCertId(cOCSPCertId, obj, cid);
return obj;
}
@@ -155,23 +92,13 @@ ossl_ocspreq_alloc(VALUE klass)
OCSP_REQUEST *req;
VALUE obj;
- obj = NewOCSPReq(klass);
if (!(req = OCSP_REQUEST_new()))
ossl_raise(eOCSPError, NULL);
- SetOCSPReq(obj, req);
+ WrapOCSPReq(klass, obj, req);
return obj;
}
-/*
- * call-seq:
- * OpenSSL::OCSP::Request.new -> request
- * OpenSSL::OCSP::Request.new(request_der) -> request
- *
- * Creates a new OpenSSL::OCSP::Request. The request may be created empty or
- * from a +request_der+ string.
- */
-
static VALUE
ossl_ocspreq_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -194,17 +121,6 @@ ossl_ocspreq_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * request.add_nonce(nonce = nil) -> request
- *
- * Adds a +nonce+ to the OCSP request. If no nonce is given a random one will
- * be generated.
- *
- * The nonce is used to prevent replay attacks but some servers do not support
- * it.
- */
-
static VALUE
ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
{
@@ -227,25 +143,18 @@ ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * request.check_nonce(response) -> result
- *
- * Checks the nonce validity for this request and +response+.
- *
- * The return value is one of the following:
- *
- * -1 :: nonce in request only.
- * 0 :: nonces both present and not equal.
- * 1 :: nonces present and equal.
- * 2 :: nonces both absent.
- * 3 :: nonce present in response only.
+/* Check nonce validity in a request and response.
+ * Return value reflects result:
+ * 1: nonces present and equal.
+ * 2: nonces both absent.
+ * 3: nonce present in response only.
+ * 0: nonces both present and not equal.
+ * -1: nonce in request only.
*
- * For most responses, clients can check +result+ > 0. If a responder doesn't
- * handle nonces <code>result.nonzero?</code> may be necessary. A result of
- * <code>0</code> is always an error.
+ * For most responders clients can check return > 0.
+ * If responder doesn't handle nonces return != 0 may be
+ * necessary. return == 0 is always an error.
*/
-
static VALUE
ossl_ocspreq_check_nonce(VALUE self, VALUE basic_resp)
{
@@ -260,39 +169,20 @@ ossl_ocspreq_check_nonce(VALUE self, VALUE basic_resp)
return INT2NUM(res);
}
-/*
- * call-seq:
- * request.add_certid(certificate_id) -> request
- *
- * Adds +certificate_id+ to the request.
- */
-
static VALUE
ossl_ocspreq_add_certid(VALUE self, VALUE certid)
{
OCSP_REQUEST *req;
- OCSP_CERTID *id, *id_new;
+ OCSP_CERTID *id;
GetOCSPReq(self, req);
GetOCSPCertId(certid, id);
-
- if (!(id_new = OCSP_CERTID_dup(id)))
- ossl_raise(eOCSPError, "OCSP_CERTID_dup");
- if (!OCSP_request_add0_id(req, id_new)) {
- OCSP_CERTID_free(id_new);
- ossl_raise(eOCSPError, "OCSP_request_add0_id");
- }
+ if(!OCSP_request_add0_id(req, OCSP_CERTID_dup(id)))
+ ossl_raise(eOCSPError, NULL);
return self;
}
-/*
- * call-seq:
- * request.certid -> [certificate_id, ...]
- *
- * Returns all certificate IDs in this request.
- */
-
static VALUE
ossl_ocspreq_get_certid(VALUE self)
{
@@ -307,27 +197,15 @@ ossl_ocspreq_get_certid(VALUE self)
ary = (count > 0) ? rb_ary_new() : Qnil;
for(i = 0; i < count; i++){
one = OCSP_request_onereq_get0(req, i);
- tmp = NewOCSPCertId(cOCSPCertId);
if(!(id = OCSP_CERTID_dup(OCSP_onereq_get0_id(one))))
ossl_raise(eOCSPError, NULL);
- SetOCSPCertId(tmp, id);
+ WrapOCSPCertId(cOCSPCertId, tmp, id);
rb_ary_push(ary, tmp);
}
return ary;
}
-/*
- * call-seq:
- * request.sign(signer_cert, signer_key) -> self
- * request.sign(signer_cert, signer_key, certificates) -> self
- * request.sign(signer_cert, signer_key, certificates, flags) -> self
- *
- * Signs this OCSP request using +signer_cert+ and +signer_key+.
- * +certificates+ is an optional Array of certificates that may be included in
- * the request.
- */
-
static VALUE
ossl_ocspreq_sign(int argc, VALUE *argv, VALUE self)
{
@@ -356,14 +234,6 @@ ossl_ocspreq_sign(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * request.verify(certificates, store) -> true or false
- * request.verify(certificates, store, flags) -> true or false
- *
- * Verifies this request using the given +certificates+ and X509 +store+.
- */
-
static VALUE
ossl_ocspreq_verify(int argc, VALUE *argv, VALUE self)
{
@@ -385,10 +255,6 @@ ossl_ocspreq_verify(int argc, VALUE *argv, VALUE self)
return result ? Qtrue : Qfalse;
}
-/*
- * Returns this request as a DER-encoded string
- */
-
static VALUE
ossl_ocspreq_to_der(VALUE self)
{
@@ -412,13 +278,6 @@ ossl_ocspreq_to_der(VALUE self)
/*
* OCSP::Response
*/
-
-/* call-seq:
- * OpenSSL::OCSP::Response.create(status, basic_response = nil) -> response
- *
- * Creates an OpenSSL::OCSP::Response from +status+ and +basic_response+.
- */
-
static VALUE
ossl_ocspres_s_create(VALUE klass, VALUE status, VALUE basic_resp)
{
@@ -429,10 +288,9 @@ ossl_ocspres_s_create(VALUE klass, VALUE status, VALUE basic_resp)
if(NIL_P(basic_resp)) bs = NULL;
else GetOCSPBasicRes(basic_resp, bs); /* NO NEED TO DUP */
- obj = NewOCSPRes(klass);
if(!(res = OCSP_response_create(st, bs)))
ossl_raise(eOCSPError, NULL);
- SetOCSPRes(obj, res);
+ WrapOCSPRes(klass, obj, res);
return obj;
}
@@ -443,23 +301,13 @@ ossl_ocspres_alloc(VALUE klass)
OCSP_RESPONSE *res;
VALUE obj;
- obj = NewOCSPRes(klass);
if(!(res = OCSP_RESPONSE_new()))
ossl_raise(eOCSPError, NULL);
- SetOCSPRes(obj, res);
+ WrapOCSPRes(klass, obj, res);
return obj;
}
-/*
- * call-seq:
- * OpenSSL::OCSP::Response.new -> response
- * OpenSSL::OCSP::Response.new(response_der) -> response
- *
- * Creates a new OpenSSL::OCSP::Response. The response may be created empty or
- * from a +response_der+ string.
- */
-
static VALUE
ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -482,13 +330,6 @@ ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * response.status -> Integer
- *
- * Returns the status of the response.
- */
-
static VALUE
ossl_ocspres_status(VALUE self)
{
@@ -501,13 +342,6 @@ ossl_ocspres_status(VALUE self)
return INT2NUM(st);
}
-/*
- * call-seq:
- * response.status_string -> String
- *
- * Returns a status string for the response.
- */
-
static VALUE
ossl_ocspres_status_string(VALUE self)
{
@@ -520,13 +354,6 @@ ossl_ocspres_status_string(VALUE self)
return rb_str_new2(OCSP_response_status_str(st));
}
-/*
- * call-seq:
- * response.basic
- *
- * Returns a BasicResponse for this response
- */
-
static VALUE
ossl_ocspres_get_basic(VALUE self)
{
@@ -535,21 +362,13 @@ ossl_ocspres_get_basic(VALUE self)
VALUE ret;
GetOCSPRes(self, res);
- ret = NewOCSPBasicRes(cOCSPBasicRes);
if(!(bs = OCSP_response_get1_basic(res)))
return Qnil;
- SetOCSPBasicRes(ret, bs);
+ WrapOCSPBasicRes(cOCSPBasicRes, ret, bs);
return ret;
}
-/*
- * call-seq:
- * response.to_der -> String
- *
- * Returns this response as a DER-encoded string.
- */
-
static VALUE
ossl_ocspres_to_der(VALUE self)
{
@@ -579,35 +398,19 @@ ossl_ocspbres_alloc(VALUE klass)
OCSP_BASICRESP *bs;
VALUE obj;
- obj = NewOCSPBasicRes(klass);
if(!(bs = OCSP_BASICRESP_new()))
ossl_raise(eOCSPError, NULL);
- SetOCSPBasicRes(obj, bs);
+ WrapOCSPBasicRes(klass, obj, bs);
return obj;
}
-/*
- * call-seq:
- * OpenSSL::OCSP::BasicResponse.new(*) -> basic_response
- *
- * Creates a new BasicResponse and ignores all arguments.
- */
-
static VALUE
ossl_ocspbres_initialize(int argc, VALUE *argv, VALUE self)
{
return self;
}
-/*
- * call-seq:
- * basic_response.copy_nonce(request) -> Integer
- *
- * Copies the nonce from +request+ into this response. Returns 1 on success
- * and 0 on failure.
- */
-
static VALUE
ossl_ocspbres_copy_nonce(VALUE self, VALUE request)
{
@@ -622,14 +425,6 @@ ossl_ocspbres_copy_nonce(VALUE self, VALUE request)
return INT2NUM(ret);
}
-/*
- * call-seq:
- * basic_response.add_nonce(nonce = nil)
- *
- * Adds +nonce+ to this response. If no nonce was provided a random nonce
- * will be added.
- */
-
static VALUE
ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
{
@@ -652,22 +447,6 @@ ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * basic_response.add_status(certificate_id, status, reason, revocation_time, this_update, next_update, extensions) -> basic_response
- *
- * Adds a validation +status+ (0 for good, 1 for revoked, 2 for unknown) to this
- * response for +certificate_id+. +reason+ describes the reason for the
- * revocation, if any.
- *
- * The +revocation_time+, +this_update+ and +next_update+ are times for the
- * certificate's revocation time, the time of this status and the next update
- * time for a new status, respectively.
- *
- * +extensions+ may be an Array of OpenSSL::X509::Extension that will
- * be added to this response or nil.
- */
-
static VALUE
ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
VALUE reason, VALUE revtime,
@@ -676,9 +455,9 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
OCSP_BASICRESP *bs;
OCSP_SINGLERESP *single;
OCSP_CERTID *id;
+ int st, rsn;
ASN1_TIME *ths, *nxt, *rev;
- int st, rsn, error, rstatus = 0;
- long i;
+ int error, i, rstatus = 0;
VALUE tmp;
st = NUM2INT(status);
@@ -687,7 +466,7 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
/* All ary's members should be X509Extension */
Check_Type(ext, T_ARRAY);
for (i = 0; i < RARRAY_LEN(ext); i++)
- OSSL_Check_Kind(RARRAY_AREF(ext, i), cX509Ext);
+ OSSL_Check_Kind(RARRAY_PTR(ext)[i], cX509Ext);
}
error = 0;
@@ -716,7 +495,7 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
sk_X509_EXTENSION_pop_free(single->singleExtensions, X509_EXTENSION_free);
single->singleExtensions = NULL;
for(i = 0; i < RARRAY_LEN(ext); i++){
- x509ext = DupX509ExtPtr(RARRAY_AREF(ext, i));
+ x509ext = DupX509ExtPtr(RARRAY_PTR(ext)[i]);
if(!OCSP_SINGLERESP_add_ext(single, x509ext, -1)){
X509_EXTENSION_free(x509ext);
error = 1;
@@ -736,16 +515,6 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
return self;
}
-/*
- * call-seq:
- * basic_response.status -> statuses
- *
- * Returns an Array of statuses for this response. Each status contains a
- * CertificateId, the status (0 for good, 1 for revoked, 2 for unknown), the reason for
- * the status, the revocation time, the time of this update, the time for the
- * next update and a list of OpenSSL::X509::Extensions.
- */
-
static VALUE
ossl_ocspbres_get_status(VALUE self)
{
@@ -791,16 +560,6 @@ ossl_ocspbres_get_status(VALUE self)
return ret;
}
-/*
- * call-seq:
- * basic_response.sign(signer_cert, signer_key) -> self
- * basic_response.sign(signer_cert, signer_key, certificates) -> self
- * basic_response.sign(signer_cert, signer_key, certificates, flags) -> self
- *
- * Signs this response using the +signer_cert+ and +signer_key+. Additional
- * +certificates+ may be added to the signature along with a set of +flags+.
- */
-
static VALUE
ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)
{
@@ -831,14 +590,6 @@ ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * basic_response.verify(certificates, store) -> true or false
- * basic_response.verify(certificates, store, flags) -> true or false
- *
- * Verifies the signature of the response using the given +certificates+,
- * +store+ and +flags+.
- */
static VALUE
ossl_ocspbres_verify(int argc, VALUE *argv, VALUE self)
{
@@ -869,23 +620,13 @@ ossl_ocspcid_alloc(VALUE klass)
OCSP_CERTID *id;
VALUE obj;
- obj = NewOCSPCertId(klass);
if(!(id = OCSP_CERTID_new()))
ossl_raise(eOCSPError, NULL);
- SetOCSPCertId(obj, id);
+ WrapOCSPCertId(klass, obj, id);
return obj;
}
-/*
- * call-seq:
- * OpenSSL::OCSP::CertificateId.new(subject, issuer, digest = nil) -> certificate_id
- *
- * Creates a new OpenSSL::OCSP::CertificateId for the given +subject+ and
- * +issuer+ X509 certificates. The +digest+ is used to compute the
- * certificate ID and must be an OpenSSL::Digest instance.
- */
-
static VALUE
ossl_ocspcid_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -916,13 +657,6 @@ ossl_ocspcid_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-/*
- * call-seq:
- * certificate_id.cmp(other) -> true or false
- *
- * Compares this certificate id with +other+ and returns true if they are the
- * same.
- */
static VALUE
ossl_ocspcid_cmp(VALUE self, VALUE other)
{
@@ -936,14 +670,6 @@ ossl_ocspcid_cmp(VALUE self, VALUE other)
return (result == 0) ? Qtrue : Qfalse;
}
-/*
- * call-seq:
- * certificate_id.cmp_issuer(other) -> true or false
- *
- * Compares this certificate id's issuer with +other+ and returns true if
- * they are the same.
- */
-
static VALUE
ossl_ocspcid_cmp_issuer(VALUE self, VALUE other)
{
@@ -957,13 +683,6 @@ ossl_ocspcid_cmp_issuer(VALUE self, VALUE other)
return (result == 0) ? Qtrue : Qfalse;
}
-/*
- * call-seq:
- * certificate_id.get_serial -> Integer
- *
- * Returns the serial number of the issuing certificate.
- */
-
static VALUE
ossl_ocspcid_get_serial(VALUE self)
{
@@ -975,132 +694,12 @@ ossl_ocspcid_get_serial(VALUE self)
}
void
-Init_ossl_ocsp(void)
+Init_ossl_ocsp()
{
- /*
- * OpenSSL::OCSP implements Online Certificate Status Protocol requests
- * and responses.
- *
- * Creating and sending an OCSP request requires a subject certificate
- * that contains an OCSP URL in an authorityInfoAccess extension and the
- * issuer certificate for the subject certificate. First, load the issuer
- * and subject certificates:
- *
- * subject = OpenSSL::X509::Certificate.new subject_pem
- * issuer = OpenSSL::X509::Certificate.new issuer_pem
- *
- * To create the request we need to create a certificate ID for the
- * subject certificate so the CA knows which certificate we are asking
- * about:
- *
- * digest = OpenSSL::Digest::SHA1.new
- * certificate_id =
- * OpenSSL::OCSP::CertificateId.new subject, issuer, digest
- *
- * Then create a request and add the certificate ID to it:
- *
- * request = OpenSSL::OCSP::Request.new
- * request.add_certid certificate_id
- *
- * Adding a nonce to the request protects against replay attacks but not
- * all CA process the nonce.
- *
- * request.add_nonce
- *
- * To submit the request to the CA for verification we need to extract the
- * OCSP URI from the subject certificate:
- *
- * authority_info_access = subject.extensions.find do |extension|
- * extension.oid == 'authorityInfoAccess'
- * end
- *
- * descriptions = authority_info_access.value.split "\n"
- * ocsp = descriptions.find do |description|
- * description.start_with? 'OCSP'
- * end
- *
- * require 'uri'
- *
- * ocsp_uri = URI ocsp[/URI:(.*)/, 1]
- *
- * To submit the request we'll POST the request to the OCSP URI (per RFC
- * 2560). Note that we only handle HTTP requests and don't handle any
- * redirects in this example, so this is insufficient for serious use.
- *
- * require 'net/http'
- *
- * http_response =
- * Net::HTTP.start ocsp_uri.hostname, ocsp.port do |http|
- * http.post ocsp_uri.path, request.to_der,
- * 'content-type' => 'application/ocsp-request'
- * end
- *
- * response = OpenSSL::OCSP::Response.new http_response.body
- * response_basic = response.basic
- *
- * First we check if the response has a valid signature. Without a valid
- * signature we cannot trust it. If you get a failure here you may be
- * missing a system certificate store or may be missing the intermediate
- * certificates.
- *
- * store = OpenSSL::X509::Store.new
- * store.set_default_paths
- *
- * unless response.verify [], store then
- * raise 'response is not signed by a trusted certificate'
- * end
- *
- * The response contains the status information (success/fail). We can
- * display the status as a string:
- *
- * puts response.status_string #=> successful
- *
- * Next we need to know the response details to determine if the response
- * matches our request. First we check the nonce. Again, not all CAs
- * support a nonce. See Request#check_nonce for the meanings of the
- * return values.
- *
- * p request.check_nonce basic_response #=> value from -1 to 3
- *
- * Then extract the status information from the basic response. (You can
- * check multiple certificates in a request, but for this example we only
- * submitted one.)
- *
- * response_certificate_id, status, reason, revocation_time,
- * this_update, next_update, extensions = basic_response.status
- *
- * Then check the various fields.
- *
- * unless response_certificate_id == certificate_id then
- * raise 'certificate id mismatch'
- * end
- *
- * now = Time.now
- *
- * if this_update > now then
- * raise 'update date is in the future'
- * end
- *
- * if now > next_update then
- * raise 'next update time has passed'
- * end
- */
-
mOCSP = rb_define_module_under(mOSSL, "OCSP");
- /*
- * OCSP error class.
- */
-
eOCSPError = rb_define_class_under(mOCSP, "OCSPError", eOSSLError);
- /*
- * An OpenSSL::OCSP::Request contains the certificate information for
- * determining if a certificate has been revoked or not. A Request can be
- * created for a certificate or from a DER-encoded request created
- * elsewhere.
- */
-
cOCSPReq = rb_define_class_under(mOCSP, "Request", rb_cObject);
rb_define_alloc_func(cOCSPReq, ossl_ocspreq_alloc);
rb_define_method(cOCSPReq, "initialize", ossl_ocspreq_initialize, -1);
@@ -1112,11 +711,6 @@ Init_ossl_ocsp(void)
rb_define_method(cOCSPReq, "verify", ossl_ocspreq_verify, -1);
rb_define_method(cOCSPReq, "to_der", ossl_ocspreq_to_der, 0);
- /*
- * An OpenSSL::OCSP::Response contains the status of a certificate check
- * which is created from an OpenSSL::OCSP::Request.
- */
-
cOCSPRes = rb_define_class_under(mOCSP, "Response", rb_cObject);
rb_define_singleton_method(cOCSPRes, "create", ossl_ocspres_s_create, 2);
rb_define_alloc_func(cOCSPRes, ossl_ocspres_alloc);
@@ -1126,12 +720,6 @@ Init_ossl_ocsp(void)
rb_define_method(cOCSPRes, "basic", ossl_ocspres_get_basic, 0);
rb_define_method(cOCSPRes, "to_der", ossl_ocspres_to_der, 0);
- /*
- * An OpenSSL::OCSP::BasicResponse contains the status of a certificate
- * check which is created from an OpenSSL::OCSP::Request. A
- * BasicResponse is more detailed than a Response.
- */
-
cOCSPBasicRes = rb_define_class_under(mOCSP, "BasicResponse", rb_cObject);
rb_define_alloc_func(cOCSPBasicRes, ossl_ocspbres_alloc);
rb_define_method(cOCSPBasicRes, "initialize", ossl_ocspbres_initialize, -1);
@@ -1142,11 +730,6 @@ Init_ossl_ocsp(void)
rb_define_method(cOCSPBasicRes, "sign", ossl_ocspbres_sign, -1);
rb_define_method(cOCSPBasicRes, "verify", ossl_ocspbres_verify, -1);
- /*
- * An OpenSSL::OCSP::CertificateId identifies a certificate to the CA so
- * that a status check can be performed.
- */
-
cOCSPCertId = rb_define_class_under(mOCSP, "CertificateId", rb_cObject);
rb_define_alloc_func(cOCSPCertId, ossl_ocspcid_alloc);
rb_define_method(cOCSPCertId, "initialize", ossl_ocspcid_initialize, -1);
@@ -1154,110 +737,50 @@ Init_ossl_ocsp(void)
rb_define_method(cOCSPCertId, "cmp_issuer", ossl_ocspcid_cmp_issuer, 1);
rb_define_method(cOCSPCertId, "serial", ossl_ocspcid_get_serial, 0);
- /* Internal error in issuer */
- rb_define_const(mOCSP, "RESPONSE_STATUS_INTERNALERROR", INT2NUM(OCSP_RESPONSE_STATUS_INTERNALERROR));
-
- /* Illegal confirmation request */
- rb_define_const(mOCSP, "RESPONSE_STATUS_MALFORMEDREQUEST", INT2NUM(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST));
-
- /* The certificate was revoked for an unknown reason */
- rb_define_const(mOCSP, "REVOKED_STATUS_NOSTATUS", INT2NUM(OCSP_REVOKED_STATUS_NOSTATUS));
-
- /* You must sign the request and resubmit */
- rb_define_const(mOCSP, "RESPONSE_STATUS_SIGREQUIRED", INT2NUM(OCSP_RESPONSE_STATUS_SIGREQUIRED));
-
- /* Response has valid confirmations */
- rb_define_const(mOCSP, "RESPONSE_STATUS_SUCCESSFUL", INT2NUM(OCSP_RESPONSE_STATUS_SUCCESSFUL));
-
- /* Try again later */
- rb_define_const(mOCSP, "RESPONSE_STATUS_TRYLATER", INT2NUM(OCSP_RESPONSE_STATUS_TRYLATER));
-
- /* The certificate subject's name or other information changed */
- rb_define_const(mOCSP, "REVOKED_STATUS_AFFILIATIONCHANGED", INT2NUM(OCSP_REVOKED_STATUS_AFFILIATIONCHANGED));
-
- /* This CA certificate was revoked due to a key compromise */
- rb_define_const(mOCSP, "REVOKED_STATUS_CACOMPROMISE", INT2NUM(OCSP_REVOKED_STATUS_CACOMPROMISE));
-
- /* The certificate is on hold */
- rb_define_const(mOCSP, "REVOKED_STATUS_CERTIFICATEHOLD", INT2NUM(OCSP_REVOKED_STATUS_CERTIFICATEHOLD));
-
- /* The certificate is no longer needed */
- rb_define_const(mOCSP, "REVOKED_STATUS_CESSATIONOFOPERATION", INT2NUM(OCSP_REVOKED_STATUS_CESSATIONOFOPERATION));
-
- /* The certificate was revoked due to a key compromise */
- rb_define_const(mOCSP, "REVOKED_STATUS_KEYCOMPROMISE", INT2NUM(OCSP_REVOKED_STATUS_KEYCOMPROMISE));
-
- /* The certificate was previously on hold and should now be removed from
- * the CRL */
- rb_define_const(mOCSP, "REVOKED_STATUS_REMOVEFROMCRL", INT2NUM(OCSP_REVOKED_STATUS_REMOVEFROMCRL));
-
- /* The certificate was superseded by a new certificate */
- rb_define_const(mOCSP, "REVOKED_STATUS_SUPERSEDED", INT2NUM(OCSP_REVOKED_STATUS_SUPERSEDED));
-
- /* Your request is unauthorized. */
- rb_define_const(mOCSP, "RESPONSE_STATUS_UNAUTHORIZED", INT2NUM(OCSP_RESPONSE_STATUS_UNAUTHORIZED));
-
- /* The certificate was revoked for an unspecified reason */
- rb_define_const(mOCSP, "REVOKED_STATUS_UNSPECIFIED", INT2NUM(OCSP_REVOKED_STATUS_UNSPECIFIED));
-
- /* Do not include certificates in the response */
- rb_define_const(mOCSP, "NOCERTS", INT2NUM(OCSP_NOCERTS));
-
- /* Do not search certificates contained in the response for a signer */
- rb_define_const(mOCSP, "NOINTERN", INT2NUM(OCSP_NOINTERN));
-
- /* Do not check the signature on the response */
- rb_define_const(mOCSP, "NOSIGS", INT2NUM(OCSP_NOSIGS));
-
- /* Do not verify the certificate chain on the response */
- rb_define_const(mOCSP, "NOCHAIN", INT2NUM(OCSP_NOCHAIN));
-
- /* Do not verify the response at all */
- rb_define_const(mOCSP, "NOVERIFY", INT2NUM(OCSP_NOVERIFY));
-
- /* Do not check trust */
- rb_define_const(mOCSP, "NOEXPLICIT", INT2NUM(OCSP_NOEXPLICIT));
-
- /* (This flag is not used by OpenSSL 1.0.1g) */
- rb_define_const(mOCSP, "NOCASIGN", INT2NUM(OCSP_NOCASIGN));
-
- /* (This flag is not used by OpenSSL 1.0.1g) */
- rb_define_const(mOCSP, "NODELEGATED", INT2NUM(OCSP_NODELEGATED));
-
- /* Do not make additional signing certificate checks */
- rb_define_const(mOCSP, "NOCHECKS", INT2NUM(OCSP_NOCHECKS));
-
- /* Do not verify additional certificates */
- rb_define_const(mOCSP, "TRUSTOTHER", INT2NUM(OCSP_TRUSTOTHER));
-
- /* Identify the response by signing the certificate key ID */
- rb_define_const(mOCSP, "RESPID_KEY", INT2NUM(OCSP_RESPID_KEY));
-
- /* Do not include producedAt time in response */
- rb_define_const(mOCSP, "NOTIME", INT2NUM(OCSP_NOTIME));
-
- /* Indicates the certificate is not revoked but does not necessarily mean
- * the certificate was issued or that this response is within the
- * certificate's validity interval */
- rb_define_const(mOCSP, "V_CERTSTATUS_GOOD", INT2NUM(V_OCSP_CERTSTATUS_GOOD));
- /* Indicates the certificate has been revoked either permanently or
- * temporarily (on hold). */
- rb_define_const(mOCSP, "V_CERTSTATUS_REVOKED", INT2NUM(V_OCSP_CERTSTATUS_REVOKED));
-
- /* Indicates the responder does not know about the certificate being
- * requested. */
- rb_define_const(mOCSP, "V_CERTSTATUS_UNKNOWN", INT2NUM(V_OCSP_CERTSTATUS_UNKNOWN));
-
- /* The responder ID is based on the key name. */
- rb_define_const(mOCSP, "V_RESPID_NAME", INT2NUM(V_OCSP_RESPID_NAME));
-
- /* The responder ID is based on the public key. */
- rb_define_const(mOCSP, "V_RESPID_KEY", INT2NUM(V_OCSP_RESPID_KEY));
+#define DefOCSPConst(x) rb_define_const(mOCSP, #x, INT2NUM(OCSP_##x))
+
+ DefOCSPConst(RESPONSE_STATUS_SUCCESSFUL);
+ DefOCSPConst(RESPONSE_STATUS_MALFORMEDREQUEST);
+ DefOCSPConst(RESPONSE_STATUS_INTERNALERROR);
+ DefOCSPConst(RESPONSE_STATUS_TRYLATER);
+ DefOCSPConst(RESPONSE_STATUS_SIGREQUIRED);
+ DefOCSPConst(RESPONSE_STATUS_UNAUTHORIZED);
+
+ DefOCSPConst(REVOKED_STATUS_NOSTATUS);
+ DefOCSPConst(REVOKED_STATUS_UNSPECIFIED);
+ DefOCSPConst(REVOKED_STATUS_KEYCOMPROMISE);
+ DefOCSPConst(REVOKED_STATUS_CACOMPROMISE);
+ DefOCSPConst(REVOKED_STATUS_AFFILIATIONCHANGED);
+ DefOCSPConst(REVOKED_STATUS_SUPERSEDED);
+ DefOCSPConst(REVOKED_STATUS_CESSATIONOFOPERATION);
+ DefOCSPConst(REVOKED_STATUS_CERTIFICATEHOLD);
+ DefOCSPConst(REVOKED_STATUS_REMOVEFROMCRL);
+
+ DefOCSPConst(NOCERTS);
+ DefOCSPConst(NOINTERN);
+ DefOCSPConst(NOSIGS);
+ DefOCSPConst(NOCHAIN);
+ DefOCSPConst(NOVERIFY);
+ DefOCSPConst(NOEXPLICIT);
+ DefOCSPConst(NOCASIGN);
+ DefOCSPConst(NODELEGATED);
+ DefOCSPConst(NOCHECKS);
+ DefOCSPConst(TRUSTOTHER);
+ DefOCSPConst(RESPID_KEY);
+ DefOCSPConst(NOTIME);
+
+#define DefOCSPVConst(x) rb_define_const(mOCSP, "V_" #x, INT2NUM(V_OCSP_##x))
+
+ DefOCSPVConst(CERTSTATUS_GOOD);
+ DefOCSPVConst(CERTSTATUS_REVOKED);
+ DefOCSPVConst(CERTSTATUS_UNKNOWN);
+ DefOCSPVConst(RESPID_NAME);
+ DefOCSPVConst(RESPID_KEY);
}
#else /* ! OSSL_OCSP_ENABLED */
void
-Init_ossl_ocsp(void)
+Init_ossl_ocsp()
{
}
#endif
diff --git a/ext/openssl/ossl_ocsp.h b/ext/openssl/ossl_ocsp.h
index c5064fbc85..65b4f2e23f 100644
--- a/ext/openssl/ossl_ocsp.h
+++ b/ext/openssl/ossl_ocsp.h
@@ -1,11 +1,12 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_OCSP_H_)
diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c
index 2a42ee973b..8a5f816082 100644
--- a/ext/openssl/ossl_pkcs12.c
+++ b/ext/openssl/ossl_pkcs12.c
@@ -1,19 +1,17 @@
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
+ * $Id$
*/
#include "ossl.h"
-#define NewPKCS12(klass) \
- TypedData_Wrap_Struct((klass), &ossl_pkcs12_type, 0)
-
-#define SetPKCS12(obj, p12) do { \
+#define WrapPKCS12(klass, obj, p12) do { \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
- RTYPEDDATA_DATA(obj) = (p12); \
+ (obj) = Data_Wrap_Struct((klass), 0, PKCS12_free, (p12)); \
} while (0)
#define GetPKCS12(obj, p12) do { \
- TypedData_Get_Struct((obj), PKCS12, &ossl_pkcs12_type, (p12)); \
+ Data_Get_Struct((obj), PKCS12, (p12)); \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
} while (0)
@@ -38,29 +36,14 @@ VALUE ePKCS12Error;
/*
* Private
*/
-static void
-ossl_pkcs12_free(void *ptr)
-{
- PKCS12_free(ptr);
-}
-
-static const rb_data_type_t ossl_pkcs12_type = {
- "OpenSSL/PKCS12",
- {
- 0, ossl_pkcs12_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
ossl_pkcs12_s_allocate(VALUE klass)
{
PKCS12 *p12;
VALUE obj;
- obj = NewPKCS12(klass);
if(!(p12 = PKCS12_new())) ossl_raise(ePKCS12Error, NULL);
- SetPKCS12(obj, p12);
+ WrapPKCS12(klass, obj, p12);
return obj;
}
@@ -104,6 +87,7 @@ ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
friendlyname = NIL_P(name) ? NULL : StringValuePtr(name);
key = GetPKeyPtr(pkey);
x509 = GetX509CertPtr(cert);
+ x509s = NIL_P(ca) ? NULL : ossl_x509_ary2sk(ca);
/* TODO: make a VALUE to nid function */
if (!NIL_P(key_nid)) {
if ((nkey = OBJ_txt2nid(StringValuePtr(key_nid))) == NID_undef)
@@ -120,13 +104,11 @@ ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
if (!NIL_P(keytype))
ktype = NUM2INT(keytype);
- obj = NewPKCS12(cPKCS12);
- x509s = NIL_P(ca) ? NULL : ossl_x509_ary2sk(ca);
p12 = PKCS12_create(passphrase, friendlyname, key, x509, x509s,
nkey, ncert, kiter, miter, ktype);
sk_X509_pop_free(x509s, X509_free);
if(!p12) ossl_raise(ePKCS12Error, NULL);
- SetPKCS12(obj, p12);
+ WrapPKCS12(cPKCS12, obj, p12);
ossl_pkcs12_set_key(obj, pkey);
ossl_pkcs12_set_cert(obj, cert);
@@ -165,12 +147,8 @@ ossl_pkcs12_initialize(int argc, VALUE *argv, VALUE self)
BIO_free(in);
pkey = cert = ca = Qnil;
- /* OpenSSL's bug; PKCS12_parse() puts errors even if it succeeds.
- * Fixed in OpenSSL 1.0.0t, 1.0.1p, 1.0.2d */
- ERR_set_mark();
if(!PKCS12_parse(pkcs, passphrase, &key, &x509, &x509s))
ossl_raise(ePKCS12Error, "PKCS12_parse");
- ERR_pop_to_mark();
pkey = rb_protect((VALUE(*)_((VALUE)))ossl_pkey_new, (VALUE)key,
&st); /* NO DUP */
if(st) goto err;
@@ -214,7 +192,7 @@ ossl_pkcs12_to_der(VALUE self)
}
void
-Init_ossl_pkcs12(void)
+Init_ossl_pkcs12()
{
/*
* Defines a file format commonly used to store private keys with
diff --git a/ext/openssl/ossl_pkcs12.h b/ext/openssl/ossl_pkcs12.h
index fe4f15ef60..24d25d00bb 100644
--- a/ext/openssl/ossl_pkcs12.h
+++ b/ext/openssl/ossl_pkcs12.h
@@ -1,6 +1,7 @@
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
+ * $Id$
*/
#if !defined(_OSSL_PKCS12_H_)
#define _OSSL_PKCS12_H_
@@ -11,3 +12,4 @@ extern VALUE ePKCS12Error;
void Init_ossl_pkcs12(void);
#endif /* _OSSL_PKCS12_H_ */
+
diff --git a/ext/openssl/ossl_pkcs5.c b/ext/openssl/ossl_pkcs5.c
index 73d989e164..3b615e4828 100644
--- a/ext/openssl/ossl_pkcs5.c
+++ b/ext/openssl/ossl_pkcs5.c
@@ -1,4 +1,5 @@
/*
+ * $Id$
* Copyright (C) 2007 Technorama Ltd. <oss-ruby@technorama.net>
*/
#include "ossl.h"
@@ -86,7 +87,7 @@ ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALU
#endif
void
-Init_ossl_pkcs5(void)
+Init_ossl_pkcs5()
{
/*
* Password-based Encryption
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index 04e41db598..b710280c9c 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewPKCS7(klass) \
- TypedData_Wrap_Struct((klass), &ossl_pkcs7_type, 0)
-#define SetPKCS7(obj, pkcs7) do { \
+#define WrapPKCS7(klass, obj, pkcs7) do { \
if (!(pkcs7)) { \
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
} \
- RTYPEDDATA_DATA(obj) = (pkcs7); \
+ (obj) = Data_Wrap_Struct((klass), 0, PKCS7_free, (pkcs7)); \
} while (0)
#define GetPKCS7(obj, pkcs7) do { \
- TypedData_Get_Struct((obj), PKCS7, &ossl_pkcs7_type, (pkcs7)); \
+ Data_Get_Struct((obj), PKCS7, (pkcs7)); \
if (!(pkcs7)) { \
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
} \
@@ -28,16 +27,14 @@
GetPKCS7((obj), (pkcs7)); \
} while (0)
-#define NewPKCS7si(klass) \
- TypedData_Wrap_Struct((klass), &ossl_pkcs7_signer_info_type, 0)
-#define SetPKCS7si(obj, p7si) do { \
+#define WrapPKCS7si(klass, obj, p7si) do { \
if (!(p7si)) { \
ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \
} \
- RTYPEDDATA_DATA(obj) = (p7si); \
+ (obj) = Data_Wrap_Struct((klass), 0, PKCS7_SIGNER_INFO_free, (p7si)); \
} while (0)
#define GetPKCS7si(obj, p7si) do { \
- TypedData_Get_Struct((obj), PKCS7_SIGNER_INFO, &ossl_pkcs7_signer_info_type, (p7si)); \
+ Data_Get_Struct((obj), PKCS7_SIGNER_INFO, (p7si)); \
if (!(p7si)) { \
ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \
} \
@@ -47,16 +44,14 @@
GetPKCS7si((obj), (p7si)); \
} while (0)
-#define NewPKCS7ri(klass) \
- TypedData_Wrap_Struct((klass), &ossl_pkcs7_recip_info_type, 0)
-#define SetPKCS7ri(obj, p7ri) do { \
+#define WrapPKCS7ri(klass, obj, p7ri) do { \
if (!(p7ri)) { \
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
} \
- RTYPEDDATA_DATA(obj) = (p7ri); \
+ (obj) = Data_Wrap_Struct((klass), 0, PKCS7_RECIP_INFO_free, (p7ri)); \
} while (0)
#define GetPKCS7ri(obj, p7ri) do { \
- TypedData_Get_Struct((obj), PKCS7_RECIP_INFO, &ossl_pkcs7_recip_info_type, (p7ri)); \
+ Data_Get_Struct((obj), PKCS7_RECIP_INFO, (p7ri)); \
if (!(p7ri)) { \
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
} \
@@ -81,48 +76,6 @@ VALUE cPKCS7Signer;
VALUE cPKCS7Recipient;
VALUE ePKCS7Error;
-static void
-ossl_pkcs7_free(void *ptr)
-{
- PKCS7_free(ptr);
-}
-
-static const rb_data_type_t ossl_pkcs7_type = {
- "OpenSSL/PKCS7",
- {
- 0, ossl_pkcs7_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
-static void
-ossl_pkcs7_signer_info_free(void *ptr)
-{
- PKCS7_SIGNER_INFO_free(ptr);
-}
-
-static const rb_data_type_t ossl_pkcs7_signer_info_type = {
- "OpenSSL/PKCS7/SIGNER_INFO",
- {
- 0, ossl_pkcs7_signer_info_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
-static void
-ossl_pkcs7_recip_info_free(void *ptr)
-{
- PKCS7_RECIP_INFO_free(ptr);
-}
-
-static const rb_data_type_t ossl_pkcs7_recip_info_type = {
- "OpenSSL/PKCS7/RECIP_INFO",
- {
- 0, ossl_pkcs7_recip_info_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
* (MADE PRIVATE UNTIL SOMEBODY WILL NEED THEM)
@@ -133,10 +86,9 @@ ossl_pkcs7si_new(PKCS7_SIGNER_INFO *p7si)
PKCS7_SIGNER_INFO *pkcs7;
VALUE obj;
- obj = NewPKCS7si(cPKCS7Signer);
pkcs7 = p7si ? PKCS7_SIGNER_INFO_dup(p7si) : PKCS7_SIGNER_INFO_new();
if (!pkcs7) ossl_raise(ePKCS7Error, NULL);
- SetPKCS7si(obj, pkcs7);
+ WrapPKCS7si(cPKCS7Signer, obj, pkcs7);
return obj;
}
@@ -160,10 +112,9 @@ ossl_pkcs7ri_new(PKCS7_RECIP_INFO *p7ri)
PKCS7_RECIP_INFO *pkcs7;
VALUE obj;
- obj = NewPKCS7ri(cPKCS7Recipient);
pkcs7 = p7ri ? PKCS7_RECIP_INFO_dup(p7ri) : PKCS7_RECIP_INFO_new();
if (!pkcs7) ossl_raise(ePKCS7Error, NULL);
- SetPKCS7ri(obj, pkcs7);
+ WrapPKCS7ri(cPKCS7Recipient, obj, pkcs7);
return obj;
}
@@ -192,14 +143,13 @@ ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg)
PKCS7 *pkcs7;
VALUE ret, data;
- ret = NewPKCS7(cPKCS7);
in = ossl_obj2bio(arg);
out = NULL;
pkcs7 = SMIME_read_PKCS7(in, &out);
BIO_free(in);
if(!pkcs7) ossl_raise(ePKCS7Error, NULL);
data = out ? ossl_membio2str(out) : Qnil;
- SetPKCS7(ret, pkcs7);
+ WrapPKCS7(cPKCS7, ret, pkcs7);
ossl_pkcs7_set_data(ret, data);
ossl_pkcs7_set_err_string(ret, Qnil);
@@ -261,7 +211,6 @@ ossl_pkcs7_s_sign(int argc, VALUE *argv, VALUE klass)
x509 = GetX509CertPtr(cert); /* NO NEED TO DUP */
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
flg = NIL_P(flags) ? 0 : NUM2INT(flags);
- ret = NewPKCS7(cPKCS7);
in = ossl_obj2bio(data);
if(NIL_P(certs)) x509s = NULL;
else{
@@ -276,7 +225,7 @@ ossl_pkcs7_s_sign(int argc, VALUE *argv, VALUE klass)
sk_X509_pop_free(x509s, X509_free);
ossl_raise(ePKCS7Error, NULL);
}
- SetPKCS7(ret, pkcs7);
+ WrapPKCS7(cPKCS7, ret, pkcs7);
ossl_pkcs7_set_data(ret, data);
ossl_pkcs7_set_err_string(ret, Qnil);
BIO_free(in);
@@ -317,7 +266,6 @@ ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
}
else ciph = GetCipherPtr(cipher); /* NO NEED TO DUP */
flg = NIL_P(flags) ? 0 : NUM2INT(flags);
- ret = NewPKCS7(cPKCS7);
in = ossl_obj2bio(data);
x509s = ossl_protect_x509_ary2sk(certs, &status);
if(status){
@@ -330,7 +278,7 @@ ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
ossl_raise(ePKCS7Error, NULL);
}
BIO_free(in);
- SetPKCS7(ret, p7);
+ WrapPKCS7(cPKCS7, ret, p7);
ossl_pkcs7_set_data(ret, data);
sk_X509_pop_free(x509s, X509_free);
@@ -343,11 +291,10 @@ ossl_pkcs7_alloc(VALUE klass)
PKCS7 *pkcs7;
VALUE obj;
- obj = NewPKCS7(klass);
if (!(pkcs7 = PKCS7_new())) {
ossl_raise(ePKCS7Error, NULL);
}
- SetPKCS7(obj, pkcs7);
+ WrapPKCS7(klass, obj, pkcs7);
return obj;
}
@@ -415,10 +362,9 @@ ossl_pkcs7_sym2typeid(VALUE sym)
{
int i, ret = Qnil;
const char *s;
- size_t l;
- static const struct {
- char name[20];
+ static struct {
+ const char *name;
int nid;
} p7_type_tab[] = {
{ "signed", NID_pkcs7_signed },
@@ -427,15 +373,14 @@ ossl_pkcs7_sym2typeid(VALUE sym)
{ "enveloped", NID_pkcs7_enveloped },
{ "encrypted", NID_pkcs7_encrypted },
{ "digest", NID_pkcs7_digest },
+ { NULL, 0 },
};
- if (RB_TYPE_P(sym, T_SYMBOL)) sym = rb_sym2str(sym);
- else StringValue(sym);
- RSTRING_GETMEM(sym, s, l);
- for(i = 0; ; i++){
- if(i == numberof(p7_type_tab))
+ if(TYPE(sym) == T_SYMBOL) s = rb_id2name(SYM2ID(sym));
+ else s = StringValuePtr(sym);
+ for(i = 0; i < numberof(p7_type_tab); i++){
+ if(p7_type_tab[i].name == NULL)
ossl_raise(ePKCS7Error, "unknown type \"%s\"", s);
- if(strlen(p7_type_tab[i].name) != l) continue;
if(strcmp(p7_type_tab[i].name, s) == 0){
ret = p7_type_tab[i].nid;
break;
@@ -679,7 +624,7 @@ pkcs7_get_crls(VALUE self)
}
static VALUE
-ossl_pkcs7_set_certs_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+ossl_pkcs7_set_certs_i(VALUE i, VALUE arg)
{
return ossl_pkcs7_add_certificate(arg, i);
}
@@ -719,7 +664,7 @@ ossl_pkcs7_add_crl(VALUE self, VALUE crl)
}
static VALUE
-ossl_pkcs7_set_crls_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+ossl_pkcs7_set_crls_i(VALUE i, VALUE arg)
{
return ossl_pkcs7_add_crl(arg, i);
}
@@ -755,9 +700,7 @@ ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
VALUE data;
const char *msg;
- GetPKCS7(self, p7);
rb_scan_args(argc, argv, "22", &certs, &store, &indata, &flags);
- x509st = GetX509StorePtr(store);
flg = NIL_P(flags) ? 0 : NUM2INT(flags);
if(NIL_P(indata)) indata = ossl_pkcs7_get_data(self);
in = NIL_P(indata) ? NULL : ossl_obj2bio(indata);
@@ -769,6 +712,8 @@ ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
rb_jump_tag(status);
}
}
+ x509st = GetX509StorePtr(store);
+ GetPKCS7(self, p7);
if(!(out = BIO_new(BIO_s_mem()))){
BIO_free(in);
sk_X509_pop_free(x509s, X509_free);
@@ -776,13 +721,13 @@ ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
}
ok = PKCS7_verify(p7, x509s, x509st, in, out, flg);
BIO_free(in);
- sk_X509_pop_free(x509s, X509_free);
- if (ok < 0) ossl_raise(ePKCS7Error, "PKCS7_verify");
+ if (ok < 0) ossl_raise(ePKCS7Error, NULL);
msg = ERR_reason_error_string(ERR_get_error());
ossl_pkcs7_set_err_string(self, msg ? rb_str_new2(msg) : Qnil);
ERR_clear_error();
data = ossl_membio2str(out);
ossl_pkcs7_set_data(self, data);
+ sk_X509_pop_free(x509s, X509_free);
return (ok == 1) ? Qtrue : Qfalse;
}
@@ -822,12 +767,12 @@ ossl_pkcs7_add_data(VALUE self, VALUE data)
char buf[4096];
int len;
+ in = ossl_obj2bio(data);
GetPKCS7(self, pkcs7);
if(PKCS7_type_is_signed(pkcs7)){
if(!PKCS7_content_new(pkcs7, NID_pkcs7_data))
ossl_raise(ePKCS7Error, NULL);
}
- in = ossl_obj2bio(data);
if(!(out = PKCS7_dataInit(pkcs7, NULL))) goto err;
for(;;){
if((len = BIO_read(in, buf, sizeof(buf))) <= 0)
@@ -839,7 +784,7 @@ ossl_pkcs7_add_data(VALUE self, VALUE data)
ossl_pkcs7_set_data(self, Qnil);
err:
- BIO_free_all(out);
+ BIO_free(out);
BIO_free(in);
if(ERR_peek_error()){
ossl_raise(ePKCS7Error, NULL);
@@ -897,11 +842,10 @@ ossl_pkcs7si_alloc(VALUE klass)
PKCS7_SIGNER_INFO *p7si;
VALUE obj;
- obj = NewPKCS7si(klass);
if (!(p7si = PKCS7_SIGNER_INFO_new())) {
ossl_raise(ePKCS7Error, NULL);
}
- SetPKCS7si(obj, p7si);
+ WrapPKCS7si(klass, obj, p7si);
return obj;
}
@@ -977,11 +921,10 @@ ossl_pkcs7ri_alloc(VALUE klass)
PKCS7_RECIP_INFO *p7ri;
VALUE obj;
- obj = NewPKCS7ri(klass);
if (!(p7ri = PKCS7_RECIP_INFO_new())) {
ossl_raise(ePKCS7Error, NULL);
}
- SetPKCS7ri(obj, p7ri);
+ WrapPKCS7ri(klass, obj, p7ri);
return obj;
}
@@ -1035,7 +978,7 @@ ossl_pkcs7ri_get_enc_key(VALUE self)
* INIT
*/
void
-Init_ossl_pkcs7(void)
+Init_ossl_pkcs7()
{
cPKCS7 = rb_define_class_under(mOSSL, "PKCS7", rb_cObject);
ePKCS7Error = rb_define_class_under(cPKCS7, "PKCS7Error", eOSSLError);
diff --git a/ext/openssl/ossl_pkcs7.h b/ext/openssl/ossl_pkcs7.h
index 139e00d640..371c421103 100644
--- a/ext/openssl/ossl_pkcs7.h
+++ b/ext/openssl/ossl_pkcs7.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_PKCS7_H_)
@@ -18,3 +19,4 @@ extern VALUE ePKCS7Error;
void Init_ossl_pkcs7(void);
#endif /* _OSSL_PKCS7_H_ */
+
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index e758c9e331..0004d9d9b5 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -68,23 +69,9 @@ ossl_generate_cb_stop(void *ptr)
}
#endif
-static void
-ossl_evp_pkey_free(void *ptr)
-{
- EVP_PKEY_free(ptr);
-}
-
/*
* Public
*/
-const rb_data_type_t ossl_evp_pkey_type = {
- "OpenSSL/EVP_PKEY",
- {
- 0, ossl_evp_pkey_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
VALUE
ossl_pkey_new(EVP_PKEY *pkey)
{
@@ -198,7 +185,7 @@ GetPrivPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
- if (rb_funcallv(obj, id_private_q, 0, NULL) != Qtrue) {
+ if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) {
ossl_raise(rb_eArgError, "Private key is needed.");
}
SafeGetPKey(obj, pkey);
@@ -222,7 +209,7 @@ DupPrivPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
- if (rb_funcallv(obj, id_private_q, 0, NULL) != Qtrue) {
+ if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) {
ossl_raise(rb_eArgError, "Private key is needed.");
}
SafeGetPKey(obj, pkey);
@@ -240,11 +227,10 @@ ossl_pkey_alloc(VALUE klass)
EVP_PKEY *pkey;
VALUE obj;
- obj = NewPKey(klass);
if (!(pkey = EVP_PKEY_new())) {
ossl_raise(ePKeyError, NULL);
}
- SetPKey(obj, pkey);
+ WrapPKey(klass, obj, pkey);
return obj;
}
@@ -289,9 +275,8 @@ ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
EVP_MD_CTX ctx;
unsigned int buf_len;
VALUE str;
- int result;
- if (rb_funcallv(self, id_private_q, 0, NULL) != Qtrue) {
+ if (rb_funcall(self, id_private_q, 0, NULL) != Qtrue) {
ossl_raise(rb_eArgError, "Private key is needed.");
}
GetPKey(self, pkey);
@@ -299,9 +284,7 @@ ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
StringValue(data);
EVP_SignUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data));
str = rb_str_new(0, EVP_PKEY_size(pkey)+16);
- result = EVP_SignFinal(&ctx, (unsigned char *)RSTRING_PTR(str), &buf_len, pkey);
- EVP_MD_CTX_cleanup(&ctx);
- if (!result)
+ if (!EVP_SignFinal(&ctx, (unsigned char *)RSTRING_PTR(str), &buf_len, pkey))
ossl_raise(ePKeyError, NULL);
assert((long)buf_len <= RSTRING_LEN(str));
rb_str_set_len(str, buf_len);
@@ -335,16 +318,13 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
{
EVP_PKEY *pkey;
EVP_MD_CTX ctx;
- int result;
GetPKey(self, pkey);
+ EVP_VerifyInit(&ctx, GetDigestPtr(digest));
StringValue(sig);
StringValue(data);
- EVP_VerifyInit(&ctx, GetDigestPtr(digest));
EVP_VerifyUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data));
- result = EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), pkey);
- EVP_MD_CTX_cleanup(&ctx);
- switch (result) {
+ switch (EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), pkey)) {
case 0:
return Qfalse;
case 1:
@@ -359,7 +339,7 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
* INIT
*/
void
-Init_ossl_pkey(void)
+Init_ossl_pkey()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
@@ -453,3 +433,4 @@ Init_ossl_pkey(void)
Init_ossl_dh();
Init_ossl_ec();
}
+
diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h
index 7288d5af7f..686e956ee5 100644
--- a/ext/openssl/ossl_pkey.h
+++ b/ext/openssl/ossl_pkey.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_PKEY_H_)
@@ -14,23 +15,20 @@ extern VALUE mPKey;
extern VALUE cPKey;
extern VALUE ePKeyError;
extern ID id_private_q;
-extern const rb_data_type_t ossl_evp_pkey_type;
#define OSSL_PKEY_SET_PRIVATE(obj) rb_iv_set((obj), "private", Qtrue)
#define OSSL_PKEY_SET_PUBLIC(obj) rb_iv_set((obj), "private", Qfalse)
#define OSSL_PKEY_IS_PRIVATE(obj) (rb_iv_get((obj), "private") == Qtrue)
-#define NewPKey(klass) \
- TypedData_Wrap_Struct((klass), &ossl_evp_pkey_type, 0)
-#define SetPKey(obj, pkey) do { \
+#define WrapPKey(klass, obj, pkey) do { \
if (!(pkey)) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (pkey); \
+ (obj) = Data_Wrap_Struct((klass), 0, EVP_PKEY_free, (pkey)); \
OSSL_PKEY_SET_PUBLIC(obj); \
} while (0)
#define GetPKey(obj, pkey) do {\
- TypedData_Get_Struct((obj), EVP_PKEY, &ossl_evp_pkey_type, (pkey)); \
+ Data_Get_Struct((obj), EVP_PKEY, (pkey));\
if (!(pkey)) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!");\
} \
@@ -83,6 +81,8 @@ void Init_ossl_dsa(void);
*/
extern VALUE cDH;
extern VALUE eDHError;
+extern DH *OSSL_DEFAULT_DH_512;
+extern DH *OSSL_DEFAULT_DH_1024;
VALUE ossl_dh_new(EVP_PKEY *);
void Init_ossl_dh(void);
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index 3668acb165..a6ae0063f5 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(OPENSSL_NO_DH)
@@ -45,7 +46,6 @@ dh_instance(VALUE klass, DH *dh)
if (!dh) {
return Qfalse;
}
- obj = NewPKey(klass);
if (!(pkey = EVP_PKEY_new())) {
return Qfalse;
}
@@ -53,7 +53,7 @@ dh_instance(VALUE klass, DH *dh)
EVP_PKEY_free(pkey);
return Qfalse;
}
- SetPKey(obj, pkey);
+ WrapPKey(klass, obj, pkey);
return obj;
}
@@ -66,11 +66,10 @@ ossl_dh_new(EVP_PKEY *pkey)
if (!pkey) {
obj = dh_instance(cDH, DH_new());
} else {
- obj = NewPKey(cDH);
if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DH) {
ossl_raise(rb_eTypeError, "Not a DH key!");
}
- SetPKey(obj, pkey);
+ WrapPKey(cDH, obj, pkey);
}
if (obj == Qfalse) {
ossl_raise(eDHError, NULL);
@@ -506,8 +505,6 @@ ossl_dh_compute_key(VALUE self, VALUE pub)
GetPKeyDH(self, pkey);
dh = pkey->pkey.dh;
- if (!dh->p)
- ossl_raise(eDHError, "incomplete DH");
pub_key = GetBNPtr(pub);
len = DH_size(dh);
str = rb_str_new(0, len);
@@ -525,10 +522,73 @@ OSSL_PKEY_BN(dh, pub_key)
OSSL_PKEY_BN(dh, priv_key)
/*
+ * -----BEGIN DH PARAMETERS-----
+ * MEYCQQD0zXHljRg/mJ9PYLACLv58Cd8VxBxxY7oEuCeURMiTqEhMym16rhhKgZG2
+ * zk2O9uUIBIxSj+NKMURHGaFKyIvLAgEC
+ * -----END DH PARAMETERS-----
+ */
+static unsigned char DEFAULT_DH_512_PRIM[] = {
+ 0xf4, 0xcd, 0x71, 0xe5, 0x8d, 0x18, 0x3f, 0x98,
+ 0x9f, 0x4f, 0x60, 0xb0, 0x02, 0x2e, 0xfe, 0x7c,
+ 0x09, 0xdf, 0x15, 0xc4, 0x1c, 0x71, 0x63, 0xba,
+ 0x04, 0xb8, 0x27, 0x94, 0x44, 0xc8, 0x93, 0xa8,
+ 0x48, 0x4c, 0xca, 0x6d, 0x7a, 0xae, 0x18, 0x4a,
+ 0x81, 0x91, 0xb6, 0xce, 0x4d, 0x8e, 0xf6, 0xe5,
+ 0x08, 0x04, 0x8c, 0x52, 0x8f, 0xe3, 0x4a, 0x31,
+ 0x44, 0x47, 0x19, 0xa1, 0x4a, 0xc8, 0x8b, 0xcb,
+};
+static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 };
+DH *OSSL_DEFAULT_DH_512 = NULL;
+
+/*
+ * -----BEGIN DH PARAMETERS-----
+ * MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ
+ * AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR
+ * T4h7KZ/2zmjvV+eF8kBUHBJAojUlzxKj4QeO2x20FP9X5xmNUXeDAgEC
+ * -----END DH PARAMETERS-----
+ */
+static unsigned char DEFAULT_DH_1024_PRIM[] = {
+ 0x9d, 0x25, 0x39, 0x5c, 0xb4, 0x54, 0x8a, 0xff,
+ 0x25, 0xe6, 0xd6, 0x9f, 0x4c, 0xc3, 0xc1, 0x8d,
+ 0xa1, 0xfa, 0xba, 0x88, 0x4c, 0x53, 0xa9, 0x74,
+ 0xda, 0xfa, 0xba, 0x0b, 0x20, 0xbe, 0x40, 0xd7,
+ 0xba, 0xe7, 0x1d, 0x70, 0x28, 0x61, 0x60, 0x4c,
+ 0x49, 0x01, 0x5f, 0xd9, 0x0f, 0x60, 0x16, 0x3d,
+ 0xba, 0xd3, 0xa9, 0x5e, 0xfa, 0x98, 0x64, 0x60,
+ 0x26, 0x0e, 0x04, 0x75, 0xd8, 0x13, 0xd7, 0x31,
+ 0xb4, 0x8e, 0xad, 0xeb, 0x9c, 0x57, 0x4c, 0x8f,
+ 0x65, 0xf3, 0x90, 0x16, 0x31, 0xdc, 0x15, 0x6f,
+ 0x7d, 0x1d, 0x00, 0xae, 0x76, 0xf2, 0xd1, 0x11,
+ 0xd1, 0x4f, 0x88, 0x7b, 0x29, 0x9f, 0xf6, 0xce,
+ 0x68, 0xef, 0x57, 0xe7, 0x85, 0xf2, 0x40, 0x54,
+ 0x1c, 0x12, 0x40, 0xa2, 0x35, 0x25, 0xcf, 0x12,
+ 0xa3, 0xe1, 0x07, 0x8e, 0xdb, 0x1d, 0xb4, 0x14,
+ 0xff, 0x57, 0xe7, 0x19, 0x8d, 0x51, 0x77, 0x83
+};
+static unsigned char DEFAULT_DH_1024_GEN[] = { 0x02 };
+DH *OSSL_DEFAULT_DH_1024 = NULL;
+
+static DH*
+ossl_create_dh(unsigned char *p, size_t plen, unsigned char *g, size_t glen)
+{
+ DH *dh;
+
+ if ((dh = DH_new()) == NULL) ossl_raise(eDHError, NULL);
+ dh->p = BN_bin2bn(p, rb_long2int(plen), NULL);
+ dh->g = BN_bin2bn(g, rb_long2int(glen), NULL);
+ if (dh->p == NULL || dh->g == NULL){
+ DH_free(dh);
+ ossl_raise(eDHError, NULL);
+ }
+
+ return dh;
+}
+
+/*
* INIT
*/
void
-Init_ossl_dh(void)
+Init_ossl_dh()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
@@ -561,7 +621,7 @@ Init_ossl_dh(void)
*
* === Example of a key exchange
* dh1 = OpenSSL::PKey::DH.new(2048)
- * der = dh1.public_key.to_der #you may send this publicly to the participating party
+ * params = dh1.public_key.to_der #you may send this publicly to the participating party
* dh2 = OpenSSL::PKey::DH.new(der)
* dh2.generate_key! #generate the per-session key pair
* symm_key1 = dh1.compute_key(dh2.pub_key)
@@ -589,11 +649,19 @@ Init_ossl_dh(void)
DEF_OSSL_PKEY_BN(cDH, dh, pub_key);
DEF_OSSL_PKEY_BN(cDH, dh, priv_key);
rb_define_method(cDH, "params", ossl_dh_get_params, 0);
+
+ OSSL_DEFAULT_DH_512 = ossl_create_dh(
+ DEFAULT_DH_512_PRIM, sizeof(DEFAULT_DH_512_PRIM),
+ DEFAULT_DH_512_GEN, sizeof(DEFAULT_DH_512_GEN));
+ OSSL_DEFAULT_DH_1024 = ossl_create_dh(
+ DEFAULT_DH_1024_PRIM, sizeof(DEFAULT_DH_1024_PRIM),
+ DEFAULT_DH_1024_GEN, sizeof(DEFAULT_DH_1024_GEN));
}
#else /* defined NO_DH */
void
-Init_ossl_dh(void)
+Init_ossl_dh()
{
}
#endif /* NO_DH */
+
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 1fe5753a4e..823b9b66e5 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(OPENSSL_NO_DSA)
@@ -39,7 +40,6 @@ dsa_instance(VALUE klass, DSA *dsa)
if (!dsa) {
return Qfalse;
}
- obj = NewPKey(klass);
if (!(pkey = EVP_PKEY_new())) {
return Qfalse;
}
@@ -47,7 +47,7 @@ dsa_instance(VALUE klass, DSA *dsa)
EVP_PKEY_free(pkey);
return Qfalse;
}
- SetPKey(obj, pkey);
+ WrapPKey(klass, obj, pkey);
return obj;
}
@@ -60,11 +60,10 @@ ossl_dsa_new(EVP_PKEY *pkey)
if (!pkey) {
obj = dsa_instance(cDSA, DSA_new());
} else {
- obj = NewPKey(cDSA);
if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DSA) {
ossl_raise(rb_eTypeError, "Not a DSA key!");
}
- SetPKey(obj, pkey);
+ WrapPKey(cDSA, obj, pkey);
}
if (obj == Qfalse) {
ossl_raise(eDSAError, NULL);
@@ -110,7 +109,7 @@ dsa_generate(int size)
unsigned long h;
if (!dsa) return 0;
- if (RAND_bytes(seed, seed_len) <= 0) {
+ if (!RAND_bytes(seed, seed_len)) {
DSA_free(dsa);
return 0;
}
@@ -144,7 +143,7 @@ dsa_generate(int size)
int seed_len = 20, counter;
unsigned long h;
- if (RAND_bytes(seed, seed_len) <= 0) {
+ if (!RAND_bytes(seed, seed_len)) {
return 0;
}
dsa = DSA_generate_parameters(size, seed, seed_len, &counter, &h,
@@ -498,11 +497,10 @@ ossl_dsa_sign(VALUE self, VALUE data)
VALUE str;
GetPKeyDSA(self, pkey);
- if (!pkey->pkey.dsa->q)
- ossl_raise(eDSAError, "incomplete DSA");
- if (!DSA_PRIVATE(self, pkey->pkey.dsa))
- ossl_raise(eDSAError, "Private DSA key needed!");
StringValue(data);
+ if (!DSA_PRIVATE(self, pkey->pkey.dsa)) {
+ ossl_raise(eDSAError, "Private DSA key needed!");
+ }
str = rb_str_new(0, ossl_dsa_buf_size(pkey));
if (!DSA_sign(0, (unsigned char *)RSTRING_PTR(data), RSTRING_LENINT(data),
(unsigned char *)RSTRING_PTR(str),
@@ -565,7 +563,7 @@ OSSL_PKEY_BN(dsa, priv_key)
* INIT
*/
void
-Init_ossl_dsa(void)
+Init_ossl_dsa()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
@@ -619,7 +617,7 @@ Init_ossl_dsa(void)
#else /* defined NO_DSA */
void
-Init_ossl_dsa(void)
+Init_ossl_dsa()
{
}
#endif /* NO_DSA */
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
index 09987e5426..5e419bd167 100644
--- a/ext/openssl/ossl_pkey_ec.c
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -20,8 +20,6 @@ typedef struct {
#define EXPORT_PEM 0
#define EXPORT_DER 1
-static const rb_data_type_t ossl_ec_group_type;
-static const rb_data_type_t ossl_ec_point_type;
#define GetPKeyEC(obj, pkey) do { \
GetPKey((obj), (pkey)); \
@@ -32,7 +30,7 @@ static const rb_data_type_t ossl_ec_point_type;
#define SafeGet_ec_group(obj, group) do { \
OSSL_Check_Kind((obj), cEC_GROUP); \
- TypedData_Get_Struct((obj), ossl_ec_group, &ossl_ec_group_type, (group)); \
+ Data_Get_Struct((obj), ossl_ec_group, (group)); \
} while(0)
#define Get_EC_KEY(obj, key) do { \
@@ -54,7 +52,7 @@ static const rb_data_type_t ossl_ec_point_type;
#define Get_EC_GROUP(obj, g) do { \
ossl_ec_group *ec_group; \
- TypedData_Get_Struct((obj), ossl_ec_group, &ossl_ec_group_type, ec_group); \
+ Data_Get_Struct((obj), ossl_ec_group, ec_group); \
if (ec_group == NULL) \
ossl_raise(eEC_GROUP, "missing ossl_ec_group structure"); \
(g) = ec_group->group; \
@@ -73,7 +71,7 @@ static const rb_data_type_t ossl_ec_point_type;
#define Get_EC_POINT(obj, p) do { \
ossl_ec_point *ec_point; \
- TypedData_Get_Struct((obj), ossl_ec_point, &ossl_ec_point_type, ec_point); \
+ Data_Get_Struct((obj), ossl_ec_point, ec_point); \
if (ec_point == NULL) \
ossl_raise(eEC_POINT, "missing ossl_ec_point structure"); \
(p) = ec_point->point; \
@@ -116,7 +114,6 @@ static VALUE ec_instance(VALUE klass, EC_KEY *ec)
if (!ec) {
return Qfalse;
}
- obj = NewPKey(klass);
if (!(pkey = EVP_PKEY_new())) {
return Qfalse;
}
@@ -124,7 +121,7 @@ static VALUE ec_instance(VALUE klass, EC_KEY *ec)
EVP_PKEY_free(pkey);
return Qfalse;
}
- SetPKey(obj, pkey);
+ WrapPKey(klass, obj, pkey);
return obj;
}
@@ -136,11 +133,10 @@ VALUE ossl_ec_new(EVP_PKEY *pkey)
if (!pkey) {
obj = ec_instance(cEC, EC_KEY_new());
} else {
- obj = NewPKey(cEC);
if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) {
ossl_raise(rb_eTypeError, "Not a EC key!");
}
- SetPKey(obj, pkey);
+ WrapPKey(cEC, obj, pkey);
}
if (obj == Qfalse) {
ossl_raise(eECError, NULL);
@@ -373,7 +369,7 @@ static VALUE ossl_ec_point_dup(const EC_POINT *point, VALUE group_v)
ossl_ec_point *new_point;
obj = rb_obj_alloc(cEC_POINT);
- TypedData_Get_Struct(obj, ossl_ec_point, &ossl_ec_point_type, new_point);
+ Data_Get_Struct(obj, ossl_ec_point, new_point);
SafeRequire_EC_GROUP(group_v, group);
@@ -475,7 +471,6 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
int private = 0;
char *password = NULL;
VALUE str;
- const EVP_CIPHER *cipher = NULL;
Require_EC_KEY(self, ec);
@@ -488,22 +483,25 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
if (EC_KEY_get0_private_key(ec))
private = 1;
- if (!NIL_P(ciph)) {
- cipher = GetCipherPtr(ciph);
- if (!NIL_P(pass)) {
- StringValue(pass);
- if (RSTRING_LENINT(pass) < OSSL_MIN_PWD_LEN)
- ossl_raise(eOSSLError, "OpenSSL requires passwords to be at least four characters long");
- password = RSTRING_PTR(pass);
- }
- }
-
if (!(out = BIO_new(BIO_s_mem())))
ossl_raise(eECError, "BIO_new(BIO_s_mem())");
switch(format) {
case EXPORT_PEM:
if (private) {
+ const EVP_CIPHER *cipher;
+ if (!NIL_P(ciph)) {
+ cipher = GetCipherPtr(ciph);
+ if (!NIL_P(pass)) {
+ StringValue(pass);
+ if (RSTRING_LENINT(pass) < OSSL_MIN_PWD_LEN)
+ ossl_raise(eOSSLError, "OpenSSL requires passwords to be at least four characters long");
+ password = RSTRING_PTR(pass);
+ }
+ }
+ else {
+ cipher = NULL;
+ }
i = PEM_write_bio_ECPrivateKey(out, ec, cipher, NULL, 0, NULL, password);
} else {
i = PEM_write_bio_EC_PUBKEY(out, ec);
@@ -709,28 +707,19 @@ static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig)
UNREACHABLE;
}
-static void ossl_ec_group_free(void *ptr)
+static void ossl_ec_group_free(ossl_ec_group *ec_group)
{
- ossl_ec_group *ec_group = ptr;
if (!ec_group->dont_free && ec_group->group)
EC_GROUP_clear_free(ec_group->group);
ruby_xfree(ec_group);
}
-static const rb_data_type_t ossl_ec_group_type = {
- "OpenSSL/ec_group",
- {
- 0, ossl_ec_group_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE ossl_ec_group_alloc(VALUE klass)
{
ossl_ec_group *ec_group;
VALUE obj;
- obj = TypedData_Make_Struct(klass, ossl_ec_group, &ossl_ec_group_type, ec_group);
+ obj = Data_Make_Struct(klass, ossl_ec_group, 0, ossl_ec_group_free, ec_group);
return obj;
}
@@ -757,7 +746,7 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
ossl_ec_group *ec_group;
EC_GROUP *group = NULL;
- TypedData_Get_Struct(self, ossl_ec_group, &ossl_ec_group_type, ec_group);
+ Data_Get_Struct(self, ossl_ec_group, ec_group);
if (ec_group->group != NULL)
ossl_raise(rb_eRuntimeError, "EC_GROUP is already initialized");
@@ -1230,28 +1219,19 @@ static VALUE ossl_ec_group_to_text(VALUE self)
}
-static void ossl_ec_point_free(void *ptr)
+static void ossl_ec_point_free(ossl_ec_point *ec_point)
{
- ossl_ec_point *ec_point = ptr;
if (!ec_point->dont_free && ec_point->point)
EC_POINT_clear_free(ec_point->point);
ruby_xfree(ec_point);
}
-static const rb_data_type_t ossl_ec_point_type = {
- "OpenSSL/ec_point",
- {
- 0, ossl_ec_point_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE ossl_ec_point_alloc(VALUE klass)
{
ossl_ec_point *ec_point;
VALUE obj;
- obj = TypedData_Make_Struct(klass, ossl_ec_point, &ossl_ec_point_type, ec_point);
+ obj = Data_Make_Struct(klass, ossl_ec_point, 0, ossl_ec_point_free, ec_point);
return obj;
}
@@ -1272,7 +1252,7 @@ static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
VALUE group_v = Qnil;
const EC_GROUP *group = NULL;
- TypedData_Get_Struct(self, ossl_ec_point, &ossl_ec_point_type, ec_point);
+ Data_Get_Struct(self, ossl_ec_point, ec_point);
if (ec_point->point)
ossl_raise(eEC_POINT, "EC_POINT already initialized");
@@ -1576,7 +1556,7 @@ static void no_copy(VALUE klass)
rb_undef_method(klass, "initialize_copy");
}
-void Init_ossl_ec(void)
+void Init_ossl_ec()
{
#ifdef DONT_NEED_RDOC_WORKAROUND
mOSSL = rb_define_module("OpenSSL");
@@ -1697,7 +1677,7 @@ void Init_ossl_ec(void)
}
#else /* defined NO_EC */
-void Init_ossl_ec(void)
+void Init_ossl_ec()
{
}
#endif /* NO_EC */
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index 26b1fbe1b6..4c346a042f 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(OPENSSL_NO_RSA)
@@ -39,7 +40,6 @@ rsa_instance(VALUE klass, RSA *rsa)
if (!rsa) {
return Qfalse;
}
- obj = NewPKey(klass);
if (!(pkey = EVP_PKEY_new())) {
return Qfalse;
}
@@ -47,7 +47,7 @@ rsa_instance(VALUE klass, RSA *rsa)
EVP_PKEY_free(pkey);
return Qfalse;
}
- SetPKey(obj, pkey);
+ WrapPKey(klass, obj, pkey);
return obj;
}
@@ -61,11 +61,10 @@ ossl_rsa_new(EVP_PKEY *pkey)
obj = rsa_instance(cRSA, RSA_new());
}
else {
- obj = NewPKey(cRSA);
if (EVP_PKEY_type(pkey->type) != EVP_PKEY_RSA) {
ossl_raise(rb_eTypeError, "Not a RSA key!");
}
- SetPKey(obj, pkey);
+ WrapPKey(cRSA, obj, pkey);
}
if (obj == Qfalse) {
ossl_raise(eRSAError, NULL);
@@ -391,8 +390,6 @@ ossl_rsa_public_encrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!pkey->pkey.rsa->n)
- ossl_raise(eRSAError, "incomplete RSA");
rb_scan_args(argc, argv, "11", &buffer, &padding);
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
@@ -422,8 +419,6 @@ ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!pkey->pkey.rsa->n)
- ossl_raise(eRSAError, "incomplete RSA");
rb_scan_args(argc, argv, "11", &buffer, &padding);
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
@@ -453,10 +448,9 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!pkey->pkey.rsa->n)
- ossl_raise(eRSAError, "incomplete RSA");
- if (!RSA_PRIVATE(self, pkey->pkey.rsa))
- ossl_raise(eRSAError, "private key needed");
+ if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
+ ossl_raise(eRSAError, "private key needed.");
+ }
rb_scan_args(argc, argv, "11", &buffer, &padding);
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
@@ -486,10 +480,9 @@ ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!pkey->pkey.rsa->n)
- ossl_raise(eRSAError, "incomplete RSA");
- if (!RSA_PRIVATE(self, pkey->pkey.rsa))
- ossl_raise(eRSAError, "private key needed");
+ if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
+ ossl_raise(eRSAError, "private key needed.");
+ }
rb_scan_args(argc, argv, "11", &buffer, &padding);
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
@@ -633,7 +626,7 @@ OSSL_PKEY_BN(rsa, iqmp)
#define DefRSAConst(x) rb_define_const(cRSA, #x,INT2FIX(RSA_##x))
void
-Init_ossl_rsa(void)
+Init_ossl_rsa()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
@@ -701,7 +694,8 @@ Init_ossl_rsa(void)
#else /* defined NO_RSA */
void
-Init_ossl_rsa(void)
+Init_ossl_rsa()
{
}
#endif /* NO_RSA */
+
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c
index daf866d772..270a4b7437 100644
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -1,22 +1,37 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
- *
* All rights reserved.
- *
- * This program is licensed under the same licence as Ruby.
+ */
+/*
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
+/*
+ * Classes
+ */
VALUE mRandom;
VALUE eRandomError;
/*
+ * Struct
+ */
+
+/*
+ * Public
+ */
+
+/*
+ * Private
+ */
+
+/*
* call-seq:
* seed(str) -> str
*
- * ::seed is equivalent to ::add where +entropy+ is length of +str+.
*/
static VALUE
ossl_rand_seed(VALUE self, VALUE str)
@@ -31,23 +46,6 @@ ossl_rand_seed(VALUE self, VALUE str)
* call-seq:
* add(str, entropy) -> self
*
- * Mixes the bytes from +str+ into the Pseudo Random Number Generator(PRNG)
- * state.
- *
- * Thus, if the data from +str+ are unpredictable to an adversary, this
- * increases the uncertainty about the state and makes the PRNG output less
- * predictable.
- *
- * The +entropy+ argument is (the lower bound of) an estimate of how much
- * randomness is contained in +str+, measured in bytes.
- *
- * Example:
- *
- * pid = $$
- * now = Time.now
- * ary = [now.to_i, now.nsec, 1000, pid]
- * OpenSSL::Random.add(ary.join("").to_s, 0.0)
- * OpenSSL::Random.seed(ary.join("").to_s)
*/
static VALUE
ossl_rand_add(VALUE self, VALUE str, VALUE entropy)
@@ -62,7 +60,6 @@ ossl_rand_add(VALUE self, VALUE str, VALUE entropy)
* call-seq:
* load_random_file(filename) -> true
*
- * Reads bytes from +filename+ and adds them to the PRNG.
*/
static VALUE
ossl_rand_load_file(VALUE self, VALUE filename)
@@ -79,9 +76,6 @@ ossl_rand_load_file(VALUE self, VALUE filename)
* call-seq:
* write_random_file(filename) -> true
*
- * Writes a number of random generated bytes (currently 1024) to +filename+
- * which can be used to initialize the PRNG by calling ::load_random_file in a
- * later session.
*/
static VALUE
ossl_rand_write_file(VALUE self, VALUE filename)
@@ -95,31 +89,18 @@ ossl_rand_write_file(VALUE self, VALUE filename)
/*
* call-seq:
- * random_bytes(length) -> string
- *
- * Generates +string+ with +length+ number of cryptographically strong
- * pseudo-random bytes.
- *
- * Example:
+ * random_bytes(length) -> aString
*
- * OpenSSL::Random.random_bytes(12)
- * => "..."
*/
static VALUE
ossl_rand_bytes(VALUE self, VALUE len)
{
VALUE str;
int n = NUM2INT(len);
- int ret;
str = rb_str_new(0, n);
- ret = RAND_bytes((unsigned char *)RSTRING_PTR(str), n);
- if (ret == 0){
- char buf[256];
- ERR_error_string_n(ERR_get_error(), buf, 256);
- ossl_raise(eRandomError, "RAND_bytes error: %s", buf);
- } else if (ret == -1) {
- ossl_raise(eRandomError, "RAND_bytes is not supported");
+ if (!RAND_bytes((unsigned char *)RSTRING_PTR(str), n)) {
+ ossl_raise(eRandomError, NULL);
}
return str;
@@ -127,17 +108,8 @@ ossl_rand_bytes(VALUE self, VALUE len)
/*
* call-seq:
- * pseudo_bytes(length) -> string
- *
- * Generates +string+ with +length+ number of pseudo-random bytes.
- *
- * Pseudo-random byte sequences generated by ::pseudo_bytes will be unique if
- * they are of sufficient length, but are not necessarily unpredictable.
- *
- * Example:
+ * pseudo_bytes(length) -> aString
*
- * OpenSSL::Random.pseudo_bytes(12)
- * => "..."
*/
static VALUE
ossl_rand_pseudo_bytes(VALUE self, VALUE len)
@@ -153,12 +125,10 @@ ossl_rand_pseudo_bytes(VALUE self, VALUE len)
return str;
}
-#ifdef HAVE_RAND_EGD
/*
* call-seq:
* egd(filename) -> true
*
- * Same as ::egd_bytes but queries 255 bytes by default.
*/
static VALUE
ossl_rand_egd(VALUE self, VALUE filename)
@@ -175,10 +145,6 @@ ossl_rand_egd(VALUE self, VALUE filename)
* call-seq:
* egd_bytes(filename, length) -> true
*
- * Queries the entropy gathering daemon EGD on socket path given by +filename+.
- *
- * Fetches +length+ number of bytes and uses ::add to seed the OpenSSL built-in
- * PRNG.
*/
static VALUE
ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
@@ -192,7 +158,6 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
}
return Qtrue;
}
-#endif /* HAVE_RAND_EGD */
/*
* call-seq:
@@ -206,11 +171,15 @@ ossl_rand_status(VALUE self)
return RAND_status() ? Qtrue : Qfalse;
}
+#define DEFMETH(class, name, func, argc) \
+ rb_define_method((class), (name), (func), (argc)); \
+ rb_define_singleton_method((class), (name), (func), (argc));
+
/*
* INIT
*/
void
-Init_ossl_rand(void)
+Init_ossl_rand()
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
@@ -220,15 +189,14 @@ Init_ossl_rand(void)
eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
- rb_define_module_function(mRandom, "seed", ossl_rand_seed, 1);
- rb_define_module_function(mRandom, "random_add", ossl_rand_add, 2);
- rb_define_module_function(mRandom, "load_random_file", ossl_rand_load_file, 1);
- rb_define_module_function(mRandom, "write_random_file", ossl_rand_write_file, 1);
- rb_define_module_function(mRandom, "random_bytes", ossl_rand_bytes, 1);
- rb_define_module_function(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
-#ifdef HAVE_RAND_EGD
- rb_define_module_function(mRandom, "egd", ossl_rand_egd, 1);
- rb_define_module_function(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
-#endif /* HAVE_RAND_EGD */
- rb_define_module_function(mRandom, "status?", ossl_rand_status, 0);
+ DEFMETH(mRandom, "seed", ossl_rand_seed, 1);
+ DEFMETH(mRandom, "random_add", ossl_rand_add, 2);
+ DEFMETH(mRandom, "load_random_file", ossl_rand_load_file, 1);
+ DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
+ DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
+ DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
+ DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
+ DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+ DEFMETH(mRandom, "status?", ossl_rand_status, 0)
}
+
diff --git a/ext/openssl/ossl_rand.h b/ext/openssl/ossl_rand.h
index 8f77a3b239..ce2ae0d129 100644
--- a/ext/openssl/ossl_rand.h
+++ b/ext/openssl/ossl_rand.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_RAND_H_)
@@ -16,3 +17,4 @@ extern VALUE eRandomError;
void Init_ossl_rand(void);
#endif /* _OSSL_RAND_H_ */
+
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 7a0eb4ec90..77007ba691 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1,4 +1,5 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2000-2002 GOTOU Yuuzou <gotoyuzo@notwork.org>
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
@@ -6,7 +7,7 @@
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -23,13 +24,8 @@
# define TO_SOCKET(s) (s)
#endif
-#define GetSSLCTX(obj, ctx) do { \
- TypedData_Get_Struct((obj), SSL_CTX, &ossl_sslctx_type, (ctx)); \
-} while (0)
-
VALUE mSSL;
-static VALUE mSSLExtConfig;
-static VALUE eSSLError;
+VALUE eSSLError;
VALUE cSSLContext;
VALUE cSSLSocket;
@@ -45,9 +41,11 @@ static VALUE eSSLErrorWaitWritable;
#define ossl_sslctx_set_verify_mode(o,v) rb_iv_set((o),"@verify_mode",(v))
#define ossl_sslctx_set_verify_dep(o,v) rb_iv_set((o),"@verify_depth",(v))
#define ossl_sslctx_set_verify_cb(o,v) rb_iv_set((o),"@verify_callback",(v))
+#define ossl_sslctx_set_options(o,v) rb_iv_set((o),"@options",(v))
#define ossl_sslctx_set_cert_store(o,v) rb_iv_set((o),"@cert_store",(v))
#define ossl_sslctx_set_extra_cert(o,v) rb_iv_set((o),"@extra_chain_cert",(v))
#define ossl_sslctx_set_client_cert_cb(o,v) rb_iv_set((o),"@client_cert_cb",(v))
+#define ossl_sslctx_set_tmp_dh_cb(o,v) rb_iv_set((o),"@tmp_dh_callback",(v))
#define ossl_sslctx_set_sess_id_ctx(o, v) rb_iv_set((o),"@session_id_context",(v))
#define ossl_sslctx_get_cert(o) rb_iv_get((o),"@cert")
@@ -59,30 +57,58 @@ static VALUE eSSLErrorWaitWritable;
#define ossl_sslctx_get_verify_mode(o) rb_iv_get((o),"@verify_mode")
#define ossl_sslctx_get_verify_dep(o) rb_iv_get((o),"@verify_depth")
#define ossl_sslctx_get_verify_cb(o) rb_iv_get((o),"@verify_callback")
+#define ossl_sslctx_get_options(o) rb_iv_get((o),"@options")
#define ossl_sslctx_get_cert_store(o) rb_iv_get((o),"@cert_store")
#define ossl_sslctx_get_extra_cert(o) rb_iv_get((o),"@extra_chain_cert")
#define ossl_sslctx_get_client_cert_cb(o) rb_iv_get((o),"@client_cert_cb")
-#define ossl_sslctx_get_tmp_ecdh_cb(o) rb_iv_get((o),"@tmp_ecdh_callback")
+#define ossl_sslctx_get_tmp_dh_cb(o) rb_iv_get((o),"@tmp_dh_callback")
#define ossl_sslctx_get_sess_id_ctx(o) rb_iv_get((o),"@session_id_context")
+static const char *ossl_sslctx_attrs[] = {
+ "cert", "key", "client_ca", "ca_file", "ca_path",
+ "timeout", "verify_mode", "verify_depth", "renegotiation_cb",
+ "verify_callback", "options", "cert_store", "extra_chain_cert",
+ "client_cert_cb", "tmp_dh_callback", "session_id_context",
+ "session_get_cb", "session_new_cb", "session_remove_cb",
+#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
+ "servername_cb",
+#endif
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+ "npn_protocols",
+ "npn_select_cb",
+#endif
+};
+
#define ossl_ssl_get_io(o) rb_iv_get((o),"@io")
#define ossl_ssl_get_ctx(o) rb_iv_get((o),"@context")
+#define ossl_ssl_get_sync_close(o) rb_iv_get((o),"@sync_close")
#define ossl_ssl_get_x509(o) rb_iv_get((o),"@x509")
#define ossl_ssl_get_key(o) rb_iv_get((o),"@key")
+#define ossl_ssl_get_tmp_dh(o) rb_iv_get((o),"@tmp_dh")
+#define ossl_ssl_set_io(o,v) rb_iv_set((o),"@io",(v))
+#define ossl_ssl_set_ctx(o,v) rb_iv_set((o),"@context",(v))
+#define ossl_ssl_set_sync_close(o,v) rb_iv_set((o),"@sync_close",(v))
#define ossl_ssl_set_x509(o,v) rb_iv_set((o),"@x509",(v))
#define ossl_ssl_set_key(o,v) rb_iv_set((o),"@key",(v))
#define ossl_ssl_set_tmp_dh(o,v) rb_iv_set((o),"@tmp_dh",(v))
-#define ossl_ssl_set_tmp_ecdh(o,v) rb_iv_set((o),"@tmp_ecdh",(v))
-static ID ID_callback_state;
+static const char *ossl_ssl_attr_readers[] = { "io", "context", };
+static const char *ossl_ssl_attrs[] = {
+#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
+ "hostname",
+#endif
+ "sync_close",
+};
+
+ID ID_callback_state;
-static VALUE sym_exception, sym_wait_readable, sym_wait_writable;
+static VALUE sym_exception;
/*
* SSLContext class
*/
-static const struct {
+struct {
const char *name;
SSL_METHOD *(*func)(void);
} ossl_ssl_method_tab[] = {
@@ -108,60 +134,45 @@ static const struct {
OSSL_SSL_METHOD_ENTRY(SSLv2_server),
OSSL_SSL_METHOD_ENTRY(SSLv2_client),
#endif
-#if defined(HAVE_SSLV3_METHOD) && defined(HAVE_SSLV3_SERVER_METHOD) && \
- defined(HAVE_SSLV3_CLIENT_METHOD)
OSSL_SSL_METHOD_ENTRY(SSLv3),
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
-#endif
OSSL_SSL_METHOD_ENTRY(SSLv23),
OSSL_SSL_METHOD_ENTRY(SSLv23_server),
OSSL_SSL_METHOD_ENTRY(SSLv23_client),
#undef OSSL_SSL_METHOD_ENTRY
};
-static int ossl_ssl_ex_vcb_idx;
-static int ossl_ssl_ex_store_p;
-static int ossl_ssl_ex_ptr_idx;
+int ossl_ssl_ex_vcb_idx;
+int ossl_ssl_ex_store_p;
+int ossl_ssl_ex_ptr_idx;
+int ossl_ssl_ex_client_cert_cb_idx;
+int ossl_ssl_ex_tmp_dh_callback_idx;
static void
-ossl_sslctx_free(void *ptr)
+ossl_sslctx_free(SSL_CTX *ctx)
{
- SSL_CTX *ctx = ptr;
if(ctx && SSL_CTX_get_ex_data(ctx, ossl_ssl_ex_store_p)== (void*)1)
ctx->cert_store = NULL;
SSL_CTX_free(ctx);
}
-static const rb_data_type_t ossl_sslctx_type = {
- "OpenSSL/SSL/CTX",
- {
- 0, ossl_sslctx_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
ossl_sslctx_s_alloc(VALUE klass)
{
SSL_CTX *ctx;
long mode = SSL_MODE_ENABLE_PARTIAL_WRITE;
- VALUE obj;
#ifdef SSL_MODE_RELEASE_BUFFERS
mode |= SSL_MODE_RELEASE_BUFFERS;
#endif
- obj = TypedData_Wrap_Struct(klass, &ossl_sslctx_type, 0);
ctx = SSL_CTX_new(SSLv23_method());
if (!ctx) {
ossl_raise(eSSLError, "SSL_CTX_new");
}
SSL_CTX_set_mode(ctx, mode);
- RTYPEDDATA_DATA(obj) = ctx;
- SSL_CTX_set_ex_data(ctx, ossl_ssl_ex_ptr_idx, (void*)obj);
-
- return obj;
+ return Data_Wrap_Struct(klass, 0, ossl_sslctx_free, ctx);
}
/*
@@ -176,13 +187,13 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
{
SSL_METHOD *method = NULL;
const char *s;
- VALUE m = ssl_method;
int i;
SSL_CTX *ctx;
- if (RB_TYPE_P(ssl_method, T_SYMBOL))
- m = rb_sym2str(ssl_method);
- s = StringValueCStr(m);
+ if(TYPE(ssl_method) == T_SYMBOL)
+ s = rb_id2name(SYM2ID(ssl_method));
+ else
+ s = StringValuePtr(ssl_method);
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
if (strcmp(ossl_ssl_method_tab[i].name, s) == 0) {
method = ossl_ssl_method_tab[i].func();
@@ -190,9 +201,9 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
}
}
if (!method) {
- ossl_raise(rb_eArgError, "unknown SSL method `%"PRIsVALUE"'.", m);
+ ossl_raise(rb_eArgError, "unknown SSL method `%s'.", s);
}
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
if (SSL_CTX_set_ssl_version(ctx, method) != 1) {
ossl_raise(eSSLError, "SSL_CTX_set_ssl_version");
}
@@ -200,12 +211,41 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
return ssl_method;
}
+/*
+ * call-seq:
+ * SSLContext.new => ctx
+ * SSLContext.new(:TLSv1) => ctx
+ * SSLContext.new("SSLv23_client") => ctx
+ *
+ * You can get a list of valid methods with OpenSSL::SSL::SSLContext::METHODS
+ */
+static VALUE
+ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
+{
+ VALUE ssl_method;
+ int i;
+
+ for(i = 0; i < numberof(ossl_sslctx_attrs); i++){
+ char buf[32];
+ snprintf(buf, sizeof(buf), "@%s", ossl_sslctx_attrs[i]);
+ rb_iv_set(self, buf, Qnil);
+ }
+ if (rb_scan_args(argc, argv, "01", &ssl_method) == 0){
+ return self;
+ }
+ ossl_sslctx_set_ssl_version(self, ssl_method);
+
+ return self;
+}
+
static VALUE
ossl_call_client_cert_cb(VALUE obj)
{
VALUE cb, ary, cert, key;
+ SSL *ssl;
- cb = rb_funcall(obj, rb_intern("client_cert_cb"), 0);
+ Data_Get_Struct(obj, SSL, ssl);
+ cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx);
if (NIL_P(cb)) return Qfalse;
ary = rb_funcall(cb, rb_intern("call"), 1, obj);
Check_Type(ary, T_ARRAY);
@@ -223,7 +263,8 @@ ossl_client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
VALUE obj, success;
obj = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx);
- success = rb_protect(ossl_call_client_cert_cb, obj, NULL);
+ success = rb_protect((VALUE(*)_((VALUE)))ossl_call_client_cert_cb,
+ obj, NULL);
if (!RTEST(success)) return 0;
*x509 = DupX509CertPtr(ossl_ssl_get_x509(obj));
*pkey = DupPKeyPtr(ossl_ssl_get_key(obj));
@@ -233,71 +274,52 @@ ossl_client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
#if !defined(OPENSSL_NO_DH)
static VALUE
-ossl_call_tmp_dh_callback(VALUE args)
+ossl_call_tmp_dh_callback(VALUE *args)
{
+ SSL *ssl;
VALUE cb, dh;
EVP_PKEY *pkey;
- cb = rb_funcall(rb_ary_entry(args, 0), rb_intern("tmp_dh_callback"), 0);
-
+ Data_Get_Struct(args[0], SSL, ssl);
+ cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx);
if (NIL_P(cb)) return Qfalse;
- dh = rb_apply(cb, rb_intern("call"), args);
+ dh = rb_funcall(cb, rb_intern("call"), 3, args[0], args[1], args[2]);
pkey = GetPKeyPtr(dh);
if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DH) return Qfalse;
+ ossl_ssl_set_tmp_dh(args[0], dh);
- return dh;
+ return Qtrue;
}
static DH*
ossl_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
{
- VALUE args, dh, rb_ssl;
-
- rb_ssl = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx);
-
- args = rb_ary_new_from_args(3, rb_ssl, INT2FIX(is_export), INT2FIX(keylength));
-
- dh = rb_protect(ossl_call_tmp_dh_callback, args, NULL);
- if (!RTEST(dh)) return NULL;
- ossl_ssl_set_tmp_dh(rb_ssl, dh);
-
- return GetPKeyPtr(dh)->pkey.dh;
-}
-#endif /* OPENSSL_NO_DH */
-
-#if !defined(OPENSSL_NO_EC)
-static VALUE
-ossl_call_tmp_ecdh_callback(VALUE args)
-{
- VALUE cb, ecdh;
- EVP_PKEY *pkey;
+ VALUE args[3], success;
- cb = rb_funcall(rb_ary_entry(args, 0), rb_intern("tmp_ecdh_callback"), 0);
+ args[0] = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx);
+ args[1] = INT2FIX(is_export);
+ args[2] = INT2FIX(keylength);
+ success = rb_protect((VALUE(*)_((VALUE)))ossl_call_tmp_dh_callback,
+ (VALUE)args, NULL);
+ if (!RTEST(success)) return NULL;
- if (NIL_P(cb)) return Qfalse;
- ecdh = rb_apply(cb, rb_intern("call"), args);
- pkey = GetPKeyPtr(ecdh);
- if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) return Qfalse;
-
- return ecdh;
+ return GetPKeyPtr(ossl_ssl_get_tmp_dh(args[0]))->pkey.dh;
}
-static EC_KEY*
-ossl_tmp_ecdh_callback(SSL *ssl, int is_export, int keylength)
+static DH*
+ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
{
- VALUE args, ecdh, rb_ssl;
+ rb_warning("using default DH parameters.");
- rb_ssl = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx);
-
- args = rb_ary_new_from_args(3, rb_ssl, INT2FIX(is_export), INT2FIX(keylength));
-
- ecdh = rb_protect(ossl_call_tmp_ecdh_callback, args, NULL);
- if (!RTEST(ecdh)) return NULL;
- ossl_ssl_set_tmp_ecdh(rb_ssl, ecdh);
-
- return GetPKeyPtr(ecdh)->pkey.ec;
+ switch(keylength){
+ case 512:
+ return OSSL_DEFAULT_DH_512;
+ case 1024:
+ return OSSL_DEFAULT_DH_1024;
+ }
+ return NULL;
}
-#endif
+#endif /* OPENSSL_NO_DH */
static int
ossl_ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
@@ -307,19 +329,21 @@ ossl_ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_vcb_idx);
- X509_STORE_CTX_set_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx, (void *)cb);
+ X509_STORE_CTX_set_ex_data(ctx, ossl_verify_cb_idx, (void*)cb);
return ossl_verify_cb(preverify_ok, ctx);
}
static VALUE
ossl_call_session_get_cb(VALUE ary)
{
- VALUE ssl_obj, cb;
+ VALUE ssl_obj, sslctx_obj, cb;
Check_Type(ary, T_ARRAY);
ssl_obj = rb_ary_entry(ary, 0);
- cb = rb_funcall(ssl_obj, rb_intern("session_get_cb"), 0);
+ sslctx_obj = rb_iv_get(ssl_obj, "@context");
+ if (NIL_P(sslctx_obj)) return Qnil;
+ cb = rb_iv_get(sslctx_obj, "@session_get_cb");
if (NIL_P(cb)) return Qnil;
return rb_funcall(cb, rb_intern("call"), 1, ary);
@@ -342,7 +366,7 @@ ossl_sslctx_session_get_cb(SSL *ssl, unsigned char *buf, int len, int *copy)
rb_ary_push(ary, ssl_obj);
rb_ary_push(ary, rb_str_new((const char *)buf, len));
- ret_obj = rb_protect(ossl_call_session_get_cb, ary, &state);
+ ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_get_cb, ary, &state);
if (state) {
rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state));
return NULL;
@@ -359,12 +383,14 @@ ossl_sslctx_session_get_cb(SSL *ssl, unsigned char *buf, int len, int *copy)
static VALUE
ossl_call_session_new_cb(VALUE ary)
{
- VALUE ssl_obj, cb;
+ VALUE ssl_obj, sslctx_obj, cb;
Check_Type(ary, T_ARRAY);
ssl_obj = rb_ary_entry(ary, 0);
- cb = rb_funcall(ssl_obj, rb_intern("session_new_cb"), 0);
+ sslctx_obj = rb_iv_get(ssl_obj, "@context");
+ if (NIL_P(sslctx_obj)) return Qnil;
+ cb = rb_iv_get(sslctx_obj, "@session_new_cb");
if (NIL_P(cb)) return Qnil;
return rb_funcall(cb, rb_intern("call"), 1, ary);
@@ -391,7 +417,7 @@ ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
rb_ary_push(ary, ssl_obj);
rb_ary_push(ary, sess_obj);
- rb_protect(ossl_call_session_new_cb, ary, &state);
+ rb_protect((VALUE(*)_((VALUE)))ossl_call_session_new_cb, ary, &state);
if (state) {
rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state));
}
@@ -451,12 +477,12 @@ ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
}
static VALUE
-ossl_sslctx_add_extra_chain_cert_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+ossl_sslctx_add_extra_chain_cert_i(VALUE i, VALUE arg)
{
X509 *x509;
SSL_CTX *ctx;
- GetSSLCTX(arg, ctx);
+ Data_Get_Struct(arg, SSL_CTX, ctx);
x509 = DupX509CertPtr(i);
if(!SSL_CTX_add_extra_chain_cert(ctx, x509)){
ossl_raise(eSSLError, NULL);
@@ -487,10 +513,9 @@ ossl_call_servername_cb(VALUE ary)
SSL_CTX *ctx2;
ossl_sslctx_setup(ret_obj);
- GetSSL(ssl_obj, ssl);
- GetSSLCTX(ret_obj, ctx2);
+ Data_Get_Struct(ssl_obj, SSL, ssl);
+ Data_Get_Struct(ret_obj, SSL_CTX, ctx2);
SSL_set_SSL_CTX(ssl, ctx2);
- rb_iv_set(ssl_obj, "@context", ret_obj);
} else if (!NIL_P(ret_obj)) {
ossl_raise(rb_eArgError, "servername_cb must return an OpenSSL::SSL::SSLContext object or nil");
}
@@ -544,7 +569,7 @@ ssl_renegotiation_cb(const SSL *ssl)
(void) rb_funcall(cb, rb_intern("call"), 1, ssl_obj);
}
-#if defined(HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB) || defined(HAVE_SSL_CTX_SET_ALPN_SELECT_CB)
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
static VALUE
ssl_npn_encode_protocol_i(VALUE cur, VALUE encoded)
{
@@ -559,45 +584,15 @@ ssl_npn_encode_protocol_i(VALUE cur, VALUE encoded)
return Qnil;
}
-static VALUE
-ssl_encode_npn_protocols(VALUE protocols)
+static void
+ssl_npn_encode_protocols(VALUE sslctx, VALUE protocols)
{
VALUE encoded = rb_str_new2("");
rb_iterate(rb_each, protocols, ssl_npn_encode_protocol_i, encoded);
StringValueCStr(encoded);
- return encoded;
-}
-
-static int
-ssl_npn_select_cb_common(VALUE cb, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen)
-{
- VALUE selected;
- long len;
- VALUE protocols = rb_ary_new();
- unsigned char l;
- const unsigned char *in_end = in + inlen;
-
- /* assume OpenSSL verifies this format */
- /* The format is len_1|proto_1|...|len_n|proto_n */
- while (in < in_end) {
- l = *in++;
- rb_ary_push(protocols, rb_str_new((const char *)in, l));
- in += l;
- }
-
- selected = rb_funcall(cb, rb_intern("call"), 1, protocols);
- StringValue(selected);
- len = RSTRING_LEN(selected);
- if (len < 1 || len >= 256) {
- ossl_raise(eSSLError, "Selected protocol name must have length 1..255");
- }
- *out = (unsigned char *)RSTRING_PTR(selected);
- *outlen = (unsigned char)len;
-
- return SSL_TLSEXT_ERR_OK;
+ rb_iv_set(sslctx, "@_protocols", encoded);
}
-#ifdef HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB
static int
ssl_npn_advertise_cb(SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg)
{
@@ -613,28 +608,28 @@ ssl_npn_advertise_cb(SSL *ssl, const unsigned char **out, unsigned int *outlen,
static int
ssl_npn_select_cb(SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
{
- VALUE sslctx_obj, cb;
+ int i = 0;
+ VALUE sslctx_obj, cb, protocols, selected;
sslctx_obj = (VALUE) arg;
cb = rb_iv_get(sslctx_obj, "@npn_select_cb");
+ protocols = rb_ary_new();
- return ssl_npn_select_cb_common(cb, (const unsigned char **)out, outlen, in, inlen);
-}
-#endif
-
-#ifdef HAVE_SSL_CTX_SET_ALPN_SELECT_CB
-static int
-ssl_alpn_select_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
-{
- VALUE sslctx_obj, cb;
+ /* The format is len_1|proto_1|...|len_n|proto_n\0 */
+ while (in[i]) {
+ VALUE protocol = rb_str_new((const char *) &in[i + 1], in[i]);
+ rb_ary_push(protocols, protocol);
+ i += in[i] + 1;
+ }
- sslctx_obj = (VALUE) arg;
- cb = rb_iv_get(sslctx_obj, "@alpn_select_cb");
+ selected = rb_funcall(cb, rb_intern("call"), 1, protocols);
+ StringValue(selected);
+ *out = (unsigned char *) StringValuePtr(selected);
+ *outlen = RSTRING_LENINT(selected);
- return ssl_npn_select_cb_common(cb, out, outlen, in, inlen);
+ return SSL_TLSEXT_ERR_OK;
}
#endif
-#endif /* HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB || HAVE_SSL_CTX_SET_ALPN_SELECT_CB */
/* This function may serve as the entry point to support further
* callbacks. */
@@ -650,46 +645,13 @@ ssl_info_cb(const SSL *ssl, int where, int val)
}
/*
- * Gets various OpenSSL options.
- */
-static VALUE
-ossl_sslctx_get_options(VALUE self)
-{
- SSL_CTX *ctx;
- GetSSLCTX(self, ctx);
- return LONG2NUM(SSL_CTX_get_options(ctx));
-}
-
-/*
- * Sets various OpenSSL options.
- */
-static VALUE
-ossl_sslctx_set_options(VALUE self, VALUE options)
-{
- SSL_CTX *ctx;
-
- rb_check_frozen(self);
- GetSSLCTX(self, ctx);
-
- SSL_CTX_clear_options(ctx, SSL_CTX_get_options(ctx));
-
- if (NIL_P(options)) {
- SSL_CTX_set_options(ctx, SSL_OP_ALL);
- } else {
- SSL_CTX_set_options(ctx, NUM2LONG(options));
- }
-
- return self;
-}
-
-/*
* call-seq:
* ctx.setup => Qtrue # first time
* ctx.setup => nil # thereafter
*
* This method is called automatically when a new SSLSocket is created.
- * However, it is not thread-safe and must be called before creating
- * SSLSocket objects in a multi-threaded program.
+ * Normally you do not need to call this method (unless you are writing an
+ * extension in C).
*/
static VALUE
ossl_sslctx_setup(VALUE self)
@@ -699,22 +661,21 @@ ossl_sslctx_setup(VALUE self)
X509_STORE *store;
EVP_PKEY *key = NULL;
char *ca_path = NULL, *ca_file = NULL;
- int verify_mode;
- long i;
+ int i, verify_mode;
VALUE val;
if(OBJ_FROZEN(self)) return Qnil;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
#if !defined(OPENSSL_NO_DH)
- SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
-#endif
-
-#if !defined(OPENSSL_NO_EC)
- if (RTEST(ossl_sslctx_get_tmp_ecdh_cb(self))){
- SSL_CTX_set_tmp_ecdh_callback(ctx, ossl_tmp_ecdh_callback);
+ if (RTEST(ossl_sslctx_get_tmp_dh_cb(self))){
+ SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
+ }
+ else{
+ SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
}
#endif
+ SSL_CTX_set_ex_data(ctx, ossl_ssl_ex_ptr_idx, (void*)self);
val = ossl_sslctx_get_cert_store(self);
if(!NIL_P(val)){
@@ -755,9 +716,9 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_client_ca(self);
if(!NIL_P(val)){
- if (RB_TYPE_P(val, T_ARRAY)) {
+ if(TYPE(val) == T_ARRAY){
for(i = 0; i < RARRAY_LEN(val); i++){
- client_ca = GetX509CertPtr(RARRAY_AREF(val, i));
+ client_ca = GetX509CertPtr(RARRAY_PTR(val)[i]);
if (!SSL_CTX_add_client_CA(ctx, client_ca)){
/* Copies X509_NAME => FREE it. */
ossl_raise(eSSLError, "SSL_CTX_add_client_CA");
@@ -794,10 +755,17 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_verify_dep(self);
if(!NIL_P(val)) SSL_CTX_set_verify_depth(ctx, NUM2INT(val));
-#ifdef HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB
+ val = ossl_sslctx_get_options(self);
+ if(!NIL_P(val)) {
+ SSL_CTX_set_options(ctx, NUM2LONG(val));
+ } else {
+ SSL_CTX_set_options(ctx, SSL_OP_ALL);
+ }
+
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
val = rb_iv_get(self, "@npn_protocols");
if (!NIL_P(val)) {
- rb_iv_set(self, "@_protocols", ssl_encode_npn_protocols(val));
+ ssl_npn_encode_protocols(self, val);
SSL_CTX_set_next_protos_advertised_cb(ctx, ssl_npn_advertise_cb, (void *) self);
OSSL_Debug("SSL NPN advertise callback added");
}
@@ -807,19 +775,6 @@ ossl_sslctx_setup(VALUE self)
}
#endif
-#ifdef HAVE_SSL_CTX_SET_ALPN_SELECT_CB
- val = rb_iv_get(self, "@alpn_protocols");
- if (!NIL_P(val)) {
- VALUE rprotos = ssl_encode_npn_protocols(val);
- SSL_CTX_set_alpn_protos(ctx, (const unsigned char *)StringValueCStr(rprotos), RSTRING_LENINT(rprotos));
- OSSL_Debug("SSL ALPN values added");
- }
- if (RTEST(rb_iv_get(self, "@alpn_select_cb"))) {
- SSL_CTX_set_alpn_select_cb(ctx, ssl_alpn_select_cb, (void *) self);
- OSSL_Debug("SSL ALPN select callback added");
- }
-#endif
-
rb_obj_freeze(self);
val = ossl_sslctx_get_sess_id_ctx(self);
@@ -886,7 +841,7 @@ ossl_sslctx_get_ciphers(VALUE self)
VALUE ary;
int i, num;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
if(!ctx){
rb_warning("SSL_CTX is not initialized.");
return Qnil;
@@ -927,11 +882,11 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
rb_check_frozen(self);
if (NIL_P(v))
return v;
- else if (RB_TYPE_P(v, T_ARRAY)) {
+ else if (TYPE(v) == T_ARRAY) {
str = rb_str_new(0, 0);
for (i = 0; i < RARRAY_LEN(v); i++) {
elem = rb_ary_entry(v, i);
- if (RB_TYPE_P(elem, T_ARRAY)) elem = rb_ary_entry(elem, 0);
+ if (TYPE(elem) == T_ARRAY) elem = rb_ary_entry(elem, 0);
elem = rb_String(elem);
rb_str_append(str, elem);
if (i < RARRAY_LEN(v)-1) rb_str_cat2(str, ":");
@@ -941,7 +896,7 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
StringValue(str);
}
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
if(!ctx){
ossl_raise(eSSLError, "SSL_CTX is not initialized.");
return Qnil;
@@ -965,7 +920,7 @@ ossl_sslctx_session_add(VALUE self, VALUE arg)
SSL_CTX *ctx;
SSL_SESSION *sess;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
SafeGetSSLSession(arg, sess);
return SSL_CTX_add_session(ctx, sess) == 1 ? Qtrue : Qfalse;
@@ -983,7 +938,7 @@ ossl_sslctx_session_remove(VALUE self, VALUE arg)
SSL_CTX *ctx;
SSL_SESSION *sess;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
SafeGetSSLSession(arg, sess);
return SSL_CTX_remove_session(ctx, sess) == 1 ? Qtrue : Qfalse;
@@ -1000,7 +955,7 @@ ossl_sslctx_get_session_cache_mode(VALUE self)
{
SSL_CTX *ctx;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
return LONG2NUM(SSL_CTX_get_session_cache_mode(ctx));
}
@@ -1018,7 +973,7 @@ ossl_sslctx_set_session_cache_mode(VALUE self, VALUE arg)
{
SSL_CTX *ctx;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
SSL_CTX_set_session_cache_mode(ctx, NUM2LONG(arg));
@@ -1037,7 +992,7 @@ ossl_sslctx_get_session_cache_size(VALUE self)
{
SSL_CTX *ctx;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
return LONG2NUM(SSL_CTX_sess_get_cache_size(ctx));
}
@@ -1054,7 +1009,7 @@ ossl_sslctx_set_session_cache_size(VALUE self, VALUE arg)
{
SSL_CTX *ctx;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
SSL_CTX_sess_set_cache_size(ctx, NUM2LONG(arg));
@@ -1089,7 +1044,7 @@ ossl_sslctx_get_session_cache_stats(VALUE self)
SSL_CTX *ctx;
VALUE hash;
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
hash = rb_hash_new();
rb_hash_aset(hash, ID2SYM(rb_intern("cache_num")), LONG2NUM(SSL_CTX_sess_number(ctx)));
@@ -1124,7 +1079,7 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
rb_scan_args(argc, argv, "01", &arg1);
- GetSSLCTX(self, ctx);
+ Data_Get_Struct(self, SSL_CTX, ctx);
if (NIL_P(arg1)) {
tm = time(0);
@@ -1156,7 +1111,7 @@ ossl_ssl_shutdown(SSL *ssl)
* Ignore the case SSL_shutdown returns -1. Empty handshake_func
* must not happen.
*/
- if ((rc = SSL_shutdown(ssl)) != 0)
+ if (rc = SSL_shutdown(ssl))
break;
}
SSL_clear(ssl);
@@ -1165,23 +1120,53 @@ ossl_ssl_shutdown(SSL *ssl)
}
static void
-ossl_ssl_free(void *ssl)
+ossl_ssl_free(SSL *ssl)
{
SSL_free(ssl);
}
-const rb_data_type_t ossl_ssl_type = {
- "OpenSSL/SSL",
- {
- 0, ossl_ssl_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
ossl_ssl_s_alloc(VALUE klass)
{
- return TypedData_Wrap_Struct(klass, &ossl_ssl_type, NULL);
+ return Data_Wrap_Struct(klass, 0, ossl_ssl_free, NULL);
+}
+
+/*
+ * call-seq:
+ * SSLSocket.new(io) => aSSLSocket
+ * SSLSocket.new(io, ctx) => aSSLSocket
+ *
+ * Creates a new SSL socket from +io+ which must be a real ruby object (not an
+ * IO-like object that responds to read/write).
+ *
+ * If +ctx+ is provided the SSL Sockets initial params will be taken from
+ * the context.
+ *
+ * The OpenSSL::Buffering module provides additional IO methods.
+ *
+ * This method will freeze the SSLContext if one is provided;
+ * however, session management is still allowed in the frozen SSLContext.
+ */
+static VALUE
+ossl_ssl_initialize(int argc, VALUE *argv, VALUE self)
+{
+ VALUE io, ctx;
+
+ if (rb_scan_args(argc, argv, "11", &io, &ctx) == 1) {
+ ctx = rb_funcall(cSSLContext, rb_intern("new"), 0);
+ }
+ OSSL_Check_Kind(ctx, cSSLContext);
+ Check_Type(io, T_FILE);
+ ossl_ssl_set_io(self, io);
+ ossl_ssl_set_ctx(self, ctx);
+ ossl_ssl_set_sync_close(self, Qfalse);
+ ossl_sslctx_setup(ctx);
+
+ rb_iv_set(self, "@hostname", Qnil);
+
+ rb_call_super(0, 0);
+
+ return self;
}
static VALUE
@@ -1192,14 +1177,14 @@ ossl_ssl_setup(VALUE self)
SSL *ssl;
rb_io_t *fptr;
- GetSSL(self, ssl);
+ Data_Get_Struct(self, SSL, ssl);
if(!ssl){
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
VALUE hostname = rb_iv_get(self, "@hostname");
#endif
v_ctx = ossl_ssl_get_ctx(self);
- GetSSLCTX(v_ctx, ctx);
+ Data_Get_Struct(v_ctx, SSL_CTX, ctx);
ssl = SSL_new(ctx);
if (!ssl) {
@@ -1221,6 +1206,10 @@ ossl_ssl_setup(VALUE self)
SSL_set_ex_data(ssl, ossl_ssl_ex_ptr_idx, (void*)self);
cb = ossl_sslctx_get_verify_cb(v_ctx);
SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void*)cb);
+ cb = ossl_sslctx_get_client_cert_cb(v_ctx);
+ SSL_set_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx, (void*)cb);
+ cb = ossl_sslctx_get_tmp_dh_cb(v_ctx);
+ SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx, (void*)cb);
SSL_set_info_callback(ssl, ssl_info_cb);
}
@@ -1235,7 +1224,7 @@ ossl_ssl_setup(VALUE self)
#define ossl_ssl_data_get_struct(v, ssl) \
do { \
- GetSSL((v), (ssl)); \
+ Data_Get_Struct((v), SSL, (ssl)); \
if (!(ssl)) { \
rb_warning("SSL session is not started yet."); \
return Qnil; \
@@ -1260,23 +1249,13 @@ read_would_block(int nonblock)
}
}
-static int
-no_exception_p(VALUE opts)
-{
- if (RB_TYPE_P(opts, T_HASH) &&
- rb_hash_lookup2(opts, sym_exception, Qundef) == Qfalse)
- return 1;
- return 0;
-}
-
static VALUE
-ossl_start_ssl(VALUE self, int (*func)(), const char *funcname, VALUE opts)
+ossl_start_ssl(VALUE self, int (*func)(), const char *funcname, int nonblock)
{
SSL *ssl;
rb_io_t *fptr;
int ret, ret2;
VALUE cb_state;
- int nonblock = opts != Qfalse;
rb_ivar_set(self, ID_callback_state, Qnil);
@@ -1295,12 +1274,10 @@ ossl_start_ssl(VALUE self, int (*func)(), const char *funcname, VALUE opts)
switch((ret2 = ssl_get_error(ssl, ret))){
case SSL_ERROR_WANT_WRITE:
- if (no_exception_p(opts)) { return sym_wait_writable; }
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- if (no_exception_p(opts)) { return sym_wait_readable; }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
@@ -1326,13 +1303,12 @@ static VALUE
ossl_ssl_connect(VALUE self)
{
ossl_ssl_setup(self);
-
- return ossl_start_ssl(self, SSL_connect, "SSL_connect", Qfalse);
+ return ossl_start_ssl(self, SSL_connect, "SSL_connect", 0);
}
/*
* call-seq:
- * ssl.connect_nonblock([options]) => self
+ * ssl.connect_nonblock => self
*
* Initiates the SSL/TLS handshake as a client in non-blocking manner.
*
@@ -1347,20 +1323,12 @@ ossl_ssl_connect(VALUE self)
* retry
* end
*
- * By specifying `exception: false`, the options hash allows you to indicate
- * that connect_nonblock should not raise an IO::WaitReadable or
- * IO::WaitWritable exception, but return the symbol :wait_readable or
- * :wait_writable instead.
*/
static VALUE
-ossl_ssl_connect_nonblock(int argc, VALUE *argv, VALUE self)
+ossl_ssl_connect_nonblock(VALUE self)
{
- VALUE opts;
- rb_scan_args(argc, argv, "0:", &opts);
-
ossl_ssl_setup(self);
-
- return ossl_start_ssl(self, SSL_connect, "SSL_connect", opts);
+ return ossl_start_ssl(self, SSL_connect, "SSL_connect", 1);
}
/*
@@ -1374,13 +1342,12 @@ static VALUE
ossl_ssl_accept(VALUE self)
{
ossl_ssl_setup(self);
-
- return ossl_start_ssl(self, SSL_accept, "SSL_accept", Qfalse);
+ return ossl_start_ssl(self, SSL_accept, "SSL_accept", 0);
}
/*
* call-seq:
- * ssl.accept_nonblock([options]) => self
+ * ssl.accept_nonblock => self
*
* Initiates the SSL/TLS handshake as a server in non-blocking manner.
*
@@ -1395,20 +1362,12 @@ ossl_ssl_accept(VALUE self)
* retry
* end
*
- * By specifying `exception: false`, the options hash allows you to indicate
- * that accept_nonblock should not raise an IO::WaitReadable or
- * IO::WaitWritable exception, but return the symbol :wait_readable or
- * :wait_writable instead.
*/
static VALUE
-ossl_ssl_accept_nonblock(int argc, VALUE *argv, VALUE self)
+ossl_ssl_accept_nonblock(VALUE self)
{
- VALUE opts;
-
- rb_scan_args(argc, argv, "0:", &opts);
ossl_ssl_setup(self);
-
- return ossl_start_ssl(self, SSL_accept, "SSL_accept", opts);
+ return ossl_start_ssl(self, SSL_accept, "SSL_accept", 1);
}
static VALUE
@@ -1416,15 +1375,15 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
{
SSL *ssl;
int ilen, nread = 0;
+ int no_exception = 0;
VALUE len, str;
rb_io_t *fptr;
VALUE opts = Qnil;
- if (nonblock) {
- rb_scan_args(argc, argv, "11:", &len, &str, &opts);
- } else {
- rb_scan_args(argc, argv, "11", &len, &str);
- }
+ rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exception = 1;
ilen = NUM2INT(len);
if(NIL_P(str)) str = rb_str_new(0, ilen);
@@ -1435,7 +1394,7 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
}
if(ilen == 0) return str;
- GetSSL(self, ssl);
+ Data_Get_Struct(self, SSL, ssl);
GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
if(!nonblock && SSL_pending(ssl) <= 0)
@@ -1446,21 +1405,21 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_ZERO_RETURN:
- if (no_exception_p(opts)) { return Qnil; }
+ if (no_exception) { return Qnil; }
rb_eof_error();
case SSL_ERROR_WANT_WRITE:
- if (no_exception_p(opts)) { return sym_wait_writable; }
+ if (no_exception) { return ID2SYM(rb_intern("wait_writable")); }
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- if (no_exception_p(opts)) { return sym_wait_readable; }
+ if (no_exception) { return ID2SYM(rb_intern("wait_readable")); }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_SYSCALL:
if(ERR_peek_error() == 0 && nread == 0) {
- if (no_exception_p(opts)) { return Qnil; }
+ if (no_exception) { return Qnil; }
rb_eof_error();
}
rb_sys_fail(0);
@@ -1472,11 +1431,7 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
else {
ID meth = nonblock ? rb_intern("read_nonblock") : rb_intern("sysread");
rb_warning("SSL session is not started yet.");
- if (nonblock) {
- return rb_funcall(ossl_ssl_get_io(self), meth, 3, len, str, opts);
- } else {
- return rb_funcall(ossl_ssl_get_io(self), meth, 2, len, str);
- }
+ return rb_funcall(ossl_ssl_get_io(self), meth, 2, len, str);
}
end:
@@ -1520,36 +1475,29 @@ ossl_ssl_read_nonblock(int argc, VALUE *argv, VALUE self)
}
static VALUE
-ossl_ssl_write_internal(VALUE self, VALUE str, VALUE opts)
+ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock, int no_exception)
{
SSL *ssl;
int nwrite = 0;
rb_io_t *fptr;
- int nonblock = opts != Qfalse;
StringValue(str);
- GetSSL(self, ssl);
+ Data_Get_Struct(self, SSL, ssl);
GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
for (;;){
- int num = RSTRING_LENINT(str);
-
- /* SSL_write(3ssl) manpage states num == 0 is undefined */
- if (num == 0)
- goto end;
-
- nwrite = SSL_write(ssl, RSTRING_PTR(str), num);
+ nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
switch(ssl_get_error(ssl, nwrite)){
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_WANT_WRITE:
- if (no_exception_p(opts)) { return sym_wait_writable; }
+ if (no_exception) { return ID2SYM(rb_intern("wait_writable")); }
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- if (no_exception_p(opts)) { return sym_wait_readable; }
+ if (no_exception) { return ID2SYM(rb_intern("wait_readable")); }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
@@ -1579,7 +1527,7 @@ ossl_ssl_write_internal(VALUE self, VALUE str, VALUE opts)
static VALUE
ossl_ssl_write(VALUE self, VALUE str)
{
- return ossl_ssl_write_internal(self, str, Qfalse);
+ return ossl_ssl_write_internal(self, str, 0, 0);
}
/*
@@ -1592,28 +1540,41 @@ ossl_ssl_write(VALUE self, VALUE str)
static VALUE
ossl_ssl_write_nonblock(int argc, VALUE *argv, VALUE self)
{
- VALUE str, opts;
+ VALUE str;
+ VALUE opts = Qnil;
+ int no_exception = 0;
rb_scan_args(argc, argv, "1:", &str, &opts);
- return ossl_ssl_write_internal(self, str, opts);
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exception = 1;
+
+ return ossl_ssl_write_internal(self, str, 1, no_exception);
}
/*
* call-seq:
- * ssl.stop => nil
+ * ssl.sysclose => nil
*
- * Sends "close notify" to the peer and tries to shut down the SSL connection
- * gracefully.
+ * Shuts down the SSL connection and prepares it for another connection.
*/
static VALUE
-ossl_ssl_stop(VALUE self)
+ossl_ssl_close(VALUE self)
{
SSL *ssl;
ossl_ssl_data_get_struct(self, ssl);
- ossl_ssl_shutdown(ssl);
+ if (ssl) {
+ VALUE io = ossl_ssl_get_io(self);
+ if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
+ ossl_ssl_shutdown(ssl);
+ SSL_free(ssl);
+ DATA_PTR(self) = NULL;
+ if (RTEST(ossl_ssl_get_sync_close(self)))
+ rb_funcall(io, rb_intern("close"), 0);
+ }
+ }
return Qnil;
}
@@ -1862,7 +1823,7 @@ ossl_ssl_get_client_ca_list(VALUE self)
return ossl_x509name_sk2ary(ca);
}
-# ifdef HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB
+# ifdef HAVE_OPENSSL_NPN_NEGOTIATED
/*
* call-seq:
* ssl.npn_protocol => String
@@ -1886,35 +1847,10 @@ ossl_ssl_npn_protocol(VALUE self)
return rb_str_new((const char *) out, outlen);
}
# endif
-
-# ifdef HAVE_SSL_CTX_SET_ALPN_SELECT_CB
-/*
- * call-seq:
- * ssl.alpn_protocol => String
- *
- * Returns the ALPN protocol string that was finally selected by the client
- * during the handshake.
- */
-static VALUE
-ossl_ssl_alpn_protocol(VALUE self)
-{
- SSL *ssl;
- const unsigned char *out;
- unsigned int outlen;
-
- ossl_ssl_data_get_struct(self, ssl);
-
- SSL_get0_alpn_selected(ssl, &out, &outlen);
- if (!outlen)
- return Qnil;
- else
- return rb_str_new((const char *) out, outlen);
-}
-# endif
#endif /* !defined(OPENSSL_NO_SOCK) */
void
-Init_ossl_ssl(void)
+Init_ossl_ssl()
{
int i;
VALUE ary;
@@ -1928,6 +1864,10 @@ Init_ossl_ssl(void)
ossl_ssl_ex_vcb_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_vcb_idx",0,0,0);
ossl_ssl_ex_store_p = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_store_p",0,0,0);
ossl_ssl_ex_ptr_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_ptr_idx",0,0,0);
+ ossl_ssl_ex_client_cert_cb_idx =
+ SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_client_cert_cb_idx",0,0,0);
+ ossl_ssl_ex_tmp_dh_callback_idx =
+ SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0);
/* Document-module: OpenSSL::SSL
*
@@ -1937,17 +1877,6 @@ Init_ossl_ssl(void)
* of SSLContext to set up connections.
*/
mSSL = rb_define_module_under(mOSSL, "SSL");
-
- /* Document-module: OpenSSL::ExtConfig
- *
- * This module contains configuration information about the SSL extension,
- * for example if socket support is enabled, or the host name TLS extension
- * is enabled. Constants in this module will always be defined, but contain
- * `true` or `false` values depending on the configuration of your OpenSSL
- * installation.
- */
- mSSLExtConfig = rb_define_module_under(mOSSL, "ExtConfig");
-
/* Document-class: OpenSSL::SSL::SSLError
*
* Generic error class raised by SSLSocket and SSLContext.
@@ -2036,6 +1965,11 @@ Init_ossl_ssl(void)
rb_attr(cSSLContext, rb_intern("verify_callback"), 1, 1, Qfalse);
/*
+ * Sets various OpenSSL options.
+ */
+ rb_attr(cSSLContext, rb_intern("options"), 1, 1, Qfalse);
+
+ /*
* An OpenSSL::X509::Store used for certificate verification
*/
rb_attr(cSSLContext, rb_intern("cert_store"), 1, 1, Qfalse);
@@ -2057,20 +1991,20 @@ Init_ossl_ssl(void)
rb_attr(cSSLContext, rb_intern("client_cert_cb"), 1, 1, Qfalse);
/*
- * A callback invoked when ECDH parameters are required.
+ * A callback invoked when DH parameters are required.
*
* The callback is invoked with the Session for the key exchange, an
* flag indicating the use of an export cipher and the keylength
* required.
*
- * The callback must return an OpenSSL::PKey::EC instance of the correct
+ * The callback must return an OpenSSL::PKey::DH instance of the correct
* key length.
*/
- rb_attr(cSSLContext, rb_intern("tmp_ecdh_callback"), 1, 1, Qfalse);
+ rb_attr(cSSLContext, rb_intern("tmp_dh_callback"), 1, 1, Qfalse);
/*
* Sets the context in which a session can be reused. This allows
- * sessions for multiple applications to be distinguished, for example, by
+ * sessions for multiple applications to be distinguished, for exapmle, by
* name.
*/
rb_attr(cSSLContext, rb_intern("session_id_context"), 1, 1, Qfalse);
@@ -2085,7 +2019,7 @@ Init_ossl_ssl(void)
rb_attr(cSSLContext, rb_intern("session_get_cb"), 1, 1, Qfalse);
/*
- * A callback invoked when a new session was negotiated.
+ * A callback invoked when a new session was negotiatied.
*
* The callback is invoked with an SSLSocket. If false is returned the
* session will be removed from the internal cache.
@@ -2100,17 +2034,15 @@ Init_ossl_ssl(void)
rb_attr(cSSLContext, rb_intern("session_remove_cb"), 1, 1, Qfalse);
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
- rb_define_const(mSSLExtConfig, "HAVE_TLSEXT_HOST_NAME", Qtrue);
-#else
- rb_define_const(mSSLExtConfig, "HAVE_TLSEXT_HOST_NAME", Qfalse);
-#endif
-
-#ifdef TLS_DH_anon_WITH_AES_256_GCM_SHA384
- rb_define_const(mSSLExtConfig, "TLS_DH_anon_WITH_AES_256_GCM_SHA384", Qtrue);
-#else
- rb_define_const(mSSLExtConfig, "TLS_DH_anon_WITH_AES_256_GCM_SHA384", Qfalse);
+ /*
+ * A callback invoked at connect time to distinguish between multiple
+ * server names.
+ *
+ * The callback is invoked with an SSLSocket and a server name. The
+ * callback must return an SSLContext for the server name or nil.
+ */
+ rb_attr(cSSLContext, rb_intern("servername_cb"), 1, 1, Qfalse);
#endif
-
/*
* A callback invoked whenever a new handshake is initiated. May be used
* to disable renegotiation entirely.
@@ -2133,7 +2065,7 @@ Init_ossl_ssl(void)
* end
*/
rb_attr(cSSLContext, rb_intern("renegotiation_cb"), 1, 1, Qfalse);
-#ifdef HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB
+#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
/*
* An Enumerable of Strings. Each String represents a protocol to be
* advertised as the list of supported protocols for Next Protocol
@@ -2165,40 +2097,9 @@ Init_ossl_ssl(void)
rb_attr(cSSLContext, rb_intern("npn_select_cb"), 1, 1, Qfalse);
#endif
-#ifdef HAVE_SSL_CTX_SET_ALPN_SELECT_CB
- /*
- * An Enumerable of Strings. Each String represents a protocol to be
- * advertised as the list of supported protocols for Application-Layer Protocol
- * Negotiation. Supported in OpenSSL 1.0.1 and higher. Has no effect
- * on the client side. If not set explicitly, the NPN extension will
- * not be sent by the server in the handshake.
- *
- * === Example
- *
- * ctx.alpn_protocols = ["http/1.1", "spdy/2", "h2"]
- */
- rb_attr(cSSLContext, rb_intern("alpn_protocols"), 1, 1, Qfalse);
- /*
- * A callback invoked on the server side when the server needs to select
- * a protocol from the list sent by the client. Supported in OpenSSL 1.0.2
- * and higher. The server MUST select a protocol of those advertised by
- * the client. If none is acceptable, raising an error in the callback
- * will cause the handshake to fail. Not setting this callback explicitly
- * means not supporting the ALPN extension on the client - any protocols
- * advertised by the server will be ignored.
- *
- * === Example
- *
- * ctx.alpn_select_cb = lambda do |protocols|
- * #inspect the protocols and select one
- * protocols.first
- * end
- */
- rb_attr(cSSLContext, rb_intern("alpn_select_cb"), 1, 1, Qfalse);
-#endif
-
rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
rb_define_alias(cSSLContext, "ssl_timeout=", "timeout=");
+ rb_define_method(cSSLContext, "initialize", ossl_sslctx_initialize, -1);
rb_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1);
rb_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers, 0);
rb_define_method(cSSLContext, "ciphers=", ossl_sslctx_set_ciphers, 1);
@@ -2260,8 +2161,6 @@ Init_ossl_ssl(void)
rb_define_method(cSSLContext, "session_cache_size=", ossl_sslctx_set_session_cache_size, 1);
rb_define_method(cSSLContext, "session_cache_stats", ossl_sslctx_get_session_cache_stats, 0);
rb_define_method(cSSLContext, "flush_sessions", ossl_sslctx_flush_sessions, -1);
- rb_define_method(cSSLContext, "options", ossl_sslctx_get_options, 0);
- rb_define_method(cSSLContext, "options=", ossl_sslctx_set_options, 1);
ary = rb_ary_new2(numberof(ossl_ssl_method_tab));
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
@@ -2280,19 +2179,24 @@ Init_ossl_ssl(void)
*/
cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject);
#ifdef OPENSSL_NO_SOCK
- rb_define_const(mSSLExtConfig, "OPENSSL_NO_SOCK", Qtrue);
+ rb_define_method(cSSLSocket, "initialize", rb_notimplement, -1);
#else
- rb_define_const(mSSLExtConfig, "OPENSSL_NO_SOCK", Qfalse);
rb_define_alloc_func(cSSLSocket, ossl_ssl_s_alloc);
+ for(i = 0; i < numberof(ossl_ssl_attr_readers); i++)
+ rb_attr(cSSLSocket, rb_intern(ossl_ssl_attr_readers[i]), 1, 0, Qfalse);
+ for(i = 0; i < numberof(ossl_ssl_attrs); i++)
+ rb_attr(cSSLSocket, rb_intern(ossl_ssl_attrs[i]), 1, 1, Qfalse);
+ rb_define_alias(cSSLSocket, "to_io", "io");
+ rb_define_method(cSSLSocket, "initialize", ossl_ssl_initialize, -1);
rb_define_method(cSSLSocket, "connect", ossl_ssl_connect, 0);
- rb_define_method(cSSLSocket, "connect_nonblock", ossl_ssl_connect_nonblock, -1);
+ rb_define_method(cSSLSocket, "connect_nonblock", ossl_ssl_connect_nonblock, 0);
rb_define_method(cSSLSocket, "accept", ossl_ssl_accept, 0);
- rb_define_method(cSSLSocket, "accept_nonblock", ossl_ssl_accept_nonblock, -1);
+ rb_define_method(cSSLSocket, "accept_nonblock", ossl_ssl_accept_nonblock, 0);
rb_define_method(cSSLSocket, "sysread", ossl_ssl_read, -1);
rb_define_private_method(cSSLSocket, "sysread_nonblock", ossl_ssl_read_nonblock, -1);
rb_define_method(cSSLSocket, "syswrite", ossl_ssl_write, 1);
rb_define_private_method(cSSLSocket, "syswrite_nonblock", ossl_ssl_write_nonblock, -1);
- rb_define_private_method(cSSLSocket, "stop", ossl_ssl_stop, 0);
+ rb_define_method(cSSLSocket, "sysclose", ossl_ssl_close, 0);
rb_define_method(cSSLSocket, "cert", ossl_ssl_get_cert, 0);
rb_define_method(cSSLSocket, "peer_cert", ossl_ssl_get_peer_cert, 0);
rb_define_method(cSSLSocket, "peer_cert_chain", ossl_ssl_get_peer_cert_chain, 0);
@@ -2305,15 +2209,12 @@ Init_ossl_ssl(void)
rb_define_method(cSSLSocket, "session=", ossl_ssl_set_session, 1);
rb_define_method(cSSLSocket, "verify_result", ossl_ssl_get_verify_result, 0);
rb_define_method(cSSLSocket, "client_ca", ossl_ssl_get_client_ca_list, 0);
-# ifdef HAVE_SSL_CTX_SET_ALPN_SELECT_CB
- rb_define_method(cSSLSocket, "alpn_protocol", ossl_ssl_alpn_protocol, 0);
-# endif
-# ifdef HAVE_SSL_CTX_SET_NEXT_PROTO_SELECT_CB
+# ifdef HAVE_OPENSSL_NPN_NEGOTIATED
rb_define_method(cSSLSocket, "npn_protocol", ossl_ssl_npn_protocol, 0);
# endif
#endif
-#define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, LONG2NUM(SSL_##x))
+#define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x))
ossl_ssl_def_const(VERIFY_NONE);
ossl_ssl_def_const(VERIFY_PEER);
@@ -2328,9 +2229,7 @@ Init_ossl_ssl(void)
ossl_ssl_def_const(OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
ossl_ssl_def_const(OP_SSLREF2_REUSE_CERT_TYPE_BUG);
ossl_ssl_def_const(OP_MICROSOFT_BIG_SSLV3_BUFFER);
-#if defined(SSL_OP_MSIE_SSLV2_RSA_PADDING)
ossl_ssl_def_const(OP_MSIE_SSLV2_RSA_PADDING);
-#endif
ossl_ssl_def_const(OP_SSLEAY_080_CLIENT_DH_BUG);
ossl_ssl_def_const(OP_TLS_D5_BUG);
ossl_ssl_def_const(OP_TLS_BLOCK_PADDING_BUG);
@@ -2368,8 +2267,5 @@ Init_ossl_ssl(void)
ossl_ssl_def_const(OP_NETSCAPE_CA_DN_BUG);
ossl_ssl_def_const(OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
-#undef rb_intern
sym_exception = ID2SYM(rb_intern("exception"));
- sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
- sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
}
diff --git a/ext/openssl/ossl_ssl.h b/ext/openssl/ossl_ssl.h
index 909f6798c4..034762fc46 100644
--- a/ext/openssl/ossl_ssl.h
+++ b/ext/openssl/ossl_ssl.h
@@ -1,21 +1,18 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_SSL_H_)
#define _OSSL_SSL_H_
-#define GetSSL(obj, ssl) do { \
- TypedData_Get_Struct((obj), SSL, &ossl_ssl_type, (ssl)); \
-} while (0)
-
#define GetSSLSession(obj, sess) do { \
- TypedData_Get_Struct((obj), SSL_SESSION, &ossl_ssl_session_type, (sess)); \
+ Data_Get_Struct((obj), SSL_SESSION, (sess)); \
if (!(sess)) { \
ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
} \
@@ -26,13 +23,14 @@
GetSSLSession((obj), (sess)); \
} while (0)
-extern const rb_data_type_t ossl_ssl_type;
-extern const rb_data_type_t ossl_ssl_session_type;
extern VALUE mSSL;
+extern VALUE eSSLError;
extern VALUE cSSLSocket;
+extern VALUE cSSLContext;
extern VALUE cSSLSession;
void Init_ossl_ssl(void);
void Init_ossl_ssl_session(void);
#endif /* _OSSL_SSL_H_ */
+
diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c
index e1bbc6fb54..a7437caf37 100644
--- a/ext/openssl/ossl_ssl_session.c
+++ b/ext/openssl/ossl_ssl_session.c
@@ -4,26 +4,25 @@
#include "ossl.h"
-VALUE cSSLSession;
-static VALUE eSSLSession;
+#define GetSSLSession(obj, sess) do { \
+ Data_Get_Struct((obj), SSL_SESSION, (sess)); \
+ if (!(sess)) { \
+ ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
+ } \
+} while (0)
-static void
-ossl_ssl_session_free(void *ptr)
-{
- SSL_SESSION_free(ptr);
-}
+#define SafeGetSSLSession(obj, sess) do { \
+ OSSL_Check_Kind((obj), cSSLSession); \
+ GetSSLSession((obj), (sess)); \
+} while (0)
-const rb_data_type_t ossl_ssl_session_type = {
- "OpenSSL/SSL/Session",
- {
- 0, ossl_ssl_session_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
+
+VALUE cSSLSession;
+static VALUE eSSLSession;
static VALUE ossl_ssl_session_alloc(VALUE klass)
{
- return TypedData_Wrap_Struct(klass, &ossl_ssl_session_type, NULL);
+ return Data_Wrap_Struct(klass, 0, SSL_SESSION_free, NULL);
}
/*
@@ -44,7 +43,7 @@ static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1)
if (rb_obj_is_instance_of(arg1, cSSLSocket)) {
SSL *ssl;
- GetSSL(arg1, ssl);
+ Data_Get_Struct(arg1, SSL, ssl);
if (!ssl || (ctx = SSL_get1_session(ssl)) == NULL)
ossl_raise(eSSLSession, "no session available");
@@ -79,11 +78,7 @@ int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b)
if (a->ssl_version != b->ssl_version ||
a->session_id_length != b->session_id_length)
return 1;
-#if defined(_WIN32)
- return memcmp(a->session_id, b->session_id, a->session_id_length);
-#else
- return CRYPTO_memcmp(a->session_id, b->session_id, a->session_id_length);
-#endif
+ return memcmp(a->session_id,b-> session_id, a->session_id_length);
}
#endif
diff --git a/ext/openssl/ossl_version.h b/ext/openssl/ossl_version.h
index dcd026a19c..193ceab089 100644
--- a/ext/openssl/ossl_version.h
+++ b/ext/openssl/ossl_version.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_VERSION_H_)
diff --git a/ext/openssl/ossl_x509.c b/ext/openssl/ossl_x509.c
index 2fd14566cd..fd1d9b6c7e 100644
--- a/ext/openssl/ossl_x509.c
+++ b/ext/openssl/ossl_x509.c
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
@@ -16,7 +17,7 @@ VALUE mX509;
rb_define_const(mX509, "DEFAULT_" #x, rb_str_new2(X509_get_default_##i()))
void
-Init_ossl_x509(void)
+Init_ossl_x509()
{
mX509 = rb_define_module_under(mOSSL, "X509");
@@ -100,3 +101,4 @@ Init_ossl_x509(void)
DefX509Default(CERT_FILE_ENV, cert_file_env);
DefX509Default(PRIVATE_DIR, private_dir);
}
+
diff --git a/ext/openssl/ossl_x509.h b/ext/openssl/ossl_x509.h
index 9dedb9a49a..1a43569073 100644
--- a/ext/openssl/ossl_x509.h
+++ b/ext/openssl/ossl_x509.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_X509_H_)
@@ -24,7 +25,7 @@ extern VALUE cX509Attr;
extern VALUE eX509AttrError;
VALUE ossl_x509attr_new(X509_ATTRIBUTE *);
-X509_ATTRIBUTE *GetX509AttrPtr(VALUE);
+X509_ATTRIBUTE *DupX509AttrPtr(VALUE);
void Init_ossl_x509attr(void);
/*
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index b5a2441807..d50f88c969 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509Attr(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509attr_type, 0)
-#define SetX509Attr(obj, attr) do { \
+#define WrapX509Attr(klass, obj, attr) do { \
if (!(attr)) { \
ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (attr); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_ATTRIBUTE_free, (attr)); \
} while (0)
#define GetX509Attr(obj, attr) do { \
- TypedData_Get_Struct((obj), X509_ATTRIBUTE, &ossl_x509attr_type, (attr)); \
+ Data_Get_Struct((obj), X509_ATTRIBUTE, (attr)); \
if (!(attr)) { \
ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
} \
@@ -34,20 +33,6 @@
VALUE cX509Attr;
VALUE eX509AttrError;
-static void
-ossl_x509attr_free(void *ptr)
-{
- X509_ATTRIBUTE_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509attr_type = {
- "OpenSSL/X509/ATTRIBUTE",
- {
- 0, ossl_x509attr_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
*/
@@ -57,7 +42,6 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr)
X509_ATTRIBUTE *new;
VALUE obj;
- obj = NewX509Attr(cX509Attr);
if (!attr) {
new = X509_ATTRIBUTE_new();
} else {
@@ -66,19 +50,22 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr)
if (!new) {
ossl_raise(eX509AttrError, NULL);
}
- SetX509Attr(obj, new);
+ WrapX509Attr(cX509Attr, obj, new);
return obj;
}
X509_ATTRIBUTE *
-GetX509AttrPtr(VALUE obj)
+DupX509AttrPtr(VALUE obj)
{
- X509_ATTRIBUTE *attr;
+ X509_ATTRIBUTE *attr, *new;
SafeGetX509Attr(obj, attr);
+ if (!(new = X509_ATTRIBUTE_dup(attr))) {
+ ossl_raise(eX509AttrError, NULL);
+ }
- return attr;
+ return new;
}
/*
@@ -90,10 +77,9 @@ ossl_x509attr_alloc(VALUE klass)
X509_ATTRIBUTE *attr;
VALUE obj;
- obj = NewX509Attr(klass);
if (!(attr = X509_ATTRIBUTE_new()))
ossl_raise(eX509AttrError, NULL);
- SetX509Attr(obj, attr);
+ WrapX509Attr(klass, obj, attr);
return obj;
}
@@ -138,15 +124,12 @@ ossl_x509attr_set_oid(VALUE self, VALUE oid)
ASN1_OBJECT *obj;
char *s;
- GetX509Attr(self, attr);
- s = StringValueCStr(oid);
+ s = StringValuePtr(oid);
obj = OBJ_txt2obj(s, 0);
+ if(!obj) obj = OBJ_txt2obj(s, 1);
if(!obj) ossl_raise(eX509AttrError, NULL);
- if (!X509_ATTRIBUTE_set1_object(attr, obj)) {
- ASN1_OBJECT_free(obj);
- ossl_raise(eX509AttrError, "X509_ATTRIBUTE_set1_object");
- }
- ASN1_OBJECT_free(obj);
+ GetX509Attr(self, attr);
+ X509_ATTRIBUTE_set1_object(attr, obj);
return oid;
}
@@ -277,7 +260,7 @@ ossl_x509attr_to_der(VALUE self)
* X509_ATTRIBUTE init
*/
void
-Init_ossl_x509attr(void)
+Init_ossl_x509attr()
{
eX509AttrError = rb_define_class_under(mX509, "AttributeError", eOSSLError);
diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c
index 4dafae17b9..84cedc763a 100644
--- a/ext/openssl/ossl_x509cert.c
+++ b/ext/openssl/ossl_x509cert.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509_type, 0)
-#define SetX509(obj, x509) do { \
+#define WrapX509(klass, obj, x509) do { \
if (!(x509)) { \
ossl_raise(rb_eRuntimeError, "CERT wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (x509); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_free, (x509)); \
} while (0)
#define GetX509(obj, x509) do { \
- TypedData_Get_Struct((obj), X509, &ossl_x509_type, (x509)); \
+ Data_Get_Struct((obj), X509, (x509)); \
if (!(x509)) { \
ossl_raise(rb_eRuntimeError, "CERT wasn't initialized!"); \
} \
@@ -34,20 +33,6 @@
VALUE cX509Cert;
VALUE eX509CertError;
-static void
-ossl_x509_free(void *ptr)
-{
- X509_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509_type = {
- "OpenSSL/X509",
- {
- 0, ossl_x509_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
*/
@@ -57,7 +42,6 @@ ossl_x509_new(X509 *x509)
X509 *new;
VALUE obj;
- obj = NewX509(cX509Cert);
if (!x509) {
new = X509_new();
} else {
@@ -66,7 +50,7 @@ ossl_x509_new(X509 *x509)
if (!new) {
ossl_raise(eX509CertError, NULL);
}
- SetX509(obj, new);
+ WrapX509(cX509Cert, obj, new);
return obj;
}
@@ -79,7 +63,6 @@ ossl_x509_new_from_file(VALUE filename)
VALUE obj;
SafeStringValue(filename);
- obj = NewX509(cX509Cert);
if (!(fp = fopen(RSTRING_PTR(filename), "r"))) {
ossl_raise(eX509CertError, "%s", strerror(errno));
}
@@ -100,7 +83,7 @@ ossl_x509_new_from_file(VALUE filename)
if (!x509) {
ossl_raise(eX509CertError, NULL);
}
- SetX509(obj, x509);
+ WrapX509(cX509Cert, obj, x509);
return obj;
}
@@ -136,10 +119,10 @@ ossl_x509_alloc(VALUE klass)
X509 *x509;
VALUE obj;
- obj = NewX509(klass);
x509 = X509_new();
if (!x509) ossl_raise(eX509CertError, NULL);
- SetX509(obj, x509);
+
+ WrapX509(klass, obj, x509);
return obj;
}
@@ -663,18 +646,18 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
{
X509 *x509;
X509_EXTENSION *ext;
- long i;
+ int i;
Check_Type(ary, T_ARRAY);
/* All ary's members should be X509Extension */
for (i=0; i<RARRAY_LEN(ary); i++) {
- OSSL_Check_Kind(RARRAY_AREF(ary, i), cX509Ext);
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509(self, x509);
sk_X509_EXTENSION_pop_free(x509->cert_info->extensions, X509_EXTENSION_free);
x509->cert_info->extensions = NULL;
for (i=0; i<RARRAY_LEN(ary); i++) {
- ext = DupX509ExtPtr(RARRAY_AREF(ary, i));
+ ext = DupX509ExtPtr(RARRAY_PTR(ary)[i]);
if (!X509_add_ext(x509, ext, -1)) { /* DUPs ext - FREE it */
X509_EXTENSION_free(ext);
@@ -710,22 +693,42 @@ ossl_x509_add_extension(VALUE self, VALUE extension)
static VALUE
ossl_x509_inspect(VALUE self)
{
- return rb_sprintf("#<%"PRIsVALUE": subject=%+"PRIsVALUE", "
- "issuer=%+"PRIsVALUE", serial=%+"PRIsVALUE", "
- "not_before=%+"PRIsVALUE", not_after=%+"PRIsVALUE">",
- rb_obj_class(self),
- ossl_x509_get_subject(self),
- ossl_x509_get_issuer(self),
- ossl_x509_get_serial(self),
- ossl_x509_get_not_before(self),
- ossl_x509_get_not_after(self));
+ VALUE str;
+ const char *cname = rb_class2name(rb_obj_class(self));
+
+ str = rb_str_new2("#<");
+ rb_str_cat2(str, cname);
+ rb_str_cat2(str, " ");
+
+ rb_str_cat2(str, "subject=");
+ rb_str_append(str, rb_inspect(ossl_x509_get_subject(self)));
+ rb_str_cat2(str, ", ");
+
+ rb_str_cat2(str, "issuer=");
+ rb_str_append(str, rb_inspect(ossl_x509_get_issuer(self)));
+ rb_str_cat2(str, ", ");
+
+ rb_str_cat2(str, "serial=");
+ rb_str_append(str, rb_inspect(ossl_x509_get_serial(self)));
+ rb_str_cat2(str, ", ");
+
+ rb_str_cat2(str, "not_before=");
+ rb_str_append(str, rb_inspect(ossl_x509_get_not_before(self)));
+ rb_str_cat2(str, ", ");
+
+ rb_str_cat2(str, "not_after=");
+ rb_str_append(str, rb_inspect(ossl_x509_get_not_after(self)));
+
+ str = rb_str_cat2(str, ">");
+
+ return str;
}
/*
* INIT
*/
void
-Init_ossl_x509cert(void)
+Init_ossl_x509cert()
{
#if 0
@@ -860,3 +863,4 @@ Init_ossl_x509cert(void)
rb_define_method(cX509Cert, "add_extension", ossl_x509_add_extension, 1);
rb_define_method(cX509Cert, "inspect", ossl_x509_inspect, 0);
}
+
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index 3905762d3c..dec13c8cae 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509CRL(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509crl_type, 0)
-#define SetX509CRL(obj, crl) do { \
+#define WrapX509CRL(klass, obj, crl) do { \
if (!(crl)) { \
ossl_raise(rb_eRuntimeError, "CRL wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (crl); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_CRL_free, (crl)); \
} while (0)
#define GetX509CRL(obj, crl) do { \
- TypedData_Get_Struct((obj), X509_CRL, &ossl_x509crl_type, (crl)); \
+ Data_Get_Struct((obj), X509_CRL, (crl)); \
if (!(crl)) { \
ossl_raise(rb_eRuntimeError, "CRL wasn't initialized!"); \
} \
@@ -34,20 +33,6 @@
VALUE cX509CRL;
VALUE eX509CRLError;
-static void
-ossl_x509crl_free(void *ptr)
-{
- X509_CRL_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509crl_type = {
- "OpenSSL/X509/CRL",
- {
- 0, ossl_x509crl_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* PUBLIC
*/
@@ -78,10 +63,9 @@ ossl_x509crl_new(X509_CRL *crl)
X509_CRL *tmp;
VALUE obj;
- obj = NewX509CRL(cX509CRL);
tmp = crl ? X509_CRL_dup(crl) : X509_CRL_new();
if(!tmp) ossl_raise(eX509CRLError, NULL);
- SetX509CRL(obj, tmp);
+ WrapX509CRL(cX509CRL, obj, tmp);
return obj;
}
@@ -95,11 +79,10 @@ ossl_x509crl_alloc(VALUE klass)
X509_CRL *crl;
VALUE obj;
- obj = NewX509CRL(klass);
if (!(crl = X509_CRL_new())) {
ossl_raise(eX509CRLError, NULL);
}
- SetX509CRL(obj, crl);
+ WrapX509CRL(klass, obj, crl);
return obj;
}
@@ -302,21 +285,20 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary)
{
X509_CRL *crl;
X509_REVOKED *rev;
- long i;
+ int i;
Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Revoked */
for (i=0; i<RARRAY_LEN(ary); i++) {
- OSSL_Check_Kind(RARRAY_AREF(ary, i), cX509Rev);
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Rev);
}
GetX509CRL(self, crl);
sk_X509_REVOKED_pop_free(crl->crl->revoked, X509_REVOKED_free);
crl->crl->revoked = NULL;
for (i=0; i<RARRAY_LEN(ary); i++) {
- rev = DupX509RevokedPtr(RARRAY_AREF(ary, i));
+ rev = DupX509RevokedPtr(RARRAY_PTR(ary)[i]);
if (!X509_CRL_add0_revoked(crl, rev)) { /* NO DUP - don't free! */
- X509_REVOKED_free(rev);
- ossl_raise(eX509CRLError, "X509_CRL_add0_revoked");
+ ossl_raise(eX509CRLError, NULL);
}
}
X509_CRL_sort(crl);
@@ -333,8 +315,7 @@ ossl_x509crl_add_revoked(VALUE self, VALUE revoked)
GetX509CRL(self, crl);
rev = DupX509RevokedPtr(revoked);
if (!X509_CRL_add0_revoked(crl, rev)) { /* NO DUP - don't free! */
- X509_REVOKED_free(rev);
- ossl_raise(eX509CRLError, "X509_CRL_add0_revoked");
+ ossl_raise(eX509CRLError, NULL);
}
X509_CRL_sort(crl);
@@ -478,18 +459,18 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary)
{
X509_CRL *crl;
X509_EXTENSION *ext;
- long i;
+ int i;
Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Extensions */
for (i=0; i<RARRAY_LEN(ary); i++) {
- OSSL_Check_Kind(RARRAY_AREF(ary, i), cX509Ext);
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509CRL(self, crl);
sk_X509_EXTENSION_pop_free(crl->crl->extensions, X509_EXTENSION_free);
crl->crl->extensions = NULL;
for (i=0; i<RARRAY_LEN(ary); i++) {
- ext = DupX509ExtPtr(RARRAY_AREF(ary, i));
+ ext = DupX509ExtPtr(RARRAY_PTR(ary)[i]);
if(!X509_CRL_add_ext(crl, ext, -1)) { /* DUPs ext - FREE it */
X509_EXTENSION_free(ext);
ossl_raise(eX509CRLError, NULL);
@@ -521,7 +502,7 @@ ossl_x509crl_add_extension(VALUE self, VALUE extension)
* INIT
*/
void
-Init_ossl_x509crl(void)
+Init_ossl_x509crl()
{
eX509CRLError = rb_define_class_under(mX509, "CRLError", eOSSLError);
@@ -553,3 +534,4 @@ Init_ossl_x509crl(void)
rb_define_method(cX509CRL, "extensions=", ossl_x509crl_set_extensions, 1);
rb_define_method(cX509CRL, "add_extension", ossl_x509crl_add_extension, 1);
}
+
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index f1058a0c1f..bd2e1dd2fa 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509Ext(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509ext_type, 0)
-#define SetX509Ext(obj, ext) do { \
+#define WrapX509Ext(klass, obj, ext) do { \
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (ext); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_EXTENSION_free, (ext)); \
} while (0)
#define GetX509Ext(obj, ext) do { \
- TypedData_Get_Struct((obj), X509_EXTENSION, &ossl_x509ext_type, (ext)); \
+ Data_Get_Struct((obj), X509_EXTENSION, (ext)); \
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
@@ -28,14 +27,13 @@
GetX509Ext((obj), (ext)); \
} while (0)
#define MakeX509ExtFactory(klass, obj, ctx) do { \
- (obj) = TypedData_Wrap_Struct((klass), &ossl_x509extfactory_type, 0); \
if (!((ctx) = OPENSSL_malloc(sizeof(X509V3_CTX)))) \
ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \
X509V3_set_ctx((ctx), NULL, NULL, NULL, NULL, 0); \
- RTYPEDDATA_DATA(obj) = (ctx); \
+ (obj) = Data_Wrap_Struct((klass), 0, ossl_x509extfactory_free, (ctx)); \
} while (0)
#define GetX509ExtFactory(obj, ctx) do { \
- TypedData_Get_Struct((obj), X509V3_CTX, &ossl_x509extfactory_type, (ctx)); \
+ Data_Get_Struct((obj), X509V3_CTX, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \
} \
@@ -48,20 +46,6 @@ VALUE cX509Ext;
VALUE cX509ExtFactory;
VALUE eX509ExtError;
-static void
-ossl_x509ext_free(void *ptr)
-{
- X509_EXTENSION_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509ext_type = {
- "OpenSSL/X509/EXTENSION",
- {
- 0, ossl_x509ext_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
*/
@@ -71,7 +55,6 @@ ossl_x509ext_new(X509_EXTENSION *ext)
X509_EXTENSION *new;
VALUE obj;
- obj = NewX509Ext(cX509Ext);
if (!ext) {
new = X509_EXTENSION_new();
} else {
@@ -80,7 +63,7 @@ ossl_x509ext_new(X509_EXTENSION *ext)
if (!new) {
ossl_raise(eX509ExtError, NULL);
}
- SetX509Ext(obj, new);
+ WrapX509Ext(cX509Ext, obj, new);
return obj;
}
@@ -115,19 +98,11 @@ DupX509ExtPtr(VALUE obj)
* Ext factory
*/
static void
-ossl_x509extfactory_free(void *ctx)
+ossl_x509extfactory_free(X509V3_CTX *ctx)
{
OPENSSL_free(ctx);
}
-static const rb_data_type_t ossl_x509extfactory_type = {
- "OpenSSL/X509/EXTENSION/Factory",
- {
- 0, ossl_x509extfactory_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
ossl_x509extfactory_alloc(VALUE klass)
{
@@ -188,6 +163,24 @@ ossl_x509extfactory_set_crl(VALUE self, VALUE crl)
return crl;
}
+#ifdef HAVE_X509V3_SET_NCONF
+static VALUE
+ossl_x509extfactory_set_config(VALUE self, VALUE config)
+{
+ X509V3_CTX *ctx;
+ CONF *conf;
+
+ GetX509ExtFactory(self, ctx);
+ rb_iv_set(self, "@config", config);
+ conf = GetConfigPtr(config); /* NO DUP NEEDED */
+ X509V3_set_nconf(ctx, conf);
+
+ return config;
+}
+#else
+#define ossl_x509extfactory_set_config rb_f_notimplement
+#endif
+
static VALUE
ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -243,14 +236,10 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
valstr = rb_str_new2(RTEST(critical) ? "critical," : "");
rb_str_append(valstr, value);
GetX509ExtFactory(self, ctx);
- obj = NewX509Ext(cX509Ext);
#ifdef HAVE_X509V3_EXT_NCONF_NID
rconf = rb_iv_get(self, "@config");
- conf = NIL_P(rconf) ? NULL : DupConfigPtr(rconf);
- X509V3_set_nconf(ctx, conf);
+ conf = NIL_P(rconf) ? NULL : GetConfigPtr(rconf);
ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr));
- X509V3_set_ctx_nodb(ctx);
- NCONF_free(conf);
#else
if (!empty_lhash) empty_lhash = lh_new(NULL, NULL);
ext = X509V3_EXT_conf_nid(empty_lhash, ctx, nid, RSTRING_PTR(valstr));
@@ -259,7 +248,7 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
ossl_raise(eX509ExtError, "%s = %s",
RSTRING_PTR(oid), RSTRING_PTR(value));
}
- SetX509Ext(obj, ext);
+ WrapX509Ext(cX509Ext, obj, ext);
return obj;
}
@@ -273,11 +262,10 @@ ossl_x509ext_alloc(VALUE klass)
X509_EXTENSION *ext;
VALUE obj;
- obj = NewX509Ext(klass);
if(!(ext = X509_EXTENSION_new())){
ossl_raise(eX509ExtError, NULL);
}
- SetX509Ext(obj, ext);
+ WrapX509Ext(klass, obj, ext);
return obj;
}
@@ -324,16 +312,14 @@ ossl_x509ext_set_oid(VALUE self, VALUE oid)
{
X509_EXTENSION *ext;
ASN1_OBJECT *obj;
+ char *s;
+ s = StringValuePtr(oid);
+ obj = OBJ_txt2obj(s, 0);
+ if(!obj) obj = OBJ_txt2obj(s, 1);
+ if(!obj) ossl_raise(eX509ExtError, NULL);
GetX509Ext(self, ext);
- obj = OBJ_txt2obj(StringValueCStr(oid), 0);
- if (!obj)
- ossl_raise(eX509ExtError, "OBJ_txt2obj");
- if (!X509_EXTENSION_set_object(ext, obj)) {
- ASN1_OBJECT_free(obj);
- ossl_raise(eX509ExtError, "X509_EXTENSION_set_object");
- }
- ASN1_OBJECT_free(obj);
+ X509_EXTENSION_set_object(ext, obj);
return oid;
}
@@ -343,16 +329,25 @@ ossl_x509ext_set_value(VALUE self, VALUE data)
{
X509_EXTENSION *ext;
ASN1_OCTET_STRING *asn1s;
+ char *s;
- GetX509Ext(self, ext);
data = ossl_to_der_if_possible(data);
StringValue(data);
- asn1s = X509_EXTENSION_get_data(ext);
-
- if (!ASN1_OCTET_STRING_set(asn1s, (unsigned char *)RSTRING_PTR(data),
- RSTRING_LENINT(data))) {
- ossl_raise(eX509ExtError, "ASN1_OCTET_STRING_set");
+ if(!(s = OPENSSL_malloc(RSTRING_LEN(data))))
+ ossl_raise(eX509ExtError, "malloc error");
+ memcpy(s, RSTRING_PTR(data), RSTRING_LEN(data));
+ if(!(asn1s = ASN1_OCTET_STRING_new())){
+ OPENSSL_free(s);
+ ossl_raise(eX509ExtError, NULL);
}
+ if(!M_ASN1_OCTET_STRING_set(asn1s, s, RSTRING_LENINT(data))){
+ OPENSSL_free(s);
+ ASN1_OCTET_STRING_free(asn1s);
+ ossl_raise(eX509ExtError, NULL);
+ }
+ OPENSSL_free(s);
+ GetX509Ext(self, ext);
+ X509_EXTENSION_set_data(ext, asn1s);
return data;
}
@@ -441,7 +436,7 @@ ossl_x509ext_to_der(VALUE obj)
* INIT
*/
void
-Init_ossl_x509ext(void)
+Init_ossl_x509ext()
{
eX509ExtError = rb_define_class_under(mX509, "ExtensionError", eOSSLError);
@@ -454,12 +449,13 @@ Init_ossl_x509ext(void)
rb_attr(cX509ExtFactory, rb_intern("subject_certificate"), 1, 0, Qfalse);
rb_attr(cX509ExtFactory, rb_intern("subject_request"), 1, 0, Qfalse);
rb_attr(cX509ExtFactory, rb_intern("crl"), 1, 0, Qfalse);
- rb_attr(cX509ExtFactory, rb_intern("config"), 1, 1, Qfalse);
+ rb_attr(cX509ExtFactory, rb_intern("config"), 1, 0, Qfalse);
rb_define_method(cX509ExtFactory, "issuer_certificate=", ossl_x509extfactory_set_issuer_cert, 1);
rb_define_method(cX509ExtFactory, "subject_certificate=", ossl_x509extfactory_set_subject_cert, 1);
rb_define_method(cX509ExtFactory, "subject_request=", ossl_x509extfactory_set_subject_req, 1);
rb_define_method(cX509ExtFactory, "crl=", ossl_x509extfactory_set_crl, 1);
+ rb_define_method(cX509ExtFactory, "config=", ossl_x509extfactory_set_config, 1);
rb_define_method(cX509ExtFactory, "create_ext", ossl_x509extfactory_create_ext, -1);
cX509Ext = rb_define_class_under(mX509, "Extension", rb_cObject);
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index a0e28e29ec..16a2dfd115 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509Name(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509name_type, 0)
-#define SetX509Name(obj, name) do { \
+#define WrapX509Name(klass, obj, name) do { \
if (!(name)) { \
ossl_raise(rb_eRuntimeError, "Name wasn't initialized."); \
} \
- RTYPEDDATA_DATA(obj) = (name); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_NAME_free, (name)); \
} while (0)
#define GetX509Name(obj, name) do { \
- TypedData_Get_Struct((obj), X509_NAME, &ossl_x509name_type, (name)); \
+ Data_Get_Struct((obj), X509_NAME, (name)); \
if (!(name)) { \
ossl_raise(rb_eRuntimeError, "Name wasn't initialized."); \
} \
@@ -39,20 +38,6 @@
VALUE cX509Name;
VALUE eX509NameError;
-static void
-ossl_x509name_free(void *ptr)
-{
- X509_NAME_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509name_type = {
- "OpenSSL/X509/NAME",
- {
- 0, ossl_x509name_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public
*/
@@ -62,7 +47,6 @@ ossl_x509name_new(X509_NAME *name)
X509_NAME *new;
VALUE obj;
- obj = NewX509Name(cX509Name);
if (!name) {
new = X509_NAME_new();
} else {
@@ -71,7 +55,7 @@ ossl_x509name_new(X509_NAME *name)
if (!new) {
ossl_raise(eX509NameError, NULL);
}
- SetX509Name(obj, new);
+ WrapX509Name(cX509Name, obj, new);
return obj;
}
@@ -95,11 +79,10 @@ ossl_x509name_alloc(VALUE klass)
X509_NAME *name;
VALUE obj;
- obj = NewX509Name(klass);
if (!(name = X509_NAME_new())) {
ossl_raise(eX509NameError, NULL);
}
- SetX509Name(obj, name);
+ WrapX509Name(klass, obj, name);
return obj;
}
@@ -109,7 +92,7 @@ static VALUE ossl_x509name_add_entry(int, VALUE*, VALUE);
#define rb_aref(obj, key) rb_funcall((obj), id_aref, 1, (key))
static VALUE
-ossl_x509name_init_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
+ossl_x509name_init_i(VALUE i, VALUE args)
{
VALUE self = rb_ary_entry(args, 0);
VALUE template = rb_ary_entry(args, 1);
@@ -200,14 +183,13 @@ VALUE ossl_x509name_add_entry(int argc, VALUE *argv, VALUE self)
{
X509_NAME *name;
VALUE oid, value, type;
- const char *oid_name;
rb_scan_args(argc, argv, "21", &oid, &value, &type);
- oid_name = StringValueCStr(oid);
+ StringValue(oid);
StringValue(value);
if(NIL_P(type)) type = rb_aref(OBJECT_TYPE_TEMPLATE, oid);
GetX509Name(self, name);
- if (!X509_NAME_add_entry_by_txt(name, oid_name, NUM2INT(type),
+ if (!X509_NAME_add_entry_by_txt(name, RSTRING_PTR(oid), NUM2INT(type),
(const unsigned char *)RSTRING_PTR(value), RSTRING_LENINT(value), -1, 0)) {
ossl_raise(eX509NameError, NULL);
}
@@ -443,7 +425,7 @@ ossl_x509name_to_der(VALUE self)
*/
void
-Init_ossl_x509name(void)
+Init_ossl_x509name()
{
VALUE utf8str, ptrstr, ia5str, hash;
diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c
index 0c13c8ca3e..5927f76d44 100644
--- a/ext/openssl/ossl_x509req.c
+++ b/ext/openssl/ossl_x509req.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509Req(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509req_type, 0)
-#define SetX509Req(obj, req) do { \
+#define WrapX509Req(klass, obj, req) do { \
if (!(req)) { \
ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (req); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_REQ_free, (req)); \
} while (0)
#define GetX509Req(obj, req) do { \
- TypedData_Get_Struct((obj), X509_REQ, &ossl_x509req_type, (req)); \
+ Data_Get_Struct((obj), X509_REQ, (req)); \
if (!(req)) { \
ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \
} \
@@ -34,20 +33,6 @@
VALUE cX509Req;
VALUE eX509ReqError;
-static void
-ossl_x509req_free(void *ptr)
-{
- X509_REQ_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509req_type = {
- "OpenSSL/X509/REQ",
- {
- 0, ossl_x509req_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public functions
*/
@@ -57,7 +42,6 @@ ossl_x509req_new(X509_REQ *req)
X509_REQ *new;
VALUE obj;
- obj = NewX509Req(cX509Req);
if (!req) {
new = X509_REQ_new();
} else {
@@ -66,7 +50,7 @@ ossl_x509req_new(X509_REQ *req)
if (!new) {
ossl_raise(eX509ReqError, NULL);
}
- SetX509Req(obj, new);
+ WrapX509Req(cX509Req, obj, new);
return obj;
}
@@ -103,11 +87,10 @@ ossl_x509req_alloc(VALUE klass)
X509_REQ *req;
VALUE obj;
- obj = NewX509Req(klass);
if (!(req = X509_REQ_new())) {
ossl_raise(eX509ReqError, NULL);
}
- SetX509Req(obj, req);
+ WrapX509Req(klass, obj, req);
return obj;
}
@@ -418,19 +401,19 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary)
{
X509_REQ *req;
X509_ATTRIBUTE *attr;
- long i;
+ int i;
VALUE item;
Check_Type(ary, T_ARRAY);
for (i=0;i<RARRAY_LEN(ary); i++) {
- OSSL_Check_Kind(RARRAY_AREF(ary, i), cX509Attr);
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Attr);
}
GetX509Req(self, req);
sk_X509_ATTRIBUTE_pop_free(req->req_info->attributes, X509_ATTRIBUTE_free);
req->req_info->attributes = NULL;
for (i=0;i<RARRAY_LEN(ary); i++) {
- item = RARRAY_AREF(ary, i);
- attr = GetX509AttrPtr(item);
+ item = RARRAY_PTR(ary)[i];
+ attr = DupX509AttrPtr(item);
if (!X509_REQ_add1_attr(req, attr)) {
ossl_raise(eX509ReqError, NULL);
}
@@ -444,7 +427,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr)
X509_REQ *req;
GetX509Req(self, req);
- if (!X509_REQ_add1_attr(req, GetX509AttrPtr(attr))) {
+ if (!X509_REQ_add1_attr(req, DupX509AttrPtr(attr))) {
ossl_raise(eX509ReqError, NULL);
}
@@ -455,7 +438,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr)
* X509_REQUEST init
*/
void
-Init_ossl_x509req(void)
+Init_ossl_x509req()
{
eX509ReqError = rb_define_class_under(mX509, "RequestError", eOSSLError);
@@ -482,3 +465,4 @@ Init_ossl_x509req(void)
rb_define_method(cX509Req, "attributes=", ossl_x509req_set_attributes, 1);
rb_define_method(cX509Req, "add_attribute", ossl_x509req_add_attribute, 1);
}
+
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c
index 4691d507d3..320abaa7ae 100644
--- a/ext/openssl/ossl_x509revoked.c
+++ b/ext/openssl/ossl_x509revoked.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509Rev(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509rev_type, 0)
-#define SetX509Rev(obj, rev) do { \
+#define WrapX509Rev(klass, obj, rev) do { \
if (!(rev)) { \
ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (rev); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_REVOKED_free, (rev)); \
} while (0)
#define GetX509Rev(obj, rev) do { \
- TypedData_Get_Struct((obj), X509_REVOKED, &ossl_x509rev_type, (rev)); \
+ Data_Get_Struct((obj), X509_REVOKED, (rev)); \
if (!(rev)) { \
ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
} \
@@ -34,20 +33,6 @@
VALUE cX509Rev;
VALUE eX509RevError;
-static void
-ossl_x509rev_free(void *ptr)
-{
- X509_REVOKED_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509rev_type = {
- "OpenSSL/X509/REV",
- {
- 0, ossl_x509rev_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* PUBLIC
*/
@@ -57,7 +42,6 @@ ossl_x509revoked_new(X509_REVOKED *rev)
X509_REVOKED *new;
VALUE obj;
- obj = NewX509Rev(cX509Rev);
if (!rev) {
new = X509_REVOKED_new();
} else {
@@ -66,7 +50,7 @@ ossl_x509revoked_new(X509_REVOKED *rev)
if (!new) {
ossl_raise(eX509RevError, NULL);
}
- SetX509Rev(obj, new);
+ WrapX509Rev(cX509Rev, obj, new);
return obj;
}
@@ -93,11 +77,10 @@ ossl_x509revoked_alloc(VALUE klass)
X509_REVOKED *rev;
VALUE obj;
- obj = NewX509Rev(klass);
if (!(rev = X509_REVOKED_new())) {
ossl_raise(eX509RevError, NULL);
}
- SetX509Rev(obj, rev);
+ WrapX509Rev(klass, obj, rev);
return obj;
}
@@ -188,19 +171,19 @@ ossl_x509revoked_set_extensions(VALUE self, VALUE ary)
{
X509_REVOKED *rev;
X509_EXTENSION *ext;
- long i;
+ int i;
VALUE item;
Check_Type(ary, T_ARRAY);
for (i=0; i<RARRAY_LEN(ary); i++) {
- OSSL_Check_Kind(RARRAY_AREF(ary, i), cX509Ext);
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509Rev(self, rev);
sk_X509_EXTENSION_pop_free(rev->extensions, X509_EXTENSION_free);
rev->extensions = NULL;
for (i=0; i<RARRAY_LEN(ary); i++) {
- item = RARRAY_AREF(ary, i);
- ext = GetX509ExtPtr(item);
+ item = RARRAY_PTR(ary)[i];
+ ext = DupX509ExtPtr(item);
if(!X509_REVOKED_add_ext(rev, ext, -1)) {
ossl_raise(eX509RevError, NULL);
}
@@ -215,7 +198,7 @@ ossl_x509revoked_add_extension(VALUE self, VALUE ext)
X509_REVOKED *rev;
GetX509Rev(self, rev);
- if (!X509_REVOKED_add_ext(rev, GetX509ExtPtr(ext), -1)) {
+ if(!X509_REVOKED_add_ext(rev, DupX509ExtPtr(ext), -1)) {
ossl_raise(eX509RevError, NULL);
}
@@ -226,7 +209,7 @@ ossl_x509revoked_add_extension(VALUE self, VALUE ext)
* INIT
*/
void
-Init_ossl_x509revoked(void)
+Init_ossl_x509revoked()
{
eX509RevError = rb_define_class_under(mX509, "RevokedError", eOSSLError);
@@ -243,3 +226,4 @@ Init_ossl_x509revoked(void)
rb_define_method(cX509Rev, "extensions=", ossl_x509revoked_set_extensions, 1);
rb_define_method(cX509Rev, "add_extension", ossl_x509revoked_add_extension, 1);
}
+
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index cec9dbbb44..f59c376574 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -1,24 +1,23 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#define NewX509Store(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509store_type, 0)
-#define SetX509Store(obj, st) do { \
+#define WrapX509Store(klass, obj, st) do { \
if (!(st)) { \
ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (st); \
+ (obj) = Data_Wrap_Struct((klass), 0, X509_STORE_free, (st)); \
} while (0)
#define GetX509Store(obj, st) do { \
- TypedData_Get_Struct((obj), X509_STORE, &ossl_x509store_type, (st)); \
+ Data_Get_Struct((obj), X509_STORE, (st)); \
if (!(st)) { \
ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
} \
@@ -28,16 +27,14 @@
GetX509Store((obj), (st)); \
} while (0)
-#define NewX509StCtx(klass) \
- TypedData_Wrap_Struct((klass), &ossl_x509stctx_type, 0)
-#define SetX509StCtx(obj, ctx) do { \
+#define WrapX509StCtx(klass, obj, ctx) do { \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "STORE_CTX wasn't initialized!"); \
} \
- RTYPEDDATA_DATA(obj) = (ctx); \
+ (obj) = Data_Wrap_Struct((klass), 0, ossl_x509stctx_free, (ctx)); \
} while (0)
#define GetX509StCtx(obj, ctx) do { \
- TypedData_Get_Struct((obj), X509_STORE_CTX, &ossl_x509stctx_type, (ctx)); \
+ Data_Get_Struct((obj), X509_STORE_CTX, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "STORE_CTX is out of scope!"); \
} \
@@ -54,20 +51,6 @@ VALUE cX509Store;
VALUE cX509StoreContext;
VALUE eX509StoreError;
-static void
-ossl_x509store_free(void *ptr)
-{
- X509_STORE_free(ptr);
-}
-
-static const rb_data_type_t ossl_x509store_type = {
- "OpenSSL/X509/STORE",
- {
- 0, ossl_x509store_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* Public functions
*/
@@ -76,8 +59,7 @@ ossl_x509store_new(X509_STORE *store)
{
VALUE obj;
- obj = NewX509Store(cX509Store);
- SetX509Store(obj, store);
+ WrapX509Store(cX509Store, obj, store);
return obj;
}
@@ -112,11 +94,10 @@ ossl_x509store_alloc(VALUE klass)
X509_STORE *store;
VALUE obj;
- obj = NewX509Store(klass);
if((store = X509_STORE_new()) == NULL){
ossl_raise(eX509StoreError, NULL);
}
- SetX509Store(obj, store);
+ WrapX509Store(klass, obj, store);
return obj;
}
@@ -130,7 +111,7 @@ ossl_x509store_set_vfy_cb(VALUE self, VALUE cb)
X509_STORE *store;
GetX509Store(self, store);
- X509_STORE_set_ex_data(store, ossl_store_ex_verify_cb_idx, (void *)cb);
+ X509_STORE_set_ex_data(store, ossl_verify_cb_idx, (void*)cb);
rb_iv_set(self, "@verify_callback", cb);
return cb;
@@ -249,13 +230,6 @@ ossl_x509store_add_file(VALUE self, VALUE file)
if(X509_LOOKUP_load_file(lookup, path, X509_FILETYPE_PEM) != 1){
ossl_raise(eX509StoreError, NULL);
}
- /*
- * X509_load_cert_crl_file() which is called from X509_LOOKUP_load_file()
- * did not check the return value of X509_STORE_add_{cert,crl}(), leaking
- * "cert already in hash table" errors on the error queue, if duplicate
- * certificates are found. This will be fixed by OpenSSL 1.1.1.
- */
- ERR_clear_error();
return self;
}
@@ -368,25 +342,14 @@ ossl_x509store_verify(int argc, VALUE *argv, VALUE self)
/*
* Public Functions
*/
-static void ossl_x509stctx_free(void*);
-
-
-static const rb_data_type_t ossl_x509stctx_type = {
- "OpenSSL/X509/STORE_CTX",
- {
- 0, ossl_x509stctx_free,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
+static void ossl_x509stctx_free(X509_STORE_CTX*);
VALUE
ossl_x509stctx_new(X509_STORE_CTX *ctx)
{
VALUE obj;
- obj = NewX509StCtx(cX509StoreContext);
- SetX509StCtx(obj, ctx);
+ WrapX509StCtx(cX509StoreContext, obj, ctx);
return obj;
}
@@ -404,9 +367,8 @@ ossl_x509stctx_clear_ptr(VALUE obj)
* Private functions
*/
static void
-ossl_x509stctx_free(void *ptr)
+ossl_x509stctx_free(X509_STORE_CTX *ctx)
{
- X509_STORE_CTX *ctx = ptr;
if(ctx->untrusted)
sk_X509_pop_free(ctx->untrusted, X509_free);
if(ctx->cert)
@@ -420,11 +382,10 @@ ossl_x509stctx_alloc(VALUE klass)
X509_STORE_CTX *ctx;
VALUE obj;
- obj = NewX509StCtx(klass);
if((ctx = X509_STORE_CTX_new()) == NULL){
ossl_raise(eX509StoreError, NULL);
}
- SetX509StCtx(obj, ctx);
+ WrapX509StCtx(klass, obj, ctx);
return obj;
}
@@ -474,7 +435,7 @@ ossl_x509stctx_verify(VALUE self)
int result;
GetX509StCtx(self, ctx);
- X509_STORE_CTX_set_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx,
+ X509_STORE_CTX_set_ex_data(ctx, ossl_verify_cb_idx,
(void*)rb_iv_get(self, "@verify_callback"));
result = X509_verify_cert(ctx);
@@ -632,7 +593,7 @@ ossl_x509stctx_set_time(VALUE self, VALUE time)
* INIT
*/
void
-Init_ossl_x509store(void)
+Init_ossl_x509store()
{
VALUE x509stctx;
diff --git a/ext/openssl/ruby_missing.h b/ext/openssl/ruby_missing.h
index d7384ec32c..0f9de1c842 100644
--- a/ext/openssl/ruby_missing.h
+++ b/ext/openssl/ruby_missing.h
@@ -1,10 +1,11 @@
/*
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2003 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
*/
/*
- * This program is licensed under the same licence as Ruby.
+ * This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_RUBY_MISSING_H_)
diff --git a/ext/pathname/extconf.rb b/ext/pathname/extconf.rb
index c9133bc153..6720903e88 100644
--- a/ext/pathname/extconf.rb
+++ b/ext/pathname/extconf.rb
@@ -1,4 +1,2 @@
-# frozen_string_literal: false
require 'mkmf'
-have_struct_member("struct stat", "st_birthtimespec", "sys/stat.h")
create_makefile('pathname')
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 8bdb73f439..46fa72b784 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#
# = pathname.rb
#
@@ -14,12 +13,16 @@ require 'pathname.so'
class Pathname
- # to_path is implemented so Pathname objects are usable with File.open, etc.
- TO_PATH = :to_path
+ # :stopdoc:
+ if RUBY_VERSION < "1.9"
+ TO_PATH = :to_str
+ else
+ # to_path is implemented so Pathname objects are usable with File.open, etc.
+ TO_PATH = :to_path
+ end
SAME_PATHS = if File::FNM_SYSCASE.nonzero?
- # Avoid #zero? here because #casecmp can return nil.
- proc {|a, b| a.casecmp(b) == 0}
+ proc {|a, b| a.casecmp(b).zero?}
else
proc {|a, b| a == b}
end
@@ -110,7 +113,6 @@ class Pathname
end
end
end
- pre.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
names.shift while names[0] == '..'
end
@@ -159,7 +161,6 @@ class Pathname
pre, base = r
names.unshift base if base != '.'
end
- pre.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
names.shift while names[0] == '..'
end
@@ -279,17 +280,9 @@ class Pathname
# #<Pathname:path/to/some>
# #<Pathname:path/to/some/file.rb>
#
- # Returns an Enumerator if no block was given.
- #
- # enum = Pathname.new("/usr/bin/ruby").descend
- # # ... do stuff ...
- # enum.each { |e| ... }
- # # yields Pathnames /, /usr, /usr/bin, and /usr/bin/ruby.
- #
# It doesn't access the filesystem.
#
def descend
- return to_enum(__method__) unless block_given?
vs = []
ascend {|v| vs << v }
vs.reverse_each {|v| yield v }
@@ -312,17 +305,9 @@ class Pathname
# #<Pathname:path/to>
# #<Pathname:path>
#
- # Returns an Enumerator if no block was given.
- #
- # enum = Pathname.new("/usr/bin/ruby").ascend
- # # ... do stuff ...
- # enum.each { |e| ... }
- # # yields Pathnames /usr/bin/ruby, /usr/bin, /usr, and /.
- #
# It doesn't access the filesystem.
#
def ascend
- return to_enum(__method__) unless block_given?
path = @path
yield self
while r = chop_basename(path)
@@ -339,17 +324,12 @@ class Pathname
# p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
# p3 = p1 + "/etc/passwd" # Pathname:/etc/passwd
#
- # # / is aliased to +.
- # p4 = p1 / "bin/ruby" # Pathname:/usr/bin/ruby
- # p5 = p1 / "/etc/passwd" # Pathname:/etc/passwd
- #
# This method doesn't access the file system; it is pure string manipulation.
#
def +(other)
other = Pathname.new(other) unless Pathname === other
Pathname.new(plus(@path, other.to_s))
end
- alias / +
def plus(path1, path2) # -> path # :nodoc:
prefix2 = path2
@@ -378,7 +358,7 @@ class Pathname
basename_list2.shift
end
r1 = chop_basename(prefix1)
- if !r1 && (r1 = /#{SEPARATOR_PAT}/o =~ File.basename(prefix1))
+ if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1)
while !basename_list2.empty? && basename_list2.first == '..'
index_list2.shift
basename_list2.shift
@@ -404,7 +384,7 @@ class Pathname
# #=> true
#
def join(*args)
- return self if args.empty?
+ args.unshift self
result = args.pop
result = Pathname.new(result) unless Pathname === result
return result if result.absolute?
@@ -413,7 +393,7 @@ class Pathname
result = arg + result
return result if result.absolute?
}
- self + result
+ result
end
#
@@ -554,13 +534,13 @@ class Pathname # * Find *
#
# See Find.find
#
- def find(ignore_error: true) # :yield: pathname
- return to_enum(__method__, ignore_error: ignore_error) unless block_given?
+ def find # :yield: pathname
+ return to_enum(__method__) unless block_given?
require 'find'
if @path == '.'
- Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
+ Find.find(@path) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
else
- Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f) }
+ Find.find(@path) {|f| yield self.class.new(f) }
end
end
end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index d560e7356f..8205b3c830 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -440,25 +440,6 @@ path_atime(VALUE self)
return rb_funcall(rb_cFile, rb_intern("atime"), 1, get_strpath(self));
}
-#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC) || defined(_WIN32)
-/*
- * call-seq:
- * pathname.birthtime -> time
- *
- * Returns the birth time for the file.
- * If the platform doesn't have birthtime, raises NotImplementedError.
- *
- * See File.birthtime.
- */
-static VALUE
-path_birthtime(VALUE self)
-{
- return rb_funcall(rb_cFile, rb_intern("birthtime"), 1, get_strpath(self));
-}
-#else
-# define path_birthtime rb_f_notimplement
-#endif
-
/*
* call-seq:
* pathname.ctime -> time
@@ -987,7 +968,7 @@ path_zero_p(VALUE self)
}
static VALUE
-glob_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
+glob_i(VALUE elt, VALUE klass, int argc, VALUE *argv)
{
return rb_yield(rb_class_new_instance(1, &elt, klass));
}
@@ -1125,7 +1106,7 @@ path_opendir(VALUE self)
}
static VALUE
-each_entry_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
+each_entry_i(VALUE elt, VALUE klass, int argc, VALUE *argv)
{
return rb_yield(rb_class_new_instance(1, &elt, klass));
}
@@ -1307,7 +1288,6 @@ path_f_pathname(VALUE self, VALUE str)
*
* These methods are a facade for File:
* - #atime
- * - #birthtime
* - #ctime
* - #mtime
* - #chmod(mode)
@@ -1370,7 +1350,7 @@ path_f_pathname(VALUE self, VALUE str)
* information. In some cases, a brief description will follow.
*/
void
-Init_pathname(void)
+Init_pathname()
{
id_at_path = rb_intern("@path");
id_to_path = rb_intern("to_path");
@@ -1400,7 +1380,6 @@ Init_pathname(void)
rb_define_method(rb_cPathname, "binwrite", path_binwrite, -1);
rb_define_method(rb_cPathname, "sysopen", path_sysopen, -1);
rb_define_method(rb_cPathname, "atime", path_atime, 0);
- rb_define_method(rb_cPathname, "birthtime", path_birthtime, 0);
rb_define_method(rb_cPathname, "ctime", path_ctime, 0);
rb_define_method(rb_cPathname, "mtime", path_mtime, 0);
rb_define_method(rb_cPathname, "chmod", path_chmod, 1);
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index be33d35a5e..65e83a3554 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -1,5 +1,4 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
require 'mkmf'
require 'fileutils'
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index 4e678deedc..f4abd283d4 100644
--- a/ext/psych/lib/psych.rb
+++ b/ext/psych/lib/psych.rb
@@ -1,11 +1,4 @@
-# frozen_string_literal: false
-case RUBY_ENGINE
-when 'jruby'
- require 'psych_jars'
- org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
-else
- require 'psych.so'
-end
+require 'psych.so'
require 'psych/nodes'
require 'psych/streaming'
require 'psych/visitors'
@@ -21,14 +14,13 @@ require 'psych/stream'
require 'psych/json/tree_builder'
require 'psych/json/stream'
require 'psych/handlers/document_stream'
-require 'psych/class_loader'
###
# = Overview
#
# Psych is a YAML parser and emitter.
# Psych leverages libyaml [Home page: http://pyyaml.org/wiki/LibYAML]
-# or [HG repo: https://bitbucket.org/xi/libyaml] for its YAML parsing
+# or [Git repo: https://github.com/zerotao/libyaml] for its YAML parsing
# and emitting capabilities. In addition to wrapping libyaml, Psych also
# knows how to serialize and de-serialize most Ruby objects to and from
# the YAML format.
@@ -79,7 +71,7 @@ require 'psych/class_loader'
# ==== Exception handling
#
# begin
-# # The second argument changes only the exception contents
+# # The second argument chnages only the exception contents
# Psych.parse("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
@@ -143,7 +135,7 @@ require 'psych/class_loader'
# ==== Exception handling
#
# begin
-# # The second argument changes only the exception contents
+# # The second argument chnages only the exception contents
# Psych.parse("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
@@ -224,13 +216,11 @@ require 'psych/class_loader'
module Psych
# The version is Psych you're using
- VERSION = '2.1.0'
+ VERSION = '2.0.1'
# The version of libyaml Psych is using
LIBYAML_VERSION = Psych.libyaml_version.join '.'
- FALLBACK = Struct.new :to_ruby # :nodoc:
-
###
# Load +yaml+ in to a Ruby data structure. If multiple documents are
# provided, the object contained in the first document will be returned.
@@ -250,8 +240,8 @@ module Psych
# ex.file # => 'file.txt'
# ex.message # => "(file.txt): found character that cannot start any token"
# end
- def self.load yaml, filename = nil, fallback = false
- result = parse(yaml, filename, fallback)
+ def self.load yaml, filename = nil
+ result = parse(yaml, filename)
result ? result.to_ruby : result
end
@@ -323,11 +313,11 @@ module Psych
# end
#
# See Psych::Nodes for more information about YAML AST.
- def self.parse yaml, filename = nil, fallback = false
+ def self.parse yaml, filename = nil
parse_stream(yaml, filename) do |node|
return node
end
- fallback
+ false
end
###
@@ -468,12 +458,9 @@ module Psych
###
# Load the document contained in +filename+. Returns the yaml contained in
- # +filename+ as a Ruby object, or if the file is empty, it returns
- # the specified default return value, which defaults to an empty Hash
- def self.load_file filename, fallback = false
- File.open(filename, 'r:bom|utf-8') { |f|
- self.load f, filename, FALLBACK.new(fallback)
- }
+ # +filename+ as a Ruby object
+ def self.load_file filename
+ File.open(filename, 'r:bom|utf-8') { |f| self.load f, filename }
end
# :stopdoc:
diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb
index ba756f7ea7..46c6b93627 100644
--- a/ext/psych/lib/psych/class_loader.rb
+++ b/ext/psych/lib/psych/class_loader.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/omap'
require 'psych/set'
diff --git a/ext/psych/lib/psych/coder.rb b/ext/psych/lib/psych/coder.rb
index 26005f57b4..2b830d2b21 100644
--- a/ext/psych/lib/psych/coder.rb
+++ b/ext/psych/lib/psych/coder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
###
# If an object defines +encode_with+, then an instance of Psych::Coder will
diff --git a/ext/psych/lib/psych/core_ext.rb b/ext/psych/lib/psych/core_ext.rb
index 1a98279afd..9c8134da7e 100644
--- a/ext/psych/lib/psych/core_ext.rb
+++ b/ext/psych/lib/psych/core_ext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
class Object
def self.yaml_tag url
Psych.add_tag(url, self)
diff --git a/ext/psych/lib/psych/deprecated.rb b/ext/psych/lib/psych/deprecated.rb
index 165d2102b4..8c310b3207 100644
--- a/ext/psych/lib/psych/deprecated.rb
+++ b/ext/psych/lib/psych/deprecated.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'date'
module Psych
diff --git a/ext/psych/lib/psych/exception.rb b/ext/psych/lib/psych/exception.rb
index 83c3d7fa82..ce9d2caf3f 100644
--- a/ext/psych/lib/psych/exception.rb
+++ b/ext/psych/lib/psych/exception.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
class Exception < RuntimeError
end
diff --git a/ext/psych/lib/psych/handler.rb b/ext/psych/lib/psych/handler.rb
index 1ab5f73e95..c55afe745f 100644
--- a/ext/psych/lib/psych/handler.rb
+++ b/ext/psych/lib/psych/handler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
###
# Psych::Handler is an abstract base class that defines the events used
diff --git a/ext/psych/lib/psych/handlers/document_stream.rb b/ext/psych/lib/psych/handlers/document_stream.rb
index c43b39ebc5..e429993c1c 100644
--- a/ext/psych/lib/psych/handlers/document_stream.rb
+++ b/ext/psych/lib/psych/handlers/document_stream.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/tree_builder'
module Psych
diff --git a/ext/psych/lib/psych/handlers/recorder.rb b/ext/psych/lib/psych/handlers/recorder.rb
index 341b81dec4..4eae62e5f9 100644
--- a/ext/psych/lib/psych/handlers/recorder.rb
+++ b/ext/psych/lib/psych/handlers/recorder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/handler'
module Psych
diff --git a/ext/psych/lib/psych/json/ruby_events.rb b/ext/psych/lib/psych/json/ruby_events.rb
index 478eb667c7..6b73249c06 100644
--- a/ext/psych/lib/psych/json/ruby_events.rb
+++ b/ext/psych/lib/psych/json/ruby_events.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module JSON
module RubyEvents # :nodoc:
diff --git a/ext/psych/lib/psych/json/stream.rb b/ext/psych/lib/psych/json/stream.rb
index 83b7e13655..fe2a6e9116 100644
--- a/ext/psych/lib/psych/json/stream.rb
+++ b/ext/psych/lib/psych/json/stream.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/json/ruby_events'
require 'psych/json/yaml_events'
diff --git a/ext/psych/lib/psych/json/tree_builder.rb b/ext/psych/lib/psych/json/tree_builder.rb
index 2f94b8c252..b799c93f58 100644
--- a/ext/psych/lib/psych/json/tree_builder.rb
+++ b/ext/psych/lib/psych/json/tree_builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/json/yaml_events'
module Psych
diff --git a/ext/psych/lib/psych/json/yaml_events.rb b/ext/psych/lib/psych/json/yaml_events.rb
index 07f64737c5..d054d9b458 100644
--- a/ext/psych/lib/psych/json/yaml_events.rb
+++ b/ext/psych/lib/psych/json/yaml_events.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module JSON
module YAMLEvents # :nodoc:
diff --git a/ext/psych/lib/psych/nodes.rb b/ext/psych/lib/psych/nodes.rb
index 01573b509b..f3b33fe975 100644
--- a/ext/psych/lib/psych/nodes.rb
+++ b/ext/psych/lib/psych/nodes.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/nodes/node'
require 'psych/nodes/stream'
require 'psych/nodes/document'
diff --git a/ext/psych/lib/psych/nodes/alias.rb b/ext/psych/lib/psych/nodes/alias.rb
index 716a00d62f..5bd4df13d1 100644
--- a/ext/psych/lib/psych/nodes/alias.rb
+++ b/ext/psych/lib/psych/nodes/alias.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/document.rb b/ext/psych/lib/psych/nodes/document.rb
index 7234fef1d8..32014d60dc 100644
--- a/ext/psych/lib/psych/nodes/document.rb
+++ b/ext/psych/lib/psych/nodes/document.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/mapping.rb b/ext/psych/lib/psych/nodes/mapping.rb
index 4c11df8cd6..5ba95ce4b6 100644
--- a/ext/psych/lib/psych/nodes/mapping.rb
+++ b/ext/psych/lib/psych/nodes/mapping.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/node.rb b/ext/psych/lib/psych/nodes/node.rb
index e3621dc451..83233a61fd 100644
--- a/ext/psych/lib/psych/nodes/node.rb
+++ b/ext/psych/lib/psych/nodes/node.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'stringio'
require 'psych/class_loader'
require 'psych/scalar_scanner'
diff --git a/ext/psych/lib/psych/nodes/scalar.rb b/ext/psych/lib/psych/nodes/scalar.rb
index ee5570518e..1b1b25b98a 100644
--- a/ext/psych/lib/psych/nodes/scalar.rb
+++ b/ext/psych/lib/psych/nodes/scalar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/sequence.rb b/ext/psych/lib/psych/nodes/sequence.rb
index 1096469567..e4b833d330 100644
--- a/ext/psych/lib/psych/nodes/sequence.rb
+++ b/ext/psych/lib/psych/nodes/sequence.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Nodes
###
@@ -57,7 +56,7 @@ module Psych
# Is this sequence started implicitly?
attr_accessor :implicit
- # The sequence style used
+ # The sequece style used
attr_accessor :style
###
diff --git a/ext/psych/lib/psych/nodes/stream.rb b/ext/psych/lib/psych/nodes/stream.rb
index 559b0846e7..7cf5e033ec 100644
--- a/ext/psych/lib/psych/nodes/stream.rb
+++ b/ext/psych/lib/psych/nodes/stream.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/omap.rb b/ext/psych/lib/psych/omap.rb
index 233b945c4a..6286270616 100644
--- a/ext/psych/lib/psych/omap.rb
+++ b/ext/psych/lib/psych/omap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
class Omap < ::Hash
end
diff --git a/ext/psych/lib/psych/parser.rb b/ext/psych/lib/psych/parser.rb
index 242512f89f..84085f1fb0 100644
--- a/ext/psych/lib/psych/parser.rb
+++ b/ext/psych/lib/psych/parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
###
# YAML event parser class. This class parses a YAML document and calls
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index f519da1465..068fc0e3cf 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'strscan'
module Psych
@@ -6,7 +5,7 @@ module Psych
# Scan scalars for built in types
class ScalarScanner
# Taken from http://yaml.org/type/timestamp.html
- TIME = /^-?\d{4}-\d{1,2}-\d{1,2}(?:[Tt]|\s+)\d{1,2}:\d\d:\d\d(?:\.\d*)?(?:\s*(?:Z|[-+]\d{1,2}:?(?:\d\d)?))?$/
+ TIME = /^\d{4}-\d{1,2}-\d{1,2}([Tt]|\s+)\d{1,2}:\d\d:\d\d(\.\d*)?(\s*Z|[-+]\d{1,2}(:\d\d)?)?/
# Taken from http://yaml.org/type/float.html
FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10)
@@ -38,7 +37,7 @@ module Psych
case string
# Check for a String type, being careful not to get caught by hash keys, hex values, and
# special floats (e.g., -.inf).
- when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/, /\n/
+ when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/
if string.length > 5
@string_cache[string] = true
return string
@@ -124,7 +123,7 @@ module Psych
klass = class_loader.load 'Time'
date, time = *(string.split(/[ tT]/, 2))
- (yy, m, dd) = date.match(/^(-?\d{4})-(\d{1,2})-(\d{1,2})/).captures.map { |x| x.to_i }
+ (yy, m, dd) = date.split('-').map { |x| x.to_i }
md = time.match(/(\d+:\d+:\d+)(?:\.(\d*))?\s*(Z|[-+]\d+(:\d\d)?)?/)
(hh, mm, ss) = md[1].split(':').map { |x| x.to_i }
diff --git a/ext/psych/lib/psych/set.rb b/ext/psych/lib/psych/set.rb
index f35be15e6f..6793a8ed1b 100644
--- a/ext/psych/lib/psych/set.rb
+++ b/ext/psych/lib/psych/set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
class Set < ::Hash
end
diff --git a/ext/psych/lib/psych/stream.rb b/ext/psych/lib/psych/stream.rb
index 2f63d7d552..88c4c4cb4e 100644
--- a/ext/psych/lib/psych/stream.rb
+++ b/ext/psych/lib/psych/stream.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
###
# Psych::Stream is a streaming YAML emitter. It will not buffer your YAML,
diff --git a/ext/psych/lib/psych/streaming.rb b/ext/psych/lib/psych/streaming.rb
index 260f8a8008..9d94eb549f 100644
--- a/ext/psych/lib/psych/streaming.rb
+++ b/ext/psych/lib/psych/streaming.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Streaming
module ClassMethods
diff --git a/ext/psych/lib/psych/syntax_error.rb b/ext/psych/lib/psych/syntax_error.rb
index db293b9fb2..e200ef0060 100644
--- a/ext/psych/lib/psych/syntax_error.rb
+++ b/ext/psych/lib/psych/syntax_error.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/exception'
module Psych
diff --git a/ext/psych/lib/psych/tree_builder.rb b/ext/psych/lib/psych/tree_builder.rb
index d359c933af..c8f344787c 100644
--- a/ext/psych/lib/psych/tree_builder.rb
+++ b/ext/psych/lib/psych/tree_builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/handler'
module Psych
diff --git a/ext/psych/lib/psych/versions.rb b/ext/psych/lib/psych/versions.rb
deleted file mode 100644
index 5f7652b097..0000000000
--- a/ext/psych/lib/psych/versions.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: false
-module Psych
- DEFAULT_SNAKEYAML_VERSION = '1.14'.freeze
-end
diff --git a/ext/psych/lib/psych/visitors.rb b/ext/psych/lib/psych/visitors.rb
index 5dee4ebd7a..cc98b103f1 100644
--- a/ext/psych/lib/psych/visitors.rb
+++ b/ext/psych/lib/psych/visitors.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/visitors/visitor'
require 'psych/visitors/to_ruby'
require 'psych/visitors/emitter'
diff --git a/ext/psych/lib/psych/visitors/depth_first.rb b/ext/psych/lib/psych/visitors/depth_first.rb
index 2d74a212d6..c6eb814ac0 100644
--- a/ext/psych/lib/psych/visitors/depth_first.rb
+++ b/ext/psych/lib/psych/visitors/depth_first.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Visitors
class DepthFirst < Psych::Visitors::Visitor
diff --git a/ext/psych/lib/psych/visitors/emitter.rb b/ext/psych/lib/psych/visitors/emitter.rb
index f2ff9fdb28..c886e5092e 100644
--- a/ext/psych/lib/psych/visitors/emitter.rb
+++ b/ext/psych/lib/psych/visitors/emitter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Visitors
class Emitter < Psych::Visitors::Visitor
diff --git a/ext/psych/lib/psych/visitors/json_tree.rb b/ext/psych/lib/psych/visitors/json_tree.rb
index f2f0215cd2..0127ac8aa8 100644
--- a/ext/psych/lib/psych/visitors/json_tree.rb
+++ b/ext/psych/lib/psych/visitors/json_tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/json/ruby_events'
module Psych
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index c061da25f1..1bfffb952f 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/scalar_scanner'
require 'psych/class_loader'
require 'psych/exception'
@@ -33,7 +32,7 @@ module Psych
return result if @domain_types.empty? || !target.tag
key = target.tag.sub(/^[!\/]*/, '').sub(/(,\d+)\//, '\1:')
- key = "tag:#{key}" unless key =~ /^(?:tag:|x-private)/
+ key = "tag:#{key}" unless key =~ /^(tag:|x-private)/
if @domain_types.key? key
value, block = @domain_types[key]
@@ -62,7 +61,7 @@ module Psych
case o.tag
when '!binary', 'tag:yaml.org,2002:binary'
o.value.unpack('m').first
- when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
+ when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
klass = resolve_class($1)
if klass
klass.allocate.replace o.value
@@ -76,8 +75,6 @@ module Psych
class_loader.date_time
require 'date'
@ss.parse_time(o.value).to_datetime
- when '!ruby/encoding'
- ::Encoding.find o.value
when "!ruby/object:Complex"
class_loader.complex
Complex(o.value)
@@ -90,7 +87,7 @@ module Psych
Float(@ss.tokenize(o.value))
when "!ruby/regexp"
klass = class_loader.regexp
- o.value =~ /^\/(.*)\/([mixn]*)$/m
+ o.value =~ /^\/(.*)\/([mixn]*)$/
source = $1
options = 0
lang = nil
@@ -184,11 +181,9 @@ module Psych
klass = class_loader.struct
members = o.children.map { |c| accept c }
h = Hash[*members]
- s = klass.new(*h.map { |k,v|
+ klass.new(*h.map { |k,v|
class_loader.symbolize k
}).new(*h.map { |k,v| v })
- register(o, s)
- s
end
when /^!ruby\/object:?(.*)?$/
@@ -202,14 +197,12 @@ module Psych
class_loader.rational
h = Hash[*o.children.map { |c| accept c }]
register o, Rational(h['numerator'], h['denominator'])
- elsif name == 'Hash'
- revive_hash(register(o, {}), o)
else
obj = revive((resolve_class(name) || class_loader.object), o)
obj
end
- when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
+ when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
klass = resolve_class($1)
members = {}
string = nil
@@ -262,23 +255,8 @@ module Psych
end
set
- when /^!ruby\/hash-with-ivars(?::(.*))?$/
- hash = $1 ? resolve_class($1).allocate : {}
- register o, hash
- o.children.each_slice(2) do |key, value|
- case key.value
- when 'elements'
- revive_hash hash, value
- when 'ivars'
- value.children.each_slice(2) do |k,v|
- hash.instance_variable_set accept(k), accept(v)
- end
- end
- end
- hash
-
when /^!map:(.*)$/, /^!ruby\/hash:(.*)$/
- revive_hash register(o, resolve_class($1).allocate), o
+ revive_hash register(o, resolve_class($1).new), o
when '!omap', 'tag:yaml.org,2002:omap'
map = register(o, class_loader.psych_omap.new)
@@ -287,21 +265,6 @@ module Psych
end
map
- when /^!ruby\/marshalable:(.*)$/
- name = $1
- klass = resolve_class(name)
- obj = register(o, klass.allocate)
-
- if obj.respond_to?(:init_with)
- init_with(obj, revive_hash({}, o), o)
- elsif obj.respond_to?(:marshal_load)
- marshal_data = o.children.map(&method(:accept))
- obj.marshal_load(marshal_data)
- obj
- else
- raise ArgumentError, "Cannot deserialize #{name}"
- end
-
else
revive_hash(register(o, {}), o)
end
@@ -331,15 +294,14 @@ module Psych
list
end
- SHOVEL = '<<'
def revive_hash hash, o
o.children.each_slice(2) { |k,v|
key = accept(k)
val = accept(v)
- if key == SHOVEL && k.tag != "tag:yaml.org,2002:str"
+ if key == '<<'
case v
- when Nodes::Alias, Nodes::Mapping
+ when Nodes::Alias
begin
hash.merge! val
rescue TypeError
diff --git a/ext/psych/lib/psych/visitors/visitor.rb b/ext/psych/lib/psych/visitors/visitor.rb
index d97bf550f6..4d7772f428 100644
--- a/ext/psych/lib/psych/visitors/visitor.rb
+++ b/ext/psych/lib/psych/visitors/visitor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Psych
module Visitors
class Visitor
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 38cee2ff78..b469e2ddc3 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'psych/tree_builder'
require 'psych/scalar_scanner'
require 'psych/class_loader'
@@ -17,20 +16,15 @@ module Psych
def initialize
@obj_to_id = {}
@obj_to_node = {}
- @targets = []
@counter = 0
end
def register target, node
- return unless target.respond_to? :object_id
- @targets << target
@obj_to_node[target.object_id] = node
end
def key? target
@obj_to_node.key? target.object_id
- rescue NoMethodError
- false
end
def id_for target
@@ -64,22 +58,13 @@ module Psych
def initialize emitter, ss, options
super()
- @started = false
- @finished = false
- @emitter = emitter
- @st = Registrar.new
- @ss = ss
- @options = options
- @line_width = options[:line_width]
- if @line_width && @line_width < 0
- if @line_width == -1
- # Treat -1 as unlimited line-width, same as libyaml does.
- @line_width = nil
- else
- fail(ArgumentError, "Invalid line_width #{@line_width}, must be non-negative or -1 for unlimited.")
- end
- end
- @coders = []
+ @started = false
+ @finished = false
+ @emitter = emitter
+ @st = Registrar.new
+ @ss = ss
+ @options = options
+ @coders = []
@dispatch_cache = Hash.new do |h,klass|
method = "visit_#{(klass.name || '').split('::').join('_')}"
@@ -165,18 +150,13 @@ module Psych
end
def visit_Psych_Omap o
- seq = @emitter.start_sequence(nil, 'tag:yaml.org,2002:omap', false, Nodes::Sequence::BLOCK)
+ seq = @emitter.start_sequence(nil, '!omap', false, Nodes::Sequence::BLOCK)
register(o, seq)
o.each { |k,v| visit_Hash k => v }
@emitter.end_sequence
end
- def visit_Encoding o
- tag = "!ruby/encoding"
- @emitter.scalar o.name, nil, tag, false, false, Nodes::Scalar::ANY
- end
-
def visit_Object o
tag = Psych.dump_tags[o.class]
unless tag
@@ -224,35 +204,12 @@ module Psych
@emitter.end_mapping
end
- def visit_NameError o
- tag = ['!ruby/exception', o.class.name].join ':'
-
- @emitter.start_mapping nil, tag, false, Nodes::Mapping::BLOCK
-
- {
- 'message' => o.message.to_s,
- 'backtrace' => private_iv_get(o, 'backtrace'),
- }.each do |k,v|
- next unless v
- @emitter.scalar k, nil, nil, true, false, Nodes::Scalar::ANY
- accept v
- end
-
- dump_ivars o
-
- @emitter.end_mapping
- end
-
def visit_Regexp o
register o, @emitter.scalar(o.inspect, nil, '!ruby/regexp', false, false, Nodes::Scalar::ANY)
end
def visit_DateTime o
- formatted = if o.offset.zero?
- o.strftime("%Y-%m-%d %H:%M:%S.%9N Z".freeze)
- else
- o.strftime("%Y-%m-%d %H:%M:%S.%9N %:z".freeze)
- end
+ formatted = format_time o.to_time
tag = '!ruby/object:DateTime'
register o, @emitter.scalar(formatted, nil, tag, false, false, Nodes::Scalar::ANY)
end
@@ -312,46 +269,41 @@ module Psych
quote = true
style = Nodes::Scalar::PLAIN
tag = nil
+ str = o
if binary?(o)
- o = [o].pack('m').chomp
+ str = [o].pack('m').chomp
tag = '!binary' # FIXME: change to below when syck is removed
#tag = 'tag:yaml.org,2002:binary'
style = Nodes::Scalar::LITERAL
plain = false
quote = false
- elsif o =~ /\n(?!\Z)/ # match \n except blank line at the end of string
+ elsif o =~ /\n/
style = Nodes::Scalar::LITERAL
- elsif o == '<<'
- style = Nodes::Scalar::SINGLE_QUOTED
- tag = 'tag:yaml.org,2002:str'
- plain = false
- quote = false
- elsif @line_width && o.length > @line_width
- style = Nodes::Scalar::FOLDED
- elsif o =~ /^[^[:word:]][^"]*$/
+ elsif o =~ /^\W/
style = Nodes::Scalar::DOUBLE_QUOTED
- elsif not String === @ss.tokenize(o) or /\A0[0-7]*[89]/ =~ o
- style = Nodes::Scalar::SINGLE_QUOTED
+ else
+ unless String === @ss.tokenize(o)
+ style = Nodes::Scalar::SINGLE_QUOTED
+ end
end
- is_primitive = o.class == ::String
- ivars = find_ivars o, is_primitive
+ ivars = find_ivars o
if ivars.empty?
- unless is_primitive
+ unless o.class == ::String
tag = "!ruby/string:#{o.class}"
plain = false
quote = false
end
- @emitter.scalar o, nil, tag, plain, quote, style
+ @emitter.scalar str, nil, tag, plain, quote, style
else
maptag = '!ruby/string'
maptag << ":#{o.class}" unless o.class == ::String
register o, @emitter.start_mapping(nil, maptag, false, Nodes::Mapping::BLOCK)
@emitter.scalar 'str', nil, nil, true, false, Nodes::Scalar::ANY
- @emitter.scalar o, nil, tag, plain, quote, style
+ @emitter.scalar str, nil, tag, plain, quote, style
dump_ivars o
@@ -378,16 +330,17 @@ module Psych
end
def visit_Hash o
- if o.class == ::Hash
- register(o, @emitter.start_mapping(nil, nil, true, Psych::Nodes::Mapping::BLOCK))
- o.each do |k,v|
- accept k
- accept v
- end
- @emitter.end_mapping
- else
- visit_hash_subclass o
+ tag = o.class == ::Hash ? nil : "!ruby/hash:#{o.class}"
+ implicit = !tag
+
+ register(o, @emitter.start_mapping(nil, tag, implicit, Psych::Nodes::Mapping::BLOCK))
+
+ o.each do |k,v|
+ accept k
+ accept v
end
+
+ @emitter.end_mapping
end
def visit_Psych_Set o
@@ -416,23 +369,7 @@ module Psych
end
def visit_Symbol o
- if o.empty?
- @emitter.scalar "", nil, '!ruby/symbol', false, false, Nodes::Scalar::ANY
- else
- @emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY
- end
- end
-
- def visit_BasicObject o
- tag = Psych.dump_tags[o.class]
- tag ||= "!ruby/marshalable:#{o.class.name}"
-
- map = @emitter.start_mapping(nil, tag, false, Nodes::Mapping::BLOCK)
- register(o, map)
-
- o.marshal_dump.each(&method(:accept))
-
- @emitter.end_mapping
+ @emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY
end
private
@@ -449,8 +386,7 @@ module Psych
def visit_array_subclass o
tag = "!ruby/array:#{o.class}"
- ivars = o.instance_variables
- if ivars.empty?
+ if o.instance_variables.empty?
node = @emitter.start_sequence(nil, tag, false, Nodes::Sequence::BLOCK)
register o, node
o.each { |c| accept c }
@@ -468,7 +404,7 @@ module Psych
# Dump the ivars
accept 'ivars'
@emitter.start_mapping(nil, nil, true, Nodes::Sequence::BLOCK)
- ivars.each do |ivar|
+ o.instance_variables.each do |ivar|
accept ivar
accept o.instance_variable_get ivar
end
@@ -478,57 +414,35 @@ module Psych
end
end
- def visit_hash_subclass o
- ivars = o.instance_variables
- if ivars.any?
- tag = "!ruby/hash-with-ivars:#{o.class}"
- node = @emitter.start_mapping(nil, tag, false, Psych::Nodes::Mapping::BLOCK)
- register(o, node)
+ def dump_list o
+ end
- # Dump the elements
- accept 'elements'
- @emitter.start_mapping nil, nil, true, Nodes::Mapping::BLOCK
- o.each do |k,v|
- accept k
- accept v
- end
- @emitter.end_mapping
+ # '%:z' was no defined until 1.9.3
+ if RUBY_VERSION < '1.9.3'
+ def format_time time
+ formatted = time.strftime("%Y-%m-%d %H:%M:%S.%9N")
- # Dump the ivars
- accept 'ivars'
- @emitter.start_mapping nil, nil, true, Nodes::Mapping::BLOCK
- o.instance_variables.each do |ivar|
- accept ivar
- accept o.instance_variable_get ivar
+ if time.utc?
+ formatted += " Z"
+ else
+ zone = time.strftime('%z')
+ formatted += " #{zone[0,3]}:#{zone[3,5]}"
end
- @emitter.end_mapping
- @emitter.end_mapping
- else
- tag = "!ruby/hash:#{o.class}"
- node = @emitter.start_mapping(nil, tag, false, Psych::Nodes::Mapping::BLOCK)
- register(o, node)
- o.each do |k,v|
- accept k
- accept v
- end
- @emitter.end_mapping
+ formatted
end
- end
-
- def dump_list o
- end
-
- def format_time time
- if time.utc?
- time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
- else
- time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
+ else
+ def format_time time
+ if time.utc?
+ time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
+ else
+ time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
+ end
end
end
# FIXME: remove this method once "to_yaml_properties" is removed
- def find_ivars target, is_primitive=false
+ def find_ivars target
begin
loc = target.method(:to_yaml_properties).source_location.first
unless loc.start_with?(Psych::DEPRECATED) || loc.end_with?('rubytypes.rb')
@@ -542,7 +456,7 @@ module Psych
# and it's OK to skip it since it's only to emit a warning.
end
- is_primitive ? [] : target.instance_variables
+ target.instance_variables
end
def register target, yaml_obj
@@ -560,10 +474,10 @@ module Psych
c = Psych::Coder.new(tag)
o.encode_with(c)
- emit_coder c, o
+ emit_coder c
end
- def emit_coder c, o
+ def emit_coder c
case c.type
when :scalar
@emitter.scalar c.scalar, nil, c.tag, c.tag.nil?, false, Nodes::Scalar::ANY
@@ -574,7 +488,7 @@ module Psych
end
@emitter.end_sequence
when :map
- register o, @emitter.start_mapping(nil, c.tag, c.implicit, c.style)
+ @emitter.start_mapping nil, c.tag, c.implicit, c.style
c.map.each do |k,v|
accept k
accept v
diff --git a/ext/psych/lib/psych/y.rb b/ext/psych/lib/psych/y.rb
index 82e05a783c..d0e049d4e5 100644
--- a/ext/psych/lib/psych/y.rb
+++ b/ext/psych/lib/psych/y.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Kernel
###
# An alias for Psych.dump_stream meant to be used with IRB.
diff --git a/ext/psych/lib/psych_jars.rb b/ext/psych/lib/psych_jars.rb
deleted file mode 100644
index bd7ea04de7..0000000000
--- a/ext/psych/lib/psych_jars.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# frozen_string_literal: false
-require 'psych/versions'
-require 'psych.jar'
-
-require 'jar-dependencies'
-require_jar('org.yaml', 'snakeyaml', Psych::DEFAULT_SNAKEYAML_VERSION)
diff --git a/ext/psych/psych.c b/ext/psych/psych.c
index 3bb59bfc11..69ff1d8dfc 100644
--- a/ext/psych/psych.c
+++ b/ext/psych/psych.c
@@ -20,7 +20,7 @@ static VALUE libyaml_version(VALUE module)
VALUE mPsych;
-void Init_psych(void)
+void Init_psych()
{
mPsych = rb_define_module("Psych");
diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec
index c50ce592a9..a8599c9bd1 100644
--- a/ext/psych/psych.gemspec
+++ b/ext/psych/psych.gemspec
@@ -1,45 +1,23 @@
# -*- encoding: utf-8 -*-
-# stub: psych 2.1.0 ruby lib
-# stub: ext/psych/extconf.rb
Gem::Specification.new do |s|
s.name = "psych"
- s.version = "2.1.0.1"
+ s.version = "2.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.require_paths = ["lib"]
s.authors = ["Aaron Patterson"]
- s.date = "2016-06-24"
+ s.date = "2013-09-18"
s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
s.email = ["aaron@tenderlovemaking.com"]
s.extensions = ["ext/psych/extconf.rb"]
- s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "CHANGELOG.rdoc", "README.rdoc"]
- s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb", "lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "lib/psych_jars.rb", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
+ s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/visitors.rb", "lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_engine_manager.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb", ".gemtest"]
s.homepage = "http://github.com/tenderlove/psych"
- s.licenses = ["MIT"]
s.rdoc_options = ["--main", "README.rdoc"]
+ s.require_paths = ["lib"]
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
- s.rubygems_version = "2.5.1"
+ s.rubyforge_project = "psych"
+ s.rubygems_version = "2.0.2"
s.summary = "Psych is a YAML parser and emitter"
-
- if s.respond_to? :specification_version then
- s.specification_version = 4
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
- s.add_development_dependency(%q<rake-compiler>, [">= 0.4.1"])
- s.add_development_dependency(%q<minitest>, ["~> 5.0"])
- s.add_development_dependency(%q<hoe>, ["~> 3.15"])
- else
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
- s.add_dependency(%q<rake-compiler>, [">= 0.4.1"])
- s.add_dependency(%q<minitest>, ["~> 5.0"])
- s.add_dependency(%q<hoe>, ["~> 3.15"])
- end
- else
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
- s.add_dependency(%q<rake-compiler>, [">= 0.4.1"])
- s.add_dependency(%q<minitest>, ["~> 5.0"])
- s.add_dependency(%q<hoe>, ["~> 3.15"])
- end
+ s.test_files = ["test/psych/handlers/test_recorder.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_engine_manager.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
end
diff --git a/ext/psych/psych_emitter.c b/ext/psych/psych_emitter.c
index 371c285183..f0d032649c 100644
--- a/ext/psych/psych_emitter.c
+++ b/ext/psych/psych_emitter.c
@@ -1,12 +1,5 @@
#include <psych.h>
-#if !defined(RARRAY_CONST_PTR)
-#define RARRAY_CONST_PTR(s) (const VALUE *)RARRAY_PTR(s)
-#endif
-#if !defined(RARRAY_AREF)
-#define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i]
-#endif
-
VALUE cPsychEmitter;
static ID id_write;
static ID id_line_width;
@@ -22,11 +15,7 @@ static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
static int writer(void *ctx, unsigned char *buffer, size_t size)
{
VALUE io = (VALUE)ctx;
-#ifdef HAVE_RUBY_ENCODING_H
- VALUE str = rb_enc_str_new((const char *)buffer, (long)size, rb_utf8_encoding());
-#else
VALUE str = rb_str_new((const char *)buffer, (long)size);
-#endif
VALUE wrote = rb_funcall(io, id_write, 1, str);
return (int)NUM2INT(wrote);
}
@@ -40,34 +29,17 @@ static void dealloc(void * ptr)
xfree(emitter);
}
-#if 0
-static size_t memsize(const void *ptr)
-{
- const yaml_emitter_t *emitter = ptr;
- /* TODO: calculate emitter's size */
- return 0;
-}
-#endif
-
-static const rb_data_type_t psych_emitter_type = {
- "Psych/emitter",
- {0, dealloc, 0,},
- 0, 0,
-#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- RUBY_TYPED_FREE_IMMEDIATELY,
-#endif
-};
-
static VALUE allocate(VALUE klass)
{
yaml_emitter_t * emitter;
- VALUE obj = TypedData_Make_Struct(klass, yaml_emitter_t, &psych_emitter_type, emitter);
+
+ emitter = xmalloc(sizeof(yaml_emitter_t));
yaml_emitter_initialize(emitter);
yaml_emitter_set_unicode(emitter, 1);
yaml_emitter_set_indent(emitter, 2);
- return obj;
+ return Data_Wrap_Struct(klass, 0, dealloc, emitter);
}
/* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
@@ -82,7 +54,7 @@ static VALUE initialize(int argc, VALUE *argv, VALUE self)
VALUE indent;
VALUE canonical;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
if (rb_scan_args(argc, argv, "11", &io, &options) == 2) {
line_width = rb_funcall(options, id_line_width, 0);
@@ -109,7 +81,7 @@ static VALUE start_stream(VALUE self, VALUE encoding)
{
yaml_emitter_t * emitter;
yaml_event_t event;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
Check_Type(encoding, T_FIXNUM);
yaml_stream_start_event_initialize(&event, (yaml_encoding_t)NUM2INT(encoding));
@@ -129,7 +101,7 @@ static VALUE end_stream(VALUE self)
{
yaml_emitter_t * emitter;
yaml_event_t event;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_stream_end_event_initialize(&event);
@@ -152,7 +124,7 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
yaml_tag_directive_t * tail = NULL;
yaml_event_t event;
yaml_version_directive_t version_directive;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
Check_Type(version, T_ARRAY);
@@ -166,20 +138,18 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
}
if(RTEST(tags)) {
- long i = 0;
- long len;
+ int i = 0;
#ifdef HAVE_RUBY_ENCODING_H
rb_encoding * encoding = rb_utf8_encoding();
#endif
Check_Type(tags, T_ARRAY);
- len = RARRAY_LEN(tags);
- head = xcalloc((size_t)len, sizeof(yaml_tag_directive_t));
+ head = xcalloc((size_t)RARRAY_LEN(tags), sizeof(yaml_tag_directive_t));
tail = head;
- for(i = 0; i < len && i < RARRAY_LEN(tags); i++) {
- VALUE tuple = RARRAY_AREF(tags, i);
+ for(i = 0; i < RARRAY_LEN(tags); i++) {
+ VALUE tuple = RARRAY_PTR(tags)[i];
VALUE name;
VALUE value;
@@ -189,17 +159,15 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
xfree(head);
rb_raise(rb_eRuntimeError, "tag tuple must be of length 2");
}
- name = RARRAY_AREF(tuple, 0);
- value = RARRAY_AREF(tuple, 1);
- StringValue(name);
- StringValue(value);
+ name = RARRAY_PTR(tuple)[0];
+ value = RARRAY_PTR(tuple)[1];
#ifdef HAVE_RUBY_ENCODING_H
name = rb_str_export_to_enc(name, encoding);
value = rb_str_export_to_enc(value, encoding);
#endif
- tail->handle = (yaml_char_t *)RSTRING_PTR(name);
- tail->prefix = (yaml_char_t *)RSTRING_PTR(value);
+ tail->handle = (yaml_char_t *)StringValuePtr(name);
+ tail->prefix = (yaml_char_t *)StringValuePtr(value);
tail++;
}
@@ -230,7 +198,7 @@ static VALUE end_document(VALUE self, VALUE imp)
{
yaml_emitter_t * emitter;
yaml_event_t event;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_document_end_event_initialize(&event, imp ? 1 : 0);
@@ -260,7 +228,7 @@ static VALUE scalar(
#ifdef HAVE_RUBY_ENCODING_H
rb_encoding *encoding;
#endif
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
Check_Type(value, T_STRING);
@@ -327,7 +295,7 @@ static VALUE start_sequence(
}
#endif
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_sequence_start_event_initialize(
&event,
@@ -352,7 +320,7 @@ static VALUE end_sequence(VALUE self)
{
yaml_emitter_t * emitter;
yaml_event_t event;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_sequence_end_event_initialize(&event);
@@ -380,7 +348,7 @@ static VALUE start_mapping(
#ifdef HAVE_RUBY_ENCODING_H
rb_encoding *encoding;
#endif
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
#ifdef HAVE_RUBY_ENCODING_H
encoding = rb_utf8_encoding();
@@ -419,7 +387,7 @@ static VALUE end_mapping(VALUE self)
{
yaml_emitter_t * emitter;
yaml_event_t event;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_mapping_end_event_initialize(&event);
@@ -438,7 +406,7 @@ static VALUE alias(VALUE self, VALUE anchor)
{
yaml_emitter_t * emitter;
yaml_event_t event;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
#ifdef HAVE_RUBY_ENCODING_H
if(!NIL_P(anchor)) {
@@ -464,7 +432,7 @@ static VALUE alias(VALUE self, VALUE anchor)
static VALUE set_canonical(VALUE self, VALUE style)
{
yaml_emitter_t * emitter;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_emitter_set_canonical(emitter, Qtrue == style ? 1 : 0);
@@ -478,7 +446,7 @@ static VALUE set_canonical(VALUE self, VALUE style)
static VALUE canonical(VALUE self)
{
yaml_emitter_t * emitter;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
return (emitter->canonical == 0) ? Qfalse : Qtrue;
}
@@ -491,7 +459,7 @@ static VALUE canonical(VALUE self)
static VALUE set_indentation(VALUE self, VALUE level)
{
yaml_emitter_t * emitter;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_emitter_set_indent(emitter, NUM2INT(level));
@@ -505,7 +473,7 @@ static VALUE set_indentation(VALUE self, VALUE level)
static VALUE indentation(VALUE self)
{
yaml_emitter_t * emitter;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
return INT2NUM(emitter->best_indent);
}
@@ -517,7 +485,7 @@ static VALUE indentation(VALUE self)
static VALUE line_width(VALUE self)
{
yaml_emitter_t * emitter;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
return INT2NUM(emitter->best_width);
}
@@ -529,14 +497,14 @@ static VALUE line_width(VALUE self)
static VALUE set_line_width(VALUE self, VALUE width)
{
yaml_emitter_t * emitter;
- TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
+ Data_Get_Struct(self, yaml_emitter_t, emitter);
yaml_emitter_set_width(emitter, NUM2INT(width));
return width;
}
-void Init_psych_emitter(void)
+void Init_psych_emitter()
{
VALUE psych = rb_define_module("Psych");
VALUE handler = rb_define_class_under(psych, "Handler", rb_cObject);
diff --git a/ext/psych/psych_emitter.h b/ext/psych/psych_emitter.h
index 4c1482a78b..560451ef31 100644
--- a/ext/psych/psych_emitter.h
+++ b/ext/psych/psych_emitter.h
@@ -3,6 +3,6 @@
#include <psych.h>
-void Init_psych_emitter(void);
+void Init_psych_emitter();
#endif
diff --git a/ext/psych/psych_parser.c b/ext/psych/psych_parser.c
index 2caa8a09c3..8c65ce1307 100644
--- a/ext/psych/psych_parser.c
+++ b/ext/psych/psych_parser.c
@@ -49,32 +49,14 @@ static void dealloc(void * ptr)
xfree(parser);
}
-#if 0
-static size_t memsize(const void *ptr)
-{
- const yaml_parser_t *parser = ptr;
- /* TODO: calculate parser's size */
- return 0;
-}
-#endif
-
-static const rb_data_type_t psych_parser_type = {
- "Psych/parser",
- {0, dealloc, 0,},
- 0, 0,
-#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- RUBY_TYPED_FREE_IMMEDIATELY,
-#endif
-};
-
static VALUE allocate(VALUE klass)
{
yaml_parser_t * parser;
- VALUE obj = TypedData_Make_Struct(klass, yaml_parser_t, &psych_parser_type, parser);
+ parser = xmalloc(sizeof(yaml_parser_t));
yaml_parser_initialize(parser);
- return obj;
+ return Data_Wrap_Struct(klass, 0, dealloc, parser);
}
static VALUE make_exception(yaml_parser_t * parser, VALUE path)
@@ -266,7 +248,7 @@ static VALUE parse(int argc, VALUE *argv, VALUE self)
path = rb_str_new2("<unknown>");
}
- TypedData_Get_Struct(self, yaml_parser_t, &psych_parser_type, parser);
+ Data_Get_Struct(self, yaml_parser_t, parser);
yaml_parser_delete(parser);
yaml_parser_initialize(parser);
@@ -544,7 +526,7 @@ static VALUE mark(VALUE self)
VALUE args[3];
yaml_parser_t * parser;
- TypedData_Get_Struct(self, yaml_parser_t, &psych_parser_type, parser);
+ Data_Get_Struct(self, yaml_parser_t, parser);
mark_klass = rb_const_get_at(cPsychParser, rb_intern("Mark"));
args[0] = INT2NUM(parser->mark.index);
args[1] = INT2NUM(parser->mark.line);
@@ -553,7 +535,7 @@ static VALUE mark(VALUE self)
return rb_class_new_instance(3, args, mark_klass);
}
-void Init_psych_parser(void)
+void Init_psych_parser()
{
#if 0
mPsych = rb_define_module("Psych");
diff --git a/ext/psych/psych_parser.h b/ext/psych/psych_parser.h
index beb3dd0709..25e896f01d 100644
--- a/ext/psych/psych_parser.h
+++ b/ext/psych/psych_parser.h
@@ -1,6 +1,6 @@
#ifndef PSYCH_PARSER_H
#define PSYCH_PARSER_H
-void Init_psych_parser(void);
+void Init_psych_parser();
#endif
diff --git a/ext/psych/yaml/api.c b/ext/psych/yaml/api.c
index b1a8da0bda..0c4732e152 100644
--- a/ext/psych/yaml/api.c
+++ b/ext/psych/yaml/api.c
@@ -415,7 +415,7 @@ yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
{
yaml_emitter_t *emitter = data;
- if (emitter->output.string.size - *emitter->output.string.size_written
+ if (emitter->output.string.size + *emitter->output.string.size_written
< size) {
memcpy(emitter->output.string.buffer
+ *emitter->output.string.size_written,
diff --git a/ext/psych/yaml/config.h b/ext/psych/yaml/config.h
index 79e8501f4f..6d6c25b3b1 100644
--- a/ext/psych/yaml/config.h
+++ b/ext/psych/yaml/config.h
@@ -1,10 +1,11 @@
+
#define PACKAGE_NAME "yaml"
#define PACKAGE_TARNAME "yaml"
-#define PACKAGE_VERSION "0.1.7"
-#define PACKAGE_STRING "yaml 0.1.7"
-#define PACKAGE_BUGREPORT "https://github.com/yaml/libyaml/issues"
-#define PACKAGE_URL "https://github.com/yaml/libyaml"
+#define PACKAGE_VERSION "0.1.4"
+#define PACKAGE_STRING "yaml 0.1.4"
+#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component libyaml"
+#define PACKAGE_URL ""
#define YAML_VERSION_MAJOR 0
#define YAML_VERSION_MINOR 1
-#define YAML_VERSION_PATCH 7
-#define YAML_VERSION_STRING "0.1.7"
+#define YAML_VERSION_PATCH 4
+#define YAML_VERSION_STRING "0.1.4"
diff --git a/ext/psych/yaml/emitter.c b/ext/psych/yaml/emitter.c
index 5adcbdeb32..c852f9309f 100644
--- a/ext/psych/yaml/emitter.c
+++ b/ext/psych/yaml/emitter.c
@@ -221,7 +221,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter);
static int
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
- char *indicator, int need_whitespace,
+ const char *indicator, int need_whitespace,
int is_whitespace, int is_indention);
static int
@@ -1493,7 +1493,7 @@ yaml_emitter_analyze_scalar(yaml_emitter_t *emitter,
int break_space = 0;
int space_break = 0;
- int preceded_by_whitespace = 0;
+ int preceeded_by_whitespace = 0;
int followed_by_whitespace = 0;
int previous_space = 0;
int previous_break = 0;
@@ -1524,7 +1524,7 @@ yaml_emitter_analyze_scalar(yaml_emitter_t *emitter,
flow_indicators = 1;
}
- preceded_by_whitespace = 1;
+ preceeded_by_whitespace = 1;
followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));
while (string.pointer != string.end)
@@ -1570,7 +1570,7 @@ yaml_emitter_analyze_scalar(yaml_emitter_t *emitter,
}
}
- if (CHECK(string, '#') && preceded_by_whitespace) {
+ if (CHECK(string, '#') && preceeded_by_whitespace) {
flow_indicators = 1;
block_indicators = 1;
}
@@ -1619,7 +1619,7 @@ yaml_emitter_analyze_scalar(yaml_emitter_t *emitter,
previous_break = 0;
}
- preceded_by_whitespace = IS_BLANKZ(string);
+ preceeded_by_whitespace = IS_BLANKZ(string);
MOVE(string);
if (string.pointer != string.end) {
followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));
@@ -1784,7 +1784,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter)
static int
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
- char *indicator, int need_whitespace,
+ const char *indicator, int need_whitespace,
int is_whitespace, int is_indention)
{
size_t indicator_length;
@@ -2178,7 +2178,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
yaml_string_t string)
{
char indent_hint[2];
- char *chomp_hint = NULL;
+ const char *chomp_hint = NULL;
if (IS_SPACE(string) || IS_BREAK(string))
{
diff --git a/ext/psych/yaml/loader.c b/ext/psych/yaml/loader.c
index 3ba99f087e..9d3d912663 100644
--- a/ext/psych/yaml/loader.c
+++ b/ext/psych/yaml/loader.c
@@ -239,8 +239,8 @@ yaml_parser_register_anchor(yaml_parser_t *parser,
if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
yaml_free(anchor);
return yaml_parser_set_composer_error_context(parser,
- "found duplicate anchor; first occurrence",
- alias_data->mark, "second occurrence", data.mark);
+ "found duplicate anchor; first occurence",
+ alias_data->mark, "second occurence", data.mark);
}
}
@@ -286,8 +286,6 @@ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
int index;
yaml_char_t *tag = first_event->data.scalar.tag;
- if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
-
if (!tag || strcmp((char *)tag, "!") == 0) {
yaml_free(tag);
tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SCALAR_TAG);
@@ -331,8 +329,6 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
int index, item_index;
yaml_char_t *tag = first_event->data.sequence_start.tag;
- if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
-
if (!tag || strcmp((char *)tag, "!") == 0) {
yaml_free(tag);
tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG);
@@ -355,9 +351,6 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
if (!yaml_parser_parse(parser, &event)) return 0;
while (event.type != YAML_SEQUENCE_END_EVENT) {
- if (!STACK_LIMIT(parser,
- parser->document->nodes.start[index-1].data.sequence.items,
- INT_MAX-1)) return 0;
item_index = yaml_parser_load_node(parser, &event);
if (!item_index) return 0;
if (!PUSH(parser,
@@ -394,8 +387,6 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
yaml_node_pair_t pair;
yaml_char_t *tag = first_event->data.mapping_start.tag;
- if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
-
if (!tag || strcmp((char *)tag, "!") == 0) {
yaml_free(tag);
tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_MAPPING_TAG);
@@ -418,9 +409,6 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
if (!yaml_parser_parse(parser, &event)) return 0;
while (event.type != YAML_MAPPING_END_EVENT) {
- if (!STACK_LIMIT(parser,
- parser->document->nodes.start[index-1].data.mapping.pairs,
- INT_MAX-1)) return 0;
pair.key = yaml_parser_load_node(parser, &event);
if (!pair.key) return 0;
if (!yaml_parser_parse(parser, &event)) return 0;
diff --git a/ext/psych/yaml/reader.c b/ext/psych/yaml/reader.c
index f1a06deb9d..4e48add7b8 100644
--- a/ext/psych/yaml/reader.c
+++ b/ext/psych/yaml/reader.c
@@ -460,10 +460,6 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
}
- if (parser->offset >= PTRDIFF_MAX)
- return yaml_parser_set_reader_error(parser, "input is too long",
- PTRDIFF_MAX, -1);
-
return 1;
}
diff --git a/ext/psych/yaml/scanner.c b/ext/psych/yaml/scanner.c
index 3ef90dc66b..31fed0ed94 100644
--- a/ext/psych/yaml/scanner.c
+++ b/ext/psych/yaml/scanner.c
@@ -70,7 +70,7 @@
* %TAG !yaml! tag:yaml.org,2002:
* ---
*
- * The corresponding sequence of tokens:
+ * The correspoding sequence of tokens:
*
* STREAM-START(utf-8)
* VERSION-DIRECTIVE(1,1)
@@ -615,11 +615,11 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser);
*/
static int
-yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
- ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark);
+yaml_parser_roll_indent(yaml_parser_t *parser, int column,
+ int number, yaml_token_type_t type, yaml_mark_t mark);
static int
-yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column);
+yaml_parser_unroll_indent(yaml_parser_t *parser, int column);
/*
* Token fetchers.
@@ -1103,7 +1103,14 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
*/
int required = (!parser->flow_level
- && parser->indent == (ptrdiff_t)parser->mark.column);
+ && parser->indent == (int)parser->mark.column);
+
+ /*
+ * A simple key is required only when it is the first token in the current
+ * line. Therefore it is always allowed. But we add a check anyway.
+ */
+
+ assert(parser->simple_key_allowed || !required); /* Impossible. */
/*
* If the current position may start a simple key, save it.
@@ -1169,11 +1176,6 @@ yaml_parser_increase_flow_level(yaml_parser_t *parser)
/* Increase the flow level. */
- if (parser->flow_level == INT_MAX) {
- parser->error = YAML_MEMORY_ERROR;
- return 0;
- }
-
parser->flow_level++;
return 1;
@@ -1204,8 +1206,8 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
*/
static int
-yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
- ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark)
+yaml_parser_roll_indent(yaml_parser_t *parser, int column,
+ int number, yaml_token_type_t type, yaml_mark_t mark)
{
yaml_token_t token;
@@ -1224,11 +1226,6 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
if (!PUSH(parser, parser->indents, parser->indent))
return 0;
- if (column > INT_MAX) {
- parser->error = YAML_MEMORY_ERROR;
- return 0;
- }
-
parser->indent = column;
/* Create a token and insert it into the queue. */
@@ -1257,7 +1254,7 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
static int
-yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
+yaml_parser_unroll_indent(yaml_parser_t *parser, int column)
{
yaml_token_t token;
@@ -2053,7 +2050,7 @@ yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token)
else
{
yaml_parser_set_scanner_error(parser, "while scanning a directive",
- start_mark, "found unknown directive name");
+ start_mark, "found uknown directive name");
goto error;
}
@@ -2577,7 +2574,7 @@ yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
/* Resize the string to include the head. */
- while ((size_t)(string.end - string.start) <= length) {
+ while (string.end - string.start <= (int)length) {
if (!yaml_string_extend(&string.start, &string.pointer, &string.end)) {
parser->error = YAML_MEMORY_ERROR;
goto error;
@@ -2622,9 +2619,6 @@ yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
/* Check if it is a URI-escape sequence. */
if (CHECK(parser->buffer, '%')) {
- if (!STRING_EXTEND(parser, string))
- goto error;
-
if (!yaml_parser_scan_uri_escapes(parser,
directive, start_mark, &string)) goto error;
}
@@ -3504,7 +3498,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
{
if (IS_BLANK(parser->buffer))
{
- /* Check for tab characters that abuse indentation. */
+ /* Check for tab character that abuse indentation. */
if (leading_blanks && (int)parser->mark.column < indent
&& IS_TAB(parser->buffer)) {
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
index ce262d3086..af10c83973 100644
--- a/ext/psych/yaml/yaml_private.h
+++ b/ext/psych/yaml/yaml_private.h
@@ -10,17 +10,6 @@
#include <assert.h>
#include <limits.h>
-#include <stddef.h>
-
-#ifndef _MSC_VER
-#include <stdint.h>
-#else
-#ifdef _WIN64
-#define PTRDIFF_MAX _I64_MAX
-#else
-#define PTRDIFF_MAX INT_MAX
-#endif
-#endif
/*
* Memory management.
@@ -146,12 +135,9 @@ yaml_string_join(
(string).start = (string).pointer = (string).end = 0)
#define STRING_EXTEND(context,string) \
- ((((string).pointer+5 < (string).end) \
+ (((string).pointer+5 < (string).end) \
|| yaml_string_extend(&(string).start, \
- &(string).pointer, &(string).end)) ? \
- 1 : \
- ((context)->error = YAML_MEMORY_ERROR, \
- 0))
+ &(string).pointer, &(string).end))
#define CLEAR(context,string) \
((string).pointer = (string).start, \
@@ -438,12 +424,6 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
#define STACK_EMPTY(context,stack) \
((stack).start == (stack).top)
-#define STACK_LIMIT(context,stack,size) \
- ((stack).top - (stack).start < (size) ? \
- 1 : \
- ((context)->error = YAML_MEMORY_ERROR, \
- 0))
-
#define PUSH(context,stack,value) \
(((stack).top != (stack).end \
|| yaml_stack_extend((void **)&(stack).start, \
@@ -660,3 +640,4 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
(node).data.mapping.pairs.end = (node_pairs_end), \
(node).data.mapping.pairs.top = (node_pairs_start), \
(node).data.mapping.style = (node_style))
+
diff --git a/ext/pty/depend b/ext/pty/depend
index a1982af215..cfcd3c910e 100644
--- a/ext/pty/depend
+++ b/ext/pty/depend
@@ -1,17 +1,6 @@
-# AUTOGENERATED DEPENDENCIES START
-pty.o: $(RUBY_EXTCONF_H)
-pty.o: $(arch_hdrdir)/ruby/config.h
-pty.o: $(hdrdir)/ruby/defines.h
-pty.o: $(hdrdir)/ruby/encoding.h
-pty.o: $(hdrdir)/ruby/intern.h
-pty.o: $(hdrdir)/ruby/io.h
-pty.o: $(hdrdir)/ruby/missing.h
-pty.o: $(hdrdir)/ruby/oniguruma.h
-pty.o: $(hdrdir)/ruby/ruby.h
-pty.o: $(hdrdir)/ruby/st.h
-pty.o: $(hdrdir)/ruby/subst.h
-pty.o: $(hdrdir)/ruby/util.h
-pty.o: $(top_srcdir)/include/ruby.h
-pty.o: $(top_srcdir)/internal.h
-pty.o: pty.c
-# AUTOGENERATED DEPENDENCIES END
+pty.o: pty.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/util.h \
+ $(top_srcdir)/internal.h
diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb
index b37057f3c9..1db9f6e8aa 100644
--- a/ext/pty/extconf.rb
+++ b/ext/pty/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
diff --git a/ext/pty/lib/expect.rb b/ext/pty/lib/expect.rb
index 122562127d..c3f3925be7 100644
--- a/ext/pty/lib/expect.rb
+++ b/ext/pty/lib/expect.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$expect_verbose = false
# Expect library adds the IO instance method #expect, which does similar act to
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index c8aee4ce38..4ba1cba621 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -33,9 +33,10 @@
#endif
#include <ctype.h>
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/util.h"
+#include "internal.h"
#include <signal.h>
#ifdef HAVE_SYS_STROPTS_H
@@ -182,7 +183,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
carg.execarg_obj = rb_execarg_new(argc, argv, 1);
carg.eargp = rb_execarg_get(carg.execarg_obj);
- rb_execarg_parent_start(carg.execarg_obj);
+ rb_execarg_fixup(carg.execarg_obj);
getDevice(&master, &slave, SlaveName, 0);
@@ -196,14 +197,12 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
int e = errno;
close(master);
close(slave);
- rb_execarg_parent_end(carg.execarg_obj);
errno = e;
if (status) rb_jump_tag(status);
rb_sys_fail(errbuf[0] ? errbuf : "fork failed");
}
close(slave);
- rb_execarg_parent_end(carg.execarg_obj);
info->child_pid = pid;
info->fd = master;
@@ -263,7 +262,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if ((slavefd = rb_cloexec_open(slavedevice, O_RDWR|O_NOCTTY, 0)) == -1) goto error;
rb_update_max_fd(slavefd);
-#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
+#if defined(I_PUSH) && !defined(__linux__)
if (ioctl(slavefd, I_PUSH, "ptem") == -1) goto error;
if (ioctl(slavefd, I_PUSH, "ldterm") == -1) goto error;
if (ioctl(slavefd, I_PUSH, "ttcompat") == -1) goto error;
@@ -347,7 +346,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
if (no_mesg(slavedevice, nomesg) == -1) goto error;
if((slavefd = rb_cloexec_open(slavedevice, O_RDWR, 0)) == -1) goto error;
rb_update_max_fd(slavefd);
-#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
+#if defined(I_PUSH) && !defined(__linux__)
if(ioctl(slavefd, I_PUSH, "ptem") == -1) goto error;
if(ioctl(slavefd, I_PUSH, "ldterm") == -1) goto error;
ioctl(slavefd, I_PUSH, "ttcompat");
@@ -505,14 +504,6 @@ pty_close_pty(VALUE assoc)
* +slave_file+:: the slave of the pty, as a File. The path to the
* terminal device is available via +slave_file.path+
*
- * IO#raw! is usable to disable newline conversions:
- *
- * require 'io/console'
- * PTY.open {|m, s|
- * s.raw!
- * ...
- * }
- *
*/
static VALUE
pty_open(VALUE klass)
@@ -547,11 +538,6 @@ pty_open(VALUE klass)
static VALUE
pty_detach_process(struct pty_info *info)
{
-#ifdef WNOHANG
- int st;
- if (rb_waitpid(info->child_pid, &st, WNOHANG) <= 0)
- return Qnil;
-#endif
rb_detach_process(info->child_pid);
return Qnil;
}
@@ -579,7 +565,7 @@ pty_detach_process(struct pty_info *info)
*
* In the block form these same values will be yielded to the block:
*
- * +r+:: A readable IO that contains the command's
+ * +r+:: A readable IO that that contains the command's
* standard output and standard error
* +w+:: A writable IO that is the command's standard input
* +pid+:: The process identifier for the command.
@@ -599,11 +585,11 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
establishShell(argc, argv, &info, SlaveName);
- rfptr->mode = rb_io_modestr_fmode("r");
+ rfptr->mode = rb_io_mode_flags("r");
rfptr->fd = info.fd;
rfptr->pathv = rb_obj_freeze(rb_str_new_cstr(SlaveName));
- wfptr->mode = rb_io_modestr_fmode("w") | FMODE_SYNC;
+ wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC;
wfptr->fd = rb_cloexec_dup(info.fd);
if (wfptr->fd == -1)
rb_sys_fail("dup()");
@@ -627,7 +613,7 @@ static void
raise_from_check(rb_pid_t pid, int status)
{
const char *state;
- VALUE msg;
+ char buf[1024];
VALUE exc;
#if defined(WIFSTOPPED)
@@ -645,8 +631,8 @@ raise_from_check(rb_pid_t pid, int status)
else {
state = "exited";
}
- msg = rb_sprintf("pty - %s: %ld", state, (long)pid);
- exc = rb_exc_new_str(eChildExited, msg);
+ snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)pid);
+ exc = rb_exc_new2(eChildExited, buf);
rb_iv_set(exc, "status", rb_last_status_get());
rb_exc_raise(exc);
}
@@ -733,7 +719,7 @@ static VALUE cPTY;
* # The result of read operation when pty slave is closed is platform
* # dependent.
* ret = begin
- * master.gets # FreeBSD returns nil.
+ * m.gets # FreeBSD returns nil.
* rescue Errno::EIO # GNU/Linux raises EIO.
* nil
* end
@@ -754,10 +740,10 @@ static VALUE cPTY;
*/
void
-Init_pty(void)
+Init_pty()
{
cPTY = rb_define_module("PTY");
- /* :nodoc: */
+ /* :nodoc */
rb_define_module_function(cPTY,"getpty",pty_getpty,-1);
rb_define_module_function(cPTY,"spawn",pty_getpty,-1);
rb_define_singleton_method(cPTY,"check",pty_check,-1);
diff --git a/ext/racc/cparse/README b/ext/racc/cparse/README
index 7771108b84..80b4dce311 100644
--- a/ext/racc/cparse/README
+++ b/ext/racc/cparse/README
@@ -6,6 +6,5 @@ Racc parser generator. If you want to generate
your own parser, you must get Racc full package.
Get it from:
- - http://i.loveruby.net/en/projects/racc
- - https://github.com/tenderlove/racc
+ http://raa.ruby-lang.org/list.rhtml?name=racc
diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c
index b4429ed5f3..8c16656a28 100644
--- a/ext/racc/cparse/cparse.c
+++ b/ext/racc/cparse/cparse.c
@@ -192,7 +192,7 @@ static VALUE racc_yyparse _((VALUE parser, VALUE lexer, VALUE lexmid,
VALUE arg, VALUE sysdebug));
static void call_lexer _((struct cparse_params *v));
-static VALUE lexer_i _((RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data)));
+static VALUE lexer_i _((VALUE block_args, VALUE data, VALUE self));
static VALUE assert_array _((VALUE a));
static long assert_integer _((VALUE n));
@@ -200,7 +200,6 @@ static VALUE assert_hash _((VALUE h));
static VALUE initialize_params _((VALUE vparams, VALUE parser, VALUE arg,
VALUE lexer, VALUE lexmid));
static void cparse_params_mark _((void *ptr));
-static size_t cparse_params_memsize _((const void *ptr));
static void parse_main _((struct cparse_params *v,
VALUE tok, VALUE val, int resume));
@@ -218,48 +217,31 @@ static VALUE reduce0 _((VALUE block_args, VALUE data, VALUE self));
# define D_printf(fmt,arg)
#endif
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 1
-
-static const rb_data_type_t cparse_params_type = {
- "racc/cparse",
- {
- cparse_params_mark,
- RUBY_TYPED_DEFAULT_FREE,
- cparse_params_memsize,
- },
-#ifdef RUBY_TYPED_FREE_IMMEDIATELY
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-#endif
-};
-
static VALUE
racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug)
{
- VALUE vparams;
+ volatile VALUE vparams;
struct cparse_params *v;
- vparams = TypedData_Make_Struct(CparseParams, struct cparse_params,
- &cparse_params_type, v);
+ vparams = Data_Make_Struct(CparseParams, struct cparse_params,
+ cparse_params_mark, -1, v);
D_puts("starting cparse");
v->sys_debug = RTEST(sysdebug);
vparams = initialize_params(vparams, parser, arg, Qnil, Qnil);
v->lex_is_iterator = FALSE;
parse_main(v, Qnil, Qnil, 0);
- RB_GC_GUARD(vparams);
return v->retval;
}
static VALUE
racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug)
{
- VALUE vparams;
+ volatile VALUE vparams;
struct cparse_params *v;
- vparams = TypedData_Make_Struct(CparseParams, struct cparse_params,
- &cparse_params_type, v);
+ vparams = Data_Make_Struct(CparseParams, struct cparse_params,
+ cparse_params_mark, -1, v);
v->sys_debug = RTEST(sysdebug);
D_puts("start C yyparse");
vparams = initialize_params(vparams, parser, arg, lexer, lexmid);
@@ -272,7 +254,6 @@ racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug)
rb_id2name(v->lexmid));
}
- RB_GC_GUARD(vparams);
return v->retval;
}
@@ -286,8 +267,9 @@ call_lexer(struct cparse_params *v)
static VALUE
lexer_iter(VALUE data)
{
- struct cparse_params *v = rb_check_typeddata(data, &cparse_params_type);
+ struct cparse_params *v;
+ Data_Get_Struct(data, struct cparse_params, v);
rb_funcall(v->lexer, v->lexmid, 0);
return Qnil;
}
@@ -300,11 +282,12 @@ call_lexer(struct cparse_params *v)
#endif
static VALUE
-lexer_i(RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data))
+lexer_i(VALUE block_args, VALUE data, VALUE self)
{
- struct cparse_params *v = rb_check_typeddata(data, &cparse_params_type);
+ struct cparse_params *v;
VALUE tok, val;
+ Data_Get_Struct(data, struct cparse_params, v);
if (v->fin)
rb_raise(rb_eArgError, "extra token after EndOfToken");
extract_user_token(v, block_args, &tok, &val);
@@ -337,8 +320,9 @@ assert_integer(VALUE n)
static VALUE
initialize_params(VALUE vparams, VALUE parser, VALUE arg, VALUE lexer, VALUE lexmid)
{
- struct cparse_params *v = rb_check_typeddata(vparams, &cparse_params_type);
+ struct cparse_params *v;
+ Data_Get_Struct(vparams, struct cparse_params, v);
v->value_v = vparams;
v->parser = parser;
v->lexer = lexer;
@@ -421,12 +405,6 @@ cparse_params_mark(void *ptr)
rb_gc_mark(v->retval);
}
-static size_t
-cparse_params_memsize(const void *ptr)
-{
- return sizeof(struct cparse_params);
-}
-
static void
extract_user_token(struct cparse_params *v, VALUE block_args,
VALUE *tok, VALUE *val)
@@ -440,10 +418,10 @@ extract_user_token(struct cparse_params *v, VALUE block_args,
if (!RB_TYPE_P(block_args, T_ARRAY)) {
rb_raise(rb_eTypeError,
- "%s() %s %"PRIsVALUE" (must be Array[2])",
+ "%s() %s %s (must be Array[2])",
v->lex_is_iterator ? rb_id2name(v->lexmid) : "next_token",
v->lex_is_iterator ? "yielded" : "returned",
- rb_obj_class(block_args));
+ rb_class2name(CLASS_OF(block_args)));
}
if (RARRAY_LEN(block_args) != 2) {
rb_raise(rb_eArgError,
@@ -706,7 +684,7 @@ reduce(struct cparse_params *v, long act)
static VALUE
reduce0(VALUE val, VALUE data, VALUE self)
{
- struct cparse_params *v = rb_check_typeddata(data, &cparse_params_type);
+ struct cparse_params *v;
VALUE reduce_to, reduce_len, method_id;
long len;
ID mid;
@@ -714,6 +692,7 @@ reduce0(VALUE val, VALUE data, VALUE self)
long i, k1, k2;
VALUE goto_state;
+ Data_Get_Struct(data, struct cparse_params, v);
reduce_len = rb_ary_entry(v->reduce_table, v->ruleno);
reduce_to = rb_ary_entry(v->reduce_table, v->ruleno+1);
method_id = rb_ary_entry(v->reduce_table, v->ruleno+2);
@@ -815,8 +794,6 @@ reduce0(VALUE val, VALUE data, VALUE self)
void
Init_cparse(void)
{
-#undef rb_intern
-#define rb_intern(str) rb_intern_const(str)
VALUE Racc, Parser;
ID id_racc = rb_intern("Racc");
@@ -836,9 +813,6 @@ Init_cparse(void)
rb_str_new2("$originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $"));
CparseParams = rb_define_class_under(Racc, "CparseParams", rb_cObject);
- rb_undef_alloc_func(CparseParams);
- rb_undef_method(CparseParams, "initialize");
- rb_undef_method(CparseParams, "initialize_copy");
RaccBug = rb_eRuntimeError;
diff --git a/ext/racc/cparse/extconf.rb b/ext/racc/cparse/extconf.rb
index dfddf57111..3710f6f7e7 100644
--- a/ext/racc/cparse/extconf.rb
+++ b/ext/racc/cparse/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# $Id$
require 'mkmf'
diff --git a/ext/rbconfig/sizeof/depend b/ext/rbconfig/sizeof/depend
index 56564b1b99..360b3386d3 100644
--- a/ext/rbconfig/sizeof/depend
+++ b/ext/rbconfig/sizeof/depend
@@ -1,17 +1,3 @@
-sizes.c: $(top_srcdir)/tool/generic_erb.rb $(top_srcdir)/template/sizes.c.tmpl $(top_srcdir)/configure.in $(top_srcdir)/ext/rbconfig/sizeof/extconf.rb
+sizes.c: $(top_srcdir)/tool/generic_erb.rb $(top_srcdir)/template/sizes.c.tmpl $(top_srcdir)/configure.in
$(Q) $(RUBY) $(top_srcdir)/tool/generic_erb.rb --output=$@ \
- $(top_srcdir)/template/sizes.c.tmpl \
- $(top_srcdir)/configure.in \
- $(top_srcdir)/ext/rbconfig/sizeof/extconf.rb
-
-# AUTOGENERATED DEPENDENCIES START
-sizes.o: $(RUBY_EXTCONF_H)
-sizes.o: $(arch_hdrdir)/ruby/config.h
-sizes.o: $(hdrdir)/ruby/defines.h
-sizes.o: $(hdrdir)/ruby/intern.h
-sizes.o: $(hdrdir)/ruby/missing.h
-sizes.o: $(hdrdir)/ruby/ruby.h
-sizes.o: $(hdrdir)/ruby/st.h
-sizes.o: $(hdrdir)/ruby/subst.h
-sizes.o: {$(VPATH)}sizes.c
-# AUTOGENERATED DEPENDENCIES END
+ $(top_srcdir)/template/sizes.c.tmpl $(top_srcdir)/configure.in
diff --git a/ext/rbconfig/sizeof/extconf.rb b/ext/rbconfig/sizeof/extconf.rb
index b7cc876e7e..619b4256f8 100644
--- a/ext/rbconfig/sizeof/extconf.rb
+++ b/ext/rbconfig/sizeof/extconf.rb
@@ -1,36 +1,2 @@
-# frozen_string_literal: false
$srcs = %w[sizes.c]
-$distcleanfiles.concat($srcs)
-
-check_sizeof('int_least8_t')
-check_sizeof('int_least16_t')
-check_sizeof('int_least32_t')
-check_sizeof('int_least64_t')
-check_sizeof('int_fast8_t')
-check_sizeof('int_fast16_t')
-check_sizeof('int_fast32_t')
-check_sizeof('int_fast64_t')
-check_sizeof('intmax_t')
-check_sizeof('sig_atomic_t', %w[signal.h])
-check_sizeof('wchar_t')
-check_sizeof('wint_t', %w[wctype.h])
-check_sizeof('wctrans_t', %w[wctype.h])
-check_sizeof('wctype_t', %w[wctype.h])
-check_sizeof('_Bool')
-check_sizeof('long double')
-check_sizeof('float _Complex')
-check_sizeof('double _Complex')
-check_sizeof('long double _Complex')
-check_sizeof('float _Imaginary')
-check_sizeof('double _Imaginary')
-check_sizeof('long double _Imaginary')
-check_sizeof('__int128') # x86_64 ABI (optional)
-check_sizeof('__float128') # x86_64 ABI (optional)
-check_sizeof('_Decimal32') # x86_64 ABI
-check_sizeof('_Decimal64') # x86_64 ABI
-check_sizeof('_Decimal128') # x86_64 ABI
-check_sizeof('__m64') # x86_64 ABI (optional)
-check_sizeof('__m128') # x86_64 ABI (optional)
-check_sizeof('__float80') # gcc x86
-
create_makefile('rbconfig/sizeof')
diff --git a/ext/readline/depend b/ext/readline/depend
index 26777f2816..ef0414d9b2 100644
--- a/ext/readline/depend
+++ b/ext/readline/depend
@@ -1,17 +1,5 @@
-# AUTOGENERATED DEPENDENCIES START
-readline.o: $(RUBY_EXTCONF_H)
-readline.o: $(arch_hdrdir)/ruby/config.h
-readline.o: $(hdrdir)/ruby/defines.h
-readline.o: $(hdrdir)/ruby/encoding.h
-readline.o: $(hdrdir)/ruby/intern.h
-readline.o: $(hdrdir)/ruby/io.h
-readline.o: $(hdrdir)/ruby/missing.h
-readline.o: $(hdrdir)/ruby/oniguruma.h
-readline.o: $(hdrdir)/ruby/ruby.h
-readline.o: $(hdrdir)/ruby/st.h
-readline.o: $(hdrdir)/ruby/subst.h
-readline.o: $(hdrdir)/ruby/thread.h
-readline.o: $(top_srcdir)/include/ruby.h
-readline.o: $(top_srcdir)/internal.h
-readline.o: readline.c
-# AUTOGENERATED DEPENDENCIES END
+readline.o: readline.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/thread.h
diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index 776ab19ba8..0b121c1ebe 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "mkmf"
readline = Struct.new(:headers, :extra_check).new(["stdio.h"])
@@ -20,10 +19,6 @@ def readline.have_func(func)
return super(func, headers)
end
-def readline.have_type(type)
- return super(type, headers)
-end
-
dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
@@ -38,7 +33,6 @@ have_library("ncurses", "tgetnum") ||
case enable_libedit
when true
# --enable-libedit
- dir_config("libedit")
unless (readline.have_header("editline/readline.h") ||
readline.have_header("readline/readline.h")) &&
have_library("edit", "readline")
@@ -100,12 +94,4 @@ readline.have_func("clear_history")
readline.have_func("rl_redisplay")
readline.have_func("rl_insert_text")
readline.have_func("rl_delete_text")
-unless readline.have_type("rl_hook_func_t*")
- # rl_hook_func_t is available since readline-4.2 (2001).
- # Function is removed at readline-6.3 (2014).
- # However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t.
- $defs << "-Drl_hook_func_t=Function"
-end
-
-$INCFLAGS << " -I$(top_srcdir)"
create_makefile("readline")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index c3b98a8dc9..820c6b74be 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -33,7 +33,7 @@
#include <editline/readline.h>
#endif
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
@@ -229,7 +229,8 @@ readline_getc(FILE *input)
goto again;
rb_sys_fail("rb_wait_for_single_fd");
}
- rb_syserr_fail(data.err, "read");
+ errno = data.err;
+ rb_sys_fail("read");
}
return data.ret;
}
@@ -358,34 +359,6 @@ clear_rl_outstream(void)
readline_outstream = Qfalse;
}
-static void
-prepare_readline(void)
-{
- static int initialized = 0;
- if (!initialized) {
- rl_initialize();
- initialized = 1;
- }
-
- if (readline_instream) {
- rb_io_t *ifp;
- rb_io_check_initialized(ifp = RFILE(rb_io_taint_check(readline_instream))->fptr);
- if (ifp->fd < 0) {
- clear_rl_instream();
- rb_raise(rb_eIOError, "closed readline input");
- }
- }
-
- if (readline_outstream) {
- rb_io_t *ofp;
- rb_io_check_initialized(ofp = RFILE(rb_io_taint_check(readline_outstream))->fptr);
- if (ofp->fd < 0) {
- clear_rl_outstream();
- rb_raise(rb_eIOError, "closed readline output");
- }
- }
-}
-
/*
* call-seq:
* Readline.readline(prompt = "", add_hist = false) -> string or nil
@@ -487,7 +460,23 @@ readline_readline(int argc, VALUE *argv, VALUE self)
prompt = RSTRING_PTR(tmp);
}
- prepare_readline();
+ if (readline_instream) {
+ rb_io_t *ifp;
+ rb_io_check_initialized(ifp = RFILE(rb_io_taint_check(readline_instream))->fptr);
+ if (ifp->fd < 0) {
+ clear_rl_instream();
+ rb_raise(rb_eIOError, "closed readline input");
+ }
+ }
+
+ if (readline_outstream) {
+ rb_io_t *ofp;
+ rb_io_check_initialized(ofp = RFILE(rb_io_taint_check(readline_outstream))->fptr);
+ if (ofp->fd < 0) {
+ clear_rl_outstream();
+ rb_raise(rb_eIOError, "closed readline output");
+ }
+ }
#ifdef _WIN32
rl_prep_terminal(1);
@@ -556,7 +545,8 @@ readline_s_set_input(VALUE self, VALUE input)
if (f == NULL) {
int save_errno = errno;
close(fd);
- rb_syserr_fail(save_errno, "fdopen");
+ errno = save_errno;
+ rb_sys_fail("fdopen");
}
rl_instream = readline_rl_instream = f;
readline_instream = input;
@@ -592,7 +582,8 @@ readline_s_set_output(VALUE self, VALUE output)
if (f == NULL) {
int save_errno = errno;
close(fd);
- rb_syserr_fail(save_errno, "fdopen");
+ errno = save_errno;
+ rb_sys_fail("fdopen");
}
rl_outstream = readline_rl_outstream = f;
readline_outstream = output;
@@ -697,7 +688,12 @@ readline_s_delete_text(int argc, VALUE *argv, VALUE self)
char *p, *ptr = rl_line_buffer;
long beg = 0, len = strlen(rl_line_buffer);
struct RString fakestr;
- VALUE str = rb_setup_fake_str(&fakestr, ptr, len, rb_locale_encoding());
+ VALUE str = (VALUE)&fakestr;
+
+ fakestr.basic.flags = T_STRING | RSTRING_NOEMBED;
+ fakestr.as.heap.ptr = ptr;
+ fakestr.as.heap.len = len;
+ rb_enc_associate(str, rb_locale_encoding());
OBJ_FREEZE(str);
if (argc == 2) {
beg = NUM2LONG(argv[0]);
@@ -963,7 +959,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
enc = rb_locale_encoding();
encobj = rb_enc_from_encoding(enc);
for (i = 0; i < matches; i++) {
- temp = rb_obj_as_string(RARRAY_AREF(ary, i));
+ temp = rb_obj_as_string(RARRAY_PTR(ary)[i]);
StringValueCStr(temp); /* must be NUL-terminated */
rb_enc_check(encobj, temp);
result[i + 1] = (char*)malloc(RSTRING_LEN(temp) + 1);
@@ -1558,7 +1554,6 @@ readline_s_get_filename_quote_characters(VALUE self, VALUE str)
static VALUE
readline_s_refresh_line(VALUE self)
{
- prepare_readline();
rl_refresh_line(0, 0);
return Qnil;
}
@@ -1795,7 +1790,7 @@ username_completion_proc_call(VALUE self, VALUE str)
}
void
-Init_readline(void)
+Init_readline()
{
VALUE history, fcomp, ucomp, version;
@@ -1979,7 +1974,7 @@ Init_readline(void)
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
+ rl_pre_input_hook = (Function *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
diff --git a/ext/ripper/depend b/ext/ripper/depend
index 64236cd592..db7bea74ed 100644
--- a/ext/ripper/depend
+++ b/ext/ripper/depend
@@ -7,7 +7,19 @@ BISON = bison
src: ripper.c eventids1.c eventids2table.c
-ripper.o: ripper.c
+ripper.o: ripper.c id.c lex.c eventids1.c eventids2.c eventids2table.c \
+ $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/regex.h \
+ $(hdrdir)/ruby/util.h \
+ $(top_srcdir)/node.h \
+ $(top_srcdir)/internal.h \
+ {$(VPATH)}parse.h \
+ {$(VPATH)}id.h \
+ $(top_srcdir)/regenc.h \
+ $(top_srcdir)/vm_opts.h \
+ $(topdir)/probes.h
.y.c:
$(ECHO) compiling compiler $<
@@ -42,34 +54,3 @@ preproc: ripper.E
ripper.E: ripper.c
$(ECHO) preprocessing ripper.c
$(Q) $(CC) -E $(CPPFLAGS) ripper.c | $(RUBY) $(srcdir)/tools/strip.rb > $@
-
-# AUTOGENERATED DEPENDENCIES START
-ripper.o: $(RUBY_EXTCONF_H)
-ripper.o: $(arch_hdrdir)/ruby/config.h
-ripper.o: $(hdrdir)/ruby/defines.h
-ripper.o: $(hdrdir)/ruby/encoding.h
-ripper.o: $(hdrdir)/ruby/intern.h
-ripper.o: $(hdrdir)/ruby/io.h
-ripper.o: $(hdrdir)/ruby/missing.h
-ripper.o: $(hdrdir)/ruby/oniguruma.h
-ripper.o: $(hdrdir)/ruby/regex.h
-ripper.o: $(hdrdir)/ruby/ruby.h
-ripper.o: $(hdrdir)/ruby/st.h
-ripper.o: $(hdrdir)/ruby/subst.h
-ripper.o: $(hdrdir)/ruby/util.h
-ripper.o: $(top_srcdir)/include/ruby.h
-ripper.o: $(top_srcdir)/internal.h
-ripper.o: $(top_srcdir)/node.h
-ripper.o: $(top_srcdir)/regenc.h
-ripper.o: $(top_srcdir)/symbol.h
-ripper.o: $(top_srcdir)/vm_opts.h
-ripper.o: ../../probes.h
-ripper.o: eventids2.c
-ripper.o: ripper.y
-ripper.o: {$(VPATH)}eventids1.c
-ripper.o: {$(VPATH)}eventids2table.c
-ripper.o: {$(VPATH)}id.h
-ripper.o: {$(VPATH)}lex.c
-ripper.o: {$(VPATH)}parse.h
-ripper.o: {$(VPATH)}ripper.c
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c
index 04a40e0da7..423f9d7e29 100644
--- a/ext/ripper/eventids2.c
+++ b/ext/ripper/eventids2.c
@@ -8,297 +8,284 @@
#define tHEREDOC_END (tLAST_TOKEN + 8)
#define k__END__ (tLAST_TOKEN + 9)
-typedef struct {
- ID ripper_id_backref;
- ID ripper_id_backtick;
- ID ripper_id_comma;
- ID ripper_id_const;
- ID ripper_id_cvar;
- ID ripper_id_embexpr_beg;
- ID ripper_id_embexpr_end;
- ID ripper_id_embvar;
- ID ripper_id_float;
- ID ripper_id_gvar;
- ID ripper_id_ident;
- ID ripper_id_imaginary;
- ID ripper_id_int;
- ID ripper_id_ivar;
- ID ripper_id_kw;
- ID ripper_id_lbrace;
- ID ripper_id_lbracket;
- ID ripper_id_lparen;
- ID ripper_id_nl;
- ID ripper_id_op;
- ID ripper_id_period;
- ID ripper_id_rbrace;
- ID ripper_id_rbracket;
- ID ripper_id_rparen;
- ID ripper_id_semicolon;
- ID ripper_id_symbeg;
- ID ripper_id_tstring_beg;
- ID ripper_id_tstring_content;
- ID ripper_id_tstring_end;
- ID ripper_id_words_beg;
- ID ripper_id_qwords_beg;
- ID ripper_id_qsymbols_beg;
- ID ripper_id_symbols_beg;
- ID ripper_id_words_sep;
- ID ripper_id_rational;
- ID ripper_id_regexp_beg;
- ID ripper_id_regexp_end;
- ID ripper_id_label;
- ID ripper_id_label_end;
- ID ripper_id_tlambda;
- ID ripper_id_tlambeg;
+static ID ripper_id_backref;
+static ID ripper_id_backtick;
+static ID ripper_id_comma;
+static ID ripper_id_const;
+static ID ripper_id_cvar;
+static ID ripper_id_embexpr_beg;
+static ID ripper_id_embexpr_end;
+static ID ripper_id_embvar;
+static ID ripper_id_float;
+static ID ripper_id_gvar;
+static ID ripper_id_ident;
+static ID ripper_id_imaginary;
+static ID ripper_id_int;
+static ID ripper_id_ivar;
+static ID ripper_id_kw;
+static ID ripper_id_lbrace;
+static ID ripper_id_lbracket;
+static ID ripper_id_lparen;
+static ID ripper_id_nl;
+static ID ripper_id_op;
+static ID ripper_id_period;
+static ID ripper_id_rbrace;
+static ID ripper_id_rbracket;
+static ID ripper_id_rparen;
+static ID ripper_id_semicolon;
+static ID ripper_id_symbeg;
+static ID ripper_id_tstring_beg;
+static ID ripper_id_tstring_content;
+static ID ripper_id_tstring_end;
+static ID ripper_id_words_beg;
+static ID ripper_id_qwords_beg;
+static ID ripper_id_qsymbols_beg;
+static ID ripper_id_symbols_beg;
+static ID ripper_id_words_sep;
+static ID ripper_id_rational;
+static ID ripper_id_regexp_beg;
+static ID ripper_id_regexp_end;
+static ID ripper_id_label;
+static ID ripper_id_tlambda;
+static ID ripper_id_tlambeg;
- ID ripper_id_ignored_nl;
- ID ripper_id_comment;
- ID ripper_id_embdoc_beg;
- ID ripper_id_embdoc;
- ID ripper_id_embdoc_end;
- ID ripper_id_sp;
- ID ripper_id_heredoc_beg;
- ID ripper_id_heredoc_end;
- ID ripper_id___end__;
- ID ripper_id_CHAR;
-} ripper_scanner_ids_t;
-
-static ripper_scanner_ids_t ripper_scanner_ids;
+static ID ripper_id_ignored_nl;
+static ID ripper_id_comment;
+static ID ripper_id_embdoc_beg;
+static ID ripper_id_embdoc;
+static ID ripper_id_embdoc_end;
+static ID ripper_id_sp;
+static ID ripper_id_heredoc_beg;
+static ID ripper_id_heredoc_end;
+static ID ripper_id___end__;
+static ID ripper_id_CHAR;
#include "eventids2table.c"
static void
ripper_init_eventids2(void)
{
-#define set_id2(name) ripper_scanner_ids.ripper_id_##name = rb_intern_const("on_"#name)
- set_id2(backref);
- set_id2(backtick);
- set_id2(comma);
- set_id2(const);
- set_id2(cvar);
- set_id2(embexpr_beg);
- set_id2(embexpr_end);
- set_id2(embvar);
- set_id2(float);
- set_id2(gvar);
- set_id2(ident);
- set_id2(imaginary);
- set_id2(int);
- set_id2(ivar);
- set_id2(kw);
- set_id2(lbrace);
- set_id2(lbracket);
- set_id2(lparen);
- set_id2(nl);
- set_id2(op);
- set_id2(period);
- set_id2(rbrace);
- set_id2(rbracket);
- set_id2(rparen);
- set_id2(semicolon);
- set_id2(symbeg);
- set_id2(tstring_beg);
- set_id2(tstring_content);
- set_id2(tstring_end);
- set_id2(words_beg);
- set_id2(qwords_beg);
- set_id2(qsymbols_beg);
- set_id2(symbols_beg);
- set_id2(words_sep);
- set_id2(rational);
- set_id2(regexp_beg);
- set_id2(regexp_end);
- set_id2(label);
- set_id2(label_end);
- set_id2(tlambda);
- set_id2(tlambeg);
+ ripper_id_backref = rb_intern_const("on_backref");
+ ripper_id_backtick = rb_intern_const("on_backtick");
+ ripper_id_comma = rb_intern_const("on_comma");
+ ripper_id_const = rb_intern_const("on_const");
+ ripper_id_cvar = rb_intern_const("on_cvar");
+ ripper_id_embexpr_beg = rb_intern_const("on_embexpr_beg");
+ ripper_id_embexpr_end = rb_intern_const("on_embexpr_end");
+ ripper_id_embvar = rb_intern_const("on_embvar");
+ ripper_id_float = rb_intern_const("on_float");
+ ripper_id_gvar = rb_intern_const("on_gvar");
+ ripper_id_ident = rb_intern_const("on_ident");
+ ripper_id_imaginary = rb_intern_const("on_imaginary");
+ ripper_id_int = rb_intern_const("on_int");
+ ripper_id_ivar = rb_intern_const("on_ivar");
+ ripper_id_kw = rb_intern_const("on_kw");
+ ripper_id_lbrace = rb_intern_const("on_lbrace");
+ ripper_id_lbracket = rb_intern_const("on_lbracket");
+ ripper_id_lparen = rb_intern_const("on_lparen");
+ ripper_id_nl = rb_intern_const("on_nl");
+ ripper_id_op = rb_intern_const("on_op");
+ ripper_id_period = rb_intern_const("on_period");
+ ripper_id_rbrace = rb_intern_const("on_rbrace");
+ ripper_id_rbracket = rb_intern_const("on_rbracket");
+ ripper_id_rparen = rb_intern_const("on_rparen");
+ ripper_id_semicolon = rb_intern_const("on_semicolon");
+ ripper_id_symbeg = rb_intern_const("on_symbeg");
+ ripper_id_tstring_beg = rb_intern_const("on_tstring_beg");
+ ripper_id_tstring_content = rb_intern_const("on_tstring_content");
+ ripper_id_tstring_end = rb_intern_const("on_tstring_end");
+ ripper_id_words_beg = rb_intern_const("on_words_beg");
+ ripper_id_qwords_beg = rb_intern_const("on_qwords_beg");
+ ripper_id_qsymbols_beg = rb_intern_const("on_qsymbols_beg");
+ ripper_id_symbols_beg = rb_intern_const("on_symbols_beg");
+ ripper_id_words_sep = rb_intern_const("on_words_sep");
+ ripper_id_rational = rb_intern_const("on_rational");
+ ripper_id_regexp_beg = rb_intern_const("on_regexp_beg");
+ ripper_id_regexp_end = rb_intern_const("on_regexp_end");
+ ripper_id_label = rb_intern_const("on_label");
+ ripper_id_tlambda = rb_intern_const("on_tlambda");
+ ripper_id_tlambeg = rb_intern_const("on_tlambeg");
- set_id2(ignored_nl);
- set_id2(comment);
- set_id2(embdoc_beg);
- set_id2(embdoc);
- set_id2(embdoc_end);
- set_id2(sp);
- set_id2(heredoc_beg);
- set_id2(heredoc_end);
- set_id2(__end__);
- set_id2(CHAR);
+ ripper_id_ignored_nl = rb_intern_const("on_ignored_nl");
+ ripper_id_comment = rb_intern_const("on_comment");
+ ripper_id_embdoc_beg = rb_intern_const("on_embdoc_beg");
+ ripper_id_embdoc = rb_intern_const("on_embdoc");
+ ripper_id_embdoc_end = rb_intern_const("on_embdoc_end");
+ ripper_id_sp = rb_intern_const("on_sp");
+ ripper_id_heredoc_beg = rb_intern_const("on_heredoc_beg");
+ ripper_id_heredoc_end = rb_intern_const("on_heredoc_end");
+ ripper_id___end__ = rb_intern_const("on___end__");
+ ripper_id_CHAR = rb_intern_const("on_CHAR");
}
-STATIC_ASSERT(k__END___range, k__END__ < SHRT_MAX);
-STATIC_ASSERT(ripper_scanner_ids_size, sizeof(ripper_scanner_ids) < SHRT_MAX);
-#define O(member) (int)offsetof(ripper_scanner_ids_t, ripper_id_##member)
-
static const struct token_assoc {
- unsigned short token;
- unsigned short id_offset;
+ int token;
+ ID *id;
} token_to_eventid[] = {
- {' ', O(words_sep)},
- {'!', O(op)},
- {'%', O(op)},
- {'&', O(op)},
- {'*', O(op)},
- {'+', O(op)},
- {'-', O(op)},
- {'/', O(op)},
- {'<', O(op)},
- {'=', O(op)},
- {'>', O(op)},
- {'?', O(op)},
- {'^', O(op)},
- {'|', O(op)},
- {'~', O(op)},
- {':', O(op)},
- {',', O(comma)},
- {'.', O(period)},
- {';', O(semicolon)},
- {'`', O(backtick)},
- {'\n', O(nl)},
- {keyword_alias, O(kw)},
- {keyword_and, O(kw)},
- {keyword_begin, O(kw)},
- {keyword_break, O(kw)},
- {keyword_case, O(kw)},
- {keyword_class, O(kw)},
- {keyword_def, O(kw)},
- {keyword_defined, O(kw)},
- {keyword_do, O(kw)},
- {keyword_do_block, O(kw)},
- {keyword_do_cond, O(kw)},
- {keyword_else, O(kw)},
- {keyword_elsif, O(kw)},
- {keyword_end, O(kw)},
- {keyword_ensure, O(kw)},
- {keyword_false, O(kw)},
- {keyword_for, O(kw)},
- {keyword_if, O(kw)},
- {modifier_if, O(kw)},
- {keyword_in, O(kw)},
- {keyword_module, O(kw)},
- {keyword_next, O(kw)},
- {keyword_nil, O(kw)},
- {keyword_not, O(kw)},
- {keyword_or, O(kw)},
- {keyword_redo, O(kw)},
- {keyword_rescue, O(kw)},
- {modifier_rescue, O(kw)},
- {keyword_retry, O(kw)},
- {keyword_return, O(kw)},
- {keyword_self, O(kw)},
- {keyword_super, O(kw)},
- {keyword_then, O(kw)},
- {keyword_true, O(kw)},
- {keyword_undef, O(kw)},
- {keyword_unless, O(kw)},
- {modifier_unless, O(kw)},
- {keyword_until, O(kw)},
- {modifier_until, O(kw)},
- {keyword_when, O(kw)},
- {keyword_while, O(kw)},
- {modifier_while, O(kw)},
- {keyword_yield, O(kw)},
- {keyword__FILE__, O(kw)},
- {keyword__LINE__, O(kw)},
- {keyword__ENCODING__, O(kw)},
- {keyword_BEGIN, O(kw)},
- {keyword_END, O(kw)},
- {keyword_do_LAMBDA, O(kw)},
- {tAMPER, O(op)},
- {tANDOP, O(op)},
- {tAREF, O(op)},
- {tASET, O(op)},
- {tASSOC, O(op)},
- {tBACK_REF, O(backref)},
- {tCHAR, O(CHAR)},
- {tCMP, O(op)},
- {tCOLON2, O(op)},
- {tCOLON3, O(op)},
- {tCONSTANT, O(const)},
- {tCVAR, O(cvar)},
- {tDOT2, O(op)},
- {tDOT3, O(op)},
- {tEQ, O(op)},
- {tEQQ, O(op)},
- {tFID, O(ident)},
- {tFLOAT, O(float)},
- {tGEQ, O(op)},
- {tGVAR, O(gvar)},
- {tIDENTIFIER, O(ident)},
- {tIMAGINARY, O(imaginary)},
- {tINTEGER, O(int)},
- {tIVAR, O(ivar)},
- {tLBRACE, O(lbrace)},
- {tLBRACE_ARG, O(lbrace)},
- {'{', O(lbrace)},
- {'}', O(rbrace)},
- {tLBRACK, O(lbracket)},
- {'[', O(lbracket)},
- {']', O(rbracket)},
- {tLEQ, O(op)},
- {tLPAREN, O(lparen)},
- {tLPAREN_ARG, O(lparen)},
- {'(', O(lparen)},
- {')', O(rparen)},
- {tLSHFT, O(op)},
- {tMATCH, O(op)},
- {tNEQ, O(op)},
- {tNMATCH, O(op)},
- {tNTH_REF, O(backref)},
- {tOP_ASGN, O(op)},
- {tOROP, O(op)},
- {tPOW, O(op)},
- {tQWORDS_BEG, O(qwords_beg)},
- {tQSYMBOLS_BEG, O(qsymbols_beg)},
- {tSYMBOLS_BEG, O(symbols_beg)},
- {tRATIONAL, O(rational)},
- {tREGEXP_BEG, O(regexp_beg)},
- {tREGEXP_END, O(regexp_end)},
- {tRPAREN, O(rparen)},
- {tRSHFT, O(op)},
- {tSTAR, O(op)},
- {tDSTAR, O(op)},
- {tANDDOT, O(op)},
- {tSTRING_BEG, O(tstring_beg)},
- {tSTRING_CONTENT, O(tstring_content)},
- {tSTRING_DBEG, O(embexpr_beg)},
- {tSTRING_DEND, O(embexpr_end)},
- {tSTRING_DVAR, O(embvar)},
- {tSTRING_END, O(tstring_end)},
- {tSYMBEG, O(symbeg)},
- {tUMINUS, O(op)},
- {tUMINUS_NUM, O(op)},
- {tUPLUS, O(op)},
- {tWORDS_BEG, O(words_beg)},
- {tXSTRING_BEG, O(backtick)},
- {tLABEL, O(label)},
- {tLABEL_END, O(label_end)},
- {tLAMBDA, O(tlambda)},
- {tLAMBEG, O(tlambeg)},
+ {' ', &ripper_id_words_sep},
+ {'!', &ripper_id_op},
+ {'%', &ripper_id_op},
+ {'&', &ripper_id_op},
+ {'*', &ripper_id_op},
+ {'+', &ripper_id_op},
+ {'-', &ripper_id_op},
+ {'/', &ripper_id_op},
+ {'<', &ripper_id_op},
+ {'=', &ripper_id_op},
+ {'>', &ripper_id_op},
+ {'?', &ripper_id_op},
+ {'^', &ripper_id_op},
+ {'|', &ripper_id_op},
+ {'~', &ripper_id_op},
+ {':', &ripper_id_op},
+ {',', &ripper_id_comma},
+ {'.', &ripper_id_period},
+ {';', &ripper_id_semicolon},
+ {'`', &ripper_id_backtick},
+ {'\n', &ripper_id_nl},
+ {keyword_alias, &ripper_id_kw},
+ {keyword_and, &ripper_id_kw},
+ {keyword_begin, &ripper_id_kw},
+ {keyword_break, &ripper_id_kw},
+ {keyword_case, &ripper_id_kw},
+ {keyword_class, &ripper_id_kw},
+ {keyword_def, &ripper_id_kw},
+ {keyword_defined, &ripper_id_kw},
+ {keyword_do, &ripper_id_kw},
+ {keyword_do_block, &ripper_id_kw},
+ {keyword_do_cond, &ripper_id_kw},
+ {keyword_else, &ripper_id_kw},
+ {keyword_elsif, &ripper_id_kw},
+ {keyword_end, &ripper_id_kw},
+ {keyword_ensure, &ripper_id_kw},
+ {keyword_false, &ripper_id_kw},
+ {keyword_for, &ripper_id_kw},
+ {keyword_if, &ripper_id_kw},
+ {modifier_if, &ripper_id_kw},
+ {keyword_in, &ripper_id_kw},
+ {keyword_module, &ripper_id_kw},
+ {keyword_next, &ripper_id_kw},
+ {keyword_nil, &ripper_id_kw},
+ {keyword_not, &ripper_id_kw},
+ {keyword_or, &ripper_id_kw},
+ {keyword_redo, &ripper_id_kw},
+ {keyword_rescue, &ripper_id_kw},
+ {modifier_rescue, &ripper_id_kw},
+ {keyword_retry, &ripper_id_kw},
+ {keyword_return, &ripper_id_kw},
+ {keyword_self, &ripper_id_kw},
+ {keyword_super, &ripper_id_kw},
+ {keyword_then, &ripper_id_kw},
+ {keyword_true, &ripper_id_kw},
+ {keyword_undef, &ripper_id_kw},
+ {keyword_unless, &ripper_id_kw},
+ {modifier_unless, &ripper_id_kw},
+ {keyword_until, &ripper_id_kw},
+ {modifier_until, &ripper_id_kw},
+ {keyword_when, &ripper_id_kw},
+ {keyword_while, &ripper_id_kw},
+ {modifier_while, &ripper_id_kw},
+ {keyword_yield, &ripper_id_kw},
+ {keyword__FILE__, &ripper_id_kw},
+ {keyword__LINE__, &ripper_id_kw},
+ {keyword__ENCODING__, &ripper_id_kw},
+ {keyword_BEGIN, &ripper_id_kw},
+ {keyword_END, &ripper_id_kw},
+ {keyword_do_LAMBDA, &ripper_id_kw},
+ {tAMPER, &ripper_id_op},
+ {tANDOP, &ripper_id_op},
+ {tAREF, &ripper_id_op},
+ {tASET, &ripper_id_op},
+ {tASSOC, &ripper_id_op},
+ {tBACK_REF, &ripper_id_backref},
+ {tCHAR, &ripper_id_CHAR},
+ {tCMP, &ripper_id_op},
+ {tCOLON2, &ripper_id_op},
+ {tCOLON3, &ripper_id_op},
+ {tCONSTANT, &ripper_id_const},
+ {tCVAR, &ripper_id_cvar},
+ {tDOT2, &ripper_id_op},
+ {tDOT3, &ripper_id_op},
+ {tEQ, &ripper_id_op},
+ {tEQQ, &ripper_id_op},
+ {tFID, &ripper_id_ident},
+ {tFLOAT, &ripper_id_float},
+ {tGEQ, &ripper_id_op},
+ {tGVAR, &ripper_id_gvar},
+ {tIDENTIFIER, &ripper_id_ident},
+ {tIMAGINARY, &ripper_id_imaginary},
+ {tINTEGER, &ripper_id_int},
+ {tIVAR, &ripper_id_ivar},
+ {tLBRACE, &ripper_id_lbrace},
+ {tLBRACE_ARG, &ripper_id_lbrace},
+ {'{', &ripper_id_lbrace},
+ {'}', &ripper_id_rbrace},
+ {tLBRACK, &ripper_id_lbracket},
+ {'[', &ripper_id_lbracket},
+ {']', &ripper_id_rbracket},
+ {tLEQ, &ripper_id_op},
+ {tLPAREN, &ripper_id_lparen},
+ {tLPAREN_ARG, &ripper_id_lparen},
+ {'(', &ripper_id_lparen},
+ {')', &ripper_id_rparen},
+ {tLSHFT, &ripper_id_op},
+ {tMATCH, &ripper_id_op},
+ {tNEQ, &ripper_id_op},
+ {tNMATCH, &ripper_id_op},
+ {tNTH_REF, &ripper_id_backref},
+ {tOP_ASGN, &ripper_id_op},
+ {tOROP, &ripper_id_op},
+ {tPOW, &ripper_id_op},
+ {tQWORDS_BEG, &ripper_id_qwords_beg},
+ {tQSYMBOLS_BEG, &ripper_id_qsymbols_beg},
+ {tSYMBOLS_BEG, &ripper_id_symbols_beg},
+ {tRATIONAL, &ripper_id_rational},
+ {tREGEXP_BEG, &ripper_id_regexp_beg},
+ {tREGEXP_END, &ripper_id_regexp_end},
+ {tRPAREN, &ripper_id_rparen},
+ {tRSHFT, &ripper_id_op},
+ {tSTAR, &ripper_id_op},
+ {tDSTAR, &ripper_id_op},
+ {tSTRING_BEG, &ripper_id_tstring_beg},
+ {tSTRING_CONTENT, &ripper_id_tstring_content},
+ {tSTRING_DBEG, &ripper_id_embexpr_beg},
+ {tSTRING_DEND, &ripper_id_embexpr_end},
+ {tSTRING_DVAR, &ripper_id_embvar},
+ {tSTRING_END, &ripper_id_tstring_end},
+ {tSYMBEG, &ripper_id_symbeg},
+ {tUMINUS, &ripper_id_op},
+ {tUMINUS_NUM, &ripper_id_op},
+ {tUPLUS, &ripper_id_op},
+ {tWORDS_BEG, &ripper_id_words_beg},
+ {tXSTRING_BEG, &ripper_id_backtick},
+ {tLABEL, &ripper_id_label},
+ {tLAMBDA, &ripper_id_tlambda},
+ {tLAMBEG, &ripper_id_tlambeg},
/* ripper specific tokens */
- {tIGNORED_NL, O(ignored_nl)},
- {tCOMMENT, O(comment)},
- {tEMBDOC_BEG, O(embdoc_beg)},
- {tEMBDOC, O(embdoc)},
- {tEMBDOC_END, O(embdoc_end)},
- {tSP, O(sp)},
- {tHEREDOC_BEG, O(heredoc_beg)},
- {tHEREDOC_END, O(heredoc_end)},
- {k__END__, O(__end__)},
+ {tIGNORED_NL, &ripper_id_ignored_nl},
+ {tCOMMENT, &ripper_id_comment},
+ {tEMBDOC_BEG, &ripper_id_embdoc_beg},
+ {tEMBDOC, &ripper_id_embdoc},
+ {tEMBDOC_END, &ripper_id_embdoc_end},
+ {tSP, &ripper_id_sp},
+ {tHEREDOC_BEG, &ripper_id_heredoc_beg},
+ {tHEREDOC_END, &ripper_id_heredoc_end},
+ {k__END__, &ripper_id___end__},
+ {0, NULL}
};
static ID
ripper_token2eventid(int tok)
{
- int i;
+ const struct token_assoc *a;
- for (i = 0; i < numberof(token_to_eventid); i++) {
- const struct token_assoc *const a = &token_to_eventid[i];
+ for (a = token_to_eventid; a->id != NULL; a++) {
if (a->token == tok)
- return *(const ID *)((const char *)&ripper_scanner_ids + a->id_offset);
+ return *a->id;
}
if (tok < 256) {
- return ripper_scanner_ids.ripper_id_CHAR;
+ return ripper_id_CHAR;
}
rb_raise(rb_eRuntimeError, "[Ripper FATAL] unknown token %d", tok);
diff --git a/ext/ripper/extconf.rb b/ext/ripper/extconf.rb
index ec686986f9..db54e5ca2a 100644
--- a/ext/ripper/extconf.rb
+++ b/ext/ripper/extconf.rb
@@ -1,5 +1,4 @@
#!ruby -s
-# frozen_string_literal: false
require 'mkmf'
require 'rbconfig'
diff --git a/ext/ripper/lib/ripper.rb b/ext/ripper/lib/ripper.rb
index c5c3a8091e..542bd405d2 100644
--- a/ext/ripper/lib/ripper.rb
+++ b/ext/ripper/lib/ripper.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'ripper/core'
require 'ripper/lexer'
require 'ripper/filter'
diff --git a/ext/ripper/lib/ripper/core.rb b/ext/ripper/lib/ripper/core.rb
index 53ed14d5e1..637a72f4ad 100644
--- a/ext/ripper/lib/ripper/core.rb
+++ b/ext/ripper/lib/ripper/core.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# $Id$
#
@@ -30,21 +29,16 @@ class Ripper
private
- def _dispatch_0() nil end
- def _dispatch_1(a) a end
- def _dispatch_2(a, b) a end
- def _dispatch_3(a, b, c) a end
- def _dispatch_4(a, b, c, d) a end
- def _dispatch_5(a, b, c, d, e) a end
- def _dispatch_6(a, b, c, d, e, f) a end
- def _dispatch_7(a, b, c, d, e, f, g) a end
-
#
# Parser Events
#
PARSER_EVENT_TABLE.each do |id, arity|
- alias_method "on_#{id}", "_dispatch_#{arity}"
+ module_eval(<<-End, __FILE__, __LINE__ + 1)
+ def on_#{id}(#{ ('a'..'z').to_a[0, arity].join(', ') })
+ #{arity == 0 ? 'nil' : 'a'}
+ end
+ End
end
# This method is called when weak warning is produced by the parser.
@@ -66,7 +60,11 @@ class Ripper
#
SCANNER_EVENTS.each do |id|
- alias_method "on_#{id}", :_dispatch_1
+ module_eval(<<-End, __FILE__, __LINE__ + 1)
+ def on_#{id}(token)
+ token
+ end
+ End
end
end
diff --git a/ext/ripper/lib/ripper/filter.rb b/ext/ripper/lib/ripper/filter.rb
index a50a2c6c4e..239f9f00e1 100644
--- a/ext/ripper/lib/ripper/filter.rb
+++ b/ext/ripper/lib/ripper/filter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# $Id$
#
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index e70db0b1d1..5c99dfe8fa 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# $Id$
#
@@ -13,7 +12,7 @@ require 'ripper/core'
class Ripper
- # Tokenizes the Ruby program and returns an array of strings.
+ # Tokenizes the Ruby program and returns an Array of String.
#
# p Ripper.tokenize("def m(a) nil end")
# # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
@@ -22,7 +21,7 @@ class Ripper
Lexer.new(src, filename, lineno).tokenize
end
- # Tokenizes the Ruby program and returns an array of an array,
+ # Tokenizes the Ruby program and returns an Array of an Array,
# which is formatted like <code>[[lineno, column], type, token]</code>.
#
# require 'ripper'
@@ -45,63 +44,28 @@ class Ripper
end
class Lexer < ::Ripper #:nodoc: internal use only
- Elem = Struct.new(:pos, :event, :tok)
-
def tokenize
- parse().sort_by(&:pos).map(&:tok)
+ lex().map {|pos, event, tok| tok }
end
def lex
- parse().sort_by(&:pos).map(&:to_a)
+ parse().sort_by {|pos, event, tok| pos }
end
def parse
@buf = []
- @stack = []
super
- @buf.flatten!
@buf
end
private
- def on_heredoc_dedent(v, w)
- ignored_sp = []
- heredoc = @buf.last
- heredoc.each_with_index do |e, i|
- if Elem === e and e.event == :on_tstring_content
- tok = e.tok.dup if w > 0 and /\A\s/ =~ e.tok
- if (n = dedent_string(e.tok, w)) > 0
- ignored_sp << [i, Elem.new(e.pos.dup, :on_ignored_sp, tok[0, n])]
- e.pos[1] += n
- end
+ SCANNER_EVENTS.each do |event|
+ module_eval(<<-End, __FILE__+'/module_eval', __LINE__ + 1)
+ def on_#{event}(tok)
+ @buf.push [[lineno(), column()], :on_#{event}, tok]
end
- end
- ignored_sp.reverse_each do |i, e|
- heredoc[i, 0] = [e]
- end
- v
- end
-
- def on_heredoc_beg(tok)
- @stack.push @buf
- buf = []
- @buf << buf
- @buf = buf
- @buf.push Elem.new([lineno(), column()], __callee__, tok)
- end
-
- def on_heredoc_end(tok)
- @buf.push Elem.new([lineno(), column()], __callee__, tok)
- @buf = @stack.pop
- end
-
- def _push_token(tok)
- @buf.push Elem.new([lineno(), column()], __callee__, tok)
- end
-
- (SCANNER_EVENTS.map {|event|:"on_#{event}"} - private_instance_methods(false)).each do |event|
- alias_method event, :_push_token
+ End
end
end
diff --git a/ext/ripper/lib/ripper/sexp.rb b/ext/ripper/lib/ripper/sexp.rb
index aa1f86e38c..66bd69134d 100644
--- a/ext/ripper/lib/ripper/sexp.rb
+++ b/ext/ripper/lib/ripper/sexp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# $Id$
#
@@ -29,9 +28,7 @@ class Ripper
# [:bodystmt, [[:var_ref, [:@kw, "nil", [1, 9]]]], nil, nil, nil]]]]
#
def Ripper.sexp(src, filename = '-', lineno = 1)
- builder = SexpBuilderPP.new(src, filename, lineno)
- sexp = builder.parse
- sexp unless builder.error?
+ SexpBuilderPP.new(src, filename, lineno).parse
end
# [EXPERIMENTAL]
@@ -55,43 +52,48 @@ class Ripper
# nil]]]]
#
def Ripper.sexp_raw(src, filename = '-', lineno = 1)
- builder = SexpBuilder.new(src, filename, lineno)
- sexp = builder.parse
- sexp unless builder.error?
+ SexpBuilder.new(src, filename, lineno).parse
end
- class SexpBuilder < ::Ripper #:nodoc:
+ class SexpBuilderPP < ::Ripper #:nodoc:
private
- def dedent_element(e, width)
- if (n = dedent_string(e[1], width)) > 0
- e[2][1] += n
+ PARSER_EVENT_TABLE.each do |event, arity|
+ if /_new\z/ =~ event.to_s and arity == 0
+ module_eval(<<-End, __FILE__, __LINE__ + 1)
+ def on_#{event}
+ []
+ end
+ End
+ elsif /_add\z/ =~ event.to_s
+ module_eval(<<-End, __FILE__, __LINE__ + 1)
+ def on_#{event}(list, item)
+ list.push item
+ list
+ end
+ End
+ else
+ module_eval(<<-End, __FILE__, __LINE__ + 1)
+ def on_#{event}(*args)
+ [:#{event}, *args]
+ end
+ End
end
- e
end
- def on_heredoc_dedent(val, width)
- sub = proc do |cont|
- cont.map! do |e|
- if Array === e
- case e[0]
- when :@tstring_content
- e = dedent_element(e, width)
- when /_add\z/
- e[1] = sub[e[1]]
- end
- elsif String === e
- dedent_string(e, width)
- end
- e
+ SCANNER_EVENTS.each do |event|
+ module_eval(<<-End, __FILE__, __LINE__ + 1)
+ def on_#{event}(tok)
+ [:@#{event}, tok, [lineno(), column()]]
end
- end
- sub[val]
- val
+ End
end
+ end
+
+ class SexpBuilder < ::Ripper #:nodoc:
+ private
- events = private_instance_methods(false).grep(/\Aon_/) {$'.to_sym}
- (PARSER_EVENTS - events).each do |event|
+ PARSER_EVENTS.each do |event|
module_eval(<<-End, __FILE__, __LINE__ + 1)
def on_#{event}(*args)
args.unshift :#{event}
@@ -109,38 +111,4 @@ class Ripper
end
end
- class SexpBuilderPP < SexpBuilder #:nodoc:
- private
-
- def on_heredoc_dedent(val, width)
- val.map! do |e|
- next e if Symbol === e and /_content\z/ =~ e
- if Array === e and e[0] == :@tstring_content
- e = dedent_element(e, width)
- elsif String === e
- dedent_string(e, width)
- end
- e
- end
- val
- end
-
- def _dispatch_event_new
- []
- end
-
- def _dispatch_event_push(list, item)
- list.push item
- list
- end
-
- PARSER_EVENT_TABLE.each do |event, arity|
- if /_new\z/ =~ event and arity == 0
- alias_method "on_#{event}", :_dispatch_event_new
- elsif /_add\z/ =~ event
- alias_method "on_#{event}", :_dispatch_event_push
- end
- end
- end
-
end
diff --git a/ext/ripper/tools/generate-param-macros.rb b/ext/ripper/tools/generate-param-macros.rb
index c1f0c5bc31..b19f6e8d5c 100755
--- a/ext/ripper/tools/generate-param-macros.rb
+++ b/ext/ripper/tools/generate-param-macros.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
off = true
ARGF.each do |line|
case line
diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb
index cb02de9b4b..48ad9e1d25 100755
--- a/ext/ripper/tools/generate.rb
+++ b/ext/ripper/tools/generate.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# $Id$
require 'optparse'
@@ -69,22 +68,15 @@ end
def generate_eventids1(ids)
buf = ""
- buf << %Q[static struct {\n]
ids.each do |id, arity|
- buf << %Q[ ID id_#{id};\n]
- end
- buf << %Q[} ripper_parser_ids;\n]
- buf << %Q[\n]
- ids.each do |id, arity|
- buf << %Q[#define ripper_id_#{id} ripper_parser_ids.id_#{id}\n]
+ buf << %Q[static ID ripper_id_#{id};\n]
end
buf << %Q[\n]
buf << %Q[static void\n]
buf << %Q[ripper_init_eventids1(void)\n]
buf << %Q[{\n]
- buf << %Q[#define set_id1(name) ripper_id_##name = rb_intern_const("on_"#name)\n]
ids.each do |id, arity|
- buf << %Q[ set_id1(#{id});\n]
+ buf << %Q[ ripper_id_#{id} = rb_intern_const("on_#{id}");\n]
end
buf << %Q[}\n]
buf << %Q[\n]
@@ -92,9 +84,11 @@ def generate_eventids1(ids)
buf << %Q[ripper_init_eventids1_table(VALUE self)\n]
buf << %Q[{\n]
buf << %Q[ VALUE h = rb_hash_new();\n]
+ buf << %Q[ ID id;\n]
buf << %Q[ rb_define_const(self, "PARSER_EVENT_TABLE", h);\n]
ids.each do |id, arity|
- buf << %Q[ rb_hash_aset(h, intern_sym("#{id}"), INT2FIX(#{arity}));\n]
+ buf << %Q[ id = rb_intern_const("#{id}");\n]
+ buf << %Q[ rb_hash_aset(h, ID2SYM(id), INT2NUM(#{arity}));\n]
end
buf << %Q[}\n]
buf
@@ -106,9 +100,11 @@ def generate_eventids2_table(ids)
buf << %Q[ripper_init_eventids2_table(VALUE self)\n]
buf << %Q[{\n]
buf << %Q[ VALUE h = rb_hash_new();\n]
+ buf << %Q[ ID id;\n]
buf << %Q[ rb_define_const(self, "SCANNER_EVENT_TABLE", h);\n]
ids.each do |id|
- buf << %Q[ rb_hash_aset(h, intern_sym("#{id}"), INT2FIX(1));\n]
+ buf << %Q[ id = rb_intern_const("#{id}");\n]
+ buf << %Q[ rb_hash_aset(h, ID2SYM(id), INT2NUM(1));\n]
end
buf << %Q[}\n]
buf
@@ -139,9 +135,9 @@ def read_ids1_with_locations(path)
h = {}
File.open(path) {|f|
f.each do |line|
- next if /\A\#\s*define\s+dispatch/ =~ line
+ next if /\A\#\s*define\s+s?dispatch/ =~ line
next if /ripper_dispatch/ =~ line
- line.scan(/\bdispatch(\d)\((\w+)/) do |arity, event|
+ line.scan(/dispatch(\d)\((\w+)/) do |arity, event|
(h[event] ||= []).push [f.lineno, arity.to_i]
end
end
@@ -150,13 +146,9 @@ def read_ids1_with_locations(path)
end
def read_ids2(path)
- src = File.open(path) {|f| f.read}
- ids2 = src.scan(/ID\s+ripper_id_(\w+)/).flatten.uniq.sort
- diff = src.scan(/set_id2\((\w+)\);/).flatten - ids2
- unless diff.empty?
- abort "missing scanner IDs: #{diff}"
- end
- return ids2
+ File.open(path) {|f|
+ return f.read.scan(/ripper_id_(\w+)/).flatten.uniq.sort
+ }
end
main
diff --git a/ext/ripper/tools/preproc.rb b/ext/ripper/tools/preproc.rb
index 2377506cd5..06397cea05 100755
--- a/ext/ripper/tools/preproc.rb
+++ b/ext/ripper/tools/preproc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# $Id$
require 'optparse'
diff --git a/ext/ripper/tools/strip.rb b/ext/ripper/tools/strip.rb
index 82022d0b55..99413c361d 100755
--- a/ext/ripper/tools/strip.rb
+++ b/ext/ripper/tools/strip.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
last_is_void = false
ARGF.each do |line|
if line.strip.empty?
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 9ff0e7959a..847eb2aaf6 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -7,7 +7,8 @@
* core routines
*/
-#include "ruby/ruby.h"
+#include "ruby/config.h"
+#include "ruby/defines.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -372,7 +373,7 @@ makroom(register DBM *db, long int hash, int need)
{
long newp;
char twin[PBLKSIZ];
-#if defined _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
char zer[PBLKSIZ];
long oldtail;
#endif
@@ -399,7 +400,7 @@ makroom(register DBM *db, long int hash, int need)
* here, as sdbm_store will do so, after it inserts the incoming pair.
*/
-#if defined _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
/*
* Fill hole with 0 if made it.
* (hole is NOT read as 0)
@@ -506,7 +507,7 @@ getpage(register DBM *db, register long int hash)
while (dbit < db->maxbno && getdbit(db, dbit))
dbit = 2 * dbit + ((hash & ((long) 1 << hbit++)) ? 2 : 1);
- debug(("dbit: %ld...", dbit));
+ debug(("dbit: %d...", dbit));
db->curbit = dbit;
db->hmask = masks[hbit];
@@ -531,7 +532,7 @@ getpage(register DBM *db, register long int hash)
}
db->pagbno = pagb;
- debug(("pag read: %ld\n", pagb));
+ debug(("pag read: %d\n", pagb));
}
return 1;
}
@@ -551,7 +552,7 @@ getdbit(register DBM *db, register long int dbit)
return 0;
db->dirbno = dirb;
- debug(("dir read: %ld\n", dirb));
+ debug(("dir read: %d\n", dirb));
}
return db->dirbuf[c % DBLKSIZ] & (1 << (dbit % BYTESIZ));
@@ -572,7 +573,7 @@ setdbit(register DBM *db, register long int dbit)
return 0;
db->dirbno = dirb;
- debug(("dir read: %ld\n", dirb));
+ debug(("dir read: %d\n", dirb));
}
db->dirbuf[c % DBLKSIZ] |= (1 << (dbit % BYTESIZ));
@@ -802,7 +803,7 @@ delpair(char *pag, datum key)
}
#else
#ifdef MEMMOVE
- memmove(dst-m, src-m, m);
+ memmove(dst, src, m);
#else
while (m--)
*--dst = *--src;
diff --git a/ext/sdbm/depend b/ext/sdbm/depend
index b8f551369b..09f171a511 100644
--- a/ext/sdbm/depend
+++ b/ext/sdbm/depend
@@ -1,19 +1,2 @@
-# AUTOGENERATED DEPENDENCIES START
-_sdbm.o: $(RUBY_EXTCONF_H)
-_sdbm.o: $(arch_hdrdir)/ruby/config.h
-_sdbm.o: $(hdrdir)/ruby/defines.h
-_sdbm.o: $(hdrdir)/ruby/missing.h
-_sdbm.o: _sdbm.c
-_sdbm.o: sdbm.h
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: init.c
-init.o: sdbm.h
-# AUTOGENERATED DEPENDENCIES END
+_sdbm.o: _sdbm.c sdbm.h $(HDRS) $(ruby_headers)
+init.o: init.c sdbm.h $(HDRS) $(ruby_headers)
diff --git a/ext/sdbm/extconf.rb b/ext/sdbm/extconf.rb
index bdf3e299e6..67796fbf8a 100644
--- a/ext/sdbm/extconf.rb
+++ b/ext/sdbm/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
$defs << "-D""BADMESS=0"
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index c984152382..78add53e4f 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -72,50 +72,30 @@ struct dbmdata {
};
static void
-closed_sdbm(void)
+closed_sdbm()
{
rb_raise(rb_eDBMError, "closed SDBM file");
}
-#define GetDBM(obj, dbmp) do {\
- TypedData_Get_Struct((obj), struct dbmdata, &sdbm_type, (dbmp));\
+#define GetDBM(obj, dbmp) {\
+ Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_sdbm();\
if ((dbmp)->di_dbm == 0) closed_sdbm();\
-} while (0)
+}
-#define GetDBM2(obj, dbmp, dbm) do {\
- GetDBM((obj), (dbmp));\
- (dbm) = (dbmp)->di_dbm;\
-} while (0)
+#define GetDBM2(obj, data, dbm) {\
+ GetDBM((obj), (data));\
+ (dbm) = dbmp->di_dbm;\
+}
static void
-free_sdbm(void *ptr)
+free_sdbm(struct dbmdata *dbmp)
{
- struct dbmdata *dbmp = ptr;
if (dbmp->di_dbm) sdbm_close(dbmp->di_dbm);
ruby_xfree(dbmp);
}
-static size_t
-memsize_dbm(const void *ptr)
-{
- size_t size = 0;
- const struct dbmdata *dbmp = ptr;
- if (dbmp) {
- size += sizeof(*dbmp);
- if (dbmp->di_dbm) size += sizeof(DBM);
- }
- return size;
-}
-
-static const rb_data_type_t sdbm_type = {
- "sdbm",
- {0, free_sdbm, memsize_dbm,},
- 0, 0,
- RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
/*
* call-seq:
* sdbm.close -> nil
@@ -147,7 +127,7 @@ fsdbm_closed(VALUE obj)
{
struct dbmdata *dbmp;
- TypedData_Get_Struct(obj, struct dbmdata, &sdbm_type, dbmp);
+ Data_Get_Struct(obj, struct dbmdata, dbmp);
if (dbmp == 0)
return Qtrue;
if (dbmp->di_dbm == 0)
@@ -159,7 +139,7 @@ fsdbm_closed(VALUE obj)
static VALUE
fsdbm_alloc(VALUE klass)
{
- return TypedData_Wrap_Struct(klass, &sdbm_type, 0);
+ return Data_Wrap_Struct(klass, 0, free_sdbm, 0);
}
/*
* call-seq:
@@ -238,7 +218,7 @@ fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
static VALUE
fsdbm_s_open(int argc, VALUE *argv, VALUE klass)
{
- VALUE obj = fsdbm_alloc(klass);
+ VALUE obj = Data_Wrap_Struct(klass, 0, free_sdbm, 0);
if (NIL_P(fsdbm_initialize(argc, argv, obj))) {
return Qnil;
@@ -512,8 +492,7 @@ fsdbm_delete_if(VALUE obj)
DBM *dbm;
VALUE keystr, valstr;
VALUE ret, ary = rb_ary_new();
- long i;
- int status = 0, n;
+ int i, status = 0, n;
fdbm_modify(obj);
GetDBM2(obj, dbmp, dbm);
@@ -530,7 +509,7 @@ fsdbm_delete_if(VALUE obj)
}
for (i = 0; i < RARRAY_LEN(ary); i++) {
- keystr = RARRAY_AREF(ary, i);
+ keystr = RARRAY_PTR(ary)[i];
ExportStringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
key.dsize = RSTRING_LENINT(keystr);
@@ -653,15 +632,13 @@ fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
}
static VALUE
-update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
+update_i(VALUE pair, VALUE dbm)
{
- const VALUE *ptr;
Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) {
rb_raise(rb_eArgError, "pair must be [key, value]");
}
- ptr = RARRAY_CONST_PTR(pair);
- fsdbm_store(dbm, ptr[0], ptr[1]);
+ fsdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]);
return Qnil;
}
@@ -1014,7 +991,7 @@ fsdbm_reject(VALUE obj)
}
void
-Init_sdbm(void)
+Init_sdbm()
{
rb_cDBM = rb_define_class("SDBM", rb_cObject);
rb_eDBMError = rb_define_class("SDBMError", rb_eStandardError);
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 02766ba5d2..9a68a0c289 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -2,9 +2,6 @@
#include <time.h>
-int rsock_cmsg_cloexec_state = -1; /* <0: unknown, 0: ignored, >0: working */
-static VALUE sym_wait_readable, sym_wait_writable;
-
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static VALUE rb_cAncillaryData;
@@ -207,7 +204,7 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
str = rb_str_buf_new(sizeof(int) * argc);
for (i = 0 ; i < argc; i++) {
- VALUE obj = RARRAY_AREF(ary, i);
+ VALUE obj = RARRAY_PTR(ary)[i];
rb_io_t *fptr;
int fd;
GetOpenFile(obj, fptr);
@@ -990,7 +987,7 @@ ancillary_inspect(VALUE self)
vtype = ip_cmsg_type_to_sym(level, type);
if (SYMBOL_P(vtype))
- rb_str_catf(ret, " %"PRIsVALUE, rb_sym2str(vtype));
+ rb_str_catf(ret, " %s", rb_id2name(SYM2ID(vtype)));
else
rb_str_catf(ret, " cmsg_type:%d", type);
}
@@ -1106,8 +1103,8 @@ ancillary_cmsg_is_p(VALUE self, VALUE vlevel, VALUE vtype)
#if defined(HAVE_SENDMSG)
struct sendmsg_args_struct {
int fd;
- int flags;
const struct msghdr *msg;
+ int flags;
};
static void *
@@ -1128,16 +1125,16 @@ rb_sendmsg(int fd, const struct msghdr *msg, int flags)
}
static VALUE
-bsock_sendmsg_internal(VALUE sock, VALUE data, VALUE vflags,
- VALUE dest_sockaddr, VALUE controls, VALUE ex,
- int nonblock)
+bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
{
rb_io_t *fptr;
+ VALUE data, vflags, dest_sockaddr;
+ int controls_num;
struct msghdr mh;
struct iovec iov;
- int controls_num;
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- VALUE controls_str = 0;
+ volatile VALUE controls_str = 0;
+ VALUE *controls_ptr = NULL;
int family;
#endif
int flags;
@@ -1145,21 +1142,27 @@ bsock_sendmsg_internal(VALUE sock, VALUE data, VALUE vflags,
GetOpenFile(sock, fptr);
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- family = rsock_getfamily(fptr);
+ family = rsock_getfamily(fptr->fd);
#endif
- StringValue(data);
+ data = vflags = dest_sockaddr = Qnil;
- if (!RB_TYPE_P(controls, T_ARRAY)) {
- controls = rb_ary_new();
- }
- controls_num = RARRAY_LENINT(controls);
+ if (argc == 0)
+ rb_raise(rb_eArgError, "mesg argument required");
+ data = argv[0];
+ if (1 < argc) vflags = argv[1];
+ if (2 < argc) dest_sockaddr = argv[2];
+ controls_num = 3 < argc ? argc - 3 : 0;
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
+ if (3 < argc) { controls_ptr = &argv[3]; }
+#endif
+
+ StringValue(data);
if (controls_num) {
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
int i;
size_t last_pad = 0;
- const VALUE *controls_ptr = RARRAY_CONST_PTR(controls);
#if defined(__NetBSD__)
int last_level = 0;
int last_type = 0;
@@ -1234,7 +1237,6 @@ bsock_sendmsg_internal(VALUE sock, VALUE data, VALUE vflags,
rb_str_set_len(controls_str, RSTRING_LEN(controls_str)-last_pad);
#endif
}
- RB_GC_GUARD(controls);
#else
rb_raise(rb_eNotImpError, "control message for sendmsg is unimplemented");
#endif
@@ -1266,63 +1268,97 @@ bsock_sendmsg_internal(VALUE sock, VALUE data, VALUE vflags,
mh.msg_control = RSTRING_PTR(controls_str);
mh.msg_controllen = RSTRING_SOCKLEN(controls_str);
}
+ else {
+ mh.msg_control = NULL;
+ mh.msg_controllen = 0;
+ }
#endif
rb_io_check_closed(fptr);
- if (nonblock && !MSG_DONTWAIT_RELIABLE)
+ if (nonblock)
rb_io_set_nonblock(fptr);
ss = rb_sendmsg(fptr->fd, &mh, flags);
+ if (!nonblock && rb_io_wait_writable(fptr->fd)) {
+ rb_io_check_closed(fptr);
+ goto retry;
+ }
+
if (ss == -1) {
- int e;
- if (!nonblock && rb_io_wait_writable(fptr->fd)) {
- rb_io_check_closed(fptr);
- goto retry;
- }
- e = errno;
- if (nonblock && (e == EWOULDBLOCK || e == EAGAIN)) {
- if (ex == Qfalse) {
- return sym_wait_writable;
- }
- rb_readwrite_syserr_fail(RB_IO_WAIT_WRITABLE, e,
- "sendmsg(2) would block");
- }
- rb_syserr_fail(e, "sendmsg(2)");
+ if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN))
+ rb_readwrite_sys_fail(RB_IO_WAIT_WRITABLE, "sendmsg(2) would block");
+ rb_sys_fail("sendmsg(2)");
}
-#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- RB_GC_GUARD(controls_str);
-#endif
return SSIZET2NUM(ss);
}
#endif
#if defined(HAVE_SENDMSG)
+/*
+ * call-seq:
+ * basicsocket.sendmsg(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent
+ *
+ * sendmsg sends a message using sendmsg(2) system call in blocking manner.
+ *
+ * _mesg_ is a string to send.
+ *
+ * _flags_ is bitwise OR of MSG_* constants such as Socket::MSG_OOB.
+ *
+ * _dest_sockaddr_ is a destination socket address for connection-less socket.
+ * It should be a sockaddr such as a result of Socket.sockaddr_in.
+ * An Addrinfo object can be used too.
+ *
+ * _controls_ is a list of ancillary data.
+ * The element of _controls_ should be Socket::AncillaryData or
+ * 3-elements array.
+ * The 3-element array should contains cmsg_level, cmsg_type and data.
+ *
+ * The return value, _numbytes_sent_ is an integer which is the number of bytes sent.
+ *
+ * sendmsg can be used to implement send_io as follows:
+ *
+ * # use Socket::AncillaryData.
+ * ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno)
+ * sock.sendmsg("a", 0, nil, ancdata)
+ *
+ * # use 3-element array.
+ * ancdata = [:SOCKET, :RIGHTS, [io.fileno].pack("i!")]
+ * sock.sendmsg("\0", 0, nil, ancdata)
+ *
+ */
VALUE
-rsock_bsock_sendmsg(VALUE sock, VALUE data, VALUE flags, VALUE dest_sockaddr,
- VALUE controls)
+rsock_bsock_sendmsg(int argc, VALUE *argv, VALUE sock)
{
- return bsock_sendmsg_internal(sock, data, flags, dest_sockaddr, controls,
- Qtrue, 0);
+ return bsock_sendmsg_internal(argc, argv, sock, 0);
}
#endif
#if defined(HAVE_SENDMSG)
+/*
+ * call-seq:
+ * basicsocket.sendmsg_nonblock(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent
+ *
+ * sendmsg_nonblock sends a message using sendmsg(2) system call in non-blocking manner.
+ *
+ * It is similar to BasicSocket#sendmsg
+ * but the non-blocking flag is set before the system call
+ * and it doesn't retry the system call.
+ *
+ */
VALUE
-rsock_bsock_sendmsg_nonblock(VALUE sock, VALUE data, VALUE flags,
- VALUE dest_sockaddr, VALUE controls, VALUE ex)
+rsock_bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock)
{
- return bsock_sendmsg_internal(sock, data, flags, dest_sockaddr,
- controls, ex, 1);
+ return bsock_sendmsg_internal(argc, argv, sock, 1);
}
#endif
#if defined(HAVE_RECVMSG)
struct recvmsg_args_struct {
int fd;
- int flags;
struct msghdr *msg;
+ int flags;
};
ssize_t
@@ -1380,7 +1416,7 @@ discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
int *end = (int *)((char *)cmh + cmh->cmsg_len);
while ((char *)fdp + sizeof(int) <= (char *)end &&
(char *)fdp + sizeof(int) <= msg_end) {
- rb_update_max_fd(*fdp);
+ rb_fd_fix_cloexec(*fdp);
close(*fdp);
fdp++;
}
@@ -1423,11 +1459,7 @@ make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh, char *msg_end)
VALUE io;
if (fstat(fd, &stbuf) == -1)
rb_raise(rb_eSocket, "invalid fd in SCM_RIGHTS");
- rb_update_max_fd(fd);
- if (rsock_cmsg_cloexec_state < 0)
- rsock_cmsg_cloexec_state = rsock_detect_cloexec(fd);
- if (rsock_cmsg_cloexec_state == 0 || fd <= 2)
- rb_maygvl_fd_fix_cloexec(fd);
+ rb_fd_fix_cloexec(fd);
if (S_ISSOCK(stbuf.st_mode))
io = rsock_init_sock(rb_obj_alloc(rb_cSocket), fd);
else
@@ -1442,18 +1474,18 @@ make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh, char *msg_end)
#endif
static VALUE
-bsock_recvmsg_internal(VALUE sock,
- VALUE vmaxdatlen, VALUE vflags, VALUE vmaxctllen,
- VALUE scm_rights, VALUE ex, int nonblock)
+bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
{
rb_io_t *fptr;
+ VALUE vmaxdatlen, vmaxctllen, vflags;
+ VALUE vopts;
int grow_buffer;
size_t maxdatlen;
int flags, orig_flags;
struct msghdr mh;
struct iovec iov;
union_sockaddr namebuf;
- char *datbuf;
+ char datbuf0[4096], *datbuf;
VALUE dat_str = Qnil;
VALUE ret;
ssize_t ss;
@@ -1461,20 +1493,27 @@ bsock_recvmsg_internal(VALUE sock,
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
struct cmsghdr *cmh;
size_t maxctllen;
+ union {
+ char bytes[4096];
+ struct cmsghdr align;
+ } ctlbuf0;
char *ctlbuf;
VALUE ctl_str = Qnil;
int family;
int gc_done = 0;
#endif
- maxdatlen = NIL_P(vmaxdatlen) ? 4096 : NUM2SIZET(vmaxdatlen);
+
+ rb_scan_args(argc, argv, "03:", &vmaxdatlen, &vflags, &vmaxctllen, &vopts);
+
+ maxdatlen = NIL_P(vmaxdatlen) ? sizeof(datbuf0) : NUM2SIZET(vmaxdatlen);
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- maxctllen = NIL_P(vmaxctllen) ? 4096 : NUM2SIZET(vmaxctllen);
+ maxctllen = NIL_P(vmaxctllen) ? sizeof(ctlbuf0) : NUM2SIZET(vmaxctllen);
#else
if (!NIL_P(vmaxctllen))
rb_raise(rb_eArgError, "control message not supported");
#endif
- flags = NUM2INT(vflags);
+ flags = NIL_P(vflags) ? 0 : NUM2INT(vflags);
#ifdef MSG_DONTWAIT
if (nonblock)
flags |= MSG_DONTWAIT;
@@ -1484,7 +1523,7 @@ bsock_recvmsg_internal(VALUE sock,
grow_buffer = NIL_P(vmaxdatlen) || NIL_P(vmaxctllen);
request_scm_rights = 0;
- if (RTEST(scm_rights))
+ if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
request_scm_rights = 1;
#if !defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (request_scm_rights)
@@ -1509,18 +1548,26 @@ bsock_recvmsg_internal(VALUE sock,
#endif
retry:
- if (NIL_P(dat_str))
- dat_str = rb_str_tmp_new(maxdatlen);
- else
- rb_str_resize(dat_str, maxdatlen);
- datbuf = RSTRING_PTR(dat_str);
+ if (maxdatlen <= sizeof(datbuf0))
+ datbuf = datbuf0;
+ else {
+ if (NIL_P(dat_str))
+ dat_str = rb_str_tmp_new(maxdatlen);
+ else
+ rb_str_resize(dat_str, maxdatlen);
+ datbuf = RSTRING_PTR(dat_str);
+ }
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- if (NIL_P(ctl_str))
- ctl_str = rb_str_tmp_new(maxctllen);
- else
- rb_str_resize(ctl_str, maxctllen);
- ctlbuf = RSTRING_PTR(ctl_str);
+ if (maxctllen <= sizeof(ctlbuf0))
+ ctlbuf = ctlbuf0.bytes;
+ else {
+ if (NIL_P(ctl_str))
+ ctl_str = rb_str_tmp_new(maxctllen);
+ else
+ rb_str_resize(ctl_str, maxctllen);
+ ctlbuf = RSTRING_PTR(ctl_str);
+ }
#endif
memset(&mh, 0, sizeof(mh));
@@ -1543,26 +1590,21 @@ bsock_recvmsg_internal(VALUE sock,
flags |= MSG_PEEK;
rb_io_check_closed(fptr);
- if (nonblock && !MSG_DONTWAIT_RELIABLE)
+ if (nonblock)
rb_io_set_nonblock(fptr);
ss = rb_recvmsg(fptr->fd, &mh, flags);
+ if (!nonblock && rb_io_wait_readable(fptr->fd)) {
+ rb_io_check_closed(fptr);
+ goto retry;
+ }
+
if (ss == -1) {
- int e;
- if (!nonblock && rb_io_wait_readable(fptr->fd)) {
- rb_io_check_closed(fptr);
- goto retry;
- }
- e = errno;
- if (nonblock && (e == EWOULDBLOCK || e == EAGAIN)) {
- if (ex == Qfalse) {
- return sym_wait_readable;
- }
- rb_readwrite_syserr_fail(RB_IO_WAIT_READABLE, e, "recvmsg(2) would block");
- }
+ if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN))
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "recvmsg(2) would block");
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- if (!gc_done && (e == EMFILE || e == EMSGSIZE)) {
+ if (!gc_done && (errno == EMFILE || errno == EMSGSIZE)) {
/*
* When SCM_RIGHTS hit the file descriptors limit:
* - Linux 2.6.18 causes success with MSG_CTRUNC
@@ -1574,23 +1616,19 @@ bsock_recvmsg_internal(VALUE sock,
gc_done = 1;
goto retry;
}
-#else
- if (NIL_P(vmaxdatlen) && grow_buffer && e == EMSGSIZE)
- ss = (ssize_t)iov.iov_len;
- else
#endif
- rb_syserr_fail(e, "recvmsg(2)");
+ rb_sys_fail("recvmsg(2)");
}
if (grow_buffer) {
int grown = 0;
- if (NIL_P(vmaxdatlen) && ss != -1 && ss == (ssize_t)iov.iov_len) {
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
+ if (NIL_P(vmaxdatlen) && (mh.msg_flags & MSG_TRUNC)) {
if (SIZE_MAX/2 < maxdatlen)
rb_raise(rb_eArgError, "max data length too big");
maxdatlen *= 2;
grown = 1;
}
-#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (NIL_P(vmaxctllen) && (mh.msg_flags & MSG_CTRUNC)) {
#define BIG_ENOUGH_SPACE 65536
if (BIG_ENOUGH_SPACE < maxctllen &&
@@ -1610,6 +1648,13 @@ bsock_recvmsg_internal(VALUE sock,
}
#undef BIG_ENOUGH_SPACE
}
+#else
+ if (NIL_P(vmaxdatlen) && ss != -1 && ss == (ssize_t)iov.iov_len) {
+ if (SIZE_MAX/2 < maxdatlen)
+ rb_raise(rb_eArgError, "max data length too big");
+ maxdatlen *= 2;
+ grown = 1;
+ }
#endif
if (grown) {
rsock_discard_cmsg_resource(&mh, (flags & MSG_PEEK) != 0);
@@ -1643,7 +1688,7 @@ bsock_recvmsg_internal(VALUE sock,
);
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- family = rsock_getfamily(fptr);
+ family = rsock_getfamily(fptr->fd);
if (mh.msg_controllen) {
char *msg_end = (char *)mh.msg_control + mh.msg_controllen;
for (cmh = CMSG_FIRSTHDR(&mh); cmh != NULL; cmh = CMSG_NXTHDR(&mh, cmh)) {
@@ -1662,7 +1707,6 @@ bsock_recvmsg_internal(VALUE sock,
discard_cmsg(cmh, msg_end, (flags & MSG_PEEK) != 0);
rb_ary_push(ret, ctl);
}
- RB_GC_GUARD(ctl_str);
}
#endif
@@ -1671,21 +1715,82 @@ bsock_recvmsg_internal(VALUE sock,
#endif
#if defined(HAVE_RECVMSG)
+/*
+ * call-seq:
+ * basicsocket.recvmsg(maxmesglen=nil, flags=0, maxcontrollen=nil, opts={}) => [mesg, sender_addrinfo, rflags, *controls]
+ *
+ * recvmsg receives a message using recvmsg(2) system call in blocking manner.
+ *
+ * _maxmesglen_ is the maximum length of mesg to receive.
+ *
+ * _flags_ is bitwise OR of MSG_* constants such as Socket::MSG_PEEK.
+ *
+ * _maxcontrollen_ is the maximum length of controls (ancillary data) to receive.
+ *
+ * _opts_ is option hash.
+ * Currently :scm_rights=>bool is the only option.
+ *
+ * :scm_rights option specifies that application expects SCM_RIGHTS control message.
+ * If the value is nil or false, application don't expects SCM_RIGHTS control message.
+ * In this case, recvmsg closes the passed file descriptors immediately.
+ * This is the default behavior.
+ *
+ * If :scm_rights value is neither nil nor false, application expects SCM_RIGHTS control message.
+ * In this case, recvmsg creates IO objects for each file descriptors for
+ * Socket::AncillaryData#unix_rights method.
+ *
+ * The return value is 4-elements array.
+ *
+ * _mesg_ is a string of the received message.
+ *
+ * _sender_addrinfo_ is a sender socket address for connection-less socket.
+ * It is an Addrinfo object.
+ * For connection-oriented socket such as TCP, sender_addrinfo is platform dependent.
+ *
+ * _rflags_ is a flags on the received message which is bitwise OR of MSG_* constants such as Socket::MSG_TRUNC.
+ * It will be nil if the system uses 4.3BSD style old recvmsg system call.
+ *
+ * _controls_ is ancillary data which is an array of Socket::AncillaryData objects such as:
+ *
+ * #<Socket::AncillaryData: AF_UNIX SOCKET RIGHTS 7>
+ *
+ * _maxmesglen_ and _maxcontrollen_ can be nil.
+ * In that case, the buffer will be grown until the message is not truncated.
+ * Internally, MSG_PEEK is used and MSG_TRUNC/MSG_CTRUNC are checked.
+ *
+ * recvmsg can be used to implement recv_io as follows:
+ *
+ * mesg, sender_sockaddr, rflags, *controls = sock.recvmsg(:scm_rights=>true)
+ * controls.each {|ancdata|
+ * if ancdata.cmsg_is?(:SOCKET, :RIGHTS)
+ * return ancdata.unix_rights[0]
+ * end
+ * }
+ *
+ */
VALUE
-rsock_bsock_recvmsg(VALUE sock, VALUE dlen, VALUE flags, VALUE clen,
- VALUE scm_rights)
+rsock_bsock_recvmsg(int argc, VALUE *argv, VALUE sock)
{
- VALUE ex = Qtrue;
- return bsock_recvmsg_internal(sock, dlen, flags, clen, scm_rights, ex, 0);
+ return bsock_recvmsg_internal(argc, argv, sock, 0);
}
#endif
#if defined(HAVE_RECVMSG)
+/*
+ * call-seq:
+ * basicsocket.recvmsg_nonblock(maxdatalen=nil, flags=0, maxcontrollen=nil, opts={}) => [data, sender_addrinfo, rflags, *controls]
+ *
+ * recvmsg receives a message using recvmsg(2) system call in non-blocking manner.
+ *
+ * It is similar to BasicSocket#recvmsg
+ * but non-blocking flag is set before the system call
+ * and it doesn't retry the system call.
+ *
+ */
VALUE
-rsock_bsock_recvmsg_nonblock(VALUE sock, VALUE dlen, VALUE flags, VALUE clen,
- VALUE scm_rights, VALUE ex)
+rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock)
{
- return bsock_recvmsg_internal(sock, dlen, flags, clen, scm_rights, ex, 1);
+ return bsock_recvmsg_internal(argc, argv, sock, 1);
}
#endif
@@ -1726,7 +1831,4 @@ rsock_init_ancdata(void)
rb_define_method(rb_cAncillaryData, "ipv6_pktinfo_addr", ancillary_ipv6_pktinfo_addr, 0);
rb_define_method(rb_cAncillaryData, "ipv6_pktinfo_ifindex", ancillary_ipv6_pktinfo_ifindex, 0);
#endif
-#undef rb_intern
- sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
- sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
}
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index 2d2b22e1a9..bce085b632 100644
--- a/ext/socket/basicsocket.c
+++ b/ext/socket/basicsocket.c
@@ -66,6 +66,9 @@ bsock_shutdown(int argc, VALUE *argv, VALUE sock)
int how;
rb_io_t *fptr;
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't shutdown socket");
+ }
rb_scan_args(argc, argv, "01", &howto);
if (howto == Qnil)
how = SHUT_RDWR;
@@ -97,6 +100,9 @@ bsock_close_read(VALUE sock)
{
rb_io_t *fptr;
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't close socket");
+ }
GetOpenFile(sock, fptr);
shutdown(fptr->fd, 0);
if (!(fptr->mode & FMODE_WRITABLE)) {
@@ -127,6 +133,9 @@ bsock_close_write(VALUE sock)
{
rb_io_t *fptr;
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't close socket");
+ }
GetOpenFile(sock, fptr);
if (!(fptr->mode & FMODE_READABLE)) {
return rb_io_close(sock);
@@ -213,8 +222,9 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
rb_scan_args(argc, argv, "30", &lev, &optname, &val);
}
+ rb_secure(2);
GetOpenFile(sock, fptr);
- family = rsock_getfamily(fptr);
+ family = rsock_getfamily(fptr->fd);
level = rsock_level_arg(family, lev);
option = rsock_optname_arg(family, level, optname);
@@ -244,6 +254,7 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
return INT2FIX(0);
}
+#if !defined(__BEOS__)
/*
* Document-method: getsockopt
* call-seq:
@@ -310,7 +321,7 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
int family;
GetOpenFile(sock, fptr);
- family = rsock_getfamily(fptr);
+ family = rsock_getfamily(fptr->fd);
level = rsock_level_arg(family, lev);
option = rsock_optname_arg(family, level, optname);
len = 256;
@@ -323,6 +334,9 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
return rsock_sockopt_new(family, level, option, rb_str_new(buf, len));
}
+#else
+#define bsock_getsockopt rb_f_notimplement
+#endif
/*
* call-seq:
@@ -549,7 +563,7 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
GetOpenFile(sock, fptr);
arg.fd = fptr->fd;
arg.flags = NUM2INT(flags);
- while (rsock_maybe_fd_writable(arg.fd),
+ while (rb_thread_fd_writable(arg.fd),
(n = (int)BLOCKING_REGION_FD(func, &arg)) < 0) {
if (rb_io_wait_writable(arg.fd)) {
continue;
@@ -565,13 +579,11 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
*
* Gets the do_not_reverse_lookup flag of _basicsocket_.
*
- * BasicSocket.do_not_reverse_lookup = false
* TCPSocket.open("www.ruby-lang.org", 80) {|sock|
* p sock.do_not_reverse_lookup #=> false
- * }
- * BasicSocket.do_not_reverse_lookup = true
- * TCPSocket.open("www.ruby-lang.org", 80) {|sock|
- * p sock.do_not_reverse_lookup #=> true
+ * p sock.peeraddr #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
+ * sock.do_not_reverse_lookup = true
+ * p sock.peeraddr #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
* }
*/
static VALUE
@@ -589,12 +601,10 @@ bsock_do_not_reverse_lookup(VALUE sock)
*
* Sets the do_not_reverse_lookup flag of _basicsocket_.
*
- * TCPSocket.open("www.ruby-lang.org", 80) {|sock|
- * p sock.do_not_reverse_lookup #=> true
- * p sock.peeraddr #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
- * sock.do_not_reverse_lookup = false
- * p sock.peeraddr #=> ["AF_INET", 80, "carbon.ruby-lang.org", "54.163.249.195"]
- * }
+ * BasicSocket.do_not_reverse_lookup = false
+ * p TCPSocket.new("127.0.0.1", 80).do_not_reverse_lookup #=> false
+ * BasicSocket.do_not_reverse_lookup = true
+ * p TCPSocket.new("127.0.0.1", 80).do_not_reverse_lookup #=> true
*
*/
static VALUE
@@ -614,7 +624,8 @@ bsock_do_not_reverse_lookup_set(VALUE sock, VALUE state)
/*
* call-seq:
- * basicsocket.recv(maxlen[, flags[, outbuf]]) => mesg
+ * basicsocket.recv(maxlen) => mesg
+ * basicsocket.recv(maxlen, flags) => mesg
*
* Receives a message.
*
@@ -622,9 +633,6 @@ bsock_do_not_reverse_lookup_set(VALUE sock, VALUE state)
*
* _flags_ should be a bitwise OR of Socket::MSG_* constants.
*
- * _outbuf_ will contain only the received data after the method call
- * even if it is not empty at the beginning.
- *
* UNIXSocket.pair {|s1, s2|
* s1.puts "Hello World"
* p s2.recv(4) #=> "Hell"
@@ -639,11 +647,55 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
return rsock_s_recvfrom(sock, argc, argv, RECV_RECV);
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * basicsocket.recv_nonblock(maxlen) => mesg
+ * basicsocket.recv_nonblock(maxlen, flags) => mesg
+ *
+ * Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * _flags_ is zero or more of the +MSG_+ options.
+ * The result, _mesg_, is the data received.
+ *
+ * When recvfrom(2) returns 0, Socket#recv_nonblock returns
+ * an empty string as data.
+ * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
+ *
+ * === Parameters
+ * * +maxlen+ - the number of bytes to receive from the socket
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
+ * === Example
+ * serv = TCPServer.new("127.0.0.1", 0)
+ * af, port, host, addr = serv.addr
+ * c = TCPSocket.new(addr, port)
+ * s = serv.accept
+ * c.send "aaa", 0
+ * begin # emulate blocking recv.
+ * p s.recv_nonblock(10) #=> "aaa"
+ * rescue IO::WaitReadable
+ * IO.select([s])
+ * retry
+ * end
+ *
+ * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
+ * to _recv_nonblock_ fails.
+ *
+ * BasicSocket#recv_nonblock may raise any error corresponding to recvfrom(2) failure,
+ * including Errno::EWOULDBLOCK.
+ *
+ * If the exception is Errno::EWOULDBLOCK or Errno::AGAIN,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying recv_nonblock.
+ *
+ * === See
+ * * Socket#recvfrom
+ */
+
static VALUE
-bsock_recv_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex)
+bsock_recv_nonblock(int argc, VALUE *argv, VALUE sock)
{
- return rsock_s_recvfrom_nonblock(sock, len, flg, str, ex, RECV_RECV);
+ return rsock_s_recvfrom_nonblock(sock, argc, argv, RECV_RECV);
}
/*
@@ -712,22 +764,13 @@ rsock_init_basicsocket(void)
rb_define_method(rb_cBasicSocket, "remote_address", bsock_remote_address, 0);
rb_define_method(rb_cBasicSocket, "send", rsock_bsock_send, -1);
rb_define_method(rb_cBasicSocket, "recv", bsock_recv, -1);
-
+ rb_define_method(rb_cBasicSocket, "recv_nonblock", bsock_recv_nonblock, -1);
rb_define_method(rb_cBasicSocket, "do_not_reverse_lookup", bsock_do_not_reverse_lookup, 0);
rb_define_method(rb_cBasicSocket, "do_not_reverse_lookup=", bsock_do_not_reverse_lookup_set, 1);
- /* for ext/socket/lib/socket.rb use only: */
- rb_define_private_method(rb_cBasicSocket,
- "__recv_nonblock", bsock_recv_nonblock, 4);
-
- /* in ancdata.c */
- rb_define_private_method(rb_cBasicSocket, "__sendmsg",
- rsock_bsock_sendmsg, 4);
- rb_define_private_method(rb_cBasicSocket, "__sendmsg_nonblock",
- rsock_bsock_sendmsg_nonblock, 5);
- rb_define_private_method(rb_cBasicSocket, "__recvmsg",
- rsock_bsock_recvmsg, 4);
- rb_define_private_method(rb_cBasicSocket, "__recvmsg_nonblock",
- rsock_bsock_recvmsg_nonblock, 5);
+ rb_define_method(rb_cBasicSocket, "sendmsg", rsock_bsock_sendmsg, -1); /* in ancdata.c */
+ rb_define_method(rb_cBasicSocket, "sendmsg_nonblock", rsock_bsock_sendmsg_nonblock, -1); /* in ancdata.c */
+ rb_define_method(rb_cBasicSocket, "recvmsg", rsock_bsock_recvmsg, -1); /* in ancdata.c */
+ rb_define_method(rb_cBasicSocket, "recvmsg_nonblock", rsock_bsock_recvmsg_nonblock, -1); /* in ancdata.c */
}
diff --git a/ext/socket/constants.c b/ext/socket/constants.c
index 6fc862777e..bab27b23bb 100644
--- a/ext/socket/constants.c
+++ b/ext/socket/constants.c
@@ -22,7 +22,7 @@ constant_arg(VALUE arg, int (*str_to_int)(const char*, long, int*), const char *
int ret;
if (SYMBOL_P(arg)) {
- arg = rb_sym2str(arg);
+ arg = rb_sym_to_s(arg);
goto str;
}
else if (!NIL_P(tmp = rb_check_string_type(arg))) {
diff --git a/ext/socket/depend b/ext/socket/depend
index 30ecfc5b52..cd3fae98ea 100644
--- a/ext/socket/depend
+++ b/ext/socket/depend
@@ -1,295 +1,29 @@
+SOCK_HEADERS = $(srcdir)/rubysocket.h $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/util.h \
+ $(hdrdir)/ruby/io.h $(hdrdir)/ruby/thread.h \
+ $(srcdir)/addrinfo.h $(srcdir)/sockport.h constdefs.h $(top_srcdir)/internal.h
+
+init.o: init.c $(SOCK_HEADERS)
+constants.o: constants.c constdefs.c $(SOCK_HEADERS)
+basicsocket.o: basicsocket.c $(SOCK_HEADERS)
+socket.o: socket.c $(SOCK_HEADERS)
+ifaddr.o: ifaddr.c $(SOCK_HEADERS)
+ipsocket.o: ipsocket.c $(SOCK_HEADERS)
+tcpsocket.o: tcpsocket.c $(SOCK_HEADERS)
+tcpserver.o: tcpserver.c $(SOCK_HEADERS)
+sockssocket.o: sockssocket.c $(SOCK_HEADERS)
+udpsocket.o: udpsocket.c $(SOCK_HEADERS)
+unixsocket.o: unixsocket.c $(SOCK_HEADERS)
+unixserver.o: unixserver.c $(SOCK_HEADERS)
+option.o: option.c $(SOCK_HEADERS)
+ancdata.o: ancdata.c $(SOCK_HEADERS)
+raddrinfo.o: raddrinfo.c $(SOCK_HEADERS)
+
getnameinfo.o: getnameinfo.c $(arch_hdrdir)/ruby/config.h addrinfo.h sockport.h
getaddrinfo.o: getaddrinfo.c $(arch_hdrdir)/ruby/config.h addrinfo.h sockport.h
constdefs.h constdefs.c : $(srcdir)/mkconstants.rb
@echo "generating constant definitions"
@$(RUBY) $(srcdir)/mkconstants.rb -H constdefs.h -o constdefs.c
-
-# AUTOGENERATED DEPENDENCIES START
-ancdata.o: $(RUBY_EXTCONF_H)
-ancdata.o: $(arch_hdrdir)/ruby/config.h
-ancdata.o: $(hdrdir)/ruby/defines.h
-ancdata.o: $(hdrdir)/ruby/encoding.h
-ancdata.o: $(hdrdir)/ruby/intern.h
-ancdata.o: $(hdrdir)/ruby/io.h
-ancdata.o: $(hdrdir)/ruby/missing.h
-ancdata.o: $(hdrdir)/ruby/oniguruma.h
-ancdata.o: $(hdrdir)/ruby/ruby.h
-ancdata.o: $(hdrdir)/ruby/st.h
-ancdata.o: $(hdrdir)/ruby/subst.h
-ancdata.o: $(hdrdir)/ruby/thread.h
-ancdata.o: $(hdrdir)/ruby/util.h
-ancdata.o: $(top_srcdir)/include/ruby.h
-ancdata.o: $(top_srcdir)/internal.h
-ancdata.o: ancdata.c
-ancdata.o: constdefs.h
-ancdata.o: rubysocket.h
-ancdata.o: sockport.h
-basicsocket.o: $(RUBY_EXTCONF_H)
-basicsocket.o: $(arch_hdrdir)/ruby/config.h
-basicsocket.o: $(hdrdir)/ruby/defines.h
-basicsocket.o: $(hdrdir)/ruby/encoding.h
-basicsocket.o: $(hdrdir)/ruby/intern.h
-basicsocket.o: $(hdrdir)/ruby/io.h
-basicsocket.o: $(hdrdir)/ruby/missing.h
-basicsocket.o: $(hdrdir)/ruby/oniguruma.h
-basicsocket.o: $(hdrdir)/ruby/ruby.h
-basicsocket.o: $(hdrdir)/ruby/st.h
-basicsocket.o: $(hdrdir)/ruby/subst.h
-basicsocket.o: $(hdrdir)/ruby/thread.h
-basicsocket.o: $(hdrdir)/ruby/util.h
-basicsocket.o: $(top_srcdir)/include/ruby.h
-basicsocket.o: $(top_srcdir)/internal.h
-basicsocket.o: basicsocket.c
-basicsocket.o: constdefs.h
-basicsocket.o: rubysocket.h
-basicsocket.o: sockport.h
-constants.o: $(RUBY_EXTCONF_H)
-constants.o: $(arch_hdrdir)/ruby/config.h
-constants.o: $(hdrdir)/ruby/defines.h
-constants.o: $(hdrdir)/ruby/encoding.h
-constants.o: $(hdrdir)/ruby/intern.h
-constants.o: $(hdrdir)/ruby/io.h
-constants.o: $(hdrdir)/ruby/missing.h
-constants.o: $(hdrdir)/ruby/oniguruma.h
-constants.o: $(hdrdir)/ruby/ruby.h
-constants.o: $(hdrdir)/ruby/st.h
-constants.o: $(hdrdir)/ruby/subst.h
-constants.o: $(hdrdir)/ruby/thread.h
-constants.o: $(hdrdir)/ruby/util.h
-constants.o: $(top_srcdir)/include/ruby.h
-constants.o: $(top_srcdir)/internal.h
-constants.o: constants.c
-constants.o: constdefs.c
-constants.o: constdefs.h
-constants.o: rubysocket.h
-constants.o: sockport.h
-ifaddr.o: $(RUBY_EXTCONF_H)
-ifaddr.o: $(arch_hdrdir)/ruby/config.h
-ifaddr.o: $(hdrdir)/ruby/defines.h
-ifaddr.o: $(hdrdir)/ruby/encoding.h
-ifaddr.o: $(hdrdir)/ruby/intern.h
-ifaddr.o: $(hdrdir)/ruby/io.h
-ifaddr.o: $(hdrdir)/ruby/missing.h
-ifaddr.o: $(hdrdir)/ruby/oniguruma.h
-ifaddr.o: $(hdrdir)/ruby/ruby.h
-ifaddr.o: $(hdrdir)/ruby/st.h
-ifaddr.o: $(hdrdir)/ruby/subst.h
-ifaddr.o: $(hdrdir)/ruby/thread.h
-ifaddr.o: $(hdrdir)/ruby/util.h
-ifaddr.o: $(top_srcdir)/include/ruby.h
-ifaddr.o: $(top_srcdir)/internal.h
-ifaddr.o: constdefs.h
-ifaddr.o: ifaddr.c
-ifaddr.o: rubysocket.h
-ifaddr.o: sockport.h
-init.o: $(RUBY_EXTCONF_H)
-init.o: $(arch_hdrdir)/ruby/config.h
-init.o: $(hdrdir)/ruby/defines.h
-init.o: $(hdrdir)/ruby/encoding.h
-init.o: $(hdrdir)/ruby/intern.h
-init.o: $(hdrdir)/ruby/io.h
-init.o: $(hdrdir)/ruby/missing.h
-init.o: $(hdrdir)/ruby/oniguruma.h
-init.o: $(hdrdir)/ruby/ruby.h
-init.o: $(hdrdir)/ruby/st.h
-init.o: $(hdrdir)/ruby/subst.h
-init.o: $(hdrdir)/ruby/thread.h
-init.o: $(hdrdir)/ruby/util.h
-init.o: $(top_srcdir)/include/ruby.h
-init.o: $(top_srcdir)/internal.h
-init.o: constdefs.h
-init.o: init.c
-init.o: rubysocket.h
-init.o: sockport.h
-ipsocket.o: $(RUBY_EXTCONF_H)
-ipsocket.o: $(arch_hdrdir)/ruby/config.h
-ipsocket.o: $(hdrdir)/ruby/defines.h
-ipsocket.o: $(hdrdir)/ruby/encoding.h
-ipsocket.o: $(hdrdir)/ruby/intern.h
-ipsocket.o: $(hdrdir)/ruby/io.h
-ipsocket.o: $(hdrdir)/ruby/missing.h
-ipsocket.o: $(hdrdir)/ruby/oniguruma.h
-ipsocket.o: $(hdrdir)/ruby/ruby.h
-ipsocket.o: $(hdrdir)/ruby/st.h
-ipsocket.o: $(hdrdir)/ruby/subst.h
-ipsocket.o: $(hdrdir)/ruby/thread.h
-ipsocket.o: $(hdrdir)/ruby/util.h
-ipsocket.o: $(top_srcdir)/include/ruby.h
-ipsocket.o: $(top_srcdir)/internal.h
-ipsocket.o: constdefs.h
-ipsocket.o: ipsocket.c
-ipsocket.o: rubysocket.h
-ipsocket.o: sockport.h
-option.o: $(RUBY_EXTCONF_H)
-option.o: $(arch_hdrdir)/ruby/config.h
-option.o: $(hdrdir)/ruby/defines.h
-option.o: $(hdrdir)/ruby/encoding.h
-option.o: $(hdrdir)/ruby/intern.h
-option.o: $(hdrdir)/ruby/io.h
-option.o: $(hdrdir)/ruby/missing.h
-option.o: $(hdrdir)/ruby/oniguruma.h
-option.o: $(hdrdir)/ruby/ruby.h
-option.o: $(hdrdir)/ruby/st.h
-option.o: $(hdrdir)/ruby/subst.h
-option.o: $(hdrdir)/ruby/thread.h
-option.o: $(hdrdir)/ruby/util.h
-option.o: $(top_srcdir)/include/ruby.h
-option.o: $(top_srcdir)/internal.h
-option.o: constdefs.h
-option.o: option.c
-option.o: rubysocket.h
-option.o: sockport.h
-raddrinfo.o: $(RUBY_EXTCONF_H)
-raddrinfo.o: $(arch_hdrdir)/ruby/config.h
-raddrinfo.o: $(hdrdir)/ruby/defines.h
-raddrinfo.o: $(hdrdir)/ruby/encoding.h
-raddrinfo.o: $(hdrdir)/ruby/intern.h
-raddrinfo.o: $(hdrdir)/ruby/io.h
-raddrinfo.o: $(hdrdir)/ruby/missing.h
-raddrinfo.o: $(hdrdir)/ruby/oniguruma.h
-raddrinfo.o: $(hdrdir)/ruby/ruby.h
-raddrinfo.o: $(hdrdir)/ruby/st.h
-raddrinfo.o: $(hdrdir)/ruby/subst.h
-raddrinfo.o: $(hdrdir)/ruby/thread.h
-raddrinfo.o: $(hdrdir)/ruby/util.h
-raddrinfo.o: $(top_srcdir)/include/ruby.h
-raddrinfo.o: $(top_srcdir)/internal.h
-raddrinfo.o: constdefs.h
-raddrinfo.o: raddrinfo.c
-raddrinfo.o: rubysocket.h
-raddrinfo.o: sockport.h
-socket.o: $(RUBY_EXTCONF_H)
-socket.o: $(arch_hdrdir)/ruby/config.h
-socket.o: $(hdrdir)/ruby/defines.h
-socket.o: $(hdrdir)/ruby/encoding.h
-socket.o: $(hdrdir)/ruby/intern.h
-socket.o: $(hdrdir)/ruby/io.h
-socket.o: $(hdrdir)/ruby/missing.h
-socket.o: $(hdrdir)/ruby/oniguruma.h
-socket.o: $(hdrdir)/ruby/ruby.h
-socket.o: $(hdrdir)/ruby/st.h
-socket.o: $(hdrdir)/ruby/subst.h
-socket.o: $(hdrdir)/ruby/thread.h
-socket.o: $(hdrdir)/ruby/util.h
-socket.o: $(top_srcdir)/include/ruby.h
-socket.o: $(top_srcdir)/internal.h
-socket.o: constdefs.h
-socket.o: rubysocket.h
-socket.o: socket.c
-socket.o: sockport.h
-sockssocket.o: $(RUBY_EXTCONF_H)
-sockssocket.o: $(arch_hdrdir)/ruby/config.h
-sockssocket.o: $(hdrdir)/ruby/defines.h
-sockssocket.o: $(hdrdir)/ruby/encoding.h
-sockssocket.o: $(hdrdir)/ruby/intern.h
-sockssocket.o: $(hdrdir)/ruby/io.h
-sockssocket.o: $(hdrdir)/ruby/missing.h
-sockssocket.o: $(hdrdir)/ruby/oniguruma.h
-sockssocket.o: $(hdrdir)/ruby/ruby.h
-sockssocket.o: $(hdrdir)/ruby/st.h
-sockssocket.o: $(hdrdir)/ruby/subst.h
-sockssocket.o: $(hdrdir)/ruby/thread.h
-sockssocket.o: $(hdrdir)/ruby/util.h
-sockssocket.o: $(top_srcdir)/include/ruby.h
-sockssocket.o: $(top_srcdir)/internal.h
-sockssocket.o: constdefs.h
-sockssocket.o: rubysocket.h
-sockssocket.o: sockport.h
-sockssocket.o: sockssocket.c
-tcpserver.o: $(RUBY_EXTCONF_H)
-tcpserver.o: $(arch_hdrdir)/ruby/config.h
-tcpserver.o: $(hdrdir)/ruby/defines.h
-tcpserver.o: $(hdrdir)/ruby/encoding.h
-tcpserver.o: $(hdrdir)/ruby/intern.h
-tcpserver.o: $(hdrdir)/ruby/io.h
-tcpserver.o: $(hdrdir)/ruby/missing.h
-tcpserver.o: $(hdrdir)/ruby/oniguruma.h
-tcpserver.o: $(hdrdir)/ruby/ruby.h
-tcpserver.o: $(hdrdir)/ruby/st.h
-tcpserver.o: $(hdrdir)/ruby/subst.h
-tcpserver.o: $(hdrdir)/ruby/thread.h
-tcpserver.o: $(hdrdir)/ruby/util.h
-tcpserver.o: $(top_srcdir)/include/ruby.h
-tcpserver.o: $(top_srcdir)/internal.h
-tcpserver.o: constdefs.h
-tcpserver.o: rubysocket.h
-tcpserver.o: sockport.h
-tcpserver.o: tcpserver.c
-tcpsocket.o: $(RUBY_EXTCONF_H)
-tcpsocket.o: $(arch_hdrdir)/ruby/config.h
-tcpsocket.o: $(hdrdir)/ruby/defines.h
-tcpsocket.o: $(hdrdir)/ruby/encoding.h
-tcpsocket.o: $(hdrdir)/ruby/intern.h
-tcpsocket.o: $(hdrdir)/ruby/io.h
-tcpsocket.o: $(hdrdir)/ruby/missing.h
-tcpsocket.o: $(hdrdir)/ruby/oniguruma.h
-tcpsocket.o: $(hdrdir)/ruby/ruby.h
-tcpsocket.o: $(hdrdir)/ruby/st.h
-tcpsocket.o: $(hdrdir)/ruby/subst.h
-tcpsocket.o: $(hdrdir)/ruby/thread.h
-tcpsocket.o: $(hdrdir)/ruby/util.h
-tcpsocket.o: $(top_srcdir)/include/ruby.h
-tcpsocket.o: $(top_srcdir)/internal.h
-tcpsocket.o: constdefs.h
-tcpsocket.o: rubysocket.h
-tcpsocket.o: sockport.h
-tcpsocket.o: tcpsocket.c
-udpsocket.o: $(RUBY_EXTCONF_H)
-udpsocket.o: $(arch_hdrdir)/ruby/config.h
-udpsocket.o: $(hdrdir)/ruby/defines.h
-udpsocket.o: $(hdrdir)/ruby/encoding.h
-udpsocket.o: $(hdrdir)/ruby/intern.h
-udpsocket.o: $(hdrdir)/ruby/io.h
-udpsocket.o: $(hdrdir)/ruby/missing.h
-udpsocket.o: $(hdrdir)/ruby/oniguruma.h
-udpsocket.o: $(hdrdir)/ruby/ruby.h
-udpsocket.o: $(hdrdir)/ruby/st.h
-udpsocket.o: $(hdrdir)/ruby/subst.h
-udpsocket.o: $(hdrdir)/ruby/thread.h
-udpsocket.o: $(hdrdir)/ruby/util.h
-udpsocket.o: $(top_srcdir)/include/ruby.h
-udpsocket.o: $(top_srcdir)/internal.h
-udpsocket.o: constdefs.h
-udpsocket.o: rubysocket.h
-udpsocket.o: sockport.h
-udpsocket.o: udpsocket.c
-unixserver.o: $(RUBY_EXTCONF_H)
-unixserver.o: $(arch_hdrdir)/ruby/config.h
-unixserver.o: $(hdrdir)/ruby/defines.h
-unixserver.o: $(hdrdir)/ruby/encoding.h
-unixserver.o: $(hdrdir)/ruby/intern.h
-unixserver.o: $(hdrdir)/ruby/io.h
-unixserver.o: $(hdrdir)/ruby/missing.h
-unixserver.o: $(hdrdir)/ruby/oniguruma.h
-unixserver.o: $(hdrdir)/ruby/ruby.h
-unixserver.o: $(hdrdir)/ruby/st.h
-unixserver.o: $(hdrdir)/ruby/subst.h
-unixserver.o: $(hdrdir)/ruby/thread.h
-unixserver.o: $(hdrdir)/ruby/util.h
-unixserver.o: $(top_srcdir)/include/ruby.h
-unixserver.o: $(top_srcdir)/internal.h
-unixserver.o: constdefs.h
-unixserver.o: rubysocket.h
-unixserver.o: sockport.h
-unixserver.o: unixserver.c
-unixsocket.o: $(RUBY_EXTCONF_H)
-unixsocket.o: $(arch_hdrdir)/ruby/config.h
-unixsocket.o: $(hdrdir)/ruby/defines.h
-unixsocket.o: $(hdrdir)/ruby/encoding.h
-unixsocket.o: $(hdrdir)/ruby/intern.h
-unixsocket.o: $(hdrdir)/ruby/io.h
-unixsocket.o: $(hdrdir)/ruby/missing.h
-unixsocket.o: $(hdrdir)/ruby/oniguruma.h
-unixsocket.o: $(hdrdir)/ruby/ruby.h
-unixsocket.o: $(hdrdir)/ruby/st.h
-unixsocket.o: $(hdrdir)/ruby/subst.h
-unixsocket.o: $(hdrdir)/ruby/thread.h
-unixsocket.o: $(hdrdir)/ruby/util.h
-unixsocket.o: $(top_srcdir)/include/ruby.h
-unixsocket.o: $(top_srcdir)/internal.h
-unixsocket.o: constdefs.h
-unixsocket.o: rubysocket.h
-unixsocket.o: sockport.h
-unixsocket.o: unixsocket.c
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index fd70be45da..f3be5862f0 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
AF_INET6_SOCKET_CREATION_TEST = <<EOF
@@ -310,7 +309,6 @@ end
xti.h
netinet/in_systm.h
netinet/tcp.h
- netinet/tcp_fsm.h
netinet/udp.h
arpa/inet.h
netpacket/packet.h
@@ -334,7 +332,6 @@ end
have_struct_member("struct sockaddr", "sa_len", headers) # 4.4BSD
have_struct_member("struct sockaddr_in", "sin_len", headers) # 4.4BSD
-have_struct_member("struct sockaddr_in6", "sin6_len", headers) # 4.4BSD
if have_type("struct sockaddr_un", headers) # POSIX
have_struct_member("struct sockaddr_un", "sun_len", headers) # 4.4BSD
@@ -372,73 +369,21 @@ have_msg_control = nil
have_msg_control = have_struct_member('struct msghdr', 'msg_control', headers) unless $mswin or $mingw
have_struct_member('struct msghdr', 'msg_accrights', headers)
-if have_type("struct tcp_info", headers)
- have_const("TCP_ESTABLISHED", headers)
- have_const("TCP_SYN_SENT", headers)
- have_const("TCP_SYN_RECV", headers)
- have_const("TCP_FIN_WAIT1", headers)
- have_const("TCP_FIN_WAIT2", headers)
- have_const("TCP_TIME_WAIT", headers)
- have_const("TCP_CLOSE", headers)
- have_const("TCP_CLOSE_WAIT", headers)
- have_const("TCP_LAST_ACK", headers)
- have_const("TCP_LISTEN", headers)
- have_const("TCP_CLOSING", headers)
- have_struct_member('struct tcp_info', 'tcpi_state', headers)
- if /solaris/ !~ RUBY_PLATFORM
- have_struct_member('struct tcp_info', 'tcpi_ca_state', headers)
- end
- have_struct_member('struct tcp_info', 'tcpi_retransmits', headers)
- have_struct_member('struct tcp_info', 'tcpi_probes', headers)
- have_struct_member('struct tcp_info', 'tcpi_backoff', headers)
- have_struct_member('struct tcp_info', 'tcpi_options', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_wscale', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_wscale', headers)
- have_struct_member('struct tcp_info', 'tcpi_rto', headers)
- have_struct_member('struct tcp_info', 'tcpi_ato', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_mss', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_mss', headers)
- have_struct_member('struct tcp_info', 'tcpi_unacked', headers)
- have_struct_member('struct tcp_info', 'tcpi_sacked', headers)
- have_struct_member('struct tcp_info', 'tcpi_lost', headers)
- have_struct_member('struct tcp_info', 'tcpi_retrans', headers)
- have_struct_member('struct tcp_info', 'tcpi_fackets', headers)
- have_struct_member('struct tcp_info', 'tcpi_last_data_sent', headers)
- have_struct_member('struct tcp_info', 'tcpi_last_ack_sent', headers)
- have_struct_member('struct tcp_info', 'tcpi_last_data_recv', headers)
- have_struct_member('struct tcp_info', 'tcpi_last_ack_recv', headers)
- have_struct_member('struct tcp_info', 'tcpi_pmtu', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_ssthresh', headers)
- have_struct_member('struct tcp_info', 'tcpi_rtt', headers)
- have_struct_member('struct tcp_info', 'tcpi_rttvar', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_ssthresh', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_cwnd', headers)
- have_struct_member('struct tcp_info', 'tcpi_advmss', headers)
- have_struct_member('struct tcp_info', 'tcpi_reordering', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_rtt', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_space', headers)
- have_struct_member('struct tcp_info', 'tcpi_total_retrans', headers)
-
- # FreeBSD extension
- have_struct_member('struct tcp_info', 'tcpi_snd_wnd', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_bwnd', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_nxt', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_nxt', headers)
- have_struct_member('struct tcp_info', 'tcpi_toe_tid', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_rexmitpack', headers)
- have_struct_member('struct tcp_info', 'tcpi_rcv_ooopack', headers)
- have_struct_member('struct tcp_info', 'tcpi_snd_zerowin', headers)
-end
-
case RUBY_PLATFORM
when /mswin(32|64)|mingw/
test_func = "WSACleanup"
have_library("ws2_32", "WSACleanup", headers)
when /cygwin/
test_func = "socket(0,0,0)"
+when /beos/
+ test_func = "socket(0,0,0)"
+ have_library("net", "socket(0,0,0)", headers)
when /haiku/
test_func = "socket(0,0,0)"
have_library("network", "socket(0,0,0)", headers)
+when /i386-os2_emx/
+ test_func = "socket(0,0,0)"
+ have_library("socket", "socket(0,0,0)", headers)
else
test_func = "socket(0,0,0)"
have_library("nsl", 't_open("", 0, (struct t_info *)NULL)', headers) # SunOS
@@ -505,7 +450,7 @@ EOF
end
ipv6 = false
- default_ipv6 = /haiku/ !~ RUBY_PLATFORM
+ default_ipv6 = /beos|haiku/ !~ RUBY_PLATFORM
if enable_config("ipv6", default_ipv6)
if checking_for("ipv6") {try_link(AF_INET6_SOCKET_CREATION_TEST)}
$defs << "-DENABLE_IPV6" << "-DINET6"
@@ -562,15 +507,29 @@ EOS
case enable_config("wide-getaddrinfo")
when true
getaddr_info_ok = :wide
- when nil, false
- getaddr_info_ok = (:wide if getaddr_info_ok.nil?)
+ when nil
+ if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
+ getaddr_info_ok = :os
+ if !CROSS_COMPILING &&
+ !checking_for("system getaddrinfo working") {
+ try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
+ }
+ getaddr_info_ok = :wide
+ end
+ else
+ getaddr_info_ok = :wide
+ end
+ when false
if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
- if CROSS_COMPILING ||
- checking_for("system getaddrinfo working") {
+ getaddr_info_ok = :os
+ if !CROSS_COMPILING &&
+ !checking_for("system getaddrinfo working") {
try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
}
- getaddr_info_ok = :os
+ getaddr_info_ok = nil
end
+ else
+ getaddr_info_ok = nil
end
else
raise "unexpected enable_config() value"
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index b01f1cb82e..a17d12b705 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -45,7 +45,11 @@
#include <sys/types.h>
#ifndef _WIN32
#include <sys/param.h>
-#include <sys/socket.h>
+#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
+# include <net/socket.h>
+#else
+# include <sys/socket.h>
+#endif
#include <netinet/in.h>
#if defined(HAVE_ARPA_INET_H)
#include <arpa/inet.h>
@@ -62,9 +66,6 @@
#endif
#include <unistd.h>
#else
-#if defined(_MSC_VER) && _MSC_VER <= 1200
-#include <windows.h>
-#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>
@@ -435,8 +436,11 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
s = socket(afd->a_af, SOCK_DGRAM, 0);
if (s < 0)
continue;
-
+#if defined(__BEOS__)
+ closesocket(s);
+#else
close(s);
+#endif
if (pai->ai_flags & AI_PASSIVE) {
GET_AI(cur->ai_next, afd, afd->a_addrany, port);
@@ -589,7 +593,6 @@ get_addr(const char *hostname, int af, struct addrinfo **res, struct addrinfo *p
} else
hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
#else
- if (strlen(hostname) >= NI_MAXHOST) ERR(EAI_NODATA);
hp = gethostbyname((char*)hostname);
h_error = h_errno;
#endif
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index b7e75f7d27..4da9680ccb 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -41,7 +41,11 @@
#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
-#include <sys/socket.h>
+#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
+# include <net/socket.h>
+#else
+# include <sys/socket.h>
+#endif
#include <netinet/in.h>
#if defined(HAVE_ARPA_INET_H)
#include <arpa/inet.h>
@@ -55,9 +59,6 @@
#endif
#endif
#ifdef _WIN32
-#if defined(_MSC_VER) && _MSC_VER <= 1200
-#include <windows.h>
-#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#define snprintf _snprintf
@@ -117,6 +118,24 @@ static struct afd {
#define ENI_FAMILY 5
#define ENI_SALEN 6
+#ifndef HAVE_INET_NTOP
+static const char *
+inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
+{
+#ifdef HAVE_INET_NTOA
+ struct in_addr in;
+ memcpy(&in.s_addr, addr, sizeof(in.s_addr));
+ snprintf(numaddr, numaddr_len, "%s", inet_ntoa(in));
+#else
+ unsigned long x = ntohl(*(unsigned long*)addr);
+ snprintf(numaddr, numaddr_len, "%d.%d.%d.%d",
+ (int) (x>>24) & 0xff, (int) (x>>16) & 0xff,
+ (int) (x>> 8) & 0xff, (int) (x>> 0) & 0xff);
+#endif
+ return numaddr;
+}
+#endif
+
int
getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
{
diff --git a/ext/socket/ifaddr.c b/ext/socket/ifaddr.c
index a954163369..16cd47be5a 100644
--- a/ext/socket/ifaddr.c
+++ b/ext/socket/ifaddr.c
@@ -41,6 +41,11 @@ get_root(const rb_ifaddr_t *ifaddr)
}
static void
+ifaddr_mark(void *ptr)
+{
+}
+
+static void
ifaddr_free(void *ptr)
{
rb_ifaddr_t *ifaddr = ptr;
@@ -57,6 +62,8 @@ ifaddr_memsize(const void *ptr)
{
const rb_ifaddr_t *ifaddr;
const rb_ifaddr_root_t *root;
+ if (ptr == NULL)
+ return 0;
ifaddr = ptr;
root = get_root(ifaddr);
return sizeof(rb_ifaddr_root_t) + (root->numifaddrs - 1) * sizeof(rb_ifaddr_t);
@@ -64,9 +71,10 @@ ifaddr_memsize(const void *ptr)
static const rb_data_type_t ifaddr_type = {
"socket/ifaddr",
- {0, ifaddr_free, ifaddr_memsize,},
+ {ifaddr_mark, ifaddr_free, ifaddr_memsize,},
};
+#define IS_IFADDRS(obj) rb_typeddata_is_kind_of((obj), &ifaddr_type)
static inline rb_ifaddr_t *
check_ifaddr(VALUE self)
{
@@ -91,7 +99,7 @@ rsock_getifaddrs(void)
int numifaddrs, i;
struct ifaddrs *ifaddrs, *ifa;
rb_ifaddr_root_t *root;
- VALUE result, addr;
+ VALUE result;
ret = getifaddrs(&ifaddrs);
if (ret == -1)
@@ -105,10 +113,8 @@ rsock_getifaddrs(void)
for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next)
numifaddrs++;
- addr = TypedData_Wrap_Struct(rb_cSockIfaddr, &ifaddr_type, 0);
root = xmalloc(sizeof(rb_ifaddr_root_t) + (numifaddrs-1) * sizeof(rb_ifaddr_t));
- root->refcount = 0;
- root->numifaddrs = numifaddrs;
+ root->refcount = root->numifaddrs = numifaddrs;
ifa = ifaddrs;
for (i = 0; i < numifaddrs; i++) {
@@ -117,15 +123,10 @@ rsock_getifaddrs(void)
root->ary[i].root = root;
ifa = ifa->ifa_next;
}
- RTYPEDDATA_DATA(addr) = &root->ary[0];
- root->refcount++;
result = rb_ary_new2(numifaddrs);
- rb_ary_push(result, addr);
- for (i = 1; i < numifaddrs; i++) {
- addr = TypedData_Wrap_Struct(rb_cSockIfaddr, &ifaddr_type, &root->ary[i]);
- root->refcount++;
- rb_ary_push(result, addr);
+ for (i = 0; i < numifaddrs; i++) {
+ rb_ary_push(result, TypedData_Wrap_Struct(rb_cSockIfaddr, &ifaddr_type, &root->ary[i]));
}
return result;
@@ -292,9 +293,6 @@ ifaddr_inspect_flags(ifa_flags_t flags, VALUE result)
#ifdef IFF_ALLMULTI
INSPECT_BIT(IFF_ALLMULTI, "ALLMULTI")
#endif
-#ifdef IFF_SIMPLEX
- INSPECT_BIT(IFF_SIMPLEX, "SIMPLEX")
-#endif
#ifdef IFF_MASTER
INSPECT_BIT(IFF_MASTER, "MASTER")
#endif
diff --git a/ext/socket/init.c b/ext/socket/init.c
index 1ecd4fe352..6d98a66d6e 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -29,43 +29,34 @@ VALUE rb_cSOCKSSocket;
#endif
int rsock_do_not_reverse_lookup = 1;
-static VALUE sym_wait_readable;
void
rsock_raise_socket_error(const char *reason, int error)
{
#ifdef EAI_SYSTEM
- int e;
- if (error == EAI_SYSTEM && (e = errno) != 0)
- rb_syserr_fail(e, reason);
+ if (error == EAI_SYSTEM) rb_sys_fail(reason);
#endif
rb_raise(rb_eSocket, "%s: %s", reason, gai_strerror(error));
}
-#ifdef _WIN32
-#define is_socket(fd) rb_w32_is_socket(fd)
-#else
-static int
-is_socket(int fd)
+VALUE
+rsock_init_sock(VALUE sock, int fd)
{
+ rb_io_t *fp;
+#ifndef _WIN32
struct stat sbuf;
if (fstat(fd, &sbuf) < 0)
rb_sys_fail("fstat(2)");
- return S_ISSOCK(sbuf.st_mode);
-}
+ rb_update_max_fd(fd);
+ if (!S_ISSOCK(sbuf.st_mode))
+ rb_raise(rb_eArgError, "not a socket file descriptor");
+#else
+ rb_update_max_fd(fd);
+ if (!rb_w32_is_socket(fd))
+ rb_raise(rb_eArgError, "not a socket file descriptor");
#endif
-VALUE
-rsock_init_sock(VALUE sock, int fd)
-{
- rb_io_t *fp;
-
- if (!is_socket(fd) || rb_reserved_fd_p(fd)) {
- rb_syserr_fail(EBADF, "not a socket file descriptor");
- }
-
- rb_update_max_fd(fd);
MakeOpenFile(sock, fp);
fp->fd = fd;
fp->mode = FMODE_READWRITE|FMODE_DUPLEX;
@@ -116,48 +107,21 @@ recvfrom_blocking(void *data)
return (VALUE)ret;
}
-static VALUE
-rsock_strbuf(VALUE str, long buflen)
-{
- long len;
-
- if (NIL_P(str)) return rb_tainted_str_new(0, buflen);
-
- StringValue(str);
- len = RSTRING_LEN(str);
- if (len >= buflen) {
- rb_str_modify(str);
- } else {
- rb_str_modify_expand(str, buflen - len);
- }
- rb_str_set_len(str, buflen);
- return str;
-}
-
-static VALUE
-recvfrom_locktmp(VALUE v)
-{
- struct recvfrom_arg *arg = (struct recvfrom_arg *)v;
-
- return rb_thread_io_blocking_region(recvfrom_blocking, arg, arg->fd);
-}
-
VALUE
rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
{
rb_io_t *fptr;
- VALUE str;
+ VALUE str, klass;
struct recvfrom_arg arg;
VALUE len, flg;
long buflen;
long slen;
- rb_scan_args(argc, argv, "12", &len, &flg, &str);
+ rb_scan_args(argc, argv, "11", &len, &flg);
if (flg == Qnil) arg.flags = 0;
else arg.flags = NUM2INT(flg);
buflen = NUM2INT(len);
- str = rsock_strbuf(str, buflen);
GetOpenFile(sock, fptr);
if (rb_io_read_pending(fptr)) {
@@ -165,18 +129,24 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
}
arg.fd = fptr->fd;
arg.alen = (socklen_t)sizeof(arg.buf);
- arg.str = str;
+
+ arg.str = str = rb_tainted_str_new(0, buflen);
+ klass = RBASIC(str)->klass;
+ rb_obj_hide(str);
while (rb_io_check_closed(fptr),
- rsock_maybe_wait_fd(arg.fd),
- (slen = (long)rb_str_locktmp_ensure(str, recvfrom_locktmp,
- (VALUE)&arg)) < 0) {
+ rb_thread_wait_fd(arg.fd),
+ (slen = BLOCKING_REGION_FD(recvfrom_blocking, &arg)) < 0) {
if (!rb_io_wait_readable(fptr->fd)) {
rb_sys_fail("recvfrom(2)");
}
+ if (RBASIC(str)->klass || RSTRING_LEN(str) != buflen) {
+ rb_raise(rb_eRuntimeError, "buffer string modified");
+ }
}
- if (slen != RSTRING_LEN(str)) {
+ rb_obj_reveal(str, klass);
+ if (slen < RSTRING_LEN(str)) {
rb_str_set_len(str, slen);
}
rb_obj_taint(str);
@@ -206,21 +176,24 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
}
VALUE
-rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str,
- VALUE ex, enum sock_recv_type from)
+rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
{
rb_io_t *fptr;
+ VALUE str;
union_sockaddr buf;
socklen_t alen = (socklen_t)sizeof buf;
+ VALUE len, flg;
long buflen;
long slen;
int fd, flags;
VALUE addr = Qnil;
socklen_t len0;
- flags = NUM2INT(flg);
+ rb_scan_args(argc, argv, "11", &len, &flg);
+
+ if (flg == Qnil) flags = 0;
+ else flags = NUM2INT(flg);
buflen = NUM2INT(len);
- str = rsock_strbuf(str, buflen);
#ifdef MSG_DONTWAIT
/* MSG_DONTWAIT avoids the race condition between fcntl and recvfrom.
@@ -234,30 +207,26 @@ rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str,
}
fd = fptr->fd;
- rb_io_check_closed(fptr);
-
- if (!MSG_DONTWAIT_RELIABLE)
- rb_io_set_nonblock(fptr);
+ str = rb_tainted_str_new(0, buflen);
+ rb_io_check_closed(fptr);
+ rb_io_set_nonblock(fptr);
len0 = alen;
slen = recvfrom(fd, RSTRING_PTR(str), buflen, flags, &buf.addr, &alen);
if (slen != -1 && len0 < alen)
alen = len0;
if (slen < 0) {
- int e = errno;
- switch (e) {
+ switch (errno) {
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
- if (ex == Qfalse)
- return sym_wait_readable;
- rb_readwrite_syserr_fail(RB_IO_WAIT_READABLE, e, "recvfrom(2) would block");
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "recvfrom(2) would block");
}
- rb_syserr_fail(e, "recvfrom(2)");
+ rb_sys_fail("recvfrom(2)");
}
- if (slen != RSTRING_LEN(str)) {
+ if (slen < RSTRING_LEN(str)) {
rb_str_set_len(str, slen);
}
rb_obj_taint(str);
@@ -280,78 +249,37 @@ rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str,
return rb_assoc_new(str, addr);
}
-/* returns true if SOCK_CLOEXEC is supported */
-int rsock_detect_cloexec(int fd)
-{
-#ifdef SOCK_CLOEXEC
- int flags = fcntl(fd, F_GETFD);
-
- if (flags == -1)
- rb_bug("rsock_detect_cloexec: fcntl(%d, F_GETFD) failed: %s", fd, strerror(errno));
-
- if (flags & FD_CLOEXEC)
- return 1;
-#endif
- return 0;
-}
-
-#ifdef SOCK_CLOEXEC
static int
rsock_socket0(int domain, int type, int proto)
{
int ret;
- static int cloexec_state = -1; /* <0: unknown, 0: ignored, >0: working */
- if (cloexec_state > 0) { /* common path, if SOCK_CLOEXEC is defined */
- ret = socket(domain, type|SOCK_CLOEXEC, proto);
- if (ret >= 0) {
- if (ret <= 2)
- goto fix_cloexec;
- goto update_max_fd;
- }
- }
- else if (cloexec_state < 0) { /* usually runs once only for detection */
+#ifdef SOCK_CLOEXEC
+ static int try_sock_cloexec = 1;
+ if (try_sock_cloexec) {
ret = socket(domain, type|SOCK_CLOEXEC, proto);
- if (ret >= 0) {
- cloexec_state = rsock_detect_cloexec(ret);
- if (cloexec_state == 0 || ret <= 2)
- goto fix_cloexec;
- goto update_max_fd;
- }
- else if (ret == -1 && errno == EINVAL) {
+ if (ret == -1 && errno == EINVAL) {
/* SOCK_CLOEXEC is available since Linux 2.6.27. Linux 2.6.18 fails with EINVAL */
ret = socket(domain, type, proto);
if (ret != -1) {
- cloexec_state = 0;
- /* fall through to fix_cloexec */
+ try_sock_cloexec = 0;
}
}
}
- else { /* cloexec_state == 0 */
+ else {
ret = socket(domain, type, proto);
}
+#else
+ ret = socket(domain, type, proto);
+#endif
if (ret == -1)
return -1;
-fix_cloexec:
- rb_maygvl_fd_fix_cloexec(ret);
-update_max_fd:
- rb_update_max_fd(ret);
- return ret;
-}
-#else /* !SOCK_CLOEXEC */
-static int
-rsock_socket0(int domain, int type, int proto)
-{
- int ret = socket(domain, type, proto);
-
- if (ret == -1)
- return -1;
rb_fd_fix_cloexec(ret);
return ret;
+
}
-#endif /* !SOCK_CLOEXEC */
int
rsock_socket(int domain, int type, int proto)
@@ -360,7 +288,8 @@ rsock_socket(int domain, int type, int proto)
fd = rsock_socket0(domain, type, proto);
if (fd < 0) {
- if (rb_gc_for_fd(errno)) {
+ if (errno == EMFILE || errno == ENFILE) {
+ rb_gc();
fd = rsock_socket0(domain, type, proto);
}
}
@@ -369,69 +298,68 @@ rsock_socket(int domain, int type, int proto)
return fd;
}
-/* emulate blocking connect behavior on EINTR or non-blocking socket */
static int
wait_connectable(int fd)
{
- int sockerr, revents;
+ int sockerr;
socklen_t sockerrlen;
+ int revents;
+ int ret;
- /* only to clear pending error */
- sockerrlen = (socklen_t)sizeof(sockerr);
- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&sockerr, &sockerrlen) < 0)
- return -1;
-
- /*
- * Stevens book says, successful finish turn on RB_WAITFD_OUT and
- * failure finish turn on both RB_WAITFD_IN and RB_WAITFD_OUT.
- * So it's enough to wait only RB_WAITFD_OUT and check the pending error
- * by getsockopt().
- *
- * Note: rb_wait_for_single_fd already retries on EINTR/ERESTART
- */
- revents = rb_wait_for_single_fd(fd, RB_WAITFD_IN|RB_WAITFD_OUT, NULL);
+ for (;;) {
+ /*
+ * Stevens book says, succuessful finish turn on RB_WAITFD_OUT and
+ * failure finish turn on both RB_WAITFD_IN and RB_WAITFD_OUT.
+ */
+ revents = rb_wait_for_single_fd(fd, RB_WAITFD_IN|RB_WAITFD_OUT, NULL);
+
+ if (revents & (RB_WAITFD_IN|RB_WAITFD_OUT)) {
+ sockerrlen = (socklen_t)sizeof(sockerr);
+ ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&sockerr, &sockerrlen);
+
+ /*
+ * Solaris getsockopt(SO_ERROR) return -1 and set errno
+ * in getsockopt(). Let's return immediately.
+ */
+ if (ret < 0)
+ break;
+ if (sockerr == 0)
+ continue; /* workaround for winsock */
+
+ /* BSD and Linux use sockerr. */
+ errno = sockerr;
+ ret = -1;
+ break;
+ }
- if (revents < 0)
- return -1;
+ if ((revents & (RB_WAITFD_IN|RB_WAITFD_OUT)) == RB_WAITFD_OUT) {
+ ret = 0;
+ break;
+ }
+ }
- sockerrlen = (socklen_t)sizeof(sockerr);
- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&sockerr, &sockerrlen) < 0)
- return -1;
+ return ret;
+}
- switch (sockerr) {
- case 0:
- /*
- * be defensive in case some platforms set SO_ERROR on the original,
- * interrupted connect()
- */
- case EINTR:
-#ifdef ERESTART
- case ERESTART:
+#ifdef __CYGWIN__
+#define WAIT_IN_PROGRESS 10
#endif
- case EAGAIN:
-#ifdef EINPROGRESS
- case EINPROGRESS:
+#ifdef __APPLE__
+#define WAIT_IN_PROGRESS 10
#endif
-#ifdef EALREADY
- case EALREADY:
+#ifdef __linux__
+/* returns correct error */
+#define WAIT_IN_PROGRESS 0
#endif
-#ifdef EISCONN
- case EISCONN:
+#ifndef WAIT_IN_PROGRESS
+/* BSD origin code apparently has a problem */
+#define WAIT_IN_PROGRESS 1
#endif
- return 0; /* success */
- default:
- /* likely (but not limited to): ECONNREFUSED, ETIMEDOUT, EHOSTUNREACH */
- errno = sockerr;
- return -1;
- }
-
- return 0;
-}
struct connect_arg {
int fd;
- socklen_t len;
const struct sockaddr *sockaddr;
+ socklen_t len;
};
static VALUE
@@ -456,6 +384,11 @@ rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks)
int status;
rb_blocking_function_t *func = connect_blocking;
struct connect_arg arg;
+#if WAIT_IN_PROGRESS > 0
+ int wait_in_progress = -1;
+ int sockerr;
+ socklen_t sockerrlen;
+#endif
arg.fd = fd;
arg.sockaddr = sockaddr;
@@ -463,22 +396,76 @@ rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks)
#if defined(SOCKS) && !defined(SOCKS5)
if (socks) func = socks_connect_blocking;
#endif
- status = (int)BLOCKING_REGION_FD(func, &arg);
-
- if (status < 0) {
- switch (errno) {
- case EINTR:
-#ifdef ERESTART
- case ERESTART:
+ for (;;) {
+ status = (int)BLOCKING_REGION_FD(func, &arg);
+ if (status < 0) {
+ switch (errno) {
+ case EINTR:
+#if defined(ERESTART)
+ case ERESTART:
#endif
- case EAGAIN:
+ continue;
+
+ case EAGAIN:
#ifdef EINPROGRESS
- case EINPROGRESS:
+ case EINPROGRESS:
#endif
- return wait_connectable(fd);
- }
+#if WAIT_IN_PROGRESS > 0
+ sockerrlen = (socklen_t)sizeof(sockerr);
+ status = getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&sockerr, &sockerrlen);
+ if (status) break;
+ if (sockerr) {
+ status = -1;
+ errno = sockerr;
+ break;
+ }
+#endif
+#ifdef EALREADY
+ case EALREADY:
+#endif
+#if WAIT_IN_PROGRESS > 0
+ wait_in_progress = WAIT_IN_PROGRESS;
+#endif
+ status = wait_connectable(fd);
+ if (status) {
+ break;
+ }
+ errno = 0;
+ continue;
+
+#if WAIT_IN_PROGRESS > 0
+ case EINVAL:
+ if (wait_in_progress-- > 0) {
+ /*
+ * connect() after EINPROGRESS returns EINVAL on
+ * some platforms, need to check true error
+ * status.
+ */
+ sockerrlen = (socklen_t)sizeof(sockerr);
+ status = getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&sockerr, &sockerrlen);
+ if (!status && !sockerr) {
+ struct timeval tv = {0, 100000};
+ rb_thread_wait_for(tv);
+ continue;
+ }
+ status = -1;
+ errno = sockerr;
+ }
+ break;
+#endif
+
+#ifdef EISCONN
+ case EISCONN:
+ status = 0;
+ errno = 0;
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+ return status;
}
- return status;
}
static void
@@ -500,8 +487,7 @@ make_fd_nonblock(int fd)
}
static int
-cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len,
- int nonblock)
+cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len)
{
int ret;
socklen_t len0 = 0;
@@ -515,21 +501,11 @@ cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len,
#ifdef SOCK_CLOEXEC
flags |= SOCK_CLOEXEC;
#endif
-#ifdef SOCK_NONBLOCK
- if (nonblock) {
- flags |= SOCK_NONBLOCK;
- }
-#endif
ret = accept4(socket, address, address_len, flags);
/* accept4 is available since Linux 2.6.28, glibc 2.10. */
if (ret != -1) {
if (ret <= 2)
rb_maygvl_fd_fix_cloexec(ret);
-#ifndef SOCK_NONBLOCK
- if (nonblock) {
- make_fd_nonblock(ret);
- }
-#endif
if (address_len && len0 < *address_len) *address_len = len0;
return ret;
}
@@ -543,23 +519,20 @@ cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len,
if (ret == -1) return -1;
if (address_len && len0 < *address_len) *address_len = len0;
rb_maygvl_fd_fix_cloexec(ret);
- if (nonblock) {
- make_fd_nonblock(ret);
- }
return ret;
}
+
VALUE
-rsock_s_accept_nonblock(VALUE klass, VALUE ex, rb_io_t *fptr,
- struct sockaddr *sockaddr, socklen_t *len)
+rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len)
{
int fd2;
+ rb_secure(3);
rb_io_set_nonblock(fptr);
- fd2 = cloexec_accept(fptr->fd, (struct sockaddr*)sockaddr, len, 1);
+ fd2 = cloexec_accept(fptr->fd, (struct sockaddr*)sockaddr, len);
if (fd2 < 0) {
- int e = errno;
- switch (e) {
+ switch (errno) {
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
@@ -568,13 +541,12 @@ rsock_s_accept_nonblock(VALUE klass, VALUE ex, rb_io_t *fptr,
#if defined EPROTO
case EPROTO:
#endif
- if (ex == Qfalse)
- return sym_wait_readable;
- rb_readwrite_syserr_fail(RB_IO_WAIT_READABLE, e, "accept(2) would block");
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "accept(2) would block");
}
- rb_syserr_fail(e, "accept(2)");
+ rb_sys_fail("accept(2)");
}
rb_update_max_fd(fd2);
+ make_fd_nonblock(fd2);
return rsock_init_sock(rb_obj_alloc(klass), fd2);
}
@@ -588,7 +560,7 @@ static VALUE
accept_blocking(void *data)
{
struct accept_arg *arg = data;
- return (VALUE)cloexec_accept(arg->fd, arg->sockaddr, arg->len, 0);
+ return (VALUE)cloexec_accept(arg->fd, arg->sockaddr, arg->len);
}
VALUE
@@ -598,18 +570,17 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
int retry = 0;
struct accept_arg arg;
+ rb_secure(3);
arg.fd = fd;
arg.sockaddr = sockaddr;
arg.len = len;
retry:
- rsock_maybe_wait_fd(fd);
+ rb_thread_wait_fd(fd);
fd2 = (int)BLOCKING_REGION_FD(accept_blocking, &arg);
if (fd2 < 0) {
- int e = errno;
- switch (e) {
+ switch (errno) {
case EMFILE:
case ENFILE:
- case ENOMEM:
if (retry) break;
rb_gc();
retry = 1;
@@ -619,7 +590,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
retry = 0;
goto retry;
}
- rb_syserr_fail(e, "accept(2)");
+ rb_sys_fail("accept(2)");
}
rb_update_max_fd(fd2);
if (!klass) return INT2NUM(fd2);
@@ -627,39 +598,20 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
}
int
-rsock_getfamily(rb_io_t *fptr)
+rsock_getfamily(int sockfd)
{
union_sockaddr ss;
socklen_t sslen = (socklen_t)sizeof(ss);
- int cached = fptr->mode & FMODE_SOCK;
-
- if (cached) {
- switch (cached) {
-#ifdef AF_UNIX
- case FMODE_UNIX: return AF_UNIX;
-#endif
- case FMODE_INET: return AF_INET;
- case FMODE_INET6: return AF_INET6;
- }
- }
ss.addr.sa_family = AF_UNSPEC;
- if (getsockname(fptr->fd, &ss.addr, &sslen) < 0)
+ if (getsockname(sockfd, &ss.addr, &sslen) < 0)
return AF_UNSPEC;
- switch (ss.addr.sa_family) {
-#ifdef AF_UNIX
- case AF_UNIX: fptr->mode |= FMODE_UNIX; break;
-#endif
- case AF_INET: fptr->mode |= FMODE_INET; break;
- case AF_INET6: fptr->mode |= FMODE_INET6; break;
- }
-
return ss.addr.sa_family;
}
void
-rsock_init_socket_init(void)
+rsock_init_socket_init()
{
/*
* SocketError is the error class for socket.
@@ -677,7 +629,4 @@ rsock_init_socket_init(void)
rsock_init_addrinfo();
rsock_init_sockifaddr();
rsock_init_socket_constants();
-
-#undef rb_intern
- sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
}
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index 9981fd43ad..7b198bd154 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -15,7 +15,7 @@ struct inetsock_arg
VALUE sock;
struct {
VALUE host, serv;
- struct rb_addrinfo *res;
+ struct addrinfo *res;
} remote, local;
int type;
int fd;
@@ -25,11 +25,11 @@ static VALUE
inetsock_cleanup(struct inetsock_arg *arg)
{
if (arg->remote.res) {
- rb_freeaddrinfo(arg->remote.res);
+ freeaddrinfo(arg->remote.res);
arg->remote.res = 0;
}
if (arg->local.res) {
- rb_freeaddrinfo(arg->local.res);
+ freeaddrinfo(arg->local.res);
arg->local.res = 0;
}
if (arg->fd >= 0) {
@@ -41,34 +41,30 @@ inetsock_cleanup(struct inetsock_arg *arg)
static VALUE
init_inetsock_internal(struct inetsock_arg *arg)
{
- int error = 0;
int type = arg->type;
struct addrinfo *res, *lres;
int fd, status = 0, local = 0;
- int family = AF_UNSPEC;
const char *syscall = 0;
- arg->remote.res = rsock_addrinfo(arg->remote.host, arg->remote.serv,
- family, SOCK_STREAM,
- (type == INET_SERVER) ? AI_PASSIVE : 0);
+ arg->remote.res = rsock_addrinfo(arg->remote.host, arg->remote.serv, SOCK_STREAM,
+ (type == INET_SERVER) ? AI_PASSIVE : 0);
/*
* Maybe also accept a local address
*/
if (type != INET_SERVER && (!NIL_P(arg->local.host) || !NIL_P(arg->local.serv))) {
- arg->local.res = rsock_addrinfo(arg->local.host, arg->local.serv,
- family, SOCK_STREAM, 0);
+ arg->local.res = rsock_addrinfo(arg->local.host, arg->local.serv, SOCK_STREAM, 0);
}
arg->fd = fd = -1;
- for (res = arg->remote.res->ai; res; res = res->ai_next) {
+ for (res = arg->remote.res; res; res = res->ai_next) {
#if !defined(INET6) && defined(AF_INET6)
if (res->ai_family == AF_INET6)
continue;
#endif
lres = NULL;
if (arg->local.res) {
- for (lres = arg->local.res->ai; lres; lres = lres->ai_next) {
+ for (lres = arg->local.res; lres; lres = lres->ai_next) {
if (lres->ai_family == res->ai_family)
break;
}
@@ -77,14 +73,13 @@ init_inetsock_internal(struct inetsock_arg *arg)
continue;
/* Use a different family local address if no choice, this
* will cause EAFNOSUPPORT. */
- lres = arg->local.res->ai;
+ lres = arg->local.res;
}
}
status = rsock_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
syscall = "socket(2)";
fd = status;
if (fd < 0) {
- error = errno;
continue;
}
arg->fd = fd;
@@ -112,7 +107,6 @@ init_inetsock_internal(struct inetsock_arg *arg)
}
if (status < 0) {
- error = errno;
close(fd);
arg->fd = fd = -1;
continue;
@@ -130,7 +124,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
port = arg->remote.serv;
}
- rsock_syserr_fail_host_port(error, syscall, host, port);
+ rsock_sys_fail_host_port(syscall, host, port);
}
arg->fd = -1;
@@ -138,9 +132,8 @@ init_inetsock_internal(struct inetsock_arg *arg)
if (type == INET_SERVER) {
status = listen(fd, SOMAXCONN);
if (status < 0) {
- error = errno;
close(fd);
- rb_syserr_fail(error, "listen(2)");
+ rb_sys_fail("listen(2)");
}
}
@@ -200,7 +193,7 @@ rsock_revlookup_flag(VALUE revlookup, int *norevlookup)
* hostname is obtained from numeric_address using reverse lookup.
* Or if it is +false+, or +:numeric+,
* hostname is same as numeric_address.
- * Or if it is +nil+ or omitted, obeys to +ipsocket.do_not_reverse_lookup+.
+ * Or if it is +nil+ or ommitted, obeys to +ipsocket.do_not_reverse_lookup+.
* See +Socket.getaddrinfo+ also.
*
* TCPSocket.open("www.ruby-lang.org", 80) {|sock|
@@ -241,7 +234,7 @@ ip_addr(int argc, VALUE *argv, VALUE sock)
* hostname is obtained from numeric_address using reverse lookup.
* Or if it is +false+, or +:numeric+,
* hostname is same as numeric_address.
- * Or if it is +nil+ or omitted, obeys to +ipsocket.do_not_reverse_lookup+.
+ * Or if it is +nil+ or ommitted, obeys to +ipsocket.do_not_reverse_lookup+.
* See +Socket.getaddrinfo+ also.
*
* TCPSocket.open("www.ruby-lang.org", 80) {|sock|
@@ -311,14 +304,13 @@ static VALUE
ip_s_getaddress(VALUE obj, VALUE host)
{
union_sockaddr addr;
- struct rb_addrinfo *res = rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, 0);
- socklen_t len = res->ai->ai_addrlen;
+ struct addrinfo *res = rsock_addrinfo(host, Qnil, SOCK_STREAM, 0);
/* just take the first one */
- memcpy(&addr, res->ai->ai_addr, len);
- rb_freeaddrinfo(res);
+ memcpy(&addr, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
- return rsock_make_ipaddr(&addr.addr, len);
+ return rsock_make_ipaddr(&addr.addr, res->ai_addrlen);
}
void
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 5c3ed400f4..07c9c4e6ba 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -1,7 +1,4 @@
-# frozen_string_literal: true
-
require 'socket.so'
-require 'io/wait'
class Addrinfo
# creates an Addrinfo object from the arguments.
@@ -53,28 +50,27 @@ class Addrinfo
sock.ipv6only! if self.ipv6?
sock.bind local_addrinfo if local_addrinfo
if timeout
- case sock.connect_nonblock(self, exception: false)
- when 0 # success or EISCONN, other errors raise
- break
- when :wait_writable
- sock.wait_writable(timeout) or
+ begin
+ sock.connect_nonblock(self)
+ rescue IO::WaitWritable
+ if !IO.select(nil, [sock], nil, timeout)
raise Errno::ETIMEDOUT, 'user specified timeout'
- end while true
+ end
+ begin
+ sock.connect_nonblock(self) # check connection failure
+ rescue Errno::EISCONN
+ end
+ end
else
sock.connect(self)
end
- rescue Exception
- sock.close
- raise
- end
- if block_given?
- begin
+ if block_given?
yield sock
- ensure
- sock.close if !sock.closed?
+ else
+ sock
end
- else
- sock
+ ensure
+ sock.close if !sock.closed? && (block_given? || $!)
end
end
private :connect_internal
@@ -181,18 +177,13 @@ class Addrinfo
sock.ipv6only! if self.ipv6?
sock.setsockopt(:SOCKET, :REUSEADDR, 1)
sock.bind(self)
- rescue Exception
- sock.close
- raise
- end
- if block_given?
- begin
+ if block_given?
yield sock
- ensure
- sock.close if !sock.closed?
+ else
+ sock
end
- else
- sock
+ ensure
+ sock.close if !sock.closed? && (block_given? || $!)
end
end
@@ -204,18 +195,13 @@ class Addrinfo
sock.setsockopt(:SOCKET, :REUSEADDR, 1)
sock.bind(self)
sock.listen(backlog)
- rescue Exception
- sock.close
- raise
- end
- if block_given?
- begin
+ if block_given?
yield sock
- ensure
- sock.close if !sock.closed?
+ else
+ sock
end
- else
- sock
+ ensure
+ sock.close if !sock.closed? && (block_given? || $!)
end
end
@@ -274,178 +260,6 @@ class BasicSocket < IO
end
addr
end
-
- # call-seq:
- # basicsocket.sendmsg(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent
- #
- # sendmsg sends a message using sendmsg(2) system call in blocking manner.
- #
- # _mesg_ is a string to send.
- #
- # _flags_ is bitwise OR of MSG_* constants such as Socket::MSG_OOB.
- #
- # _dest_sockaddr_ is a destination socket address for connection-less socket.
- # It should be a sockaddr such as a result of Socket.sockaddr_in.
- # An Addrinfo object can be used too.
- #
- # _controls_ is a list of ancillary data.
- # The element of _controls_ should be Socket::AncillaryData or
- # 3-elements array.
- # The 3-element array should contains cmsg_level, cmsg_type and data.
- #
- # The return value, _numbytes_sent_ is an integer which is the number of bytes sent.
- #
- # sendmsg can be used to implement send_io as follows:
- #
- # # use Socket::AncillaryData.
- # ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno)
- # sock.sendmsg("a", 0, nil, ancdata)
- #
- # # use 3-element array.
- # ancdata = [:SOCKET, :RIGHTS, [io.fileno].pack("i!")]
- # sock.sendmsg("\0", 0, nil, ancdata)
- def sendmsg(mesg, flags = 0, dest_sockaddr = nil, *controls)
- __sendmsg(mesg, flags, dest_sockaddr, controls)
- end
-
- # call-seq:
- # basicsocket.sendmsg_nonblock(mesg, flags=0, dest_sockaddr=nil, *controls, opts={}) => numbytes_sent
- #
- # sendmsg_nonblock sends a message using sendmsg(2) system call in non-blocking manner.
- #
- # It is similar to BasicSocket#sendmsg
- # but the non-blocking flag is set before the system call
- # and it doesn't retry the system call.
- #
- # By specifying `exception: false`, the _opts_ hash allows you to indicate
- # that sendmsg_nonblock should not raise an IO::WaitWritable exception, but
- # return the symbol :wait_writable instead.
- def sendmsg_nonblock(mesg, flags = 0, dest_sockaddr = nil, *controls,
- exception: true)
- __sendmsg_nonblock(mesg, flags, dest_sockaddr, controls, exception)
- end
-
- # call-seq:
- # basicsocket.recv_nonblock(maxlen [, flags [, buf [, options ]]]) => mesg
- #
- # Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
- # O_NONBLOCK is set for the underlying file descriptor.
- # _flags_ is zero or more of the +MSG_+ options.
- # The result, _mesg_, is the data received.
- #
- # When recvfrom(2) returns 0, Socket#recv_nonblock returns
- # an empty string as data.
- # The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
- #
- # === Parameters
- # * +maxlen+ - the number of bytes to receive from the socket
- # * +flags+ - zero or more of the +MSG_+ options
- # * +options+ - keyword hash, supporting `exception: false`
- #
- # === Example
- # serv = TCPServer.new("127.0.0.1", 0)
- # af, port, host, addr = serv.addr
- # c = TCPSocket.new(addr, port)
- # s = serv.accept
- # c.send "aaa", 0
- # begin # emulate blocking recv.
- # p s.recv_nonblock(10) #=> "aaa"
- # rescue IO::WaitReadable
- # IO.select([s])
- # retry
- # end
- #
- # Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- # to _recv_nonblock_ fails.
- #
- # BasicSocket#recv_nonblock may raise any error corresponding to recvfrom(2) failure,
- # including Errno::EWOULDBLOCK.
- #
- # If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying recv_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that recv_nonblock should not raise an IO::WaitWritable exception, but
- # return the symbol :wait_writable instead.
- #
- # === See
- # * Socket#recvfrom
- def recv_nonblock(len, flag = 0, str = nil, exception: true)
- __recv_nonblock(len, flag, str, exception)
- end
-
- # call-seq:
- # basicsocket.recvmsg(maxmesglen=nil, flags=0, maxcontrollen=nil, opts={}) => [mesg, sender_addrinfo, rflags, *controls]
- #
- # recvmsg receives a message using recvmsg(2) system call in blocking manner.
- #
- # _maxmesglen_ is the maximum length of mesg to receive.
- #
- # _flags_ is bitwise OR of MSG_* constants such as Socket::MSG_PEEK.
- #
- # _maxcontrollen_ is the maximum length of controls (ancillary data) to receive.
- #
- # _opts_ is option hash.
- # Currently :scm_rights=>bool is the only option.
- #
- # :scm_rights option specifies that application expects SCM_RIGHTS control message.
- # If the value is nil or false, application don't expects SCM_RIGHTS control message.
- # In this case, recvmsg closes the passed file descriptors immediately.
- # This is the default behavior.
- #
- # If :scm_rights value is neither nil nor false, application expects SCM_RIGHTS control message.
- # In this case, recvmsg creates IO objects for each file descriptors for
- # Socket::AncillaryData#unix_rights method.
- #
- # The return value is 4-elements array.
- #
- # _mesg_ is a string of the received message.
- #
- # _sender_addrinfo_ is a sender socket address for connection-less socket.
- # It is an Addrinfo object.
- # For connection-oriented socket such as TCP, sender_addrinfo is platform dependent.
- #
- # _rflags_ is a flags on the received message which is bitwise OR of MSG_* constants such as Socket::MSG_TRUNC.
- # It will be nil if the system uses 4.3BSD style old recvmsg system call.
- #
- # _controls_ is ancillary data which is an array of Socket::AncillaryData objects such as:
- #
- # #<Socket::AncillaryData: AF_UNIX SOCKET RIGHTS 7>
- #
- # _maxmesglen_ and _maxcontrollen_ can be nil.
- # In that case, the buffer will be grown until the message is not truncated.
- # Internally, MSG_PEEK is used.
- # Buffer full and MSG_CTRUNC are checked for truncation.
- #
- # recvmsg can be used to implement recv_io as follows:
- #
- # mesg, sender_sockaddr, rflags, *controls = sock.recvmsg(:scm_rights=>true)
- # controls.each {|ancdata|
- # if ancdata.cmsg_is?(:SOCKET, :RIGHTS)
- # return ancdata.unix_rights[0]
- # end
- # }
- def recvmsg(dlen = nil, flags = 0, clen = nil, scm_rights: false)
- __recvmsg(dlen, flags, clen, scm_rights)
- end
-
- # call-seq:
- # basicsocket.recvmsg_nonblock(maxdatalen=nil, flags=0, maxcontrollen=nil, opts={}) => [data, sender_addrinfo, rflags, *controls]
- #
- # recvmsg receives a message using recvmsg(2) system call in non-blocking manner.
- #
- # It is similar to BasicSocket#recvmsg
- # but non-blocking flag is set before the system call
- # and it doesn't retry the system call.
- #
- # By specifying `exception: false`, the _opts_ hash allows you to indicate
- # that recvmsg_nonblock should not raise an IO::WaitWritable exception, but
- # return the symbol :wait_writable instead.
- def recvmsg_nonblock(dlen = nil, flags = 0, clen = nil,
- scm_rights: false, exception: true)
- __recvmsg_nonblock(dlen, flags, clen, scm_rights, exception)
- end
end
class Socket < BasicSocket
@@ -456,133 +270,6 @@ class Socket < BasicSocket
end
end
- # call-seq:
- # socket.recvfrom_nonblock(maxlen[, flags[, outbuf[, opts]]]) => [mesg, sender_addrinfo]
- #
- # Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
- # O_NONBLOCK is set for the underlying file descriptor.
- # _flags_ is zero or more of the +MSG_+ options.
- # The first element of the results, _mesg_, is the data received.
- # The second element, _sender_addrinfo_, contains protocol-specific address
- # information of the sender.
- #
- # When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns
- # an empty string as data.
- # The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
- #
- # === Parameters
- # * +maxlen+ - the maximum number of bytes to receive from the socket
- # * +flags+ - zero or more of the +MSG_+ options
- # * +outbuf+ - destination String buffer
- # * +opts+ - keyword hash, supporting `exception: false`
- #
- # === Example
- # # In one file, start this first
- # require 'socket'
- # include Socket::Constants
- # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- # sockaddr = Socket.sockaddr_in(2200, 'localhost')
- # socket.bind(sockaddr)
- # socket.listen(5)
- # client, client_addrinfo = socket.accept
- # begin # emulate blocking recvfrom
- # pair = client.recvfrom_nonblock(20)
- # rescue IO::WaitReadable
- # IO.select([client])
- # retry
- # end
- # data = pair[0].chomp
- # puts "I only received 20 bytes '#{data}'"
- # sleep 1
- # socket.close
- #
- # # In another file, start this second
- # require 'socket'
- # include Socket::Constants
- # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- # sockaddr = Socket.sockaddr_in(2200, 'localhost')
- # socket.connect(sockaddr)
- # socket.puts "Watch this get cut short!"
- # socket.close
- #
- # Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- # to _recvfrom_nonblock_ fails.
- #
- # Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
- # including Errno::EWOULDBLOCK.
- #
- # If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying
- # recvfrom_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that accept_nonblock should not raise an IO::WaitReadable exception, but
- # return the symbol :wait_readable instead.
- #
- # === See
- # * Socket#recvfrom
- def recvfrom_nonblock(len, flag = 0, str = nil, exception: true)
- __recvfrom_nonblock(len, flag, str, exception)
- end
-
- # call-seq:
- # socket.accept_nonblock([options]) => [client_socket, client_addrinfo]
- #
- # Accepts an incoming connection using accept(2) after
- # O_NONBLOCK is set for the underlying file descriptor.
- # It returns an array containing the accepted socket
- # for the incoming connection, _client_socket_,
- # and an Addrinfo, _client_addrinfo_.
- #
- # === Example
- # # In one script, start this first
- # require 'socket'
- # include Socket::Constants
- # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- # sockaddr = Socket.sockaddr_in(2200, 'localhost')
- # socket.bind(sockaddr)
- # socket.listen(5)
- # begin # emulate blocking accept
- # client_socket, client_addrinfo = socket.accept_nonblock
- # rescue IO::WaitReadable, Errno::EINTR
- # IO.select([socket])
- # retry
- # end
- # puts "The client said, '#{client_socket.readline.chomp}'"
- # client_socket.puts "Hello from script one!"
- # socket.close
- #
- # # In another script, start this second
- # require 'socket'
- # include Socket::Constants
- # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- # sockaddr = Socket.sockaddr_in(2200, 'localhost')
- # socket.connect(sockaddr)
- # socket.puts "Hello from script 2."
- # puts "The server said, '#{socket.readline.chomp}'"
- # socket.close
- #
- # Refer to Socket#accept for the exceptions that may be thrown if the call
- # to _accept_nonblock_ fails.
- #
- # Socket#accept_nonblock may raise any error corresponding to accept(2) failure,
- # including Errno::EWOULDBLOCK.
- #
- # If the exception is Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::ECONNABORTED or Errno::EPROTO,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that accept_nonblock should not raise an IO::WaitReadable exception, but
- # return the symbol :wait_readable instead.
- #
- # === See
- # * Socket#accept
- def accept_nonblock(exception: true)
- __accept_nonblock(exception)
- end
-
# :call-seq:
# Socket.tcp(host, port, local_host=nil, local_port=nil, [opts]) {|socket| ... }
# Socket.tcp(host, port, local_host=nil, local_port=nil, [opts])
@@ -661,9 +348,8 @@ class Socket < BasicSocket
# :stopdoc:
def self.ip_sockets_port0(ai_list, reuseaddr)
- sockets = []
begin
- sockets.clear
+ sockets = []
port = nil
ai_list.each {|ai|
begin
@@ -684,13 +370,14 @@ class Socket < BasicSocket
end
}
rescue Errno::EADDRINUSE
- sockets.each {|s| s.close }
+ sockets.each {|s|
+ s.close
+ }
retry
- rescue Exception
- sockets.each {|s| s.close }
- raise
end
sockets
+ ensure
+ sockets.each {|s| s.close if !s.closed? } if $!
end
class << self
private :ip_sockets_port0
@@ -699,15 +386,12 @@ class Socket < BasicSocket
def self.tcp_server_sockets_port0(host)
ai_list = Addrinfo.getaddrinfo(host, 0, nil, :STREAM, nil, Socket::AI_PASSIVE)
sockets = ip_sockets_port0(ai_list, true)
- begin
- sockets.each {|s|
- s.listen(Socket::SOMAXCONN)
- }
- rescue Exception
- sockets.each {|s| s.close }
- raise
- end
+ sockets.each {|s|
+ s.listen(Socket::SOMAXCONN)
+ }
sockets
+ ensure
+ sockets.each {|s| s.close if !s.closed? } if $! && sockets
end
class << self
private :tcp_server_sockets_port0
@@ -751,9 +435,9 @@ class Socket < BasicSocket
if port == 0
sockets = tcp_server_sockets_port0(host)
else
- last_error = nil
- sockets = []
begin
+ last_error = nil
+ sockets = []
Addrinfo.foreach(host, port, nil, :STREAM, nil, Socket::AI_PASSIVE) {|ai|
begin
s = ai.listen
@@ -766,9 +450,8 @@ class Socket < BasicSocket
if sockets.empty?
raise last_error
end
- rescue Exception
- sockets.each {|s| s.close }
- raise
+ ensure
+ sockets.each {|s| s.close if !s.closed? } if $!
end
end
if block_given?
@@ -799,8 +482,11 @@ class Socket < BasicSocket
loop {
readable, _, _ = IO.select(sockets)
readable.each {|r|
- sock, addr = r.accept_nonblock(exception: false)
- next if sock == :wait_readable
+ begin
+ sock, addr = r.accept_nonblock
+ rescue IO::WaitReadable
+ next
+ end
yield sock, addr
}
}
@@ -964,8 +650,11 @@ class Socket < BasicSocket
#
def self.udp_server_recv(sockets)
sockets.each {|r|
- msg, sender_addrinfo, _, *controls = r.recvmsg_nonblock(exception: false)
- next if msg == :wait_readable
+ begin
+ msg, sender_addrinfo, _, *controls = r.recvmsg_nonblock
+ rescue IO::WaitReadable
+ next
+ end
ai = r.local_address
if ai.ipv6? and pktinfo = controls.find {|c| c.cmsg_is?(:IPV6, :PKTINFO) }
ai = Addrinfo.udp(pktinfo.ipv6_pktinfo_addr.ip_address, ai.ip_port)
@@ -1042,7 +731,7 @@ class Socket < BasicSocket
attr_reader :local_address
def inspect # :nodoc:
- "\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>".dup
+ "\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>"
end
# Sends the String +msg+ to the source
@@ -1102,7 +791,7 @@ class Socket < BasicSocket
st = File.lstat(path)
rescue Errno::ENOENT
end
- if st&.socket? && st.owned?
+ if st && st.socket? && st.owned?
File.unlink path
end
end
@@ -1159,193 +848,5 @@ class Socket < BasicSocket
}
end
- # call-seq:
- # socket.connect_nonblock(remote_sockaddr, [options]) => 0
- #
- # Requests a connection to be made on the given +remote_sockaddr+ after
- # O_NONBLOCK is set for the underlying file descriptor.
- # Returns 0 if successful, otherwise an exception is raised.
- #
- # === Parameter
- # # +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
- #
- # === Example:
- # # Pull down Google's web page
- # require 'socket'
- # include Socket::Constants
- # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- # sockaddr = Socket.sockaddr_in(80, 'www.google.com')
- # begin # emulate blocking connect
- # socket.connect_nonblock(sockaddr)
- # rescue IO::WaitWritable
- # IO.select(nil, [socket]) # wait 3-way handshake completion
- # begin
- # socket.connect_nonblock(sockaddr) # check connection failure
- # rescue Errno::EISCONN
- # end
- # end
- # socket.write("GET / HTTP/1.0\r\n\r\n")
- # results = socket.read
- #
- # Refer to Socket#connect for the exceptions that may be thrown if the call
- # to _connect_nonblock_ fails.
- #
- # Socket#connect_nonblock may raise any error corresponding to connect(2) failure,
- # including Errno::EINPROGRESS.
- #
- # If the exception is Errno::EINPROGRESS,
- # it is extended by IO::WaitWritable.
- # So IO::WaitWritable can be used to rescue the exceptions for retrying connect_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that connect_nonblock should not raise an IO::WaitWritable exception, but
- # return the symbol :wait_writable instead.
- #
- # === See
- # # Socket#connect
- def connect_nonblock(addr, exception: true)
- __connect_nonblock(addr, exception)
- end
-end
-
-class UDPSocket < IPSocket
-
- # call-seq:
- # udpsocket.recvfrom_nonblock(maxlen [, flags[, outbuf [, options]]]) => [mesg, sender_inet_addr]
- #
- # Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after
- # O_NONBLOCK is set for the underlying file descriptor.
- # If _maxlen_ is omitted, its default value is 65536.
- # _flags_ is zero or more of the +MSG_+ options.
- # The first element of the results, _mesg_, is the data received.
- # The second element, _sender_inet_addr_, is an array to represent the sender address.
- #
- # When recvfrom(2) returns 0,
- # Socket#recvfrom_nonblock returns an empty string as data.
- # It means an empty packet.
- #
- # === Parameters
- # * +maxlen+ - the number of bytes to receive from the socket
- # * +flags+ - zero or more of the +MSG_+ options
- # * +outbuf+ - destination String buffer
- # * +options+ - keyword hash, supporting `exception: false`
- #
- # === Example
- # require 'socket'
- # s1 = UDPSocket.new
- # s1.bind("127.0.0.1", 0)
- # s2 = UDPSocket.new
- # s2.bind("127.0.0.1", 0)
- # s2.connect(*s1.addr.values_at(3,1))
- # s1.connect(*s2.addr.values_at(3,1))
- # s1.send "aaa", 0
- # begin # emulate blocking recvfrom
- # p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
- # rescue IO::WaitReadable
- # IO.select([s2])
- # retry
- # end
- #
- # Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- # to _recvfrom_nonblock_ fails.
- #
- # UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
- # including Errno::EWOULDBLOCK.
- #
- # If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying recvfrom_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that recvmsg_nonblock should not raise an IO::WaitWritable exception, but
- # return the symbol :wait_writable instead.
- #
- # === See
- # * Socket#recvfrom
- def recvfrom_nonblock(len, flag = 0, outbuf = nil, exception: true)
- __recvfrom_nonblock(len, flag, outbuf, exception)
- end
-end
-
-class TCPServer < TCPSocket
-
- # call-seq:
- # tcpserver.accept_nonblock([options]) => tcpsocket
- #
- # Accepts an incoming connection using accept(2) after
- # O_NONBLOCK is set for the underlying file descriptor.
- # It returns an accepted TCPSocket for the incoming connection.
- #
- # === Example
- # require 'socket'
- # serv = TCPServer.new(2202)
- # begin # emulate blocking accept
- # sock = serv.accept_nonblock
- # rescue IO::WaitReadable, Errno::EINTR
- # IO.select([serv])
- # retry
- # end
- # # sock is an accepted socket.
- #
- # Refer to Socket#accept for the exceptions that may be thrown if the call
- # to TCPServer#accept_nonblock fails.
- #
- # TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure,
- # including Errno::EWOULDBLOCK.
- #
- # If the exception is Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that accept_nonblock should not raise an IO::WaitReadable exception, but
- # return the symbol :wait_readable instead.
- #
- # === See
- # * TCPServer#accept
- # * Socket#accept
- def accept_nonblock(exception: true)
- __accept_nonblock(exception)
- end
end
-class UNIXServer < UNIXSocket
- # call-seq:
- # unixserver.accept_nonblock([options]) => unixsocket
- #
- # Accepts an incoming connection using accept(2) after
- # O_NONBLOCK is set for the underlying file descriptor.
- # It returns an accepted UNIXSocket for the incoming connection.
- #
- # === Example
- # require 'socket'
- # serv = UNIXServer.new("/tmp/sock")
- # begin # emulate blocking accept
- # sock = serv.accept_nonblock
- # rescue IO::WaitReadable, Errno::EINTR
- # IO.select([serv])
- # retry
- # end
- # # sock is an accepted socket.
- #
- # Refer to Socket#accept for the exceptions that may be thrown if the call
- # to UNIXServer#accept_nonblock fails.
- #
- # UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure,
- # including Errno::EWOULDBLOCK.
- #
- # If the exception is Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::ECONNABORTED or Errno::EPROTO,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that accept_nonblock should not raise an IO::WaitReadable exception, but
- # return the symbol :wait_readable instead.
- #
- # === See
- # * UNIXServer#accept
- # * Socket#accept
- def accept_nonblock(exception: true)
- __accept_nonblock(exception)
- end
-end if defined?(UNIXSocket)
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 0ebf628b46..d12b2a24e3 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'optparse'
require 'erb'
@@ -541,7 +540,6 @@ IP_FREEBIND nil Allow binding to nonexistent IP addresses
IP_IPSEC_POLICY nil IPsec security policy
IP_XFRM_POLICY
IP_PASSSEC nil Retrieve security context with datagram
-IP_TRANSPARENT nil Transparent proxy
IP_PMTUDISC_DONT nil Never send DF frames
IP_PMTUDISC_WANT nil Use per-route hints
IP_PMTUDISC_DO nil Always send DF frames
@@ -570,8 +568,6 @@ SO_DONTROUTE nil Use interface addresses
SO_BROADCAST nil Permit sending of broadcast messages
SO_SNDBUF nil Send buffer size
SO_RCVBUF nil Receive buffer size
-SO_SNDBUFFORCE nil Send buffer size without wmem_max limit (Linux 2.6.14)
-SO_RCVBUFFORCE nil Receive buffer size without rmem_max limit (Linux 2.6.14)
SO_KEEPALIVE nil Keep connections alive
SO_OOBINLINE nil Leave received out-of-band data in-line
SO_NO_CHECK nil Disable checksums
@@ -598,7 +594,6 @@ SO_SECURITY_ENCRYPTION_NETWORK
SO_BINDTODEVICE nil Only send packets from the given interface
SO_ATTACH_FILTER nil Attach an accept filter
SO_DETACH_FILTER nil Detach an accept filter
-SO_GET_FILTER nil Obtain filter set by SO_ATTACH_FILTER (Linux 3.8)
SO_PEERNAME nil Name of the connecting user
SO_TIMESTAMP nil Receive timestamp with datagrams (timeval)
SO_TIMESTAMPNS nil Receive nanosecond timestamp with datagrams (timespec)
@@ -606,21 +601,6 @@ SO_BINTIME nil Receive timestamp with datagrams (bintime)
SO_RECVUCRED nil Receive user credentials with datagram
SO_MAC_EXEMPT nil Mandatory Access Control exemption for unlabeled peers
SO_ALLZONES nil Bypass zone boundaries
-SO_PEERSEC nil Obtain the security credentials (Linux 2.6.2)
-SO_PASSSEC nil Toggle security context passing (Linux 2.6.18)
-SO_MARK nil Set the mark for mark-based routing (Linux 2.6.25)
-SO_TIMESTAMPING nil Time stamping of incoming and outgoing packets (Linux 2.6.30)
-SO_PROTOCOL nil Protocol given for socket() (Linux 2.6.32)
-SO_DOMAIN nil Domain given for socket() (Linux 2.6.32)
-SO_RXQ_OVFL nil Toggle cmsg for number of packets dropped (Linux 2.6.33)
-SO_WIFI_STATUS nil Toggle cmsg for wifi status (Linux 3.3)
-SO_PEEK_OFF nil Set the peek offset (Linux 3.4)
-SO_NOFCS nil Set netns of a socket (Linux 3.4)
-SO_LOCK_FILTER nil Lock the filter attached to a socket (Linux 3.9)
-SO_SELECT_ERR_QUEUE nil Make select() detect socket error queue with errorfds (Linux 3.10)
-SO_BUSY_POLL nil Set the threshold in microseconds for low latency polling (Linux 3.11)
-SO_MAX_PACING_RATE nil Cap the rate computed by transport layer. [bytes per second] (Linux 3.13)
-SO_BPF_EXTENSIONS nil Query supported BPF extensions (Linux 3.14)
SOPRI_INTERACTIVE nil Interactive socket priority
SOPRI_NORMAL nil Normal socket priority
@@ -630,32 +610,22 @@ IPX_TYPE
TCP_NODELAY nil Don't delay sending to coalesce packets
TCP_MAXSEG nil Set maximum segment size
-TCP_CORK nil Don't send partial frames (Linux 2.2, glibc 2.2)
-TCP_DEFER_ACCEPT nil Don't notify a listening socket until data is ready (Linux 2.4, glibc 2.2)
-TCP_INFO nil Retrieve information about this socket (Linux 2.4, glibc 2.2)
-TCP_KEEPCNT nil Maximum number of keepalive probes allowed before dropping a connection (Linux 2.4, glibc 2.2)
-TCP_KEEPIDLE nil Idle time before keepalive probes are sent (Linux 2.4, glibc 2.2)
-TCP_KEEPINTVL nil Time between keepalive probes (Linux 2.4, glibc 2.2)
-TCP_LINGER2 nil Lifetime of orphaned FIN_WAIT2 sockets (Linux 2.4, glibc 2.2)
-TCP_MD5SIG nil Use MD5 digests (RFC2385, Linux 2.6.20, glibc 2.7)
+TCP_CORK nil Don't send partial frames
+TCP_DEFER_ACCEPT nil Don't notify a listening socket until data is ready
+TCP_INFO nil Retrieve information about this socket
+TCP_KEEPCNT nil Maximum number of keepalive probes allowed before dropping a connection
+TCP_KEEPIDLE nil Idle time before keepalive probes are sent
+TCP_KEEPINTVL nil Time between keepalive probes
+TCP_LINGER2 nil Lifetime of orphaned FIN_WAIT2 sockets
+TCP_MD5SIG nil Use MD5 digests (RFC2385)
TCP_NOOPT nil Don't use TCP options
TCP_NOPUSH nil Don't push the last block of write
-TCP_QUICKACK nil Enable quickack mode (Linux 2.4.4, glibc 2.3)
-TCP_SYNCNT nil Number of SYN retransmits before a connection is dropped (Linux 2.4, glibc 2.2)
-TCP_WINDOW_CLAMP nil Clamp the size of the advertised window (Linux 2.4, glibc 2.2)
-TCP_FASTOPEN nil Reduce step of the handshake process (Linux 3.7, glibc 2.18)
-TCP_CONGESTION nil TCP congestion control algorithm (Linux 2.6.13, glibc 2.6)
-TCP_COOKIE_TRANSACTIONS nil TCP Cookie Transactions (Linux 2.6.33, glibc 2.18)
-TCP_QUEUE_SEQ nil Sequence of a queue for repair mode (Linux 3.5, glibc 2.18)
-TCP_REPAIR nil Repair mode (Linux 3.5, glibc 2.18)
-TCP_REPAIR_OPTIONS nil Options for repair mode (Linux 3.5, glibc 2.18)
-TCP_REPAIR_QUEUE nil Queue for repair mode (Linux 3.5, glibc 2.18)
-TCP_THIN_DUPACK nil Duplicated acknowledgments handling for thin-streams (Linux 2.6.34, glibc 2.18)
-TCP_THIN_LINEAR_TIMEOUTS nil Linear timeouts for thin-streams (Linux 2.6.34, glibc 2.18)
-TCP_TIMESTAMP nil TCP timestamp (Linux 3.9, glibc 2.18)
-TCP_USER_TIMEOUT nil Max timeout before a TCP connection is aborted (Linux 2.6.37, glibc 2.18)
-
-UDP_CORK nil Don't send partial frames (Linux 2.5.44, glibc 2.11)
+TCP_QUICKACK nil Enable quickack mode
+TCP_SYNCNT nil Number of SYN retransmits before a connection is dropped
+TCP_WINDOW_CLAMP nil Clamp the size of the advertised window
+TCP_FASTOPEN nil Reduce step of the handshake process
+
+UDP_CORK nil Don't send partial frames
EAI_ADDRFAMILY nil Address family for hostname not supported
EAI_AGAIN nil Temporary failure in name resolution
@@ -734,12 +704,10 @@ SOMAXCONN 5 Maximum connection requests that may be queued for a socket
SCM_RIGHTS nil Access rights
SCM_TIMESTAMP nil Timestamp (timeval)
SCM_TIMESTAMPNS nil Timespec (timespec)
-SCM_TIMESTAMPING nil Timestamp (timespec list) (Linux 2.6.30)
SCM_BINTIME nil Timestamp (bintime)
SCM_CREDENTIALS nil The sender's credentials
SCM_CREDS nil Process credentials
SCM_UCRED nil User credentials
-SCM_WIFI_STATUS nil Wifi status (Linux 3.3)
LOCAL_PEERCRED nil Retrieve peer credentials
LOCAL_CREDS nil Pass credentials to receiver
diff --git a/ext/socket/option.c b/ext/socket/option.c
index a823ec7757..3e32230aab 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -2,51 +2,6 @@
VALUE rb_cSockOpt;
-#define pack_var(v) rb_str_new((const char *)&(v), sizeof(v))
-
-#define CAT(x,y) x##y
-#define XCAT(x,y) CAT(x,y)
-
-#if defined(__linux__) || \
- defined(__GNU__) /* GNU/Hurd */ || \
- defined(__FreeBSD__) || \
- defined(__DragonFly__) || \
- defined(__APPLE__) || \
- defined(_WIN32) || \
- defined(__CYGWIN__)
-# define TYPE_IP_MULTICAST_LOOP int
-# define TYPE_IP_MULTICAST_TTL int
-#else
-/* The original IP multicast implementation by Steve Deering
- * NetBSD
- * OpenBSD
- * SunOS
- */
-# define TYPE_IP_MULTICAST_LOOP byte
-# define TYPE_IP_MULTICAST_TTL byte
-# define USE_INSPECT_BYTE 1
-#endif
-
-#define check_size(len, size) \
- ((len) == (size) ? \
- (void)0 : \
- rb_raise(rb_eTypeError, "size differ. expected as "#size"=%d but %ld", \
- (int)size, (long)(len)))
-
-static VALUE
-sockopt_pack_byte(VALUE value)
-{
- char i = NUM2CHR(rb_to_int(value));
- return pack_var(i);
-}
-
-static VALUE
-sockopt_pack_int(VALUE value)
-{
- int i = NUM2INT(rb_to_int(value));
- return pack_var(i);
-}
-
static VALUE
constant_to_sym(int constant, ID (*intern_const)(int))
{
@@ -193,6 +148,8 @@ sockopt_data(VALUE self)
*
* Creates a new Socket::Option object which contains a byte as data.
*
+ * The size and endian is dependent on the platform.
+ *
* p Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1)
* #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
*/
@@ -202,7 +159,8 @@ sockopt_s_byte(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE v
int family = rsock_family_arg(vfamily);
int level = rsock_level_arg(family, vlevel);
int optname = rsock_optname_arg(family, level, voptname);
- return rsock_sockopt_new(family, level, optname, sockopt_pack_byte(vint));
+ unsigned char i = (unsigned char)NUM2CHR(vint);
+ return rsock_sockopt_new(family, level, optname, rb_str_new((char*)&i, sizeof(i)));
}
/*
@@ -211,15 +169,20 @@ sockopt_s_byte(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE v
*
* Returns the data in _sockopt_ as an byte.
*
+ * The size and endian is dependent on the platform.
+ *
* sockopt = Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1)
* p sockopt.byte => 1
*/
static VALUE
sockopt_byte(VALUE self)
{
+ unsigned char i;
VALUE data = sockopt_data(self);
StringValue(data);
- check_size(RSTRING_LEN(data), sizeof(char));
+ if (RSTRING_LEN(data) != sizeof(i))
+ rb_raise(rb_eTypeError, "size differ. expected as sizeof(int)=%d but %ld",
+ (int)sizeof(i), (long)RSTRING_LEN(data));
return CHR2FIX(*RSTRING_PTR(data));
}
@@ -240,7 +203,8 @@ sockopt_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vi
int family = rsock_family_arg(vfamily);
int level = rsock_level_arg(family, vlevel);
int optname = rsock_optname_arg(family, level, voptname);
- return rsock_sockopt_new(family, level, optname, sockopt_pack_int(vint));
+ int i = NUM2INT(vint);
+ return rsock_sockopt_new(family, level, optname, rb_str_new((char*)&i, sizeof(i)));
}
/*
@@ -260,7 +224,9 @@ sockopt_int(VALUE self)
int i;
VALUE data = sockopt_data(self);
StringValue(data);
- check_size(RSTRING_LEN(data), sizeof(int));
+ if (RSTRING_LEN(data) != sizeof(int))
+ rb_raise(rb_eTypeError, "size differ. expected as sizeof(int)=%d but %ld",
+ (int)sizeof(int), (long)RSTRING_LEN(data));
memcpy((char*)&i, RSTRING_PTR(data), sizeof(int));
return INT2NUM(i);
}
@@ -286,7 +252,7 @@ sockopt_s_bool(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE v
int level = rsock_level_arg(family, vlevel);
int optname = rsock_optname_arg(family, level, voptname);
int i = RTEST(vbool) ? 1 : 0;
- return rsock_sockopt_new(family, level, optname, pack_var(i));
+ return rsock_sockopt_new(family, level, optname, rb_str_new((char*)&i, sizeof(i)));
}
/*
@@ -302,15 +268,12 @@ static VALUE
sockopt_bool(VALUE self)
{
int i;
- long len;
VALUE data = sockopt_data(self);
StringValue(data);
- len = RSTRING_LEN(data);
- if (len == 1) {
- return *RSTRING_PTR(data) == 0 ? Qfalse : Qtrue;
- }
- check_size(len, sizeof(int));
- memcpy((char*)&i, RSTRING_PTR(data), len);
+ if (RSTRING_LEN(data) != sizeof(int))
+ rb_raise(rb_eTypeError, "size differ. expected as sizeof(int)=%d but %ld",
+ (int)sizeof(int), (long)RSTRING_LEN(data));
+ memcpy((char*)&i, RSTRING_PTR(data), sizeof(int));
return i == 0 ? Qfalse : Qtrue;
}
@@ -339,7 +302,7 @@ sockopt_s_linger(VALUE klass, VALUE vonoff, VALUE vsecs)
else
l.l_onoff = RTEST(vonoff) ? 1 : 0;
l.l_linger = NUM2INT(vsecs);
- return rsock_sockopt_new(AF_UNSPEC, SOL_SOCKET, SO_LINGER, pack_var(l));
+ return rsock_sockopt_new(AF_UNSPEC, SOL_SOCKET, SO_LINGER, rb_str_new((char*)&l, sizeof(l)));
}
/*
@@ -362,7 +325,9 @@ sockopt_linger(VALUE self)
if (level != SOL_SOCKET || optname != SO_LINGER)
rb_raise(rb_eTypeError, "linger socket option expected");
- check_size(RSTRING_LEN(data), sizeof(struct linger));
+ if (RSTRING_LEN(data) != sizeof(l))
+ rb_raise(rb_eTypeError, "size differ. expected as sizeof(struct linger)=%d but %ld",
+ (int)sizeof(struct linger), (long)RSTRING_LEN(data));
memcpy((char*)&l, RSTRING_PTR(data), sizeof(struct linger));
switch (l.l_onoff) {
case 0: vonoff = Qfalse; break;
@@ -391,10 +356,14 @@ sockopt_linger(VALUE self)
static VALUE
sockopt_s_ipv4_multicast_loop(VALUE klass, VALUE value)
{
-
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_LOOP)
- VALUE o = XCAT(sockopt_pack_,TYPE_IP_MULTICAST_LOOP)(value);
- return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_LOOP, o);
+# ifdef __NetBSD__
+ unsigned char i = NUM2CHR(rb_to_int(value));
+# else
+ int i = NUM2INT(rb_to_int(value));
+# endif
+ return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_LOOP,
+ rb_str_new((char*)&i, sizeof(i)));
#else
# error IPPROTO_IP or IP_MULTICAST_LOOP is not implemented
#endif
@@ -418,15 +387,22 @@ sockopt_ipv4_multicast_loop(VALUE self)
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_LOOP)
if (family == AF_INET && level == IPPROTO_IP && optname == IP_MULTICAST_LOOP) {
- return XCAT(sockopt_,TYPE_IP_MULTICAST_LOOP)(self);
+# ifdef __NetBSD__
+ return sockopt_byte(self);
+# else
+ return sockopt_int(self);
+# endif
}
#endif
rb_raise(rb_eTypeError, "ipv4_multicast_loop socket option expected");
UNREACHABLE;
}
-#define inspect_ipv4_multicast_loop(a,b,c,d) \
- XCAT(inspect_,TYPE_IP_MULTICAST_LOOP)(a,b,c,d)
+#ifdef __NetBSD__
+# define inspect_ipv4_multicast_loop(a,b,c,d) inspect_byte(a,b,c,d)
+#else
+# define inspect_ipv4_multicast_loop(a,b,c,d) inspect_int(a,b,c,d)
+#endif
/*
* call-seq:
@@ -444,8 +420,13 @@ static VALUE
sockopt_s_ipv4_multicast_ttl(VALUE klass, VALUE value)
{
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_TTL)
- VALUE o = XCAT(sockopt_pack_,TYPE_IP_MULTICAST_TTL)(value);
- return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_TTL, o);
+# ifdef __NetBSD__
+ unsigned char i = NUM2CHR(rb_to_int(value));
+# else
+ int i = NUM2INT(rb_to_int(value));
+# endif
+ return rsock_sockopt_new(AF_INET, IPPROTO_IP, IP_MULTICAST_TTL,
+ rb_str_new((char*)&i, sizeof(i)));
#else
# error IPPROTO_IP or IP_MULTICAST_TTL is not implemented
#endif
@@ -469,15 +450,22 @@ sockopt_ipv4_multicast_ttl(VALUE self)
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_TTL)
if (family == AF_INET && level == IPPROTO_IP && optname == IP_MULTICAST_TTL) {
- return XCAT(sockopt_,TYPE_IP_MULTICAST_TTL)(self);
+# ifdef __NetBSD__
+ return sockopt_byte(self);
+# else
+ return sockopt_int(self);
+# endif
}
#endif
rb_raise(rb_eTypeError, "ipv4_multicast_ttl socket option expected");
UNREACHABLE;
}
-#define inspect_ipv4_multicast_ttl(a,b,c,d) \
- XCAT(inspect_,TYPE_IP_MULTICAST_TTL)(a,b,c,d)
+#ifdef __NetBSD__
+# define inspect_ipv4_multicast_ttl(a,b,c,d) inspect_byte(a,b,c,d)
+#else
+# define inspect_ipv4_multicast_ttl(a,b,c,d) inspect_int(a,b,c,d)
+#endif
static int
inspect_int(int level, int optname, VALUE data, VALUE ret)
@@ -493,7 +481,7 @@ inspect_int(int level, int optname, VALUE data, VALUE ret)
}
}
-#ifdef USE_INSPECT_BYTE
+#ifdef __NetBSD__
static int
inspect_byte(int level, int optname, VALUE data, VALUE ret)
{
@@ -603,15 +591,6 @@ inspect_timeval_as_interval(int level, int optname, VALUE data, VALUE ret)
* (MULTICAST 1.2 Release)
* http://www.kohala.com/start/mcast.api.txt
*
- * There are 2 socket options which takes a u_char (unsigned char).
- *
- * IP_MULTICAST_TTL
- * IP_MULTICAST_LOOP
- *
- * However Linux and FreeBSD setsockname accepts int argument
- * as well as u_char.
- * Their getsockname returns int.
- *
* There are 3 socket options which takes a struct.
*
* IP_MULTICAST_IF: struct in_addr
@@ -644,8 +623,8 @@ inspect_timeval_as_interval(int level, int optname, VALUE data, VALUE ret)
* it is not distinguishable by the size.
*/
-#if !defined HAVE_INET_NTOP && ! defined _WIN32
-const char *
+#ifndef HAVE_INET_NTOP
+static const char *
inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
{
#ifdef HAVE_INET_NTOA
@@ -660,6 +639,8 @@ inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
#endif
return numaddr;
}
+#elif defined __MINGW64__
+# define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l)
#endif
/* Although the buffer size needed depends on the prefixes, "%u" may generate "4294967295". */
@@ -808,333 +789,6 @@ inspect_ipv6_mreq(int level, int optname, VALUE data, VALUE ret)
}
#endif
-#if defined(IPPROTO_TCP) && defined(TCP_INFO) && defined(HAVE_TYPE_STRUCT_TCP_INFO)
-
-#ifdef __FreeBSD__
-# ifndef HAVE_CONST_TCP_ESTABLISHED
-# define TCP_ESTABLISHED TCPS_ESTABLISHED
-# endif
-# ifndef HAVE_CONST_TCP_SYN_SENT
-# define TCP_SYN_SENT TCPS_SYN_SENT
-# endif
-# ifndef HAVE_CONST_TCP_SYN_RECV
-# define TCP_SYN_RECV TCPS_SYN_RECEIVED
-# endif
-# ifndef HAVE_CONST_TCP_FIN_WAIT1
-# define TCP_FIN_WAIT1 TCPS_FIN_WAIT_1
-# endif
-# ifndef HAVE_CONST_TCP_FIN_WAIT2
-# define TCP_FIN_WAIT2 TCPS_FIN_WAIT_2
-# endif
-# ifndef HAVE_CONST_TCP_TIME_WAIT
-# define TCP_TIME_WAIT TCPS_TIME_WAIT
-# endif
-# ifndef HAVE_CONST_TCP_CLOSE
-# define TCP_CLOSE TCPS_CLOSED
-# endif
-# ifndef HAVE_CONST_TCP_CLOSE_WAIT
-# define TCP_CLOSE_WAIT TCPS_CLOSE_WAIT
-# endif
-# ifndef HAVE_CONST_TCP_LAST_ACK
-# define TCP_LAST_ACK TCPS_LAST_ACK
-# endif
-# ifndef HAVE_CONST_TCP_LISTEN
-# define TCP_LISTEN TCPS_LISTEN
-# endif
-# ifndef HAVE_CONST_TCP_CLOSING
-# define TCP_CLOSING TCPS_CLOSING
-# endif
-#endif
-
-#if defined(HAVE_CONST_TCP_ESTABLISHED) && !defined(TCP_ESTABLISHED)
-# define TCP_ESTABLISHED TCP_ESTABLISHED
-#endif
-#if defined(HAVE_CONST_TCP_SYN_SENT) && !defined(TCP_SYN_SENT)
-# define TCP_SYN_SENT TCP_SYN_SENT
-#endif
-#if defined(HAVE_CONST_TCP_SYN_RECV) && !defined(TCP_SYN_RECV)
-# define TCP_SYN_RECV TCP_SYN_RECV
-#endif
-#if defined(HAVE_CONST_TCP_FIN_WAIT1) && !defined(TCP_FIN_WAIT1)
-# define TCP_FIN_WAIT1 TCP_FIN_WAIT1
-#endif
-#if defined(HAVE_CONST_TCP_FIN_WAIT2) && !defined(TCP_FIN_WAIT2)
-# define TCP_FIN_WAIT2 TCP_FIN_WAIT2
-#endif
-#if defined(HAVE_CONST_TCP_TIME_WAIT) && !defined(TCP_TIME_WAIT)
-# define TCP_TIME_WAIT TCP_TIME_WAIT
-#endif
-#if defined(HAVE_CONST_TCP_CLOSE) && !defined(TCP_CLOSE)
-# define TCP_CLOSE TCP_CLOSE
-#endif
-#if defined(HAVE_CONST_TCP_CLOSE_WAIT) && !defined(TCP_CLOSE_WAIT)
-# define TCP_CLOSE_WAIT TCP_CLOSE_WAIT
-#endif
-#if defined(HAVE_CONST_TCP_LAST_ACK) && !defined(TCP_LAST_ACK)
-# define TCP_LAST_ACK TCP_LAST_ACK
-#endif
-#if defined(HAVE_CONST_TCP_LISTEN) && !defined(TCP_LISTEN)
-# define TCP_LISTEN TCP_LISTEN
-#endif
-#if defined(HAVE_CONST_TCP_CLOSING) && !defined(TCP_CLOSING)
-# define TCP_CLOSING TCP_CLOSING
-#endif
-
-static void
-inspect_tcpi_options(VALUE ret, uint8_t options)
-{
- int sep = '=';
-
- rb_str_cat2(ret, " options");
-#define INSPECT_TCPI_OPTION(optval, name) \
- if (options & (optval)) { \
- options &= ~(uint8_t)(optval); \
- rb_str_catf(ret, "%c%s", sep, name); \
- sep = ','; \
- }
-#ifdef TCPI_OPT_TIMESTAMPS /* GNU/Linux, FreeBSD */
- INSPECT_TCPI_OPTION(TCPI_OPT_TIMESTAMPS, "TIMESTAMPS");
-#endif
-#ifdef TCPI_OPT_SACK /* GNU/Linux, FreeBSD */
- INSPECT_TCPI_OPTION(TCPI_OPT_SACK, "SACK");
-#endif
-#ifdef TCPI_OPT_WSCALE /* GNU/Linux, FreeBSD */
- INSPECT_TCPI_OPTION(TCPI_OPT_WSCALE, "WSCALE");
-#endif
-#ifdef TCPI_OPT_ECN /* GNU/Linux, FreeBSD */
- INSPECT_TCPI_OPTION(TCPI_OPT_ECN, "ECN");
-#endif
-#ifdef TCPI_OPT_ECN_SEEN /* GNU/Linux */
- INSPECT_TCPI_OPTION(TCPI_OPT_ECN_SEEN, "ECN_SEEN");
-#endif
-#ifdef TCPI_OPT_SYN_DATA /* GNU/Linux */
- INSPECT_TCPI_OPTION(TCPI_OPT_SYN_DATA, "SYN_DATA");
-#endif
-#ifdef TCPI_OPT_TOE /* FreeBSD */
- INSPECT_TCPI_OPTION(TCPI_OPT_TOE, "TOE");
-#endif
-#undef INSPECT_TCPI_OPTION
-
- if (options || sep == '=') {
- rb_str_catf(ret, "%c%u", sep, options);
- }
-}
-
-static void
-inspect_tcpi_usec(VALUE ret, const char *prefix, uint32_t t)
-{
- rb_str_catf(ret, "%s%u.%06us", prefix, t / 1000000, t % 1000000);
-}
-
-#if !defined __FreeBSD__ && ( \
- defined HAVE_STRUCT_TCP_INFO_TCPI_LAST_DATA_SENT || \
- defined HAVE_STRUCT_TCP_INFO_TCPI_LAST_DATA_RECV || \
- defined HAVE_STRUCT_TCP_INFO_TCPI_LAST_ACK_SENT || \
- defined HAVE_STRUCT_TCP_INFO_TCPI_LAST_ACK_RECV || \
- 0)
-static void
-inspect_tcpi_msec(VALUE ret, const char *prefix, uint32_t t)
-{
- rb_str_catf(ret, "%s%u.%03us", prefix, t / 1000, t % 1000);
-}
-#endif
-
-#ifdef __FreeBSD__
-# define inspect_tcpi_rto(ret, t) inspect_tcpi_usec(ret, " rto=", t)
-# define inspect_tcpi_last_data_recv(ret, t) inspect_tcpi_usec(ret, " last_data_recv=", t)
-# define inspect_tcpi_rtt(ret, t) inspect_tcpi_usec(ret, " rtt=", t)
-# define inspect_tcpi_rttvar(ret, t) inspect_tcpi_usec(ret, " rttvar=", t)
-#else
-# define inspect_tcpi_rto(ret, t) inspect_tcpi_usec(ret, " rto=", t)
-# define inspect_tcpi_ato(ret, t) inspect_tcpi_usec(ret, " ato=", t)
-# define inspect_tcpi_last_data_sent(ret, t) inspect_tcpi_msec(ret, " last_data_sent=", t)
-# define inspect_tcpi_last_data_recv(ret, t) inspect_tcpi_msec(ret, " last_data_recv=", t)
-# define inspect_tcpi_last_ack_sent(ret, t) inspect_tcpi_msec(ret, " last_ack_sent=", t)
-# define inspect_tcpi_last_ack_recv(ret, t) inspect_tcpi_msec(ret, " last_ack_recv=", t)
-# define inspect_tcpi_rtt(ret, t) inspect_tcpi_usec(ret, " rtt=", t)
-# define inspect_tcpi_rttvar(ret, t) inspect_tcpi_usec(ret, " rttvar=", t)
-# define inspect_tcpi_rcv_rtt(ret, t) inspect_tcpi_usec(ret, " rcv_rtt=", t)
-#endif
-
-static int
-inspect_tcp_info(int level, int optname, VALUE data, VALUE ret)
-{
- size_t actual_size = RSTRING_LEN(data);
- if (sizeof(struct tcp_info) <= actual_size) {
- struct tcp_info s;
- memcpy((char*)&s, RSTRING_PTR(data), sizeof(s));
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_STATE
- switch (s.tcpi_state) {
-# ifdef TCP_ESTABLISHED
- case TCP_ESTABLISHED: rb_str_cat_cstr(ret, " state=ESTABLISHED"); break;
-# endif
-# ifdef TCP_SYN_SENT
- case TCP_SYN_SENT: rb_str_cat_cstr(ret, " state=SYN_SENT"); break;
-# endif
-# ifdef TCP_SYN_RECV
- case TCP_SYN_RECV: rb_str_cat_cstr(ret, " state=SYN_RECV"); break;
-# endif
-# ifdef TCP_FIN_WAIT1
- case TCP_FIN_WAIT1: rb_str_cat_cstr(ret, " state=FIN_WAIT1"); break;
-# endif
-# ifdef TCP_FIN_WAIT2
- case TCP_FIN_WAIT2: rb_str_cat_cstr(ret, " state=FIN_WAIT2"); break;
-# endif
-# ifdef TCP_TIME_WAIT
- case TCP_TIME_WAIT: rb_str_cat_cstr(ret, " state=TIME_WAIT"); break;
-# endif
-# ifdef TCP_CLOSE
- case TCP_CLOSE: rb_str_cat_cstr(ret, " state=CLOSED"); break; /* RFC 793 uses "CLOSED", not "CLOSE" */
-# endif
-# ifdef TCP_CLOSE_WAIT
- case TCP_CLOSE_WAIT: rb_str_cat_cstr(ret, " state=CLOSE_WAIT"); break;
-# endif
-# ifdef TCP_LAST_ACK
- case TCP_LAST_ACK: rb_str_cat_cstr(ret, " state=LAST_ACK"); break;
-# endif
-# ifdef TCP_LISTEN
- case TCP_LISTEN: rb_str_cat_cstr(ret, " state=LISTEN"); break;
-# endif
-# ifdef TCP_CLOSING
- case TCP_CLOSING: rb_str_cat_cstr(ret, " state=CLOSING"); break;
-# endif
- default: rb_str_catf(ret, " state=%u", s.tcpi_state); break;
- }
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_CA_STATE
- switch (s.tcpi_ca_state) {
- case TCP_CA_Open: rb_str_cat_cstr(ret, " ca_state=Open"); break;
- case TCP_CA_Disorder: rb_str_cat_cstr(ret, " ca_state=Disorder"); break;
- case TCP_CA_CWR: rb_str_cat_cstr(ret, " ca_state=CWR"); break;
- case TCP_CA_Recovery: rb_str_cat_cstr(ret, " ca_state=Recovery"); break;
- case TCP_CA_Loss: rb_str_cat_cstr(ret, " ca_state=Loss"); break;
- default: rb_str_catf(ret, " ca_state=%u", s.tcpi_ca_state); break;
- }
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RETRANSMITS
- rb_str_catf(ret, " retransmits=%u", s.tcpi_retransmits);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_PROBES
- rb_str_catf(ret, " probes=%u", s.tcpi_probes);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_BACKOFF
- rb_str_catf(ret, " backoff=%u", s.tcpi_backoff);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_OPTIONS
- inspect_tcpi_options(ret, s.tcpi_options);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_WSCALE
- rb_str_catf(ret, " snd_wscale=%u", s.tcpi_snd_wscale);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_WSCALE
- rb_str_catf(ret, " rcv_wscale=%u", s.tcpi_rcv_wscale);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RTO
- inspect_tcpi_rto(ret, s.tcpi_rto);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_ATO
- inspect_tcpi_ato(ret, s.tcpi_ato);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_MSS
- rb_str_catf(ret, " snd_mss=%u", s.tcpi_snd_mss);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_MSS
- rb_str_catf(ret, " rcv_mss=%u", s.tcpi_rcv_mss);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_UNACKED
- rb_str_catf(ret, " unacked=%u", s.tcpi_unacked);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SACKED
- rb_str_catf(ret, " sacked=%u", s.tcpi_sacked);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_LOST
- rb_str_catf(ret, " lost=%u", s.tcpi_lost);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RETRANS
- rb_str_catf(ret, " retrans=%u", s.tcpi_retrans);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_FACKETS
- rb_str_catf(ret, " fackets=%u", s.tcpi_fackets);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_LAST_DATA_SENT
- inspect_tcpi_last_data_sent(ret, s.tcpi_last_data_sent);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_LAST_ACK_SENT
- inspect_tcpi_last_ack_sent(ret, s.tcpi_last_ack_sent);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_LAST_DATA_RECV
- inspect_tcpi_last_data_recv(ret, s.tcpi_last_data_recv);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_LAST_ACK_RECV
- inspect_tcpi_last_ack_recv(ret, s.tcpi_last_ack_recv);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_PMTU
- rb_str_catf(ret, " pmtu=%u", s.tcpi_pmtu);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_SSTHRESH
- rb_str_catf(ret, " rcv_ssthresh=%u", s.tcpi_rcv_ssthresh);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RTT
- inspect_tcpi_rtt(ret, s.tcpi_rtt);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RTTVAR
- inspect_tcpi_rttvar(ret, s.tcpi_rttvar);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_SSTHRESH
- rb_str_catf(ret, " snd_ssthresh=%u", s.tcpi_snd_ssthresh);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_CWND
- rb_str_catf(ret, " snd_cwnd=%u", s.tcpi_snd_cwnd);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_ADVMSS
- rb_str_catf(ret, " advmss=%u", s.tcpi_advmss);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_REORDERING
- rb_str_catf(ret, " reordering=%u", s.tcpi_reordering);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_RTT
- inspect_tcpi_rcv_rtt(ret, s.tcpi_rcv_rtt);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_SPACE
- rb_str_catf(ret, " rcv_space=%u", s.tcpi_rcv_space);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS
- rb_str_catf(ret, " total_retrans=%u", s.tcpi_total_retrans);
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_WND
- rb_str_catf(ret, " snd_wnd=%u", s.tcpi_snd_wnd); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_BWND
- rb_str_catf(ret, " snd_bwnd=%u", s.tcpi_snd_bwnd); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_NXT
- rb_str_catf(ret, " snd_nxt=%u", s.tcpi_snd_nxt); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_NXT
- rb_str_catf(ret, " rcv_nxt=%u", s.tcpi_rcv_nxt); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_TOE_TID
- rb_str_catf(ret, " toe_tid=%u", s.tcpi_toe_tid); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_REXMITPACK
- rb_str_catf(ret, " snd_rexmitpack=%u", s.tcpi_snd_rexmitpack); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_RCV_OOOPACK
- rb_str_catf(ret, " rcv_ooopack=%u", s.tcpi_rcv_ooopack); /* FreeBSD */
-#endif
-#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_ZEROWIN
- rb_str_catf(ret, " snd_zerowin=%u", s.tcpi_snd_zerowin); /* FreeBSD */
-#endif
- if (sizeof(struct tcp_info) < actual_size)
- rb_str_catf(ret, " (%u bytes too long)", (unsigned)(actual_size - sizeof(struct tcp_info)));
- return 1;
- }
- else {
- return 0;
- }
-}
-#endif
-
#if defined(SOL_SOCKET) && defined(SO_PEERCRED) /* GNU/Linux, OpenBSD */
#if defined(__OpenBSD__)
#define RUBY_SOCK_PEERCRED struct sockpeercred
@@ -1247,7 +901,7 @@ sockopt_inspect(VALUE self)
v = optname_to_sym(level, optname);
if (SYMBOL_P(v))
- rb_str_catf(ret, " %"PRIsVALUE, rb_sym2str(v));
+ rb_str_catf(ret, " %s", rb_id2name(SYM2ID(v)));
else
rb_str_catf(ret, " optname:%d", optname);
}
@@ -1382,9 +1036,6 @@ sockopt_inspect(VALUE self)
# if defined(TCP_NODELAY) /* POSIX */
case TCP_NODELAY: inspected = inspect_int(level, optname, data, ret); break;
# endif
-# if defined(TCP_INFO) && defined(HAVE_TYPE_STRUCT_TCP_INFO) /* Linux, FreeBSD */
- case TCP_INFO: inspected = inspect_tcp_info(level, optname, data, ret); break;
-# endif
}
break;
# endif
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index 92556fc9d2..109fcccae8 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -1,6 +1,6 @@
/************************************************
- raddrinfo.c -
+ ainfo.c -
created at: Thu Mar 31 12:21:29 JST 1994
@@ -154,34 +154,6 @@ struct getaddrinfo_arg
struct addrinfo **res;
};
-#ifdef HAVE_INET_PTON
-static int
-parse_numeric_port(const char *service, int *portp)
-{
- unsigned long u;
-
- if (!service) {
- *portp = 0;
- return 1;
- }
-
- if (strspn(service, "0123456789") != strlen(service))
- return 0;
-
- errno = 0;
- u = STRTOUL(service, NULL, 10);
- if (errno)
- return 0;
-
- if (0x10000 <= u)
- return 0;
-
- *portp = (int)u;
-
- return 1;
-}
-#endif
-
static void *
nogvl_getaddrinfo(void *arg)
{
@@ -199,141 +171,24 @@ nogvl_getaddrinfo(void *arg)
}
#endif
-static int
-numeric_getaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res)
-{
-#ifdef HAVE_INET_PTON
-# if defined __MINGW64__
-# define inet_pton(f,s,d) rb_w32_inet_pton(f,s,d)
-# endif
-
- int port;
-
- if (node && parse_numeric_port(service, &port)) {
- static const struct {
- int socktype;
- int protocol;
- } list[] = {
- { SOCK_STREAM, IPPROTO_TCP },
- { SOCK_DGRAM, IPPROTO_UDP },
- { SOCK_RAW, 0 }
- };
- struct addrinfo *ai = NULL;
- int hint_family = hints ? hints->ai_family : PF_UNSPEC;
- int hint_socktype = hints ? hints->ai_socktype : 0;
- int hint_protocol = hints ? hints->ai_protocol : 0;
- char ipv4addr[4];
-#ifdef AF_INET6
- char ipv6addr[16];
- if ((hint_family == PF_UNSPEC || hint_family == PF_INET6) &&
- strspn(node, "0123456789abcdefABCDEF.:") == strlen(node) &&
- inet_pton(AF_INET6, node, ipv6addr)) {
- int i;
- for (i = numberof(list)-1; 0 <= i; i--) {
- if ((hint_socktype == 0 || hint_socktype == list[i].socktype) &&
- (hint_protocol == 0 || list[i].protocol == 0 || hint_protocol == list[i].protocol)) {
- struct addrinfo *ai0 = xcalloc(1, sizeof(struct addrinfo));
- struct sockaddr_in6 *sa = xmalloc(sizeof(struct sockaddr_in6));
- INIT_SOCKADDR_IN6(sa, sizeof(struct sockaddr_in6));
- memcpy(&sa->sin6_addr, ipv6addr, sizeof(ipv6addr));
- sa->sin6_port = htons(port);
- ai0->ai_family = PF_INET6;
- ai0->ai_socktype = list[i].socktype;
- ai0->ai_protocol = hint_protocol ? hint_protocol : list[i].protocol;
- ai0->ai_addrlen = sizeof(struct sockaddr_in6);
- ai0->ai_addr = (struct sockaddr *)sa;
- ai0->ai_canonname = NULL;
- ai0->ai_next = ai;
- ai = ai0;
- }
- }
- }
- else
-#endif
- if ((hint_family == PF_UNSPEC || hint_family == PF_INET) &&
- strspn(node, "0123456789.") == strlen(node) &&
- inet_pton(AF_INET, node, ipv4addr)) {
- int i;
- for (i = numberof(list)-1; 0 <= i; i--) {
- if ((hint_socktype == 0 || hint_socktype == list[i].socktype) &&
- (hint_protocol == 0 || list[i].protocol == 0 || hint_protocol == list[i].protocol)) {
- struct addrinfo *ai0 = xcalloc(1, sizeof(struct addrinfo));
- struct sockaddr_in *sa = xmalloc(sizeof(struct sockaddr_in));
- INIT_SOCKADDR_IN(sa, sizeof(struct sockaddr_in));
- memcpy(&sa->sin_addr, ipv4addr, sizeof(ipv4addr));
- sa->sin_port = htons(port);
- ai0->ai_family = PF_INET;
- ai0->ai_socktype = list[i].socktype;
- ai0->ai_protocol = hint_protocol ? hint_protocol : list[i].protocol;
- ai0->ai_addrlen = sizeof(struct sockaddr_in);
- ai0->ai_addr = (struct sockaddr *)sa;
- ai0->ai_canonname = NULL;
- ai0->ai_next = ai;
- ai = ai0;
- }
- }
- }
- if (ai) {
- *res = ai;
- return 0;
- }
- }
-#endif
- return EAI_FAIL;
-}
-
int
rb_getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints,
- struct rb_addrinfo **res)
+ struct addrinfo **res)
{
- struct addrinfo *ai;
- int ret;
- int allocated_by_malloc = 0;
-
- ret = numeric_getaddrinfo(node, service, hints, &ai);
- if (ret == 0)
- allocated_by_malloc = 1;
- else {
#ifdef GETADDRINFO_EMU
- ret = getaddrinfo(node, service, hints, &ai);
+ return getaddrinfo(node, service, hints, res);
#else
- struct getaddrinfo_arg arg;
- MEMZERO(&arg, struct getaddrinfo_arg, 1);
- arg.node = node;
- arg.service = service;
- arg.hints = hints;
- arg.res = &ai;
- ret = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getaddrinfo, &arg, RUBY_UBF_IO, 0);
-#endif
- }
-
- if (ret == 0) {
- *res = (struct rb_addrinfo *)xmalloc(sizeof(struct rb_addrinfo));
- (*res)->allocated_by_malloc = allocated_by_malloc;
- (*res)->ai = ai;
- }
+ struct getaddrinfo_arg arg;
+ int ret;
+ MEMZERO(&arg, sizeof arg, 1);
+ arg.node = node;
+ arg.service = service;
+ arg.hints = hints;
+ arg.res = res;
+ ret = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getaddrinfo, &arg, RUBY_UBF_IO, 0);
return ret;
-}
-
-void
-rb_freeaddrinfo(struct rb_addrinfo *ai)
-{
- if (!ai->allocated_by_malloc)
- freeaddrinfo(ai->ai);
- else {
- struct addrinfo *ai1, *ai2;
- ai1 = ai->ai;
- while (ai1) {
- ai2 = ai1->ai_next;
- xfree(ai1->ai_addr);
- xfree(ai1);
- ai1 = ai2;
- }
- }
- xfree(ai);
+#endif
}
#ifndef GETADDRINFO_EMU
@@ -341,11 +196,11 @@ struct getnameinfo_arg
{
const struct sockaddr *sa;
socklen_t salen;
- int flags;
char *host;
size_t hostlen;
char *serv;
size_t servlen;
+ int flags;
};
static void *
@@ -490,10 +345,10 @@ port_str(VALUE port, char *pbuf, size_t pbuflen, int *flags_ptr)
}
}
-struct rb_addrinfo*
+struct addrinfo*
rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack)
{
- struct rb_addrinfo* res = NULL;
+ struct addrinfo* res = NULL;
char *hostp, *portp;
int error;
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
@@ -518,26 +373,13 @@ rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_h
return res;
}
-int
-rsock_fd_family(int fd)
-{
- struct sockaddr sa = { 0 };
- socklen_t sa_len = sizeof(sa);
-
- if (fd < 0 || getsockname(fd, &sa, &sa_len) != 0 ||
- (size_t)sa_len < offsetof(struct sockaddr, sa_family) + sizeof(sa.sa_family)) {
- return AF_UNSPEC;
- }
- return sa.sa_family;
-}
-
-struct rb_addrinfo*
-rsock_addrinfo(VALUE host, VALUE port, int family, int socktype, int flags)
+struct addrinfo*
+rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
{
struct addrinfo hints;
MEMZERO(&hints, struct addrinfo, 1);
- hints.ai_family = family;
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = socktype;
hints.ai_flags = flags;
return rsock_getaddrinfo(host, port, &hints, 1);
@@ -632,7 +474,7 @@ rsock_unix_sockaddr_len(VALUE path)
struct hostent_arg {
VALUE host;
- struct rb_addrinfo* addr;
+ struct addrinfo* addr;
VALUE (*ipaddr)(struct sockaddr*, socklen_t);
};
@@ -640,7 +482,7 @@ static VALUE
make_hostent_internal(struct hostent_arg *arg)
{
VALUE host = arg->host;
- struct addrinfo* addr = arg->addr->ai;
+ struct addrinfo* addr = arg->addr;
VALUE (*ipaddr)(struct sockaddr*, socklen_t) = arg->ipaddr;
struct addrinfo *ai;
@@ -659,8 +501,7 @@ make_hostent_internal(struct hostent_arg *arg)
}
rb_ary_push(ary, rb_str_new2(hostp));
- if (addr->ai_canonname && strlen(addr->ai_canonname) < NI_MAXHOST &&
- (h = gethostbyname(addr->ai_canonname))) {
+ if (addr->ai_canonname && (h = gethostbyname(addr->ai_canonname))) {
names = rb_ary_new();
if (h->h_aliases != NULL) {
for (pch = h->h_aliases; *pch; pch++) {
@@ -681,15 +522,14 @@ make_hostent_internal(struct hostent_arg *arg)
}
VALUE
-rsock_freeaddrinfo(VALUE arg)
+rsock_freeaddrinfo(struct addrinfo *addr)
{
- struct rb_addrinfo *addr = (struct rb_addrinfo *)arg;
- rb_freeaddrinfo(addr);
+ freeaddrinfo(addr);
return Qnil;
}
VALUE
-rsock_make_hostent(VALUE host, struct rb_addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t))
+rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t))
{
struct hostent_arg arg;
@@ -725,7 +565,7 @@ addrinfo_mark(void *ptr)
static size_t
addrinfo_memsize(const void *ptr)
{
- return sizeof(rb_addrinfo_t);
+ return ptr ? sizeof(rb_addrinfo_t) : 0;
}
static const rb_data_type_t addrinfo_type = {
@@ -759,9 +599,10 @@ get_addrinfo(VALUE self)
static rb_addrinfo_t *
-alloc_addrinfo(void)
+alloc_addrinfo()
{
- rb_addrinfo_t *rai = ZALLOC(rb_addrinfo_t);
+ rb_addrinfo_t *rai = ALLOC(rb_addrinfo_t);
+ memset(rai, 0, sizeof(rb_addrinfo_t));
rai->inspectname = Qnil;
rai->canonname = Qnil;
return rai;
@@ -798,13 +639,12 @@ rsock_addrinfo_new(struct sockaddr *addr, socklen_t len,
return a;
}
-static struct rb_addrinfo *
+static struct addrinfo *
call_getaddrinfo(VALUE node, VALUE service,
VALUE family, VALUE socktype, VALUE protocol, VALUE flags,
int socktype_hack)
{
- struct addrinfo hints;
- struct rb_addrinfo *res;
+ struct addrinfo hints, *res;
MEMZERO(&hints, struct addrinfo, 1);
hints.ai_family = NIL_P(family) ? PF_UNSPEC : rsock_family_arg(family);
@@ -832,21 +672,21 @@ init_addrinfo_getaddrinfo(rb_addrinfo_t *rai, VALUE node, VALUE service,
VALUE family, VALUE socktype, VALUE protocol, VALUE flags,
VALUE inspectnode, VALUE inspectservice)
{
- struct rb_addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 1);
+ struct addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 1);
VALUE canonname;
- VALUE inspectname = rb_str_equal(node, inspectnode) ? Qnil : make_inspectname(inspectnode, inspectservice, res->ai);
+ VALUE inspectname = rb_str_equal(node, inspectnode) ? Qnil : make_inspectname(inspectnode, inspectservice, res);
canonname = Qnil;
- if (res->ai->ai_canonname) {
- canonname = rb_tainted_str_new_cstr(res->ai->ai_canonname);
+ if (res->ai_canonname) {
+ canonname = rb_tainted_str_new_cstr(res->ai_canonname);
OBJ_FREEZE(canonname);
}
- init_addrinfo(rai, res->ai->ai_addr, res->ai->ai_addrlen,
+ init_addrinfo(rai, res->ai_addr, res->ai_addrlen,
NUM2INT(family), NUM2INT(socktype), NUM2INT(protocol),
canonname, inspectname);
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
}
static VALUE
@@ -902,22 +742,21 @@ addrinfo_firstonly_new(VALUE node, VALUE service, VALUE family, VALUE socktype,
VALUE canonname;
VALUE inspectname;
- struct rb_addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
+ struct addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
- inspectname = make_inspectname(node, service, res->ai);
+ inspectname = make_inspectname(node, service, res);
canonname = Qnil;
- if (res->ai->ai_canonname) {
- canonname = rb_tainted_str_new_cstr(res->ai->ai_canonname);
+ if (res->ai_canonname) {
+ canonname = rb_tainted_str_new_cstr(res->ai_canonname);
OBJ_FREEZE(canonname);
}
- ret = rsock_addrinfo_new(res->ai->ai_addr, res->ai->ai_addrlen,
- res->ai->ai_family, res->ai->ai_socktype,
- res->ai->ai_protocol,
+ ret = rsock_addrinfo_new(res->ai_addr, res->ai_addrlen,
+ res->ai_family, res->ai_socktype, res->ai_protocol,
canonname, inspectname);
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
return ret;
}
@@ -928,12 +767,12 @@ addrinfo_list_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE
struct addrinfo *r;
VALUE inspectname;
- struct rb_addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
+ struct addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
- inspectname = make_inspectname(node, service, res->ai);
+ inspectname = make_inspectname(node, service, res);
ret = rb_ary_new();
- for (r = res->ai; r; r = r->ai_next) {
+ for (r = res; r; r = r->ai_next) {
VALUE addr;
VALUE canonname = Qnil;
@@ -949,7 +788,7 @@ addrinfo_list_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE
rb_ary_push(ret, addr);
}
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
return ret;
}
@@ -1252,7 +1091,7 @@ rsock_inspect_sockaddr(struct sockaddr *sockaddr_arg, socklen_t socklen, VALUE r
}
#endif
-#if defined(AF_PACKET) && defined(__linux__)
+#ifdef AF_PACKET
/* GNU/Linux */
case AF_PACKET:
{
@@ -1674,7 +1513,7 @@ addrinfo_mload(VALUE self, VALUE ary)
default:
{
VALUE pair = rb_convert_type(v, T_ARRAY, "Array", "to_ary");
- struct rb_addrinfo *res;
+ struct addrinfo *res;
int flags = AI_NUMERICHOST;
#ifdef AI_NUMERICSERV
flags |= AI_NUMERICSERV;
@@ -1683,9 +1522,8 @@ addrinfo_mload(VALUE self, VALUE ary)
INT2NUM(pfamily), INT2NUM(socktype), INT2NUM(protocol),
INT2NUM(flags), 1);
- len = res->ai->ai_addrlen;
- memcpy(&ss, res->ai->ai_addr, res->ai->ai_addrlen);
- rb_freeaddrinfo(res);
+ len = res->ai_addrlen;
+ memcpy(&ss, res->ai_addr, res->ai_addrlen);
break;
}
}
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index 352da8c56e..97c02fc410 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -27,7 +27,11 @@
# undef HAVE_TYPE_STRUCT_SOCKADDR_DL
# endif
#else
-# include <sys/socket.h>
+# if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
+# include <net/socket.h>
+# else
+# include <sys/socket.h>
+# endif
# include <netinet/in.h>
# ifdef HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
@@ -35,9 +39,6 @@
# ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
# endif
-# ifdef HAVE_NETINET_TCP_FSM_H
-# include <netinet/tcp_fsm.h>
-# endif
# ifdef HAVE_NETINET_UDP_H
# include <netinet/udp.h>
# endif
@@ -76,9 +77,6 @@
#endif
#ifdef HAVE_IFADDRS_H
-# ifdef __HAIKU__
-# define _BSD_SOURCE
-# endif
# include <ifaddrs.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
@@ -218,20 +216,18 @@ typedef union {
# endif
#endif
+#ifdef __BEOS__
+# undef close
+# define close closesocket
+#endif
+
#define INET_CLIENT 0
#define INET_SERVER 1
#define INET_SOCKS 2
extern int rsock_do_not_reverse_lookup;
-extern int rsock_cmsg_cloexec_state;
#define FMODE_NOREVLOOKUP 0x100
-/* common socket families only */
-#define FMODE_UNIX 0x00200000
-#define FMODE_INET 0x00400000
-#define FMODE_INET6 0x00800000
-#define FMODE_SOCK (FMODE_UNIX|FMODE_INET|FMODE_INET6)
-
extern VALUE rb_cBasicSocket;
extern VALUE rb_cIPSocket;
extern VALUE rb_cTCPSocket;
@@ -259,6 +255,7 @@ int Rconnect();
#include "constdefs.h"
+#define BLOCKING_REGION(func, arg) (long)rb_thread_blocking_region((func), (arg), RUBY_UBF_IO, 0)
#define BLOCKING_REGION_FD(func, arg) (long)rb_thread_io_blocking_region((func), (arg), (arg)->fd)
#define SockAddrStringValue(v) rsock_sockaddr_string_value(&(v))
@@ -279,19 +276,12 @@ int rsock_optname_arg(int family, int level, VALUE optname);
int rsock_cmsg_type_arg(int family, int level, VALUE type);
int rsock_shutdown_how_arg(VALUE how);
-int rsock_getfamily(rb_io_t *fptr);
+int rsock_getfamily(int sockfd);
-struct rb_addrinfo {
- struct addrinfo *ai;
- int allocated_by_malloc;
-};
-int rb_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct rb_addrinfo **res);
-void rb_freeaddrinfo(struct rb_addrinfo *ai);
-VALUE rsock_freeaddrinfo(VALUE arg);
+int rb_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
int rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
-int rsock_fd_family(int fd);
-struct rb_addrinfo *rsock_addrinfo(VALUE host, VALUE port, int family, int socktype, int flags);
-struct rb_addrinfo *rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack);
+struct addrinfo *rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags);
+struct addrinfo *rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack);
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len);
VALUE rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len);
@@ -300,7 +290,7 @@ VALUE rsock_addrinfo_inspect_sockaddr(VALUE rai);
VALUE rsock_make_ipaddr(struct sockaddr *addr, socklen_t addrlen);
VALUE rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup);
-VALUE rsock_make_hostent(VALUE host, struct rb_addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t));
+VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t));
VALUE rsock_inspect_sockaddr(struct sockaddr *addr, socklen_t socklen, VALUE ret);
socklen_t rsock_sockaddr_len(struct sockaddr *addr);
VALUE rsock_sockaddr_obj(struct sockaddr *addr, socklen_t len);
@@ -314,7 +304,6 @@ socklen_t rsock_unix_sockaddr_len(VALUE path);
#endif
int rsock_socket(int domain, int type, int proto);
-int rsock_detect_cloexec(int fd);
VALUE rsock_init_sock(VALUE sock, int fd);
VALUE rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass);
VALUE rsock_init_inetsock(VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type);
@@ -338,34 +327,28 @@ enum sock_recv_type {
RECV_SOCKET /* Socket#recvfrom */
};
-VALUE rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str,
- VALUE ex, enum sock_recv_type from);
+VALUE rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from);
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from);
int rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks);
VALUE rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len);
-VALUE rsock_s_accept_nonblock(VALUE klass, VALUE ex, rb_io_t *fptr,
- struct sockaddr *sockaddr, socklen_t *len);
+VALUE rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len);
VALUE rsock_sock_listen(VALUE sock, VALUE log);
VALUE rsock_sockopt_new(int family, int level, int optname, VALUE data);
#if defined(HAVE_SENDMSG)
-VALUE rsock_bsock_sendmsg(VALUE sock, VALUE data, VALUE flags,
- VALUE dest_sockaddr, VALUE controls);
-VALUE rsock_bsock_sendmsg_nonblock(VALUE sock, VALUE data, VALUE flags,
- VALUE dest_sockaddr, VALUE controls, VALUE ex);
+VALUE rsock_bsock_sendmsg(int argc, VALUE *argv, VALUE sock);
+VALUE rsock_bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock);
#else
#define rsock_bsock_sendmsg rb_f_notimplement
#define rsock_bsock_sendmsg_nonblock rb_f_notimplement
#endif
#if defined(HAVE_RECVMSG)
-VALUE rsock_bsock_recvmsg(VALUE sock, VALUE dlen, VALUE clen, VALUE flags,
- VALUE scm_rights);
-VALUE rsock_bsock_recvmsg_nonblock(VALUE sock, VALUE dlen, VALUE clen,
- VALUE flags, VALUE scm_rights, VALUE ex);
+VALUE rsock_bsock_recvmsg(int argc, VALUE *argv, VALUE sock);
+VALUE rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock);
ssize_t rsock_recvmsg(int socket, struct msghdr *message, int flags);
#else
#define rsock_bsock_recvmsg rb_f_notimplement
@@ -391,51 +374,10 @@ void rsock_init_sockopt(void);
void rsock_init_sockifaddr(void);
void rsock_init_socket_init(void);
-NORETURN(void rsock_syserr_fail_host_port(int err, const char *, VALUE, VALUE));
-NORETURN(void rsock_syserr_fail_path(int err, const char *, VALUE));
-NORETURN(void rsock_syserr_fail_sockaddr(int err, const char *mesg, struct sockaddr *addr, socklen_t len));
-NORETURN(void rsock_syserr_fail_raddrinfo(int err, const char *mesg, VALUE rai));
-NORETURN(void rsock_syserr_fail_raddrinfo_or_sockaddr(int err, const char *mesg, VALUE addr, VALUE rai));
-
NORETURN(void rsock_sys_fail_host_port(const char *, VALUE, VALUE));
NORETURN(void rsock_sys_fail_path(const char *, VALUE));
NORETURN(void rsock_sys_fail_sockaddr(const char *, struct sockaddr *addr, socklen_t len));
NORETURN(void rsock_sys_fail_raddrinfo(const char *, VALUE rai));
NORETURN(void rsock_sys_fail_raddrinfo_or_sockaddr(const char *, VALUE addr, VALUE rai));
-/*
- * It is safe on Linux to attempt using a socket without waiting on it in
- * all cases. For some syscalls (e.g. accept/accept4), blocking on the
- * syscall instead of relying on select/poll allows the kernel to use
- * "wake-one" behavior and avoid the thundering herd problem.
- * This is likely safe on all other *nix-like systems, so this whitelist
- * can be expanded by interested parties.
- */
-#if defined(__linux__)
-static inline int rsock_maybe_fd_writable(int fd) { return 1; }
-static inline void rsock_maybe_wait_fd(int fd) { }
-# ifdef MSG_DONTWAIT
-# define MSG_DONTWAIT_RELIABLE 1
-# endif
-#else /* some systems (mswin/mingw) need these. ref: r36946 */
-# define rsock_maybe_fd_writable(fd) rb_thread_fd_writable((fd))
-# define rsock_maybe_wait_fd(fd) rb_thread_wait_fd((fd))
-#endif
-
-/*
- * some OSes may support MSG_DONTWAIT inconsistently depending on socket
- * type, we only expect Linux to support it consistently for all socket types.
- */
-#ifndef MSG_DONTWAIT_RELIABLE
-# define MSG_DONTWAIT_RELIABLE 0
-#endif
-
-#if !defined HAVE_INET_NTOP && ! defined _WIN32
-const char *inet_ntop(int, const void *, char *, size_t);
-#elif defined __MINGW32__
-# define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l)
-#elif defined _MSC_VER && RUBY_MSVCRT_VERSION < 90
-const char *WSAAPI inet_ntop(int, const void *, char *, size_t);
-#endif
-
#endif
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 542cd02ed6..5fd74652c6 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -10,98 +10,74 @@
#include "rubysocket.h"
-static VALUE sym_wait_writable;
-
static VALUE sock_s_unpack_sockaddr_in(VALUE, VALUE);
void
rsock_sys_fail_host_port(const char *mesg, VALUE host, VALUE port)
{
- rsock_syserr_fail_host_port(errno, mesg, host, port);
-}
-
-void
-rsock_syserr_fail_host_port(int err, const char *mesg, VALUE host, VALUE port)
-{
VALUE message;
- message = rb_sprintf("%s for %+"PRIsVALUE" port % "PRIsVALUE"",
- mesg, host, port);
+ port = rb_String(port);
- rb_syserr_fail_str(err, message);
-}
+ message = rb_sprintf("%s for \"%s\" port %s",
+ mesg, StringValueCStr(host), StringValueCStr(port));
-void
-rsock_sys_fail_path(const char *mesg, VALUE path)
-{
- rsock_syserr_fail_path(errno, mesg, path);
+ rb_sys_fail_str(message);
}
void
-rsock_syserr_fail_path(int err, const char *mesg, VALUE path)
+rsock_sys_fail_path(const char *mesg, VALUE path)
{
VALUE message;
-
if (RB_TYPE_P(path, T_STRING)) {
- message = rb_sprintf("%s for % "PRIsVALUE"", mesg, path);
- rb_syserr_fail_str(err, message);
+ if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) {
+ path = rb_str_inspect(path);
+ message = rb_sprintf("%s for %s", mesg,
+ StringValueCStr(path));
+ }
+ else {
+ message = rb_sprintf("%s for \"%s\"", mesg,
+ StringValueCStr(path));
+ }
+ rb_sys_fail_str(message);
}
else {
- rb_syserr_fail(err, mesg);
+ rb_sys_fail(mesg);
}
}
void
rsock_sys_fail_sockaddr(const char *mesg, struct sockaddr *addr, socklen_t len)
{
- rsock_syserr_fail_sockaddr(errno, mesg, addr, len);
-}
-
-void
-rsock_syserr_fail_sockaddr(int err, const char *mesg, struct sockaddr *addr, socklen_t len)
-{
VALUE rai;
rai = rsock_addrinfo_new(addr, len, PF_UNSPEC, 0, 0, Qnil, Qnil);
- rsock_syserr_fail_raddrinfo(err, mesg, rai);
+ rsock_sys_fail_raddrinfo(mesg, rai);
}
void
rsock_sys_fail_raddrinfo(const char *mesg, VALUE rai)
{
- rsock_syserr_fail_raddrinfo(errno, mesg, rai);
-}
-
-void
-rsock_syserr_fail_raddrinfo(int err, const char *mesg, VALUE rai)
-{
VALUE str, message;
str = rsock_addrinfo_inspect_sockaddr(rai);
- message = rb_sprintf("%s for %"PRIsVALUE"", mesg, str);
+ message = rb_sprintf("%s for %s", mesg, StringValueCStr(str));
- rb_syserr_fail_str(err, message);
+ rb_sys_fail_str(message);
}
void
rsock_sys_fail_raddrinfo_or_sockaddr(const char *mesg, VALUE addr, VALUE rai)
{
- rsock_syserr_fail_raddrinfo_or_sockaddr(errno, mesg, addr, rai);
-}
-
-void
-rsock_syserr_fail_raddrinfo_or_sockaddr(int err, const char *mesg, VALUE addr, VALUE rai)
-{
if (NIL_P(rai)) {
StringValue(addr);
-
- rsock_syserr_fail_sockaddr(err, mesg,
+ rsock_sys_fail_sockaddr(mesg,
(struct sockaddr *)RSTRING_PTR(addr),
(socklen_t)RSTRING_LEN(addr)); /* overflow should be checked already */
}
else
- rsock_syserr_fail_raddrinfo(err, mesg, rai);
+ rsock_sys_fail_raddrinfo(mesg, rai);
}
static void
@@ -140,6 +116,7 @@ sock_initialize(int argc, VALUE *argv, VALUE sock)
if (NIL_P(protocol))
protocol = INT2FIX(0);
+ rb_secure(3);
setup_domain_and_type(domain, &d, type, &t);
fd = rsock_socket(d, t, NUM2INT(protocol));
if (fd < 0) rb_sys_fail("socket(2)");
@@ -151,7 +128,7 @@ sock_initialize(int argc, VALUE *argv, VALUE sock)
static VALUE
io_call_close(VALUE io)
{
- return rb_funcallv(io, rb_intern("close"), 0, 0);
+ return rb_funcall(io, rb_intern("close"), 0, 0);
}
static VALUE
@@ -169,29 +146,16 @@ pair_yield(VALUE pair)
#if defined HAVE_SOCKETPAIR
-#ifdef SOCK_CLOEXEC
static int
rsock_socketpair0(int domain, int type, int protocol, int sv[2])
{
int ret;
- static int cloexec_state = -1; /* <0: unknown, 0: ignored, >0: working */
- if (cloexec_state > 0) { /* common path, if SOCK_CLOEXEC is defined */
- ret = socketpair(domain, type|SOCK_CLOEXEC, protocol, sv);
- if (ret == 0 && (sv[0] <= 2 || sv[1] <= 2)) {
- goto fix_cloexec; /* highly unlikely */
- }
- goto update_max_fd;
- }
- else if (cloexec_state < 0) { /* usually runs once only for detection */
+#ifdef SOCK_CLOEXEC
+ static int try_sock_cloexec = 1;
+ if (try_sock_cloexec) {
ret = socketpair(domain, type|SOCK_CLOEXEC, protocol, sv);
- if (ret == 0) {
- cloexec_state = rsock_detect_cloexec(sv[0]);
- if ((cloexec_state == 0) || (sv[0] <= 2 || sv[1] <= 2))
- goto fix_cloexec;
- goto update_max_fd;
- }
- else if (ret == -1 && errno == EINVAL) {
+ if (ret == -1 && errno == EINVAL) {
/* SOCK_CLOEXEC is available since Linux 2.6.27. Linux 2.6.18 fails with EINVAL */
ret = socketpair(domain, type, protocol, sv);
if (ret != -1) {
@@ -199,41 +163,26 @@ rsock_socketpair0(int domain, int type, int protocol, int sv[2])
* So disable SOCK_CLOEXEC only if socketpair() succeeds without SOCK_CLOEXEC.
* Ex. Socket.pair(:UNIX, 0xff) fails with EINVAL.
*/
- cloexec_state = 0;
+ try_sock_cloexec = 0;
}
}
}
- else { /* cloexec_state == 0 */
+ else {
ret = socketpair(domain, type, protocol, sv);
}
+#else
+ ret = socketpair(domain, type, protocol, sv);
+#endif
+
if (ret == -1) {
return -1;
}
-fix_cloexec:
- rb_maygvl_fd_fix_cloexec(sv[0]);
- rb_maygvl_fd_fix_cloexec(sv[1]);
-
-update_max_fd:
- rb_update_max_fd(sv[0]);
- rb_update_max_fd(sv[1]);
-
- return ret;
-}
-#else /* !SOCK_CLOEXEC */
-static int
-rsock_socketpair0(int domain, int type, int protocol, int sv[2])
-{
- int ret = socketpair(domain, type, protocol, sv);
-
- if (ret == -1)
- return -1;
-
rb_fd_fix_cloexec(sv[0]);
rb_fd_fix_cloexec(sv[1]);
+
return ret;
}
-#endif /* !SOCK_CLOEXEC */
static int
rsock_socketpair(int domain, int type, int protocol, int sv[2])
@@ -241,7 +190,8 @@ rsock_socketpair(int domain, int type, int protocol, int sv[2])
int ret;
ret = rsock_socketpair0(domain, type, protocol, sv);
- if (ret < 0 && rb_gc_for_fd(errno)) {
+ if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
+ rb_gc();
ret = rsock_socketpair0(domain, type, protocol, sv);
}
@@ -295,6 +245,8 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
if (ret < 0) {
rb_sys_fail("socketpair(2)");
}
+ rb_fd_fix_cloexec(sp[0]);
+ rb_fd_fix_cloexec(sp[1]);
s1 = rsock_init_sock(rb_obj_alloc(klass), sp[0]);
s2 = rsock_init_sock(rb_obj_alloc(klass), sp[1]);
@@ -319,14 +271,14 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
*
* === Example:
- * # Pull down Google's web page
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
- * socket.connect( sockaddr )
- * socket.write( "GET / HTTP/1.0\r\n\r\n" )
- * results = socket.read
+ * # Pull down Google's web page
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
+ * socket.connect( sockaddr )
+ * socket.write( "GET / HTTP/1.0\r\n\r\n" )
+ * results = socket.read
*
* === Unix-based Exceptions
* On unix-based systems the following system exceptions may be raised if
@@ -438,9 +390,50 @@ sock_connect(VALUE sock, VALUE addr)
return INT2FIX(n);
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * socket.connect_nonblock(remote_sockaddr) => 0
+ *
+ * Requests a connection to be made on the given +remote_sockaddr+ after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * Returns 0 if successful, otherwise an exception is raised.
+ *
+ * === Parameter
+ * * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
+ *
+ * === Example:
+ * # Pull down Google's web page
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
+ * sockaddr = Socket.sockaddr_in(80, 'www.google.com')
+ * begin # emulate blocking connect
+ * socket.connect_nonblock(sockaddr)
+ * rescue IO::WaitWritable
+ * IO.select(nil, [socket]) # wait 3-way handshake completion
+ * begin
+ * socket.connect_nonblock(sockaddr) # check connection failure
+ * rescue Errno::EISCONN
+ * end
+ * end
+ * socket.write("GET / HTTP/1.0\r\n\r\n")
+ * results = socket.read
+ *
+ * Refer to Socket#connect for the exceptions that may be thrown if the call
+ * to _connect_nonblock_ fails.
+ *
+ * Socket#connect_nonblock may raise any error corresponding to connect(2) failure,
+ * including Errno::EINPROGRESS.
+ *
+ * If the exception is Errno::EINPROGRESS,
+ * it is extended by IO::WaitWritable.
+ * So IO::WaitWritable can be used to rescue the exceptions for retrying connect_nonblock.
+ *
+ * === See
+ * * Socket#connect
+ */
static VALUE
-sock_connect_nonblock(VALUE sock, VALUE addr, VALUE ex)
+sock_connect_nonblock(VALUE sock, VALUE addr)
{
VALUE rai;
rb_io_t *fptr;
@@ -452,19 +445,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr, VALUE ex)
rb_io_set_nonblock(fptr);
n = connect(fptr->fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_SOCKLEN(addr));
if (n < 0) {
- int e = errno;
- if (e == EINPROGRESS) {
- if (ex == Qfalse) {
- return sym_wait_writable;
- }
- rb_readwrite_syserr_fail(RB_IO_WAIT_WRITABLE, e, "connect(2) would block");
- }
- if (e == EISCONN) {
- if (ex == Qfalse) {
- return INT2FIX(0);
- }
- }
- rsock_syserr_fail_raddrinfo_or_sockaddr(e, "connect(2)", addr, rai);
+ if (errno == EINPROGRESS)
+ rb_readwrite_sys_fail(RB_IO_WAIT_WRITABLE, "connect(2) would block");
+ rsock_sys_fail_raddrinfo_or_sockaddr("connect(2)", addr, rai);
}
return INT2FIX(n);
@@ -480,18 +463,18 @@ sock_connect_nonblock(VALUE sock, VALUE addr, VALUE ex)
* * +local_sockaddr+ - the +struct+ sockaddr contained in a string or an Addrinfo object
*
* === Example
- * require 'socket'
+ * require 'socket'
*
- * # use Addrinfo
- * socket = Socket.new(:INET, :STREAM, 0)
- * socket.bind(Addrinfo.tcp("127.0.0.1", 2222))
- * p socket.local_address #=> #<Addrinfo: 127.0.0.1:2222 TCP>
+ * # use Addrinfo
+ * socket = Socket.new(:INET, :STREAM, 0)
+ * socket.bind(Addrinfo.tcp("127.0.0.1", 2222))
+ * p socket.local_address #=> #<Addrinfo: 127.0.0.1:2222 TCP>
*
- * # use struct sockaddr
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
+ * # use struct sockaddr
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
+ * socket.bind( sockaddr )
*
* === Unix-based Exceptions
* On unix-based based systems the following system exceptions may be raised if
@@ -582,18 +565,18 @@ sock_bind(VALUE sock, VALUE addr)
* * +backlog+ - the maximum length of the queue for pending connections.
*
* === Example 1
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
+ * socket.bind( sockaddr )
+ * socket.listen( 5 )
*
* === Example 2 (listening on an arbitrary port, unix-based systems only):
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * socket.listen( 1 )
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * socket.listen( 1 )
*
* === Unix-based Exceptions
* On unix based systems the above will work because a new +sockaddr+ struct
@@ -669,27 +652,27 @@ rsock_sock_listen(VALUE sock, VALUE log)
* * +flags+ - zero or more of the +MSG_+ options
*
* === Example
- * # In one file, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
- * client, client_addrinfo = socket.accept
- * data = client.recvfrom( 20 )[0].chomp
- * puts "I only received 20 bytes '#{data}'"
- * sleep 1
- * socket.close
- *
- * # In another file, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.connect( sockaddr )
- * socket.puts "Watch this get cut short!"
- * socket.close
+ * # In one file, start this first
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
+ * socket.bind( sockaddr )
+ * socket.listen( 5 )
+ * client, client_addrinfo = socket.accept
+ * data = client.recvfrom( 20 )[0].chomp
+ * puts "I only received 20 bytes '#{data}'"
+ * sleep 1
+ * socket.close
+ *
+ * # In another file, start this second
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
+ * socket.connect( sockaddr )
+ * socket.puts "Watch this get cut short!"
+ * socket.close
*
* === Unix-based Exceptions
* On unix-based based systems the following system exceptions may be raised if the
@@ -765,11 +748,72 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
return rsock_s_recvfrom(sock, argc, argv, RECV_SOCKET);
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * socket.recvfrom_nonblock(maxlen) => [mesg, sender_addrinfo]
+ * socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_addrinfo]
+ *
+ * Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * _flags_ is zero or more of the +MSG_+ options.
+ * The first element of the results, _mesg_, is the data received.
+ * The second element, _sender_addrinfo_, contains protocol-specific address
+ * information of the sender.
+ *
+ * When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns
+ * an empty string as data.
+ * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
+ *
+ * === Parameters
+ * * +maxlen+ - the maximum number of bytes to receive from the socket
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
+ * === Example
+ * # In one file, start this first
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
+ * sockaddr = Socket.sockaddr_in(2200, 'localhost')
+ * socket.bind(sockaddr)
+ * socket.listen(5)
+ * client, client_addrinfo = socket.accept
+ * begin # emulate blocking recvfrom
+ * pair = client.recvfrom_nonblock(20)
+ * rescue IO::WaitReadable
+ * IO.select([client])
+ * retry
+ * end
+ * data = pair[0].chomp
+ * puts "I only received 20 bytes '#{data}'"
+ * sleep 1
+ * socket.close
+ *
+ * # In another file, start this second
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
+ * sockaddr = Socket.sockaddr_in(2200, 'localhost')
+ * socket.connect(sockaddr)
+ * socket.puts "Watch this get cut short!"
+ * socket.close
+ *
+ * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
+ * to _recvfrom_nonblock_ fails.
+ *
+ * Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
+ * including Errno::EWOULDBLOCK.
+ *
+ * If the exception is Errno::EWOULDBLOCK or Errno::AGAIN,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying recvfrom_nonblock.
+ *
+ * === See
+ * * Socket#recvfrom
+ */
static VALUE
-sock_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex)
+sock_recvfrom_nonblock(int argc, VALUE *argv, VALUE sock)
{
- return rsock_s_recvfrom_nonblock(sock, len, flg, str, ex, RECV_SOCKET);
+ return rsock_s_recvfrom_nonblock(sock, argc, argv, RECV_SOCKET);
}
/*
@@ -800,21 +844,67 @@ sock_accept(VALUE sock)
return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, &buf.addr, len));
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * socket.accept_nonblock => [client_socket, client_addrinfo]
+ *
+ * Accepts an incoming connection using accept(2) after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * It returns an array containing the accepted socket
+ * for the incoming connection, _client_socket_,
+ * and an Addrinfo, _client_addrinfo_.
+ *
+ * === Example
+ * # In one script, start this first
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
+ * sockaddr = Socket.sockaddr_in(2200, 'localhost')
+ * socket.bind(sockaddr)
+ * socket.listen(5)
+ * begin # emulate blocking accept
+ * client_socket, client_addrinfo = socket.accept_nonblock
+ * rescue IO::WaitReadable, Errno::EINTR
+ * IO.select([socket])
+ * retry
+ * end
+ * puts "The client said, '#{client_socket.readline.chomp}'"
+ * client_socket.puts "Hello from script one!"
+ * socket.close
+ *
+ * # In another script, start this second
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
+ * sockaddr = Socket.sockaddr_in(2200, 'localhost')
+ * socket.connect(sockaddr)
+ * socket.puts "Hello from script 2."
+ * puts "The server said, '#{socket.readline.chomp}'"
+ * socket.close
+ *
+ * Refer to Socket#accept for the exceptions that may be thrown if the call
+ * to _accept_nonblock_ fails.
+ *
+ * Socket#accept_nonblock may raise any error corresponding to accept(2) failure,
+ * including Errno::EWOULDBLOCK.
+ *
+ * If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
+ *
+ * === See
+ * * Socket#accept
+ */
static VALUE
-sock_accept_nonblock(VALUE sock, VALUE ex)
+sock_accept_nonblock(VALUE sock)
{
rb_io_t *fptr;
VALUE sock2;
union_sockaddr buf;
- struct sockaddr *addr = &buf.addr;
socklen_t len = (socklen_t)sizeof buf;
GetOpenFile(sock, fptr);
- sock2 = rsock_s_accept_nonblock(rb_cSocket, ex, fptr, addr, &len);
-
- if (SYMBOL_P(sock2)) /* :wait_readable */
- return sock2;
+ sock2 = rsock_s_accept_nonblock(rb_cSocket, fptr, &buf.addr, &len);
return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, &buf.addr, len));
}
@@ -827,28 +917,28 @@ sock_accept_nonblock(VALUE sock, VALUE ex)
* and an Addrinfo, _client_addrinfo_.
*
* === Example
- * # In one script, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
- * client_fd, client_addrinfo = socket.sysaccept
- * client_socket = Socket.for_fd( client_fd )
- * puts "The client said, '#{client_socket.readline.chomp}'"
- * client_socket.puts "Hello from script one!"
- * socket.close
- *
- * # In another script, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.connect( sockaddr )
- * socket.puts "Hello from script 2."
- * puts "The server said, '#{socket.readline.chomp}'"
- * socket.close
+ * # In one script, start this first
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
+ * socket.bind( sockaddr )
+ * socket.listen( 5 )
+ * client_fd, client_addrinfo = socket.sysaccept
+ * client_socket = Socket.for_fd( client_fd )
+ * puts "The client said, '#{client_socket.readline.chomp}'"
+ * client_socket.puts "Hello from script one!"
+ * socket.close
+ *
+ * # In another script, start this second
+ * require 'socket'
+ * include Socket::Constants
+ * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
+ * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
+ * socket.connect( sockaddr )
+ * socket.puts "Hello from script 2."
+ * puts "The server said, '#{socket.readline.chomp}'"
+ * socket.close
*
* Refer to Socket#accept for the exceptions that may be thrown if the call
* to _sysaccept_ fails.
@@ -885,35 +975,17 @@ sock_sysaccept(VALUE sock)
static VALUE
sock_gethostname(VALUE obj)
{
-#if defined(NI_MAXHOST)
-# define RUBY_MAX_HOST_NAME_LEN NI_MAXHOST
-#elif defined(HOST_NAME_MAX)
-# define RUBY_MAX_HOST_NAME_LEN HOST_NAME_MAX
-#else
-# define RUBY_MAX_HOST_NAME_LEN 1024
+#ifndef HOST_NAME_MAX
+# define HOST_NAME_MAX 1024
#endif
+ char buf[HOST_NAME_MAX+1];
- long len = RUBY_MAX_HOST_NAME_LEN;
- VALUE name;
-
- name = rb_str_new(0, len);
- while (gethostname(RSTRING_PTR(name), len) < 0) {
- int e = errno;
- switch (e) {
- case ENAMETOOLONG:
-#ifdef __linux__
- case EINVAL:
- /* glibc before version 2.1 uses EINVAL instead of ENAMETOOLONG */
-#endif
- break;
- default:
- rb_syserr_fail(e, "gethostname(3)");
- }
- rb_str_modify_expand(name, len);
- len += len;
- }
- rb_str_resize(name, strlen(RSTRING_PTR(name)));
- return name;
+ rb_secure(3);
+ if (gethostname(buf, (int)sizeof buf - 1) < 0)
+ rb_sys_fail("gethostname(3)");
+
+ buf[sizeof buf - 1] = '\0';
+ return rb_str_new2(buf);
}
#else
#ifdef HAVE_UNAME
@@ -925,6 +997,7 @@ sock_gethostname(VALUE obj)
{
struct utsname un;
+ rb_secure(3);
uname(&un);
return rb_str_new2(un.nodename);
}
@@ -934,7 +1007,7 @@ sock_gethostname(VALUE obj)
#endif
static VALUE
-make_addrinfo(struct rb_addrinfo *res0, int norevlookup)
+make_addrinfo(struct addrinfo *res0, int norevlookup)
{
VALUE base, ary;
struct addrinfo *res;
@@ -943,10 +1016,10 @@ make_addrinfo(struct rb_addrinfo *res0, int norevlookup)
rb_raise(rb_eSocket, "host not found");
}
base = rb_ary_new();
- for (res = res0->ai; res; res = res->ai_next) {
+ for (res = res0; res; res = res->ai_next) {
ary = rsock_ipaddr(res->ai_addr, res->ai_addrlen, norevlookup);
if (res->ai_canonname) {
- RARRAY_ASET(ary, 2, rb_str_new2(res->ai_canonname));
+ RARRAY_PTR(ary)[2] = rb_str_new2(res->ai_canonname);
}
rb_ary_push(ary, INT2FIX(res->ai_family));
rb_ary_push(ary, INT2FIX(res->ai_socktype));
@@ -991,9 +1064,8 @@ sock_sockaddr(struct sockaddr *addr, socklen_t len)
static VALUE
sock_s_gethostbyname(VALUE obj, VALUE host)
{
- struct rb_addrinfo *res =
- rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, AI_CANONNAME);
- return rsock_make_hostent(host, res, sock_sockaddr);
+ rb_secure(3);
+ return rsock_make_hostent(host, rsock_addrinfo(host, Qnil, SOCK_STREAM, AI_CANONNAME), sock_sockaddr);
}
/*
@@ -1137,7 +1209,7 @@ sock_s_getservbyport(int argc, VALUE *argv)
*
* Obtains address information for _nodename_:_servname_.
*
- * _family_ should be an address family such as: :INET, :INET6, etc.
+ * _family_ should be an address family such as: :INET, :INET6, :UNIX, etc.
*
* _socktype_ should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
*
@@ -1167,8 +1239,7 @@ static VALUE
sock_s_getaddrinfo(int argc, VALUE *argv)
{
VALUE host, port, family, socktype, protocol, flags, ret, revlookup;
- struct addrinfo hints;
- struct rb_addrinfo *res;
+ struct addrinfo hints, *res;
int norevlookup;
rb_scan_args(argc, argv, "25", &host, &port, &family, &socktype, &protocol, &flags, &revlookup);
@@ -1191,7 +1262,7 @@ sock_s_getaddrinfo(int argc, VALUE *argv)
res = rsock_getaddrinfo(host, port, &hints, 0);
ret = make_addrinfo(res, norevlookup);
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
return ret;
}
@@ -1224,9 +1295,8 @@ sock_s_getnameinfo(int argc, VALUE *argv)
char *hptr, *pptr;
char hbuf[1024], pbuf[1024];
int fl;
- struct rb_addrinfo *res = NULL;
- struct addrinfo hints, *r;
- int error, saved_errno;
+ struct addrinfo hints, *res = NULL, *r;
+ int error;
union_sockaddr ss;
struct sockaddr *sap;
socklen_t salen;
@@ -1257,16 +1327,16 @@ sock_s_getnameinfo(int argc, VALUE *argv)
sa = tmp;
MEMZERO(&hints, struct addrinfo, 1);
if (RARRAY_LEN(sa) == 3) {
- af = RARRAY_AREF(sa, 0);
- port = RARRAY_AREF(sa, 1);
- host = RARRAY_AREF(sa, 2);
+ af = RARRAY_PTR(sa)[0];
+ port = RARRAY_PTR(sa)[1];
+ host = RARRAY_PTR(sa)[2];
}
else if (RARRAY_LEN(sa) >= 4) {
- af = RARRAY_AREF(sa, 0);
- port = RARRAY_AREF(sa, 1);
- host = RARRAY_AREF(sa, 3);
+ af = RARRAY_PTR(sa)[0];
+ port = RARRAY_PTR(sa)[1];
+ host = RARRAY_PTR(sa)[3];
if (NIL_P(host)) {
- host = RARRAY_AREF(sa, 2);
+ host = RARRAY_PTR(sa)[2];
}
else {
/*
@@ -1310,8 +1380,8 @@ sock_s_getnameinfo(int argc, VALUE *argv)
hints.ai_family = NIL_P(af) ? PF_UNSPEC : rsock_family_arg(af);
error = rb_getaddrinfo(hptr, pptr, &hints, &res);
if (error) goto error_exit_addr;
- sap = res->ai->ai_addr;
- salen = res->ai->ai_addrlen;
+ sap = res->ai_addr;
+ salen = res->ai_addrlen;
}
else {
rb_raise(rb_eTypeError, "expecting String or Array");
@@ -1322,7 +1392,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
pbuf, sizeof(pbuf), fl);
if (error) goto error_exit_name;
if (res) {
- for (r = res->ai->ai_next; r; r = r->ai_next) {
+ for (r = res->ai_next; r; r = r->ai_next) {
char hbuf2[1024], pbuf2[1024];
sap = r->ai_addr;
@@ -1331,24 +1401,20 @@ sock_s_getnameinfo(int argc, VALUE *argv)
pbuf2, sizeof(pbuf2), fl);
if (error) goto error_exit_name;
if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) {
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename");
}
}
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
}
return rb_assoc_new(rb_str_new2(hbuf), rb_str_new2(pbuf));
error_exit_addr:
- saved_errno = errno;
- if (res) rb_freeaddrinfo(res);
- errno = saved_errno;
+ if (res) freeaddrinfo(res);
rsock_raise_socket_error("getaddrinfo", error);
error_exit_name:
- saved_errno = errno;
- if (res) rb_freeaddrinfo(res);
- errno = saved_errno;
+ if (res) freeaddrinfo(res);
rsock_raise_socket_error("getnameinfo", error);
UNREACHABLE;
@@ -1371,10 +1437,10 @@ sock_s_getnameinfo(int argc, VALUE *argv)
static VALUE
sock_s_pack_sockaddr_in(VALUE self, VALUE port, VALUE host)
{
- struct rb_addrinfo *res = rsock_addrinfo(host, port, AF_UNSPEC, 0, 0);
- VALUE addr = rb_str_new((char*)res->ai->ai_addr, res->ai->ai_addrlen);
+ struct addrinfo *res = rsock_addrinfo(host, port, 0, 0);
+ VALUE addr = rb_str_new((char*)res->ai_addr, res->ai_addrlen);
- rb_freeaddrinfo(res);
+ freeaddrinfo(res);
OBJ_INFECT(addr, port);
OBJ_INFECT(addr, host);
@@ -1642,7 +1708,7 @@ socket_s_ip_address_list(VALUE self)
int ret;
struct lifnum ln;
struct lifconf lc;
- const char *reason = NULL;
+ char *reason = NULL;
int save_errno;
int i;
VALUE list = Qnil;
@@ -1703,7 +1769,7 @@ socket_s_ip_address_list(VALUE self)
errno = save_errno;
if (reason)
- rb_syserr_fail(save_errno, reason);
+ rb_sys_fail(reason);
return list;
#elif defined(SIOCGIFCONF)
@@ -1788,7 +1854,7 @@ socket_s_ip_address_list(VALUE self)
errno = save_errno;
if (reason)
- rb_syserr_fail(save_errno, reason);
+ rb_sys_fail(reason);
return list;
#undef EXTRA_SPACE
@@ -1900,7 +1966,7 @@ socket_s_ip_address_list(VALUE self)
#endif
void
-Init_socket(void)
+Init_socket()
{
rsock_init_basicsocket();
@@ -1918,7 +1984,7 @@ Init_socket(void)
*
* === What's a socket?
*
- * Sockets are endpoints of a bidirectional communication channel.
+ * Sockets are endpoints of a bidirectionnal communication channel.
* Sockets can communicate within a process, between processes on the same
* machine or between different machines. There are many types of socket:
* TCPSocket, UDPSocket or UNIXSocket for example.
@@ -1943,7 +2009,7 @@ Init_socket(void)
*
* *hostname:*
* The identifier of a network interface:
- * * a string (hostname, IPv4 or IPv6 address or +broadcast+
+ * * a string (hostname, IPv4 or IPv6 adress or +broadcast+
* which specifies a broadcast address)
* * a zero-length string which specifies INADDR_ANY
* * an integer (interpreted as binary address in host byte order).
@@ -2025,26 +2091,15 @@ Init_socket(void)
rb_define_method(rb_cSocket, "initialize", sock_initialize, -1);
rb_define_method(rb_cSocket, "connect", sock_connect, 1);
-
- /* for ext/socket/lib/socket.rb use only: */
- rb_define_private_method(rb_cSocket,
- "__connect_nonblock", sock_connect_nonblock, 2);
-
+ rb_define_method(rb_cSocket, "connect_nonblock", sock_connect_nonblock, 1);
rb_define_method(rb_cSocket, "bind", sock_bind, 1);
rb_define_method(rb_cSocket, "listen", rsock_sock_listen, 1);
rb_define_method(rb_cSocket, "accept", sock_accept, 0);
-
- /* for ext/socket/lib/socket.rb use only: */
- rb_define_private_method(rb_cSocket,
- "__accept_nonblock", sock_accept_nonblock, 1);
-
+ rb_define_method(rb_cSocket, "accept_nonblock", sock_accept_nonblock, 0);
rb_define_method(rb_cSocket, "sysaccept", sock_sysaccept, 0);
rb_define_method(rb_cSocket, "recvfrom", sock_recvfrom, -1);
-
- /* for ext/socket/lib/socket.rb use only: */
- rb_define_private_method(rb_cSocket,
- "__recvfrom_nonblock", sock_recvfrom_nonblock, 4);
+ rb_define_method(rb_cSocket, "recvfrom_nonblock", sock_recvfrom_nonblock, -1);
rb_define_singleton_method(rb_cSocket, "socketpair", rsock_sock_s_socketpair, -1);
rb_define_singleton_method(rb_cSocket, "pair", rsock_sock_s_socketpair, -1);
@@ -2065,7 +2120,4 @@ Init_socket(void)
#endif
rb_define_singleton_method(rb_cSocket, "ip_address_list", socket_s_ip_address_list, 0);
-
-#undef rb_intern
- sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
}
diff --git a/ext/socket/sockport.h b/ext/socket/sockport.h
index 2b58958ae7..a3c698e8a4 100644
--- a/ext/socket/sockport.h
+++ b/ext/socket/sockport.h
@@ -29,12 +29,6 @@
# define SET_SIN_LEN(sa, len) SET_SA_LEN((struct sockaddr *)(sa), (len))
#endif
-#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
-# define SET_SIN6_LEN(sa, len) (void)((sa)->sin6_len = (len))
-#else
-# define SET_SIN6_LEN(sa, len) SET_SA_LEN((struct sockaddr *)(sa), (len))
-#endif
-
#define INIT_SOCKADDR(addr, family, len) \
do { \
struct sockaddr *init_sockaddr_ptr = (addr); \
@@ -53,15 +47,6 @@
SET_SIN_LEN(init_sockaddr_ptr, init_sockaddr_len); \
} while (0)
-#define INIT_SOCKADDR_IN6(addr, len) \
- do { \
- struct sockaddr_in6 *init_sockaddr_ptr = (addr); \
- socklen_t init_sockaddr_len = (len); \
- memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
- init_sockaddr_ptr->sin6_family = AF_INET6; \
- SET_SIN6_LEN(init_sockaddr_ptr, init_sockaddr_len); \
- } while (0)
-
/* for strict-aliasing rule */
#ifdef HAVE_TYPE_STRUCT_SOCKADDR_UN
diff --git a/ext/socket/sockssocket.c b/ext/socket/sockssocket.c
index 81f77a67c5..48be4fcf99 100644
--- a/ext/socket/sockssocket.c
+++ b/ext/socket/sockssocket.c
@@ -41,6 +41,9 @@ socks_s_close(VALUE sock)
{
rb_io_t *fptr;
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't close socket");
+ }
GetOpenFile(sock, fptr);
shutdown(fptr->fd, 2);
return rb_io_close(sock);
diff --git a/ext/socket/tcpserver.c b/ext/socket/tcpserver.c
index 1bbb31adcf..2245a0600d 100644
--- a/ext/socket/tcpserver.c
+++ b/ext/socket/tcpserver.c
@@ -64,16 +64,49 @@ tcp_accept(VALUE sock)
return rsock_s_accept(rb_cTCPSocket, fptr->fd, &from.addr, &fromlen);
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * tcpserver.accept_nonblock => tcpsocket
+ *
+ * Accepts an incoming connection using accept(2) after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * It returns an accepted TCPSocket for the incoming connection.
+ *
+ * === Example
+ * require 'socket'
+ * serv = TCPServer.new(2202)
+ * begin # emulate blocking accept
+ * sock = serv.accept_nonblock
+ * rescue IO::WaitReadable, Errno::EINTR
+ * IO.select([serv])
+ * retry
+ * end
+ * # sock is an accepted socket.
+ *
+ * Refer to Socket#accept for the exceptions that may be thrown if the call
+ * to TCPServer#accept_nonblock fails.
+ *
+ * TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure,
+ * including Errno::EWOULDBLOCK.
+ *
+ * If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED, Errno::EPROTO,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
+ *
+ * === See
+ * * TCPServer#accept
+ * * Socket#accept
+ */
static VALUE
-tcp_accept_nonblock(VALUE sock, VALUE ex)
+tcp_accept_nonblock(VALUE sock)
{
rb_io_t *fptr;
union_sockaddr from;
- socklen_t len = (socklen_t)sizeof(from);
+ socklen_t fromlen;
GetOpenFile(sock, fptr);
- return rsock_s_accept_nonblock(rb_cTCPSocket, ex, fptr, &from.addr, &len);
+ fromlen = (socklen_t)sizeof(from);
+ return rsock_s_accept_nonblock(rb_cTCPSocket, fptr, &from.addr, &fromlen);
}
/*
@@ -138,8 +171,7 @@ rsock_init_tcpserver(void)
*/
rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket);
rb_define_method(rb_cTCPServer, "accept", tcp_accept, 0);
- rb_define_private_method(rb_cTCPServer,
- "__accept_nonblock", tcp_accept_nonblock, 1);
+ rb_define_method(rb_cTCPServer, "accept_nonblock", tcp_accept_nonblock, 0);
rb_define_method(rb_cTCPServer, "sysaccept", tcp_sysaccept, 0);
rb_define_method(rb_cTCPServer, "initialize", tcp_svr_init, -1);
rb_define_method(rb_cTCPServer, "listen", rsock_sock_listen, 1); /* in socket.c */
diff --git a/ext/socket/tcpsocket.c b/ext/socket/tcpsocket.c
index a7a82fd880..6217e424d9 100644
--- a/ext/socket/tcpsocket.c
+++ b/ext/socket/tcpsocket.c
@@ -50,9 +50,9 @@ tcp_sockaddr(struct sockaddr *addr, socklen_t len)
static VALUE
tcp_s_gethostbyname(VALUE obj, VALUE host)
{
- struct rb_addrinfo *res =
- rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, AI_CANONNAME);
- return rsock_make_hostent(host, res, tcp_sockaddr);
+ rb_secure(3);
+ return rsock_make_hostent(host, rsock_addrinfo(host, Qnil, SOCK_STREAM, AI_CANONNAME),
+ tcp_sockaddr);
}
void
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index 7b7b34f04d..a89c453239 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -30,6 +30,7 @@ udp_init(int argc, VALUE *argv, VALUE sock)
int family = AF_INET;
int fd;
+ rb_secure(3);
if (rb_scan_args(argc, argv, "01", &arg) == 1) {
family = rsock_family_arg(arg);
}
@@ -43,20 +44,17 @@ udp_init(int argc, VALUE *argv, VALUE sock)
struct udp_arg
{
- struct rb_addrinfo *res;
- rb_io_t *fptr;
+ struct addrinfo *res;
+ int fd;
};
static VALUE
udp_connect_internal(struct udp_arg *arg)
{
- rb_io_t *fptr;
- int fd;
+ int fd = arg->fd;
struct addrinfo *res;
- rb_io_check_closed(fptr = arg->fptr);
- fd = fptr->fd;
- for (res = arg->res->ai; res; res = res->ai_next) {
+ for (res = arg->res; res; res = res->ai_next) {
if (rsock_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
return Qtrue;
}
@@ -64,6 +62,8 @@ udp_connect_internal(struct udp_arg *arg)
return Qfalse;
}
+VALUE rsock_freeaddrinfo(struct addrinfo *addr);
+
/*
* call-seq:
* udpsocket.connect(host, port) => 0
@@ -83,35 +83,20 @@ udp_connect_internal(struct udp_arg *arg)
static VALUE
udp_connect(VALUE sock, VALUE host, VALUE port)
{
+ rb_io_t *fptr;
struct udp_arg arg;
VALUE ret;
- GetOpenFile(sock, arg.fptr);
- arg.res = rsock_addrinfo(host, port, rsock_fd_family(arg.fptr->fd), SOCK_DGRAM, 0);
+ rb_secure(3);
+ arg.res = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
+ GetOpenFile(sock, fptr);
+ arg.fd = fptr->fd;
ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
rsock_freeaddrinfo, (VALUE)arg.res);
if (!ret) rsock_sys_fail_host_port("connect(2)", host, port);
return INT2FIX(0);
}
-static VALUE
-udp_bind_internal(struct udp_arg *arg)
-{
- rb_io_t *fptr;
- int fd;
- struct addrinfo *res;
-
- rb_io_check_closed(fptr = arg->fptr);
- fd = fptr->fd;
- for (res = arg->res->ai; res; res = res->ai_next) {
- if (bind(fd, res->ai_addr, res->ai_addrlen) < 0) {
- continue;
- }
- return Qtrue;
- }
- return Qfalse;
-}
-
/*
* call-seq:
* udpsocket.bind(host, port) #=> 0
@@ -127,46 +112,24 @@ udp_bind_internal(struct udp_arg *arg)
static VALUE
udp_bind(VALUE sock, VALUE host, VALUE port)
{
- struct udp_arg arg;
- VALUE ret;
-
- GetOpenFile(sock, arg.fptr);
- arg.res = rsock_addrinfo(host, port, rsock_fd_family(arg.fptr->fd), SOCK_DGRAM, 0);
- ret = rb_ensure(udp_bind_internal, (VALUE)&arg,
- rsock_freeaddrinfo, (VALUE)arg.res);
- if (!ret) rsock_sys_fail_host_port("bind(2)", host, port);
- return INT2FIX(0);
-}
-
-struct udp_send_arg {
- struct rb_addrinfo *res;
rb_io_t *fptr;
- struct rsock_send_arg sarg;
-};
+ struct addrinfo *res0, *res;
-static VALUE
-udp_send_internal(struct udp_send_arg *arg)
-{
- rb_io_t *fptr;
- int n;
- struct addrinfo *res;
-
- rb_io_check_closed(fptr = arg->fptr);
- for (res = arg->res->ai; res; res = res->ai_next) {
- retry:
- arg->sarg.fd = fptr->fd;
- arg->sarg.to = res->ai_addr;
- arg->sarg.tolen = res->ai_addrlen;
- rsock_maybe_fd_writable(arg->sarg.fd);
- n = (int)BLOCKING_REGION_FD(rsock_sendto_blocking, &arg->sarg);
- if (n >= 0) {
- return INT2FIX(n);
- }
- if (rb_io_wait_writable(fptr->fd)) {
- goto retry;
+ rb_secure(3);
+ res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
+ GetOpenFile(sock, fptr);
+ for (res = res0; res; res = res->ai_next) {
+ if (bind(fptr->fd, res->ai_addr, res->ai_addrlen) < 0) {
+ continue;
}
+ freeaddrinfo(res0);
+ return INT2FIX(0);
}
- return Qfalse;
+ freeaddrinfo(res0);
+
+ rsock_sys_fail_host_port("bind(2)", host, port);
+
+ return INT2FIX(0);
}
/*
@@ -195,30 +158,93 @@ static VALUE
udp_send(int argc, VALUE *argv, VALUE sock)
{
VALUE flags, host, port;
- struct udp_send_arg arg;
- VALUE ret;
+ rb_io_t *fptr;
+ int n;
+ struct addrinfo *res0, *res;
+ struct rsock_send_arg arg;
if (argc == 2 || argc == 3) {
return rsock_bsock_send(argc, argv, sock);
}
- rb_scan_args(argc, argv, "4", &arg.sarg.mesg, &flags, &host, &port);
-
- StringValue(arg.sarg.mesg);
- GetOpenFile(sock, arg.fptr);
- arg.sarg.fd = arg.fptr->fd;
- arg.sarg.flags = NUM2INT(flags);
- arg.res = rsock_addrinfo(host, port, rsock_fd_family(arg.fptr->fd), SOCK_DGRAM, 0);
- ret = rb_ensure(udp_send_internal, (VALUE)&arg,
- rsock_freeaddrinfo, (VALUE)arg.res);
- if (!ret) rsock_sys_fail_host_port("sendto(2)", host, port);
- return ret;
+ rb_scan_args(argc, argv, "4", &arg.mesg, &flags, &host, &port);
+
+ StringValue(arg.mesg);
+ res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
+ GetOpenFile(sock, fptr);
+ arg.fd = fptr->fd;
+ arg.flags = NUM2INT(flags);
+ for (res = res0; res; res = res->ai_next) {
+ retry:
+ arg.to = res->ai_addr;
+ arg.tolen = res->ai_addrlen;
+ rb_thread_fd_writable(arg.fd);
+ n = (int)BLOCKING_REGION_FD(rsock_sendto_blocking, &arg);
+ if (n >= 0) {
+ freeaddrinfo(res0);
+ return INT2FIX(n);
+ }
+ if (rb_io_wait_writable(fptr->fd)) {
+ goto retry;
+ }
+ }
+ freeaddrinfo(res0);
+ rsock_sys_fail_host_port("sendto(2)", host, port);
+ return INT2FIX(n);
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
+ * udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
+ *
+ * Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * If _maxlen_ is omitted, its default value is 65536.
+ * _flags_ is zero or more of the +MSG_+ options.
+ * The first element of the results, _mesg_, is the data received.
+ * The second element, _sender_inet_addr_, is an array to represent the sender address.
+ *
+ * When recvfrom(2) returns 0,
+ * Socket#recvfrom_nonblock returns an empty string as data.
+ * It means an empty packet.
+ *
+ * === Parameters
+ * * +maxlen+ - the number of bytes to receive from the socket
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
+ * === Example
+ * require 'socket'
+ * s1 = UDPSocket.new
+ * s1.bind("127.0.0.1", 0)
+ * s2 = UDPSocket.new
+ * s2.bind("127.0.0.1", 0)
+ * s2.connect(*s1.addr.values_at(3,1))
+ * s1.connect(*s2.addr.values_at(3,1))
+ * s1.send "aaa", 0
+ * begin # emulate blocking recvfrom
+ * p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
+ * rescue IO::WaitReadable
+ * IO.select([s2])
+ * retry
+ * end
+ *
+ * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
+ * to _recvfrom_nonblock_ fails.
+ *
+ * UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
+ * including Errno::EWOULDBLOCK.
+ *
+ * If the exception is Errno::EWOULDBLOCK or Errno::AGAIN,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying recvfrom_nonblock.
+ *
+ * === See
+ * * Socket#recvfrom
+ */
static VALUE
-udp_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex)
+udp_recvfrom_nonblock(int argc, VALUE *argv, VALUE sock)
{
- return rsock_s_recvfrom_nonblock(sock, len, flg, str, ex, RECV_IP);
+ return rsock_s_recvfrom_nonblock(sock, argc, argv, RECV_IP);
}
void
@@ -235,8 +261,6 @@ rsock_init_udpsocket(void)
rb_define_method(rb_cUDPSocket, "connect", udp_connect, 2);
rb_define_method(rb_cUDPSocket, "bind", udp_bind, 2);
rb_define_method(rb_cUDPSocket, "send", udp_send, -1);
-
- /* for ext/socket/lib/socket.rb use only: */
- rb_define_private_method(rb_cUDPSocket,
- "__recvfrom_nonblock", udp_recvfrom_nonblock, 4);
+ rb_define_method(rb_cUDPSocket, "recvfrom_nonblock", udp_recvfrom_nonblock, -1);
}
+
diff --git a/ext/socket/unixserver.c b/ext/socket/unixserver.c
index 799dcffb00..df9849703b 100644
--- a/ext/socket/unixserver.c
+++ b/ext/socket/unixserver.c
@@ -57,9 +57,41 @@ unix_accept(VALUE sock)
(struct sockaddr*)&from, &fromlen);
}
-/* :nodoc: */
+/*
+ * call-seq:
+ * unixserver.accept_nonblock => unixsocket
+ *
+ * Accepts an incoming connection using accept(2) after
+ * O_NONBLOCK is set for the underlying file descriptor.
+ * It returns an accepted UNIXSocket for the incoming connection.
+ *
+ * === Example
+ * require 'socket'
+ * serv = UNIXServer.new("/tmp/sock")
+ * begin # emulate blocking accept
+ * sock = serv.accept_nonblock
+ * rescue IO::WaitReadable, Errno::EINTR
+ * IO.select([serv])
+ * retry
+ * end
+ * # sock is an accepted socket.
+ *
+ * Refer to Socket#accept for the exceptions that may be thrown if the call
+ * to UNIXServer#accept_nonblock fails.
+ *
+ * UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure,
+ * including Errno::EWOULDBLOCK.
+ *
+ * If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
+ *
+ * === See
+ * * UNIXServer#accept
+ * * Socket#accept
+ */
static VALUE
-unix_accept_nonblock(VALUE sock, VALUE ex)
+unix_accept_nonblock(VALUE sock)
{
rb_io_t *fptr;
struct sockaddr_un from;
@@ -67,7 +99,7 @@ unix_accept_nonblock(VALUE sock, VALUE ex)
GetOpenFile(sock, fptr);
fromlen = (socklen_t)sizeof(from);
- return rsock_s_accept_nonblock(rb_cUNIXSocket, ex, fptr,
+ return rsock_s_accept_nonblock(rb_cUNIXSocket, fptr,
(struct sockaddr *)&from, &fromlen);
}
@@ -116,10 +148,7 @@ rsock_init_unixserver(void)
rb_cUNIXServer = rb_define_class("UNIXServer", rb_cUNIXSocket);
rb_define_method(rb_cUNIXServer, "initialize", unix_svr_init, 1);
rb_define_method(rb_cUNIXServer, "accept", unix_accept, 0);
-
- rb_define_private_method(rb_cUNIXServer,
- "__accept_nonblock", unix_accept_nonblock, 1);
-
+ rb_define_method(rb_cUNIXServer, "accept_nonblock", unix_accept_nonblock, 0);
rb_define_method(rb_cUNIXServer, "sysaccept", unix_sysaccept, 0);
rb_define_method(rb_cUNIXServer, "listen", rsock_sock_listen, 1); /* in socket.c */
#endif
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index f73f12777c..1742496e84 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -34,6 +34,10 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
rb_io_t *fptr;
SafeStringValue(path);
+ fd = rsock_socket(AF_UNIX, SOCK_STREAM, 0);
+ if (fd < 0) {
+ rsock_sys_fail_path("socket(2)", path);
+ }
INIT_SOCKADDR_UN(&sockaddr, sizeof(struct sockaddr_un));
if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) {
@@ -43,11 +47,6 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
sockaddrlen = rsock_unix_sockaddr_len(path);
- fd = rsock_socket(AF_UNIX, SOCK_STREAM, 0);
- if (fd < 0) {
- rsock_sys_fail_path("socket(2)", path);
- }
-
if (server) {
status = bind(fd, (struct sockaddr*)&sockaddr, sockaddrlen);
}
@@ -65,16 +64,14 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
}
if (status < 0) {
- int e = errno;
close(fd);
- rsock_syserr_fail_path(e, "connect(2)", path);
+ rsock_sys_fail_path("connect(2)", path);
}
if (server) {
if (listen(fd, SOMAXCONN) < 0) {
- int e = errno;
close(fd);
- rsock_syserr_fail_path(e, "listen(2)", path);
+ rsock_sys_fail_path("listen(2)", path);
}
}
@@ -133,7 +130,7 @@ unix_path(VALUE sock)
/*
* call-seq:
- * unixsocket.recvfrom(maxlen [, flags[, outbuf]]) => [mesg, unixaddress]
+ * unixsocket.recvfrom(maxlen [, flags]) => [mesg, unixaddress]
*
* Receives a message via _unixsocket_.
*
@@ -141,9 +138,6 @@ unix_path(VALUE sock)
*
* _flags_ should be a bitwise OR of Socket::MSG_* constants.
*
- * _outbuf_ will contain only the received data after the method call
- * even if it is not empty at the beginning.
- *
* s1 = Socket.new(:UNIX, :DGRAM, 0)
* s1_ai = Addrinfo.unix("/tmp/sock1")
* s1.bind(s1_ai)
@@ -203,8 +197,6 @@ sendmsg_blocking(void *data)
* p stdout.fileno #=> 6
*
* stdout.puts "hello" # outputs "hello\n" to standard output.
- *
- * _io_ may be any kind of IO object or integer file descriptor.
*/
static VALUE
unix_send_io(VALUE sock, VALUE val)
@@ -285,8 +277,6 @@ recvmsg_blocking(void *data)
* call-seq:
* unixsocket.recv_io([klass [, mode]]) => io
*
- * Example
- *
* UNIXServer.open("/tmp/sock") {|serv|
* UNIXSocket.open("/tmp/sock") {|c|
* s = serv.accept
@@ -301,11 +291,6 @@ recvmsg_blocking(void *data)
* }
* }
*
- * _klass_ will determine the class of _io_ returned (using the
- * IO.for_fd singleton method or similar).
- * If _klass_ is +nil+, an integer file descriptor is returned.
- *
- * _mode_ is the same as the argument passed to IO.for_fd
*/
static VALUE
unix_recv_io(int argc, VALUE *argv, VALUE sock)
@@ -404,13 +389,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
#if FD_PASSING_BY_MSG_CONTROL
memcpy(&fd, CMSG_DATA(&cmsg.hdr), sizeof(int));
#endif
-
- rb_update_max_fd(fd);
-
- if (rsock_cmsg_cloexec_state < 0)
- rsock_cmsg_cloexec_state = rsock_detect_cloexec(fd);
- if (rsock_cmsg_cloexec_state == 0 || fd <= 2)
- rb_maygvl_fd_fix_cloexec(fd);
+ rb_fd_fix_cloexec(fd);
if (klass == Qnil)
return INT2FIX(fd);
@@ -489,7 +468,7 @@ unix_peeraddr(VALUE sock)
* UNIXSocket.pair([type [, protocol]]) => [unixsocket1, unixsocket2]
* UNIXSocket.socketpair([type [, protocol]]) => [unixsocket1, unixsocket2]
*
- * Creates a pair of sockets connected to each other.
+ * Creates a pair of sockets connected each other.
*
* _socktype_ should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
*
diff --git a/ext/stringio/extconf.rb b/ext/stringio/extconf.rb
index ad8650dce2..8fc84b3735 100644
--- a/ext/stringio/extconf.rb
+++ b/ext/stringio/extconf.rb
@@ -1,3 +1,2 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('stringio')
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 8ae4cd5b2e..3fef619de6 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -20,13 +20,8 @@
#include <sys/fcntl.h>
#endif
-#ifndef RB_INTEGER_TYPE_P
-# define RB_INTEGER_TYPE_P(c) (FIXNUM_P(c) || RB_TYPE_P(c, T_BIGNUM))
-#endif
-
struct StringIO {
VALUE string;
- rb_encoding *enc;
long pos;
long lineno;
int flags;
@@ -34,11 +29,9 @@ struct StringIO {
};
static void strio_init(int, VALUE *, struct StringIO *, VALUE);
-static VALUE strio_unget_bytes(struct StringIO *, const char *, long);
#define IS_STRIO(obj) (rb_typeddata_is_kind_of((obj), &strio_data_type))
-#define error_inval(msg) (rb_syserr_fail(EINVAL, msg))
-#define get_enc(ptr) ((ptr)->enc ? (ptr)->enc : rb_enc_get((ptr)->string))
+#define error_inval(msg) (errno = EINVAL, rb_sys_fail(msg))
static struct StringIO *
strio_alloc(void)
@@ -73,6 +66,8 @@ strio_free(void *p)
static size_t
strio_memsize(const void *p)
{
+ const struct StringIO *ptr = p;
+ if (!ptr) return 0;
return sizeof(struct StringIO);
}
@@ -83,7 +78,7 @@ static const rb_data_type_t strio_data_type = {
strio_free,
strio_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#define check_strio(self) ((struct StringIO*)rb_check_typeddata((self), &strio_data_type))
@@ -103,7 +98,7 @@ static VALUE
strio_substr(struct StringIO *ptr, long pos, long len)
{
VALUE str = ptr->string;
- rb_encoding *enc = get_enc(ptr);
+ rb_encoding *enc = rb_enc_get(str);
long rlen = RSTRING_LEN(str) - pos;
if (len > rlen) len = rlen;
@@ -144,6 +139,8 @@ writable(VALUE strio)
if (!WRITABLE(strio)) {
rb_raise(rb_eIOError, "not opened for writing");
}
+ if (!OBJ_TAINTED(ptr->string)) {
+ }
return ptr;
}
@@ -189,17 +186,18 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
case 2:
if (FIXNUM_P(mode)) {
int flags = FIX2INT(mode);
- ptr->flags = rb_io_oflags_fmode(flags);
+ ptr->flags = rb_io_modenum_flags(flags);
trunc = flags & O_TRUNC;
}
else {
const char *m = StringValueCStr(mode);
- ptr->flags = rb_io_modestr_fmode(m);
+ ptr->flags = rb_io_mode_flags(m);
trunc = *m == 'w';
}
StringValue(string);
if ((ptr->flags & FMODE_WRITABLE) && OBJ_FROZEN(string)) {
- rb_syserr_fail(EACCES, 0);
+ errno = EACCES;
+ rb_sys_fail(0);
}
if (trunc) {
rb_str_resize(string, 0);
@@ -215,7 +213,6 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
break;
}
ptr->string = string;
- ptr->enc = 0;
ptr->pos = 0;
ptr->lineno = 0;
RBASIC(self)->flags |= (ptr->flags & FMODE_READWRITE) * (STRIO_READABLE / FMODE_READABLE);
@@ -349,6 +346,9 @@ static VALUE
strio_close(VALUE self)
{
StringIO(self);
+ if (CLOSED(self)) {
+ rb_raise(rb_eIOError, "closed stream");
+ }
RBASIC(self)->flags &= ~STRIO_READWRITE;
return Qnil;
}
@@ -363,8 +363,8 @@ strio_close(VALUE self)
static VALUE
strio_close_read(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (!(ptr->flags & FMODE_READABLE)) {
+ StringIO(self);
+ if (!READABLE(self)) {
rb_raise(rb_eIOError, "closing non-duplex IO for reading");
}
RBASIC(self)->flags &= ~STRIO_READABLE;
@@ -381,8 +381,8 @@ strio_close_read(VALUE self)
static VALUE
strio_close_write(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- if (!(ptr->flags & FMODE_WRITABLE)) {
+ StringIO(self);
+ if (!WRITABLE(self)) {
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
RBASIC(self)->flags &= ~STRIO_WRITABLE;
@@ -497,18 +497,7 @@ strio_set_lineno(VALUE self, VALUE lineno)
return lineno;
}
-static VALUE
-strio_binmode(VALUE self)
-{
- struct StringIO *ptr = StringIO(self);
- rb_encoding *enc = rb_ascii8bit_encoding();
-
- ptr->enc = enc;
- if (WRITABLE(self)) {
- rb_enc_associate(ptr->string, enc);
- }
- return self;
-}
+#define strio_binmode strio_self
#define strio_fcntl strio_unimpl
@@ -680,7 +669,7 @@ static VALUE
strio_getc(VALUE self)
{
struct StringIO *ptr = readable(self);
- rb_encoding *enc = get_enc(ptr);
+ rb_encoding *enc = rb_enc_get(ptr->string);
int len;
char *p;
@@ -690,7 +679,7 @@ strio_getc(VALUE self)
p = RSTRING_PTR(ptr->string)+ptr->pos;
len = rb_enc_mbclen(p, RSTRING_END(ptr->string), enc);
ptr->pos += len;
- return rb_enc_str_new(p, len, enc);
+ return rb_enc_str_new(p, len, rb_enc_get(ptr->string));
}
/*
@@ -741,19 +730,19 @@ static VALUE
strio_ungetc(VALUE self, VALUE c)
{
struct StringIO *ptr = readable(self);
+ long lpos, clen;
+ char *p, *pend;
rb_encoding *enc, *enc2;
- check_modifiable(ptr);
if (NIL_P(c)) return Qnil;
- if (RB_INTEGER_TYPE_P(c)) {
- int len, cc = NUM2INT(c);
+ check_modifiable(ptr);
+ if (FIXNUM_P(c)) {
+ int cc = FIX2INT(c);
char buf[16];
enc = rb_enc_get(ptr->string);
- len = rb_enc_codelen(cc, enc);
- if (len <= 0) rb_enc_uint_chr(cc, enc);
rb_enc_mbcput(cc, buf, enc);
- return strio_unget_bytes(ptr, buf, len);
+ c = rb_enc_str_new(buf, rb_enc_codelen(cc, enc), enc);
}
else {
SafeStringValue(c);
@@ -762,10 +751,29 @@ strio_ungetc(VALUE self, VALUE c)
if (enc != enc2 && enc != rb_ascii8bit_encoding()) {
c = rb_str_conv_enc(c, enc2, enc);
}
- strio_unget_bytes(ptr, RSTRING_PTR(c), RSTRING_LEN(c));
- RB_GC_GUARD(c);
- return Qnil;
}
+ if (RSTRING_LEN(ptr->string) < ptr->pos) {
+ long len = RSTRING_LEN(ptr->string);
+ rb_str_resize(ptr->string, ptr->pos - 1);
+ memset(RSTRING_PTR(ptr->string) + len, 0, ptr->pos - len - 1);
+ rb_str_concat(ptr->string, c);
+ ptr->pos--;
+ }
+ else {
+ /* get logical position */
+ lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos;
+ for (;;) {
+ clen = rb_enc_mbclen(p, pend, enc);
+ if (p+clen >= pend) break;
+ p += clen;
+ lpos++;
+ }
+ clen = p - RSTRING_PTR(ptr->string);
+ rb_str_update(ptr->string, lpos, ptr->pos ? 1 : 0, c);
+ ptr->pos = clen;
+ }
+
+ return Qnil;
}
/*
@@ -779,53 +787,35 @@ strio_ungetbyte(VALUE self, VALUE c)
{
struct StringIO *ptr = readable(self);
char buf[1], *cp = buf;
- long cl = 1;
+ long pos = ptr->pos, cl = 1;
+ VALUE str = ptr->string;
- check_modifiable(ptr);
if (NIL_P(c)) return Qnil;
if (FIXNUM_P(c)) {
buf[0] = (char)FIX2INT(c);
- return strio_unget_bytes(ptr, buf, 1);
}
else {
SafeStringValue(c);
cp = RSTRING_PTR(c);
cl = RSTRING_LEN(c);
if (cl == 0) return Qnil;
- strio_unget_bytes(ptr, cp, cl);
- RB_GC_GUARD(c);
- return Qnil;
}
-}
-
-static VALUE
-strio_unget_bytes(struct StringIO *ptr, const char *cp, long cl)
-{
- long pos = ptr->pos, len, rest;
- VALUE str = ptr->string;
- char *s;
-
- len = RSTRING_LEN(str);
- rest = pos - len;
+ check_modifiable(ptr);
+ rb_str_modify(str);
if (cl > pos) {
- long ex = (rest < 0 ? cl-pos : cl+rest);
- rb_str_modify_expand(str, ex);
- rb_str_set_len(str, len + ex);
+ char *s;
+ long rest = RSTRING_LEN(str) - pos;
+ rb_str_resize(str, rest + cl);
s = RSTRING_PTR(str);
- if (rest < 0) memmove(s + cl, s + pos, -rest);
+ memmove(s + cl, s + pos, rest);
pos = 0;
}
else {
- if (rest > 0) {
- rb_str_modify_expand(str, rest);
- rb_str_set_len(str, len + rest);
- }
- s = RSTRING_PTR(str);
- if (rest > cl) memset(s + len, 0, rest - cl);
pos -= cl;
}
- memcpy(s + pos, cp, cl);
+ memcpy(RSTRING_PTR(str) + pos, cp, cl);
ptr->pos = pos;
+ RB_GC_GUARD(c);
return Qnil;
}
@@ -907,7 +897,7 @@ strio_each_codepoint(VALUE self)
RETURN_ENUMERATOR(self, 0, 0);
ptr = readable(self);
- enc = get_enc(ptr);
+ enc = rb_enc_get(ptr->string);
for (;;) {
if (ptr->pos >= RSTRING_LEN(ptr->string)) {
return self;
@@ -1006,7 +996,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
e = s + RSTRING_LEN(ptr->string);
s += ptr->pos;
if (limit > 0 && s + limit < e) {
- e = rb_enc_right_char_head(s, s + limit, e, get_enc(ptr));
+ e = rb_enc_right_char_head(s, s + limit, e, rb_enc_get(ptr->string));
}
if (NIL_P(str)) {
str = strio_substr(ptr, ptr->pos, e - s);
@@ -1179,13 +1169,13 @@ strio_write(VALUE self, VALUE str)
struct StringIO *ptr = writable(self);
long len, olen;
rb_encoding *enc, *enc2;
- rb_encoding *const ascii8bit = rb_ascii8bit_encoding();
+ RB_GC_GUARD(str);
if (!RB_TYPE_P(str, T_STRING))
str = rb_obj_as_string(str);
- enc = get_enc(ptr);
+ enc = rb_enc_get(ptr->string);
enc2 = rb_enc_get(str);
- if (enc != enc2 && enc != ascii8bit) {
+ if (enc != enc2 && enc != rb_ascii8bit_encoding()) {
str = rb_str_conv_enc(str, enc2, enc);
}
len = RSTRING_LEN(str);
@@ -1196,13 +1186,7 @@ strio_write(VALUE self, VALUE str)
ptr->pos = olen;
}
if (ptr->pos == olen) {
- if (enc == ascii8bit || enc2 == ascii8bit) {
- rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc);
- OBJ_INFECT(ptr->string, str);
- }
- else {
- rb_str_buf_append(ptr->string, str);
- }
+ rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc);
}
else {
strio_extend(ptr, ptr->pos, len);
@@ -1210,7 +1194,6 @@ strio_write(VALUE self, VALUE str)
OBJ_INFECT(ptr->string, str);
}
OBJ_INFECT(ptr->string, self);
- RB_GC_GUARD(str);
ptr->pos += len;
return LONG2NUM(len);
}
@@ -1250,17 +1233,17 @@ static VALUE
strio_putc(VALUE self, VALUE ch)
{
struct StringIO *ptr = writable(self);
- VALUE str;
+ int c = NUM2CHR(ch);
+ long olen;
check_modifiable(ptr);
- if (RB_TYPE_P(ch, T_STRING)) {
- str = rb_str_substr(ch, 0, 1);
- }
- else {
- char c = NUM2CHR(ch);
- str = rb_str_new(&c, 1);
+ olen = RSTRING_LEN(ptr->string);
+ if (ptr->flags & FMODE_APPEND) {
+ ptr->pos = olen;
}
- strio_write(self, str);
+ strio_extend(ptr, ptr->pos, 1);
+ RSTRING_PTR(ptr->string)[ptr->pos++] = c;
+ OBJ_INFECT(ptr->string, self);
return ch;
}
@@ -1286,7 +1269,6 @@ strio_read(int argc, VALUE *argv, VALUE self)
long len;
int binary = 0;
- rb_check_arity(argc, 0, 2);
switch (argc) {
case 2:
str = argv[1];
@@ -1323,6 +1305,8 @@ strio_read(int argc, VALUE *argv, VALUE self)
len -= ptr->pos;
}
break;
+ default:
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
}
if (NIL_P(str)) {
str = strio_substr(ptr, ptr->pos, len);
@@ -1371,17 +1355,20 @@ static VALUE
strio_read_nonblock(int argc, VALUE *argv, VALUE self)
{
VALUE opts = Qnil, val;
+ int no_exception = 0;
rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
if (!NIL_P(opts)) {
argc--;
+
+ if (Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exception = 1;
}
val = strio_read(argc, argv, self);
if (NIL_P(val)) {
- if (!NIL_P(opts) &&
- rb_hash_lookup2(opts, sym_exception, Qundef) == Qfalse)
+ if (no_exception)
return Qnil;
else
rb_eof_error();
@@ -1458,8 +1445,7 @@ strio_truncate(VALUE self, VALUE len)
static VALUE
strio_external_encoding(VALUE self)
{
- struct StringIO *ptr = StringIO(self);
- return rb_enc_from_encoding(get_enc(ptr));
+ return rb_enc_from_encoding(rb_enc_get(StringIO(self)->string));
}
/*
@@ -1490,7 +1476,7 @@ static VALUE
strio_set_encoding(int argc, VALUE *argv, VALUE self)
{
rb_encoding* enc;
- struct StringIO *ptr = StringIO(self);
+ VALUE str = StringIO(self)->string;
VALUE ext_enc, int_enc, opt;
argc = rb_scan_args(argc, argv, "11:", &ext_enc, &int_enc, &opt);
@@ -1501,29 +1487,15 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self)
else {
enc = rb_to_encoding(ext_enc);
}
- ptr->enc = enc;
- if (WRITABLE(self)) {
- rb_enc_associate(ptr->string, enc);
- }
-
+ rb_enc_associate(str, enc);
return self;
}
/*
* Pseudo I/O on String object.
- *
- * Commonly used to simulate `$stdio` or `$stderr`
- *
- * === Examples
- *
- * require 'stringio'
- *
- * io = StringIO.new
- * io.puts "Hello World"
- * io.string #=> "Hello World\n"
*/
void
-Init_stringio(void)
+Init_stringio()
{
VALUE StringIO = rb_define_class("StringIO", rb_cData);
diff --git a/ext/strscan/depend b/ext/strscan/depend
index 324c5da2f2..689510ec66 100644
--- a/ext/strscan/depend
+++ b/ext/strscan/depend
@@ -1,17 +1,7 @@
-# AUTOGENERATED DEPENDENCIES START
-strscan.o: $(RUBY_EXTCONF_H)
-strscan.o: $(arch_hdrdir)/ruby/config.h
-strscan.o: $(hdrdir)/ruby/defines.h
-strscan.o: $(hdrdir)/ruby/encoding.h
-strscan.o: $(hdrdir)/ruby/intern.h
-strscan.o: $(hdrdir)/ruby/missing.h
-strscan.o: $(hdrdir)/ruby/oniguruma.h
-strscan.o: $(hdrdir)/ruby/re.h
-strscan.o: $(hdrdir)/ruby/regex.h
-strscan.o: $(hdrdir)/ruby/ruby.h
-strscan.o: $(hdrdir)/ruby/st.h
-strscan.o: $(hdrdir)/ruby/subst.h
-strscan.o: $(top_srcdir)/regenc.h
-strscan.o: $(top_srcdir)/regint.h
-strscan.o: strscan.c
-# AUTOGENERATED DEPENDENCIES END
+strscan.o: strscan.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/re.h \
+ $(hdrdir)/regex.h \
+ $(hdrdir)/encoding.h \
+ $(hdrdir)/oniguruma.h \
+ $(top_srcdir)/regint.h \
+ $(top_srcdir)/regenc.h
diff --git a/ext/strscan/extconf.rb b/ext/strscan/extconf.rb
index c968f81c95..3e5a295e31 100644
--- a/ext/strscan/extconf.rb
+++ b/ext/strscan/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
$INCFLAGS << " -I$(top_srcdir)"
create_makefile 'strscan'
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 05a62da405..f020ba780d 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -64,7 +64,6 @@ struct strscanner
Function Prototypes
======================================================================= */
-static inline long minl _((const long n, const long x));
static VALUE infect _((VALUE str, struct strscanner *p));
static VALUE extract_range _((struct strscanner *p, long beg_i, long end_i));
static VALUE extract_beg_len _((struct strscanner *p, long beg_i, long len));
@@ -141,17 +140,12 @@ str_new(struct strscanner *p, const char *ptr, long len)
return str;
}
-static inline long
-minl(const long x, const long y)
-{
- return (x < y) ? x : y;
-}
-
static VALUE
extract_range(struct strscanner *p, long beg_i, long end_i)
{
if (beg_i > S_LEN(p)) return Qnil;
- end_i = minl(end_i, S_LEN(p));
+ if (end_i > S_LEN(p))
+ end_i = S_LEN(p);
return infect(str_new(p, S_PBEG(p) + beg_i, end_i - beg_i), p);
}
@@ -159,7 +153,8 @@ static VALUE
extract_beg_len(struct strscanner *p, long beg_i, long len)
{
if (beg_i > S_LEN(p)) return Qnil;
- len = minl(len, S_LEN(p) - beg_i);
+ if (beg_i + len > S_LEN(p))
+ len = S_LEN(p) - beg_i;
return infect(str_new(p, S_PBEG(p) + beg_i, len), p);
}
@@ -186,25 +181,30 @@ static size_t
strscan_memsize(const void *ptr)
{
const struct strscanner *p = ptr;
- return sizeof(*p) - sizeof(p->regs) + onig_region_memsize(&p->regs);
+ size_t size = 0;
+ if (p) {
+ size = sizeof(*p) - sizeof(p->regs) + onig_region_memsize(&p->regs);
+ }
+ return size;
}
static const rb_data_type_t strscanner_type = {
"StringScanner",
{strscan_mark, strscan_free, strscan_memsize},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
strscan_s_allocate(VALUE klass)
{
struct strscanner *p;
- VALUE obj = TypedData_Make_Struct(klass, struct strscanner, &strscanner_type, p);
+ p = ALLOC(struct strscanner);
+ MEMZERO(p, struct strscanner, 1);
CLEAR_MATCH_STATUS(p);
onig_region_init(&(p->regs));
p->str = Qnil;
- return obj;
+ return TypedData_Wrap_Struct(klass, &strscanner_type, p);
}
/*
@@ -252,9 +252,7 @@ strscan_init_copy(VALUE vself, VALUE vorig)
self->str = orig->str;
self->prev = orig->prev;
self->curr = orig->curr;
- if (rb_reg_region_copy(&self->regs, &orig->regs))
- rb_memerror();
- RB_GC_GUARD(vorig);
+ onig_region_copy(&self->regs, &orig->regs);
}
return vself;
@@ -733,7 +731,9 @@ strscan_getch(VALUE self)
return Qnil;
len = rb_enc_mbclen(CURPTR(p), S_PEND(p), rb_enc_get(p->str));
- len = minl(len, S_RESTLEN(p));
+ if (p->curr + len > S_LEN(p)) {
+ len = S_LEN(p) - p->curr;
+ }
p->prev = p->curr;
p->curr += len;
MATCHED(p);
@@ -810,7 +810,8 @@ strscan_peek(VALUE self, VALUE vlen)
if (EOS_P(p))
return infect(str_new(p, "", 0), p);
- len = minl(len, S_RESTLEN(p));
+ if (p->curr + len > S_LEN(p))
+ len = S_LEN(p) - p->curr;
return extract_beg_len(p, p->curr, len);
}
@@ -976,7 +977,7 @@ strscan_matched_size(VALUE self)
}
static int
-name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end, rb_encoding *enc)
+name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end)
{
int num;
@@ -986,8 +987,9 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
return num;
}
else {
- rb_enc_raise(enc, rb_eIndexError, "undefined group name reference: %.*s",
- rb_long2int(name_end - name), name);
+ VALUE s = rb_str_new(name, (long )(name_end - name));
+ rb_raise(rb_eIndexError, "undefined group name reference: %s",
+ StringValuePtr(s));
}
UNREACHABLE;
@@ -1031,12 +1033,13 @@ strscan_aref(VALUE self, VALUE idx)
switch (TYPE(idx)) {
case T_SYMBOL:
- idx = rb_sym2str(idx);
- /* fall through */
+ name = rb_id2name(SYM2ID(idx));
+ goto name_to_backref;
+ break;
case T_STRING:
- if (!p->regex) return Qnil;
- RSTRING_GETMEM(idx, name, i);
- i = name_to_backref_number(&(p->regs), p->regex, name, name + i, rb_enc_get(idx));
+ name = StringValuePtr(idx);
+ name_to_backref:
+ i = name_to_backref_number(&(p->regs), p->regex, name, name + strlen(name));
break;
default:
i = NUM2LONG(idx);
@@ -1119,7 +1122,7 @@ strscan_rest_size(VALUE self)
if (EOS_P(p)) {
return INT2FIX(0);
}
- i = S_RESTLEN(p);
+ i = S_LEN(p) - p->curr;
return INT2FIX(i);
}
@@ -1135,6 +1138,7 @@ strscan_restsize(VALUE self)
}
#define INSPECT_LENGTH 5
+#define BUFSIZE 256
/*
* Returns a string that represents the StringScanner object, showing:
@@ -1151,69 +1155,76 @@ static VALUE
strscan_inspect(VALUE self)
{
struct strscanner *p;
+ char buf[BUFSIZE];
+ long len;
VALUE a, b;
p = check_strscan(self);
if (NIL_P(p->str)) {
- a = rb_sprintf("#<%"PRIsVALUE" (uninitialized)>", rb_obj_class(self));
- return infect(a, p);
+ len = snprintf(buf, BUFSIZE, "#<%s (uninitialized)>",
+ rb_class2name(CLASS_OF(self)));
+ return infect(rb_str_new(buf, len), p);
}
if (EOS_P(p)) {
- a = rb_sprintf("#<%"PRIsVALUE" fin>", rb_obj_class(self));
- return infect(a, p);
+ len = snprintf(buf, BUFSIZE, "#<%s fin>",
+ rb_class2name(CLASS_OF(self)));
+ return infect(rb_str_new(buf, len), p);
}
if (p->curr == 0) {
- b = inspect2(p);
- a = rb_sprintf("#<%"PRIsVALUE" %ld/%ld @ %"PRIsVALUE">",
- rb_obj_class(self),
- p->curr, S_LEN(p),
- b);
- return infect(a, p);
+ b = inspect2(p);
+ len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld @ %s>",
+ rb_class2name(CLASS_OF(self)),
+ p->curr, S_LEN(p),
+ RSTRING_PTR(b));
+ return infect(rb_str_new(buf, len), p);
}
a = inspect1(p);
b = inspect2(p);
- a = rb_sprintf("#<%"PRIsVALUE" %ld/%ld %"PRIsVALUE" @ %"PRIsVALUE">",
- rb_obj_class(self),
- p->curr, S_LEN(p),
- a, b);
- return infect(a, p);
+ len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld %s @ %s>",
+ rb_class2name(CLASS_OF(self)),
+ p->curr, S_LEN(p),
+ RSTRING_PTR(a),
+ RSTRING_PTR(b));
+ return infect(rb_str_new(buf, len), p);
}
static VALUE
inspect1(struct strscanner *p)
{
- VALUE str;
+ char buf[BUFSIZE];
+ char *bp = buf;
long len;
if (p->curr == 0) return rb_str_new2("");
if (p->curr > INSPECT_LENGTH) {
- str = rb_str_new_cstr("...");
- len = INSPECT_LENGTH;
+ strcpy(bp, "..."); bp += 3;
+ len = INSPECT_LENGTH;
}
else {
- str = rb_str_new(0, 0);
- len = p->curr;
+ len = p->curr;
}
- rb_str_cat(str, CURPTR(p) - len, len);
- return rb_str_dump(str);
+ memcpy(bp, CURPTR(p) - len, len); bp += len;
+ return rb_str_dump(rb_str_new(buf, bp - buf));
}
static VALUE
inspect2(struct strscanner *p)
{
- VALUE str;
+ char buf[BUFSIZE];
+ char *bp = buf;
long len;
if (EOS_P(p)) return rb_str_new2("");
- len = S_RESTLEN(p);
+ len = S_LEN(p) - p->curr;
if (len > INSPECT_LENGTH) {
- str = rb_str_new(CURPTR(p), INSPECT_LENGTH);
- rb_str_cat2(str, "...");
+ len = INSPECT_LENGTH;
+ memcpy(bp, CURPTR(p), len); bp += len;
+ strcpy(bp, "..."); bp += 3;
}
else {
- str = rb_str_new(CURPTR(p), len);
+ memcpy(bp, CURPTR(p), len); bp += len;
}
- return rb_str_dump(str);
+ return rb_str_dump(rb_str_new(buf, bp - buf));
}
/* =======================================================================
@@ -1324,7 +1335,7 @@ inspect2(struct strscanner *p)
* There are aliases to several of the methods.
*/
void
-Init_strscan(void)
+Init_strscan()
{
ID id_scanerr = rb_intern("ScanError");
VALUE tmp;
diff --git a/ext/syslog/depend b/ext/syslog/depend
index d818fd80aa..0e2d76fbf6 100644
--- a/ext/syslog/depend
+++ b/ext/syslog/depend
@@ -1,12 +1,2 @@
-# AUTOGENERATED DEPENDENCIES START
-syslog.o: $(RUBY_EXTCONF_H)
-syslog.o: $(arch_hdrdir)/ruby/config.h
-syslog.o: $(hdrdir)/ruby/defines.h
-syslog.o: $(hdrdir)/ruby/intern.h
-syslog.o: $(hdrdir)/ruby/missing.h
-syslog.o: $(hdrdir)/ruby/ruby.h
-syslog.o: $(hdrdir)/ruby/st.h
-syslog.o: $(hdrdir)/ruby/subst.h
-syslog.o: $(hdrdir)/ruby/util.h
-syslog.o: syslog.c
-# AUTOGENERATED DEPENDENCIES END
+syslog.o: syslog.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/util.h
diff --git a/ext/syslog/extconf.rb b/ext/syslog/extconf.rb
index 3bfea1fa73..0fa0bc339b 100644
--- a/ext/syslog/extconf.rb
+++ b/ext/syslog/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# $RoughId: extconf.rb,v 1.3 2001/11/24 17:49:26 knu Exp $
# $Id$
diff --git a/ext/syslog/lib/syslog/logger.rb b/ext/syslog/lib/syslog/logger.rb
index 06cbe5b19d..086f83c591 100644
--- a/ext/syslog/lib/syslog/logger.rb
+++ b/ext/syslog/lib/syslog/logger.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'syslog'
require 'logger'
@@ -67,7 +66,7 @@ class Syslog::Logger
##
# The version of Syslog::Logger you are using.
- VERSION = '2.1.0'
+ VERSION = '2.0'
##
# Maps Logger warning types to syslog(3) warning types.
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index 9c41795f5b..17c5ef8969 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -304,13 +304,15 @@ static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self)
{
VALUE pri;
- rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
+ if (argc < 2) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2+)", argc);
+ }
argc--;
pri = *argv++;
if (!FIXNUM_P(pri)) {
- rb_raise(rb_eTypeError, "type mismatch: %"PRIsVALUE" given", rb_obj_class(pri));
+ rb_raise(rb_eTypeError, "type mismatch: %s given", rb_class2name(CLASS_OF(pri)));
}
syslog_write(FIX2INT(pri), argc, argv);
@@ -325,10 +327,10 @@ static VALUE mSyslog_inspect(VALUE self)
Check_Type(self, T_MODULE);
if (!syslog_opened)
- return rb_sprintf("<#%"PRIsVALUE": opened=false>", self);
+ return rb_sprintf("<#%s: opened=false>", rb_class2name(self));
- return rb_sprintf("<#%"PRIsVALUE": opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
- self,
+ return rb_sprintf("<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
+ rb_class2name(self),
syslog_ident,
syslog_options,
syslog_facility,
@@ -416,7 +418,7 @@ static VALUE mSyslogMacros_included(VALUE mod, VALUE target)
*
* The syslog protocol is standardized in RFC 5424.
*/
-void Init_syslog(void)
+void Init_syslog()
{
mSyslog = rb_define_module("Syslog");
diff --git a/ext/thread/extconf.rb b/ext/thread/extconf.rb
index 7e1c6d2716..f2f0890580 100644
--- a/ext/thread/extconf.rb
+++ b/ext/thread/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'mkmf'
create_makefile('thread')
diff --git a/ext/thread/thread.c b/ext/thread/thread.c
index 9eef3b442e..126b5b3523 100644
--- a/ext/thread/thread.c
+++ b/ext/thread/thread.c
@@ -1,6 +1,579 @@
#include <ruby.h>
+enum {
+ CONDVAR_WAITERS = 0
+};
+
+enum {
+ QUEUE_QUE = 0,
+ QUEUE_WAITERS = 1,
+ SZQUEUE_WAITERS = 2,
+ SZQUEUE_MAX = 3
+};
+
+#define GET_CONDVAR_WAITERS(cv) RSTRUCT_GET((cv), CONDVAR_WAITERS)
+
+#define GET_QUEUE_QUE(q) RSTRUCT_GET((q), QUEUE_QUE)
+#define GET_QUEUE_WAITERS(q) RSTRUCT_GET((q), QUEUE_WAITERS)
+#define GET_SZQUEUE_WAITERS(q) RSTRUCT_GET((q), SZQUEUE_WAITERS)
+#define GET_SZQUEUE_MAX(q) RSTRUCT_GET((q), SZQUEUE_MAX)
+#define GET_SZQUEUE_ULONGMAX(q) NUM2ULONG(GET_SZQUEUE_MAX(q))
+
+static VALUE
+ary_buf_new(void)
+{
+ return rb_ary_tmp_new(1);
+}
+
+static void
+wakeup_first_thread(VALUE list)
+{
+ VALUE thread;
+
+ while (!NIL_P(thread = rb_ary_shift(list))) {
+ if (RTEST(rb_thread_wakeup_alive(thread))) break;
+ }
+}
+
+static void
+wakeup_all_threads(VALUE list)
+{
+ VALUE thread;
+ long i;
+
+ for (i=0; i<RARRAY_LEN(list); i++) {
+ thread = RARRAY_AREF(list, i);
+ rb_thread_wakeup_alive(thread);
+ }
+ rb_ary_clear(list);
+}
+
+/*
+ * Document-class: ConditionVariable
+ *
+ * ConditionVariable objects augment class Mutex. Using condition variables,
+ * it is possible to suspend while in the middle of a critical section until a
+ * resource becomes available.
+ *
+ * Example:
+ *
+ * require 'thread'
+ *
+ * mutex = Mutex.new
+ * resource = ConditionVariable.new
+ *
+ * a = Thread.new {
+ * mutex.synchronize {
+ * # Thread 'a' now needs the resource
+ * resource.wait(mutex)
+ * # 'a' can now have the resource
+ * }
+ * }
+ *
+ * b = Thread.new {
+ * mutex.synchronize {
+ * # Thread 'b' has finished using the resource
+ * resource.signal
+ * }
+ * }
+ */
+
+/*
+ * Document-method: ConditionVariable::new
+ *
+ * Creates a new condition variable instance.
+ */
+
+static VALUE
+rb_condvar_initialize(VALUE self)
+{
+ RSTRUCT_SET(self, CONDVAR_WAITERS, ary_buf_new());
+ return self;
+}
+
+struct sleep_call {
+ VALUE mutex;
+ VALUE timeout;
+};
+
+static ID id_sleep;
+
+static VALUE
+do_sleep(VALUE args)
+{
+ struct sleep_call *p = (struct sleep_call *)args;
+ return rb_funcall2(p->mutex, id_sleep, 1, &p->timeout);
+}
+
+static VALUE
+delete_current_thread(VALUE ary)
+{
+ return rb_ary_delete(ary, rb_thread_current());
+}
+
+/*
+ * Document-method: ConditionVariable#wait
+ * call-seq: wait(mutex, timeout=nil)
+ *
+ * Releases the lock held in +mutex+ and waits; reacquires the lock on wakeup.
+ *
+ * If +timeout+ is given, this method returns after +timeout+ seconds passed,
+ * even if no other thread doesn't signal.
+ */
+
+static VALUE
+rb_condvar_wait(int argc, VALUE *argv, VALUE self)
+{
+ VALUE waiters = GET_CONDVAR_WAITERS(self);
+ VALUE mutex, timeout;
+ struct sleep_call args;
+
+ rb_scan_args(argc, argv, "11", &mutex, &timeout);
+
+ args.mutex = mutex;
+ args.timeout = timeout;
+ rb_ary_push(waiters, rb_thread_current());
+ rb_ensure(do_sleep, (VALUE)&args, delete_current_thread, waiters);
+
+ return self;
+}
+
+/*
+ * Document-method: ConditionVariable#signal
+ *
+ * Wakes up the first thread in line waiting for this lock.
+ */
+
+static VALUE
+rb_condvar_signal(VALUE self)
+{
+ wakeup_first_thread(GET_CONDVAR_WAITERS(self));
+ return self;
+}
+
+/*
+ * Document-method: ConditionVariable#broadcast
+ *
+ * Wakes up all threads waiting for this lock.
+ */
+
+static VALUE
+rb_condvar_broadcast(VALUE self)
+{
+ wakeup_all_threads(GET_CONDVAR_WAITERS(self));
+ return self;
+}
+
+/*
+ * Document-class: Queue
+ *
+ * This class provides a way to synchronize communication between threads.
+ *
+ * Example:
+ *
+ * require 'thread'
+ * queue = Queue.new
+ *
+ * producer = Thread.new do
+ * 5.times do |i|
+ * sleep rand(i) # simulate expense
+ * queue << i
+ * puts "#{i} produced"
+ * end
+ * end
+ *
+ * consumer = Thread.new do
+ * 5.times do |i|
+ * value = queue.pop
+ * sleep rand(i/2) # simulate expense
+ * puts "consumed #{value}"
+ * end
+ * end
+ *
+ */
+
+/*
+ * Document-method: Queue::new
+ *
+ * Creates a new queue instance.
+ */
+
+static VALUE
+rb_queue_initialize(VALUE self)
+{
+ RSTRUCT_SET(self, QUEUE_QUE, ary_buf_new());
+ RSTRUCT_SET(self, QUEUE_WAITERS, ary_buf_new());
+ return self;
+}
+
+static VALUE
+queue_do_push(VALUE self, VALUE obj)
+{
+ rb_ary_push(GET_QUEUE_QUE(self), obj);
+ wakeup_first_thread(GET_QUEUE_WAITERS(self));
+ return self;
+}
+
+/*
+ * Document-method: Queue#push
+ * call-seq: push(object)
+ *
+ * Pushes the given +object+ to the queue.
+ */
+
+static VALUE
+rb_queue_push(VALUE self, VALUE obj)
+{
+ return queue_do_push(self, obj);
+}
+
+static unsigned long
+queue_length(VALUE self)
+{
+ return RARRAY_LEN(GET_QUEUE_QUE(self));
+}
+
+static unsigned long
+queue_num_waiting(VALUE self)
+{
+ return RARRAY_LEN(GET_QUEUE_WAITERS(self));
+}
+
+struct waiting_delete {
+ VALUE waiting;
+ VALUE th;
+};
+
+static VALUE
+queue_delete_from_waiting(struct waiting_delete *p)
+{
+ rb_ary_delete(p->waiting, p->th);
+ return Qnil;
+}
+
+static VALUE
+queue_sleep(VALUE arg)
+{
+ rb_thread_sleep_deadly();
+ return Qnil;
+}
+
+static VALUE
+queue_do_pop(VALUE self, VALUE should_block)
+{
+ struct waiting_delete args;
+ args.waiting = GET_QUEUE_WAITERS(self);
+ args.th = rb_thread_current();
+
+ while (queue_length(self) == 0) {
+ if (!(int)should_block) {
+ rb_raise(rb_eThreadError, "queue empty");
+ }
+ rb_ary_push(args.waiting, args.th);
+ rb_ensure(queue_sleep, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
+ }
+
+ return rb_ary_shift(GET_QUEUE_QUE(self));
+}
+
+static VALUE
+queue_pop_should_block(int argc, VALUE *argv)
+{
+ VALUE should_block = Qtrue;
+ switch (argc) {
+ case 0:
+ break;
+ case 1:
+ should_block = RTEST(argv[0]) ? Qfalse : Qtrue;
+ break;
+ default:
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ }
+ return should_block;
+}
+
+/*
+ * Document-method: Queue#pop
+ * call-seq: pop(non_block=false)
+ *
+ * Retrieves data from the queue.
+ *
+ * If the queue is empty, the calling thread is suspended until data is pushed
+ * onto the queue. If +non_block+ is true, the thread isn't suspended, and an
+ * exception is raised.
+ */
+
+static VALUE
+rb_queue_pop(int argc, VALUE *argv, VALUE self)
+{
+ VALUE should_block = queue_pop_should_block(argc, argv);
+ return queue_do_pop(self, should_block);
+}
+
+/*
+ * Document-method: Queue#empty?
+ * call-seq: empty?
+ *
+ * Returns +true+ if the queue is empty.
+ */
+
+static VALUE
+rb_queue_empty_p(VALUE self)
+{
+ return queue_length(self) == 0 ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: Queue#clear
+ *
+ * Removes all objects from the queue.
+ */
+
+static VALUE
+rb_queue_clear(VALUE self)
+{
+ rb_ary_clear(GET_QUEUE_QUE(self));
+ return self;
+}
+
+/*
+ * Document-method: Queue#length
+ *
+ * Returns the length of the queue.
+ */
+
+static VALUE
+rb_queue_length(VALUE self)
+{
+ unsigned long len = queue_length(self);
+ return ULONG2NUM(len);
+}
+
+/*
+ * Document-method: Queue#num_waiting
+ *
+ * Returns the number of threads waiting on the queue.
+ */
+
+static VALUE
+rb_queue_num_waiting(VALUE self)
+{
+ unsigned long len = queue_num_waiting(self);
+ return ULONG2NUM(len);
+}
+
+/*
+ * Document-class: SizedQueue
+ *
+ * This class represents queues of specified size capacity. The push operation
+ * may be blocked if the capacity is full.
+ *
+ * See Queue for an example of how a SizedQueue works.
+ */
+
+/*
+ * Document-method: SizedQueue::new
+ * call-seq: new(max)
+ *
+ * Creates a fixed-length queue with a maximum size of +max+.
+ */
+
+static VALUE
+rb_szqueue_initialize(VALUE self, VALUE vmax)
+{
+ long max;
+
+ max = NUM2LONG(vmax);
+ if (max <= 0) {
+ rb_raise(rb_eArgError, "queue size must be positive");
+ }
+
+ RSTRUCT_SET(self, QUEUE_QUE, ary_buf_new());
+ RSTRUCT_SET(self, QUEUE_WAITERS, ary_buf_new());
+ RSTRUCT_SET(self, SZQUEUE_WAITERS, ary_buf_new());
+ RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
+
+ return self;
+}
+
+/*
+ * Document-method: SizedQueue#max
+ *
+ * Returns the maximum size of the queue.
+ */
+
+static VALUE
+rb_szqueue_max_get(VALUE self)
+{
+ return GET_SZQUEUE_MAX(self);
+}
+
+/*
+ * Document-method: SizedQueue#max=
+ * call-seq: max=(number)
+ *
+ * Sets the maximum size of the queue to the given +number+.
+ */
+
+static VALUE
+rb_szqueue_max_set(VALUE self, VALUE vmax)
+{
+ long max = NUM2LONG(vmax), diff = 0;
+ VALUE t;
+
+ if (max <= 0) {
+ rb_raise(rb_eArgError, "queue size must be positive");
+ }
+ if ((unsigned long)max > GET_SZQUEUE_ULONGMAX(self)) {
+ diff = max - GET_SZQUEUE_ULONGMAX(self);
+ }
+ RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
+ while (diff > 0 && !NIL_P(t = rb_ary_shift(GET_QUEUE_QUE(self)))) {
+ rb_thread_wakeup_alive(t);
+ }
+ return vmax;
+}
+
+/*
+ * Document-method: SizedQueue#push
+ * call-seq: push(object)
+ *
+ * Pushes +object+ to the queue.
+ *
+ * If there is no space left in the queue, waits until space becomes available.
+ */
+
+static VALUE
+rb_szqueue_push(VALUE self, VALUE obj)
+{
+ struct waiting_delete args;
+ args.waiting = GET_QUEUE_WAITERS(self);
+ args.th = rb_thread_current();
+
+ while (queue_length(self) >= GET_SZQUEUE_ULONGMAX(self)) {
+ rb_ary_push(args.waiting, args.th);
+ rb_ensure((VALUE (*)())rb_thread_sleep_deadly, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
+ }
+ return queue_do_push(self, obj);
+}
+
+static VALUE
+szqueue_do_pop(VALUE self, VALUE should_block)
+{
+ VALUE retval = queue_do_pop(self, should_block);
+
+ if (queue_length(self) < GET_SZQUEUE_ULONGMAX(self)) {
+ wakeup_first_thread(GET_SZQUEUE_WAITERS(self));
+ }
+
+ return retval;
+}
+
+/*
+ * Document-method: SizedQueue#pop
+ * call-seq: pop(non_block=false)
+ *
+ * Retrieves data from the queue.
+ *
+ * If the queue is empty, the calling thread is suspended until data is pushed
+ * onto the queue. If +non_block+ is true, the thread isn't suspended, and an
+ * exception is raised.
+ */
+
+static VALUE
+rb_szqueue_pop(int argc, VALUE *argv, VALUE self)
+{
+ VALUE should_block = queue_pop_should_block(argc, argv);
+ return szqueue_do_pop(self, should_block);
+}
+
+/*
+ * Document-method: SizedQueue#num_waiting
+ *
+ * Returns the number of threads waiting on the queue.
+ */
+
+static VALUE
+rb_szqueue_num_waiting(VALUE self)
+{
+ long len = queue_num_waiting(self);
+ len += RARRAY_LEN(GET_SZQUEUE_WAITERS(self));
+ return ULONG2NUM(len);
+}
+
+#ifndef UNDER_THREAD
+#define UNDER_THREAD 1
+#endif
+
void
Init_thread(void)
{
+#if UNDER_THREAD
+#define ALIAS_GLOBAL_CONST(name) do { \
+ ID id = rb_intern_const(#name); \
+ if (!rb_const_defined_at(rb_cObject, id)) { \
+ rb_const_set(rb_cObject, id, rb_c##name); \
+ } \
+ } while (0)
+#define OUTER rb_cThread
+#else
+#define ALIAS_GLOBAL_CONST(name) do { /* nothing */ } while (0)
+#define OUTER 0
+#endif
+
+ VALUE rb_cConditionVariable = rb_struct_define_without_accessor_under(
+ OUTER,
+ "ConditionVariable", rb_cObject, rb_struct_alloc_noinit,
+ "waiters", NULL);
+ VALUE rb_cQueue = rb_struct_define_without_accessor_under(
+ OUTER,
+ "Queue", rb_cObject, rb_struct_alloc_noinit,
+ "que", "waiters", NULL);
+ VALUE rb_cSizedQueue = rb_struct_define_without_accessor_under(
+ OUTER,
+ "SizedQueue", rb_cQueue, rb_struct_alloc_noinit,
+ "que", "waiters", "queue_waiters", "size", NULL);
+
+#if 0
+ rb_cConditionVariable = rb_define_class("ConditionVariable", rb_cObject); /* teach rdoc ConditionVariable */
+ rb_cQueue = rb_define_class("Queue", rb_cObject); /* teach rdoc Queue */
+ rb_cSizedQueue = rb_define_class("SizedQueue", rb_cObject); /* teach rdoc SizedQueue */
+#endif
+
+ id_sleep = rb_intern("sleep");
+
+ rb_define_method(rb_cConditionVariable, "initialize", rb_condvar_initialize, 0);
+ rb_define_method(rb_cConditionVariable, "wait", rb_condvar_wait, -1);
+ rb_define_method(rb_cConditionVariable, "signal", rb_condvar_signal, 0);
+ rb_define_method(rb_cConditionVariable, "broadcast", rb_condvar_broadcast, 0);
+
+ rb_define_method(rb_cQueue, "initialize", rb_queue_initialize, 0);
+ rb_define_method(rb_cQueue, "push", rb_queue_push, 1);
+ rb_define_method(rb_cQueue, "pop", rb_queue_pop, -1);
+ rb_define_method(rb_cQueue, "empty?", rb_queue_empty_p, 0);
+ rb_define_method(rb_cQueue, "clear", rb_queue_clear, 0);
+ rb_define_method(rb_cQueue, "length", rb_queue_length, 0);
+ rb_define_method(rb_cQueue, "num_waiting", rb_queue_num_waiting, 0);
+
+ rb_alias(rb_cQueue, rb_intern("enq"), rb_intern("push"));
+ rb_alias(rb_cQueue, rb_intern("<<"), rb_intern("push"));
+ rb_alias(rb_cQueue, rb_intern("deq"), rb_intern("pop"));
+ rb_alias(rb_cQueue, rb_intern("shift"), rb_intern("pop"));
+ rb_alias(rb_cQueue, rb_intern("size"), rb_intern("length"));
+
+ rb_define_method(rb_cSizedQueue, "initialize", rb_szqueue_initialize, 1);
+ rb_define_method(rb_cSizedQueue, "max", rb_szqueue_max_get, 0);
+ rb_define_method(rb_cSizedQueue, "max=", rb_szqueue_max_set, 1);
+ rb_define_method(rb_cSizedQueue, "push", rb_szqueue_push, 1);
+ rb_define_method(rb_cSizedQueue, "pop", rb_szqueue_pop, -1);
+ rb_define_method(rb_cSizedQueue, "num_waiting", rb_szqueue_num_waiting, 0);
+ rb_alias(rb_cSizedQueue, rb_intern("enq"), rb_intern("push"));
+ rb_alias(rb_cSizedQueue, rb_intern("<<"), rb_intern("push"));
+ rb_alias(rb_cSizedQueue, rb_intern("deq"), rb_intern("pop"));
+ rb_alias(rb_cSizedQueue, rb_intern("shift"), rb_intern("pop"));
+
+ rb_provide("thread.rb");
+ ALIAS_GLOBAL_CONST(ConditionVariable);
+ ALIAS_GLOBAL_CONST(Queue);
+ ALIAS_GLOBAL_CONST(SizedQueue);
}
diff --git a/ext/tk/MANUAL_tcltklib.eng b/ext/tk/MANUAL_tcltklib.eng
index bd124f7620..957e8ec840 100644
--- a/ext/tk/MANUAL_tcltklib.eng
+++ b/ext/tk/MANUAL_tcltklib.eng
@@ -1,7 +1,7 @@
(tof)
2005/07/05 Hidetoshi NAGAI
-This document describes about the 'tcltklib' library. Although there
+This document discribes about the 'tcltklib' library. Although there
is the 'tcltk' library (tcltk.rb) under this directory, no description
in this document (because it is not maintained recently).
@@ -171,7 +171,7 @@ module TclTklib
: a target event.
: If set DONT_WAIT flag and no event for processing, returns
: false immediately.
- : If $SAFE >= 1 and the flag is tainted,
+ : If $SAFE >= 4, or $SAFE >= 1 and the flag is tainted,
: force to set DONT_WAIT flag.
set_eventloop_tick(timer_tick)
@@ -183,6 +183,7 @@ module TclTklib
: However, if the eventloop thread is the only thread,
: timer_tick cannot be set to 0. If 0, then is set to 100 ms
: automatically (see NO_THREAD_INTERRUPT_TIME on tcltklib.c).
+ : On $SAFE >= 4, cannot call this method.
get_eventloop_tick
: Get current value of 'timer_tick'
@@ -193,6 +194,7 @@ module TclTklib
: Default value is 20 (ms).
: If the eventloop thread is the only thread, this value is
: invalid.
+ : On $SAFE >= 4, cannot call this method.
get_no_event_wait
: Get current value of 'no_event_wait'.
@@ -205,6 +207,7 @@ module TclTklib
: when no event for processing (And then, the eventloop thread
: sleeps 'no_event_wait' mili-seconds).
: 'loop_max == 800' and 'no_event_tick == 10' are default.
+ : On $SAFE >= 4, cannot call this method.
get_eventloop_weight
: Get current values of 'loop_max' and 'no_event_tick'.
@@ -212,7 +215,7 @@ module TclTklib
mainloop_abort_on_exception=(bool)
: Define whether the eventloop stops on exception or not.
: If true (default value), stops on exception.
- : If false, show a warning message but ignore the exception.
+ : If false, show a waring message but ignore the exception.
: If nil, no warning message and ignore the exception.
: This parameter is sometimes useful when multiple Tk
: interpreters are working. Because the only one eventloop
@@ -220,6 +223,7 @@ module TclTklib
: interpreter kills the eventloop thread. Even if such
: situation, when abort_on_exception == false or nil,
: the eventloop ignores the exception and continue to working.
+ : On $SAFE >= 4, cannot call this method.
mainloop_abort_on_exception
: Get current status of that.
@@ -290,6 +294,7 @@ class TclTkIp
: interpreter. Default is false. However, if the parent
: interpreter is a safe interpreter, the created interpreter is
: a safe interpreter (ignore 'safe' argument value).
+ : If $SAFE >= 4, can create a safe interpreter only.
make_safe
: Make the interpreter to the safe interpreter, and returns
@@ -309,7 +314,7 @@ class TclTkIp
allow_ruby_exit=(mode)
: Change the mode of 'allow_ruby_exit?'.
- : If the interpreter is a "safe" interpreter,
+ : If $SAFE >= 4 or the interpreter is a "safe" interpreter,
: this is not permitted (raise an exception).
delete
@@ -330,6 +335,7 @@ class TclTkIp
: Restart Tk part of the interpreter.
: Use this when you need Tk functions after destroying the
: root widget.
+ : On $SAFE >= 4, cannot call this method.
_eval(str)
_invoke(*args)
diff --git a/ext/tk/MANUAL_tcltklib.ja b/ext/tk/MANUAL_tcltklib.ja
index 8641909517..1de1736f9f 100644
--- a/ext/tk/MANUAL_tcltklib.ja
+++ b/ext/tk/MANUAL_tcltklib.ja
@@ -272,7 +272,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: 象となっている種類のイベントが発生するまで待ち続ける.
: DONT_WAIT を指定していた場合,処理対象イベントがなくても
: すぐに終了し false を返す.
- : $SAFE >= 1 かつ flag が汚染されているならば
+ : $SAFE >= 4 か,$SAFE >= 1 かつ flag が汚染されているならば
: flag には DONT_WAIT が強制的に付けられる.
set_eventloop_tick(timer_tick)
@@ -288,6 +288,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: 定される.
: 詳細な説明は略すが,これは CPU パワーを節約しつつ安全で
: 安定した動作を実現するために実装した仕様である.
+ : $SAFE >= 4 では実行が禁止される.
get_eventloop_tick
: timer_tick の現在値を返す.
@@ -297,6 +298,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: く存在しなかった際に sleep 状態に入る時間長を指定する.
: 稼働スレッドがイベントループだけの場合には意味をなさない.
: デフォルトの値は 20 (ms)
+ : $SAFE >= 4 では実行が禁止される.
get_no_event_wait
: no_event_wait の現在値を返す.
@@ -314,6 +316,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: が全く発生しないままに 80 回の処理待ちイベント検査が完了
: するとかでカウントが 800 以上になるとスレッドスイッチング
: が発生することになる.
+ : $SAFE >= 4 では実行が禁止される.
get_eventloop_weight
: 現在の loop_max と no_event_tick との値を返す.
@@ -333,6 +336,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: 他のインタープリタの処理継続が不可能になることがある.その
: ような場合でもエラーを無視してイベントループが稼働を続ける
: ことで,他のインタープリタが正常に動作し続けることができる.
+ : $SAFE >= 4 では実行が禁止される.
mainloop_abort_on_exception
: Tk インタープリタ上で例外を発生した際に,イベントループをエ
@@ -400,6 +404,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: たとえ明確に false を指定していたとしても,親となるインター
: プリタが safe インタープリタであれば,その設定を引き継いで
: safe インタープリタとして生成される.
+ : $SAFE >= 4 では,safe インタープリタ以外の生成が禁止される.
make_safe
: Tcl/Tk インタープリタを safe インタープリタに変更する.
@@ -420,8 +425,8 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
allow_ruby_exit=(mode)
: 対象となるインタープリタの allow_ruby_exit? の状態を変更する.
- : インタープリタが safe インタープリタの場合は変更が許されない
- : (例外を発生).
+ : $SAFE >= 4 またはインタープリタが safe インタープリタの場合は
+ : 変更が許されない (例外を発生).
delete
: Tcl/Tk インタープリタを delete する.
@@ -442,6 +447,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
: Tcl/Tk インタープリタの Tk 部分の初期化,再起動を行う.
: 一旦 root widget を破壊した後に再度 Tk の機能が必要と
: なった場合に用いる.
+ : $SAFE >= 4 では実行が禁止される.
_eval(str)
_invoke(*args)
diff --git a/ext/tk/README.macosx-aqua b/ext/tk/README.macosx-aqua
index 52edf4dcbf..15630727ec 100644
--- a/ext/tk/README.macosx-aqua
+++ b/ext/tk/README.macosx-aqua
@@ -3,7 +3,7 @@
First of all, please read README.tcltklib to use Tcl/Tk Aqua Framework.
-With Tcl/Tk Aqua libraries, current tcltklib sometimes freezes when
+With Tcl/Tk Aqua libraries, current tcltklib somtimes freezes when
using Aqua specific dialogs (e.g. Tk.messageBox).
This is a known bug of Ruby-1.8.4 release.
diff --git a/ext/tk/README.tcltklib b/ext/tk/README.tcltklib
index da343a4f3e..1367189690 100644
--- a/ext/tk/README.tcltklib
+++ b/ext/tk/README.tcltklib
@@ -30,7 +30,7 @@ some or all of the following options.
--with-tcltkversion=<version>
--with-tcltkversion=<tclversion>,<tkversion>
- force version of Tcl/Tk library
+ force version of Tcl/Tk libaray
(e.g. libtcl8.4g.so & libtk8.4g.so ==> --with-tcltkversion=8.4g
libtcl8.4.so & libtk8.4g.so ==> --with-tcltkversion=8.4,8.4g)
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
index c4ea4067bd..1a44eccb31 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##############################################################
# extconf.rb for tcltklib
# release date: 2010-07-30
@@ -10,20 +9,12 @@ TkLib_Config['search_versions'] =
# %w[8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6 4.2]
# %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0]
# %w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps
- %w[8.6 8.5 8.4]
-
-TkLib_Config['unsupported_versions'] =
- %w[8.8 8.7]
+ %w[8.5 8.4] # At present, Tcl/Tk8.6 is not supported.
TkLib_Config['major_nums'] = '87'
##############################################################
-
-TkLib_Config['enable-shared'] = enable_config("shared")
-
-
-##############################################################
# use old extconf.rb ?
##############################################################
if with_config('tk-old-extconf')
@@ -552,13 +543,13 @@ end
def get_ext_list()
exts = [CONFIG['DLEXT']]
- exts.concat %w(dll) if is_win32?
+ exts.concat %w(dll lib) if is_win32?
exts.concat %w(bundle dylib) if is_macosx?
- if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false
- exts.unshift "lib" if is_win32?
- exts.unshift "a"
- exts.unshift CONFIG['LIBEXT']
+ if enable_config("shared") == false
+ [CONFIG['LIBEXT'], "a"].concat exts
+ else
+ exts.concat [CONFIG['LIBEXT'], "a"]
end
if is_win32?
@@ -624,7 +615,7 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
$INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32?
else
tcllibs = append_library($libs, libname)
- tcllibs = "#{libpathflag([tcldir])} #{tcllibs}"
+ tcllibs = "-L#{tcldir.quote} -Wl,-R#{tcldir.quote} " + tcllibs
# FIX ME: avoid pathname trouble (fail to find) on MinGW.
$INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32?
@@ -666,7 +657,7 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
else
tklibs = append_library("", libname)
#tklibs = append_library("", $1)
- tklibs = "#{libpathflag([tkdir])} #{tklibs}"
+ tklibs = "-L#{tkdir.quote} -Wl,-R#{tkdir.quote} " + tklibs
# FIX ME: avoid pathname trouble (fail to find) on MinGW.
$INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32?
@@ -746,7 +737,6 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
end
conf = nil
- progress_flag = false
config_dir.uniq!
config_dir.map{|dir|
@@ -757,7 +747,7 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
dir.strip.chomp('/')
end
}.each{|dir|
- print("."); progress_flag = true # progress
+ print(".") # progress
# print("check #{dir} ==>");
if dir.kind_of? Array
tcldir, tkdir = dir
@@ -796,36 +786,10 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
# parse tclConfig.sh/tkConfig.sh
tclconf = (tclpath)? parse_tclConfig(tclpath): nil
- if tclconf
- if tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
- print("\n") if progress_flag
- puts "Ignore \"#{tclpath}\" (unmatch with configured version)."
- progress_flag = false
- next
- end
- if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tclconf['TCL_MAJOR_VERSION']}.#{tclconf['TCL_MINOR_VERSION']}"}
- print("\n") if progress_flag
- puts "Ignore \"#{tclpath}\" (unsupported version of Tcl/Tk)."
- progress_flag = false
- next
- end
- end
+ next if tclconf && tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
tkconf = (tkpath)? parse_tclConfig(tkpath): nil
- if tkconf
- if tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
- print("\n") if progress_flag
- puts "Ignore \"#{tkpath}\" (unmatch with configured version)."
- progress_flag = false
- next
- end
- if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tkconf['TK_MAJOR_VERSION']}.#{tkconf['TK_MINOR_VERSION']}"}
- print("\n") if progress_flag
- puts "Ignore \"#{tkpath}\" (unsupported version of Tcl/Tk)."
- progress_flag = false
- next
- end
- end
+ next if tkconf && tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
# nativethread check
if !TkLib_Config["ruby_with_thread"]
@@ -1138,7 +1102,7 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
if tcllib
print(".")
if have_library(tcllib, func, ["tcl.h"])
- return [true, path, tcllib, nil, *inc]
+ return [true, path, lib_w_sufx, nil, *inc]
end
else
sufx_list = ['', 't', 'g', 's', 'x']
@@ -1162,7 +1126,7 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
tcllibs = libs_param + " -DSTATIC_BUILD " + fname.quote
else
tcllibs = append_library($libs, lib_w_sufx)
- tcllibs = "#{libpathflag([path])} #{tcllibs}"
+ tcllibs = "-L#{path.quote} -Wl,-R#{path.quote} " + tcllibs
end
if try_func(func, tcllibs, ["tcl.h"])
return [true, path, nil, tcllibs, *inc]
@@ -1278,7 +1242,7 @@ def find_tk(tklib, stubs, version, *opt_paths)
if tklib
print(".")
if have_library(tklib, func, ["tcl.h", "tk.h"])
- return [true, path, tklib, nil, *inc]
+ return [true, path, lib_w_sufx, nil, *inc]
end
else
sufx_list = ['', 't', 'g', 's', 'x']
@@ -1301,7 +1265,7 @@ def find_tk(tklib, stubs, version, *opt_paths)
tklibs = libs_param + " -DSTATIC_BUILD " + fname.quote
else
tklibs = append_library($libs, lib_w_sufx)
- tklibs = "#{libpathflag([path])} #{tklibs}"
+ tklibs = "-L#{path.quote} -Wl,-R#{path.quote} " + tklibs
end
if try_func(func, tklibs, ["tcl.h", "tk.h"])
return [true, path, nil, tklibs, *inc]
@@ -1328,10 +1292,6 @@ end
def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
tcl_opt_paths, tk_opt_paths)
st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
- if !st && TkLib_Config['enable-shared'] == nil
- TkLib_Config['enable-shared'] = false
- st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
- end
unless st
puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
return false
@@ -1344,10 +1304,6 @@ def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
end
st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
- if !st && TkLib_Config['enable-shared'] == nil
- TkLib_Config['enable-shared'] = false
- st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
- end
unless st
puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
return false
@@ -1647,7 +1603,7 @@ def pthread_check()
if TclConfig_Info['config_file_path']
if tcl_enable_thread == true
- puts("Warning: definition of tclConfig.sh is ignored, because --enable-tcl-thread option is given.")
+ puts("Warning: definiton of tclConfig.sh is ignored, because --enable-tcl-thread option is given.")
elsif tcl_enable_thread == false
puts("Warning: definition of tclConfig.sh is ignored, because --disable-tcl-thread option is given.")
else
@@ -1796,9 +1752,7 @@ print("check functions.")
%w"ruby_native_thread_p rb_errinfo rb_safe_level rb_hash_lookup
rb_proc_new rb_obj_untrust rb_obj_taint rb_set_safe_level_force
- rb_sourcefile rb_thread_alive_p rb_thread_check_trap_pending
- ruby_enc_find_basename
-".each do |func|
+ rb_sourcefile rb_thread_alive_p rb_thread_check_trap_pending".each do |func|
have_func(func, "ruby.h")
print(".") # progress
end
@@ -2006,7 +1960,7 @@ $defs += collect_tcltk_defs(TclConfig_Info['TCL_DEFS'], TkConfig_Info['TK_DEFS']
# MacOS X Frameworks?
if TkLib_Config["tcltk-framework"]
puts("Use MacOS X Frameworks.")
- ($LDFLAGS ||= "") << " " << libpathflag([TkLib_Config["tcl-build-dir"]]) if TkLib_Config["tcl-build-dir"]
+ ($LDFLAGS ||= "") << " -L#{TkLib_Config["tcl-build-dir"].quote} -Wl,-R#{TkLib_Config["tcl-build-dir"].quote}" if TkLib_Config["tcl-build-dir"]
libs = ''
if tcl_cfg_dir
@@ -2032,7 +1986,7 @@ if TkLib_Config["tcltk-framework"]
end
end
- libs << " " << libpathflag([TkLib_Config["tk-build-dir"]]) if TkLib_Config["tk-build-dir"]
+ libs << " -L#{TkLib_Config["tk-build-dir"].quote} -Wl,-R#{TkLib_Config["tk-build-dir"].quote}" if TkLib_Config["tk-build-dir"]
if tk_cfg_dir
TkConfig_Info['TK_LIBS'] ||= ""
diff --git a/ext/tk/lib/README b/ext/tk/lib/README
index df1c7906ea..c076755756 100644
--- a/ext/tk/lib/README
+++ b/ext/tk/lib/README
@@ -23,7 +23,7 @@ tkfont.rb Tk font support
tkmacpkg.rb Mac resource support
tkmenubar.rb TK menubar utility
tkmngfocus.rb focus manager
-tkpalette.rb palette support
+tkpalette.rb pallete support
tkscrollbox.rb scroll box, also example of compound widget
tktext.rb text classes
tkvirtevent.rb virtual event support
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index a5759c70cc..68bd849670 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# multi-tk.rb - supports multi Tk interpreters
# by Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -149,7 +148,7 @@ class MultiTkIp
end
def delete(idx, &blk)
- # if gets an entry, is permitted to delete
+ # if gets an entry, is permited to delete
if self[idx]
@tbl.delete(idx)
elsif blk
@@ -1266,6 +1265,14 @@ class MultiTkIp
######################################
def initialize(master, safeip=true, keys={})
+ if $SAFE >= 4
+ fail SecurityError, "cannot create a new interpreter at level #{$SAFE}"
+ end
+
+ if safeip == nil && $SAFE >= 2
+ fail SecurityError, "cannot create a master-ip at level #{$SAFE}"
+ end
+
if master.deleted? && safeip == nil
fail RuntimeError, "cannot create a slave of a deleted interpreter"
end
@@ -1300,7 +1307,7 @@ class MultiTkIp
name, safe, safe_opts, tk_opts = _parse_slaveopts(keys)
- safe = 1 if safe && !safe.kind_of?(Fixnum)
+ safe = 4 if safe && !safe.kind_of?(Fixnum)
@safe_base = false
@@ -1416,7 +1423,7 @@ class MultiTkIp
safe = master.safe_level if safe < master.safe_level
@safe_level = [safe]
else
- @safe_level = [1]
+ @safe_level = [4]
end
else
@interp, @ip_name = master.__create_trusted_slave_obj(name, tk_opts)
@@ -1483,17 +1490,17 @@ class MultiTkIp
begin
@interp._eval("::safe::disallowTk #{slave}")
rescue
- warn("Warning: fail to call '::safe::disallowTk'") if $DEBUG
+ warn("Waring: fail to call '::safe::disallowTk'") if $DEBUG
end
else # toplevel path
begin
@interp._eval("::safe::tkDelete {} #{top} #{slave}")
rescue
- warn("Warning: fail to call '::safe::tkDelete'") if $DEBUG
+ warn("Waring: fail to call '::safe::tkDelete'") if $DEBUG
begin
@interp._eval("destroy #{top}")
rescue
- warn("Warning: fail to destroy toplevel") if $DEBUG
+ warn("Waring: fail to destroy toplevel") if $DEBUG
end
end
end
@@ -1608,7 +1615,7 @@ class << MultiTkIp
end
alias new_trusted_slave new_slave
- def new_safe_slave(safe=1, keys={}, &blk)
+ def new_safe_slave(safe=4, keys={}, &blk)
if safe.kind_of?(Hash)
keys = safe
elsif safe.kind_of?(Integer)
@@ -2468,7 +2475,7 @@ end
# event loop
-# all master/slave IPs are controlled by only one event-loop
+# all master/slave IPs are controled by only one event-loop
class MultiTkIp
def self.default_master?
__getip == @@DEFAULT_MASTER
@@ -2747,9 +2754,13 @@ class MultiTkIp
if @wait_on_mainloop[0]
begin
@wait_on_mainloop[1] += 1
- @cmd_queue.enq([@system, 'call_mainloop',
- Thread.current, check_root])
- Thread.stop
+ if $SAFE >= 4
+ _receiver_mainloop(check_root).join
+ else
+ @cmd_queue.enq([@system, 'call_mainloop',
+ Thread.current, check_root])
+ Thread.stop
+ end
rescue MultiTkIp_OK => ret
# return value
if ret.value.kind_of?(Thread)
diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb
index 165e6587fd..443d66010c 100644
--- a/ext/tk/lib/remote-tk.rb
+++ b/ext/tk/lib/remote-tk.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# remote-tk.rb - supports to control remote Tk interpreters
# by Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -62,6 +61,10 @@ end
class RemoteTkIp
def initialize(remote_ip, displayof=nil, timeout=5)
+ if $SAFE >= 4
+ fail SecurityError, "cannot access another interpreter at level #{$SAFE}"
+ end
+
@interp = MultiTkIp.__getip
if @interp.safe?
fail SecurityError, "safe-IP cannot create RemoteTkIp"
@@ -196,7 +199,9 @@ class RemoteTkIp
raise SecurityError, "no permission to manipulate" unless self.manipulable?
p ['_appsend', [@remote, @displayof], enc_mode, async, cmds] if $DEBUG
- if $SAFE >= 1 && cmds.find{|obj| obj.tainted?}
+ if $SAFE >= 4
+ fail SecurityError, "cannot send commands at level 4"
+ elsif $SAFE >= 1 && cmds.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted commands at level #{$SAFE}"
end
diff --git a/ext/tk/lib/tcltk.rb b/ext/tk/lib/tcltk.rb
index 7796bb86ef..48ec1df09a 100644
--- a/ext/tk/lib/tcltk.rb
+++ b/ext/tk/lib/tcltk.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# tof
#### tcltk library, more direct manipulation of tcl/tk
@@ -326,7 +325,7 @@ class TclTkCallback < TclTkObject
TclTk._addcallback(self)
end
- # to_eval(): returns string representation for @ip._eval_args
+ # to_eval(): retuens string representation for @ip._eval_args
def to_eval()
if @arg
# bind replaces %s before calling ruby_fmt, so %%s is used
@@ -350,7 +349,7 @@ class TclTkImage < TclTkCommand
# initialize(interp, t, *args):
# generating image is done by TclTkImage.new()
- # destroying is done by image delete (inconsistent, sigh)
+ # destrying is done by image delete (inconsistent, sigh)
# interp: interpreter(TclTkInterpreter)
# t: image type (photo, bitmap, etc.)
# *args: command argument
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 7fe2fb0878..5bac92e47c 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk.rb - Tk interface module using tcltklib
# by Yukihiro Matsumoto <matz@netlab.jp>
@@ -1310,12 +1309,8 @@ EOS
end
unless interp.deleted?
- begin
- #Thread.current[:status].value = TclTkLib.mainloop(false)
- Thread.current[:status].value = interp.mainloop(false)
- rescue Exception=>e
- puts "ignore exception on interp: #{e.inspect}\n" if $DEBUG
- end
+ #Thread.current[:status].value = TclTkLib.mainloop(false)
+ Thread.current[:status].value = interp.mainloop(false)
end
ensure
@@ -1574,15 +1569,7 @@ EOS
EOL
=end
- if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
- at_exit{ INTERP.remove_tk_procs(TclTkLib::FINALIZE_PROC_NAME) }
- else
- at_exit{
- Tk.root.destroy
- INTERP.remove_tk_procs(TclTkLib::FINALIZE_PROC_NAME)
- INTERP_THREAD.kill.join
- }
- end
+ at_exit{ INTERP.remove_tk_procs(TclTkLib::FINALIZE_PROC_NAME) }
EventFlag = TclTkLib::EventFlag
@@ -1786,7 +1773,9 @@ EOS
end
def appsend(interp, async, *args)
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
+ if $SAFE >= 4
+ fail SecurityError, "cannot send Tk commands at level 4"
+ elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
end
if async != true && async != false && async != nil
@@ -1801,7 +1790,9 @@ EOS
end
def rb_appsend(interp, async, *args)
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
+ if $SAFE >= 4
+ fail SecurityError, "cannot send Ruby commands at level 4"
+ elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
end
if async != true && async != false && async != nil
@@ -1817,7 +1808,9 @@ EOS
end
def appsend_displayof(interp, win, async, *args)
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
+ if $SAFE >= 4
+ fail SecurityError, "cannot send Tk commands at level 4"
+ elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
end
win = '.' if win == nil
@@ -1833,7 +1826,9 @@ EOS
end
def rb_appsend_displayof(interp, win, async, *args)
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
+ if $SAFE >= 4
+ fail SecurityError, "cannot send Ruby commands at level 4"
+ elsif $SAFE >= 1 && args.find{|obj| obj.tainted?}
fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
end
win = '.' if win == nil
@@ -1892,7 +1887,7 @@ EOS
INTERP_ROOT_CHECK.wait(INTERP_MUTEX)
status = INTERP_THREAD_STATUS.value
if status && TkCore::INTERP.default_master?
- INTERP_THREAD_STATUS.value = nil
+ INTERP_THREAD_STATUS.value = nil if $SAFE < 4
raise status if status.kind_of?(Exception)
end
}
@@ -2202,6 +2197,9 @@ module Tk
# tk_split_simplelist(INTERP._invoke('set', 'tcl_libPath'))
when :PLATFORM, :TCL_PLATFORM
+ if $SAFE >= 4
+ fail SecurityError, "can't get #{sym} when $SAFE >= 4"
+ end
INTERP._invoke_without_enc('global', 'tcl_platform')
Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get',
'tcl_platform'))]
@@ -3736,6 +3734,7 @@ module TkConfigMethod
@mode || false
end
def TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
+ fail SecurityError, "can't change the mode" if $SAFE>=4
@mode = (mode)? true: false
end
@@ -5198,8 +5197,6 @@ class TkWindow<TkObject
TkWinfo.exist?(self)
end
- alias subcommand tk_send
-
def bind_class
@db_class || self.class()
end
@@ -5639,6 +5636,9 @@ class TkWindow<TkObject
end
def wait_visibility(on_thread = true)
+ if $SAFE >= 4
+ fail SecurityError, "can't wait visibility at $SAFE >= 4"
+ end
on_thread &= (Thread.list.size != 1)
if on_thread
INTERP._thread_tkwait('visibility', path)
@@ -5662,6 +5662,9 @@ class TkWindow<TkObject
alias thread_tkwait_visibility thread_wait_visibility
def wait_destroy(on_thread = true)
+ if $SAFE >= 4
+ fail SecurityError, "can't wait destroy at $SAFE >= 4"
+ end
on_thread &= (Thread.list.size != 1)
if on_thread
INTERP._thread_tkwait('window', epath)
@@ -5739,7 +5742,7 @@ TkWidget = TkWindow
#Tk.freeze
module Tk
- RELEASE_DATE = '2014-10-19'.freeze
+ RELEASE_DATE = '2010-06-03'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
diff --git a/ext/tk/lib/tk/after.rb b/ext/tk/lib/tk/after.rb
index 3213a6b818..8c58210331 100644
--- a/ext/tk/lib/tk/after.rb
+++ b/ext/tk/lib/tk/after.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/after.rb : methods for Tcl/Tk after command
#
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index 3d19fb053d..f6ca261da9 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# autoload
#
@@ -95,8 +94,6 @@ module Tk
autoload :Y_Scrollable, 'tk/scrollable'
autoload :Scrollable, 'tk/scrollable'
- autoload :Fontchooser, 'tk/fontchooser'
-
autoload :Wm, 'tk/wm'
autoload :Wm_for_General, 'tk/wm'
diff --git a/ext/tk/lib/tk/bgerror.rb b/ext/tk/lib/tk/bgerror.rb
index 9d2f59357e..c82a8e046b 100644
--- a/ext/tk/lib/tk/bgerror.rb
+++ b/ext/tk/lib/tk/bgerror.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkbgerror -- bgerror ( tkerror ) module
# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/lib/tk/bindtag.rb b/ext/tk/lib/tk/bindtag.rb
index ad3c90b505..23b4e0b7c3 100644
--- a/ext/tk/lib/tk/bindtag.rb
+++ b/ext/tk/lib/tk/bindtag.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/bind.rb : control event binding
#
diff --git a/ext/tk/lib/tk/busy.rb b/ext/tk/lib/tk/busy.rb
index 18ebede9dd..7f4f89f524 100644
--- a/ext/tk/lib/tk/busy.rb
+++ b/ext/tk/lib/tk/busy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/busy.rb: support 'tk busy' command (Tcl/Tk8.6 or later)
#
diff --git a/ext/tk/lib/tk/button.rb b/ext/tk/lib/tk/button.rb
index dc252d8e82..65233c91b6 100644
--- a/ext/tk/lib/tk/button.rb
+++ b/ext/tk/lib/tk/button.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/button.rb : treat button widget
#
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index d707733d8c..af404213e7 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/canvas.rb - Tk canvas classes
# by Yukihiro Matsumoto <matz@caelum.co.jp>
@@ -78,7 +77,7 @@ class Tk::Canvas<TkWindow
if tag.kind_of?(TkcItem) || tag.kind_of?(TkcTag)
tag.id
else
- tag # maybe an Array of configure parameters
+ tag # maybe an Array of configure paramters
end
end
private :tagid
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
index 4a14cd78a9..495d92a9a8 100644
--- a/ext/tk/lib/tk/canvastag.rb
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/canvastag.rb - methods for treating canvas tags
#
diff --git a/ext/tk/lib/tk/checkbutton.rb b/ext/tk/lib/tk/checkbutton.rb
index 521b015b3e..b7449541c5 100644
--- a/ext/tk/lib/tk/checkbutton.rb
+++ b/ext/tk/lib/tk/checkbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/checkbutton.rb : treat checkbutton widget
#
diff --git a/ext/tk/lib/tk/clipboard.rb b/ext/tk/lib/tk/clipboard.rb
index c5f481f979..d4205a5c28 100644
--- a/ext/tk/lib/tk/clipboard.rb
+++ b/ext/tk/lib/tk/clipboard.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/clipboard.rb : methods to treat clipboard
#
diff --git a/ext/tk/lib/tk/clock.rb b/ext/tk/lib/tk/clock.rb
index df900d7364..4e9438f5ab 100644
--- a/ext/tk/lib/tk/clock.rb
+++ b/ext/tk/lib/tk/clock.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/clock.rb : methods for clock command
#
diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb
index 830d383d69..e267c7a22b 100644
--- a/ext/tk/lib/tk/composite.rb
+++ b/ext/tk/lib/tk/composite.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/composite.rb :
#
diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb
index c560912da8..64e257594c 100644
--- a/ext/tk/lib/tk/console.rb
+++ b/ext/tk/lib/tk/console.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/console.rb : control the console on system without a real console
#
diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb
index 0b19be7cfa..7ef7820699 100644
--- a/ext/tk/lib/tk/dialog.rb
+++ b/ext/tk/lib/tk/dialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/dialog.rb : create dialog boxes
#
diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb
index 9ca13b3d1a..59fbb1911d 100644
--- a/ext/tk/lib/tk/encodedstr.rb
+++ b/ext/tk/lib/tk/encodedstr.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/encodedstr.rb : Tk::EncodedString class
#
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
index aa40e4755c..d4aa03f2b6 100644
--- a/ext/tk/lib/tk/entry.rb
+++ b/ext/tk/lib/tk/entry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/entry.rb - Tk entry classes
# by Yukihiro Matsumoto <matz@caelum.co.jp>
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index 5658e92874..bf4e122322 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/event.rb - module for event
#
diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb
index 7a2a549849..03db850f96 100644
--- a/ext/tk/lib/tk/font.rb
+++ b/ext/tk/lib/tk/font.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/font.rb - the class to treat fonts on Ruby/Tk
#
diff --git a/ext/tk/lib/tk/fontchooser.rb b/ext/tk/lib/tk/fontchooser.rb
index 325ca4dbd2..694c58a607 100644
--- a/ext/tk/lib/tk/fontchooser.rb
+++ b/ext/tk/lib/tk/fontchooser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/fontchooser.rb -- "tk fontchooser" support (Tcl/Tk8.6 or later)
#
@@ -9,10 +8,6 @@ module TkFont::Chooser
extend TkCore
end
-module Tk
- Fontchooser = TkFont::Chooser
-end
-
class << TkFont::Chooser
def method_missing(id, *args)
name = id.id2name
@@ -52,7 +47,7 @@ class << TkFont::Chooser
tk_tcl2ruby(val)
when 'visible'
bool(val)
- else # unknown
+ else # unkown
val
end
end
diff --git a/ext/tk/lib/tk/frame.rb b/ext/tk/lib/tk/frame.rb
index 0682faf3fe..5118939732 100644
--- a/ext/tk/lib/tk/frame.rb
+++ b/ext/tk/lib/tk/frame.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/frame.rb : treat frame widget
#
diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb
index 5a4a26403a..e1e07c44fa 100644
--- a/ext/tk/lib/tk/grid.rb
+++ b/ext/tk/lib/tk/grid.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/grid.rb : control grid geometry manager
#
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index ec23e495d0..972383982f 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/image.rb : treat Tk image objects
#
diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb
index e615fa0950..14396048ba 100644
--- a/ext/tk/lib/tk/itemconfig.rb
+++ b/ext/tk/lib/tk/itemconfig.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/itemconfig.rb : control item/tag configuration of widget
#
@@ -125,6 +124,7 @@ module TkItemConfigMethod
@mode || false
end
def TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
+ fail SecurityError, "can't change the mode" if $SAFE>=4
@mode = (mode)? true: false
end
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
index 92f75ac388..b5da4fa1ef 100644
--- a/ext/tk/lib/tk/itemfont.rb
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/itemfont.rb : control font of widget items
#
diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb
index 6d2b3d7a7a..b63f756def 100644
--- a/ext/tk/lib/tk/kinput.rb
+++ b/ext/tk/lib/tk/kinput.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/kinput.rb : control kinput
#
diff --git a/ext/tk/lib/tk/label.rb b/ext/tk/lib/tk/label.rb
index 48f67deb31..05e430e49b 100644
--- a/ext/tk/lib/tk/label.rb
+++ b/ext/tk/lib/tk/label.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/label.rb : treat label widget
#
diff --git a/ext/tk/lib/tk/labelframe.rb b/ext/tk/lib/tk/labelframe.rb
index f9497dc2f0..6f679e55b5 100644
--- a/ext/tk/lib/tk/labelframe.rb
+++ b/ext/tk/lib/tk/labelframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/labelframe.rb : treat labelframe widget
#
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb
index df4d422007..6742b2132c 100644
--- a/ext/tk/lib/tk/listbox.rb
+++ b/ext/tk/lib/tk/listbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/listbox.rb : treat listbox widget
#
diff --git a/ext/tk/lib/tk/macpkg.rb b/ext/tk/lib/tk/macpkg.rb
index abf9b176fb..3ca7953c13 100644
--- a/ext/tk/lib/tk/macpkg.rb
+++ b/ext/tk/lib/tk/macpkg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/macpkg.rb : methods for Tcl/Tk packages for Macintosh
# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index 16347a98ea..bcd250026d 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/menu.rb : treat menu and menubutton
#
diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb
index 6c5df6b1c2..9d5571c470 100644
--- a/ext/tk/lib/tk/menubar.rb
+++ b/ext/tk/lib/tk/menubar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/menubar.rb
#
@@ -77,7 +76,7 @@
# 'tearoff'=>false,
# 'foreground'=>'grey40',
# 'activeforeground'=>'red',
-# 'font'=>'Helvetica 12 bold')
+# 'font'=>'Helvetia 12 bold')
# menubar.pack('side'=>'top', 'fill'=>'x')
# See tk/menuspce.rb about the format of the menu_spec
diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb
index 2de62242ff..cb3597eec9 100644
--- a/ext/tk/lib/tk/menuspec.rb
+++ b/ext/tk/lib/tk/menuspec.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/menuspec.rb
# Hidethoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tk/message.rb b/ext/tk/lib/tk/message.rb
index 432e9667bd..5f73b3066f 100644
--- a/ext/tk/lib/tk/message.rb
+++ b/ext/tk/lib/tk/message.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/message.rb : treat message widget
#
diff --git a/ext/tk/lib/tk/mngfocus.rb b/ext/tk/lib/tk/mngfocus.rb
index 06b20eb6ab..a05fb94f8e 100644
--- a/ext/tk/lib/tk/mngfocus.rb
+++ b/ext/tk/lib/tk/mngfocus.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/mngfocus.rb : methods for Tcl/Tk standard library 'focus.tcl'
# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index 1e98889faf..4abbcad85e 100644
--- a/ext/tk/lib/tk/msgcat.rb
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/msgcat.rb : methods for Tcl message catalog
# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
@@ -126,8 +125,6 @@ class TkMsgCatalog < TkObject
when 2 # src and trans, or, trans_list and enc
if args[0].kind_of?(Array)
- # trans_list
- self.set_translation_list(loc, *args)
else
#self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
self.set_translation(loc, *args)
@@ -202,11 +199,7 @@ class TkMsgCatalog < TkObject
file = File.join(dir, loc + self::MSGCAT_EXT)
if File.readable?(file)
count += 1
- if TkCore::WITH_ENCODING
- eval(IO.read(file, :encoding=>"ASCII-8BIT"))
- else
- eval(IO.read(file))
- end
+ eval(open(file){|f| f.read})
end
}
count
@@ -222,11 +215,7 @@ class TkMsgCatalog < TkObject
file = File.join(dir, loc + @msgcat_ext)
if File.readable?(file)
count += 1
- if TkCore::WITH_ENCODING
- @namespace.eval(IO.read(file, :encoding=>"ASCII-8BIT"))
- else
- @namespace.eval(IO.read(file))
- end
+ @namespace.eval(open(file){|f| f.read})
end
}
count
@@ -240,21 +229,30 @@ class TkMsgCatalog < TkObject
def self.set_translation(locale, src_str, trans_str=None, enc='utf-8')
if trans_str && trans_str != None
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
- Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}"))
+ Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true),
+ trans_str))
else
- Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}"))
+ Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true)))
end
end
def set_translation(locale, src_str, trans_str=None, enc='utf-8')
if trans_str && trans_str != None
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
Tk.UTF8_String(@namespace.eval{
- ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}")
+ tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true),
+ trans_str)
})
else
Tk.UTF8_String(@namespace.eval{
- ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}")
- })
+ tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true))})
end
end
@@ -264,13 +262,12 @@ class TkMsgCatalog < TkObject
trans_list.each{|src, trans|
if trans && trans != None
list << _get_eval_string(src, true)
- list << Tk.UTF8_String(_toUTF8(trans, enc))
+ list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
else
list << _get_eval_string(src, true) << ''
end
}
- #number(tk_call_without_enc('::msgcat::mcmset', locale, list))
- number(ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}"))
+ number(tk_call_without_enc('::msgcat::mcmset', locale, list))
end
def set_translation_list(locale, trans_list, enc='utf-8')
# trans_list ::= [ [src, trans], [src, trans], ... ]
@@ -284,8 +281,7 @@ class TkMsgCatalog < TkObject
end
}
number(@namespace.eval{
- #tk_call_without_enc('::msgcat::mcmset', locale, list)
- ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}")
+ tk_call_without_enc('::msgcat::mcmset', locale, list)
})
end
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index 1cab6fa060..4af891995e 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/namespace.rb : methods to manipulate Tcl/Tk namespace
# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
@@ -326,7 +325,12 @@ class TkNamespace < TkObject
def code(script = Proc.new)
if script.kind_of?(String)
cmd = proc{|*args|
- ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
+ if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
+ obj = ScopeArgs.new(@fullname,*args)
+ ret = obj.instance_exec(obj, script)
+ else
+ ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
+ end
id = ret.object_id
TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
id
diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb
index b27a5e5721..0f3be30ff7 100644
--- a/ext/tk/lib/tk/optiondb.rb
+++ b/ext/tk/lib/tk/optiondb.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/optiondb.rb : treat option database
#
@@ -23,9 +22,15 @@ module TkOptionDB
end
def add(pat, value, pri=None)
+ # if $SAFE >= 4
+ # fail SecurityError, "can't call 'TkOptionDB.add' at $SAFE >= 4"
+ # end
tk_call('option', 'add', pat, value, pri)
end
def clear
+ # if $SAFE >= 4
+ # fail SecurityError, "can't call 'TkOptionDB.crear' at $SAFE >= 4"
+ # end
tk_call_without_enc('option', 'clear')
end
def get(win, name, klass)
diff --git a/ext/tk/lib/tk/optionobj.rb b/ext/tk/lib/tk/optionobj.rb
index 4219e4be71..29b06da0eb 100644
--- a/ext/tk/lib/tk/optionobj.rb
+++ b/ext/tk/lib/tk/optionobj.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/optionobj.rb : control options for a group of widgets
#
diff --git a/ext/tk/lib/tk/pack.rb b/ext/tk/lib/tk/pack.rb
index 45926d4043..220a38e524 100644
--- a/ext/tk/lib/tk/pack.rb
+++ b/ext/tk/lib/tk/pack.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/pack.rb : control pack geometry manager
#
diff --git a/ext/tk/lib/tk/package.rb b/ext/tk/lib/tk/package.rb
index fe6939c2d4..0c329732f5 100644
--- a/ext/tk/lib/tk/package.rb
+++ b/ext/tk/lib/tk/package.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/package.rb : package command
#
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
index e118e8dbe5..9462bb0667 100644
--- a/ext/tk/lib/tk/palette.rb
+++ b/ext/tk/lib/tk/palette.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/palette.rb : methods for Tcl/Tk standard library 'palette.tcl'
# 1998/06/21 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb
index 285292f018..04407802ea 100644
--- a/ext/tk/lib/tk/panedwindow.rb
+++ b/ext/tk/lib/tk/panedwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/panedwindow.rb : treat panedwindow
#
diff --git a/ext/tk/lib/tk/place.rb b/ext/tk/lib/tk/place.rb
index efda36df5e..109d866fda 100644
--- a/ext/tk/lib/tk/place.rb
+++ b/ext/tk/lib/tk/place.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/place.rb : control place geometry manager
#
diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb
index b0858df2b4..627df6d9cf 100644
--- a/ext/tk/lib/tk/radiobutton.rb
+++ b/ext/tk/lib/tk/radiobutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/radiobutton.rb : treat radiobutton widget
#
diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb
index 3fb7c472d3..b4f0bd107f 100644
--- a/ext/tk/lib/tk/root.rb
+++ b/ext/tk/lib/tk/root.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/root.rb : treat root widget
#
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
index f6f60e3c25..0bdcead7f2 100644
--- a/ext/tk/lib/tk/scale.rb
+++ b/ext/tk/lib/tk/scale.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/scale.rb : treat scale widget
#
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb
index e9b4a93d6d..96959b7a4b 100644
--- a/ext/tk/lib/tk/scrollable.rb
+++ b/ext/tk/lib/tk/scrollable.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/scrollable.rb : module for scrollable widget
#
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb
index c16ed38756..c0ac201acb 100644
--- a/ext/tk/lib/tk/scrollbar.rb
+++ b/ext/tk/lib/tk/scrollbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/scrollbar.rb : treat scrollbar widget
#
diff --git a/ext/tk/lib/tk/scrollbox.rb b/ext/tk/lib/tk/scrollbox.rb
index a470765d7c..d20742a666 100644
--- a/ext/tk/lib/tk/scrollbox.rb
+++ b/ext/tk/lib/tk/scrollbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/scrollbox.rb - Tk Listbox with Scrollbar
# as an example of Composite Widget
diff --git a/ext/tk/lib/tk/selection.rb b/ext/tk/lib/tk/selection.rb
index 085d8b2d2d..ba0a6f49f9 100644
--- a/ext/tk/lib/tk/selection.rb
+++ b/ext/tk/lib/tk/selection.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/selection.rb : control selection
#
diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
index 4be41c4266..f2917d60ca 100644
--- a/ext/tk/lib/tk/spinbox.rb
+++ b/ext/tk/lib/tk/spinbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/spinbox.rb - Tk spinbox classes
# by Yukihiro Matsumoto <matz@caelum.co.jp>
diff --git a/ext/tk/lib/tk/tagfont.rb b/ext/tk/lib/tk/tagfont.rb
index e3fd60465c..a1807395d2 100644
--- a/ext/tk/lib/tk/tagfont.rb
+++ b/ext/tk/lib/tk/tagfont.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/tagfont.rb : control font of tags
#
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index fc4f112933..bc2aa0a293 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/text.rb - Tk text classes
# by Yukihiro Matsumoto <matz@caelum.co.jp>
@@ -353,7 +352,7 @@ class Tk::Text<TkTextWin
|| tag.kind_of?(TkTextWindow)
tag.id
else
- tag # maybe an Array of configure parameters
+ tag # maybe an Array of configure paramters
end
end
private :tagid
diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb
index f7329c5dcc..99027a06fb 100644
--- a/ext/tk/lib/tk/textimage.rb
+++ b/ext/tk/lib/tk/textimage.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/textimage.rb - treat Tk text image object
#
diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb
index 80945cc70c..d1888c5e54 100644
--- a/ext/tk/lib/tk/textmark.rb
+++ b/ext/tk/lib/tk/textmark.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/textmark.rb - methods for treating text marks
#
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index 9f11c6539b..96692014e4 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/texttag.rb - methods for treating text tags
#
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index e0be5bac7a..49327b2c81 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/textwindow.rb - treat Tk text window object
#
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index 794463aab1..ddfbfce9be 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/timer.rb : methods for Tcl/Tk after command
#
@@ -499,6 +498,10 @@ class TkTimer
end
def wait(on_thread = true, check_root = false)
+ if $SAFE >= 4
+ fail SecurityError, "can't wait timer at $SAFE >= 4"
+ end
+
unless @running
if @return_value.kind_of?(Exception)
fail @return_value
diff --git a/ext/tk/lib/tk/tk_mac.rb b/ext/tk/lib/tk/tk_mac.rb
deleted file mode 100644
index ed90fd1c67..0000000000
--- a/ext/tk/lib/tk/tk_mac.rb
+++ /dev/null
@@ -1,159 +0,0 @@
-# frozen_string_literal: false
-#
-# tk/tk_mac.rb : Access Mac-Specific functionality on OS X from Tk
-# (supported by Tk8.6 or later)
-#
-# ATTENTION !!
-# This is NOT TESTED. Because I have no test-environment.
-#
-require 'tk'
-
-module Tk
- module Mac
- end
-end
-
-module Tk::Mac
- extend TkCore
-
- # event handler callbacks
- def self.def_ShowPreferences(cmd=Proc.new)
- ip_eval("proc ::tk::mac::ShowPreferences {} { #{install_cmd(cmd)} }")
- nil
- end
-
- def self.def_OpenApplication(cmd=Proc.new)
- ip_eval("proc ::tk::mac::OpenApplication {} { #{install_cmd(cmd)} }")
- nil
- end
-
- def self.def_ReopenApplication(cmd=Proc.new)
- ip_eval("proc ::tk::mac::ReopenApplication {} { #{install_cmd(cmd)} }")
- nil
- end
-
- def self.def_OpenDocument(cmd=Proc.new)
- ip_eval("proc ::tk::mac::OpenDocument {args} { eval #{install_cmd(cmd)} $args }")
- nil
- end
-
- def self.def_PrintDocument(cmd=Proc.new)
- ip_eval("proc ::tk::mac::PrintDocument {args} { eval #{install_cmd(cmd)} $args }")
- nil
- end
-
- def self.def_Quit(cmd=Proc.new)
- ip_eval("proc ::tk::mac::Quit {} { #{install_cmd(cmd)} }")
- nil
- end
-
- def self.def_OnHide(cmd=Proc.new)
- ip_eval("proc ::tk::mac::OnHide {} { #{install_cmd(cmd)} }")
- nil
- end
-
- def self.def_OnShow(cmd=Proc.new)
- ip_eval("proc ::tk::mac::OnShow {} { #{install_cmd(cmd)} }")
- nil
- end
-
- def self.def_ShowHelp(cmd=Proc.new)
- ip_eval("proc ::tk::mac::ShowHelp {} { #{install_cmd(cmd)} }")
- nil
- end
-
-
- # additional dialogs
- def self.standardAboutPanel
- tk_call('::tk::mac::standardAboutPanel')
- nil
- end
-
-
- # system configuration
- def self.useCompatibilityMetrics(mode)
- tk_call('::tk::mac::useCompatibilityMetrics', mode)
- nil
- end
-
- def self.CGAntialiasLimit(limit)
- tk_call('::tk::mac::CGAntialiasLimit', limit)
- nil
- end
-
- def self.antialiasedtext(num)
- tk_call('::tk::mac::antialiasedtext', num)
- nil
- end
-
- def self.useThemedToplevel(mode)
- tk_call('::tk::mac::useThemedToplevel', mode)
- nil
- end
-
-end
-
-class Tk::Mac::IconBitmap < TkImage
- TkCommandNames = ['::tk::mac::iconBitmap'].freeze
-
- def self.new(width, height, keys)
- if keys.kind_of?(Hash)
- name = nil
- if keys.key?(:imagename)
- name = keys[:imagename]
- elsif keys.key?('imagename')
- name = keys['imagename']
- end
- if name
- if name.kind_of?(TkImage)
- obj = name
- else
- name = _get_eval_string(name)
- obj = nil
- Tk_IMGTBL.mutex.synchronize{
- obj = Tk_IMGTBL[name]
- }
- end
- if obj
- if !(keys[:without_creating] || keys['without_creating'])
- keys = _symbolkey2str(keys)
- keys.delete('imagename')
- keys.delete('without_creating')
- obj.instance_eval{
- tk_call_without_enc('::tk::mac::iconBitmap',
- @path, width, height, *hash_kv(keys, true))
- }
- end
- return obj
- end
- end
- end
- (obj = self.allocate).instance_eval{
- Tk_IMGTBL.mutex.synchronize{
- initialize(width, height, keys)
- Tk_IMGTBL[@path] = self
- }
- }
- obj
- end
-
- def initialize(width, height, keys)
- @path = nil
- without_creating = false
- if keys.kind_of?(Hash)
- keys = _symbolkey2str(keys)
- @path = keys.delete('imagename')
- without_creating = keys.delete('without_creating')
- end
- unless @path
- Tk_Image_ID.mutex.synchronize{
- @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
- Tk_Image_ID[1].succ!
- }
- end
- unless without_creating
- tk_call_without_enc('::tk::mac::iconBitmap',
- @path, width, height, *hash_kv(keys, true))
- end
- end
-end
diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb
index e66b0fc1be..30ef009517 100644
--- a/ext/tk/lib/tk/toplevel.rb
+++ b/ext/tk/lib/tk/toplevel.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/toplevel.rb : treat toplevel widget
#
diff --git a/ext/tk/lib/tk/ttk_selector.rb b/ext/tk/lib/tk/ttk_selector.rb
index 4589e7fc29..cc9e9928cb 100644
--- a/ext/tk/lib/tk/ttk_selector.rb
+++ b/ext/tk/lib/tk/ttk_selector.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ttk_selector
#
diff --git a/ext/tk/lib/tk/txtwin_abst.rb b/ext/tk/lib/tk/txtwin_abst.rb
index 3c9beef6c4..540f806d17 100644
--- a/ext/tk/lib/tk/txtwin_abst.rb
+++ b/ext/tk/lib/tk/txtwin_abst.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/txtwin_abst.rb : TkTextWin abstruct class
#
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index c6cbfb280e..0ebd5c51b7 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/validation.rb - validation support module for entry, spinbox, and so on
#
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index 8ac0fc6ace..0487b034bd 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/variable.rb : treat Tk variable object
#
@@ -361,6 +360,9 @@ class TkVariable
end
def wait(on_thread = false, check_root = false)
+ if $SAFE >= 4
+ fail SecurityError, "can't wait variable at $SAFE >= 4"
+ end
on_thread &= (Thread.list.size != 1)
if on_thread
if check_root
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
index de3c33da36..c11e9692e7 100644
--- a/ext/tk/lib/tk/virtevent.rb
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/virtevent.rb : treats virtual events
# 1998/07/16 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb
index 36f32e5952..b10cfe6760 100644
--- a/ext/tk/lib/tk/winfo.rb
+++ b/ext/tk/lib/tk/winfo.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/winfo.rb : methods for winfo command
#
diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb
index 2a8f724bef..80e0439ace 100644
--- a/ext/tk/lib/tk/winpkg.rb
+++ b/ext/tk/lib/tk/winpkg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/winpkg.rb : methods for Tcl/Tk packages for Microsoft Windows
# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
index 114ba24276..fcd5a2cbd2 100644
--- a/ext/tk/lib/tk/wm.rb
+++ b/ext/tk/lib/tk/wm.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/wm.rb : methods for wm command
#
diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb
index 7e77591b45..c0126c5175 100644
--- a/ext/tk/lib/tk/xim.rb
+++ b/ext/tk/lib/tk/xim.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tk/xim.rb : control imput_method
#
diff --git a/ext/tk/lib/tkafter.rb b/ext/tk/lib/tkafter.rb
index 0ce5049d4a..f65945884c 100644
--- a/ext/tk/lib/tkafter.rb
+++ b/ext/tk/lib/tkafter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkafter.rb - load tk/after.rb
#
diff --git a/ext/tk/lib/tkbgerror.rb b/ext/tk/lib/tkbgerror.rb
index 875f3fef2f..deba7a57fa 100644
--- a/ext/tk/lib/tkbgerror.rb
+++ b/ext/tk/lib/tkbgerror.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkbgerror.rb - load tk/bgerror.rb
#
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb
index d4d0afac9e..9524614291 100644
--- a/ext/tk/lib/tkcanvas.rb
+++ b/ext/tk/lib/tkcanvas.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkcanvas.rb - load tk/canvas.rb
#
diff --git a/ext/tk/lib/tkclass.rb b/ext/tk/lib/tkclass.rb
index 947cbf3a4a..87f5acc453 100644
--- a/ext/tk/lib/tkclass.rb
+++ b/ext/tk/lib/tkclass.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkclass.rb - Tk classes
# Date: 2000/11/27 09:23:36
diff --git a/ext/tk/lib/tkconsole.rb b/ext/tk/lib/tkconsole.rb
index f4e8669c11..9960ddb8ac 100644
--- a/ext/tk/lib/tkconsole.rb
+++ b/ext/tk/lib/tkconsole.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkconsole.rb - load tk/console.rb
#
diff --git a/ext/tk/lib/tkdialog.rb b/ext/tk/lib/tkdialog.rb
index 7a24e2a37a..bec5e5d29a 100644
--- a/ext/tk/lib/tkdialog.rb
+++ b/ext/tk/lib/tkdialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkdialog.rb - load tk/dialog.rb
#
diff --git a/ext/tk/lib/tkentry.rb b/ext/tk/lib/tkentry.rb
index 9ae2f7c8fe..2dcfcab5da 100644
--- a/ext/tk/lib/tkentry.rb
+++ b/ext/tk/lib/tkentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkentry.rb - load tk/entry.rb
#
diff --git a/ext/tk/lib/tkextlib/ICONS.rb b/ext/tk/lib/tkextlib/ICONS.rb
index 10402c1292..18d84c05e9 100644
--- a/ext/tk/lib/tkextlib/ICONS.rb
+++ b/ext/tk/lib/tkextlib/ICONS.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ICONS support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb
index 2934757b6d..bd3180aa55 100644
--- a/ext/tk/lib/tkextlib/ICONS/icons.rb
+++ b/ext/tk/lib/tkextlib/ICONS/icons.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/ICONS/icons.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/ICONS/setup.rb b/ext/tk/lib/tkextlib/ICONS/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/ICONS/setup.rb
+++ b/ext/tk/lib/tkextlib/ICONS/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index b44b629e46..865181a766 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -4,7 +4,7 @@
*** RELEASE_DATE of the libraries => see 'tkextlib/version.rb' ***
The following list shows *CURRENT* status when this file was modified
-at last. If you want to add other Tcl/Tk extensions to the planned list
+at last. If you want to add other Tcl/Tk extensions to the planed list
(or change its status position), please request them at the ruby-talk,
ruby-list, or ruby-dev ML. Although we cannot promise to support your
requests, we'll try to do.
@@ -77,7 +77,10 @@ ICONS 1.0 http://www.satisoft.com/tcltk/icons/ ==> ICONS
TkImg 1.3 http://sourceforge.net/projects/tkimg ==> tkimg
-BLT 2.4z http://sourceforge.net/projects/blt ==> blt
+BLT 2.4z http://sourceforge.net/projects/blt
+ * see also tcltk-ext library on RAA
+ (http://raa.ruby-lang.org/)
+ ==> blt
TkTreeCtrl 2.2.9
http://tktreectrl.sourceforge.net/ ==> treectrl
@@ -126,6 +129,8 @@ Tkgeomap *** http://tkgeomap.sourceforge.net/index.html
===< not determined to supprt or not >========================================
Tix *** http://tixlibrary.sourceforge.net/
+ * see also tcltk-ext library on RAA
+ (http://raa.ruby-lang.org/)
TkZinc *** http://www.tkzinc.org/
diff --git a/ext/tk/lib/tkextlib/blt.rb b/ext/tk/lib/tkextlib/blt.rb
index 665e41226f..8b132e41a7 100644
--- a/ext/tk/lib/tkextlib/blt.rb
+++ b/ext/tk/lib/tkextlib/blt.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# BLT support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/barchart.rb b/ext/tk/lib/tkextlib/blt/barchart.rb
index 5b6f09ead3..a86b91c959 100644
--- a/ext/tk/lib/tkextlib/blt/barchart.rb
+++ b/ext/tk/lib/tkextlib/blt/barchart.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/barchart.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/bitmap.rb b/ext/tk/lib/tkextlib/blt/bitmap.rb
index b9f411044e..3254b63116 100644
--- a/ext/tk/lib/tkextlib/blt/bitmap.rb
+++ b/ext/tk/lib/tkextlib/blt/bitmap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/bitmap.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/busy.rb b/ext/tk/lib/tkextlib/blt/busy.rb
index ab24420750..b5287fb5b7 100644
--- a/ext/tk/lib/tkextlib/blt/busy.rb
+++ b/ext/tk/lib/tkextlib/blt/busy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/busy.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb
index a6b6f13905..a228a82246 100644
--- a/ext/tk/lib/tkextlib/blt/component.rb
+++ b/ext/tk/lib/tkextlib/blt/component.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/component.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -1421,7 +1420,7 @@ module Tk::BLT
tag.kind_of?(Marker)
tag.id
else
- tag # maybe an Array of configure parameters
+ tag # maybe an Array of configure paramters
end
end
diff --git a/ext/tk/lib/tkextlib/blt/container.rb b/ext/tk/lib/tkextlib/blt/container.rb
index 6ee11138d7..be05828d95 100644
--- a/ext/tk/lib/tkextlib/blt/container.rb
+++ b/ext/tk/lib/tkextlib/blt/container.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/container.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/cutbuffer.rb b/ext/tk/lib/tkextlib/blt/cutbuffer.rb
index b36aece6e7..1cc39dfb94 100644
--- a/ext/tk/lib/tkextlib/blt/cutbuffer.rb
+++ b/ext/tk/lib/tkextlib/blt/cutbuffer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/cutbuffer.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb
index dc2531b12e..aa5c5654c2 100644
--- a/ext/tk/lib/tkextlib/blt/dragdrop.rb
+++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/dragdrop.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/eps.rb b/ext/tk/lib/tkextlib/blt/eps.rb
index bd2d3cc47e..0dba87a7cc 100644
--- a/ext/tk/lib/tkextlib/blt/eps.rb
+++ b/ext/tk/lib/tkextlib/blt/eps.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/eps.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/graph.rb b/ext/tk/lib/tkextlib/blt/graph.rb
index 02de006f33..6bd4424065 100644
--- a/ext/tk/lib/tkextlib/blt/graph.rb
+++ b/ext/tk/lib/tkextlib/blt/graph.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/graph.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb
index d0f5e8b5e6..878bd9982d 100644
--- a/ext/tk/lib/tkextlib/blt/htext.rb
+++ b/ext/tk/lib/tkextlib/blt/htext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/htext.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/setup.rb b/ext/tk/lib/tkextlib/blt/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/blt/setup.rb
+++ b/ext/tk/lib/tkextlib/blt/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/blt/spline.rb b/ext/tk/lib/tkextlib/blt/spline.rb
index 84d96a08f0..9f75a0b217 100644
--- a/ext/tk/lib/tkextlib/blt/spline.rb
+++ b/ext/tk/lib/tkextlib/blt/spline.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/spline.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/stripchart.rb b/ext/tk/lib/tkextlib/blt/stripchart.rb
index 332521ab0b..74093f1868 100644
--- a/ext/tk/lib/tkextlib/blt/stripchart.rb
+++ b/ext/tk/lib/tkextlib/blt/stripchart.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/stripchart.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb
index 39e345408d..205e29e6c5 100644
--- a/ext/tk/lib/tkextlib/blt/table.rb
+++ b/ext/tk/lib/tkextlib/blt/table.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/table.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tabnotebook.rb b/ext/tk/lib/tkextlib/blt/tabnotebook.rb
index f08f198163..82936c67d3 100644
--- a/ext/tk/lib/tkextlib/blt/tabnotebook.rb
+++ b/ext/tk/lib/tkextlib/blt/tabnotebook.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tabnotebook.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb
index 022d9784e9..c4716c7304 100644
--- a/ext/tk/lib/tkextlib/blt/tabset.rb
+++ b/ext/tk/lib/tkextlib/blt/tabset.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tabset.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/ted.rb b/ext/tk/lib/tkextlib/blt/ted.rb
index 7e81eab27d..53ab9acdaa 100644
--- a/ext/tk/lib/tkextlib/blt/ted.rb
+++ b/ext/tk/lib/tkextlib/blt/ted.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/ted.rb
#
diff --git a/ext/tk/lib/tkextlib/blt/tile.rb b/ext/tk/lib/tkextlib/blt/tile.rb
index f52a5d3944..c67cafd8d6 100644
--- a/ext/tk/lib/tkextlib/blt/tile.rb
+++ b/ext/tk/lib/tkextlib/blt/tile.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/button.rb b/ext/tk/lib/tkextlib/blt/tile/button.rb
index e3d819edb7..2e0863cfbe 100644
--- a/ext/tk/lib/tkextlib/blt/tile/button.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/button.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/button.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb b/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb
index 0c8c7f9774..da230b5925 100644
--- a/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/checkbutton.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/frame.rb b/ext/tk/lib/tkextlib/blt/tile/frame.rb
index 8d979fe485..5434af4b72 100644
--- a/ext/tk/lib/tkextlib/blt/tile/frame.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/frame.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/frame.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/label.rb b/ext/tk/lib/tkextlib/blt/tile/label.rb
index f58450d902..f370c1403b 100644
--- a/ext/tk/lib/tkextlib/blt/tile/label.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/label.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/label.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb b/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb
index ee449c75b0..814f9a5cc4 100644
--- a/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/radiobutton.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb b/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb
index 35d878d5aa..2ae871d518 100644
--- a/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/scrollbar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tile/toplevel.rb b/ext/tk/lib/tkextlib/blt/tile/toplevel.rb
index e30b8b37b5..76d5f86b1b 100644
--- a/ext/tk/lib/tkextlib/blt/tile/toplevel.rb
+++ b/ext/tk/lib/tkextlib/blt/tile/toplevel.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tile/toplevel.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/tree.rb b/ext/tk/lib/tkextlib/blt/tree.rb
index ae235f68e8..da53a6ed04 100644
--- a/ext/tk/lib/tkextlib/blt/tree.rb
+++ b/ext/tk/lib/tkextlib/blt/tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/tree.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -636,7 +635,7 @@ module Tk::BLT
}
end
- def initialize(name = nil)
+ def initialzie(name = nil)
if name
@path = @id = name
else
@@ -671,7 +670,7 @@ module Tk::BLT
tag.kind_of?(Tk::BLT::Tree::Trace)
tag.id
else
- tag # maybe an Array of configure parameters
+ tag # maybe an Array of configure paramters
end
end
diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb
index 2866ba3027..046cf7f837 100644
--- a/ext/tk/lib/tkextlib/blt/treeview.rb
+++ b/ext/tk/lib/tkextlib/blt/treeview.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/treeview.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -340,7 +339,7 @@ class Tk::BLT::Treeview
|| tag.kind_of?(Tk::BLT::Treeview::Tag)
tag.id
else
- tag # maybe an Array of configure parameters
+ tag # maybe an Array of configure paramters
end
end
private :tagid
diff --git a/ext/tk/lib/tkextlib/blt/unix_dnd.rb b/ext/tk/lib/tkextlib/blt/unix_dnd.rb
index 3c0cd33b79..8996f7c891 100644
--- a/ext/tk/lib/tkextlib/blt/unix_dnd.rb
+++ b/ext/tk/lib/tkextlib/blt/unix_dnd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/unix_dnd.rb
#
diff --git a/ext/tk/lib/tkextlib/blt/vector.rb b/ext/tk/lib/tkextlib/blt/vector.rb
index a3ab7e64b2..742e901d3e 100644
--- a/ext/tk/lib/tkextlib/blt/vector.rb
+++ b/ext/tk/lib/tkextlib/blt/vector.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/vector.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/watch.rb b/ext/tk/lib/tkextlib/blt/watch.rb
index b88c81c745..292623ff58 100644
--- a/ext/tk/lib/tkextlib/blt/watch.rb
+++ b/ext/tk/lib/tkextlib/blt/watch.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/watch.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/blt/win_printer.rb b/ext/tk/lib/tkextlib/blt/win_printer.rb
index 8d609acc19..7ac6a0dcfc 100644
--- a/ext/tk/lib/tkextlib/blt/win_printer.rb
+++ b/ext/tk/lib/tkextlib/blt/win_printer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/win_printer.rb
#
diff --git a/ext/tk/lib/tkextlib/blt/winop.rb b/ext/tk/lib/tkextlib/blt/winop.rb
index 38033e1113..03bdb60810 100644
--- a/ext/tk/lib/tkextlib/blt/winop.rb
+++ b/ext/tk/lib/tkextlib/blt/winop.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/blt/winop.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget.rb b/ext/tk/lib/tkextlib/bwidget.rb
index 0fa9c77ecf..7a1eff51d8 100644
--- a/ext/tk/lib/tkextlib/bwidget.rb
+++ b/ext/tk/lib/tkextlib/bwidget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# BWidget extension support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb b/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb
index a991245065..13fe9e59bf 100644
--- a/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb
+++ b/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/arrowbutton.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/bitmap.rb b/ext/tk/lib/tkextlib/bwidget/bitmap.rb
index 3acdfdf5ec..6cfde203e8 100644
--- a/ext/tk/lib/tkextlib/bwidget/bitmap.rb
+++ b/ext/tk/lib/tkextlib/bwidget/bitmap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/bitmap.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/button.rb b/ext/tk/lib/tkextlib/bwidget/button.rb
index ad880ebfdd..e139fb6708 100644
--- a/ext/tk/lib/tkextlib/bwidget/button.rb
+++ b/ext/tk/lib/tkextlib/bwidget/button.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/button.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
index 780a6a649e..a6de33c40c 100644
--- a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/buttonbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/combobox.rb b/ext/tk/lib/tkextlib/bwidget/combobox.rb
index b3de3186d6..16143dfbc6 100644
--- a/ext/tk/lib/tkextlib/bwidget/combobox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/combobox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/combobox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb
index ed929cb830..3b0656f021 100644
--- a/ext/tk/lib/tkextlib/bwidget/dialog.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/dialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/dragsite.rb b/ext/tk/lib/tkextlib/bwidget/dragsite.rb
index 6c7ea4491a..4d4de1780c 100644
--- a/ext/tk/lib/tkextlib/bwidget/dragsite.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dragsite.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/dragsite.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/dropsite.rb b/ext/tk/lib/tkextlib/bwidget/dropsite.rb
index e5eb7f4a88..e5e98fbc51 100644
--- a/ext/tk/lib/tkextlib/bwidget/dropsite.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dropsite.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/dropsite.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
index 7e7538fc00..846e58062d 100644
--- a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/dynamichelp.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/entry.rb b/ext/tk/lib/tkextlib/bwidget/entry.rb
index bfbe2f1967..8dc4496123 100644
--- a/ext/tk/lib/tkextlib/bwidget/entry.rb
+++ b/ext/tk/lib/tkextlib/bwidget/entry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/entry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/label.rb b/ext/tk/lib/tkextlib/bwidget/label.rb
index 9a0b73d95c..e8d9352c62 100644
--- a/ext/tk/lib/tkextlib/bwidget/label.rb
+++ b/ext/tk/lib/tkextlib/bwidget/label.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/label.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ext/tk/lib/tkextlib/bwidget/labelentry.rb
index 501f9515fa..16e7b46933 100644
--- a/ext/tk/lib/tkextlib/bwidget/labelentry.rb
+++ b/ext/tk/lib/tkextlib/bwidget/labelentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/labelentry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/labelframe.rb b/ext/tk/lib/tkextlib/bwidget/labelframe.rb
index 21c529c6c9..0710f213f0 100644
--- a/ext/tk/lib/tkextlib/bwidget/labelframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/labelframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/labelframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb
index 394c379a34..930491c869 100644
--- a/ext/tk/lib/tkextlib/bwidget/listbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/listbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/mainframe.rb b/ext/tk/lib/tkextlib/bwidget/mainframe.rb
index ad097439c3..92253bd8d3 100644
--- a/ext/tk/lib/tkextlib/bwidget/mainframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/mainframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/mainframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
index 69819360a8..7b62614737 100644
--- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
+++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/messagedlg.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb
index 05c8939a30..ed28bcd86a 100644
--- a/ext/tk/lib/tkextlib/bwidget/notebook.rb
+++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/notebook.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb b/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb
index ce18ee0edb..31bbf1fb8b 100644
--- a/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb
+++ b/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/pagesmanager.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/panedwindow.rb b/ext/tk/lib/tkextlib/bwidget/panedwindow.rb
index 560c563479..54cf06cbde 100644
--- a/ext/tk/lib/tkextlib/bwidget/panedwindow.rb
+++ b/ext/tk/lib/tkextlib/bwidget/panedwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/panedwindow.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/panelframe.rb b/ext/tk/lib/tkextlib/bwidget/panelframe.rb
index 0e32f4e261..1cbf914425 100644
--- a/ext/tk/lib/tkextlib/bwidget/panelframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/panelframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/panelframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
index 9fe6fc6a02..ea50c87cef 100644
--- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
+++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/passwddlg.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/progressbar.rb b/ext/tk/lib/tkextlib/bwidget/progressbar.rb
index f06ddc164e..18eb67349b 100644
--- a/ext/tk/lib/tkextlib/bwidget/progressbar.rb
+++ b/ext/tk/lib/tkextlib/bwidget/progressbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/progressbar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/progressdlg.rb b/ext/tk/lib/tkextlib/bwidget/progressdlg.rb
index e11a73e88d..0c0c4540bc 100644
--- a/ext/tk/lib/tkextlib/bwidget/progressdlg.rb
+++ b/ext/tk/lib/tkextlib/bwidget/progressdlg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/progressdlg.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb b/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb
index 2b184746a4..5bd00d6870 100644
--- a/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/scrollableframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb b/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb
index 9bd5e87554..ea5a18cc66 100644
--- a/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb
+++ b/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/scrolledwindow.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/scrollview.rb b/ext/tk/lib/tkextlib/bwidget/scrollview.rb
index d60fdca89e..ab27bc91cf 100644
--- a/ext/tk/lib/tkextlib/bwidget/scrollview.rb
+++ b/ext/tk/lib/tkextlib/bwidget/scrollview.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/scrollview.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb
index 85809b69bd..456175e87e 100644
--- a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb
+++ b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/selectcolor.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ext/tk/lib/tkextlib/bwidget/selectfont.rb
index 4f67a2e239..23419cb0fa 100644
--- a/ext/tk/lib/tkextlib/bwidget/selectfont.rb
+++ b/ext/tk/lib/tkextlib/bwidget/selectfont.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/selectfont.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/separator.rb b/ext/tk/lib/tkextlib/bwidget/separator.rb
index 786c41c763..6d92321210 100644
--- a/ext/tk/lib/tkextlib/bwidget/separator.rb
+++ b/ext/tk/lib/tkextlib/bwidget/separator.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/separator.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/setup.rb b/ext/tk/lib/tkextlib/bwidget/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/bwidget/setup.rb
+++ b/ext/tk/lib/tkextlib/bwidget/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ext/tk/lib/tkextlib/bwidget/spinbox.rb
index 00fe33da39..0a45b045fb 100644
--- a/ext/tk/lib/tkextlib/bwidget/spinbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/spinbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/entry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/statusbar.rb b/ext/tk/lib/tkextlib/bwidget/statusbar.rb
index 28fd6fab21..5c5dd43fe4 100644
--- a/ext/tk/lib/tkextlib/bwidget/statusbar.rb
+++ b/ext/tk/lib/tkextlib/bwidget/statusbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/statusbar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/titleframe.rb b/ext/tk/lib/tkextlib/bwidget/titleframe.rb
index eca622399e..71879111c1 100644
--- a/ext/tk/lib/tkextlib/bwidget/titleframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/titleframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/titleframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb
index 688ed5f324..089c482fe8 100644
--- a/ext/tk/lib/tkextlib/bwidget/tree.rb
+++ b/ext/tk/lib/tkextlib/bwidget/tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/tree.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/bwidget/widget.rb b/ext/tk/lib/tkextlib/bwidget/widget.rb
index ab08826b19..a93364b567 100644
--- a/ext/tk/lib/tkextlib/bwidget/widget.rb
+++ b/ext/tk/lib/tkextlib/bwidget/widget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/bwidget/widget.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/itcl.rb b/ext/tk/lib/tkextlib/itcl.rb
index 3a67b3f651..1d6ecf04f2 100644
--- a/ext/tk/lib/tkextlib/itcl.rb
+++ b/ext/tk/lib/tkextlib/itcl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# [incr Tcl] support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
index de1be12392..8f6bb33abe 100644
--- a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
+++ b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/itk/incr_tcl.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/itcl/setup.rb b/ext/tk/lib/tkextlib/itcl/setup.rb
index 917b877947..70b38e4916 100644
--- a/ext/tk/lib/tkextlib/itcl/setup.rb
+++ b/ext/tk/lib/tkextlib/itcl/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/itk.rb b/ext/tk/lib/tkextlib/itk.rb
index 112cb789f2..7492bd3eb4 100644
--- a/ext/tk/lib/tkextlib/itk.rb
+++ b/ext/tk/lib/tkextlib/itk.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# [incr Tk] support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb
index 8c6fe1374f..989585e33b 100644
--- a/ext/tk/lib/tkextlib/itk/incr_tk.rb
+++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/itk/incr_tk.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/itk/setup.rb b/ext/tk/lib/tkextlib/itk/setup.rb
index f32d5d6a75..544926efe0 100644
--- a/ext/tk/lib/tkextlib/itk/setup.rb
+++ b/ext/tk/lib/tkextlib/itk/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/iwidgets.rb b/ext/tk/lib/tkextlib/iwidgets.rb
index 2ebd9d993e..ebd4cf7507 100644
--- a/ext/tk/lib/tkextlib/iwidgets.rb
+++ b/ext/tk/lib/tkextlib/iwidgets.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# [incr Widgets] support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
index 0357114c83..91e06d1b52 100644
--- a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/buttonbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
index 4cfb9203c8..a5478c7cc6 100644
--- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/calendar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
index 3fe489dc95..398eec3f1a 100644
--- a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/canvasprintbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb
index 4b5fdf5d7c..e64d8154ca 100644
--- a/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/canvasprintdialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
index 4589fe7ffa..a7476c824e 100644
--- a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/checkbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/combobox.rb b/ext/tk/lib/tkextlib/iwidgets/combobox.rb
index d4c05b5be5..82dcf25d0b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/combobox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/combobox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/combobox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/dateentry.rb b/ext/tk/lib/tkextlib/iwidgets/dateentry.rb
index e135b89ed7..98a0051e55 100644
--- a/ext/tk/lib/tkextlib/iwidgets/dateentry.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/dateentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/dateentry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/datefield.rb b/ext/tk/lib/tkextlib/iwidgets/datefield.rb
index 35977e1f6d..50d5405a3b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/datefield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/datefield.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/datefield.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/dialog.rb b/ext/tk/lib/tkextlib/iwidgets/dialog.rb
index edefba1844..2d554ca7b5 100644
--- a/ext/tk/lib/tkextlib/iwidgets/dialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/dialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/dialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
index 009fc61c56..e880594532 100644
--- a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/dialogshell.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
index 3ae3f319b6..07ab025cdf 100644
--- a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/disjointlistbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
index 75baca05d4..3e7149a662 100644
--- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/entryfield.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
index 3c77c2ec21..e744fba91a 100644
--- a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/extbutton.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
index 4581771309..2ff15bb509 100644
--- a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/extfileselectionbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb
index 32a06cc46f..509fdcf636 100644
--- a/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/extfileselectiondialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/feedback.rb b/ext/tk/lib/tkextlib/iwidgets/feedback.rb
index e52d60edac..29d04c8a5d 100644
--- a/ext/tk/lib/tkextlib/iwidgets/feedback.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/feedback.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/feedback.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
index 3811f2b57e..a425b53b5f 100644
--- a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/fileselectionbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb
index 8d368486ea..ebcdaf8c0b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/fileselectiondialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
index ff0b587390..3d522e07c8 100644
--- a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/finddialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
index af99973240..cb9301d0c9 100644
--- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/hierarchy.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb
index 1650c7af37..d4ea1aac65 100644
--- a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/hyperhelp.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
index f4f3786528..6595398427 100644
--- a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/labeledframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
index fe3c03135c..d36d42878d 100644
--- a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/labeledwidget.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb
index 34c9eb52e3..ebf48021db 100644
--- a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/mainwindow.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
index f729511230..f9a17d0b55 100644
--- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/menubar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
index a4c28228ee..6adb53d941 100644
--- a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/messagebox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb b/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb
index 2fb4533b67..9aa590056f 100644
--- a/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/messagedialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
index ad2a372512..7ed4126a4d 100644
--- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/notebook.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb
index 642db11ff1..57a3cc7d2b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/optionmenu.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
index 5f17bdd862..65463cc85a 100644
--- a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/panedwindow.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb b/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb
index fc73a51742..7c7ff7ad62 100644
--- a/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/promptdialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb
index cec3563ddc..ae56788289 100644
--- a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/pushbutton.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
index 1c9e9f8d34..21181777b5 100644
--- a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/radiobox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb b/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb
index e17fee98dc..056cd85322 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/buttonbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
index 463689f513..935e04bbcc 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/scrolledcanvas.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -65,7 +64,7 @@ class Tk::Iwidgets::Scrolledcanvas
elsif tag.kind_of?(Tk::Itk::Component)
tag.name
else
- tag # maybe an Array of configure parameters
+ tag # maybe an Array of configure paramters
end
end
private :tagid
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb
index f105576fd6..7b7b95df1c 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/scrolledframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb
index 4ee5abe9fc..dc2966bd48 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/scrolledhtml.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
index 94949c5524..20a4cd1d36 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/scrolledlistbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
index 1e2898988c..69b7d314fd 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/scrolledtext.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb
index a8b4e5a27b..5ecd2d72d2 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/scrolledwidget.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb
index 333f68e306..eb8fe3ad52 100644
--- a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/selectionbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb
index 0d0b94e8d2..45aecf3266 100644
--- a/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/selectiondialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/setup.rb b/ext/tk/lib/tkextlib/iwidgets/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/iwidgets/setup.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/iwidgets/shell.rb b/ext/tk/lib/tkextlib/iwidgets/shell.rb
index f09e7d4d31..c560e3ac29 100644
--- a/ext/tk/lib/tkextlib/iwidgets/shell.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/shell.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/shell.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/spindate.rb b/ext/tk/lib/tkextlib/iwidgets/spindate.rb
index 8860348cc0..b3de9ed989 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spindate.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spindate.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/spindate.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/spinint.rb b/ext/tk/lib/tkextlib/iwidgets/spinint.rb
index 85736d095c..bede3bb1bf 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spinint.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spinint.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/spinint.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
index 49968e86d8..d960996e22 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/spinner.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/spintime.rb b/ext/tk/lib/tkextlib/iwidgets/spintime.rb
index 9b280ec0e4..20f8197a09 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spintime.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spintime.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/spintime.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
index 89e3362185..f56efa9aaf 100644
--- a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/tabnotebook.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb
index 816ea087ef..501ead4964 100644
--- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/tabset.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb
index d4078e6e4f..b0afb3afd9 100644
--- a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/timeentry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/timefield.rb b/ext/tk/lib/tkextlib/iwidgets/timefield.rb
index d759a0762f..c34281d4ff 100644
--- a/ext/tk/lib/tkextlib/iwidgets/timefield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/timefield.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/timefield.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
index 7f2a54b88b..5b474c3816 100644
--- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/toolbar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/iwidgets/watch.rb b/ext/tk/lib/tkextlib/iwidgets/watch.rb
index c6e862b36a..f10ec54cb2 100644
--- a/ext/tk/lib/tkextlib/iwidgets/watch.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/watch.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/iwidgets/watch.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/pkg_checker.rb b/ext/tk/lib/tkextlib/pkg_checker.rb
index 76a25ca629..e2fd97bb6a 100755
--- a/ext/tk/lib/tkextlib/pkg_checker.rb
+++ b/ext/tk/lib/tkextlib/pkg_checker.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# Ruby/Tk extension library checker
#
diff --git a/ext/tk/lib/tkextlib/setup.rb b/ext/tk/lib/tkextlib/setup.rb
index 08ad32e99b..79facc5ee3 100644
--- a/ext/tk/lib/tkextlib/setup.rb
+++ b/ext/tk/lib/tkextlib/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before using Tk extension libraries
#
diff --git a/ext/tk/lib/tkextlib/tcllib.rb b/ext/tk/lib/tkextlib/tcllib.rb
index 75d250cba4..2831989759 100644
--- a/ext/tk/lib/tkextlib/tcllib.rb
+++ b/ext/tk/lib/tkextlib/tcllib.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tcllib extension support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
index ae45b84787..2def59bf73 100644
--- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
+++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/autoscroll.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/calendar.rb b/ext/tk/lib/tkextlib/tcllib/calendar.rb
index fa53603d91..b6843df176 100644
--- a/ext/tk/lib/tkextlib/tcllib/calendar.rb
+++ b/ext/tk/lib/tkextlib/tcllib/calendar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/calendar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb b/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb
index f3d1847d73..ba87cd3aae 100644
--- a/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb
+++ b/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/canvas.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb b/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb
index bb8b04a18b..f4ffb48ece 100644
--- a/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb
+++ b/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/canvas.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/chatwidget.rb b/ext/tk/lib/tkextlib/tcllib/chatwidget.rb
index 34a8ca5094..ddb0340c31 100644
--- a/ext/tk/lib/tkextlib/tcllib/chatwidget.rb
+++ b/ext/tk/lib/tkextlib/tcllib/chatwidget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/chatwidget.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/crosshair.rb b/ext/tk/lib/tkextlib/tcllib/crosshair.rb
index 74cc0a881c..49b5361e4f 100644
--- a/ext/tk/lib/tkextlib/tcllib/crosshair.rb
+++ b/ext/tk/lib/tkextlib/tcllib/crosshair.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/crosshair.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb
index 1c61ec81a6..308847c233 100644
--- a/ext/tk/lib/tkextlib/tcllib/ctext.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/ctext.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/cursor.rb b/ext/tk/lib/tkextlib/tcllib/cursor.rb
index 4c93cfc063..5c47f9709b 100644
--- a/ext/tk/lib/tkextlib/tcllib/cursor.rb
+++ b/ext/tk/lib/tkextlib/tcllib/cursor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/cursor.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/dateentry.rb b/ext/tk/lib/tkextlib/tcllib/dateentry.rb
index 81b38515fc..77038d95bc 100644
--- a/ext/tk/lib/tkextlib/tcllib/dateentry.rb
+++ b/ext/tk/lib/tkextlib/tcllib/dateentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/dateentry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb
index ceed1260df..4c2eae741e 100644
--- a/ext/tk/lib/tkextlib/tcllib/datefield.rb
+++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/datefield.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/diagrams.rb b/ext/tk/lib/tkextlib/tcllib/diagrams.rb
index 7fb7b3c7ee..d24ba9d232 100644
--- a/ext/tk/lib/tkextlib/tcllib/diagrams.rb
+++ b/ext/tk/lib/tkextlib/tcllib/diagrams.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/diagrams.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/dialog.rb b/ext/tk/lib/tkextlib/tcllib/dialog.rb
index 46fd06f177..86a0ef2269 100644
--- a/ext/tk/lib/tkextlib/tcllib/dialog.rb
+++ b/ext/tk/lib/tkextlib/tcllib/dialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/dialog.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb
index 72d9c5f517..48711d3b66 100644
--- a/ext/tk/lib/tkextlib/tcllib/getstring.rb
+++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/getstring.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/history.rb b/ext/tk/lib/tkextlib/tcllib/history.rb
index a1b92726ee..a01a4ebfcc 100644
--- a/ext/tk/lib/tkextlib/tcllib/history.rb
+++ b/ext/tk/lib/tkextlib/tcllib/history.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/history.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/ico.rb b/ext/tk/lib/tkextlib/tcllib/ico.rb
index 8814205f94..36a32c6b09 100644
--- a/ext/tk/lib/tkextlib/tcllib/ico.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ico.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/ico.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
index 6bbd8442a6..4878cc3c23 100644
--- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/ip_entry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/khim.rb b/ext/tk/lib/tkextlib/tcllib/khim.rb
index e79f26b381..5dc2130b35 100644
--- a/ext/tk/lib/tkextlib/tcllib/khim.rb
+++ b/ext/tk/lib/tkextlib/tcllib/khim.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/khim.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/menuentry.rb b/ext/tk/lib/tkextlib/tcllib/menuentry.rb
index 51521499da..f1eb2f295c 100644
--- a/ext/tk/lib/tkextlib/tcllib/menuentry.rb
+++ b/ext/tk/lib/tkextlib/tcllib/menuentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/menuentry.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/ntext.rb b/ext/tk/lib/tkextlib/tcllib/ntext.rb
index 2d0c208236..7888ed4871 100644
--- a/ext/tk/lib/tkextlib/tcllib/ntext.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ntext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/ntext.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/panelframe.rb b/ext/tk/lib/tkextlib/tcllib/panelframe.rb
index 678d5d0a9a..020c51cbd1 100644
--- a/ext/tk/lib/tkextlib/tcllib/panelframe.rb
+++ b/ext/tk/lib/tkextlib/tcllib/panelframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/panelframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
index 1817f9a791..2f3d79d427 100644
--- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/plotchart.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -143,7 +142,7 @@ module Tk::Tcllib::Plotchart
end
def self.pixel_to_coords(w, x, y)
- list(tk_call_without_enc('::Plotchart::pixelToCoords', w.path, x, y))
+ list(tk_call_without_enc('::Plotchart::coordsToPixel', w.path, x, y))
end
def self.determine_scale(*args) # (xmin, xmax, inverted=false)
@@ -312,7 +311,7 @@ module Tk::Tcllib::Plotchart
end
def pixel_to_coords(x, y)
- list(tk_call_without_enc('::Plotchart::pixelToCoords', @path, x, y))
+ list(tk_call_without_enc('::Plotchart::coordsToPixel', @path, x, y))
end
def determine_scale(xmax, ymax)
@@ -520,7 +519,7 @@ module Tk::Tcllib::Plotchart
class Histogram < XYPlot
TkCommandNames = [
'canvas'.freeze,
- '::Plotchart::createHistogram'.freeze
+ '::Plotchart::createHistgram'.freeze
].freeze
end
diff --git a/ext/tk/lib/tkextlib/tcllib/ruler.rb b/ext/tk/lib/tkextlib/tcllib/ruler.rb
index f57b0b0e1a..d22dafa053 100644
--- a/ext/tk/lib/tkextlib/tcllib/ruler.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ruler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/ruler.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/screenruler.rb b/ext/tk/lib/tkextlib/tcllib/screenruler.rb
index 64dd4f4ccc..75fa36b66d 100644
--- a/ext/tk/lib/tkextlib/tcllib/screenruler.rb
+++ b/ext/tk/lib/tkextlib/tcllib/screenruler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/screenruler.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb b/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb
index 380d301a1a..c9488b4686 100644
--- a/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb
+++ b/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/scrolledwindow.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
index f9bf127799..c9f6062fef 100644
--- a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
+++ b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/scrollwin.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/setup.rb b/ext/tk/lib/tkextlib/tcllib/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tcllib/setup.rb
+++ b/ext/tk/lib/tkextlib/tcllib/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tcllib/statusbar.rb b/ext/tk/lib/tkextlib/tcllib/statusbar.rb
index b2c8f54b94..46a4b9d8b6 100644
--- a/ext/tk/lib/tkextlib/tcllib/statusbar.rb
+++ b/ext/tk/lib/tkextlib/tcllib/statusbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/statusbar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/style.rb b/ext/tk/lib/tkextlib/tcllib/style.rb
index f3b66b7861..dac6916e46 100644
--- a/ext/tk/lib/tkextlib/tcllib/style.rb
+++ b/ext/tk/lib/tkextlib/tcllib/style.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/style.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/superframe.rb b/ext/tk/lib/tkextlib/tcllib/superframe.rb
index 776ad7c166..adc9c4adbd 100644
--- a/ext/tk/lib/tkextlib/tcllib/superframe.rb
+++ b/ext/tk/lib/tkextlib/tcllib/superframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/superframe.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
index 7eaed8dbaa..7698640534 100644
--- a/ext/tk/lib/tkextlib/tcllib/swaplist.rb
+++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/swaplist.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist.rb b/ext/tk/lib/tkextlib/tcllib/tablelist.rb
index 7cfe2faf1e..bf5ab6620a 100644
--- a/ext/tk/lib/tkextlib/tcllib/tablelist.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/tablelist.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
index b45f18796a..2a5c415cc7 100644
--- a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/tablelist_core.rb
#
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
index d09bbe7225..0a1458415e 100644
--- a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/tablelist_tlie.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -16,7 +15,7 @@ unless defined? Tk::Tcllib::Tablelist_usingTile
Tk::Tcllib::Tablelist_usingTile = true
end
-require 'tkextlib/tcllib/tablelist_core'
+requrie 'tkextlib/tcllib/tablelist_core'
module Tk
module Tcllib
diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
index 2fc75a68ec..2f6e4b44fc 100644
--- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/tkpiechart.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/toolbar.rb b/ext/tk/lib/tkextlib/tcllib/toolbar.rb
index a771548db4..6eae4eb3e1 100644
--- a/ext/tk/lib/tkextlib/tcllib/toolbar.rb
+++ b/ext/tk/lib/tkextlib/tcllib/toolbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/toolbar.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -57,7 +56,7 @@ class Tk::Tcllib::Widget::ToolbarItem < TkObject
}
end
- def initialize(parent, *args)
+ def initaialize(parent, *args)
@parent = @t = parent
@tpath = parent.path
diff --git a/ext/tk/lib/tkextlib/tcllib/tooltip.rb b/ext/tk/lib/tkextlib/tcllib/tooltip.rb
index 4a70ec5732..070e63a7b5 100644
--- a/ext/tk/lib/tkextlib/tcllib/tooltip.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tooltip.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/tooltip.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tcllib/validator.rb b/ext/tk/lib/tkextlib/tcllib/validator.rb
deleted file mode 100644
index c2c9dda376..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/validator.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# frozen_string_literal: false
-#
-# tkextlib/tcllib/validator.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Provides a unified validation API
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::validator', '0.1')
-TkPackage.require('widget::validator')
-
-module Tk::Tcllib
- module Validator
- PACKAGE_NAME = 'widget::validator'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::validator')
- rescue
- ''
- end
- end
- end
-end
-
-module Tk::Tcllib::Validator
- extend TkCore
-
- def self.attach(widget, color, cmd=Proc.new)
- tk_call_without_enc('::widget::validator', 'attach', widget, color, cmd)
- nil
- end
-
- def self.detach(widget)
- tk_call_without_enc('::widget::validator', 'detach', widget)
- nil
- end
-
- def self.validate(widget)
- tk_call_without_enc('::widget::validator', 'validate', widget)
- nil
- end
-
- def attach_validator(color, cmd=Proc.new)
- tk_call_without_enc('::widget::validator', 'attach', @path, color, cmd)
- self
- end
-
- def detach_validator(color, cmd=Proc.new)
- tk_call_without_enc('::widget::validator', 'detach', @path)
- self
- end
-
- def invoke_validator(color, cmd=Proc.new)
- tk_call_without_enc('::widget::validator', 'validate', @path)
- self
- end
- alias validate_validator invoke_validator
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/widget.rb b/ext/tk/lib/tkextlib/tcllib/widget.rb
index b8d5070b0b..57fdf7a575 100644
--- a/ext/tk/lib/tkextlib/tcllib/widget.rb
+++ b/ext/tk/lib/tkextlib/tcllib/widget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tcllib/widget.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tclx.rb b/ext/tk/lib/tkextlib/tclx.rb
index 1189d855cb..3a4ff27644 100644
--- a/ext/tk/lib/tkextlib/tclx.rb
+++ b/ext/tk/lib/tkextlib/tclx.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TclX support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tclx/setup.rb b/ext/tk/lib/tkextlib/tclx/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tclx/setup.rb
+++ b/ext/tk/lib/tkextlib/tclx/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tclx/tclx.rb b/ext/tk/lib/tkextlib/tclx/tclx.rb
index 7360a85403..5a908fcd0b 100644
--- a/ext/tk/lib/tkextlib/tclx/tclx.rb
+++ b/ext/tk/lib/tkextlib/tclx/tclx.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tclx/tclx.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb
index ef15351066..6c11e212ae 100644
--- a/ext/tk/lib/tkextlib/tile.rb
+++ b/ext/tk/lib/tkextlib/tile.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Tile theme engin (tile widget set) support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb
index d81851bb68..b112e6152b 100644
--- a/ext/tk/lib/tkextlib/tile/dialog.rb
+++ b/ext/tk/lib/tkextlib/tile/dialog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ttk::dialog (tile-0.7+)
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/setup.rb b/ext/tk/lib/tkextlib/tile/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tile/setup.rb
+++ b/ext/tk/lib/tkextlib/tile/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tile/sizegrip.rb b/ext/tk/lib/tkextlib/tile/sizegrip.rb
index 4b9510aefa..9947e0d870 100644
--- a/ext/tk/lib/tkextlib/tile/sizegrip.rb
+++ b/ext/tk/lib/tkextlib/tile/sizegrip.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ttk::sizegrip widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index a96cba795f..83a0c9a2e8 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# style commands
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tbutton.rb b/ext/tk/lib/tkextlib/tile/tbutton.rb
index 217da62eca..c852024842 100644
--- a/ext/tk/lib/tkextlib/tile/tbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tbutton widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
index c0e4d4b505..01751ede0f 100644
--- a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tcheckbutton widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb
index f2dec21fbf..b5ab827e2d 100644
--- a/ext/tk/lib/tkextlib/tile/tcombobox.rb
+++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tcombobox widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb
index 5d577a65a6..8d2633a774 100644
--- a/ext/tk/lib/tkextlib/tile/tentry.rb
+++ b/ext/tk/lib/tkextlib/tile/tentry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tentry widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tframe.rb b/ext/tk/lib/tkextlib/tile/tframe.rb
index 5ebf19d1e8..d6d4312628 100644
--- a/ext/tk/lib/tkextlib/tile/tframe.rb
+++ b/ext/tk/lib/tkextlib/tile/tframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tframe widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tlabel.rb b/ext/tk/lib/tkextlib/tile/tlabel.rb
index 3dddeafc21..55b98acc68 100644
--- a/ext/tk/lib/tkextlib/tile/tlabel.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tlabel widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
index d512f31ffe..a34c98583f 100644
--- a/ext/tk/lib/tkextlib/tile/tlabelframe.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tlabelframe widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
index a22ebaeca7..1cf553ec8c 100644
--- a/ext/tk/lib/tkextlib/tile/tmenubutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tmenubutton widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
index 4089dcfd4b..9e27e2c1fd 100644
--- a/ext/tk/lib/tkextlib/tile/tnotebook.rb
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tnotebook widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb
index f51a1f3b41..d6ad234559 100644
--- a/ext/tk/lib/tkextlib/tile/tpaned.rb
+++ b/ext/tk/lib/tkextlib/tile/tpaned.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tpaned widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
index 446e053e3b..0c9d15e1b9 100644
--- a/ext/tk/lib/tkextlib/tile/tprogressbar.rb
+++ b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tprogressbar widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
index 202de1eb25..5dbf260666 100644
--- a/ext/tk/lib/tkextlib/tile/tradiobutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tradiobutton widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb
index 1be8f54348..70db3d6d78 100644
--- a/ext/tk/lib/tkextlib/tile/treeview.rb
+++ b/ext/tk/lib/tkextlib/tile/treeview.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# treeview widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -987,18 +986,6 @@ class Tk::Tile::Treeview::Tag < TkObject
end
alias added? tag_has?
- def tag_has
- @t.tag_has(@id)
- end
-
- def add(*items)
- @t.tag_add(@id, *items)
- end
-
- def remove(*items)
- @t.tag_remove(@id, *items)
- end
-
def bind(seq, *args)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
@@ -1312,24 +1299,6 @@ class Tk::Tile::Treeview < TkWindow
_bindinfo([@path, 'tag', 'bind', tag], context)
end
alias tagbindinfo tag_bindinfo
-
- def tag_names
- tk_split_simplelist(tk_send('tag', 'names')).collect{|id|
- Tk::Tile::Treeview::Tag.id2obj(self, id)
- }
- end
-
- def tag_add(tag, *items)
- fail ArgumentError, "no target items" if items.empty?
- tk_send('tag', 'add', tagid(tag), *(items.collect{|item| tagid(item)}))
- self
- end
-
- def tag_remove(tag, *items)
- tk_send('tag', 'remove', tagid(tag), *(items.collect{|item| tagid(item)}))
- self
- end
-
end
#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview)
diff --git a/ext/tk/lib/tkextlib/tile/tscale.rb b/ext/tk/lib/tkextlib/tile/tscale.rb
index 446344ecea..7eefcef731 100644
--- a/ext/tk/lib/tkextlib/tile/tscale.rb
+++ b/ext/tk/lib/tkextlib/tile/tscale.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tscale & tprogress widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
index 621ca48efb..c6bba5810b 100644
--- a/ext/tk/lib/tkextlib/tile/tscrollbar.rb
+++ b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tscrollbar widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tseparator.rb b/ext/tk/lib/tkextlib/tile/tseparator.rb
index d4a90e56db..ffd2f6f89f 100644
--- a/ext/tk/lib/tkextlib/tile/tseparator.rb
+++ b/ext/tk/lib/tkextlib/tile/tseparator.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tseparator widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tspinbox.rb b/ext/tk/lib/tkextlib/tile/tspinbox.rb
index 47d822e68c..2f2d73c5ab 100644
--- a/ext/tk/lib/tkextlib/tile/tspinbox.rb
+++ b/ext/tk/lib/tkextlib/tile/tspinbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ttk::spinbox widget (Tcl/Tk 8.6b1 or later)
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tile/tsquare.rb b/ext/tk/lib/tkextlib/tile/tsquare.rb
index 7412966708..a81cd7b98a 100644
--- a/ext/tk/lib/tkextlib/tile/tsquare.rb
+++ b/ext/tk/lib/tkextlib/tile/tsquare.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tsquare widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkDND.rb b/ext/tk/lib/tkextlib/tkDND.rb
index c76c48d169..5d52e34418 100644
--- a/ext/tk/lib/tkextlib/tkDND.rb
+++ b/ext/tk/lib/tkextlib/tkDND.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkDND (Tk Drag & Drop Extension) support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkDND/setup.rb b/ext/tk/lib/tkextlib/tkDND/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tkDND/setup.rb
+++ b/ext/tk/lib/tkextlib/tkDND/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tkDND/shape.rb b/ext/tk/lib/tkextlib/tkDND/shape.rb
index 06d8d64ac7..d44068ed33 100644
--- a/ext/tk/lib/tkextlib/tkDND/shape.rb
+++ b/ext/tk/lib/tkextlib/tkDND/shape.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tkDND/shape.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
index c2059b7c23..97cdfc7f1c 100644
--- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
+++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tkDND/tkdnd.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -159,7 +158,7 @@ module Tk
cmd = Proc.new
end
- args = [TkComm::None] if args.empty?
+ args = [None] if args.empty
tk_call('dnd', 'bindsource', @path, type, cmd, *args)
self
diff --git a/ext/tk/lib/tkextlib/tkHTML.rb b/ext/tk/lib/tkextlib/tkHTML.rb
index d64e676024..5fddde72ff 100644
--- a/ext/tk/lib/tkextlib/tkHTML.rb
+++ b/ext/tk/lib/tkextlib/tkHTML.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkHtml support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
index 362c381830..b9ee90aace 100644
--- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
+++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tkHTML/htmlwidget.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkHTML/setup.rb b/ext/tk/lib/tkextlib/tkHTML/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tkHTML/setup.rb
+++ b/ext/tk/lib/tkextlib/tkHTML/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tkimg.rb b/ext/tk/lib/tkextlib/tkimg.rb
index de4b7212c3..c01359d3ef 100644
--- a/ext/tk/lib/tkextlib/tkimg.rb
+++ b/ext/tk/lib/tkextlib/tkimg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg extension support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/bmp.rb b/ext/tk/lib/tkextlib/tkimg/bmp.rb
index 48a3b7ef5f..ea90181aa3 100644
--- a/ext/tk/lib/tkextlib/tkimg/bmp.rb
+++ b/ext/tk/lib/tkextlib/tkimg/bmp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'bmp'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/dted.rb b/ext/tk/lib/tkextlib/tkimg/dted.rb
deleted file mode 100644
index 30c595c1b6..0000000000
--- a/ext/tk/lib/tkextlib/tkimg/dted.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: false
-#
-# TkImg - format 'DTED'
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-
-# call setup script for general 'tkextlib' libraries
-require 'tkextlib/setup.rb'
-
-# call setup script
-require 'tkextlib/tkimg/setup.rb'
-
-# TkPackage.require('img::dted', '1.4')
-TkPackage.require('img::dted')
-
-module Tk
- module Img
- module DTED
- PACKAGE_NAME = 'img::dted'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('img::dted')
- rescue
- ''
- end
- end
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/tkimg/gif.rb b/ext/tk/lib/tkextlib/tkimg/gif.rb
index ce5f3e94ec..d542d47561 100644
--- a/ext/tk/lib/tkextlib/tkimg/gif.rb
+++ b/ext/tk/lib/tkextlib/tkimg/gif.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'gif'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/ico.rb b/ext/tk/lib/tkextlib/tkimg/ico.rb
index 80656005f0..e79bdf45e9 100644
--- a/ext/tk/lib/tkextlib/tkimg/ico.rb
+++ b/ext/tk/lib/tkextlib/tkimg/ico.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'ico'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/jpeg.rb b/ext/tk/lib/tkextlib/tkimg/jpeg.rb
index 24e11a84de..2126120161 100644
--- a/ext/tk/lib/tkextlib/tkimg/jpeg.rb
+++ b/ext/tk/lib/tkextlib/tkimg/jpeg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'jpeg'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/pcx.rb b/ext/tk/lib/tkextlib/tkimg/pcx.rb
index 942d585120..6831f4d35b 100644
--- a/ext/tk/lib/tkextlib/tkimg/pcx.rb
+++ b/ext/tk/lib/tkextlib/tkimg/pcx.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'pcx'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)#
diff --git a/ext/tk/lib/tkextlib/tkimg/pixmap.rb b/ext/tk/lib/tkextlib/tkimg/pixmap.rb
index b90468a108..bd1b870af7 100644
--- a/ext/tk/lib/tkextlib/tkimg/pixmap.rb
+++ b/ext/tk/lib/tkextlib/tkimg/pixmap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'pixmap'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/png.rb b/ext/tk/lib/tkextlib/tkimg/png.rb
index 76f7329772..5c829f48d2 100644
--- a/ext/tk/lib/tkextlib/tkimg/png.rb
+++ b/ext/tk/lib/tkextlib/tkimg/png.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'png'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/ppm.rb b/ext/tk/lib/tkextlib/tkimg/ppm.rb
index a6b705e6ad..eacfae467d 100644
--- a/ext/tk/lib/tkextlib/tkimg/ppm.rb
+++ b/ext/tk/lib/tkextlib/tkimg/ppm.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'ppm'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/ps.rb b/ext/tk/lib/tkextlib/tkimg/ps.rb
index 2a450ed157..68e9178ac0 100644
--- a/ext/tk/lib/tkextlib/tkimg/ps.rb
+++ b/ext/tk/lib/tkextlib/tkimg/ps.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'ps'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/raw.rb b/ext/tk/lib/tkextlib/tkimg/raw.rb
deleted file mode 100644
index 2eddbbc43a..0000000000
--- a/ext/tk/lib/tkextlib/tkimg/raw.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: false
-#
-# TkImg - format 'Raw Data'
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-
-# call setup script for general 'tkextlib' libraries
-require 'tkextlib/setup.rb'
-
-# call setup script
-require 'tkextlib/tkimg/setup.rb'
-
-# TkPackage.require('img::raw', '1.4')
-TkPackage.require('img::raw')
-
-module Tk
- module Img
- module Raw
- PACKAGE_NAME = 'img::raw'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('img::raw')
- rescue
- ''
- end
- end
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/tkimg/setup.rb b/ext/tk/lib/tkextlib/tkimg/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tkimg/setup.rb
+++ b/ext/tk/lib/tkextlib/tkimg/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tkimg/sgi.rb b/ext/tk/lib/tkextlib/tkimg/sgi.rb
index 73a5bce0ac..ec7038bf0e 100644
--- a/ext/tk/lib/tkextlib/tkimg/sgi.rb
+++ b/ext/tk/lib/tkextlib/tkimg/sgi.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'sgi'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/sun.rb b/ext/tk/lib/tkextlib/tkimg/sun.rb
index bd1ac0e577..651f946497 100644
--- a/ext/tk/lib/tkextlib/tkimg/sun.rb
+++ b/ext/tk/lib/tkextlib/tkimg/sun.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'sun'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/tga.rb b/ext/tk/lib/tkextlib/tkimg/tga.rb
index 1dd499b953..1eae407c0a 100644
--- a/ext/tk/lib/tkextlib/tkimg/tga.rb
+++ b/ext/tk/lib/tkextlib/tkimg/tga.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'tga'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/tiff.rb b/ext/tk/lib/tkextlib/tkimg/tiff.rb
index a2d1d8fcc5..ed271c2600 100644
--- a/ext/tk/lib/tkextlib/tkimg/tiff.rb
+++ b/ext/tk/lib/tkextlib/tkimg/tiff.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'tiff'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/window.rb b/ext/tk/lib/tkextlib/tkimg/window.rb
index 346f246aa4..3b5906fab6 100644
--- a/ext/tk/lib/tkextlib/tkimg/window.rb
+++ b/ext/tk/lib/tkextlib/tkimg/window.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'window'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/xbm.rb b/ext/tk/lib/tkextlib/tkimg/xbm.rb
index 0a4deffdd7..f4bea030be 100644
--- a/ext/tk/lib/tkextlib/tkimg/xbm.rb
+++ b/ext/tk/lib/tkextlib/tkimg/xbm.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'xbm'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tkimg/xpm.rb b/ext/tk/lib/tkextlib/tkimg/xpm.rb
index 7708b9d427..5119c8710b 100644
--- a/ext/tk/lib/tkextlib/tkimg/xpm.rb
+++ b/ext/tk/lib/tkextlib/tkimg/xpm.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkImg - format 'xpm'
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tktable.rb b/ext/tk/lib/tkextlib/tktable.rb
index a957294db0..385eb13497 100644
--- a/ext/tk/lib/tkextlib/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkTable support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tktable/setup.rb b/ext/tk/lib/tkextlib/tktable/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tktable/setup.rb
+++ b/ext/tk/lib/tkextlib/tktable/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb
index d8811a9676..bc7a6c9a2e 100644
--- a/ext/tk/lib/tkextlib/tktable/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable/tktable.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/tktable/tktable.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -71,7 +70,7 @@ module Tk::TkTable::ConfigMethod
private :__item_strval_optkeys
def __item_val2ruby_optkeys(id) # { key=>method, ... }
- super(id).update('window'=>proc{|k,v| window(v)})
+ super(id).update('window'=>proc{|v| window(v)})
end
private :__item_val2ruby_optkeys
diff --git a/ext/tk/lib/tkextlib/tktrans.rb b/ext/tk/lib/tkextlib/tktrans.rb
index 031eeb9fd7..c5de5be5e6 100644
--- a/ext/tk/lib/tkextlib/tktrans.rb
+++ b/ext/tk/lib/tkextlib/tktrans.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkTrans support (win32 only)
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/tktrans/setup.rb b/ext/tk/lib/tkextlib/tktrans/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/tktrans/setup.rb
+++ b/ext/tk/lib/tkextlib/tktrans/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/tktrans/tktrans.rb b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
index e6e0e3a78d..e051c09211 100644
--- a/ext/tk/lib/tkextlib/tktrans/tktrans.rb
+++ b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkTrans support (win32 only)
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/treectrl.rb b/ext/tk/lib/tkextlib/treectrl.rb
index 227d55ff1e..1944fb83e3 100644
--- a/ext/tk/lib/tkextlib/treectrl.rb
+++ b/ext/tk/lib/tkextlib/treectrl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# TkTreeCtrl support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/treectrl/setup.rb b/ext/tk/lib/tkextlib/treectrl/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/treectrl/setup.rb
+++ b/ext/tk/lib/tkextlib/treectrl/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
index dbd59f8c05..1879a531ae 100644
--- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
+++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/treectrl/tktreectrl.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/trofs.rb b/ext/tk/lib/tkextlib/trofs.rb
index 46581a3dad..5914e5165f 100644
--- a/ext/tk/lib/tkextlib/trofs.rb
+++ b/ext/tk/lib/tkextlib/trofs.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# trofs support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/trofs/setup.rb b/ext/tk/lib/tkextlib/trofs/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/trofs/setup.rb
+++ b/ext/tk/lib/tkextlib/trofs/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/trofs/trofs.rb b/ext/tk/lib/tkextlib/trofs/trofs.rb
index dc55ec269a..7a2606a275 100644
--- a/ext/tk/lib/tkextlib/trofs/trofs.rb
+++ b/ext/tk/lib/tkextlib/trofs/trofs.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/trofs/trofs.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/version.rb b/ext/tk/lib/tkextlib/version.rb
index 68c8ae31a2..4bef78fe54 100644
--- a/ext/tk/lib/tkextlib/version.rb
+++ b/ext/tk/lib/tkextlib/version.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# release date of tkextlib
#
diff --git a/ext/tk/lib/tkextlib/vu.rb b/ext/tk/lib/tkextlib/vu.rb
index 145a0b5647..d2234eb2a8 100644
--- a/ext/tk/lib/tkextlib/vu.rb
+++ b/ext/tk/lib/tkextlib/vu.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# The vu widget set support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/vu/bargraph.rb b/ext/tk/lib/tkextlib/vu/bargraph.rb
index e1d58e9555..b9fcf925f3 100644
--- a/ext/tk/lib/tkextlib/vu/bargraph.rb
+++ b/ext/tk/lib/tkextlib/vu/bargraph.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ::vu::bargraph widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb
index 66d5cfd394..8569ac5541 100644
--- a/ext/tk/lib/tkextlib/vu/charts.rb
+++ b/ext/tk/lib/tkextlib/vu/charts.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# charts -- Create and manipulate canvas Add-On Items
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/vu/dial.rb b/ext/tk/lib/tkextlib/vu/dial.rb
index 7eb5650df0..4d04974a55 100644
--- a/ext/tk/lib/tkextlib/vu/dial.rb
+++ b/ext/tk/lib/tkextlib/vu/dial.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ::vu::dial widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/vu/pie.rb b/ext/tk/lib/tkextlib/vu/pie.rb
index fb9920cc68..6b0c485d8a 100644
--- a/ext/tk/lib/tkextlib/vu/pie.rb
+++ b/ext/tk/lib/tkextlib/vu/pie.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ::vu::pie widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/vu/setup.rb b/ext/tk/lib/tkextlib/vu/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/vu/setup.rb
+++ b/ext/tk/lib/tkextlib/vu/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/vu/spinbox.rb b/ext/tk/lib/tkextlib/vu/spinbox.rb
index 082ebd1f62..7d6104f4d1 100644
--- a/ext/tk/lib/tkextlib/vu/spinbox.rb
+++ b/ext/tk/lib/tkextlib/vu/spinbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ::vu::spinbox widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/winico.rb b/ext/tk/lib/tkextlib/winico.rb
index 996fc409b8..ce7b8eac5c 100644
--- a/ext/tk/lib/tkextlib/winico.rb
+++ b/ext/tk/lib/tkextlib/winico.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# winico -- Windows Icon extension support
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkextlib/winico/setup.rb b/ext/tk/lib/tkextlib/winico/setup.rb
index cc967dced6..ee406c6ca0 100644
--- a/ext/tk/lib/tkextlib/winico/setup.rb
+++ b/ext/tk/lib/tkextlib/winico/setup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# setup.rb -- setup script before calling TkPackage.require()
#
diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb
index dda0357a16..9160c2960f 100644
--- a/ext/tk/lib/tkextlib/winico/winico.rb
+++ b/ext/tk/lib/tkextlib/winico/winico.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkextlib/winico/winico.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/lib/tkfont.rb b/ext/tk/lib/tkfont.rb
index 6036006aac..38a96633de 100644
--- a/ext/tk/lib/tkfont.rb
+++ b/ext/tk/lib/tkfont.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkfont.rb - load tk/font.rb
#
diff --git a/ext/tk/lib/tkmacpkg.rb b/ext/tk/lib/tkmacpkg.rb
index 4f76c2feb8..35560e78ce 100644
--- a/ext/tk/lib/tkmacpkg.rb
+++ b/ext/tk/lib/tkmacpkg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkmacpkg.rb - load tk/macpkg.rb
#
diff --git a/ext/tk/lib/tkmenubar.rb b/ext/tk/lib/tkmenubar.rb
index 43109e2b67..70214fda1a 100644
--- a/ext/tk/lib/tkmenubar.rb
+++ b/ext/tk/lib/tkmenubar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkmenubar.rb - load tk/menubar.rb
#
diff --git a/ext/tk/lib/tkmngfocus.rb b/ext/tk/lib/tkmngfocus.rb
index 43abd210c9..fe70950e8e 100644
--- a/ext/tk/lib/tkmngfocus.rb
+++ b/ext/tk/lib/tkmngfocus.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkmngfocus.rb - load tk/mngfocus.rb
#
diff --git a/ext/tk/lib/tkpalette.rb b/ext/tk/lib/tkpalette.rb
index f4e7321c47..56b203bbb9 100644
--- a/ext/tk/lib/tkpalette.rb
+++ b/ext/tk/lib/tkpalette.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkpalette.rb - load tk/palette.rb
#
diff --git a/ext/tk/lib/tkscrollbox.rb b/ext/tk/lib/tkscrollbox.rb
index c316ce2ea6..6093b2e4e7 100644
--- a/ext/tk/lib/tkscrollbox.rb
+++ b/ext/tk/lib/tkscrollbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkscrollbox.rb - load tk/scrollbox.rb
#
diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb
index 8ed41ac15a..97ad62a3ea 100644
--- a/ext/tk/lib/tktext.rb
+++ b/ext/tk/lib/tktext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tktext.rb - load tk/text.rb
#
diff --git a/ext/tk/lib/tkvirtevent.rb b/ext/tk/lib/tkvirtevent.rb
index 4efa790505..f4fae19a0a 100644
--- a/ext/tk/lib/tkvirtevent.rb
+++ b/ext/tk/lib/tkvirtevent.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkvirtevent.rb - load tk/virtevent.rb
#
diff --git a/ext/tk/lib/tkwinpkg.rb b/ext/tk/lib/tkwinpkg.rb
index 97c84f8ab1..83371c546d 100644
--- a/ext/tk/lib/tkwinpkg.rb
+++ b/ext/tk/lib/tkwinpkg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkwinpkg.rb - load tk/winpkg.rb
#
diff --git a/ext/tk/old-extconf.rb b/ext/tk/old-extconf.rb
index a13fa4c46e..ebc83a0c0b 100644
--- a/ext/tk/old-extconf.rb
+++ b/ext/tk/old-extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# extconf.rb for tcltklib
require 'mkmf'
diff --git a/ext/tk/sample/24hr_clock.rb b/ext/tk/sample/24hr_clock.rb
index 3a030ddaf2..29f84e0b40 100644
--- a/ext/tk/sample/24hr_clock.rb
+++ b/ext/tk/sample/24hr_clock.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
diff --git a/ext/tk/sample/binding_sample.rb b/ext/tk/sample/binding_sample.rb
index a324a745f3..3c2eb5e1cb 100644
--- a/ext/tk/sample/binding_sample.rb
+++ b/ext/tk/sample/binding_sample.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
diff --git a/ext/tk/sample/bindtag_sample.rb b/ext/tk/sample/bindtag_sample.rb
index 7b4ac16f64..b13364bb68 100644
--- a/ext/tk/sample/bindtag_sample.rb
+++ b/ext/tk/sample/bindtag_sample.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
TkLabel.new(:text=><<EOT, :justify=>:left).pack
diff --git a/ext/tk/sample/binstr_usage.rb b/ext/tk/sample/binstr_usage.rb
index 92882b8e1b..fa81f98b5e 100644
--- a/ext/tk/sample/binstr_usage.rb
+++ b/ext/tk/sample/binstr_usage.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require "tk"
diff --git a/ext/tk/sample/btn_with_frame.rb b/ext/tk/sample/btn_with_frame.rb
index 43e120b123..d04c95a289 100644
--- a/ext/tk/sample/btn_with_frame.rb
+++ b/ext/tk/sample/btn_with_frame.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'tk'
class Button_with_Frame < TkButton
diff --git a/ext/tk/sample/cd_timer.rb b/ext/tk/sample/cd_timer.rb
index 1efe8cdb7c..e2611fbf23 100644
--- a/ext/tk/sample/cd_timer.rb
+++ b/ext/tk/sample/cd_timer.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# countdown timer
# usage: cd_timer min [, min ... ]
diff --git a/ext/tk/sample/cmd_res_test.rb b/ext/tk/sample/cmd_res_test.rb
index 52c5bc7515..8df2e61af7 100644
--- a/ext/tk/sample/cmd_res_test.rb
+++ b/ext/tk/sample/cmd_res_test.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'tk'
TkOptionDB.readfile(File.expand_path('cmd_resource',
File.dirname(__FILE__)))
diff --git a/ext/tk/sample/demos-en/anilabel.rb b/ext/tk/sample/demos-en/anilabel.rb
index a48f4a10e8..ebd84accd2 100644
--- a/ext/tk/sample/demos-en/anilabel.rb
+++ b/ext/tk/sample/demos-en/anilabel.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# animated label widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/aniwave.rb b/ext/tk/sample/demos-en/aniwave.rb
index 955f202767..57d58193f6 100644
--- a/ext/tk/sample/demos-en/aniwave.rb
+++ b/ext/tk/sample/demos-en/aniwave.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# animated wave demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/arrow.rb b/ext/tk/sample/demos-en/arrow.rb
index 46229668c2..452153d010 100644
--- a/ext/tk/sample/demos-en/arrow.rb
+++ b/ext/tk/sample/demos-en/arrow.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# arrow.rb
#
# This demonstration script creates a canvas widget that displays a
diff --git a/ext/tk/sample/demos-en/bind.rb b/ext/tk/sample/demos-en/bind.rb
index 38f2b46eaf..c291e4730a 100644
--- a/ext/tk/sample/demos-en/bind.rb
+++ b/ext/tk/sample/demos-en/bind.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# bind.rb
#
# This demonstration script creates a text widget with bindings set
diff --git a/ext/tk/sample/demos-en/bitmap.rb b/ext/tk/sample/demos-en/bitmap.rb
index bb7a13d7b6..858d067d0d 100644
--- a/ext/tk/sample/demos-en/bitmap.rb
+++ b/ext/tk/sample/demos-en/bitmap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# bitmap.rb
#
# This demonstration script creates a toplevel window that displays
diff --git a/ext/tk/sample/demos-en/button.rb b/ext/tk/sample/demos-en/button.rb
index 00331002d2..f63a2f3b06 100644
--- a/ext/tk/sample/demos-en/button.rb
+++ b/ext/tk/sample/demos-en/button.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# button.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/check.rb b/ext/tk/sample/demos-en/check.rb
index 3f3b07bd0a..bf0b73476a 100644
--- a/ext/tk/sample/demos-en/check.rb
+++ b/ext/tk/sample/demos-en/check.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# check.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/check2.rb b/ext/tk/sample/demos-en/check2.rb
index d68b86438a..4f7b1f07bc 100644
--- a/ext/tk/sample/demos-en/check2.rb
+++ b/ext/tk/sample/demos-en/check2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# checkbutton widget demo2 (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/clrpick.rb b/ext/tk/sample/demos-en/clrpick.rb
index 081d11be4f..6da28cb112 100644
--- a/ext/tk/sample/demos-en/clrpick.rb
+++ b/ext/tk/sample/demos-en/clrpick.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# clrpick.rb
#
# This demonstration script prompts the user to select a color.
diff --git a/ext/tk/sample/demos-en/colors.rb b/ext/tk/sample/demos-en/colors.rb
index dca147b51e..b0ef9590b9 100644
--- a/ext/tk/sample/demos-en/colors.rb
+++ b/ext/tk/sample/demos-en/colors.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# colors.rb
#
# This demonstration script creates a listbox widget that displays
diff --git a/ext/tk/sample/demos-en/combo.rb b/ext/tk/sample/demos-en/combo.rb
index b8bf2d8803..d77660095c 100644
--- a/ext/tk/sample/demos-en/combo.rb
+++ b/ext/tk/sample/demos-en/combo.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# combo.rb --
#
# This demonstration script creates several combobox widgets.
@@ -72,7 +71,7 @@ australianCities = [
]
-secondValue.value = 'unchangeable'
+secondValue.value = 'unchangable'
ozCity.value = 'Sydney'
Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f|
diff --git a/ext/tk/sample/demos-en/cscroll.rb b/ext/tk/sample/demos-en/cscroll.rb
index eac615d035..40a3afc0ad 100644
--- a/ext/tk/sample/demos-en/cscroll.rb
+++ b/ext/tk/sample/demos-en/cscroll.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# cscroll.rb
#
# This demonstration script creates a simple canvas that can be
diff --git a/ext/tk/sample/demos-en/ctext.rb b/ext/tk/sample/demos-en/ctext.rb
index dbd26d21df..e04cb283f0 100644
--- a/ext/tk/sample/demos-en/ctext.rb
+++ b/ext/tk/sample/demos-en/ctext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ctext.rb
#
# This demonstration script creates a canvas widget with a text
diff --git a/ext/tk/sample/demos-en/dialog1.rb b/ext/tk/sample/demos-en/dialog1.rb
index 3fd56a69c3..af476ecd05 100644
--- a/ext/tk/sample/demos-en/dialog1.rb
+++ b/ext/tk/sample/demos-en/dialog1.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# a dialog box with a local grab (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/dialog2.rb b/ext/tk/sample/demos-en/dialog2.rb
index fed14081c8..efc4b714da 100644
--- a/ext/tk/sample/demos-en/dialog2.rb
+++ b/ext/tk/sample/demos-en/dialog2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# a dialog box with a global grab (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/entry1.rb b/ext/tk/sample/demos-en/entry1.rb
index d6b0af2b5d..fac0afc243 100644
--- a/ext/tk/sample/demos-en/entry1.rb
+++ b/ext/tk/sample/demos-en/entry1.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# entry (no scrollbars) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/entry2.rb b/ext/tk/sample/demos-en/entry2.rb
index 460a0a02ea..05a6c83cfd 100644
--- a/ext/tk/sample/demos-en/entry2.rb
+++ b/ext/tk/sample/demos-en/entry2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# entry2.rb
#
# This demonstration script is the same as the entry1.tcl script
diff --git a/ext/tk/sample/demos-en/entry3.rb b/ext/tk/sample/demos-en/entry3.rb
index 6170fe1365..d3bc629fdf 100644
--- a/ext/tk/sample/demos-en/entry3.rb
+++ b/ext/tk/sample/demos-en/entry3.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# entry3.rb --
#
# This demonstration script creates several entry widgets whose
diff --git a/ext/tk/sample/demos-en/filebox.rb b/ext/tk/sample/demos-en/filebox.rb
index 2bdf0aac10..0c284c11d4 100644
--- a/ext/tk/sample/demos-en/filebox.rb
+++ b/ext/tk/sample/demos-en/filebox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# filebox.rb
#
# This demonstration script prompts the user to select a file.#
diff --git a/ext/tk/sample/demos-en/floor.rb b/ext/tk/sample/demos-en/floor.rb
index b22ccecfd2..eb8b23eb7d 100644
--- a/ext/tk/sample/demos-en/floor.rb
+++ b/ext/tk/sample/demos-en/floor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# floor.rb
#
# This demonstration script creates a canvas widet that displays the
diff --git a/ext/tk/sample/demos-en/floor2.rb b/ext/tk/sample/demos-en/floor2.rb
index a95bfedbfd..3bfa89a920 100644
--- a/ext/tk/sample/demos-en/floor2.rb
+++ b/ext/tk/sample/demos-en/floor2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
%# floor2.rb
#
# This demonstration script creates a canvas widet that displays the
diff --git a/ext/tk/sample/demos-en/form.rb b/ext/tk/sample/demos-en/form.rb
index b6c6655083..abb3e0e10e 100644
--- a/ext/tk/sample/demos-en/form.rb
+++ b/ext/tk/sample/demos-en/form.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# form widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb
index 555ad4af35..d3956ef78c 100644
--- a/ext/tk/sample/demos-en/goldberg.rb
+++ b/ext/tk/sample/demos-en/goldberg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Ruby/Tk Goldverg demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/hscale.rb b/ext/tk/sample/demos-en/hscale.rb
index 05a8f39362..e660216967 100644
--- a/ext/tk/sample/demos-en/hscale.rb
+++ b/ext/tk/sample/demos-en/hscale.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "tkcanvas"
if defined?($hscale_demo) && $hscale_demo
diff --git a/ext/tk/sample/demos-en/icon.rb b/ext/tk/sample/demos-en/icon.rb
index ab29a0c186..bab40da214 100644
--- a/ext/tk/sample/demos-en/icon.rb
+++ b/ext/tk/sample/demos-en/icon.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# icon.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/image1.rb b/ext/tk/sample/demos-en/image1.rb
index c7c0989df8..233cb963d1 100644
--- a/ext/tk/sample/demos-en/image1.rb
+++ b/ext/tk/sample/demos-en/image1.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
## image1.rb
#
# This demonstration script displays two image widgets.
diff --git a/ext/tk/sample/demos-en/image2.rb b/ext/tk/sample/demos-en/image2.rb
index dfb993e434..13098af1b6 100644
--- a/ext/tk/sample/demos-en/image2.rb
+++ b/ext/tk/sample/demos-en/image2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# image2.rb
#
# This demonstration script creates a simple collection of widgets
diff --git a/ext/tk/sample/demos-en/image3.rb b/ext/tk/sample/demos-en/image3.rb
index 2879cd4bff..edb6d231bf 100644
--- a/ext/tk/sample/demos-en/image3.rb
+++ b/ext/tk/sample/demos-en/image3.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# image3.rb
#
# This demonstration script creates a simple collection of widgets
diff --git a/ext/tk/sample/demos-en/items.rb b/ext/tk/sample/demos-en/items.rb
index d6de1e557e..01a4072cb7 100644
--- a/ext/tk/sample/demos-en/items.rb
+++ b/ext/tk/sample/demos-en/items.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# items.rb
#
# This demonstration script creates a canvas that displays the
diff --git a/ext/tk/sample/demos-en/knightstour.rb b/ext/tk/sample/demos-en/knightstour.rb
index 1ad82fcc9d..6f96a5be10 100644
--- a/ext/tk/sample/demos-en/knightstour.rb
+++ b/ext/tk/sample/demos-en/knightstour.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Based on the widget demo of Tcl/Tk8.5.2
# The following is the original copyright text.
#----------------------------------------------------------------------------
diff --git a/ext/tk/sample/demos-en/label.rb b/ext/tk/sample/demos-en/label.rb
index d9cfd92364..5be06eafee 100644
--- a/ext/tk/sample/demos-en/label.rb
+++ b/ext/tk/sample/demos-en/label.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# label.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/labelframe.rb b/ext/tk/sample/demos-en/labelframe.rb
index bd2d8f335e..ad968bc061 100644
--- a/ext/tk/sample/demos-en/labelframe.rb
+++ b/ext/tk/sample/demos-en/labelframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# labelframe.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/mclist.rb b/ext/tk/sample/demos-en/mclist.rb
index 61ebff1805..17019bb15b 100644
--- a/ext/tk/sample/demos-en/mclist.rb
+++ b/ext/tk/sample/demos-en/mclist.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# mclist.rb --
#
# This demonstration script creates a toplevel window containing a Ttk
diff --git a/ext/tk/sample/demos-en/menu.rb b/ext/tk/sample/demos-en/menu.rb
index 8b7a524bc6..a458dbbc14 100644
--- a/ext/tk/sample/demos-en/menu.rb
+++ b/ext/tk/sample/demos-en/menu.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# menus widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/menu84.rb b/ext/tk/sample/demos-en/menu84.rb
index e6e42cb844..4fc53962e7 100644
--- a/ext/tk/sample/demos-en/menu84.rb
+++ b/ext/tk/sample/demos-en/menu84.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# menus widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/menubu.rb b/ext/tk/sample/demos-en/menubu.rb
index 9ff683d09c..6e28e813b3 100644
--- a/ext/tk/sample/demos-en/menubu.rb
+++ b/ext/tk/sample/demos-en/menubu.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# menubutton.rb
#
# This demonstration script creates a window with a bunch of menus
diff --git a/ext/tk/sample/demos-en/msgbox.rb b/ext/tk/sample/demos-en/msgbox.rb
index 9a5ff51b4b..d3d66bfeb0 100644
--- a/ext/tk/sample/demos-en/msgbox.rb
+++ b/ext/tk/sample/demos-en/msgbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# msgbox.rb
#
# This demonstration script creates message boxes of various type
diff --git a/ext/tk/sample/demos-en/msgbox2.rb b/ext/tk/sample/demos-en/msgbox2.rb
index 0eb35c486d..c227b59bb1 100644
--- a/ext/tk/sample/demos-en/msgbox2.rb
+++ b/ext/tk/sample/demos-en/msgbox2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# msgbox2.rb
#
# This demonstration script creates message boxes of various type
diff --git a/ext/tk/sample/demos-en/paned1.rb b/ext/tk/sample/demos-en/paned1.rb
index c14562a962..d3d66d1b16 100644
--- a/ext/tk/sample/demos-en/paned1.rb
+++ b/ext/tk/sample/demos-en/paned1.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# paned1.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/paned2.rb b/ext/tk/sample/demos-en/paned2.rb
index 0c62235112..02293b0309 100644
--- a/ext/tk/sample/demos-en/paned2.rb
+++ b/ext/tk/sample/demos-en/paned2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# paned2.rb --
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/pendulum.rb b/ext/tk/sample/demos-en/pendulum.rb
index 833a31084f..306ac94a21 100644
--- a/ext/tk/sample/demos-en/pendulum.rb
+++ b/ext/tk/sample/demos-en/pendulum.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# This demonstration illustrates how Tcl/Tk can be used to construct
# simulations of physical systems.
diff --git a/ext/tk/sample/demos-en/plot.rb b/ext/tk/sample/demos-en/plot.rb
index 786695a85c..f70daa3fb2 100644
--- a/ext/tk/sample/demos-en/plot.rb
+++ b/ext/tk/sample/demos-en/plot.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# plot.rb
#
# This demonstration script creates a canvas widget showing a 2-D
diff --git a/ext/tk/sample/demos-en/puzzle.rb b/ext/tk/sample/demos-en/puzzle.rb
index 6cf502fcf5..f16414aa4c 100644
--- a/ext/tk/sample/demos-en/puzzle.rb
+++ b/ext/tk/sample/demos-en/puzzle.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# puzzle.rb
#
# This demonstration script creates a 15-puzzle game using a collection
diff --git a/ext/tk/sample/demos-en/radio.rb b/ext/tk/sample/demos-en/radio.rb
index d6b3ffbcbe..bde31508e1 100644
--- a/ext/tk/sample/demos-en/radio.rb
+++ b/ext/tk/sample/demos-en/radio.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# radio.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/radio2.rb b/ext/tk/sample/demos-en/radio2.rb
index ece7cfdf08..72fc2c610c 100644
--- a/ext/tk/sample/demos-en/radio2.rb
+++ b/ext/tk/sample/demos-en/radio2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# radio2.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/radio3.rb b/ext/tk/sample/demos-en/radio3.rb
index d1629c884e..8a147edda7 100644
--- a/ext/tk/sample/demos-en/radio3.rb
+++ b/ext/tk/sample/demos-en/radio3.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# radio3.rb
#
# This demonstration script creates a toplevel window containing
diff --git a/ext/tk/sample/demos-en/rolodex b/ext/tk/sample/demos-en/rolodex
index b4c42b6199..dfc4b2b245 100644
--- a/ext/tk/sample/demos-en/rolodex
+++ b/ext/tk/sample/demos-en/rolodex
@@ -284,7 +284,7 @@ $helpTopics["context"] = <<EOF
Unfortunately, this application doesn't support context-sensitive\
help in the usual way, because when this demo was written Ruby/Tk\
didn't have a grab mechanism and this is needed for context-sensitive\
-help. Instead, you can achieve much the same effect by simply moving\
+help. Instead, you can achive much the same effect by simply moving\
the mouse over the window you're curious about and pressing the\
Help or F1 keys. You can do this anytime.
EOF
diff --git a/ext/tk/sample/demos-en/ruler.rb b/ext/tk/sample/demos-en/ruler.rb
index d9a2c037b8..a9773699f7 100644
--- a/ext/tk/sample/demos-en/ruler.rb
+++ b/ext/tk/sample/demos-en/ruler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ruler.rb
#
# This demonstration script creates a canvas widget that displays a ruler
diff --git a/ext/tk/sample/demos-en/sayings.rb b/ext/tk/sample/demos-en/sayings.rb
index e7ddfe5b5d..a4dcf37cdc 100644
--- a/ext/tk/sample/demos-en/sayings.rb
+++ b/ext/tk/sample/demos-en/sayings.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# sayings.rb
#
# This demonstration script creates a listbox that can be scrolled
diff --git a/ext/tk/sample/demos-en/search.rb b/ext/tk/sample/demos-en/search.rb
index 82c0d169a9..7fb40d88b2 100644
--- a/ext/tk/sample/demos-en/search.rb
+++ b/ext/tk/sample/demos-en/search.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# search.rb
#
# This demonstration script creates a collection of widgets that
diff --git a/ext/tk/sample/demos-en/spin.rb b/ext/tk/sample/demos-en/spin.rb
index d3558d56d6..d51b7e6619 100644
--- a/ext/tk/sample/demos-en/spin.rb
+++ b/ext/tk/sample/demos-en/spin.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# spin.rb --
#
# This demonstration script creates several spinbox widgets.
diff --git a/ext/tk/sample/demos-en/states.rb b/ext/tk/sample/demos-en/states.rb
index 4eac7424e7..a5c01a867c 100644
--- a/ext/tk/sample/demos-en/states.rb
+++ b/ext/tk/sample/demos-en/states.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# states.rb
#
# This demonstration script creates a listbox widget that displays
diff --git a/ext/tk/sample/demos-en/style.rb b/ext/tk/sample/demos-en/style.rb
index a6fd6b328c..5c8777379e 100644
--- a/ext/tk/sample/demos-en/style.rb
+++ b/ext/tk/sample/demos-en/style.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# style.rb
#
# This demonstration script creates a text widget that illustrates the
diff --git a/ext/tk/sample/demos-en/text.rb b/ext/tk/sample/demos-en/text.rb
index c44be395b6..2f72de7583 100644
--- a/ext/tk/sample/demos-en/text.rb
+++ b/ext/tk/sample/demos-en/text.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# text.rb
#
# This demonstration script creates a text widget that describes
diff --git a/ext/tk/sample/demos-en/textpeer.rb b/ext/tk/sample/demos-en/textpeer.rb
index c3298e2caa..20192fcd05 100644
--- a/ext/tk/sample/demos-en/textpeer.rb
+++ b/ext/tk/sample/demos-en/textpeer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# text widget peering demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/tkencoding.rb b/ext/tk/sample/demos-en/tkencoding.rb
index 01a11ad7ed..727491a6ad 100644
--- a/ext/tk/sample/demos-en/tkencoding.rb
+++ b/ext/tk/sample/demos-en/tkencoding.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# -*- ruby -*-
#
# tkencoding.rb
diff --git a/ext/tk/sample/demos-en/toolbar.rb b/ext/tk/sample/demos-en/toolbar.rb
index 1914e6eaad..e7cbeb4235 100644
--- a/ext/tk/sample/demos-en/toolbar.rb
+++ b/ext/tk/sample/demos-en/toolbar.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# toolbar.rb --
#
# This demonstration script creates a toolbar that can be torn off.
diff --git a/ext/tk/sample/demos-en/tree.rb b/ext/tk/sample/demos-en/tree.rb
index e3e5527f79..69154ee076 100644
--- a/ext/tk/sample/demos-en/tree.rb
+++ b/ext/tk/sample/demos-en/tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# tree.rb --
#
# This demonstration script creates a toplevel window containing a Ttk
diff --git a/ext/tk/sample/demos-en/ttkbut.rb b/ext/tk/sample/demos-en/ttkbut.rb
index f2fcbcc7ba..a784efcc08 100644
--- a/ext/tk/sample/demos-en/ttkbut.rb
+++ b/ext/tk/sample/demos-en/ttkbut.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ttkbut.rb
#
# This demonstration script creates a toplevel window containing several
diff --git a/ext/tk/sample/demos-en/ttkmenu.rb b/ext/tk/sample/demos-en/ttkmenu.rb
index f84c9138d5..9399568313 100644
--- a/ext/tk/sample/demos-en/ttkmenu.rb
+++ b/ext/tk/sample/demos-en/ttkmenu.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ttkmenu.rb --
#
# This demonstration script creates a toplevel window containing several Ttk
diff --git a/ext/tk/sample/demos-en/ttknote.rb b/ext/tk/sample/demos-en/ttknote.rb
index 7c56252d2d..bc0c7b369a 100644
--- a/ext/tk/sample/demos-en/ttknote.rb
+++ b/ext/tk/sample/demos-en/ttknote.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ttknote.rb --
#
# This demonstration script creates a toplevel window containing a Ttk
diff --git a/ext/tk/sample/demos-en/ttkpane.rb b/ext/tk/sample/demos-en/ttkpane.rb
index 7eb4c29731..87c4dedeb2 100644
--- a/ext/tk/sample/demos-en/ttkpane.rb
+++ b/ext/tk/sample/demos-en/ttkpane.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ttkpane.rb --
#
# This demonstration script creates a Ttk pane with some content.
diff --git a/ext/tk/sample/demos-en/ttkprogress.rb b/ext/tk/sample/demos-en/ttkprogress.rb
index 09bf398e17..c341a9385f 100644
--- a/ext/tk/sample/demos-en/ttkprogress.rb
+++ b/ext/tk/sample/demos-en/ttkprogress.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# ttkprogress.rb --
#
# This demonstration script creates several progress bar widgets.
diff --git a/ext/tk/sample/demos-en/twind.rb b/ext/tk/sample/demos-en/twind.rb
index a709f0d188..60a345d0b4 100644
--- a/ext/tk/sample/demos-en/twind.rb
+++ b/ext/tk/sample/demos-en/twind.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# twind.rb
#
# This demonstration script creates a text widget with a bunch of
diff --git a/ext/tk/sample/demos-en/twind2.rb b/ext/tk/sample/demos-en/twind2.rb
index 4a59a2e613..af7313dd82 100644
--- a/ext/tk/sample/demos-en/twind2.rb
+++ b/ext/tk/sample/demos-en/twind2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# text (embedded windows) widget demo 2 (called by 'widget')
#
diff --git a/ext/tk/sample/demos-en/unicodeout.rb b/ext/tk/sample/demos-en/unicodeout.rb
index 910dff38b7..ee7b5afa15 100644
--- a/ext/tk/sample/demos-en/unicodeout.rb
+++ b/ext/tk/sample/demos-en/unicodeout.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# unicodeout.rb --
#
# This demonstration script shows how you can produce output (in label
diff --git a/ext/tk/sample/demos-en/vscale.rb b/ext/tk/sample/demos-en/vscale.rb
index 2ce522f7be..b05ed12072 100644
--- a/ext/tk/sample/demos-en/vscale.rb
+++ b/ext/tk/sample/demos-en/vscale.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# vscale.rb
#
# This demonstration script shows an example with a vertical scale.
diff --git a/ext/tk/sample/demos-jp/anilabel.rb b/ext/tk/sample/demos-jp/anilabel.rb
index ccad73ffc6..c882f43f7e 100644
--- a/ext/tk/sample/demos-jp/anilabel.rb
+++ b/ext/tk/sample/demos-jp/anilabel.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# animated label widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/aniwave.rb b/ext/tk/sample/demos-jp/aniwave.rb
index 6973de7f09..866316c331 100644
--- a/ext/tk/sample/demos-jp/aniwave.rb
+++ b/ext/tk/sample/demos-jp/aniwave.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# animated wave demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/arrow.rb b/ext/tk/sample/demos-jp/arrow.rb
index 12ab4af2b1..2995f96d54 100644
--- a/ext/tk/sample/demos-jp/arrow.rb
+++ b/ext/tk/sample/demos-jp/arrow.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# arrowhead widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb
index 74ddf0217a..efba6e6c01 100644
--- a/ext/tk/sample/demos-jp/bind.rb
+++ b/ext/tk/sample/demos-jp/bind.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# text (tag bindings) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/bitmap.rb b/ext/tk/sample/demos-jp/bitmap.rb
index 2cc9c28fbd..d84e9a5f09 100644
--- a/ext/tk/sample/demos-jp/bitmap.rb
+++ b/ext/tk/sample/demos-jp/bitmap.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# bitmap widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/button.rb b/ext/tk/sample/demos-jp/button.rb
index 204f5eab86..301100b057 100644
--- a/ext/tk/sample/demos-jp/button.rb
+++ b/ext/tk/sample/demos-jp/button.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# button widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/check.rb b/ext/tk/sample/demos-jp/check.rb
index 04a47c8101..422e898ec9 100644
--- a/ext/tk/sample/demos-jp/check.rb
+++ b/ext/tk/sample/demos-jp/check.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# checkbutton widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb
index 609f6830d8..558e588535 100644
--- a/ext/tk/sample/demos-jp/check2.rb
+++ b/ext/tk/sample/demos-jp/check2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# checkbutton widget demo2 (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/clrpick.rb b/ext/tk/sample/demos-jp/clrpick.rb
index 31a3f25b7c..df8c76a69d 100644
--- a/ext/tk/sample/demos-jp/clrpick.rb
+++ b/ext/tk/sample/demos-jp/clrpick.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# widget demo prompts the user to select a color (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/colors.rb b/ext/tk/sample/demos-jp/colors.rb
index c0145daaf6..5e5f47cb04 100644
--- a/ext/tk/sample/demos-jp/colors.rb
+++ b/ext/tk/sample/demos-jp/colors.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# listbox widget demo 'colors' (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/combo.rb b/ext/tk/sample/demos-jp/combo.rb
index 0f3e808606..8bbe36997d 100644
--- a/ext/tk/sample/demos-jp/combo.rb
+++ b/ext/tk/sample/demos-jp/combo.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# combo.rb --
#
diff --git a/ext/tk/sample/demos-jp/cscroll.rb b/ext/tk/sample/demos-jp/cscroll.rb
index 6cce3d4369..e993326aa9 100644
--- a/ext/tk/sample/demos-jp/cscroll.rb
+++ b/ext/tk/sample/demos-jp/cscroll.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# simple scrollable canvas widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/ctext.rb b/ext/tk/sample/demos-jp/ctext.rb
index ce7de841e8..bb354c490e 100644
--- a/ext/tk/sample/demos-jp/ctext.rb
+++ b/ext/tk/sample/demos-jp/ctext.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# Canvas Text widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/dialog1.rb b/ext/tk/sample/demos-jp/dialog1.rb
index 9d54f93b35..e50c9071e5 100644
--- a/ext/tk/sample/demos-jp/dialog1.rb
+++ b/ext/tk/sample/demos-jp/dialog1.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# a dialog box with a local grab (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/dialog2.rb b/ext/tk/sample/demos-jp/dialog2.rb
index c8506b6cf8..3e7d9619a4 100644
--- a/ext/tk/sample/demos-jp/dialog2.rb
+++ b/ext/tk/sample/demos-jp/dialog2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# a dialog box with a global grab (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/entry1.rb b/ext/tk/sample/demos-jp/entry1.rb
index 0fbbeb8259..9be677d12d 100644
--- a/ext/tk/sample/demos-jp/entry1.rb
+++ b/ext/tk/sample/demos-jp/entry1.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# entry (no scrollbars) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/entry2.rb b/ext/tk/sample/demos-jp/entry2.rb
index 294c82490f..5476d24ade 100644
--- a/ext/tk/sample/demos-jp/entry2.rb
+++ b/ext/tk/sample/demos-jp/entry2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# entry (with scrollbars) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/entry3.rb b/ext/tk/sample/demos-jp/entry3.rb
index 6f8ba943e9..59c698de62 100644
--- a/ext/tk/sample/demos-jp/entry3.rb
+++ b/ext/tk/sample/demos-jp/entry3.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
# entry3.rb --
#
# This demonstration script creates several entry widgets whose
diff --git a/ext/tk/sample/demos-jp/filebox.rb b/ext/tk/sample/demos-jp/filebox.rb
index 800dd5ddbf..fc014bc282 100644
--- a/ext/tk/sample/demos-jp/filebox.rb
+++ b/ext/tk/sample/demos-jp/filebox.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# widget demo prompts the user to select a file (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/floor.rb b/ext/tk/sample/demos-jp/floor.rb
index 8a079035c9..5101a026bb 100644
--- a/ext/tk/sample/demos-jp/floor.rb
+++ b/ext/tk/sample/demos-jp/floor.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# floorDisplay widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb
index 7f294ce82e..7ca705c7bd 100644
--- a/ext/tk/sample/demos-jp/floor2.rb
+++ b/ext/tk/sample/demos-jp/floor2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# floorDisplay widget demo 2 (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/form.rb b/ext/tk/sample/demos-jp/form.rb
index 751852cbf7..000fcb5091 100644
--- a/ext/tk/sample/demos-jp/form.rb
+++ b/ext/tk/sample/demos-jp/form.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# form widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb
index cc039b2d62..fc38d877db 100644
--- a/ext/tk/sample/demos-jp/goldberg.rb
+++ b/ext/tk/sample/demos-jp/goldberg.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# Ruby/Tk Goldverg demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/hscale.rb b/ext/tk/sample/demos-jp/hscale.rb
index 0607792a74..2dfbf38272 100644
--- a/ext/tk/sample/demos-jp/hscale.rb
+++ b/ext/tk/sample/demos-jp/hscale.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
require "tkcanvas"
if defined?($hscale_demo) && $hscale_deom
diff --git a/ext/tk/sample/demos-jp/icon.rb b/ext/tk/sample/demos-jp/icon.rb
index 7bf6d9731b..6b9e1a570a 100644
--- a/ext/tk/sample/demos-jp/icon.rb
+++ b/ext/tk/sample/demos-jp/icon.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# iconic button widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/image1.rb b/ext/tk/sample/demos-jp/image1.rb
index e07f1d3afc..0c69b2a45f 100644
--- a/ext/tk/sample/demos-jp/image1.rb
+++ b/ext/tk/sample/demos-jp/image1.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# two image widgets demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/image2.rb b/ext/tk/sample/demos-jp/image2.rb
index 312ec41f2a..aa507c5b9b 100644
--- a/ext/tk/sample/demos-jp/image2.rb
+++ b/ext/tk/sample/demos-jp/image2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# widget demo 'load image' (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/image3.rb b/ext/tk/sample/demos-jp/image3.rb
index 3f2b1ad3b9..5c1ceb2816 100644
--- a/ext/tk/sample/demos-jp/image3.rb
+++ b/ext/tk/sample/demos-jp/image3.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
# image3.rb
#
# This demonstration script creates a simple collection of widgets
diff --git a/ext/tk/sample/demos-jp/items.rb b/ext/tk/sample/demos-jp/items.rb
index 9fef0bedda..b1d66f367b 100644
--- a/ext/tk/sample/demos-jp/items.rb
+++ b/ext/tk/sample/demos-jp/items.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# canvas item types widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/knightstour.rb b/ext/tk/sample/demos-jp/knightstour.rb
index f4de10b3b3..835a24c392 100644
--- a/ext/tk/sample/demos-jp/knightstour.rb
+++ b/ext/tk/sample/demos-jp/knightstour.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# Based on the widget demo of Tcl/Tk8.5.2
# The following is the original copyright text.
diff --git a/ext/tk/sample/demos-jp/label.rb b/ext/tk/sample/demos-jp/label.rb
index 6164ac1ebc..700e6a61ce 100644
--- a/ext/tk/sample/demos-jp/label.rb
+++ b/ext/tk/sample/demos-jp/label.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# label widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/labelframe.rb b/ext/tk/sample/demos-jp/labelframe.rb
index 3dcd1dc3f1..80e106c6e7 100644
--- a/ext/tk/sample/demos-jp/labelframe.rb
+++ b/ext/tk/sample/demos-jp/labelframe.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# labelframe.rb
#
diff --git a/ext/tk/sample/demos-jp/mclist.rb b/ext/tk/sample/demos-jp/mclist.rb
index e7b71edfdb..67cec638eb 100644
--- a/ext/tk/sample/demos-jp/mclist.rb
+++ b/ext/tk/sample/demos-jp/mclist.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# mclist.rb --
#
diff --git a/ext/tk/sample/demos-jp/menu.rb b/ext/tk/sample/demos-jp/menu.rb
index 30e491d953..05ea7a9ec2 100644
--- a/ext/tk/sample/demos-jp/menu.rb
+++ b/ext/tk/sample/demos-jp/menu.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# menus widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/menu84.rb b/ext/tk/sample/demos-jp/menu84.rb
index 3fd879e4f7..6a57279481 100644
--- a/ext/tk/sample/demos-jp/menu84.rb
+++ b/ext/tk/sample/demos-jp/menu84.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# menus widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb
index a1acda4c1b..77ecb5bcf3 100644
--- a/ext/tk/sample/demos-jp/menu8x.rb
+++ b/ext/tk/sample/demos-jp/menu8x.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# menus widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/menubu.rb b/ext/tk/sample/demos-jp/menubu.rb
index 57b1d41420..06f9eb875e 100644
--- a/ext/tk/sample/demos-jp/menubu.rb
+++ b/ext/tk/sample/demos-jp/menubu.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
require "tkcanvas"
def optionMenu(menubutton, varName, firstValue, *rest)
diff --git a/ext/tk/sample/demos-jp/msgbox.rb b/ext/tk/sample/demos-jp/msgbox.rb
index 45d8b8e9f9..ec7b4f2bbc 100644
--- a/ext/tk/sample/demos-jp/msgbox.rb
+++ b/ext/tk/sample/demos-jp/msgbox.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# message boxes widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/msgbox2.rb b/ext/tk/sample/demos-jp/msgbox2.rb
index 51a0ca9dcc..ad6d936036 100644
--- a/ext/tk/sample/demos-jp/msgbox2.rb
+++ b/ext/tk/sample/demos-jp/msgbox2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# message boxes widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/paned1.rb b/ext/tk/sample/demos-jp/paned1.rb
index 96e419bec0..53d2e7162b 100644
--- a/ext/tk/sample/demos-jp/paned1.rb
+++ b/ext/tk/sample/demos-jp/paned1.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# paned1.rb
#
diff --git a/ext/tk/sample/demos-jp/paned2.rb b/ext/tk/sample/demos-jp/paned2.rb
index 11a02abe73..65bd41c757 100644
--- a/ext/tk/sample/demos-jp/paned2.rb
+++ b/ext/tk/sample/demos-jp/paned2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# paned2.rb --
#
diff --git a/ext/tk/sample/demos-jp/pendulum.rb b/ext/tk/sample/demos-jp/pendulum.rb
index 06e6933548..60556fd70a 100644
--- a/ext/tk/sample/demos-jp/pendulum.rb
+++ b/ext/tk/sample/demos-jp/pendulum.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# This demonstration illustrates how Tcl/Tk can be used to construct
# simulations of physical systems.
diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb
index 85970bb5b3..4147b35399 100644
--- a/ext/tk/sample/demos-jp/plot.rb
+++ b/ext/tk/sample/demos-jp/plot.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# 2-D plot widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/puzzle.rb b/ext/tk/sample/demos-jp/puzzle.rb
index 61fb4cbf60..dbcb423463 100644
--- a/ext/tk/sample/demos-jp/puzzle.rb
+++ b/ext/tk/sample/demos-jp/puzzle.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# widet demo 'puzzle' (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/radio.rb b/ext/tk/sample/demos-jp/radio.rb
index 4d84441687..efb613593d 100644
--- a/ext/tk/sample/demos-jp/radio.rb
+++ b/ext/tk/sample/demos-jp/radio.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# radiobutton widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/radio2.rb b/ext/tk/sample/demos-jp/radio2.rb
index 4416122876..0633a8def1 100644
--- a/ext/tk/sample/demos-jp/radio2.rb
+++ b/ext/tk/sample/demos-jp/radio2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# radio2.rb
#
diff --git a/ext/tk/sample/demos-jp/radio3.rb b/ext/tk/sample/demos-jp/radio3.rb
index 3f26ffb847..3356b6945b 100644
--- a/ext/tk/sample/demos-jp/radio3.rb
+++ b/ext/tk/sample/demos-jp/radio3.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# radio3.rb
#
diff --git a/ext/tk/sample/demos-jp/rolodex b/ext/tk/sample/demos-jp/rolodex
index 95c0e3b869..2cc73e128f 100644
--- a/ext/tk/sample/demos-jp/rolodex
+++ b/ext/tk/sample/demos-jp/rolodex
@@ -284,7 +284,7 @@ $helpTopics["context"] = <<EOF
Unfortunately, this application doesn't support context-sensitive\
help in the usual way, because when this demo was written Ruby/Tk\
didn't have a grab mechanism and this is needed for context-sensitive\
-help. Instead, you can achieve much the same effect by simply moving\
+help. Instead, you can achive much the same effect by simply moving\
the mouse over the window you're curious about and pressing the\
Help or F1 keys. You can do this anytime.
EOF
diff --git a/ext/tk/sample/demos-jp/ruler.rb b/ext/tk/sample/demos-jp/ruler.rb
index 734f47f142..5c34a5a5da 100644
--- a/ext/tk/sample/demos-jp/ruler.rb
+++ b/ext/tk/sample/demos-jp/ruler.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# ruler widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/sayings.rb b/ext/tk/sample/demos-jp/sayings.rb
index a60b0bf2e5..cf4fe7b1b1 100644
--- a/ext/tk/sample/demos-jp/sayings.rb
+++ b/ext/tk/sample/demos-jp/sayings.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# listbox widget demo 'sayings' (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/search.rb b/ext/tk/sample/demos-jp/search.rb
index dffccf1a48..238450ae30 100644
--- a/ext/tk/sample/demos-jp/search.rb
+++ b/ext/tk/sample/demos-jp/search.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# Text Search widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/spin.rb b/ext/tk/sample/demos-jp/spin.rb
index 616a14e9d6..fd51a3f457 100644
--- a/ext/tk/sample/demos-jp/spin.rb
+++ b/ext/tk/sample/demos-jp/spin.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# spin.rb --
#
diff --git a/ext/tk/sample/demos-jp/states.rb b/ext/tk/sample/demos-jp/states.rb
index 9f8fb0ef03..2966e6d834 100644
--- a/ext/tk/sample/demos-jp/states.rb
+++ b/ext/tk/sample/demos-jp/states.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# listbox widget demo 'states' (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/style.rb b/ext/tk/sample/demos-jp/style.rb
index 737c9f8994..813fde7a78 100644
--- a/ext/tk/sample/demos-jp/style.rb
+++ b/ext/tk/sample/demos-jp/style.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# text (display styles) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/text.rb b/ext/tk/sample/demos-jp/text.rb
index 117f9f105a..e698a79246 100644
--- a/ext/tk/sample/demos-jp/text.rb
+++ b/ext/tk/sample/demos-jp/text.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# text (basic facilities) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/textpeer.rb b/ext/tk/sample/demos-jp/textpeer.rb
index 31e467afef..4d896d2a12 100644
--- a/ext/tk/sample/demos-jp/textpeer.rb
+++ b/ext/tk/sample/demos-jp/textpeer.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# text widget peering demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/toolbar.rb b/ext/tk/sample/demos-jp/toolbar.rb
index f355e8fef8..3ee7a5f9d8 100644
--- a/ext/tk/sample/demos-jp/toolbar.rb
+++ b/ext/tk/sample/demos-jp/toolbar.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# toolbar.rb --
#
diff --git a/ext/tk/sample/demos-jp/tree.rb b/ext/tk/sample/demos-jp/tree.rb
index 48d5e5407e..3f3b18b677 100644
--- a/ext/tk/sample/demos-jp/tree.rb
+++ b/ext/tk/sample/demos-jp/tree.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# tree.rb --
#
diff --git a/ext/tk/sample/demos-jp/ttkbut.rb b/ext/tk/sample/demos-jp/ttkbut.rb
index af9321dcd9..ccde541019 100644
--- a/ext/tk/sample/demos-jp/ttkbut.rb
+++ b/ext/tk/sample/demos-jp/ttkbut.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# ttkbut.rb
#
diff --git a/ext/tk/sample/demos-jp/ttkmenu.rb b/ext/tk/sample/demos-jp/ttkmenu.rb
index b521a3f101..aa9db5019f 100644
--- a/ext/tk/sample/demos-jp/ttkmenu.rb
+++ b/ext/tk/sample/demos-jp/ttkmenu.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# ttkmenu.rb --
#
diff --git a/ext/tk/sample/demos-jp/ttknote.rb b/ext/tk/sample/demos-jp/ttknote.rb
index 2f82408ba0..f3b2fa5881 100644
--- a/ext/tk/sample/demos-jp/ttknote.rb
+++ b/ext/tk/sample/demos-jp/ttknote.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# ttknote.rb --
#
diff --git a/ext/tk/sample/demos-jp/ttkpane.rb b/ext/tk/sample/demos-jp/ttkpane.rb
index af7622272c..a5c1a08ec9 100644
--- a/ext/tk/sample/demos-jp/ttkpane.rb
+++ b/ext/tk/sample/demos-jp/ttkpane.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# ttkpane.rb --
#
diff --git a/ext/tk/sample/demos-jp/ttkprogress.rb b/ext/tk/sample/demos-jp/ttkprogress.rb
index 6f0ea4c2df..ec28253a9f 100644
--- a/ext/tk/sample/demos-jp/ttkprogress.rb
+++ b/ext/tk/sample/demos-jp/ttkprogress.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# ttkprogress.rb --
#
diff --git a/ext/tk/sample/demos-jp/twind.rb b/ext/tk/sample/demos-jp/twind.rb
index 7db7576c6e..f13a137cc3 100644
--- a/ext/tk/sample/demos-jp/twind.rb
+++ b/ext/tk/sample/demos-jp/twind.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# text (embedded windows) widget demo (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/twind2.rb b/ext/tk/sample/demos-jp/twind2.rb
index c5bef5bce0..a783ba4738 100644
--- a/ext/tk/sample/demos-jp/twind2.rb
+++ b/ext/tk/sample/demos-jp/twind2.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# text (embedded windows) widget demo 2 (called by 'widget')
#
diff --git a/ext/tk/sample/demos-jp/unicodeout.rb b/ext/tk/sample/demos-jp/unicodeout.rb
index 966f85f331..31596cf8fd 100644
--- a/ext/tk/sample/demos-jp/unicodeout.rb
+++ b/ext/tk/sample/demos-jp/unicodeout.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
#
# unicodeout.rb --
#
diff --git a/ext/tk/sample/demos-jp/vscale.rb b/ext/tk/sample/demos-jp/vscale.rb
index a502634138..6ae513bc33 100644
--- a/ext/tk/sample/demos-jp/vscale.rb
+++ b/ext/tk/sample/demos-jp/vscale.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
require "tkcanvas"
if defined?($vscale_demo) && $vscale_demo
diff --git a/ext/tk/sample/editable_listbox.rb b/ext/tk/sample/editable_listbox.rb
index 02a3f4aad3..890aec032e 100644
--- a/ext/tk/sample/editable_listbox.rb
+++ b/ext/tk/sample/editable_listbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Tk::RbWidget::Editable_Listbox class
#
diff --git a/ext/tk/sample/encstr_usage.rb b/ext/tk/sample/encstr_usage.rb
index 49a29ec19a..39dc9c4018 100644
--- a/ext/tk/sample/encstr_usage.rb
+++ b/ext/tk/sample/encstr_usage.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'tk'
TkMessage.new(:width=>400, :text=><<EOM).pack
diff --git a/ext/tk/sample/figmemo_sample.rb b/ext/tk/sample/figmemo_sample.rb
index 4e5684fa94..da6c41797e 100644
--- a/ext/tk/sample/figmemo_sample.rb
+++ b/ext/tk/sample/figmemo_sample.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
begin
@@ -301,7 +300,7 @@ end
def open_file(canvas, fname)
if canvas.modified?
ret = Tk.messageBox(:icon=>'warning',:type=>'okcancel',:default=>'cancel',
- :message=>'Canvas may be modified. Really erase? ')
+ :message=>'Canvas may be modified. Realy erase? ')
return if ret == 'cancel'
end
diff --git a/ext/tk/sample/irbtk.rb b/ext/tk/sample/irbtk.rb
index 8665b20539..70dd33e4da 100644
--- a/ext/tk/sample/irbtk.rb
+++ b/ext/tk/sample/irbtk.rb
@@ -1,5 +1,4 @@
#!/usr/local/bin/ruby
-# frozen_string_literal: false
#
# irbtk.rb - irb with Ruby/Tk
#
diff --git a/ext/tk/sample/menubar1.rb b/ext/tk/sample/menubar1.rb
index a468fb6ea4..a233c6e088 100644
--- a/ext/tk/sample/menubar1.rb
+++ b/ext/tk/sample/menubar1.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# menubar sample 1 : use frame and menubuttons
#
@@ -44,7 +43,7 @@ menubar = TkMenubar.new(nil, menu_spec,
'tearoff'=>false,
'foreground'=>'grey40',
'activeforeground'=>'red',
- 'font'=>'Helvetica 12 bold')
+ 'font'=>'Helvetia 12 bold')
menubar.pack('side'=>'top', 'fill'=>'x')
TkText.new(:wrap=>'word').pack.insert('1.0', 'Please read the sample source, and check how to override default configure options of menu entries on a menu_spec. Maybe, on windows, this menubar does not work properly about keyboard shortcuts. Then, please use "menu" option of root/toplevel widget (see sample/menubar2.rb).')
diff --git a/ext/tk/sample/menubar2.rb b/ext/tk/sample/menubar2.rb
index e10a282f93..e3cd68eaef 100644
--- a/ext/tk/sample/menubar2.rb
+++ b/ext/tk/sample/menubar2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# menubar sample 2 : use 'menu' option of root/toplevel widget
#
@@ -45,12 +44,12 @@ mbar = Tk.root.add_menubar(menu_spec,
'tearoff'=>'false',
'foreground'=>'grey40',
'activeforeground'=>'red',
- 'font'=>'Helvetica 12 bold')
+ 'font'=>'Helvetia 12 bold')
# This (default configure options) is NOT same the following.
#
# mbar = Tk.root.add_menubar(menu_spec)
# mbar.configure('foreground'=>'grey40', 'activeforeground'=>'red',
-# 'font'=>'Helvetica 12 bold')
+# 'font'=>'Helvetia 12 bold')
TkText.new(:wrap=>'word').pack.insert('1.0', 'Please read the sample source, and check how to override default configure options of menu entries on a menu_spec.')
diff --git a/ext/tk/sample/menubar3.rb b/ext/tk/sample/menubar3.rb
index f8344cc834..4f42f81c88 100644
--- a/ext/tk/sample/menubar3.rb
+++ b/ext/tk/sample/menubar3.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# menubar sample 3 : vertical layout menubar; use frame and menubuttons
#
@@ -63,7 +62,7 @@ menubar = TkMenubar.new(nil, menu_spec,
'tearoff'=>false,
'foreground'=>'grey40',
'activeforeground'=>'red',
- 'font'=>'Helvetica 12 bold')
+ 'font'=>'Helvetia 12 bold')
menubar.pack('side'=>'left', 'fill'=>'y')
TkText.new(:wrap=>'word').pack.insert('1.0', 'This sample script generates "Menu Sidebar".
diff --git a/ext/tk/sample/multi-ip_sample.rb b/ext/tk/sample/multi-ip_sample.rb
index fb7a8afb5b..eccf0201f8 100644
--- a/ext/tk/sample/multi-ip_sample.rb
+++ b/ext/tk/sample/multi-ip_sample.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
# This script is a sample of MultiTkIp class
require "multi-tk"
diff --git a/ext/tk/sample/multi-ip_sample2.rb b/ext/tk/sample/multi-ip_sample2.rb
index ae2cb35e96..79c78dec4a 100644
--- a/ext/tk/sample/multi-ip_sample2.rb
+++ b/ext/tk/sample/multi-ip_sample2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'multi-tk.rb'
th = Thread.new{Tk.mainloop}
diff --git a/ext/tk/sample/optobj_sample.rb b/ext/tk/sample/optobj_sample.rb
index 5e4806f8fb..a781254a28 100644
--- a/ext/tk/sample/optobj_sample.rb
+++ b/ext/tk/sample/optobj_sample.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# sample script of Tk::OptionObj
#
diff --git a/ext/tk/sample/propagate.rb b/ext/tk/sample/propagate.rb
index 10e0ed8236..66f14aeb72 100644
--- a/ext/tk/sample/propagate.rb
+++ b/ext/tk/sample/propagate.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
TkLabel.new(:text=>"Please click the bottom frame").pack
diff --git a/ext/tk/sample/remote-ip_sample.rb b/ext/tk/sample/remote-ip_sample.rb
index d80399f368..f6eed9e985 100644
--- a/ext/tk/sample/remote-ip_sample.rb
+++ b/ext/tk/sample/remote-ip_sample.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'remote-tk'
puts <<EOM
diff --git a/ext/tk/sample/remote-ip_sample2.rb b/ext/tk/sample/remote-ip_sample2.rb
index 919bfd0b67..d8cf3c7650 100644
--- a/ext/tk/sample/remote-ip_sample2.rb
+++ b/ext/tk/sample/remote-ip_sample2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'remote-tk'
diff --git a/ext/tk/sample/safe-tk.rb b/ext/tk/sample/safe-tk.rb
index a8a85d3288..38131c0155 100755..100644
--- a/ext/tk/sample/safe-tk.rb
+++ b/ext/tk/sample/safe-tk.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
# This script is a sample of MultiTkIp class
require "multi-tk"
@@ -118,6 +117,9 @@ p ip.eval_str("
:padx=>10, :pady=>7)
", bind)
+puts "\n---- change the safe slave IP's safe-level ==> 4 ----------"
+ip.safe_level = 4
+
puts "\n---- call 3rd and 4th eval_proc ----------"
p ip.eval_proc{
TkLabel.new(:text=>"3rd and 4th eval_proc : $SAFE == #{$SAFE}").pack
diff --git a/ext/tk/sample/scrollframe.rb b/ext/tk/sample/scrollframe.rb
index fda4478055..e340e1da3c 100644
--- a/ext/tk/sample/scrollframe.rb
+++ b/ext/tk/sample/scrollframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Tk::RbWidget::ScrollFrame class
#
@@ -14,8 +13,6 @@
#
require 'tk'
-module Tk::RbWidget; end
-
class Tk::RbWidget::ScrollFrame < TkFrame
include TkComposite
diff --git a/ext/tk/sample/tcltklib/lines1.rb b/ext/tk/sample/tcltklib/lines1.rb
index 57e3d33f6f..9f21ae6377 100644
--- a/ext/tk/sample/tcltklib/lines1.rb
+++ b/ext/tk/sample/tcltklib/lines1.rb
@@ -1,5 +1,4 @@
#! /usr/local/bin/ruby
-# frozen_string_literal: false
require "tcltk"
diff --git a/ext/tk/sample/tcltklib/lines2.rb b/ext/tk/sample/tcltklib/lines2.rb
index 7ae54d9ea9..e459589f50 100644
--- a/ext/tk/sample/tcltklib/lines2.rb
+++ b/ext/tk/sample/tcltklib/lines2.rb
@@ -1,5 +1,4 @@
#! /usr/local/bin/ruby
-# frozen_string_literal: false
require "tk"
diff --git a/ext/tk/sample/tcltklib/lines3.rb b/ext/tk/sample/tcltklib/lines3.rb
index d79bb12ef3..caa50f92e7 100644
--- a/ext/tk/sample/tcltklib/lines3.rb
+++ b/ext/tk/sample/tcltklib/lines3.rb
@@ -1,5 +1,4 @@
#! /usr/local/bin/ruby
-# frozen_string_literal: false
require "tk"
diff --git a/ext/tk/sample/tcltklib/lines4.rb b/ext/tk/sample/tcltklib/lines4.rb
index 37ffc0ee74..7a1175bce0 100644
--- a/ext/tk/sample/tcltklib/lines4.rb
+++ b/ext/tk/sample/tcltklib/lines4.rb
@@ -1,5 +1,4 @@
#! /usr/local/bin/ruby
-# frozen_string_literal: false
require "tk"
diff --git a/ext/tk/sample/tcltklib/safeTk.rb b/ext/tk/sample/tcltklib/safeTk.rb
index 5fac9e2e23..5d2c60e700 100644
--- a/ext/tk/sample/tcltklib/safeTk.rb
+++ b/ext/tk/sample/tcltklib/safeTk.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tcltklib'
master = TclTkIp.new
diff --git a/ext/tk/sample/tcltklib/sample0.rb b/ext/tk/sample/tcltklib/sample0.rb
index 0cc2de4878..0ac303ae9e 100644
--- a/ext/tk/sample/tcltklib/sample0.rb
+++ b/ext/tk/sample/tcltklib/sample0.rb
@@ -1,5 +1,4 @@
#! /usr/local/bin/ruby -vd
-# frozen_string_literal: false
# tcltklib ライブラリのテスト
diff --git a/ext/tk/sample/tcltklib/sample1.rb b/ext/tk/sample/tcltklib/sample1.rb
index b4ad6436bd..3235edfe0d 100644
--- a/ext/tk/sample/tcltklib/sample1.rb
+++ b/ext/tk/sample/tcltklib/sample1.rb
@@ -1,6 +1,5 @@
#! /usr/local/bin/ruby -d
# -*- encoding: utf-8 -*-
-# frozen_string_literal: false
# -d オプションを付けると, デバッグ情報を表示する.
# tcltk ライブラリのサンプル
diff --git a/ext/tk/sample/tcltklib/sample2.rb b/ext/tk/sample/tcltklib/sample2.rb
index 378c2d3eb7..1acc180680 100644
--- a/ext/tk/sample/tcltklib/sample2.rb
+++ b/ext/tk/sample/tcltklib/sample2.rb
@@ -1,5 +1,4 @@
#!/usr/local/bin/ruby
-# frozen_string_literal: false
#----------------------> pretty simple othello game <-----------------------
# othello.rb
#
diff --git a/ext/tk/sample/tkalignbox.rb b/ext/tk/sample/tkalignbox.rb
index 89aae111b7..f3d083c33d 100644
--- a/ext/tk/sample/tkalignbox.rb
+++ b/ext/tk/sample/tkalignbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkalignbox.rb : align widgets with same width/height
#
diff --git a/ext/tk/sample/tkballoonhelp.rb b/ext/tk/sample/tkballoonhelp.rb
index fb811164ab..2daa522601 100644
--- a/ext/tk/sample/tkballoonhelp.rb
+++ b/ext/tk/sample/tkballoonhelp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkballoonhelp.rb : simple balloon help widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/tkbiff.rb b/ext/tk/sample/tkbiff.rb
index a65e4beaa9..c0953a1b1b 100644
--- a/ext/tk/sample/tkbiff.rb
+++ b/ext/tk/sample/tkbiff.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
if ARGV[0] != '-d'
unless $DEBUG
diff --git a/ext/tk/sample/tkbrowse.rb b/ext/tk/sample/tkbrowse.rb
index f083a8ac77..56d5a80fcf 100644
--- a/ext/tk/sample/tkbrowse.rb
+++ b/ext/tk/sample/tkbrowse.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# This script generates a directory browser, which lists the working
# directory and allows you to open files or subdirectories by
diff --git a/ext/tk/sample/tkcombobox.rb b/ext/tk/sample/tkcombobox.rb
index 17adbc9f9e..c38bde10d4 100644
--- a/ext/tk/sample/tkcombobox.rb
+++ b/ext/tk/sample/tkcombobox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkcombobox.rb : auto scrollbox & combobox
#
diff --git a/ext/tk/sample/tkdialog.rb b/ext/tk/sample/tkdialog.rb
index f0f7d2ccb5..eb8cd04796 100644
--- a/ext/tk/sample/tkdialog.rb
+++ b/ext/tk/sample/tkdialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require "tk"
root = TkFrame.new
diff --git a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb
index 7ed3c267e4..02ba19a629 100644
--- a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb
+++ b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# viewIcons.rb
#
diff --git a/ext/tk/sample/tkextlib/blt/barchart5.rb b/ext/tk/sample/tkextlib/blt/barchart5.rb
index f818ffc375..86101b200d 100644
--- a/ext/tk/sample/tkextlib/blt/barchart5.rb
+++ b/ext/tk/sample/tkextlib/blt/barchart5.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/calendar.rb b/ext/tk/sample/tkextlib/blt/calendar.rb
index daae5fdcba..86d34043dc 100644
--- a/ext/tk/sample/tkextlib/blt/calendar.rb
+++ b/ext/tk/sample/tkextlib/blt/calendar.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/graph6.rb b/ext/tk/sample/tkextlib/blt/graph6.rb
index 26baa527ef..b3eeb81231 100644
--- a/ext/tk/sample/tkextlib/blt/graph6.rb
+++ b/ext/tk/sample/tkextlib/blt/graph6.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/graph7.rb b/ext/tk/sample/tkextlib/blt/graph7.rb
index 0e68388596..8b31b28c91 100644
--- a/ext/tk/sample/tkextlib/blt/graph7.rb
+++ b/ext/tk/sample/tkextlib/blt/graph7.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/graph7a.rb b/ext/tk/sample/tkextlib/blt/graph7a.rb
index aa744f1f74..8def766060 100644
--- a/ext/tk/sample/tkextlib/blt/graph7a.rb
+++ b/ext/tk/sample/tkextlib/blt/graph7a.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/graph7b.rb b/ext/tk/sample/tkextlib/blt/graph7b.rb
index 5b30c4bac0..8b00f154b2 100644
--- a/ext/tk/sample/tkextlib/blt/graph7b.rb
+++ b/ext/tk/sample/tkextlib/blt/graph7b.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/graph7c.rb b/ext/tk/sample/tkextlib/blt/graph7c.rb
index 8cbf3223f1..d4ed1a66ad 100644
--- a/ext/tk/sample/tkextlib/blt/graph7c.rb
+++ b/ext/tk/sample/tkextlib/blt/graph7c.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/pareto.rb b/ext/tk/sample/tkextlib/blt/pareto.rb
index e68cde7992..bf9a1ec749 100644
--- a/ext/tk/sample/tkextlib/blt/pareto.rb
+++ b/ext/tk/sample/tkextlib/blt/pareto.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
@@ -68,7 +67,7 @@ xdata.zip(ydata){|x, y|
:foreground=>'red4', :anchor=>:center, :yoffset=>-5)
}
-# Display an auxiliary y-axis for percentages.
+# Display an auxillary y-axis for percentages.
b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0,
:title=>'Percentage')
diff --git a/ext/tk/sample/tkextlib/blt/plot1.rb b/ext/tk/sample/tkextlib/blt/plot1.rb
index 95797c96b7..07dff48292 100644
--- a/ext/tk/sample/tkextlib/blt/plot1.rb
+++ b/ext/tk/sample/tkextlib/blt/plot1.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/plot1b.rb b/ext/tk/sample/tkextlib/blt/plot1b.rb
index 96adbd792b..8a3ce8216d 100644
--- a/ext/tk/sample/tkextlib/blt/plot1b.rb
+++ b/ext/tk/sample/tkextlib/blt/plot1b.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/scripts/stipples.rb b/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
index 2a4943e032..47f3c4d063 100644
--- a/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
+++ b/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$stipples = {} unless $stipples
$stipples['bdiagonal1'] = Tk::BLT::Bitmap.new(<<EOD)
diff --git a/ext/tk/sample/tkextlib/blt/winop1.rb b/ext/tk/sample/tkextlib/blt/winop1.rb
index 32c01cad6b..97c31aa295 100644
--- a/ext/tk/sample/tkextlib/blt/winop1.rb
+++ b/ext/tk/sample/tkextlib/blt/winop1.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/blt/winop2.rb b/ext/tk/sample/tkextlib/blt/winop2.rb
index cc708573ab..d59c43ba22 100644
--- a/ext/tk/sample/tkextlib/blt/winop2.rb
+++ b/ext/tk/sample/tkextlib/blt/winop2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/blt'
diff --git a/ext/tk/sample/tkextlib/bwidget/basic.rb b/ext/tk/sample/tkextlib/bwidget/basic.rb
index 6a7bdbc1f6..060baf8a6c 100644
--- a/ext/tk/sample/tkextlib/bwidget/basic.rb
+++ b/ext/tk/sample/tkextlib/bwidget/basic.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# basic demo --- called from demo.rb
#
diff --git a/ext/tk/sample/tkextlib/bwidget/demo.rb b/ext/tk/sample/tkextlib/bwidget/demo.rb
index 0b5578ca68..3eb98818f3 100644
--- a/ext/tk/sample/tkextlib/bwidget/demo.rb
+++ b/ext/tk/sample/tkextlib/bwidget/demo.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/bwidget'
diff --git a/ext/tk/sample/tkextlib/bwidget/dnd.rb b/ext/tk/sample/tkextlib/bwidget/dnd.rb
index 326288bade..b1b1cf60ff 100644
--- a/ext/tk/sample/tkextlib/bwidget/dnd.rb
+++ b/ext/tk/sample/tkextlib/bwidget/dnd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# dnd demo --- called from demo.rb
#
diff --git a/ext/tk/sample/tkextlib/bwidget/manager.rb b/ext/tk/sample/tkextlib/bwidget/manager.rb
index b0371699ad..a59afb8b86 100644
--- a/ext/tk/sample/tkextlib/bwidget/manager.rb
+++ b/ext/tk/sample/tkextlib/bwidget/manager.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# manager demo --- called from demo.rb
#
diff --git a/ext/tk/sample/tkextlib/bwidget/select.rb b/ext/tk/sample/tkextlib/bwidget/select.rb
index b32a69d837..3a1a810e14 100644
--- a/ext/tk/sample/tkextlib/bwidget/select.rb
+++ b/ext/tk/sample/tkextlib/bwidget/select.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# select demo --- called from demo.rb
#
diff --git a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb
index 1496cbce2f..da2c9678c0 100644
--- a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb
+++ b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# templdlg demo --- called from demo.rb
#
diff --git a/ext/tk/sample/tkextlib/bwidget/tree.rb b/ext/tk/sample/tkextlib/bwidget/tree.rb
index fbccd0d250..9ef6569d16 100644
--- a/ext/tk/sample/tkextlib/bwidget/tree.rb
+++ b/ext/tk/sample/tkextlib/bwidget/tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# templdlg demo --- called from demo.rb
#
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb
index c64c3f0247..2b7cd45205 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb
index 4093997029..bb09b4dfd3 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb
index 1680aae695..c7c043000a 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb
index 1bedf2c543..ea8d63e6eb 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb
index bd0a21fd7f..bae0eba73a 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb
index 1ce2c9085e..36847538d6 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb
index 873f702cb5..5727879217 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb b/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb
index 30c72a1351..12d498245d 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb
index f9ceffb201..3449cd4b3d 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb
index 240768a259..00ee99786c 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb
index 151a06f8da..682c853e47 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb
index a063ddc2ce..8563a0894d 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#########################################################
#
# use Tk::UTF8_String() for a utf8 charecter
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb
index fb7538b278..d8ccdf8555 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#########################################################
#
# set $KCODE to 'utf' for a utf8 charecter
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb
index dc8462096e..327f90893c 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#########################################################
#
# set Tk.encoding = 'utf-8' for a utf8 charecter
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb
index fbacebc563..4944c72ea5 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb
index 2eb0c7aca0..63e4be2fee 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb
index 24a32da49a..c1a9b3defd 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb b/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
index 27fe625a5d..7b87a029ed 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb
index c87ee27a6c..3a5b513bde 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb
index 1585bd4639..ff22b2f643 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb
index a32a08ffbf..110efb9b96 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb
index bb65a66b4d..085070e652 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb
index dcda4030f3..f9c92bf6dc 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb
index 52bf957208..4e2e21e727 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb
index 8b45d2bcb0..577550af55 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb
index 3e5e511a1e..c9677f2270 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb
index 389a622966..e01275217d 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb
index c3fd8bc35d..477c916e07 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb
index 8f51ab754f..87b2d38907 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb
index 9bb15ebec2..5278883568 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb
index ca73ed54d2..52799f206c 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
index 4305db4f5c..4d460e8802 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
index a3b00b2a87..576a9c18d0 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb
index 2dc7eaf411..2b921ffab9 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb
index ba36319f85..88fc401483 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb
index 4abd5f4a45..96987d529c 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb
index 7f011f4833..d92a26ead9 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb
index 5d3bdc7efd..e76dda88c6 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb
index 470ed8cee5..9cd6a002b0 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb
index 85e6a47b1a..92c94b96bb 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb
index 91d22131c0..e5bd90a1cb 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb
index f825483b2c..2b675f802c 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb
index 3872fb7d40..bf2c60191f 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb
index 4965039371..41498e67f7 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb
index 8c0b68a22e..74684974b1 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb
index 9fbf8b7d2a..d53391f2f3 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb
index 4cbf4416c0..6d01280141 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb
index 38d9b49c86..17197a66b7 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb
index 1887f46e05..e2dde01b18 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb
index 2e64bdfb08..6a20b0eb87 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb
index 597e7d014c..2c13884b94 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb
index 0c94cd1738..382b34d3ce 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb
index 57f9e46214..2689759bde 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb
index 99d5ac6071..90be46b40b 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb b/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb
index 5841f0aadf..465939947b 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb b/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb
index e2824b17aa..bb5945048d 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb
index 3cbaec210b..608efd0af1 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb
index b06f173eee..2af53ba63b 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'
diff --git a/ext/tk/sample/tkextlib/tcllib/datefield.rb b/ext/tk/sample/tkextlib/tcllib/datefield.rb
index cf77ed5e64..3550af7d23 100644
--- a/ext/tk/sample/tkextlib/tcllib/datefield.rb
+++ b/ext/tk/sample/tkextlib/tcllib/datefield.rb
@@ -1,5 +1,4 @@
#!/usr/bin/ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/tcllib/datefield'
diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb
index 89166c1c30..7f35a3833c 100644
--- a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb
+++ b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb
@@ -1,5 +1,4 @@
#!/usr/bin/ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/tcllib/plotchart'
diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb
index 58c5b1928b..cb657a40d8 100644
--- a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb
+++ b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/tcllib/plotchart'
diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb
index 816e38b6a6..66b8fe706a 100644
--- a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb
+++ b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb
@@ -1,5 +1,4 @@
#!/usr/bin/ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/tcllib/plotchart'
diff --git a/ext/tk/sample/tkextlib/tcllib/xyplot.rb b/ext/tk/sample/tkextlib/tcllib/xyplot.rb
index 3d71c3bf9f..2aa101efcb 100644
--- a/ext/tk/sample/tkextlib/tcllib/xyplot.rb
+++ b/ext/tk/sample/tkextlib/tcllib/xyplot.rb
@@ -1,5 +1,4 @@
#!/usr/bin/ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/tcllib/plotchart'
diff --git a/ext/tk/sample/tkextlib/tile/demo.rb b/ext/tk/sample/tkextlib/tile/demo.rb
index 8348ecdb58..260ca00022 100644
--- a/ext/tk/sample/tkextlib/tile/demo.rb
+++ b/ext/tk/sample/tkextlib/tile/demo.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# Demo for 'tile' package.
#
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/ext/tk/sample/tkextlib/tile/themes/kroc.rb
index 3b8569275b..72a7c6901d 100644
--- a/ext/tk/sample/tkextlib/tile/themes/kroc.rb
+++ b/ext/tk/sample/tkextlib/tile/themes/kroc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# kroc.rb
#
diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb
index eb3a786c21..920eb15f5a 100644
--- a/ext/tk/sample/tkextlib/tkHTML/hv.rb
+++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# This script implements the "hv" application. Type "hv FILE" to
# view FILE as HTML.
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/index.html b/ext/tk/sample/tkextlib/tkHTML/page4/index.html
index 588ae5ccd7..c7bfde35a5 100644
--- a/ext/tk/sample/tkextlib/tkHTML/page4/index.html
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/index.html
@@ -117,7 +117,7 @@ squelching curiosity."
<B><FONT SIZE="+2">nmpg 1.1.3</FONT></B><BR>
<SMALL><B><A HREF="mailto:narkos@linuxmail.org">Joel Lindau</A> - January 29th 2000, 18:18 EST</B></SMALL>
<DIV ALIGN="justify"><P>nmpg is a small command-driven frontend and network-jukebox for mpg123.</DIV>
-<P><B>Changes:</B> Bugfixes, better memory management, a new .nmpgrc parser, and new options.
+<P><B>Changes:</B> Bugfixes, better memory managment, a new .nmpgrc parser, and new options.
<P><B>Urgency:</B> low
<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949187896.html">comments (0)</A> ]</B>
</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
diff --git a/ext/tk/sample/tkextlib/tkHTML/ss.rb b/ext/tk/sample/tkextlib/tkHTML/ss.rb
index e6ef63bc31..45d4d87d69 100644
--- a/ext/tk/sample/tkextlib/tkHTML/ss.rb
+++ b/ext/tk/sample/tkextlib/tkHTML/ss.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# This script implements the "ss" application. "ss" implements
# a presentation slide-show based on HTML slides.
diff --git a/ext/tk/sample/tkextlib/tkimg/demo.rb b/ext/tk/sample/tkextlib/tkimg/demo.rb
index 0f0d585fc7..8016c263a6 100644
--- a/ext/tk/sample/tkextlib/tkimg/demo.rb
+++ b/ext/tk/sample/tkextlib/tkimg/demo.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# Tk::Img demo
#
diff --git a/ext/tk/sample/tkextlib/tktable/basic.rb b/ext/tk/sample/tkextlib/tktable/basic.rb
index eed5351a8a..dddbb776dc 100644
--- a/ext/tk/sample/tkextlib/tktable/basic.rb
+++ b/ext/tk/sample/tkextlib/tktable/basic.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## basic.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/buttons.rb b/ext/tk/sample/tkextlib/tktable/buttons.rb
index 2c3fee7982..e35c137a28 100644
--- a/ext/tk/sample/tkextlib/tktable/buttons.rb
+++ b/ext/tk/sample/tkextlib/tktable/buttons.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## buttons.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/command.rb b/ext/tk/sample/tkextlib/tktable/command.rb
index 05ee47aa17..e697ccf3bf 100644
--- a/ext/tk/sample/tkextlib/tktable/command.rb
+++ b/ext/tk/sample/tkextlib/tktable/command.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## command.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/debug.rb b/ext/tk/sample/tkextlib/tktable/debug.rb
index 831b3a1846..016d5b353e 100644
--- a/ext/tk/sample/tkextlib/tktable/debug.rb
+++ b/ext/tk/sample/tkextlib/tktable/debug.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## debug.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/dynarows.rb b/ext/tk/sample/tkextlib/tktable/dynarows.rb
index ae3349daba..cc72a021cf 100644
--- a/ext/tk/sample/tkextlib/tktable/dynarows.rb
+++ b/ext/tk/sample/tkextlib/tktable/dynarows.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## dynarows.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/maxsize.rb b/ext/tk/sample/tkextlib/tktable/maxsize.rb
index 51aa619126..74e136c49c 100644
--- a/ext/tk/sample/tkextlib/tktable/maxsize.rb
+++ b/ext/tk/sample/tkextlib/tktable/maxsize.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## maxsize.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb
index a801045d41..2953b2e597 100644
--- a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb
+++ b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## spreadsheet.rb
##
diff --git a/ext/tk/sample/tkextlib/tktable/valid.rb b/ext/tk/sample/tkextlib/tktable/valid.rb
index f11e511884..98e9c3855a 100644
--- a/ext/tk/sample/tkextlib/tktable/valid.rb
+++ b/ext/tk/sample/tkextlib/tktable/valid.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
##
## valid.rb
##
diff --git a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb
index a42e7ac541..0d8b37b81e 100644
--- a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb
+++ b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: Bitmaps
#
diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb
index cd277cf2a9..564a005bdc 100644
--- a/ext/tk/sample/tkextlib/treectrl/demo.rb
+++ b/ext/tk/sample/tkextlib/treectrl/demo.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/treectrl'
diff --git a/ext/tk/sample/tkextlib/treectrl/explorer.rb b/ext/tk/sample/tkextlib/treectrl/explorer.rb
index 3b54bf269c..1b8c2a8287 100644
--- a/ext/tk/sample/tkextlib/treectrl/explorer.rb
+++ b/ext/tk/sample/tkextlib/treectrl/explorer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
def demoExplorerAux(t, dir_proc, file_proc)
base_dir = File.dirname(File.dirname(@ScriptDir))
diff --git a/ext/tk/sample/tkextlib/treectrl/help.rb b/ext/tk/sample/tkextlib/treectrl/help.rb
index e3758d00a6..31ec9eb3f8 100644
--- a/ext/tk/sample/tkextlib/treectrl/help.rb
+++ b/ext/tk/sample/tkextlib/treectrl/help.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: Help contents
#
diff --git a/ext/tk/sample/tkextlib/treectrl/imovie.rb b/ext/tk/sample/tkextlib/treectrl/imovie.rb
index 4419496ac4..72134ebda6 100644
--- a/ext/tk/sample/tkextlib/treectrl/imovie.rb
+++ b/ext/tk/sample/tkextlib/treectrl/imovie.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: iMovie
#
diff --git a/ext/tk/sample/tkextlib/treectrl/layout.rb b/ext/tk/sample/tkextlib/treectrl/layout.rb
index 50c332641b..488abe2aa9 100644
--- a/ext/tk/sample/tkextlib/treectrl/layout.rb
+++ b/ext/tk/sample/tkextlib/treectrl/layout.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: Layout
#
diff --git a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb
index 81ffe743b6..1b51bb9b21 100644
--- a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb
+++ b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: MailWasher
#
diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb
index 8707251ee9..d966807866 100644
--- a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb
+++ b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: Outlook Express folder list
#
diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb
index 841f330919..3495522e5c 100644
--- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb
+++ b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Demo: Outlook Express newsgroup messages
#
diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb
index 33bbcc2631..43aca63283 100644
--- a/ext/tk/sample/tkextlib/treectrl/random.rb
+++ b/ext/tk/sample/tkextlib/treectrl/random.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
def random_N
@RandomN[0] || 500
diff --git a/ext/tk/sample/tkextlib/treectrl/www-options.rb b/ext/tk/sample/tkextlib/treectrl/www-options.rb
index 81f5349abc..6a3e9c2201 100644
--- a/ext/tk/sample/tkextlib/treectrl/www-options.rb
+++ b/ext/tk/sample/tkextlib/treectrl/www-options.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
def demoInternetOptions (t)
@Option = TkVarAccess.new_hash('::Option')
diff --git a/ext/tk/sample/tkextlib/vu/canvItems.rb b/ext/tk/sample/tkextlib/vu/canvItems.rb
index aa9bd5e9f6..364f87613b 100644
--- a/ext/tk/sample/tkextlib/vu/canvItems.rb
+++ b/ext/tk/sample/tkextlib/vu/canvItems.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu/charts'
diff --git a/ext/tk/sample/tkextlib/vu/canvSticker.rb b/ext/tk/sample/tkextlib/vu/canvSticker.rb
index a240eb5be2..85713ebcf3 100644
--- a/ext/tk/sample/tkextlib/vu/canvSticker.rb
+++ b/ext/tk/sample/tkextlib/vu/canvSticker.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu/charts'
diff --git a/ext/tk/sample/tkextlib/vu/canvSticker2.rb b/ext/tk/sample/tkextlib/vu/canvSticker2.rb
index 5dec81aed9..3d9495ffb0 100644
--- a/ext/tk/sample/tkextlib/vu/canvSticker2.rb
+++ b/ext/tk/sample/tkextlib/vu/canvSticker2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu/charts'
diff --git a/ext/tk/sample/tkextlib/vu/dial_demo.rb b/ext/tk/sample/tkextlib/vu/dial_demo.rb
index 409b8d73cf..f1f2f110b1 100644
--- a/ext/tk/sample/tkextlib/vu/dial_demo.rb
+++ b/ext/tk/sample/tkextlib/vu/dial_demo.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu/dial'
diff --git a/ext/tk/sample/tkextlib/vu/oscilloscope.rb b/ext/tk/sample/tkextlib/vu/oscilloscope.rb
index 0fa779985d..1efe13ce01 100644
--- a/ext/tk/sample/tkextlib/vu/oscilloscope.rb
+++ b/ext/tk/sample/tkextlib/vu/oscilloscope.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu/charts'
diff --git a/ext/tk/sample/tkextlib/vu/pie.rb b/ext/tk/sample/tkextlib/vu/pie.rb
index a61a19188e..c8f9276e4e 100644
--- a/ext/tk/sample/tkextlib/vu/pie.rb
+++ b/ext/tk/sample/tkextlib/vu/pie.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu/pie'
diff --git a/ext/tk/sample/tkextlib/vu/vu_demo.rb b/ext/tk/sample/tkextlib/vu/vu_demo.rb
index 7b9741f933..358d32495f 100644
--- a/ext/tk/sample/tkextlib/vu/vu_demo.rb
+++ b/ext/tk/sample/tkextlib/vu/vu_demo.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
require 'tkextlib/vu'
diff --git a/ext/tk/sample/tkfrom.rb b/ext/tk/sample/tkfrom.rb
index 4c249884af..f51f7f5d85 100644
--- a/ext/tk/sample/tkfrom.rb
+++ b/ext/tk/sample/tkfrom.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require "parsedate"
require "base64"
diff --git a/ext/tk/sample/tkhello.rb b/ext/tk/sample/tkhello.rb
index 02de5ff381..597c1f6242 100644
--- a/ext/tk/sample/tkhello.rb
+++ b/ext/tk/sample/tkhello.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "tk"
TkButton.new(nil,
diff --git a/ext/tk/sample/tkline.rb b/ext/tk/sample/tkline.rb
index c23cb95cbd..3124c2fe0c 100644
--- a/ext/tk/sample/tkline.rb
+++ b/ext/tk/sample/tkline.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "tkclass"
diff --git a/ext/tk/sample/tkmenubutton.rb b/ext/tk/sample/tkmenubutton.rb
index 2107e42a75..8ae1359425 100644
--- a/ext/tk/sample/tkmenubutton.rb
+++ b/ext/tk/sample/tkmenubutton.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# menubutton sample : based on sample menubuttons on the Tcl/Tk demo script
#
diff --git a/ext/tk/sample/tkmsgcat-load_rb.rb b/ext/tk/sample/tkmsgcat-load_rb.rb
index bacf85de50..98a91fadf4 100644
--- a/ext/tk/sample/tkmsgcat-load_rb.rb
+++ b/ext/tk/sample/tkmsgcat-load_rb.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
diff --git a/ext/tk/sample/tkmsgcat-load_rb2.rb b/ext/tk/sample/tkmsgcat-load_rb2.rb
index 53e41bc481..05512a3131 100644
--- a/ext/tk/sample/tkmsgcat-load_rb2.rb
+++ b/ext/tk/sample/tkmsgcat-load_rb2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
diff --git a/ext/tk/sample/tkmsgcat-load_tk.rb b/ext/tk/sample/tkmsgcat-load_tk.rb
index 783d03ccf2..703f471e19 100644
--- a/ext/tk/sample/tkmsgcat-load_tk.rb
+++ b/ext/tk/sample/tkmsgcat-load_tk.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'tk'
diff --git a/ext/tk/sample/tkmulticolumnlist.rb b/ext/tk/sample/tkmulticolumnlist.rb
index fb0c29d7ff..a1b3a1a2fa 100644
--- a/ext/tk/sample/tkmulticolumnlist.rb
+++ b/ext/tk/sample/tkmulticolumnlist.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkmulticolumnlist.rb : multiple column list widget on scrollable frame
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/tkmultilistbox.rb b/ext/tk/sample/tkmultilistbox.rb
index c8c8118ffe..7791649c4b 100644
--- a/ext/tk/sample/tkmultilistbox.rb
+++ b/ext/tk/sample/tkmultilistbox.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkmultilistbox.rb : multiple listbox widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/tkmultilistframe.rb b/ext/tk/sample/tkmultilistframe.rb
index 229a40023a..7c0aac9a9e 100644
--- a/ext/tk/sample/tkmultilistframe.rb
+++ b/ext/tk/sample/tkmultilistframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tkmultilistframe.rb : multiple listbox widget on scrollable frame
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/sample/tkoptdb-safeTk.rb b/ext/tk/sample/tkoptdb-safeTk.rb
index f14015d15f..7502e30667 100755..100644
--- a/ext/tk/sample/tkoptdb-safeTk.rb
+++ b/ext/tk/sample/tkoptdb-safeTk.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
require 'multi-tk'
@@ -32,7 +31,7 @@ file = File.expand_path('tkoptdb.rb', File.dirname(__FILE__))
ip = MultiTkIp.new_safeTk{
# When a block is given to 'new_safeTk' method,
- # the block is evaluated on $SAFE==1.
+ # the block is evaluated on $SAFE==4.
ent.each{|pat, val| Tk.tk_call('option', 'add', pat, val)}
}
diff --git a/ext/tk/sample/tkoptdb.rb b/ext/tk/sample/tkoptdb.rb
index 3fb2464260..0171e465b3 100644
--- a/ext/tk/sample/tkoptdb.rb
+++ b/ext/tk/sample/tkoptdb.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# sample script of TkOptionDB
#
diff --git a/ext/tk/sample/tkrttimer.rb b/ext/tk/sample/tkrttimer.rb
index cde15620b6..1f9cbd9eb5 100644
--- a/ext/tk/sample/tkrttimer.rb
+++ b/ext/tk/sample/tkrttimer.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
# This script is a re-implementation of tktimer.rb with TkTimer(TkAfter) class.
require "tk"
diff --git a/ext/tk/sample/tksleep_sample.rb b/ext/tk/sample/tksleep_sample.rb
index 14ce3a475f..23f6eca54e 100644
--- a/ext/tk/sample/tksleep_sample.rb
+++ b/ext/tk/sample/tksleep_sample.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'tk'
v = TkVariable.new(0)
diff --git a/ext/tk/sample/tktextframe.rb b/ext/tk/sample/tktextframe.rb
index f6d9bbd239..d6584beeb8 100644
--- a/ext/tk/sample/tktextframe.rb
+++ b/ext/tk/sample/tktextframe.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tktextframe.rb : a sample of TkComposite
#
diff --git a/ext/tk/sample/tktextio.rb b/ext/tk/sample/tktextio.rb
index 4a1346b38b..679a2b7142 100644
--- a/ext/tk/sample/tktextio.rb
+++ b/ext/tk/sample/tktextio.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# TkTextIO class :: handling I/O stream on a TkText widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
@@ -936,7 +935,7 @@ if __FILE__ == $0
$stdout = tio
$stderr = tio
- STDOUT.print("\n========= TkTextIO#gets for initial text ========\n\n")
+ STDOUT.print("\n========= TkTextIO#gets for inital text ========\n\n")
while(s = gets)
STDOUT.print(s)
diff --git a/ext/tk/sample/tktimer.rb b/ext/tk/sample/tktimer.rb
index 4b6abae7e6..b1adb5b506 100644
--- a/ext/tk/sample/tktimer.rb
+++ b/ext/tk/sample/tktimer.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
# This script generates a counter with start and stop buttons.
require "tk"
diff --git a/ext/tk/sample/tktimer2.rb b/ext/tk/sample/tktimer2.rb
index 3f8d722153..125115e863 100644
--- a/ext/tk/sample/tktimer2.rb
+++ b/ext/tk/sample/tktimer2.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
# This script is a re-implementation of tktimer.rb with TkTimer(TkAfter) class.
require "tk"
diff --git a/ext/tk/sample/tktimer3.rb b/ext/tk/sample/tktimer3.rb
index bce3cd6b6c..08e8a3cad4 100644
--- a/ext/tk/sample/tktimer3.rb
+++ b/ext/tk/sample/tktimer3.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
# This script is a re-implementation of tktimer.rb with TkTimer(TkAfter) class.
require "tk"
diff --git a/ext/tk/sample/tktree.rb b/ext/tk/sample/tktree.rb
index 47622973e7..4eb7f60627 100644
--- a/ext/tk/sample/tktree.rb
+++ b/ext/tk/sample/tktree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##########################################################################
# TkTree widget class
#
diff --git a/ext/tk/sample/ttk_wrapper.rb b/ext/tk/sample/ttk_wrapper.rb
index eee9878704..e4eb9c7964 100644
--- a/ext/tk/sample/ttk_wrapper.rb
+++ b/ext/tk/sample/ttk_wrapper.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-# frozen_string_literal: false
#
# ttk_wrapper.rb -- use Ttk widgets as default on old Ruby/Tk scripts
#
diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c
index 89da88aea4..7398a79ae3 100644
--- a/ext/tk/stubs.c
+++ b/ext/tk/stubs.c
@@ -24,7 +24,7 @@
static int call_macinit = 0;
static void
-_macinit(void)
+_macinit()
{
if (!call_macinit) {
tcl_macQdPtr = &qd; /* setup QuickDraw globals */
@@ -83,8 +83,8 @@ _nativethread_consistency_check(ip)
# define DL_SYM GetProcAddress
# define TCL_INDEX 4
# define TK_INDEX 3
-# define TCL_NAME "tcl89"
-# define TK_NAME "tk89"
+# define TCL_NAME "tcl89%s"
+# define TK_NAME "tk89%s"
# undef DLEXT
# define DLEXT ".dll"
#elif defined HAVE_DLOPEN
@@ -94,8 +94,8 @@ _nativethread_consistency_check(ip)
# define DL_SYM dlsym
# define TCL_INDEX 8
# define TK_INDEX 7
-# define TCL_NAME "libtcl8.9"
-# define TK_NAME "libtk8.9"
+# define TCL_NAME "libtcl8.9%s"
+# define TK_NAME "libtk8.9%s"
# ifdef __APPLE__
# undef DLEXT
# define DLEXT ".dylib"
@@ -116,6 +116,7 @@ ruby_open_tcl_dll(appname)
void (*p_Tcl_FindExecutable)(const char *);
int n;
char *ruby_tcl_dll = 0;
+ char tcl_name[20];
if (tcl_dll) return TCLTK_STUBS_OK;
@@ -126,7 +127,7 @@ ruby_open_tcl_dll(appname)
if (ruby_tcl_dll) {
tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
} else {
- char tcl_name[] = TCL_NAME DLEXT;
+ snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
/* examine from 8.9 to 8.1 */
for (n = '9'; n > '0'; n--) {
tcl_name[TCL_INDEX] = n;
@@ -157,10 +158,11 @@ ruby_open_tcl_dll(appname)
}
int
-ruby_open_tk_dll(void)
+ruby_open_tk_dll()
{
int n;
char *ruby_tk_dll = 0;
+ char tk_name[20];
if (!tcl_dll) {
/* int ret = ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
@@ -174,7 +176,7 @@ ruby_open_tk_dll(void)
if (ruby_tk_dll) {
tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
} else {
- char tk_name[] = TK_NAME DLEXT;
+ snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
/* examine from 8.9 to 8.1 */
for (n = '9'; n > '0'; n--) {
tk_name[TK_INDEX] = n;
@@ -202,13 +204,13 @@ ruby_open_tcltk_dll(appname)
}
int
-tcl_stubs_init_p(void)
+tcl_stubs_init_p()
{
return(tclStubsPtr != (TclStubs*)NULL);
}
int
-tk_stubs_init_p(void)
+tk_stubs_init_p()
{
return(tkStubsPtr != (TkStubs*)NULL);
}
@@ -285,7 +287,7 @@ ruby_tcl_create_ip_and_stubs_init(st)
}
int
-ruby_tcl_stubs_init(void)
+ruby_tcl_stubs_init()
{
int st;
Tcl_Interp *tcl_ip;
@@ -397,7 +399,7 @@ ruby_tk_stubs_safeinit(tcl_ip)
}
int
-ruby_tcltk_stubs(void)
+ruby_tcltk_stubs()
{
int st;
Tcl_Interp *tcl_ip;
@@ -467,7 +469,7 @@ ruby_open_tcl_dll(appname)
}
int
-ruby_open_tk_dll(void)
+ruby_open_tk_dll()
{
if (!open_tcl_dll) {
/* ruby_open_tcl_dll(RSTRING_PTR(rb_argv0)); */
@@ -489,13 +491,13 @@ ruby_open_tcltk_dll(appname)
}
int
-tcl_stubs_init_p(void)
+tcl_stubs_init_p()
{
return 1;
}
int
-tk_stubs_init_p(void)
+tk_stubs_init_p()
{
return call_tk_stubs_init;
}
@@ -528,7 +530,7 @@ ruby_tcl_create_ip_and_stubs_init(st)
}
int
-ruby_tcl_stubs_init(void)
+ruby_tcl_stubs_init()
{
return TCLTK_STUBS_OK;
}
@@ -582,7 +584,7 @@ ruby_tk_stubs_safeinit(tcl_ip)
}
int
-ruby_tcltk_stubs(void)
+ruby_tcltk_stubs()
{
/* Tcl_FindExecutable(RSTRING_PTR(rb_argv0)); */
Tcl_FindExecutable(rb_argv0 ? RSTRING_PTR(rb_argv0) : 0);
diff --git a/ext/tk/stubs.h b/ext/tk/stubs.h
index b4a85dbd1f..7c913fb393 100644
--- a/ext/tk/stubs.h
+++ b/ext/tk/stubs.h
@@ -1,15 +1,15 @@
#include <tcl.h>
extern int ruby_open_tcl_dll(char *);
-extern int ruby_open_tk_dll(void);
+extern int ruby_open_tk_dll();
extern int ruby_open_tcltk_dll(char *);
-extern int tcl_stubs_init_p(void);
-extern int tk_stubs_init_p(void);
+extern int tcl_stubs_init_p();
+extern int tk_stubs_init_p();
extern Tcl_Interp *ruby_tcl_create_ip_and_stubs_init(int*);
-extern int ruby_tcl_stubs_init(void);
+extern int ruby_tcl_stubs_init();
extern int ruby_tk_stubs_init(Tcl_Interp*);
extern int ruby_tk_stubs_safeinit(Tcl_Interp*);
-extern int ruby_tcltk_stubs(void);
+extern int ruby_tcltk_stubs();
/* no error */
#define TCLTK_STUBS_OK (0)
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 47dc52a337..d269f9c43e 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -19,12 +19,9 @@
#define RUBY_RELEASE_DATE "unknown release-date"
#endif
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
-
#ifdef HAVE_RB_THREAD_CHECK_TRAP_PENDING
static int rb_thread_critical; /* dummy */
-int rb_thread_check_trap_pending(void);
+int rb_thread_check_trap_pending();
#else
/* use rb_thread_critical on Ruby 1.8.x */
#include "rubysig.h"
@@ -42,12 +39,6 @@ int rb_thread_check_trap_pending(void);
#define RARRAY_PTR(s) (RARRAY(s)->ptr)
#define RARRAY_LEN(s) (RARRAY(s)->len)
#endif
-#if !defined(RARRAY_CONST_PTR)
-#define RARRAY_CONST_PTR(s) (const VALUE *)RARRAY_PTR(s)
-#endif
-#if !defined(RARRAY_AREF)
-#define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i]
-#endif
#ifdef OBJ_UNTRUST
#define RbTk_OBJ_UNTRUST(x) do {OBJ_TAINT(x); OBJ_UNTRUST(x);} while (0)
@@ -123,7 +114,7 @@ static struct {
} tcltk_version = {0, 0, 0, 0};
static void
-set_tcltk_version(void)
+set_tcltk_version()
{
if (tcltk_version.major) return;
@@ -191,7 +182,6 @@ static const char tcltklib_release_date[] = TCLTKLIB_RELEASE_DATE;
static const char finalize_hook_name[] = "INTERP_FINALIZE_HOOK";
static void ip_finalize _((Tcl_Interp*));
-static void ip_free _((void *p));
static int at_exit = 0;
@@ -400,7 +390,7 @@ Tcl_SetVar2Ex(interp, name1, name2, newValObj, flags)
/* from tkAppInit.c */
#if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4)
-# if !defined __MINGW32__
+# if !defined __MINGW32__ && !defined __BORLANDC__
/*
* The following variable is a special hack that is needed in order for
* Sun shared libraries to be used for Tcl.
@@ -781,18 +771,13 @@ struct tcltkip {
int return_value; /* return value */
};
-static const rb_data_type_t tcltkip_type = {
- "tcltkip",
- {0, ip_free, 0,},
-};
-
static struct tcltkip *
get_ip(self)
VALUE self;
{
struct tcltkip *ptr;
- TypedData_Get_Struct(self, struct tcltkip, &tcltkip_type, ptr);
+ Data_Get_Struct(self, struct tcltkip, ptr);
if (ptr == 0) {
/* rb_raise(rb_eTypeError, "uninitialized TclTkIp"); */
return((struct tcltkip *)NULL);
@@ -863,14 +848,15 @@ create_ip_exc(interp, exc, fmt, va_alist)
#endif
{
va_list args;
- VALUE msg;
+ char buf[BUFSIZ];
VALUE einfo;
struct tcltkip *ptr = get_ip(interp);
va_init_list(args,fmt);
- msg = rb_vsprintf(fmt, args);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ buf[BUFSIZ - 1] = '\0';
va_end(args);
- einfo = rb_exc_new_str(exc, msg);
+ einfo = rb_exc_new2(exc, buf);
rb_ivar_set(einfo, ID_at_interp, interp);
if (ptr) {
Tcl_ResetResult(ptr->ip);
@@ -1072,7 +1058,7 @@ set_rubytk_kitpath(const char *kitpath)
#endif
static void
-check_tclkit_std_channels(void)
+check_tclkit_std_channels()
{
Tcl_Channel chan;
@@ -1156,7 +1142,7 @@ rubytk_kitpath_init(Tcl_Interp *interp)
/*--------------------------------------------------------*/
static void
-init_static_tcltk_packages(void)
+init_static_tcltk_packages()
{
/*
* Ensure that std channels exist (creating them if necessary)
@@ -1243,7 +1229,7 @@ void rbtk_win32_SetHINSTANCE(const char *module_name)
/*--------------------------------------------------------*/
static void
-setup_rubytkkit(void)
+setup_rubytkkit()
{
init_static_tcltk_packages();
@@ -1269,17 +1255,10 @@ setup_rubytkkit(void)
#ifdef __WIN32__
/* rbtk_win32_SetHINSTANCE("tcltklib.so"); */
{
-# ifdef HAVE_RUBY_ENC_FIND_BASENAME
- const char *base = ruby_enc_find_basename(rb_sourcefile(), NULL, NULL,
- rb_filesystem_encoding());
- rbtk_win32_SetHINSTANCE(base);
-# else
- VALUE basename;
+ volatile VALUE basename;
basename = rb_funcall(rb_cFile, rb_intern("basename"), 1,
rb_str_new2(rb_sourcefile()));
rbtk_win32_SetHINSTANCE(RSTRING_PTR(basename));
- RB_GC_GUARD(basename);
-# endif
}
#endif
set_rubytk_kitpath(rb_sourcefile());
@@ -1303,7 +1282,7 @@ setup_rubytkkit(void)
/* stub status */
static void
-tcl_stubs_check(void)
+tcl_stubs_check()
{
if (!tcl_stubs_init_p()) {
int st = ruby_tcl_stubs_init();
@@ -1397,14 +1376,14 @@ tcltkip_init_tk(interp)
}
-/* treat exception on Tcl side */
+/* treat excetiopn on Tcl side */
static VALUE rbtk_pending_exception;
static int rbtk_eventloop_depth = 0;
static int rbtk_internal_eventloop_handler = 0;
static int
-pending_exception_check0(void)
+pending_exception_check0()
{
volatile VALUE exc = rbtk_pending_exception;
@@ -1667,7 +1646,7 @@ _timer_for_tcl(clientData)
#ifdef RUBY_USE_NATIVE_THREAD
#if USE_TOGGLE_WINDOW_MODE_FOR_IDLE
static int
-toggle_eventloop_window_mode_for_idle(void)
+toggle_eventloop_window_mode_for_idle()
{
if (window_event_mode & TCL_IDLE_EVENTS) {
/* idle -> event */
@@ -1895,19 +1874,19 @@ set_max_block_time(self, time)
case T_BIGNUM:
/* time is micro-second value */
divmod = rb_funcall(time, rb_intern("divmod"), 1, LONG2NUM(1000000));
- tcl_time.sec = NUM2LONG(RARRAY_AREF(divmod, 0));
- tcl_time.usec = NUM2LONG(RARRAY_AREF(divmod, 1));
+ tcl_time.sec = NUM2LONG(RARRAY_PTR(divmod)[0]);
+ tcl_time.usec = NUM2LONG(RARRAY_PTR(divmod)[1]);
break;
case T_FLOAT:
/* time is second value */
divmod = rb_funcall(time, rb_intern("divmod"), 1, INT2FIX(1));
- tcl_time.sec = NUM2LONG(RARRAY_AREF(divmod, 0));
- tcl_time.usec = (long)(NUM2DBL(RARRAY_AREF(divmod, 1)) * 1000000);
+ tcl_time.sec = NUM2LONG(RARRAY_PTR(divmod)[0]);
+ tcl_time.usec = (long)(NUM2DBL(RARRAY_PTR(divmod)[1]) * 1000000);
default:
{
- VALUE tmp = rb_funcallv(time, ID_inspect, 0, 0);
+ VALUE tmp = rb_funcall(time, ID_inspect, 0, 0);
rb_raise(rb_eArgError, "invalid value for time: '%s'",
StringValuePtr(tmp));
}
@@ -2101,9 +2080,9 @@ eventloop_sleep(dummy)
#endif
#endif
- DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %"PRIxVALUE, rb_thread_current());
+ DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %lx", rb_thread_current());
rb_thread_wait_for(t);
- DUMP2("eventloop_sleep: finish at thread : %"PRIxVALUE, rb_thread_current());
+ DUMP2("eventloop_sleep: finish at thread : %lx", rb_thread_current());
#ifdef HAVE_NATIVETHREAD
#ifndef RUBY_USE_NATIVE_THREAD
@@ -2121,7 +2100,7 @@ eventloop_sleep(dummy)
#if USE_EVLOOP_THREAD_ALONE_CHECK_FLAG
static int
-get_thread_alone_check_flag(void)
+get_thread_alone_check_flag()
{
#ifdef RUBY_USE_NATIVE_THREAD
return 0;
@@ -2190,7 +2169,7 @@ trap_check(int *check_var)
}
static int
-check_eventloop_interp(void)
+check_eventloop_interp()
{
DUMP1("check eventloop_interp");
if (eventloop_interp != (Tcl_Interp*)NULL
@@ -2520,8 +2499,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
}
} else {
- DUMP2("sleep eventloop %"PRIxVALUE, current);
- DUMP2("eventloop thread is %"PRIxVALUE, eventloop_thread);
+ DUMP2("sleep eventloop %lx", current);
+ DUMP2("eventloop thread is %lx", eventloop_thread);
/* rb_thread_stop(); */
rb_thread_sleep_forever();
}
@@ -2642,10 +2621,10 @@ lib_eventloop_ensure(args)
Tcl_DeleteEventSource(rbtk_EventSetupProc, rbtk_EventCheckProc, (ClientData)args);
- DUMP2("eventloop_ensure: current-thread : %"PRIxVALUE, current_evloop);
- DUMP2("eventloop_ensure: eventloop-thread : %"PRIxVALUE, eventloop_thread);
+ DUMP2("eventloop_ensure: current-thread : %lx", current_evloop);
+ DUMP2("eventloop_ensure: eventloop-thread : %lx", eventloop_thread);
if (eventloop_thread != current_evloop) {
- DUMP2("finish eventloop %"PRIxVALUE" (NOT current eventloop)", current_evloop);
+ DUMP2("finish eventloop %lx (NOT current eventloop)", current_evloop);
rb_thread_critical = ptr->thr_crit_bup;
@@ -2656,12 +2635,12 @@ lib_eventloop_ensure(args)
}
while((eventloop_thread = rb_ary_pop(eventloop_stack))) {
- DUMP2("eventloop-ensure: new eventloop-thread -> %"PRIxVALUE,
+ DUMP2("eventloop-ensure: new eventloop-thread -> %lx",
eventloop_thread);
if (eventloop_thread == current_evloop) {
rbtk_eventloop_depth--;
- DUMP2("eventloop %"PRIxVALUE" : back from recursive call", current_evloop);
+ DUMP2("eventloop %lx : back from recursive call", current_evloop);
break;
}
@@ -2673,7 +2652,7 @@ lib_eventloop_ensure(args)
}
if (RTEST(rb_thread_alive_p(eventloop_thread))) {
- DUMP2("eventloop-enshure: wake up parent %"PRIxVALUE, eventloop_thread);
+ DUMP2("eventloop-enshure: wake up parent %lx", eventloop_thread);
rb_thread_wakeup(eventloop_thread);
break;
@@ -2691,7 +2670,7 @@ lib_eventloop_ensure(args)
xfree(ptr);
/* ckfree((char*)ptr);*/
- DUMP2("finish current eventloop %"PRIxVALUE, current_evloop);
+ DUMP2("finish current eventloop %lx", current_evloop);
return Qnil;
}
@@ -2714,14 +2693,14 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp)
#endif
if (parent_evloop == eventloop_thread) {
- DUMP2("eventloop: recursive call on %"PRIxVALUE, parent_evloop);
+ DUMP2("eventloop: recursive call on %lx", parent_evloop);
rbtk_eventloop_depth++;
}
if (!NIL_P(parent_evloop) && parent_evloop != eventloop_thread) {
- DUMP2("wait for stop of parent_evloop %"PRIxVALUE, parent_evloop);
+ DUMP2("wait for stop of parent_evloop %lx", parent_evloop);
while(!RTEST(rb_funcall(parent_evloop, ID_stop_p, 0))) {
- DUMP2("parent_evloop %"PRIxVALUE" doesn't stop", parent_evloop);
+ DUMP2("parent_evloop %lx doesn't stop", parent_evloop);
rb_thread_run(parent_evloop);
}
DUMP1("succeed to stop parent");
@@ -2729,7 +2708,7 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp)
rb_ary_push(eventloop_stack, parent_evloop);
- DUMP3("tcltklib: eventloop-thread : %"PRIxVALUE" -> %"PRIxVALUE"\n",
+ DUMP3("tcltklib: eventloop-thread : %lx -> %lx\n",
parent_evloop, eventloop_thread);
args->check_root = check_root;
@@ -2835,11 +2814,11 @@ lib_watchdog_core(check_rootwidget)
if (NIL_P(eventloop_thread)
|| (loop_counter == prev_val && chance >= EVLOOP_WAKEUP_CHANCE)) {
/* start new eventloop thread */
- DUMP2("eventloop thread %"PRIxVALUE" is sleeping or dead",
+ DUMP2("eventloop thread %lx is sleeping or dead",
eventloop_thread);
evloop = rb_thread_create(watchdog_evloop_launcher,
(void*)&check_rootwidget);
- DUMP2("create new eventloop thread %"PRIxVALUE, evloop);
+ DUMP2("create new eventloop thread %lx", evloop);
loop_counter = -1;
chance = 0;
rb_thread_run(evloop);
@@ -3052,7 +3031,7 @@ lib_do_one_event_core(argc, argv, self, is_ip)
flags = FIX2INT(vflags);
}
- if (rb_safe_level() >=1 && OBJ_TAINTED(vflags)) {
+ if (rb_safe_level() >= 4 || (rb_safe_level() >=1 && OBJ_TAINTED(vflags))) {
flags |= TCL_DONT_WAIT;
}
@@ -3122,7 +3101,7 @@ ip_set_exc_message(interp, exc)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- msg = rb_funcallv(exc, ID_message, 0, 0);
+ msg = rb_funcall(exc, ID_message, 0, 0);
StringValue(msg);
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
@@ -3132,11 +3111,11 @@ ip_set_exc_message(interp, exc)
}
if (NIL_P(enc)) {
encoding = (Tcl_Encoding)NULL;
- } else if (RB_TYPE_P(enc, T_STRING)) {
+ } else if (TYPE(enc) == T_STRING) {
/* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc));
} else {
- enc = rb_funcallv(enc, ID_to_s, 0, 0);
+ enc = rb_funcall(enc, ID_to_s, 0, 0);
/* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc));
}
@@ -3189,11 +3168,11 @@ TkStringValue(obj)
default:
if (rb_respond_to(obj, ID_to_s)) {
- return rb_funcallv(obj, ID_to_s, 0, 0);
+ return rb_funcall(obj, ID_to_s, 0, 0);
}
}
- return rb_funcallv(obj, ID_inspect, 0, 0);
+ return rb_funcall(obj, ID_inspect, 0, 0);
}
static int
@@ -3311,7 +3290,7 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
rb_thread_critical = Qtrue;
DUMP1("set backtrace");
- if (!NIL_P(backtrace = rb_funcallv(exc, ID_backtrace, 0, 0))) {
+ if (!NIL_P(backtrace = rb_funcall(exc, ID_backtrace, 0, 0))) {
backtrace = rb_ary_join(backtrace, rb_str_new2("\n"));
Tcl_AddErrorInfo(interp, StringValuePtr(backtrace));
}
@@ -3342,7 +3321,7 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
if (rb_obj_is_kind_of(exc, eLocalJumpError)) {
VALUE reason = rb_ivar_get(exc, ID_at_reason);
- if (RB_TYPE_P(reason, T_SYMBOL)) {
+ if (TYPE(reason) == T_SYMBOL) {
if (SYM2ID(reason) == ID_return)
return TCL_RETURN;
@@ -3495,18 +3474,65 @@ ip_ruby_cmd_core(arg)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qfalse;
ret = rb_apply(arg->receiver, arg->method, arg->args);
- DUMP2("rb_apply return:%"PRIxVALUE, ret);
+ DUMP2("rb_apply return:%lx", ret);
rb_thread_critical = thr_crit_bup;
DUMP1("finish ip_ruby_cmd_core");
return ret;
}
+#define SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER 1
+
static VALUE
ip_ruby_cmd_receiver_const_get(name)
char *name;
{
- return rb_path2class(name);
+ volatile VALUE klass = rb_cObject;
+#if 0
+ char *head, *tail;
+#endif
+ int state;
+
+#if SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
+ klass = rb_eval_string_protect(name, &state);
+ if (state) {
+ return Qnil;
+ } else {
+ return klass;
+ }
+#else
+ return rb_const_get(klass, rb_intern(name));
+#endif
+
+ /* TODO!!!!!! */
+ /* support nest of classes/modules */
+
+ /* return rb_eval_string(name); */
+ /* return rb_eval_string_protect(name, &state); */
+
+#if 0 /* doesn't work!! (fail to autoload?) */
+ /* duplicate */
+ head = name = strdup(name);
+
+ /* has '::' at head ? */
+ if (*head == ':') head += 2;
+ tail = head;
+
+ /* search */
+ while(*tail) {
+ if (*tail == ':') {
+ *tail = '\0';
+ klass = rb_const_get(klass, rb_intern(head));
+ tail += 2;
+ head = tail;
+ } else {
+ tail++;
+ }
+ }
+
+ free(name);
+ return rb_const_get(klass, rb_intern(head));
+#endif
}
static VALUE
@@ -3514,12 +3540,18 @@ ip_ruby_cmd_receiver_get(str)
char *str;
{
volatile VALUE receiver;
+#if !SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
int state;
+#endif
if (str[0] == ':' || ('A' <= str[0] && str[0] <= 'Z')) {
/* class | module | constant */
+#if SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
+ receiver = ip_ruby_cmd_receiver_const_get(str);
+#else
receiver = rb_protect(ip_ruby_cmd_receiver_const_get, (VALUE)str, &state);
if (state) return Qnil;
+#endif
} else if (str[0] == '$') {
/* global variable */
receiver = rb_gv_get(str);
@@ -3752,7 +3784,7 @@ ip_RubyExitCommand(clientData, interp, argc, argv)
#endif
if (argc < 1 || argc > 2) {
- /* argument error */
+ /* arguemnt error */
Tcl_AppendResult(interp,
"wrong number of arguments: should be \"",
cmd, " ?returnCode?\"", (char *)NULL);
@@ -3763,7 +3795,7 @@ ip_RubyExitCommand(clientData, interp, argc, argv)
Tcl_ResetResult(interp);
- if (Tcl_IsSafe(interp)) {
+ if (rb_safe_level() >= 4 || Tcl_IsSafe(interp)) {
if (!Tcl_InterpDeleted(interp)) {
ip_finalize(interp);
@@ -5056,8 +5088,8 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
if (rb_thread_alone() || eventloop_thread == current_thread) {
#if TCL_MAJOR_VERSION >= 8
DUMP1("call ip_rbTkWaitObjCmd");
- DUMP2("eventloop_thread %"PRIxVALUE, eventloop_thread);
- DUMP2("current_thread %"PRIxVALUE, current_thread);
+ DUMP2("eventloop_thread %lx", eventloop_thread);
+ DUMP2("current_thread %lx", current_thread);
return ip_rbTkWaitObjCmd(clientData, interp, objc, objv);
#else /* TCL_MAJOR_VERSION < 8 */
DUMP1("call rb_VwaitCommand");
@@ -5769,13 +5801,12 @@ ip_finalize(ip)
/* destroy interpreter */
static void
-ip_free(p)
- void *p;
+ip_free(ptr)
+ struct tcltkip *ptr;
{
- struct tcltkip *ptr = p;
int thr_crit_bup;
- DUMP2("free Tcl Interp %p", ptr->ip);
+ DUMP2("free Tcl Interp %lx", (unsigned long)ptr->ip);
if (ptr) {
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -5784,10 +5815,10 @@ ip_free(p)
&& !Tcl_InterpDeleted(ptr->ip)
&& Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL
&& !Tcl_InterpDeleted(Tcl_GetMaster(ptr->ip)) ) {
- DUMP2("parent IP(%p) is not deleted",
- Tcl_GetMaster(ptr->ip));
- DUMP2("slave IP(%p) should not be deleted",
- ptr->ip);
+ DUMP2("parent IP(%lx) is not deleted",
+ (unsigned long)Tcl_GetMaster(ptr->ip));
+ DUMP2("slave IP(%lx) should not be deleted",
+ (unsigned long)ptr->ip);
xfree(ptr);
/* ckfree((char*)ptr); */
rb_thread_critical = thr_crit_bup;
@@ -5826,7 +5857,7 @@ static VALUE
ip_alloc(self)
VALUE self;
{
- return TypedData_Wrap_Struct(self, &tcltkip_type, 0);
+ return Data_Wrap_Struct(self, 0, ip_free, 0);
}
static void
@@ -5968,9 +5999,6 @@ ip_rb_replaceSlaveTkCmdsCommand(clientData, interp, objc, objv)
return TCL_OK;
}
-#ifndef ORIG_NAMESPACE_CMD
-#define ORIG_NAMESPACE_CMD "__orig_namespace_command__"
-#endif
#if TCL_MAJOR_VERSION >= 8
static int ip_rbNamespaceObjCmd _((ClientData, Tcl_Interp *, int,
@@ -5985,12 +6013,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv)
Tcl_CmdInfo info;
int ret;
- DUMP1("call ip_rbNamespaceObjCmd");
- DUMP2("objc = %d", objc);
- DUMP2("objv[0] = '%s'", Tcl_GetString(objv[0]));
- DUMP2("objv[1] = '%s'", Tcl_GetString(objv[1]));
- if (!Tcl_GetCommandInfo(interp, ORIG_NAMESPACE_CMD, &(info))) {
- DUMP1("fail to get "ORIG_NAMESPACE_CMD);
+ if (!Tcl_GetCommandInfo(interp, "__orig_namespace_command__", &(info))) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp,
"invalid command name \"namespace\"", (char*)NULL);
@@ -5998,38 +6021,15 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv)
}
rbtk_eventloop_depth++;
- DUMP2("namespace wrapper enter depth == %d", rbtk_eventloop_depth);
+ /* DUMP2("namespace wrapper enter depth == %d", rbtk_eventloop_depth); */
if (info.isNativeObjectProc) {
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6
- DUMP1("call a native-object-proc");
ret = (*(info.objProc))(info.objClientData, interp, objc, objv);
-#else
- /* Tcl8.6 or later */
- int i;
- Tcl_Obj **cp_objv;
- char org_ns_cmd_name[] = ORIG_NAMESPACE_CMD;
-
- DUMP1("call a native-object-proc for tcl8.6 or later");
- cp_objv = RbTk_ALLOC_N(Tcl_Obj *, (objc + 1));
-
- cp_objv[0] = Tcl_NewStringObj(org_ns_cmd_name, strlen(org_ns_cmd_name));
- for(i = 1; i < objc; i++) {
- cp_objv[i] = objv[i];
- }
- cp_objv[objc] = (Tcl_Obj *)NULL;
-
- /* ret = Tcl_EvalObjv(interp, objc, cp_objv, TCL_EVAL_DIRECT); */
- ret = Tcl_EvalObjv(interp, objc, cp_objv, 0);
-
- ckfree((char*)cp_objv);
-#endif
} else {
/* string interface */
int i;
char **argv;
- DUMP1("call with the string-interface");
/* argv = (char **)Tcl_Alloc(sizeof(char *) * (objc + 1)); */
argv = RbTk_ALLOC_N(char *, (objc + 1));
#if 0 /* use Tcl_Preserve/Release */
@@ -6057,10 +6057,9 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv)
#endif
}
- DUMP2("namespace wrapper exit depth == %d", rbtk_eventloop_depth);
+ /* DUMP2("namespace wrapper exit depth == %d", rbtk_eventloop_depth); */
rbtk_eventloop_depth--;
- DUMP1("end of ip_rbNamespaceObjCmd");
return ret;
}
#endif
@@ -6070,8 +6069,6 @@ ip_wrap_namespace_command(interp)
Tcl_Interp *interp;
{
#if TCL_MAJOR_VERSION >= 8
-
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6
Tcl_CmdInfo orig_info;
if (!Tcl_GetCommandInfo(interp, "namespace", &(orig_info))) {
@@ -6079,20 +6076,15 @@ ip_wrap_namespace_command(interp)
}
if (orig_info.isNativeObjectProc) {
- Tcl_CreateObjCommand(interp, ORIG_NAMESPACE_CMD,
+ Tcl_CreateObjCommand(interp, "__orig_namespace_command__",
orig_info.objProc, orig_info.objClientData,
orig_info.deleteProc);
} else {
- Tcl_CreateCommand(interp, ORIG_NAMESPACE_CMD,
+ Tcl_CreateCommand(interp, "__orig_namespace_command__",
orig_info.proc, orig_info.clientData,
orig_info.deleteProc);
}
-#else /* tcl8.6 or later */
- Tcl_Eval(interp, "rename namespace "ORIG_NAMESPACE_CMD);
-
-#endif
-
Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *)NULL);
#endif
@@ -6138,11 +6130,15 @@ ip_init(argc, argv, self)
int with_tk = 1;
Tk_Window mainWin = (Tk_Window)NULL;
- /* create object */
- TypedData_Get_Struct(self, struct tcltkip, &tcltkip_type, ptr);
- if (DATA_PTR(self)) {
- rb_raise(rb_eArgError, "already initialized interpreter");
+ /* security check */
+ if (rb_safe_level() >= 4) {
+ rb_raise(rb_eSecurityError,
+ "Cannot create a TclTkIp object at level %d",
+ rb_safe_level());
}
+
+ /* create object */
+ Data_Get_Struct(self, struct tcltkip, ptr);
ptr = ALLOC(struct tcltkip);
/* ptr = RbTk_ALLOC_N(struct tcltkip, 1); */
DATA_PTR(self) = ptr;
@@ -6250,7 +6246,7 @@ ip_init(argc, argv, self)
/* FIX ME (2010/06/28) */
/* Don't use ::chan command for Mk4tcl + tclvfs-1.4 on Tcl8.5. */
/* It fails to access VFS files because of vfs::zstream. */
- /* So, force to use ::rechan by temporarily hiding ::chan. */
+ /* So, force to use ::rechan by temporaly hiding ::chan. */
/*************************************************************************/
Tcl_Eval(ptr->ip, "catch {rename ::chan ::_tmp_chan}");
if (Tcl_Init(ptr->ip) == TCL_ERROR) {
@@ -6380,11 +6376,10 @@ ip_create_slave_core(interp, argc, argv)
VALUE *argv;
{
struct tcltkip *master = get_ip(interp);
- struct tcltkip *slave;
+ struct tcltkip *slave = ALLOC(struct tcltkip);
/* struct tcltkip *slave = RbTk_ALLOC_N(struct tcltkip, 1); */
VALUE safemode;
VALUE name;
- VALUE new_ip;
int safe;
int thr_crit_bup;
Tk_Window mainWin;
@@ -6423,8 +6418,6 @@ ip_create_slave_core(interp, argc, argv)
}
#endif
- new_ip = TypedData_Make_Struct(CLASS_OF(interp), struct tcltkip,
- &tcltkip_type, slave);
/* create slave-ip */
#ifdef RUBY_USE_NATIVE_THREAD
/* slave->tk_thread_id = 0; */
@@ -6484,7 +6477,7 @@ ip_create_slave_core(interp, argc, argv)
rb_thread_critical = thr_crit_bup;
- return new_ip;
+ return Data_Wrap_Struct(CLASS_OF(interp), 0, ip_free, slave);
}
static VALUE
@@ -6635,7 +6628,7 @@ ip_make_safe_core(interp, argc, argv)
if (Tcl_MakeSafe(ptr->ip) == TCL_ERROR) {
/* return rb_exc_new2(rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip)); */
- return create_ip_exc(interp, rb_eRuntimeError, "%s",
+ return create_ip_exc(interp, rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip));
}
@@ -6989,8 +6982,8 @@ call_queue_handler(evPtr, flags)
struct tcltkip *ptr;
DUMP2("do_call_queue_handler : evPtr = %p", evPtr);
- DUMP2("call_queue_handler thread : %"PRIxVALUE, rb_thread_current());
- DUMP2("added by thread : %"PRIxVALUE, thread);
+ DUMP2("call_queue_handler thread : %lx", rb_thread_current());
+ DUMP2("added by thread : %lx", thread);
if (*(q->done)) {
DUMP1("processed by another event-loop");
@@ -7021,19 +7014,19 @@ call_queue_handler(evPtr, flags)
/* check safe-level */
if (rb_safe_level() != q->safe_level) {
/* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */
- q_dat = Data_Wrap_Struct(0,call_queue_mark,-1,q);
+ q_dat = Data_Wrap_Struct(rb_cData,call_queue_mark,-1,q);
ret = rb_funcall(rb_proc_new(callq_safelevel_handler, q_dat),
ID_call, 0);
rb_gc_force_recycle(q_dat);
q_dat = (VALUE)NULL;
} else {
- DUMP2("call function (for caller thread:%"PRIxVALUE")", thread);
- DUMP2("call function (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("call function (for caller thread:%lx)", thread);
+ DUMP2("call function (current thread:%lx)", rb_thread_current());
ret = (q->func)(q->interp, q->argc, q->argv);
}
/* set result */
- RARRAY_ASET(q->result, 0, ret);
+ RARRAY_PTR(q->result)[0] = ret;
ret = (VALUE)NULL;
/* decr internal handler mark */
@@ -7050,8 +7043,8 @@ call_queue_handler(evPtr, flags)
/* back to caller */
if (RTEST(rb_thread_alive_p(thread))) {
- DUMP2("back to caller (caller thread:%"PRIxVALUE")", thread);
- DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("back to caller (caller thread:%lx)", thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
have_rb_thread_waiting_for_value = 1;
rb_thread_wakeup(thread);
@@ -7063,8 +7056,8 @@ call_queue_handler(evPtr, flags)
rb_thread_schedule();
#endif
} else {
- DUMP2("caller is dead (caller thread:%"PRIxVALUE")", thread);
- DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("caller is dead (caller thread:%lx)", thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
}
/* end of handler : remove it */
@@ -7114,9 +7107,9 @@ tk_funcall(func, argc, argv, obj)
&& (NIL_P(eventloop_thread) || current == eventloop_thread)
) {
if (NIL_P(eventloop_thread)) {
- DUMP2("tk_funcall from thread:%"PRIxVALUE" but no eventloop", current);
+ DUMP2("tk_funcall from thread:%lx but no eventloop", current);
} else {
- DUMP2("tk_funcall from current eventloop %"PRIxVALUE, current);
+ DUMP2("tk_funcall from current eventloop %lx", current);
}
result = (func)(ip_obj, argc, argv);
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -7125,7 +7118,7 @@ tk_funcall(func, argc, argv, obj)
return result;
}
- DUMP2("tk_funcall from thread %"PRIxVALUE" (NOT current eventloop)", current);
+ DUMP2("tk_funcall from thread %lx (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -7200,23 +7193,23 @@ tk_funcall(func, argc, argv, obj)
t.tv_sec = 0;
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
- DUMP2("callq wait for handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("callq wait for handler (current thread:%lx)", current);
while(*alloc_done >= 0) {
- DUMP2("*** callq wait for handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("*** callq wait for handler (current thread:%lx)", current);
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
- DUMP2("*** callq wakeup (current thread:%"PRIxVALUE")", current);
- DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
+ DUMP2("*** callq wakeup (current thread:%lx)", current);
+ DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** callq lost eventloop thread");
break;
}
}
- DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("back from handler (current thread:%lx)", current);
/* get result & free allocated memory */
- ret = RARRAY_AREF(result, 0);
+ ret = RARRAY_PTR(result)[0];
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */
#else
@@ -7257,7 +7250,7 @@ tk_funcall(func, argc, argv, obj)
DUMP1("raise exception");
/* rb_exc_raise(ret); */
rb_exc_raise(rb_exc_new3(rb_obj_class(ret),
- rb_funcallv(ret, ID_to_s, 0, 0)));
+ rb_funcall(ret, ID_to_s, 0, 0)));
}
DUMP1("exit tk_funcall");
@@ -7476,8 +7469,8 @@ eval_queue_handler(evPtr, flags)
struct tcltkip *ptr;
DUMP2("do_eval_queue_handler : evPtr = %p", evPtr);
- DUMP2("eval_queue_thread : %"PRIxVALUE, rb_thread_current());
- DUMP2("added by thread : %"PRIxVALUE, thread);
+ DUMP2("eval_queue_thread : %lx", rb_thread_current());
+ DUMP2("added by thread : %lx", thread);
if (*(q->done)) {
DUMP1("processed by another event-loop");
@@ -7515,7 +7508,7 @@ eval_queue_handler(evPtr, flags)
#endif
#endif
/* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */
- q_dat = Data_Wrap_Struct(0,eval_queue_mark,-1,q);
+ q_dat = Data_Wrap_Struct(rb_cData,eval_queue_mark,-1,q);
ret = rb_funcall(rb_proc_new(evq_safelevel_handler, q_dat),
ID_call, 0);
rb_gc_force_recycle(q_dat);
@@ -7525,7 +7518,7 @@ eval_queue_handler(evPtr, flags)
}
/* set result */
- RARRAY_ASET(q->result, 0, ret);
+ RARRAY_PTR(q->result)[0] = ret;
ret = (VALUE)NULL;
/* decr internal handler mark */
@@ -7541,8 +7534,8 @@ eval_queue_handler(evPtr, flags)
/* back to caller */
if (RTEST(rb_thread_alive_p(thread))) {
- DUMP2("back to caller (caller thread:%"PRIxVALUE")", thread);
- DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("back to caller (caller thread:%lx)", thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
have_rb_thread_waiting_for_value = 1;
rb_thread_wakeup(thread);
@@ -7554,8 +7547,8 @@ eval_queue_handler(evPtr, flags)
rb_thread_schedule();
#endif
} else {
- DUMP2("caller is dead (caller thread:%"PRIxVALUE")", thread);
- DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("caller is dead (caller thread:%lx)", thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
}
/* end of handler : remove it */
@@ -7593,7 +7586,7 @@ ip_eval(self, str)
#else
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
#endif
- DUMP2("status: eventloopt_thread %"PRIxVALUE, eventloop_thread);
+ DUMP2("status: eventloopt_thread %lx", eventloop_thread);
if (
#ifdef RUBY_USE_NATIVE_THREAD
@@ -7603,9 +7596,9 @@ ip_eval(self, str)
(NIL_P(eventloop_thread) || current == eventloop_thread)
) {
if (NIL_P(eventloop_thread)) {
- DUMP2("eval from thread:%"PRIxVALUE" but no eventloop", current);
+ DUMP2("eval from thread:%lx but no eventloop", current);
} else {
- DUMP2("eval from current eventloop %"PRIxVALUE, current);
+ DUMP2("eval from current eventloop %lx", current);
}
result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LENINT(str));
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -7614,7 +7607,7 @@ ip_eval(self, str)
return result;
}
- DUMP2("eval from thread %"PRIxVALUE" (NOT current eventloop)", current);
+ DUMP2("eval from thread %lx (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -7684,23 +7677,23 @@ ip_eval(self, str)
t.tv_sec = 0;
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
- DUMP2("evq wait for handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("evq wait for handler (current thread:%lx)", current);
while(*alloc_done >= 0) {
- DUMP2("*** evq wait for handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("*** evq wait for handler (current thread:%lx)", current);
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
- DUMP2("*** evq wakeup (current thread:%"PRIxVALUE")", current);
- DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
+ DUMP2("*** evq wakeup (current thread:%lx)", current);
+ DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** evq lost eventloop thread");
break;
}
}
- DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("back from handler (current thread:%lx)", current);
/* get result & free allocated memory */
- ret = RARRAY_AREF(result, 0);
+ ret = RARRAY_PTR(result)[0];
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */
@@ -7734,7 +7727,7 @@ ip_eval(self, str)
DUMP1("raise exception");
/* rb_exc_raise(ret); */
rb_exc_raise(rb_exc_new3(rb_obj_class(ret),
- rb_funcallv(ret, ID_to_s, 0, 0)));
+ rb_funcall(ret, ID_to_s, 0, 0)));
}
return ret;
@@ -7758,8 +7751,7 @@ ip_cancel_eval_core(interp, msg, flag)
if (NIL_P(msg)) {
msg_obj = NULL;
} else {
- char *s = StringValuePtr(msg);
- msg_obj = Tcl_NewStringObj(s, RSTRING_LENINT(msg));
+ msg_obj = Tcl_NewStringObj(RSTRING_PTR(msg), RSTRING_LEN(msg));
Tcl_IncrRefCount(msg_obj);
}
@@ -7958,11 +7950,11 @@ lib_toUTF8_core(ip_obj, src, encodename)
rb_thread_critical = Qtrue;
if (NIL_P(encodename)) {
- if (RB_TYPE_P(str, T_STRING)) {
+ if (TYPE(str) == T_STRING) {
volatile VALUE enc;
#ifdef HAVE_RUBY_ENCODING_H
- enc = rb_funcallv(rb_obj_encoding(str), ID_to_s, 0, 0);
+ enc = rb_funcall(rb_obj_encoding(str), ID_to_s, 0, 0);
#else
enc = rb_attr_get(str, ID_at_enc);
#endif
@@ -7975,7 +7967,7 @@ lib_toUTF8_core(ip_obj, src, encodename)
encoding = (Tcl_Encoding)NULL;
} else {
/* StringValue(enc); */
- enc = rb_funcallv(enc, ID_to_s, 0, 0);
+ enc = rb_funcall(enc, ID_to_s, 0, 0);
/* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
if (!RSTRING_LEN(enc)) {
encoding = (Tcl_Encoding)NULL;
@@ -8136,7 +8128,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
if (NIL_P(encodename)) {
volatile VALUE enc;
- if (RB_TYPE_P(str, T_STRING)) {
+ if (TYPE(str) == T_STRING) {
enc = rb_attr_get(str, ID_at_enc);
if (!NIL_P(enc)) {
StringValue(enc);
@@ -8166,7 +8158,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
encoding = (Tcl_Encoding)NULL;
} else {
/* StringValue(enc); */
- enc = rb_funcallv(enc, ID_to_s, 0, 0);
+ enc = rb_funcall(enc, ID_to_s, 0, 0);
/* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
if (!RSTRING_LEN(enc)) {
encoding = (Tcl_Encoding)NULL;
@@ -8421,7 +8413,7 @@ lib_set_system_encoding(self, enc_name)
return lib_get_system_encoding(self);
}
- enc_name = rb_funcallv(enc_name, ID_to_s, 0, 0);
+ enc_name = rb_funcall(enc_name, ID_to_s, 0, 0);
if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
StringValuePtr(enc_name)) != TCL_OK) {
rb_raise(rb_eArgError, "unknown encoding name '%s'",
@@ -8457,28 +8449,15 @@ invoke_tcl_proc(arg)
#endif
{
struct invoke_info *inf = (struct invoke_info *)arg;
-#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION < 6
int i, len;
+#if TCL_MAJOR_VERSION >= 8
int argc = inf->objc;
char **argv = (char **)NULL;
#endif
- DUMP1("call invoke_tcl_proc");
-
-#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 6)
- /* Tcl/Tk 8.6 or later */
-
- /* eval */
- inf->ptr->return_value = Tcl_EvalObjv(inf->ptr->ip, inf->objc, inf->objv, TCL_EVAL_DIRECT);
- /* inf->ptr->return_value = Tcl_EvalObjv(inf->ptr->ip, inf->objc, inf->objv, 0); */
-
-#else /* Tcl/Tk 7.x, 8.0 -- 8.5 */
-
/* memory allocation for arguments of this command */
-#if TCL_MAJOR_VERSION == 8
- /* Tcl/Tk 8.0 -- 8.5 */
+#if TCL_MAJOR_VERSION >= 8
if (!inf->cmdinfo.isNativeObjectProc) {
- DUMP1("called proc is not a native-obj-proc");
/* string interface */
/* argv = (char **)ALLOC_N(char *, argc+1);*/ /* XXXXXXXXXX */
argv = RbTk_ALLOC_N(char *, (argc+1));
@@ -8492,14 +8471,11 @@ invoke_tcl_proc(arg)
}
#endif
- DUMP1("reset result of tcl-interp");
Tcl_ResetResult(inf->ptr->ip);
/* Invoke the C procedure */
-#if TCL_MAJOR_VERSION == 8
- /* Tcl/Tk 8.0 -- 8.5 */
+#if TCL_MAJOR_VERSION >= 8
if (inf->cmdinfo.isNativeObjectProc) {
- DUMP1("call tcl_proc as a native-obj-proc");
inf->ptr->return_value
= (*(inf->cmdinfo.objProc))(inf->cmdinfo.objClientData,
inf->ptr->ip, inf->objc, inf->objv);
@@ -8507,9 +8483,7 @@ invoke_tcl_proc(arg)
else
#endif
{
-#if TCL_MAJOR_VERSION == 8
- /* Tcl/Tk 8.0 -- 8.5 */
- DUMP1("call tcl_proc as not a native-obj-proc");
+#if TCL_MAJOR_VERSION >= 8
inf->ptr->return_value
= (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip,
argc, (CONST84 char **)argv);
@@ -8532,9 +8506,6 @@ invoke_tcl_proc(arg)
#endif
}
-#endif /* Tcl/Tk 8.6 or later || Tcl 7.x, 8.0 -- 8.5 */
-
- DUMP1("end of invoke_tcl_proc");
return Qnil;
}
@@ -8571,6 +8542,9 @@ ip_invoke_core(interp, argc, argv)
#endif
#endif
+ /* get the data struct */
+ ptr = get_ip(interp);
+
/* get the command name string */
#if TCL_MAJOR_VERSION >= 8
cmd = Tcl_GetStringFromObj(objv[0], &len);
@@ -8671,9 +8645,7 @@ ip_invoke_core(interp, argc, argv)
#endif
/* invoke tcl-proc */
- DUMP1("invoke tcl-proc");
rb_protect(invoke_tcl_proc, (VALUE)&inf, &status);
- DUMP2("status of tcl-proc, %d", status);
switch(status) {
case TAG_RAISE:
if (NIL_P(rb_errinfo())) {
@@ -8933,7 +8905,7 @@ ip_invoke_real(argc, argv, interp)
char **av = (char **)NULL;
#endif
- DUMP2("invoke_real called by thread:%"PRIxVALUE, rb_thread_current());
+ DUMP2("invoke_real called by thread:%lx", rb_thread_current());
/* get the data struct */
ptr = get_ip(interp);
@@ -8982,8 +8954,8 @@ invoke_queue_handler(evPtr, flags)
struct tcltkip *ptr;
DUMP2("do_invoke_queue_handler : evPtr = %p", evPtr);
- DUMP2("invoke queue_thread : %"PRIxVALUE, rb_thread_current());
- DUMP2("added by thread : %"PRIxVALUE, thread);
+ DUMP2("invoke queue_thread : %lx", rb_thread_current());
+ DUMP2("added by thread : %lx", thread);
if (*(q->done)) {
DUMP1("processed by another event-loop");
@@ -9014,19 +8986,19 @@ invoke_queue_handler(evPtr, flags)
/* check safe-level */
if (rb_safe_level() != q->safe_level) {
/* q_dat = Data_Wrap_Struct(rb_cData,0,0,q); */
- q_dat = Data_Wrap_Struct(0,invoke_queue_mark,-1,q);
+ q_dat = Data_Wrap_Struct(rb_cData,invoke_queue_mark,-1,q);
ret = rb_funcall(rb_proc_new(ivq_safelevel_handler, q_dat),
ID_call, 0);
rb_gc_force_recycle(q_dat);
q_dat = (VALUE)NULL;
} else {
- DUMP2("call invoke_real (for caller thread:%"PRIxVALUE")", thread);
- DUMP2("call invoke_real (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("call invoke_real (for caller thread:%lx)", thread);
+ DUMP2("call invoke_real (current thread:%lx)", rb_thread_current());
ret = ip_invoke_core(q->interp, q->argc, q->argv);
}
/* set result */
- RARRAY_ASET(q->result, 0, ret);
+ RARRAY_PTR(q->result)[0] = ret;
ret = (VALUE)NULL;
/* decr internal handler mark */
@@ -9042,8 +9014,8 @@ invoke_queue_handler(evPtr, flags)
/* back to caller */
if (RTEST(rb_thread_alive_p(thread))) {
- DUMP2("back to caller (caller thread:%"PRIxVALUE")", thread);
- DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("back to caller (caller thread:%lx)", thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
have_rb_thread_waiting_for_value = 1;
rb_thread_wakeup(thread);
@@ -9055,8 +9027,8 @@ invoke_queue_handler(evPtr, flags)
rb_thread_schedule();
#endif
} else {
- DUMP2("caller is dead (caller thread:%"PRIxVALUE")", thread);
- DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
+ DUMP2("caller is dead (caller thread:%lx)", thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
}
/* end of handler : remove it */
@@ -9099,7 +9071,7 @@ ip_invoke_with_position(argc, argv, obj, position)
#else
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
#endif
- DUMP2("status: eventloopt_thread %"PRIxVALUE, eventloop_thread);
+ DUMP2("status: eventloopt_thread %lx", eventloop_thread);
if (
#ifdef RUBY_USE_NATIVE_THREAD
@@ -9109,9 +9081,9 @@ ip_invoke_with_position(argc, argv, obj, position)
(NIL_P(eventloop_thread) || current == eventloop_thread)
) {
if (NIL_P(eventloop_thread)) {
- DUMP2("invoke from thread:%"PRIxVALUE" but no eventloop", current);
+ DUMP2("invoke from thread:%lx but no eventloop", current);
} else {
- DUMP2("invoke from current eventloop %"PRIxVALUE, current);
+ DUMP2("invoke from current eventloop %lx", current);
}
result = ip_invoke_real(argc, argv, ip_obj);
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -9120,7 +9092,7 @@ ip_invoke_with_position(argc, argv, obj, position)
return result;
}
- DUMP2("invoke from thread %"PRIxVALUE" (NOT current eventloop)", current);
+ DUMP2("invoke from thread %lx (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -9184,22 +9156,22 @@ ip_invoke_with_position(argc, argv, obj, position)
t.tv_sec = 0;
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
- DUMP2("ivq wait for handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("ivq wait for handler (current thread:%lx)", current);
while(*alloc_done >= 0) {
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
- DUMP2("*** ivq wakeup (current thread:%"PRIxVALUE")", current);
- DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
+ DUMP2("*** ivq wakeup (current thread:%lx)", current);
+ DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** ivq lost eventloop thread");
break;
}
}
- DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
+ DUMP2("back from handler (current thread:%lx)", current);
/* get result & free allocated memory */
- ret = RARRAY_AREF(result, 0);
+ ret = RARRAY_PTR(result)[0];
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */
#else
@@ -9231,7 +9203,7 @@ ip_invoke_with_position(argc, argv, obj, position)
DUMP1("raise exception");
/* rb_exc_raise(ret); */
rb_exc_raise(rb_exc_new3(rb_obj_class(ret),
- rb_funcallv(ret, ID_to_s, 0, 0)));
+ rb_funcall(ret, ID_to_s, 0, 0)));
}
DUMP1("exit ip_invoke");
@@ -9321,7 +9293,7 @@ ip_get_variable2_core(interp, argc, argv)
volatile VALUE exc;
/* exc = rb_exc_new2(rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip)); */
- exc = create_ip_exc(interp, rb_eRuntimeError, "%s",
+ exc = create_ip_exc(interp, rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip));
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
@@ -9460,7 +9432,7 @@ ip_set_variable2_core(interp, argc, argv)
volatile VALUE exc;
/* exc = rb_exc_new2(rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip)); */
- exc = create_ip_exc(interp, rb_eRuntimeError, "%s",
+ exc = create_ip_exc(interp, rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip));
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
@@ -9580,7 +9552,7 @@ ip_unset_variable2_core(interp, argc, argv)
if (FIX2INT(flag) & TCL_LEAVE_ERR_MSG) {
/* return rb_exc_new2(rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip)); */
- return create_ip_exc(interp, rb_eRuntimeError, "%s",
+ return create_ip_exc(interp, rb_eRuntimeError,
Tcl_GetStringResult(ptr->ip));
}
return Qfalse;
@@ -10004,7 +9976,7 @@ lib_get_reltype_name(self)
static VALUE
-tcltklib_compile_info(void)
+tcltklib_compile_info()
{
volatile VALUE ret;
size_t size;
@@ -10200,7 +10172,7 @@ encoding_table_get_name_core(table, enc_arg, error_mode)
/* 1st: default encoding setting of interp */
if (ptr && NIL_P(enc)) {
if (rb_respond_to(interp, ID_encoding_name)) {
- enc = rb_funcallv(interp, ID_encoding_name, 0, 0);
+ enc = rb_funcall(interp, ID_encoding_name, 0, 0);
}
}
/* 2nd: Encoding.default_internal */
@@ -10243,7 +10215,7 @@ encoding_table_get_name_core(table, enc_arg, error_mode)
} else {
/* String or Symbol? */
- name = rb_funcallv(enc, ID_to_s, 0, 0);
+ name = rb_funcall(enc, ID_to_s, 0, 0);
if (!NIL_P(rb_hash_lookup(table, name))) {
/* find */
@@ -10277,7 +10249,7 @@ encoding_table_get_name_core(table, enc_arg, error_mode)
}
if (RTEST(error_mode)) {
- enc = rb_funcallv(enc_arg, ID_to_s, 0, 0);
+ enc = rb_funcall(enc_arg, ID_to_s, 0, 0);
rb_raise(rb_eArgError, "unsupported Tk encoding '%s'", RSTRING_PTR(enc));
}
return Qnil;
@@ -10355,7 +10327,7 @@ encoding_table_get_name_core(table, enc, error_mode)
{
volatile VALUE name = Qnil;
- enc = rb_funcallv(enc, ID_to_s, 0, 0);
+ enc = rb_funcall(enc, ID_to_s, 0, 0);
name = rb_hash_lookup(table, enc);
if (!NIL_P(name)) {
@@ -10743,7 +10715,7 @@ ip_make_menu_embeddable(interp, menu_path)
/*---- initialization ----*/
void
-Init_tcltklib(void)
+Init_tcltklib()
{
int ret;
@@ -11042,7 +11014,7 @@ Init_tcltklib(void)
/* --------------------------------------------------------------- */
#ifdef HAVE_NATIVETHREAD
- /* if ruby->nativethread-support and tcltklib->doesn't,
+ /* if ruby->nativethread-supprt and tcltklib->doen't,
the following will cause link-error. */
ruby_native_thread_p();
#endif
diff --git a/ext/tk/tkutil/extconf.rb b/ext/tk/tkutil/extconf.rb
index 0b3ce03595..57de973c0a 100644
--- a/ext/tk/tkutil/extconf.rb
+++ b/ext/tk/tkutil/extconf.rb
@@ -1,13 +1,17 @@
-# frozen_string_literal: false
begin
+ has_tk = compiled?('tk')
+rescue NoMethodError
+ # Probably, called manually (NOT from 'extmk.rb'). Force to make Makefile.
+ has_tk = true
+end
+
+if has_tk
require 'mkmf'
have_func("rb_obj_instance_exec", "ruby.h")
have_func("rb_obj_untrust", "ruby.h")
have_func("rb_obj_taint", "ruby.h")
- have_func("rb_sym2str", "ruby.h")
- have_func("rb_id2str", "ruby.h")
- have_func("rb_ary_cat", "ruby.h")
+ have_func("rb_sym_to_s", "ruby.h")
have_func("strndup", "string.h")
create_makefile('tkutil')
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c
index 147dfa23d1..fd8972645a 100644
--- a/ext/tk/tkutil/tkutil.c
+++ b/ext/tk/tkutil/tkutil.c
@@ -23,9 +23,6 @@ static int rb_thread_critical; /* dummy */
#include "st.h"
#endif
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 1
-
#if !defined(RHASH_TBL)
#define RHASH_TBL(h) (RHASH(h)->tbl)
#endif
@@ -37,25 +34,11 @@ static int rb_thread_critical; /* dummy */
#define RARRAY_PTR(s) (RARRAY(s)->ptr)
#define RARRAY_LEN(s) (RARRAY(s)->len)
#endif
-#if !defined(RARRAY_CONST_PTR)
-#define RARRAY_CONST_PTR(s) (const VALUE *)RARRAY_PTR(s)
-#endif
-#if !defined(RARRAY_AREF)
-#define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i]
-#endif
#if defined(HAVE_STRNDUP) && !defined(_GNU_SOURCE)
extern char *strndup(const char* _ptr, size_t _len);
#endif
-#ifndef HAVE_RB_SYM2STR
-# define rb_sym2str(obj) rb_id2str(SYM2ID(obj))
-#endif
-
-#ifndef HAVE_RB_ID2STR
-# define rb_id2str(id) rb_str_new2(rb_id2name(id))
-#endif
-
static VALUE cMethod;
static VALUE cTclTkLib;
@@ -93,40 +76,6 @@ static unsigned long CALLBACK_ID_NUM = 0;
/*************************************/
-#ifndef HAVE_STRNDUP
-static char * strndup _((const char *, size_t));
-static char *
-strndup(ptr, len)
- const char *ptr;
- size_t len;
-{
- char *newptr = malloc(len + 1);
- if (newptr) {
- memcpy(newptr, ptr, len);
- newptr[len] = '\0';
- }
- return newptr;
-}
-#endif
-
-#ifndef HAVE_RB_ARY_CAT
-static VALUE rb_ary_cat _((VALUE, const VALUE *, long));
-static VALUE
-rb_ary_cat(ary, argv, len)
- VALUE ary;
- const VALUE *argv;
- long len;
-{
- long i;
- for (i = 0; i < len; i++) {
- rb_ary_push(ary, argv[i]);
- }
- return ary;
-}
-#endif
-
-/*************************************/
-
#if defined(HAVE_RB_OBJ_INSTANCE_EXEC) && !defined(RUBY_VM)
extern VALUE rb_obj_instance_exec _((int, VALUE*, VALUE));
#endif
@@ -220,7 +169,7 @@ tk_install_cmd_core(cmd)
volatile VALUE id_num;
id_num = ULONG2NUM(CALLBACK_ID_NUM++);
- id_num = rb_funcallv(id_num, ID_to_s, 0, 0);
+ id_num = rb_funcall(id_num, ID_to_s, 0, 0);
id_num = rb_str_append(rb_str_new2(cmd_id_prefix), id_num);
rb_hash_aset(CALLBACK_TABLE, id_num, cmd);
return rb_str_append(rb_str_new2(cmd_id_head), id_num);
@@ -317,7 +266,7 @@ to_strkey(key, value, hash)
VALUE value;
VALUE hash;
{
- rb_hash_aset(hash, rb_funcallv(key, ID_to_s, 0, 0), value);
+ rb_hash_aset(hash, rb_funcall(key, ID_to_s, 0, 0), value);
return ST_CHECK;
}
@@ -354,28 +303,28 @@ ary2list(ary, enc_flag, self)
volatile VALUE dst;
volatile VALUE sys_enc, dst_enc, str_enc;
- sys_enc = rb_funcallv(cTclTkLib, ID_encoding, 0, 0);
+ sys_enc = rb_funcall(cTclTkLib, ID_encoding, 0, 0);
if (NIL_P(sys_enc)) {
- sys_enc = rb_funcallv(cTclTkLib, ID_encoding_system, 0, 0);
- sys_enc = rb_funcallv(sys_enc, ID_to_s, 0, 0);
+ sys_enc = rb_funcall(cTclTkLib, ID_encoding_system, 0, 0);
+ sys_enc = rb_funcall(sys_enc, ID_to_s, 0, 0);
}
if (NIL_P(enc_flag)) {
dst_enc = sys_enc;
req_chk_flag = 1;
- } else if (enc_flag == Qtrue || enc_flag == Qfalse) {
+ } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) {
dst_enc = enc_flag;
req_chk_flag = 0;
} else {
- dst_enc = rb_funcallv(enc_flag, ID_to_s, 0, 0);
+ dst_enc = rb_funcall(enc_flag, ID_to_s, 0, 0);
req_chk_flag = 0;
}
/* size = RARRAY_LEN(ary); */
size = 0;
for(idx = 0; idx < RARRAY_LEN(ary); idx++) {
- if (RB_TYPE_P(RARRAY_AREF(ary, idx), T_HASH)) {
- size += 2 * RHASH_SIZE(RARRAY_AREF(ary, idx));
+ if (TYPE(RARRAY_PTR(ary)[idx]) == T_HASH) {
+ size += 2 * RHASH_SIZE(RARRAY_PTR(ary)[idx]);
} else {
size++;
}
@@ -383,7 +332,7 @@ ary2list(ary, enc_flag, self)
dst = rb_ary_new2(size);
for(idx = 0; idx < RARRAY_LEN(ary); idx++) {
- val = RARRAY_AREF(ary, idx);
+ val = RARRAY_PTR(ary)[idx];
str_val = Qnil;
switch(TYPE(val)) {
case T_ARRAY:
@@ -393,7 +342,7 @@ ary2list(ary, enc_flag, self)
if (req_chk_flag) {
str_enc = rb_ivar_get(str_val, ID_at_enc);
if (!NIL_P(str_enc)) {
- str_enc = rb_funcallv(str_enc, ID_to_s, 0, 0);
+ str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
} else {
str_enc = sys_enc;
}
@@ -414,7 +363,7 @@ ary2list(ary, enc_flag, self)
}
size2 = RARRAY_LEN(val);
for(idx2 = 0; idx2 < size2; idx2++) {
- val2 = RARRAY_AREF(val, idx2);
+ val2 = RARRAY_PTR(val)[idx2];
switch(TYPE(val2)) {
case T_ARRAY:
str_val = ary2list(val2, enc_flag, self);
@@ -440,7 +389,7 @@ ary2list(ary, enc_flag, self)
if (req_chk_flag) {
str_enc = rb_ivar_get(str_val, ID_at_enc);
if (!NIL_P(str_enc)) {
- str_enc = rb_funcallv(str_enc, ID_to_s, 0, 0);
+ str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
} else {
str_enc = sys_enc;
}
@@ -460,7 +409,7 @@ ary2list(ary, enc_flag, self)
if (req_chk_flag) {
str_enc = rb_ivar_get(str_val, ID_at_enc);
if (!NIL_P(str_enc)) {
- str_enc = rb_funcallv(str_enc, ID_to_s, 0, 0);
+ str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
} else {
str_enc = sys_enc;
}
@@ -475,16 +424,16 @@ ary2list(ary, enc_flag, self)
if (RTEST(dst_enc) && !NIL_P(sys_enc)) {
for(idx = 0; idx < RARRAY_LEN(dst); idx++) {
- str_val = RARRAY_AREF(dst, idx);
+ str_val = RARRAY_PTR(dst)[idx];
if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
str_val = rb_funcall(self, ID_toUTF8, 1, str_val);
} else {
str_val = rb_funcall(cTclTkLib, ID_toUTF8, 1, str_val);
}
- RARRAY_ASET(dst, idx, str_val);
+ RARRAY_PTR(dst)[idx] = str_val;
}
val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
- if (RB_TYPE_P(dst_enc, T_STRING)) {
+ if (TYPE(dst_enc) == T_STRING) {
val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc);
rb_ivar_set(val, ID_at_enc, dst_enc);
} else {
@@ -508,27 +457,27 @@ ary2list2(ary, enc_flag, self)
volatile VALUE dst;
volatile VALUE sys_enc, dst_enc, str_enc;
- sys_enc = rb_funcallv(cTclTkLib, ID_encoding, 0, 0);
+ sys_enc = rb_funcall(cTclTkLib, ID_encoding, 0, 0);
if (NIL_P(sys_enc)) {
- sys_enc = rb_funcallv(cTclTkLib, ID_encoding_system, 0, 0);
- sys_enc = rb_funcallv(sys_enc, ID_to_s, 0, 0);
+ sys_enc = rb_funcall(cTclTkLib, ID_encoding_system, 0, 0);
+ sys_enc = rb_funcall(sys_enc, ID_to_s, 0, 0);
}
if (NIL_P(enc_flag)) {
dst_enc = sys_enc;
req_chk_flag = 1;
- } else if (enc_flag == Qtrue || enc_flag == Qfalse) {
+ } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) {
dst_enc = enc_flag;
req_chk_flag = 0;
} else {
- dst_enc = rb_funcallv(enc_flag, ID_to_s, 0, 0);
+ dst_enc = rb_funcall(enc_flag, ID_to_s, 0, 0);
req_chk_flag = 0;
}
size = RARRAY_LEN(ary);
dst = rb_ary_new2(size);
for(idx = 0; idx < RARRAY_LEN(ary); idx++) {
- val = RARRAY_AREF(ary, idx);
+ val = RARRAY_PTR(ary)[idx];
str_val = Qnil;
switch(TYPE(val)) {
case T_ARRAY:
@@ -555,7 +504,7 @@ ary2list2(ary, enc_flag, self)
if (req_chk_flag) {
str_enc = rb_ivar_get(str_val, ID_at_enc);
if (!NIL_P(str_enc)) {
- str_enc = rb_funcallv(str_enc, ID_to_s, 0, 0);
+ str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
} else {
str_enc = sys_enc;
}
@@ -569,16 +518,16 @@ ary2list2(ary, enc_flag, self)
if (RTEST(dst_enc) && !NIL_P(sys_enc)) {
for(idx = 0; idx < RARRAY_LEN(dst); idx++) {
- str_val = RARRAY_AREF(dst, idx);
+ str_val = RARRAY_PTR(dst)[idx];
if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
str_val = rb_funcall(self, ID_toUTF8, 1, str_val);
} else {
str_val = rb_funcall(cTclTkLib, ID_toUTF8, 1, str_val);
}
- RARRAY_ASET(dst, idx, str_val);
+ RARRAY_PTR(dst)[idx] = str_val;
}
val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
- if (RB_TYPE_P(dst_enc, T_STRING)) {
+ if (TYPE(dst_enc) == T_STRING) {
val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc);
rb_ivar_set(val, ID_at_enc, dst_enc);
} else {
@@ -594,7 +543,7 @@ static VALUE
key2keyname(key)
VALUE key;
{
- return rb_str_append(rb_str_new2("-"), rb_funcallv(key, ID_to_s, 0, 0));
+ return rb_str_append(rb_str_new2("-"), rb_funcall(key, ID_to_s, 0, 0));
}
static VALUE
@@ -603,7 +552,7 @@ assoc2kv(assoc, ary, self)
VALUE ary;
VALUE self;
{
- long i, len;
+ long i, j, len;
volatile VALUE pair;
volatile VALUE val;
volatile VALUE dst = rb_ary_new2(2 * RARRAY_LEN(assoc));
@@ -611,26 +560,28 @@ assoc2kv(assoc, ary, self)
len = RARRAY_LEN(assoc);
for(i = 0; i < len; i++) {
- pair = RARRAY_AREF(assoc, i);
- if (!RB_TYPE_P(pair, T_ARRAY)) {
+ pair = RARRAY_PTR(assoc)[i];
+ if (TYPE(pair) != T_ARRAY) {
rb_ary_push(dst, key2keyname(pair));
continue;
}
switch(RARRAY_LEN(assoc)) {
case 2:
- rb_ary_push(dst, RARRAY_AREF(pair, 2));
+ rb_ary_push(dst, RARRAY_PTR(pair)[2]);
case 1:
- rb_ary_push(dst, key2keyname(RARRAY_AREF(pair, 0)));
+ rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));
case 0:
continue;
default:
- rb_ary_push(dst, key2keyname(RARRAY_AREF(pair, 0)));
+ rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));
val = rb_ary_new2(RARRAY_LEN(pair) - 1);
- rb_ary_cat(val, RARRAY_CONST_PTR(pair) + 1, RARRAY_LEN(pair) - 1);
+ for(j = 1; j < RARRAY_LEN(pair); j++) {
+ rb_ary_push(val, RARRAY_PTR(pair)[j]);
+ }
rb_ary_push(dst, val);
}
@@ -649,7 +600,7 @@ assoc2kv_enc(assoc, ary, self)
VALUE ary;
VALUE self;
{
- long i, len;
+ long i, j, len;
volatile VALUE pair;
volatile VALUE val;
volatile VALUE dst = rb_ary_new2(2 * RARRAY_LEN(assoc));
@@ -657,26 +608,28 @@ assoc2kv_enc(assoc, ary, self)
len = RARRAY_LEN(assoc);
for(i = 0; i < len; i++) {
- pair = RARRAY_AREF(assoc, i);
- if (!RB_TYPE_P(pair, T_ARRAY)) {
+ pair = RARRAY_PTR(assoc)[i];
+ if (TYPE(pair) != T_ARRAY) {
rb_ary_push(dst, key2keyname(pair));
continue;
}
switch(RARRAY_LEN(assoc)) {
case 2:
- rb_ary_push(dst, get_eval_string_core(RARRAY_AREF(pair, 2), Qtrue, self));
+ rb_ary_push(dst, get_eval_string_core(RARRAY_PTR(pair)[2], Qtrue, self));
case 1:
- rb_ary_push(dst, key2keyname(RARRAY_AREF(pair, 0)));
+ rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));
case 0:
continue;
default:
- rb_ary_push(dst, key2keyname(RARRAY_AREF(pair, 0)));
+ rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));
val = rb_ary_new2(RARRAY_LEN(pair) - 1);
- rb_ary_cat(val, RARRAY_CONST_PTR(pair) + 1, RARRAY_LEN(pair) - 1);
+ for(j = 1; j < RARRAY_LEN(pair); j++) {
+ rb_ary_push(val, RARRAY_PTR(pair)[j]);
+ }
rb_ary_push(dst, get_eval_string_core(val, Qtrue, self));
}
@@ -697,7 +650,7 @@ push_kv(key, val, args)
{
volatile VALUE ary;
- ary = RARRAY_AREF(args, 0);
+ ary = RARRAY_PTR(args)[0];
#if 0
rb_ary_push(ary, key2keyname(key));
@@ -707,7 +660,7 @@ push_kv(key, val, args)
if (val == TK_None) return ST_CHECK;
- rb_ary_push(ary, get_eval_string_core(val, Qnil, RARRAY_AREF(args, 1)));
+ rb_ary_push(ary, get_eval_string_core(val, Qnil, RARRAY_PTR(args)[1]));
return ST_CHECK;
}
@@ -738,20 +691,20 @@ push_kv_enc(key, val, args)
{
volatile VALUE ary;
- ary = RARRAY_AREF(args, 0);
+ ary = RARRAY_PTR(args)[0];
#if 0
rb_ary_push(ary, key2keyname(key));
if (val != TK_None) {
rb_ary_push(ary, get_eval_string_core(val, Qtrue,
- RARRAY_AREF(args, 1)));
+ RARRAY_PTR(args)[1]));
}
#endif
rb_ary_push(ary, key2keyname(key));
if (val == TK_None) return ST_CHECK;
- rb_ary_push(ary, get_eval_string_core(val, Qtrue, RARRAY_AREF(args, 1)));
+ rb_ary_push(ary, get_eval_string_core(val, Qtrue, RARRAY_PTR(args)[1]));
return ST_CHECK;
}
@@ -804,7 +757,6 @@ tk_hash_kv(argc, argv, self)
switch(argc) {
case 3:
ary = argv[2];
- Check_Type(ary, T_ARRAY);
case 2:
enc_flag = argv[1];
case 1:
@@ -862,7 +814,7 @@ get_eval_string_core(obj, enc_flag, self)
case T_FLOAT:
case T_FIXNUM:
case T_BIGNUM:
- return rb_funcallv(obj, ID_to_s, 0, 0);
+ return rb_funcall(obj, ID_to_s, 0, 0);
case T_STRING:
if (RTEST(enc_flag)) {
@@ -879,12 +831,16 @@ get_eval_string_core(obj, enc_flag, self)
if (RTEST(enc_flag)) {
if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
return rb_funcall(self, ID_toUTF8, 1,
- rb_str_dup(rb_sym2str(obj)));
+ rb_str_new2(rb_id2name(SYM2ID(obj))));
} else {
- return fromDefaultEnc_toUTF8(rb_sym2str(obj), self);
+ return fromDefaultEnc_toUTF8(rb_str_new2(rb_id2name(SYM2ID(obj))), self);
}
} else {
- return rb_sym2str(obj);
+#ifdef HAVE_RB_SYM_TO_S
+ return rb_sym_to_s(obj);
+#else
+ return rb_str_new2(rb_id2name(SYM2ID(obj)));
+#endif
}
case T_HASH:
@@ -907,12 +863,12 @@ get_eval_string_core(obj, enc_flag, self)
return rb_str_new2("");
case T_REGEXP:
- return rb_funcallv(obj, ID_source, 0, 0);
+ return rb_funcall(obj, ID_source, 0, 0);
default:
if (rb_obj_is_kind_of(obj, cTkObject)) {
- /* return rb_str_new3(rb_funcallv(obj, ID_path, 0, 0)); */
- return get_eval_string_core(rb_funcallv(obj, ID_path, 0, 0),
+ /* return rb_str_new3(rb_funcall(obj, ID_path, 0, 0)); */
+ return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
enc_flag, self);
}
@@ -929,15 +885,15 @@ get_eval_string_core(obj, enc_flag, self)
if (obj == TK_None) return Qnil;
if (rb_obj_respond_to(obj, ID_to_eval, Qtrue)) {
- /* return rb_funcallv(obj, ID_to_eval, 0, 0); */
- return get_eval_string_core(rb_funcallv(obj, ID_to_eval, 0, 0),
+ /* return rb_funcall(obj, ID_to_eval, 0, 0); */
+ return get_eval_string_core(rb_funcall(obj, ID_to_eval, 0, 0),
enc_flag, self);
} else if (rb_obj_respond_to(obj, ID_path, Qtrue)) {
- /* return rb_funcallv(obj, ID_path, 0, 0); */
- return get_eval_string_core(rb_funcallv(obj, ID_path, 0, 0),
+ /* return rb_funcall(obj, ID_path, 0, 0); */
+ return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
enc_flag, self);
} else if (rb_obj_respond_to(obj, ID_to_s, Qtrue)) {
- return rb_funcallv(obj, ID_to_s, 0, 0);
+ return rb_funcall(obj, ID_to_s, 0, 0);
}
}
@@ -994,7 +950,7 @@ tk_conv_args(argc, argv, self)
old_gc = rb_gc_disable();
for(size = 0, idx = 2; idx < argc; idx++) {
- if (RB_TYPE_P(argv[idx], T_HASH)) {
+ if (TYPE(argv[idx]) == T_HASH) {
size += 2 * RHASH_SIZE(argv[idx]);
} else {
size++;
@@ -1003,7 +959,7 @@ tk_conv_args(argc, argv, self)
/* dst = rb_ary_new2(argc - 2); */
dst = rb_ary_new2(size);
for(idx = 2; idx < argc; idx++) {
- if (RB_TYPE_P(argv[idx], T_HASH)) {
+ if (TYPE(argv[idx]) == T_HASH) {
if (RTEST(argv[1])) {
hash2kv_enc(argv[idx], dst, self);
} else {
@@ -1028,7 +984,7 @@ tcl2rb_bool(self, value)
VALUE self;
VALUE value;
{
- if (RB_TYPE_P(value, T_FIXNUM)) {
+ if (TYPE(value) == T_FIXNUM) {
if (NUM2INT(value) == 0) {
return Qfalse;
} else {
@@ -1036,7 +992,7 @@ tcl2rb_bool(self, value)
}
}
- if (value == Qtrue || value == Qfalse) {
+ if (TYPE(value) == T_TRUE || TYPE(value) == T_FALSE) {
return value;
}
@@ -1212,23 +1168,6 @@ subst_free(ptr)
}
}
-static size_t
-subst_memsize(ptr)
- const struct cbsubst_info *ptr;
-{
- return sizeof(*ptr);
-}
-
-static const rb_data_type_t cbsubst_info_type = {
- "TkUtil/CallbackSubst/Info",
- {
- subst_mark,
- subst_free,
- subst_memsize,
- },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
-};
-
static VALUE
allocate_cbsubst_info(struct cbsubst_info **inf_ptr)
{
@@ -1236,8 +1175,7 @@ allocate_cbsubst_info(struct cbsubst_info **inf_ptr)
volatile VALUE proc, aliases;
int idx;
- VALUE info = TypedData_Make_Struct(cSUBST_INFO, struct cbsubst_info,
- &cbsubst_info_type, inf);
+ inf = ALLOC(struct cbsubst_info);
inf->full_subst_length = 0;
@@ -1256,23 +1194,16 @@ allocate_cbsubst_info(struct cbsubst_info **inf_ptr)
if (inf_ptr != (struct cbsubst_info **)NULL) *inf_ptr = inf;
- return info;
+ return Data_Wrap_Struct(cSUBST_INFO, subst_mark, subst_free, inf);
}
static void
-cbsubst_init(void)
+cbsubst_init()
{
rb_const_set(cCB_SUBST, ID_SUBST_INFO,
allocate_cbsubst_info((struct cbsubst_info **)NULL));
}
-static struct cbsubst_info *
-cbsubst_get_ptr(klass)
- VALUE klass;
-{
- return rb_check_typeddata(rb_const_get(klass, ID_SUBST_INFO), &cbsubst_info_type);
-}
-
static VALUE
cbsubst_initialize(argc, argv, self)
int argc;
@@ -1282,9 +1213,10 @@ cbsubst_initialize(argc, argv, self)
struct cbsubst_info *inf;
int idx, iv_idx;
- inf = cbsubst_get_ptr(rb_obj_class(self));
+ Data_Get_Struct(rb_const_get(rb_obj_class(self), ID_SUBST_INFO),
+ struct cbsubst_info, inf);
- idx = 0;
+ idx = 0;
for(iv_idx = 0; iv_idx < CBSUBST_TBL_MAX; iv_idx++) {
if ( inf->ivar[iv_idx] == (ID) 0 ) continue;
rb_ivar_set(self, inf->ivar[iv_idx], argv[idx++]);
@@ -1349,11 +1281,12 @@ cbsubst_def_attr_aliases(self, tbl)
{
struct cbsubst_info *inf;
- if (!RB_TYPE_P(tbl, T_HASH)) {
+ if (TYPE(tbl) != T_HASH) {
rb_raise(rb_eArgError, "expected a Hash");
}
- inf = cbsubst_get_ptr(self);
+ Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
+ struct cbsubst_info, inf);
rb_hash_foreach(tbl, each_attr_def, self);
@@ -1361,57 +1294,27 @@ cbsubst_def_attr_aliases(self, tbl)
}
static VALUE
-cbsubst_append_inf_key(str, inf, idx)
- VALUE str;
- const struct cbsubst_info *inf;
- int idx;
-{
- const long len = inf->keylen[idx];
- const long olen = RSTRING_LEN(str);
- char *buf, *ptr;
-
- rb_str_modify_expand(str, (len ? len : 1) + 2);
- buf = RSTRING_PTR(str);
- ptr = buf + olen;
-
- *(ptr++) = '%';
-
- if (len != 0) {
- /* longname */
- strncpy(ptr, inf->key[idx], len);
- ptr += len;
- }
- else {
- /* single char */
- *(ptr++) = (unsigned char)idx;
- }
-
- *(ptr++) = ' ';
-
- rb_str_set_len(str, ptr - buf);
-
- return str;
-}
-
-static VALUE
cbsubst_sym_to_subst(self, sym)
VALUE self;
VALUE sym;
{
struct cbsubst_info *inf;
VALUE str;
+ char *buf, *ptr;
int idx;
+ long len;
ID id;
volatile VALUE ret;
- if (!RB_TYPE_P(sym, T_SYMBOL)) return sym;
+ if (TYPE(sym) != T_SYMBOL) return sym;
- inf = cbsubst_get_ptr(self);
+ Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
+ struct cbsubst_info, inf);
if (!NIL_P(ret = rb_hash_aref(inf->aliases, sym))) {
- str = rb_sym2str(ret);
+ str = rb_id2str(SYM2ID(ret));
} else {
- str = rb_sym2str(sym);
+ str = rb_id2str(SYM2ID(sym));
}
id = rb_intern_str(rb_sprintf("@%"PRIsVALUE, str));
@@ -1421,7 +1324,27 @@ cbsubst_sym_to_subst(self, sym)
}
if (idx >= CBSUBST_TBL_MAX) return sym;
- return cbsubst_append_inf_key(rb_str_new(0, 0), inf, idx);
+ ptr = buf = ALLOC_N(char, inf->full_subst_length + 1);
+
+ *(ptr++) = '%';
+
+ if (len = inf->keylen[idx]) {
+ /* longname */
+ strncpy(ptr, inf->key[idx], len);
+ ptr += len;
+ } else {
+ /* single char */
+ *(ptr++) = (unsigned char)idx;
+ }
+
+ *(ptr++) = ' ';
+ *(ptr++) = '\0';
+
+ ret = rb_str_new2(buf);
+
+ xfree(buf);
+
+ return ret;
}
static VALUE
@@ -1432,48 +1355,65 @@ cbsubst_get_subst_arg(argc, argv, self)
{
struct cbsubst_info *inf;
VALUE str;
+ char *buf, *ptr;
int i, idx;
+ long len;
ID id;
- VALUE arg_sym, ret, result;
+ volatile VALUE arg_sym, ret;
- inf = cbsubst_get_ptr(self);
+ Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
+ struct cbsubst_info, inf);
+
+ ptr = buf = ALLOC_N(char, inf->full_subst_length + 1);
- result = rb_str_new(0, 0);
for(i = 0; i < argc; i++) {
switch(TYPE(argv[i])) {
case T_STRING:
str = argv[i];
- arg_sym = rb_check_symbol(&str);
- if (NIL_P(arg_sym)) goto not_found;
+ arg_sym = ID2SYM(rb_intern_str(argv[i]));
break;
case T_SYMBOL:
arg_sym = argv[i];
- str = rb_sym2str(arg_sym);
+ str = rb_id2str(SYM2ID(arg_sym));
break;
default:
rb_raise(rb_eArgError, "arg #%d is not a String or a Symbol", i);
}
if (!NIL_P(ret = rb_hash_aref(inf->aliases, arg_sym))) {
- str = rb_sym2str(ret);
+ str = rb_id2str(SYM2ID(ret));
}
- ret = rb_sprintf("@%"PRIsVALUE, str);
- id = rb_check_id(&ret);
- if (!id) goto not_found;
+ id = rb_intern_str(rb_sprintf("@%"PRIsVALUE, str));
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
if (inf->ivar[idx] == id) break;
}
if (idx >= CBSUBST_TBL_MAX) {
- not_found:
rb_raise(rb_eArgError, "cannot find attribute :%"PRIsVALUE, str);
}
- result = cbsubst_append_inf_key(result, inf, idx);
+ *(ptr++) = '%';
+
+ if (len = inf->keylen[idx]) {
+ /* longname */
+ strncpy(ptr, inf->key[idx], len);
+ ptr += len;
+ } else {
+ /* single char */
+ *(ptr++) = (unsigned char)idx;
+ }
+
+ *(ptr++) = ' ';
}
- return result;
+ *ptr = '\0';
+
+ ret = rb_str_new2(buf);
+
+ xfree(buf);
+
+ return ret;
}
static VALUE
@@ -1482,24 +1422,24 @@ cbsubst_get_subst_key(self, str)
VALUE str;
{
struct cbsubst_info *inf;
- VALUE list;
- VALUE ret;
+ volatile VALUE list;
+ volatile VALUE ret;
+ VALUE keyval;
long i, len, keylen;
int idx;
- char *buf, *ptr;
+ char *buf, *ptr, *key;
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
- Check_Type(list, T_ARRAY);
len = RARRAY_LEN(list);
- inf = cbsubst_get_ptr(self);
+ Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
+ struct cbsubst_info, inf);
- ret = rb_str_new(0, len);
- ptr = buf = RSTRING_PTR(ret);
+ ptr = buf = ALLOC_N(char, inf->full_subst_length + len + 1);
for(i = 0; i < len; i++) {
- VALUE keyval = RARRAY_AREF(list, i);
- const char *key = (Check_Type(keyval, T_STRING), StringValueCStr(keyval));
+ keyval = RARRAY_PTR(list)[i];
+ key = RSTRING_PTR(keyval);
if (*key == '%') {
if (*(key + 2) == '\0') {
/* single char */
@@ -1523,8 +1463,10 @@ cbsubst_get_subst_key(self, str)
*(ptr++) = ' ';
}
}
+ *ptr = '\0';
- rb_str_set_len(ret, ptr - buf);
+ ret = rb_str_new2(buf);
+ xfree(buf);
return ret;
}
@@ -1533,26 +1475,46 @@ cbsubst_get_all_subst_keys(self)
VALUE self;
{
struct cbsubst_info *inf;
+ char *buf, *ptr;
char *keys_buf, *keys_ptr;
int idx;
- VALUE str, keys_str;
+ long len;
+ volatile VALUE ret;
- inf = cbsubst_get_ptr(self);
+ Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
+ struct cbsubst_info, inf);
- str = rb_str_new(0, 0);
- keys_str = rb_str_new(0, CBSUBST_TBL_MAX);
- keys_ptr = keys_buf = RSTRING_PTR(keys_str);
+ ptr = buf = ALLOC_N(char, inf->full_subst_length + 1);
+ keys_ptr = keys_buf = ALLOC_N(char, CBSUBST_TBL_MAX + 1);
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
if (inf->ivar[idx] == (ID) 0) continue;
*(keys_ptr++) = (unsigned char)idx;
- str = cbsubst_append_inf_key(str, inf, idx);
+ *(ptr++) = '%';
+
+ if (len = inf->keylen[idx]) {
+ /* longname */
+ strncpy(ptr, inf->key[idx], len);
+ ptr += len;
+ } else {
+ /* single char */
+ *(ptr++) = (unsigned char)idx;
+ }
+
+ *(ptr++) = ' ';
}
- rb_str_set_len(keys_str, keys_ptr - keys_buf);
- return rb_ary_new3(2, keys_str, str);
+ *ptr = '\0';
+ *keys_ptr = '\0';
+
+ ret = rb_ary_new3(2, rb_str_new2(keys_buf), rb_str_new2(buf));
+
+ xfree(buf);
+ xfree(keys_buf);
+
+ return ret;
}
static VALUE
@@ -1565,11 +1527,10 @@ cbsubst_table_setup(argc, argv, self)
volatile VALUE key_inf;
volatile VALUE longkey_inf;
volatile VALUE proc_inf;
- VALUE inf, subst, name, type, ivar, proc;
- const VALUE *infp;
+ VALUE inf;
ID id;
struct cbsubst_info *subst_inf;
- long idx;
+ long idx, len;
unsigned char chr;
/* accept (key_inf, proc_inf) or (key_inf, longkey_inf, procinf) */
@@ -1577,9 +1538,6 @@ cbsubst_table_setup(argc, argv, self)
proc_inf = longkey_inf;
longkey_inf = rb_ary_new();
}
- Check_Type(key_inf, T_ARRAY);
- Check_Type(longkey_inf, T_ARRAY);
- Check_Type(proc_inf, T_ARRAY);
/* check the number of longkeys */
if (RARRAY_LEN(longkey_inf) > 125 /* from 0x80 to 0xFD */) {
@@ -1595,21 +1553,25 @@ cbsubst_table_setup(argc, argv, self)
* type ==> char code or string
* ivar ==> symbol
*/
- for(idx = 0; idx < RARRAY_LEN(key_inf); idx++) {
- inf = RARRAY_AREF(key_inf, idx);
- if (!RB_TYPE_P(inf, T_ARRAY)) continue;
- if (RARRAY_LEN(inf) < 3) continue;
- infp = RARRAY_CONST_PTR(inf);
- subst = infp[0];
- type = infp[1];
- ivar = infp[2];
-
- chr = NUM2CHR(subst);
- subst_inf->type[chr] = NUM2CHR(type);
+ len = RARRAY_LEN(key_inf);
+ for(idx = 0; idx < len; idx++) {
+ inf = RARRAY_PTR(key_inf)[idx];
+ if (TYPE(inf) != T_ARRAY) continue;
+
+ if (TYPE(RARRAY_PTR(inf)[0]) == T_STRING) {
+ chr = *(RSTRING_PTR(RARRAY_PTR(inf)[0]));
+ } else {
+ chr = NUM2CHR(RARRAY_PTR(inf)[0]);
+ }
+ if (TYPE(RARRAY_PTR(inf)[1]) == T_STRING) {
+ subst_inf->type[chr] = *(RSTRING_PTR(RARRAY_PTR(inf)[1]));
+ } else {
+ subst_inf->type[chr] = NUM2CHR(RARRAY_PTR(inf)[1]);
+ }
subst_inf->full_subst_length += 3;
- id = SYM2ID(ivar);
+ id = SYM2ID(RARRAY_PTR(inf)[2]);
subst_inf->ivar[chr] = rb_intern_str(rb_sprintf("@%"PRIsVALUE, rb_id2str(id)));
rb_attr(self, id, 1, 0, Qtrue);
@@ -1622,25 +1584,33 @@ cbsubst_table_setup(argc, argv, self)
* type ==> char code or string
* ivar ==> symbol
*/
- for(idx = 0; idx < RARRAY_LEN(longkey_inf); idx++) {
- inf = RARRAY_AREF(longkey_inf, idx);
- if (!RB_TYPE_P(inf, T_ARRAY)) continue;
- if (RARRAY_LEN(inf) < 3) continue;
- infp = RARRAY_CONST_PTR(inf);
- name = infp[0];
- type = infp[1];
- ivar = infp[2];
-
- Check_Type(name, T_STRING);
+ len = RARRAY_LEN(longkey_inf);
+ for(idx = 0; idx < len; idx++) {
+ inf = RARRAY_PTR(longkey_inf)[idx];
+ if (TYPE(inf) != T_ARRAY) continue;
+
chr = (unsigned char)(0x80 + idx);
- subst_inf->keylen[chr] = RSTRING_LEN(name);
- subst_inf->key[chr] = strndup(RSTRING_PTR(name),
- RSTRING_LEN(name));
- subst_inf->type[chr] = NUM2CHR(type);
+ subst_inf->keylen[chr] = RSTRING_LEN(RARRAY_PTR(inf)[0]);
+#if HAVE_STRNDUP
+ subst_inf->key[chr] = strndup(RSTRING_PTR(RARRAY_PTR(inf)[0]),
+ RSTRING_LEN(RARRAY_PTR(inf)[0]));
+#else
+ subst_inf->key[chr] = malloc(RSTRING_LEN(RARRAY_PTR(inf)[0]) + 1);
+ if (subst_inf->key[chr]) {
+ strncpy(subst_inf->key[chr], RSTRING_PTR(RARRAY_PTR(inf)[0]),
+ RSTRING_LEN(RARRAY_PTR(inf)[0]) + 1);
+ subst_inf->key[chr][RSTRING_LEN(RARRAY_PTR(inf)[0])] = '\0';
+ }
+#endif
+ if (TYPE(RARRAY_PTR(inf)[1]) == T_STRING) {
+ subst_inf->type[chr] = *(RSTRING_PTR(RARRAY_PTR(inf)[1]));
+ } else {
+ subst_inf->type[chr] = NUM2CHR(RARRAY_PTR(inf)[1]);
+ }
subst_inf->full_subst_length += (subst_inf->keylen[chr] + 2);
- id = SYM2ID(ivar);
+ id = SYM2ID(RARRAY_PTR(inf)[2]);
subst_inf->ivar[chr] = rb_intern_str(rb_sprintf("@%"PRIsVALUE, rb_id2str(id)));
rb_attr(self, id, 1, 0, Qtrue);
@@ -1651,15 +1621,15 @@ cbsubst_table_setup(argc, argv, self)
* type ==> char code or string
* proc ==> proc/method/obj (must respond to 'call')
*/
- for(idx = 0; idx < RARRAY_LEN(proc_inf); idx++) {
- inf = RARRAY_AREF(proc_inf, idx);
- if (!RB_TYPE_P(inf, T_ARRAY)) continue;
- if (RARRAY_LEN(inf) < 2) continue;
- type = rb_ary_entry(inf, 0);
- proc = rb_ary_entry(inf, 1);
- if (RB_TYPE_P(type, T_STRING))
- type = INT2FIX(*(RSTRING_PTR(type)));
- rb_hash_aset(subst_inf->proc, type, proc);
+ len = RARRAY_LEN(proc_inf);
+ for(idx = 0; idx < len; idx++) {
+ inf = RARRAY_PTR(proc_inf)[idx];
+ if (TYPE(inf) != T_ARRAY) continue;
+ rb_hash_aset(subst_inf->proc,
+ ((TYPE(RARRAY_PTR(inf)[0]) == T_STRING)?
+ INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) :
+ RARRAY_PTR(inf)[0]),
+ RARRAY_PTR(inf)[1]);
}
rb_const_set(self, ID_SUBST_INFO, cbsubst_obj);
@@ -1682,9 +1652,9 @@ cbsubst_scan_args(self, arg_key, val_ary)
{
struct cbsubst_info *inf;
long idx;
- unsigned char *keyptr = (unsigned char*)StringValueCStr(arg_key);
+ unsigned char *keyptr = (unsigned char*)RSTRING_PTR(arg_key);
long keylen = RSTRING_LEN(arg_key);
- long vallen = (Check_Type(val_ary, T_ARRAY), RARRAY_LEN(val_ary));
+ long vallen = RARRAY_LEN(val_ary);
unsigned char type_chr;
volatile VALUE dst = rb_ary_new2(vallen);
volatile VALUE proc;
@@ -1696,7 +1666,8 @@ cbsubst_scan_args(self, arg_key, val_ary)
old_gc = rb_gc_disable();
- inf = cbsubst_get_ptr(self);
+ Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
+ struct cbsubst_info, inf);
for(idx = 0; idx < vallen; idx++) {
if (idx >= keylen) {
@@ -1704,7 +1675,7 @@ cbsubst_scan_args(self, arg_key, val_ary)
} else if (*(keyptr + idx) == ' ') {
proc = Qnil;
} else {
- if ((type_chr = inf->type[*(keyptr + idx)]) != 0) {
+ if (type_chr = inf->type[*(keyptr + idx)]) {
proc = rb_hash_aref(inf->proc, INT2FIX((int)type_chr));
} else {
proc = Qnil;
@@ -1712,10 +1683,10 @@ cbsubst_scan_args(self, arg_key, val_ary)
}
if (NIL_P(proc)) {
- rb_ary_push(dst, RARRAY_AREF(val_ary, idx));
+ rb_ary_push(dst, RARRAY_PTR(val_ary)[idx]);
} else {
rb_ary_push(dst, rb_funcall(proc, ID_call, 1,
- RARRAY_AREF(val_ary, idx)));
+ RARRAY_PTR(val_ary)[idx]));
}
}
@@ -1763,7 +1734,7 @@ tkobj_path(self)
const char tkutil_release_date[] = TKUTIL_RELEASE_DATE;
void
-Init_tkutil(void)
+Init_tkutil()
{
VALUE cTK = rb_define_class("TkKernel", rb_cObject);
VALUE mTK = rb_define_module("TkUtil");
diff --git a/ext/win32/extconf.rb b/ext/win32/extconf.rb
index 9952274e29..7aa2c93684 100644
--- a/ext/win32/extconf.rb
+++ b/ext/win32/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
-if compiled?('fiddle') and $mswin||$mingw||$cygwin
+if (compiled?('dl') or compiled?('fiddle')) and $mswin||$mingw||$cygwin
create_makefile('win32')
end
diff --git a/ext/win32/lib/Win32API.rb b/ext/win32/lib/Win32API.rb
index 43db7db67b..4d7d4887a5 100644
--- a/ext/win32/lib/Win32API.rb
+++ b/ext/win32/lib/Win32API.rb
@@ -1,26 +1,19 @@
-# frozen_string_literal: false
# -*- ruby -*-
# for backward compatibility
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead" if $VERBOSE
+warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: Win32API is deprecated after Ruby 1.9.1; use dl directly instead" if $VERBOSE
-require 'fiddle/import'
+require 'dl'
class Win32API
DLL = {}
- TYPEMAP = {"0" => Fiddle::TYPE_VOID, "S" => Fiddle::TYPE_VOIDP, "I" => Fiddle::TYPE_LONG}
- POINTER_TYPE = Fiddle::SIZEOF_VOIDP == Fiddle::SIZEOF_LONG_LONG ? 'q*' : 'l!*'
+ TYPEMAP = {"0" => DL::TYPE_VOID, "S" => DL::TYPE_VOIDP, "I" => DL::TYPE_LONG}
+ POINTER_TYPE = DL::SIZEOF_VOIDP == DL::SIZEOF_LONG_LONG ? 'q*' : 'l!*'
def initialize(dllname, func, import, export = "0", calltype = :stdcall)
@proto = [import].join.tr("VPpNnLlIi", "0SSI").sub(/^(.)0*$/, '\1')
- handle = DLL[dllname] ||= Fiddle.dlopen(dllname)
-
- @func = Fiddle::Function.new(
- handle[func],
- @proto.chars.map { |win_type| TYPEMAP[win_type.tr("VPpNnLlIi", "0SSI")] },
- TYPEMAP[export.tr("VPpNnLlIi", "0SSI")],
- Fiddle::Importer.const_get(:CALL_TYPE_TO_ABI)[calltype]
- )
- rescue Fiddle::DLError => e
+ handle = DLL[dllname] ||= DL.dlopen(dllname)
+ @func = DL::CFunc.new(handle[func], TYPEMAP[export.tr("VPpNnLlIi", "0SSI")], func, calltype)
+ rescue DL::DLError => e
raise LoadError, e.message, e.backtrace
end
@@ -30,7 +23,7 @@ class Win32API
args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
end
- ret, = @func.call(*args)
+ ret, = @func.call(args)
return ret || 0
end
diff --git a/ext/win32/lib/win32/importer.rb b/ext/win32/lib/win32/importer.rb
index 2bef016c29..5936bb6900 100644
--- a/ext/win32/lib/win32/importer.rb
+++ b/ext/win32/lib/win32/importer.rb
@@ -1,9 +1,14 @@
-# frozen_string_literal: false
-require 'fiddle/import'
+begin
+ require 'fiddle/import'
+ importer = Fiddle::Importer
+rescue LoadError
+ require 'dl/import'
+ importer = DL::Importer
+end
module Win32
end
Win32.module_eval do
- Importer = Fiddle::Importer
+ Importer = importer
end
diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb
index a88d7e63d0..74cc77dc9f 100644
--- a/ext/win32/lib/win32/registry.rb
+++ b/ext/win32/lib/win32/registry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32/importer'
module Win32
@@ -67,7 +66,6 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
WCHAR = Encoding::UTF_16LE
WCHAR_NUL = "\0".encode(WCHAR).freeze
- WCHAR_CR = "\r".encode(WCHAR).freeze
WCHAR_SIZE = WCHAR_NUL.bytesize
LOCALE = Encoding.find(Encoding.locale_charmap)
@@ -175,20 +173,10 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
FormatMessageW = Kernel32.extern "int FormatMessageW(int, void *, int, int, void *, int, void *)", :stdcall
def initialize(code)
@code = code
- buff = WCHAR_NUL * 1024
- lang = 0
- begin
- len = FormatMessageW.call(0x1200, 0, code, lang, buff, 1024, 0)
- msg = buff.byteslice(0, len * WCHAR_SIZE)
- msg.delete!(WCHAR_CR)
- msg.chomp!
- msg.encode!(LOCALE)
- rescue EncodingError
- raise unless lang == 0
- lang = 0x0409 # en_US
- retry
- end
- super msg
+ msg = WCHAR_NUL * 1024
+ len = FormatMessageW.call(0x1200, 0, code, 0, msg, 1024, 0)
+ msg = msg[0, len].encode(LOCALE)
+ super msg.tr("\r".encode(msg.encoding), '').chomp
end
attr_reader :code
end
@@ -234,8 +222,8 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
"long RegEnumKeyExW(void *, long, void *, void *, void *, void *, void *, void *)",
"long RegQueryValueExW(void *, void *, void *, void *, void *, void *)",
"long RegSetValueExW(void *, void *, long, long, void *, long)",
- "long RegDeleteValueW(void *, void *)",
- "long RegDeleteKeyW(void *, void *)",
+ "long RegDeleteValue(void *, void *)",
+ "long RegDeleteKey(void *, void *)",
"long RegFlushKey(void *)",
"long RegCloseKey(void *)",
"long RegQueryInfoKey(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)",
@@ -302,7 +290,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
name = WCHAR_NUL * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
check RegEnumValueW.call(hkey, index, name, size, 0, 0, 0, 0)
- name.byteslice(0, unpackdw(size) * WCHAR_SIZE)
+ name[0, unpackdw(size)]
end
def EnumKey(hkey, index)
@@ -310,7 +298,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
size = packdw(Constants::MAX_KEY_LENGTH)
wtime = ' ' * 8
check RegEnumKeyExW.call(hkey, index, name, size, 0, 0, 0, wtime)
- [ name.byteslice(0, unpackdw(size) * WCHAR_SIZE), unpackqw(wtime) ]
+ [ name[0, unpackdw(size)], unpackqw(wtime) ]
end
def QueryValue(hkey, name)
@@ -327,17 +315,17 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
case type
when REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ
data = data.encode(WCHAR)
- size ||= data.bytesize + WCHAR_SIZE
+ size ||= data.size + 1
end
check RegSetValueExW.call(hkey, make_wstr(name), 0, type, data, size)
end
def DeleteValue(hkey, name)
- check RegDeleteValueW.call(hkey, make_wstr(name))
+ check RegDeleteValue.call(hkey, make_wstr(name))
end
def DeleteKey(hkey, name)
- check RegDeleteKeyW.call(hkey, make_wstr(name))
+ check RegDeleteKey.call(hkey, make_wstr(name))
end
def FlushKey(hkey)
@@ -378,16 +366,15 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
}
end
- @@type2name = %w[
+ @@type2name = { }
+ %w[
REG_NONE REG_SZ REG_EXPAND_SZ REG_BINARY REG_DWORD
REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ
REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR
REG_RESOURCE_REQUIREMENTS_LIST REG_QWORD
- ].inject([]) do |ary, type|
- type.freeze
- ary[Constants.const_get(type)] = type
- ary
- end.freeze
+ ].each do |type|
+ @@type2name[Constants.const_get(type)] = type
+ end
#
# Convert registry type value to readable string.
@@ -643,9 +630,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
def read(name, *rtype)
type, data = API.QueryValue(@hkey, name)
unless rtype.empty? or rtype.include?(type)
- raise TypeError, "Type mismatch (expect [#{
- rtype.map{|t|Registry.type2name(t)}.join(', ')}] but #{
- Registry.type2name(type)} present)"
+ raise TypeError, "Type mismatch (expect #{rtype.inspect} but #{type} present)"
end
case type
when REG_SZ, REG_EXPAND_SZ
@@ -661,7 +646,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
when REG_QWORD
[ type, API.unpackqw(data) ]
else
- raise TypeError, "Type #{Registry.type2name(type)} is not supported."
+ raise TypeError, "Type #{type} is not supported."
end
end
@@ -684,7 +669,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
when REG_EXPAND_SZ
Registry.expand_environ(data)
else
- raise TypeError, "Type #{Registry.type2name(type)} is not supported."
+ raise TypeError, "Type #{type} is not supported."
end
end
@@ -757,7 +742,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
when REG_QWORD
data = API.packqw(data.to_i)
else
- raise TypeError, "Unsupported type #{Registry.type2name(type)}"
+ raise TypeError, "Unsupported type #{type}"
end
API.SetValue(@hkey, name, type, data, data.bytesize + termsize)
end
diff --git a/ext/win32/lib/win32/resolv.rb b/ext/win32/lib/win32/resolv.rb
index d71ed98f78..b5c11bf878 100644
--- a/ext/win32/lib/win32/resolv.rb
+++ b/ext/win32/lib/win32/resolv.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
=begin
= Win32 DNS and DHCP I/F
@@ -46,21 +45,6 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
# Windows NT
#====================================================================
module_eval <<-'__EOS__', __FILE__, __LINE__+1
- module SZ
- refine Registry do
- # ad hoc workaround for broken registry
- def read_s(key)
- type, str = read(key)
- unless type == Registry::REG_SZ
- warn "Broken registry, #{name}\\#{key} was #{Registry.type2name(type)}, ignored"
- return String.new
- end
- str
- end
- end
- end
- using SZ
-
TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'
class << self
diff --git a/ext/win32/lib/win32/sspi.rb b/ext/win32/lib/win32/sspi.rb
index 20441b389c..4645e1b306 100644
--- a/ext/win32/lib/win32/sspi.rb
+++ b/ext/win32/lib/win32/sspi.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = win32/sspi.rb
#
diff --git a/ext/win32ole/depend b/ext/win32ole/depend
index c8445ad5fa..3b1d7e9a97 100644
--- a/ext/win32ole/depend
+++ b/ext/win32ole/depend
@@ -1,12 +1 @@
-WIN32OLE_HEADERS = $(HDRS) $(ruby_headers)
-win32ole.o : win32ole.c $(WIN32OLE_HEADERS)
-win32ole_variant_m.o : win32ole_variant_m.c $(WIN32OLE_HEADERS)
-win32ole_typelib.o : win32ole_typelib.c $(WIN32OLE_HEADERS)
-win32ole_type.o : win32ole_type.c $(WIN32OLE_HEADERS)
-win32ole_variable.o : win32ole_variable.c $(WIN32OLE_HEADERS)
-win32ole_method.o : win32ole_method.c $(WIN32OLE_HEADERS)
-win32ole_param.o : win32ole_param.c $(WIN32OLE_HEADERS)
-win32ole_variant.o : win32ole_variant.c $(WIN32OLE_HEADERS)
-win32ole_event.o : win32ole_event.c $(WIN32OLE_HEADERS)
-win32ole_record.o : win32ole_record.c $(WIN32OLE_HEADERS)
-win32ole_error.o : win32ole_error.c $(WIN32OLE_HEADERS)
+win32ole.o : win32ole.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb
index d2044663a9..52c3d6bdfb 100644
--- a/ext/win32ole/extconf.rb
+++ b/ext/win32ole/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#----------------------------------
# extconf.rb
# $Revision$
diff --git a/ext/win32ole/lib/win32ole/property.rb b/ext/win32ole/lib/win32ole/property.rb
index fea047cd19..a68bad9af8 100644
--- a/ext/win32ole/lib/win32ole/property.rb
+++ b/ext/win32ole/lib/win32ole/property.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# OLEProperty
# helper class of Property with arguments.
class OLEProperty
diff --git a/ext/win32ole/sample/excel1.rb b/ext/win32ole/sample/excel1.rb
index c16c753ccc..c8cd38e732 100644
--- a/ext/win32ole/sample/excel1.rb
+++ b/ext/win32ole/sample/excel1.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32ole'
application = WIN32OLE.new('Excel.Application')
@@ -28,10 +27,7 @@ range.Select
chart = workbook.Charts.Add;
workbook.saved = TRUE;
-
-print "Now quit Excel... Please enter."
-gets
-
+sleep 0.5
application.ActiveWorkbook.Close(0);
application.Quit();
diff --git a/ext/win32ole/sample/excel2.rb b/ext/win32ole/sample/excel2.rb
index 8c4773daba..dbe4178051 100644
--- a/ext/win32ole/sample/excel2.rb
+++ b/ext/win32ole/sample/excel2.rb
@@ -1,13 +1,14 @@
-# frozen_string_literal: false
require 'win32ole'
# -4100 is the value for the Excel constant xl3DColumn.
ChartTypeVal = -4100;
# Creates OLE object to Excel
+#excel = WIN32OLE.new("excel.application.5")
excel = WIN32OLE.new("excel.application")
# Create and rotate the chart
+
excel.visible = TRUE;
excel.Workbooks.Add();
excel.Range("a1").value = 3;
@@ -17,15 +18,13 @@ excel.Range("a1:a3").Select();
excelchart = excel.Charts.Add();
excelchart.type = ChartTypeVal;
-i = 0
+i = 30
i.step(180, 10) do |rot|
+# excelchart['Rotation'] = rot;
excelchart.rotation=rot;
- sleep 0.1
end
# Done, bye
-print "Now quit Excel... Please enter."
-gets
-
excel.ActiveWorkbook.Close(0);
excel.Quit();
+
diff --git a/ext/win32ole/sample/excel3.rb b/ext/win32ole/sample/excel3.rb
index d66023c2b6..0f96717063 100644
--- a/ext/win32ole/sample/excel3.rb
+++ b/ext/win32ole/sample/excel3.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32ole'
#application = WIN32OLE.new('Excel.Application.5')
@@ -12,10 +11,3 @@ puts "The number of sheets is #{sheetS.count}"
puts "Now add 2 sheets after of `#{sheet.name}`"
sheetS.add({'count'=>2, 'after'=>sheet})
puts "The number of sheets is #{sheetS.count}"
-
-print "Now quit Excel... Please enter."
-gets
-
-application.ActiveWorkbook.Close(0);
-application.Quit();
-
diff --git a/ext/win32ole/sample/ie.rb b/ext/win32ole/sample/ie.rb
index dad29b08c8..11dc861e0b 100644
--- a/ext/win32ole/sample/ie.rb
+++ b/ext/win32ole/sample/ie.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32ole'
url = 'http://www.ruby-lang.org/'
ie = WIN32OLE.new('InternetExplorer.Application')
diff --git a/ext/win32ole/sample/ieconst.rb b/ext/win32ole/sample/ieconst.rb
index 363a4f8153..2c6a7a383c 100644
--- a/ext/win32ole/sample/ieconst.rb
+++ b/ext/win32ole/sample/ieconst.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32ole'
ie = WIN32OLE.new('InternetExplorer.Application')
diff --git a/ext/win32ole/sample/ienavi.rb b/ext/win32ole/sample/ienavi.rb
index 526ef0a5a8..8b279ddaae 100644
--- a/ext/win32ole/sample/ienavi.rb
+++ b/ext/win32ole/sample/ienavi.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32ole'
$urls = []
diff --git a/ext/win32ole/sample/ienavi2.rb b/ext/win32ole/sample/ienavi2.rb
index 3248393077..67977e28ab 100644
--- a/ext/win32ole/sample/ienavi2.rb
+++ b/ext/win32ole/sample/ienavi2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'win32ole'
class IEHandler
diff --git a/ext/win32ole/sample/oledirs.rb b/ext/win32ole/sample/oledirs.rb
index e52a0fd7ac..dbacc2131d 100644
--- a/ext/win32ole/sample/oledirs.rb
+++ b/ext/win32ole/sample/oledirs.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# You need WSH(Windows Scripting Host) to run this script.
#
diff --git a/ext/win32ole/sample/olegen.rb b/ext/win32ole/sample/olegen.rb
index 4b088a774f..4ec576ca50 100644
--- a/ext/win32ole/sample/olegen.rb
+++ b/ext/win32ole/sample/olegen.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#-----------------------------
# olegen.rb
# $Revision$
@@ -9,7 +8,7 @@ require 'win32ole'
class WIN32COMGen
def initialize(typelib)
@typelib = typelib
- @receiver = ""
+ @reciever = ""
end
attr_reader :typelib
@@ -88,7 +87,7 @@ class WIN32COMGen
end
def generate_method_body(method, disptype, types=nil)
- " ret = #{@receiver}#{disptype}(#{method.dispid}, [" +
+ " ret = #{@reciever}#{disptype}(#{method.dispid}, [" +
generate_args(method).gsub("=nil", "") +
"], [" +
generate_argtypes(method, types) +
@@ -304,10 +303,10 @@ STR
if klass.ole_type == "Class" &&
klass.guid &&
klass.progid
- @receiver = "@dispatch."
+ @reciever = "@dispatch."
define_class(klass, io)
else
- @receiver = ""
+ @reciever = ""
define_module(klass, io)
end
generate_constants(klass, io)
diff --git a/ext/win32ole/sample/xml.rb b/ext/win32ole/sample/xml.rb
index 36c3db32ef..4b1a54dc75 100644
--- a/ext/win32ole/sample/xml.rb
+++ b/ext/win32ole/sample/xml.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# This file created by olegen.rb as following.
# ruby olegen.rb 'Microsoft XML, version 2.0' > xml.rb
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index ac3c2a6a73..45bd923057 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -15,7 +15,87 @@
modified for win32ole (ruby) by Masaki.Suketa <masaki.suketa@nifty.ne.jp>
*/
-#include "win32ole.h"
+#include "ruby/ruby.h"
+#include "ruby/st.h"
+#include "ruby/encoding.h"
+
+#define GNUC_OLDER_3_4_4 \
+ ((__GNUC__ < 3) || \
+ ((__GNUC__ <= 3) && (__GNUC_MINOR__ < 4)) || \
+ ((__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)))
+
+#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
+#ifndef NONAMELESSUNION
+#define NONAMELESSUNION 1
+#endif
+#endif
+
+#include <ctype.h>
+
+#include <windows.h>
+#include <ocidl.h>
+#include <olectl.h>
+#include <ole2.h>
+#if defined(HAVE_TYPE_IMULTILANGUAGE2) || defined(HAVE_TYPE_IMULTILANGUAGE)
+#include <mlang.h>
+#endif
+#include <stdlib.h>
+#include <math.h>
+#ifdef HAVE_STDARG_PROTOTYPES
+#include <stdarg.h>
+#define va_init_list(a,b) va_start(a,b)
+#else
+#include <varargs.h>
+#define va_init_list(a,b) va_start(a)
+#endif
+#include <objidl.h>
+
+#define DOUT fprintf(stderr,"[%d]\n",__LINE__)
+#define DOUTS(x) fprintf(stderr,"[%d]:" #x "=%s\n",__LINE__,x)
+#define DOUTMSG(x) fprintf(stderr, "[%d]:" #x "\n",__LINE__)
+#define DOUTI(x) fprintf(stderr, "[%ld]:" #x "=%d\n",__LINE__,x)
+#define DOUTD(x) fprintf(stderr, "[%d]:" #x "=%f\n",__LINE__,x)
+
+#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
+#define V_UNION1(X, Y) ((X)->u.Y)
+#else
+#define V_UNION1(X, Y) ((X)->Y)
+#endif
+
+#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
+#undef V_UNION
+#define V_UNION(X,Y) ((X)->n1.n2.n3.Y)
+
+#undef V_VT
+#define V_VT(X) ((X)->n1.n2.vt)
+
+#undef V_BOOL
+#define V_BOOL(X) V_UNION(X,boolVal)
+#endif
+
+#ifndef V_I1REF
+#define V_I1REF(X) V_UNION(X, pcVal)
+#endif
+
+#ifndef V_UI2REF
+#define V_UI2REF(X) V_UNION(X, puiVal)
+#endif
+
+#ifndef V_INT
+#define V_INT(X) V_UNION(X, intVal)
+#endif
+
+#ifndef V_INTREF
+#define V_INTREF(X) V_UNION(X, pintVal)
+#endif
+
+#ifndef V_UINT
+#define V_UINT(X) V_UNION(X, uintVal)
+#endif
+
+#ifndef V_UINTREF
+#define V_UINTREF(X) V_UNION(X, puintVal)
+#endif
/*
* unfortunately IID_IMultiLanguage2 is not included in any libXXX.a
@@ -26,7 +106,44 @@
const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
#endif
-#define WIN32OLE_VERSION "1.8.4"
+#define OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0
+
+#define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0
+
+#define OLE_GET_TYPEATTR(X, Y) ((X)->lpVtbl->GetTypeAttr((X), (Y)))
+#define OLE_RELEASE_TYPEATTR(X, Y) ((X)->lpVtbl->ReleaseTypeAttr((X), (Y)))
+
+#define OLE_FREE(x) {\
+ if(g_ole_initialized == TRUE) {\
+ if(x) {\
+ OLE_RELEASE(x);\
+ (x) = 0;\
+ }\
+ }\
+}
+
+#define OLEData_Get_Struct(obj, pole) {\
+ Data_Get_Struct(obj, struct oledata, pole);\
+ if(!pole->pDispatch) {\
+ rb_raise(rb_eRuntimeError, "failed to get Dispatch Interface");\
+ }\
+}
+
+#ifdef HAVE_LONG_LONG
+#define I8_2_NUM LL2NUM
+#define UI8_2_NUM ULL2NUM
+#define NUM2I8 NUM2LL
+#define NUM2UI8 NUM2ULL
+#else
+#define I8_2_NUM INT2NUM
+#define UI8_2_NUM UINT2NUM
+#define NUM2I8 NUM2INT
+#define NUM2UI8 NUM2UINT
+#endif
+
+#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
+
+#define WIN32OLE_VERSION "1.5.5"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -34,8 +151,69 @@ typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
typedef HWND (WINAPI FNHTMLHELP)(HWND hwndCaller, LPCSTR pszFile,
UINT uCommand, DWORD dwData);
typedef BOOL (FNENUMSYSEMCODEPAGES) (CODEPAGE_ENUMPROC, DWORD);
-VALUE cWIN32OLE;
+typedef struct {
+ struct IEventSinkVtbl * lpVtbl;
+} IEventSink, *PEVENTSINK;
+
+typedef struct IEventSinkVtbl IEventSinkVtbl;
+
+struct IEventSinkVtbl {
+ STDMETHOD(QueryInterface)(
+ PEVENTSINK,
+ REFIID,
+ LPVOID *);
+ STDMETHOD_(ULONG, AddRef)(PEVENTSINK);
+ STDMETHOD_(ULONG, Release)(PEVENTSINK);
+
+ STDMETHOD(GetTypeInfoCount)(
+ PEVENTSINK,
+ UINT *);
+ STDMETHOD(GetTypeInfo)(
+ PEVENTSINK,
+ UINT,
+ LCID,
+ ITypeInfo **);
+ STDMETHOD(GetIDsOfNames)(
+ PEVENTSINK,
+ REFIID,
+ OLECHAR **,
+ UINT,
+ LCID,
+ DISPID *);
+ STDMETHOD(Invoke)(
+ PEVENTSINK,
+ DISPID,
+ REFIID,
+ LCID,
+ WORD,
+ DISPPARAMS *,
+ VARIANT *,
+ EXCEPINFO *,
+ UINT *);
+};
+typedef struct tagIEVENTSINKOBJ {
+ IEventSinkVtbl *lpVtbl;
+ DWORD m_cRef;
+ IID m_iid;
+ int m_event_id;
+ ITypeInfo *pTypeInfo;
+}IEVENTSINKOBJ, *PIEVENTSINKOBJ;
+
+VALUE cWIN32OLE;
+VALUE cWIN32OLE_TYPELIB;
+VALUE cWIN32OLE_TYPE;
+VALUE cWIN32OLE_VARIABLE;
+VALUE cWIN32OLE_METHOD;
+VALUE cWIN32OLE_PARAM;
+VALUE cWIN32OLE_EVENT;
+VALUE cWIN32OLE_VARIANT;
+VALUE eWIN32OLERuntimeError;
+VALUE mWIN32OLE_VARIANT;
+VALUE cWIN32OLE_PROPERTY;
+
+static VALUE ary_ole_event;
+static ID id_events;
#if defined(RB_THREAD_SPECIFIC) && (defined(__CYGWIN__) || defined(__MINGW32__))
static RB_THREAD_SPECIFIC BOOL g_ole_initialized;
# define g_ole_initialized_init() ((void)0)
@@ -46,7 +224,6 @@ static volatile DWORD g_ole_initialized_key = TLS_OUT_OF_INDEXES;
# define g_ole_initialized_init() (g_ole_initialized_key = TlsAlloc())
# define g_ole_initialized_set(val) TlsSetValue(g_ole_initialized_key, (void*)(val))
#endif
-
static BOOL g_uninitialize_hooked = FALSE;
static BOOL g_cp_installed = FALSE;
static BOOL g_lcid_installed = FALSE;
@@ -54,13 +231,14 @@ static HINSTANCE ghhctrl = NULL;
static HINSTANCE gole32 = NULL;
static FNCOCREATEINSTANCEEX *gCoCreateInstanceEx = NULL;
static VALUE com_hash;
-static VALUE enc2cp_hash;
static IDispatchVtbl com_vtbl;
static UINT cWIN32OLE_cp = CP_ACP;
+static LCID cWIN32OLE_lcid = LOCALE_SYSTEM_DEFAULT;
static rb_encoding *cWIN32OLE_enc;
static UINT g_cp_to_check = CP_ACP;
static char g_lcid_to_check[8 + 1];
static VARTYPE g_nil_to = VT_ERROR;
+static st_table *enc2cp_table;
static IMessageFilterVtbl message_filter;
static IMessageFilter imessage_filter = { &message_filter };
static IMessageFilter* previous_filter;
@@ -73,11 +251,52 @@ static IMultiLanguage *pIMultiLanguage = NULL;
#define pIMultiLanguage NULL /* dummy */
#endif
+struct oledata {
+ IDispatch *pDispatch;
+};
+
+struct oletypelibdata {
+ ITypeLib *pTypeLib;
+};
+
+struct oletypedata {
+ ITypeInfo *pTypeInfo;
+};
+
+struct olemethoddata {
+ ITypeInfo *pOwnerTypeInfo;
+ ITypeInfo *pTypeInfo;
+ UINT index;
+};
+
+struct olevariabledata {
+ ITypeInfo *pTypeInfo;
+ UINT index;
+};
+
+struct oleparamdata {
+ ITypeInfo *pTypeInfo;
+ UINT method_index;
+ UINT index;
+};
+
+struct oleeventdata {
+ DWORD dwCookie;
+ IConnectionPoint *pConnectionPoint;
+ long event_id;
+};
+
struct oleparam {
DISPPARAMS dp;
OLECHAR** pNamedArgs;
};
+struct olevariantdata {
+ VARIANT realvar;
+ VARIANT var;
+};
+
+
static HRESULT ( STDMETHODCALLTYPE QueryInterface )(IDispatch __RPC_FAR *, REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject);
static ULONG ( STDMETHODCALLTYPE AddRef )(IDispatch __RPC_FAR * This);
static ULONG ( STDMETHODCALLTYPE Release )(IDispatch __RPC_FAR * This);
@@ -95,28 +314,58 @@ NORETURN(static void failed_load_conv51932(void));
static void load_conv_function51932(void);
#endif
static UINT ole_init_cp(void);
+static char *ole_wc2mb(LPWSTR pw);
+static VALUE ole_hresult2msg(HRESULT hr);
static void ole_freeexceptinfo(EXCEPINFO *pExInfo);
static VALUE ole_excepinfo2msg(EXCEPINFO *pExInfo);
-static void ole_free(void *ptr);
-static size_t ole_size(const void *ptr);
-static LPWSTR ole_mb2wc(char *pm, int len, UINT cp);
-static VALUE ole_ary_m_entry(VALUE val, LONG *pid);
-static VALUE is_all_index_under(LONG *pid, long *pub, long dim);
+static void ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...);
+static void ole_initialize(void);
+static void ole_msg_loop(void);
+static void ole_free(struct oledata *pole);
+static void oletypelib_free(struct oletypelibdata *poletypelib);
+static void oletype_free(struct oletypedata *poletype);
+static void olemethod_free(struct olemethoddata *polemethod);
+static void olevariable_free(struct olevariabledata *polevar);
+static void oleparam_free(struct oleparamdata *pole);
+static LPWSTR ole_vstr2wc(VALUE vstr);
+static LPWSTR ole_mb2wc(char *pm, int len);
+static VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree);
+static VALUE ole_ary_m_entry(VALUE val, long *pid);
static void * get_ptr_of_variant(VARIANT *pvar);
-static void ole_set_safe_array(long n, SAFEARRAY *psa, LONG *pid, long *pub, VALUE val, long dim, VARTYPE vt);
+static VALUE is_all_index_under(long *pid, long *pub, long dim);
+static void ole_set_safe_array(long n, SAFEARRAY *psa, long *pid, long *pub, VALUE val, long dim, VARTYPE vt);
static long dimension(VALUE val);
static long ary_len_of_dim(VALUE ary, long dim);
+static HRESULT ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt);
+static void ole_val2variant(VALUE val, VARIANT *var);
+static void ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt);
+static void ole_val2ptr_variant(VALUE val, VARIANT *var);
+static void ole_set_byref(VARIANT *realvar, VARIANT *var, VARTYPE vt);
+static void ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar);
+static void ole_val2variant2(VALUE val, VARIANT *var);
+static VALUE make_inspect(const char *class_name, VALUE detail);
+static VALUE default_inspect(VALUE self, const char *class_name);
static VALUE ole_set_member(VALUE self, IDispatch *dispatch);
static VALUE fole_s_allocate(VALUE klass);
static VALUE create_win32ole_object(VALUE klass, IDispatch *pDispatch, int argc, VALUE *argv);
-static VALUE ary_new_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim);
-static void ary_store_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim, VALUE val);
+static VALUE ary_new_dim(VALUE myary, long *pid, long *plb, long dim);
+static void ary_store_dim(VALUE myary, long *pid, long *plb, long dim, VALUE val);
+static VALUE ole_variant2val(VARIANT *pvar);
+static LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey);
+static LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey);
+static VALUE reg_enum_key(HKEY hkey, DWORD i);
+static VALUE reg_get_val(HKEY hkey, const char *subkey);
+static VALUE reg_get_typelib_file_path(HKEY hkey);
+static VALUE typelib_file_from_clsid(VALUE ole);
+static VALUE typelib_file_from_typelib(VALUE ole);
+static VALUE typelib_file(VALUE ole);
static void ole_const_load(ITypeLib *pTypeLib, VALUE klass, VALUE self);
static HRESULT clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid);
-static VALUE ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others);
+static VALUE ole_create_dcom(int argc, VALUE *argv, VALUE self);
static VALUE ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self);
static VALUE fole_s_connect(int argc, VALUE *argv, VALUE self);
static VALUE fole_s_const_load(int argc, VALUE *argv, VALUE self);
+static VALUE ole_types_from_typelib(ITypeLib *pTypeLib, VALUE classes);
static ULONG reference_count(struct oledata * pole);
static VALUE fole_s_reference_count(VALUE self, VALUE obj);
static VALUE fole_s_free(VALUE self, VALUE obj);
@@ -134,7 +383,7 @@ static VALUE fole_s_create_guid(VALUE self);
static VALUE fole_s_ole_initialize(VALUE self);
static VALUE fole_s_ole_uninitialize(VALUE self);
static VALUE fole_initialize(int argc, VALUE *argv, VALUE self);
-static int hash2named_arg(VALUE key, VALUE val, VALUE pop);
+static VALUE hash2named_arg(VALUE pair, struct oleparam* pOp);
static VALUE set_argv(VARIANTARG* realargs, unsigned int beg, unsigned int end);
static VALUE ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket);
static VALUE fole_invoke(int argc, VALUE *argv, VALUE self);
@@ -151,36 +400,203 @@ static VALUE ole_each_sub(VALUE pEnumV);
static VALUE ole_ienum_free(VALUE pEnumV);
static VALUE fole_each(VALUE self);
static VALUE fole_missing(int argc, VALUE *argv, VALUE self);
+static VALUE ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE name);
+static VALUE olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name);
+static VALUE ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, int mask);
+static VALUE ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask);
static HRESULT typeinfo_from_ole(struct oledata *pole, ITypeInfo **ppti);
static VALUE ole_methods(VALUE self, int mask);
static VALUE fole_methods(VALUE self);
static VALUE fole_get_methods(VALUE self);
static VALUE fole_put_methods(VALUE self);
static VALUE fole_func_methods(VALUE self);
+static VALUE ole_type_from_itypeinfo(ITypeInfo *pTypeInfo);
static VALUE fole_type(VALUE self);
+static VALUE ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo);
static VALUE fole_typelib(VALUE self);
static VALUE fole_query_interface(VALUE self, VALUE str_iid);
static VALUE fole_respond_to(VALUE self, VALUE method);
+static HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile);
static VALUE ole_usertype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
static VALUE ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
+static VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
static VALUE fole_method_help(VALUE self, VALUE cmdname);
static VALUE fole_activex_initialize(VALUE self);
-
-static void com_hash_free(void *ptr);
-static void com_hash_mark(void *ptr);
-static size_t com_hash_size(const void *ptr);
-
-static const rb_data_type_t ole_datatype = {
- "win32ole",
- {NULL, ole_free, ole_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static const rb_data_type_t win32ole_hash_datatype = {
- "win32ole_hash",
- {com_hash_mark, com_hash_free, com_hash_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
+static VALUE foletype_s_ole_classes(VALUE self, VALUE typelib);
+static VALUE foletype_s_typelibs(VALUE self);
+static VALUE foletype_s_progids(VALUE self);
+static VALUE foletype_s_allocate(VALUE klass);
+static VALUE oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name);
+static VALUE oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass);
+static VALUE oletypelib_set_member(VALUE self, ITypeLib *pTypeLib);
+static ITypeLib * oletypelib_get_typelib(VALUE self);
+static void oletypelib_get_libattr(ITypeLib *pTypeLib, TLIBATTR **ppTLibAttr);
+static VALUE foletypelib_s_typelibs(VALUE self);
+static VALUE make_version_str(VALUE major, VALUE minor);
+static VALUE oletypelib_search_registry2(VALUE self, VALUE args);
+static VALUE oletypelib_search_registry(VALUE self, VALUE typelib);
+static VALUE foletypelib_s_allocate(VALUE klass);
+static VALUE foletypelib_initialize(VALUE self, VALUE args);
+static VALUE foletypelib_guid(VALUE self);
+static VALUE foletypelib_name(VALUE self);
+static VALUE foletypelib_version(VALUE self);
+static VALUE foletypelib_major_version(VALUE self);
+static VALUE foletypelib_minor_version(VALUE self);
+static VALUE oletypelib_path(VALUE guid, VALUE version);
+static HRESULT oletypelib_from_guid(VALUE guid, VALUE version, ITypeLib **ppTypeLib);
+static VALUE foletypelib_path(VALUE self);
+static VALUE foletypelib_visible(VALUE self);
+static VALUE foletypelib_library_name(VALUE self);
+static VALUE foletypelib_ole_types(VALUE self);
+static VALUE foletypelib_inspect(VALUE self);
+static VALUE foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass);
+static VALUE foletype_name(VALUE self);
+static VALUE ole_ole_type(ITypeInfo *pTypeInfo);
+static VALUE foletype_ole_type(VALUE self);
+static VALUE ole_type_guid(ITypeInfo *pTypeInfo);
+static VALUE foletype_guid(VALUE self);
+static VALUE ole_type_progid(ITypeInfo *pTypeInfo);
+static VALUE foletype_progid(VALUE self);
+static VALUE ole_type_visible(ITypeInfo *pTypeInfo);
+static VALUE foletype_visible(VALUE self);
+static VALUE ole_type_major_version(ITypeInfo *pTypeInfo);
+static VALUE foletype_major_version(VALUE self);
+static VALUE ole_type_minor_version(ITypeInfo *pTypeInfo);
+static VALUE foletype_minor_version(VALUE self);
+static VALUE ole_type_typekind(ITypeInfo *pTypeInfo);
+static VALUE foletype_typekind(VALUE self);
+static VALUE ole_type_helpstring(ITypeInfo *pTypeInfo);
+static VALUE foletype_helpstring(VALUE self);
+static VALUE ole_type_src_type(ITypeInfo *pTypeInfo);
+static VALUE foletype_src_type(VALUE self);
+static VALUE ole_type_helpfile(ITypeInfo *pTypeInfo);
+static VALUE foletype_helpfile(VALUE self);
+static VALUE ole_type_helpcontext(ITypeInfo *pTypeInfo);
+static VALUE foletype_helpcontext(VALUE self);
+static VALUE foletype_ole_typelib(VALUE self);
+static VALUE ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags);
+static VALUE foletype_impl_ole_types(VALUE self);
+static VALUE foletype_source_ole_types(VALUE self);
+static VALUE foletype_default_event_sources(VALUE self);
+static VALUE foletype_default_ole_types(VALUE self);
+static VALUE foletype_inspect(VALUE self);
+static VALUE ole_variables(ITypeInfo *pTypeInfo);
+static VALUE foletype_variables(VALUE self);
+static VALUE foletype_methods(VALUE self);
+static VALUE folevariable_name(VALUE self);
+static VALUE ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index);
+static VALUE folevariable_ole_type(VALUE self);
+static VALUE ole_variable_ole_type_detail(ITypeInfo *pTypeInfo, UINT var_index);
+static VALUE folevariable_ole_type_detail(VALUE self);
+static VALUE ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index);
+static VALUE folevariable_value(VALUE self);
+static VALUE ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index);
+static VALUE folevariable_visible(VALUE self);
+static VALUE ole_variable_kind(ITypeInfo *pTypeInfo, UINT var_index);
+static VALUE folevariable_variable_kind(VALUE self);
+static VALUE ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index);
+static VALUE folevariable_varkind(VALUE self);
+static VALUE folevariable_inspect(VALUE self);
+static VALUE olemethod_set_member(VALUE self, ITypeInfo *pTypeInfo, ITypeInfo *pOwnerTypeInfo, int index, VALUE name);
+static VALUE folemethod_s_allocate(VALUE klass);
+static VALUE folemethod_initialize(VALUE self, VALUE oletype, VALUE method);
+static VALUE folemethod_name(VALUE self);
+static VALUE ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_return_type(VALUE self);
+static VALUE ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_return_vtype(VALUE self);
+static VALUE ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_return_type_detail(VALUE self);
+static VALUE ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_invkind(VALUE self);
+static VALUE folemethod_invoke_kind(VALUE self);
+static VALUE ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_visible(VALUE self);
+static VALUE ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name);
+static VALUE folemethod_event(VALUE self);
+static VALUE folemethod_event_interface(VALUE self);
+static HRESULT ole_method_docinfo_from_type(ITypeInfo *pTypeInfo, UINT method_index, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile);
+static VALUE ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_helpstring(VALUE self);
+static VALUE ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_helpfile(VALUE self);
+static VALUE ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_helpcontext(VALUE self);
+static VALUE ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_dispid(VALUE self);
+static VALUE ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_offset_vtbl(VALUE self);
+static VALUE ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_size_params(VALUE self);
+static VALUE ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_size_opt_params(VALUE self);
+static VALUE ole_method_params(ITypeInfo *pTypeInfo, UINT method_index);
+static VALUE folemethod_params(VALUE self);
+static VALUE folemethod_inspect(VALUE self);
+static VALUE foleparam_s_allocate(VALUE klass);
+static VALUE oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_index, int param_index);
+static VALUE oleparam_ole_param(VALUE self, VALUE olemethod, int n);
+static VALUE foleparam_initialize(VALUE self, VALUE olemethod, VALUE n);
+static VALUE foleparam_name(VALUE self);
+static VALUE ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index);
+static VALUE foleparam_ole_type(VALUE self);
+static VALUE ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index);
+static VALUE foleparam_ole_type_detail(VALUE self);
+static VALUE ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT mask);
+static VALUE foleparam_input(VALUE self);
+static VALUE foleparam_output(VALUE self);
+static VALUE foleparam_optional(VALUE self);
+static VALUE foleparam_retval(VALUE self);
+static VALUE ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index);
+static VALUE foleparam_default(VALUE self);
+static VALUE foleparam_inspect(VALUE self);
+static long ole_search_event_at(VALUE ary, VALUE ev);
+static VALUE ole_search_event(VALUE ary, VALUE ev, BOOL *is_default);
+static VALUE ole_search_handler_method(VALUE handler, VALUE ev, BOOL *is_default_handler);
+static void ole_delete_event(VALUE ary, VALUE ev);
+static void hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS *pdispparams);
+static VALUE hash2result(VALUE hash);
+static void ary2ptr_dispparams(VALUE ary, DISPPARAMS *pdispparams);
+static VALUE exec_callback(VALUE arg);
+static VALUE rescue_callback(VALUE arg);
+static HRESULT find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo);
+static HRESULT find_coclass(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, ITypeInfo **pTypeInfo2, TYPEATTR **pTypeAttr2);
+static HRESULT find_default_source_from_typeinfo(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, ITypeInfo **ppTypeInfo);
+static HRESULT find_default_source(VALUE ole, IID *piid, ITypeInfo **ppTypeInfo);
+static void ole_event_free(struct oleeventdata *poleev);
+static VALUE fev_s_allocate(VALUE klass);
+static VALUE ev_advise(int argc, VALUE *argv, VALUE self);
+static VALUE fev_initialize(int argc, VALUE *argv, VALUE self);
+static VALUE fev_s_msg_loop(VALUE klass);
+static void add_event_call_back(VALUE obj, VALUE event, VALUE data);
+static VALUE ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg);
+static VALUE fev_on_event(int argc, VALUE *argv, VALUE self);
+static VALUE fev_on_event_with_outargs(int argc, VALUE *argv, VALUE self);
+static VALUE fev_off_event(int argc, VALUE *argv, VALUE self);
+static VALUE fev_unadvise(VALUE self);
+static VALUE fev_set_handler(VALUE self, VALUE val);
+static VALUE fev_get_handler(VALUE self);
+static VALUE evs_push(VALUE ev);
+static VALUE evs_delete(long i);
+static VALUE evs_entry(long i);
+static VALUE evs_length(void);
+static void olevariant_free(struct olevariantdata *pvar);
+static VALUE folevariant_s_allocate(VALUE klass);
+static VALUE folevariant_s_array(VALUE klass, VALUE dims, VALUE vvt);
+static void check_type_val2variant(VALUE val);
+static VALUE folevariant_initialize(VALUE self, VALUE args);
+static long *ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa);
+static void unlock_safe_array(SAFEARRAY *psa);
+static SAFEARRAY *get_locked_safe_array(VALUE val);
+static VALUE folevariant_ary_aref(int argc, VALUE *argv, VALUE self);
+static VOID * val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt);
+static VALUE folevariant_ary_aset(int argc, VALUE *argv, VALUE self);
+static VALUE folevariant_value(VALUE self);
+static VALUE folevariant_vartype(VALUE self);
+static VALUE folevariant_set_value(VALUE self, VALUE val);
+static void init_enc2cp(void);
+static void free_enc2cp(void);
static HRESULT (STDMETHODCALLTYPE mf_QueryInterface)(
IMessageFilter __RPC_FAR * This,
@@ -349,7 +765,7 @@ static HRESULT ( STDMETHODCALLTYPE GetIDsOfNames )(
Win32OLEIDispatch* p = (Win32OLEIDispatch*)This;
*/
char* psz = ole_wc2mb(*rgszNames); // support only one method
- ID nameid = rb_check_id_cstr(psz, (long)strlen(psz), cWIN32OLE_enc);
+ ID nameid = rb_intern(psz);
free(psz);
if ((ID)(DISPID)nameid != nameid) return E_NOINTERFACE;
*rgDispId = (DISPID)nameid;
@@ -388,18 +804,13 @@ static /* [local] */ HRESULT ( STDMETHODCALLTYPE Invoke )(
return S_OK;
}
-BOOL
-ole_initialized(void)
-{
- return g_ole_initialized;
-}
-
static IDispatch*
val2dispatch(VALUE val)
{
struct st_table *tbl = DATA_PTR(com_hash);
Win32OLEIDispatch* pdisp;
st_data_t data;
+
if (st_lookup(tbl, val, &data)) {
pdisp = (Win32OLEIDispatch *)(data & ~FIXNUM_FLAG);
pdisp->refcount++;
@@ -418,28 +829,17 @@ static double
rbtime2vtdate(VALUE tmobj)
{
SYSTEMTIME st;
- double t;
- double nsec;
-
+ double t = 0;
+ memset(&st, 0, sizeof(SYSTEMTIME));
st.wYear = FIX2INT(rb_funcall(tmobj, rb_intern("year"), 0));
st.wMonth = FIX2INT(rb_funcall(tmobj, rb_intern("month"), 0));
st.wDay = FIX2INT(rb_funcall(tmobj, rb_intern("mday"), 0));
st.wHour = FIX2INT(rb_funcall(tmobj, rb_intern("hour"), 0));
st.wMinute = FIX2INT(rb_funcall(tmobj, rb_intern("min"), 0));
st.wSecond = FIX2INT(rb_funcall(tmobj, rb_intern("sec"), 0));
- st.wMilliseconds = 0;
+ st.wMilliseconds = FIX2INT(rb_funcall(tmobj, rb_intern("nsec"), 0)) / 1000000;
SystemTimeToVariantTime(&st, &t);
-
- /*
- * Unfortunately SystemTimeToVariantTime function always ignores the
- * wMilliseconds of SYSTEMTIME struct.
- * So, we need to calculate milliseconds by ourselves.
- */
- nsec = FIX2INT(rb_funcall(tmobj, rb_intern("nsec"), 0));
- nsec /= 1000000.0;
- nsec /= (24.0 * 3600.0);
- nsec /= 1000;
- return t + nsec;
+ return t;
}
static VALUE
@@ -447,9 +847,8 @@ vtdate2rbtime(double date)
{
SYSTEMTIME st;
VALUE v;
- double msec;
- double sec;
VariantTimeToSystemTime(date, &st);
+
v = rb_funcall(rb_cTime, rb_intern("new"), 6,
INT2FIX(st.wYear),
INT2FIX(st.wMonth),
@@ -457,28 +856,8 @@ vtdate2rbtime(double date)
INT2FIX(st.wHour),
INT2FIX(st.wMinute),
INT2FIX(st.wSecond));
- st.wYear = FIX2INT(rb_funcall(v, rb_intern("year"), 0));
- st.wMonth = FIX2INT(rb_funcall(v, rb_intern("month"), 0));
- st.wDay = FIX2INT(rb_funcall(v, rb_intern("mday"), 0));
- st.wHour = FIX2INT(rb_funcall(v, rb_intern("hour"), 0));
- st.wMinute = FIX2INT(rb_funcall(v, rb_intern("min"), 0));
- st.wSecond = FIX2INT(rb_funcall(v, rb_intern("sec"), 0));
- st.wMilliseconds = 0;
- SystemTimeToVariantTime(&st, &sec);
- /*
- * Unfortunately VariantTimeToSystemTime always ignores the
- * wMilliseconds of SYSTEMTIME struct(The wMilliseconds is 0).
- * So, we need to calculate milliseconds by ourselves.
- */
- msec = date - sec;
- msec *= 24 * 60;
- msec -= floor(msec);
- msec *= 60;
- if (msec >= 59) {
- msec -= 60;
- }
- if (msec != 0) {
- return rb_funcall(v, rb_intern("+"), 1, rb_float_new(msec));
+ if (st.wMilliseconds > 0) {
+ return rb_funcall(v, rb_intern("+"), 1, rb_float_new((double)(st.wMilliseconds / 1000.0)));
}
return v;
}
@@ -576,13 +955,11 @@ load_conv_function51932(void)
pIMultiLanguage = p;
}
}
-#define need_conv_function51932() (load_conv_function51932(), 1)
#else
#define load_conv_function51932() failed_load_conv51932()
-#define need_conv_function51932() (failed_load_conv51932(), 0)
#endif
-#define conv_51932(cp) ((cp) == 51932 && need_conv_function51932())
+#define conv_51932(cp) ((cp) == 51932 && (load_conv_function51932(), 1))
static void
set_ole_codepage(UINT cp)
@@ -690,25 +1067,6 @@ ole_cp2encoding(UINT cp)
return rb_enc_from_index(idx);
}
-#ifndef pIMultiLanguage
-static HRESULT
-ole_ml_wc2mb_conv0(LPWSTR pw, LPSTR pm, UINT *size)
-{
- DWORD dw = 0;
- return pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
- &dw, cWIN32OLE_cp, pw, NULL, pm, size);
-}
-#define ole_ml_wc2mb_conv(pw, pm, size, onfailure) do { \
- HRESULT hr = ole_ml_wc2mb_conv0(pw, pm, &size); \
- if (FAILED(hr)) { \
- onfailure; \
- ole_raise(hr, eWIN32OLERuntimeError, "fail to convert Unicode to CP%d", cWIN32OLE_cp); \
- } \
- } while (0)
-#endif
-
-#define ole_wc2mb_conv(pw, pm, size) WideCharToMultiByte(cWIN32OLE_cp, 0, (pw), -1, (pm), (size), NULL, NULL)
-
static char *
ole_wc2mb_alloc(LPWSTR pw, char *(alloc)(UINT size, void *arg), void *arg)
{
@@ -716,17 +1074,32 @@ ole_wc2mb_alloc(LPWSTR pw, char *(alloc)(UINT size, void *arg), void *arg)
UINT size = 0;
if (conv_51932(cWIN32OLE_cp)) {
#ifndef pIMultiLanguage
- ole_ml_wc2mb_conv(pw, NULL, size, {});
+ DWORD dw = 0;
+ HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
+ &dw, cWIN32OLE_cp, pw, NULL, NULL, &size);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "fail to convert Unicode to CP%d", cWIN32OLE_cp);
+ }
pm = alloc(size, arg);
- if (size) ole_ml_wc2mb_conv(pw, pm, size, xfree(pm));
+ hr = pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
+ &dw, cWIN32OLE_cp, pw, NULL, pm, &size);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "fail to convert Unicode to CP%d", cWIN32OLE_cp);
+ }
pm[size] = '\0';
- return pm;
#endif
+ return pm;
+ }
+ size = WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, NULL, 0, NULL, NULL);
+ if (size) {
+ pm = alloc(size, arg);
+ WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, pm, size, NULL, NULL);
+ pm[size] = '\0';
+ }
+ else {
+ pm = alloc(0, arg);
+ *pm = '\0';
}
- size = ole_wc2mb_conv(pw, NULL, 0);
- pm = alloc(size, arg);
- if (size) ole_wc2mb_conv(pw, pm, size);
- pm[size] = '\0';
return pm;
}
@@ -736,12 +1109,52 @@ ole_alloc_str(UINT size, void *arg)
return ALLOC_N(char, size + 1);
}
-char *
+static char *
ole_wc2mb(LPWSTR pw)
{
return ole_wc2mb_alloc(pw, ole_alloc_str, NULL);
}
+static VALUE
+ole_hresult2msg(HRESULT hr)
+{
+ VALUE msg = Qnil;
+ char *p_msg = NULL;
+ char *term = NULL;
+ DWORD dwCount;
+
+ char strhr[100];
+ sprintf(strhr, " HRESULT error code:0x%08x\n ", (unsigned)hr);
+ msg = rb_str_new2(strhr);
+ dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, hr,
+ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
+ (LPTSTR)&p_msg, 0, NULL);
+ if (dwCount == 0) {
+ dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, hr, cWIN32OLE_lcid,
+ (LPTSTR)&p_msg, 0, NULL);
+ }
+ if (dwCount > 0) {
+ term = p_msg + strlen(p_msg);
+ while (p_msg < term) {
+ term--;
+ if (*term == '\r' || *term == '\n')
+ *term = '\0';
+ else break;
+ }
+ if (p_msg[0] != '\0') {
+ rb_str_cat2(msg, p_msg);
+ }
+ }
+ LocalFree(p_msg);
+ return msg;
+}
+
static void
ole_freeexceptinfo(EXCEPINFO *pExInfo)
{
@@ -767,7 +1180,7 @@ ole_excepinfo2msg(EXCEPINFO *pExInfo)
pDescription = ole_wc2mb(pExInfo->bstrDescription);
}
if(pExInfo->wCode == 0) {
- sprintf(error_code, "\n OLE error code:%lX in ", (unsigned long)pExInfo->scode);
+ sprintf(error_code, "\n OLE error code:%lX in ", pExInfo->scode);
}
else{
sprintf(error_code, "\n OLE error code:%u in ", pExInfo->wCode);
@@ -792,6 +1205,25 @@ ole_excepinfo2msg(EXCEPINFO *pExInfo)
return error_msg;
}
+static void
+ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...)
+{
+ va_list args;
+ char buf[BUFSIZ];
+ VALUE err_msg;
+ va_init_list(args, fmt);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ va_end(args);
+
+ err_msg = ole_hresult2msg(hr);
+ if(err_msg != Qnil) {
+ rb_raise(ecs, "%s\n%s", buf, StringValuePtr(err_msg));
+ }
+ else {
+ rb_raise(ecs, "%s", buf);
+ }
+}
+
void
ole_uninitialize(void)
{
@@ -806,7 +1238,7 @@ ole_uninitialize_hook(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VA
ole_uninitialize();
}
-void
+static void
ole_initialize(void)
{
HRESULT hr;
@@ -832,46 +1264,70 @@ ole_initialize(void)
}
static void
-ole_free(void *ptr)
+ole_msg_loop() {
+ MSG msg;
+ while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+}
+
+static void
+ole_free(struct oledata *pole)
{
- struct oledata *pole = ptr;
OLE_FREE(pole->pDispatch);
free(pole);
}
-static size_t ole_size(const void *ptr)
+static void
+oletypelib_free(struct oletypelibdata *poletypelib)
{
- return ptr ? sizeof(struct oledata) : 0;
+ OLE_FREE(poletypelib->pTypeLib);
+ free(poletypelib);
}
-struct oledata *
-oledata_get_struct(VALUE ole)
+static void
+oletype_free(struct oletypedata *poletype)
{
- struct oledata *pole;
- TypedData_Get_Struct(ole, struct oledata, &ole_datatype, pole);
- return pole;
+ OLE_FREE(poletype->pTypeInfo);
+ free(poletype);
+}
+
+static void
+olemethod_free(struct olemethoddata *polemethod)
+{
+ OLE_FREE(polemethod->pTypeInfo);
+ OLE_FREE(polemethod->pOwnerTypeInfo);
+ free(polemethod);
+}
+
+static void
+olevariable_free(struct olevariabledata *polevar)
+{
+ OLE_FREE(polevar->pTypeInfo);
+ free(polevar);
+}
+
+static void
+oleparam_free(struct oleparamdata *pole)
+{
+ OLE_FREE(pole->pTypeInfo);
+ free(pole);
}
-LPWSTR
+
+static LPWSTR
ole_vstr2wc(VALUE vstr)
{
rb_encoding *enc;
int cp;
+ UINT size = 0;
LPWSTR pw;
st_data_t data;
- struct st_table *tbl = DATA_PTR(enc2cp_hash);
-
- /* do not type-conversion here to prevent from other arguments
- * changing (if exist) */
- Check_Type(vstr, T_STRING);
- if (RSTRING_LEN(vstr) == 0) {
- return NULL;
- }
-
enc = rb_enc_get(vstr);
- if (st_lookup(tbl, (VALUE)enc | FIXNUM_FLAG, &data)) {
- cp = FIX2INT((VALUE)data);
+ if (st_lookup(enc2cp_table, (st_data_t)enc, &data)) {
+ cp = (int)data;
} else {
cp = ole_encoding2cp(enc);
if (code_page_installed(cp) ||
@@ -883,45 +1339,63 @@ ole_vstr2wc(VALUE vstr)
cp == CP_UTF7 ||
cp == CP_UTF8 ||
cp == 51932) {
- st_insert(tbl, (VALUE)enc | FIXNUM_FLAG, INT2FIX(cp));
+ st_insert(enc2cp_table, (st_data_t)enc, (st_data_t)cp);
} else {
rb_raise(eWIN32OLERuntimeError, "not installed Windows codepage(%d) according to `%s'", cp, rb_enc_name(enc));
}
}
- pw = ole_mb2wc(RSTRING_PTR(vstr), RSTRING_LENINT(vstr), cp);
- RB_GC_GUARD(vstr);
+ if (conv_51932(cp)) {
+#ifndef pIMultiLanguage
+ DWORD dw = 0;
+ UINT len = RSTRING_LENINT(vstr);
+ HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
+ &dw, cp, RSTRING_PTR(vstr), &len, NULL, &size);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
+ }
+ pw = SysAllocStringLen(NULL, size);
+ len = RSTRING_LEN(vstr);
+ hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
+ &dw, cp, RSTRING_PTR(vstr), &len, pw, &size);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
+ }
+#endif
+ return pw;
+ }
+ size = MultiByteToWideChar(cp, 0, RSTRING_PTR(vstr), RSTRING_LEN(vstr), NULL, 0);
+ pw = SysAllocStringLen(NULL, size);
+ MultiByteToWideChar(cp, 0, RSTRING_PTR(vstr), RSTRING_LEN(vstr), pw, size);
return pw;
}
static LPWSTR
-ole_mb2wc(char *pm, int len, UINT cp)
+ole_mb2wc(char *pm, int len)
{
UINT size = 0;
LPWSTR pw;
- if (conv_51932(cp)) {
+ if (conv_51932(cWIN32OLE_cp)) {
#ifndef pIMultiLanguage
DWORD dw = 0;
UINT n = len;
HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
- &dw, cp, pm, &n, NULL, &size);
+ &dw, cWIN32OLE_cp, pm, &n, NULL, &size);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
+ ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cWIN32OLE_cp);
}
pw = SysAllocStringLen(NULL, size);
- n = len;
hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
- &dw, cp, pm, &n, pw, &size);
+ &dw, cWIN32OLE_cp, pm, &n, pw, &size);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
+ ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cWIN32OLE_cp);
}
- return pw;
#endif
+ return pw;
}
- size = MultiByteToWideChar(cp, 0, pm, len, NULL, 0);
- pw = SysAllocStringLen(NULL, size);
- pw[size-1] = 0;
- MultiByteToWideChar(cp, 0, pm, len, pw, size);
+ size = MultiByteToWideChar(cWIN32OLE_cp, 0, pm, len, NULL, 0);
+ pw = SysAllocStringLen(NULL, size - 1);
+ MultiByteToWideChar(cWIN32OLE_cp, 0, pm, len, pw, size);
return pw;
}
@@ -933,7 +1407,7 @@ ole_alloc_vstr(UINT size, void *arg)
return RSTRING_PTR(str);
}
-VALUE
+static VALUE
ole_wc2vstr(LPWSTR pw, BOOL isfree)
{
VALUE vstr;
@@ -945,89 +1419,18 @@ ole_wc2vstr(LPWSTR pw, BOOL isfree)
}
static VALUE
-ole_ary_m_entry(VALUE val, LONG *pid)
+ole_ary_m_entry(VALUE val, long *pid)
{
VALUE obj = Qnil;
int i = 0;
obj = val;
- while(RB_TYPE_P(obj, T_ARRAY)) {
+ while(TYPE(obj) == T_ARRAY) {
obj = rb_ary_entry(obj, pid[i]);
i++;
}
return obj;
}
-static VALUE
-is_all_index_under(LONG *pid, long *pub, long dim)
-{
- long i = 0;
- for (i = 0; i < dim; i++) {
- if (pid[i] > pub[i]) {
- return Qfalse;
- }
- }
- return Qtrue;
-}
-
-void
-ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt)
-{
- if (val == Qnil) {
- if (vt == VT_VARIANT) {
- ole_val2variant2(val, var);
- } else {
- V_VT(var) = (vt & ~VT_BYREF);
- if (V_VT(var) == VT_DISPATCH) {
- V_DISPATCH(var) = NULL;
- } else if (V_VT(var) == VT_UNKNOWN) {
- V_UNKNOWN(var) = NULL;
- }
- }
- return;
- }
-#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
- switch(vt & ~VT_BYREF) {
- case VT_I8:
- V_VT(var) = VT_I8;
- V_I8(var) = NUM2I8 (val);
- break;
- case VT_UI8:
- V_VT(var) = VT_UI8;
- V_UI8(var) = NUM2UI8(val);
- break;
- default:
- ole_val2variant2(val, var);
- break;
- }
-#else /* (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__) */
- ole_val2variant2(val, var);
-#endif
-}
-
-VOID *
-val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt)
-{
- VOID *p = NULL;
- HRESULT hr = S_OK;
- ole_val2variant_ex(val, var, vt);
- if ((vt & ~VT_BYREF) == VT_VARIANT) {
- p = var;
- } else {
- if ( (vt & ~VT_BYREF) != V_VT(var)) {
- hr = VariantChangeTypeEx(var, var,
- cWIN32OLE_lcid, 0, (VARTYPE)(vt & ~VT_BYREF));
- if (FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to change type");
- }
- }
- p = get_ptr_of_variant(var);
- }
- if (p == NULL) {
- rb_raise(rb_eRuntimeError, "failed to get pointer of variant");
- }
- return p;
-}
-
static void *
get_ptr_of_variant(VARIANT *pvar)
{
@@ -1097,8 +1500,20 @@ get_ptr_of_variant(VARIANT *pvar)
}
}
+static VALUE
+is_all_index_under(long *pid, long *pub, long dim)
+{
+ long i = 0;
+ for (i = 0; i < dim; i++) {
+ if (pid[i] > pub[i]) {
+ return Qfalse;
+ }
+ }
+ return Qtrue;
+}
+
static void
-ole_set_safe_array(long n, SAFEARRAY *psa, LONG *pid, long *pub, VALUE val, long dim, VARTYPE vt)
+ole_set_safe_array(long n, SAFEARRAY *psa, long *pid, long *pub, VALUE val, long dim, VARTYPE vt)
{
VALUE val1;
HRESULT hr = S_OK;
@@ -1135,7 +1550,7 @@ dimension(VALUE val) {
long dim1 = 0;
long len = 0;
long i = 0;
- if (RB_TYPE_P(val, T_ARRAY)) {
+ if (TYPE(val) == T_ARRAY) {
len = RARRAY_LEN(val);
for (i = 0; i < len; i++) {
dim1 = dimension(rb_ary_entry(val, i));
@@ -1156,11 +1571,11 @@ ary_len_of_dim(VALUE ary, long dim) {
long i = 0;
VALUE val;
if (dim == 0) {
- if (RB_TYPE_P(ary, T_ARRAY)) {
+ if (TYPE(ary) == T_ARRAY) {
ary_len = RARRAY_LEN(ary);
}
} else {
- if (RB_TYPE_P(ary, T_ARRAY)) {
+ if (TYPE(ary) == T_ARRAY) {
len = RARRAY_LEN(ary);
for (i = 0; i < len; i++) {
val = rb_ary_entry(ary, i);
@@ -1174,7 +1589,7 @@ ary_len_of_dim(VALUE ary, long dim) {
return ary_len;
}
-HRESULT
+static HRESULT
ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
{
long dim = 0;
@@ -1183,8 +1598,7 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
SAFEARRAYBOUND *psab = NULL;
SAFEARRAY *psa = NULL;
- long *pub;
- LONG *pid;
+ long *pub, *pid;
Check_Type(val, T_ARRAY);
@@ -1192,7 +1606,7 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
psab = ALLOC_N(SAFEARRAYBOUND, dim);
pub = ALLOC_N(long, dim);
- pid = ALLOC_N(LONG, dim);
+ pid = ALLOC_N(long, dim);
if(!psab || !pub || !pid) {
if(pub) free(pub);
@@ -1236,25 +1650,24 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
return hr;
}
-void
+static void
ole_val2variant(VALUE val, VARIANT *var)
{
- struct oledata *pole = NULL;
+ struct oledata *pole;
+ struct olevariantdata *pvar;
if(rb_obj_is_kind_of(val, cWIN32OLE)) {
- pole = oledata_get_struct(val);
+ Data_Get_Struct(val, struct oledata, pole);
OLE_ADDREF(pole->pDispatch);
V_VT(var) = VT_DISPATCH;
V_DISPATCH(var) = pole->pDispatch;
return;
}
if (rb_obj_is_kind_of(val, cWIN32OLE_VARIANT)) {
- ole_variant2variant(val, var);
- return;
- }
- if (rb_obj_is_kind_of(val, cWIN32OLE_RECORD)) {
- ole_rec2variant(val, var);
+ Data_Get_Struct(val, struct olevariantdata, pvar);
+ VariantCopy(var, &(pvar->var));
return;
}
+
if (rb_obj_is_kind_of(val, rb_cTime)) {
V_VT(var) = VT_DATE;
V_DATE(var) = rbtime2vtdate(val);
@@ -1303,7 +1716,294 @@ ole_val2variant(VALUE val, VARIANT *var)
}
}
-void
+static void
+ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt)
+{
+ if (val == Qnil) {
+ if (vt == VT_VARIANT) {
+ ole_val2variant2(val, var);
+ } else {
+ V_VT(var) = (vt & ~VT_BYREF);
+ if (V_VT(var) == VT_DISPATCH) {
+ V_DISPATCH(var) = NULL;
+ } else if (V_VT(var) == VT_UNKNOWN) {
+ V_UNKNOWN(var) = NULL;
+ }
+ }
+ return;
+ }
+#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
+ switch(vt & ~VT_BYREF) {
+ case VT_I8:
+ V_VT(var) = VT_I8;
+ V_I8(var) = NUM2I8 (val);
+ break;
+ case VT_UI8:
+ V_VT(var) = VT_UI8;
+ V_UI8(var) = NUM2UI8(val);
+ break;
+ default:
+ ole_val2variant2(val, var);
+ break;
+ }
+#else /* (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__) */
+ ole_val2variant2(val, var);
+#endif
+}
+
+static void
+ole_val2ptr_variant(VALUE val, VARIANT *var)
+{
+ switch (TYPE(val)) {
+ case T_STRING:
+ if (V_VT(var) == (VT_BSTR | VT_BYREF)) {
+ *V_BSTRREF(var) = ole_vstr2wc(val);
+ }
+ break;
+ case T_FIXNUM:
+ switch(V_VT(var)) {
+ case (VT_UI1 | VT_BYREF) :
+ *V_UI1REF(var) = NUM2CHR(val);
+ break;
+ case (VT_I2 | VT_BYREF) :
+ *V_I2REF(var) = (short)NUM2INT(val);
+ break;
+ case (VT_I4 | VT_BYREF) :
+ *V_I4REF(var) = NUM2INT(val);
+ break;
+ case (VT_R4 | VT_BYREF) :
+ *V_R4REF(var) = (float)NUM2INT(val);
+ break;
+ case (VT_R8 | VT_BYREF) :
+ *V_R8REF(var) = NUM2INT(val);
+ break;
+ default:
+ break;
+ }
+ break;
+ case T_FLOAT:
+ switch(V_VT(var)) {
+ case (VT_I2 | VT_BYREF) :
+ *V_I2REF(var) = (short)NUM2INT(val);
+ break;
+ case (VT_I4 | VT_BYREF) :
+ *V_I4REF(var) = NUM2INT(val);
+ break;
+ case (VT_R4 | VT_BYREF) :
+ *V_R4REF(var) = (float)NUM2DBL(val);
+ break;
+ case (VT_R8 | VT_BYREF) :
+ *V_R8REF(var) = NUM2DBL(val);
+ break;
+ default:
+ break;
+ }
+ break;
+ case T_BIGNUM:
+ if (V_VT(var) == (VT_R8 | VT_BYREF)) {
+ *V_R8REF(var) = rb_big2dbl(val);
+ }
+ break;
+ case T_TRUE:
+ if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
+ *V_BOOLREF(var) = VARIANT_TRUE;
+ }
+ break;
+ case T_FALSE:
+ if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
+ *V_BOOLREF(var) = VARIANT_FALSE;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+ole_set_byref(VARIANT *realvar, VARIANT *var, VARTYPE vt)
+{
+ V_VT(var) = vt;
+ if (vt == (VT_VARIANT|VT_BYREF)) {
+ V_VARIANTREF(var) = realvar;
+ } else {
+ if (V_VT(realvar) != (vt & ~VT_BYREF)) {
+ rb_raise(eWIN32OLERuntimeError, "variant type mismatch");
+ }
+ switch(vt & ~VT_BYREF) {
+ case VT_I1:
+ V_I1REF(var) = &V_I1(realvar);
+ break;
+ case VT_UI1:
+ V_UI1REF(var) = &V_UI1(realvar);
+ break;
+ case VT_I2:
+ V_I2REF(var) = &V_I2(realvar);
+ break;
+ case VT_UI2:
+ V_UI2REF(var) = &V_UI2(realvar);
+ break;
+ case VT_I4:
+ V_I4REF(var) = &V_I4(realvar);
+ break;
+ case VT_UI4:
+ V_UI4REF(var) = &V_UI4(realvar);
+ break;
+ case VT_R4:
+ V_R4REF(var) = &V_R4(realvar);
+ break;
+ case VT_R8:
+ V_R8REF(var) = &V_R8(realvar);
+ break;
+
+#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
+#ifdef V_I8REF
+ case VT_I8:
+ V_I8REF(var) = &V_I8(realvar);
+ break;
+#endif
+#ifdef V_UI8REF
+ case VT_UI8:
+ V_UI8REF(var) = &V_UI8(realvar);
+ break;
+#endif
+#endif
+ case VT_INT:
+ V_INTREF(var) = &V_INT(realvar);
+ break;
+
+ case VT_UINT:
+ V_UINTREF(var) = &V_UINT(realvar);
+ break;
+
+ case VT_CY:
+ V_CYREF(var) = &V_CY(realvar);
+ break;
+ case VT_DATE:
+ V_DATEREF(var) = &V_DATE(realvar);
+ break;
+ case VT_BSTR:
+ V_BSTRREF(var) = &V_BSTR(realvar);
+ break;
+ case VT_DISPATCH:
+ V_DISPATCHREF(var) = &V_DISPATCH(realvar);
+ break;
+ case VT_ERROR:
+ V_ERRORREF(var) = &V_ERROR(realvar);
+ break;
+ case VT_BOOL:
+ V_BOOLREF(var) = &V_BOOL(realvar);
+ break;
+ case VT_UNKNOWN:
+ V_UNKNOWNREF(var) = &V_UNKNOWN(realvar);
+ break;
+ case VT_ARRAY:
+ V_ARRAYREF(var) = &V_ARRAY(realvar);
+ break;
+ default:
+ rb_raise(eWIN32OLERuntimeError, "unknown type specified(setting BYREF):%d", vt);
+ break;
+ }
+ }
+}
+
+static void
+ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar)
+{
+ HRESULT hr = S_OK;
+
+ if (((vt & ~VT_BYREF) == (VT_ARRAY | VT_UI1)) && TYPE(val) == T_STRING) {
+ long len = RSTRING_LEN(val);
+ void *pdest = NULL;
+ SAFEARRAY *p = NULL;
+ SAFEARRAY *psa = SafeArrayCreateVector(VT_UI1, 0, len);
+ if (!psa) {
+ rb_raise(rb_eRuntimeError, "fail to SafeArrayCreateVector");
+ }
+ hr = SafeArrayAccessData(psa, &pdest);
+ if (SUCCEEDED(hr)) {
+ memcpy(pdest, RSTRING_PTR(val), len);
+ SafeArrayUnaccessData(psa);
+ V_VT(&(pvar->realvar)) = (vt & ~VT_BYREF);
+ p = V_ARRAY(&(pvar->realvar));
+ if (p != NULL) {
+ SafeArrayDestroy(p);
+ }
+ V_ARRAY(&(pvar->realvar)) = psa;
+ if (vt & VT_BYREF) {
+ V_VT(&(pvar->var)) = vt;
+ V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
+ } else {
+ hr = VariantCopy(&(pvar->var), &(pvar->realvar));
+ }
+ } else {
+ if (psa)
+ SafeArrayDestroy(psa);
+ }
+ } else if (vt & VT_ARRAY) {
+ if (val == Qnil) {
+ V_VT(&(pvar->var)) = vt;
+ if (vt & VT_BYREF) {
+ V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
+ }
+ } else {
+ hr = ole_val_ary2variant_ary(val, &(pvar->realvar), (VARTYPE)(vt & ~VT_BYREF));
+ if (SUCCEEDED(hr)) {
+ if (vt & VT_BYREF) {
+ V_VT(&(pvar->var)) = vt;
+ V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
+ } else {
+ hr = VariantCopy(&(pvar->var), &(pvar->realvar));
+ }
+ }
+ }
+#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
+ } else if ( (vt & ~VT_BYREF) == VT_I8 || (vt & ~VT_BYREF) == VT_UI8) {
+ ole_val2variant_ex(val, &(pvar->realvar), (vt & ~VT_BYREF));
+ ole_val2variant_ex(val, &(pvar->var), (vt & ~VT_BYREF));
+ V_VT(&(pvar->var)) = vt;
+ if (vt & VT_BYREF) {
+ ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
+ }
+#endif
+ } else {
+ if (val == Qnil) {
+ V_VT(&(pvar->var)) = vt;
+ if (vt == (VT_BYREF | VT_VARIANT)) {
+ ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
+ } else {
+ V_VT(&(pvar->realvar)) = vt & ~VT_BYREF;
+ if (vt & VT_BYREF) {
+ ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
+ }
+ }
+ } else {
+ ole_val2variant_ex(val, &(pvar->realvar), (VARTYPE)(vt & ~VT_BYREF));
+ if (vt == (VT_BYREF | VT_VARIANT)) {
+ ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
+ } else if (vt & VT_BYREF) {
+ if ( (vt & ~VT_BYREF) != V_VT(&(pvar->realvar))) {
+ hr = VariantChangeTypeEx(&(pvar->realvar), &(pvar->realvar),
+ cWIN32OLE_lcid, 0, (VARTYPE)(vt & ~VT_BYREF));
+ }
+ if (SUCCEEDED(hr)) {
+ ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
+ }
+ } else {
+ if (vt == V_VT(&(pvar->realvar))) {
+ hr = VariantCopy(&(pvar->var), &(pvar->realvar));
+ } else {
+ hr = VariantChangeTypeEx(&(pvar->var), &(pvar->realvar),
+ cWIN32OLE_lcid, 0, vt);
+ }
+ }
+ }
+ }
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to change type");
+ }
+}
+
+static void
ole_val2variant2(VALUE val, VARIANT *var)
{
g_nil_to = VT_EMPTY;
@@ -1311,7 +2011,7 @@ ole_val2variant2(VALUE val, VARIANT *var)
g_nil_to = VT_ERROR;
}
-VALUE
+static VALUE
make_inspect(const char *class_name, VALUE detail)
{
VALUE str;
@@ -1323,7 +2023,7 @@ make_inspect(const char *class_name, VALUE detail)
return str;
}
-VALUE
+static VALUE
default_inspect(VALUE self, const char *class_name)
{
VALUE detail = rb_funcall(self, rb_intern("to_s"), 0);
@@ -1333,8 +2033,8 @@ default_inspect(VALUE self, const char *class_name)
static VALUE
ole_set_member(VALUE self, IDispatch *dispatch)
{
- struct oledata *pole = NULL;
- pole = oledata_get_struct(self);
+ struct oledata *pole;
+ Data_Get_Struct(self, struct oledata, pole);
if (pole->pDispatch) {
OLE_RELEASE(pole->pDispatch);
pole->pDispatch = NULL;
@@ -1350,7 +2050,7 @@ fole_s_allocate(VALUE klass)
struct oledata *pole;
VALUE obj;
ole_initialize();
- obj = TypedData_Make_Struct(klass, struct oledata, &ole_datatype, pole);
+ obj = Data_Make_Struct(klass,struct oledata,0,ole_free,pole);
pole->pDispatch = NULL;
return obj;
}
@@ -1364,7 +2064,7 @@ create_win32ole_object(VALUE klass, IDispatch *pDispatch, int argc, VALUE *argv)
}
static VALUE
-ary_new_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim) {
+ary_new_dim(VALUE myary, long *pid, long *plb, long dim) {
long i;
VALUE obj = Qnil;
VALUE pobj = Qnil;
@@ -1390,28 +2090,24 @@ ary_new_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim) {
}
static void
-ary_store_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim, VALUE val) {
+ary_store_dim(VALUE myary, long *pid, long *plb, long dim, VALUE val) {
long id = pid[dim - 1] - plb[dim - 1];
VALUE obj = ary_new_dim(myary, pid, plb, dim);
rb_ary_store(obj, id, val);
}
-VALUE
+static VALUE
ole_variant2val(VARIANT *pvar)
{
VALUE obj = Qnil;
- VARTYPE vt = V_VT(pvar);
HRESULT hr;
- while ( vt == (VT_BYREF | VT_VARIANT) ) {
+ while ( V_VT(pvar) == (VT_BYREF | VT_VARIANT) )
pvar = V_VARIANTREF(pvar);
- vt = V_VT(pvar);
- }
if(V_ISARRAY(pvar)) {
- VARTYPE vt_base = vt & VT_TYPEMASK;
SAFEARRAY *psa = V_ISBYREF(pvar) ? *V_ARRAYREF(pvar) : V_ARRAY(pvar);
UINT i = 0;
- LONG *pid, *plb, *pub;
+ long *pid, *plb, *pub;
VARIANT variant;
VALUE val;
UINT dim = 0;
@@ -1419,9 +2115,12 @@ ole_variant2val(VARIANT *pvar)
return obj;
}
dim = SafeArrayGetDim(psa);
- pid = ALLOC_N(LONG, dim);
- plb = ALLOC_N(LONG, dim);
- pub = ALLOC_N(LONG, dim);
+ VariantInit(&variant);
+ V_VT(&variant) = (V_VT(pvar) & ~VT_ARRAY) | VT_BYREF;
+
+ pid = ALLOC_N(long, dim);
+ plb = ALLOC_N(long, dim);
+ pub = ALLOC_N(long, dim);
if(!pid || !plb || !pub) {
if(pid) free(pid);
@@ -1439,20 +2138,9 @@ ole_variant2val(VARIANT *pvar)
if (SUCCEEDED(hr)) {
obj = rb_ary_new();
i = 0;
- VariantInit(&variant);
- V_VT(&variant) = vt_base | VT_BYREF;
- if (vt_base == VT_RECORD) {
- hr = SafeArrayGetRecordInfo(psa, &V_RECORDINFO(&variant));
- if (SUCCEEDED(hr)) {
- V_VT(&variant) = VT_RECORD;
- }
- }
while (i < dim) {
ary_new_dim(obj, pid, plb, dim);
- if (vt_base == VT_RECORD)
- hr = SafeArrayPtrOfIndex(psa, pid, &V_RECORD(&variant));
- else
- hr = SafeArrayPtrOfIndex(psa, pid, &V_BYREF(&variant));
+ hr = SafeArrayPtrOfIndex(psa, pid, &V_BYREF(&variant));
if (SUCCEEDED(hr)) {
val = ole_variant2val(&variant);
ary_store_dim(obj, pid, plb, dim, val);
@@ -1574,16 +2262,10 @@ ole_variant2val(VARIANT *pvar)
case VT_BSTR:
{
- if(V_ISBYREF(pvar)) {
- obj = (SysStringLen(*V_BSTRREF(pvar)) == 0)
- ? rb_str_new2("")
- : ole_wc2vstr(*V_BSTRREF(pvar), FALSE);
- }
- else {
- obj = (SysStringLen(V_BSTR(pvar)) == 0)
- ? rb_str_new2("")
- : ole_wc2vstr(V_BSTR(pvar), FALSE);
- }
+ if(V_ISBYREF(pvar))
+ obj = ole_wc2vstr(*V_BSTRREF(pvar), FALSE);
+ else
+ obj = ole_wc2vstr(V_BSTR(pvar), FALSE);
break;
}
@@ -1651,15 +2333,6 @@ ole_variant2val(VARIANT *pvar)
obj = vtdate2rbtime(date);
break;
}
-
- case VT_RECORD:
- {
- IRecordInfo *pri = V_RECORDINFO(pvar);
- void *prec = V_RECORD(pvar);
- obj = create_win32ole_record(pri, prec);
- break;
- }
-
case VT_CY:
default:
{
@@ -1678,19 +2351,19 @@ ole_variant2val(VARIANT *pvar)
return obj;
}
-LONG
+static LONG
reg_open_key(HKEY hkey, const char *name, HKEY *phkey)
{
return RegOpenKeyEx(hkey, name, 0, KEY_READ, phkey);
}
-LONG
+static LONG
reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey)
{
return reg_open_key(hkey, StringValuePtr(key), phkey);
}
-VALUE
+static VALUE
reg_enum_key(HKEY hkey, DWORD i)
{
char buf[BUFSIZ + 1];
@@ -1705,7 +2378,7 @@ reg_enum_key(HKEY hkey, DWORD i)
return Qnil;
}
-VALUE
+static VALUE
reg_get_val(HKEY hkey, const char *subkey)
{
char *pbuf;
@@ -1733,7 +2406,7 @@ reg_get_val(HKEY hkey, const char *subkey)
return val;
}
-VALUE
+static VALUE
reg_get_val2(HKEY hkey, const char *subkey)
{
HKEY hsubkey;
@@ -1750,6 +2423,118 @@ reg_get_val2(HKEY hkey, const char *subkey)
return val;
}
+static VALUE
+reg_get_typelib_file_path(HKEY hkey)
+{
+ VALUE path = Qnil;
+ path = reg_get_val2(hkey, "win64");
+ if (path != Qnil) {
+ return path;
+ }
+ path = reg_get_val2(hkey, "win32");
+ if (path != Qnil) {
+ return path;
+ }
+ path = reg_get_val2(hkey, "win16");
+ return path;
+}
+
+static VALUE
+typelib_file_from_clsid(VALUE ole)
+{
+ HKEY hroot, hclsid;
+ LONG err;
+ VALUE typelib;
+ char path[MAX_PATH + 1];
+
+ err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hroot);
+ if (err != ERROR_SUCCESS) {
+ return Qnil;
+ }
+ err = reg_open_key(hroot, StringValuePtr(ole), &hclsid);
+ if (err != ERROR_SUCCESS) {
+ RegCloseKey(hroot);
+ return Qnil;
+ }
+ typelib = reg_get_val2(hclsid, "InprocServer32");
+ RegCloseKey(hroot);
+ RegCloseKey(hclsid);
+ if (typelib != Qnil) {
+ ExpandEnvironmentStrings(StringValuePtr(typelib), path, sizeof(path));
+ path[MAX_PATH] = '\0';
+ typelib = rb_str_new2(path);
+ }
+ return typelib;
+}
+
+static VALUE
+typelib_file_from_typelib(VALUE ole)
+{
+ HKEY htypelib, hclsid, hversion, hlang;
+ double fver;
+ DWORD i, j, k;
+ LONG err;
+ BOOL found = FALSE;
+ VALUE typelib;
+ VALUE file = Qnil;
+ VALUE clsid;
+ VALUE ver;
+ VALUE lang;
+
+ err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
+ if(err != ERROR_SUCCESS) {
+ return Qnil;
+ }
+ for(i = 0; !found; i++) {
+ clsid = reg_enum_key(htypelib, i);
+ if (clsid == Qnil)
+ break;
+ err = reg_open_vkey(htypelib, clsid, &hclsid);
+ if (err != ERROR_SUCCESS)
+ continue;
+ fver = 0;
+ for(j = 0; !found; j++) {
+ ver = reg_enum_key(hclsid, j);
+ if (ver == Qnil)
+ break;
+ err = reg_open_vkey(hclsid, ver, &hversion);
+ if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
+ continue;
+ fver = atof(StringValuePtr(ver));
+ typelib = reg_get_val(hversion, NULL);
+ if (typelib == Qnil)
+ continue;
+ if (rb_str_cmp(typelib, ole) == 0) {
+ for(k = 0; !found; k++) {
+ lang = reg_enum_key(hversion, k);
+ if (lang == Qnil)
+ break;
+ err = reg_open_vkey(hversion, lang, &hlang);
+ if (err == ERROR_SUCCESS) {
+ if ((file = reg_get_typelib_file_path(hlang)) != Qnil)
+ found = TRUE;
+ RegCloseKey(hlang);
+ }
+ }
+ }
+ RegCloseKey(hversion);
+ }
+ RegCloseKey(hclsid);
+ }
+ RegCloseKey(htypelib);
+ return file;
+}
+
+static VALUE
+typelib_file(VALUE ole)
+{
+ VALUE file = typelib_file_from_clsid(ole);
+ if (file != Qnil) {
+ return file;
+ }
+ return typelib_file_from_typelib(ole);
+}
+
static void
ole_const_load(ITypeLib *pTypeLib, VALUE klass, VALUE self)
{
@@ -1838,7 +2623,7 @@ clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid)
len = sizeof(clsid);
err = RegQueryValueEx(hpid, "", NULL, &dwtype, (BYTE *)clsid, &len);
if (err == ERROR_SUCCESS && dwtype == REG_SZ) {
- pbuf = ole_mb2wc(clsid, -1, cWIN32OLE_cp);
+ pbuf = ole_mb2wc(clsid, -1);
hr = CLSIDFromString(pbuf, pclsid);
SysFreeString(pbuf);
}
@@ -1852,8 +2637,9 @@ clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid)
}
static VALUE
-ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others)
+ole_create_dcom(int argc, VALUE *argv, VALUE self)
{
+ VALUE ole, host, others;
HRESULT hr;
CLSID clsid;
OLECHAR *pbuf;
@@ -1871,6 +2657,7 @@ ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others)
GetProcAddress(gole32, "CoCreateInstanceEx");
if (!gCoCreateInstanceEx)
rb_raise(rb_eRuntimeError, "CoCreateInstanceEx is not supported in this environment");
+ rb_scan_args(argc, argv, "2*", &ole, &host, &others);
pbuf = ole_vstr2wc(ole);
hr = CLSIDFromProgID(pbuf, &clsid);
@@ -1966,10 +2753,10 @@ fole_s_connect(int argc, VALUE *argv, VALUE self)
ole_initialize();
rb_scan_args(argc, argv, "1*", &svr_name, &others);
- StringValue(svr_name);
+ SafeStringValue(svr_name);
if (rb_safe_level() > 0 && OBJ_TAINTED(svr_name)) {
- rb_raise(rb_eSecurityError, "insecure connection - `%s'",
- StringValuePtr(svr_name));
+ rb_raise(rb_eSecurityError, "Insecure Object Connection - %s",
+ StringValuePtr(svr_name));
}
/* get CLSID from OLE server name */
@@ -2013,7 +2800,7 @@ fole_s_connect(int argc, VALUE *argv, VALUE self)
* so constant variable name of WIN32OLE object is capitalized.
* For example, the 'xlTop' constant of Excel is changed to 'XlTop'
* in WIN32OLE.
- * If the first letter of constant variable is not [A-Z], then
+ * If the first letter of constant variabl is not [A-Z], then
* the constant is defined as CONSTANTS hash element.
*
* module EXCEL_CONST
@@ -2036,7 +2823,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
{
VALUE ole;
VALUE klass;
- struct oledata *pole = NULL;
+ struct oledata *pole;
ITypeInfo *pTypeInfo;
ITypeLib *pTypeLib;
unsigned int index;
@@ -2046,13 +2833,13 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
LCID lcid = cWIN32OLE_lcid;
rb_scan_args(argc, argv, "11", &ole, &klass);
- if (!RB_TYPE_P(klass, T_CLASS) &&
- !RB_TYPE_P(klass, T_MODULE) &&
- !RB_TYPE_P(klass, T_NIL)) {
+ if (TYPE(klass) != T_CLASS &&
+ TYPE(klass) != T_MODULE &&
+ TYPE(klass) != T_NIL) {
rb_raise(rb_eTypeError, "2nd parameter must be Class or Module");
}
if (rb_obj_is_kind_of(ole, cWIN32OLE)) {
- pole = oledata_get_struct(ole);
+ OLEData_Get_Struct(ole, pole);
hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
0, lcid, &pTypeInfo);
if(FAILED(hr)) {
@@ -2064,7 +2851,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib");
}
OLE_RELEASE(pTypeInfo);
- if(!RB_TYPE_P(klass, T_NIL)) {
+ if(TYPE(klass) != T_NIL) {
ole_const_load(pTypeLib, klass, self);
}
else {
@@ -2072,7 +2859,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
}
OLE_RELEASE(pTypeLib);
}
- else if(RB_TYPE_P(ole, T_STRING)) {
+ else if(TYPE(ole) == T_STRING) {
file = typelib_file(ole);
if (file == Qnil) {
file = ole;
@@ -2082,7 +2869,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
SysFreeString(pBuf);
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to LoadTypeLibEx");
- if(!RB_TYPE_P(klass, T_NIL)) {
+ if(TYPE(klass) != T_NIL) {
ole_const_load(pTypeLib, klass, self);
}
else {
@@ -2096,6 +2883,37 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+static VALUE
+ole_types_from_typelib(ITypeLib *pTypeLib, VALUE classes)
+{
+
+ long count;
+ int i;
+ HRESULT hr;
+ BSTR bstr;
+ ITypeInfo *pTypeInfo;
+ VALUE type;
+
+ count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
+ for (i = 0; i < count; i++) {
+ hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
+ &bstr, NULL, NULL, NULL);
+ if (FAILED(hr))
+ continue;
+
+ hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
+ if (FAILED(hr))
+ continue;
+
+ type = foletype_s_allocate(cWIN32OLE_TYPE);
+ oletype_set_member(type, pTypeInfo, WC2VSTR(bstr));
+
+ rb_ary_push(classes, type);
+ OLE_RELEASE(pTypeInfo);
+ }
+ return classes;
+}
+
static ULONG
reference_count(struct oledata * pole)
{
@@ -2118,8 +2936,8 @@ reference_count(struct oledata * pole)
static VALUE
fole_s_reference_count(VALUE self, VALUE obj)
{
- struct oledata * pole = NULL;
- pole = oledata_get_struct(obj);
+ struct oledata * pole;
+ OLEData_Get_Struct(obj, pole);
return INT2NUM(reference_count(pole));
}
@@ -2136,8 +2954,8 @@ static VALUE
fole_s_free(VALUE self, VALUE obj)
{
ULONG n = 0;
- struct oledata * pole = NULL;
- pole = oledata_get_struct(obj);
+ struct oledata * pole;
+ OLEData_Get_Struct(obj, pole);
if(pole->pDispatch) {
if (reference_count(pole) > 0) {
n = OLE_RELEASE(pole->pDispatch);
@@ -2199,7 +3017,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self)
} else {
helpfile = target;
}
- if (!RB_TYPE_P(helpfile, T_STRING)) {
+ if (TYPE(helpfile) != T_STRING) {
rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)");
}
hwnd = ole_show_help(helpfile, helpcontext);
@@ -2270,7 +3088,7 @@ fole_s_set_code_page(VALUE self, VALUE vcp)
* WIN32OLE.locale -> locale id.
*
* Returns current locale id (lcid). The default locale is
- * WIN32OLE::LOCALE_SYSTEM_DEFAULT.
+ * LOCALE_SYSTEM_DEFAULT.
*
* lcid = WIN32OLE.locale
*/
@@ -2294,7 +3112,7 @@ static BOOL
lcid_installed(LCID lcid)
{
g_lcid_installed = FALSE;
- snprintf(g_lcid_to_check, sizeof(g_lcid_to_check), "%08lx", (unsigned long)lcid);
+ snprintf(g_lcid_to_check, sizeof(g_lcid_to_check), "%08lx", lcid);
EnumSystemLocales(installed_lcid_proc, LCID_INSTALLED);
return g_lcid_installed;
}
@@ -2356,10 +3174,10 @@ fole_s_create_guid(VALUE self)
/*
* WIN32OLE.ole_initialize and WIN32OLE.ole_uninitialize
* are used in win32ole.rb to fix the issue bug #2618 (ruby-core:27634).
- * You must not use these method.
+ * You must not use thease method.
*/
-/* :nodoc: */
+/* :nodoc */
static VALUE
fole_s_ole_initialize(VALUE self)
{
@@ -2367,7 +3185,7 @@ fole_s_ole_initialize(VALUE self)
return Qnil;
}
-/* :nodoc: */
+/* :nodoc */
static VALUE
fole_s_ole_uninitialize(VALUE self)
{
@@ -2404,22 +3222,15 @@ fole_s_ole_uninitialize(VALUE self)
* excel.ActiveWorkbook.Close(0);
* excel.Quit();
*
- * Unfortunately, Win32OLE doesn't support the argument passed by
- * reference directly.
- * Instead, Win32OLE provides WIN32OLE::ARGV or WIN32OLE_VARIANT object.
- * If you want to get the result value of argument passed by reference,
- * you can use WIN32OLE::ARGV or WIN32OLE_VARIANT.
+ * Unfortunately, Win32OLE doesn't support the argument passed by
+ * reference directly.
+ * Instead, Win32OLE provides WIN32OLE::ARGV.
+ * If you want to get the result value of argument passed by reference,
+ * you can use WIN32OLE::ARGV.
*
* oleobj.method(arg1, arg2, refargv3)
* puts WIN32OLE::ARGV[2] # the value of refargv3 after called oleobj.method
*
- * or
- *
- * refargv3 = WIN32OLE_VARIANT.new(XXX,
- * WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_XXX)
- * oleobj.method(arg1, arg2, refargv3)
- * p refargv3.value # the value of refargv3 after called oleobj.method.
- *
*/
/*
@@ -2449,18 +3260,18 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
rb_call_super(0, 0);
rb_scan_args(argc, argv, "11*", &svr_name, &host, &others);
- StringValue(svr_name);
+ SafeStringValue(svr_name);
if (rb_safe_level() > 0 && OBJ_TAINTED(svr_name)) {
- rb_raise(rb_eSecurityError, "insecure object creation - `%s'",
+ rb_raise(rb_eSecurityError, "Insecure Object Creation - %s",
StringValuePtr(svr_name));
}
if (!NIL_P(host)) {
- StringValue(host);
+ SafeStringValue(host);
if (rb_safe_level() > 0 && OBJ_TAINTED(host)) {
- rb_raise(rb_eSecurityError, "insecure object creation - `%s'",
- StringValuePtr(host));
+ rb_raise(rb_eSecurityError, "Insecure Object Creation - %s",
+ StringValuePtr(svr_name));
}
- return ole_create_dcom(self, svr_name, host, others);
+ return ole_create_dcom(argc, argv, self);
}
/* get CLSID from OLE server name */
@@ -2490,16 +3301,18 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-static int
-hash2named_arg(VALUE key, VALUE val, VALUE pop)
+static VALUE
+hash2named_arg(VALUE pair, struct oleparam* pOp)
{
- struct oleparam* pOp = (struct oleparam *)pop;
unsigned int index, i;
+ VALUE key, value;
index = pOp->dp.cNamedArgs;
+
/*---------------------------------------------
the data-type of key must be String or Symbol
-----------------------------------------------*/
- if(!RB_TYPE_P(key, T_STRING) && !RB_TYPE_P(key, T_SYMBOL)) {
+ key = rb_ary_entry(pair, 0);
+ if(TYPE(key) != T_STRING && TYPE(key) != T_SYMBOL) {
/* clear name of dispatch parameters */
for(i = 1; i < index + 1; i++) {
SysFreeString(pOp->pNamedArgs[i]);
@@ -2511,18 +3324,19 @@ hash2named_arg(VALUE key, VALUE val, VALUE pop)
/* raise an exception */
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
- if (RB_TYPE_P(key, T_SYMBOL)) {
- key = rb_sym2str(key);
+ if (TYPE(key) == T_SYMBOL) {
+ key = rb_sym_to_s(key);
}
/* pNamedArgs[0] is <method name>, so "index + 1" */
pOp->pNamedArgs[index + 1] = ole_vstr2wc(key);
+ value = rb_ary_entry(pair, 1);
VariantInit(&(pOp->dp.rgvarg[index]));
- ole_val2variant(val, &(pOp->dp.rgvarg[index]));
+ ole_val2variant(value, &(pOp->dp.rgvarg[index]));
pOp->dp.cNamedArgs += 1;
- return ST_CONTINUE;
+ return Qnil;
}
static VALUE
@@ -2534,9 +3348,7 @@ set_argv(VARIANTARG* realargs, unsigned int beg, unsigned int end)
rb_ary_clear(argv);
while (end-- > beg) {
rb_ary_push(argv, ole_variant2val(&realargs[end]));
- if (V_VT(&realargs[end]) != VT_RECORD) {
- VariantClear(&realargs[end]);
- }
+ VariantClear(&realargs[end]);
}
return argv;
}
@@ -2545,7 +3357,7 @@ static VALUE
ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
{
LCID lcid = cWIN32OLE_lcid;
- struct oledata *pole = NULL;
+ struct oledata *pole;
HRESULT hr;
VALUE cmd;
VALUE paramS;
@@ -2565,6 +3377,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
unsigned int cNamedArgs;
int n;
struct oleparam op;
+ struct olevariantdata *pvar;
memset(&excepinfo, 0, sizeof(EXCEPINFO));
VariantInit(&result);
@@ -2575,13 +3388,13 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
op.dp.cArgs = 0;
rb_scan_args(argc, argv, "1*", &cmd, &paramS);
- if(!RB_TYPE_P(cmd, T_STRING) && !RB_TYPE_P(cmd, T_SYMBOL) && !is_bracket) {
+ if(TYPE(cmd) != T_STRING && TYPE(cmd) != T_SYMBOL && !is_bracket) {
rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)");
}
- if (RB_TYPE_P(cmd, T_SYMBOL)) {
- cmd = rb_sym2str(cmd);
+ if (TYPE(cmd) == T_SYMBOL) {
+ cmd = rb_sym_to_s(cmd);
}
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
if(!pole->pDispatch) {
rb_raise(rb_eRuntimeError, "failed to get dispatch interface");
}
@@ -2607,16 +3420,15 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
op.dp.cNamedArgs = 0;
/* if last arg is hash object */
- if(RB_TYPE_P(param, T_HASH)) {
+ if(TYPE(param) == T_HASH) {
/*------------------------------------------
hash object ==> named dispatch parameters
--------------------------------------------*/
- cNamedArgs = rb_long2int(RHASH_SIZE(param));
+ cNamedArgs = NUM2INT(rb_funcall(param, rb_intern("length"), 0));
op.dp.cArgs = cNamedArgs + argc - 2;
op.pNamedArgs = ALLOCA_N(OLECHAR*, cNamedArgs + 1);
op.dp.rgvarg = ALLOCA_N(VARIANTARG, op.dp.cArgs);
-
- rb_hash_foreach(param, hash2named_arg, (VALUE)&op);
+ rb_block_call(param, rb_intern("each"), 0, 0, hash2named_arg, (VALUE)&op);
pDispID = ALLOCA_N(DISPID, cNamedArgs + 1);
op.pNamedArgs[0] = ole_vstr2wc(cmd);
@@ -2659,11 +3471,8 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
VariantInit(&op.dp.rgvarg[n]);
param = rb_ary_entry(paramS, i-cNamedArgs);
if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
- ole_variant2variant(param, &op.dp.rgvarg[n]);
- } else if (rb_obj_is_kind_of(param, cWIN32OLE_RECORD)) {
- ole_val2variant(param, &realargs[n]);
- op.dp.rgvarg[n] = realargs[n];
- V_VT(&op.dp.rgvarg[n]) = VT_RECORD | VT_BYREF;
+ Data_Get_Struct(param, struct olevariantdata, pvar);
+ VariantCopy(&op.dp.rgvarg[n], &(pvar->var));
} else {
ole_val2variant(param, &realargs[n]);
V_VT(&op.dp.rgvarg[n]) = VT_VARIANT | VT_BYREF;
@@ -2680,6 +3489,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
op.dp.rgdispidNamedArgs = ALLOCA_N( DISPID, 1 );
op.dp.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT;
}
+
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
&IID_NULL, lcid, wFlags, &op.dp,
&result, &excepinfo, &argErr);
@@ -2719,9 +3529,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
}
for(i = cNamedArgs; i < op.dp.cArgs; i++) {
n = op.dp.cArgs - i + cNamedArgs - 1;
- if (V_VT(&op.dp.rgvarg[n]) != VT_RECORD) {
- VariantClear(&op.dp.rgvarg[n]);
- }
+ VariantClear(&op.dp.rgvarg[n]);
}
}
@@ -2744,9 +3552,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
&excepinfo, &argErr);
for(i = cNamedArgs; i < op.dp.cArgs; i++) {
n = op.dp.cArgs - i + cNamedArgs - 1;
- if (V_VT(&op.dp.rgvarg[n]) != VT_RECORD) {
- VariantClear(&op.dp.rgvarg[n]);
- }
+ VariantClear(&op.dp.rgvarg[n]);
}
}
}
@@ -2759,9 +3565,6 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
param = rb_ary_entry(paramS, i-cNamedArgs);
if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
ole_val2variant(param, &realargs[n]);
- } else if ( rb_obj_is_kind_of(param, cWIN32OLE_RECORD) &&
- V_VT(&realargs[n]) == VT_RECORD ) {
- olerecord_set_ivar(param, V_RECORDINFO(&realargs[n]), V_RECORD(&realargs[n]));
}
}
set_argv(realargs, cNamedArgs, op.dp.cArgs);
@@ -2806,7 +3609,7 @@ static VALUE
ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
{
HRESULT hr;
- struct oledata *pole = NULL;
+ struct oledata *pole;
unsigned int argErr = 0;
EXCEPINFO excepinfo;
VARIANT result;
@@ -2824,7 +3627,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind)
memset(&excepinfo, 0, sizeof(EXCEPINFO));
memset(&dispParams, 0, sizeof(DISPPARAMS));
VariantInit(&result);
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
dispParams.cArgs = RARRAY_LEN(args);
dispParams.rgvarg = ALLOCA_N(VARIANTARG, dispParams.cArgs);
@@ -3114,7 +3917,7 @@ fole_getproperty_with_bracket(int argc, VALUE *argv, VALUE self)
static VALUE
ole_propertyput(VALUE self, VALUE property, VALUE value)
{
- struct oledata *pole = NULL;
+ struct oledata *pole;
unsigned argErr;
unsigned int index;
HRESULT hr;
@@ -3136,7 +3939,7 @@ ole_propertyput(VALUE self, VALUE property, VALUE value)
VariantInit(&propertyValue[1]);
memset(&excepinfo, 0, sizeof(excepinfo));
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
/* get ID from property name */
pBuf[0] = ole_vstr2wc(property);
@@ -3180,8 +3983,8 @@ ole_propertyput(VALUE self, VALUE property, VALUE value)
static VALUE
fole_free(VALUE self)
{
- struct oledata *pole = NULL;
- pole = oledata_get_struct(self);
+ struct oledata *pole;
+ OLEData_Get_Struct(self, pole);
OLE_FREE(pole->pDispatch);
pole->pDispatch = NULL;
return Qnil;
@@ -3230,7 +4033,7 @@ fole_each(VALUE self)
{
LCID lcid = cWIN32OLE_lcid;
- struct oledata *pole = NULL;
+ struct oledata *pole;
unsigned int argErr;
EXCEPINFO excepinfo;
@@ -3249,7 +4052,7 @@ fole_each(VALUE self)
dispParams.cArgs = 0;
memset(&excepinfo, 0, sizeof(excepinfo));
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DISPID_NEWENUM,
&IID_NULL, lcid,
DISPATCH_METHOD | DISPATCH_PROPERTYGET,
@@ -3291,18 +4094,16 @@ fole_each(VALUE self)
static VALUE
fole_missing(int argc, VALUE *argv, VALUE self)
{
- VALUE mid, sym;
+ ID id;
const char* mname;
- long n;
+ size_t n;
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
- mid = argv[0];
- sym = rb_check_symbol(&mid);
- if (!NIL_P(sym)) mid = rb_sym2str(sym);
- mname = StringValueCStr(mid);
+ id = rb_to_id(argv[0]);
+ mname = rb_id2name(id);
if(!mname) {
rb_raise(rb_eRuntimeError, "fail: unknown method or property");
}
- n = RSTRING_LEN(mid);
+ n = strlen(mname);
#if SIZEOF_SIZE_T > SIZEOF_LONG
if (n >= LONG_MAX) {
rb_raise(rb_eRuntimeError, "too long method or property name");
@@ -3310,16 +4111,151 @@ fole_missing(int argc, VALUE *argv, VALUE self)
#endif
if(mname[n-1] == '=') {
rb_check_arity(argc, 2, 2);
- argv[0] = rb_enc_str_new(mname, (n-1), cWIN32OLE_enc);
+ argv[0] = rb_enc_str_new(mname, (long)(n-1), cWIN32OLE_enc);
return ole_propertyput(self, argv[0], argv[1]);
}
else {
- argv[0] = rb_enc_str_new(mname, n, cWIN32OLE_enc);
+ argv[0] = rb_enc_str_new(mname, (long)n, cWIN32OLE_enc);
return ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET, FALSE);
}
}
+static VALUE
+ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE name)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ BSTR bstr;
+ FUNCDESC *pFuncDesc;
+ WORD i;
+ VALUE fname;
+ VALUE method = Qnil;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ }
+ for(i = 0; i < pTypeAttr->cFuncs && method == Qnil; i++) {
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
+ if (FAILED(hr))
+ continue;
+
+ hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
+ &bstr, NULL, NULL, NULL);
+ if (FAILED(hr)) {
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ continue;
+ }
+ fname = WC2VSTR(bstr);
+ if (strcasecmp(StringValuePtr(name), StringValuePtr(fname)) == 0) {
+ olemethod_set_member(self, pTypeInfo, pOwnerTypeInfo, i, fname);
+ method = self;
+ }
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ pFuncDesc=NULL;
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return method;
+}
+
+static VALUE
+olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ WORD i;
+ HREFTYPE href;
+ ITypeInfo *pRefTypeInfo;
+ VALUE method = Qnil;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ }
+ method = ole_method_sub(self, 0, pTypeInfo, name);
+ if (method != Qnil) {
+ return method;
+ }
+ for(i=0; i < pTypeAttr->cImplTypes && method == Qnil; i++){
+ hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
+ if(FAILED(hr))
+ continue;
+ hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
+ if (FAILED(hr))
+ continue;
+ method = ole_method_sub(self, pTypeInfo, pRefTypeInfo, name);
+ OLE_RELEASE(pRefTypeInfo);
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return method;
+}
+
+static VALUE
+ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, int mask)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ BSTR bstr;
+ FUNCDESC *pFuncDesc;
+ VALUE method;
+ WORD i;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ }
+ for(i = 0; i < pTypeAttr->cFuncs; i++) {
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
+ if (FAILED(hr))
+ continue;
+
+ hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
+ &bstr, NULL, NULL, NULL);
+ if (FAILED(hr)) {
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ continue;
+ }
+ if(pFuncDesc->invkind & mask) {
+ method = folemethod_s_allocate(cWIN32OLE_METHOD);
+ olemethod_set_member(method, pTypeInfo, pOwnerTypeInfo,
+ i, WC2VSTR(bstr));
+ rb_ary_push(methods, method);
+ }
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ pFuncDesc=NULL;
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+
+ return methods;
+}
+
+static VALUE
+ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ WORD i;
+ HREFTYPE href;
+ ITypeInfo *pRefTypeInfo;
+ VALUE methods = rb_ary_new();
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ }
+
+ ole_methods_sub(0, pTypeInfo, methods, mask);
+ for(i=0; i < pTypeAttr->cImplTypes; i++){
+ hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
+ if(FAILED(hr))
+ continue;
+ hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
+ if (FAILED(hr))
+ continue;
+ ole_methods_sub(pTypeInfo, pRefTypeInfo, methods, mask);
+ OLE_RELEASE(pRefTypeInfo);
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return methods;
+}
+
static HRESULT
typeinfo_from_ole(struct oledata *pole, ITypeInfo **ppti)
{
@@ -3367,9 +4303,9 @@ ole_methods(VALUE self, int mask)
ITypeInfo *pTypeInfo;
HRESULT hr;
VALUE methods;
- struct oledata *pole = NULL;
+ struct oledata *pole;
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
methods = rb_ary_new();
hr = typeinfo_from_ole(pole, &pTypeInfo);
@@ -3446,6 +4382,30 @@ fole_func_methods(VALUE self)
return ole_methods( self, INVOKE_FUNC);
}
+static VALUE
+ole_type_from_itypeinfo(ITypeInfo *pTypeInfo)
+{
+ ITypeLib *pTypeLib;
+ VALUE type = Qnil;
+ HRESULT hr;
+ unsigned int index;
+ BSTR bstr;
+
+ hr = pTypeInfo->lpVtbl->GetContainingTypeLib( pTypeInfo, &pTypeLib, &index );
+ if(FAILED(hr)) {
+ return Qnil;
+ }
+ hr = pTypeLib->lpVtbl->GetDocumentation( pTypeLib, index,
+ &bstr, NULL, NULL, NULL);
+ OLE_RELEASE(pTypeLib);
+ if (FAILED(hr)) {
+ return Qnil;
+ }
+ type = foletype_s_allocate(cWIN32OLE_TYPE);
+ oletype_set_member(type, pTypeInfo, WC2VSTR(bstr));
+ return type;
+}
+
/*
* call-seq:
* WIN32OLE#ole_type
@@ -3460,11 +4420,11 @@ fole_type(VALUE self)
{
ITypeInfo *pTypeInfo;
HRESULT hr;
- struct oledata *pole = NULL;
+ struct oledata *pole;
LCID lcid = cWIN32OLE_lcid;
VALUE type = Qnil;
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
hr = pole->pDispatch->lpVtbl->GetTypeInfo( pole->pDispatch, 0, lcid, &pTypeInfo );
if(FAILED(hr)) {
@@ -3478,6 +4438,23 @@ fole_type(VALUE self)
return type;
}
+static VALUE
+ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ ITypeLib *pTypeLib;
+ unsigned int index;
+ VALUE retval = Qnil;
+
+ hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &index);
+ if(FAILED(hr)) {
+ return Qnil;
+ }
+ retval = rb_funcall(cWIN32OLE_TYPELIB, rb_intern("allocate"), 0);
+ oletypelib_set_member(retval, pTypeLib);
+ return retval;
+}
+
/*
* call-seq:
* WIN32OLE#ole_typelib -> The WIN32OLE_TYPELIB object
@@ -3492,13 +4469,13 @@ fole_type(VALUE self)
static VALUE
fole_typelib(VALUE self)
{
- struct oledata *pole = NULL;
+ struct oledata *pole;
HRESULT hr;
ITypeInfo *pTypeInfo;
LCID lcid = cWIN32OLE_lcid;
VALUE vtlib = Qnil;
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
0, lcid, &pTypeInfo);
if(FAILED(hr)) {
@@ -3528,7 +4505,7 @@ fole_query_interface(VALUE self, VALUE str_iid)
HRESULT hr;
OLECHAR *pBuf;
IID iid;
- struct oledata *pole = NULL;
+ struct oledata *pole;
IDispatch *pDispatch;
void *p;
@@ -3541,7 +4518,7 @@ fole_query_interface(VALUE self, VALUE str_iid)
StringValuePtr(str_iid));
}
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
if(!pole->pDispatch) {
rb_raise(rb_eRuntimeError, "failed to get dispatch interface");
}
@@ -3570,17 +4547,17 @@ fole_query_interface(VALUE self, VALUE str_iid)
static VALUE
fole_respond_to(VALUE self, VALUE method)
{
- struct oledata *pole = NULL;
+ struct oledata *pole;
BSTR wcmdname;
DISPID DispID;
HRESULT hr;
- if(!RB_TYPE_P(method, T_STRING) && !RB_TYPE_P(method, T_SYMBOL)) {
- rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
+ if(TYPE(method) != T_STRING && TYPE(method) != T_SYMBOL) {
+ rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
- if (RB_TYPE_P(method, T_SYMBOL)) {
- method = rb_sym2str(method);
+ if (TYPE(method) == T_SYMBOL) {
+ method = rb_sym_to_s(method);
}
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
wcmdname = ole_vstr2wc(method);
hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
&wcmdname, 1, cWIN32OLE_lcid, &DispID);
@@ -3588,7 +4565,7 @@ fole_respond_to(VALUE self, VALUE method)
return SUCCEEDED(hr) ? Qtrue : Qfalse;
}
-HRESULT
+static HRESULT
ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile)
{
HRESULT hr;
@@ -3649,7 +4626,7 @@ ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
return type;
}
-VALUE
+static VALUE
ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
{
VALUE str;
@@ -3754,9 +4731,6 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
case VT_LPSTR:
typestr = rb_str_new2("LPSTR");
break;
- case VT_RECORD:
- typestr = rb_str_new2("RECORD");
- break;
default:
typestr = rb_str_new2("Unknown Type ");
rb_str_concat(typestr, rb_fix2str(INT2FIX(pTypeDesc->vt), 10));
@@ -3783,17 +4757,16 @@ fole_method_help(VALUE self, VALUE cmdname)
{
ITypeInfo *pTypeInfo;
HRESULT hr;
- struct oledata *pole = NULL;
- VALUE obj;
+ struct oledata *pole;
+ VALUE method, obj;
SafeStringValue(cmdname);
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
hr = typeinfo_from_ole(pole, &pTypeInfo);
if(FAILED(hr))
ole_raise(hr, rb_eRuntimeError, "failed to get ITypeInfo");
-
- obj = create_win32ole_method(pTypeInfo, cmdname);
-
+ method = folemethod_s_allocate(cWIN32OLE_METHOD);
+ obj = olemethod_from_typeinfo(method, pTypeInfo, cmdname);
OLE_RELEASE(pTypeInfo);
if (obj == Qnil)
rb_raise(eWIN32OLERuntimeError, "not found %s",
@@ -3824,13 +4797,13 @@ fole_method_help(VALUE self, VALUE cmdname)
static VALUE
fole_activex_initialize(VALUE self)
{
- struct oledata *pole = NULL;
+ struct oledata *pole;
IPersistMemory *pPersistMemory;
void *p;
HRESULT hr = S_OK;
- pole = oledata_get_struct(self);
+ OLEData_Get_Struct(self, pole);
hr = pole->pDispatch->lpVtbl->QueryInterface(pole->pDispatch, &IID_IPersistMemory, &p);
pPersistMemory = p;
@@ -3849,51 +4822,4305 @@ fole_activex_initialize(VALUE self)
return Qnil;
}
-HRESULT
-typelib_from_val(VALUE obj, ITypeLib **pTypeLib)
+/*
+ * call-seq:
+ * WIN32OLE_TYPE.ole_classes(typelib)
+ *
+ * Returns array of WIN32OLE_TYPE objects defined by the <i>typelib</i> type library.
+ * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib).ole_classes instead.
+ */
+static VALUE
+foletype_s_ole_classes(VALUE self, VALUE typelib)
{
+ VALUE obj;
+
+ /*
+ rb_warn("%s is obsolete; use %s instead.",
+ "WIN32OLE_TYPE.ole_classes",
+ "WIN32OLE_TYPELIB.new(typelib).ole_types");
+ */
+ obj = rb_funcall(cWIN32OLE_TYPELIB, rb_intern("new"), 1, typelib);
+ return rb_funcall(obj, rb_intern("ole_types"), 0);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE.typelibs
+ *
+ * Returns array of type libraries.
+ * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs.collect{|t| t.name} instead.
+ *
+ */
+static VALUE
+foletype_s_typelibs(VALUE self)
+{
+ /*
+ rb_warn("%s is obsolete. use %s instead.",
+ "WIN32OLE_TYPE.typelibs",
+ "WIN32OLE_TYPELIB.typelibs.collect{t|t.name}");
+ */
+ return rb_eval_string("WIN32OLE_TYPELIB.typelibs.collect{|t|t.name}");
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE.progids
+ *
+ * Returns array of ProgID.
+ */
+static VALUE
+foletype_s_progids(VALUE self)
+{
+ HKEY hclsids, hclsid;
+ DWORD i;
+ LONG err;
+ VALUE clsid;
+ VALUE v = rb_str_new2("");
+ VALUE progids = rb_ary_new();
+
+ err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hclsids);
+ if(err != ERROR_SUCCESS) {
+ return progids;
+ }
+ for(i = 0; ; i++) {
+ clsid = reg_enum_key(hclsids, i);
+ if (clsid == Qnil)
+ break;
+ err = reg_open_vkey(hclsids, clsid, &hclsid);
+ if (err != ERROR_SUCCESS)
+ continue;
+ if ((v = reg_get_val2(hclsid, "ProgID")) != Qnil)
+ rb_ary_push(progids, v);
+ if ((v = reg_get_val2(hclsid, "VersionIndependentProgID")) != Qnil)
+ rb_ary_push(progids, v);
+ RegCloseKey(hclsid);
+ }
+ RegCloseKey(hclsids);
+ return progids;
+}
+
+static VALUE
+foletype_s_allocate(VALUE klass)
+{
+ struct oletypedata *poletype;
+ VALUE obj;
+ ole_initialize();
+ obj = Data_Make_Struct(klass,struct oletypedata,0,oletype_free,poletype);
+ poletype->pTypeInfo = NULL;
+ return obj;
+}
+
+static VALUE
+oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ rb_ivar_set(self, rb_intern("name"), name);
+ ptype->pTypeInfo = pTypeInfo;
+ if(pTypeInfo) OLE_ADDREF(pTypeInfo);
+ return self;
+}
+
+static VALUE
+oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass)
+{
+
+ long count;
+ int i;
+ HRESULT hr;
+ BSTR bstr;
+ VALUE typelib;
+ ITypeInfo *pTypeInfo;
+
+ VALUE found = Qfalse;
+
+ count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
+ for (i = 0; i < count && found == Qfalse; i++) {
+ hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
+ if (FAILED(hr))
+ continue;
+ hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
+ &bstr, NULL, NULL, NULL);
+ if (FAILED(hr))
+ continue;
+ typelib = WC2VSTR(bstr);
+ if (rb_str_cmp(oleclass, typelib) == 0) {
+ oletype_set_member(self, pTypeInfo, typelib);
+ found = Qtrue;
+ }
+ OLE_RELEASE(pTypeInfo);
+ }
+ return found;
+}
+
+/*
+ * Document-class: WIN32OLE_TYPELIB
+ *
+ * <code>WIN32OLE_TYPELIB</code> objects represent OLE tyblib information.
+ */
+
+static VALUE
+oletypelib_set_member(VALUE self, ITypeLib *pTypeLib)
+{
+ struct oletypelibdata *ptlib;
+ Data_Get_Struct(self, struct oletypelibdata, ptlib);
+ ptlib->pTypeLib = pTypeLib;
+ return self;
+}
+
+static ITypeLib *
+oletypelib_get_typelib(VALUE self)
+{
+ struct oletypelibdata *ptlib;
+ Data_Get_Struct(self, struct oletypelibdata, ptlib);
+ return ptlib->pTypeLib;
+}
+
+static void
+oletypelib_get_libattr(ITypeLib *pTypeLib, TLIBATTR **ppTLibAttr)
+{
+ HRESULT hr;
+ hr = pTypeLib->lpVtbl->GetLibAttr(pTypeLib, ppTLibAttr);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError,
+ "failed to get library attribute(TLIBATTR) from ITypeLib");
+ }
+}
+
+/*
+ * call-seq:
+ *
+ * WIN32OLE_TYPELIB.typelibs
+ *
+ * Returns the array of WIN32OLE_TYPELIB object.
+ *
+ * tlibs = WIN32OLE_TYPELIB.typelibs
+ *
+ */
+static VALUE
+foletypelib_s_typelibs(VALUE self)
+{
+ HKEY htypelib, hguid;
+ DWORD i, j;
+ LONG err;
+ VALUE guid;
+ VALUE version;
+ VALUE name = Qnil;
+ VALUE typelibs = rb_ary_new();
+ VALUE typelib = Qnil;
+ HRESULT hr;
+ ITypeLib *pTypeLib;
+
+ err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
+ if(err != ERROR_SUCCESS) {
+ return typelibs;
+ }
+ for(i = 0; ; i++) {
+ guid = reg_enum_key(htypelib, i);
+ if (guid == Qnil)
+ break;
+ err = reg_open_vkey(htypelib, guid, &hguid);
+ if (err != ERROR_SUCCESS)
+ continue;
+ for(j = 0; ; j++) {
+ version = reg_enum_key(hguid, j);
+ if (version == Qnil)
+ break;
+ if ( (name = reg_get_val2(hguid, StringValuePtr(version))) != Qnil ) {
+ hr = oletypelib_from_guid(guid, version, &pTypeLib);
+ if (SUCCEEDED(hr)) {
+ typelib = rb_funcall(cWIN32OLE_TYPELIB, rb_intern("allocate"), 0);
+ oletypelib_set_member(typelib, pTypeLib);
+ rb_ary_push(typelibs, typelib);
+ }
+ }
+ }
+ RegCloseKey(hguid);
+ }
+ RegCloseKey(htypelib);
+ return typelibs;
+}
+
+static VALUE
+make_version_str(VALUE major, VALUE minor)
+{
+ VALUE version_str = Qnil;
+ VALUE minor_str = Qnil;
+ if (major == Qnil) {
+ return Qnil;
+ }
+ version_str = rb_String(major);
+ if (minor != Qnil) {
+ minor_str = rb_String(minor);
+ rb_str_cat2(version_str, ".");
+ rb_str_append(version_str, minor_str);
+ }
+ return version_str;
+}
+
+static VALUE
+oletypelib_search_registry2(VALUE self, VALUE args)
+{
+ HKEY htypelib, hguid, hversion;
+ double fver;
+ DWORD j;
+ LONG err;
+ VALUE found = Qfalse;
+ VALUE tlib;
+ VALUE ver;
+ VALUE version_str;
+ VALUE version = Qnil;
+ VALUE typelib = Qnil;
+ HRESULT hr;
+ ITypeLib *pTypeLib;
+
+ VALUE guid = rb_ary_entry(args, 0);
+ version_str = make_version_str(rb_ary_entry(args, 1), rb_ary_entry(args, 2));
+
+ err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
+ if(err != ERROR_SUCCESS) {
+ return Qfalse;
+ }
+ err = reg_open_vkey(htypelib, guid, &hguid);
+ if (err != ERROR_SUCCESS) {
+ RegCloseKey(htypelib);
+ return Qfalse;
+ }
+ if (version_str != Qnil) {
+ err = reg_open_vkey(hguid, version_str, &hversion);
+ if (err == ERROR_SUCCESS) {
+ tlib = reg_get_val(hversion, NULL);
+ if (tlib != Qnil) {
+ typelib = tlib;
+ version = version_str;
+ }
+ }
+ RegCloseKey(hversion);
+ } else {
+ fver = 0.0;
+ for(j = 0; ;j++) {
+ ver = reg_enum_key(hguid, j);
+ if (ver == Qnil)
+ break;
+ err = reg_open_vkey(hguid, ver, &hversion);
+ if (err != ERROR_SUCCESS)
+ continue;
+ tlib = reg_get_val(hversion, NULL);
+ if (tlib == Qnil) {
+ RegCloseKey(hversion);
+ continue;
+ }
+ if (fver < atof(StringValuePtr(ver))) {
+ fver = atof(StringValuePtr(ver));
+ version = ver;
+ typelib = tlib;
+ }
+ RegCloseKey(hversion);
+ }
+ }
+ RegCloseKey(hguid);
+ RegCloseKey(htypelib);
+ if (typelib != Qnil) {
+ hr = oletypelib_from_guid(guid, version, &pTypeLib);
+ if (SUCCEEDED(hr)) {
+ found = Qtrue;
+ oletypelib_set_member(self, pTypeLib);
+ }
+ }
+ return found;
+}
+
+static VALUE
+oletypelib_search_registry(VALUE self, VALUE typelib)
+{
+ HKEY htypelib, hguid, hversion;
+ DWORD i, j;
+ LONG err;
+ VALUE found = Qfalse;
+ VALUE tlib;
+ VALUE guid;
+ VALUE ver;
+ HRESULT hr;
+ ITypeLib *pTypeLib;
+
+ err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
+ if(err != ERROR_SUCCESS) {
+ return Qfalse;
+ }
+ for(i = 0; !found; i++) {
+ guid = reg_enum_key(htypelib, i);
+ if (guid == Qnil)
+ break;
+ err = reg_open_vkey(htypelib, guid, &hguid);
+ if (err != ERROR_SUCCESS)
+ continue;
+ for(j = 0; found == Qfalse; j++) {
+ ver = reg_enum_key(hguid, j);
+ if (ver == Qnil)
+ break;
+ err = reg_open_vkey(hguid, ver, &hversion);
+ if (err != ERROR_SUCCESS)
+ continue;
+ tlib = reg_get_val(hversion, NULL);
+ if (tlib == Qnil) {
+ RegCloseKey(hversion);
+ continue;
+ }
+ if (rb_str_cmp(typelib, tlib) == 0) {
+ hr = oletypelib_from_guid(guid, ver, &pTypeLib);
+ if (SUCCEEDED(hr)) {
+ oletypelib_set_member(self, pTypeLib);
+ found = Qtrue;
+ }
+ }
+ RegCloseKey(hversion);
+ }
+ RegCloseKey(hguid);
+ }
+ RegCloseKey(htypelib);
+ return found;
+}
+
+static VALUE
+foletypelib_s_allocate(VALUE klass)
+{
+ struct oletypelibdata *poletypelib;
+ VALUE obj;
+ ole_initialize();
+ obj = Data_Make_Struct(klass, struct oletypelibdata, 0, oletypelib_free, poletypelib);
+ poletypelib->pTypeLib = NULL;
+ return obj;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB.new(typelib [, version1, version2]) -> WIN32OLE_TYPELIB object
+ *
+ * Returns a new WIN32OLE_TYPELIB object.
+ *
+ * The first argument <i>typelib</i> specifies OLE type library name or GUID or
+ * OLE library file.
+ * The second argument is major version or version of the type library.
+ * The third argument is minor version.
+ * The second argument and third argument are optional.
+ * If the first argument is type library name, then the second and third argument
+ * are ignored.
+ *
+ * tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}')
+ * tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3)
+ * tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3)
+ * tlib5 = WIN32OLE_TYPELIB.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL")
+ * puts tlib1.name # -> 'Microsoft Excel 9.0 Object Library'
+ * puts tlib2.name # -> 'Microsoft Excel 9.0 Object Library'
+ * puts tlib3.name # -> 'Microsoft Excel 9.0 Object Library'
+ * puts tlib4.name # -> 'Microsoft Excel 9.0 Object Library'
+ * puts tlib5.name # -> 'Microsoft Shell Controls And Automation'
+ *
+ */
+static VALUE
+foletypelib_initialize(VALUE self, VALUE args)
+{
+ VALUE found = Qfalse;
+ VALUE typelib = Qnil;
+ int len = 0;
+ OLECHAR * pbuf;
+ ITypeLib *pTypeLib;
+ HRESULT hr = S_OK;
+
+ len = RARRAY_LEN(args);
+ if (len < 1 || len > 3) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..3)", len);
+ }
+
+ typelib = rb_ary_entry(args, 0);
+
+ SafeStringValue(typelib);
+
+ found = oletypelib_search_registry(self, typelib);
+ if (found == Qfalse) {
+ found = oletypelib_search_registry2(self, args);
+ }
+ if (found == Qfalse) {
+ pbuf = ole_vstr2wc(typelib);
+ hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
+ SysFreeString(pbuf);
+ if (SUCCEEDED(hr)) {
+ found = Qtrue;
+ oletypelib_set_member(self, pTypeLib);
+ }
+ }
+
+ if (found == Qfalse) {
+ rb_raise(eWIN32OLERuntimeError, "not found type library `%s`",
+ StringValuePtr(typelib));
+ }
+ return self;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#guid -> The guid string.
+ *
+ * Returns guid string which specifies type library.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * guid = tlib.guid # -> '{00020813-0000-0000-C000-000000000046}'
+ */
+static VALUE
+foletypelib_guid(VALUE self)
+{
+ ITypeLib *pTypeLib;
+ OLECHAR bstr[80];
+ VALUE guid = Qnil;
+ int len;
+ TLIBATTR *pTLibAttr;
+
+ pTypeLib = oletypelib_get_typelib(self);
+ oletypelib_get_libattr(pTypeLib, &pTLibAttr);
+ len = StringFromGUID2(&pTLibAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR));
+ if (len > 3) {
+ guid = ole_wc2vstr(bstr, FALSE);
+ }
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ return guid;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#name -> The type library name
+ *
+ * Returns the type library name.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * name = tlib.name # -> 'Microsoft Excel 9.0 Object Library'
+ */
+static VALUE
+foletypelib_name(VALUE self)
+{
+ ITypeLib *pTypeLib;
+ HRESULT hr;
+ BSTR bstr;
+ VALUE name;
+ pTypeLib = oletypelib_get_typelib(self);
+ hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, -1,
+ NULL, &bstr, NULL, NULL);
+
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to get name from ITypeLib");
+ }
+ name = WC2VSTR(bstr);
+ return name;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#version -> The type library version.
+ *
+ * Returns the type library version.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * puts tlib.version #-> 1.3
+ */
+static VALUE
+foletypelib_version(VALUE self)
+{
+ TLIBATTR *pTLibAttr;
+ VALUE major;
+ VALUE minor;
+ ITypeLib *pTypeLib;
+
+ pTypeLib = oletypelib_get_typelib(self);
+ oletypelib_get_libattr(pTypeLib, &pTLibAttr);
+ major = INT2NUM(pTLibAttr->wMajorVerNum);
+ minor = INT2NUM(pTLibAttr->wMinorVerNum);
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ return rb_Float(make_version_str(major, minor));
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#major_version -> The type library major version.
+ *
+ * Returns the type library major version.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * puts tlib.major_version # -> 1
+ */
+static VALUE
+foletypelib_major_version(VALUE self)
+{
+ TLIBATTR *pTLibAttr;
+ VALUE major;
+ ITypeLib *pTypeLib;
+ pTypeLib = oletypelib_get_typelib(self);
+ oletypelib_get_libattr(pTypeLib, &pTLibAttr);
+
+ major = INT2NUM(pTLibAttr->wMajorVerNum);
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ return major;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#minor_version -> The type library minor version.
+ *
+ * Returns the type library minor version.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * puts tlib.minor_version # -> 3
+ */
+static VALUE
+foletypelib_minor_version(VALUE self)
+{
+ TLIBATTR *pTLibAttr;
+ VALUE minor;
+ ITypeLib *pTypeLib;
+ pTypeLib = oletypelib_get_typelib(self);
+ oletypelib_get_libattr(pTypeLib, &pTLibAttr);
+ minor = INT2NUM(pTLibAttr->wMinorVerNum);
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ return minor;
+}
+
+static VALUE
+oletypelib_path(VALUE guid, VALUE version)
+{
+ int k;
+ LONG err;
+ HKEY hkey;
+ HKEY hlang;
+ VALUE lang;
+ VALUE path = Qnil;
+
+ VALUE key = rb_str_new2("TypeLib\\");
+ rb_str_concat(key, guid);
+ rb_str_cat2(key, "\\");
+ rb_str_concat(key, version);
+
+ err = reg_open_vkey(HKEY_CLASSES_ROOT, key, &hkey);
+ if (err != ERROR_SUCCESS) {
+ return Qnil;
+ }
+ for(k = 0; path == Qnil; k++) {
+ lang = reg_enum_key(hkey, k);
+ if (lang == Qnil)
+ break;
+ err = reg_open_vkey(hkey, lang, &hlang);
+ if (err == ERROR_SUCCESS) {
+ path = reg_get_typelib_file_path(hlang);
+ RegCloseKey(hlang);
+ }
+ }
+ RegCloseKey(hkey);
+ return path;
+}
+
+static HRESULT
+oletypelib_from_guid(VALUE guid, VALUE version, ITypeLib **ppTypeLib)
+{
+ VALUE path;
+ OLECHAR *pBuf;
+ HRESULT hr;
+ path = oletypelib_path(guid, version);
+ if (path == Qnil) {
+ return E_UNEXPECTED;
+ }
+ pBuf = ole_vstr2wc(path);
+ hr = LoadTypeLibEx(pBuf, REGKIND_NONE, ppTypeLib);
+ SysFreeString(pBuf);
+ return hr;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#path -> The type library file path.
+ *
+ * Returns the type library file path.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * puts tlib.path #-> 'C:\...\EXCEL9.OLB'
+ */
+static VALUE
+foletypelib_path(VALUE self)
+{
+ TLIBATTR *pTLibAttr;
+ HRESULT hr = S_OK;
+ BSTR bstr;
LCID lcid = cWIN32OLE_lcid;
+ VALUE path;
+ ITypeLib *pTypeLib;
+
+ pTypeLib = oletypelib_get_typelib(self);
+ oletypelib_get_libattr(pTypeLib, &pTLibAttr);
+ hr = QueryPathOfRegTypeLib(&pTLibAttr->guid,
+ pTLibAttr->wMajorVerNum,
+ pTLibAttr->wMinorVerNum,
+ lcid,
+ &bstr);
+ if (FAILED(hr)) {
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to QueryPathOfRegTypeTypeLib");
+ }
+
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ path = WC2VSTR(bstr);
+ return path;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#visible?
+ *
+ * Returns true if the type library information is not hidden.
+ * If wLibFlags of TLIBATTR is 0 or LIBFLAG_FRESTRICTED or LIBFLAG_FHIDDEN,
+ * the method returns false, otherwise, returns true.
+ * If the method fails to access the TLIBATTR information, then
+ * WIN32OLERuntimeError is raised.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * tlib.visible? # => true
+ */
+static VALUE
+foletypelib_visible(VALUE self)
+{
+ ITypeLib *pTypeLib = NULL;
+ VALUE visible = Qtrue;
+ TLIBATTR *pTLibAttr;
+
+ pTypeLib = oletypelib_get_typelib(self);
+ oletypelib_get_libattr(pTypeLib, &pTLibAttr);
+
+ if ((pTLibAttr->wLibFlags == 0) ||
+ (pTLibAttr->wLibFlags & LIBFLAG_FRESTRICTED) ||
+ (pTLibAttr->wLibFlags & LIBFLAG_FHIDDEN)) {
+ visible = Qfalse;
+ }
+ pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
+ return visible;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#library_name
+ *
+ * Returns library name.
+ * If the method fails to access library name, WIN32OLERuntimeError is raised.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * tlib.library_name # => Excel
+ */
+static VALUE
+foletypelib_library_name(VALUE self)
+{
+ HRESULT hr;
+ ITypeLib *pTypeLib = NULL;
+ VALUE libname = Qnil;
+ BSTR bstr;
+
+ pTypeLib = oletypelib_get_typelib(self);
+ hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, -1,
+ &bstr, NULL, NULL, NULL);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to get library name");
+ }
+ libname = WC2VSTR(bstr);
+ return libname;
+}
+
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#ole_types -> The array of WIN32OLE_TYPE object included the type library.
+ *
+ * Returns the type library file path.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...]
+ */
+static VALUE
+foletypelib_ole_types(VALUE self)
+{
+ ITypeLib *pTypeLib = NULL;
+ VALUE classes = rb_ary_new();
+ pTypeLib = oletypelib_get_typelib(self);
+ ole_types_from_typelib(pTypeLib, classes);
+ return classes;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPELIB#inspect -> String
+ *
+ * Returns the type library name with class name.
+ *
+ * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
+ * tlib.inspect # => "<#WIN32OLE_TYPELIB:Microsoft Excel 9.0 Object Library>"
+ */
+static VALUE
+foletypelib_inspect(VALUE self)
+{
+ return default_inspect(self, "WIN32OLE_TYPELIB");
+}
+
+/*
+ * Document-class: WIN32OLE_TYPE
+ *
+ * <code>WIN32OLE_TYPE</code> objects represent OLE type libarary information.
+ */
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE.new(typelib, ole_class) -> WIN32OLE_TYPE object
+ *
+ * Returns a new WIN32OLE_TYPE object.
+ * The first argument <i>typelib</i> specifies OLE type library name.
+ * The second argument specifies OLE class name.
+ *
+ * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
+ * # => WIN32OLE_TYPE object of Application class of Excel.
+ */
+static VALUE
+foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass)
+{
+ VALUE file;
+ OLECHAR * pbuf;
+ ITypeLib *pTypeLib;
+ HRESULT hr;
+
+ SafeStringValue(oleclass);
+ SafeStringValue(typelib);
+ file = typelib_file(typelib);
+ if (file == Qnil) {
+ file = typelib;
+ }
+ pbuf = ole_vstr2wc(file);
+ hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to LoadTypeLibEx");
+ SysFreeString(pbuf);
+ if (oleclass_from_typelib(self, pTypeLib, oleclass) == Qfalse) {
+ OLE_RELEASE(pTypeLib);
+ rb_raise(eWIN32OLERuntimeError, "not found `%s` in `%s`",
+ StringValuePtr(oleclass), StringValuePtr(typelib));
+ }
+ OLE_RELEASE(pTypeLib);
+ return self;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#name #=> OLE type name
+ *
+ * Returns OLE type name.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
+ * puts tobj.name # => Application
+ */
+static VALUE
+foletype_name(VALUE self)
+{
+ return rb_ivar_get(self, rb_intern("name"));
+}
+
+static VALUE
+ole_ole_type(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ VALUE type = Qnil;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if(FAILED(hr)){
+ return type;
+ }
+ switch(pTypeAttr->typekind) {
+ case TKIND_ENUM:
+ type = rb_str_new2("Enum");
+ break;
+ case TKIND_RECORD:
+ type = rb_str_new2("Record");
+ break;
+ case TKIND_MODULE:
+ type = rb_str_new2("Module");
+ break;
+ case TKIND_INTERFACE:
+ type = rb_str_new2("Interface");
+ break;
+ case TKIND_DISPATCH:
+ type = rb_str_new2("Dispatch");
+ break;
+ case TKIND_COCLASS:
+ type = rb_str_new2("Class");
+ break;
+ case TKIND_ALIAS:
+ type = rb_str_new2("Alias");
+ break;
+ case TKIND_UNION:
+ type = rb_str_new2("Union");
+ break;
+ case TKIND_MAX:
+ type = rb_str_new2("Max");
+ break;
+ default:
+ type = Qnil;
+ break;
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#ole_type #=> OLE type string.
+ *
+ * returns type of OLE class.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
+ * puts tobj.ole_type # => Class
+ */
+static VALUE
+foletype_ole_type(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_ole_type(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_guid(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ int len;
+ OLECHAR bstr[80];
+ VALUE guid = Qnil;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ return guid;
+ len = StringFromGUID2(&pTypeAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR));
+ if (len > 3) {
+ guid = ole_wc2vstr(bstr, FALSE);
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return guid;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#guid #=> GUID
+ *
+ * Returns GUID.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
+ * puts tobj.guid # => {00024500-0000-0000-C000-000000000046}
+ */
+static VALUE
+foletype_guid(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_guid(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_progid(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ OLECHAR *pbuf;
+ VALUE progid = Qnil;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ return progid;
+ hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf);
+ if (SUCCEEDED(hr)) {
+ progid = ole_wc2vstr(pbuf, FALSE);
+ CoTaskMemFree(pbuf);
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return progid;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#progid #=> ProgID
+ *
+ * Returns ProgID if it exists. If not found, then returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
+ * puts tobj.progid # => Excel.Application.9
+ */
+static VALUE
+foletype_progid(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_progid(ptype->pTypeInfo);
+}
+
+
+static VALUE
+ole_type_visible(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ VALUE visible;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ return Qtrue;
+ if (pTypeAttr->wTypeFlags & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) {
+ visible = Qfalse;
+ } else {
+ visible = Qtrue;
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return visible;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#visible? #=> true or false
+ *
+ * Returns true if the OLE class is public.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
+ * puts tobj.visible # => true
+ */
+static VALUE
+foletype_visible(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_visible(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_major_version(ITypeInfo *pTypeInfo)
+{
+ VALUE ver;
+ TYPEATTR *pTypeAttr;
+ HRESULT hr;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ ver = INT2FIX(pTypeAttr->wMajorVerNum);
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return ver;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#major_version
+ *
+ * Returns major version.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
+ * puts tobj.major_version # => 8
+ */
+static VALUE
+foletype_major_version(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_major_version(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_minor_version(ITypeInfo *pTypeInfo)
+{
+ VALUE ver;
+ TYPEATTR *pTypeAttr;
+ HRESULT hr;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ ver = INT2FIX(pTypeAttr->wMinorVerNum);
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return ver;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#minor_version #=> OLE minor version
+ *
+ * Returns minor version.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
+ * puts tobj.minor_version # => 2
+ */
+static VALUE
+foletype_minor_version(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_minor_version(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_typekind(ITypeInfo *pTypeInfo)
+{
+ VALUE typekind;
+ TYPEATTR *pTypeAttr;
+ HRESULT hr;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ typekind = INT2FIX(pTypeAttr->typekind);
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return typekind;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#typekind #=> number of type.
+ *
+ * Returns number which represents type.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
+ * puts tobj.typekind # => 4
+ *
+ */
+static VALUE
+foletype_typekind(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_typekind(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_helpstring(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ BSTR bhelpstr;
+ hr = ole_docinfo_from_type(pTypeInfo, NULL, &bhelpstr, NULL, NULL);
+ if(FAILED(hr)) {
+ return Qnil;
+ }
+ return WC2VSTR(bhelpstr);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#helpstring #=> help string.
+ *
+ * Returns help string.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
+ * puts tobj.helpstring # => Web Browser interface
+ */
+static VALUE
+foletype_helpstring(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_helpstring(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_src_type(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ VALUE alias = Qnil;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ return alias;
+ if(pTypeAttr->typekind != TKIND_ALIAS) {
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return alias;
+ }
+ alias = ole_typedesc2val(pTypeInfo, &(pTypeAttr->tdescAlias), Qnil);
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return alias;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#src_type #=> OLE source class
+ *
+ * Returns source class when the OLE class is 'Alias'.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType')
+ * puts tobj.src_type # => I4
+ *
+ */
+static VALUE
+foletype_src_type(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_src_type(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_helpfile(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ BSTR bhelpfile;
+ hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL, NULL, &bhelpfile);
+ if(FAILED(hr)) {
+ return Qnil;
+ }
+ return WC2VSTR(bhelpfile);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#helpfile
+ *
+ * Returns helpfile path. If helpfile is not found, then returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
+ * puts tobj.helpfile # => C:\...\VBAXL9.CHM
+ *
+ */
+static VALUE
+foletype_helpfile(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_helpfile(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_helpcontext(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ DWORD helpcontext;
+ hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL,
+ &helpcontext, NULL);
+ if(FAILED(hr))
+ return Qnil;
+ return INT2FIX(helpcontext);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#helpcontext
+ *
+ * Returns helpcontext. If helpcontext is not found, then returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
+ * puts tobj.helpfile # => 131185
+ */
+static VALUE
+foletype_helpcontext(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_helpcontext(ptype->pTypeInfo);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#ole_typelib
+ *
+ * Returns the WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE
+ * object. If it is not found, then returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
+ * puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library'
+ */
+static VALUE
+foletype_ole_typelib(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_typelib_from_itypeinfo(ptype->pTypeInfo);
+}
+
+static VALUE
+ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags)
+{
+ HRESULT hr;
+ ITypeInfo *pRefTypeInfo;
+ HREFTYPE href;
+ WORD i;
+ VALUE type;
+ TYPEATTR *pTypeAttr;
+ int flags;
+
+ VALUE types = rb_ary_new();
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr)) {
+ return types;
+ }
+ for (i = 0; i < pTypeAttr->cImplTypes; i++) {
+ hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
+ if (FAILED(hr))
+ continue;
+
+ hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
+ if (FAILED(hr))
+ continue;
+ hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
+ if (FAILED(hr))
+ continue;
+
+ if ((flags & implflags) == implflags) {
+ type = ole_type_from_itypeinfo(pRefTypeInfo);
+ if (type != Qnil) {
+ rb_ary_push(types, type);
+ }
+ }
+
+ OLE_RELEASE(pRefTypeInfo);
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return types;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#implemented_ole_types
+ *
+ * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
+ * object.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
+ * p tobj.implemented_ole_types # => [_Worksheet, DocEvents]
+ */
+static VALUE
+foletype_impl_ole_types(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_impl_ole_types(ptype->pTypeInfo, 0);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#source_ole_types
+ *
+ * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
+ * object and having IMPLTYPEFLAG_FSOURCE.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
+ * p tobj.source_ole_types
+ * # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>, #<WIN32OLE_TYPE:DWebBrowserEvents>]
+ */
+static VALUE
+foletype_source_ole_types(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_impl_ole_types(ptype->pTypeInfo, IMPLTYPEFLAG_FSOURCE);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#default_event_sources
+ *
+ * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
+ * object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
+ * p tobj.default_event_sources # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>]
+ */
+static VALUE
+foletype_default_event_sources(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_impl_ole_types(ptype->pTypeInfo, IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#default_ole_types
+ *
+ * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
+ * object and having IMPLTYPEFLAG_FDEFAULT.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
+ * p tobj.default_ole_types
+ * # => [#<WIN32OLE_TYPE:IWebBrowser2>, #<WIN32OLE_TYPE:DWebBrowserEvents2>]
+ */
+static VALUE
+foletype_default_ole_types(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_type_impl_ole_types(ptype->pTypeInfo, IMPLTYPEFLAG_FDEFAULT);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#inspect -> String
+ *
+ * Returns the type name with class name.
+ *
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ie.ole_type.inspect => #<WIN32OLE_TYPE:IWebBrowser2>
+ */
+static VALUE
+foletype_inspect(VALUE self)
+{
+ return default_inspect(self, "WIN32OLE_TYPE");
+}
+
+static VALUE
+ole_variables(ITypeInfo *pTypeInfo)
+{
+ HRESULT hr;
+ TYPEATTR *pTypeAttr;
+ WORD i;
+ UINT len;
+ BSTR bstr;
+ VARDESC *pVarDesc;
+ struct olevariabledata *pvar;
+ VALUE var;
+ VALUE variables = rb_ary_new();
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
+ }
+
+ for(i = 0; i < pTypeAttr->cVars; i++) {
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, i, &pVarDesc);
+ if(FAILED(hr))
+ continue;
+ len = 0;
+ hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pVarDesc->memid, &bstr,
+ 1, &len);
+ if(FAILED(hr) || len == 0 || !bstr)
+ continue;
+
+ var = Data_Make_Struct(cWIN32OLE_VARIABLE, struct olevariabledata,
+ 0,olevariable_free,pvar);
+ pvar->pTypeInfo = pTypeInfo;
+ OLE_ADDREF(pTypeInfo);
+ pvar->index = i;
+ rb_ivar_set(var, rb_intern("name"), WC2VSTR(bstr));
+ rb_ary_push(variables, var);
+
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ pVarDesc = NULL;
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return variables;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#variables
+ *
+ * Returns array of WIN32OLE_VARIABLE objects which represent variables
+ * defined in OLE class.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * vars = tobj.variables
+ * vars.each do |v|
+ * puts "#{v.name} = #{v.value}"
+ * end
+ *
+ * The result of above sample script is follows:
+ * xlChart = -4109
+ * xlDialogSheet = -4116
+ * xlExcel4IntlMacroSheet = 4
+ * xlExcel4MacroSheet = 3
+ * xlWorksheet = -4167
+ *
+ */
+static VALUE
+foletype_variables(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_variables(ptype->pTypeInfo);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_TYPE#ole_methods # the array of WIN32OLE_METHOD objects.
+ *
+ * Returns array of WIN32OLE_METHOD objects which represent OLE method defined in
+ * OLE type library.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
+ * methods = tobj.ole_methods.collect{|m|
+ * m.name
+ * }
+ * # => ['Activate', 'Copy', 'Delete',....]
+ */
+static VALUE
+foletype_methods(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, ptype);
+ return ole_methods_from_typeinfo(ptype->pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
+}
+
+/*
+ * Document-class: WIN32OLE_VARIABLE
+ *
+ * <code>WIN32OLE_VARIABLE</code> objects represent OLE variable information.
+ */
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#name
+ *
+ * Returns the name of variable.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * variables = tobj.variables
+ * variables.each do |variable|
+ * puts "#{variable.name}"
+ * end
+ *
+ * The result of above script is following:
+ * xlChart
+ * xlDialogSheet
+ * xlExcel4IntlMacroSheet
+ * xlExcel4MacroSheet
+ * xlWorksheet
+ *
+ */
+static VALUE
+folevariable_name(VALUE self)
+{
+ return rb_ivar_get(self, rb_intern("name"));
+}
+
+static VALUE
+ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index)
+{
+ VARDESC *pVarDesc;
HRESULT hr;
- struct oledata *pole = NULL;
+ VALUE type;
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetVarDesc");
+ type = ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), Qnil);
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#ole_type
+ *
+ * Returns OLE type string.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * variables = tobj.variables
+ * variables.each do |variable|
+ * puts "#{variable.ole_type} #{variable.name}"
+ * end
+ *
+ * The result of above script is following:
+ * INT xlChart
+ * INT xlDialogSheet
+ * INT xlExcel4IntlMacroSheet
+ * INT xlExcel4MacroSheet
+ * INT xlWorksheet
+ *
+ */
+static VALUE
+folevariable_ole_type(VALUE self)
+{
+ struct olevariabledata *pvar;
+ Data_Get_Struct(self, struct olevariabledata, pvar);
+ return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
+}
+
+static VALUE
+ole_variable_ole_type_detail(ITypeInfo *pTypeInfo, UINT var_index)
+{
+ VARDESC *pVarDesc;
+ HRESULT hr;
+ VALUE type = rb_ary_new();
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetVarDesc");
+ ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), type);
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#ole_type_detail
+ *
+ * Returns detail information of type. The information is array of type.
+ *
+ * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
+ * variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
+ * tdetail = variable.ole_type_detail
+ * p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]
+ *
+ */
+static VALUE
+folevariable_ole_type_detail(VALUE self)
+{
+ struct olevariabledata *pvar;
+ Data_Get_Struct(self, struct olevariabledata, pvar);
+ return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
+}
+
+static VALUE
+ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index)
+{
+ VARDESC *pVarDesc;
+ HRESULT hr;
+ VALUE val = Qnil;
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
+ if (FAILED(hr))
+ return Qnil;
+ if(pVarDesc->varkind == VAR_CONST)
+ val = ole_variant2val(V_UNION1(pVarDesc, lpvarValue));
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ return val;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#value
+ *
+ * Returns value if value is exists. If the value does not exist,
+ * this method returns nil.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * variables = tobj.variables
+ * variables.each do |variable|
+ * puts "#{variable.name} #{variable.value}"
+ * end
+ *
+ * The result of above script is following:
+ * xlChart = -4109
+ * xlDialogSheet = -4116
+ * xlExcel4IntlMacroSheet = 4
+ * xlExcel4MacroSheet = 3
+ * xlWorksheet = -4167
+ *
+ */
+static VALUE
+folevariable_value(VALUE self)
+{
+ struct olevariabledata *pvar;
+ Data_Get_Struct(self, struct olevariabledata, pvar);
+ return ole_variable_value(pvar->pTypeInfo, pvar->index);
+}
+
+static VALUE
+ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index)
+{
+ VARDESC *pVarDesc;
+ HRESULT hr;
+ VALUE visible = Qfalse;
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
+ if (FAILED(hr))
+ return visible;
+ if (!(pVarDesc->wVarFlags & (VARFLAG_FHIDDEN |
+ VARFLAG_FRESTRICTED |
+ VARFLAG_FNONBROWSABLE))) {
+ visible = Qtrue;
+ }
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ return visible;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#visible?
+ *
+ * Returns true if the variable is public.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * variables = tobj.variables
+ * variables.each do |variable|
+ * puts "#{variable.name} #{variable.visible?}"
+ * end
+ *
+ * The result of above script is following:
+ * xlChart true
+ * xlDialogSheet true
+ * xlExcel4IntlMacroSheet true
+ * xlExcel4MacroSheet true
+ * xlWorksheet true
+ *
+ */
+static VALUE
+folevariable_visible(VALUE self)
+{
+ struct olevariabledata *pvar;
+ Data_Get_Struct(self, struct olevariabledata, pvar);
+ return ole_variable_visible(pvar->pTypeInfo, pvar->index);
+}
+
+static VALUE
+ole_variable_kind(ITypeInfo *pTypeInfo, UINT var_index)
+{
+ VARDESC *pVarDesc;
+ HRESULT hr;
+ VALUE kind = rb_str_new2("UNKNOWN");
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
+ if (FAILED(hr))
+ return kind;
+ switch(pVarDesc->varkind) {
+ case VAR_PERINSTANCE:
+ kind = rb_str_new2("PERINSTANCE");
+ break;
+ case VAR_STATIC:
+ kind = rb_str_new2("STATIC");
+ break;
+ case VAR_CONST:
+ kind = rb_str_new2("CONSTANT");
+ break;
+ case VAR_DISPATCH:
+ kind = rb_str_new2("DISPATCH");
+ break;
+ default:
+ break;
+ }
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ return kind;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#variable_kind
+ *
+ * Returns variable kind string.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * variables = tobj.variables
+ * variables.each do |variable|
+ * puts "#{variable.name} #{variable.variable_kind}"
+ * end
+ *
+ * The result of above script is following:
+ * xlChart CONSTANT
+ * xlDialogSheet CONSTANT
+ * xlExcel4IntlMacroSheet CONSTANT
+ * xlExcel4MacroSheet CONSTANT
+ * xlWorksheet CONSTANT
+ */
+static VALUE
+folevariable_variable_kind(VALUE self)
+{
+ struct olevariabledata *pvar;
+ Data_Get_Struct(self, struct olevariabledata, pvar);
+ return ole_variable_kind(pvar->pTypeInfo, pvar->index);
+}
+
+static VALUE
+ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index)
+{
+ VARDESC *pVarDesc;
+ HRESULT hr;
+ VALUE kind = Qnil;
+ hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
+ if (FAILED(hr))
+ return kind;
+ pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
+ kind = INT2FIX(pVarDesc->varkind);
+ return kind;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#varkind
+ *
+ * Returns the number which represents variable kind.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
+ * variables = tobj.variables
+ * variables.each do |variable|
+ * puts "#{variable.name} #{variable.varkind}"
+ * end
+ *
+ * The result of above script is following:
+ * xlChart 2
+ * xlDialogSheet 2
+ * xlExcel4IntlMacroSheet 2
+ * xlExcel4MacroSheet 2
+ * xlWorksheet 2
+ */
+static VALUE
+folevariable_varkind(VALUE self)
+{
+ struct olevariabledata *pvar;
+ Data_Get_Struct(self, struct olevariabledata, pvar);
+ return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIABLE#inspect -> String
+ *
+ * Returns the OLE variable name and the value with class name.
+ *
+ */
+static VALUE
+folevariable_inspect(VALUE self)
+{
+ VALUE detail = rb_funcall(self, rb_intern("to_s"), 0);
+ rb_str_cat2(detail, "=");
+ rb_str_concat(detail, rb_funcall(rb_funcall(self, rb_intern("value"), 0), rb_intern("inspect"), 0));
+ return make_inspect("WIN32OLE_VARIABLE", detail);
+}
+
+/*
+ * Document-class: WIN32OLE_METHOD
+ *
+ * <code>WIN32OLE_METHOD</code> objects represent OLE method information.
+ */
+
+static VALUE
+olemethod_set_member(VALUE self, ITypeInfo *pTypeInfo, ITypeInfo *pOwnerTypeInfo, int index, VALUE name)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ pmethod->pTypeInfo = pTypeInfo;
+ OLE_ADDREF(pTypeInfo);
+ pmethod->pOwnerTypeInfo = pOwnerTypeInfo;
+ if(pOwnerTypeInfo) OLE_ADDREF(pOwnerTypeInfo);
+ pmethod->index = index;
+ rb_ivar_set(self, rb_intern("name"), name);
+ return self;
+}
+
+static VALUE
+folemethod_s_allocate(VALUE klass)
+{
+ struct olemethoddata *pmethod;
+ VALUE obj;
+ obj = Data_Make_Struct(klass,
+ struct olemethoddata,
+ 0, olemethod_free, pmethod);
+ pmethod->pTypeInfo = NULL;
+ pmethod->pOwnerTypeInfo = NULL;
+ pmethod->index = 0;
+ return obj;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD.new(ole_type, method) -> WIN32OLE_METHOD object
+ *
+ * Returns a new WIN32OLE_METHOD object which represents the information
+ * about OLE method.
+ * The first argument <i>ole_type</i> specifies WIN32OLE_TYPE object.
+ * The second argument <i>method</i> specifies OLE method name defined OLE class
+ * which represents WIN32OLE_TYPE object.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ */
+static VALUE
+folemethod_initialize(VALUE self, VALUE oletype, VALUE method)
+{
+ struct oletypedata *ptype;
+ VALUE obj = Qnil;
+ if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) {
+ SafeStringValue(method);
+ Data_Get_Struct(oletype, struct oletypedata, ptype);
+ obj = olemethod_from_typeinfo(self, ptype->pTypeInfo, method);
+ if (obj == Qnil) {
+ rb_raise(eWIN32OLERuntimeError, "not found %s",
+ StringValuePtr(method));
+ }
+ }
+ else {
+ rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object");
+ }
+ return obj;
+}
+
+/*
+ * call-seq
+ * WIN32OLE_METHOD#name
+ *
+ * Returns the name of the method.
+ *
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * puts method.name # => SaveAs
+ *
+ */
+static VALUE
+folemethod_name(VALUE self)
+{
+ return rb_ivar_get(self, rb_intern("name"));
+}
+
+static VALUE
+ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE type;
+
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
+
+ type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#return_type
+ *
+ * Returns string of return value type of method.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.return_type # => Workbook
+ *
+ */
+static VALUE
+folemethod_return_type(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_return_type(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE vvt;
+
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
+
+ vvt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return vvt;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#return_vtype
+ *
+ * Returns number of return value type of method.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.return_vtype # => 26
+ *
+ */
+static VALUE
+folemethod_return_vtype(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_return_vtype(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE type = rb_ary_new();
+
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return type;
+
+ ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), type);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#return_type_detail
+ *
+ * Returns detail information of return value type of method.
+ * The information is array.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"]
+ */
+static VALUE
+folemethod_return_type_detail(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_return_type_detail(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE invkind;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if(FAILED(hr))
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
+ invkind = INT2FIX(pFuncDesc->invkind);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return invkind;
+}
+
+static VALUE
+ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ VALUE type = rb_str_new2("UNKNOWN");
+ VALUE invkind = ole_method_invkind(pTypeInfo, method_index);
+ if((FIX2INT(invkind) & INVOKE_PROPERTYGET) &&
+ (FIX2INT(invkind) & INVOKE_PROPERTYPUT) ) {
+ type = rb_str_new2("PROPERTY");
+ } else if(FIX2INT(invkind) & INVOKE_PROPERTYGET) {
+ type = rb_str_new2("PROPERTYGET");
+ } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUT) {
+ type = rb_str_new2("PROPERTYPUT");
+ } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUTREF) {
+ type = rb_str_new2("PROPERTYPUTREF");
+ } else if(FIX2INT(invkind) & INVOKE_FUNC) {
+ type = rb_str_new2("FUNC");
+ }
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_MTHOD#invkind
+ *
+ * Returns the method invoke kind.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.invkind # => 1
+ *
+ */
+static VALUE
+folemethod_invkind(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_invkind(pmethod->pTypeInfo, pmethod->index);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#invoke_kind
+ *
+ * Returns the method kind string. The string is "UNKNOWN" or "PROPERTY"
+ * or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF"
+ * or "FUNC".
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.invoke_kind # => "FUNC"
+ */
+static VALUE
+folemethod_invoke_kind(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_invoke_kind(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE visible;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if(FAILED(hr))
+ return Qfalse;
+ if (pFuncDesc->wFuncFlags & (FUNCFLAG_FRESTRICTED |
+ FUNCFLAG_FHIDDEN |
+ FUNCFLAG_FNONBROWSABLE)) {
+ visible = Qfalse;
+ } else {
+ visible = Qtrue;
+ }
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return visible;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#visible?
+ *
+ * Returns true if the method is public.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.visible? # => true
+ */
+static VALUE
+folemethod_visible(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name)
+{
+ TYPEATTR *pTypeAttr;
+ HRESULT hr;
+ WORD i;
+ int flags;
+ HREFTYPE href;
+ ITypeInfo *pRefTypeInfo;
+ FUNCDESC *pFuncDesc;
+ BSTR bstr;
+ VALUE name;
+ VALUE event = Qfalse;
+
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+ if (FAILED(hr))
+ return event;
+ if(pTypeAttr->typekind != TKIND_COCLASS) {
+ pTypeInfo->lpVtbl->ReleaseTypeAttr(pTypeInfo, pTypeAttr);
+ return event;
+ }
+ for (i = 0; i < pTypeAttr->cImplTypes; i++) {
+ hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
+ if (FAILED(hr))
+ continue;
+
+ if (flags & IMPLTYPEFLAG_FSOURCE) {
+ hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
+ i, &href);
+ if (FAILED(hr))
+ continue;
+ hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
+ href, &pRefTypeInfo);
+ if (FAILED(hr))
+ continue;
+ hr = pRefTypeInfo->lpVtbl->GetFuncDesc(pRefTypeInfo, method_index,
+ &pFuncDesc);
+ if (FAILED(hr)) {
+ OLE_RELEASE(pRefTypeInfo);
+ continue;
+ }
+
+ hr = pRefTypeInfo->lpVtbl->GetDocumentation(pRefTypeInfo,
+ pFuncDesc->memid,
+ &bstr, NULL, NULL, NULL);
+ if (FAILED(hr)) {
+ pRefTypeInfo->lpVtbl->ReleaseFuncDesc(pRefTypeInfo, pFuncDesc);
+ OLE_RELEASE(pRefTypeInfo);
+ continue;
+ }
+
+ name = WC2VSTR(bstr);
+ pRefTypeInfo->lpVtbl->ReleaseFuncDesc(pRefTypeInfo, pFuncDesc);
+ OLE_RELEASE(pRefTypeInfo);
+ if (rb_str_cmp(method_name, name) == 0) {
+ event = Qtrue;
+ break;
+ }
+ }
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ return event;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#event?
+ *
+ * Returns true if the method is event.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
+ * puts method.event? # => true
+ *
+ */
+static VALUE
+folemethod_event(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ if (!pmethod->pOwnerTypeInfo)
+ return Qfalse;
+ return ole_method_event(pmethod->pOwnerTypeInfo,
+ pmethod->index,
+ rb_ivar_get(self, rb_intern("name")));
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#event_interface
+ *
+ * Returns event interface name if the method is event.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
+ * puts method.event_interface # => WorkbookEvents
+ */
+static VALUE
+folemethod_event_interface(VALUE self)
+{
+ BSTR name;
+ struct olemethoddata *pmethod;
+ HRESULT hr;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ if(folemethod_event(self) == Qtrue) {
+ hr = ole_docinfo_from_type(pmethod->pTypeInfo, &name, NULL, NULL, NULL);
+ if(SUCCEEDED(hr))
+ return WC2VSTR(name);
+ }
+ return Qnil;
+}
+
+static HRESULT
+ole_method_docinfo_from_type(
+ ITypeInfo *pTypeInfo,
+ UINT method_index,
+ BSTR *name,
+ BSTR *helpstr,
+ DWORD *helpcontext,
+ BSTR *helpfile
+ )
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return hr;
+ hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
+ name, helpstr,
+ helpcontext, helpfile);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return hr;
+}
+
+static VALUE
+ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ HRESULT hr;
+ BSTR bhelpstring;
+ hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, &bhelpstring,
+ NULL, NULL);
+ if (FAILED(hr))
+ return Qnil;
+ return WC2VSTR(bhelpstring);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#helpstring
+ *
+ * Returns help string of OLE method. If the help string is not found,
+ * then the method returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
+ * method = WIN32OLE_METHOD.new(tobj, 'Navigate')
+ * puts method.helpstring # => Navigates to a URL or file.
+ *
+ */
+static VALUE
+folemethod_helpstring(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_helpstring(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ HRESULT hr;
+ BSTR bhelpfile;
+ hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL,
+ NULL, &bhelpfile);
+ if (FAILED(hr))
+ return Qnil;
+ return WC2VSTR(bhelpfile);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#helpfile
+ *
+ * Returns help file. If help file is not found, then
+ * the method returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.helpfile # => C:\...\VBAXL9.CHM
+ */
+static VALUE
+folemethod_helpfile(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+
+ return ole_method_helpfile(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ HRESULT hr;
+ DWORD helpcontext = 0;
+ hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL,
+ &helpcontext, NULL);
+ if (FAILED(hr))
+ return Qnil;
+ return INT2FIX(helpcontext);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#helpcontext
+ *
+ * Returns help context.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.helpcontext # => 65717
+ */
+static VALUE
+folemethod_helpcontext(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_helpcontext(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE dispid = Qnil;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return dispid;
+ dispid = INT2NUM(pFuncDesc->memid);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return dispid;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#dispid
+ *
+ * Returns dispatch ID.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.dispid # => 181
+ */
+static VALUE
+folemethod_dispid(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_dispid(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE offset_vtbl = Qnil;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return offset_vtbl;
+ offset_vtbl = INT2FIX(pFuncDesc->oVft);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return offset_vtbl;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#offset_vtbl
+ *
+ * Returns the offset ov VTBL.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
+ * method = WIN32OLE_METHOD.new(tobj, 'Add')
+ * puts method.offset_vtbl # => 40
+ */
+static VALUE
+folemethod_offset_vtbl(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_offset_vtbl(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE size_params = Qnil;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return size_params;
+ size_params = INT2FIX(pFuncDesc->cParams);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return size_params;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#size_params
+ *
+ * Returns the size of arguments of the method.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * puts method.size_params # => 11
+ *
+ */
+static VALUE
+folemethod_size_params(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_size_params(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE size_opt_params = Qnil;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return size_opt_params;
+ size_opt_params = INT2FIX(pFuncDesc->cParamsOpt);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return size_opt_params;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#size_opt_params
+ *
+ * Returns the size of optional parameters.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * puts method.size_opt_params # => 4
+ */
+static VALUE
+folemethod_size_opt_params(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_size_opt_params(pmethod->pTypeInfo, pmethod->index);
+}
+
+static VALUE
+ole_method_params(ITypeInfo *pTypeInfo, UINT method_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ BSTR *bstrs;
+ UINT len, i;
+ struct oleparamdata *pparam;
+ VALUE param;
+ VALUE params = rb_ary_new();
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return params;
+
+ len = 0;
+ bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1);
+ hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid,
+ bstrs, pFuncDesc->cParams + 1,
+ &len);
+ if (FAILED(hr)) {
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return params;
+ }
+ SysFreeString(bstrs[0]);
+ if (pFuncDesc->cParams > 0) {
+ for(i = 1; i < len; i++) {
+ param = Data_Make_Struct(cWIN32OLE_PARAM, struct oleparamdata, 0,
+ oleparam_free, pparam);
+ pparam->pTypeInfo = pTypeInfo;
+ OLE_ADDREF(pTypeInfo);
+ pparam->method_index = method_index;
+ pparam->index = i - 1;
+ rb_ivar_set(param, rb_intern("name"), WC2VSTR(bstrs[i]));
+ rb_ary_push(params, param);
+ }
+ }
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return params;
+}
+
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#params
+ *
+ * returns array of WIN32OLE_PARAM object corresponding with method parameters.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * p method.params # => [Filename, FileFormat, Password, WriteResPassword,
+ * ReadOnlyRecommended, CreateBackup, AccessMode,
+ * ConflictResolution, AddToMru, TextCodepage,
+ * TextVisualLayout]
+ */
+static VALUE
+folemethod_params(VALUE self)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(self, struct olemethoddata, pmethod);
+ return ole_method_params(pmethod->pTypeInfo, pmethod->index);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_METHOD#inspect -> String
+ *
+ * Returns the method name with class name.
+ *
+ */
+static VALUE
+folemethod_inspect(VALUE self)
+{
+ return default_inspect(self, "WIN32OLE_METHOD");
+}
+
+/*
+ * Document-class: WIN32OLE_PARAM
+ *
+ * <code>WIN32OLE_PARAM</code> objects represent param information of
+ * the OLE method.
+ */
+static VALUE foleparam_s_allocate(VALUE klass)
+{
+ struct oleparamdata *pparam;
+ VALUE obj;
+ obj = Data_Make_Struct(klass,
+ struct oleparamdata,
+ 0, oleparam_free, pparam);
+ pparam->pTypeInfo = NULL;
+ pparam->method_index = 0;
+ pparam->index = 0;
+ return obj;
+}
+
+static VALUE
+oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_index, int param_index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ BSTR *bstrs;
+ UINT len;
+ struct oleparamdata *pparam;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ ole_raise(hr, rb_eRuntimeError, "fail to ITypeInfo::GetFuncDesc");
+
+ len = 0;
+ bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1);
+ hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid,
+ bstrs, pFuncDesc->cParams + 1,
+ &len);
+ if (FAILED(hr)) {
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ ole_raise(hr, rb_eRuntimeError, "fail to ITypeInfo::GetNames");
+ }
+ SysFreeString(bstrs[0]);
+ if (param_index < 1 || len <= (UINT)param_index)
+ {
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ rb_raise(rb_eIndexError, "index of param must be in 1..%d", len);
+ }
+
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ pparam->pTypeInfo = pTypeInfo;
+ OLE_ADDREF(pTypeInfo);
+ pparam->method_index = method_index;
+ pparam->index = param_index - 1;
+ rb_ivar_set(self, rb_intern("name"), WC2VSTR(bstrs[param_index]));
+
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return self;
+}
+
+static VALUE oleparam_ole_param(VALUE self, VALUE olemethod, int n)
+{
+ struct olemethoddata *pmethod;
+ Data_Get_Struct(olemethod, struct olemethoddata, pmethod);
+ return oleparam_ole_param_from_index(self, pmethod->pTypeInfo, pmethod->index, n);
+}
+
+static VALUE foleparam_initialize(VALUE self, VALUE olemethod, VALUE n)
+{
+ int idx;
+ if (!rb_obj_is_kind_of(olemethod, cWIN32OLE_METHOD)) {
+ rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE_METHOD object");
+ }
+ idx = FIX2INT(n);
+ return oleparam_ole_param(self, olemethod, idx);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#name
+ *
+ * Returns name.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * param1 = method.params[0]
+ * puts param1.name # => Filename
+ */
+static VALUE
+foleparam_name(VALUE self)
+{
+ return rb_ivar_get(self, rb_intern("name"));
+}
+
+static VALUE
+ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE type = rb_str_new2("unknown type");
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return type;
+ type = ole_typedesc2val(pTypeInfo,
+ &(pFuncDesc->lprgelemdescParam[index].tdesc), Qnil);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return type;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#ole_type
+ *
+ * Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method).
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * param1 = method.params[0]
+ * puts param1.ole_type # => VARIANT
+ */
+static VALUE
+foleparam_ole_type(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index,
+ pparam->index);
+}
+
+static VALUE
+ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE typedetail = rb_ary_new();
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return typedetail;
+ ole_typedesc2val(pTypeInfo,
+ &(pFuncDesc->lprgelemdescParam[index].tdesc), typedetail);
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return typedetail;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#ole_type_detail
+ *
+ * Returns detail information of type of argument.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
+ * method = WIN32OLE_METHOD.new(tobj, 'SumIf')
+ * param1 = method.params[0]
+ * p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]
+ */
+static VALUE
+foleparam_ole_type_detail(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_ole_type_detail(pparam->pTypeInfo, pparam->method_index,
+ pparam->index);
+}
+
+static VALUE
+ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT mask)
+{
+ FUNCDESC *pFuncDesc;
+ HRESULT hr;
+ VALUE ret = Qfalse;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if(FAILED(hr))
+ return ret;
+ if (V_UNION1((&(pFuncDesc->lprgelemdescParam[index])), paramdesc).wParamFlags &mask)
+ ret = Qtrue;
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return ret;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#input?
+ *
+ * Returns true if the parameter is input.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * param1 = method.params[0]
+ * puts param1.input? # => true
+ */
+static VALUE foleparam_input(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
+ pparam->index, PARAMFLAG_FIN);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE#output?
+ *
+ * Returns true if argument is output.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
+ * method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
+ * method.params.each do |param|
+ * puts "#{param.name} #{param.output?}"
+ * end
+ *
+ * The result of above script is following:
+ * URL false
+ * Flags false
+ * TargetFrameName false
+ * PostData false
+ * Headers false
+ * Processed true
+ */
+static VALUE foleparam_output(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
+ pparam->index, PARAMFLAG_FOUT);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#optional?
+ *
+ * Returns true if argument is optional.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * param1 = method.params[0]
+ * puts "#{param1.name} #{param1.optional?}" # => Filename true
+ */
+static VALUE foleparam_optional(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
+ pparam->index, PARAMFLAG_FOPT);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#retval?
+ *
+ * Returns true if argument is return value.
+ * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library',
+ * 'DirectPlayLobbyConnection')
+ * method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName')
+ * param = method.params[0]
+ * puts "#{param.name} #{param.retval?}" # => name true
+ */
+static VALUE foleparam_retval(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
+ pparam->index, PARAMFLAG_FRETVAL);
+}
+
+static VALUE
+ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
+{
+ FUNCDESC *pFuncDesc;
+ ELEMDESC *pElemDesc;
+ PARAMDESCEX * pParamDescEx;
+ HRESULT hr;
+ USHORT wParamFlags;
+ USHORT mask = PARAMFLAG_FOPT|PARAMFLAG_FHASDEFAULT;
+ VALUE defval = Qnil;
+ hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
+ if (FAILED(hr))
+ return defval;
+ pElemDesc = &pFuncDesc->lprgelemdescParam[index];
+ wParamFlags = V_UNION1(pElemDesc, paramdesc).wParamFlags;
+ if ((wParamFlags & mask) == mask) {
+ pParamDescEx = V_UNION1(pElemDesc, paramdesc).pparamdescex;
+ defval = ole_variant2val(&pParamDescEx->varDefaultValue);
+ }
+ pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
+ return defval;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#default
+ *
+ * Returns default value. If the default value does not exist,
+ * this method returns nil.
+ * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
+ * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
+ * method.params.each do |param|
+ * if param.default
+ * puts "#{param.name} (= #{param.default})"
+ * else
+ * puts "#{param}"
+ * end
+ * end
+ *
+ * The above script result is following:
+ * Filename
+ * FileFormat
+ * Password
+ * WriteResPassword
+ * ReadOnlyRecommended
+ * CreateBackup
+ * AccessMode (= 1)
+ * ConflictResolution
+ * AddToMru
+ * TextCodepage
+ * TextVisualLayout
+ */
+static VALUE foleparam_default(VALUE self)
+{
+ struct oleparamdata *pparam;
+ Data_Get_Struct(self, struct oleparamdata, pparam);
+ return ole_param_default(pparam->pTypeInfo, pparam->method_index,
+ pparam->index);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_PARAM#inspect -> String
+ *
+ * Returns the parameter name with class name. If the parameter has default value,
+ * then returns name=value string with class name.
+ *
+ */
+static VALUE
+foleparam_inspect(VALUE self)
+{
+ VALUE detail = foleparam_name(self);
+ VALUE defval = foleparam_default(self);
+ if (defval != Qnil) {
+ rb_str_cat2(detail, "=");
+ rb_str_concat(detail, rb_funcall(defval, rb_intern("inspect"), 0));
+ }
+ return make_inspect("WIN32OLE_PARAM", detail);
+}
+
+/*
+ * Document-class: WIN32OLE_EVENT
+ *
+ * <code>WIN32OLE_EVENT</code> objects controls OLE event.
+ */
+
+static IEventSinkVtbl vtEventSink;
+static BOOL g_IsEventSinkVtblInitialized = FALSE;
+
+void EVENTSINK_Destructor(PIEVENTSINKOBJ);
+
+STDMETHODIMP
+EVENTSINK_QueryInterface(
+ PEVENTSINK pEV,
+ REFIID iid,
+ LPVOID* ppv
+ ) {
+ if (IsEqualIID(iid, &IID_IUnknown) ||
+ IsEqualIID(iid, &IID_IDispatch) ||
+ IsEqualIID(iid, &((PIEVENTSINKOBJ)pEV)->m_iid)) {
+ *ppv = pEV;
+ }
+ else {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+ ((LPUNKNOWN)*ppv)->lpVtbl->AddRef((LPUNKNOWN)*ppv);
+ return NOERROR;
+}
+
+STDMETHODIMP_(ULONG)
+EVENTSINK_AddRef(
+ PEVENTSINK pEV
+ ){
+ PIEVENTSINKOBJ pEVObj = (PIEVENTSINKOBJ)pEV;
+ return ++pEVObj->m_cRef;
+}
+
+STDMETHODIMP_(ULONG) EVENTSINK_Release(
+ PEVENTSINK pEV
+ ) {
+ PIEVENTSINKOBJ pEVObj = (PIEVENTSINKOBJ)pEV;
+ --pEVObj->m_cRef;
+ if(pEVObj->m_cRef != 0)
+ return pEVObj->m_cRef;
+ EVENTSINK_Destructor(pEVObj);
+ return 0;
+}
+
+STDMETHODIMP EVENTSINK_GetTypeInfoCount(
+ PEVENTSINK pEV,
+ UINT *pct
+ ) {
+ *pct = 0;
+ return NOERROR;
+}
+
+STDMETHODIMP EVENTSINK_GetTypeInfo(
+ PEVENTSINK pEV,
+ UINT info,
+ LCID lcid,
+ ITypeInfo **pInfo
+ ) {
+ *pInfo = NULL;
+ return DISP_E_BADINDEX;
+}
+
+STDMETHODIMP EVENTSINK_GetIDsOfNames(
+ PEVENTSINK pEventSink,
+ REFIID riid,
+ OLECHAR **szNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *pDispID
+ ) {
+ ITypeInfo *pTypeInfo;
+ PIEVENTSINKOBJ pEV = (PIEVENTSINKOBJ)pEventSink;
+ pTypeInfo = pEV->pTypeInfo;
+ if (pTypeInfo) {
+ return pTypeInfo->lpVtbl->GetIDsOfNames(pTypeInfo, szNames, cNames, pDispID);
+ }
+ return DISP_E_UNKNOWNNAME;
+}
+
+static long
+ole_search_event_at(VALUE ary, VALUE ev)
+{
+ VALUE event;
+ VALUE event_name;
+ long i, len;
+ long ret = -1;
+ len = RARRAY_LEN(ary);
+ for(i = 0; i < len; i++) {
+ event = rb_ary_entry(ary, i);
+ event_name = rb_ary_entry(event, 1);
+ if(NIL_P(event_name) && NIL_P(ev)) {
+ ret = i;
+ break;
+ }
+ else if (TYPE(ev) == T_STRING &&
+ TYPE(event_name) == T_STRING &&
+ rb_str_cmp(ev, event_name) == 0) {
+ ret = i;
+ break;
+ }
+ }
+ return ret;
+}
+
+static VALUE
+ole_search_event(VALUE ary, VALUE ev, BOOL *is_default)
+{
+ VALUE event;
+ VALUE def_event;
+ VALUE event_name;
+ int i, len;
+ *is_default = FALSE;
+ def_event = Qnil;
+ len = RARRAY_LEN(ary);
+ for(i = 0; i < len; i++) {
+ event = rb_ary_entry(ary, i);
+ event_name = rb_ary_entry(event, 1);
+ if(NIL_P(event_name)) {
+ *is_default = TRUE;
+ def_event = event;
+ }
+ else if (rb_str_cmp(ev, event_name) == 0) {
+ *is_default = FALSE;
+ return event;
+ }
+ }
+ return def_event;
+}
+static VALUE
+ole_search_handler_method(VALUE handler, VALUE ev, BOOL *is_default_handler)
+{
+ VALUE mid;
+
+ *is_default_handler = FALSE;
+ mid = rb_to_id(rb_sprintf("on%s", StringValuePtr(ev)));
+ if (rb_respond_to(handler, mid)) {
+ return mid;
+ }
+ mid = rb_intern("method_missing");
+ if (rb_respond_to(handler, mid)) {
+ *is_default_handler = TRUE;
+ return mid;
+ }
+ return Qnil;
+}
+
+static void
+ole_delete_event(VALUE ary, VALUE ev)
+{
+ long at = -1;
+ at = ole_search_event_at(ary, ev);
+ if (at >= 0) {
+ rb_ary_delete_at(ary, at);
+ }
+}
+
+static void
+hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS *pdispparams)
+{
+ BSTR *bstrs;
+ HRESULT hr;
+ UINT len, i;
+ VARIANT *pvar;
+ VALUE val;
+ VALUE key;
+ len = 0;
+ bstrs = ALLOCA_N(BSTR, pdispparams->cArgs + 1);
+ hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid,
+ bstrs, pdispparams->cArgs + 1,
+ &len);
+ if (FAILED(hr))
+ return;
+
+ for (i = 0; i < len - 1; i++) {
+ key = WC2VSTR(bstrs[i + 1]);
+ val = rb_hash_aref(hash, INT2FIX(i));
+ if (val == Qnil)
+ val = rb_hash_aref(hash, key);
+ if (val == Qnil)
+ val = rb_hash_aref(hash, rb_str_intern(key));
+ pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
+ ole_val2ptr_variant(val, pvar);
+ }
+}
+
+static VALUE
+hash2result(VALUE hash)
+{
+ VALUE ret = Qnil;
+ ret = rb_hash_aref(hash, rb_str_new2("return"));
+ if (ret == Qnil)
+ ret = rb_hash_aref(hash, rb_str_intern(rb_str_new2("return")));
+ return ret;
+}
+
+static void
+ary2ptr_dispparams(VALUE ary, DISPPARAMS *pdispparams)
+{
+ int i;
+ VALUE v;
+ VARIANT *pvar;
+ for(i = 0; i < RARRAY_LEN(ary) && (unsigned int) i < pdispparams->cArgs; i++) {
+ v = rb_ary_entry(ary, i);
+ pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
+ ole_val2ptr_variant(v, pvar);
+ }
+}
+
+static VALUE
+exec_callback(VALUE arg)
+{
+ VALUE *parg = (VALUE *)arg;
+ VALUE handler = parg[0];
+ VALUE mid = parg[1];
+ VALUE args = parg[2];
+ return rb_apply(handler, mid, args);
+}
+
+static VALUE
+rescue_callback(VALUE arg)
+{
+
+ VALUE error;
+ VALUE e = rb_errinfo();
+ VALUE bt = rb_funcall(e, rb_intern("backtrace"), 0);
+ VALUE msg = rb_funcall(e, rb_intern("message"), 0);
+ bt = rb_ary_entry(bt, 0);
+ error = rb_sprintf("%s: %s (%s)\n", StringValuePtr(bt), StringValuePtr(msg), rb_obj_classname(e));
+ rb_write_error(StringValuePtr(error));
+ rb_backtrace();
+ ruby_finalize();
+ exit(-1);
+
+ return Qnil;
+}
+
+STDMETHODIMP EVENTSINK_Invoke(
+ PEVENTSINK pEventSink,
+ DISPID dispid,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pdispparams,
+ VARIANT *pvarResult,
+ EXCEPINFO *pexcepinfo,
+ UINT *puArgErr
+ ) {
+
+ HRESULT hr;
+ BSTR bstr;
+ unsigned int count;
+ unsigned int i;
+ ITypeInfo *pTypeInfo;
+ VARIANT *pvar;
+ VALUE ary, obj, event, args, outargv, ev, result;
+ VALUE handler = Qnil;
+ VALUE arg[3];
+ VALUE mid;
+ VALUE is_outarg = Qfalse;
+ BOOL is_default_handler = FALSE;
+ int state;
+
+ PIEVENTSINKOBJ pEV = (PIEVENTSINKOBJ)pEventSink;
+ pTypeInfo = pEV->pTypeInfo;
+ obj = evs_entry(pEV->m_event_id);
+ if (!rb_obj_is_kind_of(obj, cWIN32OLE_EVENT)) {
+ return NOERROR;
+ }
+
+ ary = rb_ivar_get(obj, id_events);
+ if (NIL_P(ary) || TYPE(ary) != T_ARRAY) {
+ return NOERROR;
+ }
+ hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid,
+ &bstr, 1, &count);
+ if (FAILED(hr)) {
+ return NOERROR;
+ }
+ ev = WC2VSTR(bstr);
+ event = ole_search_event(ary, ev, &is_default_handler);
+ if (TYPE(event) == T_ARRAY) {
+ handler = rb_ary_entry(event, 0);
+ mid = rb_intern("call");
+ is_outarg = rb_ary_entry(event, 3);
+ } else {
+ handler = rb_ivar_get(obj, rb_intern("handler"));
+ if (handler == Qnil) {
+ return NOERROR;
+ }
+ mid = ole_search_handler_method(handler, ev, &is_default_handler);
+ }
+ if (handler == Qnil || mid == Qnil) {
+ return NOERROR;
+ }
+
+ args = rb_ary_new();
+ if (is_default_handler) {
+ rb_ary_push(args, ev);
+ }
+
+ /* make argument of event handler */
+ for (i = 0; i < pdispparams->cArgs; ++i) {
+ pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
+ rb_ary_push(args, ole_variant2val(pvar));
+ }
+ outargv = Qnil;
+ if (is_outarg == Qtrue) {
+ outargv = rb_ary_new();
+ rb_ary_push(args, outargv);
+ }
+
+ /*
+ * if exception raised in event callback,
+ * then you receive cfp consistency error.
+ * to avoid this error we use begin rescue end.
+ * and the exception raised then error message print
+ * and exit ruby process by Win32OLE itself.
+ */
+ arg[0] = handler;
+ arg[1] = mid;
+ arg[2] = args;
+ result = rb_protect(exec_callback, (VALUE)arg, &state);
+ if (state != 0) {
+ rescue_callback(Qnil);
+ }
+ if(TYPE(result) == T_HASH) {
+ hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams);
+ result = hash2result(result);
+ }else if (is_outarg == Qtrue && TYPE(outargv) == T_ARRAY) {
+ ary2ptr_dispparams(outargv, pdispparams);
+ }
+
+ if (pvarResult) {
+ VariantInit(pvarResult);
+ ole_val2variant(result, pvarResult);
+ }
+
+ return NOERROR;
+}
+
+PIEVENTSINKOBJ
+EVENTSINK_Constructor() {
+ PIEVENTSINKOBJ pEv;
+ if (!g_IsEventSinkVtblInitialized) {
+ vtEventSink.QueryInterface=EVENTSINK_QueryInterface;
+ vtEventSink.AddRef = EVENTSINK_AddRef;
+ vtEventSink.Release = EVENTSINK_Release;
+ vtEventSink.Invoke = EVENTSINK_Invoke;
+ vtEventSink.GetIDsOfNames = EVENTSINK_GetIDsOfNames;
+ vtEventSink.GetTypeInfoCount = EVENTSINK_GetTypeInfoCount;
+ vtEventSink.GetTypeInfo = EVENTSINK_GetTypeInfo;
+
+ g_IsEventSinkVtblInitialized = TRUE;
+ }
+ pEv = ALLOC_N(IEVENTSINKOBJ, 1);
+ if(pEv == NULL) return NULL;
+ pEv->lpVtbl = &vtEventSink;
+ pEv->m_cRef = 0;
+ pEv->m_event_id = 0;
+ pEv->pTypeInfo = NULL;
+ return pEv;
+}
+
+void EVENTSINK_Destructor(
+ PIEVENTSINKOBJ pEVObj
+ ) {
+ if(pEVObj != NULL) {
+ OLE_RELEASE(pEVObj->pTypeInfo);
+ free(pEVObj);
+ pEVObj = NULL;
+ }
+}
+
+static HRESULT
+find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo)
+{
+ HRESULT hr;
+ IDispatch *pDispatch;
+ ITypeInfo *pTypeInfo;
+ ITypeLib *pTypeLib;
+ TYPEATTR *pTypeAttr;
+ HREFTYPE RefType;
+ ITypeInfo *pImplTypeInfo;
+ TYPEATTR *pImplTypeAttr;
+
+ struct oledata *pole;
unsigned int index;
+ unsigned int count;
+ int type;
+ BSTR bstr;
+ char *pstr;
+
+ BOOL is_found = FALSE;
+ LCID lcid = cWIN32OLE_lcid;
+
+ OLEData_Get_Struct(ole, pole);
+
+ pDispatch = pole->pDispatch;
+
+ hr = pDispatch->lpVtbl->GetTypeInfo(pDispatch, 0, lcid, &pTypeInfo);
+ if (FAILED(hr))
+ return hr;
+
+ hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo,
+ &pTypeLib,
+ &index);
+ OLE_RELEASE(pTypeInfo);
+ if (FAILED(hr))
+ return hr;
+
+ if (!pitf) {
+ hr = pTypeLib->lpVtbl->GetTypeInfoOfGuid(pTypeLib,
+ piid,
+ ppTypeInfo);
+ OLE_RELEASE(pTypeLib);
+ return hr;
+ }
+ count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
+ for (index = 0; index < count; index++) {
+ hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib,
+ index,
+ &pTypeInfo);
+ if (FAILED(hr))
+ break;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
+
+ if(FAILED(hr)) {
+ OLE_RELEASE(pTypeInfo);
+ break;
+ }
+ if(pTypeAttr->typekind == TKIND_COCLASS) {
+ for (type = 0; type < pTypeAttr->cImplTypes; type++) {
+ hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
+ type,
+ &RefType);
+ if (FAILED(hr))
+ break;
+ hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
+ RefType,
+ &pImplTypeInfo);
+ if (FAILED(hr))
+ break;
+
+ hr = pImplTypeInfo->lpVtbl->GetDocumentation(pImplTypeInfo,
+ -1,
+ &bstr,
+ NULL, NULL, NULL);
+ if (FAILED(hr)) {
+ OLE_RELEASE(pImplTypeInfo);
+ break;
+ }
+ pstr = ole_wc2mb(bstr);
+ if (strcmp(pitf, pstr) == 0) {
+ hr = pImplTypeInfo->lpVtbl->GetTypeAttr(pImplTypeInfo,
+ &pImplTypeAttr);
+ if (SUCCEEDED(hr)) {
+ is_found = TRUE;
+ *piid = pImplTypeAttr->guid;
+ if (ppTypeInfo) {
+ *ppTypeInfo = pImplTypeInfo;
+ (*ppTypeInfo)->lpVtbl->AddRef((*ppTypeInfo));
+ }
+ pImplTypeInfo->lpVtbl->ReleaseTypeAttr(pImplTypeInfo,
+ pImplTypeAttr);
+ }
+ }
+ free(pstr);
+ OLE_RELEASE(pImplTypeInfo);
+ if (is_found || FAILED(hr))
+ break;
+ }
+ }
+
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
+ OLE_RELEASE(pTypeInfo);
+ if (is_found || FAILED(hr))
+ break;
+ }
+ OLE_RELEASE(pTypeLib);
+ if(!is_found)
+ return E_NOINTERFACE;
+ return hr;
+}
+
+static HRESULT
+find_coclass(
+ ITypeInfo *pTypeInfo,
+ TYPEATTR *pTypeAttr,
+ ITypeInfo **pCOTypeInfo,
+ TYPEATTR **pCOTypeAttr)
+{
+ HRESULT hr = E_NOINTERFACE;
+ ITypeLib *pTypeLib;
+ int count;
+ BOOL found = FALSE;
+ ITypeInfo *pTypeInfo2;
+ TYPEATTR *pTypeAttr2;
+ int flags;
+ int i,j;
+ HREFTYPE href;
+ ITypeInfo *pRefTypeInfo;
+ TYPEATTR *pRefTypeAttr;
+
+ hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, NULL);
+ if (FAILED(hr)) {
+ return hr;
+ }
+ count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
+ for (i = 0; i < count && !found; i++) {
+ hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo2);
+ if (FAILED(hr))
+ continue;
+ hr = OLE_GET_TYPEATTR(pTypeInfo2, &pTypeAttr2);
+ if (FAILED(hr)) {
+ OLE_RELEASE(pTypeInfo2);
+ continue;
+ }
+ if (pTypeAttr2->typekind != TKIND_COCLASS) {
+ OLE_RELEASE_TYPEATTR(pTypeInfo2, pTypeAttr2);
+ OLE_RELEASE(pTypeInfo2);
+ continue;
+ }
+ for (j = 0; j < pTypeAttr2->cImplTypes && !found; j++) {
+ hr = pTypeInfo2->lpVtbl->GetImplTypeFlags(pTypeInfo2, j, &flags);
+ if (FAILED(hr))
+ continue;
+ if (!(flags & IMPLTYPEFLAG_FDEFAULT))
+ continue;
+ hr = pTypeInfo2->lpVtbl->GetRefTypeOfImplType(pTypeInfo2, j, &href);
+ if (FAILED(hr))
+ continue;
+ hr = pTypeInfo2->lpVtbl->GetRefTypeInfo(pTypeInfo2, href, &pRefTypeInfo);
+ if (FAILED(hr))
+ continue;
+ hr = OLE_GET_TYPEATTR(pRefTypeInfo, &pRefTypeAttr);
+ if (FAILED(hr)) {
+ OLE_RELEASE(pRefTypeInfo);
+ continue;
+ }
+ if (IsEqualGUID(&(pTypeAttr->guid), &(pRefTypeAttr->guid))) {
+ found = TRUE;
+ }
+ }
+ if (!found) {
+ OLE_RELEASE_TYPEATTR(pTypeInfo2, pTypeAttr2);
+ OLE_RELEASE(pTypeInfo2);
+ }
+ }
+ OLE_RELEASE(pTypeLib);
+ if (found) {
+ *pCOTypeInfo = pTypeInfo2;
+ *pCOTypeAttr = pTypeAttr2;
+ hr = S_OK;
+ } else {
+ hr = E_NOINTERFACE;
+ }
+ return hr;
+}
+
+static HRESULT
+find_default_source_from_typeinfo(
+ ITypeInfo *pTypeInfo,
+ TYPEATTR *pTypeAttr,
+ ITypeInfo **ppTypeInfo)
+{
+ int i = 0;
+ HRESULT hr = E_NOINTERFACE;
+ int flags;
+ HREFTYPE hRefType;
+ /* Enumerate all implemented types of the COCLASS */
+ for (i = 0; i < pTypeAttr->cImplTypes; i++) {
+ hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
+ if (FAILED(hr))
+ continue;
+
+ /*
+ looking for the [default] [source]
+ we just hope that it is a dispinterface :-)
+ */
+ if ((flags & IMPLTYPEFLAG_FDEFAULT) &&
+ (flags & IMPLTYPEFLAG_FSOURCE)) {
+
+ hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
+ i, &hRefType);
+ if (FAILED(hr))
+ continue;
+ hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
+ hRefType, ppTypeInfo);
+ if (SUCCEEDED(hr))
+ break;
+ }
+ }
+ return hr;
+}
+
+static HRESULT
+find_default_source(VALUE ole, IID *piid, ITypeInfo **ppTypeInfo)
+{
+ HRESULT hr;
+ IProvideClassInfo2 *pProvideClassInfo2;
+ IProvideClassInfo *pProvideClassInfo;
+ void *p;
+
+ IDispatch *pDispatch;
ITypeInfo *pTypeInfo;
- pole = oledata_get_struct(obj);
- hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
- 0, lcid, &pTypeInfo);
+ ITypeInfo *pTypeInfo2 = NULL;
+ TYPEATTR *pTypeAttr;
+ TYPEATTR *pTypeAttr2 = NULL;
+
+ struct oledata *pole;
+
+ OLEData_Get_Struct(ole, pole);
+ pDispatch = pole->pDispatch;
+ hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
+ &IID_IProvideClassInfo2,
+ &p);
+ if (SUCCEEDED(hr)) {
+ pProvideClassInfo2 = p;
+ hr = pProvideClassInfo2->lpVtbl->GetGUID(pProvideClassInfo2,
+ GUIDKIND_DEFAULT_SOURCE_DISP_IID,
+ piid);
+ OLE_RELEASE(pProvideClassInfo2);
+ if (SUCCEEDED(hr)) {
+ hr = find_iid(ole, NULL, piid, ppTypeInfo);
+ }
+ }
+ if (SUCCEEDED(hr)) {
+ return hr;
+ }
+ hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
+ &IID_IProvideClassInfo,
+ &p);
+ if (SUCCEEDED(hr)) {
+ pProvideClassInfo = p;
+ hr = pProvideClassInfo->lpVtbl->GetClassInfo(pProvideClassInfo,
+ &pTypeInfo);
+ OLE_RELEASE(pProvideClassInfo);
+ }
+ if (FAILED(hr)) {
+ hr = pDispatch->lpVtbl->GetTypeInfo(pDispatch, 0, cWIN32OLE_lcid, &pTypeInfo );
+ }
+ if (FAILED(hr))
+ return hr;
+ hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
+ OLE_RELEASE(pTypeInfo);
return hr;
}
- hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, pTypeLib, &index);
+
+ *ppTypeInfo = 0;
+ hr = find_default_source_from_typeinfo(pTypeInfo, pTypeAttr, ppTypeInfo);
+ if (!*ppTypeInfo) {
+ hr = find_coclass(pTypeInfo, pTypeAttr, &pTypeInfo2, &pTypeAttr2);
+ if (SUCCEEDED(hr)) {
+ hr = find_default_source_from_typeinfo(pTypeInfo2, pTypeAttr2, ppTypeInfo);
+ OLE_RELEASE_TYPEATTR(pTypeInfo2, pTypeAttr2);
+ OLE_RELEASE(pTypeInfo2);
+ }
+ }
+ OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
OLE_RELEASE(pTypeInfo);
+ /* Now that would be a bad surprise, if we didn't find it, wouldn't it? */
+ if (!*ppTypeInfo) {
+ if (SUCCEEDED(hr))
+ hr = E_UNEXPECTED;
+ return hr;
+ }
+
+ /* Determine IID of default source interface */
+ hr = (*ppTypeInfo)->lpVtbl->GetTypeAttr(*ppTypeInfo, &pTypeAttr);
+ if (SUCCEEDED(hr)) {
+ *piid = pTypeAttr->guid;
+ (*ppTypeInfo)->lpVtbl->ReleaseTypeAttr(*ppTypeInfo, pTypeAttr);
+ }
+ else
+ OLE_RELEASE(*ppTypeInfo);
+
return hr;
+
+}
+
+static void
+ole_event_free(struct oleeventdata *poleev)
+{
+ if (poleev->pConnectionPoint) {
+ poleev->pConnectionPoint->lpVtbl->Unadvise(poleev->pConnectionPoint, poleev->dwCookie);
+ OLE_RELEASE(poleev->pConnectionPoint);
+ poleev->pConnectionPoint = NULL;
+ }
+ free(poleev);
+}
+
+static VALUE
+fev_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct oleeventdata *poleev;
+ obj = Data_Make_Struct(klass,struct oleeventdata,0,ole_event_free,poleev);
+ poleev->dwCookie = 0;
+ poleev->pConnectionPoint = NULL;
+ poleev->event_id = 0;
+ return obj;
+}
+
+static VALUE
+ev_advise(int argc, VALUE *argv, VALUE self)
+{
+
+ VALUE ole, itf;
+ struct oledata *pole;
+ char *pitf;
+ HRESULT hr;
+ IID iid;
+ ITypeInfo *pTypeInfo = 0;
+ IDispatch *pDispatch;
+ IConnectionPointContainer *pContainer;
+ IConnectionPoint *pConnectionPoint;
+ IEVENTSINKOBJ *pIEV;
+ DWORD dwCookie;
+ struct oleeventdata *poleev;
+ void *p;
+
+ rb_scan_args(argc, argv, "11", &ole, &itf);
+
+ if (!rb_obj_is_kind_of(ole, cWIN32OLE)) {
+ rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE object");
+ }
+
+ if(TYPE(itf) != T_NIL) {
+ if (rb_safe_level() > 0 && OBJ_TAINTED(itf)) {
+ rb_raise(rb_eSecurityError, "Insecure Event Creation - %s",
+ StringValuePtr(itf));
+ }
+ SafeStringValue(itf);
+ pitf = StringValuePtr(itf);
+ hr = find_iid(ole, pitf, &iid, &pTypeInfo);
+ }
+ else {
+ hr = find_default_source(ole, &iid, &pTypeInfo);
+ }
+ if (FAILED(hr)) {
+ ole_raise(hr, rb_eRuntimeError, "interface not found");
+ }
+
+ OLEData_Get_Struct(ole, pole);
+ pDispatch = pole->pDispatch;
+ hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
+ &IID_IConnectionPointContainer,
+ &p);
+ if (FAILED(hr)) {
+ OLE_RELEASE(pTypeInfo);
+ ole_raise(hr, rb_eRuntimeError,
+ "failed to query IConnectionPointContainer");
+ }
+ pContainer = p;
+
+ hr = pContainer->lpVtbl->FindConnectionPoint(pContainer,
+ &iid,
+ &pConnectionPoint);
+ OLE_RELEASE(pContainer);
+ if (FAILED(hr)) {
+ OLE_RELEASE(pTypeInfo);
+ ole_raise(hr, rb_eRuntimeError, "failed to query IConnectionPoint");
+ }
+ pIEV = EVENTSINK_Constructor();
+ pIEV->m_iid = iid;
+ hr = pConnectionPoint->lpVtbl->Advise(pConnectionPoint,
+ (IUnknown*)pIEV,
+ &dwCookie);
+ if (FAILED(hr)) {
+ ole_raise(hr, rb_eRuntimeError, "Advise Error");
+ }
+
+ Data_Get_Struct(self, struct oleeventdata, poleev);
+ pIEV->m_event_id
+ = NUM2INT(evs_length());
+ pIEV->pTypeInfo = pTypeInfo;
+ poleev->dwCookie = dwCookie;
+ poleev->pConnectionPoint = pConnectionPoint;
+ poleev->event_id = pIEV->m_event_id;
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
+ *
+ * Returns OLE event object.
+ * The first argument specifies WIN32OLE object.
+ * The second argument specifies OLE event name.
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
+ */
+static VALUE
+fev_initialize(int argc, VALUE *argv, VALUE self)
+{
+ ev_advise(argc, argv, self);
+ evs_push(self);
+ rb_ivar_set(self, id_events, rb_ary_new());
+ fev_set_handler(self, Qnil);
+ return self;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT.message_loop
+ *
+ * Translates and dispatches Windows message.
+ */
+static VALUE
+fev_s_msg_loop(VALUE klass)
+{
+ ole_msg_loop();
+ return Qnil;
+}
+
+
+static void
+add_event_call_back(VALUE obj, VALUE event, VALUE data)
+{
+ VALUE events = rb_ivar_get(obj, id_events);
+ if (NIL_P(events) || TYPE(events) != T_ARRAY) {
+ events = rb_ary_new();
+ rb_ivar_set(obj, id_events, events);
+ }
+ ole_delete_event(events, event);
+ rb_ary_push(events, data);
+}
+
+static VALUE
+ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg)
+{
+ struct oleeventdata *poleev;
+ VALUE event, args, data;
+ Data_Get_Struct(self, struct oleeventdata, poleev);
+ if (poleev->pConnectionPoint == NULL) {
+ rb_raise(eWIN32OLERuntimeError, "IConnectionPoint not found. You must call advise at first.");
+ }
+ rb_scan_args(argc, argv, "01*", &event, &args);
+ if(!NIL_P(event)) {
+ if(TYPE(event) != T_STRING && TYPE(event) != T_SYMBOL) {
+ rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
+ }
+ if (TYPE(event) == T_SYMBOL) {
+ event = rb_sym_to_s(event);
+ }
+ }
+ data = rb_ary_new3(4, rb_block_proc(), event, args, is_ary_arg);
+ add_event_call_back(self, event, data);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT#on_event([event]){...}
+ *
+ * Defines the callback event.
+ * If argument is omitted, this method defines the callback of all events.
+ * If you want to modify reference argument in callback, return hash in
+ * callback. If you want to return value to OLE server as result of callback
+ * use `return' or :return.
+ *
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ev = WIN32OLE_EVENT.new(ie)
+ * ev.on_event("NavigateComplete") {|url| puts url}
+ * ev.on_event() {|ev, *args| puts "#{ev} fired"}
+ *
+ * ev.on_event("BeforeNavigate2") {|*args|
+ * ...
+ * # set true to BeforeNavigate reference argument `Cancel'.
+ * # Cancel is 7-th argument of BeforeNavigate,
+ * # so you can use 6 as key of hash instead of 'Cancel'.
+ * # The argument is counted from 0.
+ * # The hash key of 0 means first argument.)
+ * {:Cancel => true} # or {'Cancel' => true} or {6 => true}
+ * }
+ *
+ * ev.on_event(...) {|*args|
+ * {:return => 1, :xxx => yyy}
+ * }
+ */
+static VALUE
+fev_on_event(int argc, VALUE *argv, VALUE self)
+{
+ return ev_on_event(argc, argv, self, Qfalse);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT#on_event_with_outargs([event]){...}
+ *
+ * Defines the callback of event.
+ * If you want modify argument in callback,
+ * you could use this method instead of WIN32OLE_EVENT#on_event.
+ *
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ev = WIN32OLE_EVENT.new(ie)
+ * ev.on_event_with_outargs('BeforeNavigate2') {|*args|
+ * args.last[6] = true
+ * }
+ */
+static VALUE
+fev_on_event_with_outargs(int argc, VALUE *argv, VALUE self)
+{
+ return ev_on_event(argc, argv, self, Qtrue);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT#off_event([event])
+ *
+ * removes the callback of event.
+ *
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ev = WIN32OLE_EVENT.new(ie)
+ * ev.on_event('BeforeNavigate2') {|*args|
+ * args.last[6] = true
+ * }
+ * ...
+ * ev.off_event('BeforeNavigate2')
+ * ...
+ */
+static VALUE
+fev_off_event(int argc, VALUE *argv, VALUE self)
+{
+ VALUE event = Qnil;
+ VALUE events;
+
+ rb_scan_args(argc, argv, "01", &event);
+ if(!NIL_P(event)) {
+ if(TYPE(event) != T_STRING && TYPE(event) != T_SYMBOL) {
+ rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
+ }
+ if (TYPE(event) == T_SYMBOL) {
+ event = rb_sym_to_s(event);
+ }
+ }
+ events = rb_ivar_get(self, id_events);
+ if (NIL_P(events)) {
+ return Qnil;
+ }
+ ole_delete_event(events, event);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT#unadvise -> nil
+ *
+ * disconnects OLE server. If this method called, then the WIN32OLE_EVENT object
+ * does not receive the OLE server event any more.
+ * This method is trial implementation.
+ *
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ev = WIN32OLE_EVENT.new(ie)
+ * ev.on_event() {...}
+ * ...
+ * ev.unadvise
+ *
+ */
+static VALUE
+fev_unadvise(VALUE self)
+{
+ struct oleeventdata *poleev;
+ Data_Get_Struct(self, struct oleeventdata, poleev);
+ if (poleev->pConnectionPoint) {
+ ole_msg_loop();
+ evs_delete(poleev->event_id);
+ poleev->pConnectionPoint->lpVtbl->Unadvise(poleev->pConnectionPoint, poleev->dwCookie);
+ OLE_RELEASE(poleev->pConnectionPoint);
+ poleev->pConnectionPoint = NULL;
+ }
+ return Qnil;
+}
+
+static VALUE
+evs_push(VALUE ev)
+{
+ return rb_ary_push(ary_ole_event, ev);
+}
+
+static VALUE
+evs_delete(long i)
+{
+ rb_ary_store(ary_ole_event, i, Qnil);
+ return Qnil;
+}
+
+static VALUE
+evs_entry(long i)
+{
+ return rb_ary_entry(ary_ole_event, i);
+}
+
+static VALUE
+evs_length(void)
+{
+ return rb_funcall(ary_ole_event, rb_intern("length"), 0);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT#handler=
+ *
+ * sets event handler object. If handler object has onXXX
+ * method according to XXX event, then onXXX method is called
+ * when XXX event occurs.
+ *
+ * If handler object has method_missing and there is no
+ * method according to the event, then method_missing
+ * called and 1-st argument is event name.
+ *
+ * If handler object has onXXX method and there is block
+ * defined by WIN32OLE_EVENT#on_event('XXX'){},
+ * then block is executed but handler object method is not called
+ * when XXX event occurs.
+ *
+ * class Handler
+ * def onStatusTextChange(text)
+ * puts "StatusTextChanged"
+ * end
+ * def onPropertyChange(prop)
+ * puts "PropertyChanged"
+ * end
+ * def method_missing(ev, *arg)
+ * puts "other event #{ev}"
+ * end
+ * end
+ *
+ * handler = Handler.new
+ * ie = WIN32OLE.new('InternetExplorer.Application')
+ * ev = WIN32OLE_EVENT.new(ie)
+ * ev.on_event("StatusTextChange") {|*args|
+ * puts "this block executed."
+ * puts "handler.onStatusTextChange method is not called."
+ * }
+ * ev.handler = handler
+ *
+ */
+static VALUE
+fev_set_handler(VALUE self, VALUE val)
+{
+ return rb_ivar_set(self, rb_intern("handler"), val);
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_EVENT#handler
+ *
+ * returns handler object.
+ *
+ */
+static VALUE
+fev_get_handler(VALUE self)
+{
+ return rb_ivar_get(self, rb_intern("handler"));
+}
+
+static void
+olevariant_free(struct olevariantdata *pvar)
+{
+ VariantClear(&(pvar->realvar));
+ VariantClear(&(pvar->var));
+ free(pvar);
+}
+
+static VALUE
+folevariant_s_allocate(VALUE klass)
+{
+ struct olevariantdata *pvar;
+ VALUE obj;
+ ole_initialize();
+ obj = Data_Make_Struct(klass,struct olevariantdata,0,olevariant_free,pvar);
+ VariantInit(&(pvar->var));
+ VariantInit(&(pvar->realvar));
+ return obj;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT.array(ary, vt)
+ *
+ * Returns Ruby object wrapping OLE variant whose variant type is VT_ARRAY.
+ * The first argument should be Array object which specifies dimensions
+ * and each size of dimensions of OLE array.
+ * The second argument specifies variant type of the element of OLE array.
+ *
+ * The following create 2 dimensions OLE array. The first dimensions size
+ * is 3, and the second is 4.
+ *
+ * ole_ary = WIN32OLE_VARIANT.array([3,4], VT_I4)
+ * ruby_ary = ole_ary.value # => [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
+ *
+ */
+static VALUE
+folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
+{
+ VALUE obj = Qnil;
+ VARTYPE vt;
+ struct olevariantdata *pvar;
+ SAFEARRAYBOUND *psab = NULL;
+ SAFEARRAY *psa = NULL;
+ UINT dim = 0;
+ UINT i = 0;
+
+ ole_initialize();
+
+ vt = NUM2UINT(vvt);
+ vt = (vt | VT_ARRAY);
+ Check_Type(elems, T_ARRAY);
+ obj = folevariant_s_allocate(klass);
+
+ Data_Get_Struct(obj, struct olevariantdata, pvar);
+ dim = RARRAY_LEN(elems);
+
+ psab = ALLOC_N(SAFEARRAYBOUND, dim);
+
+ if(!psab) {
+ rb_raise(rb_eRuntimeError, "memory allocation error");
+ }
+
+ for (i = 0; i < dim; i++) {
+ psab[i].cElements = FIX2INT(rb_ary_entry(elems, i));
+ psab[i].lLbound = 0;
+ }
+
+ psa = SafeArrayCreate((VARTYPE)(vt & VT_TYPEMASK), dim, psab);
+ if (psa == NULL) {
+ if (psab) free(psab);
+ rb_raise(rb_eRuntimeError, "memory allocation error(SafeArrayCreate)");
+ }
+
+ V_VT(&(pvar->var)) = vt;
+ if (vt & VT_BYREF) {
+ V_VT(&(pvar->realvar)) = (vt & ~VT_BYREF);
+ V_ARRAY(&(pvar->realvar)) = psa;
+ V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
+ } else {
+ V_ARRAY(&(pvar->var)) = psa;
+ }
+ if (psab) free(psab);
+ return obj;
+}
+
+static void
+check_type_val2variant(VALUE val)
+{
+ VALUE elem;
+ int len = 0;
+ int i = 0;
+ if(!rb_obj_is_kind_of(val, cWIN32OLE) &&
+ !rb_obj_is_kind_of(val, cWIN32OLE_VARIANT) &&
+ !rb_obj_is_kind_of(val, rb_cTime)) {
+ switch (TYPE(val)) {
+ case T_ARRAY:
+ len = RARRAY_LEN(val);
+ for(i = 0; i < len; i++) {
+ elem = rb_ary_entry(val, i);
+ check_type_val2variant(elem);
+ }
+ break;
+ case T_STRING:
+ case T_FIXNUM:
+ case T_BIGNUM:
+ case T_FLOAT:
+ case T_TRUE:
+ case T_FALSE:
+ case T_NIL:
+ break;
+ default:
+ rb_raise(rb_eTypeError, "can not convert WIN32OLE_VARIANT from type %s",
+ rb_obj_classname(val));
+ }
+ }
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT.new(val, vartype) #=> WIN32OLE_VARIANT object.
+ *
+ * Returns Ruby object wrapping OLE variant.
+ * The first argument specifies Ruby object to convert OLE variant variable.
+ * The second argument specifies VARIANT type.
+ * In some situation, you need the WIN32OLE_VARIANT object to pass OLE method
+ *
+ * shell = WIN32OLE.new("Shell.Application")
+ * folder = shell.NameSpace("C:\\Windows")
+ * item = folder.ParseName("tmp.txt")
+ * # You can't use Ruby String object to call FolderItem.InvokeVerb.
+ * # Instead, you have to use WIN32OLE_VARIANT object to call the method.
+ * shortcut = WIN32OLE_VARIANT.new("Create Shortcut(\&S)")
+ * item.invokeVerb(shortcut)
+ *
+ */
+static VALUE
+folevariant_initialize(VALUE self, VALUE args)
+{
+ int len = 0;
+ VARIANT var;
+ VALUE val;
+ VALUE vvt;
+ VARTYPE vt;
+ struct olevariantdata *pvar;
+
+ len = RARRAY_LEN(args);
+ if (len < 1 || len > 3) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..3)", len);
+ }
+ VariantInit(&var);
+ val = rb_ary_entry(args, 0);
+
+ check_type_val2variant(val);
+
+ Data_Get_Struct(self, struct olevariantdata, pvar);
+ if (len == 1) {
+ ole_val2variant(val, &(pvar->var));
+ } else {
+ vvt = rb_ary_entry(args, 1);
+ vt = NUM2INT(vvt);
+ ole_val2olevariantdata(val, vt, pvar);
+ }
+ vt = V_VT(&pvar->var);
+ return self;
+}
+
+static SAFEARRAY *
+get_locked_safe_array(VALUE val)
+{
+ struct olevariantdata *pvar;
+ SAFEARRAY *psa = NULL;
+ HRESULT hr;
+ Data_Get_Struct(val, struct olevariantdata, pvar);
+ if (!(V_VT(&(pvar->var)) & VT_ARRAY)) {
+ rb_raise(rb_eTypeError, "variant type is not VT_ARRAY.");
+ }
+ psa = V_ISBYREF(&(pvar->var)) ? *V_ARRAYREF(&(pvar->var)) : V_ARRAY(&(pvar->var));
+ if (psa == NULL) {
+ return psa;
+ }
+ hr = SafeArrayLock(psa);
+ if (FAILED(hr)) {
+ ole_raise(hr, rb_eRuntimeError, "failed to SafeArrayLock");
+ }
+ return psa;
+}
+
+static long *
+ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa)
+{
+ long dim;
+ long *pid;
+ long i;
+ dim = SafeArrayGetDim(psa);
+ if (dim != ary_size) {
+ rb_raise(rb_eArgError, "unmatch number of indices");
+ }
+ pid = ALLOC_N(long, dim);
+ if (pid == NULL) {
+ rb_raise(rb_eRuntimeError, "failed to allocate memory for indices");
+ }
+ for (i = 0; i < dim; i++) {
+ pid[i] = NUM2INT(ary[i]);
+ }
+ return pid;
}
static void
-com_hash_free(void *ptr)
+unlock_safe_array(SAFEARRAY *psa)
+{
+ HRESULT hr;
+ hr = SafeArrayUnlock(psa);
+ if (FAILED(hr)) {
+ ole_raise(hr, rb_eRuntimeError, "failed to SafeArrayUnlock");
+ }
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT[i,j,...] #=> element of OLE array.
+ *
+ * Returns the element of WIN32OLE_VARIANT object(OLE array).
+ * This method is available only when the variant type of
+ * WIN32OLE_VARIANT object is VT_ARRAY.
+ *
+ * REMARK:
+ * The all indicies should be 0 or natural number and
+ * lower than or equal to max indicies.
+ * (This point is different with Ruby Array indicies.)
+ *
+ * obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]])
+ * p obj[0,0] # => 1
+ * p obj[1,0] # => 4
+ * p obj[2,0] # => WIN32OLERuntimeError
+ * p obj[0, -1] # => WIN32OLERuntimeError
+ *
+ */
+static VALUE
+folevariant_ary_aref(int argc, VALUE *argv, VALUE self)
+{
+ struct olevariantdata *pvar;
+ SAFEARRAY *psa;
+ VALUE val = Qnil;
+ VARIANT variant;
+ long *pid;
+ HRESULT hr;
+
+ Data_Get_Struct(self, struct olevariantdata, pvar);
+ if (!V_ISARRAY(&(pvar->var))) {
+ rb_raise(eWIN32OLERuntimeError,
+ "`[]' is not available for this variant type object");
+ }
+ psa = get_locked_safe_array(self);
+ if (psa == NULL) {
+ return val;
+ }
+
+ pid = ary2safe_array_index(argc, argv, psa);
+
+ VariantInit(&variant);
+ V_VT(&variant) = (V_VT(&(pvar->var)) & ~VT_ARRAY) | VT_BYREF;
+ hr = SafeArrayPtrOfIndex(psa, pid, &V_BYREF(&variant));
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to SafeArrayPtrOfIndex");
+ }
+ val = ole_variant2val(&variant);
+
+ unlock_safe_array(psa);
+ if (pid) free(pid);
+ return val;
+}
+
+static VOID *
+val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt)
+{
+ VOID *p = NULL;
+ HRESULT hr = S_OK;
+ ole_val2variant_ex(val, var, vt);
+ if ((vt & ~VT_BYREF) == VT_VARIANT) {
+ p = var;
+ } else {
+ if ( (vt & ~VT_BYREF) != V_VT(var)) {
+ hr = VariantChangeTypeEx(var, var,
+ cWIN32OLE_lcid, 0, (VARTYPE)(vt & ~VT_BYREF));
+ if (FAILED(hr)) {
+ ole_raise(hr, rb_eRuntimeError, "failed to change type");
+ }
+ }
+ p = get_ptr_of_variant(var);
+ }
+ if (p == NULL) {
+ rb_raise(rb_eRuntimeError, "failed to get pointer of variant");
+ }
+ return p;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT[i,j,...] = val #=> set the element of OLE array
+ *
+ * Set the element of WIN32OLE_VARIANT object(OLE array) to val.
+ * This method is available only when the variant type of
+ * WIN32OLE_VARIANT object is VT_ARRAY.
+ *
+ * REMARK:
+ * The all indicies should be 0 or natural number and
+ * lower than or equal to max indicies.
+ * (This point is different with Ruby Array indicies.)
+ *
+ * obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]])
+ * obj[0,0] = 7
+ * obj[1,0] = 8
+ * p obj.value # => [[7,2,3], [8,5,6]]
+ * obj[2,0] = 9 # => WIN32OLERuntimeError
+ * obj[0, -1] = 9 # => WIN32OLERuntimeError
+ *
+ */
+static VALUE
+folevariant_ary_aset(int argc, VALUE *argv, VALUE self)
+{
+ struct olevariantdata *pvar;
+ SAFEARRAY *psa;
+ VARIANT var;
+ VARTYPE vt;
+ long *pid;
+ HRESULT hr;
+ VOID *p = NULL;
+
+ Data_Get_Struct(self, struct olevariantdata, pvar);
+ if (!V_ISARRAY(&(pvar->var))) {
+ rb_raise(eWIN32OLERuntimeError,
+ "`[]' is not available for this variant type object");
+ }
+ psa = get_locked_safe_array(self);
+ if (psa == NULL) {
+ rb_raise(rb_eRuntimeError, "failed to get SafeArray pointer");
+ }
+
+ pid = ary2safe_array_index(argc-1, argv, psa);
+
+ VariantInit(&var);
+ vt = (V_VT(&(pvar->var)) & ~VT_ARRAY);
+ p = val2variant_ptr(argv[argc-1], &var, vt);
+ if ((V_VT(&var) == VT_DISPATCH && V_DISPATCH(&var) == NULL) ||
+ (V_VT(&var) == VT_UNKNOWN && V_UNKNOWN(&var) == NULL)) {
+ rb_raise(eWIN32OLERuntimeError, "argument does not have IDispatch or IUnknown Interface");
+ }
+ hr = SafeArrayPutElement(psa, pid, p);
+ if (FAILED(hr)) {
+ ole_raise(hr, eWIN32OLERuntimeError, "failed to SafeArrayPutElement");
+ }
+
+ unlock_safe_array(psa);
+ if (pid) free(pid);
+ return argv[argc-1];
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT.value #=> Ruby object.
+ *
+ * Returns Ruby object value from OLE variant.
+ * obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR)
+ * obj.value # => "1" (not Fixnum object, but String object "1")
+ *
+ */
+static VALUE
+folevariant_value(VALUE self)
+{
+ struct olevariantdata *pvar;
+ VALUE val = Qnil;
+ VARTYPE vt;
+ int dim;
+ SAFEARRAY *psa;
+ Data_Get_Struct(self, struct olevariantdata, pvar);
+
+ val = ole_variant2val(&(pvar->var));
+ vt = V_VT(&(pvar->var));
+
+ if ((vt & ~VT_BYREF) == (VT_UI1|VT_ARRAY)) {
+ if (vt & VT_BYREF) {
+ psa = *V_ARRAYREF(&(pvar->var));
+ } else {
+ psa = V_ARRAY(&(pvar->var));
+ }
+ if (!psa) {
+ return val;
+ }
+ dim = SafeArrayGetDim(psa);
+ if (dim == 1) {
+ val = rb_funcall(val, rb_intern("pack"), 1, rb_str_new2("C*"));
+ }
+ }
+ return val;
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT.vartype #=> OLE variant type.
+ *
+ * Returns OLE variant type.
+ * obj = WIN32OLE_VARIANT.new("string")
+ * obj.vartype # => WIN32OLE::VARIANT::VT_BSTR
+ *
+ */
+static VALUE
+folevariant_vartype(VALUE self)
+{
+ struct olevariantdata *pvar;
+ Data_Get_Struct(self, struct olevariantdata, pvar);
+ return INT2FIX(V_VT(&pvar->var));
+}
+
+/*
+ * call-seq:
+ * WIN32OLE_VARIANT.value = val #=> set WIN32OLE_VARIANT value to val.
+ *
+ * Sets variant value to val. If the val type does not match variant value
+ * type(vartype), then val is changed to match variant value type(vartype)
+ * before setting val.
+ * Thie method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY).
+ * If the vartype is VT_UI1|VT_ARRAY, the val should be String object.
+ *
+ * obj = WIN32OLE_VARIANT.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4
+ * obj.value = 3.2 # 3.2 is changed to 3 when setting value.
+ * p obj.value # => 3
+ */
+static VALUE
+folevariant_set_value(VALUE self, VALUE val)
{
- st_table *tbl = ptr;
- st_free_table(tbl);
+ struct olevariantdata *pvar;
+ VARTYPE vt;
+ Data_Get_Struct(self, struct olevariantdata, pvar);
+ vt = V_VT(&(pvar->var));
+ if (V_ISARRAY(&(pvar->var)) && ((vt & ~VT_BYREF) != (VT_UI1|VT_ARRAY) || TYPE(val) != T_STRING)) {
+ rb_raise(eWIN32OLERuntimeError,
+ "`value=' is not available for this variant type object");
+ }
+ ole_val2olevariantdata(val, vt, pvar);
+ return Qnil;
}
static void
-com_hash_mark(void *ptr)
+init_enc2cp(void)
{
- st_table *tbl = ptr;
- rb_mark_hash(tbl);
+ enc2cp_table = st_init_numtable();
}
-static size_t
-com_hash_size(const void *ptr)
+static void
+free_enc2cp(void)
{
- const st_table *tbl = ptr;
- return st_memsize(tbl);
+ st_free_table(enc2cp_table);
}
void
Init_win32ole(void)
{
- cWIN32OLE_lcid = LOCALE_SYSTEM_DEFAULT;
g_ole_initialized_init();
+ ary_ole_event = rb_ary_new();
+ rb_gc_register_mark_object(ary_ole_event);
+ id_events = rb_intern("events");
com_vtbl.QueryInterface = QueryInterface;
com_vtbl.AddRef = AddRef;
@@ -3910,12 +9137,7 @@ Init_win32ole(void)
message_filter.RetryRejectedCall = mf_RetryRejectedCall;
message_filter.MessagePending = mf_MessagePending;
- enc2cp_hash = TypedData_Wrap_Struct(rb_cData, &win32ole_hash_datatype, 0);
- RTYPEDDATA_DATA(enc2cp_hash) = st_init_numtable();
- rb_gc_register_mark_object(enc2cp_hash);
-
- com_hash = TypedData_Wrap_Struct(rb_cData, &win32ole_hash_datatype, 0);
- RTYPEDDATA_DATA(com_hash) = st_init_numtable();
+ com_hash = Data_Wrap_Struct(rb_cData, rb_mark_hash, st_free_table, st_init_numtable());
rb_gc_register_mark_object(com_hash);
cWIN32OLE = rb_define_class("WIN32OLE", rb_cObject);
@@ -3969,97 +9191,170 @@ Init_win32ole(void)
rb_define_method(cWIN32OLE, "ole_query_interface", fole_query_interface, 1);
rb_define_method(cWIN32OLE, "ole_respond_to?", fole_respond_to, 1);
- /* Constants definition */
-
- /*
- * Version string of WIN32OLE.
- */
rb_define_const(cWIN32OLE, "VERSION", rb_str_new2(WIN32OLE_VERSION));
-
- /*
- * After invoking OLE methods with reference arguments, you can access
- * the value of arguments by using ARGV.
- *
- * If the method of OLE(COM) server written by C#.NET is following:
- *
- * void calcsum(int a, int b, out int c) {
- * c = a + b;
- * }
- *
- * then, the Ruby OLE(COM) client script to retrieve the value of
- * argument c after invoking calcsum method is following:
- *
- * a = 10
- * b = 20
- * c = 0
- * comserver.calcsum(a, b, c)
- * p c # => 0
- * p WIN32OLE::ARGV # => [10, 20, 30]
- *
- * You can use WIN32OLE_VARIANT object to retrieve the value of reference
- * arguments instead of referring WIN32OLE::ARGV.
- *
- */
rb_define_const(cWIN32OLE, "ARGV", rb_ary_new());
- /*
- * 0: ANSI code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
- */
rb_define_const(cWIN32OLE, "CP_ACP", INT2FIX(CP_ACP));
-
- /*
- * 1: OEM code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
- */
rb_define_const(cWIN32OLE, "CP_OEMCP", INT2FIX(CP_OEMCP));
-
- /*
- * 2
- */
rb_define_const(cWIN32OLE, "CP_MACCP", INT2FIX(CP_MACCP));
-
- /*
- * 3: current thread ANSI code page. See WIN32OLE.codepage and
- * WIN32OLE.codepage=.
- */
rb_define_const(cWIN32OLE, "CP_THREAD_ACP", INT2FIX(CP_THREAD_ACP));
-
- /*
- * 42: symbol code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
- */
rb_define_const(cWIN32OLE, "CP_SYMBOL", INT2FIX(CP_SYMBOL));
-
- /*
- * 65000: UTF-7 code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
- */
rb_define_const(cWIN32OLE, "CP_UTF7", INT2FIX(CP_UTF7));
-
- /*
- * 65001: UTF-8 code page. See WIN32OLE.codepage and WIN32OLE.codepage=.
- */
rb_define_const(cWIN32OLE, "CP_UTF8", INT2FIX(CP_UTF8));
- /*
- * 0x0800: default locale for the operating system. See WIN32OLE.locale
- * and WIN32OLE.locale=.
- */
rb_define_const(cWIN32OLE, "LOCALE_SYSTEM_DEFAULT", INT2FIX(LOCALE_SYSTEM_DEFAULT));
-
- /*
- * 0x0400: default locale for the user or process. See WIN32OLE.locale
- * and WIN32OLE.locale=.
- */
rb_define_const(cWIN32OLE, "LOCALE_USER_DEFAULT", INT2FIX(LOCALE_USER_DEFAULT));
- Init_win32ole_variant_m();
- Init_win32ole_typelib();
- Init_win32ole_type();
- Init_win32ole_variable();
- Init_win32ole_method();
- Init_win32ole_param();
- Init_win32ole_event();
- Init_win32ole_variant();
- Init_win32ole_record();
- Init_win32ole_error();
-
+ mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VARIANT");
+ rb_define_const(mWIN32OLE_VARIANT, "VT_EMPTY", INT2FIX(VT_EMPTY));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_NULL", INT2FIX(VT_NULL));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_I2", INT2FIX(VT_I2));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_I4", INT2FIX(VT_I4));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_R4", INT2FIX(VT_R4));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_R8", INT2FIX(VT_R8));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_CY", INT2FIX(VT_CY));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_DATE", INT2FIX(VT_DATE));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_BSTR", INT2FIX(VT_BSTR));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_USERDEFINED", INT2FIX(VT_USERDEFINED));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_PTR", INT2FIX(VT_PTR));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_DISPATCH", INT2FIX(VT_DISPATCH));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_ERROR", INT2FIX(VT_ERROR));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_BOOL", INT2FIX(VT_BOOL));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_VARIANT", INT2FIX(VT_VARIANT));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_UNKNOWN", INT2FIX(VT_UNKNOWN));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_I1", INT2FIX(VT_I1));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_UI1", INT2FIX(VT_UI1));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_UI2", INT2FIX(VT_UI2));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_UI4", INT2FIX(VT_UI4));
+#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
+ rb_define_const(mWIN32OLE_VARIANT, "VT_I8", INT2FIX(VT_I8));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_UI8", INT2FIX(VT_UI8));
+#endif
+ rb_define_const(mWIN32OLE_VARIANT, "VT_INT", INT2FIX(VT_INT));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_UINT", INT2FIX(VT_UINT));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_ARRAY", INT2FIX(VT_ARRAY));
+ rb_define_const(mWIN32OLE_VARIANT, "VT_BYREF", INT2FIX(VT_BYREF));
+
+ cWIN32OLE_TYPELIB = rb_define_class("WIN32OLE_TYPELIB", rb_cObject);
+ rb_define_singleton_method(cWIN32OLE_TYPELIB, "typelibs", foletypelib_s_typelibs, 0);
+ rb_define_alloc_func(cWIN32OLE_TYPELIB, foletypelib_s_allocate);
+ rb_define_method(cWIN32OLE_TYPELIB, "initialize", foletypelib_initialize, -2);
+ rb_define_method(cWIN32OLE_TYPELIB, "guid", foletypelib_guid, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "name", foletypelib_name, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "version", foletypelib_version, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "major_version", foletypelib_major_version, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "minor_version", foletypelib_minor_version, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "path", foletypelib_path, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "ole_types", foletypelib_ole_types, 0);
+ rb_define_alias(cWIN32OLE_TYPELIB, "ole_classes", "ole_types");
+ rb_define_method(cWIN32OLE_TYPELIB, "visible?", foletypelib_visible, 0);
+ rb_define_method(cWIN32OLE_TYPELIB, "library_name", foletypelib_library_name, 0);
+ rb_define_alias(cWIN32OLE_TYPELIB, "to_s", "name");
+ rb_define_method(cWIN32OLE_TYPELIB, "inspect", foletypelib_inspect, 0);
+
+ cWIN32OLE_TYPE = rb_define_class("WIN32OLE_TYPE", rb_cObject);
+ rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1);
+ rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0);
+ rb_define_singleton_method(cWIN32OLE_TYPE, "progids", foletype_s_progids, 0);
+ rb_define_alloc_func(cWIN32OLE_TYPE, foletype_s_allocate);
+ rb_define_method(cWIN32OLE_TYPE, "initialize", foletype_initialize, 2);
+ rb_define_method(cWIN32OLE_TYPE, "name", foletype_name, 0);
+ rb_define_method(cWIN32OLE_TYPE, "ole_type", foletype_ole_type, 0);
+ rb_define_method(cWIN32OLE_TYPE, "guid", foletype_guid, 0);
+ rb_define_method(cWIN32OLE_TYPE, "progid", foletype_progid, 0);
+ rb_define_method(cWIN32OLE_TYPE, "visible?", foletype_visible, 0);
+ rb_define_alias(cWIN32OLE_TYPE, "to_s", "name");
+ rb_define_method(cWIN32OLE_TYPE, "major_version", foletype_major_version, 0);
+ rb_define_method(cWIN32OLE_TYPE, "minor_version", foletype_minor_version, 0);
+ rb_define_method(cWIN32OLE_TYPE, "typekind", foletype_typekind, 0);
+ rb_define_method(cWIN32OLE_TYPE, "helpstring", foletype_helpstring, 0);
+ rb_define_method(cWIN32OLE_TYPE, "src_type", foletype_src_type, 0);
+ rb_define_method(cWIN32OLE_TYPE, "helpfile", foletype_helpfile, 0);
+ rb_define_method(cWIN32OLE_TYPE, "helpcontext", foletype_helpcontext, 0);
+ rb_define_method(cWIN32OLE_TYPE, "variables", foletype_variables, 0);
+ rb_define_method(cWIN32OLE_TYPE, "ole_methods", foletype_methods, 0);
+ rb_define_method(cWIN32OLE_TYPE, "ole_typelib", foletype_ole_typelib, 0);
+ rb_define_method(cWIN32OLE_TYPE, "implemented_ole_types", foletype_impl_ole_types, 0);
+ rb_define_method(cWIN32OLE_TYPE, "source_ole_types", foletype_source_ole_types, 0);
+ rb_define_method(cWIN32OLE_TYPE, "default_event_sources", foletype_default_event_sources, 0);
+ rb_define_method(cWIN32OLE_TYPE, "default_ole_types", foletype_default_ole_types, 0);
+ rb_define_method(cWIN32OLE_TYPE, "inspect", foletype_inspect, 0);
+
+ cWIN32OLE_VARIABLE = rb_define_class("WIN32OLE_VARIABLE", rb_cObject);
+ rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "ole_type", folevariable_ole_type, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "ole_type_detail", folevariable_ole_type_detail, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "value", folevariable_value, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "visible?", folevariable_visible, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "variable_kind", folevariable_variable_kind, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "varkind", folevariable_varkind, 0);
+ rb_define_method(cWIN32OLE_VARIABLE, "inspect", folevariable_inspect, 0);
+ rb_define_alias(cWIN32OLE_VARIABLE, "to_s", "name");
+
+ cWIN32OLE_METHOD = rb_define_class("WIN32OLE_METHOD", rb_cObject);
+ rb_define_alloc_func(cWIN32OLE_METHOD, folemethod_s_allocate);
+ rb_define_method(cWIN32OLE_METHOD, "initialize", folemethod_initialize, 2);
+ rb_define_method(cWIN32OLE_METHOD, "name", folemethod_name, 0);
+ rb_define_method(cWIN32OLE_METHOD, "return_type", folemethod_return_type, 0);
+ rb_define_method(cWIN32OLE_METHOD, "return_vtype", folemethod_return_vtype, 0);
+ rb_define_method(cWIN32OLE_METHOD, "return_type_detail", folemethod_return_type_detail, 0);
+ rb_define_method(cWIN32OLE_METHOD, "invoke_kind", folemethod_invoke_kind, 0);
+ rb_define_method(cWIN32OLE_METHOD, "invkind", folemethod_invkind, 0);
+ rb_define_method(cWIN32OLE_METHOD, "visible?", folemethod_visible, 0);
+ rb_define_method(cWIN32OLE_METHOD, "event?", folemethod_event, 0);
+ rb_define_method(cWIN32OLE_METHOD, "event_interface", folemethod_event_interface, 0);
+ rb_define_method(cWIN32OLE_METHOD, "helpstring", folemethod_helpstring, 0);
+ rb_define_method(cWIN32OLE_METHOD, "helpfile", folemethod_helpfile, 0);
+ rb_define_method(cWIN32OLE_METHOD, "helpcontext", folemethod_helpcontext, 0);
+ rb_define_method(cWIN32OLE_METHOD, "dispid", folemethod_dispid, 0);
+ rb_define_method(cWIN32OLE_METHOD, "offset_vtbl", folemethod_offset_vtbl, 0);
+ rb_define_method(cWIN32OLE_METHOD, "size_params", folemethod_size_params, 0);
+ rb_define_method(cWIN32OLE_METHOD, "size_opt_params", folemethod_size_opt_params, 0);
+ rb_define_method(cWIN32OLE_METHOD, "params", folemethod_params, 0);
+ rb_define_alias(cWIN32OLE_METHOD, "to_s", "name");
+ rb_define_method(cWIN32OLE_METHOD, "inspect", folemethod_inspect, 0);
+
+ cWIN32OLE_PARAM = rb_define_class("WIN32OLE_PARAM", rb_cObject);
+ rb_define_alloc_func(cWIN32OLE_PARAM, foleparam_s_allocate);
+ rb_define_method(cWIN32OLE_PARAM, "initialize", foleparam_initialize, 2);
+ rb_define_method(cWIN32OLE_PARAM, "name", foleparam_name, 0);
+ rb_define_method(cWIN32OLE_PARAM, "ole_type", foleparam_ole_type, 0);
+ rb_define_method(cWIN32OLE_PARAM, "ole_type_detail", foleparam_ole_type_detail, 0);
+ rb_define_method(cWIN32OLE_PARAM, "input?", foleparam_input, 0);
+ rb_define_method(cWIN32OLE_PARAM, "output?", foleparam_output, 0);
+ rb_define_method(cWIN32OLE_PARAM, "optional?", foleparam_optional, 0);
+ rb_define_method(cWIN32OLE_PARAM, "retval?", foleparam_retval, 0);
+ rb_define_method(cWIN32OLE_PARAM, "default", foleparam_default, 0);
+ rb_define_alias(cWIN32OLE_PARAM, "to_s", "name");
+ rb_define_method(cWIN32OLE_PARAM, "inspect", foleparam_inspect, 0);
+
+ cWIN32OLE_EVENT = rb_define_class("WIN32OLE_EVENT", rb_cObject);
+ rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0);
+ rb_define_alloc_func(cWIN32OLE_EVENT, fev_s_allocate);
+ rb_define_method(cWIN32OLE_EVENT, "initialize", fev_initialize, -1);
+ rb_define_method(cWIN32OLE_EVENT, "on_event", fev_on_event, -1);
+ rb_define_method(cWIN32OLE_EVENT, "on_event_with_outargs", fev_on_event_with_outargs, -1);
+ rb_define_method(cWIN32OLE_EVENT, "off_event", fev_off_event, -1);
+ rb_define_method(cWIN32OLE_EVENT, "unadvise", fev_unadvise, 0);
+ rb_define_method(cWIN32OLE_EVENT, "handler=", fev_set_handler, 1);
+ rb_define_method(cWIN32OLE_EVENT, "handler", fev_get_handler, 0);
+
+ cWIN32OLE_VARIANT = rb_define_class("WIN32OLE_VARIANT", rb_cObject);
+ rb_define_alloc_func(cWIN32OLE_VARIANT, folevariant_s_allocate);
+ rb_define_singleton_method(cWIN32OLE_VARIANT, "array", folevariant_s_array, 2);
+ rb_define_method(cWIN32OLE_VARIANT, "initialize", folevariant_initialize, -2);
+ rb_define_method(cWIN32OLE_VARIANT, "value", folevariant_value, 0);
+ rb_define_method(cWIN32OLE_VARIANT, "value=", folevariant_set_value, 1);
+ rb_define_method(cWIN32OLE_VARIANT, "vartype", folevariant_vartype, 0);
+ rb_define_method(cWIN32OLE_VARIANT, "[]", folevariant_ary_aref, -1);
+ rb_define_method(cWIN32OLE_VARIANT, "[]=", folevariant_ary_aset, -1);
+ rb_define_const(cWIN32OLE_VARIANT, "Empty", rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_EMPTY)));
+ rb_define_const(cWIN32OLE_VARIANT, "Null", rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_NULL)));
+ rb_define_const(cWIN32OLE_VARIANT, "Nothing", rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_DISPATCH)));
+
+ eWIN32OLERuntimeError = rb_define_class("WIN32OLERuntimeError", rb_eRuntimeError);
+
+ init_enc2cp();
+ atexit((void (*)(void))free_enc2cp);
ole_init_cp();
}
diff --git a/ext/win32ole/win32ole.h b/ext/win32ole/win32ole.h
deleted file mode 100644
index d61f5e23b4..0000000000
--- a/ext/win32ole/win32ole.h
+++ /dev/null
@@ -1,155 +0,0 @@
-#ifndef WIN32OLE_H
-#define WIN32OLE_H 1
-#include "ruby/ruby.h"
-#include "ruby/st.h"
-#include "ruby/encoding.h"
-
-#define GNUC_OLDER_3_4_4 \
- ((__GNUC__ < 3) || \
- ((__GNUC__ <= 3) && (__GNUC_MINOR__ < 4)) || \
- ((__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)))
-
-#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
-#ifndef NONAMELESSUNION
-#define NONAMELESSUNION 1
-#endif
-#endif
-
-#include <ctype.h>
-
-#include <windows.h>
-#include <ocidl.h>
-#include <olectl.h>
-#include <ole2.h>
-#if defined(HAVE_TYPE_IMULTILANGUAGE2) || defined(HAVE_TYPE_IMULTILANGUAGE)
-#include <mlang.h>
-#endif
-#include <stdlib.h>
-#include <math.h>
-#ifdef HAVE_STDARG_PROTOTYPES
-#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
-#include <objidl.h>
-
-#define DOUT fprintf(stderr,"%s(%d)\n", __FILE__, __LINE__)
-#define DOUTS(x) fprintf(stderr,"%s(%d):" #x "=%s\n",__FILE__, __LINE__,x)
-#define DOUTMSG(x) fprintf(stderr, "%s(%d):" #x "\n",__FILE__, __LINE__)
-#define DOUTI(x) fprintf(stderr, "%s(%d):" #x "=%d\n",__FILE__, __LINE__,x)
-#define DOUTD(x) fprintf(stderr, "%s(%d):" #x "=%f\n",__FILE__, __LINE__,x)
-
-#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
-#define V_UNION1(X, Y) ((X)->u.Y)
-#else
-#define V_UNION1(X, Y) ((X)->Y)
-#endif
-
-#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
-#undef V_UNION
-#define V_UNION(X,Y) ((X)->n1.n2.n3.Y)
-
-#undef V_VT
-#define V_VT(X) ((X)->n1.n2.vt)
-
-#undef V_BOOL
-#define V_BOOL(X) V_UNION(X,boolVal)
-#endif
-
-#ifndef V_I1REF
-#define V_I1REF(X) V_UNION(X, pcVal)
-#endif
-
-#ifndef V_UI2REF
-#define V_UI2REF(X) V_UNION(X, puiVal)
-#endif
-
-#ifndef V_INT
-#define V_INT(X) V_UNION(X, intVal)
-#endif
-
-#ifndef V_INTREF
-#define V_INTREF(X) V_UNION(X, pintVal)
-#endif
-
-#ifndef V_UINT
-#define V_UINT(X) V_UNION(X, uintVal)
-#endif
-
-#ifndef V_UINTREF
-#define V_UINTREF(X) V_UNION(X, puintVal)
-#endif
-
-#ifdef HAVE_LONG_LONG
-#define I8_2_NUM LL2NUM
-#define UI8_2_NUM ULL2NUM
-#define NUM2I8 NUM2LL
-#define NUM2UI8 NUM2ULL
-#else
-#define I8_2_NUM INT2NUM
-#define UI8_2_NUM UINT2NUM
-#define NUM2I8 NUM2INT
-#define NUM2UI8 NUM2UINT
-#endif
-
-#define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0
-#define OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0
-#define OLE_FREE(x) {\
- if(ole_initialized() == TRUE) {\
- if(x) {\
- OLE_RELEASE(x);\
- (x) = 0;\
- }\
- }\
-}
-
-#define OLE_GET_TYPEATTR(X, Y) ((X)->lpVtbl->GetTypeAttr((X), (Y)))
-#define OLE_RELEASE_TYPEATTR(X, Y) ((X)->lpVtbl->ReleaseTypeAttr((X), (Y)))
-
-struct oledata {
- IDispatch *pDispatch;
-};
-
-VALUE cWIN32OLE;
-LCID cWIN32OLE_lcid;
-
-struct oledata *oledata_get_struct(VALUE obj);
-LPWSTR ole_vstr2wc(VALUE vstr);
-LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey);
-LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey);
-VALUE reg_enum_key(HKEY hkey, DWORD i);
-VALUE reg_get_val(HKEY hkey, const char *subkey);
-VALUE reg_get_val2(HKEY hkey, const char *subkey);
-void ole_initialize(void);
-VALUE default_inspect(VALUE self, const char *class_name);
-char *ole_wc2mb(LPWSTR pw);
-VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree);
-
-#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-
-BOOL ole_initialized(void);
-HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile);
-VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
-VALUE make_inspect(const char *class_name, VALUE detail);
-void ole_val2variant(VALUE val, VARIANT *var);
-void ole_val2variant2(VALUE val, VARIANT *var);
-void ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt);
-VALUE ole_variant2val(VARIANT *pvar);
-HRESULT ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt);
-VOID *val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt);
-HRESULT typelib_from_val(VALUE obj, ITypeLib **pTypeLib);
-
-#include "win32ole_variant_m.h"
-#include "win32ole_typelib.h"
-#include "win32ole_type.h"
-#include "win32ole_variable.h"
-#include "win32ole_method.h"
-#include "win32ole_param.h"
-#include "win32ole_event.h"
-#include "win32ole_variant.h"
-#include "win32ole_record.h"
-#include "win32ole_error.h"
-
-#endif
diff --git a/ext/win32ole/win32ole_error.c b/ext/win32ole/win32ole_error.c
deleted file mode 100644
index 62e69b186c..0000000000
--- a/ext/win32ole/win32ole_error.c
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "win32ole.h"
-
-static VALUE ole_hresult2msg(HRESULT hr);
-
-static VALUE
-ole_hresult2msg(HRESULT hr)
-{
- VALUE msg = Qnil;
- char *p_msg = NULL;
- char *term = NULL;
- DWORD dwCount;
-
- char strhr[100];
- sprintf(strhr, " HRESULT error code:0x%08x\n ", (unsigned)hr);
- msg = rb_str_new2(strhr);
- dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, hr,
- MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
- (LPTSTR)&p_msg, 0, NULL);
- if (dwCount == 0) {
- dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, hr, cWIN32OLE_lcid,
- (LPTSTR)&p_msg, 0, NULL);
- }
- if (dwCount > 0) {
- term = p_msg + strlen(p_msg);
- while (p_msg < term) {
- term--;
- if (*term == '\r' || *term == '\n')
- *term = '\0';
- else break;
- }
- if (p_msg[0] != '\0') {
- rb_str_cat2(msg, p_msg);
- }
- }
- LocalFree(p_msg);
- return msg;
-}
-
-void
-ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...)
-{
- va_list args;
- VALUE msg;
- VALUE err_msg;
- va_init_list(args, fmt);
- msg = rb_vsprintf(fmt, args);
- va_end(args);
-
- err_msg = ole_hresult2msg(hr);
- if(err_msg != Qnil) {
- rb_str_cat2(msg, "\n");
- rb_str_append(msg, err_msg);
- }
- rb_exc_raise(rb_exc_new_str(ecs, msg));
-}
-
-void
-Init_win32ole_error(void)
-{
- /*
- * Document-class: WIN32OLERuntimeError
- *
- * Raised when OLE processing failed.
- *
- * EX:
- *
- * obj = WIN32OLE.new("NonExistProgID")
- *
- * raises the exception:
- *
- * WIN32OLERuntimeError: unknown OLE server: `NonExistProgID'
- * HRESULT error code:0x800401f3
- * Invalid class string
- *
- */
- eWIN32OLERuntimeError = rb_define_class("WIN32OLERuntimeError", rb_eRuntimeError);
-}
diff --git a/ext/win32ole/win32ole_error.h b/ext/win32ole/win32ole_error.h
deleted file mode 100644
index 5359646ff1..0000000000
--- a/ext/win32ole/win32ole_error.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef WIN32OLE_ERROR_H
-#define WIN32OLE_ERROR_H 1
-
-VALUE eWIN32OLERuntimeError;
-void ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...);
-void Init_win32ole_error(void);
-
-#endif
diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c
deleted file mode 100644
index 8e30732592..0000000000
--- a/ext/win32ole/win32ole_event.c
+++ /dev/null
@@ -1,1278 +0,0 @@
-#include "win32ole.h"
-
-/*
- * Document-class: WIN32OLE_EVENT
- *
- * <code>WIN32OLE_EVENT</code> objects controls OLE event.
- */
-
-typedef struct {
- struct IEventSinkVtbl * lpVtbl;
-} IEventSink, *PEVENTSINK;
-
-typedef struct IEventSinkVtbl IEventSinkVtbl;
-
-struct IEventSinkVtbl {
- STDMETHOD(QueryInterface)(
- PEVENTSINK,
- REFIID,
- LPVOID *);
- STDMETHOD_(ULONG, AddRef)(PEVENTSINK);
- STDMETHOD_(ULONG, Release)(PEVENTSINK);
-
- STDMETHOD(GetTypeInfoCount)(
- PEVENTSINK,
- UINT *);
- STDMETHOD(GetTypeInfo)(
- PEVENTSINK,
- UINT,
- LCID,
- ITypeInfo **);
- STDMETHOD(GetIDsOfNames)(
- PEVENTSINK,
- REFIID,
- OLECHAR **,
- UINT,
- LCID,
- DISPID *);
- STDMETHOD(Invoke)(
- PEVENTSINK,
- DISPID,
- REFIID,
- LCID,
- WORD,
- DISPPARAMS *,
- VARIANT *,
- EXCEPINFO *,
- UINT *);
-};
-
-typedef struct tagIEVENTSINKOBJ {
- const IEventSinkVtbl *lpVtbl;
- DWORD m_cRef;
- IID m_iid;
- long m_event_id;
- ITypeInfo *pTypeInfo;
-}IEVENTSINKOBJ, *PIEVENTSINKOBJ;
-
-struct oleeventdata {
- DWORD dwCookie;
- IConnectionPoint *pConnectionPoint;
- IDispatch *pDispatch;
- long event_id;
-};
-
-static VALUE ary_ole_event;
-static ID id_events;
-
-VALUE cWIN32OLE_EVENT;
-
-STDMETHODIMP EVENTSINK_QueryInterface(PEVENTSINK, REFIID, LPVOID*);
-STDMETHODIMP_(ULONG) EVENTSINK_AddRef(PEVENTSINK);
-STDMETHODIMP_(ULONG) EVENTSINK_Release(PEVENTSINK);
-STDMETHODIMP EVENTSINK_GetTypeInfoCount(PEVENTSINK, UINT*);
-STDMETHODIMP EVENTSINK_GetTypeInfo(PEVENTSINK, UINT, LCID, ITypeInfo**);
-STDMETHODIMP EVENTSINK_GetIDsOfNames(PEVENTSINK, REFIID, OLECHAR**, UINT, LCID, DISPID*);
-STDMETHODIMP EVENTSINK_Invoke(PEVENTSINK, DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*);
-
-static const IEventSinkVtbl vtEventSink = {
- EVENTSINK_QueryInterface,
- EVENTSINK_AddRef,
- EVENTSINK_Release,
- EVENTSINK_GetTypeInfoCount,
- EVENTSINK_GetTypeInfo,
- EVENTSINK_GetIDsOfNames,
- EVENTSINK_Invoke,
-};
-
-void EVENTSINK_Destructor(PIEVENTSINKOBJ);
-static void ole_val2ptr_variant(VALUE val, VARIANT *var);
-static void hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS *pdispparams);
-static VALUE hash2result(VALUE hash);
-static void ary2ptr_dispparams(VALUE ary, DISPPARAMS *pdispparams);
-static VALUE exec_callback(VALUE arg);
-static VALUE rescue_callback(VALUE arg);
-static HRESULT find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo);
-static HRESULT find_coclass(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, ITypeInfo **pTypeInfo2, TYPEATTR **pTypeAttr2);
-static HRESULT find_default_source_from_typeinfo(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, ITypeInfo **ppTypeInfo);
-static HRESULT find_default_source(VALUE ole, IID *piid, ITypeInfo **ppTypeInfo);
-static long ole_search_event_at(VALUE ary, VALUE ev);
-static VALUE ole_search_event(VALUE ary, VALUE ev, BOOL *is_default);
-static VALUE ole_search_handler_method(VALUE handler, VALUE ev, BOOL *is_default_handler);
-static void ole_delete_event(VALUE ary, VALUE ev);
-static void oleevent_free(void *ptr);
-static size_t oleevent_size(const void *ptr);
-static VALUE fev_s_allocate(VALUE klass);
-static VALUE ev_advise(int argc, VALUE *argv, VALUE self);
-static VALUE fev_initialize(int argc, VALUE *argv, VALUE self);
-static void ole_msg_loop(void);
-static VALUE fev_s_msg_loop(VALUE klass);
-static void add_event_call_back(VALUE obj, VALUE event, VALUE data);
-static VALUE ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg);
-static VALUE fev_on_event(int argc, VALUE *argv, VALUE self);
-static VALUE fev_on_event_with_outargs(int argc, VALUE *argv, VALUE self);
-static VALUE fev_off_event(int argc, VALUE *argv, VALUE self);
-static VALUE fev_unadvise(VALUE self);
-static VALUE fev_set_handler(VALUE self, VALUE val);
-static VALUE fev_get_handler(VALUE self);
-static VALUE evs_push(VALUE ev);
-static VALUE evs_delete(long i);
-static VALUE evs_entry(long i);
-static long evs_length(void);
-
-
-static const rb_data_type_t oleevent_datatype = {
- "win32ole_event",
- {NULL, oleevent_free, oleevent_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-STDMETHODIMP EVENTSINK_Invoke(
- PEVENTSINK pEventSink,
- DISPID dispid,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- DISPPARAMS *pdispparams,
- VARIANT *pvarResult,
- EXCEPINFO *pexcepinfo,
- UINT *puArgErr
- ) {
-
- HRESULT hr;
- BSTR bstr;
- unsigned int count;
- unsigned int i;
- ITypeInfo *pTypeInfo;
- VARIANT *pvar;
- VALUE ary, obj, event, args, outargv, ev, result;
- VALUE handler = Qnil;
- VALUE arg[3];
- VALUE mid;
- VALUE is_outarg = Qfalse;
- BOOL is_default_handler = FALSE;
- int state;
-
- PIEVENTSINKOBJ pEV = (PIEVENTSINKOBJ)pEventSink;
- pTypeInfo = pEV->pTypeInfo;
- obj = evs_entry(pEV->m_event_id);
- if (!rb_obj_is_kind_of(obj, cWIN32OLE_EVENT)) {
- return NOERROR;
- }
-
- ary = rb_ivar_get(obj, id_events);
- if (NIL_P(ary) || !RB_TYPE_P(ary, T_ARRAY)) {
- return NOERROR;
- }
- hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid,
- &bstr, 1, &count);
- if (FAILED(hr)) {
- return NOERROR;
- }
- ev = WC2VSTR(bstr);
- event = ole_search_event(ary, ev, &is_default_handler);
- if (RB_TYPE_P(event, T_ARRAY)) {
- handler = rb_ary_entry(event, 0);
- mid = rb_intern("call");
- is_outarg = rb_ary_entry(event, 3);
- } else {
- handler = rb_ivar_get(obj, rb_intern("handler"));
- if (handler == Qnil) {
- return NOERROR;
- }
- mid = ole_search_handler_method(handler, ev, &is_default_handler);
- }
- if (handler == Qnil || mid == Qnil) {
- return NOERROR;
- }
-
- args = rb_ary_new();
- if (is_default_handler) {
- rb_ary_push(args, ev);
- }
-
- /* make argument of event handler */
- for (i = 0; i < pdispparams->cArgs; ++i) {
- pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
- rb_ary_push(args, ole_variant2val(pvar));
- }
- outargv = Qnil;
- if (is_outarg == Qtrue) {
- outargv = rb_ary_new();
- rb_ary_push(args, outargv);
- }
-
- /*
- * if exception raised in event callback,
- * then you receive cfp consistency error.
- * to avoid this error we use begin rescue end.
- * and the exception raised then error message print
- * and exit ruby process by Win32OLE itself.
- */
- arg[0] = handler;
- arg[1] = mid;
- arg[2] = args;
- result = rb_protect(exec_callback, (VALUE)arg, &state);
- if (state != 0) {
- rescue_callback(Qnil);
- }
- if(RB_TYPE_P(result, T_HASH)) {
- hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams);
- result = hash2result(result);
- }else if (is_outarg == Qtrue && RB_TYPE_P(outargv, T_ARRAY)) {
- ary2ptr_dispparams(outargv, pdispparams);
- }
-
- if (pvarResult) {
- VariantInit(pvarResult);
- ole_val2variant(result, pvarResult);
- }
-
- return NOERROR;
-}
-
-STDMETHODIMP
-EVENTSINK_QueryInterface(
- PEVENTSINK pEV,
- REFIID iid,
- LPVOID* ppv
- ) {
- if (IsEqualIID(iid, &IID_IUnknown) ||
- IsEqualIID(iid, &IID_IDispatch) ||
- IsEqualIID(iid, &((PIEVENTSINKOBJ)pEV)->m_iid)) {
- *ppv = pEV;
- }
- else {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- ((LPUNKNOWN)*ppv)->lpVtbl->AddRef((LPUNKNOWN)*ppv);
- return NOERROR;
-}
-
-STDMETHODIMP_(ULONG)
-EVENTSINK_AddRef(
- PEVENTSINK pEV
- ){
- PIEVENTSINKOBJ pEVObj = (PIEVENTSINKOBJ)pEV;
- return ++pEVObj->m_cRef;
-}
-
-STDMETHODIMP_(ULONG) EVENTSINK_Release(
- PEVENTSINK pEV
- ) {
- PIEVENTSINKOBJ pEVObj = (PIEVENTSINKOBJ)pEV;
- --pEVObj->m_cRef;
- if(pEVObj->m_cRef != 0)
- return pEVObj->m_cRef;
- EVENTSINK_Destructor(pEVObj);
- return 0;
-}
-
-STDMETHODIMP EVENTSINK_GetTypeInfoCount(
- PEVENTSINK pEV,
- UINT *pct
- ) {
- *pct = 0;
- return NOERROR;
-}
-
-STDMETHODIMP EVENTSINK_GetTypeInfo(
- PEVENTSINK pEV,
- UINT info,
- LCID lcid,
- ITypeInfo **pInfo
- ) {
- *pInfo = NULL;
- return DISP_E_BADINDEX;
-}
-
-STDMETHODIMP EVENTSINK_GetIDsOfNames(
- PEVENTSINK pEventSink,
- REFIID riid,
- OLECHAR **szNames,
- UINT cNames,
- LCID lcid,
- DISPID *pDispID
- ) {
- ITypeInfo *pTypeInfo;
- PIEVENTSINKOBJ pEV = (PIEVENTSINKOBJ)pEventSink;
- pTypeInfo = pEV->pTypeInfo;
- if (pTypeInfo) {
- return pTypeInfo->lpVtbl->GetIDsOfNames(pTypeInfo, szNames, cNames, pDispID);
- }
- return DISP_E_UNKNOWNNAME;
-}
-
-PIEVENTSINKOBJ
-EVENTSINK_Constructor(void)
-{
- PIEVENTSINKOBJ pEv;
- pEv = ALLOC_N(IEVENTSINKOBJ, 1);
- if(pEv == NULL) return NULL;
- pEv->lpVtbl = &vtEventSink;
- pEv->m_cRef = 0;
- pEv->m_event_id = 0;
- pEv->pTypeInfo = NULL;
- return pEv;
-}
-
-void
-EVENTSINK_Destructor(
- PIEVENTSINKOBJ pEVObj
- ) {
- if(pEVObj != NULL) {
- OLE_RELEASE(pEVObj->pTypeInfo);
- free(pEVObj);
- pEVObj = NULL;
- }
-}
-
-static void
-ole_val2ptr_variant(VALUE val, VARIANT *var)
-{
- switch (TYPE(val)) {
- case T_STRING:
- if (V_VT(var) == (VT_BSTR | VT_BYREF)) {
- *V_BSTRREF(var) = ole_vstr2wc(val);
- }
- break;
- case T_FIXNUM:
- switch(V_VT(var)) {
- case (VT_UI1 | VT_BYREF) :
- *V_UI1REF(var) = NUM2CHR(val);
- break;
- case (VT_I2 | VT_BYREF) :
- *V_I2REF(var) = (short)NUM2INT(val);
- break;
- case (VT_I4 | VT_BYREF) :
- *V_I4REF(var) = NUM2INT(val);
- break;
- case (VT_R4 | VT_BYREF) :
- *V_R4REF(var) = (float)NUM2INT(val);
- break;
- case (VT_R8 | VT_BYREF) :
- *V_R8REF(var) = NUM2INT(val);
- break;
- default:
- break;
- }
- break;
- case T_FLOAT:
- switch(V_VT(var)) {
- case (VT_I2 | VT_BYREF) :
- *V_I2REF(var) = (short)NUM2INT(val);
- break;
- case (VT_I4 | VT_BYREF) :
- *V_I4REF(var) = NUM2INT(val);
- break;
- case (VT_R4 | VT_BYREF) :
- *V_R4REF(var) = (float)NUM2DBL(val);
- break;
- case (VT_R8 | VT_BYREF) :
- *V_R8REF(var) = NUM2DBL(val);
- break;
- default:
- break;
- }
- break;
- case T_BIGNUM:
- if (V_VT(var) == (VT_R8 | VT_BYREF)) {
- *V_R8REF(var) = rb_big2dbl(val);
- }
- break;
- case T_TRUE:
- if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
- *V_BOOLREF(var) = VARIANT_TRUE;
- }
- break;
- case T_FALSE:
- if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
- *V_BOOLREF(var) = VARIANT_FALSE;
- }
- break;
- default:
- break;
- }
-}
-
-static void
-hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS *pdispparams)
-{
- BSTR *bstrs;
- HRESULT hr;
- UINT len, i;
- VARIANT *pvar;
- VALUE val;
- VALUE key;
- len = 0;
- bstrs = ALLOCA_N(BSTR, pdispparams->cArgs + 1);
- hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid,
- bstrs, pdispparams->cArgs + 1,
- &len);
- if (FAILED(hr))
- return;
-
- for (i = 0; i < len - 1; i++) {
- key = WC2VSTR(bstrs[i + 1]);
- val = rb_hash_aref(hash, INT2FIX(i));
- if (val == Qnil)
- val = rb_hash_aref(hash, key);
- if (val == Qnil)
- val = rb_hash_aref(hash, rb_str_intern(key));
- pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
- ole_val2ptr_variant(val, pvar);
- }
-}
-
-static VALUE
-hash2result(VALUE hash)
-{
- VALUE ret = Qnil;
- ret = rb_hash_aref(hash, rb_str_new2("return"));
- if (ret == Qnil)
- ret = rb_hash_aref(hash, rb_str_intern(rb_str_new2("return")));
- return ret;
-}
-
-static void
-ary2ptr_dispparams(VALUE ary, DISPPARAMS *pdispparams)
-{
- int i;
- VALUE v;
- VARIANT *pvar;
- for(i = 0; i < RARRAY_LEN(ary) && (unsigned int) i < pdispparams->cArgs; i++) {
- v = rb_ary_entry(ary, i);
- pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
- ole_val2ptr_variant(v, pvar);
- }
-}
-
-static VALUE
-exec_callback(VALUE arg)
-{
- VALUE *parg = (VALUE *)arg;
- VALUE handler = parg[0];
- VALUE mid = parg[1];
- VALUE args = parg[2];
- return rb_apply(handler, mid, args);
-}
-
-static VALUE
-rescue_callback(VALUE arg)
-{
-
- VALUE error;
- VALUE e = rb_errinfo();
- VALUE bt = rb_funcall(e, rb_intern("backtrace"), 0);
- VALUE msg = rb_funcall(e, rb_intern("message"), 0);
- bt = rb_ary_entry(bt, 0);
- error = rb_sprintf("%"PRIsVALUE": %"PRIsVALUE" (%s)\n", bt, msg, rb_obj_classname(e));
- rb_write_error(StringValuePtr(error));
- rb_backtrace();
- ruby_finalize();
- exit(-1);
-
- return Qnil;
-}
-
-static HRESULT
-find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo)
-{
- HRESULT hr;
- IDispatch *pDispatch;
- ITypeInfo *pTypeInfo;
- ITypeLib *pTypeLib;
- TYPEATTR *pTypeAttr;
- HREFTYPE RefType;
- ITypeInfo *pImplTypeInfo;
- TYPEATTR *pImplTypeAttr;
-
- struct oledata *pole = NULL;
- unsigned int index;
- unsigned int count;
- int type;
- BSTR bstr;
- char *pstr;
-
- BOOL is_found = FALSE;
- LCID lcid = cWIN32OLE_lcid;
-
- pole = oledata_get_struct(ole);
-
- pDispatch = pole->pDispatch;
-
- hr = pDispatch->lpVtbl->GetTypeInfo(pDispatch, 0, lcid, &pTypeInfo);
- if (FAILED(hr))
- return hr;
-
- hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo,
- &pTypeLib,
- &index);
- OLE_RELEASE(pTypeInfo);
- if (FAILED(hr))
- return hr;
-
- if (!pitf) {
- hr = pTypeLib->lpVtbl->GetTypeInfoOfGuid(pTypeLib,
- piid,
- ppTypeInfo);
- OLE_RELEASE(pTypeLib);
- return hr;
- }
- count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
- for (index = 0; index < count; index++) {
- hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib,
- index,
- &pTypeInfo);
- if (FAILED(hr))
- break;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-
- if(FAILED(hr)) {
- OLE_RELEASE(pTypeInfo);
- break;
- }
- if(pTypeAttr->typekind == TKIND_COCLASS) {
- for (type = 0; type < pTypeAttr->cImplTypes; type++) {
- hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
- type,
- &RefType);
- if (FAILED(hr))
- break;
- hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
- RefType,
- &pImplTypeInfo);
- if (FAILED(hr))
- break;
-
- hr = pImplTypeInfo->lpVtbl->GetDocumentation(pImplTypeInfo,
- -1,
- &bstr,
- NULL, NULL, NULL);
- if (FAILED(hr)) {
- OLE_RELEASE(pImplTypeInfo);
- break;
- }
- pstr = ole_wc2mb(bstr);
- if (strcmp(pitf, pstr) == 0) {
- hr = pImplTypeInfo->lpVtbl->GetTypeAttr(pImplTypeInfo,
- &pImplTypeAttr);
- if (SUCCEEDED(hr)) {
- is_found = TRUE;
- *piid = pImplTypeAttr->guid;
- if (ppTypeInfo) {
- *ppTypeInfo = pImplTypeInfo;
- (*ppTypeInfo)->lpVtbl->AddRef((*ppTypeInfo));
- }
- pImplTypeInfo->lpVtbl->ReleaseTypeAttr(pImplTypeInfo,
- pImplTypeAttr);
- }
- }
- free(pstr);
- OLE_RELEASE(pImplTypeInfo);
- if (is_found || FAILED(hr))
- break;
- }
- }
-
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- OLE_RELEASE(pTypeInfo);
- if (is_found || FAILED(hr))
- break;
- }
- OLE_RELEASE(pTypeLib);
- if(!is_found)
- return E_NOINTERFACE;
- return hr;
-}
-
-static HRESULT
-find_coclass(
- ITypeInfo *pTypeInfo,
- TYPEATTR *pTypeAttr,
- ITypeInfo **pCOTypeInfo,
- TYPEATTR **pCOTypeAttr)
-{
- HRESULT hr = E_NOINTERFACE;
- ITypeLib *pTypeLib;
- int count;
- BOOL found = FALSE;
- ITypeInfo *pTypeInfo2;
- TYPEATTR *pTypeAttr2;
- int flags;
- int i,j;
- HREFTYPE href;
- ITypeInfo *pRefTypeInfo;
- TYPEATTR *pRefTypeAttr;
-
- hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, NULL);
- if (FAILED(hr)) {
- return hr;
- }
- count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
- for (i = 0; i < count && !found; i++) {
- hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo2);
- if (FAILED(hr))
- continue;
- hr = OLE_GET_TYPEATTR(pTypeInfo2, &pTypeAttr2);
- if (FAILED(hr)) {
- OLE_RELEASE(pTypeInfo2);
- continue;
- }
- if (pTypeAttr2->typekind != TKIND_COCLASS) {
- OLE_RELEASE_TYPEATTR(pTypeInfo2, pTypeAttr2);
- OLE_RELEASE(pTypeInfo2);
- continue;
- }
- for (j = 0; j < pTypeAttr2->cImplTypes && !found; j++) {
- hr = pTypeInfo2->lpVtbl->GetImplTypeFlags(pTypeInfo2, j, &flags);
- if (FAILED(hr))
- continue;
- if (!(flags & IMPLTYPEFLAG_FDEFAULT))
- continue;
- hr = pTypeInfo2->lpVtbl->GetRefTypeOfImplType(pTypeInfo2, j, &href);
- if (FAILED(hr))
- continue;
- hr = pTypeInfo2->lpVtbl->GetRefTypeInfo(pTypeInfo2, href, &pRefTypeInfo);
- if (FAILED(hr))
- continue;
- hr = OLE_GET_TYPEATTR(pRefTypeInfo, &pRefTypeAttr);
- if (FAILED(hr)) {
- OLE_RELEASE(pRefTypeInfo);
- continue;
- }
- if (IsEqualGUID(&(pTypeAttr->guid), &(pRefTypeAttr->guid))) {
- found = TRUE;
- }
- }
- if (!found) {
- OLE_RELEASE_TYPEATTR(pTypeInfo2, pTypeAttr2);
- OLE_RELEASE(pTypeInfo2);
- }
- }
- OLE_RELEASE(pTypeLib);
- if (found) {
- *pCOTypeInfo = pTypeInfo2;
- *pCOTypeAttr = pTypeAttr2;
- hr = S_OK;
- } else {
- hr = E_NOINTERFACE;
- }
- return hr;
-}
-
-static HRESULT
-find_default_source_from_typeinfo(
- ITypeInfo *pTypeInfo,
- TYPEATTR *pTypeAttr,
- ITypeInfo **ppTypeInfo)
-{
- int i = 0;
- HRESULT hr = E_NOINTERFACE;
- int flags;
- HREFTYPE hRefType;
- /* Enumerate all implemented types of the COCLASS */
- for (i = 0; i < pTypeAttr->cImplTypes; i++) {
- hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
- if (FAILED(hr))
- continue;
-
- /*
- looking for the [default] [source]
- we just hope that it is a dispinterface :-)
- */
- if ((flags & IMPLTYPEFLAG_FDEFAULT) &&
- (flags & IMPLTYPEFLAG_FSOURCE)) {
-
- hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
- i, &hRefType);
- if (FAILED(hr))
- continue;
- hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
- hRefType, ppTypeInfo);
- if (SUCCEEDED(hr))
- break;
- }
- }
- return hr;
-}
-
-static HRESULT
-find_default_source(VALUE ole, IID *piid, ITypeInfo **ppTypeInfo)
-{
- HRESULT hr;
- IProvideClassInfo2 *pProvideClassInfo2;
- IProvideClassInfo *pProvideClassInfo;
- void *p;
-
- IDispatch *pDispatch;
- ITypeInfo *pTypeInfo;
- ITypeInfo *pTypeInfo2 = NULL;
- TYPEATTR *pTypeAttr;
- TYPEATTR *pTypeAttr2 = NULL;
-
- struct oledata *pole = NULL;
-
- pole = oledata_get_struct(ole);
- pDispatch = pole->pDispatch;
- hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
- &IID_IProvideClassInfo2,
- &p);
- if (SUCCEEDED(hr)) {
- pProvideClassInfo2 = p;
- hr = pProvideClassInfo2->lpVtbl->GetGUID(pProvideClassInfo2,
- GUIDKIND_DEFAULT_SOURCE_DISP_IID,
- piid);
- OLE_RELEASE(pProvideClassInfo2);
- if (SUCCEEDED(hr)) {
- hr = find_iid(ole, NULL, piid, ppTypeInfo);
- }
- }
- if (SUCCEEDED(hr)) {
- return hr;
- }
- hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
- &IID_IProvideClassInfo,
- &p);
- if (SUCCEEDED(hr)) {
- pProvideClassInfo = p;
- hr = pProvideClassInfo->lpVtbl->GetClassInfo(pProvideClassInfo,
- &pTypeInfo);
- OLE_RELEASE(pProvideClassInfo);
- }
- if (FAILED(hr)) {
- hr = pDispatch->lpVtbl->GetTypeInfo(pDispatch, 0, cWIN32OLE_lcid, &pTypeInfo );
- }
- if (FAILED(hr))
- return hr;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- OLE_RELEASE(pTypeInfo);
- return hr;
- }
-
- *ppTypeInfo = 0;
- hr = find_default_source_from_typeinfo(pTypeInfo, pTypeAttr, ppTypeInfo);
- if (!*ppTypeInfo) {
- hr = find_coclass(pTypeInfo, pTypeAttr, &pTypeInfo2, &pTypeAttr2);
- if (SUCCEEDED(hr)) {
- hr = find_default_source_from_typeinfo(pTypeInfo2, pTypeAttr2, ppTypeInfo);
- OLE_RELEASE_TYPEATTR(pTypeInfo2, pTypeAttr2);
- OLE_RELEASE(pTypeInfo2);
- }
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- OLE_RELEASE(pTypeInfo);
- /* Now that would be a bad surprise, if we didn't find it, wouldn't it? */
- if (!*ppTypeInfo) {
- if (SUCCEEDED(hr))
- hr = E_UNEXPECTED;
- return hr;
- }
-
- /* Determine IID of default source interface */
- hr = (*ppTypeInfo)->lpVtbl->GetTypeAttr(*ppTypeInfo, &pTypeAttr);
- if (SUCCEEDED(hr)) {
- *piid = pTypeAttr->guid;
- (*ppTypeInfo)->lpVtbl->ReleaseTypeAttr(*ppTypeInfo, pTypeAttr);
- }
- else
- OLE_RELEASE(*ppTypeInfo);
-
- return hr;
-}
-
-static long
-ole_search_event_at(VALUE ary, VALUE ev)
-{
- VALUE event;
- VALUE event_name;
- long i, len;
- long ret = -1;
- len = RARRAY_LEN(ary);
- for(i = 0; i < len; i++) {
- event = rb_ary_entry(ary, i);
- event_name = rb_ary_entry(event, 1);
- if(NIL_P(event_name) && NIL_P(ev)) {
- ret = i;
- break;
- }
- else if (RB_TYPE_P(ev, T_STRING) &&
- RB_TYPE_P(event_name, T_STRING) &&
- rb_str_cmp(ev, event_name) == 0) {
- ret = i;
- break;
- }
- }
- return ret;
-}
-
-static VALUE
-ole_search_event(VALUE ary, VALUE ev, BOOL *is_default)
-{
- VALUE event;
- VALUE def_event;
- VALUE event_name;
- int i, len;
- *is_default = FALSE;
- def_event = Qnil;
- len = RARRAY_LEN(ary);
- for(i = 0; i < len; i++) {
- event = rb_ary_entry(ary, i);
- event_name = rb_ary_entry(event, 1);
- if(NIL_P(event_name)) {
- *is_default = TRUE;
- def_event = event;
- }
- else if (rb_str_cmp(ev, event_name) == 0) {
- *is_default = FALSE;
- return event;
- }
- }
- return def_event;
-}
-
-static VALUE
-ole_search_handler_method(VALUE handler, VALUE ev, BOOL *is_default_handler)
-{
- VALUE mid;
-
- *is_default_handler = FALSE;
- mid = rb_to_id(rb_sprintf("on%"PRIsVALUE, ev));
- if (rb_respond_to(handler, mid)) {
- return mid;
- }
- mid = rb_intern("method_missing");
- if (rb_respond_to(handler, mid)) {
- *is_default_handler = TRUE;
- return mid;
- }
- return Qnil;
-}
-
-static void
-ole_delete_event(VALUE ary, VALUE ev)
-{
- long at = -1;
- at = ole_search_event_at(ary, ev);
- if (at >= 0) {
- rb_ary_delete_at(ary, at);
- }
-}
-
-
-static void
-oleevent_free(void *ptr)
-{
- struct oleeventdata *poleev = ptr;
- if (poleev->pConnectionPoint) {
- poleev->pConnectionPoint->lpVtbl->Unadvise(poleev->pConnectionPoint, poleev->dwCookie);
- OLE_RELEASE(poleev->pConnectionPoint);
- poleev->pConnectionPoint = NULL;
- }
- OLE_RELEASE(poleev->pDispatch);
- free(poleev);
-}
-
-static size_t
-oleevent_size(const void *ptr)
-{
- return ptr ? sizeof(struct oleeventdata) : 0;
-}
-
-static VALUE
-fev_s_allocate(VALUE klass)
-{
- VALUE obj;
- struct oleeventdata *poleev;
- obj = TypedData_Make_Struct(klass, struct oleeventdata, &oleevent_datatype, poleev);
- poleev->dwCookie = 0;
- poleev->pConnectionPoint = NULL;
- poleev->event_id = 0;
- poleev->pDispatch = NULL;
- return obj;
-}
-
-static VALUE
-ev_advise(int argc, VALUE *argv, VALUE self)
-{
-
- VALUE ole, itf;
- struct oledata *pole = NULL;
- char *pitf;
- HRESULT hr;
- IID iid;
- ITypeInfo *pTypeInfo = 0;
- IDispatch *pDispatch;
- IConnectionPointContainer *pContainer;
- IConnectionPoint *pConnectionPoint;
- IEVENTSINKOBJ *pIEV;
- DWORD dwCookie;
- struct oleeventdata *poleev;
- void *p;
-
- rb_scan_args(argc, argv, "11", &ole, &itf);
-
- if (!rb_obj_is_kind_of(ole, cWIN32OLE)) {
- rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE object");
- }
-
- if(!RB_TYPE_P(itf, T_NIL)) {
- pitf = StringValuePtr(itf);
- if (rb_safe_level() > 0 && OBJ_TAINTED(itf)) {
- rb_raise(rb_eSecurityError, "insecure event creation - `%s'",
- StringValuePtr(itf));
- }
- hr = find_iid(ole, pitf, &iid, &pTypeInfo);
- }
- else {
- hr = find_default_source(ole, &iid, &pTypeInfo);
- }
- if (FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "interface not found");
- }
-
- pole = oledata_get_struct(ole);
- pDispatch = pole->pDispatch;
- hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
- &IID_IConnectionPointContainer,
- &p);
- if (FAILED(hr)) {
- OLE_RELEASE(pTypeInfo);
- ole_raise(hr, rb_eRuntimeError,
- "failed to query IConnectionPointContainer");
- }
- pContainer = p;
-
- hr = pContainer->lpVtbl->FindConnectionPoint(pContainer,
- &iid,
- &pConnectionPoint);
- OLE_RELEASE(pContainer);
- if (FAILED(hr)) {
- OLE_RELEASE(pTypeInfo);
- ole_raise(hr, rb_eRuntimeError, "failed to query IConnectionPoint");
- }
- pIEV = EVENTSINK_Constructor();
- pIEV->m_iid = iid;
- hr = pConnectionPoint->lpVtbl->Advise(pConnectionPoint,
- (IUnknown*)pIEV,
- &dwCookie);
- if (FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "Advise Error");
- }
-
- TypedData_Get_Struct(self, struct oleeventdata, &oleevent_datatype, poleev);
- pIEV->m_event_id = evs_length();
- pIEV->pTypeInfo = pTypeInfo;
- poleev->dwCookie = dwCookie;
- poleev->pConnectionPoint = pConnectionPoint;
- poleev->event_id = pIEV->m_event_id;
- poleev->pDispatch = pDispatch;
- OLE_ADDREF(pDispatch);
-
- return self;
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
- *
- * Returns OLE event object.
- * The first argument specifies WIN32OLE object.
- * The second argument specifies OLE event name.
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
- */
-static VALUE
-fev_initialize(int argc, VALUE *argv, VALUE self)
-{
- ev_advise(argc, argv, self);
- evs_push(self);
- rb_ivar_set(self, id_events, rb_ary_new());
- fev_set_handler(self, Qnil);
- return self;
-}
-
-static void
-ole_msg_loop(void)
-{
- MSG msg;
- while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT.message_loop
- *
- * Translates and dispatches Windows message.
- */
-static VALUE
-fev_s_msg_loop(VALUE klass)
-{
- ole_msg_loop();
- return Qnil;
-}
-
-static void
-add_event_call_back(VALUE obj, VALUE event, VALUE data)
-{
- VALUE events = rb_ivar_get(obj, id_events);
- if (NIL_P(events) || !RB_TYPE_P(events, T_ARRAY)) {
- events = rb_ary_new();
- rb_ivar_set(obj, id_events, events);
- }
- ole_delete_event(events, event);
- rb_ary_push(events, data);
-}
-
-static VALUE
-ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg)
-{
- struct oleeventdata *poleev;
- VALUE event, args, data;
- TypedData_Get_Struct(self, struct oleeventdata, &oleevent_datatype, poleev);
- if (poleev->pConnectionPoint == NULL) {
- rb_raise(eWIN32OLERuntimeError, "IConnectionPoint not found. You must call advise at first.");
- }
- rb_scan_args(argc, argv, "01*", &event, &args);
- if(!NIL_P(event)) {
- if(!RB_TYPE_P(event, T_STRING) && !RB_TYPE_P(event, T_SYMBOL)) {
- rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
- }
- if (RB_TYPE_P(event, T_SYMBOL)) {
- event = rb_sym2str(event);
- }
- }
- data = rb_ary_new3(4, rb_block_proc(), event, args, is_ary_arg);
- add_event_call_back(self, event, data);
- return Qnil;
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT#on_event([event]){...}
- *
- * Defines the callback event.
- * If argument is omitted, this method defines the callback of all events.
- * If you want to modify reference argument in callback, return hash in
- * callback. If you want to return value to OLE server as result of callback
- * use `return' or :return.
- *
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie)
- * ev.on_event("NavigateComplete") {|url| puts url}
- * ev.on_event() {|ev, *args| puts "#{ev} fired"}
- *
- * ev.on_event("BeforeNavigate2") {|*args|
- * ...
- * # set true to BeforeNavigate reference argument `Cancel'.
- * # Cancel is 7-th argument of BeforeNavigate,
- * # so you can use 6 as key of hash instead of 'Cancel'.
- * # The argument is counted from 0.
- * # The hash key of 0 means first argument.)
- * {:Cancel => true} # or {'Cancel' => true} or {6 => true}
- * }
- *
- * ev.on_event(...) {|*args|
- * {:return => 1, :xxx => yyy}
- * }
- */
-static VALUE
-fev_on_event(int argc, VALUE *argv, VALUE self)
-{
- return ev_on_event(argc, argv, self, Qfalse);
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT#on_event_with_outargs([event]){...}
- *
- * Defines the callback of event.
- * If you want modify argument in callback,
- * you could use this method instead of WIN32OLE_EVENT#on_event.
- *
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie)
- * ev.on_event_with_outargs('BeforeNavigate2') {|*args|
- * args.last[6] = true
- * }
- */
-static VALUE
-fev_on_event_with_outargs(int argc, VALUE *argv, VALUE self)
-{
- return ev_on_event(argc, argv, self, Qtrue);
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT#off_event([event])
- *
- * removes the callback of event.
- *
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie)
- * ev.on_event('BeforeNavigate2') {|*args|
- * args.last[6] = true
- * }
- * ...
- * ev.off_event('BeforeNavigate2')
- * ...
- */
-static VALUE
-fev_off_event(int argc, VALUE *argv, VALUE self)
-{
- VALUE event = Qnil;
- VALUE events;
-
- rb_scan_args(argc, argv, "01", &event);
- if(!NIL_P(event)) {
- if(!RB_TYPE_P(event, T_STRING) && !RB_TYPE_P(event, T_SYMBOL)) {
- rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
- }
- if (RB_TYPE_P(event, T_SYMBOL)) {
- event = rb_sym2str(event);
- }
- }
- events = rb_ivar_get(self, id_events);
- if (NIL_P(events)) {
- return Qnil;
- }
- ole_delete_event(events, event);
- return Qnil;
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT#unadvise -> nil
- *
- * disconnects OLE server. If this method called, then the WIN32OLE_EVENT object
- * does not receive the OLE server event any more.
- * This method is trial implementation.
- *
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie)
- * ev.on_event() {...}
- * ...
- * ev.unadvise
- *
- */
-static VALUE
-fev_unadvise(VALUE self)
-{
- struct oleeventdata *poleev;
- TypedData_Get_Struct(self, struct oleeventdata, &oleevent_datatype, poleev);
- if (poleev->pConnectionPoint) {
- ole_msg_loop();
- evs_delete(poleev->event_id);
- poleev->pConnectionPoint->lpVtbl->Unadvise(poleev->pConnectionPoint, poleev->dwCookie);
- OLE_RELEASE(poleev->pConnectionPoint);
- poleev->pConnectionPoint = NULL;
- }
- OLE_FREE(poleev->pDispatch);
- return Qnil;
-}
-
-static VALUE
-evs_push(VALUE ev)
-{
- return rb_ary_push(ary_ole_event, ev);
-}
-
-static VALUE
-evs_delete(long i)
-{
- rb_ary_store(ary_ole_event, i, Qnil);
- return Qnil;
-}
-
-static VALUE
-evs_entry(long i)
-{
- return rb_ary_entry(ary_ole_event, i);
-}
-
-static long
-evs_length(void)
-{
- return RARRAY_LEN(ary_ole_event);
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT#handler=
- *
- * sets event handler object. If handler object has onXXX
- * method according to XXX event, then onXXX method is called
- * when XXX event occurs.
- *
- * If handler object has method_missing and there is no
- * method according to the event, then method_missing
- * called and 1-st argument is event name.
- *
- * If handler object has onXXX method and there is block
- * defined by WIN32OLE_EVENT#on_event('XXX'){},
- * then block is executed but handler object method is not called
- * when XXX event occurs.
- *
- * class Handler
- * def onStatusTextChange(text)
- * puts "StatusTextChanged"
- * end
- * def onPropertyChange(prop)
- * puts "PropertyChanged"
- * end
- * def method_missing(ev, *arg)
- * puts "other event #{ev}"
- * end
- * end
- *
- * handler = Handler.new
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie)
- * ev.on_event("StatusTextChange") {|*args|
- * puts "this block executed."
- * puts "handler.onStatusTextChange method is not called."
- * }
- * ev.handler = handler
- *
- */
-static VALUE
-fev_set_handler(VALUE self, VALUE val)
-{
- return rb_ivar_set(self, rb_intern("handler"), val);
-}
-
-/*
- * call-seq:
- * WIN32OLE_EVENT#handler
- *
- * returns handler object.
- *
- */
-static VALUE
-fev_get_handler(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("handler"));
-}
-
-void
-Init_win32ole_event(void)
-{
- ary_ole_event = rb_ary_new();
- rb_gc_register_mark_object(ary_ole_event);
- id_events = rb_intern("events");
- cWIN32OLE_EVENT = rb_define_class("WIN32OLE_EVENT", rb_cObject);
- rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0);
- rb_define_alloc_func(cWIN32OLE_EVENT, fev_s_allocate);
- rb_define_method(cWIN32OLE_EVENT, "initialize", fev_initialize, -1);
- rb_define_method(cWIN32OLE_EVENT, "on_event", fev_on_event, -1);
- rb_define_method(cWIN32OLE_EVENT, "on_event_with_outargs", fev_on_event_with_outargs, -1);
- rb_define_method(cWIN32OLE_EVENT, "off_event", fev_off_event, -1);
- rb_define_method(cWIN32OLE_EVENT, "unadvise", fev_unadvise, 0);
- rb_define_method(cWIN32OLE_EVENT, "handler=", fev_set_handler, 1);
- rb_define_method(cWIN32OLE_EVENT, "handler", fev_get_handler, 0);
-}
diff --git a/ext/win32ole/win32ole_event.h b/ext/win32ole/win32ole_event.h
deleted file mode 100644
index f1a5aa234d..0000000000
--- a/ext/win32ole/win32ole_event.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef WIN32OLE_EVENT_H
-#define WIN32OLE_EVENT_H 1
-
-void Init_win32ole_event(void);
-
-#endif
diff --git a/ext/win32ole/win32ole_method.c b/ext/win32ole/win32ole_method.c
deleted file mode 100644
index ba8cf78015..0000000000
--- a/ext/win32ole/win32ole_method.c
+++ /dev/null
@@ -1,950 +0,0 @@
-#include "win32ole.h"
-
-static void olemethod_free(void *ptr);
-static size_t olemethod_size(const void *ptr);
-static VALUE ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE name);
-static VALUE olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name);
-static VALUE ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, int mask);
-static VALUE olemethod_set_member(VALUE self, ITypeInfo *pTypeInfo, ITypeInfo *pOwnerTypeInfo, int index, VALUE name);
-static VALUE folemethod_initialize(VALUE self, VALUE oletype, VALUE method);
-static VALUE folemethod_name(VALUE self);
-static VALUE ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_return_type(VALUE self);
-static VALUE ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_return_vtype(VALUE self);
-static VALUE ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_return_type_detail(VALUE self);
-static VALUE ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_invkind(VALUE self);
-static VALUE folemethod_invoke_kind(VALUE self);
-static VALUE ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_visible(VALUE self);
-static VALUE ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name);
-static VALUE folemethod_event(VALUE self);
-static VALUE folemethod_event_interface(VALUE self);
-static HRESULT ole_method_docinfo_from_type(ITypeInfo *pTypeInfo, UINT method_index, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile);
-static VALUE ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_helpstring(VALUE self);
-static VALUE ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_helpfile(VALUE self);
-static VALUE ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_helpcontext(VALUE self);
-static VALUE ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_dispid(VALUE self);
-static VALUE ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_offset_vtbl(VALUE self);
-static VALUE ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_size_params(VALUE self);
-static VALUE ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_size_opt_params(VALUE self);
-static VALUE ole_method_params(ITypeInfo *pTypeInfo, UINT method_index);
-static VALUE folemethod_params(VALUE self);
-static VALUE folemethod_inspect(VALUE self);
-
-static const rb_data_type_t olemethod_datatype = {
- "win32ole_method",
- {NULL, olemethod_free, olemethod_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static void
-olemethod_free(void *ptr)
-{
- struct olemethoddata *polemethod = ptr;
- OLE_FREE(polemethod->pTypeInfo);
- OLE_FREE(polemethod->pOwnerTypeInfo);
- free(polemethod);
-}
-
-static size_t
-olemethod_size(const void *ptr)
-{
- return ptr ? sizeof(struct olemethoddata) : 0;
-}
-
-struct olemethoddata *
-olemethod_data_get_struct(VALUE obj)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(obj, struct olemethoddata, &olemethod_datatype, pmethod);
- return pmethod;
-}
-
-static VALUE
-ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE name)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- BSTR bstr;
- FUNCDESC *pFuncDesc;
- WORD i;
- VALUE fname;
- VALUE method = Qnil;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- }
- for(i = 0; i < pTypeAttr->cFuncs && method == Qnil; i++) {
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
- if (FAILED(hr))
- continue;
-
- hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr)) {
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- continue;
- }
- fname = WC2VSTR(bstr);
- if (strcasecmp(StringValuePtr(name), StringValuePtr(fname)) == 0) {
- olemethod_set_member(self, pTypeInfo, pOwnerTypeInfo, i, fname);
- method = self;
- }
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- pFuncDesc=NULL;
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return method;
-}
-
-VALUE
-ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- WORD i;
- HREFTYPE href;
- ITypeInfo *pRefTypeInfo;
- VALUE methods = rb_ary_new();
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- }
-
- ole_methods_sub(0, pTypeInfo, methods, mask);
- for(i=0; i < pTypeAttr->cImplTypes; i++){
- hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
- if(FAILED(hr))
- continue;
- hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
- if (FAILED(hr))
- continue;
- ole_methods_sub(pTypeInfo, pRefTypeInfo, methods, mask);
- OLE_RELEASE(pRefTypeInfo);
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return methods;
-}
-
-static VALUE
-olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- WORD i;
- HREFTYPE href;
- ITypeInfo *pRefTypeInfo;
- VALUE method = Qnil;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- }
- method = ole_method_sub(self, 0, pTypeInfo, name);
- if (method != Qnil) {
- return method;
- }
- for(i=0; i < pTypeAttr->cImplTypes && method == Qnil; i++){
- hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
- if(FAILED(hr))
- continue;
- hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
- if (FAILED(hr))
- continue;
- method = ole_method_sub(self, pTypeInfo, pRefTypeInfo, name);
- OLE_RELEASE(pRefTypeInfo);
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return method;
-}
-
-static VALUE
-ole_methods_sub(ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALUE methods, int mask)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- BSTR bstr;
- FUNCDESC *pFuncDesc;
- VALUE method;
- WORD i;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- }
- for(i = 0; i < pTypeAttr->cFuncs; i++) {
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
- if (FAILED(hr))
- continue;
-
- hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr)) {
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- continue;
- }
- if(pFuncDesc->invkind & mask) {
- method = folemethod_s_allocate(cWIN32OLE_METHOD);
- olemethod_set_member(method, pTypeInfo, pOwnerTypeInfo,
- i, WC2VSTR(bstr));
- rb_ary_push(methods, method);
- }
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- pFuncDesc=NULL;
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-
- return methods;
-}
-
-VALUE
-create_win32ole_method(ITypeInfo *pTypeInfo, VALUE name)
-{
-
- VALUE method = folemethod_s_allocate(cWIN32OLE_METHOD);
- VALUE obj = olemethod_from_typeinfo(method, pTypeInfo, name);
- return obj;
-}
-
-/*
- * Document-class: WIN32OLE_METHOD
- *
- * <code>WIN32OLE_METHOD</code> objects represent OLE method information.
- */
-
-static VALUE
-olemethod_set_member(VALUE self, ITypeInfo *pTypeInfo, ITypeInfo *pOwnerTypeInfo, int index, VALUE name)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- pmethod->pTypeInfo = pTypeInfo;
- OLE_ADDREF(pTypeInfo);
- pmethod->pOwnerTypeInfo = pOwnerTypeInfo;
- OLE_ADDREF(pOwnerTypeInfo);
- pmethod->index = index;
- rb_ivar_set(self, rb_intern("name"), name);
- return self;
-}
-
-VALUE
-folemethod_s_allocate(VALUE klass)
-{
- struct olemethoddata *pmethod;
- VALUE obj;
- obj = TypedData_Make_Struct(klass,
- struct olemethoddata,
- &olemethod_datatype, pmethod);
- pmethod->pTypeInfo = NULL;
- pmethod->pOwnerTypeInfo = NULL;
- pmethod->index = 0;
- return obj;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD.new(ole_type, method) -> WIN32OLE_METHOD object
- *
- * Returns a new WIN32OLE_METHOD object which represents the information
- * about OLE method.
- * The first argument <i>ole_type</i> specifies WIN32OLE_TYPE object.
- * The second argument <i>method</i> specifies OLE method name defined OLE class
- * which represents WIN32OLE_TYPE object.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- */
-static VALUE
-folemethod_initialize(VALUE self, VALUE oletype, VALUE method)
-{
- VALUE obj = Qnil;
- ITypeInfo *pTypeInfo;
- if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) {
- SafeStringValue(method);
- pTypeInfo = itypeinfo(oletype);
- obj = olemethod_from_typeinfo(self, pTypeInfo, method);
- if (obj == Qnil) {
- rb_raise(eWIN32OLERuntimeError, "not found %s",
- StringValuePtr(method));
- }
- }
- else {
- rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object");
- }
- return obj;
-}
-
-/*
- * call-seq
- * WIN32OLE_METHOD#name
- *
- * Returns the name of the method.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * puts method.name # => SaveAs
- *
- */
-static VALUE
-folemethod_name(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE type;
-
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
-
- type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#return_type
- *
- * Returns string of return value type of method.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.return_type # => Workbook
- *
- */
-static VALUE
-folemethod_return_type(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_return_type(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE vvt;
-
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
-
- vvt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return vvt;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#return_vtype
- *
- * Returns number of return value type of method.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.return_vtype # => 26
- *
- */
-static VALUE
-folemethod_return_vtype(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_return_vtype(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE type = rb_ary_new();
-
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return type;
-
- ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), type);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#return_type_detail
- *
- * Returns detail information of return value type of method.
- * The information is array.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"]
- */
-static VALUE
-folemethod_return_type_detail(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_return_type_detail(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_invkind(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE invkind;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if(FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
- invkind = INT2FIX(pFuncDesc->invkind);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return invkind;
-}
-
-static VALUE
-ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index)
-{
- VALUE type = rb_str_new2("UNKNOWN");
- VALUE invkind = ole_method_invkind(pTypeInfo, method_index);
- if((FIX2INT(invkind) & INVOKE_PROPERTYGET) &&
- (FIX2INT(invkind) & INVOKE_PROPERTYPUT) ) {
- type = rb_str_new2("PROPERTY");
- } else if(FIX2INT(invkind) & INVOKE_PROPERTYGET) {
- type = rb_str_new2("PROPERTYGET");
- } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUT) {
- type = rb_str_new2("PROPERTYPUT");
- } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUTREF) {
- type = rb_str_new2("PROPERTYPUTREF");
- } else if(FIX2INT(invkind) & INVOKE_FUNC) {
- type = rb_str_new2("FUNC");
- }
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_MTHOD#invkind
- *
- * Returns the method invoke kind.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.invkind # => 1
- *
- */
-static VALUE
-folemethod_invkind(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_invkind(pmethod->pTypeInfo, pmethod->index);
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#invoke_kind
- *
- * Returns the method kind string. The string is "UNKNOWN" or "PROPERTY"
- * or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF"
- * or "FUNC".
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.invoke_kind # => "FUNC"
- */
-static VALUE
-folemethod_invoke_kind(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_invoke_kind(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE visible;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if(FAILED(hr))
- return Qfalse;
- if (pFuncDesc->wFuncFlags & (FUNCFLAG_FRESTRICTED |
- FUNCFLAG_FHIDDEN |
- FUNCFLAG_FNONBROWSABLE)) {
- visible = Qfalse;
- } else {
- visible = Qtrue;
- }
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return visible;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#visible?
- *
- * Returns true if the method is public.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.visible? # => true
- */
-static VALUE
-folemethod_visible(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name)
-{
- TYPEATTR *pTypeAttr;
- HRESULT hr;
- WORD i;
- int flags;
- HREFTYPE href;
- ITypeInfo *pRefTypeInfo;
- FUNCDESC *pFuncDesc;
- BSTR bstr;
- VALUE name;
- VALUE event = Qfalse;
-
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- return event;
- if(pTypeAttr->typekind != TKIND_COCLASS) {
- pTypeInfo->lpVtbl->ReleaseTypeAttr(pTypeInfo, pTypeAttr);
- return event;
- }
- for (i = 0; i < pTypeAttr->cImplTypes; i++) {
- hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
- if (FAILED(hr))
- continue;
-
- if (flags & IMPLTYPEFLAG_FSOURCE) {
- hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
- i, &href);
- if (FAILED(hr))
- continue;
- hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
- href, &pRefTypeInfo);
- if (FAILED(hr))
- continue;
- hr = pRefTypeInfo->lpVtbl->GetFuncDesc(pRefTypeInfo, method_index,
- &pFuncDesc);
- if (FAILED(hr)) {
- OLE_RELEASE(pRefTypeInfo);
- continue;
- }
-
- hr = pRefTypeInfo->lpVtbl->GetDocumentation(pRefTypeInfo,
- pFuncDesc->memid,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr)) {
- pRefTypeInfo->lpVtbl->ReleaseFuncDesc(pRefTypeInfo, pFuncDesc);
- OLE_RELEASE(pRefTypeInfo);
- continue;
- }
-
- name = WC2VSTR(bstr);
- pRefTypeInfo->lpVtbl->ReleaseFuncDesc(pRefTypeInfo, pFuncDesc);
- OLE_RELEASE(pRefTypeInfo);
- if (rb_str_cmp(method_name, name) == 0) {
- event = Qtrue;
- break;
- }
- }
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return event;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#event?
- *
- * Returns true if the method is event.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
- * puts method.event? # => true
- *
- */
-static VALUE
-folemethod_event(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- if (!pmethod->pOwnerTypeInfo)
- return Qfalse;
- return ole_method_event(pmethod->pOwnerTypeInfo,
- pmethod->index,
- rb_ivar_get(self, rb_intern("name")));
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#event_interface
- *
- * Returns event interface name if the method is event.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
- * puts method.event_interface # => WorkbookEvents
- */
-static VALUE
-folemethod_event_interface(VALUE self)
-{
- BSTR name;
- struct olemethoddata *pmethod;
- HRESULT hr;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- if(folemethod_event(self) == Qtrue) {
- hr = ole_docinfo_from_type(pmethod->pTypeInfo, &name, NULL, NULL, NULL);
- if(SUCCEEDED(hr))
- return WC2VSTR(name);
- }
- return Qnil;
-}
-
-static HRESULT
-ole_method_docinfo_from_type(
- ITypeInfo *pTypeInfo,
- UINT method_index,
- BSTR *name,
- BSTR *helpstr,
- DWORD *helpcontext,
- BSTR *helpfile
- )
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return hr;
- hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
- name, helpstr,
- helpcontext, helpfile);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return hr;
-}
-
-static VALUE
-ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index)
-{
- HRESULT hr;
- BSTR bhelpstring;
- hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, &bhelpstring,
- NULL, NULL);
- if (FAILED(hr))
- return Qnil;
- return WC2VSTR(bhelpstring);
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#helpstring
- *
- * Returns help string of OLE method. If the help string is not found,
- * then the method returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
- * method = WIN32OLE_METHOD.new(tobj, 'Navigate')
- * puts method.helpstring # => Navigates to a URL or file.
- *
- */
-static VALUE
-folemethod_helpstring(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_helpstring(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index)
-{
- HRESULT hr;
- BSTR bhelpfile;
- hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL,
- NULL, &bhelpfile);
- if (FAILED(hr))
- return Qnil;
- return WC2VSTR(bhelpfile);
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#helpfile
- *
- * Returns help file. If help file is not found, then
- * the method returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.helpfile # => C:\...\VBAXL9.CHM
- */
-static VALUE
-folemethod_helpfile(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
-
- return ole_method_helpfile(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index)
-{
- HRESULT hr;
- DWORD helpcontext = 0;
- hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL,
- &helpcontext, NULL);
- if (FAILED(hr))
- return Qnil;
- return INT2FIX(helpcontext);
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#helpcontext
- *
- * Returns help context.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.helpcontext # => 65717
- */
-static VALUE
-folemethod_helpcontext(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_helpcontext(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE dispid = Qnil;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return dispid;
- dispid = INT2NUM(pFuncDesc->memid);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return dispid;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#dispid
- *
- * Returns dispatch ID.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.dispid # => 181
- */
-static VALUE
-folemethod_dispid(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_dispid(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE offset_vtbl = Qnil;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return offset_vtbl;
- offset_vtbl = INT2FIX(pFuncDesc->oVft);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return offset_vtbl;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#offset_vtbl
- *
- * Returns the offset ov VTBL.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.offset_vtbl # => 40
- */
-static VALUE
-folemethod_offset_vtbl(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_offset_vtbl(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE size_params = Qnil;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return size_params;
- size_params = INT2FIX(pFuncDesc->cParams);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return size_params;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#size_params
- *
- * Returns the size of arguments of the method.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * puts method.size_params # => 11
- *
- */
-static VALUE
-folemethod_size_params(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_size_params(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE size_opt_params = Qnil;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return size_opt_params;
- size_opt_params = INT2FIX(pFuncDesc->cParamsOpt);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return size_opt_params;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#size_opt_params
- *
- * Returns the size of optional parameters.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * puts method.size_opt_params # => 4
- */
-static VALUE
-folemethod_size_opt_params(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_size_opt_params(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_params(ITypeInfo *pTypeInfo, UINT method_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- BSTR *bstrs;
- UINT len, i;
- VALUE param;
- VALUE params = rb_ary_new();
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return params;
-
- len = 0;
- bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1);
- hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid,
- bstrs, pFuncDesc->cParams + 1,
- &len);
- if (FAILED(hr)) {
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return params;
- }
- SysFreeString(bstrs[0]);
- if (pFuncDesc->cParams > 0) {
- for(i = 1; i < len; i++) {
- param = create_win32ole_param(pTypeInfo, method_index, i-1, WC2VSTR(bstrs[i]));
- rb_ary_push(params, param);
- }
- }
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return params;
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#params
- *
- * returns array of WIN32OLE_PARAM object corresponding with method parameters.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * p method.params # => [Filename, FileFormat, Password, WriteResPassword,
- * ReadOnlyRecommended, CreateBackup, AccessMode,
- * ConflictResolution, AddToMru, TextCodepage,
- * TextVisualLayout]
- */
-static VALUE
-folemethod_params(VALUE self)
-{
- struct olemethoddata *pmethod;
- TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod);
- return ole_method_params(pmethod->pTypeInfo, pmethod->index);
-}
-
-/*
- * call-seq:
- * WIN32OLE_METHOD#inspect -> String
- *
- * Returns the method name with class name.
- *
- */
-static VALUE
-folemethod_inspect(VALUE self)
-{
- return default_inspect(self, "WIN32OLE_METHOD");
-}
-
-void Init_win32ole_method(void)
-{
- cWIN32OLE_METHOD = rb_define_class("WIN32OLE_METHOD", rb_cObject);
- rb_define_alloc_func(cWIN32OLE_METHOD, folemethod_s_allocate);
- rb_define_method(cWIN32OLE_METHOD, "initialize", folemethod_initialize, 2);
- rb_define_method(cWIN32OLE_METHOD, "name", folemethod_name, 0);
- rb_define_method(cWIN32OLE_METHOD, "return_type", folemethod_return_type, 0);
- rb_define_method(cWIN32OLE_METHOD, "return_vtype", folemethod_return_vtype, 0);
- rb_define_method(cWIN32OLE_METHOD, "return_type_detail", folemethod_return_type_detail, 0);
- rb_define_method(cWIN32OLE_METHOD, "invoke_kind", folemethod_invoke_kind, 0);
- rb_define_method(cWIN32OLE_METHOD, "invkind", folemethod_invkind, 0);
- rb_define_method(cWIN32OLE_METHOD, "visible?", folemethod_visible, 0);
- rb_define_method(cWIN32OLE_METHOD, "event?", folemethod_event, 0);
- rb_define_method(cWIN32OLE_METHOD, "event_interface", folemethod_event_interface, 0);
- rb_define_method(cWIN32OLE_METHOD, "helpstring", folemethod_helpstring, 0);
- rb_define_method(cWIN32OLE_METHOD, "helpfile", folemethod_helpfile, 0);
- rb_define_method(cWIN32OLE_METHOD, "helpcontext", folemethod_helpcontext, 0);
- rb_define_method(cWIN32OLE_METHOD, "dispid", folemethod_dispid, 0);
- rb_define_method(cWIN32OLE_METHOD, "offset_vtbl", folemethod_offset_vtbl, 0);
- rb_define_method(cWIN32OLE_METHOD, "size_params", folemethod_size_params, 0);
- rb_define_method(cWIN32OLE_METHOD, "size_opt_params", folemethod_size_opt_params, 0);
- rb_define_method(cWIN32OLE_METHOD, "params", folemethod_params, 0);
- rb_define_alias(cWIN32OLE_METHOD, "to_s", "name");
- rb_define_method(cWIN32OLE_METHOD, "inspect", folemethod_inspect, 0);
-}
diff --git a/ext/win32ole/win32ole_method.h b/ext/win32ole/win32ole_method.h
deleted file mode 100644
index ff2898ebeb..0000000000
--- a/ext/win32ole/win32ole_method.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef WIN32OLE_METHOD_H
-#define WIN32OLE_METHOD_H 1
-
-struct olemethoddata {
- ITypeInfo *pOwnerTypeInfo;
- ITypeInfo *pTypeInfo;
- UINT index;
-};
-
-VALUE cWIN32OLE_METHOD;
-VALUE folemethod_s_allocate(VALUE klass);
-VALUE ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask);
-VALUE create_win32ole_method(ITypeInfo *pTypeInfo, VALUE name);
-struct olemethoddata *olemethod_data_get_struct(VALUE obj);
-void Init_win32ole_method(void);
-#endif
diff --git a/ext/win32ole/win32ole_param.c b/ext/win32ole/win32ole_param.c
deleted file mode 100644
index 31cf853b04..0000000000
--- a/ext/win32ole/win32ole_param.c
+++ /dev/null
@@ -1,438 +0,0 @@
-#include "win32ole.h"
-
-VALUE cWIN32OLE_PARAM;
-
-struct oleparamdata {
- ITypeInfo *pTypeInfo;
- UINT method_index;
- UINT index;
-};
-
-static void oleparam_free(void *ptr);
-static size_t oleparam_size(const void *ptr);
-static VALUE foleparam_s_allocate(VALUE klass);
-static VALUE oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_index, int param_index);
-static VALUE oleparam_ole_param(VALUE self, VALUE olemethod, int n);
-static VALUE foleparam_initialize(VALUE self, VALUE olemethod, VALUE n);
-static VALUE foleparam_name(VALUE self);
-static VALUE ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index);
-static VALUE foleparam_ole_type(VALUE self);
-static VALUE ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index);
-static VALUE foleparam_ole_type_detail(VALUE self);
-static VALUE ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT mask);
-static VALUE foleparam_input(VALUE self);
-static VALUE foleparam_output(VALUE self);
-static VALUE foleparam_optional(VALUE self);
-static VALUE foleparam_retval(VALUE self);
-static VALUE ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index);
-static VALUE foleparam_default(VALUE self);
-static VALUE foleparam_inspect(VALUE self);
-
-static const rb_data_type_t oleparam_datatype = {
- "win32ole_param",
- {NULL, oleparam_free, oleparam_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static void
-oleparam_free(void *ptr)
-{
- struct oleparamdata *pole = ptr;
- OLE_FREE(pole->pTypeInfo);
- free(pole);
-}
-
-static size_t
-oleparam_size(const void *ptr)
-{
- return ptr ? sizeof(struct oleparamdata) : 0;
-}
-
-VALUE
-create_win32ole_param(ITypeInfo *pTypeInfo, UINT method_index, UINT index, VALUE name)
-{
- struct oleparamdata *pparam;
- VALUE obj = foleparam_s_allocate(cWIN32OLE_PARAM);
- TypedData_Get_Struct(obj, struct oleparamdata, &oleparam_datatype, pparam);
-
- pparam->pTypeInfo = pTypeInfo;
- OLE_ADDREF(pTypeInfo);
- pparam->method_index = method_index;
- pparam->index = index;
- rb_ivar_set(obj, rb_intern("name"), name);
- return obj;
-}
-
-/*
- * Document-class: WIN32OLE_PARAM
- *
- * <code>WIN32OLE_PARAM</code> objects represent param information of
- * the OLE method.
- */
-static VALUE
-foleparam_s_allocate(VALUE klass)
-{
- struct oleparamdata *pparam;
- VALUE obj;
- obj = TypedData_Make_Struct(klass,
- struct oleparamdata,
- &oleparam_datatype, pparam);
- pparam->pTypeInfo = NULL;
- pparam->method_index = 0;
- pparam->index = 0;
- return obj;
-}
-
-static VALUE
-oleparam_ole_param_from_index(VALUE self, ITypeInfo *pTypeInfo, UINT method_index, int param_index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- BSTR *bstrs;
- UINT len;
- struct oleparamdata *pparam;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- ole_raise(hr, rb_eRuntimeError, "fail to ITypeInfo::GetFuncDesc");
-
- len = 0;
- bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1);
- hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid,
- bstrs, pFuncDesc->cParams + 1,
- &len);
- if (FAILED(hr)) {
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- ole_raise(hr, rb_eRuntimeError, "fail to ITypeInfo::GetNames");
- }
- SysFreeString(bstrs[0]);
- if (param_index < 1 || len <= (UINT)param_index)
- {
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- rb_raise(rb_eIndexError, "index of param must be in 1..%d", len);
- }
-
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- pparam->pTypeInfo = pTypeInfo;
- OLE_ADDREF(pTypeInfo);
- pparam->method_index = method_index;
- pparam->index = param_index - 1;
- rb_ivar_set(self, rb_intern("name"), WC2VSTR(bstrs[param_index]));
-
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return self;
-}
-
-static VALUE
-oleparam_ole_param(VALUE self, VALUE olemethod, int n)
-{
- struct olemethoddata *pmethod = olemethod_data_get_struct(olemethod);
- return oleparam_ole_param_from_index(self, pmethod->pTypeInfo, pmethod->index, n);
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM.new(method, n) -> WIN32OLE_PARAM object
- *
- * Returns WIN32OLE_PARAM object which represents OLE parameter information.
- * 1st argument should be WIN32OLE_METHOD object.
- * 2nd argument `n' is n-th parameter of the method specified by 1st argument.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Scripting Runtime', 'IFileSystem')
- * method = WIN32OLE_METHOD.new(tobj, 'CreateTextFile')
- * param = WIN32OLE_PARAM.new(method, 2) # => #<WIN32OLE_PARAM:Overwrite=true>
- *
- */
-static VALUE
-foleparam_initialize(VALUE self, VALUE olemethod, VALUE n)
-{
- int idx;
- if (!rb_obj_is_kind_of(olemethod, cWIN32OLE_METHOD)) {
- rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE_METHOD object");
- }
- idx = FIX2INT(n);
- return oleparam_ole_param(self, olemethod, idx);
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#name
- *
- * Returns name.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts param1.name # => Filename
- */
-static VALUE
-foleparam_name(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE type = rb_str_new2("unknown type");
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return type;
- type = ole_typedesc2val(pTypeInfo,
- &(pFuncDesc->lprgelemdescParam[index].tdesc), Qnil);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#ole_type
- *
- * Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method).
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts param1.ole_type # => VARIANT
- */
-static VALUE
-foleparam_ole_type(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index,
- pparam->index);
-}
-
-static VALUE
-ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE typedetail = rb_ary_new();
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return typedetail;
- ole_typedesc2val(pTypeInfo,
- &(pFuncDesc->lprgelemdescParam[index].tdesc), typedetail);
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return typedetail;
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#ole_type_detail
- *
- * Returns detail information of type of argument.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
- * method = WIN32OLE_METHOD.new(tobj, 'SumIf')
- * param1 = method.params[0]
- * p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]
- */
-static VALUE
-foleparam_ole_type_detail(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_ole_type_detail(pparam->pTypeInfo, pparam->method_index,
- pparam->index);
-}
-
-static VALUE
-ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT mask)
-{
- FUNCDESC *pFuncDesc;
- HRESULT hr;
- VALUE ret = Qfalse;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if(FAILED(hr))
- return ret;
- if (V_UNION1((&(pFuncDesc->lprgelemdescParam[index])), paramdesc).wParamFlags &mask)
- ret = Qtrue;
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return ret;
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#input?
- *
- * Returns true if the parameter is input.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts param1.input? # => true
- */
-static VALUE
-foleparam_input(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
- pparam->index, PARAMFLAG_FIN);
-}
-
-/*
- * call-seq:
- * WIN32OLE#output?
- *
- * Returns true if argument is output.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
- * method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
- * method.params.each do |param|
- * puts "#{param.name} #{param.output?}"
- * end
- *
- * The result of above script is following:
- * URL false
- * Flags false
- * TargetFrameName false
- * PostData false
- * Headers false
- * Processed true
- */
-static VALUE
-foleparam_output(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
- pparam->index, PARAMFLAG_FOUT);
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#optional?
- *
- * Returns true if argument is optional.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts "#{param1.name} #{param1.optional?}" # => Filename true
- */
-static VALUE
-foleparam_optional(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
- pparam->index, PARAMFLAG_FOPT);
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#retval?
- *
- * Returns true if argument is return value.
- * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library',
- * 'DirectPlayLobbyConnection')
- * method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName')
- * param = method.params[0]
- * puts "#{param.name} #{param.retval?}" # => name true
- */
-static VALUE
-foleparam_retval(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
- pparam->index, PARAMFLAG_FRETVAL);
-}
-
-static VALUE
-ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index)
-{
- FUNCDESC *pFuncDesc;
- ELEMDESC *pElemDesc;
- PARAMDESCEX * pParamDescEx;
- HRESULT hr;
- USHORT wParamFlags;
- USHORT mask = PARAMFLAG_FOPT|PARAMFLAG_FHASDEFAULT;
- VALUE defval = Qnil;
- hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
- if (FAILED(hr))
- return defval;
- pElemDesc = &pFuncDesc->lprgelemdescParam[index];
- wParamFlags = V_UNION1(pElemDesc, paramdesc).wParamFlags;
- if ((wParamFlags & mask) == mask) {
- pParamDescEx = V_UNION1(pElemDesc, paramdesc).pparamdescex;
- defval = ole_variant2val(&pParamDescEx->varDefaultValue);
- }
- pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
- return defval;
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#default
- *
- * Returns default value. If the default value does not exist,
- * this method returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * method.params.each do |param|
- * if param.default
- * puts "#{param.name} (= #{param.default})"
- * else
- * puts "#{param}"
- * end
- * end
- *
- * The above script result is following:
- * Filename
- * FileFormat
- * Password
- * WriteResPassword
- * ReadOnlyRecommended
- * CreateBackup
- * AccessMode (= 1)
- * ConflictResolution
- * AddToMru
- * TextCodepage
- * TextVisualLayout
- */
-static VALUE
-foleparam_default(VALUE self)
-{
- struct oleparamdata *pparam;
- TypedData_Get_Struct(self, struct oleparamdata, &oleparam_datatype, pparam);
- return ole_param_default(pparam->pTypeInfo, pparam->method_index,
- pparam->index);
-}
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#inspect -> String
- *
- * Returns the parameter name with class name. If the parameter has default value,
- * then returns name=value string with class name.
- *
- */
-static VALUE
-foleparam_inspect(VALUE self)
-{
- VALUE detail = foleparam_name(self);
- VALUE defval = foleparam_default(self);
- if (defval != Qnil) {
- rb_str_cat2(detail, "=");
- rb_str_concat(detail, rb_inspect(defval));
- }
- return make_inspect("WIN32OLE_PARAM", detail);
-}
-
-void
-Init_win32ole_param(void)
-{
- cWIN32OLE_PARAM = rb_define_class("WIN32OLE_PARAM", rb_cObject);
- rb_define_alloc_func(cWIN32OLE_PARAM, foleparam_s_allocate);
- rb_define_method(cWIN32OLE_PARAM, "initialize", foleparam_initialize, 2);
- rb_define_method(cWIN32OLE_PARAM, "name", foleparam_name, 0);
- rb_define_method(cWIN32OLE_PARAM, "ole_type", foleparam_ole_type, 0);
- rb_define_method(cWIN32OLE_PARAM, "ole_type_detail", foleparam_ole_type_detail, 0);
- rb_define_method(cWIN32OLE_PARAM, "input?", foleparam_input, 0);
- rb_define_method(cWIN32OLE_PARAM, "output?", foleparam_output, 0);
- rb_define_method(cWIN32OLE_PARAM, "optional?", foleparam_optional, 0);
- rb_define_method(cWIN32OLE_PARAM, "retval?", foleparam_retval, 0);
- rb_define_method(cWIN32OLE_PARAM, "default", foleparam_default, 0);
- rb_define_alias(cWIN32OLE_PARAM, "to_s", "name");
- rb_define_method(cWIN32OLE_PARAM, "inspect", foleparam_inspect, 0);
-}
diff --git a/ext/win32ole/win32ole_param.h b/ext/win32ole/win32ole_param.h
deleted file mode 100644
index 7e2650cb44..0000000000
--- a/ext/win32ole/win32ole_param.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef WIN32OLE_PARAM_H
-#define WIN32OLE_PARAM_H
-
-VALUE create_win32ole_param(ITypeInfo *pTypeInfo, UINT method_index, UINT index, VALUE name);
-void Init_win32ole_param(void);
-
-#endif
-
diff --git a/ext/win32ole/win32ole_record.c b/ext/win32ole/win32ole_record.c
deleted file mode 100644
index e8838832a7..0000000000
--- a/ext/win32ole/win32ole_record.c
+++ /dev/null
@@ -1,604 +0,0 @@
-#include "win32ole.h"
-
-struct olerecorddata {
- IRecordInfo *pri;
- void *pdata;
-};
-
-static HRESULT recordinfo_from_itypelib(ITypeLib *pTypeLib, VALUE name, IRecordInfo **ppri);
-static int hash2olerec(VALUE key, VALUE val, VALUE rec);
-static void olerecord_free(void *pvar);
-static size_t olerecord_size(const void *ptr);
-static VALUE folerecord_s_allocate(VALUE klass);
-static VALUE folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj);
-static VALUE folerecord_to_h(VALUE self);
-static VALUE folerecord_typename(VALUE self);
-static VALUE olerecord_ivar_get(VALUE self, VALUE name);
-static VALUE olerecord_ivar_set(VALUE self, VALUE name, VALUE val);
-static VALUE folerecord_method_missing(int argc, VALUE *argv, VALUE self);
-static VALUE folerecord_ole_instance_variable_get(VALUE self, VALUE name);
-static VALUE folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val);
-static VALUE folerecord_inspect(VALUE self);
-
-static const rb_data_type_t olerecord_datatype = {
- "win32ole_record",
- {NULL, olerecord_free, olerecord_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static HRESULT
-recordinfo_from_itypelib(ITypeLib *pTypeLib, VALUE name, IRecordInfo **ppri)
-{
-
- unsigned int count;
- unsigned int i;
- ITypeInfo *pTypeInfo;
- HRESULT hr = OLE_E_LAST;
- BSTR bstr;
-
- count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
- for (i = 0; i < count; i++) {
- hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr))
- continue;
-
- hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
- if (FAILED(hr))
- continue;
-
- if (rb_str_cmp(WC2VSTR(bstr), name) == 0) {
- hr = GetRecordInfoFromTypeInfo(pTypeInfo, ppri);
- OLE_RELEASE(pTypeInfo);
- return hr;
- }
- OLE_RELEASE(pTypeInfo);
- }
- hr = OLE_E_LAST;
- return hr;
-}
-
-static int
-hash2olerec(VALUE key, VALUE val, VALUE rec)
-{
- VARIANT var;
- OLECHAR *pbuf;
- struct olerecorddata *prec;
- IRecordInfo *pri;
- HRESULT hr;
-
- if (val != Qnil) {
- TypedData_Get_Struct(rec, struct olerecorddata, &olerecord_datatype, prec);
- pri = prec->pri;
- VariantInit(&var);
- ole_val2variant(val, &var);
- pbuf = ole_vstr2wc(key);
- hr = pri->lpVtbl->PutField(pri, INVOKE_PROPERTYPUT, prec->pdata, pbuf, &var);
- SysFreeString(pbuf);
- VariantClear(&var);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to putfield of `%s`", StringValuePtr(key));
- }
- }
- return ST_CONTINUE;
-}
-
-void
-ole_rec2variant(VALUE rec, VARIANT *var)
-{
- struct olerecorddata *prec;
- ULONG size = 0;
- IRecordInfo *pri;
- HRESULT hr;
- VALUE fields;
- TypedData_Get_Struct(rec, struct olerecorddata, &olerecord_datatype, prec);
- pri = prec->pri;
- if (pri) {
- hr = pri->lpVtbl->GetSize(pri, &size);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to get size for allocation of VT_RECORD object");
- }
- if (prec->pdata) {
- free(prec->pdata);
- }
- prec->pdata = ALLOC_N(char, size);
- if (!prec->pdata) {
- rb_raise(rb_eRuntimeError, "failed to memory allocation of %lu bytes", (unsigned long)size);
- }
- hr = pri->lpVtbl->RecordInit(pri, prec->pdata);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to initialize VT_RECORD object");
- }
- fields = folerecord_to_h(rec);
- rb_hash_foreach(fields, hash2olerec, rec);
- V_RECORDINFO(var) = pri;
- V_RECORD(var) = prec->pdata;
- V_VT(var) = VT_RECORD;
- } else {
- rb_raise(eWIN32OLERuntimeError, "failed to retrieve IRecordInfo interface");
- }
-}
-
-void
-olerecord_set_ivar(VALUE obj, IRecordInfo *pri, void *prec)
-{
- HRESULT hr;
- BSTR bstr;
- BSTR *bstrs;
- ULONG count = 0;
- ULONG i;
- VALUE fields;
- VALUE val;
- VARIANT var;
- void *pdata = NULL;
- struct olerecorddata *pvar;
-
- TypedData_Get_Struct(obj, struct olerecorddata, &olerecord_datatype, pvar);
- OLE_ADDREF(pri);
- OLE_RELEASE(pvar->pri);
- pvar->pri = pri;
-
- hr = pri->lpVtbl->GetName(pri, &bstr);
- if (SUCCEEDED(hr)) {
- rb_ivar_set(obj, rb_intern("typename"), WC2VSTR(bstr));
- }
-
- hr = pri->lpVtbl->GetFieldNames(pri, &count, NULL);
- if (FAILED(hr) || count == 0)
- return;
- bstrs = ALLOCA_N(BSTR, count);
- hr = pri->lpVtbl->GetFieldNames(pri, &count, bstrs);
- if (FAILED(hr)) {
- return;
- }
-
- fields = rb_hash_new();
- rb_ivar_set(obj, rb_intern("fields"), fields);
- for (i = 0; i < count; i++) {
- pdata = NULL;
- VariantInit(&var);
- val = Qnil;
- if (prec) {
- hr = pri->lpVtbl->GetFieldNoCopy(pri, prec, bstrs[i], &var, &pdata);
- if (SUCCEEDED(hr)) {
- val = ole_variant2val(&var);
- }
- }
- rb_hash_aset(fields, WC2VSTR(bstrs[i]), val);
- }
-}
-
-VALUE
-create_win32ole_record(IRecordInfo *pri, void *prec)
-{
- VALUE obj = folerecord_s_allocate(cWIN32OLE_RECORD);
- olerecord_set_ivar(obj, pri, prec);
- return obj;
-}
-
-/*
- * Document-class: WIN32OLE_RECORD
- *
- * <code>WIN32OLE_RECORD</code> objects represents VT_RECORD OLE variant.
- * Win32OLE returns WIN32OLE_RECORD object if the result value of invoking
- * OLE methods.
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * Public Structure Book
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Structure
- * Public Function getBook() As Book
- * Dim book As New Book
- * book.title = "The Ruby Book"
- * book.cost = 20
- * Return book
- * End Function
- * End Class
- *
- * then, you can retrieve getBook return value from the following
- * Ruby script:
- *
- * require 'win32ole'
- * obj = WIN32OLE.new('ComServer.ComClass')
- * book = obj.getBook
- * book.class # => WIN32OLE_RECORD
- * book.title # => "The Ruby Book"
- * book.cost # => 20
- *
- */
-
-static void
-olerecord_free(void *ptr) {
- struct olerecorddata *pvar = ptr;
- OLE_FREE(pvar->pri);
- if (pvar->pdata) {
- free(pvar->pdata);
- }
- free(pvar);
-}
-
-static size_t
-olerecord_size(const void *ptr)
-{
- const struct olerecorddata *pvar = ptr;
- size_t s = 0;
- ULONG size = 0;
- HRESULT hr;
- if (ptr) {
- s += sizeof(struct olerecorddata);
- if (pvar->pri) {
- hr = pvar->pri->lpVtbl->GetSize(pvar->pri, &size);
- if (SUCCEEDED(hr)) {
- s += size;
- }
- }
- }
- return s;
-}
-
-static VALUE
-folerecord_s_allocate(VALUE klass) {
- VALUE obj = Qnil;
- struct olerecorddata *pvar;
- obj = TypedData_Make_Struct(klass, struct olerecorddata, &olerecord_datatype, pvar);
- pvar->pri = NULL;
- pvar->pdata = NULL;
- return obj;
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD.new(typename, obj) -> WIN32OLE_RECORD object
- *
- * Returns WIN32OLE_RECORD object. The first argument is struct name (String
- * or Symbol).
- * The second parameter obj should be WIN32OLE object or WIN32OLE_TYPELIB object.
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * Public Structure Book
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Structure
- * End Class
- *
- * then, you can create WIN32OLE_RECORD object is as following:
- *
- * require 'win32ole'
- * obj = WIN32OLE.new('ComServer.ComClass')
- * book1 = WIN32OLE_RECORD.new('Book', obj) # => WIN32OLE_RECORD object
- * tlib = obj.ole_typelib
- * book2 = WIN32OLE_RECORD.new('Book', tlib) # => WIN32OLE_RECORD object
- *
- */
-static VALUE
-folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) {
- HRESULT hr;
- ITypeLib *pTypeLib = NULL;
- IRecordInfo *pri = NULL;
-
- if (!RB_TYPE_P(typename, T_STRING) && !RB_TYPE_P(typename, T_SYMBOL)) {
- rb_raise(rb_eArgError, "1st argument should be String or Symbol");
- }
- if (RB_TYPE_P(typename, T_SYMBOL)) {
- typename = rb_sym2str(typename);
- }
-
- hr = S_OK;
- if(rb_obj_is_kind_of(oleobj, cWIN32OLE)) {
- hr = typelib_from_val(oleobj, &pTypeLib);
- } else if (rb_obj_is_kind_of(oleobj, cWIN32OLE_TYPELIB)) {
- pTypeLib = itypelib(oleobj);
- OLE_ADDREF(pTypeLib);
- if (pTypeLib) {
- hr = S_OK;
- } else {
- hr = E_FAIL;
- }
- } else {
- rb_raise(rb_eArgError, "2nd argument should be WIN32OLE object or WIN32OLE_TYPELIB object");
- }
-
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "fail to query ITypeLib interface");
- }
-
- hr = recordinfo_from_itypelib(pTypeLib, typename, &pri);
- OLE_RELEASE(pTypeLib);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "fail to query IRecordInfo interface for `%s'", StringValuePtr(typename));
- }
-
- olerecord_set_ivar(self, pri, NULL);
-
- return self;
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD#to_h #=> Ruby Hash object.
- *
- * Returns Ruby Hash object which represents VT_RECORD variable.
- * The keys of Hash object are member names of VT_RECORD OLE variable and
- * the values of Hash object are values of VT_RECORD OLE variable.
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * Public Structure Book
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Structure
- * Public Function getBook() As Book
- * Dim book As New Book
- * book.title = "The Ruby Book"
- * book.cost = 20
- * Return book
- * End Function
- * End Class
- *
- * then, the result of WIN32OLE_RECORD#to_h is the following:
- *
- * require 'win32ole'
- * obj = WIN32OLE.new('ComServer.ComClass')
- * book = obj.getBook
- * book.to_h # => {"title"=>"The Ruby Book", "cost"=>20}
- *
- */
-static VALUE
-folerecord_to_h(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("fields"));
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD#typename #=> String object
- *
- * Returns the type name of VT_RECORD OLE variable.
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * Public Structure Book
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Structure
- * Public Function getBook() As Book
- * Dim book As New Book
- * book.title = "The Ruby Book"
- * book.cost = 20
- * Return book
- * End Function
- * End Class
- *
- * then, the result of WIN32OLE_RECORD#typename is the following:
- *
- * require 'win32ole'
- * obj = WIN32OLE.new('ComServer.ComClass')
- * book = obj.getBook
- * book.typename # => "Book"
- *
- */
-static VALUE
-folerecord_typename(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("typename"));
-}
-
-static VALUE
-olerecord_ivar_get(VALUE self, VALUE name)
-{
- VALUE fields;
- fields = rb_ivar_get(self, rb_intern("fields"));
- return rb_hash_fetch(fields, name);
-}
-
-static VALUE
-olerecord_ivar_set(VALUE self, VALUE name, VALUE val)
-{
- long len;
- char *p;
- VALUE fields;
- len = RSTRING_LEN(name);
- p = RSTRING_PTR(name);
- if (p[len-1] == '=') {
- name = rb_str_subseq(name, 0, len-1);
- }
- fields = rb_ivar_get(self, rb_intern("fields"));
- rb_hash_fetch(fields, name);
- return rb_hash_aset(fields, name, val);
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD#method_missing(name)
- *
- * Returns value specified by the member name of VT_RECORD OLE variable.
- * Or sets value specified by the member name of VT_RECORD OLE variable.
- * If the member name is not correct, KeyError exception is raised.
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * Public Structure Book
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Structure
- * End Class
- *
- * Then getting/setting value from Ruby is as the following:
- *
- * obj = WIN32OLE.new('ComServer.ComClass')
- * book = WIN32OLE_RECORD.new('Book', obj)
- * book.title # => nil ( book.method_missing(:title) is invoked. )
- * book.title = "Ruby" # ( book.method_missing(:title=, "Ruby") is invoked. )
- */
-static VALUE
-folerecord_method_missing(int argc, VALUE *argv, VALUE self)
-{
- VALUE name;
- rb_check_arity(argc, 1, 2);
- name = rb_sym2str(argv[0]);
-
-#if SIZEOF_SIZE_T > SIZEOF_LONG
- {
- size_t n = strlen(StringValueCStr(name));
- if (n >= LONG_MAX) {
- rb_raise(rb_eRuntimeError, "too long member name");
- }
- }
-#endif
-
- if (argc == 1) {
- return olerecord_ivar_get(self, name);
- } else if (argc == 2) {
- return olerecord_ivar_set(self, name, argv[1]);
- }
- return Qnil;
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD#ole_instance_variable_get(name)
- *
- * Returns value specified by the member name of VT_RECORD OLE object.
- * If the member name is not correct, KeyError exception is raised.
- * If you can't access member variable of VT_RECORD OLE object directly,
- * use this method.
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * Public Structure ComObject
- * Public object_id As Ineger
- * End Structure
- * End Class
- *
- * and Ruby Object class has title attribute:
- *
- * then accessing object_id of ComObject from Ruby is as the following:
- *
- * srver = WIN32OLE.new('ComServer.ComClass')
- * obj = WIN32OLE_RECORD.new('ComObject', server)
- * # obj.object_id returns Ruby Object#object_id
- * obj.ole_instance_variable_get(:object_id) # => nil
- *
- */
-static VALUE
-folerecord_ole_instance_variable_get(VALUE self, VALUE name)
-{
- VALUE sname;
- if(!RB_TYPE_P(name, T_STRING) && !RB_TYPE_P(name, T_SYMBOL)) {
- rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
- }
- sname = name;
- if (RB_TYPE_P(name, T_SYMBOL)) {
- sname = rb_sym2str(name);
- }
- return olerecord_ivar_get(self, sname);
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD#ole_instance_variable_set(name, val)
- *
- * Sets value specified by the member name of VT_RECORD OLE object.
- * If the member name is not correct, KeyError exception is raised.
- * If you can't set value of member of VT_RECORD OLE object directly,
- * use this method.
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Class
- *
- * then setting value of the `title' member is as following:
- *
- * srver = WIN32OLE.new('ComServer.ComClass')
- * obj = WIN32OLE_RECORD.new('Book', server)
- * obj.ole_instance_variable_set(:title, "The Ruby Book")
- *
- */
-static VALUE
-folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val)
-{
- VALUE sname;
- if(!RB_TYPE_P(name, T_STRING) && !RB_TYPE_P(name, T_SYMBOL)) {
- rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
- }
- sname = name;
- if (RB_TYPE_P(name, T_SYMBOL)) {
- sname = rb_sym2str(name);
- }
- return olerecord_ivar_set(self, sname, val);
-}
-
-/*
- * call-seq:
- * WIN32OLE_RECORD#inspect -> String
- *
- * Returns the OLE struct name and member name and the value of member
- *
- * If COM server in VB.NET ComServer project is the following:
- *
- * Imports System.Runtime.InteropServices
- * Public Class ComClass
- * <MarshalAs(UnmanagedType.BStr)> _
- * Public title As String
- * Public cost As Integer
- * End Class
- *
- * then
- *
- * srver = WIN32OLE.new('ComServer.ComClass')
- * obj = WIN32OLE_RECORD.new('Book', server)
- * obj.inspect # => <WIN32OLE_RECORD(ComClass) {"title" => nil, "cost" => nil}>
- *
- */
-static VALUE
-folerecord_inspect(VALUE self)
-{
- VALUE tname;
- VALUE field;
- tname = folerecord_typename(self);
- if (tname == Qnil) {
- tname = rb_inspect(tname);
- }
- field = rb_inspect(folerecord_to_h(self));
- return rb_sprintf("#<WIN32OLE_RECORD(%"PRIsVALUE") %"PRIsVALUE">",
- tname,
- field);
-}
-
-void
-Init_win32ole_record(void)
-{
- cWIN32OLE_RECORD = rb_define_class("WIN32OLE_RECORD", rb_cObject);
- rb_define_alloc_func(cWIN32OLE_RECORD, folerecord_s_allocate);
- rb_define_method(cWIN32OLE_RECORD, "initialize", folerecord_initialize, 2);
- rb_define_method(cWIN32OLE_RECORD, "to_h", folerecord_to_h, 0);
- rb_define_method(cWIN32OLE_RECORD, "typename", folerecord_typename, 0);
- rb_define_method(cWIN32OLE_RECORD, "method_missing", folerecord_method_missing, -1);
- rb_define_method(cWIN32OLE_RECORD, "ole_instance_variable_get", folerecord_ole_instance_variable_get, 1);
- rb_define_method(cWIN32OLE_RECORD, "ole_instance_variable_set", folerecord_ole_instance_variable_set, 2);
- rb_define_method(cWIN32OLE_RECORD, "inspect", folerecord_inspect, 0);
-}
diff --git a/ext/win32ole/win32ole_record.h b/ext/win32ole/win32ole_record.h
deleted file mode 100644
index ea431e91f7..0000000000
--- a/ext/win32ole/win32ole_record.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef WIN32OLE_RECORD_H
-#define WIN32OLE_RECORD_H 1
-
-VALUE cWIN32OLE_RECORD;
-void ole_rec2variant(VALUE rec, VARIANT *var);
-void olerecord_set_ivar(VALUE obj, IRecordInfo *pri, void *prec);
-VALUE create_win32ole_record(IRecordInfo *pri, void *prec);
-void Init_win32ole_record(void);
-
-#endif
diff --git a/ext/win32ole/win32ole_type.c b/ext/win32ole/win32ole_type.c
deleted file mode 100644
index efcac883df..0000000000
--- a/ext/win32ole/win32ole_type.c
+++ /dev/null
@@ -1,915 +0,0 @@
-#include "win32ole.h"
-
-struct oletypedata {
- ITypeInfo *pTypeInfo;
-};
-
-static void oletype_free(void *ptr);
-static size_t oletype_size(const void *ptr);
-static VALUE foletype_s_ole_classes(VALUE self, VALUE typelib);
-static VALUE foletype_s_typelibs(VALUE self);
-static VALUE foletype_s_progids(VALUE self);
-static VALUE oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name);
-static VALUE foletype_s_allocate(VALUE klass);
-static VALUE oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass);
-static VALUE foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass);
-static VALUE foletype_name(VALUE self);
-static VALUE ole_ole_type(ITypeInfo *pTypeInfo);
-static VALUE foletype_ole_type(VALUE self);
-static VALUE ole_type_guid(ITypeInfo *pTypeInfo);
-static VALUE foletype_guid(VALUE self);
-static VALUE ole_type_progid(ITypeInfo *pTypeInfo);
-static VALUE foletype_progid(VALUE self);
-static VALUE ole_type_visible(ITypeInfo *pTypeInfo);
-static VALUE foletype_visible(VALUE self);
-static VALUE ole_type_major_version(ITypeInfo *pTypeInfo);
-static VALUE foletype_major_version(VALUE self);
-static VALUE ole_type_minor_version(ITypeInfo *pTypeInfo);
-static VALUE foletype_minor_version(VALUE self);
-static VALUE ole_type_typekind(ITypeInfo *pTypeInfo);
-static VALUE foletype_typekind(VALUE self);
-static VALUE ole_type_helpstring(ITypeInfo *pTypeInfo);
-static VALUE foletype_helpstring(VALUE self);
-static VALUE ole_type_src_type(ITypeInfo *pTypeInfo);
-static VALUE foletype_src_type(VALUE self);
-static VALUE ole_type_helpfile(ITypeInfo *pTypeInfo);
-static VALUE foletype_helpfile(VALUE self);
-static VALUE ole_type_helpcontext(ITypeInfo *pTypeInfo);
-static VALUE foletype_helpcontext(VALUE self);
-static VALUE ole_variables(ITypeInfo *pTypeInfo);
-static VALUE foletype_variables(VALUE self);
-static VALUE foletype_methods(VALUE self);
-static VALUE foletype_ole_typelib(VALUE self);
-static VALUE ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags);
-static VALUE foletype_impl_ole_types(VALUE self);
-static VALUE foletype_source_ole_types(VALUE self);
-static VALUE foletype_default_event_sources(VALUE self);
-static VALUE foletype_default_ole_types(VALUE self);
-static VALUE foletype_inspect(VALUE self);
-
-static const rb_data_type_t oletype_datatype = {
- "win32ole_type",
- {NULL, oletype_free, oletype_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-/*
- * Document-class: WIN32OLE_TYPE
- *
- * <code>WIN32OLE_TYPE</code> objects represent OLE type libarary information.
- */
-
-static void
-oletype_free(void *ptr)
-{
- struct oletypedata *poletype = ptr;
- OLE_FREE(poletype->pTypeInfo);
- free(poletype);
-}
-
-static size_t
-oletype_size(const void *ptr)
-{
- return ptr ? sizeof(struct oletypedata) : 0;
-}
-
-ITypeInfo *itypeinfo(VALUE self)
-{
- struct oletypedata *ptype;
- TypedData_Get_Struct(self, struct oletypedata, &oletype_datatype, ptype);
- return ptype->pTypeInfo;
-}
-
-VALUE
-ole_type_from_itypeinfo(ITypeInfo *pTypeInfo)
-{
- ITypeLib *pTypeLib;
- VALUE type = Qnil;
- HRESULT hr;
- unsigned int index;
- BSTR bstr;
-
- hr = pTypeInfo->lpVtbl->GetContainingTypeLib( pTypeInfo, &pTypeLib, &index );
- if(FAILED(hr)) {
- return Qnil;
- }
- hr = pTypeLib->lpVtbl->GetDocumentation( pTypeLib, index,
- &bstr, NULL, NULL, NULL);
- OLE_RELEASE(pTypeLib);
- if (FAILED(hr)) {
- return Qnil;
- }
- type = create_win32ole_type(pTypeInfo, WC2VSTR(bstr));
- return type;
-}
-
-
-/*
- * call-seq:
- * WIN32OLE_TYPE.ole_classes(typelib)
- *
- * Returns array of WIN32OLE_TYPE objects defined by the <i>typelib</i> type library.
- * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib).ole_classes instead.
- */
-static VALUE
-foletype_s_ole_classes(VALUE self, VALUE typelib)
-{
- VALUE obj;
-
- /*
- rb_warn("%s is obsolete; use %s instead.",
- "WIN32OLE_TYPE.ole_classes",
- "WIN32OLE_TYPELIB.new(typelib).ole_types");
- */
- obj = rb_funcall(cWIN32OLE_TYPELIB, rb_intern("new"), 1, typelib);
- return rb_funcall(obj, rb_intern("ole_types"), 0);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE.typelibs
- *
- * Returns array of type libraries.
- * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs.collect{|t| t.name} instead.
- *
- */
-static VALUE
-foletype_s_typelibs(VALUE self)
-{
- /*
- rb_warn("%s is obsolete. use %s instead.",
- "WIN32OLE_TYPE.typelibs",
- "WIN32OLE_TYPELIB.typelibs.collect{t|t.name}");
- */
- return rb_eval_string("WIN32OLE_TYPELIB.typelibs.collect{|t|t.name}");
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE.progids
- *
- * Returns array of ProgID.
- */
-static VALUE
-foletype_s_progids(VALUE self)
-{
- HKEY hclsids, hclsid;
- DWORD i;
- LONG err;
- VALUE clsid;
- VALUE v = rb_str_new2("");
- VALUE progids = rb_ary_new();
-
- err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hclsids);
- if(err != ERROR_SUCCESS) {
- return progids;
- }
- for(i = 0; ; i++) {
- clsid = reg_enum_key(hclsids, i);
- if (clsid == Qnil)
- break;
- err = reg_open_vkey(hclsids, clsid, &hclsid);
- if (err != ERROR_SUCCESS)
- continue;
- if ((v = reg_get_val2(hclsid, "ProgID")) != Qnil)
- rb_ary_push(progids, v);
- if ((v = reg_get_val2(hclsid, "VersionIndependentProgID")) != Qnil)
- rb_ary_push(progids, v);
- RegCloseKey(hclsid);
- }
- RegCloseKey(hclsids);
- return progids;
-}
-
-static VALUE
-oletype_set_member(VALUE self, ITypeInfo *pTypeInfo, VALUE name)
-{
- struct oletypedata *ptype;
- TypedData_Get_Struct(self, struct oletypedata, &oletype_datatype, ptype);
- rb_ivar_set(self, rb_intern("name"), name);
- ptype->pTypeInfo = pTypeInfo;
- OLE_ADDREF(pTypeInfo);
- return self;
-}
-
-static VALUE
-foletype_s_allocate(VALUE klass)
-{
- struct oletypedata *poletype;
- VALUE obj;
- ole_initialize();
- obj = TypedData_Make_Struct(klass,struct oletypedata, &oletype_datatype, poletype);
- poletype->pTypeInfo = NULL;
- return obj;
-}
-
-VALUE
-create_win32ole_type(ITypeInfo *pTypeInfo, VALUE name)
-{
- VALUE obj = foletype_s_allocate(cWIN32OLE_TYPE);
- oletype_set_member(obj, pTypeInfo, name);
- return obj;
-}
-
-static VALUE
-oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass)
-{
-
- long count;
- int i;
- HRESULT hr;
- BSTR bstr;
- VALUE typelib;
- ITypeInfo *pTypeInfo;
-
- VALUE found = Qfalse;
-
- count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
- for (i = 0; i < count && found == Qfalse; i++) {
- hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
- if (FAILED(hr))
- continue;
- hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr))
- continue;
- typelib = WC2VSTR(bstr);
- if (rb_str_cmp(oleclass, typelib) == 0) {
- oletype_set_member(self, pTypeInfo, typelib);
- found = Qtrue;
- }
- OLE_RELEASE(pTypeInfo);
- }
- return found;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE.new(typelib, ole_class) -> WIN32OLE_TYPE object
- *
- * Returns a new WIN32OLE_TYPE object.
- * The first argument <i>typelib</i> specifies OLE type library name.
- * The second argument specifies OLE class name.
- *
- * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * # => WIN32OLE_TYPE object of Application class of Excel.
- */
-static VALUE
-foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass)
-{
- VALUE file;
- OLECHAR * pbuf;
- ITypeLib *pTypeLib;
- HRESULT hr;
-
- SafeStringValue(oleclass);
- SafeStringValue(typelib);
- file = typelib_file(typelib);
- if (file == Qnil) {
- file = typelib;
- }
- pbuf = ole_vstr2wc(file);
- hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to LoadTypeLibEx");
- SysFreeString(pbuf);
- if (oleclass_from_typelib(self, pTypeLib, oleclass) == Qfalse) {
- OLE_RELEASE(pTypeLib);
- rb_raise(eWIN32OLERuntimeError, "not found `%s` in `%s`",
- StringValuePtr(oleclass), StringValuePtr(typelib));
- }
- OLE_RELEASE(pTypeLib);
- return self;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#name #=> OLE type name
- *
- * Returns OLE type name.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.name # => Application
- */
-static VALUE
-foletype_name(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_ole_type(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- VALUE type = Qnil;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if(FAILED(hr)){
- return type;
- }
- switch(pTypeAttr->typekind) {
- case TKIND_ENUM:
- type = rb_str_new2("Enum");
- break;
- case TKIND_RECORD:
- type = rb_str_new2("Record");
- break;
- case TKIND_MODULE:
- type = rb_str_new2("Module");
- break;
- case TKIND_INTERFACE:
- type = rb_str_new2("Interface");
- break;
- case TKIND_DISPATCH:
- type = rb_str_new2("Dispatch");
- break;
- case TKIND_COCLASS:
- type = rb_str_new2("Class");
- break;
- case TKIND_ALIAS:
- type = rb_str_new2("Alias");
- break;
- case TKIND_UNION:
- type = rb_str_new2("Union");
- break;
- case TKIND_MAX:
- type = rb_str_new2("Max");
- break;
- default:
- type = Qnil;
- break;
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#ole_type #=> OLE type string.
- *
- * returns type of OLE class.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.ole_type # => Class
- */
-static VALUE
-foletype_ole_type(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_ole_type(pTypeInfo);
-}
-
-static VALUE
-ole_type_guid(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- int len;
- OLECHAR bstr[80];
- VALUE guid = Qnil;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- return guid;
- len = StringFromGUID2(&pTypeAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR));
- if (len > 3) {
- guid = ole_wc2vstr(bstr, FALSE);
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return guid;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#guid #=> GUID
- *
- * Returns GUID.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.guid # => {00024500-0000-0000-C000-000000000046}
- */
-static VALUE
-foletype_guid(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_guid(pTypeInfo);
-}
-
-static VALUE
-ole_type_progid(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- OLECHAR *pbuf;
- VALUE progid = Qnil;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- return progid;
- hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf);
- if (SUCCEEDED(hr)) {
- progid = ole_wc2vstr(pbuf, FALSE);
- CoTaskMemFree(pbuf);
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return progid;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#progid #=> ProgID
- *
- * Returns ProgID if it exists. If not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.progid # => Excel.Application.9
- */
-static VALUE
-foletype_progid(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_progid(pTypeInfo);
-}
-
-
-static VALUE
-ole_type_visible(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- VALUE visible;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- return Qtrue;
- if (pTypeAttr->wTypeFlags & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) {
- visible = Qfalse;
- } else {
- visible = Qtrue;
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return visible;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#visible? #=> true or false
- *
- * Returns true if the OLE class is public.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.visible # => true
- */
-static VALUE
-foletype_visible(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_visible(pTypeInfo);
-}
-
-static VALUE
-ole_type_major_version(ITypeInfo *pTypeInfo)
-{
- VALUE ver;
- TYPEATTR *pTypeAttr;
- HRESULT hr;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- ver = INT2FIX(pTypeAttr->wMajorVerNum);
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return ver;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#major_version
- *
- * Returns major version.
- * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
- * puts tobj.major_version # => 8
- */
-static VALUE
-foletype_major_version(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_major_version(pTypeInfo);
-}
-
-static VALUE
-ole_type_minor_version(ITypeInfo *pTypeInfo)
-{
- VALUE ver;
- TYPEATTR *pTypeAttr;
- HRESULT hr;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- ver = INT2FIX(pTypeAttr->wMinorVerNum);
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return ver;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#minor_version #=> OLE minor version
- *
- * Returns minor version.
- * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
- * puts tobj.minor_version # => 2
- */
-static VALUE
-foletype_minor_version(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_minor_version(pTypeInfo);
-}
-
-static VALUE
-ole_type_typekind(ITypeInfo *pTypeInfo)
-{
- VALUE typekind;
- TYPEATTR *pTypeAttr;
- HRESULT hr;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- typekind = INT2FIX(pTypeAttr->typekind);
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return typekind;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#typekind #=> number of type.
- *
- * Returns number which represents type.
- * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
- * puts tobj.typekind # => 4
- *
- */
-static VALUE
-foletype_typekind(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_typekind(pTypeInfo);
-}
-
-static VALUE
-ole_type_helpstring(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- BSTR bhelpstr;
- hr = ole_docinfo_from_type(pTypeInfo, NULL, &bhelpstr, NULL, NULL);
- if(FAILED(hr)) {
- return Qnil;
- }
- return WC2VSTR(bhelpstr);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#helpstring #=> help string.
- *
- * Returns help string.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
- * puts tobj.helpstring # => Web Browser interface
- */
-static VALUE
-foletype_helpstring(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_helpstring(pTypeInfo);
-}
-
-static VALUE
-ole_type_src_type(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- VALUE alias = Qnil;
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr))
- return alias;
- if(pTypeAttr->typekind != TKIND_ALIAS) {
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return alias;
- }
- alias = ole_typedesc2val(pTypeInfo, &(pTypeAttr->tdescAlias), Qnil);
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return alias;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#src_type #=> OLE source class
- *
- * Returns source class when the OLE class is 'Alias'.
- * tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType')
- * puts tobj.src_type # => I4
- *
- */
-static VALUE
-foletype_src_type(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_src_type(pTypeInfo);
-}
-
-static VALUE
-ole_type_helpfile(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- BSTR bhelpfile;
- hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL, NULL, &bhelpfile);
- if(FAILED(hr)) {
- return Qnil;
- }
- return WC2VSTR(bhelpfile);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#helpfile
- *
- * Returns helpfile path. If helpfile is not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * puts tobj.helpfile # => C:\...\VBAXL9.CHM
- *
- */
-static VALUE
-foletype_helpfile(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_helpfile(pTypeInfo);
-}
-
-static VALUE
-ole_type_helpcontext(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- DWORD helpcontext;
- hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL,
- &helpcontext, NULL);
- if(FAILED(hr))
- return Qnil;
- return INT2FIX(helpcontext);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#helpcontext
- *
- * Returns helpcontext. If helpcontext is not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * puts tobj.helpfile # => 131185
- */
-static VALUE
-foletype_helpcontext(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_helpcontext(pTypeInfo);
-}
-
-static VALUE
-ole_variables(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- TYPEATTR *pTypeAttr;
- WORD i;
- UINT len;
- BSTR bstr;
- VARDESC *pVarDesc;
- VALUE var;
- VALUE variables = rb_ary_new();
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
- }
-
- for(i = 0; i < pTypeAttr->cVars; i++) {
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, i, &pVarDesc);
- if(FAILED(hr))
- continue;
- len = 0;
- hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pVarDesc->memid, &bstr,
- 1, &len);
- if(FAILED(hr) || len == 0 || !bstr)
- continue;
-
- var = create_win32ole_variable(pTypeInfo, i, WC2VSTR(bstr));
- rb_ary_push(variables, var);
-
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- pVarDesc = NULL;
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return variables;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#variables
- *
- * Returns array of WIN32OLE_VARIABLE objects which represent variables
- * defined in OLE class.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * vars = tobj.variables
- * vars.each do |v|
- * puts "#{v.name} = #{v.value}"
- * end
- *
- * The result of above sample script is follows:
- * xlChart = -4109
- * xlDialogSheet = -4116
- * xlExcel4IntlMacroSheet = 4
- * xlExcel4MacroSheet = 3
- * xlWorksheet = -4167
- *
- */
-static VALUE
-foletype_variables(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_variables(pTypeInfo);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#ole_methods # the array of WIN32OLE_METHOD objects.
- *
- * Returns array of WIN32OLE_METHOD objects which represent OLE method defined in
- * OLE type library.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * methods = tobj.ole_methods.collect{|m|
- * m.name
- * }
- * # => ['Activate', 'Copy', 'Delete',....]
- */
-static VALUE
-foletype_methods(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_methods_from_typeinfo(pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#ole_typelib
- *
- * Returns the WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE
- * object. If it is not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library'
- */
-static VALUE
-foletype_ole_typelib(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_typelib_from_itypeinfo(pTypeInfo);
-}
-
-static VALUE
-ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags)
-{
- HRESULT hr;
- ITypeInfo *pRefTypeInfo;
- HREFTYPE href;
- WORD i;
- VALUE type;
- TYPEATTR *pTypeAttr;
- int flags;
-
- VALUE types = rb_ary_new();
- hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
- if (FAILED(hr)) {
- return types;
- }
- for (i = 0; i < pTypeAttr->cImplTypes; i++) {
- hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
- if (FAILED(hr))
- continue;
-
- hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
- if (FAILED(hr))
- continue;
- hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
- if (FAILED(hr))
- continue;
-
- if ((flags & implflags) == implflags) {
- type = ole_type_from_itypeinfo(pRefTypeInfo);
- if (type != Qnil) {
- rb_ary_push(types, type);
- }
- }
-
- OLE_RELEASE(pRefTypeInfo);
- }
- OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
- return types;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#implemented_ole_types
- *
- * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
- * object.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * p tobj.implemented_ole_types # => [_Worksheet, DocEvents]
- */
-static VALUE
-foletype_impl_ole_types(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_impl_ole_types(pTypeInfo, 0);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#source_ole_types
- *
- * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
- * object and having IMPLTYPEFLAG_FSOURCE.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
- * p tobj.source_ole_types
- * # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>, #<WIN32OLE_TYPE:DWebBrowserEvents>]
- */
-static VALUE
-foletype_source_ole_types(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FSOURCE);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#default_event_sources
- *
- * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
- * object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
- * p tobj.default_event_sources # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>]
- */
-static VALUE
-foletype_default_event_sources(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#default_ole_types
- *
- * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE
- * object and having IMPLTYPEFLAG_FDEFAULT.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
- * p tobj.default_ole_types
- * # => [#<WIN32OLE_TYPE:IWebBrowser2>, #<WIN32OLE_TYPE:DWebBrowserEvents2>]
- */
-static VALUE
-foletype_default_ole_types(VALUE self)
-{
- ITypeInfo *pTypeInfo = itypeinfo(self);
- return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FDEFAULT);
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPE#inspect -> String
- *
- * Returns the type name with class name.
- *
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ie.ole_type.inspect => #<WIN32OLE_TYPE:IWebBrowser2>
- */
-static VALUE
-foletype_inspect(VALUE self)
-{
- return default_inspect(self, "WIN32OLE_TYPE");
-}
-
-void Init_win32ole_type(void)
-{
- cWIN32OLE_TYPE = rb_define_class("WIN32OLE_TYPE", rb_cObject);
- rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1);
- rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0);
- rb_define_singleton_method(cWIN32OLE_TYPE, "progids", foletype_s_progids, 0);
- rb_define_alloc_func(cWIN32OLE_TYPE, foletype_s_allocate);
- rb_define_method(cWIN32OLE_TYPE, "initialize", foletype_initialize, 2);
- rb_define_method(cWIN32OLE_TYPE, "name", foletype_name, 0);
- rb_define_method(cWIN32OLE_TYPE, "ole_type", foletype_ole_type, 0);
- rb_define_method(cWIN32OLE_TYPE, "guid", foletype_guid, 0);
- rb_define_method(cWIN32OLE_TYPE, "progid", foletype_progid, 0);
- rb_define_method(cWIN32OLE_TYPE, "visible?", foletype_visible, 0);
- rb_define_alias(cWIN32OLE_TYPE, "to_s", "name");
- rb_define_method(cWIN32OLE_TYPE, "major_version", foletype_major_version, 0);
- rb_define_method(cWIN32OLE_TYPE, "minor_version", foletype_minor_version, 0);
- rb_define_method(cWIN32OLE_TYPE, "typekind", foletype_typekind, 0);
- rb_define_method(cWIN32OLE_TYPE, "helpstring", foletype_helpstring, 0);
- rb_define_method(cWIN32OLE_TYPE, "src_type", foletype_src_type, 0);
- rb_define_method(cWIN32OLE_TYPE, "helpfile", foletype_helpfile, 0);
- rb_define_method(cWIN32OLE_TYPE, "helpcontext", foletype_helpcontext, 0);
- rb_define_method(cWIN32OLE_TYPE, "variables", foletype_variables, 0);
- rb_define_method(cWIN32OLE_TYPE, "ole_methods", foletype_methods, 0);
- rb_define_method(cWIN32OLE_TYPE, "ole_typelib", foletype_ole_typelib, 0);
- rb_define_method(cWIN32OLE_TYPE, "implemented_ole_types", foletype_impl_ole_types, 0);
- rb_define_method(cWIN32OLE_TYPE, "source_ole_types", foletype_source_ole_types, 0);
- rb_define_method(cWIN32OLE_TYPE, "default_event_sources", foletype_default_event_sources, 0);
- rb_define_method(cWIN32OLE_TYPE, "default_ole_types", foletype_default_ole_types, 0);
- rb_define_method(cWIN32OLE_TYPE, "inspect", foletype_inspect, 0);
-}
diff --git a/ext/win32ole/win32ole_type.h b/ext/win32ole/win32ole_type.h
deleted file mode 100644
index a26bf3e043..0000000000
--- a/ext/win32ole/win32ole_type.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef WIN32OLE_TYPE_H
-#define WIN32OLE_TYPE_H 1
-VALUE cWIN32OLE_TYPE;
-VALUE create_win32ole_type(ITypeInfo *pTypeInfo, VALUE name);
-ITypeInfo *itypeinfo(VALUE self);
-VALUE ole_type_from_itypeinfo(ITypeInfo *pTypeInfo);
-void Init_win32ole_type(void);
-#endif
diff --git a/ext/win32ole/win32ole_typelib.c b/ext/win32ole/win32ole_typelib.c
deleted file mode 100644
index 4f2c42fb76..0000000000
--- a/ext/win32ole/win32ole_typelib.c
+++ /dev/null
@@ -1,844 +0,0 @@
-#include "win32ole.h"
-
-struct oletypelibdata {
- ITypeLib *pTypeLib;
-};
-
-static VALUE reg_get_typelib_file_path(HKEY hkey);
-static VALUE oletypelib_path(VALUE guid, VALUE version);
-static HRESULT oletypelib_from_guid(VALUE guid, VALUE version, ITypeLib **ppTypeLib);
-static VALUE foletypelib_s_typelibs(VALUE self);
-static VALUE oletypelib_set_member(VALUE self, ITypeLib *pTypeLib);
-static void oletypelib_free(void *ptr);
-static size_t oletypelib_size(const void *ptr);
-static VALUE foletypelib_s_allocate(VALUE klass);
-static VALUE oletypelib_search_registry(VALUE self, VALUE typelib);
-static void oletypelib_get_libattr(ITypeLib *pTypeLib, TLIBATTR **ppTLibAttr);
-static VALUE oletypelib_search_registry2(VALUE self, VALUE args);
-static VALUE foletypelib_initialize(VALUE self, VALUE args);
-static VALUE foletypelib_guid(VALUE self);
-static VALUE foletypelib_name(VALUE self);
-static VALUE make_version_str(VALUE major, VALUE minor);
-static VALUE foletypelib_version(VALUE self);
-static VALUE foletypelib_major_version(VALUE self);
-static VALUE foletypelib_minor_version(VALUE self);
-static VALUE foletypelib_path(VALUE self);
-static VALUE foletypelib_visible(VALUE self);
-static VALUE foletypelib_library_name(VALUE self);
-static VALUE ole_types_from_typelib(ITypeLib *pTypeLib, VALUE classes);
-static VALUE typelib_file_from_typelib(VALUE ole);
-static VALUE typelib_file_from_clsid(VALUE ole);
-static VALUE foletypelib_ole_types(VALUE self);
-static VALUE foletypelib_inspect(VALUE self);
-
-static const rb_data_type_t oletypelib_datatype = {
- "win32ole_typelib",
- {NULL, oletypelib_free, oletypelib_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static VALUE
-reg_get_typelib_file_path(HKEY hkey)
-{
- VALUE path = Qnil;
- path = reg_get_val2(hkey, "win64");
- if (path != Qnil) {
- return path;
- }
- path = reg_get_val2(hkey, "win32");
- if (path != Qnil) {
- return path;
- }
- path = reg_get_val2(hkey, "win16");
- return path;
-}
-
-static VALUE
-oletypelib_path(VALUE guid, VALUE version)
-{
- int k;
- LONG err;
- HKEY hkey;
- HKEY hlang;
- VALUE lang;
- VALUE path = Qnil;
-
- VALUE key = rb_str_new2("TypeLib\\");
- rb_str_concat(key, guid);
- rb_str_cat2(key, "\\");
- rb_str_concat(key, version);
-
- err = reg_open_vkey(HKEY_CLASSES_ROOT, key, &hkey);
- if (err != ERROR_SUCCESS) {
- return Qnil;
- }
- for(k = 0; path == Qnil; k++) {
- lang = reg_enum_key(hkey, k);
- if (lang == Qnil)
- break;
- err = reg_open_vkey(hkey, lang, &hlang);
- if (err == ERROR_SUCCESS) {
- path = reg_get_typelib_file_path(hlang);
- RegCloseKey(hlang);
- }
- }
- RegCloseKey(hkey);
- return path;
-}
-
-static HRESULT
-oletypelib_from_guid(VALUE guid, VALUE version, ITypeLib **ppTypeLib)
-{
- VALUE path;
- OLECHAR *pBuf;
- HRESULT hr;
- path = oletypelib_path(guid, version);
- if (path == Qnil) {
- return E_UNEXPECTED;
- }
- pBuf = ole_vstr2wc(path);
- hr = LoadTypeLibEx(pBuf, REGKIND_NONE, ppTypeLib);
- SysFreeString(pBuf);
- return hr;
-}
-
-ITypeLib *
-itypelib(VALUE self)
-{
- struct oletypelibdata *ptlib;
- TypedData_Get_Struct(self, struct oletypelibdata, &oletypelib_datatype, ptlib);
- return ptlib->pTypeLib;
-}
-
-VALUE
-ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo)
-{
- HRESULT hr;
- ITypeLib *pTypeLib;
- unsigned int index;
- VALUE retval = Qnil;
-
- hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &index);
- if(FAILED(hr)) {
- return Qnil;
- }
- retval = create_win32ole_typelib(pTypeLib);
- return retval;
-}
-
-/*
- * Document-class: WIN32OLE_TYPELIB
- *
- * <code>WIN32OLE_TYPELIB</code> objects represent OLE tyblib information.
- */
-
-/*
- * call-seq:
- *
- * WIN32OLE_TYPELIB.typelibs
- *
- * Returns the array of WIN32OLE_TYPELIB object.
- *
- * tlibs = WIN32OLE_TYPELIB.typelibs
- *
- */
-static VALUE
-foletypelib_s_typelibs(VALUE self)
-{
- HKEY htypelib, hguid;
- DWORD i, j;
- LONG err;
- VALUE guid;
- VALUE version;
- VALUE name = Qnil;
- VALUE typelibs = rb_ary_new();
- VALUE typelib = Qnil;
- HRESULT hr;
- ITypeLib *pTypeLib;
-
- err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
- if(err != ERROR_SUCCESS) {
- return typelibs;
- }
- for(i = 0; ; i++) {
- guid = reg_enum_key(htypelib, i);
- if (guid == Qnil)
- break;
- err = reg_open_vkey(htypelib, guid, &hguid);
- if (err != ERROR_SUCCESS)
- continue;
- for(j = 0; ; j++) {
- version = reg_enum_key(hguid, j);
- if (version == Qnil)
- break;
- if ( (name = reg_get_val2(hguid, StringValuePtr(version))) != Qnil ) {
- hr = oletypelib_from_guid(guid, version, &pTypeLib);
- if (SUCCEEDED(hr)) {
- typelib = create_win32ole_typelib(pTypeLib);
- rb_ary_push(typelibs, typelib);
- }
- }
- }
- RegCloseKey(hguid);
- }
- RegCloseKey(htypelib);
- return typelibs;
-}
-
-static VALUE
-oletypelib_set_member(VALUE self, ITypeLib *pTypeLib)
-{
- struct oletypelibdata *ptlib;
- TypedData_Get_Struct(self, struct oletypelibdata, &oletypelib_datatype, ptlib);
- ptlib->pTypeLib = pTypeLib;
- return self;
-}
-
-static void
-oletypelib_free(void *ptr)
-{
- struct oletypelibdata *poletypelib = ptr;
- OLE_FREE(poletypelib->pTypeLib);
- free(poletypelib);
-}
-
-static size_t
-oletypelib_size(const void *ptr)
-{
- return ptr ? sizeof(struct oletypelibdata) : 0;
-}
-
-static VALUE
-foletypelib_s_allocate(VALUE klass)
-{
- struct oletypelibdata *poletypelib;
- VALUE obj;
- ole_initialize();
- obj = TypedData_Make_Struct(klass, struct oletypelibdata, &oletypelib_datatype, poletypelib);
- poletypelib->pTypeLib = NULL;
- return obj;
-}
-
-VALUE
-create_win32ole_typelib(ITypeLib *pTypeLib)
-{
- VALUE obj = foletypelib_s_allocate(cWIN32OLE_TYPELIB);
- oletypelib_set_member(obj, pTypeLib);
- return obj;
-}
-
-static VALUE
-oletypelib_search_registry(VALUE self, VALUE typelib)
-{
- HKEY htypelib, hguid, hversion;
- DWORD i, j;
- LONG err;
- VALUE found = Qfalse;
- VALUE tlib;
- VALUE guid;
- VALUE ver;
- HRESULT hr;
- ITypeLib *pTypeLib;
-
- err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
- if(err != ERROR_SUCCESS) {
- return Qfalse;
- }
- for(i = 0; !found; i++) {
- guid = reg_enum_key(htypelib, i);
- if (guid == Qnil)
- break;
- err = reg_open_vkey(htypelib, guid, &hguid);
- if (err != ERROR_SUCCESS)
- continue;
- for(j = 0; found == Qfalse; j++) {
- ver = reg_enum_key(hguid, j);
- if (ver == Qnil)
- break;
- err = reg_open_vkey(hguid, ver, &hversion);
- if (err != ERROR_SUCCESS)
- continue;
- tlib = reg_get_val(hversion, NULL);
- if (tlib == Qnil) {
- RegCloseKey(hversion);
- continue;
- }
- if (rb_str_cmp(typelib, tlib) == 0) {
- hr = oletypelib_from_guid(guid, ver, &pTypeLib);
- if (SUCCEEDED(hr)) {
- oletypelib_set_member(self, pTypeLib);
- found = Qtrue;
- }
- }
- RegCloseKey(hversion);
- }
- RegCloseKey(hguid);
- }
- RegCloseKey(htypelib);
- return found;
-}
-
-static void
-oletypelib_get_libattr(ITypeLib *pTypeLib, TLIBATTR **ppTLibAttr)
-{
- HRESULT hr;
- hr = pTypeLib->lpVtbl->GetLibAttr(pTypeLib, ppTLibAttr);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError,
- "failed to get library attribute(TLIBATTR) from ITypeLib");
- }
-}
-
-static VALUE
-oletypelib_search_registry2(VALUE self, VALUE args)
-{
- HKEY htypelib, hguid, hversion;
- double fver;
- DWORD j;
- LONG err;
- VALUE found = Qfalse;
- VALUE tlib;
- VALUE ver;
- VALUE version_str;
- VALUE version = Qnil;
- VALUE typelib = Qnil;
- HRESULT hr;
- ITypeLib *pTypeLib;
-
- VALUE guid = rb_ary_entry(args, 0);
- version_str = make_version_str(rb_ary_entry(args, 1), rb_ary_entry(args, 2));
-
- err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
- if(err != ERROR_SUCCESS) {
- return Qfalse;
- }
- err = reg_open_vkey(htypelib, guid, &hguid);
- if (err != ERROR_SUCCESS) {
- RegCloseKey(htypelib);
- return Qfalse;
- }
- if (version_str != Qnil) {
- err = reg_open_vkey(hguid, version_str, &hversion);
- if (err == ERROR_SUCCESS) {
- tlib = reg_get_val(hversion, NULL);
- if (tlib != Qnil) {
- typelib = tlib;
- version = version_str;
- }
- }
- RegCloseKey(hversion);
- } else {
- fver = 0.0;
- for(j = 0; ;j++) {
- ver = reg_enum_key(hguid, j);
- if (ver == Qnil)
- break;
- err = reg_open_vkey(hguid, ver, &hversion);
- if (err != ERROR_SUCCESS)
- continue;
- tlib = reg_get_val(hversion, NULL);
- if (tlib == Qnil) {
- RegCloseKey(hversion);
- continue;
- }
- if (fver < atof(StringValuePtr(ver))) {
- fver = atof(StringValuePtr(ver));
- version = ver;
- typelib = tlib;
- }
- RegCloseKey(hversion);
- }
- }
- RegCloseKey(hguid);
- RegCloseKey(htypelib);
- if (typelib != Qnil) {
- hr = oletypelib_from_guid(guid, version, &pTypeLib);
- if (SUCCEEDED(hr)) {
- found = Qtrue;
- oletypelib_set_member(self, pTypeLib);
- }
- }
- return found;
-}
-
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB.new(typelib [, version1, version2]) -> WIN32OLE_TYPELIB object
- *
- * Returns a new WIN32OLE_TYPELIB object.
- *
- * The first argument <i>typelib</i> specifies OLE type library name or GUID or
- * OLE library file.
- * The second argument is major version or version of the type library.
- * The third argument is minor version.
- * The second argument and third argument are optional.
- * If the first argument is type library name, then the second and third argument
- * are ignored.
- *
- * tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}')
- * tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3)
- * tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3)
- * tlib5 = WIN32OLE_TYPELIB.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL")
- * puts tlib1.name # -> 'Microsoft Excel 9.0 Object Library'
- * puts tlib2.name # -> 'Microsoft Excel 9.0 Object Library'
- * puts tlib3.name # -> 'Microsoft Excel 9.0 Object Library'
- * puts tlib4.name # -> 'Microsoft Excel 9.0 Object Library'
- * puts tlib5.name # -> 'Microsoft Shell Controls And Automation'
- *
- */
-static VALUE
-foletypelib_initialize(VALUE self, VALUE args)
-{
- VALUE found = Qfalse;
- VALUE typelib = Qnil;
- int len = 0;
- OLECHAR * pbuf;
- ITypeLib *pTypeLib;
- HRESULT hr = S_OK;
-
- len = RARRAY_LEN(args);
- rb_check_arity(len, 1, 3);
-
- typelib = rb_ary_entry(args, 0);
-
- SafeStringValue(typelib);
-
- found = oletypelib_search_registry(self, typelib);
- if (found == Qfalse) {
- found = oletypelib_search_registry2(self, args);
- }
- if (found == Qfalse) {
- pbuf = ole_vstr2wc(typelib);
- hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
- SysFreeString(pbuf);
- if (SUCCEEDED(hr)) {
- found = Qtrue;
- oletypelib_set_member(self, pTypeLib);
- }
- }
-
- if (found == Qfalse) {
- rb_raise(eWIN32OLERuntimeError, "not found type library `%s`",
- StringValuePtr(typelib));
- }
- return self;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#guid -> The guid string.
- *
- * Returns guid string which specifies type library.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * guid = tlib.guid # -> '{00020813-0000-0000-C000-000000000046}'
- */
-static VALUE
-foletypelib_guid(VALUE self)
-{
- ITypeLib *pTypeLib;
- OLECHAR bstr[80];
- VALUE guid = Qnil;
- int len;
- TLIBATTR *pTLibAttr;
-
- pTypeLib = itypelib(self);
- oletypelib_get_libattr(pTypeLib, &pTLibAttr);
- len = StringFromGUID2(&pTLibAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR));
- if (len > 3) {
- guid = ole_wc2vstr(bstr, FALSE);
- }
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- return guid;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#name -> The type library name
- *
- * Returns the type library name.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * name = tlib.name # -> 'Microsoft Excel 9.0 Object Library'
- */
-static VALUE
-foletypelib_name(VALUE self)
-{
- ITypeLib *pTypeLib;
- HRESULT hr;
- BSTR bstr;
- VALUE name;
- pTypeLib = itypelib(self);
- hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, -1,
- NULL, &bstr, NULL, NULL);
-
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to get name from ITypeLib");
- }
- name = WC2VSTR(bstr);
- return name;
-}
-
-static VALUE
-make_version_str(VALUE major, VALUE minor)
-{
- VALUE version_str = Qnil;
- VALUE minor_str = Qnil;
- if (major == Qnil) {
- return Qnil;
- }
- version_str = rb_String(major);
- if (minor != Qnil) {
- minor_str = rb_String(minor);
- rb_str_cat2(version_str, ".");
- rb_str_append(version_str, minor_str);
- }
- return version_str;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#version -> The type library version String object.
- *
- * Returns the type library version.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * puts tlib.version #-> "1.3"
- */
-static VALUE
-foletypelib_version(VALUE self)
-{
- TLIBATTR *pTLibAttr;
- ITypeLib *pTypeLib;
- VALUE version;
-
- pTypeLib = itypelib(self);
- oletypelib_get_libattr(pTypeLib, &pTLibAttr);
- version = rb_sprintf("%d.%d", pTLibAttr->wMajorVerNum, pTLibAttr->wMinorVerNum);
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- return version;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#major_version -> The type library major version.
- *
- * Returns the type library major version.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * puts tlib.major_version # -> 1
- */
-static VALUE
-foletypelib_major_version(VALUE self)
-{
- TLIBATTR *pTLibAttr;
- VALUE major;
- ITypeLib *pTypeLib;
- pTypeLib = itypelib(self);
- oletypelib_get_libattr(pTypeLib, &pTLibAttr);
-
- major = INT2NUM(pTLibAttr->wMajorVerNum);
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- return major;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#minor_version -> The type library minor version.
- *
- * Returns the type library minor version.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * puts tlib.minor_version # -> 3
- */
-static VALUE
-foletypelib_minor_version(VALUE self)
-{
- TLIBATTR *pTLibAttr;
- VALUE minor;
- ITypeLib *pTypeLib;
- pTypeLib = itypelib(self);
- oletypelib_get_libattr(pTypeLib, &pTLibAttr);
- minor = INT2NUM(pTLibAttr->wMinorVerNum);
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- return minor;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#path -> The type library file path.
- *
- * Returns the type library file path.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * puts tlib.path #-> 'C:\...\EXCEL9.OLB'
- */
-static VALUE
-foletypelib_path(VALUE self)
-{
- TLIBATTR *pTLibAttr;
- HRESULT hr = S_OK;
- BSTR bstr;
- LCID lcid = cWIN32OLE_lcid;
- VALUE path;
- ITypeLib *pTypeLib;
-
- pTypeLib = itypelib(self);
- oletypelib_get_libattr(pTypeLib, &pTLibAttr);
- hr = QueryPathOfRegTypeLib(&pTLibAttr->guid,
- pTLibAttr->wMajorVerNum,
- pTLibAttr->wMinorVerNum,
- lcid,
- &bstr);
- if (FAILED(hr)) {
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- ole_raise(hr, eWIN32OLERuntimeError, "failed to QueryPathOfRegTypeTypeLib");
- }
-
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- path = WC2VSTR(bstr);
- return path;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#visible?
- *
- * Returns true if the type library information is not hidden.
- * If wLibFlags of TLIBATTR is 0 or LIBFLAG_FRESTRICTED or LIBFLAG_FHIDDEN,
- * the method returns false, otherwise, returns true.
- * If the method fails to access the TLIBATTR information, then
- * WIN32OLERuntimeError is raised.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * tlib.visible? # => true
- */
-static VALUE
-foletypelib_visible(VALUE self)
-{
- ITypeLib *pTypeLib = NULL;
- VALUE visible = Qtrue;
- TLIBATTR *pTLibAttr;
-
- pTypeLib = itypelib(self);
- oletypelib_get_libattr(pTypeLib, &pTLibAttr);
-
- if ((pTLibAttr->wLibFlags == 0) ||
- (pTLibAttr->wLibFlags & LIBFLAG_FRESTRICTED) ||
- (pTLibAttr->wLibFlags & LIBFLAG_FHIDDEN)) {
- visible = Qfalse;
- }
- pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
- return visible;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#library_name
- *
- * Returns library name.
- * If the method fails to access library name, WIN32OLERuntimeError is raised.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * tlib.library_name # => Excel
- */
-static VALUE
-foletypelib_library_name(VALUE self)
-{
- HRESULT hr;
- ITypeLib *pTypeLib = NULL;
- VALUE libname = Qnil;
- BSTR bstr;
-
- pTypeLib = itypelib(self);
- hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, -1,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to get library name");
- }
- libname = WC2VSTR(bstr);
- return libname;
-}
-
-static VALUE
-ole_types_from_typelib(ITypeLib *pTypeLib, VALUE classes)
-{
- long count;
- int i;
- HRESULT hr;
- BSTR bstr;
- ITypeInfo *pTypeInfo;
- VALUE type;
-
- count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
- for (i = 0; i < count; i++) {
- hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
- &bstr, NULL, NULL, NULL);
- if (FAILED(hr))
- continue;
-
- hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
- if (FAILED(hr))
- continue;
-
- type = create_win32ole_type(pTypeInfo, WC2VSTR(bstr));
-
- rb_ary_push(classes, type);
- OLE_RELEASE(pTypeInfo);
- }
- return classes;
-}
-
-static VALUE
-typelib_file_from_typelib(VALUE ole)
-{
- HKEY htypelib, hclsid, hversion, hlang;
- double fver;
- DWORD i, j, k;
- LONG err;
- BOOL found = FALSE;
- VALUE typelib;
- VALUE file = Qnil;
- VALUE clsid;
- VALUE ver;
- VALUE lang;
-
- err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
- if(err != ERROR_SUCCESS) {
- return Qnil;
- }
- for(i = 0; !found; i++) {
- clsid = reg_enum_key(htypelib, i);
- if (clsid == Qnil)
- break;
- err = reg_open_vkey(htypelib, clsid, &hclsid);
- if (err != ERROR_SUCCESS)
- continue;
- fver = 0;
- for(j = 0; !found; j++) {
- ver = reg_enum_key(hclsid, j);
- if (ver == Qnil)
- break;
- err = reg_open_vkey(hclsid, ver, &hversion);
- if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
- continue;
- fver = atof(StringValuePtr(ver));
- typelib = reg_get_val(hversion, NULL);
- if (typelib == Qnil)
- continue;
- if (rb_str_cmp(typelib, ole) == 0) {
- for(k = 0; !found; k++) {
- lang = reg_enum_key(hversion, k);
- if (lang == Qnil)
- break;
- err = reg_open_vkey(hversion, lang, &hlang);
- if (err == ERROR_SUCCESS) {
- if ((file = reg_get_typelib_file_path(hlang)) != Qnil)
- found = TRUE;
- RegCloseKey(hlang);
- }
- }
- }
- RegCloseKey(hversion);
- }
- RegCloseKey(hclsid);
- }
- RegCloseKey(htypelib);
- return file;
-}
-
-static VALUE
-typelib_file_from_clsid(VALUE ole)
-{
- HKEY hroot, hclsid;
- LONG err;
- VALUE typelib;
- char path[MAX_PATH + 1];
-
- err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hroot);
- if (err != ERROR_SUCCESS) {
- return Qnil;
- }
- err = reg_open_key(hroot, StringValuePtr(ole), &hclsid);
- if (err != ERROR_SUCCESS) {
- RegCloseKey(hroot);
- return Qnil;
- }
- typelib = reg_get_val2(hclsid, "InprocServer32");
- RegCloseKey(hroot);
- RegCloseKey(hclsid);
- if (typelib != Qnil) {
- ExpandEnvironmentStrings(StringValuePtr(typelib), path, sizeof(path));
- path[MAX_PATH] = '\0';
- typelib = rb_str_new2(path);
- }
- return typelib;
-}
-
-VALUE
-typelib_file(VALUE ole)
-{
- VALUE file = typelib_file_from_clsid(ole);
- if (file != Qnil) {
- return file;
- }
- return typelib_file_from_typelib(ole);
-}
-
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#ole_types -> The array of WIN32OLE_TYPE object included the type library.
- *
- * Returns the type library file path.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...]
- */
-static VALUE
-foletypelib_ole_types(VALUE self)
-{
- ITypeLib *pTypeLib = NULL;
- VALUE classes = rb_ary_new();
- pTypeLib = itypelib(self);
- ole_types_from_typelib(pTypeLib, classes);
- return classes;
-}
-
-/*
- * call-seq:
- * WIN32OLE_TYPELIB#inspect -> String
- *
- * Returns the type library name with class name.
- *
- * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
- * tlib.inspect # => "<#WIN32OLE_TYPELIB:Microsoft Excel 9.0 Object Library>"
- */
-static VALUE
-foletypelib_inspect(VALUE self)
-{
- return default_inspect(self, "WIN32OLE_TYPELIB");
-}
-
-void
-Init_win32ole_typelib(void)
-{
- cWIN32OLE_TYPELIB = rb_define_class("WIN32OLE_TYPELIB", rb_cObject);
- rb_define_singleton_method(cWIN32OLE_TYPELIB, "typelibs", foletypelib_s_typelibs, 0);
- rb_define_alloc_func(cWIN32OLE_TYPELIB, foletypelib_s_allocate);
- rb_define_method(cWIN32OLE_TYPELIB, "initialize", foletypelib_initialize, -2);
- rb_define_method(cWIN32OLE_TYPELIB, "guid", foletypelib_guid, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "name", foletypelib_name, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "version", foletypelib_version, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "major_version", foletypelib_major_version, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "minor_version", foletypelib_minor_version, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "path", foletypelib_path, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "ole_types", foletypelib_ole_types, 0);
- rb_define_alias(cWIN32OLE_TYPELIB, "ole_classes", "ole_types");
- rb_define_method(cWIN32OLE_TYPELIB, "visible?", foletypelib_visible, 0);
- rb_define_method(cWIN32OLE_TYPELIB, "library_name", foletypelib_library_name, 0);
- rb_define_alias(cWIN32OLE_TYPELIB, "to_s", "name");
- rb_define_method(cWIN32OLE_TYPELIB, "inspect", foletypelib_inspect, 0);
-}
diff --git a/ext/win32ole/win32ole_typelib.h b/ext/win32ole/win32ole_typelib.h
deleted file mode 100644
index 9fc117fcb4..0000000000
--- a/ext/win32ole/win32ole_typelib.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef WIN32OLE_TYPELIB_H
-#define WIN32OLE_TYPELIB_H 1
-
-VALUE cWIN32OLE_TYPELIB;
-
-void Init_win32ole_typelib(void);
-ITypeLib * itypelib(VALUE self);
-VALUE typelib_file(VALUE ole);
-VALUE create_win32ole_typelib(ITypeLib *pTypeLib);
-VALUE ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo);
-#endif
diff --git a/ext/win32ole/win32ole_variable.c b/ext/win32ole/win32ole_variable.c
deleted file mode 100644
index dd583828f2..0000000000
--- a/ext/win32ole/win32ole_variable.c
+++ /dev/null
@@ -1,380 +0,0 @@
-#include "win32ole.h"
-
-struct olevariabledata {
- ITypeInfo *pTypeInfo;
- UINT index;
-};
-
-static void olevariable_free(void *ptr);
-static size_t olevariable_size(const void *ptr);
-static VALUE folevariable_name(VALUE self);
-static VALUE ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index);
-static VALUE folevariable_ole_type(VALUE self);
-static VALUE ole_variable_ole_type_detail(ITypeInfo *pTypeInfo, UINT var_index);
-static VALUE folevariable_ole_type_detail(VALUE self);
-static VALUE ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index);
-static VALUE folevariable_value(VALUE self);
-static VALUE ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index);
-static VALUE folevariable_visible(VALUE self);
-static VALUE ole_variable_kind(ITypeInfo *pTypeInfo, UINT var_index);
-static VALUE folevariable_variable_kind(VALUE self);
-static VALUE ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index);
-static VALUE folevariable_varkind(VALUE self);
-static VALUE folevariable_inspect(VALUE self);
-
-static const rb_data_type_t olevariable_datatype = {
- "win32ole_variable",
- {NULL, olevariable_free, olevariable_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static void
-olevariable_free(void *ptr)
-{
- struct olevariabledata *polevar = ptr;
- OLE_FREE(polevar->pTypeInfo);
- free(polevar);
-}
-
-static size_t
-olevariable_size(const void *ptr)
-{
- return ptr ? sizeof(struct olevariabledata) : 0;
-}
-
-/*
- * Document-class: WIN32OLE_VARIABLE
- *
- * <code>WIN32OLE_VARIABLE</code> objects represent OLE variable information.
- */
-
-VALUE
-create_win32ole_variable(ITypeInfo *pTypeInfo, UINT index, VALUE name)
-{
- struct olevariabledata *pvar;
- VALUE obj = TypedData_Make_Struct(cWIN32OLE_VARIABLE, struct olevariabledata,
- &olevariable_datatype, pvar);
- pvar->pTypeInfo = pTypeInfo;
- OLE_ADDREF(pTypeInfo);
- pvar->index = index;
- rb_ivar_set(obj, rb_intern("name"), name);
- return obj;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#name
- *
- * Returns the name of variable.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name}"
- * end
- *
- * The result of above script is following:
- * xlChart
- * xlDialogSheet
- * xlExcel4IntlMacroSheet
- * xlExcel4MacroSheet
- * xlWorksheet
- *
- */
-static VALUE
-folevariable_name(VALUE self)
-{
- return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index)
-{
- VARDESC *pVarDesc;
- HRESULT hr;
- VALUE type;
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetVarDesc");
- type = ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), Qnil);
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#ole_type
- *
- * Returns OLE type string.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.ole_type} #{variable.name}"
- * end
- *
- * The result of above script is following:
- * INT xlChart
- * INT xlDialogSheet
- * INT xlExcel4IntlMacroSheet
- * INT xlExcel4MacroSheet
- * INT xlWorksheet
- *
- */
-static VALUE
-folevariable_ole_type(VALUE self)
-{
- struct olevariabledata *pvar;
- TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
- return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_ole_type_detail(ITypeInfo *pTypeInfo, UINT var_index)
-{
- VARDESC *pVarDesc;
- HRESULT hr;
- VALUE type = rb_ary_new();
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
- if (FAILED(hr))
- ole_raise(hr, eWIN32OLERuntimeError, "failed to GetVarDesc");
- ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), type);
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- return type;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#ole_type_detail
- *
- * Returns detail information of type. The information is array of type.
- *
- * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
- * variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
- * tdetail = variable.ole_type_detail
- * p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]
- *
- */
-static VALUE
-folevariable_ole_type_detail(VALUE self)
-{
- struct olevariabledata *pvar;
- TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
- return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index)
-{
- VARDESC *pVarDesc;
- HRESULT hr;
- VALUE val = Qnil;
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
- if (FAILED(hr))
- return Qnil;
- if(pVarDesc->varkind == VAR_CONST)
- val = ole_variant2val(V_UNION1(pVarDesc, lpvarValue));
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- return val;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#value
- *
- * Returns value if value is exists. If the value does not exist,
- * this method returns nil.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.value}"
- * end
- *
- * The result of above script is following:
- * xlChart = -4109
- * xlDialogSheet = -4116
- * xlExcel4IntlMacroSheet = 4
- * xlExcel4MacroSheet = 3
- * xlWorksheet = -4167
- *
- */
-static VALUE
-folevariable_value(VALUE self)
-{
- struct olevariabledata *pvar;
- TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
- return ole_variable_value(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index)
-{
- VARDESC *pVarDesc;
- HRESULT hr;
- VALUE visible = Qfalse;
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
- if (FAILED(hr))
- return visible;
- if (!(pVarDesc->wVarFlags & (VARFLAG_FHIDDEN |
- VARFLAG_FRESTRICTED |
- VARFLAG_FNONBROWSABLE))) {
- visible = Qtrue;
- }
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- return visible;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#visible?
- *
- * Returns true if the variable is public.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.visible?}"
- * end
- *
- * The result of above script is following:
- * xlChart true
- * xlDialogSheet true
- * xlExcel4IntlMacroSheet true
- * xlExcel4MacroSheet true
- * xlWorksheet true
- *
- */
-static VALUE
-folevariable_visible(VALUE self)
-{
- struct olevariabledata *pvar;
- TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
- return ole_variable_visible(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_kind(ITypeInfo *pTypeInfo, UINT var_index)
-{
- VARDESC *pVarDesc;
- HRESULT hr;
- VALUE kind = rb_str_new2("UNKNOWN");
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
- if (FAILED(hr))
- return kind;
- switch(pVarDesc->varkind) {
- case VAR_PERINSTANCE:
- kind = rb_str_new2("PERINSTANCE");
- break;
- case VAR_STATIC:
- kind = rb_str_new2("STATIC");
- break;
- case VAR_CONST:
- kind = rb_str_new2("CONSTANT");
- break;
- case VAR_DISPATCH:
- kind = rb_str_new2("DISPATCH");
- break;
- default:
- break;
- }
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- return kind;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#variable_kind
- *
- * Returns variable kind string.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.variable_kind}"
- * end
- *
- * The result of above script is following:
- * xlChart CONSTANT
- * xlDialogSheet CONSTANT
- * xlExcel4IntlMacroSheet CONSTANT
- * xlExcel4MacroSheet CONSTANT
- * xlWorksheet CONSTANT
- */
-static VALUE
-folevariable_variable_kind(VALUE self)
-{
- struct olevariabledata *pvar;
- TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
- return ole_variable_kind(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index)
-{
- VARDESC *pVarDesc;
- HRESULT hr;
- VALUE kind = Qnil;
- hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
- if (FAILED(hr))
- return kind;
- pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
- kind = INT2FIX(pVarDesc->varkind);
- return kind;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#varkind
- *
- * Returns the number which represents variable kind.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.varkind}"
- * end
- *
- * The result of above script is following:
- * xlChart 2
- * xlDialogSheet 2
- * xlExcel4IntlMacroSheet 2
- * xlExcel4MacroSheet 2
- * xlWorksheet 2
- */
-static VALUE
-folevariable_varkind(VALUE self)
-{
- struct olevariabledata *pvar;
- TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
- return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#inspect -> String
- *
- * Returns the OLE variable name and the value with class name.
- *
- */
-static VALUE
-folevariable_inspect(VALUE self)
-{
- VALUE v = rb_inspect(folevariable_value(self));
- VALUE n = folevariable_name(self);
- VALUE detail = rb_sprintf("%"PRIsVALUE"=%"PRIsVALUE, n, v);
- return make_inspect("WIN32OLE_VARIABLE", detail);
-}
-
-void Init_win32ole_variable(void)
-{
- cWIN32OLE_VARIABLE = rb_define_class("WIN32OLE_VARIABLE", rb_cObject);
- rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "ole_type", folevariable_ole_type, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "ole_type_detail", folevariable_ole_type_detail, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "value", folevariable_value, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "visible?", folevariable_visible, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "variable_kind", folevariable_variable_kind, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "varkind", folevariable_varkind, 0);
- rb_define_method(cWIN32OLE_VARIABLE, "inspect", folevariable_inspect, 0);
- rb_define_alias(cWIN32OLE_VARIABLE, "to_s", "name");
-}
diff --git a/ext/win32ole/win32ole_variable.h b/ext/win32ole/win32ole_variable.h
deleted file mode 100644
index 704dc13508..0000000000
--- a/ext/win32ole/win32ole_variable.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef WIN32OLE_VARIABLE_H
-#define WIN32OLE_VARIABLE_H 1
-
-VALUE cWIN32OLE_VARIABLE;
-VALUE create_win32ole_variable(ITypeInfo *pTypeInfo, UINT index, VALUE name);
-void Init_win32ole_variable(void);
-
-#endif
diff --git a/ext/win32ole/win32ole_variant.c b/ext/win32ole/win32ole_variant.c
deleted file mode 100644
index f1fdeca038..0000000000
--- a/ext/win32ole/win32ole_variant.c
+++ /dev/null
@@ -1,732 +0,0 @@
-#include "win32ole.h"
-
-struct olevariantdata {
- VARIANT realvar;
- VARIANT var;
-};
-
-static void olevariant_free(void *ptr);
-static size_t olevariant_size(const void *ptr);
-static void ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar);
-static void ole_val2variant_err(VALUE val, VARIANT *var);
-static void ole_set_byref(VARIANT *realvar, VARIANT *var, VARTYPE vt);
-static VALUE folevariant_s_allocate(VALUE klass);
-static VALUE folevariant_s_array(VALUE klass, VALUE dims, VALUE vvt);
-static void check_type_val2variant(VALUE val);
-static VALUE folevariant_initialize(VALUE self, VALUE args);
-static LONG *ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa);
-static void unlock_safe_array(SAFEARRAY *psa);
-static SAFEARRAY *get_locked_safe_array(VALUE val);
-static VALUE folevariant_ary_aref(int argc, VALUE *argv, VALUE self);
-static VALUE folevariant_ary_aset(int argc, VALUE *argv, VALUE self);
-static VALUE folevariant_value(VALUE self);
-static VALUE folevariant_vartype(VALUE self);
-static VALUE folevariant_set_value(VALUE self, VALUE val);
-
-static const rb_data_type_t olevariant_datatype = {
- "win32ole_variant",
- {NULL, olevariant_free, olevariant_size,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
-static void
-olevariant_free(void *ptr)
-{
- struct olevariantdata *pvar = ptr;
- VariantClear(&(pvar->realvar));
- VariantClear(&(pvar->var));
- free(pvar);
-}
-
-static size_t
-olevariant_size(const void *ptr)
-{
- return ptr ? sizeof(struct olevariantdata) : 0;
-}
-
-static void
-ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar)
-{
- HRESULT hr = S_OK;
-
- if (((vt & ~VT_BYREF) == (VT_ARRAY | VT_UI1)) && RB_TYPE_P(val, T_STRING)) {
- long len = RSTRING_LEN(val);
- void *pdest = NULL;
- SAFEARRAY *p = NULL;
- SAFEARRAY *psa = SafeArrayCreateVector(VT_UI1, 0, len);
- if (!psa) {
- rb_raise(rb_eRuntimeError, "fail to SafeArrayCreateVector");
- }
- hr = SafeArrayAccessData(psa, &pdest);
- if (SUCCEEDED(hr)) {
- memcpy(pdest, RSTRING_PTR(val), len);
- SafeArrayUnaccessData(psa);
- V_VT(&(pvar->realvar)) = (vt & ~VT_BYREF);
- p = V_ARRAY(&(pvar->realvar));
- if (p != NULL) {
- SafeArrayDestroy(p);
- }
- V_ARRAY(&(pvar->realvar)) = psa;
- if (vt & VT_BYREF) {
- V_VT(&(pvar->var)) = vt;
- V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
- } else {
- hr = VariantCopy(&(pvar->var), &(pvar->realvar));
- }
- } else {
- if (psa)
- SafeArrayDestroy(psa);
- }
- } else if (vt & VT_ARRAY) {
- if (val == Qnil) {
- V_VT(&(pvar->var)) = vt;
- if (vt & VT_BYREF) {
- V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
- }
- } else {
- hr = ole_val_ary2variant_ary(val, &(pvar->realvar), (VARTYPE)(vt & ~VT_BYREF));
- if (SUCCEEDED(hr)) {
- if (vt & VT_BYREF) {
- V_VT(&(pvar->var)) = vt;
- V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
- } else {
- hr = VariantCopy(&(pvar->var), &(pvar->realvar));
- }
- }
- }
-#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
- } else if ( (vt & ~VT_BYREF) == VT_I8 || (vt & ~VT_BYREF) == VT_UI8) {
- ole_val2variant_ex(val, &(pvar->realvar), (vt & ~VT_BYREF));
- ole_val2variant_ex(val, &(pvar->var), (vt & ~VT_BYREF));
- V_VT(&(pvar->var)) = vt;
- if (vt & VT_BYREF) {
- ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
- }
-#endif
- } else if ( (vt & ~VT_BYREF) == VT_ERROR) {
- ole_val2variant_err(val, &(pvar->realvar));
- if (vt & VT_BYREF) {
- ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
- } else {
- hr = VariantCopy(&(pvar->var), &(pvar->realvar));
- }
- } else {
- if (val == Qnil) {
- V_VT(&(pvar->var)) = vt;
- if (vt == (VT_BYREF | VT_VARIANT)) {
- ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
- } else {
- V_VT(&(pvar->realvar)) = vt & ~VT_BYREF;
- if (vt & VT_BYREF) {
- ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
- }
- }
- } else {
- ole_val2variant_ex(val, &(pvar->realvar), (VARTYPE)(vt & ~VT_BYREF));
- if (vt == (VT_BYREF | VT_VARIANT)) {
- ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
- } else if (vt & VT_BYREF) {
- if ( (vt & ~VT_BYREF) != V_VT(&(pvar->realvar))) {
- hr = VariantChangeTypeEx(&(pvar->realvar), &(pvar->realvar),
- cWIN32OLE_lcid, 0, (VARTYPE)(vt & ~VT_BYREF));
- }
- if (SUCCEEDED(hr)) {
- ole_set_byref(&(pvar->realvar), &(pvar->var), vt);
- }
- } else {
- if (vt == V_VT(&(pvar->realvar))) {
- hr = VariantCopy(&(pvar->var), &(pvar->realvar));
- } else {
- hr = VariantChangeTypeEx(&(pvar->var), &(pvar->realvar),
- cWIN32OLE_lcid, 0, vt);
- }
- }
- }
- }
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to change type");
- }
-}
-
-static void
-ole_val2variant_err(VALUE val, VARIANT *var)
-{
- VALUE v = val;
- if (rb_obj_is_kind_of(v, cWIN32OLE_VARIANT)) {
- v = folevariant_value(v);
- }
- if (TYPE(v) != T_FIXNUM && TYPE(v) != T_BIGNUM && v != Qnil) {
- rb_raise(eWIN32OLERuntimeError, "failed to convert VT_ERROR VARIANT:`%"PRIsVALUE"'", rb_inspect(v));
- }
- V_VT(var) = VT_ERROR;
- if (v != Qnil) {
- V_ERROR(var) = NUM2LONG(val);
- } else {
- V_ERROR(var) = 0;
- }
-}
-
-static void
-ole_set_byref(VARIANT *realvar, VARIANT *var, VARTYPE vt)
-{
- V_VT(var) = vt;
- if (vt == (VT_VARIANT|VT_BYREF)) {
- V_VARIANTREF(var) = realvar;
- } else {
- if (V_VT(realvar) != (vt & ~VT_BYREF)) {
- rb_raise(eWIN32OLERuntimeError, "variant type mismatch");
- }
- switch(vt & ~VT_BYREF) {
- case VT_I1:
- V_I1REF(var) = &V_I1(realvar);
- break;
- case VT_UI1:
- V_UI1REF(var) = &V_UI1(realvar);
- break;
- case VT_I2:
- V_I2REF(var) = &V_I2(realvar);
- break;
- case VT_UI2:
- V_UI2REF(var) = &V_UI2(realvar);
- break;
- case VT_I4:
- V_I4REF(var) = &V_I4(realvar);
- break;
- case VT_UI4:
- V_UI4REF(var) = &V_UI4(realvar);
- break;
- case VT_R4:
- V_R4REF(var) = &V_R4(realvar);
- break;
- case VT_R8:
- V_R8REF(var) = &V_R8(realvar);
- break;
-
-#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
-#ifdef V_I8REF
- case VT_I8:
- V_I8REF(var) = &V_I8(realvar);
- break;
-#endif
-#ifdef V_UI8REF
- case VT_UI8:
- V_UI8REF(var) = &V_UI8(realvar);
- break;
-#endif
-#endif
- case VT_INT:
- V_INTREF(var) = &V_INT(realvar);
- break;
-
- case VT_UINT:
- V_UINTREF(var) = &V_UINT(realvar);
- break;
-
- case VT_CY:
- V_CYREF(var) = &V_CY(realvar);
- break;
- case VT_DATE:
- V_DATEREF(var) = &V_DATE(realvar);
- break;
- case VT_BSTR:
- V_BSTRREF(var) = &V_BSTR(realvar);
- break;
- case VT_DISPATCH:
- V_DISPATCHREF(var) = &V_DISPATCH(realvar);
- break;
- case VT_ERROR:
- V_ERRORREF(var) = &V_ERROR(realvar);
- break;
- case VT_BOOL:
- V_BOOLREF(var) = &V_BOOL(realvar);
- break;
- case VT_UNKNOWN:
- V_UNKNOWNREF(var) = &V_UNKNOWN(realvar);
- break;
- case VT_ARRAY:
- V_ARRAYREF(var) = &V_ARRAY(realvar);
- break;
- default:
- rb_raise(eWIN32OLERuntimeError, "unknown type specified(setting BYREF):%d", vt);
- break;
- }
- }
-}
-
-static VALUE
-folevariant_s_allocate(VALUE klass)
-{
- struct olevariantdata *pvar;
- VALUE obj;
- ole_initialize();
- obj = TypedData_Make_Struct(klass, struct olevariantdata, &olevariant_datatype, pvar);
- VariantInit(&(pvar->var));
- VariantInit(&(pvar->realvar));
- return obj;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT.array(ary, vt)
- *
- * Returns Ruby object wrapping OLE variant whose variant type is VT_ARRAY.
- * The first argument should be Array object which specifies dimensions
- * and each size of dimensions of OLE array.
- * The second argument specifies variant type of the element of OLE array.
- *
- * The following create 2 dimensions OLE array. The first dimensions size
- * is 3, and the second is 4.
- *
- * ole_ary = WIN32OLE_VARIANT.array([3,4], VT_I4)
- * ruby_ary = ole_ary.value # => [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
- *
- */
-static VALUE
-folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
-{
- VALUE obj = Qnil;
- VARTYPE vt;
- struct olevariantdata *pvar;
- SAFEARRAYBOUND *psab = NULL;
- SAFEARRAY *psa = NULL;
- UINT dim = 0;
- UINT i = 0;
-
- ole_initialize();
-
- vt = NUM2UINT(vvt);
- vt = (vt | VT_ARRAY);
- Check_Type(elems, T_ARRAY);
- obj = folevariant_s_allocate(klass);
-
- TypedData_Get_Struct(obj, struct olevariantdata, &olevariant_datatype, pvar);
- dim = RARRAY_LEN(elems);
-
- psab = ALLOC_N(SAFEARRAYBOUND, dim);
-
- if(!psab) {
- rb_raise(rb_eRuntimeError, "memory allocation error");
- }
-
- for (i = 0; i < dim; i++) {
- psab[i].cElements = FIX2INT(rb_ary_entry(elems, i));
- psab[i].lLbound = 0;
- }
-
- psa = SafeArrayCreate((VARTYPE)(vt & VT_TYPEMASK), dim, psab);
- if (psa == NULL) {
- if (psab) free(psab);
- rb_raise(rb_eRuntimeError, "memory allocation error(SafeArrayCreate)");
- }
-
- V_VT(&(pvar->var)) = vt;
- if (vt & VT_BYREF) {
- V_VT(&(pvar->realvar)) = (vt & ~VT_BYREF);
- V_ARRAY(&(pvar->realvar)) = psa;
- V_ARRAYREF(&(pvar->var)) = &(V_ARRAY(&(pvar->realvar)));
- } else {
- V_ARRAY(&(pvar->var)) = psa;
- }
- if (psab) free(psab);
- return obj;
-}
-
-static void
-check_type_val2variant(VALUE val)
-{
- VALUE elem;
- int len = 0;
- int i = 0;
- if(!rb_obj_is_kind_of(val, cWIN32OLE) &&
- !rb_obj_is_kind_of(val, cWIN32OLE_VARIANT) &&
- !rb_obj_is_kind_of(val, rb_cTime)) {
- switch (TYPE(val)) {
- case T_ARRAY:
- len = RARRAY_LEN(val);
- for(i = 0; i < len; i++) {
- elem = rb_ary_entry(val, i);
- check_type_val2variant(elem);
- }
- break;
- case T_STRING:
- case T_FIXNUM:
- case T_BIGNUM:
- case T_FLOAT:
- case T_TRUE:
- case T_FALSE:
- case T_NIL:
- break;
- default:
- rb_raise(rb_eTypeError, "can not convert WIN32OLE_VARIANT from type %s",
- rb_obj_classname(val));
- }
- }
-}
-
-/*
- * Document-class: WIN32OLE_VARIANT
- *
- * <code>WIN32OLE_VARIANT</code> objects represents OLE variant.
- *
- * Win32OLE converts Ruby object into OLE variant automatically when
- * invoking OLE methods. If OLE method requires the argument which is
- * different from the variant by automatic conversion of Win32OLE, you
- * can convert the specfied variant type by using WIN32OLE_VARIANT class.
- *
- * param = WIN32OLE_VARIANT.new(10, WIN32OLE::VARIANT::VT_R4)
- * oleobj.method(param)
- *
- * WIN32OLE_VARIANT does not support VT_RECORD variant. Use WIN32OLE_RECORD
- * class instead of WIN32OLE_VARIANT if the VT_RECORD variant is needed.
- */
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT.new(val, vartype) #=> WIN32OLE_VARIANT object.
- *
- * Returns Ruby object wrapping OLE variant.
- * The first argument specifies Ruby object to convert OLE variant variable.
- * The second argument specifies VARIANT type.
- * In some situation, you need the WIN32OLE_VARIANT object to pass OLE method
- *
- * shell = WIN32OLE.new("Shell.Application")
- * folder = shell.NameSpace("C:\\Windows")
- * item = folder.ParseName("tmp.txt")
- * # You can't use Ruby String object to call FolderItem.InvokeVerb.
- * # Instead, you have to use WIN32OLE_VARIANT object to call the method.
- * shortcut = WIN32OLE_VARIANT.new("Create Shortcut(\&S)")
- * item.invokeVerb(shortcut)
- *
- */
-static VALUE
-folevariant_initialize(VALUE self, VALUE args)
-{
- int len = 0;
- VARIANT var;
- VALUE val;
- VALUE vvt;
- VARTYPE vt;
- struct olevariantdata *pvar;
-
- len = RARRAY_LEN(args);
- rb_check_arity(len, 1, 3);
- VariantInit(&var);
- val = rb_ary_entry(args, 0);
-
- check_type_val2variant(val);
-
- TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
- if (len == 1) {
- ole_val2variant(val, &(pvar->var));
- } else {
- vvt = rb_ary_entry(args, 1);
- vt = NUM2INT(vvt);
- if ((vt & VT_TYPEMASK) == VT_RECORD) {
- rb_raise(rb_eArgError, "not supported VT_RECORD WIN32OLE_VARIANT object");
- }
- ole_val2olevariantdata(val, vt, pvar);
- }
- return self;
-}
-
-static SAFEARRAY *
-get_locked_safe_array(VALUE val)
-{
- struct olevariantdata *pvar;
- SAFEARRAY *psa = NULL;
- HRESULT hr;
- TypedData_Get_Struct(val, struct olevariantdata, &olevariant_datatype, pvar);
- if (!(V_VT(&(pvar->var)) & VT_ARRAY)) {
- rb_raise(rb_eTypeError, "variant type is not VT_ARRAY.");
- }
- psa = V_ISBYREF(&(pvar->var)) ? *V_ARRAYREF(&(pvar->var)) : V_ARRAY(&(pvar->var));
- if (psa == NULL) {
- return psa;
- }
- hr = SafeArrayLock(psa);
- if (FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to SafeArrayLock");
- }
- return psa;
-}
-
-static LONG *
-ary2safe_array_index(int ary_size, VALUE *ary, SAFEARRAY *psa)
-{
- long dim;
- LONG *pid;
- long i;
- dim = SafeArrayGetDim(psa);
- if (dim != ary_size) {
- rb_raise(rb_eArgError, "unmatch number of indices");
- }
- pid = ALLOC_N(LONG, dim);
- if (pid == NULL) {
- rb_raise(rb_eRuntimeError, "failed to allocate memory for indices");
- }
- for (i = 0; i < dim; i++) {
- pid[i] = NUM2INT(ary[i]);
- }
- return pid;
-}
-
-static void
-unlock_safe_array(SAFEARRAY *psa)
-{
- HRESULT hr;
- hr = SafeArrayUnlock(psa);
- if (FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to SafeArrayUnlock");
- }
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT[i,j,...] #=> element of OLE array.
- *
- * Returns the element of WIN32OLE_VARIANT object(OLE array).
- * This method is available only when the variant type of
- * WIN32OLE_VARIANT object is VT_ARRAY.
- *
- * REMARK:
- * The all indices should be 0 or natural number and
- * lower than or equal to max indices.
- * (This point is different with Ruby Array indices.)
- *
- * obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]])
- * p obj[0,0] # => 1
- * p obj[1,0] # => 4
- * p obj[2,0] # => WIN32OLERuntimeError
- * p obj[0, -1] # => WIN32OLERuntimeError
- *
- */
-static VALUE
-folevariant_ary_aref(int argc, VALUE *argv, VALUE self)
-{
- struct olevariantdata *pvar;
- SAFEARRAY *psa;
- VALUE val = Qnil;
- VARIANT variant;
- LONG *pid;
- HRESULT hr;
-
- TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
- if (!V_ISARRAY(&(pvar->var))) {
- rb_raise(eWIN32OLERuntimeError,
- "`[]' is not available for this variant type object");
- }
- psa = get_locked_safe_array(self);
- if (psa == NULL) {
- return val;
- }
-
- pid = ary2safe_array_index(argc, argv, psa);
-
- VariantInit(&variant);
- V_VT(&variant) = (V_VT(&(pvar->var)) & ~VT_ARRAY) | VT_BYREF;
- hr = SafeArrayPtrOfIndex(psa, pid, &V_BYREF(&variant));
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to SafeArrayPtrOfIndex");
- }
- val = ole_variant2val(&variant);
-
- unlock_safe_array(psa);
- if (pid) free(pid);
- return val;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT[i,j,...] = val #=> set the element of OLE array
- *
- * Set the element of WIN32OLE_VARIANT object(OLE array) to val.
- * This method is available only when the variant type of
- * WIN32OLE_VARIANT object is VT_ARRAY.
- *
- * REMARK:
- * The all indices should be 0 or natural number and
- * lower than or equal to max indices.
- * (This point is different with Ruby Array indices.)
- *
- * obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]])
- * obj[0,0] = 7
- * obj[1,0] = 8
- * p obj.value # => [[7,2,3], [8,5,6]]
- * obj[2,0] = 9 # => WIN32OLERuntimeError
- * obj[0, -1] = 9 # => WIN32OLERuntimeError
- *
- */
-static VALUE
-folevariant_ary_aset(int argc, VALUE *argv, VALUE self)
-{
- struct olevariantdata *pvar;
- SAFEARRAY *psa;
- VARIANT var;
- VARTYPE vt;
- LONG *pid;
- HRESULT hr;
- VOID *p = NULL;
-
- TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
- if (!V_ISARRAY(&(pvar->var))) {
- rb_raise(eWIN32OLERuntimeError,
- "`[]' is not available for this variant type object");
- }
- psa = get_locked_safe_array(self);
- if (psa == NULL) {
- rb_raise(rb_eRuntimeError, "failed to get SafeArray pointer");
- }
-
- pid = ary2safe_array_index(argc-1, argv, psa);
-
- VariantInit(&var);
- vt = (V_VT(&(pvar->var)) & ~VT_ARRAY);
- p = val2variant_ptr(argv[argc-1], &var, vt);
- if ((V_VT(&var) == VT_DISPATCH && V_DISPATCH(&var) == NULL) ||
- (V_VT(&var) == VT_UNKNOWN && V_UNKNOWN(&var) == NULL)) {
- rb_raise(eWIN32OLERuntimeError, "argument does not have IDispatch or IUnknown Interface");
- }
- hr = SafeArrayPutElement(psa, pid, p);
- if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLERuntimeError, "failed to SafeArrayPutElement");
- }
-
- unlock_safe_array(psa);
- if (pid) free(pid);
- return argv[argc-1];
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT.value #=> Ruby object.
- *
- * Returns Ruby object value from OLE variant.
- * obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR)
- * obj.value # => "1" (not Fixnum object, but String object "1")
- *
- */
-static VALUE
-folevariant_value(VALUE self)
-{
- struct olevariantdata *pvar;
- VALUE val = Qnil;
- VARTYPE vt;
- int dim;
- SAFEARRAY *psa;
- TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
-
- val = ole_variant2val(&(pvar->var));
- vt = V_VT(&(pvar->var));
-
- if ((vt & ~VT_BYREF) == (VT_UI1|VT_ARRAY)) {
- if (vt & VT_BYREF) {
- psa = *V_ARRAYREF(&(pvar->var));
- } else {
- psa = V_ARRAY(&(pvar->var));
- }
- if (!psa) {
- return val;
- }
- dim = SafeArrayGetDim(psa);
- if (dim == 1) {
- val = rb_funcall(val, rb_intern("pack"), 1, rb_str_new2("C*"));
- }
- }
- return val;
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT.vartype #=> OLE variant type.
- *
- * Returns OLE variant type.
- * obj = WIN32OLE_VARIANT.new("string")
- * obj.vartype # => WIN32OLE::VARIANT::VT_BSTR
- *
- */
-static VALUE
-folevariant_vartype(VALUE self)
-{
- struct olevariantdata *pvar;
- TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
- return INT2FIX(V_VT(&pvar->var));
-}
-
-/*
- * call-seq:
- * WIN32OLE_VARIANT.value = val #=> set WIN32OLE_VARIANT value to val.
- *
- * Sets variant value to val. If the val type does not match variant value
- * type(vartype), then val is changed to match variant value type(vartype)
- * before setting val.
- * Thie method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY).
- * If the vartype is VT_UI1|VT_ARRAY, the val should be String object.
- *
- * obj = WIN32OLE_VARIANT.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4
- * obj.value = 3.2 # 3.2 is changed to 3 when setting value.
- * p obj.value # => 3
- */
-static VALUE
-folevariant_set_value(VALUE self, VALUE val)
-{
- struct olevariantdata *pvar;
- VARTYPE vt;
- TypedData_Get_Struct(self, struct olevariantdata, &olevariant_datatype, pvar);
- vt = V_VT(&(pvar->var));
- if (V_ISARRAY(&(pvar->var)) && ((vt & ~VT_BYREF) != (VT_UI1|VT_ARRAY) || !RB_TYPE_P(val, T_STRING))) {
- rb_raise(eWIN32OLERuntimeError,
- "`value=' is not available for this variant type object");
- }
- ole_val2olevariantdata(val, vt, pvar);
- return Qnil;
-}
-
-void
-ole_variant2variant(VALUE val, VARIANT *var)
-{
- struct olevariantdata *pvar;
- TypedData_Get_Struct(val, struct olevariantdata, &olevariant_datatype, pvar);
- VariantCopy(var, &(pvar->var));
-}
-
-void
-Init_win32ole_variant(void)
-{
- cWIN32OLE_VARIANT = rb_define_class("WIN32OLE_VARIANT", rb_cObject);
- rb_define_alloc_func(cWIN32OLE_VARIANT, folevariant_s_allocate);
- rb_define_singleton_method(cWIN32OLE_VARIANT, "array", folevariant_s_array, 2);
- rb_define_method(cWIN32OLE_VARIANT, "initialize", folevariant_initialize, -2);
- rb_define_method(cWIN32OLE_VARIANT, "value", folevariant_value, 0);
- rb_define_method(cWIN32OLE_VARIANT, "value=", folevariant_set_value, 1);
- rb_define_method(cWIN32OLE_VARIANT, "vartype", folevariant_vartype, 0);
- rb_define_method(cWIN32OLE_VARIANT, "[]", folevariant_ary_aref, -1);
- rb_define_method(cWIN32OLE_VARIANT, "[]=", folevariant_ary_aset, -1);
-
- /*
- * represents VT_EMPTY OLE object.
- */
- rb_define_const(cWIN32OLE_VARIANT, "Empty",
- rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_EMPTY)));
-
- /*
- * represents VT_NULL OLE object.
- */
- rb_define_const(cWIN32OLE_VARIANT, "Null",
- rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_NULL)));
-
- /*
- * represents Nothing of VB.NET or VB.
- */
- rb_define_const(cWIN32OLE_VARIANT, "Nothing",
- rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, Qnil, INT2FIX(VT_DISPATCH)));
-
- /*
- * represents VT_ERROR variant with DISP_E_PARAMNOTFOUND.
- * This constants is used for not specified parameter.
- *
- * fso = WIN32OLE.new("Scripting.FileSystemObject")
- * fso.openTextFile(filename, WIN32OLE_VARIANT::NoParam, false)
- */
- rb_define_const(cWIN32OLE_VARIANT, "NoParam",
- rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, INT2NUM(DISP_E_PARAMNOTFOUND), INT2FIX(VT_ERROR)));
-}
diff --git a/ext/win32ole/win32ole_variant.h b/ext/win32ole/win32ole_variant.h
deleted file mode 100644
index efe7ea8bef..0000000000
--- a/ext/win32ole/win32ole_variant.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef WIN32OLE_VARIANT_H
-#define WIN32OLE_VARIANT_H 1
-
-VALUE cWIN32OLE_VARIANT;
-void ole_variant2variant(VALUE val, VARIANT *var);
-void Init_win32ole_variant(void);
-
-#endif
-
diff --git a/ext/win32ole/win32ole_variant_m.c b/ext/win32ole/win32ole_variant_m.c
deleted file mode 100644
index eb3b0b11bb..0000000000
--- a/ext/win32ole/win32ole_variant_m.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include "win32ole.h"
-
-void Init_win32ole_variant_m(void)
-{
- /*
- * Document-module: WIN32OLE::VARIANT
- *
- * The WIN32OLE::VARIANT module includes constants of VARIANT type constants.
- * The constants is used when creating WIN32OLE_VARIANT object.
- *
- * obj = WIN32OLE_VARIANT.new("2e3", WIN32OLE::VARIANT::VT_R4)
- * obj.value # => 2000.0
- *
- */
- mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VARIANT");
-
- /*
- * represents VT_EMPTY type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_EMPTY", INT2FIX(VT_EMPTY));
-
- /*
- * represents VT_NULL type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_NULL", INT2FIX(VT_NULL));
-
- /*
- * represents VT_I2 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_I2", INT2FIX(VT_I2));
-
- /*
- * represents VT_I4 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_I4", INT2FIX(VT_I4));
-
- /*
- * represents VT_R4 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_R4", INT2FIX(VT_R4));
-
- /*
- * represents VT_R8 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_R8", INT2FIX(VT_R8));
-
- /*
- * represents VT_CY type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_CY", INT2FIX(VT_CY));
-
- /*
- * represents VT_DATE type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_DATE", INT2FIX(VT_DATE));
-
- /*
- * represents VT_BSTR type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_BSTR", INT2FIX(VT_BSTR));
-
- /*
- * represents VT_USERDEFINED type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_USERDEFINED", INT2FIX(VT_USERDEFINED));
-
- /*
- * represents VT_PTR type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_PTR", INT2FIX(VT_PTR));
-
- /*
- * represents VT_DISPATCH type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_DISPATCH", INT2FIX(VT_DISPATCH));
-
- /*
- * represents VT_ERROR type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_ERROR", INT2FIX(VT_ERROR));
-
- /*
- * represents VT_BOOL type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_BOOL", INT2FIX(VT_BOOL));
-
- /*
- * represents VT_VARIANT type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_VARIANT", INT2FIX(VT_VARIANT));
-
- /*
- * represents VT_UNKNOWN type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_UNKNOWN", INT2FIX(VT_UNKNOWN));
-
- /*
- * represents VT_I1 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_I1", INT2FIX(VT_I1));
-
- /*
- * represents VT_UI1 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_UI1", INT2FIX(VT_UI1));
-
- /*
- * represents VT_UI2 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_UI2", INT2FIX(VT_UI2));
-
- /*
- * represents VT_UI4 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_UI4", INT2FIX(VT_UI4));
-
-#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
- /*
- * represents VT_I8 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_I8", INT2FIX(VT_I8));
-
- /*
- * represents VT_UI8 type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_UI8", INT2FIX(VT_UI8));
-#endif
-
- /*
- * represents VT_INT type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_INT", INT2FIX(VT_INT));
-
- /*
- * represents VT_UINT type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_UINT", INT2FIX(VT_UINT));
-
- /*
- * represents VT_ARRAY type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_ARRAY", INT2FIX(VT_ARRAY));
-
- /*
- * represents VT_BYREF type constant.
- */
- rb_define_const(mWIN32OLE_VARIANT, "VT_BYREF", INT2FIX(VT_BYREF));
-
-}
diff --git a/ext/win32ole/win32ole_variant_m.h b/ext/win32ole/win32ole_variant_m.h
deleted file mode 100644
index afbef30218..0000000000
--- a/ext/win32ole/win32ole_variant_m.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef WIN32OLE_VARIANT_M_H
-#define WIN32OLE_VARIANT_M_H 1
-
-VALUE mWIN32OLE_VARIANT;
-void Init_win32ole_variant_m(void);
-
-#endif
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb
index 8bbede63b2..b4348ceca7 100644
--- a/ext/zlib/extconf.rb
+++ b/ext/zlib/extconf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# extconf.rb
#
@@ -21,6 +20,8 @@ if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')
case RUBY_PLATFORM.split('-',2)[1]
when 'amigaos' then
os_code = 'AMIGA'
+ when /\Aos2[\-_]emx\z/ then
+ os_code = 'OS2'
when /mswin|mingw|bccwin/ then
# NOTE: cygwin should be regarded as Unix.
os_code = 'WIN32'
@@ -35,6 +36,7 @@ if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')
'OS_VMS' => 'VMS',
'OS_UNIX' => 'Unix',
'OS_ATARI' => 'Atari',
+ 'OS_OS2' => 'OS/2',
'OS_MACOS' => 'MacOS',
'OS_TOPS20' => 'TOPS20',
'OS_WIN32' => 'Win32',
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index c7604211bb..df2a2501b2 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -27,6 +27,9 @@
#define RUBY_ZLIB_VERSION "0.6.0"
+
+#define OBJ_IS_FREED(val) (RBASIC(val)->flags == 0)
+
#ifndef GZIP_SUPPORT
#define GZIP_SUPPORT 1
#endif
@@ -88,8 +91,8 @@ static void zstream_reset(struct zstream*);
static VALUE zstream_end(struct zstream*);
static void zstream_run(struct zstream*, Bytef*, long, int);
static VALUE zstream_sync(struct zstream*, Bytef*, long);
-static void zstream_mark(void*);
-static void zstream_free(void*);
+static void zstream_mark(struct zstream*);
+static void zstream_free(struct zstream*);
static VALUE zstream_new(VALUE, const struct zstream_funcs*);
static struct zstream *get_zstream(VALUE);
static void zstream_finalize(struct zstream*);
@@ -134,8 +137,8 @@ static VALUE rb_inflate_set_dictionary(VALUE, VALUE);
#if GZIP_SUPPORT
struct gzfile;
-static void gzfile_mark(void*);
-static void gzfile_free(void*);
+static void gzfile_mark(struct gzfile*);
+static void gzfile_free(struct gzfile*);
static VALUE gzfile_new(VALUE, const struct zstream_funcs*, void (*) _((struct gzfile*)));
static void gzfile_reset(struct gzfile*);
static void gzfile_close(struct gzfile*, int);
@@ -334,8 +337,11 @@ raise_zlib_error(int err, const char *msg)
rb_sys_fail(msg);
/* no return */
default:
- exc = rb_exc_new_str(cZError,
- rb_sprintf("unknown zlib error %d: %s", err, msg));
+ {
+ char buf[BUFSIZ];
+ snprintf(buf, BUFSIZ, "unknown zlib error %d: %s", err, msg);
+ exc = rb_exc_new2(cZError, buf);
+ }
}
rb_exc_raise(exc);
@@ -387,7 +393,10 @@ checksum_long(uLong (*func)(uLong, const Bytef*, uInt), uLong sum, const Bytef *
#endif
static VALUE
-do_checksum(int argc, VALUE *argv, uLong (*func)(uLong, const Bytef*, uInt))
+do_checksum(argc, argv, func)
+ int argc;
+ VALUE *argv;
+ uLong (*func)(uLong, const Bytef*, uInt);
{
VALUE str, vsum;
unsigned long sum;
@@ -423,14 +432,7 @@ do_checksum(int argc, VALUE *argv, uLong (*func)(uLong, const Bytef*, uInt))
* +adler+. If +string+ is omitted, it returns the Adler-32 initial value. If
* +adler+ is omitted, it assumes that the initial value is given to +adler+.
*
- * Example usage:
- *
- * require "zlib"
- *
- * data = "foo"
- * puts "Adler32 checksum: #{Zlib.adler32(data).to_s(16)}"
- * #=> Adler32 checksum: 2820145
- *
+ * FIXME: expression.
*/
static VALUE
rb_zlib_adler32(int argc, VALUE *argv, VALUE klass)
@@ -462,7 +464,7 @@ rb_zlib_adler32_combine(VALUE klass, VALUE adler1, VALUE adler2, VALUE len2)
/*
* Document-method: Zlib.crc32
*
- * call-seq: Zlib.crc32(string, crc)
+ * call-seq: Zlib.crc32(string, adler)
*
* Calculates CRC checksum for +string+, and returns updated value of +crc+. If
* +string+ is omitted, it returns the CRC initial value. If +crc+ is omitted, it
@@ -581,7 +583,7 @@ struct zstream_run_args {
static voidpf
zlib_mem_alloc(voidpf opaque, uInt items, uInt size)
{
- voidpf p = xmalloc2(items, size);
+ voidpf p = xmalloc(items * size);
/* zlib FAQ: Valgrind (or some similar memory access checker) says that
deflate is performing a conditional jump that depends on an
uninitialized value. Isn't that a bug?
@@ -808,7 +810,8 @@ zstream_shift_buffer(struct zstream *z, long len)
return zstream_detach_buffer(z);
}
- dst = rb_str_new(RSTRING_PTR(z->buf), len);
+ dst = rb_str_subseq(z->buf, 0, len);
+ rb_obj_reveal(dst, rb_cString);
z->buf_filled -= len;
memmove(RSTRING_PTR(z->buf), RSTRING_PTR(z->buf) + len,
z->buf_filled);
@@ -998,8 +1001,7 @@ zstream_run_func(void *ptr)
if (args->stream_output) {
state = (int)(VALUE)rb_thread_call_with_gvl(zstream_expand_buffer_protect,
(void *)z);
- }
- else {
+ } else {
state = zstream_expand_buffer_without_gvl(z);
}
@@ -1029,7 +1031,7 @@ zstream_run(struct zstream *z, Bytef *src, long len, int flush)
{
struct zstream_run_args args;
int err;
- VALUE guard = Qnil;
+ volatile VALUE guard = Qnil;
args.z = z;
args.flush = flush;
@@ -1086,7 +1088,7 @@ loop:
if (z->stream.avail_in > 0) {
zstream_append_input(z, z->stream.next_in, z->stream.avail_in);
- RB_GC_GUARD(guard); /* prevent tail call to make guard effective */
+ RB_GC_GUARD(guard) = Qnil; /* prevent tail call to make guard effective */
}
if (args.jump_state)
@@ -1133,9 +1135,8 @@ zstream_sync(struct zstream *z, Bytef *src, long len)
}
static void
-zstream_mark(void *p)
+zstream_mark(struct zstream *z)
{
- struct zstream *z = p;
rb_gc_mark(z->buf);
rb_gc_mark(z->input);
}
@@ -1151,36 +1152,22 @@ zstream_finalize(struct zstream *z)
}
static void
-zstream_free(void *p)
+zstream_free(struct zstream *z)
{
- struct zstream *z = p;
-
if (ZSTREAM_IS_READY(z)) {
zstream_finalize(z);
}
xfree(z);
}
-static size_t
-zstream_memsize(const void *p)
-{
- /* n.b. this does not track memory managed via zalloc/zfree callbacks */
- return sizeof(struct zstream);
-}
-
-static const rb_data_type_t zstream_data_type = {
- "zstream",
- { zstream_mark, zstream_free, zstream_memsize, },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
static VALUE
zstream_new(VALUE klass, const struct zstream_funcs *funcs)
{
VALUE obj;
struct zstream *z;
- obj = TypedData_Make_Struct(klass, struct zstream, &zstream_data_type, z);
+ obj = Data_Make_Struct(klass, struct zstream,
+ zstream_mark, zstream_free, z);
zstream_init(z, funcs);
z->stream.opaque = (voidpf)obj;
return obj;
@@ -1194,7 +1181,7 @@ get_zstream(VALUE obj)
{
struct zstream *z;
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
if (!ZSTREAM_IS_READY(z)) {
rb_raise(cZError, "stream is not ready");
}
@@ -1317,7 +1304,7 @@ rb_zstream_flush_next_in(VALUE obj)
struct zstream *z;
VALUE dst;
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
dst = zstream_detach_input(z);
OBJ_INFECT(dst, obj);
return dst;
@@ -1337,7 +1324,7 @@ rb_zstream_flush_next_out(VALUE obj)
{
struct zstream *z;
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
return zstream_detach_buffer(z);
}
@@ -1350,7 +1337,7 @@ static VALUE
rb_zstream_avail_out(VALUE obj)
{
struct zstream *z;
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
return rb_uint2inum(z->stream.avail_out);
}
@@ -1377,7 +1364,7 @@ static VALUE
rb_zstream_avail_in(VALUE obj)
{
struct zstream *z;
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
return INT2FIX(NIL_P(z->input) ? 0 : (int)(RSTRING_LEN(z->input)));
}
@@ -1435,7 +1422,7 @@ static VALUE
rb_zstream_closed_p(VALUE obj)
{
struct zstream *z;
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
return ZSTREAM_IS_READY(z) ? Qfalse : Qtrue;
}
@@ -1476,15 +1463,13 @@ rb_deflate_s_allocate(VALUE klass)
* the default value of that argument is used.
*
* The +level+ sets the compression level for the deflate stream between 0 (no
- * compression) and 9 (best compression). The following constants have been
+ * compression) and 9 (best compression. The following constants have been
* defined to make code more readable:
*
- * * Zlib::DEFAULT_COMPRESSION
- * * Zlib::NO_COMPRESSION
- * * Zlib::BEST_SPEED
- * * Zlib::BEST_COMPRESSION
- *
- * See http://www.zlib.net/manual.html#Constants for further information.
+ * * Zlib::NO_COMPRESSION = 0
+ * * Zlib::BEST_SPEED = 1
+ * * Zlib::DEFAULT_COMPRESSION = 6
+ * * Zlib::BEST_COMPRESSION = 9
*
* The +window_bits+ sets the size of the history buffer and should be between
* 8 and 15. Larger values of this parameter result in better compression at
@@ -1547,7 +1532,7 @@ rb_deflate_initialize(int argc, VALUE *argv, VALUE obj)
int err;
rb_scan_args(argc, argv, "04", &level, &wbits, &memlevel, &strategy);
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
err = deflateInit2(&z->stream, ARG_LEVEL(level), Z_DEFLATED,
ARG_WBITS(wbits), ARG_MEMLEVEL(memlevel),
@@ -1571,10 +1556,9 @@ rb_deflate_init_copy(VALUE self, VALUE orig)
struct zstream *z1, *z2;
int err;
- TypedData_Get_Struct(self, struct zstream, &zstream_data_type, z1);
+ Data_Get_Struct(self, struct zstream, z1);
z2 = get_zstream(orig);
- if (z1 == z2) return self;
err = deflateCopy(&z1->stream, &z2->stream);
if (err != Z_OK) {
raise_zlib_error(err, 0);
@@ -1606,7 +1590,7 @@ deflate_run(VALUE args)
*
* Compresses the given +string+. Valid values of level are
* Zlib::NO_COMPRESSION, Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION,
- * Zlib::DEFAULT_COMPRESSION, or an integer from 0 to 9.
+ * Zlib::DEFAULT_COMPRESSION, or an integer from 0 to 9 (the default is 6).
*
* This method is almost equivalent to the following code:
*
@@ -1850,7 +1834,7 @@ rb_inflate_s_allocate(VALUE klass)
* Have inflate use the window size from the zlib header of the compressed
* stream.
*
- * (8..15)::
+ * (8..15)
* Overrides the window size of the inflate header in the compressed stream.
* The window size must be greater than or equal to the window size of the
* compressed stream.
@@ -1890,7 +1874,7 @@ rb_inflate_initialize(int argc, VALUE *argv, VALUE obj)
int err;
rb_scan_args(argc, argv, "01", &wbits);
- TypedData_Get_Struct(obj, struct zstream, &zstream_data_type, z);
+ Data_Get_Struct(obj, struct zstream, z);
err = inflateInit2(&z->stream, ARG_WBITS(wbits));
if (err != Z_OK) {
@@ -1981,8 +1965,7 @@ do_inflate(struct zstream *z, VALUE src)
* stream's required dictionary.
*/
static VALUE
-rb_inflate_add_dictionary(VALUE obj, VALUE dictionary)
-{
+rb_inflate_add_dictionary(VALUE obj, VALUE dictionary) {
VALUE dictionaries = rb_ivar_get(obj, id_dictionaries);
VALUE checksum = do_checksum(1, &dictionary, adler32);
@@ -2211,18 +2194,18 @@ struct gzfile {
struct zstream z;
VALUE io;
int level;
- int os_code; /* for header */
time_t mtime; /* for header */
+ int os_code; /* for header */
VALUE orig_name; /* for header; must be a String */
VALUE comment; /* for header; must be a String */
unsigned long crc;
- int ecflags;
int lineno;
long ungetc;
void (*end)(struct gzfile *);
rb_encoding *enc;
rb_encoding *enc2;
rb_econv_t *ec;
+ int ecflags;
VALUE ecopts;
char *cbuf;
VALUE path;
@@ -2240,10 +2223,8 @@ struct gzfile {
static void
-gzfile_mark(void *p)
+gzfile_mark(struct gzfile *gz)
{
- struct gzfile *gz = p;
-
rb_gc_mark(gz->io);
rb_gc_mark(gz->orig_name);
rb_gc_mark(gz->comment);
@@ -2253,9 +2234,8 @@ gzfile_mark(void *p)
}
static void
-gzfile_free(void *p)
+gzfile_free(struct gzfile *gz)
{
- struct gzfile *gz = p;
struct zstream *z = &gz->z;
if (ZSTREAM_IS_READY(z)) {
@@ -2270,24 +2250,6 @@ gzfile_free(void *p)
xfree(gz);
}
-static size_t
-gzfile_memsize(const void *p)
-{
- const struct gzfile *gz = p;
- size_t size = sizeof(struct gzfile);
-
- if (gz->cbuf)
- size += GZFILE_CBUF_CAPA;
-
- return size;
-}
-
-static const rb_data_type_t gzfile_data_type = {
- "gzfile",
- { gzfile_mark, gzfile_free, gzfile_memsize, },
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
-};
-
static VALUE
gzfile_new(klass, funcs, endfunc)
VALUE klass;
@@ -2297,7 +2259,7 @@ gzfile_new(klass, funcs, endfunc)
VALUE obj;
struct gzfile *gz;
- obj = TypedData_Make_Struct(klass, struct gzfile, &gzfile_data_type, gz);
+ obj = Data_Make_Struct(klass, struct gzfile, gzfile_mark, gzfile_free, gz);
zstream_init(&gz->z, funcs);
gz->z.flags |= ZSTREAM_FLAG_GZFILE;
gz->io = Qnil;
@@ -2328,7 +2290,6 @@ static void
gzfile_reset(struct gzfile *gz)
{
zstream_reset(&gz->z);
- gz->z.flags |= ZSTREAM_FLAG_GZFILE;
gz->crc = crc32(0, Z_NULL, 0);
gz->lineno = 0;
gz->ungetc = 0;
@@ -2672,7 +2633,7 @@ gzfile_write(struct gzfile *gz, Bytef *str, long len)
static long
gzfile_read_more(struct gzfile *gz)
{
- VALUE str;
+ volatile VALUE str;
while (!ZSTREAM_IS_FINISHED(&gz->z)) {
str = gzfile_read_raw(gz);
@@ -2685,7 +2646,6 @@ gzfile_read_more(struct gzfile *gz)
if (RSTRING_LEN(str) > 0) { /* prevent Z_BUF_ERROR */
zstream_run(&gz->z, (Bytef*)RSTRING_PTR(str), RSTRING_LEN(str),
Z_SYNC_FLUSH);
- RB_GC_GUARD(str);
}
if (gz->z.buf_filled > 0) break;
}
@@ -2792,7 +2752,6 @@ gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf)
if (!NIL_P(outbuf)) {
rb_str_resize(outbuf, RSTRING_LEN(dst));
memcpy(RSTRING_PTR(outbuf), RSTRING_PTR(dst), RSTRING_LEN(dst));
- RB_GC_GUARD(dst);
dst = outbuf;
}
OBJ_TAINT(dst); /* for safe */
@@ -2964,7 +2923,7 @@ get_gzfile(VALUE obj)
{
struct gzfile *gz;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
if (!ZSTREAM_IS_READY(&gz->z)) {
rb_raise(cGzError, "closed gzip stream");
}
@@ -3030,7 +2989,7 @@ gzfile_ensure_close(VALUE obj)
{
struct gzfile *gz;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
if (ZSTREAM_IS_READY(&gz->z)) {
gzfile_close(gz, 1);
}
@@ -3097,7 +3056,9 @@ gzfile_s_open(int argc, VALUE *argv, VALUE klass, const char *mode)
{
VALUE io, filename;
- rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
+ if (argc < 1) {
+ rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
+ }
filename = argv[0];
io = rb_file_open_str(filename, mode);
argv[0] = io;
@@ -3296,13 +3257,9 @@ rb_gzfile_set_comment(VALUE obj, VALUE str)
static VALUE
rb_gzfile_close(VALUE obj)
{
- struct gzfile *gz;
+ struct gzfile *gz = get_gzfile(obj);
VALUE io;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
- if (!ZSTREAM_IS_READY(&gz->z)) {
- return Qnil;
- }
io = gz->io;
gzfile_close(gz, 1);
return io;
@@ -3336,7 +3293,7 @@ static VALUE
rb_gzfile_closed_p(VALUE obj)
{
struct gzfile *gz;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
return NIL_P(gz->io) ? Qtrue : Qfalse;
}
@@ -3407,14 +3364,7 @@ static VALUE
rb_gzfile_total_out(VALUE obj)
{
struct gzfile *gz = get_gzfile(obj);
- uLong total_out = gz->z.stream.total_out;
- long buf_filled = gz->z.buf_filled;
-
- if (total_out >= (uLong)buf_filled) {
- return rb_uint2inum(total_out - buf_filled);
- } else {
- return LONG2FIX(-(buf_filled - (long)total_out));
- }
+ return rb_uint2inum(gz->z.stream.total_out - gz->z.buf_filled);
}
/*
@@ -3429,7 +3379,7 @@ static VALUE
rb_gzfile_path(VALUE obj)
{
struct gzfile *gz;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
return gz->path;
}
@@ -3527,7 +3477,7 @@ rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj)
}
rb_scan_args(argc, argv, "12", &io, &level, &strategy);
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
/* this is undocumented feature of zlib */
gz->level = ARG_LEVEL(level);
@@ -3590,7 +3540,6 @@ rb_gzwriter_write(VALUE obj, VALUE str)
str = rb_str_conv_enc(str, rb_enc_get(str), gz->enc2);
}
gzfile_write(gz, (Bytef*)RSTRING_PTR(str), RSTRING_LEN(str));
- RB_GC_GUARD(str);
return INT2FIX(RSTRING_LEN(str));
}
@@ -3637,7 +3586,7 @@ rb_gzwriter_putc(VALUE obj, VALUE ch)
* Document-class: Zlib::GzipReader
*
* Zlib::GzipReader is the class for reading a gzipped file. GzipReader should
- * be used as an IO, or -IO-like, object.
+ * be used an IO, or -IO-like, object.
*
* Zlib::GzipReader.open('hoge.gz') {|gz|
* print gz.read
@@ -3730,7 +3679,7 @@ rb_gzreader_initialize(int argc, VALUE *argv, VALUE obj)
struct gzfile *gz;
int err;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
rb_scan_args(argc, argv, "1:", &io, &opt);
/* this is undocumented feature of zlib */
@@ -3775,7 +3724,7 @@ static VALUE
rb_gzreader_unused(VALUE obj)
{
struct gzfile *gz;
- TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ Data_Get_Struct(obj, struct gzfile, gz);
return gzfile_reader_get_unused(gz);
}
@@ -3964,7 +3913,6 @@ rb_gzreader_ungetc(VALUE obj, VALUE s)
s = rb_str_conv_enc(s, rb_enc_get(s), gz->enc2);
}
gzfile_ungets(gz, (const Bytef*)RSTRING_PTR(s), RSTRING_LEN(s));
- RB_GC_GUARD(s);
return Qnil;
}
@@ -4044,7 +3992,7 @@ static VALUE
gzreader_gets(int argc, VALUE *argv, VALUE obj)
{
struct gzfile *gz = get_gzfile(obj);
- VALUE rs;
+ volatile VALUE rs;
VALUE dst;
const char *rsptr;
char *p, *res;
@@ -4107,8 +4055,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
rsptr = "\n\n";
rslen = 2;
rspara = 1;
- }
- else {
+ } else {
rsptr = RSTRING_PTR(rs);
rslen = RSTRING_LEN(rs);
rspara = 0;
@@ -4145,8 +4092,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
n = filled;
if (limit > 0 && filled >= limit) break;
n++;
- }
- else {
+ } else {
n += (long)(res - p);
p = res;
if (rslen == 1 || memcmp(p, rsptr, rslen) == 0) break;
@@ -4163,7 +4109,6 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
if (rspara) {
gzreader_skip_linebreaks(gz);
}
- RB_GC_GUARD(rs);
return gzfile_newstr(gz, dst);
}
@@ -4248,21 +4193,10 @@ rb_gzreader_readlines(int argc, VALUE *argv, VALUE obj)
return dst;
}
-/*
- * Document-method: Zlib::GzipReader#external_encoding
- *
- * See Zlib::GzipReader documentation for a description.
- */
-static VALUE
-rb_gzreader_external_encoding(VALUE self)
-{
- return rb_enc_from_encoding(get_gzfile(self)->enc);
-}
-
#endif /* GZIP_SUPPORT */
void
-Init_zlib(void)
+Init_zlib()
{
VALUE mZlib, cZStream, cDeflate, cInflate;
#if GZIP_SUPPORT
@@ -4367,7 +4301,7 @@ Init_zlib(void)
* pre-compressed data to a deflate stream.
*/
rb_define_const(mZlib, "NO_COMPRESSION", INT2FIX(Z_NO_COMPRESSION));
- /* Fastest compression level, but with the lowest space savings. */
+ /* Fastest compression level, but with with lowest space savings. */
rb_define_const(mZlib, "BEST_SPEED", INT2FIX(Z_BEST_SPEED));
/* Slowest compression level, but with the best space savings. */
rb_define_const(mZlib, "BEST_COMPRESSION", INT2FIX(Z_BEST_COMPRESSION));
@@ -4527,7 +4461,6 @@ Init_zlib(void)
rb_define_method(cGzipReader, "each_line", rb_gzreader_each, -1);
rb_define_method(cGzipReader, "lines", rb_gzreader_lines, -1);
rb_define_method(cGzipReader, "readlines", rb_gzreader_readlines, -1);
- rb_define_method(cGzipReader, "external_encoding", rb_gzreader_external_encoding, 0);
/* The OS code of current host */
rb_define_const(mZlib, "OS_CODE", INT2FIX(OS_CODE));
diff --git a/file.c b/file.c
index c57447a233..b14f42e1f8 100644
--- a/file.c
+++ b/file.c
@@ -23,18 +23,15 @@
#include <CoreFoundation/CFString.h>
#endif
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/util.h"
#include "dln.h"
-#include "encindex.h"
+#include "internal.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
@@ -66,16 +63,13 @@ int flock(int, int);
#include <sys/types.h>
#include <sys/stat.h>
-#if defined(__native_client__)
-# if defined(NACL_NEWLIB)
-# include "nacl/utime.h"
-# include "nacl/stat.h"
-# include "nacl/unistd.h"
-# else
-# undef HAVE_UTIMENSAT
-# endif
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/utime.h"
+# include "nacl/stat.h"
+# include "nacl/unistd.h"
#endif
+
#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
@@ -94,20 +88,15 @@ int flock(int, int);
/* define system APIs */
#ifdef _WIN32
-#include "win32/file.h"
#define STAT(p, s) rb_w32_ustati64((p), (s))
#undef lstat
-#define lstat(p, s) rb_w32_ulstati64((p), (s))
+#define lstat(p, s) rb_w32_ustati64((p), (s))
#undef access
#define access(p, m) rb_w32_uaccess((p), (m))
-#undef truncate
-#define truncate(p, n) rb_w32_utruncate((p), (n))
#undef chmod
#define chmod(p, m) rb_w32_uchmod((p), (m))
#undef chown
#define chown(p, o, g) rb_w32_uchown((p), (o), (g))
-#undef lchown
-#define lchown(p, o, g) rb_w32_ulchown((p), (o), (g))
#undef utime
#define utime(p, t) rb_w32_uutime((p), (t))
#undef link
@@ -116,12 +105,37 @@ int flock(int, int);
#define unlink(p) rb_w32_uunlink(p)
#undef rename
#define rename(f, t) rb_w32_urename((f), (t))
-#undef symlink
-#define symlink(s, l) rb_w32_usymlink((s), (l))
#else
#define STAT(p, s) stat((p), (s))
#endif
+#if defined(__BEOS__) || defined(__HAIKU__) /* should not change ID if -1 */
+static int
+be_chown(const char *path, uid_t owner, gid_t group)
+{
+ if (owner == (uid_t)-1 || group == (gid_t)-1) {
+ struct stat st;
+ if (STAT(path, &st) < 0) return -1;
+ if (owner == (uid_t)-1) owner = st.st_uid;
+ if (group == (gid_t)-1) group = st.st_gid;
+ }
+ return chown(path, owner, group);
+}
+#define chown be_chown
+static int
+be_fchown(int fd, uid_t owner, gid_t group)
+{
+ if (owner == (uid_t)-1 || group == (gid_t)-1) {
+ struct stat st;
+ if (fstat(fd, &st) < 0) return -1;
+ if (owner == (uid_t)-1) owner = st.st_uid;
+ if (group == (gid_t)-1) group = st.st_gid;
+ }
+ return fchown(fd, owner, group);
+}
+#define fchown be_fchown
+#endif /* __BEOS__ || __HAIKU__ */
+
VALUE rb_cFile;
VALUE rb_mFileTest;
VALUE rb_cStat;
@@ -132,17 +146,15 @@ static VALUE
file_path_convert(VALUE name)
{
#ifndef _WIN32 /* non Windows == Unix */
- int fname_encidx = ENCODING_GET(name);
- int fs_encidx;
- if (ENCINDEX_US_ASCII != fname_encidx &&
- ENCINDEX_ASCII != fname_encidx &&
- (fs_encidx = rb_filesystem_encindex()) != fname_encidx &&
- rb_default_internal_encoding() &&
- !rb_enc_str_asciionly_p(name)) {
+ rb_encoding *fname_encoding = rb_enc_from_index(ENCODING_GET(name));
+ rb_encoding *fs_encoding;
+ if (rb_default_internal_encoding() != NULL
+ && rb_usascii_encoding() != fname_encoding
+ && rb_ascii8bit_encoding() != fname_encoding
+ && (fs_encoding = rb_filesystem_encoding()) != fname_encoding
+ && !rb_enc_str_asciionly_p(name)) {
/* Don't call rb_filesystem_encoding() before US-ASCII and ASCII-8BIT */
/* fs_encoding should be ascii compatible */
- rb_encoding *fname_encoding = rb_enc_from_index(fname_encidx);
- rb_encoding *fs_encoding = rb_enc_from_index(fs_encidx);
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
}
#endif
@@ -218,27 +230,26 @@ rb_get_path(VALUE obj)
VALUE
rb_str_encode_ospath(VALUE path)
{
-#if defined _WIN32 || defined __APPLE__
- int encidx = ENCODING_GET(path);
#ifdef _WIN32
- if (encidx == ENCINDEX_ASCII) {
- encidx = rb_filesystem_encindex();
+ rb_encoding *enc = rb_enc_get(path);
+ rb_encoding *utf8 = rb_utf8_encoding();
+ if (enc == rb_ascii8bit_encoding()) {
+ enc = rb_filesystem_encoding();
}
-#endif
- if (encidx != ENCINDEX_UTF_8) {
- rb_encoding *enc = rb_enc_from_index(encidx);
- rb_encoding *utf8 = rb_utf8_encoding();
+ if (enc != utf8) {
path = rb_str_conv_enc(path, enc, utf8);
}
+#elif defined __APPLE__
+ path = rb_str_conv_enc(path, NULL, rb_utf8_encoding());
#endif
return path;
}
#ifdef __APPLE__
-# define NORMALIZE_UTF8PATH 1
static VALUE
-rb_str_append_normalized_ospath(VALUE str, const char *ptr, long len)
+rb_str_normalize_ospath0(const char *ptr, long len)
{
+ VALUE str;
CFIndex buflen = 0;
CFRange all;
CFStringRef s = CFStringCreateWithBytesNoCopy(kCFAllocatorDefault,
@@ -246,15 +257,14 @@ rb_str_append_normalized_ospath(VALUE str, const char *ptr, long len)
kCFStringEncodingUTF8, FALSE,
kCFAllocatorNull);
CFMutableStringRef m = CFStringCreateMutableCopy(kCFAllocatorDefault, len, s);
- long oldlen = RSTRING_LEN(str);
CFStringNormalize(m, kCFStringNormalizationFormC);
all = CFRangeMake(0, CFStringGetLength(m));
CFStringGetBytes(m, all, kCFStringEncodingUTF8, '?', FALSE, NULL, 0, &buflen);
- rb_str_modify_expand(str, buflen);
- CFStringGetBytes(m, all, kCFStringEncodingUTF8, '?', FALSE,
- (UInt8 *)(RSTRING_PTR(str) + oldlen), buflen, &buflen);
- rb_str_set_len(str, oldlen + buflen);
+ str = rb_enc_str_new(0, buflen, rb_utf8_encoding());
+ CFStringGetBytes(m, all, kCFStringEncodingUTF8, '?', FALSE, (UInt8 *)RSTRING_PTR(str),
+ buflen, &buflen);
+ rb_str_set_len(str, buflen);
CFRelease(m);
CFRelease(s);
return str;
@@ -275,19 +285,16 @@ rb_str_normalize_ospath(const char *ptr, long len)
int r = rb_enc_precise_mbclen(p, e, enc);
if (!MBCLEN_CHARFOUND_P(r)) {
/* invalid byte shall not happen but */
- static const char invalid[3] = "\xEF\xBF\xBD";
- rb_str_append_normalized_ospath(str, p1, p-p1);
- rb_str_cat(str, invalid, sizeof(invalid));
+ rb_str_append(str, rb_str_normalize_ospath0(p1, p-p1));
+ rb_str_cat2(str, "\xEF\xBF\xBD");
p += 1;
- p1 = p;
- continue;
}
l = MBCLEN_CHARFOUND_LEN(r);
c = rb_enc_mbc_to_codepoint(p, e, enc);
if ((0x2000 <= c && c <= 0x2FFF) || (0xF900 <= c && c <= 0xFAFF) ||
(0x2F800 <= c && c <= 0x2FAFF)) {
if (p - p1 > 0) {
- rb_str_append_normalized_ospath(str, p1, p-p1);
+ rb_str_append(str, rb_str_normalize_ospath0(p1, p-p1));
}
rb_str_cat(str, p, l);
p += l;
@@ -298,45 +305,11 @@ rb_str_normalize_ospath(const char *ptr, long len)
}
}
if (p - p1 > 0) {
- rb_str_append_normalized_ospath(str, p1, p-p1);
+ rb_str_append(str, rb_str_normalize_ospath0(p1, p-p1));
}
return str;
}
-
-static int
-ignored_char_p(const char *p, const char *e, rb_encoding *enc)
-{
- unsigned char c;
- if (p+3 > e) return 0;
- switch ((unsigned char)*p) {
- case 0xe2:
- switch ((unsigned char)p[1]) {
- case 0x80:
- c = (unsigned char)p[2];
- /* c >= 0x200c && c <= 0x200f */
- if (c >= 0x8c && c <= 0x8f) return 3;
- /* c >= 0x202a && c <= 0x202e */
- if (c >= 0xaa && c <= 0xae) return 3;
- return 0;
- case 0x81:
- c = (unsigned char)p[2];
- /* c >= 0x206a && c <= 0x206f */
- if (c >= 0xaa && c <= 0xaf) return 3;
- return 0;
- }
- break;
- case 0xef:
- /* c == 0xfeff */
- if ((unsigned char)p[1] == 0xbb &&
- (unsigned char)p[2] == 0xbf)
- return 3;
- break;
- }
- return 0;
-}
-#else
-# define NORMALIZE_UTF8PATH 0
#endif
static long
@@ -383,27 +356,25 @@ rb_file_path(VALUE obj)
static size_t
stat_memsize(const void *p)
{
- return sizeof(struct stat);
+ return p ? sizeof(struct stat) : 0;
}
static const rb_data_type_t stat_data_type = {
"stat",
{NULL, RUBY_TYPED_DEFAULT_FREE, stat_memsize,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
stat_new_0(VALUE klass, const struct stat *st)
{
struct stat *nst = 0;
- VALUE obj = TypedData_Wrap_Struct(klass, &stat_data_type, 0);
if (st) {
nst = ALLOC(struct stat);
*nst = *st;
- RTYPEDDATA_DATA(obj) = nst;
}
- return obj;
+ return TypedData_Wrap_Struct(klass, &stat_data_type, nst);
}
VALUE
@@ -430,7 +401,7 @@ static struct timespec stat_mtimespec(struct stat *st);
* Compares File::Stat objects by comparing their respective modification
* times.
*
- * +nil+ is returned if +other_stat+ is not a File::Stat object
+ * +nil+ is returned if the two values are incomparable.
*
* f1 = File.new("f1", "w")
* sleep 1
@@ -538,18 +509,7 @@ rb_stat_dev_minor(VALUE self)
static VALUE
rb_stat_ino(VALUE self)
{
-#ifdef _WIN32
- struct stat *st = get_stat(self);
- unsigned short *p2 = (unsigned short *)st;
- unsigned int *p4 = (unsigned int *)st;
- uint64_t r;
- r = p2[2];
- r <<= 16;
- r |= p2[7];
- r <<= 32;
- r |= p4[5];
- return ULL2NUM(r);
-#elif SIZEOF_STRUCT_STAT_ST_INO > SIZEOF_LONG
+#if SIZEOF_STRUCT_STAT_ST_INO > SIZEOF_LONG
return ULL2NUM(get_stat(self)->st_ino);
#else
return ULONG2NUM(get_stat(self)->st_ino);
@@ -760,7 +720,7 @@ stat_atimespec(struct stat *st)
#elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
ts.tv_nsec = st->st_atimespec.tv_nsec;
#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
- ts.tv_nsec = (long)st->st_atimensec;
+ ts.tv_nsec = st->st_atimensec;
#else
ts.tv_nsec = 0;
#endif
@@ -784,7 +744,7 @@ stat_mtimespec(struct stat *st)
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC)
ts.tv_nsec = st->st_mtimespec.tv_nsec;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
- ts.tv_nsec = (long)st->st_mtimensec;
+ ts.tv_nsec = st->st_mtimensec;
#else
ts.tv_nsec = 0;
#endif
@@ -808,7 +768,7 @@ stat_ctimespec(struct stat *st)
#elif defined(HAVE_STRUCT_STAT_ST_CTIMESPEC)
ts.tv_nsec = st->st_ctimespec.tv_nsec;
#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC)
- ts.tv_nsec = (long)st->st_ctimensec;
+ ts.tv_nsec = st->st_ctimensec;
#else
ts.tv_nsec = 0;
#endif
@@ -822,20 +782,6 @@ stat_ctime(struct stat *st)
return rb_time_nano_new(ts.tv_sec, ts.tv_nsec);
}
-#define HAVE_STAT_BIRTHTIME
-#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC)
-static VALUE
-stat_birthtime(struct stat *st)
-{
- struct timespec *ts = &st->st_birthtimespec;
- return rb_time_nano_new(ts->tv_sec, ts->tv_nsec);
-}
-#elif defined(_WIN32)
-# define stat_birthtime stat_ctime
-#else
-# undef HAVE_STAT_BIRTHTIME
-#endif
-
/*
* call-seq:
* stat.atime -> time
@@ -889,38 +835,6 @@ rb_stat_ctime(VALUE self)
return stat_ctime(get_stat(self));
}
-#if defined(HAVE_STAT_BIRTHTIME)
-/*
- * call-seq:
- * stat.birthtime -> aTime
- *
- * Returns the birth time for <i>stat</i>.
- *
- * If the platform doesn't have birthtime, raises NotImplementedError.
- *
- * File.write("testfile", "foo")
- * sleep 10
- * File.write("testfile", "bar")
- * sleep 10
- * File.chmod(0644, "testfile")
- * sleep 10
- * File.read("testfile")
- * File.stat("testfile").birthtime #=> 2014-02-24 11:19:17 +0900
- * File.stat("testfile").mtime #=> 2014-02-24 11:19:27 +0900
- * File.stat("testfile").ctime #=> 2014-02-24 11:19:37 +0900
- * File.stat("testfile").atime #=> 2014-02-24 11:19:47 +0900
- *
- */
-
-static VALUE
-rb_stat_birthtime(VALUE self)
-{
- return stat_birthtime(get_stat(self));
-}
-#else
-# define rb_stat_birthtime rb_f_notimplement
-#endif
-
/*
* call-seq:
* stat.inspect -> string
@@ -932,8 +846,7 @@ rb_stat_birthtime(VALUE self)
* # nlink=1, uid=0, gid=0, rdev=0x0, size=1374, blksize=4096,
* # blocks=8, atime=Wed Dec 10 10:16:12 CST 2003,
* # mtime=Fri Sep 12 15:41:41 CDT 2003,
- * # ctime=Mon Oct 27 11:20:27 CST 2003,
- * # birthtime=Mon Aug 04 08:13:49 CDT 2003>"
+ * # ctime=Mon Oct 27 11:20:27 CST 2003>"
*/
static VALUE
@@ -958,9 +871,6 @@ rb_stat_inspect(VALUE self)
{"atime", rb_stat_atime},
{"mtime", rb_stat_mtime},
{"ctime", rb_stat_ctime},
-#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC)
- {"birthtime", rb_stat_birthtime},
-#endif
};
struct stat* st;
@@ -1003,6 +913,7 @@ rb_stat(VALUE file, struct stat *st)
{
VALUE tmp;
+ rb_secure(2);
tmp = rb_check_convert_type(file, T_FILE, "IO", "to_io");
if (!NIL_P(tmp)) {
rb_io_t *fptr;
@@ -1055,25 +966,6 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
if (ret) CloseHandle(ret);
return INVALID_HANDLE_VALUE;
}
-
-static VALUE
-close_handle(VALUE h)
-{
- CloseHandle((HANDLE)h);
- return Qfalse;
-}
-
-struct w32_io_info_args {
- VALUE *fname;
- BY_HANDLE_FILE_INFORMATION *st;
-};
-
-static VALUE
-call_w32_io_info(VALUE arg)
-{
- struct w32_io_info_args *p = (void *)arg;
- return (VALUE)w32_io_info(p->fname, p->st);
-}
#endif
/*
@@ -1147,6 +1039,7 @@ rb_file_s_lstat(VALUE klass, VALUE fname)
#ifdef HAVE_LSTAT
struct stat st;
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (lstat(StringValueCStr(fname), &st) == -1) {
@@ -1180,6 +1073,7 @@ rb_file_lstat(VALUE obj)
struct stat st;
VALUE path;
+ rb_secure(2);
GetOpenFile(obj, fptr);
if (NIL_P(fptr->pathv)) return Qnil;
path = rb_str_encode_ospath(fptr->pathv);
@@ -1195,7 +1089,7 @@ rb_file_lstat(VALUE obj)
static int
rb_group_member(GETGROUPS_T gid)
{
-#if defined(_WIN32) || !defined(HAVE_GETGROUPS)
+#ifdef _WIN32
return FALSE;
#else
int rv = FALSE;
@@ -1247,15 +1141,6 @@ rb_group_member(GETGROUPS_T gid)
#define USE_GETEUID 1
#endif
-#ifdef __native_client__
-// Although the NaCl toolchain contain eaccess() is it not yet
-// overridden by nacl_io.
-// TODO(sbc): Remove this once eaccess() is wired up correctly
-// in NaCl.
-# undef HAVE_EACCESS
-# undef USE_GETEUID
-#endif
-
#ifndef HAVE_EACCESS
int
eaccess(const char *path, int mode)
@@ -1393,6 +1278,7 @@ rb_file_symlink_p(VALUE obj, VALUE fname)
#ifdef S_ISLNK
struct stat st;
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (lstat(StringValueCStr(fname), &st) < 0) return Qfalse;
@@ -1494,6 +1380,7 @@ rb_file_chardev_p(VALUE obj, VALUE fname)
/*
* call-seq:
* File.exist?(file_name) -> true or false
+ * File.exists?(file_name) -> true or false
*
* Return <code>true</code> if the named file exists.
*
@@ -1511,12 +1398,6 @@ rb_file_exist_p(VALUE obj, VALUE fname)
return Qtrue;
}
-/*
- * call-seq:
- * File.exists?(file_name) -> true or false
- *
- * Deprecated method. Don't use.
- */
static VALUE
rb_file_exists_p(VALUE obj, VALUE fname)
{
@@ -1538,12 +1419,13 @@ rb_file_exists_p(VALUE obj, VALUE fname)
* File.readable?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is readable by the effective
- * user and group id of this process. See eaccess(3).
+ * user id of this process.
*/
static VALUE
rb_file_readable_p(VALUE obj, VALUE fname)
{
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (eaccess(StringValueCStr(fname), R_OK) < 0) return Qfalse;
@@ -1555,12 +1437,13 @@ rb_file_readable_p(VALUE obj, VALUE fname)
* File.readable_real?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is readable by the real
- * user and group id of this process. See access(3).
+ * user id of this process.
*/
static VALUE
rb_file_readable_real_p(VALUE obj, VALUE fname)
{
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (access(StringValueCStr(fname), R_OK) < 0) return Qfalse;
@@ -1610,12 +1493,13 @@ rb_file_world_readable_p(VALUE obj, VALUE fname)
* File.writable?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is writable by the effective
- * user and group id of this process. See eaccess(3).
+ * user id of this process.
*/
static VALUE
rb_file_writable_p(VALUE obj, VALUE fname)
{
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (eaccess(StringValueCStr(fname), W_OK) < 0) return Qfalse;
@@ -1627,12 +1511,13 @@ rb_file_writable_p(VALUE obj, VALUE fname)
* File.writable_real?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is writable by the real
- * user and group id of this process. See access(3)
+ * user id of this process.
*/
static VALUE
rb_file_writable_real_p(VALUE obj, VALUE fname)
{
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (access(StringValueCStr(fname), W_OK) < 0) return Qfalse;
@@ -1674,12 +1559,13 @@ rb_file_world_writable_p(VALUE obj, VALUE fname)
* File.executable?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is executable by the effective
- * user and group id of this process. See eaccess(3).
+ * user id of this process.
*/
static VALUE
rb_file_executable_p(VALUE obj, VALUE fname)
{
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (eaccess(StringValueCStr(fname), X_OK) < 0) return Qfalse;
@@ -1691,12 +1577,13 @@ rb_file_executable_p(VALUE obj, VALUE fname)
* File.executable_real?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is executable by the real
- * user and group id of this process. See access(3).
+ * user id of this process.
*/
static VALUE
rb_file_executable_real_p(VALUE obj, VALUE fname)
{
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (access(StringValueCStr(fname), X_OK) < 0) return Qfalse;
@@ -1709,14 +1596,12 @@ rb_file_executable_real_p(VALUE obj, VALUE fname)
/*
* call-seq:
- * File.file?(file) -> true or false
+ * File.file?(file_name) -> true or false
*
- * Returns +true+ if the named +file+ exists and is a regular file.
+ * Returns <code>true</code> if the named file exists and is a
+ * regular file.
*
- * +file+ can be an IO object.
- *
- * If the +file+ argument is a symbolic link, it will resolve the symbolic link
- * and use the file referenced by the link.
+ * _file_name_ can be an IO object.
*/
static VALUE
@@ -1829,6 +1714,7 @@ check3rdbyte(VALUE fname, int mode)
{
struct stat st;
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (STAT(StringValueCStr(fname), &st) < 0) return Qfalse;
@@ -1910,29 +1796,25 @@ rb_file_sticky_p(VALUE obj, VALUE fname)
static VALUE
rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2)
{
-#ifndef _WIN32
+#ifndef DOSISH
struct stat st1, st2;
if (rb_stat(fname1, &st1) < 0) return Qfalse;
if (rb_stat(fname2, &st2) < 0) return Qfalse;
if (st1.st_dev != st2.st_dev) return Qfalse;
if (st1.st_ino != st2.st_ino) return Qfalse;
- return Qtrue;
#else
+# ifdef _WIN32
BY_HANDLE_FILE_INFORMATION st1, st2;
HANDLE f1 = 0, f2 = 0;
+# endif
+ rb_secure(2);
+# ifdef _WIN32
f1 = w32_io_info(&fname1, &st1);
if (f1 == INVALID_HANDLE_VALUE) return Qfalse;
- if (f1) {
- struct w32_io_info_args arg;
- arg.fname = &fname2;
- arg.st = &st2;
- f2 = (HANDLE)rb_ensure(call_w32_io_info, (VALUE)&arg, close_handle, (VALUE)f1);
- }
- else {
- f2 = w32_io_info(&fname2, &st2);
- }
+ f2 = w32_io_info(&fname2, &st2);
+ if (f1) CloseHandle(f1);
if (f2 == INVALID_HANDLE_VALUE) return Qfalse;
if (f2) CloseHandle(f2);
@@ -1940,8 +1822,23 @@ rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2)
st1.nFileIndexHigh == st2.nFileIndexHigh &&
st1.nFileIndexLow == st2.nFileIndexLow)
return Qtrue;
- return Qfalse;
+ if (!f1 || !f2) return Qfalse;
+# else
+ FilePathValue(fname1);
+ fname1 = rb_str_new4(fname1);
+ fname1 = rb_str_encode_ospath(fname1);
+ FilePathValue(fname2);
+ fname2 = rb_str_encode_ospath(fname2);
+ if (access(RSTRING_PTR(fname1), 0)) return Qfalse;
+ if (access(RSTRING_PTR(fname2), 0)) return Qfalse;
+# endif
+ fname1 = rb_file_expand_path(fname1, Qnil);
+ fname2 = rb_file_expand_path(fname2, Qnil);
+ if (RSTRING_LEN(fname1) != RSTRING_LEN(fname2)) return Qfalse;
+ if (rb_memcicmp(RSTRING_PTR(fname1), RSTRING_PTR(fname2), RSTRING_LEN(fname1)))
+ return Qfalse;
#endif
+ return Qtrue;
}
/*
@@ -1959,9 +1856,8 @@ rb_file_s_size(VALUE klass, VALUE fname)
struct stat st;
if (rb_stat(fname, &st) < 0) {
- int e = errno;
FilePathValue(fname);
- rb_syserr_fail_path(e, fname);
+ rb_sys_fail_path(fname);
}
return OFFT2NUM(st.st_size);
}
@@ -2027,6 +1923,7 @@ rb_file_s_ftype(VALUE klass, VALUE fname)
{
struct stat st;
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (lstat(StringValueCStr(fname), &st) == -1) {
@@ -2054,9 +1951,8 @@ rb_file_s_atime(VALUE klass, VALUE fname)
struct stat st;
if (rb_stat(fname, &st) < 0) {
- int e = errno;
FilePathValue(fname);
- rb_syserr_fail_path(e, fname);
+ rb_sys_fail_path(fname);
}
return stat_atime(&st);
}
@@ -2103,9 +1999,8 @@ rb_file_s_mtime(VALUE klass, VALUE fname)
struct stat st;
if (rb_stat(fname, &st) < 0) {
- int e = errno;
FilePathValue(fname);
- rb_syserr_fail_path(e, fname);
+ rb_sys_fail_path(fname);
}
return stat_mtime(&st);
}
@@ -2155,9 +2050,8 @@ rb_file_s_ctime(VALUE klass, VALUE fname)
struct stat st;
if (rb_stat(fname, &st) < 0) {
- int e = errno;
FilePathValue(fname);
- rb_syserr_fail_path(e, fname);
+ rb_sys_fail_path(fname);
}
return stat_ctime(&st);
}
@@ -2188,66 +2082,6 @@ rb_file_ctime(VALUE obj)
return stat_ctime(&st);
}
-#if defined(HAVE_STAT_BIRTHTIME)
-/*
- * call-seq:
- * File.birthtime(file_name) -> time
- *
- * Returns the birth time for the named file.
- *
- * _file_name_ can be an IO object.
- *
- * File.birthtime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
- *
- * If the platform doesn't have birthtime, raises NotImplementedError.
- *
- */
-
-static VALUE
-rb_file_s_birthtime(VALUE klass, VALUE fname)
-{
- struct stat st;
-
- if (rb_stat(fname, &st) < 0) {
- int e = errno;
- FilePathValue(fname);
- rb_syserr_fail_path(e, fname);
- }
- return stat_birthtime(&st);
-}
-#else
-# define rb_file_s_birthtime rb_f_notimplement
-#endif
-
-#if defined(HAVE_STAT_BIRTHTIME)
-/*
- * call-seq:
- * file.birthtime -> time
- *
- * Returns the birth time for <i>file</i>.
- *
- * File.new("testfile").birthtime #=> Wed Apr 09 08:53:14 CDT 2003
- *
- * If the platform doesn't have birthtime, raises NotImplementedError.
- *
- */
-
-static VALUE
-rb_file_birthtime(VALUE obj)
-{
- rb_io_t *fptr;
- struct stat st;
-
- GetOpenFile(obj, fptr);
- if (fstat(fptr->fd, &st) == -1) {
- rb_sys_fail_path(fptr->pathv);
- }
- return stat_birthtime(&st);
-}
-#else
-# define rb_file_birthtime rb_f_notimplement
-#endif
-
/*
* call-seq:
* file.size -> integer
@@ -2302,6 +2136,7 @@ rb_file_s_chmod(int argc, VALUE *argv)
int mode;
long n;
+ rb_secure(2);
rb_scan_args(argc, argv, "1*", &vmode, &rest);
mode = NUM2INT(vmode);
@@ -2327,23 +2162,18 @@ rb_file_chmod(VALUE obj, VALUE vmode)
{
rb_io_t *fptr;
int mode;
-#if !defined HAVE_FCHMOD || !HAVE_FCHMOD
+#ifndef HAVE_FCHMOD
VALUE path;
#endif
+ rb_secure(2);
mode = NUM2INT(vmode);
GetOpenFile(obj, fptr);
#ifdef HAVE_FCHMOD
- if (fchmod(fptr->fd, mode) == -1) {
- if (HAVE_FCHMOD || errno != ENOSYS)
- rb_sys_fail_path(fptr->pathv);
- }
- else {
- if (!HAVE_FCHMOD) return INT2FIX(0);
- }
-#endif
-#if !defined HAVE_FCHMOD || !HAVE_FCHMOD
+ if (fchmod(fptr->fd, mode) == -1)
+ rb_sys_fail_path(fptr->pathv);
+#else
if (NIL_P(fptr->pathv)) return Qnil;
path = rb_str_encode_ospath(fptr->pathv);
if (chmod(RSTRING_PTR(path), mode) == -1)
@@ -2378,6 +2208,7 @@ rb_file_s_lchmod(int argc, VALUE *argv)
VALUE rest;
long mode, n;
+ rb_secure(2);
rb_scan_args(argc, argv, "1*", &vmode, &rest);
mode = NUM2INT(vmode);
@@ -2388,24 +2219,6 @@ rb_file_s_lchmod(int argc, VALUE *argv)
#define rb_file_s_lchmod rb_f_notimplement
#endif
-static inline rb_uid_t
-to_uid(VALUE u)
-{
- if (NIL_P(u)) {
- return (rb_uid_t)-1;
- }
- return NUM2UIDT(u);
-}
-
-static inline rb_gid_t
-to_gid(VALUE g)
-{
- if (NIL_P(g)) {
- return (rb_gid_t)-1;
- }
- return NUM2GIDT(g);
-}
-
struct chown_args {
rb_uid_t owner;
rb_gid_t group;
@@ -2441,9 +2254,20 @@ rb_file_s_chown(int argc, VALUE *argv)
struct chown_args arg;
long n;
+ rb_secure(2);
rb_scan_args(argc, argv, "2*", &o, &g, &rest);
- arg.owner = to_uid(o);
- arg.group = to_gid(g);
+ if (NIL_P(o)) {
+ arg.owner = -1;
+ }
+ else {
+ arg.owner = NUM2UIDT(o);
+ }
+ if (NIL_P(g)) {
+ arg.group = -1;
+ }
+ else {
+ arg.group = NUM2GIDT(g);
+ }
n = apply2files(chown_internal, rest, &arg);
return LONG2FIX(n);
@@ -2468,14 +2292,14 @@ static VALUE
rb_file_chown(VALUE obj, VALUE owner, VALUE group)
{
rb_io_t *fptr;
- rb_uid_t o;
- rb_gid_t g;
+ int o, g;
#ifndef HAVE_FCHOWN
VALUE path;
#endif
- o = to_uid(owner);
- g = to_gid(group);
+ rb_secure(2);
+ o = NIL_P(owner) ? -1 : NUM2INT(owner);
+ g = NIL_P(group) ? -1 : NUM2INT(group);
GetOpenFile(obj, fptr);
#ifndef HAVE_FCHOWN
if (NIL_P(fptr->pathv)) return Qnil;
@@ -2517,9 +2341,20 @@ rb_file_s_lchown(int argc, VALUE *argv)
struct chown_args arg;
long n;
+ rb_secure(2);
rb_scan_args(argc, argv, "2*", &o, &g, &rest);
- arg.owner = to_uid(o);
- arg.group = to_gid(g);
+ if (NIL_P(o)) {
+ arg.owner = -1;
+ }
+ else {
+ arg.owner = NUM2UIDT(o);
+ }
+ if (NIL_P(g)) {
+ arg.group = -1;
+ }
+ else {
+ arg.group = NUM2GIDT(g);
+ }
n = apply2files(lchown_internal, rest, &arg);
return LONG2FIX(n);
@@ -2539,8 +2374,7 @@ NORETURN(static void utime_failed(VALUE, const struct timespec *, VALUE, VALUE))
static void
utime_failed(VALUE path, const struct timespec *tsp, VALUE atime, VALUE mtime)
{
- int e = errno;
- if (tsp && e == EINVAL) {
+ if (tsp && errno == EINVAL) {
VALUE e[2], a = Qnil, m = Qnil;
int d = 0;
if (!NIL_P(atime)) {
@@ -2564,8 +2398,9 @@ utime_failed(VALUE path, const struct timespec *tsp, VALUE atime, VALUE mtime)
e[1] = INT2FIX(EINVAL);
rb_exc_raise(rb_class_new_instance(2, e, rb_eSystemCallError));
}
+ errno = EINVAL;
}
- rb_syserr_fail_path(e, path);
+ rb_sys_fail_path(path);
}
#else
#define utime_failed(path, tsp, atime, mtime) rb_sys_fail_path(path)
@@ -2580,7 +2415,7 @@ utime_internal(const char *path, VALUE pathv, void *arg)
const struct timespec *tsp = v->tsp;
struct timeval tvbuf[2], *tvp = NULL;
-#if defined(HAVE_UTIMENSAT)
+#ifdef HAVE_UTIMENSAT
static int try_utimensat = 1;
if (try_utimensat) {
@@ -2650,15 +2485,13 @@ rb_file_s_utime(int argc, VALUE *argv)
struct timespec tss[2], *tsp = NULL;
long n;
+ rb_secure(2);
rb_scan_args(argc, argv, "2*", &args.atime, &args.mtime, &rest);
if (!NIL_P(args.atime) || !NIL_P(args.mtime)) {
tsp = tss;
tsp[0] = rb_time_timespec(args.atime);
- if (args.atime == args.mtime)
- tsp[1] = tsp[0];
- else
- tsp[1] = rb_time_timespec(args.mtime);
+ tsp[1] = rb_time_timespec(args.mtime);
}
args.tsp = tsp;
@@ -2666,15 +2499,9 @@ rb_file_s_utime(int argc, VALUE *argv)
return LONG2FIX(n);
}
-#ifdef RUBY_FUNCTION_NAME_STRING
-# define syserr_fail2(e, s1, s2) syserr_fail2_in(RUBY_FUNCTION_NAME_STRING, e, s1, s2)
-#else
-# define syserr_fail2_in(func, e, s1, s2) syserr_fail2(e, s1, s2)
-#endif
-#define sys_fail2(s1, s2) syserr_fail2(errno, s1, s2)
-NORETURN(static void syserr_fail2_in(const char *,int,VALUE,VALUE));
+NORETURN(static void sys_fail2(VALUE,VALUE));
static void
-syserr_fail2_in(const char *func, int e, VALUE s1, VALUE s2)
+sys_fail2(VALUE s1, VALUE s2)
{
VALUE str;
#ifdef MAX_PATH
@@ -2683,19 +2510,12 @@ syserr_fail2_in(const char *func, int e, VALUE s1, VALUE s2)
const int max_pathlen = MAXPATHLEN;
#endif
- if (e == EEXIST) {
- rb_syserr_fail_path(e, rb_str_ellipsize(s2, max_pathlen));
- }
str = rb_str_new_cstr("(");
rb_str_append(str, rb_str_ellipsize(s1, max_pathlen));
rb_str_cat2(str, ", ");
rb_str_append(str, rb_str_ellipsize(s2, max_pathlen));
rb_str_cat2(str, ")");
-#ifdef RUBY_FUNCTION_NAME_STRING
- rb_syserr_fail_path_in(func, e, str);
-#else
- rb_syserr_fail_path(e, str);
-#endif
+ rb_sys_fail_path(str);
}
#ifdef HAVE_LINK
@@ -2714,6 +2534,7 @@ syserr_fail2_in(const char *func, int e, VALUE s1, VALUE s2)
static VALUE
rb_file_s_link(VALUE klass, VALUE from, VALUE to)
{
+ rb_secure(2);
FilePathValue(from);
FilePathValue(to);
from = rb_str_encode_ospath(from);
@@ -2744,6 +2565,7 @@ rb_file_s_link(VALUE klass, VALUE from, VALUE to)
static VALUE
rb_file_s_symlink(VALUE klass, VALUE from, VALUE to)
{
+ rb_secure(2);
FilePathValue(from);
FilePathValue(to);
from = rb_str_encode_ospath(from);
@@ -2759,6 +2581,8 @@ rb_file_s_symlink(VALUE klass, VALUE from, VALUE to)
#endif
#ifdef HAVE_READLINK
+static VALUE rb_readlink(VALUE path);
+
/*
* call-seq:
* File.readlink(link_name) -> file_name
@@ -2773,20 +2597,20 @@ rb_file_s_symlink(VALUE klass, VALUE from, VALUE to)
static VALUE
rb_file_s_readlink(VALUE klass, VALUE path)
{
- return rb_readlink(path, rb_filesystem_encoding());
+ return rb_readlink(path);
}
-#ifndef _WIN32
-VALUE
-rb_readlink(VALUE path, rb_encoding *enc)
+static VALUE
+rb_readlink(VALUE path)
{
int size = 100;
ssize_t rv;
VALUE v;
+ rb_secure(2);
FilePathValue(path);
path = rb_str_encode_ospath(path);
- v = rb_enc_str_new(0, size, enc);
+ v = rb_enc_str_new(0, size, rb_filesystem_encoding());
while ((rv = readlink(RSTRING_PTR(path), RSTRING_PTR(v), size)) == size
#ifdef _AIX
|| (rv < 0 && errno == ERANGE) /* quirky behavior of GPFS */
@@ -2794,18 +2618,15 @@ rb_readlink(VALUE path, rb_encoding *enc)
) {
rb_str_modify_expand(v, size);
size *= 2;
- rb_str_set_len(v, size);
}
if (rv < 0) {
- int e = errno;
rb_str_resize(v, 0);
- rb_syserr_fail_path(e, path);
+ rb_sys_fail_path(path);
}
rb_str_resize(v, rv);
return v;
}
-#endif
#else
#define rb_file_s_readlink rb_f_notimplement
#endif
@@ -2832,6 +2653,7 @@ rb_file_s_unlink(VALUE klass, VALUE args)
{
long n;
+ rb_secure(2);
n = apply2files(unlink_internal, args, 0);
return LONG2FIX(n);
}
@@ -2852,6 +2674,7 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE to)
const char *src, *dst;
VALUE f, t;
+ rb_secure(2);
FilePathValue(from);
FilePathValue(to);
f = rb_str_encode_ospath(from);
@@ -2862,17 +2685,19 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE to)
errno = 0;
#endif
if (rename(src, dst) < 0) {
- int e = errno;
#if defined DOSISH
- switch (e) {
+ switch (errno) {
case EEXIST:
+#if defined (__EMX__)
+ case EACCES:
+#endif
if (chmod(dst, 0666) == 0 &&
unlink(dst) == 0 &&
rename(src, dst) == 0)
return INT2FIX(0);
}
#endif
- syserr_fail2(e, from, to);
+ sys_fail2(from, to);
}
return INT2FIX(0);
@@ -2898,6 +2723,7 @@ rb_file_s_umask(int argc, VALUE *argv)
{
int omask = 0;
+ rb_secure(2);
if (argc == 0) {
omask = umask(0);
umask(omask);
@@ -3145,45 +2971,22 @@ ntfs_tail(const char *path, const char *end, rb_encoding *enc)
buflen = RSTRING_LEN(result),\
pend = p + buflen)
-#ifdef __APPLE__
-# define SKIPPATHSEP(p) ((*(p)) ? 1 : 0)
-#else
-# define SKIPPATHSEP(p) 1
-#endif
-
-#define BUFCOPY(srcptr, srclen) do { \
- const int skip = SKIPPATHSEP(p); \
- rb_str_set_len(result, p-buf+skip); \
- BUFCHECK(bdiff + ((srclen)+skip) >= buflen); \
- p += skip; \
- memcpy(p, (srcptr), (srclen)); \
- p += (srclen); \
-} while (0)
-
-#define WITH_ROOTDIFF(stmt) do { \
- long rootdiff = root - buf; \
- stmt; \
- root = buf + rootdiff; \
-} while (0)
-
static VALUE
copy_home_path(VALUE result, const char *dir)
{
char *buf;
#if defined DOSISH || defined __CYGWIN__
char *p, *bend;
- rb_encoding *enc;
#endif
long dirlen;
- int encidx;
+ rb_encoding *enc;
dirlen = strlen(dir);
rb_str_resize(result, dirlen);
memcpy(buf = RSTRING_PTR(result), dir, dirlen);
- encidx = rb_filesystem_encindex();
- rb_enc_associate_index(result, encidx);
+ enc = rb_filesystem_encoding();
+ rb_enc_associate(result, enc);
#if defined DOSISH || defined __CYGWIN__
- enc = rb_enc_from_index(encidx);
for (bend = (p = buf) + dirlen; p < bend; Inc(p, bend, enc)) {
if (*p == '\\') {
*p = '/';
@@ -3221,18 +3024,6 @@ rb_default_home_dir(VALUE result)
}
#ifndef _WIN32
-static VALUE
-ospath_new(const char *ptr, long len, rb_encoding *fsenc)
-{
-#if NORMALIZE_UTF8PATH
- VALUE path = rb_str_normalize_ospath(ptr, len);
- rb_enc_associate(path, fsenc);
- return path;
-#else
- return rb_enc_str_new(ptr, len, fsenc);
-#endif
-}
-
static char *
append_fspath(VALUE result, VALUE fname, char *dir, rb_encoding **enc, rb_encoding *fsenc)
{
@@ -3240,15 +3031,12 @@ append_fspath(VALUE result, VALUE fname, char *dir, rb_encoding **enc, rb_encodi
VALUE dirname = Qnil;
size_t dirlen = strlen(dir), buflen = rb_str_capacity(result);
- if (NORMALIZE_UTF8PATH || *enc != fsenc) {
- rb_encoding *direnc = rb_enc_check(fname, dirname = ospath_new(dir, dirlen, fsenc));
+ if (*enc != fsenc) {
+ rb_encoding *direnc = rb_enc_check(fname, dirname = rb_enc_str_new(dir, dirlen, fsenc));
if (direnc != fsenc) {
dirname = rb_str_conv_enc(dirname, fsenc, direnc);
RSTRING_GETMEM(dirname, cwdp, dirlen);
}
- else if (NORMALIZE_UTF8PATH) {
- RSTRING_GETMEM(dirname, cwdp, dirlen);
- }
*enc = direnc;
}
do {buflen *= 2;} while (dirlen > buflen);
@@ -3454,25 +3242,17 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
case '\\':
#endif
if (s > b) {
- WITH_ROOTDIFF(BUFCOPY(b, s-b));
+ long rootdiff = root - buf;
+ rb_str_set_len(result, p-buf+1);
+ BUFCHECK(bdiff + (s-b+1) >= buflen);
+ root = buf + rootdiff;
+ memcpy(++p, b, s-b);
+ p += s-b;
*p = '/';
}
b = ++s;
break;
default:
-#ifdef __APPLE__
- {
- int n = ignored_char_p(s, fend, enc);
- if (n) {
- if (s > b) {
- WITH_ROOTDIFF(BUFCOPY(b, s-b));
- *p = '\0';
- }
- b = s += n;
- break;
- }
- }
-#endif
Inc(s, fend, enc);
break;
}
@@ -3494,7 +3274,10 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
}
}
#endif
- BUFCOPY(b, s-b);
+ rb_str_set_len(result, p-buf+1);
+ BUFCHECK(bdiff + (s-b) >= buflen);
+ memcpy(++p, b, s-b);
+ p += s-b;
rb_str_set_len(result, p-buf);
}
if (p == skiproot(buf, p + !!*p, enc) - 1) p++;
@@ -3504,7 +3287,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
if ((s = strrdirsep(b = buf, p, enc)) != 0 && !strpbrk(s, "*?")) {
VALUE tmp, v;
size_t len;
- int encidx;
+ rb_encoding *enc;
WCHAR *wstr;
WIN32_FIND_DATAW wfd;
HANDLE h;
@@ -3557,15 +3340,15 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
*p = '/';
#endif
rb_str_set_len(result, p - buf + strlen(p));
- encidx = ENCODING_GET(result);
+ enc = rb_enc_get(result);
tmp = result;
- if (encidx != ENCINDEX_UTF_8 && rb_enc_str_coderange(result) != ENC_CODERANGE_7BIT) {
+ if (enc != rb_utf8_encoding() && rb_enc_str_coderange(result) != ENC_CODERANGE_7BIT) {
tmp = rb_str_encode_ospath(result);
}
len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0);
wstr = ALLOCV_N(WCHAR, v, len);
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, wstr, len);
- if (tmp != result) rb_str_set_len(tmp, 0);
+ if (tmp != result) rb_str_resize(tmp, 0);
h = FindFirstFileW(wstr, &wfd);
ALLOCV_END(v);
if (h != INVALID_HANDLE_VALUE) {
@@ -3583,16 +3366,14 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
++p;
wlen = (int)len;
len = WideCharToMultiByte(CP_UTF8, 0, wfd.cFileName, wlen, NULL, 0, NULL, NULL);
- if (tmp == result) {
+ BUFCHECK(bdiff + len >= buflen);
+ WideCharToMultiByte(CP_UTF8, 0, wfd.cFileName, wlen, p, len + 1, NULL, NULL);
+ if (tmp != result) {
+ rb_str_buf_cat(tmp, p, len);
+ tmp = rb_str_encode(tmp, rb_enc_from_encoding(enc), 0, Qnil);
+ len = RSTRING_LEN(tmp);
BUFCHECK(bdiff + len >= buflen);
- WideCharToMultiByte(CP_UTF8, 0, wfd.cFileName, wlen, p, len + 1, NULL, NULL);
- }
- else {
- rb_str_modify_expand(tmp, len);
- WideCharToMultiByte(CP_UTF8, 0, wfd.cFileName, wlen, RSTRING_PTR(tmp), len + 1, NULL, NULL);
- rb_str_cat_conv_enc_opts(result, bdiff, RSTRING_PTR(tmp), len,
- rb_utf8_encoding(), 0, Qnil);
- BUFINIT();
+ memcpy(p, RSTRING_PTR(tmp), len);
rb_str_resize(tmp, 0);
}
p += len;
@@ -3615,16 +3396,6 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
#define EXPAND_PATH_BUFFER() rb_usascii_str_new(0, MAXPATHLEN + 2)
-static VALUE
-str_shrink(VALUE str)
-{
- rb_str_resize(str, RSTRING_LEN(str));
- return str;
-}
-
-#define expand_path(fname, dname, abs_mode, long_name, result) \
- str_shrink(rb_file_expand_path_internal(fname, dname, abs_mode, long_name, result))
-
#define check_expand_path_args(fname, dname) \
(((fname) = rb_get_path(fname)), \
(void)(NIL_P(dname) ? (dname) : ((dname) = rb_get_path(dname))))
@@ -3639,13 +3410,13 @@ VALUE
rb_file_expand_path(VALUE fname, VALUE dname)
{
check_expand_path_args(fname, dname);
- return expand_path(fname, dname, 0, 1, EXPAND_PATH_BUFFER());
+ return rb_file_expand_path_internal(fname, dname, 0, 1, EXPAND_PATH_BUFFER());
}
VALUE
rb_file_expand_path_fast(VALUE fname, VALUE dname)
{
- return expand_path(fname, dname, 0, 0, EXPAND_PATH_BUFFER());
+ return rb_file_expand_path_internal(fname, dname, 0, 0, EXPAND_PATH_BUFFER());
}
/*
@@ -3677,7 +3448,7 @@ rb_file_expand_path_fast(VALUE fname, VALUE dname)
*/
VALUE
-rb_file_s_expand_path(int argc, const VALUE *argv)
+rb_file_s_expand_path(int argc, VALUE *argv)
{
VALUE fname, dname;
@@ -3693,7 +3464,7 @@ VALUE
rb_file_absolute_path(VALUE fname, VALUE dname)
{
check_expand_path_args(fname, dname);
- return expand_path(fname, dname, 1, 1, EXPAND_PATH_BUFFER());
+ return rb_file_expand_path_internal(fname, dname, 1, 1, EXPAND_PATH_BUFFER());
}
/*
@@ -3710,7 +3481,7 @@ rb_file_absolute_path(VALUE fname, VALUE dname)
*/
VALUE
-rb_file_s_absolute_path(int argc, const VALUE *argv)
+rb_file_s_absolute_path(int argc, VALUE *argv)
{
VALUE fname, dname;
@@ -3764,7 +3535,8 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
checkval = rb_hash_aref(loopcheck, testpath);
if (!NIL_P(checkval)) {
if (checkval == ID2SYM(resolving)) {
- rb_syserr_fail_path(ELOOP, testpath);
+ errno = ELOOP;
+ rb_sys_fail_path(testpath);
}
else {
*resolvedp = rb_str_dup(checkval);
@@ -3780,15 +3552,14 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
ret = lstat(RSTRING_PTR(testpath2), &sbuf);
#endif
if (ret == -1) {
- int e = errno;
- if (e == ENOENT) {
+ if (errno == ENOENT) {
if (strict || !last || *unresolved_firstsep)
- rb_syserr_fail_path(e, testpath);
+ rb_sys_fail_path(testpath);
*resolvedp = testpath;
break;
}
else {
- rb_syserr_fail_path(e, testpath);
+ rb_sys_fail_path(testpath);
}
}
#ifdef HAVE_READLINK
@@ -3798,7 +3569,7 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
const char *link_prefix, *link_names;
long link_prefixlen;
rb_hash_aset(loopcheck, testpath, ID2SYM(resolving));
- link = rb_readlink(testpath, enc);
+ link = rb_readlink(testpath);
link_prefix = RSTRING_PTR(link);
link_names = skipprefixroot(link_prefix, link_prefix + RSTRING_LEN(link), rb_enc_get(link));
link_prefixlen = link_names - link_prefix;
@@ -3843,11 +3614,13 @@ rb_realpath_internal(VALUE basedir, VALUE path, int strict)
VALUE loopcheck;
volatile VALUE curdir = Qnil;
- rb_encoding *enc, *origenc;
+ rb_encoding *enc;
char *path_names = NULL, *basedir_names = NULL, *curdir_names = NULL;
char *ptr, *prefixptr = NULL, *pend;
long len;
+ rb_secure(2);
+
FilePathValue(path);
unresolved_path = rb_str_dup_frozen(path);
@@ -3895,13 +3668,6 @@ rb_realpath_internal(VALUE basedir, VALUE path, int strict)
}
#endif
- origenc = enc;
- switch (rb_enc_to_index(enc)) {
- case ENCINDEX_ASCII:
- case ENCINDEX_US_ASCII:
- rb_enc_associate_index(resolved, rb_filesystem_encindex());
- }
-
loopcheck = rb_hash_new();
if (curdir_names)
realpath_rec(&prefixlen, &resolved, curdir_names, loopcheck, 1, 0);
@@ -3909,9 +3675,6 @@ rb_realpath_internal(VALUE basedir, VALUE path, int strict)
realpath_rec(&prefixlen, &resolved, basedir_names, loopcheck, 1, 0);
realpath_rec(&prefixlen, &resolved, path_names, loopcheck, strict, 1);
- if (origenc != enc && rb_enc_str_asciionly_p(resolved))
- rb_enc_associate(resolved, origenc);
-
OBJ_TAINT(resolved);
return resolved;
}
@@ -4066,12 +3829,10 @@ ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encodin
* <code>File::ALT_SEPARATOR</code> as the separator when
* <code>File::ALT_SEPARATOR</code> is not <code>nil</code>. If
* <i>suffix</i> is given and present at the end of <i>file_name</i>,
- * it is removed. If <i>suffix</i> is ".*", any extension will be
- * removed.
+ * it is removed.
*
* File.basename("/home/gumby/work/ruby.rb") #=> "ruby.rb"
* File.basename("/home/gumby/work/ruby.rb", ".rb") #=> "ruby"
- * File.basename("/home/gumby/work/ruby.rb", ".*") #=> "ruby"
*/
static VALUE
@@ -4257,8 +4018,7 @@ ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc)
*
* File.extname("test.rb") #=> ".rb"
* File.extname("a/b/d/test.rb") #=> ".rb"
- * File.extname(".a/b/d/test.rb") #=> ".rb"
- * File.extname("foo.") #=> ""
+ * File.extname("foo.") #=> ""
* File.extname("test") #=> ""
* File.extname(".profile") #=> ""
* File.extname(".profile.sh") #=> ".sh"
@@ -4408,7 +4168,7 @@ rb_file_join(VALUE ary, VALUE sep)
/*
* call-seq:
- * File.join(string, ...) -> string
+ * File.join(string, ...) -> path
*
* Returns a new string formed by joining the strings using
* <code>File::SEPARATOR</code>.
@@ -4450,6 +4210,7 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
long pos;
#endif
+ rb_secure(2);
pos = NUM2POS(len);
FilePathValue(path);
path = rb_str_encode_ospath(path);
@@ -4465,9 +4226,8 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
}
rb_update_max_fd(tmpfd);
if (chsize(tmpfd, pos) < 0) {
- int e = errno;
close(tmpfd);
- rb_syserr_fail_path(e, path);
+ rb_sys_fail_path(path);
}
close(tmpfd);
}
@@ -4506,6 +4266,7 @@ rb_file_truncate(VALUE obj, VALUE len)
long pos;
#endif
+ rb_secure(2);
pos = NUM2POS(len);
GetOpenFile(obj, fptr);
if (!(fptr->mode & FMODE_WRITABLE)) {
@@ -4611,6 +4372,7 @@ rb_file_flock(VALUE obj, VALUE operation)
int op[2], op1;
struct timeval time;
+ rb_secure(2);
op[1] = op1 = NUM2INT(operation);
GetOpenFile(obj, fptr);
op[0] = fptr->fd;
@@ -4619,8 +4381,7 @@ rb_file_flock(VALUE obj, VALUE operation)
rb_io_flush_raw(obj, 0);
}
while ((int)rb_thread_io_blocking_region(rb_thread_flock, op, fptr->fd) < 0) {
- int e = errno;
- switch (e) {
+ switch (errno) {
case EAGAIN:
case EACCES:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
@@ -4641,17 +4402,19 @@ rb_file_flock(VALUE obj, VALUE operation)
break;
default:
- rb_syserr_fail_path(e, fptr->pathv);
+ rb_sys_fail_path(fptr->pathv);
}
}
return INT2FIX(0);
}
+#undef flock
static void
test_check(int n, int argc, VALUE *argv)
{
int i;
+ rb_secure(2);
n+=1;
rb_check_arity(argc, n, n);
for (i=1; i<n; i++) {
@@ -4667,7 +4430,7 @@ test_check(int n, int argc, VALUE *argv)
* call-seq:
* test(cmd, file1 [, file2] ) -> obj
*
- * Uses the character +cmd+ to perform various tests on +file1+ (first
+ * Uses the integer +cmd+ to perform various tests on +file1+ (first
* table below) or on +file1+ and +file2+ (second table).
*
* File tests on a single file:
@@ -4750,6 +4513,7 @@ rb_f_test(int argc, VALUE *argv)
case 'd':
return rb_file_directory_p(0, argv[1]);
+ case 'a':
case 'e':
return rb_file_exist_p(0, argv[1]);
@@ -4815,9 +4579,8 @@ rb_f_test(int argc, VALUE *argv)
CHECK(1);
if (rb_stat(fname, &st) == -1) {
- int e = errno;
FilePathValue(fname);
- rb_syserr_fail_path(e, fname);
+ rb_sys_fail_path(fname);
}
switch (cmd) {
@@ -4837,28 +4600,22 @@ rb_f_test(int argc, VALUE *argv)
if (strchr("=<>", cmd)) {
struct stat st1, st2;
- struct timespec t1, t2;
CHECK(2);
if (rb_stat(argv[1], &st1) < 0) return Qfalse;
if (rb_stat(argv[2], &st2) < 0) return Qfalse;
- t1 = stat_mtimespec(&st1);
- t2 = stat_mtimespec(&st2);
-
switch (cmd) {
case '=':
- if (t1.tv_sec == t2.tv_sec && t1.tv_nsec == t2.tv_nsec) return Qtrue;
+ if (st1.st_mtime == st2.st_mtime) return Qtrue;
return Qfalse;
case '>':
- if (t1.tv_sec > t2.tv_sec) return Qtrue;
- if (t1.tv_sec == t2.tv_sec && t1.tv_nsec > t2.tv_nsec) return Qtrue;
+ if (st1.st_mtime > st2.st_mtime) return Qtrue;
return Qfalse;
case '<':
- if (t1.tv_sec < t2.tv_sec) return Qtrue;
- if (t1.tv_sec == t2.tv_sec && t1.tv_nsec < t2.tv_nsec) return Qtrue;
+ if (st1.st_mtime < st2.st_mtime) return Qtrue;
return Qfalse;
}
}
@@ -4900,6 +4657,7 @@ rb_stat_init(VALUE obj, VALUE fname)
{
struct stat st, *nst;
+ rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (STAT(StringValueCStr(fname), &st) == -1) {
@@ -5213,9 +4971,8 @@ static VALUE
rb_stat_wr(VALUE obj)
{
#ifdef S_IROTH
- struct stat *st = get_stat(obj);
- if ((st->st_mode & (S_IROTH)) == S_IROTH) {
- return UINT2NUM(st->st_mode & (S_IRUGO|S_IWUGO|S_IXUGO));
+ if ((get_stat(obj)->st_mode & (S_IROTH)) == S_IROTH) {
+ return UINT2NUM(get_stat(obj)->st_mode & (S_IRUGO|S_IWUGO|S_IXUGO));
}
else {
return Qnil;
@@ -5306,9 +5063,8 @@ static VALUE
rb_stat_ww(VALUE obj)
{
#ifdef S_IROTH
- struct stat *st = get_stat(obj);
- if ((st->st_mode & (S_IWOTH)) == S_IWOTH) {
- return UINT2NUM(st->st_mode & (S_IRUGO|S_IWUGO|S_IXUGO));
+ if ((get_stat(obj)->st_mode & (S_IWOTH)) == S_IWOTH) {
+ return UINT2NUM(get_stat(obj)->st_mode & (S_IRUGO|S_IWUGO|S_IXUGO));
}
else {
return Qnil;
@@ -5502,44 +5258,6 @@ rb_stat_sticky(VALUE obj)
return Qfalse;
}
-#if !defined HAVE_MKFIFO && defined HAVE_MKNOD && defined S_IFIFO
-#define mkfifo(path, mode) mknod(path, (mode)&~S_IFMT|S_IFIFO, 0)
-#define HAVE_MKFIFO
-#endif
-
-/*
- * call-seq:
- * File.mkfifo(file_name, mode=0666) => 0
- *
- * Creates a FIFO special file with name _file_name_. _mode_
- * specifies the FIFO's permissions. It is modified by the process's
- * umask in the usual way: the permissions of the created file are
- * (mode & ~umask).
- */
-
-#ifdef HAVE_MKFIFO
-static VALUE
-rb_file_s_mkfifo(int argc, VALUE *argv)
-{
- VALUE path;
- int mode = 0666;
-
- rb_check_arity(argc, 1, 2);
- if (argc > 1) {
- mode = NUM2INT(argv[1]);
- }
- path = argv[0];
- FilePathValue(path);
- path = rb_str_encode_ospath(path);
- if (mkfifo(RSTRING_PTR(path), mode)) {
- rb_sys_fail_path(path);
- }
- return INT2FIX(0);
-}
-#else
-#define rb_file_s_mkfifo rb_f_notimplement
-#endif
-
VALUE rb_mFConst;
void
@@ -5654,51 +5372,25 @@ rb_path_check(const char *path)
return 1;
}
-int
-ruby_is_fd_loadable(int fd)
-{
-#ifdef _WIN32
- return 1;
-#else
- struct stat st;
-
- if (fstat(fd, &st) < 0)
- return 0;
- if (S_ISREG(st.st_mode))
- return 1;
-
- if (S_ISFIFO(st.st_mode))
- return 1;
-
- if (S_ISDIR(st.st_mode))
- errno = EISDIR;
- else
- errno = ENXIO;
-
- return 0;
-#endif
-}
-
#ifndef _WIN32
+#ifdef __native_client__
+__attribute__((noinline))
+#endif
int
rb_file_load_ok(const char *path)
{
int ret = 1;
- /*
- open(2) may block if path is FIFO and it's empty. Let's use O_NONBLOCK.
- FIXME: Why O_NDELAY is checked?
- */
- int mode = (O_RDONLY |
-#if defined O_NONBLOCK
- O_NONBLOCK |
-#elif defined O_NDELAY
- O_NDELAY |
-#endif
- 0);
- int fd = rb_cloexec_open(path, mode, 0);
+ int fd = rb_cloexec_open(path, O_RDONLY, 0);
if (fd == -1) return 0;
rb_update_max_fd(fd);
- ret = ruby_is_fd_loadable(fd);
+#if !defined DOSISH
+ {
+ struct stat st;
+ if (fstat(fd, &st) || !S_ISREG(st.st_mode)) {
+ ret = 0;
+ }
+ }
+#endif
(void)close(fd);
return ret;
}
@@ -5715,7 +5407,6 @@ is_explicit_relative(const char *path)
static VALUE
copy_path_class(VALUE path, VALUE orig)
{
- str_shrink(path);
RBASIC_SET_CLASS(path, rb_obj_class(orig));
OBJ_FREEZE(path);
return path;
@@ -5788,7 +5479,6 @@ rb_find_file_ext_safe(VALUE *filep, const char *const *ext, int safe_level)
}
rb_str_set_len(fname, fnlen);
}
- rb_str_resize(tmp, 0);
RB_GC_GUARD(load_path);
return 0;
}
@@ -5841,7 +5531,6 @@ rb_find_file_safe(VALUE path, int safe_level)
if (rb_file_load_ok(f)) goto found;
}
}
- rb_str_resize(tmp, 0);
return 0;
}
else {
@@ -5877,7 +5566,7 @@ static const char null_device[] =
/*
* A <code>File</code> is an abstraction of any file object accessible
- * by the program and is closely associated with class <code>IO</code>.
+ * by the program and is closely associated with class <code>IO</code>
* <code>File</code> includes the methods of module
* <code>FileTest</code> as class methods, allowing you to write (for
* example) <code>File.exist?("foo")</code>.
@@ -5953,7 +5642,6 @@ Init_File(void)
rb_define_singleton_method(rb_cFile, "atime", rb_file_s_atime, 1);
rb_define_singleton_method(rb_cFile, "mtime", rb_file_s_mtime, 1);
rb_define_singleton_method(rb_cFile, "ctime", rb_file_s_ctime, 1);
- rb_define_singleton_method(rb_cFile, "birthtime", rb_file_s_birthtime, 1);
rb_define_singleton_method(rb_cFile, "utime", rb_file_s_utime, -1);
rb_define_singleton_method(rb_cFile, "chmod", rb_file_s_chmod, -1);
@@ -5970,7 +5658,6 @@ Init_File(void)
rb_define_singleton_method(rb_cFile, "rename", rb_file_s_rename, 2);
rb_define_singleton_method(rb_cFile, "umask", rb_file_s_umask, -1);
rb_define_singleton_method(rb_cFile, "truncate", rb_file_s_truncate, 2);
- rb_define_singleton_method(rb_cFile, "mkfifo", rb_file_s_mkfifo, -1);
rb_define_singleton_method(rb_cFile, "expand_path", rb_file_s_expand_path, -1);
rb_define_singleton_method(rb_cFile, "absolute_path", rb_file_s_absolute_path, -1);
rb_define_singleton_method(rb_cFile, "realpath", rb_file_s_realpath, -1);
@@ -6002,7 +5689,6 @@ Init_File(void)
rb_define_method(rb_cFile, "atime", rb_file_atime, 0);
rb_define_method(rb_cFile, "mtime", rb_file_mtime, 0);
rb_define_method(rb_cFile, "ctime", rb_file_ctime, 0);
- rb_define_method(rb_cFile, "birthtime", rb_file_birthtime, 0);
rb_define_method(rb_cFile, "size", rb_file_size, 0);
rb_define_method(rb_cFile, "chmod", rb_file_chmod, 1);
@@ -6057,11 +5743,6 @@ Init_File(void)
#endif
/* disable line code conversion */
rb_define_const(rb_mFConst, "BINARY", INT2FIX(O_BINARY));
-#ifndef O_SHARE_DELETE
-# define O_SHARE_DELETE 0
-#endif
- /* can delete opened file */
- rb_define_const(rb_mFConst, "SHARE_DELETE", INT2FIX(O_SHARE_DELETE));
#ifdef O_SYNC
/* any write operation perform synchronously */
rb_define_const(rb_mFConst, "SYNC", INT2FIX(O_SYNC));
@@ -6086,10 +5767,6 @@ Init_File(void)
/* Try to minimize cache effects of the I/O to and from this file. */
rb_define_const(rb_mFConst, "DIRECT", INT2FIX(O_DIRECT));
#endif
-#ifdef O_TMPFILE
- /* Create an unnamed temporary file */
- rb_define_const(rb_mFConst, "TMPFILE", INT2FIX(O_TMPFILE));
-#endif
/* shared lock. see File#flock */
rb_define_const(rb_mFConst, "LOCK_SH", INT2FIX(LOCK_SH));
@@ -6133,7 +5810,6 @@ Init_File(void)
rb_define_method(rb_cStat, "atime", rb_stat_atime, 0);
rb_define_method(rb_cStat, "mtime", rb_stat_mtime, 0);
rb_define_method(rb_cStat, "ctime", rb_stat_ctime, 0);
- rb_define_method(rb_cStat, "birthtime", rb_stat_birthtime, 0);
rb_define_method(rb_cStat, "inspect", rb_stat_inspect, 0);
diff --git a/gc.c b/gc.c
index 5d73a7e157..5478ddd54e 100644
--- a/gc.c
+++ b/gc.c
@@ -11,10 +11,7 @@
**********************************************************************/
-#define rb_data_object_alloc rb_data_object_alloc
-#define rb_data_typed_object_alloc rb_data_typed_object_alloc
-
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/re.h"
#include "ruby/io.h"
@@ -23,35 +20,30 @@
#include "ruby/debug.h"
#include "eval_intern.h"
#include "vm_core.h"
+#include "internal.h"
#include "gc.h"
#include "constant.h"
#include "ruby_atomic.h"
#include "probes.h"
-#include "id_table.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include <assert.h>
-#undef rb_data_object_wrap
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
#ifndef HAVE_MALLOC_USABLE_SIZE
# ifdef _WIN32
-# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) _msize(a)
-# elif defined HAVE_MALLOC_SIZE
-# define HAVE_MALLOC_USABLE_SIZE
-# define malloc_usable_size(a) malloc_size(a)
# endif
-#endif
-#ifdef HAVE_MALLOC_USABLE_SIZE
+#else
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# elif defined(HAVE_MALLOC_NP_H)
# include <malloc_np.h>
-# elif defined(HAVE_MALLOC_MALLOC_H)
-# include <malloc/malloc.h>
# endif
#endif
@@ -89,39 +81,25 @@
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
-#if defined(HAVE_RB_GC_GUARDED_PTR_VAL) && HAVE_RB_GC_GUARDED_PTR_VAL
-/* trick the compiler into thinking a external signal handler uses this */
-volatile VALUE rb_gc_guarded_val;
+#if defined(HAVE_RB_GC_GUARDED_PTR) && HAVE_RB_GC_GUARDED_PTR
volatile VALUE *
-rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
+rb_gc_guarded_ptr(volatile VALUE *ptr)
{
- rb_gc_guarded_val = val;
-
return ptr;
}
#endif
-#ifndef GC_HEAP_INIT_SLOTS
-#define GC_HEAP_INIT_SLOTS 10000
+#ifndef GC_HEAP_MIN_FREE_SLOTS
+#define GC_HEAP_MIN_FREE_SLOTS 4096
#endif
-#ifndef GC_HEAP_FREE_SLOTS
-#define GC_HEAP_FREE_SLOTS 4096
+#ifndef GC_HEAP_MIN_SLOTS
+#define GC_HEAP_MIN_SLOTS 10000
#endif
#ifndef GC_HEAP_GROWTH_FACTOR
#define GC_HEAP_GROWTH_FACTOR 1.8
#endif
-#ifndef GC_HEAP_GROWTH_MAX_SLOTS
-#define GC_HEAP_GROWTH_MAX_SLOTS 0 /* 0 is disable */
-#endif
-#ifndef GC_HEAP_OLDOBJECT_LIMIT_FACTOR
-#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR 2.0
-#endif
-
-#ifndef GC_HEAP_FREE_SLOTS_MIN_RATIO
-#define GC_HEAP_FREE_SLOTS_MIN_RATIO 0.3
-#endif
-#ifndef GC_HEAP_FREE_SLOTS_MAX_RATIO
-#define GC_HEAP_FREE_SLOTS_MAX_RATIO 0.8
+#ifndef GC_HEAP_GROWTH_MAX
+#define GC_HEAP_GROWTH_MAX 0 /* 0 is disable */
#endif
#ifndef GC_MALLOC_LIMIT_MIN
@@ -134,57 +112,46 @@ rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
#define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.4
#endif
-#ifndef GC_OLDMALLOC_LIMIT_MIN
-#define GC_OLDMALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
+#ifndef GC_OLDSPACE_LIMIT_MIN
+#define GC_OLDSPACE_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
#endif
-#ifndef GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
-#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR 1.2
+#ifndef GC_OLDSPACE_LIMIT_GROWTH_FACTOR
+#define GC_OLDSPACE_LIMIT_GROWTH_FACTOR 1.2
#endif
-#ifndef GC_OLDMALLOC_LIMIT_MAX
-#define GC_OLDMALLOC_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)
+#ifndef GC_OLDSPACE_LIMIT_MAX
+#define GC_OLDSPACE_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)
#endif
-#ifndef PRINT_MEASURE_LINE
-#define PRINT_MEASURE_LINE 0
-#endif
-#ifndef PRINT_ENTER_EXIT_TICK
-#define PRINT_ENTER_EXIT_TICK 0
-#endif
-#ifndef PRINT_ROOT_TICKS
-#define PRINT_ROOT_TICKS 0
-#endif
-
-#define USE_TICK_T (PRINT_ENTER_EXIT_TICK || PRINT_MEASURE_LINE || PRINT_ROOT_TICKS)
-#define TICK_TYPE 1
-
typedef struct {
- size_t heap_init_slots;
- size_t heap_free_slots;
+ unsigned int heap_min_slots;
+ unsigned int heap_min_free_slots;
double growth_factor;
- size_t growth_max_slots;
- double oldobject_limit_factor;
- size_t malloc_limit_min;
- size_t malloc_limit_max;
+ unsigned int growth_max;
+ unsigned int malloc_limit_min;
+ unsigned int malloc_limit_max;
double malloc_limit_growth_factor;
- size_t oldmalloc_limit_min;
- size_t oldmalloc_limit_max;
- double oldmalloc_limit_growth_factor;
+ unsigned int oldspace_limit_min;
+ unsigned int oldspace_limit_max;
+ double oldspace_limit_growth_factor;
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
VALUE gc_stress;
+#endif
} ruby_gc_params_t;
static ruby_gc_params_t gc_params = {
- GC_HEAP_INIT_SLOTS,
- GC_HEAP_FREE_SLOTS,
+ GC_HEAP_MIN_SLOTS,
+ GC_HEAP_MIN_FREE_SLOTS,
GC_HEAP_GROWTH_FACTOR,
- GC_HEAP_GROWTH_MAX_SLOTS,
- GC_HEAP_OLDOBJECT_LIMIT_FACTOR,
+ GC_HEAP_GROWTH_MAX,
GC_MALLOC_LIMIT_MIN,
GC_MALLOC_LIMIT_MAX,
GC_MALLOC_LIMIT_GROWTH_FACTOR,
- GC_OLDMALLOC_LIMIT_MIN,
- GC_OLDMALLOC_LIMIT_MAX,
- GC_OLDMALLOC_LIMIT_GROWTH_FACTOR,
+ GC_OLDSPACE_LIMIT_MIN,
+ GC_OLDSPACE_LIMIT_MAX,
+ GC_OLDSPACE_LIMIT_GROWTH_FACTOR,
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
FALSE,
+#endif
};
/* GC_DEBUG:
@@ -209,25 +176,13 @@ static ruby_gc_params_t gc_params = {
/* RGENGC_CHECK_MODE
* 0: disable all assertions
* 1: enable assertions (to debug RGenGC)
- * 2: enable internal consistency check at each GC (for debugging)
- * 3: enable internal consistency check at each GC steps (for debugging)
- * 4: enable liveness check
- * 5: show all references
+ * 2: enable bits check (for debugging)
+ * 3: show all references
*/
#ifndef RGENGC_CHECK_MODE
#define RGENGC_CHECK_MODE 0
#endif
-/* RGENGC_OLD_NEWOBJ_CHECK
- * 0: disable all assertions
- * >0: make a OLD object when new object creation.
- *
- * Make one OLD object per RGENGC_OLD_NEWOBJ_CHECK WB protected objects creation.
- */
-#ifndef RGENGC_OLD_NEWOBJ_CHECK
-#define RGENGC_OLD_NEWOBJ_CHECK 0
-#endif
-
/* RGENGC_PROFILE
* 0: disable RGenGC profiling
* 1: enable profiling for basic information
@@ -237,36 +192,32 @@ static ruby_gc_params_t gc_params = {
#define RGENGC_PROFILE 0
#endif
-/* RGENGC_ESTIMATE_OLDMALLOC
- * Enable/disable to estimate increase size of malloc'ed size by old objects.
- * If estimation exceeds threshold, then will invoke full GC.
- * 0: disable estimation.
- * 1: enable estimation.
+/* RGENGC_THREEGEN
+ * Enable/disable three gen GC.
+ * 0: Infant gen -> Old gen
+ * 1: Infant gen -> Young -> Old gen
*/
-#ifndef RGENGC_ESTIMATE_OLDMALLOC
-#define RGENGC_ESTIMATE_OLDMALLOC 1
+#ifndef RGENGC_THREEGEN
+#define RGENGC_THREEGEN 0
#endif
-/* RGENGC_FORCE_MAJOR_GC
- * Force major/full GC if this macro is not 0.
+/* RGENGC_ESTIMATE_OLDSPACE
+ * Enable/disable to estimate increase size of oldspace.
+ * If estimation exceeds threashold, then will invoke full GC.
+ * 0: disable estimation.
+ * 1: enable estimation.
*/
-#ifndef RGENGC_FORCE_MAJOR_GC
-#define RGENGC_FORCE_MAJOR_GC 0
+#ifndef RGENGC_ESTIMATE_OLDSPACE
+#define RGENGC_ESTIMATE_OLDSPACE 1
#endif
#else /* USE_RGENGC */
-#ifdef RGENGC_DEBUG
-#undef RGENGC_DEBUG
-#endif
#define RGENGC_DEBUG 0
-#ifdef RGENGC_CHECK_MODE
-#undef RGENGC_CHECK_MODE
-#endif
#define RGENGC_CHECK_MODE 0
#define RGENGC_PROFILE 0
-#define RGENGC_ESTIMATE_OLDMALLOC 0
-#define RGENGC_FORCE_MAJOR_GC 0
+#define RGENGC_THREEGEN 0
+#define RGENGC_ESTIMATE_OLDSPACE 0
#endif /* USE_RGENGC */
@@ -276,56 +227,37 @@ static ruby_gc_params_t gc_params = {
#ifndef GC_PROFILE_DETAIL_MEMORY
#define GC_PROFILE_DETAIL_MEMORY 0
#endif
-#ifndef GC_ENABLE_INCREMENTAL_MARK
-#define GC_ENABLE_INCREMENTAL_MARK USE_RINCGC
-#endif
#ifndef GC_ENABLE_LAZY_SWEEP
#define GC_ENABLE_LAZY_SWEEP 1
#endif
#ifndef CALC_EXACT_MALLOC_SIZE
#define CALC_EXACT_MALLOC_SIZE 0
#endif
-#if defined(HAVE_MALLOC_USABLE_SIZE) || CALC_EXACT_MALLOC_SIZE > 0
-#ifndef MALLOC_ALLOCATED_SIZE
-#define MALLOC_ALLOCATED_SIZE 0
-#endif
-#else
-#define MALLOC_ALLOCATED_SIZE 0
-#endif
-#ifndef MALLOC_ALLOCATED_SIZE_CHECK
-#define MALLOC_ALLOCATED_SIZE_CHECK 0
-#endif
-
-#ifndef GC_DEBUG_STRESS_TO_CLASS
-#define GC_DEBUG_STRESS_TO_CLASS 0
-#endif
-
-#ifndef RGENGC_OBJ_INFO
-#define RGENGC_OBJ_INFO (RGENGC_DEBUG | RGENGC_CHECK_MODE)
+#ifndef CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE
+#define CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE 0
#endif
typedef enum {
- GPR_FLAG_NONE = 0x000,
+ GPR_FLAG_NONE = 0x000,
/* major reason */
- GPR_FLAG_MAJOR_BY_NOFREE = 0x001,
- GPR_FLAG_MAJOR_BY_OLDGEN = 0x002,
- GPR_FLAG_MAJOR_BY_SHADY = 0x004,
- GPR_FLAG_MAJOR_BY_FORCE = 0x008,
-#if RGENGC_ESTIMATE_OLDMALLOC
- GPR_FLAG_MAJOR_BY_OLDMALLOC = 0x020,
-#endif
- GPR_FLAG_MAJOR_MASK = 0x0ff,
+ GPR_FLAG_MAJOR_BY_NOFREE = 0x001,
+ GPR_FLAG_MAJOR_BY_OLDGEN = 0x002,
+ GPR_FLAG_MAJOR_BY_SHADY = 0x004,
+ GPR_FLAG_MAJOR_BY_RESCAN = 0x008,
+ GPR_FLAG_MAJOR_BY_STRESS = 0x010,
+ GPR_FLAG_MAJOR_MASK = 0x01f,
/* gc reason */
- GPR_FLAG_NEWOBJ = 0x100,
- GPR_FLAG_MALLOC = 0x200,
- GPR_FLAG_METHOD = 0x400,
- GPR_FLAG_CAPI = 0x800,
- GPR_FLAG_STRESS = 0x1000,
+ GPR_FLAG_NEWOBJ = 0x020,
+ GPR_FLAG_MALLOC = 0x040,
+ GPR_FLAG_METHOD = 0x080,
+ GPR_FLAG_CAPI = 0x100,
+ GPR_FLAG_STRESS = 0x200,
/* others */
- GPR_FLAG_IMMEDIATE_SWEEP = 0x2000,
- GPR_FLAG_HAVE_FINALIZE = 0x4000
+ GPR_FLAG_IMMEDIATE_SWEEP = 0x400,
+ GPR_FLAG_HAVE_FINALIZE = 0x800
+
} gc_profile_record_flag;
typedef struct gc_profile_record {
@@ -358,7 +290,7 @@ typedef struct gc_profile_record {
long majflt;
#endif
#endif
-#if MALLOC_ALLOCATED_SIZE
+#if CALC_EXACT_MALLOC_SIZE
size_t allocated_size;
#endif
@@ -369,7 +301,7 @@ typedef struct gc_profile_record {
#endif
} gc_profile_record;
-#if defined(_MSC_VER) || defined(__CYGWIN__)
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__)
#pragma pack(push, 1) /* magic for reducing sizeof(RVALUE): 24 -> 20 */
#endif
@@ -396,15 +328,6 @@ typedef struct RVALUE {
struct RMatch match;
struct RRational rational;
struct RComplex complex;
- union {
- rb_cref_t cref;
- struct vm_svar svar;
- struct vm_throw_data throw_data;
- struct vm_ifunc ifunc;
- struct MEMO memo;
- struct rb_method_entry_struct ment;
- const rb_iseq_t iseq;
- } imemo;
struct {
struct RBasic basic;
VALUE v1;
@@ -414,11 +337,11 @@ typedef struct RVALUE {
} as;
#if GC_DEBUG
const char *file;
- int line;
+ VALUE line;
#endif
} RVALUE;
-#if defined(_MSC_VER) || defined(__CYGWIN__)
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__)
#pragma pack(pop)
#endif
@@ -453,97 +376,63 @@ typedef struct stack_chunk {
typedef struct mark_stack {
stack_chunk_t *chunk;
stack_chunk_t *cache;
- int index;
- int limit;
+ size_t index;
+ size_t limit;
size_t cache_size;
size_t unused_cache_size;
} mark_stack_t;
typedef struct rb_heap_struct {
- RVALUE *freelist;
-
+ struct heap_page *pages;
struct heap_page *free_pages;
struct heap_page *using_page;
- struct heap_page *pages;
struct heap_page *sweep_pages;
-#if GC_ENABLE_INCREMENTAL_MARK
- struct heap_page *pooled_pages;
-#endif
- size_t page_length; /* total page count in a heap */
- size_t total_slots; /* total slot count (page_length * HEAP_OBJ_LIMIT) */
+ RVALUE *freelist;
+ size_t used; /* total page count in a heap */
+ size_t limit;
} rb_heap_t;
-enum gc_stat {
- gc_stat_none,
- gc_stat_marking,
- gc_stat_sweeping
-};
-
typedef struct rb_objspace {
struct {
size_t limit;
size_t increase;
-#if MALLOC_ALLOCATED_SIZE
+#if CALC_EXACT_MALLOC_SIZE
size_t allocated_size;
size_t allocations;
#endif
} malloc_params;
- struct {
- enum gc_stat stat : 2;
- unsigned int immediate_sweep : 1;
- unsigned int dont_gc : 1;
- unsigned int dont_incremental : 1;
- unsigned int during_gc : 1;
- unsigned int gc_stressful: 1;
- unsigned int has_hook: 1;
-#if USE_RGENGC
- unsigned int during_minor_gc : 1;
-#endif
-#if GC_ENABLE_INCREMENTAL_MARK
- unsigned int during_incremental_marking : 1;
-#endif
- } flags;
-
- rb_event_flag_t hook_events;
- size_t total_allocated_objects;
-
rb_heap_t eden_heap;
rb_heap_t tomb_heap; /* heap for zombies and ghosts */
struct {
- rb_atomic_t finalizing;
- } atomic_flags;
-
- struct mark_func_data_struct {
- void *data;
- void (*mark_func)(VALUE v, void *data);
- } *mark_func_data;
-
- mark_stack_t mark_stack;
- size_t marked_slots;
-
- struct {
struct heap_page **sorted;
- size_t allocated_pages;
- size_t allocatable_pages;
- size_t sorted_length;
+ size_t used;
+ size_t length;
RVALUE *range[2];
- size_t swept_slots;
+ size_t limit;
+ size_t swept_num;
+ size_t increment;
+
size_t min_free_slots;
size_t max_free_slots;
/* final */
- size_t final_slots;
- VALUE deferred_final;
+ size_t final_num;
+ RVALUE *deferred_final;
} heap_pages;
+ struct {
+ int dont_gc;
+ int dont_lazy_sweep;
+ int during_gc;
+ rb_atomic_t finalizing;
+ } flags;
st_table *finalizer_table;
-
+ mark_stack_t mark_stack;
struct {
int run;
- int latest_gc_info;
gc_profile_record *records;
gc_profile_record *current_record;
size_t next_index;
@@ -558,18 +447,24 @@ typedef struct rb_objspace {
size_t minor_gc_count;
size_t major_gc_count;
#if RGENGC_PROFILE > 0
- size_t total_generated_normal_object_count;
- size_t total_generated_shady_object_count;
- size_t total_shade_operation_count;
- size_t total_promoted_count;
- size_t total_remembered_normal_object_count;
- size_t total_remembered_shady_object_count;
+ size_t generated_normal_object_count;
+ size_t generated_shady_object_count;
+ size_t shade_operation_count;
+ size_t promote_infant_count;
+#if RGENGC_THREEGEN
+ size_t promote_young_count;
+#endif
+ size_t remembered_normal_object_count;
+ size_t remembered_shady_object_count;
#if RGENGC_PROFILE >= 2
size_t generated_normal_object_count_types[RUBY_T_MASK];
size_t generated_shady_object_count_types[RUBY_T_MASK];
size_t shade_operation_count_types[RUBY_T_MASK];
- size_t promoted_types[RUBY_T_MASK];
+ size_t promote_infant_types[RUBY_T_MASK];
+#if RGENGC_THREEGEN
+ size_t promote_young_types[RUBY_T_MASK];
+#endif
size_t remembered_normal_object_count_types[RUBY_T_MASK];
size_t remembered_shady_object_count_types[RUBY_T_MASK];
#endif
@@ -578,32 +473,40 @@ typedef struct rb_objspace {
/* temporary profiling space */
double gc_sweep_start_time;
- size_t total_allocated_objects_at_gc_start;
+ size_t total_allocated_object_num_at_gc_start;
size_t heap_used_at_gc_start;
/* basic statistics */
size_t count;
- size_t total_freed_objects;
- size_t total_allocated_pages;
- size_t total_freed_pages;
+ size_t total_allocated_object_num;
+ size_t total_freed_object_num;
} profile;
struct gc_list *global_list;
+ rb_event_flag_t hook_events; /* this place may be affinity with memory cache */
+ VALUE gc_stress;
- VALUE gc_stress_mode;
+ struct mark_func_data_struct {
+ void *data;
+ void (*mark_func)(VALUE v, void *data);
+ } *mark_func_data;
#if USE_RGENGC
struct {
- VALUE parent_object;
+ int during_minor_gc;
+ int parent_object_is_old;
+
int need_major_gc;
- size_t last_major_gc;
- size_t uncollectible_wb_unprotected_objects;
- size_t uncollectible_wb_unprotected_objects_limit;
- size_t old_objects;
- size_t old_objects_limit;
+ size_t remembered_shady_object_count;
+ size_t remembered_shady_object_limit;
+ size_t old_object_count;
+ size_t old_object_limit;
+#if RGENGC_THREEGEN
+ size_t young_object_count;
+#endif
-#if RGENGC_ESTIMATE_OLDMALLOC
- size_t oldmalloc_increase;
- size_t oldmalloc_increase_limit;
+#if RGENGC_ESTIMATE_OLDSPACE
+ size_t oldspace_increase;
+ size_t oldspace_increase_limit;
#endif
#if RGENGC_CHECK_MODE >= 2
@@ -611,17 +514,7 @@ typedef struct rb_objspace {
size_t error_count;
#endif
} rgengc;
-#if GC_ENABLE_INCREMENTAL_MARK
- struct {
- size_t pooled_slots;
- size_t step_slots;
- } rincgc;
-#endif
#endif /* USE_RGENGC */
-
-#if GC_DEBUG_STRESS_TO_CLASS
- VALUE stress_to_class;
-#endif
} rb_objspace_t;
@@ -643,115 +536,74 @@ enum {
struct heap_page {
struct heap_page_body *body;
- struct heap_page *prev;
- rb_heap_t *heap;
- int total_slots;
- int free_slots;
- int final_slots;
- struct {
- unsigned int before_sweep : 1;
- unsigned int has_remembered_objects : 1;
- unsigned int has_uncollectible_shady_objects : 1;
- } flags;
-
- struct heap_page *free_next;
- RVALUE *start;
RVALUE *freelist;
+ RVALUE *start;
+ size_t final_num;
+ size_t limit;
struct heap_page *next;
+ struct heap_page *prev;
+ struct heap_page *free_next;
+ rb_heap_t *heap;
+ int before_sweep;
-#if USE_RGENGC
- bits_t wb_unprotected_bits[HEAP_BITMAP_LIMIT];
-#endif
- /* the following three bitmaps are cleared at the beginning of full GC */
bits_t mark_bits[HEAP_BITMAP_LIMIT];
#if USE_RGENGC
- bits_t uncollectible_bits[HEAP_BITMAP_LIMIT];
- bits_t marking_bits[HEAP_BITMAP_LIMIT];
+ bits_t rememberset_bits[HEAP_BITMAP_LIMIT];
+ bits_t oldgen_bits[HEAP_BITMAP_LIMIT];
#endif
};
-#define GET_PAGE_BODY(x) ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_ALIGN_MASK)))
-#define GET_PAGE_HEADER(x) (&GET_PAGE_BODY(x)->header)
-#define GET_HEAP_PAGE(x) (GET_PAGE_HEADER(x)->page)
-
-#define NUM_IN_PAGE(p) (((bits_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE))
-#define BITMAP_INDEX(p) (NUM_IN_PAGE(p) / BITS_BITLENGTH )
-#define BITMAP_OFFSET(p) (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))
-#define BITMAP_BIT(p) ((bits_t)1 << BITMAP_OFFSET(p))
-
+#define GET_PAGE_BODY(x) ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_ALIGN_MASK)))
+#define GET_PAGE_HEADER(x) (&GET_PAGE_BODY(x)->header)
+#define GET_HEAP_PAGE(x) (GET_PAGE_HEADER(x)->page)
+#define GET_HEAP_MARK_BITS(x) (&GET_HEAP_PAGE(x)->mark_bits[0])
+#define GET_HEAP_REMEMBERSET_BITS(x) (&GET_HEAP_PAGE(x)->rememberset_bits[0])
+#define GET_HEAP_OLDGEN_BITS(x) (&GET_HEAP_PAGE(x)->oldgen_bits[0])
+#define NUM_IN_PAGE(p) (((bits_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE))
+#define BITMAP_INDEX(p) (NUM_IN_PAGE(p) / BITS_BITLENGTH )
+#define BITMAP_OFFSET(p) (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))
+#define BITMAP_BIT(p) ((bits_t)1 << BITMAP_OFFSET(p))
/* Bitmap Operations */
#define MARKED_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))
#define MARK_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))
#define CLEAR_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))
-/* getting bitmap */
-#define GET_HEAP_MARK_BITS(x) (&GET_HEAP_PAGE(x)->mark_bits[0])
-#if USE_RGENGC
-#define GET_HEAP_UNCOLLECTIBLE_BITS(x) (&GET_HEAP_PAGE(x)->uncollectible_bits[0])
-#define GET_HEAP_WB_UNPROTECTED_BITS(x) (&GET_HEAP_PAGE(x)->wb_unprotected_bits[0])
-#define GET_HEAP_MARKING_BITS(x) (&GET_HEAP_PAGE(x)->marking_bits[0])
-#endif
-
/* Aliases */
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
#define rb_objspace (*GET_VM()->objspace)
+#define ruby_initial_gc_stress gc_params.gc_stress
+VALUE *ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress;
#else
static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT_MIN}};
+VALUE *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#endif
-#define ruby_initial_gc_stress gc_params.gc_stress
-
-VALUE *ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress;
-
#define malloc_limit objspace->malloc_params.limit
#define malloc_increase objspace->malloc_params.increase
#define malloc_allocated_size objspace->malloc_params.allocated_size
#define heap_pages_sorted objspace->heap_pages.sorted
-#define heap_allocated_pages objspace->heap_pages.allocated_pages
-#define heap_pages_sorted_length objspace->heap_pages.sorted_length
+#define heap_pages_used objspace->heap_pages.used
+#define heap_pages_length objspace->heap_pages.length
#define heap_pages_lomem objspace->heap_pages.range[0]
#define heap_pages_himem objspace->heap_pages.range[1]
-#define heap_pages_swept_slots objspace->heap_pages.swept_slots
-#define heap_allocatable_pages objspace->heap_pages.allocatable_pages
+#define heap_pages_swept_num objspace->heap_pages.swept_num
+#define heap_pages_increment objspace->heap_pages.increment
#define heap_pages_min_free_slots objspace->heap_pages.min_free_slots
#define heap_pages_max_free_slots objspace->heap_pages.max_free_slots
-#define heap_pages_final_slots objspace->heap_pages.final_slots
+#define heap_pages_final_num objspace->heap_pages.final_num
#define heap_pages_deferred_final objspace->heap_pages.deferred_final
#define heap_eden (&objspace->eden_heap)
#define heap_tomb (&objspace->tomb_heap)
#define dont_gc objspace->flags.dont_gc
#define during_gc objspace->flags.during_gc
-#define finalizing objspace->atomic_flags.finalizing
+#define finalizing objspace->flags.finalizing
#define finalizer_table objspace->finalizer_table
-#define global_list objspace->global_list
-#define ruby_gc_stressful objspace->flags.gc_stressful
-#define ruby_gc_stress_mode objspace->gc_stress_mode
-#if GC_DEBUG_STRESS_TO_CLASS
-#define stress_to_class objspace->stress_to_class
-#else
-#define stress_to_class 0
-#endif
-
-#define is_marking(objspace) ((objspace)->flags.stat == gc_stat_marking)
-#define is_sweeping(objspace) ((objspace)->flags.stat == gc_stat_sweeping)
-#if USE_RGENGC
-#define is_full_marking(objspace) ((objspace)->flags.during_minor_gc == FALSE)
-#else
-#define is_full_marking(objspace) TRUE
-#endif
-#if GC_ENABLE_INCREMENTAL_MARK
-#define is_incremental_marking(objspace) ((objspace)->flags.during_incremental_marking != FALSE)
-#else
-#define is_incremental_marking(objspace) FALSE
-#endif
-#if GC_ENABLE_INCREMENTAL_MARK
-#define will_be_incremental_marking(objspace) ((objspace)->rgengc.need_major_gc != GPR_FLAG_NONE)
-#else
-#define will_be_incremental_marking(objspace) FALSE
-#endif
-#define has_sweeping_pages(heap) ((heap)->sweep_pages != 0)
-#define is_lazy_sweeping(heap) (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap))
+#define global_List objspace->global_list
+#define ruby_gc_stress objspace->gc_stress
+#define monitor_level objspace->rgengc.monitor_level
+#define monitored_object_table objspace->rgengc.monitored_object_table
+#define is_lazy_sweeping(heap) ((heap)->sweep_pages != 0)
#if SIZEOF_LONG == SIZEOF_VOIDP
# define nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
# define obj_id_to_ref(objid) ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */
@@ -765,23 +617,11 @@ VALUE *ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress;
#define RANY(o) ((RVALUE*)(o))
-struct RZombie {
- struct RBasic basic;
- VALUE next;
- void (*dfree)(void *);
- void *data;
-};
-
-#define RZOMBIE(o) ((struct RZombie *)(o))
-
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
int ruby_gc_debug_indent = 0;
VALUE rb_mGC;
-int ruby_disable_gc = 0;
-
-void rb_iseq_mark(const rb_iseq_t *iseq);
-void rb_iseq_free(const rb_iseq_t *iseq);
+int ruby_disable_gc_stress = 0;
void rb_gcdebug_print_obj_condition(VALUE obj);
@@ -794,56 +634,21 @@ static void aligned_free(void *);
static void init_mark_stack(mark_stack_t *stack);
+static VALUE lazy_sweep_enable(void);
static int ready_to_gc(rb_objspace_t *objspace);
-
-static int garbage_collect(rb_objspace_t *, int full_mark, int immediate_mark, int immediate_sweep, int reason);
-
-static int gc_start(rb_objspace_t *objspace, const int full_mark, const int immediate_mark, const unsigned int immediate_sweep, int reason);
-static void gc_rest(rb_objspace_t *objspace);
-static inline void gc_enter(rb_objspace_t *objspace, const char *event);
-static inline void gc_exit(rb_objspace_t *objspace, const char *event);
-
-static void gc_marks(rb_objspace_t *objspace, int full_mark);
-static void gc_marks_start(rb_objspace_t *objspace, int full);
-static int gc_marks_finish(rb_objspace_t *objspace);
-static void gc_marks_rest(rb_objspace_t *objspace);
-#if GC_ENABLE_INCREMENTAL_MARK
-static void gc_marks_step(rb_objspace_t *objspace, int slots);
-static void gc_marks_continue(rb_objspace_t *objspace, rb_heap_t *heap);
-#endif
-
-static void gc_sweep(rb_objspace_t *objspace);
-static void gc_sweep_start(rb_objspace_t *objspace);
-static void gc_sweep_finish(rb_objspace_t *objspace);
-static int gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap);
-static void gc_sweep_rest(rb_objspace_t *objspace);
-#if GC_ENABLE_LAZY_SWEEP
-static void gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap);
-#endif
-
+static int heap_ready_to_gc(rb_objspace_t *objspace, rb_heap_t *heap);
+static int garbage_collect(rb_objspace_t *, int full_mark, int immediate_sweep, int reason);
+static int garbage_collect_body(rb_objspace_t *, int full_mark, int immediate_sweep, int reason);
+static int gc_heap_lazy_sweep(rb_objspace_t *objspace, rb_heap_t *heap);
+static void gc_rest_sweep(rb_objspace_t *objspace);
+static void gc_heap_rest_sweep(rb_objspace_t *objspace, rb_heap_t *heap);
+
+static void gc_mark_stacked_objects(rb_objspace_t *);
static void gc_mark(rb_objspace_t *objspace, VALUE ptr);
-static void gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr);
static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr);
static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr);
-static int gc_mark_stacked_objects_incremental(rb_objspace_t *, size_t count);
-static int gc_mark_stacked_objects_all(rb_objspace_t *);
-static void gc_grey(rb_objspace_t *objspace, VALUE ptr);
-
-static inline int gc_mark_set(rb_objspace_t *objspace, VALUE obj);
-static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr);
-
-static void push_mark_stack(mark_stack_t *, VALUE);
-static int pop_mark_stack(mark_stack_t *, VALUE *);
-static size_t mark_stack_size(mark_stack_t *stack);
-static void shrink_stack_chunk_cache(mark_stack_t *stack);
-
-static size_t obj_memsize_of(VALUE obj, int use_all_types);
-static VALUE gc_verify_internal_consistency(VALUE self);
-static int gc_verify_heap_page(rb_objspace_t *objspace, struct heap_page *page, VALUE obj);
-static int gc_verify_heap_pages(rb_objspace_t *objspace);
-
-static void gc_stress_set(rb_objspace_t *objspace, VALUE flag);
+static size_t obj_memsize_of(VALUE obj, int use_tdata);
static double getrusage_time(void);
static inline void gc_prof_setup_new_record(rb_objspace_t *objspace, int reason);
@@ -857,398 +662,177 @@ static inline void gc_prof_set_malloc_info(rb_objspace_t *);
static inline void gc_prof_set_heap_info(rb_objspace_t *);
#define gc_prof_record(objspace) (objspace)->profile.current_record
-#define gc_prof_enabled(objspace) ((objspace)->profile.run && (objspace)->profile.current_record)
-
-#ifdef HAVE_VA_ARGS_MACRO
-# define gc_report(level, objspace, fmt, ...) \
- if ((level) > RGENGC_DEBUG) {} else gc_report_body(level, objspace, fmt, ##__VA_ARGS__)
-#else
-# define gc_report if (!(RGENGC_DEBUG)) {} else gc_report_body
-#endif
-PRINTF_ARGS(static void gc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...), 3, 4);
-static const char *obj_info(VALUE obj);
-
-#define PUSH_MARK_FUNC_DATA(v) do { \
- struct mark_func_data_struct *prev_mark_func_data = objspace->mark_func_data; \
- objspace->mark_func_data = (v);
-
-#define POP_MARK_FUNC_DATA() objspace->mark_func_data = prev_mark_func_data;} while (0)
-
-/*
- * 1 - TSC (H/W Time Stamp Counter)
- * 2 - getrusage
- */
-#ifndef TICK_TYPE
-#define TICK_TYPE 1
-#endif
-
-#if USE_TICK_T
-
-#if TICK_TYPE == 1
-/* the following code is only for internal tuning. */
-
-/* Source code to use RDTSC is quoted and modified from
- * http://www.mcs.anl.gov/~kazutomo/rdtsc.html
- * written by Kazutomo Yoshii <kazutomo@mcs.anl.gov>
- */
-
-#if defined(__GNUC__) && defined(__i386__)
-typedef unsigned long long tick_t;
-#define PRItick "llu"
-static inline tick_t
-tick(void)
-{
- unsigned long long int x;
- __asm__ __volatile__ ("rdtsc" : "=A" (x));
- return x;
-}
-
-#elif defined(__GNUC__) && defined(__x86_64__)
-typedef unsigned long long tick_t;
-#define PRItick "llu"
-
-static __inline__ tick_t
-tick(void)
-{
- unsigned long hi, lo;
- __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
- return ((unsigned long long)lo)|( ((unsigned long long)hi)<<32);
-}
-
-#elif defined(_WIN32) && defined(_MSC_VER)
-#include <intrin.h>
-typedef unsigned __int64 tick_t;
-#define PRItick "llu"
-
-static inline tick_t
-tick(void)
-{
- return __rdtsc();
-}
-
-#else /* use clock */
-typedef clock_t tick_t;
-#define PRItick "llu"
-
-static inline tick_t
-tick(void)
-{
- return clock();
-}
-#endif /* TSC */
-
-#elif TICK_TYPE == 2
-typedef double tick_t;
-#define PRItick "4.9f"
-
-static inline tick_t
-tick(void)
-{
- return getrusage_time();
-}
-#else /* TICK_TYPE */
-#error "choose tick type"
-#endif /* TICK_TYPE */
-
-#define MEASURE_LINE(expr) do { \
- volatile tick_t start_time = tick(); \
- volatile tick_t end_time; \
- expr; \
- end_time = tick(); \
- fprintf(stderr, "0\t%"PRItick"\t%s\n", end_time - start_time, #expr); \
-} while (0)
-
-#else /* USE_TICK_T */
-#define MEASURE_LINE(expr) expr
-#endif /* USE_TICK_T */
-
-#define FL_TEST2(x,f) ((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? (rb_bug("FL_TEST2: SPECIAL_CONST (%p)", (void *)(x)), 0) : FL_TEST_RAW((x),(f)) != 0)
-#define FL_SET2(x,f) do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_SET2: SPECIAL_CONST"); RBASIC(x)->flags |= (f);} while (0)
-#define FL_UNSET2(x,f) do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_UNSET2: SPECIAL_CONST"); RBASIC(x)->flags &= ~(f);} while (0)
-#define RVALUE_MARK_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), (obj))
-#define RVALUE_PAGE_MARKED(page, obj) MARKED_IN_BITMAP((page)->mark_bits, (obj))
+#define rgengc_report if (RGENGC_DEBUG) rgengc_report_body
+static void rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...);
+static const char * type_name(int type, VALUE obj);
+static const char *obj_type_name(VALUE obj);
#if USE_RGENGC
-#define RVALUE_WB_UNPROTECTED_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj))
-#define RVALUE_UNCOLLECTIBLE_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj))
-#define RVALUE_MARKING_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj))
-
-#define RVALUE_PAGE_WB_UNPROTECTED(page, obj) MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj))
-#define RVALUE_PAGE_UNCOLLECTIBLE(page, obj) MARKED_IN_BITMAP((page)->uncollectible_bits, (obj))
-#define RVALUE_PAGE_MARKING(page, obj) MARKED_IN_BITMAP((page)->marking_bits, (obj))
-
-#define RVALUE_OLD_AGE 3
-#define RVALUE_AGE_SHIFT 5 /* FL_PROMOTED0 bit */
-
static int rgengc_remembered(rb_objspace_t *objspace, VALUE obj);
static int rgengc_remember(rb_objspace_t *objspace, VALUE obj);
static void rgengc_mark_and_rememberset_clear(rb_objspace_t *objspace, rb_heap_t *heap);
static void rgengc_rememberset_mark(rb_objspace_t *objspace, rb_heap_t *heap);
-static inline int
-RVALUE_FLAGS_AGE(VALUE flags)
-{
- return (int)((flags & (FL_PROMOTED0 | FL_PROMOTED1)) >> RVALUE_AGE_SHIFT);
-}
+#define FL_TEST2(x,f) ((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? (rb_bug("FL_TEST2: SPECIAL_CONST"), 0) : FL_TEST_RAW((x),(f)) != 0)
+#define FL_SET2(x,f) do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_SET2: SPECIAL_CONST"); RBASIC(x)->flags |= (f);} while (0)
+#define FL_UNSET2(x,f) do {if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) rb_bug("FL_UNSET2: SPECIAL_CONST"); RBASIC(x)->flags &= ~(f);} while (0)
-#endif /* USE_RGENGC */
+#define RVALUE_RAW_SHADY(obj) (!FL_TEST2((obj), FL_WB_PROTECTED))
+#define RVALUE_SHADY(obj) RVALUE_RAW_SHADY(check_gen_consistency((VALUE)obj))
+#define RVALUE_OLDEGN_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), (obj))
+
+static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr);
+static inline int gc_marked(rb_objspace_t *objspace, VALUE ptr);
-#if RGENGC_CHECK_MODE == 0
static inline VALUE
-check_rvalue_consistency(const VALUE obj)
-{
- return obj;
-}
-#else
-static VALUE
-check_rvalue_consistency(const VALUE obj)
+check_gen_consistency(VALUE obj)
{
- rb_objspace_t *objspace = &rb_objspace;
+ if (RGENGC_CHECK_MODE > 0) {
+ int old_flag = RVALUE_OLDEGN_BITMAP(obj) != 0;
+ int promoted_flag = FL_TEST2(obj, FL_PROMOTED);
+ rb_objspace_t *objspace = &rb_objspace;
- if (SPECIAL_CONST_P(obj)) {
- rb_bug("check_rvalue_consistency: %p is a special const.", (void *)obj);
- }
- else if (!is_pointer_to_heap(objspace, (void *)obj)) {
- rb_bug("check_rvalue_consistency: %p is not a Ruby object.", (void *)obj);
- }
- else {
- const int wb_unprotected_bit = RVALUE_WB_UNPROTECTED_BITMAP(obj) != 0;
- const int uncollectible_bit = RVALUE_UNCOLLECTIBLE_BITMAP(obj) != 0;
- const int mark_bit = RVALUE_MARK_BITMAP(obj) != 0;
- const int marking_bit = RVALUE_MARKING_BITMAP(obj) != 0, remembered_bit = marking_bit;
- const int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
-
- if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("check_rvalue_consistency: %s is T_NONE", obj_info(obj));
- if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("check_rvalue_consistency: %s is T_ZOMBIE", obj_info(obj));
obj_memsize_of((VALUE)obj, FALSE);
- /* check generation
- *
- * OLD == age == 3 && old-bitmap && mark-bit (except incremental marking)
- */
- if (age > 0 && wb_unprotected_bit) {
- rb_bug("check_rvalue_consistency: %s is not WB protected, but age is %d > 0.", obj_info(obj), age);
+ if (!is_pointer_to_heap(objspace, (void *)obj)) {
+ rb_bug("check_gen_consistency: %p (%s) is not Ruby object.", (void *)obj, obj_type_name(obj));
}
- if (!is_marking(objspace) && uncollectible_bit && !mark_bit) {
- rb_bug("check_rvalue_consistency: %s is uncollectible, but is not marked while !gc.", obj_info(obj));
- }
+ if (promoted_flag) {
+ if (RVALUE_RAW_SHADY(obj)) {
+ const char *type = old_flag ? "old" : "young";
+ rb_bug("check_gen_consistency: %p (%s) is shady, but %s object.", (void *)obj, obj_type_name(obj), type);
+ }
- if (!is_full_marking(objspace)) {
- if (uncollectible_bit && age != RVALUE_OLD_AGE && !wb_unprotected_bit) {
- rb_bug("check_rvalue_consistency: %s is uncollectible, but not old (age: %d) and not WB unprotected.", obj_info(obj), age);
+#if !RGENGC_THREEGEN
+ if (!old_flag) {
+ rb_bug("check_gen_consistency: %p (%s) is not infant, but is not old (on 2gen).", (void *)obj, obj_type_name(obj));
}
- if (remembered_bit && age != RVALUE_OLD_AGE) {
- rb_bug("check_rvalue_consistency: %s is rememberd, but not old (age: %d).", obj_info(obj), age);
+#endif
+
+ if (old_flag && objspace->rgengc.during_minor_gc && !gc_marked(objspace, obj)) {
+ rb_bug("check_gen_consistency: %p (%s) is old, but is not marked while minor marking.", (void *)obj, obj_type_name(obj));
}
}
-
- /*
- * check coloring
- *
- * marking:false marking:true
- * marked:false white *invalid*
- * marked:true black grey
- */
- if (is_incremental_marking(objspace) && marking_bit) {
- if (!is_marking(objspace) && !mark_bit) rb_bug("check_rvalue_consistency: %s is marking, but not marked.", obj_info(obj));
+ else {
+ if (old_flag) {
+ rb_bug("check_gen_consistency: %p (%s) is not infant, but is old.", (void *)obj, obj_type_name(obj));
+ }
}
}
return obj;
}
-#endif
-static inline int
-RVALUE_MARKED(VALUE obj)
-{
- check_rvalue_consistency(obj);
- return RVALUE_MARK_BITMAP(obj) != 0;
-}
-
-#if USE_RGENGC
-static inline int
-RVALUE_WB_UNPROTECTED(VALUE obj)
-{
- check_rvalue_consistency(obj);
- return RVALUE_WB_UNPROTECTED_BITMAP(obj) != 0;
-}
-
-static inline int
-RVALUE_MARKING(VALUE obj)
-{
- check_rvalue_consistency(obj);
- return RVALUE_MARKING_BITMAP(obj) != 0;
-}
-
-static inline int
-RVALUE_REMEMBERED(VALUE obj)
-{
- check_rvalue_consistency(obj);
- return RVALUE_MARKING_BITMAP(obj) != 0;
-}
-
-static inline int
-RVALUE_UNCOLLECTIBLE(VALUE obj)
+static inline VALUE
+RVALUE_INFANT_P(VALUE obj)
{
- check_rvalue_consistency(obj);
- return RVALUE_UNCOLLECTIBLE_BITMAP(obj) != 0;
+ check_gen_consistency(obj);
+ return !FL_TEST2(obj, FL_PROMOTED);
}
-static inline int
-RVALUE_OLD_P_RAW(VALUE obj)
+static inline VALUE
+RVALUE_OLD_BITMAP_P(VALUE obj)
{
- const VALUE promoted = FL_PROMOTED0 | FL_PROMOTED1;
- return (RBASIC(obj)->flags & promoted) == promoted;
+ check_gen_consistency(obj);
+ return (RVALUE_OLDEGN_BITMAP(obj) != 0);
}
-static inline int
+static inline VALUE
RVALUE_OLD_P(VALUE obj)
{
- check_rvalue_consistency(obj);
- return RVALUE_OLD_P_RAW(obj);
-}
-
-#if RGENGC_CHECK_MODE || GC_DEBUG
-static inline int
-RVALUE_AGE(VALUE obj)
-{
- check_rvalue_consistency(obj);
- return RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
-}
-#endif
-
-static inline void
-RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
-{
- MARK_IN_BITMAP(&page->uncollectible_bits[0], obj);
- objspace->rgengc.old_objects++;
-
-#if RGENGC_PROFILE >= 2
- objspace->profile.total_promoted_count++;
- objspace->profile.promoted_types[BUILTIN_TYPE(obj)]++;
+ check_gen_consistency(obj);
+#if RGENGC_THREEGEN
+ return FL_TEST2(obj, FL_PROMOTED) && RVALUE_OLD_BITMAP_P(obj);
+#else
+ return FL_TEST2(obj, FL_PROMOTED);
#endif
}
-static inline void
-RVALUE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, VALUE obj)
-{
- RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(objspace, GET_HEAP_PAGE(obj), obj);
-}
-
static inline VALUE
-RVALUE_FLAGS_AGE_SET(VALUE flags, int age)
+RVALUE_PROMOTED_P(VALUE obj)
{
- flags &= ~(FL_PROMOTED0 | FL_PROMOTED1);
- flags |= (age << RVALUE_AGE_SHIFT);
- return flags;
+ check_gen_consistency(obj);
+ return FL_TEST2(obj, FL_PROMOTED);
}
-/* set age to age+1 */
static inline void
-RVALUE_AGE_INC(rb_objspace_t *objspace, VALUE obj)
+RVALUE_PROMOTE_INFANT(VALUE obj)
{
- VALUE flags = RBASIC(obj)->flags;
- int age = RVALUE_FLAGS_AGE(flags);
-
- if (RGENGC_CHECK_MODE && age == RVALUE_OLD_AGE) {
- rb_bug("RVALUE_AGE_INC: can not increment age of OLD object %s.", obj_info(obj));
- }
+ check_gen_consistency(obj);
+ if (RGENGC_CHECK_MODE && !RVALUE_INFANT_P(obj)) rb_bug("RVALUE_PROMOTE_INFANT: %p (%s) is not infant object.", (void *)obj, obj_type_name(obj));
+ FL_SET2(obj, FL_PROMOTED);
+#if !RGENGC_THREEGEN
+ MARK_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), obj);
+#endif
+ check_gen_consistency(obj);
- age++;
- RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(flags, age);
+#if RGENGC_PROFILE >= 1
+ {
+ rb_objspace_t *objspace = &rb_objspace;
+ objspace->profile.promote_infant_count++;
- if (age == RVALUE_OLD_AGE) {
- RVALUE_OLD_UNCOLLECTIBLE_SET(objspace, obj);
+#if RGENGC_PROFILE >= 2
+ objspace->profile.promote_infant_types[BUILTIN_TYPE(obj)]++;
+#endif
}
- check_rvalue_consistency(obj);
-}
-
-/* set age to RVALUE_OLD_AGE */
-static inline void
-RVALUE_AGE_SET_OLD(rb_objspace_t *objspace, VALUE obj)
-{
- check_rvalue_consistency(obj);
- if (RGENGC_CHECK_MODE) assert(!RVALUE_OLD_P(obj));
-
- RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, RVALUE_OLD_AGE);
- RVALUE_OLD_UNCOLLECTIBLE_SET(objspace, obj);
-
- check_rvalue_consistency(obj);
-}
-
-/* set age to RVALUE_OLD_AGE - 1 */
-static inline void
-RVALUE_AGE_SET_CANDIDATE(rb_objspace_t *objspace, VALUE obj)
-{
- check_rvalue_consistency(obj);
- if (RGENGC_CHECK_MODE) assert(!RVALUE_OLD_P(obj));
-
- RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, RVALUE_OLD_AGE - 1);
-
- check_rvalue_consistency(obj);
+#endif
}
-static inline void
-RVALUE_DEMOTE_RAW(rb_objspace_t *objspace, VALUE obj)
+#if RGENGC_THREEGEN
+/*
+ * Two gen: Infant -> Old.
+ * Three gen: Infant -> Young -> Old.
+ */
+static inline VALUE
+RVALUE_YOUNG_P(VALUE obj)
{
- RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, 0);
- CLEAR_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), obj);
+ check_gen_consistency(obj);
+ return FL_TEST2(obj, FL_PROMOTED) && (RVALUE_OLDEGN_BITMAP(obj) == 0);
}
static inline void
-RVALUE_DEMOTE(rb_objspace_t *objspace, VALUE obj)
+RVALUE_PROMOTE_YOUNG(VALUE obj)
{
- check_rvalue_consistency(obj);
- if (RGENGC_CHECK_MODE) assert(RVALUE_OLD_P(obj));
+ check_gen_consistency(obj);
+ if (RGENGC_CHECK_MODE && !RVALUE_YOUNG_P(obj)) rb_bug("RVALUE_PROMOTE_YOUNG: %p (%s) is not young object.", (void *)obj, obj_type_name(obj));
+ MARK_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), obj);
+ check_gen_consistency(obj);
- if (!is_incremental_marking(objspace) && RVALUE_REMEMBERED(obj)) {
- CLEAR_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj);
- }
-
- RVALUE_DEMOTE_RAW(objspace, obj);
-
- if (RVALUE_MARKED(obj)) {
- objspace->rgengc.old_objects--;
+#if RGENGC_PROFILE >= 1
+ {
+ rb_objspace_t *objspace = &rb_objspace;
+ objspace->profile.promote_young_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.promote_young_types[BUILTIN_TYPE(obj)]++;
+#endif
}
-
- check_rvalue_consistency(obj);
+#endif
}
static inline void
-RVALUE_AGE_RESET_RAW(VALUE obj)
+RVALUE_DEMOTE_FROM_YOUNG(VALUE obj)
{
- RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, 0);
-}
+ if (RGENGC_CHECK_MODE && !RVALUE_YOUNG_P(obj))
+ rb_bug("RVALUE_DEMOTE_FROM_YOUNG: %p (%s) is not young object.", (void *)obj, obj_type_name(obj));
-static inline void
-RVALUE_AGE_RESET(VALUE obj)
-{
- check_rvalue_consistency(obj);
- if (RGENGC_CHECK_MODE) assert(!RVALUE_OLD_P(obj));
- RVALUE_AGE_RESET_RAW(obj);
- check_rvalue_consistency(obj);
-}
-
-static inline int
-RVALUE_BLACK_P(VALUE obj)
-{
- return RVALUE_MARKED(obj) && !RVALUE_MARKING(obj);
-}
-
-#if 0
-static inline int
-RVALUE_GREY_P(VALUE obj)
-{
- return RVALUE_MARKED(obj) && RVALUE_MARKING(obj);
+ check_gen_consistency(obj);
+ FL_UNSET2(obj, FL_PROMOTED);
+ check_gen_consistency(obj);
}
#endif
-static inline int
-RVALUE_WHITE_P(VALUE obj)
+static inline void
+RVALUE_DEMOTE_FROM_OLD(VALUE obj)
{
- return RVALUE_MARKED(obj) == FALSE;
+ if (RGENGC_CHECK_MODE && !RVALUE_OLD_P(obj))
+ rb_bug("RVALUE_DEMOTE_FROM_OLD: %p (%s) is not old object.", (void *)obj, obj_type_name(obj));
+
+ check_gen_consistency(obj);
+ FL_UNSET2(obj, FL_PROMOTED);
+ CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj), obj);
+ check_gen_consistency(obj);
}
#endif /* USE_RGENGC */
@@ -1257,94 +841,91 @@ RVALUE_WHITE_P(VALUE obj)
--------------------------- ObjectSpace -----------------------------
*/
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
rb_objspace_t *
rb_objspace_alloc(void)
{
-#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
- rb_objspace_t *objspace = calloc(1, sizeof(rb_objspace_t));
-#else
- rb_objspace_t *objspace = &rb_objspace;
-#endif
+ rb_objspace_t *objspace = malloc(sizeof(rb_objspace_t));
+ memset(objspace, 0, sizeof(*objspace));
+ ruby_gc_stress = ruby_initial_gc_stress;
+
malloc_limit = gc_params.malloc_limit_min;
+#if RGENGC_ESTIMATE_OLDSPACE
+ objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_min;
+#endif
return objspace;
}
+#endif
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
static void free_stack_chunks(mark_stack_t *);
static void heap_page_free(rb_objspace_t *objspace, struct heap_page *page);
void
rb_objspace_free(rb_objspace_t *objspace)
{
- if (is_lazy_sweeping(heap_eden))
- rb_bug("lazy sweeping underway when freeing object space");
+ gc_rest_sweep(objspace);
if (objspace->profile.records) {
free(objspace->profile.records);
objspace->profile.records = 0;
}
- if (global_list) {
+ if (global_List) {
struct gc_list *list, *next;
- for (list = global_list; list; list = next) {
+ for (list = global_List; list; list = next) {
next = list->next;
xfree(list);
}
}
if (heap_pages_sorted) {
size_t i;
- for (i = 0; i < heap_allocated_pages; ++i) {
+ for (i = 0; i < heap_pages_used; ++i) {
heap_page_free(objspace, heap_pages_sorted[i]);
}
free(heap_pages_sorted);
- heap_allocated_pages = 0;
- heap_pages_sorted_length = 0;
+ heap_pages_used = 0;
+ heap_pages_length = 0;
heap_pages_lomem = 0;
heap_pages_himem = 0;
- objspace->eden_heap.page_length = 0;
- objspace->eden_heap.total_slots = 0;
+ objspace->eden_heap.used = 0;
+ objspace->eden_heap.limit = 0;
objspace->eden_heap.pages = NULL;
}
free_stack_chunks(&objspace->mark_stack);
-#if !(defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE)
- if (objspace == &rb_objspace) return;
-#endif
free(objspace);
}
+#endif
static void
-heap_pages_expand_sorted_to(rb_objspace_t *objspace, size_t next_length)
+heap_pages_expand_sorted(rb_objspace_t *objspace)
{
- struct heap_page **sorted;
- size_t size = next_length * sizeof(struct heap_page *);
-
- gc_report(3, objspace, "heap_pages_expand_sorted: next_length: %d, size: %d\n", (int)next_length, (int)size);
+ size_t next_length = heap_pages_increment;
+ next_length += heap_eden->used;
+ next_length += heap_tomb->used;
- if (heap_pages_sorted_length > 0) {
- sorted = (struct heap_page **)realloc(heap_pages_sorted, size);
- if (sorted) heap_pages_sorted = sorted;
- }
- else {
- sorted = heap_pages_sorted = (struct heap_page **)malloc(size);
- }
+ if (next_length > heap_pages_length) {
+ struct heap_page **sorted;
+ size_t size = next_length * sizeof(struct heap_page *);
- if (sorted == 0) {
- rb_memerror();
- }
+ rgengc_report(3, objspace, "heap_pages_expand_sorted: next_length: %d, size: %d\n", (int)next_length, (int)size);
- heap_pages_sorted_length = next_length;
-}
+ if (heap_pages_length > 0) {
+ sorted = (struct heap_page **)realloc(heap_pages_sorted, size);
+ if (sorted) heap_pages_sorted = sorted;
+ }
+ else {
+ sorted = heap_pages_sorted = (struct heap_page **)malloc(size);
+ }
-static void
-heap_pages_expand_sorted(rb_objspace_t *objspace)
-{
- size_t next_length = heap_allocatable_pages;
- next_length += heap_eden->page_length;
- next_length += heap_tomb->page_length;
+ if (sorted == 0) {
+ during_gc = 0;
+ rb_memerror();
+ }
- if (next_length > heap_pages_sorted_length) {
- heap_pages_expand_sorted_to(objspace, next_length);
+ heap_pages_length = next_length;
}
}
@@ -1355,12 +936,7 @@ heap_page_add_freeobj(rb_objspace_t *objspace, struct heap_page *page, VALUE obj
p->as.free.flags = 0;
p->as.free.next = page->freelist;
page->freelist = p;
-
- if (RGENGC_CHECK_MODE && !is_pointer_to_heap(objspace, p)) {
- rb_bug("heap_page_add_freeobj: %p is not rvalue.", p);
- }
-
- gc_report(3, objspace, "heap_page_add_freeobj: add %p to freelist\n", (void *)obj);
+ rgengc_report(3, objspace, "heap_page_add_freeobj: %p (%s) is added to freelist\n", p, obj_type_name(obj));
}
static inline void
@@ -1372,22 +948,6 @@ heap_add_freepage(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *pa
}
}
-#if GC_ENABLE_INCREMENTAL_MARK
-static inline int
-heap_add_poolpage(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
-{
- if (page->freelist) {
- page->free_next = heap->pooled_pages;
- heap->pooled_pages = page;
- objspace->rincgc.pooled_slots += page->free_slots;
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-#endif
-
static void
heap_unlink_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
{
@@ -1397,15 +957,14 @@ heap_unlink_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *pag
page->prev = NULL;
page->next = NULL;
page->heap = NULL;
- heap->page_length--;
- heap->total_slots -= page->total_slots;
+ heap->used--;
+ heap->limit -= page->limit;
}
static void
heap_page_free(rb_objspace_t *objspace, struct heap_page *page)
{
- heap_allocated_pages--;
- objspace->profile.total_freed_pages++;
+ heap_pages_used--;
aligned_free(page->body);
free(page);
}
@@ -1415,30 +974,28 @@ heap_pages_free_unused_pages(rb_objspace_t *objspace)
{
size_t i, j;
- if (heap_tomb->pages && heap_pages_swept_slots > heap_pages_max_free_slots) {
- for (i = j = 1; j < heap_allocated_pages; i++) {
- struct heap_page *page = heap_pages_sorted[i];
-
- if (page->heap == heap_tomb && page->free_slots == page->total_slots) {
- if (heap_pages_swept_slots - page->total_slots > heap_pages_max_free_slots) {
- if (0) fprintf(stderr, "heap_pages_free_unused_pages: %d free page %p, heap_pages_swept_slots: %d, heap_pages_max_free_slots: %d\n",
- (int)i, page, (int)heap_pages_swept_slots, (int)heap_pages_max_free_slots);
- heap_pages_swept_slots -= page->total_slots;
- heap_unlink_page(objspace, heap_tomb, page);
- heap_page_free(objspace, page);
- continue;
- }
- else if (i == j) {
- return; /* no need to check rest pages */
- }
+ for (i = j = 1; j < heap_pages_used; i++) {
+ struct heap_page *page = heap_pages_sorted[i];
+
+ if (page->heap == heap_tomb && page->final_num == 0) {
+ if (heap_pages_swept_num - page->limit > heap_pages_max_free_slots) {
+ if (0) fprintf(stderr, "heap_pages_free_unused_pages: %d free page %p, heap_pages_swept_num: %d, heap_pages_max_free_slots: %d\n",
+ (int)i, page, (int)heap_pages_swept_num, (int)heap_pages_max_free_slots);
+ heap_pages_swept_num -= page->limit;
+ heap_unlink_page(objspace, heap_tomb, page);
+ heap_page_free(objspace, page);
+ continue;
}
- if (i != j) {
- heap_pages_sorted[j] = page;
+ else {
+ /* fprintf(stderr, "heap_pages_free_unused_pages: remain!!\n"); */
}
- j++;
}
- if (RGENGC_CHECK_MODE) assert(j == heap_allocated_pages);
+ if (i != j) {
+ heap_pages_sorted[j] = page;
+ }
+ j++;
}
+ assert(j == heap_pages_used);
}
static struct heap_page *
@@ -1448,26 +1005,29 @@ heap_page_allocate(rb_objspace_t *objspace)
struct heap_page *page;
struct heap_page_body *page_body = 0;
size_t hi, lo, mid;
- int limit = HEAP_OBJ_LIMIT;
+ size_t limit = HEAP_OBJ_LIMIT;
/* assign heap_page body (contains heap_page_header and RVALUEs) */
page_body = (struct heap_page_body *)aligned_malloc(HEAP_ALIGN, HEAP_SIZE);
if (page_body == 0) {
+ during_gc = 0;
rb_memerror();
}
/* assign heap_page entry */
- page = (struct heap_page *)calloc(1, sizeof(struct heap_page));
+ page = (struct heap_page *)malloc(sizeof(struct heap_page));
if (page == 0) {
aligned_free(page_body);
+ during_gc = 0;
rb_memerror();
}
+ MEMZERO((void*)page, struct heap_page, 1);
page->body = page_body;
/* setup heap_pages_sorted */
lo = 0;
- hi = heap_allocated_pages;
+ hi = heap_pages_used;
while (lo < hi) {
struct heap_page *mid_page;
@@ -1483,29 +1043,21 @@ heap_page_allocate(rb_objspace_t *objspace)
rb_bug("same heap page is allocated: %p at %"PRIuVALUE, (void *)page_body, (VALUE)mid);
}
}
- if (heap_allocated_pages >= heap_pages_sorted_length) {
- heap_pages_expand_sorted_to(objspace, heap_allocated_pages + 1);
- }
- if (hi < heap_allocated_pages) {
- MEMMOVE(&heap_pages_sorted[hi+1], &heap_pages_sorted[hi], struct heap_page_header*, heap_allocated_pages - hi);
+ if (hi < heap_pages_used) {
+ MEMMOVE(&heap_pages_sorted[hi+1], &heap_pages_sorted[hi], struct heap_page_header*, heap_pages_used - hi);
}
heap_pages_sorted[hi] = page;
- heap_allocated_pages++;
- objspace->profile.total_allocated_pages++;
-
- if (heap_allocated_pages > heap_pages_sorted_length) {
- rb_bug("heap_page_allocate: allocated(%"PRIdSIZE") > sorted(%"PRIdSIZE")",
- heap_allocated_pages, heap_pages_sorted_length);
- }
+ heap_pages_used++;
+ assert(heap_pages_used <= heap_pages_length);
/* adjust obj_limit (object number available in this page) */
start = (RVALUE*)((VALUE)page_body + sizeof(struct heap_page_header));
if ((VALUE)start % sizeof(RVALUE) != 0) {
int delta = (int)(sizeof(RVALUE) - ((VALUE)start % sizeof(RVALUE)));
start = (RVALUE*)((VALUE)start + delta);
- limit = (HEAP_SIZE - (int)((VALUE)start - (VALUE)page_body))/(int)sizeof(RVALUE);
+ limit = (HEAP_SIZE - (size_t)((VALUE)start - (VALUE)page_body))/sizeof(RVALUE);
}
end = start + limit;
@@ -1513,14 +1065,13 @@ heap_page_allocate(rb_objspace_t *objspace)
if (heap_pages_himem < end) heap_pages_himem = end;
page->start = start;
- page->total_slots = limit;
+ page->limit = limit;
page_body->header.page = page;
for (p = start; p != end; p++) {
- gc_report(3, objspace, "assign_heap_page: %p is added to freelist\n", p);
+ rgengc_report(3, objspace, "assign_heap_page: %p is added to freelist\n");
heap_page_add_freeobj(objspace, page, (VALUE)p);
}
- page->free_slots = limit;
return page;
}
@@ -1528,16 +1079,12 @@ heap_page_allocate(rb_objspace_t *objspace)
static struct heap_page *
heap_page_resurrect(rb_objspace_t *objspace)
{
- struct heap_page *page = heap_tomb->pages;
+ struct heap_page *page;
- while (page) {
- if (page->freelist != NULL) {
- heap_unlink_page(objspace, heap_tomb, page);
- return page;
- }
- page = page->next;
+ if ((page = heap_tomb->pages) != NULL) {
+ heap_unlink_page(objspace, heap_tomb, page);
+ return page;
}
-
return NULL;
}
@@ -1550,8 +1097,8 @@ heap_page_create(rb_objspace_t *objspace)
page = heap_page_allocate(objspace);
method = "allocate";
}
- if (0) fprintf(stderr, "heap_page_create: %s - %p, heap_allocated_pages: %d, heap_allocated_pages: %d, tomb->page_length: %d\n",
- method, page, (int)heap_pages_sorted_length, (int)heap_allocated_pages, (int)heap_tomb->page_length);
+ if (0) fprintf(stderr, "heap_page_create: %s - %p, heap_pages_used: %d, heap_pages_used: %d, tomb->used: %d\n",
+ method, page, (int)heap_pages_length, (int)heap_pages_used, (int)heap_tomb->used);
return page;
}
@@ -1562,8 +1109,8 @@ heap_add_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
page->next = heap->pages;
if (heap->pages) heap->pages->prev = page;
heap->pages = page;
- heap->page_length++;
- heap->total_slots += page->total_slots;
+ heap->used++;
+ heap->limit += page->limit;
}
static void
@@ -1579,106 +1126,94 @@ heap_add_pages(rb_objspace_t *objspace, rb_heap_t *heap, size_t add)
{
size_t i;
- heap_allocatable_pages = add;
+ heap_pages_increment = add;
heap_pages_expand_sorted(objspace);
for (i = 0; i < add; i++) {
heap_assign_page(objspace, heap);
}
- heap_allocatable_pages = 0;
+ heap_pages_increment = 0;
}
-static size_t
-heap_extend_pages(rb_objspace_t *objspace)
+static void
+heap_set_increment(rb_objspace_t *objspace, size_t minimum_limit)
{
- size_t used = heap_allocated_pages - heap_tomb->page_length;
+ size_t used = heap_pages_used - heap_tomb->used;
size_t next_used_limit = (size_t)(used * gc_params.growth_factor);
-
- if (gc_params.growth_max_slots > 0) {
- size_t max_used_limit = (size_t)(used + gc_params.growth_max_slots/HEAP_OBJ_LIMIT);
+ if (gc_params.growth_max > 0) {
+ size_t max_used_limit = (size_t)(used + gc_params.growth_max/HEAP_OBJ_LIMIT);
if (next_used_limit > max_used_limit) next_used_limit = max_used_limit;
}
+ if (next_used_limit == heap_pages_used) next_used_limit++;
- return next_used_limit - used;
-}
-
-static void
-heap_set_increment(rb_objspace_t *objspace, size_t additional_pages)
-{
- size_t used = heap_eden->page_length;
- size_t next_used_limit = used + additional_pages;
-
- if (next_used_limit == heap_allocated_pages) next_used_limit++;
+ if (next_used_limit < minimum_limit) {
+ next_used_limit = minimum_limit;
+ }
- heap_allocatable_pages = next_used_limit - used;
+ heap_pages_increment = next_used_limit - used;
heap_pages_expand_sorted(objspace);
- gc_report(1, objspace, "heap_set_increment: heap_allocatable_pages is %d\n", (int)heap_allocatable_pages);
+ if (0) fprintf(stderr, "heap_set_increment: heap_pages_length: %d, heap_pages_used: %d, heap_pages_increment: %d, next_used_limit: %d\n",
+ (int)heap_pages_length, (int)heap_pages_used, (int)heap_pages_increment, (int)next_used_limit);
}
static int
heap_increment(rb_objspace_t *objspace, rb_heap_t *heap)
{
- if (heap_allocatable_pages > 0) {
- gc_report(1, objspace, "heap_increment: heap_pages_sorted_length: %d, heap_pages_inc: %d, heap->page_length: %d\n",
- (int)heap_pages_sorted_length, (int)heap_allocatable_pages, (int)heap->page_length);
- heap_allocatable_pages--;
+ rgengc_report(5, objspace, "heap_increment: heap_pages_length: %d, heap_pages_inc: %d, heap->used: %d\n",
+ (int)heap_pages_length, (int)heap_pages_increment, (int)heap->used);
+
+ if (heap_pages_increment > 0) {
+ heap_pages_increment--;
heap_assign_page(objspace, heap);
return TRUE;
}
return FALSE;
}
-static void
-heap_prepare(rb_objspace_t *objspace, rb_heap_t *heap)
+static struct heap_page *
+heap_prepare_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
{
- if (RGENGC_CHECK_MODE) assert(heap->free_pages == NULL);
-
-#if GC_ENABLE_LAZY_SWEEP
- if (is_lazy_sweeping(heap)) {
- gc_sweep_continue(objspace, heap);
+ if (!GC_ENABLE_LAZY_SWEEP && objspace->flags.dont_lazy_sweep) {
+ if (heap_increment(objspace, heap) == 0 &&
+ garbage_collect(objspace, FALSE, TRUE, GPR_FLAG_NEWOBJ) == 0) {
+ goto err;
+ }
+ goto ok;
}
-#endif
-#if GC_ENABLE_INCREMENTAL_MARK
- else if (is_incremental_marking(objspace)) {
- gc_marks_continue(objspace, heap);
+
+ if (!heap_ready_to_gc(objspace, heap)) return heap->free_pages;
+
+ during_gc++;
+
+ if ((is_lazy_sweeping(heap) && gc_heap_lazy_sweep(objspace, heap)) || heap_increment(objspace, heap)) {
+ goto ok;
}
-#endif
- if (heap->free_pages == NULL &&
- (will_be_incremental_marking(objspace) || heap_increment(objspace, heap) == FALSE) &&
- gc_start(objspace, FALSE, FALSE, FALSE, GPR_FLAG_NEWOBJ) == FALSE) {
+#if GC_PROFILE_MORE_DETAIL
+ objspace->profile.prepare_time = 0;
+#endif
+ if (garbage_collect_body(objspace, 0, 0, GPR_FLAG_NEWOBJ) == 0) {
+ err:
+ during_gc = 0;
rb_memerror();
}
+ ok:
+ during_gc = 0;
+ return heap->free_pages;
}
-static RVALUE *
-heap_get_freeobj_from_next_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
+static inline struct heap_page *
+heap_get_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
{
struct heap_page *page;
- RVALUE *p;
- while (heap->free_pages == NULL) {
- heap_prepare(objspace, heap);
- }
page = heap->free_pages;
+ while (page == NULL) {
+ page = heap_prepare_freepage(objspace, heap);
+ }
heap->free_pages = page->free_next;
- heap->using_page = page;
-
- if (RGENGC_CHECK_MODE) assert(page->free_slots != 0);
- p = page->freelist;
- page->freelist = NULL;
- page->free_slots = 0;
- return p;
-}
-static inline VALUE
-heap_get_freeobj_head(rb_objspace_t *objspace, rb_heap_t *heap)
-{
- RVALUE *p = heap->freelist;
- if (LIKELY(p != NULL)) {
- heap->freelist = p->as.free.next;
- }
- return (VALUE)p;
+ return page;
}
static inline VALUE
@@ -1686,15 +1221,15 @@ heap_get_freeobj(rb_objspace_t *objspace, rb_heap_t *heap)
{
RVALUE *p = heap->freelist;
- while (1) {
- if (LIKELY(p != NULL)) {
- heap->freelist = p->as.free.next;
- return (VALUE)p;
- }
- else {
- p = heap_get_freeobj_from_next_freepage(objspace, heap);
- }
+ while (UNLIKELY(p == NULL)) {
+ struct heap_page *page = heap_get_freepage(objspace, heap);
+ heap->using_page = page;
+ p = heap->freelist = page->freelist;
+ page->freelist = NULL;
}
+ heap->freelist = p->as.free.next;
+
+ return (VALUE)p;
}
void
@@ -1702,281 +1237,127 @@ rb_objspace_set_event_hook(const rb_event_flag_t event)
{
rb_objspace_t *objspace = &rb_objspace;
objspace->hook_events = event & RUBY_INTERNAL_EVENT_OBJSPACE_MASK;
- objspace->flags.has_hook = (objspace->hook_events != 0);
}
static void
-gc_event_hook_body(rb_thread_t *th, rb_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
+gc_event_hook_body(rb_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
{
+ rb_thread_t *th = GET_THREAD();
EXEC_EVENT_HOOK(th, event, th->cfp->self, 0, 0, data);
}
-#define gc_event_hook_available_p(objspace) ((objspace)->flags.has_hook)
-#define gc_event_hook_needed_p(objspace, event) ((objspace)->hook_events & (event))
-
#define gc_event_hook(objspace, event, data) do { \
- if (UNLIKELY(gc_event_hook_needed_p(objspace, event))) { \
- gc_event_hook_body(GET_THREAD(), (objspace), (event), (data)); \
+ if (UNLIKELY((objspace)->hook_events & (event))) { \
+ gc_event_hook_body((objspace), (event), (data)); \
} \
} while (0)
-static inline VALUE
-newobj_init(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_protected, rb_objspace_t *objspace, VALUE obj)
+static VALUE
+newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
{
- if (RGENGC_CHECK_MODE > 0) {
- assert(BUILTIN_TYPE(obj) == T_NONE);
- assert((flags & FL_WB_PROTECTED) == 0);
+ rb_objspace_t *objspace = &rb_objspace;
+ VALUE obj;
+
+ if (UNLIKELY(during_gc)) {
+ dont_gc = 1;
+ during_gc = 0;
+ rb_bug("object allocation during garbage collection phase");
}
+ if (UNLIKELY(ruby_gc_stress && !ruby_disable_gc_stress)) {
+ if (!garbage_collect(objspace, FALSE, FALSE, GPR_FLAG_NEWOBJ)) {
+ during_gc = 0;
+ rb_memerror();
+ }
+ }
+
+ obj = heap_get_freeobj(objspace, heap_eden);
+
/* OBJSETUP */
RBASIC(obj)->flags = flags;
- RBASIC_SET_CLASS_RAW(obj, klass);
+ RBASIC_SET_CLASS(obj, klass);
+ if (rb_safe_level() >= 3) FL_SET((obj), FL_TAINT);
RANY(obj)->as.values.v1 = v1;
RANY(obj)->as.values.v2 = v2;
RANY(obj)->as.values.v3 = v3;
-#if RGENGC_CHECK_MODE
- assert(RVALUE_MARKED(obj) == FALSE);
- assert(RVALUE_MARKING(obj) == FALSE);
- assert(RVALUE_OLD_P(obj) == FALSE);
- assert(RVALUE_WB_UNPROTECTED(obj) == FALSE);
-
- if (flags & FL_PROMOTED1) {
- if (RVALUE_AGE(obj) != 2) rb_bug("newobj: %s of age (%d) != 2.", obj_info(obj), RVALUE_AGE(obj));
- }
- else {
- if (RVALUE_AGE(obj) > 0) rb_bug("newobj: %s of age (%d) > 0.", obj_info(obj), RVALUE_AGE(obj));
- }
- if (rgengc_remembered(objspace, (VALUE)obj)) rb_bug("newobj: %s is remembered.", obj_info(obj));
-#endif
-
-#if USE_RGENGC
- if (UNLIKELY(wb_protected == FALSE)) {
- MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj);
- }
+#if GC_DEBUG
+ RANY(obj)->file = rb_sourcefile();
+ RANY(obj)->line = rb_sourceline();
+ assert(!SPECIAL_CONST_P(obj)); /* check alignment */
#endif
#if RGENGC_PROFILE
- if (wb_protected) {
- objspace->profile.total_generated_normal_object_count++;
+ if (flags & FL_WB_PROTECTED) {
+ objspace->profile.generated_normal_object_count++;
#if RGENGC_PROFILE >= 2
objspace->profile.generated_normal_object_count_types[BUILTIN_TYPE(obj)]++;
#endif
}
else {
- objspace->profile.total_generated_shady_object_count++;
+ objspace->profile.generated_shady_object_count++;
#if RGENGC_PROFILE >= 2
objspace->profile.generated_shady_object_count_types[BUILTIN_TYPE(obj)]++;
#endif
}
#endif
-#if GC_DEBUG
- RANY(obj)->file = rb_source_loc(&RANY(obj)->line);
- assert(!SPECIAL_CONST_P(obj)); /* check alignment */
-#endif
+ rgengc_report(5, objspace, "newobj: %p (%s)\n", (void *)obj, obj_type_name(obj));
- objspace->total_allocated_objects++;
-
- gc_report(5, objspace, "newobj: %s\n", obj_info(obj));
-
-#if RGENGC_OLD_NEWOBJ_CHECK > 0
- {
- static int newobj_cnt = RGENGC_OLD_NEWOBJ_CHECK;
-
- if (!is_incremental_marking(objspace) &&
- flags & FL_WB_PROTECTED && /* do not promote WB unprotected objects */
- ! RB_TYPE_P(obj, T_ARRAY)) { /* array.c assumes that allocated objects are new */
- if (--newobj_cnt == 0) {
- newobj_cnt = RGENGC_OLD_NEWOBJ_CHECK;
-
- gc_mark_set(objspace, obj);
- RVALUE_AGE_SET_OLD(objspace, obj);
-
- rb_gc_writebarrier_remember(obj);
- }
- }
- }
+#if USE_RGENGC && RGENGC_CHECK_MODE
+ if (RVALUE_PROMOTED_P(obj)) rb_bug("newobj: %p (%s) is promoted.\n", (void *)obj, obj_type_name(obj));
+ if (rgengc_remembered(objspace, (VALUE)obj)) rb_bug("newobj: %p (%s) is remembered.\n", (void *)obj, obj_type_name(obj));
#endif
- check_rvalue_consistency(obj);
- return obj;
-}
-
-static inline VALUE
-newobj_slowpath(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace, int wb_protected)
-{
- VALUE obj;
-
- if (UNLIKELY(during_gc || ruby_gc_stressful)) {
- if (during_gc) {
- dont_gc = 1;
- during_gc = 0;
- rb_bug("object allocation during garbage collection phase");
- }
- if (ruby_gc_stressful) {
- if (!garbage_collect(objspace, FALSE, FALSE, FALSE, GPR_FLAG_NEWOBJ)) {
- rb_memerror();
- }
- }
- }
-
- obj = heap_get_freeobj(objspace, heap_eden);
- newobj_init(klass, flags, v1, v2, v3, wb_protected, objspace, obj);
+ objspace->profile.total_allocated_object_num++;
gc_event_hook(objspace, RUBY_INTERNAL_EVENT_NEWOBJ, obj);
- return obj;
-}
-
-NOINLINE(static VALUE newobj_slowpath_wb_protected(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace));
-NOINLINE(static VALUE newobj_slowpath_wb_unprotected(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace));
-
-static VALUE
-newobj_slowpath_wb_protected(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)
-{
- return newobj_slowpath(klass, flags, v1, v2, v3, objspace, TRUE);
-}
-static VALUE
-newobj_slowpath_wb_unprotected(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)
-{
- return newobj_slowpath(klass, flags, v1, v2, v3, objspace, FALSE);
-}
-
-static inline VALUE
-newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_protected)
-{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE obj;
-
-#if GC_DEBUG_STRESS_TO_CLASS
- if (UNLIKELY(stress_to_class)) {
- long i, cnt = RARRAY_LEN(stress_to_class);
- const VALUE *ptr = RARRAY_CONST_PTR(stress_to_class);
- for (i = 0; i < cnt; ++i) {
- if (klass == ptr[i]) rb_memerror();
- }
- }
-#endif
- if (!(during_gc ||
- ruby_gc_stressful ||
- gc_event_hook_available_p(objspace)) &&
- (obj = heap_get_freeobj_head(objspace, heap_eden)) != Qfalse) {
- return newobj_init(klass, flags, v1, v2, v3, wb_protected, objspace, obj);
- }
- else {
- return wb_protected ?
- newobj_slowpath_wb_protected(klass, flags, v1, v2, v3, objspace) :
- newobj_slowpath_wb_unprotected(klass, flags, v1, v2, v3, objspace);
- }
-}
-
-VALUE
-rb_wb_unprotected_newobj_of(VALUE klass, VALUE flags)
-{
- if (RGENGC_CHECK_MODE > 0) assert((flags & FL_WB_PROTECTED) == 0);
- return newobj_of(klass, flags, 0, 0, 0, FALSE);
+ return obj;
}
VALUE
-rb_wb_protected_newobj_of(VALUE klass, VALUE flags)
-{
- if (RGENGC_CHECK_MODE > 0) assert((flags & FL_WB_PROTECTED) == 0);
- return newobj_of(klass, flags, 0, 0, 0, TRUE);
-}
-
-/* for compatibility */
-
-VALUE
rb_newobj(void)
{
- return newobj_of(0, T_NONE, 0, 0, 0, FALSE);
+ return newobj_of(0, T_NONE, 0, 0, 0);
}
VALUE
rb_newobj_of(VALUE klass, VALUE flags)
{
- return newobj_of(klass, flags & ~FL_WB_PROTECTED, 0, 0, 0, flags & FL_WB_PROTECTED);
+ return newobj_of(klass, flags, 0, 0, 0);
}
NODE*
rb_node_newnode(enum node_type type, VALUE a0, VALUE a1, VALUE a2)
{
- NODE *n = (NODE *)newobj_of(0, T_NODE, a0, a1, a2, FALSE); /* TODO: node also should be wb protected */
+ NODE *n = (NODE *)newobj_of(0, T_NODE, a0, a1, a2);
nd_set_type(n, type);
return n;
}
-#undef rb_imemo_new
-
VALUE
-rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
-{
- VALUE flags = T_IMEMO | (type << FL_USHIFT);
- return newobj_of(v0, flags, v1, v2, v3, TRUE);
-}
-
-#if IMEMO_DEBUG
-VALUE
-rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line)
-{
- VALUE memo = rb_imemo_new(type, v1, v2, v3, v0);
- fprintf(stderr, "memo %p (type: %d) @ %s:%d\n", memo, imemo_type(memo), file, line);
- return memo;
-}
-#endif
-
-VALUE
-rb_data_object_wrap(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
+rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
{
if (klass) Check_Type(klass, T_CLASS);
- return newobj_of(klass, T_DATA, (VALUE)dmark, (VALUE)dfree, (VALUE)datap, FALSE);
-}
-
-#undef rb_data_object_alloc
-RUBY_ALIAS_FUNCTION(rb_data_object_alloc(VALUE klass, void *datap,
- RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree),
- rb_data_object_wrap, (klass, datap, dmark, dfree))
-
-
-VALUE
-rb_data_object_zalloc(VALUE klass, size_t size, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
-{
- VALUE obj = rb_data_object_wrap(klass, 0, dmark, dfree);
- DATA_PTR(obj) = xcalloc(1, size);
- return obj;
+ return newobj_of(klass, T_DATA, (VALUE)dmark, (VALUE)dfree, (VALUE)datap);
}
VALUE
-rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *type)
+rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
{
if (klass) Check_Type(klass, T_CLASS);
- return newobj_of(klass, T_DATA, (VALUE)type, (VALUE)1, (VALUE)datap, type->flags & RUBY_FL_WB_PROTECTED);
-}
-
-#undef rb_data_typed_object_alloc
-RUBY_ALIAS_FUNCTION(rb_data_typed_object_alloc(VALUE klass, void *datap,
- const rb_data_type_t *type),
- rb_data_typed_object_wrap, (klass, datap, type))
-
-VALUE
-rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type)
-{
- VALUE obj = rb_data_typed_object_wrap(klass, 0, type);
- DATA_PTR(obj) = xcalloc(1, size);
- return obj;
+ return newobj_of(klass, T_DATA | (type->flags & ~T_MASK), (VALUE)type, (VALUE)1, (VALUE)datap);
}
size_t
rb_objspace_data_type_memsize(VALUE obj)
{
- if (RTYPEDDATA_P(obj)) {
- const rb_data_type_t *type = RTYPEDDATA_TYPE(obj);
- const void *ptr = RTYPEDDATA_DATA(obj);
- if (ptr && type->function.dsize) {
- return type->function.dsize(ptr);
- }
+ if (RTYPEDDATA_P(obj) && RTYPEDDATA_TYPE(obj)->function.dsize) {
+ return RTYPEDDATA_TYPE(obj)->function.dsize(RTYPEDDATA_DATA(obj));
+ }
+ else {
+ return 0;
}
- return 0;
}
const char *
@@ -2002,12 +1383,12 @@ is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
/* check if p looks like a pointer using bsearch*/
lo = 0;
- hi = heap_allocated_pages;
+ hi = heap_pages_used;
while (lo < hi) {
mid = (lo + hi) / 2;
page = heap_pages_sorted[mid];
if (page->start <= p) {
- if (p < page->start + page->total_slots) {
+ if (p < page->start + page->limit) {
return TRUE;
}
lo = mid + 1;
@@ -2020,9 +1401,24 @@ is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
}
static int
-free_const_entry_i(st_data_t key, st_data_t value, st_data_t data)
+free_method_entry_i(ID key, rb_method_entry_t *me, st_data_t data)
+{
+ if (!me->mark) {
+ rb_free_method_entry(me);
+ }
+ return ST_CONTINUE;
+}
+
+void
+rb_free_m_table(st_table *tbl)
+{
+ st_foreach(tbl, free_method_entry_i, 0);
+ st_free_table(tbl);
+}
+
+static int
+free_const_entry_i(ID key, rb_const_entry_t *ce, st_data_t data)
{
- rb_const_entry_t *ce = (rb_const_entry_t *)value;
xfree(ce);
return ST_CONTINUE;
}
@@ -2035,21 +1431,20 @@ rb_free_const_table(st_table *tbl)
}
static inline void
-make_zombie(rb_objspace_t *objspace, VALUE obj, void (*dfree)(void *), void *data)
+make_deferred(rb_objspace_t *objspace,RVALUE *p)
{
- struct RZombie *zombie = RZOMBIE(obj);
- zombie->basic.flags = T_ZOMBIE;
- zombie->dfree = dfree;
- zombie->data = data;
- zombie->next = heap_pages_deferred_final;
- heap_pages_deferred_final = (VALUE)zombie;
+ p->as.basic.flags = T_ZOMBIE;
+ p->as.free.next = heap_pages_deferred_final;
+ heap_pages_deferred_final = p;
}
static inline void
-make_io_zombie(rb_objspace_t *objspace, VALUE obj)
+make_io_deferred(rb_objspace_t *objspace,RVALUE *p)
{
- rb_io_t *fptr = RANY(obj)->as.file.fptr;
- make_zombie(objspace, obj, (void (*)(void*))rb_io_fptr_finalize, fptr);
+ rb_io_t *fptr = p->as.file.fptr;
+ make_deferred(objspace, p);
+ p->as.data.dfree = (void (*)(void*))rb_io_fptr_finalize;
+ p->as.data.data = fptr;
}
static int
@@ -2072,16 +1467,8 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
}
#if USE_RGENGC
- if (RVALUE_WB_UNPROTECTED(obj)) CLEAR_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj);
-
-#if RGENGC_CHECK_MODE
-#define CHECK(x) if (x(obj) != FALSE) rb_bug("obj_free: " #x "(%s) != FALSE", obj_info(obj))
- CHECK(RVALUE_WB_UNPROTECTED);
- CHECK(RVALUE_MARKED);
- CHECK(RVALUE_MARKING);
- CHECK(RVALUE_UNCOLLECTIBLE);
-#undef CHECK
-#endif
+ if (MARKED_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj),obj))
+ CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(obj),obj);
#endif
switch (BUILTIN_TYPE(obj)) {
@@ -2093,7 +1480,9 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_MODULE:
case T_CLASS:
- rb_id_table_free(RCLASS_M_TBL(obj));
+ if (RCLASS_M_TBL(obj)) {
+ rb_free_m_table(RCLASS_M_TBL(obj));
+ }
if (RCLASS_IV_TBL(obj)) {
st_free_table(RCLASS_IV_TBL(obj));
}
@@ -2137,30 +1526,22 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
case T_DATA:
if (DATA_PTR(obj)) {
int free_immediately = FALSE;
- void (*dfree)(void *);
- void *data = DATA_PTR(obj);
if (RTYPEDDATA_P(obj)) {
free_immediately = (RANY(obj)->as.typeddata.type->flags & RUBY_TYPED_FREE_IMMEDIATELY) != 0;
- dfree = RANY(obj)->as.typeddata.type->function.dfree;
- if (0 && free_immediately == 0) {
- /* to expose non-free-immediate T_DATA */
+ RDATA(obj)->dfree = RANY(obj)->as.typeddata.type->function.dfree;
+ if (0 && free_immediately == 0) /* to expose non-free-immediate T_DATA */
fprintf(stderr, "not immediate -> %s\n", RANY(obj)->as.typeddata.type->wrap_struct_name);
- }
}
- else {
- dfree = RANY(obj)->as.data.dfree;
+ if (RANY(obj)->as.data.dfree == RUBY_DEFAULT_FREE) {
+ xfree(DATA_PTR(obj));
}
-
- if (dfree) {
- if (dfree == RUBY_DEFAULT_FREE) {
- xfree(data);
- }
- else if (free_immediately) {
- (*dfree)(data);
+ else if (RANY(obj)->as.data.dfree) {
+ if (free_immediately) {
+ (RDATA(obj)->dfree)(DATA_PTR(obj));
}
else {
- make_zombie(objspace, obj, dfree, data);
+ make_deferred(objspace, RANY(obj));
return 1;
}
}
@@ -2177,7 +1558,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_FILE:
if (RANY(obj)->as.file.fptr) {
- make_io_zombie(objspace, obj);
+ make_io_deferred(objspace, RANY(obj));
return 1;
}
break;
@@ -2185,13 +1566,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
case T_COMPLEX:
break;
case T_ICLASS:
- /* Basically , T_ICLASS shares table with the module */
- if (FL_TEST(obj, RICLASS_IS_ORIGIN)) {
- rb_id_table_free(RCLASS_M_TBL(obj));
- }
- if (RCLASS_CALLABLE_M_TBL(obj) != NULL) {
- rb_id_table_free(RCLASS_CALLABLE_M_TBL(obj));
- }
+ /* iClass shares table with the module */
if (RCLASS_EXT(obj)->subclasses) {
rb_class_detach_subclasses(obj);
RCLASS_EXT(obj)->subclasses = NULL;
@@ -2206,13 +1581,26 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_BIGNUM:
- if (!(RBASIC(obj)->flags & BIGNUM_EMBED_FLAG) && BIGNUM_DIGITS(obj)) {
- xfree(BIGNUM_DIGITS(obj));
+ if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
+ xfree(RBIGNUM_DIGITS(obj));
}
break;
-
case T_NODE:
- rb_gc_free_node(obj);
+ switch (nd_type(obj)) {
+ case NODE_SCOPE:
+ if (RANY(obj)->as.node.u1.tbl) {
+ xfree(RANY(obj)->as.node.u1.tbl);
+ }
+ break;
+ case NODE_ARGS:
+ if (RANY(obj)->as.node.u3.args) {
+ xfree(RANY(obj)->as.node.u3.args);
+ }
+ break;
+ case NODE_ALLOCA:
+ xfree(RANY(obj)->as.node.u1.node);
+ break;
+ }
break; /* no need to free iv_tbl */
case T_STRUCT:
@@ -2222,39 +1610,12 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
}
break;
- case T_SYMBOL:
- {
- rb_gc_free_dsymbol(obj);
- }
- break;
-
- case T_IMEMO:
- {
- switch (imemo_type(obj)) {
- case imemo_ment:
- rb_free_method_entry(&RANY(obj)->as.imemo.ment);
- break;
- case imemo_iseq:
- rb_iseq_free(&RANY(obj)->as.imemo.iseq);
- break;
- default:
- break;
- }
- }
- return 0;
-
default:
rb_bug("gc_sweep(): unknown data type 0x%x(%p) 0x%"PRIxVALUE,
BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags);
}
- if (FL_TEST(obj, FL_FINALIZE)) {
- make_zombie(objspace, obj, 0, 0);
- return 1;
- }
- else {
- return 0;
- }
+ return 0;
}
void
@@ -2262,13 +1623,8 @@ Init_heap(void)
{
rb_objspace_t *objspace = &rb_objspace;
- gc_stress_set(objspace, ruby_initial_gc_stress);
-
-#if RGENGC_ESTIMATE_OLDMALLOC
- objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_min;
-#endif
+ heap_add_pages(objspace, heap_eden, gc_params.heap_min_slots / HEAP_OBJ_LIMIT);
- heap_add_pages(objspace, heap_eden, gc_params.heap_init_slots / HEAP_OBJ_LIMIT);
init_mark_stack(&objspace->mark_stack);
#ifdef USE_SIGALTSTACK
@@ -2303,16 +1659,16 @@ objspace_each_objects(VALUE arg)
struct each_obj_args *args = (struct each_obj_args *)arg;
i = 0;
- while (i < heap_allocated_pages) {
+ while (i < heap_pages_used) {
while (0 < i && last_body < heap_pages_sorted[i-1]->body) i--;
- while (i < heap_allocated_pages && heap_pages_sorted[i]->body <= last_body) i++;
- if (heap_allocated_pages <= i) break;
+ while (i < heap_pages_used && heap_pages_sorted[i]->body <= last_body) i++;
+ if (heap_pages_used <= i) break;
page = heap_pages_sorted[i];
last_body = page->body;
pstart = page->start;
- pend = pstart + page->total_slots;
+ pend = pstart + page->limit;
if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
break;
@@ -2322,15 +1678,6 @@ objspace_each_objects(VALUE arg)
return Qnil;
}
-static VALUE
-incremental_enable(void)
-{
- rb_objspace_t *objspace = &rb_objspace;
-
- objspace->flags.dont_incremental = FALSE;
- return Qnil;
-}
-
/*
* rb_objspace_each_objects() is special C API to walk through
* Ruby object space. This C API is too difficult to use it.
@@ -2372,30 +1719,13 @@ rb_objspace_each_objects(each_obj_callback *callback, void *data)
{
struct each_obj_args args;
rb_objspace_t *objspace = &rb_objspace;
- int prev_dont_incremental = objspace->flags.dont_incremental;
- gc_rest(objspace);
- objspace->flags.dont_incremental = TRUE;
+ gc_rest_sweep(objspace);
+ objspace->flags.dont_lazy_sweep = TRUE;
args.callback = callback;
args.data = data;
-
- if (prev_dont_incremental) {
- objspace_each_objects((VALUE)&args);
- }
- else {
- rb_ensure(objspace_each_objects, (VALUE)&args, incremental_enable, Qnil);
- }
-}
-
-void
-rb_objspace_each_objects_without_setup(each_obj_callback *callback, void *data)
-{
- struct each_obj_args args;
- args.callback = callback;
- args.data = data;
-
- objspace_each_objects((VALUE)&args);
+ rb_ensure(objspace_each_objects, (VALUE)&args, lazy_sweep_enable, Qnil);
}
struct os_each_struct {
@@ -2411,17 +1741,13 @@ internal_object_p(VALUE obj)
if (p->as.basic.flags) {
switch (BUILTIN_TYPE(p)) {
case T_NONE:
- case T_IMEMO:
case T_ICLASS:
case T_NODE:
case T_ZOMBIE:
break;
case T_CLASS:
- if (!p->as.basic.klass) break;
- if (FL_TEST(obj, FL_SINGLETON)) {
- return rb_singleton_class_internal_p(obj);
- }
- return 0;
+ if (FL_TEST(p, FL_SINGLETON))
+ break;
default:
if (!p->as.basic.klass) break;
return 0;
@@ -2546,28 +1872,17 @@ static void
should_be_callable(VALUE block)
{
if (!rb_obj_respond_to(block, rb_intern("call"), TRUE)) {
- rb_raise(rb_eArgError, "wrong type argument %"PRIsVALUE" (should be callable)",
- rb_obj_class(block));
+ rb_raise(rb_eArgError, "wrong type argument %s (should be callable)",
+ rb_obj_classname(block));
}
}
-static void
-should_be_finalizable(VALUE obj)
-{
- if (!FL_ABLE(obj)) {
- rb_raise(rb_eArgError, "cannot define finalizer for %s",
- rb_obj_classname(obj));
- }
- rb_check_frozen(obj);
-}
/*
* call-seq:
* ObjectSpace.define_finalizer(obj, aProc=proc())
*
* Adds <i>aProc</i> as a finalizer, to be called after <i>obj</i>
- * was destroyed. The object ID of the <i>obj</i> will be passed
- * as an argument to <i>aProc</i>. If <i>aProc</i> is a lambda or
- * method, make sure it can be called with a single argument.
+ * was destroyed.
*
*/
@@ -2577,7 +1892,7 @@ define_final(int argc, VALUE *argv, VALUE os)
VALUE obj, block;
rb_scan_args(argc, argv, "11", &obj, &block);
- should_be_finalizable(obj);
+ rb_check_frozen(obj);
if (argc == 1) {
block = rb_block_proc();
}
@@ -2595,6 +1910,10 @@ define_final0(VALUE obj, VALUE block)
VALUE table;
st_data_t data;
+ if (!FL_ABLE(obj)) {
+ rb_raise(rb_eArgError, "cannot define finalizer for %s",
+ rb_obj_classname(obj));
+ }
RBASIC(obj)->flags |= FL_FINALIZE;
block = rb_ary_new3(2, INT2FIX(rb_safe_level()), block);
@@ -2602,20 +1921,6 @@ define_final0(VALUE obj, VALUE block)
if (st_lookup(finalizer_table, obj, &data)) {
table = (VALUE)data;
-
- /* avoid duplicate block, table is usually small */
- {
- const VALUE *ptr = RARRAY_CONST_PTR(table);
- long len = RARRAY_LEN(table);
- long i;
-
- for (i = 0; i < len; i++, ptr++) {
- if (rb_funcall(*ptr, idEq, 1, block)) {
- return *ptr;
- }
- }
- }
-
rb_ary_push(table, block);
}
else {
@@ -2629,7 +1934,7 @@ define_final0(VALUE obj, VALUE block)
VALUE
rb_define_finalizer(VALUE obj, VALUE block)
{
- should_be_finalizable(obj);
+ rb_check_frozen(obj);
should_be_callable(block);
return define_final0(obj, block);
}
@@ -2653,79 +1958,89 @@ static VALUE
run_single_final(VALUE arg)
{
VALUE *args = (VALUE *)arg;
-
- return rb_check_funcall(args[0], idCall, 1, args+1);
+ rb_eval_cmd(args[0], args[1], (int)args[2]);
+ return Qnil;
}
static void
run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table)
{
long i;
- VALUE args[2];
- const int safe = rb_safe_level();
- const VALUE errinfo = rb_errinfo();
+ int status;
+ VALUE args[3];
+ VALUE objid = nonspecial_obj_id(obj);
- args[1] = nonspecial_obj_id(obj);
+ if (RARRAY_LEN(table) > 0) {
+ args[1] = rb_obj_freeze(rb_ary_new3(1, objid));
+ }
+ else {
+ args[1] = 0;
+ }
+ args[2] = (VALUE)rb_safe_level();
for (i=0; i<RARRAY_LEN(table); i++) {
- const VALUE final = RARRAY_AREF(table, i);
- const VALUE cmd = RARRAY_AREF(final, 1);
- const int level = OBJ_TAINTED(cmd) ?
- RUBY_SAFE_LEVEL_MAX : FIX2INT(RARRAY_AREF(final, 0));
- int status = 0;
-
- args[0] = cmd;
- rb_set_safe_level_force(level);
+ VALUE final = RARRAY_AREF(table, i);
+ args[0] = RARRAY_AREF(final, 1);
+ args[2] = FIX2INT(RARRAY_AREF(final, 0));
+ status = 0;
rb_protect(run_single_final, (VALUE)args, &status);
- rb_set_safe_level_force(safe);
- rb_set_errinfo(errinfo);
+ if (status)
+ rb_set_errinfo(Qnil);
}
}
static void
-run_final(rb_objspace_t *objspace, VALUE zombie)
+run_final(rb_objspace_t *objspace, VALUE obj)
{
+ RUBY_DATA_FUNC free_func = 0;
st_data_t key, table;
- if (RZOMBIE(zombie)->dfree) {
- RZOMBIE(zombie)->dfree(RZOMBIE(zombie)->data);
+ heap_pages_final_num--;
+
+ RBASIC_CLEAR_CLASS(obj);
+
+ if (RTYPEDDATA_P(obj)) {
+ free_func = RTYPEDDATA_TYPE(obj)->function.dfree;
+ }
+ else {
+ free_func = RDATA(obj)->dfree;
+ }
+ if (free_func) {
+ (*free_func)(DATA_PTR(obj));
}
- key = (st_data_t)zombie;
+ key = (st_data_t)obj;
if (st_delete(finalizer_table, &key, &table)) {
- run_finalizer(objspace, zombie, (VALUE)table);
+ run_finalizer(objspace, obj, (VALUE)table);
}
}
static void
-finalize_list(rb_objspace_t *objspace, VALUE zombie)
+finalize_list(rb_objspace_t *objspace, RVALUE *p)
{
- while (zombie) {
- VALUE next_zombie = RZOMBIE(zombie)->next;
- struct heap_page *page = GET_HEAP_PAGE(zombie);
+ while (p) {
+ RVALUE *tmp = p->as.free.next;
+ struct heap_page *page = GET_HEAP_PAGE(p);
- run_final(objspace, zombie);
+ run_final(objspace, (VALUE)p);
+ objspace->profile.total_freed_object_num++;
- RZOMBIE(zombie)->basic.flags = 0;
- heap_pages_final_slots--;
- page->final_slots--;
- page->free_slots++;
- heap_page_add_freeobj(objspace, GET_HEAP_PAGE(zombie), zombie);
+ page->final_num--;
+ heap_page_add_freeobj(objspace, GET_HEAP_PAGE(p), (VALUE)p);
+ heap_pages_swept_num++;
- heap_pages_swept_slots++;
- objspace->profile.total_freed_objects++;
-
- zombie = next_zombie;
+ p = tmp;
}
}
static void
finalize_deferred(rb_objspace_t *objspace)
{
- VALUE zombie;
+ RVALUE *p = heap_pages_deferred_final;
+ heap_pages_deferred_final = 0;
- while ((zombie = ATOMIC_VALUE_EXCHANGE(heap_pages_deferred_final, 0)) != 0) {
- finalize_list(objspace, zombie);
+ if (p) {
+ finalize_list(objspace, p);
}
}
@@ -2746,7 +2061,7 @@ rb_gc_finalize_deferred(void)
}
static void
-gc_finalize_deferred_register(void)
+gc_finalize_deferred_register()
{
if (rb_postponed_job_register_one(0, gc_finalize_deferred, 0) == 0) {
rb_bug("gc_finalize_deferred_register: can't register finalizer.");
@@ -2774,9 +2089,6 @@ force_chain_object(st_data_t key, st_data_t val, st_data_t arg)
void
rb_gc_call_finalizer_at_exit(void)
{
-#if RGENGC_CHECK_MODE >= 2
- gc_verify_internal_consistency(Qnil);
-#endif
rb_objspace_call_finalizer(&rb_objspace);
}
@@ -2786,7 +2098,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
RVALUE *p, *pend;
size_t i;
- gc_rest(objspace);
+ gc_rest_sweep(objspace);
if (ATOMIC_EXCHANGE(finalizing, 1)) return;
@@ -2794,10 +2106,6 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
finalize_deferred(objspace);
assert(heap_pages_deferred_final == 0);
- gc_rest(objspace);
- /* prohibit incremental GC */
- objspace->flags.dont_incremental = 1;
-
/* force to run finalizer */
while (finalizer_table->num_entries) {
struct force_finalize_list *list = 0;
@@ -2812,15 +2120,12 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
}
}
- /* prohibit GC because force T_DATA finalizers can break an object graph consistency */
- dont_gc = 1;
-
- /* running data/file finalizers are part of garbage collection */
- gc_enter(objspace, "rb_objspace_call_finalizer");
+ /* finalizers are part of garbage collection */
+ during_gc++;
- /* run data/file object's finalizers */
- for (i = 0; i < heap_allocated_pages; i++) {
- p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->total_slots;
+ /* run data object's finalizers */
+ for (i = 0; i < heap_pages_used; i++) {
+ p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->limit;
while (p < pend) {
switch (BUILTIN_TYPE(p)) {
case T_DATA:
@@ -2836,21 +2141,19 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
xfree(DATA_PTR(p));
}
else if (RANY(p)->as.data.dfree) {
- make_zombie(objspace, (VALUE)p, RANY(p)->as.data.dfree, RANY(p)->as.data.data);
+ make_deferred(objspace, RANY(p));
}
break;
case T_FILE:
if (RANY(p)->as.file.fptr) {
- make_io_zombie(objspace, (VALUE)p);
+ make_io_deferred(objspace, RANY(p));
}
break;
}
p++;
}
}
-
- gc_exit(objspace, "rb_objspace_call_finalizer");
-
+ during_gc = 0;
if (heap_pages_deferred_final) {
finalize_list(objspace, heap_pages_deferred_final);
}
@@ -2873,7 +2176,7 @@ static inline int
heap_is_swept_object(rb_objspace_t *objspace, rb_heap_t *heap, VALUE ptr)
{
struct heap_page *page = GET_HEAP_PAGE(ptr);
- return page->flags.before_sweep ? FALSE : TRUE;
+ return page->before_sweep ? FALSE : TRUE;
}
static inline int
@@ -2887,58 +2190,43 @@ is_swept_object(rb_objspace_t *objspace, VALUE ptr)
}
}
-/* garbage objects will be collected soon. */
static inline int
-is_garbage_object(rb_objspace_t *objspace, VALUE ptr)
+is_dead_object(rb_objspace_t *objspace, VALUE ptr)
{
- if (!is_lazy_sweeping(heap_eden) ||
- is_swept_object(objspace, ptr) ||
- MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(ptr), ptr)) {
-
- return FALSE;
- }
- else {
- return TRUE;
- }
+ if (!is_lazy_sweeping(heap_eden) || MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(ptr), ptr)) return FALSE;
+ if (!is_swept_object(objspace, ptr)) return TRUE;
+ return FALSE;
}
static inline int
is_live_object(rb_objspace_t *objspace, VALUE ptr)
{
switch (BUILTIN_TYPE(ptr)) {
- case T_NONE:
- case T_ZOMBIE:
- return FALSE;
- }
-
- if (!is_garbage_object(objspace, ptr)) {
- return TRUE;
- }
- else {
+ case 0: case T_ZOMBIE:
return FALSE;
}
+ if (is_dead_object(objspace, ptr)) return FALSE;
+ return TRUE;
}
static inline int
is_markable_object(rb_objspace_t *objspace, VALUE obj)
{
- if (rb_special_const_p(obj)) return FALSE; /* special const is not markable */
- check_rvalue_consistency(obj);
- return TRUE;
-}
+ if (rb_special_const_p(obj)) return 0; /* special const is not markable */
-int
-rb_objspace_markable_object_p(VALUE obj)
-{
- rb_objspace_t *objspace = &rb_objspace;
- return is_markable_object(objspace, obj) && is_live_object(objspace, obj);
+ if (RGENGC_CHECK_MODE) {
+ if (!is_pointer_to_heap(objspace, (void *)obj)) rb_bug("is_markable_object: %p is not pointer to heap", (void *)obj);
+ if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("is_markable_object: %p is T_NONE", (void *)obj);
+ if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("is_markable_object: %p is T_ZOMBIE", (void *)obj);
+ }
+
+ return 1;
}
int
-rb_objspace_garbage_object_p(VALUE obj)
+rb_objspace_markable_object_p(VALUE obj)
{
- rb_objspace_t *objspace = &rb_objspace;
- return is_garbage_object(objspace, obj);
+ return is_markable_object(&rb_objspace, obj);
}
/*
@@ -2978,7 +2266,7 @@ id2ref(VALUE obj, VALUE objid)
if ((ptr % sizeof(RVALUE)) == (4 << 2)) {
ID symid = ptr / sizeof(RVALUE);
- if (rb_id2str(symid) == 0)
+ if (rb_id2name(symid) == 0)
rb_raise(rb_eRangeError, "%p is not symbol id value", p0);
return ID2SYM(symid);
}
@@ -2989,9 +2277,6 @@ id2ref(VALUE obj, VALUE objid)
if (!is_live_object(objspace, ptr)) {
rb_raise(rb_eRangeError, "%p is recycled object", p0);
}
- if (RBASIC(ptr)->klass == 0) {
- rb_raise(rb_eRangeError, "%p is internal object", p0);
- }
return (VALUE)ptr;
}
@@ -3005,19 +2290,28 @@ id2ref(VALUE obj, VALUE objid)
*
* Returns an integer identifier for +obj+.
*
- * The same number will be returned on all calls to +object_id+ for a given
- * object, and no two active objects will share an id.
+ * The same number will be returned on all calls to +id+ for a given object,
+ * and no two active objects will share an id.
+ *
+ * Object#object_id is a different concept from the +:name+ notation, which
+ * returns the symbol id of +name+.
*
- * Note: that some objects of builtin classes are reused for optimization.
- * This is the case for immediate values and frozen string literals.
+ * Replaces the deprecated Object#id.
+ */
+
+/*
+ * call-seq:
+ * obj.hash -> fixnum
+ *
+ * Generates a Fixnum hash value for this object.
*
- * Immediate values are not passed by reference but are passed by value:
- * +nil+, +true+, +false+, Fixnums, Symbols, and some Floats.
+ * This function must have the property that <code>a.eql?(b)</code> implies
+ * <code>a.hash == b.hash</code>.
*
- * Object.new.object_id == Object.new.object_id # => false
- * (21 * 2).object_id == (21 * 2).object_id # => true
- * "hello".object_id == "hello".object_id # => false
- * "hi".freeze.object_id == "hi".freeze.object_id # => true
+ * The hash value is used by Hash class.
+ *
+ * Any hash value that exceeds the capacity of a Fixnum will be truncated
+ * before being used.
*/
VALUE
@@ -3051,7 +2345,7 @@ rb_obj_id(VALUE obj)
* 24 if 32-bit, double is 8-byte aligned
* 40 if 64-bit
*/
- if (STATIC_SYM_P(obj)) {
+ if (SYMBOL_P(obj)) {
return (SYM2ID(obj) * sizeof(RVALUE) + (4 << 2)) | FIXNUM_FLAG;
}
else if (FLONUM_P(obj)) {
@@ -3067,10 +2361,14 @@ rb_obj_id(VALUE obj)
return nonspecial_obj_id(obj);
}
+size_t rb_str_memsize(VALUE);
+size_t rb_ary_memsize(VALUE);
+size_t rb_io_memsize(const rb_io_t *);
+size_t rb_generic_ivar_memsize(VALUE);
#include "regint.h"
static size_t
-obj_memsize_of(VALUE obj, int use_all_types)
+obj_memsize_of(VALUE obj, int use_tdata)
{
size_t size = 0;
@@ -3092,7 +2390,7 @@ obj_memsize_of(VALUE obj, int use_all_types)
case T_MODULE:
case T_CLASS:
if (RCLASS_M_TBL(obj)) {
- size += rb_id_table_memsize(RCLASS_M_TBL(obj));
+ size += st_memsize(RCLASS_M_TBL(obj));
}
if (RCLASS_EXT(obj)) {
if (RCLASS_IV_TBL(obj)) {
@@ -3110,13 +2408,6 @@ obj_memsize_of(VALUE obj, int use_all_types)
size += sizeof(rb_classext_t);
}
break;
- case T_ICLASS:
- if (FL_TEST(obj, RICLASS_IS_ORIGIN)) {
- if (RCLASS_M_TBL(obj)) {
- size += rb_id_table_memsize(RCLASS_M_TBL(obj));
- }
- }
- break;
case T_STRING:
size += rb_str_memsize(obj);
break;
@@ -3134,7 +2425,7 @@ obj_memsize_of(VALUE obj, int use_all_types)
}
break;
case T_DATA:
- if (use_all_types) size += rb_objspace_data_type_memsize(obj);
+ if (use_tdata) size += rb_objspace_data_type_memsize(obj);
break;
case T_MATCH:
if (RMATCH(obj)->rmatch) {
@@ -3151,22 +2442,31 @@ obj_memsize_of(VALUE obj, int use_all_types)
break;
case T_RATIONAL:
case T_COMPLEX:
- case T_IMEMO:
+ break;
+ case T_ICLASS:
+ /* iClass shares table with the module */
break;
case T_FLOAT:
- case T_SYMBOL:
break;
case T_BIGNUM:
- if (!(RBASIC(obj)->flags & BIGNUM_EMBED_FLAG) && BIGNUM_DIGITS(obj)) {
- size += BIGNUM_LEN(obj) * sizeof(BDIGIT);
+ if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
+ size += RBIGNUM_LEN(obj) * sizeof(BDIGIT);
}
break;
-
case T_NODE:
- if (use_all_types) size += rb_node_memsize(obj);
- break;
+ switch (nd_type(obj)) {
+ case NODE_SCOPE:
+ if (RNODE(obj)->u1.tbl) {
+ /* TODO: xfree(RANY(obj)->as.node.u1.tbl); */
+ }
+ break;
+ case NODE_ALLOCA:
+ /* TODO: xfree(RANY(obj)->as.node.u1.node); */
+ ;
+ }
+ break; /* no need to free iv_tbl */
case T_STRUCT:
if ((RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK) == 0 &&
@@ -3183,7 +2483,7 @@ obj_memsize_of(VALUE obj, int use_all_types)
BUILTIN_TYPE(obj), (void*)obj);
}
- return size + sizeof(RVALUE);
+ return size;
}
size_t
@@ -3205,7 +2505,7 @@ set_zero(st_data_t key, st_data_t val, st_data_t arg)
* call-seq:
* ObjectSpace.count_objects([result_hash]) -> hash
*
- * Counts all objects grouped by type.
+ * Counts objects for each type.
*
* It returns a hash, such as:
* {
@@ -3219,19 +2519,9 @@ set_zero(st_data_t key, st_data_t val, st_data_t arg)
* The contents of the returned hash are implementation specific.
* It may be changed in future.
*
- * The keys starting with +:T_+ means live objects.
- * For example, +:T_ARRAY+ is the number of arrays.
- * +:FREE+ means object slots which is not used now.
- * +:TOTAL+ means sum of above.
- *
* If the optional argument +result_hash+ is given,
* it is overwritten and returned. This is intended to avoid probe effect.
*
- * h = {}
- * ObjectSpace.count_objects(h)
- * puts h
- * # => { :TOTAL=>10000, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249 }
- *
* This method is only expected to work on C Ruby.
*
*/
@@ -3255,11 +2545,11 @@ count_objects(int argc, VALUE *argv, VALUE os)
counts[i] = 0;
}
- for (i = 0; i < heap_allocated_pages; i++) {
+ for (i = 0; i < heap_pages_used; i++) {
struct heap_page *page = heap_pages_sorted[i];
RVALUE *p, *pend;
- p = page->start; pend = p + page->total_slots;
+ p = page->start; pend = p + page->limit;
for (;p < pend; p++) {
if (p->as.basic.flags) {
counts[BUILTIN_TYPE(p)]++;
@@ -3268,7 +2558,7 @@ count_objects(int argc, VALUE *argv, VALUE os)
freed++;
}
}
- total += page->total_slots;
+ total += page->limit;
}
if (hash == Qnil) {
@@ -3305,7 +2595,6 @@ count_objects(int argc, VALUE *argv, VALUE os)
COUNT_TYPE(T_FALSE);
COUNT_TYPE(T_SYMBOL);
COUNT_TYPE(T_FIXNUM);
- COUNT_TYPE(T_IMEMO);
COUNT_TYPE(T_UNDEF);
COUNT_TYPE(T_NODE);
COUNT_TYPE(T_ICLASS);
@@ -3326,22 +2615,31 @@ count_objects(int argc, VALUE *argv, VALUE os)
/* Sweeping */
+static VALUE
+lazy_sweep_enable(void)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+
+ objspace->flags.dont_lazy_sweep = FALSE;
+ return Qnil;
+}
+
static size_t
-objspace_available_slots(rb_objspace_t *objspace)
+objspace_live_num(rb_objspace_t *objspace)
{
- return heap_eden->total_slots + heap_tomb->total_slots;
+ return objspace->profile.total_allocated_object_num - objspace->profile.total_freed_object_num;
}
static size_t
-objspace_live_slots(rb_objspace_t *objspace)
+objspace_limit_num(rb_objspace_t *objspace)
{
- return (objspace->total_allocated_objects - objspace->profile.total_freed_objects) - heap_pages_final_slots;
+ return heap_eden->limit + heap_tomb->limit;
}
static size_t
-objspace_free_slots(rb_objspace_t *objspace)
+objspace_free_num(rb_objspace_t *objspace)
{
- return objspace_available_slots(objspace) - objspace_live_slots(objspace) - heap_pages_final_slots;
+ return objspace_limit_num(objspace) - (objspace_live_num(objspace) - heap_pages_final_num);
}
static void
@@ -3349,28 +2647,26 @@ gc_setup_mark_bits(struct heap_page *page)
{
#if USE_RGENGC
/* copy oldgen bitmap to mark bitmap */
- memcpy(&page->mark_bits[0], &page->uncollectible_bits[0], HEAP_BITMAP_SIZE);
+ memcpy(&page->mark_bits[0], &page->oldgen_bits[0], HEAP_BITMAP_SIZE);
#else
/* clear mark bitmap */
memset(&page->mark_bits[0], 0, HEAP_BITMAP_SIZE);
#endif
}
-/* TRUE : has empty slots */
-/* FALSE: no empty slots (or move to tomb heap because no live slots) */
static inline void
gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page)
{
int i;
- int empty_slots = 0, freed_slots = 0, final_slots = 0;
+ size_t empty_num = 0, freed_num = 0, final_num = 0;
RVALUE *p, *pend,*offset;
bits_t *bits, bitset;
- gc_report(2, objspace, "page_sweep: start.\n");
+ rgengc_report(1, objspace, "page_sweep: start.\n");
- sweep_page->flags.before_sweep = FALSE;
+ sweep_page->before_sweep = 0;
- p = sweep_page->start; pend = p + sweep_page->total_slots;
+ p = sweep_page->start; pend = p + sweep_page->limit;
offset = p - NUM_IN_PAGE(p);
bits = sweep_page->mark_bits;
@@ -3383,35 +2679,30 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
if (bitset) {
p = offset + i * BITS_BITLENGTH;
do {
- if (bitset & 1) {
- switch (BUILTIN_TYPE(p)) {
- default: { /* majority case */
- gc_report(2, objspace, "page_sweep: free %s\n", obj_info((VALUE)p));
+ if ((bitset & 1) && BUILTIN_TYPE(p) != T_ZOMBIE) {
+ if (p->as.basic.flags) {
+ rgengc_report(3, objspace, "page_sweep: free %p (%s)\n", p, obj_type_name((VALUE)p));
#if USE_RGENGC && RGENGC_CHECK_MODE
- if (!is_full_marking(objspace)) {
- if (RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %s - old while minor GC.", obj_info((VALUE)p));
- if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %s - remembered.", obj_info((VALUE)p));
- }
-#endif
- if (obj_free(objspace, (VALUE)p)) {
- final_slots++;
- }
- else {
- (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
- heap_page_add_freeobj(objspace, sweep_page, (VALUE)p);
- gc_report(3, objspace, "page_sweep: %s is added to freelist\n", obj_info((VALUE)p));
- freed_slots++;
- }
- break;
- }
-
- /* minor cases */
- case T_ZOMBIE:
- /* already counted */
- break;
- case T_NONE:
- empty_slots++; /* already freed */
- break;
+ if (objspace->rgengc.during_minor_gc && RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %p (%s) is old while minor GC.\n", p, obj_type_name((VALUE)p));
+ if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %p (%s) is remembered.\n", p, obj_type_name((VALUE)p));
+#endif
+ if (obj_free(objspace, (VALUE)p)) {
+ final_num++;
+ }
+ else if (FL_TEST(p, FL_FINALIZE)) {
+ RDATA(p)->dfree = 0;
+ make_deferred(objspace,p);
+ final_num++;
+ }
+ else {
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
+ heap_page_add_freeobj(objspace, sweep_page, (VALUE)p);
+ rgengc_report(3, objspace, "page_sweep: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p));
+ freed_num++;
+ }
+ }
+ else {
+ empty_num++;
}
}
p++;
@@ -3423,21 +2714,30 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
gc_setup_mark_bits(sweep_page);
#if GC_PROFILE_MORE_DETAIL
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
- record->removing_objects += final_slots + freed_slots;
- record->empty_objects += empty_slots;
+ record->removing_objects += final_num + freed_num;
+ record->empty_objects += empty_num;
}
#endif
- if (0) fprintf(stderr, "gc_page_sweep(%d): total_slots: %d, freed_slots: %d, empty_slots: %d, final_slots: %d\n",
- (int)rb_gc_count(),
- (int)sweep_page->total_slots,
- freed_slots, empty_slots, final_slots);
- heap_pages_swept_slots += sweep_page->free_slots = freed_slots + empty_slots;
- objspace->profile.total_freed_objects += freed_slots;
- heap_pages_final_slots += final_slots;
- sweep_page->final_slots += final_slots;
+ if (final_num + freed_num + empty_num == sweep_page->limit) {
+ /* there are no living objects -> move this page to tomb heap */
+ heap_unlink_page(objspace, heap, sweep_page);
+ heap_add_page(objspace, heap_tomb, sweep_page);
+ }
+ else {
+ if (freed_num + empty_num > 0) {
+ heap_add_freepage(objspace, heap, sweep_page);
+ }
+ else {
+ sweep_page->free_next = NULL;
+ }
+ }
+ heap_pages_swept_num += freed_num + empty_num;
+ objspace->profile.total_freed_object_num += freed_num;
+ heap_pages_final_num += final_num;
+ sweep_page->final_num = final_num;
if (heap_pages_deferred_final && !finalizing) {
rb_thread_t *th = GET_THREAD();
@@ -3446,45 +2746,29 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
}
}
- gc_report(2, objspace, "page_sweep: end.\n");
+ rgengc_report(1, objspace, "page_sweep: end.\n");
}
/* allocate additional minimum page to work */
static void
gc_heap_prepare_minimum_pages(rb_objspace_t *objspace, rb_heap_t *heap)
{
- if (!heap->free_pages && heap_increment(objspace, heap) == FALSE) {
+ if (!heap->free_pages) {
/* there is no free after page_sweep() */
- heap_set_increment(objspace, 1);
+ heap_set_increment(objspace, 0);
if (!heap_increment(objspace, heap)) { /* can't allocate additional free objects */
+ during_gc = 0;
rb_memerror();
}
}
}
static void
-gc_stat_transition(rb_objspace_t *objspace, enum gc_stat stat)
-{
-#if RGENGC_CHECK_MODE
- enum gc_stat prev_stat = objspace->flags.stat;
- switch (prev_stat) {
- case gc_stat_none: assert(stat == gc_stat_marking); break;
- case gc_stat_marking: assert(stat == gc_stat_sweeping); break;
- case gc_stat_sweeping: assert(stat == gc_stat_none); break;
- }
-#endif
- objspace->flags.stat = stat;
-}
-
-static void
-gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap)
+gc_before_heap_sweep(rb_objspace_t *objspace, rb_heap_t *heap)
{
heap->sweep_pages = heap->pages;
heap->free_pages = NULL;
-#if GC_ENABLE_INCREMENTAL_MARK
- heap->pooled_pages = NULL;
- objspace->rincgc.pooled_slots = 0;
-#endif
+
if (heap->using_page) {
RVALUE **p = &heap->using_page->freelist;
while (*p) {
@@ -3500,174 +2784,228 @@ gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap)
__attribute__((noinline))
#endif
static void
-gc_sweep_start(rb_objspace_t *objspace)
+gc_before_sweep(rb_objspace_t *objspace)
{
rb_heap_t *heap;
- size_t total_limit_slot;
+ size_t total_limit_num;
- gc_stat_transition(objspace, gc_stat_sweeping);
+ rgengc_report(1, objspace, "gc_before_sweep\n");
- /* sometimes heap_allocatable_pages is not 0 */
- heap_pages_swept_slots = heap_allocatable_pages * HEAP_OBJ_LIMIT;
- total_limit_slot = objspace_available_slots(objspace);
+ /* sweep unlinked method entries */
+ if (GET_VM()->unlinked_method_entry_list) {
+ rb_sweep_method_entry(GET_VM());
+ }
+
+ heap_pages_swept_num = 0;
+ total_limit_num = objspace_limit_num(objspace);
- heap_pages_min_free_slots = (size_t)(total_limit_slot * GC_HEAP_FREE_SLOTS_MIN_RATIO);
- if (heap_pages_min_free_slots < gc_params.heap_free_slots) {
- heap_pages_min_free_slots = gc_params.heap_free_slots;
+ heap_pages_min_free_slots = (size_t)(total_limit_num * 0.30);
+ if (heap_pages_min_free_slots < gc_params.heap_min_free_slots) {
+ heap_pages_min_free_slots = gc_params.heap_min_free_slots;
}
- heap_pages_max_free_slots = (size_t)(total_limit_slot * GC_HEAP_FREE_SLOTS_MAX_RATIO);
- if (heap_pages_max_free_slots < gc_params.heap_init_slots) {
- heap_pages_max_free_slots = gc_params.heap_init_slots;
+ heap_pages_max_free_slots = (size_t)(total_limit_num * 0.80);
+ if (heap_pages_max_free_slots < gc_params.heap_min_slots) {
+ heap_pages_max_free_slots = gc_params.heap_min_slots;
}
if (0) fprintf(stderr, "heap_pages_min_free_slots: %d, heap_pages_max_free_slots: %d\n",
(int)heap_pages_min_free_slots, (int)heap_pages_max_free_slots);
heap = heap_eden;
- gc_sweep_start_heap(objspace, heap);
+ gc_before_heap_sweep(objspace, heap);
+
+ gc_prof_set_malloc_info(objspace);
+
+ /* reset malloc info */
+ if (0) fprintf(stderr, "%d\t%d\t%d\n", (int)rb_gc_count(), (int)malloc_increase, (int)malloc_limit);
+
+ {
+ size_t inc = ATOMIC_SIZE_EXCHANGE(malloc_increase, 0);
+ size_t old_limit = malloc_limit;
+
+ if (inc > malloc_limit) {
+ malloc_limit = (size_t)(inc * gc_params.malloc_limit_growth_factor);
+ if (gc_params.malloc_limit_max > 0 && /* ignore max-check if 0 */
+ malloc_limit > gc_params.malloc_limit_max) {
+ malloc_limit = inc;
+ }
+ }
+ else {
+ malloc_limit = (size_t)(malloc_limit * 0.98); /* magic number */
+ if (malloc_limit < gc_params.malloc_limit_min) {
+ malloc_limit = gc_params.malloc_limit_min;
+ }
+ }
+
+ if (0) {
+ if (old_limit != malloc_limit) {
+ fprintf(stderr, "[%"PRIuSIZE"] malloc_limit: %"PRIuSIZE" -> %"PRIuSIZE"\n",
+ rb_gc_count(), old_limit, malloc_limit);
+ }
+ else {
+ fprintf(stderr, "[%"PRIuSIZE"] malloc_limit: not changed (%"PRIuSIZE")\n",
+ rb_gc_count(), malloc_limit);
+ }
+ }
+ }
+
+ /* reset oldspace info */
+#if RGENGC_ESTIMATE_OLDSPACE
+ if (objspace->rgengc.during_minor_gc) {
+ if (objspace->rgengc.oldspace_increase > objspace->rgengc.oldspace_increase_limit) {
+ objspace->rgengc.need_major_gc = TRUE;
+ objspace->rgengc.oldspace_increase_limit =
+ (size_t)(objspace->rgengc.oldspace_increase_limit * gc_params.oldspace_limit_growth_factor);
+ if (objspace->rgengc.oldspace_increase_limit > gc_params.oldspace_limit_max) {
+ objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_max;
+ }
+ }
+ else {
+ objspace->rgengc.oldspace_increase_limit =
+ (size_t)(objspace->rgengc.oldspace_increase_limit / ((gc_params.oldspace_limit_growth_factor - 1)/10 + 1));
+ if (objspace->rgengc.oldspace_increase_limit < gc_params.oldspace_limit_min) {
+ objspace->rgengc.oldspace_increase_limit = gc_params.oldspace_limit_min;
+ }
+ }
+
+ if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n", (int)rb_gc_count(), objspace->rgengc.need_major_gc,
+ (unsigned int)objspace->rgengc.oldspace_increase,
+ (unsigned int)objspace->rgengc.oldspace_increase_limit,
+ (unsigned int)gc_params.oldspace_limit_max);
+ }
+ else {
+ /* major GC */
+ objspace->rgengc.oldspace_increase = 0;
+ }
+
+#endif
+
}
static void
-gc_sweep_finish(rb_objspace_t *objspace)
+gc_after_sweep(rb_objspace_t *objspace)
{
rb_heap_t *heap = heap_eden;
- gc_report(1, objspace, "gc_sweep_finish: heap->total_slots: %d, heap->swept_slots: %d, min_free_slots: %d\n",
- (int)heap->total_slots, (int)heap_pages_swept_slots, (int)heap_pages_min_free_slots);
+ rgengc_report(1, objspace, "after_gc_sweep: heap->limit: %d, heap->swept_num: %d, min_free_slots: %d\n",
+ (int)heap->limit, (int)heap_pages_swept_num, (int)heap_pages_min_free_slots);
+
+ if (heap_pages_swept_num < heap_pages_min_free_slots) {
+ heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_num) / HEAP_OBJ_LIMIT);
+ heap_increment(objspace, heap);
+
+#if USE_RGENGC
+ if (objspace->rgengc.remembered_shady_object_count + objspace->rgengc.old_object_count > (heap_pages_length * HEAP_OBJ_LIMIT) / 2) {
+ /* if [old]+[remembered shady] > [all object count]/2, then do major GC */
+ objspace->rgengc.need_major_gc = TRUE;
+ }
+#endif
+ }
gc_prof_set_heap_info(objspace);
heap_pages_free_unused_pages(objspace);
/* if heap_pages has unused pages, then assign them to increment */
- if (heap_allocatable_pages < heap_tomb->page_length) {
- heap_allocatable_pages = heap_tomb->page_length;
+ if (heap_pages_increment < heap_tomb->used) {
+ heap_pages_increment = heap_tomb->used;
+ heap_pages_expand_sorted(objspace);
}
- gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END_SWEEP, 0);
- gc_stat_transition(objspace, gc_stat_none);
-
-#if RGENGC_CHECK_MODE >= 2
- gc_verify_internal_consistency(Qnil);
+#if RGENGC_PROFILE > 0
+ if (0) {
+ fprintf(stderr, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
+ (int)rb_gc_count(),
+ (int)objspace->profile.major_gc_count,
+ (int)objspace->profile.minor_gc_count,
+ (int)objspace->profile.promote_infant_count,
+#if RGENGC_THREEGEN
+ (int)objspace->profile.promote_young_count,
+#else
+ 0,
+#endif
+ (int)objspace->profile.remembered_normal_object_count,
+ (int)objspace->rgengc.remembered_shady_object_count);
+ }
#endif
+
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END, 0 /* TODO: pass minor/immediate flag? */);
}
static int
-gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
+gc_heap_lazy_sweep(rb_objspace_t *objspace, rb_heap_t *heap)
{
- struct heap_page *sweep_page = heap->sweep_pages, *next;
- int unlink_limit = 3;
-#if GC_ENABLE_INCREMENTAL_MARK
- int need_pool = will_be_incremental_marking(objspace) ? TRUE : FALSE;
+ struct heap_page *page = heap->sweep_pages, *next;
+ int result = FALSE;
- gc_report(2, objspace, "gc_sweep_step (need_pool: %d)\n", need_pool);
-#else
- gc_report(2, objspace, "gc_sweep_step\n");
-#endif
-
- if (sweep_page == NULL) return FALSE;
+ if (page == NULL) return FALSE;
#if GC_ENABLE_LAZY_SWEEP
gc_prof_sweep_timer_start(objspace);
#endif
- while (sweep_page) {
- heap->sweep_pages = next = sweep_page->next;
- gc_page_sweep(objspace, heap, sweep_page);
+ while (page) {
+ heap->sweep_pages = next = page->next;
- if (sweep_page->final_slots + sweep_page->free_slots == sweep_page->total_slots &&
- unlink_limit > 0) {
- unlink_limit--;
- /* there are no living objects -> move this page to tomb heap */
- heap_unlink_page(objspace, heap, sweep_page);
- heap_add_page(objspace, heap_tomb, sweep_page);
- }
- else if (sweep_page->free_slots > 0) {
-#if GC_ENABLE_INCREMENTAL_MARK
- if (need_pool) {
- if (heap_add_poolpage(objspace, heap, sweep_page)) {
- need_pool = FALSE;
- }
- }
- else {
- heap_add_freepage(objspace, heap, sweep_page);
- break;
- }
-#else
- heap_add_freepage(objspace, heap, sweep_page);
- break;
-#endif
- }
- else {
- sweep_page->free_next = NULL;
- }
+ gc_page_sweep(objspace, heap, page);
- sweep_page = next;
- }
+ if (!next) gc_after_sweep(objspace);
+
+ if (heap->free_pages) {
+ result = TRUE;
+ break;
+ }
- if (heap->sweep_pages == NULL) {
- gc_sweep_finish(objspace);
+ page = next;
}
#if GC_ENABLE_LAZY_SWEEP
gc_prof_sweep_timer_stop(objspace);
#endif
- return heap->free_pages != NULL;
+ return result;
}
static void
-gc_sweep_rest(rb_objspace_t *objspace)
+gc_heap_rest_sweep(rb_objspace_t *objspace, rb_heap_t *heap)
{
- rb_heap_t *heap = heap_eden; /* lazy sweep only for eden */
-
- while (has_sweeping_pages(heap)) {
- gc_sweep_step(objspace, heap);
+ if (is_lazy_sweeping(heap)) {
+ during_gc++;
+ while (is_lazy_sweeping(heap)) {
+ gc_heap_lazy_sweep(objspace, heap);
+ }
+ during_gc = 0;
}
}
-#if GC_ENABLE_LAZY_SWEEP
static void
-gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap)
+gc_rest_sweep(rb_objspace_t *objspace)
{
- if (RGENGC_CHECK_MODE) assert(dont_gc == FALSE);
-
- gc_enter(objspace, "sweep_continue");
-#if USE_RGENGC
- if (objspace->rgengc.need_major_gc == GPR_FLAG_NONE && heap_increment(objspace, heap)) {
- gc_report(3, objspace, "gc_sweep_continue: success heap_increment().\n");
- }
-#endif
- gc_sweep_step(objspace, heap);
- gc_exit(objspace, "sweep_continue");
+ rb_heap_t *heap = heap_eden; /* lazy sweep only for eden */
+ gc_heap_rest_sweep(objspace, heap);
}
-#endif
static void
-gc_sweep(rb_objspace_t *objspace)
+gc_sweep(rb_objspace_t *objspace, int immediate_sweep)
{
- const unsigned int immediate_sweep = objspace->flags.immediate_sweep;
-
- gc_report(1, objspace, "gc_sweep: immediate: %d\n", immediate_sweep);
-
if (immediate_sweep) {
#if !GC_ENABLE_LAZY_SWEEP
gc_prof_sweep_timer_start(objspace);
#endif
- gc_sweep_start(objspace);
- gc_sweep_rest(objspace);
+ gc_before_sweep(objspace);
+ gc_heap_rest_sweep(objspace, heap_eden);
#if !GC_ENABLE_LAZY_SWEEP
gc_prof_sweep_timer_stop(objspace);
#endif
}
else {
struct heap_page *page;
- gc_sweep_start(objspace);
+ gc_before_sweep(objspace);
page = heap_eden->sweep_pages;
while (page) {
- page->flags.before_sweep = TRUE;
+ page->before_sweep = 1;
page = page->next;
}
- gc_sweep_step(objspace, heap_eden);
+ gc_heap_lazy_sweep(objspace, heap_eden);
}
gc_heap_prepare_minimum_pages(objspace, heap_eden);
@@ -3675,6 +3013,10 @@ gc_sweep(rb_objspace_t *objspace)
/* Marking - Marking stack */
+static void push_mark_stack(mark_stack_t *, VALUE);
+static int pop_mark_stack(mark_stack_t *, VALUE *);
+static void shrink_stack_chunk_cache(mark_stack_t *stack);
+
static stack_chunk_t *
stack_chunk_alloc(void)
{
@@ -3688,24 +3030,11 @@ stack_chunk_alloc(void)
}
static inline int
-is_mark_stack_empty(mark_stack_t *stack)
+is_mark_stask_empty(mark_stack_t *stack)
{
return stack->chunk == NULL;
}
-static size_t
-mark_stack_size(mark_stack_t *stack)
-{
- size_t size = stack->index;
- stack_chunk_t *chunk = stack->chunk ? stack->chunk->next : NULL;
-
- while (chunk) {
- size += stack->limit;
- chunk = chunk->next;
- }
- return size;
-}
-
static void
add_stack_chunk_cache(mark_stack_t *stack, stack_chunk_t *chunk)
{
@@ -3733,8 +3062,7 @@ push_mark_stack_chunk(mark_stack_t *stack)
{
stack_chunk_t *next;
- if (RGENGC_CHECK_MODE) assert(stack->index == stack->limit);
-
+ assert(stack->index == stack->limit);
if (stack->cache_size > 0) {
next = stack->cache;
stack->cache = stack->cache->next;
@@ -3756,12 +3084,13 @@ pop_mark_stack_chunk(mark_stack_t *stack)
stack_chunk_t *prev;
prev = stack->chunk->next;
- if (RGENGC_CHECK_MODE) assert(stack->index == 0);
+ assert(stack->index == 0);
add_stack_chunk_cache(stack, stack->chunk);
stack->chunk = prev;
stack->index = stack->limit;
}
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
static void
free_stack_chunks(mark_stack_t *stack)
{
@@ -3774,6 +3103,7 @@ free_stack_chunks(mark_stack_t *stack)
chunk = next;
}
}
+#endif
static void
push_mark_stack(mark_stack_t *stack, VALUE data)
@@ -3787,7 +3117,7 @@ push_mark_stack(mark_stack_t *stack, VALUE data)
static int
pop_mark_stack(mark_stack_t *stack, VALUE *data)
{
- if (is_mark_stack_empty(stack)) {
+ if (is_mark_stask_empty(stack)) {
return FALSE;
}
if (stack->index == 1) {
@@ -3800,43 +3130,13 @@ pop_mark_stack(mark_stack_t *stack, VALUE *data)
return TRUE;
}
-#if GC_ENABLE_INCREMENTAL_MARK
-static int
-invalidate_mark_stack_chunk(stack_chunk_t *chunk, int limit, VALUE obj)
-{
- int i;
- for (i=0; i<limit; i++) {
- if (chunk->data[i] == obj) {
- chunk->data[i] = Qundef;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static void
-invalidate_mark_stack(mark_stack_t *stack, VALUE obj)
-{
- stack_chunk_t *chunk = stack->chunk;
- int limit = stack->index;
-
- while (chunk) {
- if (invalidate_mark_stack_chunk(chunk, limit, obj)) return;
- chunk = chunk->next;
- limit = stack->limit;
- }
- rb_bug("invalid_mark_stack: unreachable");
-}
-#endif
-
static void
init_mark_stack(mark_stack_t *stack)
{
int i;
- MEMZERO(stack, mark_stack_t, 1);
+ if (0) push_mark_stack_chunk(stack);
stack->index = stack->limit = STACK_CHUNK_SIZE;
- stack->cache_size = 0;
for (i=0; i < 4; i++) {
add_stack_chunk_cache(stack, stack_chunk_alloc());
@@ -3847,14 +3147,14 @@ init_mark_stack(mark_stack_t *stack)
/* Marking */
#ifdef __ia64
-#define SET_STACK_END (SET_MACHINE_STACK_END(&th->machine.stack_end), th->machine.register_stack_end = rb_ia64_bsp())
+#define SET_STACK_END (SET_MACHINE_STACK_END(&th->machine_stack_end), th->machine_register_stack_end = rb_ia64_bsp())
#else
-#define SET_STACK_END SET_MACHINE_STACK_END(&th->machine.stack_end)
+#define SET_STACK_END SET_MACHINE_STACK_END(&th->machine_stack_end)
#endif
-#define STACK_START (th->machine.stack_start)
-#define STACK_END (th->machine.stack_end)
-#define STACK_LEVEL_MAX (th->machine.stack_maxsize/sizeof(VALUE))
+#define STACK_START (th->machine_stack_start)
+#define STACK_END (th->machine_stack_end)
+#define STACK_LEVEL_MAX (th->machine_stack_maxsize/sizeof(VALUE))
#if STACK_GROW_DIRECTION < 0
# define STACK_LENGTH (size_t)(STACK_START - STACK_END)
@@ -3896,8 +3196,8 @@ stack_check(int water_mark)
ret = STACK_LENGTH > STACK_LEVEL_MAX - water_mark;
#ifdef __ia64
if (!ret) {
- ret = (VALUE*)rb_ia64_bsp() - th->machine.register_stack_start >
- th->machine.register_stack_maxsize/sizeof(VALUE) - water_mark;
+ ret = (VALUE*)rb_ia64_bsp() - th->machine_register_stack_start >
+ th->machine_register_stack_maxsize/sizeof(VALUE) - water_mark;
}
#endif
return ret;
@@ -3918,7 +3218,7 @@ ruby_stack_check(void)
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
static void
-mark_locations_array(rb_objspace_t *objspace, register const VALUE *x, register long n)
+mark_locations_array(rb_objspace_t *objspace, register VALUE *x, register long n)
{
VALUE v;
while (n--) {
@@ -3929,7 +3229,7 @@ mark_locations_array(rb_objspace_t *objspace, register const VALUE *x, register
}
static void
-gc_mark_locations(rb_objspace_t *objspace, const VALUE *start, const VALUE *end)
+gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
{
long n;
@@ -3939,52 +3239,49 @@ gc_mark_locations(rb_objspace_t *objspace, const VALUE *start, const VALUE *end)
}
void
-rb_gc_mark_locations(const VALUE *start, const VALUE *end)
+rb_gc_mark_locations(VALUE *start, VALUE *end)
{
gc_mark_locations(&rb_objspace, start, end);
}
-void
-rb_gc_mark_values(long n, const VALUE *values)
-{
- rb_objspace_t *objspace = &rb_objspace;
- long i;
-
- for (i=0; i<n; i++) {
- gc_mark(objspace, values[i]);
- }
-}
-
#define rb_gc_mark_locations(start, end) gc_mark_locations(objspace, (start), (end))
+struct mark_tbl_arg {
+ rb_objspace_t *objspace;
+};
+
static int
mark_entry(st_data_t key, st_data_t value, st_data_t data)
{
- rb_objspace_t *objspace = (rb_objspace_t *)data;
- gc_mark(objspace, (VALUE)value);
+ struct mark_tbl_arg *arg = (void*)data;
+ gc_mark(arg->objspace, (VALUE)value);
return ST_CONTINUE;
}
static void
mark_tbl(rb_objspace_t *objspace, st_table *tbl)
{
+ struct mark_tbl_arg arg;
if (!tbl || tbl->num_entries == 0) return;
- st_foreach(tbl, mark_entry, (st_data_t)objspace);
+ arg.objspace = objspace;
+ st_foreach(tbl, mark_entry, (st_data_t)&arg);
}
static int
mark_key(st_data_t key, st_data_t value, st_data_t data)
{
- rb_objspace_t *objspace = (rb_objspace_t *)data;
- gc_mark(objspace, (VALUE)key);
+ struct mark_tbl_arg *arg = (void*)data;
+ gc_mark(arg->objspace, (VALUE)key);
return ST_CONTINUE;
}
static void
mark_set(rb_objspace_t *objspace, st_table *tbl)
{
+ struct mark_tbl_arg arg;
if (!tbl) return;
- st_foreach(tbl, mark_key, (st_data_t)objspace);
+ arg.objspace = objspace;
+ st_foreach(tbl, mark_key, (st_data_t)&arg);
}
void
@@ -3996,18 +3293,19 @@ rb_mark_set(st_table *tbl)
static int
mark_keyvalue(st_data_t key, st_data_t value, st_data_t data)
{
- rb_objspace_t *objspace = (rb_objspace_t *)data;
-
- gc_mark(objspace, (VALUE)key);
- gc_mark(objspace, (VALUE)value);
+ struct mark_tbl_arg *arg = (void*)data;
+ gc_mark(arg->objspace, (VALUE)key);
+ gc_mark(arg->objspace, (VALUE)value);
return ST_CONTINUE;
}
static void
mark_hash(rb_objspace_t *objspace, st_table *tbl)
{
+ struct mark_tbl_arg arg;
if (!tbl) return;
- st_foreach(tbl, mark_keyvalue, (st_data_t)objspace);
+ arg.objspace = objspace;
+ st_foreach(tbl, mark_keyvalue, (st_data_t)&arg);
}
void
@@ -4021,73 +3319,70 @@ mark_method_entry(rb_objspace_t *objspace, const rb_method_entry_t *me)
{
const rb_method_definition_t *def = me->def;
- gc_mark(objspace, me->owner);
- gc_mark(objspace, me->defined_class);
-
- if (def) {
- switch (def->type) {
- case VM_METHOD_TYPE_ISEQ:
- if (def->body.iseq.iseqptr) gc_mark(objspace, (VALUE)def->body.iseq.iseqptr);
- gc_mark(objspace, (VALUE)def->body.iseq.cref);
- break;
- case VM_METHOD_TYPE_ATTRSET:
- case VM_METHOD_TYPE_IVAR:
- gc_mark(objspace, def->body.attr.location);
- break;
- case VM_METHOD_TYPE_BMETHOD:
- gc_mark(objspace, def->body.proc);
- break;
- case VM_METHOD_TYPE_ALIAS:
- gc_mark(objspace, (VALUE)def->body.alias.original_me);
- return;
- case VM_METHOD_TYPE_REFINED:
- gc_mark(objspace, (VALUE)def->body.refined.orig_me);
- gc_mark(objspace, (VALUE)def->body.refined.owner);
- break;
- case VM_METHOD_TYPE_CFUNC:
- case VM_METHOD_TYPE_ZSUPER:
- case VM_METHOD_TYPE_MISSING:
- case VM_METHOD_TYPE_OPTIMIZED:
- case VM_METHOD_TYPE_UNDEF:
- case VM_METHOD_TYPE_NOTIMPLEMENTED:
- break;
+ gc_mark(objspace, me->klass);
+ again:
+ if (!def) return;
+ switch (def->type) {
+ case VM_METHOD_TYPE_ISEQ:
+ gc_mark(objspace, def->body.iseq->self);
+ break;
+ case VM_METHOD_TYPE_BMETHOD:
+ gc_mark(objspace, def->body.proc);
+ break;
+ case VM_METHOD_TYPE_ATTRSET:
+ case VM_METHOD_TYPE_IVAR:
+ gc_mark(objspace, def->body.attr.location);
+ break;
+ case VM_METHOD_TYPE_REFINED:
+ if (def->body.orig_me) {
+ def = def->body.orig_me->def;
+ goto again;
}
+ break;
+ default:
+ break; /* ignore */
}
}
-static enum rb_id_table_iterator_result
-mark_method_entry_i(VALUE me, void *data)
+void
+rb_mark_method_entry(const rb_method_entry_t *me)
{
- rb_objspace_t *objspace = (rb_objspace_t *)data;
+ mark_method_entry(&rb_objspace, me);
+}
- gc_mark(objspace, me);
- return ID_TABLE_CONTINUE;
+static int
+mark_method_entry_i(ID key, const rb_method_entry_t *me, st_data_t data)
+{
+ struct mark_tbl_arg *arg = (void*)data;
+ mark_method_entry(arg->objspace, me);
+ return ST_CONTINUE;
}
static void
-mark_m_tbl(rb_objspace_t *objspace, struct rb_id_table *tbl)
+mark_m_tbl(rb_objspace_t *objspace, st_table *tbl)
{
- if (tbl) {
- rb_id_table_foreach_values(tbl, mark_method_entry_i, objspace);
- }
+ struct mark_tbl_arg arg;
+ if (!tbl) return;
+ arg.objspace = objspace;
+ st_foreach(tbl, mark_method_entry_i, (st_data_t)&arg);
}
static int
-mark_const_entry_i(st_data_t key, st_data_t value, st_data_t data)
+mark_const_entry_i(ID key, const rb_const_entry_t *ce, st_data_t data)
{
- const rb_const_entry_t *ce = (const rb_const_entry_t *)value;
- rb_objspace_t *objspace = (rb_objspace_t *)data;
-
- gc_mark(objspace, ce->value);
- gc_mark(objspace, ce->file);
+ struct mark_tbl_arg *arg = (void*)data;
+ gc_mark(arg->objspace, ce->value);
+ gc_mark(arg->objspace, ce->file);
return ST_CONTINUE;
}
static void
mark_const_tbl(rb_objspace_t *objspace, st_table *tbl)
{
+ struct mark_tbl_arg arg;
if (!tbl) return;
- st_foreach(tbl, mark_const_entry_i, (st_data_t)objspace);
+ arg.objspace = objspace;
+ st_foreach(tbl, mark_const_entry_i, (st_data_t)&arg);
}
#if STACK_GROW_DIRECTION < 0
@@ -4113,21 +3408,17 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
/* This assumes that all registers are saved into the jmp_buf (and stack) */
rb_setjmp(save_regs_gc_mark.j);
- /* SET_STACK_END must be called in this function because
- * the stack frame of this function may contain
- * callee save registers and they should be marked. */
- SET_STACK_END;
GET_STACK_BOUNDS(stack_start, stack_end, 1);
mark_locations_array(objspace, save_regs_gc_mark.v, numberof(save_regs_gc_mark.v));
rb_gc_mark_locations(stack_start, stack_end);
#ifdef __ia64
- rb_gc_mark_locations(th->machine.register_stack_start, th->machine.register_stack_end);
+ rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
#endif
#if defined(__mc68000__)
- rb_gc_mark_locations((VALUE*)((char*)stack_start + 2),
- (VALUE*)((char*)stack_end - 2));
+ mark_locations_array(objspace, (VALUE*)((char*)STACK_END + 2),
+ (STACK_START - STACK_END));
#endif
}
@@ -4140,11 +3431,7 @@ rb_gc_mark_machine_stack(rb_thread_t *th)
GET_STACK_BOUNDS(stack_start, stack_end, 0);
rb_gc_mark_locations(stack_start, stack_end);
#ifdef __ia64
- rb_gc_mark_locations(th->machine.register_stack_start, th->machine.register_stack_end);
-#endif
-#if defined(__mc68000__)
- rb_gc_mark_locations((VALUE*)((char*)stack_start + 2),
- (VALUE*)((char*)stack_end - 2));
+ rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
#endif
}
@@ -4161,7 +3448,7 @@ gc_mark_maybe(rb_objspace_t *objspace, VALUE obj)
if (is_pointer_to_heap(objspace, (void *)obj)) {
int type = BUILTIN_TYPE(obj);
if (type != T_ZOMBIE && type != T_NONE) {
- gc_mark_ptr(objspace, obj);
+ gc_mark(objspace, obj);
}
}
}
@@ -4173,183 +3460,167 @@ rb_gc_mark_maybe(VALUE obj)
}
static inline int
-gc_mark_set(rb_objspace_t *objspace, VALUE obj)
+gc_marked(rb_objspace_t *objspace, VALUE ptr)
{
- if (RVALUE_MARKED(obj)) return 0;
- MARK_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj);
- return 1;
+ register bits_t *bits = GET_HEAP_MARK_BITS(ptr);
+ if (MARKED_IN_BITMAP(bits, ptr)) return 1;
+ return 0;
}
-#if USE_RGENGC
-static int
-gc_remember_unprotected(rb_objspace_t *objspace, VALUE obj)
+static inline int
+gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr)
{
- struct heap_page *page = GET_HEAP_PAGE(obj);
- bits_t *uncollectible_bits = &page->uncollectible_bits[0];
-
- if (!MARKED_IN_BITMAP(uncollectible_bits, obj)) {
- page->flags.has_uncollectible_shady_objects = TRUE;
- MARK_IN_BITMAP(uncollectible_bits, obj);
- objspace->rgengc.uncollectible_wb_unprotected_objects++;
-
-#if RGENGC_PROFILE > 0
- objspace->profile.total_remembered_shady_object_count++;
-#if RGENGC_PROFILE >= 2
- objspace->profile.remembered_shady_object_count_types[BUILTIN_TYPE(obj)]++;
-#endif
-#endif
- return TRUE;
- }
- else {
- return FALSE;
- }
+ register bits_t *bits = GET_HEAP_MARK_BITS(ptr);
+ if (gc_marked(objspace, ptr)) return 0;
+ MARK_IN_BITMAP(bits, ptr);
+ return 1;
}
-#endif
static void
-rgengc_check_relation(rb_objspace_t *objspace, VALUE obj)
+rgengc_check_shady(rb_objspace_t *objspace, VALUE obj)
{
#if USE_RGENGC
- const VALUE old_parent = objspace->rgengc.parent_object;
-
- if (old_parent) { /* parent object is old */
- if (RVALUE_WB_UNPROTECTED(obj)) {
- if (gc_remember_unprotected(objspace, obj)) {
- gc_report(2, objspace, "relation: (O->S) %s -> %s\n", obj_info(old_parent), obj_info(obj));
+ if (objspace->rgengc.parent_object_is_old) {
+ if (RVALUE_SHADY(obj)) {
+ if (rgengc_remember(objspace, obj)) {
+ objspace->rgengc.remembered_shady_object_count++;
}
}
+#if RGENGC_THREEGEN
else {
- if (!RVALUE_OLD_P(obj)) {
- if (RVALUE_MARKED(obj)) {
+ if (gc_marked(objspace, obj)) {
+ if (!RVALUE_OLD_P(obj)) {
/* An object pointed from an OLD object should be OLD. */
- gc_report(2, objspace, "relation: (O->unmarked Y) %s -> %s\n", obj_info(old_parent), obj_info(obj));
- RVALUE_AGE_SET_OLD(objspace, obj);
- if (is_incremental_marking(objspace)) {
- if (!RVALUE_MARKING(obj)) {
- gc_grey(objspace, obj);
- }
- }
- else {
- rgengc_remember(objspace, obj);
- }
+ rgengc_remember(objspace, obj);
}
- else {
- gc_report(2, objspace, "relation: (O->Y) %s -> %s\n", obj_info(old_parent), obj_info(obj));
- RVALUE_AGE_SET_CANDIDATE(objspace, obj);
+ }
+ else {
+ if (RVALUE_INFANT_P(obj)) {
+ RVALUE_PROMOTE_INFANT(obj);
}
}
}
- }
-
- if (RGENGC_CHECK_MODE) assert(old_parent == objspace->rgengc.parent_object);
#endif
-}
-
-static void
-gc_grey(rb_objspace_t *objspace, VALUE obj)
-{
-#if RGENGC_CHECK_MODE
- if (RVALUE_MARKED(obj) == FALSE) rb_bug("gc_grey: %s is not marked.", obj_info(obj));
- if (RVALUE_MARKING(obj) == TRUE) rb_bug("gc_grey: %s is marking/remembered.", obj_info(obj));
-#endif
-
-#if GC_ENABLE_INCREMENTAL_MARK
- if (is_incremental_marking(objspace)) {
- MARK_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj);
}
#endif
-
- push_mark_stack(&objspace->mark_stack, obj);
}
static void
-gc_aging(rb_objspace_t *objspace, VALUE obj)
+gc_mark(rb_objspace_t *objspace, VALUE ptr)
{
-#if USE_RGENGC
- struct heap_page *page = GET_HEAP_PAGE(obj);
-
-#if RGENGC_CHECK_MODE
- assert(RVALUE_MARKING(obj) == FALSE);
-#endif
-
- check_rvalue_consistency(obj);
+ if (!is_markable_object(objspace, ptr)) return;
- if (!RVALUE_PAGE_WB_UNPROTECTED(page, obj)) {
- if (!RVALUE_OLD_P(obj)) {
- gc_report(3, objspace, "gc_aging: YOUNG: %s\n", obj_info(obj));
- RVALUE_AGE_INC(objspace, obj);
- }
- else if (is_full_marking(objspace)) {
- if (RGENGC_CHECK_MODE) assert(RVALUE_PAGE_UNCOLLECTIBLE(page, obj) == FALSE);
- RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(objspace, page, obj);
- }
- }
- check_rvalue_consistency(obj);
-#endif /* USE_RGENGC */
-
- objspace->marked_slots++;
-}
-
-NOINLINE(static void gc_mark_ptr(rb_objspace_t *objspace, VALUE obj));
-
-static void
-gc_mark_ptr(rb_objspace_t *objspace, VALUE obj)
-{
- if (LIKELY(objspace->mark_func_data == NULL)) {
- rgengc_check_relation(objspace, obj);
- if (!gc_mark_set(objspace, obj)) return; /* already marked */
- gc_aging(objspace, obj);
- gc_grey(objspace, obj);
+ if (LIKELY(objspace->mark_func_data == 0)) {
+ rgengc_check_shady(objspace, ptr);
+ if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
+ push_mark_stack(&objspace->mark_stack, ptr);
}
else {
- objspace->mark_func_data->mark_func(obj, objspace->mark_func_data->data);
+ objspace->mark_func_data->mark_func(ptr, objspace->mark_func_data->data);
}
}
-static void
-gc_mark(rb_objspace_t *objspace, VALUE obj)
-{
- if (!is_markable_object(objspace, obj)) return;
- gc_mark_ptr(objspace, obj);
-}
-
void
rb_gc_mark(VALUE ptr)
{
gc_mark(&rb_objspace, ptr);
}
-/* CAUTION: THIS FUNCTION ENABLE *ONLY BEFORE* SWEEPING.
- * This function is only for GC_END_MARK timing.
- */
+/* resurrect non-marked `obj' if obj is before swept */
-int
-rb_objspace_marked_object_p(VALUE obj)
+void
+rb_gc_resurrect(VALUE obj)
{
- return RVALUE_MARKED(obj) ? TRUE : FALSE;
+ rb_objspace_t *objspace = &rb_objspace;
+
+ if (is_lazy_sweeping(heap_eden) &&
+ !gc_marked(objspace, obj) &&
+ !is_swept_object(objspace, obj)) {
+ gc_mark_ptr(objspace, obj);
+ }
}
-static inline void
-gc_mark_set_parent(rb_objspace_t *objspace, VALUE obj)
+static void
+gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
{
-#if USE_RGENGC
- if (RVALUE_OLD_P(obj)) {
- objspace->rgengc.parent_object = obj;
+ register RVALUE *obj = RANY(ptr);
+
+ goto marking; /* skip */
+
+ again:
+ if (LIKELY(objspace->mark_func_data == 0)) {
+ obj = RANY(ptr);
+ if (!is_markable_object(objspace, ptr)) return;
+ rgengc_check_shady(objspace, ptr);
+ if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
}
else {
- objspace->rgengc.parent_object = Qfalse;
+ gc_mark(objspace, ptr);
+ return;
}
+
+ marking:
+
+#if USE_RGENGC
+ check_gen_consistency((VALUE)obj);
+
+ if (LIKELY(objspace->mark_func_data == 0)) {
+ /* minor/major common */
+ if (!RVALUE_SHADY(obj)) {
+ if (RVALUE_INFANT_P((VALUE)obj)) {
+ /* infant -> young */
+ RVALUE_PROMOTE_INFANT((VALUE)obj);
+#if RGENGC_THREEGEN
+ /* infant -> young */
+ objspace->rgengc.young_object_count++;
+ objspace->rgengc.parent_object_is_old = FALSE;
+#else
+ /* infant -> old */
+ objspace->rgengc.old_object_count++;
+ objspace->rgengc.parent_object_is_old = TRUE;
+
+#if RGENGC_ESTIMATE_OLDSPACE
+ objspace->rgengc.oldspace_increase += obj_memsize_of((VALUE)obj, FALSE);
#endif
-}
-static void
-gc_mark_children(rb_objspace_t *objspace, VALUE obj)
-{
- register RVALUE *any = RANY(obj);
- gc_mark_set_parent(objspace, obj);
+#endif
+ rgengc_report(3, objspace, "gc_mark_children: promote infant -> young %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
+ }
+ else {
+ objspace->rgengc.parent_object_is_old = TRUE;
+
+#if RGENGC_THREEGEN
+ if (RVALUE_YOUNG_P((VALUE)obj)) {
+ /* young -> old */
+ RVALUE_PROMOTE_YOUNG((VALUE)obj);
+ objspace->rgengc.old_object_count++;
+#if RGENGC_ESTIMATE_OLDSPACE
+ objspace->rgengc.oldspace_increase += obj_memsize_of((VALUE)obj, FALSE);
+#endif
+ rgengc_report(3, objspace, "gc_mark_children: promote young -> old %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
+ }
+ else {
+#endif
+ if (!objspace->rgengc.during_minor_gc) {
+ /* major/full GC */
+ objspace->rgengc.old_object_count++;
+ }
+#if RGENGC_THREEGEN
+ }
+#endif
+ }
+ }
+ else {
+ rgengc_report(3, objspace, "gc_mark_children: do not promote shady %p (%s).\n", (void *)obj, obj_type_name((VALUE)obj));
+ objspace->rgengc.parent_object_is_old = FALSE;
+ }
+ }
+
+ check_gen_consistency((VALUE)obj);
+#endif /* USE_RGENGC */
if (FL_TEST(obj, FL_EXIVAR)) {
- rb_mark_generic_ivar(obj);
+ rb_mark_generic_ivar(ptr);
}
switch (BUILTIN_TYPE(obj)) {
@@ -4359,71 +3630,165 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
break;
case T_NODE:
- obj = rb_gc_mark_node(&any->as.node);
- if (obj) gc_mark(objspace, obj);
- return; /* no need to mark class. */
+ switch (nd_type(obj)) {
+ case NODE_IF: /* 1,2,3 */
+ case NODE_FOR:
+ case NODE_ITER:
+ case NODE_WHEN:
+ case NODE_MASGN:
+ case NODE_RESCUE:
+ case NODE_RESBODY:
+ case NODE_CLASS:
+ case NODE_BLOCK_PASS:
+ gc_mark(objspace, (VALUE)obj->as.node.u2.node);
+ /* fall through */
+ case NODE_BLOCK: /* 1,3 */
+ case NODE_ARRAY:
+ case NODE_DSTR:
+ case NODE_DXSTR:
+ case NODE_DREGX:
+ case NODE_DREGX_ONCE:
+ case NODE_ENSURE:
+ case NODE_CALL:
+ case NODE_DEFS:
+ case NODE_OP_ASGN1:
+ gc_mark(objspace, (VALUE)obj->as.node.u1.node);
+ /* fall through */
+ case NODE_SUPER: /* 3 */
+ case NODE_FCALL:
+ case NODE_DEFN:
+ case NODE_ARGS_AUX:
+ ptr = (VALUE)obj->as.node.u3.node;
+ goto again;
+
+ case NODE_WHILE: /* 1,2 */
+ case NODE_UNTIL:
+ case NODE_AND:
+ case NODE_OR:
+ case NODE_CASE:
+ case NODE_SCLASS:
+ case NODE_DOT2:
+ case NODE_DOT3:
+ case NODE_FLIP2:
+ case NODE_FLIP3:
+ case NODE_MATCH2:
+ case NODE_MATCH3:
+ case NODE_OP_ASGN_OR:
+ case NODE_OP_ASGN_AND:
+ case NODE_MODULE:
+ case NODE_ALIAS:
+ case NODE_VALIAS:
+ case NODE_ARGSCAT:
+ gc_mark(objspace, (VALUE)obj->as.node.u1.node);
+ /* fall through */
+ case NODE_GASGN: /* 2 */
+ case NODE_LASGN:
+ case NODE_DASGN:
+ case NODE_DASGN_CURR:
+ case NODE_IASGN:
+ case NODE_IASGN2:
+ case NODE_CVASGN:
+ case NODE_COLON3:
+ case NODE_OPT_N:
+ case NODE_EVSTR:
+ case NODE_UNDEF:
+ case NODE_POSTEXE:
+ ptr = (VALUE)obj->as.node.u2.node;
+ goto again;
- case T_IMEMO:
- switch (imemo_type(obj)) {
- case imemo_none:
- rb_bug("unreachable");
- return;
- case imemo_cref:
- gc_mark(objspace, RANY(obj)->as.imemo.cref.klass);
- gc_mark(objspace, (VALUE)RANY(obj)->as.imemo.cref.next);
- gc_mark(objspace, RANY(obj)->as.imemo.cref.refinements);
- return;
- case imemo_svar:
- gc_mark(objspace, RANY(obj)->as.imemo.svar.cref_or_me);
- gc_mark(objspace, RANY(obj)->as.imemo.svar.lastline);
- gc_mark(objspace, RANY(obj)->as.imemo.svar.backref);
- gc_mark(objspace, RANY(obj)->as.imemo.svar.others);
- return;
- case imemo_throw_data:
- gc_mark(objspace, RANY(obj)->as.imemo.throw_data.throw_obj);
- return;
- case imemo_ifunc:
- gc_mark_maybe(objspace, (VALUE)RANY(obj)->as.imemo.ifunc.data);
- return;
- case imemo_memo:
- gc_mark(objspace, RANY(obj)->as.imemo.memo.v1);
- gc_mark(objspace, RANY(obj)->as.imemo.memo.v2);
- gc_mark_maybe(objspace, RANY(obj)->as.imemo.memo.u3.value);
- return;
- case imemo_ment:
- mark_method_entry(objspace, &RANY(obj)->as.imemo.ment);
- return;
- case imemo_iseq:
- rb_iseq_mark((rb_iseq_t *)obj);
- return;
+ case NODE_HASH: /* 1 */
+ case NODE_LIT:
+ case NODE_STR:
+ case NODE_XSTR:
+ case NODE_DEFINED:
+ case NODE_MATCH:
+ case NODE_RETURN:
+ case NODE_BREAK:
+ case NODE_NEXT:
+ case NODE_YIELD:
+ case NODE_COLON2:
+ case NODE_SPLAT:
+ case NODE_TO_ARY:
+ ptr = (VALUE)obj->as.node.u1.node;
+ goto again;
+
+ case NODE_SCOPE: /* 2,3 */
+ case NODE_CDECL:
+ case NODE_OPT_ARG:
+ gc_mark(objspace, (VALUE)obj->as.node.u3.node);
+ ptr = (VALUE)obj->as.node.u2.node;
+ goto again;
+
+ case NODE_ARGS: /* custom */
+ {
+ struct rb_args_info *args = obj->as.node.u3.args;
+ if (args) {
+ if (args->pre_init) gc_mark(objspace, (VALUE)args->pre_init);
+ if (args->post_init) gc_mark(objspace, (VALUE)args->post_init);
+ if (args->opt_args) gc_mark(objspace, (VALUE)args->opt_args);
+ if (args->kw_args) gc_mark(objspace, (VALUE)args->kw_args);
+ if (args->kw_rest_arg) gc_mark(objspace, (VALUE)args->kw_rest_arg);
+ }
+ }
+ ptr = (VALUE)obj->as.node.u2.node;
+ goto again;
+
+ case NODE_ZARRAY: /* - */
+ case NODE_ZSUPER:
+ case NODE_VCALL:
+ case NODE_GVAR:
+ case NODE_LVAR:
+ case NODE_DVAR:
+ case NODE_IVAR:
+ case NODE_CVAR:
+ case NODE_NTH_REF:
+ case NODE_BACK_REF:
+ case NODE_REDO:
+ case NODE_RETRY:
+ case NODE_SELF:
+ case NODE_NIL:
+ case NODE_TRUE:
+ case NODE_FALSE:
+ case NODE_ERRINFO:
+ case NODE_BLOCK_ARG:
+ break;
+ case NODE_ALLOCA:
+ mark_locations_array(objspace,
+ (VALUE*)obj->as.node.u1.value,
+ obj->as.node.u3.cnt);
+ gc_mark(objspace, (VALUE)obj->as.node.u2.node);
+ break;
+
+ case NODE_CREF:
+ gc_mark(objspace, obj->as.node.nd_refinements);
+ gc_mark(objspace, (VALUE)obj->as.node.u1.node);
+ ptr = (VALUE)obj->as.node.u3.node;
+ goto again;
+
+ default: /* unlisted NODE */
+ gc_mark_maybe(objspace, (VALUE)obj->as.node.u1.node);
+ gc_mark_maybe(objspace, (VALUE)obj->as.node.u2.node);
+ gc_mark_maybe(objspace, (VALUE)obj->as.node.u3.node);
}
- rb_bug("T_IMEMO: unreachable");
+ return; /* no need to mark class. */
}
- gc_mark(objspace, any->as.basic.klass);
-
+ gc_mark(objspace, obj->as.basic.klass);
switch (BUILTIN_TYPE(obj)) {
+ case T_ICLASS:
case T_CLASS:
case T_MODULE:
mark_m_tbl(objspace, RCLASS_M_TBL(obj));
if (!RCLASS_EXT(obj)) break;
mark_tbl(objspace, RCLASS_IV_TBL(obj));
mark_const_tbl(objspace, RCLASS_CONST_TBL(obj));
- gc_mark(objspace, RCLASS_SUPER((VALUE)obj));
- break;
-
- case T_ICLASS:
- if (FL_TEST(obj, RICLASS_IS_ORIGIN)) {
- mark_m_tbl(objspace, RCLASS_M_TBL(obj));
- }
- if (!RCLASS_EXT(obj)) break;
- mark_m_tbl(objspace, RCLASS_CALLABLE_M_TBL(obj));
- gc_mark(objspace, RCLASS_SUPER((VALUE)obj));
- break;
+ ptr = RCLASS_SUPER((VALUE)obj);
+ goto again;
case T_ARRAY:
if (FL_TEST(obj, ELTS_SHARED)) {
- gc_mark(objspace, any->as.array.as.heap.aux.shared);
+ ptr = obj->as.array.as.heap.aux.shared;
+ goto again;
}
else {
long i, len = RARRAY_LEN(obj);
@@ -4435,25 +3800,25 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
break;
case T_HASH:
- mark_hash(objspace, any->as.hash.ntbl);
- gc_mark(objspace, any->as.hash.ifnone);
- break;
+ mark_hash(objspace, obj->as.hash.ntbl);
+ ptr = obj->as.hash.ifnone;
+ goto again;
case T_STRING:
- if (STR_SHARED_P(obj)) {
- gc_mark(objspace, any->as.string.as.heap.aux.shared);
+#define STR_ASSOC FL_USER3 /* copied from string.c */
+ if (FL_TEST(obj, RSTRING_NOEMBED) && FL_ANY(obj, ELTS_SHARED|STR_ASSOC)) {
+ ptr = obj->as.string.as.heap.aux.shared;
+ goto again;
}
break;
case T_DATA:
- {
- void *const ptr = DATA_PTR(obj);
- if (ptr) {
- RUBY_DATA_FUNC mark_func = RTYPEDDATA_P(obj) ?
- any->as.typeddata.type->function.dmark :
- any->as.data.dmark;
- if (mark_func) (*mark_func)(ptr);
- }
+ if (RTYPEDDATA_P(obj)) {
+ RUBY_DATA_FUNC mark_func = obj->as.typeddata.type->function.dmark;
+ if (mark_func) (*mark_func)(DATA_PTR(obj));
+ }
+ else {
+ if (obj->as.data.dmark) (*obj->as.data.dmark)(DATA_PTR(obj));
}
break;
@@ -4468,41 +3833,41 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
break;
case T_FILE:
- if (any->as.file.fptr) {
- gc_mark(objspace, any->as.file.fptr->pathv);
- gc_mark(objspace, any->as.file.fptr->tied_io_for_writing);
- gc_mark(objspace, any->as.file.fptr->writeconv_asciicompat);
- gc_mark(objspace, any->as.file.fptr->writeconv_pre_ecopts);
- gc_mark(objspace, any->as.file.fptr->encs.ecopts);
- gc_mark(objspace, any->as.file.fptr->write_lock);
+ if (obj->as.file.fptr) {
+ gc_mark(objspace, obj->as.file.fptr->pathv);
+ gc_mark(objspace, obj->as.file.fptr->tied_io_for_writing);
+ gc_mark(objspace, obj->as.file.fptr->writeconv_asciicompat);
+ gc_mark(objspace, obj->as.file.fptr->writeconv_pre_ecopts);
+ gc_mark(objspace, obj->as.file.fptr->encs.ecopts);
+ gc_mark(objspace, obj->as.file.fptr->write_lock);
}
break;
case T_REGEXP:
- gc_mark(objspace, any->as.regexp.src);
- break;
+ ptr = obj->as.regexp.src;
+ goto again;
case T_FLOAT:
case T_BIGNUM:
- case T_SYMBOL:
break;
case T_MATCH:
- gc_mark(objspace, any->as.match.regexp);
- if (any->as.match.str) {
- gc_mark(objspace, any->as.match.str);
+ gc_mark(objspace, obj->as.match.regexp);
+ if (obj->as.match.str) {
+ ptr = obj->as.match.str;
+ goto again;
}
break;
case T_RATIONAL:
- gc_mark(objspace, any->as.rational.num);
- gc_mark(objspace, any->as.rational.den);
- break;
+ gc_mark(objspace, obj->as.rational.num);
+ ptr = obj->as.rational.den;
+ goto again;
case T_COMPLEX:
- gc_mark(objspace, any->as.complex.real);
- gc_mark(objspace, any->as.complex.imag);
- break;
+ gc_mark(objspace, obj->as.complex.real);
+ ptr = obj->as.complex.imag;
+ goto again;
case T_STRUCT:
{
@@ -4522,75 +3887,79 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("rb_gc_mark(): %p is T_NONE", (void *)obj);
if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("rb_gc_mark(): %p is T_ZOMBIE", (void *)obj);
rb_bug("rb_gc_mark(): unknown data type 0x%x(%p) %s",
- BUILTIN_TYPE(obj), any,
- is_pointer_to_heap(objspace, any) ? "corrupted object" : "non object");
+ BUILTIN_TYPE(obj), (void *)obj,
+ is_pointer_to_heap(objspace, obj) ? "corrupted object" : "non object");
}
}
-/**
- * incremental: 0 -> not incremental (do all)
- * incremental: n -> mark at most `n' objects
- */
-static inline int
-gc_mark_stacked_objects(rb_objspace_t *objspace, int incremental, size_t count)
+static void
+gc_mark_stacked_objects(rb_objspace_t *objspace)
{
mark_stack_t *mstack = &objspace->mark_stack;
- VALUE obj;
-#if GC_ENABLE_INCREMENTAL_MARK
- size_t marked_slots_at_the_beginning = objspace->marked_slots;
- size_t popped_count = 0;
-#endif
+ VALUE obj = 0;
+ if (!mstack->index) return;
while (pop_mark_stack(mstack, &obj)) {
- if (obj == Qundef) continue; /* skip */
-
- if (RGENGC_CHECK_MODE && !RVALUE_MARKED(obj)) {
- rb_bug("gc_mark_stacked_objects: %s is not marked.", obj_info(obj));
+ if (!gc_marked(objspace, obj)) {
+ rb_bug("gc_mark_stacked_objects: %p (%s) is infant, but not marked.", (void *)obj, obj_type_name(obj));
}
gc_mark_children(objspace, obj);
+ }
+ shrink_stack_chunk_cache(mstack);
+}
-#if GC_ENABLE_INCREMENTAL_MARK
- if (incremental) {
- if (RGENGC_CHECK_MODE && !RVALUE_MARKING(obj)) {
- rb_bug("gc_mark_stacked_objects: incremental, but marking bit is 0");
- }
- CLEAR_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj);
- popped_count++;
-
- if (popped_count + (objspace->marked_slots - marked_slots_at_the_beginning) > count) {
- break;
- }
- }
- else {
- /* just ignore marking bits */
- }
+#ifndef RGENGC_PRINT_TICK
+#define RGENGC_PRINT_TICK 0
#endif
- }
+/* the following code is only for internal tuning. */
- if (RGENGC_CHECK_MODE >= 3) gc_verify_internal_consistency(Qnil);
+/* Source code to use RDTSC is quoted and modified from
+ * http://www.mcs.anl.gov/~kazutomo/rdtsc.html
+ * written by Kazutomo Yoshii <kazutomo@mcs.anl.gov>
+ */
- if (is_mark_stack_empty(mstack)) {
- shrink_stack_chunk_cache(mstack);
- return TRUE;
- }
- else {
- return FALSE;
- }
+#if RGENGC_PRINT_TICK
+#if defined(__GNUC__) && defined(__i386__)
+typedef unsigned long long tick_t;
+
+static inline tick_t
+tick(void)
+{
+ unsigned long long int x;
+ __asm__ __volatile__ ("rdtsc" : "=A" (x));
+ return x;
}
-static int
-gc_mark_stacked_objects_incremental(rb_objspace_t *objspace, size_t count)
+#elif defined(__GNUC__) && defined(__x86_64__)
+typedef unsigned long long tick_t;
+
+static __inline__ tick_t
+tick(void)
{
- return gc_mark_stacked_objects(objspace, TRUE, count);
+ unsigned long hi, lo;
+ __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+ return ((unsigned long long)lo)|( ((unsigned long long)hi)<<32);
}
-static int
-gc_mark_stacked_objects_all(rb_objspace_t *objspace)
+#elif defined(_WIN32) && defined(_MSC_VER)
+#include <intrin.h>
+typedef unsigned __int64 tick_t;
+
+static inline tick_t
+tick(void)
+{
+ return __rdtsc();
+}
+
+#else /* use clock */
+typedef clock_t tick_t;
+static inline tick_t
+tick(void)
{
- return gc_mark_stacked_objects(objspace, FALSE, 0);
+ return clock();
}
+#endif
-#if PRINT_ROOT_TICKS
#define MAX_TICKS 0x100
static tick_t mark_ticks[MAX_TICKS];
static const char *mark_ticks_categories[MAX_TICKS];
@@ -4611,15 +3980,16 @@ show_mark_ticks(void)
}
}
-#endif /* PRITNT_ROOT_TICKS */
+#endif /* RGENGC_PRINT_TICK */
static void
-gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
+gc_mark_roots(rb_objspace_t *objspace, int full_mark, const char **categoryp)
{
struct gc_list *list;
rb_thread_t *th = GET_THREAD();
+ if (categoryp) *categoryp = "xxx";
-#if PRINT_ROOT_TICKS
+#if RGENGC_PRINT_TICK
tick_t start_tick = tick();
int tick_count = 0;
const char *prev_category = 0;
@@ -4629,13 +3999,7 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
}
#endif
- if (categoryp) *categoryp = "xxx";
-
-#if USE_RGENGC
- objspace->rgengc.parent_object = Qfalse;
-#endif
-
-#if PRINT_ROOT_TICKS
+#if RGENGC_PRINT_TICK
#define MARK_CHECKPOINT_PRINT_TICK(category) do { \
if (prev_category) { \
tick_t t = tick(); \
@@ -4646,7 +4010,7 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
prev_category = category; \
start_tick = tick(); \
} while (0)
-#else /* PRITNT_ROOT_TICKS */
+#else /* RGENGC_PRINT_TICK */
#define MARK_CHECKPOINT_PRINT_TICK(category)
#endif
@@ -4657,8 +4021,7 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
MARK_CHECKPOINT("vm");
SET_STACK_END;
- rb_vm_mark(th->vm);
- if (th->vm->self) gc_mark(objspace, th->vm->self);
+ th->vm->self ? rb_gc_mark(th->vm->self) : rb_vm_mark(th->vm);
MARK_CHECKPOINT("finalizers");
mark_tbl(objspace, finalizer_table);
@@ -4666,12 +4029,21 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
MARK_CHECKPOINT("machine_context");
mark_current_machine_context(objspace, th);
+ MARK_CHECKPOINT("symbols");
+#if USE_RGENGC
+ objspace->rgengc.parent_object_is_old = TRUE;
+ rb_gc_mark_symbols(full_mark);
+ objspace->rgengc.parent_object_is_old = FALSE;
+#else
+ rb_gc_mark_symbols(full_mark);
+#endif
+
MARK_CHECKPOINT("encodings");
rb_gc_mark_encodings();
/* mark protected global variables */
MARK_CHECKPOINT("global_list");
- for (list = global_list; list; list = list->next) {
+ for (list = global_List; list; list = list->next) {
rb_gc_mark_maybe(*list->varptr);
}
@@ -4681,13 +4053,47 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
MARK_CHECKPOINT("global_tbl");
rb_gc_mark_global_tbl();
- if (stress_to_class) rb_gc_mark(stress_to_class);
+ /* mark generic instance variables for special constants */
+ MARK_CHECKPOINT("generic_ivars");
+ rb_mark_generic_ivar_tbl();
+
+ MARK_CHECKPOINT("parser");
+ rb_gc_mark_parser();
+
+ MARK_CHECKPOINT("live_method_entries");
+ rb_gc_mark_unlinked_live_method_entries(th->vm);
MARK_CHECKPOINT("finish");
#undef MARK_CHECKPOINT
}
-#if RGENGC_CHECK_MODE >= 4
+static void
+gc_marks_body(rb_objspace_t *objspace, int full_mark)
+{
+ /* start marking */
+ rgengc_report(1, objspace, "gc_marks_body: start (%s)\n", full_mark ? "full" : "minor");
+
+#if USE_RGENGC
+ objspace->rgengc.parent_object_is_old = FALSE;
+ objspace->rgengc.during_minor_gc = full_mark ? FALSE : TRUE;
+
+ if (objspace->rgengc.during_minor_gc) {
+ objspace->profile.minor_gc_count++;
+ rgengc_rememberset_mark(objspace, heap_eden);
+ }
+ else {
+ objspace->profile.major_gc_count++;
+ rgengc_mark_and_rememberset_clear(objspace, heap_eden);
+ }
+#endif
+ gc_mark_roots(objspace, full_mark, 0);
+ gc_mark_stacked_objects(objspace);
+
+ /* cleanup */
+ rgengc_report(1, objspace, "gc_marks_body: end (%s)\n", full_mark ? "full" : "minor");
+}
+
+#if RGENGC_CHECK_MODE >= 2
#define MAKE_ROOTSIG(obj) (((VALUE)(obj) << 1) | 0x01)
#define IS_ROOTSIG(obj) ((VALUE)(obj) & 0x01)
@@ -4724,7 +4130,6 @@ reflist_add(struct reflist *refs, VALUE obj)
refs->size *= 2;
SIZED_REALLOC_N(refs->list, VALUE, refs->size, refs->size/2);
}
-
refs->list[refs->pos++] = obj;
}
@@ -4738,7 +4143,7 @@ reflist_dump(struct reflist *refs)
fprintf(stderr, "<root@%s>", GET_ROOTSIG(obj));
}
else {
- fprintf(stderr, "<%s>", obj_info(obj));
+ fprintf(stderr, "<%p@%s>", (void *)obj, obj_type_name(obj));
}
if (i+1 < refs->pos) fprintf(stderr, ", ");
}
@@ -4767,22 +4172,19 @@ struct allrefs {
struct st_table *references;
const char *category;
VALUE root_obj;
- mark_stack_t mark_stack;
};
-static int
+static void
allrefs_add(struct allrefs *data, VALUE obj)
{
struct reflist *refs;
if (st_lookup(data->references, obj, (st_data_t *)&refs)) {
reflist_add(refs, data->root_obj);
- return 0;
}
else {
refs = reflist_create(data->root_obj);
st_insert(data->references, obj, (st_data_t)refs);
- return 1;
}
}
@@ -4790,10 +4192,7 @@ static void
allrefs_i(VALUE obj, void *ptr)
{
struct allrefs *data = (struct allrefs *)ptr;
-
- if (allrefs_add(data, obj)) {
- push_mark_stack(&data->mark_stack, obj);
- }
+ allrefs_add(data, obj);
}
static void
@@ -4802,10 +4201,8 @@ allrefs_roots_i(VALUE obj, void *ptr)
struct allrefs *data = (struct allrefs *)ptr;
if (strlen(data->category) == 0) rb_bug("!!!");
data->root_obj = MAKE_ROOTSIG(data->category);
-
- if (allrefs_add(data, obj)) {
- push_mark_stack(&data->mark_stack, obj);
- }
+ allrefs_add(data, obj);
+ push_mark_stack(&data->objspace->mark_stack, obj);
}
static st_table *
@@ -4814,34 +4211,32 @@ objspace_allrefs(rb_objspace_t *objspace)
struct allrefs data;
struct mark_func_data_struct mfd;
VALUE obj;
- int prev_dont_gc = dont_gc;
- dont_gc = TRUE;
+
+ rb_gc_disable();
data.objspace = objspace;
data.references = st_init_numtable();
- init_mark_stack(&data.mark_stack);
mfd.mark_func = allrefs_roots_i;
mfd.data = &data;
/* traverse root objects */
- PUSH_MARK_FUNC_DATA(&mfd);
objspace->mark_func_data = &mfd;
- gc_mark_roots(objspace, &data.category);
- POP_MARK_FUNC_DATA();
+ gc_mark_roots(objspace, TRUE, &data.category);
+ objspace->mark_func_data = 0;
/* traverse rest objects reachable from root objects */
- while (pop_mark_stack(&data.mark_stack, &obj)) {
+ while (pop_mark_stack(&objspace->mark_stack, &obj)) {
rb_objspace_reachable_objects_from(data.root_obj = obj, allrefs_i, &data);
}
- free_stack_chunks(&data.mark_stack);
+ shrink_stack_chunk_cache(&objspace->mark_stack);
- dont_gc = prev_dont_gc;
+ rb_gc_enable();
return data.references;
}
static int
-objspace_allrefs_destruct_i(st_data_t key, st_data_t value, void *ptr)
+objspaec_allrefs_destruct_i(st_data_t key, st_data_t value, void *ptr)
{
struct reflist *refs = (struct reflist *)value;
reflist_destruct(refs);
@@ -4849,19 +4244,23 @@ objspace_allrefs_destruct_i(st_data_t key, st_data_t value, void *ptr)
}
static void
-objspace_allrefs_destruct(struct st_table *refs)
+objspaec_allrefs_destruct(struct st_table *refs)
{
- st_foreach(refs, objspace_allrefs_destruct_i, 0);
+ st_foreach(refs, objspaec_allrefs_destruct_i, 0);
st_free_table(refs);
}
-#if RGENGC_CHECK_MODE >= 5
+#if RGENGC_CHECK_MODE >= 3
static int
allrefs_dump_i(st_data_t k, st_data_t v, st_data_t ptr)
{
VALUE obj = (VALUE)k;
struct reflist *refs = (struct reflist *)v;
- fprintf(stderr, "[allrefs_dump_i] %s <- ", obj_info(obj));
+ fprintf(stderr, "[allrefs_dump_i] %p (%s%s%s%s) <- ",
+ (void *)obj, obj_type_name(obj),
+ RVALUE_OLD_P(obj) ? "[O]" : "[Y]",
+ RVALUE_SHADY(obj) ? "[S]" : "",
+ MARKED_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(obj), obj) ? "[R]" : "");
reflist_dump(refs);
fprintf(stderr, "\n");
return ST_CONTINUE;
@@ -4876,6 +4275,33 @@ allrefs_dump(rb_objspace_t *objspace)
#endif
static int
+gc_check_before_marks_i(st_data_t k, st_data_t v, void *ptr)
+{
+ VALUE obj = k;
+ struct reflist *refs = (struct reflist *)v;
+ rb_objspace_t *objspace = (rb_objspace_t *)ptr;
+
+ /* check WB sanity */
+ if (!RVALUE_OLD_P(obj)) {
+ int i;
+ for (i=0; i<refs->pos; i++) {
+ VALUE parent = refs->list[i];
+ if (!IS_ROOTSIG(parent) && RVALUE_OLD_P(parent)) {
+ /* parent is old */
+ if (!MARKED_IN_BITMAP(GET_HEAP_PAGE(parent)->rememberset_bits, parent) &&
+ !MARKED_IN_BITMAP(GET_HEAP_PAGE(obj)->rememberset_bits, obj)) {
+ fprintf(stderr, "gc_marks_check_i: WB miss %p (%s) -> %p (%s)\n",
+ (void *)parent, obj_type_name(parent),
+ (void *)obj, obj_type_name(obj));
+ objspace->rgengc.error_count++;
+ }
+ }
+ }
+ }
+ return ST_CONTINUE;
+}
+
+static int
gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr)
{
VALUE obj = k;
@@ -4884,7 +4310,7 @@ gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr)
/* object should be marked or oldgen */
if (!MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj)) {
- fprintf(stderr, "gc_check_after_marks_i: %s is not marked and not oldgen.\n", obj_info(obj));
+ fprintf(stderr, "gc_check_after_marks_i: %p (%s) is not marked and not oldgen.\n", (void *)obj, obj_type_name(obj));
fprintf(stderr, "gc_check_after_marks_i: %p is referred from ", (void *)obj);
reflist_dump(refs);
@@ -4903,596 +4329,80 @@ gc_check_after_marks_i(st_data_t k, st_data_t v, void *ptr)
static void
gc_marks_check(rb_objspace_t *objspace, int (*checker_func)(ANYARGS), const char *checker_name)
{
- size_t saved_malloc_increase = objspace->malloc_params.increase;
-#if RGENGC_ESTIMATE_OLDMALLOC
- size_t saved_oldmalloc_increase = objspace->rgengc.oldmalloc_increase;
-#endif
- VALUE already_disabled = rb_gc_disable();
-
objspace->rgengc.allrefs_table = objspace_allrefs(objspace);
- if (checker_func) {
- st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace);
- }
+ st_foreach(objspace->rgengc.allrefs_table, checker_func, (st_data_t)objspace);
if (objspace->rgengc.error_count > 0) {
-#if RGENGC_CHECK_MODE >= 5
+#if RGENGC_CHECK_MODE >= 3
allrefs_dump(objspace);
#endif
- if (checker_name) rb_bug("%s: GC has problem.", checker_name);
+ rb_bug("%s: GC has problem.", checker_name);
}
- objspace_allrefs_destruct(objspace->rgengc.allrefs_table);
+ objspaec_allrefs_destruct(objspace->rgengc.allrefs_table);
objspace->rgengc.allrefs_table = 0;
-
- if (already_disabled == Qfalse) rb_gc_enable();
- objspace->malloc_params.increase = saved_malloc_increase;
-#if RGENGC_ESTIMATE_OLDMALLOC
- objspace->rgengc.oldmalloc_increase = saved_oldmalloc_increase;
-#endif
}
-#endif /* RGENGC_CHECK_MODE >= 4 */
-struct verify_internal_consistency_struct {
- rb_objspace_t *objspace;
- int err_count;
- size_t live_object_count;
- size_t zombie_object_count;
-
-#if USE_RGENGC
- VALUE parent;
- size_t old_object_count;
- size_t remembered_shady_count;
-#endif
-};
-
-#if USE_RGENGC
-static void
-check_generation_i(const VALUE child, void *ptr)
-{
- struct verify_internal_consistency_struct *data = (struct verify_internal_consistency_struct *)ptr;
- const VALUE parent = data->parent;
-
- if (RGENGC_CHECK_MODE) assert(RVALUE_OLD_P(parent));
-
- if (!RVALUE_OLD_P(child)) {
- if (!RVALUE_REMEMBERED(parent) &&
- !RVALUE_REMEMBERED(child) &&
- !RVALUE_UNCOLLECTIBLE(child)) {
- fprintf(stderr, "verify_internal_consistency_reachable_i: WB miss (O->Y) %s -> %s\n", obj_info(parent), obj_info(child));
- data->err_count++;
- }
- }
-}
-
-static void
-check_color_i(const VALUE child, void *ptr)
-{
- struct verify_internal_consistency_struct *data = (struct verify_internal_consistency_struct *)ptr;
- const VALUE parent = data->parent;
-
- if (!RVALUE_WB_UNPROTECTED(parent) && RVALUE_WHITE_P(child)) {
- fprintf(stderr, "verify_internal_consistency_reachable_i: WB miss (B->W) - %s -> %s\n",
- obj_info(parent), obj_info(child));
- data->err_count++;
- }
-}
-#endif
+#endif /* RGENGC_CHECK_MODE >= 2 */
static void
-check_children_i(const VALUE child, void *ptr)
-{
- check_rvalue_consistency(child);
-}
-
-static int
-verify_internal_consistency_i(void *page_start, void *page_end, size_t stride, void *ptr)
-{
- struct verify_internal_consistency_struct *data = (struct verify_internal_consistency_struct *)ptr;
- VALUE obj;
- rb_objspace_t *objspace = data->objspace;
-
- for (obj = (VALUE)page_start; obj != (VALUE)page_end; obj += stride) {
- if (is_live_object(objspace, obj)) {
- /* count objects */
- data->live_object_count++;
-
- rb_objspace_reachable_objects_from(obj, check_children_i, (void *)data);
-
-#if USE_RGENGC
- /* check health of children */
- data->parent = obj;
-
- if (RVALUE_OLD_P(obj)) data->old_object_count++;
- if (RVALUE_WB_UNPROTECTED(obj) && RVALUE_UNCOLLECTIBLE(obj)) data->remembered_shady_count++;
-
- if (!is_marking(objspace) && RVALUE_OLD_P(obj)) {
- /* reachable objects from an oldgen object should be old or (young with remember) */
- data->parent = obj;
- rb_objspace_reachable_objects_from(obj, check_generation_i, (void *)data);
- }
-
- if (is_incremental_marking(objspace)) {
- if (RVALUE_BLACK_P(obj)) {
- /* reachable objects from black objects should be black or grey objects */
- data->parent = obj;
- rb_objspace_reachable_objects_from(obj, check_color_i, (void *)data);
- }
- }
-#endif
- }
- else {
- if (BUILTIN_TYPE(obj) == T_ZOMBIE) {
- if (RGENGC_CHECK_MODE) assert(RBASIC(obj)->flags == T_ZOMBIE);
- data->zombie_object_count++;
- }
- }
- }
-
- return 0;
-}
-
-static int
-gc_verify_heap_page(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
-{
-#if USE_RGENGC
- int i;
- unsigned int has_remembered_shady = FALSE;
- unsigned int has_remembered_old = FALSE;
- int rememberd_old_objects = 0;
-
- for (i=0; i<page->total_slots; i++) {
- VALUE obj = (VALUE)&page->start[i];
- if (RVALUE_PAGE_UNCOLLECTIBLE(page, obj) && RVALUE_PAGE_WB_UNPROTECTED(page, obj)) has_remembered_shady = TRUE;
- if (RVALUE_PAGE_MARKING(page, obj)) {
- has_remembered_old = TRUE;
- rememberd_old_objects++;
- }
- }
-
- if (!is_incremental_marking(objspace) &&
- page->flags.has_remembered_objects == FALSE && has_remembered_old == TRUE) {
-
- for (i=0; i<page->total_slots; i++) {
- VALUE obj = (VALUE)&page->start[i];
- if (RVALUE_PAGE_MARKING(page, obj)) {
- fprintf(stderr, "marking -> %s\n", obj_info(obj));
- }
- }
- rb_bug("page %p's has_remembered_objects should be false, but there are remembered old objects (%d). %s",
- page, rememberd_old_objects, obj ? obj_info(obj) : "");
- }
-
- if (page->flags.has_uncollectible_shady_objects == FALSE && has_remembered_shady == TRUE) {
- rb_bug("page %p's has_remembered_shady should be false, but there are remembered shady objects. %s",
- page, obj ? obj_info(obj) : "");
- }
-
- return rememberd_old_objects;
-#else
- return 0;
-#endif
-}
-
-static int
-gc_verify_heap_pages(rb_objspace_t *objspace)
-{
- int rememberd_old_objects = 0;
- struct heap_page *page = heap_eden->pages;
-
- while (page) {
- if (page->flags.has_remembered_objects == FALSE)
- rememberd_old_objects += gc_verify_heap_page(objspace, page, Qfalse);
- page = page->next;
- }
-
- return rememberd_old_objects;
-}
-
-/*
- * call-seq:
- * GC.verify_internal_consistency -> nil
- *
- * Verify internal consistency.
- *
- * This method is implementation specific.
- * Now this method checks generational consistency
- * if RGenGC is supported.
- */
-static VALUE
-gc_verify_internal_consistency(VALUE dummy)
-{
- rb_objspace_t *objspace = &rb_objspace;
- struct verify_internal_consistency_struct data = {0};
- struct each_obj_args eo_args;
-
- data.objspace = objspace;
- gc_report(5, objspace, "gc_verify_internal_consistency: start\n");
-
- /* check relations */
-
- eo_args.callback = verify_internal_consistency_i;
- eo_args.data = (void *)&data;
- objspace_each_objects((VALUE)&eo_args);
-
- if (data.err_count != 0) {
-#if RGENGC_CHECK_MODE >= 5
- objspace->rgengc.error_count = data.err_count;
- gc_marks_check(objspace, NULL, NULL);
- allrefs_dump(objspace);
-#endif
- rb_bug("gc_verify_internal_consistency: found internal inconsistency.");
- }
-
- /* check heap_page status */
- gc_verify_heap_pages(objspace);
-
- /* check counters */
-
- if (!is_lazy_sweeping(heap_eden) && !finalizing) {
- if (objspace_live_slots(objspace) != data.live_object_count) {
- fprintf(stderr, "heap_pages_final_slots: %d, objspace->profile.total_freed_objects: %d\n",
- (int)heap_pages_final_slots, (int)objspace->profile.total_freed_objects);
- rb_bug("inconsistent live slot nubmer: expect %"PRIuSIZE", but %"PRIuSIZE".", objspace_live_slots(objspace), data.live_object_count);
- }
- }
-
-#if USE_RGENGC
- if (!is_marking(objspace)) {
- if (objspace->rgengc.old_objects != data.old_object_count) {
- rb_bug("inconsistent old slot nubmer: expect %"PRIuSIZE", but %"PRIuSIZE".", objspace->rgengc.old_objects, data.old_object_count);
- }
- if (objspace->rgengc.uncollectible_wb_unprotected_objects != data.remembered_shady_count) {
- rb_bug("inconsistent old slot nubmer: expect %"PRIuSIZE", but %"PRIuSIZE".", objspace->rgengc.uncollectible_wb_unprotected_objects, data.remembered_shady_count);
- }
- }
-#endif
-
- if (!finalizing) {
- size_t list_count = 0;
-
- {
- VALUE z = heap_pages_deferred_final;
- while (z) {
- list_count++;
- z = RZOMBIE(z)->next;
- }
- }
-
- if (heap_pages_final_slots != data.zombie_object_count ||
- heap_pages_final_slots != list_count) {
-
- rb_bug("inconsistent finalizing object count:\n"
- " expect %"PRIuSIZE"\n"
- " but %"PRIuSIZE" zombies\n"
- " heap_pages_deferred_final list has %"PRIuSIZE" items.",
- heap_pages_final_slots,
- data.zombie_object_count,
- list_count);
- }
- }
-
- gc_report(5, objspace, "gc_verify_internal_consistency: OK\n");
-
- return Qnil;
-}
-
-void
-rb_gc_verify_internal_consistency(void)
+gc_marks(rb_objspace_t *objspace, int full_mark)
{
- gc_verify_internal_consistency(Qnil);
-}
+ struct mark_func_data_struct *prev_mark_func_data;
-/* marks */
-
-static void
-gc_marks_start(rb_objspace_t *objspace, int full_mark)
-{
- /* start marking */
- gc_report(1, objspace, "gc_marks_start: (%s)\n", full_mark ? "full" : "minor");
- gc_stat_transition(objspace, gc_stat_marking);
+ gc_prof_mark_timer_start(objspace);
+ {
+ /* setup marking */
+ prev_mark_func_data = objspace->mark_func_data;
+ objspace->mark_func_data = 0;
#if USE_RGENGC
- if (full_mark) {
-#if GC_ENABLE_INCREMENTAL_MARK
- objspace->rincgc.step_slots = (objspace->marked_slots * 2) / ((objspace->rincgc.pooled_slots / HEAP_OBJ_LIMIT) + 1);
-
- if (0) fprintf(stderr, "objspace->marked_slots: %d, objspace->rincgc.pooled_page_num: %d, objspace->rincgc.step_slots: %d, \n",
- (int)objspace->marked_slots, (int)objspace->rincgc.pooled_slots, (int)objspace->rincgc.step_slots);
-#endif
- objspace->flags.during_minor_gc = FALSE;
- objspace->profile.major_gc_count++;
- objspace->rgengc.uncollectible_wb_unprotected_objects = 0;
- objspace->rgengc.old_objects = 0;
- objspace->rgengc.last_major_gc = objspace->profile.count;
- objspace->marked_slots = 0;
- rgengc_mark_and_rememberset_clear(objspace, heap_eden);
- }
- else {
- objspace->flags.during_minor_gc = TRUE;
- objspace->marked_slots =
- objspace->rgengc.old_objects + objspace->rgengc.uncollectible_wb_unprotected_objects; /* uncollectible objects are marked already */
- objspace->profile.minor_gc_count++;
- rgengc_rememberset_mark(objspace, heap_eden);
- }
-#endif
-
- gc_mark_roots(objspace, NULL);
-
- gc_report(1, objspace, "gc_marks_start: (%s) end, stack in %d\n", full_mark ? "full" : "minor", (int)mark_stack_size(&objspace->mark_stack));
-}
-
-#if GC_ENABLE_INCREMENTAL_MARK
-static void
-gc_marks_wb_unprotected_objects(rb_objspace_t *objspace)
-{
- struct heap_page *page = heap_eden->pages;
-
- while (page) {
- bits_t *mark_bits = page->mark_bits;
- bits_t *wbun_bits = page->wb_unprotected_bits;
- RVALUE *p = page->start;
- RVALUE *offset = p - NUM_IN_PAGE(p);
- size_t j;
-
- for (j=0; j<HEAP_BITMAP_LIMIT; j++) {
- bits_t bits = mark_bits[j] & wbun_bits[j];
-
- if (bits) {
- p = offset + j * BITS_BITLENGTH;
-
- do {
- if (bits & 1) {
- gc_report(2, objspace, "gc_marks_wb_unprotected_objects: marked shady: %s\n", obj_info((VALUE)p));
- if (RGENGC_CHECK_MODE > 0) {
- assert(RVALUE_WB_UNPROTECTED((VALUE)p));
- assert(RVALUE_MARKED((VALUE)p));
- }
- gc_mark_children(objspace, (VALUE)p);
- }
- p++;
- bits >>= 1;
- } while (bits);
- }
- }
-
- page = page->next;
- }
-
- gc_mark_stacked_objects_all(objspace);
-}
-
-static struct heap_page *
-heap_move_pooled_pages_to_free_pages(rb_heap_t *heap)
-{
- struct heap_page *page = heap->pooled_pages;
-
- if (page) {
- heap->pooled_pages = page->free_next;
- page->free_next = heap->free_pages;
- heap->free_pages = page;
- }
-
- return page;
-}
-#endif
-
-static int
-gc_marks_finish(rb_objspace_t *objspace)
-{
-#if GC_ENABLE_INCREMENTAL_MARK
- /* finish incremental GC */
- if (is_incremental_marking(objspace)) {
- if (heap_eden->pooled_pages) {
- heap_move_pooled_pages_to_free_pages(heap_eden);
- gc_report(1, objspace, "gc_marks_finish: pooled pages are exists. retry.\n");
- return FALSE; /* continue marking phase */
- }
-
- if (RGENGC_CHECK_MODE && is_mark_stack_empty(&objspace->mark_stack) == 0) {
- rb_bug("gc_marks_finish: mark stack is not empty (%d).", (int)mark_stack_size(&objspace->mark_stack));
- }
-
- gc_mark_roots(objspace, 0);
-
- if (is_mark_stack_empty(&objspace->mark_stack) == FALSE) {
- gc_report(1, objspace, "gc_marks_finish: not empty (%d). retry.\n", (int)mark_stack_size(&objspace->mark_stack));
- return FALSE;
- }
-
-#if RGENGC_CHECK_MODE >= 2
- if (gc_verify_heap_pages(objspace) != 0) {
- rb_bug("gc_marks_finish (incremental): there are remembered old objects.");
- }
-#endif
-
- objspace->flags.during_incremental_marking = FALSE;
- /* check children of all marked wb-unprotected objects */
- gc_marks_wb_unprotected_objects(objspace);
- }
-#endif /* GC_ENABLE_INCREMENTAL_MARK */
#if RGENGC_CHECK_MODE >= 2
- gc_verify_internal_consistency(Qnil);
+ gc_marks_check(objspace, gc_check_before_marks_i, "before_marks");
#endif
-
-#if USE_RGENGC
- if (is_full_marking(objspace)) {
- /* See the comment about RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR */
- const double r = gc_params.oldobject_limit_factor;
- objspace->rgengc.uncollectible_wb_unprotected_objects_limit = (size_t)(objspace->rgengc.uncollectible_wb_unprotected_objects * r);
- objspace->rgengc.old_objects_limit = (size_t)(objspace->rgengc.old_objects * r);
- }
+ if (full_mark == TRUE) { /* major/full GC */
+ objspace->rgengc.remembered_shady_object_count = 0;
+ objspace->rgengc.old_object_count = 0;
+#if RGENGC_THREEGEN
+ objspace->rgengc.young_object_count = 0;
#endif
-#if RGENGC_CHECK_MODE >= 4
- gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
-#endif
+ gc_marks_body(objspace, TRUE);
- { /* decide full GC is needed or not */
- rb_heap_t *heap = heap_eden;
- size_t sweep_slots =
- (heap_allocatable_pages * HEAP_OBJ_LIMIT) + /* allocatable slots in empty pages */
- (heap->total_slots - objspace->marked_slots); /* will be sweep slots */
-
-#if RGENGC_CHECK_MODE
- assert(heap->total_slots >= objspace->marked_slots);
-#endif
-
- if (sweep_slots < heap_pages_min_free_slots) {
-#if USE_RGENGC
- if (!is_full_marking(objspace) && objspace->profile.count - objspace->rgengc.last_major_gc > 3 /* magic number */) {
- gc_report(1, objspace, "gc_marks_finish: next is full GC!!)\n");
- objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_NOFREE;
- }
- else {
- gc_report(1, objspace, "gc_marks_finish: heap_set_increment!!\n");
- heap_set_increment(objspace, heap_extend_pages(objspace));
- heap_increment(objspace, heap);
- }
-#else
- gc_report(1, objspace, "gc_marks_finish: heap_set_increment!!\n");
- heap_set_increment(objspace, heap_extend_pages(objspace));
- heap_increment(objspace, heap);
-#endif
- }
-
-#if USE_RGENGC
- if (objspace->rgengc.uncollectible_wb_unprotected_objects > objspace->rgengc.uncollectible_wb_unprotected_objects_limit) {
- objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_SHADY;
- }
- if (objspace->rgengc.old_objects > objspace->rgengc.old_objects_limit) {
- objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_OLDGEN;
+ /* Do full GC if old/remembered_shady object counts is greater than counts two times at last full GC counts */
+ objspace->rgengc.remembered_shady_object_limit = objspace->rgengc.remembered_shady_object_count * 2;
+ objspace->rgengc.old_object_limit = objspace->rgengc.old_object_count * 2;
}
- if (RGENGC_FORCE_MAJOR_GC) {
- objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_FORCE;
- }
-
- gc_report(1, objspace, "gc_marks_finish (marks %d objects, old %d objects, total %d slots, sweep %d slots, increment: %d, next GC: %s)\n",
- (int)objspace->marked_slots, (int)objspace->rgengc.old_objects, (int)heap->total_slots, (int)sweep_slots, (int)heap_allocatable_pages,
- objspace->rgengc.need_major_gc ? "major" : "minor");
-#endif
- }
-
- gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END_MARK, 0);
-
- return TRUE;
-}
-
-#if GC_ENABLE_INCREMENTAL_MARK
-static void
-gc_marks_step(rb_objspace_t *objspace, int slots)
-{
- if (RGENGC_CHECK_MODE) assert(is_marking(objspace));
-
- if (gc_mark_stacked_objects_incremental(objspace, slots)) {
- if (gc_marks_finish(objspace)) {
- /* finish */
- gc_sweep(objspace);
- }
- }
- if (0) fprintf(stderr, "objspace->marked_slots: %d\n", (int)objspace->marked_slots);
-}
-#endif
-
-static void
-gc_marks_rest(rb_objspace_t *objspace)
-{
- gc_report(1, objspace, "gc_marks_rest\n");
-
-#if GC_ENABLE_INCREMENTAL_MARK
- heap_eden->pooled_pages = NULL;
-#endif
-
- if (is_incremental_marking(objspace)) {
- do {
- while (gc_mark_stacked_objects_incremental(objspace, INT_MAX) == FALSE);
- } while (gc_marks_finish(objspace) == FALSE);
- }
- else {
- gc_mark_stacked_objects_all(objspace);
- gc_marks_finish(objspace);
- }
-
- /* move to sweep */
- gc_sweep(objspace);
-}
-
-#if GC_ENABLE_INCREMENTAL_MARK
-static void
-gc_marks_continue(rb_objspace_t *objspace, rb_heap_t *heap)
-{
- int slots = 0;
- const char *from;
-
- if (RGENGC_CHECK_MODE) assert(dont_gc == FALSE);
-
- gc_enter(objspace, "marks_continue");
-
- PUSH_MARK_FUNC_DATA(NULL);
- {
- if (heap->pooled_pages) {
- while (heap->pooled_pages && slots < HEAP_OBJ_LIMIT) {
- struct heap_page *page = heap_move_pooled_pages_to_free_pages(heap);
- slots += page->free_slots;
- }
- from = "pooled-pages";
- }
- else if (heap_increment(objspace, heap)) {
- slots = heap->free_pages->free_slots;
- from = "incremented-pages";
- }
-
- if (slots > 0) {
- gc_report(2, objspace, "gc_marks_continue: provide %d slots from %s.\n", slots, from);
- gc_marks_step(objspace, (int)objspace->rincgc.step_slots);
- }
- else {
- gc_report(2, objspace, "gc_marks_continue: no more pooled pages (stack depth: %d).\n", (int)mark_stack_size(&objspace->mark_stack));
- gc_marks_rest(objspace);
- }
- }
- POP_MARK_FUNC_DATA();
-
- gc_exit(objspace, "marks_continue");
-}
-#endif
-
-static void
-gc_marks(rb_objspace_t *objspace, int full_mark)
-{
- gc_prof_mark_timer_start(objspace);
-
- PUSH_MARK_FUNC_DATA(NULL);
- {
- /* setup marking */
-
-#if USE_RGENGC
- gc_marks_start(objspace, full_mark);
- if (!is_incremental_marking(objspace)) {
- gc_marks_rest(objspace);
+ else { /* minor GC */
+ gc_marks_body(objspace, FALSE);
}
#if RGENGC_PROFILE > 0
if (gc_prof_record(objspace)) {
gc_profile_record *record = gc_prof_record(objspace);
- record->old_objects = objspace->rgengc.old_objects;
+ record->old_objects = objspace->rgengc.old_object_count;
}
#endif
+#if RGENGC_CHECK_MODE >= 2
+ gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
+#endif
+
#else /* USE_RGENGC */
- gc_marks_start(objspace, TRUE);
- gc_marks_rest(objspace);
+ gc_marks_body(objspace, TRUE);
#endif
+
+ objspace->mark_func_data = prev_mark_func_data;
}
- POP_MARK_FUNC_DATA();
gc_prof_mark_timer_stop(objspace);
}
/* RGENGC */
static void
-gc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...)
+rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...)
{
if (level <= RGENGC_DEBUG) {
char buf[1024];
@@ -5502,15 +4412,7 @@ gc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...)
#if USE_RGENGC
if (during_gc) {
- status = is_full_marking(objspace) ? "+" : "-";
- }
- else {
- if (is_lazy_sweeping(heap_eden)) {
- status = "S";
- }
- if (is_incremental_marking(objspace)) {
- status = "M";
- }
+ status = objspace->rgengc.during_minor_gc ? "-" : "+";
}
#endif
@@ -5530,22 +4432,18 @@ gc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...)
static int
rgengc_remembersetbits_get(rb_objspace_t *objspace, VALUE obj)
{
- return RVALUE_REMEMBERED(obj);
+ bits_t *bits = GET_HEAP_REMEMBERSET_BITS(obj);
+ return MARKED_IN_BITMAP(bits, obj) ? 1 : 0;
}
static int
rgengc_remembersetbits_set(rb_objspace_t *objspace, VALUE obj)
{
- struct heap_page *page = GET_HEAP_PAGE(obj);
- bits_t *bits = &page->marking_bits[0];
-
- if (RGENGC_CHECK_MODE) assert(!is_incremental_marking(objspace));
-
+ bits_t *bits = GET_HEAP_REMEMBERSET_BITS(obj);
if (MARKED_IN_BITMAP(bits, obj)) {
return FALSE;
}
else {
- page->flags.has_remembered_objects = TRUE;
MARK_IN_BITMAP(bits, obj);
return TRUE;
}
@@ -5557,25 +4455,43 @@ rgengc_remembersetbits_set(rb_objspace_t *objspace, VALUE obj)
static int
rgengc_remember(rb_objspace_t *objspace, VALUE obj)
{
- gc_report(6, objspace, "rgengc_remember: %s %s\n", obj_info(obj),
- rgengc_remembersetbits_get(objspace, obj) ? "was already remembered" : "is remembered now");
+ rgengc_report(2, objspace, "rgengc_remember: %p (%s, %s) %s\n", (void *)obj, obj_type_name(obj),
+ RVALUE_SHADY(obj) ? "shady" : "non-shady",
+ rgengc_remembersetbits_get(objspace, obj) ? "was already remembered" : "is remembered now");
- check_rvalue_consistency(obj);
-
- if (RGENGC_CHECK_MODE) {
- if (RVALUE_WB_UNPROTECTED(obj)) rb_bug("rgengc_remember: %s is not wb protected.", obj_info(obj));
+#if RGENGC_CHECK_MODE > 0
+ {
+ switch (BUILTIN_TYPE(obj)) {
+ case T_NONE:
+ case T_ZOMBIE:
+ rb_bug("rgengc_remember: should not remember %p (%s)\n",
+ (void *)obj, obj_type_name(obj));
+ default:
+ ;
+ }
}
+#endif
+ if (RGENGC_PROFILE) {
+ if (!rgengc_remembered(objspace, obj)) {
+ if (!RVALUE_SHADY(obj)) {
#if RGENGC_PROFILE > 0
- if (!rgengc_remembered(objspace, obj)) {
- if (RVALUE_WB_UNPROTECTED(obj) == 0) {
- objspace->profile.total_remembered_normal_object_count++;
+ objspace->profile.remembered_normal_object_count++;
#if RGENGC_PROFILE >= 2
- objspace->profile.remembered_normal_object_count_types[BUILTIN_TYPE(obj)]++;
+ objspace->profile.remembered_normal_object_count_types[BUILTIN_TYPE(obj)]++;
#endif
+#endif
+ }
+ else {
+#if RGENGC_PROFILE > 0
+ objspace->profile.remembered_shady_object_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.remembered_shady_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+#endif
+ }
}
}
-#endif /* RGENGC_PROFILE > 0 */
return rgengc_remembersetbits_set(objspace, obj);
}
@@ -5584,81 +4500,75 @@ static int
rgengc_remembered(rb_objspace_t *objspace, VALUE obj)
{
int result = rgengc_remembersetbits_get(objspace, obj);
- check_rvalue_consistency(obj);
- gc_report(6, objspace, "rgengc_remembered: %s\n", obj_info(obj));
+ check_gen_consistency(obj);
+ rgengc_report(6, objspace, "gc_remembered: %p (%s) => %d\n", (void *)obj, obj_type_name(obj), result);
return result;
}
-#ifndef PROFILE_REMEMBERSET_MARK
-#define PROFILE_REMEMBERSET_MARK 0
-#endif
-
static void
rgengc_rememberset_mark(rb_objspace_t *objspace, rb_heap_t *heap)
{
size_t j;
+ RVALUE *p, *offset;
+ bits_t *bits, bitset;
struct heap_page *page = heap->pages;
-#if PROFILE_REMEMBERSET_MARK
- int has_old = 0, has_shady = 0, has_both = 0, skip = 0;
+
+#if RGENGC_PROFILE > 0
+ size_t shady_object_count = 0, clear_count = 0;
#endif
- gc_report(1, objspace, "rgengc_rememberset_mark: start\n");
while (page) {
- if (page->flags.has_remembered_objects | page->flags.has_uncollectible_shady_objects) {
- RVALUE *p = page->start;
- RVALUE *offset = p - NUM_IN_PAGE(p);
- bits_t bitset, bits[HEAP_BITMAP_LIMIT];
- bits_t *marking_bits = page->marking_bits;
- bits_t *uncollectible_bits = page->uncollectible_bits;
- bits_t *wb_unprotected_bits = page->wb_unprotected_bits;
-#if PROFILE_REMEMBERSET_MARK
- if (page->flags.has_remembered_objects && page->flags.has_uncollectible_shady_objects) has_both++;
- else if (page->flags.has_remembered_objects) has_old++;
- else if (page->flags.has_uncollectible_shady_objects) has_shady++;
-#endif
- for (j=0; j<HEAP_BITMAP_LIMIT; j++) {
- bits[j] = marking_bits[j] | (uncollectible_bits[j] & wb_unprotected_bits[j]);
- marking_bits[j] = 0;
- }
- page->flags.has_remembered_objects = FALSE;
+ p = page->start;
+ bits = page->rememberset_bits;
+ offset = p - NUM_IN_PAGE(p);
- for (j=0; j < HEAP_BITMAP_LIMIT; j++) {
+ for (j=0; j < HEAP_BITMAP_LIMIT; j++) {
+ if (bits[j]) {
+ p = offset + j * BITS_BITLENGTH;
bitset = bits[j];
+ do {
+ if (bitset & 1) {
+ /* mark before RVALUE_PROMOTE_... */
+ gc_mark_ptr(objspace, (VALUE)p);
- if (bitset) {
- p = offset + j * BITS_BITLENGTH;
-
- do {
- if (bitset & 1) {
- VALUE obj = (VALUE)p;
- gc_report(2, objspace, "rgengc_rememberset_mark: mark %s\n", obj_info(obj));
-
- if (RGENGC_CHECK_MODE) {
- assert(RVALUE_UNCOLLECTIBLE(obj));
- assert(RVALUE_OLD_P(obj) || RVALUE_WB_UNPROTECTED(obj));
- }
-
- gc_mark_children(objspace, obj);
+ if (!RVALUE_SHADY(p)) {
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: clear %p (%s)\n", p, obj_type_name((VALUE)p));
+#if RGENGC_THREEGEN
+ if (RVALUE_INFANT_P((VALUE)p)) RVALUE_PROMOTE_INFANT((VALUE)p);
+ if (RVALUE_YOUNG_P((VALUE)p)) RVALUE_PROMOTE_YOUNG((VALUE)p);
+#endif
+ CLEAR_IN_BITMAP(bits, p);
+#if RGENGC_PROFILE > 0
+ clear_count++;
+#endif
}
- p++;
- bitset >>= 1;
- } while (bitset);
- }
- }
- }
-#if PROFILE_REMEMBERSET_MARK
- else {
- skip++;
- }
+ else {
+#if RGENGC_PROFILE > 0
+ shady_object_count++;
#endif
+ }
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: mark %p (%s)\n", p, obj_type_name((VALUE)p));
+ gc_mark_children(objspace, (VALUE) p);
+ }
+ p++;
+ bitset >>= 1;
+ } while (bitset);
+ }
+ }
page = page->next;
}
-#if PROFILE_REMEMBERSET_MARK
- fprintf(stderr, "%d\t%d\t%d\t%d\n", has_both, has_old, has_shady, skip);
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: finished\n");
+
+#if RGENGC_PROFILE > 0
+ rgengc_report(2, objspace, "rgengc_rememberset_mark: clear_count: %"PRIdSIZE", shady_object_count: %"PRIdSIZE"\n", clear_count, shady_object_count);
+ if (gc_prof_record(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->remembered_normal_objects = clear_count;
+ record->remembered_shady_objects = shady_object_count;
+ }
#endif
- gc_report(1, objspace, "rgengc_rememberset_mark: finished\n");
}
static void
@@ -5667,177 +4577,87 @@ rgengc_mark_and_rememberset_clear(rb_objspace_t *objspace, rb_heap_t *heap)
struct heap_page *page = heap->pages;
while (page) {
- memset(&page->mark_bits[0], 0, HEAP_BITMAP_SIZE);
- memset(&page->marking_bits[0], 0, HEAP_BITMAP_SIZE);
- memset(&page->uncollectible_bits[0], 0, HEAP_BITMAP_SIZE);
- page->flags.has_uncollectible_shady_objects = FALSE;
- page->flags.has_remembered_objects = FALSE;
+ memset(&page->mark_bits[0], 0, HEAP_BITMAP_SIZE);
+ memset(&page->rememberset_bits[0], 0, HEAP_BITMAP_SIZE);
page = page->next;
}
}
/* RGENGC: APIs */
-NOINLINE(static void gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace));
-
-static void
-gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace)
+void
+rb_gc_writebarrier(VALUE a, VALUE b)
{
if (RGENGC_CHECK_MODE) {
- if (!RVALUE_OLD_P(a)) rb_bug("gc_writebarrier_generational: %s is not an old object.", obj_info(a));
- if ( RVALUE_OLD_P(b)) rb_bug("gc_writebarrier_generational: %s is an old object.", obj_info(b));
- if (is_incremental_marking(objspace)) rb_bug("gc_writebarrier_generational: called while incremental marking: %s -> %s", obj_info(a), obj_info(b));
- }
-
-#if 1
- /* mark `a' and remember (default behavior) */
- if (!rgengc_remembered(objspace, a)) {
- rgengc_remember(objspace, a);
- gc_report(1, objspace, "gc_writebarrier_generational: %s (remembered) -> %s\n", obj_info(a), obj_info(b));
- }
-#else
- /* mark `b' and remember */
- MARK_IN_BITMAP(GET_HEAP_MARK_BITS(b), b);
- if (RVALUE_WB_UNPROTECTED(b)) {
- gc_remember_unprotected(objspace, b);
- }
- else {
- RVALUE_AGE_SET_OLD(objspace, b);
- rgengc_remember(objspace, b);
+ if (!RVALUE_PROMOTED_P(a)) rb_bug("rb_gc_writebarrier: referer object %p (%s) is not promoted.\n", (void *)a, obj_type_name(a));
}
- gc_report(1, objspace, "gc_writebarrier_generational: %s -> %s (remembered)\n", obj_info(a), obj_info(b));
-#endif
-
- check_rvalue_consistency(a);
- check_rvalue_consistency(b);
-}
-
-#if GC_ENABLE_INCREMENTAL_MARK
-static void
-gc_mark_from(rb_objspace_t *objspace, VALUE obj, VALUE parent)
-{
- gc_mark_set_parent(objspace, parent);
- rgengc_check_relation(objspace, obj);
- if (gc_mark_set(objspace, obj) == FALSE) return;
- gc_aging(objspace, obj);
- gc_grey(objspace, obj);
-}
-
-NOINLINE(static void gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace));
-
-static void
-gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace)
-{
- gc_report(2, objspace, "gc_writebarrier_incremental: [LG] %s -> %s\n", obj_info(a), obj_info(b));
-
- if (RVALUE_BLACK_P(a)) {
- if (RVALUE_WHITE_P(b)) {
- if (!RVALUE_WB_UNPROTECTED(a)) {
- gc_report(2, objspace, "gc_writebarrier_incremental: [IN] %s -> %s\n", obj_info(a), obj_info(b));
- gc_mark_from(objspace, b, a);
- }
- }
- else if (RVALUE_OLD_P(a) && !RVALUE_OLD_P(b)) {
- if (!RVALUE_WB_UNPROTECTED(b)) {
- gc_report(1, objspace, "gc_writebarrier_incremental: [GN] %s -> %s\n", obj_info(a), obj_info(b));
- RVALUE_AGE_SET_OLD(objspace, b);
+ if (!RVALUE_OLD_P(b) && RVALUE_OLD_BITMAP_P(a)) {
+ rb_objspace_t *objspace = &rb_objspace;
- if (RVALUE_BLACK_P(b)) {
- gc_grey(objspace, b);
+ if (!rgengc_remembered(objspace, a)) {
+ int type = BUILTIN_TYPE(a);
+ /* TODO: 2 << 16 is just a magic number. */
+ if ((type == T_ARRAY && RARRAY_LEN(a) >= 2 << 16) ||
+ (type == T_HASH && RHASH_SIZE(a) >= 2 << 16)) {
+ if (!rgengc_remembered(objspace, b)) {
+ rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n", (void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
+ rgengc_remember(objspace, b);
}
}
else {
- gc_report(1, objspace, "gc_writebarrier_incremental: [LL] %s -> %s\n", obj_info(a), obj_info(b));
- gc_remember_unprotected(objspace, b);
+ rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n",
+ (void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
+ rgengc_remember(objspace, a);
}
}
}
}
-#else
-#define gc_writebarrier_incremental(a, b, objspace)
-#endif
void
-rb_gc_writebarrier(VALUE a, VALUE b)
+rb_gc_writebarrier_unprotect_promoted(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
- if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(a)) rb_bug("rb_gc_writebarrier: a is special const");
- if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(b)) rb_bug("rb_gc_writebarrier: b is special const");
-
- if (!is_incremental_marking(objspace)) {
- if (!RVALUE_OLD_P(a) || RVALUE_OLD_P(b)) {
- return;
- }
- else {
- gc_writebarrier_generational(a, b, objspace);
- }
- }
- else { /* slow path */
- gc_writebarrier_incremental(a, b, objspace);
- }
-}
-
-void
-rb_gc_writebarrier_unprotect(VALUE obj)
-{
- if (RVALUE_WB_UNPROTECTED(obj)) {
- return;
+ if (RGENGC_CHECK_MODE) {
+ if (!RVALUE_PROMOTED_P(obj)) rb_bug("rb_gc_writebarrier_unprotect_promoted: called on non-promoted object");
+ if (RVALUE_SHADY(obj)) rb_bug("rb_gc_writebarrier_unprotect_promoted: called on shady object");
}
- else {
- rb_objspace_t *objspace = &rb_objspace;
- gc_report(2, objspace, "rb_gc_writebarrier_unprotect: %s %s\n", obj_info(obj),
+ rgengc_report(0, objspace, "rb_gc_writebarrier_unprotect_promoted: %p (%s)%s\n", (void *)obj, obj_type_name(obj),
rgengc_remembered(objspace, obj) ? " (already remembered)" : "");
- if (RVALUE_OLD_P(obj)) {
- gc_report(1, objspace, "rb_gc_writebarrier_unprotect: %s\n", obj_info(obj));
- RVALUE_DEMOTE(objspace, obj);
- gc_mark_set(objspace, obj);
- gc_remember_unprotected(objspace, obj);
+ if (RVALUE_OLD_P(obj)) {
+ RVALUE_DEMOTE_FROM_OLD(obj);
+
+ rgengc_remember(objspace, obj);
+ objspace->rgengc.remembered_shady_object_count++;
#if RGENGC_PROFILE
- objspace->profile.total_shade_operation_count++;
+ objspace->profile.shade_operation_count++;
#if RGENGC_PROFILE >= 2
- objspace->profile.shade_operation_count_types[BUILTIN_TYPE(obj)]++;
+ objspace->profile.shade_operation_count_types[BUILTIN_TYPE(obj)]++;
#endif /* RGENGC_PROFILE >= 2 */
#endif /* RGENGC_PROFILE */
- }
- else {
- RVALUE_AGE_RESET(obj);
- }
-
- MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj);
}
+#if RGENGC_THREEGEN
+ else {
+ RVALUE_DEMOTE_FROM_YOUNG(obj);
+ }
+#endif
}
-/*
- * remember `obj' if needed.
- */
void
-rb_gc_writebarrier_remember(VALUE obj)
+rb_gc_writebarrier_remember_promoted(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
-
- gc_report(1, objspace, "rb_gc_writebarrier_remember: %s\n", obj_info(obj));
-
- if (is_incremental_marking(objspace)) {
- if (RVALUE_BLACK_P(obj)) {
- gc_grey(objspace, obj);
- }
- }
- else {
- if (RVALUE_OLD_P(obj)) {
- rgengc_remember(objspace, obj);
- }
- }
+ rgengc_remember(objspace, obj);
}
static st_table *rgengc_unprotect_logging_table;
static int
-rgengc_unprotect_logging_exit_func_i(st_data_t key, st_data_t val, st_data_t arg)
+rgengc_unprotect_logging_exit_func_i(st_data_t key, st_data_t val)
{
fprintf(stderr, "%s\t%d\n", (char *)key, (int)val);
return ST_CONTINUE;
@@ -5859,12 +4679,12 @@ rb_gc_unprotect_logging(void *objptr, const char *filename, int line)
atexit(rgengc_unprotect_logging_exit_func);
}
- if (RVALUE_WB_UNPROTECTED(obj) == 0) {
+ if (OBJ_WB_PROTECTED(obj)) {
char buff[0x100];
st_data_t cnt = 1;
char *ptr = buff;
- snprintf(ptr, 0x100 - 1, "%s|%s:%d", obj_info(obj), filename, line);
+ snprintf(ptr, 0x100 - 1, "%s|%s:%d", obj_type_name(obj), filename, line);
if (st_lookup(rgengc_unprotect_logging_table, (st_data_t)ptr, &cnt)) {
cnt++;
@@ -5876,38 +4696,15 @@ rb_gc_unprotect_logging(void *objptr, const char *filename, int line)
st_insert(rgengc_unprotect_logging_table, (st_data_t)ptr, cnt);
}
}
-#endif /* USE_RGENGC */
-void
-rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
-{
-#if USE_RGENGC
- rb_objspace_t *objspace = &rb_objspace;
-
- if (RVALUE_WB_UNPROTECTED(obj) && !RVALUE_WB_UNPROTECTED(dest)) {
- if (!RVALUE_OLD_P(dest)) {
- MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(dest), dest);
- RVALUE_AGE_RESET_RAW(dest);
- }
- else {
- RVALUE_DEMOTE(objspace, dest);
- }
- }
-
- check_rvalue_consistency(dest);
-#endif
-}
+#endif /* USE_RGENGC */
/* RGENGC analysis information */
VALUE
rb_obj_rgengc_writebarrier_protected_p(VALUE obj)
{
-#if USE_RGENGC
- return RVALUE_WB_UNPROTECTED(obj) ? Qfalse : Qtrue;
-#else
- return Qfalse;
-#endif
+ return OBJ_WB_PROTECTED(obj) ? Qtrue : Qfalse;
}
VALUE
@@ -5916,102 +4713,35 @@ rb_obj_rgengc_promoted_p(VALUE obj)
return OBJ_PROMOTED(obj) ? Qtrue : Qfalse;
}
-size_t
-rb_obj_gc_flags(VALUE obj, ID* flags, size_t max)
-{
- size_t n = 0;
- static ID ID_marked;
-#if USE_RGENGC
- static ID ID_wb_protected, ID_old, ID_marking, ID_uncollectible;
-#endif
-
- if (!ID_marked) {
-#define I(s) ID_##s = rb_intern(#s);
- I(marked);
-#if USE_RGENGC
- I(wb_protected);
- I(old);
- I(marking);
- I(uncollectible);
-#endif
-#undef I
- }
-
-#if USE_RGENGC
- if (RVALUE_WB_UNPROTECTED(obj) == 0 && n<max) flags[n++] = ID_wb_protected;
- if (RVALUE_OLD_P(obj) && n<max) flags[n++] = ID_old;
- if (RVALUE_UNCOLLECTIBLE(obj) && n<max) flags[n++] = ID_uncollectible;
- if (MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj) && n<max) flags[n++] = ID_marking;
-#endif
- if (MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj) && n<max) flags[n++] = ID_marked;
- return n;
-}
-
/* GC */
void
-rb_gc_force_recycle(VALUE obj)
+rb_gc_force_recycle(VALUE p)
{
rb_objspace_t *objspace = &rb_objspace;
#if USE_RGENGC
- int is_old = RVALUE_OLD_P(obj);
-
- gc_report(2, objspace, "rb_gc_force_recycle: %s\n", obj_info(obj));
-
- if (is_old) {
- if (RVALUE_MARKED(obj)) {
- objspace->rgengc.old_objects--;
- }
- }
- CLEAR_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), obj);
- CLEAR_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj);
-
-#if GC_ENABLE_INCREMENTAL_MARK
- if (is_incremental_marking(objspace)) {
- if (MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj)) {
- invalidate_mark_stack(&objspace->mark_stack, obj);
- CLEAR_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj);
- }
- CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj);
- }
- else {
-#endif
- if (is_old || !GET_HEAP_PAGE(obj)->flags.before_sweep) {
- CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj);
- }
- CLEAR_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj);
-#if GC_ENABLE_INCREMENTAL_MARK
+ CLEAR_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(p), p);
+ CLEAR_IN_BITMAP(GET_HEAP_OLDGEN_BITS(p), p);
+ if (!GET_HEAP_PAGE(p)->before_sweep) {
+ CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(p), p);
}
#endif
-#endif
-
- objspace->profile.total_freed_objects++;
- heap_page_add_freeobj(objspace, GET_HEAP_PAGE(obj), obj);
+ objspace->profile.total_freed_object_num++;
+ heap_page_add_freeobj(objspace, GET_HEAP_PAGE(p), p);
- /* Disable counting swept_slots because there are no meaning.
+ /* Disable counting swept_num because there are no meaning.
* if (!MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(p), p)) {
- * objspace->heap.swept_slots++;
+ * objspace->heap.swept_num++;
* }
*/
}
-#ifndef MARK_OBJECT_ARY_BUCKET_SIZE
-#define MARK_OBJECT_ARY_BUCKET_SIZE 1024
-#endif
-
void
rb_gc_register_mark_object(VALUE obj)
{
- VALUE ary_ary = GET_THREAD()->vm->mark_object_ary;
- VALUE ary = rb_ary_last(0, 0, ary_ary);
-
- if (ary == Qnil || RARRAY_LEN(ary) >= MARK_OBJECT_ARY_BUCKET_SIZE) {
- ary = rb_ary_tmp_new(MARK_OBJECT_ARY_BUCKET_SIZE);
- rb_ary_push(ary_ary, ary);
- }
-
+ VALUE ary = GET_THREAD()->vm->mark_object_ary;
rb_ary_push(ary, obj);
}
@@ -6022,19 +4752,19 @@ rb_gc_register_address(VALUE *addr)
struct gc_list *tmp;
tmp = ALLOC(struct gc_list);
- tmp->next = global_list;
+ tmp->next = global_List;
tmp->varptr = addr;
- global_list = tmp;
+ global_List = tmp;
}
void
rb_gc_unregister_address(VALUE *addr)
{
rb_objspace_t *objspace = &rb_objspace;
- struct gc_list *tmp = global_list;
+ struct gc_list *tmp = global_List;
if (tmp->varptr == addr) {
- global_list = tmp->next;
+ global_List = tmp->next;
xfree(tmp);
return;
}
@@ -6058,356 +4788,132 @@ rb_global_variable(VALUE *var)
#define GC_NOTIFY 0
-enum {
- gc_stress_no_major,
- gc_stress_no_immediate_sweep,
- gc_stress_full_mark_after_malloc,
- gc_stress_max
-};
-
-#define gc_stress_full_mark_after_malloc_p() \
- (FIXNUM_P(ruby_gc_stress_mode) && (FIX2LONG(ruby_gc_stress_mode) & (1<<gc_stress_full_mark_after_malloc)))
-
-static void
-heap_ready_to_gc(rb_objspace_t *objspace, rb_heap_t *heap)
-{
- if (!heap->freelist && !heap->free_pages) {
- if (!heap_increment(objspace, heap)) {
- heap_set_increment(objspace, 1);
- heap_increment(objspace, heap);
- }
- }
-}
-
static int
-ready_to_gc(rb_objspace_t *objspace)
-{
- if (dont_gc || during_gc || ruby_disable_gc) {
- heap_ready_to_gc(objspace, heap_eden);
- return FALSE;
- }
- else {
- return TRUE;
- }
-}
-
-static void
-gc_reset_malloc_info(rb_objspace_t *objspace)
+garbage_collect_body(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
{
- gc_prof_set_malloc_info(objspace);
- {
- size_t inc = ATOMIC_SIZE_EXCHANGE(malloc_increase, 0);
- size_t old_limit = malloc_limit;
+ if (ruby_gc_stress && !ruby_disable_gc_stress) {
+ int flag = FIXNUM_P(ruby_gc_stress) ? FIX2INT(ruby_gc_stress) : 0;
- if (inc > malloc_limit) {
- malloc_limit = (size_t)(inc * gc_params.malloc_limit_growth_factor);
- if (gc_params.malloc_limit_max > 0 && /* ignore max-check if 0 */
- malloc_limit > gc_params.malloc_limit_max) {
- malloc_limit = gc_params.malloc_limit_max;
- }
- }
- else {
- malloc_limit = (size_t)(malloc_limit * 0.98); /* magic number */
- if (malloc_limit < gc_params.malloc_limit_min) {
- malloc_limit = gc_params.malloc_limit_min;
- }
- }
-
- if (0) {
- if (old_limit != malloc_limit) {
- fprintf(stderr, "[%"PRIuSIZE"] malloc_limit: %"PRIuSIZE" -> %"PRIuSIZE"\n",
- rb_gc_count(), old_limit, malloc_limit);
- }
- else {
- fprintf(stderr, "[%"PRIuSIZE"] malloc_limit: not changed (%"PRIuSIZE")\n",
- rb_gc_count(), malloc_limit);
- }
- }
+ if (flag & 0x01)
+ reason &= ~GPR_FLAG_MAJOR_MASK;
+ else
+ reason |= GPR_FLAG_MAJOR_BY_STRESS;
+ immediate_sweep = !(flag & 0x02);
}
- /* reset oldmalloc info */
-#if RGENGC_ESTIMATE_OLDMALLOC
- if (!is_full_marking(objspace)) {
- if (objspace->rgengc.oldmalloc_increase > objspace->rgengc.oldmalloc_increase_limit) {
- objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_OLDMALLOC;;
- objspace->rgengc.oldmalloc_increase_limit =
- (size_t)(objspace->rgengc.oldmalloc_increase_limit * gc_params.oldmalloc_limit_growth_factor);
-
- if (objspace->rgengc.oldmalloc_increase_limit > gc_params.oldmalloc_limit_max) {
- objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_max;
- }
- }
-
- if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n",
- (int)rb_gc_count(),
- (int)objspace->rgengc.need_major_gc,
- (unsigned int)objspace->rgengc.oldmalloc_increase,
- (unsigned int)objspace->rgengc.oldmalloc_increase_limit,
- (unsigned int)gc_params.oldmalloc_limit_max);
- }
+#if USE_RGENGC
else {
- /* major GC */
- objspace->rgengc.oldmalloc_increase = 0;
-
- if ((objspace->profile.latest_gc_info & GPR_FLAG_MAJOR_BY_OLDMALLOC) == 0) {
- objspace->rgengc.oldmalloc_increase_limit =
- (size_t)(objspace->rgengc.oldmalloc_increase_limit / ((gc_params.oldmalloc_limit_growth_factor - 1)/10 + 1));
- if (objspace->rgengc.oldmalloc_increase_limit < gc_params.oldmalloc_limit_min) {
- objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_min;
- }
- }
- }
-#endif
-}
-
-static int
-garbage_collect(rb_objspace_t *objspace, int full_mark, int immediate_mark, int immediate_sweep, int reason)
-{
-#if GC_PROFILE_MORE_DETAIL
- objspace->profile.prepare_time = getrusage_time();
-#endif
-
- gc_rest(objspace);
-
-#if GC_PROFILE_MORE_DETAIL
- objspace->profile.prepare_time = getrusage_time() - objspace->profile.prepare_time;
-#endif
-
- return gc_start(objspace, full_mark, immediate_mark, immediate_sweep, reason);
-}
-
-static int
-gc_start(rb_objspace_t *objspace, const int full_mark, const int immediate_mark, const unsigned int immediate_sweep, int reason)
-{
- int do_full_mark = full_mark;
- objspace->flags.immediate_sweep = immediate_sweep;
-
- if (!heap_allocated_pages) return FALSE; /* heap is not ready */
- if (reason != GPR_FLAG_METHOD && !ready_to_gc(objspace)) return TRUE; /* GC is not allowed */
-
- if (RGENGC_CHECK_MODE) {
- assert(objspace->flags.stat == gc_stat_none);
- assert(!is_lazy_sweeping(heap_eden));
- assert(!is_incremental_marking(objspace));
-#if RGENGC_CHECK_MODE >= 2
- gc_verify_internal_consistency(Qnil);
-#endif
- }
-
- gc_enter(objspace, "gc_start");
-
- if (ruby_gc_stressful) {
- int flag = FIXNUM_P(ruby_gc_stress_mode) ? FIX2INT(ruby_gc_stress_mode) : 0;
-
- if ((flag & (1<<gc_stress_no_major)) == 0) {
- do_full_mark = TRUE;
+ if (full_mark) {
+ reason |= GPR_FLAG_MAJOR_BY_NOFREE;
}
-
- objspace->flags.immediate_sweep = !(flag & (1<<gc_stress_no_immediate_sweep));
- }
- else {
-#if USE_RGENGC
if (objspace->rgengc.need_major_gc) {
- reason |= objspace->rgengc.need_major_gc;
- do_full_mark = TRUE;
+ objspace->rgengc.need_major_gc = FALSE;
+ reason |= GPR_FLAG_MAJOR_BY_RESCAN;
}
- else if (RGENGC_FORCE_MAJOR_GC) {
- reason = GPR_FLAG_MAJOR_BY_FORCE;
- do_full_mark = TRUE;
+ if (objspace->rgengc.remembered_shady_object_count > objspace->rgengc.remembered_shady_object_limit) {
+ reason |= GPR_FLAG_MAJOR_BY_SHADY;
+ }
+ if (objspace->rgengc.old_object_count > objspace->rgengc.old_object_limit) {
+ reason |= GPR_FLAG_MAJOR_BY_OLDGEN;
}
- objspace->rgengc.need_major_gc = GPR_FLAG_NONE;
-#endif
- }
-
- if (do_full_mark && (reason & GPR_FLAG_MAJOR_MASK) == 0) {
- reason |= GPR_FLAG_MAJOR_BY_FORCE; /* GC by CAPI, METHOD, and so on. */
- }
-
-#if GC_ENABLE_INCREMENTAL_MARK
- if (!GC_ENABLE_INCREMENTAL_MARK || objspace->flags.dont_incremental || immediate_mark) {
- objspace->flags.during_incremental_marking = FALSE;
- }
- else {
- objspace->flags.during_incremental_marking = do_full_mark;
+ if (!GC_ENABLE_LAZY_SWEEP || objspace->flags.dont_lazy_sweep) {
+ immediate_sweep = TRUE;
+ }
}
#endif
- if (!GC_ENABLE_LAZY_SWEEP || objspace->flags.dont_incremental) {
- objspace->flags.immediate_sweep = TRUE;
- }
-
- if (objspace->flags.immediate_sweep) reason |= GPR_FLAG_IMMEDIATE_SWEEP;
+ if (immediate_sweep) reason |= GPR_FLAG_IMMEDIATE_SWEEP;
+ full_mark = (reason & GPR_FLAG_MAJOR_MASK) ? TRUE : FALSE;
- gc_report(1, objspace, "gc_start(%d, %d, %d, reason: %d) => %d, %d, %d\n",
- full_mark, immediate_mark, immediate_sweep, reason,
- do_full_mark, !is_incremental_marking(objspace), objspace->flags.immediate_sweep);
+ if (GC_NOTIFY) fprintf(stderr, "start garbage_collect(%d, %d, %d)\n", full_mark, immediate_sweep, reason);
objspace->profile.count++;
- objspace->profile.latest_gc_info = reason;
- objspace->profile.total_allocated_objects_at_gc_start = objspace->total_allocated_objects;
- objspace->profile.heap_used_at_gc_start = heap_allocated_pages;
- gc_prof_setup_new_record(objspace, reason);
- gc_reset_malloc_info(objspace);
-
gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_START, 0 /* TODO: pass minor/immediate flag? */);
- if (RGENGC_CHECK_MODE) assert(during_gc);
+ objspace->profile.total_allocated_object_num_at_gc_start = objspace->profile.total_allocated_object_num;
+ objspace->profile.heap_used_at_gc_start = heap_pages_used;
+
+ gc_prof_setup_new_record(objspace, reason);
gc_prof_timer_start(objspace);
{
- gc_marks(objspace, do_full_mark);
+ assert(during_gc > 0);
+ gc_marks(objspace, full_mark);
+ gc_sweep(objspace, immediate_sweep);
+ during_gc = 0;
}
gc_prof_timer_stop(objspace);
- gc_exit(objspace, "gc_start");
+ if (GC_NOTIFY) fprintf(stderr, "end garbage_collect()\n");
return TRUE;
}
-static void
-gc_rest(rb_objspace_t *objspace)
+static int
+heap_ready_to_gc(rb_objspace_t *objspace, rb_heap_t *heap)
{
- int marking = is_incremental_marking(objspace);
- int sweeping = is_lazy_sweeping(heap_eden);
-
- if (marking || sweeping) {
- gc_enter(objspace, "gc_rest");
-
- if (RGENGC_CHECK_MODE >= 2) gc_verify_internal_consistency(Qnil);
-
- if (is_incremental_marking(objspace)) {
- PUSH_MARK_FUNC_DATA(NULL);
- gc_marks_rest(objspace);
- POP_MARK_FUNC_DATA();
- }
- if (is_lazy_sweeping(heap_eden)) {
- gc_sweep_rest(objspace);
+ if (dont_gc || during_gc) {
+ if (!heap->freelist && !heap->free_pages) {
+ if (!heap_increment(objspace, heap)) {
+ heap_set_increment(objspace, 0);
+ heap_increment(objspace, heap);
+ }
}
- gc_exit(objspace, "gc_rest");
+ return FALSE;
}
+ return TRUE;
}
-struct objspace_and_reason {
- rb_objspace_t *objspace;
- int reason;
- int full_mark;
- int immediate_mark;
- int immediate_sweep;
-};
-
-static void
-gc_current_status_fill(rb_objspace_t *objspace, char *buff)
+static int
+ready_to_gc(rb_objspace_t *objspace)
{
- int i = 0;
- if (is_marking(objspace)) {
- buff[i++] = 'M';
-#if USE_RGENGC
- if (is_full_marking(objspace)) buff[i++] = 'F';
-#if GC_ENABLE_INCREMENTAL_MARK
- if (is_incremental_marking(objspace)) buff[i++] = 'I';
-#endif
-#endif
- }
- else if (is_sweeping(objspace)) {
- buff[i++] = 'S';
- if (is_lazy_sweeping(heap_eden)) buff[i++] = 'L';
- }
- else {
- buff[i++] = 'N';
- }
- buff[i] = '\0';
+ return heap_ready_to_gc(objspace, heap_eden);
}
-static const char *
-gc_current_status(rb_objspace_t *objspace)
+static int
+garbage_collect(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
{
- static char buff[0x10];
- gc_current_status_fill(objspace, buff);
- return buff;
-}
-
-#if PRINT_ENTER_EXIT_TICK
-
-static tick_t last_exit_tick;
-static tick_t enter_tick;
-static int enter_count = 0;
-static char last_gc_status[0x10];
+ if (!heap_pages_used) {
+ during_gc = 0;
+ return FALSE;
+ }
+ if (!ready_to_gc(objspace)) {
+ during_gc = 0;
+ return TRUE;
+ }
-static inline void
-gc_record(rb_objspace_t *objspace, int direction, const char *event)
-{
- if (direction == 0) { /* enter */
- enter_count++;
- enter_tick = tick();
- gc_current_status_fill(objspace, last_gc_status);
- }
- else { /* exit */
- tick_t exit_tick = tick();
- char current_gc_status[0x10];
- gc_current_status_fill(objspace, current_gc_status);
-#if 1
- /* [last mutator time] [gc time] [event] */
- fprintf(stderr, "%"PRItick"\t%"PRItick"\t%s\t[%s->%s|%c]\n",
- enter_tick - last_exit_tick,
- exit_tick - enter_tick,
- event,
- last_gc_status, current_gc_status,
- (objspace->profile.latest_gc_info & GPR_FLAG_MAJOR_MASK) ? '+' : '-');
- last_exit_tick = exit_tick;
-#else
- /* [enter_tick] [gc time] [event] */
- fprintf(stderr, "%"PRItick"\t%"PRItick"\t%s\t[%s->%s|%c]\n",
- enter_tick,
- exit_tick - enter_tick,
- event,
- last_gc_status, current_gc_status,
- (objspace->profile.latest_gc_info & GPR_FLAG_MAJOR_MASK) ? '+' : '-');
+#if GC_PROFILE_MORE_DETAIL
+ objspace->profile.prepare_time = getrusage_time();
+#endif
+ gc_rest_sweep(objspace);
+#if GC_PROFILE_MORE_DETAIL
+ objspace->profile.prepare_time = getrusage_time() - objspace->profile.prepare_time;
#endif
- }
-}
-#else /* PRINT_ENTER_EXIT_TICK */
-static inline void
-gc_record(rb_objspace_t *objspace, int direction, const char *event)
-{
- /* null */
-}
-#endif /* PRINT_ENTER_EXIT_TICK */
-static inline void
-gc_enter(rb_objspace_t *objspace, const char *event)
-{
- if (RGENGC_CHECK_MODE) assert(during_gc == 0);
- if (RGENGC_CHECK_MODE >= 3) gc_verify_internal_consistency(Qnil);
+ during_gc++;
- during_gc = TRUE;
- gc_report(1, objspace, "gc_entr: %s [%s]\n", event, gc_current_status(objspace));
- gc_record(objspace, 0, event);
- gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_ENTER, 0); /* TODO: which parameter should be passed? */
+ return garbage_collect_body(objspace, full_mark, immediate_sweep, reason);
}
-static inline void
-gc_exit(rb_objspace_t *objspace, const char *event)
-{
- if (RGENGC_CHECK_MODE) assert(during_gc != 0);
-
- gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_EXIT, 0); /* TODO: which parameter should be passsed? */
- gc_record(objspace, 1, event);
- gc_report(1, objspace, "gc_exit: %s [%s]\n", event, gc_current_status(objspace));
- during_gc = FALSE;
-}
+struct objspace_and_reason {
+ rb_objspace_t *objspace;
+ int reason;
+ int full_mark;
+ int immediate_sweep;
+};
static void *
gc_with_gvl(void *ptr)
{
struct objspace_and_reason *oar = (struct objspace_and_reason *)ptr;
- return (void *)(VALUE)garbage_collect(oar->objspace, oar->full_mark, oar->immediate_mark, oar->immediate_sweep, oar->reason);
+ return (void *)(VALUE)garbage_collect(oar->objspace, oar->full_mark, oar->immediate_sweep, oar->reason);
}
static int
-garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_mark, int immediate_sweep, int reason)
+garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason)
{
if (dont_gc) return TRUE;
if (ruby_thread_has_gvl_p()) {
- return garbage_collect(objspace, full_mark, immediate_mark, immediate_sweep, reason);
+ return garbage_collect(objspace, full_mark, immediate_sweep, reason);
}
else {
if (ruby_native_thread_p()) {
@@ -6415,7 +4921,6 @@ garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_m
oar.objspace = objspace;
oar.reason = reason;
oar.full_mark = full_mark;
- oar.immediate_mark = immediate_mark;
oar.immediate_sweep = immediate_sweep;
return (int)(VALUE)rb_thread_call_with_gvl(gc_with_gvl, (void *)&oar);
}
@@ -6430,7 +4935,7 @@ garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_m
int
rb_garbage_collect(void)
{
- return garbage_collect(&rb_objspace, TRUE, TRUE, TRUE, GPR_FLAG_CAPI);
+ return garbage_collect(&rb_objspace, TRUE, TRUE, GPR_FLAG_CAPI);
}
#undef Init_stack
@@ -6444,56 +4949,13 @@ Init_stack(volatile VALUE *addr)
/*
* call-seq:
* GC.start -> nil
- * GC.garbage_collect -> nil
- * GC.start(full_mark: true, immediate_sweep: true) -> nil
- * GC.garbage_collect(full_mark: true, immediate_sweep: true) -> nil
+ * gc.garbage_collect -> nil
+ * ObjectSpace.garbage_collect -> nil
*
* Initiates garbage collection, unless manually disabled.
*
- * This method is defined with keyword arguments that default to true:
- *
- * def GC.start(full_mark: true, immediate_sweep: true); end
- *
- * Use full_mark: false to perform a minor GC.
- * Use immediate_sweep: false to defer sweeping (use lazy sweep).
- *
- * Note: These keyword arguments are implementation and version dependent. They
- * are not guaranteed to be future-compatible, and may be ignored if the
- * underlying implementation does not support them.
*/
-static VALUE
-gc_start_internal(int argc, VALUE *argv, VALUE self)
-{
- rb_objspace_t *objspace = &rb_objspace;
- int full_mark = TRUE, immediate_mark = TRUE, immediate_sweep = TRUE;
- VALUE opt = Qnil;
- static ID keyword_ids[3];
-
- rb_scan_args(argc, argv, "0:", &opt);
-
- if (!NIL_P(opt)) {
- VALUE kwvals[3];
-
- if (!keyword_ids[0]) {
- keyword_ids[0] = rb_intern("full_mark");
- keyword_ids[1] = rb_intern("immediate_mark");
- keyword_ids[2] = rb_intern("immediate_sweep");
- }
-
- rb_get_kwargs(opt, keyword_ids, 0, 3, kwvals);
-
- if (kwvals[0] != Qundef) full_mark = RTEST(kwvals[0]);
- if (kwvals[1] != Qundef) immediate_mark = RTEST(kwvals[1]);
- if (kwvals[2] != Qundef) immediate_sweep = RTEST(kwvals[2]);
- }
-
- garbage_collect(objspace, full_mark, immediate_mark, immediate_sweep, GPR_FLAG_METHOD);
- if (!finalizing) finalize_deferred(objspace);
-
- return Qnil;
-}
-
VALUE
rb_gc_start(void)
{
@@ -6505,8 +4967,9 @@ void
rb_gc(void)
{
rb_objspace_t *objspace = &rb_objspace;
- garbage_collect(objspace, TRUE, TRUE, TRUE, GPR_FLAG_CAPI);
+ garbage_collect(objspace, TRUE, TRUE, GPR_FLAG_METHOD);
if (!finalizing) finalize_deferred(objspace);
+ heap_pages_free_unused_pages(objspace);
}
int
@@ -6517,9 +4980,6 @@ rb_during_gc(void)
}
#if RGENGC_PROFILE >= 2
-
-static const char *type_name(int type, VALUE obj);
-
static void
gc_count_add_each_types(VALUE hash, const char *name, const size_t *types)
{
@@ -6555,529 +5015,131 @@ gc_count(VALUE self)
return SIZET2NUM(rb_gc_count());
}
-static VALUE
-gc_info_decode(rb_objspace_t *objspace, const VALUE hash_or_key, const int orig_flags)
-{
- static VALUE sym_major_by = Qnil, sym_gc_by, sym_immediate_sweep, sym_have_finalizer, sym_state;
- static VALUE sym_nofree, sym_oldgen, sym_shady, sym_force, sym_stress;
-#if RGENGC_ESTIMATE_OLDMALLOC
- static VALUE sym_oldmalloc;
-#endif
- static VALUE sym_newobj, sym_malloc, sym_method, sym_capi;
- static VALUE sym_none, sym_marking, sym_sweeping;
- VALUE hash = Qnil, key = Qnil;
- VALUE major_by;
- VALUE flags = orig_flags ? orig_flags : objspace->profile.latest_gc_info;
-
- if (SYMBOL_P(hash_or_key)) {
- key = hash_or_key;
- }
- else if (RB_TYPE_P(hash_or_key, T_HASH)) {
- hash = hash_or_key;
- }
- else {
- rb_raise(rb_eTypeError, "non-hash or symbol given");
- }
-
- if (sym_major_by == Qnil) {
-#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
- S(major_by);
- S(gc_by);
- S(immediate_sweep);
- S(have_finalizer);
- S(state);
-
- S(stress);
- S(nofree);
- S(oldgen);
- S(shady);
- S(force);
-#if RGENGC_ESTIMATE_OLDMALLOC
- S(oldmalloc);
-#endif
- S(newobj);
- S(malloc);
- S(method);
- S(capi);
-
- S(none);
- S(marking);
- S(sweeping);
-#undef S
- }
-
-#define SET(name, attr) \
- if (key == sym_##name) \
- return (attr); \
- else if (hash != Qnil) \
- rb_hash_aset(hash, sym_##name, (attr));
-
- major_by =
- (flags & GPR_FLAG_MAJOR_BY_NOFREE) ? sym_nofree :
- (flags & GPR_FLAG_MAJOR_BY_OLDGEN) ? sym_oldgen :
- (flags & GPR_FLAG_MAJOR_BY_SHADY) ? sym_shady :
- (flags & GPR_FLAG_MAJOR_BY_FORCE) ? sym_force :
-#if RGENGC_ESTIMATE_OLDMALLOC
- (flags & GPR_FLAG_MAJOR_BY_OLDMALLOC) ? sym_oldmalloc :
-#endif
- Qnil;
- SET(major_by, major_by);
-
- SET(gc_by,
- (flags & GPR_FLAG_NEWOBJ) ? sym_newobj :
- (flags & GPR_FLAG_MALLOC) ? sym_malloc :
- (flags & GPR_FLAG_METHOD) ? sym_method :
- (flags & GPR_FLAG_CAPI) ? sym_capi :
- (flags & GPR_FLAG_STRESS) ? sym_stress :
- Qnil
- );
-
- SET(have_finalizer, (flags & GPR_FLAG_HAVE_FINALIZE) ? Qtrue : Qfalse);
- SET(immediate_sweep, (flags & GPR_FLAG_IMMEDIATE_SWEEP) ? Qtrue : Qfalse);
-
- if (orig_flags == 0) {
- SET(state, objspace->flags.stat == gc_stat_none ? sym_none :
- objspace->flags.stat == gc_stat_marking ? sym_marking : sym_sweeping);
- }
-#undef SET
-
- if (!NIL_P(key)) {/* matched key should return above */
- rb_raise(rb_eArgError, "unknown key: %"PRIsVALUE, rb_sym2str(key));
- }
-
- return hash;
-}
-
-VALUE
-rb_gc_latest_gc_info(VALUE key)
-{
- rb_objspace_t *objspace = &rb_objspace;
- return gc_info_decode(objspace, key, 0);
-}
-
/*
* call-seq:
- * GC.latest_gc_info -> {:gc_by=>:newobj}
- * GC.latest_gc_info(hash) -> hash
- * GC.latest_gc_info(:major_by) -> :malloc
+ * GC.stat -> Hash
+ *
+ * Returns a Hash containing information about the GC.
+ *
+ * The hash includes information about internal statistics about GC such as:
+ *
+ * {
+ * :count=>0,
+ * :heap_used=>12,
+ * :heap_length=>12,
+ * :heap_increment=>0,
+ * :heap_live_num=>7539,
+ * :heap_free_num=>88,
+ * :heap_final_num=>0,
+ * :total_allocated_object=>7630,
+ * :total_freed_object=>88
+ * }
+ *
+ * The contents of the hash are implementation specific and may be changed in
+ * the future.
+ *
+ * This method is only expected to work on C Ruby.
*
- * Returns information about the most recent garbage collection.
*/
static VALUE
-gc_latest_gc_info(int argc, VALUE *argv, VALUE self)
+gc_stat(int argc, VALUE *argv, VALUE self)
{
rb_objspace_t *objspace = &rb_objspace;
- VALUE arg = Qnil;
-
- if (rb_scan_args(argc, argv, "01", &arg) == 1) {
- if (!SYMBOL_P(arg) && !RB_TYPE_P(arg, T_HASH)) {
- rb_raise(rb_eTypeError, "non-hash or symbol given");
- }
- }
-
- if (arg == Qnil) {
- arg = rb_hash_new();
- }
-
- return gc_info_decode(objspace, arg, 0);
-}
-
-enum gc_stat_sym {
- gc_stat_sym_count,
- gc_stat_sym_heap_allocated_pages,
- gc_stat_sym_heap_sorted_length,
- gc_stat_sym_heap_allocatable_pages,
- gc_stat_sym_heap_available_slots,
- gc_stat_sym_heap_live_slots,
- gc_stat_sym_heap_free_slots,
- gc_stat_sym_heap_final_slots,
- gc_stat_sym_heap_marked_slots,
- gc_stat_sym_heap_swept_slots,
- gc_stat_sym_heap_eden_pages,
- gc_stat_sym_heap_tomb_pages,
- gc_stat_sym_total_allocated_pages,
- gc_stat_sym_total_freed_pages,
- gc_stat_sym_total_allocated_objects,
- gc_stat_sym_total_freed_objects,
- gc_stat_sym_malloc_increase_bytes,
- gc_stat_sym_malloc_increase_bytes_limit,
+ VALUE hash;
+ static VALUE sym_count;
+ static VALUE sym_heap_used, sym_heap_length, sym_heap_increment;
+ static VALUE sym_heap_live_num, sym_heap_free_num, sym_heap_final_num;
+ static VALUE sym_total_allocated_object, sym_total_freed_object;
#if USE_RGENGC
- gc_stat_sym_minor_gc_count,
- gc_stat_sym_major_gc_count,
- gc_stat_sym_remembered_wb_unprotected_objects,
- gc_stat_sym_remembered_wb_unprotected_objects_limit,
- gc_stat_sym_old_objects,
- gc_stat_sym_old_objects_limit,
-#if RGENGC_ESTIMATE_OLDMALLOC
- gc_stat_sym_oldmalloc_increase_bytes,
- gc_stat_sym_oldmalloc_increase_bytes_limit,
-#endif
+ static VALUE sym_minor_gc_count, sym_major_gc_count;
#if RGENGC_PROFILE
- gc_stat_sym_total_generated_normal_object_count,
- gc_stat_sym_total_generated_shady_object_count,
- gc_stat_sym_total_shade_operation_count,
- gc_stat_sym_total_promoted_count,
- gc_stat_sym_total_remembered_normal_object_count,
- gc_stat_sym_total_remembered_shady_object_count,
-#endif
-#endif
- gc_stat_sym_last
-};
-
-enum gc_stat_compat_sym {
- gc_stat_compat_sym_gc_stat_heap_used,
- gc_stat_compat_sym_heap_eden_page_length,
- gc_stat_compat_sym_heap_tomb_page_length,
- gc_stat_compat_sym_heap_increment,
- gc_stat_compat_sym_heap_length,
- gc_stat_compat_sym_heap_live_slot,
- gc_stat_compat_sym_heap_free_slot,
- gc_stat_compat_sym_heap_final_slot,
- gc_stat_compat_sym_heap_swept_slot,
-#if USE_RGENGC
- gc_stat_compat_sym_remembered_shady_object,
- gc_stat_compat_sym_remembered_shady_object_limit,
- gc_stat_compat_sym_old_object,
- gc_stat_compat_sym_old_object_limit,
-#endif
- gc_stat_compat_sym_total_allocated_object,
- gc_stat_compat_sym_total_freed_object,
- gc_stat_compat_sym_malloc_increase,
- gc_stat_compat_sym_malloc_limit,
-#if RGENGC_ESTIMATE_OLDMALLOC
- gc_stat_compat_sym_oldmalloc_increase,
- gc_stat_compat_sym_oldmalloc_limit,
-#endif
- gc_stat_compat_sym_last
-};
-
-static VALUE gc_stat_symbols[gc_stat_sym_last];
-static VALUE gc_stat_compat_symbols[gc_stat_compat_sym_last];
-static VALUE gc_stat_compat_table;
+ static VALUE sym_generated_normal_object_count, sym_generated_shady_object_count;
+ static VALUE sym_shade_operation_count, sym_promote_infant_count, sym_promote_young_count;
+ static VALUE sym_remembered_normal_object_count, sym_remembered_shady_object_count;
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
-static void
-setup_gc_stat_symbols(void)
-{
- if (gc_stat_symbols[0] == 0) {
-#define S(s) gc_stat_symbols[gc_stat_sym_##s] = ID2SYM(rb_intern_const(#s))
+ if (sym_count == 0) {
+#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
S(count);
- S(heap_allocated_pages);
- S(heap_sorted_length);
- S(heap_allocatable_pages);
- S(heap_available_slots);
- S(heap_live_slots);
- S(heap_free_slots);
- S(heap_final_slots);
- S(heap_marked_slots);
- S(heap_swept_slots);
- S(heap_eden_pages);
- S(heap_tomb_pages);
- S(total_allocated_pages);
- S(total_freed_pages);
- S(total_allocated_objects);
- S(total_freed_objects);
- S(malloc_increase_bytes);
- S(malloc_increase_bytes_limit);
+ S(heap_used);
+ S(heap_length);
+ S(heap_increment);
+ S(heap_live_num);
+ S(heap_free_num);
+ S(heap_final_num);
+ S(total_allocated_object);
+ S(total_freed_object);
#if USE_RGENGC
S(minor_gc_count);
S(major_gc_count);
- S(remembered_wb_unprotected_objects);
- S(remembered_wb_unprotected_objects_limit);
- S(old_objects);
- S(old_objects_limit);
-#if RGENGC_ESTIMATE_OLDMALLOC
- S(oldmalloc_increase_bytes);
- S(oldmalloc_increase_bytes_limit);
-#endif
#if RGENGC_PROFILE
- S(total_generated_normal_object_count);
- S(total_generated_shady_object_count);
- S(total_shade_operation_count);
- S(total_promoted_count);
- S(total_remembered_normal_object_count);
- S(total_remembered_shady_object_count);
-#endif /* RGENGC_PROFILE */
+ S(generated_normal_object_count);
+ S(generated_shady_object_count);
+ S(shade_operation_count);
+ S(promote_infant_count);
+ S(promote_young_count);
+ S(remembered_normal_object_count);
+ S(remembered_shady_object_count);
#endif /* USE_RGENGC */
+#endif /* RGENGC_PROFILE */
#undef S
-#define S(s) gc_stat_compat_symbols[gc_stat_compat_sym_##s] = ID2SYM(rb_intern_const(#s))
- S(gc_stat_heap_used);
- S(heap_eden_page_length);
- S(heap_tomb_page_length);
- S(heap_increment);
- S(heap_length);
- S(heap_live_slot);
- S(heap_free_slot);
- S(heap_final_slot);
- S(heap_swept_slot);
-#if USE_RGEGC
- S(remembered_shady_object);
- S(remembered_shady_object_limit);
- S(old_object);
- S(old_object_limit);
-#endif
- S(total_allocated_object);
- S(total_freed_object);
- S(malloc_increase);
- S(malloc_limit);
-#if RGENGC_ESTIMATE_OLDMALLOC
- S(oldmalloc_increase);
- S(oldmalloc_limit);
-#endif
-#undef S
-
- {
- VALUE table = gc_stat_compat_table = rb_hash_new();
- rb_obj_hide(table);
- rb_gc_register_mark_object(table);
-
- /* compatibility layer for Ruby 2.1 */
-#define OLD_SYM(s) gc_stat_compat_symbols[gc_stat_compat_sym_##s]
-#define NEW_SYM(s) gc_stat_symbols[gc_stat_sym_##s]
- rb_hash_aset(table, OLD_SYM(gc_stat_heap_used), NEW_SYM(heap_allocated_pages));
- rb_hash_aset(table, OLD_SYM(heap_eden_page_length), NEW_SYM(heap_eden_pages));
- rb_hash_aset(table, OLD_SYM(heap_tomb_page_length), NEW_SYM(heap_tomb_pages));
- rb_hash_aset(table, OLD_SYM(heap_increment), NEW_SYM(heap_allocatable_pages));
- rb_hash_aset(table, OLD_SYM(heap_length), NEW_SYM(heap_sorted_length));
- rb_hash_aset(table, OLD_SYM(heap_live_slot), NEW_SYM(heap_live_slots));
- rb_hash_aset(table, OLD_SYM(heap_free_slot), NEW_SYM(heap_free_slots));
- rb_hash_aset(table, OLD_SYM(heap_final_slot), NEW_SYM(heap_final_slots));
- rb_hash_aset(table, OLD_SYM(heap_swept_slot), NEW_SYM(heap_swept_slots));
-#if USE_RGEGC
- rb_hash_aset(table, OLD_SYM(remembered_shady_object), NEW_SYM(remembered_wb_unprotected_objects));
- rb_hash_aset(table, OLD_SYM(remembered_shady_object_limit), NEW_SYM(remembered_wb_unprotected_objects_limit));
- rb_hash_aset(table, OLD_SYM(old_object), NEW_SYM(old_objects));
- rb_hash_aset(table, OLD_SYM(old_object_limit), NEW_SYM(old_objects_limit));
-#endif
- rb_hash_aset(table, OLD_SYM(total_allocated_object), NEW_SYM(total_allocated_objects));
- rb_hash_aset(table, OLD_SYM(total_freed_object), NEW_SYM(total_freed_objects));
- rb_hash_aset(table, OLD_SYM(malloc_increase), NEW_SYM(malloc_increase_bytes));
- rb_hash_aset(table, OLD_SYM(malloc_limit), NEW_SYM(malloc_increase_bytes_limit));
-#if RGENGC_ESTIMATE_OLDMALLOC
- rb_hash_aset(table, OLD_SYM(oldmalloc_increase), NEW_SYM(oldmalloc_increase_bytes));
- rb_hash_aset(table, OLD_SYM(oldmalloc_limit), NEW_SYM(oldmalloc_increase_bytes_limit));
-#endif
-#undef OLD_SYM
-#undef NEW_SYM
- rb_obj_freeze(table);
- }
}
-}
-static VALUE
-compat_key(VALUE key)
-{
- VALUE new_key = rb_hash_lookup(gc_stat_compat_table, key);
-
- if (!NIL_P(new_key)) {
- static int warned = 0;
- if (warned == 0) {
- rb_warn("GC.stat keys were changed from Ruby 2.1. "
- "In this case, you refer to obsolete `%"PRIsVALUE"' (new key is `%"PRIsVALUE"'). "
- "Please check <https://bugs.ruby-lang.org/issues/9924> for more information.",
- key, new_key);
- warned = 1;
+ if (rb_scan_args(argc, argv, "01", &hash) == 1) {
+ if (!RB_TYPE_P(hash, T_HASH)) {
+ rb_raise(rb_eTypeError, "non-hash given");
}
}
- return new_key;
-}
-
-static VALUE
-default_proc_for_compat_func(VALUE hash, VALUE dmy, int argc, VALUE *argv)
-{
- VALUE key, new_key;
-
- Check_Type(hash, T_HASH);
- rb_check_arity(argc, 2, 2);
- key = argv[1];
-
- if ((new_key = compat_key(key)) != Qnil) {
- return rb_hash_lookup(hash, new_key);
+ if (hash == Qnil) {
+ hash = rb_hash_new();
}
- return Qnil;
-}
-
-static size_t
-gc_stat_internal(VALUE hash_or_sym)
-{
- rb_objspace_t *objspace = &rb_objspace;
- VALUE hash = Qnil, key = Qnil;
-
- setup_gc_stat_symbols();
-
- if (RB_TYPE_P(hash_or_sym, T_HASH)) {
- hash = hash_or_sym;
-
- if (NIL_P(RHASH_IFNONE(hash))) {
- static VALUE default_proc_for_compat = 0;
- if (default_proc_for_compat == 0) { /* TODO: it should be */
- default_proc_for_compat = rb_proc_new(default_proc_for_compat_func, Qnil);
- rb_gc_register_mark_object(default_proc_for_compat);
- }
- rb_hash_set_default_proc(hash, default_proc_for_compat);
- }
- }
- else if (SYMBOL_P(hash_or_sym)) {
- key = hash_or_sym;
- }
- else {
- rb_raise(rb_eTypeError, "non-hash or symbol argument");
- }
+ rb_hash_aset(hash, sym_count, SIZET2NUM(objspace->profile.count));
+ /* implementation dependent counters */
+ rb_hash_aset(hash, sym_heap_used, SIZET2NUM(heap_pages_used));
+ rb_hash_aset(hash, sym_heap_final_num, SIZET2NUM(heap_pages_final_num));
-#define SET(name, attr) \
- if (key == gc_stat_symbols[gc_stat_sym_##name]) \
- return attr; \
- else if (hash != Qnil) \
- rb_hash_aset(hash, gc_stat_symbols[gc_stat_sym_##name], SIZET2NUM(attr));
+ rb_hash_aset(hash, sym_heap_length, SIZET2NUM(heap_pages_length));
+ rb_hash_aset(hash, sym_heap_increment, SIZET2NUM(heap_pages_increment));
- again:
- SET(count, objspace->profile.count);
+ rb_hash_aset(hash, sym_heap_live_num, SIZET2NUM(objspace_live_num(objspace)));
+ rb_hash_aset(hash, sym_heap_free_num, SIZET2NUM(objspace_free_num(objspace)));
- /* implementation dependent counters */
- SET(heap_allocated_pages, heap_allocated_pages);
- SET(heap_sorted_length, heap_pages_sorted_length);
- SET(heap_allocatable_pages, heap_allocatable_pages);
- SET(heap_available_slots, objspace_available_slots(objspace));
- SET(heap_live_slots, objspace_live_slots(objspace));
- SET(heap_free_slots, objspace_free_slots(objspace));
- SET(heap_final_slots, heap_pages_final_slots);
- SET(heap_marked_slots, objspace->marked_slots);
- SET(heap_swept_slots, heap_pages_swept_slots);
- SET(heap_eden_pages, heap_eden->page_length);
- SET(heap_tomb_pages, heap_tomb->page_length);
- SET(total_allocated_pages, objspace->profile.total_allocated_pages);
- SET(total_freed_pages, objspace->profile.total_freed_pages);
- SET(total_allocated_objects, objspace->total_allocated_objects);
- SET(total_freed_objects, objspace->profile.total_freed_objects);
- SET(malloc_increase_bytes, malloc_increase);
- SET(malloc_increase_bytes_limit, malloc_limit);
+ rb_hash_aset(hash, sym_total_allocated_object, SIZET2NUM(objspace->profile.total_allocated_object_num));
+ rb_hash_aset(hash, sym_total_freed_object, SIZET2NUM(objspace->profile.total_freed_object_num));
#if USE_RGENGC
- SET(minor_gc_count, objspace->profile.minor_gc_count);
- SET(major_gc_count, objspace->profile.major_gc_count);
- SET(remembered_wb_unprotected_objects, objspace->rgengc.uncollectible_wb_unprotected_objects);
- SET(remembered_wb_unprotected_objects_limit, objspace->rgengc.uncollectible_wb_unprotected_objects_limit);
- SET(old_objects, objspace->rgengc.old_objects);
- SET(old_objects_limit, objspace->rgengc.old_objects_limit);
-#if RGENGC_ESTIMATE_OLDMALLOC
- SET(oldmalloc_increase_bytes, objspace->rgengc.oldmalloc_increase);
- SET(oldmalloc_increase_bytes_limit, objspace->rgengc.oldmalloc_increase_limit);
-#endif
-
+ rb_hash_aset(hash, sym_minor_gc_count, SIZET2NUM(objspace->profile.minor_gc_count));
+ rb_hash_aset(hash, sym_major_gc_count, SIZET2NUM(objspace->profile.major_gc_count));
#if RGENGC_PROFILE
- SET(total_generated_normal_object_count, objspace->profile.total_generated_normal_object_count);
- SET(total_generated_shady_object_count, objspace->profile.total_generated_shady_object_count);
- SET(total_shade_operation_count, objspace->profile.total_shade_operation_count);
- SET(total_promoted_count, objspace->profile.total_promoted_count);
- SET(total_remembered_normal_object_count, objspace->profile.total_remembered_normal_object_count);
- SET(total_remembered_shady_object_count, objspace->profile.total_remembered_shady_object_count);
-#endif /* RGENGC_PROFILE */
-#endif /* USE_RGENGC */
-#undef SET
-
- if (!NIL_P(key)) { /* matched key should return above */
- VALUE new_key;
- if ((new_key = compat_key(key)) != Qnil) {
- key = new_key;
- goto again;
- }
- rb_raise(rb_eArgError, "unknown key: %"PRIsVALUE, rb_sym2str(key));
- }
-
-#if defined(RGENGC_PROFILE) && RGENGC_PROFILE >= 2
- if (hash != Qnil) {
+ rb_hash_aset(hash, sym_generated_normal_object_count, SIZET2NUM(objspace->profile.generated_normal_object_count));
+ rb_hash_aset(hash, sym_generated_shady_object_count, SIZET2NUM(objspace->profile.generated_shady_object_count));
+ rb_hash_aset(hash, sym_shade_operation_count, SIZET2NUM(objspace->profile.shade_operation_count));
+ rb_hash_aset(hash, sym_promote_infant_count, SIZET2NUM(objspace->profile.promote_infant_count));
+#if RGENGC_THREEGEN
+ rb_hash_aset(hash, sym_promote_young_count, SIZET2NUM(objspace->profile.promote_young_count));
+#endif
+ rb_hash_aset(hash, sym_remembered_normal_object_count, SIZET2NUM(objspace->profile.remembered_normal_object_count));
+ rb_hash_aset(hash, sym_remembered_shady_object_count, SIZET2NUM(objspace->profile.remembered_shady_object_count));
+#if RGENGC_PROFILE >= 2
+ {
gc_count_add_each_types(hash, "generated_normal_object_count_types", objspace->profile.generated_normal_object_count_types);
gc_count_add_each_types(hash, "generated_shady_object_count_types", objspace->profile.generated_shady_object_count_types);
gc_count_add_each_types(hash, "shade_operation_count_types", objspace->profile.shade_operation_count_types);
- gc_count_add_each_types(hash, "promoted_types", objspace->profile.promoted_types);
+ gc_count_add_each_types(hash, "promote_infant_types", objspace->profile.promote_infant_types);
+#if RGENGC_THREEGEN
+ gc_count_add_each_types(hash, "promote_young_types", objspace->profile.promote_young_types);
+#endif
gc_count_add_each_types(hash, "remembered_normal_object_count_types", objspace->profile.remembered_normal_object_count_types);
gc_count_add_each_types(hash, "remembered_shady_object_count_types", objspace->profile.remembered_shady_object_count_types);
}
#endif
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
- return 0;
-}
-
-/*
- * call-seq:
- * GC.stat -> Hash
- * GC.stat(hash) -> hash
- * GC.stat(:key) -> Numeric
- *
- * Returns a Hash containing information about the GC.
- *
- * The hash includes information about internal statistics about GC such as:
- *
- * {
- * :count=>0,
- * :heap_allocated_pages=>24,
- * :heap_sorted_length=>24,
- * :heap_allocatable_pages=>0,
- * :heap_available_slots=>9783,
- * :heap_live_slots=>7713,
- * :heap_free_slots=>2070,
- * :heap_final_slots=>0,
- * :heap_marked_slots=>0,
- * :heap_swept_slots=>0,
- * :heap_eden_pages=>24,
- * :heap_tomb_pages=>0,
- * :total_allocated_pages=>24,
- * :total_freed_pages=>0,
- * :total_allocated_objects=>7796,
- * :total_freed_objects=>83,
- * :malloc_increase_bytes=>2389312,
- * :malloc_increase_bytes_limit=>16777216,
- * :minor_gc_count=>0,
- * :major_gc_count=>0,
- * :remembered_wb_unprotected_objects=>0,
- * :remembered_wb_unprotected_objects_limit=>0,
- * :old_objects=>0,
- * :old_objects_limit=>0,
- * :oldmalloc_increase_bytes=>2389760,
- * :oldmalloc_increase_bytes_limit=>16777216
- * }
- *
- * The contents of the hash are implementation specific and may be changed in
- * the future.
- *
- * This method is only expected to work on C Ruby.
- *
- */
-
-static VALUE
-gc_stat(int argc, VALUE *argv, VALUE self)
-{
- VALUE arg = Qnil;
-
- if (rb_scan_args(argc, argv, "01", &arg) == 1) {
- if (SYMBOL_P(arg)) {
- size_t value = gc_stat_internal(arg);
- return SIZET2NUM(value);
- }
- else if (!RB_TYPE_P(arg, T_HASH)) {
- rb_raise(rb_eTypeError, "non-hash or symbol given");
- }
- }
-
- if (arg == Qnil) {
- arg = rb_hash_new();
- }
- gc_stat_internal(arg);
- return arg;
-}
-
-size_t
-rb_gc_stat(VALUE key)
-{
- if (SYMBOL_P(key)) {
- size_t value = gc_stat_internal(key);
- return value;
- }
- else {
- gc_stat_internal(key);
- return 0;
- }
+ return hash;
}
/*
@@ -7091,19 +5153,12 @@ static VALUE
gc_stress_get(VALUE self)
{
rb_objspace_t *objspace = &rb_objspace;
- return ruby_gc_stress_mode;
-}
-
-static void
-gc_stress_set(rb_objspace_t *objspace, VALUE flag)
-{
- objspace->flags.gc_stressful = RTEST(flag);
- objspace->gc_stress_mode = flag;
+ return ruby_gc_stress;
}
/*
* call-seq:
- * GC.stress = flag -> flag
+ * GC.stress = bool -> bool
*
* Updates the GC stress mode.
*
@@ -7111,18 +5166,14 @@ gc_stress_set(rb_objspace_t *objspace, VALUE flag)
* all memory and object allocations.
*
* Enabling stress mode will degrade performance, it is only for debugging.
- *
- * flag can be true, false, or a fixnum bit-ORed following flags.
- * 0x01:: no major GC
- * 0x02:: no immediate sweep
- * 0x04:: full mark after malloc/calloc/realloc
*/
static VALUE
-gc_stress_set_m(VALUE self, VALUE flag)
+gc_stress_set(VALUE self, VALUE flag)
{
rb_objspace_t *objspace = &rb_objspace;
- gc_stress_set(objspace, flag);
+ rb_secure(2);
+ ruby_gc_stress = FIXNUM_P(flag) ? flag : (RTEST(flag) ? Qtrue : Qfalse);
return flag;
}
@@ -7167,65 +5218,27 @@ rb_gc_disable(void)
rb_objspace_t *objspace = &rb_objspace;
int old = dont_gc;
- gc_rest(objspace);
+ gc_rest_sweep(objspace);
dont_gc = TRUE;
return old ? Qtrue : Qfalse;
}
static int
-get_envparam_size(const char *name, size_t *default_value, size_t lower_bound)
+get_envparam_int(const char *name, unsigned int *default_value, int lower_bound)
{
char *ptr = getenv(name);
- ssize_t val;
+ int val;
- if (ptr != NULL && *ptr) {
- size_t unit = 0;
- char *end;
-#if SIZEOF_SIZE_T == SIZEOF_LONG_LONG
- val = strtoll(ptr, &end, 0);
-#else
- val = strtol(ptr, &end, 0);
-#endif
- switch (*end) {
- case 'k': case 'K':
- unit = 1024;
- ++end;
- break;
- case 'm': case 'M':
- unit = 1024*1024;
- ++end;
- break;
- case 'g': case 'G':
- unit = 1024*1024*1024;
- ++end;
- break;
- }
- while (*end && isspace((unsigned char)*end)) end++;
- if (*end) {
- if (RTEST(ruby_verbose)) fprintf(stderr, "invalid string for %s: %s\n", name, ptr);
- return 0;
- }
- if (unit > 0) {
- if (val < -(ssize_t)(SIZE_MAX / 2 / unit) || (ssize_t)(SIZE_MAX / 2 / unit) < val) {
- if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%s is ignored because it overflows\n", name, ptr);
- return 0;
- }
- val *= unit;
- }
- if (val > 0 && (size_t)val > lower_bound) {
- if (RTEST(ruby_verbose)) {
- fprintf(stderr, "%s=%"PRIdSIZE" (default value: %"PRIdSIZE")\n", name, val, *default_value);
- }
- *default_value = (size_t)val;
+ if (ptr != NULL) {
+ val = atoi(ptr);
+ if (val > lower_bound) {
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d)\n", name, val, *default_value);
+ *default_value = val;
return 1;
}
else {
- if (RTEST(ruby_verbose)) {
- fprintf(stderr, "%s=%"PRIdSIZE" (default value: %"PRIdSIZE") is ignored because it must be greater than %"PRIdSIZE".\n",
- name, val, *default_value, lower_bound);
- }
- return 0;
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d), but ignored because lower than %d\n", name, val, *default_value, lower_bound);
}
}
return 0;
@@ -7237,108 +5250,50 @@ get_envparam_double(const char *name, double *default_value, double lower_bound)
char *ptr = getenv(name);
double val;
- if (ptr != NULL && *ptr) {
- char *end;
- val = strtod(ptr, &end);
- if (!*ptr || *end) {
- if (RTEST(ruby_verbose)) fprintf(stderr, "invalid string for %s: %s\n", name, ptr);
- return 0;
- }
+ if (ptr != NULL) {
+ val = strtod(ptr, NULL);
if (val > lower_bound) {
- if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (default value: %f)\n", name, val, *default_value);
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f)\n", name, val, *default_value);
*default_value = val;
return 1;
}
else {
- if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (default value: %f) is ignored because it must be greater than %f.\n", name, val, *default_value, lower_bound);
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f), but ignored because lower than %f\n", name, val, *default_value, lower_bound);
}
}
return 0;
}
-static void
-gc_set_initial_pages(void)
-{
- size_t min_pages;
- rb_objspace_t *objspace = &rb_objspace;
-
- min_pages = gc_params.heap_init_slots / HEAP_OBJ_LIMIT;
- if (min_pages > heap_eden->page_length) {
- heap_add_pages(objspace, heap_eden, min_pages - heap_eden->page_length);
- }
-}
-
-/*
- * GC tuning environment variables
- *
- * * RUBY_GC_HEAP_INIT_SLOTS
- * - Initial allocation slots.
- * * RUBY_GC_HEAP_FREE_SLOTS
- * - Prepare at least this amount of slots after GC.
- * - Allocate slots if there are not enough slots.
- * * RUBY_GC_HEAP_GROWTH_FACTOR (new from 2.1)
- * - Allocate slots by this factor.
- * - (next slots number) = (current slots number) * (this factor)
- * * RUBY_GC_HEAP_GROWTH_MAX_SLOTS (new from 2.1)
- * - Allocation rate is limited to this number of slots.
- * * RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR (new from 2.1.1)
- * - Do full GC when the number of old objects is more than R * N
- * where R is this factor and
- * N is the number of old objects just after last full GC.
- *
- * * obsolete
- * * RUBY_FREE_MIN -> RUBY_GC_HEAP_FREE_SLOTS (from 2.1)
- * * RUBY_HEAP_MIN_SLOTS -> RUBY_GC_HEAP_INIT_SLOTS (from 2.1)
- *
- * * RUBY_GC_MALLOC_LIMIT
- * * RUBY_GC_MALLOC_LIMIT_MAX (new from 2.1)
- * * RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR (new from 2.1)
- *
- * * RUBY_GC_OLDMALLOC_LIMIT (new from 2.1)
- * * RUBY_GC_OLDMALLOC_LIMIT_MAX (new from 2.1)
- * * RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR (new from 2.1)
- */
-
void
-ruby_gc_set_params(int safe_level)
+ruby_gc_set_params(void)
{
- if (safe_level > 0) return;
+ if (rb_safe_level() > 0) return;
- /* RUBY_GC_HEAP_FREE_SLOTS */
- if (get_envparam_size("RUBY_GC_HEAP_FREE_SLOTS", &gc_params.heap_free_slots, 0)) {
- /* ok */
- }
- else if (get_envparam_size("RUBY_FREE_MIN", &gc_params.heap_free_slots, 0)) {
- rb_warn("RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead.");
- }
+ get_envparam_int ("RUBY_FREE_MIN", &gc_params.heap_min_free_slots, 0);
- /* RUBY_GC_HEAP_INIT_SLOTS */
- if (get_envparam_size("RUBY_GC_HEAP_INIT_SLOTS", &gc_params.heap_init_slots, 0)) {
- gc_set_initial_pages();
- }
- else if (get_envparam_size("RUBY_HEAP_MIN_SLOTS", &gc_params.heap_init_slots, 0)) {
- rb_warn("RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.");
- gc_set_initial_pages();
- }
+ get_envparam_double("RUBY_HEAP_SLOTS_GROWTH_FACTOR", &gc_params.growth_factor, 1.0);
+ get_envparam_int ("RUBY_HEAP_SLOTS_GROWTH_MAX", &gc_params.growth_max, 0);
+ if (get_envparam_int("RUBY_HEAP_MIN_SLOTS", &gc_params.heap_min_slots, 0)) {
+ size_t min_size;
+ rb_objspace_t *objspace = &rb_objspace;
- get_envparam_double("RUBY_GC_HEAP_GROWTH_FACTOR", &gc_params.growth_factor, 1.0);
- get_envparam_size ("RUBY_GC_HEAP_GROWTH_MAX_SLOTS", &gc_params.growth_max_slots, 0);
- get_envparam_double("RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR", &gc_params.oldobject_limit_factor, 0.0);
+ min_size = gc_params.heap_min_slots / HEAP_OBJ_LIMIT;
+ if (min_size > heap_eden->used) {
+ heap_add_pages(objspace, heap_eden, min_size - heap_eden->used);
+ }
+ }
- get_envparam_size ("RUBY_GC_MALLOC_LIMIT", &gc_params.malloc_limit_min, 0);
- get_envparam_size ("RUBY_GC_MALLOC_LIMIT_MAX", &gc_params.malloc_limit_max, 0);
+ get_envparam_int("RUBY_GC_MALLOC_LIMIT", &gc_params.malloc_limit_min, 0);
+ get_envparam_int("RUBY_GC_MALLOC_LIMIT_MAX", &gc_params.malloc_limit_max, 0);
get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0);
-#if RGENGC_ESTIMATE_OLDMALLOC
- if (get_envparam_size("RUBY_GC_OLDMALLOC_LIMIT", &gc_params.oldmalloc_limit_min, 0)) {
- rb_objspace_t *objspace = &rb_objspace;
- objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_min;
- }
- get_envparam_size ("RUBY_GC_OLDMALLOC_LIMIT_MAX", &gc_params.oldmalloc_limit_max, 0);
- get_envparam_double("RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR", &gc_params.oldmalloc_limit_growth_factor, 1.0);
-#endif
+ get_envparam_int("RUBY_GC_HEAP_OLDSPACE", &gc_params.oldspace_limit_min, 0);
+ get_envparam_int("RUBY_GC_HEAP_OLDSPACE_MAX", &gc_params.oldspace_limit_max, 0);
+ get_envparam_double("RUBY_GC_HEAP_OLDSPACE_GROWTH_FACTOR", &gc_params.oldspace_limit_growth_factor, 1.0);
}
+RUBY_ALIAS_FUNCTION_VOID(rb_gc_set_params(void), ruby_gc_set_params, ())
+
void
rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data)
{
@@ -7348,9 +5303,9 @@ rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *
struct mark_func_data_struct mfd;
mfd.mark_func = func;
mfd.data = data;
- PUSH_MARK_FUNC_DATA(&mfd);
+ objspace->mark_func_data = &mfd;
gc_mark_children(objspace, obj);
- POP_MARK_FUNC_DATA();
+ objspace->mark_func_data = 0;
}
}
@@ -7380,16 +5335,18 @@ rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE,
mfd.mark_func = root_objects_from;
mfd.data = &data;
- PUSH_MARK_FUNC_DATA(&mfd);
- gc_mark_roots(objspace, &data.category);
- POP_MARK_FUNC_DATA();
+ objspace->mark_func_data = &mfd;
+ {
+ gc_mark_roots(objspace, TRUE, &data.category);
+ }
+ objspace->mark_func_data = 0;
}
/*
------------------------ Extended allocator ------------------------
*/
-static void objspace_xfree(rb_objspace_t *objspace, void *ptr, size_t size);
+static void vm_xfree(rb_objspace_t *objspace, void *ptr, size_t size);
static void *
negative_size_allocation_error_with_gvl(void *ptr)
@@ -7444,10 +5401,6 @@ void
rb_memerror(void)
{
rb_thread_t *th = GET_THREAD();
- rb_objspace_t *objspace = &rb_objspace;
-
- if (during_gc) gc_exit(objspace, "rb_memerror");
-
if (!nomem_error ||
rb_thread_raised_p(th, RAISED_NOMEMORY)) {
fprintf(stderr, "[FATAL] failed to allocate memory\n");
@@ -7469,7 +5422,7 @@ aligned_malloc(size_t alignment, size_t size)
#if defined __MINGW32__
res = __mingw_aligned_malloc(size, alignment);
-#elif defined _WIN32
+#elif defined _WIN32 && !defined __CYGWIN__
void *_aligned_malloc(size_t, size_t);
res = _aligned_malloc(size, alignment);
#elif defined(HAVE_POSIX_MEMALIGN)
@@ -7503,7 +5456,7 @@ aligned_free(void *ptr)
{
#if defined __MINGW32__
__mingw_aligned_free(ptr);
-#elif defined _WIN32
+#elif defined _WIN32 && !defined __CYGWIN__
_aligned_free(ptr);
#elif defined(HAVE_MEMALIGN) || defined(HAVE_POSIX_MEMALIGN)
free(ptr);
@@ -7512,116 +5465,43 @@ aligned_free(void *ptr)
#endif
}
-static inline size_t
-objspace_malloc_size(rb_objspace_t *objspace, void *ptr, size_t hint)
-{
-#ifdef HAVE_MALLOC_USABLE_SIZE
- return malloc_usable_size(ptr);
-#else
- return hint;
-#endif
-}
-
-enum memop_type {
- MEMOP_TYPE_MALLOC = 1,
- MEMOP_TYPE_FREE = 2,
- MEMOP_TYPE_REALLOC = 3
-};
-
-static inline void
-atomic_sub_nounderflow(size_t *var, size_t sub)
-{
- if (sub == 0) return;
-
- while (1) {
- size_t val = *var;
- if (val < sub) sub = val;
- if (ATOMIC_SIZE_CAS(*var, val, val-sub) == val) break;
- }
-}
-
static void
-objspace_malloc_gc_stress(rb_objspace_t *objspace)
-{
- if (ruby_gc_stressful && ruby_native_thread_p()) {
- garbage_collect_with_gvl(objspace, gc_stress_full_mark_after_malloc_p(), TRUE, TRUE, GPR_FLAG_STRESS | GPR_FLAG_MALLOC);
- }
-}
-
-static void
-objspace_malloc_increase(rb_objspace_t *objspace, void *mem, size_t new_size, size_t old_size, enum memop_type type)
+vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, int do_gc)
{
if (new_size > old_size) {
ATOMIC_SIZE_ADD(malloc_increase, new_size - old_size);
-#if RGENGC_ESTIMATE_OLDMALLOC
- ATOMIC_SIZE_ADD(objspace->rgengc.oldmalloc_increase, new_size - old_size);
-#endif
}
else {
- atomic_sub_nounderflow(&malloc_increase, old_size - new_size);
-#if RGENGC_ESTIMATE_OLDMALLOC
- atomic_sub_nounderflow(&objspace->rgengc.oldmalloc_increase, old_size - new_size);
-#endif
- }
-
- if (type == MEMOP_TYPE_MALLOC) {
- retry:
- if (malloc_increase > malloc_limit && ruby_native_thread_p() && !dont_gc) {
- if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) {
- gc_rest(objspace); /* gc_rest can reduce malloc_increase */
- goto retry;
+ size_t sub = old_size - new_size;
+ if (sub != 0) {
+ retry_sub:;
+ {
+ size_t old_increase = malloc_increase;
+ size_t new_increase = old_increase > sub ? old_increase - sub : 0;
+ if (ATOMIC_SIZE_CAS(malloc_increase, old_increase, new_increase) != old_increase) goto retry_sub;
}
- garbage_collect_with_gvl(objspace, FALSE, FALSE, FALSE, GPR_FLAG_MALLOC);
}
}
-#if MALLOC_ALLOCATED_SIZE
- if (new_size >= old_size) {
- ATOMIC_SIZE_ADD(objspace->malloc_params.allocated_size, new_size - old_size);
- }
- else {
- size_t dec_size = old_size - new_size;
- size_t allocated_size = objspace->malloc_params.allocated_size;
-
-#if MALLOC_ALLOCATED_SIZE_CHECK
- if (allocated_size < dec_size) {
- rb_bug("objspace_malloc_increase: underflow malloc_params.allocated_size.");
+ if (do_gc) {
+ if (ruby_gc_stress && !ruby_disable_gc_stress) {
+ garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC);
}
-#endif
- atomic_sub_nounderflow(&objspace->malloc_params.allocated_size, dec_size);
- }
-
- if (0) fprintf(stderr, "increase - ptr: %p, type: %s, new_size: %d, old_size: %d\n",
- mem,
- type == MEMOP_TYPE_MALLOC ? "malloc" :
- type == MEMOP_TYPE_FREE ? "free " :
- type == MEMOP_TYPE_REALLOC ? "realloc": "error",
- (int)new_size, (int)old_size);
-
- switch (type) {
- case MEMOP_TYPE_MALLOC:
- ATOMIC_SIZE_INC(objspace->malloc_params.allocations);
- break;
- case MEMOP_TYPE_FREE:
- {
- size_t allocations = objspace->malloc_params.allocations;
- if (allocations > 0) {
- atomic_sub_nounderflow(&objspace->malloc_params.allocations, 1);
- }
-#if MALLOC_ALLOCATED_SIZE_CHECK
- else {
- if (RGENGC_CHECK_MODE) assert(objspace->malloc_params.allocations > 0);
+ else {
+ retry:
+ if (malloc_increase > malloc_limit) {
+ if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) {
+ gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */
+ goto retry;
+ }
+ garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC);
}
-#endif
}
- break;
- case MEMOP_TYPE_REALLOC: /* ignore */ break;
}
-#endif
}
static inline size_t
-objspace_malloc_prepare(rb_objspace_t *objspace, size_t size)
+vm_malloc_prepare(rb_objspace_t *objspace, size_t size)
{
if ((ssize_t)size < 0) {
negative_size_allocation_error("negative allocation size (or too big)");
@@ -7632,13 +5512,17 @@ objspace_malloc_prepare(rb_objspace_t *objspace, size_t size)
size += sizeof(size_t);
#endif
+ vm_malloc_increase(objspace, size, 0, TRUE);
+
return size;
}
static inline void *
-objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
+vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
{
#if CALC_EXACT_MALLOC_SIZE
+ ATOMIC_SIZE_ADD(objspace->malloc_params.allocated_size, size);
+ ATOMIC_SIZE_INC(objspace->malloc_params.allocations);
((size_t *)mem)[0] = size;
mem = (size_t *)mem + 1;
#endif
@@ -7647,36 +5531,36 @@ objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
}
#define TRY_WITH_GC(alloc) do { \
- objspace_malloc_gc_stress(objspace); \
if (!(alloc) && \
- (!garbage_collect_with_gvl(objspace, TRUE, TRUE, TRUE, GPR_FLAG_MALLOC) || /* full/immediate mark && immediate sweep */ \
+ (!garbage_collect_with_gvl(objspace, 1, 1, GPR_FLAG_MALLOC) || /* full mark && immediate sweep */ \
!(alloc))) { \
ruby_memerror(); \
} \
} while (0)
static void *
-objspace_xmalloc(rb_objspace_t *objspace, size_t size)
+vm_xmalloc(rb_objspace_t *objspace, size_t size)
{
void *mem;
- size = objspace_malloc_prepare(objspace, size);
+ size = vm_malloc_prepare(objspace, size);
TRY_WITH_GC(mem = malloc(size));
- size = objspace_malloc_size(objspace, mem, size);
- objspace_malloc_increase(objspace, mem, size, 0, MEMOP_TYPE_MALLOC);
- return objspace_malloc_fixup(objspace, mem, size);
+ return vm_malloc_fixup(objspace, mem, size);
}
static void *
-objspace_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
+vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
{
void *mem;
+#if CALC_EXACT_MALLOC_SIZE
+ size_t cem_oldsize;
+#endif
if ((ssize_t)new_size < 0) {
negative_size_allocation_error("negative re-allocation size");
}
- if (!ptr) return objspace_xmalloc(objspace, new_size);
+ if (!ptr) return vm_xmalloc(objspace, new_size);
/*
* The behavior of realloc(ptr, 0) is implementation defined.
@@ -7684,94 +5568,109 @@ objspace_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t ol
* see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm
*/
if (new_size == 0) {
- objspace_xfree(objspace, ptr, old_size);
+ vm_xfree(objspace, ptr, old_size);
return 0;
}
+#ifdef HAVE_MALLOC_USABLE_SIZE
+ old_size = malloc_usable_size(ptr);
+#endif
+
+ vm_malloc_increase(objspace, new_size, old_size, FALSE);
+
#if CALC_EXACT_MALLOC_SIZE
new_size += sizeof(size_t);
ptr = (size_t *)ptr - 1;
- old_size = ((size_t *)ptr)[0];
+ cem_oldsize = ((size_t *)ptr)[0];
+
+ if (CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE && old_size > 0 && cem_oldsize - sizeof(size_t) != old_size) {
+ fprintf(stderr, "vm_xrealloc: old_size mismatch: expected %d, but %d\n", (int)(cem_oldsize-sizeof(size_t)), (int)old_size);
+ }
#endif
- old_size = objspace_malloc_size(objspace, ptr, old_size);
TRY_WITH_GC(mem = realloc(ptr, new_size));
- new_size = objspace_malloc_size(objspace, mem, new_size);
#if CALC_EXACT_MALLOC_SIZE
+ ATOMIC_SIZE_ADD(objspace->malloc_params.allocated_size, new_size - cem_oldsize);
((size_t *)mem)[0] = new_size;
mem = (size_t *)mem + 1;
#endif
- objspace_malloc_increase(objspace, mem, new_size, old_size, MEMOP_TYPE_REALLOC);
-
return mem;
}
static void
-objspace_xfree(rb_objspace_t *objspace, void *ptr, size_t old_size)
+vm_xfree(rb_objspace_t *objspace, void *ptr, size_t old_size)
{
#if CALC_EXACT_MALLOC_SIZE
+ size_t cem_oldsize;
ptr = ((size_t *)ptr) - 1;
- old_size = ((size_t*)ptr)[0];
+ cem_oldsize = ((size_t*)ptr)[0];
+ if (cem_oldsize) {
+ ATOMIC_SIZE_SUB(objspace->malloc_params.allocated_size, cem_oldsize);
+ ATOMIC_SIZE_DEC(objspace->malloc_params.allocations);
+ }
#endif
- old_size = objspace_malloc_size(objspace, ptr, old_size);
- free(ptr);
+#ifdef HAVE_MALLOC_USABLE_SIZE
+ old_size = malloc_usable_size(ptr);
+#endif
- objspace_malloc_increase(objspace, ptr, 0, old_size, MEMOP_TYPE_FREE);
+#if CALC_EXACT_MALLOC_SIZE
+ if (CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE && old_size > 0 && cem_oldsize - sizeof(size_t) != old_size) {
+ fprintf(stderr, "vm_xfree: old_size mismatch: expected %d, but %d\n", (int)(cem_oldsize-sizeof(size_t)), (int)old_size);
+ }
+#endif
+ vm_malloc_increase(objspace, 0, old_size, FALSE);
+
+ free(ptr);
}
void *
ruby_xmalloc(size_t size)
{
- return objspace_xmalloc(&rb_objspace, size);
+ return vm_xmalloc(&rb_objspace, size);
}
-void
-ruby_malloc_size_overflow(size_t count, size_t elsize)
+static inline size_t
+xmalloc2_size(size_t n, size_t size)
{
- rb_raise(rb_eArgError,
- "malloc: possible integer overflow (%"PRIdSIZE"*%"PRIdSIZE")",
- count, elsize);
+ size_t len = size * n;
+ if (n != 0 && size != len / n) {
+ rb_raise(rb_eArgError, "malloc: possible integer overflow");
+ }
+ return len;
}
-#define xmalloc2_size ruby_xmalloc2_size
-
void *
ruby_xmalloc2(size_t n, size_t size)
{
- return objspace_xmalloc(&rb_objspace, xmalloc2_size(n, size));
+ return vm_xmalloc(&rb_objspace, xmalloc2_size(n, size));
}
static void *
-objspace_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
+vm_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
{
void *mem;
size_t size;
size = xmalloc2_size(count, elsize);
- size = objspace_malloc_prepare(objspace, size);
+ size = vm_malloc_prepare(objspace, size);
TRY_WITH_GC(mem = calloc(1, size));
- size = objspace_malloc_size(objspace, mem, size);
- objspace_malloc_increase(objspace, mem, size, 0, MEMOP_TYPE_MALLOC);
- return objspace_malloc_fixup(objspace, mem, size);
+ return vm_malloc_fixup(objspace, mem, size);
}
void *
ruby_xcalloc(size_t n, size_t size)
{
- return objspace_xcalloc(&rb_objspace, n, size);
+ return vm_xcalloc(&rb_objspace, n, size);
}
-#ifdef ruby_sized_xrealloc
-#undef ruby_sized_xrealloc
-#endif
void *
ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size)
{
- return objspace_xrealloc(&rb_objspace, ptr, new_size, old_size);
+ return vm_xrealloc(&rb_objspace, ptr, new_size, old_size);
}
void *
@@ -7780,33 +5679,21 @@ ruby_xrealloc(void *ptr, size_t new_size)
return ruby_sized_xrealloc(ptr, new_size, 0);
}
-#ifdef ruby_sized_xrealloc2
-#undef ruby_sized_xrealloc2
-#endif
void *
-ruby_sized_xrealloc2(void *ptr, size_t n, size_t size, size_t old_n)
+ruby_xrealloc2(void *ptr, size_t n, size_t size)
{
size_t len = size * n;
if (n != 0 && size != len / n) {
rb_raise(rb_eArgError, "realloc: possible integer overflow");
}
- return objspace_xrealloc(&rb_objspace, ptr, len, old_n * size);
+ return ruby_xrealloc(ptr, len);
}
-void *
-ruby_xrealloc2(void *ptr, size_t n, size_t size)
-{
- return ruby_sized_xrealloc2(ptr, n, size, 0);
-}
-
-#ifdef ruby_sized_xfree
-#undef ruby_sized_xfree
-#endif
void
ruby_sized_xfree(void *x, size_t size)
{
if (x) {
- objspace_xfree(&rb_objspace, x, size);
+ vm_xfree(&rb_objspace, x, size);
}
}
@@ -7845,37 +5732,7 @@ ruby_mimfree(void *ptr)
free(mem);
}
-void *
-rb_alloc_tmp_buffer(volatile VALUE *store, long len)
-{
- NODE *s;
- long cnt;
- void *ptr;
-
- if (len < 0 || (cnt = (long)roomof(len, sizeof(VALUE))) < 0) {
- rb_raise(rb_eArgError, "negative buffer size (or size too big)");
- }
-
- s = rb_node_newnode(NODE_ALLOCA, 0, 0, 0);
- ptr = ruby_xmalloc(cnt * sizeof(VALUE));
- s->u1.value = (VALUE)ptr;
- s->u3.cnt = cnt;
- *store = (VALUE)s;
- return ptr;
-}
-
-void
-rb_free_tmp_buffer(volatile VALUE *store)
-{
- VALUE s = ATOMIC_VALUE_EXCHANGE(*store, 0);
- if (s) {
- void *ptr = ATOMIC_PTR_EXCHANGE(RNODE(s)->u1.node, 0);
- RNODE(s)->u3.cnt = 0;
- ruby_xfree(ptr);
- }
-}
-
-#if MALLOC_ALLOCATED_SIZE
+#if CALC_EXACT_MALLOC_SIZE
/*
* call-seq:
* GC.malloc_allocated_size -> Integer
@@ -7917,34 +5774,28 @@ struct weakmap {
VALUE final;
};
-#define WMAP_DELETE_DEAD_OBJECT_IN_MARK 0
-
-#if WMAP_DELETE_DEAD_OBJECT_IN_MARK
static int
wmap_mark_map(st_data_t key, st_data_t val, st_data_t arg)
{
rb_objspace_t *objspace = (rb_objspace_t *)arg;
VALUE obj = (VALUE)val;
if (!is_live_object(objspace, obj)) return ST_DELETE;
+ gc_mark_ptr(objspace, obj);
return ST_CONTINUE;
}
-#endif
static void
wmap_mark(void *ptr)
{
struct weakmap *w = ptr;
-#if WMAP_DELETE_DEAD_OBJECT_IN_MARK
if (w->obj2wmap) st_foreach(w->obj2wmap, wmap_mark_map, (st_data_t)&rb_objspace);
-#endif
rb_gc_mark(w->final);
}
static int
wmap_free_map(st_data_t key, st_data_t val, st_data_t arg)
{
- VALUE *ptr = (VALUE *)val;
- ruby_sized_xfree(ptr, (ptr[0] + 1) * sizeof(VALUE));
+ rb_ary_resize((VALUE)val, 0);
return ST_CONTINUE;
}
@@ -7957,11 +5808,11 @@ wmap_free(void *ptr)
st_free_table(w->wmap2obj);
}
+size_t rb_ary_memsize(VALUE ary);
static int
wmap_memsize_map(st_data_t key, st_data_t val, st_data_t arg)
{
- VALUE *ptr = (VALUE *)val;
- *(size_t *)arg += (ptr[0] + 1) * sizeof(VALUE);
+ *(size_t *)arg += rb_ary_memsize((VALUE)val);
return ST_CONTINUE;
}
@@ -7970,6 +5821,7 @@ wmap_memsize(const void *ptr)
{
size_t size;
const struct weakmap *w = ptr;
+ if (!w) return 0;
size = sizeof(*w);
size += st_memsize(w->obj2wmap);
size += st_memsize(w->wmap2obj);
@@ -7984,7 +5836,7 @@ static const rb_data_type_t weakmap_type = {
wmap_free,
wmap_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -8001,23 +5853,11 @@ wmap_allocate(VALUE klass)
static int
wmap_final_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
{
- VALUE wmap, *ptr, size, i, j;
+ VALUE wmap, ary;
if (!existing) return ST_STOP;
- wmap = (VALUE)arg, ptr = (VALUE *)*value;
- for (i = j = 1, size = ptr[0]; i <= size; ++i) {
- if (ptr[i] != wmap) {
- ptr[j++] = ptr[i];
- }
- }
- if (j == 1) {
- ruby_sized_xfree(ptr, i * sizeof(VALUE));
- return ST_DELETE;
- }
- if (j < i) {
- ptr = ruby_sized_xrealloc2(ptr, j + 1, sizeof(VALUE), i);
- ptr[0] = j;
- *value = (st_data_t)ptr;
- }
+ wmap = (VALUE)arg, ary = (VALUE)*value;
+ rb_ary_delete_same(ary, wmap);
+ if (!RARRAY_LEN(ary)) return ST_DELETE;
return ST_CONTINUE;
}
@@ -8025,7 +5865,8 @@ static VALUE
wmap_finalize(VALUE self, VALUE objid)
{
st_data_t orig, wmap, data;
- VALUE obj, *rids, i, size;
+ VALUE obj, rids;
+ long i;
struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
@@ -8035,13 +5876,11 @@ wmap_finalize(VALUE self, VALUE objid)
/* obj is original referenced object and/or weak reference. */
orig = (st_data_t)obj;
if (st_delete(w->obj2wmap, &orig, &data)) {
- rids = (VALUE *)data;
- size = *rids++;
- for (i = 0; i < size; ++i) {
- wmap = (st_data_t)rids[i];
+ rids = (VALUE)data;
+ for (i = 0; i < RARRAY_LEN(rids); ++i) {
+ wmap = (st_data_t)RARRAY_AREF(rids, i);
st_delete(w->wmap2obj, &wmap, NULL);
}
- ruby_sized_xfree((VALUE *)data, (size + 1) * sizeof(VALUE));
}
wmap = (st_data_t)obj;
@@ -8090,8 +5929,8 @@ wmap_inspect(VALUE self)
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
str = rb_sprintf("-<%"PRIsVALUE":%p", c, (void *)self);
- if (w->wmap2obj) {
- st_foreach(w->wmap2obj, wmap_inspect_i, str);
+ if (w->obj2wmap) {
+ st_foreach(w->obj2wmap, wmap_inspect_i, str);
}
RSTRING_PTR(str)[0] = '#';
rb_str_cat2(str, ">");
@@ -8170,13 +6009,7 @@ wmap_each_value(VALUE self)
static int
wmap_keys_i(st_data_t key, st_data_t val, st_data_t arg)
{
- struct wmap_iter_arg *argp = (struct wmap_iter_arg *)arg;
- rb_objspace_t *objspace = argp->objspace;
- VALUE ary = argp->value;
- VALUE obj = (VALUE)val;
- if (is_id_value(objspace, obj) && is_live_object(objspace, obj)) {
- rb_ary_push(ary, (VALUE)key);
- }
+ rb_ary_push((VALUE)arg, (VALUE)key);
return ST_CONTINUE;
}
@@ -8185,13 +6018,12 @@ static VALUE
wmap_keys(VALUE self)
{
struct weakmap *w;
- struct wmap_iter_arg args;
+ VALUE ary;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
- args.objspace = &rb_objspace;
- args.value = rb_ary_new();
- st_foreach(w->wmap2obj, wmap_keys_i, (st_data_t)&args);
- return args.value;
+ ary = rb_ary_new();
+ st_foreach(w->wmap2obj, wmap_keys_i, (st_data_t)ary);
+ return ary;
}
static int
@@ -8221,39 +6053,25 @@ wmap_values(VALUE self)
return args.value;
}
-static int
-wmap_aset_update(st_data_t *key, st_data_t *val, st_data_t arg, int existing)
-{
- VALUE size, *ptr, *optr;
- if (existing) {
- size = (ptr = optr = (VALUE *)*val)[0];
- ++size;
- ptr = ruby_sized_xrealloc2(ptr, size + 1, sizeof(VALUE), size);
- }
- else {
- optr = 0;
- size = 1;
- ptr = ruby_xmalloc2(2, sizeof(VALUE));
- }
- ptr[0] = size;
- ptr[size] = (VALUE)arg;
- if (ptr == optr) return ST_STOP;
- *val = (st_data_t)ptr;
- return ST_CONTINUE;
-}
-
/* Creates a weak reference from the given key to the given value */
static VALUE
wmap_aset(VALUE self, VALUE wmap, VALUE orig)
{
+ st_data_t data;
+ VALUE rids;
struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
- should_be_finalizable(orig);
- should_be_finalizable(wmap);
- define_final0(orig, w->final);
- define_final0(wmap, w->final);
- st_update(w->obj2wmap, (st_data_t)orig, wmap_aset_update, wmap);
+ rb_define_finalizer(orig, w->final);
+ rb_define_finalizer(wmap, w->final);
+ if (st_lookup(w->obj2wmap, (st_data_t)orig, &data)) {
+ rids = (VALUE)data;
+ }
+ else {
+ rids = rb_ary_tmp_new(1);
+ st_insert(w->obj2wmap, (st_data_t)orig, (st_data_t)rids);
+ }
+ rb_ary_push(rids, wmap);
st_insert(w->wmap2obj, (st_data_t)wmap, (st_data_t)orig);
return nonspecial_obj_id(orig);
}
@@ -8282,20 +6100,6 @@ wmap_has_key(VALUE self, VALUE key)
return NIL_P(wmap_aref(self, key)) ? Qfalse : Qtrue;
}
-static VALUE
-wmap_size(VALUE self)
-{
- struct weakmap *w;
- st_index_t n;
-
- TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
- n = w->wmap2obj->num_entries;
-#if SIZEOF_ST_INDEX_T <= SIZEOF_LONG
- return ULONG2NUM(n);
-#else
- return ULL2NUM(n);
-#endif
-}
/*
------------------------------ GC profiler ------------------------------
@@ -8303,7 +6107,6 @@ wmap_size(VALUE self)
#define GC_PROFILE_RECORD_DEFAULT_SIZE 100
-/* return sec in user time */
static double
getrusage_time(void)
{
@@ -8333,25 +6136,25 @@ getrusage_time(void)
#ifdef _WIN32
{
- FILETIME creation_time, exit_time, kernel_time, user_time;
- ULARGE_INTEGER ui;
- LONG_LONG q;
- double t;
-
- if (GetProcessTimes(GetCurrentProcess(),
- &creation_time, &exit_time, &kernel_time, &user_time) != 0) {
- memcpy(&ui, &user_time, sizeof(FILETIME));
- q = ui.QuadPart / 10L;
- t = (DWORD)(q % 1000000L) * 1e-6;
- q /= 1000000L;
+ FILETIME creation_time, exit_time, kernel_time, user_time;
+ ULARGE_INTEGER ui;
+ LONG_LONG q;
+ double t;
+
+ if (GetProcessTimes(GetCurrentProcess(),
+ &creation_time, &exit_time, &kernel_time, &user_time) != 0) {
+ memcpy(&ui, &user_time, sizeof(FILETIME));
+ q = ui.QuadPart / 10L;
+ t = (DWORD)(q % 1000000L) * 1e-6;
+ q /= 1000000L;
#ifdef __GNUC__
- t += q;
+ t += q;
#else
- t += (double)(DWORD)(q >> 16) * (1 << 16);
- t += (DWORD)q & ~(~0 << 16);
+ t += (double)(DWORD)(q >> 16) * (1 << 16);
+ t += (DWORD)q & ~(~0 << 16);
#endif
- return t;
- }
+ return t;
+ }
}
#endif
@@ -8383,8 +6186,8 @@ gc_prof_setup_new_record(rb_objspace_t *objspace, int reason)
MEMZERO(record, gc_profile_record, 1);
/* setup before-GC parameter */
- record->flags = reason | (ruby_gc_stressful ? GPR_FLAG_STRESS : 0);
-#if MALLOC_ALLOCATED_SIZE
+ record->flags = reason | ((ruby_gc_stress && !ruby_disable_gc_stress) ? GPR_FLAG_STRESS : 0);
+#if CALC_EXACT_MALLOC_SIZE
record->allocated_size = malloc_allocated_size;
#endif
#if GC_PROFILE_DETAIL_MEMORY
@@ -8405,7 +6208,7 @@ gc_prof_setup_new_record(rb_objspace_t *objspace, int reason)
static inline void
gc_prof_timer_start(rb_objspace_t *objspace)
{
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
#if GC_PROFILE_MORE_DETAIL
record->prepare_time = objspace->profile.prepare_time;
@@ -8430,21 +6233,21 @@ elapsed_time_from(double time)
static inline void
gc_prof_timer_stop(rb_objspace_t *objspace)
{
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
record->gc_time = elapsed_time_from(record->gc_invoke_time);
record->gc_invoke_time -= objspace->profile.invoke_time;
}
}
-#define RUBY_DTRACE_GC_HOOK(name) \
- do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)
static inline void
gc_prof_mark_timer_start(rb_objspace_t *objspace)
{
- RUBY_DTRACE_GC_HOOK(MARK_BEGIN);
+ if (RUBY_DTRACE_GC_MARK_BEGIN_ENABLED()) {
+ RUBY_DTRACE_GC_MARK_BEGIN();
+ }
#if GC_PROFILE_MORE_DETAIL
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_prof_record(objspace)->gc_mark_time = getrusage_time();
}
#endif
@@ -8453,9 +6256,11 @@ gc_prof_mark_timer_start(rb_objspace_t *objspace)
static inline void
gc_prof_mark_timer_stop(rb_objspace_t *objspace)
{
- RUBY_DTRACE_GC_HOOK(MARK_END);
+ if (RUBY_DTRACE_GC_MARK_END_ENABLED()) {
+ RUBY_DTRACE_GC_MARK_END();
+ }
#if GC_PROFILE_MORE_DETAIL
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
record->gc_mark_time = elapsed_time_from(record->gc_mark_time);
}
@@ -8465,8 +6270,10 @@ gc_prof_mark_timer_stop(rb_objspace_t *objspace)
static inline void
gc_prof_sweep_timer_start(rb_objspace_t *objspace)
{
- RUBY_DTRACE_GC_HOOK(SWEEP_BEGIN);
- if (gc_prof_enabled(objspace)) {
+ if (RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED()) {
+ RUBY_DTRACE_GC_SWEEP_BEGIN();
+ }
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
if (record->gc_time > 0 || GC_PROFILE_MORE_DETAIL) {
@@ -8478,9 +6285,11 @@ gc_prof_sweep_timer_start(rb_objspace_t *objspace)
static inline void
gc_prof_sweep_timer_stop(rb_objspace_t *objspace)
{
- RUBY_DTRACE_GC_HOOK(SWEEP_END);
+ if (RUBY_DTRACE_GC_SWEEP_END_ENABLED()) {
+ RUBY_DTRACE_GC_SWEEP_END();
+ }
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
double sweep_time;
gc_profile_record *record = gc_prof_record(objspace);
@@ -8497,7 +6306,6 @@ gc_prof_sweep_timer_stop(rb_objspace_t *objspace)
record->gc_sweep_time += sweep_time;
if (heap_pages_deferred_final) record->flags |= GPR_FLAG_HAVE_FINALIZE;
#endif
- if (heap_pages_deferred_final) objspace->profile.latest_gc_info |= GPR_FLAG_HAVE_FINALIZE;
}
}
@@ -8505,7 +6313,7 @@ static inline void
gc_prof_set_malloc_info(rb_objspace_t *objspace)
{
#if GC_PROFILE_MORE_DETAIL
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
record->allocate_increase = malloc_increase;
record->allocate_limit = malloc_limit;
@@ -8516,9 +6324,9 @@ gc_prof_set_malloc_info(rb_objspace_t *objspace)
static inline void
gc_prof_set_heap_info(rb_objspace_t *objspace)
{
- if (gc_prof_enabled(objspace)) {
+ if (objspace->profile.run) {
gc_profile_record *record = gc_prof_record(objspace);
- size_t live = objspace->profile.total_allocated_objects_at_gc_start - objspace->profile.total_freed_objects;
+ size_t live = objspace->profile.total_allocated_object_num_at_gc_start - objspace->profile.total_freed_object_num;
size_t total = objspace->profile.heap_used_at_gc_start * HEAP_OBJ_LIMIT;
#if GC_PROFILE_MORE_DETAIL
@@ -8545,6 +6353,12 @@ static VALUE
gc_profile_clear(void)
{
rb_objspace_t *objspace = &rb_objspace;
+
+ /* This method doesn't change profile.run status.
+ * While lazy sweeping, it is possible to touch zero-cleared profile.current_record.
+ */
+ gc_rest_sweep(objspace);
+
if (GC_PROFILE_RECORD_DEFAULT_SIZE * 2 < objspace->profile.size) {
objspace->profile.size = GC_PROFILE_RECORD_DEFAULT_SIZE * 2;
objspace->profile.records = realloc(objspace->profile.records, sizeof(gc_profile_record) * objspace->profile.size);
@@ -8558,6 +6372,19 @@ gc_profile_clear(void)
return Qnil;
}
+static VALUE
+gc_profile_flags(int flags)
+{
+ VALUE result = rb_ary_new();
+ rb_ary_push(result, ID2SYM(rb_intern(flags & GPR_FLAG_MAJOR_MASK ? "major_gc" : "minor_gc")));
+ if (flags & GPR_FLAG_HAVE_FINALIZE) rb_ary_push(result, ID2SYM(rb_intern("HAVE_FINALIZE")));
+ if (flags & GPR_FLAG_NEWOBJ) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_NEWOBJ")));
+ if (flags & GPR_FLAG_MALLOC) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_MALLOC")));
+ if (flags & GPR_FLAG_METHOD) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_METHOD")));
+ if (flags & GPR_FLAG_STRESS) rb_ary_push(result, ID2SYM(rb_intern("CAUSED_BY_STRESS")));
+ return result;
+}
+
/*
* call-seq:
* GC::Profiler.raw_data -> [Hash, ...]
@@ -8624,7 +6451,7 @@ gc_profile_record_get(void)
gc_profile_record *record = &objspace->profile.records[i];
prof = rb_hash_new();
- rb_hash_aset(prof, ID2SYM(rb_intern("GC_FLAGS")), gc_info_decode(0, rb_hash_new(), record->flags));
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_FLAGS")), gc_profile_flags(record->flags));
rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DBL2NUM(record->gc_time));
rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DBL2NUM(record->gc_invoke_time));
rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SIZE")), SIZET2NUM(record->heap_use_size));
@@ -8648,8 +6475,8 @@ gc_profile_record_get(void)
#if RGENGC_PROFILE > 0
rb_hash_aset(prof, ID2SYM(rb_intern("OLD_OBJECTS")), SIZET2NUM(record->old_objects));
- rb_hash_aset(prof, ID2SYM(rb_intern("REMEMBERED_NORMAL_OBJECTS")), SIZET2NUM(record->remembered_normal_objects));
- rb_hash_aset(prof, ID2SYM(rb_intern("REMEMBERED_SHADY_OBJECTS")), SIZET2NUM(record->remembered_shady_objects));
+ rb_hash_aset(prof, ID2SYM(rb_intern("REMEMBED_NORMAL_OBJECTS")), SIZET2NUM(record->remembered_normal_objects));
+ rb_hash_aset(prof, ID2SYM(rb_intern("REMEMBED_SHADY_OBJECTS")), SIZET2NUM(record->remembered_shady_objects));
#endif
rb_ary_push(gc_profile, prof);
}
@@ -8657,48 +6484,11 @@ gc_profile_record_get(void)
return gc_profile;
}
-#if GC_PROFILE_MORE_DETAIL
-#define MAJOR_REASON_MAX 0x10
-
-static char *
-gc_profile_dump_major_reason(int flags, char *buff)
-{
- int reason = flags & GPR_FLAG_MAJOR_MASK;
- int i = 0;
-
- if (reason == GPR_FLAG_NONE) {
- buff[0] = '-';
- buff[1] = 0;
- }
- else {
-#define C(x, s) \
- if (reason & GPR_FLAG_MAJOR_BY_##x) { \
- buff[i++] = #x[0]; \
- if (i >= MAJOR_REASON_MAX) rb_bug("gc_profile_dump_major_reason: overflow"); \
- buff[i] = 0; \
- }
- C(NOFREE, N);
- C(OLDGEN, O);
- C(SHADY, S);
- C(RESCAN, R);
- C(STRESS, T);
-#if RGENGC_ESTIMATE_OLDMALLOC
- C(OLDMALLOC, M);
-#endif
-#undef C
- }
- return buff;
-}
-#endif
-
static void
gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
{
rb_objspace_t *objspace = &rb_objspace;
size_t count = objspace->profile.next_index;
-#ifdef MAJOR_REASON_MAX
- char reason_str[MAJOR_REASON_MAX];
-#endif
if (objspace->profile.run && count /* > 1 */) {
size_t i;
@@ -8718,7 +6508,7 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
append(out, rb_str_new_cstr("\n\n" \
"More detail.\n" \
"Prepare Time = Previously GC's rest sweep time\n"
- "Index Flags Allocate Inc. Allocate Limit"
+ "Index Flags Allocate Inc. Allocate Limit"
#if CALC_EXACT_MALLOC_SIZE
" Allocated Size"
#endif
@@ -8733,7 +6523,7 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
for (i = 0; i < count; i++) {
record = &objspace->profile.records[i];
- append(out, rb_sprintf("%5"PRIdSIZE" %4s/%c/%6s%c %13"PRIuSIZE" %15"PRIuSIZE
+ append(out, rb_sprintf("%5"PRIdSIZE" %c/%c/%6s%c %13"PRIuSIZE" %15"PRIuSIZE
#if CALC_EXACT_MALLOC_SIZE
" %15"PRIuSIZE
#endif
@@ -8747,7 +6537,7 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
"\n",
i+1,
- gc_profile_dump_major_reason(record->flags, reason_str),
+ "-+O3S567R9abcdef!"[record->flags & GPR_FLAG_MAJOR_MASK], /* Stress,Rescan,Shady,Oldgen,NoFree */
(record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',
(record->flags & GPR_FLAG_NEWOBJ) ? "NEWOBJ" :
(record->flags & GPR_FLAG_MALLOC) ? "MALLOC" :
@@ -8880,8 +6670,8 @@ static VALUE
gc_profile_enable(void)
{
rb_objspace_t *objspace = &rb_objspace;
+ gc_rest_sweep(objspace);
objspace->profile.run = TRUE;
- objspace->profile.current_record = 0;
return Qnil;
}
@@ -8933,7 +6723,6 @@ type_name(int type, VALUE obj)
TYPE_NAME(T_SYMBOL);
TYPE_NAME(T_FIXNUM);
TYPE_NAME(T_UNDEF);
- TYPE_NAME(T_IMEMO);
TYPE_NAME(T_NODE);
TYPE_NAME(T_ICLASS);
TYPE_NAME(T_ZOMBIE);
@@ -8953,203 +6742,6 @@ obj_type_name(VALUE obj)
return type_name(TYPE(obj), obj);
}
-static const char *
-method_type_name(rb_method_type_t type)
-{
- switch (type) {
- case VM_METHOD_TYPE_ISEQ: return "iseq";
- case VM_METHOD_TYPE_ATTRSET: return "attrest";
- case VM_METHOD_TYPE_IVAR: return "ivar";
- case VM_METHOD_TYPE_BMETHOD: return "bmethod";
- case VM_METHOD_TYPE_ALIAS: return "alias";
- case VM_METHOD_TYPE_REFINED: return "refined";
- case VM_METHOD_TYPE_CFUNC: return "cfunc";
- case VM_METHOD_TYPE_ZSUPER: return "zsuper";
- case VM_METHOD_TYPE_MISSING: return "missing";
- case VM_METHOD_TYPE_OPTIMIZED: return "optimized";
- case VM_METHOD_TYPE_UNDEF: return "undef";
- case VM_METHOD_TYPE_NOTIMPLEMENTED: return "notimplemented";
- }
- rb_bug("method_type_name: unreachable (type: %d)", type);
-}
-
-/* from array.c */
-# define ARY_SHARED_P(ary) \
- (assert(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
- FL_TEST((ary),ELTS_SHARED)!=0)
-# define ARY_EMBED_P(ary) \
- (assert(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
- FL_TEST((ary), RARRAY_EMBED_FLAG)!=0)
-
-const char *
-rb_raw_obj_info(char *buff, const int buff_size, VALUE obj)
-{
- if (SPECIAL_CONST_P(obj)) {
- snprintf(buff, buff_size, "%s", obj_type_name(obj));
- }
- else {
-#define TF(c) ((c) != 0 ? "true" : "false")
-#define C(c, s) ((c) != 0 ? (s) : " ")
- const int type = BUILTIN_TYPE(obj);
-#if USE_RGENGC
- const int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
-
- snprintf(buff, buff_size, "%p [%d%s%s%s%s] %s",
- (void *)obj, age,
- C(RVALUE_UNCOLLECTIBLE_BITMAP(obj), "L"),
- C(RVALUE_MARK_BITMAP(obj), "M"),
- C(RVALUE_MARKING_BITMAP(obj), "R"),
- C(RVALUE_WB_UNPROTECTED_BITMAP(obj), "U"),
- obj_type_name(obj));
-#else
- snprintf(buff, buff_size, "%p [%s] %s",
- (void *)obj,
- C(RVALUE_MARK_BITMAP(obj), "M"),
- obj_type_name(obj));
-#endif
-
- if (internal_object_p(obj)) {
- /* ignore */
- }
- else if (RBASIC(obj)->klass == 0) {
- snprintf(buff, buff_size, "%s (temporary internal)", buff);
- }
- else {
- VALUE class_path = rb_class_path_cached(RBASIC(obj)->klass);
- if (!NIL_P(class_path)) {
- snprintf(buff, buff_size, "%s (%s)", buff, RSTRING_PTR(class_path));
- }
- }
-
-#if GC_DEBUG
- snprintf(buff, buff_size, "%s @%s:%d", buff, RANY(obj)->file, RANY(obj)->line);
-#endif
-
- switch (type) {
- case T_NODE:
- snprintf(buff, buff_size, "%s (%s)", buff,
- ruby_node_name(nd_type(obj)));
- break;
- case T_ARRAY:
- snprintf(buff, buff_size, "%s [%s%s] len: %d", buff,
- C(ARY_EMBED_P(obj), "E"),
- C(ARY_SHARED_P(obj), "S"),
- (int)RARRAY_LEN(obj));
- break;
- case T_STRING: {
- snprintf(buff, buff_size, "%s %s", buff, RSTRING_PTR(obj));
- break;
- }
- case T_CLASS: {
- VALUE class_path = rb_class_path_cached(obj);
- if (!NIL_P(class_path)) {
- snprintf(buff, buff_size, "%s %s", buff, RSTRING_PTR(class_path));
- }
- break;
- }
- case T_DATA: {
- const char * const type_name = rb_objspace_data_type_name(obj);
- if (type_name) {
- snprintf(buff, buff_size, "%s %s", buff, type_name);
- }
- break;
- }
- case T_IMEMO: {
- const char *imemo_name;
- switch (imemo_type(obj)) {
-#define IMEMO_NAME(x) case imemo_##x: imemo_name = #x; break;
- IMEMO_NAME(none);
- IMEMO_NAME(cref);
- IMEMO_NAME(svar);
- IMEMO_NAME(throw_data);
- IMEMO_NAME(ifunc);
- IMEMO_NAME(memo);
- IMEMO_NAME(ment);
- IMEMO_NAME(iseq);
- default: rb_bug("unknown IMEMO");
-#undef IMEMO_NAME
- }
- snprintf(buff, buff_size, "%s %s", buff, imemo_name);
-
- switch (imemo_type(obj)) {
- case imemo_ment: {
- const rb_method_entry_t *me = &RANY(obj)->as.imemo.ment;
- snprintf(buff, buff_size, "%s (called_id: %s, type: %s, alias: %d, owner: %s, defined_class: %s)", buff,
- rb_id2name(me->called_id),
- method_type_name(me->def->type),
- me->def->alias_count,
- obj_info(me->owner),
- obj_info(me->defined_class));
- break;
- }
- case imemo_iseq: {
- const rb_iseq_t *iseq = (const rb_iseq_t *)obj;
-
- if (iseq->body->location.label) {
- snprintf(buff, buff_size, "%s %s@%s:%d", buff,
- RSTRING_PTR(iseq->body->location.label),
- RSTRING_PTR(iseq->body->location.path),
- FIX2INT(iseq->body->location.first_lineno));
- }
- break;
- }
- default:
- break;
- }
- }
- default:
- break;
- }
-#undef TF
-#undef C
- }
- return buff;
-}
-
-#if RGENGC_OBJ_INFO
-#define OBJ_INFO_BUFFERS_NUM 10
-#define OBJ_INFO_BUFFERS_SIZE 0x100
-static int obj_info_buffers_index = 0;
-static char obj_info_buffers[OBJ_INFO_BUFFERS_NUM][OBJ_INFO_BUFFERS_SIZE];
-
-static const char *
-obj_info(VALUE obj)
-{
- const int index = obj_info_buffers_index++;
- char *const buff = &obj_info_buffers[index][0];
-
- if (obj_info_buffers_index >= OBJ_INFO_BUFFERS_NUM) {
- obj_info_buffers_index = 0;
- }
-
- return rb_raw_obj_info(buff, OBJ_INFO_BUFFERS_SIZE, obj);
-}
-#else
-static const char *
-obj_info(VALUE obj)
-{
- return obj_type_name(obj);
-}
-#endif
-
-const char *
-rb_obj_info(VALUE obj)
-{
- if (!rb_special_const_p(obj)) {
- return obj_info(obj);
- }
- else {
- return obj_type_name(obj);
- }
-}
-
-void
-rb_obj_info_dump(VALUE obj)
-{
- char buff[0x100];
- fprintf(stderr, "rb_obj_info_dump: %s\n", rb_raw_obj_info(buff, 0x100, obj));
-}
-
#if GC_DEBUG
void
@@ -9157,7 +6749,7 @@ rb_gcdebug_print_obj_condition(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
- fprintf(stderr, "created at: %s:%d\n", RANY(obj)->file, RANY(obj)->line);
+ fprintf(stderr, "created at: %s:%d\n", RSTRING_PTR(RANY(obj)->file), FIX2INT(RANY(obj)->line));
if (is_pointer_to_heap(objspace, (void *)obj)) {
fprintf(stderr, "pointer to heap?: true\n");
@@ -9167,12 +6759,14 @@ rb_gcdebug_print_obj_condition(VALUE obj)
return;
}
- fprintf(stderr, "marked? : %s\n", MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj) ? "true" : "false");
+ fprintf(stderr, "marked? : %s\n", MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj) ? "true" : "false");
#if USE_RGENGC
- fprintf(stderr, "age? : %d\n", RVALUE_AGE(obj));
- fprintf(stderr, "old? : %s\n", RVALUE_OLD_P(obj) ? "true" : "false");
- fprintf(stderr, "WB-protected?: %s\n", RVALUE_WB_UNPROTECTED(obj) ? "false" : "true");
- fprintf(stderr, "remembered? : %s\n", RVALUE_REMEMBERED(obj) ? "true" : "false");
+#if RGENGC_THREEGEN
+ fprintf(stderr, "young? : %s\n", RVALUE_YOUNG_P(obj) ? "true" : "false");
+#endif
+ fprintf(stderr, "old? : %s\n", RVALUE_OLD_P(obj) ? "true" : "false");
+ fprintf(stderr, "shady? : %s\n", RVALUE_SHADY(obj) ? "true" : "false");
+ fprintf(stderr, "remembered?: %s\n", MARKED_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(obj), obj) ? "true" : "false");
#endif
if (is_lazy_sweeping(heap_eden)) {
@@ -9185,7 +6779,7 @@ rb_gcdebug_print_obj_condition(VALUE obj)
}
static VALUE
-gcdebug_sentinel(VALUE obj, VALUE name)
+gcdebug_sential(VALUE obj, VALUE name)
{
fprintf(stderr, "WARNING: object %s(%p) is inadvertently collected\n", (char *)name, (void *)obj);
return Qnil;
@@ -9194,42 +6788,10 @@ gcdebug_sentinel(VALUE obj, VALUE name)
void
rb_gcdebug_sentinel(VALUE obj, const char *name)
{
- rb_define_finalizer(obj, rb_proc_new(gcdebug_sentinel, (VALUE)name));
+ rb_define_finalizer(obj, rb_proc_new(gcdebug_sential, (VALUE)name));
}
-
#endif /* GC_DEBUG */
-#if GC_DEBUG_STRESS_TO_CLASS
-static VALUE
-rb_gcdebug_add_stress_to_class(int argc, VALUE *argv, VALUE self)
-{
- rb_objspace_t *objspace = &rb_objspace;
-
- if (!stress_to_class) {
- stress_to_class = rb_ary_tmp_new(argc);
- }
- rb_ary_cat(stress_to_class, argv, argc);
- return self;
-}
-
-static VALUE
-rb_gcdebug_remove_stress_to_class(int argc, VALUE *argv, VALUE self)
-{
- rb_objspace_t *objspace = &rb_objspace;
- int i;
-
- if (stress_to_class) {
- for (i = 0; i < argc; ++i) {
- rb_ary_delete_same(stress_to_class, argv[i]);
- }
- if (RARRAY_LEN(stress_to_class) == 0) {
- stress_to_class = 0;
- }
- }
- return Qnil;
-}
-#endif
-
/*
* Document-module: ObjectSpace
*
@@ -9241,8 +6803,6 @@ rb_gcdebug_remove_stress_to_class(int argc, VALUE *argv, VALUE self)
* called when a specific object is about to be destroyed by garbage
* collection.
*
- * require 'objspace'
- *
* a = "A"
* b = "B"
*
@@ -9297,29 +6857,18 @@ rb_gcdebug_remove_stress_to_class(int argc, VALUE *argv, VALUE self)
void
Init_GC(void)
{
-#undef rb_intern
VALUE rb_mObjSpace;
VALUE rb_mProfiler;
- VALUE gc_constants;
rb_mGC = rb_define_module("GC");
- rb_define_singleton_method(rb_mGC, "start", gc_start_internal, -1);
+ rb_define_singleton_method(rb_mGC, "start", rb_gc_start, 0);
rb_define_singleton_method(rb_mGC, "enable", rb_gc_enable, 0);
rb_define_singleton_method(rb_mGC, "disable", rb_gc_disable, 0);
rb_define_singleton_method(rb_mGC, "stress", gc_stress_get, 0);
- rb_define_singleton_method(rb_mGC, "stress=", gc_stress_set_m, 1);
+ rb_define_singleton_method(rb_mGC, "stress=", gc_stress_set, 1);
rb_define_singleton_method(rb_mGC, "count", gc_count, 0);
rb_define_singleton_method(rb_mGC, "stat", gc_stat, -1);
- rb_define_singleton_method(rb_mGC, "latest_gc_info", gc_latest_gc_info, -1);
- rb_define_method(rb_mGC, "garbage_collect", gc_start_internal, -1);
-
- gc_constants = rb_hash_new();
- rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_SIZE")), SIZET2NUM(sizeof(RVALUE)));
- rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_OBJ_LIMIT")), SIZET2NUM(HEAP_OBJ_LIMIT));
- rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_BITMAP_SIZE")), SIZET2NUM(HEAP_BITMAP_SIZE));
- rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_BITMAP_PLANES")), SIZET2NUM(HEAP_BITMAP_PLANES));
- OBJ_FREEZE(gc_constants);
- rb_define_const(rb_mGC, "INTERNAL_CONSTANTS", gc_constants);
+ rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0);
rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler");
rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0);
@@ -9333,14 +6882,17 @@ Init_GC(void)
rb_mObjSpace = rb_define_module("ObjectSpace");
rb_define_module_function(rb_mObjSpace, "each_object", os_each_obj, -1);
- rb_define_module_function(rb_mObjSpace, "garbage_collect", gc_start_internal, -1);
+ rb_define_module_function(rb_mObjSpace, "garbage_collect", rb_gc_start, 0);
rb_define_module_function(rb_mObjSpace, "define_finalizer", define_final, -1);
rb_define_module_function(rb_mObjSpace, "undefine_finalizer", undefine_final, 1);
rb_define_module_function(rb_mObjSpace, "_id2ref", id2ref, 1);
- rb_vm_register_special_exception(ruby_error_nomemory, rb_eNoMemError, "failed to allocate memory");
+ nomem_error = rb_exc_new3(rb_eNoMemError,
+ rb_obj_freeze(rb_str_new2("failed to allocate memory")));
+ OBJ_TAINT(nomem_error);
+ OBJ_FREEZE(nomem_error);
rb_define_method(rb_cBasicObject, "__id__", rb_obj_id, 0);
rb_define_method(rb_mKernel, "object_id", rb_obj_id, 0);
@@ -9362,42 +6914,32 @@ Init_GC(void)
rb_define_method(rb_cWeakMap, "each_value", wmap_each_value, 0);
rb_define_method(rb_cWeakMap, "keys", wmap_keys, 0);
rb_define_method(rb_cWeakMap, "values", wmap_values, 0);
- rb_define_method(rb_cWeakMap, "size", wmap_size, 0);
- rb_define_method(rb_cWeakMap, "length", wmap_size, 0);
rb_define_private_method(rb_cWeakMap, "finalize", wmap_finalize, 1);
rb_include_module(rb_cWeakMap, rb_mEnumerable);
}
- /* internal methods */
- rb_define_singleton_method(rb_mGC, "verify_internal_consistency", gc_verify_internal_consistency, 0);
-#if MALLOC_ALLOCATED_SIZE
+#if CALC_EXACT_MALLOC_SIZE
rb_define_singleton_method(rb_mGC, "malloc_allocated_size", gc_malloc_allocated_size, 0);
rb_define_singleton_method(rb_mGC, "malloc_allocations", gc_malloc_allocations, 0);
#endif
-#if GC_DEBUG_STRESS_TO_CLASS
- rb_define_singleton_method(rb_mGC, "add_stress_to_class", rb_gcdebug_add_stress_to_class, -1);
- rb_define_singleton_method(rb_mGC, "remove_stress_to_class", rb_gcdebug_remove_stress_to_class, -1);
-#endif
-
/* ::GC::OPTS, which shows GC build options */
{
VALUE opts;
rb_define_const(rb_mGC, "OPTS", opts = rb_ary_new());
-#define OPT(o) if (o) rb_ary_push(opts, rb_fstring_lit(#o))
+#define OPT(o) if (o) rb_ary_push(opts, rb_str_new2(#o))
OPT(GC_DEBUG);
OPT(USE_RGENGC);
OPT(RGENGC_DEBUG);
OPT(RGENGC_CHECK_MODE);
OPT(RGENGC_PROFILE);
- OPT(RGENGC_ESTIMATE_OLDMALLOC);
+ OPT(RGENGC_THREEGEN);
+ OPT(RGENGC_ESTIMATE_OLDSPACE);
OPT(GC_PROFILE_MORE_DETAIL);
OPT(GC_ENABLE_LAZY_SWEEP);
OPT(CALC_EXACT_MALLOC_SIZE);
- OPT(MALLOC_ALLOCATED_SIZE);
- OPT(MALLOC_ALLOCATED_SIZE_CHECK);
+ OPT(CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE);
OPT(GC_PROFILE_DETAIL_MEMORY);
#undef OPT
- OBJ_FREEZE(opts);
}
}
diff --git a/gc.h b/gc.h
index c723106137..09edafa027 100644
--- a/gc.h
+++ b/gc.h
@@ -57,10 +57,7 @@ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
#define RUBY_GC_INFO if(0)printf
#endif
-#define RUBY_MARK_UNLESS_NULL(ptr) do { \
- VALUE markobj = (ptr); \
- if (RTEST(markobj)) {rb_gc_mark(markobj);} \
-} while (0)
+#define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
#if STACK_GROW_DIRECTION > 0
@@ -86,10 +83,6 @@ int ruby_get_stack_grow_direction(volatile VALUE *addr);
#endif
#define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
-const char *rb_obj_info(VALUE obj);
-const char *rb_raw_obj_info(char *buff, const int buff_size, VALUE obj);
-void rb_obj_info_dump(VALUE obj);
-
RUBY_SYMBOL_EXPORT_BEGIN
/* exports for objspace module */
@@ -98,17 +91,11 @@ void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), v
void rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *data);
int rb_objspace_markable_object_p(VALUE obj);
int rb_objspace_internal_object_p(VALUE obj);
-int rb_objspace_marked_object_p(VALUE obj);
-int rb_objspace_garbage_object_p(VALUE obj);
void rb_objspace_each_objects(
int (*callback)(void *start, void *end, size_t stride, void *data),
void *data);
-void rb_objspace_each_objects_without_setup(
- int (*callback)(void *, void *, size_t, void *),
- void *data);
-
RUBY_SYMBOL_EXPORT_END
#endif /* RUBY_GC_H */
diff --git a/gem_prelude.rb b/gem_prelude.rb
index 3f171d1145..3d4516f341 100644
--- a/gem_prelude.rb
+++ b/gem_prelude.rb
@@ -1,7 +1 @@
-if defined?(Gem)
- require 'rubygems.rb'
- begin
- require 'did_you_mean'
- rescue LoadError
- end if defined?(DidYouMean)
-end
+require 'rubygems.rb' if defined?(Gem)
diff --git a/gems/bundled_gems b/gems/bundled_gems
deleted file mode 100644
index 1cdb82884d..0000000000
--- a/gems/bundled_gems
+++ /dev/null
@@ -1,6 +0,0 @@
-power_assert 0.2.6
-test-unit 3.1.5
-minitest 5.8.5
-rake 10.4.2
-net-telnet 0.1.1
-did_you_mean 1.0.0
diff --git a/goruby.c b/goruby.c
index 99042f8440..8f7cf30be4 100644
--- a/goruby.c
+++ b/goruby.c
@@ -32,14 +32,12 @@ goruby_options(int argc, char **argv)
void *ret;
if ((isatty(0) && isatty(1) && isatty(2)) && (pipe(rw) == 0)) {
- ssize_t n;
infd = dup(0);
- if (infd < 0) return NULL;
dup2(rw[0], 0);
close(rw[0]);
- n = write(rw[1], cmd, sizeof(cmd) - 1);
+ write(rw[1], cmd, sizeof(cmd) - 1);
close(rw[1]);
- ret = n > 0 ? ruby_options(argc, argv) : NULL;
+ ret = ruby_options(argc, argv);
dup2(infd, 0);
close(infd);
return ret;
diff --git a/hash.c b/hash.c
index e418b99c1f..bc90adaa35 100644
--- a/hash.c
+++ b/hash.c
@@ -11,13 +11,13 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
+#include "ruby/encoding.h"
+#include "internal.h"
#include <errno.h>
#include "probes.h"
-#include "id.h"
-#include "symbol.h"
#ifdef __APPLE__
# ifdef HAVE_CRT_EXTERNS_H
@@ -27,23 +27,6 @@
# endif
#endif
-#define HAS_EXTRA_STATES(hash, klass) ( \
- ((klass = has_extra_methods(rb_obj_class(hash))) != 0) || \
- FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \
- !NIL_P(RHASH_IFNONE(hash)))
-
-static VALUE
-has_extra_methods(VALUE klass)
-{
- const VALUE base = rb_cHash;
- VALUE c = klass;
- while (c != base) {
- if (rb_class_has_methods(c)) return klass;
- c = RCLASS_SUPER(c);
- }
- return 0;
-}
-
static VALUE rb_hash_s_try_convert(VALUE, VALUE);
/*
@@ -65,18 +48,12 @@ rb_hash_freeze(VALUE hash)
VALUE rb_cHash;
static VALUE envtbl;
-static ID id_hash, id_yield, id_default, id_flatten_bang;
-
-VALUE
-rb_hash_ifnone(VALUE h)
-{
- return RHASH_IFNONE(h);
-}
+static ID id_hash, id_yield, id_default;
VALUE
rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
{
- RB_OBJ_WRITE(hash, (&RHASH(hash)->ifnone), ifnone);
+ OBJ_WRITE(hash, (&RHASH(hash)->ifnone), ifnone);
return hash;
}
@@ -99,20 +76,17 @@ rb_any_cmp(VALUE a, VALUE b)
return !rb_eql(a, b);
}
-static VALUE
-hash_recursive(VALUE obj, VALUE arg, int recurse)
-{
- if (recurse) return INT2FIX(0);
- return rb_funcallv(obj, id_hash, 0, 0);
-}
-
VALUE
rb_hash(VALUE obj)
{
- VALUE hval = rb_exec_recursive_outer(hash_recursive, obj, 0);
+ VALUE hval = rb_funcall(obj, id_hash, 0);
+ retry:
+ switch (TYPE(hval)) {
+ case T_FIXNUM:
+ return hval;
- while (!FIXNUM_P(hval)) {
- if (RB_TYPE_P(hval, T_BIGNUM)) {
+ case T_BIGNUM:
+ {
int sign;
unsigned long ul;
sign = rb_integer_pack(hval, &ul, 1, sizeof(ul), 0,
@@ -122,115 +96,32 @@ rb_hash(VALUE obj)
return LONG2FIX(-(long)ul);
return LONG2FIX((long)ul);
}
+
+ default:
hval = rb_to_int(hval);
+ goto retry;
}
- return hval;
}
-long rb_objid_hash(st_index_t index);
-
static st_index_t
-any_hash(VALUE a, st_index_t (*other_func)(VALUE))
+rb_any_hash(VALUE a)
{
VALUE hval;
st_index_t hnum;
if (SPECIAL_CONST_P(a)) {
if (a == Qundef) return 0;
- if (STATIC_SYM_P(a)) {
- hnum = a >> (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT);
- hnum = rb_hash_start(hnum);
- goto out;
- }
- else if (FLONUM_P(a)) {
- /* prevent pathological behavior: [Bug #10761] */
- goto flt;
- }
- hnum = rb_objid_hash((st_index_t)a);
+ hnum = rb_hash_end(rb_hash_start((st_index_t)a));
}
else if (BUILTIN_TYPE(a) == T_STRING) {
hnum = rb_str_hash(a);
}
- else if (BUILTIN_TYPE(a) == T_SYMBOL) {
- hnum = RSYMBOL(a)->hashval;
- }
- else if (BUILTIN_TYPE(a) == T_BIGNUM) {
- hval = rb_big_hash(a);
- hnum = FIX2LONG(hval);
- }
- else if (BUILTIN_TYPE(a) == T_FLOAT) {
- flt:
- hval = rb_dbl_hash(rb_float_value(a));
- hnum = FIX2LONG(hval);
- }
else {
- hnum = other_func(a);
+ hval = rb_hash(a);
+ hnum = FIX2LONG(hval);
}
- out:
hnum <<= 1;
- return (long)RSHIFT(hnum, 1);
-}
-
-static st_index_t
-obj_any_hash(VALUE obj)
-{
- obj = rb_hash(obj);
- return FIX2LONG(obj);
-}
-
-static st_index_t
-rb_any_hash(VALUE a)
-{
- return any_hash(a, obj_any_hash);
-}
-
-static st_index_t
-rb_num_hash_start(st_index_t n)
-{
- /*
- * This hash function is lightly-tuned for Ruby. Further tuning
- * should be possible. Notes:
- *
- * - (n >> 3) alone is great for heap objects and OK for fixnum,
- * however symbols perform poorly.
- * - (n >> (RUBY_SPECIAL_SHIFT+3)) was added to make symbols hash well,
- * n.b.: +3 to remove most ID scope, +1 worked well initially, too
- * n.b.: +1 (instead of 3) worked well initially, too
- * - (n << 16) was finally added to avoid losing bits for fixnums
- * - avoid expensive modulo instructions, it is currently only
- * shifts and bitmask operations.
- */
- return (n >> (RUBY_SPECIAL_SHIFT + 3) ^ (n << 16)) ^ (n >> 3);
-}
-
-long
-rb_objid_hash(st_index_t index)
-{
- st_index_t hnum = rb_num_hash_start(index);
-
- hnum = rb_hash_start(hnum);
- hnum = rb_hash_uint(hnum, (st_index_t)rb_any_hash);
- hnum = rb_hash_end(hnum);
- return hnum;
-}
-
-static st_index_t
-objid_hash(VALUE obj)
-{
- return rb_objid_hash((st_index_t)obj);
-}
-
-VALUE
-rb_obj_hash(VALUE obj)
-{
- st_index_t hnum = any_hash(obj, objid_hash);
- return LONG2FIX(hnum);
-}
-
-int
-rb_hash_iter_lev(VALUE h)
-{
- return RHASH_ITER_LEV(h);
+ return (st_index_t)RSHIFT(hnum, 1);
}
static const struct st_hash_type objhash = {
@@ -238,29 +129,8 @@ static const struct st_hash_type objhash = {
rb_any_hash,
};
-#define rb_ident_cmp st_numcmp
-
-static st_index_t
-rb_ident_hash(st_data_t n)
-{
-#ifdef USE_FLONUM /* RUBY */
- /*
- * - flonum (on 64-bit) is pathologically bad, mix the actual
- * float value in, but do not use the float value as-is since
- * many integers get interpreted as 2.0 or -2.0 [Bug #10761]
- */
- if (FLONUM_P(n)) {
- n ^= (st_data_t)rb_float_value(n);
- }
-#endif
-
- return (st_index_t)rb_num_hash_start((st_index_t)n);
-}
-
-static const struct st_hash_type identhash = {
- rb_ident_cmp,
- rb_ident_hash,
-};
+extern const struct st_hash_type st_hashtype_num;
+#define identhash st_hashtype_num
typedef int st_foreach_func(st_data_t, st_data_t, st_data_t);
@@ -386,7 +256,9 @@ hash_alloc(VALUE klass)
static VALUE
empty_hash_alloc(VALUE klass)
{
- RUBY_DTRACE_CREATE_HOOK(HASH, 0);
+ if (RUBY_DTRACE_HASH_CREATE_ENABLED()) {
+ RUBY_DTRACE_HASH_CREATE(0, rb_sourcefile(), rb_sourceline());
+ }
return hash_alloc(klass);
}
@@ -397,8 +269,8 @@ rb_hash_new(void)
return hash_alloc(rb_cHash);
}
-static inline VALUE
-rb_hash_dup_empty(VALUE hash)
+VALUE
+rb_hash_dup(VALUE hash)
{
NEWOBJ_OF(ret, struct RHash,
rb_obj_class(hash),
@@ -406,6 +278,8 @@ rb_hash_dup_empty(VALUE hash)
if (FL_TEST((hash), FL_EXIVAR))
rb_copy_generic_ivar((VALUE)(ret),(VALUE)(hash));
+ if (!RHASH_EMPTY_P(hash))
+ ret->ntbl = st_copy(RHASH(hash)->ntbl);
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
FL_SET(ret, HASH_PROC_DEFAULT);
}
@@ -413,15 +287,6 @@ rb_hash_dup_empty(VALUE hash)
return (VALUE)ret;
}
-VALUE
-rb_hash_dup(VALUE hash)
-{
- VALUE ret = rb_hash_dup_empty(hash);
- if (!RHASH_EMPTY_P(hash))
- RHASH(ret)->ntbl = st_copy(RHASH(hash)->ntbl);
- return ret;
-}
-
static void
rb_hash_modify_check(VALUE hash)
{
@@ -508,8 +373,8 @@ tbl_update(VALUE hash, VALUE key, int (*func)(st_data_t *key, st_data_t *val, st
result = st_update(RHASH(hash)->ntbl, (st_data_t)key, func, (st_data_t)&arg);
/* write barrier */
- if (arg.new_key) RB_OBJ_WRITTEN(hash, arg.old_key, arg.new_key);
- if (arg.new_value) RB_OBJ_WRITTEN(hash, arg.old_value, arg.new_value);
+ if (arg.new_key) OBJ_WRITTEN(hash, arg.old_key, arg.new_key);
+ if (arg.new_value) OBJ_WRITTEN(hash, arg.old_value, arg.new_value);
return result;
}
@@ -583,8 +448,7 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash)
FL_SET(hash, HASH_PROC_DEFAULT);
}
else {
- rb_check_arity(argc, 0, 1);
- ifnone = argc == 0 ? Qnil : argv[0];
+ rb_scan_args(argc, argv, "01", &ifnone);
RHASH_SET_IFNONE(hash, ifnone);
}
@@ -705,11 +569,6 @@ rb_hash_s_try_convert(VALUE dummy, VALUE hash)
return rb_check_hash_type(hash);
}
-struct rehash_arg {
- VALUE hash;
- st_table *tbl;
-};
-
static int
rb_hash_rehash_i(VALUE key, VALUE value, VALUE arg)
{
@@ -726,7 +585,7 @@ rb_hash_rehash_i(VALUE key, VALUE value, VALUE arg)
* Rebuilds the hash based on the current hash values for each key. If
* values of key objects have changed since they were inserted, this
* method will reindex <i>hsh</i>. If <code>Hash#rehash</code> is
- * called while an iterator is traversing the hash, a
+ * called while an iterator is traversing the hash, an
* <code>RuntimeError</code> will be raised in the iterator.
*
* a = [ "a", "b" ]
@@ -739,10 +598,9 @@ rb_hash_rehash_i(VALUE key, VALUE value, VALUE arg)
* h[a] #=> 100
*/
-VALUE
+static VALUE
rb_hash_rehash(VALUE hash)
{
- VALUE tmp;
st_table *tbl;
if (RHASH_ITER_LEV(hash) > 0) {
@@ -751,20 +609,16 @@ rb_hash_rehash(VALUE hash)
rb_hash_modify_check(hash);
if (!RHASH(hash)->ntbl)
return hash;
- tmp = hash_alloc(0);
tbl = st_init_table_with_size(RHASH(hash)->ntbl->type, RHASH(hash)->ntbl->num_entries);
- RHASH(tmp)->ntbl = tbl;
-
rb_hash_foreach(hash, rb_hash_rehash_i, (VALUE)tbl);
st_free_table(RHASH(hash)->ntbl);
RHASH(hash)->ntbl = tbl;
- RHASH(tmp)->ntbl = 0;
return hash;
}
-VALUE
-rb_hash_default_value(VALUE hash, VALUE key)
+static VALUE
+hash_default_value(VALUE hash, VALUE key)
{
if (rb_method_basic_definition_p(CLASS_OF(hash), id_default)) {
VALUE ifnone = RHASH_IFNONE(hash);
@@ -797,7 +651,7 @@ rb_hash_aref(VALUE hash, VALUE key)
st_data_t val;
if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
- return rb_hash_default_value(hash, key);
+ return hash_default_value(hash, key);
}
return (VALUE)val;
}
@@ -851,12 +705,11 @@ rb_hash_lookup(VALUE hash, VALUE key)
static VALUE
rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
{
- VALUE key;
+ VALUE key, if_none;
st_data_t val;
long block_given;
- rb_check_arity(argc, 1, 2);
- key = argv[0];
+ rb_scan_args(argc, argv, "11", &key, &if_none);
block_given = rb_block_given_p();
if (block_given && argc == 2) {
@@ -865,14 +718,14 @@ rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
if (block_given) return rb_yield(key);
if (argc == 1) {
- VALUE desc = rb_protect(rb_inspect, key, 0);
+ volatile VALUE desc = rb_protect(rb_inspect, key, 0);
if (NIL_P(desc)) {
desc = rb_any_to_s(key);
}
desc = rb_str_ellipsize(desc, 65);
rb_raise(rb_eKeyError, "key not found: %"PRIsVALUE, desc);
}
- return argv[1];
+ return if_none;
}
return (VALUE)val;
}
@@ -907,15 +760,13 @@ rb_hash_fetch(VALUE hash, VALUE key)
static VALUE
rb_hash_default(int argc, VALUE *argv, VALUE hash)
{
- VALUE args[2], ifnone;
+ VALUE key, ifnone;
- rb_check_arity(argc, 0, 1);
+ rb_scan_args(argc, argv, "01", &key);
ifnone = RHASH_IFNONE(hash);
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
if (argc == 0) return Qnil;
- args[0] = hash;
- args[1] = argv[0];
- return rb_funcallv(ifnone, id_yield, 2, args);
+ return rb_funcall(ifnone, id_yield, 2, hash, key);
}
return ifnone;
}
@@ -986,7 +837,7 @@ rb_hash_default_proc(VALUE hash)
* h["cat"] #=> "catcat"
*/
-VALUE
+static VALUE
rb_hash_set_default_proc(VALUE hash, VALUE proc)
{
VALUE b;
@@ -1057,48 +908,22 @@ rb_hash_index(VALUE hash, VALUE value)
return rb_hash_key(hash, value);
}
-/*
- * delete a specified entry a given key.
- * if there is the corresponding entry, return a value of the entry.
- * if there is no corresponding entry, return Qundef.
- */
-VALUE
-rb_hash_delete_entry(VALUE hash, VALUE key)
+static VALUE
+rb_hash_delete_key(VALUE hash, VALUE key)
{
st_data_t ktmp = (st_data_t)key, val;
- if (!RHASH(hash)->ntbl) {
- return Qundef;
- }
- else if (RHASH_ITER_LEV(hash) > 0 &&
- (st_delete_safe(RHASH(hash)->ntbl, &ktmp, &val, (st_data_t)Qundef))) {
- FL_SET(hash, HASH_DELETED);
- return (VALUE)val;
+ if (!RHASH(hash)->ntbl)
+ return Qundef;
+ if (RHASH_ITER_LEV(hash) > 0) {
+ if (st_delete_safe(RHASH(hash)->ntbl, &ktmp, &val, (st_data_t)Qundef)) {
+ FL_SET(hash, HASH_DELETED);
+ return (VALUE)val;
+ }
}
- else if (st_delete(RHASH(hash)->ntbl, &ktmp, &val)) {
+ else if (st_delete(RHASH(hash)->ntbl, &ktmp, &val))
return (VALUE)val;
- }
- else {
- return Qundef;
- }
-}
-
-/*
- * delete a specified entry by a given key.
- * if there is the corresponding entry, return a value of the entry.
- * if there is no corresponding entry, return Qnil.
- */
-VALUE
-rb_hash_delete(VALUE hash, VALUE key)
-{
- VALUE deleted_value = rb_hash_delete_entry(hash, key);
-
- if (deleted_value != Qundef) { /* likely pass */
- return deleted_value;
- }
- else {
- return Qnil;
- }
+ return Qundef;
}
/*
@@ -1107,8 +932,8 @@ rb_hash_delete(VALUE hash, VALUE key)
* hsh.delete(key) {| key | block } -> value
*
* Deletes the key-value pair and returns the value from <i>hsh</i> whose
- * key is equal to <i>key</i>. If the key is not found, it returns
- * <em>nil</em>. If the optional code block is given and the
+ * key is equal to <i>key</i>. If the key is not found, returns the
+ * <em>default value</em>. If the optional code block is given and the
* key is not found, pass in the key and return the result of
* <i>block</i>.
*
@@ -1119,25 +944,18 @@ rb_hash_delete(VALUE hash, VALUE key)
*
*/
-static VALUE
-rb_hash_delete_m(VALUE hash, VALUE key)
+VALUE
+rb_hash_delete(VALUE hash, VALUE key)
{
VALUE val;
rb_hash_modify_check(hash);
- val = rb_hash_delete_entry(hash, key);
-
- if (val != Qundef) {
- return val;
- }
- else {
- if (rb_block_given_p()) {
- return rb_yield(key);
- }
- else {
- return Qnil;
- }
+ val = rb_hash_delete_key(hash, key);
+ if (val != Qundef) return val;
+ if (rb_block_given_p()) {
+ return rb_yield(key);
}
+ return Qnil;
}
struct shift_var {
@@ -1184,12 +1002,12 @@ rb_hash_shift(VALUE hash)
else {
rb_hash_foreach(hash, shift_i_safe, (VALUE)&var);
if (var.key != Qundef) {
- rb_hash_delete_entry(hash, var.key);
+ rb_hash_delete_key(hash, var.key);
return rb_assoc_new(var.key, var.val);
}
}
}
- return rb_hash_default_value(hash, Qnil);
+ return hash_default_value(hash, Qnil);
}
static int
@@ -1201,6 +1019,8 @@ delete_if_i(VALUE key, VALUE value, VALUE hash)
return ST_CONTINUE;
}
+static VALUE rb_hash_size(VALUE hash);
+
static VALUE
hash_enum_size(VALUE hash, VALUE args, VALUE eobj)
{
@@ -1255,46 +1075,21 @@ rb_hash_reject_bang(VALUE hash)
return hash;
}
-static int
-reject_i(VALUE key, VALUE value, VALUE result)
-{
- if (!RTEST(rb_yield_values(2, key, value))) {
- rb_hash_aset(result, key, value);
- }
- return ST_CONTINUE;
-}
-
/*
* call-seq:
- * hsh.reject {|key, value| block} -> a_hash
- * hsh.reject -> an_enumerator
+ * hsh.reject {| key, value | block } -> a_hash
+ * hsh.reject -> an_enumerator
*
- * Returns a new hash consisting of entries for which the block returns false.
+ * Same as <code>Hash#delete_if</code>, but works on (and returns) a
+ * copy of the <i>hsh</i>. Equivalent to
+ * <code><i>hsh</i>.dup.delete_if</code>.
*
- * If no block is given, an enumerator is returned instead.
- *
- * h = { "a" => 100, "b" => 200, "c" => 300 }
- * h.reject {|k,v| k < "b"} #=> {"b" => 200, "c" => 300}
- * h.reject {|k,v| v > 100} #=> {"a" => 100}
*/
-VALUE
+static VALUE
rb_hash_reject(VALUE hash)
{
- VALUE result;
-
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
- if (RTEST(ruby_verbose)) {
- VALUE klass;
- if (HAS_EXTRA_STATES(hash, klass)) {
- rb_warn("extra states are no longer copied: %+"PRIsVALUE, hash);
- }
- }
- result = rb_hash_new();
- if (!RHASH_EMPTY_P(hash)) {
- rb_hash_foreach(hash, reject_i, result);
- }
- return result;
+ return rb_hash_delete_if(rb_obj_dup(hash));
}
/*
@@ -1320,40 +1115,11 @@ rb_hash_values_at(int argc, VALUE *argv, VALUE hash)
return result;
}
-/*
- * call-seq:
- * hsh.fetch_values(key, ...) -> array
- * hsh.fetch_values(key, ...) { |key| block } -> array
- *
- * Returns an array containing the values associated with the given keys
- * but also raises <code>KeyError</code> when one of keys can't be found.
- * Also see <code>Hash#values_at</code> and <code>Hash#fetch</code>.
- *
- * h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" }
- *
- * h.fetch_values("cow", "cat") #=> ["bovine", "feline"]
- * h.fetch_values("cow", "bird") # raises KeyError
- * h.fetch_values("cow", "bird") { |k| k.upcase } #=> ["bovine", "BIRD"]
- */
-
-VALUE
-rb_hash_fetch_values(int argc, VALUE *argv, VALUE hash)
-{
- VALUE result = rb_ary_new2(argc);
- long i;
-
- for (i=0; i<argc; i++) {
- rb_ary_push(result, rb_hash_fetch(hash, argv[i]));
- }
- return result;
-}
-
static int
select_i(VALUE key, VALUE value, VALUE result)
{
- if (RTEST(rb_yield_values(2, key, value))) {
+ if (RTEST(rb_yield_values(2, key, value)))
rb_hash_aset(result, key, value);
- }
return ST_CONTINUE;
}
@@ -1378,9 +1144,7 @@ rb_hash_select(VALUE hash)
RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
result = rb_hash_new();
- if (!RHASH_EMPTY_P(hash)) {
- rb_hash_foreach(hash, select_i, result);
- }
+ rb_hash_foreach(hash, select_i, result);
return result;
}
@@ -1491,13 +1255,13 @@ static int
hash_aset_str(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
{
if (!existing) {
- *key = rb_str_new_frozen(*key);
+ *key = rb_str_new_frozen((VALUE)*key);
}
return hash_aset(key, val, arg, existing);
}
-NOINSERT_UPDATE_CALLBACK(hash_aset)
-NOINSERT_UPDATE_CALLBACK(hash_aset_str)
+NOINSERT_UPDATE_CALLBACK(hash_aset);
+NOINSERT_UPDATE_CALLBACK(hash_aset_str);
/*
* call-seq:
@@ -1512,8 +1276,7 @@ NOINSERT_UPDATE_CALLBACK(hash_aset_str)
* h["a"] = 9
* h["c"] = 4
* h #=> {"a"=>9, "b"=>200, "c"=>4}
- * h.store("d", 42) #=> 42
- * h #=> {"a"=>9, "b"=>200, "c"=>4, "d"=>42}
+ * h.store("d", 42) #=> {"a"=>9, "b"=>200, "c"=>4, "d"=>42}
*
* +key+ should not have its value changed while it is in use as a key (an
* <tt>unfrozen String</tt> passed as a key will be duplicated and frozen).
@@ -1565,8 +1328,6 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2)
Check_Type(hash2, T_HASH);
- if (hash == hash2) return hash;
-
ntbl = RHASH(hash)->ntbl;
if (RHASH(hash2)->ntbl) {
if (ntbl) st_free_table(ntbl);
@@ -1618,9 +1379,22 @@ rb_hash_replace(VALUE hash, VALUE hash2)
table2 = RHASH(hash2)->ntbl;
- rb_hash_clear(hash);
- if (table2) hash_tbl(hash)->type = table2->type;
- rb_hash_foreach(hash2, replace_i, hash);
+ if (RHASH_EMPTY_P(hash2)) {
+ rb_hash_clear(hash);
+ if (table2) hash_tbl(hash)->type = table2->type;
+ return hash;
+ }
+
+ if (RHASH_ITER_LEV(hash) > 0) {
+ rb_hash_clear(hash);
+ hash_tbl(hash)->type = table2->type;
+ rb_hash_foreach(hash2, replace_i, hash);
+ }
+ else {
+ st_table *old_table = RHASH(hash)->ntbl;
+ if (old_table) st_free_table(old_table);
+ RHASH(hash)->ntbl = st_copy(table2);
+ }
return hash;
}
@@ -1638,7 +1412,7 @@ rb_hash_replace(VALUE hash, VALUE hash2)
* h.length #=> 3
*/
-VALUE
+static VALUE
rb_hash_size(VALUE hash)
{
return INT2FIX(RHASH_SIZE(hash));
@@ -1798,7 +1572,7 @@ rb_hash_to_a(VALUE hash)
{
VALUE ary;
- ary = rb_ary_new_capa(RHASH_SIZE(hash));
+ ary = rb_ary_new();
rb_hash_foreach(hash, to_a_i, ary);
OBJ_INFECT(ary, hash);
@@ -1919,26 +1693,12 @@ keys_i(VALUE key, VALUE value, VALUE ary)
VALUE
rb_hash_keys(VALUE hash)
{
- VALUE keys;
- st_index_t size = RHASH_SIZE(hash);
-
- keys = rb_ary_new_capa(size);
- if (size == 0) return keys;
-
- if (ST_DATA_COMPATIBLE_P(VALUE)) {
- st_table *table = RHASH(hash)->ntbl;
+ VALUE ary;
- rb_gc_writebarrier_remember(keys);
- RARRAY_PTR_USE(keys, ptr, {
- size = st_keys_check(table, ptr, size, Qundef);
- });
- rb_ary_set_len(keys, size);
- }
- else {
- rb_hash_foreach(hash, keys_i, keys);
- }
+ ary = rb_ary_new_capa(RHASH_SIZE(hash));
+ rb_hash_foreach(hash, keys_i, ary);
- return keys;
+ return ary;
}
static int
@@ -1963,26 +1723,12 @@ values_i(VALUE key, VALUE value, VALUE ary)
VALUE
rb_hash_values(VALUE hash)
{
- VALUE values;
- st_index_t size = RHASH_SIZE(hash);
-
- values = rb_ary_new_capa(size);
- if (size == 0) return values;
-
- if (ST_DATA_COMPATIBLE_P(VALUE)) {
- st_table *table = RHASH(hash)->ntbl;
+ VALUE ary;
- rb_gc_writebarrier_remember(values);
- RARRAY_PTR_USE(values, ptr, {
- size = st_values_check(table, ptr, size, Qundef);
- });
- rb_ary_set_len(values, size);
- }
- else {
- rb_hash_foreach(hash, values_i, values);
- }
+ ary = rb_ary_new_capa(RHASH_SIZE(hash));
+ rb_hash_foreach(hash, values_i, ary);
- return values;
+ return ary;
}
/*
@@ -1998,13 +1744,9 @@ rb_hash_values(VALUE hash)
* h.has_key?("a") #=> true
* h.has_key?("z") #=> false
*
- * Note that <code>include?</code> and <code>member?</code> do not test member
- * equality using <code>==</code> as do other Enumerables.
- *
- * See also Enumerable#include?
*/
-VALUE
+static VALUE
rb_hash_has_key(VALUE hash, VALUE key)
{
if (!RHASH(hash)->ntbl)
@@ -2094,20 +1836,13 @@ hash_equal(VALUE hash1, VALUE hash2, int eql)
if (hash1 == hash2) return Qtrue;
if (!RB_TYPE_P(hash2, T_HASH)) {
- if (!rb_respond_to(hash2, idTo_hash)) {
+ if (!rb_respond_to(hash2, rb_intern("to_hash"))) {
return Qfalse;
}
- if (eql) {
- if (rb_eql(hash2, hash1)) {
- return Qtrue;
- }
- else {
- return Qfalse;
- }
- }
- else {
+ if (eql)
+ return rb_eql(hash2, hash1);
+ else
return rb_equal(hash2, hash1);
- }
}
if (RHASH_SIZE(hash1) != RHASH_SIZE(hash2))
return Qfalse;
@@ -2143,12 +1878,6 @@ hash_equal(VALUE hash1, VALUE hash2, int eql)
* h2 == h3 #=> true
* h3 == h4 #=> false
*
- * The orders of each hashes are not compared.
- *
- * h1 = { "a" => 1, "c" => 2 }
- * h2 = { "c" => 2, "a" => 1 }
- * h1 == h2 #=> true
- *
*/
static VALUE
@@ -2163,7 +1892,6 @@ rb_hash_equal(VALUE hash1, VALUE hash2)
*
* Returns <code>true</code> if <i>hash</i> and <i>other</i> are
* both hashes with the same content.
- * The orders of each hashes are not compared.
*/
static VALUE
@@ -2184,27 +1912,32 @@ hash_i(VALUE key, VALUE val, VALUE arg)
return ST_CONTINUE;
}
+static VALUE
+recursive_hash(VALUE hash, VALUE dummy, int recur)
+{
+ st_index_t hval = RHASH_SIZE(hash);
+
+ if (!hval) return INT2FIX(0);
+ if (recur)
+ hval = rb_hash_uint(rb_hash_start(rb_hash(rb_cHash)), hval);
+ else
+ rb_hash_foreach(hash, hash_i, (VALUE)&hval);
+ hval = rb_hash_end(hval);
+ return INT2FIX(hval);
+}
+
/*
* call-seq:
* hsh.hash -> fixnum
*
* Compute a hash-code for this hash. Two hashes with the same content
* will have the same hash code (and will compare using <code>eql?</code>).
- *
- * See also Object#hash.
*/
static VALUE
rb_hash_hash(VALUE hash)
{
- st_index_t size = RHASH_SIZE(hash);
- st_index_t hval = rb_hash_start(size);
- hval = rb_hash_uint(hval, (st_index_t)rb_hash_hash);
- if (size) {
- rb_hash_foreach(hash, hash_i, (VALUE)&hval);
- }
- hval = rb_hash_end(hval);
- return INT2FIX(hval);
+ return rb_exec_recursive_outer(recursive_hash, hash, 0);
}
static int
@@ -2220,8 +1953,6 @@ rb_hash_invert_i(VALUE key, VALUE value, VALUE hash)
*
* Returns a new hash created by using <i>hsh</i>'s values as keys, and
* the keys as values.
- * If a key with the same value already exists in the <i>hsh</i>, then
- * the last one defined will be used, the earlier value(s) will be discarded.
*
* h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 }
* h.invert #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"}
@@ -2252,7 +1983,7 @@ rb_hash_update_callback(st_data_t *key, st_data_t *value, struct update_arg *arg
return ST_CONTINUE;
}
-NOINSERT_UPDATE_CALLBACK(rb_hash_update_callback)
+NOINSERT_UPDATE_CALLBACK(rb_hash_update_callback);
static int
rb_hash_update_i(VALUE key, VALUE value, VALUE hash)
@@ -2279,7 +2010,7 @@ rb_hash_update_block_callback(st_data_t *key, st_data_t *value, struct update_ar
return ST_CONTINUE;
}
-NOINSERT_UPDATE_CALLBACK(rb_hash_update_block_callback)
+NOINSERT_UPDATE_CALLBACK(rb_hash_update_block_callback);
static int
rb_hash_update_block_i(VALUE key, VALUE value, VALUE hash)
@@ -2350,7 +2081,7 @@ rb_hash_update_func_callback(st_data_t *key, st_data_t *value, struct update_arg
return ST_CONTINUE;
}
-NOINSERT_UPDATE_CALLBACK(rb_hash_update_func_callback)
+NOINSERT_UPDATE_CALLBACK(rb_hash_update_func_callback);
static int
rb_hash_update_func_i(VALUE key, VALUE value, VALUE arg0)
@@ -2560,28 +2291,20 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
{
VALUE ary;
+ ary = rb_ary_new_capa(RHASH_SIZE(hash) * 2);
+ rb_hash_foreach(hash, flatten_i, ary);
if (argc) {
- int level = NUM2INT(*argv);
- if (level == 0) return rb_hash_to_a(hash);
-
- ary = rb_ary_new_capa(RHASH_SIZE(hash) * 2);
- rb_hash_foreach(hash, flatten_i, ary);
- if (level - 1 > 0) {
- *argv = INT2FIX(level - 1);
- rb_funcall2(ary, id_flatten_bang, argc, argv);
+ int level = NUM2INT(*argv) - 1;
+ if (level > 0) {
+ *argv = INT2FIX(level);
+ rb_funcall2(ary, rb_intern("flatten!"), argc, argv);
}
- else if (level < 0) {
- rb_funcall2(ary, id_flatten_bang, 0, 0);
- }
- }
- else {
- ary = rb_ary_new_capa(RHASH_SIZE(hash) * 2);
- rb_hash_foreach(hash, flatten_i, ary);
}
-
return ary;
}
+static VALUE rb_hash_compare_by_id_p(VALUE hash);
+
/*
* call-seq:
* hsh.compare_by_identity -> hsh
@@ -2593,7 +2316,7 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
* h1["a"] #=> 100
* h1.compare_by_identity
* h1.compare_by_identity? #=> true
- * h1["a".dup] #=> nil # different objects.
+ * h1["a"] #=> nil # different objects.
* h1[:c] #=> "c" # same symbols are all same.
*
*/
@@ -2617,7 +2340,7 @@ rb_hash_compare_by_id(VALUE hash)
*
*/
-VALUE
+static VALUE
rb_hash_compare_by_id_p(VALUE hash)
{
if (!RHASH(hash)->ntbl)
@@ -2628,218 +2351,6 @@ rb_hash_compare_by_id_p(VALUE hash)
return Qfalse;
}
-VALUE
-rb_ident_hash_new(void)
-{
- VALUE hash = rb_hash_new();
- RHASH(hash)->ntbl = st_init_table(&identhash);
- return hash;
-}
-
-st_table *
-rb_init_identtable(void)
-{
- return st_init_table(&identhash);
-}
-
-st_table *
-rb_init_identtable_with_size(st_index_t size)
-{
- return st_init_table_with_size(&identhash, size);
-}
-
-static int
-any_p_i(VALUE key, VALUE value, VALUE arg)
-{
- VALUE ret = rb_yield(rb_assoc_new(key, value));
- if (RTEST(ret)) {
- *(VALUE *)arg = Qtrue;
- return ST_STOP;
- }
- return ST_CONTINUE;
-}
-
-static int
-any_p_i_fast(VALUE key, VALUE value, VALUE arg)
-{
- VALUE ret = rb_yield_values(2, key, value);
- if (RTEST(ret)) {
- *(VALUE *)arg = Qtrue;
- return ST_STOP;
- }
- return ST_CONTINUE;
-}
-
-/*
- * call-seq:
- * hsh.any? [{ |(key, value)| block }] -> true or false
- *
- * See also Enumerable#any?
- */
-
-static VALUE
-rb_hash_any_p(VALUE hash)
-{
- VALUE ret = Qfalse;
-
- if (RHASH_EMPTY_P(hash)) return Qfalse;
- if (!rb_block_given_p()) {
- /* yields pairs, never false */
- return Qtrue;
- }
- if (rb_block_arity() > 1)
- rb_hash_foreach(hash, any_p_i_fast, (VALUE)&ret);
- else
- rb_hash_foreach(hash, any_p_i, (VALUE)&ret);
- return ret;
-}
-
-/*
- * call-seq:
- * hsh.dig(key, ...) -> object
- *
- * Extracts the nested value specified by the sequence of <i>key</i>
- * objects by calling +dig+ at each step, returning +nil+ if any
- * intermediate step is +nil+.
- *
- * h = { foo: {bar: {baz: 1}}}
- *
- * h.dig(:foo, :bar, :baz) #=> 1
- * h.dig(:foo, :zot, :xyz) #=> nil
- *
- * g = { foo: [10, 11, 12] }
- * g.dig(:foo, 1) #=> 11
- * g.dig(:foo, 1, 0) #=> TypeError: Fixnum does not have #dig method
- * g.dig(:foo, :bar) #=> TypeError: no implicit conversion of Symbol into Integer
- */
-
-VALUE
-rb_hash_dig(int argc, VALUE *argv, VALUE self)
-{
- rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
- self = rb_hash_aref(self, *argv);
- if (!--argc) return self;
- ++argv;
- return rb_obj_dig(argc, argv, self, Qnil);
-}
-
-static int
-hash_le_i(VALUE key, VALUE value, VALUE arg)
-{
- VALUE *args = (VALUE *)arg;
- VALUE v = rb_hash_lookup2(args[0], key, Qundef);
- if (v != Qundef && rb_equal(value, v)) return ST_CONTINUE;
- args[1] = Qfalse;
- return ST_STOP;
-}
-
-static VALUE
-hash_le(VALUE hash1, VALUE hash2)
-{
- VALUE args[2];
- args[0] = hash2;
- args[1] = Qtrue;
- rb_hash_foreach(hash1, hash_le_i, (VALUE)args);
- return args[1];
-}
-
-/*
- * call-seq:
- * hash <= other -> true or false
- *
- * Returns <code>true</code> if <i>hash</i> is subset of
- * <i>other</i> or equals to <i>other</i>.
- *
- * h1 = {a:1, b:2}
- * h2 = {a:1, b:2, c:3}
- * h1 <= h2 #=> true
- * h2 <= h1 #=> false
- * h1 <= h1 #=> true
- */
-static VALUE
-rb_hash_le(VALUE hash, VALUE other)
-{
- other = to_hash(other);
- if (RHASH_SIZE(hash) > RHASH_SIZE(other)) return Qfalse;
- return hash_le(hash, other);
-}
-
-/*
- * call-seq:
- * hash < other -> true or false
- *
- * Returns <code>true</code> if <i>hash</i> is subset of
- * <i>other</i>.
- *
- * h1 = {a:1, b:2}
- * h2 = {a:1, b:2, c:3}
- * h1 < h2 #=> true
- * h2 < h1 #=> false
- * h1 < h1 #=> false
- */
-static VALUE
-rb_hash_lt(VALUE hash, VALUE other)
-{
- other = to_hash(other);
- if (RHASH_SIZE(hash) >= RHASH_SIZE(other)) return Qfalse;
- return hash_le(hash, other);
-}
-
-/*
- * call-seq:
- * hash >= other -> true or false
- *
- * Returns <code>true</code> if <i>other</i> is subset of
- * <i>hash</i> or equals to <i>hash</i>.
- *
- * h1 = {a:1, b:2}
- * h2 = {a:1, b:2, c:3}
- * h1 >= h2 #=> false
- * h2 >= h1 #=> true
- * h1 >= h1 #=> true
- */
-static VALUE
-rb_hash_ge(VALUE hash, VALUE other)
-{
- other = to_hash(other);
- if (RHASH_SIZE(hash) < RHASH_SIZE(other)) return Qfalse;
- return hash_le(other, hash);
-}
-
-/*
- * call-seq:
- * hash > other -> true or false
- *
- * Returns <code>true</code> if <i>other</i> is subset of
- * <i>hash</i>.
- *
- * h1 = {a:1, b:2}
- * h2 = {a:1, b:2, c:3}
- * h1 > h2 #=> false
- * h2 > h1 #=> true
- * h1 > h1 #=> false
- */
-static VALUE
-rb_hash_gt(VALUE hash, VALUE other)
-{
- other = to_hash(other);
- if (RHASH_SIZE(hash) <= RHASH_SIZE(other)) return Qfalse;
- return hash_le(other, hash);
-}
-
-static VALUE
-hash_proc_call(VALUE key, VALUE hash, int argc, const VALUE *argv, VALUE passed_proc)
-{
- rb_check_arity(argc, 1, 1);
- return rb_hash_aref(hash, *argv);
-}
-
-static VALUE
-rb_hash_to_proc(VALUE hash)
-{
- return rb_func_proc_new(hash_proc_call, hash);
-}
-
static int path_tainted = -1;
static char **origenviron;
@@ -2850,18 +2361,7 @@ static char **my_environ;
#undef environ
#define environ my_environ
#undef getenv
-static inline char *
-w32_getenv(const char *name)
-{
- static int binary = -1;
- static int locale = -1;
- if (binary < 0) {
- binary = rb_ascii8bit_encindex();
- locale = rb_locale_encindex();
- }
- return locale == binary ? rb_w32_getenv(name) : rb_w32_ugetenv(name);
-}
-#define getenv(n) w32_getenv(n)
+#define getenv(n) rb_w32_ugetenv(n)
#elif defined(__APPLE__)
#undef environ
#define environ (*_NSGetEnviron())
@@ -2880,20 +2380,11 @@ extern char **environ;
#define ENVNMATCH(s1, s2, n) (memcmp((s1), (s2), (n)) == 0)
#endif
-#ifdef _WIN32
-static VALUE
-env_str_transcode(VALUE str, rb_encoding *enc)
-{
- return rb_str_conv_enc_opts(str, NULL, enc,
- ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, Qnil);
-}
-#endif
-
static VALUE
env_str_new(const char *ptr, long len)
{
#ifdef _WIN32
- VALUE str = env_str_transcode(rb_utf8_str_new(ptr, len), rb_locale_encoding());
+ VALUE str = rb_str_conv_enc(rb_str_new(ptr, len), rb_utf8_encoding(), rb_locale_encoding());
#else
VALUE str = rb_locale_str_new(ptr, len);
#endif
@@ -2903,87 +2394,28 @@ env_str_new(const char *ptr, long len)
}
static VALUE
-env_path_str_new(const char *ptr)
-{
-#ifdef _WIN32
- VALUE str = env_str_transcode(rb_utf8_str_new_cstr(ptr), rb_filesystem_encoding());
-#else
- VALUE str = rb_filesystem_str_new_cstr(ptr);
-#endif
-
- rb_obj_freeze(str);
- return str;
-}
-
-static VALUE
env_str_new2(const char *ptr)
{
if (!ptr) return Qnil;
return env_str_new(ptr, strlen(ptr));
}
-static void *
-get_env_cstr(
-#ifdef _WIN32
- volatile VALUE *pstr,
-#else
- VALUE str,
-#endif
- const char *name)
-{
-#ifdef _WIN32
- VALUE str = *pstr;
-#endif
- char *var;
- rb_encoding *enc = rb_enc_get(str);
- if (!rb_enc_asciicompat(enc)) {
- rb_raise(rb_eArgError, "bad environment variable %s: ASCII incompatible encoding: %s",
- name, rb_enc_name(enc));
- }
-#ifdef _WIN32
- if (!rb_enc_str_asciionly_p(str)) {
- *pstr = str = rb_str_conv_enc(str, NULL, rb_utf8_encoding());
- }
-#endif
- var = RSTRING_PTR(str);
- if (memchr(var, '\0', RSTRING_LEN(str))) {
- rb_raise(rb_eArgError, "bad environment variable %s: contains null byte", name);
- }
- return var;
-}
-
-#ifdef _WIN32
-#define get_env_ptr(var, val) \
- (var = get_env_cstr(&(val), #var))
-#else
-#define get_env_ptr(var, val) \
- (var = get_env_cstr(val, #var))
-#endif
-
-static inline const char *
-env_name(volatile VALUE *s)
-{
- const char *name;
- SafeStringValue(*s);
- get_env_ptr(name, *s);
- return name;
-}
-
-#define env_name(s) env_name(&(s))
-
static VALUE
env_delete(VALUE obj, VALUE name)
{
- const char *nam, *val;
+ char *nam, *val;
- nam = env_name(name);
+ SafeStringValue(name);
+ nam = RSTRING_PTR(name);
+ if (memchr(nam, '\0', RSTRING_LEN(name))) {
+ rb_raise(rb_eArgError, "bad environment variable name");
+ }
val = getenv(nam);
if (val) {
VALUE value = env_str_new2(val);
ruby_setenv(nam, 0);
if (ENVMATCH(nam, PATH_ENV)) {
- RB_GC_GUARD(name);
path_tainted = 0;
}
return value;
@@ -3022,13 +2454,24 @@ static int env_path_tainted(const char *);
static VALUE
rb_f_getenv(VALUE obj, VALUE name)
{
- const char *nam, *env;
+ char *nam, *env;
- nam = env_name(name);
+ SafeStringValue(name);
+ nam = RSTRING_PTR(name);
+ if (memchr(nam, '\0', RSTRING_LEN(name))) {
+ rb_raise(rb_eArgError, "bad environment variable name");
+ }
env = getenv(nam);
if (env) {
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env)) {
- return env_path_str_new(env);
+#ifdef _WIN32
+ VALUE str = rb_str_conv_enc(rb_str_new(env, strlen(env)), rb_utf8_encoding(), rb_filesystem_encoding());
+#else
+ VALUE str = rb_filesystem_str_new_cstr(env);
+#endif
+
+ rb_obj_freeze(str);
+ return str;
}
return env_str_new2(env);
}
@@ -3052,27 +2495,34 @@ rb_f_getenv(VALUE obj, VALUE name)
static VALUE
env_fetch(int argc, VALUE *argv)
{
- VALUE key;
+ VALUE key, if_none;
long block_given;
- const char *nam, *env;
+ char *nam, *env;
- rb_check_arity(argc, 1, 2);
- key = argv[0];
+ rb_scan_args(argc, argv, "11", &key, &if_none);
block_given = rb_block_given_p();
if (block_given && argc == 2) {
rb_warn("block supersedes default value argument");
}
- nam = env_name(key);
+ SafeStringValue(key);
+ nam = RSTRING_PTR(key);
+ if (memchr(nam, '\0', RSTRING_LEN(key))) {
+ rb_raise(rb_eArgError, "bad environment variable name");
+ }
env = getenv(nam);
if (!env) {
if (block_given) return rb_yield(key);
if (argc == 1) {
rb_raise(rb_eKeyError, "key not found: \"%"PRIsVALUE"\"", key);
}
- return argv[1];
+ return if_none;
}
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env))
- return env_path_str_new(env);
+#ifdef _WIN32
+ return rb_str_conv_enc(rb_str_new(env, strlen(env)), rb_utf8_encoding(), rb_filesystem_encoding());
+#else
+ return rb_filesystem_str_new_cstr(env);
+#endif
return env_str_new2(env);
}
@@ -3130,22 +2580,20 @@ envix(const char *nam)
#if defined(_WIN32)
static size_t
-getenvsize(const WCHAR* p)
+getenvsize(const char* p)
{
- const WCHAR* porg = p;
- while (*p++) p += lstrlenW(p) + 1;
+ const char* porg = p;
+ while (*p++) p += strlen(p) + 1;
return p - porg + 1;
}
static size_t
-getenvblocksize(void)
+getenvblocksize()
{
return (rb_w32_osver() >= 5) ? 32767 : 5120;
}
#endif
-#if defined(_WIN32) || \
- (defined(__sun) && !(defined(HAVE_SETENV) && defined(HAVE_UNSETENV)))
-
+#if !defined(HAVE_SETENV) || !defined(HAVE_UNSETENV)
NORETURN(static void invalid_envname(const char *name));
static void
@@ -3168,52 +2616,24 @@ void
ruby_setenv(const char *name, const char *value)
{
#if defined(_WIN32)
-# if defined(MINGW_HAS_SECURE_API) || RUBY_MSVCRT_VERSION >= 80
-# define HAVE__WPUTENV_S 1
-# endif
VALUE buf;
- WCHAR *wname;
- WCHAR *wvalue = 0;
int failed = 0;
- int len;
check_envname(name);
- len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0);
if (value) {
- WCHAR* p = GetEnvironmentStringsW();
- size_t n;
- int len2;
+ const char* p = GetEnvironmentStringsA();
if (!p) goto fail; /* never happen */
- n = lstrlen(name) + 2 + strlen(value) + getenvsize(p);
- FreeEnvironmentStringsW(p);
- if (n >= getenvblocksize()) {
+ if (strlen(name) + 2 + strlen(value) + getenvsize(p) >= getenvblocksize()) {
goto fail; /* 2 for '=' & '\0' */
}
- len2 = MultiByteToWideChar(CP_UTF8, 0, value, -1, NULL, 0);
- wname = ALLOCV_N(WCHAR, buf, len + len2);
- wvalue = wname + len;
- MultiByteToWideChar(CP_UTF8, 0, name, -1, wname, len);
- MultiByteToWideChar(CP_UTF8, 0, value, -1, wvalue, len2);
-#ifndef HAVE__WPUTENV_S
- wname[len-1] = L'=';
-#endif
+ buf = rb_sprintf("%s=%s", name, value);
}
else {
- wname = ALLOCV_N(WCHAR, buf, len + 1);
- MultiByteToWideChar(CP_UTF8, 0, name, -1, wname, len);
- wvalue = wname + len;
- *wvalue = L'\0';
-#ifndef HAVE__WPUTENV_S
- wname[len-1] = L'=';
-#endif
+ buf = rb_sprintf("%s=", name);
}
-#ifndef HAVE__WPUTENV_S
- failed = _wputenv(wname);
-#else
- failed = _wputenv_s(wname, wvalue);
-#endif
- ALLOCV_END(buf);
+ failed = putenv(RSTRING_PTR(buf));
/* even if putenv() failed, clean up and try to delete the
* variable from the system area. */
+ rb_str_resize(buf, 0);
if (!value || !*value) {
/* putenv() doesn't handle empty value */
if (!SetEnvironmentVariable(name, value) &&
@@ -3239,22 +2659,10 @@ ruby_setenv(const char *name, const char *value)
#endif
}
#elif defined __sun
- /* Solaris 9 (or earlier) does not have setenv(3C) and unsetenv(3C). */
- /* The below code was tested on Solaris 10 by:
- % ./configure ac_cv_func_setenv=no ac_cv_func_unsetenv=no
- */
- size_t len, mem_size;
- char **env_ptr, *str, *mem_ptr;
+ size_t len;
+ char **env_ptr, *str;
- check_envname(name);
len = strlen(name);
- if (value) {
- mem_size = len + strlen(value) + 2;
- mem_ptr = malloc(mem_size);
- if (mem_ptr == NULL)
- rb_sys_fail_str(rb_sprintf("malloc("PRIuSIZE")", mem_size));
- snprintf(mem_ptr, mem_size, "%s=%s", name, value);
- }
for (env_ptr = GET_ENVIRON(environ); (str = *env_ptr) != 0; ++env_ptr) {
if (!strncmp(str, name, len) && str[len] == '=') {
if (!in_origenv(str)) free(str);
@@ -3263,10 +2671,10 @@ ruby_setenv(const char *name, const char *value)
}
}
if (value) {
- if (putenv(mem_ptr)) {
- free(mem_ptr);
+ str = malloc(len += strlen(value) + 2);
+ snprintf(str, len, "%s=%s", name, value);
+ if (putenv(str))
rb_sys_fail_str(rb_sprintf("putenv(%s)", name));
- }
}
#else /* WIN32 */
size_t len;
@@ -3323,7 +2731,6 @@ ruby_unsetenv(const char *name)
*
* Sets the environment variable +name+ to +value+. If the value given is
* +nil+ the environment variable is deleted.
- * +name+ must be a string.
*
*/
static VALUE
@@ -3335,16 +2742,17 @@ env_aset(VALUE obj, VALUE nm, VALUE val)
env_delete(obj, nm);
return Qnil;
}
- SafeStringValue(nm);
- SafeStringValue(val);
- /* nm can be modified in `val.to_str`, don't get `name` before
- * check for `val` */
- get_env_ptr(name, nm);
- get_env_ptr(value, val);
+ StringValue(nm);
+ StringValue(val);
+ name = RSTRING_PTR(nm);
+ value = RSTRING_PTR(val);
+ if (memchr(name, '\0', RSTRING_LEN(nm)))
+ rb_raise(rb_eArgError, "bad environment variable name");
+ if (memchr(value, '\0', RSTRING_LEN(val)))
+ rb_raise(rb_eArgError, "bad environment variable value");
ruby_setenv(name, value);
if (ENVMATCH(name, PATH_ENV)) {
- RB_GC_GUARD(nm);
if (OBJ_TAINTED(val)) {
/* already tainted, no check */
path_tainted = 1;
@@ -3526,7 +2934,7 @@ env_each_pair(VALUE ehash)
static VALUE
env_reject_bang(VALUE ehash)
{
- VALUE keys;
+ volatile VALUE keys;
long i;
int del = 0;
@@ -3543,7 +2951,6 @@ env_reject_bang(VALUE ehash)
}
}
}
- RB_GC_GUARD(keys);
if (del == 0) return Qnil;
return envtbl;
}
@@ -3598,22 +3005,23 @@ static VALUE
env_select(VALUE ehash)
{
VALUE result;
- VALUE keys;
- long i;
+ char **env;
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
result = rb_hash_new();
- keys = env_keys();
- for (i = 0; i < RARRAY_LEN(keys); ++i) {
- VALUE key = RARRAY_AREF(keys, i);
- VALUE val = rb_f_getenv(Qnil, key);
- if (!NIL_P(val)) {
- if (RTEST(rb_yield_values(2, key, val))) {
- rb_hash_aset(result, key, val);
+ env = GET_ENVIRON(environ);
+ while (*env) {
+ char *s = strchr(*env, '=');
+ if (s) {
+ VALUE k = env_str_new(*env, s-*env);
+ VALUE v = env_str_new2(s+1);
+ if (RTEST(rb_yield_values(2, k, v))) {
+ rb_hash_aset(result, k, v);
}
}
+ env++;
}
- RB_GC_GUARD(keys);
+ FREE_ENVIRON(environ);
return result;
}
@@ -3628,7 +3036,7 @@ env_select(VALUE ehash)
static VALUE
env_select_bang(VALUE ehash)
{
- VALUE keys;
+ volatile VALUE keys;
long i;
int del = 0;
@@ -3645,7 +3053,6 @@ env_select_bang(VALUE ehash)
}
}
}
- RB_GC_GUARD(keys);
if (del == 0) return Qnil;
return envtbl;
}
@@ -3676,7 +3083,7 @@ env_keep_if(VALUE ehash)
VALUE
rb_env_clear(void)
{
- VALUE keys;
+ volatile VALUE keys;
long i;
keys = env_keys();
@@ -3686,7 +3093,6 @@ rb_env_clear(void)
env_delete(Qnil, RARRAY_AREF(keys, i));
}
}
- RB_GC_GUARD(keys);
return envtbl;
}
@@ -3832,9 +3238,11 @@ env_empty_p(void)
static VALUE
env_has_key(VALUE env, VALUE key)
{
- const char *s;
+ char *s;
- s = env_name(key);
+ s = StringValuePtr(key);
+ if (memchr(s, '\0', RSTRING_LEN(key)))
+ rb_raise(rb_eArgError, "bad environment variable name");
if (getenv(s)) return Qtrue;
return Qfalse;
}
@@ -3849,9 +3257,11 @@ env_has_key(VALUE env, VALUE key)
static VALUE
env_assoc(VALUE env, VALUE key)
{
- const char *s, *e;
+ char *s, *e;
- s = env_name(key);
+ s = StringValuePtr(key);
+ if (memchr(s, '\0', RSTRING_LEN(key)))
+ rb_raise(rb_eArgError, "bad environment variable name");
e = getenv(s);
if (e) return rb_assoc_new(key, rb_tainted_str_new2(e));
return Qnil;
@@ -3871,7 +3281,6 @@ env_has_value(VALUE dmy, VALUE obj)
obj = rb_check_string_type(obj);
if (NIL_P(obj)) return Qnil;
- rb_check_safe_obj(obj);
env = GET_ENVIRON(environ);
while (*env) {
char *s = strchr(*env, '=');
@@ -3902,7 +3311,6 @@ env_rassoc(VALUE dmy, VALUE obj)
obj = rb_check_string_type(obj);
if (NIL_P(obj)) return Qnil;
- rb_check_safe_obj(obj);
env = GET_ENVIRON(environ);
while (*env) {
char *s = strchr(*env, '=');
@@ -3933,7 +3341,7 @@ env_key(VALUE dmy, VALUE value)
char **env;
VALUE str;
- SafeStringValue(value);
+ StringValue(value);
env = GET_ENVIRON(environ);
while (*env) {
char *s = strchr(*env, '=');
@@ -4017,7 +3425,6 @@ static VALUE
env_shift(void)
{
char **env;
- VALUE result = Qnil;
env = GET_ENVIRON(environ);
if (*env) {
@@ -4026,11 +3433,11 @@ env_shift(void)
VALUE key = env_str_new(*env, s-*env);
VALUE val = env_str_new2(getenv(RSTRING_PTR(key)));
env_delete(Qnil, key);
- result = rb_assoc_new(key, val);
+ return rb_assoc_new(key, val);
}
}
FREE_ENVIRON(environ);
- return result;
+ return Qnil;
}
/*
@@ -4066,7 +3473,7 @@ env_replace_i(VALUE key, VALUE val, VALUE keys)
static VALUE
env_replace(VALUE env, VALUE hash)
{
- VALUE keys;
+ volatile VALUE keys;
long i;
keys = env_keys();
@@ -4077,7 +3484,6 @@ env_replace(VALUE env, VALUE hash)
for (i=0; i<RARRAY_LEN(keys); i++) {
env_delete(env, RARRAY_AREF(keys, i));
}
- RB_GC_GUARD(keys);
return env;
}
@@ -4123,7 +3529,7 @@ env_update(VALUE env, VALUE hash)
*
* grades = { "Jane Doe" => 10, "Jim Doe" => 6 }
*
- * Hashes allow an alternate syntax for keys that are symbols.
+ * Hashes allow an alternate syntax form when your keys are always symbols.
* Instead of
*
* options = { :font_size => 10, :font_family => "Arial" }
@@ -4232,7 +3638,6 @@ Init_Hash(void)
id_hash = rb_intern("hash");
id_yield = rb_intern("yield");
id_default = rb_intern("default");
- id_flatten_bang = rb_intern("flatten!");
rb_cHash = rb_define_class("Hash", rb_cObject);
@@ -4250,7 +3655,6 @@ Init_Hash(void)
rb_define_method(rb_cHash,"to_a", rb_hash_to_a, 0);
rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0);
rb_define_alias(rb_cHash, "to_s", "inspect");
- rb_define_method(rb_cHash,"to_proc", rb_hash_to_proc, 0);
rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
@@ -4277,10 +3681,9 @@ Init_Hash(void)
rb_define_method(rb_cHash,"keys", rb_hash_keys, 0);
rb_define_method(rb_cHash,"values", rb_hash_values, 0);
rb_define_method(rb_cHash,"values_at", rb_hash_values_at, -1);
- rb_define_method(rb_cHash,"fetch_values", rb_hash_fetch_values, -1);
rb_define_method(rb_cHash,"shift", rb_hash_shift, 0);
- rb_define_method(rb_cHash,"delete", rb_hash_delete_m, 1);
+ rb_define_method(rb_cHash,"delete", rb_hash_delete, 1);
rb_define_method(rb_cHash,"delete_if", rb_hash_delete_if, 0);
rb_define_method(rb_cHash,"keep_if", rb_hash_keep_if, 0);
rb_define_method(rb_cHash,"select", rb_hash_select, 0);
@@ -4307,14 +3710,6 @@ Init_Hash(void)
rb_define_method(rb_cHash,"compare_by_identity", rb_hash_compare_by_id, 0);
rb_define_method(rb_cHash,"compare_by_identity?", rb_hash_compare_by_id_p, 0);
- rb_define_method(rb_cHash, "any?", rb_hash_any_p, 0);
- rb_define_method(rb_cHash, "dig", rb_hash_dig, -1);
-
- rb_define_method(rb_cHash, "<=", rb_hash_le, 1);
- rb_define_method(rb_cHash, "<", rb_hash_lt, 1);
- rb_define_method(rb_cHash, ">=", rb_hash_ge, 1);
- rb_define_method(rb_cHash, ">", rb_hash_gt, 1);
-
/* Document-class: ENV
*
* ENV is a hash-like accessor for environment variables.
diff --git a/id_table.c b/id_table.c
deleted file mode 100644
index 423b00669b..0000000000
--- a/id_table.c
+++ /dev/null
@@ -1,1583 +0,0 @@
-/* This file is included by symbol.c */
-
-#include "id_table.h"
-
-#ifndef ID_TABLE_DEBUG
-#define ID_TABLE_DEBUG 0
-#endif
-
-#if ID_TABLE_DEBUG == 0
-#define NDEBUG
-#endif
-#include <assert.h>
-
-/*
- * st
- * 0: using st with debug information.
- * 1: using st.
- * array
- * 11: simple array. ids = [ID1, ID2, ...], values = [val1, val2, ...]
- * 12: simple array, and use rb_id_serial_t instead of ID.
- * 13: simple array, and use rb_id_serial_t instead of ID. Swap recent access.
- * 14: sorted array, and use rb_id_serial_t instead of ID.
- * 15: sorted array, and use rb_id_serial_t instead of ID, linear small part.
- * hash
- * 21: funny falcon's Coalesced Hashing implementation [Feature #6962]
- * 22: simple open addressing with quadratic probing.
- * mix (array + hash)
- * 31: array(12) (capa <= 32) + hash(22)
- * 32: array(14) (capa <= 32) + hash(22)
- * 33: array(12) (capa <= 64) + hash(22)
- * 34: array(14) (capa <= 64) + hash(22)
- * 34: array(15) (capa <= 64) + hash(22)
- */
-
-#ifndef ID_TABLE_IMPL
-#define ID_TABLE_IMPL 34
-#endif
-
-#if ID_TABLE_IMPL == 0
-#define ID_TABLE_NAME st
-#define ID_TABLE_IMPL_TYPE struct st_id_table
-
-#define ID_TABLE_USE_ST 1
-#define ID_TABLE_USE_ST_DEBUG 1
-
-#elif ID_TABLE_IMPL == 1
-#define ID_TABLE_NAME st
-#define ID_TABLE_IMPL_TYPE struct st_id_table
-
-#define ID_TABLE_USE_ST 1
-#define ID_TABLE_USE_ST_DEBUG 0
-
-#elif ID_TABLE_IMPL == 11
-#define ID_TABLE_NAME list
-#define ID_TABLE_IMPL_TYPE struct list_id_table
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-
-#elif ID_TABLE_IMPL == 12
-#define ID_TABLE_NAME list
-#define ID_TABLE_IMPL_TYPE struct list_id_table
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#elif ID_TABLE_IMPL == 13
-#define ID_TABLE_NAME list
-#define ID_TABLE_IMPL_TYPE struct list_id_table
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_ID_SERIAL 1
-#define ID_TABLE_SWAP_RECENT_ACCESS 1
-
-#elif ID_TABLE_IMPL == 14
-#define ID_TABLE_NAME list
-#define ID_TABLE_IMPL_TYPE struct list_id_table
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_ID_SERIAL 1
-#define ID_TABLE_USE_LIST_SORTED 1
-
-#elif ID_TABLE_IMPL == 15
-#define ID_TABLE_NAME list
-#define ID_TABLE_IMPL_TYPE struct list_id_table
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_ID_SERIAL 1
-#define ID_TABLE_USE_LIST_SORTED 1
-#define ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE 1
-
-#elif ID_TABLE_IMPL == 21
-#define ID_TABLE_NAME hash
-#define ID_TABLE_IMPL_TYPE sa_table
-
-#define ID_TABLE_USE_COALESCED_HASHING 1
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#elif ID_TABLE_IMPL == 22
-#define ID_TABLE_NAME hash
-#define ID_TABLE_IMPL_TYPE struct hash_id_table
-
-#define ID_TABLE_USE_SMALL_HASH 1
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#elif ID_TABLE_IMPL == 31
-#define ID_TABLE_NAME mix
-#define ID_TABLE_IMPL_TYPE struct mix_id_table
-
-#define ID_TABLE_USE_MIX 1
-#define ID_TABLE_USE_MIX_LIST_MAX_CAPA 32
-
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_SMALL_HASH 1
-
-#elif ID_TABLE_IMPL == 32
-#define ID_TABLE_NAME mix
-#define ID_TABLE_IMPL_TYPE struct mix_id_table
-
-#define ID_TABLE_USE_MIX 1
-#define ID_TABLE_USE_MIX_LIST_MAX_CAPA 32
-
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_LIST_SORTED 1
-
-#define ID_TABLE_USE_SMALL_HASH 1
-
-#elif ID_TABLE_IMPL == 33
-#define ID_TABLE_NAME mix
-#define ID_TABLE_IMPL_TYPE struct mix_id_table
-
-#define ID_TABLE_USE_MIX 1
-#define ID_TABLE_USE_MIX_LIST_MAX_CAPA 64
-
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_SMALL_HASH 1
-
-#elif ID_TABLE_IMPL == 34
-#define ID_TABLE_NAME mix
-#define ID_TABLE_IMPL_TYPE struct mix_id_table
-
-#define ID_TABLE_USE_MIX 1
-#define ID_TABLE_USE_MIX_LIST_MAX_CAPA 64
-
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_LIST_SORTED 1
-
-#define ID_TABLE_USE_SMALL_HASH 1
-
-#elif ID_TABLE_IMPL == 35
-#define ID_TABLE_NAME mix
-#define ID_TABLE_IMPL_TYPE struct mix_id_table
-
-#define ID_TABLE_USE_MIX 1
-#define ID_TABLE_USE_MIX_LIST_MAX_CAPA 64
-
-#define ID_TABLE_USE_ID_SERIAL 1
-
-#define ID_TABLE_USE_LIST 1
-#define ID_TABLE_USE_CALC_VALUES 1
-#define ID_TABLE_USE_LIST_SORTED 1
-#define ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE 1
-
-#define ID_TABLE_USE_SMALL_HASH 1
-
-#else
-#error
-#endif
-
-#if ID_TABLE_SWAP_RECENT_ACCESS && ID_TABLE_USE_LIST_SORTED
-#error
-#endif
-
-/* IMPL(create) will be "hash_id_table_create" and so on */
-#define IMPL1(name, op) TOKEN_PASTE(name, _id##op) /* expand `name' */
-#define IMPL(op) IMPL1(ID_TABLE_NAME, _table##op) /* but prevent `op' */
-
-#ifdef __GNUC__
-# define UNUSED(func) static func __attribute__((unused))
-#else
-# define UNUSED(func) static func
-#endif
-
-UNUSED(ID_TABLE_IMPL_TYPE *IMPL(_create)(size_t));
-UNUSED(void IMPL(_free)(ID_TABLE_IMPL_TYPE *));
-UNUSED(void IMPL(_clear)(ID_TABLE_IMPL_TYPE *));
-UNUSED(size_t IMPL(_size)(const ID_TABLE_IMPL_TYPE *));
-UNUSED(size_t IMPL(_memsize)(const ID_TABLE_IMPL_TYPE *));
-UNUSED(int IMPL(_insert)(ID_TABLE_IMPL_TYPE *, ID, VALUE));
-UNUSED(int IMPL(_lookup)(ID_TABLE_IMPL_TYPE *, ID, VALUE *));
-UNUSED(int IMPL(_delete)(ID_TABLE_IMPL_TYPE *, ID));
-UNUSED(void IMPL(_foreach)(ID_TABLE_IMPL_TYPE *, rb_id_table_foreach_func_t *, void *));
-UNUSED(void IMPL(_foreach_values)(ID_TABLE_IMPL_TYPE *, rb_id_table_foreach_values_func_t *, void *));
-
-#if ID_TABLE_USE_ID_SERIAL
-typedef rb_id_serial_t id_key_t;
-static inline ID
-key2id(id_key_t key)
-{
- return rb_id_serial_to_id(key);
-}
-
-static inline id_key_t
-id2key(ID id)
-{
- return rb_id_to_serial(id);
-}
-#else /* ID_TABLE_USE_ID_SERIAL */
-
-typedef ID id_key_t;
-#define key2id(key) key
-#define id2key(id) id
-
-#endif /* ID_TABLE_USE_ID_SERIAL */
-
-/***************************************************************
- * 0: using st with debug information.
- * 1: using st.
- ***************************************************************/
-#if ID_TABLE_USE_ST
-#if ID_TABLE_USE_ST_DEBUG
-#define ID_TABLE_MARK 0x12345678
-
-struct st_id_table {
- struct st_table *st;
- unsigned int check;
-};
-
-static struct st_table *
-tbl2st(struct st_id_table *tbl)
-{
- if (tbl->check != ID_TABLE_MARK) rb_bug("tbl2st: check error %x", tbl->check);
- return tbl->st;
-}
-
-static struct st_id_table *
-st_id_table_create(size_t size)
-{
- struct st_id_table *tbl = ALLOC(struct st_id_table);
- tbl->st = st_init_numtable_with_size(size);
- tbl->check = ID_TABLE_MARK;
- return tbl;
-}
-
-static void
-st_id_table_free(struct st_id_table *tbl)
-{
- st_free_table(tbl->st);
- xfree(tbl);
-}
-
-#else /* ID_TABLE_USE_ST_DEBUG */
-
-struct st_id_table {
- struct st_table st;
-};
-
-static struct st_table *
-tbl2st(struct st_id_table *tbl)
-{
- return (struct st_table *)tbl;
-}
-
-static struct st_id_table *
-st_id_table_create(size_t size)
-{
- return (struct st_id_table *)st_init_numtable_with_size(size);
-}
-
-static void
-st_id_table_free(struct st_id_table *tbl)
-{
- st_free_table((struct st_table*)tbl);
-}
-
-#endif /* ID_TABLE_USE_ST_DEBUG */
-
-static void
-st_id_table_clear(struct st_id_table *tbl)
-{
- st_clear(tbl2st(tbl));
-}
-
-static size_t
-st_id_table_size(const struct st_id_table *tbl)
-{
- return tbl2st(tbl)->num_entries;
-}
-
-static size_t
-st_id_table_memsize(const struct st_id_table *tbl)
-{
- size_t header_size = ID_TABLE_USE_ST_DEBUG ? sizeof(struct st_id_table) : 0;
- return header_size + st_memsize(tbl2st(tbl));
-}
-
-static int
-st_id_table_lookup(struct st_id_table *tbl, ID id, VALUE *val)
-{
- return st_lookup(tbl2st(tbl), (st_data_t)id, (st_data_t *)val);
-}
-
-static int
-st_id_table_insert(struct st_id_table *tbl, ID id, VALUE val)
-{
- return st_insert(tbl2st(tbl), id, val);
-}
-
-static int
-st_id_table_delete(struct st_id_table *tbl, ID id)
-{
- return st_delete(tbl2st(tbl), (st_data_t *)&id, NULL);
-}
-
-static void
-st_id_table_foreach(struct st_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
-{
- st_foreach(tbl2st(tbl), (int (*)(ANYARGS))func, (st_data_t)data);
-}
-
-struct values_iter_data {
- rb_id_table_foreach_values_func_t *values_i;
- void *data;
-};
-
-static int
-each_values(st_data_t key, st_data_t val, st_data_t ptr)
-{
- struct values_iter_data *values_iter_data = (struct values_iter_data *)ptr;
- return values_iter_data->values_i(val, values_iter_data->data);
-}
-
-static void
-st_id_table_foreach_values(struct st_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
-{
- struct values_iter_data values_iter_data;
- values_iter_data.values_i = func;
- values_iter_data.data = data;
- st_foreach(tbl2st(tbl), each_values, (st_data_t)&values_iter_data);
-}
-#endif /* ID_TABLE_USE_ST */
-
-#if ID_TABLE_USE_LIST
-
-#define LIST_MIN_CAPA 4
-
-struct list_id_table {
- int capa;
- int num;
- id_key_t *keys;
-#if ID_TABLE_USE_CALC_VALUES == 0
- VALUE *values_;
-#endif
-};
-
-#if ID_TABLE_USE_CALC_VALUES
-#define TABLE_VALUES(tbl) ((VALUE *)((tbl)->keys + (tbl)->capa))
-#else
-#define TABLE_VALUES(tbl) (tbl)->values_
-#endif
-
-static struct list_id_table *
-list_id_table_init(struct list_id_table *tbl, size_t capa)
-{
- if (capa > 0) {
- tbl->capa = (int)capa;
-#if ID_TABLE_USE_CALC_VALUES
- tbl->keys = (id_key_t *)xmalloc(sizeof(id_key_t) * capa + sizeof(VALUE) * capa);
-#else
- tbl->keys = ALLOC_N(id_key_t, capa);
- tbl->values_ = ALLOC_N(VALUE, capa);
-#endif
- }
- return tbl;
-}
-
-#ifndef ID_TABLE_USE_MIX
-static struct list_id_table *
-list_id_table_create(size_t capa)
-{
- struct list_id_table *tbl = ZALLOC(struct list_id_table);
- return list_id_table_init(tbl, capa);
-}
-#endif
-
-static void
-list_id_table_free(struct list_id_table *tbl)
-{
- xfree(tbl->keys);
-#if ID_TABLE_USE_CALC_VALUES == 0
- xfree(tbl->values_);
-#endif
- xfree(tbl);
-}
-
-static void
-list_id_table_clear(struct list_id_table *tbl)
-{
- tbl->num = 0;
-}
-
-static size_t
-list_id_table_size(const struct list_id_table *tbl)
-{
- return (size_t)tbl->num;
-}
-
-static size_t
-list_id_table_memsize(const struct list_id_table *tbl)
-{
- return (sizeof(id_key_t) + sizeof(VALUE)) * tbl->capa + sizeof(struct list_id_table);
-}
-
-static void
-list_table_extend(struct list_id_table *tbl)
-{
- if (tbl->capa == tbl->num) {
- const int capa = tbl->capa == 0 ? LIST_MIN_CAPA : (tbl->capa * 2);
-
-#if ID_TABLE_USE_CALC_VALUES
- {
- VALUE *old_values, *new_values;
- VALUE *debug_values = NULL;
- const int num = tbl->num;
- const int size = sizeof(id_key_t) * capa + sizeof(VALUE) * capa;
- int i;
-
- if (num > 0) {
- VALUE *orig_values = (VALUE *)(tbl->keys + num);
- debug_values = ALLOC_N(VALUE, num);
-
- for (i=0; i<num; i++) {
- debug_values[i] = orig_values[i];
- }
-
- if (0)
- for (i=0; i< 2 * num; i++) {
- unsigned char *cs = (unsigned char *)&tbl->keys[i];
- size_t j;
- fprintf(stderr, ">> %3d | %p - ", i, cs);
- for (j=0; j<sizeof(VALUE); j++) {
- fprintf(stderr, "%x ", cs[j]);
- }
- fprintf(stderr, "\n");
- }
- }
-
- tbl->keys = (id_key_t *)xrealloc(tbl->keys, size);
- old_values = (VALUE *)(tbl->keys + num);
- new_values = (VALUE *)(tbl->keys + capa);
-
- /* [ keys (num) ] [ values (num) ]
- * ^ old_values
- * realloc =>
- * [ keys (capa = num * 2) ] [ values (capa = num * 2) ]
- * ^ new_values
- */
-
- /* memmove */
- if (0) {
- fprintf(stderr, "memmove: %p -> %p (%d, capa: %d)\n",
- old_values, new_values, num, capa);
- }
- assert(num < capa);
- assert(num == 0 || old_values < new_values);
-
- for (i=num-1; i>=0; i--) {
- new_values[i] = old_values[i];
- }
-
- if (num > 0) {
- for (i=0; i<num; i++) {
- assert(debug_values[i] == new_values[i]);
- }
- xfree(debug_values);
- }
- }
-
- tbl->capa = capa;
-#else
- tbl->capa = capa;
- tbl->keys = (id_key_t *)xrealloc(tbl->keys, sizeof(id_key_t) * capa);
- tbl->values_ = (VALUE *)xrealloc(tbl->values_, sizeof(VALUE) * capa);
-#endif
- }
-}
-
-#if ID_TABLE_DEBUG
-static void
-list_table_show(struct list_id_table *tbl)
-{
- const id_key_t *keys = tbl->keys;
- const int num = tbl->num;
- int i;
-
- fprintf(stderr, "tbl: %p (num: %d)\n", tbl, num);
- for (i=0; i<num; i++) {
- fprintf(stderr, " -> [%d] %s %d\n", i, rb_id2name(key2id(keys[i])), (int)keys[i]);
- }
-}
-#endif
-
-static void
-tbl_assert(struct list_id_table *tbl)
-{
-#if ID_TABLE_DEBUG
-#if ID_TABLE_USE_LIST_SORTED
- const id_key_t *keys = tbl->keys;
- const int num = tbl->num;
- int i;
-
- for (i=0; i<num-1; i++) {
- if (keys[i] >= keys[i+1]) {
- list_table_show(tbl);
- rb_bug(": not sorted.");
- }
- }
-#endif
-#endif
-}
-
-#if ID_TABLE_USE_LIST_SORTED
-static int
-list_ids_bsearch(const id_key_t *keys, id_key_t key, int num)
-{
- int p, min = 0, max = num;
-
-#if ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE
- if (num <= 64) {
- if (num > 32) {
- if (keys[num/2] <= key) {
- min = num/2;
- } else {
- max = num/2;
- }
- }
- for (p = min; p<num && keys[p] < key; p++) {
- assert(keys[p] != 0);
- }
- return (p<num && keys[p] == key) ? p : -p-1;
- }
-#endif /* ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE */
-
- while (1) {
- p = min + (max - min) / 2;
-
- if (min >= max) {
- break;
- }
- else {
- id_key_t kp = keys[p];
- assert(p < max);
- assert(p >= min);
-
- if (kp > key) max = p;
- else if (kp < key) min = p+1;
- else {
- assert(kp == key);
- assert(p >= 0);
- assert(p < num);
- return p;
- }
- }
- }
-
- assert(min == max);
- assert(min == p);
- return -p-1;
-}
-#endif /* ID_TABLE_USE_LIST_SORTED */
-
-static int
-list_table_index(struct list_id_table *tbl, id_key_t key)
-{
- const int num = tbl->num;
- const id_key_t *keys = tbl->keys;
-
-#if ID_TABLE_USE_LIST_SORTED
- return list_ids_bsearch(keys, key, num);
-#else /* ID_TABLE_USE_LIST_SORTED */
- int i;
-
- for (i=0; i<num; i++) {
- assert(keys[i] != 0);
-
- if (keys[i] == key) {
- return (int)i;
- }
- }
- return -1;
-#endif
-}
-
-static int
-list_id_table_lookup(struct list_id_table *tbl, ID id, VALUE *valp)
-{
- id_key_t key = id2key(id);
- int index = list_table_index(tbl, key);
-
- if (index >= 0) {
- *valp = TABLE_VALUES(tbl)[index];
-
-#if ID_TABLE_SWAP_RECENT_ACCESS
- if (index > 0) {
- VALUE *values = TABLE_VALUES(tbl);
- id_key_t tk = tbl->keys[index-1];
- VALUE tv = values[index-1];
- tbl->keys[index-1] = tbl->keys[index];
- tbl->keys[index] = tk;
- values[index-1] = values[index];
- values[index] = tv;
- }
-#endif /* ID_TABLE_SWAP_RECENT_ACCESS */
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-static int
-list_id_table_insert(struct list_id_table *tbl, ID id, VALUE val)
-{
- const id_key_t key = id2key(id);
- const int index = list_table_index(tbl, key);
-
- if (index >= 0) {
- TABLE_VALUES(tbl)[index] = val;
- }
- else {
- list_table_extend(tbl);
- {
- const int num = tbl->num++;
-#if ID_TABLE_USE_LIST_SORTED
- const int insert_index = -(index + 1);
- id_key_t *keys = tbl->keys;
- VALUE *values = TABLE_VALUES(tbl);
- int i;
-
- if (0) fprintf(stderr, "insert: %d into %d on\n", (int)key, insert_index);
-
- for (i=num; i>insert_index; i--) {
- keys[i] = keys[i-1];
- values[i] = values[i-1];
- }
- keys[i] = key;
- values[i] = val;
-
- tbl_assert(tbl);
-#else
- tbl->keys[num] = key;
- TABLE_VALUES(tbl)[num] = val;
-#endif
- }
- }
-
- return TRUE;
-}
-
-static int
-list_delete_index(struct list_id_table *tbl, id_key_t key, int index)
-{
- if (index >= 0) {
- VALUE *values = TABLE_VALUES(tbl);
-
-#if ID_TABLE_USE_LIST_SORTED
- int i;
- const int num = tbl->num;
- id_key_t *keys = tbl->keys;
-
- for (i=index+1; i<num; i++) { /* compaction */
- keys[i-1] = keys[i];
- values[i-1] = values[i];
- }
-#else
- tbl->keys[index] = tbl->keys[tbl->num-1];
- values[index] = values[tbl->num-1];
-#endif
- tbl->num--;
- tbl_assert(tbl);
-
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-static int
-list_id_table_delete(struct list_id_table *tbl, ID id)
-{
- const id_key_t key = id2key(id);
- int index = list_table_index(tbl, key);
- return list_delete_index(tbl, key, index);
-}
-
-#define FOREACH_LAST() do { \
- switch (ret) { \
- case ID_TABLE_CONTINUE: \
- case ID_TABLE_STOP: \
- break; \
- case ID_TABLE_DELETE: \
- list_delete_index(tbl, key, i); \
- values = TABLE_VALUES(tbl); \
- num = tbl->num; \
- i--; /* redo same index */ \
- break; \
- } \
-} while (0)
-
-static void
-list_id_table_foreach(struct list_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
-{
- int num = tbl->num;
- int i;
- const id_key_t *keys = tbl->keys;
- const VALUE *values = TABLE_VALUES(tbl);
-
- for (i=0; i<num; i++) {
- const id_key_t key = keys[i];
- enum rb_id_table_iterator_result ret = (*func)(key2id(key), values[i], data);
- assert(key != 0);
-
- FOREACH_LAST();
- if (ret == ID_TABLE_STOP) return;
- }
-}
-
-static void
-list_id_table_foreach_values(struct list_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
-{
- int num = tbl->num;
- int i;
- const id_key_t *keys = tbl->keys;
- VALUE *values = TABLE_VALUES(tbl);
-
- for (i=0; i<num; i++) {
- const id_key_t key = keys[i];
- enum rb_id_table_iterator_result ret = (*func)(values[i], data);
- assert(key != 0);
-
- FOREACH_LAST();
- if (ret == ID_TABLE_STOP) return;
- }
-}
-#endif /* ID_TABLE_USE_LIST */
-
-
-#if ID_TABLE_USE_COALESCED_HASHING
-/* implementation is based on
- * https://bugs.ruby-lang.org/issues/6962 by funny_falcon
- */
-
-typedef unsigned int sa_index_t;
-
-#define SA_EMPTY 0
-#define SA_LAST 1
-#define SA_OFFSET 2
-#define SA_MIN_SIZE 4
-
-typedef struct sa_entry {
- sa_index_t next;
- id_key_t key;
- VALUE value;
-} sa_entry;
-
-typedef struct {
- sa_index_t num_bins;
- sa_index_t num_entries;
- sa_index_t free_pos;
- sa_entry *entries;
-} sa_table;
-
-static void
-sa_init_table(register sa_table *table, sa_index_t num_bins)
-{
- if (num_bins) {
- table->num_entries = 0;
- table->entries = ZALLOC_N(sa_entry, num_bins);
- table->num_bins = num_bins;
- table->free_pos = num_bins;
- }
-}
-
-static sa_table*
-hash_id_table_create(size_t size)
-{
- sa_table* table = ZALLOC(sa_table);
- sa_init_table(table, (sa_index_t)size);
- return table;
-}
-
-static void
-hash_id_table_clear(sa_table *table)
-{
- xfree(table->entries);
- memset(table, 0, sizeof(sa_table));
-}
-
-static void
-hash_id_table_free(sa_table *table)
-{
- xfree(table->entries);
- xfree(table);
-}
-
-static size_t
-hash_id_table_memsize(const sa_table *table)
-{
- return sizeof(sa_table) + table->num_bins * sizeof (sa_entry);
-}
-
-static inline sa_index_t
-calc_pos(register sa_table* table, id_key_t key)
-{
- return key & (table->num_bins - 1);
-}
-
-static void
-fix_empty(register sa_table* table)
-{
- while (--table->free_pos &&
- table->entries[table->free_pos-1].next != SA_EMPTY);
-}
-
-#define FLOOR_TO_4 ((~((sa_index_t)0)) << 2)
-static sa_index_t
-find_empty(register sa_table* table, register sa_index_t pos)
-{
- sa_index_t new_pos = table->free_pos-1;
- sa_entry *entry;
- static const unsigned offsets[][3] = {
- {1, 2, 3},
- {2, 3, 0},
- {3, 1, 0},
- {2, 1, 0}
- };
- const unsigned *const check = offsets[pos&3];
- pos &= FLOOR_TO_4;
- entry = table->entries+pos;
-
- if (entry[check[0]].next == SA_EMPTY) { new_pos = pos + check[0]; goto check; }
- if (entry[check[1]].next == SA_EMPTY) { new_pos = pos + check[1]; goto check; }
- if (entry[check[2]].next == SA_EMPTY) { new_pos = pos + check[2]; goto check; }
-
- check:
- if (new_pos+1 == table->free_pos) fix_empty(table);
- return new_pos;
-}
-
-static void resize(register sa_table* table);
-static int insert_into_chain(register sa_table*, register id_key_t, st_data_t, sa_index_t pos);
-static int insert_into_main(register sa_table*, id_key_t, st_data_t, sa_index_t pos, sa_index_t prev_pos);
-
-static int
-sa_insert(register sa_table* table, id_key_t key, VALUE value)
-{
- register sa_entry *entry;
- sa_index_t pos, main_pos;
-
- if (table->num_bins == 0) {
- sa_init_table(table, SA_MIN_SIZE);
- }
-
- pos = calc_pos(table, key);
- entry = table->entries + pos;
-
- if (entry->next == SA_EMPTY) {
- entry->next = SA_LAST;
- entry->key = key;
- entry->value = value;
- table->num_entries++;
- if (pos+1 == table->free_pos) fix_empty(table);
- return 0;
- }
-
- if (entry->key == key) {
- entry->value = value;
- return 1;
- }
-
- if (table->num_entries + (table->num_entries >> 2) > table->num_bins) {
- resize(table);
- return sa_insert(table, key, value);
- }
-
- main_pos = calc_pos(table, entry->key);
- if (main_pos == pos) {
- return insert_into_chain(table, key, value, pos);
- }
- else {
- if (!table->free_pos) {
- resize(table);
- return sa_insert(table, key, value);
- }
- return insert_into_main(table, key, value, pos, main_pos);
- }
-}
-
-static int
-hash_id_table_insert(register sa_table* table, ID id, VALUE value)
-{
- return sa_insert(table, id2key(id), value);
-}
-
-static int
-insert_into_chain(register sa_table* table, id_key_t key, st_data_t value, sa_index_t pos)
-{
- sa_entry *entry = table->entries + pos, *new_entry;
- sa_index_t new_pos;
-
- while (entry->next != SA_LAST) {
- pos = entry->next - SA_OFFSET;
- entry = table->entries + pos;
- if (entry->key == key) {
- entry->value = value;
- return 1;
- }
- }
-
- if (!table->free_pos) {
- resize(table);
- return sa_insert(table, key, value);
- }
-
- new_pos = find_empty(table, pos);
- new_entry = table->entries + new_pos;
- entry->next = new_pos + SA_OFFSET;
-
- new_entry->next = SA_LAST;
- new_entry->key = key;
- new_entry->value = value;
- table->num_entries++;
- return 0;
-}
-
-static int
-insert_into_main(register sa_table* table, id_key_t key, st_data_t value, sa_index_t pos, sa_index_t prev_pos)
-{
- sa_entry *entry = table->entries + pos;
- sa_index_t new_pos = find_empty(table, pos);
- sa_entry *new_entry = table->entries + new_pos;
- sa_index_t npos;
-
- *new_entry = *entry;
-
- while((npos = table->entries[prev_pos].next - SA_OFFSET) != pos) {
- prev_pos = npos;
- }
- table->entries[prev_pos].next = new_pos + SA_OFFSET;
-
- entry->next = SA_LAST;
- entry->key = key;
- entry->value = value;
- table->num_entries++;
- return 0;
-}
-
-static sa_index_t
-new_size(sa_index_t num_entries)
-{
- sa_index_t size = num_entries >> 3;
- size |= size >> 1;
- size |= size >> 2;
- size |= size >> 4;
- size |= size >> 8;
- size |= size >> 16;
- return (size + 1) << 3;
-}
-
-static void
-resize(register sa_table *table)
-{
- sa_table tmp_table;
- sa_entry *entry;
- sa_index_t i;
-
- if (table->num_entries == 0) {
- xfree(table->entries);
- memset(table, 0, sizeof(sa_table));
- return;
- }
-
- sa_init_table(&tmp_table, new_size(table->num_entries + (table->num_entries >> 2)));
- entry = table->entries;
-
- for(i = 0; i < table->num_bins; i++, entry++) {
- if (entry->next != SA_EMPTY) {
- sa_insert(&tmp_table, entry->key, entry->value);
- }
- }
- xfree(table->entries);
- *table = tmp_table;
-}
-
-static int
-hash_id_table_lookup(register sa_table *table, ID id, VALUE *valuep)
-{
- register sa_entry *entry;
- id_key_t key = id2key(id);
-
- if (table->num_entries == 0) return 0;
-
- entry = table->entries + calc_pos(table, key);
- if (entry->next == SA_EMPTY) return 0;
-
- if (entry->key == key) goto found;
- if (entry->next == SA_LAST) return 0;
-
- entry = table->entries + (entry->next - SA_OFFSET);
- if (entry->key == key) goto found;
-
- while(entry->next != SA_LAST) {
- entry = table->entries + (entry->next - SA_OFFSET);
- if (entry->key == key) goto found;
- }
- return 0;
- found:
- if (valuep) *valuep = entry->value;
- return 1;
-}
-
-static size_t
-hash_id_table_size(const sa_table *table)
-{
- return table->num_entries;
-}
-
-static int
-hash_id_table_delete(sa_table *table, ID id)
-{
- sa_index_t pos, prev_pos = ~0;
- sa_entry *entry;
- id_key_t key = id2key(id);
-
- if (table->num_entries == 0) goto not_found;
-
- pos = calc_pos(table, key);
- entry = table->entries + pos;
-
- if (entry->next == SA_EMPTY) goto not_found;
-
- do {
- if (entry->key == key) {
- if (entry->next != SA_LAST) {
- sa_index_t npos = entry->next - SA_OFFSET;
- *entry = table->entries[npos];
- memset(table->entries + npos, 0, sizeof(sa_entry));
- }
- else {
- memset(table->entries + pos, 0, sizeof(sa_entry));
- if (~prev_pos) {
- table->entries[prev_pos].next = SA_LAST;
- }
- }
- table->num_entries--;
- if (table->num_entries < table->num_bins / 4) {
- resize(table);
- }
- return 1;
- }
- if (entry->next == SA_LAST) break;
- prev_pos = pos;
- pos = entry->next - SA_OFFSET;
- entry = table->entries + pos;
- } while(1);
-
- not_found:
- return 0;
-}
-
-enum foreach_type {
- foreach_key_values,
- foreach_values
-};
-
-static void
-hash_foreach(sa_table *table, enum rb_id_table_iterator_result (*func)(ANYARGS), void *arg, enum foreach_type type)
-{
- sa_index_t i;
-
- if (table->num_bins > 0) {
- for(i = 0; i < table->num_bins ; i++) {
- if (table->entries[i].next != SA_EMPTY) {
- id_key_t key = table->entries[i].key;
- st_data_t val = table->entries[i].value;
- enum rb_id_table_iterator_result ret;
-
- switch (type) {
- case foreach_key_values:
- ret = (*func)(key2id(key), val, arg);
- break;
- case foreach_values:
- ret = (*func)(val, arg);
- break;
- }
-
- switch (ret) {
- case ID_TABLE_DELETE:
- rb_warn("unsupported yet");
- break;
- default:
- break;
- }
- if (ret == ID_TABLE_STOP) break;
- }
- }
- }
-}
-
-static void
-hash_id_table_foreach(sa_table *table, enum rb_id_table_iterator_result (*func)(ID, VALUE, void *), void *arg)
-{
- hash_foreach(table, func, arg, foreach_key_values);
-}
-
-static void
-hash_id_table_foreach_values(sa_table *table, enum rb_id_table_iterator_result (*func)(VALUE, void *), void *arg)
-{
- hash_foreach(table, func, arg, foreach_values);
-}
-#endif /* ID_TABLE_USE_COALESCED_HASHING */
-
-#ifdef ID_TABLE_USE_SMALL_HASH
-/* simple open addressing with quadratic probing.
- uses mark-bit on collisions - need extra 1 bit,
- ID is strictly 3 bits larger than rb_id_serial_t */
-
-typedef struct rb_id_item {
- id_key_t key;
-#if SIZEOF_VALUE == 8
- int collision;
-#endif
- VALUE val;
-} item_t;
-
-struct hash_id_table {
- int capa;
- int num;
- int used;
- item_t *items;
-};
-
-#if SIZEOF_VALUE == 8
-#define ITEM_GET_KEY(tbl, i) ((tbl)->items[i].key)
-#define ITEM_KEY_ISSET(tbl, i) ((tbl)->items[i].key)
-#define ITEM_COLLIDED(tbl, i) ((tbl)->items[i].collision)
-#define ITEM_SET_COLLIDED(tbl, i) ((tbl)->items[i].collision = 1)
-static inline void
-ITEM_SET_KEY(struct hash_id_table *tbl, int i, id_key_t key)
-{
- tbl->items[i].key = key;
-}
-#else
-#define ITEM_GET_KEY(tbl, i) ((tbl)->items[i].key >> 1)
-#define ITEM_KEY_ISSET(tbl, i) ((tbl)->items[i].key > 1)
-#define ITEM_COLLIDED(tbl, i) ((tbl)->items[i].key & 1)
-#define ITEM_SET_COLLIDED(tbl, i) ((tbl)->items[i].key |= 1)
-static inline void
-ITEM_SET_KEY(struct hash_id_table *tbl, int i, id_key_t key)
-{
- tbl->items[i].key = (key << 1) | ITEM_COLLIDED(tbl, i);
-}
-#endif
-
-static inline int
-round_capa(int capa)
-{
- /* minsize is 4 */
- capa >>= 2;
- capa |= capa >> 1;
- capa |= capa >> 2;
- capa |= capa >> 4;
- capa |= capa >> 8;
- capa |= capa >> 16;
- return (capa + 1) << 2;
-}
-
-static struct hash_id_table *
-hash_id_table_init(struct hash_id_table *tbl, int capa)
-{
- MEMZERO(tbl, struct hash_id_table, 1);
- if (capa > 0) {
- capa = round_capa(capa);
- tbl->capa = (int)capa;
- tbl->items = ZALLOC_N(item_t, capa);
- }
- return tbl;
-}
-
-#ifndef ID_TABLE_USE_MIX
-static struct hash_id_table *
-hash_id_table_create(size_t capa)
-{
- struct hash_id_table *tbl = ALLOC(struct hash_id_table);
- return hash_id_table_init(tbl, (int)capa);
-}
-#endif
-
-static void
-hash_id_table_free(struct hash_id_table *tbl)
-{
- xfree(tbl->items);
- xfree(tbl);
-}
-
-static void
-hash_id_table_clear(struct hash_id_table *tbl)
-{
- tbl->num = 0;
- tbl->used = 0;
- MEMZERO(tbl->items, item_t, tbl->capa);
-}
-
-static size_t
-hash_id_table_size(const struct hash_id_table *tbl)
-{
- return (size_t)tbl->num;
-}
-
-static size_t
-hash_id_table_memsize(const struct hash_id_table *tbl)
-{
- return sizeof(item_t) * tbl->capa + sizeof(struct hash_id_table);
-}
-
-static int
-hash_table_index(struct hash_id_table* tbl, id_key_t key)
-{
- if (tbl->capa > 0) {
- int mask = tbl->capa - 1;
- int ix = key & mask;
- int d = 1;
- while (key != ITEM_GET_KEY(tbl, ix)) {
- if (!ITEM_COLLIDED(tbl, ix))
- return -1;
- ix = (ix + d) & mask;
- d++;
- }
- return ix;
- }
- return -1;
-}
-
-static void
-hash_table_raw_insert(struct hash_id_table *tbl, id_key_t key, VALUE val)
-{
- int mask = tbl->capa - 1;
- int ix = key & mask;
- int d = 1;
- assert(key != 0);
- while (ITEM_KEY_ISSET(tbl, ix)) {
- ITEM_SET_COLLIDED(tbl, ix);
- ix = (ix + d) & mask;
- d++;
- }
- tbl->num++;
- if (!ITEM_COLLIDED(tbl, ix)) {
- tbl->used++;
- }
- ITEM_SET_KEY(tbl, ix, key);
- tbl->items[ix].val = val;
-}
-
-static int
-hash_delete_index(struct hash_id_table *tbl, int ix)
-{
- if (ix >= 0) {
- if (!ITEM_COLLIDED(tbl, ix)) {
- tbl->used--;
- }
- tbl->num--;
- ITEM_SET_KEY(tbl, ix, 0);
- tbl->items[ix].val = 0;
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static void
-hash_table_extend(struct hash_id_table* tbl)
-{
- if (tbl->used + (tbl->used >> 1) >= tbl->capa) {
- int new_cap = round_capa(tbl->num + (tbl->num >> 1));
- int i;
- item_t* old;
- struct hash_id_table tmp_tbl = {0, 0, 0};
- if (new_cap < tbl->capa) {
- new_cap = round_capa(tbl->used + (tbl->used >> 1));
- }
- tmp_tbl.capa = new_cap;
- tmp_tbl.items = ZALLOC_N(item_t, new_cap);
- for (i = 0; i < tbl->capa; i++) {
- id_key_t key = ITEM_GET_KEY(tbl, i);
- if (key != 0) {
- hash_table_raw_insert(&tmp_tbl, key, tbl->items[i].val);
- }
- }
- old = tbl->items;
- *tbl = tmp_tbl;
- xfree(old);
- }
-}
-
-#if ID_TABLE_DEBUG && 0
-static void
-hash_table_show(struct hash_id_table *tbl)
-{
- const id_key_t *keys = tbl->keys;
- const int capa = tbl->capa;
- int i;
-
- fprintf(stderr, "tbl: %p (capa: %d, num: %d, used: %d)\n", tbl, tbl->capa, tbl->num, tbl->used);
- for (i=0; i<capa; i++) {
- if (ITEM_KEY_ISSET(tbl, i)) {
- fprintf(stderr, " -> [%d] %s %d\n", i, rb_id2name(key2id(keys[i])), (int)keys[i]);
- }
- }
-}
-#endif
-
-static int
-hash_id_table_lookup(struct hash_id_table *tbl, ID id, VALUE *valp)
-{
- id_key_t key = id2key(id);
- int index = hash_table_index(tbl, key);
-
- if (index >= 0) {
- *valp = tbl->items[index].val;
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-static int
-hash_id_table_insert_key(struct hash_id_table *tbl, const id_key_t key, const VALUE val)
-{
- const int index = hash_table_index(tbl, key);
-
- if (index >= 0) {
- tbl->items[index].val = val;
- }
- else {
- hash_table_extend(tbl);
- hash_table_raw_insert(tbl, key, val);
- }
- return TRUE;
-}
-
-static int
-hash_id_table_insert(struct hash_id_table *tbl, ID id, VALUE val)
-{
- return hash_id_table_insert_key(tbl, id2key(id), val);
-}
-
-static int
-hash_id_table_delete(struct hash_id_table *tbl, ID id)
-{
- const id_key_t key = id2key(id);
- int index = hash_table_index(tbl, key);
- return hash_delete_index(tbl, index);
-}
-
-static void
-hash_id_table_foreach(struct hash_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
-{
- int i, capa = tbl->capa;
-
- for (i=0; i<capa; i++) {
- if (ITEM_KEY_ISSET(tbl, i)) {
- const id_key_t key = ITEM_GET_KEY(tbl, i);
- enum rb_id_table_iterator_result ret = (*func)(key2id(key), tbl->items[i].val, data);
- assert(key != 0);
-
- if (ret == ID_TABLE_DELETE)
- hash_delete_index(tbl, i);
- else if (ret == ID_TABLE_STOP)
- return;
- }
- }
-}
-
-static void
-hash_id_table_foreach_values(struct hash_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
-{
- int i, capa = tbl->capa;
-
- for (i=0; i<capa; i++) {
- if (ITEM_KEY_ISSET(tbl, i)) {
- enum rb_id_table_iterator_result ret = (*func)(tbl->items[i].val, data);
-
- if (ret == ID_TABLE_DELETE)
- hash_delete_index(tbl, i);
- else if (ret == ID_TABLE_STOP)
- return;
- }
- }
-}
-#endif /* ID_TABLE_USE_SMALL_HASH */
-
-#if ID_TABLE_USE_MIX
-
-struct mix_id_table {
- union {
- struct {
- int capa;
- int num;
- } size;
- struct list_id_table list;
- struct hash_id_table hash;
- } aux;
-};
-
-#define LIST_LIMIT_P(mix) ((mix)->aux.size.num == ID_TABLE_USE_MIX_LIST_MAX_CAPA)
-#define LIST_P(mix) ((mix)->aux.size.capa <= ID_TABLE_USE_MIX_LIST_MAX_CAPA)
-
-static struct mix_id_table *
-mix_id_table_create(size_t size)
-{
- struct mix_id_table *mix = ZALLOC(struct mix_id_table);
- list_id_table_init((struct list_id_table *)mix, size);
- return mix;
-}
-
-static void
-mix_id_table_free(struct mix_id_table *tbl)
-{
- if (LIST_P(tbl)) list_id_table_free(&tbl->aux.list);
- else hash_id_table_free(&tbl->aux.hash);
-}
-
-static void
-mix_id_table_clear(struct mix_id_table *tbl)
-{
- if (LIST_P(tbl)) list_id_table_clear(&tbl->aux.list);
- else hash_id_table_clear(&tbl->aux.hash);
-}
-
-static size_t
-mix_id_table_size(const struct mix_id_table *tbl)
-{
- if (LIST_P(tbl)) return list_id_table_size(&tbl->aux.list);
- else return hash_id_table_size(&tbl->aux.hash);
-}
-
-static size_t
-mix_id_table_memsize(const struct mix_id_table *tbl)
-{
- if (LIST_P(tbl)) return list_id_table_memsize(&tbl->aux.list) - sizeof(struct list_id_table) + sizeof(struct mix_id_table);
- else return hash_id_table_memsize(&tbl->aux.hash);
-}
-
-static int
-mix_id_table_insert(struct mix_id_table *tbl, ID id, VALUE val)
-{
- int r;
-
- if (LIST_P(tbl)) {
- if (!LIST_LIMIT_P(tbl)) {
- r = list_id_table_insert(&tbl->aux.list, id, val);
- }
- else {
- /* convert to hash */
- /* overflow. TODO: this promotion should be done in list_extend_table */
- struct list_id_table *list = &tbl->aux.list;
- struct hash_id_table hash_body;
- id_key_t *keys = list->keys;
- VALUE *values = TABLE_VALUES(list);
- const int num = list->num;
- int i;
-
- hash_id_table_init(&hash_body, 0);
-
- for (i=0; i<num; i++) {
- /* note that GC can run */
- hash_id_table_insert_key(&hash_body, keys[i], values[i]);
- }
-
- tbl->aux.hash = hash_body;
-
- /* free list keys/values */
- xfree(keys);
-#if ID_TABLE_USE_CALC_VALUES == 0
- xfree(values);
-#endif
- goto hash_insert;
- }
- }
- else {
- hash_insert:
- r = hash_id_table_insert(&tbl->aux.hash, id, val);
- assert(!LIST_P(tbl));
- }
- return r;
-}
-
-static int
-mix_id_table_lookup(struct mix_id_table *tbl, ID id, VALUE *valp)
-{
- if (LIST_P(tbl)) return list_id_table_lookup(&tbl->aux.list, id, valp);
- else return hash_id_table_lookup(&tbl->aux.hash, id, valp);
-}
-
-static int
-mix_id_table_delete(struct mix_id_table *tbl, ID id)
-{
- if (LIST_P(tbl)) return list_id_table_delete(&tbl->aux.list, id);
- else return hash_id_table_delete(&tbl->aux.hash, id);
-}
-
-static void
-mix_id_table_foreach(struct mix_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
-{
- if (LIST_P(tbl)) list_id_table_foreach(&tbl->aux.list, func, data);
- else hash_id_table_foreach(&tbl->aux.hash, func, data);
-}
-
-static void
-mix_id_table_foreach_values(struct mix_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
-{
- if (LIST_P(tbl)) list_id_table_foreach_values(&tbl->aux.list, func, data);
- else hash_id_table_foreach_values(&tbl->aux.hash, func, data);
-}
-
-#endif /* ID_TABLE_USE_MIX */
-
-#define IMPL_TYPE1(type, prot, name, args) \
- RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args)
-#define IMPL_TYPE(type, name, prot, args) \
- IMPL_TYPE1(type, rb_id_table_##name prot, IMPL(_##name), args)
-#define IMPL_VOID1(prot, name, args) \
- RUBY_ALIAS_FUNCTION_VOID(prot, name, args)
-#define IMPL_VOID(name, prot, args) \
- IMPL_VOID1(rb_id_table_##name prot, IMPL(_##name), args)
-#define id_tbl (ID_TABLE_IMPL_TYPE *)tbl
-
-IMPL_TYPE(struct rb_id_table *, create, (size_t size), (size))
-IMPL_VOID(free, (struct rb_id_table *tbl), (id_tbl))
-IMPL_VOID(clear, (struct rb_id_table *tbl), (id_tbl))
-IMPL_TYPE(size_t, size, (const struct rb_id_table *tbl), (id_tbl))
-IMPL_TYPE(size_t, memsize, (const struct rb_id_table *tbl), (id_tbl))
-
-IMPL_TYPE(int , insert, (struct rb_id_table *tbl, ID id, VALUE val),
- (id_tbl, id, val))
-IMPL_TYPE(int, lookup, (struct rb_id_table *tbl, ID id, VALUE *valp),
- (id_tbl, id, valp))
-IMPL_TYPE(int, delete, (struct rb_id_table *tbl, ID id),
- (id_tbl, id))
-
-IMPL_VOID(foreach,
- (struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, void *data),
- (id_tbl, func, data))
-IMPL_VOID(foreach_values,
- (struct rb_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data),
- (id_tbl, func, data))
-
-#if ID_TABLE_STARTUP_SIG
-__attribute__((constructor))
-static void
-show_impl(void)
-{
- fprintf(stderr, "impl: %d\n", ID_TABLE_IMPL);
-}
-#endif
diff --git a/id_table.h b/id_table.h
deleted file mode 100644
index 4b4eb6fd70..0000000000
--- a/id_table.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef RUBY_ID_TABLE_H
-#define RUBY_ID_TABLE_H 1
-#include "ruby/ruby.h"
-
-struct rb_id_table;
-
-/* compatible with ST_* */
-enum rb_id_table_iterator_result {
- ID_TABLE_CONTINUE = ST_CONTINUE,
- ID_TABLE_STOP = ST_STOP,
- ID_TABLE_DELETE = ST_DELETE,
-};
-
-struct rb_id_table *rb_id_table_create(size_t size);
-void rb_id_table_free(struct rb_id_table *tbl);
-void rb_id_table_clear(struct rb_id_table *tbl);
-
-size_t rb_id_table_size(const struct rb_id_table *tbl);
-size_t rb_id_table_memsize(const struct rb_id_table *tbl);
-
-int rb_id_table_insert(struct rb_id_table *tbl, ID id, VALUE val);
-int rb_id_table_lookup(struct rb_id_table *tbl, ID id, VALUE *valp);
-int rb_id_table_delete(struct rb_id_table *tbl, ID id);
-
-typedef enum rb_id_table_iterator_result rb_id_table_foreach_func_t(ID id, VALUE val, void *data);
-typedef enum rb_id_table_iterator_result rb_id_table_foreach_values_func_t(VALUE val, void *data);
-void rb_id_table_foreach(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, void *data);
-void rb_id_table_foreach_values(struct rb_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data);
-
-#endif /* RUBY_ID_TABLE_H */
diff --git a/include/ruby/backward/classext.h b/include/ruby/backward/classext.h
index 9d5747316a..615e6f6858 100644
--- a/include/ruby/backward/classext.h
+++ b/include/ruby/backward/classext.h
@@ -1,6 +1,6 @@
#if defined __GNUC__
#warning use of RClass internals is deprecated
-#elif defined _MSC_VER
+#elif defined _MSC_VER || defined __BORLANDC__
#pragma message("warning: use of RClass internals is deprecated")
#endif
@@ -13,6 +13,6 @@ typedef struct rb_deprecated_classext_struct {
#undef RCLASS_SUPER(c)
#define RCLASS_EXT(c) ((rb_deprecated_classext_t *)RCLASS(c)->ptr)
-#define RCLASS_SUPER(c) (RCLASS(c)->super)
+#define RCLASS_SUPER(c) (RCLASS_EXT(c)->super)
#endif /* RUBY_BACKWARD_CLASSEXT_H */
diff --git a/include/ruby/backward/rubyio.h b/include/ruby/backward/rubyio.h
index a6e3a7c78b..d5246db546 100644
--- a/include/ruby/backward/rubyio.h
+++ b/include/ruby/backward/rubyio.h
@@ -1,6 +1,6 @@
#if defined __GNUC__
#warning use "ruby/io.h" instead of "rubyio.h"
-#elif defined _MSC_VER
+#elif defined _MSC_VER || defined __BORLANDC__
#pragma message("warning: use \"ruby/io.h\" instead of \"rubyio.h\"")
#endif
#include "ruby/io.h"
diff --git a/include/ruby/backward/rubysig.h b/include/ruby/backward/rubysig.h
index 58b13cab1c..945a09a8c8 100644
--- a/include/ruby/backward/rubysig.h
+++ b/include/ruby/backward/rubysig.h
@@ -12,7 +12,7 @@
#if defined __GNUC__
#warning rubysig.h is obsolete
-#elif defined _MSC_VER
+#elif defined _MSC_VER || defined __BORLANDC__
#pragma message("warning: rubysig.h is obsolete")
#endif
@@ -29,6 +29,11 @@ extern "C" {
RUBY_SYMBOL_EXPORT_BEGIN
+struct rb_blocking_region_buffer;
+DEPRECATED(RUBY_EXTERN struct rb_blocking_region_buffer *rb_thread_blocking_region_begin(void));
+DEPRECATED(RUBY_EXTERN void rb_thread_blocking_region_end(struct rb_blocking_region_buffer *));
+#define TRAP_BEG do {struct rb_blocking_region_buffer *__region = rb_thread_blocking_region_begin();
+#define TRAP_END rb_thread_blocking_region_end(__region);} while (0)
#define RUBY_CRITICAL(statements) do {statements;} while (0)
#define DEFER_INTS (0)
#define ENABLE_INTS (1)
diff --git a/include/ruby/backward/st.h b/include/ruby/backward/st.h
index 3e36d44cf8..514128e616 100644
--- a/include/ruby/backward/st.h
+++ b/include/ruby/backward/st.h
@@ -1,6 +1,6 @@
#if defined __GNUC__
#warning use "ruby/st.h" instead of bare "st.h"
-#elif defined _MSC_VER
+#elif defined _MSC_VER || defined __BORLANDC__
#pragma message("warning: use \"ruby/st.h\" instead of bare \"st.h\"")
#endif
#include "ruby/st.h"
diff --git a/include/ruby/backward/util.h b/include/ruby/backward/util.h
index 11d32a2da8..6b47940ddc 100644
--- a/include/ruby/backward/util.h
+++ b/include/ruby/backward/util.h
@@ -1,6 +1,6 @@
#if defined __GNUC__
#warning use "ruby/util.h" instead of bare "util.h"
-#elif defined _MSC_VER
+#elif defined _MSC_VER || defined __BORLANDC__
#pragma message("warning: use \"ruby/util.h\" instead of bare \"util.h\"")
#endif
#include "ruby/util.h"
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index b4d75294d4..3327e69123 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -112,7 +112,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
#define xrealloc2 ruby_xrealloc2
#define xfree ruby_xfree
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
# define RUBY_ATTR_ALLOC_SIZE(params) __attribute__ ((__alloc_size__ params))
#else
# define RUBY_ATTR_ALLOC_SIZE(params)
@@ -143,16 +143,67 @@ void xfree(void*);
# define SIZEOF_LONG_LONG SIZEOF___INT64
#endif
+#ifndef BDIGIT
+# if defined(HAVE_INT64_T) && defined(HAVE_INT128_T)
+# define BDIGIT uint64_t
+# define SIZEOF_BDIGITS SIZEOF_INT64_T
+# define BDIGIT_DBL uint128_t
+# define BDIGIT_DBL_SIGNED int128_t
+# define PRI_BDIGIT_PREFIX PRI_64_PREFIX
+# elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+# define BDIGIT unsigned int
+# define SIZEOF_BDIGITS SIZEOF_INT
+# define BDIGIT_DBL unsigned LONG_LONG
+# define BDIGIT_DBL_SIGNED LONG_LONG
+# define PRI_BDIGIT_PREFIX ""
+# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
+# elif SIZEOF_INT*2 <= SIZEOF_LONG
+# define BDIGIT unsigned int
+# define SIZEOF_BDIGITS SIZEOF_INT
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+# define PRI_BDIGIT_PREFIX ""
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# elif SIZEOF_SHORT*2 <= SIZEOF_LONG
+# define BDIGIT unsigned short
+# define SIZEOF_BDIGITS SIZEOF_SHORT
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+# define PRI_BDIGIT_PREFIX "h"
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# else
+# define BDIGIT unsigned short
+# define SIZEOF_BDIGITS (SIZEOF_LONG/2)
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+# define PRI_BDIGIT_PREFIX "h"
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# endif
+#endif
+
+#ifdef PRI_BDIGIT_PREFIX
+# define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
+# define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
+# define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
+# define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
+# define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
+# define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
+#endif
+
+#ifdef PRI_BDIGIT_DBL_PREFIX
+# define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
+# define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
+# define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
+# define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
+# define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
+# define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
+#endif
+
#ifdef __CYGWIN__
#undef _WIN32
#endif
-#if defined(_WIN32)
-/*
- DOSISH mean MS-Windows style filesystem.
- But you should use more precise macros like DOSISH_DRIVE_LETTER, PATH_SEP,
- ENV_IGNORECASE or CASEFOLD_FILESYSTEM.
- */
+#if defined(_WIN32) || defined(__EMX__)
#define DOSISH 1
# define DOSISH_DRIVE_LETTER
#endif
@@ -168,6 +219,15 @@ void xfree(void*);
#include "ruby/win32.h"
#endif
+#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
+#include <net/socket.h> /* intern.h needs fd_set definition */
+#endif
+
+#ifdef __SYMBIAN32__
+# define FALSE 0
+# define TRUE 1
+#endif
+
#ifdef RUBY_EXPORT
#undef RUBY_EXTERN
@@ -221,7 +281,7 @@ void rb_ia64_flushrs(void);
#define PATH_ENV "PATH"
-#if defined(DOSISH)
+#if defined(DOSISH) && !defined(__EMX__)
#define ENV_IGNORECASE
#endif
@@ -241,46 +301,19 @@ void rb_ia64_flushrs(void);
#define RUBY_PLATFORM "unknown-unknown"
#endif
-#ifndef FUNC_MINIMIZED
-#define FUNC_MINIMIZED(x) x
-#endif
-#ifndef FUNC_UNOPTIMIZED
-#define FUNC_UNOPTIMIZED(x) x
-#endif
#ifndef RUBY_ALIAS_FUNCTION_TYPE
#define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
- FUNC_MINIMIZED(type prot) {return (type)name args;}
+ type prot {return name args;}
#endif
#ifndef RUBY_ALIAS_FUNCTION_VOID
#define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
- FUNC_MINIMIZED(void prot) {name args;}
+ void prot {name args;}
#endif
#ifndef RUBY_ALIAS_FUNCTION
#define RUBY_ALIAS_FUNCTION(prot, name, args) \
RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
#endif
-#ifndef UNALIGNED_WORD_ACCESS
-# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
- defined(__powerpc64__) || \
- defined(__mc68020__)
-# define UNALIGNED_WORD_ACCESS 1
-# else
-# define UNALIGNED_WORD_ACCESS 0
-# endif
-#endif
-#ifndef PACKED_STRUCT
-# define PACKED_STRUCT(x) x
-#endif
-#ifndef PACKED_STRUCT_UNALIGNED
-# if UNALIGNED_WORD_ACCESS
-# define PACKED_STRUCT_UNALIGNED(x) PACKED_STRUCT(x)
-# else
-# define PACKED_STRUCT_UNALIGNED(x) x
-# endif
-#endif
-
RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index 5ea2cda116..1c5d8da015 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -24,113 +24,72 @@ extern "C" {
RUBY_SYMBOL_EXPORT_BEGIN
-enum ruby_encoding_consts {
- RUBY_ENCODING_INLINE_MAX = 127,
- RUBY_ENCODING_SHIFT = (RUBY_FL_USHIFT+10),
- RUBY_ENCODING_MASK = (RUBY_ENCODING_INLINE_MAX<<RUBY_ENCODING_SHIFT
- /* RUBY_FL_USER10..RUBY_FL_USER16 */),
- RUBY_ENCODING_MAXNAMELEN = 42
-};
-
-#define ENCODING_INLINE_MAX RUBY_ENCODING_INLINE_MAX
-#define ENCODING_SHIFT RUBY_ENCODING_SHIFT
-#define ENCODING_MASK RUBY_ENCODING_MASK
-
-#define RB_ENCODING_SET_INLINED(obj,i) do {\
- RBASIC(obj)->flags &= ~RUBY_ENCODING_MASK;\
- RBASIC(obj)->flags |= (VALUE)(i) << RUBY_ENCODING_SHIFT;\
+#define ENCODING_INLINE_MAX 127
+#define ENCODING_SHIFT (FL_USHIFT+10)
+#define ENCODING_MASK (((VALUE)ENCODING_INLINE_MAX)<<ENCODING_SHIFT) /* FL_USER10|FL_USER11|FL_USER12|FL_USER13|FL_USER14|FL_USER15|FL_USER16 */
+
+#define ENCODING_SET_INLINED(obj,i) do {\
+ RBASIC(obj)->flags &= ~ENCODING_MASK;\
+ RBASIC(obj)->flags |= (VALUE)(i) << ENCODING_SHIFT;\
} while (0)
-#define RB_ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
+#define ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
-#define RB_ENCODING_GET_INLINED(obj) \
- (int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
-#define RB_ENCODING_GET(obj) \
- (RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
- RB_ENCODING_GET_INLINED(obj) : \
+#define ENCODING_GET_INLINED(obj) (int)((RBASIC(obj)->flags & ENCODING_MASK)>>ENCODING_SHIFT)
+#define ENCODING_GET(obj) \
+ (ENCODING_GET_INLINED(obj) != ENCODING_INLINE_MAX ? \
+ ENCODING_GET_INLINED(obj) : \
rb_enc_get_index(obj))
-#define RB_ENCODING_IS_ASCII8BIT(obj) (RB_ENCODING_GET_INLINED(obj) == 0)
-
-#define ENCODING_SET_INLINED(obj,i) RB_ENCODING_SET_INLINED(obj,i)
-#define ENCODING_SET(obj,i) RB_ENCODING_SET(obj,i)
-#define ENCODING_GET_INLINED(obj) RB_ENCODING_GET_INLINED(obj)
-#define ENCODING_GET(obj) RB_ENCODING_GET(obj)
-#define ENCODING_IS_ASCII8BIT(obj) RB_ENCODING_IS_ASCII8BIT(obj)
-#define ENCODING_MAXNAMELEN RUBY_ENCODING_MAXNAMELEN
-
-enum ruby_coderange_type {
- RUBY_ENC_CODERANGE_UNKNOWN = 0,
- RUBY_ENC_CODERANGE_7BIT = ((int)RUBY_FL_USER8),
- RUBY_ENC_CODERANGE_VALID = ((int)RUBY_FL_USER9),
- RUBY_ENC_CODERANGE_BROKEN = ((int)(RUBY_FL_USER8|RUBY_FL_USER9)),
- RUBY_ENC_CODERANGE_MASK = (RUBY_ENC_CODERANGE_7BIT|
- RUBY_ENC_CODERANGE_VALID|
- RUBY_ENC_CODERANGE_BROKEN)
-};
+#define ENCODING_IS_ASCII8BIT(obj) (ENCODING_GET_INLINED(obj) == 0)
-static inline int
-rb_enc_coderange_clean_p(int cr)
-{
- return (cr ^ (cr >> 1)) & RUBY_ENC_CODERANGE_7BIT;
-}
-#define RB_ENC_CODERANGE_CLEAN_P(cr) rb_enc_coderange_clean_p(cr)
-#define RB_ENC_CODERANGE(obj) ((int)RBASIC(obj)->flags & RUBY_ENC_CODERANGE_MASK)
-#define RB_ENC_CODERANGE_ASCIIONLY(obj) (RB_ENC_CODERANGE(obj) == RUBY_ENC_CODERANGE_7BIT)
-#define RB_ENC_CODERANGE_SET(obj,cr) (\
- RBASIC(obj)->flags = \
- (RBASIC(obj)->flags & ~RUBY_ENC_CODERANGE_MASK) | (cr))
-#define RB_ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_SET((obj),0)
+#define ENCODING_MAXNAMELEN 42
+
+#define ENC_CODERANGE_MASK ((int)(FL_USER8|FL_USER9))
+#define ENC_CODERANGE_UNKNOWN 0
+#define ENC_CODERANGE_7BIT ((int)FL_USER8)
+#define ENC_CODERANGE_VALID ((int)FL_USER9)
+#define ENC_CODERANGE_BROKEN ((int)(FL_USER8|FL_USER9))
+#define ENC_CODERANGE(obj) ((int)RBASIC(obj)->flags & ENC_CODERANGE_MASK)
+#define ENC_CODERANGE_ASCIIONLY(obj) (ENC_CODERANGE(obj) == ENC_CODERANGE_7BIT)
+#define ENC_CODERANGE_SET(obj,cr) (RBASIC(obj)->flags = \
+ (RBASIC(obj)->flags & ~ENC_CODERANGE_MASK) | (cr))
+#define ENC_CODERANGE_CLEAR(obj) ENC_CODERANGE_SET((obj),0)
/* assumed ASCII compatibility */
-#define RB_ENC_CODERANGE_AND(a, b) \
- ((a) == RUBY_ENC_CODERANGE_7BIT ? (b) : \
- (a) != RUBY_ENC_CODERANGE_VALID ? RUBY_ENC_CODERANGE_UNKNOWN : \
- (b) == RUBY_ENC_CODERANGE_7BIT ? RUBY_ENC_CODERANGE_VALID : (b))
+#define ENC_CODERANGE_AND(a, b) \
+ ((a) == ENC_CODERANGE_7BIT ? (b) : \
+ (a) == ENC_CODERANGE_VALID ? ((b) == ENC_CODERANGE_7BIT ? ENC_CODERANGE_VALID : (b)) : \
+ ENC_CODERANGE_UNKNOWN)
-#define RB_ENCODING_CODERANGE_SET(obj, encindex, cr) \
+#define ENCODING_CODERANGE_SET(obj, encindex, cr) \
do { \
VALUE rb_encoding_coderange_obj = (obj); \
- RB_ENCODING_SET(rb_encoding_coderange_obj, (encindex)); \
- RB_ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \
+ ENCODING_SET(rb_encoding_coderange_obj, (encindex)); \
+ ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \
} while (0)
-#define ENC_CODERANGE_MASK RUBY_ENC_CODERANGE_MASK
-#define ENC_CODERANGE_UNKNOWN RUBY_ENC_CODERANGE_UNKNOWN
-#define ENC_CODERANGE_7BIT RUBY_ENC_CODERANGE_7BIT
-#define ENC_CODERANGE_VALID RUBY_ENC_CODERANGE_VALID
-#define ENC_CODERANGE_BROKEN RUBY_ENC_CODERANGE_BROKEN
-#define ENC_CODERANGE_CLEAN_P(cr) RB_ENC_CODERANGE_CLEAN_P(cr)
-#define ENC_CODERANGE(obj) RB_ENC_CODERANGE(obj)
-#define ENC_CODERANGE_ASCIIONLY(obj) RB_ENC_CODERANGE_ASCIIONLY(obj)
-#define ENC_CODERANGE_SET(obj,cr) RB_ENC_CODERANGE_SET(obj,cr)
-#define ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_CLEAR(obj)
-#define ENC_CODERANGE_AND(a, b) RB_ENC_CODERANGE_AND(a, b)
-#define ENCODING_CODERANGE_SET(obj, encindex, cr) RB_ENCODING_CODERANGE_SET(obj, encindex, cr)
-
-typedef const OnigEncodingType rb_encoding;
+typedef OnigEncodingType rb_encoding;
int rb_char_to_option_kcode(int c, int *option, int *kcode);
int rb_enc_replicate(const char *, rb_encoding *);
int rb_define_dummy_encoding(const char *);
-int rb_enc_dummy_p(rb_encoding *enc);
-int rb_enc_to_index(rb_encoding *enc);
+#define rb_enc_to_index(enc) ((enc) ? ENC_TO_ENCINDEX(enc) : 0)
int rb_enc_get_index(VALUE obj);
void rb_enc_set_index(VALUE obj, int encindex);
int rb_enc_find_index(const char *name);
int rb_to_encoding_index(VALUE);
-rb_encoding *rb_to_encoding(VALUE);
-rb_encoding *rb_find_encoding(VALUE);
-rb_encoding *rb_enc_get(VALUE);
-rb_encoding *rb_enc_compatible(VALUE,VALUE);
-rb_encoding *rb_enc_check(VALUE,VALUE);
+rb_encoding* rb_to_encoding(VALUE);
+rb_encoding* rb_find_encoding(VALUE);
+rb_encoding* rb_enc_get(VALUE);
+rb_encoding* rb_enc_compatible(VALUE,VALUE);
+rb_encoding* rb_enc_check(VALUE,VALUE);
VALUE rb_enc_associate_index(VALUE, int);
VALUE rb_enc_associate(VALUE, rb_encoding*);
void rb_enc_copy(VALUE dst, VALUE src);
VALUE rb_enc_str_new(const char*, long, rb_encoding*);
VALUE rb_enc_str_new_cstr(const char*, rb_encoding*);
-VALUE rb_enc_str_new_static(const char*, long, rb_encoding*);
VALUE rb_enc_reg_new(const char*, long, rb_encoding*, int);
PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3);
VALUE rb_enc_vsprintf(rb_encoding *, const char*, va_list);
@@ -146,16 +105,10 @@ VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to);
VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts);
#if defined(__GNUC__) && !defined(__PCC__)
-#define rb_enc_str_new(str, len, enc) __extension__ ( \
-{ \
- (__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
- rb_enc_str_new_static((str), (len), (enc)) : \
- rb_enc_str_new((str), (len), (enc)); \
-})
#define rb_enc_str_new_cstr(str, enc) __extension__ ( \
{ \
(__builtin_constant_p(str)) ? \
- rb_enc_str_new_static((str), (long)strlen(str), (enc)) : \
+ rb_enc_str_new((str), (long)strlen(str), (enc)) : \
rb_enc_str_new_cstr((str), (enc)); \
})
#endif
@@ -163,10 +116,10 @@ VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ec
PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4);
/* index -> rb_encoding */
-rb_encoding *rb_enc_from_index(int idx);
+rb_encoding* rb_enc_from_index(int idx);
/* name -> rb_encoding */
-rb_encoding *rb_enc_find(const char *name);
+rb_encoding * rb_enc_find(const char *name);
/* rb_encoding * -> name */
#define rb_enc_name(enc) (enc)->name
@@ -278,9 +231,21 @@ char *rb_enc_path_end(const char *,const char *,rb_encoding*);
const char *ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc);
const char *ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc);
ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc);
-VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc);
RUBY_EXTERN VALUE rb_cEncoding;
+#define ENC_DUMMY_FLAG (1<<24)
+#define ENC_INDEX_MASK (~(~0U<<24))
+
+#define ENC_TO_ENCINDEX(enc) (int)((enc)->ruby_encoding_index & ENC_INDEX_MASK)
+
+#define ENC_DUMMY_P(enc) ((enc)->ruby_encoding_index & ENC_DUMMY_FLAG)
+#define ENC_SET_DUMMY(enc) ((enc)->ruby_encoding_index |= ENC_DUMMY_FLAG)
+
+static inline int
+rb_enc_dummy_p(rb_encoding *enc)
+{
+ return ENC_DUMMY_P(enc) != 0;
+}
/* econv stuff */
@@ -348,64 +313,43 @@ VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE
void rb_econv_binmode(rb_econv_t *ec);
-enum ruby_econv_flag_type {
/* flags for rb_econv_open */
- RUBY_ECONV_ERROR_HANDLER_MASK = 0x000000ff,
- RUBY_ECONV_INVALID_MASK = 0x0000000f,
- RUBY_ECONV_INVALID_REPLACE = 0x00000002,
+#define ECONV_ERROR_HANDLER_MASK 0x000000ff
+
+#define ECONV_INVALID_MASK 0x0000000f
+#define ECONV_INVALID_REPLACE 0x00000002
- RUBY_ECONV_UNDEF_MASK = 0x000000f0,
- RUBY_ECONV_UNDEF_REPLACE = 0x00000020,
- RUBY_ECONV_UNDEF_HEX_CHARREF = 0x00000030,
+#define ECONV_UNDEF_MASK 0x000000f0
+#define ECONV_UNDEF_REPLACE 0x00000020
+#define ECONV_UNDEF_HEX_CHARREF 0x00000030
- RUBY_ECONV_DECORATOR_MASK = 0x0000ff00,
- RUBY_ECONV_NEWLINE_DECORATOR_MASK = 0x00003f00,
- RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK = 0x00000f00,
- RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK = 0x00003000,
+#define ECONV_DECORATOR_MASK 0x0000ff00
+#define ECONV_NEWLINE_DECORATOR_MASK 0x00003f00
+#define ECONV_NEWLINE_DECORATOR_READ_MASK 0x00000f00
+#define ECONV_NEWLINE_DECORATOR_WRITE_MASK 0x00003000
- RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR = 0x00000100,
- RUBY_ECONV_CRLF_NEWLINE_DECORATOR = 0x00001000,
- RUBY_ECONV_CR_NEWLINE_DECORATOR = 0x00002000,
- RUBY_ECONV_XML_TEXT_DECORATOR = 0x00004000,
- RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR = 0x00008000,
+#define ECONV_UNIVERSAL_NEWLINE_DECORATOR 0x00000100
+#define ECONV_CRLF_NEWLINE_DECORATOR 0x00001000
+#define ECONV_CR_NEWLINE_DECORATOR 0x00002000
+#define ECONV_XML_TEXT_DECORATOR 0x00004000
+#define ECONV_XML_ATTR_CONTENT_DECORATOR 0x00008000
- RUBY_ECONV_STATEFUL_DECORATOR_MASK = 0x00f00000,
- RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR = 0x00100000,
+#define ECONV_STATEFUL_DECORATOR_MASK 0x00f00000
+#define ECONV_XML_ATTR_QUOTE_DECORATOR 0x00100000
- RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR =
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
- RUBY_ECONV_CRLF_NEWLINE_DECORATOR,
+#define ECONV_DEFAULT_NEWLINE_DECORATOR ECONV_CRLF_NEWLINE_DECORATOR
#else
- 0,
+#define ECONV_DEFAULT_NEWLINE_DECORATOR 0
#endif
-#define ECONV_ERROR_HANDLER_MASK RUBY_ECONV_ERROR_HANDLER_MASK
-#define ECONV_INVALID_MASK RUBY_ECONV_INVALID_MASK
-#define ECONV_INVALID_REPLACE RUBY_ECONV_INVALID_REPLACE
-#define ECONV_UNDEF_MASK RUBY_ECONV_UNDEF_MASK
-#define ECONV_UNDEF_REPLACE RUBY_ECONV_UNDEF_REPLACE
-#define ECONV_UNDEF_HEX_CHARREF RUBY_ECONV_UNDEF_HEX_CHARREF
-#define ECONV_DECORATOR_MASK RUBY_ECONV_DECORATOR_MASK
-#define ECONV_NEWLINE_DECORATOR_MASK RUBY_ECONV_NEWLINE_DECORATOR_MASK
-#define ECONV_NEWLINE_DECORATOR_READ_MASK RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK
-#define ECONV_NEWLINE_DECORATOR_WRITE_MASK RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK
-#define ECONV_UNIVERSAL_NEWLINE_DECORATOR RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR
-#define ECONV_CRLF_NEWLINE_DECORATOR RUBY_ECONV_CRLF_NEWLINE_DECORATOR
-#define ECONV_CR_NEWLINE_DECORATOR RUBY_ECONV_CR_NEWLINE_DECORATOR
-#define ECONV_XML_TEXT_DECORATOR RUBY_ECONV_XML_TEXT_DECORATOR
-#define ECONV_XML_ATTR_CONTENT_DECORATOR RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR
-#define ECONV_STATEFUL_DECORATOR_MASK RUBY_ECONV_STATEFUL_DECORATOR_MASK
-#define ECONV_XML_ATTR_QUOTE_DECORATOR RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR
-#define ECONV_DEFAULT_NEWLINE_DECORATOR RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR
+
/* end of flags for rb_econv_open */
/* flags for rb_econv_convert */
- RUBY_ECONV_PARTIAL_INPUT = 0x00010000,
- RUBY_ECONV_AFTER_OUTPUT = 0x00020000,
-#define ECONV_PARTIAL_INPUT RUBY_ECONV_PARTIAL_INPUT
-#define ECONV_AFTER_OUTPUT RUBY_ECONV_AFTER_OUTPUT
+#define ECONV_PARTIAL_INPUT 0x00010000
+#define ECONV_AFTER_OUTPUT 0x00020000
/* end of flags for rb_econv_convert */
-RUBY_ECONV_FLAGS_PLACEHOLDER};
RUBY_SYMBOL_EXPORT_END
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index aec2d528ca..4ee6b0969b 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -56,7 +56,7 @@ void rb_ary_free(VALUE);
void rb_ary_modify(VALUE);
VALUE rb_ary_freeze(VALUE);
VALUE rb_ary_shared_with_p(VALUE, VALUE);
-VALUE rb_ary_aref(int, const VALUE*, VALUE);
+VALUE rb_ary_aref(int, VALUE*, VALUE);
VALUE rb_ary_subseq(VALUE, long, long);
void rb_ary_store(VALUE, long, VALUE);
VALUE rb_ary_dup(VALUE);
@@ -85,31 +85,35 @@ VALUE rb_ary_rassoc(VALUE, VALUE);
VALUE rb_ary_includes(VALUE, VALUE);
VALUE rb_ary_cmp(VALUE, VALUE);
VALUE rb_ary_replace(VALUE copy, VALUE orig);
-VALUE rb_get_values_at(VALUE, long, int, const VALUE*, VALUE(*)(VALUE,long));
+VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long));
VALUE rb_ary_resize(VALUE ary, long len);
#define rb_ary_new2 rb_ary_new_capa
#define rb_ary_new3 rb_ary_new_from_args
#define rb_ary_new4 rb_ary_new_from_values
/* bignum.c */
-VALUE rb_big_new(size_t, int);
+VALUE rb_big_new(long, int);
int rb_bigzero_p(VALUE x);
VALUE rb_big_clone(VALUE);
void rb_big_2comp(VALUE);
VALUE rb_big_norm(VALUE);
-void rb_big_resize(VALUE big, size_t len);
+void rb_big_resize(VALUE big, long len);
VALUE rb_cstr_to_inum(const char*, int, int);
VALUE rb_str_to_inum(VALUE, int, int);
VALUE rb_cstr2inum(const char*, int);
VALUE rb_str2inum(VALUE, int);
VALUE rb_big2str(VALUE, int);
-long rb_big2long(VALUE);
+DEPRECATED(VALUE rb_big2str0(VALUE, int, int));
+SIGNED_VALUE rb_big2long(VALUE);
#define rb_big2int(x) rb_big2long(x)
-unsigned long rb_big2ulong(VALUE);
+VALUE rb_big2ulong(VALUE);
#define rb_big2uint(x) rb_big2ulong(x)
+DEPRECATED(VALUE rb_big2ulong_pack(VALUE x));
#if HAVE_LONG_LONG
LONG_LONG rb_big2ll(VALUE);
unsigned LONG_LONG rb_big2ull(VALUE);
#endif /* HAVE_LONG_LONG */
+DEPRECATED(void rb_quad_pack(char*,VALUE));
+DEPRECATED(VALUE rb_quad_unpack(const char*,int));
void rb_big_pack(VALUE val, unsigned long *buf, long num_longs);
VALUE rb_big_unpack(unsigned long *buf, long num_longs);
int rb_uv_to_utf8(char[6],unsigned long);
@@ -131,7 +135,6 @@ VALUE rb_big_or(VALUE, VALUE);
VALUE rb_big_xor(VALUE, VALUE);
VALUE rb_big_lshift(VALUE, VALUE);
VALUE rb_big_rshift(VALUE, VALUE);
-VALUE rb_big_hash(VALUE);
/* For rb_integer_pack and rb_integer_unpack: */
/* "MS" in MSWORD and MSBYTE means "most significant" */
@@ -169,8 +172,6 @@ VALUE rb_rational_new(VALUE, VALUE);
VALUE rb_Rational(VALUE, VALUE);
#define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
#define rb_Rational2(x,y) rb_Rational((x), (y))
-VALUE rb_rational_num(VALUE rat);
-VALUE rb_rational_den(VALUE rat);
VALUE rb_flt_rationalize_with_prec(VALUE, VALUE);
VALUE rb_flt_rationalize(VALUE);
/* complex.c */
@@ -184,8 +185,6 @@ VALUE rb_complex_polar(VALUE, VALUE);
VALUE rb_Complex(VALUE, VALUE);
#define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
#define rb_Complex2(x,y) rb_Complex((x), (y))
-DEPRECATED(VALUE rb_complex_set_real(VALUE, VALUE));
-DEPRECATED(VALUE rb_complex_set_imag(VALUE, VALUE));
/* class.c */
VALUE rb_class_boot(VALUE);
VALUE rb_class_new(VALUE);
@@ -204,11 +203,11 @@ VALUE rb_include_class_new(VALUE, VALUE);
VALUE rb_mod_included_modules(VALUE);
VALUE rb_mod_include_p(VALUE, VALUE);
VALUE rb_mod_ancestors(VALUE);
-VALUE rb_class_instance_methods(int, const VALUE*, VALUE);
-VALUE rb_class_public_instance_methods(int, const VALUE*, VALUE);
-VALUE rb_class_protected_instance_methods(int, const VALUE*, VALUE);
-VALUE rb_class_private_instance_methods(int, const VALUE*, VALUE);
-VALUE rb_obj_singleton_methods(int, const VALUE*, VALUE);
+VALUE rb_class_instance_methods(int, VALUE*, VALUE);
+VALUE rb_class_public_instance_methods(int, VALUE*, VALUE);
+VALUE rb_class_protected_instance_methods(int, VALUE*, VALUE);
+VALUE rb_class_private_instance_methods(int, VALUE*, VALUE);
+VALUE rb_obj_singleton_methods(int, VALUE*, VALUE);
void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
void rb_frozen_class_p(VALUE);
void rb_undef(VALUE, ID);
@@ -221,26 +220,24 @@ int rb_cmpint(VALUE, VALUE, VALUE);
NORETURN(void rb_cmperr(VALUE, VALUE));
/* cont.c */
VALUE rb_fiber_new(VALUE (*)(ANYARGS), VALUE);
-VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
-VALUE rb_fiber_yield(int argc, const VALUE *argv);
+VALUE rb_fiber_resume(VALUE fib, int argc, VALUE *args);
+VALUE rb_fiber_yield(int argc, VALUE *args);
VALUE rb_fiber_current(void);
VALUE rb_fiber_alive_p(VALUE);
/* enum.c */
-VALUE rb_enum_values_pack(int, const VALUE*);
+VALUE rb_enum_values_pack(int, VALUE*);
/* enumerator.c */
-VALUE rb_enumeratorize(VALUE, VALUE, int, const VALUE *);
+VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *);
typedef VALUE rb_enumerator_size_func(VALUE, VALUE, VALUE);
-VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, const VALUE *, rb_enumerator_size_func *);
+VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, rb_enumerator_size_func *);
#ifndef RUBY_EXPORT
#define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
#endif
-#define SIZED_ENUMERATOR(obj, argc, argv, size_fn) \
- rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()), \
- (argc), (argv), (size_fn))
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
if (!rb_block_given_p()) \
- return SIZED_ENUMERATOR(obj, argc, argv, size_fn); \
+ return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
+ (argc), (argv), (size_fn)); \
} while (0)
#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
/* error.c */
@@ -254,18 +251,17 @@ PRINTF_ARGS(NORETURN(void rb_loaderror_with_path(VALUE path, const char*, ...)),
PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
NORETURN(void rb_invalid_str(const char*, const char*));
-DEPRECATED(PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4));
-DEPRECATED(PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5));
-DEPRECATED(PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2));
+PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
+PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
+PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
NORETURN(void rb_error_frozen(const char*));
-NORETURN(void rb_error_frozen_object(VALUE));
void rb_error_untrusted(VALUE);
void rb_check_frozen(VALUE);
void rb_check_trusted(VALUE);
#define rb_check_frozen_internal(obj) do { \
VALUE frozen_obj = (obj); \
if (OBJ_FROZEN(frozen_obj)) { \
- rb_error_frozen_object(frozen_obj); \
+ rb_error_frozen(rb_obj_classname(frozen_obj)); \
} \
} while (0)
#define rb_check_trusted_internal(obj) ((void) 0)
@@ -288,9 +284,8 @@ rb_check_trusted_inline(VALUE obj)
#endif
void rb_check_copyable(VALUE obj, VALUE orig);
-#define RB_OBJ_INIT_COPY(obj, orig) \
+#define OBJ_INIT_COPY(obj, orig) \
((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
-#define OBJ_INIT_COPY(obj, orig) RB_OBJ_INIT_COPY(obj, orig)
/* eval.c */
int rb_sourceline(void);
@@ -320,8 +315,6 @@ void rb_fd_clr(int, rb_fdset_t *);
int rb_fd_isset(int, const rb_fdset_t *);
void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
-
-struct timeval;
int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
#define rb_fd_ptr(f) ((f)->fdset)
@@ -371,28 +364,18 @@ typedef fd_set rb_fdset_t;
NORETURN(void rb_exc_raise(VALUE));
NORETURN(void rb_exc_fatal(VALUE));
-VALUE rb_f_exit(int, const VALUE*);
-VALUE rb_f_abort(int, const VALUE*);
+VALUE rb_f_exit(int,VALUE*);
+VALUE rb_f_abort(int,VALUE*);
void rb_remove_method(VALUE, const char*);
void rb_remove_method_id(VALUE, ID);
-DEPRECATED(static inline void rb_disable_super(void));
-DEPRECATED(static inline void rb_enable_super(void));
-static inline void rb_disable_super(void)
-{
- /* obsolete - no use */
-}
-static inline void rb_enable_super(void)
-{
- rb_warning("rb_enable_super() is obsolete");
-}
-#define rb_disable_super(klass, name) rb_disable_super()
-#define rb_enable_super(klass, name) rb_enable_super()
+#define rb_disable_super(klass, name) ((void)0)
+#define rb_enable_super(klass, name) ((void)0)
#define HAVE_RB_DEFINE_ALLOC_FUNC 1
typedef VALUE (*rb_alloc_func_t)(VALUE);
void rb_define_alloc_func(VALUE, rb_alloc_func_t);
void rb_undef_alloc_func(VALUE);
rb_alloc_func_t rb_get_alloc_func(VALUE);
-DEPRECATED(void rb_clear_cache(void));
+void rb_clear_cache(void);
void rb_clear_constant_cache(void);
void rb_clear_method_cache_by_class(VALUE);
void rb_alias(VALUE, ID, ID);
@@ -402,19 +385,15 @@ int rb_method_basic_definition_p(VALUE, ID);
VALUE rb_eval_cmd(VALUE, VALUE, int);
int rb_obj_respond_to(VALUE, ID, int);
int rb_respond_to(VALUE, ID);
-VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj);
-#if !defined(RUBY_EXPORT) && defined(_WIN32)
-RUBY_EXTERN VALUE (*const rb_f_notimplement_)(int, const VALUE *, VALUE);
-#define rb_f_notimplement (*rb_f_notimplement_)
-#endif
+VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj);
void rb_interrupt(void);
VALUE rb_apply(VALUE, ID, VALUE);
void rb_backtrace(void);
ID rb_frame_this_func(void);
-VALUE rb_obj_instance_eval(int, const VALUE*, VALUE);
-VALUE rb_obj_instance_exec(int, const VALUE*, VALUE);
-VALUE rb_mod_module_eval(int, const VALUE*, VALUE);
-VALUE rb_mod_module_exec(int, const VALUE*, VALUE);
+VALUE rb_obj_instance_eval(int, VALUE*, VALUE);
+VALUE rb_obj_instance_exec(int, VALUE*, VALUE);
+VALUE rb_mod_module_eval(int, VALUE*, VALUE);
+VALUE rb_mod_module_exec(int, VALUE*, VALUE);
void rb_load(VALUE, int);
void rb_load_protect(VALUE, int, int*);
NORETURN(void rb_jump_tag(int));
@@ -423,8 +402,8 @@ int rb_feature_provided(const char *, const char **);
void rb_provide(const char*);
VALUE rb_f_require(VALUE, VALUE);
VALUE rb_require_safe(VALUE, int);
-void rb_obj_call_init(VALUE, int, const VALUE*);
-VALUE rb_class_new_instance(int, const VALUE*, VALUE);
+void rb_obj_call_init(VALUE, int, VALUE*);
+VALUE rb_class_new_instance(int, VALUE*, VALUE);
VALUE rb_block_proc(void);
VALUE rb_block_lambda(void);
VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE);
@@ -436,8 +415,8 @@ VALUE rb_proc_lambda_p(VALUE);
VALUE rb_binding_new(void);
VALUE rb_obj_method(VALUE, VALUE);
VALUE rb_obj_is_method(VALUE);
-VALUE rb_method_call(int, const VALUE*, VALUE);
-VALUE rb_method_call_with_block(int, const VALUE *, VALUE, VALUE);
+VALUE rb_method_call(int, VALUE*, VALUE);
+VALUE rb_method_call_with_block(int, VALUE *, VALUE, VALUE);
int rb_mod_method_arity(VALUE, ID);
int rb_obj_method_arity(VALUE, ID);
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
@@ -448,6 +427,7 @@ void rb_thread_wait_fd(int);
int rb_thread_fd_writable(int);
void rb_thread_fd_close(int);
int rb_thread_alone(void);
+DEPRECATED(void rb_thread_polling(void));
void rb_thread_sleep(int);
void rb_thread_sleep_forever(void);
void rb_thread_sleep_deadly(void);
@@ -457,6 +437,7 @@ VALUE rb_thread_wakeup_alive(VALUE);
VALUE rb_thread_run(VALUE);
VALUE rb_thread_kill(VALUE);
VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
+DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
void rb_thread_wait_for(struct timeval);
VALUE rb_thread_current(void);
@@ -472,9 +453,9 @@ VALUE rb_exec_recursive_paired_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VAL
/* dir.c */
VALUE rb_dir_getwd(void);
/* file.c */
-VALUE rb_file_s_expand_path(int, const VALUE *);
+VALUE rb_file_s_expand_path(int, VALUE *);
VALUE rb_file_expand_path(VALUE, VALUE);
-VALUE rb_file_s_absolute_path(int, const VALUE *);
+VALUE rb_file_s_absolute_path(int, VALUE *);
VALUE rb_file_absolute_path(VALUE, VALUE);
VALUE rb_file_dirname(VALUE fname);
int rb_find_file_ext_safe(VALUE*, const char* const*, int);
@@ -487,7 +468,7 @@ int rb_is_absolute_path(const char *);
/* gc.c */
NORETURN(void rb_memerror(void));
int rb_during_gc(void);
-void rb_gc_mark_locations(const VALUE*, const VALUE*);
+void rb_gc_mark_locations(VALUE*, VALUE*);
void rb_mark_tbl(struct st_table*);
void rb_mark_set(struct st_table*);
void rb_mark_hash(struct st_table*);
@@ -501,11 +482,10 @@ void rb_gc_call_finalizer_at_exit(void);
VALUE rb_gc_enable(void);
VALUE rb_gc_disable(void);
VALUE rb_gc_start(void);
+DEPRECATED(void rb_gc_set_params(void));
VALUE rb_define_finalizer(VALUE, VALUE);
VALUE rb_undefine_finalizer(VALUE);
size_t rb_gc_count(void);
-size_t rb_gc_stat(VALUE);
-VALUE rb_gc_latest_gc_info(VALUE);
/* hash.c */
void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
VALUE rb_check_hash_type(VALUE);
@@ -529,9 +509,6 @@ struct st_table *rb_hash_tbl(VALUE);
int rb_path_check(const char*);
int rb_env_path_tainted(void);
VALUE rb_env_clear(void);
-VALUE rb_hash_size(VALUE);
-DEPRECATED(int rb_hash_iter_lev(VALUE));
-DEPRECATED(VALUE rb_hash_ifnone(VALUE));
/* io.c */
#define rb_defout rb_stdout
RUBY_EXTERN VALUE rb_fs;
@@ -550,9 +527,9 @@ VALUE rb_io_eof(VALUE);
VALUE rb_io_binmode(VALUE);
VALUE rb_io_ascii8bit_binmode(VALUE);
VALUE rb_io_addstr(VALUE, VALUE);
-VALUE rb_io_printf(int, const VALUE*, VALUE);
-VALUE rb_io_print(int, const VALUE*, VALUE);
-VALUE rb_io_puts(int, const VALUE*, VALUE);
+VALUE rb_io_printf(int, VALUE*, VALUE);
+VALUE rb_io_print(int, VALUE*, VALUE);
+VALUE rb_io_puts(int, VALUE*, VALUE);
VALUE rb_io_fdopen(int, int, const char*);
VALUE rb_io_get_io(VALUE);
VALUE rb_file_open(const char*, const char*);
@@ -624,6 +601,8 @@ VALUE rb_Hash(VALUE);
double rb_cstr_to_dbl(const char*, int);
double rb_str_to_dbl(VALUE, int);
/* parse.y */
+RUBY_EXTERN int ruby_sourceline;
+RUBY_EXTERN char *ruby_sourcefile;
ID rb_id_attrset(ID);
int rb_is_const_id(ID);
int rb_is_global_id(ID);
@@ -638,15 +617,29 @@ VALUE rb_backref_get(void);
void rb_backref_set(VALUE);
VALUE rb_lastline_get(void);
void rb_lastline_set(VALUE);
+VALUE rb_sym_all_symbols(void);
/* process.c */
void rb_last_status_set(int status, rb_pid_t pid);
VALUE rb_last_status_get(void);
+struct rb_exec_arg {
+ VALUE execarg_obj;
+};
+DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
int rb_proc_exec(const char*);
-VALUE rb_f_exec(int, const VALUE*);
+DEPRECATED(VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e));
+DEPRECATED(int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val));
+DEPRECATED(void rb_exec_arg_fixup(struct rb_exec_arg *e));
+DEPRECATED(int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s));
+DEPRECATED(int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t));
+DEPRECATED(int rb_exec(const struct rb_exec_arg*));
+DEPRECATED(int rb_exec_err(const struct rb_exec_arg*, char*, size_t));
+DEPRECATED(rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE));
+DEPRECATED(rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t));
+VALUE rb_f_exec(int,VALUE*);
rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
void rb_syswait(rb_pid_t pid);
-rb_pid_t rb_spawn(int, const VALUE*);
-rb_pid_t rb_spawn_err(int, const VALUE*, char*, size_t);
+rb_pid_t rb_spawn(int, VALUE*);
+rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
VALUE rb_proc_times(VALUE);
VALUE rb_detach_process(rb_pid_t pid);
/* range.c */
@@ -689,7 +682,7 @@ VALUE rb_get_argv(void);
void *rb_load_file(const char*);
void *rb_load_file_str(VALUE);
/* signal.c */
-VALUE rb_f_kill(int, const VALUE*);
+VALUE rb_f_kill(int, VALUE*);
#ifdef POSIX_SIGNAL
#define posix_signal ruby_posix_signal
RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
@@ -725,11 +718,6 @@ VALUE rb_str_buf_new2(const char*);
VALUE rb_str_tmp_new(long);
VALUE rb_usascii_str_new(const char*, long);
VALUE rb_usascii_str_new_cstr(const char*);
-VALUE rb_utf8_str_new(const char*, long);
-VALUE rb_utf8_str_new_cstr(const char*);
-VALUE rb_str_new_static(const char *, long);
-VALUE rb_usascii_str_new_static(const char *, long);
-VALUE rb_utf8_str_new_static(const char *, long);
void rb_str_free(VALUE);
void rb_str_shared_replace(VALUE, VALUE);
VALUE rb_str_buf_append(VALUE, VALUE);
@@ -757,7 +745,6 @@ VALUE rb_str_freeze(VALUE);
void rb_str_set_len(VALUE, long);
VALUE rb_str_resize(VALUE, long);
VALUE rb_str_cat(VALUE, const char*, long);
-VALUE rb_str_cat_cstr(VALUE, const char*);
VALUE rb_str_cat2(VALUE, const char*);
VALUE rb_str_append(VALUE, VALUE);
VALUE rb_str_concat(VALUE, VALUE);
@@ -780,8 +767,8 @@ VALUE rb_str_replace(VALUE, VALUE);
VALUE rb_str_inspect(VALUE);
VALUE rb_str_dump(VALUE);
VALUE rb_str_split(VALUE, const char*);
-DEPRECATED(void rb_str_associate(VALUE, VALUE));
-DEPRECATED(VALUE rb_str_associated(VALUE));
+void rb_str_associate(VALUE, VALUE);
+VALUE rb_str_associated(VALUE);
void rb_str_setter(VALUE, ID, VALUE*);
VALUE rb_str_intern(VALUE);
VALUE rb_sym_to_s(VALUE);
@@ -791,34 +778,13 @@ long rb_str_offset(VALUE, long);
size_t rb_str_capacity(VALUE);
VALUE rb_str_ellipsize(VALUE, long);
VALUE rb_str_scrub(VALUE, VALUE);
-/* symbol.c */
-VALUE rb_sym_all_symbols(void);
-
#if defined(__GNUC__) && !defined(__PCC__)
-#define rb_str_new(str, len) __extension__ ( \
-{ \
- (__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
- rb_str_new_static((str), (len)) : \
- rb_str_new((str), (len)); \
-})
#define rb_str_new_cstr(str) __extension__ ( \
{ \
(__builtin_constant_p(str)) ? \
- rb_str_new_static((str), (long)strlen(str)) : \
+ rb_str_new((str), (long)strlen(str)) : \
rb_str_new_cstr(str); \
})
-#define rb_usascii_str_new(str, len) __extension__ ( \
-{ \
- (__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
- rb_usascii_str_new_static((str), (len)) : \
- rb_usascii_str_new((str), (len)); \
-})
-#define rb_utf8_str_new(str, len) __extension__ ( \
-{ \
- (__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
- rb_utf8_str_new_static((str), (len)) : \
- rb_utf8_str_new((str), (len)); \
-})
#define rb_tainted_str_new_cstr(str) __extension__ ( \
{ \
(__builtin_constant_p(str)) ? \
@@ -828,15 +794,9 @@ VALUE rb_sym_all_symbols(void);
#define rb_usascii_str_new_cstr(str) __extension__ ( \
{ \
(__builtin_constant_p(str)) ? \
- rb_usascii_str_new_static((str), (long)strlen(str)) : \
+ rb_usascii_str_new((str), (long)strlen(str)) : \
rb_usascii_str_new_cstr(str); \
})
-#define rb_utf8_str_new_cstr(str) __extension__ ( \
-{ \
- (__builtin_constant_p(str)) ? \
- rb_utf8_str_new_static((str), (long)strlen(str)) : \
- rb_utf8_str_new_cstr(str); \
-})
#define rb_external_str_new_cstr(str) __extension__ ( \
{ \
(__builtin_constant_p(str)) ? \
@@ -856,11 +816,17 @@ VALUE rb_sym_all_symbols(void);
(str), (long)strlen(str)) : \
rb_str_buf_new_cstr(str); \
})
-#define rb_str_cat_cstr(str, ptr) __extension__ ( \
+#define rb_str_buf_cat2(str, ptr) __extension__ ( \
+{ \
+ (__builtin_constant_p(ptr)) ? \
+ rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
+ rb_str_buf_cat2((str), (ptr)); \
+})
+#define rb_str_cat2(str, ptr) __extension__ ( \
{ \
(__builtin_constant_p(ptr)) ? \
rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
- rb_str_cat_cstr((str), (ptr)); \
+ rb_str_cat2((str), (ptr)); \
})
#define rb_exc_new_cstr(klass, ptr) __extension__ ( \
{ \
@@ -876,19 +842,6 @@ VALUE rb_sym_all_symbols(void);
#define rb_tainted_str_new2 rb_tainted_str_new_cstr
#define rb_str_buf_new2 rb_str_buf_new_cstr
#define rb_usascii_str_new2 rb_usascii_str_new_cstr
-#define rb_str_buf_cat rb_str_cat
-#define rb_str_buf_cat2 rb_str_cat_cstr
-#define rb_str_cat2 rb_str_cat_cstr
-#define rb_strlen_lit(str) (sizeof(str "") - 1)
-#define rb_str_new_lit(str) rb_str_new_static((str), rb_strlen_lit(str))
-#define rb_usascii_str_new_lit(str) rb_usascii_str_new_static((str), rb_strlen_lit(str))
-#define rb_utf8_str_new_lit(str) rb_utf8_str_new_static((str), rb_strlen_lit(str))
-#define rb_enc_str_new_lit(str, enc) rb_enc_str_new_static((str), rb_strlen_lit(str), (enc))
-#define rb_str_new_literal(str) rb_str_new_lit(str)
-#define rb_usascii_str_new_literal(str) rb_usascii_str_new_lit(str)
-#define rb_utf8_str_new_literal(str) rb_utf8_str_new_lit(str)
-#define rb_enc_str_new_literal(str, enc) rb_enc_str_new_lit(str, enc)
-
/* struct.c */
VALUE rb_struct_new(VALUE, ...);
VALUE rb_struct_define(const char*, ...);
@@ -898,6 +851,7 @@ VALUE rb_struct_initialize(VALUE, VALUE);
VALUE rb_struct_aref(VALUE, VALUE);
VALUE rb_struct_aset(VALUE, VALUE, VALUE);
VALUE rb_struct_getmember(VALUE, ID);
+DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*));
VALUE rb_struct_s_members(VALUE);
VALUE rb_struct_members(VALUE);
VALUE rb_struct_alloc_noinit(VALUE);
@@ -910,6 +864,9 @@ typedef VALUE rb_blocking_function_t(void *);
void rb_thread_check_ints(void);
int rb_thread_interrupted(VALUE thval);
+/* Use rb_thread_call_without_gvl family instead. */
+DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func, void *data1,
+ rb_unblock_function_t *ubf, void *data2));
#define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
#define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1)
VALUE rb_mutex_new(void);
@@ -920,10 +877,8 @@ VALUE rb_mutex_unlock(VALUE mutex);
VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
VALUE rb_mutex_synchronize(VALUE mutex, VALUE (*func)(VALUE arg), VALUE arg);
/* time.c */
-void rb_timespec_now(struct timespec *);
VALUE rb_time_new(time_t, long);
VALUE rb_time_nano_new(time_t, long);
-VALUE rb_time_timespec_new(const struct timespec *, int);
VALUE rb_time_num_new(VALUE, VALUE);
struct timeval rb_time_interval(VALUE num);
struct timeval rb_time_timeval(VALUE time);
@@ -931,21 +886,20 @@ struct timespec rb_time_timespec(VALUE time);
/* variable.c */
VALUE rb_mod_name(VALUE);
VALUE rb_class_path(VALUE);
-VALUE rb_class_path_cached(VALUE);
void rb_set_class_path(VALUE, VALUE, const char*);
void rb_set_class_path_string(VALUE, VALUE, VALUE);
VALUE rb_path_to_class(VALUE);
VALUE rb_path2class(const char*);
void rb_name_class(VALUE, ID);
VALUE rb_class_name(VALUE);
-DEPRECATED(void rb_autoload(VALUE, ID, const char*));
+void rb_autoload(VALUE, ID, const char*);
VALUE rb_autoload_load(VALUE, ID);
VALUE rb_autoload_p(VALUE, ID);
-VALUE rb_f_trace_var(int, const VALUE*);
-VALUE rb_f_untrace_var(int, const VALUE*);
+VALUE rb_f_trace_var(int, VALUE*);
+VALUE rb_f_untrace_var(int, VALUE*);
VALUE rb_f_global_variables(void);
void rb_alias_variable(ID, ID);
-DEPRECATED(struct st_table* rb_generic_ivar_table(VALUE));
+struct st_table* rb_generic_ivar_table(VALUE);
void rb_copy_generic_ivar(VALUE,VALUE);
void rb_free_generic_ivar(VALUE);
VALUE rb_ivar_get(VALUE, ID);
@@ -959,7 +913,7 @@ VALUE rb_obj_remove_instance_variable(VALUE, VALUE);
void *rb_mod_const_at(VALUE, void*);
void *rb_mod_const_of(VALUE, void*);
VALUE rb_const_list(void*);
-VALUE rb_mod_constants(int, const VALUE *, VALUE);
+VALUE rb_mod_constants(int, VALUE *, VALUE);
VALUE rb_mod_remove_const(VALUE, VALUE);
int rb_const_defined(VALUE, ID);
int rb_const_defined_at(VALUE, ID);
@@ -976,19 +930,16 @@ VALUE rb_cvar_get(VALUE, ID);
void rb_cv_set(VALUE, const char*, VALUE);
VALUE rb_cv_get(VALUE, const char*);
void rb_define_class_variable(VALUE, const char*, VALUE);
-VALUE rb_mod_class_variables(int, const VALUE*, VALUE);
+VALUE rb_mod_class_variables(int, VALUE*, VALUE);
VALUE rb_mod_remove_cvar(VALUE, VALUE);
ID rb_frame_callee(void);
VALUE rb_str_succ(VALUE);
VALUE rb_time_succ(VALUE);
+void rb_frame_pop(void);
int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
VALUE rb_make_backtrace(void);
-VALUE rb_make_exception(int, const VALUE*);
-
-/* deprecated */
-DEPRECATED(void rb_frame_pop(void));
-
+VALUE rb_make_exception(int, VALUE*);
RUBY_SYMBOL_EXPORT_END
diff --git a/include/ruby/io.h b/include/ruby/io.h
index 029522bedc..23337679f0 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -51,17 +51,16 @@ extern "C" {
RUBY_SYMBOL_EXPORT_BEGIN
-PACKED_STRUCT_UNALIGNED(struct rb_io_buffer_t {
+typedef struct {
char *ptr; /* off + len <= capa */
int off;
int len;
int capa;
-});
-typedef struct rb_io_buffer_t rb_io_buffer_t;
+} rb_io_buffer_t;
typedef struct rb_io_t {
- FILE *stdio_file; /* stdio ptr for read/write if available */
int fd; /* file descriptor */
+ FILE *stdio_file; /* stdio ptr for read/write if available */
int mode; /* mode flags: FMODE_XXXs */
rb_pid_t pid; /* child's pid (for pipes) */
int lineno; /* number of lines read */
@@ -90,9 +89,9 @@ typedef struct rb_io_t {
rb_econv_t *writeconv;
VALUE writeconv_asciicompat;
- int writeconv_initialized;
int writeconv_pre_ecflags;
VALUE writeconv_pre_ecopts;
+ int writeconv_initialized;
VALUE write_lock;
} rb_io_t;
@@ -109,30 +108,59 @@ typedef struct rb_io_t {
#define FMODE_APPEND 0x00000040
#define FMODE_CREATE 0x00000080
/* #define FMODE_NOREVLOOKUP 0x00000100 */
+#define FMODE_WSPLIT 0x00000200
+#define FMODE_WSPLIT_INITIALIZED 0x00000400
#define FMODE_TRUNC 0x00000800
#define FMODE_TEXTMODE 0x00001000
/* #define FMODE_PREP 0x00010000 */
#define FMODE_SETENC_BY_BOM 0x00100000
-/* #define FMODE_UNIX 0x00200000 */
-/* #define FMODE_INET 0x00400000 */
-/* #define FMODE_INET6 0x00800000 */
#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
#define RB_IO_BUFFER_INIT(buf) do {\
- [<"internal macro RB_IO_BUFFER_INIT() is used">];\
+ (buf).ptr = NULL;\
+ (buf).off = 0;\
+ (buf).len = 0;\
+ (buf).capa = 0;\
} while (0)
#define MakeOpenFile(obj, fp) do {\
- (fp) = rb_io_make_open_file(obj);\
+ if (RFILE(obj)->fptr) {\
+ rb_io_close(obj);\
+ rb_io_fptr_finalize(RFILE(obj)->fptr);\
+ RFILE(obj)->fptr = 0;\
+ }\
+ (fp) = 0;\
+ RB_IO_FPTR_NEW(fp);\
+ RFILE(obj)->fptr = (fp);\
} while (0)
#define RB_IO_FPTR_NEW(fp) do {\
- [<"internal macro RB_IO_FPTR_NEW() is used">];\
+ (fp) = ALLOC(rb_io_t);\
+ (fp)->fd = -1;\
+ (fp)->stdio_file = NULL;\
+ (fp)->mode = 0;\
+ (fp)->pid = 0;\
+ (fp)->lineno = 0;\
+ (fp)->pathv = Qnil;\
+ (fp)->finalize = 0;\
+ RB_IO_BUFFER_INIT((fp)->wbuf);\
+ RB_IO_BUFFER_INIT((fp)->rbuf);\
+ RB_IO_BUFFER_INIT((fp)->cbuf);\
+ (fp)->readconv = NULL;\
+ (fp)->writeconv = NULL;\
+ (fp)->writeconv_asciicompat = Qnil;\
+ (fp)->writeconv_pre_ecflags = 0;\
+ (fp)->writeconv_pre_ecopts = Qnil;\
+ (fp)->writeconv_initialized = 0;\
+ (fp)->tied_io_for_writing = 0;\
+ (fp)->encs.enc = NULL;\
+ (fp)->encs.enc2 = NULL;\
+ (fp)->encs.ecflags = 0;\
+ (fp)->encs.ecopts = Qnil;\
+ (fp)->write_lock = 0;\
} while (0)
-rb_io_t *rb_io_make_open_file(VALUE obj);
-
FILE *rb_io_stdio_file(rb_io_t *fptr);
FILE *rb_fdopen(int, const char*);
@@ -159,14 +187,15 @@ int rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding **
ssize_t rb_io_bufwrite(VALUE io, const void *buf, size_t size);
/* compatibility for ruby 1.8 and older */
-#define rb_io_mode_flags(modestr) [<"rb_io_mode_flags() is obsolete; use rb_io_modestr_fmode()">]
-#define rb_io_modenum_flags(oflags) [<"rb_io_modenum_flags() is obsolete; use rb_io_oflags_fmode()">]
+#define rb_io_mode_flags(modestr) rb_io_modestr_fmode(modestr)
+#define rb_io_modenum_flags(oflags) rb_io_oflags_fmode(oflags)
VALUE rb_io_taint_check(VALUE);
NORETURN(void rb_eof_error(void));
void rb_io_read_check(rb_io_t*);
int rb_io_read_pending(rb_io_t*);
+DEPRECATED(void rb_read_check(FILE*));
struct stat;
VALUE rb_stat_new(const struct stat *);
diff --git a/include/ruby/missing.h b/include/ruby/missing.h
index 3474ca256f..5dba4edda7 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -21,9 +21,6 @@ extern "C" {
#include "ruby/config.h"
#include <stddef.h>
#include <math.h> /* for INFINITY and NAN */
-#ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
-# include RUBY_ALTERNATIVE_MALLOC_HEADER
-#endif
#ifdef RUBY_EXTCONF_H
#include RUBY_EXTCONF_H
#endif
@@ -37,13 +34,6 @@ extern "C" {
#endif
#endif
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-#ifndef M_PI_2
-# define M_PI_2 (M_PI/2)
-#endif
-
#ifndef RUBY_SYMBOL_EXPORT_BEGIN
# define RUBY_SYMBOL_EXPORT_BEGIN /* begin */
# define RUBY_SYMBOL_EXPORT_END /* end */
@@ -136,20 +126,24 @@ RUBY_EXTERN double lgamma_r(double, int *);
RUBY_EXTERN double cbrt(double);
#endif
-#if !defined(HAVE_INFINITY) || !defined(HAVE_NAN)
+#if !defined(INFINITY) || !defined(NAN)
union bytesequence4_or_float {
unsigned char bytesequence[4];
float float_value;
};
#endif
-#ifndef INFINITY
+#ifdef INFINITY
+# define HAVE_INFINITY
+#else
/** @internal */
RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
# define INFINITY (rb_infinity.float_value)
#endif
-#ifndef NAN
+#ifdef NAN
+# define HAVE_NAN
+#else
/** @internal */
RUBY_EXTERN const union bytesequence4_or_float rb_nan;
# define NAN (rb_nan.float_value)
@@ -174,17 +168,6 @@ RUBY_EXTERN int isnan(double);
# endif
#endif
-#ifndef isfinite
-# ifndef HAVE_ISFINITE
-# define HAVE_ISFINITE 1
-# define isfinite(x) finite(x)
-# endif
-#endif
-
-#ifndef HAVE_NEXTAFTER
-RUBY_EXTERN double nextafter(double x, double y);
-#endif
-
/*
#ifndef HAVE_MEMCMP
RUBY_EXTERN int memcmp(const void *, const void *, size_t);
@@ -249,13 +232,6 @@ RUBY_EXTERN int ruby_close(int);
RUBY_EXTERN void setproctitle(const char *fmt, ...);
#endif
-#ifndef HAVE_EXPLICIT_BZERO
-RUBY_EXTERN void explicit_bzero(void *b, size_t len);
-# if defined SecureZeroMemory
-# define explicit_bzero(b, len) SecureZeroMemory(b, len)
-# endif
-#endif
-
RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h
index 519c0ac336..6a26ee4aaa 100644
--- a/include/ruby/oniguruma.h
+++ b/include/ruby/oniguruma.h
@@ -5,7 +5,7 @@
**********************************************************************/
/*-
* Copyright (c) 2002-2009 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,8 @@ extern "C" {
#define ONIGURUMA
#define ONIGURUMA_VERSION_MAJOR 5
-#define ONIGURUMA_VERSION_MINOR 15
-#define ONIGURUMA_VERSION_TEENY 0
+#define ONIGURUMA_VERSION_MINOR 13
+#define ONIGURUMA_VERSION_TEENY 5
#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES
@@ -156,29 +156,29 @@ typedef struct {
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
typedef struct OnigEncodingTypeST {
- int (*precise_mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, const struct OnigEncodingTypeST* enc);
+ int (*precise_mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc);
const char* name;
int max_enc_len;
int min_enc_len;
- int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
- OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
- int (*code_to_mbclen)(OnigCodePoint code, const struct OnigEncodingTypeST* enc);
- int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf, const struct OnigEncodingTypeST* enc);
- int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, const struct OnigEncodingTypeST* enc);
- int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, const struct OnigEncodingTypeST* enc);
- int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[], const struct OnigEncodingTypeST* enc);
- int (*property_name_to_ctype)(const struct OnigEncodingTypeST* enc, const OnigUChar* p, const OnigUChar* end);
- int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype, const struct OnigEncodingTypeST* enc);
- int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], const struct OnigEncodingTypeST* enc);
- OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
- int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
+ int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
+ OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
+ int (*code_to_mbclen)(OnigCodePoint code, struct OnigEncodingTypeST* enc);
+ int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf, struct OnigEncodingTypeST* enc);
+ int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, struct OnigEncodingTypeST* enc);
+ int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, struct OnigEncodingTypeST* enc);
+ int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[], struct OnigEncodingTypeST* enc);
+ int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
+ int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype, struct OnigEncodingTypeST* enc);
+ int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], struct OnigEncodingTypeST* enc);
+ OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
+ int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
int ruby_encoding_index;
unsigned int flags;
} OnigEncodingType;
-typedef const OnigEncodingType* OnigEncoding;
+typedef OnigEncodingType* OnigEncoding;
-ONIG_EXTERN const OnigEncodingType OnigEncodingASCII;
+ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
#define ONIG_ENCODING_ASCII (&OnigEncodingASCII)
@@ -256,7 +256,7 @@ ONIG_EXTERN const OnigEncodingType OnigEncodingASCII;
#define ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e) (enc)->precise_mbc_enc_len(p,e,enc)
ONIG_EXTERN
-int onigenc_mbclen_approximate P_((const OnigUChar* p,const OnigUChar* e, const struct OnigEncodingTypeST* enc));
+int onigenc_mbclen_approximate P_((const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc));
#define ONIGENC_MBC_ENC_LEN(enc,p,e) onigenc_mbclen_approximate(p,e,enc)
#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
@@ -338,7 +338,6 @@ int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
/* config parameters */
#define ONIG_NREGION 10
#define ONIG_MAX_BACKREF_NUM 1000
-#define ONIG_MAX_CAPTURE_GROUP_NUM 32767
#define ONIG_MAX_REPEAT_NUM 100000
#define ONIG_MAX_MULTI_BYTE_RANGES_NUM 10000
/* constants */
@@ -370,9 +369,7 @@ typedef unsigned int OnigOptionType;
#define ONIG_OPTION_WORD_BOUND_ALL_RANGE (ONIG_OPTION_POSIX_BRACKET_ALL_RANGE << 1)
/* options (newline) */
#define ONIG_OPTION_NEWLINE_CRLF (ONIG_OPTION_WORD_BOUND_ALL_RANGE << 1)
-#define ONIG_OPTION_NOTBOS (ONIG_OPTION_NEWLINE_CRLF << 1)
-#define ONIG_OPTION_NOTEOS (ONIG_OPTION_NOTBOS << 1)
-#define ONIG_OPTION_MAXBIT ONIG_OPTION_NOTEOS /* limit */
+#define ONIG_OPTION_MAXBIT ONIG_OPTION_NEWLINE_CRLF /* limit */
#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
@@ -585,7 +582,6 @@ ONIG_EXTERN const OnigSyntaxType* OnigDefaultSyntax;
#define ONIGERR_NEVER_ENDING_RECURSION -221
#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222
#define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223
-#define ONIGERR_TOO_MANY_CAPTURE_GROUPS -224
#define ONIGERR_INVALID_CODE_POINT_VALUE -400
#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401
@@ -674,15 +670,13 @@ typedef struct re_pattern_buffer {
unsigned int bt_mem_end; /* need backtrack flag */
int stack_pop_level;
int repeat_range_alloc;
-
- OnigOptionType options;
-
OnigRepeatRange* repeat_range;
OnigEncoding enc;
+ OnigOptionType options;
const OnigSyntaxType* syntax;
- void* name_table;
OnigCaseFoldType case_fold_flag;
+ void* name_table;
/* optimization info (string search, char-map and anchors) */
int optimize; /* optimize flag */
@@ -714,7 +708,7 @@ typedef struct {
int num_of_elements;
OnigEncoding pattern_enc;
OnigEncoding target_enc;
- const OnigSyntaxType* syntax;
+ OnigSyntaxType* syntax;
OnigOptionType option;
OnigCaseFoldType case_fold_flag;
} OnigCompileInfo;
@@ -813,7 +807,7 @@ void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options)
ONIG_EXTERN
int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code));
ONIG_EXTERN
-void onig_copy_encoding P_((OnigEncodingType *to, OnigEncoding from));
+void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from));
ONIG_EXTERN
OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
ONIG_EXTERN
diff --git a/include/ruby/re.h b/include/ruby/re.h
index 166f254aa5..41b3e492f8 100644
--- a/include/ruby/re.h
+++ b/include/ruby/re.h
@@ -58,7 +58,6 @@ long rb_reg_adjust_startpos(VALUE, VALUE, long, int);
void rb_match_busy(VALUE);
VALUE rb_reg_quote(VALUE);
regex_t *rb_reg_prepare_re(VALUE re, VALUE str);
-int rb_reg_region_copy(struct re_registers *, const struct re_registers *);
RUBY_SYMBOL_EXPORT_END
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index dccfdc763a..3b6a279b5b 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -26,13 +26,6 @@ extern "C" {
#include RUBY_EXTCONF_H
#endif
-#if defined(__cplusplus)
-/* __builtin_choose_expr and __builtin_types_compatible aren't available
- * on C++. See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */
-# undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
-# undef HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P
-#endif
-
#include "defines.h"
#define NORETURN_STYLE_NEW 1
@@ -42,24 +35,11 @@ extern "C" {
#ifndef DEPRECATED
# define DEPRECATED(x) x
#endif
-#ifndef DEPRECATED_BY
-# define DEPRECATED_BY(n,x) DEPRECATED(x)
-#endif
-#ifndef DEPRECATED_TYPE
-# define DEPRECATED_TYPE(mesg, decl) decl
-#endif
#ifndef NOINLINE
# define NOINLINE(x) x
#endif
-#ifndef ASSUME
-# ifdef UNREACHABLE
-# define ASSUME(x) (LIKELY(!!(x)) ? (void)0 : UNREACHABLE)
-# else
-# define ASSUME(x) ((void)(x))
-# endif
-#endif
#ifndef UNREACHABLE
-# define UNREACHABLE ((void)0) /* unreachable */
+# define UNREACHABLE /* unreachable */
#endif
#ifdef __GNUC__
@@ -69,8 +49,6 @@ extern "C" {
#define PRINTF_ARGS(decl, string_index, first_to_check) decl
#endif
-#define RUBY_MACRO_SELECT(base, n) TOKEN_PASTE(base, n)
-
#ifdef HAVE_INTRINSICS_H
# include <intrinsics.h>
#endif
@@ -143,21 +121,20 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
#define PRI_64_PREFIX PRI_LL_PREFIX
#endif
-#define RUBY_PRI_VALUE_MARK "\v"
#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
#define PRIdVALUE PRIdPTR
#define PRIoVALUE PRIoPTR
#define PRIuVALUE PRIuPTR
#define PRIxVALUE PRIxPTR
#define PRIXVALUE PRIXPTR
-#define PRIsVALUE PRIiPTR"" RUBY_PRI_VALUE_MARK
+#define PRIsVALUE PRIiPTR
#else
#define PRIdVALUE PRI_VALUE_PREFIX"d"
#define PRIoVALUE PRI_VALUE_PREFIX"o"
#define PRIuVALUE PRI_VALUE_PREFIX"u"
#define PRIxVALUE PRI_VALUE_PREFIX"x"
#define PRIXVALUE PRI_VALUE_PREFIX"X"
-#define PRIsVALUE PRI_VALUE_PREFIX"i" RUBY_PRI_VALUE_MARK
+#define PRIsVALUE PRI_VALUE_PREFIX"i"
#endif
#ifndef PRI_VALUE_PREFIX
# define PRI_VALUE_PREFIX ""
@@ -248,12 +225,10 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
# endif
#endif
-#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
-#define RUBY_FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
-#define FIXNUM_MAX RUBY_FIXNUM_MAX
-#define FIXNUM_MIN RUBY_FIXNUM_MIN
+#define FIXNUM_MAX (LONG_MAX>>1)
+#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
-#define INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
+#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
#define LONG2FIX(i) INT2FIX(i)
#define rb_fix_new(v) INT2FIX(v)
VALUE rb_int2inum(SIGNED_VALUE);
@@ -367,44 +342,18 @@ rb_long2int_inline(long n)
#define MODET2NUM(v) INT2NUM(v)
#endif
-#define RB_FIX2LONG(x) ((long)RSHIFT((SIGNED_VALUE)(x),1))
-static inline long
-rb_fix2long(VALUE x)
-{
- return RB_FIX2LONG(x);
-}
-#define RB_FIX2ULONG(x) ((unsigned long)RB_FIX2LONG(x))
-static inline unsigned long
-rb_fix2ulong(VALUE x)
-{
- return RB_FIX2ULONG(x);
-}
-#define RB_FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&RUBY_FIXNUM_FLAG)
-#define RB_POSFIXABLE(f) ((f) < RUBY_FIXNUM_MAX+1)
-#define RB_NEGFIXABLE(f) ((f) >= RUBY_FIXNUM_MIN)
-#define RB_FIXABLE(f) (RB_POSFIXABLE(f) && RB_NEGFIXABLE(f))
-#define FIX2LONG(x) RB_FIX2LONG(x)
-#define FIX2ULONG(x) RB_FIX2ULONG(x)
-#define FIXNUM_P(f) RB_FIXNUM_P(f)
-#define POSFIXABLE(f) RB_POSFIXABLE(f)
-#define NEGFIXABLE(f) RB_NEGFIXABLE(f)
-#define FIXABLE(f) RB_FIXABLE(f)
-
-#define RB_IMMEDIATE_P(x) ((VALUE)(x) & RUBY_IMMEDIATE_MASK)
-#define IMMEDIATE_P(x) RB_IMMEDIATE_P(x)
-
-ID rb_sym2id(VALUE);
-VALUE rb_id2sym(ID);
-#define RB_STATIC_SYM_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT)) == RUBY_SYMBOL_FLAG)
-#define RB_DYNAMIC_SYM_P(x) (!RB_SPECIAL_CONST_P(x) && RB_BUILTIN_TYPE(x) == (RUBY_T_SYMBOL))
-#define RB_SYMBOL_P(x) (RB_STATIC_SYM_P(x)||RB_DYNAMIC_SYM_P(x))
-#define RB_ID2SYM(x) (rb_id2sym(x))
-#define RB_SYM2ID(x) (rb_sym2id(x))
-#define STATIC_SYM_P(x) RB_STATIC_SYM_P(x)
-#define DYNAMIC_SYM_P(x) RB_DYNAMIC_SYM_P(x)
-#define SYMBOL_P(x) RB_SYMBOL_P(x)
-#define ID2SYM(x) RB_ID2SYM(x)
-#define SYM2ID(x) RB_SYM2ID(x)
+#define FIX2LONG(x) ((long)RSHIFT((SIGNED_VALUE)(x),1))
+#define FIX2ULONG(x) ((unsigned long)FIX2LONG(x))
+#define FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&FIXNUM_FLAG)
+#define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
+#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
+#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
+
+#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
+
+#define SYMBOL_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
+#define ID2SYM(x) (((VALUE)(x)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
+#define SYM2ID(x) RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT)
#ifndef USE_FLONUM
#if SIZEOF_VALUE >= SIZEOF_DOUBLE
@@ -415,41 +364,62 @@ VALUE rb_id2sym(ID);
#endif
#if USE_FLONUM
-#define RB_FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG)
+#define FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&FLONUM_MASK) == FLONUM_FLAG)
#else
-#define RB_FLONUM_P(x) 0
+#define FLONUM_P(x) 0
#endif
-#define FLONUM_P(x) RB_FLONUM_P(x)
/* Module#methods, #singleton_methods and so on return Symbols */
#define USE_SYMBOL_AS_METHOD_NAME 1
+/*
+!USE_FLONUM
+-------------------------
+...xxxx xxx1 Fixnum
+...0000 1110 Symbol
+...0000 0000 Qfalse
+...0000 0010 Qtrue
+...0000 0100 Qnil
+...0000 0110 Qundef
+
+USE_FLONUM
+-------------------------
+...xxxx xxx1 Fixnum
+...xxxx xx10 Flonum
+...0000 1100 Symbol
+...0000 0000 Qfalse 0x00 = 0
+...0000 1000 Qnil 0x08 = 8
+...0001 0100 Qtrue 0x14 = 20
+...0011 0100 Qundef 0x34 = 52
+ */
+
/* special constants - i.e. non-zero and non-fixnum constants */
enum ruby_special_consts {
#if USE_FLONUM
- RUBY_Qfalse = 0x00, /* ...0000 0000 */
- RUBY_Qtrue = 0x14, /* ...0001 0100 */
- RUBY_Qnil = 0x08, /* ...0000 1000 */
- RUBY_Qundef = 0x34, /* ...0011 0100 */
+ RUBY_Qfalse = 0x00,
+ RUBY_Qtrue = 0x14,
+ RUBY_Qnil = 0x08,
+ RUBY_Qundef = 0x34,
RUBY_IMMEDIATE_MASK = 0x07,
- RUBY_FIXNUM_FLAG = 0x01, /* ...xxxx xxx1 */
+ RUBY_FIXNUM_FLAG = 0x01,
RUBY_FLONUM_MASK = 0x03,
- RUBY_FLONUM_FLAG = 0x02, /* ...xxxx xx10 */
- RUBY_SYMBOL_FLAG = 0x0c, /* ...0000 1100 */
+ RUBY_FLONUM_FLAG = 0x02,
+ RUBY_SYMBOL_FLAG = 0x0c,
+ RUBY_SPECIAL_SHIFT = 8
#else
- RUBY_Qfalse = 0, /* ...0000 0000 */
- RUBY_Qtrue = 2, /* ...0000 0010 */
- RUBY_Qnil = 4, /* ...0000 0100 */
- RUBY_Qundef = 6, /* ...0000 0110 */
+ RUBY_Qfalse = 0,
+ RUBY_Qtrue = 2,
+ RUBY_Qnil = 4,
+ RUBY_Qundef = 6,
RUBY_IMMEDIATE_MASK = 0x03,
- RUBY_FIXNUM_FLAG = 0x01, /* ...xxxx xxx1 */
+ RUBY_FIXNUM_FLAG = 0x01,
RUBY_FLONUM_MASK = 0x00, /* any values ANDed with FLONUM_MASK cannot be FLONUM_FLAG */
RUBY_FLONUM_FLAG = 0x02,
- RUBY_SYMBOL_FLAG = 0x0e, /* ...0000 1110 */
-#endif
+ RUBY_SYMBOL_FLAG = 0x0e,
RUBY_SPECIAL_SHIFT = 8
+#endif
};
#define Qfalse ((VALUE)RUBY_Qfalse)
@@ -493,12 +463,11 @@ enum ruby_value_type {
RUBY_T_FALSE = 0x13,
RUBY_T_SYMBOL = 0x14,
RUBY_T_FIXNUM = 0x15,
- RUBY_T_UNDEF = 0x16,
- RUBY_T_IMEMO = 0x1a,
- RUBY_T_NODE = 0x1b,
- RUBY_T_ICLASS = 0x1c,
- RUBY_T_ZOMBIE = 0x1d,
+ RUBY_T_UNDEF = 0x1b,
+ RUBY_T_NODE = 0x1c,
+ RUBY_T_ICLASS = 0x1d,
+ RUBY_T_ZOMBIE = 0x1e,
RUBY_T_MASK = 0x1f
};
@@ -525,49 +494,33 @@ enum ruby_value_type {
#define T_SYMBOL RUBY_T_SYMBOL
#define T_RATIONAL RUBY_T_RATIONAL
#define T_COMPLEX RUBY_T_COMPLEX
-#define T_IMEMO RUBY_T_IMEMO
#define T_UNDEF RUBY_T_UNDEF
#define T_NODE RUBY_T_NODE
#define T_ZOMBIE RUBY_T_ZOMBIE
#define T_MASK RUBY_T_MASK
-#define RB_BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & RUBY_T_MASK)
-#define BUILTIN_TYPE(x) RB_BUILTIN_TYPE(x)
+#define BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & T_MASK)
static inline int rb_type(VALUE obj);
#define TYPE(x) rb_type((VALUE)(x))
-#define RB_FLOAT_TYPE_P(obj) (\
- RB_FLONUM_P(obj) || \
- (!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == RUBY_T_FLOAT))
-
-#define RB_TYPE_P(obj, type) ( \
- ((type) == RUBY_T_FIXNUM) ? RB_FIXNUM_P(obj) : \
- ((type) == RUBY_T_TRUE) ? ((obj) == RUBY_Qtrue) : \
- ((type) == RUBY_T_FALSE) ? ((obj) == RUBY_Qfalse) : \
- ((type) == RUBY_T_NIL) ? ((obj) == RUBY_Qnil) : \
- ((type) == RUBY_T_UNDEF) ? ((obj) == RUBY_Qundef) : \
- ((type) == RUBY_T_SYMBOL) ? RB_SYMBOL_P(obj) : \
- ((type) == RUBY_T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
- (!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == (type)))
-
+/* RB_GC_GUARD_PTR() is an intermediate macro, and has no effect by
+ * itself. don't use it directly */
#ifdef __GNUC__
-#define RB_GC_GUARD(v) \
- (*__extension__ ({ \
- volatile VALUE *rb_gc_guarded_ptr = &(v); \
- __asm__("" : : "m"(rb_gc_guarded_ptr)); \
- rb_gc_guarded_ptr; \
- }))
-#elif defined _MSC_VER
+#define RB_GC_GUARD_PTR(ptr) \
+ __extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
+#else
+#ifdef _MSC_VER
#pragma optimize("", off)
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
#pragma optimize("", on)
-#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr(&(v)))
#else
-volatile VALUE *rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val);
-#define HAVE_RB_GC_GUARDED_PTR_VAL 1
-#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr_val(&(v),(v)))
+volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr);
+#define HAVE_RB_GC_GUARDED_PTR 1
+#endif
+#define RB_GC_GUARD_PTR(ptr) rb_gc_guarded_ptr(ptr)
#endif
+#define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
#ifdef __GNUC__
#define RB_UNUSED_VAR(x) x __attribute__ ((unused))
@@ -588,17 +541,13 @@ char *rb_string_value_cstr(volatile VALUE*);
#define StringValueCStr(v) rb_string_value_cstr(&(v))
void rb_check_safe_obj(VALUE);
+DEPRECATED(void rb_check_safe_str(VALUE));
#define SafeStringValue(v) do {\
StringValue(v);\
rb_check_safe_obj(v);\
} while (0)
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-void rb_check_safe_str(VALUE) __attribute__((error("rb_check_safe_str() and Check_SafeStr() are obsolete; use SafeStringValue() instead")));
-# define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
-#else
-# define rb_check_safe_str(x) [<"rb_check_safe_str() is obsolete; use SafeStringValue() instead">]
-# define Check_SafeStr(v) [<"Check_SafeStr() is obsolete; use SafeStringValue() instead">]
-#endif
+/* obsolete macro - use SafeStringValue(v) */
+#define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
VALUE rb_str_export(VALUE);
#define ExportStringValue(v) do {\
@@ -613,34 +562,21 @@ VALUE rb_get_path(VALUE);
VALUE rb_get_path_no_checksafe(VALUE);
#define FilePathStringValue(v) ((v) = rb_get_path_no_checksafe(v))
-#define RUBY_SAFE_LEVEL_MAX 1
+#define RUBY_SAFE_LEVEL_MAX 3
void rb_secure(int);
int rb_safe_level(void);
void rb_set_safe_level(int);
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-int ruby_safe_level_2_error(void) __attribute__((error("$SAFE=2 to 4 are obsolete")));
-int ruby_safe_level_2_warning(void) __attribute__((warning("$SAFE=2 to 4 are obsolete")));
+int ruby_safe_level_4_error(void) __attribute__((error("$SAFE=4 is obsolete")));
+int ruby_safe_level_4_warning(void) __attribute__((warning("$SAFE=4 is obsolete")));
# ifdef RUBY_EXPORT
-# define ruby_safe_level_2_warning() ruby_safe_level_2_error()
+# define ruby_safe_level_4_warning() ruby_safe_level_4_error()
# endif
-#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
-# define RUBY_SAFE_LEVEL_INVALID_P(level) \
- __extension__(\
- __builtin_choose_expr(\
- __builtin_constant_p(level), \
- ((level) < 0 || RUBY_SAFE_LEVEL_MAX < (level)), 0))
-# define RUBY_SAFE_LEVEL_CHECK(level, type) \
- __extension__(__builtin_choose_expr(RUBY_SAFE_LEVEL_INVALID_P(level), ruby_safe_level_2_##type(), (level)))
-#else
-/* in gcc 4.8 or earlier, __builtin_choose_expr() does not consider
- * __builtin_constant_p(variable) a constant expression.
- */
-# define RUBY_SAFE_LEVEL_INVALID_P(level) \
+#define RUBY_SAFE_LEVEL_INVALID_P(level) \
__extension__(__builtin_constant_p(level) && \
((level) < 0 || RUBY_SAFE_LEVEL_MAX < (level)))
-# define RUBY_SAFE_LEVEL_CHECK(level, type) \
- (RUBY_SAFE_LEVEL_INVALID_P(level) ? ruby_safe_level_2_##type() : (level))
-#endif
+#define RUBY_SAFE_LEVEL_CHECK(level, type) \
+ (RUBY_SAFE_LEVEL_INVALID_P(level) ? ruby_safe_level_4_##type() : (level))
#define rb_secure(level) rb_secure(RUBY_SAFE_LEVEL_CHECK(level, warning))
#define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error))
#endif
@@ -651,77 +587,68 @@ NORETURN(void rb_insecure_operation(void));
VALUE rb_errinfo(void);
void rb_set_errinfo(VALUE);
-long rb_num2long(VALUE);
-unsigned long rb_num2ulong(VALUE);
+SIGNED_VALUE rb_num2long(VALUE);
+VALUE rb_num2ulong(VALUE);
static inline long
rb_num2long_inline(VALUE x)
{
- if (RB_FIXNUM_P(x))
- return RB_FIX2LONG(x);
+ if (FIXNUM_P(x))
+ return FIX2LONG(x);
else
- return rb_num2long(x);
+ return (long)rb_num2long(x);
}
-#define RB_NUM2LONG(x) rb_num2long_inline(x)
-#define NUM2LONG(x) RB_NUM2LONG(x)
+#define NUM2LONG(x) rb_num2long_inline(x)
static inline unsigned long
rb_num2ulong_inline(VALUE x)
{
- if (RB_FIXNUM_P(x))
- return RB_FIX2ULONG(x);
+ if (FIXNUM_P(x))
+ return (unsigned long)FIX2LONG(x);
else
- return rb_num2ulong(x);
+ return (unsigned long)rb_num2ulong(x);
}
-#define RB_NUM2ULONG(x) rb_num2ulong_inline(x)
-#define NUM2ULONG(x) RB_NUM2ULONG(x)
+#define NUM2ULONG(x) rb_num2ulong_inline(x)
#if SIZEOF_INT < SIZEOF_LONG
long rb_num2int(VALUE);
long rb_fix2int(VALUE);
-#define RB_FIX2INT(x) ((int)rb_fix2int((VALUE)(x)))
+#define FIX2INT(x) ((int)rb_fix2int((VALUE)(x)))
static inline int
rb_num2int_inline(VALUE x)
{
- if (RB_FIXNUM_P(x))
- return (int)rb_fix2int(x);
+ if (FIXNUM_P(x))
+ return FIX2INT(x);
else
return (int)rb_num2int(x);
}
-#define RB_NUM2INT(x) rb_num2int_inline(x)
+#define NUM2INT(x) rb_num2int_inline(x)
unsigned long rb_num2uint(VALUE);
-#define RB_NUM2UINT(x) ((unsigned int)rb_num2uint(x))
+#define NUM2UINT(x) ((unsigned int)rb_num2uint(x))
unsigned long rb_fix2uint(VALUE);
-#define RB_FIX2UINT(x) ((unsigned int)rb_fix2uint(x))
+#define FIX2UINT(x) ((unsigned int)rb_fix2uint(x))
#else /* SIZEOF_INT < SIZEOF_LONG */
-#define RB_NUM2INT(x) ((int)RB_NUM2LONG(x))
-#define RB_NUM2UINT(x) ((unsigned int)RB_NUM2ULONG(x))
-#define RB_FIX2INT(x) ((int)RB_FIX2LONG(x))
-#define RB_FIX2UINT(x) ((unsigned int)RB_FIX2ULONG(x))
+#define NUM2INT(x) ((int)NUM2LONG(x))
+#define NUM2UINT(x) ((unsigned int)NUM2ULONG(x))
+#define FIX2INT(x) ((int)FIX2LONG(x))
+#define FIX2UINT(x) ((unsigned int)FIX2ULONG(x))
#endif /* SIZEOF_INT < SIZEOF_LONG */
-#define NUM2INT(x) RB_NUM2INT(x)
-#define NUM2UINT(x) RB_NUM2UINT(x)
-#define FIX2INT(x) RB_FIX2INT(x)
-#define FIX2UINT(x) RB_FIX2UINT(x)
short rb_num2short(VALUE);
unsigned short rb_num2ushort(VALUE);
short rb_fix2short(VALUE);
unsigned short rb_fix2ushort(VALUE);
-#define RB_FIX2SHORT(x) (rb_fix2short((VALUE)(x)))
-#define FIX2SHORT(x) RB_FIX2SHORT(x)
+#define FIX2SHORT(x) (rb_fix2short((VALUE)(x)))
static inline short
rb_num2short_inline(VALUE x)
{
- if (RB_FIXNUM_P(x))
- return rb_fix2short(x);
+ if (FIXNUM_P(x))
+ return FIX2SHORT(x);
else
return rb_num2short(x);
}
-#define RB_NUM2SHORT(x) rb_num2short_inline(x)
-#define RB_NUM2USHORT(x) rb_num2ushort(x)
-#define NUM2SHORT(x) RB_NUM2SHORT(x)
-#define NUM2USHORT(x) RB_NUM2USHORT(x)
+#define NUM2SHORT(x) rb_num2short_inline(x)
+#define NUM2USHORT(x) rb_num2ushort(x)
#ifdef HAVE_LONG_LONG
LONG_LONG rb_num2ll(VALUE);
@@ -729,15 +656,13 @@ unsigned LONG_LONG rb_num2ull(VALUE);
static inline LONG_LONG
rb_num2ll_inline(VALUE x)
{
- if (RB_FIXNUM_P(x))
- return RB_FIX2LONG(x);
+ if (FIXNUM_P(x))
+ return FIX2LONG(x);
else
return rb_num2ll(x);
}
-# define RB_NUM2LL(x) rb_num2ll_inline(x)
-# define RB_NUM2ULL(x) rb_num2ull(x)
-# define NUM2LL(x) RB_NUM2LL(x)
-# define NUM2ULL(x) RB_NUM2ULL(x)
+# define NUM2LL(x) rb_num2ll_inline(x)
+# define NUM2ULL(x) rb_num2ull(x)
#endif
#if !defined(NUM2OFFT)
@@ -765,23 +690,21 @@ VALUE rb_int2big(SIGNED_VALUE);
VALUE rb_newobj(void);
VALUE rb_newobj_of(VALUE, VALUE);
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
-#define RB_NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj()
-#define RB_NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
-#define NEWOBJ(obj,type) RB_NEWOBJ(obj,type)
-#define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags) /* core has special NEWOBJ_OF() in internal.h */
+#define NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj()
+#define NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
#define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
-#define CLONESETUP(clone,obj) rb_clone_setup(clone,obj)
-#define DUPSETUP(dup,obj) rb_dup_setup(dup,obj)
+#define CLONESETUP(clone,obj) do {\
+ OBJSETUP((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
+ rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)(clone));\
+ if (FL_TEST((obj), FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(clone),(VALUE)(obj));\
+} while (0)
+#define DUPSETUP(dup,obj) do {\
+ OBJSETUP((dup),rb_obj_class(obj), (RBASIC(obj)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT)); \
+ if (FL_TEST((obj), FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(dup),(VALUE)(obj));\
+} while (0)
#ifndef USE_RGENGC
#define USE_RGENGC 1
-#ifndef USE_RINCGC
-#define USE_RINCGC 1
-#endif
-#endif
-
-#if USE_RGENGC == 0
-#define USE_RINCGC 0
#endif
#ifndef RGENGC_WB_PROTECTED_ARRAY
@@ -817,53 +740,6 @@ VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
#ifndef RGENGC_WB_PROTECTED_BIGNUM
#define RGENGC_WB_PROTECTED_BIGNUM 1
#endif
-#ifndef RGENGC_WB_PROTECTED_NODE_CREF
-#define RGENGC_WB_PROTECTED_NODE_CREF 1
-#endif
-
-enum ruby_fl_type {
- RUBY_FL_WB_PROTECTED = (1<<5),
- RUBY_FL_PROMOTED0 = (1<<5),
- RUBY_FL_PROMOTED1 = (1<<6),
- RUBY_FL_PROMOTED = RUBY_FL_PROMOTED0|RUBY_FL_PROMOTED1,
- RUBY_FL_FINALIZE = (1<<7),
- RUBY_FL_TAINT = (1<<8),
- RUBY_FL_UNTRUSTED = RUBY_FL_TAINT,
- RUBY_FL_EXIVAR = (1<<10),
- RUBY_FL_FREEZE = (1<<11),
-
- RUBY_FL_USHIFT = 12,
-
-#define RUBY_FL_USER_N(n) RUBY_FL_USER##n = (1<<(RUBY_FL_USHIFT+n))
- RUBY_FL_USER_N(0),
- RUBY_FL_USER_N(1),
- RUBY_FL_USER_N(2),
- RUBY_FL_USER_N(3),
- RUBY_FL_USER_N(4),
- RUBY_FL_USER_N(5),
- RUBY_FL_USER_N(6),
- RUBY_FL_USER_N(7),
- RUBY_FL_USER_N(8),
- RUBY_FL_USER_N(9),
- RUBY_FL_USER_N(10),
- RUBY_FL_USER_N(11),
- RUBY_FL_USER_N(12),
- RUBY_FL_USER_N(13),
- RUBY_FL_USER_N(14),
- RUBY_FL_USER_N(15),
- RUBY_FL_USER_N(16),
- RUBY_FL_USER_N(17),
- RUBY_FL_USER_N(18),
-#if defined ENUM_OVER_INT || SIZEOF_INT*CHAR_BIT>12+19+1
- RUBY_FL_USER_N(19),
-#else
-#define RUBY_FL_USER19 (((VALUE)1)<<(RUBY_FL_USHIFT+19))
-#endif
-
- RUBY_ELTS_SHARED = RUBY_FL_USER2,
- RUBY_FL_DUPPED = (RUBY_T_MASK|RUBY_FL_EXIVAR|RUBY_FL_TAINT),
- RUBY_FL_SINGLETON = RUBY_FL_USER0
-};
struct RBasic {
VALUE flags;
@@ -877,40 +753,21 @@ struct RBasic {
VALUE rb_obj_hide(VALUE obj);
VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change klass information */
-#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
-# define RB_OBJ_WB_UNPROTECT_FOR(type, obj) \
- __extension__( \
- __builtin_choose_expr( \
- RGENGC_WB_PROTECTED_##type, \
- OBJ_WB_UNPROTECT((VALUE)(obj)), ((VALUE)(obj))))
-#else
-# define RB_OBJ_WB_UNPROTECT_FOR(type, obj) \
- (RGENGC_WB_PROTECTED_##type ? \
- OBJ_WB_UNPROTECT((VALUE)(obj)) : ((VALUE)(obj)))
-#endif
-
#define RBASIC_CLASS(obj) (RBASIC(obj)->klass)
-#define ROBJECT_EMBED_LEN_MAX ROBJECT_EMBED_LEN_MAX
-#define ROBJECT_EMBED ROBJECT_EMBED
-enum {
- ROBJECT_EMBED_LEN_MAX = 3,
- ROBJECT_EMBED = RUBY_FL_USER1,
-
- ROBJECT_ENUM_END
-};
-
+#define ROBJECT_EMBED_LEN_MAX 3
struct RObject {
struct RBasic basic;
union {
struct {
- long numiv; /* only uses 32-bits */
+ long numiv;
VALUE *ivptr;
- void *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */
+ struct st_table *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */
} heap;
VALUE ary[ROBJECT_EMBED_LEN_MAX];
} as;
};
+#define ROBJECT_EMBED FL_USER1
#define ROBJECT_NUMIV(o) \
((RBASIC(o)->flags & ROBJECT_EMBED) ? \
ROBJECT_EMBED_LEN_MAX : \
@@ -924,27 +781,27 @@ struct RObject {
RCLASS_IV_INDEX_TBL(rb_obj_class(o)) : \
ROBJECT(o)->as.heap.iv_index_tbl)
-#define RClass RClassDeprecated
-#ifndef __cplusplus
-DEPRECATED_TYPE(("RClass is internal use only"),
+/** @internal */
+typedef struct rb_classext_struct rb_classext_t;
+
struct RClass {
struct RBasic basic;
-});
-#endif
+ rb_classext_t *ptr;
+ struct st_table *m_tbl;
+ struct st_table *iv_index_tbl;
+};
#define RCLASS_SUPER(c) rb_class_get_superclass(c)
#define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m)
#define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m)
#define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
#define RMODULE_SUPER(m) RCLASS_SUPER(m)
-#define RMODULE_IS_OVERLAID RMODULE_IS_OVERLAID
-#define RMODULE_IS_REFINEMENT RMODULE_IS_REFINEMENT
-#define RMODULE_INCLUDED_INTO_REFINEMENT RMODULE_INCLUDED_INTO_REFINEMENT
-enum {
- RMODULE_IS_OVERLAID = RUBY_FL_USER2,
- RMODULE_IS_REFINEMENT = RUBY_FL_USER3,
- RMODULE_INCLUDED_INTO_REFINEMENT = RUBY_FL_USER4,
-
- RMODULE_ENUM_END
+#define RMODULE_IS_OVERLAID FL_USER2
+#define RMODULE_IS_REFINEMENT FL_USER3
+#define RMODULE_INCLUDED_INTO_REFINEMENT FL_USER4
+
+struct RFloat {
+ struct RBasic basic;
+ double float_value;
};
double rb_float_value(VALUE);
@@ -954,24 +811,9 @@ VALUE rb_float_new_in_heap(double);
#define RFLOAT_VALUE(v) rb_float_value(v)
#define DBL2NUM(dbl) rb_float_new(dbl)
-#define RUBY_ELTS_SHARED RUBY_ELTS_SHARED
-#define ELTS_SHARED RUBY_ELTS_SHARED
-
-#define RSTRING_NOEMBED RSTRING_NOEMBED
-#define RSTRING_EMBED_LEN_MASK RSTRING_EMBED_LEN_MASK
-#define RSTRING_EMBED_LEN_SHIFT RSTRING_EMBED_LEN_SHIFT
-#define RSTRING_EMBED_LEN_MAX RSTRING_EMBED_LEN_MAX
-#define RSTRING_FSTR RSTRING_FSTR
-enum {
- RSTRING_NOEMBED = RUBY_FL_USER1,
- RSTRING_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|
- RUBY_FL_USER5|RUBY_FL_USER6),
- RSTRING_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+2),
- RSTRING_EMBED_LEN_MAX = (int)((sizeof(VALUE)*3)/sizeof(char)-1),
- RSTRING_FSTR = RUBY_FL_USER17,
-
- RSTRING_ENUM_END
-};
+#define ELTS_SHARED FL_USER2
+
+#define RSTRING_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(char)-1))
struct RString {
struct RBasic basic;
union {
@@ -986,6 +828,10 @@ struct RString {
char ary[RSTRING_EMBED_LEN_MAX + 1];
} as;
};
+#define RSTRING_NOEMBED FL_USER1
+#define RSTRING_FSTR FL_USER17
+#define RSTRING_EMBED_LEN_MASK (FL_USER2|FL_USER3|FL_USER4|FL_USER5|FL_USER6)
+#define RSTRING_EMBED_LEN_SHIFT (FL_USHIFT+2)
#define RSTRING_EMBED_LEN(str) \
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
(RSTRING_EMBED_LEN_MASK >> RSTRING_EMBED_LEN_SHIFT))
@@ -1007,19 +853,7 @@ struct RString {
((ptrvar) = RSTRING(str)->as.ary, (lenvar) = RSTRING_EMBED_LEN(str)) : \
((ptrvar) = RSTRING(str)->as.heap.ptr, (lenvar) = RSTRING(str)->as.heap.len))
-#define RARRAY_EMBED_FLAG RARRAY_EMBED_FLAG
-#define RARRAY_EMBED_LEN_MASK RARRAY_EMBED_LEN_MASK
-#define RARRAY_EMBED_LEN_MAX RARRAY_EMBED_LEN_MAX
-#define RARRAY_EMBED_LEN_SHIFT RARRAY_EMBED_LEN_SHIFT
-enum {
- RARRAY_EMBED_LEN_MAX = 3,
- RARRAY_EMBED_FLAG = RUBY_FL_USER1,
- /* RUBY_FL_USER2 is for ELTS_SHARED */
- RARRAY_EMBED_LEN_MASK = (RUBY_FL_USER4|RUBY_FL_USER3),
- RARRAY_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+3),
-
- RARRAY_ENUM_END
-};
+#define RARRAY_EMBED_LEN_MAX 3
struct RArray {
struct RBasic basic;
union {
@@ -1034,12 +868,22 @@ struct RArray {
const VALUE ary[RARRAY_EMBED_LEN_MAX];
} as;
};
-#define RARRAY_EMBED_LEN(a) \
- (long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
- (RARRAY_EMBED_LEN_MASK >> RARRAY_EMBED_LEN_SHIFT))
-#define RARRAY_LEN(a) rb_array_len(a)
+#define RARRAY_EMBED_FLAG FL_USER1
+/* FL_USER2 is for ELTS_SHARED */
+#define RARRAY_EMBED_LEN_MASK (FL_USER4|FL_USER3)
+#define RARRAY_EMBED_LEN_SHIFT (FL_USHIFT+3)
+#define RARRAY_LEN(a) \
+ ((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ? \
+ (long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
+ (RARRAY_EMBED_LEN_MASK >> RARRAY_EMBED_LEN_SHIFT)) : \
+ RARRAY(a)->as.heap.len)
+
#define RARRAY_LENINT(ary) rb_long2int(RARRAY_LEN(ary))
-#define RARRAY_CONST_PTR(a) rb_array_const_ptr(a)
+
+#define RARRAY_CONST_PTR(a) \
+ ((const VALUE *)((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ? \
+ RARRAY(a)->as.ary : \
+ RARRAY(a)->as.heap.ptr))
#define RARRAY_PTR_USE_START(a) ((VALUE *)RARRAY_CONST_PTR(a))
#define RARRAY_PTR_USE_END(a) /* */
@@ -1053,13 +897,11 @@ struct RArray {
#define RARRAY_AREF(a, i) (RARRAY_CONST_PTR(a)[i])
#define RARRAY_ASET(a, i, v) do { \
- const VALUE _ary = (a); \
- VALUE *ptr = (VALUE *)RARRAY_PTR_USE_START(_ary); \
- RB_OBJ_WRITE(_ary, &ptr[i], (v)); \
- RARRAY_PTR_USE_END(_ary); \
+ const VALUE _ary_ = (a); \
+ OBJ_WRITE(_ary_, &RARRAY_CONST_PTR(_ary_)[i], (v)); \
} while (0)
-#define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(ARRAY, a)))
+#define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_UNPROTECT((VALUE)a) : ((VALUE)a)))
struct RRegexp {
struct RBasic basic;
@@ -1072,11 +914,17 @@ struct RRegexp {
#define RREGEXP_SRC_LEN(r) RSTRING_LEN(RREGEXP(r)->src)
#define RREGEXP_SRC_END(r) RSTRING_END(RREGEXP(r)->src)
+struct RHash {
+ struct RBasic basic;
+ struct st_table *ntbl; /* possibly 0 */
+ int iter_lev;
+ const VALUE ifnone;
+};
/* RHASH_TBL allocates st_table if not available. */
#define RHASH_TBL(h) rb_hash_tbl(h)
-#define RHASH_ITER_LEV(h) rb_hash_iter_lev(h)
-#define RHASH_IFNONE(h) rb_hash_ifnone(h)
-#define RHASH_SIZE(h) NUM2SIZET(rb_hash_size(h))
+#define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
+#define RHASH_IFNONE(h) (RHASH(h)->ifnone)
+#define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
#define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
#define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
@@ -1085,8 +933,23 @@ struct RFile {
struct rb_io_t *fptr;
};
-#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
-#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
+struct RRational {
+ struct RBasic basic;
+ const VALUE num;
+ const VALUE den;
+};
+
+#define RRATIONAL_SET_NUM(rat, n) OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
+#define RRATIONAL_SET_DEN(rat, d) OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
+
+struct RComplex {
+ struct RBasic basic;
+ const VALUE real;
+ const VALUE imag;
+};
+
+#define RCOMPLEX_SET_REAL(cmp, r) OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
+#define RCOMPLEX_SET_IMAG(cmp, i) OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
struct RData {
struct RBasic basic;
@@ -1109,7 +972,7 @@ struct rb_data_type_struct {
const rb_data_type_t *parent;
void *data; /* This area can be used for any purpose
by a programmer who define the type. */
- VALUE flags; /* RUBY_FL_WB_PROTECTED */
+ VALUE flags; /* FL_WB_PROTECTED */
};
#define HAVE_TYPE_RB_DATA_TYPE_T 1
@@ -1134,17 +997,8 @@ struct RTypedData {
*/
typedef void (*RUBY_DATA_FUNC)(void*);
-#ifndef RUBY_UNTYPED_DATA_WARNING
-# if defined RUBY_EXPORT
-# define RUBY_UNTYPED_DATA_WARNING 1
-# else
-# define RUBY_UNTYPED_DATA_WARNING 0
-# endif
-#endif
-VALUE rb_data_object_wrap(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
-VALUE rb_data_object_zalloc(VALUE,size_t,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
-VALUE rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *);
-VALUE rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type);
+VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
+VALUE rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *);
int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent);
int rb_typeddata_is_kind_of(VALUE, const rb_data_type_t *);
void *rb_check_typeddata(VALUE, const rb_data_type_t *);
@@ -1156,64 +1010,36 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *);
/* bits for rb_data_type_struct::flags */
#define RUBY_TYPED_FREE_IMMEDIATELY 1 /* TYPE field */
-#define RUBY_TYPED_WB_PROTECTED RUBY_FL_WB_PROTECTED /* THIS FLAG DEPENDS ON Ruby version */
-#define RUBY_TYPED_PROMOTED1 RUBY_FL_PROMOTED1 /* THIS FLAG DEPENDS ON Ruby version */
+#define RUBY_TYPED_WB_PROTECTED FL_WB_PROTECTED
#define Data_Wrap_Struct(klass,mark,free,sval)\
- rb_data_object_wrap((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
-
-#define Data_Make_Struct0(result, klass, type, size, mark, free, sval) \
- VALUE result = rb_data_object_zalloc((klass), (size), \
- (RUBY_DATA_FUNC)(mark), \
- (RUBY_DATA_FUNC)(free)); \
- (void)((sval) = (type *)DATA_PTR(result));
+ rb_data_object_alloc((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
-#ifdef __GNUC__
-#define Data_Make_Struct(klass,type,mark,free,sval) ({\
- Data_Make_Struct0(data_struct_obj, klass, type, sizeof(type), mark, free, sval); \
- data_struct_obj; \
-})
-#else
#define Data_Make_Struct(klass,type,mark,free,sval) (\
- rb_data_object_make((klass),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free),(void **)&(sval),sizeof(type)) \
+ (sval) = ALLOC(type),\
+ memset((sval), 0, sizeof(type)),\
+ Data_Wrap_Struct((klass),(mark),(free),(sval))\
)
-#endif
#define TypedData_Wrap_Struct(klass,data_type,sval)\
- rb_data_typed_object_wrap((klass),(sval),(data_type))
+ rb_data_typed_object_alloc((klass),(sval),(data_type))
-#define TypedData_Make_Struct0(result, klass, type, size, data_type, sval) \
- VALUE result = rb_data_typed_object_zalloc(klass, size, data_type); \
- (void)((sval) = (type *)DATA_PTR(result));
-
-#ifdef __GNUC__
-#define TypedData_Make_Struct(klass, type, data_type, sval) ({\
- TypedData_Make_Struct0(data_struct_obj, klass, type, sizeof(type), data_type, sval); \
- data_struct_obj; \
-})
-#else
#define TypedData_Make_Struct(klass, type, data_type, sval) (\
- rb_data_typed_object_make((klass),(data_type),(void **)&(sval),sizeof(type)) \
+ (sval) = ALLOC(type),\
+ memset((sval), 0, sizeof(type)),\
+ TypedData_Wrap_Struct((klass),(data_type),(sval))\
)
-#endif
-
-#define Data_Get_Struct(obj,type,sval) \
- ((sval) = (type*)rb_data_object_get(obj))
-#define TypedData_Get_Struct(obj,type,data_type,sval) \
- ((sval) = (type*)rb_check_typeddata((obj), (data_type)))
-
-#define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX
-#define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK
-#define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
-enum {
- RSTRUCT_EMBED_LEN_MAX = 3,
- RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
- RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
+#define Data_Get_Struct(obj,type,sval) do {\
+ Check_Type((obj), T_DATA); \
+ (sval) = (type*)DATA_PTR(obj);\
+} while (0)
- RSTRUCT_ENUM_END
-};
+#define TypedData_Get_Struct(obj,type,data_type,sval) do {\
+ (sval) = (type*)rb_check_typeddata((obj), (data_type)); \
+} while (0)
+#define RSTRUCT_EMBED_LEN_MAX 3
struct RStruct {
struct RBasic basic;
union {
@@ -1224,259 +1050,149 @@ struct RStruct {
const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
} as;
};
-
-#define RSTRUCT_EMBED_LEN(st) \
- (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
- (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT))
-#define RSTRUCT_LEN(st) rb_struct_len(st)
+#define RSTRUCT_EMBED_LEN_MASK (FL_USER2|FL_USER1)
+#define RSTRUCT_EMBED_LEN_SHIFT (FL_USHIFT+1)
+#define RSTRUCT_LEN(st) \
+ ((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
+ (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
+ (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT)) : \
+ RSTRUCT(st)->as.heap.len)
#define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st))
-#define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st)
-#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st)))
+#define RSTRUCT_CONST_PTR(st) \
+ ((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
+ RSTRUCT(st)->as.ary : \
+ RSTRUCT(st)->as.heap.ptr)
+#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RGENGC_WB_PROTECTED_STRUCT ? OBJ_WB_UNPROTECT((VALUE)st) : (VALUE)st))
-#define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
+#define RSTRUCT_SET(st, idx, v) OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
#define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
-#define RBIGNUM_SIGN(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0)
-#define RBIGNUM_POSITIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) >= 0)
-#define RBIGNUM_NEGATIVE_P(b) (FIX2LONG(rb_big_cmp((b), INT2FIX(0))) < 0)
+#ifndef RBIGNUM_EMBED_LEN_MAX
+# define RBIGNUM_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(BDIGIT)))
+#endif
+struct RBignum {
+ struct RBasic basic;
+ union {
+ struct {
+ long len;
+ BDIGIT *digits;
+ } heap;
+ BDIGIT ary[RBIGNUM_EMBED_LEN_MAX];
+ } as;
+};
+#define RBIGNUM_SIGN_BIT FL_USER1
+/* sign: positive:1, negative:0 */
+#define RBIGNUM_SIGN(b) ((RBASIC(b)->flags & RBIGNUM_SIGN_BIT) != 0)
+#define RBIGNUM_SET_SIGN(b,sign) \
+ ((sign) ? (RBASIC(b)->flags |= RBIGNUM_SIGN_BIT) \
+ : (RBASIC(b)->flags &= ~RBIGNUM_SIGN_BIT))
+#define RBIGNUM_POSITIVE_P(b) RBIGNUM_SIGN(b)
+#define RBIGNUM_NEGATIVE_P(b) (!RBIGNUM_SIGN(b))
+
+#define RBIGNUM_EMBED_FLAG FL_USER2
+#define RBIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
+#define RBIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+3)
+#define RBIGNUM_LEN(b) \
+ ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
+ (long)((RBASIC(b)->flags >> RBIGNUM_EMBED_LEN_SHIFT) & \
+ (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT)) : \
+ RBIGNUM(b)->as.heap.len)
+/* LSB:RBIGNUM_DIGITS(b)[0], MSB:RBIGNUM_DIGITS(b)[RBIGNUM_LEN(b)-1] */
+#define RBIGNUM_DIGITS(b) \
+ ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
+ RBIGNUM(b)->as.ary : \
+ RBIGNUM(b)->as.heap.digits)
+#define RBIGNUM_LENINT(b) rb_long2int(RBIGNUM_LEN(b))
#define R_CAST(st) (struct st*)
#define RBASIC(obj) (R_CAST(RBasic)(obj))
#define ROBJECT(obj) (R_CAST(RObject)(obj))
#define RCLASS(obj) (R_CAST(RClass)(obj))
#define RMODULE(obj) RCLASS(obj)
+#define RFLOAT(obj) (R_CAST(RFloat)(obj))
#define RSTRING(obj) (R_CAST(RString)(obj))
#define RREGEXP(obj) (R_CAST(RRegexp)(obj))
#define RARRAY(obj) (R_CAST(RArray)(obj))
+#define RHASH(obj) (R_CAST(RHash)(obj))
#define RDATA(obj) (R_CAST(RData)(obj))
#define RTYPEDDATA(obj) (R_CAST(RTypedData)(obj))
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
+#define RBIGNUM(obj) (R_CAST(RBignum)(obj))
#define RFILE(obj) (R_CAST(RFile)(obj))
+#define RRATIONAL(obj) (R_CAST(RRational)(obj))
+#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
+
+#define FL_SINGLETON FL_USER0
+#define FL_WB_PROTECTED (((VALUE)1)<<5)
+#define FL_PROMOTED (((VALUE)1)<<6)
+#define FL_FINALIZE (((VALUE)1)<<7)
+#define FL_TAINT (((VALUE)1)<<8)
+#define FL_UNTRUSTED FL_TAINT
+#define FL_EXIVAR (((VALUE)1)<<10)
+#define FL_FREEZE (((VALUE)1)<<11)
+
+#define FL_USHIFT 12
+
+#define FL_USER0 (((VALUE)1)<<(FL_USHIFT+0))
+#define FL_USER1 (((VALUE)1)<<(FL_USHIFT+1))
+#define FL_USER2 (((VALUE)1)<<(FL_USHIFT+2))
+#define FL_USER3 (((VALUE)1)<<(FL_USHIFT+3))
+#define FL_USER4 (((VALUE)1)<<(FL_USHIFT+4))
+#define FL_USER5 (((VALUE)1)<<(FL_USHIFT+5))
+#define FL_USER6 (((VALUE)1)<<(FL_USHIFT+6))
+#define FL_USER7 (((VALUE)1)<<(FL_USHIFT+7))
+#define FL_USER8 (((VALUE)1)<<(FL_USHIFT+8))
+#define FL_USER9 (((VALUE)1)<<(FL_USHIFT+9))
+#define FL_USER10 (((VALUE)1)<<(FL_USHIFT+10))
+#define FL_USER11 (((VALUE)1)<<(FL_USHIFT+11))
+#define FL_USER12 (((VALUE)1)<<(FL_USHIFT+12))
+#define FL_USER13 (((VALUE)1)<<(FL_USHIFT+13))
+#define FL_USER14 (((VALUE)1)<<(FL_USHIFT+14))
+#define FL_USER15 (((VALUE)1)<<(FL_USHIFT+15))
+#define FL_USER16 (((VALUE)1)<<(FL_USHIFT+16))
+#define FL_USER17 (((VALUE)1)<<(FL_USHIFT+17))
+#define FL_USER18 (((VALUE)1)<<(FL_USHIFT+18))
+#define FL_USER19 (((VALUE)1)<<(FL_USHIFT+19))
+
+#define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
+
+#define FL_ABLE(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) != T_NODE)
+#define FL_TEST_RAW(x,f) (RBASIC(x)->flags&(f))
+#define FL_TEST(x,f) (FL_ABLE(x)?FL_TEST_RAW((x),(f)):0)
+#define FL_ANY(x,f) FL_TEST((x),(f))
+#define FL_ALL(x,f) (FL_TEST((x),(f)) == (f))
+#define FL_SET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags |= (f);} while (0)
+#define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
+#define FL_REVERSE(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags ^= (f);} while (0)
+
+#define OBJ_TAINTED(x) (!!FL_TEST((x), FL_TAINT))
+#define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
+#define OBJ_UNTRUSTED(x) OBJ_TAINTED(x)
+#define OBJ_UNTRUST(x) OBJ_TAINT(x)
+#define OBJ_INFECT(x,s) do { \
+ if (FL_ABLE(x) && FL_ABLE(s)) \
+ RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT; \
+} while (0)
-#define FL_SINGLETON RUBY_FL_SINGLETON
-#define FL_WB_PROTECTED RUBY_FL_WB_PROTECTED
-#define FL_PROMOTED0 RUBY_FL_PROMOTED0
-#define FL_PROMOTED1 RUBY_FL_PROMOTED1
-#define FL_FINALIZE RUBY_FL_FINALIZE
-#define FL_TAINT RUBY_FL_TAINT
-#define FL_UNTRUSTED RUBY_FL_UNTRUSTED
-#define FL_EXIVAR RUBY_FL_EXIVAR
-#define FL_FREEZE RUBY_FL_FREEZE
-
-#define FL_USHIFT RUBY_FL_USHIFT
-
-#define FL_USER0 RUBY_FL_USER0
-#define FL_USER1 RUBY_FL_USER1
-#define FL_USER2 RUBY_FL_USER2
-#define FL_USER3 RUBY_FL_USER3
-#define FL_USER4 RUBY_FL_USER4
-#define FL_USER5 RUBY_FL_USER5
-#define FL_USER6 RUBY_FL_USER6
-#define FL_USER7 RUBY_FL_USER7
-#define FL_USER8 RUBY_FL_USER8
-#define FL_USER9 RUBY_FL_USER9
-#define FL_USER10 RUBY_FL_USER10
-#define FL_USER11 RUBY_FL_USER11
-#define FL_USER12 RUBY_FL_USER12
-#define FL_USER13 RUBY_FL_USER13
-#define FL_USER14 RUBY_FL_USER14
-#define FL_USER15 RUBY_FL_USER15
-#define FL_USER16 RUBY_FL_USER16
-#define FL_USER17 RUBY_FL_USER17
-#define FL_USER18 RUBY_FL_USER18
-#define FL_USER19 RUBY_FL_USER19
-
-#define RB_SPECIAL_CONST_P(x) (RB_IMMEDIATE_P(x) || !RTEST(x))
-#define SPECIAL_CONST_P(x) RB_SPECIAL_CONST_P(x)
-
-#define RB_FL_ABLE(x) (!RB_SPECIAL_CONST_P(x) && RB_BUILTIN_TYPE(x) != RUBY_T_NODE)
-#define RB_FL_TEST_RAW(x,f) (RBASIC(x)->flags&(f))
-#define RB_FL_TEST(x,f) (RB_FL_ABLE(x)?RB_FL_TEST_RAW((x),(f)):0)
-#define RB_FL_ANY_RAW(x,f) RB_FL_TEST_RAW((x),(f))
-#define RB_FL_ANY(x,f) RB_FL_TEST((x),(f))
-#define RB_FL_ALL_RAW(x,f) (RB_FL_TEST_RAW((x),(f)) == (f))
-#define RB_FL_ALL(x,f) (RB_FL_TEST((x),(f)) == (f))
-#define RB_FL_SET_RAW(x,f) (void)(RBASIC(x)->flags |= (f))
-#define RB_FL_SET(x,f) (RB_FL_ABLE(x) ? RB_FL_SET_RAW(x, f) : (void)0)
-#define RB_FL_UNSET_RAW(x,f) (void)(RBASIC(x)->flags &= ~(f))
-#define RB_FL_UNSET(x,f) (RB_FL_ABLE(x) ? RB_FL_UNSET_RAW(x, f) : (void)0)
-#define RB_FL_REVERSE_RAW(x,f) (void)(RBASIC(x)->flags ^= (f))
-#define RB_FL_REVERSE(x,f) (RB_FL_ABLE(x) ? RB_FL_REVERSE_RAW(x, f) : (void)0)
-
-#define RB_OBJ_TAINTABLE(x) (RB_FL_ABLE(x) && RB_BUILTIN_TYPE(x) != RUBY_T_BIGNUM && RB_BUILTIN_TYPE(x) != RUBY_T_FLOAT)
-#define RB_OBJ_TAINTED_RAW(x) RB_FL_TEST_RAW(x, RUBY_FL_TAINT)
-#define RB_OBJ_TAINTED(x) (!!RB_FL_TEST((x), RUBY_FL_TAINT))
-#define RB_OBJ_TAINT_RAW(x) RB_FL_SET_RAW(x, RUBY_FL_TAINT)
-#define RB_OBJ_TAINT(x) (RB_OBJ_TAINTABLE(x) ? RB_OBJ_TAINT_RAW(x) : (void)0)
-#define RB_OBJ_UNTRUSTED(x) RB_OBJ_TAINTED(x)
-#define RB_OBJ_UNTRUST(x) RB_OBJ_TAINT(x)
-#define RB_OBJ_INFECT_RAW(x,s) RB_FL_SET_RAW(x, RB_OBJ_TAINTED_RAW(s))
-#define RB_OBJ_INFECT(x,s) ( \
- (RB_OBJ_TAINTABLE(x) && RB_FL_ABLE(s)) ? \
- RB_OBJ_INFECT_RAW(x, s) : (void)0)
-
-#define RB_OBJ_FROZEN_RAW(x) (RBASIC(x)->flags&RUBY_FL_FREEZE)
-#define RB_OBJ_FROZEN(x) (!RB_FL_ABLE(x) || RB_OBJ_FROZEN_RAW(x))
-#define RB_OBJ_FREEZE_RAW(x) (void)(RBASIC(x)->flags |= RUBY_FL_FREEZE)
-#define RB_OBJ_FREEZE(x) rb_obj_freeze_inline((VALUE)x)
-
-#define FL_ABLE(x) RB_FL_ABLE(x)
-#define FL_TEST_RAW(x,f) RB_FL_TEST_RAW(x,f)
-#define FL_TEST(x,f) RB_FL_TEST(x,f)
-#define FL_ANY_RAW(x,f) RB_FL_ANY_RAW(x,f)
-#define FL_ANY(x,f) RB_FL_ANY(x,f)
-#define FL_ALL_RAW(x,f) RB_FL_ALL_RAW(x,f)
-#define FL_ALL(x,f) RB_FL_ALL(x,f)
-#define FL_SET_RAW(x,f) RB_FL_SET_RAW(x,f)
-#define FL_SET(x,f) RB_FL_SET(x,f)
-#define FL_UNSET_RAW(x,f) RB_FL_UNSET_RAW(x,f)
-#define FL_UNSET(x,f) RB_FL_UNSET(x,f)
-#define FL_REVERSE_RAW(x,f) RB_FL_REVERSE_RAW(x,f)
-#define FL_REVERSE(x,f) RB_FL_REVERSE(x,f)
-
-#define OBJ_TAINTABLE(x) RB_OBJ_TAINTABLE(x)
-#define OBJ_TAINTED_RAW(x) RB_OBJ_TAINTED_RAW(x)
-#define OBJ_TAINTED(x) RB_OBJ_TAINTED(x)
-#define OBJ_TAINT_RAW(x) RB_OBJ_TAINT_RAW(x)
-#define OBJ_TAINT(x) RB_OBJ_TAINT(x)
-#define OBJ_UNTRUSTED(x) RB_OBJ_UNTRUSTED(x)
-#define OBJ_UNTRUST(x) RB_OBJ_UNTRUST(x)
-#define OBJ_INFECT_RAW(x,s) RB_OBJ_INFECT_RAW(x,s)
-#define OBJ_INFECT(x,s) RB_OBJ_INFECT(x,s)
-#define OBJ_FROZEN_RAW(x) RB_OBJ_FROZEN_RAW(x)
-#define OBJ_FROZEN(x) RB_OBJ_FROZEN(x)
-#define OBJ_FREEZE_RAW(x) RB_OBJ_FREEZE_RAW(x)
-#define OBJ_FREEZE(x) RB_OBJ_FREEZE(x)
-
-void rb_freeze_singleton_class(VALUE klass);
-
-static inline void
-rb_obj_freeze_inline(VALUE x)
-{
- if (RB_FL_ABLE(x)) {
- RB_OBJ_FREEZE_RAW(x);
- if (RBASIC_CLASS(x) && !(RBASIC(x)->flags & RUBY_FL_SINGLETON)) {
- rb_freeze_singleton_class(x);
- }
- }
-}
-
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-# define RUBY_UNTYPED_DATA_FUNC(func) func __attribute__((warning("untyped Data is unsafe; use TypedData instead")))
-#else
-# define RUBY_UNTYPED_DATA_FUNC(func) DEPRECATED(func)
-#endif
-
-#if defined(__GNUC__) && !defined(__NO_INLINE__)
-#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
-RUBY_UNTYPED_DATA_FUNC(static inline VALUE rb_data_object_wrap_warning(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
-#endif
-RUBY_UNTYPED_DATA_FUNC(static inline void *rb_data_object_get_warning(VALUE));
-
-static inline VALUE
-rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
-{
- return rb_data_object_wrap(klass, ptr, mark, free);
-}
-
-#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
-#define rb_data_object_wrap_warning(klass, ptr, mark, free) \
- __extension__( \
- __builtin_choose_expr( \
- __builtin_constant_p(klass) && !(klass), \
- rb_data_object_wrap(klass, ptr, mark, free), \
- rb_data_object_wrap_warning(klass, ptr, mark, free)))
-#endif
-#endif
-
-static inline void *
-rb_data_object_get(VALUE obj)
-{
- Check_Type(obj, RUBY_T_DATA);
- return ((struct RData *)obj)->data;
-}
-
-#if defined(__GNUC__) && !defined(__NO_INLINE__)
-static inline void *
-rb_data_object_get_warning(VALUE obj)
-{
- return rb_data_object_get(obj);
-}
-#endif
-
-static inline VALUE
-rb_data_object_make(VALUE klass, RUBY_DATA_FUNC mark_func, RUBY_DATA_FUNC free_func, void **datap, size_t size)
-{
- Data_Make_Struct0(result, klass, void, size, mark_func, free_func, *datap);
- return result;
-}
-
-static inline VALUE
-rb_data_typed_object_make(VALUE klass, const rb_data_type_t *type, void **datap, size_t size)
-{
- TypedData_Make_Struct0(result, klass, void, size, type, *datap);
- return result;
-}
-
-#ifndef rb_data_object_alloc
-DEPRECATED_BY(rb_data_object_wrap, static inline VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
-static inline VALUE
-rb_data_object_alloc(VALUE klass, void *data, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
-{
- return rb_data_object_wrap(klass, data, dmark, dfree);
-}
-#endif
-
-#ifndef rb_data_typed_object_alloc
-DEPRECATED_BY(rb_data_typed_object_wrap, static inline VALUE rb_data_typed_object_alloc(VALUE,void*,const rb_data_type_t*));
-static inline VALUE
-rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
-{
- return rb_data_typed_object_wrap(klass, datap, type);
-}
-#endif
-
-#if defined(__GNUC__) && !defined(__NO_INLINE__)
-#define rb_data_object_wrap_0 rb_data_object_wrap
-#define rb_data_object_wrap_1 rb_data_object_wrap_warning
-#define rb_data_object_wrap RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)
-#define rb_data_object_get_0 rb_data_object_get
-#define rb_data_object_get_1 rb_data_object_get_warning
-#define rb_data_object_get RUBY_MACRO_SELECT(rb_data_object_get_, RUBY_UNTYPED_DATA_WARNING)
-#define rb_data_object_make_0 rb_data_object_make
-#define rb_data_object_make_1 rb_data_object_make_warning
-#define rb_data_object_make RUBY_MACRO_SELECT(rb_data_object_make_, RUBY_UNTYPED_DATA_WARNING)
-#endif
+#define OBJ_FROZEN(x) (!!(FL_ABLE(x)?(RBASIC(x)->flags&(FL_FREEZE)):(FIXNUM_P(x)||FLONUM_P(x)||SYMBOL_P(x))))
+#define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)
#if USE_RGENGC
-#define RB_OBJ_PROMOTED_RAW(x) RB_FL_ALL_RAW(x, RUBY_FL_PROMOTED)
-#define RB_OBJ_PROMOTED(x) (RB_SPECIAL_CONST_P(x) ? 0 : RB_OBJ_PROMOTED_RAW(x))
-#define RB_OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
+#define OBJ_PROMOTED(x) (SPECIAL_CONST_P(x) ? 0 : FL_TEST_RAW((x), FL_PROMOTED))
+#define OBJ_WB_PROTECTED(x) (SPECIAL_CONST_P(x) ? 1 : FL_TEST_RAW((x), FL_WB_PROTECTED))
+#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
void rb_gc_writebarrier(VALUE a, VALUE b);
-void rb_gc_writebarrier_unprotect(VALUE obj);
+void rb_gc_writebarrier_unprotect_promoted(VALUE obj);
#else /* USE_RGENGC */
-#define RB_OBJ_PROMOTED(x) 0
-#define RB_OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
-#endif
-#define OBJ_PROMOTED_RAW(x) RB_OBJ_PROMOTED_RAW(x)
-#define OBJ_PROMOTED(x) RB_OBJ_PROMOTED(x)
-#define OBJ_WB_UNPROTECT(x) RB_OBJ_WB_UNPROTECT(x)
-
-/* Write barrier (WB) interfaces:
- * - RB_OBJ_WRITE(a, slot, b): WB for new reference from `a' to `b'.
- * Write `b' into `*slot'. `slot' is a pointer in `a'.
- * - RB_OBJ_WRITTEN(a, oldv, b): WB for new reference from `a' to `b'.
- * This doesn't write any values, but only a WB declaration.
- * `oldv' is replaced value with `b' (not used in current Ruby).
- *
- * NOTE: The following core interfaces can be changed in the future.
- * Please catch up if you want to insert WB into C-extensions
- * correctly.
- */
-#define RB_OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
-#define RB_OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
+#define OBJ_PROMOTED(x) 0
+#define OBJ_WB_PROTECTED(x) 0
+#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
+#endif
+
+#define OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
+#define OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__)
#ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
#define USE_RGENGC_LOGGING_WB_UNPROTECT 0
@@ -1493,8 +1209,15 @@ rb_obj_wb_unprotect(VALUE x, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(
#ifdef RGENGC_LOGGING_WB_UNPROTECT
RGENGC_LOGGING_WB_UNPROTECT((void *)x, filename, line);
#endif
+
#if USE_RGENGC
- rb_gc_writebarrier_unprotect(x);
+ /* `x' should be an RVALUE object */
+ if (FL_TEST_RAW((x), FL_WB_PROTECTED)) {
+ if (FL_TEST_RAW((x), FL_PROMOTED)) {
+ rb_gc_writebarrier_unprotect_promoted(x);
+ }
+ RBASIC(x)->flags &= ~FL_WB_PROTECTED;
+ }
#endif
return x;
}
@@ -1507,7 +1230,8 @@ rb_obj_written(VALUE a, RB_UNUSED_VAR(VALUE oldv), VALUE b, RB_UNUSED_VAR(const
#endif
#if USE_RGENGC
- if (!RB_SPECIAL_CONST_P(b)) {
+ /* `a' should be an RVALUE object */
+ if (FL_TEST_RAW((a), FL_PROMOTED) && !SPECIAL_CONST_P(b)) {
rb_gc_writebarrier(a, b);
}
#endif
@@ -1531,115 +1255,79 @@ rb_obj_write(VALUE a, VALUE *slot, VALUE b, RB_UNUSED_VAR(const char *filename),
}
#if SIZEOF_INT < SIZEOF_LONG
-# define RB_INT2NUM(v) INT2FIX((int)(v))
-# define RB_UINT2NUM(v) LONG2FIX((unsigned int)(v))
+# define INT2NUM(v) INT2FIX((int)(v))
+# define UINT2NUM(v) LONG2FIX((unsigned int)(v))
#else
static inline VALUE
rb_int2num_inline(int v)
{
- if (RB_FIXABLE(v))
+ if (FIXABLE(v))
return INT2FIX(v);
else
return rb_int2big(v);
}
-#define RB_INT2NUM(x) rb_int2num_inline(x)
+#define INT2NUM(x) rb_int2num_inline(x)
static inline VALUE
rb_uint2num_inline(unsigned int v)
{
- if (RB_POSFIXABLE(v))
+ if (POSFIXABLE(v))
return LONG2FIX(v);
else
return rb_uint2big(v);
}
-#define RB_UINT2NUM(x) rb_uint2num_inline(x)
+#define UINT2NUM(x) rb_uint2num_inline(x)
#endif
-#define INT2NUM(x) RB_INT2NUM(x)
-#define UINT2NUM(x) RB_UINT2NUM(x)
static inline VALUE
rb_long2num_inline(long v)
{
- if (RB_FIXABLE(v))
+ if (FIXABLE(v))
return LONG2FIX(v);
else
return rb_int2big(v);
}
-#define RB_LONG2NUM(x) rb_long2num_inline(x)
+#define LONG2NUM(x) rb_long2num_inline(x)
static inline VALUE
rb_ulong2num_inline(unsigned long v)
{
- if (RB_POSFIXABLE(v))
+ if (POSFIXABLE(v))
return LONG2FIX(v);
else
return rb_uint2big(v);
}
-#define RB_ULONG2NUM(x) rb_ulong2num_inline(x)
+#define ULONG2NUM(x) rb_ulong2num_inline(x)
static inline char
rb_num2char_inline(VALUE x)
{
- if (RB_TYPE_P(x, RUBY_T_STRING) && (RSTRING_LEN(x)>=1))
+ if ((TYPE(x) == T_STRING) && (RSTRING_LEN(x)>=1))
return RSTRING_PTR(x)[0];
else
return (char)(NUM2INT(x) & 0xff);
}
-#define RB_NUM2CHR(x) rb_num2char_inline(x)
-
-#define RB_CHR2FIX(x) INT2FIX((long)((x)&0xff))
+#define NUM2CHR(x) rb_num2char_inline(x)
-#define LONG2NUM(x) RB_LONG2NUM(x)
-#define ULONG2NUM(x) RB_ULONG2NUM(x)
-#define NUM2CHR(x) RB_NUM2CHR(x)
-#define CHR2FIX(x) RB_CHR2FIX(x)
+#define CHR2FIX(x) INT2FIX((long)((x)&0xff))
-#define RB_ALLOC_N(type,n) ((type*)ruby_xmalloc2((n),sizeof(type)))
-#define RB_ALLOC(type) ((type*)ruby_xmalloc(sizeof(type)))
-#define RB_ZALLOC_N(type,n) ((type*)ruby_xcalloc((n),sizeof(type)))
-#define RB_ZALLOC(type) (RB_ZALLOC_N(type,1))
-#define RB_REALLOC_N(var,type,n) ((var)=(type*)ruby_xrealloc2((char*)(var),(n),sizeof(type)))
-
-#define ALLOC_N(type,n) RB_ALLOC_N(type,n)
-#define ALLOC(type) RB_ALLOC(type)
-#define ZALLOC_N(type,n) RB_ZALLOC_N(type,n)
-#define ZALLOC(type) RB_ZALLOC(type)
-#define REALLOC_N(var,type,n) RB_REALLOC_N(var,type,n)
+#define ALLOC_N(type,n) ((type*)xmalloc2((n),sizeof(type)))
+#define ALLOC(type) ((type*)xmalloc(sizeof(type)))
+#define REALLOC_N(var,type,n) ((var)=(type*)xrealloc2((char*)(var),(n),sizeof(type)))
#define ALLOCA_N(type,n) ((type*)alloca(sizeof(type)*(n)))
void *rb_alloc_tmp_buffer(volatile VALUE *store, long len) RUBY_ATTR_ALLOC_SIZE((2));
void rb_free_tmp_buffer(volatile VALUE *store);
-NORETURN(void ruby_malloc_size_overflow(size_t, size_t));
-static inline size_t
-ruby_xmalloc2_size(const size_t count, const size_t elsize)
-{
- if (count > SIZE_MAX / elsize) {
- ruby_malloc_size_overflow(count, elsize);
- }
- return count * elsize;
-}
/* allocates _n_ bytes temporary buffer and stores VALUE including it
* in _v_. _n_ may be evaluated twice. */
#ifdef C_ALLOCA
-# define RB_ALLOCV(v, n) rb_alloc_tmp_buffer(&(v), (n))
-# define RB_ALLOCV_N(type, v, n) \
- ((type*)RB_ALLOCV((v), ruby_xmalloc2_size((n), sizeof(type))))
+# define ALLOCV(v, n) rb_alloc_tmp_buffer(&(v), (n))
#else
-# define RUBY_ALLOCV_LIMIT 1024
-# define RB_ALLOCV(v, n) ((n) < RUBY_ALLOCV_LIMIT ? \
- (RB_GC_GUARD(v) = 0, alloca(n)) : \
- rb_alloc_tmp_buffer(&(v), (n)))
-# define RB_ALLOCV_N(type, v, n) \
- ((type*)(ruby_xmalloc2_size((n), sizeof(type)) < RUBY_ALLOCV_LIMIT ? \
- (RB_GC_GUARD(v) = 0, alloca((n) * sizeof(type))) : \
- rb_alloc_tmp_buffer(&(v), (n) * sizeof(type))))
+# define ALLOCV(v, n) ((n) < 1024 ? (RB_GC_GUARD(v) = 0, alloca(n)) : rb_alloc_tmp_buffer(&(v), (n)))
#endif
-#define RB_ALLOCV_END(v) rb_free_tmp_buffer(&(v))
-
-#define ALLOCV(v, n) RB_ALLOCV(v, n)
-#define ALLOCV_N(type, v, n) RB_ALLOCV_N(type, v, n)
-#define ALLOCV_END(v) RB_ALLOCV_END(v)
+#define ALLOCV_N(type, v, n) ((type*)ALLOCV((v), sizeof(type)*(n)))
+#define ALLOCV_END(v) rb_free_tmp_buffer(&(v))
#define MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
#define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
@@ -1685,7 +1373,7 @@ void rb_gvar_readonly_setter(VALUE val, ID id, void *data, struct rb_global_var
void rb_define_variable(const char*,VALUE*);
void rb_define_virtual_variable(const char*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
void rb_define_hooked_variable(const char*,VALUE*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
-void rb_define_readonly_variable(const char*,const VALUE*);
+void rb_define_readonly_variable(const char*,VALUE*);
void rb_define_const(VALUE,const char*,VALUE);
void rb_define_global_const(const char*,VALUE);
@@ -1710,21 +1398,16 @@ const char *rb_id2name(ID);
ID rb_check_id(volatile VALUE *);
ID rb_to_id(VALUE);
VALUE rb_id2str(ID);
-VALUE rb_sym2str(VALUE);
-VALUE rb_to_symbol(VALUE name);
-VALUE rb_check_symbol(volatile VALUE *namep);
-#define RUBY_CONST_ID_CACHE(result, str) \
+#define CONST_ID_CACHE(result, str) \
{ \
static ID rb_intern_id_cache; \
if (!rb_intern_id_cache) \
rb_intern_id_cache = rb_intern2((str), (long)strlen(str)); \
result rb_intern_id_cache; \
}
-#define RUBY_CONST_ID(var, str) \
- do RUBY_CONST_ID_CACHE((var) =, (str)) while (0)
-#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
-#define CONST_ID(var, str) RUBY_CONST_ID(var, str)
+#define CONST_ID(var, str) \
+ do CONST_ID_CACHE((var) =, (str)) while (0)
#ifdef __GNUC__
/* __builtin_constant_p and statement expression is available
* since gcc-2.7.2.3 at least. */
@@ -1757,9 +1440,6 @@ VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE*);
VALUE rb_funcall_with_block(VALUE, ID, int, const VALUE*, VALUE);
int rb_scan_args(int, const VALUE*, const char*, ...);
VALUE rb_call_super(int, const VALUE*);
-VALUE rb_current_receiver(void);
-int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *);
-VALUE rb_extract_keywords(VALUE *orighash);
/* rb_scan_args() format allows ':' for optional hash */
#define HAVE_RB_SCAN_ARGS_OPTIONAL_HASH 1
@@ -1776,11 +1456,6 @@ VALUE *rb_ruby_debug_ptr(void);
#define ruby_verbose (*rb_ruby_verbose_ptr())
#define ruby_debug (*rb_ruby_debug_ptr())
-/* for rb_readwrite_sys_fail first argument */
-enum rb_io_wait_readwrite {RB_IO_WAIT_READABLE, RB_IO_WAIT_WRITABLE};
-#define RB_IO_WAIT_READABLE RB_IO_WAIT_READABLE
-#define RB_IO_WAIT_WRITABLE RB_IO_WAIT_WRITABLE
-
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
PRINTF_ARGS(NORETURN(void rb_fatal(const char*, ...)), 1, 2);
PRINTF_ARGS(NORETURN(void rb_bug(const char*, ...)), 1, 2);
@@ -1789,7 +1464,7 @@ NORETURN(void rb_sys_fail(const char*));
NORETURN(void rb_sys_fail_str(VALUE));
NORETURN(void rb_mod_sys_fail(VALUE, const char*));
NORETURN(void rb_mod_sys_fail_str(VALUE, VALUE));
-NORETURN(void rb_readwrite_sys_fail(enum rb_io_wait_readwrite, const char*));
+NORETURN(void rb_readwrite_sys_fail(int, const char*));
NORETURN(void rb_iter_break(void));
NORETURN(void rb_iter_break_value(VALUE));
NORETURN(void rb_exit(int));
@@ -1800,7 +1475,6 @@ NORETURN(void rb_syserr_fail(int, const char*));
NORETURN(void rb_syserr_fail_str(int, VALUE));
NORETURN(void rb_mod_syserr_fail(VALUE, int, const char*));
NORETURN(void rb_mod_syserr_fail_str(VALUE, int, VALUE));
-NORETURN(void rb_readwrite_syserr_fail(enum rb_io_wait_readwrite, int, const char*));
/* reports if `-W' specified */
PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
@@ -1810,27 +1484,21 @@ PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
-#define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1
-#define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg) \
- VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg
-typedef VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg));
+/* for rb_readwrite_sys_fail first argument */
+#define RB_IO_WAIT_READABLE 0
+#define RB_IO_WAIT_WRITABLE 1
-#if defined RB_BLOCK_CALL_FUNC_STRICT && RB_BLOCK_CALL_FUNC_STRICT
-typedef rb_block_call_func *rb_block_call_func_t;
-#else
-typedef VALUE (*rb_block_call_func_t)(ANYARGS);
-#endif
+typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*);
VALUE rb_each(VALUE);
VALUE rb_yield(VALUE);
VALUE rb_yield_values(int n, ...);
VALUE rb_yield_values2(int n, const VALUE *argv);
VALUE rb_yield_splat(VALUE);
-VALUE rb_yield_block(VALUE, VALUE, int, const VALUE *, VALUE); /* rb_block_call_func */
int rb_block_given_p(void);
void rb_need_block(void);
VALUE rb_iterate(VALUE(*)(VALUE),VALUE,VALUE(*)(ANYARGS),VALUE);
-VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE);
+VALUE rb_block_call(VALUE,ID,int,VALUE*,VALUE(*)(ANYARGS),VALUE);
VALUE rb_rescue(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
VALUE rb_rescue2(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...);
VALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
@@ -1932,15 +1600,15 @@ RUBY_EXTERN VALUE rb_stdin, rb_stdout, rb_stderr;
static inline VALUE
rb_class_of(VALUE obj)
{
- if (RB_IMMEDIATE_P(obj)) {
- if (RB_FIXNUM_P(obj)) return rb_cFixnum;
- if (RB_FLONUM_P(obj)) return rb_cFloat;
- if (obj == RUBY_Qtrue) return rb_cTrueClass;
- if (RB_STATIC_SYM_P(obj)) return rb_cSymbol;
+ if (IMMEDIATE_P(obj)) {
+ if (FIXNUM_P(obj)) return rb_cFixnum;
+ if (FLONUM_P(obj)) return rb_cFloat;
+ if (obj == Qtrue) return rb_cTrueClass;
+ if (SYMBOL_P(obj)) return rb_cSymbol;
}
else if (!RTEST(obj)) {
- if (obj == RUBY_Qnil) return rb_cNilClass;
- if (obj == RUBY_Qfalse) return rb_cFalseClass;
+ if (obj == Qnil) return rb_cNilClass;
+ if (obj == Qfalse) return rb_cFalseClass;
}
return RBASIC(obj)->klass;
}
@@ -1948,20 +1616,32 @@ rb_class_of(VALUE obj)
static inline int
rb_type(VALUE obj)
{
- if (RB_IMMEDIATE_P(obj)) {
- if (RB_FIXNUM_P(obj)) return RUBY_T_FIXNUM;
- if (RB_FLONUM_P(obj)) return RUBY_T_FLOAT;
- if (obj == RUBY_Qtrue) return RUBY_T_TRUE;
- if (RB_STATIC_SYM_P(obj)) return RUBY_T_SYMBOL;
- if (obj == RUBY_Qundef) return RUBY_T_UNDEF;
+ if (IMMEDIATE_P(obj)) {
+ if (FIXNUM_P(obj)) return T_FIXNUM;
+ if (FLONUM_P(obj)) return T_FLOAT;
+ if (obj == Qtrue) return T_TRUE;
+ if (SYMBOL_P(obj)) return T_SYMBOL;
+ if (obj == Qundef) return T_UNDEF;
}
else if (!RTEST(obj)) {
- if (obj == RUBY_Qnil) return RUBY_T_NIL;
- if (obj == RUBY_Qfalse) return RUBY_T_FALSE;
+ if (obj == Qnil) return T_NIL;
+ if (obj == Qfalse) return T_FALSE;
}
- return RB_BUILTIN_TYPE(obj);
+ return BUILTIN_TYPE(obj);
}
+#define RB_FLOAT_TYPE_P(obj) (FLONUM_P(obj) || (!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == T_FLOAT))
+
+#define RB_TYPE_P(obj, type) ( \
+ ((type) == T_FIXNUM) ? FIXNUM_P(obj) : \
+ ((type) == T_TRUE) ? ((obj) == Qtrue) : \
+ ((type) == T_FALSE) ? ((obj) == Qfalse) : \
+ ((type) == T_NIL) ? ((obj) == Qnil) : \
+ ((type) == T_UNDEF) ? ((obj) == Qundef) : \
+ ((type) == T_SYMBOL) ? SYMBOL_P(obj) : \
+ ((type) == T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
+ (!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == (type)))
+
#ifdef __GNUC__
#define rb_type_p(obj, type) \
__extension__ (__builtin_constant_p(type) ? RB_TYPE_P((obj), (type)) : \
@@ -1972,72 +1652,18 @@ rb_type(VALUE obj)
#ifdef __GNUC__
#define rb_special_const_p(obj) \
- __extension__ ({ \
- VALUE special_const_obj = (obj); \
- (int)(RB_SPECIAL_CONST_P(special_const_obj) ? RUBY_Qtrue : RUBY_Qfalse); \
- })
+ __extension__ ({VALUE special_const_obj = (obj); (int)(SPECIAL_CONST_P(special_const_obj) ? Qtrue : Qfalse);})
#else
static inline int
rb_special_const_p(VALUE obj)
{
- if (RB_SPECIAL_CONST_P(obj)) return (int)RUBY_Qtrue;
- return (int)RUBY_Qfalse;
+ if (SPECIAL_CONST_P(obj)) return (int)Qtrue;
+ return (int)Qfalse;
}
#endif
#include "ruby/intern.h"
-static inline void
-rb_clone_setup(VALUE clone, VALUE obj)
-{
- rb_obj_setup(clone, rb_singleton_class_clone(obj), RBASIC(obj)->flags);
- rb_singleton_class_attached(RBASIC_CLASS(clone), clone);
- if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(clone, obj);
-}
-
-static inline void
-rb_dup_setup(VALUE dup, VALUE obj)
-{
- rb_obj_setup(dup, rb_obj_class(obj), RB_FL_TEST_RAW(obj, RUBY_FL_DUPPED));
- if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(dup, obj);
-}
-
-static inline long
-rb_array_len(VALUE a)
-{
- return (RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
- RARRAY_EMBED_LEN(a) : RARRAY(a)->as.heap.len;
-}
-
-#if defined(__fcc__) || defined(__fcc_version) || \
- defined(__FCC__) || defined(__FCC_VERSION)
-/* workaround for old version of Fujitsu C Compiler (fcc) */
-# define FIX_CONST_VALUE_PTR(x) ((const VALUE *)(x))
-#else
-# define FIX_CONST_VALUE_PTR(x) (x)
-#endif
-
-static inline const VALUE *
-rb_array_const_ptr(VALUE a)
-{
- return FIX_CONST_VALUE_PTR((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
- RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr);
-}
-
-static inline long
-rb_struct_len(VALUE st)
-{
- return (RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
- RSTRUCT_EMBED_LEN(st) : RSTRUCT(st)->as.heap.len;
-}
-
-static inline const VALUE *
-rb_struct_const_ptr(VALUE st)
-{
- return FIX_CONST_VALUE_PTR((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
- RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
-}
-
#if defined(EXTLIB) && defined(USE_DLN_A_OUT)
/* hook for external modules */
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
@@ -2064,7 +1690,6 @@ int ruby_native_thread_p(void);
#define RUBY_EVENT_B_RETURN 0x0200
#define RUBY_EVENT_THREAD_BEGIN 0x0400
#define RUBY_EVENT_THREAD_END 0x0800
-#define RUBY_EVENT_FIBER_SWITCH 0x1000
#define RUBY_EVENT_TRACEPOINT_ALL 0xffff
/* special events */
@@ -2072,20 +1697,17 @@ int ruby_native_thread_p(void);
#define RUBY_EVENT_COVERAGE 0x020000
/* internal events */
-#define RUBY_INTERNAL_EVENT_SWITCH 0x040000
-#define RUBY_EVENT_SWITCH 0x040000 /* obsolete name. this macro is for compatibility */
- /* 0x080000 */
-#define RUBY_INTERNAL_EVENT_NEWOBJ 0x100000
-#define RUBY_INTERNAL_EVENT_FREEOBJ 0x200000
-#define RUBY_INTERNAL_EVENT_GC_START 0x400000
-#define RUBY_INTERNAL_EVENT_GC_END_MARK 0x800000
-#define RUBY_INTERNAL_EVENT_GC_END_SWEEP 0x1000000
-#define RUBY_INTERNAL_EVENT_GC_ENTER 0x2000000
-#define RUBY_INTERNAL_EVENT_GC_EXIT 0x4000000
-#define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0x7f00000
-#define RUBY_INTERNAL_EVENT_MASK 0xfffe0000
-
-typedef uint32_t rb_event_flag_t;
+#define RUBY_INTERNAL_EVENT_SWITCH 0x040000
+#define RUBY_EVENT_SWITCH 0x040000 /* obsolete name. this macro is for compatibility */
+ /* 0x080000 */
+#define RUBY_INTERNAL_EVENT_NEWOBJ 0x100000
+#define RUBY_INTERNAL_EVENT_FREEOBJ 0x200000
+#define RUBY_INTERNAL_EVENT_GC_START 0x400000
+#define RUBY_INTERNAL_EVENT_GC_END 0x800000
+#define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0xf00000
+#define RUBY_INTERNAL_EVENT_MASK 0xfffe0000
+
+typedef unsigned long rb_event_flag_t;
typedef void (*rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass);
#define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
diff --git a/include/ruby/st.h b/include/ruby/st.h
index 190bad2a35..e71301b519 100644
--- a/include/ruby/st.h
+++ b/include/ruby/st.h
@@ -59,13 +59,6 @@ struct st_hash_type {
#define ST_INDEX_BITS (sizeof(st_index_t) * CHAR_BIT)
-#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR) && defined(HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P)
-# define ST_DATA_COMPATIBLE_P(type) \
- __builtin_choose_expr(__builtin_types_compatible_p(type, st_data_t), 1, 0)
-#else
-# define ST_DATA_COMPATIBLE_P(type) 0
-#endif
-
struct st_table {
const struct st_hash_type *type;
st_index_t num_bins;
@@ -78,7 +71,7 @@ struct st_table {
* implementation-defined type. It is implementation-defined whether
* atomic types are permitted.
* In short, long and long long bit-field are implementation-defined
- * feature. Therefore we want to suppress a warning explicitly.
+ * feature. Therefore we want to supress a warning explicitly.
*/
__extension__
#endif
@@ -86,7 +79,7 @@ struct st_table {
union {
struct {
struct st_table_entry **bins;
- void *private_list_head[2];
+ struct st_table_entry *head, *tail;
} big;
struct {
struct st_packed_entry *entries;
@@ -115,17 +108,10 @@ int st_insert2(st_table *, st_data_t, st_data_t, st_data_t (*)(st_data_t));
int st_lookup(st_table *, st_data_t, st_data_t *);
int st_get_key(st_table *, st_data_t, st_data_t *);
typedef int st_update_callback_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing);
-/* *key may be altered, but must equal to the old key, i.e., the
- * results of hash() are same and compare() returns 0, otherwise the
- * behavior is undefined */
int st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data_t arg);
int st_foreach(st_table *, int (*)(ANYARGS), st_data_t);
int st_foreach_check(st_table *, int (*)(ANYARGS), st_data_t, st_data_t);
int st_reverse_foreach(st_table *, int (*)(ANYARGS), st_data_t);
-st_index_t st_keys(st_table *table, st_data_t *keys, st_index_t size);
-st_index_t st_keys_check(st_table *table, st_data_t *keys, st_index_t size, st_data_t never);
-st_index_t st_values(st_table *table, st_data_t *values, st_index_t size);
-st_index_t st_values_check(st_table *table, st_data_t *values, st_index_t size, st_data_t never);
void st_add_direct(st_table *, st_data_t, st_data_t);
void st_free_table(st_table *);
void st_cleanup_safe(st_table *, st_data_t);
diff --git a/include/ruby/thread_native.h b/include/ruby/thread_native.h
deleted file mode 100644
index 8e500c5a13..0000000000
--- a/include/ruby/thread_native.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**********************************************************************
-
- thread_native.h -
-
- $Author: ko1 $
- created at: Wed May 14 19:37:31 2014
-
- Copyright (C) 2014 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#ifndef RUBY_THREAD_NATIVE_H
-#define RUBY_THREAD_NATIVE_H 1
-
-/*
- * This file contains wrapper APIs for native thread primitives
- * which Ruby interpreter uses.
- *
- * Now, we only suppors pthread and Windows threads.
- *
- * If you want to use Ruby's Mutex and so on to synchronize Ruby Threads,
- * please use Mutex directly.
- */
-
-
-#if defined(_WIN32)
-#include <windows.h>
-typedef HANDLE rb_nativethread_id_t;
-
-typedef union rb_thread_lock_union {
- HANDLE mutex;
- CRITICAL_SECTION crit;
-} rb_nativethread_lock_t;
-
-#elif defined(HAVE_PTHREAD_H)
-#include <pthread.h>
-typedef pthread_t rb_nativethread_id_t;
-typedef pthread_mutex_t rb_nativethread_lock_t;
-
-#else
-#error "unsupported thread type"
-
-#endif
-
-RUBY_SYMBOL_EXPORT_BEGIN
-
-rb_nativethread_id_t rb_nativethread_self();
-
-void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock);
-void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);
-void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock);
-void rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock);
-
-RUBY_SYMBOL_EXPORT_END
-
-#endif
diff --git a/include/ruby/util.h b/include/ruby/util.h
index e9343b3390..5be5f2e0b4 100644
--- a/include/ruby/util.h
+++ b/include/ruby/util.h
@@ -47,20 +47,13 @@ extern "C" {
RUBY_SYMBOL_EXPORT_BEGIN
-#define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999)
-/* an approximation of ceil(n * log10(2)), up to 65536 at least */
-
#define scan_oct(s,l,e) ((int)ruby_scan_oct((s),(l),(e)))
unsigned long ruby_scan_oct(const char *, size_t, size_t *);
#define scan_hex(s,l,e) ((int)ruby_scan_hex((s),(l),(e)))
unsigned long ruby_scan_hex(const char *, size_t, size_t *);
-#ifdef HAVE_GNU_QSORT_R
-# define ruby_qsort qsort_r
-#else
void ruby_qsort(void *, const size_t, const size_t,
int (*)(const void *, const void *, void *), void *);
-#endif
void ruby_setenv(const char *, const char *);
void ruby_unsetenv(const char *);
@@ -80,6 +73,14 @@ double ruby_strtod(const char *, char **);
#undef strtod
#define strtod(s,e) ruby_strtod((s),(e))
+#if defined _MSC_VER && _MSC_VER >= 1300
+#pragma warning(push)
+#pragma warning(disable:4723)
+#endif
+#if defined _MSC_VER && _MSC_VER >= 1300
+#pragma warning(pop)
+#endif
+
void ruby_each_words(const char *, void (*)(const char*, int, void*), void *);
RUBY_SYMBOL_EXPORT_END
diff --git a/include/ruby/version.h b/include/ruby/version.h
index bb1926f721..4ffcc7a9ad 100644
--- a/include/ruby/version.h
+++ b/include/ruby/version.h
@@ -13,7 +13,7 @@
/*
* This file contains only
- * - never-changeable informations, and
+ * - never-changable informations, and
* - interfaces accessible from extension libraries.
*
* Never try to check RUBY_VERSION_CODE etc in extension libraries,
@@ -31,7 +31,7 @@
/* API version */
#define RUBY_API_VERSION_MAJOR 2
-#define RUBY_API_VERSION_MINOR 3
+#define RUBY_API_VERSION_MINOR 1
#define RUBY_API_VERSION_TEENY 0
#define RUBY_API_VERSION_CODE (RUBY_API_VERSION_MAJOR*10000+RUBY_API_VERSION_MINOR*100+RUBY_API_VERSION_TEENY)
diff --git a/include/ruby/win32.h b/include/ruby/win32.h
index 7bcd0e9125..96b2f3f8a2 100644
--- a/include/ruby/win32.h
+++ b/include/ruby/win32.h
@@ -35,9 +35,6 @@ extern "C++" { /* template without extern "C++" */
#if !defined(_WIN64) && !defined(WIN32)
#define WIN32
#endif
-#if defined(_MSC_VER) && _MSC_VER <= 1200
-#include <windows.h>
-#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#if !defined(_MSC_VER) || _MSC_VER >= 1400
@@ -80,7 +77,7 @@ extern "C++" { /* template without extern "C++" */
#endif
#include <io.h>
#include <malloc.h>
-#if defined __MINGW32__
+#if defined __MINGW32__ || __BORLANDC__ >= 0x0580
# include <stdint.h>
#else
# if !defined(_INTPTR_T_DEFINED)
@@ -127,17 +124,31 @@ typedef unsigned int uintptr_t;
#define WNOHANG -1
-#define O_SHARE_DELETE 0x20000000 /* for rb_w32_open(), rb_w32_wopen() */
-
typedef int clockid_t;
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
+#undef getc
+#undef putc
+#undef fgetc
+#undef fputc
+#undef getchar
+#undef putchar
+#undef fgetchar
+#undef fputchar
#undef utime
#undef lseek
#undef stat
#undef fstat
+#define getc(_stream) rb_w32_getc(_stream)
+#define getchar() rb_w32_getc(stdin)
+#define putc(_c, _stream) rb_w32_putc(_c, _stream)
+#define putchar(_c) rb_w32_putc(_c, stdout)
#ifdef RUBY_EXPORT
+#define fgetc(_stream) getc(_stream)
+#define fputc(_c, _stream) putc(_c, _stream)
+#define fgetchar() getchar()
+#define fputchar(_c) putchar(_c)
#define utime(_p, _t) rb_w32_utime(_p, _t)
#define lseek(_f, _o, _w) _lseeki64(_f, _o, _w)
@@ -152,11 +163,28 @@ typedef int clockid_t;
#define sleep(x) rb_w32_Sleep((x)*1000)
#define Sleep(msec) (void)rb_w32_Sleep(msec)
#define fstati64(fd,st) rb_w32_fstati64(fd,st)
+#ifdef __BORLANDC__
+#define creat(p, m) _creat(p, m)
+#define eof() _eof()
+#define filelength(h) _filelength(h)
+#define mktemp(t) _mktemp(t)
+#define tell(h) _tell(h)
+#define _open _sopen
+#define sopen _sopen
+#undef fopen
+#define fopen(p, m) rb_w32_fopen(p, m)
+#undef fdopen
+#define fdopen(h, m) rb_w32_fdopen(h, m)
+#undef fsopen
+#define fsopen(p, m, sh) rb_w32_fsopen(p, m, sh)
+#endif /* __BORLANDC__ */
#undef execv
#define execv(path,argv) rb_w32_aspawn(P_OVERLAY,path,argv)
+#if !defined(__BORLANDC__)
#undef isatty
#define isatty(h) rb_w32_isatty(h)
+#endif /* __BORLANDC__ */
#undef mkdir
#define mkdir(p, m) rb_w32_mkdir(p, m)
@@ -170,7 +198,9 @@ typedef int clockid_t;
#define off_t __int64
#define stat stati64
#define fstat(fd,st) fstati64(fd,st)
-#if !defined(_MSC_VER) || RUBY_MSVCRT_VERSION < 80
+#if defined(__BORLANDC__)
+#define stati64(path, st) rb_w32_stati64(path, st)
+#elif !defined(_MSC_VER) || RT_VER < 80
#define stati64 _stati64
#ifndef _stati64
#define _stati64(path, st) rb_w32_stati64(path, st)
@@ -185,7 +215,6 @@ typedef int clockid_t;
extern int rb_w32_stat(const char *, struct stat *);
extern int rb_w32_fstat(int, struct stat *);
#endif
-#define lstat(path,st) rb_w32_lstati64(path,st)
#define access(path,mode) rb_w32_access(path,mode)
#define strcasecmp _stricmp
@@ -234,6 +263,7 @@ struct ifaddrs {
#endif
extern DWORD rb_w32_osid(void);
+extern int rb_w32_cmdvector(const char *, char ***);
extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *, int *);
extern int flock(int fd, int oper);
extern int rb_w32_io_cancelable_p(int);
@@ -279,18 +309,12 @@ extern char **rb_w32_get_environ(void);
extern void rb_w32_free_environ(char **);
extern int rb_w32_map_errno(DWORD);
extern const char *WSAAPI rb_w32_inet_ntop(int,const void *,char *,size_t);
-extern int WSAAPI rb_w32_inet_pton(int,const char *,void *);
extern DWORD rb_w32_osver(void);
extern int chown(const char *, int, int);
extern int rb_w32_uchown(const char *, int, int);
extern int link(const char *, const char *);
extern int rb_w32_ulink(const char *, const char *);
-extern ssize_t readlink(const char *, char *, size_t);
-extern ssize_t rb_w32_ureadlink(const char *, char *, size_t);
-extern ssize_t rb_w32_wreadlink(const WCHAR *, WCHAR *, size_t);
-extern int symlink(const char *src, const char *link);
-extern int rb_w32_usymlink(const char *src, const char *link);
extern int gettimeofday(struct timeval *, struct timezone *);
extern int clock_gettime(clockid_t, struct timespec *);
extern int clock_getres(clockid_t, struct timespec *);
@@ -303,10 +327,11 @@ extern rb_pid_t rb_w32_uaspawn(int, const char *, char *const *);
extern rb_pid_t rb_w32_uaspawn_flags(int, const char *, char *const *, DWORD);
extern int kill(int, int);
extern int fcntl(int, int, ...);
-extern int rb_w32_set_nonblock(int);
extern rb_pid_t rb_w32_getpid(void);
extern rb_pid_t rb_w32_getppid(void);
+#if !defined(__BORLANDC__)
extern int rb_w32_isatty(int);
+#endif
extern int rb_w32_uchdir(const char *);
extern int rb_w32_mkdir(const char *, int);
extern int rb_w32_umkdir(const char *, int);
@@ -317,13 +342,17 @@ extern int rb_w32_uunlink(const char *);
extern int rb_w32_uchmod(const char *, int);
extern int rb_w32_stati64(const char *, struct stati64 *);
extern int rb_w32_ustati64(const char *, struct stati64 *);
-extern int rb_w32_lstati64(const char *, struct stati64 *);
-extern int rb_w32_ulstati64(const char *, struct stati64 *);
extern int rb_w32_access(const char *, int);
extern int rb_w32_uaccess(const char *, int);
extern char rb_w32_fd_is_text(int);
extern int rb_w32_fstati64(int, struct stati64 *);
-extern int rb_w32_dup2(int, int);
+
+#ifdef __BORLANDC__
+extern off_t _lseeki64(int, off_t, int);
+extern FILE *rb_w32_fopen(const char *, const char *);
+extern FILE *rb_w32_fdopen(int, const char *);
+extern FILE *rb_w32_fsopen(const char *, const char *, int);
+#endif
#include <float.h>
@@ -365,6 +394,19 @@ __declspec(dllimport) extern int finite(double);
#define S_IFIFO _S_IFIFO
#endif
+#if 0 && defined __BORLANDC__
+#undef S_ISDIR
+#undef S_ISFIFO
+#undef S_ISBLK
+#undef S_ISCHR
+#undef S_ISREG
+#define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR)
+#define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO)
+#define S_ISBLK(m) (((unsigned short)(m) & S_IFMT) == S_IFBLK)
+#define S_ISCHR(m) (((unsigned short)(m) & S_IFMT) == S_IFCHR)
+#define S_ISREG(m) (((unsigned short)(m) & S_IFMT) == S_IFREG)
+#endif
+
#if !defined S_IRUSR && !defined __MINGW32__
#define S_IRUSR 0400
#endif
@@ -395,17 +437,14 @@ __declspec(dllimport) extern int finite(double);
#define S_IXOTH 0001
#endif
-#define S_IFLNK 0xa000
-
/*
* define this so we can do inplace editing
*/
#define SUFFIX
-extern int rb_w32_ftruncate(int fd, off_t length);
-extern int rb_w32_truncate(const char *path, off_t length);
-extern int rb_w32_utruncate(const char *path, off_t length);
+extern int rb_w32_ftruncate(int fd, off_t length);
+extern int rb_w32_truncate(const char *path, off_t length);
#undef HAVE_FTRUNCATE
#define HAVE_FTRUNCATE 1
@@ -423,11 +462,6 @@ extern int rb_w32_utruncate(const char *path, off_t length);
#define truncate rb_w32_truncate
#endif
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && _MSC_VER < 1800
-#define strtoll _strtoi64
-#define strtoull _strtoui64
-#endif
-
/*
* stubs
*/
@@ -578,14 +612,15 @@ extern char *rb_w32_strerror(int);
#endif
#define F_DUPFD 0
+#if 0
#define F_GETFD 1
#define F_SETFD 2
-#if 0
#define F_GETFL 3
#endif
#define F_SETFL 4
-#define F_DUPFD_CLOEXEC 67
+#if 0
#define FD_CLOEXEC 1 /* F_GETFD, F_SETFD */
+#endif
#define O_NONBLOCK 1
#undef FD_SET
@@ -616,9 +651,6 @@ extern char *rb_w32_strerror(int);
#undef inet_ntop
#define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l)
-#undef inet_pton
-#define inet_pton(f,s,d) rb_w32_inet_pton(f,s,d)
-
#undef accept
#define accept(s, a, l) rb_w32_accept(s, a, l)
@@ -702,9 +734,6 @@ extern char *rb_w32_strerror(int);
#undef times
#define times(t) rb_w32_times(t)
-
-#undef dup2
-#define dup2(o, n) rb_w32_dup2(o, n)
#endif
struct tms {
@@ -721,6 +750,8 @@ struct tm *localtime_r(const time_t *, struct tm *);
/* thread stuff */
int rb_w32_sleep(unsigned long msec);
+int rb_w32_putc(int, FILE*);
+int rb_w32_getc(FILE*);
int rb_w32_open(const char *, int, ...);
int rb_w32_uopen(const char *, int, ...);
int rb_w32_wopen(const WCHAR *, int, ...);
@@ -737,14 +768,12 @@ int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout);
int rb_w32_time_subtract(struct timeval *rest, const struct timeval *wait);
int rb_w32_wrap_io_handle(HANDLE, int);
int rb_w32_unwrap_io_handle(int);
-WCHAR *rb_w32_mbstr_to_wstr(UINT, const char *, int, long *);
-char *rb_w32_wstr_to_mbstr(UINT, const WCHAR *, int, long *);
/*
== ***CAUTION***
Since this function is very dangerous, ((*NEVER*))
* lock any HANDLEs(i.e. Mutex, Semaphore, CriticalSection and so on) or,
-* use anything like rb_thread_call_without_gvl,
+* use anything like TRAP_BEG...TRAP_END block structure,
in asynchronous_func_t.
*/
typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
@@ -752,8 +781,7 @@ uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc
RUBY_SYMBOL_EXPORT_END
-#if (defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)) && !defined(__cplusplus)
-#ifdef RUBY_MINGW64_BROKEN_FREXP_MODF
+#ifdef __MINGW_ATTRIB_PURE
/* License: Ruby's */
/* get rid of bugs in math.h of mingw */
#define frexp(_X, _Y) __extension__ ({\
@@ -771,6 +799,13 @@ RUBY_SYMBOL_EXPORT_END
})
#endif
+#if defined(__cplusplus)
+#if 0
+{ /* satisfy cc-mode */
+#endif
+} /* extern "C" { */
+#endif
+
#if defined(__MINGW64__)
/*
* Use powl() instead of broken pow() of x86_64-w64-mingw32.
@@ -785,14 +820,8 @@ rb_w32_pow(double x, double y)
#elif defined(__MINGW64_VERSION_MAJOR)
double rb_w32_pow(double x, double y);
#endif
+#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
#define pow rb_w32_pow
#endif
-#if defined(__cplusplus)
-#if 0
-{ /* satisfy cc-mode */
-#endif
-} /* extern "C" { */
-#endif
-
#endif /* RUBY_WIN32_H */
diff --git a/inits.c b/inits.c
index 5822f04cab..fe0aade090 100644
--- a/inits.c
+++ b/inits.c
@@ -9,6 +9,7 @@
**********************************************************************/
+#include "ruby/ruby.h"
#include "internal.h"
#define CALL(n) {void Init_##n(void); Init_##n();}
@@ -16,8 +17,7 @@
void
rb_call_inits(void)
{
- CALL(Method);
- CALL(RandomSeedCore);
+ CALL(RandomSeed);
CALL(sym);
CALL(var_tables);
CALL(Object);
@@ -46,6 +46,7 @@ rb_call_inits(void)
CALL(Time);
CALL(Random);
CALL(signal);
+ CALL(process);
CALL(load);
CALL(Proc);
CALL(Binding);
@@ -55,7 +56,6 @@ rb_call_inits(void)
CALL(VM);
CALL(ISeq);
CALL(Thread);
- CALL(process);
CALL(Cont);
CALL(Rational);
CALL(Complex);
diff --git a/insns.def b/insns.def
index b6a87734c0..63a36b3979 100644
--- a/insns.def
+++ b/insns.def
@@ -60,7 +60,6 @@ getlocal
int i, lev = (int)level;
VALUE *ep = GET_EP();
- /* optimized insns generated for level == (0|1) in defs/opt_operand.def */
for (i = 0; i < lev; i++) {
ep = GET_PREV_EP(ep);
}
@@ -83,7 +82,6 @@ setlocal
int i, lev = (int)level;
VALUE *ep = GET_EP();
- /* optimized insns generated for level == (0|1) in defs/opt_operand.def */
for (i = 0; i < lev; i++) {
ep = GET_PREV_EP(ep);
}
@@ -159,7 +157,8 @@ getclassvariable
()
(VALUE val)
{
- val = rb_cvar_get(vm_get_cvar_base(rb_vm_get_cref(GET_EP()), GET_CFP()), id);
+ NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
+ val = rb_cvar_get(vm_get_cvar_base(cref, GET_CFP()), id);
}
/**
@@ -173,7 +172,8 @@ setclassvariable
(VALUE val)
()
{
- rb_cvar_set(vm_get_cvar_base(rb_vm_get_cref(GET_EP()), GET_CFP()), id, val);
+ NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
+ rb_cvar_set(vm_get_cvar_base(cref, GET_CFP()), id, val);
}
/**
@@ -194,7 +194,7 @@ getconstant
(VALUE klass)
(VALUE val)
{
- val = vm_get_ev_const(th, klass, id, 0);
+ val = vm_get_ev_const(th, GET_ISEQ(), klass, id, 0);
}
/**
@@ -316,10 +316,10 @@ putspecialobject
val = rb_mRubyVMFrozenCore;
break;
case VM_SPECIAL_OBJECT_CBASE:
- val = vm_get_cbase(GET_EP());
+ val = vm_get_cbase(GET_ISEQ(), GET_EP());
break;
case VM_SPECIAL_OBJECT_CONST_BASE:
- val = vm_get_const_base(GET_EP());
+ val = vm_get_const_base(GET_ISEQ(), GET_EP());
break;
default:
rb_bug("putspecialobject insn: unknown value_type");
@@ -337,7 +337,7 @@ putiseq
()
(VALUE ret)
{
- ret = (VALUE)iseq;
+ ret = iseq->self;
}
/**
@@ -370,7 +370,7 @@ concatstrings
val = rb_str_resurrect(TOPN(i));
while (i-- > 0) {
const VALUE v = TOPN(i);
- rb_str_append_literal(val, v);
+ rb_str_append(val, v);
}
POPN(num);
}
@@ -391,23 +391,6 @@ tostring
/**
@c put
- @e Freeze (dynamically) created strings.
- @j (埋め込み)文字列を freeze する。もし、debug_info が与えられていれば、それを設定する。
- */
-DEFINE_INSN
-freezestring
-(VALUE debug_info)
-(VALUE str)
-(VALUE str)
-{
- if (!NIL_P(debug_info)) {
- rb_ivar_set(str, id_debug_created_info, debug_info);
- }
- rb_str_freeze(str);
-}
-
-/**
- @c put
@e to Regexp
@j 文字列 str を正規表現にコンパイルしてスタックにプッシュする。
コンパイル時,opt を正規表現のオプションとする。
@@ -543,7 +526,9 @@ newhash
{
rb_num_t i;
- RUBY_DTRACE_CREATE_HOOK(HASH, num);
+ if(RUBY_DTRACE_HASH_CREATE_ENABLED()) {
+ RUBY_DTRACE_HASH_CREATE(num, rb_sourcefile(), rb_sourceline());
+ }
val = rb_hash_new();
@@ -638,28 +623,6 @@ swap
/**
@c stack
- @e reverse stack top N order.
- @j スタックトップの n 個の値を逆転する。
- */
-DEFINE_INSN
-reverse
-(rb_num_t n)
-(...)
-(...) // inc += 0;
-{
- rb_num_t i;
- VALUE *sp = STACK_ADDR_FROM_TOP(n);
-
- for (i=0; i<n/2; i++) {
- VALUE v0 = sp[i];
- VALUE v1 = TOPN(i);
- sp[i] = v1;
- TOPN(i) = v0;
- }
-}
-
-/**
- @c stack
@e for stack caching.
@j スタックキャッシングの状態を調整するために必要な命令。
*/
@@ -702,7 +665,7 @@ setn
/**
@c stack
- @e empty current stack
+ @e empt current stack
@j current stack を空にする。
*/
DEFINE_INSN
@@ -730,7 +693,105 @@ defined
(VALUE v)
(VALUE val)
{
- val = vm_defined(th, GET_CFP(), op_type, obj, needstr, v);
+ VALUE klass;
+ enum defined_type expr_type = 0;
+ enum defined_type type = (enum defined_type)op_type;
+
+ val = Qnil;
+
+ switch (type) {
+ case DEFINED_IVAR:
+ if (rb_ivar_defined(GET_SELF(), SYM2ID(obj))) {
+ expr_type = DEFINED_IVAR;
+ }
+ break;
+ case DEFINED_IVAR2:
+ klass = vm_get_cbase(GET_ISEQ(), GET_EP());
+ break;
+ case DEFINED_GVAR:
+ if (rb_gvar_defined(rb_global_entry(SYM2ID(obj)))) {
+ expr_type = DEFINED_GVAR;
+ }
+ break;
+ case DEFINED_CVAR: {
+ NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
+ klass = vm_get_cvar_base(cref, GET_CFP());
+ if (rb_cvar_defined(klass, SYM2ID(obj))) {
+ expr_type = DEFINED_CVAR;
+ }
+ break;
+ }
+ case DEFINED_CONST:
+ klass = v;
+ if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) {
+ expr_type = DEFINED_CONST;
+ }
+ break;
+ case DEFINED_FUNC:
+ klass = CLASS_OF(v);
+ if (rb_method_boundp(klass, SYM2ID(obj), 0)) {
+ expr_type = DEFINED_METHOD;
+ }
+ break;
+ case DEFINED_METHOD:{
+ VALUE klass = CLASS_OF(v);
+ const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj), 0);
+
+ if (me) {
+ if (!(me->flag & NOEX_PRIVATE)) {
+ if (!((me->flag & NOEX_PROTECTED) &&
+ !rb_obj_is_kind_of(GET_SELF(),
+ rb_class_real(klass)))) {
+ expr_type = DEFINED_METHOD;
+ }
+ }
+ }
+ {
+ VALUE args[2];
+ VALUE r;
+
+ args[0] = obj; args[1] = Qfalse;
+ r = rb_check_funcall(v, idRespond_to_missing, 2, args);
+ if (r != Qundef && RTEST(r))
+ expr_type = DEFINED_METHOD;
+ }
+ break;
+ }
+ case DEFINED_YIELD:
+ if (GET_BLOCK_PTR()) {
+ expr_type = DEFINED_YIELD;
+ }
+ break;
+ case DEFINED_ZSUPER:{
+ rb_call_info_t cit;
+ if (vm_search_superclass(GET_CFP(), GET_ISEQ(), Qnil, &cit) == 0) {
+ VALUE klass = cit.klass;
+ ID id = cit.mid;
+ if (rb_method_boundp(klass, id, 0)) {
+ expr_type = DEFINED_ZSUPER;
+ }
+ }
+ break;
+ }
+ case DEFINED_REF:{
+ val = vm_getspecial(th, GET_LEP(), Qfalse, FIX2INT(obj));
+ if (val != Qnil) {
+ expr_type = DEFINED_GVAR;
+ }
+ break;
+ }
+ default:
+ rb_bug("unimplemented defined? type (VM)");
+ break;
+ }
+ if (expr_type != 0) {
+ if (needstr != Qfalse) {
+ val = rb_iseq_defined_string(expr_type);
+ }
+ else {
+ val = Qtrue;
+ }
+ }
}
/**
@@ -771,30 +832,6 @@ checkmatch
/**
@c setting
- @e check keywords are specified or not.
- @j キーワードが指定されているかどうかチェックする
- */
-DEFINE_INSN
-checkkeyword
-(lindex_t kw_bits_index, rb_num_t keyword_index)
-()
-(VALUE ret)
-{
- const VALUE *ep = GET_EP();
- const VALUE kw_bits = *(ep - kw_bits_index);
-
- if (FIXNUM_P(kw_bits)) {
- int bits = FIX2INT(kw_bits);
- ret = (bits & (0x01 << keyword_index)) ? Qfalse : Qtrue;
- }
- else {
- assert(RB_TYPE_P(kw_bits, T_HASH));
- ret = rb_hash_has_key(kw_bits, INT2FIX(keyword_index)) ? Qfalse : Qtrue;
- }
-}
-
-/**
- @c setting
@e trace
@j trace 用の命令。
*/
@@ -811,7 +848,7 @@ trace
RUBY_DTRACE_CMETHOD_ENTRY_ENABLED() ||
RUBY_DTRACE_CMETHOD_RETURN_ENABLED()) {
- switch (flag) {
+ switch(flag) {
case RUBY_EVENT_CALL:
RUBY_DTRACE_METHOD_ENTRY_HOOK(th, 0, 0);
break;
@@ -838,7 +875,7 @@ trace
/**
@c class/module
@e
- enter class definition scope. if super is Qfalse, and class
+ enter class definition scope. if super is Qfalse, and clsas
"klass" is defined, it's redefine. otherwise, define "klass" class.
@j クラス定義スコープへ移行する。
もし super が Qfalse で klassクラスが定義されていれば再定義である。
@@ -859,8 +896,12 @@ defineclass
if (VM_DEFINECLASS_HAS_SUPERCLASS_P(flags) &&
!RB_TYPE_P(super, T_CLASS)) {
- rb_raise(rb_eTypeError, "superclass must be a Class (%"PRIsVALUE" given)",
- rb_obj_class(super));
+ rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
+ rb_obj_classname(super));
+ }
+
+ if (super == Qnil) {
+ super = rb_cObject;
}
vm_check_if_namespace(cbase);
@@ -872,23 +913,20 @@ defineclass
klass = VM_DEFINECLASS_SCOPED_P(flags) ?
rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
if (!RB_TYPE_P(klass, T_CLASS)) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE" is not a class", rb_id2str(id));
+ rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(id));
}
- if (VM_DEFINECLASS_HAS_SUPERCLASS_P(flags)) {
+ if (super != rb_cObject) {
VALUE tmp;
tmp = rb_class_real(RCLASS_SUPER(klass));
if (tmp != super) {
- rb_raise(rb_eTypeError, "superclass mismatch for class %"PRIsVALUE"",
- rb_id2str(id));
+ rb_raise(rb_eTypeError, "superclass mismatch for class %s",
+ rb_id2name(id));
}
}
}
else {
- if (!VM_DEFINECLASS_HAS_SUPERCLASS_P(flags)) {
- super = rb_cObject;
- }
/* new class declaration */
klass = rb_define_class_id(id, super);
rb_set_class_path_string(klass, cbase, rb_id2str(id));
@@ -913,7 +951,7 @@ defineclass
rb_public_const_get_at(klass, id) : rb_const_get_at(klass, id);
/* already exist */
if (!RB_TYPE_P(klass, T_MODULE)) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE" is not a module", rb_id2str(id));
+ rb_raise(rb_eTypeError, "%s is not a module", rb_id2name(id));
}
}
else {
@@ -927,15 +965,13 @@ defineclass
rb_bug("unknown defineclass type: %d", (int)type);
}
- rb_iseq_check(class_iseq);
+ COPY_CREF(class_iseq->cref_stack, vm_cref_push(th, klass, NOEX_PUBLIC, NULL));
/* enter scope */
- vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS, klass,
- VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()),
- (VALUE)vm_cref_push(th, klass, NULL, FALSE),
- class_iseq->body->iseq_encoded, GET_SP(),
- class_iseq->body->local_size,
- class_iseq->body->stack_max);
+ vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS,
+ klass, 0, VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()),
+ class_iseq->iseq_encoded, GET_SP(),
+ class_iseq->local_size, 0, class_iseq->stack_max);
RESTORE_REGS();
NEXT_INSN();
}
@@ -952,15 +988,15 @@ defineclass
*/
DEFINE_INSN
send
-(CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
+(CALL_INFO ci)
(...)
(VALUE val) // inc += - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
{
- struct rb_calling_info calling;
-
- vm_caller_setup_arg_block(th, reg_cfp, &calling, ci, blockiseq, FALSE);
- vm_search_method(ci, cc, calling.recv = TOPN(calling.argc = ci->orig_argc));
- CALL_METHOD(&calling, ci, cc);
+ ci->argc = ci->orig_argc;
+ ci->blockptr = 0;
+ vm_caller_setup_args(th, reg_cfp, ci);
+ vm_search_method(ci, ci->recv = TOPN(ci->argc));
+ CALL_METHOD(ci);
}
DEFINE_INSN
@@ -979,19 +1015,17 @@ opt_str_freeze
/**
@c optimize
- @e Invoke method without block
- @j Invoke method without block
+ @e Invoke method without block, splat
+ @j Invoke method without block, splat
*/
DEFINE_INSN
-opt_send_without_block
-(CALL_INFO ci, CALL_CACHE cc)
+opt_send_simple
+(CALL_INFO ci)
(...)
(VALUE val) // inc += -ci->orig_argc;
{
- struct rb_calling_info calling;
- calling.blockptr = NULL;
- vm_search_method(ci, cc, calling.recv = TOPN(calling.argc = ci->orig_argc));
- CALL_METHOD(&calling, ci, cc);
+ vm_search_method(ci, ci->recv = TOPN(ci->argc));
+ CALL_METHOD(ci);
}
/**
@@ -1001,17 +1035,19 @@ opt_send_without_block
*/
DEFINE_INSN
invokesuper
-(CALL_INFO ci, CALL_CACHE cc, ISEQ blockiseq)
+(CALL_INFO ci)
(...)
(VALUE val) // inc += - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));
{
- struct rb_calling_info calling;
- calling.argc = ci->orig_argc;
+ ci->argc = ci->orig_argc;
+ ci->blockptr = !(ci->flag & VM_CALL_ARGS_BLOCKARG) ? GET_BLOCK_PTR() : 0;
- vm_caller_setup_arg_block(th, reg_cfp, &calling, ci, blockiseq, TRUE);
- calling.recv = GET_SELF();
- vm_search_super_method(th, GET_CFP(), &calling, ci, cc);
- CALL_METHOD(&calling, ci, cc);
+ if (UNLIKELY(!(ci->flag & VM_CALL_ARGS_SKIP_SETUP))) {
+ vm_caller_setup_args(th, reg_cfp, ci);
+ }
+ ci->recv = GET_SELF();
+ vm_search_super_method(th, GET_CFP(), ci);
+ CALL_METHOD(ci);
}
/**
@@ -1025,12 +1061,10 @@ invokeblock
(...)
(VALUE val) // inc += 1 - ci->orig_argc;
{
- struct rb_calling_info calling;
- calling.argc = ci->orig_argc;
- calling.blockptr = NULL;
- calling.recv = GET_SELF();
-
- val = vm_invoke_block(th, GET_CFP(), &calling, ci);
+ ci->argc = ci->orig_argc;
+ ci->blockptr = 0;
+ ci->recv = GET_SELF();
+ val = vm_invoke_block(th, GET_CFP(), ci);
if (val == Qundef) {
RESTORE_REGS();
NEXT_INSN();
@@ -1049,10 +1083,9 @@ leave
(VALUE val)
{
if (OPT_CHECKED_RUN) {
- const VALUE *const bp = vm_base_ptr(reg_cfp);
- if (reg_cfp->sp != bp) {
+ if (reg_cfp->sp != vm_base_ptr(reg_cfp)) {
rb_bug("Stack consistency error (sp: %"PRIdPTRDIFF", bp: %"PRIdPTRDIFF")",
- VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, bp));
+ VM_SP_CNT(th, reg_cfp->sp), VM_SP_CNT(th, vm_base_ptr(reg_cfp)));
}
}
@@ -1148,23 +1181,6 @@ branchunless
}
}
-/**
- @c jump
- @e if val is nil, set PC to (PC + dst).
- @j もし val が nil ならば、PC を (PC + dst) にする。
- */
-DEFINE_INSN
-branchnil
-(OFFSET dst)
-(VALUE val)
-()
-{
- if (NIL_P(val)) {
- RUBY_VM_CHECK_INTS(th);
- JUMP(dst);
- }
-}
-
/**********************************************************/
/* for optimize */
@@ -1181,8 +1197,7 @@ getinlinecache
()
(VALUE val)
{
- if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE() &&
- (ic->ic_cref == NULL || ic->ic_cref == rb_vm_get_cref(GET_EP()))) {
+ if (ic->ic_serial == GET_CONSTANT_SERIAL()) {
val = ic->ic_value.value;
JUMP(dst);
}
@@ -1203,10 +1218,11 @@ setinlinecache
(VALUE val)
(VALUE val)
{
- VM_ASSERT(ic->ic_value.value != Qundef);
+ if (ic->ic_value.value == Qundef) {
+ rb_iseq_add_mark_object(GET_ISEQ(), val);
+ }
ic->ic_value.value = val;
- ic->ic_serial = GET_GLOBAL_CONSTANT_STATE() - ruby_vm_const_missing_count;
- ic->ic_cref = vm_get_const_key_cref(GET_EP());
+ ic->ic_serial = GET_CONSTANT_SERIAL() - ruby_vm_const_missing_count;
ruby_vm_const_missing_count = 0;
}
@@ -1223,27 +1239,28 @@ once
{
union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)ic;
-#define RUNNING_THREAD_ONCE_DONE ((rb_thread_t *)(0x1))
retry:
- if (is->once.running_thread == RUNNING_THREAD_ONCE_DONE) {
- val = is->once.value;
- }
- else if (is->once.running_thread == NULL) {
- is->once.running_thread = th;
- val = is->once.value = rb_ensure(vm_once_exec, (VALUE)iseq, vm_once_clear, (VALUE)is);
- /* is->once.running_thread is cleared by vm_once_clear() */
- is->once.running_thread = RUNNING_THREAD_ONCE_DONE; /* success */
- rb_iseq_add_mark_object(GET_ISEQ(), val);
- }
- else if (is->once.running_thread == th) {
- /* recursive once */
- val = vm_once_exec((VALUE)iseq);
+ if (is->once.done == Qfalse) {
+ if (is->once.running_thread == NULL) {
+ is->once.running_thread = th;
+ val = is->once.value = rb_ensure(vm_once_exec, (VALUE)iseq, vm_once_clear, (VALUE)is);
+ /* is->once.running_thread is cleared by vm_once_clear() */
+ is->once.done = Qtrue;
+ rb_iseq_add_mark_object(GET_ISEQ(), val);
+ }
+ else if (is->once.running_thread == th) {
+ /* recursive once */
+ val = vm_once_exec(iseq);
+ }
+ else {
+ /* waiting for finish */
+ RUBY_VM_CHECK_INTS(th);
+ rb_thread_schedule();
+ goto retry;
+ }
}
else {
- /* waiting for finish */
- RUBY_VM_CHECK_INTS(th);
- rb_thread_schedule();
- goto retry;
+ val = is->once.value;
}
}
@@ -1261,13 +1278,10 @@ opt_case_dispatch
switch(TYPE(key)) {
case T_FLOAT: {
double ival;
- if (modf(RFLOAT_VALUE(key), &ival) == 0.0 && !isinf(ival)) {
+ if (modf(RFLOAT_VALUE(key), &ival) == 0.0) {
key = FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival);
}
}
- case T_TRUE:
- case T_FALSE:
- case T_NIL:
case T_SYMBOL: /* fall through */
case T_FIXNUM:
case T_BIGNUM:
@@ -1275,11 +1289,7 @@ opt_case_dispatch
if (BASIC_OP_UNREDEFINED_P(BOP_EQQ,
SYMBOL_REDEFINED_OP_FLAG |
FIXNUM_REDEFINED_OP_FLAG |
- FLOAT_REDEFINED_OP_FLAG |
BIGNUM_REDEFINED_OP_FLAG |
- NIL_REDEFINED_OP_FLAG |
- TRUE_REDEFINED_OP_FLAG |
- FALSE_REDEFINED_OP_FLAG |
STRING_REDEFINED_OP_FLAG)) {
st_data_t val;
if (st_lookup(RHASH_TBL_RAW(hash), key, &val)) {
@@ -1304,7 +1314,7 @@ opt_case_dispatch
*/
DEFINE_INSN
opt_plus
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1367,7 +1377,7 @@ opt_plus
*/
DEFINE_INSN
opt_minus
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1415,7 +1425,7 @@ opt_minus
*/
DEFINE_INSN
opt_mult
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1465,7 +1475,7 @@ opt_mult
*/
DEFINE_INSN
opt_div
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1501,7 +1511,7 @@ opt_div
val = LONG2NUM(div);
}
else if (FLONUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
+ BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
@@ -1528,7 +1538,7 @@ opt_div
*/
DEFINE_INSN
opt_mod
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1540,13 +1550,12 @@ opt_mod
y = FIX2LONG(obj);
if (x > 0 && y > 0) {
val = LONG2FIX(x % y);
- }
- else {
+ } else {
/* copied from numeric.c#fixdivmod */
long div, mod;
if (y == 0)
- goto INSN_LABEL(normal_dispatch);
+ rb_num_zerodiv();
if (y < 0) {
if (x < 0)
div = -x / -y;
@@ -1595,11 +1604,11 @@ opt_mod
*/
DEFINE_INSN
opt_eq
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
- val = opt_eq_func(recv, obj, ci, cc);
+ val = opt_eq_func(recv, obj, ci);
if (val == Qundef) {
/* other */
@@ -1616,17 +1625,16 @@ opt_eq
*/
DEFINE_INSN
opt_neq
-(CALL_INFO ci, CALL_CACHE cc, CALL_INFO ci_eq, CALL_CACHE cc_eq)
+(CALL_INFO ci, CALL_INFO ci_eq)
(VALUE recv, VALUE obj)
(VALUE val)
{
extern VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
- vm_search_method(ci, cc, recv);
-
+ vm_search_method(ci, recv);
val = Qundef;
- if (check_cfunc(cc->me, rb_obj_not_equal)) {
- val = opt_eq_func(recv, obj, ci_eq, cc_eq);
+ if (check_cfunc(ci->me, rb_obj_not_equal)) {
+ val = opt_eq_func(recv, obj, ci_eq);
if (val != Qundef) {
val = RTEST(val) ? Qfalse : Qtrue;
@@ -1648,7 +1656,7 @@ opt_neq
*/
DEFINE_INSN
opt_lt
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1692,7 +1700,7 @@ opt_lt
*/
DEFINE_INSN
opt_le
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1727,7 +1735,7 @@ opt_le
*/
DEFINE_INSN
opt_gt
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1771,7 +1779,7 @@ opt_gt
*/
DEFINE_INSN
opt_ge
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1805,7 +1813,7 @@ opt_ge
*/
DEFINE_INSN
opt_ltlt
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1837,7 +1845,7 @@ opt_ltlt
*/
DEFINE_INSN
opt_aref
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj)
(VALUE val)
{
@@ -1867,7 +1875,7 @@ opt_aref
*/
DEFINE_INSN
opt_aset
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv, VALUE obj, VALUE set)
(VALUE val)
{
@@ -1895,59 +1903,12 @@ opt_aset
/**
@c optimize
- @e recv[str] = set
- @j 最適化された recv[str] = set。
- */
-DEFINE_INSN
-opt_aset_with
-(CALL_INFO ci, CALL_CACHE cc, VALUE key)
-(VALUE recv, VALUE val)
-(VALUE val)
-{
- if (!SPECIAL_CONST_P(recv) && RBASIC_CLASS(recv) == rb_cHash &&
- BASIC_OP_UNREDEFINED_P(BOP_ASET, HASH_REDEFINED_OP_FLAG) &&
- rb_hash_compare_by_id_p(recv) == Qfalse) {
- rb_hash_aset(recv, key, val);
- }
- else {
- PUSH(recv);
- PUSH(rb_str_resurrect(key));
- PUSH(val);
- CALL_SIMPLE_METHOD(recv);
- }
-}
-
-/**
- @c optimize
- @e recv[str]
- @j 最適化された recv[str]。
- */
-DEFINE_INSN
-opt_aref_with
-(CALL_INFO ci, CALL_CACHE cc, VALUE key)
-(VALUE recv)
-(VALUE val)
-{
- if (!SPECIAL_CONST_P(recv) && RBASIC_CLASS(recv) == rb_cHash &&
- BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG) &&
- rb_hash_compare_by_id_p(recv) == Qfalse) {
- val = rb_hash_aref(recv, key);
- }
- else {
- PUSH(recv);
- PUSH(rb_str_resurrect(key));
- CALL_SIMPLE_METHOD(recv);
- }
-}
-
-/**
- @c optimize
@e optimized length
@j 最適化された recv.length()。
*/
DEFINE_INSN
opt_length
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
@@ -1982,7 +1943,7 @@ opt_length
*/
DEFINE_INSN
opt_size
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
@@ -2017,7 +1978,7 @@ opt_size
*/
DEFINE_INSN
opt_empty_p
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
@@ -2055,7 +2016,7 @@ opt_empty_p
*/
DEFINE_INSN
opt_succ
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
@@ -2079,7 +2040,12 @@ opt_succ
BASIC_OP_UNREDEFINED_P(BOP_SUCC, STRING_REDEFINED_OP_FLAG)) {
val = rb_str_succ(recv);
}
- else {
+ else if (RBASIC_CLASS(recv) == rb_cTime &&
+ BASIC_OP_UNREDEFINED_P(BOP_SUCC, TIME_REDEFINED_OP_FLAG)) {
+ val = rb_time_succ(recv);
+ }
+ else
+ {
goto INSN_LABEL(normal_dispatch);
}
}
@@ -2097,15 +2063,14 @@ opt_succ
*/
DEFINE_INSN
opt_not
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE recv)
(VALUE val)
{
extern VALUE rb_obj_not(VALUE obj);
+ vm_search_method(ci, recv);
- vm_search_method(ci, cc, recv);
-
- if (check_cfunc(cc->me, rb_obj_not)) {
+ if (check_cfunc(ci->me, rb_obj_not)) {
val = RTEST(recv) ? Qfalse : Qtrue;
}
else {
@@ -2128,8 +2093,7 @@ opt_regexpmatch1
{
if (BASIC_OP_UNREDEFINED_P(BOP_MATCH, REGEXP_REDEFINED_OP_FLAG)) {
val = rb_reg_match(r, obj);
- }
- else {
+ } else {
val = rb_funcall(r, idEqTilde, 1, obj);
}
}
@@ -2141,11 +2105,11 @@ opt_regexpmatch1
*/
DEFINE_INSN
opt_regexpmatch2
-(CALL_INFO ci, CALL_CACHE cc)
+(CALL_INFO ci)
(VALUE obj2, VALUE obj1)
(VALUE val)
{
- if (CLASS_OF(obj2) == rb_cString &&
+ if (RB_TYPE_P(obj2, T_STRING) &&
BASIC_OP_UNREDEFINED_P(BOP_MATCH, STRING_REDEFINED_OP_FLAG)) {
val = rb_reg_match(obj1, obj2);
}
diff --git a/internal.h b/internal.h
index 14af6f0173..464266ffbb 100644
--- a/internal.h
+++ b/internal.h
@@ -12,10 +12,6 @@
#ifndef RUBY_INTERNAL_H
#define RUBY_INTERNAL_H 1
-#include "ruby.h"
-#include "ruby/encoding.h"
-#include "ruby/io.h"
-
#if defined(__cplusplus)
extern "C" {
#if 0
@@ -23,35 +19,6 @@ extern "C" {
#endif
#endif
-/* likely */
-#if __GNUC__ >= 3
-#define LIKELY(x) (__builtin_expect(!!(x), 1))
-#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
-#else /* __GNUC__ >= 3 */
-#define LIKELY(x) (x)
-#define UNLIKELY(x) (x)
-#endif /* __GNUC__ >= 3 */
-
-#ifndef __has_attribute
-# define __has_attribute(x) 0
-#endif
-
-#if __has_attribute(unused)
-#define UNINITIALIZED_VAR(x) x __attribute__((unused))
-#elif defined(__GNUC__) && __GNUC__ >= 3
-#define UNINITIALIZED_VAR(x) x = x
-#else
-#define UNINITIALIZED_VAR(x) x
-#endif
-
-#if __has_attribute(warn_unused_result)
-#define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result))
-#elif defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 3004
-#define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result))
-#else
-#define WARN_UNUSED_RESULT(x) x
-#endif
-
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
# ifndef VALGRIND_MAKE_MEM_DEFINED
@@ -67,26 +34,14 @@ extern "C" {
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
+#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
+
#define GCC_VERSION_SINCE(major, minor, patchlevel) \
(defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
((__GNUC__ > (major)) || \
(__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
(__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
-#ifndef __has_feature
-# define __has_feature(x) 0
-#endif
-
-#ifndef __has_extension
-# define __has_extension __has_feature
-#endif
-
-#if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
-# define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
-#else
-# define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
-#endif
-
#define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
#define SIGNED_INTEGER_MAX(sint_type) \
(sint_type) \
@@ -115,12 +70,6 @@ extern "C" {
#define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
#ifndef swap16
-# ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
-# define swap16(x) __builtin_bswap16(x)
-# endif
-#endif
-
-#ifndef swap16
# define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
#endif
@@ -283,160 +232,6 @@ nlz_int128(uint128_t x)
SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
#endif
-#ifndef BDIGIT
-# if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
-# define BDIGIT unsigned int
-# define SIZEOF_BDIGIT SIZEOF_INT
-# define BDIGIT_DBL unsigned LONG_LONG
-# define BDIGIT_DBL_SIGNED LONG_LONG
-# define PRI_BDIGIT_PREFIX ""
-# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
-# elif SIZEOF_INT*2 <= SIZEOF_LONG
-# define BDIGIT unsigned int
-# define SIZEOF_BDIGIT SIZEOF_INT
-# define BDIGIT_DBL unsigned long
-# define BDIGIT_DBL_SIGNED long
-# define PRI_BDIGIT_PREFIX ""
-# define PRI_BDIGIT_DBL_PREFIX "l"
-# elif SIZEOF_SHORT*2 <= SIZEOF_LONG
-# define BDIGIT unsigned short
-# define SIZEOF_BDIGIT SIZEOF_SHORT
-# define BDIGIT_DBL unsigned long
-# define BDIGIT_DBL_SIGNED long
-# define PRI_BDIGIT_PREFIX "h"
-# define PRI_BDIGIT_DBL_PREFIX "l"
-# else
-# define BDIGIT unsigned short
-# define SIZEOF_BDIGIT (SIZEOF_LONG/2)
-# define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
-# define BDIGIT_DBL unsigned long
-# define BDIGIT_DBL_SIGNED long
-# define PRI_BDIGIT_PREFIX "h"
-# define PRI_BDIGIT_DBL_PREFIX "l"
-# endif
-#endif
-#ifndef SIZEOF_ACTUAL_BDIGIT
-# define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT
-#endif
-
-#ifdef PRI_BDIGIT_PREFIX
-# define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
-# define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
-# define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
-# define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
-# define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
-# define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
-#endif
-
-#ifdef PRI_BDIGIT_DBL_PREFIX
-# define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
-# define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
-# define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
-# define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
-# define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
-# define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
-#endif
-
-#define BIGNUM_EMBED_LEN_NUMBITS 3
-#ifndef BIGNUM_EMBED_LEN_MAX
-# if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
-# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
-# else
-# define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
-# endif
-#endif
-
-struct RBignum {
- struct RBasic basic;
- union {
- struct {
- size_t len;
- BDIGIT *digits;
- } heap;
- BDIGIT ary[BIGNUM_EMBED_LEN_MAX];
- } as;
-};
-#define BIGNUM_SIGN_BIT FL_USER1
-/* sign: positive:1, negative:0 */
-#define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
-#define BIGNUM_SET_SIGN(b,sign) \
- ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \
- : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
-#define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
-#define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
-
-#define BIGNUM_EMBED_FLAG FL_USER2
-#define BIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
-#define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS)
-#define BIGNUM_LEN(b) \
- ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
- (long)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
- (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
- RBIGNUM(b)->as.heap.len)
-/* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
-#define BIGNUM_DIGITS(b) \
- ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
- RBIGNUM(b)->as.ary : \
- RBIGNUM(b)->as.heap.digits)
-#define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b))
-
-#define RBIGNUM(obj) (R_CAST(RBignum)(obj))
-
-struct RRational {
- struct RBasic basic;
- const VALUE num;
- const VALUE den;
-};
-
-#define RRATIONAL(obj) (R_CAST(RRational)(obj))
-
-struct RFloat {
- struct RBasic basic;
- double float_value;
-};
-
-#define RFLOAT(obj) (R_CAST(RFloat)(obj))
-
-struct RComplex {
- struct RBasic basic;
- const VALUE real;
- const VALUE imag;
-};
-
-#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
-
-#ifdef RCOMPLEX_SET_REAL /* shortcut macro for internal only */
-#undef RCOMPLEX_SET_REAL
-#undef RCOMPLEX_SET_IMAG
-#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
-#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
-#endif
-
-struct RHash {
- struct RBasic basic;
- struct st_table *ntbl; /* possibly 0 */
- int iter_lev;
- const VALUE ifnone;
-};
-
-#define RHASH(obj) (R_CAST(RHash)(obj))
-
-#ifdef RHASH_ITER_LEV
-#undef RHASH_ITER_LEV
-#undef RHASH_IFNONE
-#undef RHASH_SIZE
-#define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
-#define RHASH_IFNONE(h) (RHASH(h)->ifnone)
-#define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
-#endif
-
-/* missing/setproctitle.c */
-#ifndef HAVE_SETPROCTITLE
-extern void ruby_init_setproctitle(int argc, char *argv[]);
-#endif
-
-/* class.c */
-
struct rb_deprecated_classext_struct {
char conflict[sizeof(VALUE) * 3];
};
@@ -451,20 +246,16 @@ struct rb_subclass_entry {
#if defined(HAVE_LONG_LONG)
typedef unsigned LONG_LONG rb_serial_t;
-#define SERIALT2NUM ULL2NUM
#elif defined(HAVE_UINT64_T)
typedef uint64_t rb_serial_t;
-#define SERIALT2NUM SIZET2NUM
#else
typedef unsigned long rb_serial_t;
-#define SERIALT2NUM ULONG2NUM
#endif
struct rb_classext_struct {
- struct st_table *iv_index_tbl;
+ VALUE super;
struct st_table *iv_tbl;
struct st_table *const_tbl;
- struct rb_id_table *callable_m_tbl;
rb_subclass_entry_t *subclasses;
rb_subclass_entry_t **parent_subclasses;
/**
@@ -474,49 +265,28 @@ struct rb_classext_struct {
*/
rb_subclass_entry_t **module_subclasses;
rb_serial_t class_serial;
- const VALUE origin_;
+ VALUE origin;
VALUE refined_class;
rb_alloc_func_t allocator;
};
-typedef struct rb_classext_struct rb_classext_t;
-
-#undef RClass
-struct RClass {
- struct RBasic basic;
- VALUE super;
- rb_classext_t *ptr;
- struct rb_id_table *m_tbl;
-};
-
+/* class.c */
void rb_class_subclass_add(VALUE super, VALUE klass);
void rb_class_remove_from_super_subclasses(VALUE);
-int rb_singleton_class_internal_p(VALUE sklass);
#define RCLASS_EXT(c) (RCLASS(c)->ptr)
#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
-#define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
-#define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
-#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
+#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
+#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
-#define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
-
-#define RICLASS_IS_ORIGIN FL_USER5
-
-static inline void
-RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
-{
- RB_OBJ_WRITE(klass, &RCLASS_ORIGIN(klass), origin);
- if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN);
-}
#undef RCLASS_SUPER
static inline VALUE
RCLASS_SUPER(VALUE klass)
{
- return RCLASS(klass)->super;
+ return RCLASS_EXT(klass)->super;
}
static inline VALUE
@@ -526,173 +296,38 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super)
rb_class_remove_from_super_subclasses(klass);
rb_class_subclass_add(super, klass);
}
- RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
+ OBJ_WRITE(klass, &RCLASS_EXT(klass)->super, super);
return super;
}
-/* IMEMO: Internal memo object */
-
-#ifndef IMEMO_DEBUG
-#define IMEMO_DEBUG 0
-#endif
-
-struct RIMemo {
- VALUE flags;
- VALUE v0;
- VALUE v1;
- VALUE v2;
- VALUE v3;
-};
-
-enum imemo_type {
- imemo_none = 0,
- imemo_cref = 1,
- imemo_svar = 2,
- imemo_throw_data = 3,
- imemo_ifunc = 4,
- imemo_memo = 5,
- imemo_ment = 6,
- imemo_iseq = 7,
- imemo_mask = 0x07
-};
-
-static inline enum imemo_type
-imemo_type(VALUE imemo)
-{
- return (RBASIC(imemo)->flags >> FL_USHIFT) & imemo_mask;
-}
-
-/* FL_USER0 to FL_USER2 is for type */
-#define IMEMO_FL_USHIFT (FL_USHIFT + 3)
-#define IMEMO_FL_USER0 FL_USER3
-#define IMEMO_FL_USER1 FL_USER4
-#define IMEMO_FL_USER2 FL_USER5
-#define IMEMO_FL_USER3 FL_USER6
-#define IMEMO_FL_USER4 FL_USER7
-
-/* CREF in method.h */
-
-/* SVAR */
-
-struct vm_svar {
- VALUE flags;
- const VALUE cref_or_me;
- const VALUE lastline;
- const VALUE backref;
- const VALUE others;
-};
-
-/* THROW_DATA */
-
-#define THROW_DATA_CONSUMED IMEMO_FL_USER0
-
-struct vm_throw_data {
- VALUE flags;
- VALUE reserved;
- const VALUE throw_obj;
- const struct rb_control_frame_struct *catch_frame;
- VALUE throw_state;
-};
-
-#define THROW_DATA_P(err) RB_TYPE_P((VALUE)(err), T_IMEMO)
-
-/* IFUNC */
-
-struct vm_ifunc {
- VALUE flags;
- VALUE reserved;
- VALUE (*func)(ANYARGS);
- const void *data;
- ID id;
-};
-
-#define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
-
-/* MEMO */
-
-struct MEMO {
- VALUE flags;
- VALUE reserved;
- const VALUE v1;
- const VALUE v2;
- union {
- long cnt;
- long state;
- const VALUE value;
- VALUE (*func)(ANYARGS);
- } u3;
-};
-
-#define MEMO_V1_SET(m, v) RB_OBJ_WRITE((memo), &(memo)->v1, (v))
-#define MEMO_V2_SET(m, v) RB_OBJ_WRITE((memo), &(memo)->v2, (v))
-
-#define MEMO_CAST(m) ((struct MEMO *)m)
-
-#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
-
-#define roomof(x, y) (((x) + (y) - 1) / (y))
-#define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
-#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
-#define NEW_MEMO_FOR(type, value) \
- ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
-
-/* ment is in method.h */
-
-/* global variable */
-
-struct rb_global_entry {
- struct rb_global_variable *var;
- ID id;
-};
-
-struct rb_global_entry *rb_global_entry(ID);
-VALUE rb_gvar_get(struct rb_global_entry *);
-VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
-VALUE rb_gvar_defined(struct rb_global_entry *);
struct vtm; /* defined by timev.h */
/* array.c */
-VALUE rb_ary_last(int, const VALUE *, VALUE);
+VALUE rb_ary_last(int, VALUE *, VALUE);
void rb_ary_set_len(VALUE, long);
void rb_ary_delete_same(VALUE, VALUE);
-VALUE rb_ary_tmp_new_fill(long capa);
-VALUE rb_ary_at(VALUE, VALUE);
-size_t rb_ary_memsize(VALUE);
-#ifdef __GNUC__
-#define rb_ary_new_from_args(n, ...) \
- __extension__ ({ \
- const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
- if (__builtin_constant_p(n)) { \
- STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
- } \
- rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
- })
-#endif
/* bignum.c */
-extern const char ruby_digitmap[];
VALUE rb_big_fdiv(VALUE x, VALUE y);
VALUE rb_big_uminus(VALUE x);
VALUE rb_integer_float_cmp(VALUE x, VALUE y);
VALUE rb_integer_float_eq(VALUE x, VALUE y);
/* class.c */
-void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
+void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE));
void rb_class_detach_subclasses(VALUE);
void rb_class_detach_module_subclasses(VALUE);
void rb_class_remove_from_module_subclasses(VALUE);
-VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
-VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
-VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
-VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
+VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj);
+VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj);
+VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj);
+VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj);
int rb_obj_basic_to_s_p(VALUE);
VALUE rb_special_singleton_class(VALUE);
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
VALUE rb_singleton_class_get(VALUE obj);
void Init_class_hierarchy(void);
-int rb_class_has_methods(VALUE c);
-
/* compar.c */
VALUE rb_invcmp(VALUE, VALUE);
@@ -713,45 +348,43 @@ void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE
PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
/* dmyext.c */
-void Init_enc(void);
void Init_ext(void);
/* encoding.c */
+#ifdef RUBY_ENCODING_H
+enum ruby_preserved_encindex {
+ ENCINDEX_ASCII,
+ ENCINDEX_UTF_8,
+ ENCINDEX_US_ASCII,
+
+ /* preserved indexes */
+ ENCINDEX_UTF_16BE,
+ ENCINDEX_UTF_16LE,
+ ENCINDEX_UTF_32BE,
+ ENCINDEX_UTF_32LE,
+ ENCINDEX_UTF_16,
+ ENCINDEX_UTF_32,
+ ENCINDEX_UTF8_MAC,
+
+ /* for old options of regexp */
+ ENCINDEX_EUC_JP,
+ ENCINDEX_Windows_31J,
+
+ ENCINDEX_BUILTIN_MAX
+};
+#endif
+#define rb_ascii8bit_encindex() ENCINDEX_ASCII
+#define rb_utf8_encindex() ENCINDEX_UTF_8
+#define rb_usascii_encindex() ENCINDEX_US_ASCII
ID rb_id_encoding(void);
void rb_gc_mark_encodings(void);
-rb_encoding *rb_enc_get_from_index(int index);
-rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
-int rb_encdb_replicate(const char *alias, const char *orig);
-int rb_encdb_alias(const char *alias, const char *orig);
-int rb_encdb_dummy(const char *name);
-void rb_encdb_declare(const char *name);
-void rb_enc_set_base(const char *name, const char *orig);
-int rb_enc_set_dummy(int index);
-void rb_encdb_set_unicode(int index);
-int rb_data_is_encoding(VALUE obj);
-
-/* enum.c */
-VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
/* error.c */
-extern VALUE rb_eEAGAIN;
-extern VALUE rb_eEWOULDBLOCK;
-extern VALUE rb_eEINPROGRESS;
NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
-NORETURN(PRINTF_ARGS(void rb_compile_bug_str(VALUE file, int line, const char *fmt, ...), 3, 4));
-PRINTF_ARGS(void rb_compile_error_str(VALUE file, int line, void *enc, const char *fmt, ...), 4, 5);
VALUE rb_check_backtrace(VALUE);
NORETURN(void rb_async_bug_errno(const char *,int));
const char *rb_builtin_type_name(int t);
const char *rb_builtin_class_name(VALUE x);
-PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
-PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
-PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
-VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
-#define rb_name_err_raise_str(mesg, recv, name) \
- rb_exc_raise(rb_name_err_new(mesg, recv, name))
-#define rb_name_err_raise(mesg, recv, name) \
- rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
/* eval.c */
VALUE rb_refinement_module_get_refined_class(VALUE module);
@@ -775,7 +408,6 @@ VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
VALUE rb_get_path_check_to_string(VALUE, int);
VALUE rb_get_path_check_convert(VALUE, VALUE, int);
void Init_File(void);
-int ruby_is_fd_loadable(int fd);
#ifdef RUBY_FUNCTION_NAME_STRING
# if defined __GNUC__ && __GNUC__ >= 4
@@ -794,57 +426,24 @@ NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path)
#endif
/* gc.c */
-extern VALUE *ruby_initial_gc_stress_ptr;
-extern int ruby_disable_gc;
void Init_heap(void);
void *ruby_mimmalloc(size_t size);
void ruby_mimfree(void *ptr);
void rb_objspace_set_event_hook(const rb_event_flag_t event);
-#if USE_RGENGC
-void rb_gc_writebarrier_remember(VALUE obj);
-#else
-#define rb_gc_writebarrier_remember(obj) 0
-#endif
-void ruby_gc_set_params(int safe_level);
-void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
-
-#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
-#define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
-#define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size)
-#define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
-#define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
-#else
+void rb_gc_writebarrier_remember_promoted(VALUE obj);
+void ruby_gc_set_params(void);
+
void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
-void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2, 3));
void ruby_sized_xfree(void *x, size_t size);
#define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type)))
-#endif
void rb_gc_resurrect(VALUE ptr);
-/* optimized version of NEWOBJ() */
-#undef NEWOBJF_OF
-#undef RB_NEWOBJ_OF
-#define RB_NEWOBJ_OF(obj,type,klass,flags) \
- type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \
- rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \
- rb_wb_unprotected_newobj_of(klass, flags))
-#define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
-
/* hash.c */
struct st_table *rb_hash_tbl_raw(VALUE hash);
-VALUE rb_hash_has_key(VALUE hash, VALUE key);
-VALUE rb_hash_default_value(VALUE hash, VALUE key);
-VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
-long rb_objid_hash(st_index_t index);
-st_table *rb_init_identtable(void);
-st_table *rb_init_identtable_with_size(st_index_t size);
-VALUE rb_hash_compare_by_id_p(VALUE hash);
-
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
VALUE rb_hash_keys(VALUE hash);
VALUE rb_hash_values(VALUE hash);
-VALUE rb_hash_rehash(VALUE hash);
#define HASH_DELETED FL_USER1
#define HASH_PROC_DEFAULT FL_USER2
@@ -858,33 +457,32 @@ ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
void rb_stdio_set_default_encoding(void);
void rb_write_error_str(VALUE mesg);
VALUE rb_io_flush_raw(VALUE, int);
-size_t rb_io_memsize(const rb_io_t *);
+
+/* iseq.c */
+VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
+VALUE rb_iseq_path(VALUE iseqval);
+VALUE rb_iseq_absolute_path(VALUE iseqval);
+VALUE rb_iseq_label(VALUE iseqval);
+VALUE rb_iseq_base_label(VALUE iseqval);
+VALUE rb_iseq_first_lineno(VALUE iseqval);
+VALUE rb_iseq_klass(VALUE iseqval); /* completely temporary fucntion */
+VALUE rb_iseq_method_name(VALUE self);
/* load.c */
VALUE rb_get_load_path(void);
VALUE rb_get_expanded_load_path(void);
-int rb_require_internal(VALUE fname, int safe);
NORETURN(void rb_load_fail(VALUE, const char*));
-/* loadpath.c */
-extern const char ruby_exec_prefix[];
-extern const char ruby_initial_load_paths[];
-
-/* localeinit.c */
-int Init_enc_set_filesystem_encoding(void);
-
/* math.c */
VALUE rb_math_atan2(VALUE, VALUE);
VALUE rb_math_cos(VALUE);
VALUE rb_math_cosh(VALUE);
VALUE rb_math_exp(VALUE);
VALUE rb_math_hypot(VALUE, VALUE);
-VALUE rb_math_log(int argc, const VALUE *argv);
+VALUE rb_math_log(int argc, VALUE *argv);
VALUE rb_math_sin(VALUE);
VALUE rb_math_sinh(VALUE);
-#if 0
VALUE rb_math_sqrt(VALUE);
-#endif
/* newline.c */
void Init_newline(void);
@@ -897,7 +495,6 @@ double ruby_float_mod(double x, double y);
int rb_num_negative_p(VALUE);
VALUE rb_int_succ(VALUE num);
VALUE rb_int_pred(VALUE num);
-VALUE rb_dbl_hash(double d);
#if USE_FLONUM
#define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
@@ -905,41 +502,31 @@ VALUE rb_dbl_hash(double d);
#endif
static inline double
-rb_float_flonum_value(VALUE v)
+rb_float_value_inline(VALUE v)
{
#if USE_FLONUM
- if (v != (VALUE)0x8000000000000002) { /* LIKELY */
- union {
- double d;
- VALUE v;
- } t;
-
- VALUE b63 = (v >> 63);
- /* e: xx1... -> 011... */
- /* xx0... -> 100... */
- /* ^b63 */
- t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
- return t.d;
+ if (FLONUM_P(v)) {
+ if (v != (VALUE)0x8000000000000002) { /* LIKELY */
+ union {
+ double d;
+ VALUE v;
+ } t;
+
+ VALUE b63 = (v >> 63);
+ /* e: xx1... -> 011... */
+ /* xx0... -> 100... */
+ /* ^b63 */
+ t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
+ return t.d;
+ }
+ else {
+ return 0.0;
+ }
}
#endif
- return 0.0;
-}
-
-static inline double
-rb_float_noflonum_value(VALUE v)
-{
return ((struct RFloat *)v)->float_value;
}
-static inline double
-rb_float_value_inline(VALUE v)
-{
- if (FLONUM_P(v)) {
- return rb_float_flonum_value(v);
- }
- return rb_float_noflonum_value(v);
-}
-
static inline VALUE
rb_float_new_inline(double d)
{
@@ -974,12 +561,7 @@ rb_float_new_inline(double d)
#define rb_float_new(d) rb_float_new_inline(d)
/* object.c */
-void rb_obj_copy_ivar(VALUE dest, VALUE obj);
VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
-VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
-NORETURN(void rb_undefined_alloc(VALUE klass));
-double rb_num_to_dbl(VALUE val);
-VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
struct RBasicRaw {
VALUE flags;
@@ -990,13 +572,10 @@ struct RBasicRaw {
#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
#define RBASIC_SET_CLASS(obj, cls) do { \
VALUE _obj_ = (obj); \
- RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
+ OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
} while (0)
/* parse.y */
-#ifndef USE_SYMBOL_GC
-#define USE_SYMBOL_GC 1
-#endif
VALUE rb_parser_get_yydebug(VALUE);
VALUE rb_parser_set_yydebug(VALUE, VALUE);
int rb_is_const_name(VALUE name);
@@ -1007,29 +586,19 @@ int rb_is_attrset_name(VALUE name);
int rb_is_local_name(VALUE name);
int rb_is_method_name(VALUE name);
int rb_is_junk_name(VALUE name);
-int rb_is_const_sym(VALUE sym);
-int rb_is_class_sym(VALUE sym);
-int rb_is_global_sym(VALUE sym);
-int rb_is_instance_sym(VALUE sym);
-int rb_is_attrset_sym(VALUE sym);
-int rb_is_local_sym(VALUE sym);
-int rb_is_method_sym(VALUE sym);
-int rb_is_junk_sym(VALUE sym);
-ID rb_make_internal_id(void);
-void rb_gc_free_dsymbol(VALUE);
-ID rb_id_attrget(ID id);
+void rb_gc_mark_parser(void);
+void rb_gc_mark_symbols(int full_mark);
/* proc.c */
VALUE rb_proc_location(VALUE self);
st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
int rb_block_arity(void);
-VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
-VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val);
/* process.c */
#define RB_MAX_GROUPS (65536)
struct rb_execarg {
+ int use_shell;
union {
struct {
VALUE shell_script;
@@ -1045,7 +614,6 @@ struct rb_execarg {
VALUE envp_str;
VALUE envp_buf;
VALUE dup2_tmpbuf;
- unsigned use_shell : 1;
unsigned pgroup_given : 1;
unsigned umask_given : 1;
unsigned unsetenv_others_given : 1;
@@ -1062,11 +630,11 @@ struct rb_execarg {
mode_t umask_mask;
rb_uid_t uid;
rb_gid_t gid;
- int close_others_maxhint;
VALUE fd_dup2;
VALUE fd_close;
VALUE fd_open;
VALUE fd_dup2_child;
+ int close_others_maxhint;
VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
VALUE chdir_dir;
};
@@ -1084,16 +652,12 @@ void rb_last_status_clear(void);
/* rational.c */
VALUE rb_lcm(VALUE x, VALUE y);
VALUE rb_rational_reciprocal(VALUE x);
-VALUE rb_cstr_to_rat(const char *, int);
/* re.c */
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
VALUE rb_reg_check_preprocess(VALUE);
-long rb_reg_search0(VALUE, VALUE, long, int, int);
-void rb_backref_set_string(VALUE string, long pos, long len);
/* signal.c */
-extern int ruby_enable_coredump;
int rb_get_next_signal(void);
int rb_sigaltstack_size(void);
@@ -1107,18 +671,6 @@ size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc
/* string.c */
VALUE rb_fstring(VALUE);
-VALUE rb_fstring_new(const char *ptr, long len);
-#define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
-#define rb_fstring_literal(str) rb_fstring_lit(str)
-VALUE rb_fstring_cstr(const char *str);
-#if defined(__GNUC__) && !defined(__PCC__)
-#define rb_fstring_cstr(str) __extension__ ( \
-{ \
- (__builtin_constant_p(str)) ? \
- rb_fstring_new((str), (long)strlen(str)) : \
- rb_fstring_cstr(str); \
-})
-#endif
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
int rb_str_symname_p(VALUE);
VALUE rb_str_quote_unprintable(VALUE);
@@ -1126,51 +678,23 @@ VALUE rb_id_quote_unprintable(ID);
#define QUOTE(str) rb_str_quote_unprintable(str)
#define QUOTE_ID(id) rb_id_quote_unprintable(id)
void rb_str_fill_terminator(VALUE str, const int termlen);
-void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
#ifdef RUBY_ENCODING_H
VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
-VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
- rb_encoding *from, int ecflags, VALUE ecopts);
-VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
#endif
-#define STR_NOEMBED FL_USER1
-#define STR_SHARED FL_USER2 /* = ELTS_SHARED */
-#define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED))
-#define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED)
+#define STR_NOEMBED FL_USER1
+#define STR_SHARED FL_USER2 /* = ELTS_SHARED */
+#define STR_ASSOC FL_USER3
+#define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED)
+#define STR_ASSOC_P(s) FL_ALL((s), STR_NOEMBED|STR_ASSOC)
+#define STR_NOCAPA (STR_NOEMBED|ELTS_SHARED|STR_ASSOC)
+#define STR_NOCAPA_P(s) (FL_TEST((s),STR_NOEMBED) && FL_ANY((s),ELTS_SHARED|STR_ASSOC))
+#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED))
#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
-size_t rb_str_memsize(VALUE);
-VALUE rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passed_proc);
-VALUE rb_sym_to_proc(VALUE sym);
-
-/* symbol.c */
-#ifdef RUBY_ENCODING_H
-VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
-VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc);
-#ifdef __GNUC__
-#define rb_sym_intern_cstr(ptr, enc) __extension__ ( \
-{ \
- (__builtin_constant_p(ptr)) ? \
- rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \
- rb_sym_intern_cstr((ptr), (enc)); \
-})
-#endif
-#endif
-VALUE rb_sym_intern_ascii(const char *ptr, long len);
-VALUE rb_sym_intern_ascii_cstr(const char *ptr);
-#ifdef __GNUC__
-#define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \
-{ \
- (__builtin_constant_p(ptr)) ? \
- rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
- rb_sym_intern_ascii_cstr(ptr); \
-})
-#endif
/* struct.c */
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
-VALUE rb_struct_lookup(VALUE s, VALUE idx);
/* time.c */
struct timeval rb_time_timeval(VALUE);
@@ -1185,7 +709,6 @@ VALUE rb_thread_shield_new(void);
VALUE rb_thread_shield_wait(VALUE self);
VALUE rb_thread_shield_release(VALUE self);
VALUE rb_thread_shield_destroy(VALUE self);
-int rb_thread_to_be_killed(VALUE thread);
void rb_mutex_allow_trap(VALUE self, int val);
VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
VALUE rb_mutex_owned_p(VALUE self);
@@ -1193,31 +716,6 @@ void ruby_kill(rb_pid_t pid, int sig);
/* thread_pthread.c, thread_win32.c */
void Init_native_thread(void);
-int rb_divert_reserved_fd(int fd);
-
-/* transcode.c */
-extern VALUE rb_cEncodingConverter;
-size_t rb_econv_memsize(rb_econv_t *);
-
-/* us_ascii.c */
-extern rb_encoding OnigEncodingUS_ASCII;
-
-/* util.c */
-char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
-char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
-
-/* utf_8.c */
-extern rb_encoding OnigEncodingUTF_8;
-
-/* variable.c */
-size_t rb_generic_ivar_memsize(VALUE);
-VALUE rb_search_class_path(VALUE);
-VALUE rb_attr_delete(VALUE, ID);
-VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
-void rb_autoload_str(VALUE mod, ID id, VALUE file);
-
-/* version.c */
-extern const char ruby_engine[];
/* vm_insnhelper.h */
rb_serial_t rb_next_class_serial(void);
@@ -1226,7 +724,6 @@ rb_serial_t rb_next_class_serial(void);
VALUE rb_obj_is_thread(VALUE obj);
void rb_vm_mark(void *ptr);
void Init_BareVM(void);
-void Init_vm_objects(void);
VALUE rb_vm_top_self(void);
void rb_thread_recycle_stack_release(VALUE *);
void rb_vm_change_state(void);
@@ -1234,27 +731,18 @@ void rb_vm_inc_const_missing_count(void);
void rb_thread_mark(void *th);
const void **rb_vm_get_insns_address_table(void);
VALUE rb_sourcefilename(void);
-VALUE rb_source_location(int *pline);
-const char *rb_source_loc(int *pline);
-void rb_vm_pop_cfunc_frame(void);
-int rb_vm_add_root_module(ID id, VALUE module);
-void rb_vm_check_redefinition_by_prepend(VALUE klass);
-VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
-VALUE ruby_vm_special_exception_copy(VALUE);
/* vm_dump.c */
+void rb_vm_bugreport(void);
void rb_print_backtrace(void);
/* vm_eval.c */
void Init_vm_eval(void);
VALUE rb_current_realfilepath(void);
-VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
+VALUE rb_check_block_call(VALUE, ID, int, VALUE *, VALUE (*)(ANYARGS), VALUE);
typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
rb_check_funcall_hook *hook, VALUE arg);
-VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
-VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
-VALUE rb_yield_1(VALUE val);
/* vm_insnhelper.c */
VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
@@ -1268,14 +756,13 @@ void Init_prelude(void);
/* vm_backtrace.c */
void Init_vm_backtrace(void);
-VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
-VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
+VALUE rb_vm_thread_backtrace(int argc, VALUE *argv, VALUE thval);
+VALUE rb_vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval);
VALUE rb_make_backtrace(void);
void rb_backtrace_print_as_bugreport(void);
int rb_backtrace_p(VALUE obj);
VALUE rb_backtrace_to_str_ary(VALUE obj);
-VALUE rb_backtrace_to_location_ary(VALUE obj);
void rb_backtrace_print_to(VALUE output);
VALUE rb_vm_backtrace_object(void);
@@ -1285,7 +772,7 @@ const char *rb_objspace_data_type_name(VALUE obj);
/* Temporary. This API will be removed (renamed). */
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
-/* bignum.c (export) */
+/* bignum.c */
VALUE rb_big_mul_normal(VALUE x, VALUE y);
VALUE rb_big_mul_balance(VALUE x, VALUE y);
VALUE rb_big_mul_karatsuba(VALUE x, VALUE y);
@@ -1304,100 +791,54 @@ VALUE rb_big2str_gmp(VALUE x, int base);
VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
#endif
-/* error.c (export) */
+/* error.c */
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
-/* file.c (export) */
-#ifdef HAVE_READLINK
-VALUE rb_readlink(VALUE path, rb_encoding *enc);
-#endif
+/* file.c */
#ifdef __APPLE__
VALUE rb_str_normalize_ospath(const char *ptr, long len);
#endif
-/* hash.c (export) */
-VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
-VALUE rb_ident_hash_new(void);
-
-/* io.c (export) */
+/* io.c */
void rb_maygvl_fd_fix_cloexec(int fd);
-int rb_gc_for_fd(int err);
-/* numeric.c (export) */
+/* numeric.c */
VALUE rb_int_positive_pow(long x, unsigned long y);
-/* process.c (export) */
+/* process.c */
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
-VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
+VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
-VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
+VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj);
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
-void rb_execarg_parent_start(VALUE execarg_obj);
-void rb_execarg_parent_end(VALUE execarg_obj);
+void rb_execarg_fixup(VALUE execarg_obj);
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
-/* rational.c (export) */
+/* rational.c */
VALUE rb_gcd_normal(VALUE self, VALUE other);
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
VALUE rb_gcd_gmp(VALUE x, VALUE y);
#endif
-/* string.c (export) */
-#ifdef RUBY_ENCODING_H
-/* internal use */
-VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
-#endif
-
-/* thread.c (export) */
-int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
-
-/* util.c (export) */
+/* util.c */
extern const signed char ruby_digit36_to_number_table[];
-extern const char ruby_hexdigits[];
-extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
-/* variable.c (export) */
+/* variable.c */
void rb_gc_mark_global_tbl(void);
void rb_mark_generic_ivar(VALUE);
-VALUE rb_const_missing(VALUE klass, VALUE name);
-int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
-st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
+void rb_mark_generic_ivar_tbl(void);
-/* gc.c (export) */
-VALUE rb_wb_protected_newobj_of(VALUE, VALUE);
-VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE);
+int rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value);
+st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
+/* gc.c */
size_t rb_obj_memsize_of(VALUE);
-void rb_gc_verify_internal_consistency(void);
-
-#define RB_OBJ_GC_FLAGS_MAX 5
-size_t rb_obj_gc_flags(VALUE, ID[], size_t);
-void rb_gc_mark_values(long n, const VALUE *values);
-
-#if IMEMO_DEBUG
-VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
-#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
-#else
-VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
-#endif
RUBY_SYMBOL_EXPORT_END
-#define RUBY_DTRACE_CREATE_HOOK(name, arg) \
- RUBY_DTRACE_HOOK(name##_CREATE, arg)
-#define RUBY_DTRACE_HOOK(name, arg) \
-do { \
- if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
- int dtrace_line; \
- const char *dtrace_file = rb_source_loc(&dtrace_line); \
- if (!dtrace_file) dtrace_file = ""; \
- RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
- } \
-} while (0)
-
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
diff --git a/io.c b/io.c
index aeea680652..053e8f3b0e 100644
--- a/io.c
+++ b/io.c
@@ -11,17 +11,16 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "dln.h"
-#include "encindex.h"
+#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <errno.h>
#include "ruby_atomic.h"
-#undef free
#define free(x) xfree(x)
#if defined(DOSISH) || defined(__CYGWIN__)
@@ -32,10 +31,12 @@
#if defined HAVE_NET_SOCKET_H
# include <net/socket.h>
#elif defined HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
+# ifndef __native_client__
+# include <sys/socket.h>
+# endif
#endif
-#if defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32)
+#if defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__EMX__) || defined(__BEOS__) || defined(__HAIKU__)
# define NO_SAFE_RENAME
#endif
@@ -51,6 +52,9 @@
#if defined(HAVE_SYS_IOCTL_H) && !defined(_WIN32)
#include <sys/ioctl.h>
#endif
+#if defined(__native_client__) && defined(NACL_NEWLIB)
+# include "nacl/ioctl.h"
+#endif
#if defined(HAVE_FCNTL_H) || defined(_WIN32)
#include <fcntl.h>
#elif defined(HAVE_SYS_FCNTL_H)
@@ -60,21 +64,11 @@
#if !HAVE_OFF_T && !defined(off_t)
# define off_t long
#endif
-#if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
-# define PRI_OFF_T_PREFIX "ll"
-#elif SIZEOF_OFF_T == SIZEOF_LONG
-# define PRI_OFF_T_PREFIX "l"
-#else
-# define PRI_OFF_T_PREFIX ""
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
#include <sys/stat.h>
-#if defined(HAVE_SYS_PARAM_H) || defined(__HIUX_MPP__)
+/* EMX has sys/param.h, but.. */
+#if defined(HAVE_SYS_PARAM_H) && !(defined(__EMX__) || defined(__HIUX_MPP__))
# include <sys/param.h>
#endif
@@ -92,12 +86,10 @@
#include <sys/syscall.h>
#endif
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h> /* for WNOHANG on BSD */
+#if defined(__BEOS__) || defined(__HAIKU__)
+# ifndef NOFILE
+# define NOFILE (OPEN_MAX)
+# endif
#endif
#include "ruby/util.h"
@@ -127,13 +119,6 @@
off_t __syscall(quad_t number, ...);
#endif
-#ifdef __native_client__
-# undef F_GETFD
-# ifdef NACL_NEWLIB
-# undef HAVE_IOCTL
-# endif
-#endif
-
#define IO_RBUF_CAPA_MIN 8192
#define IO_CBUF_CAPA_MIN (128*1024)
#define IO_RBUF_CAPA_FOR(fptr) (NEED_READCONV(fptr) ? IO_CBUF_CAPA_MIN : IO_RBUF_CAPA_MIN)
@@ -150,6 +135,9 @@ VALUE rb_eEOFError;
VALUE rb_eIOError;
VALUE rb_mWaitReadable;
VALUE rb_mWaitWritable;
+extern VALUE rb_eEAGAIN;
+extern VALUE rb_eEWOULDBLOCK;
+extern VALUE rb_eEINPROGRESS;
static VALUE rb_eEAGAINWaitReadable;
static VALUE rb_eEAGAINWaitWritable;
@@ -169,12 +157,10 @@ VALUE rb_default_rs;
static VALUE argf;
-#define id_exception idException
static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding;
-static VALUE sym_mode, sym_perm, sym_flags, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
-static VALUE sym_textmode, sym_binmode, sym_autoclose;
+static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
+static VALUE sym_textmode, sym_binmode, sym_autoclose, sym_exception;
static VALUE sym_SET, sym_CUR, sym_END;
-static VALUE sym_wait_readable, sym_wait_writable;
#ifdef SEEK_DATA
static VALUE sym_DATA;
#endif
@@ -199,9 +185,6 @@ rb_update_max_fd(int fd)
struct stat buf;
rb_atomic_t afd = (rb_atomic_t)fd;
- if (afd <= max_file_descriptor)
- return;
-
if (fstat(fd, &buf) != 0 && errno == EBADF) {
rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
}
@@ -241,29 +224,10 @@ rb_fd_fix_cloexec(int fd)
rb_update_max_fd(fd);
}
-/* this is only called once */
-static int
-rb_fix_detect_o_cloexec(int fd)
-{
-#if defined(O_CLOEXEC) && defined(F_GETFD)
- int flags = fcntl(fd, F_GETFD);
-
- if (flags == -1)
- rb_bug("rb_fix_detect_o_cloexec: fcntl(%d, F_GETFD) failed: %s", fd, strerror(errno));
-
- if (flags & FD_CLOEXEC)
- return 1;
-#endif /* fall through if O_CLOEXEC does not work: */
- rb_maygvl_fd_fix_cloexec(fd);
- return 0;
-}
-
int
rb_cloexec_open(const char *pathname, int flags, mode_t mode)
{
int ret;
- static int o_cloexec_state = -1; /* <0: unknown, 0: ignored, >0: working */
-
#ifdef O_CLOEXEC
/* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
flags |= O_CLOEXEC;
@@ -272,15 +236,7 @@ rb_cloexec_open(const char *pathname, int flags, mode_t mode)
#endif
ret = open(pathname, flags, mode);
if (ret == -1) return -1;
- if (ret <= 2 || o_cloexec_state == 0) {
- rb_maygvl_fd_fix_cloexec(ret);
- }
- else if (o_cloexec_state > 0) {
- return ret;
- }
- else {
- o_cloexec_state = rb_fix_detect_o_cloexec(ret);
- }
+ rb_maygvl_fd_fix_cloexec(ret);
return ret;
}
@@ -319,6 +275,10 @@ rb_cloexec_dup2(int oldfd, int newfd)
}
#else
ret = dup2(oldfd, newfd);
+# ifdef _WIN32
+ if (newfd >= 0 && newfd <= 2)
+ SetStdHandle(newfd == 0 ? STD_INPUT_HANDLE : newfd == 1 ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE, (HANDLE)rb_w32_get_osfhandle(newfd));
+# endif
#endif
if (ret == -1) return -1;
}
@@ -409,6 +369,22 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
#define argf_of(obj) (*(struct argf *)DATA_PTR(obj))
#define ARGF argf_of(argf)
+#ifdef _STDIO_USES_IOSTREAM /* GNU libc */
+# ifdef _IO_fpos_t
+# define STDIO_READ_DATA_PENDING(fp) ((fp)->_IO_read_ptr != (fp)->_IO_read_end)
+# else
+# define STDIO_READ_DATA_PENDING(fp) ((fp)->_gptr < (fp)->_egptr)
+# endif
+#elif defined(FILE_COUNT)
+# define STDIO_READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
+#elif defined(FILE_READEND)
+# define STDIO_READ_DATA_PENDING(fp) ((fp)->FILE_READPTR < (fp)->FILE_READEND)
+#elif defined(__BEOS__) || defined(__HAIKU__)
+# define STDIO_READ_DATA_PENDING(fp) ((fp)->_state._eof == 0)
+#else
+# define STDIO_READ_DATA_PENDING(fp) (!feof(fp))
+#endif
+
#define GetWriteIO(io) rb_io_get_write_io(io)
#define READ_DATA_PENDING(fptr) ((fptr)->rbuf.len)
@@ -431,7 +407,7 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
if (!READ_DATA_PENDING(fptr)) {\
WAIT_FD_IN_WIN32(fptr);\
rb_io_check_closed(fptr);\
- }\
+ }\
} while(0)
#ifndef S_ISSOCK
@@ -551,9 +527,8 @@ io_unread(rb_io_t *fptr)
}
read_size = _read(fptr->fd, buf, fptr->rbuf.len + newlines);
if (read_size < 0) {
- int e = errno;
free(buf);
- rb_syserr_fail_path(e, fptr->pathv);
+ rb_sys_fail_path(fptr->pathv);
}
if (read_size == fptr->rbuf.len) {
lseek(fptr->fd, r, SEEK_SET);
@@ -619,8 +594,6 @@ is_socket(int fd, VALUE path)
}
#endif
-static const char closed_stream[] = "closed stream";
-
void
rb_eof_error(void)
{
@@ -647,17 +620,10 @@ rb_io_check_closed(rb_io_t *fptr)
{
rb_io_check_initialized(fptr);
if (fptr->fd < 0) {
- rb_raise(rb_eIOError, closed_stream);
+ rb_raise(rb_eIOError, "closed stream");
}
}
-static rb_io_t *
-rb_io_get_fptr(VALUE io)
-{
- rb_io_t *fptr = RFILE(io)->fptr;
- rb_io_check_initialized(fptr);
- return fptr;
-}
VALUE
rb_io_get_io(VALUE io)
@@ -675,7 +641,8 @@ VALUE
rb_io_get_write_io(VALUE io)
{
VALUE write_io;
- write_io = rb_io_get_fptr(io)->tied_io_for_writing;
+ rb_io_check_initialized(RFILE(io)->fptr);
+ write_io = RFILE(io)->fptr->tied_io_for_writing;
if (write_io) {
return write_io;
}
@@ -686,24 +653,24 @@ VALUE
rb_io_set_write_io(VALUE io, VALUE w)
{
VALUE write_io;
- rb_io_t *fptr = rb_io_get_fptr(io);
+ rb_io_check_initialized(RFILE(io)->fptr);
if (!RTEST(w)) {
w = 0;
}
else {
GetWriteIO(w);
}
- write_io = fptr->tied_io_for_writing;
- fptr->tied_io_for_writing = w;
+ write_io = RFILE(io)->fptr->tied_io_for_writing;
+ RFILE(io)->fptr->tied_io_for_writing = w;
return write_io ? write_io : Qnil;
}
/*
* call-seq:
- * IO.try_convert(obj) -> io or nil
+ * IO.try_convert(obj) -> io or nil
*
* Try to convert <i>obj</i> into an IO, using to_io method.
- * Returns converted IO or +nil+ if <i>obj</i> cannot be converted
+ * Returns converted IO or nil if <i>obj</i> cannot be converted
* for any reason.
*
* IO.try_convert(STDOUT) #=> STDOUT
@@ -871,22 +838,20 @@ rb_io_read_pending(rb_io_t *fptr)
}
void
-rb_io_read_check(rb_io_t *fptr)
+rb_read_check(FILE *fp)
{
- if (!READ_DATA_PENDING(fptr)) {
- rb_thread_wait_fd(fptr->fd);
+ if (!STDIO_READ_DATA_PENDING(fp)) {
+ rb_thread_wait_fd(fileno(fp));
}
- return;
}
-int
-rb_gc_for_fd(int err)
+void
+rb_io_read_check(rb_io_t *fptr)
{
- if (err == EMFILE || err == ENFILE || err == ENOMEM) {
- rb_gc();
- return 1;
+ if (!READ_DATA_PENDING(fptr)) {
+ rb_thread_wait_fd(fptr->fd);
}
- return 0;
+ return;
}
static int
@@ -896,7 +861,8 @@ ruby_dup(int orig)
fd = rb_cloexec_dup(orig);
if (fd < 0) {
- if (rb_gc_for_fd(errno)) {
+ if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
+ rb_gc();
fd = rb_cloexec_dup(orig);
}
if (fd < 0) {
@@ -921,6 +887,29 @@ io_alloc(VALUE klass)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
+static int
+wsplit_p(rb_io_t *fptr)
+{
+#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(O_NONBLOCK)
+ int r;
+#endif
+
+ if (!(fptr->mode & FMODE_WSPLIT_INITIALIZED)) {
+ struct stat buf;
+ if (fstat(fptr->fd, &buf) == 0 &&
+ !S_ISREG(buf.st_mode)
+#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(O_NONBLOCK)
+ && (r = fcntl(fptr->fd, F_GETFL)) != -1 &&
+ !(r & O_NONBLOCK)
+#endif
+ ) {
+ fptr->mode |= FMODE_WSPLIT;
+ }
+ fptr->mode |= FMODE_WSPLIT_INITIALIZED;
+ }
+ return fptr->mode & FMODE_WSPLIT;
+}
+
struct io_internal_read_struct {
int fd;
void *buf;
@@ -933,14 +922,6 @@ struct io_internal_write_struct {
size_t capa;
};
-#ifdef HAVE_WRITEV
-struct io_internal_writev_struct {
- int fd;
- int iovcnt;
- const struct iovec *iov;
-};
-#endif
-
static VALUE
internal_read_func(void *ptr)
{
@@ -962,15 +943,6 @@ internal_write_func2(void *ptr)
return (void*)(intptr_t)write(iis->fd, iis->buf, iis->capa);
}
-#ifdef HAVE_WRITEV
-static VALUE
-internal_writev_func(void *ptr)
-{
- struct io_internal_writev_struct *iis = ptr;
- return writev(iis->fd, iis->iov, iis->iovcnt);
-}
-#endif
-
static ssize_t
rb_read_internal(int fd, void *buf, size_t count)
{
@@ -1005,24 +977,22 @@ rb_write_internal2(int fd, const void *buf, size_t count)
RUBY_UBF_IO, NULL);
}
-#ifdef HAVE_WRITEV
-static ssize_t
-rb_writev_internal(int fd, const struct iovec *iov, int iovcnt)
+static long
+io_writable_length(rb_io_t *fptr, long l)
{
- struct io_internal_writev_struct iis;
- iis.fd = fd;
- iis.iov = iov;
- iis.iovcnt = iovcnt;
-
- return (ssize_t)rb_thread_io_blocking_region(internal_writev_func, &iis, fd);
+ if (PIPE_BUF < l &&
+ !rb_thread_alone() &&
+ wsplit_p(fptr)) {
+ l = PIPE_BUF;
+ }
+ return l;
}
-#endif
static VALUE
io_flush_buffer_sync(void *arg)
{
rb_io_t *fptr = arg;
- long l = fptr->wbuf.len;
+ long l = io_writable_length(fptr, fptr->wbuf.len);
ssize_t r = write(fptr->fd, fptr->wbuf.ptr+fptr->wbuf.off, (size_t)l);
if (fptr->wbuf.len <= r) {
@@ -1070,11 +1040,10 @@ io_flush_buffer_async2(VALUE arg)
/* pending async interrupt is there. */
errno = EAGAIN;
return -1;
- }
- else if (ret == 1) {
+ } else if (ret == 1) {
return 0;
- }
- return ret;
+ } else
+ return ret;
}
static inline int
@@ -1110,7 +1079,7 @@ int
rb_io_wait_readable(int f)
{
if (f < 0) {
- rb_raise(rb_eIOError, closed_stream);
+ rb_raise(rb_eIOError, "closed stream");
}
switch (errno) {
case EINTR:
@@ -1136,7 +1105,7 @@ int
rb_io_wait_writable(int f)
{
if (f < 0) {
- rb_raise(rb_eIOError, closed_stream);
+ rb_raise(rb_eIOError, "closed stream");
}
switch (errno) {
case EINTR:
@@ -1236,76 +1205,13 @@ struct write_arg {
int nosync;
};
-#ifdef HAVE_WRITEV
static VALUE
io_binwrite_string(VALUE arg)
{
struct binwrite_arg *p = (struct binwrite_arg *)arg;
- rb_io_t *fptr = p->fptr;
- long r;
-
- if (fptr->wbuf.len) {
- struct iovec iov[2];
-
- iov[0].iov_base = fptr->wbuf.ptr+fptr->wbuf.off;
- iov[0].iov_len = fptr->wbuf.len;
- iov[1].iov_base = (char *)p->ptr;
- iov[1].iov_len = p->length;
-
- r = rb_writev_internal(fptr->fd, iov, 2);
-
- if (r == -1)
- return -1;
-
- if (fptr->wbuf.len <= r) {
- r -= fptr->wbuf.len;
- fptr->wbuf.off = 0;
- fptr->wbuf.len = 0;
- }
- else {
- fptr->wbuf.off += (int)r;
- fptr->wbuf.len -= (int)r;
- r = 0L;
- }
- }
- else {
- r = rb_write_internal(fptr->fd, p->ptr, p->length);
- }
-
- return r;
+ long l = io_writable_length(p->fptr, p->length);
+ return rb_write_internal2(p->fptr->fd, p->ptr, l);
}
-#else
-static VALUE
-io_binwrite_string(VALUE arg)
-{
- struct binwrite_arg *p = (struct binwrite_arg *)arg;
- rb_io_t *fptr = p->fptr;
- long l, len;
-
- l = len = p->length;
-
- if (fptr->wbuf.len) {
- if (fptr->wbuf.len+len <= fptr->wbuf.capa) {
- if (fptr->wbuf.capa < fptr->wbuf.off+fptr->wbuf.len+len) {
- MEMMOVE(fptr->wbuf.ptr, fptr->wbuf.ptr+fptr->wbuf.off, char, fptr->wbuf.len);
- fptr->wbuf.off = 0;
- }
- MEMMOVE(fptr->wbuf.ptr+fptr->wbuf.off+fptr->wbuf.len, p->ptr, char, len);
- fptr->wbuf.len += (int)len;
- l = 0;
- }
- if (io_fflush(fptr) < 0)
- return -2L; /* fail in fflush */
- if (l == 0)
- return len;
- }
-
- if (fptr->stdio_file != stderr && !rb_thread_fd_writable(fptr->fd))
- rb_io_check_closed(fptr);
-
- return rb_write_internal(p->fptr->fd, p->ptr, p->length);
-}
-#endif
static long
io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
@@ -1328,6 +1234,27 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
(fptr->wbuf.ptr && fptr->wbuf.capa <= fptr->wbuf.len + len)) {
struct binwrite_arg arg;
+ /*
+ * xxx: use writev to avoid double write if available
+ * writev may help avoid context switch between "a" and "\n" in
+ * STDERR.puts "a" [ruby-dev:25080] (rebroken since native threads
+ * introduced in 1.9)
+ */
+ if (fptr->wbuf.len && fptr->wbuf.len+len <= fptr->wbuf.capa) {
+ if (fptr->wbuf.capa < fptr->wbuf.off+fptr->wbuf.len+len) {
+ MEMMOVE(fptr->wbuf.ptr, fptr->wbuf.ptr+fptr->wbuf.off, char, fptr->wbuf.len);
+ fptr->wbuf.off = 0;
+ }
+ MEMMOVE(fptr->wbuf.ptr+fptr->wbuf.off+fptr->wbuf.len, ptr+offset, char, len);
+ fptr->wbuf.len += (int)len;
+ n = 0;
+ }
+ if (io_fflush(fptr) < 0)
+ return -1L;
+ if (n == 0)
+ return len;
+
+ rb_io_check_closed(fptr);
arg.fptr = fptr;
arg.str = str;
retry:
@@ -1337,7 +1264,8 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
r = rb_mutex_synchronize(fptr->write_lock, io_binwrite_string, (VALUE)&arg);
}
else {
- r = io_binwrite_string((VALUE)&arg);
+ long l = io_writable_length(fptr, n);
+ r = rb_write_internal(fptr->fd, ptr+offset, l);
}
/* xxx: other threads may modify given string. */
if (r == n) return len;
@@ -1345,9 +1273,7 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
offset += r;
n -= r;
errno = EAGAIN;
- }
- if (r == -2L)
- return -1L;
+ }
if (rb_io_wait_writable(fptr->fd)) {
rb_io_check_closed(fptr);
if (offset < len)
@@ -1369,7 +1295,7 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
# define MODE_BTMODE(a,b,c) ((fmode & FMODE_BINMODE) ? (b) : \
(fmode & FMODE_TEXTMODE) ? (c) : (a))
static VALUE
-do_writeconv(VALUE str, rb_io_t *fptr, int *converted)
+do_writeconv(VALUE str, rb_io_t *fptr)
{
if (NEED_WRITECONV(fptr)) {
VALUE common_encoding = Qnil;
@@ -1397,12 +1323,10 @@ do_writeconv(VALUE str, rb_io_t *fptr, int *converted)
if (!NIL_P(common_encoding)) {
str = rb_str_encode(str, common_encoding,
fptr->writeconv_pre_ecflags, fptr->writeconv_pre_ecopts);
- *converted = 1;
}
if (fptr->writeconv) {
str = rb_econv_str_convert(fptr->writeconv, str, ECONV_PARTIAL_INPUT);
- *converted = 1;
}
}
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
@@ -1428,19 +1352,13 @@ do_writeconv(VALUE str, rb_io_t *fptr, int *converted)
static long
io_fwrite(VALUE str, rb_io_t *fptr, int nosync)
{
- int converted = 0;
#ifdef _WIN32
if (fptr->mode & FMODE_TTY) {
long len = rb_w32_write_console(str, fptr->fd);
if (len > 0) return len;
}
#endif
- str = do_writeconv(str, fptr, &converted);
- if (converted)
- OBJ_FREEZE(str);
- else
- str = rb_str_new_frozen(str);
-
+ str = do_writeconv(str, fptr);
return io_binwrite(str, RSTRING_PTR(str), RSTRING_LEN(str),
fptr, nosync);
}
@@ -1472,6 +1390,8 @@ io_write(VALUE io, VALUE str, int nosync)
io = tmp;
if (RSTRING_LEN(str) == 0) return INT2FIX(0);
+ str = rb_str_new_frozen(str);
+
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
@@ -1540,10 +1460,6 @@ nogvl_fsync(void *ptr)
{
rb_io_t *fptr = ptr;
-#ifdef _WIN32
- if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) != FILE_TYPE_DISK)
- return 0;
-#endif
return (VALUE)fsync(fptr->fd);
}
#endif
@@ -1563,6 +1479,11 @@ rb_io_flush_raw(VALUE io, int sync)
if (fptr->mode & FMODE_WRITABLE) {
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
+#ifdef _WIN32
+ if (sync && GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
+ rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd);
+ }
+#endif
}
if (fptr->mode & FMODE_READABLE) {
io_unread(fptr);
@@ -1655,7 +1576,7 @@ interpret_seek_whence(VALUE vwhence)
/*
* call-seq:
- * ios.seek(amount, whence=IO::SEEK_SET) -> 0
+ * ios.seek(amount, whence=IO::SEEK_SET) -> 0
*
* Seeks to a given offset <i>anInteger</i> in the stream according to
* the value of <i>whence</i>:
@@ -1773,15 +1694,13 @@ io_fillbuf(rb_io_t *fptr)
if (rb_io_wait_readable(fptr->fd))
goto retry;
{
- int e = errno;
VALUE path = rb_sprintf("fd:%d ", fptr->fd);
if (!NIL_P(fptr->pathv)) {
rb_str_append(path, fptr->pathv);
}
- rb_syserr_fail_path(e, path);
+ rb_sys_fail_path(path);
}
}
- if (r > 0) rb_io_check_closed(fptr);
fptr->rbuf.off = 0;
fptr->rbuf.len = (int)r; /* r should be <= rbuf_capa */
if (r == 0)
@@ -1926,8 +1845,10 @@ rb_io_fsync(VALUE io)
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
+# ifndef _WIN32 /* already called in io_fflush() */
if ((int)rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd) < 0)
rb_sys_fail_path(fptr->pathv);
+# endif
return INT2FIX(0);
}
#else
@@ -1947,10 +1868,6 @@ nogvl_fdatasync(void *ptr)
{
rb_io_t *fptr = ptr;
-#ifdef _WIN32
- if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) != FILE_TYPE_DISK)
- return 0;
-#endif
return (VALUE)fdatasync(fptr->fd);
}
@@ -2001,10 +1918,10 @@ rb_io_fdatasync(VALUE io)
static VALUE
rb_io_fileno(VALUE io)
{
- rb_io_t *fptr = RFILE(io)->fptr;
+ rb_io_t *fptr;
int fd;
- rb_io_check_closed(fptr);
+ GetOpenFile(io, fptr);
fd = fptr->fd;
return INT2FIX(fd);
}
@@ -2056,7 +1973,7 @@ rb_io_inspect(VALUE obj)
VALUE result;
static const char closed[] = " (closed)";
- fptr = RFILE(obj)->fptr;
+ fptr = RFILE(rb_io_taint_check(obj))->fptr;
if (!fptr) return rb_any_to_s(obj);
result = rb_str_new_cstr("#<");
rb_str_append(result, rb_class_name(CLASS_OF(obj)));
@@ -2080,7 +1997,7 @@ rb_io_inspect(VALUE obj)
/*
* call-seq:
- * ios.to_io -> ios
+ * ios.to_io -> ios
*
* Returns <em>ios</em>.
*/
@@ -2185,6 +2102,8 @@ rb_io_bufread(VALUE io, void *buf, size_t size)
return (ssize_t)io_bufread(buf, (long)size, fptr);
}
+#define SMALLBUF 100
+
static long
remain_size(rb_io_t *fptr)
{
@@ -2193,7 +2112,7 @@ remain_size(rb_io_t *fptr)
off_t pos;
if (fstat(fptr->fd, &st) == 0 && S_ISREG(st.st_mode)
-#if defined(__HAIKU__)
+#if defined(__BEOS__) || defined(__HAIKU__)
&& (st.st_dev > 3)
#endif
)
@@ -2375,7 +2294,10 @@ io_setstrbuf(VALUE *str, long len)
VALUE s = StringValue(*str);
long clen = RSTRING_LEN(s);
if (clen >= len) {
- rb_str_modify(s);
+ if (clen != len) {
+ rb_str_modify(s);
+ rb_str_set_len(s, len);
+ }
return;
}
len -= clen;
@@ -2402,27 +2324,23 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
int cr;
if (NEED_READCONV(fptr)) {
- int first = !NIL_P(str);
SET_BINARY_MODE(fptr);
io_setstrbuf(&str,0);
make_readconv(fptr, 0);
while (1) {
VALUE v;
if (fptr->cbuf.len) {
- if (first) rb_str_set_len(str, first = 0);
io_shift_cbuf(fptr, fptr->cbuf.len, &str);
}
v = fill_cbuf(fptr, 0);
if (v != MORE_CHAR_SUSPENDED && v != MORE_CHAR_FINISHED) {
if (fptr->cbuf.len) {
- if (first) rb_str_set_len(str, first = 0);
io_shift_cbuf(fptr, fptr->cbuf.len, &str);
}
rb_exc_raise(v);
}
if (v == MORE_CHAR_FINISHED) {
clear_readconv(fptr);
- if (first) rb_str_set_len(str, first = 0);
return io_enc_str(str, fptr);
}
}
@@ -2460,11 +2378,6 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
void
rb_io_set_nonblock(rb_io_t *fptr)
{
-#ifdef _WIN32
- if (rb_w32_set_nonblock(fptr->fd) != 0) {
- rb_sys_fail_path(fptr->pathv);
- }
-#else
int oflags;
#ifdef F_GETFL
oflags = fcntl(fptr->fd, F_GETFL);
@@ -2480,9 +2393,11 @@ rb_io_set_nonblock(rb_io_t *fptr)
rb_sys_fail_path(fptr->pathv);
}
}
-#endif
}
+void
+rb_readwrite_sys_fail(int writable, const char *mesg);
+
struct read_internal_arg {
int fd;
char *str_ptr;
@@ -2497,25 +2412,15 @@ read_internal_call(VALUE arg)
return Qundef;
}
-static int
-no_exception_p(VALUE opts)
-{
- VALUE except;
- ID id = id_exception;
-
- rb_get_kwargs(opts, &id, 0, 1, &except);
- return except == Qfalse;
-}
-
static VALUE
-io_getpartial(int argc, VALUE *argv, VALUE io, VALUE opts, int nonblock)
+io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock, int no_exception)
{
rb_io_t *fptr;
VALUE length, str;
long n, len;
struct read_internal_arg arg;
- rb_scan_args(argc, argv, "11", &length, &str);
+ rb_scan_args(argc, argv, "11:", &length, &str, NULL);
if ((len = NUM2LONG(length)) < 0) {
rb_raise(rb_eArgError, "negative length %ld given", len);
@@ -2545,17 +2450,15 @@ io_getpartial(int argc, VALUE *argv, VALUE io, VALUE opts, int nonblock)
rb_str_locktmp_ensure(str, read_internal_call, (VALUE)&arg);
n = arg.len;
if (n < 0) {
- int e = errno;
if (!nonblock && rb_io_wait_readable(fptr->fd))
goto again;
- if (nonblock && (e == EWOULDBLOCK || e == EAGAIN)) {
- if (no_exception_p(opts))
- return sym_wait_readable;
+ if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN)) {
+ if (no_exception)
+ return ID2SYM(rb_intern("wait_readable"));
else
- rb_readwrite_syserr_fail(RB_IO_WAIT_READABLE,
- e, "read would block");
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "read would block");
}
- rb_syserr_fail_path(e, fptr->pathv);
+ rb_sys_fail_path(fptr->pathv);
}
}
io_set_read_length(str, n);
@@ -2574,12 +2477,10 @@ io_getpartial(int argc, VALUE *argv, VALUE io, VALUE opts, int nonblock)
* Reads at most <i>maxlen</i> bytes from the I/O stream.
* It blocks only if <em>ios</em> has no data immediately available.
* It doesn't block if some data available.
- *
- * If the optional _outbuf_ argument is present,
+ * If the optional <i>outbuf</i> argument is present,
* it must reference a String, which will receive the data.
- * The _outbuf_ will contain only the received data after the method call
+ * The <i>outbuf</i> will contain only the received data after the method call
* even if it is not empty at the beginning.
- *
* It raises <code>EOFError</code> on end of file.
*
* readpartial is designed for streams such as pipe, socket, tty, etc.
@@ -2622,7 +2523,7 @@ io_getpartial(int argc, VALUE *argv, VALUE io, VALUE opts, int nonblock)
* * If the byte buffer is not empty, read from the byte buffer instead of "sysread for buffered IO (IOError)".
* * It doesn't cause Errno::EWOULDBLOCK and Errno::EINTR. When readpartial meets EWOULDBLOCK and EINTR by read system call, readpartial retry the system call.
*
- * The latter means that readpartial is nonblocking-flag insensitive.
+ * The later means that readpartial is nonblocking-flag insensitive.
* It blocks on the situation IO#sysread causes Errno::EWOULDBLOCK as if the fd is blocking mode.
*
*/
@@ -2632,73 +2533,88 @@ io_readpartial(int argc, VALUE *argv, VALUE io)
{
VALUE ret;
- ret = io_getpartial(argc, argv, io, Qnil, 0);
+ ret = io_getpartial(argc, argv, io, 0, 0);
if (NIL_P(ret))
rb_eof_error();
return ret;
}
-static VALUE
-io_nonblock_eof(VALUE opts)
-{
- if (!no_exception_p(opts)) {
- rb_eof_error();
- }
- return Qnil;
-}
+/*
+ * call-seq:
+ * ios.read_nonblock(maxlen) -> string
+ * ios.read_nonblock(maxlen, outbuf) -> outbuf
+ *
+ * Reads at most <i>maxlen</i> bytes from <em>ios</em> using
+ * the read(2) system call after O_NONBLOCK is set for
+ * the underlying file descriptor.
+ *
+ * If the optional <i>outbuf</i> argument is present,
+ * it must reference a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
+ * even if it is not empty at the beginning.
+ *
+ * read_nonblock just calls the read(2) system call.
+ * It causes all errors the read(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc.
+ * The caller should care such errors.
+ *
+ * If the exception is Errno::EWOULDBLOCK or Errno::AGAIN,
+ * it is extended by IO::WaitReadable.
+ * So IO::WaitReadable can be used to rescue the exceptions for retrying read_nonblock.
+ *
+ * read_nonblock causes EOFError on EOF.
+ *
+ * If the read byte buffer is not empty,
+ * read_nonblock reads from the buffer like readpartial.
+ * In this case, the read(2) system call is not called.
+ *
+ * When read_nonblock raises an exception kind of IO::WaitReadable,
+ * read_nonblock should not be called
+ * until io is readable for avoiding busy loop.
+ * This can be done as follows.
+ *
+ * # emulates blocking read (readpartial).
+ * begin
+ * result = io.read_nonblock(maxlen)
+ * rescue IO::WaitReadable
+ * IO.select([io])
+ * retry
+ * end
+ *
+ * Although IO#read_nonblock doesn't raise IO::WaitWritable.
+ * OpenSSL::Buffering#read_nonblock can raise IO::WaitWritable.
+ * If IO and SSL should be used polymorphically,
+ * IO::WaitWritable should be rescued too.
+ * See the document of OpenSSL::Buffering#read_nonblock for sample code.
+ *
+ * Note that this method is identical to readpartial
+ * except the non-blocking flag is set.
+ */
-/* :nodoc: */
static VALUE
-io_read_nonblock(VALUE io, VALUE length, VALUE str, VALUE ex)
+io_read_nonblock(int argc, VALUE *argv, VALUE io)
{
- rb_io_t *fptr;
- long n, len;
- struct read_internal_arg arg;
-
- if ((len = NUM2LONG(length)) < 0) {
- rb_raise(rb_eArgError, "negative length %ld given", len);
- }
+ VALUE ret;
+ VALUE opts = Qnil;
+ int no_exception = 0;
- io_setstrbuf(&str,len);
- OBJ_TAINT(str);
- GetOpenFile(io, fptr);
- rb_io_check_byte_readable(fptr);
+ rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
- if (len == 0)
- return str;
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exception = 1;
- n = read_buffered_data(RSTRING_PTR(str), len, fptr);
- if (n <= 0) {
- rb_io_set_nonblock(fptr);
- io_setstrbuf(&str, len);
- arg.fd = fptr->fd;
- arg.str_ptr = RSTRING_PTR(str);
- arg.len = len;
- rb_str_locktmp_ensure(str, read_internal_call, (VALUE)&arg);
- n = arg.len;
- if (n < 0) {
- int e = errno;
- if ((e == EWOULDBLOCK || e == EAGAIN)) {
- if (ex == Qfalse) return sym_wait_readable;
- rb_readwrite_syserr_fail(RB_IO_WAIT_READABLE,
- e, "read would block");
- }
- rb_syserr_fail_path(e, fptr->pathv);
- }
- }
- io_set_read_length(str, n);
+ ret = io_getpartial(argc, argv, io, 1, no_exception);
- if (n == 0) {
- if (ex == Qfalse) return Qnil;
- rb_eof_error();
+ if (NIL_P(ret)) {
+ if (no_exception)
+ return Qnil;
+ else
+ rb_eof_error();
}
-
- return str;
+ return ret;
}
-/* :nodoc: */
static VALUE
-io_write_nonblock(VALUE io, VALUE str, VALUE ex)
+io_write_nonblock(VALUE io, VALUE str, int no_exception)
{
rb_io_t *fptr;
long n;
@@ -2717,16 +2633,14 @@ io_write_nonblock(VALUE io, VALUE str, VALUE ex)
n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
if (n == -1) {
- int e = errno;
- if (e == EWOULDBLOCK || e == EAGAIN) {
- if (ex == Qfalse) {
- return sym_wait_writable;
- }
- else {
- rb_readwrite_syserr_fail(RB_IO_WAIT_WRITABLE, e, "write would block");
+ if (errno == EWOULDBLOCK || errno == EAGAIN) {
+ if (no_exception) {
+ return ID2SYM(rb_intern("wait_writable"));
+ } else {
+ rb_readwrite_sys_fail(RB_IO_WAIT_WRITABLE, "write would block");
}
}
- rb_syserr_fail_path(e, fptr->pathv);
+ rb_sys_fail_path(fptr->pathv);
}
return LONG2FIX(n);
@@ -2734,69 +2648,141 @@ io_write_nonblock(VALUE io, VALUE str, VALUE ex)
/*
* call-seq:
+ * ios.write_nonblock(string) -> integer
+ * ios.write_nonblock(string [, options]) -> integer
+ *
+ * Writes the given string to <em>ios</em> using
+ * the write(2) system call after O_NONBLOCK is set for
+ * the underlying file descriptor.
+ *
+ * It returns the number of bytes written.
+ *
+ * write_nonblock just calls the write(2) system call.
+ * It causes all errors the write(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc.
+ * The result may also be smaller than string.length (partial write).
+ * The caller should care such errors and partial write.
+ *
+ * If the exception is Errno::EWOULDBLOCK or Errno::AGAIN,
+ * it is extended by IO::WaitWritable.
+ * So IO::WaitWritable can be used to rescue the exceptions for retrying write_nonblock.
+ *
+ * # Creates a pipe.
+ * r, w = IO.pipe
+ *
+ * # write_nonblock writes only 65536 bytes and return 65536.
+ * # (The pipe size is 65536 bytes on this environment.)
+ * s = "a" * 100000
+ * p w.write_nonblock(s) #=> 65536
+ *
+ * # write_nonblock cannot write a byte and raise EWOULDBLOCK (EAGAIN).
+ * p w.write_nonblock("b") # Resource temporarily unavailable (Errno::EAGAIN)
+ *
+ * If the write buffer is not empty, it is flushed at first.
+ *
+ * When write_nonblock raises an exception kind of IO::WaitWritable,
+ * write_nonblock should not be called
+ * until io is writable for avoiding busy loop.
+ * This can be done as follows.
+ *
+ * begin
+ * result = io.write_nonblock(string)
+ * rescue IO::WaitWritable, Errno::EINTR
+ * IO.select(nil, [io])
+ * retry
+ * end
+ *
+ * Note that this doesn't guarantee to write all data in string.
+ * The length written is reported as result and it should be checked later.
+ *
+ * On some platforms such as Windows, write_nonblock is not supported
+ * according to the kind of the IO object.
+ * In such cases, write_nonblock raises <code>Errno::EBADF</code>.
+ *
+ * By specifying `exception: false`, the options hash allows you to indicate
+ * that write_nonblock should not raise an IO::WaitWritable exception, but
+ * return the symbol :wait_writable instead.
+ *
+ */
+
+static VALUE
+rb_io_write_nonblock(int argc, VALUE *argv, VALUE io)
+{
+ VALUE str;
+ VALUE opts = Qnil;
+ int no_exceptions = 0;
+
+ rb_scan_args(argc, argv, "10:", &str, &opts);
+
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exceptions = 1;
+
+ return io_write_nonblock(io, str, no_exceptions);
+}
+
+/*
+ * call-seq:
* ios.read([length [, outbuf]]) -> string, outbuf, or nil
*
- * Reads _length_ bytes from the I/O stream.
+ * Reads <i>length</i> bytes from the I/O stream.
*
- * _length_ must be a non-negative integer or +nil+.
+ * <i>length</i> must be a non-negative integer or <code>nil</code>.
*
- * If _length_ is a positive integer, +read+ tries to read
- * _length_ bytes without any conversion (binary mode).
- * It returns +nil+ if an EOF is encountered before anything can be read.
- * Fewer than _length_ bytes are returned if an EOF is encountered during
- * the read.
- * In the case of an integer _length_, the resulting string is always
- * in ASCII-8BIT encoding.
+ * If <i>length</i> is a positive integer,
+ * it try to read <i>length</i> bytes without any conversion (binary mode).
+ * It returns <code>nil</code> or a string whose length is 1 to <i>length</i> bytes.
+ * <code>nil</code> means it met EOF at beginning.
+ * The 1 to <i>length</i>-1 bytes string means it met EOF after reading the result.
+ * The <i>length</i> bytes string means it doesn't meet EOF.
+ * The resulted string is always ASCII-8BIT encoding.
*
- * If _length_ is omitted or is +nil+, it reads until EOF
- * and the encoding conversion is applied, if applicable.
- * A string is returned even if EOF is encountered before any data is read.
+ * If <i>length</i> is omitted or is <code>nil</code>,
+ * it reads until EOF and the encoding conversion is applied.
+ * It returns a string even if EOF is met at beginning.
*
- * If _length_ is zero, it returns an empty string (<code>""</code>).
+ * If <i>length</i> is zero, it returns <code>""</code>.
*
- * If the optional _outbuf_ argument is present,
- * it must reference a String, which will receive the data.
- * The _outbuf_ will contain only the received data after the method call
+ * If the optional <i>outbuf</i> argument is present, it must reference
+ * a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
* even if it is not empty at the beginning.
*
- * When this method is called at end of file, it returns +nil+
- * or <code>""</code>, depending on _length_:
- * +read+, <code>read(nil)</code>, and <code>read(0)</code> return
- * <code>""</code>,
- * <code>read(<i>positive_integer</i>)</code> returns +nil+.
+ * At end of file, it returns <code>nil</code> or <code>""</code>
+ * depend on <i>length</i>.
+ * <code><i>ios</i>.read()</code> and
+ * <code><i>ios</i>.read(nil)</code> returns <code>""</code>.
+ * <code><i>ios</i>.read(<i>positive-integer</i>)</code> returns <code>nil</code>.
*
* f = File.new("testfile")
* f.read(16) #=> "This is line one"
*
- * # read whole file
- * open("file") do |f|
- * data = f.read # This returns a string even if the file is empty.
- * # ...
- * end
+ * # reads whole file
+ * open("file") {|f|
+ * data = f.read # This returns a string even if the file is empty.
+ * ...
+ * }
*
- * # iterate over fixed length records
- * open("fixed-record-file") do |f|
+ * # iterate over fixed length records.
+ * open("fixed-record-file") {|f|
* while record = f.read(256)
- * # ...
+ * ...
* end
- * end
+ * }
*
- * # iterate over variable length records,
- * # each record is prefixed by its 32-bit length
- * open("variable-record-file") do |f|
+ * # iterate over variable length records.
+ * # record is prefixed by 32-bit length.
+ * open("variable-record-file") {|f|
* while len = f.read(4)
- * len = len.unpack("N")[0] # 32-bit length
- * record = f.read(len) # This returns a string even if len is 0.
+ * len = len.unpack("N")[0] # 32-bit length
+ * record = f.read(len) # This returns a string even if len is 0.
* end
- * end
+ * }
*
- * Note that this method behaves like the fread() function in C.
- * This means it retries to invoke read(2) system calls to read data
- * with the specified length (or until EOF).
- * This behavior is preserved even if <i>ios</i> is in non-blocking mode.
+ * Note that this method behaves like fread() function in C.
+ * This means it retry to invoke read(2) system call to read data with the specified length (or until EOF).
+ * This behavior is preserved even if <i>ios</i> is non-blocking mode.
* (This method is non-blocking flag insensitive as other methods.)
- * If you need the behavior like a single read(2) system call,
- * consider #readpartial, #read_nonblock, and #sysread.
+ * If you need the behavior like single read(2) system call,
+ * consider readpartial, read_nonblock and sysread.
*/
static VALUE
@@ -2825,10 +2811,7 @@ io_read(int argc, VALUE *argv, VALUE io)
GetOpenFile(io, fptr);
rb_io_check_byte_readable(fptr);
- if (len == 0) {
- io_set_read_length(str, 0);
- return str;
- }
+ if (len == 0) return str;
READ_CHECK(fptr);
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
@@ -3043,7 +3026,6 @@ prepare_getline_args(int argc, VALUE *argv, VALUE *rsp, long *limit, VALUE io)
VALUE rs = rb_rs, lim = Qnil;
rb_io_t *fptr;
- rb_check_arity(argc, 0, 2);
if (argc == 1) {
VALUE tmp = Qnil;
@@ -3055,7 +3037,7 @@ prepare_getline_args(int argc, VALUE *argv, VALUE *rsp, long *limit, VALUE io)
}
}
else if (2 <= argc) {
- rs = argv[0], lim = argv[1];
+ rb_scan_args(argc, argv, "2", &rs, &lim);
if (!NIL_P(rs))
StringValue(rs);
}
@@ -3137,7 +3119,7 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
newline = (unsigned char)rsptr[rslen - 1];
}
- /* MS - Optimization */
+ /* MS - Optimisation */
while ((c = appendline(fptr, newline, &str, &limit)) != EOF) {
const char *s, *p, *pp, *e;
@@ -3212,30 +3194,18 @@ rb_io_gets(VALUE io)
* ios.gets(sep, limit) -> string or nil
*
* Reads the next ``line'' from the I/O stream; lines are separated by
- * <i>sep</i>. A separator of +nil+ reads the entire
+ * <i>sep</i>. A separator of <code>nil</code> reads the entire
* contents, and a zero-length separator reads the input a paragraph at
* a time (two successive newlines in the input separate paragraphs).
* The stream must be opened for reading or an <code>IOError</code>
* will be raised. The line read in will be returned and also assigned
- * to <code>$_</code>. Returns +nil+ if called at end of
+ * to <code>$_</code>. Returns <code>nil</code> if called at end of
* file. If the first argument is an integer, or optional second
* argument is given, the returning string would not be longer than the
* given value in bytes.
*
* File.new("testfile").gets #=> "This is line one\n"
* $_ #=> "This is line one\n"
- *
- * File.new("testfile").gets(4)#=> "This"
- *
- * If IO contains multibyte characters byte then <code>gets(1)</code>
- * returns character entirely:
- *
- * # Russian characters take 2 bytes
- * File.write("testfile", "\u{442 435 441 442}")
- * File.open("testfile") {|f|f.gets(1)} #=> "\u0442"
- * File.open("testfile") {|f|f.gets(2)} #=> "\u0442"
- * File.open("testfile") {|f|f.gets(3)} #=> "\u0442\u0435"
- * File.open("testfile") {|f|f.gets(4)} #=> "\u0442\u0435"
*/
static VALUE
@@ -3338,7 +3308,7 @@ rb_io_readline(int argc, VALUE *argv, VALUE io)
*
* Reads all of the lines in <em>ios</em>, and returns them in
* <i>anArray</i>. Lines are separated by the optional <i>sep</i>. If
- * <i>sep</i> is +nil+, the rest of the stream is returned
+ * <i>sep</i> is <code>nil</code>, the rest of the stream is returned
* as a single record. If the first argument is an integer, or
* optional second argument is given, the returning string would not be
* longer than the given value in bytes. The stream must be opened for
@@ -3366,15 +3336,15 @@ rb_io_readlines(int argc, VALUE *argv, VALUE io)
/*
* call-seq:
- * ios.each(sep=$/) {|line| block } -> ios
- * ios.each(limit) {|line| block } -> ios
- * ios.each(sep, limit) {|line| block } -> ios
- * ios.each(...) -> an_enumerator
+ * ios.each(sep=$/) {|line| block } -> ios
+ * ios.each(limit) {|line| block } -> ios
+ * ios.each(sep,limit) {|line| block } -> ios
+ * ios.each(...) -> an_enumerator
*
- * ios.each_line(sep=$/) {|line| block } -> ios
- * ios.each_line(limit) {|line| block } -> ios
- * ios.each_line(sep, limit) {|line| block } -> ios
- * ios.each_line(...) -> an_enumerator
+ * ios.each_line(sep=$/) {|line| block } -> ios
+ * ios.each_line(limit) {|line| block } -> ios
+ * ios.each_line(sep,limit) {|line| block } -> ios
+ * ios.each_line(...) -> an_enumerator
*
* Executes the block for every line in <em>ios</em>, where lines are
* separated by <i>sep</i>. <em>ios</em> must be opened for
@@ -3658,7 +3628,6 @@ rb_io_each_codepoint(VALUE io)
READ_CHECK(fptr);
if (NEED_READCONV(fptr)) {
SET_BINARY_MODE(fptr);
- r = 1; /* no invalid char yet */
for (;;) {
make_readconv(fptr, 0);
for (;;) {
@@ -3677,16 +3646,13 @@ rb_io_each_codepoint(VALUE io)
}
if (more_char(fptr) == MORE_CHAR_FINISHED) {
clear_readconv(fptr);
- if (!MBCLEN_CHARFOUND_P(r)) {
- enc = fptr->encs.enc;
- goto invalid;
- }
+ /* ignore an incomplete character before EOF */
return io;
}
}
if (MBCLEN_INVALID_P(r)) {
- enc = fptr->encs.enc;
- goto invalid;
+ rb_raise(rb_eArgError, "invalid byte sequence in %s",
+ rb_enc_name(fptr->encs.enc));
}
n = MBCLEN_CHARFOUND_LEN(r);
if (fptr->encs.enc) {
@@ -3716,25 +3682,8 @@ rb_io_each_codepoint(VALUE io)
rb_yield(UINT2NUM(c));
}
else if (MBCLEN_INVALID_P(r)) {
- invalid:
rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(enc));
}
- else if (MBCLEN_NEEDMORE_P(r)) {
- char cbuf[8], *p = cbuf;
- int more = MBCLEN_NEEDMORE_LEN(r);
- if (more > numberof(cbuf)) goto invalid;
- more += n = fptr->rbuf.len;
- if (more > numberof(cbuf)) goto invalid;
- while ((n = (int)read_buffered_data(p, more, fptr)) > 0 &&
- (p += n, (more -= n) > 0)) {
- if (io_fillbuf(fptr) < 0) goto invalid;
- if ((n = fptr->rbuf.len) > more) n = more;
- }
- r = rb_enc_precise_mbclen(cbuf, p, enc);
- if (!MBCLEN_CHARFOUND_P(r)) goto invalid;
- c = rb_enc_codepoint(cbuf, p, enc);
- rb_yield(UINT2NUM(c));
- }
else {
continue;
}
@@ -3761,7 +3710,7 @@ rb_io_codepoints(VALUE io)
* ios.getc -> string or nil
*
* Reads a one-character string from <em>ios</em>. Returns
- * +nil+ if called at end of file.
+ * <code>nil</code> if called at end of file.
*
* f = File.new("testfile")
* f.getc #=> "h"
@@ -3810,7 +3759,7 @@ rb_io_readchar(VALUE io)
* ios.getbyte -> fixnum or nil
*
* Gets the next 8-bit byte (0..255) from <em>ios</em>. Returns
- * +nil+ if called at end of file.
+ * <code>nil</code> if called at end of file.
*
* f = File.new("testfile")
* f.getbyte #=> 84
@@ -3864,7 +3813,7 @@ rb_io_readbyte(VALUE io)
/*
* call-seq:
* ios.ungetbyte(string) -> nil
- * ios.ungetbyte(integer) -> nil
+ * ios.ungetbyte(integer) -> nil
*
* Pushes back bytes (passed as a parameter) onto <em>ios</em>,
* such that a subsequent buffered read will return it. Only one byte
@@ -4113,7 +4062,7 @@ finish_writeconv(rb_io_t *fptr, int noalloc)
}
if (rb_io_wait_writable(fptr->fd)) {
if (fptr->fd < 0)
- return noalloc ? Qtrue : rb_exc_new3(rb_eIOError, rb_str_new_cstr(closed_stream));
+ return noalloc ? Qtrue : rb_exc_new3(rb_eIOError, rb_str_new_cstr("closed stream"));
goto retry;
}
return noalloc ? Qtrue : INT2NUM(errno);
@@ -4198,16 +4147,12 @@ maygvl_fclose(FILE *file, int keepgvl)
return (int)(intptr_t)rb_thread_call_without_gvl(nogvl_fclose, file, RUBY_UBF_IO, 0);
}
-static void free_io_buffer(rb_io_buffer_t *buf);
-static void clear_codeconv(rb_io_t *fptr);
-
static void
-fptr_finalize_flush(rb_io_t *fptr, int noraise)
+fptr_finalize(rb_io_t *fptr, int noraise)
{
VALUE err = Qnil;
int fd = fptr->fd;
FILE *stdio_file = fptr->stdio_file;
- int mode = fptr->mode;
if (fptr->writeconv) {
if (fptr->write_lock && !noraise) {
@@ -4248,11 +4193,7 @@ fptr_finalize_flush(rb_io_t *fptr, int noraise)
/* fptr->fd may be closed even if close fails.
* POSIX doesn't specify it.
* We assumes it is closed. */
-
- /**/
- int keepgvl = !(mode & FMODE_WRITABLE);
- keepgvl |= noraise;
- if ((maygvl_close(fd, keepgvl) < 0) && NIL_P(err))
+ if ((maygvl_close(fd, noraise) < 0) && NIL_P(err))
err = noraise ? Qtrue : INT2NUM(errno);
}
@@ -4260,7 +4201,8 @@ fptr_finalize_flush(rb_io_t *fptr, int noraise)
switch (TYPE(err)) {
case T_FIXNUM:
case T_BIGNUM:
- rb_syserr_fail_path(NUM2INT(err), fptr->pathv);
+ errno = NUM2INT(err);
+ rb_sys_fail_path(fptr->pathv);
default:
rb_exc_raise(err);
@@ -4269,15 +4211,6 @@ fptr_finalize_flush(rb_io_t *fptr, int noraise)
}
static void
-fptr_finalize(rb_io_t *fptr, int noraise)
-{
- fptr_finalize_flush(fptr, noraise);
- free_io_buffer(&fptr->rbuf);
- free_io_buffer(&fptr->wbuf);
- clear_codeconv(fptr);
-}
-
-static void
rb_io_fptr_cleanup(rb_io_t *fptr, int noraise)
{
if (fptr->finalize) {
@@ -4289,22 +4222,16 @@ rb_io_fptr_cleanup(rb_io_t *fptr, int noraise)
}
static void
-free_io_buffer(rb_io_buffer_t *buf)
-{
- if (buf->ptr) {
- ruby_sized_xfree(buf->ptr, (size_t)buf->capa);
- buf->ptr = NULL;
- }
-}
-
-static void
clear_readconv(rb_io_t *fptr)
{
if (fptr->readconv) {
rb_econv_close(fptr->readconv);
fptr->readconv = NULL;
}
- free_io_buffer(&fptr->cbuf);
+ if (fptr->cbuf.ptr) {
+ free(fptr->cbuf.ptr);
+ fptr->cbuf.ptr = NULL;
+ }
}
static void
@@ -4332,13 +4259,21 @@ rb_io_fptr_finalize(rb_io_t *fptr)
if (0 <= fptr->fd)
rb_io_fptr_cleanup(fptr, TRUE);
fptr->write_lock = 0;
- free_io_buffer(&fptr->rbuf);
- free_io_buffer(&fptr->wbuf);
+ if (fptr->rbuf.ptr) {
+ free(fptr->rbuf.ptr);
+ fptr->rbuf.ptr = 0;
+ }
+ if (fptr->wbuf.ptr) {
+ free(fptr->wbuf.ptr);
+ fptr->wbuf.ptr = 0;
+ }
clear_codeconv(fptr);
free(fptr);
return 1;
}
+size_t rb_econv_memsize(rb_econv_t *);
+
RUBY_FUNC_EXPORTED size_t
rb_io_memsize(const rb_io_t *fptr)
{
@@ -4351,15 +4286,13 @@ rb_io_memsize(const rb_io_t *fptr)
return size;
}
-int rb_notify_fd_close(int fd);
-static rb_io_t *
-io_close_fptr(VALUE io)
+VALUE
+rb_io_close(VALUE io)
{
rb_io_t *fptr;
int fd;
VALUE write_io;
rb_io_t *write_fptr;
- int busy;
write_io = GetWriteIO(io);
if (io != write_io) {
@@ -4370,35 +4303,19 @@ io_close_fptr(VALUE io)
}
fptr = RFILE(io)->fptr;
- if (!fptr) return 0;
- if (fptr->fd < 0) return 0;
+ if (!fptr) return Qnil;
+ if (fptr->fd < 0) return Qnil;
fd = fptr->fd;
- busy = rb_notify_fd_close(fd);
- fptr_finalize_flush(fptr, FALSE);
- if (busy) {
- do rb_thread_schedule(); while (rb_notify_fd_close(fd));
- }
+ rb_thread_fd_close(fd);
rb_io_fptr_cleanup(fptr, FALSE);
- return fptr;
-}
-static void
-fptr_waitpid(rb_io_t *fptr, int nohang)
-{
- int status;
if (fptr->pid) {
- rb_last_status_clear();
- rb_waitpid(fptr->pid, &status, nohang ? WNOHANG : 0);
+ rb_last_status_clear();
+ rb_syswait(fptr->pid);
fptr->pid = 0;
}
-}
-VALUE
-rb_io_close(VALUE io)
-{
- rb_io_t *fptr = io_close_fptr(io);
- if (fptr) fptr_waitpid(fptr, 0);
return Qnil;
}
@@ -4414,17 +4331,12 @@ rb_io_close(VALUE io)
*
* If <em>ios</em> is opened by <code>IO.popen</code>,
* <code>close</code> sets <code>$?</code>.
- *
- * Calling this method on closed IO object is just ignored since Ruby 2.3.
*/
static VALUE
rb_io_close_m(VALUE io)
{
- rb_io_t *fptr = rb_io_get_fptr(io);
- if (fptr->fd < 0) {
- return Qnil;
- }
+ rb_io_check_closed(RFILE(io)->fptr);
rb_io_close(io);
return Qnil;
}
@@ -4432,31 +4344,13 @@ rb_io_close_m(VALUE io)
static VALUE
io_call_close(VALUE io)
{
- rb_check_funcall(io, rb_intern("close"), 0, 0);
- return io;
-}
-
-static VALUE
-ignore_closed_stream(VALUE io, VALUE exc)
-{
- enum {mesg_len = sizeof(closed_stream)-1};
- VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
- if (!RB_TYPE_P(mesg, T_STRING) ||
- RSTRING_LEN(mesg) != mesg_len ||
- memcmp(RSTRING_PTR(mesg), closed_stream, mesg_len)) {
- rb_exc_raise(exc);
- }
- return io;
+ return rb_funcall(io, rb_intern("close"), 0, 0);
}
static VALUE
io_close(VALUE io)
{
- VALUE closed = rb_check_funcall(io, rb_intern("closed?"), 0, 0);
- if (closed != Qundef && RTEST(closed)) return io;
- rb_rescue2(io_call_close, io, ignore_closed_stream, io,
- rb_eIOError, (VALUE)0);
- return io;
+ return rb_rescue(io_call_close, io, 0, 0);
}
/*
@@ -4493,7 +4387,8 @@ rb_io_closed(VALUE io)
}
}
- fptr = rb_io_get_fptr(io);
+ fptr = RFILE(io)->fptr;
+ rb_io_check_initialized(fptr);
return 0 <= fptr->fd ? Qfalse : Qtrue;
}
@@ -4521,8 +4416,7 @@ rb_io_close_read(VALUE io)
rb_io_t *fptr;
VALUE write_io;
- fptr = rb_io_get_fptr(rb_io_taint_check(io));
- if (fptr->fd < 0) return Qnil;
+ GetOpenFile(io, fptr);
if (is_socket(fptr->fd, fptr->pathv)) {
#ifndef SHUT_RD
# define SHUT_RD 0
@@ -4538,19 +4432,20 @@ rb_io_close_read(VALUE io)
write_io = GetWriteIO(io);
if (io != write_io) {
rb_io_t *wfptr;
- wfptr = rb_io_get_fptr(rb_io_taint_check(write_io));
+ GetOpenFile(write_io, wfptr);
wfptr->pid = fptr->pid;
fptr->pid = 0;
RFILE(io)->fptr = wfptr;
/* bind to write_io temporarily to get rid of memory/fd leak */
fptr->tied_io_for_writing = 0;
+ fptr->mode &= ~FMODE_DUPLEX;
RFILE(write_io)->fptr = fptr;
rb_io_fptr_cleanup(fptr, FALSE);
/* should not finalize fptr because another thread may be reading it */
return Qnil;
}
- if ((fptr->mode & (FMODE_DUPLEX|FMODE_WRITABLE)) == FMODE_WRITABLE) {
+ if (fptr->mode & FMODE_WRITABLE) {
rb_raise(rb_eIOError, "closing non-duplex IO for reading");
}
return rb_io_close(io);
@@ -4582,8 +4477,7 @@ rb_io_close_write(VALUE io)
VALUE write_io;
write_io = GetWriteIO(io);
- fptr = rb_io_get_fptr(rb_io_taint_check(write_io));
- if (fptr->fd < 0) return Qnil;
+ GetOpenFile(write_io, fptr);
if (is_socket(fptr->fd, fptr->pathv)) {
#ifndef SHUT_WR
# define SHUT_WR 1
@@ -4596,13 +4490,14 @@ rb_io_close_write(VALUE io)
return Qnil;
}
- if ((fptr->mode & (FMODE_DUPLEX|FMODE_READABLE)) == FMODE_READABLE) {
+ if (fptr->mode & FMODE_READABLE) {
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
if (io != write_io) {
- fptr = rb_io_get_fptr(rb_io_taint_check(io));
+ GetOpenFile(io, fptr);
fptr->tied_io_for_writing = 0;
+ fptr->mode &= ~FMODE_DUPLEX;
}
rb_io_close(write_io);
return Qnil;
@@ -4681,7 +4576,6 @@ rb_io_syswrite(VALUE io, VALUE str)
}
n = rb_write_internal(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
- RB_GC_GUARD(str);
if (n == -1) rb_sys_fail_path(fptr->pathv);
@@ -4695,12 +4589,10 @@ rb_io_syswrite(VALUE io, VALUE str)
* Reads <i>maxlen</i> bytes from <em>ios</em> using a low-level
* read and returns them as a string. Do not mix with other methods
* that read from <em>ios</em> or you may get unpredictable results.
- *
- * If the optional _outbuf_ argument is present,
- * it must reference a String, which will receive the data.
- * The _outbuf_ will contain only the received data after the method call
+ * If the optional <i>outbuf</i> argument is present, it must reference
+ * a String, which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
* even if it is not empty at the beginning.
- *
* Raises <code>SystemCallError</code> on error and
* <code>EOFError</code> at end of file.
*
@@ -4729,6 +4621,8 @@ rb_io_sysread(int argc, VALUE *argv, VALUE io)
rb_raise(rb_eIOError, "sysread for buffered IO");
}
+ n = fptr->fd;
+
/*
* FIXME: removing rb_thread_wait_fd() here changes sysread semantics
* on non-blocking IOs. However, it's still currently possible
@@ -4827,6 +4721,7 @@ rb_io_ascii8bit_binmode(VALUE io)
* - newline conversion disabled
* - encoding conversion disabled
* - content is treated as ASCII-8BIT
+ *
*/
static VALUE
@@ -4880,14 +4775,15 @@ rb_io_fmode_modestr(int fmode)
}
}
-static const char bom_prefix[] = "bom|";
-static const char utf_prefix[] = "utf-";
-enum {bom_prefix_len = (int)sizeof(bom_prefix) - 1};
-enum {utf_prefix_len = (int)sizeof(utf_prefix) - 1};
-
static int
io_encname_bom_p(const char *name, long len)
{
+ static const char bom_prefix[] = "bom|utf-";
+ enum {bom_prefix_len = (int)sizeof(bom_prefix) - 1};
+ if (!len) {
+ const char *p = strchr(name, ':');
+ len = p ? (long)(p - name) : (long)strlen(name);
+ }
return len > bom_prefix_len && STRNCASECMP(name, bom_prefix, bom_prefix_len) == 0;
}
@@ -4926,9 +4822,7 @@ rb_io_modestr_fmode(const char *modestr)
default:
goto error;
case ':':
- p = strchr(m, ':');
- if (io_encname_bom_p(m, p ? (long)(p - m) : (long)strlen(m)))
- fmode |= FMODE_SETENC_BY_BOM;
+ p = m;
goto finished;
}
}
@@ -4936,6 +4830,8 @@ rb_io_modestr_fmode(const char *modestr)
finished:
if ((fmode & FMODE_BINMODE) && (fmode & FMODE_TEXTMODE))
goto error;
+ if (p && io_encname_bom_p(p, 0))
+ fmode |= FMODE_SETENC_BY_BOM;
return fmode;
}
@@ -4945,7 +4841,7 @@ rb_io_oflags_fmode(int oflags)
{
int fmode = 0;
- switch (oflags & O_ACCMODE) {
+ switch (oflags & (O_RDONLY|O_WRONLY|O_RDWR)) {
case O_RDONLY:
fmode = FMODE_READABLE;
break;
@@ -5041,9 +4937,6 @@ rb_io_oflags_modestr(int oflags)
case O_WRONLY:
return MODE_BINARY("w", "wb");
case O_RDWR:
- if (oflags & O_TRUNC) {
- return MODE_BINARY("w+", "wb+");
- }
return MODE_BINARY("r+", "rb+");
}
}
@@ -5082,42 +4975,45 @@ rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc,
}
static void
-unsupported_encoding(const char *name, rb_encoding *enc)
+unsupported_encoding(const char *name)
{
- rb_enc_warn(enc, "Unsupported encoding %s ignored", name);
+ rb_warn("Unsupported encoding %s ignored", name);
}
static void
-parse_mode_enc(const char *estr, rb_encoding *estr_enc,
- rb_encoding **enc_p, rb_encoding **enc2_p, int *fmode_p)
+parse_mode_enc(const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int *fmode_p)
{
const char *p;
char encname[ENCODING_MAXNAMELEN+1];
int idx, idx2;
int fmode = fmode_p ? *fmode_p : 0;
rb_encoding *ext_enc, *int_enc;
- long len;
/* parse estr as "enc" or "enc2:enc" or "enc:-" */
p = strrchr(estr, ':');
- len = p ? (p++ - estr) : (long)strlen(estr);
- if ((fmode & FMODE_SETENC_BY_BOM) || io_encname_bom_p(estr, len)) {
- estr += bom_prefix_len;
- len -= bom_prefix_len;
- if (!STRNCASECMP(estr, utf_prefix, utf_prefix_len)) {
- fmode |= FMODE_SETENC_BY_BOM;
- }
+ if (p) {
+ long len = (p++) - estr;
+ if (len == 0 || len > ENCODING_MAXNAMELEN)
+ idx = -1;
else {
- rb_enc_warn(estr_enc, "BOM with non-UTF encoding %s is nonsense", estr);
- fmode &= ~FMODE_SETENC_BY_BOM;
+ if (io_encname_bom_p(estr, len)) {
+ fmode |= FMODE_SETENC_BY_BOM;
+ estr += 4;
+ len -= 4;
+ }
+ memcpy(encname, estr, len);
+ encname[len] = '\0';
+ estr = encname;
+ idx = rb_enc_find_index(encname);
}
}
- if (len == 0 || len > ENCODING_MAXNAMELEN) {
- idx = -1;
- }
else {
- if (p) {
+ long len = strlen(estr);
+ if (io_encname_bom_p(estr, len)) {
+ fmode |= FMODE_SETENC_BY_BOM;
+ estr += 4;
+ len -= 4;
memcpy(encname, estr, len);
encname[len] = '\0';
estr = encname;
@@ -5130,7 +5026,7 @@ parse_mode_enc(const char *estr, rb_encoding *estr_enc,
ext_enc = rb_enc_from_index(idx);
else {
if (idx != -2)
- unsupported_encoding(estr, estr_enc);
+ unsupported_encoding(estr);
ext_enc = NULL;
}
@@ -5143,7 +5039,7 @@ parse_mode_enc(const char *estr, rb_encoding *estr_enc,
else {
idx2 = rb_enc_find_index(p);
if (idx2 < 0)
- unsupported_encoding(p, estr_enc);
+ unsupported_encoding(p);
else if (!(fmode & FMODE_SETENC_BY_BOM) && (idx2 == idx)) {
int_enc = (rb_encoding *)Qnil;
}
@@ -5175,9 +5071,9 @@ rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding **enc2
if ((extenc != Qundef || intenc != Qundef) && !NIL_P(encoding)) {
if (!NIL_P(ruby_verbose)) {
int idx = rb_to_encoding_index(encoding);
- if (idx >= 0) encoding = rb_enc_from_encoding(rb_enc_from_index(idx));
- rb_warn("Ignoring encoding parameter '%"PRIsVALUE"': %s_encoding is used",
- encoding, extenc == Qundef ? "internal" : "external");
+ rb_warn("Ignoring encoding parameter '%s': %s_encoding is used",
+ idx < 0 ? StringValueCStr(encoding) : rb_enc_name(rb_enc_from_index(idx)),
+ extenc == Qundef ? "internal" : "external");
}
encoding = Qnil;
}
@@ -5210,8 +5106,7 @@ rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding **enc2
if (!NIL_P(encoding)) {
extracted = 1;
if (!NIL_P(tmp = rb_check_string_type(encoding))) {
- parse_mode_enc(StringValueCStr(tmp), rb_enc_get(tmp),
- enc_p, enc2_p, fmode_p);
+ parse_mode_enc(StringValueCStr(tmp), enc_p, enc2_p, fmode_p);
}
else {
rb_io_ext_int_to_encs(rb_to_encoding(encoding), NULL, enc_p, enc2_p, 0);
@@ -5316,7 +5211,7 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
p = strchr(p, ':');
if (p) {
has_enc = 1;
- parse_mode_enc(p+1, rb_enc_get(vmode), &enc, &enc2, &fmode);
+ parse_mode_enc(p+1, &enc, &enc2, &fmode);
}
else {
rb_encoding *e;
@@ -5340,24 +5235,6 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
}
else {
VALUE v;
- if (!has_vmode) {
- v = rb_hash_aref(opthash, sym_mode);
- if (!NIL_P(v)) {
- if (!NIL_P(vmode)) {
- rb_raise(rb_eArgError, "mode specified twice");
- }
- has_vmode = 1;
- vmode = v;
- goto vmode_handle;
- }
- }
- v = rb_hash_aref(opthash, sym_flags);
- if (!NIL_P(v)) {
- v = rb_to_int(v);
- oflags |= NUM2INT(v);
- vmode = INT2NUM(oflags);
- fmode = rb_io_oflags_fmode(oflags);
- }
extract_binmode(opthash, &fmode);
if (fmode & FMODE_BINMODE) {
#ifdef O_BINARY
@@ -5371,6 +5248,17 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash,
fmode |= DEFAULT_TEXTMODE;
}
#endif
+ if (!has_vmode) {
+ v = rb_hash_aref(opthash, sym_mode);
+ if (!NIL_P(v)) {
+ if (!NIL_P(vmode)) {
+ rb_raise(rb_eArgError, "mode specified twice");
+ }
+ has_vmode = 1;
+ vmode = v;
+ goto vmode_handle;
+ }
+ }
v = rb_hash_aref(opthash, sym_perm);
if (!NIL_P(v)) {
if (vperm_p) {
@@ -5444,13 +5332,13 @@ rb_sysopen(VALUE fname, int oflags, mode_t perm)
struct sysopen_struct data;
data.fname = rb_str_encode_ospath(fname);
- StringValueCStr(data.fname);
data.oflags = oflags;
data.perm = perm;
fd = rb_sysopen_internal(&data);
if (fd < 0) {
- if (rb_gc_for_fd(errno)) {
+ if (errno == EMFILE || errno == ENFILE) {
+ rb_gc();
fd = rb_sysopen_internal(&data);
}
if (fd < 0) {
@@ -5470,25 +5358,24 @@ rb_fdopen(int fd, const char *modestr)
#endif
file = fdopen(fd, modestr);
if (!file) {
+ if (
#if defined(__sun)
- if (errno == 0) {
+ errno == 0 ||
+#endif
+ errno == EMFILE || errno == ENFILE) {
rb_gc();
+#if defined(__sun)
errno = 0;
- file = fdopen(fd, modestr);
- }
- else
#endif
- if (rb_gc_for_fd(errno)) {
file = fdopen(fd, modestr);
}
if (!file) {
- int e = errno;
#ifdef _WIN32
- if (e == 0) e = EINVAL;
+ if (errno == 0) errno = EINVAL;
#elif defined(__sun)
- if (e == 0) e = EMFILE;
+ if (errno == 0) errno = EMFILE;
#endif
- rb_syserr_fail(e, 0);
+ rb_sys_fail(0);
}
}
@@ -5623,8 +5510,7 @@ rb_file_open_internal(VALUE io, VALUE filename, const char *modestr)
convconfig_t convconfig;
if (p) {
- parse_mode_enc(p+1, rb_usascii_encoding(),
- &convconfig.enc, &convconfig.enc2, &fmode);
+ parse_mode_enc(p+1, &convconfig.enc, &convconfig.enc2, &fmode);
}
else {
rb_encoding *e;
@@ -5656,7 +5542,7 @@ rb_file_open(const char *fname, const char *modestr)
return rb_file_open_internal(io_alloc(rb_cFile), rb_str_new_cstr(fname), modestr);
}
-#if defined(__CYGWIN__) || !defined(HAVE_WORKING_FORK)
+#if defined(__CYGWIN__) || !defined(HAVE_FORK)
static struct pipe_list {
rb_io_t *fptr;
struct pipe_list *next;
@@ -5696,7 +5582,6 @@ pipe_del_fptr(rb_io_t *fptr)
}
}
-#if defined (_WIN32) || defined(__CYGWIN__)
static void
pipe_atexit(void)
{
@@ -5709,12 +5594,11 @@ pipe_atexit(void)
list = tmp;
}
}
-#endif
static void
pipe_finalize(rb_io_t *fptr, int noraise)
{
-#if !defined(HAVE_WORKING_FORK) && !defined(_WIN32)
+#if !defined(HAVE_FORK) && !defined(_WIN32)
int status = 0;
if (fptr->stdio_file) {
status = pclose(fptr->stdio_file);
@@ -5748,7 +5632,8 @@ rb_pipe(int *pipes)
int ret;
ret = rb_cloexec_pipe(pipes);
if (ret == -1) {
- if (rb_gc_for_fd(errno)) {
+ if (errno == EMFILE || errno == ENFILE) {
+ rb_gc();
ret = rb_cloexec_pipe(pipes);
}
}
@@ -5765,7 +5650,7 @@ rb_pipe(int *pipes)
#define spawn(mode, cmd) rb_w32_uspawn((mode), (cmd), 0)
#endif
-#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
struct popen_arg {
VALUE execarg_obj;
struct rb_execarg *eargp;
@@ -5775,7 +5660,7 @@ struct popen_arg {
};
#endif
-#ifdef HAVE_WORKING_FORK
+#ifdef HAVE_FORK
static void
popen_redirect(struct popen_arg *p)
{
@@ -5853,20 +5738,19 @@ linux_get_maxfd(void)
void
rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
{
-#if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
int fd, ret;
int max = (int)max_file_descriptor;
-# ifdef F_MAXFD
+#ifdef F_MAXFD
/* F_MAXFD is available since NetBSD 2.0. */
ret = fcntl(0, F_MAXFD); /* async-signal-safe */
if (ret != -1)
maxhint = max = ret;
-# elif defined(__linux__)
+#elif defined(__linux__)
ret = linux_get_maxfd();
if (maxhint < ret)
maxhint = ret;
/* maxhint = max = ret; if (ret == -1) abort(); // test */
-# endif
+#endif
if (max < maxhint)
max = maxhint;
for (fd = lowfd; fd <= max; fd++) {
@@ -5877,13 +5761,12 @@ rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
if (ret != -1 && !(ret & FD_CLOEXEC)) {
fcntl(fd, F_SETFD, ret|FD_CLOEXEC); /* async-signal-safe */
}
-# define CONTIGUOUS_CLOSED_FDS 20
+#define CONTIGUOUS_CLOSED_FDS 20
if (ret != -1) {
if (max < fd + CONTIGUOUS_CLOSED_FDS)
max = fd + CONTIGUOUS_CLOSED_FDS;
}
}
-#endif
}
static int
@@ -5895,17 +5778,6 @@ popen_exec(void *pp, char *errmsg, size_t errmsg_len)
}
#endif
-#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
-static VALUE
-rb_execarg_fixup_v(VALUE execarg_obj)
-{
- rb_execarg_parent_start(execarg_obj);
- return Qnil;
-}
-#else
-char *rb_execarg_commandline(const struct rb_execarg *eargp, VALUE *prog);
-#endif
-
static VALUE
pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convconfig)
{
@@ -5916,15 +5788,14 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
VALUE port;
rb_io_t *write_fptr;
VALUE write_port;
-#if defined(HAVE_WORKING_FORK)
+#if defined(HAVE_FORK)
int status;
char errmsg[80] = { '\0' };
#endif
-#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
- int state;
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
struct popen_arg arg;
-#endif
int e = 0;
+#endif
#if defined(HAVE_SPAWNV)
# if defined(HAVE_SPAWNVE)
# define DO_SPAWN(cmd, args, envp) ((args) ? \
@@ -5935,33 +5806,37 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
spawnv(P_NOWAIT, (cmd), (args)) : \
spawn(P_NOWAIT, (cmd)))
# endif
-# if !defined(HAVE_WORKING_FORK)
+# if !defined(HAVE_FORK)
char **args = NULL;
# if defined(HAVE_SPAWNVE)
char **envp = NULL;
# endif
# endif
#endif
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
struct rb_execarg sarg, *sargp = &sarg;
#endif
FILE *fp = 0;
int fd = -1;
int write_fd = -1;
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
const char *cmd = 0;
+#if !defined(HAVE_SPAWNV)
+ int argc;
+ VALUE *argv;
+#endif
if (prog)
cmd = StringValueCStr(prog);
#endif
-#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
arg.execarg_obj = execarg_obj;
arg.eargp = eargp;
arg.modef = fmode;
arg.pair[0] = arg.pair[1] = -1;
arg.write_pair[0] = arg.write_pair[1] = -1;
-# if !defined(HAVE_WORKING_FORK)
+# if !defined(HAVE_FORK)
if (eargp && !eargp->use_shell) {
args = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
}
@@ -5971,10 +5846,11 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
if (rb_pipe(arg.write_pair) < 0)
rb_sys_fail_str(prog);
if (rb_pipe(arg.pair) < 0) {
- e = errno;
+ int e = errno;
close(arg.write_pair[0]);
close(arg.write_pair[1]);
- rb_syserr_fail_str(e, prog);
+ errno = e;
+ rb_sys_fail_str(prog);
}
if (eargp) {
rb_execarg_addopt(execarg_obj, INT2FIX(0), INT2FIX(arg.write_pair[0]));
@@ -5997,17 +5873,8 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
rb_sys_fail_str(prog);
}
if (!NIL_P(execarg_obj)) {
- rb_protect(rb_execarg_fixup_v, execarg_obj, &state);
- if (state) {
- if (0 <= arg.write_pair[0]) close(arg.write_pair[0]);
- if (0 <= arg.write_pair[1]) close(arg.write_pair[1]);
- if (0 <= arg.pair[0]) close(arg.pair[0]);
- if (0 <= arg.pair[1]) close(arg.pair[1]);
- rb_execarg_parent_end(execarg_obj);
- rb_jump_tag(state);
- }
-
-# if defined(HAVE_WORKING_FORK)
+ rb_execarg_fixup(execarg_obj);
+# if defined(HAVE_FORK)
pid = rb_fork_async_signal_safe(&status, popen_exec, &arg, arg.eargp->redirect_fds, errmsg, sizeof(errmsg));
# else
rb_execarg_run_options(eargp, sargp, NULL, 0);
@@ -6029,10 +5896,9 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
if (eargp)
rb_execarg_run_options(sargp, NULL, NULL, 0);
# endif
- rb_execarg_parent_end(execarg_obj);
}
else {
-# if defined(HAVE_WORKING_FORK)
+# if defined(HAVE_FORK)
pid = rb_fork_ruby(&status);
if (pid == 0) { /* child */
rb_thread_atfork();
@@ -6048,7 +5914,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
/* parent */
if (pid == -1) {
-# if defined(HAVE_WORKING_FORK)
+# if defined(HAVE_FORK)
e = errno;
# endif
close(arg.pair[0]);
@@ -6057,11 +5923,12 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
close(arg.write_pair[0]);
close(arg.write_pair[1]);
}
-# if defined(HAVE_WORKING_FORK)
+ errno = e;
+# if defined(HAVE_FORK)
if (errmsg[0])
- rb_syserr_fail(e, errmsg);
+ rb_sys_fail(errmsg);
# endif
- rb_syserr_fail_str(e, prog);
+ rb_sys_fail_str(prog);
}
if ((fmode & FMODE_READABLE) && (fmode & FMODE_WRITABLE)) {
close(arg.pair[1]);
@@ -6078,18 +5945,18 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
fd = arg.pair[1];
}
#else
- cmd = rb_execarg_commandline(eargp, &prog);
+ if (argc) {
+ prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
+ cmd = StringValueCStr(prog);
+ }
if (!NIL_P(execarg_obj)) {
- rb_execarg_parent_start(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
rb_execarg_run_options(eargp, sargp, NULL, 0);
}
fp = popen(cmd, modestr);
- e = errno;
- if (eargp) {
- rb_execarg_parent_end(execarg_obj);
+ if (eargp)
rb_execarg_run_options(sargp, NULL, NULL, 0);
- }
- if (!fp) rb_syserr_fail_path(e, prog);
+ if (!fp) rb_sys_fail_path(prog);
fd = fileno(fp);
#endif
@@ -6128,7 +5995,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
rb_ivar_set(port, rb_intern("@tied_io_for_writing"), write_port);
}
-#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
+#if defined (__CYGWIN__) || !defined(HAVE_FORK)
fptr->finalize = pipe_finalize;
pipe_add_fptr(fptr);
#endif
@@ -6139,7 +6006,7 @@ static int
is_popen_fork(VALUE prog)
{
if (RSTRING_LEN(prog) == 1 && RSTRING_PTR(prog)[0] == '-') {
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
rb_raise(rb_eNotImpError,
"fork() function is unimplemented on this machine");
#else
@@ -6161,16 +6028,6 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
return pipe_open(execarg_obj, modestr, fmode, convconfig);
}
-static VALUE
-pipe_close(VALUE io)
-{
- rb_io_t *fptr = io_close_fptr(io);
- if (fptr) {
- fptr_waitpid(fptr, rb_thread_to_be_killed(rb_thread_current()));
- }
- return Qnil;
-}
-
/*
* call-seq:
* IO.popen([env,] cmd, mode="r" [, opt]) -> io
@@ -6225,7 +6082,7 @@ pipe_close(VALUE io)
* If a block is given, Ruby will run the command as a child connected
* to Ruby with a pipe. Ruby's end of the pipe will be passed as a
* parameter to the block.
- * At the end of block, Ruby closes the pipe and sets <code>$?</code>.
+ * At the end of block, Ruby close the pipe and sets <code>$?</code>.
* In this case <code>IO.popen</code> returns
* the value of the block.
*
@@ -6233,7 +6090,7 @@ pipe_close(VALUE io)
* the block will be run in two separate processes: once in the parent,
* and once in a child. The parent process will be passed the pipe
* object as a parameter to the block, the child version of the block
- * will be passed +nil+, and the child's standard in and
+ * will be passed <code>nil</code>, and the child's standard in and
* standard out will be connected to the parent through the pipe. Not
* available on all platforms.
*
@@ -6241,7 +6098,7 @@ pipe_close(VALUE io)
* p f.readlines
* f.close
* puts "Parent is #{Process.pid}"
- * IO.popen("date") {|f| puts f.gets }
+ * IO.popen("date") { |f| puts f.gets }
* IO.popen("-") {|f| $stderr.puts "#{Process.pid} is here, f is #{f.inspect}"}
* p $?
* IO.popen(%w"sed -e s|^|<foo>| -e s&$&;zot;&", "r+") {|f|
@@ -6290,8 +6147,10 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
rb_raise(rb_eArgError, "too many arguments");
}
#endif
- execarg_obj = rb_execarg_new((int)len, RARRAY_CONST_PTR(tmp), FALSE);
- RB_GC_GUARD(tmp);
+ tmp = rb_ary_dup(tmp);
+ RBASIC_CLEAR_CLASS(tmp);
+ execarg_obj = rb_execarg_new((int)len, RARRAY_PTR(tmp), FALSE);
+ rb_ary_clear(tmp);
}
else {
SafeStringValue(pname);
@@ -6321,7 +6180,7 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
}
RBASIC_SET_CLASS(port, klass);
if (rb_block_given_p()) {
- return rb_ensure(rb_yield, port, pipe_close, port);
+ return rb_ensure(rb_yield, port, io_close, port);
}
return port;
}
@@ -6389,7 +6248,7 @@ rb_open_file(int argc, const VALUE *argv, VALUE io)
*
* call-seq:
* IO.open(fd, mode="r" [, opt]) -> io
- * IO.open(fd, mode="r" [, opt]) {|io| block } -> obj
+ * IO.open(fd, mode="r" [, opt]) { |io| block } -> obj
*
* With no associated block, <code>IO.open</code> is a synonym for IO.new. If
* the optional code block is given, it will be passed +io+ as an argument,
@@ -6501,7 +6360,7 @@ check_pipe_command(VALUE filename_or_command)
* parent. If the command is not <code>"-"</code>, the subprocess runs the
* command.
*
- * When the subprocess is Ruby (opened via <code>"|-"</code>), the +open+
+ * When the subprocess is ruby (opened via <code>"|-"</code>), the +open+
* call returns +nil+. If a block is associated with the open call, that
* block will run twice --- once in the parent and once in the child.
*
@@ -6534,7 +6393,7 @@ check_pipe_command(VALUE filename_or_command)
* Open a subprocess running the same Ruby program:
*
* f = open("|-", "w+")
- * if f.nil?
+ * if f == nil
* puts "in Child"
* exit
* else
@@ -6673,7 +6532,7 @@ io_reopen(VALUE io, VALUE nfile)
if (RTEST(orig->pathv)) fptr->pathv = orig->pathv;
else if (!IS_PREP_STDIO(fptr)) fptr->pathv = Qnil;
fptr->finalize = orig->finalize;
-#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
+#if defined (__CYGWIN__) || !defined(HAVE_FORK)
if (fptr->finalize == pipe_finalize)
pipe_add_fptr(fptr);
#endif
@@ -6696,7 +6555,7 @@ io_reopen(VALUE io, VALUE nfile)
rb_update_max_fd(fd);
fptr->fd = fd;
}
- rb_notify_fd_close(fd);
+ rb_thread_fd_close(fd);
if ((orig->mode & FMODE_READABLE) && pos >= 0) {
if (io_seek(fptr, pos, SEEK_SET) < 0 && errno) {
rb_sys_fail_path(fptr->pathv);
@@ -6715,20 +6574,6 @@ io_reopen(VALUE io, VALUE nfile)
return io;
}
-#ifdef _WIN32
-int rb_freopen(VALUE fname, const char *mode, FILE *fp);
-#else
-static int
-rb_freopen(VALUE fname, const char *mode, FILE *fp)
-{
- if (!freopen(RSTRING_PTR(fname), mode, fp)) {
- RB_GC_GUARD(fname);
- return errno;
- }
- return 0;
-}
-#endif
-
/*
* call-seq:
* ios.reopen(other_IO) -> ios
@@ -6763,7 +6608,8 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
rb_io_taint_check(file);
fptr = RFILE(file)->fptr;
if (!fptr) {
- fptr = RFILE(file)->fptr = ZALLOC(rb_io_t);
+ fptr = RFILE(file)->fptr = ALLOC(rb_io_t);
+ MEMZERO(fptr, rb_io_t, 1);
}
if (!NIL_P(nmode) || !NIL_P(opt)) {
@@ -6786,7 +6632,7 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
oflags = rb_io_fmode_oflags(fptr->mode);
}
- fptr->pathv = fname;
+ fptr->pathv = rb_str_new_frozen(fname);
if (fptr->fd < 0) {
fptr->fd = rb_sysopen(fptr->pathv, oflags, 0666);
fptr->stdio_file = 0;
@@ -6800,10 +6646,9 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
fptr->rbuf.off = fptr->rbuf.len = 0;
if (fptr->stdio_file) {
- int e = rb_freopen(rb_str_encode_ospath(fptr->pathv),
- rb_io_oflags_modestr(oflags),
- fptr->stdio_file);
- if (e) rb_syserr_fail_path(e, fptr->pathv);
+ if (freopen(RSTRING_PTR(fptr->pathv), rb_io_oflags_modestr(oflags), fptr->stdio_file) == 0) {
+ rb_sys_fail_path(fptr->pathv);
+ }
fptr->fd = fileno(fptr->stdio_file);
rb_fd_fix_cloexec(fptr->fd);
#ifdef USE_SETVBUF
@@ -6856,7 +6701,7 @@ rb_io_init_copy(VALUE dest, VALUE io)
fptr->lineno = orig->lineno;
if (!NIL_P(orig->pathv)) fptr->pathv = orig->pathv;
fptr->finalize = orig->finalize;
-#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
+#if defined (__CYGWIN__) || !defined(HAVE_FORK)
if (fptr->finalize == pipe_finalize)
pipe_add_fptr(fptr);
#endif
@@ -6890,7 +6735,7 @@ rb_io_init_copy(VALUE dest, VALUE io)
*/
VALUE
-rb_io_printf(int argc, const VALUE *argv, VALUE out)
+rb_io_printf(int argc, VALUE *argv, VALUE out)
{
rb_io_write(out, rb_f_sprintf(argc, argv));
return Qnil;
@@ -6928,20 +6773,18 @@ rb_f_printf(int argc, VALUE *argv)
/*
* call-seq:
- * ios.print -> nil
+ * ios.print() -> nil
* ios.print(obj, ...) -> nil
*
- * Writes the given object(s) to <em>ios</em>. Returns +nil+.
- *
- * The stream must be opened for writing.
- * Each given object that isn't a string will be converted by calling
- * its <code>to_s</code> method.
- * When called without arguments, prints the contents of <code>$_</code>.
- *
- * If the output field separator (<code>$,</code>) is not +nil+,
- * it is inserted between objects.
- * If the output record separator (<code>$\\</code>) is not +nil+,
- * it is appended to the output.
+ * Writes the given object(s) to <em>ios</em>. The stream must be
+ * opened for writing. If the output field separator (<code>$,</code>)
+ * is not <code>nil</code>, it will be inserted between each object.
+ * If the output record separator (<code>$\\</code>)
+ * is not <code>nil</code>, it will be appended to the output. If no
+ * arguments are given, prints <code>$_</code>. Objects that aren't
+ * strings will be converted by calling their <code>to_s</code> method.
+ * With no argument, prints the contents of the variable <code>$_</code>.
+ * Returns <code>nil</code>.
*
* $stdout.print("This is ", 100, " percent.\n")
*
@@ -6951,7 +6794,7 @@ rb_f_printf(int argc, VALUE *argv)
*/
VALUE
-rb_io_print(int argc, const VALUE *argv, VALUE out)
+rb_io_print(int argc, VALUE *argv, VALUE out)
{
int i;
VALUE line;
@@ -6999,7 +6842,7 @@ rb_io_print(int argc, const VALUE *argv, VALUE out)
*/
static VALUE
-rb_f_print(int argc, const VALUE *argv)
+rb_f_print(int argc, VALUE *argv)
{
rb_io_print(argc, argv, rb_stdout);
return Qnil;
@@ -7046,8 +6889,8 @@ rb_io_putc(VALUE io, VALUE ch)
*
* $stdout.putc(int)
*
- * Refer to the documentation for IO#putc for important information regarding
- * multi-byte characters.
+ * Refer to the documentation for IO#putc for important information regarding
+ * multi-byte characters.
*/
static VALUE
@@ -7099,17 +6942,13 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
* call-seq:
* ios.puts(obj, ...) -> nil
*
- * Writes the given object(s) to <em>ios</em>.
- * Writes a newline after any that do not already end
- * with a newline sequence. Returns +nil+.
- *
- * The stream must be opened for writing.
+ * Writes the given objects to <em>ios</em> as with
+ * <code>IO#print</code>. Writes a record separator (typically a
+ * newline) after any that do not already end with a newline sequence.
* If called with an array argument, writes each element on a new line.
- * Each given object that isn't a string or array will be converted
- * by calling its +to_s+ method.
- * If called without arguments, outputs a single newline.
+ * If called without arguments, outputs a single record separator.
*
- * $stdout.puts("this", "is", ["a", "test"])
+ * $stdout.puts("this", "is", "a", "test")
*
* <em>produces:</em>
*
@@ -7117,13 +6956,10 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
* is
* a
* test
- *
- * Note that +puts+ always uses newlines and is not affected
- * by the output record separator (<code>$\\</code>).
*/
VALUE
-rb_io_puts(int argc, const VALUE *argv, VALUE out)
+rb_io_puts(int argc, VALUE *argv, VALUE out)
{
int i;
VALUE line;
@@ -7308,11 +7144,6 @@ rb_write_error_str(VALUE mesg)
/* a stopgap measure for the time being */
if (rb_stderr == orig_stderr || RFILE(orig_stderr)->fptr->fd < 0) {
size_t len = (size_t)RSTRING_LEN(mesg);
-#ifdef _WIN32
- if (isatty(fileno(stderr))) {
- if (rb_w32_write_console(mesg, fileno(stderr)) > 0) return;
- }
-#endif
if (fwrite(RSTRING_PTR(mesg), sizeof(char), len, stderr) < len) {
RB_GC_GUARD(mesg);
return;
@@ -7328,9 +7159,9 @@ static void
must_respond_to(ID mid, VALUE val, ID id)
{
if (!rb_respond_to(val, mid)) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE" must have %"PRIsVALUE" method, %"PRIsVALUE" given",
- rb_id2str(id), rb_id2str(mid),
- rb_obj_class(val));
+ rb_raise(rb_eTypeError, "%s must have %s method, %s given",
+ rb_id2name(id), rb_id2name(mid),
+ rb_obj_classname(val));
}
}
@@ -7401,60 +7232,6 @@ rb_io_stdio_file(rb_io_t *fptr)
return fptr->stdio_file;
}
-static inline void
-rb_io_buffer_init(rb_io_buffer_t *buf)
-{
- buf->ptr = NULL;
- buf->off = 0;
- buf->len = 0;
- buf->capa = 0;
-}
-
-static inline rb_io_t *
-rb_io_fptr_new(void)
-{
- rb_io_t *fp = ALLOC(rb_io_t);
- fp->fd = -1;
- fp->stdio_file = NULL;
- fp->mode = 0;
- fp->pid = 0;
- fp->lineno = 0;
- fp->pathv = Qnil;
- fp->finalize = 0;
- rb_io_buffer_init(&fp->wbuf);
- rb_io_buffer_init(&fp->rbuf);
- rb_io_buffer_init(&fp->cbuf);
- fp->readconv = NULL;
- fp->writeconv = NULL;
- fp->writeconv_asciicompat = Qnil;
- fp->writeconv_pre_ecflags = 0;
- fp->writeconv_pre_ecopts = Qnil;
- fp->writeconv_initialized = 0;
- fp->tied_io_for_writing = 0;
- fp->encs.enc = NULL;
- fp->encs.enc2 = NULL;
- fp->encs.ecflags = 0;
- fp->encs.ecopts = Qnil;
- fp->write_lock = 0;
- return fp;
-}
-
-rb_io_t *
-rb_io_make_open_file(VALUE obj)
-{
- rb_io_t *fp = 0;
-
- Check_Type(obj, T_FILE);
- if (RFILE(obj)->fptr) {
- rb_io_close(obj);
- rb_io_fptr_finalize(RFILE(obj)->fptr);
- RFILE(obj)->fptr = 0;
- }
- fp = rb_io_fptr_new();
- RFILE(obj)->fptr = fp;
- return fp;
-}
-
/*
* call-seq:
* IO.new(fd [, mode] [, opt]) -> io
@@ -7496,12 +7273,12 @@ rb_io_make_open_file(VALUE obj)
* "w+" Read-write, truncates existing file to zero length
* or creates a new file for reading and writing.
*
- * "a" Write-only, each write call appends data at end of file.
- * Creates a new file for writing if file does not exist.
+ * "a" Write-only, starts at end of file if file exists,
+ * otherwise creates a new file for writing.
*
- * "a+" Read-write, each write call appends data at end of file.
- * Creates a new file for reading and writing if file does
- * not exist.
+ * "a+" Read-write, starts at end of file if file exists,
+ * otherwise creates a new file for reading and
+ * writing.
*
* The following modes must be used separately, and along with one or more of
* the modes seen above.
@@ -7531,7 +7308,7 @@ rb_io_make_open_file(VALUE obj)
* converted from +int_enc+ to +ext_enc+ upon output. See Encoding for
* further details of transcoding on input and output.
*
- * If "BOM|UTF-8", "BOM|UTF-16LE" or "BOM|UTF16-BE" are used, Ruby checks for
+ * If "BOM|UTF-8", "BOM|UTF-16LE" or "BOM|UTF16-BE" are used, ruby checks for
* a Unicode BOM in the input document to help determine the encoding. For
* UTF-16 encodings the file open mode must be binary. When present, the BOM
* is stripped and the external encoding from the BOM is used. When the BOM
@@ -7546,10 +7323,6 @@ rb_io_make_open_file(VALUE obj)
* :mode ::
* Same as +mode+ parameter
*
- * :flags ::
- * Specifies file open flags as integer.
- * If +mode+ parameter is given, this parameter will be bitwise-ORed.
- *
* :\external_encoding ::
* External encoding for the IO. "-" is a synonym for the default external
* encoding.
@@ -7558,7 +7331,7 @@ rb_io_make_open_file(VALUE obj)
* Internal encoding for the IO. "-" is a synonym for the default internal
* encoding.
*
- * If the value is +nil+ no conversion occurs.
+ * If the value is nil no conversion occurs.
*
* :encoding ::
* Specifies external and internal encodings as "extern:intern".
@@ -7709,9 +7482,9 @@ static VALUE
rb_io_s_new(int argc, VALUE *argv, VALUE klass)
{
if (rb_block_given_p()) {
- VALUE cname = rb_obj_as_string(klass);
+ const char *cname = rb_class2name(klass);
- rb_warn("%"PRIsVALUE"::new() does not take block; use %"PRIsVALUE"::open() instead",
+ rb_warn("%s::new() does not take block; use %s::open() instead",
cname, cname);
}
return rb_class_new_instance(argc, argv, klass);
@@ -7745,8 +7518,8 @@ rb_io_s_for_fd(int argc, VALUE *argv, VALUE klass)
static VALUE
rb_io_autoclose_p(VALUE io)
{
- rb_io_t *fptr = RFILE(io)->fptr;
- rb_io_check_closed(fptr);
+ rb_io_t *fptr;
+ GetOpenFile(io, fptr);
return (fptr->mode & FMODE_PREP) ? Qfalse : Qtrue;
}
@@ -7802,6 +7575,7 @@ argf_memsize(const void *ptr)
{
const struct argf *p = ptr;
size_t size = sizeof(*p);
+ if (!ptr) return 0;
if (p->inplace) size += strlen(p->inplace) + 1;
return size;
}
@@ -7809,7 +7583,7 @@ argf_memsize(const void *ptr)
static const rb_data_type_t argf_type = {
"ARGF",
{argf_mark, argf_free, argf_memsize},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static inline void
@@ -7886,7 +7660,7 @@ argf_set_lineno(VALUE argf, VALUE val)
/*
* call-seq:
- * ARGF.lineno -> integer
+ * ARGF.lineno -> integer
*
* Returns the current line number of ARGF as a whole. This value
* can be set manually with +ARGF.lineno=+.
@@ -7968,11 +7742,9 @@ argf_next_argv(VALUE argf)
if (ARGF.next_p == 1) {
retry:
if (RARRAY_LEN(ARGF.argv) > 0) {
- VALUE filename = rb_ary_shift(ARGF.argv);
- StringValueCStr(filename);
- ARGF.filename = rb_str_encode_ospath(filename);
- fn = StringValueCStr(filename);
- if (RSTRING_LEN(filename) == 1 && fn[0] == '-') {
+ ARGF.filename = rb_ary_shift(ARGF.argv);
+ fn = StringValueCStr(ARGF.filename);
+ if (strlen(fn) == 1 && fn[0] == '-') {
ARGF.current_file = rb_stdin;
if (ARGF.inplace) {
rb_warn("Can't do inplace edit for stdio; skipping");
@@ -7981,7 +7753,7 @@ argf_next_argv(VALUE argf)
}
else {
VALUE write_io = Qnil;
- int fr = rb_sysopen(filename, O_RDONLY, 0);
+ int fr = rb_sysopen(ARGF.filename, O_RDONLY, 0);
if (ARGF.inplace) {
struct stat st;
@@ -7995,24 +7767,22 @@ argf_next_argv(VALUE argf)
rb_io_close(rb_stdout);
}
fstat(fr, &st);
- str = filename;
if (*ARGF.inplace) {
- str = rb_str_dup(str);
+ str = rb_str_new2(fn);
rb_str_cat2(str, ARGF.inplace);
- /* TODO: encoding of ARGF.inplace */
#ifdef NO_SAFE_RENAME
(void)close(fr);
(void)unlink(RSTRING_PTR(str));
if (rename(fn, RSTRING_PTR(str)) < 0) {
- rb_warn("Can't rename %"PRIsVALUE" to %"PRIsVALUE": %s, skipping file",
- filename, str, strerror(errno));
+ rb_warn("Can't rename %s to %s: %s, skipping file",
+ fn, RSTRING_PTR(str), strerror(errno));
goto retry;
}
fr = rb_sysopen(str, O_RDONLY, 0);
#else
if (rename(fn, RSTRING_PTR(str)) < 0) {
- rb_warn("Can't rename %"PRIsVALUE" to %"PRIsVALUE": %s, skipping file",
- filename, str, strerror(errno));
+ rb_warn("Can't rename %s to %s: %s, skipping file",
+ fn, RSTRING_PTR(str), strerror(errno));
close(fr);
goto retry;
}
@@ -8023,14 +7793,14 @@ argf_next_argv(VALUE argf)
rb_fatal("Can't do inplace edit without backup");
#else
if (unlink(fn) < 0) {
- rb_warn("Can't remove %"PRIsVALUE": %s, skipping file",
- filename, strerror(errno));
+ rb_warn("Can't remove %s: %s, skipping file",
+ fn, strerror(errno));
close(fr);
goto retry;
}
#endif
}
- fw = rb_sysopen(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ fw = rb_sysopen(ARGF.filename, O_WRONLY|O_CREAT|O_TRUNC, 0666);
#ifndef NO_SAFE_RENAME
fstat(fw, &st2);
#ifdef HAVE_FCHMOD
@@ -8046,9 +7816,9 @@ argf_next_argv(VALUE argf)
err = chown(fn, st.st_uid, st.st_gid);
#endif
if (err && getuid() == 0 && st2.st_uid == 0) {
- const char *wkfn = RSTRING_PTR(filename);
- rb_warn("Can't set owner/group of %"PRIsVALUE" to same as %"PRIsVALUE": %s, skipping file",
- filename, str, strerror(errno));
+ const char *wkfn = RSTRING_PTR(ARGF.filename);
+ rb_warn("Can't set owner/group of %s to same as %s: %s, skipping file",
+ wkfn, fn, strerror(errno));
(void)close(fr);
(void)close(fw);
(void)unlink(wkfn);
@@ -8153,9 +7923,9 @@ static VALUE argf_gets(int, VALUE *, VALUE);
/*
* call-seq:
- * gets(sep=$/) -> string or nil
- * gets(limit) -> string or nil
- * gets(sep, limit) -> string or nil
+ * gets(sep=$/) -> string or nil
+ * gets(limit) -> string or nil
+ * gets(sep,limit) -> string or nil
*
* Returns (and assigns to <code>$_</code>) the next line from the list
* of files in +ARGV+ (or <code>$*</code>), or from standard input if
@@ -8167,8 +7937,8 @@ static VALUE argf_gets(int, VALUE *, VALUE);
* divided by two consecutive newlines. If the first argument is an
* integer, or optional second argument is given, the returning string
* would not be longer than the given value in bytes. If multiple
- * filenames are present in +ARGV+, <code>gets(nil)</code> will read
- * the contents one file at a time.
+ * filenames are present in +ARGV+, +gets(nil)+ will read the contents
+ * one file at a time.
*
* ARGV << "testfile"
* print while gets
@@ -8201,9 +7971,8 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv)
*
* Returns the next line from the current file in +ARGF+.
*
- * By default lines are assumed to be separated by <code>$/</code>;
- * to use a different character as a separator, supply it as a +String+
- * for the _sep_ argument.
+ * By default lines are assumed to be separated by +$/+; to use a different
+ * character as a separator, supply it as a +String+ for the _sep_ argument.
*
* The optional _limit_ argument specifies how many characters of each line
* to return. By default all characters are returned.
@@ -8276,11 +8045,10 @@ rb_f_readline(int argc, VALUE *argv, VALUE recv)
*
* Returns the next line from the current file in +ARGF+.
*
- * By default lines are assumed to be separated by <code>$/</code>;
- * to use a different character as a separator, supply it as a +String+
- * for the _sep_ argument.
+ * By default lines are assumed to be separated by +$/+; to use a different
+ * character as a separator, supply it as a +String+ for the _sep_ argument.
*
- * The optional _limit_ argument specifies how many characters of each line
+ * The optional _limit_ argument specifies how many characters of each line
* to return. By default all characters are returned.
*
* An +EOFError+ is raised at the end of the file.
@@ -8304,9 +8072,9 @@ static VALUE argf_readlines(int, VALUE *, VALUE);
/*
* call-seq:
- * readlines(sep=$/) -> array
- * readlines(limit) -> array
- * readlines(sep, limit) -> array
+ * readlines(sep=$/) -> array
+ * readlines(limit) -> array
+ * readlines(sep,limit) -> array
*
* Returns an array containing the lines returned by calling
* <code>Kernel.gets(<i>sep</i>)</code> until the end of file.
@@ -8378,7 +8146,7 @@ argf_readlines(int argc, VALUE *argv, VALUE argf)
static VALUE
rb_f_backquote(VALUE obj, VALUE str)
{
- VALUE port;
+ volatile VALUE port;
VALUE result;
rb_io_t *fptr;
@@ -8390,8 +8158,6 @@ rb_f_backquote(VALUE obj, VALUE str)
GetOpenFile(port, fptr);
result = read_all(fptr, remain_size(fptr), Qnil);
rb_io_close(port);
- rb_io_fptr_finalize(fptr);
- rb_gc_force_recycle(port); /* also guards from premature GC */
return result;
}
@@ -8556,9 +8322,9 @@ static VALUE sym_normal, sym_sequential, sym_random,
#ifdef HAVE_POSIX_FADVISE
struct io_advise_struct {
int fd;
- int advice;
off_t offset;
off_t len;
+ int advice;
};
static VALUE
@@ -8626,15 +8392,10 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len)
ias.len = len;
rv = (int)rb_thread_io_blocking_region(io_advise_internal, &ias, fptr->fd);
- if (rv && rv != ENOSYS) {
+ if (rv) {
/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
it returns the error code. */
- VALUE message = rb_sprintf("%"PRIsVALUE" "
- "(%"PRI_OFF_T_PREFIX"d, "
- "%"PRI_OFF_T_PREFIX"d, "
- "%"PRIsVALUE")",
- fptr->pathv, offset, len, advice);
- rb_syserr_fail_str(rv, message);
+ rb_syserr_fail_str(rv, fptr->pathv);
}
return Qnil;
@@ -8654,7 +8415,9 @@ advice_arg_check(VALUE advice)
advice != sym_willneed &&
advice != sym_dontneed &&
advice != sym_noreuse) {
- rb_raise(rb_eNotImpError, "Unsupported advice: %+"PRIsVALUE, advice);
+ VALUE symname = rb_inspect(advice);
+ rb_raise(rb_eNotImpError, "Unsupported advice: %s",
+ StringValuePtr(symname));
}
}
@@ -8726,25 +8489,28 @@ rb_io_advise(int argc, VALUE *argv, VALUE io)
/*
* call-seq:
- * IO.select(read_array [, write_array [, error_array [, timeout]]]) -> array or nil
+ * IO.select(read_array
+ * [, write_array
+ * [, error_array
+ * [, timeout]]]) -> array or nil
*
* Calls select(2) system call.
- * It monitors given arrays of <code>IO</code> objects, waits until one or more
- * of <code>IO</code> objects are ready for reading, are ready for writing,
+ * It monitors given arrays of <code>IO</code> objects, waits one or more
+ * of <code>IO</code> objects ready for reading, are ready for writing,
* and have pending exceptions respectively, and returns an array that
- * contains arrays of those IO objects. It will return +nil+
+ * contains arrays of those IO objects. It will return <code>nil</code>
* if optional <i>timeout</i> value is given and no <code>IO</code> object
* is ready in <i>timeout</i> seconds.
*
* <code>IO.select</code> peeks the buffer of <code>IO</code> objects for testing readability.
* If the <code>IO</code> buffer is not empty,
- * <code>IO.select</code> immediately notifies readability.
- * This "peek" only happens for <code>IO</code> objects.
- * It does not happen for IO-like objects such as OpenSSL::SSL::SSLSocket.
+ * <code>IO.select</code> immediately notify readability.
+ * This "peek" is only happen for <code>IO</code> objects.
+ * It is not happen for IO-like objects such as OpenSSL::SSL::SSLSocket.
*
* The best way to use <code>IO.select</code> is invoking it
* after nonblocking methods such as <code>read_nonblock</code>, <code>write_nonblock</code>, etc.
- * The methods raise an exception which is extended by
+ * The methods raises an exception which is extended by
* <code>IO::WaitReadable</code> or <code>IO::WaitWritable</code>.
* The modules notify how the caller should wait with <code>IO.select</code>.
* If <code>IO::WaitReadable</code> is raised, the caller should wait for reading.
@@ -8772,37 +8538,37 @@ rb_io_advise(int argc, VALUE *argv, VALUE io)
* This means that readability notified by <code>IO.select</code> doesn't mean
* readability from <code>OpenSSL::SSL::SSLSocket</code> object.
*
- * The most likely situation is that <code>OpenSSL::SSL::SSLSocket</code> buffers some data.
+ * Most possible situation is <code>OpenSSL::SSL::SSLSocket</code> buffers some data.
* <code>IO.select</code> doesn't see the buffer.
* So <code>IO.select</code> can block when <code>OpenSSL::SSL::SSLSocket#readpartial</code> doesn't block.
*
- * However, several more complicated situations exist.
+ * However several more complicated situation exists.
*
* SSL is a protocol which is sequence of records.
- * The record consists of multiple bytes.
+ * The record consists multiple bytes.
* So, the remote side of SSL sends a partial record,
* <code>IO.select</code> notifies readability but
* <code>OpenSSL::SSL::SSLSocket</code> cannot decrypt a byte and
* <code>OpenSSL::SSL::SSLSocket#readpartial</code> will blocks.
*
* Also, the remote side can request SSL renegotiation which forces
- * the local SSL engine to write some data.
+ * the local SSL engine writes some data.
* This means <code>OpenSSL::SSL::SSLSocket#readpartial</code> may
* invoke <code>write</code> system call and it can block.
- * In such a situation, <code>OpenSSL::SSL::SSLSocket#read_nonblock</code>
+ * In such situation, <code>OpenSSL::SSL::SSLSocket#read_nonblock</code>
* raises IO::WaitWritable instead of blocking.
* So, the caller should wait for ready for writability as above example.
*
* The combination of nonblocking methods and <code>IO.select</code> is
* also useful for streams such as tty, pipe socket socket when
- * multiple processes read from a stream.
+ * multiple process read form a stream.
*
- * Finally, Linux kernel developers don't guarantee that
+ * Finally, Linux kernel developers doesn't guarantee that
* readability of select(2) means readability of following read(2) even
- * for a single process.
+ * for single process.
* See select(2) manual on GNU/Linux system.
*
- * Invoking <code>IO.select</code> before <code>IO#readpartial</code> works well as usual.
+ * Invoking <code>IO.select</code> before <code>IO#readpartial</code> works well in usual.
* However it is not the best way to use <code>IO.select</code>.
*
* The writability notified by select(2) doesn't show
@@ -8896,7 +8662,6 @@ rb_f_select(int argc, VALUE *argv, VALUE obj)
# define NUM2IOCTLREQ(num) NUM2INT(num)
#endif
-#ifdef HAVE_IOCTL
struct ioctl_arg {
int fd;
ioctl_req_t cmd;
@@ -8925,7 +8690,6 @@ do_ioctl(int fd, ioctl_req_t cmd, long narg)
return retval;
}
-#endif
#define DEFULT_IOCTL_NARG_LEN (256)
@@ -8980,14 +8744,6 @@ typedef long fcntl_arg_t;
typedef int fcntl_arg_t;
#endif
-#if defined __native_client__ && !defined __GLIBC__
-// struct flock is currently missing the NaCl newlib headers
-// TODO(sbc): remove this once it gets added.
-#undef F_GETLK
-#undef F_SETLK
-#undef F_SETLKW
-#endif
-
static long
fcntl_narg_len(int cmd)
{
@@ -9137,8 +8893,7 @@ setup_narg(ioctl_req_t cmd, VALUE *argp, int io_p)
narg = NUM2LONG(arg);
}
else {
- char *ptr;
- long len, slen;
+ long len;
*argp = arg = tmp;
if (io_p)
@@ -9147,24 +8902,19 @@ setup_narg(ioctl_req_t cmd, VALUE *argp, int io_p)
len = fcntl_narg_len((int)cmd);
rb_str_modify(arg);
- slen = RSTRING_LEN(arg);
/* expand for data + sentinel. */
- if (slen < len+1) {
+ if (RSTRING_LEN(arg) < len+1) {
rb_str_resize(arg, len+1);
- MEMZERO(RSTRING_PTR(arg)+slen, char, len-slen);
- slen = len+1;
}
/* a little sanity check here */
- ptr = RSTRING_PTR(arg);
- ptr[slen - 1] = 17;
- narg = (long)(SIGNED_VALUE)ptr;
+ RSTRING_PTR(arg)[RSTRING_LEN(arg) - 1] = 17;
+ narg = (long)(SIGNED_VALUE)RSTRING_PTR(arg);
}
}
return narg;
}
-#ifdef HAVE_IOCTL
static VALUE
rb_ioctl(VALUE io, VALUE req, VALUE arg)
{
@@ -9173,17 +8923,16 @@ rb_ioctl(VALUE io, VALUE req, VALUE arg)
long narg;
int retval;
+ rb_secure(2);
+
narg = setup_narg(cmd, &arg, 1);
GetOpenFile(io, fptr);
retval = do_ioctl(fptr->fd, cmd, narg);
if (retval < 0) rb_sys_fail_path(fptr->pathv);
if (RB_TYPE_P(arg, T_STRING)) {
- char *ptr;
- long slen;
- RSTRING_GETMEM(arg, ptr, slen);
- if (ptr[slen-1] != 17)
+ if (RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] != 17)
rb_raise(rb_eArgError, "return value overflowed string");
- ptr[slen-1] = '\0';
+ RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] = '\0';
}
return INT2NUM(retval);
@@ -9209,9 +8958,6 @@ rb_io_ioctl(int argc, VALUE *argv, VALUE io)
rb_scan_args(argc, argv, "11", &req, &arg);
return rb_ioctl(io, req, arg);
}
-#else
-#define rb_io_ioctl rb_f_notimplement
-#endif
#ifdef HAVE_FCNTL
struct fcntl_arg {
@@ -9260,17 +9006,26 @@ rb_fcntl(VALUE io, VALUE req, VALUE arg)
long narg;
int retval;
+ rb_secure(2);
+
narg = setup_narg(cmd, &arg, 0);
GetOpenFile(io, fptr);
retval = do_fcntl(fptr->fd, cmd, narg);
if (retval < 0) rb_sys_fail_path(fptr->pathv);
if (RB_TYPE_P(arg, T_STRING)) {
- char *ptr;
- long slen;
- RSTRING_GETMEM(arg, ptr, slen);
- if (ptr[slen-1] != 17)
+ if (RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] != 17)
rb_raise(rb_eArgError, "return value overflowed string");
- ptr[slen-1] = '\0';
+ RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] = '\0';
+ }
+
+ if (cmd == F_SETFL) {
+ if (narg & O_NONBLOCK) {
+ fptr->mode |= FMODE_WSPLIT_INITIALIZED;
+ fptr->mode &= ~FMODE_WSPLIT;
+ }
+ else {
+ fptr->mode &= ~(FMODE_WSPLIT_INITIALIZED|FMODE_WSPLIT);
+ }
}
return INT2NUM(retval);
@@ -9326,14 +9081,13 @@ rb_io_fcntl(int argc, VALUE *argv, VALUE io)
*
* hello
*
+ *
* Calling +syscall+ on a platform which does not have any way to
* an arbitrary system function just fails with NotImplementedError.
*
- * *Note:*
- * +syscall+ is essentially unsafe and unportable.
- * Feel free to shoot your foot.
- * The DL (Fiddle) library is preferred for safer and a bit
- * more portable programming.
+ * Note::
+ * +syscall+ is essentially unsafe and unportable. Feel free to shoot your foot.
+ * DL (Fiddle) library is preferred for safer and a bit more portable programming.
*/
static VALUE
@@ -9379,6 +9133,7 @@ rb_f_syscall(int argc, VALUE *argv)
rb_warning("We plan to remove a syscall function at future release. DL(Fiddle) provides safer alternative.");
}
+ rb_secure(2);
if (argc == 0)
rb_raise(rb_eArgError, "too few arguments for syscall");
if (argc > numberof(arg))
@@ -9471,7 +9226,7 @@ static rb_encoding *
find_encoding(VALUE v)
{
rb_encoding *enc = rb_find_encoding(v);
- if (!enc) rb_warn("Unsupported encoding %"PRIsVALUE" ignored", v);
+ if (!enc) unsupported_encoding(StringValueCStr(v));
return enc;
}
@@ -9517,8 +9272,8 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
}
else {
tmp = rb_check_string_type(v1);
- if (!NIL_P(tmp) && rb_enc_asciicompat(enc = rb_enc_get(tmp))) {
- parse_mode_enc(RSTRING_PTR(tmp), enc, &enc, &enc2, NULL);
+ if (!NIL_P(tmp) && rb_enc_asciicompat(rb_enc_get(tmp))) {
+ parse_mode_enc(RSTRING_PTR(tmp), &enc, &enc2, NULL);
SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(enc2, ecflags);
ecflags = rb_econv_prepare_options(opt, &ecopts, ecflags);
}
@@ -9538,21 +9293,6 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
}
-struct io_encoding_set_args {
- rb_io_t *fptr;
- VALUE v1;
- VALUE v2;
- VALUE opt;
-};
-
-static VALUE
-io_encoding_set_v(VALUE v)
-{
- struct io_encoding_set_args *arg = (struct io_encoding_set_args *)v;
- io_encoding_set(arg->fptr, arg->v1, arg->v2, arg->opt);
- return Qnil;
-}
-
static VALUE
pipe_pair_close(VALUE rw)
{
@@ -9627,7 +9367,6 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
VALUE r, w, args[3], v1, v2;
VALUE opt;
rb_io_t *fptr, *fptr2;
- struct io_encoding_set_args ies_args;
int fmode = 0;
VALUE ret;
@@ -9645,18 +9384,7 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
rb_jump_tag(state);
}
GetOpenFile(r, fptr);
-
- ies_args.fptr = fptr;
- ies_args.v1 = v1;
- ies_args.v2 = v2;
- ies_args.opt = opt;
- rb_protect(io_encoding_set_v, (VALUE)&ies_args, &state);
- if (state) {
- close(pipes[1]);
- io_close(r);
- rb_jump_tag(state);
- }
-
+ io_encoding_set(fptr, v1, v2, opt);
args[1] = INT2NUM(pipes[1]);
args[2] = INT2FIX(O_WRONLY);
w = rb_protect(io_new_instance, (VALUE)args, &state);
@@ -9851,41 +9579,38 @@ seek_before_access(VALUE argp)
/*
* call-seq:
- * IO.read(name, [length [, offset]] [, opt] ) -> string
+ * IO.read(name, [length [, offset]] ) -> string
+ * IO.read(name, [length [, offset]], open_args) -> string
*
* Opens the file, optionally seeks to the given +offset+, then returns
* +length+ bytes (defaulting to the rest of the file). <code>read</code>
* ensures the file is closed before returning.
*
- * === Options
- *
- * The options hash accepts the following keys:
+ * If the last argument is a hash, it specifies option for internal
+ * open(). The key would be the following. open_args: is exclusive
+ * to others.
*
* encoding::
* string or encoding
*
- * Specifies the encoding of the read string. +encoding:+ will be ignored
- * if +length+ is specified. See Encoding.aliases for possible encodings.
+ * specifies encoding of the read string. +encoding+ will be ignored
+ * if length is specified.
*
* mode::
* string
*
- * Specifies the mode argument for open(). It must start with an "r"
- * otherwise it will cause an error. See IO.new for the list of possible
- * modes.
+ * specifies mode argument for open(). It should start with "r"
+ * otherwise it will cause an error.
*
- * open_args::
- * array of strings
+ * open_args:: array of strings
*
- * Specifies arguments for open() as an array. This key can not be used
- * in combination with either +encoding:+ or +mode:+.
+ * specifies arguments for open() as an array.
*
* Examples:
*
- * IO.read("testfile") #=> "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
- * IO.read("testfile", 20) #=> "This is line one\nThi"
- * IO.read("testfile", 20, 10) #=> "ne one\nThis is line "
- * IO.read("binfile", mode: "rb") #=> "\xF7\x00\x00\x0E\x12"
+ * IO.read("testfile") #=> "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
+ * IO.read("testfile", 20) #=> "This is line one\nThi"
+ * IO.read("testfile", 20, 10) #=> "ne one\nThis is line "
*/
static VALUE
@@ -9940,16 +9665,7 @@ rb_io_s_binread(int argc, VALUE *argv, VALUE io)
arg.argv = argv+1;
arg.argc = (argc > 1) ? 1 : 0;
if (!NIL_P(offset)) {
- struct seek_arg sarg;
- int state = 0;
- sarg.io = arg.io;
- sarg.offset = offset;
- sarg.mode = SEEK_SET;
- rb_protect(seek_before_access, (VALUE)&sarg, &state);
- if (state) {
- rb_io_close(arg.io);
- rb_jump_tag(state);
- }
+ rb_io_seek(arg.io, offset, SEEK_SET);
}
return rb_ensure(io_s_read, (VALUE)&arg, rb_io_close, arg.io);
}
@@ -10055,11 +9771,12 @@ rb_io_s_write(int argc, VALUE *argv, VALUE io)
/*
* call-seq:
- * IO.binwrite(name, string, [offset] ) -> integer
- * IO.binwrite(name, string, [offset], open_args ) -> integer
+ * IO.binwrite(name, string, [offset] ) => fixnum
+ * IO.binwrite(name, string, [offset], open_args ) => fixnum
*
* Same as <code>IO.write</code> except opening the file in binary mode
* and ASCII-8BIT encoding ("wb:ASCII-8BIT").
+ *
*/
static VALUE
@@ -10118,49 +9835,6 @@ maygvl_copy_stream_continue_p(int has_gvl, struct copy_stream_struct *stp)
return FALSE;
}
-/* non-Linux poll may not work on all FDs */
-#if defined(HAVE_POLL) && defined(__linux__)
-# define USE_POLL 1
-# define IOWAIT_SYSCALL "poll"
-#else
-# define IOWAIT_SYSCALL "select"
-# define USE_POLL 0
-#endif
-
-#if USE_POLL
-static int
-nogvl_wait_for_single_fd(int fd, short events)
-{
- struct pollfd fds;
-
- fds.fd = fd;
- fds.events = events;
-
- return poll(&fds, 1, -1);
-}
-
-static int
-maygvl_copy_stream_wait_read(int has_gvl, struct copy_stream_struct *stp)
-{
- int ret;
-
- do {
- if (has_gvl) {
- ret = rb_wait_for_single_fd(stp->src_fd, RB_WAITFD_IN, NULL);
- }
- else {
- ret = nogvl_wait_for_single_fd(stp->src_fd, POLLIN);
- }
- } while (ret == -1 && maygvl_copy_stream_continue_p(has_gvl, stp));
-
- if (ret == -1) {
- stp->syserr = "poll";
- stp->error_no = errno;
- return -1;
- }
- return 0;
-}
-#else /* !USE_POLL */
static int
maygvl_select(int has_gvl, int n, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout)
{
@@ -10188,7 +9862,6 @@ maygvl_copy_stream_wait_read(int has_gvl, struct copy_stream_struct *stp)
}
return 0;
}
-#endif /* !USE_POLL */
static int
nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
@@ -10196,17 +9869,13 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
int ret;
do {
-#if USE_POLL
- ret = nogvl_wait_for_single_fd(stp->dst_fd, POLLOUT);
-#else
rb_fd_zero(&stp->fds);
rb_fd_set(stp->dst_fd, &stp->fds);
ret = rb_fd_select(rb_fd_max(&stp->fds), NULL, &stp->fds, NULL, NULL);
-#endif
} while (ret == -1 && maygvl_copy_stream_continue_p(0, stp));
if (ret == -1) {
- stp->syserr = IOWAIT_SYSCALL;
+ stp->syserr = "select";
stp->error_no = errno;
return -1;
}
@@ -10234,6 +9903,10 @@ simple_sendfile(int out_fd, int in_fd, off_t *offset, off_t count)
*/
# define USE_SENDFILE
+# ifdef HAVE_SYS_UIO_H
+# include <sys/uio.h>
+# endif
+
static ssize_t
simple_sendfile(int out_fd, int in_fd, off_t *offset, off_t count)
{
@@ -10287,10 +9960,8 @@ nogvl_copy_stream_sendfile(struct copy_stream_struct *stp)
stp->error_no = errno;
return -1;
}
-#ifndef __linux__
if ((dst_stat.st_mode & S_IFMT) != S_IFSOCK)
- return 0;
-#endif
+ return 0;
src_offset = stp->src_offset;
use_pread = src_offset != (off_t)-1;
@@ -10409,9 +10080,9 @@ maygvl_copy_stream_read(int has_gvl, struct copy_stream_struct *stp, char *buf,
goto retry_read;
#ifdef ENOSYS
case ENOSYS:
+#endif
stp->notimp = "pread";
return -1;
-#endif
}
stp->syserr = offset == (off_t)-1 ? "read" : "pread";
stp->error_no = errno;
@@ -10563,11 +10234,11 @@ copy_stream_fallback_body(VALUE arg)
ssize_t ss;
rb_str_resize(buf, buflen);
ss = maygvl_copy_stream_read(1, stp, RSTRING_PTR(buf), l, off);
- rb_str_resize(buf, ss > 0 ? ss : 0);
if (ss == -1)
return Qnil;
if (ss == 0)
rb_eof_error();
+ rb_str_resize(buf, ss);
if (off != (off_t)-1)
off += ss;
}
@@ -10613,59 +10284,51 @@ copy_stream_body(VALUE arg)
stp->total = 0;
if (src_io == argf ||
- !(RB_TYPE_P(src_io, T_FILE) ||
- RB_TYPE_P(src_io, T_STRING) ||
- rb_respond_to(src_io, rb_intern("to_path")))) {
- src_fd = -1;
+ !(RB_TYPE_P(src_io, T_FILE) ||
+ RB_TYPE_P(src_io, T_STRING) ||
+ rb_respond_to(src_io, rb_intern("to_path")))) {
+ src_fd = -1;
}
else {
- VALUE tmp_io = rb_io_check_io(src_io);
- if (!NIL_P(tmp_io)) {
- src_io = tmp_io;
- }
- else if (!RB_TYPE_P(src_io, T_FILE)) {
- VALUE args[2];
+ if (!RB_TYPE_P(src_io, T_FILE)) {
+ VALUE args[2];
FilePathValue(src_io);
args[0] = src_io;
args[1] = INT2NUM(O_RDONLY|common_oflags);
- src_io = rb_class_new_instance(2, args, rb_cFile);
- stp->src = src_io;
- stp->close_src = 1;
- }
- GetOpenFile(src_io, src_fptr);
- rb_io_check_byte_readable(src_fptr);
- src_fd = src_fptr->fd;
+ src_io = rb_class_new_instance(2, args, rb_cFile);
+ stp->src = src_io;
+ stp->close_src = 1;
+ }
+ GetOpenFile(src_io, src_fptr);
+ rb_io_check_byte_readable(src_fptr);
+ src_fd = src_fptr->fd;
}
stp->src_fd = src_fd;
if (dst_io == argf ||
- !(RB_TYPE_P(dst_io, T_FILE) ||
- RB_TYPE_P(dst_io, T_STRING) ||
- rb_respond_to(dst_io, rb_intern("to_path")))) {
- dst_fd = -1;
+ !(RB_TYPE_P(dst_io, T_FILE) ||
+ RB_TYPE_P(dst_io, T_STRING) ||
+ rb_respond_to(dst_io, rb_intern("to_path")))) {
+ dst_fd = -1;
}
else {
- VALUE tmp_io = rb_io_check_io(dst_io);
- if (!NIL_P(tmp_io)) {
- dst_io = GetWriteIO(tmp_io);
- }
- else if (!RB_TYPE_P(dst_io, T_FILE)) {
- VALUE args[3];
+ if (!RB_TYPE_P(dst_io, T_FILE)) {
+ VALUE args[3];
FilePathValue(dst_io);
args[0] = dst_io;
args[1] = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC|common_oflags);
- args[2] = INT2FIX(0666);
- dst_io = rb_class_new_instance(3, args, rb_cFile);
- stp->dst = dst_io;
- stp->close_dst = 1;
- }
- else {
- dst_io = GetWriteIO(dst_io);
- stp->dst = dst_io;
- }
- GetOpenFile(dst_io, dst_fptr);
- rb_io_check_writable(dst_fptr);
- dst_fd = dst_fptr->fd;
+ args[2] = INT2FIX(0666);
+ dst_io = rb_class_new_instance(3, args, rb_cFile);
+ stp->dst = dst_io;
+ stp->close_dst = 1;
+ }
+ else {
+ dst_io = GetWriteIO(dst_io);
+ stp->dst = dst_io;
+ }
+ GetOpenFile(dst_io, dst_fptr);
+ rb_io_check_writable(dst_fptr);
+ dst_fd = dst_fptr->fd;
}
stp->dst_fd = dst_fd;
@@ -10726,7 +10389,8 @@ copy_stream_finalize(VALUE arg)
}
rb_fd_term(&stp->fds);
if (stp->syserr) {
- rb_syserr_fail(stp->error_no, stp->syserr);
+ errno = stp->error_no;
+ rb_sys_fail(stp->syserr);
}
if (stp->notimp) {
rb_raise(rb_eNotImpError, "%s() not implemented", stp->notimp);
@@ -10796,7 +10460,7 @@ rb_io_s_copy_stream(int argc, VALUE *argv, VALUE io)
* io.external_encoding -> encoding
*
* Returns the Encoding object that represents the encoding of the file.
- * If _io_ is in write mode and no encoding is specified, returns +nil+.
+ * If io is write mode and no encoding is specified, returns <code>nil</code>.
*/
static VALUE
@@ -10821,7 +10485,7 @@ rb_io_external_encoding(VALUE io)
* io.internal_encoding -> encoding
*
* Returns the Encoding of the internal string if conversion is
- * specified. Otherwise returns +nil+.
+ * specified. Otherwise returns nil.
*/
static VALUE
@@ -10891,7 +10555,7 @@ rb_stdio_set_default_encoding(void)
*
* To set the external encoding use +ARGF.set_encoding+.
*
- * For example:
+ * For example:
*
* ARGF.external_encoding #=> #<Encoding:UTF-8>
*
@@ -10916,7 +10580,7 @@ argf_external_encoding(VALUE argf)
* is returned. Otherwise, if +Encoding.default_external+ has been set, that
* value is returned. Failing that, if a default external encoding was
* specified on the command-line, that value is used. If the encoding is
- * unknown, +nil+ is returned.
+ * unknown, nil is returned.
*/
static VALUE
argf_internal_encoding(VALUE argf)
@@ -10949,7 +10613,7 @@ argf_internal_encoding(VALUE argf)
*
* If the external encoding and the internal encoding are specified, the
* optional +Hash+ argument can be used to adjust the conversion process. The
- * structure of this hash is explained in the String#encode documentation.
+ * structure of this hash is explained in the +String#encode+ documentation.
*
* For example:
*
@@ -10996,10 +10660,10 @@ argf_tell(VALUE argf)
/*
* call-seq:
- * ARGF.seek(amount, whence=IO::SEEK_SET) -> 0
+ * ARGF.seek(amount, whence=IO::SEEK_SET) -> 0
*
* Seeks to offset _amount_ (an +Integer+) in the +ARGF+ stream according to
- * the value of _whence_. See IO#seek for further details.
+ * the value of _whence_. See +IO#seek+ for further details.
*/
static VALUE
argf_seek_m(int argc, VALUE *argv, VALUE argf)
@@ -11136,28 +10800,22 @@ argf_eof(VALUE argf)
* called without arguments the contents of this pseudo file are returned in
* their entirety.
*
- * _length_ must be a non-negative integer or +nil+.
+ * _length_ must be a non-negative integer or nil. If it is a positive
+ * integer, +read+ tries to read at most _length_ bytes. It returns nil
+ * if an EOF was encountered before anything could be read. Fewer than
+ * _length_ bytes may be returned if an EOF is encountered during the read.
*
- * If _length_ is a positive integer, +read+ tries to read
- * _length_ bytes without any conversion (binary mode).
- * It returns +nil+ if an EOF is encountered before anything can be read.
- * Fewer than _length_ bytes are returned if an EOF is encountered during
- * the read.
- * In the case of an integer _length_, the resulting string is always
- * in ASCII-8BIT encoding.
+ * If _length_ is omitted or is _nil_, it reads until EOF. A String is
+ * returned even if EOF is encountered before any data is read.
*
- * If _length_ is omitted or is +nil+, it reads until EOF
- * and the encoding conversion is applied, if applicable.
- * A string is returned even if EOF is encountered before any data is read.
+ * If _length_ is zero, it returns _""_.
*
- * If _length_ is zero, it returns an empty string (<code>""</code>).
- *
- * If the optional _outbuf_ argument is present,
- * it must reference a String, which will receive the data.
- * The _outbuf_ will contain only the received data after the method call
+ * If the optional _outbuf_ argument is present, it must reference a String,
+ * which will receive the data.
+ * The <i>outbuf</i> will contain only the received data after the method call
* even if it is not empty at the beginning.
*
- * For example:
+ * For example:
*
* $ echo "small" > small.txt
* $ echo "large" > large.txt
@@ -11168,11 +10826,8 @@ argf_eof(VALUE argf)
* ARGF.read(2) #=> "sm"
* ARGF.read(0) #=> ""
*
- * Note that this method behaves like the fread() function in C.
- * This means it retries to invoke read(2) system calls to read data
- * with the specified length.
- * If you need the behavior like a single read(2) system call,
- * consider ARGF#readpartial or ARGF#read_nonblock.
+ * Note that this method behaves like fread() function in C. If you need the
+ * behavior like read(2) system call, consider +ARGF.readpartial+.
*/
static VALUE
@@ -11211,9 +10866,8 @@ argf_read(int argc, VALUE *argv, VALUE argf)
}
}
else if (argc >= 1) {
- long slen = RSTRING_LEN(str);
- if (slen < len) {
- len -= slen;
+ if (RSTRING_LEN(str) < len) {
+ len -= RSTRING_LEN(str);
argv[0] = INT2NUM(len);
goto retry;
}
@@ -11235,8 +10889,7 @@ argf_forward_call(VALUE arg)
return Qnil;
}
-static VALUE argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts,
- int nonblock);
+static VALUE argf_getpartial(int argc, VALUE *argv, VALUE argf, int nonblock);
/*
* call-seq:
@@ -11247,7 +10900,7 @@ static VALUE argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts,
*
* If the optional _outbuf_ argument is present,
* it must reference a String, which will receive the data.
- * The _outbuf_ will contain only the received data after the method call
+ * The <i>outbuf</i> will contain only the received data after the method call
* even if it is not empty at the beginning.
*
* It raises <code>EOFError</code> on end of ARGF stream.
@@ -11261,7 +10914,7 @@ static VALUE argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts,
static VALUE
argf_readpartial(int argc, VALUE *argv, VALUE argf)
{
- return argf_getpartial(argc, argv, argf, Qnil, 0);
+ return argf_getpartial(argc, argv, argf, 0);
}
/*
@@ -11275,18 +10928,11 @@ argf_readpartial(int argc, VALUE *argv, VALUE argf)
static VALUE
argf_read_nonblock(int argc, VALUE *argv, VALUE argf)
{
- VALUE opts;
-
- rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
-
- if (!NIL_P(opts))
- argc--;
-
- return argf_getpartial(argc, argv, argf, opts, 1);
+ return argf_getpartial(argc, argv, argf, 1);
}
static VALUE
-argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts, int nonblock)
+argf_getpartial(int argc, VALUE *argv, VALUE argf, int nonblock)
{
VALUE tmp, str, length;
@@ -11297,9 +10943,7 @@ argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts, int nonblock)
}
if (!next_argv()) {
- if (!NIL_P(str)) {
- rb_str_resize(str, 0);
- }
+ rb_str_resize(str, 0);
rb_eof_error();
}
if (ARGF_GENERIC_INPUT_P()) {
@@ -11311,17 +10955,16 @@ argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts, int nonblock)
RUBY_METHOD_FUNC(0), Qnil, rb_eEOFError, (VALUE)0);
}
else {
- tmp = io_getpartial(argc, argv, ARGF.current_file, opts, nonblock);
+ tmp = io_getpartial(argc, argv, ARGF.current_file, nonblock, 0);
}
if (NIL_P(tmp)) {
if (ARGF.next_p == -1) {
- return io_nonblock_eof(opts);
+ rb_eof_error();
}
argf_close(argf);
ARGF.next_p = 1;
- if (RARRAY_LEN(ARGF.argv) == 0) {
- return io_nonblock_eof(opts);
- }
+ if (RARRAY_LEN(ARGF.argv) == 0)
+ rb_eof_error();
if (NIL_P(str))
str = rb_str_new(NULL, 0);
return str;
@@ -11488,7 +11131,7 @@ argf_readbyte(VALUE argf)
#define FOREACH_ARGF() while (next_argv())
static VALUE
-argf_block_call_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, argf))
+argf_block_call_i(VALUE i, VALUE argf, int argc, VALUE *argv)
{
const VALUE current = ARGF.current_file;
rb_yield_values2(argc, argv);
@@ -11507,13 +11150,13 @@ argf_block_call(ID mid, int argc, VALUE *argv, VALUE argf)
/*
* call-seq:
- * ARGF.each(sep=$/) {|line| block } -> ARGF
- * ARGF.each(sep=$/, limit) {|line| block } -> ARGF
- * ARGF.each(...) -> an_enumerator
+ * ARGF.each(sep=$/) {|line| block } -> ARGF
+ * ARGF.each(sep=$/,limit) {|line| block } -> ARGF
+ * ARGF.each(...) -> an_enumerator
*
- * ARGF.each_line(sep=$/) {|line| block } -> ARGF
- * ARGF.each_line(sep=$/, limit) {|line| block } -> ARGF
- * ARGF.each_line(...) -> an_enumerator
+ * ARGF.each_line(sep=$/) {|line| block } -> ARGF
+ * ARGF.each_line(sep=$/,limit) {|line| block } -> ARGF
+ * ARGF.each_line(...) -> an_enumerator
*
* Returns an enumerator which iterates over each line (separated by _sep_,
* which defaults to your platform's newline character) of each file in
@@ -11532,7 +11175,7 @@ argf_block_call(ID mid, int argc, VALUE *argv, VALUE argf)
* For example, the following code prints out each line of each named file
* prefixed with its line number, displaying the filename once per file:
*
- * ARGF.each_line do |line|
+ * ARGF.lines do |line|
* puts ARGF.filename if ARGF.lineno == 1
* puts "#{ARGF.lineno}: #{line}"
* end
@@ -11579,7 +11222,7 @@ argf_lines(int argc, VALUE *argv, VALUE argf)
*
* If no block is given, an enumerator is returned instead.
*
- * For example:
+ * For example:
*
* ARGF.bytes.to_a #=> [35, 32, ... 95, 10]
*
@@ -11609,8 +11252,8 @@ argf_bytes(VALUE argf)
/*
* call-seq:
- * ARGF.each_char {|char| block } -> ARGF
- * ARGF.each_char -> an_enumerator
+ * ARGF.each_char {|char| block } -> ARGF
+ * ARGF.each_char -> an_enumerator
*
* Iterates over each character of each file in +ARGF+.
*
@@ -11648,8 +11291,8 @@ argf_chars(VALUE argf)
/*
* call-seq:
- * ARGF.each_codepoint {|codepoint| block } -> ARGF
- * ARGF.each_codepoint -> an_enumerator
+ * ARGF.each_codepoint {|codepoint| block } -> ARGF
+ * ARGF.each_codepoint -> an_enumerator
*
* Iterates over each codepoint of each file in +ARGF+.
*
@@ -11724,8 +11367,8 @@ argf_filename_getter(ID id, VALUE *var)
* call-seq:
* ARGF.file -> IO or File object
*
- * Returns the current file as an +IO+ or +File+ object.
- * <code>#<IO:<STDIN>></code> is returned when the current file is STDIN.
+ * Returns the current file as an +IO+ or +File+ object. #<IO:<STDIN>> is
+ * returned when the current file is STDIN.
*
* For example:
*
@@ -11770,10 +11413,10 @@ argf_binmode_m(VALUE argf)
* call-seq:
* ARGF.binmode? -> true or false
*
- * Returns true if +ARGF+ is being read in binary mode; false otherwise.
- * To enable binary mode use +ARGF.binmode+.
+ * Returns true if +ARGF+ is being read in binary mode; false otherwise. (To
+ * enable binary mode use +ARGF.binmode+.
*
- * For example:
+ * For example:
*
* ARGF.binmode? #=> false
* ARGF.binmode
@@ -11792,7 +11435,7 @@ argf_binmode_p(VALUE argf)
* Sets the current file to the next file in ARGV. If there aren't any more
* files it has no effect.
*
- * For example:
+ * For example:
*
* $ ruby argf.rb foo bar
* ARGF.filename #=> "foo"
@@ -11817,7 +11460,7 @@ argf_skip(VALUE argf)
* close a file that has already been closed causes an +IOError+ to be
* raised.
*
- * For example:
+ * For example:
*
* $ ruby argf.rb foo bar
*
@@ -11871,7 +11514,7 @@ argf_to_s(VALUE argf)
* ARGF.inplace_mode -> String
*
* Returns the file extension appended to the names of modified files under
- * in-place edit mode. This value can be set using +ARGF.inplace_mode=+ or
+ * inplace-edit mode. This value can be set using +ARGF.inplace_mode=+ or
* passing the +-i+ switch to the Ruby binary.
*/
static VALUE
@@ -11891,7 +11534,7 @@ opt_i_get(ID id, VALUE *var)
* call-seq:
* ARGF.inplace_mode = ext -> ARGF
*
- * Sets the filename extension for in-place editing mode to the given String.
+ * Sets the filename extension for inplace editing mode to the given String.
* Each file being edited has this value appended to its filename. The
* modified file is saved under this new name.
*
@@ -11900,12 +11543,12 @@ opt_i_get(ID id, VALUE *var)
* $ ruby argf.rb file.txt
*
* ARGF.inplace_mode = '.bak'
- * ARGF.each_line do |line|
+ * ARGF.lines do |line|
* print line.sub("foo","bar")
* end
*
- * Each line of _file.txt_ has the first occurrence of "foo" replaced with
- * "bar", then the new line is written out to _file.txt.bak_.
+ * Each line of _file.txt_ has the first occurrence of "foo" replaced with
+ * "bar", then the new line is written out to _file.txt.bak_.
*/
static VALUE
argf_inplace_mode_set(VALUE argf, VALUE val)
@@ -12007,15 +11650,10 @@ argf_write(VALUE argf, VALUE str)
}
void
-rb_readwrite_sys_fail(enum rb_io_wait_readwrite writable, const char *mesg)
-{
- rb_readwrite_syserr_fail(writable, errno, mesg);
-}
-
-void
-rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char *mesg)
+rb_readwrite_sys_fail(int writable, const char *mesg)
{
VALUE arg;
+ int n = errno;
arg = mesg ? rb_str_new2(mesg) : Qnil;
if (writable == RB_IO_WAIT_WRITABLE) {
switch (n) {
@@ -12067,8 +11705,8 @@ rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char *
* File.open("/etc/hosts") {|f| f.close; f.read }
* #=> IOError: closed stream
*
- * Note that some IO failures raise <code>SystemCallError</code>s
- * and these are not subclasses of IOError:
+ * Note that some IO failures raise +SystemCallError+s and these are not
+ * subclasses of IOError:
*
* File.open("does/not/exist")
* #=> Errno::ENOENT: No such file or directory - does/not/exist
@@ -12081,7 +11719,7 @@ rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char *
* methods exist in two forms,
*
* one that returns +nil+ when the end of file is reached, the other
- * raises +EOFError+.
+ * raises EOFError +EOFError+.
*
* +EOFError+ is a subclass of +IOError+.
*
@@ -12207,7 +11845,7 @@ rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char *
* Example:
*
* require 'io/console'
- * rows, columns = $stdout.winsize
+ * rows, columns = $stdin.winsize
* puts "Your screen is #{columns} wide and #{rows} tall"
*/
@@ -12358,10 +11996,8 @@ Init_IO(void)
rb_define_method(rb_cIO, "readlines", rb_io_readlines, -1);
- /* for prelude.rb use only: */
- rb_define_private_method(rb_cIO, "__read_nonblock", io_read_nonblock, 3);
- rb_define_private_method(rb_cIO, "__write_nonblock", io_write_nonblock, 2);
-
+ rb_define_method(rb_cIO, "read_nonblock", io_read_nonblock, -1);
+ rb_define_method(rb_cIO, "write_nonblock", rb_io_write_nonblock, -1);
rb_define_method(rb_cIO, "readpartial", io_readpartial, -1);
rb_define_method(rb_cIO, "read", io_read, -1);
rb_define_method(rb_cIO, "write", io_write_m, 1);
@@ -12443,7 +12079,7 @@ Init_IO(void)
#if 0
/* Hack to get rdoc to regard ARGF as a class: */
- rb_cARGF = rb_define_class("ARGF.class", rb_cObject);
+ rb_cARGF = rb_define_class("ARGF", rb_cObject);
#endif
rb_cARGF = rb_class_new(rb_cObject);
@@ -12544,10 +12180,9 @@ Init_IO(void)
sym_mode = ID2SYM(rb_intern("mode"));
sym_perm = ID2SYM(rb_intern("perm"));
- sym_flags = ID2SYM(rb_intern("flags"));
sym_extenc = ID2SYM(rb_intern("external_encoding"));
sym_intenc = ID2SYM(rb_intern("internal_encoding"));
- sym_encoding = ID2SYM(rb_id_encoding());
+ sym_encoding = ID2SYM(rb_intern("encoding"));
sym_open_args = ID2SYM(rb_intern("open_args"));
sym_textmode = ID2SYM(rb_intern("textmode"));
sym_binmode = ID2SYM(rb_intern("binmode"));
@@ -12567,6 +12202,5 @@ Init_IO(void)
#ifdef SEEK_HOLE
sym_HOLE = ID2SYM(rb_intern("HOLE"));
#endif
- sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
- sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
+ sym_exception = ID2SYM(rb_intern("exception"));
}
diff --git a/iseq.c b/iseq.c
index 797473e070..2db1d3be56 100644
--- a/iseq.c
+++ b/iseq.c
@@ -9,14 +9,10 @@
**********************************************************************/
+#include "ruby/ruby.h"
#include "internal.h"
-#include "ruby/util.h"
#include "eval_intern.h"
-#ifdef HAVE_DLADDR
-# include <dlfcn.h>
-#endif
-
/* #define RUBY_MARK_FREE_DEBUG 1 */
#include "gc.h"
#include "vm_core.h"
@@ -25,9 +21,10 @@
#include "insns.inc"
#include "insns_info.inc"
+#define ISEQ_MAJOR_VERSION 2
+#define ISEQ_MINOR_VERSION 1
+
VALUE rb_cISeq;
-static VALUE iseqw_new(const rb_iseq_t *iseq);
-static const rb_iseq_t *iseqw_check(VALUE iseqw);
#define hidden_obj_p(obj) (!SPECIAL_CONST_P(obj) && !RBASIC(obj)->klass)
@@ -62,247 +59,254 @@ compile_data_free(struct iseq_compile_data *compile_data)
}
}
-void
-rb_iseq_free(const rb_iseq_t *iseq)
+static void
+iseq_free(void *ptr)
{
+ rb_iseq_t *iseq;
RUBY_FREE_ENTER("iseq");
- if (iseq) {
- if (iseq->body) {
- ruby_xfree((void *)iseq->body->iseq_encoded);
- ruby_xfree((void *)iseq->body->line_info_table);
- ruby_xfree((void *)iseq->body->local_table);
- ruby_xfree((void *)iseq->body->is_entries);
-
- if (iseq->body->ci_entries) {
- unsigned int i;
- struct rb_call_info_with_kwarg *ci_kw_entries = (struct rb_call_info_with_kwarg *)&iseq->body->ci_entries[iseq->body->ci_size];
- for (i=0; i<iseq->body->ci_kw_size; i++) {
- const struct rb_call_info_kw_arg *kw_arg = ci_kw_entries[i].kw_arg;
- ruby_xfree((void *)kw_arg);
- }
- ruby_xfree(iseq->body->ci_entries);
- ruby_xfree(iseq->body->cc_entries);
+ if (ptr) {
+ iseq = ptr;
+ if (!iseq->orig) {
+ /* It's possible that strings are freed */
+ if (0) {
+ RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label),
+ RSTRING_PTR(iseq->location.path));
}
- ruby_xfree((void *)iseq->body->catch_table);
- ruby_xfree((void *)iseq->body->param.opt_table);
- if (iseq->body->param.keyword != NULL) {
- ruby_xfree((void *)iseq->body->param.keyword->default_values);
- ruby_xfree((void *)iseq->body->param.keyword);
+ if (iseq->iseq != iseq->iseq_encoded) {
+ RUBY_FREE_UNLESS_NULL(iseq->iseq_encoded);
}
- compile_data_free(ISEQ_COMPILE_DATA(iseq));
- ruby_xfree(iseq->body);
+
+ RUBY_FREE_UNLESS_NULL(iseq->iseq);
+ RUBY_FREE_UNLESS_NULL(iseq->line_info_table);
+ RUBY_FREE_UNLESS_NULL(iseq->local_table);
+ RUBY_FREE_UNLESS_NULL(iseq->is_entries);
+ RUBY_FREE_UNLESS_NULL(iseq->callinfo_entries);
+ RUBY_FREE_UNLESS_NULL(iseq->catch_table);
+ RUBY_FREE_UNLESS_NULL(iseq->arg_opt_table);
+ RUBY_FREE_UNLESS_NULL(iseq->arg_keyword_table);
+ compile_data_free(iseq->compile_data);
}
+ ruby_xfree(ptr);
}
RUBY_FREE_LEAVE("iseq");
}
-void
-rb_iseq_mark(const rb_iseq_t *iseq)
+static void
+iseq_mark(void *ptr)
{
RUBY_MARK_ENTER("iseq");
- RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(iseq->body->location.path));
+ if (ptr) {
+ rb_iseq_t *iseq = ptr;
- if (iseq->body) {
- const struct rb_iseq_constant_body *body = iseq->body;
+ RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path));
+ RUBY_MARK_UNLESS_NULL(iseq->mark_ary);
- RUBY_MARK_UNLESS_NULL(body->mark_ary);
- rb_gc_mark(body->location.label);
- rb_gc_mark(body->location.base_label);
- rb_gc_mark(body->location.path);
- RUBY_MARK_UNLESS_NULL(body->location.absolute_path);
- RUBY_MARK_UNLESS_NULL((VALUE)body->parent_iseq);
- }
+ RUBY_MARK_UNLESS_NULL(iseq->location.label);
+ RUBY_MARK_UNLESS_NULL(iseq->location.base_label);
+ RUBY_MARK_UNLESS_NULL(iseq->location.path);
+ RUBY_MARK_UNLESS_NULL(iseq->location.absolute_path);
- if (FL_TEST(iseq, ISEQ_NOT_LOADED_YET)) {
- rb_gc_mark(iseq->aux.loader.obj);
- }
- else if (ISEQ_COMPILE_DATA(iseq) != 0) {
- const struct iseq_compile_data *const compile_data = ISEQ_COMPILE_DATA(iseq);
- RUBY_MARK_UNLESS_NULL(compile_data->mark_ary);
- RUBY_MARK_UNLESS_NULL(compile_data->err_info);
- RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary);
- }
+ RUBY_MARK_UNLESS_NULL((VALUE)iseq->cref_stack);
+ RUBY_MARK_UNLESS_NULL(iseq->klass);
+ RUBY_MARK_UNLESS_NULL(iseq->coverage);
+ RUBY_MARK_UNLESS_NULL(iseq->orig);
+ if (iseq->compile_data != 0) {
+ struct iseq_compile_data *const compile_data = iseq->compile_data;
+ RUBY_MARK_UNLESS_NULL(compile_data->mark_ary);
+ RUBY_MARK_UNLESS_NULL(compile_data->err_info);
+ RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary);
+ }
+ }
RUBY_MARK_LEAVE("iseq");
}
static size_t
-param_keyword_size(const struct rb_iseq_param_keyword *pkw)
+iseq_memsize(const void *ptr)
{
- size_t size = 0;
-
- if (!pkw) return size;
-
- size += sizeof(struct rb_iseq_param_keyword);
- size += sizeof(VALUE) * (pkw->num - pkw->required_num);
-
- return size;
-}
-
-static size_t
-iseq_memsize(const rb_iseq_t *iseq)
-{
- size_t size = 0; /* struct already counted as RVALUE size */
- const struct rb_iseq_constant_body *body = iseq->body;
- const struct iseq_compile_data *compile_data;
-
- /* TODO: should we count original_iseq? */
-
- if (body) {
- struct rb_call_info_with_kwarg *ci_kw_entries = (struct rb_call_info_with_kwarg *)&body->ci_entries[body->ci_size];
-
- size += sizeof(struct rb_iseq_constant_body);
- size += body->iseq_size * sizeof(VALUE);
- size += body->line_info_size * sizeof(struct iseq_line_info_entry);
- size += body->local_table_size * sizeof(ID);
- if (body->catch_table) {
- size += iseq_catch_table_bytes(body->catch_table->size);
- }
- size += (body->param.opt_num + 1) * sizeof(VALUE);
- size += param_keyword_size(body->param.keyword);
+ size_t size = sizeof(rb_iseq_t);
+ const rb_iseq_t *iseq;
- /* body->is_entries */
- size += body->is_size * sizeof(union iseq_inline_storage_entry);
-
- /* body->ci_entries */
- size += body->ci_size * sizeof(struct rb_call_info);
- size += body->ci_kw_size * sizeof(struct rb_call_info_with_kwarg);
-
- /* body->cc_entries */
- size += body->ci_size * sizeof(struct rb_call_cache);
- size += body->ci_kw_size * sizeof(struct rb_call_cache);
-
- if (ci_kw_entries) {
- unsigned int i;
-
- for (i = 0; i < body->ci_kw_size; i++) {
- const struct rb_call_info_kw_arg *kw_arg = ci_kw_entries[i].kw_arg;
+ if (ptr) {
+ iseq = ptr;
+ if (!iseq->orig) {
+ if (iseq->iseq != iseq->iseq_encoded) {
+ size += iseq->iseq_size * sizeof(VALUE);
+ }
- if (kw_arg) {
- size += rb_call_info_kw_arg_bytes(kw_arg->keyword_len);
+ size += iseq->iseq_size * sizeof(VALUE);
+ size += iseq->line_info_size * sizeof(struct iseq_line_info_entry);
+ size += iseq->local_table_size * sizeof(ID);
+ size += iseq->catch_table_size * sizeof(struct iseq_catch_table_entry);
+ size += iseq->arg_opts * sizeof(VALUE);
+ size += iseq->is_size * sizeof(union iseq_inline_storage_entry);
+ size += iseq->callinfo_size * sizeof(rb_call_info_t);
+
+ if (iseq->compile_data) {
+ struct iseq_compile_data_storage *cur;
+
+ cur = iseq->compile_data->storage_head;
+ while (cur) {
+ size += cur->size + sizeof(struct iseq_compile_data_storage);
+ cur = cur->next;
}
+ size += sizeof(struct iseq_compile_data);
}
}
}
- compile_data = ISEQ_COMPILE_DATA(iseq);
- if (compile_data) {
- struct iseq_compile_data_storage *cur;
-
- size += sizeof(struct iseq_compile_data);
-
- cur = compile_data->storage_head;
- while (cur) {
- size += cur->size + SIZEOF_ISEQ_COMPILE_DATA_STORAGE;
- cur = cur->next;
- }
- }
-
return size;
}
-static rb_iseq_t *
-iseq_alloc(void)
+static const rb_data_type_t iseq_data_type = {
+ "iseq",
+ {
+ iseq_mark,
+ iseq_free,
+ iseq_memsize,
+ }, /* functions */
+ NULL, NULL,
+ RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
+};
+
+static VALUE
+iseq_alloc(VALUE klass)
{
- rb_iseq_t *iseq = iseq_imemo_alloc();
- iseq->body = ZALLOC(struct rb_iseq_constant_body);
- return iseq;
+ rb_iseq_t *iseq;
+ return TypedData_Make_Struct(klass, rb_iseq_t, &iseq_data_type, iseq);
}
static rb_iseq_location_t *
-iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, VALUE first_lineno)
+iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, size_t first_lineno)
{
- rb_iseq_location_t *loc = &iseq->body->location;
- RB_OBJ_WRITE(iseq, &loc->path, path);
+ rb_iseq_location_t *loc = &iseq->location;
+ OBJ_WRITE(iseq->self, &loc->path, path);
if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0) {
- RB_OBJ_WRITE(iseq, &loc->absolute_path, path);
+ OBJ_WRITE(iseq->self, &loc->absolute_path, path);
}
else {
- RB_OBJ_WRITE(iseq, &loc->absolute_path, absolute_path);
+ OBJ_WRITE(iseq->self, &loc->absolute_path, absolute_path);
}
- RB_OBJ_WRITE(iseq, &loc->label, name);
- RB_OBJ_WRITE(iseq, &loc->base_label, name);
+ OBJ_WRITE(iseq->self, &loc->label, name);
+ OBJ_WRITE(iseq->self, &loc->base_label, name);
loc->first_lineno = first_lineno;
return loc;
}
+#define ISEQ_SET_CREF(iseq, cref) OBJ_WRITE((iseq)->self, &(iseq)->cref_stack, (cref))
+
static void
-set_relation(rb_iseq_t *iseq, const rb_iseq_t *piseq)
+set_relation(rb_iseq_t *iseq, const VALUE parent)
{
- const VALUE type = iseq->body->type;
+ const VALUE type = iseq->type;
+ rb_thread_t *th = GET_THREAD();
+ rb_iseq_t *piseq;
/* set class nest stack */
if (type == ISEQ_TYPE_TOP) {
- iseq->body->local_iseq = iseq;
+ /* toplevel is private */
+ OBJ_WRITE(iseq->self, &iseq->cref_stack, NEW_CREF(rb_cObject));
+ iseq->cref_stack->nd_refinements = Qnil;
+ iseq->cref_stack->nd_visi = NOEX_PRIVATE;
+ if (th->top_wrapper) {
+ NODE *cref = NEW_CREF(th->top_wrapper);
+ cref->nd_refinements = Qnil;
+ cref->nd_visi = NOEX_PRIVATE;
+ cref->nd_next = iseq->cref_stack;
+ ISEQ_SET_CREF(iseq, cref);
+ }
+ iseq->local_iseq = iseq;
}
else if (type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) {
- iseq->body->local_iseq = iseq;
+ ISEQ_SET_CREF(iseq, NEW_CREF(0)); /* place holder */
+ iseq->cref_stack->nd_refinements = Qnil;
+ iseq->local_iseq = iseq;
}
- else if (piseq) {
- iseq->body->local_iseq = piseq->body->local_iseq;
+ else if (RTEST(parent)) {
+ GetISeqPtr(parent, piseq);
+ ISEQ_SET_CREF(iseq, piseq->cref_stack);
+ iseq->local_iseq = piseq->local_iseq;
}
- if (piseq) {
- iseq->body->parent_iseq = piseq;
+ if (RTEST(parent)) {
+ GetISeqPtr(parent, piseq);
+ iseq->parent_iseq = piseq;
}
if (type == ISEQ_TYPE_MAIN) {
- iseq->body->local_iseq = iseq;
+ iseq->local_iseq = iseq;
}
}
void
-rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj)
+rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj)
{
- /* TODO: check dedup */
- rb_ary_push(ISEQ_MARK_ARY(iseq), obj);
+ if (!RTEST(iseq->mark_ary)) {
+ OBJ_WRITE(iseq->self, &iseq->mark_ary, rb_ary_tmp_new(3));
+ RBASIC_CLEAR_CLASS(iseq->mark_ary);
+ }
+ rb_ary_push(iseq->mark_ary, obj);
}
static VALUE
prepare_iseq_build(rb_iseq_t *iseq,
VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
- const rb_iseq_t *parent, enum iseq_type type,
+ VALUE parent, enum iseq_type type, VALUE block_opt,
const rb_compile_option_t *option)
{
- iseq->body->type = type;
+ iseq->type = type;
+ iseq->arg_rest = -1;
+ iseq->arg_block = -1;
+ iseq->arg_keyword = -1;
+ OBJ_WRITE(iseq->self, &iseq->klass, 0);
set_relation(iseq, parent);
- name = rb_fstring(name);
- path = rb_fstring(path);
- if (RTEST(absolute_path)) absolute_path = rb_fstring(absolute_path);
+ OBJ_FREEZE(name);
+ OBJ_FREEZE(path);
+
iseq_location_setup(iseq, path, absolute_path, name, first_lineno);
- if (iseq != iseq->body->local_iseq) {
- RB_OBJ_WRITE(iseq, &iseq->body->location.base_label, iseq->body->local_iseq->body->location.label);
+ if (iseq != iseq->local_iseq) {
+ OBJ_WRITE(iseq->self, &iseq->location.base_label, iseq->local_iseq->location.label);
}
- RB_OBJ_WRITE(iseq, &iseq->body->mark_ary, iseq_mark_ary_create(0));
- ISEQ_COMPILE_DATA(iseq) = ZALLOC(struct iseq_compile_data);
- RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, Qnil);
- RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->mark_ary, rb_ary_tmp_new(3));
+ iseq->defined_method_id = 0;
+ OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
+
+ /*
+ * iseq->special_block_builder = GC_GUARDED_PTR_REF(block_opt);
+ * iseq->cached_special_block_builder = 0;
+ * iseq->cached_special_block = 0;
+ */
- ISEQ_COMPILE_DATA(iseq)->storage_head = ISEQ_COMPILE_DATA(iseq)->storage_current =
+ iseq->compile_data = ALLOC(struct iseq_compile_data);
+ MEMZERO(iseq->compile_data, struct iseq_compile_data, 1);
+ OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, Qnil);
+ OBJ_WRITE(iseq->self, &iseq->compile_data->mark_ary, rb_ary_tmp_new(3));
+
+ iseq->compile_data->storage_head = iseq->compile_data->storage_current =
(struct iseq_compile_data_storage *)
ALLOC_N(char, INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE +
- SIZEOF_ISEQ_COMPILE_DATA_STORAGE);
+ sizeof(struct iseq_compile_data_storage));
- RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, rb_ary_tmp_new(3));
- ISEQ_COMPILE_DATA(iseq)->storage_head->pos = 0;
- ISEQ_COMPILE_DATA(iseq)->storage_head->next = 0;
- ISEQ_COMPILE_DATA(iseq)->storage_head->size =
+ OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, rb_ary_new());
+ iseq->compile_data->storage_head->pos = 0;
+ iseq->compile_data->storage_head->next = 0;
+ iseq->compile_data->storage_head->size =
INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE;
- ISEQ_COMPILE_DATA(iseq)->option = option;
- ISEQ_COMPILE_DATA(iseq)->last_coverable_line = -1;
-
- ISEQ_COVERAGE_SET(iseq, Qfalse);
+ iseq->compile_data->storage_head->buff =
+ (char *)(&iseq->compile_data->storage_head->buff + 1);
+ iseq->compile_data->option = option;
+ iseq->compile_data->last_coverable_line = -1;
+ OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
if (!GET_THREAD()->parse_in_eval) {
VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) {
- ISEQ_COVERAGE_SET(iseq, rb_hash_lookup(coverages, path));
- if (NIL_P(ISEQ_COVERAGE(iseq))) ISEQ_COVERAGE_SET(iseq, Qfalse);
+ OBJ_WRITE(iseq->self, &iseq->coverage, rb_hash_lookup(coverages, path));
+ if (NIL_P(iseq->coverage)) OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
}
}
@@ -312,13 +316,13 @@ prepare_iseq_build(rb_iseq_t *iseq,
static VALUE
cleanup_iseq_build(rb_iseq_t *iseq)
{
- struct iseq_compile_data *data = ISEQ_COMPILE_DATA(iseq);
+ struct iseq_compile_data *data = iseq->compile_data;
VALUE err = data->err_info;
- ISEQ_COMPILE_DATA(iseq) = 0;
+ iseq->compile_data = 0;
compile_data_free(data);
if (RTEST(err)) {
- rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->body->location.path);
+ rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->location.path);
rb_exc_raise(err);
}
return Qtrue;
@@ -333,47 +337,10 @@ static rb_compile_option_t COMPILE_OPTION_DEFAULT = {
OPT_INSTRUCTIONS_UNIFICATION, /* int instructions_unification; */
OPT_STACK_CACHING, /* int stack_caching; */
OPT_TRACE_INSTRUCTION, /* int trace_instruction */
- OPT_FROZEN_STRING_LITERAL,
- OPT_DEBUG_FROZEN_STRING_LITERAL,
};
-
static const rb_compile_option_t COMPILE_OPTION_FALSE = {0};
static void
-set_compile_option_from_hash(rb_compile_option_t *option, VALUE opt)
-{
-#define SET_COMPILE_OPTION(o, h, mem) \
- { VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \
- if (flag == Qtrue) { (o)->mem = 1; } \
- else if (flag == Qfalse) { (o)->mem = 0; } \
- }
-#define SET_COMPILE_OPTION_NUM(o, h, mem) \
- { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
- if (!NIL_P(num)) (o)->mem = NUM2INT(num); \
- }
- SET_COMPILE_OPTION(option, opt, inline_const_cache);
- SET_COMPILE_OPTION(option, opt, peephole_optimization);
- SET_COMPILE_OPTION(option, opt, tailcall_optimization);
- SET_COMPILE_OPTION(option, opt, specialized_instruction);
- SET_COMPILE_OPTION(option, opt, operands_unification);
- SET_COMPILE_OPTION(option, opt, instructions_unification);
- SET_COMPILE_OPTION(option, opt, stack_caching);
- SET_COMPILE_OPTION(option, opt, trace_instruction);
- SET_COMPILE_OPTION(option, opt, frozen_string_literal);
- SET_COMPILE_OPTION(option, opt, debug_frozen_string_literal);
- SET_COMPILE_OPTION_NUM(option, opt, debug_level);
-#undef SET_COMPILE_OPTION
-#undef SET_COMPILE_OPTION_NUM
-}
-
-void
-rb_iseq_make_compile_option(rb_compile_option_t *option, VALUE opt)
-{
- Check_Type(opt, T_HASH);
- set_compile_option_from_hash(option, opt);
-}
-
-static void
make_compile_option(rb_compile_option_t *option, VALUE opt)
{
if (opt == Qnil) {
@@ -389,7 +356,27 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
}
else if (CLASS_OF(opt) == rb_cHash) {
*option = COMPILE_OPTION_DEFAULT;
- set_compile_option_from_hash(option, opt);
+
+#define SET_COMPILE_OPTION(o, h, mem) \
+ { VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \
+ if (flag == Qtrue) { (o)->mem = 1; } \
+ else if (flag == Qfalse) { (o)->mem = 0; } \
+ }
+#define SET_COMPILE_OPTION_NUM(o, h, mem) \
+ { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
+ if (!NIL_P(num)) (o)->mem = NUM2INT(num); \
+ }
+ SET_COMPILE_OPTION(option, opt, inline_const_cache);
+ SET_COMPILE_OPTION(option, opt, peephole_optimization);
+ SET_COMPILE_OPTION(option, opt, tailcall_optimization);
+ SET_COMPILE_OPTION(option, opt, specialized_instruction);
+ SET_COMPILE_OPTION(option, opt, operands_unification);
+ SET_COMPILE_OPTION(option, opt, instructions_unification);
+ SET_COMPILE_OPTION(option, opt, stack_caching);
+ SET_COMPILE_OPTION(option, opt, trace_instruction);
+ SET_COMPILE_OPTION_NUM(option, opt, debug_level);
+#undef SET_COMPILE_OPTION
+#undef SET_COMPILE_OPTION_NUM
}
else {
rb_raise(rb_eTypeError, "Compile option must be Hash/true/false/nil");
@@ -413,8 +400,6 @@ make_compile_option_value(rb_compile_option_t *option)
SET_COMPILE_OPTION(option, opt, instructions_unification);
SET_COMPILE_OPTION(option, opt, stack_caching);
SET_COMPILE_OPTION(option, opt, trace_instruction);
- SET_COMPILE_OPTION(option, opt, frozen_string_literal);
- SET_COMPILE_OPTION(option, opt, debug_frozen_string_literal);
SET_COMPILE_OPTION_NUM(option, opt, debug_level);
}
#undef SET_COMPILE_OPTION
@@ -422,116 +407,82 @@ make_compile_option_value(rb_compile_option_t *option)
return opt;
}
-rb_iseq_t *
+VALUE
rb_iseq_new(NODE *node, VALUE name, VALUE path, VALUE absolute_path,
- const rb_iseq_t *parent, enum iseq_type type)
+ VALUE parent, enum iseq_type type)
{
return rb_iseq_new_with_opt(node, name, path, absolute_path, INT2FIX(0), parent, type,
&COMPILE_OPTION_DEFAULT);
}
-rb_iseq_t *
-rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, const rb_iseq_t *parent)
+VALUE
+rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE parent)
{
return rb_iseq_new_with_opt(node, name, path, absolute_path, INT2FIX(0), parent, ISEQ_TYPE_TOP,
&COMPILE_OPTION_DEFAULT);
}
-rb_iseq_t *
+VALUE
rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path)
{
rb_thread_t *th = GET_THREAD();
- const rb_iseq_t *parent = th->base_block->iseq;
+ VALUE parent = th->base_block->iseq->self;
return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), path, absolute_path, INT2FIX(0),
parent, ISEQ_TYPE_MAIN, &COMPILE_OPTION_DEFAULT);
}
-static inline rb_iseq_t *
-iseq_translate(rb_iseq_t *iseq)
+static VALUE
+rb_iseq_new_with_bopt_and_opt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
+ VALUE parent, enum iseq_type type, VALUE bopt,
+ const rb_compile_option_t *option)
{
- if (rb_respond_to(rb_cISeq, rb_intern("translate"))) {
- VALUE v1 = iseqw_new(iseq);
- VALUE v2 = rb_funcall(rb_cISeq, rb_intern("translate"), 1, v1);
- if (v1 != v2 && CLASS_OF(v2) == rb_cISeq) {
- iseq = (rb_iseq_t *)iseqw_check(v2);
- }
- }
+ rb_iseq_t *iseq;
+ VALUE self = iseq_alloc(rb_cISeq);
- return iseq;
+ GetISeqPtr(self, iseq);
+ iseq->self = self;
+
+ prepare_iseq_build(iseq, name, path, absolute_path, first_lineno, parent, type, bopt, option);
+ rb_iseq_compile_node(self, node);
+ cleanup_iseq_build(iseq);
+ return self;
}
-rb_iseq_t *
-rb_iseq_new_with_opt(NODE *node, VALUE name, VALUE path, VALUE absolute_path,
- VALUE first_lineno, const rb_iseq_t *parent,
- enum iseq_type type, const rb_compile_option_t *option)
+VALUE
+rb_iseq_new_with_opt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
+ VALUE parent, enum iseq_type type,
+ const rb_compile_option_t *option)
{
/* TODO: argument check */
- rb_iseq_t *iseq = iseq_alloc();
-
- if (!option) option = &COMPILE_OPTION_DEFAULT;
- prepare_iseq_build(iseq, name, path, absolute_path, first_lineno, parent, type, option);
-
- rb_iseq_compile_node(iseq, node);
- cleanup_iseq_build(iseq);
-
- return iseq_translate(iseq);
+ return rb_iseq_new_with_bopt_and_opt(node, name, path, absolute_path, first_lineno, parent, type,
+ Qfalse, option);
}
-const rb_iseq_t *
-rb_iseq_load_iseq(VALUE fname)
+VALUE
+rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
+ VALUE parent, enum iseq_type type, VALUE bopt)
{
- VALUE iseqv = rb_check_funcall(rb_cISeq, rb_intern("load_iseq"), 1, &fname);
-
- if (!SPECIAL_CONST_P(iseqv) && RBASIC_CLASS(iseqv) == rb_cISeq) {
- return iseqw_check(iseqv);
- }
-
- return NULL;
+ /* TODO: argument check */
+ return rb_iseq_new_with_bopt_and_opt(node, name, path, absolute_path, first_lineno, parent, type,
+ bopt, &COMPILE_OPTION_DEFAULT);
}
#define CHECK_ARRAY(v) rb_convert_type((v), T_ARRAY, "Array", "to_ary")
-#define CHECK_HASH(v) rb_convert_type((v), T_HASH, "Hash", "to_hash")
#define CHECK_STRING(v) rb_convert_type((v), T_STRING, "String", "to_str")
#define CHECK_SYMBOL(v) rb_convert_type((v), T_SYMBOL, "Symbol", "to_sym")
static inline VALUE CHECK_INTEGER(VALUE v) {(void)NUM2LONG(v); return v;}
-
-static enum iseq_type
-iseq_type_from_sym(VALUE type)
-{
- const ID id_top = rb_intern("top");
- const ID id_method = rb_intern("method");
- const ID id_block = rb_intern("block");
- const ID id_class = rb_intern("class");
- const ID id_rescue = rb_intern("rescue");
- const ID id_ensure = rb_intern("ensure");
- const ID id_eval = rb_intern("eval");
- const ID id_main = rb_intern("main");
- const ID id_defined_guard = rb_intern("defined_guard");
- /* ensure all symbols are static or pinned down before
- * conversion */
- const ID typeid = rb_check_id(&type);
- if (typeid == id_top) return ISEQ_TYPE_TOP;
- if (typeid == id_method) return ISEQ_TYPE_METHOD;
- if (typeid == id_block) return ISEQ_TYPE_BLOCK;
- if (typeid == id_class) return ISEQ_TYPE_CLASS;
- if (typeid == id_rescue) return ISEQ_TYPE_RESCUE;
- if (typeid == id_ensure) return ISEQ_TYPE_ENSURE;
- if (typeid == id_eval) return ISEQ_TYPE_EVAL;
- if (typeid == id_main) return ISEQ_TYPE_MAIN;
- if (typeid == id_defined_guard) return ISEQ_TYPE_DEFINED_GUARD;
- return (enum iseq_type)-1;
-}
-
static VALUE
-iseq_load(VALUE data, const rb_iseq_t *parent, VALUE opt)
+iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
{
- rb_iseq_t *iseq = iseq_alloc();
+ VALUE iseqval = iseq_alloc(self);
VALUE magic, version1, version2, format_type, misc;
VALUE name, path, absolute_path, first_lineno;
- VALUE type, body, locals, params, exception;
+ VALUE type, body, locals, args, exception;
st_data_t iseq_type;
+ struct st_table *type_map = 0;
+ rb_iseq_t *iseq;
rb_compile_option_t option;
int i = 0;
@@ -546,8 +497,8 @@ iseq_load(VALUE data, const rb_iseq_t *parent, VALUE opt)
version1 = CHECK_INTEGER(rb_ary_entry(data, i++));
version2 = CHECK_INTEGER(rb_ary_entry(data, i++));
format_type = CHECK_INTEGER(rb_ary_entry(data, i++));
- misc = CHECK_HASH(rb_ary_entry(data, i++));
- ((void)magic, (void)version1, (void)version2, (void)format_type);
+ misc = rb_ary_entry(data, i++); /* TODO */
+ ((void)magic, (void)version1, (void)version2, (void)format_type, (void)misc);
name = CHECK_STRING(rb_ary_entry(data, i++));
path = CHECK_STRING(rb_ary_entry(data, i++));
@@ -557,27 +508,53 @@ iseq_load(VALUE data, const rb_iseq_t *parent, VALUE opt)
type = CHECK_SYMBOL(rb_ary_entry(data, i++));
locals = CHECK_ARRAY(rb_ary_entry(data, i++));
- params = CHECK_HASH(rb_ary_entry(data, i++));
+
+ args = rb_ary_entry(data, i++);
+ if (FIXNUM_P(args) || (args = CHECK_ARRAY(args))) {
+ /* */
+ }
+
exception = CHECK_ARRAY(rb_ary_entry(data, i++));
body = CHECK_ARRAY(rb_ary_entry(data, i++));
- iseq->body->local_iseq = iseq;
+ GetISeqPtr(iseqval, iseq);
+ iseq->self = iseqval;
+ iseq->local_iseq = iseq;
- iseq_type = iseq_type_from_sym(type);
- if (iseq_type == (enum iseq_type)-1) {
- rb_raise(rb_eTypeError, "unsupport type: :%"PRIsVALUE, rb_sym2str(type));
+ if (type_map == 0) {
+ type_map = st_init_numtable();
+ st_insert(type_map, ID2SYM(rb_intern("top")), ISEQ_TYPE_TOP);
+ st_insert(type_map, ID2SYM(rb_intern("method")), ISEQ_TYPE_METHOD);
+ st_insert(type_map, ID2SYM(rb_intern("block")), ISEQ_TYPE_BLOCK);
+ st_insert(type_map, ID2SYM(rb_intern("class")), ISEQ_TYPE_CLASS);
+ st_insert(type_map, ID2SYM(rb_intern("rescue")), ISEQ_TYPE_RESCUE);
+ st_insert(type_map, ID2SYM(rb_intern("ensure")), ISEQ_TYPE_ENSURE);
+ st_insert(type_map, ID2SYM(rb_intern("eval")), ISEQ_TYPE_EVAL);
+ st_insert(type_map, ID2SYM(rb_intern("main")), ISEQ_TYPE_MAIN);
+ st_insert(type_map, ID2SYM(rb_intern("defined_guard")), ISEQ_TYPE_DEFINED_GUARD);
+ }
+
+ if (st_lookup(type_map, type, &iseq_type) == 0) {
+ ID typeid = SYM2ID(type);
+ VALUE typename = rb_id2str(typeid);
+ if (typename)
+ rb_raise(rb_eTypeError, "unsupport type: :%"PRIsVALUE, typename);
+ else
+ rb_raise(rb_eTypeError, "unsupport type: %p", (void *)typeid);
+ }
+
+ if (parent == Qnil) {
+ parent = 0;
}
make_compile_option(&option, opt);
- option.peephole_optimization = FALSE; /* because peephole optimization can modify original iseq */
prepare_iseq_build(iseq, name, path, absolute_path, first_lineno,
- parent, (enum iseq_type)iseq_type, &option);
+ parent, (enum iseq_type)iseq_type, 0, &option);
- rb_iseq_build_from_ary(iseq, misc, locals, params, exception, body);
+ rb_iseq_build_from_ary(iseq, locals, args, exception, body);
cleanup_iseq_build(iseq);
-
- return iseqw_new(iseq);
+ return iseqval;
}
/*
@@ -588,172 +565,81 @@ iseq_s_load(int argc, VALUE *argv, VALUE self)
{
VALUE data, opt=Qnil;
rb_scan_args(argc, argv, "11", &data, &opt);
- return iseq_load(data, NULL, opt);
+
+ return iseq_load(self, data, 0, opt);
}
VALUE
rb_iseq_load(VALUE data, VALUE parent, VALUE opt)
{
- return iseq_load(data, RTEST(parent) ? (rb_iseq_t *)parent : NULL, opt);
+ return iseq_load(rb_cISeq, data, parent, opt);
}
-rb_iseq_t *
+VALUE
rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt)
{
int state;
rb_thread_t *th = GET_THREAD();
rb_block_t *prev_base_block = th->base_block;
- rb_iseq_t *iseq = NULL;
- const rb_iseq_t *parent = NULL;
- rb_compile_option_t option;
- VALUE label;
- enum iseq_type type;
- NODE *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start);
- int ln = NUM2INT(line);
-
- StringValueCStr(file);
- if (RB_TYPE_P(src, T_FILE)) {
- parse = rb_parser_compile_file_path;
- }
- else {
- StringValue(src);
- parse = rb_parser_compile_string_path;
- }
-
- make_compile_option(&option, opt);
-
- if (base_block && (parent = base_block->iseq) != NULL) {
- label = parent->body->location.label;
- type = ISEQ_TYPE_EVAL;
- }
- else {
- label = rb_fstring_cstr("<compiled>");
- type = ISEQ_TYPE_TOP;
- }
+ VALUE iseqval = Qundef;
th->base_block = base_block;
+
TH_PUSH_TAG(th);
if ((state = EXEC_TAG()) == 0) {
- NODE *node = (*parse)(rb_parser_new(), file, src, ln);
- if (node) { /* TODO: check err */
- iseq = rb_iseq_new_with_opt(node, label, file, absolute_path, line,
- parent, type, &option);
+ VALUE parser;
+ int ln = NUM2INT(line);
+ NODE *node;
+ rb_compile_option_t option;
+
+ StringValueCStr(file);
+ make_compile_option(&option, opt);
+
+ parser = rb_parser_new();
+
+ if (RB_TYPE_P((src), T_FILE))
+ node = rb_parser_compile_file_path(parser, file, src, ln);
+ else {
+ node = rb_parser_compile_string_path(parser, file, src, ln);
+
+ if (!node) {
+ rb_exc_raise(GET_THREAD()->errinfo); /* TODO: check err */
+ }
+ }
+
+ if (base_block && base_block->iseq) {
+ iseqval = rb_iseq_new_with_opt(node, base_block->iseq->location.label,
+ file, absolute_path, line, base_block->iseq->self,
+ ISEQ_TYPE_EVAL, &option);
+ }
+ else {
+ iseqval = rb_iseq_new_with_opt(node, rb_str_new2("<compiled>"), file, absolute_path, line, Qfalse,
+ ISEQ_TYPE_TOP, &option);
}
}
TH_POP_TAG();
th->base_block = prev_base_block;
- if (!iseq) rb_exc_raise(th->errinfo);
if (state) {
JUMP_TAG(state);
}
- return iseq;
+ return iseqval;
}
-rb_iseq_t *
+VALUE
rb_iseq_compile(VALUE src, VALUE file, VALUE line)
{
return rb_iseq_compile_with_option(src, file, Qnil, line, 0, Qnil);
}
-rb_iseq_t *
+VALUE
rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, rb_block_t *base_block)
{
return rb_iseq_compile_with_option(src, file, Qnil, line, base_block, Qnil);
}
-VALUE
-rb_iseq_path(const rb_iseq_t *iseq)
-{
- return iseq->body->location.path;
-}
-
-VALUE
-rb_iseq_absolute_path(const rb_iseq_t *iseq)
-{
- return iseq->body->location.absolute_path;
-}
-
-VALUE
-rb_iseq_label(const rb_iseq_t *iseq)
-{
- return iseq->body->location.label;
-}
-
-VALUE
-rb_iseq_base_label(const rb_iseq_t *iseq)
-{
- return iseq->body->location.base_label;
-}
-
-VALUE
-rb_iseq_first_lineno(const rb_iseq_t *iseq)
-{
- return iseq->body->location.first_lineno;
-}
-
-VALUE
-rb_iseq_method_name(const rb_iseq_t *iseq)
-{
- const rb_iseq_t *local_iseq;
-
- local_iseq = iseq->body->local_iseq;
-
- if (local_iseq->body->type == ISEQ_TYPE_METHOD) {
- return local_iseq->body->location.base_label;
- }
- else {
- return Qnil;
- }
-}
-
-VALUE
-rb_iseq_coverage(const rb_iseq_t *iseq)
-{
- return ISEQ_COVERAGE(iseq);
-}
-
-/* define wrapper class methods (RubyVM::InstructionSequence) */
-
-static void
-iseqw_mark(void *ptr)
-{
- rb_gc_mark((VALUE)ptr);
-}
-
-static size_t
-iseqw_memsize(const void *ptr)
-{
- return iseq_memsize((const rb_iseq_t *)ptr);
-}
-
-static const rb_data_type_t iseqw_data_type = {
- "T_IMEMO/iseq",
- {iseqw_mark, NULL, iseqw_memsize,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED
-};
-
-static VALUE
-iseqw_new(const rb_iseq_t *iseq)
-{
- union { const rb_iseq_t *in; void *out; } deconst;
- VALUE obj;
-
- deconst.in = iseq;
- obj = TypedData_Wrap_Struct(rb_cISeq, &iseqw_data_type, deconst.out);
- RB_OBJ_WRITTEN(obj, Qundef, iseq);
-
- return obj;
-}
-
-VALUE
-rb_iseqw_new(const rb_iseq_t *iseq)
-{
- return iseqw_new(iseq);
-}
-
/*
* call-seq:
* InstructionSequence.compile(source[, file[, path[, line[, options]]]]) -> iseq
@@ -776,16 +662,17 @@ rb_iseqw_new(const rb_iseq_t *iseq)
*
*/
static VALUE
-iseqw_s_compile(int argc, VALUE *argv, VALUE self)
+iseq_s_compile(int argc, VALUE *argv, VALUE self)
{
VALUE src, file = Qnil, path = Qnil, line = INT2FIX(1), opt = Qnil;
+
rb_secure(1);
rb_scan_args(argc, argv, "14", &src, &file, &path, &line, &opt);
if (NIL_P(file)) file = rb_str_new2("<compiled>");
if (NIL_P(line)) line = INT2FIX(1);
- return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, 0, opt));
+ return rb_iseq_compile_with_option(src, file, path, line, 0, opt);
}
/*
@@ -809,10 +696,11 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self)
* #=> <RubyVM::InstructionSequence:<main>@/tmp/hello.rb>
*/
static VALUE
-iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
+iseq_s_compile_file(int argc, VALUE *argv, VALUE self)
{
VALUE file, line = INT2FIX(1), opt = Qnil;
- VALUE parser, f, exc = Qnil;
+ VALUE parser;
+ VALUE f;
NODE *node;
const char *fname;
rb_compile_option_t option;
@@ -826,16 +714,10 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
parser = rb_parser_new();
node = rb_parser_compile_file(parser, fname, f, NUM2INT(line));
- if (!node) exc = GET_THREAD()->errinfo;
-
- rb_io_close(f);
- if (!node) rb_exc_raise(exc);
-
make_compile_option(&option, opt);
-
- return iseqw_new(rb_iseq_new_with_opt(node, rb_str_new2("<main>"), file,
- rb_realpath_internal(Qnil, file, 1), line, NULL,
- ISEQ_TYPE_TOP, &option));
+ return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), file,
+ rb_realpath_internal(Qnil, file, 1), line, Qfalse,
+ ISEQ_TYPE_TOP, &option);
}
/*
@@ -871,7 +753,7 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
* ::new, ::compile and ::compile_file.
*/
static VALUE
-iseqw_s_compile_option_set(VALUE self, VALUE opt)
+iseq_s_compile_option_set(VALUE self, VALUE opt)
{
rb_compile_option_t option;
rb_secure(1);
@@ -889,32 +771,22 @@ iseqw_s_compile_option_set(VALUE self, VALUE opt)
* For details, see InstructionSequence.compile_option=.
*/
static VALUE
-iseqw_s_compile_option_get(VALUE self)
+iseq_s_compile_option_get(VALUE self)
{
return make_compile_option_value(&COMPILE_OPTION_DEFAULT);
}
-static const rb_iseq_t *
-iseqw_check(VALUE iseqw)
+static rb_iseq_t *
+iseq_check(VALUE val)
{
- rb_iseq_t *iseq = DATA_PTR(iseqw);
-
- if (!iseq->body) {
- ibf_load_iseq_complete(iseq);
- }
-
- if (!iseq->body->location.label) {
+ rb_iseq_t *iseq;
+ GetISeqPtr(val, iseq);
+ if (!iseq->location.label) {
rb_raise(rb_eTypeError, "uninitialized InstructionSequence");
}
return iseq;
}
-const rb_iseq_t *
-rb_iseqw_to_iseq(VALUE iseqw)
-{
- return iseqw_check(iseqw);
-}
-
/*
* call-seq:
* iseq.eval -> obj
@@ -924,10 +796,10 @@ rb_iseqw_to_iseq(VALUE iseqw)
* RubyVM::InstructionSequence.compile("1 + 2").eval #=> 3
*/
static VALUE
-iseqw_eval(VALUE self)
+iseq_eval(VALUE self)
{
rb_secure(1);
- return rb_iseq_eval(iseqw_check(self));
+ return rb_iseq_eval(self);
}
/*
@@ -935,18 +807,17 @@ iseqw_eval(VALUE self)
* sequence, including the #label and #path.
*/
static VALUE
-iseqw_inspect(VALUE self)
+iseq_inspect(VALUE self)
{
- const rb_iseq_t *iseq = iseqw_check(self);
-
- if (!iseq->body->location.label) {
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ if (!iseq->location.label) {
return rb_sprintf("#<%s: uninitialized>", rb_obj_classname(self));
}
- else {
- return rb_sprintf("<%s:%s@%s>",
- rb_obj_classname(self),
- RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(iseq->body->location.path));
- }
+
+ return rb_sprintf("<%s:%s@%s>",
+ rb_obj_classname(self),
+ RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path));
}
/*
@@ -972,10 +843,12 @@ iseqw_inspect(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.path #=> /tmp/method.rb
*/
-static VALUE
-iseqw_path(VALUE self)
+VALUE
+rb_iseq_path(VALUE self)
{
- return rb_iseq_path(iseqw_check(self));
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.path;
}
/*
@@ -994,10 +867,12 @@ iseqw_path(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.absolute_path #=> /tmp/method.rb
*/
-static VALUE
-iseqw_absolute_path(VALUE self)
+VALUE
+rb_iseq_absolute_path(VALUE self)
{
- return rb_iseq_absolute_path(iseqw_check(self));
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.absolute_path;
}
/* Returns the label of this instruction sequence.
@@ -1023,10 +898,12 @@ iseqw_absolute_path(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.label #=> <main>
*/
-static VALUE
-iseqw_label(VALUE self)
+VALUE
+rb_iseq_label(VALUE self)
{
- return rb_iseq_label(iseqw_check(self));
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.label;
}
/* Returns the base label of this instruction sequence.
@@ -1049,10 +926,12 @@ iseqw_label(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.base_label #=> <main>
*/
-static VALUE
-iseqw_base_label(VALUE self)
+VALUE
+rb_iseq_base_label(VALUE self)
{
- return rb_iseq_base_label(iseqw_check(self));
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.base_label;
}
/* Returns the number of the first source line where the instruction sequence
@@ -1065,13 +944,38 @@ iseqw_base_label(VALUE self)
* iseq.first_lineno
* #=> 1
*/
-static VALUE
-iseqw_first_lineno(VALUE self)
+VALUE
+rb_iseq_first_lineno(VALUE self)
{
- return rb_iseq_first_lineno(iseqw_check(self));
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->location.first_lineno;
}
-static VALUE iseq_data_to_ary(const rb_iseq_t *iseq);
+VALUE
+rb_iseq_klass(VALUE self)
+{
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->local_iseq->klass;
+}
+
+VALUE
+rb_iseq_method_name(VALUE self)
+{
+ rb_iseq_t *iseq, *local_iseq;
+ GetISeqPtr(self, iseq);
+ local_iseq = iseq->local_iseq;
+ if (local_iseq->type == ISEQ_TYPE_METHOD) {
+ return local_iseq->location.base_label;
+ }
+ else {
+ return Qnil;
+ }
+}
+
+static
+VALUE iseq_data_to_ary(rb_iseq_t *iseq);
/*
* call-seq:
@@ -1138,8 +1042,14 @@ static VALUE iseq_data_to_ary(const rb_iseq_t *iseq);
* An array containing the names of all arguments and local variables as
* symbols.
*
- * [params]
- * An Hash object containing parameter information.
+ * [args]
+ * The arity if the method or block only has required arguments.
+ *
+ * Otherwise an array of:
+ *
+ * [required_argc, [optional_arg_labels, ...],
+ * splat_index, post_splat_argc, post_splat_index,
+ * block_index, simple]
*
* More info about these values can be found in +vm_core.h+.
*
@@ -1151,13 +1061,11 @@ static VALUE iseq_data_to_ary(const rb_iseq_t *iseq);
* An array of arrays containing the instruction names and operands that
* make up the body of the instruction sequence.
*
- * Note that this format is MRI specific and version dependent.
- *
*/
static VALUE
-iseqw_to_a(VALUE self)
+iseq_to_a(VALUE self)
{
- const rb_iseq_t *iseq = iseqw_check(self);
+ rb_iseq_t *iseq = iseq_check(self);
rb_secure(1);
return iseq_data_to_ary(iseq);
}
@@ -1165,11 +1073,11 @@ iseqw_to_a(VALUE self)
/* TODO: search algorithm is brute force.
this should be binary search or so. */
-static const struct iseq_line_info_entry *
+static struct iseq_line_info_entry *
get_line_info(const rb_iseq_t *iseq, size_t pos)
{
- size_t i = 0, size = iseq->body->line_info_size;
- const struct iseq_line_info_entry *table = iseq->body->line_info_table;
+ size_t i = 0, size = iseq->line_info_size;
+ struct iseq_line_info_entry *table = iseq->line_info_table;
const int debug = 0;
if (debug) {
@@ -1203,8 +1111,7 @@ get_line_info(const rb_iseq_t *iseq, size_t pos)
static unsigned int
find_line_no(const rb_iseq_t *iseq, size_t pos)
{
- const struct iseq_line_info_entry *entry = get_line_info(iseq, pos);
-
+ struct iseq_line_info_entry *entry = get_line_info(iseq, pos);
if (entry) {
return entry->line_no;
}
@@ -1238,13 +1145,13 @@ id_to_name(ID id, VALUE default_value)
}
VALUE
-rb_insn_operand_intern(const rb_iseq_t *iseq,
+rb_insn_operand_intern(rb_iseq_t *iseq,
VALUE insn, int op_no, VALUE op,
- int len, size_t pos, const VALUE *pnop, VALUE child)
+ int len, size_t pos, VALUE *pnop, VALUE child)
{
const char *types = insn_op_types(insn);
char type = types[op_no];
- VALUE ret = Qundef;
+ VALUE ret;
switch (type) {
case TS_OFFSET: /* LONG */
@@ -1258,13 +1165,13 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
case TS_LINDEX:{
if (insn == BIN(getlocal) || insn == BIN(setlocal)) {
if (pnop) {
- const rb_iseq_t *diseq = iseq;
+ rb_iseq_t *diseq = iseq;
VALUE level = *pnop, i;
for (i = 0; i < level; i++) {
- diseq = diseq->body->parent_iseq;
+ diseq = diseq->parent_iseq;
}
- ret = id_to_name(diseq->body->local_table[diseq->body->local_size - op], INT2FIX('*'));
+ ret = id_to_name(diseq->local_table[diseq->local_size - op], INT2FIX('*'));
}
else {
ret = rb_sprintf("%"PRIuVALUE, op);
@@ -1290,11 +1197,11 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
case TS_ISEQ: /* iseq */
{
- if (op) {
- const rb_iseq_t *iseq = rb_iseq_check((rb_iseq_t *)op);
- ret = iseq->body->location.label;
+ rb_iseq_t *iseq = (rb_iseq_t *)op;
+ if (iseq) {
+ ret = iseq->location.label;
if (child) {
- rb_ary_push(child, (VALUE)iseq);
+ rb_ary_push(child, iseq->self);
}
}
else {
@@ -1310,24 +1217,25 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
break;
case TS_IC:
- ret = rb_sprintf("<is:%"PRIdPTRDIFF">", (union iseq_inline_storage_entry *)op - iseq->body->is_entries);
+ ret = rb_sprintf("<is:%"PRIdPTRDIFF">", (union iseq_inline_storage_entry *)op - iseq->is_entries);
break;
case TS_CALLINFO:
{
- struct rb_call_info *ci = (struct rb_call_info *)op;
+ rb_call_info_t *ci = (rb_call_info_t *)op;
VALUE ary = rb_ary_new();
if (ci->mid) {
- rb_ary_push(ary, rb_sprintf("mid:%"PRIsVALUE, rb_id2str(ci->mid)));
+ rb_ary_push(ary, rb_sprintf("mid:%s", rb_id2name(ci->mid)));
}
rb_ary_push(ary, rb_sprintf("argc:%d", ci->orig_argc));
- if (ci->flag & VM_CALL_KWARG) {
- struct rb_call_info_kw_arg *kw_args = ((struct rb_call_info_with_kwarg *)ci)->kw_arg;
- VALUE kw_ary = rb_ary_new_from_values(kw_args->keyword_len, kw_args->keywords);
- rb_ary_push(ary, rb_sprintf("kw:[%"PRIsVALUE"]", rb_ary_join(kw_ary, rb_str_new2(","))));
+ if (ci->blockiseq) {
+ if (child) {
+ rb_ary_push(child, ci->blockiseq->self);
+ }
+ rb_ary_push(ary, rb_sprintf("block:%"PRIsVALUE, ci->blockiseq->location.label));
}
if (ci->flag) {
@@ -1338,34 +1246,20 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
if (ci->flag & VM_CALL_VCALL) rb_ary_push(flags, rb_str_new2("VCALL"));
if (ci->flag & VM_CALL_TAILCALL) rb_ary_push(flags, rb_str_new2("TAILCALL"));
if (ci->flag & VM_CALL_SUPER) rb_ary_push(flags, rb_str_new2("SUPER"));
- if (ci->flag & VM_CALL_KWARG) rb_ary_push(flags, rb_str_new2("KWARG"));
if (ci->flag & VM_CALL_OPT_SEND) rb_ary_push(flags, rb_str_new2("SNED")); /* maybe not reachable */
- if (ci->flag & VM_CALL_ARGS_SIMPLE) rb_ary_push(flags, rb_str_new2("ARGS_SIMPLE")); /* maybe not reachable */
+ if (ci->flag & VM_CALL_ARGS_SKIP_SETUP) rb_ary_push(flags, rb_str_new2("ARGS_SKIP")); /* maybe not reachable */
rb_ary_push(ary, rb_ary_join(flags, rb_str_new2("|")));
}
ret = rb_sprintf("<callinfo!%"PRIsVALUE">", rb_ary_join(ary, rb_str_new2(", ")));
}
break;
- case TS_CALLCACHE:
- ret = rb_str_new2("<callcache>");
- break;
-
case TS_CDHASH:
ret = rb_str_new2("<cdhash>");
break;
case TS_FUNCPTR:
- {
-#ifdef HAVE_DLADDR
- Dl_info info;
- if (dladdr((void *)op, &info) && info.dli_sname) {
- ret = rb_str_new_cstr(info.dli_sname);
- break;
- }
-#endif
- ret = rb_str_new2("<funcptr>");
- }
+ ret = rb_str_new2("<funcptr>");
break;
default:
@@ -1379,10 +1273,10 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
* Iseq -> Iseq inspect object
*/
int
-rb_iseq_disasm_insn(VALUE ret, const VALUE *code, size_t pos,
- const rb_iseq_t *iseq, VALUE child)
+rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, size_t pos,
+ rb_iseq_t *iseqdat, VALUE child)
{
- VALUE insn = code[pos];
+ VALUE insn = iseq[pos];
int len = insn_len(insn);
int j;
const char *types = insn_op_types(insn);
@@ -1400,8 +1294,8 @@ rb_iseq_disasm_insn(VALUE ret, const VALUE *code, size_t pos,
for (j = 0; types[j]; j++) {
const char *types = insn_op_types(insn);
- VALUE opstr = rb_insn_operand_intern(iseq, insn, j, code[pos + j + 1],
- len, pos, &code[pos + j + 2],
+ VALUE opstr = rb_insn_operand_intern(iseqdat, insn, j, iseq[pos + j + 1],
+ len, pos, &iseq[pos + j + 2],
child);
rb_str_concat(str, opstr);
@@ -1411,8 +1305,8 @@ rb_iseq_disasm_insn(VALUE ret, const VALUE *code, size_t pos,
}
{
- unsigned int line_no = find_line_no(iseq, pos);
- unsigned int prev = pos == 0 ? 0 : find_line_no(iseq, pos - 1);
+ unsigned int line_no = find_line_no(iseqdat, pos);
+ unsigned int prev = pos == 0 ? 0 : find_line_no(iseqdat, pos - 1);
if (line_no && line_no != prev) {
long slen = RSTRING_LEN(str);
slen = (slen > 70) ? 0 : (70 - slen);
@@ -1452,37 +1346,46 @@ catch_type(int type)
}
}
-static VALUE
-iseq_inspect(const rb_iseq_t *iseq)
-{
- if (!iseq->body->location.label) {
- return rb_sprintf("#<ISeq: uninitialized>");
- }
- else {
- return rb_sprintf("#<ISeq:%s@%s>", RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(iseq->body->location.path));
- }
-}
-
+/*
+ * call-seq:
+ * iseq.disasm -> str
+ * iseq.disassemble -> str
+ *
+ * Returns the instruction sequence as a +String+ in human readable form.
+ *
+ * puts RubyVM::InstructionSequence.compile('1 + 2').disasm
+ *
+ * Produces:
+ *
+ * == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
+ * 0000 trace 1 ( 1)
+ * 0002 putobject 1
+ * 0004 putobject 2
+ * 0006 opt_plus <ic:1>
+ * 0008 leave
+ */
VALUE
-rb_iseq_disasm(const rb_iseq_t *iseq)
+rb_iseq_disasm(VALUE self)
{
- VALUE *code;
+ rb_iseq_t *iseqdat = iseq_check(self);
+ VALUE *iseq;
VALUE str = rb_str_new(0, 0);
- VALUE child = rb_ary_tmp_new(3);
- unsigned int size;
- unsigned int i;
+ VALUE child = rb_ary_new();
+ unsigned long size;
+ int i;
long l;
- const ID *tbl;
+ ID *tbl;
size_t n;
enum {header_minlen = 72};
rb_secure(1);
- size = iseq->body->iseq_size;
+ iseq = iseqdat->iseq;
+ size = iseqdat->iseq_size;
rb_str_cat2(str, "== disasm: ");
- rb_str_concat(str, iseq_inspect(iseq));
+ rb_str_concat(str, iseq_inspect(iseqdat->self));
if ((l = RSTRING_LEN(str)) < header_minlen) {
rb_str_resize(str, header_minlen);
memset(RSTRING_PTR(str) + l, '=', header_minlen - l);
@@ -1490,67 +1393,61 @@ rb_iseq_disasm(const rb_iseq_t *iseq)
rb_str_cat2(str, "\n");
/* show catch table information */
- if (iseq->body->catch_table) {
+ if (iseqdat->catch_table_size != 0) {
rb_str_cat2(str, "== catch table\n");
}
- if (iseq->body->catch_table) {
- for (i = 0; i < iseq->body->catch_table->size; i++) {
- const struct iseq_catch_table_entry *entry = &iseq->body->catch_table->entries[i];
- rb_str_catf(str,
- "| catch type: %-6s st: %04d ed: %04d sp: %04d cont: %04d\n",
- catch_type((int)entry->type), (int)entry->start,
- (int)entry->end, (int)entry->sp, (int)entry->cont);
- if (entry->iseq) {
- rb_str_concat(str, rb_iseq_disasm(rb_iseq_check(entry->iseq)));
- }
+ for (i = 0; i < iseqdat->catch_table_size; i++) {
+ struct iseq_catch_table_entry *entry = &iseqdat->catch_table[i];
+ rb_str_catf(str,
+ "| catch type: %-6s st: %04d ed: %04d sp: %04d cont: %04d\n",
+ catch_type((int)entry->type), (int)entry->start,
+ (int)entry->end, (int)entry->sp, (int)entry->cont);
+ if (entry->iseq) {
+ rb_str_concat(str, rb_iseq_disasm(entry->iseq));
}
}
- if (iseq->body->catch_table) {
+ if (iseqdat->catch_table_size != 0) {
rb_str_cat2(str, "|-------------------------------------"
"-----------------------------------\n");
}
/* show local table information */
- tbl = iseq->body->local_table;
+ tbl = iseqdat->local_table;
if (tbl) {
rb_str_catf(str,
"local table (size: %d, argc: %d "
- "[opts: %d, rest: %d, post: %d, block: %d, kw: %d@%d, kwrest: %d])\n",
- iseq->body->local_size,
- iseq->body->param.lead_num,
- iseq->body->param.opt_num,
- iseq->body->param.flags.has_rest ? iseq->body->param.rest_start : -1,
- iseq->body->param.post_num,
- iseq->body->param.flags.has_block ? iseq->body->param.block_start : -1,
- iseq->body->param.flags.has_kw ? iseq->body->param.keyword->num : -1,
- iseq->body->param.flags.has_kw ? iseq->body->param.keyword->required_num : -1,
- iseq->body->param.flags.has_kwrest ? iseq->body->param.keyword->rest_start : -1);
-
- for (i = 0; i < iseq->body->local_table_size; i++) {
- int li = (int)i;
+ "[opts: %d, rest: %d, post: %d, block: %d, keyword: %d@%d] s%d)\n",
+ iseqdat->local_size, iseqdat->argc,
+ iseqdat->arg_opts, iseqdat->arg_rest,
+ iseqdat->arg_post_len, iseqdat->arg_block,
+ iseqdat->arg_keywords, iseqdat->local_size-iseqdat->arg_keyword,
+ iseqdat->arg_simple);
+
+ for (i = 0; i < iseqdat->local_table_size; i++) {
long width;
VALUE name = id_to_name(tbl[i], 0);
char argi[0x100] = "";
char opti[0x100] = "";
- if (iseq->body->param.flags.has_opt) {
- int argc = iseq->body->param.lead_num;
- int opts = iseq->body->param.opt_num;
- if (li >= argc && li < argc + opts) {
+ if (iseqdat->arg_opts) {
+ int argc = iseqdat->argc;
+ int opts = iseqdat->arg_opts;
+ if (i >= argc && i < argc + opts - 1) {
snprintf(opti, sizeof(opti), "Opt=%"PRIdVALUE,
- iseq->body->param.opt_table[li - argc]);
+ iseqdat->arg_opt_table[i - argc]);
}
}
snprintf(argi, sizeof(argi), "%s%s%s%s%s", /* arg, opts, rest, post block */
- iseq->body->param.lead_num > li ? "Arg" : "",
+ iseqdat->argc > i ? "Arg" : "",
opti,
- (iseq->body->param.flags.has_rest && iseq->body->param.rest_start == li) ? "Rest" : "",
- (iseq->body->param.flags.has_post && iseq->body->param.post_start <= li && li < iseq->body->param.post_start + iseq->body->param.post_num) ? "Post" : "",
- (iseq->body->param.flags.has_block && iseq->body->param.block_start == li) ? "Block" : "");
+ iseqdat->arg_rest == i ? "Rest" : "",
+ (iseqdat->arg_post_start <= i &&
+ i < iseqdat->arg_post_start + iseqdat->arg_post_len) ? "Post" : "",
+ iseqdat->arg_block == i ? "Block" : "");
- rb_str_catf(str, "[%2d] ", iseq->body->local_size - i);
+ rb_str_catf(str, "[%2d] ", iseqdat->local_size - i);
width = RSTRING_LEN(str) + 11;
if (name)
rb_str_append(str, name);
@@ -1563,44 +1460,19 @@ rb_iseq_disasm(const rb_iseq_t *iseq)
}
/* show each line */
- code = rb_iseq_original_iseq(iseq);
for (n = 0; n < size;) {
- n += rb_iseq_disasm_insn(str, code, n, iseq, child);
+ n += rb_iseq_disasm_insn(str, iseq, n, iseqdat, child);
}
- for (l = 0; l < RARRAY_LEN(child); l++) {
- VALUE isv = rb_ary_entry(child, l);
- rb_str_concat(str, rb_iseq_disasm(rb_iseq_check((rb_iseq_t *)isv)));
+ for (i = 0; i < RARRAY_LEN(child); i++) {
+ VALUE isv = rb_ary_entry(child, i);
+ rb_str_concat(str, rb_iseq_disasm(isv));
}
return str;
}
/*
- * call-seq:
- * iseq.disasm -> str
- * iseq.disassemble -> str
- *
- * Returns the instruction sequence as a +String+ in human readable form.
- *
- * puts RubyVM::InstructionSequence.compile('1 + 2').disasm
- *
- * Produces:
- *
- * == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
- * 0000 trace 1 ( 1)
- * 0002 putobject 1
- * 0004 putobject 2
- * 0006 opt_plus <ic:1>
- * 0008 leave
- */
-static VALUE
-iseqw_disasm(VALUE self)
-{
- return rb_iseq_disasm(iseqw_check(self));
-}
-
-/*
* Returns the instruction sequence containing the given proc or method.
*
* For example, using irb:
@@ -1636,9 +1508,10 @@ iseqw_disasm(VALUE self)
* > #=> #<RubyVM::InstructionSequence:0x007fb73d7caf78>
*/
static VALUE
-iseqw_s_of(VALUE klass, VALUE body)
+iseq_s_of(VALUE klass, VALUE body)
{
- const rb_iseq_t *iseq = NULL;
+ VALUE ret = Qnil;
+ rb_iseq_t *iseq;
rb_secure(1);
@@ -1646,16 +1519,14 @@ iseqw_s_of(VALUE klass, VALUE body)
rb_proc_t *proc;
GetProcPtr(body, proc);
iseq = proc->block.iseq;
-
- if (!RUBY_VM_NORMAL_ISEQ_P(iseq)) {
- iseq = NULL;
+ if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
+ ret = iseq->self;
}
}
- else {
- iseq = rb_method_iseq(body);
+ else if ((iseq = rb_method_get_iseq(body)) != 0) {
+ ret = iseq->self;
}
-
- return iseq ? iseqw_new(iseq) : Qnil;
+ return ret;
}
/*
@@ -1710,11 +1581,12 @@ iseqw_s_of(VALUE klass, VALUE body)
* 0012 leave
*
*/
+
static VALUE
-iseqw_s_disasm(VALUE klass, VALUE body)
+iseq_s_disasm(VALUE klass, VALUE body)
{
- VALUE iseqw = iseqw_s_of(klass, body);
- return NIL_P(iseqw) ? Qnil : rb_iseq_disasm(iseqw_check(iseqw));
+ VALUE iseqval = iseq_s_of(klass, body);
+ return NIL_P(iseqval) ? Qnil : rb_iseq_disasm(iseqval);
}
const char *
@@ -1737,7 +1609,11 @@ ruby_node_name(int node)
static VALUE
register_label(struct st_table *table, unsigned long idx)
{
- VALUE sym = rb_str_intern(rb_sprintf("label_%lu", idx));
+ VALUE sym;
+ char buff[8 + (sizeof(idx) * CHAR_BIT * 32 / 100)];
+
+ snprintf(buff, sizeof(buff), "label_%lu", idx);
+ sym = ID2SYM(rb_intern(buff));
st_insert(table, idx, sym);
return sym;
}
@@ -1754,7 +1630,7 @@ exception_type2symbol(VALUE type)
case CATCH_TYPE_REDO: CONST_ID(id, "redo"); break;
case CATCH_TYPE_NEXT: CONST_ID(id, "next"); break;
default:
- rb_bug("exception_type2symbol: unknown type %d", (int)type);
+ rb_bug("...");
}
return ID2SYM(id);
}
@@ -1768,19 +1644,18 @@ cdhash_each(VALUE key, VALUE value, VALUE ary)
}
static VALUE
-iseq_data_to_ary(const rb_iseq_t *iseq)
+iseq_data_to_ary(rb_iseq_t *iseq)
{
- unsigned int i;
- long l;
+ long i;
size_t ti;
unsigned int pos;
unsigned int line = 0;
- VALUE *seq, *iseq_original;
+ VALUE *seq;
VALUE val = rb_ary_new();
VALUE type; /* Symbol */
VALUE locals = rb_ary_new();
- VALUE params = rb_hash_new();
+ VALUE args = rb_ary_new();
VALUE body = rb_ary_new(); /* [[:insn1, ...], ...] */
VALUE nbody;
VALUE exception = rb_ary_new(); /* [[....]] */
@@ -1816,7 +1691,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
}
/* type */
- switch (iseq->body->type) {
+ switch (iseq->type) {
case ISEQ_TYPE_TOP: type = sym_top; break;
case ISEQ_TYPE_METHOD: type = sym_method; break;
case ISEQ_TYPE_BLOCK: type = sym_block; break;
@@ -1830,68 +1705,53 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
};
/* locals */
- for (i=0; i<iseq->body->local_table_size; i++) {
- ID lid = iseq->body->local_table[i];
+ for (i=0; i<iseq->local_table_size; i++) {
+ ID lid = iseq->local_table[i];
if (lid) {
- if (rb_id2str(lid)) {
- rb_ary_push(locals, ID2SYM(lid));
- }
- else { /* hidden variable from id_internal() */
- rb_ary_push(locals, ULONG2NUM(iseq->body->local_table_size-i+1));
- }
+ if (rb_id2str(lid)) rb_ary_push(locals, ID2SYM(lid));
}
else {
rb_ary_push(locals, ID2SYM(rb_intern("#arg_rest")));
}
}
- /* params */
+ /* args */
{
+ /*
+ * [argc, # argc
+ * [label1, label2, ...] # opts
+ * rest index,
+ * post_len
+ * post_start
+ * block index,
+ * simple,
+ * ]
+ */
+ VALUE arg_opt_labels = rb_ary_new();
int j;
- if (iseq->body->param.flags.has_opt) {
- int len = iseq->body->param.opt_num + 1;
- VALUE arg_opt_labels = rb_ary_new2(len);
-
- for (j = 0; j < len; j++) {
- VALUE l = register_label(labels_table, iseq->body->param.opt_table[j]);
- rb_ary_push(arg_opt_labels, l);
- }
- rb_hash_aset(params, ID2SYM(rb_intern("opt")), arg_opt_labels);
- }
+ for (j=0; j<iseq->arg_opts; j++) {
+ rb_ary_push(arg_opt_labels,
+ register_label(labels_table, iseq->arg_opt_table[j]));
+ }
/* commit */
- if (iseq->body->param.flags.has_lead) rb_hash_aset(params, ID2SYM(rb_intern("lead_num")), INT2FIX(iseq->body->param.lead_num));
- if (iseq->body->param.flags.has_post) rb_hash_aset(params, ID2SYM(rb_intern("post_num")), INT2FIX(iseq->body->param.post_num));
- if (iseq->body->param.flags.has_post) rb_hash_aset(params, ID2SYM(rb_intern("post_start")), INT2FIX(iseq->body->param.post_start));
- if (iseq->body->param.flags.has_rest) rb_hash_aset(params, ID2SYM(rb_intern("rest_start")), INT2FIX(iseq->body->param.rest_start));
- if (iseq->body->param.flags.has_block) rb_hash_aset(params, ID2SYM(rb_intern("block_start")), INT2FIX(iseq->body->param.block_start));
- if (iseq->body->param.flags.has_kw) {
- VALUE keywords = rb_ary_new();
- int i, j;
- for (i=0; i<iseq->body->param.keyword->required_num; i++) {
- rb_ary_push(keywords, ID2SYM(iseq->body->param.keyword->table[i]));
- }
- for (j=0; i<iseq->body->param.keyword->num; i++, j++) {
- VALUE key = rb_ary_new_from_args(1, ID2SYM(iseq->body->param.keyword->table[i]));
- if (iseq->body->param.keyword->default_values[j] != Qundef) {
- rb_ary_push(key, iseq->body->param.keyword->default_values[j]);
- }
- rb_ary_push(keywords, key);
- }
-
- rb_hash_aset(params, ID2SYM(rb_intern("kwbits")),
- INT2FIX(iseq->body->param.keyword->bits_start));
- rb_hash_aset(params, ID2SYM(rb_intern("keyword")), keywords);
+ if (iseq->arg_simple == 1) {
+ args = INT2FIX(iseq->argc);
+ }
+ else {
+ rb_ary_push(args, INT2FIX(iseq->argc));
+ rb_ary_push(args, arg_opt_labels);
+ rb_ary_push(args, INT2FIX(iseq->arg_post_len));
+ rb_ary_push(args, INT2FIX(iseq->arg_post_start));
+ rb_ary_push(args, INT2FIX(iseq->arg_rest));
+ rb_ary_push(args, INT2FIX(iseq->arg_block));
+ rb_ary_push(args, INT2FIX(iseq->arg_simple));
}
- if (iseq->body->param.flags.has_kwrest) rb_hash_aset(params, ID2SYM(rb_intern("kwrest")), INT2FIX(iseq->body->param.keyword->rest_start));
- if (iseq->body->param.flags.ambiguous_param0) rb_hash_aset(params, ID2SYM(rb_intern("ambiguous_param0")), Qtrue);
}
/* body */
- iseq_original = rb_iseq_original_iseq((rb_iseq_t *)iseq);
-
- for (seq = iseq_original; seq < iseq_original + iseq->body->iseq_size; ) {
+ for (seq = iseq->iseq; seq < iseq->iseq + iseq->iseq_size; ) {
VALUE insn = *seq++;
int j, len = insn_len(insn);
VALUE *nseq = seq + len - 1;
@@ -1901,7 +1761,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
for (j=0; j<len-1; j++, seq++) {
switch (insn_op_type(insn, j)) {
case TS_OFFSET: {
- unsigned long idx = nseq - iseq_original + *seq;
+ unsigned long idx = nseq - iseq->iseq + *seq;
rb_ary_push(ary, register_label(labels_table, idx));
break;
}
@@ -1914,9 +1774,9 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
break;
case TS_ISEQ:
{
- const rb_iseq_t *iseq = (rb_iseq_t *)*seq;
+ rb_iseq_t *iseq = (rb_iseq_t *)*seq;
if (iseq) {
- VALUE val = iseq_data_to_ary(rb_iseq_check(iseq));
+ VALUE val = iseq_data_to_ary(iseq);
rb_ary_push(ary, val);
}
else {
@@ -1933,38 +1793,20 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
case TS_IC:
{
union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)*seq;
- rb_ary_push(ary, INT2FIX(is - iseq->body->is_entries));
+ rb_ary_push(ary, INT2FIX(is - iseq->is_entries));
}
break;
case TS_CALLINFO:
{
- struct rb_call_info *ci = (struct rb_call_info *)*seq;
+ rb_call_info_t *ci = (rb_call_info_t *)*seq;
VALUE e = rb_hash_new();
- int orig_argc = ci->orig_argc;
-
rb_hash_aset(e, ID2SYM(rb_intern("mid")), ci->mid ? ID2SYM(ci->mid) : Qnil);
- rb_hash_aset(e, ID2SYM(rb_intern("flag")), UINT2NUM(ci->flag));
-
- if (ci->flag & VM_CALL_KWARG) {
- struct rb_call_info_with_kwarg *ci_kw = (struct rb_call_info_with_kwarg *)ci;
- int i;
- VALUE kw = rb_ary_new2((long)ci_kw->kw_arg->keyword_len);
-
- orig_argc -= ci_kw->kw_arg->keyword_len;
- for (i = 0; i < ci_kw->kw_arg->keyword_len; i++) {
- rb_ary_push(kw, ci_kw->kw_arg->keywords[i]);
- }
- rb_hash_aset(e, ID2SYM(rb_intern("kw_arg")), kw);
- }
-
- rb_hash_aset(e, ID2SYM(rb_intern("orig_argc")),
- INT2FIX(orig_argc));
+ rb_hash_aset(e, ID2SYM(rb_intern("flag")), ULONG2NUM(ci->flag));
+ rb_hash_aset(e, ID2SYM(rb_intern("orig_argc")), INT2FIX(ci->orig_argc));
+ rb_hash_aset(e, ID2SYM(rb_intern("blockptr")), ci->blockiseq ? iseq_data_to_ary(ci->blockiseq) : Qnil);
rb_ary_push(ary, e);
}
break;
- case TS_CALLCACHE:
- rb_ary_push(ary, Qfalse);
- break;
case TS_ID:
rb_ary_push(ary, ID2SYM(*seq));
break;
@@ -1978,7 +1820,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
for (i=0; i<RARRAY_LEN(val); i+=2) {
VALUE pos = FIX2INT(rb_ary_entry(val, i+1));
- unsigned long idx = nseq - iseq_original + pos;
+ unsigned long idx = nseq - iseq->iseq + pos;
rb_ary_store(val, i+1,
register_label(labels_table, idx));
@@ -1986,16 +1828,6 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
rb_ary_push(ary, val);
}
break;
- case TS_FUNCPTR:
- {
-#if SIZEOF_VALUE <= SIZEOF_LONG
- VALUE val = LONG2NUM((SIGNED_VALUE)*seq);
-#else
- VALUE val = LL2NUM((SIGNED_VALUE)*seq);
-#endif
- rb_ary_push(ary, val);
- }
- break;
default:
rb_bug("unknown operand: %c", insn_op_type(insn, j));
}
@@ -2006,12 +1838,14 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
nbody = body;
/* exception */
- if (iseq->body->catch_table) for (i=0; i<iseq->body->catch_table->size; i++) {
+ for (i=0; i<iseq->catch_table_size; i++) {
VALUE ary = rb_ary_new();
- const struct iseq_catch_table_entry *entry = &iseq->body->catch_table->entries[i];
+ struct iseq_catch_table_entry *entry = &iseq->catch_table[i];
rb_ary_push(ary, exception_type2symbol(entry->type));
if (entry->iseq) {
- rb_ary_push(ary, iseq_data_to_ary(rb_iseq_check(entry->iseq)));
+ rb_iseq_t *eiseq;
+ GetISeqPtr(entry->iseq, eiseq);
+ rb_ary_push(ary, iseq_data_to_ary(eiseq));
}
else {
rb_ary_push(ary, Qnil);
@@ -2019,7 +1853,7 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
rb_ary_push(ary, register_label(labels_table, entry->start));
rb_ary_push(ary, register_label(labels_table, entry->end));
rb_ary_push(ary, register_label(labels_table, entry->cont));
- rb_ary_push(ary, UINT2NUM(entry->sp));
+ rb_ary_push(ary, INT2FIX(entry->sp));
rb_ary_push(exception, ary);
}
@@ -2027,16 +1861,16 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
body = rb_ary_new();
ti = 0;
- for (l=0, pos=0; l<RARRAY_LEN(nbody); l++) {
- VALUE ary = RARRAY_AREF(nbody, l);
+ for (i=0, pos=0; i<RARRAY_LEN(nbody); i++) {
+ VALUE ary = RARRAY_AREF(nbody, i);
st_data_t label;
if (st_lookup(labels_table, pos, &label)) {
rb_ary_push(body, (VALUE)label);
}
- if (ti < iseq->body->line_info_size && iseq->body->line_info_table[ti].position == pos) {
- line = iseq->body->line_info_table[ti].line_no;
+ if (ti < iseq->line_info_size && iseq->line_info_table[ti].position == pos) {
+ line = iseq->line_info_table[ti].line_no;
rb_ary_push(body, INT2FIX(line));
ti++;
}
@@ -2044,13 +1878,12 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
rb_ary_push(body, ary);
pos += RARRAY_LENINT(ary); /* reject too huge data */
}
- RB_GC_GUARD(nbody);
st_free_table(labels_table);
- rb_hash_aset(misc, ID2SYM(rb_intern("arg_size")), INT2FIX(iseq->body->param.size));
- rb_hash_aset(misc, ID2SYM(rb_intern("local_size")), INT2FIX(iseq->body->local_size));
- rb_hash_aset(misc, ID2SYM(rb_intern("stack_max")), INT2FIX(iseq->body->stack_max));
+ rb_hash_aset(misc, ID2SYM(rb_intern("arg_size")), INT2FIX(iseq->arg_size));
+ rb_hash_aset(misc, ID2SYM(rb_intern("local_size")), INT2FIX(iseq->local_size));
+ rb_hash_aset(misc, ID2SYM(rb_intern("stack_max")), INT2FIX(iseq->stack_max));
/* TODO: compatibility issue */
/*
@@ -2063,26 +1896,57 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
rb_ary_push(val, INT2FIX(ISEQ_MINOR_VERSION)); /* minor */
rb_ary_push(val, INT2FIX(1));
rb_ary_push(val, misc);
- rb_ary_push(val, iseq->body->location.label);
- rb_ary_push(val, iseq->body->location.path);
- rb_ary_push(val, iseq->body->location.absolute_path);
- rb_ary_push(val, iseq->body->location.first_lineno);
+ rb_ary_push(val, iseq->location.label);
+ rb_ary_push(val, iseq->location.path);
+ rb_ary_push(val, iseq->location.absolute_path);
+ rb_ary_push(val, iseq->location.first_lineno);
rb_ary_push(val, type);
rb_ary_push(val, locals);
- rb_ary_push(val, params);
+ rb_ary_push(val, args);
rb_ary_push(val, exception);
rb_ary_push(val, body);
return val;
}
VALUE
+rb_iseq_clone(VALUE iseqval, VALUE newcbase)
+{
+ VALUE newiseq = iseq_alloc(rb_cISeq);
+ rb_iseq_t *iseq0, *iseq1;
+
+ GetISeqPtr(iseqval, iseq0);
+ GetISeqPtr(newiseq, iseq1);
+
+ MEMCPY(iseq1, iseq0, rb_iseq_t, 1); /* TODO: write barrier? */
+
+ iseq1->self = newiseq;
+ if (!iseq1->orig) {
+ OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval);
+ }
+ if (iseq0->local_iseq == iseq0) {
+ iseq1->local_iseq = iseq1;
+ }
+ if (newcbase) {
+ ISEQ_SET_CREF(iseq1, NEW_CREF(newcbase));
+ iseq1->cref_stack->nd_refinements = iseq0->cref_stack->nd_refinements;
+ iseq1->cref_stack->nd_visi = iseq0->cref_stack->nd_visi;
+ if (iseq0->cref_stack->nd_next) {
+ iseq1->cref_stack->nd_next = iseq0->cref_stack->nd_next;
+ }
+ OBJ_WRITE(iseq1, &iseq1->klass, newcbase);
+ }
+
+ return newiseq;
+}
+
+VALUE
rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
{
int i, r;
- VALUE a, args = rb_ary_new2(iseq->body->param.size);
+ VALUE a, args = rb_ary_new2(iseq->arg_size);
ID req, opt, rest, block, key, keyrest;
#define PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))
-#define PARAM_ID(i) iseq->body->local_table[(i)]
+#define PARAM_ID(i) iseq->local_table[(i)]
#define PARAM(i, type) ( \
PARAM_TYPE(type), \
rb_id2str(PARAM_ID(i)) ? \
@@ -2092,18 +1956,18 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
CONST_ID(req, "req");
CONST_ID(opt, "opt");
if (is_proc) {
- for (i = 0; i < iseq->body->param.lead_num; i++) {
+ for (i = 0; i < iseq->argc; i++) {
PARAM_TYPE(opt);
rb_ary_push(a, rb_id2str(PARAM_ID(i)) ? ID2SYM(PARAM_ID(i)) : Qnil);
rb_ary_push(args, a);
}
}
else {
- for (i = 0; i < iseq->body->param.lead_num; i++) {
+ for (i = 0; i < iseq->argc; i++) {
rb_ary_push(args, PARAM(i, req));
}
}
- r = iseq->body->param.lead_num + iseq->body->param.opt_num;
+ r = iseq->argc + iseq->arg_opts - 1;
for (; i < r; i++) {
PARAM_TYPE(opt);
if (rb_id2str(PARAM_ID(i))) {
@@ -2111,52 +1975,52 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
}
rb_ary_push(args, a);
}
- if (iseq->body->param.flags.has_rest) {
+ if (iseq->arg_rest != -1) {
CONST_ID(rest, "rest");
- rb_ary_push(args, PARAM(iseq->body->param.rest_start, rest));
+ rb_ary_push(args, PARAM(iseq->arg_rest, rest));
}
- r = iseq->body->param.post_start + iseq->body->param.post_num;
+ r = iseq->arg_post_start + iseq->arg_post_len;
if (is_proc) {
- for (i = iseq->body->param.post_start; i < r; i++) {
+ for (i = iseq->arg_post_start; i < r; i++) {
PARAM_TYPE(opt);
rb_ary_push(a, rb_id2str(PARAM_ID(i)) ? ID2SYM(PARAM_ID(i)) : Qnil);
rb_ary_push(args, a);
}
}
else {
- for (i = iseq->body->param.post_start; i < r; i++) {
+ for (i = iseq->arg_post_start; i < r; i++) {
rb_ary_push(args, PARAM(i, req));
}
}
- if (iseq->body->param.flags.has_kw) {
+ if (iseq->arg_keyword != -1) {
i = 0;
- if (iseq->body->param.keyword->required_num > 0) {
+ if (iseq->arg_keyword_required) {
ID keyreq;
CONST_ID(keyreq, "keyreq");
- for (; i < iseq->body->param.keyword->required_num; i++) {
+ for (; i < iseq->arg_keyword_required; i++) {
PARAM_TYPE(keyreq);
- if (rb_id2str(iseq->body->param.keyword->table[i])) {
- rb_ary_push(a, ID2SYM(iseq->body->param.keyword->table[i]));
+ if (rb_id2str(iseq->arg_keyword_table[i])) {
+ rb_ary_push(a, ID2SYM(iseq->arg_keyword_table[i]));
}
rb_ary_push(args, a);
}
}
CONST_ID(key, "key");
- for (; i < iseq->body->param.keyword->num; i++) {
+ for (; i < iseq->arg_keywords; i++) {
PARAM_TYPE(key);
- if (rb_id2str(iseq->body->param.keyword->table[i])) {
- rb_ary_push(a, ID2SYM(iseq->body->param.keyword->table[i]));
+ if (rb_id2str(iseq->arg_keyword_table[i])) {
+ rb_ary_push(a, ID2SYM(iseq->arg_keyword_table[i]));
}
rb_ary_push(args, a);
}
+ if (rb_id2str(iseq->local_table[iseq->arg_keyword])) {
+ CONST_ID(keyrest, "keyrest");
+ rb_ary_push(args, PARAM(iseq->arg_keyword, keyrest));
+ }
}
- if (iseq->body->param.flags.has_kwrest) {
- CONST_ID(keyrest, "keyrest");
- rb_ary_push(args, PARAM(iseq->body->param.keyword->rest_start, keyrest));
- }
- if (iseq->body->param.flags.has_block) {
+ if (iseq->arg_block != -1) {
CONST_ID(block, "block");
- rb_ary_push(args, PARAM(iseq->body->param.block_start, block));
+ rb_ary_push(args, PARAM(iseq->arg_block, block));
}
return args;
}
@@ -2193,36 +2057,88 @@ rb_iseq_defined_string(enum defined_type type)
}
str = defs[type-1];
if (!str) {
- str = rb_str_new_cstr(estr);
+ str = rb_str_new_cstr(estr);;
OBJ_FREEZE(str);
defs[type-1] = str;
- rb_gc_register_mark_object(str);
}
return str;
}
+/* ruby2cext */
+
+VALUE
+rb_iseq_build_for_ruby2cext(
+ const rb_iseq_t *iseq_template,
+ const rb_insn_func_t *func,
+ const struct iseq_line_info_entry *line_info_table,
+ const char **local_table,
+ const VALUE *arg_opt_table,
+ const struct iseq_catch_table_entry *catch_table,
+ const char *name,
+ const char *path,
+ const unsigned short first_lineno)
+{
+ unsigned long i;
+ VALUE iseqval = iseq_alloc(rb_cISeq);
+ rb_iseq_t *iseq;
+ GetISeqPtr(iseqval, iseq);
+
+ /* copy iseq */
+ MEMCPY(iseq, iseq_template, rb_iseq_t, 1); /* TODO: write barrier, *iseq = *iseq_template; */
+ OBJ_WRITE(iseq->self, &iseq->location.label, rb_str_new2(name));
+ OBJ_WRITE(iseq->self, &iseq->location.path, rb_str_new2(path));
+ iseq->location.first_lineno = first_lineno;
+ OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
+ iseq->self = iseqval;
+
+ iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size);
+
+ for (i=0; i<iseq->iseq_size; i+=2) {
+ iseq->iseq[i] = BIN(opt_call_c_function);
+ iseq->iseq[i+1] = (VALUE)func;
+ }
+
+ rb_iseq_translate_threaded_code(iseq);
+
+#define ALLOC_AND_COPY(dst, src, type, size) do { \
+ if (size) { \
+ (dst) = ALLOC_N(type, (size)); \
+ MEMCPY((dst), (src), type, (size)); \
+ } \
+} while (0)
+
+ ALLOC_AND_COPY(iseq->line_info_table, line_info_table,
+ struct iseq_line_info_entry, iseq->line_info_size);
+
+ ALLOC_AND_COPY(iseq->catch_table, catch_table,
+ struct iseq_catch_table_entry, iseq->catch_table_size);
+
+ ALLOC_AND_COPY(iseq->arg_opt_table, arg_opt_table,
+ VALUE, iseq->arg_opts);
+
+ set_relation(iseq, 0);
+
+ return iseqval;
+}
+
/* Experimental tracing support: trace(line) -> trace(specified_line)
* MRI Specific.
*/
int
-rb_iseqw_line_trace_each(VALUE iseqw, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data)
+rb_iseq_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data)
{
int trace_num = 0;
- unsigned int pos;
- size_t insn;
- const rb_iseq_t *iseq = iseqw_check(iseqw);
+ size_t pos, insn;
+ rb_iseq_t *iseq;
int cont = 1;
- VALUE *iseq_original;
+ GetISeqPtr(iseqval, iseq);
- iseq_original = rb_iseq_original_iseq(iseq);
- for (pos = 0; cont && pos < iseq->body->iseq_size; pos += insn_len(insn)) {
- insn = iseq_original[pos];
+ for (pos = 0; cont && pos < iseq->iseq_size; pos += insn_len(insn)) {
+ insn = iseq->iseq[pos];
if (insn == BIN(trace)) {
- rb_event_flag_t current_events;
-
- current_events = (rb_event_flag_t)iseq_original[pos+1];
+ rb_event_flag_t current_events = (VALUE)iseq->iseq[pos+1];
if (current_events & RUBY_EVENT_LINE) {
rb_event_flag_t events = current_events & RUBY_EVENT_SPECIFIED_LINE;
@@ -2233,8 +2149,7 @@ rb_iseqw_line_trace_each(VALUE iseqw, int (*func)(int line, rb_event_flag_t *eve
/* printf("line: %d\n", line); */
cont = (*func)(line, &events, data);
if (current_events != events) {
- VALUE *encoded = (VALUE *)iseq->body->iseq_encoded;
- iseq_original[pos+1] = encoded[pos+1] =
+ iseq->iseq[pos+1] = iseq->iseq_encoded[pos+1] =
(VALUE)(current_events | (events & RUBY_EVENT_SPECIFIED_LINE));
}
}
@@ -2258,10 +2173,10 @@ collect_trace(int line, rb_event_flag_t *events_ptr, void *ptr)
* Returns all +specified_line+ events.
*/
VALUE
-rb_iseqw_line_trace_all(VALUE iseqw)
+rb_iseq_line_trace_all(VALUE iseqval)
{
VALUE result = rb_ary_new();
- rb_iseqw_line_trace_each(iseqw, collect_trace, (void *)result);
+ rb_iseq_line_trace_each(iseqval, collect_trace, (void *)result);
return result;
}
@@ -2305,7 +2220,7 @@ line_trace_specify(int line, rb_event_flag_t *events_ptr, void *ptr)
* If +pos+ is a negative integer a TypeError exception is raised.
*/
VALUE
-rb_iseqw_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set)
+rb_iseq_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set)
{
struct set_specifc_data data;
@@ -2320,7 +2235,7 @@ rb_iseqw_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set)
rb_raise(rb_eTypeError, "`set' should be true/false");
}
- rb_iseqw_line_trace_each(iseqval, line_trace_specify, (void *)&data);
+ rb_iseq_line_trace_each(iseqval, line_trace_specify, (void *)&data);
if (data.prev == 0) {
rb_raise(rb_eTypeError, "`pos' is out of range.");
@@ -2328,68 +2243,6 @@ rb_iseqw_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set)
return data.prev == 1 ? Qtrue : Qfalse;
}
-VALUE
-rb_iseqw_local_variables(VALUE iseqval)
-{
- return rb_iseq_local_variables(iseqw_check(iseqval));
-}
-
-/*
- * call-seq:
- * iseq.to_binary(extra_data = nil) -> binary str
- *
- * Returns serialized iseq binary format data as a String object.
- * A corresponding iseq object is created by
- * RubyVM::InstructionSequence.load_from_binary() method.
- *
- * String extra_data will be saved with binary data.
- * You can access this data with
- * RubyVM::InstructionSequence.load_from_binary_extra_data(binary).
- *
- * Note that the translated binary data is not portable.
- * You can not move this binary data to another machine.
- * You can not use the binary data which is created by another
- * version/another architecture of Ruby.
- */
-static VALUE
-iseqw_to_binary(int argc, VALUE *argv, VALUE self)
-{
- VALUE opt;
- rb_scan_args(argc, argv, "01", &opt);
- return iseq_ibf_dump(iseqw_check(self), opt);
-}
-
-/*
- * call-seq:
- * RubyVM::InstructionSequence.load_from_binary(binary) -> iseq
- *
- * Load an iseq object from binary format String object
- * created by RubyVM::InstructionSequence.to_binary.
- *
- * This loader does not have a verifier, so that loading broken/modified
- * binary causes critical problem.
- *
- * You should not load binary data provided by others.
- * You should use binary data translated by yourself.
- */
-static VALUE
-iseqw_s_load_from_binary(VALUE self, VALUE str)
-{
- return iseqw_new(iseq_ibf_load(str));
-}
-
-/*
- * call-seq:
- * RubyVM::InstructionSequence.load_from_binary_extra_data(binary) -> str
- *
- * Load extra data embed into binary format String object.
- */
-static VALUE
-iseqw_s_load_from_binary_extra_data(VALUE self, VALUE str)
-{
- return iseq_ibf_load_extra_data(str);
-}
-
/*
* Document-class: RubyVM::InstructionSequence
*
@@ -2415,48 +2268,45 @@ Init_ISeq(void)
{
/* declare ::RubyVM::InstructionSequence */
rb_cISeq = rb_define_class_under(rb_cRubyVM, "InstructionSequence", rb_cObject);
- rb_define_method(rb_cISeq, "inspect", iseqw_inspect, 0);
- rb_define_method(rb_cISeq, "disasm", iseqw_disasm, 0);
- rb_define_method(rb_cISeq, "disassemble", iseqw_disasm, 0);
- rb_define_method(rb_cISeq, "to_a", iseqw_to_a, 0);
- rb_define_method(rb_cISeq, "eval", iseqw_eval, 0);
-
- rb_define_method(rb_cISeq, "to_binary", iseqw_to_binary, -1);
- rb_define_singleton_method(rb_cISeq, "load_from_binary", iseqw_s_load_from_binary, 1);
- rb_define_singleton_method(rb_cISeq, "load_from_binary_extra_data", iseqw_s_load_from_binary_extra_data, 1);
-
+ rb_define_alloc_func(rb_cISeq, iseq_alloc);
+ rb_define_method(rb_cISeq, "inspect", iseq_inspect, 0);
+ rb_define_method(rb_cISeq, "disasm", rb_iseq_disasm, 0);
+ rb_define_method(rb_cISeq, "disassemble", rb_iseq_disasm, 0);
+ rb_define_method(rb_cISeq, "to_a", iseq_to_a, 0);
+ rb_define_method(rb_cISeq, "eval", iseq_eval, 0);
/* location APIs */
- rb_define_method(rb_cISeq, "path", iseqw_path, 0);
- rb_define_method(rb_cISeq, "absolute_path", iseqw_absolute_path, 0);
- rb_define_method(rb_cISeq, "label", iseqw_label, 0);
- rb_define_method(rb_cISeq, "base_label", iseqw_base_label, 0);
- rb_define_method(rb_cISeq, "first_lineno", iseqw_first_lineno, 0);
+ rb_define_method(rb_cISeq, "path", rb_iseq_path, 0);
+ rb_define_method(rb_cISeq, "absolute_path", rb_iseq_absolute_path, 0);
+ rb_define_method(rb_cISeq, "label", rb_iseq_label, 0);
+ rb_define_method(rb_cISeq, "base_label", rb_iseq_base_label, 0);
+ rb_define_method(rb_cISeq, "first_lineno", rb_iseq_first_lineno, 0);
#if 0
/* Now, it is experimental. No discussions, no tests. */
/* They can be used from C level. Please give us feedback. */
- rb_define_method(rb_cISeq, "line_trace_all", rb_iseqw_line_trace_all, 0);
- rb_define_method(rb_cISeq, "line_trace_specify", rb_iseqw_line_trace_specify, 2);
+ rb_define_method(rb_cISeq, "line_trace_all", rb_iseq_line_trace_all, 0);
+ rb_define_method(rb_cISeq, "line_trace_specify", rb_iseq_line_trace_specify, 2);
#else
- (void)rb_iseqw_line_trace_all;
- (void)rb_iseqw_line_trace_specify;
+ (void)rb_iseq_line_trace_all;
+ (void)rb_iseq_line_trace_specify;
#endif
#if 0 /* TBD */
- rb_define_private_method(rb_cISeq, "marshal_dump", iseqw_marshal_dump, 0);
- rb_define_private_method(rb_cISeq, "marshal_load", iseqw_marshal_load, 1);
- /* disable this feature because there is no verifier. */
- rb_define_singleton_method(rb_cISeq, "load", iseq_s_load, -1);
+ rb_define_private_method(rb_cISeq, "marshal_dump", iseq_marshal_dump, 0);
+ rb_define_private_method(rb_cISeq, "marshal_load", iseq_marshal_load, 1);
#endif
+
+ /* disable this feature because there is no verifier. */
+ /* rb_define_singleton_method(rb_cISeq, "load", iseq_s_load, -1); */
(void)iseq_s_load;
- rb_define_singleton_method(rb_cISeq, "compile", iseqw_s_compile, -1);
- rb_define_singleton_method(rb_cISeq, "new", iseqw_s_compile, -1);
- rb_define_singleton_method(rb_cISeq, "compile_file", iseqw_s_compile_file, -1);
- rb_define_singleton_method(rb_cISeq, "compile_option", iseqw_s_compile_option_get, 0);
- rb_define_singleton_method(rb_cISeq, "compile_option=", iseqw_s_compile_option_set, 1);
- rb_define_singleton_method(rb_cISeq, "disasm", iseqw_s_disasm, 1);
- rb_define_singleton_method(rb_cISeq, "disassemble", iseqw_s_disasm, 1);
- rb_define_singleton_method(rb_cISeq, "of", iseqw_s_of, 1);
+ rb_define_singleton_method(rb_cISeq, "compile", iseq_s_compile, -1);
+ rb_define_singleton_method(rb_cISeq, "new", iseq_s_compile, -1);
+ rb_define_singleton_method(rb_cISeq, "compile_file", iseq_s_compile_file, -1);
+ rb_define_singleton_method(rb_cISeq, "compile_option", iseq_s_compile_option_get, 0);
+ rb_define_singleton_method(rb_cISeq, "compile_option=", iseq_s_compile_option_set, 1);
+ rb_define_singleton_method(rb_cISeq, "disasm", iseq_s_disasm, 1);
+ rb_define_singleton_method(rb_cISeq, "disassemble", iseq_s_disasm, 1);
+ rb_define_singleton_method(rb_cISeq, "of", iseq_s_of, 1);
}
diff --git a/iseq.h b/iseq.h
index b316ea41b9..5487d86f7b 100644
--- a/iseq.h
+++ b/iseq.h
@@ -9,118 +9,31 @@
**********************************************************************/
-#ifndef RUBY_ISEQ_H
-#define RUBY_ISEQ_H 1
-
-#define ISEQ_MAJOR_VERSION 2
-#define ISEQ_MINOR_VERSION 3
-
-#ifndef rb_iseq_t
-typedef struct rb_iseq_struct rb_iseq_t;
-#define rb_iseq_t rb_iseq_t
-#endif
-
-static inline size_t
-rb_call_info_kw_arg_bytes(int keyword_len)
-{
- return sizeof(struct rb_call_info_kw_arg) + sizeof(VALUE) * (keyword_len - 1);
-}
-
-enum iseq_mark_ary_index {
- ISEQ_MARK_ARY_COVERAGE = 0,
- ISEQ_MARK_ARY_FLIP_CNT = 1,
- ISEQ_MARK_ARY_ORIGINAL_ISEQ = 2,
-};
-
-static inline VALUE
-iseq_mark_ary_create(int flip_cnt)
-{
- VALUE ary = rb_ary_tmp_new(3);
- rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_COVERAGE */
- rb_ary_push(ary, INT2FIX(flip_cnt)); /* ISEQ_MARK_ARY_FLIP_CNT */
- rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_ORIGINAL_ISEQ */
- return ary;
-}
-
-#define ISEQ_MARK_ARY(iseq) (iseq)->body->mark_ary
-
-#define ISEQ_COVERAGE(iseq) RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE)
-#define ISEQ_COVERAGE_SET(iseq, cov) RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE, cov)
-
-#define ISEQ_FLIP_CNT(iseq) FIX2INT(RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT))
-
-static inline int
-ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq)
-{
- int cnt = ISEQ_FLIP_CNT(iseq);
- RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT, INT2FIX(cnt+1));
- return cnt;
-}
-
-static inline VALUE *
-ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
-{
- VALUE str = RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ);
- if (RTEST(str)) return (VALUE *)RSTRING_PTR(str);
- return NULL;
-}
-
-static inline VALUE *
-ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
-{
- VALUE str = rb_str_tmp_new(size * sizeof(VALUE));
- RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ, str);
- return (VALUE *)RSTRING_PTR(str);
-}
-
-#define ISEQ_COMPILE_DATA(iseq) (iseq)->aux.compile_data
-
-static inline rb_iseq_t *
-iseq_imemo_alloc(void)
-{
- return (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
-}
-
-#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
-
-VALUE iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
-void ibf_load_iseq_complete(rb_iseq_t *iseq);
-const rb_iseq_t *iseq_ibf_load(VALUE str);
-VALUE iseq_ibf_load_extra_data(VALUE str);
+#ifndef RUBY_COMPILE_H
+#define RUBY_COMPILE_H
RUBY_SYMBOL_EXPORT_BEGIN
/* compile.c */
-VALUE rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node);
+VALUE rb_iseq_compile_node(VALUE self, NODE *node);
int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
-VALUE *rb_iseq_original_iseq(const rb_iseq_t *iseq);
-void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
- VALUE locals, VALUE args,
- VALUE exception, VALUE body);
+VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
+ VALUE exception, VALUE body);
/* iseq.c */
-void rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj);
+void rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj);
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
struct st_table *ruby_insn_make_insn_table(void);
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
-int rb_iseqw_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data);
-VALUE rb_iseqw_line_trace_all(VALUE iseqval);
-VALUE rb_iseqw_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set);
-VALUE rb_iseqw_new(const rb_iseq_t *iseq);
-const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
-
-VALUE rb_iseq_path(const rb_iseq_t *iseq);
-VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq);
-VALUE rb_iseq_label(const rb_iseq_t *iseq);
-VALUE rb_iseq_base_label(const rb_iseq_t *iseq);
-VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq);
-VALUE rb_iseq_method_name(const rb_iseq_t *iseq);
+int rb_iseq_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data);
+VALUE rb_iseq_line_trace_all(VALUE iseqval);
+VALUE rb_iseq_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set);
/* proc.c */
-const rb_iseq_t *rb_method_iseq(VALUE body);
-const rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
+rb_iseq_t *rb_method_get_iseq(VALUE body);
+rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
struct rb_compile_option_struct {
int inline_const_cache;
@@ -131,8 +44,6 @@ struct rb_compile_option_struct {
int instructions_unification;
int stack_caching;
int trace_instruction;
- int frozen_string_literal;
- int debug_frozen_string_literal;
int debug_level;
};
@@ -150,42 +61,22 @@ struct iseq_catch_table_entry {
CATCH_TYPE_REDO = INT2FIX(5),
CATCH_TYPE_NEXT = INT2FIX(6)
} type;
- const rb_iseq_t *iseq;
- unsigned int start;
- unsigned int end;
- unsigned int cont;
- unsigned int sp;
+ VALUE iseq;
+ unsigned long start;
+ unsigned long end;
+ unsigned long cont;
+ unsigned long sp;
};
-PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
- unsigned int size;
- struct iseq_catch_table_entry entries[1]; /* flexible array */
-});
-
-static inline int
-iseq_catch_table_bytes(int n)
-{
- enum {
- catch_table_entries_max = (INT_MAX - sizeof(struct iseq_catch_table)) / sizeof(struct iseq_catch_table_entry)
- };
- if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
- return (int)(sizeof(struct iseq_catch_table) +
- (n - 1) * sizeof(struct iseq_catch_table_entry));
-}
-
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
struct iseq_compile_data_storage {
struct iseq_compile_data_storage *next;
- unsigned int pos;
- unsigned int size;
- char buff[1]; /* flexible array */
+ unsigned long pos;
+ unsigned long size;
+ char *buff;
};
-/* account for flexible array */
-#define SIZEOF_ISEQ_COMPILE_DATA_STORAGE \
- (sizeof(struct iseq_compile_data_storage) - 1)
-
struct iseq_compile_data {
/* GC is needed */
const VALUE err_info;
@@ -196,7 +87,7 @@ struct iseq_compile_data {
struct iseq_label_data *start_label;
struct iseq_label_data *end_label;
struct iseq_label_data *redo_label;
- const rb_iseq_t *current_block;
+ VALUE current_block;
VALUE ensure_node;
VALUE for_iseq;
struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
@@ -208,8 +99,6 @@ struct iseq_compile_data {
int last_coverable_line;
int label_no;
int node_level;
- unsigned int ci_index;
- unsigned int ci_kw_index;
const rb_compile_option_t *option;
#if SUPPORT_JOKE
st_table *labels_table;
@@ -239,11 +128,9 @@ enum defined_type {
};
VALUE rb_iseq_defined_string(enum defined_type type);
-void rb_iseq_make_compile_option(struct rb_compile_option_struct *option, VALUE opt);
-/* vm.c */
-VALUE rb_iseq_local_variables(const rb_iseq_t *iseq);
+#define DEFAULT_SPECIAL_VAR_COUNT 2
RUBY_SYMBOL_EXPORT_END
-#endif /* RUBY_ISEQ_H */
+#endif /* RUBY_COMPILE_H */
diff --git a/lex.c.blt b/lex.c.blt
index 7d8dd5b6e7..1ae80990b9 100644
--- a/lex.c.blt
+++ b/lex.c.blt
@@ -1,5 +1,5 @@
/* C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -C -P -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */
+/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -30,7 +30,7 @@ error "gperf generated tables don't work with this execution character set. Plea
#line 1 "defs/keywords"
-struct kwtable {int name, id[2], state;};
+struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER
static const struct kwtable *reserved_word(const char *, unsigned int);
@@ -45,10 +45,12 @@ struct kwtable;
#define MAX_HASH_VALUE 50
/* maximum key range = 43, duplicates = 0 */
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)
-inline
-#elif defined(__GNUC__)
+#ifdef __GNUC__
__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
#endif
static unsigned int
hash (str, len)
@@ -99,95 +101,6 @@ hash (str, len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
-struct stringpool_t
- {
- char stringpool_str8[sizeof("break")];
- char stringpool_str9[sizeof("else")];
- char stringpool_str10[sizeof("nil")];
- char stringpool_str11[sizeof("ensure")];
- char stringpool_str12[sizeof("end")];
- char stringpool_str13[sizeof("then")];
- char stringpool_str14[sizeof("not")];
- char stringpool_str15[sizeof("false")];
- char stringpool_str16[sizeof("self")];
- char stringpool_str17[sizeof("elsif")];
- char stringpool_str18[sizeof("rescue")];
- char stringpool_str19[sizeof("true")];
- char stringpool_str20[sizeof("until")];
- char stringpool_str21[sizeof("unless")];
- char stringpool_str22[sizeof("return")];
- char stringpool_str23[sizeof("def")];
- char stringpool_str24[sizeof("and")];
- char stringpool_str25[sizeof("do")];
- char stringpool_str26[sizeof("yield")];
- char stringpool_str27[sizeof("for")];
- char stringpool_str28[sizeof("undef")];
- char stringpool_str29[sizeof("or")];
- char stringpool_str30[sizeof("in")];
- char stringpool_str31[sizeof("when")];
- char stringpool_str32[sizeof("retry")];
- char stringpool_str33[sizeof("if")];
- char stringpool_str34[sizeof("case")];
- char stringpool_str35[sizeof("redo")];
- char stringpool_str36[sizeof("next")];
- char stringpool_str37[sizeof("super")];
- char stringpool_str38[sizeof("module")];
- char stringpool_str39[sizeof("begin")];
- char stringpool_str40[sizeof("__LINE__")];
- char stringpool_str41[sizeof("__FILE__")];
- char stringpool_str42[sizeof("__ENCODING__")];
- char stringpool_str43[sizeof("END")];
- char stringpool_str44[sizeof("alias")];
- char stringpool_str45[sizeof("BEGIN")];
- char stringpool_str46[sizeof("defined?")];
- char stringpool_str47[sizeof("class")];
- char stringpool_str50[sizeof("while")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "break",
- "else",
- "nil",
- "ensure",
- "end",
- "then",
- "not",
- "false",
- "self",
- "elsif",
- "rescue",
- "true",
- "until",
- "unless",
- "return",
- "def",
- "and",
- "do",
- "yield",
- "for",
- "undef",
- "or",
- "in",
- "when",
- "retry",
- "if",
- "case",
- "redo",
- "next",
- "super",
- "module",
- "begin",
- "__LINE__",
- "__FILE__",
- "__ENCODING__",
- "END",
- "alias",
- "BEGIN",
- "defined?",
- "class",
- "while"
- };
-#define stringpool ((const char *) &stringpool_contents)
#ifdef __GNUC__
__inline
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
@@ -201,90 +114,90 @@ rb_reserved_word (str, len)
{
static const struct kwtable wordlist[] =
{
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 19 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str8), {keyword_break, keyword_break}, EXPR_MID},
+ {"break", {keyword_break, keyword_break}, EXPR_MID},
#line 25 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str9), {keyword_else, keyword_else}, EXPR_BEG},
+ {"else", {keyword_else, keyword_else}, EXPR_BEG},
#line 35 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str10), {keyword_nil, keyword_nil}, EXPR_END},
+ {"nil", {keyword_nil, keyword_nil}, EXPR_END},
#line 28 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str11), {keyword_ensure, keyword_ensure}, EXPR_BEG},
+ {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
#line 27 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str12), {keyword_end, keyword_end}, EXPR_END},
+ {"end", {keyword_end, keyword_end}, EXPR_END},
#line 44 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str13), {keyword_then, keyword_then}, EXPR_BEG},
+ {"then", {keyword_then, keyword_then}, EXPR_BEG},
#line 36 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str14), {keyword_not, keyword_not}, EXPR_ARG},
+ {"not", {keyword_not, keyword_not}, EXPR_ARG},
#line 29 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str15), {keyword_false, keyword_false}, EXPR_END},
+ {"false", {keyword_false, keyword_false}, EXPR_END},
#line 42 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str16), {keyword_self, keyword_self}, EXPR_END},
+ {"self", {keyword_self, keyword_self}, EXPR_END},
#line 26 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str17), {keyword_elsif, keyword_elsif}, EXPR_VALUE},
+ {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
#line 39 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str18), {keyword_rescue, modifier_rescue}, EXPR_MID},
+ {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
#line 45 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str19), {keyword_true, keyword_true}, EXPR_END},
+ {"true", {keyword_true, keyword_true}, EXPR_END},
#line 48 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str20), {keyword_until, modifier_until}, EXPR_VALUE},
+ {"until", {keyword_until, modifier_until}, EXPR_VALUE},
#line 47 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str21), {keyword_unless, modifier_unless}, EXPR_VALUE},
+ {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
#line 41 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str22), {keyword_return, keyword_return}, EXPR_MID},
+ {"return", {keyword_return, keyword_return}, EXPR_MID},
#line 22 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str23), {keyword_def, keyword_def}, EXPR_FNAME},
+ {"def", {keyword_def, keyword_def}, EXPR_FNAME},
#line 17 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str24), {keyword_and, keyword_and}, EXPR_VALUE},
+ {"and", {keyword_and, keyword_and}, EXPR_VALUE},
#line 24 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str25), {keyword_do, keyword_do}, EXPR_BEG},
+ {"do", {keyword_do, keyword_do}, EXPR_BEG},
#line 51 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str26), {keyword_yield, keyword_yield}, EXPR_ARG},
+ {"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
#line 30 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str27), {keyword_for, keyword_for}, EXPR_VALUE},
+ {"for", {keyword_for, keyword_for}, EXPR_VALUE},
#line 46 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str28), {keyword_undef, keyword_undef}, EXPR_FNAME|EXPR_FITEM},
+ {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
#line 37 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str29), {keyword_or, keyword_or}, EXPR_VALUE},
+ {"or", {keyword_or, keyword_or}, EXPR_VALUE},
#line 32 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str30), {keyword_in, keyword_in}, EXPR_VALUE},
+ {"in", {keyword_in, keyword_in}, EXPR_VALUE},
#line 49 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str31), {keyword_when, keyword_when}, EXPR_VALUE},
+ {"when", {keyword_when, keyword_when}, EXPR_VALUE},
#line 40 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str32), {keyword_retry, keyword_retry}, EXPR_END},
+ {"retry", {keyword_retry, keyword_retry}, EXPR_END},
#line 31 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str33), {keyword_if, modifier_if}, EXPR_VALUE},
+ {"if", {keyword_if, modifier_if}, EXPR_VALUE},
#line 20 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str34), {keyword_case, keyword_case}, EXPR_VALUE},
+ {"case", {keyword_case, keyword_case}, EXPR_VALUE},
#line 38 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str35), {keyword_redo, keyword_redo}, EXPR_END},
+ {"redo", {keyword_redo, keyword_redo}, EXPR_END},
#line 34 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str36), {keyword_next, keyword_next}, EXPR_MID},
+ {"next", {keyword_next, keyword_next}, EXPR_MID},
#line 43 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str37), {keyword_super, keyword_super}, EXPR_ARG},
+ {"super", {keyword_super, keyword_super}, EXPR_ARG},
#line 33 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str38), {keyword_module, keyword_module}, EXPR_VALUE},
+ {"module", {keyword_module, keyword_module}, EXPR_VALUE},
#line 18 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str39), {keyword_begin, keyword_begin}, EXPR_BEG},
+ {"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
#line 12 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str40), {keyword__LINE__, keyword__LINE__}, EXPR_END},
+ {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
#line 13 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str41), {keyword__FILE__, keyword__FILE__}, EXPR_END},
+ {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
#line 11 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str42), {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
+ {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
#line 15 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str43), {keyword_END, keyword_END}, EXPR_END},
+ {"END", {keyword_END, keyword_END}, EXPR_END},
#line 16 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str44), {keyword_alias, keyword_alias}, EXPR_FNAME|EXPR_FITEM},
+ {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
#line 14 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str45), {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
+ {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
#line 23 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str46), {keyword_defined, keyword_defined}, EXPR_ARG},
+ {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG},
#line 21 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str47), {keyword_class, keyword_class}, EXPR_CLASS},
- {-1}, {-1},
+ {"class", {keyword_class, keyword_class}, EXPR_CLASS},
+ {""}, {""},
#line 50 "defs/keywords"
- {(int)offsetof(struct stringpool_t, stringpool_str50), {keyword_while, modifier_while}, EXPR_VALUE}
+ {"while", {keyword_while, modifier_while}, EXPR_VALUE}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -293,14 +206,10 @@ rb_reserved_word (str, len)
if (key <= MAX_HASH_VALUE && key >= 0)
{
- register int o = wordlist[key].name;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
+ register const char *s = wordlist[key].name;
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &wordlist[key];
- }
+ if (*str == *s && !strcmp (str + 1, s + 1))
+ return &wordlist[key];
}
}
return 0;
diff --git a/lib/English.rb b/lib/English.rb
index 0c17229682..32769fb18b 100644
--- a/lib/English.rb
+++ b/lib/English.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Include the English library file in a Ruby script, and you can
# reference the global variables such as \VAR{\$\_} using less
# cryptic names, listed in the following table.% \vref{tab:english}.
@@ -7,7 +6,7 @@
#
# $\ = ' -- '
# "waterbuffalo" =~ /buff/
-# print $', $$, "\n"
+# print $", $', $$, "\n"
#
# With English:
#
@@ -15,7 +14,7 @@
#
# $OUTPUT_FIELD_SEPARATOR = ' -- '
# "waterbuffalo" =~ /buff/
-# print $POSTMATCH, $PID, "\n"
+# print $LOADED_FEATURES, $POSTMATCH, $PID, "\n"
#
# Below is a full list of descriptive aliases and their associated global
# variable:
diff --git a/lib/abbrev.rb b/lib/abbrev.rb
index 2eac293c30..841f6d980e 100644..100755
--- a/lib/abbrev.rb
+++ b/lib/abbrev.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+#!/usr/bin/env ruby
#--
# Copyright (c) 2001,2003 Akinori MUSHA <knu@iDaemons.org>
#
@@ -11,46 +11,43 @@
#++
##
-# Calculates the set of unambiguous abbreviations for a given set of strings.
+# Calculates the set of unique abbreviations for a given set of strings.
#
# require 'abbrev'
# require 'pp'
#
-# pp Abbrev.abbrev(['ruby'])
-# #=> {"ruby"=>"ruby", "rub"=>"ruby", "ru"=>"ruby", "r"=>"ruby"}
+# pp Abbrev.abbrev(['ruby', 'rules'])
#
-# pp Abbrev.abbrev(%w{ ruby rules })
+# Generates:
#
-# _Generates:_
-# { "ruby" => "ruby",
-# "rub" => "ruby",
-# "rules" => "rules",
+# { "rub" => "ruby",
+# "ruby" => "ruby",
+# "rul" => "rules",
# "rule" => "rules",
-# "rul" => "rules" }
+# "rules" => "rules" }
#
# It also provides an array core extension, Array#abbrev.
#
-# pp %w{ summer winter }.abbrev
-#
-# _Generates:_
-# { "summer" => "summer",
-# "summe" => "summer",
-# "summ" => "summer",
-# "sum" => "summer",
-# "su" => "summer",
-# "s" => "summer",
-# "winter" => "winter",
-# "winte" => "winter",
-# "wint" => "winter",
-# "win" => "winter",
-# "wi" => "winter",
-# "w" => "winter" }
+# pp %w{summer winter}.abbrev
+# #=> {"summe"=>"summer",
+# "summ"=>"summer",
+# "sum"=>"summer",
+# "su"=>"summer",
+# "s"=>"summer",
+# "winte"=>"winter",
+# "wint"=>"winter",
+# "win"=>"winter",
+# "wi"=>"winter",
+# "w"=>"winter",
+# "summer"=>"summer",
+# "winter"=>"winter"}
module Abbrev
- # Given a set of strings, calculate the set of unambiguous abbreviations for
- # those strings, and return a hash where the keys are all the possible
- # abbreviations and the values are the full strings.
+ # Given a set of strings, calculate the set of unambiguous
+ # abbreviations for those strings, and return a hash where the keys
+ # are all the possible abbreviations and the values are the full
+ # strings.
#
# Thus, given +words+ is "car" and "cone", the keys pointing to "car" would
# be "ca" and "car", while those pointing to "cone" would be "co", "con", and
@@ -58,18 +55,15 @@ module Abbrev
#
# require 'abbrev'
#
- # Abbrev.abbrev(%w{ car cone })
+ # Abbrev.abbrev(['car', 'cone'])
# #=> {"ca"=>"car", "con"=>"cone", "co"=>"cone", "car"=>"car", "cone"=>"cone"}
#
- # The optional +pattern+ parameter is a pattern or a string. Only input
- # strings that match the pattern or start with the string are included in the
- # output hash.
- #
- # Abbrev.abbrev(%w{car box cone crab}, /b/)
- # #=> {"box"=>"box", "bo"=>"box", "b"=>"box", "crab" => "crab"}
+ # The optional +pattern+ parameter is a pattern or a string. Only
+ # input strings that match the pattern or start with the string
+ # are included in the output hash.
#
- # Abbrev.abbrev(%w{car box cone}, 'ca')
- # #=> {"car"=>"car", "ca"=>"car"}
+ # Abbrev.abbrev(%w{car box cone}, /b/)
+ # #=> {"bo"=>"box", "b"=>"box", "box"=>"box"}
def abbrev(words, pattern = nil)
table = {}
seen = Hash.new(0)
@@ -109,24 +103,34 @@ module Abbrev
end
class Array
- # Calculates the set of unambiguous abbreviations for the strings in +self+.
+ # Calculates the set of unambiguous abbreviations for the strings in
+ # +self+.
#
# require 'abbrev'
# %w{ car cone }.abbrev
- # #=> {"car"=>"car", "ca"=>"car", "cone"=>"cone", "con"=>"cone", "co"=>"cone"}
+ # #=> {"ca" => "car", "con"=>"cone", "co" => "cone",
+ # "car"=>"car", "cone" => "cone"}
#
- # The optional +pattern+ parameter is a pattern or a string. Only input
- # strings that match the pattern or start with the string are included in the
- # output hash.
+ # The optional +pattern+ parameter is a pattern or a string. Only
+ # input strings that match the pattern or start with the string
+ # are included in the output hash.
#
# %w{ fast boat day }.abbrev(/^.a/)
- # #=> {"fast"=>"fast", "fas"=>"fast", "fa"=>"fast", "day"=>"day", "da"=>"day"}
- #
- # Abbrev.abbrev(%w{car box cone}, "ca")
- # #=> {"car"=>"car", "ca"=>"car"}
+ # #=> {"fas"=>"fast", "fa"=>"fast", "da"=>"day",
+ # "fast"=>"fast", "day"=>"day"}
#
# See also Abbrev.abbrev
def abbrev(pattern = nil)
Abbrev::abbrev(self, pattern)
end
end
+
+if $0 == __FILE__
+ while line = gets
+ hash = line.split.abbrev
+
+ hash.sort.each do |k, v|
+ puts "#{k} => #{v}"
+ end
+ end
+end
diff --git a/lib/base64.rb b/lib/base64.rb
index a08941af92..98829f0d96 100644
--- a/lib/base64.rb
+++ b/lib/base64.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = base64.rb: methods for base64-encoding and -decoding strings
#
@@ -78,30 +77,15 @@ module Base64
# This method complies with ``Base 64 Encoding with URL and Filename Safe
# Alphabet'' in RFC 4648.
# The alphabet uses '-' instead of '+' and '_' instead of '/'.
- # Note that the result can still contain '='.
- # You can remove the padding by setting +padding+ as false.
- def urlsafe_encode64(bin, padding: true)
- str = strict_encode64(bin).tr("+/", "-_")
- str = str.delete("=") unless padding
- str
+ def urlsafe_encode64(bin)
+ strict_encode64(bin).tr("+/", "-_")
end
# Returns the Base64-decoded version of +str+.
# This method complies with ``Base 64 Encoding with URL and Filename Safe
# Alphabet'' in RFC 4648.
# The alphabet uses '-' instead of '+' and '_' instead of '/'.
- #
- # The padding character is optional.
- # This method accepts both correctly-padded and unpadded input.
- # Note that it still rejects incorrectly-padded input.
def urlsafe_decode64(str)
- # NOTE: RFC 4648 does say nothing about unpadded input, but says that
- # "the excess pad characters MAY also be ignored", so it is inferred that
- # unpadded input is also acceptable.
- str = str.tr("-_", "+/")
- if !str.end_with?("=") && str.length % 4 != 0
- str = str.ljust((str.length + 3) & ~3, "=")
- end
- strict_decode64(str)
+ strict_decode64(str.tr("-_", "+/"))
end
end
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index ec1b658cde..81ca0bcede 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# benchmark.rb - a performance benchmarking library
#
@@ -26,7 +25,7 @@
#
# puts Benchmark.measure { "a"*1_000_000_000 }
#
-# On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates:
+# On my machine (OSX 10.8.3 on i5 1.7 Ghz) this generates:
#
# 0.350000 0.400000 0.750000 ( 0.835234)
#
@@ -132,7 +131,7 @@ module Benchmark
#
# If the block returns an array of
# Benchmark::Tms objects, these will be used to format
- # additional lines of output. If +labels+ parameter are
+ # additional lines of output. If +label+ parameters are
# given, these are used to label these extra lines.
#
# _Note_: Other methods provide a simpler interface to this one, and are
@@ -181,8 +180,8 @@ module Benchmark
# A simple interface to the #benchmark method, #bm generates sequential
- # reports with labels. +label_width+ and +labels+ parameters have the same
- # meaning as for #benchmark.
+ # reports with labels. The parameters have the same meaning as for
+ # #benchmark.
#
# require 'benchmark'
#
@@ -273,25 +272,12 @@ module Benchmark
#
# Returns the time used to execute the given block as a
- # Benchmark::Tms object. Takes +label+ option.
- #
- # require 'benchmark'
- #
- # n = 1000000
- #
- # time = Benchmark.measure do
- # n.times { a = "1" }
- # end
- # puts time
- #
- # Generates:
- #
- # 0.220000 0.000000 0.220000 ( 0.227313)
+ # Benchmark::Tms object.
#
def measure(label = "") # :yield:
- t0, r0 = Process.times, Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ t0, r0 = Process.times, Time.now
yield
- t1, r1 = Process.times, Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ t1, r1 = Process.times, Time.now
Benchmark::Tms.new(t1.utime - t0.utime,
t1.stime - t0.stime,
t1.cutime - t0.cutime,
@@ -304,9 +290,9 @@ module Benchmark
# Returns the elapsed real time used to execute the given block.
#
def realtime # :yield:
- r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ r0 = Time.now
yield
- Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0
+ Time.now - r0
end
module_function :benchmark, :measure, :realtime, :bm, :bmbm
@@ -480,7 +466,7 @@ module Benchmark
#
# Returns the contents of this Tms object as
- # a formatted string, according to a +format+ string
+ # a formatted string, according to a format string
# like that passed to Kernel.format. In addition, #format
# accepts the following extensions:
#
@@ -492,7 +478,7 @@ module Benchmark
# <tt>%r</tt>:: Replaced by the elapsed real time, as reported by Tms#real
# <tt>%n</tt>:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
#
- # If +format+ is not given, FORMAT is used as default value, detailing the
+ # If _format_ is not given, FORMAT is used as default value, detailing the
# user, system and real elapsed time.
#
def format(format = nil, *args)
@@ -560,3 +546,23 @@ module Benchmark
# The default format string used to display times. See also Benchmark::Tms#format.
FORMAT = Benchmark::Tms::FORMAT
end
+
+if __FILE__ == $0
+ include Benchmark
+
+ n = ARGV[0].to_i.nonzero? || 50000
+ puts %Q([#{n} times iterations of `a = "1"'])
+ benchmark(CAPTION, 7, FORMAT) do |x|
+ x.report("for:") {for _ in 1..n; _ = "1"; end} # Benchmark.measure
+ x.report("times:") {n.times do ; _ = "1"; end}
+ x.report("upto:") {1.upto(n) do ; _ = "1"; end}
+ end
+
+ benchmark do
+ [
+ measure{for _ in 1..n; _ = "1"; end}, # Benchmark.measure
+ measure{n.times do ; _ = "1"; end},
+ measure{1.upto(n) do ; _ = "1"; end}
+ ]
+ end
+end
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 167b76cef7..15676eab5f 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cgi.rb - cgi support library
#
@@ -11,6 +10,8 @@
# Documentation: Wakou Aoyama (RDoc'd and embellished by William Webber)
#
+raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
+
# == Overview
#
# The Common Gateway Interface (CGI) is a simple protocol for passing an HTTP
@@ -81,7 +82,7 @@
#
# For instance, suppose the request contains the parameter
# "favourite_colours" with the multiple values "blue" and "green". The
-# following behavior would occur:
+# following behaviour would occur:
#
# cgi.params["favourite_colours"] # => ["blue", "green"]
# cgi["favourite_colours"] # => "blue"
diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb
index ffd88b8edb..3ec884dffb 100644
--- a/lib/cgi/cookie.rb
+++ b/lib/cgi/cookie.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'cgi/util'
class CGI
# Class representing an HTTP cookie.
@@ -11,32 +10,29 @@ class CGI
# == Examples of use
# cookie1 = CGI::Cookie.new("name", "value1", "value2", ...)
# cookie1 = CGI::Cookie.new("name" => "name", "value" => "value")
- # cookie1 = CGI::Cookie.new('name' => 'name',
- # 'value' => ['value1', 'value2', ...],
- # 'path' => 'path', # optional
- # 'domain' => 'domain', # optional
- # 'expires' => Time.now, # optional
- # 'secure' => true, # optional
- # 'httponly' => true # optional
+ # cookie1 = CGI::Cookie.new('name' => 'name',
+ # 'value' => ['value1', 'value2', ...],
+ # 'path' => 'path', # optional
+ # 'domain' => 'domain', # optional
+ # 'expires' => Time.now, # optional
+ # 'secure' => true # optional
# )
#
# cgi.out("cookie" => [cookie1, cookie2]) { "string" }
#
- # name = cookie1.name
- # values = cookie1.value
- # path = cookie1.path
- # domain = cookie1.domain
- # expires = cookie1.expires
- # secure = cookie1.secure
- # httponly = cookie1.httponly
+ # name = cookie1.name
+ # values = cookie1.value
+ # path = cookie1.path
+ # domain = cookie1.domain
+ # expires = cookie1.expires
+ # secure = cookie1.secure
#
- # cookie1.name = 'name'
- # cookie1.value = ['value1', 'value2', ...]
- # cookie1.path = 'path'
- # cookie1.domain = 'domain'
- # cookie1.expires = Time.now + 30
- # cookie1.secure = true
- # cookie1.httponly = true
+ # cookie1.name = 'name'
+ # cookie1.value = ['value1', 'value2', ...]
+ # cookie1.path = 'path'
+ # cookie1.domain = 'domain'
+ # cookie1.expires = Time.now + 30
+ # cookie1.secure = true
class Cookie < Array
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
@@ -64,8 +60,6 @@ class CGI
# secure:: whether this cookie is a secure cookie or not (default to
# false). Secure cookies are only transmitted to HTTPS
# servers.
- # httponly:: whether this cookie is a HttpOnly cookie or not (default to
- # false). HttpOnly cookies are not available to javascript.
#
# These keywords correspond to attributes of the cookie object.
def initialize(name = "", *value)
@@ -76,7 +70,6 @@ class CGI
%r|^(.*/)|.match(ENV["SCRIPT_NAME"])
@path = ($1 or "")
@secure = false
- @httponly = false
return super(value)
end
@@ -96,8 +89,7 @@ class CGI
end
@domain = options["domain"]
@expires = options["expires"]
- @secure = options["secure"] == true
- @httponly = options["httponly"] == true
+ @secure = options["secure"] == true ? true : false
super(value)
end
@@ -111,9 +103,7 @@ class CGI
# Time at which this cookie expires, as a +Time+
attr_accessor :expires
# True if this cookie is secure; false otherwise
- attr_reader :secure
- # True if this cookie is httponly; false otherwise
- attr_reader :httponly
+ attr_reader("secure")
# Returns the value or list of values for this cookie.
def value
@@ -133,13 +123,6 @@ class CGI
@secure
end
- # Set whether the Cookie is a httponly cookie or not.
- #
- # +val+ must be a boolean.
- def httponly=(val)
- @httponly = !!val
- end
-
# Convert the Cookie to its string representation.
def to_s
val = collect{|v| CGI.escape(v) }.join("&")
@@ -147,8 +130,7 @@ class CGI
buf << "; domain=#{@domain}" if @domain
buf << "; path=#{@path}" if @path
buf << "; expires=#{CGI::rfc1123_date(@expires)}" if @expires
- buf << "; secure" if @secure
- buf << "; HttpOnly" if @httponly
+ buf << "; secure" if @secure == true
buf
end
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 1a741dcd76..662e04c9b7 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# Methods for generating HTML, parsing CGI-related parameters, and
# generating HTTP responses.
@@ -390,6 +389,9 @@ class CGI
# Maximum content length of post data
##MAX_CONTENT_LENGTH = 2 * 1024 * 1024
+ # Maximum content length of multipart data
+ MAX_MULTIPART_LENGTH = 128 * 1024 * 1024
+
# Maximum number of request parameters when multipart
MAX_MULTIPART_COUNT = 128
@@ -480,6 +482,7 @@ class CGI
@files = {}
boundary_rexp = /--#{Regexp.quote(boundary)}(#{EOL}|--)/
boundary_size = "#{EOL}--#{boundary}#{EOL}".bytesize
+ boundary_end = nil
buf = ''
bufsize = 10 * 1024
max_count = MAX_MULTIPART_COUNT
@@ -547,7 +550,7 @@ class CGI
name = $1 || $2 || ''
if body.original_filename.empty?
value=body.read.dup.force_encoding(@accept_charset)
- body.close! if defined?(Tempfile) && body.kind_of?(Tempfile)
+ body.unlink if defined?(Tempfile) && body.kind_of?(Tempfile)
(params[name] ||= []) << value
unless value.valid_encoding?
if @accept_charset_error_block
@@ -571,15 +574,14 @@ class CGI
raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/
params.default = []
params
- rescue Exception
- if tempfiles
+ ensure
+ if $! && tempfiles
tempfiles.each {|t|
if t.path
- t.close!
+ t.unlink
end
}
end
- raise
end # read_multipart
private :read_multipart
def create_body(is_large) #:nodoc:
@@ -641,9 +643,8 @@ class CGI
# Reads query parameters in the @params field, and cookies into @cookies.
def initialize_query()
if ("POST" == env_table['REQUEST_METHOD']) and
- %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE'])
- current_max_multipart_length = @max_multipart_length.respond_to?(:call) ? @max_multipart_length.call : @max_multipart_length
- raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > current_max_multipart_length
+ %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE'])
+ raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > MAX_MULTIPART_LENGTH
boundary = $1.dup
@multipart = true
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
@@ -749,16 +750,6 @@ class CGI
# Return the accept character set for this CGI instance.
attr_reader :accept_charset
- # @@max_multipart_length is the maximum length of multipart data.
- # The default value is 128 * 1024 * 1024 bytes
- #
- # The default can be set to something else in the CGI constructor,
- # via the :max_multipart_length key in the option hash.
- #
- # See CGI.new documentation.
- #
- @@max_multipart_length= 128 * 1024 * 1024
-
# Create a new CGI instance.
#
# :call-seq:
@@ -772,7 +763,7 @@ class CGI
# +options_hash+ form, since it also allows you specify the charset you
# will accept.
# <tt>options_hash</tt>::
- # A Hash that recognizes three options:
+ # A Hash that recognizes two options:
#
# <tt>:accept_charset</tt>::
# specifies encoding of received query string. If omitted,
@@ -801,18 +792,6 @@ class CGI
# "html4Fr":: HTML 4.0 with Framesets
# "html5":: HTML 5
#
- # <tt>:max_multipart_length</tt>::
- # Specifies maximum length of multipart data. Can be an Integer scalar or
- # a lambda, that will be evaluated when the request is parsed. This
- # allows more complex logic to be set when determining whether to accept
- # multipart data (e.g. consult a registered users upload allowance)
- #
- # Default is 128 * 1024 * 1024 bytes
- #
- # cgi=CGI.new(:max_multipart_length => 268435456) # simple scalar
- #
- # cgi=CGI.new(:max_multipart_length => -> {check_filesystem}) # lambda
- #
# <tt>block</tt>::
# If provided, the block is called when an invalid encoding is
# encountered. For example:
@@ -830,10 +809,7 @@ class CGI
# CGI locations, which varies according to the REQUEST_METHOD.
def initialize(options = {}, &block) # :yields: name, value
@accept_charset_error_block = block_given? ? block : nil
- @options={
- :accept_charset=>@@accept_charset,
- :max_multipart_length=>@@max_multipart_length
- }
+ @options={:accept_charset=>@@accept_charset}
case options
when Hash
@options.merge!(options)
@@ -841,7 +817,6 @@ class CGI
@options[:tag_maker]=options
end
@accept_charset=@options[:accept_charset]
- @max_multipart_length=@options[:max_multipart_length]
if defined?(MOD_RUBY) && !ENV.key?("GATEWAY_INTERFACE")
Apache.request.setup_cgi_env
end
@@ -879,3 +854,5 @@ class CGI
end
end # class CGI
+
+
diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb
index 4b9e577b32..4c4f698a2b 100644
--- a/lib/cgi/html.rb
+++ b/lib/cgi/html.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
class CGI
# Base module for HTML-generation mixins.
#
@@ -866,7 +865,7 @@ class CGI
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|
end
- # Initialize the HTML generation methods for this version.
+ # Initialise the HTML generation methods for this version.
# - -
instance_method(:nn_element_def).tap do |m|
for element in %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index d44a5f84b0..606d5bc541 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cgi/session.rb - session support for cgi scripts
#
@@ -164,26 +163,24 @@ class CGI
# Create a new session id.
#
- # The session id is a secure random number by SecureRandom
- # if possible, otherwise an SHA512 hash based upon the time,
- # a random number, and a constant string. This routine is
- # used internally for automatically generated session ids.
+ # The session id is an MD5 hash based upon the time,
+ # a random number, and a constant string. This routine
+ # is used internally for automatically generated
+ # session ids.
def create_new_id
require 'securerandom'
begin
- # by OpenSSL, or system provided entropy pool
session_id = SecureRandom.hex(16)
rescue NotImplementedError
- # never happens on modern systems
- require 'digest'
- d = Digest('SHA512').new
+ require 'digest/md5'
+ md5 = Digest::MD5::new
now = Time::now
- d.update(now.to_s)
- d.update(String(now.usec))
- d.update(String(rand(0)))
- d.update(String($$))
- d.update('foobar')
- session_id = d.hexdigest[0, 32]
+ md5.update(now.to_s)
+ md5.update(String(now.usec))
+ md5.update(String(rand(0)))
+ md5.update(String($$))
+ md5.update('foobar')
+ session_id = md5.hexdigest
end
session_id
end
@@ -456,7 +453,7 @@ class CGI
#
# +session+ is the session this instance is associated with.
# +option+ is a list of initialisation options. None are
- # currently recognized.
+ # currently recognised.
def initialize(session, option=nil)
@session_id = session.session_id
unless GLOBAL_HASH_TABLE.key?(@session_id)
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index 2dfb72bdce..a63d7d3984 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cgi/session/pstore.rb - persistent storage of marshalled session data
#
@@ -98,4 +97,15 @@ class CGI
end
end
end
-# :enddoc:
+
+if $0 == __FILE__
+ # :enddoc:
+ STDIN.reopen("/dev/null")
+ cgi = CGI.new
+ session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore)
+ session['key'] = {'k' => 'v'}
+ puts session['key'].class
+ fail unless Hash === session['key']
+ puts session['key'].inspect
+ fail unless session['key'].inspect == '{"k"=>"v"}'
+end
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 83c310b3cb..199e17bbbc 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
class CGI; module Util; end; extend Util; end
module CGI::Util
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
@@ -38,11 +37,6 @@ module CGI::Util
string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
end
- begin
- require 'cgi/escape'
- rescue LoadError
- end
-
# Unescape a string that has been HTML-escaped
# CGI::unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
# # => "Usage: foo \"bar\" <baz>"
@@ -96,10 +90,14 @@ module CGI::Util
end
# Synonym for CGI::escapeHTML(str)
- alias escape_html escapeHTML
+ def escape_html(str)
+ escapeHTML(str)
+ end
# Synonym for CGI::unescapeHTML(str)
- alias unescape_html unescapeHTML
+ def unescape_html(str)
+ unescapeHTML(str)
+ end
# Escape only the tags of certain HTML elements in +string+.
#
@@ -146,10 +144,14 @@ module CGI::Util
end
# Synonym for CGI::escapeElement(str)
- alias escape_element escapeElement
+ def escape_element(str)
+ escapeElement(str)
+ end
# Synonym for CGI::unescapeElement(str)
- alias unescape_element unescapeElement
+ def unescape_element(str)
+ unescapeElement(str)
+ end
# Abbreviated day-of-week names specified by RFC 822
RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
diff --git a/lib/cmath.rb b/lib/cmath.rb
index 41ab06e77c..337c2e063a 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -1,72 +1,60 @@
-# frozen_string_literal: false
##
-# = Trigonometric and transcendental functions for complex numbers.
-#
# CMath is a library that provides trigonometric and transcendental
-# functions for complex numbers. The functions in this module accept
-# integers, floating-point numbers or complex numbers as arguments.
-#
-# Note that the selection of functions is similar, but not identical,
-# to that in module math. The reason for having two modules is that
-# some users aren't interested in complex numbers, and perhaps don't
-# even know what they are. They would rather have Math.sqrt(-1) raise
-# an exception than return a complex number.
-#
-# For more information you can see Complex class.
+# functions for complex numbers.
#
# == Usage
#
-# To start using this library, simply require cmath library:
+# To start using this library, simply:
#
# require "cmath"
+#
+# Square root of a negative number is a complex number.
+#
+# CMath.sqrt(-9) #=> 0+3.0i
+#
module CMath
include Math
- # Backup of Math is needed because mathn.rb replaces Math with CMath.
- RealMath = Math # :nodoc:
- private_constant :RealMath
-
- %w[
- exp
- log
- log2
- log10
- sqrt
- cbrt
- sin
- cos
- tan
- sinh
- cosh
- tanh
- asin
- acos
- atan
- atan2
- asinh
- acosh
- atanh
- ].each do |meth|
- define_method(meth + '!') do |*args, &block|
- warn("CMath##{meth}! is deprecated; use CMath##{meth} or Math##{meth}") if $VERBOSE
- RealMath.send(meth, *args, &block)
- end
- end
+ alias exp! exp
+ alias log! log
+ alias log2! log2
+ alias log10! log10
+ alias sqrt! sqrt
+ alias cbrt! cbrt
+
+ alias sin! sin
+ alias cos! cos
+ alias tan! tan
+
+ alias sinh! sinh
+ alias cosh! cosh
+ alias tanh! tanh
+
+ alias asin! asin
+ alias acos! acos
+ alias atan! atan
+ alias atan2! atan2
+
+ alias asinh! asinh
+ alias acosh! acosh
+ alias atanh! atanh
##
# Math::E raised to the +z+ power
#
- # CMath.exp(1.i * Math::PI) #=> (-1.0+1.2246467991473532e-16i)
+ # exp(Complex(0,0)) #=> 1.0+0.0i
+ # exp(Complex(0,PI)) #=> -1.0+1.2246467991473532e-16i
+ # exp(Complex(0,PI/2.0)) #=> 6.123233995736766e-17+1.0i
def exp(z)
begin
if z.real?
- RealMath.exp(z)
+ exp!(z)
else
- ere = RealMath.exp(z.real)
- Complex(ere * RealMath.cos(z.imag),
- ere * RealMath.sin(z.imag))
+ ere = exp!(z.real)
+ Complex(ere * cos!(z.imag),
+ ere * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -74,17 +62,24 @@ module CMath
end
##
- # Returns the natural logarithm of Complex. If a second argument is given,
+ # Returns the natural logarithm of Complex. If a second argument is given,
# it will be the base of logarithm.
#
- # CMath.log(1 + 4i) #=> (1.416606672028108+1.3258176636680326i)
- # CMath.log(1 + 4i, 10) #=> (0.6152244606891369+0.5757952953408879i)
- def log(z, b=::Math::E)
+ # log(Complex(0,0)) #=> -Infinity+0.0i
+ def log(*args)
begin
- if z.real? && z >= 0 && b >= 0
- RealMath.log(z, b)
+ z, b = args
+ unless b.nil? || b.kind_of?(Numeric)
+ raise TypeError, "Numeric Number required"
+ end
+ if z.real? and z >= 0 and (b.nil? or b >= 0)
+ log!(*args)
else
- Complex(RealMath.log(z.abs), z.arg) / log(b)
+ a = Complex(log!(z.abs), z.arg)
+ if b
+ a /= log(b)
+ end
+ a
end
rescue NoMethodError
handle_no_method_error
@@ -92,15 +87,13 @@ module CMath
end
##
- # Returns the base 2 logarithm of +z+
- #
- # CMath.log2(-1) => (0.0+4.532360141827194i)
+ # returns the base 2 logarithm of +z+
def log2(z)
begin
if z.real? and z >= 0
- RealMath.log2(z)
+ log2!(z)
else
- log(z) / RealMath.log(2)
+ log(z) / log!(2)
end
rescue NoMethodError
handle_no_method_error
@@ -108,15 +101,13 @@ module CMath
end
##
- # Returns the base 10 logarithm of +z+
- #
- # CMath.log10(-1) #=> (0.0+1.3643763538418412i)
+ # returns the base 10 logarithm of +z+
def log10(z)
begin
if z.real? and z >= 0
- RealMath.log10(z)
+ log10!(z)
else
- log(z) / RealMath.log(10)
+ log(z) / log!(10)
end
rescue NoMethodError
handle_no_method_error
@@ -125,25 +116,26 @@ module CMath
##
# Returns the non-negative square root of Complex.
- #
- # CMath.sqrt(-1 + 0i) #=> 0.0+1.0i
+ # sqrt(-1) #=> 0+1.0i
+ # sqrt(Complex(-1,0)) #=> 0.0+1.0i
+ # sqrt(Complex(0,8)) #=> 2.0+2.0i
def sqrt(z)
begin
if z.real?
- if z < 0
- Complex(0, RealMath.sqrt(-z))
- else
- RealMath.sqrt(z)
- end
+ if z < 0
+ Complex(0, sqrt!(-z))
+ else
+ sqrt!(z)
+ end
else
- if z.imag < 0 ||
- (z.imag == 0 && z.imag.to_s[0] == '-')
- sqrt(z.conjugate).conjugate
- else
- r = z.abs
- x = z.real
- Complex(RealMath.sqrt((r + x) / 2.0), RealMath.sqrt((r - x) / 2.0))
- end
+ if z.imag < 0 ||
+ (z.imag == 0 && z.imag.to_s[0] == '-')
+ sqrt(z.conjugate).conjugate
+ else
+ r = z.abs
+ x = z.real
+ Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
+ end
end
rescue NoMethodError
handle_no_method_error
@@ -151,24 +143,20 @@ module CMath
end
##
- # Returns the principal value of the cube root of +z+
- #
- # CMath.cbrt(1 + 4i) #=> (1.449461632813119+0.6858152562177092i)
+ # returns the principal value of the cube root of +z+
def cbrt(z)
z ** (1.0/3)
end
##
- # Returns the sine of +z+, where +z+ is given in radians
- #
- # CMath.sin(1 + 1i) #=> (1.2984575814159773+0.6349639147847361i)
+ # returns the sine of +z+, where +z+ is given in radians
def sin(z)
begin
if z.real?
- RealMath.sin(z)
+ sin!(z)
else
- Complex(RealMath.sin(z.real) * RealMath.cosh(z.imag),
- RealMath.cos(z.real) * RealMath.sinh(z.imag))
+ Complex(sin!(z.real) * cosh!(z.imag),
+ cos!(z.real) * sinh!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -176,16 +164,14 @@ module CMath
end
##
- # Returns the cosine of +z+, where +z+ is given in radians
- #
- # CMath.cos(1 + 1i) #=> (0.8337300251311491-0.9888977057628651i)
+ # returns the cosine of +z+, where +z+ is given in radians
def cos(z)
begin
if z.real?
- RealMath.cos(z)
+ cos!(z)
else
- Complex(RealMath.cos(z.real) * RealMath.cosh(z.imag),
- -RealMath.sin(z.real) * RealMath.sinh(z.imag))
+ Complex(cos!(z.real) * cosh!(z.imag),
+ -sin!(z.real) * sinh!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -193,15 +179,13 @@ module CMath
end
##
- # Returns the tangent of +z+, where +z+ is given in radians
- #
- # CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)
+ # returns the tangent of +z+, where +z+ is given in radians
def tan(z)
begin
if z.real?
- RealMath.tan(z)
+ tan!(z)
else
- sin(z) / cos(z)
+ sin(z) / cos(z)
end
rescue NoMethodError
handle_no_method_error
@@ -209,16 +193,14 @@ module CMath
end
##
- # Returns the hyperbolic sine of +z+, where +z+ is given in radians
- #
- # CMath.sinh(1 + 1i) #=> (0.6349639147847361+1.2984575814159773i)
+ # returns the hyperbolic sine of +z+, where +z+ is given in radians
def sinh(z)
begin
if z.real?
- RealMath.sinh(z)
+ sinh!(z)
else
- Complex(RealMath.sinh(z.real) * RealMath.cos(z.imag),
- RealMath.cosh(z.real) * RealMath.sin(z.imag))
+ Complex(sinh!(z.real) * cos!(z.imag),
+ cosh!(z.real) * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -226,16 +208,14 @@ module CMath
end
##
- # Returns the hyperbolic cosine of +z+, where +z+ is given in radians
- #
- # CMath.cosh(1 + 1i) #=> (0.8337300251311491+0.9888977057628651i)
+ # returns the hyperbolic cosine of +z+, where +z+ is given in radians
def cosh(z)
begin
if z.real?
- RealMath.cosh(z)
+ cosh!(z)
else
- Complex(RealMath.cosh(z.real) * RealMath.cos(z.imag),
- RealMath.sinh(z.real) * RealMath.sin(z.imag))
+ Complex(cosh!(z.real) * cos!(z.imag),
+ sinh!(z.real) * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -243,15 +223,13 @@ module CMath
end
##
- # Returns the hyperbolic tangent of +z+, where +z+ is given in radians
- #
- # CMath.tanh(1 + 1i) #=> (1.0839233273386943+0.27175258531951174i)
+ # returns the hyperbolic tangent of +z+, where +z+ is given in radians
def tanh(z)
begin
if z.real?
- RealMath.tanh(z)
+ tanh!(z)
else
- sinh(z) / cosh(z)
+ sinh(z) / cosh(z)
end
rescue NoMethodError
handle_no_method_error
@@ -259,15 +237,13 @@ module CMath
end
##
- # Returns the arc sine of +z+
- #
- # CMath.asin(1 + 1i) #=> (0.6662394324925153+1.0612750619050355i)
+ # returns the arc sine of +z+
def asin(z)
begin
if z.real? and z >= -1 and z <= 1
- RealMath.asin(z)
+ asin!(z)
else
- (-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
+ (-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
end
rescue NoMethodError
handle_no_method_error
@@ -275,15 +251,13 @@ module CMath
end
##
- # Returns the arc cosine of +z+
- #
- # CMath.acos(1 + 1i) #=> (0.9045568943023813-1.0612750619050357i)
+ # returns the arc cosine of +z+
def acos(z)
begin
if z.real? and z >= -1 and z <= 1
- RealMath.acos(z)
+ acos!(z)
else
- (-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
+ (-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
end
rescue NoMethodError
handle_no_method_error
@@ -291,15 +265,13 @@ module CMath
end
##
- # Returns the arc tangent of +z+
- #
- # CMath.atan(1 + 1i) #=> (1.0172219678978514+0.4023594781085251i)
+ # returns the arc tangent of +z+
def atan(z)
begin
if z.real?
- RealMath.atan(z)
+ atan!(z)
else
- 1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
+ 1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
end
rescue NoMethodError
handle_no_method_error
@@ -309,14 +281,12 @@ module CMath
##
# returns the arc tangent of +y+ divided by +x+ using the signs of +y+ and
# +x+ to determine the quadrant
- #
- # CMath.atan2(1 + 1i, 0) #=> (1.5707963267948966+0.0i)
def atan2(y,x)
begin
if y.real? and x.real?
- RealMath.atan2(y,x)
+ atan2!(y,x)
else
- (-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
+ (-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
end
rescue NoMethodError
handle_no_method_error
@@ -325,14 +295,12 @@ module CMath
##
# returns the inverse hyperbolic sine of +z+
- #
- # CMath.asinh(1 + 1i) #=> (1.0612750619050357+0.6662394324925153i)
def asinh(z)
begin
if z.real?
- RealMath.asinh(z)
+ asinh!(z)
else
- log(z + sqrt(1.0 + z * z))
+ log(z + sqrt(1.0 + z * z))
end
rescue NoMethodError
handle_no_method_error
@@ -341,14 +309,12 @@ module CMath
##
# returns the inverse hyperbolic cosine of +z+
- #
- # CMath.acosh(1 + 1i) #=> (1.0612750619050357+0.9045568943023813i)
def acosh(z)
begin
if z.real? and z >= 1
- RealMath.acosh(z)
+ acosh!(z)
else
- log(z + sqrt(z * z - 1.0))
+ log(z + sqrt(z * z - 1.0))
end
rescue NoMethodError
handle_no_method_error
@@ -357,14 +323,12 @@ module CMath
##
# returns the inverse hyperbolic tangent of +z+
- #
- # CMath.atanh(1 + 1i) #=> (0.4023594781085251+1.0172219678978514i)
def atanh(z)
begin
if z.real? and z >= -1 and z <= 1
- RealMath.atanh(z)
+ atanh!(z)
else
- log((1.0 + z) / (1.0 - z)) / 2.0
+ log((1.0 + z) / (1.0 - z)) / 2.0
end
rescue NoMethodError
handle_no_method_error
@@ -433,3 +397,4 @@ module CMath
module_function :handle_no_method_error
end
+
diff --git a/lib/complex.rb b/lib/complex.rb
new file mode 100644
index 0000000000..9c57ecdf7a
--- /dev/null
+++ b/lib/complex.rb
@@ -0,0 +1,28 @@
+# :enddoc:
+
+warn('lib/complex.rb is deprecated') if $VERBOSE
+
+require 'cmath'
+
+unless defined?(Math.exp!)
+ Object.instance_eval{remove_const :Math}
+ Math = CMath
+end
+
+def Complex.generic? (other)
+ other.kind_of?(Integer) ||
+ other.kind_of?(Float) ||
+ other.kind_of?(Rational)
+end
+
+class Complex
+
+ alias image imag
+
+end
+
+class Numeric
+
+ def im() Complex(0, self) end
+
+end
diff --git a/lib/csv.rb b/lib/csv.rb
index ba9d62c706..804b941433 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -1,5 +1,4 @@
# encoding: US-ASCII
-# frozen_string_literal: true
# = csv.rb -- CSV Reading and Writing
#
# Created by James Edward Gray II on 2005-10-31.
@@ -177,7 +176,7 @@ require "stringio"
# support. For example, <tt>:col_sep</tt>, <tt>:row_sep</tt>, and
# <tt>:quote_char</tt> must be transcoded to match your data. Hopefully this
# makes the entire process feel transparent, since CSV's defaults should just
-# magically work for your data. However, you can set these values manually in
+# magically work for you data. However, you can set these values manually in
# the target Encoding to avoid the translation.
#
# It's also important to note that while all of CSV's core parser is now
@@ -208,7 +207,7 @@ require "stringio"
#
class CSV
# The version of the installed library.
- VERSION = "2.4.8"
+ VERSION = "2.4.8".freeze
#
# A CSV::Row is part Array and part Hash. It retains an order for the fields
@@ -236,13 +235,12 @@ class CSV
#
def initialize(headers, fields, header_row = false)
@header_row = header_row
- headers.each { |h| h.freeze if h.is_a? String }
# handle extra headers or fields
- @row = if headers.size >= fields.size
+ @row = if headers.size > fields.size
headers.zip(fields)
else
- fields.zip(headers).map { |pair| pair.reverse! }
+ fields.zip(headers).map { |pair| pair.reverse }
end
end
@@ -279,21 +277,17 @@ class CSV
# This method will return the field value by +header+ or +index+. If a field
# is not found, +nil+ is returned.
#
- # When provided, +offset+ ensures that a header match occurs on or later
+ # When provided, +offset+ ensures that a header match occurrs on or later
# than the +offset+ index. You can use this to find duplicate headers,
# without resorting to hard-coding exact indices.
#
def field(header_or_index, minimum_index = 0)
# locate the pair
- finder = (header_or_index.is_a?(Integer) || header_or_index.is_a?(Range)) ? :[] : :assoc
+ finder = header_or_index.is_a?(Integer) ? :[] : :assoc
pair = @row[minimum_index..-1].send(finder, header_or_index)
# return the field if we have a pair
- if pair.nil?
- nil
- else
- header_or_index.is_a?(Range) ? pair.map(&:last) : pair.last
- end
+ pair.nil? ? nil : pair.last
end
alias_method :[], :field
@@ -522,7 +516,7 @@ class CSV
end
#
- # Collapses the row into a simple Hash. Be warned that this discards field
+ # Collapses the row into a simple Hash. Be warning that this discards field
# order and clobbers duplicate fields.
#
def to_hash
@@ -695,7 +689,7 @@ class CSV
#
def [](index_or_header)
if @mode == :row or # by index
- (@mode == :col_or_row and (index_or_header.is_a?(Integer) or index_or_header.is_a?(Range)))
+ (@mode == :col_or_row and index_or_header.is_a? Integer)
@table[index_or_header]
else # by header
@table.map { |row| row[index_or_header] }
@@ -817,7 +811,7 @@ class CSV
#
# Removes any column or row for which the block returns +true+. In the
# default mixed mode or row mode, iteration is the standard row major
- # walking of rows. In column mode, iteration will +yield+ two element
+ # walking of rows. In column mode, interation will +yield+ two element
# tuples containing the column name and an Array of values for that column.
#
# This method returns the table for chaining.
@@ -840,7 +834,7 @@ class CSV
#
# In the default mixed mode or row mode, iteration is the standard row major
- # walking of rows. In column mode, iteration will +yield+ two element
+ # walking of rows. In column mode, interation will +yield+ two element
# tuples containing the column name and an Array of values for that column.
#
# This method returns the table for chaining.
@@ -949,32 +943,30 @@ class CSV
# To add a combo field, the value should be an Array of names. Combo fields
# can be nested with other combo fields.
#
- Converters = {
- integer: lambda { |f|
- Integer(f.encode(ConverterEncoding)) rescue f
- },
- float: lambda { |f|
- Float(f.encode(ConverterEncoding)) rescue f
- },
- numeric: [:integer, :float],
- date: lambda { |f|
- begin
- e = f.encode(ConverterEncoding)
- e =~ DateMatcher ? Date.parse(e) : f
- rescue # encoding conversion or date parse errors
- f
- end
- },
- date_time: lambda { |f|
- begin
- e = f.encode(ConverterEncoding)
- e =~ DateTimeMatcher ? DateTime.parse(e) : f
- rescue # encoding conversion or date parse errors
- f
- end
- },
- all: [:date_time, :numeric],
- }
+ Converters = { integer: lambda { |f|
+ Integer(f.encode(ConverterEncoding)) rescue f
+ },
+ float: lambda { |f|
+ Float(f.encode(ConverterEncoding)) rescue f
+ },
+ numeric: [:integer, :float],
+ date: lambda { |f|
+ begin
+ e = f.encode(ConverterEncoding)
+ e =~ DateMatcher ? Date.parse(e) : f
+ rescue # encoding conversion or date parse errors
+ f
+ end
+ },
+ date_time: lambda { |f|
+ begin
+ e = f.encode(ConverterEncoding)
+ e =~ DateTimeMatcher ? DateTime.parse(e) : f
+ rescue # encoding conversion or date parse errors
+ f
+ end
+ },
+ all: [:date_time, :numeric] }
#
# This Hash holds the built-in header converters of CSV that can be accessed
@@ -990,7 +982,7 @@ class CSV
# attempting a conversion. If your data cannot be transcoded to UTF-8 the
# conversion will fail and the header will remain unchanged.
#
- # This Hash is intentionally left unfrozen and users should feel free to add
+ # This Hash is intetionally left unfrozen and users should feel free to add
# values to it that can be accessed by all CSV objects.
#
# To add a combo field, the value should be an Array of names. Combo fields
@@ -999,8 +991,8 @@ class CSV
HeaderConverters = {
downcase: lambda { |h| h.encode(ConverterEncoding).downcase },
symbol: lambda { |h|
- h.encode(ConverterEncoding).downcase.strip.gsub(/\s+/, "_").
- gsub(/\W+/, "").to_sym
+ h.encode(ConverterEncoding).downcase.gsub(/\s+/, "_").
+ gsub(/\W+/, "").to_sym
}
}
@@ -1020,20 +1012,18 @@ class CSV
# <b><tt>:force_quotes</tt></b>:: +false+
# <b><tt>:skip_lines</tt></b>:: +nil+
#
- DEFAULT_OPTIONS = {
- col_sep: ",",
- row_sep: :auto,
- quote_char: '"',
- field_size_limit: nil,
- converters: nil,
- unconverted_fields: nil,
- headers: false,
- return_headers: false,
- header_converters: nil,
- skip_blanks: false,
- force_quotes: false,
- skip_lines: nil,
- }.freeze
+ DEFAULT_OPTIONS = { col_sep: ",",
+ row_sep: :auto,
+ quote_char: '"',
+ field_size_limit: nil,
+ converters: nil,
+ unconverted_fields: nil,
+ headers: false,
+ return_headers: false,
+ header_converters: nil,
+ skip_blanks: false,
+ force_quotes: false,
+ skip_lines: nil }.freeze
#
# This method will return a CSV instance, just like CSV::new(), but the
@@ -1142,7 +1132,7 @@ class CSV
# append CSV rows to the String and when the block exits, the final String
# will be returned.
#
- # Note that a passed String *is* modified by this method. Call dup() before
+ # Note that a passed String *is* modfied by this method. Call dup() before
# passing if you need a new String.
#
# The +options+ parameter can be anything CSV::new() understands. This method
@@ -1157,9 +1147,9 @@ class CSV
io.seek(0, IO::SEEK_END)
args.unshift(io)
else
- encoding = args[-1][:encoding] if args.last.is_a?(Hash)
- str = String.new
- str.force_encoding(encoding) if encoding
+ encoding = (args[-1] = args[-1].dup).delete(:encoding) if args.last.is_a?(Hash)
+ str = ""
+ str.encode!(encoding) if encoding
args.unshift(str)
end
csv = new(*args) # wrap
@@ -1183,7 +1173,7 @@ class CSV
def self.generate_line(row, options = Hash.new)
options = {row_sep: $INPUT_RECORD_SEPARATOR}.merge(options)
encoding = options.delete(:encoding)
- str = String.new
+ str = ""
if encoding
str.force_encoding(encoding)
elsif field = row.find { |f| not f.nil? }
@@ -1269,12 +1259,7 @@ class CSV
file_opts = {encoding: Encoding.default_external}.merge(file_opts)
retry
end
- begin
- csv = new(f, options)
- rescue Exception
- f.close
- raise
- end
+ csv = new(f, options)
# handle blocks like Ruby's open(), not like the CSV library
if block_given?
@@ -1364,7 +1349,7 @@ class CSV
# a String for +data+, you can later retrieve it (after writing to it, for
# example) with CSV.string().
#
- # Note that a wrapped String will be positioned at the beginning (for
+ # Note that a wrapped String will be positioned at at the beginning (for
# reading). If you want it at the end (for writing), use CSV::generate().
# If you want any other positioning, pass a preset StringIO object instead.
#
@@ -1410,7 +1395,7 @@ class CSV
# <tt>'</tt> as the quote character
# instead of the correct <tt>"</tt>.
# CSV will always consider a double
- # sequence of this character to be an
+ # sequence this character to be an
# escaped quote. This String will be
# transcoded into the data's Encoding
# before parsing.
@@ -1479,26 +1464,17 @@ class CSV
# if the data cannot be transcoded,
# leaving the header unchanged.
# <b><tt>:skip_blanks</tt></b>:: When set to a +true+ value, CSV will
- # skip over any empty rows. Note that
- # this setting will not skip rows that
- # contain column separators, even if
- # the rows contain no actual data. If
- # you want to skip rows that contain
- # separators but no content, consider
- # using <tt>:skip_lines</tt>, or
- # inspecting fields.compact.empty? on
- # each row.
+ # skip over any rows with no content.
# <b><tt>:force_quotes</tt></b>:: When set to a +true+ value, CSV will
# quote all CSV fields it creates.
# <b><tt>:skip_lines</tt></b>:: When set to an object responding to
# <tt>match</tt>, every line matching
# it is considered a comment and ignored
- # during parsing. When set to a String,
- # it is first converted to a Regexp.
- # When set to +nil+ no line is considered
- # a comment. If the passed object does
- # not respond to <tt>match</tt>,
- # <tt>ArgumentError</tt> is thrown.
+ # during parsing. When set to +nil+
+ # no line is considered a comment.
+ # If the passed object does not respond
+ # to <tt>match</tt>, <tt>ArgumentError</tt>
+ # is thrown.
#
# See CSV::DEFAULT_OPTIONS for the default settings.
#
@@ -1506,10 +1482,6 @@ class CSV
# so be sure to set what you want here.
#
def initialize(data, options = Hash.new)
- if data.nil?
- raise ArgumentError.new("Cannot parse nil as CSV")
- end
-
# build the options for this read/write
options = DEFAULT_OPTIONS.merge(options)
@@ -1532,8 +1504,9 @@ class CSV
# prepare for building safe regular expressions in the target encoding,
# if we can transcode the needed characters
#
- @re_esc = "\\".encode(@encoding).freeze rescue ""
- @re_chars = /#{%"[-\\]\\[\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
+ @re_esc = "\\".encode(@encoding) rescue ""
+ @re_chars = /#{%"[-][\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
+ # @re_chars = /#{%"[-][\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding, fallback: proc{""})}/
init_separators(options)
init_parsers(options)
@@ -1541,7 +1514,7 @@ class CSV
init_headers(options)
init_comments(options)
- @force_encoding = !!(encoding || options.delete(:encoding))
+ options.delete(:encoding)
options.delete(:internal_encoding)
options.delete(:external_encoding)
unless options.empty?
@@ -1681,13 +1654,10 @@ class CSV
output = row.map(&@quote).join(@col_sep) + @row_sep # quote and separate
if @io.is_a?(StringIO) and
- output.encoding != (encoding = raw_encoding)
- if @force_encoding
- output = output.encode(encoding)
- elsif (compatible_encoding = Encoding.compatible?(@io.string, output))
- @io.set_encoding(compatible_encoding)
- @io.seek(0, IO::SEEK_END)
- end
+ output.encoding != raw_encoding and
+ (compatible_encoding = Encoding.compatible?(@io.string, output))
+ @io.set_encoding(compatible_encoding)
+ @io.seek(0, IO::SEEK_END)
end
@io << output
@@ -1859,7 +1829,7 @@ class CSV
csv.last << @col_sep
end
elsif part[0] == @quote_char
- # If we are starting a new quoted column
+ # If we are staring a new quoted column
if part[-1] != @quote_char || part.count(@quote_char) % 2 != 0
# start an extended column
csv << part[1..-1]
@@ -1997,7 +1967,7 @@ class CSV
else
begin
#
- # remember where we were (pos() will raise an exception if @io is pipe
+ # remember where we were (pos() will raise an axception if @io is pipe
# or not opened for reading)
#
saved_pos = @io.pos
@@ -2103,7 +2073,7 @@ class CSV
# are set. When +field_name+ is <tt>:header_converters</tt> header converters
# are added instead.
#
- # The <tt>:unconverted_fields</tt> option is also activated for
+ # The <tt>:unconverted_fields</tt> option is also actived for
# <tt>:converters</tt> calls, if requested.
#
def init_converters(options, field_name = :converters)
@@ -2150,12 +2120,10 @@ class CSV
# Stores the pattern of comments to skip from the provided options.
#
# The pattern must respond to +.match+, else ArgumentError is raised.
- # Strings are converted to a Regexp.
#
# See also CSV.new
def init_comments(options)
@skip_lines = options.delete(:skip_lines)
- @skip_lines = Regexp.new(@skip_lines) if @skip_lines.is_a? String
if @skip_lines and not @skip_lines.respond_to?(:match)
raise ArgumentError, ":skip_lines has to respond to matches"
end
@@ -2197,14 +2165,13 @@ class CSV
fields.map.with_index do |field, index|
converters.each do |converter|
- break if field.nil?
field = if converter.arity == 1 # straight field converter
converter[field]
else # FieldInfo converter
header = @use_headers && !headers ? @headers[index] : nil
converter[field, FieldInfo.new(index, lineno, header)]
end
- break unless field.is_a? String # short-circuit pipeline for speed
+ break unless field.is_a? String # short-curcuit pipeline for speed
end
field # final state of each field, converted or original
end
@@ -2238,7 +2205,6 @@ class CSV
# prepare converted and unconverted copies
row = @headers if row.nil?
@headers = convert_fields(@headers, true)
- @headers.each { |h| h.freeze if h.is_a? String }
if @return_headers # return headers
return self.class::Row.new(@headers, row, true)
diff --git a/lib/debug.rb b/lib/debug.rb
index 5d754d8ebb..67861cba64 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
# Copyright (C) 2000 Information-technology Promotion Agency, Japan
# Copyright (C) 2000-2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
@@ -917,7 +916,7 @@ EOHELP
# Returns the list of break points where execution will be stopped.
#
- # See DEBUGGER__ for more usage
+ # See DEBUGGER__ for more useage
def break_points
@break_points
end
@@ -1009,29 +1008,6 @@ EOHELP
@stdout.print "\n"
end
- # Prints all threads in @thread_list to @stdout. Returns a sorted array of
- # values from the @thread_list hash.
- #
- # While in the debugger you can list all of
- # the threads with: <b>DEBUGGER__.thread_list_all</b>
- #
- # (rdb:1) DEBUGGER__.thread_list_all
- # +1 #<Thread:0x007fb2320c03f0 run> debug_me.rb.rb:3
- # 2 #<Thread:0x007fb23218a538@debug_me.rb.rb:3 sleep>
- # 3 #<Thread:0x007fb23218b0f0@debug_me.rb.rb:3 sleep>
- # [1, 2, 3]
- #
- # Your current thread is indicated by a <b>+</b>
- #
- # Additionally you can list all threads with <b>th l</b>
- #
- # (rdb:1) th l
- # +1 #<Thread:0x007f99328c0410 run> debug_me.rb:3
- # 2 #<Thread:0x007f9932938230@debug_me.rb:3 sleep> debug_me.rb:3
- # 3 #<Thread:0x007f9932938e10@debug_me.rb:3 sleep> debug_me.rb:3
- #
- # See DEBUGGER__ for more usage.
-
def thread_list_all
for th in @thread_list.values.sort
thread_list(th)
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 4ce3c53cc9..0eaf37122b 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = delegate -- Support for the Delegation Pattern
#
# Documentation by James Edward Gray II and Gavin Sinclair
@@ -18,10 +17,15 @@
# yourself needing this control, have a look at Forwardable which is also in
# the standard library. It may suit your needs better.)
#
-# SimpleDelegator's implementation serves as a nice example of the use of
+# SimpleDelegator's implementation serves as a nice example if the use of
# Delegator:
#
# class SimpleDelegator < Delegator
+# def initialize(obj)
+# super # pass obj to Delegator constructor, required
+# @delegate_sd_obj = obj # store obj for future use
+# end
+#
# def __getobj__
# @delegate_sd_obj # return object we are delegating to, required
# end
@@ -44,7 +48,7 @@ class Delegator < BasicObject
undef_method m
end
private_instance_methods.each do |m|
- if /\Ablock_given\?\z|iterator\?\z|\A__.*__\z/ =~ m
+ if /\Ablock_given\?\z|iterator\?\z|\A__raise__\z/ =~ m
next
end
undef_method m
@@ -58,12 +62,6 @@ class Delegator < BasicObject
end
# :startdoc:
- ##
- # :method: raise
- # Use __raise__ if your Delegator does not have a object to delegate the
- # raise method call.
- #
-
#
# Pass in the _obj_ to delegate method calls to. All methods supported by
# _obj_ will be delegated to.
@@ -76,15 +74,17 @@ class Delegator < BasicObject
# Handles the magic of delegation through \_\_getobj\_\_.
#
def method_missing(m, *args, &block)
- r = true
- target = self.__getobj__ {r = false}
-
- if r && target.respond_to?(m)
- target.__send__(m, *args, &block)
- elsif ::Kernel.respond_to?(m, true)
- ::Kernel.instance_method(m).bind(self).(*args, &block)
- else
- super(m, *args, &block)
+ target = self.__getobj__
+ begin
+ if target.respond_to?(m)
+ target.__send__(m, *args, &block)
+ elsif ::Kernel.respond_to?(m, true)
+ ::Kernel.instance_method(m).bind(self).(*args, &block)
+ else
+ super(m, *args, &block)
+ end
+ ensure
+ $@.delete_if {|t| %r"\A#{Regexp.quote(__FILE__)}:(?:#{[__LINE__-7, __LINE__-5, __LINE__-3].join('|')}):"o =~ t} if $@
end
end
@@ -93,10 +93,8 @@ class Delegator < BasicObject
# call through \_\_getobj\_\_.
#
def respond_to_missing?(m, include_private)
- r = true
- target = self.__getobj__ {r = false}
- r &&= target.respond_to?(m, include_private)
- if r && include_private && !target.respond_to?(m, false)
+ r = self.__getobj__.respond_to?(m, include_private)
+ if r && include_private && !self.__getobj__.respond_to?(m, false)
warn "#{caller(3)[0]}: delegator does not forward private method \##{m}"
return false
end
@@ -247,7 +245,7 @@ end
#
# class User
# def born_on
-# Date.new(1989, 9, 10)
+# Date.new(1989, 09, 10)
# end
# end
#
@@ -308,10 +306,7 @@ end
class SimpleDelegator<Delegator
# Returns the current object method calls are being delegated to.
def __getobj__
- unless defined?(@delegate_sd_obj)
- return yield if block_given?
- __raise__ ::ArgumentError, "not delegated"
- end
+ __raise__ ::ArgumentError, "not delegated" unless defined?(@delegate_sd_obj)
@delegate_sd_obj
end
@@ -338,7 +333,11 @@ end
def Delegator.delegating_block(mid) # :nodoc:
lambda do |*args, &block|
target = self.__getobj__
- target.__send__(mid, *args, &block)
+ begin
+ target.__send__(mid, *args, &block)
+ ensure
+ $@.delete_if {|t| /\A#{Regexp.quote(__FILE__)}:#{__LINE__-2}:/o =~ t} if $@
+ end
end
end
@@ -382,10 +381,7 @@ def DelegateClass(superclass)
methods -= [:to_s,:inspect,:=~,:!~,:===]
klass.module_eval do
def __getobj__ # :nodoc:
- unless defined?(@delegate_dc_obj)
- return yield if block_given?
- __raise__ ::ArgumentError, "not delegated"
- end
+ __raise__ ::ArgumentError, "not delegated" unless defined?(@delegate_dc_obj)
@delegate_dc_obj
end
def __setobj__(obj) # :nodoc:
@@ -404,3 +400,37 @@ def DelegateClass(superclass)
end
return klass
end
+
+# :enddoc:
+
+if __FILE__ == $0
+ class ExtArray<DelegateClass(Array)
+ def initialize()
+ super([])
+ end
+ end
+
+ ary = ExtArray.new
+ p ary.class
+ ary.push 25
+ p ary
+ ary.push 42
+ ary.each {|x| p x}
+
+ foo = Object.new
+ def foo.test
+ 25
+ end
+ def foo.iter
+ yield self
+ end
+ def foo.error
+ raise 'this is OK'
+ end
+ foo2 = SimpleDelegator.new(foo)
+ p foo2
+ foo2.instance_eval{print "foo\n"}
+ p foo.test == foo2.test # => true
+ p foo2.iter{[55,true]} # => true
+ foo2.error # raise error!
+end
diff --git a/lib/drb.rb b/lib/drb.rb
index 2bb4716fa2..93cc811e14 100644
--- a/lib/drb.rb
+++ b/lib/drb.rb
@@ -1,3 +1,2 @@
-# frozen_string_literal: false
require 'drb/drb'
diff --git a/lib/drb/acl.rb b/lib/drb/acl.rb
index 520b7df71d..29a378199f 100644
--- a/lib/drb/acl.rb
+++ b/lib/drb/acl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Copyright (c) 2000,2002,2003 Masatoshi SEKI
#
# acl.rb is copyrighted free software by Masatoshi SEKI.
@@ -224,10 +223,28 @@ class ACL
when 'deny'
@deny.add(domain)
else
- raise "Invalid ACL entry #{list}"
+ raise "Invalid ACL entry #{list.to_s}"
end
i += 2
end
end
end
+
+if __FILE__ == $0
+ # example
+ list = %w(deny all
+ allow 192.168.1.1
+ allow ::ffff:192.168.1.2
+ allow 192.168.1.3
+ )
+
+ addr = ["AF_INET", 10, "lc630", "192.168.1.3"]
+
+ acl = ACL.new
+ p acl.allow_addr?(addr)
+
+ acl = ACL.new(list, ACL::DENY_ALLOW)
+ p acl.allow_addr?(addr)
+end
+
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index 8011660156..97965228bb 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = drb/drb.rb
#
@@ -48,7 +47,7 @@
require 'socket'
require 'thread'
-require 'io/wait'
+require 'fcntl'
require 'drb/eq'
#
@@ -178,9 +177,6 @@ require 'drb/eq'
# # Not necessary for this small example, but will be required
# # as soon as we pass a non-marshallable object as an argument
# # to a dRuby call.
-# #
-# # Note: this must be called at least once per process to take any effect.
-# # This is particularly important if your application forks.
# DRb.start_service
#
# timeserver = DRbObject.new_with_uri(SERVER_URI)
@@ -746,7 +742,7 @@ module DRb
end
end
if first && (config[:auto_load] != false)
- auto_load(uri)
+ auto_load(uri, config)
return open(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' + uri
@@ -770,7 +766,7 @@ module DRb
end
end
if first && (config[:auto_load] != false)
- auto_load(uri)
+ auto_load(uri, config)
return open_server(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' + uri
@@ -793,14 +789,14 @@ module DRb
end
end
if first && (config[:auto_load] != false)
- auto_load(uri)
+ auto_load(uri, config)
return uri_option(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' + uri
end
module_function :uri_option
- def auto_load(uri) # :nodoc:
+ def auto_load(uri, config) # :nodoc:
if uri =~ /^drb([a-z0-9]+):/
require("drb/#{$1}") rescue nil
end
@@ -906,7 +902,6 @@ module DRb
@acl = config[:tcp_acl]
@msg = DRbMessage.new(config)
set_sockopt(@socket)
- @shutdown_pipe_r, @shutdown_pipe_w = IO.pipe
end
# Get the URI that we are connected to.
@@ -954,28 +949,14 @@ module DRb
@socket.close
@socket = nil
end
- close_shutdown_pipe
end
- def close_shutdown_pipe
- if @shutdown_pipe_r && !@shutdown_pipe_r.closed?
- @shutdown_pipe_r.close
- @shutdown_pipe_r = nil
- end
- if @shutdown_pipe_w && !@shutdown_pipe_w.closed?
- @shutdown_pipe_w.close
- @shutdown_pipe_w = nil
- end
- end
- private :close_shutdown_pipe
-
# On the server side, for an instance returned by #open_server,
# accept a client connection and return a new instance to handle
# the server's side of this client-server session.
def accept
while true
- s = accept_or_shutdown
- return nil unless s
+ s = @socket.accept
break if (@acl ? @acl.allow_socket?(s) : true)
s.close
end
@@ -987,24 +968,10 @@ module DRb
self.class.new(uri, s, @config)
end
- def accept_or_shutdown
- readables, = IO.select([@socket, @shutdown_pipe_r])
- if readables.include? @shutdown_pipe_r
- return nil
- end
- @socket.accept
- end
- private :accept_or_shutdown
-
- # Graceful shutdown
- def shutdown
- @shutdown_pipe_w.close if @shutdown_pipe_w && !@shutdown_pipe_w.closed?
- end
-
# Check to see if this connection is alive.
def alive?
return false unless @socket
- if @socket.to_io.wait_readable(0)
+ if IO.select([@socket], nil, nil, 0)
close
return false
end
@@ -1013,6 +980,7 @@ module DRb
def set_sockopt(soc) # :nodoc:
soc.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
+ soc.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::FD_CLOEXEC
end
end
@@ -1024,7 +992,7 @@ module DRb
def initialize(option)
@option = option.to_s
end
- attr_reader :option
+ attr :option
def to_s; @option; end
def ==(other)
@@ -1467,12 +1435,7 @@ module DRb
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
Thread.current['DRb']['stop_service'] = true
else
- if @protocol.respond_to? :shutdown
- @protocol.shutdown
- else
- [@thread, *@grp.list].each {|thread| thread.kill} # xxx: Thread#kill
- end
- @thread.join
+ @thread.kill.join
end
end
@@ -1497,7 +1460,8 @@ module DRb
def run
Thread.start do
begin
- while main_loop
+ while true
+ main_loop
end
ensure
@protocol.close if @protocol
@@ -1627,9 +1591,16 @@ module DRb
end
- require 'drb/invokemethod'
- class InvokeMethod
- include InvokeMethod18Mixin
+ if RUBY_VERSION >= '1.8'
+ require 'drb/invokemethod'
+ class InvokeMethod
+ include InvokeMethod18Mixin
+ end
+ else
+ require 'drb/invokemethod16'
+ class InvokeMethod
+ include InvokeMethod16Mixin
+ end
end
# The main loop performed by a DRbServer's internal thread.
@@ -1640,9 +1611,7 @@ module DRb
# returning responses, until the client closes the connection
# or a local method call fails.
def main_loop
- client0 = @protocol.accept
- return nil if !client0
- Thread.start(client0) do |client|
+ Thread.start(@protocol.accept) do |client|
@grp.add Thread.current
Thread.current['DRb'] = { 'client' => client ,
'server' => self }
diff --git a/lib/drb/eq.rb b/lib/drb/eq.rb
index 15ca5cae42..553f30c598 100644
--- a/lib/drb/eq.rb
+++ b/lib/drb/eq.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module DRb
class DRbObject # :nodoc:
def ==(other)
diff --git a/lib/drb/extserv.rb b/lib/drb/extserv.rb
index 1cb1be4709..c70ced877c 100644
--- a/lib/drb/extserv.rb
+++ b/lib/drb/extserv.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
=begin
external service
Copyright (c) 2000,2002 Masatoshi SEKI
@@ -42,3 +41,33 @@ module DRb
end
end
end
+
+# :stopdoc:
+
+if __FILE__ == $0
+ class Foo
+ include DRbUndumped
+
+ def initialize(str)
+ @str = str
+ end
+
+ def hello(it)
+ "#{it}: #{self}"
+ end
+
+ def to_s
+ @str
+ end
+ end
+
+ cmd = ARGV.shift
+ case cmd
+ when 'itest1', 'itest2'
+ front = Foo.new(cmd)
+ manager = DRb::DRbServer.new(nil, front)
+ es = DRb::ExtServ.new(ARGV.shift, ARGV.shift, manager)
+ es.server.thread.join
+ end
+end
+
diff --git a/lib/drb/extservm.rb b/lib/drb/extservm.rb
index e2637aa62c..8a7fc316af 100644
--- a/lib/drb/extservm.rb
+++ b/lib/drb/extservm.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
=begin
external service manager
Copyright (c) 2000 Masatoshi SEKI
@@ -38,7 +37,7 @@ module DRb
synchronize do
while true
server = @servers[name]
- return server if server&.alive?
+ return server if server && server.alive?
invoke_service(name)
@cond.wait
end
diff --git a/lib/drb/gw.rb b/lib/drb/gw.rb
index d000507644..b3568ab08d 100644
--- a/lib/drb/gw.rb
+++ b/lib/drb/gw.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'drb/drb'
require 'monitor'
diff --git a/lib/drb/invokemethod.rb b/lib/drb/invokemethod.rb
index 0fae6d52b6..71ebec11f6 100644
--- a/lib/drb/invokemethod.rb
+++ b/lib/drb/invokemethod.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# for ruby-1.8.0
module DRb # :nodoc: all
diff --git a/lib/drb/observer.rb b/lib/drb/observer.rb
index 3ee15331a1..cab9ebc60b 100644
--- a/lib/drb/observer.rb
+++ b/lib/drb/observer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'observer'
module DRb
diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb
index 8d2724e736..8651702797 100644
--- a/lib/drb/ssl.rb
+++ b/lib/drb/ssl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'socket'
require 'openssl'
require 'drb/drb'
@@ -43,7 +42,7 @@ module DRb
# Create a new DRb::DRbSSLSocket::SSLConfig instance
#
# The DRb::DRbSSLSocket will take either a +config+ Hash or an instance
- # of SSLConfig, and will setup the certificate for its session for the
+ # of SSLConfg, and will setup the certificate for its session for the
# configuration. If want it to generate a generic certificate, the bare
# minimum is to provide the :SSLCertName
#
@@ -300,7 +299,7 @@ module DRb
# +uri+ is the URI we are connected to.
# +soc+ is the tcp socket we are bound to.
# +config+ is our configuration. Either a Hash or SSLConfig
- # +is_established+ is a boolean of whether +soc+ is currently established
+ # +is_established+ is a boolean of whether +soc+ is currenly established
#
# This is called automatically based on the DRb protocol.
def initialize(uri, soc, config, is_established)
@@ -323,16 +322,14 @@ module DRb
def accept # :nodoc:
begin
while true
- soc = accept_or_shutdown
- return nil unless soc
+ soc = @socket.accept
break if (@acl ? @acl.allow_socket?(soc) : true)
soc.close
end
begin
- ssl = @config.accept(soc)
- rescue Exception
- soc.close
- raise
+ ssl = @config.accept(soc)
+ ensure
+ soc.close if $!
end
self.class.new(uri, ssl, @config, true)
rescue OpenSSL::SSL::SSLError
diff --git a/lib/drb/timeridconv.rb b/lib/drb/timeridconv.rb
index 7e2a6cf998..4ea3035f39 100644
--- a/lib/drb/timeridconv.rb
+++ b/lib/drb/timeridconv.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'drb/drb'
require 'monitor'
@@ -18,27 +17,26 @@ module DRb
class InvalidIndexError < RuntimeError; end
- def initialize(keeping=600)
+ def initialize(timeout=600)
super()
@sentinel = Object.new
@gc = {}
+ @curr = {}
@renew = {}
- @keeping = keeping
- @expires = Time.now + @keeping
+ @timeout = timeout
+ @keeper = keeper
end
def add(obj)
synchronize do
- rotate
key = obj.__id__
- @renew[key] = obj
+ @curr[key] = obj
return key
end
end
def fetch(key, dv=@sentinel)
synchronize do
- rotate
obj = peek(key)
if obj == @sentinel
return dv unless dv == @sentinel
@@ -49,35 +47,42 @@ module DRb
end
end
- private
+ def include?(key)
+ synchronize do
+ obj = peek(key)
+ return false if obj == @sentinel
+ true
+ end
+ end
+
def peek(key)
synchronize do
- return @renew.fetch(key) { @gc.fetch(key, @sentinel) }
+ return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel)))
end
end
- def rotate
+ private
+ def alternate
synchronize do
- return if @expires > Time.now
- @gc = @renew # GCed
+ @gc = @curr # GCed
+ @curr = @renew
@renew = {}
- @expires = Time.now + @keeping
end
end
def keeper
Thread.new do
loop do
- rotate
- sleep(@keeping)
+ alternate
+ sleep(@timeout)
end
end
end
end
- # Creates a new TimerIdConv which will hold objects for +keeping+ seconds.
- def initialize(keeping=600)
- @holder = TimerHolder2.new(keeping)
+ # Creates a new TimerIdConv which will hold objects for +timeout+ seconds.
+ def initialize(timeout=600)
+ @holder = TimerHolder2.new(timeout)
end
def to_obj(ref) # :nodoc:
diff --git a/lib/drb/unix.rb b/lib/drb/unix.rb
index adacf6df5b..4d245780a5 100644
--- a/lib/drb/unix.rb
+++ b/lib/drb/unix.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'socket'
require 'drb/drb'
require 'tmpdir'
@@ -99,17 +98,15 @@ module DRb
@socket.close
File.unlink(path) if @server_mode
@socket = nil
- close_shutdown_pipe
end
def accept
- s = accept_or_shutdown
- return nil unless s
+ s = @socket.accept
self.class.new(nil, s, @config)
end
def set_sockopt(soc)
- # no-op for now
+ soc.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::FD_CLOEXEC
end
end
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index a9990b5ec5..3473a1c844 100644
--- a/lib/e2mmap.rb
+++ b/lib/e2mmap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
#--
# e2mmap.rb - for Ruby 1.1
@@ -53,6 +52,7 @@
#
#
module Exception2MessageMapper
+ @RCS_ID='-$Id: e2mmap.rb,v 1.10 1999/02/17 12:33:17 keiju Exp keiju $-'
E2MM = Exception2MessageMapper # :nodoc:
@@ -142,6 +142,8 @@ module Exception2MessageMapper
def E2MM.Raise(klass = E2MM, err = nil, *rest)
if form = e2mm_message(klass, err)
b = $@.nil? ? caller(1) : $@
+ #p $@
+ #p __FILE__
b.shift if b[0] =~ /^#{Regexp.quote(__FILE__)}:/
raise err, sprintf(form, *rest), b
else
@@ -155,6 +157,7 @@ module Exception2MessageMapper
def E2MM.e2mm_message(klass, exp)
for c in klass.ancestors
if mes = @MessageMap[[c,exp]]
+ #p mes
m = klass.instance_eval('"' + mes + '"')
return m
end
@@ -167,7 +170,7 @@ module Exception2MessageMapper
E2MM.def_exception(E2MM,
:ErrNotRegisteredException,
- "not registered exception(%s)")
+ "not registerd exception(%s)")
end
diff --git a/lib/erb.rb b/lib/erb.rb
index e89d9c1fd0..5c89cb403e 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -1,5 +1,4 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
# = ERB -- Ruby Templating
#
# Author:: Masatoshi SEKI
@@ -69,7 +68,7 @@ require "cgi/util"
# a magic comment, however, it returns a string in the encoding specified
# by the magic comment.
#
-# # -*- coding: utf-8 -*-
+# # -*- coding: UTF-8 -*-
# require 'erb'
#
# template = ERB.new <<EOF
@@ -253,8 +252,7 @@ require "cgi/util"
# * Amrita (smart at producing HTML/XML);
# * cs/Template (written in C for speed);
# * RDoc, distributed with Ruby, uses its own template engine, which can be reused elsewhere;
-# * and others; search {RubyGems.org}[https://rubygems.org/] or
-# {The Ruby Toolbox}[https://www.ruby-toolbox.com/].
+# * and others; search the RAA.
#
# Rails, the web application framework, uses ERB to create views.
#
@@ -429,10 +427,10 @@ class ERB
end
def trim_line1(line)
- line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\r?\n|%>|\n|\z)/m) do |tokens|
+ line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
tokens.each do |token|
next if token.empty?
- if token == "%>\n" || token == "%>\r\n"
+ if token == "%>\n"
yield('%>')
yield(:cr)
else
@@ -444,11 +442,11 @@ class ERB
def trim_line2(line)
head = nil
- line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\r?\n|%>|\n|\z)/m) do |tokens|
+ line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
tokens.each do |token|
next if token.empty?
head = token unless head
- if token == "%>\n" || token == "%>\r\n"
+ if token == "%>\n"
yield('%>')
if is_erb_stag?(head)
yield(:cr)
@@ -465,12 +463,12 @@ class ERB
end
def explicit_trim_line(line)
- line.scan(/(.*?)(^[ \t]*<%\-|<%\-|<%%|%%>|<%=|<%#|<%|-%>\r?\n|-%>|%>|\z)/m) do |tokens|
+ line.scan(/(.*?)(^[ \t]*<%\-|<%\-|<%%|%%>|<%=|<%#|<%|-%>\n|-%>|%>|\z)/m) do |tokens|
tokens.each do |token|
next if token.empty?
if @stag.nil? && /[ \t]*<%-/ =~ token
yield('<%')
- elsif @stag && token == "-%>\n" || token == "-%>\r\n"
+ elsif @stag && token == "-%>\n"
yield('%>')
yield(:cr)
elsif @stag && token == '-%>'
@@ -507,8 +505,8 @@ class ERB
require 'strscan'
class SimpleScanner2 < Scanner # :nodoc:
def scan
- stag_reg = /(.*?)(<%[%=#]?|\z)/m
- etag_reg = /(.*?)(%%?>|\z)/m
+ stag_reg = /(.*?)(<%%|<%=|<%#|<%|\z)/m
+ etag_reg = /(.*?)(%%>|%>|\z)/m
scanner = StringScanner.new(@src)
while ! scanner.eos?
scanner.scan(@stag ? etag_reg : stag_reg)
@@ -533,7 +531,7 @@ class ERB
yield('<%')
elsif elem == '-%>'
yield('%>')
- yield(:cr) if scanner.scan(/(\r?\n|\z)/)
+ yield(:cr) if scanner.scan(/(\n|\z)/)
else
yield(elem)
end
@@ -549,7 +547,7 @@ class ERB
def initialize(compiler, enc=nil)
@compiler = compiler
@line = []
- @script = enc ? "#coding:#{enc}\n" : ""
+ @script = enc ? "#coding:#{enc.to_s}\n" : ""
@compiler.pre_cmd.each do |x|
push(x)
end
@@ -718,7 +716,7 @@ class ERB
comment = $1 if comment[/-\*-\s*(.*?)\s*-*-$/]
if %r"coding\s*[=:]\s*([[:alnum:]\-_]+)" =~ comment
enc = $1.sub(/-(?:mac|dos|unix)/i, '')
- Encoding.find(enc)
+ enc = Encoding.find(enc)
end
end
end
@@ -798,9 +796,8 @@ class ERB
@safe_level = safe_level
compiler = make_compiler(trim_mode)
set_eoutvar(compiler, eoutvar)
- @src, @encoding = *compiler.compile(str)
+ @src, @enc = *compiler.compile(str)
@filename = nil
- @lineno = 0
end
##
@@ -813,22 +810,10 @@ class ERB
# The Ruby code generated by ERB
attr_reader :src
- # The encoding to eval
- attr_reader :encoding
-
# The optional _filename_ argument passed to Kernel#eval when the ERB code
# is run
attr_accessor :filename
- # The optional _lineno_ argument passed to Kernel#eval when the ERB code
- # is run
- attr_accessor :lineno
-
- def location=((filename, lineno))
- @filename = filename
- @lineno = lineno if lineno
- end
-
#
# Can be used to set _eoutvar_ as described in ERB::new. It's probably
# easier to just use the constructor though, since calling this method
@@ -851,17 +836,17 @@ class ERB
# the results of that code. (See ERB::new for details on how this process
# can be affected by _safe_level_.)
#
- # _b_ accepts a Binding object which is used to set the context of
+ # _b_ accepts a Binding or Proc object which is used to set the context of
# code evaluation.
#
def result(b=new_toplevel)
if @safe_level
proc {
$SAFE = @safe_level
- eval(@src, b, (@filename || '(erb)'), @lineno)
+ eval(@src, b, (@filename || '(erb)'), 0)
}.call
else
- eval(@src, b, (@filename || '(erb)'), @lineno)
+ eval(@src, b, (@filename || '(erb)'), 0)
end
end
@@ -883,7 +868,7 @@ class ERB
# print MyClass.new.render('foo', 123)
def def_method(mod, methodname, fname='(ERB)')
src = self.src
- magic_comment = "#coding:#{@encoding}\n"
+ magic_comment = "#coding:#{@enc}\n"
mod.module_eval do
eval(magic_comment + "def #{methodname}\n" + src + "\nend\n", binding, fname, -2)
end
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index bc9e959fab..26129c4204 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = fileutils.rb
#
@@ -13,37 +12,35 @@
#
# === Module Functions
#
-# require 'fileutils'
-#
-# FileUtils.cd(dir, options)
-# FileUtils.cd(dir, options) {|dir| .... }
-# FileUtils.pwd()
-# FileUtils.mkdir(dir, options)
-# FileUtils.mkdir(list, options)
-# FileUtils.mkdir_p(dir, options)
-# FileUtils.mkdir_p(list, options)
-# FileUtils.rmdir(dir, options)
-# FileUtils.rmdir(list, options)
-# FileUtils.ln(old, new, options)
-# FileUtils.ln(list, destdir, options)
-# FileUtils.ln_s(old, new, options)
-# FileUtils.ln_s(list, destdir, options)
-# FileUtils.ln_sf(src, dest, options)
-# FileUtils.cp(src, dest, options)
-# FileUtils.cp(list, dir, options)
-# FileUtils.cp_r(src, dest, options)
-# FileUtils.cp_r(list, dir, options)
-# FileUtils.mv(src, dest, options)
-# FileUtils.mv(list, dir, options)
-# FileUtils.rm(list, options)
-# FileUtils.rm_r(list, options)
-# FileUtils.rm_rf(list, options)
-# FileUtils.install(src, dest, mode = <src's>, options)
-# FileUtils.chmod(mode, list, options)
-# FileUtils.chmod_R(mode, list, options)
-# FileUtils.chown(user, group, list, options)
-# FileUtils.chown_R(user, group, list, options)
-# FileUtils.touch(list, options)
+# cd(dir, options)
+# cd(dir, options) {|dir| .... }
+# pwd()
+# mkdir(dir, options)
+# mkdir(list, options)
+# mkdir_p(dir, options)
+# mkdir_p(list, options)
+# rmdir(dir, options)
+# rmdir(list, options)
+# ln(old, new, options)
+# ln(list, destdir, options)
+# ln_s(old, new, options)
+# ln_s(list, destdir, options)
+# ln_sf(src, dest, options)
+# cp(src, dest, options)
+# cp(list, dir, options)
+# cp_r(src, dest, options)
+# cp_r(list, dir, options)
+# mv(src, dest, options)
+# mv(list, dir, options)
+# rm(list, options)
+# rm_r(list, options)
+# rm_rf(list, options)
+# install(src, dest, mode = <src's>, options)
+# chmod(mode, list, options)
+# chmod_R(mode, list, options)
+# chown(user, group, list, options)
+# chown_R(user, group, list, options)
+# touch(list, options)
#
# The <tt>options</tt> parameter is a hash of options, taken from the list
# <tt>:force</tt>, <tt>:noop</tt>, <tt>:preserve</tt>, and <tt>:verbose</tt>.
@@ -56,15 +53,15 @@
#
# There are some `low level' methods, which do not accept any option:
#
-# FileUtils.copy_entry(src, dest, preserve = false, dereference = false)
-# FileUtils.copy_file(src, dest, preserve = false, dereference = true)
-# FileUtils.copy_stream(srcstream, deststream)
-# FileUtils.remove_entry(path, force = false)
-# FileUtils.remove_entry_secure(path, force = false)
-# FileUtils.remove_file(path, force = false)
-# FileUtils.compare_file(path_a, path_b)
-# FileUtils.compare_stream(stream_a, stream_b)
-# FileUtils.uptodate?(file, cmp_list)
+# copy_entry(src, dest, preserve = false, dereference = false)
+# copy_file(src, dest, preserve = false, dereference = true)
+# copy_stream(srcstream, deststream)
+# remove_entry(path, force = false)
+# remove_entry_secure(path, force = false)
+# remove_file(path, force = false)
+# compare_file(path_a, path_b)
+# compare_stream(stream_a, stream_b)
+# uptodate?(file, cmp_list)
#
# == module FileUtils::Verbose
#
@@ -139,7 +136,7 @@ module FileUtils
#
# Options: (none)
#
- # Returns true if +new+ is newer than all +old_list+.
+ # Returns true if +newer+ is newer than all +old_list+.
# Non-existent files are older than any file.
#
# FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \
@@ -157,10 +154,10 @@ module FileUtils
end
module_function :uptodate?
- def remove_trailing_slash(dir)
+ def remove_tailing_slash(dir)
dir == '/' ? dir : dir.chomp(?/)
end
- private_module_function :remove_trailing_slash
+ private_module_function :remove_tailing_slash
#
# Options: mode noop verbose
@@ -208,7 +205,7 @@ module FileUtils
fu_output_message "mkdir -p #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" if options[:verbose]
return *list if options[:noop]
- list.map {|path| remove_trailing_slash(path)}.each do |path|
+ list.map {|path| remove_tailing_slash(path)}.each do |path|
# optimize for the most common case
begin
fu_mkdir path, options[:mode]
@@ -222,7 +219,6 @@ module FileUtils
stack.push path
path = File.dirname(path)
end
- stack.pop # root directory should exist
stack.reverse_each do |dir|
begin
fu_mkdir dir, options[:mode]
@@ -246,7 +242,7 @@ module FileUtils
OPT_TABLE['makedirs'] = [:mode, :noop, :verbose]
def fu_mkdir(path, mode) #:nodoc:
- path = remove_trailing_slash(path)
+ path = remove_tailing_slash(path)
if mode
Dir.mkdir path, mode
File.chmod mode, path
@@ -257,7 +253,7 @@ module FileUtils
private_module_function :fu_mkdir
#
- # Options: parents, noop, verbose
+ # Options: noop, verbose
#
# Removes one or more directories.
#
@@ -274,14 +270,14 @@ module FileUtils
return if options[:noop]
list.each do |dir|
begin
- Dir.rmdir(dir = remove_trailing_slash(dir))
+ Dir.rmdir(dir = remove_tailing_slash(dir))
if parents
until (parent = File.dirname(dir)) == '.' or parent == dir
dir = parent
Dir.rmdir(dir)
end
end
- rescue Errno::ENOTEMPTY, Errno::EEXIST, Errno::ENOENT
+ rescue Errno::ENOTEMPTY, Errno::ENOENT
end
end
end
@@ -459,8 +455,8 @@ module FileUtils
# Both of +src+ and +dest+ must be a path name.
# +src+ must exist, +dest+ must not exist.
#
- # If +preserve+ is true, this method preserves owner, group, and
- # modified time. Permissions are copied regardless +preserve+.
+ # If +preserve+ is true, this method preserves owner, group, permissions
+ # and modified time.
#
# If +dereference_root+ is true, this method dereference tree root.
#
@@ -520,7 +516,7 @@ module FileUtils
begin
if destent.exist?
if destent.directory?
- raise Errno::EEXIST, d
+ raise Errno::EEXIST, dest
else
destent.remove_file if rename_cannot_overwrite_file?
end
@@ -549,7 +545,7 @@ module FileUtils
OPT_TABLE['move'] = [:force, :noop, :verbose, :secure]
def rename_cannot_overwrite_file? #:nodoc:
- /emx/ =~ RUBY_PLATFORM
+ /cygwin|mswin|mingw|bccwin|emx/ =~ RUBY_PLATFORM
end
private_module_function :rename_cannot_overwrite_file?
@@ -858,8 +854,7 @@ module FileUtils
fu_check_options options, OPT_TABLE['install']
fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
- fu_each_src_dest(src, dest) do |s, d|
- st = File.stat(s)
+ fu_each_src_dest(src, dest) do |s, d, st|
unless File.exist?(d) and compare_file(s, d)
remove_file d, true
copy_file s, d
@@ -1102,37 +1097,49 @@ module FileUtils
begin
require 'etc'
- rescue LoadError # rescue LoadError for miniruby
- end
- def fu_get_uid(user) #:nodoc:
- return nil unless user
- case user
- when Integer
- user
- when /\A\d+\z/
- user.to_i
- else
- Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
+ def fu_get_uid(user) #:nodoc:
+ return nil unless user
+ case user
+ when Integer
+ user
+ when /\A\d+\z/
+ user.to_i
+ else
+ Etc.getpwnam(user).uid
+ end
end
- end
- private_module_function :fu_get_uid
-
- def fu_get_gid(group) #:nodoc:
- return nil unless group
- case group
- when Integer
- group
- when /\A\d+\z/
- group.to_i
- else
- Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
+ private_module_function :fu_get_uid
+
+ def fu_get_gid(group) #:nodoc:
+ return nil unless group
+ case group
+ when Integer
+ group
+ when /\A\d+\z/
+ group.to_i
+ else
+ Etc.getgrnam(group).gid
+ end
+ end
+ private_module_function :fu_get_gid
+
+ rescue LoadError
+ # need Win32 support???
+
+ def fu_get_uid(user) #:nodoc:
+ user # FIXME
+ end
+ private_module_function :fu_get_uid
+
+ def fu_get_gid(group) #:nodoc:
+ group # FIXME
end
+ private_module_function :fu_get_gid
end
- private_module_function :fu_get_gid
#
- # Options: noop verbose mtime nocreate
+ # Options: noop verbose
#
# Updates modification time (mtime) and access time (atime) of file(s) in
# +list+. Files are created if they don't exist.
@@ -1143,7 +1150,7 @@ module FileUtils
def touch(list, options = {})
fu_check_options options, OPT_TABLE['touch']
list = fu_list(list)
- nocreate = options[:nocreate]
+ created = nocreate = options[:nocreate]
t = options[:mtime]
if options[:verbose]
fu_output_message "touch #{nocreate ? '-c ' : ''}#{t ? t.strftime('-t %Y%m%d%H%M.%S ') : ''}#{list.join ' '}"
@@ -1245,12 +1252,7 @@ module FileUtils
end
def exist?
- begin
- lstat
- true
- rescue Errno::ENOENT
- false
- end
+ lstat! ? true : false
end
def file?
@@ -1360,7 +1362,7 @@ module FileUtils
when file?
copy_file dest
when directory?
- if !File.exist?(dest) and descendant_directory?(dest, path)
+ if !File.exist?(dest) and descendant_diretory?(dest, path)
raise ArgumentError, "cannot copy directory %s to itself %s" % [path, dest]
end
begin
@@ -1491,7 +1493,6 @@ module FileUtils
end
end
end
- ensure
yield self
end
@@ -1556,7 +1557,7 @@ module FileUtils
end
SYSCASE = File::FNM_SYSCASE.nonzero? ? "-i" : ""
- def descendant_directory?(descendant, ascendant)
+ def descendant_diretory?(descendant, ascendant)
/\A(?#{SYSCASE}:#{Regexp.quote(ascendant)})#{DIRECTORY_TERM}/ =~ File.dirname(descendant)
end
end # class Entry_
@@ -1569,7 +1570,7 @@ module FileUtils
def fu_each_src_dest(src, dest) #:nodoc:
fu_each_src_dest0(src, dest) do |s, d|
raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d)
- yield s, d
+ yield s, d, File.stat(s)
end
end
private_module_function :fu_each_src_dest
@@ -1648,7 +1649,7 @@ module FileUtils
#
# p FileUtils.have_option?(:cp, :noop) #=> true
# p FileUtils.have_option?(:rm, :force) #=> true
- # p FileUtils.have_option?(:rm, :preserve) #=> false
+ # p FileUtils.have_option?(:rm, :perserve) #=> false
#
def FileUtils.have_option?(mid, opt)
li = OPT_TABLE[mid.to_s] or raise ArgumentError, "no such method: #{mid}"
@@ -1658,7 +1659,7 @@ module FileUtils
#
# Returns an Array of option names of the method +mid+.
#
- # p FileUtils.options_of(:rm) #=> ["noop", "verbose", "force"]
+ # p FileUtils.options(:rm) #=> ["noop", "verbose", "force"]
#
def FileUtils.options_of(mid)
OPT_TABLE[mid.to_s].map {|sym| sym.to_s }
diff --git a/lib/find.rb b/lib/find.rb
index aa7a3c082b..6f3e4282ed 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# find.rb: the Find module for processing all files under a given directory.
#
@@ -35,13 +34,12 @@ module Find
#
# See the +Find+ module documentation for an example.
#
- def find(*paths, ignore_error: true) # :yield: path
- block_given? or return enum_for(__method__, *paths, ignore_error: ignore_error)
+ def find(*paths) # :yield: path
+ block_given? or return enum_for(__method__, *paths)
fs_encoding = Encoding.find("filesystem")
paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path|
- path = path.to_path if path.respond_to? :to_path
enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding
ps = [path]
while file = ps.shift
@@ -50,14 +48,12 @@ module Find
begin
s = File.lstat(file)
rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG
- raise unless ignore_error
next
end
if s.directory? then
begin
fs = Dir.entries(file, encoding: enc)
rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG
- raise unless ignore_error
next
end
fs.sort!
diff --git a/lib/forwardable.rb b/lib/forwardable.rb
index e78b9ed1e0..ecc5f03843 100644
--- a/lib/forwardable.rb
+++ b/lib/forwardable.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# forwardable.rb -
# $Release Version: 1.1$
@@ -178,44 +177,28 @@ module Forwardable
# q.push 23 #=> NoMethodError
#
def def_instance_delegator(accessor, method, ali = method)
- gen = Forwardable._delegator_method(self, accessor, method, ali)
-
+ line_no = __LINE__; str = %{
+ def #{ali}(*args, &block)
+ begin
+ #{accessor}.__send__(:#{method}, *args, &block)
+ rescue Exception
+ $@.delete_if{|s| Forwardable::FILE_REGEXP =~ s} unless Forwardable::debug
+ ::Kernel::raise
+ end
+ end
+ }
# If it's not a class or module, it's an instance
- (Module === self ? self : singleton_class).module_eval(&gen)
+ begin
+ module_eval(str, __FILE__, line_no)
+ rescue
+ instance_eval(str, __FILE__, line_no)
+ end
+
end
alias delegate instance_delegate
alias def_delegators def_instance_delegators
alias def_delegator def_instance_delegator
-
- def self._delegator_method(obj, accessor, method, ali)
- accessor = accessor.to_s unless Symbol === accessor
-
- if Module === obj ?
- obj.method_defined?(accessor) || obj.private_method_defined?(accessor) :
- obj.respond_to?(accessor, true)
- accessor = "#{accessor}()"
- end
-
- line_no = __LINE__+1; str = "#{<<-"begin;"}\n#{<<-"end;"}"
- begin;
- proc do
- def #{ali}(*args, &block)
- begin
- #{accessor}
- ensure
- $@.delete_if {|s| ::Forwardable::FILE_REGEXP =~ s} if $@ and !::Forwardable::debug
- end.__send__ :#{method}, *args, &block
- end
- end
- end;
-
- RubyVM::InstructionSequence
- .compile(str, __FILE__, __FILE__, line_no,
- trace_instruction: false,
- tailcall_optimization: true)
- .eval
- end
end
# SingleForwardable can be used to setup delegation at the object level as well.
@@ -286,9 +269,18 @@ module SingleForwardable
# the method of the same name in _accessor_). If _new_name_ is
# provided, it is used as the name for the delegate method.
def def_single_delegator(accessor, method, ali = method)
- gen = Forwardable._delegator_method(self, accessor, method, ali)
+ str = %{
+ def #{ali}(*args, &block)
+ begin
+ #{accessor}.__send__(:#{method}, *args, &block)
+ rescue Exception
+ $@.delete_if{|s| Forwardable::FILE_REGEXP =~ s} unless Forwardable::debug
+ ::Kernel::raise
+ end
+ end
+ }
- instance_eval(&gen)
+ instance_eval(str, __FILE__, __LINE__)
end
alias delegate single_delegate
diff --git a/lib/getoptlong.rb b/lib/getoptlong.rb
index 8aa91b82e0..cf635f0438 100644
--- a/lib/getoptlong.rb
+++ b/lib/getoptlong.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# GetoptLong for Ruby
#
@@ -575,7 +574,7 @@ class GetoptLong
else
#
# This is a non-option argument.
- # Only RETURN_IN_ORDER fell into here.
+ # Only RETURN_IN_ORDER falled into here.
#
return '', argument
end
diff --git a/lib/gserver.rb b/lib/gserver.rb
new file mode 100644
index 0000000000..48770289f8
--- /dev/null
+++ b/lib/gserver.rb
@@ -0,0 +1,310 @@
+#
+# Copyright (C) 2001 John W. Small All Rights Reserved
+#
+# Author:: John W. Small
+# Documentation:: Gavin Sinclair
+# Licence:: Ruby License
+
+require "socket"
+require "thread"
+
+#
+# GServer implements a generic server, featuring thread pool management,
+# simple logging, and multi-server management. See HttpServer in
+# <tt>xmlrpc/httpserver.rb</tt> in the Ruby standard library for an example of
+# GServer in action.
+#
+# Any kind of application-level server can be implemented using this class.
+# It accepts multiple simultaneous connections from clients, up to an optional
+# maximum number. Several _services_ (i.e. one service per TCP port) can be
+# run simultaneously, and stopped at any time through the class method
+# <tt>GServer.stop(port)</tt>. All the threading issues are handled, saving
+# you the effort. All events are optionally logged, but you can provide your
+# own event handlers if you wish.
+#
+# == Example
+#
+# Using GServer is simple. Below we implement a simple time server, run it,
+# query it, and shut it down. Try this code in +irb+:
+#
+# require 'gserver'
+#
+# #
+# # A server that returns the time in seconds since 1970.
+# #
+# class TimeServer < GServer
+# def initialize(port=10001, *args)
+# super(port, *args)
+# end
+# def serve(io)
+# io.puts(Time.now.to_s)
+# end
+# end
+#
+# # Run the server with logging enabled (it's a separate thread).
+# server = TimeServer.new
+# server.audit = true # Turn logging on.
+# server.start
+#
+# # *** Now point your browser to http://localhost:10001 to see it working ***
+#
+# # See if it's still running.
+# GServer.in_service?(10001) # -> true
+# server.stopped? # -> false
+#
+# # Shut the server down gracefully.
+# server.shutdown
+#
+# # Alternatively, stop it immediately.
+# GServer.stop(10001)
+# # or, of course, "server.stop".
+#
+# All the business of accepting connections and exception handling is taken
+# care of. All we have to do is implement the method that actually serves the
+# client.
+#
+# === Advanced
+#
+# As the example above shows, the way to use GServer is to subclass it to
+# create a specific server, overriding the +serve+ method. You can override
+# other methods as well if you wish, perhaps to collect statistics, or emit
+# more detailed logging.
+#
+# * #connecting
+# * #disconnecting
+# * #starting
+# * #stopping
+#
+# The above methods are only called if auditing is enabled, via #audit=.
+#
+# You can also override #log and #error if, for example, you wish to use a
+# more sophisticated logging system.
+#
+class GServer
+
+ DEFAULT_HOST = "127.0.0.1"
+
+ def serve(io)
+ end
+
+ @@services = {} # Hash of opened ports, i.e. services
+ @@servicesMutex = Mutex.new
+
+ # Stop the server running on the given port, bound to the given host
+ #
+ # +port+:: port, as a FixNum, of the server to stop
+ # +host+:: host on which to find the server to stop
+ def GServer.stop(port, host = DEFAULT_HOST)
+ @@servicesMutex.synchronize {
+ @@services[host][port].stop
+ }
+ end
+
+ # Check if a server is running on the given port and host
+ #
+ # +port+:: port, as a FixNum, of the server to check
+ # +host+:: host on which to find the server to check
+ #
+ # Returns true if a server is running on that port and host.
+ def GServer.in_service?(port, host = DEFAULT_HOST)
+ @@services.has_key?(host) and
+ @@services[host].has_key?(port)
+ end
+
+ # Stop the server
+ def stop
+ @connectionsMutex.synchronize {
+ if @tcpServerThread
+ @tcpServerThread.raise "stop"
+ end
+ }
+ end
+
+ # Returns true if the server has stopped.
+ def stopped?
+ @tcpServerThread == nil
+ end
+
+ # Schedule a shutdown for the server
+ def shutdown
+ @shutdown = true
+ end
+
+ # Return the current number of connected clients
+ def connections
+ @connections.size
+ end
+
+ # Join with the server thread
+ def join
+ @tcpServerThread.join if @tcpServerThread
+ end
+
+ # Port on which to listen, as a FixNum
+ attr_reader :port
+ # Host on which to bind, as a String
+ attr_reader :host
+ # Maximum number of connections to accept at at ime, as a FixNum
+ attr_reader :maxConnections
+ # IO Device on which log messages should be written
+ attr_accessor :stdlog
+ # Set to true to cause the callbacks #connecting, #disconnecting, #starting,
+ # and #stopping to be called during the server's lifecycle
+ attr_accessor :audit
+ # Set to true to show more detailed logging
+ attr_accessor :debug
+
+ # Called when a client connects, if auditing is enabled.
+ #
+ # +client+:: a TCPSocket instances representing the client that connected
+ #
+ # Return true to allow this client to connect, false to prevent it.
+ def connecting(client)
+ addr = client.peeraddr
+ log("#{self.class.to_s} #{@host}:#{@port} client:#{addr[1]} " +
+ "#{addr[2]}<#{addr[3]}> connect")
+ true
+ end
+
+
+ # Called when a client disconnects, if audition is enabled.
+ #
+ # +clientPort+:: the port of the client that is connecting
+ def disconnecting(clientPort)
+ log("#{self.class.to_s} #{@host}:#{@port} " +
+ "client:#{clientPort} disconnect")
+ end
+
+ protected :connecting, :disconnecting
+
+ # Called when the server is starting up, if auditing is enabled.
+ def starting()
+ log("#{self.class.to_s} #{@host}:#{@port} start")
+ end
+
+ # Called when the server is shutting down, if auditing is enabled.
+ def stopping()
+ log("#{self.class.to_s} #{@host}:#{@port} stop")
+ end
+
+ protected :starting, :stopping
+
+ # Called if #debug is true whenever an unhandled exception is raised.
+ # This implementation simply logs the backtrace.
+ #
+ # +detail+:: The Exception that was caught
+ def error(detail)
+ log(detail.backtrace.join("\n"))
+ end
+
+ # Log a message to #stdlog, if it's defined. This implementation
+ # outputs the timestamp and message to the log.
+ #
+ # +msg+:: the message to log
+ def log(msg)
+ if @stdlog
+ @stdlog.puts("[#{Time.new.ctime}] %s" % msg)
+ @stdlog.flush
+ end
+ end
+
+ protected :error, :log
+
+ # Create a new server
+ #
+ # +port+:: the port, as a FixNum, on which to listen.
+ # +host+:: the host to bind to
+ # +maxConnections+:: The maximum number of simultaneous connections to
+ # accept
+ # +stdlog+:: IO device on which to log messages
+ # +audit+:: if true, lifecycle callbacks will be called. See #audit
+ # +debug+:: if true, error messages are logged. See #debug
+ def initialize(port, host = DEFAULT_HOST, maxConnections = 4,
+ stdlog = $stderr, audit = false, debug = false)
+ @tcpServerThread = nil
+ @port = port
+ @host = host
+ @maxConnections = maxConnections
+ @connections = []
+ @connectionsMutex = Mutex.new
+ @connectionsCV = ConditionVariable.new
+ @stdlog = stdlog
+ @audit = audit
+ @debug = debug
+ end
+
+ # Start the server if it isn't already running
+ #
+ # +maxConnections+::
+ # override +maxConnections+ given to the constructor. A negative
+ # value indicates that the value from the constructor should be used.
+ def start(maxConnections = -1)
+ raise "server is already running" if !stopped?
+ @shutdown = false
+ @maxConnections = maxConnections if maxConnections > 0
+ @@servicesMutex.synchronize {
+ if GServer.in_service?(@port,@host)
+ raise "Port already in use: #{host}:#{@port}!"
+ end
+ @tcpServer = TCPServer.new(@host,@port)
+ @port = @tcpServer.addr[1]
+ @@services[@host] = {} unless @@services.has_key?(@host)
+ @@services[@host][@port] = self;
+ }
+ @tcpServerThread = Thread.new {
+ begin
+ starting if @audit
+ while !@shutdown
+ @connectionsMutex.synchronize {
+ while @connections.size >= @maxConnections
+ @connectionsCV.wait(@connectionsMutex)
+ end
+ }
+ client = @tcpServer.accept
+ Thread.new(client) { |myClient|
+ @connections << Thread.current
+ begin
+ myPort = myClient.peeraddr[1]
+ serve(myClient) if !@audit or connecting(myClient)
+ rescue => detail
+ error(detail) if @debug
+ ensure
+ begin
+ myClient.close
+ rescue
+ end
+ @connectionsMutex.synchronize {
+ @connections.delete(Thread.current)
+ @connectionsCV.signal
+ }
+ disconnecting(myPort) if @audit
+ end
+ }
+ end
+ rescue => detail
+ error(detail) if @debug
+ ensure
+ begin
+ @tcpServer.close
+ rescue
+ end
+ if @shutdown
+ @connectionsMutex.synchronize {
+ while @connections.size > 0
+ @connectionsCV.wait(@connectionsMutex)
+ end
+ }
+ else
+ @connections.each { |c| c.raise "stop" }
+ end
+ @tcpServerThread = nil
+ @@servicesMutex.synchronize {
+ @@services[@host].delete(@port)
+ }
+ stopping if @audit
+ end
+ }
+ self
+ end
+
+end
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index 64d2a8162d..13016fcbba 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ipaddr.rb - A class to manipulate an IP address
#
@@ -411,7 +410,7 @@ class IPAddr
# Set current netmask to given mask.
def mask!(mask)
if mask.kind_of?(String)
- if mask =~ /\A\d+\z/
+ if mask =~ /^\d+$/
prefixlen = mask.to_i
else
m = IPAddr.new(mask)
@@ -479,7 +478,7 @@ class IPAddr
end
end
prefix, prefixlen = addr.split('/')
- if prefix =~ /\A\[(.*)\]\z/i
+ if prefix =~ /^\[(.*)\]$/i
prefix = $1
family = Socket::AF_INET6
end
@@ -657,3 +656,280 @@ unless Socket.const_defined? :AF_INET6
end
end
end
+
+if $0 == __FILE__
+ eval DATA.read, nil, $0, __LINE__+4
+end
+
+__END__
+
+require 'test/unit'
+
+class TC_IPAddr < Test::Unit::TestCase
+ def test_s_new
+ [
+ ["3FFE:505:ffff::/48"],
+ ["0:0:0:1::"],
+ ["2001:200:300::/48"],
+ ["2001:200:300::192.168.1.2/48"],
+ ["1:2:3:4:5:6:7::"],
+ ["::2:3:4:5:6:7:8"],
+ ].each { |args|
+ assert_nothing_raised {
+ IPAddr.new(*args)
+ }
+ }
+
+ a = IPAddr.new
+ assert_equal("::", a.to_s)
+ assert_equal("0000:0000:0000:0000:0000:0000:0000:0000", a.to_string)
+ assert_equal(Socket::AF_INET6, a.family)
+
+ a = IPAddr.new("0123:4567:89ab:cdef:0ABC:DEF0:1234:5678")
+ assert_equal("123:4567:89ab:cdef:abc:def0:1234:5678", a.to_s)
+ assert_equal("0123:4567:89ab:cdef:0abc:def0:1234:5678", a.to_string)
+ assert_equal(Socket::AF_INET6, a.family)
+
+ a = IPAddr.new("3ffe:505:2::/48")
+ assert_equal("3ffe:505:2::", a.to_s)
+ assert_equal("3ffe:0505:0002:0000:0000:0000:0000:0000", a.to_string)
+ assert_equal(Socket::AF_INET6, a.family)
+ assert_equal(false, a.ipv4?)
+ assert_equal(true, a.ipv6?)
+ assert_equal("#<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>", a.inspect)
+
+ a = IPAddr.new("3ffe:505:2::/ffff:ffff:ffff::")
+ assert_equal("3ffe:505:2::", a.to_s)
+ assert_equal("3ffe:0505:0002:0000:0000:0000:0000:0000", a.to_string)
+ assert_equal(Socket::AF_INET6, a.family)
+
+ a = IPAddr.new("0.0.0.0")
+ assert_equal("0.0.0.0", a.to_s)
+ assert_equal("0.0.0.0", a.to_string)
+ assert_equal(Socket::AF_INET, a.family)
+
+ a = IPAddr.new("192.168.1.2")
+ assert_equal("192.168.1.2", a.to_s)
+ assert_equal("192.168.1.2", a.to_string)
+ assert_equal(Socket::AF_INET, a.family)
+ assert_equal(true, a.ipv4?)
+ assert_equal(false, a.ipv6?)
+
+ a = IPAddr.new("192.168.1.2/24")
+ assert_equal("192.168.1.0", a.to_s)
+ assert_equal("192.168.1.0", a.to_string)
+ assert_equal(Socket::AF_INET, a.family)
+ assert_equal("#<IPAddr: IPv4:192.168.1.0/255.255.255.0>", a.inspect)
+
+ a = IPAddr.new("192.168.1.2/255.255.255.0")
+ assert_equal("192.168.1.0", a.to_s)
+ assert_equal("192.168.1.0", a.to_string)
+ assert_equal(Socket::AF_INET, a.family)
+
+ assert_equal("0:0:0:1::", IPAddr.new("0:0:0:1::").to_s)
+ assert_equal("2001:200:300::", IPAddr.new("2001:200:300::/48").to_s)
+
+ assert_equal("2001:200:300::", IPAddr.new("[2001:200:300::]/48").to_s)
+ assert_equal("1:2:3:4:5:6:7:0", IPAddr.new("1:2:3:4:5:6:7::").to_s)
+ assert_equal("0:2:3:4:5:6:7:8", IPAddr.new("::2:3:4:5:6:7:8").to_s)
+
+ assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.256") }
+ assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.011") }
+ assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("fe80::1%fxp0") }
+ assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("[192.168.1.2]/120") }
+ assert_raises(IPAddr::InvalidPrefixError) { IPAddr.new("::1/255.255.255.0") }
+ assert_raises(IPAddr::InvalidPrefixError) { IPAddr.new("::1/129") }
+ assert_raises(IPAddr::InvalidPrefixError) { IPAddr.new("192.168.0.1/33") }
+ assert_raises(IPAddr::AddressFamilyError) { IPAddr.new(1) }
+ assert_raises(IPAddr::AddressFamilyError) { IPAddr.new("::ffff:192.168.1.2/120", Socket::AF_INET) }
+ end
+
+ def test_s_new_ntoh
+ addr = ''
+ IPAddr.new("1234:5678:9abc:def0:1234:5678:9abc:def0").hton.each_byte { |c|
+ addr += sprintf("%02x", c)
+ }
+ assert_equal("123456789abcdef0123456789abcdef0", addr)
+ addr = ''
+ IPAddr.new("123.45.67.89").hton.each_byte { |c|
+ addr += sprintf("%02x", c)
+ }
+ assert_equal(sprintf("%02x%02x%02x%02x", 123, 45, 67, 89), addr)
+ a = IPAddr.new("3ffe:505:2::")
+ assert_equal("3ffe:505:2::", IPAddr.new_ntoh(a.hton).to_s)
+ a = IPAddr.new("192.168.2.1")
+ assert_equal("192.168.2.1", IPAddr.new_ntoh(a.hton).to_s)
+ end
+
+ def test_ipv4_compat
+ a = IPAddr.new("::192.168.1.2")
+ assert_equal("::192.168.1.2", a.to_s)
+ assert_equal("0000:0000:0000:0000:0000:0000:c0a8:0102", a.to_string)
+ assert_equal(Socket::AF_INET6, a.family)
+ assert_equal(true, a.ipv4_compat?)
+ b = a.native
+ assert_equal("192.168.1.2", b.to_s)
+ assert_equal(Socket::AF_INET, b.family)
+ assert_equal(false, b.ipv4_compat?)
+
+ a = IPAddr.new("192.168.1.2")
+ b = a.ipv4_compat
+ assert_equal("::192.168.1.2", b.to_s)
+ assert_equal(Socket::AF_INET6, b.family)
+ end
+
+ def test_ipv4_mapped
+ a = IPAddr.new("::ffff:192.168.1.2")
+ assert_equal("::ffff:192.168.1.2", a.to_s)
+ assert_equal("0000:0000:0000:0000:0000:ffff:c0a8:0102", a.to_string)
+ assert_equal(Socket::AF_INET6, a.family)
+ assert_equal(true, a.ipv4_mapped?)
+ b = a.native
+ assert_equal("192.168.1.2", b.to_s)
+ assert_equal(Socket::AF_INET, b.family)
+ assert_equal(false, b.ipv4_mapped?)
+
+ a = IPAddr.new("192.168.1.2")
+ b = a.ipv4_mapped
+ assert_equal("::ffff:192.168.1.2", b.to_s)
+ assert_equal(Socket::AF_INET6, b.family)
+ end
+
+ def test_reverse
+ assert_equal("f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.arpa", IPAddr.new("3ffe:505:2::f").reverse)
+ assert_equal("1.2.168.192.in-addr.arpa", IPAddr.new("192.168.2.1").reverse)
+ end
+
+ def test_ip6_arpa
+ assert_equal("f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.arpa", IPAddr.new("3ffe:505:2::f").ip6_arpa)
+ assert_raises(IPAddr::InvalidAddressError) {
+ IPAddr.new("192.168.2.1").ip6_arpa
+ }
+ end
+
+ def test_ip6_int
+ assert_equal("f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.int", IPAddr.new("3ffe:505:2::f").ip6_int)
+ assert_raises(IPAddr::InvalidAddressError) {
+ IPAddr.new("192.168.2.1").ip6_int
+ }
+ end
+
+ def test_to_s
+ assert_equal("3ffe:0505:0002:0000:0000:0000:0000:0001", IPAddr.new("3ffe:505:2::1").to_string)
+ assert_equal("3ffe:505:2::1", IPAddr.new("3ffe:505:2::1").to_s)
+ end
+end
+
+class TC_Operator < Test::Unit::TestCase
+
+ IN6MASK32 = "ffff:ffff::"
+ IN6MASK128 = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
+
+ def setup
+ @in6_addr_any = IPAddr.new()
+ @a = IPAddr.new("3ffe:505:2::/48")
+ @b = IPAddr.new("0:0:0:1::")
+ @c = IPAddr.new(IN6MASK32)
+ end
+ alias set_up setup
+
+ def test_or
+ assert_equal("3ffe:505:2:1::", (@a | @b).to_s)
+ a = @a
+ a |= @b
+ assert_equal("3ffe:505:2:1::", a.to_s)
+ assert_equal("3ffe:505:2::", @a.to_s)
+ assert_equal("3ffe:505:2:1::",
+ (@a | 0x00000000000000010000000000000000).to_s)
+ end
+
+ def test_and
+ assert_equal("3ffe:505::", (@a & @c).to_s)
+ a = @a
+ a &= @c
+ assert_equal("3ffe:505::", a.to_s)
+ assert_equal("3ffe:505:2::", @a.to_s)
+ assert_equal("3ffe:505::", (@a & 0xffffffff000000000000000000000000).to_s)
+ end
+
+ def test_shift_right
+ assert_equal("0:3ffe:505:2::", (@a >> 16).to_s)
+ a = @a
+ a >>= 16
+ assert_equal("0:3ffe:505:2::", a.to_s)
+ assert_equal("3ffe:505:2::", @a.to_s)
+ end
+
+ def test_shift_left
+ assert_equal("505:2::", (@a << 16).to_s)
+ a = @a
+ a <<= 16
+ assert_equal("505:2::", a.to_s)
+ assert_equal("3ffe:505:2::", @a.to_s)
+ end
+
+ def test_carrot
+ a = ~@in6_addr_any
+ assert_equal(IN6MASK128, a.to_s)
+ assert_equal("::", @in6_addr_any.to_s)
+ end
+
+ def test_equal
+ assert_equal(true, @a == IPAddr.new("3FFE:505:2::"))
+ assert_equal(true, @a == IPAddr.new("3ffe:0505:0002::"))
+ assert_equal(true, @a == IPAddr.new("3ffe:0505:0002:0:0:0:0:0"))
+ assert_equal(false, @a == IPAddr.new("3ffe:505:3::"))
+ assert_equal(true, @a != IPAddr.new("3ffe:505:3::"))
+ assert_equal(false, @a != IPAddr.new("3ffe:505:2::"))
+ end
+
+ def test_mask
+ a = @a.mask(32)
+ assert_equal("3ffe:505::", a.to_s)
+ assert_equal("3ffe:505:2::", @a.to_s)
+ end
+
+ def test_include?
+ assert_equal(true, @a.include?(IPAddr.new("3ffe:505:2::")))
+ assert_equal(true, @a.include?(IPAddr.new("3ffe:505:2::1")))
+ assert_equal(false, @a.include?(IPAddr.new("3ffe:505:3::")))
+ net1 = IPAddr.new("192.168.2.0/24")
+ assert_equal(true, net1.include?(IPAddr.new("192.168.2.0")))
+ assert_equal(true, net1.include?(IPAddr.new("192.168.2.255")))
+ assert_equal(false, net1.include?(IPAddr.new("192.168.3.0")))
+ # test with integer parameter
+ int = (192 << 24) + (168 << 16) + (2 << 8) + 13
+
+ assert_equal(true, net1.include?(int))
+ assert_equal(false, net1.include?(int+255))
+
+ end
+
+ def test_hash
+ a1 = IPAddr.new('192.168.2.0')
+ a2 = IPAddr.new('192.168.2.0')
+ a3 = IPAddr.new('3ffe:505:2::1')
+ a4 = IPAddr.new('3ffe:505:2::1')
+ a5 = IPAddr.new('127.0.0.1')
+ a6 = IPAddr.new('::1')
+ a7 = IPAddr.new('192.168.2.0/25')
+ a8 = IPAddr.new('192.168.2.0/25')
+
+ h = { a1 => 'ipv4', a2 => 'ipv4', a3 => 'ipv6', a4 => 'ipv6', a5 => 'ipv4', a6 => 'ipv6', a7 => 'ipv4', a8 => 'ipv4'}
+ assert_equal(5, h.size)
+ assert_equal('ipv4', h[a1])
+ assert_equal('ipv4', h[a2])
+ assert_equal('ipv6', h[a3])
+ assert_equal('ipv6', h[a4])
+
+ require 'set'
+ s = Set[a1, a2, a3, a4, a5, a6, a7, a8]
+ assert_equal(5, s.size)
+ assert_equal(true, s.include?(a1))
+ assert_equal(true, s.include?(a2))
+ assert_equal(true, s.include?(a3))
+ assert_equal(true, s.include?(a4))
+ assert_equal(true, s.include?(a5))
+ assert_equal(true, s.include?(a6))
+ end
+end
diff --git a/lib/irb.rb b/lib/irb.rb
index 92b79b3301..20390d2205 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb.rb - irb main module
# $Release Version: 0.9.6 $
@@ -14,11 +13,14 @@ require "e2mmap"
require "irb/init"
require "irb/context"
require "irb/extend-command"
+#require "irb/workspace"
require "irb/ruby-lex"
require "irb/input-method"
require "irb/locale"
+STDOUT.sync = true
+
# IRB stands for "interactive Ruby" and is a tool to interactively execute Ruby
# expressions read from the standard input.
#
@@ -136,8 +138,8 @@ require "irb/locale"
# This example can be used in your +.irbrc+
#
# IRB.conf[:PROMPT][:MY_PROMPT] = { # name of prompt mode
-# :AUTO_INDENT => true, # enables auto-indent mode
-# :PROMPT_I => ">> ", # simple prompt
+# :AUTO_INDENT => true # enables auto-indent mode
+# :PROMPT_I => nil, # normal prompt
# :PROMPT_S => nil, # prompt for continuated strings
# :PROMPT_C => nil, # prompt for continuated statement
# :RETURN => " ==>%s\n" # format to return value
@@ -156,8 +158,8 @@ require "irb/locale"
# %m # to_s of main object (self)
# %M # inspect of main object (self)
# %l # type of string(", ', /, ]), `]' is inner %w[...]
-# %NNi # indent level. NN is digits and means as same as printf("%NNd").
-# # It can be omitted
+# %NNi # indent level. NN is degits and means as same as printf("%NNd").
+# # It can be ommited
# %NNn # line number.
# %% # %
#
@@ -329,12 +331,13 @@ require "irb/locale"
# irb.3(<Foo:0x4010af3c>):003:0> bar #=> bar => nil
# # kill jobs 1, 2, and 3
# irb.3(<Foo:0x4010af3c>):004:0> kill 1, 2, 3
-# # list open sessions, should only include main session
+# # list open sesssions, should only include main session
# irb(main):009:0> jobs
# #0->irb on main (#<Thread:0x400fb7e4> : running)
# # quit irb
# irb(main):010:0> exit
module IRB
+ @RCS_ID='-$Id$-'
# An exception raised by IRB.irb_abort
class Abort < Exception;end
@@ -344,7 +347,7 @@ module IRB
# Displays current configuration.
#
- # Modifying the configuration is achieved by sending a message to IRB.conf.
+ # Modifing the configuration is achieved by sending a message to IRB.conf.
#
# See IRB@Configuration for more information.
def IRB.conf
@@ -372,7 +375,6 @@ module IRB
# Initializes IRB and creates a new Irb.irb object at the +TOPLEVEL_BINDING+
def IRB.start(ap_path = nil)
- STDOUT.sync = true
$0 = File::basename(ap_path, ".rb") if ap_path
IRB.setup(ap_path)
@@ -397,6 +399,7 @@ module IRB
ensure
irb_at_exit
end
+# print "\n"
end
# Calls each event hook of IRB.conf[:AT_EXIT] when the current session quits.
@@ -496,7 +499,7 @@ module IRB
end
if exc
print exc.class, ": ", exc, "\n"
- if exc.backtrace && exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ &&
+ if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ &&
!(SyntaxError === exc)
irb_bug = true
else
@@ -506,18 +509,16 @@ module IRB
messages = []
lasts = []
levels = 0
- if exc.backtrace
- for m in exc.backtrace
- m = @context.workspace.filter_backtrace(m) unless irb_bug
- if m
- if messages.size < @context.back_trace_limit
- messages.push "\tfrom "+m
- else
- lasts.push "\tfrom "+m
- if lasts.size > @context.back_trace_limit
- lasts.shift
- levels += 1
- end
+ for m in exc.backtrace
+ m = @context.workspace.filter_backtrace(m) unless irb_bug
+ if m
+ if messages.size < @context.back_trace_limit
+ messages.push "\tfrom "+m
+ else
+ lasts.push "\tfrom "+m
+ if lasts.size > @context.back_trace_limit
+ lasts.shift
+ levels += 1
end
end
end
@@ -525,7 +526,7 @@ module IRB
print messages.join("\n"), "\n"
unless lasts.empty?
printf "... %d levels...\n", levels if levels > 0
- print lasts.join("\n"), "\n"
+ print lasts.join("\n")
end
print "Maybe IRB bug!\n" if irb_bug
end
diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb
index 606e0c52a9..1889e75d5e 100644
--- a/lib/irb/cmd/chws.rb
+++ b/lib/irb/cmd/chws.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# change-ws.rb -
# $Release Version: 0.9.6$
@@ -19,14 +18,14 @@ module IRB
class CurrentWorkingWorkspace<Nop
def execute(*obj)
- irb_context.main
+ irb_context.main
end
end
class ChangeWorkspace<Nop
def execute(*obj)
- irb_context.change_workspace(*obj)
- irb_context.main
+ irb_context.change_workspace(*obj)
+ irb_context.main
end
end
end
diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb
index 552c3962f6..fbe5126c85 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# fork.rb -
# $Release Version: 0.9.6 $
@@ -10,26 +9,27 @@
#
#
+@RCS_ID='-$Id$-'
# :stopdoc:
module IRB
module ExtendCommand
class Fork<Nop
def execute
- pid = send ExtendCommand.irb_original_method_name("fork")
- unless pid
- class << self
- alias_method :exit, ExtendCommand.irb_original_method_name('exit')
- end
- if iterator?
- begin
- yield
- ensure
- exit
- end
- end
- end
- pid
+ pid = send ExtendCommand.irb_original_method_name("fork")
+ unless pid
+ class << self
+ alias_method :exit, ExtendCommand.irb_original_method_name('exit')
+ end
+ if iterator?
+ begin
+ yield
+ ensure
+ exit
+ end
+ end
+ end
+ pid
end
end
end
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb
index 7a09c396e1..76e299fc20 100644
--- a/lib/irb/cmd/help.rb
+++ b/lib/irb/cmd/help.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# help.rb - helper using ri
# $Release Version: 0.9.6$
diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb
index e3b84dad79..6c9e9f67ce 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# load.rb -
# $Release Version: 0.9.6$
@@ -20,7 +19,8 @@ module IRB
include IrbLoader
def execute(file_name, priv = nil)
- return irb_load(file_name, priv)
+# return ruby_load(file_name) unless IRB.conf[:USE_LOADER]
+ return irb_load(file_name, priv)
end
end
@@ -28,37 +28,38 @@ module IRB
include IrbLoader
def execute(file_name)
+# return ruby_require(file_name) unless IRB.conf[:USE_LOADER]
- rex = Regexp.new("#{Regexp.quote(file_name)}(\.o|\.rb)?")
- return false if $".find{|f| f =~ rex}
+ rex = Regexp.new("#{Regexp.quote(file_name)}(\.o|\.rb)?")
+ return false if $".find{|f| f =~ rex}
- case file_name
- when /\.rb$/
- begin
- if irb_load(file_name)
- $".push file_name
- return true
- end
- rescue LoadError
- end
- when /\.(so|o|sl)$/
- return ruby_require(file_name)
- end
+ case file_name
+ when /\.rb$/
+ begin
+ if irb_load(file_name)
+ $".push file_name
+ return true
+ end
+ rescue LoadError
+ end
+ when /\.(so|o|sl)$/
+ return ruby_require(file_name)
+ end
- begin
- irb_load(f = file_name + ".rb")
- $".push f
- return true
- rescue LoadError
- return ruby_require(file_name)
- end
+ begin
+ irb_load(f = file_name + ".rb")
+ $".push f
+ return true
+ rescue LoadError
+ return ruby_require(file_name)
+ end
end
end
class Source<Nop
include IrbLoader
def execute(file_name)
- source_file(file_name)
+ source_file(file_name)
end
end
end
diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb
index 9cf4337c28..7bd443121e 100644
--- a/lib/irb/cmd/nop.rb
+++ b/lib/irb/cmd/nop.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# nop.rb -
# $Release Version: 0.9.6$
@@ -14,24 +13,25 @@ module IRB
module ExtendCommand
class Nop
+ @RCS_ID='-$Id$-'
def self.execute(conf, *opts)
- command = new(conf)
- command.execute(*opts)
+ command = new(conf)
+ command.execute(*opts)
end
def initialize(conf)
- @irb_context = conf
+ @irb_context = conf
end
attr_reader :irb_context
def irb
- @irb_context.irb
+ @irb_context.irb
end
def execute(*opts)
- #nop
+ #nop
end
end
end
diff --git a/lib/irb/cmd/pushws.rb b/lib/irb/cmd/pushws.rb
index aa14430ce4..cee8538e3e 100644
--- a/lib/irb/cmd/pushws.rb
+++ b/lib/irb/cmd/pushws.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# change-ws.rb -
# $Release Version: 0.9.6$
@@ -18,21 +17,21 @@ module IRB
module ExtendCommand
class Workspaces<Nop
def execute(*obj)
- irb_context.workspaces.collect{|ws| ws.main}
+ irb_context.workspaces.collect{|ws| ws.main}
end
end
class PushWorkspace<Workspaces
def execute(*obj)
- irb_context.push_workspace(*obj)
- super
+ irb_context.push_workspace(*obj)
+ super
end
end
class PopWorkspace<Workspaces
def execute(*obj)
- irb_context.pop_workspace(*obj)
- super
+ irb_context.pop_workspace(*obj)
+ super
end
end
end
diff --git a/lib/irb/cmd/subirb.rb b/lib/irb/cmd/subirb.rb
index f29548b88f..7363d64769 100644
--- a/lib/irb/cmd/subirb.rb
+++ b/lib/irb/cmd/subirb.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# multi.rb -
# $Release Version: 0.9.6$
# $Revision$
@@ -17,25 +16,25 @@ module IRB
module ExtendCommand
class IrbCommand<Nop
def execute(*obj)
- IRB.irb(nil, *obj)
+ IRB.irb(nil, *obj)
end
end
class Jobs<Nop
def execute
- IRB.JobManager
+ IRB.JobManager
end
end
class Foreground<Nop
def execute(key)
- IRB.JobManager.switch(key)
+ IRB.JobManager.switch(key)
end
end
class Kill<Nop
def execute(*keys)
- IRB.JobManager.kill(*keys)
+ IRB.JobManager.kill(*keys)
end
end
end
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index e7499a8e2b..c6f8a5889f 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/completor.rb -
# $Release Version: 0.9$
@@ -12,6 +11,7 @@ require "readline"
module IRB
module InputCompletor # :nodoc:
+ @RCS_ID='-$Id$-'
# Set of reserved words used by Ruby, you should not use these for
# constants or variables
@@ -38,169 +38,175 @@ module IRB
CompletionProc = proc { |input|
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding
+# puts "input: #{input}"
+
case input
when /^((["'`]).*\2)\.([^.]*)$/
- # String
- receiver = $1
- message = Regexp.quote($3)
+ # String
+ receiver = $1
+ message = Regexp.quote($3)
- candidates = String.instance_methods.collect{|m| m.to_s}
- select_message(receiver, message, candidates)
+ candidates = String.instance_methods.collect{|m| m.to_s}
+ select_message(receiver, message, candidates)
when /^(\/[^\/]*\/)\.([^.]*)$/
- # Regexp
- receiver = $1
- message = Regexp.quote($2)
+ # Regexp
+ receiver = $1
+ message = Regexp.quote($2)
- candidates = Regexp.instance_methods.collect{|m| m.to_s}
- select_message(receiver, message, candidates)
+ candidates = Regexp.instance_methods.collect{|m| m.to_s}
+ select_message(receiver, message, candidates)
when /^([^\]]*\])\.([^.]*)$/
- # Array
- receiver = $1
- message = Regexp.quote($2)
+ # Array
+ receiver = $1
+ message = Regexp.quote($2)
- candidates = Array.instance_methods.collect{|m| m.to_s}
- select_message(receiver, message, candidates)
+ candidates = Array.instance_methods.collect{|m| m.to_s}
+ select_message(receiver, message, candidates)
when /^([^\}]*\})\.([^.]*)$/
- # Proc or Hash
- receiver = $1
- message = Regexp.quote($2)
+ # Proc or Hash
+ receiver = $1
+ message = Regexp.quote($2)
- candidates = Proc.instance_methods.collect{|m| m.to_s}
- candidates |= Hash.instance_methods.collect{|m| m.to_s}
- select_message(receiver, message, candidates)
+ candidates = Proc.instance_methods.collect{|m| m.to_s}
+ candidates |= Hash.instance_methods.collect{|m| m.to_s}
+ select_message(receiver, message, candidates)
when /^(:[^:.]*)$/
- # Symbol
- if Symbol.respond_to?(:all_symbols)
- sym = $1
- candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name}
- candidates.grep(/^#{Regexp.quote(sym)}/)
- else
- []
- end
+ # Symbol
+ if Symbol.respond_to?(:all_symbols)
+ sym = $1
+ candidates = Symbol.all_symbols.collect{|s| ":" + s.id2name}
+ candidates.grep(/^#{Regexp.quote(sym)}/)
+ else
+ []
+ end
when /^::([A-Z][^:\.\(]*)$/
- # Absolute Constant or class methods
- receiver = $1
- candidates = Object.constants.collect{|m| m.to_s}
- candidates.grep(/^#{receiver}/).collect{|e| "::" + e}
+ # Absolute Constant or class methods
+ receiver = $1
+ candidates = Object.constants.collect{|m| m.to_s}
+ candidates.grep(/^#{receiver}/).collect{|e| "::" + e}
+# when /^(((::)?[A-Z][^:.\(]*)+)::?([^:.]*)$/
when /^([A-Z].*)::([^:.]*)$/
- # Constant or class methods
- receiver = $1
- message = Regexp.quote($2)
- begin
- candidates = eval("#{receiver}.constants.collect{|m| m.to_s}", bind)
- candidates |= eval("#{receiver}.methods.collect{|m| m.to_s}", bind)
- rescue Exception
- candidates = []
- end
- select_message(receiver, message, candidates, "::")
+ # Constant or class methods
+ receiver = $1
+ message = Regexp.quote($2)
+ begin
+ candidates = eval("#{receiver}.constants.collect{|m| m.to_s}", bind)
+ candidates |= eval("#{receiver}.methods.collect{|m| m.to_s}", bind)
+ rescue Exception
+ candidates = []
+ end
+ select_message(receiver, message, candidates, "::")
when /^(:[^:.]+)(\.|::)([^.]*)$/
- # Symbol
- receiver = $1
- sep = $2
- message = Regexp.quote($3)
+ # Symbol
+ receiver = $1
+ sep = $2
+ message = Regexp.quote($3)
- candidates = Symbol.instance_methods.collect{|m| m.to_s}
- select_message(receiver, message, candidates, sep)
+ candidates = Symbol.instance_methods.collect{|m| m.to_s}
+ select_message(receiver, message, candidates, sep)
when /^(-?(0[dbo])?[0-9_]+(\.[0-9_]+)?([eE]-?[0-9]+)?)(\.|::)([^.]*)$/
- # Numeric
- receiver = $1
- sep = $5
- message = Regexp.quote($6)
-
- begin
- candidates = eval(receiver, bind).methods.collect{|m| m.to_s}
- rescue Exception
- candidates = []
- end
- select_message(receiver, message, candidates, sep)
+ # Numeric
+ receiver = $1
+ sep = $5
+ message = Regexp.quote($6)
+
+ begin
+ candidates = eval(receiver, bind).methods.collect{|m| m.to_s}
+ rescue Exception
+ candidates = []
+ end
+ select_message(receiver, message, candidates, sep)
when /^(-?0x[0-9a-fA-F_]+)(\.|::)([^.]*)$/
- # Numeric(0xFFFF)
- receiver = $1
- sep = $2
- message = Regexp.quote($3)
-
- begin
- candidates = eval(receiver, bind).methods.collect{|m| m.to_s}
- rescue Exception
- candidates = []
- end
- select_message(receiver, message, candidates, sep)
+ # Numeric(0xFFFF)
+ receiver = $1
+ sep = $2
+ message = Regexp.quote($3)
+
+ begin
+ candidates = eval(receiver, bind).methods.collect{|m| m.to_s}
+ rescue Exception
+ candidates = []
+ end
+ select_message(receiver, message, candidates, sep)
when /^(\$[^.]*)$/
- # global var
- regmessage = Regexp.new(Regexp.quote($1))
- candidates = global_variables.collect{|m| m.to_s}.grep(regmessage)
+ # global var
+ regmessage = Regexp.new(Regexp.quote($1))
+ candidates = global_variables.collect{|m| m.to_s}.grep(regmessage)
+# when /^(\$?(\.?[^.]+)+)\.([^.]*)$/
+# when /^((\.?[^.]+)+)\.([^.]*)$/
+# when /^([^."].*)\.([^.]*)$/
when /^([^."].*)(\.|::)([^.]*)$/
- # variable.func or func.func
- receiver = $1
- sep = $2
- message = Regexp.quote($3)
-
- gv = eval("global_variables", bind).collect{|m| m.to_s}
- lv = eval("local_variables", bind).collect{|m| m.to_s}
- iv = eval("instance_variables", bind).collect{|m| m.to_s}
- cv = eval("self.class.constants", bind).collect{|m| m.to_s}
-
- if (gv | lv | iv | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
- # foo.func and foo is var. OR
- # foo::func and foo is var. OR
- # foo::Const and foo is var. OR
- # Foo::Bar.func
- begin
- candidates = []
- rec = eval(receiver, bind)
- if sep == "::" and rec.kind_of?(Module)
- candidates = rec.constants.collect{|m| m.to_s}
- end
- candidates |= rec.methods.collect{|m| m.to_s}
- rescue Exception
- candidates = []
- end
- else
- # func1.func2
- candidates = []
- ObjectSpace.each_object(Module){|m|
- begin
- name = m.name
- rescue Exception
- name = ""
- end
+ # variable.func or func.func
+ receiver = $1
+ sep = $2
+ message = Regexp.quote($3)
+
+ gv = eval("global_variables", bind).collect{|m| m.to_s}
+ lv = eval("local_variables", bind).collect{|m| m.to_s}
+ iv = eval("instance_variables", bind).collect{|m| m.to_s}
+ cv = eval("self.class.constants", bind).collect{|m| m.to_s}
+
+ if (gv | lv | iv | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
+ # foo.func and foo is var. OR
+ # foo::func and foo is var. OR
+ # foo::Const and foo is var. OR
+ # Foo::Bar.func
+ begin
+ candidates = []
+ rec = eval(receiver, bind)
+ if sep == "::" and rec.kind_of?(Module)
+ candidates = rec.constants.collect{|m| m.to_s}
+ end
+ candidates |= rec.methods.collect{|m| m.to_s}
+ rescue Exception
+ candidates = []
+ end
+ else
+ # func1.func2
+ candidates = []
+ ObjectSpace.each_object(Module){|m|
+ begin
+ name = m.name
+ rescue Exception
+ name = ""
+ end
begin
next if name != "IRB::Context" and
/^(IRB|SLex|RubyLex|RubyToken)/ =~ name
rescue Exception
next
end
- candidates.concat m.instance_methods(false).collect{|x| x.to_s}
- }
- candidates.sort!
- candidates.uniq!
- end
- select_message(receiver, message, candidates, sep)
+ candidates.concat m.instance_methods(false).collect{|x| x.to_s}
+ }
+ candidates.sort!
+ candidates.uniq!
+ end
+ select_message(receiver, message, candidates, sep)
when /^\.([^.]*)$/
- # unknown(maybe String)
+ # unknown(maybe String)
- receiver = ""
- message = Regexp.quote($1)
+ receiver = ""
+ message = Regexp.quote($1)
- candidates = String.instance_methods(true).collect{|m| m.to_s}
- select_message(receiver, message, candidates)
+ candidates = String.instance_methods(true).collect{|m| m.to_s}
+ select_message(receiver, message, candidates)
else
- candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
+ candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
- (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
+ (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
end
}
@@ -209,19 +215,20 @@ module IRB
def self.select_message(receiver, message, candidates, sep = ".")
candidates.grep(/^#{message}/).collect do |e|
- case e
- when /^[a-zA-Z_]/
- receiver + sep + e
- when /^[0-9]/
- when *Operators
- #receiver + " " + e
- end
+ case e
+ when /^[a-zA-Z_]/
+ receiver + sep + e
+ when /^[0-9]/
+ when *Operators
+ #receiver + " " + e
+ end
end
end
end
end
if Readline.respond_to?("basic_word_break_characters=")
+# Readline.basic_word_break_characters= " \t\n\"\\'`><=;|&{("
Readline.basic_word_break_characters= " \t\n`><=;|&{("
end
Readline.completion_append_character = nil
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 4cf6128930..72b36307d5 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/context.rb - irb context
# $Release Version: 0.9.6$
@@ -26,11 +25,12 @@ module IRB
def initialize(irb, workspace = nil, input_method = nil, output_method = nil)
@irb = irb
if workspace
- @workspace = workspace
+ @workspace = workspace
else
- @workspace = WorkSpace.new
+ @workspace = WorkSpace.new
end
@thread = Thread.current if defined? Thread
+# @irb_level = 0
# copy of default configuration
@ap_name = IRB.conf[:AP_NAME]
@@ -55,50 +55,50 @@ module IRB
self.prompt_mode = IRB.conf[:PROMPT_MODE]
if IRB.conf[:SINGLE_IRB] or !defined?(IRB::JobManager)
- @irb_name = IRB.conf[:IRB_NAME]
+ @irb_name = IRB.conf[:IRB_NAME]
else
- @irb_name = IRB.conf[:IRB_NAME]+"#"+IRB.JobManager.n_jobs.to_s
+ @irb_name = IRB.conf[:IRB_NAME]+"#"+IRB.JobManager.n_jobs.to_s
end
@irb_path = "(" + @irb_name + ")"
case input_method
when nil
- case use_readline?
- when nil
- if (defined?(ReadlineInputMethod) && STDIN.tty? &&
- IRB.conf[:PROMPT_MODE] != :INF_RUBY)
- @io = ReadlineInputMethod.new
- else
- @io = StdioInputMethod.new
- end
- when false
- @io = StdioInputMethod.new
- when true
- if defined?(ReadlineInputMethod)
- @io = ReadlineInputMethod.new
- else
- @io = StdioInputMethod.new
- end
- end
+ case use_readline?
+ when nil
+ if (defined?(ReadlineInputMethod) && STDIN.tty? &&
+ IRB.conf[:PROMPT_MODE] != :INF_RUBY)
+ @io = ReadlineInputMethod.new
+ else
+ @io = StdioInputMethod.new
+ end
+ when false
+ @io = StdioInputMethod.new
+ when true
+ if defined?(ReadlineInputMethod)
+ @io = ReadlineInputMethod.new
+ else
+ @io = StdioInputMethod.new
+ end
+ end
when String
- @io = FileInputMethod.new(input_method)
- @irb_name = File.basename(input_method)
- @irb_path = input_method
+ @io = FileInputMethod.new(input_method)
+ @irb_name = File.basename(input_method)
+ @irb_path = input_method
else
- @io = input_method
+ @io = input_method
end
self.save_history = IRB.conf[:SAVE_HISTORY] if IRB.conf[:SAVE_HISTORY]
if output_method
- @output_method = output_method
+ @output_method = output_method
else
- @output_method = StdioOutputMethod.new
+ @output_method = StdioOutputMethod.new
end
@echo = IRB.conf[:ECHO]
if @echo.nil?
- @echo = true
+ @echo = true
end
self.debug_level = IRB.conf[:DEBUG_LEVEL]
end
@@ -235,15 +235,15 @@ module IRB
# Returns whether messages are displayed or not.
def verbose?
if @verbose.nil?
- if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)
- false
- elsif !STDIN.tty? or @io.kind_of?(FileInputMethod)
- true
- else
- false
- end
+ if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)
+ false
+ elsif !STDIN.tty? or @io.kind_of?(FileInputMethod)
+ true
+ else
+ false
+ end
else
- @verbose
+ @verbose
end
end
@@ -251,7 +251,7 @@ module IRB
# StdioInputMethod or ReadlineInputMethod, see #io for more information.
def prompting?
verbose? || (STDIN.tty? && @io.kind_of?(StdioInputMethod) ||
- (defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)))
+ (defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)))
end
# The return value of the last statement evaluated.
@@ -276,9 +276,9 @@ module IRB
@prompt_n = pconf[:PROMPT_N]
@return_format = pconf[:RETURN]
if ai = pconf.include?(:AUTO_INDENT)
- @auto_indent_mode = ai
+ @auto_indent_mode = ai
else
- @auto_indent_mode = IRB.conf[:AUTO_INDENT]
+ @auto_indent_mode = IRB.conf[:AUTO_INDENT]
end
end
@@ -309,41 +309,41 @@ module IRB
def inspect_mode=(opt)
if i = Inspector::INSPECTORS[opt]
- @inspect_mode = opt
- @inspect_method = i
- i.init
+ @inspect_mode = opt
+ @inspect_method = i
+ i.init
else
- case opt
- when nil
- if Inspector.keys_with_inspector(Inspector::INSPECTORS[true]).include?(@inspect_mode)
- self.inspect_mode = false
- elsif Inspector.keys_with_inspector(Inspector::INSPECTORS[false]).include?(@inspect_mode)
- self.inspect_mode = true
- else
- puts "Can't switch inspect mode."
- return
- end
- when /^\s*\{.*\}\s*$/
- begin
- inspector = eval "proc#{opt}"
- rescue Exception
- puts "Can't switch inspect mode(#{opt})."
- return
- end
- self.inspect_mode = inspector
- when Proc
- self.inspect_mode = IRB::Inspector(opt)
- when Inspector
- prefix = "usr%d"
- i = 1
- while Inspector::INSPECTORS[format(prefix, i)]; i += 1; end
- @inspect_mode = format(prefix, i)
- @inspect_method = opt
- Inspector.def_inspector(format(prefix, i), @inspect_method)
- else
- puts "Can't switch inspect mode(#{opt})."
- return
- end
+ case opt
+ when nil
+ if Inspector.keys_with_inspector(Inspector::INSPECTORS[true]).include?(@inspect_mode)
+ self.inspect_mode = false
+ elsif Inspector.keys_with_inspector(Inspector::INSPECTORS[false]).include?(@inspect_mode)
+ self.inspect_mode = true
+ else
+ puts "Can't switch inspect mode."
+ return
+ end
+ when /^\s*\{.*\}\s*$/
+ begin
+ inspector = eval "proc#{opt}"
+ rescue Exception
+ puts "Can't switch inspect mode(#{opt})."
+ return
+ end
+ self.inspect_mode = inspector
+ when Proc
+ self.inspect_mode = IRB::Inspector(opt)
+ when Inspector
+ prefix = "usr%d"
+ i = 1
+ while Inspector::INSPECTORS[format(prefix, i)]; i += 1; end
+ @inspect_mode = format(prefix, i)
+ @inspect_method = opt
+ Inspector.def_inspector(format(prefix, i), @inspect_method)
+ else
+ puts "Can't switch inspect mode(#{opt})."
+ return
+ end
end
print "Switch to#{unless @inspect_mode; ' non';end} inspect mode.\n" if verbose?
@inspect_mode
@@ -378,6 +378,8 @@ module IRB
def evaluate(line, line_no) # :nodoc:
@line_no = line_no
set_last_value(@workspace.evaluate(self, line, irb_path, line_no))
+# @workspace.evaluate("_ = IRB.conf[:MAIN_CONTEXT]._")
+# @_ = @workspace.evaluate(line, irb_path, line_no)
end
def inspect_last_value # :nodoc:
@@ -398,19 +400,19 @@ module IRB
def inspect # :nodoc:
array = []
for ivar in instance_variables.sort{|e1, e2| e1 <=> e2}
- ivar = ivar.to_s
- name = ivar.sub(/^@(.*)$/, '\1')
- val = instance_eval(ivar)
- case ivar
- when *NOPRINTING_IVARS
- array.push format("conf.%s=%s", name, "...")
- when *NO_INSPECTING_IVARS
- array.push format("conf.%s=%s", name, val.to_s)
- when *IDNAME_IVARS
- array.push format("conf.%s=:%s", name, val.id2name)
- else
- array.push format("conf.%s=%s", name, val.inspect)
- end
+ ivar = ivar.to_s
+ name = ivar.sub(/^@(.*)$/, '\1')
+ val = instance_eval(ivar)
+ case ivar
+ when *NOPRINTING_IVARS
+ array.push format("conf.%s=%s", name, "...")
+ when *NO_INSPECTING_IVARS
+ array.push format("conf.%s=%s", name, val.to_s)
+ when *IDNAME_IVARS
+ array.push format("conf.%s=:%s", name, val.id2name)
+ else
+ array.push format("conf.%s=%s", name, val.inspect)
+ end
end
array.join("\n")
end
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb
index 94bfe62bc0..ce921eb5e3 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/ext/cb.rb -
# $Release Version: 0.9.6$
@@ -16,9 +15,9 @@ module IRB # :nodoc:
# Inherited from +TOPLEVEL_BINDING+.
def home_workspace
if defined? @home_workspace
- @home_workspace
+ @home_workspace
else
- @home_workspace = @workspace
+ @home_workspace = @workspace
end
end
@@ -31,16 +30,40 @@ module IRB # :nodoc:
# See IRB::WorkSpace.new for more information.
def change_workspace(*_main)
if _main.empty?
- @workspace = home_workspace
- return main
+ @workspace = home_workspace
+ return main
end
@workspace = WorkSpace.new(_main[0])
if !(class<<main;ancestors;end).include?(ExtendCommandBundle)
- main.extend ExtendCommandBundle
+ main.extend ExtendCommandBundle
end
end
+
+# def change_binding(*_main)
+# back = @workspace
+# @workspace = WorkSpace.new(*_main)
+# unless _main.empty?
+# begin
+# main.extend ExtendCommandBundle
+# rescue
+# print "can't change binding to: ", main.inspect, "\n"
+# @workspace = back
+# return nil
+# end
+# end
+# @irb_level += 1
+# begin
+# catch(:SU_EXIT) do
+# @irb.eval_input
+# end
+# ensure
+# @irb_level -= 1
+# @workspace = back
+# end
+# end
+# alias change_workspace change_binding
end
end
diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb
index 62363b13f4..3239c57a6c 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# history.rb -
# $Release Version: 0.9.6$
@@ -22,9 +21,10 @@ module IRB # :nodoc:
def set_last_value(value)
_set_last_value(value)
- if @eval_history
- @eval_history_values.push @line_no, @last_value
- @workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
+# @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
+ if @eval_history #and !@eval_history_values.equal?(llv)
+ @eval_history_values.push @line_no, @last_value
+ @workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
end
@last_value
@@ -43,22 +43,23 @@ module IRB # :nodoc:
# If +no+ is +nil+, execution result history isn't used (default).
def eval_history=(no)
if no
- if defined?(@eval_history) && @eval_history
- @eval_history_values.size(no)
- else
- @eval_history_values = History.new(no)
- IRB.conf[:__TMP__EHV__] = @eval_history_values
- @workspace.evaluate(self, "__ = IRB.conf[:__TMP__EHV__]")
- IRB.conf.delete(:__TMP_EHV__)
- end
+ if defined?(@eval_history) && @eval_history
+ @eval_history_values.size(no)
+ else
+ @eval_history_values = History.new(no)
+ IRB.conf[:__TMP__EHV__] = @eval_history_values
+ @workspace.evaluate(self, "__ = IRB.conf[:__TMP__EHV__]")
+ IRB.conf.delete(:__TMP_EHV__)
+ end
else
- @eval_history_values = nil
+ @eval_history_values = nil
end
@eval_history = no
end
end
class History # :nodoc:
+ @RCS_ID='-$Id$-'
def initialize(size = 16)
@size = size
@@ -67,20 +68,20 @@ module IRB # :nodoc:
def size(size)
if size != 0 && size < @size
- @contents = @contents[@size - size .. @size]
+ @contents = @contents[@size - size .. @size]
end
@size = size
end
def [](idx)
begin
- if idx >= 0
- @contents.find{|no, val| no == idx}[1]
- else
- @contents[idx][1]
- end
+ if idx >= 0
+ @contents.find{|no, val| no == idx}[1]
+ else
+ @contents[idx][1]
+ end
rescue NameError
- nil
+ nil
end
end
@@ -93,22 +94,22 @@ module IRB # :nodoc:
def inspect
if @contents.empty?
- return real_inspect
+ return real_inspect
end
unless (last = @contents.pop)[1].equal?(self)
- @contents.push last
- last = nil
+ @contents.push last
+ last = nil
end
str = @contents.collect{|no, val|
- if val.equal?(self)
- "#{no} ...self-history..."
- else
- "#{no} #{val.inspect}"
- end
+ if val.equal?(self)
+ "#{no} ...self-history..."
+ else
+ "#{no} #{val.inspect}"
+ end
}.join("\n")
if str == ""
- str = "Empty."
+ str = "Empty."
end
@contents.push last if last
str
diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb
index 840226db30..6cdc8ec898 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# loader.rb -
# $Release Version: 0.9.6$
@@ -19,6 +18,7 @@ module IRB # :nodoc:
#
# See ExtendCommandBundle for more information.
module IrbLoader
+ @RCS_ID='-$Id$-'
alias ruby_load load
alias ruby_require require
@@ -33,14 +33,14 @@ module IRB # :nodoc:
def search_file_from_ruby_path(fn) # :nodoc:
if /^#{Regexp.quote(File::Separator)}/ =~ fn
- return fn if File.exist?(fn)
- return nil
+ return fn if File.exist?(fn)
+ return nil
end
for path in $:
- if File.exist?(f = File.join(path, fn))
- return f
- end
+ if File.exist?(f = File.join(path, fn))
+ return f
+ end
end
return nil
end
@@ -50,20 +50,20 @@ module IRB # :nodoc:
# See Irb#suspend_input_method for more information.
def source_file(path)
irb.suspend_name(path, File.basename(path)) do
- irb.suspend_input_method(FileInputMethod.new(path)) do
- |back_io|
- irb.signal_status(:IN_LOAD) do
- if back_io.kind_of?(FileInputMethod)
- irb.eval_input
- else
- begin
- irb.eval_input
- rescue LoadAbort
- print "load abort!!\n"
- end
- end
- end
- end
+ irb.suspend_input_method(FileInputMethod.new(path)) do
+ |back_io|
+ irb.signal_status(:IN_LOAD) do
+ if back_io.kind_of?(FileInputMethod)
+ irb.eval_input
+ else
+ begin
+ irb.eval_input
+ rescue LoadAbort
+ print "load abort!!\n"
+ end
+ end
+ end
+ end
end
end
@@ -73,27 +73,28 @@ module IRB # :nodoc:
def load_file(path, priv = nil)
irb.suspend_name(path, File.basename(path)) do
- if priv
- ws = WorkSpace.new(Module.new)
- else
- ws = WorkSpace.new
- end
- irb.suspend_workspace(ws) do
- irb.suspend_input_method(FileInputMethod.new(path)) do
- |back_io|
- irb.signal_status(:IN_LOAD) do
- if back_io.kind_of?(FileInputMethod)
- irb.eval_input
- else
- begin
- irb.eval_input
- rescue LoadAbort
- print "load abort!!\n"
- end
- end
- end
- end
- end
+ if priv
+ ws = WorkSpace.new(Module.new)
+ else
+ ws = WorkSpace.new
+ end
+ irb.suspend_workspace(ws) do
+ irb.suspend_input_method(FileInputMethod.new(path)) do
+ |back_io|
+ irb.signal_status(:IN_LOAD) do
+# p irb.conf
+ if back_io.kind_of?(FileInputMethod)
+ irb.eval_input
+ else
+ begin
+ irb.eval_input
+ rescue LoadAbort
+ print "load abort!!\n"
+ end
+ end
+ end
+ end
+ end
end
end
@@ -103,25 +104,25 @@ module IRB # :nodoc:
back_name = @irb_name
back_scanner = @irb.scanner
begin
- @io = FileInputMethod.new(path)
- @irb_name = File.basename(path)
- @irb_path = path
- @irb.signal_status(:IN_LOAD) do
- if back_io.kind_of?(FileInputMethod)
- @irb.eval_input
- else
- begin
- @irb.eval_input
- rescue LoadAbort
- print "load abort!!\n"
- end
- end
- end
+ @io = FileInputMethod.new(path)
+ @irb_name = File.basename(path)
+ @irb_path = path
+ @irb.signal_status(:IN_LOAD) do
+ if back_io.kind_of?(FileInputMethod)
+ @irb.eval_input
+ else
+ begin
+ @irb.eval_input
+ rescue LoadAbort
+ print "load abort!!\n"
+ end
+ end
+ end
ensure
- @io = back_io
- @irb_name = back_name
- @irb_path = back_path
- @irb.scanner = back_scanner
+ @io = back_io
+ @irb_name = back_name
+ @irb_path = back_path
+ @irb.scanner = back_scanner
end
end
end
diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb
index e409dbdc6a..067eb1e7fa 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# math-mode.rb -
# $Release Version: 0.9.6$
@@ -29,14 +28,14 @@ module IRB
# more information.
def math_mode=(opt)
if @math_mode == true && !opt
- IRB.fail CantReturnToNormalMode
- return
+ IRB.fail CantReturnToNormalMode
+ return
end
@math_mode = opt
if math_mode
- main.extend Math
- print "start math mode\n" if verbose?
+ main.extend Math
+ print "start math mode\n" if verbose?
end
end
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 982a319611..e49a158fa3 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/multi-irb.rb - multiple irb module
# $Release Version: 0.9.6$
@@ -14,9 +13,11 @@ require "thread"
module IRB
class JobManager
+ @RCS_ID='-$Id$-'
# Creates a new JobManager object
def initialize
+ # @jobs = [[thread, irb],...]
@jobs = []
@current_job = nil
end
@@ -84,9 +85,9 @@ module IRB
# See Thread#exit for more information.
def kill(*keys)
for key in keys
- th, _ = search(key)
- IRB.fail IrbAlreadyDead unless th.alive?
- th.exit
+ th, _ = search(key)
+ IRB.fail IrbAlreadyDead unless th.alive?
+ th.exit
end
end
@@ -106,15 +107,15 @@ module IRB
# Raises a NoSuchJob exception if no job can be found with the given +key+.
def search(key)
job = case key
- when Integer
- @jobs[key]
- when Irb
- @jobs.find{|k, v| v.equal?(key)}
- when Thread
- @jobs.assoc(key)
- else
- @jobs.find{|k, v| v.context.main.equal?(key)}
- end
+ when Integer
+ @jobs[key]
+ when Irb
+ @jobs.find{|k, v| v.equal?(key)}
+ when Thread
+ @jobs.assoc(key)
+ else
+ @jobs.find{|k, v| v.context.main.equal?(key)}
+ end
IRB.fail NoSuchJob, key if job.nil?
job
end
@@ -123,21 +124,21 @@ module IRB
def delete(key)
case key
when Integer
- IRB.fail NoSuchJob, key unless @jobs[key]
- @jobs[key] = nil
+ IRB.fail NoSuchJob, key unless @jobs[key]
+ @jobs[key] = nil
else
- catch(:EXISTS) do
- @jobs.each_index do
- |i|
- if @jobs[i] and (@jobs[i][0] == key ||
- @jobs[i][1] == key ||
- @jobs[i][1].context.main.equal?(key))
- @jobs[i] = nil
- throw :EXISTS
- end
- end
- IRB.fail NoSuchJob, key
- end
+ catch(:EXISTS) do
+ @jobs.each_index do
+ |i|
+ if @jobs[i] and (@jobs[i][0] == key ||
+ @jobs[i][1] == key ||
+ @jobs[i][1].context.main.equal?(key))
+ @jobs[i] = nil
+ throw :EXISTS
+ end
+ end
+ IRB.fail NoSuchJob, key
+ end
end
until assoc = @jobs.pop; end unless @jobs.empty?
@jobs.push assoc
@@ -147,25 +148,25 @@ module IRB
def inspect
ary = []
@jobs.each_index do
- |i|
- th, irb = @jobs[i]
- next if th.nil?
+ |i|
+ th, irb = @jobs[i]
+ next if th.nil?
- if th.alive?
- if th.stop?
- t_status = "stop"
- else
- t_status = "running"
- end
- else
- t_status = "exited"
- end
- ary.push format("#%d->%s on %s (%s: %s)",
- i,
- irb.context.irb_name,
- irb.context.main,
- th,
- t_status)
+ if th.alive?
+ if th.stop?
+ t_status = "stop"
+ else
+ t_status = "running"
+ end
+ else
+ t_status = "exited"
+ end
+ ary.push format("#%d->%s on %s (%s: %s)",
+ i,
+ irb.context.irb_name,
+ irb.context.main,
+ th,
+ t_status)
end
ary.join("\n")
end
@@ -192,45 +193,64 @@ module IRB
parent_thread = Thread.current
Thread.start do
begin
- irb = Irb.new(workspace, file)
+ irb = Irb.new(workspace, file)
rescue
- print "Subirb can't start with context(self): ", workspace.main.inspect, "\n"
- print "return to main irb\n"
- Thread.pass
- Thread.main.wakeup
- Thread.exit
+ print "Subirb can't start with context(self): ", workspace.main.inspect, "\n"
+ print "return to main irb\n"
+ Thread.pass
+ Thread.main.wakeup
+ Thread.exit
end
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
@JobManager.insert(irb)
@JobManager.current_job = irb
begin
- system_exit = false
- catch(:IRB_EXIT) do
- irb.eval_input
- end
+ system_exit = false
+ catch(:IRB_EXIT) do
+ irb.eval_input
+ end
rescue SystemExit
- system_exit = true
- raise
- #fail
+ system_exit = true
+ raise
+ #fail
ensure
- unless system_exit
- @JobManager.delete(irb)
- if @JobManager.current_job == irb
- if parent_thread.alive?
- @JobManager.current_job = @JobManager.irb(parent_thread)
- parent_thread.run
- else
- @JobManager.current_job = @JobManager.main_irb
- @JobManager.main_thread.run
- end
- end
- end
+ unless system_exit
+ @JobManager.delete(irb)
+ if @JobManager.current_job == irb
+ if parent_thread.alive?
+ @JobManager.current_job = @JobManager.irb(parent_thread)
+ parent_thread.run
+ else
+ @JobManager.current_job = @JobManager.main_irb
+ @JobManager.main_thread.run
+ end
+ end
+ end
end
end
Thread.stop
@JobManager.current_job = @JobManager.irb(Thread.current)
end
+# class Context
+# def set_last_value(value)
+# @last_value = value
+# @workspace.evaluate "_ = IRB.JobManager.irb(Thread.current).context.last_value"
+# if @eval_history #and !@__.equal?(@last_value)
+# @eval_history_values.push @line_no, @last_value
+# @workspace.evaluate "__ = IRB.JobManager.irb(Thread.current).context.instance_eval{@eval_history_values}"
+# end
+# @last_value
+# end
+# end
+
+# module ExtendCommand
+# def irb_context
+# IRB.JobManager.irb(Thread.current).context
+# end
+# # alias conf irb_context
+# end
+
@CONF[:SINGLE_IRB_MODE] = false
@JobManager.insert(@CONF[:MAIN_CONTEXT].irb)
@JobManager.current_job = @CONF[:MAIN_CONTEXT].irb
@@ -238,22 +258,22 @@ module IRB
class Irb
def signal_handle
unless @context.ignore_sigint?
- print "\nabort!!\n" if @context.verbose?
- exit
+ print "\nabort!!\n" if @context.verbose?
+ exit
end
case @signal_status
when :IN_INPUT
- print "^C\n"
- IRB.JobManager.thread(self).raise RubyLex::TerminateLineInput
+ print "^C\n"
+ IRB.JobManager.thread(self).raise RubyLex::TerminateLineInput
when :IN_EVAL
- IRB.irb_abort(self)
+ IRB.irb_abort(self)
when :IN_LOAD
- IRB.irb_abort(self, LoadAbort)
+ IRB.irb_abort(self, LoadAbort)
when :IN_IRB
- # ignore
+ # ignore
else
- # ignore other cases as well
+ # ignore other cases as well
end
end
end
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
index ab64cf543d..7b3fcbbeec 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# save-history.rb -
# $Release Version: 0.9.6$
# $Revision$
@@ -13,12 +12,13 @@ require "readline"
module IRB
module HistorySavingAbility # :nodoc:
+ @RCS_ID='-$Id$-'
end
class Context
def init_save_history# :nodoc:
unless (class<<@io;self;end).include?(HistorySavingAbility)
- @io.extend(HistorySavingAbility)
+ @io.extend(HistorySavingAbility)
end
end
@@ -27,7 +27,6 @@ module IRB
IRB.conf[:SAVE_HISTORY]
end
- remove_method :save_history= if respond_to?(:save_history=)
# Sets <code>IRB.conf[:SAVE_HISTORY]</code> to the given +val+ and calls
# #init_save_history with this context.
#
@@ -40,9 +39,9 @@ module IRB
def save_history=(val)
IRB.conf[:SAVE_HISTORY] = val
if val
- main_context = IRB.conf[:MAIN_CONTEXT]
- main_context = self unless main_context
- main_context.init_save_history
+ main_context = IRB.conf[:MAIN_CONTEXT]
+ main_context = self unless main_context
+ main_context.init_save_history
end
end
@@ -60,7 +59,23 @@ module IRB
module HistorySavingAbility # :nodoc:
include Readline
+# def HistorySavingAbility.create_finalizer
+# proc do
+# if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
+# if hf = IRB.conf[:HISTORY_FILE]
+# file = File.expand_path(hf)
+# end
+# file = IRB.rc_file("_history") unless file
+# open(file, 'w' ) do |f|
+# hist = HISTORY.to_a
+# f.puts(hist[-num..-1] || hist)
+# end
+# end
+# end
+# end
+
def HistorySavingAbility.extended(obj)
+# ObjectSpace.define_finalizer(obj, HistorySavingAbility.create_finalizer)
IRB.conf[:AT_EXIT].push proc{obj.save_history}
obj.load_history
obj
@@ -68,37 +83,37 @@ module IRB
def load_history
if history_file = IRB.conf[:HISTORY_FILE]
- history_file = File.expand_path(history_file)
+ history_file = File.expand_path(history_file)
end
history_file = IRB.rc_file("_history") unless history_file
if File.exist?(history_file)
- open(history_file) do |f|
- f.each {|l| HISTORY << l.chomp}
- end
+ open(history_file) do |f|
+ f.each {|l| HISTORY << l.chomp}
+ end
end
end
def save_history
if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
- if history_file = IRB.conf[:HISTORY_FILE]
- history_file = File.expand_path(history_file)
- end
- history_file = IRB.rc_file("_history") unless history_file
+ if history_file = IRB.conf[:HISTORY_FILE]
+ history_file = File.expand_path(history_file)
+ end
+ history_file = IRB.rc_file("_history") unless history_file
- # Change the permission of a file that already exists[BUG #7694]
- begin
- if File.stat(history_file).mode & 066 != 0
- File.chmod(0600, history_file)
- end
- rescue Errno::ENOENT
- rescue
- raise
- end
+ # Change the permission of a file that already exists[BUG #7694]
+ begin
+ if File.stat(history_file).mode & 066 != 0
+ File.chmod(0600, history_file)
+ end
+ rescue Errno::ENOENT
+ rescue
+ raise
+ end
- open(history_file, 'w', 0600 ) do |f|
- hist = HISTORY.to_a
- f.puts(hist[-num..-1] || hist)
- end
+ open(history_file, 'w', 0600 ) do |f|
+ hist = HISTORY.to_a
+ f.puts(hist[-num..-1] || hist)
+ end
end
end
end
diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index 200f77e341..8c9083dbad 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/lib/tracer.rb -
# $Release Version: 0.9.6$
@@ -19,7 +18,7 @@ module IRB
Tracer.add_filter {
|event, file, line, id, binding, *rests|
/^#{Regexp.quote(@CONF[:IRB_LIB_PATH])}/ !~ file and
- File::basename(file) != "irb.rb"
+ File::basename(file) != "irb.rb"
}
end
@@ -36,12 +35,12 @@ module IRB
# See +lib/tracer.rb+ for more information.
def use_tracer=(opt)
if opt
- Tracer.set_get_line_procs(@irb_path) {
- |line_no, *rests|
- @io.line(line_no)
- }
+ Tracer.set_get_line_procs(@irb_path) {
+ |line_no, *rests|
+ @io.line(line_no)
+ }
elsif !opt && @use_tracer
- Tracer.off
+ Tracer.off
end
@use_tracer=opt
end
@@ -55,14 +54,14 @@ module IRB
# See +lib/tracer.rb+ for more information.
def evaluate(context, statements, file = nil, line = nil)
if context.use_tracer? && file != nil && line != nil
- Tracer.on
- begin
- __evaluate__(context, statements, file, line)
- ensure
- Tracer.off
- end
+ Tracer.on
+ begin
+ __evaluate__(context, statements, file, line)
+ ensure
+ Tracer.off
+ end
else
- __evaluate__(context, statements, file || __FILE__, line || __LINE__)
+ __evaluate__(context, statements, file || __FILE__, line || __LINE__)
end
end
end
diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb
index 571dd25d17..4e98f5b7a2 100644
--- a/lib/irb/ext/use-loader.rb
+++ b/lib/irb/ext/use-loader.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# use-loader.rb -
# $Release Version: 0.9.6$
@@ -50,20 +49,20 @@ module IRB
def use_loader=(opt)
if IRB.conf[:USE_LOADER] != opt
- IRB.conf[:USE_LOADER] = opt
- if opt
- if !$".include?("irb/cmd/load")
- end
- (class<<@workspace.main;self;end).instance_eval {
- alias_method :load, :irb_load
- alias_method :require, :irb_require
- }
- else
- (class<<@workspace.main;self;end).instance_eval {
- alias_method :load, :__original__load__IRB_use_loader__
- alias_method :require, :__original__require__IRB_use_loader__
- }
- end
+ IRB.conf[:USE_LOADER] = opt
+ if opt
+ if !$".include?("irb/cmd/load")
+ end
+ (class<<@workspace.main;self;end).instance_eval {
+ alias_method :load, :irb_load
+ alias_method :require, :irb_require
+ }
+ else
+ (class<<@workspace.main;self;end).instance_eval {
+ alias_method :load, :__original__load__IRB_use_loader__
+ alias_method :require, :__original__require__IRB_use_loader__
+ }
+ end
end
print "Switch to load/require#{unless use_loader; ' non';end} trace mode.\n" if verbose?
opt
diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb
index 5bd72c194f..641befbdf3 100644
--- a/lib/irb/ext/workspaces.rb
+++ b/lib/irb/ext/workspaces.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# push-ws.rb -
# $Release Version: 0.9.6$
@@ -21,9 +20,9 @@ module IRB # :nodoc:
# WorkSpaces in the current stack
def workspaces
if defined? @workspaces
- @workspaces
+ @workspaces
else
- @workspaces = []
+ @workspaces = []
end
end
@@ -34,20 +33,20 @@ module IRB # :nodoc:
# information.
def push_workspace(*_main)
if _main.empty?
- if workspaces.empty?
- print "No other workspace\n"
- return nil
- end
- ws = workspaces.pop
- workspaces.push @workspace
- @workspace = ws
- return workspaces
+ if workspaces.empty?
+ print "No other workspace\n"
+ return nil
+ end
+ ws = workspaces.pop
+ workspaces.push @workspace
+ @workspace = ws
+ return workspaces
end
workspaces.push @workspace
@workspace = WorkSpace.new(@workspace.binding, _main[0])
if !(class<<main;ancestors;end).include?(ExtendCommandBundle)
- main.extend ExtendCommandBundle
+ main.extend ExtendCommandBundle
end
end
@@ -57,8 +56,8 @@ module IRB # :nodoc:
# Also, see #push_workspace.
def pop_workspace
if workspaces.empty?
- print "workspace stack empty\n"
- return
+ print "workspace stack empty\n"
+ return
end
@workspace = workspaces.pop
end
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 6f15e6403a..487c0bbeff 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/extend-command.rb - irb extend command
# $Release Version: 0.9.6$
@@ -47,57 +46,71 @@ module IRB # :nodoc:
@EXTEND_COMMANDS = [
[:irb_current_working_workspace, :CurrentWorkingWorkspace, "irb/cmd/chws",
- [:irb_print_working_workspace, OVERRIDE_ALL],
- [:irb_cwws, OVERRIDE_ALL],
- [:irb_pwws, OVERRIDE_ALL],
- [:cwws, NO_OVERRIDE],
- [:pwws, NO_OVERRIDE],
- [:irb_current_working_binding, OVERRIDE_ALL],
- [:irb_print_working_binding, OVERRIDE_ALL],
- [:irb_cwb, OVERRIDE_ALL],
- [:irb_pwb, OVERRIDE_ALL],
- ],
- [:irb_change_workspace, :ChangeWorkspace, "irb/cmd/chws",
- [:irb_chws, OVERRIDE_ALL],
- [:irb_cws, OVERRIDE_ALL],
- [:chws, NO_OVERRIDE],
- [:cws, NO_OVERRIDE],
- [:irb_change_binding, OVERRIDE_ALL],
- [:irb_cb, OVERRIDE_ALL],
- [:cb, NO_OVERRIDE]],
+ [:irb_print_working_workspace, OVERRIDE_ALL],
+ [:irb_cwws, OVERRIDE_ALL],
+ [:irb_pwws, OVERRIDE_ALL],
+# [:irb_cww, OVERRIDE_ALL],
+# [:irb_pww, OVERRIDE_ALL],
+ [:cwws, NO_OVERRIDE],
+ [:pwws, NO_OVERRIDE],
+# [:cww, NO_OVERRIDE],
+# [:pww, NO_OVERRIDE],
+ [:irb_current_working_binding, OVERRIDE_ALL],
+ [:irb_print_working_binding, OVERRIDE_ALL],
+ [:irb_cwb, OVERRIDE_ALL],
+ [:irb_pwb, OVERRIDE_ALL],
+# [:cwb, NO_OVERRIDE],
+# [:pwb, NO_OVERRIDE]
+ ],
+ [:irb_change_workspace, :ChangeWorkspace, "irb/cmd/chws",
+ [:irb_chws, OVERRIDE_ALL],
+# [:irb_chw, OVERRIDE_ALL],
+ [:irb_cws, OVERRIDE_ALL],
+# [:irb_cw, OVERRIDE_ALL],
+ [:chws, NO_OVERRIDE],
+# [:chw, NO_OVERRIDE],
+ [:cws, NO_OVERRIDE],
+# [:cw, NO_OVERRIDE],
+ [:irb_change_binding, OVERRIDE_ALL],
+ [:irb_cb, OVERRIDE_ALL],
+ [:cb, NO_OVERRIDE]],
- [:irb_workspaces, :Workspaces, "irb/cmd/pushws",
- [:workspaces, NO_OVERRIDE],
- [:irb_bindings, OVERRIDE_ALL],
- [:bindings, NO_OVERRIDE]],
- [:irb_push_workspace, :PushWorkspace, "irb/cmd/pushws",
- [:irb_pushws, OVERRIDE_ALL],
- [:pushws, NO_OVERRIDE],
- [:irb_push_binding, OVERRIDE_ALL],
- [:irb_pushb, OVERRIDE_ALL],
- [:pushb, NO_OVERRIDE]],
- [:irb_pop_workspace, :PopWorkspace, "irb/cmd/pushws",
- [:irb_popws, OVERRIDE_ALL],
- [:popws, NO_OVERRIDE],
- [:irb_pop_binding, OVERRIDE_ALL],
- [:irb_popb, OVERRIDE_ALL],
- [:popb, NO_OVERRIDE]],
+ [:irb_workspaces, :Workspaces, "irb/cmd/pushws",
+ [:workspaces, NO_OVERRIDE],
+ [:irb_bindings, OVERRIDE_ALL],
+ [:bindings, NO_OVERRIDE]],
+ [:irb_push_workspace, :PushWorkspace, "irb/cmd/pushws",
+ [:irb_pushws, OVERRIDE_ALL],
+# [:irb_pushw, OVERRIDE_ALL],
+ [:pushws, NO_OVERRIDE],
+# [:pushw, NO_OVERRIDE],
+ [:irb_push_binding, OVERRIDE_ALL],
+ [:irb_pushb, OVERRIDE_ALL],
+ [:pushb, NO_OVERRIDE]],
+ [:irb_pop_workspace, :PopWorkspace, "irb/cmd/pushws",
+ [:irb_popws, OVERRIDE_ALL],
+# [:irb_popw, OVERRIDE_ALL],
+ [:popws, NO_OVERRIDE],
+# [:popw, NO_OVERRIDE],
+ [:irb_pop_binding, OVERRIDE_ALL],
+ [:irb_popb, OVERRIDE_ALL],
+ [:popb, NO_OVERRIDE]],
- [:irb_load, :Load, "irb/cmd/load"],
- [:irb_require, :Require, "irb/cmd/load"],
- [:irb_source, :Source, "irb/cmd/load",
- [:source, NO_OVERRIDE]],
+ [:irb_load, :Load, "irb/cmd/load"],
+ [:irb_require, :Require, "irb/cmd/load"],
+ [:irb_source, :Source, "irb/cmd/load",
+ [:source, NO_OVERRIDE]],
- [:irb, :IrbCommand, "irb/cmd/subirb"],
- [:irb_jobs, :Jobs, "irb/cmd/subirb",
- [:jobs, NO_OVERRIDE]],
- [:irb_fg, :Foreground, "irb/cmd/subirb",
- [:fg, NO_OVERRIDE]],
- [:irb_kill, :Kill, "irb/cmd/subirb",
- [:kill, OVERRIDE_PRIVATE_ONLY]],
+ [:irb, :IrbCommand, "irb/cmd/subirb"],
+ [:irb_jobs, :Jobs, "irb/cmd/subirb",
+ [:jobs, NO_OVERRIDE]],
+ [:irb_fg, :Foreground, "irb/cmd/subirb",
+ [:fg, NO_OVERRIDE]],
+ [:irb_kill, :Kill, "irb/cmd/subirb",
+ [:kill, OVERRIDE_PRIVATE_ONLY]],
- [:irb_help, :Help, "irb/cmd/help",
- [:help, NO_OVERRIDE]],
+ [:irb_help, :Help, "irb/cmd/help",
+ [:help, NO_OVERRIDE]],
]
@@ -118,7 +131,7 @@ module IRB # :nodoc:
# +irb_help+:: IRB@Command+line+options
def self.install_extend_commands
for args in @EXTEND_COMMANDS
- def_extend_command(*args)
+ def_extend_command(*args)
end
end
@@ -131,39 +144,39 @@ module IRB # :nodoc:
def self.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
case cmd_class
when Symbol
- cmd_class = cmd_class.id2name
+ cmd_class = cmd_class.id2name
when String
when Class
- cmd_class = cmd_class.name
+ cmd_class = cmd_class.name
end
if load_file
- line = __LINE__; eval %[
- def #{cmd_name}(*opts, &b)
- require "#{load_file}"
- arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
- args = (1..(arity < 0 ? ~arity : arity)).map {|i| "arg" + i.to_s }
- args << "*opts" if arity < 0
- args << "&block"
- args = args.join(", ")
- line = __LINE__; eval %[
- def #{cmd_name}(\#{args})
- ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
- end
- ], nil, __FILE__, line
- send :#{cmd_name}, *opts, &b
- end
- ], nil, __FILE__, line
+ line = __LINE__; eval %[
+ def #{cmd_name}(*opts, &b)
+ require "#{load_file}"
+ arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
+ args = (1..(arity < 0 ? ~arity : arity)).map {|i| "arg" + i.to_s }
+ args << "*opts" if arity < 0
+ args << "&block"
+ args = args.join(", ")
+ line = __LINE__; eval %[
+ def #{cmd_name}(\#{args})
+ ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
+ end
+ ], nil, __FILE__, line
+ send :#{cmd_name}, *opts, &b
+ end
+ ], nil, __FILE__, line
else
- line = __LINE__; eval %[
- def #{cmd_name}(*opts, &b)
- ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
- end
- ], nil, __FILE__, line
+ line = __LINE__; eval %[
+ def #{cmd_name}(*opts, &b)
+ ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
+ end
+ ], nil, __FILE__, line
end
for ali, flag in aliases
- @ALIASES.push [ali, cmd_name, flag]
+ @ALIASES.push [ali, cmd_name, flag]
end
end
@@ -174,18 +187,18 @@ module IRB # :nodoc:
from = from.id2name unless from.kind_of?(String)
if override == OVERRIDE_ALL or
- (override == OVERRIDE_PRIVATE_ONLY) && !respond_to?(to) or
- (override == NO_OVERRIDE) && !respond_to?(to, true)
- target = self
- (class << self; self; end).instance_eval{
- if target.respond_to?(to, true) &&
- !target.respond_to?(EXCB.irb_original_method_name(to), true)
- alias_method(EXCB.irb_original_method_name(to), to)
- end
- alias_method to, from
- }
+ (override == OVERRIDE_PRIVATE_ONLY) && !respond_to?(to) or
+ (override == NO_OVERRIDE) && !respond_to?(to, true)
+ target = self
+ (class << self; self; end).instance_eval{
+ if target.respond_to?(to, true) &&
+ !target.respond_to?(EXCB.irb_original_method_name(to), true)
+ alias_method(EXCB.irb_original_method_name(to), to)
+ end
+ alias_method to, from
+ }
else
- print "irb: warn: can't alias #{to} from #{from}.\n"
+ print "irb: warn: can't alias #{to} from #{from}.\n"
end
end
@@ -197,10 +210,10 @@ module IRB # :nodoc:
# using #install_alias_method.
def self.extend_object(obj)
unless (class << obj; ancestors; end).include?(EXCB)
- super
- for ali, com, flg in @ALIASES
- obj.install_alias_method(ali, com, flg)
- end
+ super
+ for ali, com, flg in @ALIASES
+ obj.install_alias_method(ali, com, flg)
+ end
end
end
@@ -228,7 +241,7 @@ module IRB # :nodoc:
# Context#save_history=:: +irb/ext/save-history.rb+
def self.install_extend_commands
for args in @EXTEND_COMMANDS
- def_extend_command(*args)
+ def_extend_command(*args)
end
end
@@ -239,13 +252,13 @@ module IRB # :nodoc:
def self.def_extend_command(cmd_name, load_file, *aliases)
line = __LINE__; Context.module_eval %[
def #{cmd_name}(*opts, &b)
- Context.module_eval {remove_method(:#{cmd_name})}
- require "#{load_file}"
- send :#{cmd_name}, *opts, &b
- end
- for ali in aliases
- alias_method ali, cmd_name
- end
+ Context.module_eval {remove_method(:#{cmd_name})}
+ require "#{load_file}"
+ send :#{cmd_name}, *opts, &b
+ end
+ for ali in aliases
+ alias_method ali, cmd_name
+ end
], __FILE__, line
end
@@ -264,9 +277,9 @@ module IRB # :nodoc:
module_eval %[
alias_method alias_name, base_method
def #{base_method}(*opts)
- send :#{extend_method}, *opts
- send :#{alias_name}, *opts
- end
+ send :#{extend_method}, *opts
+ send :#{alias_name}, *opts
+ end
]
end
@@ -280,9 +293,9 @@ module IRB # :nodoc:
module_eval %[
alias_method alias_name, base_method
def #{base_method}(*opts)
- send :#{alias_name}, *opts
- send :#{extend_method}, *opts
- end
+ send :#{alias_name}, *opts
+ send :#{extend_method}, *opts
+ end
]
end
@@ -300,7 +313,7 @@ module IRB # :nodoc:
return base_name if same_methods.empty?
no = same_methods.size
while !same_methods.include?(alias_name = base_name + no)
- no += 1
+ no += 1
end
alias_name
end
diff --git a/lib/irb/frame.rb b/lib/irb/frame.rb
index 6073809249..bcfa3a3140 100644
--- a/lib/irb/frame.rb
+++ b/lib/irb/frame.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# frame.rb -
# $Release Version: 0.9$
@@ -32,9 +31,9 @@ module IRB
def trace_func(event, file, line, id, binding)
case event
when 'call', 'class'
- @frames.push binding
+ @frames.push binding
when 'return', 'end'
- @frames.pop
+ @frames.pop
end
end
diff --git a/lib/irb/help.rb b/lib/irb/help.rb
index a4264ab4ab..9fd734038f 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/help.rb - print usage module
# $Release Version: 0.9.6$
@@ -20,16 +19,16 @@ module IRB
space_line = false
IRB::MagicFile.open(path){|f|
f.each_line do |l|
- if /^\s*$/ =~ l
- lc.puts l unless space_line
- space_line = true
- next
- end
- space_line = false
+ if /^\s*$/ =~ l
+ lc.puts l unless space_line
+ space_line = true
+ next
+ end
+ space_line = false
- l.sub!(/#.*$/, "")
- next if /^\s*$/ =~ l
- lc.puts l
+ l.sub!(/#.*$/, "")
+ next if /^\s*$/ =~ l
+ lc.puts l
end
}
end
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 1184db15ea..826bcaf3ac 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/init.rb - irb initialize module
# $Release Version: 0.9.6$
@@ -60,47 +59,48 @@ module IRB # :nodoc:
@CONF[:PROMPT] = {
:NULL => {
- :PROMPT_I => nil,
- :PROMPT_N => nil,
- :PROMPT_S => nil,
- :PROMPT_C => nil,
- :RETURN => "%s\n"
+ :PROMPT_I => nil,
+ :PROMPT_N => nil,
+ :PROMPT_S => nil,
+ :PROMPT_C => nil,
+ :RETURN => "%s\n"
},
:DEFAULT => {
- :PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_N => "%N(%m):%03n:%i> ",
- :PROMPT_S => "%N(%m):%03n:%i%l ",
- :PROMPT_C => "%N(%m):%03n:%i* ",
- :RETURN => "=> %s\n"
+ :PROMPT_I => "%N(%m):%03n:%i> ",
+ :PROMPT_N => "%N(%m):%03n:%i> ",
+ :PROMPT_S => "%N(%m):%03n:%i%l ",
+ :PROMPT_C => "%N(%m):%03n:%i* ",
+ :RETURN => "=> %s\n"
},
:CLASSIC => {
- :PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_N => "%N(%m):%03n:%i> ",
- :PROMPT_S => "%N(%m):%03n:%i%l ",
- :PROMPT_C => "%N(%m):%03n:%i* ",
- :RETURN => "%s\n"
+ :PROMPT_I => "%N(%m):%03n:%i> ",
+ :PROMPT_N => "%N(%m):%03n:%i> ",
+ :PROMPT_S => "%N(%m):%03n:%i%l ",
+ :PROMPT_C => "%N(%m):%03n:%i* ",
+ :RETURN => "%s\n"
},
:SIMPLE => {
- :PROMPT_I => ">> ",
- :PROMPT_N => ">> ",
- :PROMPT_S => nil,
- :PROMPT_C => "?> ",
- :RETURN => "=> %s\n"
+ :PROMPT_I => ">> ",
+ :PROMPT_N => ">> ",
+ :PROMPT_S => nil,
+ :PROMPT_C => "?> ",
+ :RETURN => "=> %s\n"
},
:INF_RUBY => {
- :PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_N => nil,
- :PROMPT_S => nil,
- :PROMPT_C => nil,
- :RETURN => "%s\n",
- :AUTO_INDENT => true
+ :PROMPT_I => "%N(%m):%03n:%i> ",
+# :PROMPT_N => "%N(%m):%03n:%i> ",
+ :PROMPT_N => nil,
+ :PROMPT_S => nil,
+ :PROMPT_C => nil,
+ :RETURN => "%s\n",
+ :AUTO_INDENT => true
},
:XMP => {
- :PROMPT_I => nil,
- :PROMPT_N => nil,
- :PROMPT_S => nil,
- :PROMPT_C => nil,
- :RETURN => " ==>%s\n"
+ :PROMPT_I => nil,
+ :PROMPT_N => nil,
+ :PROMPT_S => nil,
+ :PROMPT_C => nil,
+ :RETURN => " ==>%s\n"
}
}
@@ -110,6 +110,7 @@ module IRB # :nodoc:
@CONF[:CONTEXT_MODE] = 3 # use binding in function on TOPLEVEL_BINDING
@CONF[:SINGLE_IRB] = false
+# @CONF[:LC_MESSAGES] = "en"
@CONF[:LC_MESSAGES] = Locale.new
@CONF[:AT_EXIT] = []
@@ -121,104 +122,108 @@ module IRB # :nodoc:
@CONF[:LC_MESSAGES].load("irb/error.rb")
end
+ FEATURE_IOPT_CHANGE_VERSION = "1.9.0"
+
# option analyzing
def IRB.parse_opts
load_path = []
while opt = ARGV.shift
case opt
when "-f"
- @CONF[:RC] = false
+ @CONF[:RC] = false
when "-m"
- @CONF[:MATH_MODE] = true
+ @CONF[:MATH_MODE] = true
when "-d"
- $DEBUG = true
- $VERBOSE = true
+ $DEBUG = true
+ $VERBOSE = true
when "-w"
- $VERBOSE = true
+ $VERBOSE = true
when /^-W(.+)?/
- opt = $1 || ARGV.shift
- case opt
- when "0"
- $VERBOSE = nil
- when "1"
- $VERBOSE = false
- else
- $VERBOSE = true
- end
+ opt = $1 || ARGV.shift
+ case opt
+ when "0"
+ $VERBOSE = nil
+ when "1"
+ $VERBOSE = false
+ else
+ $VERBOSE = true
+ end
when /^-r(.+)?/
- opt = $1 || ARGV.shift
- @CONF[:LOAD_MODULES].push opt if opt
+ opt = $1 || ARGV.shift
+ @CONF[:LOAD_MODULES].push opt if opt
when /^-I(.+)?/
opt = $1 || ARGV.shift
- load_path.concat(opt.split(File::PATH_SEPARATOR)) if opt
+ load_path.concat(opt.split(File::PATH_SEPARATOR)) if opt
when '-U'
- set_encoding("UTF-8", "UTF-8")
+ set_encoding("UTF-8", "UTF-8")
when /^-E(.+)?/, /^--encoding(?:=(.+))?/
- opt = $1 || ARGV.shift
- set_encoding(*opt.split(':', 2))
+ opt = $1 || ARGV.shift
+ set_encoding(*opt.split(':', 2))
when "--inspect"
- if /^-/ !~ ARGV.first
- @CONF[:INSPECT_MODE] = ARGV.shift
- else
- @CONF[:INSPECT_MODE] = true
- end
+ if /^-/ !~ ARGV.first
+ @CONF[:INSPECT_MODE] = ARGV.shift
+ else
+ @CONF[:INSPECT_MODE] = true
+ end
when "--noinspect"
- @CONF[:INSPECT_MODE] = false
+ @CONF[:INSPECT_MODE] = false
when "--readline"
- @CONF[:USE_READLINE] = true
+ @CONF[:USE_READLINE] = true
when "--noreadline"
- @CONF[:USE_READLINE] = false
+ @CONF[:USE_READLINE] = false
when "--echo"
- @CONF[:ECHO] = true
+ @CONF[:ECHO] = true
when "--noecho"
- @CONF[:ECHO] = false
+ @CONF[:ECHO] = false
when "--verbose"
- @CONF[:VERBOSE] = true
+ @CONF[:VERBOSE] = true
when "--noverbose"
- @CONF[:VERBOSE] = false
+ @CONF[:VERBOSE] = false
when /^--prompt-mode(?:=(.+))?/, /^--prompt(?:=(.+))?/
- opt = $1 || ARGV.shift
- prompt_mode = opt.upcase.tr("-", "_").intern
- @CONF[:PROMPT_MODE] = prompt_mode
+ opt = $1 || ARGV.shift
+ prompt_mode = opt.upcase.tr("-", "_").intern
+ @CONF[:PROMPT_MODE] = prompt_mode
when "--noprompt"
- @CONF[:PROMPT_MODE] = :NULL
+ @CONF[:PROMPT_MODE] = :NULL
when "--inf-ruby-mode"
- @CONF[:PROMPT_MODE] = :INF_RUBY
+ @CONF[:PROMPT_MODE] = :INF_RUBY
when "--sample-book-mode", "--simple-prompt"
- @CONF[:PROMPT_MODE] = :SIMPLE
+ @CONF[:PROMPT_MODE] = :SIMPLE
when "--tracer"
- @CONF[:USE_TRACER] = true
+ @CONF[:USE_TRACER] = true
when /^--back-trace-limit(?:=(.+))?/
- @CONF[:BACK_TRACE_LIMIT] = ($1 || ARGV.shift).to_i
+ @CONF[:BACK_TRACE_LIMIT] = ($1 || ARGV.shift).to_i
when /^--context-mode(?:=(.+))?/
- @CONF[:CONTEXT_MODE] = ($1 || ARGV.shift).to_i
+ @CONF[:CONTEXT_MODE] = ($1 || ARGV.shift).to_i
when "--single-irb"
- @CONF[:SINGLE_IRB] = true
+ @CONF[:SINGLE_IRB] = true
when /^--irb_debug(?:=(.+))?/
- @CONF[:DEBUG_LEVEL] = ($1 || ARGV.shift).to_i
+ @CONF[:DEBUG_LEVEL] = ($1 || ARGV.shift).to_i
when "-v", "--version"
- print IRB.version, "\n"
- exit 0
+ print IRB.version, "\n"
+ exit 0
when "-h", "--help"
- require "irb/help"
- IRB.print_usage
- exit 0
+ require "irb/help"
+ IRB.print_usage
+ exit 0
when "--"
- if opt = ARGV.shift
- @CONF[:SCRIPT] = opt
- $0 = opt
- end
+ if opt = ARGV.shift
+ @CONF[:SCRIPT] = opt
+ $0 = opt
+ end
break
when /^-/
- IRB.fail UnrecognizedSwitch, opt
+ IRB.fail UnrecognizedSwitch, opt
else
- @CONF[:SCRIPT] = opt
- $0 = opt
- break
+ @CONF[:SCRIPT] = opt
+ $0 = opt
+ break
end
end
- load_path.collect! do |path|
- /\A\.\// =~ path ? path : File.expand_path(path)
+ if RUBY_VERSION >= FEATURE_IOPT_CHANGE_VERSION
+ load_path.collect! do |path|
+ /\A\.\// =~ path ? path : File.expand_path(path)
+ end
end
$LOAD_PATH.unshift(*load_path)
@@ -228,14 +233,14 @@ module IRB # :nodoc:
def IRB.run_config
if @CONF[:RC]
begin
- load rc_file
+ load rc_file
rescue LoadError, Errno::ENOENT
rescue # StandardError, ScriptError
- print "load error: #{rc_file}\n"
- print $!.class, ": ", $!, "\n"
- for err in $@[0, $@.size - 2]
- print "\t", err, "\n"
- end
+ print "load error: #{rc_file}\n"
+ print $!.class, ": ", $!, "\n"
+ for err in $@[0, $@.size - 2]
+ print "\t", err, "\n"
+ end
end
end
end
@@ -244,11 +249,11 @@ module IRB # :nodoc:
def IRB.rc_file(ext = IRBRC_EXT)
if !@CONF[:RC_NAME_GENERATOR]
rc_file_generators do |rcgen|
- @CONF[:RC_NAME_GENERATOR] ||= rcgen
- if File.exist?(rcgen.call(IRBRC_EXT))
- @CONF[:RC_NAME_GENERATOR] = rcgen
- break
- end
+ @CONF[:RC_NAME_GENERATOR] ||= rcgen
+ if File.exist?(rcgen.call(IRBRC_EXT))
+ @CONF[:RC_NAME_GENERATOR] = rcgen
+ break
+ end
end
end
case rc_file = @CONF[:RC_NAME_GENERATOR].call(ext)
@@ -278,9 +283,9 @@ module IRB # :nodoc:
def IRB.load_modules
for m in @CONF[:LOAD_MODULES]
begin
- require m
+ require m
rescue LoadError => err
- warn err.backtrace[0] << ":#{err.class}: #{err}"
+ warn err.backtrace[0] << ":#{err.class}: #{err}"
end
end
end
@@ -295,7 +300,7 @@ module IRB # :nodoc:
Encoding.default_internal = intern unless intern.nil? || intern.empty?
@CONF[:ENCODINGS] = IRB::DefaultEncodings.new(extern, intern)
[$stdin, $stdout, $stderr].each do |io|
- io.set_encoding(extern, intern)
+ io.set_encoding(extern, intern)
end
@CONF[:LC_MESSAGES].instance_variable_set(:@encoding, extern)
ensure
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index f7b1aac3bf..55363fe0c4 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/input-method.rb - input methods used irb
# $Release Version: 0.9.6$
@@ -15,6 +14,7 @@ require 'irb/magic-file'
module IRB
STDIN_FILE_NAME = "(line)" # :nodoc:
class InputMethod
+ @RCS_ID='-$Id$-'
# Creates a new input method object
def initialize(file = STDIN_FILE_NAME)
@@ -117,6 +117,7 @@ module IRB
def gets
print @prompt
l = @io.gets
+# print @prompt, l
l
end
@@ -132,14 +133,14 @@ module IRB
include Readline
# Creates a new input method object using Readline
def initialize
- super
+ super
- @line_no = 0
- @line = []
- @eof = false
+ @line_no = 0
+ @line = []
+ @eof = false
- @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
- @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
+ @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
+ @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-")
end
# Reads the next line from this input method.
@@ -148,13 +149,13 @@ module IRB
def gets
Readline.input = @stdin
Readline.output = @stdout
- if l = readline(@prompt, false)
- HISTORY.push(l) if !l.empty?
- @line[@line_no += 1] = l + "\n"
- else
- @eof = true
- l
- end
+ if l = readline(@prompt, false)
+ HISTORY.push(l) if !l.empty?
+ @line[@line_no += 1] = l + "\n"
+ else
+ @eof = true
+ l
+ end
end
# Whether the end of this input method has been reached, returns +true+
@@ -162,7 +163,7 @@ module IRB
#
# See IO#eof? for more information.
def eof?
- @eof
+ @eof
end
# Whether this input method is still readable when there is no more data to
@@ -170,7 +171,7 @@ module IRB
#
# See IO#eof for more information.
def readable_after_eof?
- true
+ true
end
# Returns the current line number for #io.
@@ -179,12 +180,12 @@ module IRB
#
# See IO#lineno for more information.
def line(line_no)
- @line[line_no]
+ @line[line_no]
end
# The external encoding for standard input.
def encoding
- @stdin.external_encoding
+ @stdin.external_encoding
end
end
rescue LoadError
diff --git a/lib/irb/inspector.rb b/lib/irb/inspector.rb
index f6f76712b8..eaff44fc0b 100644
--- a/lib/irb/inspector.rb
+++ b/lib/irb/inspector.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/inspector.rb - inspect methods
# $Release Version: 0.9.6$
@@ -62,6 +61,20 @@ module IRB # :nodoc:
# Inspector.def_inspector(key, inspector)
# Inspector.def_inspector([key1,...], inspector)
def self.def_inspector(key, arg=nil, &block)
+ # if !block_given?
+ # case arg
+ # when nil, Proc
+ # inspector = IRB::Inspector(init_p)
+ # when Inspector
+ # inspector = init_p
+ # else
+ # IRB.Raise IllegalParameter, init_p
+ # end
+ # init_p = nil
+ # else
+ # inspector = IRB::Inspector(block, init_p)
+ # end
+
if block_given?
inspector = IRB::Inspector(block, arg)
else
@@ -92,7 +105,7 @@ module IRB # :nodoc:
end
# Proc to call when the inspector is activated, good for requiring
- # dependent libraries.
+ # dependant libraries.
def init
@init.call if @init
end
diff --git a/lib/irb/lc/error.rb b/lib/irb/lc/error.rb
index 6623f82d84..c0c6c30d79 100644
--- a/lib/irb/lc/error.rb
+++ b/lib/irb/lc/error.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/lc/error.rb -
# $Release Version: 0.9.6$
diff --git a/lib/irb/lc/ja/encoding_aliases.rb b/lib/irb/lc/ja/encoding_aliases.rb
index c534bf0fef..5bef32e20e 100644
--- a/lib/irb/lc/ja/encoding_aliases.rb
+++ b/lib/irb/lc/ja/encoding_aliases.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# :stopdoc:
module IRB
class Locale
diff --git a/lib/irb/lc/ja/error.rb b/lib/irb/lc/ja/error.rb
index 919363154c..4f09d781cb 100644
--- a/lib/irb/lc/ja/error.rb
+++ b/lib/irb/lc/ja/error.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
# irb/lc/ja/error.rb -
# $Release Version: 0.9.6$
# $Revision$
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index df540c8cbb..accce9e13f 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/locale.rb - internationalization module
# $Release Version: 0.9.6$
@@ -11,6 +10,7 @@
#
module IRB # :nodoc:
class Locale
+ @RCS_ID='-$Id$-'
LOCALE_NAME_RE = %r[
(?<language>[[:alpha:]]{2,3})
@@ -26,27 +26,27 @@ module IRB # :nodoc:
@lang = @territory = @encoding_name = @modifier = nil
@locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
if m = LOCALE_NAME_RE.match(@locale)
- @lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier]
-
- if @encoding_name
- begin load 'irb/encoding_aliases.rb'; rescue LoadError; end
- if @encoding = @@legacy_encoding_alias_map[@encoding_name]
- warn "%s is obsolete. use %s" % ["#{@lang}_#{@territory}.#{@encoding_name}", "#{@lang}_#{@territory}.#{@encoding.name}"]
- end
- @encoding = Encoding.find(@encoding_name) rescue nil
- end
+ @lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier]
+
+ if @encoding_name
+ begin load 'irb/encoding_aliases.rb'; rescue LoadError; end
+ if @encoding = @@legacy_encoding_alias_map[@encoding_name]
+ warn "%s is obsolete. use %s" % ["#{@lang}_#{@territory}.#{@encoding_name}", "#{@lang}_#{@territory}.#{@encoding.name}"]
+ end
+ @encoding = Encoding.find(@encoding_name) rescue nil
+ end
end
@encoding ||= (Encoding.find('locale') rescue Encoding::ASCII_8BIT)
end
- attr_reader :lang, :territory, :encoding, :modifier
+ attr_reader :lang, :territory, :encoding, :modifieer
def String(mes)
mes = super(mes)
if @encoding
- mes.encode(@encoding, undef: :replace)
+ mes.encode(@encoding, undef: :replace)
else
- mes
+ mes
end
end
@@ -83,22 +83,22 @@ module IRB # :nodoc:
case file
when /\.rb$/
- begin
- load(file, priv)
- $".push file
- return true
- rescue LoadError
- end
+ begin
+ load(file, priv)
+ $".push file
+ return true
+ rescue LoadError
+ end
when /\.(so|o|sl)$/
- return super
+ return super
end
begin
- load(f = file + ".rb")
- $".push f #"
- return true
+ load(f = file + ".rb")
+ $".push f #"
+ return true
rescue LoadError
- return ruby_require(file)
+ return ruby_require(file)
end
end
@@ -129,9 +129,9 @@ module IRB # :nodoc:
def real_load(path, priv)
src = MagicFile.open(path){|f| f.read}
if priv
- eval("self", TOPLEVEL_BINDING).extend(Module.new {eval(src, nil, path)})
+ eval("self", TOPLEVEL_BINDING).extend(Module.new {eval(src, nil, path)})
else
- eval(src, TOPLEVEL_BINDING, path)
+ eval(src, TOPLEVEL_BINDING, path)
end
end
@@ -161,20 +161,20 @@ module IRB # :nodoc:
def each_sublocale
if @lang
- if @territory
- if @encoding_name
- yield "#{@lang}_#{@territory}.#{@encoding_name}@#{@modifier}" if @modifier
- yield "#{@lang}_#{@territory}.#{@encoding_name}"
- end
- yield "#{@lang}_#{@territory}@#{@modifier}" if @modifier
- yield "#{@lang}_#{@territory}"
- end
+ if @territory
+ if @encoding_name
+ yield "#{@lang}_#{@territory}.#{@encoding_name}@#{@modifier}" if @modifier
+ yield "#{@lang}_#{@territory}.#{@encoding_name}"
+ end
+ yield "#{@lang}_#{@territory}@#{@modifier}" if @modifier
+ yield "#{@lang}_#{@territory}"
+ end
if @encoding_name
yield "#{@lang}.#{@encoding_name}@#{@modifier}" if @modifier
yield "#{@lang}.#{@encoding_name}"
end
- yield "#{@lang}@#{@modifier}" if @modifier
- yield "#{@lang}"
+ yield "#{@lang}@#{@modifier}" if @modifier
+ yield "#{@lang}"
end
yield nil
end
diff --git a/lib/irb/magic-file.rb b/lib/irb/magic-file.rb
index 2dee684657..339ed60b6b 100644
--- a/lib/irb/magic-file.rb
+++ b/lib/irb/magic-file.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module IRB
class << (MagicFile = Object.new)
# see parser_magic_comment in parse.y
diff --git a/lib/irb/notifier.rb b/lib/irb/notifier.rb
index 9d8de82e69..effb12c30d 100644
--- a/lib/irb/notifier.rb
+++ b/lib/irb/notifier.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# notifier.rb - output methods used by irb
# $Release Version: 0.9.6$
@@ -27,7 +26,7 @@ module IRB
#
# The optional +prefix+ will be appended to all objects being inspected
# during output, using the given +output_method+ as the output source. If
- # no +output_method+ is given, StdioOutputMethod will be used, and all
+ # no +output_method+ is given, StdioOuputMethod will be used, and all
# expressions will be sent directly to STDOUT without any additional
# formatting.
def def_notifier(prefix = "", output_method = StdioOutputMethod.new)
@@ -41,8 +40,8 @@ module IRB
class AbstractNotifier
# Creates a new Notifier object
def initialize(prefix, base_notifier)
- @prefix = prefix
- @base_notifier = base_notifier
+ @prefix = prefix
+ @base_notifier = base_notifier
end
# The +prefix+ for this Notifier, which is appended to all objects being
@@ -53,38 +52,38 @@ module IRB
#
# Defaults to +true+.
def notify?
- true
+ true
end
# See OutputMethod#print for more detail.
def print(*opts)
- @base_notifier.print prefix, *opts if notify?
+ @base_notifier.print prefix, *opts if notify?
end
# See OutputMethod#printn for more detail.
def printn(*opts)
- @base_notifier.printn prefix, *opts if notify?
+ @base_notifier.printn prefix, *opts if notify?
end
# See OutputMethod#printf for more detail.
def printf(format, *opts)
- @base_notifier.printf(prefix + format, *opts) if notify?
+ @base_notifier.printf(prefix + format, *opts) if notify?
end
# See OutputMethod#puts for more detail.
def puts(*objs)
- if notify?
- @base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s})
- end
+ if notify?
+ @base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s})
+ end
end
# Same as #ppx, except it uses the #prefix given during object
# initialization.
# See OutputMethod#ppx for more detail.
def pp(*objs)
- if notify?
- @base_notifier.ppx @prefix, *objs
- end
+ if notify?
+ @base_notifier.ppx @prefix, *objs
+ end
end
# Same as #pp, except it concatenates the given +prefix+ with the #prefix
@@ -92,14 +91,14 @@ module IRB
#
# See OutputMethod#ppx for more detail.
def ppx(prefix, *objs)
- if notify?
- @base_notifier.ppx @prefix+prefix, *objs
- end
+ if notify?
+ @base_notifier.ppx @prefix+prefix, *objs
+ end
end
# Execute the given block if notifications are enabled.
def exec_if
- yield(@base_notifier) if notify?
+ yield(@base_notifier) if notify?
end
end
@@ -117,10 +116,10 @@ module IRB
# Create a new composite notifier object with the given +prefix+, and
# +base_notifier+ to use for output.
def initialize(prefix, base_notifier)
- super
+ super
- @notifiers = [D_NOMSG]
- @level_notifier = D_NOMSG
+ @notifiers = [D_NOMSG]
+ @level_notifier = D_NOMSG
end
# List of notifiers in the group
@@ -133,9 +132,9 @@ module IRB
#
# This method returns the newly created instance.
def def_notifier(level, prefix = "")
- notifier = LeveledNotifier.new(self, level, prefix)
- @notifiers[level] = notifier
- notifier
+ notifier = LeveledNotifier.new(self, level, prefix)
+ @notifiers[level] = notifier
+ notifier
end
# Returns the leveled notifier for this object
@@ -157,16 +156,16 @@ module IRB
# found in the existing #notifiers Array, or an instance of
# AbstractNotifier
def level_notifier=(value)
- case value
- when AbstractNotifier
- @level_notifier = value
- when Integer
- l = @notifiers[value]
- Notifier.Raise ErrUndefinedNotifier, value unless l
- @level_notifier = l
- else
- Notifier.Raise ErrUnrecognizedLevel, value unless l
- end
+ case value
+ when AbstractNotifier
+ @level_notifier = value
+ when Integer
+ l = @notifiers[value]
+ Notifier.Raise ErrUndefinedNotifer, value unless l
+ @level_notifier = l
+ else
+ Notifier.Raise ErrUnrecognizedLevel, value unless l
+ end
end
alias level= level_notifier=
@@ -184,9 +183,9 @@ module IRB
# CompositeNotifier group to determine whether or not to output
# notifications.
def initialize(base, level, prefix)
- super(prefix, base)
+ super(prefix, base)
- @level = level
+ @level = level
end
# The current level of this notifier object
@@ -197,13 +196,13 @@ module IRB
#
# See the Comparable module for more information.
def <=>(other)
- @level <=> other.level
+ @level <=> other.level
end
# Whether to output messages to the output method, depending on the level
# of this notifier object.
def notify?
- @base_notifier.level >= self
+ @base_notifier.level >= self
end
end
@@ -215,15 +214,15 @@ module IRB
class NoMsgNotifier<LeveledNotifier
# Creates a new notifier that should not be used to output messages.
def initialize
- @base_notifier = nil
- @level = 0
- @prefix = ""
+ @base_notifier = nil
+ @level = 0
+ @prefix = ""
end
# Ensures notifications are ignored, see AbstractNotifier#notify? for
# more information.
def notify?
- false
+ false
end
end
diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb
index 7d64851698..aae9e2294d 100644
--- a/lib/irb/output-method.rb
+++ b/lib/irb/output-method.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# output-method.rb - output methods used by irb
# $Release Version: 0.9.6$
@@ -36,7 +35,7 @@ module IRB
# #parse_printf_format
def printf(format, *opts)
if /(%*)%I/ =~ format
- format, opts = parse_printf_format(format, opts)
+ format, opts = parse_printf_format(format, opts)
end
print sprintf(format, *opts)
end
@@ -59,8 +58,8 @@ module IRB
# character.
def puts(*objs)
for obj in objs
- print(*obj)
- print "\n"
+ print(*obj)
+ print "\n"
end
end
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index ca01662eee..4a700b3324 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/ruby-lex.rb - ruby lexcal analyzer
# $Release Version: 0.9.6$
@@ -16,13 +15,14 @@ require "irb/ruby-token"
# :stopdoc:
class RubyLex
+ @RCS_ID='-$Id$-'
extend Exception2MessageMapper
def_exception(:AlreadyDefinedToken, "Already defined token(%s)")
def_exception(:TkReading2TokenNoKey, "key nothing(key='%s')")
def_exception(:TkSymbol2TokenNoKey, "key nothing(key='%s')")
def_exception(:TkReading2TokenDuplicateError,
- "key duplicate(token_n='%s', key='%s')")
+ "key duplicate(token_n='%s', key='%s')")
def_exception(:SyntaxError, "%s")
def_exception(:TerminateLineInput, "Terminate Line Input")
@@ -101,6 +101,7 @@ class RubyLex
def getc
while @rests.empty?
+# return nil unless buf_input
@rests.push nil unless buf_input
end
c = @rests.shift
@@ -153,9 +154,9 @@ class RubyLex
if c == "\n"
@line_no -= 1
if idx = @readed.rindex("\n")
- @char_no = idx + 1
+ @char_no = idx + 1
else
- @char_no = @base_char_no + @readed.size
+ @char_no = @base_char_no + @readed.size
end
else
@char_no -= 1
@@ -230,43 +231,47 @@ class RubyLex
initialize_input
catch(:TERM_INPUT) do
loop do
- begin
- @continue = false
- prompt
- unless l = lex
- throw :TERM_INPUT if @line == ''
- else
- @line.concat l
- if @ltype or @continue or @indent > 0
- next
- end
- end
- if @line != "\n"
+ begin
+ @continue = false
+ prompt
+ unless l = lex
+ throw :TERM_INPUT if @line == ''
+ else
+ @line.concat l
+ if @ltype or @continue or @indent > 0
+ next
+ end
+ end
+ if @line != "\n"
@line.force_encoding(@io.encoding)
- yield @line, @exp_line_no
- end
- break unless l
- @line = ''
- @exp_line_no = @line_no
-
- @indent = 0
- @indent_stack = []
- prompt
- rescue TerminateLineInput
- initialize_input
- prompt
- get_readed
- end
+ yield @line, @exp_line_no
+ end
+ break unless l
+ @line = ''
+ @exp_line_no = @line_no
+
+ @indent = 0
+ @indent_stack = []
+ prompt
+ rescue TerminateLineInput
+ initialize_input
+ prompt
+ get_readed
+ end
end
end
end
def lex
until (((tk = token).kind_of?(TkNL) || tk.kind_of?(TkEND_OF_SCRIPT)) &&
- !@continue or
- tk.nil?)
+ !@continue or
+ tk.nil?)
+ #p tk
+ #p @lex_state
+ #p self
end
line = get_readed
+ # print self.inspect
if line == "" and tk.kind_of?(TkEND_OF_SCRIPT) || tk.nil?
nil
else
@@ -275,31 +280,34 @@ class RubyLex
end
def token
+ # require "tracer"
+ # Tracer.on
@prev_seek = @seek
@prev_line_no = @line_no
@prev_char_no = @char_no
begin
begin
- tk = @OP.match(self)
- @space_seen = tk.kind_of?(TkSPACE)
- @lex_state = EXPR_END if @post_symbeg && tk.kind_of?(TkOp)
- @post_symbeg = tk.kind_of?(TkSYMBEG)
+ tk = @OP.match(self)
+ @space_seen = tk.kind_of?(TkSPACE)
+ @lex_state = EXPR_END if @post_symbeg && tk.kind_of?(TkOp)
+ @post_symbeg = tk.kind_of?(TkSYMBEG)
rescue SyntaxError
- raise if @exception_on_syntax_error
- tk = TkError.new(@seek, @line_no, @char_no)
+ raise if @exception_on_syntax_error
+ tk = TkError.new(@seek, @line_no, @char_no)
end
end while @skip_space and tk.kind_of?(TkSPACE)
if @readed_auto_clean_up
get_readed
end
+ # Tracer.off
tk
end
ENINDENT_CLAUSE = [
"case", "class", "def", "do", "for", "if",
- "module", "unless", "until", "while", "begin"
+ "module", "unless", "until", "while", "begin" #, "when"
]
- DEINDENT_CLAUSE = ["end"
+ DEINDENT_CLAUSE = ["end" #, "when"
]
PERCENT_LTYPE = {
@@ -353,12 +361,12 @@ class RubyLex
end
@OP.def_rule("=begin",
- proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
+ proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
|op, io|
@ltype = "="
until getc == "\n"; end
until peek_equal?("=end") && peek(4) =~ /\s/
- until getc == "\n"; end
+ until getc == "\n"; end
end
gets
@ltype = nil
@@ -369,15 +377,15 @@ class RubyLex
print "\\n\n" if RubyLex.debug?
case @lex_state
when EXPR_BEG, EXPR_FNAME, EXPR_DOT
- @continue = true
+ @continue = true
else
- @continue = false
- @lex_state = EXPR_BEG
- until (@indent_stack.empty? ||
- [TkLPAREN, TkLBRACK, TkLBRACE,
- TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
- @indent_stack.pop
- end
+ @continue = false
+ @lex_state = EXPR_BEG
+ until (@indent_stack.empty? ||
+ [TkLPAREN, TkLBRACK, TkLBRACE,
+ TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
+ @indent_stack.pop
+ end
end
@here_header = false
@here_readed = []
@@ -385,17 +393,17 @@ class RubyLex
end
@OP.def_rules("*", "**",
- "=", "==", "===",
- "=~", "<=>",
- "<", "<=",
- ">", ">=", ">>",
- "!", "!=", "!~") do
+ "=", "==", "===",
+ "=~", "<=>",
+ "<", "<=",
+ ">", ">=", ">>",
+ "!", "!=", "!~") do
|op, io|
case @lex_state
when EXPR_FNAME, EXPR_DOT
- @lex_state = EXPR_ARG
+ @lex_state = EXPR_ARG
else
- @lex_state = EXPR_BEG
+ @lex_state = EXPR_BEG
end
Token(op)
end
@@ -404,20 +412,20 @@ class RubyLex
|op, io|
tk = nil
if @lex_state != EXPR_END && @lex_state != EXPR_CLASS &&
- (@lex_state != EXPR_ARG || @space_seen)
- c = peek(0)
- if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-" || c == "~")
- tk = identify_here_document
- end
+ (@lex_state != EXPR_ARG || @space_seen)
+ c = peek(0)
+ if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-")
+ tk = identify_here_document
+ end
end
unless tk
- tk = Token(op)
- case @lex_state
- when EXPR_FNAME, EXPR_DOT
- @lex_state = EXPR_ARG
- else
- @lex_state = EXPR_BEG
- end
+ tk = Token(op)
+ case @lex_state
+ when EXPR_FNAME, EXPR_DOT
+ @lex_state = EXPR_ARG
+ else
+ @lex_state = EXPR_BEG
+ end
end
tk
end
@@ -430,31 +438,31 @@ class RubyLex
@OP.def_rules("`") do
|op, io|
if @lex_state == EXPR_FNAME
- @lex_state = EXPR_END
- Token(op)
+ @lex_state = EXPR_END
+ Token(op)
else
- identify_string(op)
+ identify_string(op)
end
end
@OP.def_rules('?') do
|op, io|
if @lex_state == EXPR_END
- @lex_state = EXPR_BEG
- Token(TkQUESTION)
+ @lex_state = EXPR_BEG
+ Token(TkQUESTION)
else
- ch = getc
- if @lex_state == EXPR_ARG && ch =~ /\s/
- ungetc
- @lex_state = EXPR_BEG;
- Token(TkQUESTION)
- else
- if (ch == '\\')
- read_escape
- end
- @lex_state = EXPR_END
- Token(TkINTEGER)
- end
+ ch = getc
+ if @lex_state == EXPR_ARG && ch =~ /\s/
+ ungetc
+ @lex_state = EXPR_BEG;
+ Token(TkQUESTION)
+ else
+ if (ch == '\\')
+ read_escape
+ end
+ @lex_state = EXPR_END
+ Token(TkINTEGER)
+ end
end
end
@@ -465,7 +473,7 @@ class RubyLex
end
@OP.def_rules("+=", "-=", "*=", "**=",
- "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
+ "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
|op, io|
@lex_state = EXPR_BEG
op =~ /^(.*)=$/
@@ -487,18 +495,18 @@ class RubyLex
@OP.def_rules("+", "-") do
|op, io|
catch(:RET) do
- if @lex_state == EXPR_ARG
- if @space_seen and peek(0) =~ /[0-9]/
- throw :RET, identify_number
- else
- @lex_state = EXPR_BEG
- end
- elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/
- throw :RET, identify_number
- else
- @lex_state = EXPR_BEG
- end
- Token(op)
+ if @lex_state == EXPR_ARG
+ if @space_seen and peek(0) =~ /[0-9]/
+ throw :RET, identify_number
+ else
+ @lex_state = EXPR_BEG
+ end
+ elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/
+ throw :RET, identify_number
+ else
+ @lex_state = EXPR_BEG
+ end
+ Token(op)
end
end
@@ -506,12 +514,12 @@ class RubyLex
|op, io|
@lex_state = EXPR_BEG
if peek(0) =~ /[0-9]/
- ungetc
- identify_number
+ ungetc
+ identify_number
else
- # for "obj.if" etc.
- @lex_state = EXPR_DOT
- Token(TkDOT)
+ # for "obj.if" etc.
+ @lex_state = EXPR_DOT
+ Token(TkDOT)
end
end
@@ -536,38 +544,39 @@ class RubyLex
@OP.def_rule(":") do
|op, io|
if @lex_state == EXPR_END || peek(0) =~ /\s/
- @lex_state = EXPR_BEG
- Token(TkCOLON)
+ @lex_state = EXPR_BEG
+ Token(TkCOLON)
else
- @lex_state = EXPR_FNAME
- Token(TkSYMBEG)
+ @lex_state = EXPR_FNAME
+ Token(TkSYMBEG)
end
end
@OP.def_rule("::") do
|op, io|
+# p @lex_state.id2name, @space_seen
if @lex_state == EXPR_BEG or @lex_state == EXPR_ARG && @space_seen
- @lex_state = EXPR_BEG
- Token(TkCOLON3)
+ @lex_state = EXPR_BEG
+ Token(TkCOLON3)
else
- @lex_state = EXPR_DOT
- Token(TkCOLON2)
+ @lex_state = EXPR_DOT
+ Token(TkCOLON2)
end
end
@OP.def_rule("/") do
|op, io|
if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
- identify_string(op)
+ identify_string(op)
elsif peek(0) == '='
- getc
- @lex_state = EXPR_BEG
- Token(TkOPASGN, "/") #/)
+ getc
+ @lex_state = EXPR_BEG
+ Token(TkOPASGN, "/") #/)
elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
- identify_string(op)
+ identify_string(op)
else
- @lex_state = EXPR_BEG
- Token("/") #/)
+ @lex_state = EXPR_BEG
+ Token("/") #/)
end
end
@@ -577,6 +586,11 @@ class RubyLex
Token("^")
end
+ # @OP.def_rules("^=") do
+ # @lex_state = EXPR_BEG
+ # Token(OP_ASGN, :^)
+ # end
+
@OP.def_rules(",") do
|op, io|
@lex_state = EXPR_BEG
@@ -587,9 +601,9 @@ class RubyLex
|op, io|
@lex_state = EXPR_BEG
until (@indent_stack.empty? ||
- [TkLPAREN, TkLBRACK, TkLBRACE,
- TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
- @indent_stack.pop
+ [TkLPAREN, TkLBRACK, TkLBRACE,
+ TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
+ @indent_stack.pop
end
Token(op)
end
@@ -610,11 +624,11 @@ class RubyLex
|op, io|
@indent += 1
if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
- @lex_state = EXPR_BEG
- tk_c = TkfLPAREN
+ @lex_state = EXPR_BEG
+ tk_c = TkfLPAREN
else
- @lex_state = EXPR_BEG
- tk_c = TkLPAREN
+ @lex_state = EXPR_BEG
+ tk_c = TkLPAREN
end
@indent_stack.push tk_c
Token(tk_c)
@@ -636,16 +650,16 @@ class RubyLex
|op, io|
@indent += 1
if @lex_state == EXPR_FNAME
- tk_c = TkfLBRACK
+ tk_c = TkfLBRACK
else
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
- tk_c = TkLBRACK
- elsif @lex_state == EXPR_ARG && @space_seen
- tk_c = TkLBRACK
- else
- tk_c = TkfLBRACK
- end
- @lex_state = EXPR_BEG
+ if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ tk_c = TkLBRACK
+ elsif @lex_state == EXPR_ARG && @space_seen
+ tk_c = TkLBRACK
+ else
+ tk_c = TkfLBRACK
+ end
+ @lex_state = EXPR_BEG
end
@indent_stack.push tk_c
Token(tk_c)
@@ -655,9 +669,9 @@ class RubyLex
|op, io|
@indent += 1
if @lex_state != EXPR_END && @lex_state != EXPR_ARG
- tk_c = TkLBRACE
+ tk_c = TkLBRACE
else
- tk_c = TkfLBRACE
+ tk_c = TkfLBRACE
end
@lex_state = EXPR_BEG
@indent_stack.push tk_c
@@ -667,27 +681,27 @@ class RubyLex
@OP.def_rule('\\') do
|op, io|
if getc == "\n"
- @space_seen = true
- @continue = true
- Token(TkSPACE)
+ @space_seen = true
+ @continue = true
+ Token(TkSPACE)
else
- read_escape
- Token("\\")
+ read_escape
+ Token("\\")
end
end
@OP.def_rule('%') do
|op, io|
if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
- identify_quotation
+ identify_quotation
elsif peek(0) == '='
- getc
- Token(TkOPASGN, :%)
+ getc
+ Token(TkOPASGN, :%)
elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
- identify_quotation
+ identify_quotation
else
- @lex_state = EXPR_BEG
- Token("%") #))
+ @lex_state = EXPR_BEG
+ Token("%") #))
end
end
@@ -699,20 +713,30 @@ class RubyLex
@OP.def_rule('@') do
|op, io|
if peek(0) =~ /[\w@]/
- ungetc
- identify_identifier
+ ungetc
+ identify_identifier
else
- Token("@")
+ Token("@")
end
end
+ # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
+ # |op, io|
+ # @indent += 1
+ # @lex_state = EXPR_FNAME
+ # # @lex_state = EXPR_END
+ # # until @rests[0] == "\n" or @rests[0] == ";"
+ # # rests.shift
+ # # end
+ # end
+
@OP.def_rule("") do
|op, io|
printf "MATCH: start %s: %s\n", op, io.inspect if RubyLex.debug?
if peek(0) =~ /[0-9]/
- t = identify_number
+ t = identify_number
elsif peek(0) =~ /[^\x00-\/:-@\[-^`{-\x7F]/
- t = identify_identifier
+ t = identify_identifier
end
printf "MATCH: end %s: %s\n", op, io.inspect if RubyLex.debug?
t
@@ -750,7 +774,7 @@ class RubyLex
if peek(0) =~ /[$@]/
token.concat(c = getc)
if c == "@" and peek(0) == "@"
- token.concat getc
+ token.concat getc
end
end
@@ -783,60 +807,61 @@ class RubyLex
token_c, *trans = TkReading2Token[token]
if token_c
- # reserved word?
-
- if (@lex_state != EXPR_BEG &&
- @lex_state != EXPR_FNAME &&
- trans[1])
- # modifiers
- token_c = TkSymbol2Token[trans[1]]
- @lex_state = trans[0]
- else
- if @lex_state != EXPR_FNAME and peek(0) != ':'
- if ENINDENT_CLAUSE.include?(token)
- # check for ``class = val'' etc.
- valid = true
- case token
- when "class"
- valid = false unless peek_match?(/^\s*(<<|\w|::)/)
- when "def"
- valid = false if peek_match?(/^\s*(([+\-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
- when "do"
- valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&)/)
- when *ENINDENT_CLAUSE
- valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&|\|)/)
- else
- # no nothing
- end
- if valid
- if token == "do"
- if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last)
- @indent += 1
- @indent_stack.push token_c
- end
- else
- @indent += 1
- @indent_stack.push token_c
- end
- end
-
- elsif DEINDENT_CLAUSE.include?(token)
- @indent -= 1
- @indent_stack.pop
- end
- @lex_state = trans[0]
- else
- @lex_state = EXPR_END
- end
- end
- return Token(token_c, token)
+ # reserved word?
+
+ if (@lex_state != EXPR_BEG &&
+ @lex_state != EXPR_FNAME &&
+ trans[1])
+ # modifiers
+ token_c = TkSymbol2Token[trans[1]]
+ @lex_state = trans[0]
+ else
+ if @lex_state != EXPR_FNAME
+ if ENINDENT_CLAUSE.include?(token)
+ # check for ``class = val'' etc.
+ valid = true
+ case token
+ when "class"
+ valid = false unless peek_match?(/^\s*(<<|\w|::)/)
+ when "def"
+ valid = false if peek_match?(/^\s*(([+\-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
+ when "do"
+ valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&)/)
+ when *ENINDENT_CLAUSE
+ valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&|\|)/)
+ else
+ # no nothing
+ end
+ if valid
+ if token == "do"
+ if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last)
+ @indent += 1
+ @indent_stack.push token_c
+ end
+ else
+ @indent += 1
+ @indent_stack.push token_c
+ end
+# p @indent_stack
+ end
+
+ elsif DEINDENT_CLAUSE.include?(token)
+ @indent -= 1
+ @indent_stack.pop
+ end
+ @lex_state = trans[0]
+ else
+ @lex_state = EXPR_END
+ end
+ end
+ return Token(token_c, token)
end
end
if @lex_state == EXPR_FNAME
@lex_state = EXPR_END
if peek(0) == '='
- token.concat getc
+ token.concat getc
end
elsif @lex_state == EXPR_BEG || @lex_state == EXPR_DOT
@lex_state = EXPR_ARG
@@ -855,7 +880,8 @@ class RubyLex
def identify_here_document
ch = getc
- if ch == "-" || ch == "~"
+# if lt = PERCENT_LTYPE[ch]
+ if ch == "-"
ch = getc
indent = true
end
@@ -863,13 +889,13 @@ class RubyLex
lt = ch
quoted = ""
while (c = getc) && c != lt
- quoted.concat c
+ quoted.concat c
end
else
lt = '"'
quoted = ch.dup
while (c = getc) && c =~ /\w/
- quoted.concat c
+ quoted.concat c
end
ungetc
end
@@ -879,26 +905,32 @@ class RubyLex
while ch = getc
reserve.push ch
if ch == "\\"
- reserve.push ch = getc
+ reserve.push ch = getc
elsif ch == "\n"
- break
+ break
end
end
@here_header = false
+# while l = gets
+# l = l.sub(/(:?\r)?\n\z/, '')
+# if (indent ? l.strip : l) == quoted
+# break
+# end
+# end
line = ""
while ch = getc
if ch == "\n"
- if line == quoted
- break
- end
- line = ""
+ if line == quoted
+ break
+ end
+ line = ""
else
- line.concat ch unless indent && line == "" && /\s/ =~ ch
- if @ltype != "'" && ch == "#" && peek(0) == "{"
- identify_string_dvar
- end
+ line.concat ch unless indent && line == "" && /\s/ =~ ch
+ if @ltype != "'" && ch == "#" && peek(0) == "{"
+ identify_string_dvar
+ end
end
end
@@ -922,6 +954,11 @@ class RubyLex
else
RubyLex.fail SyntaxError, "unknown type of %string"
end
+# if ch !~ /\W/
+# ungetc
+# next
+# end
+ #@ltype = lt
@quoted = ch unless @quoted = PERCENT_PAREN[ch]
identify_string(lt, @quoted)
end
@@ -933,49 +970,49 @@ class RubyLex
getc
case peek(0)
when /[xX]/
- ch = getc
- match = /[0-9a-fA-F_]/
+ ch = getc
+ match = /[0-9a-fA-F_]/
when /[bB]/
- ch = getc
- match = /[01_]/
+ ch = getc
+ match = /[01_]/
when /[oO]/
- ch = getc
- match = /[0-7_]/
+ ch = getc
+ match = /[0-7_]/
when /[dD]/
- ch = getc
- match = /[0-9_]/
+ ch = getc
+ match = /[0-9_]/
when /[0-7]/
- match = /[0-7_]/
+ match = /[0-7_]/
when /[89]/
- RubyLex.fail SyntaxError, "Invalid octal digit"
+ RubyLex.fail SyntaxError, "Invalid octal digit"
else
- return Token(TkINTEGER)
+ return Token(TkINTEGER)
end
len0 = true
non_digit = false
while ch = getc
- if match =~ ch
- if ch == "_"
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{ch}' in number"
- else
- non_digit = ch
- end
- else
- non_digit = false
- len0 = false
- end
- else
- ungetc
- if len0
- RubyLex.fail SyntaxError, "numeric literal without digits"
- end
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
- break
- end
+ if match =~ ch
+ if ch == "_"
+ if non_digit
+ RubyLex.fail SyntaxError, "trailing `#{ch}' in number"
+ else
+ non_digit = ch
+ end
+ else
+ non_digit = false
+ len0 = false
+ end
+ else
+ ungetc
+ if len0
+ RubyLex.fail SyntaxError, "numeric literal without digits"
+ end
+ if non_digit
+ RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
+ end
+ break
+ end
end
return Token(TkINTEGER)
end
@@ -987,37 +1024,37 @@ class RubyLex
while ch = getc
case ch
when /[0-9]/
- non_digit = false
+ non_digit = false
when "_"
- non_digit = ch
+ non_digit = ch
when allow_point && "."
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
- type = TkFLOAT
- if peek(0) !~ /[0-9]/
- type = TkINTEGER
- ungetc
- break
- end
- allow_point = false
+ if non_digit
+ RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
+ end
+ type = TkFLOAT
+ if peek(0) !~ /[0-9]/
+ type = TkINTEGER
+ ungetc
+ break
+ end
+ allow_point = false
when allow_e && "e", allow_e && "E"
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
- type = TkFLOAT
- if peek(0) =~ /[+-]/
- getc
- end
- allow_e = false
- allow_point = false
- non_digit = ch
+ if non_digit
+ RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
+ end
+ type = TkFLOAT
+ if peek(0) =~ /[+-]/
+ getc
+ end
+ allow_e = false
+ allow_point = false
+ non_digit = ch
else
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
- ungetc
- break
+ if non_digit
+ RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
+ end
+ ungetc
+ break
end
end
Token(type)
@@ -1030,38 +1067,38 @@ class RubyLex
begin
nest = 0
while ch = getc
- if @quoted == ch and nest == 0
- break
- elsif @ltype != "'" && ch == "#" && peek(0) == "{"
- identify_string_dvar
- elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
- subtype = true
- elsif ch == '\\' and @ltype == "'" #'
- case ch = getc
- when "\\", "\n", "'"
- else
- ungetc
- end
- elsif ch == '\\' #'
- read_escape
- end
- if PERCENT_PAREN.values.include?(@quoted)
- if PERCENT_PAREN[ch] == @quoted
- nest += 1
- elsif ch == @quoted
- nest -= 1
- end
- end
+ if @quoted == ch and nest == 0
+ break
+ elsif @ltype != "'" && ch == "#" && peek(0) == "{"
+ identify_string_dvar
+ elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
+ subtype = true
+ elsif ch == '\\' and @ltype == "'" #'
+ case ch = getc
+ when "\\", "\n", "'"
+ else
+ ungetc
+ end
+ elsif ch == '\\' #'
+ read_escape
+ end
+ if PERCENT_PAREN.values.include?(@quoted)
+ if PERCENT_PAREN[ch] == @quoted
+ nest += 1
+ elsif ch == @quoted
+ nest -= 1
+ end
+ end
end
if @ltype == "/"
while /[imxoesun]/ =~ peek(0)
- getc
- end
+ getc
+ end
end
if subtype
- Token(DLtype2Token[ltype])
+ Token(DLtype2Token[ltype])
else
- Token(Ltype2Token[ltype])
+ Token(Ltype2Token[ltype])
end
ensure
@ltype = nil
@@ -1088,13 +1125,13 @@ class RubyLex
@lex_state = EXPR_BEG
loop do
- @continue = false
- prompt
- tk = token
- if @ltype or @continue or @indent >= 0
- next
- end
- break if tk.kind_of?(TkRBRACE)
+ @continue = false
+ prompt
+ tk = token
+ if @ltype or @continue or @indent > 0
+ next
+ end
+ break if tk.kind_of?(TkRBRACE)
end
ensure
@continue = reserve_continue
@@ -1110,10 +1147,13 @@ class RubyLex
@ltype = "#"
while ch = getc
+# if ch == "\\" #"
+# read_escape
+# end
if ch == "\n"
- @ltype = nil
- ungetc
- break
+ @ltype = nil
+ ungetc
+ break
end
end
return Token(TkCOMMENT)
@@ -1126,42 +1166,42 @@ class RubyLex
when /[0-7]/
ungetc ch
3.times do
- case ch = getc
- when /[0-7]/
- when nil
- break
- else
- ungetc
- break
- end
+ case ch = getc
+ when /[0-7]/
+ when nil
+ break
+ else
+ ungetc
+ break
+ end
end
when "x"
2.times do
- case ch = getc
- when /[0-9a-fA-F]/
- when nil
- break
- else
- ungetc
- break
- end
+ case ch = getc
+ when /[0-9a-fA-F]/
+ when nil
+ break
+ else
+ ungetc
+ break
+ end
end
when "M"
if (ch = getc) != '-'
- ungetc
+ ungetc
else
- if (ch = getc) == "\\" #"
- read_escape
- end
+ if (ch = getc) == "\\" #"
+ read_escape
+ end
end
when "C", "c" #, "^"
if ch == "C" and (ch = getc) != "-"
- ungetc
+ ungetc
elsif (ch = getc) == "\\" #"
- read_escape
+ read_escape
end
else
# other characters
diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb
index af53d3c93b..2c7565dbfc 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/ruby-token.rb - ruby tokens
# $Release Version: 0.9.6$
@@ -25,14 +24,14 @@ module RubyToken
@line_no = line_no
@char_no = char_no
end
- attr_reader :seek, :line_no, :char_no
+ attr :seek, :line_no, :char_no
end
class TkNode < Token
def initialize(seek, line_no, char_no)
super
end
- attr_reader :node
+ attr :node
end
class TkId < Token
@@ -40,7 +39,7 @@ module RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr_reader :name
+ attr :name
end
class TkVal < Token
@@ -48,7 +47,7 @@ module RubyToken
super(seek, line_no, char_no)
@value = value
end
- attr_reader :value
+ attr :value
end
class TkOp < Token
@@ -61,7 +60,7 @@ module RubyToken
op = TkReading2Token[op][0] unless op.kind_of?(Symbol)
@op = op
end
- attr_reader :op
+ attr :op
end
class TkUnknownChar < Token
@@ -69,7 +68,7 @@ module RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr_reader :name
+ attr :name
end
class TkError < Token
@@ -79,23 +78,23 @@ module RubyToken
case token
when String
if (tk = TkReading2Token[token]).nil?
- IRB.fail TkReading2TokenNoKey, token
+ IRB.fail TkReading2TokenNoKey, token
end
tk = Token(tk[0], value)
if tk.kind_of?(TkOp)
- tk.name = token
+ tk.name = token
end
return tk
when Symbol
if (tk = TkSymbol2Token[token]).nil?
- IRB.fail TkSymbol2TokenNoKey, token
+ IRB.fail TkSymbol2TokenNoKey, token
end
return Token(tk[0], value)
else
if (token.ancestors & [TkId, TkVal, TkOPASGN, TkUnknownChar]).empty?
- token.new(@prev_seek, @prev_line_no, @prev_char_no)
+ token.new(@prev_seek, @prev_line_no, @prev_char_no)
else
- token.new(@prev_seek, @prev_line_no, @prev_char_no, value)
+ token.new(@prev_seek, @prev_line_no, @prev_char_no, value)
end
end
end
@@ -187,6 +186,7 @@ module RubyToken
[:TkRSHFT, TkOp, ">>"],
[:TkCOLON2, TkOp],
[:TkCOLON3, TkOp],
+# [:OPASGN, TkOp], # +=, -= etc. #
[:TkASSOC, TkOp, "=>"],
[:TkQUESTION, TkOp, "?"], #?
[:TkCOLON, TkOp, ":"], #:
@@ -249,12 +249,12 @@ module RubyToken
if reading
if TkReading2Token[reading]
- IRB.fail TkReading2TokenDuplicateError, token_n, reading
+ IRB.fail TkReading2TokenDuplicateError, token_n, reading
end
if opts.empty?
- TkReading2Token[reading] = [token_c]
+ TkReading2Token[reading] = [token_c]
else
- TkReading2Token[reading] = [token_c].concat(opts)
+ TkReading2Token[reading] = [token_c].concat(opts)
end
end
TkSymbol2Token[token_n.intern] = token_c
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index 68174771a7..09c1c02ebc 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/slex.rb - simple lex analyzer
# $Release Version: 0.9.6$
@@ -16,6 +15,7 @@ require "irb/notifier"
# :stopdoc:
module IRB
class SLex
+ @RCS_ID='-$Id$-'
extend Exception2MessageMapper
def_exception :ErrNodeNothing, "node nothing"
@@ -41,10 +41,10 @@ module IRB
def def_rules(*tokens, &block)
if block_given?
- p = block
+ p = block
end
for token in tokens
- def_rule(token, nil, p)
+ def_rule(token, nil, p)
end
end
@@ -71,9 +71,9 @@ module IRB
case token
when Array
when String
- return match(token.split(//))
+ return match(token.split(//))
else
- return @head.match_io(token)
+ return @head.match_io(token)
end
ret = @head.match(token)
D_DETAIL.exec_if{D_DETAIL.printf "match end: %s:%s\n", ret, token.inspect}
@@ -93,69 +93,69 @@ module IRB
# if postproc is nil, this node is an abstract node.
# if postproc is non-nil, this node is a real node.
def initialize(preproc = nil, postproc = nil)
- @Tree = {}
- @preproc = preproc
- @postproc = postproc
+ @Tree = {}
+ @preproc = preproc
+ @postproc = postproc
end
attr_accessor :preproc
attr_accessor :postproc
def search(chrs, opt = nil)
- return self if chrs.empty?
- ch = chrs.shift
- if node = @Tree[ch]
- node.search(chrs, opt)
- else
- if opt
- chrs.unshift ch
- self.create_subnode(chrs)
- else
- SLex.fail ErrNodeNothing
- end
- end
+ return self if chrs.empty?
+ ch = chrs.shift
+ if node = @Tree[ch]
+ node.search(chrs, opt)
+ else
+ if opt
+ chrs.unshift ch
+ self.create_subnode(chrs)
+ else
+ SLex.fail ErrNodeNothing
+ end
+ end
end
def create_subnode(chrs, preproc = nil, postproc = nil)
- if chrs.empty?
- if @postproc
- D_DETAIL.pp node
- SLex.fail ErrNodeAlreadyExists
- else
- D_DEBUG.puts "change abstract node to real node."
- @preproc = preproc
- @postproc = postproc
- end
- return self
- end
+ if chrs.empty?
+ if @postproc
+ D_DETAIL.pp node
+ SLex.fail ErrNodeAlreadyExists
+ else
+ D_DEBUG.puts "change abstract node to real node."
+ @preproc = preproc
+ @postproc = postproc
+ end
+ return self
+ end
- ch = chrs.shift
- if node = @Tree[ch]
- if chrs.empty?
- if node.postproc
- DebugLogger.pp node
- DebugLogger.pp self
- DebugLogger.pp ch
- DebugLogger.pp chrs
- SLex.fail ErrNodeAlreadyExists
- else
- D_WARN.puts "change abstract node to real node"
- node.preproc = preproc
- node.postproc = postproc
- end
- else
- node.create_subnode(chrs, preproc, postproc)
- end
- else
- if chrs.empty?
- node = Node.new(preproc, postproc)
- else
- node = Node.new
- node.create_subnode(chrs, preproc, postproc)
- end
- @Tree[ch] = node
- end
- node
+ ch = chrs.shift
+ if node = @Tree[ch]
+ if chrs.empty?
+ if node.postproc
+ DebugLogger.pp node
+ DebugLogger.pp self
+ DebugLogger.pp ch
+ DebugLogger.pp chrs
+ SLex.fail ErrNodeAlreadyExists
+ else
+ D_WARN.puts "change abstract node to real node"
+ node.preproc = preproc
+ node.postproc = postproc
+ end
+ else
+ node.create_subnode(chrs, preproc, postproc)
+ end
+ else
+ if chrs.empty?
+ node = Node.new(preproc, postproc)
+ else
+ node = Node.new
+ node.create_subnode(chrs, preproc, postproc)
+ end
+ @Tree[ch] = node
+ end
+ node
end
#
@@ -165,81 +165,81 @@ module IRB
# able to be called arbitrary number of times.
#
def match(chrs, op = "")
- D_DETAIL.print "match>: ", chrs, "op:", op, "\n"
- if chrs.empty?
- if @preproc.nil? || @preproc.call(op, chrs)
- DOUT.printf(D_DETAIL, "op1: %s\n", op)
- @postproc.call(op, chrs)
- else
- nil
- end
- else
- ch = chrs.shift
- if node = @Tree[ch]
- if ret = node.match(chrs, op+ch)
- return ret
- else
- chrs.unshift ch
- if @postproc and @preproc.nil? || @preproc.call(op, chrs)
- DOUT.printf(D_DETAIL, "op2: %s\n", op.inspect)
- ret = @postproc.call(op, chrs)
- return ret
- else
- return nil
- end
- end
- else
- chrs.unshift ch
- if @postproc and @preproc.nil? || @preproc.call(op, chrs)
- DOUT.printf(D_DETAIL, "op3: %s\n", op)
- @postproc.call(op, chrs)
- return ""
- else
- return nil
- end
- end
- end
+ D_DETAIL.print "match>: ", chrs, "op:", op, "\n"
+ if chrs.empty?
+ if @preproc.nil? || @preproc.call(op, chrs)
+ DOUT.printf(D_DETAIL, "op1: %s\n", op)
+ @postproc.call(op, chrs)
+ else
+ nil
+ end
+ else
+ ch = chrs.shift
+ if node = @Tree[ch]
+ if ret = node.match(chrs, op+ch)
+ return ret
+ else
+ chrs.unshift ch
+ if @postproc and @preproc.nil? || @preproc.call(op, chrs)
+ DOUT.printf(D_DETAIL, "op2: %s\n", op.inspect)
+ ret = @postproc.call(op, chrs)
+ return ret
+ else
+ return nil
+ end
+ end
+ else
+ chrs.unshift ch
+ if @postproc and @preproc.nil? || @preproc.call(op, chrs)
+ DOUT.printf(D_DETAIL, "op3: %s\n", op)
+ @postproc.call(op, chrs)
+ return ""
+ else
+ return nil
+ end
+ end
+ end
end
def match_io(io, op = "")
- if op == ""
- ch = io.getc
- if ch == nil
- return nil
- end
- else
- ch = io.getc_of_rests
- end
- if ch.nil?
- if @preproc.nil? || @preproc.call(op, io)
- D_DETAIL.printf("op1: %s\n", op)
- @postproc.call(op, io)
- else
- nil
- end
- else
- if node = @Tree[ch]
- if ret = node.match_io(io, op+ch)
- ret
- else
- io.ungetc ch
- if @postproc and @preproc.nil? || @preproc.call(op, io)
- DOUT.exec_if{D_DETAIL.printf "op2: %s\n", op.inspect}
- @postproc.call(op, io)
- else
- nil
- end
- end
- else
- io.ungetc ch
- if @postproc and @preproc.nil? || @preproc.call(op, io)
- D_DETAIL.printf("op3: %s\n", op)
- @postproc.call(op, io)
- else
- nil
- end
- end
- end
+ if op == ""
+ ch = io.getc
+ if ch == nil
+ return nil
+ end
+ else
+ ch = io.getc_of_rests
+ end
+ if ch.nil?
+ if @preproc.nil? || @preproc.call(op, io)
+ D_DETAIL.printf("op1: %s\n", op)
+ @postproc.call(op, io)
+ else
+ nil
+ end
+ else
+ if node = @Tree[ch]
+ if ret = node.match_io(io, op+ch)
+ ret
+ else
+ io.ungetc ch
+ if @postproc and @preproc.nil? || @preproc.call(op, io)
+ DOUT.exec_if{D_DETAIL.printf "op2: %s\n", op.inspect}
+ @postproc.call(op, io)
+ else
+ nil
+ end
+ end
+ else
+ io.ungetc ch
+ if @postproc and @preproc.nil? || @preproc.call(op, io)
+ D_DETAIL.printf("op3: %s\n", op)
+ @postproc.call(op, io)
+ else
+ nil
+ end
+ end
+ end
end
end
end
@@ -247,6 +247,7 @@ end
# :startdoc:
if $0 == __FILE__
+ # Tracer.on
case $1
when "1"
tr = SLex.new
@@ -280,3 +281,4 @@ if $0 == __FILE__
end
exit
end
+
diff --git a/lib/irb/src_encoding.rb b/lib/irb/src_encoding.rb
index 32f997fc7c..958cef104c 100644
--- a/lib/irb/src_encoding.rb
+++ b/lib/irb/src_encoding.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# DO NOT WRITE ANY MAGIC COMMENT HERE.
def default_src_encoding
return __ENCODING__
diff --git a/lib/irb/version.rb b/lib/irb/version.rb
index 094cb33c05..bb998db3dd 100644
--- a/lib/irb/version.rb
+++ b/lib/irb/version.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/version.rb - irb version definition file
# $Release Version: 0.9.6$
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index ac3e369430..65214a2217 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/workspace-binding.rb -
# $Release Version: 0.9.6$
@@ -17,61 +16,61 @@ module IRB # :nodoc:
# inherit main from TOPLEVEL_BINDING.
def initialize(*main)
if main[0].kind_of?(Binding)
- @binding = main.shift
+ @binding = main.shift
elsif IRB.conf[:SINGLE_IRB]
- @binding = TOPLEVEL_BINDING
+ @binding = TOPLEVEL_BINDING
else
- case IRB.conf[:CONTEXT_MODE]
- when 0 # binding in proc on TOPLEVEL_BINDING
- @binding = eval("proc{binding}.call",
- TOPLEVEL_BINDING,
- __FILE__,
- __LINE__)
- when 1 # binding in loaded file
- require "tempfile"
- f = Tempfile.open("irb-binding")
- f.print <<EOF
- $binding = binding
+ case IRB.conf[:CONTEXT_MODE]
+ when 0 # binding in proc on TOPLEVEL_BINDING
+ @binding = eval("proc{binding}.call",
+ TOPLEVEL_BINDING,
+ __FILE__,
+ __LINE__)
+ when 1 # binding in loaded file
+ require "tempfile"
+ f = Tempfile.open("irb-binding")
+ f.print <<EOF
+ $binding = binding
EOF
- f.close
- load f.path
- @binding = $binding
+ f.close
+ load f.path
+ @binding = $binding
- when 2 # binding in loaded file(thread use)
- unless defined? BINDING_QUEUE
- require "thread"
+ when 2 # binding in loaded file(thread use)
+ unless defined? BINDING_QUEUE
+ require "thread"
- IRB.const_set(:BINDING_QUEUE, SizedQueue.new(1))
- Thread.abort_on_exception = true
- Thread.start do
- eval "require \"irb/ws-for-case-2\"", TOPLEVEL_BINDING, __FILE__, __LINE__
- end
- Thread.pass
- end
- @binding = BINDING_QUEUE.pop
+ IRB.const_set(:BINDING_QUEUE, SizedQueue.new(1))
+ Thread.abort_on_exception = true
+ Thread.start do
+ eval "require \"irb/ws-for-case-2\"", TOPLEVEL_BINDING, __FILE__, __LINE__
+ end
+ Thread.pass
+ end
+ @binding = BINDING_QUEUE.pop
- when 3 # binding in function on TOPLEVEL_BINDING(default)
- @binding = eval("def irb_binding; private; binding; end; irb_binding",
- TOPLEVEL_BINDING,
- __FILE__,
- __LINE__ - 3)
- end
+ when 3 # binging in function on TOPLEVEL_BINDING(default)
+ @binding = eval("def irb_binding; private; binding; end; irb_binding",
+ TOPLEVEL_BINDING,
+ __FILE__,
+ __LINE__ - 3)
+ end
end
if main.empty?
- @main = eval("self", @binding)
+ @main = eval("self", @binding)
else
- @main = main[0]
- IRB.conf[:__MAIN__] = @main
- case @main
- when Module
- @binding = eval("IRB.conf[:__MAIN__].module_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
- else
- begin
- @binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
- rescue TypeError
- IRB.fail CantChangeBinding, @main.inspect
- end
- end
+ @main = main[0]
+ IRB.conf[:__MAIN__] = @main
+ case @main
+ when Module
+ @binding = eval("IRB.conf[:__MAIN__].module_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
+ else
+ begin
+ @binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
+ rescue TypeError
+ IRB.fail CantChangeBinding, @main.inspect
+ end
+ end
end
eval("_=nil", @binding)
end
@@ -91,20 +90,20 @@ EOF
def filter_backtrace(bt)
case IRB.conf[:CONTEXT_MODE]
when 0
- return nil if bt =~ /\(irb_local_binding\)/
+ return nil if bt =~ /\(irb_local_binding\)/
when 1
- if(bt =~ %r!/tmp/irb-binding! or
- bt =~ %r!irb/.*\.rb! or
- bt =~ /irb\.rb/)
- return nil
- end
+ if(bt =~ %r!/tmp/irb-binding! or
+ bt =~ %r!irb/.*\.rb! or
+ bt =~ /irb\.rb/)
+ return nil
+ end
when 2
- return nil if bt =~ /irb\/.*\.rb/
- return nil if bt =~ /irb\.rb/
+ return nil if bt =~ /irb\/.*\.rb/
+ return nil if bt =~ /irb\.rb/
when 3
- return nil if bt =~ /irb\/.*\.rb/
- return nil if bt =~ /irb\.rb/
- bt = bt.sub(/:\s*in `irb_binding'/, '')
+ return nil if bt =~ /irb\/.*\.rb/
+ return nil if bt =~ /irb\.rb/
+ bt = bt.sub(/:\s*in `irb_binding'/, '')
end
bt
end
diff --git a/lib/irb/ws-for-case-2.rb b/lib/irb/ws-for-case-2.rb
index eb173fddca..9f3af49f30 100644
--- a/lib/irb/ws-for-case-2.rb
+++ b/lib/irb/ws-for-case-2.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# irb/ws-for-case-2.rb -
# $Release Version: 0.9.6$
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
index 3234cff7f3..947d2cf5a2 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# xmp.rb - irb version of gotoken xmp
# $Release Version: 0.9$
@@ -44,6 +43,7 @@ require "irb/frame"
# ctx.eval 'today # is what?'
# #=> "a good day"
class XMP
+ @RCS_ID='-$Id$-'
# Creates a new XMP object.
#
@@ -54,6 +54,8 @@ class XMP
# full detail.
def initialize(bind = nil)
IRB.init_config(nil)
+ #IRB.parse_opts
+ #IRB.load_modules
IRB.conf[:PROMPT_MODE] = :XMP
@@ -63,6 +65,7 @@ class XMP
@irb = IRB::Irb.new(ws, @io)
@irb.context.ignore_sigint = false
+# IRB.conf[:IRB_RC].call(@irb.context) if IRB.conf[:IRB_RC]
IRB.conf[:MAIN_CONTEXT] = @irb.context
end
@@ -82,16 +85,16 @@ class XMP
if @irb.context.ignore_sigint
begin
- trap_proc_b = trap("SIGINT"){@irb.signal_handle}
- catch(:IRB_EXIT) do
- @irb.eval_input
- end
+ trap_proc_b = trap("SIGINT"){@irb.signal_handle}
+ catch(:IRB_EXIT) do
+ @irb.eval_input
+ end
ensure
- trap("SIGINT", trap_proc_b)
+ trap("SIGINT", trap_proc_b)
end
else
catch(:IRB_EXIT) do
- @irb.eval_input
+ @irb.eval_input
end
end
end
@@ -114,10 +117,10 @@ class XMP
# See IO#gets for more information.
def gets
while l = @exps.shift
- next if /^\s+$/ =~ l
- l.concat "\n"
- print @prompt, l
- break
+ next if /^\s+$/ =~ l
+ l.concat "\n"
+ print @prompt, l
+ break
end
l
end
@@ -128,14 +131,14 @@ class XMP
# doesn't match the previous expression evaluated.
def puts(exps)
if @encoding and exps.encoding != @encoding
- enc = Encoding.compatible?(@exps.join("\n"), exps)
- if enc.nil?
- raise Encoding::CompatibilityError, "Encoding in which the passed expression is encoded is not compatible to the preceding's one"
- else
- @encoding = enc
- end
+ enc = Encoding.compatible?(@exps.join("\n"), exps)
+ if enc.nil?
+ raise Encoding::CompatibilityError, "Encoding in which the passed expression is encoded is not compatible to the preceding's one"
+ else
+ @encoding = enc
+ end
else
- @encoding = exps.encoding
+ @encoding = exps.encoding
end
@exps.concat exps.split(/\n/)
end
diff --git a/lib/logger.rb b/lib/logger.rb
index 259d4692b1..c70b091469 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# logger.rb - simple logging utility
# Copyright (C) 2000-2003, 2005, 2008, 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
#
@@ -177,13 +176,6 @@ require 'monitor'
#
# # DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
#
-# 3. Symbol or String (case insensitive)
-#
-# logger.level = :info
-# logger.level = 'INFO'
-#
-# # :debug < :info < :warn < :error < :fatal < :unknown
-#
# == Format
#
# Log messages are rendered in the output stream in a certain format by
@@ -216,7 +208,7 @@ class Logger
name = File.basename(__FILE__)
end
rev ||= "v#{VERSION}"
- ProgName = "#{name}/#{rev}".freeze
+ ProgName = "#{name}/#{rev}"
class Error < RuntimeError # :nodoc:
end
@@ -242,34 +234,7 @@ class Logger
include Severity
# Logging severity threshold (e.g. <tt>Logger::INFO</tt>).
- attr_reader :level
-
- # Set logging severity threshold.
- #
- # +severity+:: The Severity of the log message.
- def level=(severity)
- if severity.is_a?(Integer)
- @level = severity
- else
- _severity = severity.to_s.downcase
- case _severity
- when 'debug'.freeze
- @level = DEBUG
- when 'info'.freeze
- @level = INFO
- when 'warn'.freeze
- @level = WARN
- when 'error'.freeze
- @level = ERROR
- when 'fatal'.freeze
- @level = FATAL
- when 'unknown'.freeze
- @level = UNKNOWN
- else
- raise ArgumentError, "invalid log level: #{severity}"
- end
- end
- end
+ attr_accessor :level
# Program name to include in log messages.
attr_accessor :progname
@@ -325,8 +290,8 @@ class Logger
#
# :call-seq:
- # Logger.new(logdev, shift_age = 7, shift_size = 1048576)
- # Logger.new(logdev, shift_age = 'weekly')
+ # Logger.new(name, shift_age = 7, shift_size = 1048576)
+ # Logger.new(name, shift_age = 'weekly')
#
# === Args
#
@@ -357,26 +322,6 @@ class Logger
#
# :call-seq:
- # Logger#reopen
- # Logger#reopen(logdev)
- #
- # === Args
- #
- # +logdev+::
- # The log device. This is a filename (String) or IO object (typically
- # +STDOUT+, +STDERR+, or an open file).
- #
- # === Description
- #
- # Reopen a log device.
- #
- def reopen(logdev = nil)
- @logdev.reopen(logdev)
- self
- end
-
- #
- # :call-seq:
# Logger#add(severity, message = nil, progname = nil) { ... }
#
# === Args
@@ -416,7 +361,7 @@ class Logger
# * Append open does not need to lock file.
# * If the OS supports multi I/O, records possibly may be mixed.
#
- def add(severity, message = nil, progname = nil)
+ def add(severity, message = nil, progname = nil, &block)
severity ||= UNKNOWN
if @logdev.nil? or severity < @level
return true
@@ -536,7 +481,7 @@ class Logger
private
# Severity label for logging (max 5 chars).
- SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY).each(&:freeze).freeze
+ SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
def format_severity(severity)
SEV_LABEL[severity] || 'ANY'
@@ -549,7 +494,7 @@ private
# Default formatter for log messages.
class Formatter
- Format = "%s, [%s#%d] %5s -- %s: %s\n".freeze
+ Format = "%s, [%s#%d] %5s -- %s: %s\n"
attr_accessor :datetime_format
@@ -565,7 +510,11 @@ private
private
def format_datetime(time)
- time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ".freeze)
+ if @datetime_format.nil?
+ time.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec
+ else
+ time.strftime(@datetime_format)
+ end
end
def msg2str(msg)
@@ -581,68 +530,33 @@ private
end
end
- module Period
- module_function
-
- SiD = 24 * 60 * 60
-
- def next_rotate_time(now, shift_age)
- case shift_age
- when 'daily'
- t = Time.mktime(now.year, now.month, now.mday) + SiD
- when 'weekly'
- t = Time.mktime(now.year, now.month, now.mday) + SiD * (7 - now.wday)
- when 'monthly'
- t = Time.mktime(now.year, now.month, 1) + SiD * 32
- return Time.mktime(t.year, t.month, 1)
- else
- return now
- end
- if t.hour.nonzero? or t.min.nonzero? or t.sec.nonzero?
- hour = t.hour
- t = Time.mktime(t.year, t.month, t.mday)
- t += SiD if hour > 12
- end
- t
- end
-
- def previous_period_end(now, shift_age)
- case shift_age
- when 'daily'
- t = Time.mktime(now.year, now.month, now.mday) - SiD / 2
- when 'weekly'
- t = Time.mktime(now.year, now.month, now.mday) - (SiD * now.wday + SiD / 2)
- when 'monthly'
- t = Time.mktime(now.year, now.month, 1) - SiD / 2
- else
- return now
- end
- Time.mktime(t.year, t.month, t.mday, 23, 59, 59)
- end
- end
# Device used for logging messages.
class LogDevice
- include Period
-
attr_reader :dev
attr_reader :filename
- include MonitorMixin
+
+ class LogDeviceMutex
+ include MonitorMixin
+ end
def initialize(log = nil, opt = {})
@dev = @filename = @shift_age = @shift_size = nil
- mon_initialize
- set_dev(log)
- if @filename
+ @mutex = LogDeviceMutex.new
+ if log.respond_to?(:write) and log.respond_to?(:close)
+ @dev = log
+ else
+ @dev = open_logfile(log)
+ @dev.sync = true
+ @filename = log
@shift_age = opt[:shift_age] || 7
@shift_size = opt[:shift_size] || 1048576
- @next_rotate_time = next_rotate_time(Time.now, @shift_age) unless @shift_age.is_a?(Integer)
end
end
def write(message)
begin
- synchronize do
+ @mutex.synchronize do
if @shift_age and @dev.respond_to?(:stat)
begin
check_shift_log
@@ -663,7 +577,7 @@ private
def close
begin
- synchronize do
+ @mutex.synchronize do
@dev.close rescue nil
end
rescue Exception
@@ -671,33 +585,8 @@ private
end
end
- def reopen(log = nil)
- # reopen the same filename if no argument, do nothing for IO
- log ||= @filename if @filename
- if log
- synchronize do
- if @filename and @dev
- @dev.close rescue nil # close only file opened by Logger
- @filename = nil
- end
- set_dev(log)
- end
- end
- self
- end
-
private
- def set_dev(log)
- if log.respond_to?(:write) and log.respond_to?(:close)
- @dev = log
- else
- @dev = open_logfile(log)
- @dev.sync = true
- @filename = log
- end
- end
-
def open_logfile(filename)
begin
open(filename, (File::WRONLY | File::APPEND))
@@ -727,6 +616,8 @@ private
) if file.size == 0
end
+ SiD = 24 * 60 * 60
+
def check_shift_log
if @shift_age.is_a?(Integer)
# Note: always returns false if '0'.
@@ -735,9 +626,9 @@ private
end
else
now = Time.now
- if now >= @next_rotate_time
- @next_rotate_time = next_rotate_time(now, @shift_age)
- lock_shift_log { shift_log_period(previous_period_end(now, @shift_age)) }
+ period_end = previous_period_end(now)
+ if @dev.stat.mtime <= period_end
+ lock_shift_log { shift_log_period(period_end) }
end
end
end
@@ -753,7 +644,8 @@ private
begin
File.open(@filename, File::WRONLY | File::APPEND) do |lock|
lock.flock(File::LOCK_EX) # inter-process locking. will be unlocked at closing file
- if File.identical?(@filename, lock) and File.identical?(lock, @dev)
+ ino = lock.stat.ino
+ if ino == File.stat(@filename).ino
yield # log shifting
else
# log shifted by another process (i-node before locking and i-node after locking are different)
@@ -808,5 +700,146 @@ private
@dev = create_logfile(@filename)
return true
end
+
+ def previous_period_end(now)
+ case @shift_age
+ when /^daily$/
+ eod(now - 1 * SiD)
+ when /^weekly$/
+ eod(now - ((now.wday + 1) * SiD))
+ when /^monthly$/
+ eod(now - now.mday * SiD)
+ else
+ now
+ end
+ end
+
+ def eod(t)
+ Time.mktime(t.year, t.month, t.mday, 23, 59, 59)
+ end
+ end
+
+
+ #
+ # == Description
+ #
+ # Logger::Application --- Add logging support to your application.
+ #
+ # == Usage
+ #
+ # 1. Define your application class as a sub-class of this class.
+ # 2. Override the +run+ method in your class to do many things.
+ # 3. Instantiate it and invoke #start.
+ #
+ # == Example
+ #
+ # class FooApp < Logger::Application
+ # def initialize(foo_app, application_specific, arguments)
+ # super('FooApp') # Name of the application.
+ # end
+ #
+ # def run
+ # ...
+ # log(WARN, 'warning', 'my_method1')
+ # ...
+ # @log.error('my_method2') { 'Error!' }
+ # ...
+ # end
+ # end
+ #
+ # status = FooApp.new(....).start
+ #
+ class Application
+ include Logger::Severity
+
+ # Name of the application given at initialize.
+ attr_reader :appname
+
+ #
+ # :call-seq:
+ # Logger::Application.new(appname = '')
+ #
+ # == Args
+ #
+ # +appname+:: Name of the application.
+ #
+ # == Description
+ #
+ # Create an instance. Log device is +STDERR+ by default. This can be
+ # changed with #set_log.
+ #
+ def initialize(appname = nil)
+ @appname = appname
+ @log = Logger.new(STDERR)
+ @log.progname = @appname
+ @level = @log.level
+ end
+
+ #
+ # Start the application. Return the status code.
+ #
+ def start
+ status = -1
+ begin
+ log(INFO, "Start of #{ @appname }.")
+ status = run
+ rescue
+ log(FATAL, "Detected an exception. Stopping ... #{$!} (#{$!.class})\n" << $@.join("\n"))
+ ensure
+ log(INFO, "End of #{ @appname }. (status: #{ status.to_s })")
+ end
+ status
+ end
+
+ # Logger for this application. See the class Logger for an explanation.
+ def logger
+ @log
+ end
+
+ #
+ # Sets the logger for this application. See the class Logger for an
+ # explanation.
+ #
+ def logger=(logger)
+ @log = logger
+ @log.progname = @appname
+ @log.level = @level
+ end
+
+ #
+ # Sets the log device for this application. See <tt>Logger.new</tt> for
+ # an explanation of the arguments.
+ #
+ def set_log(logdev, shift_age = 0, shift_size = 1024000)
+ @log = Logger.new(logdev, shift_age, shift_size)
+ @log.progname = @appname
+ @log.level = @level
+ end
+
+ def log=(logdev)
+ set_log(logdev)
+ end
+
+ #
+ # Set the logging threshold, just like <tt>Logger#level=</tt>.
+ #
+ def level=(level)
+ @level = level
+ @log.level = @level
+ end
+
+ #
+ # See Logger#add. This application's +appname+ is used.
+ #
+ def log(severity, message = nil, &block)
+ @log.add(severity, message, @appname, &block) if @log
+ end
+
+ private
+
+ def run
+ # TODO: should be an NotImplementedError
+ raise RuntimeError.new('Method run must be defined in the derived class.')
+ end
end
end
diff --git a/lib/mathn.rb b/lib/mathn.rb
index d07388bc26..aae4620c3f 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# $Release Version: 0.5 $
# $Revision: 1.1.1.1.4.1 $
@@ -6,8 +5,9 @@
##
# = mathn
#
-# mathn serves to make mathematical operations more precise in Ruby
-# and to integrate other mathematical standard libraries.
+# mathn is a library for changing the way Ruby does math. If you need
+# more precise rounding with multiple division or exponentiation
+# operations, then mathn is the right tool.
#
# Without mathn:
#
@@ -17,7 +17,7 @@
#
# 3 / 2 => 3/2 # Rational
#
-# mathn keeps value in exact terms.
+# mathn features late rounding and lacks truncation of intermediate results:
#
# Without mathn:
#
@@ -38,8 +38,6 @@
# class Numeric follows to make this documentation findable in a reasonable
# location
-warn('lib/mathn.rb is deprecated') if $VERBOSE
-
class Numeric; end
require "cmath.rb"
@@ -55,7 +53,7 @@ unless defined?(Math.exp!)
end
##
-# When mathn is required, Fixnum's division is enhanced to
+# When mathn is required, Fixnum's division and exponentiation are enhanced to
# return more precise values from mathematical expressions.
#
# 2/3*3 # => 0
@@ -71,13 +69,25 @@ class Fixnum
# 1/3 # => (1/3)
alias / quo
+
+ alias power! ** unless method_defined? :power!
+
+ ##
+ # Exponentiate by +other+
+
+ def ** (other)
+ if self < 0 && other.round != other
+ Complex(self, 0.0) ** other
+ else
+ power!(other)
+ end
+ end
+
end
##
-# When mathn is required Bignum's division is enhanced to
+# When mathn is required Bignum's division and exponentiation are enhanced to
# return more precise values from mathematical expressions.
-#
-# (2**72) / ((2**70) * 3) # => 4/3
class Bignum
remove_method :/
@@ -88,6 +98,103 @@ class Bignum
# (2**72) / ((2**70) * 3) # => 4/3
alias / quo
+
+ alias power! ** unless method_defined? :power!
+
+ ##
+ # Exponentiate by +other+
+
+ def ** (other)
+ if self < 0 && other.round != other
+ Complex(self, 0.0) ** other
+ else
+ power!(other)
+ end
+ end
+
+end
+
+##
+# When mathn is required Rational is changed to simplify the use of Rational
+# operations.
+#
+# Normal behaviour:
+#
+# Rational.new!(1,3) ** 2 # => Rational(1, 9)
+# (1 / 3) ** 2 # => 0
+#
+# require 'mathn' behaviour:
+#
+# (1 / 3) ** 2 # => 1/9
+
+class Rational
+ remove_method :**
+
+ ##
+ # Exponentiate by +other+
+ #
+ # (1/3) ** 2 # => 1/9
+
+ def ** (other)
+ if other.kind_of?(Rational)
+ other2 = other
+ if self < 0
+ return Complex(self, 0.0) ** other
+ elsif other == 0
+ return Rational(1,1)
+ elsif self == 0
+ return Rational(0,1)
+ elsif self == 1
+ return Rational(1,1)
+ end
+
+ npd = numerator.prime_division
+ dpd = denominator.prime_division
+ if other < 0
+ other = -other
+ npd, dpd = dpd, npd
+ end
+
+ for elm in npd
+ elm[1] = elm[1] * other
+ if !elm[1].kind_of?(Integer) and elm[1].denominator != 1
+ return Float(self) ** other2
+ end
+ elm[1] = elm[1].to_i
+ end
+
+ for elm in dpd
+ elm[1] = elm[1] * other
+ if !elm[1].kind_of?(Integer) and elm[1].denominator != 1
+ return Float(self) ** other2
+ end
+ elm[1] = elm[1].to_i
+ end
+
+ num = Integer.from_prime_division(npd)
+ den = Integer.from_prime_division(dpd)
+
+ Rational(num,den)
+
+ elsif other.kind_of?(Integer)
+ if other > 0
+ num = numerator ** other
+ den = denominator ** other
+ elsif other < 0
+ num = denominator ** -other
+ den = numerator ** -other
+ elsif other == 0
+ num = 1
+ den = 1
+ end
+ Rational(num, den)
+ elsif other.kind_of?(Float)
+ Float(self) ** other
+ else
+ x , y = other.coerce(self)
+ x ** y
+ end
+ end
end
##
@@ -119,8 +226,14 @@ module Math
def sqrt(a)
if a.kind_of?(Complex)
abs = sqrt(a.real*a.real + a.imag*a.imag)
+# if not abs.kind_of?(Rational)
+# return a**Rational(1,2)
+# end
x = sqrt((a.real + abs)/Rational(2))
y = sqrt((-a.real + abs)/Rational(2))
+# if !(x.kind_of?(Rational) and y.kind_of?(Rational))
+# return a**Rational(1,2)
+# end
if a.imag >= 0
Complex(x, y)
else
@@ -190,3 +303,22 @@ module Math
module_function :sqrt
module_function :rsqrt
end
+
+##
+# When mathn is required, Float is changed to handle Complex numbers.
+
+class Float
+ alias power! **
+
+ ##
+ # Exponentiate by +other+
+
+ def ** (other)
+ if self < 0 && other.round != other
+ Complex(self, 0.0) ** other
+ else
+ power!(other)
+ end
+ end
+
+end
diff --git a/lib/matrix.rb b/lib/matrix.rb
index fe61b6d120..f82ed65979 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -1,5 +1,4 @@
# encoding: utf-8
-# frozen_string_literal: false
#
# = matrix.rb
#
@@ -46,9 +45,6 @@ end
# * Matrix.zero(n)
# * Matrix.row_vector(row)
# * Matrix.column_vector(column)
-# * Matrix.empty(row_count, column_count)
-# * Matrix.hstack(*matrices)
-# * Matrix.vstack(*matrices)
#
# To access Matrix elements/columns/rows/submatrices/properties:
# * #[](i, j)
@@ -62,11 +58,6 @@ end
# * #each_with_index
# * #find_index
# * #minor(*param)
-# * #first_minor(row, column)
-# * #cofactor(row, column)
-# * #adjugate
-# * #laplace_expansion(row_or_column: num)
-# * #cofactor_expansion(row_or_column: num)
#
# Properties of a matrix:
# * #diagonal?
@@ -93,20 +84,16 @@ end
# * #inverse
# * #inv
# * #**
-# * #+@
-# * #-@
#
# Matrix functions:
# * #determinant
# * #det
-# * #hstack(*matrices)
# * #rank
# * #round
# * #trace
# * #tr
# * #transpose
# * #t
-# * #vstack(*matrices)
#
# Matrix decompositions:
# * #eigen
@@ -163,7 +150,7 @@ class Matrix
# -1 66
#
def Matrix.rows(rows, copy = true)
- rows = convert_to_array(rows, copy)
+ rows = convert_to_array(rows)
rows.map! do |row|
convert_to_array(row, copy)
end
@@ -217,7 +204,6 @@ class Matrix
#
def Matrix.diagonal(*values)
size = values.size
- return Matrix.empty if size == 0
rows = Array.new(size) {|j|
row = Array.new(size, 0)
row[j] = values[j]
@@ -307,51 +293,6 @@ class Matrix
end
#
- # Create a matrix by stacking matrices vertically
- #
- # x = Matrix[[1, 2], [3, 4]]
- # y = Matrix[[5, 6], [7, 8]]
- # Matrix.vstack(x, y) # => Matrix[[1, 2], [3, 4], [5, 6], [7, 8]]
- #
- def Matrix.vstack(x, *matrices)
- raise TypeError, "Expected a Matrix, got a #{x.class}" unless x.is_a?(Matrix)
- result = x.send(:rows).map(&:dup)
- matrices.each do |m|
- raise TypeError, "Expected a Matrix, got a #{m.class}" unless m.is_a?(Matrix)
- if m.column_count != x.column_count
- raise ErrDimensionMismatch, "The given matrices must have #{x.column_count} columns, but one has #{m.column_count}"
- end
- result.concat(m.send(:rows))
- end
- new result, x.column_count
- end
-
-
- #
- # Create a matrix by stacking matrices horizontally
- #
- # x = Matrix[[1, 2], [3, 4]]
- # y = Matrix[[5, 6], [7, 8]]
- # Matrix.hstack(x, y) # => Matrix[[1, 2, 5, 6], [3, 4, 7, 8]]
- #
- def Matrix.hstack(x, *matrices)
- raise TypeError, "Expected a Matrix, got a #{x.class}" unless x.is_a?(Matrix)
- result = x.send(:rows).map(&:dup)
- total_column_count = x.column_count
- matrices.each do |m|
- raise TypeError, "Expected a Matrix, got a #{m.class}" unless m.is_a?(Matrix)
- if m.row_count != x.row_count
- raise ErrDimensionMismatch, "The given matrices must have #{x.row_count} rows, but one has #{m.row_count}"
- end
- result.each_with_index do |row, i|
- row.concat m.send(:rows)[i]
- end
- total_column_count += m.column_count
- end
- new result, total_column_count
- end
-
- #
# Matrix.new is private; use Matrix.rows, columns, [], etc... to create.
#
def initialize(rows, column_count = rows[0].size)
@@ -447,7 +388,7 @@ class Matrix
#
# Yields all elements of the matrix, starting with those of the first row,
- # or returns an Enumerator if no block given.
+ # or returns an Enumerator is no block given.
# Elements can be restricted by passing an argument:
# * :all (default): yields all elements
# * :diagonal: yields only elements on the diagonal
@@ -602,7 +543,6 @@ class Matrix
nil
end
alias_method :find_index, :index
-
#
# Returns a section of the matrix. The parameters are either:
# * start_row, nrows, start_col, ncols; OR
@@ -649,100 +589,12 @@ class Matrix
new_matrix rows, [column_count - from_col, size_col].min
end
- #
- # Returns the submatrix obtained by deleting the specified row and column.
- #
- # Matrix.diagonal(9, 5, -3, 4).first_minor(1, 2)
- # => 9 0 0
- # 0 0 0
- # 0 0 4
- #
- def first_minor(row, column)
- raise RuntimeError, "first_minor of empty matrix is not defined" if empty?
-
- unless 0 <= row && row < row_count
- raise ArgumentError, "invalid row (#{row.inspect} for 0..#{row_count - 1})"
- end
-
- unless 0 <= column && column < column_count
- raise ArgumentError, "invalid column (#{column.inspect} for 0..#{column_count - 1})"
- end
-
- arrays = to_a
- arrays.delete_at(row)
- arrays.each do |array|
- array.delete_at(column)
- end
-
- new_matrix arrays, column_count - 1
- end
-
- #
- # Returns the (row, column) cofactor which is obtained by multiplying
- # the first minor by (-1)**(row + column).
- #
- # Matrix.diagonal(9, 5, -3, 4).cofactor(1, 1)
- # => -108
- #
- def cofactor(row, column)
- raise RuntimeError, "cofactor of empty matrix is not defined" if empty?
- Matrix.Raise ErrDimensionMismatch unless square?
-
- det_of_minor = first_minor(row, column).determinant
- det_of_minor * (-1) ** (row + column)
- end
-
- #
- # Returns the adjugate of the matrix.
- #
- # Matrix[ [7,6],[3,9] ].adjugate
- # => 9 -6
- # -3 7
- #
- def adjugate
- Matrix.Raise ErrDimensionMismatch unless square?
- Matrix.build(row_count, column_count) do |row, column|
- cofactor(column, row)
- end
- end
-
- #
- # Returns the Laplace expansion along given row or column.
- #
- # Matrix[[7,6], [3,9]].laplace_expansion(column: 1)
- # => 45
- #
- # Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0)
- # => Vector[3, -2]
- #
- #
- def laplace_expansion(row: nil, column: nil)
- num = row || column
-
- if !num || (row && column)
- raise ArgumentError, "exactly one the row or column arguments must be specified"
- end
-
- Matrix.Raise ErrDimensionMismatch unless square?
- raise RuntimeError, "laplace_expansion of empty matrix is not defined" if empty?
-
- unless 0 <= num && num < row_count
- raise ArgumentError, "invalid num (#{num.inspect} for 0..#{row_count - 1})"
- end
-
- send(row ? :row : :column, num).map.with_index { |e, k|
- e * cofactor(*(row ? [num, k] : [k,num]))
- }.inject(:+)
- end
- alias_method :cofactor_expansion, :laplace_expansion
-
-
#--
# TESTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
#
- # Returns +true+ if this is a diagonal matrix.
+ # Returns +true+ is this is a diagonal matrix.
# Raises an error if matrix is not square.
#
def diagonal?
@@ -759,7 +611,7 @@ class Matrix
end
#
- # Returns +true+ if this is an hermitian matrix.
+ # Returns +true+ is this is an hermitian matrix.
# Raises an error if matrix is not square.
#
def hermitian?
@@ -770,14 +622,14 @@ class Matrix
end
#
- # Returns +true+ if this is a lower triangular matrix.
+ # Returns +true+ is this is a lower triangular matrix.
#
def lower_triangular?
each(:strict_upper).all?(&:zero?)
end
#
- # Returns +true+ if this is a normal matrix.
+ # Returns +true+ is this is a normal matrix.
# Raises an error if matrix is not square.
#
def normal?
@@ -795,7 +647,7 @@ class Matrix
end
#
- # Returns +true+ if this is an orthogonal matrix
+ # Returns +true+ is this is an orthogonal matrix
# Raises an error if matrix is not square.
#
def orthogonal?
@@ -813,7 +665,7 @@ class Matrix
end
#
- # Returns +true+ if this is a permutation matrix
+ # Returns +true+ is this is a permutation matrix
# Raises an error if matrix is not square.
#
def permutation?
@@ -849,21 +701,21 @@ class Matrix
end
#
- # Returns +true+ if this is a singular matrix.
+ # Returns +true+ is this is a singular matrix.
#
def singular?
determinant == 0
end
#
- # Returns +true+ if this is a square matrix.
+ # Returns +true+ is this is a square matrix.
#
def square?
column_count == row_count
end
#
- # Returns +true+ if this is a symmetric matrix.
+ # Returns +true+ is this is a symmetric matrix.
# Raises an error if matrix is not square.
#
def symmetric?
@@ -875,7 +727,7 @@ class Matrix
end
#
- # Returns +true+ if this is a unitary matrix
+ # Returns +true+ is this is a unitary matrix
# Raises an error if matrix is not square.
#
def unitary?
@@ -893,14 +745,14 @@ class Matrix
end
#
- # Returns +true+ if this is an upper triangular matrix.
+ # Returns +true+ is this is an upper triangular matrix.
#
def upper_triangular?
each(:strict_lower).all?(&:zero?)
end
#
- # Returns +true+ if this is a matrix with only zero elements
+ # Returns +true+ is this is a matrix with only zero elements
#
def zero?
all?(&:zero?)
@@ -995,7 +847,7 @@ class Matrix
return apply_through_coercion(m, __method__)
end
- Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count && column_count == m.column_count
+ Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count and column_count == m.column_count
rows = Array.new(row_count) {|i|
Array.new(column_count) {|j|
@@ -1022,7 +874,7 @@ class Matrix
return apply_through_coercion(m, __method__)
end
- Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count && column_count == m.column_count
+ Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count and column_count == m.column_count
rows = Array.new(row_count) {|i|
Array.new(column_count) {|j|
@@ -1141,14 +993,6 @@ class Matrix
end
end
- def +@
- self
- end
-
- def -@
- collect {|e| -e }
- end
-
#--
# MATRIX FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
@@ -1252,18 +1096,6 @@ class Matrix
alias det_e determinant_e
#
- # Returns a new matrix resulting by stacking horizontally
- # the receiver with the given matrices
- #
- # x = Matrix[[1, 2], [3, 4]]
- # y = Matrix[[5, 6], [7, 8]]
- # x.hstack(y) # => Matrix[[1, 2, 5, 6], [3, 4, 7, 8]]
- #
- def hstack(*matrices)
- self.class.hstack(self, *matrices)
- end
-
- #
# Returns the rank of the matrix.
# Beware that using Float values can yield erroneous results
# because of their lack of precision.
@@ -1344,18 +1176,6 @@ class Matrix
end
alias t transpose
- #
- # Returns a new matrix resulting by stacking vertically
- # the receiver with the given matrices
- #
- # x = Matrix[[1, 2], [3, 4]]
- # y = Matrix[[5, 6], [7, 8]]
- # x.vstack(y) # => Matrix[[1, 2], [3, 4], [5, 6], [7, 8]]
- #
- def vstack(*matrices)
- self.class.vstack(self, *matrices)
- end
-
#--
# DECOMPOSITIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#++
@@ -1684,7 +1504,6 @@ end
# To create a Vector:
# * Vector.[](*array)
# * Vector.elements(array, copy = true)
-# * Vector.basis(size: n, index: k)
#
# To access elements:
# * #[](i)
@@ -1693,22 +1512,14 @@ end
# * #each2(v)
# * #collect2(v)
#
-# Properties of vectors:
-# * #angle_with(v)
-# * Vector.independent?(*vs)
-# * #independent?(*vs)
-#
# Vector arithmetic:
# * #*(x) "is matrix or number"
# * #+(v)
# * #-(v)
-# * #/(v)
-# * #+@
-# * #-@
#
# Vector functions:
-# * #inner_product(v), dot(v)
-# * #cross_product(v), cross(v)
+# * #inner_product(v)
+# * #cross_product(v)
# * #collect
# * #magnitude
# * #map
@@ -1716,7 +1527,6 @@ end
# * #norm
# * #normalize
# * #r
-# * #round
# * #size
#
# Conversion to other data types:
@@ -1756,19 +1566,6 @@ class Vector
end
#
- # Returns a standard basis +n+-vector, where k is the index.
- #
- # Vector.basis(size:, index:) # => Vector[0, 1, 0]
- #
- def Vector.basis(size:, index:)
- raise ArgumentError, "invalid size (#{size} for 1..)" if size < 1
- raise ArgumentError, "invalid index (#{index} for 0...#{size})" unless 0 <= index && index < size
- array = Array.new(size, 0)
- array[index] = 1
- new convert_to_array(array, false)
- end
-
- #
# Vector.new is private; use Vector[] or Vector.elements to create.
#
def initialize(array)
@@ -1794,13 +1591,6 @@ class Vector
alias set_component []=
private :[]=, :set_element, :set_component
- # Returns a vector with entries rounded to the given precision
- # (see Float#round)
- #
- def round(ndigits=0)
- map{|e| e.round(ndigits)}
- end
-
#
# Returns the number of elements in the vector.
#
@@ -1848,41 +1638,6 @@ class Vector
end
#--
- # PROPERTIES -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #++
-
- #
- # Returns +true+ iff all of vectors are linearly independent.
- #
- # Vector.independent?(Vector[1,0], Vector[0,1])
- # => true
- #
- # Vector.independent?(Vector[1,2], Vector[2,4])
- # => false
- #
- def Vector.independent?(*vs)
- vs.each do |v|
- raise TypeError, "expected Vector, got #{v.class}" unless v.is_a?(Vector)
- Vector.Raise ErrDimensionMismatch unless v.size == vs.first.size
- end
- return false if vs.count > vs.first.size
- Matrix[*vs].rank.eql?(vs.count)
- end
-
- #
- # Returns +true+ iff all of vectors are linearly independent.
- #
- # Vector[1,0].independent?(Vector[0,1])
- # => true
- #
- # Vector[1,2].independent?(Vector[2,4])
- # => false
- #
- def independent?(*vs)
- self.class.independent?(self, *vs)
- end
-
- #--
# COMPARING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
@@ -1900,14 +1655,14 @@ class Vector
end
#
- # Returns a copy of the vector.
+ # Return a copy of the vector.
#
def clone
self.class.elements(@elements)
end
#
- # Returns a hash-code for the vector.
+ # Return a hash-code for the vector.
#
def hash
@elements.hash
@@ -1918,7 +1673,7 @@ class Vector
#++
#
- # Multiplies the vector by +x+, where +x+ is a number or a matrix.
+ # Multiplies the vector by +x+, where +x+ is a number or another vector.
#
def *(x)
case x
@@ -1985,14 +1740,6 @@ class Vector
end
end
- def +@
- self
- end
-
- def -@
- collect {|e| -e }
- end
-
#--
# VECTOR FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
@@ -2010,41 +1757,17 @@ class Vector
}
p
end
- alias_method :dot, :inner_product
#
- # Returns the cross product of this vector with the others.
+ # Returns the cross product of this vector with the other.
# Vector[1, 0, 0].cross_product Vector[0, 1, 0] => Vector[0, 0, 1]
#
- # It is generalized to other dimensions to return a vector perpendicular
- # to the arguments.
- # Vector[1, 2].cross_product # => Vector[-2, 1]
- # Vector[1, 0, 0, 0].cross_product(
- # Vector[0, 1, 0, 0],
- # Vector[0, 0, 1, 0]
- # ) #=> Vector[0, 0, 0, 1]
- #
- def cross_product(*vs)
- raise ErrOperationNotDefined, "cross product is not defined on vectors of dimension #{size}" unless size >= 2
- raise ArgumentError, "wrong number of arguments (#{vs.size} for #{size - 2})" unless vs.size == size - 2
- vs.each do |v|
- raise TypeError, "expected Vector, got #{v.class}" unless v.is_a? Vector
- Vector.Raise ErrDimensionMismatch unless v.size == size
- end
- case size
- when 2
- Vector[-@elements[1], @elements[0]]
- when 3
- v = vs[0]
- Vector[ v[2]*@elements[1] - v[1]*@elements[2],
- v[0]*@elements[2] - v[2]*@elements[0],
- v[1]*@elements[0] - v[0]*@elements[1] ]
- else
- rows = self, *vs, Array.new(size) {|i| Vector.basis(size: size, index: i) }
- Matrix.rows(rows).laplace_expansion(row: size - 1)
- end
+ def cross_product(v)
+ Vector.Raise ErrDimensionMismatch unless size == v.size && v.size == 3
+ Vector[ v[1]*@elements[2] - v[2]*@elements[1],
+ v[2]*@elements[0] - v[0]*@elements[2],
+ v[0]*@elements[1] - v[1]*@elements[0] ]
end
- alias_method :cross, :cross_product
#
# Like Array#collect.
@@ -2089,20 +1812,6 @@ class Vector
self / n
end
- #
- # Returns an angle with another vector. Result is within the [0...Math::PI].
- # Vector[1,0].angle_with(Vector[0,1])
- # # => Math::PI / 2
- #
- def angle_with(v)
- raise TypeError, "Expected a Vector, got a #{v.class}" unless v.is_a?(Vector)
- Vector.Raise ErrDimensionMismatch if size != v.size
- prod = magnitude * v.magnitude
- raise ZeroVectorError, "Can't get angle of zero vector" if prod == 0
-
- Math.acos( inner_product(v) / prod )
- end
-
#--
# CONVERTING
#++
diff --git a/lib/matrix/eigenvalue_decomposition.rb b/lib/matrix/eigenvalue_decomposition.rb
index 919db9e83d..0dd9d42f29 100644
--- a/lib/matrix/eigenvalue_decomposition.rb
+++ b/lib/matrix/eigenvalue_decomposition.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
class Matrix
# Adapted from JAMA: http://math.nist.gov/javanumerics/jama/
@@ -41,14 +40,14 @@ class Matrix
# Returns the eigenvector matrix +V+
#
def eigenvector_matrix
- Matrix.send(:new, build_eigenvectors.transpose)
+ Matrix.send :new, build_eigenvectors.transpose
end
alias v eigenvector_matrix
# Returns the inverse of the eigenvector matrix +V+
#
def eigenvector_matrix_inv
- r = Matrix.send(:new, build_eigenvectors)
+ r = Matrix.send :new, build_eigenvectors
r = r.transpose.inverse unless @symmetric
r
end
@@ -65,7 +64,7 @@ class Matrix
# Returns an array of the eigenvectors
#
def eigenvectors
- build_eigenvectors.map{|ev| Vector.send(:new, ev)}
+ build_eigenvectors.map{|ev| Vector.send :new, ev}
end
# Returns the block diagonal eigenvalue matrix +D+
@@ -120,113 +119,113 @@ class Matrix
# Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
# Fortran subroutine in EISPACK.
- @size.times do |j|
- @d[j] = @v[@size-1][j]
- end
+ @size.times do |j|
+ @d[j] = @v[@size-1][j]
+ end
- # Householder reduction to tridiagonal form.
+ # Householder reduction to tridiagonal form.
- (@size-1).downto(0+1) do |i|
+ (@size-1).downto(0+1) do |i|
- # Scale to avoid under/overflow.
+ # Scale to avoid under/overflow.
- scale = 0.0
- h = 0.0
- i.times do |k|
- scale = scale + @d[k].abs
- end
- if (scale == 0.0)
- @e[i] = @d[i-1]
- i.times do |j|
- @d[j] = @v[i-1][j]
- @v[i][j] = 0.0
- @v[j][i] = 0.0
- end
- else
+ scale = 0.0
+ h = 0.0
+ i.times do |k|
+ scale = scale + @d[k].abs
+ end
+ if (scale == 0.0)
+ @e[i] = @d[i-1]
+ i.times do |j|
+ @d[j] = @v[i-1][j]
+ @v[i][j] = 0.0
+ @v[j][i] = 0.0
+ end
+ else
- # Generate Householder vector.
+ # Generate Householder vector.
- i.times do |k|
- @d[k] /= scale
- h += @d[k] * @d[k]
- end
- f = @d[i-1]
- g = Math.sqrt(h)
- if (f > 0)
- g = -g
- end
- @e[i] = scale * g
- h -= f * g
- @d[i-1] = f - g
- i.times do |j|
- @e[j] = 0.0
- end
+ i.times do |k|
+ @d[k] /= scale
+ h += @d[k] * @d[k]
+ end
+ f = @d[i-1]
+ g = Math.sqrt(h)
+ if (f > 0)
+ g = -g
+ end
+ @e[i] = scale * g
+ h -= f * g
+ @d[i-1] = f - g
+ i.times do |j|
+ @e[j] = 0.0
+ end
- # Apply similarity transformation to remaining columns.
+ # Apply similarity transformation to remaining columns.
- i.times do |j|
- f = @d[j]
- @v[j][i] = f
- g = @e[j] + @v[j][j] * f
- (j+1).upto(i-1) do |k|
- g += @v[k][j] * @d[k]
- @e[k] += @v[k][j] * f
+ i.times do |j|
+ f = @d[j]
+ @v[j][i] = f
+ g = @e[j] + @v[j][j] * f
+ (j+1).upto(i-1) do |k|
+ g += @v[k][j] * @d[k]
+ @e[k] += @v[k][j] * f
+ end
+ @e[j] = g
+ end
+ f = 0.0
+ i.times do |j|
+ @e[j] /= h
+ f += @e[j] * @d[j]
+ end
+ hh = f / (h + h)
+ i.times do |j|
+ @e[j] -= hh * @d[j]
+ end
+ i.times do |j|
+ f = @d[j]
+ g = @e[j]
+ j.upto(i-1) do |k|
+ @v[k][j] -= (f * @e[k] + g * @d[k])
+ end
+ @d[j] = @v[i-1][j]
+ @v[i][j] = 0.0
end
- @e[j] = g
- end
- f = 0.0
- i.times do |j|
- @e[j] /= h
- f += @e[j] * @d[j]
- end
- hh = f / (h + h)
- i.times do |j|
- @e[j] -= hh * @d[j]
- end
- i.times do |j|
- f = @d[j]
- g = @e[j]
- j.upto(i-1) do |k|
- @v[k][j] -= (f * @e[k] + g * @d[k])
- end
- @d[j] = @v[i-1][j]
- @v[i][j] = 0.0
end
+ @d[i] = h
end
- @d[i] = h
- end
- # Accumulate transformations.
+ # Accumulate transformations.
- 0.upto(@size-1-1) do |i|
- @v[@size-1][i] = @v[i][i]
- @v[i][i] = 1.0
- h = @d[i+1]
- if (h != 0.0)
- 0.upto(i) do |k|
- @d[k] = @v[k][i+1] / h
- end
- 0.upto(i) do |j|
- g = 0.0
+ 0.upto(@size-1-1) do |i|
+ @v[@size-1][i] = @v[i][i]
+ @v[i][i] = 1.0
+ h = @d[i+1]
+ if (h != 0.0)
0.upto(i) do |k|
- g += @v[k][i+1] * @v[k][j]
+ @d[k] = @v[k][i+1] / h
end
- 0.upto(i) do |k|
- @v[k][j] -= g * @d[k]
+ 0.upto(i) do |j|
+ g = 0.0
+ 0.upto(i) do |k|
+ g += @v[k][i+1] * @v[k][j]
+ end
+ 0.upto(i) do |k|
+ @v[k][j] -= g * @d[k]
+ end
end
end
+ 0.upto(i) do |k|
+ @v[k][i+1] = 0.0
+ end
end
- 0.upto(i) do |k|
- @v[k][i+1] = 0.0
+ @size.times do |j|
+ @d[j] = @v[@size-1][j]
+ @v[@size-1][j] = 0.0
end
+ @v[@size-1][@size-1] = 1.0
+ @e[0] = 0.0
end
- @size.times do |j|
- @d[j] = @v[@size-1][j]
- @v[@size-1][j] = 0.0
- end
- @v[@size-1][@size-1] = 1.0
- @e[0] = 0.0
- end
# Symmetric tridiagonal QL algorithm.
@@ -459,7 +458,7 @@ class Matrix
high = nn-1
eps = Float::EPSILON
exshift = 0.0
- p = q = r = s = z = 0
+ p=q=r=s=z=0
# Store roots isolated by balanc and compute matrix norm
@@ -728,20 +727,20 @@ class Matrix
return
end
- (nn-1).downto(0) do |k|
- p = @d[k]
- q = @e[k]
+ (nn-1).downto(0) do |n|
+ p = @d[n]
+ q = @e[n]
# Real vector
if (q == 0)
- l = k
- @h[k][k] = 1.0
- (k-1).downto(0) do |i|
+ l = n
+ @h[n][n] = 1.0
+ (n-1).downto(0) do |i|
w = @h[i][i] - p
r = 0.0
- l.upto(k) do |j|
- r += @h[i][j] * @h[j][k]
+ l.upto(n) do |j|
+ r += @h[i][j] * @h[j][n]
end
if (@e[i] < 0.0)
z = w
@@ -750,9 +749,9 @@ class Matrix
l = i
if (@e[i] == 0.0)
if (w != 0.0)
- @h[i][k] = -r / w
+ @h[i][n] = -r / w
else
- @h[i][k] = -r / (eps * norm)
+ @h[i][n] = -r / (eps * norm)
end
# Solve real equations
@@ -762,20 +761,20 @@ class Matrix
y = @h[i+1][i]
q = (@d[i] - p) * (@d[i] - p) + @e[i] * @e[i]
t = (x * s - z * r) / q
- @h[i][k] = t
+ @h[i][n] = t
if (x.abs > z.abs)
- @h[i+1][k] = (-r - w * t) / x
+ @h[i+1][n] = (-r - w * t) / x
else
- @h[i+1][k] = (-s - y * t) / z
+ @h[i+1][n] = (-s - y * t) / z
end
end
# Overflow control
- t = @h[i][k].abs
+ t = @h[i][n].abs
if ((eps * t) * t > 1)
- i.upto(k) do |j|
- @h[j][k] = @h[j][k] / t
+ i.upto(n) do |j|
+ @h[j][n] = @h[j][n] / t
end
end
end
diff --git a/lib/matrix/lup_decomposition.rb b/lib/matrix/lup_decomposition.rb
index 9c1998fd36..30f3276253 100644
--- a/lib/matrix/lup_decomposition.rb
+++ b/lib/matrix/lup_decomposition.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
class Matrix
# Adapted from JAMA: http://math.nist.gov/javanumerics/jama/
diff --git a/lib/minitest/.document b/lib/minitest/.document
new file mode 100644
index 0000000000..6850e5befb
--- /dev/null
+++ b/lib/minitest/.document
@@ -0,0 +1,2 @@
+# Ignore README.txt, it is included in the minitest documentation.
+*.rb
diff --git a/test/lib/minitest/README.txt b/lib/minitest/README.txt
index 368cc3aa4e..368cc3aa4e 100644
--- a/test/lib/minitest/README.txt
+++ b/lib/minitest/README.txt
diff --git a/lib/minitest/autorun.rb b/lib/minitest/autorun.rb
new file mode 100644
index 0000000000..cb4a3a0e5d
--- /dev/null
+++ b/lib/minitest/autorun.rb
@@ -0,0 +1,19 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+begin
+ require 'rubygems'
+ gem 'minitest'
+rescue Gem::LoadError
+ # do nothing
+end
+
+require 'minitest/unit'
+require 'minitest/spec'
+require 'minitest/mock'
+
+MiniTest::Unit.autorun
diff --git a/test/lib/minitest/benchmark.rb b/lib/minitest/benchmark.rb
index 21f0b29d50..e233282b0a 100644
--- a/test/lib/minitest/benchmark.rb
+++ b/lib/minitest/benchmark.rb
@@ -1,7 +1,12 @@
# encoding: utf-8
-# frozen_string_literal: false
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
require 'minitest/unit'
+require 'minitest/spec'
class MiniTest::Unit # :nodoc:
def run_benchmarks # :nodoc:
diff --git a/lib/minitest/hell.rb b/lib/minitest/hell.rb
new file mode 100644
index 0000000000..827bf0e320
--- /dev/null
+++ b/lib/minitest/hell.rb
@@ -0,0 +1,20 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+require "minitest/parallel_each"
+
+# :stopdoc:
+class Minitest::Unit::TestCase
+ class << self
+ alias :old_test_order :test_order
+
+ def test_order
+ :parallel
+ end
+ end
+end
+# :startdoc:
diff --git a/test/lib/minitest/mock.rb b/lib/minitest/mock.rb
index 07e88113ea..a5b0f602f5 100644
--- a/test/lib/minitest/mock.rb
+++ b/lib/minitest/mock.rb
@@ -1,5 +1,9 @@
# encoding: utf-8
-# frozen_string_literal: false
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
class MockExpectationError < StandardError; end # :nodoc:
diff --git a/lib/minitest/parallel_each.rb b/lib/minitest/parallel_each.rb
new file mode 100644
index 0000000000..e1020b35a0
--- /dev/null
+++ b/lib/minitest/parallel_each.rb
@@ -0,0 +1,80 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+##
+# Provides a parallel #each that lets you enumerate using N threads.
+# Use environment variable N to customize. Defaults to 2. Enumerable,
+# so all the goodies come along (tho not all are wrapped yet to
+# return another ParallelEach instance).
+
+class ParallelEach
+ require 'thread'
+ include Enumerable
+
+ ##
+ # How many Threads to use for this parallel #each.
+
+ N = (ENV['N'] || 2).to_i
+
+ ##
+ # Create a new ParallelEach instance over +list+.
+
+ def initialize list
+ @queue = Queue.new # *sigh*... the Queue api sucks sooo much...
+
+ list.each { |i| @queue << i }
+ N.times { @queue << nil }
+ end
+
+ def grep pattern # :nodoc:
+ self.class.new super
+ end
+
+ def select(&block) # :nodoc:
+ self.class.new super
+ end
+
+ alias find_all select # :nodoc:
+
+ ##
+ # Starts N threads that yield each element to your block. Joins the
+ # threads at the end.
+
+ def each
+ threads = N.times.map {
+ Thread.new do
+ Thread.current.abort_on_exception = true
+ while job = @queue.pop
+ yield job
+ end
+ end
+ }
+ threads.map(&:join)
+ end
+
+ def count
+ [@queue.size - N, 0].max
+ end
+
+ alias_method :size, :count
+end
+
+class MiniTest::Unit
+ alias _old_run_suites _run_suites
+
+ ##
+ # Runs all the +suites+ for a given +type+. Runs suites declaring
+ # a test_order of +:parallel+ in parallel, and everything else
+ # serial.
+
+ def _run_suites suites, type
+ parallel, serial = suites.partition { |s| s.test_order == :parallel }
+
+ ParallelEach.new(parallel).map { |suite| _run_suite suite, type } +
+ serial.map { |suite| _run_suite suite, type }
+ end
+end
diff --git a/lib/minitest/pride.rb b/lib/minitest/pride.rb
new file mode 100644
index 0000000000..40c35394fa
--- /dev/null
+++ b/lib/minitest/pride.rb
@@ -0,0 +1,119 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+require "minitest/unit"
+
+##
+# Show your testing pride!
+
+class PrideIO
+
+ # Start an escape sequence
+ ESC = "\e["
+
+ # End the escape sequence
+ NND = "#{ESC}0m"
+
+ # The IO we're going to pipe through.
+ attr_reader :io
+
+ def initialize io # :nodoc:
+ @io = io
+ # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm
+ # also reference http://en.wikipedia.org/wiki/ANSI_escape_code
+ @colors ||= (31..36).to_a
+ @size = @colors.size
+ @index = 0
+ # io.sync = true
+ end
+
+ ##
+ # Wrap print to colorize the output.
+
+ def print o
+ case o
+ when "." then
+ io.print pride o
+ when "E", "F" then
+ io.print "#{ESC}41m#{ESC}37m#{o}#{NND}"
+ else
+ io.print o
+ end
+ end
+
+ def puts(*o) # :nodoc:
+ o.map! { |s|
+ s.to_s.sub(/Finished tests/) {
+ @index = 0
+ 'Fabulous tests'.split(//).map { |c|
+ pride(c)
+ }.join
+ }
+ }
+
+ super
+ end
+
+ ##
+ # Color a string.
+
+ def pride string
+ string = "*" if string == "."
+ c = @colors[@index % @size]
+ @index += 1
+ "#{ESC}#{c}m#{string}#{NND}"
+ end
+
+ def method_missing msg, *args # :nodoc:
+ io.send(msg, *args)
+ end
+end
+
+##
+# If you thought the PrideIO was colorful...
+#
+# (Inspired by lolcat, but with clean math)
+
+class PrideLOL < PrideIO
+ PI_3 = Math::PI / 3 # :nodoc:
+
+ def initialize io # :nodoc:
+ # walk red, green, and blue around a circle separated by equal thirds.
+ #
+ # To visualize, type this into wolfram-alpha:
+ #
+ # plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)
+
+ # 6 has wide pretty gradients. 3 == lolcat, about half the width
+ @colors = (0...(6 * 7)).map { |n|
+ n *= 1.0 / 6
+ r = (3 * Math.sin(n ) + 3).to_i
+ g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
+ b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
+
+ # Then we take rgb and encode them in a single number using base 6.
+ # For some mysterious reason, we add 16... to clear the bottom 4 bits?
+ # Yes... they're ugly.
+
+ 36 * r + 6 * g + b + 16
+ }
+
+ super
+ end
+
+ ##
+ # Make the string even more colorful. Damnit.
+
+ def pride string
+ c = @colors[@index % @size]
+ @index += 1
+ "#{ESC}38;5;#{c}m#{string}#{NND}"
+ end
+end
+
+klass = ENV['TERM'] =~ /^xterm|-256color$/ ? PrideLOL : PrideIO
+MiniTest::Unit.output = klass.new(MiniTest::Unit.output)
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
new file mode 100644
index 0000000000..d91fccf5bc
--- /dev/null
+++ b/lib/minitest/spec.rb
@@ -0,0 +1,551 @@
+# encoding: utf-8
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
+
+#!/usr/bin/ruby -w
+
+require 'minitest/unit'
+
+class Module # :nodoc:
+ def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
+ # warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
+ self.class_eval <<-EOM
+ def #{new_name} *args
+ case
+ when Proc === self then
+ MiniTest::Spec.current.#{meth}(*args, &self)
+ when #{!!dont_flip} then
+ MiniTest::Spec.current.#{meth}(self, *args)
+ else
+ MiniTest::Spec.current.#{meth}(args.first, self, *args[1..-1])
+ end
+ end
+ EOM
+ end
+
+ ##
+ # infect_with_assertions has been removed due to excessive clever.
+ # Use infect_an_assertion directly instead.
+
+ def infect_with_assertions(pos_prefix, neg_prefix,
+ skip_re,
+ dont_flip_re = /\c0/,
+ map = {})
+ abort "infect_with_assertions is dead. Use infect_an_assertion directly"
+ end
+end
+
+module Kernel # :nodoc:
+ ##
+ # Describe a series of expectations for a given target +desc+.
+ #
+ # TODO: find good tutorial url.
+ #
+ # Defines a test class subclassing from either MiniTest::Spec or
+ # from the surrounding describe's class. The surrounding class may
+ # subclass MiniTest::Spec manually in order to easily share code:
+ #
+ # class MySpec < MiniTest::Spec
+ # # ... shared code ...
+ # end
+ #
+ # class TestStuff < MySpec
+ # it "does stuff" do
+ # # shared code available here
+ # end
+ # describe "inner stuff" do
+ # it "still does stuff" do
+ # # ...and here
+ # end
+ # end
+ # end
+
+ def describe desc, additional_desc = nil, &block # :doc:
+ stack = MiniTest::Spec.describe_stack
+ name = [stack.last, desc, additional_desc].compact.join("::")
+ sclas = stack.last || if Class === self && is_a?(MiniTest::Spec::DSL) then
+ self
+ else
+ MiniTest::Spec.spec_type desc
+ end
+
+ cls = sclas.create name, desc
+
+ stack.push cls
+ cls.class_eval(&block)
+ stack.pop
+ cls
+ end
+ private :describe
+end
+
+##
+# MiniTest::Spec -- The faster, better, less-magical spec framework!
+#
+# For a list of expectations, see MiniTest::Expectations.
+
+class MiniTest::Spec < MiniTest::Unit::TestCase
+
+ ##
+ # Oh look! A MiniTest::Spec::DSL module! Eat your heart out DHH.
+
+ module DSL
+ ##
+ # Contains pairs of matchers and Spec classes to be used to
+ # calculate the superclass of a top-level describe. This allows for
+ # automatically customizable spec types.
+ #
+ # See: register_spec_type and spec_type
+
+ TYPES = [[//, MiniTest::Spec]]
+
+ ##
+ # Register a new type of spec that matches the spec's description.
+ # This method can take either a Regexp and a spec class or a spec
+ # class and a block that takes the description and returns true if
+ # it matches.
+ #
+ # Eg:
+ #
+ # register_spec_type(/Controller$/, MiniTest::Spec::Rails)
+ #
+ # or:
+ #
+ # register_spec_type(MiniTest::Spec::RailsModel) do |desc|
+ # desc.superclass == ActiveRecord::Base
+ # end
+
+ def register_spec_type(*args, &block)
+ if block then
+ matcher, klass = block, args.first
+ else
+ matcher, klass = *args
+ end
+ TYPES.unshift [matcher, klass]
+ end
+
+ ##
+ # Figure out the spec class to use based on a spec's description. Eg:
+ #
+ # spec_type("BlahController") # => MiniTest::Spec::Rails
+
+ def spec_type desc
+ TYPES.find { |matcher, klass|
+ if matcher.respond_to? :call then
+ matcher.call desc
+ else
+ matcher === desc.to_s
+ end
+ }.last
+ end
+
+ def describe_stack # :nodoc:
+ Thread.current[:describe_stack] ||= []
+ end
+
+ ##
+ # Returns the children of this spec.
+
+ def children
+ @children ||= []
+ end
+
+ def nuke_test_methods! # :nodoc:
+ self.public_instance_methods.grep(/^test_/).each do |name|
+ self.send :undef_method, name
+ end
+ end
+
+ ##
+ # Define a 'before' action. Inherits the way normal methods should.
+ #
+ # NOTE: +type+ is ignored and is only there to make porting easier.
+ #
+ # Equivalent to MiniTest::Unit::TestCase#setup.
+
+ def before type = nil, &block
+ define_method :setup do
+ super()
+ self.instance_eval(&block)
+ end
+ end
+
+ ##
+ # Define an 'after' action. Inherits the way normal methods should.
+ #
+ # NOTE: +type+ is ignored and is only there to make porting easier.
+ #
+ # Equivalent to MiniTest::Unit::TestCase#teardown.
+
+ def after type = nil, &block
+ define_method :teardown do
+ self.instance_eval(&block)
+ super()
+ end
+ end
+
+ ##
+ # Define an expectation with name +desc+. Name gets morphed to a
+ # proper test method name. For some freakish reason, people who
+ # write specs don't like class inheritance, so this goes way out of
+ # its way to make sure that expectations aren't inherited.
+ #
+ # This is also aliased to #specify and doesn't require a +desc+ arg.
+ #
+ # Hint: If you _do_ want inheritence, use minitest/unit. You can mix
+ # and match between assertions and expectations as much as you want.
+
+ def it desc = "anonymous", &block
+ block ||= proc { skip "(no tests defined)" }
+
+ @specs ||= 0
+ @specs += 1
+
+ name = "test_%04d_%s" % [ @specs, desc ]
+
+ define_method name, &block
+
+ self.children.each do |mod|
+ mod.send :undef_method, name if mod.public_method_defined? name
+ end
+
+ name
+ end
+
+ ##
+ # Essentially, define an accessor for +name+ with +block+.
+ #
+ # Why use let instead of def? I honestly don't know.
+
+ def let name, &block
+ define_method name do
+ @_memoized ||= {}
+ @_memoized.fetch(name) { |k| @_memoized[k] = instance_eval(&block) }
+ end
+ end
+
+ ##
+ # Another lazy man's accessor generator. Made even more lazy by
+ # setting the name for you to +subject+.
+
+ def subject &block
+ let :subject, &block
+ end
+
+ def create name, desc # :nodoc:
+ cls = Class.new(self) do
+ @name = name
+ @desc = desc
+
+ nuke_test_methods!
+ end
+
+ children << cls
+
+ cls
+ end
+
+ def name # :nodoc:
+ defined?(@name) ? @name : super
+ end
+
+ def to_s # :nodoc:
+ name # Can't alias due to 1.8.7, not sure why
+ end
+
+ # :stopdoc:
+ attr_reader :desc
+ alias :specify :it
+ # :startdoc:
+ end
+
+ extend DSL
+
+ TYPES = DSL::TYPES # :nodoc:
+end
+
+##
+# It's where you hide your "assertions".
+
+module MiniTest::Expectations
+ ##
+ # See MiniTest::Assertions#assert_empty.
+ #
+ # collection.must_be_empty
+ #
+ # :method: must_be_empty
+
+ infect_an_assertion :assert_empty, :must_be_empty, :unary
+
+ ##
+ # See MiniTest::Assertions#assert_equal
+ #
+ # a.must_equal b
+ #
+ # :method: must_equal
+
+ infect_an_assertion :assert_equal, :must_equal
+
+ ##
+ # See MiniTest::Assertions#assert_in_delta
+ #
+ # n.must_be_close_to m [, delta]
+ #
+ # :method: must_be_close_to
+
+ infect_an_assertion :assert_in_delta, :must_be_close_to
+
+ alias :must_be_within_delta :must_be_close_to # :nodoc:
+
+ ##
+ # See MiniTest::Assertions#assert_in_epsilon
+ #
+ # n.must_be_within_epsilon m [, epsilon]
+ #
+ # :method: must_be_within_epsilon
+
+ infect_an_assertion :assert_in_epsilon, :must_be_within_epsilon
+
+ ##
+ # See MiniTest::Assertions#assert_includes
+ #
+ # collection.must_include obj
+ #
+ # :method: must_include
+
+ infect_an_assertion :assert_includes, :must_include, :reverse
+
+ ##
+ # See MiniTest::Assertions#assert_instance_of
+ #
+ # obj.must_be_instance_of klass
+ #
+ # :method: must_be_instance_of
+
+ infect_an_assertion :assert_instance_of, :must_be_instance_of
+
+ ##
+ # See MiniTest::Assertions#assert_kind_of
+ #
+ # obj.must_be_kind_of mod
+ #
+ # :method: must_be_kind_of
+
+ infect_an_assertion :assert_kind_of, :must_be_kind_of
+
+ ##
+ # See MiniTest::Assertions#assert_match
+ #
+ # a.must_match b
+ #
+ # :method: must_match
+
+ infect_an_assertion :assert_match, :must_match
+
+ ##
+ # See MiniTest::Assertions#assert_nil
+ #
+ # obj.must_be_nil
+ #
+ # :method: must_be_nil
+
+ infect_an_assertion :assert_nil, :must_be_nil, :unary
+
+ ##
+ # See MiniTest::Assertions#assert_operator
+ #
+ # n.must_be :<=, 42
+ #
+ # This can also do predicates:
+ #
+ # str.must_be :empty?
+ #
+ # :method: must_be
+
+ infect_an_assertion :assert_operator, :must_be, :reverse
+
+ ##
+ # See MiniTest::Assertions#assert_output
+ #
+ # proc { ... }.must_output out_or_nil [, err]
+ #
+ # :method: must_output
+
+ infect_an_assertion :assert_output, :must_output
+
+ ##
+ # See MiniTest::Assertions#assert_raises
+ #
+ # proc { ... }.must_raise exception
+ #
+ # :method: must_raise
+
+ infect_an_assertion :assert_raises, :must_raise
+
+ ##
+ # See MiniTest::Assertions#assert_respond_to
+ #
+ # obj.must_respond_to msg
+ #
+ # :method: must_respond_to
+
+ infect_an_assertion :assert_respond_to, :must_respond_to, :reverse
+
+ ##
+ # See MiniTest::Assertions#assert_same
+ #
+ # a.must_be_same_as b
+ #
+ # :method: must_be_same_as
+
+ infect_an_assertion :assert_same, :must_be_same_as
+
+ ##
+ # See MiniTest::Assertions#assert_send
+ # TODO: remove me
+ #
+ # a.must_send
+ #
+ # :method: must_send
+
+ infect_an_assertion :assert_send, :must_send
+
+ ##
+ # See MiniTest::Assertions#assert_silent
+ #
+ # proc { ... }.must_be_silent
+ #
+ # :method: must_be_silent
+
+ infect_an_assertion :assert_silent, :must_be_silent
+
+ ##
+ # See MiniTest::Assertions#assert_throws
+ #
+ # proc { ... }.must_throw sym
+ #
+ # :method: must_throw
+
+ infect_an_assertion :assert_throws, :must_throw
+
+ ##
+ # See MiniTest::Assertions#refute_empty
+ #
+ # collection.wont_be_empty
+ #
+ # :method: wont_be_empty
+
+ infect_an_assertion :refute_empty, :wont_be_empty, :unary
+
+ ##
+ # See MiniTest::Assertions#refute_equal
+ #
+ # a.wont_equal b
+ #
+ # :method: wont_equal
+
+ infect_an_assertion :refute_equal, :wont_equal
+
+ ##
+ # See MiniTest::Assertions#refute_in_delta
+ #
+ # n.wont_be_close_to m [, delta]
+ #
+ # :method: wont_be_close_to
+
+ infect_an_assertion :refute_in_delta, :wont_be_close_to
+
+ alias :wont_be_within_delta :wont_be_close_to # :nodoc:
+
+ ##
+ # See MiniTest::Assertions#refute_in_epsilon
+ #
+ # n.wont_be_within_epsilon m [, epsilon]
+ #
+ # :method: wont_be_within_epsilon
+
+ infect_an_assertion :refute_in_epsilon, :wont_be_within_epsilon
+
+ ##
+ # See MiniTest::Assertions#refute_includes
+ #
+ # collection.wont_include obj
+ #
+ # :method: wont_include
+
+ infect_an_assertion :refute_includes, :wont_include, :reverse
+
+ ##
+ # See MiniTest::Assertions#refute_instance_of
+ #
+ # obj.wont_be_instance_of klass
+ #
+ # :method: wont_be_instance_of
+
+ infect_an_assertion :refute_instance_of, :wont_be_instance_of
+
+ ##
+ # See MiniTest::Assertions#refute_kind_of
+ #
+ # obj.wont_be_kind_of mod
+ #
+ # :method: wont_be_kind_of
+
+ infect_an_assertion :refute_kind_of, :wont_be_kind_of
+
+ ##
+ # See MiniTest::Assertions#refute_match
+ #
+ # a.wont_match b
+ #
+ # :method: wont_match
+
+ infect_an_assertion :refute_match, :wont_match
+
+ ##
+ # See MiniTest::Assertions#refute_nil
+ #
+ # obj.wont_be_nil
+ #
+ # :method: wont_be_nil
+
+ infect_an_assertion :refute_nil, :wont_be_nil, :unary
+
+ ##
+ # See MiniTest::Assertions#refute_operator
+ #
+ # n.wont_be :<=, 42
+ #
+ # This can also do predicates:
+ #
+ # str.wont_be :empty?
+ #
+ # :method: wont_be
+
+ infect_an_assertion :refute_operator, :wont_be, :reverse
+
+ ##
+ # See MiniTest::Assertions#refute_respond_to
+ #
+ # obj.wont_respond_to msg
+ #
+ # :method: wont_respond_to
+
+ infect_an_assertion :refute_respond_to, :wont_respond_to, :reverse
+
+ ##
+ # See MiniTest::Assertions#refute_same
+ #
+ # a.wont_be_same_as b
+ #
+ # :method: wont_be_same_as
+
+ infect_an_assertion :refute_same, :wont_be_same_as
+end
+
+class Object # :nodoc:
+ include MiniTest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
+end
diff --git a/test/lib/minitest/unit.rb b/lib/minitest/unit.rb
index 62f89e97e5..465e5b4c98 100644
--- a/test/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -1,9 +1,12 @@
# encoding: utf-8
-# frozen_string_literal: false
+######################################################################
+# This file is imported from the minitest project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis.
+######################################################################
require "optparse"
require "rbconfig"
-require "leakchecker"
##
# Minimal (mostly drop-in) replacement for test-unit.
@@ -74,6 +77,12 @@ module MiniTest
# printed if the assertion fails.
module Assertions
+ UNDEFINED = Object.new # :nodoc:
+
+ def UNDEFINED.inspect # :nodoc:
+ "UNDEFINED" # again with the rdoc bugs... :(
+ end
+
##
# Returns the diff command to use in #diff. Tries to intelligently
# figure out what diff to use.
@@ -126,16 +135,11 @@ module MiniTest
return "Expected: #{mu_pp exp}\n Actual: #{mu_pp act}" unless
need_to_diff
- tempfile_a = nil
- tempfile_b = nil
-
Tempfile.open("expect") do |a|
- tempfile_a = a
a.puts expect
a.flush
Tempfile.open("butwas") do |b|
- tempfile_b = b
b.puts butwas
b.flush
@@ -156,9 +160,6 @@ module MiniTest
end
result
- ensure
- tempfile_a.close! if tempfile_a
- tempfile_b.close! if tempfile_b
end
##
@@ -306,8 +307,8 @@ module MiniTest
#
# assert_operator 5, :<=, 4
- def assert_operator o1, op, o2 = (predicate = true; nil), msg = nil
- return assert_predicate o1, op, msg if predicate
+ def assert_operator o1, op, o2 = UNDEFINED, msg = nil
+ return assert_predicate o1, op, msg if UNDEFINED == o2
msg = message(msg) { "Expected #{mu_pp(o1)} to be #{op} #{mu_pp(o2)}" }
assert o1.__send__(op, o2), msg
end
@@ -518,12 +519,10 @@ module MiniTest
[captured_stdout.read, captured_stderr.read]
ensure
+ captured_stdout.unlink
+ captured_stderr.unlink
$stdout.reopen orig_stdout
$stderr.reopen orig_stderr
- orig_stdout.close
- orig_stderr.close
- captured_stdout.close!
- captured_stderr.close!
end
end
end
@@ -671,8 +670,8 @@ module MiniTest
# refute_operator 1, :>, 2 #=> pass
# refute_operator 1, :<, 2 #=> fail
- def refute_operator o1, op, o2 = (predicate = true; nil), msg = nil
- return refute_predicate o1, op, msg if predicate
+ def refute_operator o1, op, o2 = UNDEFINED, msg = nil
+ return refute_predicate o1, op, msg if UNDEFINED == o2
msg = message(msg) { "Expected #{mu_pp(o1)} to not be #{op} #{mu_pp(o2)}"}
refute o1.__send__(op, o2), msg
end
@@ -908,6 +907,8 @@ module MiniTest
##
# Runs all the +suites+ for a given +type+.
#
+ # NOTE: this method is redefined in parallel_each.rb, which is
+ # loaded if a test-suite calls parallelize_me!.
def _run_suites suites, type
suites.map { |suite| _run_suite suite, type }
@@ -929,8 +930,6 @@ module MiniTest
filter === m || filter === "#{suite}##{m}"
}
- leakchecker = LeakChecker.new
-
assertions = filtered_test_methods.map { |method|
inst = suite.new method
inst._assertions = 0
@@ -943,9 +942,6 @@ module MiniTest
print "%.2f s = " % (Time.now - start_time) if @verbose
print result
puts if @verbose
- $stdout.flush
-
- leakchecker.check("#{inst.class}\##{inst.__name__}")
inst._assertions
}
@@ -1330,6 +1326,18 @@ module MiniTest
reset
##
+ # Call this at the top of your tests when you absolutely
+ # positively need to have ordered tests. In doing so, you're
+ # admitting that you suck and your tests are weak.
+
+ def self.i_suck_and_my_tests_are_order_dependent!
+ class << self
+ undef_method :test_order if method_defined? :test_order
+ define_method :test_order do :alpha end
+ end
+ end
+
+ ##
# Make diffs for this TestCase use #pretty_inspect so that diff
# in assert_equal can be more details. NOTE: this is much slower
# than the regular inspect but much more usable for complex
@@ -1343,6 +1351,20 @@ module MiniTest
end
end
+ ##
+ # Call this at the top of your tests when you want to run your
+ # tests in parallel. In doing so, you're admitting that you rule
+ # and your tests are awesome.
+
+ def self.parallelize_me!
+ require "minitest/parallel_each"
+
+ class << self
+ undef_method :test_order if method_defined? :test_order
+ define_method :test_order do :parallel end
+ end
+ end
+
def self.inherited klass # :nodoc:
@@test_suites[klass] = true
super
@@ -1395,8 +1417,6 @@ module MiniTest
include MiniTest::Assertions
end # class TestCase
end # class Unit
-
- Test = Unit::TestCase
end # module MiniTest
Minitest = MiniTest # :nodoc: because ugh... I typo this all the time
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 68f0b39216..a3a39dfe3c 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1,5 +1,4 @@
# -*- coding: us-ascii -*-
-# frozen-string-literal: false
# module to create Makefile for extension modules
# invoke like: ruby -r mkmf extconf.rb
@@ -72,7 +71,7 @@ module MakeMakefile
# Extensions for files complied with a C++ compiler
CXX_EXT = %w[cc mm cxx cpp]
- unless File.exist?(File.join(*File.split(__FILE__).tap {|d, b| b.swapcase}))
+ if File::FNM_SYSCASE.zero?
CXX_EXT.concat(%w[C])
end
@@ -133,6 +132,8 @@ module MakeMakefile
$mingw = /mingw/ =~ RUBY_PLATFORM
$cygwin = /cygwin/ =~ RUBY_PLATFORM
$netbsd = /netbsd/ =~ RUBY_PLATFORM
+ $os2 = /os2/ =~ RUBY_PLATFORM
+ $beos = /beos/ =~ RUBY_PLATFORM
$haiku = /haiku/ =~ RUBY_PLATFORM
$solaris = /solaris/ =~ RUBY_PLATFORM
$universal = /universal/ =~ RUBY_PLATFORM
@@ -386,9 +387,8 @@ module MakeMakefile
if opts and opts[:werror]
result = nil
Logging.postpone do |log|
- output = IO.popen(libpath_env, command, &:read)
- result = ($?.success? and File.zero?(log.path))
- output
+ result = (system(libpath_env, command) and File.zero?(log.path))
+ ""
end
result
else
@@ -568,7 +568,7 @@ MSG
# [+src+] a String which contains a C source
# [+opt+] a String which contains compiler options
def try_compile(src, opt="", *opts, &b)
- with_werror(opt, *opts) {|_opt, *| try_do(src, cc_command(_opt), *opts, &b)} and
+ with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)} and
File.file?("#{CONFTEST}.#{$OBJEXT}")
ensure
MakeMakefile.rm_f "#{CONFTEST}*"
@@ -609,17 +609,9 @@ MSG
$CPPFLAGS = cppflags unless ret
end
- def try_cppflags(flags, opts = {})
- try_header(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
- end
-
- def append_cppflags(flags, *opts)
- Array(flags).each do |flag|
- if checking_for("whether #{flag} is accepted as CPPFLAGS") {
- try_cppflags(flag, *opts)
- }
- $CPPFLAGS << " " << flag
- end
+ def try_cppflags(flags)
+ with_cppflags(flags) do
+ try_header("int main() {return 0;}")
end
end
@@ -631,17 +623,9 @@ MSG
$CFLAGS = cflags unless ret
end
- def try_cflags(flags, opts = {})
- try_compile(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
- end
-
- def append_cflags(flags, *opts)
- Array(flags).each do |flag|
- if checking_for("whether #{flag} is accepted as CFLAGS") {
- try_cflags(flag, *opts)
- }
- $CFLAGS << " " << flag
- end
+ def try_cflags(flags)
+ with_cflags(flags) do
+ try_compile("int main() {return 0;}")
end
end
@@ -653,17 +637,9 @@ MSG
$LDFLAGS = ldflags unless ret
end
- def try_ldflags(flags, opts = {})
- try_link(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
- end
-
- def append_ldflags(flags, *opts)
- Array(flags).each do |flag|
- if checking_for("whether #{flag} is accepted as LDFLAGS") {
- try_ldflags(flag, *opts)
- }
- $LDFLAGS << " " << flag
- end
+ def try_ldflags(flags)
+ with_ldflags(flags) do
+ try_link("int main() {return 0;}")
end
end
@@ -691,6 +667,7 @@ SRC
return nil
end
upper = 1
+ lower = 0
until try_static_assert("#{const} <= #{upper}", headers, opt)
lower = upper
upper <<= 1
@@ -767,14 +744,13 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const
/*top*/
extern int t(void);
#{MAIN_DOES_NOTHING 't'}
-int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return !p; }
+int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; }
SRC
call && try_link(<<"SRC", opt, &b)
#{headers}
/*top*/
extern int t(void);
#{MAIN_DOES_NOTHING 't'}
-#{"extern void #{call};" if decltype}
int t(void) { #{call}; return 0; }
SRC
end
@@ -787,7 +763,7 @@ SRC
/*top*/
extern int t(void);
#{MAIN_DOES_NOTHING 't'}
-int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return !p; }
+int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
SRC
end
@@ -1117,11 +1093,11 @@ SRC
checking_for fw do
src = cpp_include("#{fw}/#{header}") << "\n" "int main(void){return 0;}"
opt = " -framework #{fw}"
- if try_link(src, opt, &b) or (objc = try_link(src, "-ObjC#{opt}", &b))
+ if try_link(src, "-ObjC#{opt}", &b)
$defs.push(format("-DHAVE_FRAMEWORK_%s", fw.tr_cpp))
# TODO: non-worse way than this hack, to get rid of separating
# option and its argument.
- $LDFLAGS << " -ObjC" if objc and /(\A|\s)-ObjC(\s|\z)/ !~ $LDFLAGS
+ $LDFLAGS << " -ObjC" unless /(\A|\s)-ObjC(\s|\z)/ =~ $LDFLAGS
$LIBS << opt
true
else
@@ -1325,7 +1301,7 @@ SRC
#
def check_sizeof(type, headers = nil, opts = "", &b)
typedef, member, prelude = typedef_expr(type, headers)
- prelude << "#{typedef} *rbcv_ptr_;\n"
+ prelude << "static #{typedef} *rbcv_ptr_;\n"
prelude = [prelude]
expr = "sizeof((*rbcv_ptr_)#{"." << member if member})"
fmt = STRING_OR_FAILED_FORMAT
@@ -1478,7 +1454,7 @@ SRC
prelude = [cpp_include(headers).split(/^/)]
prelude << ["typedef #{type} rbcv_typedef_;\n",
"extern rbcv_typedef_ *#{func};\n",
- "rbcv_typedef_ #{var};\n",
+ "static rbcv_typedef_ #{var};\n",
]
type = "rbcv_typedef_"
fmt = member && !(typeof = have_typeof?) ? "seems %s" : "%s"
@@ -1489,7 +1465,7 @@ SRC
type = "rbcv_mem_typedef_"
prelude[-1] << "typedef #{typeof}(#{val}) #{type};\n"
prelude[-1] << "extern #{type} *#{func};\n"
- prelude[-1] << "#{type} #{var};\n"
+ prelude[-1] << "static #{type} #{var};\n"
val = var
end
def fmt.%(x)
@@ -1512,7 +1488,7 @@ SRC
type = UNIVERSAL_INTS.find do |t|
pre = prelude
unless member
- pre += [["#{unsigned} #{t} #{ptr}#{var};\n",
+ pre += [["static #{unsigned} #{t} #{ptr}#{var};\n",
"extern #{unsigned} #{t} #{ptr}*#{func};\n"]]
end
try_static_assert("sizeof(#{ptr}#{val}) == sizeof(#{unsigned} #{t})", pre)
@@ -1701,28 +1677,13 @@ SRC
$extconf_h = header
end
- # call-seq:
- # dir_config(target)
- # dir_config(target, prefix)
- # dir_config(target, idefault, ldefault)
+ # Sets a +target+ name that the user can then use to configure various
+ # "with" options with on the command line by using that name. For example,
+ # if the target is set to "foo", then the user could use the
+ # <code>--with-foo-dir</code> command line option.
#
- # Sets a +target+ name that the user can then use to configure
- # various "with" options with on the command line by using that
- # name. For example, if the target is set to "foo", then the user
- # could use the <code>--with-foo-dir=prefix</code>,
- # <code>--with-foo-include=dir</code> and
- # <code>--with-foo-lib=dir</code> command line options to tell where
- # to search for header/library files.
- #
- # You may pass along additional parameters to specify default
- # values. If one is given it is taken as default +prefix+, and if
- # two are given they are taken as "include" and "lib" defaults in
- # that order.
- #
- # In any case, the return value will be an array of determined
- # "include" and "lib" directories, either of which can be nil if no
- # corresponding command line option is given when no default value
- # is specified.
+ # You may pass along additional "include" or "lib" defaults via the
+ # +idefault+ and +ldefault+ parameters, respectively.
#
# Note that dir_config only adds to the list of places to search for
# libraries and include files. It does not link the libraries into your
@@ -1784,52 +1745,27 @@ SRC
def pkg_config(pkg, option=nil)
if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
# iff package specific config command is given
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
elsif ($PKGCONFIG ||=
(pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
find_executable0(pkgconfig) && pkgconfig) and
- xsystem("#{$PKGCONFIG} --exists #{pkg}")
+ system("#{$PKGCONFIG} --exists #{pkg}")
# default to pkg-config command
- pkgconfig = $PKGCONFIG
- get = proc {|opt|
- opt = xpopen("#{$PKGCONFIG} --#{opt} #{pkg}", err:[:child, :out], &:read)
- Logging.open {puts opt.each_line.map{|s|"=> #{s.inspect}"}}
- opt.strip if $?.success?
- }
+ get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.strip}
elsif find_executable0(pkgconfig = "#{pkg}-config")
# default to package specific config command, as a last resort.
- else
- pkgconfig = nil
- end
- if pkgconfig
- get ||= proc {|opt|
- opt = xpopen("#{pkgconfig} --#{opt}", err:[:child, :out], &:read)
- Logging.open {puts opt.each_line.map{|s|"=> #{s.inspect}"}}
- opt.strip if $?.success?
- }
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
end
orig_ldflags = $LDFLAGS
if get and option
get[option]
elsif get and try_ldflags(ldflags = get['libs'])
- if incflags = get['cflags-only-I']
- $INCFLAGS << " " << incflags
- cflags = get['cflags-only-other']
- else
- cflags = get['cflags']
- end
+ cflags = get['cflags']
libs = get['libs-only-l']
- if cflags
- $CFLAGS += " " << cflags
- $CXXFLAGS += " " << cflags
- end
- if libs
- ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
- else
- libs, ldflags = Shellwords.shellwords(ldflags).partition {|s| s =~ /-l([^ ]+)/ }.map {|l|l.quote.join(" ")}
- end
- $libs += " " << libs
-
+ ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
+ $CFLAGS += " " << cflags
$LDFLAGS = [orig_ldflags, ldflags].join(' ')
+ $libs += " " << libs
Logging::message "package configuration for %s\n", pkg
Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
cflags, ldflags, libs
@@ -1897,7 +1833,6 @@ Q1 = $(V:1=)
Q = $(Q1:0=@)
ECHO1 = $(V:1=@#{CONFIG['NULLCMD']})
ECHO = $(ECHO1:0=@echo)
-NULLCMD = #{CONFIG['NULLCMD']}
#### Start of system configuration section. ####
#{"top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/") if $extmk}
@@ -1914,7 +1849,6 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
prefix = mkintpath(CONFIG["prefix"])
if destdir = prefix[$dest_prefix_pattern, 1]
mk << "\nDESTDIR = #{destdir}\n"
- prefix = prefix[destdir.size..-1]
end
mk << "prefix = #{with_destdir(prefix).unspace}\n"
CONFIG.each do |key, var|
@@ -1922,7 +1856,7 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
end
CONFIG.each do |key, var|
next if /^abs_/ =~ key
- next if /^(?:src|top(?:_src)?|build|hdr)dir$/ =~ key
+ next if /^(?:src|top|hdr)dir$/ =~ key
next unless /dir$/ =~ key
mk << "#{key} = #{with_destdir(var)}\n"
end
@@ -1962,7 +1896,6 @@ COUTFLAG = #{COUTFLAG}$(empty)
RUBY_EXTCONF_H = #{$extconf_h}
cflags = #{CONFIG['cflags']}
-cxxflags = #{CONFIG['cxxflags']}
optflags = #{CONFIG['optflags']}
debugflags = #{CONFIG['debugflags']}
warnflags = #{$warnflags}
@@ -1971,7 +1904,7 @@ CFLAGS = $(CCDLFLAGS) #$CFLAGS $(ARCH_FLAG)
INCFLAGS = -I. #$INCFLAGS
DEFS = #{CONFIG['DEFS']}
CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
-CXXFLAGS = $(CCDLFLAGS) #$CXXFLAGS $(ARCH_FLAG)
+CXXFLAGS = $(CCDLFLAGS) #{CONFIG['CXXFLAGS']} $(ARCH_FLAG)
ldflags = #{$LDFLAGS}
dldflags = #{$DLDFLAGS} #{CONFIG['EXTDLDFLAGS']}
ARCH_FLAG = #{$ARCH_FLAG}
@@ -2086,10 +2019,7 @@ RULES
implicit = [[m[1], m[2]], [m.post_match]]
next
elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
- line.sub!(/\s*\#.*$/, '')
- comment = $&
- line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
- line = line.chomp + comment + "\n" if comment
+ line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
end
depout << line
end
@@ -2225,10 +2155,10 @@ RULES
if File.exist?(File.join(srcdir, target + '.def'))
deffile = "$(srcdir)/$(TARGET).def"
unless EXPORT_PREFIX.empty?
- makedef = %{$(RUBY) -pe "$$_.sub!(/^(?=\\w)/,'#{EXPORT_PREFIX}') unless 1../^EXPORTS$/i" #{deffile}}
+ makedef = %{-pe "$_.sub!(/^(?=\\w)/,'#{EXPORT_PREFIX}') unless 1../^EXPORTS$/i"}
end
else
- makedef = %{(echo EXPORTS && echo $(TARGET_ENTRY))}
+ makedef = %{-e "puts 'EXPORTS', '$(TARGET_ENTRY)'"}
end
if makedef
$cleanfiles << '$(DEFFILE)'
@@ -2295,7 +2225,7 @@ CLEANLIBS = #{n}.#{CONFIG['DLEXT']} #{config_string('cleanlibs') {|t| t.gsub
CLEANOBJS = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, "$(TARGET)#{deffile ? '-$(arch)': ''}")} if target} *.bak
all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
-static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{$extout ? " install-rb" : ""}"}
+static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
.PHONY: all install static install-so install-rb
.PHONY: clean clean-so clean-static clean-rb
"
@@ -2306,7 +2236,7 @@ static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{$extout ? " install-rb" :
fseprepl = proc {|s|
s = s.gsub("/", fsep)
s = s.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
- s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
+ s = s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
}
rsep = ":#{fsep}=/"
else
@@ -2321,14 +2251,13 @@ static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{$extout ? " install-rb" :
if target
f = "$(DLLIB)"
dest = "#{dir}/#{f}"
- stamp = timestamp_file(dir, target_prefix)
if $extout
mfile.puts dest
mfile.print "clean-so::\n"
- mfile.print "\t-$(Q)$(RM) #{fseprepl[dest]} #{fseprepl[stamp]}\n"
+ mfile.print "\t-$(Q)$(RM) #{fseprepl[dest]}\n"
mfile.print "\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n"
else
- mfile.print "#{f} #{stamp}\n"
+ mfile.print "#{f} #{timestamp_file(dir, target_prefix)}\n"
mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} #{dir}\n"
if defined?($installed_list)
mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
@@ -2354,7 +2283,7 @@ static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{$extout ? " install-rb" :
dest = "#{dir}/#{File.basename(f)}"
mfile.print("install-rb#{sfx}: #{dest}\n")
mfile.print("#{dest}: #{f} #{timestamp_file(dir, target_prefix)}\n")
- mfile.print("\t$(Q) $(#{$extout ? 'COPY' : 'INSTALL_DATA'}) #{f} $(@D)\n")
+ mfile.print("\t$(Q) $(#{$extout ? 'COPY' : 'INSTALL_DATA'}) #{f} $(@D#{sep})\n")
if defined?($installed_list) and !$extout
mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n")
end
@@ -2365,18 +2294,12 @@ static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{$extout ? " install-rb" :
end
end
mfile.print "pre-install-rb#{sfx}:\n"
- if files.empty?
- mfile.print("\t@$(NULLCMD)\n")
- else
- mfile.print("\t$(ECHO) installing#{sfx.sub(/^-/, " ")} #{target} libraries\n")
- end
+ mfile.print("\t$(ECHO) installing#{sfx.sub(/^-/, " ")} #{target} libraries\n")
if $extout
dirs.uniq!
unless dirs.empty?
mfile.print("clean-rb#{sfx}::\n")
for dir in dirs.sort_by {|d| -d.count('/')}
- stamp = timestamp_file(dir, target_prefix)
- mfile.print("\t-$(Q)$(RM) #{fseprepl[stamp]}\n")
mfile.print("\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n")
end
end
@@ -2399,28 +2322,20 @@ site-install-rb: install-rb
return unless target
mfile.puts SRC_EXT.collect {|e| ".path.#{e} = $(VPATH)"} if $nmake == ?b
- mfile.print ".SUFFIXES: .#{(SRC_EXT + [$OBJEXT, $ASMEXT]).compact.join(' .')}\n"
+ mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
mfile.print "\n"
compile_command = "\n\t$(ECHO) compiling $(<#{rsep})\n\t$(Q) %s\n\n"
- command = compile_command % COMPILE_CXX
- asm_command = compile_command.sub(/compiling/, 'translating') % ASSEMBLE_CXX
CXX_EXT.each do |e|
each_compile_rules do |rule|
mfile.printf(rule, e, $OBJEXT)
- mfile.print(command)
- mfile.printf(rule, e, $ASMEXT)
- mfile.print(asm_command)
+ mfile.printf(compile_command, COMPILE_CXX)
end
end
- command = compile_command % COMPILE_C
- asm_command = compile_command.sub(/compiling/, 'translating') % ASSEMBLE_C
C_EXT.each do |e|
each_compile_rules do |rule|
mfile.printf(rule, e, $OBJEXT)
- mfile.print(command)
- mfile.printf(rule, e, $ASMEXT)
- mfile.print(asm_command)
+ mfile.printf(compile_command, COMPILE_C)
end
end
@@ -2449,7 +2364,7 @@ site-install-rb: install-rb
if makedef
mfile.print "$(DEFFILE): #{origdef}\n"
mfile.print "\t$(ECHO) generating $(@#{rsep})\n"
- mfile.print "\t$(Q) #{makedef} > $@\n\n"
+ mfile.print "\t$(Q) $(RUBY) #{makedef} #{origdef} > $@\n\n"
end
depend = File.join(srcdir, "depend")
@@ -2475,9 +2390,6 @@ site-install-rb: install-rb
if $warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes'
# turn warnings into errors only for bundled extensions.
config['warnflags'] = $warnflags.gsub(/(\A|\s)-Werror[-=]/, '\1-W')
- if /icc\z/ =~ config['CC']
- config['warnflags'].gsub!(/(\A|\s)-W(?:division-by-zero|deprecated-declarations)/, '\1')
- end
RbConfig.expand(rbconfig['warnflags'] = config['warnflags'].dup)
config.each do |key, val|
RbConfig.expand(rbconfig[key] = val.dup) if /warnflags/ =~ val
@@ -2485,7 +2397,6 @@ site-install-rb: install-rb
$warnflags = config['warnflags'] unless $extmk
end
$CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
- $CXXFLAGS = (with_config("cxxflags", arg_config("CXXFLAGS", config["CXXFLAGS"]))||'').dup
$ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG", config["ARCH_FLAG"])).dup
$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
$LDFLAGS = with_config("ldflags", arg_config("LDFLAGS", config["LDFLAGS"])).dup
@@ -2496,7 +2407,6 @@ site-install-rb: install-rb
$LIBEXT = config['LIBEXT'].dup
$OBJEXT = config["OBJEXT"].dup
$EXEEXT = config["EXEEXT"].dup
- $ASMEXT = config_string('ASMEXT', &:dup) || 'S'
$LIBS = "#{config['LIBS']} #{config['DLDLIBS']}"
$LIBRUBYARG = ""
$LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
@@ -2577,6 +2487,8 @@ MESSAGE
case
when $mswin
$nmake = ?m if /nmake/i =~ make
+ when $bccwin
+ $nmake = ?b if /Borland/i =~ `#{make} -h`
end
$ignore_error = $nmake ? '' : ' 2> /dev/null || true'
@@ -2595,8 +2507,6 @@ MESSAGE
$configure_args["--topdir"] ||= $curdir
$ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
- RbConfig.expand(CONFIG["RUBY_SO_NAME"])
-
# :startdoc:
split = Shellwords.method(:shellwords).to_proc
@@ -2643,16 +2553,6 @@ MESSAGE
COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
##
- # Command which will translate C files to assembler sources in the generated Makefile
-
- ASSEMBLE_C = config_string('ASSEMBLE_C') || COMPILE_C.sub(/(?<=\s)-c(?=\s)/, '-S')
-
- ##
- # Command which will translate C++ files to assembler sources in the generated Makefile
-
- ASSEMBLE_CXX = config_string('ASSEMBLE_CXX') || COMPILE_CXX.sub(/(?<=\s)-c(?=\s)/, '-S')
-
- ##
# Command which will compile a program in order to test linking a library
TRY_LINK = config_string('TRY_LINK') ||
diff --git a/lib/monitor.rb b/lib/monitor.rb
index 73741f8ddb..07394b5900 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = monitor.rb
#
# Copyright (C) 2001 Shugo Maeda <shugo@ruby-lang.org>
@@ -171,7 +170,6 @@ module MonitorMixin
return false
end
@mon_owner = Thread.current
- @mon_count = 0
end
@mon_count += 1
return true
@@ -186,7 +184,6 @@ module MonitorMixin
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
- @mon_count = 0
end
@mon_count += 1
end
diff --git a/lib/mutex_m.rb b/lib/mutex_m.rb
index 627355151e..6698cb5ac6 100644
--- a/lib/mutex_m.rb
+++ b/lib/mutex_m.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# mutex_m.rb -
# $Release Version: 3.0$
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 0437e9504e..c22b9636d5 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#
# = net/ftp.rb - FTP Client Library
#
@@ -18,7 +17,6 @@
require "socket"
require "monitor"
require "net/protocol"
-require "time"
module Net
@@ -80,13 +78,12 @@ module Net
FTP_PORT = 21
CRLF = "\r\n"
DEFAULT_BLOCKSIZE = BufferedIO::BUFSIZE
- @@default_passive = true
# :startdoc:
# When +true+, transfers are performed in binary mode. Default: +true+.
attr_reader :binary
- # When +true+, the connection is in passive mode. Default: +true+.
+ # When +true+, the connection is in passive mode. Default: +false+.
attr_accessor :passive
# When +true+, all traffic to and from the server is written
@@ -106,7 +103,7 @@ module Net
# Number of seconds to wait for one block to be read (via one read(2)
# call). Any number may be used, including Floats for fractional
# seconds. If the FTP object cannot read data in this many seconds,
- # it raises a Timeout::Error exception. The default value is 60 seconds.
+ # it raises a TimeoutError exception. The default value is 60 seconds.
attr_reader :read_timeout
# Setter for the read_timeout attribute.
@@ -125,18 +122,6 @@ module Net
# The server's last response.
attr_reader :last_response
- # When +true+, connections are in passive mode per default.
- # Default: +true+.
- def self.default_passive=(value)
- @@default_passive = value
- end
-
- # When +true+, connections are in passive mode per default.
- # Default: +true+.
- def self.default_passive
- @@default_passive
- end
-
#
# A synonym for <tt>FTP.new</tt>, but with a mandatory host parameter.
#
@@ -164,7 +149,7 @@ module Net
def initialize(host = nil, user = nil, passwd = nil, acct = nil)
super()
@binary = true
- @passive = @@default_passive
+ @passive = false
@debug_mode = false
@resume = false
@sock = NullSocket.new
@@ -295,9 +280,6 @@ module Net
if @debug_mode
print "put: ", sanitize(line), "\n"
end
- if /[\r\n]/ =~ line
- raise ArgumentError, "A line must not contain CR or LF"
- end
line = line + CRLF
@sock.write(line)
end
@@ -316,16 +298,16 @@ module Net
# Receive a section of lines until the response code's match.
def getmultiline # :nodoc:
- lines = []
- lines << getline
- code = lines.last.slice(/\A([0-9a-zA-Z]{3})-/, 1)
- if code
- delimiter = code + " "
+ line = getline
+ buff = line
+ if line[3] == ?-
+ code = line[0, 3]
begin
- lines << getline
- end until lines.last.start_with?(delimiter)
+ line = getline
+ buff << "\n" << line
+ end until line[0, 3] == code and line[3] != ?-
end
- return lines.join("\n") + "\n"
+ return buff << "\n"
end
private :getmultiline
@@ -355,7 +337,7 @@ module Net
# equal 2.
def voidresp # :nodoc:
resp = getresp
- if !resp.start_with?("2")
+ if resp[0] != ?2
raise FTPReplyError, resp
end
end
@@ -395,9 +377,15 @@ module Net
end
private :sendport
- # Constructs a TCPServer socket
+ # Constructs a TCPServer socket, and sends it the PORT command
+ #
+ # Returns the constructed TCPServer socket
def makeport # :nodoc:
- TCPServer.open(@sock.addr[3], 0)
+ sock = TCPServer.open(@sock.addr[3], 0)
+ port = sock.addr[1]
+ host = sock.addr[3]
+ sendport(host, port)
+ return sock
end
private :makeport
@@ -420,51 +408,47 @@ module Net
conn = open_socket(host, port)
if @resume and rest_offset
resp = sendcmd("REST " + rest_offset.to_s)
- if !resp.start_with?("3")
+ if resp[0] != ?3
raise FTPReplyError, resp
end
end
resp = sendcmd(cmd)
# skip 2XX for some ftp servers
- resp = getresp if resp.start_with?("2")
- if !resp.start_with?("1")
+ resp = getresp if resp[0] == ?2
+ if resp[0] != ?1
raise FTPReplyError, resp
end
else
sock = makeport
- begin
- sendport(sock.addr[3], sock.addr[1])
- if @resume and rest_offset
- resp = sendcmd("REST " + rest_offset.to_s)
- if !resp.start_with?("3")
- raise FTPReplyError, resp
- end
- end
- resp = sendcmd(cmd)
- # skip 2XX for some ftp servers
- resp = getresp if resp.start_with?("2")
- if !resp.start_with?("1")
+ if @resume and rest_offset
+ resp = sendcmd("REST " + rest_offset.to_s)
+ if resp[0] != ?3
raise FTPReplyError, resp
end
- conn = BufferedSocket.new(sock.accept)
- conn.read_timeout = @read_timeout
- sock.shutdown(Socket::SHUT_WR) rescue nil
- sock.read rescue nil
- ensure
- sock.close
end
+ resp = sendcmd(cmd)
+ # skip 2XX for some ftp servers
+ resp = getresp if resp[0] == ?2
+ if resp[0] != ?1
+ raise FTPReplyError, resp
+ end
+ conn = BufferedSocket.new(sock.accept)
+ conn.read_timeout = @read_timeout
+ sock.shutdown(Socket::SHUT_WR) rescue nil
+ sock.read rescue nil
+ sock.close
end
return conn
end
private :transfercmd
#
- # Logs in to the remote host. The session must have been
- # previously connected. If +user+ is the string "anonymous" and
- # the +password+ is +nil+, "anonymous@" is used as a password. If
- # the +acct+ parameter is not +nil+, an FTP ACCT command is sent
- # following the successful login. Raises an exception on error
- # (typically <tt>Net::FTPPermError</tt>).
+ # Logs in to the remote host. The session must have been previously
+ # connected. If +user+ is the string "anonymous" and the +password+ is
+ # +nil+, a password of <tt>user@host</tt> is synthesized. If the +acct+
+ # parameter is not +nil+, an FTP ACCT command is sent following the
+ # successful login. Raises an exception on error (typically
+ # <tt>Net::FTPPermError</tt>).
#
def login(user = "anonymous", passwd = nil, acct = nil)
if user == "anonymous" and passwd == nil
@@ -474,16 +458,16 @@ module Net
resp = ""
synchronize do
resp = sendcmd('USER ' + user)
- if resp.start_with?("3")
+ if resp[0] == ?3
raise FTPReplyError, resp if passwd.nil?
resp = sendcmd('PASS ' + passwd)
end
- if resp.start_with?("3")
+ if resp[0] == ?3
raise FTPReplyError, resp if acct.nil?
resp = sendcmd('ACCT ' + acct)
end
end
- if !resp.start_with?("2")
+ if resp[0] != ?2
raise FTPReplyError, resp
end
@welcome = resp
@@ -616,30 +600,29 @@ module Net
# chunks.
#
def getbinaryfile(remotefile, localfile = File.basename(remotefile),
- blocksize = DEFAULT_BLOCKSIZE, &block) # :yield: data
- f = nil
+ blocksize = DEFAULT_BLOCKSIZE) # :yield: data
result = nil
if localfile
if @resume
rest_offset = File.size?(localfile)
- f = File.open(localfile, "a")
+ f = open(localfile, "a")
else
rest_offset = nil
- f = File.open(localfile, "w")
+ f = open(localfile, "w")
end
elsif !block_given?
- result = String.new
+ result = ""
end
begin
- f&.binmode
- retrbinary("RETR #{remotefile}", blocksize, rest_offset) do |data|
- f&.write(data)
- block&.(data)
- result&.concat(data)
+ f.binmode if localfile
+ retrbinary("RETR " + remotefile.to_s, blocksize, rest_offset) do |data|
+ f.write(data) if localfile
+ yield(data) if block_given?
+ result.concat(data) if result
end
return result
ensure
- f&.close
+ f.close if localfile
end
end
@@ -650,25 +633,23 @@ module Net
# If a block is supplied, it is passed the retrieved data one
# line at a time.
#
- def gettextfile(remotefile, localfile = File.basename(remotefile),
- &block) # :yield: line
- f = nil
+ def gettextfile(remotefile, localfile = File.basename(remotefile)) # :yield: line
result = nil
if localfile
- f = File.open(localfile, "w")
+ f = open(localfile, "w")
elsif !block_given?
- result = String.new
+ result = ""
end
begin
- retrlines("RETR #{remotefile}") do |line, newline|
+ retrlines("RETR " + remotefile) do |line, newline|
l = newline ? line + "\n" : line
- f&.print(l)
- block&.(line, newline)
- result&.concat(l)
+ f.print(l) if localfile
+ yield(line, newline) if block_given?
+ result.concat(l) if result
end
return result
ensure
- f&.close
+ f.close if localfile
end
end
@@ -701,13 +682,13 @@ module Net
else
rest_offset = nil
end
- f = File.open(localfile)
+ f = open(localfile)
begin
f.binmode
if rest_offset
- storbinary("APPE #{remotefile}", f, blocksize, rest_offset, &block)
+ storbinary("APPE " + remotefile, f, blocksize, rest_offset, &block)
else
- storbinary("STOR #{remotefile}", f, blocksize, rest_offset, &block)
+ storbinary("STOR " + remotefile, f, blocksize, rest_offset, &block)
end
ensure
f.close
@@ -720,9 +701,9 @@ module Net
# passing in the transmitted data one line at a time.
#
def puttextfile(localfile, remotefile = File.basename(localfile), &block) # :yield: line
- f = File.open(localfile)
+ f = open(localfile)
begin
- storlines("STOR #{remotefile}", f, &block)
+ storlines("STOR " + remotefile, f, &block)
ensure
f.close
end
@@ -758,7 +739,7 @@ module Net
def nlst(dir = nil)
cmd = "NLST"
if dir
- cmd = "#{cmd} #{dir}"
+ cmd = cmd + " " + dir
end
files = []
retrlines(cmd) do |line|
@@ -774,238 +755,40 @@ module Net
def list(*args, &block) # :yield: line
cmd = "LIST"
args.each do |arg|
- cmd = "#{cmd} #{arg}"
- end
- lines = []
- retrlines(cmd) do |line|
- lines << line
+ cmd = cmd + " " + arg.to_s
end
if block
- lines.each(&block)
+ retrlines(cmd, &block)
+ else
+ lines = []
+ retrlines(cmd) do |line|
+ lines << line
+ end
+ return lines
end
- return lines
end
alias ls list
alias dir list
#
- # MLSxEntry represents an entry in responses of MLST/MLSD.
- # Each entry has the facts (e.g., size, last modification time, etc.)
- # and the pathname.
- #
- class MLSxEntry
- attr_reader :facts, :pathname
-
- def initialize(facts, pathname)
- @facts = facts
- @pathname = pathname
- end
-
- standard_facts = %w(size modify create type unique perm
- lang media-type charset)
- standard_facts.each do |factname|
- define_method factname.gsub(/-/, "_") do
- facts[factname]
- end
- end
-
- #
- # Returns +true+ if the entry is a file (i.e., the value of the type
- # fact is file).
- #
- def file?
- return facts["type"] == "file"
- end
-
- #
- # Returns +true+ if the entry is a directory (i.e., the value of the
- # type fact is dir, cdir, or pdir).
- #
- def directory?
- if /\A[cp]?dir\z/.match(facts["type"])
- return true
- else
- return false
- end
- end
-
- #
- # Returns +true+ if the APPE command may be applied to the file.
- #
- def appendable?
- return facts["perm"].include?(?a)
- end
-
- #
- # Returns +true+ if files may be created in the directory by STOU,
- # STOR, APPE, and RNTO.
- #
- def creatable?
- return facts["perm"].include?(?c)
- end
-
- #
- # Returns +true+ if the file or directory may be deleted by DELE/RMD.
- #
- def deletable?
- return facts["perm"].include?(?d)
- end
-
- #
- # Returns +true+ if the directory may be entered by CWD/CDUP.
- #
- def enterable?
- return facts["perm"].include?(?e)
- end
-
- #
- # Returns +true+ if the file or directory may be renamed by RNFR.
- #
- def renamable?
- return facts["perm"].include?(?f)
- end
-
- #
- # Returns +true+ if the listing commands, LIST, NLST, and MLSD are
- # applied to the directory.
- #
- def listable?
- return facts["perm"].include?(?l)
- end
-
- #
- # Returns +true+ if the MKD command may be used to create a new
- # directory within the directory.
- #
- def directory_makable?
- return facts["perm"].include?(?m)
- end
-
- #
- # Returns +true+ if the objects in the directory may be deleted, or
- # the directory may be purged.
- #
- def purgeable?
- return facts["perm"].include?(?p)
- end
-
- #
- # Returns +true+ if the RETR command may be applied to the file.
- #
- def readable?
- return facts["perm"].include?(?r)
- end
-
- #
- # Returns +true+ if the STOR command may be applied to the file.
- #
- def writable?
- return facts["perm"].include?(?w)
- end
- end
-
- CASE_DEPENDENT_PARSER = ->(value) { value }
- CASE_INDEPENDENT_PARSER = ->(value) { value.downcase }
- DECIMAL_PARSER = ->(value) { value.to_i }
- OCTAL_PARSER = ->(value) { value.to_i(8) }
- TIME_PARSER = ->(value, local = false) {
- unless /\A(?<year>\d{4})(?<month>\d{2})(?<day>\d{2})
- (?<hour>\d{2})(?<min>\d{2})(?<sec>\d{2})
- (\.(?<fractions>\d+))?/x =~ value
- raise FTPProtoError, "invalid time-val: #{value}"
- end
- usec = fractions.to_i * 10 ** (6 - fractions.to_s.size)
- Time.send(local ? :local : :utc, year, month, day, hour, min, sec, usec)
- }
- FACT_PARSERS = Hash.new(CASE_DEPENDENT_PARSER)
- FACT_PARSERS["size"] = DECIMAL_PARSER
- FACT_PARSERS["modify"] = TIME_PARSER
- FACT_PARSERS["create"] = TIME_PARSER
- FACT_PARSERS["type"] = CASE_INDEPENDENT_PARSER
- FACT_PARSERS["unique"] = CASE_DEPENDENT_PARSER
- FACT_PARSERS["perm"] = CASE_INDEPENDENT_PARSER
- FACT_PARSERS["lang"] = CASE_INDEPENDENT_PARSER
- FACT_PARSERS["media-type"] = CASE_INDEPENDENT_PARSER
- FACT_PARSERS["charset"] = CASE_INDEPENDENT_PARSER
- FACT_PARSERS["unix.mode"] = OCTAL_PARSER
- FACT_PARSERS["unix.owner"] = DECIMAL_PARSER
- FACT_PARSERS["unix.group"] = DECIMAL_PARSER
- FACT_PARSERS["unix.ctime"] = TIME_PARSER
- FACT_PARSERS["unix.atime"] = TIME_PARSER
-
- def parse_mlsx_entry(entry)
- facts, pathname = entry.chomp.split(/ /, 2)
- unless pathname
- raise FTPProtoError, entry
- end
- return MLSxEntry.new(
- facts.scan(/(.*?)=(.*?);/).each_with_object({}) {
- |(factname, value), h|
- name = factname.downcase
- h[name] = FACT_PARSERS[name].(value)
- },
- pathname)
- end
- private :parse_mlsx_entry
-
- #
- # Returns data (e.g., size, last modification time, entry type, etc.)
- # about the file or directory specified by +pathname+.
- # If +pathname+ is omitted, the current directory is assumed.
- #
- def mlst(pathname = nil)
- cmd = pathname ? "MLST #{pathname}" : "MLST"
- resp = sendcmd(cmd)
- if !resp.start_with?("250")
- raise FTPReplyError, resp
- end
- line = resp.lines[1]
- unless line
- raise FTPProtoError, resp
- end
- entry = line.sub(/\A(250-| *)/, "")
- return parse_mlsx_entry(entry)
- end
-
- #
- # Returns an array of the entries of the directory specified by
- # +pathname+.
- # Each entry has the facts (e.g., size, last modification time, etc.)
- # and the pathname.
- # If a block is given, it iterates through the listing.
- # If +pathname+ is omitted, the current directory is assumed.
- #
- def mlsd(pathname = nil, &block) # :yield: entry
- cmd = pathname ? "MLSD #{pathname}" : "MLSD"
- entries = []
- retrlines(cmd) do |line|
- entries << parse_mlsx_entry(line)
- end
- if block
- entries.each(&block)
- end
- return entries
- end
-
- #
# Renames a file on the server.
#
def rename(fromname, toname)
- resp = sendcmd("RNFR #{fromname}")
- if !resp.start_with?("3")
+ resp = sendcmd("RNFR " + fromname)
+ if resp[0] != ?3
raise FTPReplyError, resp
end
- voidcmd("RNTO #{toname}")
+ voidcmd("RNTO " + toname)
end
#
# Deletes a file on the server.
#
def delete(filename)
- resp = sendcmd("DELE #{filename}")
- if resp.start_with?("250")
+ resp = sendcmd("DELE " + filename)
+ if resp[0, 3] == "250"
return
- elsif resp.start_with?("5")
+ elsif resp[0] == ?5
raise FTPPermError, resp
else
raise FTPReplyError, resp
@@ -1026,41 +809,40 @@ module Net
end
end
end
- cmd = "CWD #{dirname}"
+ cmd = "CWD " + dirname
voidcmd(cmd)
end
- def get_body(resp) # :nodoc:
- resp.slice(/\A[0-9a-zA-Z]{3} (.*)$/, 1)
- end
- private :get_body
-
#
# Returns the size of the given (remote) filename.
#
def size(filename)
with_binary(true) do
- resp = sendcmd("SIZE #{filename}")
- if !resp.start_with?("213")
+ resp = sendcmd("SIZE " + filename)
+ if resp[0, 3] != "213"
raise FTPReplyError, resp
end
- return get_body(resp).to_i
+ return resp[3..-1].strip.to_i
end
end
+ MDTM_REGEXP = /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ # :nodoc:
+
#
# Returns the last modification time of the (remote) file. If +local+ is
# +true+, it is returned as a local time, otherwise it's a UTC time.
#
def mtime(filename, local = false)
- return TIME_PARSER.(mdtm(filename), local)
+ str = mdtm(filename)
+ ary = str.scan(MDTM_REGEXP)[0].collect {|i| i.to_i}
+ return local ? Time.local(*ary) : Time.gm(*ary)
end
#
# Creates a remote directory.
#
def mkdir(dirname)
- resp = sendcmd("MKD #{dirname}")
+ resp = sendcmd("MKD " + dirname)
return parse257(resp)
end
@@ -1068,7 +850,7 @@ module Net
# Removes a remote directory.
#
def rmdir(dirname)
- voidcmd("RMD #{dirname}")
+ voidcmd("RMD " + dirname)
end
#
@@ -1085,10 +867,10 @@ module Net
#
def system
resp = sendcmd("SYST")
- if !resp.start_with?("215")
+ if resp[0, 3] != "215"
raise FTPReplyError, resp
end
- return get_body(resp)
+ return resp[4 .. -1]
end
#
@@ -1122,9 +904,9 @@ module Net
# Use +mtime+ if you want a parsed Time instance.
#
def mdtm(filename)
- resp = sendcmd("MDTM #{filename}")
- if resp.start_with?("213")
- return get_body(resp)
+ resp = sendcmd("MDTM " + filename)
+ if resp[0, 3] == "213"
+ return resp[3 .. -1].strip
end
end
@@ -1192,7 +974,7 @@ module Net
#
# Returns host and port.
def parse227(resp) # :nodoc:
- if !resp.start_with?("227")
+ if resp[0, 3] != "227"
raise FTPReplyError, resp
end
if m = /\((?<host>\d+(,\d+){3}),(?<port>\d+,\d+)\)/.match(resp)
@@ -1208,7 +990,7 @@ module Net
#
# Returns host and port.
def parse228(resp) # :nodoc:
- if !resp.start_with?("228")
+ if resp[0, 3] != "228"
raise FTPReplyError, resp
end
if m = /\(4,4,(?<host>\d+(,\d+){3}),2,(?<port>\d+,\d+)\)/.match(resp)
@@ -1245,7 +1027,7 @@ module Net
#
# Returns host and port.
def parse229(resp) # :nodoc:
- if !resp.start_with?("229")
+ if resp[0, 3] != "229"
raise FTPReplyError, resp
end
if m = /\((?<d>[!-~])\k<d>\k<d>(?<port>\d+)\k<d>\)/.match(resp)
@@ -1261,10 +1043,27 @@ module Net
#
# Returns host and port.
def parse257(resp) # :nodoc:
- if !resp.start_with?("257")
+ if resp[0, 3] != "257"
raise FTPReplyError, resp
end
- return resp.slice(/"(([^"]|"")*)"/, 1).to_s.gsub(/""/, '"')
+ if resp[3, 2] != ' "'
+ return ""
+ end
+ dirname = ""
+ i = 5
+ n = resp.length
+ while i < n
+ c = resp[i, 1]
+ i = i + 1
+ if c == '"'
+ if i > n or resp[i, 1] != '"'
+ break
+ end
+ i = i + 1
+ end
+ dirname = dirname + c
+ end
+ return dirname
end
private :parse257
@@ -1273,10 +1072,6 @@ module Net
def read_timeout=(sec)
end
- def closed?
- true
- end
-
def close
end
@@ -1294,11 +1089,11 @@ module Net
def read(len = nil)
if len
- s = super(len, String.new, true)
+ s = super(len, "", true)
return s.empty? ? nil : s
else
result = ""
- while s = super(DEFAULT_BLOCKSIZE, String.new, true)
+ while s = super(DEFAULT_BLOCKSIZE, "", true)
break if s.empty?
result << s
end
@@ -1307,16 +1102,13 @@ module Net
end
def gets
- line = readuntil("\n", true)
- return line.empty? ? nil : line
+ return readuntil("\n")
+ rescue EOFError
+ return nil
end
def readline
- line = gets
- if line.nil?
- raise EOFError, "end of file reached"
- end
- return line
+ return readuntil("\n")
end
end
# :startdoc:
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 25fa1d6888..44c123b0e3 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = net/http.rb
#
@@ -335,7 +334,6 @@ module Net #:nodoc:
# HTTPResetContent:: 205
# HTTPPartialContent:: 206
# HTTPMultiStatus:: 207
- # HTTPIMUsed:: 226
# HTTPRedirection:: 3xx
# HTTPMultipleChoices:: 300
# HTTPMovedPermanently:: 301
@@ -642,7 +640,7 @@ module Net #:nodoc:
@close_on_empty_response = false
@socket = nil
@started = false
- @open_timeout = 60
+ @open_timeout = nil
@read_timeout = 60
@continue_timeout = nil
@debug_output = nil
@@ -657,6 +655,7 @@ module Net #:nodoc:
@use_ssl = false
@ssl_context = nil
@ssl_session = nil
+ @enable_post_connection_check = true
@sspi_enabled = false
SSL_IVNAMES.each do |ivname|
instance_variable_set ivname, nil
@@ -687,10 +686,10 @@ module Net #:nodoc:
# The port number to connect to.
attr_reader :port
- # The local host used to establish the connection.
+ # The local host used to estabilish the connection.
attr_accessor :local_host
- # The local port used to establish the connection.
+ # The local port used to estabilish the connection.
attr_accessor :local_port
attr_writer :proxy_from_env
@@ -702,7 +701,7 @@ module Net #:nodoc:
# Number of seconds to wait for the connection to open. Any number
# may be used, including Floats for fractional seconds. If the HTTP
# object cannot open a connection in this many seconds, it raises a
- # Net::OpenTimeout exception. The default value is 60 seconds.
+ # Net::OpenTimeout exception. The default value is +nil+.
attr_accessor :open_timeout
# Number of seconds to wait for one block to be read (via one read(2)
@@ -876,12 +875,7 @@ module Net #:nodoc:
D "opening connection to #{conn_address}:#{conn_port}..."
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
- begin
- TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
- rescue => e
- raise e, "Failed to open TCP connection to " +
- "#{conn_address}:#{conn_port} (#{e.message})"
- end
+ TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
}
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
D "opened"
@@ -919,13 +913,10 @@ module Net #:nodoc:
@socket.write(buf)
HTTPResponse.read_new(@socket).value
end
+ s.session = @ssl_session if @ssl_session
# Server Name Indication (SNI) RFC 3546
s.hostname = @address if s.respond_to? :hostname=
- if @ssl_session and
- Process.clock_gettime(Process::CLOCK_REALTIME) < @ssl_session.time.to_f + @ssl_session.timeout
- s.session = @ssl_session if @ssl_session
- end
- ssl_socket_connect(s, @open_timeout)
+ Timeout.timeout(@open_timeout, Net::OpenTimeout) { s.connect }
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
@@ -1034,15 +1025,13 @@ module Net #:nodoc:
# The proxy URI determined from the environment for this connection.
def proxy_uri # :nodoc:
- @proxy_uri ||= URI::HTTP.new(
- "http".freeze, nil, address, port, nil, nil, nil, nil, nil
- ).find_proxy
+ @proxy_uri ||= URI("http://#{address}:#{port}").find_proxy
end
# The address of the proxy server, if one is configured.
def proxy_address
if @proxy_from_env then
- proxy_uri&.hostname
+ proxy_uri && proxy_uri.hostname
else
@proxy_address
end
@@ -1051,7 +1040,7 @@ module Net #:nodoc:
# The port of the proxy server, if one is configured.
def proxy_port
if @proxy_from_env then
- proxy_uri&.port
+ proxy_uri && proxy_uri.port
else
@proxy_port
end
@@ -1083,12 +1072,8 @@ module Net #:nodoc:
end
def edit_path(path)
- if proxy?
- if path.start_with?("ftp://") || use_ssl?
- path
- else
- "http://#{addr_port}#{path}"
- end
+ if proxy? and not use_ssl? then
+ "http://#{addr_port}#{path}"
else
path
end
@@ -1137,7 +1122,7 @@ module Net #:nodoc:
# end
# }
#
- def get(path, initheader = nil, dest = nil, &block) # :yield: +body_segment+
+ def get(path, initheader = {}, dest = nil, &block) # :yield: +body_segment+
res = nil
request(Get.new(path, initheader)) {|r|
r.read_body dest, &block
@@ -1359,8 +1344,7 @@ module Net #:nodoc:
# puts response.body
#
def send_request(name, path, data = nil, header = nil)
- has_response_body = name != 'HEAD'
- r = HTTPGenericRequest.new(name,(data ? true : false),has_response_body,path,header)
+ r = HTTPGenericRequest.new(name,(data ? true : false),true,path,header)
request r, data
end
@@ -1422,15 +1406,15 @@ module Net #:nodoc:
begin
res = HTTPResponse.read_new(@socket)
res.decode_content = req.decode_content
- end while res.kind_of?(HTTPInformation)
+ end while res.kind_of?(HTTPContinue)
res.uri = req.uri
+ res.reading_body(@socket, req.response_body_permitted?) {
+ yield res if block_given?
+ }
res
}
- res.reading_body(@socket, req.response_body_permitted?) {
- yield res if block_given?
- }
rescue Net::OpenTimeout
raise
rescue Net::ReadTimeout, IOError, EOFError,
@@ -1460,23 +1444,20 @@ module Net #:nodoc:
def begin_transport(req)
if @socket.closed?
connect
- elsif @last_communicated
- if @last_communicated + @keep_alive_timeout < Process.clock_gettime(Process::CLOCK_MONOTONIC)
- D 'Conn close because of keep_alive_timeout'
- @socket.close
- connect
- elsif @socket.io.to_io.wait_readable(0) && @socket.eof?
- D "Conn close because of EOF"
- @socket.close
- connect
- end
+ elsif @last_communicated && @last_communicated + @keep_alive_timeout < Time.now
+ D 'Conn close because of keep_alive_timeout'
+ @socket.close
+ connect
end
if not req.response_body_permitted? and @close_on_empty_response
req['connection'] ||= 'close'
end
- req.update_uri address, port, use_ssl?
+ host = req['host'] || address
+ host = $1 if host =~ /(.*):\d+$/
+ req.update_uri host, port, use_ssl?
+
req['host'] ||= addr_port()
end
@@ -1490,7 +1471,7 @@ module Net #:nodoc:
@socket.close
elsif keep_alive?(req, res)
D 'Conn keep-alive'
- @last_communicated = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ @last_communicated = Time.now
else
D 'Conn close'
@socket.close
@@ -1571,3 +1552,4 @@ require 'net/http/responses'
require 'net/http/proxy_delta'
require 'net/http/backward'
+
diff --git a/lib/net/http/backward.rb b/lib/net/http/backward.rb
index 9e24eae32c..faf47b8489 100644
--- a/lib/net/http/backward.rb
+++ b/lib/net/http/backward.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# for backward compatibility
# :enddoc:
diff --git a/lib/net/http/exceptions.rb b/lib/net/http/exceptions.rb
index 0d34526616..6c5d81cb04 100644
--- a/lib/net/http/exceptions.rb
+++ b/lib/net/http/exceptions.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Net::HTTP exception class.
# You cannot use Net::HTTPExceptions directly; instead, you must use
# its subclasses.
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb
index 6c5ceafe61..b51034c7ea 100644
--- a/lib/net/http/generic_request.rb
+++ b/lib/net/http/generic_request.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# HTTPGenericRequest is the parent of the HTTPRequest class.
# Do not use this directly; use a subclass of HTTPRequest.
#
@@ -15,18 +14,19 @@ class Net::HTTPGenericRequest
if URI === uri_or_path then
@uri = uri_or_path.dup
- host = @uri.hostname.dup
- host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port
- @path = uri_or_path.request_uri
- raise ArgumentError, "no HTTP request path given" unless @path
+ host = @uri.hostname
+ host += ":#{@uri.port}" if @uri.port != @uri.class::DEFAULT_PORT
+ path = uri_or_path.request_uri
else
@uri = nil
host = nil
- raise ArgumentError, "no HTTP request path given" unless uri_or_path
- raise ArgumentError, "HTTP request path is empty" if uri_or_path.empty?
- @path = uri_or_path.dup
+ path = uri_or_path
end
+ raise ArgumentError, "no HTTP request path given" unless path
+ raise ArgumentError, "HTTP request path is empty" if path.empty?
+ @path = path
+
@decode_content = false
if @response_has_body and Net::HTTP::HAVE_ZLIB then
@@ -44,7 +44,7 @@ class Net::HTTPGenericRequest
initialize_http_header initheader
self['Accept'] ||= '*/*'
self['User-Agent'] ||= 'Ruby'
- self['Host'] ||= host if host
+ self['Host'] ||= host
@body = nil
@body_stream = nil
@body_data = nil
@@ -117,6 +117,15 @@ class Net::HTTPGenericRequest
#
def exec(sock, ver, path) #:nodoc: internal use only
+ if @uri
+ if @uri.port == @uri.default_port
+ # [Bug #7650] Amazon ECS API and GFE/1.3 disallow extra default port number
+ self['host'] = @uri.host
+ else
+ self['host'] = "#{@uri.host}:#{@uri.port}"
+ end
+ end
+
if @body
send_request_with_body sock, ver, path, @body
elsif @body_stream
@@ -128,34 +137,21 @@ class Net::HTTPGenericRequest
end
end
- def update_uri(addr, port, ssl) # :nodoc: internal use only
- # reflect the connection and @path to @uri
+ def update_uri(host, port, ssl) # :nodoc: internal use only
return unless @uri
- if ssl
- scheme = 'https'.freeze
- klass = URI::HTTPS
- else
- scheme = 'http'.freeze
- klass = URI::HTTP
- end
+ @uri.host ||= host
+ @uri.port = port
+
+ scheme = ssl ? 'https' : 'http'
- if host = self['host']
- host.sub!(/:.*/s, ''.freeze)
- elsif host = @uri.host
- else
- host = addr
- end
# convert the class of the URI
- if @uri.is_a?(klass)
- @uri.host = host
- @uri.port = port
- else
- @uri = klass.new(
- scheme, @uri.userinfo,
- host, port, nil,
- @uri.path, nil, @uri.query, nil)
+ unless scheme == @uri.scheme then
+ new_uri = @uri.to_s.sub(/^https?/, scheme)
+ @uri = URI new_uri
end
+
+ @uri
end
private
@@ -310,7 +306,7 @@ class Net::HTTPGenericRequest
def wait_for_continue(sock, ver)
if ver >= '1.1' and @header['expect'] and
@header['expect'].include?('100-continue')
- if sock.io.to_io.wait_readable(sock.continue_timeout)
+ if IO.select([sock.io], nil, nil, sock.continue_timeout)
res = Net::HTTPResponse.read_new(sock)
unless res.kind_of?(Net::HTTPContinue)
res.decode_content = @decode_content
@@ -321,12 +317,7 @@ class Net::HTTPGenericRequest
end
def write_header(sock, ver, path)
- reqline = "#{@method} #{path} HTTP/#{ver}"
- if /[\r\n]/ =~ reqline
- raise ArgumentError, "A Request-Line must not contain CR or LF"
- end
- buf = ""
- buf << reqline << "\r\n"
+ buf = "#{@method} #{path} HTTP/#{ver}\r\n"
each_capitalized do |k,v|
buf << "#{k}: #{v}\r\n"
end
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb
index 7eee15e361..029b647b5e 100644
--- a/lib/net/http/header.rb
+++ b/lib/net/http/header.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# The HTTPHeader module defines methods for reading and writing
# HTTP headers.
#
@@ -38,7 +37,7 @@ module Net::HTTPHeader
@header.delete key.downcase
return val
end
- set_field(key, val)
+ @header[key.downcase] = [val]
end
# [Ruby 1.8.3]
@@ -58,40 +57,12 @@ module Net::HTTPHeader
#
def add_field(key, val)
if @header.key?(key.downcase)
- append_field_value(@header[key.downcase], val)
+ @header[key.downcase].push val
else
- set_field(key, val)
- end
- end
-
- private def set_field(key, val)
- case val
- when Enumerable
- ary = []
- append_field_value(ary, val)
- @header[key.downcase] = ary
- else
- val = val.to_s
- if /[\r\n]/ =~ val
- raise ArgumentError, 'header field value cannnot include CR/LF'
- end
@header[key.downcase] = [val]
end
end
- private def append_field_value(ary, val)
- case val
- when Enumerable
- val.each{|x| append_field_value(ary, x)}
- else
- val = val.to_s
- if /[\r\n]/ =~ val
- raise ArgumentError, 'header field value cannnot include CR/LF'
- end
- ary.push val
- end
- end
-
# [Ruby 1.8.3]
# Returns an array of header field strings corresponding to the
# case-insensitive +key+. This method allows you to get duplicated
@@ -174,11 +145,11 @@ module Net::HTTPHeader
@header.key?(key.downcase)
end
- # Returns a Hash consisting of header names and array of values.
+ # Returns a Hash consisting of header names and values.
# e.g.
- # {"cache-control" => ["private"],
- # "content-type" => ["text/html"],
- # "date" => ["Wed, 22 Jun 2005 22:11:50 GMT"]}
+ # {"cache-control" => "private",
+ # "content-type" => "text/html",
+ # "date" => "Wed, 22 Jun 2005 22:11:50 GMT"}
def to_hash
@header.dup
end
@@ -198,7 +169,7 @@ module Net::HTTPHeader
alias canonical_each each_capitalized
def capitalize(name)
- name.to_s.split(/-/).map {|s| s.capitalize }.join('-')
+ name.split(/-/).map {|s| s.capitalize }.join('-')
end
private :capitalize
@@ -406,7 +377,7 @@ module Net::HTTPHeader
# +params+ is the form data set; it is an Array of Arrays or a Hash
# +enctype is the type to encode the form data set.
# It is application/x-www-form-urlencoded or multipart/form-data.
- # +formopt+ is an optional hash to specify the detail.
+ # +formpot+ is an optional hash to specify the detail.
#
# boundary:: the boundary of the multipart message
# charset:: the charset of the message. All names and the values of
diff --git a/lib/net/http/proxy_delta.rb b/lib/net/http/proxy_delta.rb
index a2f770ebdb..b16c9f1ed8 100644
--- a/lib/net/http/proxy_delta.rb
+++ b/lib/net/http/proxy_delta.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module Net::HTTP::ProxyDelta #:nodoc: internal use only
private
diff --git a/lib/net/http/request.rb b/lib/net/http/request.rb
index 1e86f3e4b4..e8b0f48fcc 100644
--- a/lib/net/http/request.rb
+++ b/lib/net/http/request.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# HTTP request class.
# This class wraps together the request header and the request path.
# You cannot use this class directly. Instead, you should use one of its
diff --git a/lib/net/http/requests.rb b/lib/net/http/requests.rb
index d4c80a3812..ef719ea6e7 100644
--- a/lib/net/http/requests.rb
+++ b/lib/net/http/requests.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# HTTP/1.1 methods --- RFC2616
#
@@ -47,7 +46,7 @@ end
class Net::HTTP::Options < Net::HTTPRequest
METHOD = 'OPTIONS'
REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
+ RESPONSE_HAS_BODY = false
end
# See Net::HTTPGenericRequest for attributes and methods.
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
index 349812834f..da3e4b4c8c 100644
--- a/lib/net/http/response.rb
+++ b/lib/net/http/response.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# HTTP response class.
#
# This class wraps together the response header and the response body (the
@@ -38,7 +37,7 @@ class Net::HTTPResponse
def read_status_line(sock)
str = sock.readline
- m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)(?:\s+(.*))?\z/in.match(str) or
+ m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in.match(str) or
raise Net::HTTPBadResponse, "wrong status line: #{str.dump}"
m.captures
end
@@ -251,8 +250,7 @@ class Net::HTTPResponse
return yield @socket unless @decode_content
return yield @socket if self['content-range']
- v = self['content-encoding']
- case v&.downcase
+ case self['content-encoding']
when 'deflate', 'gzip', 'x-gzip' then
self.delete 'content-encoding'
@@ -261,12 +259,7 @@ class Net::HTTPResponse
begin
yield inflate_body_io
ensure
- orig_err = $!
- begin
- inflate_body_io.finish
- rescue => err
- raise orig_err || err
- end
+ inflate_body_io.finish
end
when 'none', 'identity' then
self.delete 'content-encoding'
@@ -308,6 +301,7 @@ class Net::HTTPResponse
# See RFC 2616 section 3.6.1 for definitions
def read_chunked(dest, chunk_data_io) # :nodoc:
+ len = nil
total = 0
while true
line = @socket.readline
@@ -360,7 +354,6 @@ class Net::HTTPResponse
# Finishes the inflate stream.
def finish
- return if @inflate.total_in == 0
@inflate.finish
end
@@ -371,11 +364,6 @@ class Net::HTTPResponse
# entire body in memory.
def inflate_adapter(dest)
- if dest.respond_to?(:set_encoding)
- dest.set_encoding(Encoding::ASCII_8BIT)
- elsif dest.respond_to?(:force_encoding)
- dest.force_encoding(Encoding::ASCII_8BIT)
- end
block = proc do |compressed_chunk|
@inflate.inflate(compressed_chunk) do |chunk|
dest << chunk
diff --git a/lib/net/http/responses.rb b/lib/net/http/responses.rb
index a5b8ddc68b..38a5da2443 100644
--- a/lib/net/http/responses.rb
+++ b/lib/net/http/responses.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# :stopdoc:
class Net::HTTPUnknownResponse < Net::HTTPResponse
HAS_BODY = true
@@ -58,9 +57,7 @@ class Net::HTTPMultiStatus < Net::HTTPSuccess # 207 - RFC 4918
HAS_BODY = true
end
# 208 Already Reported - RFC 5842; experimental
-class Net::HTTPIMUsed < Net::HTTPSuccess # 226 - RFC 3229
- HAS_BODY = true
-end
+# 226 IM Used - RFC 3229; no famous implementation known
class Net::HTTPMultipleChoices < Net::HTTPRedirection # 300
HAS_BODY = true
@@ -86,9 +83,7 @@ end
class Net::HTTPTemporaryRedirect < Net::HTTPRedirection # 307
HAS_BODY = true
end
-class Net::HTTPPermanentRedirect < Net::HTTPRedirection # 308
- HAS_BODY = true
-end
+# 308 Permanent Redirect - in draft
class Net::HTTPBadRequest < Net::HTTPClientError # 400
HAS_BODY = true
@@ -223,7 +218,6 @@ class Net::HTTPResponse
'205' => Net::HTTPResetContent,
'206' => Net::HTTPPartialContent,
'207' => Net::HTTPMultiStatus,
- '226' => Net::HTTPIMUsed,
'300' => Net::HTTPMultipleChoices,
'301' => Net::HTTPMovedPermanently,
@@ -232,7 +226,6 @@ class Net::HTTPResponse
'304' => Net::HTTPNotModified,
'305' => Net::HTTPUseProxy,
'307' => Net::HTTPTemporaryRedirect,
- '308' => Net::HTTPPermanentRedirect,
'400' => Net::HTTPBadRequest,
'401' => Net::HTTPUnauthorized,
diff --git a/lib/net/https.rb b/lib/net/https.rb
index 58cb6ddf19..d36f82002d 100644
--- a/lib/net/https.rb
+++ b/lib/net/https.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
=begin
= net/https -- SSL/TLS enhancement for Net::HTTP.
@@ -14,7 +13,7 @@
All rights reserved.
== Licence
- This program is licensed under the same licence as Ruby.
+ This program is licenced under the same licence as Ruby.
(See the file 'LICENCE'.)
=end
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 439ca13206..55c611b9c6 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#
# = net/imap.rb
#
@@ -38,7 +37,7 @@ module Net
# arranged in an hierarchical namespace, and each of which
# contains zero or more messages. How this is implemented on
# the server is implementation-dependent; on a UNIX server, it
- # will frequently be implemented as files in mailbox format
+ # will frequently be implemented as a files in mailbox format
# within a hierarchy of directories.
#
# To work on the messages within a mailbox, the client must
@@ -49,12 +48,12 @@ module Net
# related commands implicitly operate.
#
# Messages have two sorts of identifiers: message sequence
- # numbers and UIDs.
+ # numbers, and UIDs.
#
- # Message sequence numbers number messages within a mailbox
- # from 1 up to the number of items in the mailbox. If a new
+ # Message sequence numbers number messages within a mail box
+ # from 1 up to the number of items in the mail box. If new
# message arrives during a session, it receives a sequence
- # number equal to the new size of the mailbox. If messages
+ # number equal to the new size of the mail box. If messages
# are expunged from the mailbox, remaining messages have their
# sequence numbers "shuffled down" to fill the gaps.
#
@@ -64,7 +63,7 @@ module Net
# be assigned in ascending (but not necessarily sequential)
# order within a mailbox; this means that if a non-IMAP client
# rearranges the order of mailitems within a mailbox, the
- # UIDs have to be reassigned. An IMAP client thus cannot
+ # UIDs have to be reassigned. An IMAP client cannot thus
# rearrange message orders.
#
# == Examples of Usage
@@ -114,7 +113,7 @@ module Net
#
# NO:: the attempted command could not be successfully completed. For
# instance, the username/password used for logging in are incorrect;
- # the selected mailbox does not exist; etc.
+ # the selected mailbox does not exists; etc.
#
# BAD:: the request from the client does not follow the server's
# understanding of the IMAP protocol. This includes attempting
@@ -126,7 +125,7 @@ module Net
# BYE:: the server is saying goodbye. This can be part of a normal
# logout sequence, and can be used as part of a login sequence
# to indicate that the server is (for some reason) unwilling
- # to accept your connection. As a response to any other command,
+ # to accept our connection. As a response to any other command,
# it indicates either that the server is shutting down, or that
# the server is timing out the client connection due to inactivity.
#
@@ -224,14 +223,14 @@ module Net
# The thread to receive exceptions.
attr_accessor :client_thread
- # Flag indicating a message has been seen.
+ # Flag indicating a message has been seen
SEEN = :Seen
- # Flag indicating a message has been answered.
+ # Flag indicating a message has been answered
ANSWERED = :Answered
# Flag indicating a message has been flagged for special or urgent
- # attention.
+ # attention
FLAGGED = :Flagged
# Flag indicating a message has been marked for deletion. This
@@ -241,7 +240,7 @@ module Net
# Flag indicating a message is only a draft or work-in-progress version.
DRAFT = :Draft
- # Flag indicating that the message is "recent," meaning that this
+ # Flag indicating that the message is "recent", meaning that this
# session is the first session in which the client has been notified
# of this message.
RECENT = :Recent
@@ -387,7 +386,7 @@ module Net
# Sends an AUTHENTICATE command to authenticate the client.
# The +auth_type+ parameter is a string that represents
# the authentication mechanism to be used. Currently Net::IMAP
- # supports the authentication mechanisms:
+ # supports authentication mechanisms:
#
# LOGIN:: login using cleartext user and password.
# CRAM-MD5:: login with cleartext user and encrypted password
@@ -395,8 +394,8 @@ module Net
# mechanism requires that the server have the user's
# password stored in clear-text password.
#
- # For both of these mechanisms, there should be two +args+: username
- # and (cleartext) password. A server may not support one or the other
+ # For both these mechanisms, there should be two +args+: username
+ # and (cleartext) password. A server may not support one or other
# of these mechanisms; check #capability() for a capability of
# the form "AUTH=LOGIN" or "AUTH=CRAM-MD5".
#
@@ -501,7 +500,7 @@ module Net
# by #lsub().
#
# A Net::IMAP::NoResponseError is raised if +mailbox+ cannot be
- # subscribed to; for instance, because it does not exist.
+ # subscribed to, for instance because it does not exist.
def subscribe(mailbox)
send_command("SUBSCRIBE", mailbox)
end
@@ -510,7 +509,7 @@ module Net
# from the server's set of "active" or "subscribed" mailboxes.
#
# A Net::IMAP::NoResponseError is raised if +mailbox+ cannot be
- # unsubscribed from; for instance, because the client is not currently
+ # unsubscribed from, for instance because the client is not currently
# subscribed to it.
def unsubscribe(mailbox)
send_command("UNSUBSCRIBE", mailbox)
@@ -577,9 +576,9 @@ module Net
end
end
- # Sends the GETQUOTAROOT command along with the specified +mailbox+.
+ # Sends the GETQUOTAROOT command along with specified +mailbox+.
# This command is generally available to both admin and user.
- # If this mailbox exists, it returns an array containing objects of type
+ # If mailbox exists, returns an array containing objects of
# Net::IMAP::MailboxQuotaRoot and Net::IMAP::MailboxQuota.
def getquotaroot(mailbox)
synchronize do
@@ -594,7 +593,7 @@ module Net
# Sends the GETQUOTA command along with specified +mailbox+.
# If this mailbox exists, then an array containing a
# Net::IMAP::MailboxQuota object is returned. This
- # command is generally only available to server admin.
+ # command generally is only available to server admin.
def getquota(mailbox)
synchronize do
send_command("GETQUOTA", mailbox)
@@ -603,8 +602,8 @@ module Net
end
# Sends a SETQUOTA command along with the specified +mailbox+ and
- # +quota+. If +quota+ is nil, then +quota+ will be unset for that
- # mailbox. Typically one needs to be logged in as a server admin
+ # +quota+. If +quota+ is nil, then quota will be unset for that
+ # mailbox. Typically one needs to be logged in as server admin
# for this to work. The IMAP quota commands are described in
# [RFC-2087].
def setquota(mailbox, quota)
@@ -628,7 +627,7 @@ module Net
end
end
- # Send the GETACL command along with a specified +mailbox+.
+ # Send the GETACL command along with specified +mailbox+.
# If this mailbox exists, an array containing objects of
# Net::IMAP::MailboxACLItem will be returned.
def getacl(mailbox)
@@ -640,7 +639,7 @@ module Net
# Sends a LSUB command, and returns a subset of names from the set
# of names that the user has declared as being "active" or
- # "subscribed." +refname+ and +mailbox+ are interpreted as
+ # "subscribed". +refname+ and +mailbox+ are interpreted as
# for #list().
# The return value is an array of +Net::IMAP::MailboxList+.
def lsub(refname, mailbox)
@@ -651,8 +650,8 @@ module Net
end
# Sends a STATUS command, and returns the status of the indicated
- # +mailbox+. +attr+ is a list of one or more attributes whose
- # statuses are to be requested. Supported attributes include:
+ # +mailbox+. +attr+ is a list of one or more attributes that
+ # we are request the status of. Supported attributes include:
#
# MESSAGES:: the number of messages in the mailbox.
# RECENT:: the number of recent messages in the mailbox.
@@ -664,7 +663,7 @@ module Net
# #=> {"RECENT"=>0, "MESSAGES"=>44}
#
# A Net::IMAP::NoResponseError is raised if status values
- # for +mailbox+ cannot be returned; for instance, because it
+ # for +mailbox+ cannot be returned, for instance because it
# does not exist.
def status(mailbox, attr)
synchronize do
@@ -675,7 +674,7 @@ module Net
# Sends a APPEND command to append the +message+ to the end of
# the +mailbox+. The optional +flags+ argument is an array of
- # flags initially passed to the new message. The optional
+ # flags to initially passing to the new message. The optional
# +date_time+ argument specifies the creation time to assign to the
# new message; it defaults to the current time.
# For example:
@@ -703,7 +702,7 @@ module Net
# Sends a CHECK command to request a checkpoint of the currently
# selected mailbox. This performs implementation-specific
- # housekeeping; for instance, reconciling the mailbox's
+ # housekeeping, for instance, reconciling the mailbox's
# in-memory and on-disk state.
def check
send_command("CHECK")
@@ -769,30 +768,18 @@ module Net
return search_internal("SEARCH", keys, charset)
end
- # Similar to #search(), but returns unique identifiers.
+ # As for #search(), but returns unique identifiers.
def uid_search(keys, charset = nil)
return search_internal("UID SEARCH", keys, charset)
end
# Sends a FETCH command to retrieve data associated with a message
- # in the mailbox.
- #
- # The +set+ parameter is a number or a range between two numbers,
- # or an array of those. The number is a message sequence number,
- # where -1 represents a '*' for use in range notation like 100..-1
- # being interpreted as '100:*'. Beware that the +exclude_end?+
- # property of a Range object is ignored, and the contents of a
- # range are independent of the order of the range endpoints as per
- # the protocol specification, so 1...5, 5..1 and 5...1 are all
- # equivalent to 1..5.
- #
- # +attr+ is a list of attributes to fetch; see the documentation
- # for Net::IMAP::FetchData for a list of valid attributes.
- #
- # The return value is an array of Net::IMAP::FetchData or nil
- # (instead of an empty array) if there is no matching message.
- #
- # For example:
+ # in the mailbox. The +set+ parameter is a number or an array of
+ # numbers or a Range object. The number is a message sequence
+ # number. +attr+ is a list of attributes to fetch; see the
+ # documentation for Net::IMAP::FetchData for a list of valid
+ # attributes.
+ # The return value is an array of Net::IMAP::FetchData. For example:
#
# p imap.fetch(6..8, "UID")
# #=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, \\
@@ -813,18 +800,18 @@ module Net
return fetch_internal("FETCH", set, attr)
end
- # Similar to #fetch(), but +set+ contains unique identifiers.
+ # As for #fetch(), but +set+ contains unique identifiers.
def uid_fetch(set, attr)
return fetch_internal("UID FETCH", set, attr)
end
# Sends a STORE command to alter data associated with messages
# in the mailbox, in particular their flags. The +set+ parameter
- # is a number, an array of numbers, or a Range object. Each number
+ # is a number or an array of numbers or a Range object. Each number
# is a message sequence number. +attr+ is the name of a data item
- # to store: 'FLAGS' will replace the message's flag list
- # with the provided one, '+FLAGS' will add the provided flags,
- # and '-FLAGS' will remove them. +flags+ is a list of flags.
+ # to store: 'FLAGS' means to replace the message's flag list
+ # with the provided one; '+FLAGS' means to add the provided flags;
+ # and '-FLAGS' means to remove them. +flags+ is a list of flags.
#
# The return value is an array of Net::IMAP::FetchData. For example:
#
@@ -836,38 +823,24 @@ module Net
return store_internal("STORE", set, attr, flags)
end
- # Similar to #store(), but +set+ contains unique identifiers.
+ # As for #store(), but +set+ contains unique identifiers.
def uid_store(set, attr, flags)
return store_internal("UID STORE", set, attr, flags)
end
# Sends a COPY command to copy the specified message(s) to the end
# of the specified destination +mailbox+. The +set+ parameter is
- # a number, an array of numbers, or a Range object. The number is
+ # a number or an array of numbers or a Range object. The number is
# a message sequence number.
def copy(set, mailbox)
copy_internal("COPY", set, mailbox)
end
- # Similar to #copy(), but +set+ contains unique identifiers.
+ # As for #copy(), but +set+ contains unique identifiers.
def uid_copy(set, mailbox)
copy_internal("UID COPY", set, mailbox)
end
- # Sends a MOVE command to move the specified message(s) to the end
- # of the specified destination +mailbox+. The +set+ parameter is
- # a number, an array of numbers, or a Range object. The number is
- # a message sequence number.
- # The IMAP MOVE extension is described in [RFC-6851].
- def move(set, mailbox)
- copy_internal("MOVE", set, mailbox)
- end
-
- # Similar to #move(), but +set+ contains unique identifiers.
- def uid_move(set, mailbox)
- copy_internal("UID MOVE", set, mailbox)
- end
-
# Sends a SORT command to sort messages in the mailbox.
# Returns an array of message sequence numbers. For example:
#
@@ -881,16 +854,16 @@ module Net
return sort_internal("SORT", sort_keys, search_keys, charset)
end
- # Similar to #sort(), but returns an array of unique identifiers.
+ # As for #sort(), but returns an array of unique identifiers.
def uid_sort(sort_keys, search_keys, charset)
return sort_internal("UID SORT", sort_keys, search_keys, charset)
end
# Adds a response handler. For example, to detect when
- # the server sends a new EXISTS response (which normally
- # indicates new messages being added to the mailbox),
- # add the following handler after selecting the
- # mailbox:
+ # the server sends us a new EXISTS response (which normally
+ # indicates new messages being added to the mail box),
+ # you could add the following handler after selecting the
+ # mailbox.
#
# imap.add_response_handler { |resp|
# if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
@@ -907,7 +880,7 @@ module Net
@response_handlers.delete(handler)
end
- # Similar to #search(), but returns message sequence numbers in threaded
+ # As for #search(), but returns message sequence numbers in threaded
# format, as a Net::IMAP::ThreadMember tree. The supported algorithms
# are:
#
@@ -924,7 +897,7 @@ module Net
return thread_internal("THREAD", algorithm, search_keys, charset)
end
- # Similar to #thread(), but returns unique identifiers instead of
+ # As for #thread(), but returns unique identifiers instead of
# message sequence numbers.
def uid_thread(algorithm, search_keys, charset)
return thread_internal("UID THREAD", algorithm, search_keys, charset)
@@ -934,17 +907,7 @@ module Net
# messages. Yields responses from the server during the IDLE.
#
# Use #idle_done() to leave IDLE.
- #
- # If +timeout+ is given, this method returns after +timeout+ seconds passed.
- # +timeout+ can be used for keep-alive. For example, the following code
- # checks the connection for each 60 seconds.
- #
- # loop do
- # imap.idle(60) do |res|
- # ...
- # end
- # end
- def idle(timeout = nil, &response_handler)
+ def idle(&response_handler)
raise LocalJumpError, "no block given" unless response_handler
response = nil
@@ -956,7 +919,7 @@ module Net
begin
add_response_handler(response_handler)
@idle_done_cond = new_cond
- @idle_done_cond.wait(timeout)
+ @idle_done_cond.wait
@idle_done_cond = nil
if @receiver_thread_terminating
raise Net::IMAP::Error, "connection closed"
@@ -990,7 +953,7 @@ module Net
# containing non-ASCII characters; see [IMAP] section 5.1.3.
#
# Net::IMAP does _not_ automatically encode and decode
- # mailbox names to and from UTF-7.
+ # mailbox names to and from utf7.
def self.decode_utf7(s)
return s.gsub(/&([^-]+)?-/n) {
if $1
@@ -1043,24 +1006,24 @@ module Net
#
# The available options are:
#
- # port:: Port number (default value is 143 for imap, or 993 for imaps)
- # ssl:: If options[:ssl] is true, then an attempt will be made
+ # port:: port number (default value is 143 for imap, or 993 for imaps)
+ # ssl:: if options[:ssl] is true, then an attempt will be made
# to use SSL (now TLS) to connect to the server. For this to work
# OpenSSL [OSSL] and the Ruby OpenSSL [RSSL] extensions need to
# be installed.
- # If options[:ssl] is a hash, it's passed to
+ # if options[:ssl] is a hash, it's passed to
# OpenSSL::SSL::SSLContext#set_params as parameters.
#
# The most common errors are:
#
- # Errno::ECONNREFUSED:: Connection refused by +host+ or an intervening
+ # Errno::ECONNREFUSED:: connection refused by +host+ or an intervening
# firewall.
- # Errno::ETIMEDOUT:: Connection timed out (possibly due to packets
+ # Errno::ETIMEDOUT:: connection timed out (possibly due to packets
# being dropped by an intervening firewall).
- # Errno::ENETUNREACH:: There is no route to that network.
- # SocketError:: Hostname not known or other socket error.
- # Net::IMAP::ByeResponseError:: The connected to the host was successful, but
- # it immediately said goodbye.
+ # Errno::ENETUNREACH:: there is no route to that network.
+ # SocketError:: hostname not known or other socket error.
+ # Net::IMAP::ByeResponseError:: we connected to the host, but they
+ # immediately said goodbye to us.
def initialize(host, port_or_options = {},
usessl = false, certs = nil, verify = true)
super()
@@ -1080,43 +1043,40 @@ module Net
@tagno = 0
@parser = ResponseParser.new
@sock = TCPSocket.open(@host, @port)
- begin
- if options[:ssl]
- start_tls_session(options[:ssl])
- @usessl = true
- else
- @usessl = false
- end
- @responses = Hash.new([].freeze)
- @tagged_responses = {}
- @response_handlers = []
- @tagged_response_arrival = new_cond
- @continuation_request_arrival = new_cond
- @idle_done_cond = nil
- @logout_command_tag = nil
- @debug_output_bol = true
- @exception = nil
-
- @greeting = get_response
- if @greeting.nil?
- raise Error, "connection closed"
- end
- if @greeting.name == "BYE"
- raise ByeResponseError, @greeting
- end
-
- @client_thread = Thread.current
- @receiver_thread = Thread.start {
- begin
- receive_responses
- rescue Exception
- end
- }
- @receiver_thread_terminating = false
- rescue Exception
+ if options[:ssl]
+ start_tls_session(options[:ssl])
+ @usessl = true
+ else
+ @usessl = false
+ end
+ @responses = Hash.new([].freeze)
+ @tagged_responses = {}
+ @response_handlers = []
+ @tagged_response_arrival = new_cond
+ @continuation_request_arrival = new_cond
+ @idle_done_cond = nil
+ @logout_command_tag = nil
+ @debug_output_bol = true
+ @exception = nil
+
+ @greeting = get_response
+ if @greeting.nil?
+ @sock.close
+ raise Error, "connection closed"
+ end
+ if @greeting.name == "BYE"
@sock.close
- raise
+ raise ByeResponseError, @greeting
end
+
+ @client_thread = Thread.current
+ @receiver_thread = Thread.start {
+ begin
+ receive_responses
+ rescue Exception
+ end
+ }
+ @receiver_thread_terminating = false
end
def receive_responses
@@ -1202,7 +1162,7 @@ module Net
end
def get_response
- buff = String.new
+ buff = ""
while true
s = @sock.gets(CRLF)
break unless s
@@ -1281,7 +1241,9 @@ module Net
when nil
when String
when Integer
- NumValidator.ensure_number(data)
+ if data < 0 || data >= 4294967296
+ raise DataFormatError, num.to_s
+ end
when Array
data.each do |i|
validate_data(i)
@@ -1595,7 +1557,7 @@ module Net
case data
when "*"
when Integer
- NumValidator.ensure_nz_number(data)
+ ensure_nz_number(data)
when Range
when Array
data.each do |i|
@@ -1609,42 +1571,11 @@ module Net
raise DataFormatError, data.inspect
end
end
- end
-
- # Common validators of number and nz_number types
- module NumValidator # :nodoc
- class << self
- # Check is passed argument valid 'number' in RFC 3501 terminology
- def valid_number?(num)
- # [RFC 3501]
- # number = 1*DIGIT
- # ; Unsigned 32-bit integer
- # ; (0 <= n < 4,294,967,296)
- num >= 0 && num < 4294967296
- end
-
- # Check is passed argument valid 'nz_number' in RFC 3501 terminology
- def valid_nz_number?(num)
- # [RFC 3501]
- # nz-number = digit-nz *DIGIT
- # ; Non-zero unsigned 32-bit integer
- # ; (0 < n < 4,294,967,296)
- num != 0 && valid_number?(num)
- end
- # Ensure argument is 'number' or raise DataFormatError
- def ensure_number(num)
- return if valid_number?(num)
-
- msg = "number must be unsigned 32-bit integer: #{num}"
- raise DataFormatError, msg
- end
-
- # Ensure argument is 'nz_number' or raise DataFormatError
- def ensure_nz_number(num)
- return if valid_nz_number?(num)
-
- msg = "nz_number must be non-zero unsigned 32-bit integer: #{num}"
+ def ensure_nz_number(num)
+ if num < -1 || num == 0 || num >= 4294967296
+ msg = "nz_number must be non-zero unsigned 32-bit integer: " +
+ num.inspect
raise DataFormatError, msg
end
end
@@ -1677,10 +1608,10 @@ module Net
#
# ==== Fields:
#
- # name:: Returns the name, such as "FLAGS", "LIST", or "FETCH".
+ # name:: Returns the name such as "FLAGS", "LIST", "FETCH"....
#
# data:: Returns the data such as an array of flag symbols,
- # a ((<Net::IMAP::MailboxList>)) object.
+ # a ((<Net::IMAP::MailboxList>)) object....
#
# raw_data:: Returns the raw data string.
UntaggedResponse = Struct.new(:name, :data, :raw_data)
@@ -1701,7 +1632,7 @@ module Net
#
# tag:: Returns the tag.
#
- # name:: Returns the name, one of "OK", "NO", or "BAD".
+ # name:: Returns the name. the name is one of "OK", "NO", "BAD".
#
# data:: Returns the data. See ((<Net::IMAP::ResponseText>)).
#
@@ -1723,6 +1654,7 @@ module Net
#
ResponseText = Struct.new(:code, :text)
+ #
# Net::IMAP::ResponseCode represents response codes.
#
# resp_text_code ::= "ALERT" / "PARSE" /
@@ -1734,9 +1666,9 @@ module Net
#
# ==== Fields:
#
- # name:: Returns the name, such as "ALERT", "PERMANENTFLAGS", or "UIDVALIDITY".
+ # name:: Returns the name such as "ALERT", "PERMANENTFLAGS", "UIDVALIDITY"....
#
- # data:: Returns the data, if it exists.
+ # data:: Returns the data if it exists.
#
ResponseCode = Struct.new(:name, :data)
@@ -1751,7 +1683,7 @@ module Net
# attr:: Returns the name attributes. Each name attribute is a symbol
# capitalized by String#capitalize, such as :Noselect (not :NoSelect).
#
- # delim:: Returns the hierarchy delimiter.
+ # delim:: Returns the hierarchy delimiter
#
# name:: Returns the mailbox name.
#
@@ -1772,9 +1704,9 @@ module Net
#
# mailbox:: The mailbox with the associated quota.
#
- # usage:: Current storage usage of the mailbox.
+ # usage:: Current storage usage of mailbox.
#
- # quota:: Quota limit imposed on the mailbox.
+ # quota:: Quota limit imposed on mailbox.
#
MailboxQuota = Struct.new(:mailbox, :usage, :quota)
@@ -1787,12 +1719,12 @@ module Net
#
# mailbox:: The mailbox with the associated quota.
#
- # quotaroots:: Zero or more quotaroots that affect the quota on the
+ # quotaroots:: Zero or more quotaroots that effect the quota on the
# specified mailbox.
#
MailboxQuotaRoot = Struct.new(:mailbox, :quotaroots)
- # Net::IMAP::MailboxACLItem represents the response from GETACL.
+ # Net::IMAP::MailboxACLItem represents response from GETACL.
#
# acl_data ::= "ACL" SPACE mailbox *(SPACE identifier SPACE rights)
#
@@ -1810,7 +1742,7 @@ module Net
#
MailboxACLItem = Struct.new(:user, :rights, :mailbox)
- # Net::IMAP::StatusData represents the contents of the STATUS response.
+ # Net::IMAP::StatusData represents contents of the STATUS response.
#
# ==== Fields:
#
@@ -1821,7 +1753,7 @@ module Net
#
StatusData = Struct.new(:mailbox, :attr)
- # Net::IMAP::FetchData represents the contents of the FETCH response.
+ # Net::IMAP::FetchData represents contents of the FETCH response.
#
# ==== Fields:
#
@@ -1845,7 +1777,7 @@ module Net
# A Net::IMAP::Envelope object that describes the envelope
# structure of a message.
# [FLAGS]
- # A array of flag symbols that are set for this message. Flag symbols
+ # A array of flag symbols that are set for this message. flag symbols
# are capitalized by String#capitalize.
# [INTERNALDATE]
# A string representing the internal date of the message.
@@ -1900,7 +1832,7 @@ module Net
#
# mailbox:: nil indicates end of [RFC-822] group.
# If non-nil and host is nil, returns [RFC-822] group name.
- # Otherwise, returns [RFC-822] local-part.
+ # Otherwise, returns [RFC-822] local-part
#
# host:: nil indicates [RFC-822] group syntax.
# Otherwise, returns [RFC-822] domain name.
@@ -1920,14 +1852,14 @@ module Net
ContentDisposition = Struct.new(:dsp_type, :param)
# Net::IMAP::ThreadMember represents a thread-node returned
- # by Net::IMAP#thread.
+ # by Net::IMAP#thread
#
# ==== Fields:
#
# seqno:: The sequence number of this message.
#
- # children:: An array of Net::IMAP::ThreadMember objects for mail
- # items that are children of this in the thread.
+ # children:: an array of Net::IMAP::ThreadMember objects for mail
+ # items that are children of this in the thread.
#
ThreadMember = Struct.new(:seqno, :children)
@@ -2154,9 +2086,9 @@ module Net
BEG_REGEXP = /\G(?:\
(?# 1: SPACE )( +)|\
-(?# 2: NIL )(NIL)(?=[\x80-\xff(){ \x00-\x1f\x7f%*"\\\[\]+])|\
-(?# 3: NUMBER )(\d+)(?=[\x80-\xff(){ \x00-\x1f\x7f%*"\\\[\]+])|\
-(?# 4: ATOM )([^\x80-\xff(){ \x00-\x1f\x7f%*"\\\[\]+]+)|\
+(?# 2: NIL )(NIL)(?=[\x80-\xff(){ \x00-\x1f\x7f%*#{'"'}\\\[\]+])|\
+(?# 3: NUMBER )(\d+)(?=[\x80-\xff(){ \x00-\x1f\x7f%*#{'"'}\\\[\]+])|\
+(?# 4: ATOM )([^\x80-\xff(){ \x00-\x1f\x7f%*#{'"'}\\\[\]+]+)|\
(?# 5: QUOTED )"((?:[^\x00\r\n"\\]|\\["\\])*)"|\
(?# 6: LPAR )(\()|\
(?# 7: RPAR )(\))|\
@@ -2440,8 +2372,6 @@ module Net
return body_type_msg
when /\A(?:ATTACHMENT)\z/ni
return body_type_attachment
- when /\A(?:MIXED)\z/ni
- return body_type_mixed
else
return body_type_basic
end
@@ -2524,13 +2454,6 @@ module Net
return BodyTypeAttachment.new(mtype, nil, param)
end
- def body_type_mixed
- mtype = "MULTIPART"
- msubtype = case_insensitive_string
- param, disposition, language, extension = body_ext_mpart
- return BodyTypeBasic.new(mtype, msubtype, param, nil, nil, nil, nil, nil, disposition, language, extension)
- end
-
def body_type_mpart
parts = []
while true
@@ -2650,13 +2573,7 @@ module Net
return param
end
disposition = body_fld_dsp
-
- token = lookahead
- if token.symbol == T_SPACE
- shift_token
- else
- return param, disposition
- end
+ match(T_SPACE)
language = body_fld_lang
token = lookahead
@@ -2740,7 +2657,7 @@ module Net
end
def section
- str = String.new
+ str = ""
token = match(T_LBRA)
str.concat(token.value)
token = match(T_ATOM, T_NUMBER, T_RBRA)
@@ -2925,15 +2842,8 @@ module Net
break
when T_SPACE
shift_token
- when T_NUMBER
+ else
data.push(number)
- when T_LPAR
- # TODO: include the MODSEQ value in a response
- shift_token
- match(T_ATOM)
- match(T_SPACE)
- match(T_NUMBER)
- match(T_RPAR)
end
end
else
@@ -3151,6 +3061,39 @@ module Net
return Address.new(name, route, mailbox, host)
end
+# def flag_list
+# result = []
+# match(T_LPAR)
+# while true
+# token = lookahead
+# case token.symbol
+# when T_RPAR
+# shift_token
+# break
+# when T_SPACE
+# shift_token
+# end
+# result.push(flag)
+# end
+# return result
+# end
+
+# def flag
+# token = lookahead
+# if token.symbol == T_BSLASH
+# shift_token
+# token = lookahead
+# if token.symbol == T_STAR
+# shift_token
+# return token.value.intern
+# else
+# return atom.intern
+# end
+# else
+# return atom
+# end
+# end
+
FLAG_REGEXP = /\
(?# FLAG )\\([^\x80-\xff(){ \x00-\x1f\x7f%"\\]+)|\
(?# ATOM )([^\x80-\xff(){ \x00-\x1f\x7f%*"\\]+)/n
@@ -3221,7 +3164,7 @@ module Net
end
def atom
- result = String.new
+ result = ""
while true
token = lookahead
if atom_token?(token)
@@ -3645,3 +3588,174 @@ module Net
end
end
end
+
+if __FILE__ == $0
+ # :enddoc:
+ require "getoptlong"
+
+ $stdout.sync = true
+ $port = nil
+ $user = ENV["USER"] || ENV["LOGNAME"]
+ $auth = "login"
+ $ssl = false
+ $starttls = false
+
+ def usage
+ <<EOF
+usage: #{$0} [options] <host>
+
+ --help print this message
+ --port=PORT specifies port
+ --user=USER specifies user
+ --auth=AUTH specifies auth type
+ --starttls use starttls
+ --ssl use ssl
+EOF
+ end
+
+ begin
+ require 'io/console'
+ rescue LoadError
+ def _noecho(&block)
+ system("stty", "-echo")
+ begin
+ yield STDIN
+ ensure
+ system("stty", "echo")
+ end
+ end
+ else
+ def _noecho(&block)
+ STDIN.noecho(&block)
+ end
+ end
+
+ def get_password
+ print "password: "
+ begin
+ return _noecho(&:gets).chomp
+ ensure
+ puts
+ end
+ end
+
+ def get_command
+ printf("%s@%s> ", $user, $host)
+ if line = gets
+ return line.strip.split(/\s+/)
+ else
+ return nil
+ end
+ end
+
+ parser = GetoptLong.new
+ parser.set_options(['--debug', GetoptLong::NO_ARGUMENT],
+ ['--help', GetoptLong::NO_ARGUMENT],
+ ['--port', GetoptLong::REQUIRED_ARGUMENT],
+ ['--user', GetoptLong::REQUIRED_ARGUMENT],
+ ['--auth', GetoptLong::REQUIRED_ARGUMENT],
+ ['--starttls', GetoptLong::NO_ARGUMENT],
+ ['--ssl', GetoptLong::NO_ARGUMENT])
+ begin
+ parser.each_option do |name, arg|
+ case name
+ when "--port"
+ $port = arg
+ when "--user"
+ $user = arg
+ when "--auth"
+ $auth = arg
+ when "--ssl"
+ $ssl = true
+ when "--starttls"
+ $starttls = true
+ when "--debug"
+ Net::IMAP.debug = true
+ when "--help"
+ usage
+ exit
+ end
+ end
+ rescue
+ abort usage
+ end
+
+ $host = ARGV.shift
+ unless $host
+ abort usage
+ end
+
+ imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl)
+ begin
+ imap.starttls if $starttls
+ class << password = method(:get_password)
+ alias to_str call
+ end
+ imap.authenticate($auth, $user, password)
+ while true
+ cmd, *args = get_command
+ break unless cmd
+ begin
+ case cmd
+ when "list"
+ for mbox in imap.list("", args[0] || "*")
+ if mbox.attr.include?(Net::IMAP::NOSELECT)
+ prefix = "!"
+ elsif mbox.attr.include?(Net::IMAP::MARKED)
+ prefix = "*"
+ else
+ prefix = " "
+ end
+ print prefix, mbox.name, "\n"
+ end
+ when "select"
+ imap.select(args[0] || "inbox")
+ print "ok\n"
+ when "close"
+ imap.close
+ print "ok\n"
+ when "summary"
+ unless messages = imap.responses["EXISTS"][-1]
+ puts "not selected"
+ next
+ end
+ if messages > 0
+ for data in imap.fetch(1..-1, ["ENVELOPE"])
+ print data.seqno, ": ", data.attr["ENVELOPE"].subject, "\n"
+ end
+ else
+ puts "no message"
+ end
+ when "fetch"
+ if args[0]
+ data = imap.fetch(args[0].to_i, ["RFC822.HEADER", "RFC822.TEXT"])[0]
+ puts data.attr["RFC822.HEADER"]
+ puts data.attr["RFC822.TEXT"]
+ else
+ puts "missing argument"
+ end
+ when "logout", "exit", "quit"
+ break
+ when "help", "?"
+ print <<EOF
+list [pattern] list mailboxes
+select [mailbox] select mailbox
+close close mailbox
+summary display summary
+fetch [msgno] display message
+logout logout
+help, ? display help message
+EOF
+ else
+ print "unknown command: ", cmd, "\n"
+ end
+ rescue Net::IMAP::Error
+ puts $!
+ end
+ end
+ ensure
+ imap.logout
+ imap.disconnect
+ end
+end
+
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index 00209fec46..ebf1085d55 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = net/pop.rb
#
# Copyright (c) 1999-2007 Yukihiro Matsumoto.
@@ -708,7 +707,7 @@ module Net
@mails.each {|m| m.uid = uidl[m.number] }
end
- # debugging output for +msg+
+ # deguging output for +msg+
def logging(msg)
@debug_output << msg + "\n" if @debug_output
end
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index 6b75b94cda..14a68e1115 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = net/protocol.rb
#
@@ -21,7 +20,6 @@
require 'socket'
require 'timeout'
-require 'io/wait'
module Net # :nodoc:
@@ -34,24 +32,6 @@ module Net # :nodoc:
end
End
end
-
- def ssl_socket_connect(s, timeout)
- if timeout
- while true
- raise Net::OpenTimeout if timeout <= 0
- start = Process.clock_gettime Process::CLOCK_MONOTONIC
- # to_io is required because SSLSocket doesn't have wait_readable yet
- case s.connect_nonblock(exception: false)
- when :wait_readable; s.to_io.wait_readable(timeout)
- when :wait_writable; s.to_io.wait_writable(timeout)
- else; break
- end
- timeout -= Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
- end
- else
- s.connect
- end
- end
end
@@ -169,21 +149,23 @@ module Net # :nodoc:
BUFSIZE = 1024 * 16
def rbuf_fill
- case rv = @io.read_nonblock(BUFSIZE, exception: false)
- when String
- return @rbuf << rv
- when :wait_readable
- @io.to_io.wait_readable(@read_timeout) or raise Net::ReadTimeout
- # continue looping
- when :wait_writable
+ begin
+ @rbuf << @io.read_nonblock(BUFSIZE)
+ rescue IO::WaitReadable
+ if IO.select([@io], nil, nil, @read_timeout)
+ retry
+ else
+ raise Net::ReadTimeout
+ end
+ rescue IO::WaitWritable
# OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable.
# http://www.openssl.org/support/faq.html#PROG10
- @io.to_io.wait_writable(@read_timeout) or raise Net::ReadTimeout
- # continue looping
- when nil
- # callers do not care about backtrace, so avoid allocating for it
- raise EOFError, 'end of file reached', []
- end while true
+ if IO.select(nil, [@io], nil, @read_timeout)
+ retry
+ else
+ raise Net::ReadTimeout
+ end
+ end
end
def rbuf_consume(len)
@@ -285,7 +267,7 @@ module Net # :nodoc:
def write_message_0(src)
prev = @written_bytes
each_crlf_line(src) do |line|
- write0 dot_stuff(line)
+ write0 line.sub(/\A\./, '..')
end
@written_bytes - prev
end
@@ -326,15 +308,11 @@ module Net # :nodoc:
private
- def dot_stuff(s)
- s.sub(/\A\./, '..')
- end
-
def using_each_crlf_line
@wbuf = ''
yield
if not @wbuf.empty? # unterminated last line
- write0 dot_stuff(@wbuf.chomp) + "\r\n"
+ write0 @wbuf.chomp + "\r\n"
elsif @written_bytes == 0 # empty src
write0 "\r\n"
end
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 500916c17e..4ed7e746d9 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = net/smtp.rb
#
# Copyright (c) 1999-2007 Yukihiro Matsumoto.
@@ -77,9 +76,8 @@ module Net
#
# This library does NOT provide functions to compose internet mails.
# You must create them by yourself. If you want better mail support,
- # try RubyMail or TMail or search for alternatives in
- # {RubyGems.org}[https://rubygems.org/] or {The Ruby
- # Toolbox}[https://www.ruby-toolbox.com/].
+ # try RubyMail or TMail. You can get both libraries from RAA.
+ # (http://www.ruby-lang.org/en/raa.html)
#
# FYI: the official documentation on internet mail is: [RFC2822] (http://www.ietf.org/rfc/rfc2822.txt).
#
@@ -170,7 +168,7 @@ module Net
# Net::SMTP.start('your.smtp.server', 25, 'mail.from.domain',
# 'Your Account', 'Your Password', :cram_md5)
#
- class SMTP < Protocol
+ class SMTP
Revision = %q$Revision$.split[1]
@@ -584,7 +582,7 @@ module Net
s = ssl_socket(s, @ssl_context)
logging "TLS connection started"
s.sync_close = true
- ssl_socket_connect(s, @open_timeout)
+ s.connect
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
@@ -902,17 +900,10 @@ module Net
end
res = critical {
check_continue get_response('DATA')
- socket_sync_bak = @socket.io.sync
- begin
- @socket.io.sync = false
- if msgstr
- @socket.write_message msgstr
- else
- @socket.write_message_by_block(&block)
- end
- ensure
- @socket.io.flush
- @socket.io.sync = socket_sync_bak
+ if msgstr
+ @socket.write_message msgstr
+ else
+ @socket.write_message_by_block(&block)
end
recv_response()
}
@@ -926,15 +917,7 @@ module Net
private
- def validate_line(line)
- # A bare CR or LF is not allowed in RFC5321.
- if /[\r\n]/ =~ line
- raise ArgumentError, "A line must not contain CR or LF"
- end
- end
-
def getok(reqline)
- validate_line reqline
res = critical {
@socket.writeline reqline
recv_response()
@@ -944,7 +927,6 @@ module Net
end
def get_response(reqline)
- validate_line reqline
@socket.writeline reqline
recv_response()
end
@@ -960,7 +942,7 @@ module Net
end
def critical
- return Response.parse('200 dummy reply code') if @error_occurred
+ return '200 dummy reply code' if @error_occurred
begin
return yield()
rescue Exception
@@ -1059,7 +1041,7 @@ module Net
h
end
- # Determines whether there was an error and raises the appropriate error
+ # Determines whether there was an error and raies the appropriate error
# based on the reply code of the response
def exception_class
case @status
diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb
new file mode 100644
index 0000000000..3c5d6e8e73
--- /dev/null
+++ b/lib/net/telnet.rb
@@ -0,0 +1,763 @@
+# = net/telnet.rb - Simple Telnet Client Library
+#
+# Author:: Wakou Aoyama <wakou@ruby-lang.org>
+# Documentation:: William Webber and Wakou Aoyama
+#
+# This file holds the class Net::Telnet, which provides client-side
+# telnet functionality.
+#
+# For documentation, see Net::Telnet.
+#
+
+require "net/protocol"
+require "English"
+
+module Net
+
+ #
+ # == Net::Telnet
+ #
+ # Provides telnet client functionality.
+ #
+ # This class also has, through delegation, all the methods of a
+ # socket object (by default, a +TCPSocket+, but can be set by the
+ # +Proxy+ option to <tt>new()</tt>). This provides methods such as
+ # <tt>close()</tt> to end the session and <tt>sysread()</tt> to read
+ # data directly from the host, instead of via the <tt>waitfor()</tt>
+ # mechanism. Note that if you do use <tt>sysread()</tt> directly
+ # when in telnet mode, you should probably pass the output through
+ # <tt>preprocess()</tt> to extract telnet command sequences.
+ #
+ # == Overview
+ #
+ # The telnet protocol allows a client to login remotely to a user
+ # account on a server and execute commands via a shell. The equivalent
+ # is done by creating a Net::Telnet class with the +Host+ option
+ # set to your host, calling #login() with your user and password,
+ # issuing one or more #cmd() calls, and then calling #close()
+ # to end the session. The #waitfor(), #print(), #puts(), and
+ # #write() methods, which #cmd() is implemented on top of, are
+ # only needed if you are doing something more complicated.
+ #
+ # A Net::Telnet object can also be used to connect to non-telnet
+ # services, such as SMTP or HTTP. In this case, you normally
+ # want to provide the +Port+ option to specify the port to
+ # connect to, and set the +Telnetmode+ option to false to prevent
+ # the client from attempting to interpret telnet command sequences.
+ # Generally, #login() will not work with other protocols, and you
+ # have to handle authentication yourself.
+ #
+ # For some protocols, it will be possible to specify the +Prompt+
+ # option once when you create the Telnet object and use #cmd() calls;
+ # for others, you will have to specify the response sequence to
+ # look for as the Match option to every #cmd() call, or call
+ # #puts() and #waitfor() directly; for yet others, you will have
+ # to use #sysread() instead of #waitfor() and parse server
+ # responses yourself.
+ #
+ # It is worth noting that when you create a new Net::Telnet object,
+ # you can supply a proxy IO channel via the Proxy option. This
+ # can be used to attach the Telnet object to other Telnet objects,
+ # to already open sockets, or to any read-write IO object. This
+ # can be useful, for instance, for setting up a test fixture for
+ # unit testing.
+ #
+ # == Examples
+ #
+ # === Log in and send a command, echoing all output to stdout
+ #
+ # localhost = Net::Telnet::new("Host" => "localhost",
+ # "Timeout" => 10,
+ # "Prompt" => /[$%#>] \z/n)
+ # localhost.login("username", "password") { |c| print c }
+ # localhost.cmd("command") { |c| print c }
+ # localhost.close
+ #
+ #
+ # === Check a POP server to see if you have mail
+ #
+ # pop = Net::Telnet::new("Host" => "your_destination_host_here",
+ # "Port" => 110,
+ # "Telnetmode" => false,
+ # "Prompt" => /^\+OK/n)
+ # pop.cmd("user " + "your_username_here") { |c| print c }
+ # pop.cmd("pass " + "your_password_here") { |c| print c }
+ # pop.cmd("list") { |c| print c }
+ #
+ # == References
+ #
+ # There are a large number of RFCs relevant to the Telnet protocol.
+ # RFCs 854-861 define the base protocol. For a complete listing
+ # of relevant RFCs, see
+ # http://www.omnifarious.org/~hopper/technical/telnet-rfc.html
+ #
+ class Telnet
+
+ # :stopdoc:
+ IAC = 255.chr # "\377" # "\xff" # interpret as command
+ DONT = 254.chr # "\376" # "\xfe" # you are not to use option
+ DO = 253.chr # "\375" # "\xfd" # please, you use option
+ WONT = 252.chr # "\374" # "\xfc" # I won't use option
+ WILL = 251.chr # "\373" # "\xfb" # I will use option
+ SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation
+ GA = 249.chr # "\371" # "\xf9" # you may reverse the line
+ EL = 248.chr # "\370" # "\xf8" # erase the current line
+ EC = 247.chr # "\367" # "\xf7" # erase the current character
+ AYT = 246.chr # "\366" # "\xf6" # are you there
+ AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish
+ IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently
+ BREAK = 243.chr # "\363" # "\xf3" # break
+ DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning
+ NOP = 241.chr # "\361" # "\xf1" # nop
+ SE = 240.chr # "\360" # "\xf0" # end sub negotiation
+ EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode)
+ ABORT = 238.chr # "\356" # "\xee" # Abort process
+ SUSP = 237.chr # "\355" # "\xed" # Suspend process
+ EOF = 236.chr # "\354" # "\xec" # End of file
+ SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls
+
+ OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission
+ OPT_ECHO = 1.chr # "\001" # "\x01" # Echo
+ OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection
+ OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead
+ OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation
+ OPT_STATUS = 5.chr # "\005" # "\x05" # Status
+ OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark
+ OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo
+ OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width
+ OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size
+ OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition
+ OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops
+ OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition
+ OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition
+ OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops
+ OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition
+ OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition
+ OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII
+ OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout
+ OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro
+ OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal
+ OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP
+ OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output
+ OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location
+ OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type
+ OPT_EOR = 25.chr # "\031" # "\x19" # End of Record
+ OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification
+ OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking
+ OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number
+ OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime
+ OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD
+ OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size
+ OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed
+ OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control
+ OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode
+ OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location
+ OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option
+ OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option
+ OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option
+ OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option
+ OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List
+
+ NULL = "\000"
+ CR = "\015"
+ LF = "\012"
+ EOL = CR + LF
+ REVISION = '$Id$'
+ # :startdoc:
+
+ #
+ # Creates a new Net::Telnet object.
+ #
+ # Attempts to connect to the host (unless the Proxy option is
+ # provided: see below). If a block is provided, it is yielded
+ # status messages on the attempt to connect to the server, of
+ # the form:
+ #
+ # Trying localhost...
+ # Connected to localhost.
+ #
+ # +options+ is a hash of options. The following example lists
+ # all options and their default values.
+ #
+ # host = Net::Telnet::new(
+ # "Host" => "localhost", # default: "localhost"
+ # "Port" => 23, # default: 23
+ # "Binmode" => false, # default: false
+ # "Output_log" => "output_log", # default: nil (no output)
+ # "Dump_log" => "dump_log", # default: nil (no output)
+ # "Prompt" => /[$%#>] \z/n, # default: /[$%#>] \z/n
+ # "Telnetmode" => true, # default: true
+ # "Timeout" => 10, # default: 10
+ # # if ignore timeout then set "Timeout" to false.
+ # "Waittime" => 0, # default: 0
+ # "Proxy" => proxy # default: nil
+ # # proxy is Net::Telnet or IO object
+ # )
+ #
+ # The options have the following meanings:
+ #
+ # Host:: the hostname or IP address of the host to connect to, as a String.
+ # Defaults to "localhost".
+ #
+ # Port:: the port to connect to. Defaults to 23.
+ #
+ # Binmode:: if false (the default), newline substitution is performed.
+ # Outgoing LF is
+ # converted to CRLF, and incoming CRLF is converted to LF. If
+ # true, this substitution is not performed. This value can
+ # also be set with the #binmode() method. The
+ # outgoing conversion only applies to the #puts() and #print()
+ # methods, not the #write() method. The precise nature of
+ # the newline conversion is also affected by the telnet options
+ # SGA and BIN.
+ #
+ # Output_log:: the name of the file to write connection status messages
+ # and all received traffic to. In the case of a proper
+ # Telnet session, this will include the client input as
+ # echoed by the host; otherwise, it only includes server
+ # responses. Output is appended verbatim to this file.
+ # By default, no output log is kept.
+ #
+ # Dump_log:: as for Output_log, except that output is written in hexdump
+ # format (16 bytes per line as hex pairs, followed by their
+ # printable equivalent), with connection status messages
+ # preceded by '#', sent traffic preceded by '>', and
+ # received traffic preceded by '<'. By default, not dump log
+ # is kept.
+ #
+ # Prompt:: a regular expression matching the host's command-line prompt
+ # sequence. This is needed by the Telnet class to determine
+ # when the output from a command has finished and the host is
+ # ready to receive a new command. By default, this regular
+ # expression is /[$%#>] \z/n.
+ #
+ # Telnetmode:: a boolean value, true by default. In telnet mode,
+ # traffic received from the host is parsed for special
+ # command sequences, and these sequences are escaped
+ # in outgoing traffic sent using #puts() or #print()
+ # (but not #write()). If you are using the Net::Telnet
+ # object to connect to a non-telnet service (such as
+ # SMTP or POP), this should be set to "false" to prevent
+ # undesired data corruption. This value can also be set
+ # by the #telnetmode() method.
+ #
+ # Timeout:: the number of seconds to wait before timing out both the
+ # initial attempt to connect to host (in this constructor),
+ # which raises a Net::OpenTimeout, and all attempts to read data
+ # from the host, which raises a Net::ReadTimeout (in #waitfor(),
+ # #cmd(), and #login()). The default value is 10 seconds.
+ # You can disable the timeout by setting this value to false.
+ # In this case, the connect attempt will eventually timeout
+ # on the underlying connect(2) socket call with an
+ # Errno::ETIMEDOUT error (but generally only after a few
+ # minutes), but other attempts to read data from the host
+ # will hang indefinitely if no data is forthcoming.
+ #
+ # Waittime:: the amount of time to wait after seeing what looks like a
+ # prompt (that is, received data that matches the Prompt
+ # option regular expression) to see if more data arrives.
+ # If more data does arrive in this time, Net::Telnet assumes
+ # that what it saw was not really a prompt. This is to try to
+ # avoid false matches, but it can also lead to missing real
+ # prompts (if, for instance, a background process writes to
+ # the terminal soon after the prompt is displayed). By
+ # default, set to 0, meaning not to wait for more data.
+ #
+ # Proxy:: a proxy object to used instead of opening a direct connection
+ # to the host. Must be either another Net::Telnet object or
+ # an IO object. If it is another Net::Telnet object, this
+ # instance will use that one's socket for communication. If an
+ # IO object, it is used directly for communication. Any other
+ # kind of object will cause an error to be raised.
+ #
+ def initialize(options) # :yield: mesg
+ @options = options
+ @options["Host"] = "localhost" unless @options.has_key?("Host")
+ @options["Port"] = 23 unless @options.has_key?("Port")
+ @options["Prompt"] = /[$%#>] \z/n unless @options.has_key?("Prompt")
+ @options["Timeout"] = 10 unless @options.has_key?("Timeout")
+ @options["Waittime"] = 0 unless @options.has_key?("Waittime")
+ unless @options.has_key?("Binmode")
+ @options["Binmode"] = false
+ else
+ unless (true == @options["Binmode"] or false == @options["Binmode"])
+ raise ArgumentError, "Binmode option must be true or false"
+ end
+ end
+
+ unless @options.has_key?("Telnetmode")
+ @options["Telnetmode"] = true
+ else
+ unless (true == @options["Telnetmode"] or false == @options["Telnetmode"])
+ raise ArgumentError, "Telnetmode option must be true or false"
+ end
+ end
+
+ @telnet_option = { "SGA" => false, "BINARY" => false }
+
+ if @options.has_key?("Output_log")
+ @log = File.open(@options["Output_log"], 'a+')
+ @log.sync = true
+ @log.binmode
+ end
+
+ if @options.has_key?("Dump_log")
+ @dumplog = File.open(@options["Dump_log"], 'a+')
+ @dumplog.sync = true
+ @dumplog.binmode
+ def @dumplog.log_dump(dir, x) # :nodoc:
+ len = x.length
+ addr = 0
+ offset = 0
+ while 0 < len
+ if len < 16
+ line = x[offset, len]
+ else
+ line = x[offset, 16]
+ end
+ hexvals = line.unpack('H*')[0]
+ hexvals += ' ' * (32 - hexvals.length)
+ hexvals = format("%s %s %s %s " * 4, *hexvals.unpack('a2' * 16))
+ line = line.gsub(/[\000-\037\177-\377]/n, '.')
+ printf "%s 0x%5.5x: %s%s\n", dir, addr, hexvals, line
+ addr += 16
+ offset += 16
+ len -= 16
+ end
+ print "\n"
+ end
+ end
+
+ if @options.has_key?("Proxy")
+ if @options["Proxy"].kind_of?(Net::Telnet)
+ @sock = @options["Proxy"].sock
+ elsif @options["Proxy"].kind_of?(IO)
+ @sock = @options["Proxy"]
+ else
+ raise "Error: Proxy must be an instance of Net::Telnet or IO."
+ end
+ else
+ message = "Trying " + @options["Host"] + "...\n"
+ yield(message) if block_given?
+ @log.write(message) if @options.has_key?("Output_log")
+ @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
+
+ begin
+ if @options["Timeout"] == false
+ @sock = TCPSocket.open(@options["Host"], @options["Port"])
+ else
+ Timeout.timeout(@options["Timeout"], Net::OpenTimeout) do
+ @sock = TCPSocket.open(@options["Host"], @options["Port"])
+ end
+ end
+ rescue Net::OpenTimeout
+ raise Net::OpenTimeout, "timed out while opening a connection to the host"
+ rescue
+ @log.write($ERROR_INFO.to_s + "\n") if @options.has_key?("Output_log")
+ @dumplog.log_dump('#', $ERROR_INFO.to_s + "\n") if @options.has_key?("Dump_log")
+ raise
+ end
+ @sock.sync = true
+ @sock.binmode
+
+ message = "Connected to " + @options["Host"] + ".\n"
+ yield(message) if block_given?
+ @log.write(message) if @options.has_key?("Output_log")
+ @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
+ end
+
+ end # initialize
+
+ # The socket the Telnet object is using. Note that this object becomes
+ # a delegate of the Telnet object, so normally you invoke its methods
+ # directly on the Telnet object.
+ attr :sock
+
+ # Set telnet command interpretation on (+mode+ == true) or off
+ # (+mode+ == false), or return the current value (+mode+ not
+ # provided). It should be on for true telnet sessions, off if
+ # using Net::Telnet to connect to a non-telnet service such
+ # as SMTP.
+ def telnetmode(mode = nil)
+ case mode
+ when nil
+ @options["Telnetmode"]
+ when true, false
+ @options["Telnetmode"] = mode
+ else
+ raise ArgumentError, "argument must be true or false, or missing"
+ end
+ end
+
+ # Turn telnet command interpretation on (true) or off (false). It
+ # should be on for true telnet sessions, off if using Net::Telnet
+ # to connect to a non-telnet service such as SMTP.
+ def telnetmode=(mode)
+ if (true == mode or false == mode)
+ @options["Telnetmode"] = mode
+ else
+ raise ArgumentError, "argument must be true or false"
+ end
+ end
+
+ # Turn newline conversion on (+mode+ == false) or off (+mode+ == true),
+ # or return the current value (+mode+ is not specified).
+ def binmode(mode = nil)
+ case mode
+ when nil
+ @options["Binmode"]
+ when true, false
+ @options["Binmode"] = mode
+ else
+ raise ArgumentError, "argument must be true or false"
+ end
+ end
+
+ # Turn newline conversion on (false) or off (true).
+ def binmode=(mode)
+ if (true == mode or false == mode)
+ @options["Binmode"] = mode
+ else
+ raise ArgumentError, "argument must be true or false"
+ end
+ end
+
+ # Preprocess received data from the host.
+ #
+ # Performs newline conversion and detects telnet command sequences.
+ # Called automatically by #waitfor(). You should only use this
+ # method yourself if you have read input directly using sysread()
+ # or similar, and even then only if in telnet mode.
+ def preprocess(string)
+ # combine CR+NULL into CR
+ string = string.gsub(/#{CR}#{NULL}/no, CR) if @options["Telnetmode"]
+
+ # combine EOL into "\n"
+ string = string.gsub(/#{EOL}/no, "\n") unless @options["Binmode"]
+
+ # remove NULL
+ string = string.gsub(/#{NULL}/no, '') unless @options["Binmode"]
+
+ string.gsub(/#{IAC}(
+ [#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]|
+ [#{DO}#{DONT}#{WILL}#{WONT}]
+ [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}]|
+ #{SB}[^#{IAC}]*#{IAC}#{SE}
+ )/xno) do
+ if IAC == $1 # handle escaped IAC characters
+ IAC
+ elsif AYT == $1 # respond to "IAC AYT" (are you there)
+ self.write("nobody here but us pigeons" + EOL)
+ ''
+ elsif DO[0] == $1[0] # respond to "IAC DO x"
+ if OPT_BINARY[0] == $1[1]
+ @telnet_option["BINARY"] = true
+ self.write(IAC + WILL + OPT_BINARY)
+ else
+ self.write(IAC + WONT + $1[1..1])
+ end
+ ''
+ elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x"
+ self.write(IAC + WONT + $1[1..1])
+ ''
+ elsif WILL[0] == $1[0] # respond to "IAC WILL x"
+ if OPT_BINARY[0] == $1[1]
+ self.write(IAC + DO + OPT_BINARY)
+ elsif OPT_ECHO[0] == $1[1]
+ self.write(IAC + DO + OPT_ECHO)
+ elsif OPT_SGA[0] == $1[1]
+ @telnet_option["SGA"] = true
+ self.write(IAC + DO + OPT_SGA)
+ else
+ self.write(IAC + DONT + $1[1..1])
+ end
+ ''
+ elsif WONT[0] == $1[0] # respond to "IAC WON'T x"
+ if OPT_ECHO[0] == $1[1]
+ self.write(IAC + DONT + OPT_ECHO)
+ elsif OPT_SGA[0] == $1[1]
+ @telnet_option["SGA"] = false
+ self.write(IAC + DONT + OPT_SGA)
+ else
+ self.write(IAC + DONT + $1[1..1])
+ end
+ ''
+ else
+ ''
+ end
+ end
+ end # preprocess
+
+ # Read data from the host until a certain sequence is matched.
+ #
+ # If a block is given, the received data will be yielded as it
+ # is read in (not necessarily all in one go), or nil if EOF
+ # occurs before any data is received. Whether a block is given
+ # or not, all data read will be returned in a single string, or again
+ # nil if EOF occurs before any data is received. Note that
+ # received data includes the matched sequence we were looking for.
+ #
+ # +options+ can be either a regular expression or a hash of options.
+ # If a regular expression, this specifies the data to wait for.
+ # If a hash, this can specify the following options:
+ #
+ # Match:: a regular expression, specifying the data to wait for.
+ # Prompt:: as for Match; used only if Match is not specified.
+ # String:: as for Match, except a string that will be converted
+ # into a regular expression. Used only if Match and
+ # Prompt are not specified.
+ # Timeout:: the number of seconds to wait for data from the host
+ # before raising a Timeout::Error. If set to false,
+ # no timeout will occur. If not specified, the
+ # Timeout option value specified when this instance
+ # was created will be used, or, failing that, the
+ # default value of 10 seconds.
+ # Waittime:: the number of seconds to wait after matching against
+ # the input data to see if more data arrives. If more
+ # data arrives within this time, we will judge ourselves
+ # not to have matched successfully, and will continue
+ # trying to match. If not specified, the Waittime option
+ # value specified when this instance was created will be
+ # used, or, failing that, the default value of 0 seconds,
+ # which means not to wait for more input.
+ # FailEOF:: if true, when the remote end closes the connection then an
+ # EOFError will be raised. Otherwise, defaults to the old
+ # behaviour that the function will return whatever data
+ # has been received already, or nil if nothing was received.
+ #
+ def waitfor(options) # :yield: recvdata
+ time_out = @options["Timeout"]
+ waittime = @options["Waittime"]
+ fail_eof = @options["FailEOF"]
+
+ if options.kind_of?(Hash)
+ prompt = if options.has_key?("Match")
+ options["Match"]
+ elsif options.has_key?("Prompt")
+ options["Prompt"]
+ elsif options.has_key?("String")
+ Regexp.new( Regexp.quote(options["String"]) )
+ end
+ time_out = options["Timeout"] if options.has_key?("Timeout")
+ waittime = options["Waittime"] if options.has_key?("Waittime")
+ fail_eof = options["FailEOF"] if options.has_key?("FailEOF")
+ else
+ prompt = options
+ end
+
+ if time_out == false
+ time_out = nil
+ end
+
+ line = ''
+ buf = ''
+ rest = ''
+ until(prompt === line and not IO::select([@sock], nil, nil, waittime))
+ unless IO::select([@sock], nil, nil, time_out)
+ raise Net::ReadTimeout, "timed out while waiting for more data"
+ end
+ begin
+ c = @sock.readpartial(1024 * 1024)
+ @dumplog.log_dump('<', c) if @options.has_key?("Dump_log")
+ if @options["Telnetmode"]
+ c = rest + c
+ if Integer(c.rindex(/#{IAC}#{SE}/no) || 0) <
+ Integer(c.rindex(/#{IAC}#{SB}/no) || 0)
+ buf = preprocess(c[0 ... c.rindex(/#{IAC}#{SB}/no)])
+ rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1]
+ elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) ||
+ c.rindex(/\r\z/no)
+ buf = preprocess(c[0 ... pt])
+ rest = c[pt .. -1]
+ else
+ buf = preprocess(c)
+ rest = ''
+ end
+ else
+ # Not Telnetmode.
+ #
+ # We cannot use preprocess() on this data, because that
+ # method makes some Telnetmode-specific assumptions.
+ buf = rest + c
+ rest = ''
+ unless @options["Binmode"]
+ if pt = buf.rindex(/\r\z/no)
+ buf = buf[0 ... pt]
+ rest = buf[pt .. -1]
+ end
+ buf.gsub!(/#{EOL}/no, "\n")
+ end
+ end
+ @log.print(buf) if @options.has_key?("Output_log")
+ line += buf
+ yield buf if block_given?
+ rescue EOFError # End of file reached
+ raise if fail_eof
+ if line == ''
+ line = nil
+ yield nil if block_given?
+ end
+ break
+ end
+ end
+ line
+ end
+
+ # Write +string+ to the host.
+ #
+ # Does not perform any conversions on +string+. Will log +string+ to the
+ # dumplog, if the Dump_log option is set.
+ def write(string)
+ length = string.length
+ while 0 < length
+ IO::select(nil, [@sock])
+ @dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log")
+ length -= @sock.syswrite(string[-length..-1])
+ end
+ end
+
+ # Sends a string to the host.
+ #
+ # This does _not_ automatically append a newline to the string. Embedded
+ # newlines may be converted and telnet command sequences escaped
+ # depending upon the values of telnetmode, binmode, and telnet options
+ # set by the host.
+ def print(string)
+ string = string.gsub(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"]
+
+ if @options["Binmode"]
+ self.write(string)
+ else
+ if @telnet_option["BINARY"] and @telnet_option["SGA"]
+ # IAC WILL SGA IAC DO BIN send EOL --> CR
+ self.write(string.gsub(/\n/n, CR))
+ elsif @telnet_option["SGA"]
+ # IAC WILL SGA send EOL --> CR+NULL
+ self.write(string.gsub(/\n/n, CR + NULL))
+ else
+ # NONE send EOL --> CR+LF
+ self.write(string.gsub(/\n/n, EOL))
+ end
+ end
+ end
+
+ # Sends a string to the host.
+ #
+ # Same as #print(), but appends a newline to the string.
+ def puts(string)
+ self.print(string + "\n")
+ end
+
+ # Send a command to the host.
+ #
+ # More exactly, sends a string to the host, and reads in all received
+ # data until is sees the prompt or other matched sequence.
+ #
+ # If a block is given, the received data will be yielded to it as
+ # it is read in. Whether a block is given or not, the received data
+ # will be return as a string. Note that the received data includes
+ # the prompt and in most cases the host's echo of our command.
+ #
+ # +options+ is either a String, specified the string or command to
+ # send to the host; or it is a hash of options. If a hash, the
+ # following options can be specified:
+ #
+ # String:: the command or other string to send to the host.
+ # Match:: a regular expression, the sequence to look for in
+ # the received data before returning. If not specified,
+ # the Prompt option value specified when this instance
+ # was created will be used, or, failing that, the default
+ # prompt of /[$%#>] \z/n.
+ # Timeout:: the seconds to wait for data from the host before raising
+ # a Timeout error. If not specified, the Timeout option
+ # value specified when this instance was created will be
+ # used, or, failing that, the default value of 10 seconds.
+ #
+ # The command or other string will have the newline sequence appended
+ # to it.
+ def cmd(options) # :yield: recvdata
+ match = @options["Prompt"]
+ time_out = @options["Timeout"]
+ fail_eof = @options["FailEOF"]
+
+ if options.kind_of?(Hash)
+ string = options["String"]
+ match = options["Match"] if options.has_key?("Match")
+ time_out = options["Timeout"] if options.has_key?("Timeout")
+ fail_eof = options["FailEOF"] if options.has_key?("FailEOF")
+ else
+ string = options
+ end
+
+ self.puts(string)
+ if block_given?
+ waitfor({"Prompt" => match, "Timeout" => time_out, "FailEOF" => fail_eof}){|c| yield c }
+ else
+ waitfor({"Prompt" => match, "Timeout" => time_out, "FailEOF" => fail_eof})
+ end
+ end
+
+ # Login to the host with a given username and password.
+ #
+ # The username and password can either be provided as two string
+ # arguments in that order, or as a hash with keys "Name" and
+ # "Password".
+ #
+ # This method looks for the strings "login" and "Password" from the
+ # host to determine when to send the username and password. If the
+ # login sequence does not follow this pattern (for instance, you
+ # are connecting to a service other than telnet), you will need
+ # to handle login yourself.
+ #
+ # The password can be omitted, either by only
+ # provided one String argument, which will be used as the username,
+ # or by providing a has that has no "Password" key. In this case,
+ # the method will not look for the "Password:" prompt; if it is
+ # sent, it will have to be dealt with by later calls.
+ #
+ # The method returns all data received during the login process from
+ # the host, including the echoed username but not the password (which
+ # the host should not echo). If a block is passed in, this received
+ # data is also yielded to the block as it is received.
+ def login(options, password = nil) # :yield: recvdata
+ login_prompt = /[Ll]ogin[: ]*\z/n
+ password_prompt = /[Pp]ass(?:word|phrase)[: ]*\z/n
+ if options.kind_of?(Hash)
+ username = options["Name"]
+ password = options["Password"]
+ login_prompt = options["LoginPrompt"] if options["LoginPrompt"]
+ password_prompt = options["PasswordPrompt"] if options["PasswordPrompt"]
+ else
+ username = options
+ end
+
+ if block_given?
+ line = waitfor(login_prompt){|c| yield c }
+ if password
+ line += cmd({"String" => username,
+ "Match" => password_prompt}){|c| yield c }
+ line += cmd(password){|c| yield c }
+ else
+ line += cmd(username){|c| yield c }
+ end
+ else
+ line = waitfor(login_prompt)
+ if password
+ line += cmd({"String" => username,
+ "Match" => password_prompt})
+ line += cmd(password)
+ else
+ line += cmd(username)
+ end
+ end
+ line
+ end
+
+ # Closes the connection
+ def close
+ @sock.close
+ end
+
+ end # class Telnet
+end # module Net
+
diff --git a/lib/observer.rb b/lib/observer.rb
index fa7446f384..99610f7505 100644
--- a/lib/observer.rb
+++ b/lib/observer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Implementation of the _Observer_ object-oriented design pattern. The
# following documentation is copied, with modifications, from "Programming
@@ -128,7 +127,7 @@ module Observable
def add_observer(observer, func=:update)
@observer_peers = {} unless defined? @observer_peers
unless observer.respond_to? func
- raise NoMethodError, "observer does not respond to `#{func}'"
+ raise NoMethodError, "observer does not respond to `#{func.to_s}'"
end
@observer_peers[observer] = func
end
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 9e4a5e24c1..b1a253841d 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'uri'
require 'stringio'
require 'time'
@@ -74,7 +73,7 @@ end
# The environment variables such as http_proxy, https_proxy and ftp_proxy
# are in effect by default. Here we disable proxy:
#
-# open("http://www.ruby-lang.org/en/", :proxy => nil) {|f|
+# open("http://www.ruby-lang.org/en/raa.html", :proxy => nil) {|f|
# # ...
# }
#
@@ -103,7 +102,6 @@ module OpenURI
:content_length_proc => true,
:http_basic_authentication => true,
:read_timeout => true,
- :open_timeout => true,
:ssl_ca_cert => nil,
:ssl_verify_mode => nil,
:ftp_active_mode => false,
@@ -157,7 +155,7 @@ module OpenURI
if io.respond_to? :close!
io.close! # Tempfile
else
- io.close if !io.closed?
+ io.close
end
end
else
@@ -258,7 +256,8 @@ module OpenURI
raise "Non-HTTP proxy URI: #{proxy_uri}" if proxy_uri.class != URI::HTTP
end
- if target.userinfo
+ if target.userinfo && "1.9.0" <= RUBY_VERSION
+ # don't raise for 1.8 because compatibility.
raise ArgumentError, "userinfo not supported. [RFC3986]"
end
@@ -289,19 +288,17 @@ module OpenURI
end
end
- http = proxy ? klass.new(target_host, target_port) : klass.new(target_host, target_port, nil)
+ http = klass.new(target_host, target_port)
if target.class == URI::HTTPS
require 'net/https'
http.use_ssl = true
http.verify_mode = options[:ssl_verify_mode] || OpenSSL::SSL::VERIFY_PEER
store = OpenSSL::X509::Store.new
if options[:ssl_ca_cert]
- Array(options[:ssl_ca_cert]).each do |cert|
- if File.directory? cert
- store.add_path cert
- else
- store.add_file cert
- end
+ if File.directory? options[:ssl_ca_cert]
+ store.add_path options[:ssl_ca_cert]
+ else
+ store.add_file options[:ssl_ca_cert]
end
else
store.set_default_paths
@@ -311,9 +308,6 @@ module OpenURI
if options.include? :read_timeout
http.read_timeout = options[:read_timeout]
end
- if options.include? :open_timeout
- http.open_timeout = options[:open_timeout]
- end
resp = nil
http.start {
@@ -540,9 +534,8 @@ module OpenURI
end
end
- # Returns a list of encodings in Content-Encoding field as an array of
- # strings.
- #
+ # returns a list of encodings in Content-Encoding field
+ # as an Array of String.
# The encodings are downcased for canonicalization.
def content_encoding
vs = @metas['content-encoding']
@@ -674,16 +667,9 @@ module OpenURI
#
# :read_timeout option specifies a timeout of read for http connections.
#
- # [:open_timeout]
- # Synopsis:
- # :open_timeout=>nil (no timeout)
- # :open_timeout=>10 (10 second)
- #
- # :open_timeout option specifies a timeout of open for http connections.
- #
# [:ssl_ca_cert]
# Synopsis:
- # :ssl_ca_cert=>filename or an Array of filenames
+ # :ssl_ca_cert=>filename
#
# :ssl_ca_cert is used to specify CA certificate for SSL.
# If it is given, default certificates are not used.
@@ -773,7 +759,7 @@ module URI
# The access sequence is defined by RFC 1738
ftp = Net::FTP.new
ftp.connect(self.hostname, self.port)
- ftp.passive = !options[:ftp_active_mode]
+ ftp.passive = true if !options[:ftp_active_mode]
# todo: extract user/passwd from .netrc.
user = 'anonymous'
passwd = nil
diff --git a/lib/open3.rb b/lib/open3.rb
index 3c9d450737..134601c907 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
#
# = open3.rb: Popen, but with stderr, too
#
@@ -192,10 +190,6 @@ module Open3
module_function :popen2e
def popen_run(cmd, opts, child_io, parent_io) # :nodoc:
- if last = Hash.try_convert(cmd.last)
- opts = opts.merge(last)
- cmd.pop
- end
pid = spawn(*cmd, opts)
wait_thr = Process.detach(pid)
child_io.each {|io| io.close }
@@ -220,11 +214,11 @@ module Open3
# stdout_str, stderr_str, status = Open3.capture3([env,] cmd... [, opts])
#
# The arguments env, cmd and opts are passed to Open3.popen3 except
- # <code>opts[:stdin_data]</code> and <code>opts[:binmode]</code>. See Process.spawn.
+ # opts[:stdin_data] and opts[:binmode]. See Process.spawn.
#
- # If <code>opts[:stdin_data]</code> is specified, it is sent to the command's standard input.
+ # If opts[:stdin_data] is specified, it is sent to the command's standard input.
#
- # If <code>opts[:binmode]</code> is true, internal pipes are set to binary mode.
+ # If opts[:binmode] is true, internal pipes are set to binary mode.
#
# Examples:
#
@@ -241,7 +235,7 @@ module Open3
# p e #=> "bar\nbaz\nfoo\n"
# p s #=> #<Process::Status: pid 32682 exit 0>
#
- # # generate a thumbnail image using the convert command of ImageMagick.
+ # # generate a thumnail image using the convert command of ImageMagick.
# # However, if the image is really stored in a file,
# # system("convert", "-thumbnail", "80", "png:#{filename}", "png:-") is better
# # because of reduced memory consumption.
@@ -249,9 +243,9 @@ module Open3
# # Open3.capture3 should be considered.
# #
# image = File.read("/usr/share/openclipart/png/animals/mammals/sheep-md-v0.1.png", :binmode=>true)
- # thumbnail, err, s = Open3.capture3("convert -thumbnail 80 png:- png:-", :stdin_data=>image, :binmode=>true)
+ # thumnail, err, s = Open3.capture3("convert -thumbnail 80 png:- png:-", :stdin_data=>image, :binmode=>true)
# if s.success?
- # STDOUT.binmode; print thumbnail
+ # STDOUT.binmode; print thumnail
# end
#
def capture3(*cmd, stdin_data: '', binmode: false, **opts)
@@ -263,10 +257,7 @@ module Open3
end
out_reader = Thread.new { o.read }
err_reader = Thread.new { e.read }
- begin
- i.write stdin_data
- rescue Errno::EPIPE
- end
+ i.write stdin_data
i.close
[out_reader.value, err_reader.value, t.value]
}
@@ -278,11 +269,11 @@ module Open3
# stdout_str, status = Open3.capture2([env,] cmd... [, opts])
#
# The arguments env, cmd and opts are passed to Open3.popen3 except
- # <code>opts[:stdin_data]</code> and <code>opts[:binmode]</code>. See Process.spawn.
+ # opts[:stdin_data] and opts[:binmode]. See Process.spawn.
#
- # If <code>opts[:stdin_data]</code> is specified, it is sent to the command's standard input.
+ # If opts[:stdin_data] is specified, it is sent to the command's standard input.
#
- # If <code>opts[:binmode]</code> is true, internal pipes are set to binary mode.
+ # If opts[:binmode] is true, internal pipes are set to binary mode.
#
# Example:
#
@@ -302,19 +293,14 @@ module Open3
# End
# image, s = Open3.capture2("gnuplot", :stdin_data=>gnuplot_commands, :binmode=>true)
#
- def capture2(*cmd, stdin_data: nil, binmode: false, **opts)
+ def capture2(*cmd, stdin_data: '', binmode: false, **opts)
popen2(*cmd, opts) {|i, o, t|
if binmode
i.binmode
o.binmode
end
out_reader = Thread.new { o.read }
- if stdin_data
- begin
- i.write stdin_data
- rescue Errno::EPIPE
- end
- end
+ i.write stdin_data
i.close
[out_reader.value, t.value]
}
@@ -326,30 +312,25 @@ module Open3
# stdout_and_stderr_str, status = Open3.capture2e([env,] cmd... [, opts])
#
# The arguments env, cmd and opts are passed to Open3.popen3 except
- # <code>opts[:stdin_data]</code> and <code>opts[:binmode]</code>. See Process.spawn.
+ # opts[:stdin_data] and opts[:binmode]. See Process.spawn.
#
- # If <code>opts[:stdin_data]</code> is specified, it is sent to the command's standard input.
+ # If opts[:stdin_data] is specified, it is sent to the command's standard input.
#
- # If <code>opts[:binmode]</code> is true, internal pipes are set to binary mode.
+ # If opts[:binmode] is true, internal pipes are set to binary mode.
#
# Example:
#
# # capture make log
# make_log, s = Open3.capture2e("make")
#
- def capture2e(*cmd, stdin_data: nil, binmode: false, **opts)
+ def capture2e(*cmd, stdin_data: '', binmode: false, **opts)
popen2e(*cmd, opts) {|i, oe, t|
if binmode
i.binmode
oe.binmode
end
outerr_reader = Thread.new { oe.read }
- if stdin_data
- begin
- i.write stdin_data
- rescue Errno::EPIPE
- end
- end
+ i.write stdin_data
i.close
[outerr_reader.value, t.value]
}
@@ -667,3 +648,16 @@ module Open3
end
end
+
+if $0 == __FILE__
+ a = Open3.popen3("nroff -man")
+ Thread.start do
+ while line = gets
+ a[0].print line
+ end
+ a[0].close
+ end
+ while line = a[1].gets
+ print ":", line
+ end
+end
diff --git a/lib/optionparser.rb b/lib/optionparser.rb
deleted file mode 100644
index 4b9b40d82a..0000000000
--- a/lib/optionparser.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: false
-require_relative 'optparse'
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 40425253f4..33faed0057 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# optparse.rb - command-line option analysis with the OptionParser class.
#
@@ -83,155 +82,6 @@
# p options
# p ARGV
#
-# === Generating Help
-#
-# OptionParser can be used to automatically generate help for the commands you
-# write:
-#
-# require 'optparse'
-#
-# Options = Struct.new(:name)
-#
-# class Parser
-# def self.parse(options)
-# args = Options.new("world")
-#
-# opt_parser = OptionParser.new do |opts|
-# opts.banner = "Usage: example.rb [options]"
-#
-# opts.on("-nNAME", "--name=NAME", "Name to say hello to") do |n|
-# args.name = n
-# end
-#
-# opts.on("-h", "--help", "Prints this help") do
-# puts opts
-# exit
-# end
-# end
-#
-# opt_parser.parse!(options)
-# return args
-# end
-# end
-# options = Parser.parse %w[--help]
-#
-# #=>
-# # Usage: example.rb [options]
-# # -n, --name=NAME Name to say hello to
-# # -h, --help Prints this help
-#
-# === Required Arguments
-#
-# For options that require an argument, option specification strings may include an
-# option name in all caps. If an option is used without the required argument,
-# an exception will be raised.
-# require 'optparse'
-#
-# options = {}
-# OptionParser.new do |parser|
-# parser.on("-r", "--require LIBRARY",
-# "Require the LIBRARY before executing your script") do |lib|
-# puts "You required #{lib}!"
-# end
-# end.parse!
-#
-# Used:
-#
-# bash-3.2$ ruby optparse-test.rb -r
-# optparse-test.rb:9:in `<main>': missing argument: -r (OptionParser::MissingArgument)
-# bash-3.2$ ruby optparse-test.rb -r my-library
-# You required my-library!
-#
-# === Type Coercion
-#
-# OptionParser supports the ability to coerce command line arguments
-# into objects for us.
-#
-# OptionParser comes with a few ready-to-use kinds of type
-# coercion. They are:
-#
-# - Date -- Anything accepted by +Date.parse+
-# - DateTime -- Anything accepted by +DateTime.parse+
-# - Time -- Anything accepted by +Time.httpdate+ or +Time.parse+
-# - URI -- Anything accepted by +URI.parse+
-# - Shellwords -- Anything accepted by +Shellwords.shellwords+
-# - String -- Any non-empty string
-# - Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040)
-# - Float -- Any float. (e.g. 10, 3.14, -100E+13)
-# - Numeric -- Any integer, float, or rational (1, 3.4, 1/3)
-# - DecimalInteger -- Like +Integer+, but no octal format.
-# - OctalInteger -- Like +Integer+, but no decimal format.
-# - DecimalNumeric -- Decimal integer or float.
-# - TrueClass -- Accepts '+, yes, true, -, no, false' and
-# defaults as +true+
-# - FalseClass -- Same as +TrueClass+, but defaults to +false+
-# - Array -- Strings separated by ',' (e.g. 1,2,3)
-# - Regexp -- Regular expressions. Also includes options.
-#
-# We can also add our own coercions, which we will cover soon.
-#
-# ==== Using Built-in Conversions
-#
-# As an example, the built-in +Time+ conversion is used. The other built-in
-# conversions behave in the same way.
-# OptionParser will attempt to parse the argument
-# as a +Time+. If it succeeds, that time will be passed to the
-# handler block. Otherwise, an exception will be raised.
-#
-# require 'optparse'
-# require 'optparse/time'
-# OptionParser.new do |parser|
-# parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
-# p time
-# end
-# end.parse!
-#
-# Used:
-# bash-3.2$ ruby optparse-test.rb -t nonsense
-# ... invalid argument: -t nonsense (OptionParser::InvalidArgument)
-# from ... time.rb:5:in `block in <top (required)>'
-# from optparse-test.rb:31:in `<main>'
-# bash-3.2$ ruby optparse-test.rb -t 10-11-12
-# 2010-11-12 00:00:00 -0500
-# bash-3.2$ ruby optparse-test.rb -t 9:30
-# 2014-08-13 09:30:00 -0400
-#
-# ==== Creating Custom Conversions
-#
-# The +accept+ method on OptionParser may be used to create converters.
-# It specifies which conversion block to call whenever a class is specified.
-# The example below uses it to fetch a +User+ object before the +on+ handler receives it.
-#
-# require 'optparse'
-#
-# User = Struct.new(:id, :name)
-#
-# def find_user id
-# not_found = ->{ raise "No User Found for id #{id}" }
-# [ User.new(1, "Sam"),
-# User.new(2, "Gandalf") ].find(not_found) do |u|
-# u.id == id
-# end
-# end
-#
-# op = OptionParser.new
-# op.accept(User) do |user_id|
-# find_user user_id.to_i
-# end
-#
-# op.on("--user ID", User) do |user|
-# puts user
-# end
-#
-# op.parse!
-#
-# output:
-# bash-3.2$ ruby optparse-test.rb --user 1
-# #<struct User id=1, name="Sam">
-# bash-3.2$ ruby optparse-test.rb --user 2
-# #<struct User id=2, name="Gandalf">
-# bash-3.2$ ruby optparse-test.rb --user 3
-# optparse-test.rb:15:in `block in find_user': No User Found for id 3 (RuntimeError)
# === Complete example
#
# The following example is a complete Ruby program. You can run it and see the
@@ -244,142 +94,110 @@
# require 'pp'
#
# class OptparseExample
-# Version = '1.0.0'
#
# CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
# CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
#
-# class ScriptOptions
-# attr_accessor :library, :inplace, :encoding, :transfer_type,
-# :verbose, :extension, :delay, :time, :record_separator,
-# :list
-#
-# def initialize
-# self.library = []
-# self.inplace = false
-# self.encoding = "utf8"
-# self.transfer_type = :auto
-# self.verbose = false
-# end
+# #
+# # Return a structure describing the options.
+# #
+# def self.parse(args)
+# # The options specified on the command line will be collected in *options*.
+# # We set default values here.
+# options = OpenStruct.new
+# options.library = []
+# options.inplace = false
+# options.encoding = "utf8"
+# options.transfer_type = :auto
+# options.verbose = false
#
-# def define_options(parser)
-# parser.banner = "Usage: example.rb [options]"
-# parser.separator ""
-# parser.separator "Specific options:"
+# opt_parser = OptionParser.new do |opts|
+# opts.banner = "Usage: example.rb [options]"
#
-# # add additional options
-# perform_inplace_option(parser)
-# delay_execution_option(parser)
-# execute_at_time_option(parser)
-# specify_record_separator_option(parser)
-# list_example_option(parser)
-# specify_encoding_option(parser)
-# optional_option_argument_with_keyword_completion_option(parser)
-# boolean_verbose_option(parser)
+# opts.separator ""
+# opts.separator "Specific options:"
#
-# parser.separator ""
-# parser.separator "Common options:"
-# # No argument, shows at tail. This will print an options summary.
-# # Try it and see!
-# parser.on_tail("-h", "--help", "Show this message") do
-# puts parser
-# exit
-# end
-# # Another typical switch to print the version.
-# parser.on_tail("--version", "Show version") do
-# puts Version
-# exit
+# # Mandatory argument.
+# opts.on("-r", "--require LIBRARY",
+# "Require the LIBRARY before executing your script") do |lib|
+# options.library << lib
# end
-# end
#
-# def perform_inplace_option(parser)
-# # Specifies an optional option argument
-# parser.on("-i", "--inplace [EXTENSION]",
-# "Edit ARGV files in place",
-# "(make backup if EXTENSION supplied)") do |ext|
-# self.inplace = true
-# self.extension = ext || ''
-# self.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
+# # Optional argument; multi-line description.
+# opts.on("-i", "--inplace [EXTENSION]",
+# "Edit ARGV files in place",
+# " (make backup if EXTENSION supplied)") do |ext|
+# options.inplace = true
+# options.extension = ext || ''
+# options.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
# end
-# end
#
-# def delay_execution_option(parser)
# # Cast 'delay' argument to a Float.
-# parser.on("--delay N", Float, "Delay N seconds before executing") do |n|
-# self.delay = n
+# opts.on("--delay N", Float, "Delay N seconds before executing") do |n|
+# options.delay = n
# end
-# end
#
-# def execute_at_time_option(parser)
# # Cast 'time' argument to a Time object.
-# parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
-# self.time = time
+# opts.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
+# options.time = time
# end
-# end
#
-# def specify_record_separator_option(parser)
# # Cast to octal integer.
-# parser.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger,
-# "Specify record separator (default \\0)") do |rs|
-# self.record_separator = rs
+# opts.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger,
+# "Specify record separator (default \\0)") do |rs|
+# options.record_separator = rs
# end
-# end
#
-# def list_example_option(parser)
# # List of arguments.
-# parser.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
-# self.list = list
+# opts.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
+# options.list = list
# end
-# end
#
-# def specify_encoding_option(parser)
# # Keyword completion. We are specifying a specific set of arguments (CODES
# # and CODE_ALIASES - notice the latter is a Hash), and the user may provide
# # the shortest unambiguous text.
-# code_list = (CODE_ALIASES.keys + CODES).join(', ')
-# parser.on("--code CODE", CODES, CODE_ALIASES, "Select encoding",
-# "(#{code_list})") do |encoding|
-# self.encoding = encoding
+# code_list = (CODE_ALIASES.keys + CODES).join(',')
+# opts.on("--code CODE", CODES, CODE_ALIASES, "Select encoding",
+# " (#{code_list})") do |encoding|
+# options.encoding = encoding
# end
-# end
#
-# def optional_option_argument_with_keyword_completion_option(parser)
-# # Optional '--type' option argument with keyword completion.
-# parser.on("--type [TYPE]", [:text, :binary, :auto],
-# "Select transfer type (text, binary, auto)") do |t|
-# self.transfer_type = t
+# # Optional argument with keyword completion.
+# opts.on("--type [TYPE]", [:text, :binary, :auto],
+# "Select transfer type (text, binary, auto)") do |t|
+# options.transfer_type = t
# end
-# end
#
-# def boolean_verbose_option(parser)
# # Boolean switch.
-# parser.on("-v", "--[no-]verbose", "Run verbosely") do |v|
-# self.verbose = v
+# opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
+# options.verbose = v
# end
-# end
-# end
#
-# #
-# # Return a structure describing the options.
-# #
-# def parse(args)
-# # The options specified on the command line will be collected in
-# # *options*.
+# opts.separator ""
+# opts.separator "Common options:"
+#
+# # No argument, shows at tail. This will print an options summary.
+# # Try it and see!
+# opts.on_tail("-h", "--help", "Show this message") do
+# puts opts
+# exit
+# end
#
-# @options = ScriptOptions.new
-# @args = OptionParser.new do |parser|
-# @options.define_options(parser)
-# parser.parse!(args)
+# # Another typical switch to print the version.
+# opts.on_tail("--version", "Show version") do
+# puts ::Version.join('.')
+# exit
+# end
# end
-# @options
-# end
#
-# attr_reader :parser, :options
+# opt_parser.parse!(args)
+# options
+# end # parse()
+#
# end # class OptparseExample
#
-# example = OptparseExample.new
-# options = example.parse(ARGV)
-# pp options # example.options
+# options = OptparseExample.parse(ARGV)
+# pp options
# pp ARGV
#
# === Shell Completion
@@ -413,7 +231,7 @@ class OptionParser
candidates = []
block.call do |k, *v|
(if Regexp === k
- kn = "".freeze
+ kn = nil
k === key
else
kn = defined?(k.id2name) ? k.id2name : k
@@ -629,7 +447,7 @@ class OptionParser
(sopts+lopts).each do |opt|
# "(-x -c -r)-l[left justify]" \
- if /^--\[no-\](.+)$/ =~ opt
+ if opt =~ /^--\[no-\](.+)$/
o = $1
yield("--#{o}", desc.join(""))
yield("--no-#{o}", desc.join(""))
@@ -1336,7 +1154,6 @@ XXX
default_pattern = nil
klass = nil
q, a = nil
- has_arg = false
opts.each do |o|
# argument class
@@ -1415,8 +1232,6 @@ XXX
if a
default_style = default_style.guess(arg = a)
default_pattern, conv = search(:atype, o) unless default_pattern
- else
- has_arg = true
end
sdesc << "-#{q}"
short << Regexp.new(q)
@@ -1439,9 +1254,6 @@ XXX
default_pattern, conv = search(:atype, default_style.pattern) unless default_pattern
if !(short.empty? and long.empty?)
- if has_arg and default_style == Switch::NoArgument
- default_style = Switch::RequiredArgument
- end
s = (style || default_style).new(pattern || default_pattern,
conv, sdesc, ldesc, arg, desc, block)
elsif !block
@@ -1646,12 +1458,11 @@ XXX
#
# Wrapper method for getopts.rb.
#
- # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option)
+ # params = ARGV.getopts("ab:", "foo", "bar:")
# # params[:a] = true # -a
# # params[:b] = "1" # -b1
# # params[:foo] = "1" # --foo
# # params[:bar] = "x" # --bar x
- # # params[:zot] = "z" # --zot Z
#
def getopts(*args)
argv = Array === args.first ? args.shift : default_argv
@@ -1670,14 +1481,13 @@ XXX
end if single_options
long_options.each do |arg|
- arg, desc = arg.split(';', 2)
opt, val = arg.split(':', 2)
if val
result[opt] = val.empty? ? nil : val
- define("--#{opt}=#{result[opt] || "VAL"}", *[desc].compact)
+ define("--#{opt} VAL")
else
result[opt] = false
- define("--#{opt}", *[desc].compact)
+ define("--#{opt}")
end
end
@@ -1719,7 +1529,7 @@ XXX
# Completes shortened long style option switch and returns pair of
# canonical switch and switch descriptor OptionParser::Switch.
#
- # +typ+:: Searching table.
+ # +id+:: Searching table.
# +opt+:: Searching key.
# +icase+:: Search case insensitive if true.
# +pat+:: Optional pattern for completion.
@@ -1836,7 +1646,7 @@ XXX
#
# Float number format, and converts to Float.
#
- float = "(?:#{decimal}(?=(.)?)(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
+ float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
floatpat = %r"\A[-+]?#{float}\z"io
accept(Float, floatpat) {|s,| s.to_f if s}
@@ -1845,13 +1655,11 @@ XXX
# for float format, and Rational for rational format.
#
real = "[-+]?(?:#{octal}|#{float})"
- accept(Numeric, /\A(#{real})(?:\/(#{real}))?\z/io) {|s, d, f, n,|
+ accept(Numeric, /\A(#{real})(?:\/(#{real}))?\z/io) {|s, d, n|
if n
Rational(d, n)
- elsif f
- Float(s)
- else
- Integer(s)
+ elsif s
+ eval(s)
end
}
@@ -1885,14 +1693,10 @@ XXX
# integer format, Float for float format.
#
DecimalNumeric = floatpat # decimal integer is allowed as float also.
- accept(DecimalNumeric, floatpat) {|s, f|
+ accept(DecimalNumeric, floatpat) {|s,|
begin
- if f
- Float(s)
- else
- Integer(s)
- end
- rescue ArgumentError
+ eval(s)
+ rescue SyntaxError
raise OptionParser::InvalidArgument, s
end if s
}
@@ -1992,7 +1796,7 @@ XXX
end
def inspect
- "#<#{self.class}: #{args.join(' ')}>"
+ "#<#{self.class.to_s}: #{args.join(' ')}>"
end
#
@@ -2150,5 +1954,3 @@ end
# ARGV is arguable by OptionParser
ARGV.extend(OptionParser::Arguable)
-
-OptParse = OptionParser
diff --git a/lib/optparse/ac.rb b/lib/optparse/ac.rb
index fb0883f97a..6a8626094d 100644
--- a/lib/optparse/ac.rb
+++ b/lib/optparse/ac.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'optparse'
class OptionParser::AC < OptionParser
diff --git a/lib/optparse/date.rb b/lib/optparse/date.rb
index d6649c83f1..d680559f37 100644
--- a/lib/optparse/date.rb
+++ b/lib/optparse/date.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'optparse'
require 'date'
diff --git a/lib/optparse/shellwords.rb b/lib/optparse/shellwords.rb
index bf31701b96..0422d7c887 100644
--- a/lib/optparse/shellwords.rb
+++ b/lib/optparse/shellwords.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# -*- ruby -*-
require 'shellwords'
diff --git a/lib/optparse/time.rb b/lib/optparse/time.rb
index ffc6ff000d..402cadcf16 100644
--- a/lib/optparse/time.rb
+++ b/lib/optparse/time.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'optparse'
require 'time'
diff --git a/lib/optparse/uri.rb b/lib/optparse/uri.rb
index 51550cf91b..024dc69eac 100644
--- a/lib/optparse/uri.rb
+++ b/lib/optparse/uri.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# -*- ruby -*-
require 'optparse'
diff --git a/lib/optparse/version.rb b/lib/optparse/version.rb
index b869d8fe51..76ed564287 100644
--- a/lib/optparse/version.rb
+++ b/lib/optparse/version.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# OptionParser internal utility
class << OptionParser
@@ -52,7 +51,7 @@ class << OptionParser
raise NameError, path unless Module === klass
klass.constants.grep(/#{name}/i) do |c|
klass.const_defined?(c) or next
- klass.const_get(c)
+ c = klass.const_get(c)
end
end
end
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index d2375a2572..f51eb7b5db 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = ostruct.rb: OpenStruct implementation
#
@@ -71,14 +70,6 @@
# of these properties compared to using a Hash or a Struct.
#
class OpenStruct
- # :nodoc:
- class << self
- def allocate
- (x = super).instance_variable_set(:@table, {})
- x
- end
- end
-
#
# Creates a new OpenStruct object. By default, the resulting OpenStruct
# object will have no attributes.
@@ -99,6 +90,7 @@ class OpenStruct
hash.each_pair do |k, v|
k = k.to_sym
@table[k] = v
+ new_ostruct_member(k)
end
end
end
@@ -107,6 +99,7 @@ class OpenStruct
def initialize_copy(orig)
super
@table = @table.dup
+ @table.each_key{|key| new_ostruct_member(key)}
end
#
@@ -134,7 +127,6 @@ class OpenStruct
def each_pair
return to_enum(__method__) { @table.size } unless block_given?
@table.each_pair{|p| yield p}
- self
end
#
@@ -149,6 +141,7 @@ class OpenStruct
#
def marshal_load(x)
@table = x
+ @table.each_key{|key| new_ostruct_member(key)}
end
#
@@ -172,7 +165,7 @@ class OpenStruct
#
def new_ostruct_member(name)
name = name.to_sym
- unless singleton_class.method_defined?(name)
+ unless respond_to?(name)
define_singleton_method(name) { @table[name] }
define_singleton_method("#{name}=") { |x| modifiable[name] = x }
end
@@ -180,28 +173,16 @@ class OpenStruct
end
protected :new_ostruct_member
- def freeze
- @table.each_key {|key| new_ostruct_member(key)}
- super
- end
-
- def respond_to_missing?(mid, include_private = false)
- mname = mid.to_s.chomp("=").to_sym
- @table.key?(mname) || super
- end
-
def method_missing(mid, *args) # :nodoc:
+ mname = mid.id2name
len = args.length
- if mname = mid[/.*(?==\z)/m]
+ if mname.chomp!('=')
if len != 1
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
modifiable[new_ostruct_member(mname)] = args[0]
elsif len == 0
- if @table.key?(mid)
- new_ostruct_member(mid)
- @table[mid]
- end
+ @table[mid]
else
err = NoMethodError.new "undefined method `#{mid}' for #{self}", mid, args
err.set_backtrace caller(1)
@@ -230,24 +211,6 @@ class OpenStruct
end
#
- # Retrieves the value object corresponding to the each +name+
- # objects repeatedly.
- #
- # address = OpenStruct.new('city' => "Anytown NC", 'zip' => 12345)
- # person = OpenStruct.new('name' => 'John Smith', 'address' => address)
- # person.dig(:address, 'zip') # => 12345
- # person.dig(:business_address, 'zip') # => nil
- #
- def dig(name, *names)
- begin
- name = name.to_sym
- rescue NoMethodError
- raise TypeError, "#{name} is not a symbol nor a string"
- end
- @table.dig(name, *names)
- end
-
- #
# Remove the named field from the object. Returns the value that the field
# contained if it was defined.
#
@@ -259,13 +222,8 @@ class OpenStruct
#
def delete_field(name)
sym = name.to_sym
- begin
- singleton_class.__send__(:remove_method, sym, "#{sym}=")
- rescue NameError
- end
- @table.delete(sym) do
- raise NameError.new("no field `#{sym}' in #{self}", sym)
- end
+ singleton_class.__send__(:remove_method, sym, "#{sym}=")
+ @table.delete sym
end
InspectKey = :__inspect_key__ # :nodoc:
diff --git a/lib/pp.rb b/lib/pp.rb
index 9678774b8c..0091ddf74c 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require 'prettyprint'
module Kernel
@@ -11,7 +9,7 @@ module Kernel
#
# See the PP module for more information.
def pretty_inspect
- PP.pp(self, ''.dup)
+ PP.pp(self, '')
end
private
@@ -349,7 +347,7 @@ class PP < PrettyPrint
if /\(PP::ObjectMixin\)#/ =~ Object.instance_method(:method).bind(self).call(:pretty_print).inspect
raise "pretty_print is not overridden for #{self.class}"
end
- PP.singleline_pp(self, ''.dup)
+ PP.singleline_pp(self, '')
end
end
end
@@ -471,10 +469,8 @@ class File < IO # :nodoc:
q.comma_breakable
q.group {
q.text sprintf("rdev=0x%x", self.rdev)
- if self.rdev_major && self.rdev_minor
- q.breakable
- q.text sprintf('(%d, %d)', self.rdev_major, self.rdev_minor)
- end
+ q.breakable
+ q.text sprintf('(%d, %d)', self.rdev_major, self.rdev_minor)
}
q.comma_breakable
q.text "size="; q.pp self.size; q.comma_breakable
diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb
index 2a3ca90dc1..5b1da330dd 100644
--- a/lib/prettyprint.rb
+++ b/lib/prettyprint.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-#
# This class implements a pretty printing algorithm. It finds line breaks and
# nice indentations for grouped structure.
#
@@ -42,7 +40,7 @@ class PrettyPrint
# output
# end
#
- def PrettyPrint.format(output=''.dup, maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n})
+ def PrettyPrint.format(output='', maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n})
q = PrettyPrint.new(output, maxwidth, newline, &genspace)
yield q
q.flush
@@ -56,7 +54,7 @@ class PrettyPrint
# The invocation of +breakable+ in the block doesn't break a line and is
# treated as just an invocation of +text+.
#
- def PrettyPrint.singleline_format(output=''.dup, maxwidth=nil, newline=nil, genspace=nil)
+ def PrettyPrint.singleline_format(output='', maxwidth=nil, newline=nil, genspace=nil)
q = SingleLine.new(output)
yield q
output
@@ -79,7 +77,7 @@ class PrettyPrint
# The block is used to generate spaces. {|width| ' ' * width} is used if it
# is not given.
#
- def initialize(output=''.dup, maxwidth=79, newline="\n", &genspace)
+ def initialize(output='', maxwidth=79, newline="\n", &genspace)
@output = output
@maxwidth = maxwidth
@newline = newline
@@ -156,6 +154,28 @@ class PrettyPrint
@group_stack.last
end
+ # first? is a predicate to test the call is a first call to first? with
+ # current group.
+ #
+ # It is useful to format comma separated values as:
+ #
+ # q.group(1, '[', ']') {
+ # xxx.each {|yyy|
+ # unless q.first?
+ # q.text ','
+ # q.breakable
+ # end
+ # ... pretty printing yyy ...
+ # }
+ # }
+ #
+ # first? is obsoleted in 1.8.2.
+ #
+ def first?
+ warn "PrettyPrint#first? is obsoleted at 1.8.2."
+ current_group.first?
+ end
+
# Breaks the buffer into lines that are shorter than #maxwidth
def break_outmost_groups
while @maxwidth < @output_width + @buffer_width
diff --git a/lib/prime.rb b/lib/prime.rb
index c64c0c2cf1..f359c12693 100644
--- a/lib/prime.rb
+++ b/lib/prime.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = prime.rb
#
@@ -30,16 +29,9 @@ class Integer
Prime.prime_division(self, generator)
end
- # Returns true if +self+ is a prime number, else returns false.
+ # Returns true if +self+ is a prime number, false for a composite.
def prime?
- return self >= 2 if self <= 3
- return false if self % 2 == 0 or self % 3 == 0
- (5..(self**0.5).floor).step(6).each do |i|
- if self % i == 0 || self % (i + 2) == 0
- return false
- end
- end
- true
+ Prime.prime?(self)
end
# Iterates the given block over all prime numbers.
@@ -65,6 +57,9 @@ end
#
# == Retrieving the instance
#
+# +Prime+.new is obsolete. Now +Prime+ has the default instance and you can
+# access it as +Prime+.instance.
+#
# For convenience, each instance method of +Prime+.instance can be accessed
# as a class method of +Prime+.
#
@@ -95,11 +90,20 @@ end
class Prime
include Enumerable
- include Singleton
+ @the_instance = Prime.new
+
+ # obsolete. Use +Prime+::+instance+ or class methods of +Prime+.
+ def initialize
+ @generator = EratosthenesGenerator.new
+ extend OldCompatibility
+ warn "Prime::new is obsolete. use Prime::instance or class methods of Prime."
+ end
class << self
extend Forwardable
include Enumerable
+ # Returns the default instance of Prime.
+ def instance; @the_instance end
def method_added(method) # :nodoc:
(class<< self;self;end).def_delegator :instance, method
@@ -132,23 +136,30 @@ class Prime
# Upper bound of prime numbers. The iterator stops after it
# yields all prime numbers p <= +ubound+.
#
+ # == Note
+ #
+ # +Prime+.+new+ returns an object extended by +Prime+::+OldCompatibility+
+ # in order to be compatible with Ruby 1.8, and +Prime+#each is overwritten
+ # by +Prime+::+OldCompatibility+#+each+.
+ #
+ # +Prime+.+new+ is now obsolete. Use +Prime+.+instance+.+each+ or simply
+ # +Prime+.+each+.
def each(ubound = nil, generator = EratosthenesGenerator.new, &block)
generator.upper_bound = ubound
generator.each(&block)
end
- # Returns true if +value+ is a prime number, else returns false.
+ # Returns true if +value+ is prime, false for a composite.
#
# == Parameters
#
# +value+:: an arbitrary integer to be checked.
# +generator+:: optional. A pseudo-prime generator.
def prime?(value, generator = Prime::Generator23.new)
- raise ArgumentError, "Expected a prime generator, got #{generator}" unless generator.respond_to? :each
- raise ArgumentError, "Expected an integer, got #{value}" unless value.respond_to?(:integer?) && value.integer?
+ value = -value if value < 0
return false if value < 2
- generator.each do |num|
+ for num in generator
q,r = value.divmod num
return true if q < num
return false if r == 0
@@ -170,7 +181,7 @@ class Prime
# Prime.int_from_prime_division([[2,2], [3,1]]) #=> 12
def int_from_prime_division(pd)
pd.inject(1){|value, (prime, index)|
- value * prime**index
+ value *= prime**index
}
end
@@ -206,7 +217,7 @@ class Prime
else
pv = []
end
- generator.each do |prime|
+ for prime in generator
count = 0
while (value1, mod = value.divmod(prime)
mod) == 0
@@ -221,7 +232,7 @@ class Prime
if value > 1
pv.push [value, 1]
end
- pv
+ return pv
end
# An abstract class for enumerating pseudo-prime numbers.
@@ -262,44 +273,32 @@ class Prime
end
# Iterates the given block for each prime number.
- def each
- return self.dup unless block_given?
+ def each(&block)
+ return self.dup unless block
if @ubound
last_value = nil
loop do
prime = succ
break last_value if prime > @ubound
- last_value = yield prime
+ last_value = block.call(prime)
end
else
loop do
- yield succ
+ block.call(succ)
end
end
end
# see +Enumerator+#with_index.
- def with_index(offset = 0)
- return enum_for(:with_index, offset) { Float::INFINITY } unless block_given?
- return each_with_index(&proc) if offset == 0
-
- each do |prime|
- yield prime, offset
- offset += 1
- end
- end
+ alias with_index each_with_index
# see +Enumerator+#with_object.
def with_object(obj)
- return enum_for(:with_object, obj) { Float::INFINITY } unless block_given?
+ return enum_for(:with_object) unless block_given?
each do |prime|
yield prime, obj
end
end
-
- def size
- Float::INFINITY
- end
end
# An implementation of +PseudoPrimeGenerator+.
@@ -352,17 +351,19 @@ class Prime
end
def succ
- if (@step)
- @prime += @step
- @step = 6 - @step
- else
- case @prime
- when 1; @prime = 2
- when 2; @prime = 3
- when 3; @prime = 5; @step = 2
+ loop do
+ if (@step)
+ @prime += @step
+ @step = 6 - @step
+ else
+ case @prime
+ when 1; @prime = 2
+ when 2; @prime = 3
+ when 3; @prime = 5; @step = 2
+ end
end
+ return @prime
end
- @prime
end
alias next succ
def rewind
@@ -389,7 +390,7 @@ class Prime
# Returns the cached prime numbers.
def cache
- @primes
+ return @primes
end
alias primes cache
alias primes_so_far cache
@@ -414,7 +415,7 @@ class Prime
@primes.push @next_to_check if @primes[2..@ulticheck_index].find {|prime| @next_to_check % prime == 0 }.nil?
@next_to_check += 2
end
- @primes[index]
+ return @primes[index]
end
end
@@ -446,21 +447,44 @@ class Prime
segment_max = [segment_min + max_segment_size, max_cached_prime * 2].min
root = Integer(Math.sqrt(segment_max).floor)
- segment = ((segment_min + 1) .. segment_max).step(2).to_a
+ sieving_primes = @primes[1 .. -1].take_while { |prime| prime <= root }
+ offsets = Array.new(sieving_primes.size) do |i|
+ (-(segment_min + 1 + sieving_primes[i]) / 2) % sieving_primes[i]
+ end
- (1..Float::INFINITY).each do |sieving|
- prime = @primes[sieving]
- break if prime > root
- composite_index = (-(segment_min + 1 + prime) / 2) % prime
+ segment = ((segment_min + 1) .. segment_max).step(2).to_a
+ sieving_primes.each_with_index do |prime, index|
+ composite_index = offsets[index]
while composite_index < segment.size do
segment[composite_index] = nil
composite_index += prime
end
end
- @primes.concat(segment.compact!)
-
+ segment.each do |prime|
+ @primes.push prime unless prime.nil?
+ end
@max_checked = segment_max
end
end
+
+ # Provides a +Prime+ object with compatibility to Ruby 1.8 when instantiated via +Prime+.+new+.
+ module OldCompatibility
+ # Returns the next prime number and forwards internal pointer.
+ def succ
+ @generator.succ
+ end
+ alias next succ
+
+ # Overwrites Prime#each.
+ #
+ # Iterates the given block over all prime numbers. Note that enumeration
+ # starts from the current position of internal pointer, not rewound.
+ def each(&block)
+ return @generator.dup unless block_given?
+ loop do
+ yield succ
+ end
+ end
+ end
end
diff --git a/lib/profile.rb b/lib/profile.rb
index 39f8370370..2aeecce908 100644
--- a/lib/profile.rb
+++ b/lib/profile.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'profiler'
RubyVM::InstructionSequence.compile_option = {
diff --git a/lib/profiler.rb b/lib/profiler.rb
index ab55e1fe48..e53951cbe6 100644
--- a/lib/profiler.rb
+++ b/lib/profiler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Profile provides a way to Profile your Ruby application.
#
# Profiling your program is a way of determining which methods are called and
diff --git a/lib/pstore.rb b/lib/pstore.rb
index 8dfcaec7df..a2813a8e20 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = PStore -- Transactional File Storage for Ruby Objects
#
# pstore.rb -
@@ -190,7 +189,7 @@ class PStore
# store.transaction do # begin transaction
# # load some data into the store...
# store[:single_object] = "My data..."
- # store[:obj_hierarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"],
+ # store[:obj_heirarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"],
# "James Gray" => ["erb.rb", "pstore.rb"] }
# end # commit changes to data store file
#
@@ -483,3 +482,25 @@ class PStore
EMPTY_MARSHAL_CHECKSUM
end
end
+
+# :enddoc:
+
+if __FILE__ == $0
+ db = PStore.new("/tmp/foo")
+ db.transaction do
+ p db.roots
+ ary = db["root"] = [1,2,3,4]
+ ary[1] = [1,1.5]
+ end
+
+ 1000.times do
+ db.transaction do
+ db["root"][0] += 1
+ p db["root"][0]
+ end
+ end
+
+ db.transaction(true) do
+ p db["root"]
+ end
+end
diff --git a/lib/racc/parser.rb b/lib/racc/parser.rb
index 0cdb42e49d..058d080a8a 100644
--- a/lib/racc/parser.rb
+++ b/lib/racc/parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# $originalId: parser.rb,v 1.8 2006/07/06 11:42:07 aamine Exp $
#
@@ -175,8 +174,8 @@ end
# Your own parser is completely yours.
module Racc
- unless defined?(Racc_No_Extensions)
- Racc_No_Extensions = false # :nodoc:
+ unless defined?(Racc_No_Extentions)
+ Racc_No_Extentions = false # :nodoc:
end
class Parser
@@ -193,7 +192,7 @@ module Racc
unless new.respond_to?(:_racc_do_parse_c, true)
raise LoadError, 'old cparse.so'
end
- if Racc_No_Extensions
+ if Racc_No_Extentions
raise LoadError, 'selecting ruby version of racc runtime core'
end
@@ -381,6 +380,7 @@ module Racc
_, _, _, _,
_, _, _, shift_n, reduce_n,
_, _, * = arg
+ nerr = 0 # tmp
if act > 0 and act < shift_n
#
@@ -431,6 +431,7 @@ module Racc
case @racc_error_status
when 0
unless arg[21] # user_yyerror
+ nerr += 1
on_error @racc_t, @racc_val, @racc_vstack
end
when 3
diff --git a/lib/racc/rdoc/grammar.en.rdoc b/lib/racc/rdoc/grammar.en.rdoc
index 824d0ee13d..b667a7cb5e 100644
--- a/lib/racc/rdoc/grammar.en.rdoc
+++ b/lib/racc/rdoc/grammar.en.rdoc
@@ -4,12 +4,14 @@
== Class Block and User Code Block
-There are two blocks on toplevel. One is 'class' block, another is 'user code'
-block. 'user code' block MUST be placed after 'class' block.
+There's two block on toplevel.
+one is 'class' block, another is 'user code' block. 'user code' block MUST
+places after 'class' block.
-== Comments
+== Comment
-You can insert comments about all places. Two style comments can be used, Ruby style '#.....' and C style '/\*......*\/'.
+You can insert comment about all places. Two style comment can be used,
+Ruby style (#.....) and C style (/*......*/) .
== Class Block
@@ -17,19 +19,19 @@ The class block is formed like this:
class CLASS_NAME
[precedance table]
- [token declarations]
- [expected number of S/R conflicts]
+ [token declearations]
+ [expected number of S/R conflict]
[options]
- [semantic value conversion]
+ [semantic value convertion]
[start rule]
rule
GRAMMARS
-CLASS_NAME is a name of parser class. This is the name of generating parser
-class.
+CLASS_NAME is a name of parser class.
+This is the name of generating parser class.
-If CLASS_NAME includes '::', Racc outputs module clause. For example, writing
-"class M::C" causes creating the code below:
+If CLASS_NAME includes '::', Racc outputs module clause.
+For example, writing "class M::C" causes creating the code bellow:
module M
class C
@@ -40,8 +42,8 @@ If CLASS_NAME includes '::', Racc outputs module clause. For example, writing
== Grammar Block
-The grammar block describes grammar which is able to be understood by parser.
-Syntax is:
+The grammar block discripts grammar which is able
+to be understood by parser. Syntax is:
(token): (token) (token) (token).... (action)
@@ -57,27 +59,28 @@ Syntax is:
Note that you cannot use '%' string, here document, '%r' regexp in action.
-Actions can be omitted. When it is omitted, '' (empty string) is used.
+Actions can be omitted.
+When it is omitted, '' (empty string) is used.
-A return value of action is a value of left side value ($$). It is value of
-result, or returned value by `return` statement.
+A return value of action is a value of left side value ($$).
+It is value of result, or returned value by "return" statement.
Here is an example of whole grammar block.
rule
- goal: definition rules source { result = val }
+ goal: definition ruls source { result = val }
definition: /* none */ { result = [] }
| definition startdesig { result[0] = val[1] }
| definition
- precrule # this line continues from upper line
+ precrule # this line continue from upper line
{
result[1] = val[1]
}
startdesig: START TOKEN
-You can use the following special local variables in action:
+You can use following special local variables in action.
* result ($$)
@@ -89,7 +92,8 @@ An array of value of right-hand side (rhs).
* _values (...$-2,$-1,$0)
-A stack of values. DO NOT MODIFY this stack unless you know what you are doing.
+A stack of values.
+DO NOT MODIFY this stack unless you know what you are doing.
== Operator Precedence
@@ -103,9 +107,9 @@ To designate this block:
right '='
preclow
-`right` is yacc's %right, `left` is yacc's %left.
+`right' is yacc's %right, `left' is yacc's %left.
-`=` + (symbol) means yacc's %prec:
+`=' + (symbol) means yacc's %prec:
prechigh
nonassoc UMINUS
@@ -132,22 +136,22 @@ Racc has bison's "expect" directive.
:
:
-This directive declares "expected" number of shift/reduce conflicts. If
-"expected" number is equal to real number of conflicts, Racc does not print
-conflict warning message.
+This directive declears "expected" number of shift/reduce conflict.
+If "expected" number is equal to real number of conflicts,
+racc does not print confliction warning message.
== Declaring Tokens
-By declaring tokens, you can avoid many meaningless bugs. If declared token
-does not exist or existing token does not decleared, Racc output warnings.
-Declaration syntax is:
+By declaring tokens, you can avoid many meanless bugs.
+If decleared token does not exist/existing token does not decleared,
+Racc output warnings. Declearation syntax is:
token TOKEN_NAME AND_IS_THIS
ALSO_THIS_IS AGAIN_AND_AGAIN THIS_IS_LAST
== Options
-You can write options for Racc command in your Racc file.
+You can write options for racc command in your racc file.
options OPTION OPTION ...
@@ -155,19 +159,19 @@ Options are:
* omit_action_call
-omits empty action call or not.
+omit empty action call or not.
* result_var
-uses local variable "result" or not.
+use/does not use local variable "result"
-You can use 'no_' prefix to invert their meanings.
+You can use 'no_' prefix to invert its meanings.
== Converting Token Symbol
Token symbols are, as default,
- * naked token string in Racc file (TOK, XFILE, this_is_token, ...)
+ * naked token string in racc file (TOK, XFILE, this_is_token, ...)
--> symbol (:TOK, :XFILE, :this_is_token, ...)
* quoted string (':', '.', '(', ...)
--> same string (':', '.', '(', ...)
@@ -181,7 +185,7 @@ Here is an example:
end
We can use almost all ruby value can be used by token symbol,
-except 'false' and 'nil'. These cause unexpected parse error.
+except 'false' and 'nil'. These are causes unexpected parse error.
If you want to use String as token symbol, special care is required.
For example:
@@ -198,10 +202,12 @@ For example:
start real_target
+This statement will not be used forever, I think.
+
== User Code Block
-"User Code Block" is a Ruby source code which is copied to output. There are
-three user code blocks, "header" "inner" and "footer".
+"User Code Block" is a Ruby source code which is copied to output.
+There are three user code block, "header" "inner" and "footer".
Format of user code is like this:
@@ -215,5 +221,6 @@ Format of user code is like this:
:
:
-If four '-' exist on the line head, Racc treats it as the beginning of the
-user code block. The name of the user code block must be one word.
+If four '-' exist on line head,
+racc treat it as beginning of user code block.
+A name of user code must be one word.
diff --git a/lib/rake.rb b/lib/rake.rb
new file mode 100644
index 0000000000..531cfc82b8
--- /dev/null
+++ b/lib/rake.rb
@@ -0,0 +1,73 @@
+#--
+
+# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#++
+
+require 'rake/version'
+
+# :stopdoc:
+RAKEVERSION = Rake::VERSION
+# :startdoc:
+
+require 'rbconfig'
+require 'fileutils'
+require 'singleton'
+require 'monitor'
+require 'optparse'
+require 'ostruct'
+
+require 'rake/ext/module'
+require 'rake/ext/string'
+require 'rake/ext/time'
+
+require 'rake/win32'
+
+require 'rake/linked_list'
+require 'rake/scope'
+require 'rake/task_argument_error'
+require 'rake/rule_recursion_overflow_error'
+require 'rake/rake_module'
+require 'rake/trace_output'
+require 'rake/pseudo_status'
+require 'rake/task_arguments'
+require 'rake/invocation_chain'
+require 'rake/task'
+require 'rake/file_task'
+require 'rake/file_creation_task'
+require 'rake/multi_task'
+require 'rake/dsl_definition'
+require 'rake/file_utils_ext'
+require 'rake/file_list'
+require 'rake/default_loader'
+require 'rake/early_time'
+require 'rake/name_space'
+require 'rake/task_manager'
+require 'rake/application'
+require 'rake/backtrace'
+
+$trace = false
+
+# :stopdoc:
+#
+# Some top level Constants.
+
+FileList = Rake::FileList
+RakeFileUtils = Rake::FileUtilsExt
diff --git a/lib/rake/alt_system.rb b/lib/rake/alt_system.rb
new file mode 100644
index 0000000000..a42597bf09
--- /dev/null
+++ b/lib/rake/alt_system.rb
@@ -0,0 +1,108 @@
+#
+# Copyright (c) 2008 James M. Lawrence
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+require 'rbconfig'
+
+#
+# Alternate implementations of system() and backticks `` on Windows
+# for ruby-1.8 and earlier.
+#
+module Rake::AltSystem
+ WINDOWS = RbConfig::CONFIG["host_os"] =~
+ %r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
+
+ class << self
+ def define_module_function(name, &block)
+ define_method(name, &block)
+ module_function(name)
+ end
+ end
+
+ if WINDOWS && RUBY_VERSION < "1.9.0"
+ RUNNABLE_EXTS = %w[com exe bat cmd]
+ RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
+
+ define_module_function :kernel_system, &Kernel.method(:system)
+ define_module_function :kernel_backticks, &Kernel.method(:'`')
+
+ module_function
+
+ def repair_command(cmd)
+ "call " + (
+ if cmd =~ %r!\A\s*\".*?\"!
+ # already quoted
+ cmd
+ elsif match = cmd.match(%r!\A\s*(\S+)!)
+ if match[1] =~ %r!/!
+ # avoid x/y.bat interpretation as x with option /y
+ %Q!"#{match[1]}"! + match.post_match
+ else
+ # a shell command will fail if quoted
+ cmd
+ end
+ else
+ # empty or whitespace
+ cmd
+ end
+ )
+ end
+
+ def find_runnable(file)
+ if file =~ RUNNABLE_PATTERN
+ file
+ else
+ RUNNABLE_EXTS.each { |ext|
+ test = "#{file}.#{ext}"
+ return test if File.exist?(test)
+ }
+ nil
+ end
+ end
+
+ def system(cmd, *args)
+ repaired = (
+ if args.empty?
+ [repair_command(cmd)]
+ elsif runnable = find_runnable(cmd)
+ [File.expand_path(runnable), *args]
+ else
+ # non-existent file
+ [cmd, *args]
+ end
+ )
+ kernel_system(*repaired)
+ end
+
+ def backticks(cmd)
+ kernel_backticks(repair_command(cmd))
+ end
+
+ define_module_function :'`', &method(:backticks)
+ else
+ # Non-Windows or ruby-1.9+: same as Kernel versions
+ define_module_function :system, &Kernel.method(:system)
+ define_module_function :backticks, &Kernel.method(:'`')
+ define_module_function :'`', &Kernel.method(:'`')
+ end
+end
diff --git a/lib/rake/application.rb b/lib/rake/application.rb
new file mode 100644
index 0000000000..b76244b7a3
--- /dev/null
+++ b/lib/rake/application.rb
@@ -0,0 +1,728 @@
+require 'shellwords'
+require 'optparse'
+
+require 'rake/task_manager'
+require 'rake/file_list'
+require 'rake/thread_pool'
+require 'rake/thread_history_display'
+require 'rake/trace_output'
+require 'rake/win32'
+
+module Rake
+
+ CommandLineOptionError = Class.new(StandardError)
+
+ ######################################################################
+ # Rake main application object. When invoking +rake+ from the
+ # command line, a Rake::Application object is created and run.
+ #
+ class Application
+ include TaskManager
+ include TraceOutput
+
+ # The name of the application (typically 'rake')
+ attr_reader :name
+
+ # The original directory where rake was invoked.
+ attr_reader :original_dir
+
+ # Name of the actual rakefile used.
+ attr_reader :rakefile
+
+ # Number of columns on the terminal
+ attr_accessor :terminal_columns
+
+ # List of the top level task names (task names from the command line).
+ attr_reader :top_level_tasks
+
+ DEFAULT_RAKEFILES = [
+ 'rakefile',
+ 'Rakefile',
+ 'rakefile.rb',
+ 'Rakefile.rb'
+ ].freeze
+
+ # Initialize a Rake::Application object.
+ def initialize
+ super
+ @name = 'rake'
+ @rakefiles = DEFAULT_RAKEFILES.dup
+ @rakefile = nil
+ @pending_imports = []
+ @imported = []
+ @loaders = {}
+ @default_loader = Rake::DefaultLoader.new
+ @original_dir = Dir.pwd
+ @top_level_tasks = []
+ add_loader('rb', DefaultLoader.new)
+ add_loader('rf', DefaultLoader.new)
+ add_loader('rake', DefaultLoader.new)
+ @tty_output = STDOUT.tty?
+ @terminal_columns = ENV['RAKE_COLUMNS'].to_i
+ end
+
+ # Run the Rake application. The run method performs the following
+ # three steps:
+ #
+ # * Initialize the command line options (+init+).
+ # * Define the tasks (+load_rakefile+).
+ # * Run the top level tasks (+top_level+).
+ #
+ # If you wish to build a custom rake command, you should call
+ # +init+ on your application. Then define any tasks. Finally,
+ # call +top_level+ to run your top level tasks.
+ def run
+ standard_exception_handling do
+ init
+ load_rakefile
+ top_level
+ end
+ end
+
+ # Initialize the command line parameters and app name.
+ def init(app_name='rake')
+ standard_exception_handling do
+ @name = app_name
+ handle_options
+ collect_tasks
+ end
+ end
+
+ # Find the rakefile and then load it and any pending imports.
+ def load_rakefile
+ standard_exception_handling do
+ raw_load_rakefile
+ end
+ end
+
+ # Run the top level tasks of a Rake application.
+ def top_level
+ run_with_threads do
+ if options.show_tasks
+ display_tasks_and_comments
+ elsif options.show_prereqs
+ display_prerequisites
+ else
+ top_level_tasks.each { |task_name| invoke_task(task_name) }
+ end
+ end
+ end
+
+ # Run the given block with the thread startup and shutdown.
+ def run_with_threads
+ thread_pool.gather_history if options.job_stats == :history
+
+ yield
+
+ thread_pool.join
+ if options.job_stats
+ stats = thread_pool.statistics
+ puts "Maximum active threads: #{stats[:max_active_threads]}"
+ puts "Total threads in play: #{stats[:total_threads_in_play]}"
+ end
+ ThreadHistoryDisplay.new(thread_pool.history).show if
+ options.job_stats == :history
+ end
+
+ # Add a loader to handle imported files ending in the extension
+ # +ext+.
+ def add_loader(ext, loader)
+ ext = ".#{ext}" unless ext =~ /^\./
+ @loaders[ext] = loader
+ end
+
+ # Application options from the command line
+ def options
+ @options ||= OpenStruct.new
+ end
+
+ # Return the thread pool used for multithreaded processing.
+ def thread_pool # :nodoc:
+ @thread_pool ||= ThreadPool.new(options.thread_pool_size || FIXNUM_MAX)
+ end
+
+ # private ----------------------------------------------------------------
+
+ def invoke_task(task_string)
+ name, args = parse_task_string(task_string)
+ t = self[name]
+ t.invoke(*args)
+ end
+
+ def parse_task_string(string)
+ if string =~ /^([^\[]+)(\[(.*)\])$/
+ name = $1
+ args = $3.split(/\s*,\s*/)
+ else
+ name = string
+ args = []
+ end
+ [name, args]
+ end
+
+ # Provide standard exception handling for the given block.
+ def standard_exception_handling
+ yield
+ rescue SystemExit
+ # Exit silently with current status
+ raise
+ rescue OptionParser::InvalidOption => ex
+ $stderr.puts ex.message
+ exit(false)
+ rescue Exception => ex
+ # Exit with error message
+ display_error_message(ex)
+ exit_because_of_exception(ex)
+ end
+
+ # Exit the program because of an unhandle exception.
+ # (may be overridden by subclasses)
+ def exit_because_of_exception(ex)
+ exit(false)
+ end
+
+ # Display the error message that caused the exception.
+ def display_error_message(ex)
+ trace "#{name} aborted!"
+ trace ex.message
+ if options.backtrace
+ trace ex.backtrace.join("\n")
+ else
+ trace Backtrace.collapse(ex.backtrace).join("\n")
+ end
+ trace "Tasks: #{ex.chain}" if has_chain?(ex)
+ trace "(See full trace by running task with --trace)" unless
+ options.backtrace
+ end
+
+ # Warn about deprecated usage.
+ #
+ # Example:
+ # Rake.application.deprecate("import", "Rake.import", caller.first)
+ #
+ def deprecate(old_usage, new_usage, call_site)
+ unless options.ignore_deprecate
+ $stderr.puts "WARNING: '#{old_usage}' is deprecated. " +
+ "Please use '#{new_usage}' instead.\n" +
+ " at #{call_site}"
+ end
+ end
+
+ # Does the exception have a task invocation chain?
+ def has_chain?(exception)
+ exception.respond_to?(:chain) && exception.chain
+ end
+ private :has_chain?
+
+ # True if one of the files in RAKEFILES is in the current directory.
+ # If a match is found, it is copied into @rakefile.
+ def have_rakefile
+ @rakefiles.each do |fn|
+ if File.exist?(fn)
+ others = FileList.glob(fn, File::FNM_CASEFOLD)
+ return others.size == 1 ? others.first : fn
+ elsif fn == ''
+ return fn
+ end
+ end
+ return nil
+ end
+
+ # True if we are outputting to TTY, false otherwise
+ def tty_output?
+ @tty_output
+ end
+
+ # Override the detected TTY output state (mostly for testing)
+ def tty_output=(tty_output_state)
+ @tty_output = tty_output_state
+ end
+
+ # We will truncate output if we are outputting to a TTY or if we've been
+ # given an explicit column width to honor
+ def truncate_output?
+ tty_output? || @terminal_columns.nonzero?
+ end
+
+ # Display the tasks and comments.
+ def display_tasks_and_comments
+ displayable_tasks = tasks.select { |t|
+ (options.show_all_tasks || t.comment) &&
+ t.name =~ options.show_task_pattern
+ }
+ case options.show_tasks
+ when :tasks
+ width = displayable_tasks.map { |t| t.name_with_args.length }.max || 10
+ if truncate_output?
+ max_column = terminal_width - name.size - width - 7
+ else
+ max_column = nil
+ end
+
+ displayable_tasks.each do |t|
+ printf("#{name} %-#{width}s # %s\n",
+ t.name_with_args,
+ max_column ? truncate(t.comment, max_column) : t.comment)
+ end
+ when :describe
+ displayable_tasks.each do |t|
+ puts "#{name} #{t.name_with_args}"
+ comment = t.full_comment || ""
+ comment.split("\n").each do |line|
+ puts " #{line}"
+ end
+ puts
+ end
+ when :lines
+ displayable_tasks.each do |t|
+ t.locations.each do |loc|
+ printf "#{name} %-30s %s\n", t.name_with_args, loc
+ end
+ end
+ else
+ fail "Unknown show task mode: '#{options.show_tasks}'"
+ end
+ end
+
+ def terminal_width
+ if @terminal_columns.nonzero?
+ result = @terminal_columns
+ else
+ result = unix? ? dynamic_width : 80
+ end
+ (result < 10) ? 80 : result
+ rescue
+ 80
+ end
+
+ # Calculate the dynamic width of the
+ def dynamic_width
+ @dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput)
+ end
+
+ def dynamic_width_stty
+ %x{stty size 2>/dev/null}.split[1].to_i
+ end
+
+ def dynamic_width_tput
+ %x{tput cols 2>/dev/null}.to_i
+ end
+
+ def unix?
+ RbConfig::CONFIG['host_os'] =~
+ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
+ end
+
+ def windows?
+ Win32.windows?
+ end
+
+ def truncate(string, width)
+ if string.nil?
+ ""
+ elsif string.length <= width
+ string
+ else
+ (string[0, width - 3] || "") + "..."
+ end
+ end
+
+ # Display the tasks and prerequisites
+ def display_prerequisites
+ tasks.each do |t|
+ puts "#{name} #{t.name}"
+ t.prerequisites.each { |pre| puts " #{pre}" }
+ end
+ end
+
+ def trace(*strings)
+ options.trace_output ||= $stderr
+ trace_on(options.trace_output, *strings)
+ end
+
+ def sort_options(options)
+ options.sort_by { |opt|
+ opt.select { |o| o =~ /^-/ }.map { |o| o.downcase }.sort.reverse
+ }
+ end
+ private :sort_options
+
+ # A list of all the standard options used in rake, suitable for
+ # passing to OptionParser.
+ def standard_rake_options
+ sort_options(
+ [
+ ['--all', '-A',
+ "Show all tasks, even uncommented ones",
+ lambda { |value|
+ options.show_all_tasks = value
+ }
+ ],
+ ['--backtrace=[OUT]',
+ "Enable full backtrace. OUT can be stderr (default) or stdout.",
+ lambda { |value|
+ options.backtrace = true
+ select_trace_output(options, 'backtrace', value)
+ }
+ ],
+ ['--comments',
+ "Show commented tasks only",
+ lambda { |value|
+ options.show_all_tasks = !value
+ }
+ ],
+ ['--describe', '-D [PATTERN]',
+ "Describe the tasks (matching optional PATTERN), then exit.",
+ lambda { |value|
+ select_tasks_to_show(options, :describe, value)
+ }
+ ],
+ ['--dry-run', '-n',
+ "Do a dry run without executing actions.",
+ lambda { |value|
+ Rake.verbose(true)
+ Rake.nowrite(true)
+ options.dryrun = true
+ options.trace = true
+ }
+ ],
+ ['--execute', '-e CODE',
+ "Execute some Ruby code and exit.",
+ lambda { |value|
+ eval(value)
+ exit
+ }
+ ],
+ ['--execute-print', '-p CODE',
+ "Execute some Ruby code, print the result, then exit.",
+ lambda { |value|
+ puts eval(value)
+ exit
+ }
+ ],
+ ['--execute-continue', '-E CODE',
+ "Execute some Ruby code, " +
+ "then continue with normal task processing.",
+ lambda { |value| eval(value) }
+ ],
+ ['--jobs', '-j [NUMBER]',
+ "Specifies the maximum number of tasks to execute in parallel. " +
+ "(default is 2)",
+ lambda { |value|
+ options.thread_pool_size = [(value || 2).to_i, 2].max
+ }
+ ],
+ ['--job-stats [LEVEL]',
+ "Display job statistics. " +
+ "LEVEL=history displays a complete job list",
+ lambda { |value|
+ if value =~ /^history/i
+ options.job_stats = :history
+ else
+ options.job_stats = true
+ end
+ }
+ ],
+ ['--libdir', '-I LIBDIR',
+ "Include LIBDIR in the search path for required modules.",
+ lambda { |value| $:.push(value) }
+ ],
+ ['--multitask', '-m',
+ "Treat all tasks as multitasks.",
+ lambda { |value| options.always_multitask = true }
+ ],
+ ['--no-search', '--nosearch',
+ '-N', "Do not search parent directories for the Rakefile.",
+ lambda { |value| options.nosearch = true }
+ ],
+ ['--prereqs', '-P',
+ "Display the tasks and dependencies, then exit.",
+ lambda { |value| options.show_prereqs = true }
+ ],
+ ['--quiet', '-q',
+ "Do not log messages to standard output.",
+ lambda { |value| Rake.verbose(false) }
+ ],
+ ['--rakefile', '-f [FILE]',
+ "Use FILE as the rakefile.",
+ lambda { |value|
+ value ||= ''
+ @rakefiles.clear
+ @rakefiles << value
+ }
+ ],
+ ['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
+ "Auto-import any .rake files in RAKELIBDIR. " +
+ "(default is 'rakelib')",
+ lambda { |value|
+ options.rakelib = value.split(File::PATH_SEPARATOR)
+ }
+ ],
+ ['--require', '-r MODULE',
+ "Require MODULE before executing rakefile.",
+ lambda { |value|
+ begin
+ require value
+ rescue LoadError => ex
+ begin
+ rake_require value
+ rescue LoadError
+ raise ex
+ end
+ end
+ }
+ ],
+ ['--rules',
+ "Trace the rules resolution.",
+ lambda { |value| options.trace_rules = true }
+ ],
+ ['--silent', '-s',
+ "Like --quiet, but also suppresses the " +
+ "'in directory' announcement.",
+ lambda { |value|
+ Rake.verbose(false)
+ options.silent = true
+ }
+ ],
+ ['--suppress-backtrace PATTERN',
+ "Suppress backtrace lines matching regexp PATTERN. " +
+ "Ignored if --trace is on.",
+ lambda { |value|
+ options.suppress_backtrace_pattern = Regexp.new(value)
+ }
+ ],
+ ['--system', '-g',
+ "Using system wide (global) rakefiles " +
+ "(usually '~/.rake/*.rake').",
+ lambda { |value| options.load_system = true }
+ ],
+ ['--no-system', '--nosystem', '-G',
+ "Use standard project Rakefile search paths, " +
+ "ignore system wide rakefiles.",
+ lambda { |value| options.ignore_system = true }
+ ],
+ ['--tasks', '-T [PATTERN]',
+ "Display the tasks (matching optional PATTERN) " +
+ "with descriptions, then exit.",
+ lambda { |value|
+ select_tasks_to_show(options, :tasks, value)
+ }
+ ],
+ ['--trace=[OUT]', '-t',
+ "Turn on invoke/execute tracing, enable full backtrace. " +
+ "OUT can be stderr (default) or stdout.",
+ lambda { |value|
+ options.trace = true
+ options.backtrace = true
+ select_trace_output(options, 'trace', value)
+ Rake.verbose(true)
+ }
+ ],
+ ['--verbose', '-v',
+ "Log message to standard output.",
+ lambda { |value| Rake.verbose(true) }
+ ],
+ ['--version', '-V',
+ "Display the program version.",
+ lambda { |value|
+ puts "rake, version #{RAKEVERSION}"
+ exit
+ }
+ ],
+ ['--where', '-W [PATTERN]',
+ "Describe the tasks (matching optional PATTERN), then exit.",
+ lambda { |value|
+ select_tasks_to_show(options, :lines, value)
+ options.show_all_tasks = true
+ }
+ ],
+ ['--no-deprecation-warnings', '-X',
+ "Disable the deprecation warnings.",
+ lambda { |value|
+ options.ignore_deprecate = true
+ }
+ ],
+ ])
+ end
+
+ def select_tasks_to_show(options, show_tasks, value)
+ options.show_tasks = show_tasks
+ options.show_task_pattern = Regexp.new(value || '')
+ Rake::TaskManager.record_task_metadata = true
+ end
+ private :select_tasks_to_show
+
+ def select_trace_output(options, trace_option, value)
+ value = value.strip unless value.nil?
+ case value
+ when 'stdout'
+ options.trace_output = $stdout
+ when 'stderr', nil
+ options.trace_output = $stderr
+ else
+ fail CommandLineOptionError,
+ "Unrecognized --#{trace_option} option '#{value}'"
+ end
+ end
+ private :select_trace_output
+
+ # Read and handle the command line options.
+ def handle_options
+ options.rakelib = ['rakelib']
+ options.trace_output = $stderr
+
+ OptionParser.new do |opts|
+ opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
+ opts.separator ""
+ opts.separator "Options are ..."
+
+ opts.on_tail("-h", "--help", "-H", "Display this help message.") do
+ puts opts
+ exit
+ end
+
+ standard_rake_options.each { |args| opts.on(*args) }
+ opts.environment('RAKEOPT')
+ end.parse!
+ end
+
+ # Similar to the regular Ruby +require+ command, but will check
+ # for *.rake files in addition to *.rb files.
+ def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
+ fn = file_name + ".rake"
+ return false if loaded.include?(fn)
+ paths.each do |path|
+ full_path = File.join(path, fn)
+ if File.exist?(full_path)
+ Rake.load_rakefile(full_path)
+ loaded << fn
+ return true
+ end
+ end
+ fail LoadError, "Can't find #{file_name}"
+ end
+
+ def find_rakefile_location
+ here = Dir.pwd
+ until (fn = have_rakefile)
+ Dir.chdir("..")
+ return nil if Dir.pwd == here || options.nosearch
+ here = Dir.pwd
+ end
+ [fn, here]
+ ensure
+ Dir.chdir(Rake.original_dir)
+ end
+
+ def print_rakefile_directory(location)
+ $stderr.puts "(in #{Dir.pwd})" unless
+ options.silent or original_dir == location
+ end
+
+ def raw_load_rakefile # :nodoc:
+ rakefile, location = find_rakefile_location
+ if (! options.ignore_system) &&
+ (options.load_system || rakefile.nil?) &&
+ system_dir && File.directory?(system_dir)
+ print_rakefile_directory(location)
+ glob("#{system_dir}/*.rake") do |name|
+ add_import name
+ end
+ else
+ fail "No Rakefile found (looking for: #{@rakefiles.join(', ')})" if
+ rakefile.nil?
+ @rakefile = rakefile
+ Dir.chdir(location)
+ print_rakefile_directory(location)
+ Rake.load_rakefile(File.expand_path(@rakefile)) if
+ @rakefile && @rakefile != ''
+ options.rakelib.each do |rlib|
+ glob("#{rlib}/*.rake") do |name|
+ add_import name
+ end
+ end
+ end
+ load_imports
+ end
+
+ def glob(path, &block)
+ FileList.glob(path.gsub("\\", '/')).each(&block)
+ end
+ private :glob
+
+ # The directory path containing the system wide rakefiles.
+ def system_dir
+ @system_dir ||=
+ begin
+ if ENV['RAKE_SYSTEM']
+ ENV['RAKE_SYSTEM']
+ else
+ standard_system_dir
+ end
+ end
+ end
+
+ # The standard directory containing system wide rake files.
+ if Win32.windows?
+ def standard_system_dir #:nodoc:
+ Win32.win32_system_dir
+ end
+ else
+ def standard_system_dir #:nodoc:
+ File.join(File.expand_path('~'), '.rake')
+ end
+ end
+ private :standard_system_dir
+
+ # Collect the list of tasks on the command line. If no tasks are
+ # given, return a list containing only the default task.
+ # Environmental assignments are processed at this time as well.
+ def collect_tasks
+ @top_level_tasks = []
+ ARGV.each do |arg|
+ if arg =~ /^(\w+)=(.*)$/m
+ ENV[$1] = $2
+ else
+ @top_level_tasks << arg unless arg =~ /^-/
+ end
+ end
+ @top_level_tasks.push(default_task_name) if @top_level_tasks.empty?
+ end
+
+ # Default task name ("default").
+ # (May be overridden by subclasses)
+ def default_task_name
+ "default"
+ end
+
+ # Add a file to the list of files to be imported.
+ def add_import(fn)
+ @pending_imports << fn
+ end
+
+ # Load the pending list of imported files.
+ def load_imports
+ while fn = @pending_imports.shift
+ next if @imported.member?(fn)
+ fn_task = lookup(fn) and fn_task.invoke
+ ext = File.extname(fn)
+ loader = @loaders[ext] || @default_loader
+ loader.load(fn)
+ @imported << fn
+ end
+ end
+
+ def rakefile_location(backtrace=caller)
+ backtrace.map { |t| t[/([^:]+):/, 1] }
+
+ re = /^#{@rakefile}$/
+ re = /#{re.source}/i if windows?
+
+ backtrace.find { |str| str =~ re } || ''
+ end
+
+ private
+ FIXNUM_MAX = (2**(0.size * 8 - 2) - 1) # :nodoc:
+
+ end
+end
diff --git a/lib/rake/backtrace.rb b/lib/rake/backtrace.rb
new file mode 100644
index 0000000000..9b2ba6157f
--- /dev/null
+++ b/lib/rake/backtrace.rb
@@ -0,0 +1,20 @@
+module Rake
+ module Backtrace
+ SYS_KEYS = RbConfig::CONFIG.keys.grep(/(prefix|libdir)/)
+ SYS_PATHS = RbConfig::CONFIG.values_at(*SYS_KEYS).uniq +
+ [ File.join(File.dirname(__FILE__), "..") ]
+
+ SUPPRESSED_PATHS = SYS_PATHS.
+ map { |s| s.gsub("\\", "/") }.
+ map { |f| File.expand_path(f) }.
+ reject { |s| s.nil? || s =~ /^ *$/ }
+ SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|")
+ SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i
+
+ def self.collapse(backtrace)
+ pattern = Rake.application.options.suppress_backtrace_pattern ||
+ SUPPRESS_PATTERN
+ backtrace.reject { |elem| elem =~ pattern }
+ end
+ end
+end
diff --git a/lib/rake/clean.rb b/lib/rake/clean.rb
new file mode 100644
index 0000000000..8001ce569a
--- /dev/null
+++ b/lib/rake/clean.rb
@@ -0,0 +1,55 @@
+# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
+# two rake tasks (:clean and :clobber).
+#
+# [:clean] Clean up the project by deleting scratch files and backup
+# files. Add files to the CLEAN file list to have the :clean
+# target handle them.
+#
+# [:clobber] Clobber all generated and non-source files in a project.
+# The task depends on :clean, so all the clean files will
+# be deleted as well as files in the CLOBBER file list.
+# The intent of this task is to return a project to its
+# pristine, just unpacked state.
+
+require 'rake'
+
+# :stopdoc:
+
+module Rake
+ module Cleaner
+ extend FileUtils
+
+ module_function
+
+ def cleanup_files(file_names)
+ file_names.each do |file_name|
+ cleanup(file_name)
+ end
+ end
+
+ def cleanup(file_name, opts={})
+ begin
+ rm_r file_name, opts
+ rescue StandardError => ex
+ puts "Failed to remove #{file_name}: #{ex}"
+ end
+ end
+ end
+end
+
+CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"]
+CLEAN.clear_exclude.exclude { |fn|
+ fn.pathmap("%f").downcase == 'core' && File.directory?(fn)
+}
+
+desc "Remove any temporary products."
+task :clean do
+ Rake::Cleaner.cleanup_files(CLEAN)
+end
+
+CLOBBER = ::Rake::FileList.new
+
+desc "Remove any generated file."
+task :clobber => [:clean] do
+ Rake::Cleaner.cleanup_files(CLOBBER)
+end
diff --git a/lib/rake/cloneable.rb b/lib/rake/cloneable.rb
new file mode 100644
index 0000000000..ac67471232
--- /dev/null
+++ b/lib/rake/cloneable.rb
@@ -0,0 +1,16 @@
+module Rake
+ # ##########################################################################
+ # Mixin for creating easily cloned objects.
+ #
+ module Cloneable
+ # The hook that invoked by 'clone' and 'dup' methods.
+ def initialize_copy(source)
+ super
+ source.instance_variables.each do |var|
+ src_value = source.instance_variable_get(var)
+ value = src_value.clone rescue src_value
+ instance_variable_set(var, value)
+ end
+ end
+ end
+end
diff --git a/lib/rake/contrib/compositepublisher.rb b/lib/rake/contrib/compositepublisher.rb
new file mode 100644
index 0000000000..69952a0808
--- /dev/null
+++ b/lib/rake/contrib/compositepublisher.rb
@@ -0,0 +1,21 @@
+module Rake
+
+ # Manage several publishers as a single entity.
+ class CompositePublisher
+ def initialize
+ @publishers = []
+ end
+
+ # Add a publisher to the composite.
+ def add(pub)
+ @publishers << pub
+ end
+
+ # Upload all the individual publishers.
+ def upload
+ @publishers.each { |p| p.upload }
+ end
+ end
+
+end
+
diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb
new file mode 100644
index 0000000000..0dd50fdc8d
--- /dev/null
+++ b/lib/rake/contrib/ftptools.rb
@@ -0,0 +1,139 @@
+# = Tools for FTP uploading.
+#
+# This file is still under development and is not released for general
+# use.
+
+require 'date'
+require 'net/ftp'
+require 'rake/file_list'
+
+module Rake # :nodoc:
+
+ ####################################################################
+ # <b>Note:</b> <em> Not released for general use.</em>
+ class FtpFile
+ attr_reader :name, :size, :owner, :group, :time
+
+ def self.date
+ @date_class ||= Date
+ end
+
+ def self.time
+ @time_class ||= Time
+ end
+
+ def initialize(path, entry)
+ @path = path
+ @mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
+ @size = size.to_i
+ @time = determine_time(d1, d2, d3)
+ end
+
+ def path
+ File.join(@path, @name)
+ end
+
+ def directory?
+ @mode[0] == ?d
+ end
+
+ def mode
+ parse_mode(@mode)
+ end
+
+ def symlink?
+ @mode[0] == ?l
+ end
+
+ private # --------------------------------------------------------
+
+ def parse_mode(m)
+ result = 0
+ (1..9).each do |i|
+ result = 2 * result + ((m[i] == ?-) ? 0 : 1)
+ end
+ result
+ end
+
+ def determine_time(d1, d2, d3)
+ now = self.class.time.now
+ if /:/ !~ d3
+ result = Time.parse("#{d1} #{d2} #{d3}")
+ else
+ result = Time.parse("#{d1} #{d2} #{now.year} #{d3}")
+ result = Time.parse("#{d1} #{d2} #{now.year - 1} #{d3}") if
+ result > now
+ end
+ result
+ end
+ end
+
+ ####################################################################
+ # Manage the uploading of files to an FTP account.
+ class FtpUploader
+
+ # Log uploads to standard output when true.
+ attr_accessor :verbose
+
+ class << FtpUploader
+ # Create an uploader and pass it to the given block as +up+.
+ # When the block is complete, close the uploader.
+ def connect(path, host, account, password)
+ up = self.new(path, host, account, password)
+ begin
+ yield(up)
+ ensure
+ up.close
+ end
+ end
+ end
+
+ # Create an FTP uploader targeting the directory +path+ on +host+
+ # using the given account and password. +path+ will be the root
+ # path of the uploader.
+ def initialize(path, host, account, password)
+ @created = Hash.new
+ @path = path
+ @ftp = Net::FTP.new(host, account, password)
+ makedirs(@path)
+ @ftp.chdir(@path)
+ end
+
+ # Create the directory +path+ in the uploader root path.
+ def makedirs(path)
+ route = []
+ File.split(path).each do |dir|
+ route << dir
+ current_dir = File.join(route)
+ if @created[current_dir].nil?
+ @created[current_dir] = true
+ $stderr.puts "Creating Directory #{current_dir}" if @verbose
+ @ftp.mkdir(current_dir) rescue nil
+ end
+ end
+ end
+
+ # Upload all files matching +wildcard+ to the uploader's root
+ # path.
+ def upload_files(wildcard)
+ FileList.glob(wildcard).each do |fn|
+ upload(fn)
+ end
+ end
+
+ # Close the uploader.
+ def close
+ @ftp.close
+ end
+
+ private # --------------------------------------------------------
+
+ # Upload a single file to the uploader's root path.
+ def upload(file)
+ $stderr.puts "Uploading #{file}" if @verbose
+ dir = File.dirname(file)
+ makedirs(dir)
+ @ftp.putbinaryfile(file, file) unless File.directory?(file)
+ end
+ end
+end
diff --git a/lib/rake/contrib/publisher.rb b/lib/rake/contrib/publisher.rb
new file mode 100644
index 0000000000..8b11edb59c
--- /dev/null
+++ b/lib/rake/contrib/publisher.rb
@@ -0,0 +1,73 @@
+# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
+# All rights reserved.
+
+# :stopdoc:
+
+# Configuration information about an upload host system.
+# name :: Name of host system.
+# webdir :: Base directory for the web information for the
+# application. The application name (APP) is appended to
+# this directory before using.
+# pkgdir :: Directory on the host system where packages can be
+# placed.
+HostInfo = Struct.new(:name, :webdir, :pkgdir)
+
+# :startdoc:
+
+# Manage several publishers as a single entity.
+class CompositePublisher
+ def initialize
+ @publishers = []
+ end
+
+ # Add a publisher to the composite.
+ def add(pub)
+ @publishers << pub
+ end
+
+ # Upload all the individual publishers.
+ def upload
+ @publishers.each { |p| p.upload }
+ end
+end
+
+# Publish an entire directory to an existing remote directory using
+# SSH.
+class SshDirPublisher
+ def initialize(host, remote_dir, local_dir)
+ @host = host
+ @remote_dir = remote_dir
+ @local_dir = local_dir
+ end
+
+ def upload
+ run %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
+ end
+end
+
+# Publish an entire directory to a fresh remote directory using SSH.
+class SshFreshDirPublisher < SshDirPublisher
+ def upload
+ run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
+ run %{ssh #{@host} mkdir #{@remote_dir}}
+ super
+ end
+end
+
+# Publish a list of files to an existing remote directory.
+class SshFilePublisher
+ # Create a publisher using the give host information.
+ def initialize(host, remote_dir, local_dir, *files)
+ @host = host
+ @remote_dir = remote_dir
+ @local_dir = local_dir
+ @files = files
+ end
+
+ # Upload the local directory to the remote directory.
+ def upload
+ @files.each do |fn|
+ run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
+ end
+ end
+end
diff --git a/lib/rake/contrib/rubyforgepublisher.rb b/lib/rake/contrib/rubyforgepublisher.rb
new file mode 100644
index 0000000000..a4b96936c8
--- /dev/null
+++ b/lib/rake/contrib/rubyforgepublisher.rb
@@ -0,0 +1,16 @@
+require 'rake/contrib/sshpublisher'
+
+module Rake
+
+ class RubyForgePublisher < SshDirPublisher
+ attr_reader :project, :proj_id, :user
+
+ def initialize(projname, user)
+ super(
+ "#{user}@rubyforge.org",
+ "/var/www/gforge-projects/#{projname}",
+ "html")
+ end
+ end
+
+end
diff --git a/lib/rake/contrib/sshpublisher.rb b/lib/rake/contrib/sshpublisher.rb
new file mode 100644
index 0000000000..bd6adc127e
--- /dev/null
+++ b/lib/rake/contrib/sshpublisher.rb
@@ -0,0 +1,50 @@
+require 'rake/dsl_definition'
+require 'rake/contrib/compositepublisher'
+
+module Rake
+
+ # Publish an entire directory to an existing remote directory using
+ # SSH.
+ class SshDirPublisher
+ include Rake::DSL
+
+ def initialize(host, remote_dir, local_dir)
+ @host = host
+ @remote_dir = remote_dir
+ @local_dir = local_dir
+ end
+
+ def upload
+ sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
+ end
+ end
+
+ # Publish an entire directory to a fresh remote directory using SSH.
+ class SshFreshDirPublisher < SshDirPublisher
+ def upload
+ sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
+ sh %{ssh #{@host} mkdir #{@remote_dir}}
+ super
+ end
+ end
+
+ # Publish a list of files to an existing remote directory.
+ class SshFilePublisher
+ include Rake::DSL
+
+ # Create a publisher using the give host information.
+ def initialize(host, remote_dir, local_dir, *files)
+ @host = host
+ @remote_dir = remote_dir
+ @local_dir = local_dir
+ @files = files
+ end
+
+ # Upload the local directory to the remote directory.
+ def upload
+ @files.each do |fn|
+ sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
+ end
+ end
+ end
+end
diff --git a/lib/rake/contrib/sys.rb b/lib/rake/contrib/sys.rb
new file mode 100644
index 0000000000..a3a9f69e25
--- /dev/null
+++ b/lib/rake/contrib/sys.rb
@@ -0,0 +1,2 @@
+fail "ERROR: 'rake/contrib/sys' is obsolete and no longer supported. " +
+ "Use 'FileUtils' instead."
diff --git a/lib/rake/default_loader.rb b/lib/rake/default_loader.rb
new file mode 100644
index 0000000000..5dd3c05617
--- /dev/null
+++ b/lib/rake/default_loader.rb
@@ -0,0 +1,10 @@
+module Rake
+
+ # Default Rakefile loader used by +import+.
+ class DefaultLoader
+ def load(fn)
+ Rake.load_rakefile(File.expand_path(fn))
+ end
+ end
+
+end
diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb
new file mode 100644
index 0000000000..b24a821386
--- /dev/null
+++ b/lib/rake/dsl_definition.rb
@@ -0,0 +1,157 @@
+# Rake DSL functions.
+require 'rake/file_utils_ext'
+
+module Rake
+
+ ##
+ # DSL is a module that provides #task, #desc, #namespace, etc. Use this
+ # when you'd like to use rake outside the top level scope.
+
+ module DSL
+
+ #--
+ # Include the FileUtils file manipulation functions in the top
+ # level module, but mark them private so that they don't
+ # unintentionally define methods on other objects.
+ #++
+
+ include FileUtilsExt
+ private(*FileUtils.instance_methods(false))
+ private(*FileUtilsExt.instance_methods(false))
+
+ private
+
+ # Declare a basic task.
+ #
+ # Example:
+ # task :clobber => [:clean] do
+ # rm_rf "html"
+ # end
+ #
+ def task(*args, &block)
+ Rake::Task.define_task(*args, &block)
+ end
+
+ # Declare a file task.
+ #
+ # Example:
+ # file "config.cfg" => ["config.template"] do
+ # open("config.cfg", "w") do |outfile|
+ # open("config.template") do |infile|
+ # while line = infile.gets
+ # outfile.puts line
+ # end
+ # end
+ # end
+ # end
+ #
+ def file(*args, &block)
+ Rake::FileTask.define_task(*args, &block)
+ end
+
+ # Declare a file creation task.
+ # (Mainly used for the directory command).
+ def file_create(*args, &block)
+ Rake::FileCreationTask.define_task(*args, &block)
+ end
+
+ # Declare a set of files tasks to create the given directories on
+ # demand.
+ #
+ # Example:
+ # directory "testdata/doc"
+ #
+ def directory(*args, &block)
+ result = file_create(*args, &block)
+ dir, _ = *Rake.application.resolve_args(args)
+ Rake.each_dir_parent(dir) do |d|
+ file_create d do |t|
+ mkdir_p t.name unless File.exist?(t.name)
+ end
+ end
+ result
+ end
+
+ # Declare a task that performs its prerequisites in
+ # parallel. Multitasks does *not* guarantee that its prerequisites
+ # will execute in any given order (which is obvious when you think
+ # about it)
+ #
+ # Example:
+ # multitask :deploy => [:deploy_gem, :deploy_rdoc]
+ #
+ def multitask(*args, &block)
+ Rake::MultiTask.define_task(*args, &block)
+ end
+
+ # Create a new rake namespace and use it for evaluating the given
+ # block. Returns a NameSpace object that can be used to lookup
+ # tasks defined in the namespace.
+ #
+ # E.g.
+ #
+ # ns = namespace "nested" do
+ # task :run
+ # end
+ # task_run = ns[:run] # find :run in the given namespace.
+ #
+ def namespace(name=nil, &block)
+ name = name.to_s if name.kind_of?(Symbol)
+ name = name.to_str if name.respond_to?(:to_str)
+ unless name.kind_of?(String) || name.nil?
+ raise ArgumentError, "Expected a String or Symbol for a namespace name"
+ end
+ Rake.application.in_namespace(name, &block)
+ end
+
+ # Declare a rule for auto-tasks.
+ #
+ # Example:
+ # rule '.o' => '.c' do |t|
+ # sh %{cc -o #{t.name} #{t.source}}
+ # end
+ #
+ def rule(*args, &block)
+ Rake::Task.create_rule(*args, &block)
+ end
+
+ # Describe the next rake task.
+ # Duplicate descriptions are discarded.
+ #
+ # Example:
+ # desc "Run the Unit Tests"
+ # task :test => [:build]
+ # runtests
+ # end
+ #
+ def desc(description)
+ Rake.application.last_description = description
+ end
+
+ # Import the partial Rakefiles +fn+. Imported files are loaded
+ # _after_ the current file is completely loaded. This allows the
+ # import statement to appear anywhere in the importing file, and yet
+ # allowing the imported files to depend on objects defined in the
+ # importing file.
+ #
+ # A common use of the import statement is to include files
+ # containing dependency declarations.
+ #
+ # See also the --rakelibdir command line option.
+ #
+ # Example:
+ # import ".depend", "my_rules"
+ #
+ def import(*fns)
+ fns.each do |fn|
+ Rake.application.add_import(fn)
+ end
+ end
+ end
+ extend FileUtilsExt
+end
+
+# Extend the main object with the DSL commands. This allows top-level
+# calls to task, etc. to work from a Rakefile without polluting the
+# object inheritance tree.
+self.extend Rake::DSL
diff --git a/lib/rake/early_time.rb b/lib/rake/early_time.rb
new file mode 100644
index 0000000000..8c0e7d3339
--- /dev/null
+++ b/lib/rake/early_time.rb
@@ -0,0 +1,18 @@
+module Rake
+
+ # EarlyTime is a fake timestamp that occurs _before_ any other time value.
+ class EarlyTime
+ include Comparable
+ include Singleton
+
+ def <=>(other)
+ -1
+ end
+
+ def to_s
+ "<EARLY TIME>"
+ end
+ end
+
+ EARLY = EarlyTime.instance
+end
diff --git a/lib/rake/ext/core.rb b/lib/rake/ext/core.rb
new file mode 100644
index 0000000000..c924c7eaba
--- /dev/null
+++ b/lib/rake/ext/core.rb
@@ -0,0 +1,28 @@
+######################################################################
+# Core extension library
+#
+class Module
+ # Check for an existing method in the current class before extending. IF
+ # the method already exists, then a warning is printed and the extension is
+ # not added. Otherwise the block is yielded and any definitions in the
+ # block will take effect.
+ #
+ # Usage:
+ #
+ # class String
+ # rake_extension("xyz") do
+ # def xyz
+ # ...
+ # end
+ # end
+ # end
+ #
+ def rake_extension(method)
+ if method_defined?(method)
+ $stderr.puts "WARNING: Possible conflict with Rake extension: " +
+ "#{self}##{method} already exists"
+ else
+ yield
+ end
+ end
+end
diff --git a/lib/rake/ext/module.rb b/lib/rake/ext/module.rb
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/lib/rake/ext/module.rb
@@ -0,0 +1 @@
+
diff --git a/lib/rake/ext/string.rb b/lib/rake/ext/string.rb
new file mode 100644
index 0000000000..07ef167f82
--- /dev/null
+++ b/lib/rake/ext/string.rb
@@ -0,0 +1,166 @@
+require 'rake/ext/core'
+
+######################################################################
+# Rake extension methods for String.
+#
+class String
+
+ rake_extension("ext") do
+ # Replace the file extension with +newext+. If there is no extension on
+ # the string, append the new extension to the end. If the new extension
+ # is not given, or is the empty string, remove any existing extension.
+ #
+ # +ext+ is a user added method for the String class.
+ def ext(newext='')
+ return self.dup if ['.', '..'].include? self
+ newext = (newext =~ /^\./) ? newext : ("." + newext) if newext != ''
+ self.chomp(File.extname(self)) << newext
+ end
+ end
+
+ rake_extension("pathmap") do
+ # Explode a path into individual components. Used by +pathmap+.
+ def pathmap_explode
+ head, tail = File.split(self)
+ return [self] if head == self
+ return [tail] if head == '.' || tail == '/'
+ return [head, tail] if head == '/'
+ return head.pathmap_explode + [tail]
+ end
+ protected :pathmap_explode
+
+ # Extract a partial path from the path. Include +n+ directories from the
+ # front end (left hand side) if +n+ is positive. Include |+n+|
+ # directories from the back end (right hand side) if +n+ is negative.
+ def pathmap_partial(n)
+ dirs = File.dirname(self).pathmap_explode
+ partial_dirs =
+ if n > 0
+ dirs[0...n]
+ elsif n < 0
+ dirs.reverse[0...-n].reverse
+ else
+ "."
+ end
+ File.join(partial_dirs)
+ end
+ protected :pathmap_partial
+
+ # Preform the pathmap replacement operations on the given path. The
+ # patterns take the form 'pat1,rep1;pat2,rep2...'.
+ def pathmap_replace(patterns, &block)
+ result = self
+ patterns.split(';').each do |pair|
+ pattern, replacement = pair.split(',')
+ pattern = Regexp.new(pattern)
+ if replacement == '*' && block_given?
+ result = result.sub(pattern, &block)
+ elsif replacement
+ result = result.sub(pattern, replacement)
+ else
+ result = result.sub(pattern, '')
+ end
+ end
+ result
+ end
+ protected :pathmap_replace
+
+ # Map the path according to the given specification. The specification
+ # controls the details of the mapping. The following special patterns are
+ # recognized:
+ #
+ # * <b>%p</b> -- The complete path.
+ # * <b>%f</b> -- The base file name of the path, with its file extension,
+ # but without any directories.
+ # * <b>%n</b> -- The file name of the path without its file extension.
+ # * <b>%d</b> -- The directory list of the path.
+ # * <b>%x</b> -- The file extension of the path. An empty string if there
+ # is no extension.
+ # * <b>%X</b> -- Everything *but* the file extension.
+ # * <b>%s</b> -- The alternate file separator if defined, otherwise use
+ # the standard file separator.
+ # * <b>%%</b> -- A percent sign.
+ #
+ # The %d specifier can also have a numeric prefix (e.g. '%2d'). If the
+ # number is positive, only return (up to) +n+ directories in the path,
+ # starting from the left hand side. If +n+ is negative, return (up to)
+ # |+n+| directories from the right hand side of the path.
+ #
+ # Examples:
+ #
+ # 'a/b/c/d/file.txt'.pathmap("%2d") => 'a/b'
+ # 'a/b/c/d/file.txt'.pathmap("%-2d") => 'c/d'
+ #
+ # Also the %d, %p, %f, %n, %x, and %X operators can take a
+ # pattern/replacement argument to perform simple string substitutions on a
+ # particular part of the path. The pattern and replacement are separated
+ # by a comma and are enclosed by curly braces. The replacement spec comes
+ # after the % character but before the operator letter. (e.g.
+ # "%{old,new}d"). Multiple replacement specs should be separated by
+ # semi-colons (e.g. "%{old,new;src,bin}d").
+ #
+ # Regular expressions may be used for the pattern, and back refs may be
+ # used in the replacement text. Curly braces, commas and semi-colons are
+ # excluded from both the pattern and replacement text (let's keep parsing
+ # reasonable).
+ #
+ # For example:
+ #
+ # "src/org/onestepback/proj/A.java".pathmap("%{^src,bin}X.class")
+ #
+ # returns:
+ #
+ # "bin/org/onestepback/proj/A.class"
+ #
+ # If the replacement text is '*', then a block may be provided to perform
+ # some arbitrary calculation for the replacement.
+ #
+ # For example:
+ #
+ # "/path/to/file.TXT".pathmap("%X%{.*,*}x") { |ext|
+ # ext.downcase
+ # }
+ #
+ # Returns:
+ #
+ # "/path/to/file.txt"
+ #
+ def pathmap(spec=nil, &block)
+ return self if spec.nil?
+ result = ''
+ spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
+ case frag
+ when '%f'
+ result << File.basename(self)
+ when '%n'
+ result << File.basename(self).ext
+ when '%d'
+ result << File.dirname(self)
+ when '%x'
+ result << File.extname(self)
+ when '%X'
+ result << self.ext
+ when '%p'
+ result << self
+ when '%s'
+ result << (File::ALT_SEPARATOR || File::SEPARATOR)
+ when '%-'
+ # do nothing
+ when '%%'
+ result << "%"
+ when /%(-?\d+)d/
+ result << pathmap_partial($1.to_i)
+ when /^%\{([^}]*)\}(\d*[dpfnxX])/
+ patterns, operator = $1, $2
+ result << pathmap('%' + operator).pathmap_replace(patterns, &block)
+ when /^%/
+ fail ArgumentError, "Unknown pathmap specifier #{frag} in '#{spec}'"
+ else
+ result << frag
+ end
+ end
+ result
+ end
+ end
+
+end
diff --git a/lib/rake/ext/time.rb b/lib/rake/ext/time.rb
new file mode 100644
index 0000000000..ea8b037e39
--- /dev/null
+++ b/lib/rake/ext/time.rb
@@ -0,0 +1,15 @@
+#--
+# Extensions to time to allow comparisons with an early time class.
+
+require 'rake/early_time'
+
+class Time
+ alias rake_original_time_compare :<=>
+ def <=>(other)
+ if Rake::EarlyTime === other
+ - other.<=>(self)
+ else
+ rake_original_time_compare(other)
+ end
+ end
+end
diff --git a/lib/rake/file_creation_task.rb b/lib/rake/file_creation_task.rb
new file mode 100644
index 0000000000..c87e2192bb
--- /dev/null
+++ b/lib/rake/file_creation_task.rb
@@ -0,0 +1,24 @@
+require 'rake/file_task'
+require 'rake/early_time'
+
+module Rake
+
+ # A FileCreationTask is a file task that when used as a dependency will be
+ # needed if and only if the file has not been created. Once created, it is
+ # not re-triggered if any of its dependencies are newer, nor does trigger
+ # any rebuilds of tasks that depend on it whenever it is updated.
+ #
+ class FileCreationTask < FileTask
+ # Is this file task needed? Yes if it doesn't exist.
+ def needed?
+ ! File.exist?(name)
+ end
+
+ # Time stamp for file creation task. This time stamp is earlier
+ # than any other time stamp.
+ def timestamp
+ Rake::EARLY
+ end
+ end
+
+end
diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb
new file mode 100644
index 0000000000..0b60925f09
--- /dev/null
+++ b/lib/rake/file_list.rb
@@ -0,0 +1,416 @@
+require 'rake/cloneable'
+require 'rake/file_utils_ext'
+require 'rake/pathmap'
+
+######################################################################
+module Rake
+
+ # #########################################################################
+ # A FileList is essentially an array with a few helper methods defined to
+ # make file manipulation a bit easier.
+ #
+ # FileLists are lazy. When given a list of glob patterns for possible files
+ # to be included in the file list, instead of searching the file structures
+ # to find the files, a FileList holds the pattern for latter use.
+ #
+ # This allows us to define a number of FileList to match any number of
+ # files, but only search out the actual files when then FileList itself is
+ # actually used. The key is that the first time an element of the
+ # FileList/Array is requested, the pending patterns are resolved into a real
+ # list of file names.
+ #
+ class FileList
+
+ include Cloneable
+
+ # == Method Delegation
+ #
+ # The lazy evaluation magic of FileLists happens by implementing all the
+ # array specific methods to call +resolve+ before delegating the heavy
+ # lifting to an embedded array object (@items).
+ #
+ # In addition, there are two kinds of delegation calls. The regular kind
+ # delegates to the @items array and returns the result directly. Well,
+ # almost directly. It checks if the returned value is the @items object
+ # itself, and if so will return the FileList object instead.
+ #
+ # The second kind of delegation call is used in methods that normally
+ # return a new Array object. We want to capture the return value of these
+ # methods and wrap them in a new FileList object. We enumerate these
+ # methods in the +SPECIAL_RETURN+ list below.
+
+ # List of array methods (that are not in +Object+) that need to be
+ # delegated.
+ ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).
+ map { |n| n.to_s }
+
+ # List of additional methods that must be delegated.
+ MUST_DEFINE = %w[inspect <=>]
+
+ # List of methods that should not be delegated here (we define special
+ # versions of them explicitly below).
+ MUST_NOT_DEFINE = %w[to_a to_ary partition *]
+
+ # List of delegated methods that return new array values which need
+ # wrapping.
+ SPECIAL_RETURN = %w[
+ map collect sort sort_by select find_all reject grep
+ compact flatten uniq values_at
+ + - & |
+ ]
+
+ DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).
+ map { |s| s.to_s }.sort.uniq
+
+ # Now do the delegation.
+ DELEGATING_METHODS.each do |sym|
+ if SPECIAL_RETURN.include?(sym)
+ ln = __LINE__ + 1
+ class_eval %{
+ def #{sym}(*args, &block)
+ resolve
+ result = @items.send(:#{sym}, *args, &block)
+ FileList.new.import(result)
+ end
+ }, __FILE__, ln
+ else
+ ln = __LINE__ + 1
+ class_eval %{
+ def #{sym}(*args, &block)
+ resolve
+ result = @items.send(:#{sym}, *args, &block)
+ result.object_id == @items.object_id ? self : result
+ end
+ }, __FILE__, ln
+ end
+ end
+
+ # Create a file list from the globbable patterns given. If you wish to
+ # perform multiple includes or excludes at object build time, use the
+ # "yield self" pattern.
+ #
+ # Example:
+ # file_list = FileList.new('lib/**/*.rb', 'test/test*.rb')
+ #
+ # pkg_files = FileList.new('lib/**/*') do |fl|
+ # fl.exclude(/\bCVS\b/)
+ # end
+ #
+ def initialize(*patterns)
+ @pending_add = []
+ @pending = false
+ @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup
+ @exclude_procs = DEFAULT_IGNORE_PROCS.dup
+ @items = []
+ patterns.each { |pattern| include(pattern) }
+ yield self if block_given?
+ end
+
+ # Add file names defined by glob patterns to the file list. If an array
+ # is given, add each element of the array.
+ #
+ # Example:
+ # file_list.include("*.java", "*.cfg")
+ # file_list.include %w( math.c lib.h *.o )
+ #
+ def include(*filenames)
+ # TODO: check for pending
+ filenames.each do |fn|
+ if fn.respond_to? :to_ary
+ include(*fn.to_ary)
+ else
+ @pending_add << fn
+ end
+ end
+ @pending = true
+ self
+ end
+ alias :add :include
+
+ # Register a list of file name patterns that should be excluded from the
+ # list. Patterns may be regular expressions, glob patterns or regular
+ # strings. In addition, a block given to exclude will remove entries that
+ # return true when given to the block.
+ #
+ # Note that glob patterns are expanded against the file system. If a file
+ # is explicitly added to a file list, but does not exist in the file
+ # system, then an glob pattern in the exclude list will not exclude the
+ # file.
+ #
+ # Examples:
+ # FileList['a.c', 'b.c'].exclude("a.c") => ['b.c']
+ # FileList['a.c', 'b.c'].exclude(/^a/) => ['b.c']
+ #
+ # If "a.c" is a file, then ...
+ # FileList['a.c', 'b.c'].exclude("a.*") => ['b.c']
+ #
+ # If "a.c" is not a file, then ...
+ # FileList['a.c', 'b.c'].exclude("a.*") => ['a.c', 'b.c']
+ #
+ def exclude(*patterns, &block)
+ patterns.each do |pat|
+ @exclude_patterns << pat
+ end
+ @exclude_procs << block if block_given?
+ resolve_exclude unless @pending
+ self
+ end
+
+
+ # Clear all the exclude patterns so that we exclude nothing.
+ def clear_exclude
+ @exclude_patterns = []
+ @exclude_procs = []
+ self
+ end
+
+ # Define equality.
+ def ==(array)
+ to_ary == array
+ end
+
+ # Return the internal array object.
+ def to_a
+ resolve
+ @items
+ end
+
+ # Return the internal array object.
+ def to_ary
+ to_a
+ end
+
+ # Lie about our class.
+ def is_a?(klass)
+ klass == Array || super(klass)
+ end
+ alias kind_of? is_a?
+
+ # Redefine * to return either a string or a new file list.
+ def *(other)
+ result = @items * other
+ case result
+ when Array
+ FileList.new.import(result)
+ else
+ result
+ end
+ end
+
+ # Resolve all the pending adds now.
+ def resolve
+ if @pending
+ @pending = false
+ @pending_add.each do |fn| resolve_add(fn) end
+ @pending_add = []
+ resolve_exclude
+ end
+ self
+ end
+
+ def resolve_add(fn)
+ case fn
+ when %r{[*?\[\{]}
+ add_matching(fn)
+ else
+ self << fn
+ end
+ end
+ private :resolve_add
+
+ def resolve_exclude
+ reject! { |fn| excluded_from_list?(fn) }
+ self
+ end
+ private :resolve_exclude
+
+ # Return a new FileList with the results of running +sub+ against each
+ # element of the original list.
+ #
+ # Example:
+ # FileList['a.c', 'b.c'].sub(/\.c$/, '.o') => ['a.o', 'b.o']
+ #
+ def sub(pat, rep)
+ inject(FileList.new) { |res, fn| res << fn.sub(pat, rep) }
+ end
+
+ # Return a new FileList with the results of running +gsub+ against each
+ # element of the original list.
+ #
+ # Example:
+ # FileList['lib/test/file', 'x/y'].gsub(/\//, "\\")
+ # => ['lib\\test\\file', 'x\\y']
+ #
+ def gsub(pat, rep)
+ inject(FileList.new) { |res, fn| res << fn.gsub(pat, rep) }
+ end
+
+ # Same as +sub+ except that the original file list is modified.
+ def sub!(pat, rep)
+ each_with_index { |fn, i| self[i] = fn.sub(pat, rep) }
+ self
+ end
+
+ # Same as +gsub+ except that the original file list is modified.
+ def gsub!(pat, rep)
+ each_with_index { |fn, i| self[i] = fn.gsub(pat, rep) }
+ self
+ end
+
+ # Apply the pathmap spec to each of the included file names, returning a
+ # new file list with the modified paths. (See String#pathmap for
+ # details.)
+ def pathmap(spec=nil)
+ collect { |fn| fn.pathmap(spec) }
+ end
+
+ # Return a new FileList with <tt>String#ext</tt> method applied to
+ # each member of the array.
+ #
+ # This method is a shortcut for:
+ #
+ # array.collect { |item| item.ext(newext) }
+ #
+ # +ext+ is a user added method for the Array class.
+ def ext(newext='')
+ collect { |fn| fn.ext(newext) }
+ end
+
+
+ # Grep each of the files in the filelist using the given pattern. If a
+ # block is given, call the block on each matching line, passing the file
+ # name, line number, and the matching line of text. If no block is given,
+ # a standard emacs style file:linenumber:line message will be printed to
+ # standard out. Returns the number of matched items.
+ def egrep(pattern, *options)
+ matched = 0
+ each do |fn|
+ begin
+ open(fn, "r", *options) do |inf|
+ count = 0
+ inf.each do |line|
+ count += 1
+ if pattern.match(line)
+ matched += 1
+ if block_given?
+ yield fn, count, line
+ else
+ puts "#{fn}:#{count}:#{line}"
+ end
+ end
+ end
+ end
+ rescue StandardError => ex
+ $stderr.puts "Error while processing '#{fn}': #{ex}"
+ end
+ end
+ matched
+ end
+
+ # Return a new file list that only contains file names from the current
+ # file list that exist on the file system.
+ def existing
+ select { |fn| File.exist?(fn) }
+ end
+
+ # Modify the current file list so that it contains only file name that
+ # exist on the file system.
+ def existing!
+ resolve
+ @items = @items.select { |fn| File.exist?(fn) }
+ self
+ end
+
+ # FileList version of partition. Needed because the nested arrays should
+ # be FileLists in this version.
+ def partition(&block) # :nodoc:
+ resolve
+ result = @items.partition(&block)
+ [
+ FileList.new.import(result[0]),
+ FileList.new.import(result[1]),
+ ]
+ end
+
+ # Convert a FileList to a string by joining all elements with a space.
+ def to_s
+ resolve
+ self.join(' ')
+ end
+
+ # Add matching glob patterns.
+ def add_matching(pattern)
+ FileList.glob(pattern).each do |fn|
+ self << fn unless excluded_from_list?(fn)
+ end
+ end
+ private :add_matching
+
+ # Should the given file name be excluded from the list?
+ #
+ # NOTE: This method was formally named "exclude?", but Rails
+ # introduced an exclude? method as an array method and setup a
+ # conflict with file list. We renamed the method to avoid
+ # confusion. If you were using "FileList#exclude?" in your user
+ # code, you will need to update.
+ def excluded_from_list?(fn)
+ return true if @exclude_patterns.any? do |pat|
+ case pat
+ when Regexp
+ fn =~ pat
+ when /[*?]/
+ File.fnmatch?(pat, fn, File::FNM_PATHNAME)
+ else
+ fn == pat
+ end
+ end
+ @exclude_procs.any? { |p| p.call(fn) }
+ end
+
+ DEFAULT_IGNORE_PATTERNS = [
+ /(^|[\/\\])CVS([\/\\]|$)/,
+ /(^|[\/\\])\.svn([\/\\]|$)/,
+ /\.bak$/,
+ /~$/
+ ]
+ DEFAULT_IGNORE_PROCS = [
+ proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
+ ]
+
+ def import(array)
+ @items = array
+ self
+ end
+
+ class << self
+ # Create a new file list including the files listed. Similar to:
+ #
+ # FileList.new(*args)
+ def [](*args)
+ new(*args)
+ end
+
+ # Get a sorted list of files matching the pattern. This method
+ # should be prefered to Dir[pattern] and Dir.glob(pattern) because
+ # the files returned are guaranteed to be sorted.
+ def glob(pattern, *args)
+ Dir.glob(pattern, *args).sort
+ end
+ end
+ end
+end
+
+module Rake
+ class << self
+
+ # Yield each file or directory component.
+ def each_dir_parent(dir) # :nodoc:
+ old_length = nil
+ while dir != '.' && dir.length != old_length
+ yield(dir)
+ old_length = dir.length
+ dir = File.dirname(dir)
+ end
+ end
+ end
+end # module Rake
diff --git a/lib/rake/file_task.rb b/lib/rake/file_task.rb
new file mode 100644
index 0000000000..3e717c24b7
--- /dev/null
+++ b/lib/rake/file_task.rb
@@ -0,0 +1,46 @@
+require 'rake/task.rb'
+require 'rake/early_time'
+
+module Rake
+ # #########################################################################
+ # A FileTask is a task that includes time based dependencies. If any of a
+ # FileTask's prerequisites have a timestamp that is later than the file
+ # represented by this task, then the file must be rebuilt (using the
+ # supplied actions).
+ #
+ class FileTask < Task
+
+ # Is this file task needed? Yes if it doesn't exist, or if its time stamp
+ # is out of date.
+ def needed?
+ ! File.exist?(name) || out_of_date?(timestamp)
+ end
+
+ # Time stamp for file task.
+ def timestamp
+ if File.exist?(name)
+ File.mtime(name.to_s)
+ else
+ Rake::EARLY
+ end
+ end
+
+ private
+
+ # Are there any prerequisites with a later time than the given time stamp?
+ def out_of_date?(stamp)
+ @prerequisites.any? { |n| application[n, @scope].timestamp > stamp }
+ end
+
+ # ----------------------------------------------------------------
+ # Task class methods.
+ #
+ class << self
+ # Apply the scope to the task name according to the rules for this kind
+ # of task. File based tasks ignore the scope when creating the name.
+ def scope_name(scope, task_name)
+ task_name
+ end
+ end
+ end
+end
diff --git a/lib/rake/file_utils.rb b/lib/rake/file_utils.rb
new file mode 100644
index 0000000000..0f7f459d87
--- /dev/null
+++ b/lib/rake/file_utils.rb
@@ -0,0 +1,116 @@
+require 'rbconfig'
+require 'fileutils'
+
+#--
+# This a FileUtils extension that defines several additional commands to be
+# added to the FileUtils utility functions.
+module FileUtils
+ # Path to the currently running Ruby program
+ RUBY = ENV['RUBY'] || File.join(
+ RbConfig::CONFIG['bindir'],
+ RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
+ sub(/.*\s.*/m, '"\&"')
+
+ OPT_TABLE['sh'] = %w(noop verbose)
+ OPT_TABLE['ruby'] = %w(noop verbose)
+
+ # Run the system command +cmd+. If multiple arguments are given the command
+ # is not run with the shell (same semantics as Kernel::exec and
+ # Kernel::system).
+ #
+ # Example:
+ # sh %{ls -ltr}
+ #
+ # sh 'ls', 'file with spaces'
+ #
+ # # check exit status after command runs
+ # sh %{grep pattern file} do |ok, res|
+ # if ! ok
+ # puts "pattern not found (status = #{res.exitstatus})"
+ # end
+ # end
+ #
+ def sh(*cmd, &block)
+ options = (Hash === cmd.last) ? cmd.pop : {}
+ shell_runner = block_given? ? block : create_shell_runner(cmd)
+ set_verbose_option(options)
+ options[:noop] ||= Rake::FileUtilsExt.nowrite_flag
+ Rake.rake_check_options options, :noop, :verbose
+ Rake.rake_output_message cmd.join(" ") if options[:verbose]
+
+ unless options[:noop]
+ res = rake_system(*cmd)
+ status = $?
+ status = Rake::PseudoStatus.new(1) if !res && status.nil?
+ shell_runner.call(res, status)
+ end
+ end
+
+ def create_shell_runner(cmd) # :nodoc:
+ show_command = cmd.join(" ")
+ show_command = show_command[0, 42] + "..." unless $trace
+ lambda do |ok, status|
+ ok or
+ fail "Command failed with status (#{status.exitstatus}): " +
+ "[#{show_command}]"
+ end
+ end
+ private :create_shell_runner
+
+ def set_verbose_option(options) # :nodoc:
+ unless options.key? :verbose
+ options[:verbose] =
+ (Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT) ||
+ Rake::FileUtilsExt.verbose_flag
+ end
+ end
+ private :set_verbose_option
+
+ def rake_system(*cmd) # :nodoc:
+ Rake::AltSystem.system(*cmd)
+ end
+ private :rake_system
+
+ # Run a Ruby interpreter with the given arguments.
+ #
+ # Example:
+ # ruby %{-pe '$_.upcase!' <README}
+ #
+ def ruby(*args, &block)
+ options = (Hash === args.last) ? args.pop : {}
+ if args.length > 1
+ sh(*([RUBY] + args + [options]), &block)
+ else
+ sh("#{RUBY} #{args.first}", options, &block)
+ end
+ end
+
+ LN_SUPPORTED = [true]
+
+ # Attempt to do a normal file link, but fall back to a copy if the link
+ # fails.
+ def safe_ln(*args)
+ if ! LN_SUPPORTED[0]
+ cp(*args)
+ else
+ begin
+ ln(*args)
+ rescue StandardError, NotImplementedError
+ LN_SUPPORTED[0] = false
+ cp(*args)
+ end
+ end
+ end
+
+ # Split a file path into individual directory names.
+ #
+ # Example:
+ # split_all("a/b/c") => ['a', 'b', 'c']
+ #
+ def split_all(path)
+ head, tail = File.split(path)
+ return [tail] if head == '.' || tail == '/'
+ return [head, tail] if head == '/'
+ return split_all(head) + [tail]
+ end
+end
diff --git a/lib/rake/file_utils_ext.rb b/lib/rake/file_utils_ext.rb
new file mode 100644
index 0000000000..309159aec1
--- /dev/null
+++ b/lib/rake/file_utils_ext.rb
@@ -0,0 +1,144 @@
+require 'rake/file_utils'
+
+module Rake
+ #
+ # FileUtilsExt provides a custom version of the FileUtils methods
+ # that respond to the <tt>verbose</tt> and <tt>nowrite</tt>
+ # commands.
+ #
+ module FileUtilsExt
+ include FileUtils
+
+ class << self
+ attr_accessor :verbose_flag, :nowrite_flag
+ end
+
+ DEFAULT = Object.new
+
+ FileUtilsExt.verbose_flag = DEFAULT
+ FileUtilsExt.nowrite_flag = false
+
+ FileUtils.commands.each do |name|
+ opts = FileUtils.options_of name
+ default_options = []
+ if opts.include?("verbose")
+ default_options << ':verbose => FileUtilsExt.verbose_flag'
+ end
+ if opts.include?("noop")
+ default_options << ':noop => FileUtilsExt.nowrite_flag'
+ end
+
+ next if default_options.empty?
+ module_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ def #{name}( *args, &block )
+ super(
+ *rake_merge_option(args,
+ #{default_options.join(', ')}
+ ), &block)
+ end
+ EOS
+ end
+
+ # Get/set the verbose flag controlling output from the FileUtils
+ # utilities. If verbose is true, then the utility method is
+ # echoed to standard output.
+ #
+ # Examples:
+ # verbose # return the current value of the
+ # # verbose flag
+ # verbose(v) # set the verbose flag to _v_.
+ # verbose(v) { code } # Execute code with the verbose flag set
+ # # temporarily to _v_. Return to the
+ # # original value when code is done.
+ def verbose(value=nil)
+ oldvalue = FileUtilsExt.verbose_flag
+ FileUtilsExt.verbose_flag = value unless value.nil?
+ if block_given?
+ begin
+ yield
+ ensure
+ FileUtilsExt.verbose_flag = oldvalue
+ end
+ end
+ FileUtilsExt.verbose_flag
+ end
+
+ # Get/set the nowrite flag controlling output from the FileUtils
+ # utilities. If verbose is true, then the utility method is
+ # echoed to standard output.
+ #
+ # Examples:
+ # nowrite # return the current value of the
+ # # nowrite flag
+ # nowrite(v) # set the nowrite flag to _v_.
+ # nowrite(v) { code } # Execute code with the nowrite flag set
+ # # temporarily to _v_. Return to the
+ # # original value when code is done.
+ def nowrite(value=nil)
+ oldvalue = FileUtilsExt.nowrite_flag
+ FileUtilsExt.nowrite_flag = value unless value.nil?
+ if block_given?
+ begin
+ yield
+ ensure
+ FileUtilsExt.nowrite_flag = oldvalue
+ end
+ end
+ oldvalue
+ end
+
+ # Use this function to prevent potentially destructive ruby code
+ # from running when the :nowrite flag is set.
+ #
+ # Example:
+ #
+ # when_writing("Building Project") do
+ # project.build
+ # end
+ #
+ # The following code will build the project under normal
+ # conditions. If the nowrite(true) flag is set, then the example
+ # will print:
+ #
+ # DRYRUN: Building Project
+ #
+ # instead of actually building the project.
+ #
+ def when_writing(msg=nil)
+ if FileUtilsExt.nowrite_flag
+ $stderr.puts "DRYRUN: #{msg}" if msg
+ else
+ yield
+ end
+ end
+
+ # Merge the given options with the default values.
+ def rake_merge_option(args, defaults)
+ if Hash === args.last
+ defaults.update(args.last)
+ args.pop
+ end
+ args.push defaults
+ args
+ end
+
+ # Send the message to the default rake output (which is $stderr).
+ def rake_output_message(message)
+ $stderr.puts(message)
+ end
+
+ # Check that the options do not contain options not listed in
+ # +optdecl+. An ArgumentError exception is thrown if non-declared
+ # options are found.
+ def rake_check_options(options, *optdecl)
+ h = options.dup
+ optdecl.each do |name|
+ h.delete name
+ end
+ raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless
+ h.empty?
+ end
+
+ extend self
+ end
+end
diff --git a/lib/rake/gempackagetask.rb b/lib/rake/gempackagetask.rb
new file mode 100644
index 0000000000..4ace0a6f0e
--- /dev/null
+++ b/lib/rake/gempackagetask.rb
@@ -0,0 +1,2 @@
+fail "ERROR: 'rake/gempackagetask' is obsolete and no longer supported. " +
+ "Use 'rubygems/packagetask' instead."
diff --git a/lib/rake/invocation_chain.rb b/lib/rake/invocation_chain.rb
new file mode 100644
index 0000000000..dae9a35915
--- /dev/null
+++ b/lib/rake/invocation_chain.rb
@@ -0,0 +1,57 @@
+module Rake
+
+ ####################################################################
+ # InvocationChain tracks the chain of task invocations to detect
+ # circular dependencies.
+ class InvocationChain < LinkedList
+
+ # Is the invocation already in the chain?
+ def member?(invocation)
+ head == invocation || tail.member?(invocation)
+ end
+
+ # Append an invocation to the chain of invocations. It is an error
+ # if the invocation already listed.
+ def append(invocation)
+ if member?(invocation)
+ fail RuntimeError, "Circular dependency detected: #{to_s} => #{invocation}"
+ end
+ conj(invocation)
+ end
+
+ # Convert to string, ie: TOP => invocation => invocation
+ def to_s
+ "#{prefix}#{head}"
+ end
+
+ # Class level append.
+ def self.append(invocation, chain)
+ chain.append(invocation)
+ end
+
+ private
+
+ def prefix
+ "#{tail.to_s} => "
+ end
+
+ # Null object for an empty chain.
+ class EmptyInvocationChain < LinkedList::EmptyLinkedList
+ @parent = InvocationChain
+
+ def member?(obj)
+ false
+ end
+
+ def append(invocation)
+ conj(invocation)
+ end
+
+ def to_s
+ "TOP"
+ end
+ end
+
+ EMPTY = EmptyInvocationChain.new
+ end
+end
diff --git a/lib/rake/invocation_exception_mixin.rb b/lib/rake/invocation_exception_mixin.rb
new file mode 100644
index 0000000000..84ff3353ba
--- /dev/null
+++ b/lib/rake/invocation_exception_mixin.rb
@@ -0,0 +1,16 @@
+module Rake
+ module InvocationExceptionMixin
+ # Return the invocation chain (list of Rake tasks) that were in
+ # effect when this exception was detected by rake. May be null if
+ # no tasks were active.
+ def chain
+ @rake_invocation_chain ||= nil
+ end
+
+ # Set the invocation chain in effect when this exception was
+ # detected.
+ def chain=(value)
+ @rake_invocation_chain = value
+ end
+ end
+end
diff --git a/lib/rake/lib/.document b/lib/rake/lib/.document
new file mode 100644
index 0000000000..098e64716e
--- /dev/null
+++ b/lib/rake/lib/.document
@@ -0,0 +1 @@
+# Ignore project.rake
diff --git a/lib/rake/lib/project.rake b/lib/rake/lib/project.rake
new file mode 100644
index 0000000000..a5497328a7
--- /dev/null
+++ b/lib/rake/lib/project.rake
@@ -0,0 +1,21 @@
+task "create:project" => ["lib", "test", "Rakefile"]
+
+directory "lib"
+directory "test"
+
+file "Rakefile" do
+ File.open("Rakefile", "w") do |out|
+ out.puts %{# -*- ruby -*-
+
+require 'rake/clean'
+require 'rake/testtask'
+
+task :default => :test
+
+Rake::TestTask.new do |t|
+ t.verbose = false
+ t.test_files = FileList['test/test_*.rb']
+end
+}
+ end
+end
diff --git a/lib/rake/linked_list.rb b/lib/rake/linked_list.rb
new file mode 100644
index 0000000000..26483703f4
--- /dev/null
+++ b/lib/rake/linked_list.rb
@@ -0,0 +1,103 @@
+module Rake
+
+ # Polylithic linked list structure used to implement several data
+ # structures in Rake.
+ class LinkedList
+ include Enumerable
+
+ attr_reader :head, :tail
+
+ def initialize(head, tail=EMPTY)
+ @head = head
+ @tail = tail
+ end
+
+ # Polymorphically add a new element to the head of a list. The
+ # type of head node will be the same list type has the tail.
+ def conj(item)
+ self.class.cons(item, self)
+ end
+
+ # Is the list empty?
+ def empty?
+ false
+ end
+
+ # Lists are structurally equivalent.
+ def ==(other)
+ current = self
+ while ! current.empty? && ! other.empty?
+ return false if current.head != other.head
+ current = current.tail
+ other = other.tail
+ end
+ current.empty? && other.empty?
+ end
+
+ # Convert to string: LL(item, item...)
+ def to_s
+ items = map { |item| item.to_s }.join(", ")
+ "LL(#{items})"
+ end
+
+ # Same as +to_s+, but with inspected items.
+ def inspect
+ items = map { |item| item.inspect }.join(", ")
+ "LL(#{items})"
+ end
+
+ # For each item in the list.
+ def each
+ current = self
+ while ! current.empty?
+ yield(current.head)
+ current = current.tail
+ end
+ self
+ end
+
+ # Make a list out of the given arguments. This method is
+ # polymorphic
+ def self.make(*args)
+ result = empty
+ args.reverse_each do |item|
+ result = cons(item, result)
+ end
+ result
+ end
+
+ # Cons a new head onto the tail list.
+ def self.cons(head, tail)
+ new(head, tail)
+ end
+
+ # The standard empty list class for the given LinkedList class.
+ def self.empty
+ self::EMPTY
+ end
+
+ # Represent an empty list, using the Null Object Pattern.
+ #
+ # When inheriting from the LinkedList class, you should implement
+ # a type specific Empty class as well. Make sure you set the class
+ # instance variable @parent to the assocated list class (this
+ # allows conj, cons and make to work polymorphically).
+ class EmptyLinkedList < LinkedList
+ @parent = LinkedList
+
+ def initialize
+ end
+
+ def empty?
+ true
+ end
+
+ def self.cons(head, tail)
+ @parent.cons(head, tail)
+ end
+ end
+
+ EMPTY = EmptyLinkedList.new
+ end
+
+end
diff --git a/lib/rake/loaders/makefile.rb b/lib/rake/loaders/makefile.rb
new file mode 100644
index 0000000000..4ece4323af
--- /dev/null
+++ b/lib/rake/loaders/makefile.rb
@@ -0,0 +1,40 @@
+module Rake
+
+ # Makefile loader to be used with the import file loader.
+ class MakefileLoader
+ include Rake::DSL
+
+ SPACE_MARK = "\0"
+
+ # Load the makefile dependencies in +fn+.
+ def load(fn)
+ lines = File.read fn
+ lines.gsub!(/\\ /, SPACE_MARK)
+ lines.gsub!(/#[^\n]*\n/m, "")
+ lines.gsub!(/\\\n/, ' ')
+ lines.each_line do |line|
+ process_line(line)
+ end
+ end
+
+ private
+
+ # Process one logical line of makefile data.
+ def process_line(line)
+ file_tasks, args = line.split(':', 2)
+ return if args.nil?
+ dependents = args.split.map { |d| respace(d) }
+ file_tasks.scan(/\S+/) do |file_task|
+ file_task = respace(file_task)
+ file file_task => dependents
+ end
+ end
+
+ def respace(str)
+ str.tr SPACE_MARK, ' '
+ end
+ end
+
+ # Install the handler
+ Rake.application.add_loader('mf', MakefileLoader.new)
+end
diff --git a/lib/rake/multi_task.rb b/lib/rake/multi_task.rb
new file mode 100644
index 0000000000..5418a7a7b0
--- /dev/null
+++ b/lib/rake/multi_task.rb
@@ -0,0 +1,13 @@
+module Rake
+
+ # Same as a regular task, but the immediate prerequisites are done in
+ # parallel using Ruby threads.
+ #
+ class MultiTask < Task
+ private
+ def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
+ invoke_prerequisites_concurrently(task_args, invocation_chain)
+ end
+ end
+
+end
diff --git a/lib/rake/name_space.rb b/lib/rake/name_space.rb
new file mode 100644
index 0000000000..e1cc0940b8
--- /dev/null
+++ b/lib/rake/name_space.rb
@@ -0,0 +1,25 @@
+module Rake
+
+ # The NameSpace class will lookup task names in the the scope
+ # defined by a +namespace+ command.
+ #
+ class NameSpace
+
+ # Create a namespace lookup object using the given task manager
+ # and the list of scopes.
+ def initialize(task_manager, scope_list)
+ @task_manager = task_manager
+ @scope = scope_list.dup
+ end
+
+ # Lookup a task named +name+ in the namespace.
+ def [](name)
+ @task_manager.lookup(name, @scope)
+ end
+
+ # Return the list of tasks defined in this and nested namespaces.
+ def tasks
+ @task_manager.tasks_in_scope(@scope)
+ end
+ end
+end
diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb
new file mode 100644
index 0000000000..029caa6d49
--- /dev/null
+++ b/lib/rake/packagetask.rb
@@ -0,0 +1,190 @@
+# Define a package task library to aid in the definition of
+# redistributable package files.
+
+require 'rake'
+require 'rake/tasklib'
+
+module Rake
+
+ # Create a packaging task that will package the project into
+ # distributable files (e.g zip archive or tar files).
+ #
+ # The PackageTask will create the following targets:
+ #
+ # [<b>:package</b>]
+ # Create all the requested package files.
+ #
+ # [<b>:clobber_package</b>]
+ # Delete all the package files. This target is automatically
+ # added to the main clobber target.
+ #
+ # [<b>:repackage</b>]
+ # Rebuild the package files from scratch, even if they are not out
+ # of date.
+ #
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</b>]
+ # Create a gzipped tar package (if <em>need_tar</em> is true).
+ #
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</b>]
+ # Create a gzipped tar package (if <em>need_tar_gz</em> is true).
+ #
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</b>]
+ # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true).
+ #
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</b>]
+ # Create a zip package archive (if <em>need_zip</em> is true).
+ #
+ # Example:
+ #
+ # Rake::PackageTask.new("rake", "1.2.3") do |p|
+ # p.need_tar = true
+ # p.package_files.include("lib/**/*.rb")
+ # end
+ #
+ class PackageTask < TaskLib
+ # Name of the package (from the GEM Spec).
+ attr_accessor :name
+
+ # Version of the package (e.g. '1.3.2').
+ attr_accessor :version
+
+ # Directory used to store the package files (default is 'pkg').
+ attr_accessor :package_dir
+
+ # True if a gzipped tar file (tgz) should be produced (default is
+ # false).
+ attr_accessor :need_tar
+
+ # True if a gzipped tar file (tar.gz) should be produced (default
+ # is false).
+ attr_accessor :need_tar_gz
+
+ # True if a bzip2'd tar file (tar.bz2) should be produced (default
+ # is false).
+ attr_accessor :need_tar_bz2
+
+ # True if a zip file should be produced (default is false)
+ attr_accessor :need_zip
+
+ # List of files to be included in the package.
+ attr_accessor :package_files
+
+ # Tar command for gzipped or bzip2ed archives. The default is 'tar'.
+ attr_accessor :tar_command
+
+ # Zip command for zipped archives. The default is 'zip'.
+ attr_accessor :zip_command
+
+ # Create a Package Task with the given name and version. Use +:noversion+
+ # as the version to build a package without a version or to provide a
+ # fully-versioned package name.
+
+ def initialize(name=nil, version=nil)
+ init(name, version)
+ yield self if block_given?
+ define unless name.nil?
+ end
+
+ # Initialization that bypasses the "yield self" and "define" step.
+ def init(name, version)
+ @name = name
+ @version = version
+ @package_files = Rake::FileList.new
+ @package_dir = 'pkg'
+ @need_tar = false
+ @need_tar_gz = false
+ @need_tar_bz2 = false
+ @need_zip = false
+ @tar_command = 'tar'
+ @zip_command = 'zip'
+ end
+
+ # Create the tasks defined by this task library.
+ def define
+ fail "Version required (or :noversion)" if @version.nil?
+ @version = nil if :noversion == @version
+
+ desc "Build all the packages"
+ task :package
+
+ desc "Force a rebuild of the package files"
+ task :repackage => [:clobber_package, :package]
+
+ desc "Remove package products"
+ task :clobber_package do
+ rm_r package_dir rescue nil
+ end
+
+ task :clobber => [:clobber_package]
+
+ [
+ [need_tar, tgz_file, "z"],
+ [need_tar_gz, tar_gz_file, "z"],
+ [need_tar_bz2, tar_bz2_file, "j"]
+ ].each do |(need, file, flag)|
+ if need
+ task :package => ["#{package_dir}/#{file}"]
+ file "#{package_dir}/#{file}" =>
+ [package_dir_path] + package_files do
+ chdir(package_dir) do
+ sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}}
+ end
+ end
+ end
+ end
+
+ if need_zip
+ task :package => ["#{package_dir}/#{zip_file}"]
+ file "#{package_dir}/#{zip_file}" =>
+ [package_dir_path] + package_files do
+ chdir(package_dir) do
+ sh %{#{@zip_command} -r #{zip_file} #{package_name}}
+ end
+ end
+ end
+
+ directory package_dir
+
+ file package_dir_path => @package_files do
+ mkdir_p package_dir rescue nil
+ @package_files.each do |fn|
+ f = File.join(package_dir_path, fn)
+ fdir = File.dirname(f)
+ mkdir_p(fdir) unless File.exist?(fdir)
+ if File.directory?(fn)
+ mkdir_p(f)
+ else
+ rm_f f
+ safe_ln(fn, f)
+ end
+ end
+ end
+ self
+ end
+
+ def package_name
+ @version ? "#{@name}-#{@version}" : @name
+ end
+
+ def package_dir_path
+ "#{package_dir}/#{package_name}"
+ end
+
+ def tgz_file
+ "#{package_name}.tgz"
+ end
+
+ def tar_gz_file
+ "#{package_name}.tar.gz"
+ end
+
+ def tar_bz2_file
+ "#{package_name}.tar.bz2"
+ end
+
+ def zip_file
+ "#{package_name}.zip"
+ end
+ end
+
+end
diff --git a/lib/rake/pathmap.rb b/lib/rake/pathmap.rb
new file mode 100644
index 0000000000..2275724341
--- /dev/null
+++ b/lib/rake/pathmap.rb
@@ -0,0 +1 @@
+require 'rake/ext/string'
diff --git a/lib/rake/phony.rb b/lib/rake/phony.rb
new file mode 100644
index 0000000000..29633ae066
--- /dev/null
+++ b/lib/rake/phony.rb
@@ -0,0 +1,15 @@
+# Defines a :phony task that you can use as a dependency. This allows
+# file-based tasks to use non-file-based tasks as prerequisites
+# without forcing them to rebuild.
+#
+# See FileTask#out_of_date? and Task#timestamp for more info.
+
+require 'rake'
+
+task :phony
+
+Rake::Task[:phony].tap do |task|
+ def task.timestamp # :nodoc:
+ Time.at 0
+ end
+end
diff --git a/lib/rake/private_reader.rb b/lib/rake/private_reader.rb
new file mode 100644
index 0000000000..1620978576
--- /dev/null
+++ b/lib/rake/private_reader.rb
@@ -0,0 +1,20 @@
+module Rake
+
+ # Include PrivateReader to use +private_reader+.
+ module PrivateReader # :nodoc: all
+
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+
+ # Declare a list of private accessors
+ def private_reader(*names)
+ attr_reader(*names)
+ private(*names)
+ end
+ end
+
+ end
+end
diff --git a/lib/rake/promise.rb b/lib/rake/promise.rb
new file mode 100644
index 0000000000..31c4563476
--- /dev/null
+++ b/lib/rake/promise.rb
@@ -0,0 +1,99 @@
+module Rake
+
+ # A Promise object represents a promise to do work (a chore) in the
+ # future. The promise is created with a block and a list of
+ # arguments for the block. Calling value will return the value of
+ # the promised chore.
+ #
+ # Used by ThreadPool.
+ #
+ class Promise # :nodoc: all
+ NOT_SET = Object.new.freeze # :nodoc:
+
+ attr_accessor :recorder
+
+ # Create a promise to do the chore specified by the block.
+ def initialize(args, &block)
+ @mutex = Mutex.new
+ @result = NOT_SET
+ @error = NOT_SET
+ @args = args
+ @block = block
+ end
+
+ # Return the value of this promise.
+ #
+ # If the promised chore is not yet complete, then do the work
+ # synchronously. We will wait.
+ def value
+ unless complete?
+ stat :sleeping_on, :item_id => object_id
+ @mutex.synchronize do
+ stat :has_lock_on, :item_id => object_id
+ chore
+ stat :releasing_lock_on, :item_id => object_id
+ end
+ end
+ error? ? raise(@error) : @result
+ end
+
+ # If no one else is working this promise, go ahead and do the chore.
+ def work
+ stat :attempting_lock_on, :item_id => object_id
+ if @mutex.try_lock
+ stat :has_lock_on, :item_id => object_id
+ chore
+ stat :releasing_lock_on, :item_id => object_id
+ @mutex.unlock
+ else
+ stat :bailed_on, :item_id => object_id
+ end
+ end
+
+ private
+
+ # Perform the chore promised
+ def chore
+ if complete?
+ stat :found_completed, :item_id => object_id
+ return
+ end
+ stat :will_execute, :item_id => object_id
+ begin
+ @result = @block.call(*@args)
+ rescue Exception => e
+ @error = e
+ end
+ stat :did_execute, :item_id => object_id
+ discard
+ end
+
+ # Do we have a result for the promise
+ def result?
+ ! @result.equal?(NOT_SET)
+ end
+
+ # Did the promise throw an error
+ def error?
+ ! @error.equal?(NOT_SET)
+ end
+
+ # Are we done with the promise
+ def complete?
+ result? || error?
+ end
+
+ # free up these items for the GC
+ def discard
+ @args = nil
+ @block = nil
+ end
+
+ # Record execution statistics if there is a recorder
+ def stat(*args)
+ @recorder.call(*args) if @recorder
+ end
+
+ end
+
+end
diff --git a/lib/rake/pseudo_status.rb b/lib/rake/pseudo_status.rb
new file mode 100644
index 0000000000..09d5c88c7e
--- /dev/null
+++ b/lib/rake/pseudo_status.rb
@@ -0,0 +1,29 @@
+module Rake
+
+ ####################################################################
+ # Exit status class for times the system just gives us a nil.
+ class PseudoStatus
+ attr_reader :exitstatus
+
+ def initialize(code=0)
+ @exitstatus = code
+ end
+
+ def to_i
+ @exitstatus << 8
+ end
+
+ def >>(n)
+ to_i >> n
+ end
+
+ def stopped?
+ false
+ end
+
+ def exited?
+ true
+ end
+ end
+
+end
diff --git a/lib/rake/rake_module.rb b/lib/rake/rake_module.rb
new file mode 100644
index 0000000000..fcf5800064
--- /dev/null
+++ b/lib/rake/rake_module.rb
@@ -0,0 +1,37 @@
+require 'rake/application'
+
+module Rake
+
+ # Rake module singleton methods.
+ #
+ class << self
+ # Current Rake Application
+ def application
+ @application ||= Rake::Application.new
+ end
+
+ # Set the current Rake application object.
+ def application=(app)
+ @application = app
+ end
+
+ # Return the original directory where the Rake application was started.
+ def original_dir
+ application.original_dir
+ end
+
+ # Load a rakefile.
+ def load_rakefile(path)
+ load(path)
+ end
+
+ # Add files to the rakelib list
+ def add_rakelib(*files)
+ application.options.rakelib ||= []
+ files.each do |file|
+ application.options.rakelib << file
+ end
+ end
+ end
+
+end
diff --git a/lib/rake/rake_test_loader.rb b/lib/rake/rake_test_loader.rb
new file mode 100644
index 0000000000..7e3a6b3f35
--- /dev/null
+++ b/lib/rake/rake_test_loader.rb
@@ -0,0 +1,22 @@
+require 'rake'
+
+# Load the test files from the command line.
+argv = ARGV.select do |argument|
+ case argument
+ when /^-/ then
+ argument
+ when /\*/ then
+ FileList[argument].to_a.each do |file|
+ require File.expand_path file
+ end
+
+ false
+ else
+ require File.expand_path argument
+
+ false
+ end
+end
+
+ARGV.replace argv
+
diff --git a/lib/rake/rdoctask.rb b/lib/rake/rdoctask.rb
new file mode 100644
index 0000000000..50b7e269d5
--- /dev/null
+++ b/lib/rake/rdoctask.rb
@@ -0,0 +1,2 @@
+fail "ERROR: 'rake/rdoctask' is obsolete and no longer supported. " +
+ "Use 'rdoc/task' (available in RDoc 2.4.2+) instead."
diff --git a/lib/rake/ruby182_test_unit_fix.rb b/lib/rake/ruby182_test_unit_fix.rb
new file mode 100644
index 0000000000..e47feeb09c
--- /dev/null
+++ b/lib/rake/ruby182_test_unit_fix.rb
@@ -0,0 +1,27 @@
+# Local Rake override to fix bug in Ruby 0.8.2
+module Test # :nodoc:
+ # Local Rake override to fix bug in Ruby 0.8.2
+ module Unit # :nodoc:
+ # Local Rake override to fix bug in Ruby 0.8.2
+ module Collector # :nodoc:
+ # Local Rake override to fix bug in Ruby 0.8.2
+ class Dir # :nodoc:
+ undef collect_file
+ def collect_file(name, suites, already_gathered) # :nodoc:
+ dir = File.dirname(File.expand_path(name))
+ $:.unshift(dir) unless $:.first == dir
+ if @req
+ @req.require(name)
+ else
+ require(name)
+ end
+ find_test_cases(already_gathered).each do |t|
+ add_suite(suites, t.suite)
+ end
+ ensure
+ $:.delete_at $:.rindex(dir)
+ end
+ end
+ end
+ end
+end
diff --git a/lib/rake/rule_recursion_overflow_error.rb b/lib/rake/rule_recursion_overflow_error.rb
new file mode 100644
index 0000000000..da4318da9d
--- /dev/null
+++ b/lib/rake/rule_recursion_overflow_error.rb
@@ -0,0 +1,20 @@
+
+module Rake
+
+ # Error indicating a recursion overflow error in task selection.
+ class RuleRecursionOverflowError < StandardError
+ def initialize(*args)
+ super
+ @targets = []
+ end
+
+ def add_target(target)
+ @targets << target
+ end
+
+ def message
+ super + ": [" + @targets.reverse.join(' => ') + "]"
+ end
+ end
+
+end
diff --git a/lib/rake/runtest.rb b/lib/rake/runtest.rb
new file mode 100644
index 0000000000..3f01b28cad
--- /dev/null
+++ b/lib/rake/runtest.rb
@@ -0,0 +1,22 @@
+require 'test/unit'
+require 'test/unit/assertions'
+require 'rake/file_list'
+
+module Rake
+ include Test::Unit::Assertions
+
+ def run_tests(pattern='test/test*.rb', log_enabled=false)
+ FileList.glob(pattern).each do |fn|
+ $stderr.puts fn if log_enabled
+ begin
+ require fn
+ rescue Exception => ex
+ $stderr.puts "Error in #{fn}: #{ex.message}"
+ $stderr.puts ex.backtrace
+ assert false
+ end
+ end
+ end
+
+ extend self
+end
diff --git a/lib/rake/scope.rb b/lib/rake/scope.rb
new file mode 100644
index 0000000000..33e1c08e7b
--- /dev/null
+++ b/lib/rake/scope.rb
@@ -0,0 +1,42 @@
+module Rake
+ class Scope < LinkedList
+
+ # Path for the scope.
+ def path
+ map { |item| item.to_s }.reverse.join(":")
+ end
+
+ # Path for the scope + the named path.
+ def path_with_task_name(task_name)
+ "#{path}:#{task_name}"
+ end
+
+ # Trim +n+ innermost scope levels from the scope. In no case will
+ # this trim beyond the toplevel scope.
+ def trim(n)
+ result = self
+ while n > 0 && ! result.empty?
+ result = result.tail
+ n -= 1
+ end
+ result
+ end
+
+ # Scope lists always end with an EmptyScope object. See Null
+ # Object Pattern)
+ class EmptyScope < EmptyLinkedList
+ @parent = Scope
+
+ def path
+ ""
+ end
+
+ def path_with_task_name(task_name)
+ task_name
+ end
+ end
+
+ # Singleton null object for an empty scope.
+ EMPTY = EmptyScope.new
+ end
+end
diff --git a/lib/rake/task.rb b/lib/rake/task.rb
new file mode 100644
index 0000000000..5e4dd64d4e
--- /dev/null
+++ b/lib/rake/task.rb
@@ -0,0 +1,378 @@
+require 'rake/invocation_exception_mixin'
+
+module Rake
+
+ # #########################################################################
+ # A Task is the basic unit of work in a Rakefile. Tasks have associated
+ # actions (possibly more than one) and a list of prerequisites. When
+ # invoked, a task will first ensure that all of its prerequisites have an
+ # opportunity to run and then it will execute its own actions.
+ #
+ # Tasks are not usually created directly using the new method, but rather
+ # use the +file+ and +task+ convenience methods.
+ #
+ class Task
+ # List of prerequisites for a task.
+ attr_reader :prerequisites
+
+ # List of actions attached to a task.
+ attr_reader :actions
+
+ # Application owning this task.
+ attr_accessor :application
+
+ # Array of nested namespaces names used for task lookup by this task.
+ attr_reader :scope
+
+ # File/Line locations of each of the task definitions for this
+ # task (only valid if the task was defined with the detect
+ # location option set).
+ attr_reader :locations
+
+ # Return task name
+ def to_s
+ name
+ end
+
+ def inspect
+ "<#{self.class} #{name} => [#{prerequisites.join(', ')}]>"
+ end
+
+ # List of sources for task.
+ attr_writer :sources
+ def sources
+ @sources ||= []
+ end
+
+ # List of prerequisite tasks
+ def prerequisite_tasks
+ prerequisites.map { |pre| lookup_prerequisite(pre) }
+ end
+
+ def lookup_prerequisite(prerequisite_name)
+ application[prerequisite_name, @scope]
+ end
+ private :lookup_prerequisite
+
+ # List of all unique prerequisite tasks including prerequisite tasks'
+ # prerequisites.
+ # Includes self when cyclic dependencies are found.
+ def all_prerequisite_tasks
+ seen = {}
+ collect_prerequisites(seen)
+ seen.values
+ end
+
+ def collect_prerequisites(seen)
+ prerequisite_tasks.each do |pre|
+ next if seen[pre.name]
+ seen[pre.name] = pre
+ pre.collect_prerequisites(seen)
+ end
+ end
+ protected :collect_prerequisites
+
+ # First source from a rule (nil if no sources)
+ def source
+ @sources.first if defined?(@sources)
+ end
+
+ # Create a task named +task_name+ with no actions or prerequisites. Use
+ # +enhance+ to add actions and prerequisites.
+ def initialize(task_name, app)
+ @name = task_name.to_s
+ @prerequisites = []
+ @actions = []
+ @already_invoked = false
+ @comments = []
+ @lock = Monitor.new
+ @application = app
+ @scope = app.current_scope
+ @arg_names = nil
+ @locations = []
+ end
+
+ # Enhance a task with prerequisites or actions. Returns self.
+ def enhance(deps=nil, &block)
+ @prerequisites |= deps if deps
+ @actions << block if block_given?
+ self
+ end
+
+ # Name of the task, including any namespace qualifiers.
+ def name
+ @name.to_s
+ end
+
+ # Name of task with argument list description.
+ def name_with_args # :nodoc:
+ if arg_description
+ "#{name}#{arg_description}"
+ else
+ name
+ end
+ end
+
+ # Argument description (nil if none).
+ def arg_description # :nodoc:
+ @arg_names ? "[#{arg_names.join(',')}]" : nil
+ end
+
+ # Name of arguments for this task.
+ def arg_names
+ @arg_names || []
+ end
+
+ # Reenable the task, allowing its tasks to be executed if the task
+ # is invoked again.
+ def reenable
+ @already_invoked = false
+ end
+
+ # Clear the existing prerequisites and actions of a rake task.
+ def clear
+ clear_prerequisites
+ clear_actions
+ clear_comments
+ self
+ end
+
+ # Clear the existing prerequisites of a rake task.
+ def clear_prerequisites
+ prerequisites.clear
+ self
+ end
+
+ # Clear the existing actions on a rake task.
+ def clear_actions
+ actions.clear
+ self
+ end
+
+ # Clear the existing comments on a rake task.
+ def clear_comments
+ @comments = []
+ self
+ end
+
+ # Invoke the task if it is needed. Prerequisites are invoked first.
+ def invoke(*args)
+ task_args = TaskArguments.new(arg_names, args)
+ invoke_with_call_chain(task_args, InvocationChain::EMPTY)
+ end
+
+ # Same as invoke, but explicitly pass a call chain to detect
+ # circular dependencies.
+ def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
+ new_chain = InvocationChain.append(self, invocation_chain)
+ @lock.synchronize do
+ if application.options.trace
+ application.trace "** Invoke #{name} #{format_trace_flags}"
+ end
+ return if @already_invoked
+ @already_invoked = true
+ invoke_prerequisites(task_args, new_chain)
+ execute(task_args) if needed?
+ end
+ rescue Exception => ex
+ add_chain_to(ex, new_chain)
+ raise ex
+ end
+ protected :invoke_with_call_chain
+
+ def add_chain_to(exception, new_chain)
+ exception.extend(InvocationExceptionMixin) unless
+ exception.respond_to?(:chain)
+ exception.chain = new_chain if exception.chain.nil?
+ end
+ private :add_chain_to
+
+ # Invoke all the prerequisites of a task.
+ def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
+ if application.options.always_multitask
+ invoke_prerequisites_concurrently(task_args, invocation_chain)
+ else
+ prerequisite_tasks.each { |p|
+ prereq_args = task_args.new_scope(p.arg_names)
+ p.invoke_with_call_chain(prereq_args, invocation_chain)
+ }
+ end
+ end
+
+ # Invoke all the prerequisites of a task in parallel.
+ def invoke_prerequisites_concurrently(task_args, invocation_chain)# :nodoc:
+ futures = prerequisite_tasks.map do |p|
+ prereq_args = task_args.new_scope(p.arg_names)
+ application.thread_pool.future(p) do |r|
+ r.invoke_with_call_chain(prereq_args, invocation_chain)
+ end
+ end
+ futures.each { |f| f.value }
+ end
+
+ # Format the trace flags for display.
+ def format_trace_flags
+ flags = []
+ flags << "first_time" unless @already_invoked
+ flags << "not_needed" unless needed?
+ flags.empty? ? "" : "(" + flags.join(", ") + ")"
+ end
+ private :format_trace_flags
+
+ # Execute the actions associated with this task.
+ def execute(args=nil)
+ args ||= EMPTY_TASK_ARGS
+ if application.options.dryrun
+ application.trace "** Execute (dry run) #{name}"
+ return
+ end
+ application.trace "** Execute #{name}" if application.options.trace
+ application.enhance_with_matching_rule(name) if @actions.empty?
+ @actions.each do |act|
+ case act.arity
+ when 1
+ act.call(self)
+ else
+ act.call(self, args)
+ end
+ end
+ end
+
+ # Is this task needed?
+ def needed?
+ true
+ end
+
+ # Timestamp for this task. Basic tasks return the current time for their
+ # time stamp. Other tasks can be more sophisticated.
+ def timestamp
+ Time.now
+ end
+
+ # Add a description to the task. The description can consist of an option
+ # argument list (enclosed brackets) and an optional comment.
+ def add_description(description)
+ return unless description
+ comment = description.strip
+ add_comment(comment) if comment && ! comment.empty?
+ end
+
+ def comment=(comment)
+ add_comment(comment)
+ end
+
+ def add_comment(comment)
+ @comments << comment unless @comments.include?(comment)
+ end
+ private :add_comment
+
+ # Full collection of comments. Multiple comments are separated by
+ # newlines.
+ def full_comment
+ transform_comments("\n")
+ end
+
+ # First line (or sentence) of all comments. Multiple comments are
+ # separated by a "/".
+ def comment
+ transform_comments(" / ") { |c| first_sentence(c) }
+ end
+
+ # Transform the list of comments as specified by the block and
+ # join with the separator.
+ def transform_comments(separator, &block)
+ if @comments.empty?
+ nil
+ else
+ block ||= lambda { |c| c }
+ @comments.map(&block).join(separator)
+ end
+ end
+ private :transform_comments
+
+ # Get the first sentence in a string. The sentence is terminated
+ # by the first period or the end of the line. Decimal points do
+ # not count as periods.
+ def first_sentence(string)
+ string.split(/\.[ \t]|\.$|\n/).first
+ end
+ private :first_sentence
+
+ # Set the names of the arguments for this task. +args+ should be
+ # an array of symbols, one for each argument name.
+ def set_arg_names(args)
+ @arg_names = args.map { |a| a.to_sym }
+ end
+
+ # Return a string describing the internal state of a task. Useful for
+ # debugging.
+ def investigation
+ result = "------------------------------\n"
+ result << "Investigating #{name}\n"
+ result << "class: #{self.class}\n"
+ result << "task needed: #{needed?}\n"
+ result << "timestamp: #{timestamp}\n"
+ result << "pre-requisites: \n"
+ prereqs = prerequisite_tasks
+ prereqs.sort! { |a, b| a.timestamp <=> b.timestamp }
+ prereqs.each do |p|
+ result << "--#{p.name} (#{p.timestamp})\n"
+ end
+ latest_prereq = prerequisite_tasks.map { |pre| pre.timestamp }.max
+ result << "latest-prerequisite time: #{latest_prereq}\n"
+ result << "................................\n\n"
+ return result
+ end
+
+ # ----------------------------------------------------------------
+ # Rake Module Methods
+ #
+ class << self
+
+ # Clear the task list. This cause rake to immediately forget all the
+ # tasks that have been assigned. (Normally used in the unit tests.)
+ def clear
+ Rake.application.clear
+ end
+
+ # List of all defined tasks.
+ def tasks
+ Rake.application.tasks
+ end
+
+ # Return a task with the given name. If the task is not currently
+ # known, try to synthesize one from the defined rules. If no rules are
+ # found, but an existing file matches the task name, assume it is a file
+ # task with no dependencies or actions.
+ def [](task_name)
+ Rake.application[task_name]
+ end
+
+ # TRUE if the task name is already defined.
+ def task_defined?(task_name)
+ Rake.application.lookup(task_name) != nil
+ end
+
+ # Define a task given +args+ and an option block. If a rule with the
+ # given name already exists, the prerequisites and actions are added to
+ # the existing task. Returns the defined task.
+ def define_task(*args, &block)
+ Rake.application.define_task(self, *args, &block)
+ end
+
+ # Define a rule for synthesizing tasks.
+ def create_rule(*args, &block)
+ Rake.application.create_rule(*args, &block)
+ end
+
+ # Apply the scope to the task name according to the rules for
+ # this kind of task. Generic tasks will accept the scope as
+ # part of the name.
+ def scope_name(scope, task_name)
+# (scope + [task_name]).join(':')
+ scope.path_with_task_name(task_name)
+ end
+
+ end # class << Rake::Task
+ end # class Rake::Task
+end
diff --git a/lib/rake/task_argument_error.rb b/lib/rake/task_argument_error.rb
new file mode 100644
index 0000000000..3e1dda64db
--- /dev/null
+++ b/lib/rake/task_argument_error.rb
@@ -0,0 +1,7 @@
+module Rake
+
+ # Error indicating an ill-formed task declaration.
+ class TaskArgumentError < ArgumentError
+ end
+
+end
diff --git a/lib/rake/task_arguments.rb b/lib/rake/task_arguments.rb
new file mode 100644
index 0000000000..0094682579
--- /dev/null
+++ b/lib/rake/task_arguments.rb
@@ -0,0 +1,89 @@
+module Rake
+
+ ####################################################################
+ # TaskArguments manage the arguments passed to a task.
+ #
+ class TaskArguments
+ include Enumerable
+
+ attr_reader :names
+
+ # Create a TaskArgument object with a list of named arguments
+ # (given by :names) and a set of associated values (given by
+ # :values). :parent is the parent argument object.
+ def initialize(names, values, parent=nil)
+ @names = names
+ @parent = parent
+ @hash = {}
+ @values = values
+ names.each_with_index { |name, i|
+ @hash[name.to_sym] = values[i] unless values[i].nil?
+ }
+ end
+
+ # Retrive the complete array of sequential values
+ def to_a
+ @values.dup
+ end
+
+ # Retrive the list of values not associated with named arguments
+ def extras
+ @values[@names.length..-1] || []
+ end
+
+ # Create a new argument scope using the prerequisite argument
+ # names.
+ def new_scope(names)
+ values = names.map { |n| self[n] }
+ self.class.new(names, values + extras, self)
+ end
+
+ # Find an argument value by name or index.
+ def [](index)
+ lookup(index.to_sym)
+ end
+
+ # Specify a hash of default values for task arguments. Use the
+ # defaults only if there is no specific value for the given
+ # argument.
+ def with_defaults(defaults)
+ @hash = defaults.merge(@hash)
+ end
+
+ def each(&block)
+ @hash.each(&block)
+ end
+
+ def values_at(*keys)
+ keys.map { |k| lookup(k) }
+ end
+
+ def method_missing(sym, *args)
+ lookup(sym.to_sym)
+ end
+
+ def to_hash
+ @hash
+ end
+
+ def to_s
+ @hash.inspect
+ end
+
+ def inspect
+ to_s
+ end
+
+ protected
+
+ def lookup(name)
+ if @hash.has_key?(name)
+ @hash[name]
+ elsif @parent
+ @parent.lookup(name)
+ end
+ end
+ end
+
+ EMPTY_TASK_ARGS = TaskArguments.new([], [])
+end
diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb
new file mode 100644
index 0000000000..06c243a7b2
--- /dev/null
+++ b/lib/rake/task_manager.rb
@@ -0,0 +1,297 @@
+module Rake
+
+ # The TaskManager module is a mixin for managing tasks.
+ module TaskManager
+ # Track the last comment made in the Rakefile.
+ attr_accessor :last_description
+ alias :last_comment :last_description # Backwards compatibility
+
+ def initialize
+ super
+ @tasks = Hash.new
+ @rules = Array.new
+ @scope = Scope.make
+ @last_description = nil
+ end
+
+ def create_rule(*args, &block)
+ pattern, args, deps = resolve_args(args)
+ pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
+ @rules << [pattern, args, deps, block]
+ end
+
+ def define_task(task_class, *args, &block)
+ task_name, arg_names, deps = resolve_args(args)
+ task_name = task_class.scope_name(@scope, task_name)
+ deps = [deps] unless deps.respond_to?(:to_ary)
+ deps = deps.map { |d| d.to_s }
+ task = intern(task_class, task_name)
+ task.set_arg_names(arg_names) unless arg_names.empty?
+ if Rake::TaskManager.record_task_metadata
+ add_location(task)
+ task.add_description(get_description(task))
+ end
+ task.enhance(deps, &block)
+ end
+
+ # Lookup a task. Return an existing task if found, otherwise
+ # create a task of the current type.
+ def intern(task_class, task_name)
+ @tasks[task_name.to_s] ||= task_class.new(task_name, self)
+ end
+
+ # Find a matching task for +task_name+.
+ def [](task_name, scopes=nil)
+ task_name = task_name.to_s
+ self.lookup(task_name, scopes) or
+ enhance_with_matching_rule(task_name) or
+ synthesize_file_task(task_name) or
+ fail "Don't know how to build task '#{task_name}'"
+ end
+
+ def synthesize_file_task(task_name)
+ return nil unless File.exist?(task_name)
+ define_task(Rake::FileTask, task_name)
+ end
+
+ # Resolve the arguments for a task/rule. Returns a triplet of
+ # [task_name, arg_name_list, prerequisites].
+ def resolve_args(args)
+ if args.last.is_a?(Hash)
+ deps = args.pop
+ resolve_args_with_dependencies(args, deps)
+ else
+ resolve_args_without_dependencies(args)
+ end
+ end
+
+ # Resolve task arguments for a task or rule when there are no
+ # dependencies declared.
+ #
+ # The patterns recognized by this argument resolving function are:
+ #
+ # task :t
+ # task :t, [:a]
+ #
+ def resolve_args_without_dependencies(args)
+ task_name = args.shift
+ if args.size == 1 && args.first.respond_to?(:to_ary)
+ arg_names = args.first.to_ary
+ else
+ arg_names = args
+ end
+ [task_name, arg_names, []]
+ end
+ private :resolve_args_without_dependencies
+
+ # Resolve task arguments for a task or rule when there are
+ # dependencies declared.
+ #
+ # The patterns recognized by this argument resolving function are:
+ #
+ # task :t => [:d]
+ # task :t, [a] => [:d]
+ #
+ def resolve_args_with_dependencies(args, hash) # :nodoc:
+ fail "Task Argument Error" if hash.size != 1
+ key, value = hash.map { |k, v| [k, v] }.first
+ if args.empty?
+ task_name = key
+ arg_names = []
+ deps = value
+ else
+ task_name = args.shift
+ arg_names = key
+ deps = value
+ end
+ deps = [deps] unless deps.respond_to?(:to_ary)
+ [task_name, arg_names, deps]
+ end
+ private :resolve_args_with_dependencies
+
+ # If a rule can be found that matches the task name, enhance the
+ # task with the prerequisites and actions from the rule. Set the
+ # source attribute of the task appropriately for the rule. Return
+ # the enhanced task or nil of no rule was found.
+ def enhance_with_matching_rule(task_name, level=0)
+ fail Rake::RuleRecursionOverflowError,
+ "Rule Recursion Too Deep" if level >= 16
+ @rules.each do |pattern, args, extensions, block|
+ if pattern.match(task_name)
+ task = attempt_rule(task_name, args, extensions, block, level)
+ return task if task
+ end
+ end
+ nil
+ rescue Rake::RuleRecursionOverflowError => ex
+ ex.add_target(task_name)
+ fail ex
+ end
+
+ # List of all defined tasks in this application.
+ def tasks
+ @tasks.values.sort_by { |t| t.name }
+ end
+
+ # List of all the tasks defined in the given scope (and its
+ # sub-scopes).
+ def tasks_in_scope(scope)
+ prefix = scope.path
+ tasks.select { |t|
+ /^#{prefix}:/ =~ t.name
+ }
+ end
+
+ # Clear all tasks in this application.
+ def clear
+ @tasks.clear
+ @rules.clear
+ end
+
+ # Lookup a task, using scope and the scope hints in the task name.
+ # This method performs straight lookups without trying to
+ # synthesize file tasks or rules. Special scope names (e.g. '^')
+ # are recognized. If no scope argument is supplied, use the
+ # current scope. Return nil if the task cannot be found.
+ def lookup(task_name, initial_scope=nil)
+ initial_scope ||= @scope
+ task_name = task_name.to_s
+ if task_name =~ /^rake:/
+ scopes = Scope.make
+ task_name = task_name.sub(/^rake:/, '')
+ elsif task_name =~ /^(\^+)/
+ scopes = initial_scope.trim($1.size)
+ task_name = task_name.sub(/^(\^+)/, '')
+ else
+ scopes = initial_scope
+ end
+ lookup_in_scope(task_name, scopes)
+ end
+
+ # Lookup the task name
+ def lookup_in_scope(name, scope)
+ loop do
+ tn = scope.path_with_task_name(name)
+ task = @tasks[tn]
+ return task if task
+ break if scope.empty?
+ scope = scope.tail
+ end
+ nil
+ end
+ private :lookup_in_scope
+
+ # Return the list of scope names currently active in the task
+ # manager.
+ def current_scope
+ @scope
+ end
+
+ # Evaluate the block in a nested namespace named +name+. Create
+ # an anonymous namespace if +name+ is nil.
+ def in_namespace(name)
+ name ||= generate_name
+ @scope = Scope.new(name, @scope)
+ ns = NameSpace.new(self, @scope)
+ yield(ns)
+ ns
+ ensure
+ @scope = @scope.tail
+ end
+
+ private
+
+ # Add a location to the locations field of the given task.
+ def add_location(task)
+ loc = find_location
+ task.locations << loc if loc
+ task
+ end
+
+ # Find the location that called into the dsl layer.
+ def find_location
+ locations = caller
+ i = 0
+ while locations[i]
+ return locations[i + 1] if locations[i] =~ /rake\/dsl_definition.rb/
+ i += 1
+ end
+ nil
+ end
+
+ # Generate an anonymous namespace name.
+ def generate_name
+ @seed ||= 0
+ @seed += 1
+ "_anon_#{@seed}"
+ end
+
+ def trace_rule(level, message)
+ options.trace_output.puts "#{" " * level}#{message}" if
+ Rake.application.options.trace_rules
+ end
+
+ # Attempt to create a rule given the list of prerequisites.
+ def attempt_rule(task_name, args, extensions, block, level)
+ sources = make_sources(task_name, extensions)
+ prereqs = sources.map { |source|
+ trace_rule level, "Attempting Rule #{task_name} => #{source}"
+ if File.exist?(source) || Rake::Task.task_defined?(source)
+ trace_rule level, "(#{task_name} => #{source} ... EXIST)"
+ source
+ elsif parent = enhance_with_matching_rule(source, level + 1)
+ trace_rule level, "(#{task_name} => #{source} ... ENHANCE)"
+ parent.name
+ else
+ trace_rule level, "(#{task_name} => #{source} ... FAIL)"
+ return nil
+ end
+ }
+ task = FileTask.define_task(task_name, {args => prereqs}, &block)
+ task.sources = prereqs
+ task
+ end
+
+ # Make a list of sources from the list of file name extensions /
+ # translation procs.
+ def make_sources(task_name, extensions)
+ result = extensions.map { |ext|
+ case ext
+ when /%/
+ task_name.pathmap(ext)
+ when %r{/}
+ ext
+ when /^\./
+ task_name.ext(ext)
+ when String
+ ext
+ when Proc
+ if ext.arity == 1
+ ext.call(task_name)
+ else
+ ext.call
+ end
+ else
+ fail "Don't know how to handle rule dependent: #{ext.inspect}"
+ end
+ }
+ result.flatten
+ end
+
+
+ private
+
+ # Return the current description, clearing it in the process.
+ def get_description(task)
+ desc = @last_description
+ @last_description = nil
+ desc
+ end
+
+ class << self
+ attr_accessor :record_task_metadata
+ TaskManager.record_task_metadata = false
+ end
+ end
+
+end
diff --git a/lib/rake/tasklib.rb b/lib/rake/tasklib.rb
new file mode 100644
index 0000000000..48d27df9ed
--- /dev/null
+++ b/lib/rake/tasklib.rb
@@ -0,0 +1,22 @@
+require 'rake'
+
+module Rake
+
+ # Base class for Task Libraries.
+ class TaskLib
+ include Cloneable
+ include Rake::DSL
+
+ # Make a symbol by pasting two strings together.
+ #
+ # NOTE: DEPRECATED! This method is kinda stupid. I don't know why
+ # I didn't just use string interpolation. But now other task
+ # libraries depend on this so I can't remove it without breaking
+ # other people's code. So for now it stays for backwards
+ # compatibility. BUT DON'T USE IT.
+ def paste(a, b) # :nodoc:
+ (a.to_s + b.to_s).intern
+ end
+ end
+
+end
diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb
new file mode 100644
index 0000000000..c693dd2626
--- /dev/null
+++ b/lib/rake/testtask.rb
@@ -0,0 +1,201 @@
+# Define a task library for running unit tests.
+
+require 'rake'
+require 'rake/tasklib'
+
+module Rake
+
+ # Create a task that runs a set of tests.
+ #
+ # Example:
+ #
+ # Rake::TestTask.new do |t|
+ # t.libs << "test"
+ # t.test_files = FileList['test/test*.rb']
+ # t.verbose = true
+ # end
+ #
+ # If rake is invoked with a "TEST=filename" command line option,
+ # then the list of test files will be overridden to include only the
+ # filename specified on the command line. This provides an easy way
+ # to run just one test.
+ #
+ # If rake is invoked with a "TESTOPTS=options" command line option,
+ # then the given options are passed to the test process after a
+ # '--'. This allows Test::Unit options to be passed to the test
+ # suite.
+ #
+ # Examples:
+ #
+ # rake test # run tests normally
+ # rake test TEST=just_one_file.rb # run just one test file.
+ # rake test TESTOPTS="-v" # run in verbose mode
+ # rake test TESTOPTS="--runner=fox" # use the fox test runner
+ #
+ class TestTask < TaskLib
+
+ # Name of test task. (default is :test)
+ attr_accessor :name
+
+ # List of directories to added to $LOAD_PATH before running the
+ # tests. (default is 'lib')
+ attr_accessor :libs
+
+ # True if verbose test output desired. (default is false)
+ attr_accessor :verbose
+
+ # Test options passed to the test suite. An explicit
+ # TESTOPTS=opts on the command line will override this. (default
+ # is NONE)
+ attr_accessor :options
+
+ # Request that the tests be run with the warning flag set.
+ # E.g. warning=true implies "ruby -w" used to run the tests.
+ attr_accessor :warning
+
+ # Glob pattern to match test files. (default is 'test/test*.rb')
+ attr_accessor :pattern
+
+ # Style of test loader to use. Options are:
+ #
+ # * :rake -- Rake provided test loading script (default).
+ # * :testrb -- Ruby provided test loading script.
+ # * :direct -- Load tests using command line loader.
+ #
+ attr_accessor :loader
+
+ # Array of commandline options to pass to ruby when running test loader.
+ attr_accessor :ruby_opts
+
+ # Explicitly define the list of test files to be included in a
+ # test. +list+ is expected to be an array of file names (a
+ # FileList is acceptable). If both +pattern+ and +test_files+ are
+ # used, then the list of test files is the union of the two.
+ def test_files=(list)
+ @test_files = list
+ end
+
+ # Create a testing task.
+ def initialize(name=:test)
+ @name = name
+ @libs = ["lib"]
+ @pattern = nil
+ @options = nil
+ @test_files = nil
+ @verbose = false
+ @warning = false
+ @loader = :rake
+ @ruby_opts = []
+ yield self if block_given?
+ @pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil?
+ define
+ end
+
+ # Create the tasks defined by this task lib.
+ def define
+ desc "Run tests" + (@name == :test ? "" : " for #{@name}")
+ task @name do
+ FileUtilsExt.verbose(@verbose) do
+ args =
+ "#{ruby_opts_string} #{run_code} " +
+ "#{file_list_string} #{option_list}"
+ ruby args do |ok, status|
+ if !ok && status.respond_to?(:signaled?) && status.signaled?
+ raise SignalException.new(status.termsig)
+ elsif !ok
+ fail "Command failed with status (#{status.exitstatus}): " +
+ "[ruby #{args}]"
+ end
+ end
+ end
+ end
+ self
+ end
+
+ def option_list # :nodoc:
+ (ENV['TESTOPTS'] ||
+ ENV['TESTOPT'] ||
+ ENV['TEST_OPTS'] ||
+ ENV['TEST_OPT'] ||
+ @options ||
+ "")
+ end
+
+ def ruby_opts_string
+ opts = @ruby_opts.dup
+ opts.unshift("-I\"#{lib_path}\"") unless @libs.empty?
+ opts.unshift("-w") if @warning
+ opts.join(" ")
+ end
+
+ def lib_path
+ @libs.join(File::PATH_SEPARATOR)
+ end
+
+ def file_list_string
+ file_list.map { |fn| "\"#{fn}\"" }.join(' ')
+ end
+
+ def file_list # :nodoc:
+ if ENV['TEST']
+ FileList[ENV['TEST']]
+ else
+ result = []
+ result += @test_files.to_a if @test_files
+ result << @pattern if @pattern
+ result
+ end
+ end
+
+ def fix # :nodoc:
+ case ruby_version
+ when '1.8.2'
+ "\"#{find_file 'rake/ruby182_test_unit_fix'}\""
+ else
+ nil
+ end || ''
+ end
+
+ def ruby_version
+ RUBY_VERSION
+ end
+
+ def run_code
+ case @loader
+ when :direct
+ "-e \"ARGV.each{|f| require f}\""
+ when :testrb
+ "-S testrb #{fix}"
+ when :rake
+ "-I\"#{rake_lib_dir}\" \"#{rake_loader}\""
+ end
+ end
+
+ def rake_loader # :nodoc:
+ find_file('rake/rake_test_loader') or
+ fail "unable to find rake test loader"
+ end
+
+ def find_file(fn) # :nodoc:
+ $LOAD_PATH.each do |path|
+ file_path = File.join(path, "#{fn}.rb")
+ return file_path if File.exist? file_path
+ end
+ nil
+ end
+
+ def rake_lib_dir # :nodoc:
+ find_dir('rake') or
+ fail "unable to find rake lib"
+ end
+
+ def find_dir(fn) # :nodoc:
+ $LOAD_PATH.each do |path|
+ file_path = File.join(path, "#{fn}.rb")
+ return path if File.exist? file_path
+ end
+ nil
+ end
+
+ end
+end
diff --git a/lib/rake/thread_history_display.rb b/lib/rake/thread_history_display.rb
new file mode 100644
index 0000000000..c2af9ecef5
--- /dev/null
+++ b/lib/rake/thread_history_display.rb
@@ -0,0 +1,48 @@
+require 'rake/private_reader'
+
+module Rake
+
+ class ThreadHistoryDisplay # :nodoc: all
+ include Rake::PrivateReader
+
+ private_reader :stats, :items, :threads
+
+ def initialize(stats)
+ @stats = stats
+ @items = { :_seq_ => 1 }
+ @threads = { :_seq_ => "A" }
+ end
+
+ def show
+ puts "Job History:"
+ stats.each do |stat|
+ stat[:data] ||= {}
+ rename(stat, :thread, threads)
+ rename(stat[:data], :item_id, items)
+ rename(stat[:data], :new_thread, threads)
+ rename(stat[:data], :deleted_thread, threads)
+ printf("%8d %2s %-20s %s\n",
+ (stat[:time] * 1_000_000).round,
+ stat[:thread],
+ stat[:event],
+ stat[:data].map do |k, v| "#{k}:#{v}" end.join(" "))
+ end
+ end
+
+ private
+
+ def rename(hash, key, renames)
+ if hash && hash[key]
+ original = hash[key]
+ value = renames[original]
+ unless value
+ value = renames[:_seq_]
+ renames[:_seq_] = renames[:_seq_].succ
+ renames[original] = value
+ end
+ hash[key] = value
+ end
+ end
+ end
+
+end
diff --git a/lib/rake/thread_pool.rb b/lib/rake/thread_pool.rb
new file mode 100644
index 0000000000..44bc7483e4
--- /dev/null
+++ b/lib/rake/thread_pool.rb
@@ -0,0 +1,161 @@
+require 'thread'
+require 'set'
+
+require 'rake/promise'
+
+module Rake
+
+ class ThreadPool # :nodoc: all
+
+ # Creates a ThreadPool object.
+ # The parameter is the size of the pool.
+ def initialize(thread_count)
+ @max_active_threads = [thread_count, 0].max
+ @threads = Set.new
+ @threads_mon = Monitor.new
+ @queue = Queue.new
+ @join_cond = @threads_mon.new_cond
+
+ @history_start_time = nil
+ @history = []
+ @history_mon = Monitor.new
+ @total_threads_in_play = 0
+ end
+
+ # Creates a future executed by the +ThreadPool+.
+ #
+ # The args are passed to the block when executing (similarly to
+ # <tt>Thread#new</tt>) The return value is an object representing
+ # a future which has been created and added to the queue in the
+ # pool. Sending <tt>#value</tt> to the object will sleep the
+ # current thread until the future is finished and will return the
+ # result (or raise an exception thrown from the future)
+ def future(*args, &block)
+ promise = Promise.new(args, &block)
+ promise.recorder = lambda { |*stats| stat(*stats) }
+
+ @queue.enq promise
+ stat :queued, :item_id => promise.object_id
+ start_thread
+ promise
+ end
+
+ # Waits until the queue of futures is empty and all threads have exited.
+ def join
+ @threads_mon.synchronize do
+ begin
+ stat :joining
+ @join_cond.wait unless @threads.empty?
+ stat :joined
+ rescue Exception => e
+ stat :joined
+ $stderr.puts e
+ $stderr.print "Queue contains #{@queue.size} items. " +
+ "Thread pool contains #{@threads.count} threads\n"
+ $stderr.print "Current Thread #{Thread.current} status = " +
+ "#{Thread.current.status}\n"
+ $stderr.puts e.backtrace.join("\n")
+ @threads.each do |t|
+ $stderr.print "Thread #{t} status = #{t.status}\n"
+ # 1.8 doesn't support Thread#backtrace
+ $stderr.puts t.backtrace.join("\n") if t.respond_to? :backtrace
+ end
+ raise e
+ end
+ end
+ end
+
+ # Enable the gathering of history events.
+ def gather_history #:nodoc:
+ @history_start_time = Time.now if @history_start_time.nil?
+ end
+
+ # Return a array of history events for the thread pool.
+ #
+ # History gathering must be enabled to be able to see the events
+ # (see #gather_history). Best to call this when the job is
+ # complete (i.e. after ThreadPool#join is called).
+ def history # :nodoc:
+ @history_mon.synchronize { @history.dup }.
+ sort_by { |i| i[:time] }.
+ each { |i| i[:time] -= @history_start_time }
+ end
+
+ # Return a hash of always collected statistics for the thread pool.
+ def statistics # :nodoc:
+ {
+ :total_threads_in_play => @total_threads_in_play,
+ :max_active_threads => @max_active_threads,
+ }
+ end
+
+ private
+
+ # processes one item on the queue. Returns true if there was an
+ # item to process, false if there was no item
+ def process_queue_item #:nodoc:
+ return false if @queue.empty?
+
+ # Even though we just asked if the queue was empty, it
+ # still could have had an item which by this statement
+ # is now gone. For this reason we pass true to Queue#deq
+ # because we will sleep indefinitely if it is empty.
+ promise = @queue.deq(true)
+ stat :dequeued, :item_id => promise.object_id
+ promise.work
+ return true
+
+ rescue ThreadError # this means the queue is empty
+ false
+ end
+
+ def start_thread # :nodoc:
+ @threads_mon.synchronize do
+ next unless @threads.count < @max_active_threads
+
+ t = Thread.new do
+ begin
+ while @threads.count <= @max_active_threads
+ break unless process_queue_item
+ end
+ ensure
+ @threads_mon.synchronize do
+ @threads.delete Thread.current
+ stat :ended, :thread_count => @threads.count
+ @join_cond.broadcast if @threads.empty?
+ end
+ end
+ end
+ @threads << t
+ stat(
+ :spawned,
+ :new_thread => t.object_id,
+ :thread_count => @threads.count)
+ @total_threads_in_play = @threads.count if
+ @threads.count > @total_threads_in_play
+ end
+ end
+
+ def stat(event, data=nil) # :nodoc:
+ return if @history_start_time.nil?
+ info = {
+ :event => event,
+ :data => data,
+ :time => Time.now,
+ :thread => Thread.current.object_id,
+ }
+ @history_mon.synchronize { @history << info }
+ end
+
+ # for testing only
+
+ def __queue__ # :nodoc:
+ @queue
+ end
+
+ def __threads__ # :nodoc:
+ @threads.dup
+ end
+ end
+
+end
diff --git a/lib/rake/trace_output.rb b/lib/rake/trace_output.rb
new file mode 100644
index 0000000000..1cd19451ca
--- /dev/null
+++ b/lib/rake/trace_output.rb
@@ -0,0 +1,22 @@
+module Rake
+ module TraceOutput
+
+ # Write trace output to output stream +out+.
+ #
+ # The write is done as a single IO call (to print) to lessen the
+ # chance that the trace output is interrupted by other tasks also
+ # producing output.
+ def trace_on(out, *strings)
+ sep = $\ || "\n"
+ if strings.empty?
+ output = sep
+ else
+ output = strings.map { |s|
+ next if s.nil?
+ s =~ /#{sep}$/ ? s : s + sep
+ }.join
+ end
+ out.print(output)
+ end
+ end
+end
diff --git a/lib/rake/version.rb b/lib/rake/version.rb
new file mode 100644
index 0000000000..05c934d785
--- /dev/null
+++ b/lib/rake/version.rb
@@ -0,0 +1,9 @@
+module Rake
+ VERSION = '10.1.0'
+
+ module Version # :nodoc: all
+ MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split '.'
+
+ NUMBERS = [MAJOR, MINOR, BUILD, *OTHER]
+ end
+end
diff --git a/lib/rake/win32.rb b/lib/rake/win32.rb
new file mode 100644
index 0000000000..edb33938b4
--- /dev/null
+++ b/lib/rake/win32.rb
@@ -0,0 +1,56 @@
+
+module Rake
+ require 'rake/alt_system'
+
+ # Win 32 interface methods for Rake. Windows specific functionality
+ # will be placed here to collect that knowledge in one spot.
+ module Win32
+
+ # Error indicating a problem in locating the home directory on a
+ # Win32 system.
+ class Win32HomeError < RuntimeError
+ end
+
+ class << self
+ # True if running on a windows system.
+ def windows?
+ AltSystem::WINDOWS
+ end
+
+ # Run a command line on windows.
+ def rake_system(*cmd)
+ AltSystem.system(*cmd)
+ end
+
+ # The standard directory containing system wide rake files on
+ # Win 32 systems. Try the following environment variables (in
+ # order):
+ #
+ # * HOME
+ # * HOMEDRIVE + HOMEPATH
+ # * APPDATA
+ # * USERPROFILE
+ #
+ # If the above are not defined, the return nil.
+ def win32_system_dir #:nodoc:
+ win32_shared_path = ENV['HOME']
+ if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
+ win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
+ end
+
+ win32_shared_path ||= ENV['APPDATA']
+ win32_shared_path ||= ENV['USERPROFILE']
+ raise Win32HomeError,
+ "Unable to determine home path environment variable." if
+ win32_shared_path.nil? or win32_shared_path.empty?
+ normalize(File.join(win32_shared_path, 'Rake'))
+ end
+
+ # Normalize a win32 path so that the slashes are all forward slashes.
+ def normalize(path)
+ path.gsub(/\\/, '/')
+ end
+
+ end
+ end
+end
diff --git a/lib/rational.rb b/lib/rational.rb
new file mode 100644
index 0000000000..a1aeca1e40
--- /dev/null
+++ b/lib/rational.rb
@@ -0,0 +1,23 @@
+# :enddoc:
+
+warn('lib/rational.rb is deprecated') if $VERBOSE
+
+class Fixnum
+
+ alias quof fdiv
+ alias rdiv quo
+
+ alias power! ** unless method_defined? :power!
+ alias rpower **
+
+end
+
+class Bignum
+
+ alias quof fdiv
+ alias rdiv quo
+
+ alias power! ** unless method_defined? :power!
+ alias rpower **
+
+end
diff --git a/lib/rbconfig/datadir.rb b/lib/rbconfig/datadir.rb
index 136162da44..9b7eabb473 100644
--- a/lib/rbconfig/datadir.rb
+++ b/lib/rbconfig/datadir.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
diff --git a/lib/rbconfig/obsolete.rb b/lib/rbconfig/obsolete.rb
new file mode 100644
index 0000000000..7025fb43fb
--- /dev/null
+++ b/lib/rbconfig/obsolete.rb
@@ -0,0 +1,38 @@
+module ::RbConfig
+ module Obsolete
+ end
+ class << Obsolete
+ def _warn_
+ loc, = caller_locations(2, 1)
+ loc = "#{loc.to_s}: " if loc
+ warn "#{loc}Use RbConfig instead of obsolete and deprecated Config."
+ self
+ end
+
+ def const_missing(name)
+ _warn_
+ ::RbConfig.const_get(name)
+ end
+
+ def method_missing(*args, &block)
+ _warn_
+ rbconfig = ::RbConfig
+ result = rbconfig.__send__(*args, &block)
+ result = rbconfig if rbconfig.equal?(result)
+ result
+ end
+
+ def respond_to_missing?(*args, &block)
+ _warn_
+ ::RbConfig.send(:respond_to_missing?, *args, &block)
+ end
+ end
+end
+
+::Config = ::RbConfig::Obsolete._warn_
+=begin
+def Object.const_missing(name)
+ return super unless name == :Config
+ ::RbConfig::Obsolete._warn_
+end
+=end
diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index d6e26114c0..4fb0c3b881 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
$DEBUG_RDOC = nil
# :main: README.rdoc
@@ -65,7 +64,7 @@ module RDoc
##
# RDoc version you are using
- VERSION = '4.2.1'
+ VERSION = '4.1.0.preview.2'
##
# Method visibilities
@@ -110,8 +109,6 @@ module RDoc
def self.load_yaml
begin
gem 'psych'
- rescue NameError => e # --disable-gems
- raise unless e.name == :gem
rescue Gem::LoadError
end
@@ -154,8 +151,6 @@ module RDoc
autoload :Comment, 'rdoc/comment'
- autoload :I18n, 'rdoc/i18n'
-
# code objects
#
# We represent the various high-level code constructs that appear in Ruby
diff --git a/lib/rdoc/alias.rb b/lib/rdoc/alias.rb
index 1e06fb96e5..39d2694817 100644
--- a/lib/rdoc/alias.rb
+++ b/lib/rdoc/alias.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Represent an alias, which is an old_name/new_name pair associated with a
# particular context
diff --git a/lib/rdoc/anon_class.rb b/lib/rdoc/anon_class.rb
index 098bfdfcf9..c23d8e5d96 100644
--- a/lib/rdoc/anon_class.rb
+++ b/lib/rdoc/anon_class.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# An anonymous class like:
#
diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb
index 16ac8e024e..3afafc86b8 100644
--- a/lib/rdoc/any_method.rb
+++ b/lib/rdoc/any_method.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# AnyMethod is the base class for objects representing methods
@@ -241,15 +240,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
return []
end
- if @block_params then
- # If this method has explicit block parameters, remove any explicit
- # &block
- params.sub!(/,?\s*&\w+/, '')
- else
- params.sub!(/\&(\w+)/, '\1')
- end
-
- params = params.gsub(/\s+/, '').split(',').reject(&:empty?)
+ params = params.gsub(/\s+/, '').split ','
params.map { |param| param.sub(/=.*/, '') }
end
diff --git a/lib/rdoc/attr.rb b/lib/rdoc/attr.rb
index f77a5c04a7..960e1d1107 100644
--- a/lib/rdoc/attr.rb
+++ b/lib/rdoc/attr.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# An attribute created by \#attr, \#attr_reader, \#attr_writer or
# \#attr_accessor
diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb
index 5881d6cf24..71566f050a 100644
--- a/lib/rdoc/class_module.rb
+++ b/lib/rdoc/class_module.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# ClassModule is the base class for objects representing either a class or a
# module.
diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb
index dc195cc6ac..4620fa586d 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Base class for the RDoc code tree.
#
diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb
index 564849e1d1..f1a626cd2e 100644
--- a/lib/rdoc/code_objects.rb
+++ b/lib/rdoc/code_objects.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# This file was used to load all the RDoc::CodeObject subclasses at once. Now
# autoload handles this.
diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb
index ebff742233..33ced18b5a 100644
--- a/lib/rdoc/comment.rb
+++ b/lib/rdoc/comment.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A comment holds the text comment for a RDoc::CodeObject and provides a
# unified way of cleaning it up and parsing it into an RDoc::Markup::Document.
diff --git a/lib/rdoc/constant.rb b/lib/rdoc/constant.rb
index 4fd5c5f10f..97985cbf99 100644
--- a/lib/rdoc/constant.rb
+++ b/lib/rdoc/constant.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A constant
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index bc8c8eecf1..892a43e118 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'cgi'
##
@@ -165,8 +164,6 @@ class RDoc::Context < RDoc::CodeObject
# Contexts are sorted by full_name
def <=>(other)
- return nil unless RDoc::CodeObject === other
-
full_name <=> other.full_name
end
@@ -324,11 +321,10 @@ class RDoc::Context < RDoc::CodeObject
end
# fix up superclass
- if full_name == 'BasicObject' then
- superclass = nil
- elsif full_name == 'Object' then
- superclass = defined?(::BasicObject) ? '::BasicObject' : nil
- end
+ superclass = nil if full_name == 'BasicObject'
+ superclass = nil if full_name == 'Object' and defined?(::BasicObject)
+ superclass = '::BasicObject' if
+ defined?(::BasicObject) and full_name == 'Object'
# find the superclass full name
if superclass then
diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb
index 90f184cb89..580f07deff 100644
--- a/lib/rdoc/context/section.rb
+++ b/lib/rdoc/context/section.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A section of documentation like:
#
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index 0e40d23159..5b08d5202d 100644
--- a/lib/rdoc/cross_reference.rb
+++ b/lib/rdoc/cross_reference.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# RDoc::CrossReference is a reusable way to create cross references for names.
diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb
index 5327f9a961..9fe3539412 100644
--- a/lib/rdoc/encoding.rb
+++ b/lib/rdoc/encoding.rb
@@ -1,5 +1,4 @@
# coding: US-ASCII
-# frozen_string_literal: false
##
# This class is a wrapper around File IO and Encoding that helps RDoc load
@@ -30,9 +29,7 @@ module RDoc::Encoding
encoding ||= Encoding.default_external
orig_encoding = content.encoding
- if not orig_encoding.ascii_compatible? then
- content.encode! encoding
- elsif utf8 then
+ if utf8 then
content.force_encoding Encoding::UTF_8
content.encode! encoding
else
diff --git a/lib/rdoc/erb_partial.rb b/lib/rdoc/erb_partial.rb
index d17dda20a9..910d1e0351 100644
--- a/lib/rdoc/erb_partial.rb
+++ b/lib/rdoc/erb_partial.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Allows an ERB template to be rendered in the context (binding) of an
# existing ERB template evaluation.
diff --git a/lib/rdoc/erbio.rb b/lib/rdoc/erbio.rb
index a2aaa90e67..04a89fbd34 100644
--- a/lib/rdoc/erbio.rb
+++ b/lib/rdoc/erbio.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'erb'
##
diff --git a/lib/rdoc/extend.rb b/lib/rdoc/extend.rb
index 30b51a1dbd..efa2c69bee 100644
--- a/lib/rdoc/extend.rb
+++ b/lib/rdoc/extend.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A Module extension to a class with \#extend
#
diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb
index d37d1db61f..9051f8a658 100644
--- a/lib/rdoc/generator.rb
+++ b/lib/rdoc/generator.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# RDoc uses generators to turn parsed source code in the form of an
# RDoc::CodeObject tree into some form of output. RDoc comes with the HTML
@@ -46,7 +45,6 @@ module RDoc::Generator
autoload :Darkfish, 'rdoc/generator/darkfish'
autoload :JsonIndex, 'rdoc/generator/json_index'
autoload :RI, 'rdoc/generator/ri'
- autoload :POT, 'rdoc/generator/pot'
end
diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb
index 18394a2c34..bd37b60668 100644
--- a/lib/rdoc/generator/darkfish.rb
+++ b/lib/rdoc/generator/darkfish.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
require 'erb'
@@ -63,14 +62,14 @@ class RDoc::Generator::Darkfish
BUILTIN_STYLE_ITEMS = # :nodoc:
%w[
- css/fonts.css
+ fonts.css
fonts/Lato-Light.ttf
fonts/Lato-LightItalic.ttf
fonts/Lato-Regular.ttf
fonts/Lato-RegularItalic.ttf
fonts/SourceCodePro-Bold.ttf
fonts/SourceCodePro-Regular.ttf
- css/rdoc.css
+ rdoc.css
]
##
@@ -247,7 +246,6 @@ class RDoc::Generator::Darkfish
generate_file_files
generate_table_of_contents
@json_index.generate
- @json_index.generate_gzipped
copy_static
diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb
index 624a2e512e..c303b2effb 100644
--- a/lib/rdoc/generator/json_index.rb
+++ b/lib/rdoc/generator/json_index.rb
@@ -1,9 +1,4 @@
-# frozen_string_literal: false
require 'json'
-begin
- require 'zlib'
-rescue LoadError
-end
##
# The JsonIndex generator is designed to complement an HTML generator and
@@ -158,51 +153,6 @@ class RDoc::Generator::JsonIndex
end
##
- # Compress the search_index.js file using gzip
-
- def generate_gzipped
- return unless defined?(Zlib)
-
- debug_msg "Compressing generated JSON index"
- out_dir = @base_dir + @options.op_dir
-
- search_index_file = out_dir + SEARCH_INDEX_FILE
- outfile = out_dir + "#{search_index_file}.gz"
-
- debug_msg "Reading the JSON index file from %s" % search_index_file
- search_index = search_index_file.read
-
- debug_msg "Writing gzipped search index to %s" % outfile
-
- Zlib::GzipWriter.open(outfile) do |gz|
- gz.mtime = File.mtime(search_index_file)
- gz.orig_name = search_index_file.basename.to_s
- gz.write search_index
- gz.close
- end
-
- # GZip the rest of the js files
- Dir.chdir @template_dir do
- Dir['**/*.js'].each do |source|
- dest = out_dir + source
- outfile = out_dir + "#{dest}.gz"
-
- debug_msg "Reading the original js file from %s" % dest
- data = dest.read
-
- debug_msg "Writing gzipped file to %s" % outfile
-
- Zlib::GzipWriter.open(outfile) do |gz|
- gz.mtime = File.mtime(dest)
- gz.orig_name = dest.basename.to_s
- gz.write data
- gz.close
- end
- end
- end
- end
-
- ##
# Adds classes and modules to the index
def index_classes
diff --git a/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb
index 3ca423bb69..788e5a485d 100644
--- a/lib/rdoc/generator/markup.rb
+++ b/lib/rdoc/generator/markup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Handle common RDoc::Markup tasks for various CodeObjects
#
diff --git a/lib/rdoc/generator/pot.rb b/lib/rdoc/generator/pot.rb
deleted file mode 100644
index e2cf22d730..0000000000
--- a/lib/rdoc/generator/pot.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-# frozen_string_literal: false
-##
-# Generates a POT file.
-#
-# Here is a translator work flow with the generator.
-#
-# == Create .pot
-#
-# You create .pot file by pot formatter:
-#
-# % rdoc --format pot
-#
-# It generates doc/rdoc.pot.
-#
-# == Create .po
-#
-# You create .po file from doc/rdoc.pot. This operation is needed only
-# the first time. This work flow assumes that you are a translator
-# for Japanese.
-#
-# You create locale/ja/rdoc.po from doc/rdoc.pot. You can use msginit
-# provided by GNU gettext or rmsginit provided by gettext gem. This
-# work flow uses gettext gem because it is more portable than GNU
-# gettext for Rubyists. Gettext gem is implemented by pure Ruby.
-#
-# % gem install gettext
-# % mkdir -p locale/ja
-# % rmsginit --input doc/rdoc.pot --output locale/ja/rdoc.po --locale ja
-#
-# Translate messages in .po
-#
-# You translate messages in .po by a PO file editor. po-mode.el exists
-# for Emacs users. There are some GUI tools such as GTranslator.
-# There are some Web services such as POEditor and Tansifex. You can
-# edit by your favorite text editor because .po is a text file.
-# Generate localized documentation
-#
-# You can generate localized documentation with locale/ja/rdoc.po:
-#
-# % rdoc --locale ja
-#
-# You can find documentation in Japanese in doc/. Yay!
-#
-# == Update translation
-#
-# You need to update translation when your application is added or
-# modified messages.
-#
-# You can update .po by the following command lines:
-#
-# % rdoc --format pot
-# % rmsgmerge --update locale/ja/rdoc.po doc/rdoc.pot
-#
-# You edit locale/ja/rdoc.po to translate new messages.
-
-class RDoc::Generator::POT
-
- RDoc::RDoc.add_generator self
-
- ##
- # Description of this generator
-
- DESCRIPTION = 'creates .pot file'
-
- ##
- # Set up a new .pot generator
-
- def initialize store, options #:not-new:
- @options = options
- @store = store
- end
-
- ##
- # Writes .pot to disk.
-
- def generate
- po = extract_messages
- pot_path = 'rdoc.pot'
- File.open(pot_path, "w") do |pot|
- pot.print(po.to_s)
- end
- end
-
- def class_dir
- nil
- end
-
- private
- def extract_messages
- extractor = MessageExtractor.new(@store)
- extractor.extract
- end
-
- autoload :MessageExtractor, 'rdoc/generator/pot/message_extractor'
- autoload :PO, 'rdoc/generator/pot/po'
- autoload :POEntry, 'rdoc/generator/pot/po_entry'
-
-end
diff --git a/lib/rdoc/generator/pot/message_extractor.rb b/lib/rdoc/generator/pot/message_extractor.rb
deleted file mode 100644
index 0dd2497c26..0000000000
--- a/lib/rdoc/generator/pot/message_extractor.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# frozen_string_literal: false
-##
-# Extracts message from RDoc::Store
-
-class RDoc::Generator::POT::MessageExtractor
-
- ##
- # Creates a message extractor for +store+.
-
- def initialize store
- @store = store
- @po = RDoc::Generator::POT::PO.new
- end
-
- ##
- # Extracts messages from +store+, stores them into
- # RDoc::Generator::POT::PO and returns it.
-
- def extract
- @store.all_classes_and_modules.each do |klass|
- extract_from_klass(klass)
- end
- @po
- end
-
- private
-
- def extract_from_klass klass
- extract_text(klass.comment_location, klass.full_name)
-
- klass.each_section do |section, constants, attributes|
- extract_text(section.title ,"#{klass.full_name}: section title")
- section.comments.each do |comment|
- extract_text(comment, "#{klass.full_name}: #{section.title}")
- end
- end
-
- klass.each_constant do |constant|
- extract_text(constant.comment, constant.full_name)
- end
-
- klass.each_attribute do |attribute|
- extract_text(attribute.comment, attribute.full_name)
- end
-
- klass.each_method do |method|
- extract_text(method.comment, method.full_name)
- end
- end
-
- def extract_text text, comment, location = nil
- return if text.nil?
-
- options = {
- :extracted_comment => comment,
- :references => [location].compact,
- }
- i18n_text = RDoc::I18n::Text.new(text)
- i18n_text.extract_messages do |part|
- @po.add(entry(part[:paragraph], options))
- end
- end
-
- def entry msgid, options
- RDoc::Generator::POT::POEntry.new(msgid, options)
- end
-
-end
diff --git a/lib/rdoc/generator/pot/po.rb b/lib/rdoc/generator/pot/po.rb
deleted file mode 100644
index 60e14db831..0000000000
--- a/lib/rdoc/generator/pot/po.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# frozen_string_literal: false
-##
-# Generates a PO format text
-
-class RDoc::Generator::POT::PO
-
- ##
- # Creates an object that represents PO format.
-
- def initialize
- @entries = {}
- add_header
- end
-
- ##
- # Adds a PO entry to the PO.
-
- def add entry
- existing_entry = @entries[entry.msgid]
- if existing_entry
- entry = existing_entry.merge(entry)
- end
- @entries[entry.msgid] = entry
- end
-
- ##
- # Returns PO format text for the PO.
-
- def to_s
- po = ''
- sort_entries.each do |entry|
- po << "\n" unless po.empty?
- po << entry.to_s
- end
- po
- end
-
- private
-
- def add_header
- add(header_entry)
- end
-
- def header_entry
- comment = <<-COMMENT
-SOME DESCRIPTIVE TITLE.
-Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-This file is distributed under the same license as the PACKAGE package.
-FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
- COMMENT
-
- content = <<-CONTENT
-Project-Id-Version: PACKAGE VERSEION
-Report-Msgid-Bugs-To:
-PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE
-Last-Translator: FULL NAME <EMAIL@ADDRESS>
-Language-Team: LANGUAGE <LL@li.org>
-Language:
-MIME-Version: 1.0
-Content-Type: text/plain; charset=CHARSET
-Content-Transfer-Encoding: 8bit
-Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;
- CONTENT
-
- options = {
- :msgstr => content,
- :translator_comment => comment,
- :flags => ['fuzzy'],
- }
- RDoc::Generator::POT::POEntry.new('', options)
- end
-
- def sort_entries
- headers, messages = @entries.values.partition do |entry|
- entry.msgid.empty?
- end
- # TODO: sort by location
- sorted_messages = messages.sort_by do |entry|
- entry.msgid
- end
- headers + sorted_messages
- end
-
-end
diff --git a/lib/rdoc/generator/pot/po_entry.rb b/lib/rdoc/generator/pot/po_entry.rb
deleted file mode 100644
index 515d02b48d..0000000000
--- a/lib/rdoc/generator/pot/po_entry.rb
+++ /dev/null
@@ -1,141 +0,0 @@
-# frozen_string_literal: false
-##
-# A PO entry in PO
-
-class RDoc::Generator::POT::POEntry
-
- # The msgid content
- attr_reader :msgid
-
- # The msgstr content
- attr_reader :msgstr
-
- # The comment content created by translator (PO editor)
- attr_reader :translator_comment
-
- # The comment content extracted from source file
- attr_reader :extracted_comment
-
- # The locations where the PO entry is extracted
- attr_reader :references
-
- # The flags of the PO entry
- attr_reader :flags
-
- ##
- # Creates a PO entry for +msgid+. Other valus can be specified by
- # +options+.
-
- def initialize msgid, options = {}
- @msgid = msgid
- @msgstr = options[:msgstr] || ""
- @translator_comment = options[:translator_comment]
- @extracted_comment = options[:extracted_comment]
- @references = options[:references] || []
- @flags = options[:flags] || []
- end
-
- ##
- # Returns the PO entry in PO format.
-
- def to_s
- entry = ''
- entry << format_translator_comment
- entry << format_extracted_comment
- entry << format_references
- entry << format_flags
- entry << <<-ENTRY
-msgid #{format_message(@msgid)}
-msgstr #{format_message(@msgstr)}
- ENTRY
- end
-
- ##
- # Merges the PO entry with +other_entry+.
-
- def merge other_entry
- options = {
- :extracted_comment => merge_string(@extracted_comment,
- other_entry.extracted_comment),
- :translator_comment => merge_string(@translator_comment,
- other_entry.translator_comment),
- :references => merge_array(@references,
- other_entry.references),
- :flags => merge_array(@flags,
- other_entry.flags),
- }
- self.class.new(@msgid, options)
- end
-
- private
-
- def format_comment mark, comment
- return '' unless comment
- return '' if comment.empty?
-
- formatted_comment = ''
- comment.each_line do |line|
- formatted_comment << "#{mark} #{line}"
- end
- formatted_comment << "\n" unless formatted_comment.end_with?("\n")
- formatted_comment
- end
-
- def format_translator_comment
- format_comment('#', @translator_comment)
- end
-
- def format_extracted_comment
- format_comment('#.', @extracted_comment)
- end
-
- def format_references
- return '' if @references.empty?
-
- formatted_references = ''
- @references.sort.each do |file, line|
- formatted_references << "\#: #{file}:#{line}\n"
- end
- formatted_references
- end
-
- def format_flags
- return '' if @flags.empty?
-
- formatted_flags = flags.join(",")
- "\#, #{formatted_flags}\n"
- end
-
- def format_message message
- return "\"#{escape(message)}\"" unless message.include?("\n")
-
- formatted_message = '""'
- message.each_line do |line|
- formatted_message << "\n"
- formatted_message << "\"#{escape(line)}\""
- end
- formatted_message
- end
-
- def escape string
- string.gsub(/["\\\t\n]/) do |special_character|
- case special_character
- when "\t"
- "\\t"
- when "\n"
- "\\n"
- else
- "\\#{special_character}"
- end
- end
- end
-
- def merge_string string1, string2
- [string1, string2].compact.join("\n")
- end
-
- def merge_array array1, array2
- (array1 + array2).uniq
- end
-
-end
diff --git a/lib/rdoc/generator/ri.rb b/lib/rdoc/generator/ri.rb
index 830777e587..b9c4141a5e 100644
--- a/lib/rdoc/generator/ri.rb
+++ b/lib/rdoc/generator/ri.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Generates ri data files
diff --git a/lib/rdoc/generator/template/darkfish/_footer.rhtml b/lib/rdoc/generator/template/darkfish/_footer.rhtml
index fe5822cc6b..3d9526f02a 100644
--- a/lib/rdoc/generator/template/darkfish/_footer.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_footer.rhtml
@@ -1,5 +1,5 @@
<footer id="validator-badges" role="contentinfo">
<p><a href="http://validator.w3.org/check/referer">Validate</a>
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> <%= RDoc::VERSION %>.
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
+ <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> <%= RDoc::VERSION %>.
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>
diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml
index 70f1c188d6..062160a751 100644
--- a/lib/rdoc/generator/template/darkfish/_head.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_head.rhtml
@@ -2,18 +2,21 @@
<title><%= h @title %></title>
-<script type="text/javascript">
- var rdoc_rel_prefix = "<%= rel_prefix %>/";
-</script>
-
-<script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
-<script src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
-
-<link href="<%= asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
-<link href="<%= asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/fonts.css" rel="stylesheet">
+<link href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
<% if @options.template_stylesheets.flatten.any? then %>
<% @options.template_stylesheets.flatten.each do |stylesheet| %>
<link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
<% end %>
<% end %>
+<script type="text/javascript">
+ var rdoc_rel_prefix = "<%= rel_prefix %>/";
+</script>
+
+<script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
+<script src="<%= asset_rel_prefix %>/js/navigation.js"></script>
+<script src="<%= search_index_rel_prefix %>/js/search_index.js"></script>
+<script src="<%= asset_rel_prefix %>/js/search.js"></script>
+<script src="<%= asset_rel_prefix %>/js/searcher.js"></script>
+<script src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
index 9c49b31376..4c1e1f7cc3 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
@@ -3,12 +3,13 @@
<div id="search-field-wrapper">
<input id="search-field" role="combobox" aria-label="Search"
aria-autocomplete="list" aria-controls="search-results"
- type="text" name="search" placeholder="Search" spellcheck="false"
+ type="text" name="search" placeholder="Search"
title="Type to search, Up and Down to navigate, Enter to load">
</div>
<ul id="search-results" aria-label="Search Results"
aria-busy="false" aria-expanded="false"
- aria-atomic="false" class="initially-hidden"></ul>
+ aria-atomic="false" aria-live="polite"
+ aria-relevant="all" class="initially-hidden"></ul>
</form>
</div>
diff --git a/lib/rdoc/generator/template/darkfish/css/fonts.css b/lib/rdoc/generator/template/darkfish/fonts.css
index e9e721183b..e9e721183b 100644
--- a/lib/rdoc/generator/template/darkfish/css/fonts.css
+++ b/lib/rdoc/generator/template/darkfish/fonts.css
diff --git a/lib/rdoc/generator/template/darkfish/images/add.png b/lib/rdoc/generator/template/darkfish/images/add.png
index 6332fefea4..6332fefea4 100644..100755
--- a/lib/rdoc/generator/template/darkfish/images/add.png
+++ b/lib/rdoc/generator/template/darkfish/images/add.png
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/images/arrow_up.png b/lib/rdoc/generator/template/darkfish/images/arrow_up.png
index 1ebb193243..1ebb193243 100644..100755
--- a/lib/rdoc/generator/template/darkfish/images/arrow_up.png
+++ b/lib/rdoc/generator/template/darkfish/images/arrow_up.png
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/images/delete.png b/lib/rdoc/generator/template/darkfish/images/delete.png
index 08f249365a..08f249365a 100644..100755
--- a/lib/rdoc/generator/template/darkfish/images/delete.png
+++ b/lib/rdoc/generator/template/darkfish/images/delete.png
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/images/tag_blue.png b/lib/rdoc/generator/template/darkfish/images/tag_blue.png
index 3f02b5f8f8..3f02b5f8f8 100644..100755
--- a/lib/rdoc/generator/template/darkfish/images/tag_blue.png
+++ b/lib/rdoc/generator/template/darkfish/images/tag_blue.png
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js
index b789a65631..06fef3b215 100644
--- a/lib/rdoc/generator/template/darkfish/js/darkfish.js
+++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js
@@ -44,6 +44,14 @@ function hookSourceViews() {
$('.method-heading').click( showSource );
};
+function toggleDebuggingSection() {
+ $('.debugging-section').slideToggle();
+};
+
+function hookDebuggingToggle() {
+ $('#debugging-toggle img').click( toggleDebuggingSection );
+};
+
function hookSearch() {
var input = $('#search-field').eq(0);
var result = $('#search-results').eq(0);
@@ -121,41 +129,12 @@ function highlightClickTarget( event ) {
};
};
-function loadAsync(path, success) {
- $.ajax({
- url: rdoc_rel_prefix + path,
- dataType: 'script',
- success: success,
- cache: true
- });
-};
$(document).ready( function() {
hookSourceViews();
+ hookDebuggingToggle();
+ hookSearch();
highlightLocationTarget();
- $('ul.link-list a').bind( "click", highlightClickTarget );
- var search_scripts_loaded = {
- navigation_loaded: false,
- search_loaded: false,
- search_index_loaded: false,
- searcher_loaded: false,
- }
-
- var search_success_function = function(variable) {
- return (function (data, status, xhr) {
- search_scripts_loaded[variable] = true;
-
- if (search_scripts_loaded['navigation_loaded'] == true &&
- search_scripts_loaded['search_loaded'] == true &&
- search_scripts_loaded['search_index_loaded'] == true &&
- search_scripts_loaded['searcher_loaded'] == true)
- hookSearch();
- });
- }
-
- loadAsync('js/navigation.js', search_success_function('navigation_loaded'));
- loadAsync('js/search.js', search_success_function('search_loaded'));
- loadAsync('js/search_index.js', search_success_function('search_index_loaded'));
- loadAsync('js/searcher.js', search_success_function('searcher_loaded'));
+ $('ul.link-list a').bind( "click", highlightClickTarget );
});
diff --git a/lib/rdoc/generator/template/darkfish/js/jquery.js b/lib/rdoc/generator/template/darkfish/js/jquery.js
index 628ed9b316..48590ecb96 100644
--- a/lib/rdoc/generator/template/darkfish/js/jquery.js
+++ b/lib/rdoc/generator/template/darkfish/js/jquery.js
@@ -1,4 +1,18 @@
-/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
-(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete
-t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean
-(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bC.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bR,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bX(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bX(a,c,d,e,"*",g));return l}function bW(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bN),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bA(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bv:bw;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bg(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(H)return H.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:|^on/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.
+shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j
+)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file
diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js
index 60ac295e6c..563ed7e54e 100644
--- a/lib/rdoc/generator/template/darkfish/js/search.js
+++ b/lib/rdoc/generator/template/darkfish/js/search.js
@@ -14,12 +14,7 @@ Search.prototype = $.extend({}, Navigation, new function() {
this.init = function() {
var _this = this;
- var observer = function(e) {
- switch(e.originalEvent.keyCode) {
- case 38: // Event.KEY_UP
- case 40: // Event.KEY_DOWN
- return;
- }
+ var observer = function() {
_this.search(_this.$input[0].value);
};
this.$input.keyup(observer);
@@ -87,8 +82,6 @@ Search.prototype = $.extend({}, Navigation, new function() {
this.$input.attr('aria-activedescendant', $next.attr('id'));
this.scrollIntoView($next[0], this.$view[0]);
this.$current = $next;
- this.$input.val($next[0].firstChild.firstChild.text);
- this.$input.select();
}
return true;
}
diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/rdoc.css
index 2f4dca7e08..4f22adaae1 100644
--- a/lib/rdoc/generator/template/darkfish/css/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/rdoc.css
@@ -23,22 +23,12 @@ h3 span,
h4 span,
h5 span,
h6 span {
- position: relative;
-
display: none;
padding-left: 1em;
- line-height: 0;
- vertical-align: baseline;
font-size: 10px;
+ vertical-align: super;
}
-h1 span { top: -1.3em; }
-h2 span { top: -1.2em; }
-h3 span { top: -1.0em; }
-h4 span { top: -0.8em; }
-h5 span { top: -0.5em; }
-h6 span { top: -0.5em; }
-
h1:hover span,
h2:hover span,
h3:hover span,
diff --git a/lib/rdoc/generator/template/json_index/js/searcher.js b/lib/rdoc/generator/template/json_index/js/searcher.js
index 0419f2a117..f854b541d0 100644
--- a/lib/rdoc/generator/template/json_index/js/searcher.js
+++ b/lib/rdoc/generator/template/json_index/js/searcher.js
@@ -52,13 +52,13 @@ Searcher.prototype = new function() {
/* ----- Utilities ------ */
function splitQuery(query) {
return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
- return string.match(/\S/);
+ return string.match(/\S/)
});
}
function buildRegexps(queries) {
return jQuery.map(queries, function(query) {
- return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
+ return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i')
});
}
diff --git a/lib/rdoc/ghost_method.rb b/lib/rdoc/ghost_method.rb
index a1f75bfe4b..7eb2d93167 100644
--- a/lib/rdoc/ghost_method.rb
+++ b/lib/rdoc/ghost_method.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# GhostMethod represents a method referenced only by a comment
diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb
deleted file mode 100644
index 20848aad75..0000000000
--- a/lib/rdoc/i18n.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: false
-##
-# This module provides i18n realated features.
-
-module RDoc::I18n
-
- autoload :Locale, 'rdoc/i18n/locale'
- autoload :Text, 'rdoc/i18n/text'
-
-end
diff --git a/lib/rdoc/i18n/locale.rb b/lib/rdoc/i18n/locale.rb
deleted file mode 100644
index 735a271bf3..0000000000
--- a/lib/rdoc/i18n/locale.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-# frozen_string_literal: false
-##
-# A message container for a locale.
-#
-# This object provides the following two features:
-#
-# * Loads translated messages from .po file.
-# * Translates a message into the locale.
-
-class RDoc::I18n::Locale
-
- @@locales = {} # :nodoc:
-
- class << self
-
- ##
- # Returns the locale object for +locale_name+.
-
- def [](locale_name)
- @@locales[locale_name] ||= new(locale_name)
- end
-
- ##
- # Sets the locale object for +locale_name+.
- #
- # Normally, this method is not used. This method is useful for
- # testing.
-
- def []=(locale_name, locale)
- @@locales[locale_name] = locale
- end
-
- end
-
- ##
- # The name of the locale. It uses IETF language tag format
- # +[language[_territory][.codeset][@modifier]]+.
- #
- # See also {BCP 47 - Tags for Identifying
- # Languages}[http://tools.ietf.org/rfc/bcp/bcp47.txt].
-
- attr_reader :name
-
- ##
- # Creates a new locale object for +name+ locale. +name+ must
- # follow IETF language tag format.
-
- def initialize(name)
- @name = name
- @messages = {}
- end
-
- ##
- # Loads translation messages from +locale_directory+/+@name+/rdoc.po
- # or +locale_directory+/+@name+.po. The former has high priority.
- #
- # This method requires gettext gem for parsing .po file. If you
- # don't have gettext gem, this method doesn't load .po file. This
- # method warns and returns +false+.
- #
- # Returns +true+ if succeeded, +false+ otherwise.
-
- def load(locale_directory)
- return false if @name.nil?
-
- po_file_candidates = [
- File.join(locale_directory, @name, 'rdoc.po'),
- File.join(locale_directory, "#{@name}.po"),
- ]
- po_file = po_file_candidates.find do |po_file_candidate|
- File.exist?(po_file_candidate)
- end
- return false unless po_file
-
- begin
- require 'gettext/po_parser'
- require 'gettext/mo'
- rescue LoadError
- warn('Need gettext gem for i18n feature:')
- warn(' gem install gettext')
- return false
- end
-
- po_parser = GetText::POParser.new
- messages = GetText::MO.new
- po_parser.report_warning = false
- po_parser.parse_file(po_file, messages)
-
- @messages.merge!(messages)
-
- true
- end
-
- ##
- # Translates the +message+ into locale. If there is no tranlsation
- # messages for +message+ in locale, +message+ itself is returned.
-
- def translate(message)
- @messages[message] || message
- end
-
-end
diff --git a/lib/rdoc/i18n/text.rb b/lib/rdoc/i18n/text.rb
deleted file mode 100644
index fcfe7611bc..0000000000
--- a/lib/rdoc/i18n/text.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-# frozen_string_literal: false
-##
-# An i18n supported text.
-#
-# This object provides the following two features:
-#
-# * Extracts translation messages from wrapped raw text.
-# * Translates wrapped raw text in specified locale.
-#
-# Wrapped raw text is one of String, RDoc::Comment or Array of them.
-
-class RDoc::I18n::Text
-
- ##
- # Creates a new i18n supported text for +raw+ text.
-
- def initialize(raw)
- @raw = raw
- end
-
- ##
- # Extracts translation target messages and yields each message.
- #
- # Each yielded message is a Hash. It consists of the followings:
- #
- # :type :: :paragraph
- # :paragraph :: String (The translation target message itself.)
- # :line_no :: Integer (The line number of the :paragraph is started.)
- #
- # The above content may be added in the future.
-
- def extract_messages
- parse do |part|
- case part[:type]
- when :empty_line
- # ignore
- when :paragraph
- yield(part)
- end
- end
- end
-
- # Translates raw text into +locale+.
- def translate(locale)
- translated_text = ''
- parse do |part|
- case part[:type]
- when :paragraph
- translated_text << locale.translate(part[:paragraph])
- when :empty_line
- translated_text << part[:line]
- else
- raise "should not reach here: unexpected type: #{type}"
- end
- end
- translated_text
- end
-
- private
- def parse(&block)
- paragraph = ''
- paragraph_start_line = 0
- line_no = 0
-
- each_line(@raw) do |line|
- line_no += 1
- case line
- when /\A\s*\z/
- if paragraph.empty?
- emit_empty_line_event(line, line_no, &block)
- else
- paragraph << line
- emit_paragraph_event(paragraph, paragraph_start_line, line_no,
- &block)
- paragraph = ''
- end
- else
- paragraph_start_line = line_no if paragraph.empty?
- paragraph << line
- end
- end
-
- unless paragraph.empty?
- emit_paragraph_event(paragraph, paragraph_start_line, line_no, &block)
- end
- end
-
- def each_line(raw, &block)
- case raw
- when RDoc::Comment
- raw.text.each_line(&block)
- when Array
- raw.each do |comment, location|
- each_line(comment, &block)
- end
- else
- raw.each_line(&block)
- end
- end
-
- def emit_empty_line_event(line, line_no)
- part = {
- :type => :empty_line,
- :line => line,
- :line_no => line_no,
- }
- yield(part)
- end
-
- def emit_paragraph_event(paragraph, paragraph_start_line, line_no, &block)
- paragraph_part = {
- :type => :paragraph,
- :line_no => paragraph_start_line,
- }
- match_data = /(\s*)\z/.match(paragraph)
- if match_data
- paragraph_part[:paragraph] = match_data.pre_match
- yield(paragraph_part)
- emit_empty_line_event(match_data[1], line_no, &block)
- else
- paragraph_part[:paragraph] = paragraph
- yield(paragraph_part)
- end
- end
-
-end
diff --git a/lib/rdoc/include.rb b/lib/rdoc/include.rb
index efce43bffb..75ed9c7bff 100644
--- a/lib/rdoc/include.rb
+++ b/lib/rdoc/include.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A Module included in a class with \#include
#
diff --git a/lib/rdoc/known_classes.rb b/lib/rdoc/known_classes.rb
index 8d9421255b..ddc932c7c0 100644
--- a/lib/rdoc/known_classes.rb
+++ b/lib/rdoc/known_classes.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module RDoc
##
@@ -60,6 +59,7 @@ module RDoc
"rb_eZeroDivError" => "ZeroDivError",
"rb_mComparable" => "Comparable",
+ "rb_mDL" => "DL",
"rb_mEnumerable" => "Enumerable",
"rb_mErrno" => "Errno",
"rb_mFConst" => "File::Constants",
diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb
index f3d4bd86d0..63c9a9076f 100644
--- a/lib/rdoc/markdown.rb
+++ b/lib/rdoc/markdown.rb
@@ -1,5 +1,4 @@
# coding: UTF-8
-# frozen_string_literal: false
# :markup: markdown
##
@@ -2823,172 +2822,6 @@ class RDoc::Markdown
return _tmp
end
- # HtmlOpenAnchor = "<" Spnl ("a" | "A") Spnl HtmlAttribute* ">"
- def _HtmlOpenAnchor
-
- _save = self.pos
- while true # sequence
- _tmp = match_string("<")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = apply(:_Spnl)
- unless _tmp
- self.pos = _save
- break
- end
-
- _save1 = self.pos
- while true # choice
- _tmp = match_string("a")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("A")
- break if _tmp
- self.pos = _save1
- break
- end # end choice
-
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = apply(:_Spnl)
- unless _tmp
- self.pos = _save
- break
- end
- while true
- _tmp = apply(:_HtmlAttribute)
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string(">")
- unless _tmp
- self.pos = _save
- end
- break
- end # end sequence
-
- set_failed_rule :_HtmlOpenAnchor unless _tmp
- return _tmp
- end
-
- # HtmlCloseAnchor = "<" Spnl "/" ("a" | "A") Spnl ">"
- def _HtmlCloseAnchor
-
- _save = self.pos
- while true # sequence
- _tmp = match_string("<")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = apply(:_Spnl)
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string("/")
- unless _tmp
- self.pos = _save
- break
- end
-
- _save1 = self.pos
- while true # choice
- _tmp = match_string("a")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("A")
- break if _tmp
- self.pos = _save1
- break
- end # end choice
-
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = apply(:_Spnl)
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string(">")
- unless _tmp
- self.pos = _save
- end
- break
- end # end sequence
-
- set_failed_rule :_HtmlCloseAnchor unless _tmp
- return _tmp
- end
-
- # HtmlAnchor = HtmlOpenAnchor (HtmlAnchor | !HtmlCloseAnchor .)* HtmlCloseAnchor
- def _HtmlAnchor
-
- _save = self.pos
- while true # sequence
- _tmp = apply(:_HtmlOpenAnchor)
- unless _tmp
- self.pos = _save
- break
- end
- while true
-
- _save2 = self.pos
- while true # choice
- _tmp = apply(:_HtmlAnchor)
- break if _tmp
- self.pos = _save2
-
- _save3 = self.pos
- while true # sequence
- _save4 = self.pos
- _tmp = apply(:_HtmlCloseAnchor)
- _tmp = _tmp ? nil : true
- self.pos = _save4
- unless _tmp
- self.pos = _save3
- break
- end
- _tmp = get_byte
- unless _tmp
- self.pos = _save3
- end
- break
- end # end sequence
-
- break if _tmp
- self.pos = _save2
- break
- end # end choice
-
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = apply(:_HtmlCloseAnchor)
- unless _tmp
- self.pos = _save
- end
- break
- end # end sequence
-
- set_failed_rule :_HtmlAnchor unless _tmp
- return _tmp
- end
-
# HtmlBlockOpenAddress = "<" Spnl ("address" | "ADDRESS") Spnl HtmlAttribute* ">"
def _HtmlBlockOpenAddress
@@ -8456,14 +8289,11 @@ class RDoc::Markdown
return _tmp
end
- # HtmlBlockInTags = (HtmlAnchor | HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript)
+ # HtmlBlockInTags = (HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript)
def _HtmlBlockInTags
_save = self.pos
while true # choice
- _tmp = apply(:_HtmlAnchor)
- break if _tmp
- self.pos = _save
_tmp = apply(:_HtmlBlockAddress)
break if _tmp
self.pos = _save
@@ -15918,9 +15748,6 @@ class RDoc::Markdown
Rules[:_Enumerator] = rule_info("Enumerator", "@NonindentSpace [0-9]+ \".\" @Spacechar+")
Rules[:_OrderedList] = rule_info("OrderedList", "&Enumerator (ListTight | ListLoose):a { RDoc::Markup::List.new(:NUMBER, *a) }")
Rules[:_ListBlockLine] = rule_info("ListBlockLine", "!@BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine")
- Rules[:_HtmlOpenAnchor] = rule_info("HtmlOpenAnchor", "\"<\" Spnl (\"a\" | \"A\") Spnl HtmlAttribute* \">\"")
- Rules[:_HtmlCloseAnchor] = rule_info("HtmlCloseAnchor", "\"<\" Spnl \"/\" (\"a\" | \"A\") Spnl \">\"")
- Rules[:_HtmlAnchor] = rule_info("HtmlAnchor", "HtmlOpenAnchor (HtmlAnchor | !HtmlCloseAnchor .)* HtmlCloseAnchor")
Rules[:_HtmlBlockOpenAddress] = rule_info("HtmlBlockOpenAddress", "\"<\" Spnl (\"address\" | \"ADDRESS\") Spnl HtmlAttribute* \">\"")
Rules[:_HtmlBlockCloseAddress] = rule_info("HtmlBlockCloseAddress", "\"<\" Spnl \"/\" (\"address\" | \"ADDRESS\") Spnl \">\"")
Rules[:_HtmlBlockAddress] = rule_info("HtmlBlockAddress", "HtmlBlockOpenAddress (HtmlBlockAddress | !HtmlBlockCloseAddress .)* HtmlBlockCloseAddress")
@@ -16020,7 +15847,7 @@ class RDoc::Markdown
Rules[:_HtmlBlockOpenScript] = rule_info("HtmlBlockOpenScript", "\"<\" Spnl (\"script\" | \"SCRIPT\") Spnl HtmlAttribute* \">\"")
Rules[:_HtmlBlockCloseScript] = rule_info("HtmlBlockCloseScript", "\"<\" Spnl \"/\" (\"script\" | \"SCRIPT\") Spnl \">\"")
Rules[:_HtmlBlockScript] = rule_info("HtmlBlockScript", "HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript")
- Rules[:_HtmlBlockInTags] = rule_info("HtmlBlockInTags", "(HtmlAnchor | HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript)")
+ Rules[:_HtmlBlockInTags] = rule_info("HtmlBlockInTags", "(HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlockOl | HtmlBlockP | HtmlBlockPre | HtmlBlockTable | HtmlBlockUl | HtmlBlockDd | HtmlBlockDt | HtmlBlockFrameset | HtmlBlockLi | HtmlBlockTbody | HtmlBlockTd | HtmlBlockTfoot | HtmlBlockTh | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript)")
Rules[:_HtmlBlock] = rule_info("HtmlBlock", "< (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ { if html? then RDoc::Markup::Raw.new text end }")
Rules[:_HtmlUnclosed] = rule_info("HtmlUnclosed", "\"<\" Spnl HtmlUnclosedType Spnl HtmlAttribute* Spnl \">\"")
Rules[:_HtmlUnclosedType] = rule_info("HtmlUnclosedType", "(\"HR\" | \"hr\")")
diff --git a/lib/rdoc/markdown/entities.rb b/lib/rdoc/markdown/entities.rb
index d32ae51053..0661abab78 100644
--- a/lib/rdoc/markdown/entities.rb
+++ b/lib/rdoc/markdown/entities.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# HTML entity name map for RDoc::Markdown
diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals_1_9.rb
index d7a27f12b1..f7bfbe27a1 100644
--- a/lib/rdoc/markdown/literals_1_9.rb
+++ b/lib/rdoc/markdown/literals_1_9.rb
@@ -1,5 +1,4 @@
# coding: UTF-8
-# frozen_string_literal: false
# :markup: markdown
##
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index 3406522596..e1d75fa52b 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# RDoc::Markup parses plain text documents and attempts to decompose them into
# their constituent parts. Some of these parts are high-level: paragraphs,
@@ -85,7 +84,7 @@
#
# markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
#
-# wh = WikiHtml.new RDoc::Options.new, markup
+# wh = WikiHtml.new markup
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
#
# puts "<body>#{wh.convert ARGF.read}</body>"
@@ -164,7 +163,7 @@
#
# The header's id would be:
#
-# <h1 id="method-i-do_fun_things-label-Example">Example</h1>
+# <h1 id="method-i-do_fun_things-label-Example">Example</h3>
#
# The label can be linked-to using <tt>SomeClass@Headers</tt>. See
# {Links}[RDoc::Markup@Links] for further details.
diff --git a/lib/rdoc/markup/attr_changer.rb b/lib/rdoc/markup/attr_changer.rb
index 9a1a9c8c66..1772f18b2b 100644
--- a/lib/rdoc/markup/attr_changer.rb
+++ b/lib/rdoc/markup/attr_changer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
class RDoc::Markup
AttrChanger = Struct.new :turn_on, :turn_off # :nodoc:
diff --git a/lib/rdoc/markup/attr_span.rb b/lib/rdoc/markup/attr_span.rb
index 4d9e5b0217..b5c1b3b7b7 100644
--- a/lib/rdoc/markup/attr_span.rb
+++ b/lib/rdoc/markup/attr_span.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# An array of attributes which parallels the characters in a string.
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index 3296d17af2..c5a50d519c 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Manages changes of attributes in a block of text
@@ -131,7 +130,7 @@ class RDoc::Markup::AttributeManager
# first do matching ones
tags = @matching_word_pairs.keys.join("")
- re = /(^|\W)([#{tags}])([#\\]?[\w:.\/-]+?\S?)\2(\W|$)/
+ re = /(^|\W)([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/
1 while str.gsub!(re) do
attr = @matching_word_pairs[$2]
diff --git a/lib/rdoc/markup/attributes.rb b/lib/rdoc/markup/attributes.rb
index 8776c4ed29..3423f10ca7 100644
--- a/lib/rdoc/markup/attributes.rb
+++ b/lib/rdoc/markup/attributes.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# We manage a set of attributes. Each attribute has a symbol name and a bit
# value.
diff --git a/lib/rdoc/markup/blank_line.rb b/lib/rdoc/markup/blank_line.rb
index 2b1ab91b47..5da0ac8d81 100644
--- a/lib/rdoc/markup/blank_line.rb
+++ b/lib/rdoc/markup/blank_line.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# An empty line. This class is a singleton.
diff --git a/lib/rdoc/markup/block_quote.rb b/lib/rdoc/markup/block_quote.rb
index 3be022f9dd..552f0c4baa 100644
--- a/lib/rdoc/markup/block_quote.rb
+++ b/lib/rdoc/markup/block_quote.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A quoted section which contains markup items.
diff --git a/lib/rdoc/markup/document.rb b/lib/rdoc/markup/document.rb
index 0692c3522f..be93d80eec 100644
--- a/lib/rdoc/markup/document.rb
+++ b/lib/rdoc/markup/document.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A Document containing lists, headings, paragraphs, etc.
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index 197ff003e3..7661c95239 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Base class for RDoc markup formatters
#
diff --git a/lib/rdoc/markup/formatter_test_case.rb b/lib/rdoc/markup/formatter_test_case.rb
index 776fe00537..6616a75898 100644
--- a/lib/rdoc/markup/formatter_test_case.rb
+++ b/lib/rdoc/markup/formatter_test_case.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'minitest/unit'
##
diff --git a/lib/rdoc/markup/hard_break.rb b/lib/rdoc/markup/hard_break.rb
index 5898bfb644..8445ad26e7 100644
--- a/lib/rdoc/markup/hard_break.rb
+++ b/lib/rdoc/markup/hard_break.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A hard-break in the middle of a paragraph.
diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb
index 5229287d5b..535e310e54 100644
--- a/lib/rdoc/markup/heading.rb
+++ b/lib/rdoc/markup/heading.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A heading with a level (1-6) and text
diff --git a/lib/rdoc/markup/include.rb b/lib/rdoc/markup/include.rb
index 891be71b85..a2e8903279 100644
--- a/lib/rdoc/markup/include.rb
+++ b/lib/rdoc/markup/include.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A file included at generation time. Objects of this class are created by
# RDoc::RD for an extension-less include.
diff --git a/lib/rdoc/markup/indented_paragraph.rb b/lib/rdoc/markup/indented_paragraph.rb
index 56a96bd3c9..1b8a8c725d 100644
--- a/lib/rdoc/markup/indented_paragraph.rb
+++ b/lib/rdoc/markup/indented_paragraph.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# An Indented Paragraph of text
diff --git a/lib/rdoc/markup/inline.rb b/lib/rdoc/markup/inline.rb
index 58072fef06..fb3ab5c74d 100644
--- a/lib/rdoc/markup/inline.rb
+++ b/lib/rdoc/markup/inline.rb
@@ -1,2 +1 @@
-# frozen_string_literal: false
warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w
diff --git a/lib/rdoc/markup/list.rb b/lib/rdoc/markup/list.rb
index bcaea7d7c1..89b7fc20fa 100644
--- a/lib/rdoc/markup/list.rb
+++ b/lib/rdoc/markup/list.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A List is a homogeneous set of ListItems.
#
diff --git a/lib/rdoc/markup/list_item.rb b/lib/rdoc/markup/list_item.rb
index 115ec0412c..c5e59fe167 100644
--- a/lib/rdoc/markup/list_item.rb
+++ b/lib/rdoc/markup/list_item.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# An item within a List that contains paragraphs, headings, etc.
#
diff --git a/lib/rdoc/markup/paragraph.rb b/lib/rdoc/markup/paragraph.rb
index fefa12f9ef..7180729f75 100644
--- a/lib/rdoc/markup/paragraph.rb
+++ b/lib/rdoc/markup/paragraph.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A Paragraph of text
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index 2f8b7628e2..cc828a4513 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'strscan'
##
diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb
index d7cef36158..01fb293462 100644
--- a/lib/rdoc/markup/pre_process.rb
+++ b/lib/rdoc/markup/pre_process.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Handle common directives that can occur in a block of text:
#
diff --git a/lib/rdoc/markup/raw.rb b/lib/rdoc/markup/raw.rb
index 8012d2cea6..e11e8efff4 100644
--- a/lib/rdoc/markup/raw.rb
+++ b/lib/rdoc/markup/raw.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A section of text that is added to the output document as-is
diff --git a/lib/rdoc/markup/rule.rb b/lib/rdoc/markup/rule.rb
index b96d4fb293..b778f2bc09 100644
--- a/lib/rdoc/markup/rule.rb
+++ b/lib/rdoc/markup/rule.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A horizontal rule with a weight
diff --git a/lib/rdoc/markup/special.rb b/lib/rdoc/markup/special.rb
index 4d834b9e37..1c0fc03eea 100644
--- a/lib/rdoc/markup/special.rb
+++ b/lib/rdoc/markup/special.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Hold details of a special sequence
diff --git a/lib/rdoc/markup/text_formatter_test_case.rb b/lib/rdoc/markup/text_formatter_test_case.rb
index 1c8882aa36..4abf42563b 100644
--- a/lib/rdoc/markup/text_formatter_test_case.rb
+++ b/lib/rdoc/markup/text_formatter_test_case.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Test case for creating new plain-text RDoc::Markup formatters. See also
# RDoc::Markup::FormatterTestCase
diff --git a/lib/rdoc/markup/to_ansi.rb b/lib/rdoc/markup/to_ansi.rb
index 56cd1fe446..4d439ce88d 100644
--- a/lib/rdoc/markup/to_ansi.rb
+++ b/lib/rdoc/markup/to_ansi.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Outputs RDoc markup with vibrant ANSI color!
diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb
index d55f64c5e7..10c31854d2 100644
--- a/lib/rdoc/markup/to_bs.rb
+++ b/lib/rdoc/markup/to_bs.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Outputs RDoc markup with hot backspace action! You will probably need a
# pager to use this output format.
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 3bf66c2c31..823b023e72 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'cgi'
##
@@ -287,7 +286,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
@res << to_html(heading.text)
unless @options.pipe then
@res << "<span><a href=\"##{label}\">&para;</a>"
- @res << " <a href=\"#top\">&uarr;</a></span>"
+ @res << " <a href=\"#documentation\">&uarr;</a></span>"
end
@res << "</h#{level}>\n"
end
@@ -380,12 +379,11 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
##
- # Returns true if text is valid ruby syntax
+ # Returns true if Ripper is available it can create a sexp from +text+
def parseable? text
- eval("BEGIN {return true}\n#{text}")
- rescue SyntaxError
- false
+ text =~ /\b(def|class|module|require) |=>|\{\s?\||do \|/ and
+ text !~ /<%|%>/
end
##
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index 3f03c65898..d27e0ab627 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Subclass of the RDoc::Markup::ToHtml class that supports looking up method
# names, classes, etc to create links. RDoc::CrossReference is used to
diff --git a/lib/rdoc/markup/to_html_snippet.rb b/lib/rdoc/markup/to_html_snippet.rb
index 75c1df94d9..4ad0a9a4b9 100644
--- a/lib/rdoc/markup/to_html_snippet.rb
+++ b/lib/rdoc/markup/to_html_snippet.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Outputs RDoc markup as paragraphs with inline markup only.
diff --git a/lib/rdoc/markup/to_joined_paragraph.rb b/lib/rdoc/markup/to_joined_paragraph.rb
index 293258c092..835841071d 100644
--- a/lib/rdoc/markup/to_joined_paragraph.rb
+++ b/lib/rdoc/markup/to_joined_paragraph.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Joins the parts of an RDoc::Markup::Paragraph into a single String.
#
diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb
index bdf08b7aee..ace89c324a 100644
--- a/lib/rdoc/markup/to_label.rb
+++ b/lib/rdoc/markup/to_label.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'cgi'
##
@@ -32,7 +31,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
def convert text
label = convert_flow @am.flow text
- CGI.escape(label).gsub('%', '-').sub(/^-/, '')
+ CGI.escape label
end
##
diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb
index 9074547b4c..d4b15bf41b 100644
--- a/lib/rdoc/markup/to_markdown.rb
+++ b/lib/rdoc/markup/to_markdown.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# :markup: markdown
##
diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb
index a40c09859f..f16b4ed5a3 100644
--- a/lib/rdoc/markup/to_rdoc.rb
+++ b/lib/rdoc/markup/to_rdoc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Outputs RDoc markup as RDoc markup! (mostly)
diff --git a/lib/rdoc/markup/to_table_of_contents.rb b/lib/rdoc/markup/to_table_of_contents.rb
index eae7c59d94..2e0f98cfeb 100644
--- a/lib/rdoc/markup/to_table_of_contents.rb
+++ b/lib/rdoc/markup/to_table_of_contents.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Extracts just the RDoc::Markup::Heading elements from a
# RDoc::Markup::Document to help build a table of contents
diff --git a/lib/rdoc/markup/to_test.rb b/lib/rdoc/markup/to_test.rb
index 7b1fa8c630..c51f64b917 100644
--- a/lib/rdoc/markup/to_test.rb
+++ b/lib/rdoc/markup/to_test.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# This Markup outputter is used for testing purposes.
diff --git a/lib/rdoc/markup/to_tt_only.rb b/lib/rdoc/markup/to_tt_only.rb
index ba20fcdd00..e2da20c6f3 100644
--- a/lib/rdoc/markup/to_tt_only.rb
+++ b/lib/rdoc/markup/to_tt_only.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Extracts sections of text enclosed in plus, tt or code. Used to discover
# undocumented parameters.
diff --git a/lib/rdoc/markup/verbatim.rb b/lib/rdoc/markup/verbatim.rb
index a0b1d05928..0ddde675e3 100644
--- a/lib/rdoc/markup/verbatim.rb
+++ b/lib/rdoc/markup/verbatim.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A section of verbatim text
diff --git a/lib/rdoc/meta_method.rb b/lib/rdoc/meta_method.rb
index 408c089dd1..68ba8109e0 100644
--- a/lib/rdoc/meta_method.rb
+++ b/lib/rdoc/meta_method.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# MetaMethod represents a meta-programmed method
diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb
index 50eab141be..8bde102640 100644
--- a/lib/rdoc/method_attr.rb
+++ b/lib/rdoc/method_attr.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Abstract class representing either a method or an attribute.
@@ -111,15 +110,12 @@ class RDoc::MethodAttr < RDoc::CodeObject
# Order by #singleton then #name
def <=>(other)
- return unless other.respond_to?(:singleton) &&
- other.respond_to?(:name)
-
[ @singleton ? 0 : 1, name] <=>
[other.singleton ? 0 : 1, other.name]
end
def == other # :nodoc:
- equal?(other) or self.class == other.class and full_name == other.full_name
+ super or self.class == other.class and full_name == other.full_name
end
##
@@ -185,8 +181,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
parent != kernel && !searched.include?(kernel)
searched.each do |ancestor|
- next if String === ancestor
next if parent == ancestor
+ next if String === ancestor
other = ancestor.find_method_named('#' << name) ||
ancestor.find_attribute_named(name)
@@ -362,12 +358,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
def pretty_print q # :nodoc:
- alias_for =
- if @is_alias_for.respond_to? :name then
- "alias for #{@is_alias_for.name}"
- elsif Array === @is_alias_for then
- "alias for #{@is_alias_for.last}"
- end
+ alias_for = @is_alias_for ? "alias for #{@is_alias_for.name}" : nil
q.group 2, "[#{self.class.name} #{full_name} #{visibility}", "]" do
if alias_for then
diff --git a/lib/rdoc/mixin.rb b/lib/rdoc/mixin.rb
index 14f04c15e7..547744f870 100644
--- a/lib/rdoc/mixin.rb
+++ b/lib/rdoc/mixin.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A Mixin adds features from a module into another context. RDoc::Include and
# RDoc::Extend are both mixins.
diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb
index eb53e964dd..7589e2686c 100644
--- a/lib/rdoc/normal_class.rb
+++ b/lib/rdoc/normal_class.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A normal class, neither singleton nor anonymous
diff --git a/lib/rdoc/normal_module.rb b/lib/rdoc/normal_module.rb
index d046c8cbfe..961c431ed6 100644
--- a/lib/rdoc/normal_module.rb
+++ b/lib/rdoc/normal_module.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A normal module, like NormalClass
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 17b0bb105d..e27be89dbf 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'optparse'
require 'pathname'
@@ -215,16 +214,6 @@ class RDoc::Options
attr_accessor :line_numbers
##
- # The output locale.
-
- attr_accessor :locale
-
- ##
- # The directory where locale data live.
-
- attr_accessor :locale_dir
-
- ##
# Name of the file, class or module to display in the initial index page (if
# not specified the first file we encounter is used)
@@ -336,7 +325,7 @@ class RDoc::Options
# other visibilities may be overridden on a per-method basis with the :doc:
# directive.
- attr_reader :visibility
+ attr_accessor :visibility
def initialize # :nodoc:
init_ivars
@@ -354,9 +343,6 @@ class RDoc::Options
@generators = RDoc::RDoc::GENERATORS
@hyperlink_all = false
@line_numbers = false
- @locale = nil
- @locale_name = nil
- @locale_dir = 'locale'
@main_page = nil
@markup = 'rdoc'
@coverage_report = false
@@ -402,8 +388,6 @@ class RDoc::Options
@generator_name = map['generator_name']
@hyperlink_all = map['hyperlink_all']
@line_numbers = map['line_numbers']
- @locale_name = map['locale_name']
- @locale_dir = map['locale_dir']
@main_page = map['main_page']
@markup = map['markup']
@op_dir = map['op_dir']
@@ -428,8 +412,6 @@ class RDoc::Options
@generator_name == other.generator_name and
@hyperlink_all == other.hyperlink_all and
@line_numbers == other.line_numbers and
- @locale == other.locale and
- @locale_dir == other.locale_dir and
@main_page == other.main_page and
@markup == other.markup and
@op_dir == other.op_dir and
@@ -533,13 +515,6 @@ class RDoc::Options
@template_dir = template_dir_for @template
end
- if @locale_name
- @locale = RDoc::I18n::Locale[@locale_name]
- @locale.load(@locale_dir)
- else
- @locale = nil
- end
-
self
end
@@ -702,19 +677,6 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
end
-
- opt.on("--locale=NAME",
- "Specifies the output locale.") do |value|
- @locale_name = value
- end
-
- opt.on("--locale-data-dir=DIR",
- "Specifies the directory where locale data live.") do |value|
- @locale_dir = value
- end
-
- opt.separator nil
-
opt.on("--all", "-a",
"Synonym for --visibility=private.") do |value|
@visibility = :private
@@ -1054,7 +1016,8 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--help", "-h", "Display this help") do
+ opt.on("--help",
+ "Display this help") do
RDoc::RDoc::GENERATORS.each_key do |generator|
setup_generator generator
end
@@ -1211,22 +1174,6 @@ Usage: #{opt.program_name} [options] [names...]
end
end
- # Sets the minimum visibility of a documented method.
- #
- # Accepts +:public+, +:protected+, +:private+, +:nodoc+, or +:all+.
- #
- # When +:all+ is passed, visibility is set to +:private+, similarly to
- # RDOCOPT="--all", see #visibility for more information.
-
- def visibility= visibility
- case visibility
- when :all
- @visibility = :private
- else
- @visibility = visibility
- end
- end
-
##
# Displays a warning using Kernel#warn if we're being verbose
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 9c207edcff..5c6a0a8983 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -1,5 +1,4 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
##
# A parser is simple a class that subclasses RDoc::Parser and implements #scan
@@ -84,7 +83,7 @@ class RDoc::Parser
mode = "r"
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
- mode = "rb:#{encoding}" if encoding
+ mode = "r:#{encoding}" if encoding
s = File.open(file, mode) {|f| f.gets(nil, 1024)}
not s.valid_encoding?
@@ -269,11 +268,9 @@ class RDoc::Parser
markup = Regexp.escape markup
- _, selected = RDoc::Parser.parsers.find do |_, parser|
+ RDoc::Parser.parsers.find do |_, parser|
/^#{markup}$/i =~ parser.name.sub(/.*:/, '')
- end
-
- selected
+ end.last
end
##
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index cd139441ba..f7d0a9afa0 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'tsort'
##
@@ -595,10 +594,9 @@ class RDoc::Parser::C < RDoc::Parser
\s*#{attr_name}\s*,
#{rw},.*?\)\s*;%xm then
$1
- elsif @content =~ %r%(/\*.*?(?:\s*\*\s*)?)
- Document-attr:\s#{attr_name}\s*?\n
- ((?>(.|\n)*?\*/))%x then
- "#{$1}\n#{$2}"
+ elsif @content =~ %r%Document-attr:\s#{attr_name}\s*?\n
+ ((?>.*?\*/))%xm then
+ $1
else
''
end
@@ -612,7 +610,7 @@ class RDoc::Parser::C < RDoc::Parser
def find_body class_name, meth_name, meth_obj, file_content, quiet = false
case file_content
when %r%((?>/\*.*?\*/\s*)?)
- ((?:(?:\w+)\s+)?
+ ((?:(?:static|SWIGINTERN)\s+)?
(?:intern\s+)?VALUE\s+#{meth_name}
\s*(\([^)]*\))([^;]|$))%xm then
comment = RDoc::Comment.new $1, @top_level
@@ -746,11 +744,11 @@ class RDoc::Parser::C < RDoc::Parser
elsif @content =~ %r%Document-(?:class|module):\s+#{class_name}\s*?
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then
comment = "/*\n#{$1}"
- elsif @content =~ %r%((?>/\*.*?\*/\s+))
- ([\w\.\s]+\s* = \s+)?rb_define_(class|module)[\t (]*?"(#{class_name})"%xm then
+ elsif @content =~ %r%.*((?>/\*.*?\*/\s+))
+ ([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(#{class_name})"%xm then
comment = $1
- elsif @content =~ %r%((?>/\*.*?\*/\s+))
- ([\w\. \t]+ = \s+)?rb_define_(class|module)_under[\t\w, (]*?"(#{class_name.split('::').last})"%xm then
+ elsif @content =~ %r%.*((?>/\*.*?\*/\s+))
+ ([\w\.\s]+\s* = \s+)?rb_define_(class|module)_under.*?"(#{class_name.split('::').last})"%xm then
comment = $1
else
comment = ''
@@ -1187,6 +1185,7 @@ class RDoc::Parser::C < RDoc::Parser
if hash then
args << "p#{position} = {}"
+ position += 1
end
args << '&block' if block
diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb
index 92c8d94ad6..782d8f09bf 100644
--- a/lib/rdoc/parser/changelog.rb
+++ b/lib/rdoc/parser/changelog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'time'
##
@@ -146,14 +145,10 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
# HACK Ruby 1.8 does not raise ArgumentError for Time.parse "Other"
entry_name = nil unless entry_name =~ /#{time.year}/
rescue NoMethodError
- # HACK Ruby 2.1.2 and earlier raises NoMethodError if time part is absent
- entry_name.split ' ', 2
+ time, = entry_name.split ' ', 2
+ time = Time.parse time
rescue ArgumentError
- if /out of range/ =~ $!.message
- Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil
- else
- entry_name = nil
- end
+ entry_name = nil
end
entry_body = []
diff --git a/lib/rdoc/parser/markdown.rb b/lib/rdoc/parser/markdown.rb
index feffb26ced..6fd88cf614 100644
--- a/lib/rdoc/parser/markdown.rb
+++ b/lib/rdoc/parser/markdown.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Parse a Markdown format file. The parsed RDoc::Markup::Document is attached
# as a file comment.
diff --git a/lib/rdoc/parser/rd.rb b/lib/rdoc/parser/rd.rb
index e6693b9ac8..09069ae297 100644
--- a/lib/rdoc/parser/rd.rb
+++ b/lib/rdoc/parser/rd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Parse a RD format file. The parsed RDoc::Markup::Document is attached as a
# file comment.
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index ac7094f488..1c4b637640 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# This file contains stuff stolen outright from:
#
@@ -188,16 +187,15 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Extracts the visibility information for the visibility token +tk+
- # and +single+ class type identifier.
+ # Extracts the visibility information for the visibility token +tk+.
#
# Returns the visibility type (a string), the visibility (a symbol) and
# +singleton+ if the methods following should be converted to singleton
# methods.
- def get_visibility_information tk, single # :nodoc:
+ def get_visibility_information tk # :nodoc:
vis_type = tk.name
- singleton = single == SINGLE
+ singleton = false
vis =
case vis_type
@@ -228,7 +226,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
comment = ''
comment.force_encoding @encoding if @encoding
first_line = true
- first_comment_tk_class = nil
tk = get_tk
@@ -241,9 +238,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
skip_tkspace
tk = get_tk
else
- break if first_comment_tk_class and not first_comment_tk_class === tk
- first_comment_tk_class = tk.class
-
first_line = false
comment << tk.text << "\n"
tk = get_tk
@@ -847,6 +841,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
# true, no found constants will be added to RDoc.
def parse_constant container, tk, comment, ignore_constants = false
+ prev_container = container
offset = tk.seek
line_no = tk.line_no
@@ -869,6 +864,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
unless TkASSIGN === eq_tk then
+ suppress_parents container, prev_container
+
unget_tk eq_tk
return false
end
@@ -892,7 +889,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
@stats.add_constant con
- container.add_constant con
+ con = container.add_constant con
true
end
@@ -1308,7 +1305,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
return unless name
meth = RDoc::AnyMethod.new get_tkread, name
- meth.singleton = single == SINGLE ? true : singleton
+ meth.singleton = singleton
record_location meth
meth.offset = offset
@@ -1878,7 +1875,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Determines the visibility in +container+ from +tk+
def parse_visibility(container, single, tk)
- vis_type, vis, singleton = get_visibility_information tk, single
+ singleton = (single == SINGLE)
+
+ vis_type, vis, singleton = get_visibility_information tk
skip_tkspace_comment false
@@ -2079,7 +2078,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
def skip_for_variable
skip_tkspace false
- get_tk
+ tk = get_tk
skip_tkspace false
tk = get_tk
unget_tk(tk) unless TkIN === tk
diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb
index bbca065b5e..654431ea30 100644
--- a/lib/rdoc/parser/ruby_tools.rb
+++ b/lib/rdoc/parser/ruby_tools.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Collection of methods for writing parsers against RDoc::RubyLex and
# RDoc::RubyToken
diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb
index 73bb7bdffb..65cfc1b2e7 100644
--- a/lib/rdoc/parser/simple.rb
+++ b/lib/rdoc/parser/simple.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Parse a non-source file. We basically take the whole thing as one big
# comment.
diff --git a/lib/rdoc/parser/text.rb b/lib/rdoc/parser/text.rb
index 1a13fd1186..f973313551 100644
--- a/lib/rdoc/parser/text.rb
+++ b/lib/rdoc/parser/text.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Indicates this parser is text and doesn't contain code constructs.
#
diff --git a/lib/rdoc/rd.rb b/lib/rdoc/rd.rb
index 39af3294f5..28c5d286e0 100644
--- a/lib/rdoc/rd.rb
+++ b/lib/rdoc/rd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# RDoc::RD implements the RD format from the rdtool gem.
#
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb
index 111ba90fdc..dd15e1262e 100644
--- a/lib/rdoc/rd/block_parser.rb
+++ b/lib/rdoc/rd/block_parser.rb
@@ -1,7 +1,6 @@
-# frozen_string_literal: false
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.4.12
+# This file is automatically generated by Racc 1.4.9
# from Racc grammer file "".
#
@@ -145,9 +144,9 @@ def next_token # :nodoc:
# call filter, part_out is output(Part object)
part_out = @tree.filter[@in_part].call(part)
- if @tree.filter[@in_part].mode == :rd # if output is RD formatted
+ if @tree.filter[@in_part].mode == :rd # if output is RD formated
subtree = parse_subtree(part_out.to_a)
- else # if output is target formatted
+ else # if output is target formated
basename = TMPFILE.join('.')
TMPFILE[-1] += 1
tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
diff --git a/lib/rdoc/rd/inline.rb b/lib/rdoc/rd/inline.rb
index 011ec67e33..ee724fb80f 100644
--- a/lib/rdoc/rd/inline.rb
+++ b/lib/rdoc/rd/inline.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Inline keeps track of markup and labels to create proper links.
diff --git a/lib/rdoc/rd/inline_parser.rb b/lib/rdoc/rd/inline_parser.rb
index 240f68ba13..c3c1f4b030 100644
--- a/lib/rdoc/rd/inline_parser.rb
+++ b/lib/rdoc/rd/inline_parser.rb
@@ -1,7 +1,6 @@
-# frozen_string_literal: false
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.4.12
+# This file is automatically generated by Racc 1.4.9
# from Racc grammer file "".
#
diff --git a/lib/rdoc/rdoc.gemspec b/lib/rdoc/rdoc.gemspec
deleted file mode 100644
index e1631e2cc1..0000000000
--- a/lib/rdoc/rdoc.gemspec
+++ /dev/null
@@ -1,7 +0,0 @@
-Gem::Specification.new do |s|
- s.name = "rdoc"
- s.version = "4.2.1"
- s.summary = "This rdoc is bundled with Ruby"
- s.executables = ["rdoc", "ri"]
- s.files = ["rdoc.rb", "rdoc/alias.rb", "rdoc/anon_class.rb", "rdoc/any_method.rb", "rdoc/attr.rb", "rdoc/class_module.rb", "rdoc/code_object.rb", "rdoc/code_objects.rb", "rdoc/comment.rb", "rdoc/constant.rb", "rdoc/context.rb", "rdoc/context/section.rb", "rdoc/cross_reference.rb", "rdoc/encoding.rb", "rdoc/erb_partial.rb", "rdoc/erbio.rb", "rdoc/extend.rb", "rdoc/generator.rb", "rdoc/generator/darkfish.rb", "rdoc/generator/json_index.rb", "rdoc/generator/markup.rb", "rdoc/generator/pot.rb", "rdoc/generator/pot/message_extractor.rb", "rdoc/generator/pot/po.rb", "rdoc/generator/pot/po_entry.rb", "rdoc/generator/ri.rb", "rdoc/ghost_method.rb", "rdoc/i18n.rb", "rdoc/i18n/locale.rb", "rdoc/i18n/text.rb", "rdoc/include.rb", "rdoc/known_classes.rb", "rdoc/markdown.rb", "rdoc/markdown/entities.rb", "rdoc/markdown/literals_1_9.rb", "rdoc/markup.rb", "rdoc/markup/attr_changer.rb", "rdoc/markup/attr_span.rb", "rdoc/markup/attribute_manager.rb", "rdoc/markup/attributes.rb", "rdoc/markup/blank_line.rb", "rdoc/markup/block_quote.rb", "rdoc/markup/document.rb", "rdoc/markup/formatter.rb", "rdoc/markup/formatter_test_case.rb", "rdoc/markup/hard_break.rb", "rdoc/markup/heading.rb", "rdoc/markup/include.rb", "rdoc/markup/indented_paragraph.rb", "rdoc/markup/inline.rb", "rdoc/markup/list.rb", "rdoc/markup/list_item.rb", "rdoc/markup/paragraph.rb", "rdoc/markup/parser.rb", "rdoc/markup/pre_process.rb", "rdoc/markup/raw.rb", "rdoc/markup/rule.rb", "rdoc/markup/special.rb", "rdoc/markup/text_formatter_test_case.rb", "rdoc/markup/to_ansi.rb", "rdoc/markup/to_bs.rb", "rdoc/markup/to_html.rb", "rdoc/markup/to_html_crossref.rb", "rdoc/markup/to_html_snippet.rb", "rdoc/markup/to_joined_paragraph.rb", "rdoc/markup/to_label.rb", "rdoc/markup/to_markdown.rb", "rdoc/markup/to_rdoc.rb", "rdoc/markup/to_table_of_contents.rb", "rdoc/markup/to_test.rb", "rdoc/markup/to_tt_only.rb", "rdoc/markup/verbatim.rb", "rdoc/meta_method.rb", "rdoc/method_attr.rb", "rdoc/mixin.rb", "rdoc/normal_class.rb", "rdoc/normal_module.rb", "rdoc/options.rb", "rdoc/parser.rb", "rdoc/parser/c.rb", "rdoc/parser/changelog.rb", "rdoc/parser/markdown.rb", "rdoc/parser/rd.rb", "rdoc/parser/ruby.rb", "rdoc/parser/ruby_tools.rb", "rdoc/parser/simple.rb", "rdoc/parser/text.rb", "rdoc/rd.rb", "rdoc/rd/block_parser.rb", "rdoc/rd/inline.rb", "rdoc/rd/inline_parser.rb", "rdoc/rdoc.rb", "rdoc/require.rb", "rdoc/ri.rb", "rdoc/ri/driver.rb", "rdoc/ri/formatter.rb", "rdoc/ri/paths.rb", "rdoc/ri/store.rb", "rdoc/ri/task.rb", "rdoc/ruby_lex.rb", "rdoc/ruby_token.rb", "rdoc/rubygems_hook.rb", "rdoc/servlet.rb", "rdoc/single_class.rb", "rdoc/stats.rb", "rdoc/stats/normal.rb", "rdoc/stats/quiet.rb", "rdoc/stats/verbose.rb", "rdoc/store.rb", "rdoc/task.rb", "rdoc/test_case.rb", "rdoc/text.rb", "rdoc/token_stream.rb", "rdoc/tom_doc.rb", "rdoc/top_level.rb"]
-end
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 7c5d34e089..b41434ba39 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rdoc'
require 'find'
@@ -306,9 +305,6 @@ option)
when "directory" then
next if rel_file_name == "CVS" || rel_file_name == ".svn"
- created_rid = File.join rel_file_name, "created.rid"
- next if File.file? created_rid
-
dot_doc = File.join rel_file_name, RDoc::DOT_DOC_FILENAME
if File.file? dot_doc then
@@ -340,7 +336,7 @@ option)
# Parses +filename+ and returns an RDoc::TopLevel
def parse_file filename
- if Object.const_defined? :Encoding then
+ if defined?(Encoding) then
encoding = @options.encoding
filename = filename.encode encoding
end
@@ -354,11 +350,7 @@ option)
return unless content
filename_path = Pathname(filename).expand_path
- begin
- relative_path = filename_path.relative_path_from @options.root
- rescue ArgumentError
- relative_path = filename_path
- end
+ relative_path = filename_path.relative_path_from @options.root
if @options.page_dir and
relative_path.to_s.start_with? @options.page_dir.to_s then
@@ -419,6 +411,8 @@ The internal error was:
return [] if file_list.empty?
+ file_info = []
+
@stats.begin_adding
file_info = file_list.map do |filename|
@@ -571,5 +565,4 @@ end
# require built-in generators after discovery in case they've been replaced
require 'rdoc/generator/darkfish'
require 'rdoc/generator/ri'
-require 'rdoc/generator/pot'
diff --git a/lib/rdoc/require.rb b/lib/rdoc/require.rb
index f565ffad78..a3d4bd18c0 100644
--- a/lib/rdoc/require.rb
+++ b/lib/rdoc/require.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A file loaded by \#require
diff --git a/lib/rdoc/ri.rb b/lib/rdoc/ri.rb
index 388cb12c70..8b35e0fa2f 100644
--- a/lib/rdoc/ri.rb
+++ b/lib/rdoc/ri.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rdoc'
##
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index e571ae82ac..39064c1384 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'abbrev'
require 'optparse'
diff --git a/lib/rdoc/ri/formatter.rb b/lib/rdoc/ri/formatter.rb
index d0c85dbe6b..84d37a9d31 100644
--- a/lib/rdoc/ri/formatter.rb
+++ b/lib/rdoc/ri/formatter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# For RubyGems backwards compatibility
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
index 41529a3e0d..970cb91461 100644
--- a/lib/rdoc/ri/paths.rb
+++ b/lib/rdoc/ri/paths.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rdoc/ri'
##
diff --git a/lib/rdoc/ri/store.rb b/lib/rdoc/ri/store.rb
index 66e234f521..9fa9bbb03c 100644
--- a/lib/rdoc/ri/store.rb
+++ b/lib/rdoc/ri/store.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module RDoc::RI
Store = RDoc::Store # :nodoc:
diff --git a/lib/rdoc/ri/task.rb b/lib/rdoc/ri/task.rb
deleted file mode 100644
index d45f0c664c..0000000000
--- a/lib/rdoc/ri/task.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# frozen_string_literal: false
-require 'rubygems'
-begin
- gem 'rdoc'
-rescue Gem::LoadError
-end unless defined?(RDoc)
-
-require 'rdoc/task'
-
-##
-# RDoc::RI::Task creates ri data in <code>./.rdoc</code> for your project.
-#
-# It contains the following tasks:
-#
-# [ri]
-# Build ri data
-#
-# [clobber_ri]
-# Delete ri data files. This target is automatically added to the main
-# clobber target.
-#
-# [reri]
-# Rebuild the ri data from scratch even if they are not out of date.
-#
-# Simple example:
-#
-# require 'rdoc/ri/task'
-#
-# RDoc::RI::Task.new do |ri|
-# ri.main = 'README.rdoc'
-# ri.rdoc_files.include 'README.rdoc', 'lib/**/*.rb'
-# end
-#
-# For further configuration details see RDoc::Task.
-
-class RDoc::RI::Task < RDoc::Task
-
- DEFAULT_NAMES = { # :nodoc:
- :clobber_rdoc => :clobber_ri,
- :rdoc => :ri,
- :rerdoc => :reri,
- }
-
- ##
- # Create an ri task with the given name. See RDoc::Task for documentation on
- # setting names.
-
- def initialize name = DEFAULT_NAMES # :yield: self
- super
- end
-
- def clobber_task_description # :nodoc:
- "Remove RI data files"
- end
-
- ##
- # Sets default task values
-
- def defaults
- super
-
- @rdoc_dir = '.rdoc'
- end
-
- def rdoc_task_description # :nodoc:
- 'Build RI data files'
- end
-
- def rerdoc_task_description # :nodoc:
- 'Rebuild RI data files'
- end
-end
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index e772e660e0..d470d2b5f8 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -1,5 +1,4 @@
# coding: US-ASCII
-# frozen_string_literal: false
#--
# irb/ruby-lex.rb - ruby lexcal analyzer
@@ -435,7 +434,7 @@ class RDoc::RubyLex
|op, io|
@ltype = "="
res = ''
- nil until getc == "\n"
+ nil until (ch = getc) == "\n"
until ( peek_equal?("=end") && peek(4) =~ /\s/ ) do
(ch = getc)
@@ -1185,9 +1184,9 @@ class RDoc::RubyLex
str = if ltype == quoted and %w[" ' /].include? ltype then
ltype.dup
elsif RUBY_VERSION > '1.9' then
- "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
+ "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]}"
else
- "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
+ "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
end
subtype = nil
diff --git a/lib/rdoc/ruby_token.rb b/lib/rdoc/ruby_token.rb
index d923e24b18..8010475b92 100644
--- a/lib/rdoc/ruby_token.rb
+++ b/lib/rdoc/ruby_token.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# irb/ruby-token.rb - ruby tokens
# $Release Version: 0.9.5$
@@ -39,9 +38,9 @@ module RDoc::RubyToken
@text = text
end
- attr_reader :seek
- attr_reader :line_no
- attr_reader :char_no
+ attr :seek
+ attr :line_no
+ attr :char_no
attr_accessor :text
@@ -74,7 +73,7 @@ module RDoc::RubyToken
@node = node
end
- attr_reader:node
+ attr :node
def ==(other)
self.class == other.class and
@@ -102,7 +101,7 @@ module RDoc::RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr_reader:name
+ attr :name
def ==(other)
self.class == other.class and
@@ -193,7 +192,7 @@ module RDoc::RubyToken
@text = nil
end
- attr_reader:op
+ attr :op
def ==(other)
self.class == other.class and
@@ -218,7 +217,7 @@ module RDoc::RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr_reader:name
+ attr :name
def ==(other)
self.class == other.class and
diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb
index f6aeb84598..b4393114f1 100644
--- a/lib/rdoc/rubygems_hook.rb
+++ b/lib/rdoc/rubygems_hook.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rubygems'
require 'rubygems/user_interaction'
require 'fileutils'
@@ -154,13 +153,7 @@ class RDoc::RubygemsHook
options = nil
args = @spec.rdoc_options
-
- if @spec.respond_to? :source_paths then
- args.concat @spec.source_paths
- else
- args.concat @spec.require_paths
- end
-
+ args.concat @spec.require_paths
args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc]
diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
index 0da87dba92..ec8fd739f1 100644
--- a/lib/rdoc/servlet.rb
+++ b/lib/rdoc/servlet.rb
@@ -1,7 +1,5 @@
-# frozen_string_literal: false
require 'rdoc'
require 'time'
-require 'json'
require 'webrick'
##
@@ -440,3 +438,4 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
end
end
+
diff --git a/lib/rdoc/single_class.rb b/lib/rdoc/single_class.rb
index 7affa027e1..9e77a65c73 100644
--- a/lib/rdoc/single_class.rb
+++ b/lib/rdoc/single_class.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A singleton class
@@ -11,10 +10,6 @@ class RDoc::SingleClass < RDoc::ClassModule
superclass ? super + [superclass] : super
end
- def aref_prefix # :nodoc:
- 'sclass'
- end
-
##
# The definition of this singleton class, <tt>class << MyClassName</tt>
diff --git a/lib/rdoc/stats.rb b/lib/rdoc/stats.rb
index 354e904b19..b5a21915b4 100644
--- a/lib/rdoc/stats.rb
+++ b/lib/rdoc/stats.rb
@@ -1,12 +1,9 @@
-# frozen_string_literal: false
##
# RDoc statistics collector which prints a summary and report of a project's
# documentation totals.
class RDoc::Stats
- include RDoc::Text
-
##
# Output level for the coverage report
@@ -441,8 +438,6 @@ class RDoc::Stats
params = method.param_list
- params = params.map { |param| param.gsub(/^\*\*?/, '') }
-
return 0, [] if params.empty?
document = parse method.comment
diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb
index f32db48005..c971973bf1 100644
--- a/lib/rdoc/stats/normal.rb
+++ b/lib/rdoc/stats/normal.rb
@@ -1,9 +1,3 @@
-# frozen_string_literal: false
-begin
- require 'io/console/size'
-rescue LoadError
-end
-
##
# Stats printer that prints just the files being documented with a progress
# bar
@@ -11,14 +5,15 @@ end
class RDoc::Stats::Normal < RDoc::Stats::Quiet
def begin_adding # :nodoc:
- puts "Parsing sources..."
- @last_width = 0
+ puts "Parsing sources..." if $stdout.tty?
end
##
# Prints a file with a progress bar
def print_file files_so_far, filename
+ return unless $stdout.tty?
+
progress_bar = sprintf("%3d%% [%2d/%2d] ",
100 * files_so_far / @num_files,
files_so_far,
@@ -26,11 +21,7 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
# Print a progress bar, but make sure it fits on a single line. Filename
# will be truncated if necessary.
- terminal_width = if defined?(IO) && IO.respond_to?(:console_size)
- IO.console_size[1].to_i.nonzero? || 80
- else
- 80
- end
+ terminal_width = (ENV['COLUMNS'] || 80).to_i
max_filename_size = terminal_width - progress_bar.size
if filename.size > max_filename_size then
@@ -39,21 +30,18 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
filename[0..2] = "..."
end
+ # Pad the line with whitespaces so that leftover output from the
+ # previous line doesn't show up.
line = "#{progress_bar}#{filename}"
- if $stdout.tty?
- # Clean the line with whitespaces so that leftover output from the
- # previous line doesn't show up.
- $stdout.print("\r" << (" " * @last_width) << ("\b" * @last_width) << "\r") if @last_width && @last_width > 0
- @last_width = line.size
- $stdout.print("#{line}\r")
- else
- $stdout.puts(line)
- end
+ padding = terminal_width - line.size
+ line << (" " * padding) if padding > 0
+
+ $stdout.print("#{line}\r")
$stdout.flush
end
def done_adding # :nodoc:
- puts
+ puts if $stdout.tty?
end
end
diff --git a/lib/rdoc/stats/quiet.rb b/lib/rdoc/stats/quiet.rb
index 561c272ef7..eed27b2a88 100644
--- a/lib/rdoc/stats/quiet.rb
+++ b/lib/rdoc/stats/quiet.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Stats printer that prints nothing
diff --git a/lib/rdoc/stats/verbose.rb b/lib/rdoc/stats/verbose.rb
index e04edade52..430809ae07 100644
--- a/lib/rdoc/stats/verbose.rb
+++ b/lib/rdoc/stats/verbose.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# Stats printer that prints everything documented, including the documented
# status
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index 3f91f05824..fde6f0695b 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'fileutils'
##
diff --git a/lib/rdoc/task.rb b/lib/rdoc/task.rb
index 0577677054..d347e4d6ab 100644
--- a/lib/rdoc/task.rb
+++ b/lib/rdoc/task.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel
#
@@ -292,7 +291,7 @@ class RDoc::Task < Rake::TaskLib
private
def rdoc_target
- "#{rdoc_dir}/created.rid"
+ "#{rdoc_dir}/index.html"
end
def rdoc_task_name
diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb
index 1d5469bc19..245e4ef1c5 100644
--- a/lib/rdoc/test_case.rb
+++ b/lib/rdoc/test_case.rb
@@ -1,9 +1,8 @@
-# frozen_string_literal: false
require 'rubygems'
begin
gem 'minitest', '~> 4.0' unless defined?(Test::Unit)
-rescue NoMethodError, Gem::LoadError
+rescue NoMethodError
# for ruby tests
end
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index b40c89806a..0fda72e3ae 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -1,5 +1,4 @@
# coding: utf-8
-# frozen_string_literal: false
##
# For RDoc::Text#to_html
@@ -11,11 +10,11 @@ require 'strscan'
begin
gem 'json'
-rescue NameError => e # --disable-gems
- raise unless e.name == :gem
rescue Gem::LoadError
end
+require 'json'
+
##
# Methods for manipulating comment text
@@ -69,11 +68,11 @@ module RDoc::Text
expanded = []
text.each_line do |line|
- nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
+ line.gsub!(/^((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
r = "#{$1}#{$2}#{' ' * (8 - $2.size)}"
r.force_encoding text.encoding if Object.const_defined? :Encoding
r
- end
+ end until line !~ /\t/
expanded << line
end
@@ -104,15 +103,6 @@ module RDoc::Text
# Requires the including class to implement #formatter
def markup text
- if @store.rdoc.options
- locale = @store.rdoc.options.locale
- else
- locale = nil
- end
- if locale
- i18n_text = RDoc::I18n::Text.new(text)
- text = i18n_text.translate(locale)
- end
parse(text).accept formatter
end
@@ -322,3 +312,4 @@ module RDoc::Text
end
end
+
diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb
index b0035227fa..851bc05bf5 100644
--- a/lib/rdoc/token_stream.rb
+++ b/lib/rdoc/token_stream.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A TokenStream is a list of tokens, gathered during the parse of some entity
# (say a method). Entities populate these streams by being registered with the
@@ -89,7 +88,7 @@ module RDoc::TokenStream
# Returns a string representation of the token stream
def tokens_to_s
- token_stream.compact.map { |token| token.text }.join ''
+ token_stream.map { |token| token.text }.join ''
end
end
diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb
index d760849938..2b62243525 100644
--- a/lib/rdoc/tom_doc.rb
+++ b/lib/rdoc/tom_doc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# :markup: tomdoc
# A parser for TomDoc based on TomDoc 1.0.0-rc1 (02adef9b5a)
diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb
index 38be646ad0..64d81d20c1 100644
--- a/lib/rdoc/top_level.rb
+++ b/lib/rdoc/top_level.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# A TopLevel context is a representation of the contents of a single file
diff --git a/lib/resolv-replace.rb b/lib/resolv-replace.rb
index a83e79d996..3e28a843fd 100644
--- a/lib/resolv-replace.rb
+++ b/lib/resolv-replace.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require 'socket'
require 'resolv'
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 9a981b99bd..d8ee487cfc 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
-
require 'socket'
+require 'fcntl'
require 'timeout'
require 'thread'
-require 'io/wait'
begin
require 'securerandom'
@@ -161,7 +159,7 @@ class Resolv
##
# Indicates a timeout resolving a name or address.
- class ResolvTimeout < Timeout::Error; end
+ class ResolvTimeout < TimeoutError; end
##
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
@@ -189,7 +187,7 @@ class Resolv
unless @initialized
@name2addr = {}
@addr2name = {}
- open(@filename, 'rb') {|f|
+ open(@filename) {|f|
f.each {|line|
line.sub!(/#.*/, '')
addr, hostname, *aliases = line.split(/\s+/)
@@ -524,9 +522,8 @@ class Resolv
msg.rd = 1
msg.add_question(candidate, typeclass)
unless sender = senders[[candidate, nameserver, port]]
- sender = requester.sender(msg, candidate, nameserver, port)
- next if !sender
- senders[[candidate, nameserver, port]] = sender
+ sender = senders[[candidate, nameserver, port]] =
+ requester.sender(msg, candidate, nameserver, port)
end
reply, reply_name = requester.request(sender, tout)
case reply.rcode
@@ -655,9 +652,7 @@ class Resolv
begin
port = rangerand(1024..65535)
udpsock.bind(bind_host, port)
- rescue Errno::EADDRINUSE, # POSIX
- Errno::EACCES, # SunOS: See PRIV_SYS_NFS in privileges(5)
- Errno::EPERM # FreeBSD: security.mac.portacl.port_high is configurable. See mac_portacl(4).
+ rescue Errno::EADDRINUSE, Errno::EACCES
retry
end
end
@@ -669,27 +664,23 @@ class Resolv
end
def request(sender, tout)
- start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ start = Time.now
timelimit = start + tout
begin
sender.send
- rescue Errno::EHOSTUNREACH, # multi-homed IPv6 may generate this
- Errno::ENETUNREACH
+ rescue Errno::EHOSTUNREACH
+ # multi-homed IPv6 may generate this
raise ResolvTimeout
end
while true
- before_select = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ before_select = Time.now
timeout = timelimit - before_select
if timeout <= 0
raise ResolvTimeout
end
- if @socks.size == 1
- select_result = @socks[0].wait_readable(timeout) ? [ @socks ] : nil
- else
- select_result = IO.select(@socks, nil, nil, timeout)
- end
+ select_result = IO.select(@socks, nil, nil, timeout)
if !select_result
- after_select = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ after_select = Time.now
next if after_select < timelimit
raise ResolvTimeout
end
@@ -750,12 +741,9 @@ class Resolv
af = Socket::AF_INET
end
next if @socks_hash[bind_host]
- begin
- sock = UDPSocket.new(af)
- rescue Errno::EAFNOSUPPORT
- next # The kernel doesn't support the address family.
- end
+ sock = UDPSocket.new(af)
sock.do_not_reverse_lookup = true
+ sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::F_SETFD
DNS.bind_random_port(sock, bind_host)
@socks << sock
@socks_hash[bind_host] = sock
@@ -768,12 +756,11 @@ class Resolv
end
def sender(msg, data, host, port=Port)
- sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
- return nil if !sock
service = [host, port]
id = DNS.allocate_request_id(host, port)
request = msg.encode
request[0,2] = [id].pack('n')
+ sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
return @senders[[service, id]] =
Sender.new(request, data, sock, host, port)
end
@@ -794,7 +781,6 @@ class Resolv
attr_reader :data
def send
- raise "@sock is nil." if @sock.nil?
@sock.send(@msg, 0, @host, @port)
end
end
@@ -809,6 +795,7 @@ class Resolv
sock = UDPSocket.new(is_ipv6 ? Socket::AF_INET6 : Socket::AF_INET)
@socks = [sock]
sock.do_not_reverse_lookup = true
+ sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::F_SETFD
DNS.bind_random_port(sock, is_ipv6 ? "::" : "0.0.0.0")
sock.connect(host, port)
end
@@ -837,7 +824,6 @@ class Resolv
class Sender < Requester::Sender # :nodoc:
def send
- raise "@sock is nil." if @sock.nil?
@sock.send(@msg, 0)
end
attr_reader :data
@@ -866,6 +852,7 @@ class Resolv
@port = port
sock = TCPSocket.new(@host, @port)
@socks = [sock]
+ sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::F_SETFD
@senders = {}
end
@@ -921,7 +908,7 @@ class Resolv
values = Array(values)
values.each do |t|
Numeric === t or raise ArgumentError, "#{t.inspect} is not numeric"
- t > 0.0 or raise ArgumentError, "timeout=#{t} must be positive"
+ t > 0.0 or raise ArgumentError, "timeout=#{t} must be postive"
end
@timeouts = values
else
@@ -933,7 +920,7 @@ class Resolv
nameserver = []
search = nil
ndots = 1
- open(filename, 'rb') {|f|
+ open(filename) {|f|
f.each {|line|
line.sub!(/[#;].*/, '')
keyword, *args = line.split(/\s+/)
@@ -1073,10 +1060,6 @@ class Resolv
candidates = []
end
candidates.concat(@search.map {|domain| Name.new(name.to_a + domain)})
- fname = Name.create("#{name}.")
- if !candidates.include?(fname)
- candidates << fname
- end
end
return candidates
end
@@ -1177,9 +1160,7 @@ class Resolv
class Str # :nodoc:
def initialize(string)
@string = string
- # case insensivity of DNS labels doesn't apply non-ASCII characters. [RFC 4343]
- # This assumes @string is given in ASCII compatible encoding.
- @downcase = string.b.downcase
+ @downcase = string.downcase
end
attr_reader :string, :downcase
@@ -1188,11 +1169,11 @@ class Resolv
end
def inspect
- return "#<#{self.class} #{self}>"
+ return "#<#{self.class} #{self.to_s}>"
end
def ==(other)
- return self.class == other.class && @downcase == other.downcase
+ return @downcase == other.downcase
end
def eql?(other)
@@ -1228,20 +1209,12 @@ class Resolv
end
def initialize(labels, absolute=true) # :nodoc:
- labels = labels.map {|label|
- case label
- when String then Label::Str.new(label)
- when Label::Str then label
- else
- raise ArgumentError, "unexpected label: #{label.inspect}"
- end
- }
@labels = labels
@absolute = absolute
end
def inspect # :nodoc:
- "#<#{self.class}: #{self}#{@absolute ? '.' : ''}>"
+ "#<#{self.class}: #{self.to_s}#{@absolute ? '.' : ''}>"
end
##
@@ -1253,8 +1226,7 @@ class Resolv
def ==(other) # :nodoc:
return false unless Name === other
- return false unless @absolute == other.absolute?
- return @labels == other.to_a
+ return @labels.join == other.to_a.join && @absolute == other.absolute?
end
alias eql? == # :nodoc:
@@ -1428,7 +1400,7 @@ class Resolv
class MessageEncoder # :nodoc:
def initialize
- @data = ''.dup
+ @data = ''
@names = {}
yield self
end
@@ -1476,9 +1448,7 @@ class Resolv
self.put_pack("n", 0xc000 | idx)
return
else
- if @data.length < 0x4000
- @names[domain] = @data.length
- end
+ @names[domain] = @data.length
self.put_label(d[i])
end
}
@@ -1550,7 +1520,6 @@ class Resolv
end
def get_bytes(len = @limit - @index)
- raise DecodeError.new("limit exceeded") if @limit < @index + len
d = @data[@index, len]
@index += len
return d
@@ -1578,7 +1547,6 @@ class Resolv
end
def get_string
- raise DecodeError.new("limit exceeded") if @limit <= @index
len = @data[@index].ord
raise DecodeError.new("limit exceeded") if @limit < @index + 1 + len
d = @data[@index + 1, len]
@@ -1598,33 +1566,29 @@ class Resolv
return Name.new(self.get_labels)
end
- def get_labels
- prev_index = @index
- save_index = nil
+ def get_labels(limit=nil)
+ limit = @index if !limit || @index < limit
d = []
while true
- raise DecodeError.new("limit exceeded") if @limit <= @index
case @data[@index].ord
when 0
@index += 1
- if save_index
- @index = save_index
- end
return d
when 192..255
idx = self.get_unpack('n')[0] & 0x3fff
- if prev_index <= idx
+ if limit <= idx
raise DecodeError.new("non-backward name pointer")
end
- prev_index = idx
- if !save_index
- save_index = @index
- end
+ save_index = @index
@index = idx
+ d += self.get_labels(limit)
+ @index = save_index
+ return d
else
d << self.get_label
end
end
+ return d
end
def get_label
@@ -1685,10 +1649,10 @@ class Resolv
return false unless self.class == other.class
s_ivars = self.instance_variables
s_ivars.sort!
- s_ivars.delete :@ttl
+ s_ivars.delete "@ttl"
o_ivars = other.instance_variables
o_ivars.sort!
- o_ivars.delete :@ttl
+ o_ivars.delete "@ttl"
return s_ivars == o_ivars &&
s_ivars.collect {|name| self.instance_variable_get name} ==
o_ivars.collect {|name| other.instance_variable_get name}
@@ -1701,7 +1665,7 @@ class Resolv
def hash # :nodoc:
h = 0
vars = self.instance_variables
- vars.delete :@ttl
+ vars.delete "@ttl"
vars.each {|name|
h ^= self.instance_variable_get(name).hash
}
@@ -1999,10 +1963,10 @@ class Resolv
attr_reader :strings
##
- # Returns the concatenated string from +strings+.
+ # Returns the first string from +strings+.
def data
- @strings.join("")
+ @strings[0]
end
def encode_rdata(msg) # :nodoc:
@@ -2370,7 +2334,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self}>"
+ return "#<#{self.class} #{self.to_s}>"
end
##
@@ -2451,14 +2415,14 @@ class Resolv
when IPv6
return arg
when String
- address = ''.b
+ address = ''
if Regex_8Hex =~ arg
arg.scan(/[0-9A-Fa-f]+/) {|hex| address << [hex.hex].pack('n')}
elsif Regex_CompressedHex =~ arg
prefix = $1
suffix = $2
- a1 = ''.b
- a2 = ''.b
+ a1 = ''
+ a2 = ''
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
omitlen = 16 - a1.length - a2.length
@@ -2474,8 +2438,8 @@ class Resolv
elsif Regex_CompressedHex4Dec =~ arg
prefix, suffix, a, b, c, d = $1, $2, $3.to_i, $4.to_i, $5.to_i, $6.to_i
if (0..255) === a && (0..255) === b && (0..255) === c && (0..255) === d
- a1 = ''.b
- a2 = ''.b
+ a1 = ''
+ a2 = ''
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
omitlen = 12 - a1.length - a2.length
@@ -2513,7 +2477,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self}>"
+ return "#<#{self.class} #{self.to_s}>"
end
##
@@ -2663,7 +2627,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self}>"
+ return "#<#{self.class} #{self.to_s}>"
end
def ==(other) # :nodoc:
@@ -2752,7 +2716,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self}>"
+ return "#<#{self.class} #{self.to_s}>"
end
def ==(other) # :nodoc:
@@ -2814,7 +2778,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self}>"
+ return "#<#{self.class} #{self.to_s}>"
end
def ==(other) # :nodoc:
diff --git a/lib/rexml/attlistdecl.rb b/lib/rexml/attlistdecl.rb
index dc1d2add0b..ec4e6c3b8d 100644
--- a/lib/rexml/attlistdecl.rb
+++ b/lib/rexml/attlistdecl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#vim:ts=2 sw=2 noexpandtab:
require 'rexml/child'
require 'rexml/source'
@@ -24,7 +23,7 @@ module REXML
# Create an AttlistDecl, pulling the information from a Source. Notice
# that this isn't very convenient; to create an AttlistDecl, you basically
# have to format it yourself, and then have the initializer parse it.
- # Sorry, but for the foreseeable future, DTD support in REXML is pretty
+ # Sorry, but for the forseeable future, DTD support in REXML is pretty
# weak on convenience. Have I mentioned how much I hate DTDs?
def initialize(source)
super()
diff --git a/lib/rexml/attribute.rb b/lib/rexml/attribute.rb
index ca5984e178..803d0217b1 100644
--- a/lib/rexml/attribute.rb
+++ b/lib/rexml/attribute.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/namespace"
require 'rexml/text'
@@ -110,7 +109,7 @@ module REXML
# b.to_string # -> "ns:x='y'"
def to_string
if @element and @element.context and @element.context[:attribute_quote] == :quote
- %Q^#@expanded_name="#{to_s().gsub(/"/, '&quot;')}"^
+ %Q^#@expanded_name="#{to_s().gsub(/"/, '&quote;')}"^
else
"#@expanded_name='#{to_s().gsub(/'/, '&apos;')}'"
end
@@ -160,7 +159,7 @@ module REXML
self
end
- # Removes this Attribute from the tree, and returns true if successful
+ # Removes this Attribute from the tree, and returns true if successfull
#
# This method is usually not called directly.
def remove
diff --git a/lib/rexml/cdata.rb b/lib/rexml/cdata.rb
index fe9b49b5f7..73358edc28 100644
--- a/lib/rexml/cdata.rb
+++ b/lib/rexml/cdata.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/text"
module REXML
diff --git a/lib/rexml/child.rb b/lib/rexml/child.rb
index d23451e71e..bf97d5f903 100644
--- a/lib/rexml/child.rb
+++ b/lib/rexml/child.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/node"
module REXML
diff --git a/lib/rexml/comment.rb b/lib/rexml/comment.rb
index 746af77296..42a040c456 100644
--- a/lib/rexml/comment.rb
+++ b/lib/rexml/comment.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/child"
module REXML
@@ -22,6 +21,7 @@ module REXML
# should be nil, not supplied, or a Parent to be set as the parent
# of this object
def initialize( first, second = nil )
+ #puts "IN COMMENT CONSTRUCTOR; SECOND IS #{second.type}"
super(second)
if first.kind_of? String
@string = first
diff --git a/lib/rexml/doctype.rb b/lib/rexml/doctype.rb
index 1eb1f5b4e1..0b3c533bb4 100644
--- a/lib/rexml/doctype.rb
+++ b/lib/rexml/doctype.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/parent"
require "rexml/parseexception"
require "rexml/namespace"
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index 806bc499cd..1e18263dda 100644
--- a/lib/rexml/document.rb
+++ b/lib/rexml/document.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/security"
require "rexml/element"
require "rexml/xmldecl"
@@ -124,7 +123,7 @@ module REXML
def xml_decl
rv = @children[0]
return rv if rv.kind_of? XMLDecl
- @children.unshift(XMLDecl.default)[0]
+ rv = @children.unshift(XMLDecl.default)[0]
end
# @return the XMLDecl version of this document as a String.
@@ -279,10 +278,6 @@ module REXML
end
end
- def document
- self
- end
-
private
def build( source )
Parsers::TreeParser.new( source, self ).parse
diff --git a/lib/rexml/dtd/attlistdecl.rb b/lib/rexml/dtd/attlistdecl.rb
index 32847daadb..25955ee274 100644
--- a/lib/rexml/dtd/attlistdecl.rb
+++ b/lib/rexml/dtd/attlistdecl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/child"
module REXML
module DTD
diff --git a/lib/rexml/dtd/dtd.rb b/lib/rexml/dtd/dtd.rb
index 927d5d847b..966e39ea57 100644
--- a/lib/rexml/dtd/dtd.rb
+++ b/lib/rexml/dtd/dtd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/dtd/elementdecl"
require "rexml/dtd/entitydecl"
require "rexml/comment"
@@ -25,18 +24,23 @@ module REXML
case input
when ElementDecl.PATTERN_RE
match = $&
+ source = $'
contents << ElementDecl.new( match )
when AttlistDecl.PATTERN_RE
matchdata = $~
+ source = $'
contents << AttlistDecl.new( matchdata )
when EntityDecl.PATTERN_RE
matchdata = $~
+ source = $'
contents << EntityDecl.new( matchdata )
when Comment.PATTERN_RE
matchdata = $~
+ source = $'
contents << Comment.new( matchdata )
when NotationDecl.PATTERN_RE
matchdata = $~
+ source = $'
contents << NotationDecl.new( matchdata )
end
end
diff --git a/lib/rexml/dtd/elementdecl.rb b/lib/rexml/dtd/elementdecl.rb
index 119fd41a8f..a0bf641300 100644
--- a/lib/rexml/dtd/elementdecl.rb
+++ b/lib/rexml/dtd/elementdecl.rb
@@ -1,12 +1,11 @@
-# frozen_string_literal: false
require "rexml/child"
module REXML
module DTD
class ElementDecl < Child
START = "<!ELEMENT"
START_RE = /^\s*#{START}/um
- # PATTERN_RE = /^\s*(#{START}.*?)>/um
- PATTERN_RE = /^\s*#{START}\s+((?:[:\w][-\.\w]*:)?[-!\*\.\w]*)(.*?)>/
+ PATTERN_RE = /^\s*(#{START}.*?)>/um
+ PATTERN_RE = /^\s*#{START}\s+((?:[:\w_][-\.\w_]*:)?[-!\*\.\w_]*)(.*?)>/
#\s*((((["']).*?\5)|[^\/'">]*)*?)(\/)?>/um, true)
def initialize match
diff --git a/lib/rexml/dtd/entitydecl.rb b/lib/rexml/dtd/entitydecl.rb
index 45707e2f42..a9286b2b90 100644
--- a/lib/rexml/dtd/entitydecl.rb
+++ b/lib/rexml/dtd/entitydecl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/child"
module REXML
module DTD
diff --git a/lib/rexml/dtd/notationdecl.rb b/lib/rexml/dtd/notationdecl.rb
index cfdf0b9b74..17d1b9ef29 100644
--- a/lib/rexml/dtd/notationdecl.rb
+++ b/lib/rexml/dtd/notationdecl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/child"
module REXML
module DTD
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index f725d5a2be..c30b150c0b 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/parent"
require "rexml/namespace"
require "rexml/attribute"
@@ -207,7 +206,7 @@ module REXML
return namespaces
end
- # Evaluates to the URI for a prefix, or the empty string if no such
+ # Evalutas to the URI for a prefix, or the empty string if no such
# namespace is declared for this element. Evaluates recursively for
# ancestors. Returns the default namespace, if there is one.
# prefix::
@@ -1182,8 +1181,9 @@ module REXML
prefix = '' unless prefix
end
old = fetch(name, nil)
+ attr = nil
if old.kind_of? Hash # the supplied attribute is one of many
- old.delete(prefix)
+ attr = old.delete(prefix)
if old.size == 1
repl = nil
old.each_value{|v| repl = v}
@@ -1192,6 +1192,7 @@ module REXML
elsif old.nil?
return @element
else # the supplied attribute is a top-level one
+ attr = old
super(name)
end
@element
diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb
index da2d70d6c9..1c7e79a124 100644
--- a/lib/rexml/encoding.rb
+++ b/lib/rexml/encoding.rb
@@ -1,5 +1,4 @@
# coding: US-ASCII
-# frozen_string_literal: false
module REXML
module Encoding
# ID ---> Encoding name
diff --git a/lib/rexml/entity.rb b/lib/rexml/entity.rb
index d9a72cc8fa..3d81fbc738 100644
--- a/lib/rexml/entity.rb
+++ b/lib/rexml/entity.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/child'
require 'rexml/source'
require 'rexml/xmltokens'
@@ -64,7 +63,7 @@ module REXML
end
end
- # Evaluates whether the given string matches an entity definition,
+ # Evaluates whether the given string matchs an entity definition,
# returning true if so, and false otherwise.
def Entity::matches? string
(ENTITYDECL =~ string) == 0
@@ -139,14 +138,8 @@ module REXML
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
- sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
- if sum + entity_value.bytesize > Security.entity_expansion_text_limit
- raise "entity expansion has grown too large"
- else
- sum += entity_value.bytesize
- end
rv.gsub!( /%#{entity_reference.join};/um, entity_value )
end
end
@@ -158,7 +151,6 @@ module REXML
# This is a set of entity constants -- the ones defined in the XML
# specification. These are +gt+, +lt+, +amp+, +quot+ and +apos+.
- # CAUTION: these entities does not have parent and document
module EntityConst
# +>+
GT = Entity.new( 'gt', '>' )
diff --git a/lib/rexml/formatters/default.rb b/lib/rexml/formatters/default.rb
index b84759d2ff..574c821f96 100644
--- a/lib/rexml/formatters/default.rb
+++ b/lib/rexml/formatters/default.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
module Formatters
class Default
diff --git a/lib/rexml/formatters/pretty.rb b/lib/rexml/formatters/pretty.rb
index a80274bdad..e5ba561a58 100644
--- a/lib/rexml/formatters/pretty.rb
+++ b/lib/rexml/formatters/pretty.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/formatters/default'
module REXML
diff --git a/lib/rexml/formatters/transitive.rb b/lib/rexml/formatters/transitive.rb
index 81e67f3274..6cc690d922 100644
--- a/lib/rexml/formatters/transitive.rb
+++ b/lib/rexml/formatters/transitive.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/formatters/pretty'
module REXML
diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb
index 8e2abca811..20c8961aee 100644
--- a/lib/rexml/functions.rb
+++ b/lib/rexml/functions.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
# If you add a method, keep in mind two things:
# (1) the first argument will always be a list of nodes from which to
@@ -8,28 +7,10 @@ module REXML
# Therefore, in XML, "local-name()" is identical (and actually becomes)
# "local_name()"
module Functions
- @@available_functions = {}
@@context = nil
@@namespace_context = {}
@@variables = {}
- INTERNAL_METHODS = [
- :namespace_context,
- :namespace_context=,
- :variables,
- :variables=,
- :context=,
- :get_namespace,
- :send,
- ]
- class << self
- def singleton_method_added(name)
- unless INTERNAL_METHODS.include?(name)
- @@available_functions[name] = true
- end
- end
- end
-
def Functions::namespace_context=(x) ; @@namespace_context=x ; end
def Functions::variables=(x) ; @@variables=x ; end
def Functions::namespace_context ; @@namespace_context ; end
@@ -382,7 +363,7 @@ module REXML
def Functions::sum( nodes )
nodes = [nodes] unless nodes.kind_of? Array
- nodes.inject(0) { |r,n| r + number(string(n)) }
+ nodes.inject(0) { |r,n| r += number(string(n)) }
end
def Functions::floor( number )
@@ -405,14 +386,9 @@ module REXML
node.node_type == :processing_instruction
end
- def Functions::send(name, *args)
- if @@available_functions[name.to_sym]
- super
- else
- # TODO: Maybe, this is not XPath spec behavior.
- # This behavior must be reconsidered.
- XPath.match(@@context[:node], name.to_s)
- end
+ def Functions::method_missing( id )
+ puts "METHOD MISSING #{id.id2name}"
+ XPath.match( @@context[:node], id.id2name )
end
end
end
diff --git a/lib/rexml/instruction.rb b/lib/rexml/instruction.rb
index 576939ca2b..f8b734a5b5 100644
--- a/lib/rexml/instruction.rb
+++ b/lib/rexml/instruction.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/child"
require "rexml/source"
diff --git a/lib/rexml/light/node.rb b/lib/rexml/light/node.rb
index d58119a3a4..b33f78f7ce 100644
--- a/lib/rexml/light/node.rb
+++ b/lib/rexml/light/node.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/xmltokens'
# [ :element, parent, name, attributes, children* ]
diff --git a/lib/rexml/namespace.rb b/lib/rexml/namespace.rb
index 90ba7cc635..aeb339ee83 100644
--- a/lib/rexml/namespace.rb
+++ b/lib/rexml/namespace.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/xmltokens'
module REXML
diff --git a/lib/rexml/node.rb b/lib/rexml/node.rb
index c7a3936799..cab6e9fddb 100644
--- a/lib/rexml/node.rb
+++ b/lib/rexml/node.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/parseexception"
require "rexml/formatters/pretty"
require "rexml/formatters/default"
diff --git a/lib/rexml/output.rb b/lib/rexml/output.rb
index 96dfea570e..0c6cc7a7f8 100644
--- a/lib/rexml/output.rb
+++ b/lib/rexml/output.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/encoding'
module REXML
diff --git a/lib/rexml/parent.rb b/lib/rexml/parent.rb
index 3bd0a96255..0a9f805109 100644
--- a/lib/rexml/parent.rb
+++ b/lib/rexml/parent.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/child"
module REXML
@@ -16,8 +15,10 @@ module REXML
end
def add( object )
+ #puts "PARENT GOTS #{size} CHILDREN"
object.parent = self
@children << object
+ #puts "PARENT NOW GOTS #{size} CHILDREN"
object
end
diff --git a/lib/rexml/parseexception.rb b/lib/rexml/parseexception.rb
index 7b16cd1a41..0c4d55abda 100644
--- a/lib/rexml/parseexception.rb
+++ b/lib/rexml/parseexception.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
class ParseException < RuntimeError
attr_accessor :source, :parser, :continued_exception
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index 80eeb0fa79..6a08b8661d 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/parseexception'
require 'rexml/undefinednamespaceexception'
require 'rexml/source'
diff --git a/lib/rexml/parsers/lightparser.rb b/lib/rexml/parsers/lightparser.rb
index f0601ae51b..81041681c2 100644
--- a/lib/rexml/parsers/lightparser.rb
+++ b/lib/rexml/parsers/lightparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/parsers/streamparser'
require 'rexml/parsers/baseparser'
require 'rexml/light/node'
diff --git a/lib/rexml/parsers/pullparser.rb b/lib/rexml/parsers/pullparser.rb
index 8c49217553..68a4ff7eae 100644
--- a/lib/rexml/parsers/pullparser.rb
+++ b/lib/rexml/parsers/pullparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'forwardable'
require 'rexml/parseexception'
diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb
index 1386f69c83..46ea8faa4d 100644
--- a/lib/rexml/parsers/sax2parser.rb
+++ b/lib/rexml/parsers/sax2parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/parsers/baseparser'
require 'rexml/parseexception'
require 'rexml/namespace'
@@ -230,6 +229,7 @@ module REXML
def get_procs( symbol, name )
return nil if @procs.size == 0
@procs.find_all do |sym, match, block|
+ #puts sym.inspect+"=="+symbol.inspect+ "\t"+match.inspect+"=="+name.inspect+ "\t"+( (sym.nil? or symbol == sym) and ((name.nil? and match.nil?) or match.nil? or ( (name == match) or (match.kind_of? Regexp and name =~ match)))).to_s
(
(sym.nil? or symbol == sym) and
((name.nil? and match.nil?) or match.nil? or (
diff --git a/lib/rexml/parsers/streamparser.rb b/lib/rexml/parsers/streamparser.rb
index f6a8bfa802..9ea65ed3d1 100644
--- a/lib/rexml/parsers/streamparser.rb
+++ b/lib/rexml/parsers/streamparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/parsers/baseparser"
module REXML
@@ -7,7 +6,6 @@ module REXML
def initialize source, listener
@listener = listener
@parser = BaseParser.new( source )
- @tag_stack = []
end
def add_listener( listener )
@@ -20,21 +18,14 @@ module REXML
event = @parser.pull
case event[0]
when :end_document
- unless @tag_stack.empty?
- tag_path = "/" + @tag_stack.join("/")
- raise ParseException.new("Missing end tag for '#{tag_path}'",
- @parser.source)
- end
return
when :start_element
- @tag_stack << event[1]
attrs = event[2].each do |n, v|
event[2][n] = @parser.unnormalize( v )
end
@listener.tag_start( event[1], attrs )
when :end_element
@listener.tag_end( event[1] )
- @tag_stack.pop
when :text
normalized = @parser.unnormalize( event[1] )
@listener.text( normalized )
diff --git a/lib/rexml/parsers/treeparser.rb b/lib/rexml/parsers/treeparser.rb
index fc0993c72a..68edb77759 100644
--- a/lib/rexml/parsers/treeparser.rb
+++ b/lib/rexml/parsers/treeparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/validation/validationexception'
require 'rexml/undefinednamespaceexception'
diff --git a/lib/rexml/parsers/ultralightparser.rb b/lib/rexml/parsers/ultralightparser.rb
index 6571d119bd..4e2d7a81cf 100644
--- a/lib/rexml/parsers/ultralightparser.rb
+++ b/lib/rexml/parsers/ultralightparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/parsers/streamparser'
require 'rexml/parsers/baseparser'
diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb
index 32b70bb798..e643d11511 100644
--- a/lib/rexml/parsers/xpathparser.rb
+++ b/lib/rexml/parsers/xpathparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/namespace'
require 'rexml/xmltokens'
@@ -22,7 +21,7 @@ module REXML
path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces
path.gsub!( /\s+([\]\)])/, '\1')
parsed = []
- OrExpr(path, parsed)
+ path = OrExpr(path, parsed)
parsed
end
@@ -185,6 +184,7 @@ module REXML
# | '/' RelativeLocationPath?
# | '//' RelativeLocationPath
def LocationPath path, parsed
+ #puts "LocationPath '#{path}'"
path = path.strip
if path[0] == ?/
parsed << :document
@@ -196,6 +196,7 @@ module REXML
path = path[1..-1]
end
end
+ #puts parsed.inspect
return RelativeLocationPath( path, parsed ) if path.size > 0
end
@@ -209,6 +210,7 @@ module REXML
# | RelativeLocationPath '//' Step
AXIS = /^(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::/
def RelativeLocationPath path, parsed
+ #puts "RelativeLocationPath #{path}"
while path.size > 0
# (axis or @ or <child::>) nodetest predicate >
# OR > / Step
@@ -225,6 +227,7 @@ module REXML
end
else
if path[0] == ?@
+ #puts "ATTRIBUTE"
parsed << :attribute
path = path[1..-1]
# Goto Nodetest
@@ -236,8 +239,10 @@ module REXML
parsed << :child
end
+ #puts "NODETESTING '#{path}'"
n = []
path = NodeTest( path, n)
+ #puts "NODETEST RETURNED '#{path}'"
if path[0] == ?[
path = Predicate( path, n )
@@ -277,6 +282,7 @@ module REXML
NODE_TYPE = /^(comment|text|node)\(\s*\)/m
PI = /^processing-instruction\(/
def NodeTest path, parsed
+ #puts "NodeTest with #{path}"
case path
when /^\*/
path = $'
@@ -298,11 +304,13 @@ module REXML
parsed << :processing_instruction
parsed << (literal || '')
when NCNAMETEST
+ #puts "NCNAMETEST"
prefix = $1
path = $'
parsed << :namespace
parsed << prefix
when QNAME
+ #puts "QNAME"
prefix = $1
name = $2
path = $'
@@ -316,18 +324,22 @@ module REXML
# Filters the supplied nodeset on the predicate(s)
def Predicate path, parsed
+ #puts "PREDICATE with #{path}"
return nil unless path[0] == ?[
predicates = []
while path[0] == ?[
path, expr = get_group(path)
predicates << expr[1..-2] if expr
end
+ #puts "PREDICATES = #{predicates.inspect}"
predicates.each{ |pred|
+ #puts "ORING #{pred}"
preds = []
parsed << :predicate
parsed << preds
OrExpr(pred, preds)
}
+ #puts "PREDICATES = #{predicates.inspect}"
path
end
@@ -338,8 +350,10 @@ module REXML
#| OrExpr S 'or' S AndExpr
#| AndExpr
def OrExpr path, parsed
+ #puts "OR >>> #{path}"
n = []
rest = AndExpr( path, n )
+ #puts "OR <<< #{rest}"
if rest != path
while rest =~ /^\s*( or )/
n = [ :or, n, [] ]
@@ -357,12 +371,16 @@ module REXML
#| AndExpr S 'and' S EqualityExpr
#| EqualityExpr
def AndExpr path, parsed
+ #puts "AND >>> #{path}"
n = []
rest = EqualityExpr( path, n )
+ #puts "AND <<< #{rest}"
if rest != path
while rest =~ /^\s*( and )/
n = [ :and, n, [] ]
+ #puts "AND >>> #{rest}"
rest = EqualityExpr( $', n[-1] )
+ #puts "AND <<< #{rest}"
end
end
if parsed.size == 0 and n.size != 0
@@ -376,8 +394,10 @@ module REXML
#| EqualityExpr ('=' | '!=') RelationalExpr
#| RelationalExpr
def EqualityExpr path, parsed
+ #puts "EQUALITY >>> #{path}"
n = []
rest = RelationalExpr( path, n )
+ #puts "EQUALITY <<< #{rest}"
if rest != path
while rest =~ /^\s*(!?=)\s*/
if $1[0] == ?!
@@ -399,8 +419,10 @@ module REXML
#| RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr
#| AdditiveExpr
def RelationalExpr path, parsed
+ #puts "RELATION >>> #{path}"
n = []
rest = AdditiveExpr( path, n )
+ #puts "RELATION <<< #{rest}"
if rest != path
while rest =~ /^\s*([<>]=?)\s*/
if $1[0] == ?<
@@ -424,8 +446,10 @@ module REXML
#| AdditiveExpr ('+' | S '-') MultiplicativeExpr
#| MultiplicativeExpr
def AdditiveExpr path, parsed
+ #puts "ADDITIVE >>> #{path}"
n = []
rest = MultiplicativeExpr( path, n )
+ #puts "ADDITIVE <<< #{rest}"
if rest != path
while rest =~ /^\s*(\+| -)\s*/
if $1[0] == ?+
@@ -447,8 +471,10 @@ module REXML
#| MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr
#| UnaryExpr
def MultiplicativeExpr path, parsed
+ #puts "MULT >>> #{path}"
n = []
rest = UnaryExpr( path, n )
+ #puts "MULT <<< #{rest}"
if rest != path
while rest =~ /^\s*(\*| div | mod )\s*/
if $1[0] == ?*
@@ -481,8 +507,10 @@ module REXML
end
parsed << :neg if mult < 0
+ #puts "UNARY >>> #{path}"
n = []
path = UnionExpr( path, n )
+ #puts "UNARY <<< #{path}"
parsed.concat( n )
path
end
@@ -490,8 +518,10 @@ module REXML
#| UnionExpr '|' PathExpr
#| PathExpr
def UnionExpr path, parsed
+ #puts "UNION >>> #{path}"
n = []
rest = PathExpr( path, n )
+ #puts "UNION <<< #{rest}"
if rest != path
while rest =~ /^\s*(\|)\s*/
n = [ :union, n, [] ]
@@ -511,13 +541,16 @@ module REXML
def PathExpr path, parsed
path =~ /^\s*/
path = $'
+ #puts "PATH >>> #{path}"
n = []
rest = FilterExpr( path, n )
+ #puts "PATH <<< '#{rest}'"
if rest != path
if rest and rest[0] == ?/
return RelativeLocationPath(rest, n)
end
end
+ #puts "BEFORE WITH '#{rest}'"
rest = LocationPath(rest, n) if rest =~ /\A[\/\.\@\[\w*]/
parsed.concat(n)
return rest
@@ -526,9 +559,12 @@ module REXML
#| FilterExpr Predicate
#| PrimaryExpr
def FilterExpr path, parsed
+ #puts "FILTER >>> #{path}"
n = []
path = PrimaryExpr( path, n )
+ #puts "FILTER <<< #{path}"
path = Predicate(path, n) if path and path[0] == ?[
+ #puts "FILTER <<< #{path}"
parsed.concat(n)
path
end
@@ -550,19 +586,23 @@ module REXML
parsed << varname
#arry << @variables[ varname ]
when /^(\w[-\w]*)(?:\()/
+ #puts "PrimaryExpr :: Function >>> #$1 -- '#$''"
fname = $1
tmp = $'
+ #puts "#{fname} =~ #{NT.inspect}"
return path if fname =~ NT
path = tmp
parsed << :function
parsed << fname
path = FunctionCall(path, parsed)
when NUMBER
+ #puts "LITERAL or NUMBER: #$1"
varname = $1.nil? ? $2 : $1
path = $'
parsed << :literal
parsed << (varname.include?('.') ? varname.to_f : varname.to_i)
when LITERAL
+ #puts "LITERAL or NUMBER: #$1"
varname = $1.nil? ? $2 : $1
path = $'
parsed << :literal
diff --git a/lib/rexml/quickpath.rb b/lib/rexml/quickpath.rb
index f3ad29a93a..9bec2158dd 100644
--- a/lib/rexml/quickpath.rb
+++ b/lib/rexml/quickpath.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/functions'
require 'rexml/xmltokens'
diff --git a/lib/rexml/rexml.rb b/lib/rexml/rexml.rb
index fbc0d339d8..f89951171a 100644
--- a/lib/rexml/rexml.rb
+++ b/lib/rexml/rexml.rb
@@ -1,5 +1,4 @@
# -*- encoding: utf-8 -*-
-# frozen_string_literal: false
# REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby.
#
# REXML is a _pure_ Ruby, XML 1.0 conforming,
diff --git a/lib/rexml/sax2listener.rb b/lib/rexml/sax2listener.rb
index 5afdc80890..9f276eb4ed 100644
--- a/lib/rexml/sax2listener.rb
+++ b/lib/rexml/sax2listener.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
# A template for stream parser listeners.
# Note that the declarations (attlistdecl, elementdecl, etc) are trivially
diff --git a/lib/rexml/security.rb b/lib/rexml/security.rb
index 99b7460772..593b652dc6 100644
--- a/lib/rexml/security.rb
+++ b/lib/rexml/security.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
module Security
@@entity_expansion_limit = 10_000
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb
index af65cf4751..b653714b2f 100644
--- a/lib/rexml/source.rb
+++ b/lib/rexml/source.rb
@@ -1,5 +1,4 @@
# coding: US-ASCII
-# frozen_string_literal: false
require 'rexml/encoding'
module REXML
@@ -63,7 +62,7 @@ module REXML
# requirements; for another, the source can be consumed. You can easily
# confuse this method. Originally, the patterns were easier
# to construct and this method more robust, because this method
- # generated search regexps on the fly; however, this was
+ # generated search regexes on the fly; however, this was
# computationally expensive and slowed down the entire REXML package
# considerably, since this is by far the most commonly called method.
# @param pattern must be a Regexp, and must be in the form of
@@ -186,7 +185,7 @@ module REXML
# You'll notice that this next section is very similar to the same
# section in match(), but just a liiittle different. This is
# because it is a touch faster to do it this way with scan()
- # than the way match() does it; enough faster to warrant duplicating
+ # than the way match() does it; enough faster to warrent duplicating
# some code
if rv.size == 0
until @buffer =~ pattern or @source.nil?
@@ -286,7 +285,7 @@ module REXML
case @encoding
when "UTF-16BE", "UTF-16LE"
@source.binmode
- @source.set_encoding(@encoding, @encoding)
+ @source.set_encoding(@encoding)
end
@line_break = encode(">")
@pending_buffer, @buffer = @buffer, ""
diff --git a/lib/rexml/streamlistener.rb b/lib/rexml/streamlistener.rb
index 30c8945179..8805ffba4d 100644
--- a/lib/rexml/streamlistener.rb
+++ b/lib/rexml/streamlistener.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
# A template for stream parser listeners.
# Note that the declarations (attlistdecl, elementdecl, etc) are trivially
@@ -14,7 +13,7 @@ module REXML
def tag_start name, attrs
end
# Called when the end tag is reached. In the case of <tag/>, tag_end
- # will be called immediately after tag_start
+ # will be called immidiately after tag_start
# @p the name of the tag
def tag_end name
end
diff --git a/lib/rexml/syncenumerator.rb b/lib/rexml/syncenumerator.rb
index a9d2ad7f9c..11609bdf3d 100644
--- a/lib/rexml/syncenumerator.rb
+++ b/lib/rexml/syncenumerator.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
class SyncEnumerator
include Enumerable
diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb
index b132bab8f4..d3242ee46d 100644
--- a/lib/rexml/text.rb
+++ b/lib/rexml/text.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/security'
require 'rexml/entity'
require 'rexml/doctype'
diff --git a/lib/rexml/undefinednamespaceexception.rb b/lib/rexml/undefinednamespaceexception.rb
index e522ed57ea..8ebfdfd0a9 100644
--- a/lib/rexml/undefinednamespaceexception.rb
+++ b/lib/rexml/undefinednamespaceexception.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/parseexception'
module REXML
class UndefinedNamespaceException < ParseException
diff --git a/lib/rexml/validation/relaxng.rb b/lib/rexml/validation/relaxng.rb
index fb52438290..2441901d7b 100644
--- a/lib/rexml/validation/relaxng.rb
+++ b/lib/rexml/validation/relaxng.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/validation/validation"
require "rexml/parsers/baseparser"
@@ -146,6 +145,7 @@ module REXML
def next( event )
#print "In next with #{event.inspect}. "
+ #puts "Next (#@current) is #{@events[@current]}"
#p @previous
return @previous.pop.next( event ) if @events[@current].nil?
expand_ref_in( @events, @current ) if @events[@current].class == Ref
@@ -154,15 +154,19 @@ module REXML
@events[@current-1].previous = self
return @events[@current-1].next( event )
end
+ #puts "Current isn't a state"
if ( @events[@current].matches?(event) )
@current += 1
if @events[@current].nil?
+ #puts "#{inspect[0,5]} 1RETURNING #{@previous.inspect[0,5]}"
return @previous.pop
elsif @events[@current].kind_of? State
@current += 1
+ #puts "#{inspect[0,5]} 2RETURNING (#{@current-1}) #{@events[@current-1].inspect[0,5]}; on return, next is #{@events[@current]}"
@events[@current-1].previous = self
return @events[@current-1]
else
+ #puts "#{inspect[0,5]} RETURNING self w/ next(#@current) = #{@events[@current]}"
return self
end
else
@@ -389,10 +393,13 @@ module REXML
# Remove the references
# Find the events
end
+ #puts "In next with #{event.inspect}."
+ #puts "events is #{@events.inspect}"
unless @events
@events = []
return nil
end
+ #puts "current = #@current"
super
end
@@ -402,6 +409,8 @@ module REXML
end
def expected
+ #puts "IN CHOICE EXPECTED"
+ #puts "EVENTS = #{@events.inspect}"
return [@events[@current]] if @events.size > 0
return @choices.collect do |x|
if x[0].kind_of? State
@@ -470,6 +479,8 @@ module REXML
@choice += 1
end
+ #puts "In next with #{event.inspect}."
+ #puts "events is #{@events.inspect}"
@events = [] unless @events
end
@@ -480,22 +491,29 @@ module REXML
return nil unless @events[@current]
expand_ref_in( @events, @current ) if @events[@current].class == Ref
+ #puts "In next with #{event.inspect}."
+ #puts "Next (#@current) is #{@events[@current]}"
if ( @events[@current].kind_of? State )
@current += 1
@events[@current-1].previous = self
return @events[@current-1].next( event )
end
+ #puts "Current isn't a state"
return @previous.pop.next( event ) if @events[@current].nil?
if ( @events[@current].matches?(event) )
@current += 1
if @events[@current].nil?
+ #puts "#{inspect[0,5]} 1RETURNING self" unless @choices[@choice].nil?
return self unless @choices[@choice].nil?
+ #puts "#{inspect[0,5]} 1RETURNING #{@previous[-1].inspect[0,5]}"
return @previous.pop
elsif @events[@current].kind_of? State
@current += 1
+ #puts "#{inspect[0,5]} 2RETURNING (#{@current-1}) #{@events[@current-1].inspect[0,5]}; on return, next is #{@events[@current]}"
@events[@current-1].previous = self
return @events[@current-1]
else
+ #puts "#{inspect[0,5]} RETURNING self w/ next(#@current) = #{@events[@current]}"
return self
end
else
@@ -509,6 +527,8 @@ module REXML
end
def expected
+ #puts "IN CHOICE EXPECTED"
+ #puts "EVENTS = #{@events.inspect}"
return [@events[@current]] if @events[@current]
return @choices[@choice..-1].collect do |x|
if x[0].kind_of? State
diff --git a/lib/rexml/validation/validation.rb b/lib/rexml/validation/validation.rb
index f0c76f976c..8042e5d062 100644
--- a/lib/rexml/validation/validation.rb
+++ b/lib/rexml/validation/validation.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/validation/validationexception'
module REXML
@@ -16,6 +15,8 @@ module REXML
puts @root.inspect
end
def validate( event )
+ #puts "Current: #@current"
+ #puts "Event: #{event.inspect}"
@attr_stack = [] unless defined? @attr_stack
match = @current.next(event)
raise ValidationException.new( "Validation error. Expected: "+
@@ -26,6 +27,7 @@ module REXML
# Check for attributes
case event[0]
when :start_element
+ #puts "Checking attributes"
@attr_stack << event[2]
begin
sattr = [:start_attribute, nil]
@@ -33,14 +35,22 @@ module REXML
text = [:text, nil]
k, = event[2].find { |key,value|
sattr[1] = key
+ #puts "Looking for #{sattr.inspect}"
m = @current.next( sattr )
+ #puts "Got #{m.inspect}"
if m
# If the state has text children...
+ #puts "Looking for #{eattr.inspect}"
+ #puts "Expect #{m.expected}"
if m.matches?( eattr )
+ #puts "Got end"
@current = m
else
+ #puts "Didn't get end"
text[1] = value
+ #puts "Looking for #{text.inspect}"
m = m.next( text )
+ #puts "Got #{m.inspect}"
text[1] = nil
return false unless m
@current = m if m
@@ -84,6 +94,7 @@ module REXML
end
def matches?( event )
+ #puts "#@event_type =? #{event[0]} && #@event_arg =? #{event[1]} "
return false unless event[0] == @event_type
case event[0]
when nil
diff --git a/lib/rexml/validation/validationexception.rb b/lib/rexml/validation/validationexception.rb
index 78cd63fd04..4723d9e4d3 100644
--- a/lib/rexml/validation/validationexception.rb
+++ b/lib/rexml/validation/validationexception.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
module REXML
module Validation
class ValidationException < RuntimeError
diff --git a/lib/rexml/xmldecl.rb b/lib/rexml/xmldecl.rb
index a37e9f3ddc..465e6abeb7 100644
--- a/lib/rexml/xmldecl.rb
+++ b/lib/rexml/xmldecl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/encoding'
require 'rexml/source'
diff --git a/lib/rexml/xmltokens.rb b/lib/rexml/xmltokens.rb
index 392b47b1d3..7dc4e8b2ba 100644
--- a/lib/rexml/xmltokens.rb
+++ b/lib/rexml/xmltokens.rb
@@ -1,80 +1,13 @@
-# frozen_string_literal: false
module REXML
# Defines a number of tokens used for parsing XML. Not for general
# consumption.
module XMLTokens
- # From http://www.w3.org/TR/REC-xml/#sec-common-syn
- #
- # [4] NameStartChar ::=
- # ":" |
- # [A-Z] |
- # "_" |
- # [a-z] |
- # [#xC0-#xD6] |
- # [#xD8-#xF6] |
- # [#xF8-#x2FF] |
- # [#x370-#x37D] |
- # [#x37F-#x1FFF] |
- # [#x200C-#x200D] |
- # [#x2070-#x218F] |
- # [#x2C00-#x2FEF] |
- # [#x3001-#xD7FF] |
- # [#xF900-#xFDCF] |
- # [#xFDF0-#xFFFD] |
- # [#x10000-#xEFFFF]
- name_start_chars = [
- ":",
- "A-Z",
- "_",
- "a-z",
- "\\u00C0-\\u00D6",
- "\\u00D8-\\u00F6",
- "\\u00F8-\\u02FF",
- "\\u0370-\\u037D",
- "\\u037F-\\u1FFF",
- "\\u200C-\\u200D",
- "\\u2070-\\u218F",
- "\\u2C00-\\u2FEF",
- "\\u3001-\\uD7FF",
- "\\uF900-\\uFDCF",
- "\\uFDF0-\\uFFFD",
- "\\u{10000}-\\u{EFFFF}",
- ]
- # From http://www.w3.org/TR/REC-xml/#sec-common-syn
- #
- # [4a] NameChar ::=
- # NameStartChar |
- # "-" |
- # "." |
- # [0-9] |
- # #xB7 |
- # [#x0300-#x036F] |
- # [#x203F-#x2040]
- name_chars = name_start_chars + [
- "\\-",
- "\\.",
- "0-9",
- "\\u00B7",
- "\\u0300-\\u036F",
- "\\u203F-\\u2040",
- ]
- NAME_START_CHAR = "[#{name_start_chars.join('')}]"
- NAME_CHAR = "[#{name_chars.join('')}]"
- NAMECHAR = NAME_CHAR # deprecated. Use NAME_CHAR instead.
+ NCNAME_STR= '[\w:][\-\w.]*'
+ NAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
- # From http://www.w3.org/TR/xml-names11/#NT-NCName
- #
- # [6] NCNameStartChar ::= NameStartChar - ':'
- ncname_start_chars = name_start_chars - [":"]
- # From http://www.w3.org/TR/xml-names11/#NT-NCName
- #
- # [5] NCNameChar ::= NameChar - ':'
- ncname_chars = name_chars - [":"]
- NCNAME_STR = "[#{ncname_start_chars.join('')}][#{ncname_chars.join('')}]*"
- NAME_STR = "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
-
- NAME = "(#{NAME_START_CHAR}#{NAME_CHAR}*)"
- NMTOKEN = "(?:#{NAME_CHAR})+"
+ NAMECHAR = '[\-\w\.:]'
+ NAME = "([\\w:]#{NAMECHAR}*)"
+ NMTOKEN = "(?:#{NAMECHAR})+"
NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*"
REFERENCE = "(?:&#{NAME};|&#\\d+;|&#x[0-9a-fA-F]+;)"
diff --git a/lib/rexml/xpath.rb b/lib/rexml/xpath.rb
index f1cb99baea..0f99808def 100644
--- a/lib/rexml/xpath.rb
+++ b/lib/rexml/xpath.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/functions'
require 'rexml/xpath_parser'
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb
index edd1127735..0fc9da2e08 100644
--- a/lib/rexml/xpath_parser.rb
+++ b/lib/rexml/xpath_parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rexml/namespace'
require 'rexml/xmltokens'
require 'rexml/attribute'
@@ -64,13 +63,19 @@ module REXML
end
def parse path, nodeset
- path_stack = @parser.parse( path )
- match( path_stack, nodeset )
+ #puts "#"*40
+ path_stack = @parser.parse( path )
+ #puts "PARSE: #{path} => #{path_stack.inspect}"
+ #puts "PARSE: nodeset = #{nodeset.inspect}"
+ match( path_stack, nodeset )
end
def get_first path, nodeset
- path_stack = @parser.parse( path )
- first( path_stack, nodeset )
+ #puts "#"*40
+ path_stack = @parser.parse( path )
+ #puts "PARSE: #{path} => #{path_stack.inspect}"
+ #puts "PARSE: nodeset = #{nodeset.inspect}"
+ first( path_stack, nodeset )
end
def predicate path, nodeset
@@ -88,6 +93,7 @@ module REXML
#
# FIXME: This method is incomplete!
def first( path_stack, node )
+ #puts "#{depth}) Entering match( #{path.inspect}, #{tree.inspect} )"
return nil if path.size == 0
case path[0]
@@ -96,12 +102,16 @@ module REXML
return first( path[1..-1], node )
when :child
for c in node.children
+ #puts "#{depth}) CHILD checking #{name(c)}"
r = first( path[1..-1], c )
+ #puts "#{depth}) RETURNING #{r.inspect}" if r
return r if r
end
when :qname
name = path[2]
+ #puts "#{depth}) QNAME #{name(tree)} == #{name} (path => #{path.size})"
if node.name == name
+ #puts "#{depth}) RETURNING #{tree.inspect}" if path.size == 3
return node if path.size == 3
return first( path[3..-1], node )
else
@@ -124,7 +134,10 @@ module REXML
def match( path_stack, nodeset )
+ #puts "MATCH: path_stack = #{path_stack.inspect}"
+ #puts "MATCH: nodeset = #{nodeset.inspect}"
r = expr( path_stack, nodeset )
+ #puts "MAIN EXPR => #{r.inspect}"
r
end
@@ -151,9 +164,15 @@ module REXML
ALL = [ :attribute, :element, :text, :processing_instruction, :comment ]
ELEMENTS = [ :element ]
def expr( path_stack, nodeset, context=nil )
+ #puts "#"*15
+ #puts "In expr with #{path_stack.inspect}"
+ #puts "Returning" if path_stack.length == 0 || nodeset.length == 0
node_types = ELEMENTS
return nodeset if path_stack.length == 0 || nodeset.length == 0
while path_stack.length > 0
+ #puts "#"*5
+ #puts "Path stack = #{path_stack.inspect}"
+ #puts "Nodeset is #{nodeset.inspect}"
if nodeset.length == 0
path_stack.clear
return []
@@ -161,15 +180,21 @@ module REXML
case (op = path_stack.shift)
when :document
nodeset = [ nodeset[0].root_node ]
+ #puts ":document, nodeset = #{nodeset.inspect}"
when :qname
+ #puts "IN QNAME"
prefix = path_stack.shift
name = path_stack.shift
nodeset.delete_if do |node|
# FIXME: This DOUBLES the time XPath searches take
ns = get_namespace( node, prefix )
+ #puts "NS = #{ns.inspect}"
+ #puts "node.node_type == :element => #{node.node_type == :element}"
if node.node_type == :element
+ #puts "node.name == #{name} => #{node.name == name}"
if node.name == name
+ #puts "node.namespace == #{ns.inspect} => #{node.namespace == ns}"
end
end
!(node.node_type == :element and
@@ -179,7 +204,10 @@ module REXML
node_types = ELEMENTS
when :any
+ #puts "ANY 1: nodeset = #{nodeset.inspect}"
+ #puts "ANY 1: node_types = #{node_types.inspect}"
nodeset.delete_if { |node| !node_types.include?(node.node_type) }
+ #puts "ANY 2: nodeset = #{nodeset.inspect}"
when :self
# This space left intentionally blank
@@ -222,11 +250,15 @@ module REXML
name = path_stack.shift
for element in nodeset
if element.node_type == :element
+ #puts "Element name = #{element.name}"
+ #puts "get_namespace( #{element.inspect}, #{prefix} ) = #{get_namespace(element, prefix)}"
attrib = element.attribute( name, get_namespace(element, prefix) )
+ #puts "attrib = #{attrib.inspect}"
new_nodeset << attrib if attrib
end
end
when :any
+ #puts "ANY"
for element in nodeset
if element.node_type == :element
new_nodeset += element.attributes.to_a
@@ -236,8 +268,10 @@ module REXML
nodeset = new_nodeset
when :parent
+ #puts "PARENT 1: nodeset = #{nodeset}"
nodeset = nodeset.collect{|n| n.parent}.compact
#nodeset = expr(path_stack.dclone, nodeset.collect{|n| n.parent}.compact)
+ #puts "PARENT 2: nodeset = #{nodeset.inspect}"
node_types = ELEMENTS
when :ancestor
@@ -271,30 +305,41 @@ module REXML
pred = path_stack.shift
nodeset.each_with_index { |node, index|
subcontext[ :node ] = node
+ #puts "PREDICATE SETTING CONTEXT INDEX TO #{index+1}"
subcontext[ :index ] = index+1
pc = pred.dclone
+ #puts "#{node.hash}) Recursing with #{pred.inspect} and [#{node.inspect}]"
result = expr( pc, [node], subcontext )
result = result[0] if result.kind_of? Array and result.length == 1
+ #puts "#{node.hash}) Result = #{result.inspect} (#{result.class.name})"
if result.kind_of? Numeric
+ #puts "Adding node #{node.inspect}" if result == (index+1)
new_nodeset << node if result == (index+1)
elsif result.instance_of? Array
if result.size > 0 and result.inject(false) {|k,s| s or k}
+ #puts "Adding node #{node.inspect}" if result.size > 0
new_nodeset << node if result.size > 0
end
else
+ #puts "Adding node #{node.inspect}" if result
new_nodeset << node if result
end
}
+ #puts "New nodeset = #{new_nodeset.inspect}"
+ #puts "Path_stack = #{path_stack.inspect}"
nodeset = new_nodeset
=begin
predicate = path_stack.shift
ns = nodeset.clone
result = expr( predicate, ns )
+ #puts "Result = #{result.inspect} (#{result.class.name})"
+ #puts "nodeset = #{nodeset.inspect}"
if result.kind_of? Array
nodeset = result.zip(ns).collect{|m,n| n if m}.compact
else
nodeset = result ? nodeset : []
end
+ #puts "Outgoing NS = #{nodeset.inspect}"
=end
when :descendant_or_self
@@ -315,6 +360,7 @@ module REXML
node_types = ELEMENTS
when :following_sibling
+ #puts "FOLLOWING_SIBLING 1: nodeset = #{nodeset}"
results = []
nodeset.each do |node|
next if node.parent.nil?
@@ -323,6 +369,7 @@ module REXML
following_siblings = all_siblings[ current_index+1 .. -1 ]
results += expr( path_stack.dclone, following_siblings )
end
+ #puts "FOLLOWING_SIBLING 2: nodeset = #{nodeset}"
nodeset = results
when :preceding_sibling
@@ -342,6 +389,7 @@ module REXML
nodeset.each do |node|
new_nodeset += preceding( node )
end
+ #puts "NEW NODESET => #{new_nodeset.inspect}"
nodeset = new_nodeset
node_types = ELEMENTS
@@ -354,6 +402,7 @@ module REXML
node_types = ELEMENTS
when :namespace
+ #puts "In :namespace"
new_nodeset = []
prefix = path_stack.shift
nodeset.each do |node|
@@ -365,6 +414,9 @@ module REXML
else
namespaces = node.element.namesapces
end
+ #puts "Namespaces = #{namespaces.inspect}"
+ #puts "Prefix = #{prefix.inspect}"
+ #puts "Node.namespace = #{node.namespace}"
if (node.namespace == namespaces[prefix])
new_nodeset << node
end
@@ -382,18 +434,24 @@ module REXML
# :or and false for :and).
when :eq, :neq, :lt, :lteq, :gt, :gteq, :or
left = expr( path_stack.shift, nodeset.dup, context )
+ #puts "LEFT => #{left.inspect} (#{left.class.name})"
right = expr( path_stack.shift, nodeset.dup, context )
+ #puts "RIGHT => #{right.inspect} (#{right.class.name})"
res = equality_relational_compare( left, op, right )
+ #puts "RES => #{res.inspect}"
return res
when :and
left = expr( path_stack.shift, nodeset.dup, context )
+ #puts "LEFT => #{left.inspect} (#{left.class.name})"
return [] unless left
if left.respond_to?(:inject) and !left.inject(false) {|a,b| a | b}
return []
end
right = expr( path_stack.shift, nodeset.dup, context )
+ #puts "RIGHT => #{right.inspect} (#{right.class.name})"
res = equality_relational_compare( left, op, right )
+ #puts "RES => #{res.inspect}"
return res
when :div
@@ -434,6 +492,7 @@ module REXML
when :function
func_name = path_stack.shift.tr('-','_')
arguments = path_stack.shift
+ #puts "FUNCTION 0: #{func_name}(#{arguments.collect{|a|a.inspect}.join(', ')})"
subcontext = context ? nil : { :size => nodeset.size }
res = []
@@ -446,15 +505,19 @@ module REXML
end
arg_clone = arguments.dclone
args = arg_clone.collect { |arg|
+ #puts "FUNCTION 1: Calling expr( #{arg.inspect}, [#{n.inspect}] )"
expr( arg, [n], cont )
}
+ #puts "FUNCTION 2: #{func_name}(#{args.collect{|a|a.inspect}.join(', ')})"
Functions.context = cont
res << Functions.send( func_name, *args )
+ #puts "FUNCTION 3: #{res[-1].inspect}"
}
return res
end
end # while
+ #puts "EXPR returning #{nodeset.inspect}"
return nodeset
end
@@ -469,15 +532,21 @@ module REXML
def descendant_or_self( path_stack, nodeset )
rs = []
+ #puts "#"*80
+ #puts "PATH_STACK = #{path_stack.inspect}"
+ #puts "NODESET = #{nodeset.collect{|n|n.inspect}.inspect}"
d_o_s( path_stack, nodeset, rs )
+ #puts "RS = #{rs.collect{|n|n.inspect}.inspect}"
document_order(rs.flatten.compact)
#rs.flatten.compact
end
def d_o_s( p, ns, r )
+ #puts "IN DOS with #{ns.inspect}; ALREADY HAVE #{r.inspect}"
nt = nil
ns.each_index do |i|
n = ns[i]
+ #puts "P => #{p.inspect}"
x = expr( p.dclone, [ n ] )
nt = n.node_type
d_o_s( p, n.children, x ) if nt == :element or nt == :document and n.children.size > 0
@@ -505,6 +574,7 @@ module REXML
end
new_arry << [ node_idx.reverse, node ]
}
+ #puts "new_arry = #{new_arry.inspect}"
new_arry.sort{ |s1, s2| s1[0] <=> s2[0] }.collect{ |s| s[1] }
end
@@ -523,6 +593,7 @@ module REXML
# preceding:: includes every element in the document that precedes this node,
# except for ancestors
def preceding( node )
+ #puts "IN PRECEDING"
ancestors = []
p = node.parent
while p
@@ -532,6 +603,7 @@ module REXML
acc = []
p = preceding_node_of( node )
+ #puts "P = #{p.inspect}"
while p
if ancestors.include? p
ancestors.delete(p)
@@ -539,11 +611,15 @@ module REXML
acc << p
end
p = preceding_node_of( p )
+ #puts "P = #{p.inspect}"
end
acc
end
def preceding_node_of( node )
+ #puts "NODE: #{node.inspect}"
+ #puts "PREVIOUS NODE: #{node.previous_sibling_node.inspect}"
+ #puts "PARENT NODE: #{node.parent}"
psn = node.previous_sibling_node
if psn.nil?
if node.parent.nil? or node.parent.class == Document
@@ -559,16 +635,22 @@ module REXML
end
def following( node )
+ #puts "IN PRECEDING"
acc = []
p = next_sibling_node( node )
+ #puts "P = #{p.inspect}"
while p
acc << p
p = following_node_of( p )
+ #puts "P = #{p.inspect}"
end
acc
end
def following_node_of( node )
+ #puts "NODE: #{node.inspect}"
+ #puts "PREVIOUS NODE: #{node.previous_sibling_node.inspect}"
+ #puts "PARENT NODE: #{node.parent}"
if node.kind_of? Element and node.children.size > 0
return node.children[0]
end
@@ -583,6 +665,7 @@ module REXML
end
node = node.parent
psn = node.next_sibling_node
+ #puts "psn = #{psn.inspect}"
end
return psn
end
@@ -601,17 +684,22 @@ module REXML
end
def equality_relational_compare( set1, op, set2 )
+ #puts "EQ_REL_COMP(#{set1.inspect} #{op.inspect} #{set2.inspect})"
if set1.kind_of? Array and set2.kind_of? Array
+ #puts "#{set1.size} & #{set2.size}"
if set1.size == 1 and set2.size == 1
set1 = set1[0]
set2 = set2[0]
elsif set1.size == 0 or set2.size == 0
nd = set1.size==0 ? set2 : set1
rv = nd.collect { |il| compare( il, op, nil ) }
+ #puts "RV = #{rv.inspect}"
return rv
else
res = []
SyncEnumerator.new( set1, set2 ).each { |i1, i2|
+ #puts "i1 = #{i1.inspect} (#{i1.class.name})"
+ #puts "i2 = #{i2.inspect} (#{i2.class.name})"
i1 = norm( i1 )
i2 = norm( i2 )
res << compare( i1, op, i2 )
@@ -619,6 +707,8 @@ module REXML
return res
end
end
+ #puts "EQ_REL_COMP: #{set1.inspect} (#{set1.class.name}), #{op}, #{set2.inspect} (#{set2.class.name})"
+ #puts "COMPARING VALUES"
# If one is nodeset and other is number, compare number to each item
# in nodeset s.t. number op number(string(item))
# If one is nodeset and other is string, compare string to each item
@@ -626,6 +716,7 @@ module REXML
# If one is nodeset and other is boolean, compare boolean to each item
# in nodeset s.t. boolean op boolean(item)
if set1.kind_of? Array or set2.kind_of? Array
+ #puts "ISA ARRAY"
if set1.kind_of? Array
a = set1
b = set2
@@ -641,8 +732,10 @@ module REXML
return a.collect {|v| compare( Functions::number(v), op, b )}
when /^\d+(\.\d+)?$/
b = Functions::number( b )
+ #puts "B = #{b.inspect}"
return a.collect {|v| compare( Functions::number(v), op, b )}
else
+ #puts "Functions::string( #{b}(#{b.class.name}) ) = #{Functions::string(b)}"
b = Functions::string( b )
return a.collect { |v| compare( Functions::string(v), op, b ) }
end
@@ -656,7 +749,10 @@ module REXML
# Convert both to numbers and compare
s1 = set1.to_s
s2 = set2.to_s
+ #puts "EQ_REL_COMP: #{set1}=>#{s1}, #{set2}=>#{s2}"
if s1 == 'true' or s1 == 'false' or s2 == 'true' or s2 == 'false'
+ #puts "Functions::boolean(#{set1})=>#{Functions::boolean(set1)}"
+ #puts "Functions::boolean(#{set2})=>#{Functions::boolean(set2)}"
set1 = Functions::boolean( set1 )
set2 = Functions::boolean( set2 )
else
@@ -673,12 +769,15 @@ module REXML
set2 = Functions::number( set2 )
end
end
+ #puts "EQ_REL_COMP: #{set1} #{op} #{set2}"
+ #puts ">>> #{compare( set1, op, set2 )}"
return compare( set1, op, set2 )
end
return false
end
def compare a, op, b
+ #puts "COMPARE #{a.inspect}(#{a.class.name}) #{op} #{b.inspect}(#{b.class.name})"
case op
when :eq
a == b
diff --git a/lib/rinda/rinda.rb b/lib/rinda/rinda.rb
index 36c3503aa8..d9cd3782a0 100644
--- a/lib/rinda/rinda.rb
+++ b/lib/rinda/rinda.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'drb/drb'
require 'thread'
diff --git a/lib/rinda/ring.rb b/lib/rinda/ring.rb
index 9ec8a2fb2f..29ea5f0ff6 100644
--- a/lib/rinda/ring.rb
+++ b/lib/rinda/ring.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Note: Rinda::Ring API is unstable.
#
@@ -213,7 +212,7 @@ module Rinda
# address of the local TupleSpace.
def do_reply
- tuple = @ts.take([:lookup_ring, nil], @renewer)
+ tuple = @ts.take([:lookup_ring, DRbObject], @renewer)
Thread.new { tuple[1].call(@ts) rescue nil}
rescue
end
@@ -226,7 +225,6 @@ module Rinda
@w_services.each do |thread|
thread.kill
- thread.join
end
@sockets.each do |socket|
@@ -234,7 +232,6 @@ module Rinda
end
@r_service.kill
- @r_service.join
end
end
@@ -414,26 +411,23 @@ module Rinda
addrinfo = Addrinfo.udp(address, @port)
soc = Socket.new(addrinfo.pfamily, addrinfo.socktype, addrinfo.protocol)
- begin
- if addrinfo.ipv4_multicast? then
- soc.setsockopt(Socket::Option.ipv4_multicast_loop(1))
- soc.setsockopt(Socket::Option.ipv4_multicast_ttl(@multicast_hops))
- elsif addrinfo.ipv6_multicast? then
- soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_LOOP, true)
- soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS,
- [@multicast_hops].pack('I'))
- soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_IF,
- [@multicast_interface].pack('I'))
- else
- soc.setsockopt(:SOL_SOCKET, :SO_BROADCAST, true)
- end
- soc.connect(addrinfo)
- rescue Exception
- soc.close
- raise
+ if addrinfo.ipv4_multicast? then
+ soc.setsockopt(:IPPROTO_IP, :IP_MULTICAST_LOOP, true)
+ soc.setsockopt(:IPPROTO_IP, :IP_MULTICAST_TTL,
+ [@multicast_hops].pack('c'))
+ elsif addrinfo.ipv6_multicast? then
+ soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_LOOP, true)
+ soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_HOPS,
+ [@multicast_hops].pack('I'))
+ soc.setsockopt(:IPPROTO_IPV6, :IPV6_MULTICAST_IF,
+ [@multicast_interface].pack('I'))
+ else
+ soc.setsockopt(:SOL_SOCKET, :SO_BROADCAST, true)
end
+ soc.connect(addrinfo)
+
soc
end
@@ -479,3 +473,27 @@ module Rinda
end
end
+
+if __FILE__ == $0
+ DRb.start_service
+ case ARGV.shift
+ when 's'
+ require 'rinda/tuplespace'
+ ts = Rinda::TupleSpace.new
+ Rinda::RingServer.new(ts)
+ $stdin.gets
+ when 'w'
+ finger = Rinda::RingFinger.new(nil)
+ finger.lookup_ring do |ts2|
+ p ts2
+ ts2.write([:hello, :world])
+ end
+ when 'r'
+ finger = Rinda::RingFinger.new(nil)
+ finger.lookup_ring do |ts2|
+ p ts2
+ p ts2.take([nil, nil])
+ end
+ end
+end
+
diff --git a/lib/rinda/tuplespace.rb b/lib/rinda/tuplespace.rb
index e29bd63126..ee2bef1769 100644
--- a/lib/rinda/tuplespace.rb
+++ b/lib/rinda/tuplespace.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: false
require 'monitor'
require 'thread'
require 'drb/drb'
require 'rinda/rinda'
+require 'enumerator'
require 'forwardable'
module Rinda
@@ -76,7 +76,7 @@ module Rinda
# Reset the expiry time according to +sec_or_renewer+.
#
# +nil+:: it is set to expire in the far future.
- # +true+:: it has expired.
+ # +false+:: it has expired.
# Numeric:: it will expire in that many seconds.
#
# Otherwise the argument refers to some kind of renewer object
diff --git a/lib/rss.rb b/lib/rss.rb
index 1c7d72b9f7..fd7364645b 100644
--- a/lib/rss.rb
+++ b/lib/rss.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# = RSS reading and writing
#
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb
index d852a6a85e..77b2de131c 100644
--- a/lib/rss/0.9.rb
+++ b/lib/rss/0.9.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/parser"
module RSS
diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb
index fb63937c5e..a2d88d459e 100644
--- a/lib/rss/1.0.rb
+++ b/lib/rss/1.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/parser"
module RSS
diff --git a/lib/rss/2.0.rb b/lib/rss/2.0.rb
index 13f9ade918..5c0caecd73 100644
--- a/lib/rss/2.0.rb
+++ b/lib/rss/2.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/0.9"
module RSS
diff --git a/lib/rss/atom.rb b/lib/rss/atom.rb
index a232e358be..d3524231ff 100644
--- a/lib/rss/atom.rb
+++ b/lib/rss/atom.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/parser'
module RSS
diff --git a/lib/rss/content.rb b/lib/rss/content.rb
index d35311075a..5a2120c067 100644
--- a/lib/rss/content.rb
+++ b/lib/rss/content.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/rss"
module RSS
diff --git a/lib/rss/content/1.0.rb b/lib/rss/content/1.0.rb
index 1367dfe092..e5dc857930 100644
--- a/lib/rss/content/1.0.rb
+++ b/lib/rss/content/1.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/1.0'
module RSS
diff --git a/lib/rss/content/2.0.rb b/lib/rss/content/2.0.rb
index 3b468248ac..8491a99937 100644
--- a/lib/rss/content/2.0.rb
+++ b/lib/rss/content/2.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/2.0"
module RSS
diff --git a/lib/rss/converter.rb b/lib/rss/converter.rb
index b92e35a051..3e79eba4fb 100644
--- a/lib/rss/converter.rb
+++ b/lib/rss/converter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/utils"
module RSS
diff --git a/lib/rss/dublincore.rb b/lib/rss/dublincore.rb
index 8d1a551947..58424141cd 100644
--- a/lib/rss/dublincore.rb
+++ b/lib/rss/dublincore.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/rss"
module RSS
diff --git a/lib/rss/dublincore/1.0.rb b/lib/rss/dublincore/1.0.rb
index 1d96fab9b9..efe2f5dad4 100644
--- a/lib/rss/dublincore/1.0.rb
+++ b/lib/rss/dublincore/1.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/1.0"
module RSS
diff --git a/lib/rss/dublincore/2.0.rb b/lib/rss/dublincore/2.0.rb
index e3011fef6a..a79c1e84a4 100644
--- a/lib/rss/dublincore/2.0.rb
+++ b/lib/rss/dublincore/2.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/2.0"
module RSS
diff --git a/lib/rss/dublincore/atom.rb b/lib/rss/dublincore/atom.rb
index 0b8b11e440..8db9066bb8 100644
--- a/lib/rss/dublincore/atom.rb
+++ b/lib/rss/dublincore/atom.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/atom"
module RSS
diff --git a/lib/rss/image.rb b/lib/rss/image.rb
index 6b86ec0e5b..b0619141bb 100644
--- a/lib/rss/image.rb
+++ b/lib/rss/image.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/1.0'
require 'rss/dublincore'
diff --git a/lib/rss/itunes.rb b/lib/rss/itunes.rb
index 827970c209..e6de5c1ca2 100644
--- a/lib/rss/itunes.rb
+++ b/lib/rss/itunes.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/2.0'
module RSS
diff --git a/lib/rss/maker.rb b/lib/rss/maker.rb
index 33d285f6af..824b2b2dcd 100644
--- a/lib/rss/maker.rb
+++ b/lib/rss/maker.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/rss"
module RSS
diff --git a/lib/rss/maker/0.9.rb b/lib/rss/maker/0.9.rb
index 622a4c30b4..c398343ec4 100644
--- a/lib/rss/maker/0.9.rb
+++ b/lib/rss/maker/0.9.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/0.9"
require "rss/maker/base"
diff --git a/lib/rss/maker/1.0.rb b/lib/rss/maker/1.0.rb
index 3aee77e913..1b9f7c3b79 100644
--- a/lib/rss/maker/1.0.rb
+++ b/lib/rss/maker/1.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/1.0"
require "rss/maker/base"
diff --git a/lib/rss/maker/2.0.rb b/lib/rss/maker/2.0.rb
index 1f77a014d1..15b1349c2a 100644
--- a/lib/rss/maker/2.0.rb
+++ b/lib/rss/maker/2.0.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/2.0"
require "rss/maker/0.9"
diff --git a/lib/rss/maker/atom.rb b/lib/rss/maker/atom.rb
index e0cd7623c8..fd3198cd9e 100644
--- a/lib/rss/maker/atom.rb
+++ b/lib/rss/maker/atom.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/atom"
require "rss/maker/base"
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index bc4ca84141..36860032da 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'forwardable'
require 'rss/rss'
@@ -368,7 +367,7 @@ module RSS
self.date ||= self.dc_date
super
ensure
- self.date = keep[:date]
+ date = keep[:date]
dc_dates.replace(keep[:dc_dates])
end
diff --git a/lib/rss/maker/content.rb b/lib/rss/maker/content.rb
index 3559a45ad0..46c4911f73 100644
--- a/lib/rss/maker/content.rb
+++ b/lib/rss/maker/content.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/content'
require 'rss/maker/1.0'
require 'rss/maker/2.0'
diff --git a/lib/rss/maker/dublincore.rb b/lib/rss/maker/dublincore.rb
index 988209c045..717b074fae 100644
--- a/lib/rss/maker/dublincore.rb
+++ b/lib/rss/maker/dublincore.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/dublincore'
require 'rss/maker/1.0'
diff --git a/lib/rss/maker/entry.rb b/lib/rss/maker/entry.rb
index f806cbcaae..f8f5469f2c 100644
--- a/lib/rss/maker/entry.rb
+++ b/lib/rss/maker/entry.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/maker/atom"
require "rss/maker/feed"
diff --git a/lib/rss/maker/feed.rb b/lib/rss/maker/feed.rb
index fdef7ad643..0129218b0c 100644
--- a/lib/rss/maker/feed.rb
+++ b/lib/rss/maker/feed.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/maker/atom"
module RSS
diff --git a/lib/rss/maker/image.rb b/lib/rss/maker/image.rb
index 1957ba8689..06084b4af4 100644
--- a/lib/rss/maker/image.rb
+++ b/lib/rss/maker/image.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/image'
require 'rss/maker/1.0'
require 'rss/maker/dublincore'
diff --git a/lib/rss/maker/itunes.rb b/lib/rss/maker/itunes.rb
index cc1051ae0c..8b7420da3c 100644
--- a/lib/rss/maker/itunes.rb
+++ b/lib/rss/maker/itunes.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/itunes'
require 'rss/maker/2.0'
diff --git a/lib/rss/maker/slash.rb b/lib/rss/maker/slash.rb
index 3bd82d3057..27adef3832 100644
--- a/lib/rss/maker/slash.rb
+++ b/lib/rss/maker/slash.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/slash'
require 'rss/maker/1.0'
diff --git a/lib/rss/maker/syndication.rb b/lib/rss/maker/syndication.rb
index 840b70229a..b81230457c 100644
--- a/lib/rss/maker/syndication.rb
+++ b/lib/rss/maker/syndication.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/syndication'
require 'rss/maker/1.0'
diff --git a/lib/rss/maker/taxonomy.rb b/lib/rss/maker/taxonomy.rb
index 76a2d1600d..13ae9aa805 100644
--- a/lib/rss/maker/taxonomy.rb
+++ b/lib/rss/maker/taxonomy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/taxonomy'
require 'rss/maker/1.0'
require 'rss/maker/dublincore'
diff --git a/lib/rss/maker/trackback.rb b/lib/rss/maker/trackback.rb
index f97691c608..00f001cb85 100644
--- a/lib/rss/maker/trackback.rb
+++ b/lib/rss/maker/trackback.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/trackback'
require 'rss/maker/1.0'
require 'rss/maker/2.0'
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb
index a9842e6d40..1b6e4e9596 100644
--- a/lib/rss/parser.rb
+++ b/lib/rss/parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "forwardable"
require "open-uri"
diff --git a/lib/rss/rexmlparser.rb b/lib/rss/rexmlparser.rb
index ef0595e447..a5a2a2edbe 100644
--- a/lib/rss/rexmlparser.rb
+++ b/lib/rss/rexmlparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rexml/document"
require "rexml/streamlistener"
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 3921e48457..6c89598e2d 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "time"
class Time
@@ -29,7 +28,7 @@ class Time
datetime = apply_offset(*(datetime + [off]))
datetime << usec
time = Time.utc(*datetime)
- force_zone!(time, zone, off)
+ time.localtime unless zone_utc?(zone)
time
else
datetime << usec
@@ -54,7 +53,7 @@ class Time
if usec.zero?
fraction_digits = 0
else
- fraction_digits = strftime('%6N').index(/0*\z/)
+ fraction_digits = Math.log10(usec.to_s.sub(/0*$/, '').to_i).floor + 1
end
xmlschema(fraction_digits)
end
@@ -106,7 +105,7 @@ module RSS
end
# Some tags must only exist a specific number of times in a given RSS feed.
- # If a feed has too many occurrences of one of these tags, a TooMuchTagError
+ # If a feed has too many occurances of one of these tags, a TooMuchTagError
# will be raised.
class TooMuchTagError < InvalidRSSError
attr_reader :tag, :parent
@@ -963,7 +962,7 @@ EOC
children = child
children.any? {|c| c.have_required_elements?}
else
- not child.nil?
+ !child.to_s.empty?
end
else
true
diff --git a/lib/rss/slash.rb b/lib/rss/slash.rb
index 0055fc9f88..65c61142e1 100644
--- a/lib/rss/slash.rb
+++ b/lib/rss/slash.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'rss/1.0'
module RSS
diff --git a/lib/rss/syndication.rb b/lib/rss/syndication.rb
index 8f9620f9f3..77a84b9a2a 100644
--- a/lib/rss/syndication.rb
+++ b/lib/rss/syndication.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/1.0"
module RSS
@@ -48,7 +47,7 @@ module RSS
private
SY_UPDATEPERIOD_AVAILABLE_VALUES = %w(hourly daily weekly monthly yearly)
- def validate_sy_updatePeriod(value) # :nodoc:
+ def validate_sy_updatePeriod(value)
unless SY_UPDATEPERIOD_AVAILABLE_VALUES.include?(value)
raise NotAvailableValueError.new("updatePeriod", value)
end
diff --git a/lib/rss/taxonomy.rb b/lib/rss/taxonomy.rb
index b7ea219e8c..b7fbe6b0de 100644
--- a/lib/rss/taxonomy.rb
+++ b/lib/rss/taxonomy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/1.0"
require "rss/dublincore"
diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb
index 1a3c3849b5..577bf0cef7 100644
--- a/lib/rss/trackback.rb
+++ b/lib/rss/trackback.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# This file contains the implementation of trackbacks. It is entirely internal
# and not useful to outside developers.
require 'rss/1.0'
diff --git a/lib/rss/utils.rb b/lib/rss/utils.rb
index ce7dbf1b02..5ed214159f 100644
--- a/lib/rss/utils.rb
+++ b/lib/rss/utils.rb
@@ -1,10 +1,9 @@
-# frozen_string_literal: false
module RSS
##
# RSS::Utils is a module that holds various utility functions that are used
# across many parts of the rest of the RSS library. Like most modules named
- # some variant of 'util', its methods are probably not particularly useful
+ # some variant of 'util', its methods are probably not particuarly useful
# to those who aren't developing the library itself.
module Utils
module_function
diff --git a/lib/rss/xml-stylesheet.rb b/lib/rss/xml-stylesheet.rb
index be9cfaaf64..96ee95050e 100644
--- a/lib/rss/xml-stylesheet.rb
+++ b/lib/rss/xml-stylesheet.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/utils"
module RSS
diff --git a/lib/rss/xml.rb b/lib/rss/xml.rb
index cda8668044..1ae878b772 100644
--- a/lib/rss/xml.rb
+++ b/lib/rss/xml.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "rss/utils"
module RSS
diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb
index cb2dd2afdd..6af157a2f2 100644
--- a/lib/rss/xmlparser.rb
+++ b/lib/rss/xmlparser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
begin
require "xml/parser"
rescue LoadError
@@ -21,7 +20,7 @@ end
module XML
class Parser
unless defined?(Error)
- # This error is legacy, so we just set it to the new one
+ # This erorr is legacy, so we just set it to the new one
Error = ::XMLParserError # :nodoc:
end
end
diff --git a/lib/rss/xmlscanner.rb b/lib/rss/xmlscanner.rb
index 6e3b13d2f5..1cdf81c0c3 100644
--- a/lib/rss/xmlscanner.rb
+++ b/lib/rss/xmlscanner.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'xmlscan/scanner'
require 'stringio'
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index fd4075a632..8a0d992141 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
@@ -7,10 +6,9 @@
#++
require 'rbconfig'
-require 'thread'
module Gem
- VERSION = '2.5.2.2'
+ VERSION = '2.2.0'
end
# Must be first since it unloads the prelude from 1.9.2
@@ -27,12 +25,12 @@ require 'rubygems/errors'
# For user documentation, see:
#
# * <tt>gem help</tt> and <tt>gem help [command]</tt>
-# * {RubyGems User Guide}[http://guides.rubygems.org/]
-# * {Frequently Asked Questions}[http://guides.rubygems.org/faqs]
+# * {RubyGems User Guide}[http://docs.rubygems.org/read/book/1]
+# * {Frequently Asked Questions}[http://docs.rubygems.org/read/book/3]
#
# For gem developer documentation see:
#
-# * {Creating Gems}[http://guides.rubygems.org/make-your-own-gem]
+# * {Creating Gems}[http://docs.rubygems.org/read/chapter/5]
# * Gem::Specification
# * Gem::Version for version dependency notes
#
@@ -58,8 +56,8 @@ require 'rubygems/errors'
# RubyGems defaults are stored in rubygems/defaults.rb. If you're packaging
# RubyGems or implementing Ruby you can change RubyGems' defaults.
#
-# For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb
-# and override any defaults from lib/rubygems/defaults.rb.
+# For RubyGems packagers, provide lib/rubygems/operating_system.rb and
+# override any defaults from lib/rubygems/defaults.rb.
#
# For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and
# override any defaults from lib/rubygems/defaults.rb.
@@ -85,7 +83,7 @@ require 'rubygems/errors'
# * Chad Fowler -- chad(at)chadfowler.com
# * David Black -- dblack(at)wobblini.net
# * Paul Brannan -- paul(at)atdesk.com
-# * Jim Weirich -- jim(at)weirichhouse.org
+# * Jim Weirch -- jim(at)weirichhouse.org
#
# Contributors:
#
@@ -157,9 +155,7 @@ module Gem
@@win_platform = nil
@configuration = nil
- @gemdeps = nil
@loaded_specs = {}
- LOADED_SPECS_MUTEX = Mutex.new
@path_to_default_spec_map = {}
@platforms = []
@ruby = nil
@@ -182,13 +178,17 @@ module Gem
def self.try_activate path
# finds the _latest_ version... regardless of loaded specs and their deps
# if another gem had a requirement that would mean we shouldn't
- # activate the latest version, then either it would already be activated
- # or if it was ambiguous (and thus unresolved) the code in our custom
+ # activate the latest version, then either it would alreaby be activated
+ # or if it was ambigious (and thus unresolved) the code in our custom
# require will try to activate the more specific version.
- spec = Gem::Specification.find_by_path path
- return false unless spec
- return true if spec.activated?
+ spec = Gem::Specification.find_inactive_by_path path
+
+ unless spec
+ spec = Gem::Specification.find_by_path path
+ return true if spec && spec.activated?
+ return false
+ end
begin
spec.activate
@@ -230,16 +230,10 @@ module Gem
requirements = Gem::Requirement.default if
requirements.empty?
- dep = Gem::Dependency.new name, requirements
-
- loaded = Gem.loaded_specs[name]
-
- return loaded.bin_file exec_name if loaded && dep.matches_spec?(loaded)
-
- specs = dep.matching_specs(true)
+ specs = Gem::Dependency.new(name, requirements).matching_specs(true)
raise Gem::GemNotFoundException,
- "can't find gem #{dep}" if specs.empty?
+ "can't find gem #{name} (#{requirements})" if specs.empty?
specs = specs.find_all { |spec|
spec.executables.include? exec_name
@@ -304,14 +298,15 @@ module Gem
end
##
- # The path to the data directory specified by the gem name. If the
+ # The path the the data directory specified by the gem name. If the
# package is not available as a gem, return nil.
def self.datadir(gem_name)
-# TODO: deprecate
+# TODO: deprecate and move to Gem::Specification
+# and drop the extra ", gem_name" which is uselessly redundant
spec = @loaded_specs[gem_name]
return nil if spec.nil?
- spec.datadir
+ File.join spec.full_gem_path, "data", gem_name
end
##
@@ -430,7 +425,7 @@ module Gem
files = find_files_from_load_path glob if check_load_path
- files.concat Gem::Specification.stubs.map { |spec|
+ files.concat Gem::Specification.map { |spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
}.flatten
@@ -549,9 +544,9 @@ module Gem
# Fetching: minitest-3.0.1.gem (100%)
# => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
- def self.install name, version = Gem::Requirement.default, *options
+ def self.install name, version = Gem::Requirement.default
require "rubygems/dependency_installer"
- inst = Gem::DependencyInstaller.new(*options)
+ inst = Gem::DependencyInstaller.new
inst.install name, version
inst.installed_gems
end
@@ -573,15 +568,14 @@ module Gem
end
##
- # The index to insert activated gem paths into the $LOAD_PATH. The activated
- # gem's paths are inserted before site lib directory by default.
+ # The index to insert activated gem paths into the $LOAD_PATH.
+ #
+ # Defaults to the site lib directory unless gem_prelude.rb has loaded paths,
+ # then it inserts the activated gem's paths before the gem_prelude.rb paths
+ # so you can override the gem_prelude.rb default $LOAD_PATH paths.
def self.load_path_insert_index
- $LOAD_PATH.each_with_index do |path, i|
- return i if path.instance_variable_defined?(:@gem_prelude_index)
- end
-
- index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
+ index = $LOAD_PATH.index ConfigMap[:sitelibdir]
index
end
@@ -597,12 +591,9 @@ module Gem
test_syck = ENV['TEST_SYCK']
- # Only Ruby 1.8 and 1.9 have syck
- test_syck = false unless /^1\./ =~ RUBY_VERSION
-
unless test_syck
begin
- gem 'psych', '>= 2.0.0'
+ gem 'psych', '~> 1.2', '>= 1.2.1'
rescue Gem::LoadError
# It's OK if the user does not have the psych gem installed. We will
# attempt to require the stdlib version
@@ -626,7 +617,6 @@ module Gem
end
require 'yaml'
- require 'rubygems/safe_yaml'
# If we're supposed to be using syck, then we may have to force
# activate it via the YAML::ENGINE API.
@@ -756,8 +746,8 @@ module Gem
def self.prefix
prefix = File.dirname RUBYGEMS_DIR
- if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and
- prefix != File.expand_path(RbConfig::CONFIG['libdir']) and
+ if prefix != File.expand_path(ConfigMap[:sitelibdir]) and
+ prefix != File.expand_path(ConfigMap[:libdir]) and
'lib' == File.basename(RUBYGEMS_DIR) then
prefix
end
@@ -774,22 +764,7 @@ module Gem
# Safely read a file in binary mode on all platforms.
def self.read_binary(path)
- open path, 'rb+' do |f|
- f.flock(File::LOCK_EX)
- f.read
- end
- rescue Errno::EACCES
- open path, 'rb' do |f|
- f.read
- end
- rescue Errno::ENOLCK # NFS
- if Thread.main != Thread.current
- raise
- else
- open path, 'rb' do |f|
- f.read
- end
- end
+ File.open path, binary_mode do |f| f.read end
end
##
@@ -797,8 +772,8 @@ module Gem
def self.ruby
if @ruby.nil? then
- @ruby = File.join(RbConfig::CONFIG['bindir'],
- "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
+ @ruby = File.join(ConfigMap[:bindir],
+ "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
@ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
end
@@ -810,7 +785,8 @@ module Gem
# Returns a String containing the API compatibility version of Ruby
def self.ruby_api_version
- @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
+ @ruby_api_version ||=
+ "#{ConfigMap[:MAJOR]}.#{ConfigMap[:MINOR]}.#{ConfigMap[:TEENY]}"
end
##
@@ -1016,72 +992,61 @@ module Gem
end
##
- # Looks for a gem dependency file at +path+ and activates the gems in the
- # file if found. If the file is not found an ArgumentError is raised.
- #
- # If +path+ is not given the RUBYGEMS_GEMDEPS environment variable is used,
- # but if no file is found no exception is raised.
- #
- # If '-' is given for +path+ RubyGems searches up from the current working
- # directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and
- # activates the gems in the first one found.
+ # Looks for gem dependency files (gem.deps.rb, Gemfile, Isolate) from the
+ # current directory up and activates the gems in the first file found.
#
# You can run this automatically when rubygems starts. To enable, set
# the <code>RUBYGEMS_GEMDEPS</code> environment variable to either the path
- # of your gem dependencies file or "-" to auto-discover in parent
- # directories.
+ # of your Gemfile or "-" to auto-discover in parent directories.
#
# NOTE: Enabling automatic discovery on multiuser systems can lead to
# execution of arbitrary code when used from directories outside your
# control.
- def self.use_gemdeps path = nil
- raise_exception = path
+ def self.use_gemdeps
+ return unless path = ENV['RUBYGEMS_GEMDEPS']
+ path = path.dup.untaint
- path ||= ENV['RUBYGEMS_GEMDEPS']
- return unless path
+ if path == "-"
+ here = Dir.pwd.untaint
+ start = here
- path = path.dup
+ begin
+ while true
+ path = GEM_DEP_FILES.find { |f| File.file?(f) }
- if path == "-" then
- require 'rubygems/util'
+ if path
+ path = File.join here, path
+ break
+ end
- Gem::Util.traverse_parents Dir.pwd do |directory|
- dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }
+ Dir.chdir ".."
- next unless dep_file
+ # If we're at a toplevel, stop.
+ return if Dir.pwd == here
- path = File.join directory, dep_file
- break
+ here = Dir.pwd
+ end
+ ensure
+ Dir.chdir start
end
end
path.untaint
- unless File.file? path then
- return unless raise_exception
-
- raise ArgumentError, "Unable to find gem dependencies file at #{path}"
- end
+ return unless File.file? path
rs = Gem::RequestSet.new
- @gemdeps = rs.load_gemdeps path
+ rs.load_gemdeps path
rs.resolve_current.map do |s|
sp = s.full_spec
sp.activate
sp
end
- rescue Gem::LoadError, Gem::UnsatisfiableDependencyError => e
- warn e.message
- warn "You may need to `gem install -g` to install missing gems"
- warn ""
end
class << self
- ##
- # TODO remove with RubyGems 3.0
-
alias detect_gemdeps use_gemdeps # :nodoc:
end
@@ -1096,12 +1061,6 @@ module Gem
attr_reader :loaded_specs
##
- # GemDependencyAPI object, which is set when .use_gemdeps is called.
- # This contains all the information from the Gemfile.
-
- attr_reader :gemdeps
-
- ##
# Register a Gem::Specification for default gem.
#
# Two formats for the specification are supported:
@@ -1153,7 +1112,7 @@ module Gem
end
##
- # Clear default gem related variables. It is for test
+ # Clear default gem related varibles. It is for test
def clear_default_specs
@path_to_default_spec_map.clear
@@ -1213,19 +1172,17 @@ module Gem
autoload :ConfigFile, 'rubygems/config_file'
autoload :Dependency, 'rubygems/dependency'
autoload :DependencyList, 'rubygems/dependency_list'
+ autoload :Resolver, 'rubygems/resolver'
autoload :DependencyResolver, 'rubygems/resolver'
- autoload :Installer, 'rubygems/installer'
- autoload :Licenses, 'rubygems/util/licenses'
autoload :PathSupport, 'rubygems/path_support'
autoload :Platform, 'rubygems/platform'
autoload :RequestSet, 'rubygems/request_set'
autoload :Requirement, 'rubygems/requirement'
- autoload :Resolver, 'rubygems/resolver'
- autoload :Source, 'rubygems/source'
autoload :SourceList, 'rubygems/source_list'
autoload :SpecFetcher, 'rubygems/spec_fetcher'
autoload :Specification, 'rubygems/specification'
autoload :Version, 'rubygems/version'
+ autoload :Source, 'rubygems/source'
require "rubygems/specification"
end
@@ -1261,4 +1218,4 @@ Gem::Specification.load_defaults
require 'rubygems/core_ext/kernel_gem'
require 'rubygems/core_ext/kernel_require'
-Gem.use_gemdeps
+Gem.detect_gemdeps
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
index 49b5d5fd06..4ab4d77716 100644
--- a/lib/rubygems/available_set.rb
+++ b/lib/rubygems/available_set.rb
@@ -1,16 +1,12 @@
-# frozen_string_literal: true
class Gem::AvailableSet
include Enumerable
Tuple = Struct.new(:spec, :source)
- attr_accessor :remote # :nodoc:
-
def initialize
@set = []
@sorted = nil
- @remote = true
end
attr_reader :set
@@ -127,11 +123,11 @@ class Gem::AvailableSet
dep = req.dependency
match = @set.find_all do |t|
- dep.match? t.spec
+ dep.matches_spec? t.spec
end
match.map do |t|
- Gem::Resolver::LocalSpecification.new(self, t.spec, t.source)
+ Gem::Resolver::InstalledSpecification.new(self, t.spec, t.source)
end
end
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 5c57076f91..4f96fcac3d 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# BasicSpecification is an abstract class which implements some common code
# used by both Specification and StubSpecification.
@@ -6,47 +5,15 @@
class Gem::BasicSpecification
##
- # Allows installation of extensions for git: gems.
-
- attr_writer :base_dir # :nodoc:
-
- ##
- # Sets the directory where extensions for this gem will be installed.
-
- attr_writer :extension_dir # :nodoc:
-
- ##
- # Is this specification ignored for activation purposes?
-
- attr_writer :ignored # :nodoc:
-
- ##
# The path this gemspec was loaded from. This attribute is not persisted.
- attr_accessor :loaded_from
-
- ##
- # Allows correct activation of git: and path: gems.
-
- attr_writer :full_gem_path # :nodoc:
-
- def initialize
- internal_init
- end
+ attr_reader :loaded_from
def self.default_specifications_dir
File.join(Gem.default_dir, "specifications", "default")
end
##
- # The path to the gem.build_complete file within the extension install
- # directory.
-
- def gem_build_complete_path # :nodoc:
- File.join extension_dir, 'gem.build_complete'
- end
-
- ##
# True when the gem has been activated
def activated?
@@ -59,24 +26,26 @@ class Gem::BasicSpecification
# eg: /usr/local/lib/ruby/gems/1.8
def base_dir
- raise NotImplementedError
+ return Gem.dir unless loaded_from
+ @base_dir ||= if default_gem? then
+ File.dirname File.dirname File.dirname loaded_from
+ else
+ File.dirname File.dirname loaded_from
+ end
end
##
# Return true if this spec can require +file+.
def contains_requirable_file? file
- if @ignored then
- return false
- elsif missing_extensions? then
- @ignored = true
-
- warn "Ignoring #{full_name} because its extensions are not built. " +
- "Try: gem pristine #{name} --version #{version}"
- return false
- end
+ build_extensions
+
+ suffixes = Gem.suffixes
- have_file? file, Gem.suffixes
+ full_require_paths.any? do |dir|
+ base = "#{dir}/#{file}"
+ suffixes.any? { |suf| File.file? "#{base}#{suf}" }
+ end
end
def default_gem?
@@ -85,26 +54,24 @@ class Gem::BasicSpecification
end
##
- # Returns full path to the directory where gem's extensions are installed.
-
- def extension_dir
- @extension_dir ||= File.expand_path(File.join(extensions_dir, full_name)).untaint
- end
-
- ##
- # Returns path to the extensions directory.
+ # The directory the named +extension+ was installed into after being built.
+ #
+ # Usage:
+ #
+ # spec.extensions.each do |ext|
+ # puts spec.extension_install_dir ext
+ # end
- def extensions_dir
- @extensions_dir ||= Gem.default_ext_dir_for(base_dir) ||
- File.join(base_dir, 'extensions', Gem::Platform.local.to_s,
- Gem.extension_api_version)
+ def extension_install_dir
+ File.join base_dir, 'extensions', Gem::Platform.local.to_s,
+ Gem.extension_api_version, full_name
end
def find_full_gem_path # :nodoc:
# TODO: also, shouldn't it default to full_name if it hasn't been written?
path = File.expand_path File.join(gems_dir, full_name)
path.untaint
- path
+ path if File.directory? path
end
private :find_full_gem_path
@@ -125,9 +92,9 @@ class Gem::BasicSpecification
def full_name
if platform == Gem::Platform::RUBY or platform.nil? then
- "#{name}-#{version}".dup.untaint
+ "#{name}-#{version}".untaint
else
- "#{name}-#{version}-#{platform}".dup.untaint
+ "#{name}-#{version}-#{platform}".untaint
end
end
@@ -136,46 +103,13 @@ class Gem::BasicSpecification
# activated.
def full_require_paths
- @full_require_paths ||=
- begin
- full_paths = raw_require_paths.map do |path|
- File.join full_gem_path, path.untaint
- end
-
- full_paths << extension_dir if have_extensions?
-
- full_paths
+ full_paths = @require_paths.map do |path|
+ File.join full_gem_path, path
end
- end
- ##
- # The path to the data directory for this gem.
+ full_paths.unshift extension_install_dir unless @extensions.empty?
- def datadir
-# TODO: drop the extra ", gem_name" which is uselessly redundant
- File.expand_path(File.join(gems_dir, full_name, "data", name)).untaint
- end
-
- ##
- # Full path of the target library file.
- # If the file is not in this gem, return nil.
-
- def to_fullpath path
- if activated? then
- @paths_map ||= {}
- @paths_map[path] ||=
- begin
- fullpath = nil
- suffixes = Gem.suffixes
- suffixes.find do |suf|
- full_require_paths.find do |dir|
- File.file?(fullpath = "#{dir}/#{path}#{suf}")
- end
- end ? fullpath : nil
- end
- else
- nil
- end
+ full_paths
end
##
@@ -191,15 +125,20 @@ class Gem::BasicSpecification
# gem directory. eg: /usr/local/lib/ruby/1.8/gems
def gems_dir
- raise NotImplementedError
+ # TODO: this logic seems terribly broken, but tests fail if just base_dir
+ @gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
end
- def internal_init # :nodoc:
- @extension_dir = nil
- @extensions_dir = nil
- @full_gem_path = nil
- @gem_dir = nil
- @ignored = nil
+ ##
+ # Set the path the Specification was loaded from. +path+ is converted to a
+ # String.
+
+ def loaded_from= path
+ @loaded_from = path && path.to_s
+
+ @full_gem_path = nil
+ @gems_dir = nil
+ @base_dir = nil
end
##
@@ -217,7 +156,7 @@ class Gem::BasicSpecification
end
def raw_require_paths # :nodoc:
- raise NotImplementedError
+ @require_paths
end
##
@@ -238,51 +177,13 @@ class Gem::BasicSpecification
# spec.require_path = '.'
def require_paths
- return raw_require_paths unless have_extensions?
-
- [extension_dir].concat raw_require_paths
- end
-
- ##
- # Returns the paths to the source files for use with analysis and
- # documentation tools. These paths are relative to full_gem_path.
-
- def source_paths
- paths = raw_require_paths.dup
-
- if have_extensions? then
- ext_dirs = extensions.map do |extension|
- extension.split(File::SEPARATOR, 2).first
- end.uniq
-
- paths.concat ext_dirs
- end
-
- paths.uniq
- end
-
- ##
- # Return all files in this gem that match for +glob+.
+ return @require_paths if @extensions.empty?
- def matches_for_glob glob # TODO: rename?
- # TODO: do we need these?? Kill it
- glob = File.join(self.lib_dirs_glob, glob)
+ relative_extension_install_dir =
+ File.join '..', '..', 'extensions', Gem::Platform.local.to_s,
+ Gem.extension_api_version, full_name
- Dir[glob].map { |f| f.untaint } # FIX our tests are broken, run w/ SAFE=1
- end
-
- ##
- # Returns a string usable in Dir.glob to match all requirable paths
- # for this spec.
-
- def lib_dirs_glob
- dirs = if self.require_paths.size > 1 then
- "{#{self.require_paths.join(',')}}"
- else
- self.require_paths.first
- end
-
- "#{self.full_gem_path}/#{dirs}".dup.untaint
+ [relative_extension_install_dir].concat @require_paths
end
##
@@ -307,22 +208,5 @@ class Gem::BasicSpecification
raise NotImplementedError
end
- private
-
- def have_extensions?; !extensions.empty?; end
-
- def have_file? file, suffixes
- return true if raw_require_paths.any? do |path|
- base = File.join(gems_dir, full_name, path.untaint, file).untaint
- suffixes.any? { |suf| File.file? base + suf }
- end
-
- if have_extensions?
- base = File.join extension_dir, file
- suffixes.any? { |suf| File.file? base + suf }
- else
- false
- end
- end
-
end
+
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index 5b41fc288e..cba79b9196 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -149,12 +148,10 @@ class Gem::Command
##
# Display to the user that a gem couldn't be found and reasons why
- #--
- # TODO: replace +domain+ with a parameter to suppress suggestions
def show_lookup_failure(gem_name, version, errors, domain)
if errors and !errors.empty?
- msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n".dup
+ msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n"
errors.each { |x| msg << " #{x.wordy}\n" }
alert_error msg
else
@@ -540,11 +537,6 @@ class Gem::Command
'Turn on Ruby debugging') do
end
- add_common_option('--norc',
- 'Avoid loading any .gemrc file') do
- end
-
-
# :stopdoc:
HELP = <<-HELP
@@ -565,8 +557,7 @@ basic help message containing pointers to more information.
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
- gem help gem_dependencies gem dependencies file guide
- gem help platforms gem platforms guide
+ gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
@@ -585,3 +576,4 @@ end
module Gem::Commands
end
+
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 451b719c46..fdee064fed 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -49,7 +48,6 @@ class Gem::CommandManager
:list,
:lock,
:mirror,
- :open,
:outdated,
:owner,
:pristine,
@@ -138,7 +136,7 @@ class Gem::CommandManager
def run(args, build_args=nil)
process_args(args, build_args)
rescue StandardError, Timeout::Error => ex
- alert_error "While executing gem ... (#{ex.class})\n #{ex}"
+ alert_error "While executing gem ... (#{ex.class})\n #{ex.to_s}"
ui.backtrace ex
terminate_interaction(1)
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index 38c45e46f0..d975429fe8 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'
@@ -42,10 +41,6 @@ with gem spec:
def execute
gemspec = get_one_gem_name
- unless File.exist? gemspec
- gemspec += '.gemspec' if File.exist? gemspec + '.gemspec'
- end
-
if File.exist? gemspec then
spec = Gem::Specification.load gemspec
diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb
index 7adf5b01b1..e417193bca 100644
--- a/lib/rubygems/commands/cert_command.rb
+++ b/lib/rubygems/commands/cert_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/security'
begin
@@ -130,21 +129,23 @@ class Gem::Commands::CertCommand < Gem::Command
end
def build_key # :nodoc:
- return options[:key] if options[:key]
+ if options[:key] then
+ options[:key]
+ else
+ passphrase = ask_for_password 'Passphrase for your Private Key:'
+ say "\n"
- passphrase = ask_for_password 'Passphrase for your Private Key:'
- say "\n"
+ passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:'
+ say "\n"
- passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:'
- say "\n"
+ raise Gem::CommandLineError,
+ "Passphrase and passphrase confirmation don't match" unless passphrase == passphrase_confirmation
- raise Gem::CommandLineError,
- "Passphrase and passphrase confirmation don't match" unless passphrase == passphrase_confirmation
+ key = Gem::Security.create_key
+ key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase
- key = Gem::Security.create_key
- key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase
-
- return key, key_path
+ return key, key_path
+ end
end
def certificates_matching filter
diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb
index 818cb05f55..8893b9c3b2 100644
--- a/lib/rubygems/commands/check_command.rb
+++ b/lib/rubygems/commands/check_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/validator'
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index 46f89f1bb8..c8f0082bfb 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/dependency_list'
require 'rubygems/uninstaller'
@@ -68,10 +67,10 @@ If no gems are named all gems in GEM_HOME are cleaned.
say "Clean Up Complete"
- verbose do
+ if Gem.configuration.really_verbose then
skipped = @default_gems.map { |spec| spec.full_name }
- "Skipped default gems: #{skipped.join ', '}"
+ say "Skipped default gems: #{skipped.join ', '}"
end
end
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index e0f2eedb5d..97218848ed 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'English'
require 'rubygems/command'
require 'rubygems/version_option'
@@ -9,8 +8,7 @@ class Gem::Commands::ContentsCommand < Gem::Command
def initialize
super 'contents', 'Display the contents of the installed gems',
- :specdirs => [], :lib_only => false, :prefix => true,
- :show_install_dir => false
+ :specdirs => [], :lib_only => false, :prefix => true
add_version_option
@@ -34,11 +32,6 @@ class Gem::Commands::ContentsCommand < Gem::Command
options[:prefix] = prefix
end
- add_option( '--[no-]show-install-dir',
- 'Show only the gem install dir') do |show, options|
- options[:show_install_dir] = show
- end
-
@path_kind = nil
@spec_dirs = nil
@version = nil
@@ -72,12 +65,7 @@ prefix or only the files that are requireable.
names = gem_names
names.each do |name|
- found =
- if options[:show_install_dir] then
- gem_install_dir name
- else
- gem_contents name
- end
+ found = gem_contents name
terminate_interaction 1 unless found or names.length > 1
end
@@ -103,14 +91,14 @@ prefix or only the files that are requireable.
end
def files_in_default_gem spec
- spec.files.map do |file|
+ spec.files.sort.map do |file|
case file
when /\A#{spec.bindir}\//
- [RbConfig::CONFIG['bindir'], $POSTMATCH]
+ [Gem::ConfigMap[:bindir], $POSTMATCH]
when /\.so\z/
- [RbConfig::CONFIG['archdir'], file]
+ [Gem::ConfigMap[:archdir], file]
else
- [RbConfig::CONFIG['rubylibdir'], file]
+ [Gem::ConfigMap[:rubylibdir], file]
end
end
end
@@ -127,16 +115,6 @@ prefix or only the files that are requireable.
true
end
- def gem_install_dir name
- spec = spec_for name
-
- return false unless spec
-
- say spec.gem_dir
-
- true
- end
-
def gem_names # :nodoc:
if options[:all] then
Gem::Specification.map(&:name)
@@ -147,6 +125,7 @@ prefix or only the files that are requireable.
def path_description spec_dirs # :nodoc:
if spec_dirs.empty? then
+ spec_dirs = Gem::Specification.dirs
"default gem paths"
else
"specified path"
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index 97fd812ffa..c5d6dd7d70 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
@@ -32,7 +31,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
end
def arguments # :nodoc:
- "REGEXP show dependencies for gems whose names start with REGEXP"
+ "GEMNAME name of gem to show dependencies for"
end
def defaults_str # :nodoc:
@@ -51,7 +50,7 @@ use with other commands.
end
def usage # :nodoc:
- "#{program_name} REGEXP"
+ "#{program_name} GEMNAME"
end
def fetch_remote_specs dependency # :nodoc:
@@ -62,16 +61,10 @@ use with other commands.
ss.map { |spec, _| spec }
end
- def fetch_specs name_pattern, dependency # :nodoc:
+ def fetch_specs dependency # :nodoc:
specs = []
- if local?
- specs.concat Gem::Specification.stubs.find_all { |spec|
- name_pattern =~ spec.name and
- dependency.requirement.satisfied_by? spec.version
- }.map(&:to_spec)
- end
-
+ specs.concat dependency.matching_specs if local?
specs.concat fetch_remote_specs dependency if remote?
ensure_specs specs
@@ -79,7 +72,16 @@ use with other commands.
specs.uniq.sort
end
- def gem_dependency pattern, version, prerelease # :nodoc:
+ def gem_dependency args, version, prerelease # :nodoc:
+ args << '' if args.empty?
+
+ pattern = if args.length == 1 and args.first =~ /\A\/(.*)\/(i)?\z/m then
+ flags = $2 ? Regexp::IGNORECASE : nil
+ Regexp.new $1, flags
+ else
+ /\A#{Regexp.union(*args)}/
+ end
+
dependency = Gem::Deprecate.skip_during {
Gem::Dependency.new pattern, version
}
@@ -100,7 +102,7 @@ use with other commands.
end
def display_readable specs, reverse # :nodoc:
- response = String.new
+ response = ''
specs.each do |spec|
response << print_dependencies(spec)
@@ -119,12 +121,10 @@ use with other commands.
def execute
ensure_local_only_reverse_dependencies
- pattern = name_pattern options[:args]
-
dependency =
- gem_dependency pattern, options[:version], options[:prerelease]
+ gem_dependency options[:args], options[:version], options[:prerelease]
- specs = fetch_specs pattern, dependency
+ specs = fetch_specs dependency
reverse = reverse_dependencies specs
@@ -153,7 +153,7 @@ use with other commands.
end
def print_dependencies(spec, level = 0) # :nodoc:
- response = String.new
+ response = ''
response << ' ' * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty? then
spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
@@ -203,16 +203,5 @@ use with other commands.
result
end
- private
-
- def name_pattern args
- args << '' if args.empty?
-
- if args.length == 1 and args.first =~ /\A\/(.*)\/(i)?\z/m then
- flags = $2 ? Regexp::IGNORECASE : nil
- Regexp.new $1, flags
- else
- /\A#{Regexp.union(*args)}/
- end
- end
end
+
diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb
index e825c761ad..d32d12b757 100644
--- a/lib/rubygems/commands/environment_command.rb
+++ b/lib/rubygems/commands/environment_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::EnvironmentCommand < Gem::Command
@@ -29,9 +28,8 @@ The RubyGems environment can be controlled through command line arguments,
gemrc files, environment variables and built-in defaults.
Command line argument defaults and some RubyGems defaults can be set in a
-~/.gemrc file for individual users and a gemrc in the SYSTEM CONFIGURATION
-DIRECTORY for all users. These files are YAML files with the following YAML
-keys:
+~/.gemrc file for individual users and a /etc/gemrc for all users. These
+files are YAML files with the following YAML keys:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the
@@ -72,7 +70,7 @@ lib/rubygems/defaults/operating_system.rb
end
def execute
- out = String.new
+ out = ''
arg = options[:args][0]
out <<
case arg
@@ -104,7 +102,7 @@ lib/rubygems/defaults/operating_system.rb
end
def show_environment # :nodoc:
- out = "RubyGems Environment:\n".dup
+ out = "RubyGems Environment:\n"
out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"
@@ -114,8 +112,6 @@ lib/rubygems/defaults/operating_system.rb
out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
- out << " - USER INSTALLATION DIRECTORY: #{Gem.user_dir}\n"
-
out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"
@@ -124,8 +120,6 @@ lib/rubygems/defaults/operating_system.rb
out << " - SPEC CACHE DIRECTORY: #{Gem.spec_cache_dir}\n"
- out << " - SYSTEM CONFIGURATION DIRECTORY: #{Gem::ConfigFile::SYSTEM_CONFIG_PATH}\n"
-
out << " - RUBYGEMS PLATFORMS:\n"
Gem.platforms.each do |platform|
out << " - #{platform}\n"
@@ -158,3 +152,4 @@ lib/rubygems/defaults/operating_system.rb
end
end
+
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index 19559a7774..c57ab0089a 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb
index 01f1f88405..a7db013caf 100644
--- a/lib/rubygems/commands/generate_index_command.rb
+++ b/lib/rubygems/commands/generate_index_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/indexer'
@@ -63,7 +62,7 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
end
def execute
- # This is always true because it's the only way now.
+ # This is always true becasue it's the only way now.
options[:build_modern] = true
if not File.exist?(options[:directory]) or
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index de3f175fad..ed7be903ac 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::HelpCommand < Gem::Command
@@ -53,183 +52,6 @@ Some examples of 'gem' usage.
gem update --system
EOF
- GEM_DEPENDENCIES = <<-EOF
-A gem dependencies file allows installation of a consistent set of gems across
-multiple environments. The RubyGems implementation is designed to be
-compatible with Bundler's Gemfile format. You can see additional
-documentation on the format at:
-
- http://bundler.io
-
-RubyGems automatically looks for these gem dependencies files:
-
-* gem.deps.rb
-* Gemfile
-* Isolate
-
-These files are looked up automatically using `gem install -g`, or you can
-specify a custom file.
-
-When the RUBYGEMS_GEMDEPS environment variable is set to a gem dependencies
-file the gems from that file will be activated at startup time. Set it to a
-specific filename or to "-" to have RubyGems automatically discover the gem
-dependencies file by walking up from the current directory.
-
-You can also activate gem dependencies at program startup using
-Gem.use_gemdeps.
-
-NOTE: Enabling automatic discovery on multiuser systems can lead to execution
-of arbitrary code when used from directories outside your control.
-
-Gem Dependencies
-================
-
-Use #gem to declare which gems you directly depend upon:
-
- gem 'rake'
-
-To depend on a specific set of versions:
-
- gem 'rake', '~> 10.3', '>= 10.3.2'
-
-RubyGems will require the gem name when activating the gem using
-the RUBYGEMS_GEMDEPS environment variable or Gem::use_gemdeps. Use the
-require: option to override this behavior if the gem does not have a file of
-that name or you don't want to require those files:
-
- gem 'my_gem', require: 'other_file'
-
-To prevent RubyGems from requiring any files use:
-
- gem 'my_gem', require: false
-
-To load dependencies from a .gemspec file:
-
- gemspec
-
-RubyGems looks for the first .gemspec file in the current directory. To
-override this use the name: option:
-
- gemspec name: 'specific_gem'
-
-To look in a different directory use the path: option:
-
- gemspec name: 'specific_gem', path: 'gemspecs'
-
-To depend on a gem unpacked into a local directory:
-
- gem 'modified_gem', path: 'vendor/modified_gem'
-
-To depend on a gem from git:
-
- gem 'private_gem', git: 'git@my.company.example:private_gem.git'
-
-To depend on a gem from github:
-
- gem 'private_gem', github: 'my_company/private_gem'
-
-To depend on a gem from a github gist:
-
- gem 'bang', gist: '1232884'
-
-Git, github and gist support the ref:, branch: and tag: options to specify a
-commit reference or hash, branch or tag respectively to use for the gem.
-
-Setting the submodules: option to true for git, github and gist dependencies
-causes fetching of submodules when fetching the repository.
-
-You can depend on multiple gems from a single repository with the git method:
-
- git 'https://github.com/rails/rails.git' do
- gem 'activesupport'
- gem 'activerecord'
- end
-
-Gem Sources
-===========
-
-RubyGems uses the default sources for regular `gem install` for gem
-dependencies files. Unlike bundler, you do need to specify a source.
-
-You can override the sources used for downloading gems with:
-
- source 'https://gem_server.example'
-
-You may specify multiple sources. Unlike bundler the prepend: option is not
-supported. Sources are used in-order, to prepend a source place it at the
-front of the list.
-
-Gem Platform
-============
-
-You can restrict gem dependencies to specific platforms with the #platform
-and #platforms methods:
-
- platform :ruby_21 do
- gem 'debugger'
- end
-
-See the bundler Gemfile manual page for a list of platforms supported in a gem
-dependencies file.:
-
- http://bundler.io/v1.6/man/gemfile.5.html
-
-Ruby Version and Engine Dependency
-==================================
-
-You can specify the version, engine and engine version of ruby to use with
-your gem dependencies file. If you are not running the specified version
-RubyGems will raise an exception.
-
-To depend on a specific version of ruby:
-
- ruby '2.1.2'
-
-To depend on a specific ruby engine:
-
- ruby '1.9.3', engine: 'jruby'
-
-To depend on a specific ruby engine version:
-
- ruby '1.9.3', engine: 'jruby', engine_version: '1.7.11'
-
-Grouping Dependencies
-=====================
-
-Gem dependencies may be placed in groups that can be excluded from install.
-Dependencies required for development or testing of your code may be excluded
-when installed in a production environment.
-
-A #gem dependency may be placed in a group using the group: option:
-
- gem 'minitest', group: :test
-
-To install dependencies from a gemfile without specific groups use the
-`--without` option for `gem install -g`:
-
- $ gem install -g --without test
-
-The group: option also accepts multiple groups if the gem fits in multiple
-categories.
-
-Multiple groups may be excluded during install by comma-separating the groups for `--without` or by specifying `--without` multiple times.
-
-The #group method can also be used to place gems in groups:
-
- group :test do
- gem 'minitest'
- gem 'minitest-emoji'
- end
-
-The #group method allows multiple groups.
-
-The #gemspec development dependencies are placed in the :development group by
-default. This may be overridden with the :development_group option:
-
- gemspec development_group: :other
-
- EOF
-
PLATFORMS = <<-'EOF'
RubyGems platforms are composed of three parts, a CPU, an OS, and a
version. These values are taken from values in rbconfig.rb. You can view
@@ -268,16 +90,6 @@ When building platform gems, set the platform in the gem specification to
Gem::Platform::CURRENT. This will correctly mark the gem with your ruby's
platform.
EOF
-
- # NOTE when updating also update Gem::Command::HELP
-
- SUBCOMMANDS = [
- ["commands", :show_commands],
- ["options", Gem::Command::HELP],
- ["examples", EXAMPLES],
- ["gem_dependencies", GEM_DEPENDENCIES],
- ["platforms", PLATFORMS],
- ]
# :startdoc:
def initialize
@@ -286,6 +98,15 @@ platform.
@command_manager = Gem::CommandManager.instance
end
+ def arguments # :nodoc:
+ args = <<-EOF
+ commands List all 'gem' commands
+ examples Show examples of 'gem' usage
+ <command> Show specific help for <command>
+ EOF
+ return args.gsub(/^\s+/, '')
+ end
+
def usage # :nodoc:
"#{program_name} ARGUMENT"
end
@@ -293,20 +114,19 @@ platform.
def execute
arg = options[:args][0]
- _, help = SUBCOMMANDS.find do |command,|
- begins? command, arg
- end
+ if begins? "commands", arg then
+ show_commands
- if help then
- if Symbol === help then
- send help
- else
- say help
- end
- return
- end
+ elsif begins? "options", arg then
+ say Gem::Command::HELP
+
+ elsif begins? "examples", arg then
+ say EXAMPLES
+
+ elsif begins? "platforms", arg then
+ say PLATFORMS
- if options[:help] then
+ elsif options[:help] then
show_help
elsif arg then
@@ -371,5 +191,15 @@ platform.
end
end
+ def show_help # :nodoc:
+ command = @command_manager[options[:help]]
+ if command then
+ # help with provided command
+ command.invoke("--help")
+ else
+ alert_error "Unknown command #{options[:help]}. Try 'gem help commands'"
+ end
+ end
+
end
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 5f0934aa17..68a2fad129 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/install_update_options'
require 'rubygems/dependency_installer'
@@ -22,8 +21,6 @@ class Gem::Commands::InstallCommand < Gem::Command
def initialize
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
:format_executable => false,
- :lock => true,
- :suggest_alternate => true,
:version => Gem::Requirement.default,
:without_groups => [],
})
@@ -43,13 +40,6 @@ class Gem::Commands::InstallCommand < Gem::Command
File.exist? file
end unless v
- unless v then
- message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ', '})"
-
- raise OptionParser::InvalidArgument,
- "cannot find gem dependencies file #{message}"
- end
-
o[:gemdeps] = v
end
@@ -72,17 +62,7 @@ class Gem::Commands::InstallCommand < Gem::Command
o[:explain] = v
end
- add_option(:"Install/Update", '--[no-]lock',
- 'Create a lock file (when used with -g/--file)') do |v,o|
- o[:lock] = v
- end
-
- add_option(:"Install/Update", '--[no-]suggestions',
- 'Suggest alternates when gems are not found') do |v,o|
- o[:suggest_alternate] = v
- end
-
- @installed_specs = []
+ @installed_specs = nil
end
def arguments # :nodoc:
@@ -91,7 +71,7 @@ class Gem::Commands::InstallCommand < Gem::Command
def defaults_str # :nodoc:
"--both --version '#{Gem::Requirement.default}' --document --no-force\n" +
- "--install-dir #{Gem.dir} --lock"
+ "--install-dir #{Gem.dir}"
end
def description # :nodoc:
@@ -105,25 +85,6 @@ The wrapper allows you to choose among alternate gem versions using _version_.
For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
version is also installed.
-Gem Dependency Files
-====================
-
-RubyGems can install a consistent set of gems across multiple environments
-using `gem install -g` when a gem dependencies file (gem.deps.rb, Gemfile or
-Isolate) is present. If no explicit file is given RubyGems attempts to find
-one in the current directory.
-
-When the RUBYGEMS_GEMDEPS environment variable is set to a gem dependencies
-file the gems from that file will be activated at startup time. Set it to a
-specific filename or to "-" to have RubyGems automatically discover the gem
-dependencies file by walking up from the current directory.
-
-NOTE: Enabling automatic discovery on multiuser systems can lead to
-execution of arbitrary code when used from directories outside your control.
-
-Extension Install Failures
-==========================
-
If an extension fails to compile during gem installation the gem
specification is not written out, but the gem remains unpacked in the
repository. You may need to specify the path to the library's headers and
@@ -232,62 +193,25 @@ to write the specification by hand. For example:
req = Gem::Requirement.create(version)
- if options[:ignore_dependencies] then
- install_gem_without_dependencies name, req
- else
- inst = Gem::DependencyInstaller.new options
- request_set = inst.resolve_dependencies name, req
+ inst = Gem::DependencyInstaller.new options
- if options[:explain]
- puts "Gems to install:"
-
- request_set.sorted_requests.each do |s|
- puts " #{s.full_name}"
- end
-
- return
- else
- @installed_specs.concat request_set.install options
- end
-
- show_install_errors inst.errors
- end
- end
+ if options[:explain]
+ request_set = inst.resolve_dependencies name, req
- def install_gem_without_dependencies name, req # :nodoc:
- gem = nil
+ puts "Gems to install:"
- if local? then
- if name =~ /\.gem$/ and File.file? name then
- source = Gem::Source::SpecificFile.new name
- spec = source.spec
- else
- source = Gem::Source::Local.new
- spec = source.find_gem name, req
+ request_set.specs.map { |s| s.full_name }.sort.each do |s|
+ puts " #{s}"
end
- gem = source.download spec if spec
- end
-
- if remote? and not gem then
- dependency = Gem::Dependency.new name, req
- dependency.prerelease = options[:prerelease]
- fetcher = Gem::RemoteFetcher.fetcher
- gem = fetcher.download_to_cache dependency
+ return
+ else
+ inst.install name, req
end
- inst = Gem::Installer.at gem, options
- inst.install
-
- require 'rubygems/dependency_installer'
- dinst = Gem::DependencyInstaller.new options
- dinst.installed_gems.replace [inst.spec]
-
- Gem.done_installing_hooks.each do |hook|
- hook.call dinst, [inst.spec]
- end unless Gem.done_installing_hooks.empty?
+ @installed_specs.push(*inst.installed_gems)
- @installed_specs.push(inst.spec)
+ show_install_errors inst.errors
end
def install_gems # :nodoc:
@@ -301,10 +225,8 @@ to write the specification by hand. For example:
rescue Gem::InstallError => e
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
exit_code |= 1
- rescue Gem::GemNotFoundException, Gem::UnsatisfiableDependencyError => e
- domain = options[:domain]
- domain = :local unless options[:suggest_alternate]
- show_lookup_failure e.name, e.version, e.errors, domain
+ rescue Gem::GemNotFoundException => e
+ show_lookup_failure e.name, e.version, e.errors, options[:domain]
exit_code |= 2
end
diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb
index 1acb49e5fb..4edeabef02 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -1,21 +1,20 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'
##
# An alternate to Gem::Commands::QueryCommand that searches for gems starting
-# with the supplied argument.
+# with the the supplied argument.
class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
def initialize
- super 'list', 'Display local gems whose name matches REGEXP'
+ super 'list', 'Display local gems whose name starts with STRING'
remove_option('--name-matches')
end
def arguments # :nodoc:
- "REGEXP regexp to look for in gem name"
+ "STRING start of gem name to look for"
end
def defaults_str # :nodoc:
@@ -34,7 +33,7 @@ To search for remote gems use the search command.
end
def usage # :nodoc:
- "#{program_name} [REGEXP ...]"
+ "#{program_name} [STRING ...]"
end
end
diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb
index 3eebfadc05..6b4b25a281 100644
--- a/lib/rubygems/commands/lock_command.rb
+++ b/lib/rubygems/commands/lock_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::LockCommand < Gem::Command
diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb
index 801c9c8927..75419c857a 100644
--- a/lib/rubygems/commands/mirror_command.rb
+++ b/lib/rubygems/commands/mirror_command.rb
@@ -1,26 +1,23 @@
-# frozen_string_literal: true
require 'rubygems/command'
-unless defined? Gem::Commands::MirrorCommand
- class Gem::Commands::MirrorCommand < Gem::Command
- def initialize
- super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
- begin
- Gem::Specification.find_by_name('rubygems-mirror').activate
- rescue Gem::LoadError
- # no-op
- end
+class Gem::Commands::MirrorCommand < Gem::Command
+ def initialize
+ super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
+ begin
+ Gem::Specification.find_by_name('rubygems-mirror').activate
+ rescue Gem::LoadError
+ # no-op
end
+ end
- def description # :nodoc:
- <<-EOF
+ def description # :nodoc:
+ <<-EOF
The mirror command has been moved to the rubygems-mirror gem.
- EOF
- end
-
- def execute
- alert_error "Install the rubygems-mirror gem for the mirror command"
- end
+ EOF
+ end
+ def execute
+ alert_error "Install the rubygems-mirror gem for the mirror command"
end
+
end
diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb
deleted file mode 100644
index 957d369b26..0000000000
--- a/lib/rubygems/commands/open_command.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-# frozen_string_literal: true
-require 'English'
-require 'rubygems/command'
-require 'rubygems/version_option'
-require 'rubygems/util'
-
-class Gem::Commands::OpenCommand < Gem::Command
-
- include Gem::VersionOption
-
- def initialize
- super 'open', 'Open gem sources in editor'
-
- add_option('-e', '--editor EDITOR', String,
- "Opens gem sources in EDITOR") do |editor, options|
- options[:editor] = editor || get_env_editor
- end
- end
-
- def arguments # :nodoc:
- "GEMNAME name of gem to open in editor"
- end
-
- def defaults_str # :nodoc:
- "-e #{get_env_editor}"
- end
-
- def description # :nodoc:
- <<-EOF
- The open command opens gem in editor and changes current path
- to gem's source directory. Editor can be specified with -e option,
- otherwise rubygems will look for editor in $EDITOR, $VISUAL and
- $GEM_EDITOR variables.
- EOF
- end
-
- def usage # :nodoc:
- "#{program_name} GEMNAME [-e EDITOR]"
- end
-
- def get_env_editor
- ENV['GEM_EDITOR'] ||
- ENV['VISUAL'] ||
- ENV['EDITOR'] ||
- 'vi'
- end
-
- def execute
- @version = options[:version] || Gem::Requirement.default
- @editor = options[:editor] || get_env_editor
-
- found = open_gem(get_one_gem_name)
-
- terminate_interaction 1 unless found
- end
-
- def open_gem name
- spec = spec_for name
- return false unless spec
-
- open_editor(spec.full_gem_path)
- end
-
- def open_editor path
- Dir.chdir(path) do
- system(*@editor.split(/\s+/) + [path])
- end
- end
-
- def spec_for name
- spec = Gem::Specification.find_all_by_name(name, @version).last
-
- return spec if spec
-
- say "Unable to find gem '#{name}'"
- end
-end
diff --git a/lib/rubygems/commands/outdated_command.rb b/lib/rubygems/commands/outdated_command.rb
index 70f6c02801..f51bc5e93f 100644
--- a/lib/rubygems/commands/outdated_command.rb
+++ b/lib/rubygems/commands/outdated_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
@@ -18,7 +17,7 @@ class Gem::Commands::OutdatedCommand < Gem::Command
def description # :nodoc:
<<-EOF
-The outdated command lists gems you may wish to upgrade to a newer version.
+The outdated command lists gems you way wish to upgrade to a newer version.
You can check for dependency mismatches using the dependency command and
update the gems with the update or install commands.
diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb
index e507c988d6..13b8793021 100644
--- a/lib/rubygems/commands/owner_command.rb
+++ b/lib/rubygems/commands/owner_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'
@@ -87,9 +86,7 @@ permission to.
request.add_field "Authorization", api_key
end
- action = method == :delete ? "Removing" : "Adding"
-
- with_response response, "#{action} #{owner}"
+ with_response response, "Removing #{owner}"
rescue
# ignore
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index a5a348dc72..b54e7eac93 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'
require 'rubygems/installer'
@@ -22,11 +21,6 @@ class Gem::Commands::PristineCommand < Gem::Command
options[:all] = value
end
- add_option('--skip=gem_name',
- 'used on --all, skip if name == gem_name') do |value, options|
- options[:skip] = value
- end
-
add_option('--[no-]extensions',
'Restore gems with extensions',
'in addition to regular gems') do |value, options|
@@ -115,16 +109,6 @@ extensions will be restored.
next
end
- if spec.name == options[:skip]
- say "Skipped #{spec.full_name}, it was given through options"
- next
- end
-
- if spec.bundled_gem_in_old_ruby?
- say "Skipped #{spec.full_name}, it is bundled with old Ruby"
- next
- end
-
unless spec.extensions.empty? or options[:extensions] then
say "Skipped #{spec.full_name}, it needs to compile an extension"
next
@@ -136,17 +120,8 @@ extensions will be restored.
require 'rubygems/remote_fetcher'
say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
-
dep = Gem::Dependency.new spec.name, spec.version
- found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
-
- if found.empty?
- say "Skipped #{spec.full_name}, it was not found from cache and remote sources"
- next
- end
-
- spec_candidate, source = found.first
- Gem::RemoteFetcher.fetcher.download spec_candidate, source.uri.to_s, spec.base_dir
+ Gem::RemoteFetcher.fetcher.download_to_cache dep
end
env_shebang =
@@ -157,7 +132,7 @@ extensions will be restored.
install_defaults.to_s['--env-shebang']
end
- installer = Gem::Installer.at(gem,
+ installer = Gem::Installer.new(gem,
:wrappers => true,
:force => true,
:install_dir => spec.base_dir,
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index 035a03e5e7..6899b489ad 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 61e9808860..432250e033 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
@@ -50,12 +49,6 @@ class Gem::Commands::QueryCommand < Gem::Command
options[:all] = value
end
- add_option('-e', '--exact',
- 'Name of gem(s) to query on matches the',
- 'provided STRING') do |value, options|
- options[:exact] = value
- end
-
add_option( '--[no-]prerelease',
'Display prerelease versions') do |value, options|
options[:prerelease] = value
@@ -85,8 +78,7 @@ is too hard to use.
elsif !options[:name].source.empty?
name = Array(options[:name])
else
- args = options[:args].to_a
- name = options[:exact] ? args : args.map{|arg| /#{arg}/i }
+ name = options[:args].to_a.map{|arg| /#{arg}/i }
end
prerelease = options[:prerelease]
@@ -169,7 +161,7 @@ is too hard to use.
:latest
end
- if name.respond_to?(:source) && name.source.empty?
+ if name.source.empty?
spec_tuples = fetcher.detect(type) { true }
else
spec_tuples = fetcher.detect(type) do |name_tuple|
@@ -226,7 +218,7 @@ is too hard to use.
end
end
- output << clean_text(make_entry(matching_tuples, platforms))
+ output << make_entry(matching_tuples, platforms)
end
end
@@ -235,7 +227,7 @@ is too hard to use.
name_tuple, spec = detail_tuple
- spec = spec.fetch_spec name_tuple if spec.respond_to? :fetch_spec
+ spec = spec.fetch_spec name_tuple unless Gem::Specification === spec
entry << "\n"
@@ -284,7 +276,7 @@ is too hard to use.
end
def spec_authors entry, spec
- authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup
+ authors = "Author#{spec.authors.length > 1 ? 's' : ''}: "
authors << spec.authors.join(', ')
entry << format_text(authors, 68, 4)
end
@@ -298,7 +290,7 @@ is too hard to use.
def spec_license entry, spec
return if spec.license.nil? or spec.license.empty?
- licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
+ licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: "
licenses << spec.licenses.join(', ')
entry << "\n" << format_text(licenses, 68, 4)
end
@@ -344,8 +336,8 @@ is too hard to use.
end
def spec_summary entry, spec
- summary = truncate_text(spec.summary, "the summary for #{spec.full_name}")
- entry << "\n\n" << format_text(summary, 68, 4)
+ entry << "\n\n" << format_text(spec.summary, 68, 4)
end
end
+
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index 6992040dca..86597f99a6 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/rdoc'
diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb
index 933436d84d..5809690735 100644
--- a/lib/rubygems/commands/search_command.rb
+++ b/lib/rubygems/commands/search_command.rb
@@ -1,11 +1,10 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'
class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
def initialize
- super 'search', 'Display remote gems whose name matches REGEXP'
+ super 'search', 'Display remote gems whose name contains STRING'
remove_option '--name-matches'
@@ -13,7 +12,7 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
end
def arguments # :nodoc:
- "REGEXP regexp to search for in gem name"
+ "STRING fragment of gem name to search for"
end
def defaults_str # :nodoc:
@@ -22,8 +21,8 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
def description # :nodoc:
<<-EOF
-The search command displays remote gems whose name matches the given
-regexp.
+The search command displays remote gems whose name contains the given
+string.
The --details option displays additional details from the gem but will
take a little longer to complete as it must download the information
@@ -34,7 +33,7 @@ To list local gems use the list command.
end
def usage # :nodoc:
- "#{program_name} [REGEXP]"
+ "#{program_name} [STRING]"
end
end
diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb
index 245156d50d..4796ce2ad6 100644
--- a/lib/rubygems/commands/server_command.rb
+++ b/lib/rubygems/commands/server_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/server'
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index ebb08d24d7..face77fae9 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
##
@@ -14,7 +13,7 @@ class Gem::Commands::SetupCommand < Gem::Command
super 'setup', 'Install RubyGems',
:format_executable => true, :document => %w[ri],
- :site_or_vendor => 'sitelibdir',
+ :site_or_vendor => :sitelibdir,
:destdir => '', :prefix => '', :previous_version => ''
add_option '--previous-version=VERSION',
@@ -37,7 +36,7 @@ class Gem::Commands::SetupCommand < Gem::Command
add_option '--[no-]vendor',
'Install into vendorlibdir not sitelibdir' do |vendor, options|
- options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir'
+ options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
end
add_option '--[no-]format-executable',
@@ -344,19 +343,19 @@ TEXT
site_or_vendor = options[:site_or_vendor]
if prefix.empty? then
- lib_dir = RbConfig::CONFIG[site_or_vendor]
- bin_dir = RbConfig::CONFIG['bindir']
+ lib_dir = Gem::ConfigMap[site_or_vendor]
+ bin_dir = Gem::ConfigMap[:bindir]
else
# Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets
# confused about installation location, so switch back to
# sitelibdir/vendorlibdir.
if defined?(APPLE_GEM_HOME) and
# just in case Apple and RubyGems don't get this patched up proper.
- (prefix == RbConfig::CONFIG['libdir'] or
+ (prefix == Gem::ConfigMap[:libdir] or
# this one is important
- prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) then
- lib_dir = RbConfig::CONFIG[site_or_vendor]
- bin_dir = RbConfig::CONFIG['bindir']
+ prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then
+ lib_dir = Gem::ConfigMap[site_or_vendor]
+ bin_dir = Gem::ConfigMap[:bindir]
else
lib_dir = File.join prefix, 'lib'
bin_dir = File.join prefix, 'bin'
@@ -447,7 +446,7 @@ abort "#{deprecation_message}"
history.force_encoding Encoding::UTF_8 if
Object.const_defined? :Encoding
- history = history.sub(/^# coding:.*?(?=^=)/m, '')
+ history = history.sub(/^# coding:.*?^=/m, '')
text = history.split(HISTORY_HEADER)
text.shift # correct an off-by-one generated by split
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
index 9832afd214..81ff07babc 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/remote_fetcher'
require 'rubygems/spec_fetcher'
@@ -103,7 +102,7 @@ Do you want to add this insecure source?
RubyGems fetches gems from the sources you have configured (stored in your
~/.gemrc).
-The default source is https://rubygems.org, but you may have other sources
+The default source is https://rubygems.org, but you may have older sources
configured. This guide will help you update your sources or configure
yourself to use your own gem server.
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index ad8840adc2..3bc02a9c14 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb
index 0524ee1e2b..0ef0755960 100644
--- a/lib/rubygems/commands/stale_command.rb
+++ b/lib/rubygems/commands/stale_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::StaleCommand < Gem::Command
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index fe97790194..e62095a336 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/uninstaller'
@@ -16,7 +15,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
def initialize
super 'uninstall', 'Uninstall gems from the local repository',
:version => Gem::Requirement.default, :user_install => true,
- :check_dev => false, :vendor => false
+ :check_dev => false
add_option('-a', '--[no-]all',
'Uninstall all matching versions'
@@ -77,18 +76,6 @@ class Gem::Commands::UninstallCommand < Gem::Command
add_version_option
add_platform_option
-
- add_option('--vendor',
- 'Uninstall gem from the vendor directory.',
- 'Only for use by gem repackagers.') do |value, options|
- unless Gem.vendor_dir then
- raise OptionParser::InvalidOption.new 'your platform is not supported'
- end
-
- alert_warning 'Use your OS package manager to uninstall vendor gems'
- options[:vendor] = true
- options[:install_dir] = Gem.vendor_dir
- end
end
def arguments # :nodoc:
@@ -125,7 +112,7 @@ that is a dependency of an existing gem. You can use the
end
def uninstall_all
- specs = Gem::Specification.reject { |spec| spec.default_gem? }
+ _, specs = Gem::Specification.partition { |spec| spec.default_gem? }
specs.each do |spec|
options[:version] = spec.version
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index ffa429de6f..5a05ad0a81 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/installer'
require 'rubygems/version_option'
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index d654a5fa4e..b4ee59b3bb 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/command_manager'
require 'rubygems/dependency_installer'
@@ -17,8 +16,6 @@ class Gem::Commands::UpdateCommand < Gem::Command
attr_reader :installer # :nodoc:
- attr_reader :updated # :nodoc:
-
def initialize
super 'update', 'Update installed gems to the latest version',
:document => %w[rdoc ri],
@@ -59,7 +56,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
<<-EOF
The update command will update your gems to the latest version.
-The update command does not remove the previous version. Use the cleanup
+The update comamnd does not remove the previous version. Use the cleanup
command to remove old versions.
EOF
end
@@ -85,6 +82,8 @@ command to remove old versions.
end
def execute
+ hig = {}
+
if options[:system] then
update_rubygems
return
@@ -98,14 +97,10 @@ command to remove old versions.
updated = update_gems gems_to_update
- updated_names = updated.map { |spec| spec.name }
- not_updated_names = options[:args].uniq - updated_names
-
if updated.empty? then
say "Nothing to update"
else
- say "Gems updated: #{updated_names.join(' ')}"
- say "Gems already up-to-date: #{not_updated_names.join(' ')}" unless not_updated_names.empty?
+ say "Gems updated: #{updated.map { |spec| spec.name }.join ' '}"
end
end
@@ -202,16 +197,17 @@ command to remove old versions.
def update_gem name, version = Gem::Requirement.default
return if @updated.any? { |spec| spec.name == name }
- update_options = options.dup
- update_options[:prerelease] = version.prerelease?
+ @installer ||= Gem::DependencyInstaller.new options
- @installer = Gem::DependencyInstaller.new update_options
+ success = false
say "Updating #{name}"
begin
@installer.install name, Gem::Requirement.new(version)
- rescue Gem::InstallError, Gem::DependencyError => e
+ success = true
+ rescue Gem::InstallError => e
alert_error "Error installing #{name}:\n\t#{e.message}"
+ success = false
end
@installer.installed_gems.each do |spec|
@@ -263,7 +259,7 @@ command to remove old versions.
highest_installed_gems.each do |l_name, l_spec|
next if not gem_names.empty? and
- gem_names.none? { |name| name == l_spec.name }
+ gem_names.all? { |name| /#{name}/ !~ l_spec.name }
highest_remote_ver = highest_remote_version l_spec
@@ -276,3 +272,4 @@ command to remove old versions.
end
end
+
diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb
index c028d5d49f..96eeb86288 100644
--- a/lib/rubygems/commands/which_command.rb
+++ b/lib/rubygems/commands/which_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
class Gem::Commands::WhichCommand < Gem::Command
diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb
index 0d6575b272..2285bb4017 100644
--- a/lib/rubygems/commands/yank_command.rb
+++ b/lib/rubygems/commands/yank_command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
@@ -22,7 +21,7 @@ via the webhooks. If you accidentally pushed passwords or other sensitive
data you will need to change them immediately and yank your gem.
If you are yanking a gem due to intellectual property reasons contact
-http://help.rubygems.org for permanent removal. Be sure to mention this
+http://help.rubygems.org for permanant removal. Be sure to mention this
as the reason for the removal request.
EOF
end
@@ -32,7 +31,7 @@ as the reason for the removal request.
end
def usage # :nodoc:
- "#{program_name} GEM -v VERSION [-p PLATFORM] [--key KEY_NAME] [--host HOST]"
+ "#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]"
end
def initialize
@@ -41,41 +40,51 @@ as the reason for the removal request.
add_version_option("remove")
add_platform_option("remove")
- add_option('--host HOST',
- 'Yank from another gemcutter-compatible host') do |value, options|
- options[:host] = value
+ add_option('--undo') do |value, options|
+ options[:undo] = true
end
- add_key_option
- @host = nil
+ add_option('-k', '--key KEY_NAME',
+ 'Use API key from your gem credentials file') do |value, options|
+ options[:key] = value
+ end
end
def execute
- @host = options[:host]
-
- sign_in @host
+ sign_in
version = get_version_from_requirements(options[:version])
platform = get_platform_from_requirements(options)
+ api_key = Gem.configuration.rubygems_api_key
+ api_key = Gem.configuration.api_keys[options[:key].to_sym] if options[:key]
if version then
- yank_gem(version, platform)
+ if options[:undo] then
+ unyank_gem(version, platform, api_key)
+ else
+ yank_gem(version, platform, api_key)
+ end
else
say "A version argument is required: #{usage}"
terminate_interaction
end
end
- def yank_gem(version, platform)
+ def yank_gem(version, platform, api_key)
say "Yanking gem from #{self.host}..."
- yank_api_request(:delete, version, platform, "api/v1/gems/yank")
+ yank_api_request(:delete, version, platform, "api/v1/gems/yank", api_key)
+ end
+
+ def unyank_gem(version, platform, api_key)
+ say "Unyanking gem from #{host}..."
+ yank_api_request(:put, version, platform, "api/v1/gems/unyank", api_key)
end
private
- def yank_api_request(method, version, platform, api)
+ def yank_api_request(method, version, platform, api, api_key)
name = get_one_gem_name
- response = rubygems_api_request(method, api, host) do |request|
+ response = rubygems_api_request(method, api) do |request|
request.add_field("Authorization", api_key)
data = {
diff --git a/lib/rubygems/compatibility.rb b/lib/rubygems/compatibility.rb
index 2056b5b53a..5e8618fe39 100644
--- a/lib/rubygems/compatibility.rb
+++ b/lib/rubygems/compatibility.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
# :stopdoc:
#--
@@ -21,7 +20,8 @@ if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
$LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library
- if path = $LOADED_FEATURES.find {|n| n.end_with? '/rubygems.rb'} then
+ if $LOADED_FEATURES.any? do |path| path.end_with? '/rubygems.rb' end then
+ # TODO path does not exist here
raise LoadError, "another rubygems is already loaded from #{path}"
end
@@ -33,8 +33,6 @@ end
module Gem
RubyGemsVersion = VERSION
- # TODO remove at RubyGems 3
-
RbConfigPriorities = %w[
MAJOR
MINOR
@@ -47,7 +45,7 @@ module Gem
unless defined?(ConfigMap)
##
# Configuration settings from ::RbConfig
- ConfigMap = Hash.new do |cm, key| # TODO remove at RubyGems 3
+ ConfigMap = Hash.new do |cm, key|
cm[key] = RbConfig::CONFIG[key.to_s]
end
else
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 2bcd830f38..1acae9b529 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -58,7 +57,7 @@ class Gem::ConfigFile
# :stopdoc:
- SYSTEM_CONFIG_PATH =
+ system_config_path =
begin
require "etc"
Etc.sysconfdir
@@ -87,7 +86,7 @@ class Gem::ConfigFile
# :startdoc:
- SYSTEM_WIDE_CONFIG_FILE = File.join SYSTEM_CONFIG_PATH, 'gemrc'
+ SYSTEM_WIDE_CONFIG_FILE = File.join system_config_path, 'gemrc'
##
# List of arguments supplied to the config file object.
@@ -138,10 +137,9 @@ class Gem::ConfigFile
attr_reader :ssl_verify_mode
##
- # Path name of directory or file of openssl CA certificate, used for remote
- # https connection
+ # Path name of directory or file of openssl CA certificate, used for remote https connection
- attr_accessor :ssl_ca_cert
+ attr_reader :ssl_ca_cert
##
# Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
@@ -201,12 +199,11 @@ class Gem::ConfigFile
result.merge load_file file
end
+
@hash = operating_system_config.merge platform_config
- unless arg_list.index '--norc'
- @hash = @hash.merge system_config
- @hash = @hash.merge user_config
- @hash = @hash.merge environment_config
- end
+ @hash = @hash.merge system_config
+ @hash = @hash.merge user_config
+ @hash = @hash.merge environment_config
# HACK these override command-line args, which is bad
@backtrace = @hash[:backtrace] if @hash.key? :backtrace
@@ -323,23 +320,23 @@ if you believe they were disclosed to a third party.
@rubygems_api_key = api_key
end
+ YAMLErrors = [ArgumentError]
+ YAMLErrors << Psych::SyntaxError if defined?(Psych::SyntaxError)
+
def load_file(filename)
Gem.load_yaml
- yaml_errors = [ArgumentError]
- yaml_errors << Psych::SyntaxError if defined?(Psych::SyntaxError)
-
return {} unless filename and File.exist? filename
begin
- content = Gem::SafeYAML.load(File.read(filename))
+ content = YAML.load(File.read(filename))
unless content.kind_of? Hash
warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
return {}
end
return content
- rescue *yaml_errors => e
- warn "Failed to load #{filename}, #{e}"
+ rescue *YAMLErrors => e
+ warn "Failed to load #{filename}, #{e.to_s}"
rescue Errno::EACCES
warn "Failed to load #{filename} due to permissions problem."
end
@@ -385,8 +382,6 @@ if you believe they were disclosed to a third party.
@backtrace = true
when /^--debug$/ then
$DEBUG = true
-
- warn 'NOTE: Debugging mode prints all exceptions even when rescued'
else
@args << arg
end
@@ -432,15 +427,6 @@ if you believe they were disclosed to a third party.
DEFAULT_VERBOSITY
end
- yaml_hash[:ssl_verify_mode] =
- @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
-
- yaml_hash[:ssl_ca_cert] =
- @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert
-
- yaml_hash[:ssl_client_cert] =
- @hash[:ssl_client_cert] if @hash.key? :ssl_client_cert
-
keys = yaml_hash.keys.map { |key| key.to_s }
keys << 'debug'
re = Regexp.union(*keys)
diff --git a/lib/rubygems/core_ext/kernel_gem.rb b/lib/rubygems/core_ext/kernel_gem.rb
index b0dd69bfcc..3405233ab1 100644
--- a/lib/rubygems/core_ext/kernel_gem.rb
+++ b/lib/rubygems/core_ext/kernel_gem.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# RubyGems adds the #gem method to allow activation of specific gem versions
# and overrides the #require method on Kernel to make gems appear as if they
@@ -27,11 +26,6 @@ module Kernel
# Kernel#gem should be called *before* any require statements (otherwise
# RubyGems may load a conflicting library version).
#
- # Kernel#gem only loads prerelease versions when prerelease +requirements+
- # are given:
- #
- # gem 'rake', '>= 1.1.a', '< 2'
- #
# In older RubyGems versions, the environment variable GEM_SKIP could be
# used to skip activation of specified gems, for example to test out changes
# that haven't been installed yet. Now RubyGems defers to -I and the
@@ -56,17 +50,8 @@ module Kernel
gem_name = gem_name.name
end
- dep = Gem::Dependency.new(gem_name, *requirements)
-
- loaded = Gem.loaded_specs[gem_name]
-
- return false if loaded && dep.matches_spec?(loaded)
-
- spec = dep.to_spec
-
- Gem::LOADED_SPECS_MUTEX.synchronize {
- spec.activate
- } if spec
+ spec = Gem::Dependency.new(gem_name, *requirements).to_spec
+ spec.activate if spec
end
private :gem
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 6c00f3fd9b..84bb03f67d 100755
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -51,8 +50,12 @@ module Kernel
# normal require handle loading a gem from the rescue below.
if Gem::Specification.unresolved_deps.empty? then
- RUBYGEMS_ACTIVATION_MONITOR.exit
- return gem_original_require(path)
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
end
# If +path+ is for a gem that has already been loaded, don't
@@ -61,11 +64,15 @@ module Kernel
#--
# TODO request access to the C implementation of this to speed up RubyGems
- spec = Gem::Specification.find_active_stub_by_path path
+ spec = Gem::Specification.stubs.find { |s|
+ s.activated? and s.contains_requirable_file? path
+ }
begin
RUBYGEMS_ACTIVATION_MONITOR.exit
return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
end if spec
# Attempt to find +path+ in any unresolved gems...
@@ -98,38 +105,42 @@ module Kernel
names = found_specs.map(&:name).uniq
if names.size > 1 then
- RUBYGEMS_ACTIVATION_MONITOR.exit
raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
end
# Ok, now find a gem that has no conflicts, starting
# at the highest version.
- valid = found_specs.reject { |s| s.has_conflicts? }.last
+ valid = found_specs.select { |s| s.conflicts.empty? }.last
unless valid then
le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
le.name = names.first
- RUBYGEMS_ACTIVATION_MONITOR.exit
raise le
end
valid.activate
end
- RUBYGEMS_ACTIVATION_MONITOR.exit
- return gem_original_require(path)
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
rescue LoadError => load_error
- RUBYGEMS_ACTIVATION_MONITOR.enter
-
if load_error.message.start_with?("Could not find") or
(load_error.message.end_with?(path) and Gem.try_activate(path)) then
- RUBYGEMS_ACTIVATION_MONITOR.exit
- return gem_original_require(path)
- else
- RUBYGEMS_ACTIVATION_MONITOR.exit
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.enter
+ end
end
raise load_error
+ ensure
+ RUBYGEMS_ACTIVATION_MONITOR.exit
end
private :require
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index 16fa96eb2d..591580b7da 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
module Gem
DEFAULT_HOST = "https://rubygems.org"
@@ -30,22 +29,22 @@ module Gem
def self.default_dir
path = if defined? RUBY_FRAMEWORK_VERSION then
[
- File.dirname(RbConfig::CONFIG['sitedir']),
+ File.dirname(ConfigMap[:sitedir]),
'Gems',
- RbConfig::CONFIG['ruby_version']
+ ConfigMap[:ruby_version]
]
- elsif RbConfig::CONFIG['rubylibprefix'] then
+ elsif ConfigMap[:rubylibprefix] then
[
- RbConfig::CONFIG['rubylibprefix'],
+ ConfigMap[:rubylibprefix],
'gems',
- RbConfig::CONFIG['ruby_version']
+ ConfigMap[:ruby_version]
]
else
[
- RbConfig::CONFIG['libdir'],
+ ConfigMap[:libdir],
ruby_engine,
'gems',
- RbConfig::CONFIG['ruby_version']
+ ConfigMap[:ruby_version]
]
end
@@ -53,17 +52,6 @@ module Gem
end
##
- # Returns binary extensions dir for specified RubyGems base dir or nil
- # if such directory cannot be determined.
- #
- # By default, the binary extensions are located side by side with their
- # Ruby counterparts, therefore nil is returned
-
- def self.default_ext_dir_for base_dir
- nil
- end
-
- ##
# Paths where RubyGems' .rb files and bin files are installed
def self.default_rubygems_dirs
@@ -75,7 +63,7 @@ module Gem
def self.user_dir
parts = [Gem.user_home, '.gem', ruby_engine]
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
+ parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty?
File.join parts
end
@@ -90,18 +78,18 @@ module Gem
# Default gem load path
def self.default_path
- path = []
- path << user_dir if user_home && File.exist?(user_home)
- path << default_dir
- path << vendor_dir if vendor_dir and File.directory? vendor_dir
- path
+ if Gem.user_home && File.exist?(Gem.user_home) then
+ [user_dir, default_dir]
+ else
+ [default_dir]
+ end
end
##
# Deduce Ruby's --program-prefix and --program-suffix from its install name
def self.default_exec_format
- exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s'
+ exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
unless exec_format =~ /%s/ then
raise Gem::Exception,
@@ -118,7 +106,7 @@ module Gem
if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
'/usr/bin'
else # generic install
- RbConfig::CONFIG['bindir']
+ ConfigMap[:bindir]
end
end
@@ -153,26 +141,4 @@ module Gem
def self.default_gems_use_full_paths?
ruby_engine != 'ruby'
end
-
- ##
- # Install extensions into lib as well as into the extension directory.
-
- def self.install_extension_in_lib # :nodoc:
- true
- end
-
- ##
- # Directory where vendor gems are installed.
-
- def self.vendor_dir # :nodoc:
- if vendor_dir = ENV['GEM_VENDOR'] then
- return vendor_dir.dup
- end
-
- return nil unless RbConfig::CONFIG.key? 'vendordir'
-
- File.join RbConfig::CONFIG['vendordir'], 'gems',
- RbConfig::CONFIG['ruby_version']
- end
-
end
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index c7b2451c6a..a96d67c3e5 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# The Dependency class holds a Gem name and a Gem::Requirement.
@@ -75,7 +74,7 @@ class Gem::Dependency
end
def inspect # :nodoc:
- if prerelease? then
+ if @prerelease
"<%s type=%p name=%p requirements=%p prerelease=ok>" %
[self.class, self.type, self.name, requirement.to_s]
else
@@ -146,6 +145,7 @@ class Gem::Dependency
@requirement = @version_requirements if defined?(@version_requirements)
end
+ # DOC: this method needs documentation or :nodoc''d
def requirements_list
requirement.as_list
end
@@ -165,10 +165,6 @@ class Gem::Dependency
@type ||= :runtime
end
- def runtime?
- @type == :runtime || !@type
- end
-
def == other # :nodoc:
Gem::Dependency === other &&
self.name == other.name &&
@@ -209,19 +205,9 @@ class Gem::Dependency
alias === =~
- ##
- # :call-seq:
- # dep.match? name => true or false
- # dep.match? name, version => true or false
- # dep.match? spec => true or false
- #
- # Does this dependency match the specification described by +name+ and
- # +version+ or match +spec+?
- #
- # NOTE: Unlike #matches_spec? this method does not return true when the
- # version is a prerelease version unless this is a prerelease dependency.
+ # DOC: this method needs either documented or :nodoc'd
- def match? obj, version=nil, allow_prerelease=false
+ def match? obj, version=nil
if !version
name = obj.name
version = obj.version
@@ -230,23 +216,12 @@ class Gem::Dependency
end
return false unless self.name === name
+ return true if requirement.none?
- version = Gem::Version.new version
-
- return true if requirement.none? and not version.prerelease?
- return false if version.prerelease? and
- not allow_prerelease and
- not prerelease?
-
- requirement.satisfied_by? version
+ requirement.satisfied_by? Gem::Version.new(version)
end
- ##
- # Does this dependency match +spec+?
- #
- # NOTE: This is not a convenience method. Unlike #match? this method
- # returns true when +spec+ is a prerelease version even if this dependency
- # is not a prerelease dependency.
+ # DOC: this method needs either documented or :nodoc'd
def matches_spec? spec
return false unless name === spec.name
@@ -274,18 +249,21 @@ class Gem::Dependency
self.class.new name, self_req.as_list.concat(other_req.as_list)
end
+ # DOC: this method needs either documented or :nodoc'd
+
def matching_specs platform_only = false
- matches = Gem::Specification.stubs_for(name).find_all { |spec|
- requirement.satisfied_by? spec.version
+ matches = Gem::Specification.stubs.find_all { |spec|
+ self.name === spec.name and # TODO: == instead of ===
+ requirement.satisfied_by? spec.version
}.map(&:to_spec)
if platform_only
matches.reject! { |spec|
- spec.nil? || !Gem::Platform.match(spec.platform)
+ not Gem::Platform.match spec.platform
}
end
- matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
+ matches = matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
end
##
@@ -295,6 +273,8 @@ class Gem::Dependency
@requirement.specific?
end
+ # DOC: this method needs either documented or :nodoc'd
+
def to_specs
matches = matching_specs true
@@ -307,13 +287,12 @@ class Gem::Dependency
if specs.empty?
total = Gem::Specification.to_a.size
- msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n".dup
+ error = Gem::LoadError.new \
+ "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)"
else
- msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n".dup
+ error = Gem::LoadError.new \
+ "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]"
end
- msg << "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}', execute `gem env` for more information"
-
- error = Gem::LoadError.new(msg)
error.name = self.name
error.requirement = self.requirement
raise error
@@ -324,15 +303,11 @@ class Gem::Dependency
matches
end
+ # DOC: this method needs either documented or :nodoc'd
+
def to_spec
matches = self.to_specs
- active = matches.find { |spec| spec && spec.activated? }
-
- return active if active
-
- matches.delete_if { |spec| spec.nil? || spec.version.prerelease? } unless prerelease?
-
- matches.last
+ matches.find { |spec| spec.activated? } or matches.last
end
end
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index 28848f7373..e404d42b3a 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/dependency_list'
require 'rubygems/package'
@@ -73,7 +72,6 @@ class Gem::DependencyInstaller
def initialize options = {}
@only_install_dir = !!options[:install_dir]
@install_dir = options[:install_dir] || Gem.dir
- @build_root = options[:build_root]
options = DEFAULT_OPTIONS.merge options
@@ -104,7 +102,7 @@ class Gem::DependencyInstaller
@cache_dir = options[:cache_dir] || @install_dir
- @errors = []
+ @errors = nil
end
##
@@ -159,7 +157,6 @@ class Gem::DependencyInstaller
dependency_list.remove_specs_unsatisfied_by dependencies
end
-
##
# Creates an AvailableSet to install from based on +dep_or_name+ and
# +version+
@@ -219,17 +216,7 @@ class Gem::DependencyInstaller
tuples, errors = Gem::SpecFetcher.fetcher.search_for_dependency dep
if best_only && !tuples.empty?
- tuples.sort! do |a,b|
- if b[0].version == a[0].version
- if b[0].platform != Gem::Platform::RUBY
- 1
- else
- -1
- end
- else
- b[0].version <=> a[0].version
- end
- end
+ tuples.sort! { |a,b| b[0].version <=> a[0].version }
tuples = [tuples.first]
end
@@ -256,9 +243,9 @@ class Gem::DependencyInstaller
# FIX if there is a problem talking to the network, we either need to always tell
# the user (no really_verbose) or fail hard, not silently tell them that we just
# couldn't find their requested gem.
- verbose do
- "Error fetching remote data:\t\t#{e.message}\n" \
- "Falling back to local-only install"
+ if Gem.configuration.really_verbose then
+ say "Error fetching remote data:\t\t#{e.message}"
+ say "Falling back to local-only install"
end
@domain = :local
end
@@ -388,16 +375,13 @@ class Gem::DependencyInstaller
options = {
:bin_dir => @bin_dir,
:build_args => @build_args,
- :document => @document,
:env_shebang => @env_shebang,
:force => @force,
:format_executable => @format_executable,
:ignore_dependencies => @ignore_dependencies,
- :prerelease => @prerelease,
:security_policy => @security_policy,
:user_install => @user_install,
:wrappers => @wrappers,
- :build_root => @build_root,
:install_as_default => @install_as_default
}
options[:install_dir] = @install_dir if @only_install_dir
@@ -431,59 +415,23 @@ class Gem::DependencyInstaller
end
def resolve_dependencies dep_or_name, version # :nodoc:
- request_set = Gem::RequestSet.new
- request_set.development = @development
- request_set.development_shallow = @dev_shallow
+ as = available_set_for dep_or_name, version
+
+ request_set = as.to_request_set install_development_deps
request_set.soft_missing = @force
- request_set.prerelease = @prerelease
- request_set.remote = false unless consider_remote?
installer_set = Gem::Resolver::InstallerSet.new @domain
+ installer_set.always_install.concat request_set.always_install
installer_set.ignore_installed = @only_install_dir
- if consider_local?
- if dep_or_name =~ /\.gem$/ and File.file? dep_or_name then
- src = Gem::Source::SpecificFile.new dep_or_name
- installer_set.add_local dep_or_name, src.spec, src
- version = src.spec.version if version == Gem::Requirement.default
- elsif dep_or_name =~ /\.gem$/ then
- Dir[dep_or_name].each do |name|
- begin
- src = Gem::Source::SpecificFile.new name
- installer_set.add_local dep_or_name, src.spec, src
- rescue Gem::Package::FormatError
- end
- end
- # else This is a dependency. InstallerSet handles this case
- end
- end
-
- dependency =
- if spec = installer_set.local?(dep_or_name) then
- Gem::Dependency.new spec.name, version
- elsif String === dep_or_name then
- Gem::Dependency.new dep_or_name, version
- else
- dep_or_name
- end
-
- dependency.prerelease = @prerelease
-
- request_set.import [dependency]
-
- installer_set.add_always_install dependency
-
- request_set.always_install = installer_set.always_install
-
if @ignore_dependencies then
installer_set.ignore_dependencies = true
- request_set.ignore_dependencies = true
- request_set.soft_missing = true
+ request_set.soft_missing = true
end
- request_set.resolve installer_set
+ composed_set = Gem::Resolver.compose_sets as, installer_set
- @errors.concat request_set.errors
+ request_set.resolve composed_set
request_set
end
diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
index 35fe7c4c1a..3e40325527 100644
--- a/lib/rubygems/dependency_list.rb
+++ b/lib/rubygems/dependency_list.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -142,9 +141,6 @@ class Gem::DependencyList
def ok_to_remove?(full_name, check_dev=true)
gem_to_remove = find_name full_name
- # If the state is inconsistent, at least don't crash
- return true unless gem_to_remove
-
siblings = @specs.find_all { |s|
s.name == gem_to_remove.name &&
s.full_name != gem_to_remove.full_name
@@ -223,7 +219,11 @@ class Gem::DependencyList
dependencies.each do |dep|
specs.each do |spec|
if spec.satisfies_requirement? dep then
- yield spec
+ begin
+ yield spec
+ rescue TSort::Cyclic
+ # do nothing
+ end
break
end
end
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index 375194c1e8..274d6a5c12 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Provides a single method +deprecate+ to be used to declare when
# something is going away.
@@ -51,7 +50,7 @@ module Gem::Deprecate
class_eval {
old = "_deprecated_#{name}"
alias_method old, name
- define_method name do |*args, &block|
+ define_method name do |*args, &block| # TODO: really works on 1.8.7?
klass = self.kind_of? Module
target = klass ? "#{self}." : "#{self.class}#"
msg = [ "NOTE: #{target}#{name} is deprecated",
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
index ec4a16c3f8..0aa0f7b79f 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'
@@ -106,7 +105,7 @@ class Gem::Doctor
next if ent == "." || ent == ".."
child = File.join(directory, ent)
- next unless File.exist?(child)
+ next unless File.exists?(child)
basename = File.basename(child, extension)
next if installed_specs.include? basename
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb
index 8304647546..fc9bfbc0dc 100644
--- a/lib/rubygems/errors.rb
+++ b/lib/rubygems/errors.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# This file contains all the various exceptions and other errors that are used
# inside of RubyGems.
@@ -20,36 +19,6 @@ module Gem
attr_accessor :requirement
end
- # Raised when there are conflicting gem specs loaded
-
- class ConflictError < LoadError
-
- ##
- # A Hash mapping conflicting specifications to the dependencies that
- # caused the conflict
-
- attr_reader :conflicts
-
- ##
- # The specification that had the conflict
-
- attr_reader :target
-
- def initialize target, conflicts
- @target = target
- @conflicts = conflicts
- @name = target.name
-
- reason = conflicts.map { |act, dependencies|
- "#{act.full_name} conflicts with #{dependencies.join(", ")}"
- }.join ", "
-
- # TODO: improve message by saying who activated `con`
-
- super("Unable to activate #{target.full_name}, because #{reason}")
- end
- end
-
class ErrorReason; end
# Generated when trying to lookup a gem to indicate that the gem
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb
index 9089eae4d5..6bd50eca2c 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
# TODO: the documentation in here is terrible.
#
# Each exception needs a brief description and the scenarios where it is
@@ -28,7 +27,7 @@ class Gem::DependencyRemovalException < Gem::Exception; end
# toplevel. Indicates which dependencies were incompatible through #conflict
# and #conflicting_dependencies
-class Gem::DependencyResolutionError < Gem::DependencyError
+class Gem::DependencyResolutionError < Gem::Exception
attr_reader :conflict
@@ -138,7 +137,7 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
requester = requester ? requester.spec.full_name : 'The user'
dependency = @request.dependency
- message = "#{requester} requires #{dependency} but it conflicted:\n".dup
+ message = "#{requester} requires #{dependency} but it conflicted:\n"
@conflicts.each do |_, conflict|
message << conflict.explanation
@@ -215,7 +214,7 @@ end
# Raised by Resolver when a dependency requests a gem for which
# there is no spec.
-class Gem::UnsatisfiableDependencyError < Gem::DependencyError
+class Gem::UnsatisfiableDependencyError < Gem::Exception
##
# The unsatisfiable dependency. This is a
@@ -224,11 +223,6 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
attr_reader :dependency
##
- # Errors encountered which may have contributed to this exception
-
- attr_accessor :errors
-
- ##
# Creates a new UnsatisfiableDependencyError for the unsatisfiable
# Gem::Resolver::DependencyRequest +dep+
@@ -245,21 +239,6 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
end
@dependency = dep
- @errors = []
- end
-
- ##
- # The name of the unresolved dependency
-
- def name
- @dependency.name
- end
-
- ##
- # The Requirement of the unresolved dependency (not Version).
-
- def version
- @dependency.requirement
end
end
@@ -268,3 +247,4 @@ end
# Backwards compatible typo'd exception class for early RubyGems 2.0.x
Gem::UnsatisfiableDepedencyError = Gem::UnsatisfiableDependencyError # :nodoc:
+
diff --git a/lib/rubygems/ext.rb b/lib/rubygems/ext.rb
index 18d2bc233a..5af6bbf39e 100644
--- a/lib/rubygems/ext.rb
+++ b/lib/rubygems/ext.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
diff --git a/lib/rubygems/ext/build_error.rb b/lib/rubygems/ext/build_error.rb
index 0b3c17a9a0..bfe85ffc11 100644
--- a/lib/rubygems/ext/build_error.rb
+++ b/lib/rubygems/ext/build_error.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Raised when there is an error while building extensions.
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 699903ab0e..e9244c760c 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -67,11 +66,9 @@ class Gem::Ext::Builder
# TODO use Process.spawn when ruby 1.8 support is dropped.
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
if verbose
- puts("current directory: #{Dir.pwd}")
puts(command)
system(command)
else
- results << "current directory: #{Dir.pwd}"
results << command
results << `#{command} #{redirector}`
end
@@ -101,7 +98,7 @@ class Gem::Ext::Builder
def initialize spec, build_args = spec.build_args
@spec = spec
@build_args = build_args
- @gem_dir = spec.full_gem_path
+ @gem_dir = spec.gem_dir
@ran_rake = nil
end
@@ -164,7 +161,7 @@ EOF
results = builder.build(extension, @gem_dir, dest_path,
results, @build_args, lib_dir)
- verbose { results.join("\n") }
+ say results.join("\n") if Gem.configuration.really_verbose
end
end
@@ -189,7 +186,7 @@ EOF
say "This could take a while..."
end
- dest_path = @spec.extension_dir
+ dest_path = @spec.extension_install_dir
FileUtils.rm_f @spec.gem_build_complete_path
@@ -208,9 +205,9 @@ EOF
# Writes +output+ to gem_make.out in the extension install directory.
def write_gem_make_out output # :nodoc:
- destination = File.join @spec.extension_dir, 'gem_make.out'
+ destination = File.join @spec.extension_install_dir, 'gem_make.out'
- FileUtils.mkdir_p @spec.extension_dir
+ FileUtils.mkdir_p @spec.extension_install_dir
open destination, 'wb' do |io| io.puts output end
diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb
index efa3bd1d88..24531bc75c 100644
--- a/lib/rubygems/ext/cmake_builder.rb
+++ b/lib/rubygems/ext/cmake_builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/command'
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb
index 8b42bf7ee9..f66e39387a 100644
--- a/lib/rubygems/ext/configure_builder.rb
+++ b/lib/rubygems/ext/configure_builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 59e243b972..6e736d8062 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -14,24 +13,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
tmp_dest = Dir.mktmpdir(".gem.", ".")
- # Some versions of `mktmpdir` return absolute paths, which will break make
- # if the paths contain spaces. However, on Ruby 1.9.x on Windows, relative
- # paths cause all C extension builds to fail.
- #
- # As such, we convert to a relative path unless we are using Ruby 1.9.x on
- # Windows. This means that when using Ruby 1.9.x on Windows, paths with
- # spaces do not work.
- #
- # Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
- #
- # TODO: Make this unconditional when rubygems no longer supports Ruby 1.9.x.
- tmp_dest = get_relative_path(tmp_dest) unless Gem.win_platform? && RUBY_VERSION <= '2.0'
-
t = nil
Tempfile.open %w"siteconf .rb", "." do |siteconf|
t = siteconf
siteconf.puts "require 'rbconfig'"
- siteconf.puts "dest_path = #{tmp_dest.dump}"
+ siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}"
%w[sitearchdir sitelibdir].each do |dir|
siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
@@ -39,42 +25,37 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
siteconf.flush
+ siteconf_path = File.expand_path siteconf.path
+
+ rubyopt = ENV["RUBYOPT"]
destdir = ENV["DESTDIR"]
begin
- cmd = [Gem.ruby, "-r", get_relative_path(siteconf.path), File.basename(extension), *args].join ' '
-
- begin
- run cmd, results
- ensure
- if File.exist? 'mkmf.log'
- results << "To see why this extension failed to compile, please check" \
- " the mkmf.log which can be found here:\n"
- results << " " + File.join(dest_path, 'mkmf.log') + "\n"
- FileUtils.mv 'mkmf.log', dest_path
- end
- siteconf.unlink
- end
+ ENV["RUBYOPT"] = ["-r#{siteconf_path}", rubyopt].compact.join(' ')
+ cmd = [Gem.ruby, File.basename(extension), *args].join ' '
+
+ run cmd, results
ENV["DESTDIR"] = nil
+ ENV["RUBYOPT"] = rubyopt
+ siteconf.unlink
make dest_path, results
if tmp_dest
- # TODO remove in RubyGems 3
- if Gem.install_extension_in_lib and lib_dir then
- FileUtils.mkdir_p lib_dir
- entries = Dir.entries(tmp_dest) - %w[. ..]
- entries = entries.map { |entry| File.join tmp_dest, entry }
- FileUtils.cp_r entries, lib_dir, :remove_destination => true
- end
-
FileEntry.new(tmp_dest).traverse do |ent|
+ # TODO remove in RubyGems 3
+ if lib_dir then
+ libent = ent.class.new lib_dir, ent.rel
+ libent.exist? or ent.copy libent.path
+ end
+
destent = ent.class.new(dest_path, ent.rel)
- destent.exist? or FileUtils.mv(ent.path, destent.path)
+ destent.exist? or File.rename(ent.path, destent.path)
end
end
ensure
+ ENV["RUBYOPT"] = rubyopt
ENV["DESTDIR"] = destdir
end
end
@@ -85,10 +66,5 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
FileUtils.rm_rf tmp_dest if tmp_dest
end
- private
- def self.get_relative_path(path)
- path[0..Dir.pwd.length-1] = '.' if path.start_with?(Dir.pwd)
- path
- end
-
end
+
diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb
index 682f1253e1..2093bcabdd 100644
--- a/lib/rubygems/ext/rake_builder.rb
+++ b/lib/rubygems/ext/rake_builder.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -20,7 +19,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
rake = ENV['rake']
rake ||= begin
- "#{Gem.ruby} -rubygems #{Gem.bin_path('rake', 'rake')}"
+ "\"#{Gem.ruby}\" -rubygems #{Gem.bin_path('rake', 'rake')}"
rescue Gem::Exception
end
diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb
index fec9e403da..7a3fd6b116 100644
--- a/lib/rubygems/gem_runner.rb
+++ b/lib/rubygems/gem_runner.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index 464993b11f..6a4da9e983 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/remote_fetcher'
##
@@ -69,14 +68,9 @@ module Gem::GemcutterUtilities
terminate_interaction 1 # TODO: question this
end
- if allowed_push_host
- allowed_host_uri = URI.parse(allowed_push_host)
- host_uri = URI.parse(self.host)
-
- unless (host_uri.scheme == allowed_host_uri.scheme) && (host_uri.host == allowed_host_uri.host)
- alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
- terminate_interaction 1
- end
+ if allowed_push_host and self.host != allowed_push_host
+ alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
+ terminate_interaction 1
end
uri = URI.parse "#{self.host}/#{path}"
@@ -92,7 +86,7 @@ module Gem::GemcutterUtilities
def sign_in sign_in_host = nil
sign_in_host ||= self.host
- return if api_key
+ return if Gem.configuration.rubygems_api_key
pretty_host = if Gem::DEFAULT_HOST == sign_in_host then
'RubyGems.org'
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index 871cc09d8d..1c7f8e709f 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/package'
require 'time'
@@ -94,22 +93,40 @@ class Gem::Indexer
end
##
- # Build various indices
+ # Abbreviate the spec for downloading. Abbreviated specs are only used for
+ # searching, downloading and related activities and do not need deployment
+ # specific information (e.g. list of files). So we abbreviate the spec,
+ # making it much smaller for quicker downloads.
+ #--
+ # TODO move to Gem::Specification
+
+ def abbreviate(spec)
+ spec.files = []
+ spec.test_files = []
+ spec.rdoc_options = []
+ spec.extra_rdoc_files = []
+ spec.cert_chain = []
+ spec
+ end
+
+ ##
+ # Build various indicies
+
+ def build_indicies
+ Gem::Specification.dirs = []
+ Gem::Specification.add_specs(*map_gems_to_specs(gem_file_list))
- def build_indices
- specs = map_gems_to_specs gem_file_list
- Gem::Specification._resort! specs
- build_marshal_gemspecs specs
- build_modern_indices specs if @build_modern
+ build_marshal_gemspecs
+ build_modern_indicies if @build_modern
- compress_indices
+ compress_indicies
end
##
# Builds Marshal quick index gemspecs.
- def build_marshal_gemspecs specs
- count = specs.count
+ def build_marshal_gemspecs
+ count = Gem::Specification.count { |s| not s.default_gem? }
progress = ui.progress_reporter count,
"Generating Marshal quick index gemspecs for #{count} gems",
"Complete"
@@ -117,7 +134,7 @@ class Gem::Indexer
files = []
Gem.time 'Generated Marshal quick index gemspecs' do
- specs.each do |spec|
+ Gem::Specification.each do |spec|
next if spec.default_gem?
spec_file_name = "#{spec.original_name}.gemspec.rz"
marshal_name = File.join @quick_marshal_dir, spec_file_name
@@ -169,14 +186,16 @@ class Gem::Indexer
end
##
- # Builds indices for RubyGems 1.2 and newer. Handles full, latest, prerelease
+ # Builds indicies for RubyGems 1.2 and newer. Handles full, latest, prerelease
+
+ def build_modern_indicies
+ specs = Gem::Specification.reject { |s| s.default_gem? }
- def build_modern_indices specs
prerelease, released = specs.partition { |s|
s.version.prerelease?
}
latest_specs =
- Gem::Specification._latest_specs specs
+ Gem::Specification.latest_specs.reject { |s| s.default_gem? }
build_modern_index(released.sort, @specs_index, 'specs')
build_modern_index(latest_specs.sort, @latest_specs_index, 'latest specs')
@@ -202,11 +221,21 @@ class Gem::Indexer
spec = Gem::Package.new(gemfile).spec
spec.loaded_from = gemfile
- spec.abbreviate
- spec.sanitize
+ # HACK: fuck this shit - borks all tests that use pl1
+ # if File.basename(gemfile, ".gem") != spec.original_name then
+ # exp = spec.full_name
+ # exp << " (#{spec.original_name})" if
+ # spec.original_name != spec.full_name
+ # msg = "Skipping misnamed gem: #{gemfile} should be named #{exp}"
+ # alert_warning msg
+ # next
+ # end
+
+ abbreviate spec
+ sanitize spec
spec
- rescue SignalException
+ rescue SignalException => e
alert_error "Received signal, exiting"
raise
rescue Exception => e
@@ -219,14 +248,14 @@ class Gem::Indexer
end
##
- # Compresses indices on disk
+ # Compresses indicies on disk
#--
# All future files should be compressed using gzip, not deflate
- def compress_indices
- say "Compressing indices"
+ def compress_indicies
+ say "Compressing indicies"
- Gem.time 'Compressed indices' do
+ Gem.time 'Compressed indicies' do
if @build_modern then
gzip @specs_index
gzip @latest_specs_index
@@ -274,12 +303,12 @@ class Gem::Indexer
end
##
- # Builds and installs indices.
+ # Builds and installs indicies.
def generate_index
make_temp_directories
- build_indices
- install_indices
+ build_indicies
+ install_indicies
rescue SignalException
ensure
FileUtils.rm_rf @directory
@@ -295,9 +324,9 @@ class Gem::Indexer
end
##
- # Install generated indices into the destination directory.
+ # Install generated indicies into the destination directory.
- def install_indices
+ def install_indicies
verbose = Gem.configuration.really_verbose
say "Moving index into production dir #{@dest_directory}" if verbose
@@ -352,6 +381,38 @@ class Gem::Indexer
end
##
+ # Sanitize the descriptive fields in the spec. Sometimes non-ASCII
+ # characters will garble the site index. Non-ASCII characters will
+ # be replaced by their XML entity equivalent.
+
+ def sanitize(spec)
+ spec.summary = sanitize_string(spec.summary)
+ spec.description = sanitize_string(spec.description)
+ spec.post_install_message = sanitize_string(spec.post_install_message)
+ spec.authors = spec.authors.collect { |a| sanitize_string(a) }
+
+ spec
+ end
+
+ ##
+ # Sanitize a single string.
+
+ def sanitize_string(string)
+ return string unless string
+
+ # HACK the #to_s is in here because RSpec has an Array of Arrays of
+ # Strings for authors. Need a way to disallow bad values on gemspec
+ # generation. (Probably won't happen.)
+ string = string.to_s
+
+ begin
+ Builder::XChar.encode string
+ rescue NameError, NoMethodError
+ string.to_xs
+ end
+ end
+
+ ##
# Perform an in-place update of the repository from newly added gems.
def update_index
@@ -374,7 +435,10 @@ class Gem::Indexer
specs = map_gems_to_specs updated_gems
prerelease, released = specs.partition { |s| s.version.prerelease? }
- files = build_marshal_gemspecs specs
+ Gem::Specification.dirs = []
+ Gem::Specification.add_specs(*specs)
+
+ files = build_marshal_gemspecs
Gem.time 'Updated indexes' do
update_specs_index released, @dest_specs_index, @specs_index
@@ -384,7 +448,7 @@ class Gem::Indexer
@prerelease_specs_index)
end
- compress_indices
+ compress_indicies
verbose = Gem.configuration.really_verbose
diff --git a/lib/rubygems/install_default_message.rb b/lib/rubygems/install_default_message.rb
index dc73fd962b..458ba3da96 100644
--- a/lib/rubygems/install_default_message.rb
+++ b/lib/rubygems/install_default_message.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'
diff --git a/lib/rubygems/install_message.rb b/lib/rubygems/install_message.rb
index 6880db583e..c1979c1549 100644
--- a/lib/rubygems/install_message.rb
+++ b/lib/rubygems/install_message.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index 26c5e84d1f..d3f55cd5ea 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -60,23 +59,6 @@ module Gem::InstallUpdateOptions
end
end
- add_option(:"Install/Update", '--build-root DIR',
- 'Temporary installation root. Useful for building',
- 'packages. Do not use this when installing remote gems.') do |value, options|
- options[:build_root] = File.expand_path(value)
- end
-
- add_option(:"Install/Update", '--vendor',
- 'Install gem into the vendor directory.',
- 'Only for use by gem repackagers.') do |value, options|
- unless Gem.vendor_dir then
- raise OptionParser::InvalidOption.new 'your platform is not supported'
- end
-
- options[:vendor] = true
- options[:install_dir] = Gem.vendor_dir
- end
-
add_option(:"Install/Update", '-N', '--no-document',
'Disable documentation generation') do |value, options|
options[:document] = []
@@ -174,11 +156,6 @@ module Gem::InstallUpdateOptions
"meet version requirements") do |value, options|
options[:minimal_deps] = true
end
-
- add_option(:"Install/Update", "--[no-]post-install-message",
- "Print post install message") do |value, options|
- options[:post_install_message] = value
- end
end
##
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 709b77d126..214652a241 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -40,9 +39,7 @@ class Gem::Installer
include Gem::UserInteraction
- ##
- # Filename of the gem being installed.
-
+ # DOC: Missing docs or :nodoc:.
attr_reader :gem
##
@@ -50,8 +47,6 @@ class Gem::Installer
attr_reader :bin_dir
- attr_reader :build_root # :nodoc:
-
##
# The gem repository the gem will be installed into
@@ -64,8 +59,6 @@ class Gem::Installer
@path_warning = false
- @install_lock = Mutex.new
-
class << self
##
@@ -73,19 +66,7 @@ class Gem::Installer
attr_accessor :path_warning
- ##
- # Certain aspects of the install process are not thread-safe. This lock is
- # used to allow multiple threads to install Gems at the same time.
-
- attr_reader :install_lock
-
- ##
- # Overrides the executable format.
- #
- # This is a sprintf format with a "%s" which will be replaced with the
- # executable name. It is based off the ruby executable name's difference
- # from "ruby".
-
+ # DOC: Missing docs or :nodoc:.
attr_writer :exec_format
# Defaults to use Ruby's program prefix and suffix.
@@ -96,46 +77,6 @@ class Gem::Installer
end
##
- # Construct an installer object for the gem file located at +path+
-
- def self.at path, options = {}
- security_policy = options[:security_policy]
- package = Gem::Package.new path, security_policy
- new package, options
- end
-
- class FakePackage
- attr_accessor :spec
-
- def initialize(spec)
- @spec = spec
- end
-
- def extract_files destination_dir, pattern = '*'
- FileUtils.mkdir_p destination_dir
-
- spec.files.each do |file|
- file = File.join destination_dir, file
- next if File.exist? file
- FileUtils.mkdir_p File.dirname(file)
- File.open file, 'w' do |fp| fp.puts "# #{file}" end
- end
- end
-
- def copy_to path
- end
- end
-
- ##
- # Construct an installer object for an ephemeral gem (one where we don't
- # actually have a .gem file, just a spec)
-
- def self.for_spec spec, options = {}
- # FIXME: we should have a real Package class for this
- new FakePackage.new(spec), options
- end
-
- ##
# Constructs an Installer instance that will install the gem located at
# +gem+. +options+ is a Hash with the following keys:
#
@@ -158,22 +99,17 @@ class Gem::Installer
# :build_args:: An Array of arguments to pass to the extension builder
# process. If not set, then Gem::Command.build_args is used
- def initialize(package, options={})
+ def initialize(gem, options={})
require 'fileutils'
+ @gem = gem
@options = options
- if package.is_a? String
- security_policy = options[:security_policy]
- @package = Gem::Package.new package, security_policy
- if $VERBOSE
- warn "constructing an Installer object with a string is deprecated. Please use Gem::Installer.at (called from: #{caller.first})"
- end
- else
- @package = package
- end
+ @package = Gem::Package.new @gem
process_options
+ @package.security_policy = @security_policy
+
if options[:user_install] and not options[:unpack] then
@gem_home = Gem.user_dir
@bin_dir = Gem.bindir gem_home unless options[:bin_dir]
@@ -213,13 +149,7 @@ class Gem::Installer
next unless io.gets =~ /This file was generated by RubyGems/
ruby_executable = true
- existing = io.read.slice(%r{
- ^(
- gem \s |
- load \s Gem\.bin_path\(
- )
- (['"])(.*?)(\2),
- }x, 3)
+ existing = io.read.slice(/^gem (['"])(.*?)(\1),/, 2)
end
return if spec.name == existing
@@ -227,7 +157,7 @@ class Gem::Installer
# somebody has written to RubyGems' directory, overwrite, too bad
return if Gem.default_bindir != @bin_dir and not ruby_executable
- question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup
+ question = "#{spec.name}'s executable \"#{filename}\" conflicts with "
if ruby_executable then
question << existing
@@ -258,7 +188,7 @@ class Gem::Installer
# Lazy accessor for the installer's spec.
def spec
- @package.spec
+ @spec ||= @package.spec
rescue Gem::Package::Error => e
raise Gem::InstallError, "invalid gem: #{e.message}"
end
@@ -277,8 +207,6 @@ class Gem::Installer
def install
pre_install_checks
- FileUtils.rm_f File.join gem_home, 'specifications', spec.spec_name
-
run_pre_install_hooks
# Completely remove any previous gem files
@@ -286,12 +214,12 @@ class Gem::Installer
FileUtils.mkdir_p gem_dir
+ spec.loaded_from = spec_file
+
if @options[:install_as_default]
- spec.loaded_from = default_spec_file
extract_bin
write_default_spec
else
- spec.loaded_from = spec_file
extract_files
build_extensions
@@ -303,9 +231,9 @@ class Gem::Installer
write_cache_file
end
- say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil?
+ say spec.post_install_message unless spec.post_install_message.nil?
- Gem::Installer.install_lock.synchronize { Gem::Specification.reset }
+ Gem::Specification.add_spec spec unless Gem::Specification.include? spec
run_post_install_hooks
@@ -383,7 +311,6 @@ class Gem::Installer
# True if the gems in the system satisfy +dependency+.
def installation_satisfies_dependency?(dependency)
- return true if @options[:development] and dependency.type == :development
return true if installed_specs.detect { |s| dependency.matches_spec? s }
return false if @only_install_dir
not dependency.matching_specs.empty?
@@ -398,7 +325,7 @@ class Gem::Installer
end
##
- # The location of the spec file that is installed.
+ # The location of of the spec file that is installed.
#
def spec_file
@@ -406,11 +333,11 @@ class Gem::Installer
end
##
- # The location of the default spec file for default gems.
+ # The location of of the default spec file for default gems.
#
def default_spec_file
- File.join Gem::Specification.default_specifications_dir, "#{spec.full_name}.gemspec"
+ File.join gem_home, "specifications/default", "#{spec.full_name}.gemspec"
end
##
@@ -448,11 +375,12 @@ class Gem::Installer
file.puts windows_stub_script(bindir, filename)
end
- verbose script_path
+ say script_path if Gem.configuration.really_verbose
end
end
- def generate_bin # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def generate_bin
return if spec.executables.nil? or spec.executables.empty?
Dir.mkdir @bin_dir unless File.exist? @bin_dir
@@ -468,8 +396,8 @@ class Gem::Installer
next
end
- mode = File.stat(bin_path).mode
- FileUtils.chmod mode | 0111, bin_path unless (mode | 0111) == mode
+ mode = File.stat(bin_path).mode | 0111
+ FileUtils.chmod mode, bin_path
check_executable_overwrite filename
@@ -498,7 +426,7 @@ class Gem::Installer
file.print app_script_text(filename)
end
- verbose bin_script_path
+ say bin_script_path if Gem.configuration.really_verbose
generate_windows_script filename, bindir
end
@@ -545,7 +473,7 @@ class Gem::Installer
#
def shebang(bin_file_name)
- ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
+ ruby_name = Gem::ConfigMap[:ruby_install_name] if @env_shebang
path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb") {|file| file.gets}
@@ -558,7 +486,7 @@ class Gem::Installer
if which = Gem.configuration[:custom_shebang]
# replace bin_file_name with "ruby" to avoid endless loops
- which = which.gsub(/ #{bin_file_name}$/," #{RbConfig::CONFIG['ruby_install_name']}")
+ which = which.gsub(/ #{bin_file_name}$/," #{Gem::ConfigMap[:ruby_install_name]}")
which = which.gsub(/\$(\w+)/) do
case $1
@@ -601,7 +529,8 @@ class Gem::Installer
end
end
- def ensure_required_ruby_version_met # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def ensure_required_ruby_version_met
if rrv = spec.required_ruby_version then
unless rrv.satisfied_by? Gem.ruby_version then
raise Gem::InstallError, "#{spec.name} requires Ruby version #{rrv}."
@@ -609,7 +538,8 @@ class Gem::Installer
end
end
- def ensure_required_rubygems_version_met # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def ensure_required_rubygems_version_met
if rrgv = spec.required_rubygems_version then
unless rrgv.satisfied_by? Gem.rubygems_version then
raise Gem::InstallError,
@@ -619,7 +549,8 @@ class Gem::Installer
end
end
- def ensure_dependencies_met # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def ensure_dependencies_met
deps = spec.runtime_dependencies
deps |= spec.development_dependencies if @development
@@ -628,13 +559,13 @@ class Gem::Installer
end
end
- def process_options # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def process_options
@options = {
:bin_dir => nil,
:env_shebang => false,
:force => false,
- :only_install_dir => false,
- :post_install_message => true
+ :only_install_dir => false
}.merge options
@env_shebang = options[:env_shebang]
@@ -643,6 +574,7 @@ class Gem::Installer
@gem_home = options[:install_dir] || Gem.dir
@ignore_dependencies = options[:ignore_dependencies]
@format_executable = options[:format_executable]
+ @security_policy = options[:security_policy]
@wrappers = options[:wrappers]
@only_install_dir = options[:only_install_dir]
@@ -651,20 +583,12 @@ class Gem::Installer
# (or use) a new bin dir under the gem_home.
@bin_dir = options[:bin_dir] || Gem.bindir(gem_home)
@development = options[:development]
- @build_root = options[:build_root]
@build_args = options[:build_args] || Gem::Command.build_args
-
- unless @build_root.nil?
- require 'pathname'
- @build_root = Pathname.new(@build_root).expand_path
- @bin_dir = File.join(@build_root, options[:bin_dir] || Gem.bindir(@gem_home))
- @gem_home = File.join(@build_root, @gem_home)
- alert_warning "You build with buildroot.\n Build root: #{@build_root}\n Bin dir: #{@bin_dir}\n Gem home: #{@gem_home}"
- end
end
- def check_that_user_bin_dir_is_in_path # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def check_that_user_bin_dir_is_in_path
user_bin_dir = @bin_dir || Gem.bindir(gem_home)
user_bin_dir = user_bin_dir.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if
File::ALT_SEPARATOR
@@ -675,29 +599,21 @@ class Gem::Installer
user_bin_dir = user_bin_dir.downcase
end
- path = path.split(File::PATH_SEPARATOR)
-
- unless path.include? user_bin_dir then
- unless !Gem.win_platform? && (path.include? user_bin_dir.sub(ENV['HOME'], '~'))
- unless self.class.path_warning then
- alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
- self.class.path_warning = true
- end
+ unless path.split(File::PATH_SEPARATOR).include? user_bin_dir then
+ unless self.class.path_warning then
+ alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
+ self.class.path_warning = true
end
end
end
- def verify_gem_home(unpack = false) # :nodoc:
+ # DOC: Missing docs or :nodoc:.
+ def verify_gem_home(unpack = false)
FileUtils.mkdir_p gem_home
raise Gem::FilePermissionError, gem_home unless
unpack or File.writable?(gem_home)
end
- def verify_spec_name
- return if spec.name =~ Gem::Specification::VALID_NAME_PATTERN
- raise Gem::InstallError, "#{spec} has an invalid name"
- end
-
##
# Return the text for an application file.
@@ -713,17 +629,18 @@ class Gem::Installer
require 'rubygems'
-version = "#{Gem::Requirement.default}.a"
+version = "#{Gem::Requirement.default}"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
- if str =~ /\\A_(.*)_\\z/ and Gem::Version.correct?($1) then
+ if str =~ /\\A_(.*)_\\z/
version = $1
ARGV.shift
end
end
+gem '#{spec.name}', version
load Gem.bin_path('#{spec.name}', '#{bin_file_name}', version)
TEXT
end
@@ -732,7 +649,7 @@ TEXT
# return the stub script text used to launch the true Ruby script
def windows_stub_script(bindir, bin_file_name)
- ruby = Gem.ruby.gsub(/^\"|\"$/, "").tr(File::SEPARATOR, "\\")
+ ruby = File.basename(Gem.ruby).chomp('"')
return <<-TEXT
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@@ -815,9 +732,12 @@ TEXT
def pre_install_checks
verify_gem_home options[:unpack]
- ensure_loadable_spec
+ # If we're forcing the install then disable security unless the security
+ # policy says that we only install signed gems.
+ @security_policy = nil if
+ @force and @security_policy and not @security_policy.only_signed
- verify_spec_name
+ ensure_loadable_spec
if options[:install_as_default]
Gem.ensure_default_gem_subdirectories gem_home
@@ -859,7 +779,9 @@ TEXT
def write_cache_file
cache_file = File.join gem_home, 'cache', spec.file_name
- @package.copy_to cache_file
+
+ FileUtils.cp @gem, cache_file unless File.exist? cache_file
end
end
+
diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb
index bdefedc9f6..62a468a8a2 100644
--- a/lib/rubygems/installer_test_case.rb
+++ b/lib/rubygems/installer_test_case.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems/installer'
@@ -57,6 +56,11 @@ class Gem::Installer
##
# Available through requiring rubygems/installer_test_case
+ attr_writer :spec
+
+ ##
+ # Available through requiring rubygems/installer_test_case
+
attr_writer :wrappers
end
@@ -102,8 +106,6 @@ class Gem::InstallerTestCase < Gem::TestCase
@installer = util_installer @spec, @gemhome
@user_installer = util_installer @user_spec, Gem.user_dir, :user
-
- Gem::Installer.path_warning = false
end
def util_gem_bindir spec = @spec # :nodoc:
@@ -177,7 +179,7 @@ class Gem::InstallerTestCase < Gem::TestCase
end
end
- @installer = Gem::Installer.at @gem
+ @installer = Gem::Installer.new @gem
end
##
@@ -185,7 +187,7 @@ class Gem::InstallerTestCase < Gem::TestCase
# +user+ is true a user-install will be performed.
def util_installer(spec, gem_home, user=false)
- Gem::Installer.at(spec.cache_file,
+ Gem::Installer.new(spec.cache_file,
:install_dir => gem_home,
:user_install => user)
end
diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb
index 597b87ea03..a1e106d9be 100644
--- a/lib/rubygems/local_remote_options.rb
+++ b/lib/rubygems/local_remote_options.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -24,7 +23,7 @@ module Gem::LocalRemoteOptions
raise OptionParser::InvalidArgument, value
end
- unless ['http', 'https', 'file', 's3'].include?(uri.scheme)
+ unless ['http', 'https', 'file'].include?(uri.scheme)
raise OptionParser::InvalidArgument, value
end
@@ -101,8 +100,8 @@ module Gem::LocalRemoteOptions
def add_source_option
accept_uri_http
- add_option(:"Local/Remote", '-s', '--source URL', URI::HTTP,
- 'Append URL to list of remote gem sources') do |source, options|
+ add_option(:"Local/Remote", '--source URL', URI::HTTP,
+ 'Add URL as a remote source for gems') do |source, options|
source << '/' if source !~ /\/\z/
diff --git a/lib/rubygems/mock_gem_ui.rb b/lib/rubygems/mock_gem_ui.rb
index 0223f8c35d..76a9389676 100644
--- a/lib/rubygems/mock_gem_ui.rb
+++ b/lib/rubygems/mock_gem_ui.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'stringio'
require 'rubygems/user_interaction'
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index 316329a0bd..f16ab369fa 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
#
# Represents a gem of name +name+ at +version+ of +platform+. These
@@ -54,7 +53,7 @@ class Gem::NameTuple
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{@platform}"
- end.dup.untaint
+ end
end
##
@@ -91,9 +90,7 @@ class Gem::NameTuple
alias to_s inspect # :nodoc:
def <=> other
- [@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1] <=>
- [other.name, other.version,
- other.platform == Gem::Platform::RUBY ? -1 : 1]
+ to_a <=> other.to_a
end
include Comparable
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index ab49ea2d2c..0ed6e1b91f 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: true
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
@@ -55,12 +54,10 @@ class Gem::Package
class FormatError < Error
attr_reader :path
- def initialize message, source = nil
- if source
- @path = source.path
+ def initialize message, path = nil
+ @path = path
- message = message + " in #{path}" if path
- end
+ message << " in #{path}" if path
super message
end
@@ -83,7 +80,6 @@ class Gem::Package
class TarInvalidError < Error; end
-
attr_accessor :build_time # :nodoc:
##
@@ -118,26 +114,19 @@ class Gem::Package
end
##
- # Creates a new Gem::Package for the file at +gem+. +gem+ can also be
- # provided as an IO object.
+ # Creates a new Gem::Package for the file at +gem+.
#
# If +gem+ is an existing file in the old format a Gem::Package::Old will be
# returned.
- def self.new gem, security_policy = nil
- gem = if gem.is_a?(Gem::Package::Source)
- gem
- elsif gem.respond_to? :read
- Gem::Package::IOSource.new gem
- else
- Gem::Package::FileSource.new gem
- end
-
+ def self.new gem
return super unless Gem::Package == self
- return super unless gem.present?
+ return super unless File.exist? gem
+
+ start = File.read gem, 20
- return super unless gem.start
- return super unless gem.start.include? 'MD5SUM ='
+ return super unless start
+ return super unless start.include? 'MD5SUM ='
Gem::Package::Old.new gem
end
@@ -145,7 +134,7 @@ class Gem::Package
##
# Creates a new package that will read or write to the file +gem+.
- def initialize gem, security_policy # :notnew:
+ def initialize gem # :notnew:
@gem = gem
@build_time = Time.now
@@ -153,20 +142,13 @@ class Gem::Package
@contents = nil
@digests = Hash.new { |h, algorithm| h[algorithm] = {} }
@files = nil
- @security_policy = security_policy
+ @security_policy = nil
@signatures = {}
@signer = nil
@spec = nil
end
##
- # Copies this package to +path+ (if possible)
-
- def copy_to path
- FileUtils.cp @gem.path, path unless File.exist? path
- end
-
- ##
# Adds a checksum for each entry in the gem to checksums.yaml.gz.
def add_checksums tar
@@ -208,11 +190,7 @@ class Gem::Package
def add_files tar # :nodoc:
@spec.files.each do |file|
- stat = File.lstat file
-
- if stat.symlink?
- tar.add_symlink file, File.readlink(file), stat.mode
- end
+ stat = File.stat file
next unless stat.file?
@@ -249,7 +227,7 @@ class Gem::Package
setup_signer
- @gem.with_write_io do |gem_io|
+ open @gem, 'wb' do |gem_io|
Gem::Package::TarWriter.new gem_io do |gem|
add_metadata gem
add_contents gem
@@ -277,7 +255,7 @@ EOM
@contents = []
- @gem.with_read_io do |io|
+ open @gem, 'rb' do |io|
gem_tar = Gem::Package::TarReader.new io
gem_tar.each do |entry|
@@ -334,7 +312,7 @@ EOM
FileUtils.mkdir_p destination_dir
- @gem.with_read_io do |io|
+ open @gem, 'rb' do |io|
reader = Gem::Package::TarReader.new io
reader.each do |entry|
@@ -378,14 +356,11 @@ EOM
FileUtils.mkdir_p mkdir, mkdir_options
- open destination, 'wb' do |out|
+ open destination, 'wb', entry.header.mode do |out|
out.write entry.read
- FileUtils.chmod entry.header.mode, destination
end if entry.file?
- File.symlink(entry.header.linkname, destination) if entry.symlink?
-
- verbose destination
+ say destination if Gem.configuration.really_verbose
end
end
end
@@ -466,7 +441,7 @@ EOM
@checksums = gem.seek 'checksums.yaml.gz' do |entry|
Zlib::GzipReader.wrap entry do |gz_io|
- Gem::SafeYAML.safe_load gz_io.read
+ YAML.load gz_io.read
end
end
end
@@ -515,7 +490,7 @@ EOM
@files = []
@spec = nil
- @gem.with_read_io do |io|
+ open @gem, 'rb' do |io|
Gem::Package::TarReader.new io do |reader|
read_checksums reader
@@ -617,11 +592,9 @@ EOM
end
require 'rubygems/package/digest_io'
-require 'rubygems/package/source'
-require 'rubygems/package/file_source'
-require 'rubygems/package/io_source'
require 'rubygems/package/old'
require 'rubygems/package/tar_header'
require 'rubygems/package/tar_reader'
require 'rubygems/package/tar_reader/entry'
require 'rubygems/package/tar_writer'
+
diff --git a/lib/rubygems/package/digest_io.rb b/lib/rubygems/package/digest_io.rb
index 4930c9aa7d..f8bde0f557 100644
--- a/lib/rubygems/package/digest_io.rb
+++ b/lib/rubygems/package/digest_io.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# IO wrapper that creates digests of contents written to the IO it wraps.
diff --git a/lib/rubygems/package/file_source.rb b/lib/rubygems/package/file_source.rb
deleted file mode 100644
index 1a4dc4c824..0000000000
--- a/lib/rubygems/package/file_source.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-##
-# The primary source of gems is a file on disk, including all usages
-# internal to rubygems.
-#
-# This is a private class, do not depend on it directly. Instead, pass a path
-# object to `Gem::Package.new`.
-
-class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all
-
- attr_reader :path
-
- def initialize path
- @path = path
- end
-
- def start
- @start ||= File.read path, 20
- end
-
- def present?
- File.exist? path
- end
-
- def with_write_io &block
- open path, 'wb', &block
- end
-
- def with_read_io &block
- open path, 'rb', &block
- end
-
-end
-
diff --git a/lib/rubygems/package/io_source.rb b/lib/rubygems/package/io_source.rb
deleted file mode 100644
index ee79a21083..0000000000
--- a/lib/rubygems/package/io_source.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-# frozen_string_literal: true
-##
-# Supports reading and writing gems from/to a generic IO object. This is
-# useful for other applications built on top of rubygems, such as
-# rubygems.org.
-#
-# This is a private class, do not depend on it directly. Instead, pass an IO
-# object to `Gem::Package.new`.
-
-class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all
-
- attr_reader :io
-
- def initialize io
- @io = io
- end
-
- def start
- @start ||= begin
- if io.pos > 0
- raise Gem::Package::Error, "Cannot read start unless IO is at start"
- end
-
- value = io.read 20
- io.rewind
- value
- end
- end
-
- def present?
- true
- end
-
- def with_read_io
- yield io
- end
-
- def with_write_io
- yield io
- end
-
- def path
- end
-
-end
-
diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb
index 071f7141ab..d74753fa90 100644
--- a/lib/rubygems/package/old.rb
+++ b/lib/rubygems/package/old.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -19,14 +18,14 @@ class Gem::Package::Old < Gem::Package
# Creates a new old-format package reader for +gem+. Old-format packages
# cannot be written.
- def initialize gem, security_policy
+ def initialize gem
require 'fileutils'
require 'zlib'
Gem.load_yaml
@contents = nil
@gem = gem
- @security_policy = security_policy
+ @security_policy = nil
@spec = nil
end
@@ -38,7 +37,7 @@ class Gem::Package::Old < Gem::Package
return @contents if @contents
- @gem.with_read_io do |io|
+ open @gem, 'rb' do |io|
read_until_dashes io # spec
header = file_list io
@@ -54,7 +53,7 @@ class Gem::Package::Old < Gem::Package
errstr = "Error reading files from gem"
- @gem.with_read_io do |io|
+ open @gem, 'rb' do |io|
read_until_dashes io # spec
header = file_list io
raise Gem::Exception, errstr unless header
@@ -64,7 +63,7 @@ class Gem::Package::Old < Gem::Package
destination = install_location full_name, destination_dir
- file_data = String.new
+ file_data = ''
read_until_dashes io do |line|
file_data << line
@@ -84,7 +83,7 @@ class Gem::Package::Old < Gem::Package
out.write file_data
end
- verbose destination
+ say destination if Gem.configuration.really_verbose
end
end
rescue Zlib::DataError
@@ -95,13 +94,13 @@ class Gem::Package::Old < Gem::Package
# Reads the file list section from the old-format gem +io+
def file_list io # :nodoc:
- header = String.new
+ header = ''
read_until_dashes io do |line|
header << line
end
- Gem::SafeYAML.safe_load header
+ YAML.load header
end
##
@@ -135,9 +134,9 @@ class Gem::Package::Old < Gem::Package
return @spec if @spec
- yaml = String.new
+ yaml = ''
- @gem.with_read_io do |io|
+ open @gem, 'rb' do |io|
skip_ruby io
read_until_dashes io do |line|
yaml << line
@@ -146,7 +145,7 @@ class Gem::Package::Old < Gem::Package
yaml_error = if RUBY_VERSION < '1.9' then
YAML::ParseError
- elsif YAML.const_defined?(:ENGINE) && YAML::ENGINE.yamler == 'syck' then
+ elsif YAML::ENGINE.yamler == 'syck' then
YAML::ParseError
else
YAML::SyntaxError
@@ -154,10 +153,10 @@ class Gem::Package::Old < Gem::Package
begin
@spec = Gem::Specification.from_yaml yaml
- rescue yaml_error
+ rescue yaml_error => e
raise Gem::Exception, "Failed to parse gem specification out of gem file"
end
- rescue ArgumentError
+ rescue ArgumentError => e
raise Gem::Exception, "Failed to parse gem specification out of gem file"
end
@@ -176,3 +175,4 @@ class Gem::Package::Old < Gem::Package
end
end
+
diff --git a/lib/rubygems/package/source.rb b/lib/rubygems/package/source.rb
deleted file mode 100644
index fe19776c38..0000000000
--- a/lib/rubygems/package/source.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: true
-class Gem::Package::Source # :nodoc:
-end
-
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
index c54bd14d57..28da1db0b5 100644
--- a/lib/rubygems/package/tar_header.rb
+++ b/lib/rubygems/package/tar_header.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: true
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
@@ -135,7 +134,7 @@ class Gem::Package::TarHeader
vals[:gid] ||= 0
vals[:mtime] ||= 0
vals[:checksum] ||= ""
- vals[:typeflag] = "0" if vals[:typeflag].nil? || vals[:typeflag].empty?
+ vals[:typeflag] ||= "0"
vals[:magic] ||= "ustar"
vals[:version] ||= "00"
vals[:uname] ||= "wheel"
@@ -227,3 +226,4 @@ class Gem::Package::TarHeader
end
end
+
diff --git a/lib/rubygems/package/tar_reader.rb b/lib/rubygems/package/tar_reader.rb
index 1098336e36..e257fdd846 100644
--- a/lib/rubygems/package/tar_reader.rb
+++ b/lib/rubygems/package/tar_reader.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: true
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
@@ -121,3 +120,4 @@ class Gem::Package::TarReader
end
require 'rubygems/package/tar_reader/entry'
+
diff --git a/lib/rubygems/package/tar_reader/entry.rb b/lib/rubygems/package/tar_reader/entry.rb
index 5f958edc2f..7034e59210 100644
--- a/lib/rubygems/package/tar_reader/entry.rb
+++ b/lib/rubygems/package/tar_reader/entry.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: true
#++
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
@@ -104,13 +103,6 @@ class Gem::Package::TarReader::Entry
end
##
- # Is this tar entry a symlink?
-
- def symlink?
- @header.typeflag == "2"
- end
-
- ##
# The position in the tar entry
def pos
@@ -137,8 +129,6 @@ class Gem::Package::TarReader::Entry
ret
end
- alias readpartial read # :nodoc:
-
##
# Rewinds to the beginning of the tar file entry
@@ -152,3 +142,4 @@ class Gem::Package::TarReader::Entry
end
end
+
diff --git a/lib/rubygems/package/tar_test_case.rb b/lib/rubygems/package/tar_test_case.rb
index 46ac949587..5253e32f36 100644
--- a/lib/rubygems/package/tar_test_case.rb
+++ b/lib/rubygems/package/tar_test_case.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems/package'
@@ -72,7 +71,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
SP(Z(to_oct(sum, 6)))
end
- def header(type, fname, dname, length, mode, mtime, checksum = nil, linkname = "")
+ def header(type, fname, dname, length, mode, mtime, checksum = nil)
checksum ||= " " * 8
arr = [ # struct tarfile_entry_posix
@@ -84,7 +83,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
Z(to_oct(mtime, 11)), # char mtime[12]; 0 padded, octal, null
checksum, # char checksum[8]; 0 padded, octal, null, space
type, # char typeflag[1]; file: "0" dir: "5"
- ASCIIZ(linkname, 100), # char linkname[100]; ASCII + (Z unless filled)
+ "\0" * 100, # char linkname[100]; ASCII + (Z unless filled)
"ustar\0", # char magic[6]; "ustar\0"
"00", # char version[2]; "00"
ASCIIZ("wheel", 32), # char uname[32]; ASCIIZ
@@ -118,12 +117,6 @@ class Gem::Package::TarTestCase < Gem::TestCase
header("0", fname, dname, length, mode, mtime, checksum)
end
- def tar_symlink_header(fname, prefix, mode, mtime, linkname)
- h = header("2", fname, prefix, 0, mode, mtime, nil, linkname)
- checksum = calc_checksum(h)
- header("2", fname, prefix, 0, mode, mtime, checksum, linkname)
- end
-
def to_oct(n, pad_size)
"%0#{pad_size}o" % n
end
@@ -140,8 +133,5 @@ class Gem::Package::TarTestCase < Gem::TestCase
util_entry tar_dir_header("foo", "bar", 0, Time.now)
end
- def util_symlink_entry
- util_entry tar_symlink_header("foo", "bar", 0, Time.now, "link")
- end
-
end
+
diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb
index ab0313c9f8..e1b38ad6b5 100644
--- a/lib/rubygems/package/tar_writer.rb
+++ b/lib/rubygems/package/tar_writer.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: true
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
@@ -235,25 +234,6 @@ class Gem::Package::TarWriter
end
##
- # Adds symlink +name+ with permissions +mode+, linking to +target+.
-
- def add_symlink(name, target, mode)
- check_closed
-
- name, prefix = split_name name
-
- header = Gem::Package::TarHeader.new(:name => name, :mode => mode,
- :size => 0, :typeflag => "2",
- :linkname => target,
- :prefix => prefix,
- :mtime => Time.now).to_s
-
- @io.write header
-
- self
- end
-
- ##
# Raises IOError if the TarWriter is closed
def check_closed
@@ -310,9 +290,7 @@ class Gem::Package::TarWriter
# Splits +name+ into a name and prefix that can fit in the TarHeader
def split_name(name) # :nodoc:
- if name.bytesize > 256
- raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
- end
+ raise Gem::Package::TooLongFileName if name.bytesize > 256
if name.bytesize <= 100 then
prefix = ""
@@ -330,12 +308,8 @@ class Gem::Package::TarWriter
prefix = (parts + [nxt]).join "/"
name = newname
- if name.bytesize > 100
- raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
- end
-
- if prefix.bytesize > 155 then
- raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long base path (should be 155 or less)")
+ if name.bytesize > 100 or prefix.bytesize > 155 then
+ raise Gem::Package::TooLongFileName
end
end
@@ -343,3 +317,4 @@ class Gem::Package::TarWriter
end
end
+
diff --git a/lib/rubygems/package_task.rb b/lib/rubygems/package_task.rb
index d554e3697b..09384cc0e7 100644
--- a/lib/rubygems/package_task.rb
+++ b/lib/rubygems/package_task.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
# Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel
#
# Permission is hereby granted, free of charge, to any person obtaining
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index afb559d472..2af303eecf 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
#
# Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings
@@ -44,6 +43,13 @@ class Gem::PathSupport
private
##
+ # Set the Gem home directory (as reported by Gem.dir).
+
+ def home=(home)
+ @home = home.to_s
+ end
+
+ ##
# Set the Gem search path (as reported by Gem.path).
def path=(gpaths)
@@ -59,9 +65,6 @@ class Gem::PathSupport
gem_path = gpaths.dup
else
gem_path = gpaths.split(Gem.path_separator)
- if gpaths.end_with?(Gem.path_separator)
- gem_path += default_path
- end
end
if File::ALT_SEPARATOR then
@@ -72,19 +75,13 @@ class Gem::PathSupport
gem_path << @home
else
- gem_path = default_path
+ gem_path = Gem.default_path + [@home]
+
+ if defined?(APPLE_GEM_HOME)
+ gem_path << APPLE_GEM_HOME
+ end
end
@path = gem_path.uniq
end
-
- # Return the default Gem path
- def default_path
- gem_path = Gem.default_path + [@home]
-
- if defined?(APPLE_GEM_HOME)
- gem_path << APPLE_GEM_HOME
- end
- gem_path
- end
end
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index d22d91ae54..e050959dc6 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require "rubygems/deprecate"
##
@@ -17,8 +16,8 @@ class Gem::Platform
attr_accessor :version
def self.local
- arch = RbConfig::CONFIG['arch']
- arch = "#{arch}_60" if arch =~ /mswin(?:32|64)$/
+ arch = Gem::ConfigMap[:arch]
+ arch = "#{arch}_60" if arch =~ /mswin32$/
@local ||= new(arch)
end
@@ -96,7 +95,6 @@ class Gem::Platform
[os, version]
when /netbsdelf/ then [ 'netbsdelf', nil ]
when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
- when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
# test
when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
@@ -149,8 +147,8 @@ class Gem::Platform
return nil unless Gem::Platform === other
# cpu
- ([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or
- (@cpu == 'arm' and other.cpu =~ /\Aarm/)) and
+ (@cpu == 'universal' or other.cpu == 'universal' or @cpu == other.cpu or
+ (@cpu == 'arm' and other.cpu =~ /\Aarm/)) and
# os
@os == other.os and
@@ -175,7 +173,6 @@ class Gem::Platform
when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
- when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
diff --git a/lib/rubygems/psych_additions.rb b/lib/rubygems/psych_additions.rb
index 1ddd74421c..0e4ebbd50c 100644
--- a/lib/rubygems/psych_additions.rb
+++ b/lib/rubygems/psych_additions.rb
@@ -1,5 +1,4 @@
-# frozen_string_literal: true
-# This exists just to satisfy bugs in marshal'd gemspecs that
+# This exists just to satify bugs in marshal'd gemspecs that
# contain a reference to YAML::PrivateType. We prune these out
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
diff --git a/lib/rubygems/psych_tree.rb b/lib/rubygems/psych_tree.rb
index 41a7314b53..e3f1d1a08a 100644
--- a/lib/rubygems/psych_tree.rb
+++ b/lib/rubygems/psych_tree.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
module Gem
if defined? ::Psych::Visitors
class NoAliasYAMLTree < Psych::Visitors::YAMLTree
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index 7043bd2a31..f16c8696f0 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'
require 'fileutils'
@@ -9,7 +8,7 @@ rescue Gem::LoadError
# swallow
else
# This will force any deps that 'rdoc' might have
- # (such as json) that are ambiguous to be activated, which
+ # (such as json) that are ambigious to be activated, which
# is important because we end up using Specification.reset
# and we don't want the warning it pops out.
Gem.finish_resolve
@@ -21,7 +20,7 @@ begin
require 'rdoc/rubygems_hook'
loaded_hook = true
module Gem
- RDoc = ::RDoc::RubygemsHook
+ RDoc = RDoc::RubygemsHook
end
rescue LoadError
end
@@ -194,7 +193,7 @@ class Gem::RDoc # :nodoc: all
::RDoc::Parser::C.reset
args = @spec.rdoc_options
- args.concat @spec.source_paths
+ args.concat @spec.require_paths
args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc]
@@ -264,7 +263,7 @@ class Gem::RDoc # :nodoc: all
Gem::Requirement.new('>= 2.4.0') =~ self.class.rdoc_version
r = new_rdoc
- verbose { "rdoc #{args.join ' '}" }
+ say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose
Dir.chdir @spec.full_gem_path do
begin
@@ -280,6 +279,7 @@ class Gem::RDoc # :nodoc: all
ui.errs.puts "... RDOC args: #{args.join(' ')}"
ui.backtrace ex
ui.errs.puts "(continuing with the rest of the installation)"
+ ensure
end
end
end
@@ -333,3 +333,4 @@ class Gem::RDoc # :nodoc: all
end unless loaded_hook
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
+
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 254bebfadf..c6816e8f0f 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
require 'rubygems'
require 'rubygems/request'
require 'rubygems/uri_formatter'
require 'rubygems/user_interaction'
-require 'rubygems/request/connection_pools'
require 'resolv'
##
@@ -52,8 +50,6 @@ class Gem::RemoteFetcher
@fetcher ||= self.new Gem.configuration[:http_proxy]
end
- attr_accessor :headers
-
##
# Initialize a remote fetcher using the source URI and possible proxy
# information.
@@ -67,11 +63,8 @@ class Gem::RemoteFetcher
#
# +dns+: An object to use for DNS resolution of the API endpoint.
# By default, use Resolv::DNS.
- #
- # +headers+: A set of additional HTTP headers to be sent to the server when
- # fetching the gem.
- def initialize(proxy=nil, dns=Resolv::DNS.new, headers={})
+ def initialize(proxy=nil, dns=Resolv::DNS.new)
require 'net/http'
require 'stringio'
require 'time'
@@ -80,12 +73,8 @@ class Gem::RemoteFetcher
Socket.do_not_reverse_lookup = true
@proxy = proxy
- @pools = {}
- @pool_lock = Mutex.new
- @cert_files = Gem::Request.get_cert_files
@dns = dns
- @headers = headers
end
##
@@ -98,17 +87,10 @@ class Gem::RemoteFetcher
begin
res = @dns.getresource "_rubygems._tcp.#{host}",
Resolv::DNS::Resource::IN::SRV
- rescue Resolv::ResolvError => e
- verbose "Getting SRV record failed: #{e}"
+ rescue Resolv::ResolvError
uri
else
- target = res.target.to_s.strip
-
- if URI("http://" + target).host.end_with?(".#{host}")
- return URI.parse "#{uri.scheme}://#{target}#{uri.path}"
- end
-
- uri
+ URI.parse "#{uri.scheme}://#{res.target}#{uri.path}"
end
end
@@ -117,7 +99,7 @@ class Gem::RemoteFetcher
# filename. Returns nil if the gem cannot be located.
#--
# Should probably be integrated with #download below, but that will be a
- # larger, more encompassing effort. -erikh
+ # larger, more emcompassing effort. -erikh
def download_to_cache dependency
found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
@@ -149,19 +131,11 @@ class Gem::RemoteFetcher
FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
- # Always escape URI's to deal with potential spaces and such
- # It should also be considered that source_uri may already be
- # a valid URI with escaped characters. e.g. "{DESede}" is encoded
- # as "%7BDESede%7D". If this is escaped again the percentage
- # symbols will be escaped.
- unless source_uri.is_a?(URI::Generic)
- begin
- source_uri = URI.parse(source_uri)
- rescue
- source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
- URI::DEFAULT_PARSER.escape(source_uri.to_s) :
- URI.escape(source_uri.to_s))
- end
+ # Always escape URI's to deal with potential spaces and such
+ unless URI::Generic === source_uri
+ source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
+ URI::DEFAULT_PARSER.escape(source_uri.to_s) :
+ URI.escape(source_uri.to_s))
end
scheme = source_uri.scheme
@@ -172,10 +146,11 @@ class Gem::RemoteFetcher
# REFACTOR: split this up and dispatch on scheme (eg download_http)
# REFACTOR: be sure to clean up fake fetcher when you do this... cleaner
case scheme
- when 'http', 'https', 's3' then
+ when 'http', 'https' then
unless File.exist? local_gem_path then
begin
- verbose "Downloading gem #{gem_file_name}"
+ say "Downloading gem #{gem_file_name}" if
+ Gem.configuration.really_verbose
remote_gem_path = source_uri + "gems/#{gem_file_name}"
@@ -185,7 +160,8 @@ class Gem::RemoteFetcher
alternate_name = "#{spec.original_name}.gem"
- verbose "Failed, downloading gem #{alternate_name}"
+ say "Failed, downloading gem #{alternate_name}" if
+ Gem.configuration.really_verbose
remote_gem_path = source_uri + "gems/#{alternate_name}"
@@ -204,7 +180,8 @@ class Gem::RemoteFetcher
local_gem_path = source_uri.to_s
end
- verbose "Using local gem #{local_gem_path}"
+ say "Using local gem #{local_gem_path}" if
+ Gem.configuration.really_verbose
when nil then # TODO test for local overriding cache
source_path = if Gem.win_platform? && source_uri.scheme &&
!source_uri.path.include?(':') then
@@ -222,7 +199,8 @@ class Gem::RemoteFetcher
local_gem_path = source_uri.to_s
end
- verbose "Using local gem #{local_gem_path}"
+ say "Using local gem #{local_gem_path}" if
+ Gem.configuration.really_verbose
else
raise ArgumentError, "unsupported URI scheme #{source_uri.scheme}"
end
@@ -242,13 +220,10 @@ class Gem::RemoteFetcher
def fetch_http uri, last_modified = nil, head = false, depth = 0
fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get
- response = request uri, fetch_type, last_modified do |req|
- headers.each { |k,v| req.add_field(k,v) }
- end
+ response = request uri, fetch_type, last_modified
case response
when Net::HTTPOK, Net::HTTPNotModified then
- response.uri = uri if response.respond_to? :uri
head ? response : response.body
when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
Net::HTTPTemporaryRedirect then
@@ -282,7 +257,7 @@ class Gem::RemoteFetcher
data = send "fetch_#{uri.scheme}", uri, mtime, head
- if data and !head and uri.to_s =~ /\.gz$/
+ if data and !head and uri.to_s =~ /gz$/
begin
data = Gem.gunzip data
rescue Zlib::GzipFile::Error
@@ -303,11 +278,6 @@ class Gem::RemoteFetcher
end
end
- def fetch_s3(uri, mtime = nil, head = false)
- public_uri = sign_s3_url(uri)
- fetch_https public_uri, mtime, head
- end
-
##
# Downloads +uri+ to +path+ if necessary. If no path is given, it just
# passes the data.
@@ -315,30 +285,19 @@ class Gem::RemoteFetcher
def cache_update_path uri, path = nil, update = true
mtime = path && File.stat(path).mtime rescue nil
- data = fetch_path(uri, mtime)
-
- if data == nil # indicates the server returned 304 Not Modified
- return Gem.read_binary(path)
- end
+ if mtime && Net::HTTPNotModified === fetch_path(uri, mtime, true)
+ Gem.read_binary(path)
+ else
+ data = fetch_path(uri)
- if update and path
- begin
+ if update and path then
open(path, 'wb') do |io|
- io.flock(File::LOCK_EX)
io.write data
end
- rescue Errno::ENOLCK # NFS
- if Thread.main != Thread.current
- raise
- else
- open(path, 'wb') do |io|
- io.write data
- end
- end
end
- end
- data
+ data
+ end
end
##
@@ -352,7 +311,7 @@ class Gem::RemoteFetcher
def correct_for_windows_path(path)
if path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
- path[1..-1]
+ path = path[1..-1]
else
path
end
@@ -364,10 +323,7 @@ class Gem::RemoteFetcher
# connections to reduce connect overhead.
def request(uri, request_class, last_modified = nil)
- proxy = proxy_for @proxy, uri
- pool = pools_for(proxy).pool_for uri
-
- request = Gem::Request.new uri, request_class, last_modified, pool
+ request = Gem::Request.new uri, request_class, last_modified, @proxy
request.fetch do |req|
yield req if block_given?
@@ -378,47 +334,5 @@ class Gem::RemoteFetcher
uri.scheme.downcase == 'https'
end
- def close_all
- @pools.each_value {|pool| pool.close_all}
- end
-
- protected
-
- # we have our own signing code here to avoid a dependency on the aws-sdk gem
- # fortunately, a simple GET request isn't too complex to sign properly
- def sign_s3_url(uri, expiration = nil)
- require 'base64'
- require 'openssl'
-
- unless uri.user && uri.password
- raise FetchError.new("credentials needed in s3 source, like s3://key:secret@bucket-name/", uri.to_s)
- end
-
- expiration ||= s3_expiration
- canonical_path = "/#{uri.host}#{uri.path}"
- payload = "GET\n\n\n#{expiration}\n#{canonical_path}"
- digest = OpenSSL::HMAC.digest('sha1', uri.password, payload)
- # URI.escape is deprecated, and there isn't yet a replacement that does quite what we want
- signature = Base64.encode64(digest).gsub("\n", '').gsub(/[\+\/=]/) { |c| BASE64_URI_TRANSLATE[c] }
- URI.parse("https://#{uri.host}.s3.amazonaws.com#{uri.path}?AWSAccessKeyId=#{uri.user}&Expires=#{expiration}&Signature=#{signature}")
- end
-
- def s3_expiration
- (Time.now + 3600).to_i # one hour from now
- end
-
- BASE64_URI_TRANSLATE = { '+' => '%2B', '/' => '%2F', '=' => '%3D' }.freeze
-
- private
-
- def proxy_for proxy, uri
- Gem::Request.proxy_uri(proxy || Gem::Request.get_proxy_from_env(uri.scheme))
- end
-
- def pools_for proxy
- @pool_lock.synchronize do
- @pools[proxy] ||= Gem::Request::ConnectionPools.new proxy, @cert_files
- end
- end
end
diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
index 7f2cb30e98..e8707630c5 100644
--- a/lib/rubygems/request.rb
+++ b/lib/rubygems/request.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'net/http'
require 'thread'
require 'time'
@@ -8,43 +7,35 @@ class Gem::Request
include Gem::UserInteraction
- ###
- # Legacy. This is used in tests.
- def self.create_with_proxy uri, request_class, last_modified, proxy # :nodoc:
- cert_files = get_cert_files
- proxy ||= get_proxy_from_env(uri.scheme)
- pool = ConnectionPools.new proxy_uri(proxy), cert_files
+ attr_reader :proxy_uri
- new(uri, request_class, last_modified, pool.pool_for(uri))
- end
-
- def self.proxy_uri proxy # :nodoc:
- case proxy
- when :no_proxy then nil
- when URI::HTTP then proxy
- else URI.parse(proxy)
- end
- end
-
- def initialize(uri, request_class, last_modified, pool)
+ def initialize(uri, request_class, last_modified, proxy)
@uri = uri
@request_class = request_class
@last_modified = last_modified
@requests = Hash.new 0
+ @connections = {}
+ @connections_mutex = Mutex.new
@user_agent = user_agent
- @connection_pool = pool
+ @proxy_uri =
+ case proxy
+ when :no_proxy then nil
+ when nil then get_proxy_from_env uri.scheme
+ when URI::HTTP then proxy
+ else URI.parse(proxy)
+ end
+ @env_no_proxy = get_no_proxy_from_env
end
- def proxy_uri; @connection_pool.proxy_uri; end
- def cert_files; @connection_pool.cert_files; end
-
- def self.get_cert_files
+ def add_rubygems_trusted_certs(store)
pattern = File.expand_path("./ssl_certs/*.pem", File.dirname(__FILE__))
- Dir.glob(pattern)
+ Dir.glob(pattern).each do |ssl_cert_file|
+ store.add_file ssl_cert_file
+ end
end
- def self.configure_connection_for_https(connection, cert_files)
+ def configure_connection_for_https(connection)
require 'net/https'
connection.use_ssl = true
connection.verify_mode =
@@ -57,19 +48,17 @@ class Gem::Request
connection.key = OpenSSL::PKey::RSA.new pem
end
- store.set_default_paths
- cert_files.each do |ssl_cert_file|
- store.add_file ssl_cert_file
- end
if Gem.configuration.ssl_ca_cert
if File.directory? Gem.configuration.ssl_ca_cert
store.add_path Gem.configuration.ssl_ca_cert
else
store.add_file Gem.configuration.ssl_ca_cert
end
+ else
+ store.set_default_paths
+ add_rubygems_trusted_certs(store)
end
connection.cert_store = store
- connection
rescue LoadError => e
raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
e.message =~ / -- openssl$/
@@ -83,7 +72,31 @@ class Gem::Request
# connection, using a proxy if needed.
def connection_for(uri)
- @connection_pool.checkout
+ net_http_args = [uri.host, uri.port]
+
+ if @proxy_uri and not no_proxy?(uri.host) then
+ net_http_args += [
+ @proxy_uri.host,
+ @proxy_uri.port,
+ Gem::UriFormatter.new(@proxy_uri.user).unescape,
+ Gem::UriFormatter.new(@proxy_uri.password).unescape,
+ ]
+ end
+
+ connection_id = [Thread.current.object_id, *net_http_args].join ':'
+
+ connection = @connections_mutex.synchronize do
+ @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
+ @connections[connection_id]
+ end
+
+ if https?(uri) and not connection.started? then
+ configure_connection_for_https(connection)
+ end
+
+ connection.start unless connection.started?
+
+ connection
rescue defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : Errno::EHOSTDOWN,
Errno::EHOSTDOWN => e
raise Gem::RemoteFetcher::FetchError.new(e.message, uri)
@@ -93,8 +106,7 @@ class Gem::Request
request = @request_class.new @uri.request_uri
unless @uri.nil? || @uri.user.nil? || @uri.user.empty? then
- request.basic_auth Gem::UriFormatter.new(@uri.user).unescape,
- Gem::UriFormatter.new(@uri.password).unescape
+ request.basic_auth @uri.user, @uri.password
end
request.add_field 'User-Agent', @user_agent
@@ -107,37 +119,6 @@ class Gem::Request
yield request if block_given?
- perform_request request
- end
-
- ##
- # Returns a proxy URI for the given +scheme+ if one is set in the
- # environment variables.
-
- def self.get_proxy_from_env scheme = 'http'
- _scheme = scheme.downcase
- _SCHEME = scheme.upcase
- env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
-
- no_env_proxy = env_proxy.nil? || env_proxy.empty?
-
- return get_proxy_from_env 'http' if no_env_proxy and _scheme != 'http'
- return :no_proxy if no_env_proxy
-
- uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
-
- if uri and uri.user.nil? and uri.password.nil? then
- user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"]
- password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"]
-
- uri.user = Gem::UriFormatter.new(user).escape
- uri.password = Gem::UriFormatter.new(password).escape
- end
-
- uri
- end
-
- def perform_request request # :nodoc:
connection = connection_for @uri
retried = false
@@ -146,7 +127,8 @@ class Gem::Request
begin
@requests[connection.object_id] += 1
- verbose "#{request.method} #{@uri}"
+ say "#{request.method} #{@uri}" if
+ Gem.configuration.really_verbose
file_name = File.basename(@uri.path)
# perform download progress reporter only for gems
@@ -156,7 +138,7 @@ class Gem::Request
if Net::HTTPOK === incomplete_response
reporter.fetch(file_name, incomplete_response.content_length)
downloaded = 0
- data = String.new
+ data = ''
incomplete_response.read_body do |segment|
data << segment
@@ -175,10 +157,11 @@ class Gem::Request
response = connection.request request
end
- verbose "#{response.code} #{response.message}"
+ say "#{response.code} #{response.message}" if
+ Gem.configuration.really_verbose
rescue Net::HTTPBadResponse
- verbose "bad response"
+ say "bad response" if Gem.configuration.really_verbose
reset connection
@@ -186,10 +169,6 @@ class Gem::Request
bad_response = true
retry
- rescue Net::HTTPFatalError
- verbose "fatal error"
-
- raise Gem::RemoteFetcher::FetchError.new('fatal error', @uri)
# HACK work around EOFError bug in Net::HTTP
# NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
# to install gems.
@@ -197,7 +176,8 @@ class Gem::Request
Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE
requests = @requests[connection.object_id]
- verbose "connection reset after #{requests} requests, retrying"
+ say "connection reset after #{requests} requests, retrying" if
+ Gem.configuration.really_verbose
raise Gem::RemoteFetcher::FetchError.new('too many connection resets', @uri) if retried
@@ -208,8 +188,57 @@ class Gem::Request
end
response
- ensure
- @connection_pool.checkin connection
+ end
+
+ ##
+ # Returns list of no_proxy entries (if any) from the environment
+
+ def get_no_proxy_from_env
+ env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
+
+ return [] if env_no_proxy.nil? or env_no_proxy.empty?
+
+ env_no_proxy.split(/\s*,\s*/)
+ end
+
+ ##
+ # Returns a proxy URI for the given +scheme+ if one is set in the
+ # environment variables.
+
+ def get_proxy_from_env scheme = 'http'
+ _scheme = scheme.downcase
+ _SCHEME = scheme.upcase
+ env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
+
+ no_env_proxy = env_proxy.nil? || env_proxy.empty?
+
+ return get_proxy_from_env 'http' if no_env_proxy and _scheme != 'http'
+ return nil if no_env_proxy
+
+ uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
+
+ if uri and uri.user.nil? and uri.password.nil? then
+ user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"]
+ password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"]
+
+ uri.user = Gem::UriFormatter.new(user).escape
+ uri.password = Gem::UriFormatter.new(password).escape
+ end
+
+ uri
+ end
+
+ def https?(uri)
+ uri.scheme.downcase == 'https'
+ end
+
+ def no_proxy? host
+ host = host.downcase
+ @env_no_proxy.each do |pattern|
+ pattern = pattern.downcase
+ return true if host[-pattern.length, pattern.length ] == pattern
+ end
+ return false
end
##
@@ -223,7 +252,7 @@ class Gem::Request
end
def user_agent
- ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}".dup
+ ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}"
ruby_version = RUBY_VERSION
ruby_version += 'dev' if RUBY_PATCHLEVEL == -1
@@ -243,6 +272,3 @@ class Gem::Request
end
-require 'rubygems/request/http_pool'
-require 'rubygems/request/https_pool'
-require 'rubygems/request/connection_pools'
diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb
deleted file mode 100644
index 31fc609800..0000000000
--- a/lib/rubygems/request/connection_pools.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# frozen_string_literal: true
-require 'thread'
-
-class Gem::Request::ConnectionPools # :nodoc:
-
- @client = Net::HTTP
-
- class << self
- attr_accessor :client
- end
-
- def initialize proxy_uri, cert_files
- @proxy_uri = proxy_uri
- @cert_files = cert_files
- @pools = {}
- @pool_mutex = Mutex.new
- end
-
- def pool_for uri
- http_args = net_http_args(uri, @proxy_uri)
- key = http_args + [https?(uri)]
- @pool_mutex.synchronize do
- @pools[key] ||=
- if https? uri then
- Gem::Request::HTTPSPool.new(http_args, @cert_files, @proxy_uri)
- else
- Gem::Request::HTTPPool.new(http_args, @cert_files, @proxy_uri)
- end
- end
- end
-
- def close_all
- @pools.each_value {|pool| pool.close_all}
- end
-
- private
-
- ##
- # Returns list of no_proxy entries (if any) from the environment
-
- def get_no_proxy_from_env
- env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
-
- return [] if env_no_proxy.nil? or env_no_proxy.empty?
-
- env_no_proxy.split(/\s*,\s*/)
- end
-
- def https? uri
- uri.scheme.downcase == 'https'
- end
-
- def no_proxy? host, env_no_proxy
- host = host.downcase
-
- env_no_proxy.any? do |pattern|
- pattern = pattern.downcase
-
- host[-pattern.length, pattern.length] == pattern or
- (pattern.start_with? '.' and pattern[1..-1] == host)
- end
- end
-
- def net_http_args uri, proxy_uri
- # URI::Generic#hostname was added in ruby 1.9.3, use it if exists, otherwise
- # don't support IPv6 literals and use host.
- hostname = uri.respond_to?(:hostname) ? uri.hostname : uri.host
- net_http_args = [hostname, uri.port]
-
- no_proxy = get_no_proxy_from_env
-
- if proxy_uri and not no_proxy?(hostname, no_proxy) then
- proxy_hostname = proxy_uri.respond_to?(:hostname) ? proxy_uri.hostname : proxy_uri.host
- net_http_args + [
- proxy_hostname,
- proxy_uri.port,
- Gem::UriFormatter.new(proxy_uri.user).unescape,
- Gem::UriFormatter.new(proxy_uri.password).unescape,
- ]
- elsif no_proxy? hostname, no_proxy then
- net_http_args + [nil, nil]
- else
- net_http_args
- end
- end
-
-end
-
diff --git a/lib/rubygems/request/http_pool.rb b/lib/rubygems/request/http_pool.rb
deleted file mode 100644
index bfcd15399d..0000000000
--- a/lib/rubygems/request/http_pool.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# frozen_string_literal: true
-##
-# A connection "pool" that only manages one connection for now. Provides
-# thread safe `checkout` and `checkin` methods. The pool consists of one
-# connection that corresponds to `http_args`. This class is private, do not
-# use it.
-
-class Gem::Request::HTTPPool # :nodoc:
- attr_reader :cert_files, :proxy_uri
-
- def initialize http_args, cert_files, proxy_uri
- @http_args = http_args
- @cert_files = cert_files
- @proxy_uri = proxy_uri
- @queue = SizedQueue.new 1
- @queue << nil
- end
-
- def checkout
- @queue.pop || make_connection
- end
-
- def checkin connection
- @queue.push connection
- end
-
- def close_all
- until @queue.empty?
- if connection = @queue.pop(true) and connection.started?
- connection.finish
- end
- end
- @queue.push(nil)
- end
-
- private
-
- def make_connection
- setup_connection Gem::Request::ConnectionPools.client.new(*@http_args)
- end
-
- def setup_connection connection
- connection.start
- connection
- end
-
-end
-
diff --git a/lib/rubygems/request/https_pool.rb b/lib/rubygems/request/https_pool.rb
deleted file mode 100644
index e82c2440e1..0000000000
--- a/lib/rubygems/request/https_pool.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-class Gem::Request::HTTPSPool < Gem::Request::HTTPPool # :nodoc:
- private
-
- def setup_connection connection
- Gem::Request.configure_connection_for_https(connection, @cert_files)
- super
- end
-end
-
-
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index 5541e64b88..d91a39cb22 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -1,4 +1,8 @@
-# frozen_string_literal: true
+require 'rubygems'
+require 'rubygems/dependency'
+require 'rubygems/dependency_list'
+require 'rubygems/installer'
+require 'rubygems/resolver'
require 'tsort'
##
@@ -21,48 +25,18 @@ class Gem::RequestSet
##
# Array of gems to install even if already installed
- attr_accessor :always_install
+ attr_reader :always_install
attr_reader :dependencies
attr_accessor :development
##
- # Errors fetching gems during resolution.
-
- attr_reader :errors
-
- ##
- # Set to true if you want to install only direct development dependencies.
-
- attr_accessor :development_shallow
-
- ##
# The set of git gems imported via load_gemdeps.
attr_reader :git_set # :nodoc:
##
- # When true, dependency resolution is not performed, only the requested gems
- # are installed.
-
- attr_accessor :ignore_dependencies
-
- attr_reader :install_dir # :nodoc:
-
- ##
- # If true, allow dependencies to match prerelease gems.
-
- attr_accessor :prerelease
-
- ##
- # When false no remote sets are used for resolving gems.
-
- attr_accessor :remote
-
- attr_reader :resolver # :nodoc:
-
- ##
# Sets used for resolution
attr_reader :sets # :nodoc:
@@ -78,11 +52,6 @@ class Gem::RequestSet
attr_reader :vendor_set # :nodoc:
##
- # The set of source gems imported via load_gemdeps.
-
- attr_reader :source_set
-
- ##
# Creates a RequestSet for a list of Gem::Dependency objects, +deps+. You
# can then #resolve and #install the resolved list of dependencies.
#
@@ -94,24 +63,16 @@ class Gem::RequestSet
def initialize *deps
@dependencies = deps
- @always_install = []
- @conservative = false
- @dependency_names = {}
- @development = false
- @development_shallow = false
- @errors = []
- @git_set = nil
- @ignore_dependencies = false
- @install_dir = Gem.dir
- @prerelease = false
- @remote = true
- @requests = []
- @sets = []
- @soft_missing = false
- @sorted = nil
- @specs = nil
- @vendor_set = nil
- @source_set = nil
+ @always_install = []
+ @dependency_names = {}
+ @development = false
+ @git_set = nil
+ @requests = []
+ @sets = []
+ @soft_missing = false
+ @sorted = nil
+ @specs = nil
+ @vendor_set = nil
yield self if block_given?
end
@@ -123,7 +84,7 @@ class Gem::RequestSet
if dep = @dependency_names[name] then
dep.requirement.concat reqs
else
- dep = Gem::Dependency.new name, *reqs
+ dep = Gem::Dependency.new name, reqs
@dependency_names[name] = dep
@dependencies << dep
end
@@ -145,13 +106,12 @@ class Gem::RequestSet
def install options, &block # :yields: request, installer
if dir = options[:install_dir]
- requests = install_into dir, false, options, &block
- return requests
+ return install_into dir, false, options, &block
end
- @prerelease = options[:prerelease]
+ cache_dir = options[:cache_dir] || Gem.dir
- requests = []
+ specs = []
sorted_requests.each do |req|
if req.installed? then
@@ -163,33 +123,16 @@ class Gem::RequestSet
end
end
- spec = req.spec.install options do |installer|
- yield req, installer if block_given?
- end
+ path = req.download cache_dir
- requests << spec
- end
+ inst = Gem::Installer.new path, options
- return requests if options[:gemdeps]
+ yield req, inst if block_given?
- specs = requests.map do |request|
- case request
- when Gem::Resolver::ActivationRequest then
- request.spec.spec
- else
- request
- end
+ specs << inst.install
end
- require 'rubygems/dependency_installer'
- inst = Gem::DependencyInstaller.new options
- inst.installed_gems.replace specs
-
- Gem.done_installing_hooks.each do |hook|
- hook.call inst, specs
- end unless Gem.done_installing_hooks.empty?
-
- requests
+ specs
end
##
@@ -200,43 +143,22 @@ class Gem::RequestSet
# dependencies file are not used. See Gem::Installer for other +options+.
def install_from_gemdeps options, &block
- gemdeps = options[:gemdeps]
-
- @install_dir = options[:install_dir] || Gem.dir
- @prerelease = options[:prerelease]
- @remote = options[:domain] != :local
- @conservative = true if options[:conservative]
-
- gem_deps_api = load_gemdeps gemdeps, options[:without_groups], true
+ load_gemdeps options[:gemdeps], options[:without_groups]
resolve
if options[:explain]
puts "Gems to install:"
- sorted_requests.each do |spec|
- puts " #{spec.full_name}"
- end
-
- if Gem.configuration.really_verbose
- @resolver.stats.display
+ specs.map { |s| s.full_name }.sort.each do |s|
+ puts " #{s}"
end
else
- installed = install options, &block
-
- if options.fetch :lock, true then
- lockfile =
- Gem::RequestSet::Lockfile.build self, gemdeps, gem_deps_api.dependencies
- lockfile.write
- end
-
- installed
+ install options, &block
end
end
def install_into dir, force = true, options = {}
- gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir
-
existing = force ? [] : specs_in(dir)
existing.delete_if { |s| @always_install.include? s }
@@ -244,97 +166,46 @@ class Gem::RequestSet
installed = []
- options[:development] = false
- options[:install_dir] = dir
- options[:only_install_dir] = true
- @prerelease = options[:prerelease]
+ sorted_requests.each do |req|
+ if existing.find { |s| s.full_name == req.spec.full_name }
+ yield req, nil if block_given?
+ next
+ end
- sorted_requests.each do |request|
- spec = request.spec
+ path = req.download(dir)
- if existing.find { |s| s.full_name == spec.full_name } then
- yield request, nil if block_given?
+ unless path then # already installed
+ yield req, nil if block_given?
next
end
- spec.install options do |installer|
- yield request, installer if block_given?
- end
+ options[:install_dir] = dir
+ options[:only_install_dir] = true
+
+ inst = Gem::Installer.new path, options
+
+ yield req, inst if block_given?
- installed << request
+ inst.install
+
+ installed << req
end
installed
- ensure
- ENV['GEM_HOME'] = gem_home
end
##
# Load a dependency management file.
- def load_gemdeps path, without_groups = [], installing = false
+ def load_gemdeps path, without_groups = []
@git_set = Gem::Resolver::GitSet.new
@vendor_set = Gem::Resolver::VendorSet.new
- @source_set = Gem::Resolver::SourceSet.new
-
- @git_set.root_dir = @install_dir
-
- lock_file = "#{File.expand_path(path)}.lock".dup.untaint
- begin
- tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file
- parser = tokenizer.make_parser self, []
- parser.parse
- rescue Errno::ENOENT
- end
gf = Gem::RequestSet::GemDependencyAPI.new self, path
- gf.installing = installing
gf.without_groups = without_groups if without_groups
gf.load
end
- def pretty_print q # :nodoc:
- q.group 2, '[RequestSet:', ']' do
- q.breakable
-
- if @remote then
- q.text 'remote'
- q.breakable
- end
-
- if @prerelease then
- q.text 'prerelease'
- q.breakable
- end
-
- if @development_shallow then
- q.text 'shallow development'
- q.breakable
- elsif @development then
- q.text 'development'
- q.breakable
- end
-
- if @soft_missing then
- q.text 'soft missing'
- end
-
- q.group 2, '[dependencies:', ']' do
- q.breakable
- @dependencies.map do |dep|
- q.text dep.to_s
- q.breakable
- end
- end
-
- q.breakable
- q.text 'sets:'
-
- q.breakable
- q.pp @sets.map { |set| set.class }
- end
- end
-
##
# Resolve the requested dependencies and return an Array of Specification
# objects to be activated.
@@ -343,33 +214,14 @@ class Gem::RequestSet
@sets << set
@sets << @git_set
@sets << @vendor_set
- @sets << @source_set
set = Gem::Resolver.compose_sets(*@sets)
- set.remote = @remote
- set.prerelease = @prerelease
resolver = Gem::Resolver.new @dependencies, set
- resolver.development = @development
- resolver.development_shallow = @development_shallow
- resolver.ignore_dependencies = @ignore_dependencies
- resolver.soft_missing = @soft_missing
-
- if @conservative
- installed_gems = {}
- Gem::Specification.find_all do |spec|
- (installed_gems[spec.name] ||= []) << spec
- end
- resolver.skip_gems = installed_gems
- end
-
- @resolver = resolver
+ resolver.development = @development
+ resolver.soft_missing = @soft_missing
@requests = resolver.resolve
-
- @errors = set.errors
-
- @requests
end
##
@@ -402,23 +254,20 @@ class Gem::RequestSet
node.spec.dependencies.each do |dep|
next if dep.type == :development and not @development
- match = @requests.find { |r|
- dep.match? r.spec.name, r.spec.version, @prerelease
- }
-
- unless match then
- next if dep.type == :development and @development_shallow
- next if @soft_missing
- raise Gem::DependencyError,
- "Unresolved dependency found during sorting - #{dep} (requested by #{node.spec.full_name})"
+ match = @requests.find { |r| dep.match? r.spec.name, r.spec.version }
+ if match
+ begin
+ yield match
+ rescue TSort::Cyclic
+ end
+ else
+ unless @soft_missing
+ raise Gem::DependencyError, "Unresolved dependency found during sorting - #{dep} (requested by #{node.spec.full_name})"
+ end
end
-
- yield match
end
end
end
require 'rubygems/request_set/gem_dependency_api'
-require 'rubygems/request_set/lockfile'
-require 'rubygems/request_set/lockfile/tokenizer'
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index 4b2699d7d2..0c27b1a61a 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -1,34 +1,5 @@
-# frozen_string_literal: true
##
-# A semi-compatible DSL for the Bundler Gemfile and Isolate gem dependencies
-# files.
-#
-# To work with both the Bundler Gemfile and Isolate formats this
-# implementation takes some liberties to allow compatibility with each, most
-# notably in #source.
-#
-# A basic gem dependencies file will look like the following:
-#
-# source 'https://rubygems.org'
-#
-# gem 'rails', '3.2.14a
-# gem 'devise', '~> 2.1', '>= 2.1.3'
-# gem 'cancan'
-# gem 'airbrake'
-# gem 'pg'
-#
-# RubyGems recommends saving this as gem.deps.rb over Gemfile or Isolate.
-#
-# To install the gems in this Gemfile use `gem install -g` to install it and
-# create a lockfile. The lockfile will ensure that when you make changes to
-# your gem dependencies file a minimum amount of change is made to the
-# dependencies of your gems.
-#
-# RubyGems can activate all the gems in your dependencies file at startup
-# using the RUBYGEMS_GEMDEPS environment variable or through Gem.use_gemdeps.
-# See Gem.use_gemdeps for details and warnings.
-#
-# See `gem help install` and `gem help gem_dependencies` for further details.
+# A semi-compatible DSL for the Bundler Gemfile and Isolate formats.
class Gem::RequestSet::GemDependencyAPI
@@ -50,8 +21,6 @@ class Gem::RequestSet::GemDependencyAPI
:ruby_21 => %w[ruby rbx maglev],
}
- mswin = Gem::Platform.new 'x86-mswin32'
- mswin64 = Gem::Platform.new 'x64-mswin64'
x86_mingw = Gem::Platform.new 'x86-mingw32'
x64_mingw = Gem::Platform.new 'x64-mingw32'
@@ -70,15 +39,7 @@ class Gem::RequestSet::GemDependencyAPI
:mri_19 => Gem::Platform::RUBY,
:mri_20 => Gem::Platform::RUBY,
:mri_21 => Gem::Platform::RUBY,
- :mswin => mswin,
- :mswin_18 => mswin,
- :mswin_19 => mswin,
- :mswin_20 => mswin,
- :mswin_21 => mswin,
- :mswin64 => mswin64,
- :mswin64_19 => mswin64,
- :mswin64_20 => mswin64,
- :mswin64_21 => mswin64,
+ :mswin => Gem::Platform::RUBY,
:rbx => Gem::Platform::RUBY,
:ruby => Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY,
@@ -112,14 +73,6 @@ class Gem::RequestSet::GemDependencyAPI
:mri_20 => tilde_gt_2_0_0,
:mri_21 => tilde_gt_2_1_0,
:mswin => gt_eq_0,
- :mswin_18 => tilde_gt_1_8_0,
- :mswin_19 => tilde_gt_1_9_0,
- :mswin_20 => tilde_gt_2_0_0,
- :mswin_21 => tilde_gt_2_1_0,
- :mswin64 => gt_eq_0,
- :mswin64_19 => tilde_gt_1_9_0,
- :mswin64_20 => tilde_gt_2_0_0,
- :mswin64_21 => tilde_gt_2_1_0,
:rbx => gt_eq_0,
:ruby => gt_eq_0,
:ruby_18 => tilde_gt_1_8_0,
@@ -143,14 +96,6 @@ class Gem::RequestSet::GemDependencyAPI
:mri_20 => :never,
:mri_21 => :never,
:mswin => :only,
- :mswin_18 => :only,
- :mswin_19 => :only,
- :mswin_20 => :only,
- :mswin_21 => :only,
- :mswin64 => :only,
- :mswin64_19 => :only,
- :mswin64_20 => :only,
- :mswin64_21 => :only,
:rbx => :never,
:ruby => :never,
:ruby_18 => :never,
@@ -163,11 +108,6 @@ class Gem::RequestSet::GemDependencyAPI
}
##
- # The gems required by #gem statements in the gem.deps.rb file
-
- attr_reader :dependencies
-
- ##
# A set of gems that are loaded via the +:git+ option to #gem
attr_reader :git_set # :nodoc:
@@ -175,7 +115,7 @@ class Gem::RequestSet::GemDependencyAPI
##
# A Hash containing gem names and files to require from those gems.
- attr_reader :requires
+ attr_reader :requires # :nodoc:
##
# A set of gems that are loaded via the +:path+ option to #gem
@@ -196,32 +136,14 @@ class Gem::RequestSet::GemDependencyAPI
@path = path
@current_groups = nil
- @current_platforms = nil
+ @current_platform = nil
@current_repository = nil
- @dependencies = {}
@default_sources = true
@git_set = @set.git_set
- @git_sources = {}
- @installing = false
@requires = Hash.new { |h, name| h[name] = [] }
@vendor_set = @set.vendor_set
- @source_set = @set.source_set
@gem_sources = {}
@without_groups = []
-
- git_source :github do |repo_name|
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include? "/"
-
- "git://github.com/#{repo_name}.git"
- end
-
- git_source :bitbucket do |repo_name|
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include? "/"
-
- user, = repo_name.split "/", 2
-
- "https://#{user}@bitbucket.org/#{repo_name}.git"
- end
end
##
@@ -265,26 +187,14 @@ class Gem::RequestSet::GemDependencyAPI
end
##
- # Changes the behavior of gem dependency file loading to installing mode.
- # In installing mode certain restrictions are ignored such as ruby version
- # mismatch checks.
-
- def installing= installing # :nodoc:
- @installing = installing
- end
-
- ##
- # Loads the gem dependency file and returns self.
+ # Loads the gem dependency file
def load
instance_eval File.read(@path).untaint, @path, 1
-
- self
end
##
# :category: Gem Dependencies DSL
- #
# :call-seq:
# gem(name)
# gem(name, *requirements)
@@ -292,66 +202,6 @@ class Gem::RequestSet::GemDependencyAPI
#
# Specifies a gem dependency with the given +name+ and +requirements+. You
# may also supply +options+ following the +requirements+
- #
- # +options+ include:
- #
- # require: ::
- # RubyGems does not provide any autorequire features so requires in a gem
- # dependencies file are recorded but ignored.
- #
- # In bundler the require: option overrides the file to require during
- # Bundler.require. By default the name of the dependency is required in
- # Bundler. A single file or an Array of files may be given.
- #
- # To disable requiring any file give +false+:
- #
- # gem 'rake', require: false
- #
- # group: ::
- # Place the dependencies in the given dependency group. A single group or
- # an Array of groups may be given.
- #
- # See also #group
- #
- # platform: ::
- # Only install the dependency on the given platform. A single platform or
- # an Array of platforms may be given.
- #
- # See #platform for a list of platforms available.
- #
- # path: ::
- # Install this dependency from an unpacked gem in the given directory.
- #
- # gem 'modified_gem', path: 'vendor/modified_gem'
- #
- # git: ::
- # Install this dependency from a git repository:
- #
- # gem 'private_gem', git: git@my.company.example:private_gem.git'
- #
- # gist: ::
- # Install this dependency from the gist ID:
- #
- # gem 'bang', gist: '1232884'
- #
- # github: ::
- # Install this dependency from a github git repository:
- #
- # gem 'private_gem', github: 'my_company/private_gem'
- #
- # submodules: ::
- # Set to +true+ to include submodules when fetching the git repository for
- # git:, gist: and github: dependencies.
- #
- # ref: ::
- # Use the given commit name or SHA for git:, gist: and github:
- # dependencies.
- #
- # branch: ::
- # Use the given branch for git:, gist: and github: dependencies.
- #
- # tag: ::
- # Use the given tag for git:, gist: and github: dependencies.
def gem name, *requirements
options = requirements.pop if requirements.last.kind_of?(Hash)
@@ -361,21 +211,9 @@ class Gem::RequestSet::GemDependencyAPI
source_set = false
- source_set ||= gem_path name, options
- source_set ||= gem_git name, options
- source_set ||= gem_git_source name, options
- source_set ||= gem_source name, options
-
- duplicate = @dependencies.include? name
-
- @dependencies[name] =
- if requirements.empty? and not source_set then
- Gem::Requirement.default
- elsif source_set then
- Gem::Requirement.source_set
- else
- Gem::Requirement.create requirements
- end
+ source_set ||= gem_path name, options
+ source_set ||= gem_git name, options
+ source_set ||= gem_github name, options
return unless gem_platforms options
@@ -383,23 +221,23 @@ class Gem::RequestSet::GemDependencyAPI
return unless (groups & @without_groups).empty?
- pin_gem_source name, :default unless source_set
-
- gem_requires name, options
+ unless source_set then
+ raise ArgumentError,
+ "duplicate source (default) for gem #{name}" if
+ @gem_sources.include? name
- if duplicate then
- warn <<-WARNING
-Gem dependencies file #{@path} requires #{name} more than once.
- WARNING
+ @gem_sources[name] = :default
end
+ gem_requires name, options
+
@set.gem name, *requirements
end
##
# Handles the git: option from +options+ for gem +name+.
#
- # Returns +true+ if the gist or git option was handled.
+ # Returns +true+ if the path option was handled.
def gem_git name, options # :nodoc:
if gist = options.delete(:gist) then
@@ -408,71 +246,43 @@ Gem dependencies file #{@path} requires #{name} more than once.
return unless repository = options.delete(:git)
- pin_gem_source name, :git, repository
+ raise ArgumentError,
+ "duplicate source git: #{repository} for gem #{name}" if
+ @gem_sources.include? name
- reference = gem_git_reference options
+ reference = nil
+ reference ||= options.delete :ref
+ reference ||= options.delete :branch
+ reference ||= options.delete :tag
+ reference ||= 'master'
submodules = options.delete :submodules
@git_set.add_git_gem name, repository, reference, submodules
- true
- end
-
- ##
- # Handles the git options from +options+ for git gem.
- #
- # Returns reference for the git gem.
-
- def gem_git_reference options # :nodoc:
- ref = options.delete :ref
- branch = options.delete :branch
- tag = options.delete :tag
-
- reference = nil
- reference ||= ref
- reference ||= branch
- reference ||= tag
- reference ||= 'master'
-
- if ref && branch
- warn <<-WARNING
-Gem dependencies file #{@path} includes git reference for both ref and branch but only ref is used.
- WARNING
- end
- if (ref||branch) && tag
- warn <<-WARNING
-Gem dependencies file #{@path} includes git reference for both ref/branch and tag but only ref/branch is used.
- WARNING
- end
+ @gem_sources[name] = repository
- reference
+ true
end
private :gem_git
##
- # Handles a git gem option from +options+ for gem +name+ for a git source
- # registered through git_source.
+ # Handles the github: option from +options+ for gem +name+.
#
- # Returns +true+ if the custom source option was handled.
-
- def gem_git_source name, options # :nodoc:
- return unless git_source = (@git_sources.keys & options.keys).last
-
- source_callback = @git_sources[git_source]
- source_param = options.delete git_source
+ # Returns +true+ if the path option was handled.
- git_url = source_callback.call source_param
+ def gem_github name, options # :nodoc:
+ return unless path = options.delete(:github)
- options[:git] = git_url
+ options[:git] = "git://github.com/#{path}.git"
gem_git name, options
true
end
- private :gem_git_source
+ private :gem_github
##
# Handles the :group and :groups +options+ for the gem with the given
@@ -500,40 +310,26 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
def gem_path name, options # :nodoc:
return unless directory = options.delete(:path)
- pin_gem_source name, :path, directory
+ raise ArgumentError,
+ "duplicate source path: #{directory} for gem #{name}" if
+ @gem_sources.include? name
@vendor_set.add_vendor_gem name, directory
- true
- end
-
- private :gem_path
-
- ##
- # Handles the source: option from +options+ for gem +name+.
- #
- # Returns +true+ if the source option was handled.
-
- def gem_source name, options # :nodoc:
- return unless source = options.delete(:source)
-
- pin_gem_source name, :source, source
-
- @source_set.add_source_gem name, source
+ @gem_sources[name] = directory
true
end
- private :gem_source
+ private :gem_path
##
# Handles the platforms: option from +options+. Returns true if the
# platform matches the current platform.
def gem_platforms options # :nodoc:
- platform_names = Array(options.delete :platform)
- platform_names.concat Array(options.delete :platforms)
- platform_names.concat @current_platforms if @current_platforms
+ platform_names = Array(options.delete :platforms)
+ platform_names << @current_platform if @current_platform
return true if platform_names.empty?
@@ -561,7 +357,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
private :gem_platforms
##
- # Records the require: option from +options+ and adds those files, or the
+ # Handles the require: option from +options+ and adds those files, or the
# default file to the require list for +name+.
def gem_requires name, options # :nodoc:
@@ -572,7 +368,6 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
else
@requires[name] << name
end
- raise ArgumentError, "Unhandled gem options #{options.inspect}" unless options.empty?
end
private :gem_requires
@@ -581,11 +376,6 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
# :category: Gem Dependencies DSL
#
# Block form for specifying gems from a git +repository+.
- #
- # git 'https://github.com/rails/rails.git' do
- # gem 'activesupport'
- # gem 'activerecord'
- # end
def git repository
@current_repository = repository
@@ -597,15 +387,6 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
end
##
- # Defines a custom git source that uses +name+ to expand git repositories
- # for use in gems built from git repositories. You must provide a block
- # that accepts a git repository name for expansion.
-
- def git_source name, &callback
- @git_sources[name] = callback
- end
-
- ##
# Returns the basename of the file the dependencies were loaded from
def gem_deps_file # :nodoc:
@@ -616,23 +397,6 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
# :category: Gem Dependencies DSL
#
# Loads dependencies from a gemspec file.
- #
- # +options+ include:
- #
- # name: ::
- # The name portion of the gemspec file. Defaults to searching for any
- # gemspec file in the current directory.
- #
- # gemspec name: 'my_gem'
- #
- # path: ::
- # The path the gemspec lives in. Defaults to the current directory:
- #
- # gemspec 'my_gem', path: 'gemspecs', name: 'my_gem'
- #
- # development_group: ::
- # The group to add development dependencies to. By default this is
- # :development. Only one group may be specified.
def gemspec options = {}
name = options.delete(:name) || '{,*}'
@@ -643,41 +407,18 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
groups = gem_group spec.name, {}
- self_dep = Gem::Dependency.new spec.name, spec.version
-
- add_dependencies groups, [self_dep]
add_dependencies groups, spec.runtime_dependencies
- @dependencies[spec.name] = Gem::Requirement.source_set
-
- spec.dependencies.each do |dep|
- @dependencies[dep.name] = dep.requirement
- end
-
groups << development_group
add_dependencies groups, spec.development_dependencies
- @vendor_set.add_vendor_gem spec.name, path
gem_requires spec.name, options
end
##
# :category: Gem Dependencies DSL
- #
# Block form for placing a dependency in the given +groups+.
- #
- # group :development do
- # gem 'debugger'
- # end
- #
- # group :development, :test do
- # gem 'minitest'
- # end
- #
- # Groups can be excluded at install time using `gem install -g --without
- # development`. See `gem help install` and `gem help gem_dependencies` for
- # further details.
def group *groups
@current_groups = groups
@@ -689,97 +430,30 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
end
##
- # Pins the gem +name+ to the given +source+. Adding a gem with the same
- # name from a different +source+ will raise an exception.
-
- def pin_gem_source name, type = :default, source = nil
- source_description =
- case type
- when :default then '(default)'
- when :path then "path: #{source}"
- when :git then "git: #{source}"
- when :source then "source: #{source}"
- else '(unknown)'
- end
-
- raise ArgumentError,
- "duplicate source #{source_description} for gem #{name}" if
- @gem_sources.fetch(name, source) != source
-
- @gem_sources[name] = source
- end
-
- private :pin_gem_source
-
- ##
# :category: Gem Dependencies DSL
#
- # Block form for restricting gems to a set of platforms.
- #
- # The gem dependencies platform is different from Gem::Platform. A platform
- # gem.deps.rb platform matches on the ruby engine, the ruby version and
- # whether or not windows is allowed.
- #
- # :ruby, :ruby_XY ::
- # Matches non-windows, non-jruby implementations where X and Y can be used
- # to match releases in the 1.8, 1.9, 2.0 or 2.1 series.
- #
- # :mri, :mri_XY ::
- # Matches non-windows C Ruby (Matz Ruby) or only the 1.8, 1.9, 2.0 or
- # 2.1 series.
- #
- # :mingw, :mingw_XY ::
- # Matches 32 bit C Ruby on MinGW or only the 1.8, 1.9, 2.0 or 2.1 series.
- #
- # :x64_mingw, :x64_mingw_XY ::
- # Matches 64 bit C Ruby on MinGW or only the 1.8, 1.9, 2.0 or 2.1 series.
- #
- # :mswin, :mswin_XY ::
- # Matches 32 bit C Ruby on Microsoft Windows or only the 1.8, 1.9, 2.0 or
- # 2.1 series.
- #
- # :mswin64, :mswin64_XY ::
- # Matches 64 bit C Ruby on Microsoft Windows or only the 1.8, 1.9, 2.0 or
- # 2.1 series.
- #
- # :jruby, :jruby_XY ::
- # Matches JRuby or JRuby in 1.8 or 1.9 mode.
- #
- # :maglev ::
- # Matches Maglev
- #
- # :rbx ::
- # Matches non-windows Rubinius
- #
- # NOTE: There is inconsistency in what environment a platform matches. You
- # may need to read the source to know the exact details.
+ # Block form for restricting gems to a particular platform.
- def platform *platforms
- @current_platforms = platforms
+ def platform what
+ @current_platform = what
yield
ensure
- @current_platforms = nil
+ @current_platform = nil
end
##
# :category: Gem Dependencies DSL
#
- # Block form for restricting gems to a particular set of platforms. See
- # #platform.
+ # Block form for restricting gems to a particular platform.
alias :platforms :platform
##
# :category: Gem Dependencies DSL
- #
- # Restricts this gem dependencies file to the given ruby +version+.
- #
- # You may also provide +engine:+ and +engine_version:+ options to restrict
- # this gem dependencies file to a particular ruby engine and its engine
- # version. This matching is performed by using the RUBY_ENGINE and
- # engine_specific VERSION constants. (For JRuby, JRUBY_VERSION).
+ # Restricts this gem dependencies file to the given ruby +version+. The
+ # +:engine+ options from Bundler are currently ignored.
def ruby version, options = {}
engine = options[:engine]
@@ -789,8 +463,6 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
'you must specify engine_version along with the ruby engine' if
engine and not engine_version
- return true if @installing
-
unless RUBY_VERSION == version then
message = "Your Ruby version is #{RUBY_VERSION}, " +
"but your #{gem_deps_file} requires #{version}"
@@ -823,16 +495,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
##
# :category: Gem Dependencies DSL
#
- # Sets +url+ as a source for gems for this dependency API. RubyGems uses
- # the default configured sources if no source was given. If a source is set
- # only that source is used.
- #
- # This method differs in behavior from Bundler:
- #
- # * The +:gemcutter+, # +:rubygems+ and +:rubyforge+ sources are not
- # supported as they are deprecated in bundler.
- # * The +prepend:+ option is not supported. If you wish to order sources
- # then list them in your preferred order.
+ # Sets +url+ as a source for gems for this dependency API.
def source url
Gem.sources.clear if @default_sources
@@ -847,3 +510,4 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
Gem::RequestSet::GemDepedencyAPI = self # :nodoc:
end
+
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index 7f6eadb939..0073bfdcc5 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -1,10 +1,5 @@
-# frozen_string_literal: true
-##
-# Parses a gem.deps.rb.lock file and constructs a LockSet containing the
-# dependencies found inside. If the lock file is missing no LockSet is
-# constructed.
-
class Gem::RequestSet::Lockfile
+
##
# Raised when a lockfile cannot be parsed
@@ -29,41 +24,13 @@ class Gem::RequestSet::Lockfile
# Raises a ParseError with the given +message+ which was encountered at a
# +line+ and +column+ while parsing.
- def initialize message, column, line, path
+ def initialize message, line, column, path
@line = line
@column = column
@path = path
- super "#{message} (at line #{line} column #{column})"
- end
- end
-
- ##
- # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+
- # location.
-
- def self.build request_set, gem_deps_file, dependencies = nil
- request_set.resolve
- dependencies ||= requests_to_deps request_set.sorted_requests
- new request_set, gem_deps_file, dependencies
- end
-
- def self.requests_to_deps requests # :nodoc:
- deps = {}
-
- requests.each do |request|
- spec = request.spec
- name = request.name
- requirement = request.request.dependency.requirement
-
- deps[name] = if [Gem::Resolver::VendorSpecification,
- Gem::Resolver::GitSpecification].include? spec.class then
- Gem::Requirement.source_set
- else
- requirement
- end
+ super "#{message} (at #{line}:#{column})"
end
- deps
end
##
@@ -71,100 +38,82 @@ class Gem::RequestSet::Lockfile
attr_reader :platforms
- def initialize request_set, gem_deps_file, dependencies
+ ##
+ # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+
+ # location.
+
+ def initialize request_set, gem_deps_file
@set = request_set
- @dependencies = dependencies
@gem_deps_file = File.expand_path(gem_deps_file)
@gem_deps_dir = File.dirname(@gem_deps_file)
- @gem_deps_file.untaint unless gem_deps_file.tainted?
-
+ @current_token = nil
+ @line = 0
+ @line_pos = 0
@platforms = []
+ @tokens = []
end
def add_DEPENDENCIES out # :nodoc:
out << "DEPENDENCIES"
- out.concat @dependencies.sort_by { |name,| name }.map { |name, requirement|
- " #{name}#{requirement.for_lockfile}"
- }
+ @set.dependencies.sort.map do |dependency|
+ source = @requests.find do |req|
+ req.name == dependency.name and
+ req.spec.class == Gem::Resolver::VendorSpecification
+ end
+
+ source_dep = '!' if source
+
+ requirement = dependency.requirement
+
+ out << " #{dependency.name}#{source_dep}#{requirement.for_lockfile}"
+ end
out << nil
end
- def add_GEM out, spec_groups # :nodoc:
- return if spec_groups.empty?
+ def add_GEM out # :nodoc:
+ out << "GEM"
- source_groups = spec_groups.values.flatten.group_by do |request|
+ source_groups = @spec_groups.values.flatten.group_by do |request|
request.spec.source.uri
end
- source_groups.sort_by { |group,| group.to_s }.map do |group, requests|
- out << "GEM"
+ source_groups.map do |group, requests|
out << " remote: #{group}"
out << " specs:"
requests.sort_by { |request| request.name }.each do |request|
- next if request.spec.name == 'bundler'
platform = "-#{request.spec.platform}" unless
Gem::Platform::RUBY == request.spec.platform
out << " #{request.name} (#{request.version}#{platform})"
request.full_spec.dependencies.sort.each do |dependency|
- next if dependency.type == :development
-
requirement = dependency.requirement
out << " #{dependency.name}#{requirement.for_lockfile}"
end
end
- out << nil
end
- end
-
- def add_GIT out, git_requests
- return if git_requests.empty?
- by_repository_revision = git_requests.group_by do |request|
- source = request.spec.source
- [source.repository, source.rev_parse]
- end
-
- by_repository_revision.each do |(repository, revision), requests|
- out << "GIT"
- out << " remote: #{repository}"
- out << " revision: #{revision}"
- out << " specs:"
-
- requests.sort_by { |request| request.name }.each do |request|
- out << " #{request.name} (#{request.version})"
-
- dependencies = request.spec.dependencies.sort_by { |dep| dep.name }
- dependencies.each do |dep|
- out << " #{dep.name}#{dep.requirement.for_lockfile}"
- end
- end
- out << nil
- end
+ out << nil
end
- def relative_path_from dest, base # :nodoc:
+ def relative_path_from(dest, base)
dest = File.expand_path(dest)
base = File.expand_path(base)
- if dest.index(base) == 0 then
- offset = dest[base.size+1..-1]
-
- return '.' unless offset
-
- offset
+ if dest.index(base) == 0
+ return dest[base.size+1..-1]
else
dest
end
end
- def add_PATH out, path_requests # :nodoc:
- return if path_requests.empty?
+ def add_PATH out # :nodoc:
+ return unless path_requests =
+ @spec_groups.delete(Gem::Resolver::VendorSpecification)
out << "PATH"
path_requests.each do |request|
@@ -181,9 +130,8 @@ class Gem::RequestSet::Lockfile
def add_PLATFORMS out # :nodoc:
out << "PLATFORMS"
- platforms = requests.map { |request| request.spec.platform }.uniq
-
- platforms = platforms.sort_by { |platform| platform.to_s }
+ platforms = @requests.map { |request| request.spec.platform }.uniq
+ platforms.delete Gem::Platform::RUBY if platforms.length > 1
platforms.each do |platform|
out << " #{platform}"
@@ -192,23 +140,143 @@ class Gem::RequestSet::Lockfile
out << nil
end
- def spec_groups
- requests.group_by { |request| request.spec.class }
+ ##
+ # Gets the next token for a Lockfile
+
+ def get expected_type = nil, expected_value = nil # :nodoc:
+ @current_token = @tokens.shift
+
+ type, value, line, column = @current_token
+
+ if expected_type and expected_type != type then
+ unget
+
+ message = "unexpected token [#{type.inspect}, #{value.inspect}], " +
+ "expected #{expected_type.inspect}"
+
+ raise ParseError.new message, line, column, "#{@gem_deps_file}.lock"
+ end
+
+ if expected_value and expected_value != value then
+ unget
+
+ message = "unexpected token [#{type.inspect}, #{value.inspect}], " +
+ "expected [#{expected_type.inspect}, #{expected_value.inspect}]"
+
+ raise ParseError.new message, line, column, "#{@gem_deps_file}.lock"
+ end
+
+ @current_token
+ end
+
+ def parse # :nodoc:
+ tokenize
+
+ until @tokens.empty? do
+ type, data, column, line = get
+
+ case type
+ when :section then
+ skip :newline
+
+ case data
+ when 'DEPENDENCIES' then
+ parse_DEPENDENCIES
+ when 'GEM' then
+ parse_GEM
+ when 'PLATFORMS' then
+ parse_PLATFORMS
+ else
+ type, = get until @tokens.empty? or peek.first == :section
+ end
+ else
+ raise "BUG: unhandled token #{type} (#{data.inspect}) at #{line}:#{column}"
+ end
+ end
+ end
+
+ def parse_DEPENDENCIES # :nodoc:
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ @set.gem name
+
+ skip :newline
+ end
+ end
+
+ def parse_GEM # :nodoc:
+ get :entry, 'remote'
+ _, data, = get :text
+
+ source = Gem::Source.new data
+
+ skip :newline
+
+ get :entry, 'specs'
+
+ skip :newline
+
+ set = Gem::Resolver::LockSet.new source
+
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ case peek[0]
+ when :newline then # ignore
+ when :l_paren then
+ get :l_paren
+
+ _, version, = get :text
+
+ get :r_paren
+
+ set.add name, version, Gem::Platform::RUBY
+ else
+ raise "BUG: unknown token #{peek}"
+ end
+
+ skip :newline
+ end
+
+ @set.sets << set
+ end
+
+ def parse_PLATFORMS # :nodoc:
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ @platforms << name
+
+ skip :newline
+ end
end
##
- # The contents of the lock file.
+ # Peeks at the next token for Lockfile
+
+ def peek # :nodoc:
+ @tokens.first
+ end
+
+ def skip type # :nodoc:
+ get while not @tokens.empty? and peek.first == type
+ end
def to_s
+ @set.resolve
+
out = []
- groups = spec_groups
+ @requests = @set.sorted_requests
- add_PATH out, groups.delete(Gem::Resolver::VendorSpecification) { [] }
+ @spec_groups = @requests.group_by do |request|
+ request.spec.class
+ end
- add_GIT out, groups.delete(Gem::Resolver::GitSpecification) { [] }
+ add_PATH out
- add_GEM out, groups
+ add_GEM out
add_PLATFORMS out
@@ -218,21 +286,71 @@ class Gem::RequestSet::Lockfile
end
##
- # Writes the lock file alongside the gem dependencies file
+ # Calculates the column (by byte) and the line of the current token based on
+ # +byte_offset+.
+
+ def token_pos byte_offset # :nodoc:
+ [byte_offset - @line_pos, @line]
+ end
- def write
- content = to_s
+ def tokenize # :nodoc:
+ @line = 0
+ @line_pos = 0
- open "#{@gem_deps_file}.lock", 'w' do |io|
- io.write content
+ @platforms = []
+ @tokens = []
+ @current_token = nil
+
+ lock_file = "#{@gem_deps_file}.lock"
+
+ @input = File.read lock_file
+ s = StringScanner.new @input
+
+ until s.eos? do
+ pos = s.pos
+
+ # leading whitespace is for the user's convenience
+ next if s.scan(/ +/)
+
+ if s.scan(/[<|=>]{7}/) then
+ message = "your #{lock_file} contains merge conflict markers"
+ line, column = token_pos pos
+
+ raise ParseError.new message, line, column, lock_file
+ end
+
+ @tokens <<
+ case
+ when s.scan(/\r?\n/) then
+ token = [:newline, nil, *token_pos(pos)]
+ @line_pos = s.pos
+ @line += 1
+ token
+ when s.scan(/[A-Z]+/) then
+ [:section, s.matched, *token_pos(pos)]
+ when s.scan(/([a-z]+):\s/) then
+ s.pos -= 1 # rewind for possible newline
+ [:entry, s[1], *token_pos(pos)]
+ when s.scan(/\(/) then
+ [:l_paren, nil, *token_pos(pos)]
+ when s.scan(/\)/) then
+ [:r_paren, nil, *token_pos(pos)]
+ when s.scan(/[^\s)]*/) then
+ [:text, s.matched, *token_pos(pos)]
+ else
+ raise "BUG: can't create token for: #{s.string[s.pos..-1].inspect}"
+ end
end
+
+ @tokens
end
- private
+ ##
+ # Ungets the last token retrieved by #get
- def requests
- @set.sorted_requests
+ def unget # :nodoc:
+ @tokens.unshift @current_token
end
+
end
-require 'rubygems/request_set/lockfile/tokenizer'
diff --git a/lib/rubygems/request_set/lockfile/parser.rb b/lib/rubygems/request_set/lockfile/parser.rb
deleted file mode 100644
index ebea940188..0000000000
--- a/lib/rubygems/request_set/lockfile/parser.rb
+++ /dev/null
@@ -1,354 +0,0 @@
-# frozen_string_literal: true
-class Gem::RequestSet::Lockfile::Parser
- ###
- # Parses lockfiles
-
- def initialize tokenizer, set, platforms, filename = nil
- @tokens = tokenizer
- @filename = filename
- @set = set
- @platforms = platforms
- end
-
- def parse
- until @tokens.empty? do
- token = get
-
- case token.type
- when :section then
- @tokens.skip :newline
-
- case token.value
- when 'DEPENDENCIES' then
- parse_DEPENDENCIES
- when 'GIT' then
- parse_GIT
- when 'GEM' then
- parse_GEM
- when 'PATH' then
- parse_PATH
- when 'PLATFORMS' then
- parse_PLATFORMS
- else
- token = get until @tokens.empty? or peek.first == :section
- end
- else
- raise "BUG: unhandled token #{token.type} (#{token.value.inspect}) at line #{token.line} column #{token.column}"
- end
- end
- end
-
- ##
- # Gets the next token for a Lockfile
-
- def get expected_types = nil, expected_value = nil # :nodoc:
- token = @tokens.shift
-
- if expected_types and not Array(expected_types).include? token.type then
- unget token
-
- message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
- "expected #{expected_types.inspect}"
-
- raise Gem::RequestSet::Lockfile::ParseError.new message, token.column, token.line, @filename
- end
-
- if expected_value and expected_value != token.value then
- unget token
-
- message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
- "expected [#{expected_types.inspect}, " +
- "#{expected_value.inspect}]"
-
- raise Gem::RequestSet::Lockfile::ParseError.new message, token.column, token.line, @filename
- end
-
- token
- end
-
- def parse_DEPENDENCIES # :nodoc:
- while not @tokens.empty? and :text == peek.type do
- token = get :text
-
- requirements = []
-
- case peek[0]
- when :bang then
- get :bang
-
- requirements << pinned_requirement(token.value)
- when :l_paren then
- get :l_paren
-
- loop do
- op = get(:requirement).value
- version = get(:text).value
-
- requirements << "#{op} #{version}"
-
- break unless peek.type == :comma
-
- get :comma
- end
-
- get :r_paren
-
- if peek[0] == :bang then
- requirements.clear
- requirements << pinned_requirement(token.value)
-
- get :bang
- end
- end
-
- @set.gem token.value, *requirements
-
- skip :newline
- end
- end
-
- def parse_GEM # :nodoc:
- sources = []
-
- while [:entry, 'remote'] == peek.first(2) do
- get :entry, 'remote'
- data = get(:text).value
- skip :newline
-
- sources << Gem::Source.new(data)
- end
-
- sources << Gem::Source.new(Gem::DEFAULT_HOST) if sources.empty?
-
- get :entry, 'specs'
-
- skip :newline
-
- set = Gem::Resolver::LockSet.new sources
- last_specs = nil
-
- while not @tokens.empty? and :text == peek.type do
- token = get :text
- name = token.value
- column = token.column
-
- case peek[0]
- when :newline then
- last_specs.each do |spec|
- spec.add_dependency Gem::Dependency.new name if column == 6
- end
- when :l_paren then
- get :l_paren
-
- token = get [:text, :requirement]
- type = token.type
- data = token.value
-
- if type == :text and column == 4 then
- version, platform = data.split '-', 2
-
- platform =
- platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
-
- last_specs = set.add name, version, platform
- else
- dependency = parse_dependency name, data
-
- last_specs.each do |spec|
- spec.add_dependency dependency
- end
- end
-
- get :r_paren
- else
- raise "BUG: unknown token #{peek}"
- end
-
- skip :newline
- end
-
- @set.sets << set
- end
-
- def parse_GIT # :nodoc:
- get :entry, 'remote'
- repository = get(:text).value
-
- skip :newline
-
- get :entry, 'revision'
- revision = get(:text).value
-
- skip :newline
-
- type = peek.type
- value = peek.value
- if type == :entry and %w[branch ref tag].include? value then
- get
- get :text
-
- skip :newline
- end
-
- get :entry, 'specs'
-
- skip :newline
-
- set = Gem::Resolver::GitSet.new
- set.root_dir = @set.install_dir
-
- last_spec = nil
-
- while not @tokens.empty? and :text == peek.type do
- token = get :text
- name = token.value
- column = token.column
-
- case peek[0]
- when :newline then
- last_spec.add_dependency Gem::Dependency.new name if column == 6
- when :l_paren then
- get :l_paren
-
- token = get [:text, :requirement]
- type = token.type
- data = token.value
-
- if type == :text and column == 4 then
- last_spec = set.add_git_spec name, data, repository, revision, true
- else
- dependency = parse_dependency name, data
-
- last_spec.add_dependency dependency
- end
-
- get :r_paren
- else
- raise "BUG: unknown token #{peek}"
- end
-
- skip :newline
- end
-
- @set.sets << set
- end
-
- def parse_PATH # :nodoc:
- get :entry, 'remote'
- directory = get(:text).value
-
- skip :newline
-
- get :entry, 'specs'
-
- skip :newline
-
- set = Gem::Resolver::VendorSet.new
- last_spec = nil
-
- while not @tokens.empty? and :text == peek.first do
- token = get :text
- name = token.value
- column = token.column
-
- case peek[0]
- when :newline then
- last_spec.add_dependency Gem::Dependency.new name if column == 6
- when :l_paren then
- get :l_paren
-
- token = get [:text, :requirement]
- type = token.type
- data = token.value
-
- if type == :text and column == 4 then
- last_spec = set.add_vendor_gem name, directory
- else
- dependency = parse_dependency name, data
-
- last_spec.dependencies << dependency
- end
-
- get :r_paren
- else
- raise "BUG: unknown token #{peek}"
- end
-
- skip :newline
- end
-
- @set.sets << set
- end
-
- def parse_PLATFORMS # :nodoc:
- while not @tokens.empty? and :text == peek.first do
- name = get(:text).value
-
- @platforms << name
-
- skip :newline
- end
- end
-
- ##
- # Parses the requirements following the dependency +name+ and the +op+ for
- # the first token of the requirements and returns a Gem::Dependency object.
-
- def parse_dependency name, op # :nodoc:
- return Gem::Dependency.new name, op unless peek[0] == :text
-
- version = get(:text).value
-
- requirements = ["#{op} #{version}"]
-
- while peek.type == :comma do
- get :comma
- op = get(:requirement).value
- version = get(:text).value
-
- requirements << "#{op} #{version}"
- end
-
- Gem::Dependency.new name, requirements
- end
-
- private
-
- def skip type # :nodoc:
- @tokens.skip type
- end
-
- ##
- # Peeks at the next token for Lockfile
-
- def peek # :nodoc:
- @tokens.peek
- end
-
- if [].respond_to? :flat_map
- def pinned_requirement name # :nodoc:
- requirement = Gem::Dependency.new name
- specification = @set.sets.flat_map { |set|
- set.find_all(requirement)
- }.compact.first
-
- specification && specification.version
- end
- else # FIXME: remove when 1.8 is dropped
- def pinned_requirement name # :nodoc:
- requirement = Gem::Dependency.new name
- specification = @set.sets.map { |set|
- set.find_all(requirement)
- }.flatten(1).compact.first
-
- specification && specification.version
- end
- end
-
- ##
- # Ungets the last token retrieved by #get
-
- def unget token # :nodoc:
- @tokens.unshift token
- end
-end
diff --git a/lib/rubygems/request_set/lockfile/tokenizer.rb b/lib/rubygems/request_set/lockfile/tokenizer.rb
deleted file mode 100644
index c9f1fac75b..0000000000
--- a/lib/rubygems/request_set/lockfile/tokenizer.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-# frozen_string_literal: true
-require 'strscan'
-require 'rubygems/request_set/lockfile/parser'
-
-class Gem::RequestSet::Lockfile::Tokenizer
- Token = Struct.new :type, :value, :column, :line
- EOF = Token.new :EOF
-
- def self.from_file file
- new File.read(file), file
- end
-
- def initialize input, filename = nil, line = 0, pos = 0
- @line = line
- @line_pos = pos
- @tokens = []
- @filename = filename
- tokenize input
- end
-
- def make_parser set, platforms
- Gem::RequestSet::Lockfile::Parser.new self, set, platforms, @filename
- end
-
- def to_a
- @tokens.map { |token| [token.type, token.value, token.column, token.line] }
- end
-
- def skip type
- @tokens.shift while not @tokens.empty? and peek.type == type
- end
-
- ##
- # Calculates the column (by byte) and the line of the current token based on
- # +byte_offset+.
-
- def token_pos byte_offset # :nodoc:
- [byte_offset - @line_pos, @line]
- end
-
- def empty?
- @tokens.empty?
- end
-
- def unshift token
- @tokens.unshift token
- end
-
- def next_token
- @tokens.shift
- end
- alias :shift :next_token
-
- def peek
- @tokens.first || EOF
- end
-
- private
-
- def tokenize input
- s = StringScanner.new input
-
- until s.eos? do
- pos = s.pos
-
- pos = s.pos if leading_whitespace = s.scan(/ +/)
-
- if s.scan(/[<|=>]{7}/) then
- message = "your #{@filename} contains merge conflict markers"
- column, line = token_pos pos
-
- raise Gem::RequestSet::Lockfile::ParseError.new message, column, line, @filename
- end
-
- @tokens <<
- case
- when s.scan(/\r?\n/) then
- token = Token.new(:newline, nil, *token_pos(pos))
- @line_pos = s.pos
- @line += 1
- token
- when s.scan(/[A-Z]+/) then
- if leading_whitespace then
- text = s.matched
- text += s.scan(/[^\s)]*/).to_s # in case of no match
- Token.new(:text, text, *token_pos(pos))
- else
- Token.new(:section, s.matched, *token_pos(pos))
- end
- when s.scan(/([a-z]+):\s/) then
- s.pos -= 1 # rewind for possible newline
- Token.new(:entry, s[1], *token_pos(pos))
- when s.scan(/\(/) then
- Token.new(:l_paren, nil, *token_pos(pos))
- when s.scan(/\)/) then
- Token.new(:r_paren, nil, *token_pos(pos))
- when s.scan(/<=|>=|=|~>|<|>|!=/) then
- Token.new(:requirement, s.matched, *token_pos(pos))
- when s.scan(/,/) then
- Token.new(:comma, nil, *token_pos(pos))
- when s.scan(/!/) then
- Token.new(:bang, nil, *token_pos(pos))
- when s.scan(/[^\s),!]*/) then
- Token.new(:text, s.matched, *token_pos(pos))
- else
- raise "BUG: can't create token for: #{s.string[s.pos..-1].inspect}"
- end
- end
-
- @tokens
- end
-end
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 32dc769055..2b112a8022 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require "rubygems/version"
require "rubygems/deprecate"
@@ -9,9 +8,6 @@ Gem.load_yaml if defined? ::YAML
##
# A Requirement is a set of one or more version restrictions. It supports a
# few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
-#
-# See Gem::Version for a description on how versions and requirements work
-# together in RubyGems.
class Gem::Requirement
OPS = { #:nodoc:
@@ -24,8 +20,6 @@ class Gem::Requirement
"~>" => lambda { |v, r| v >= r && v.release < r.bump }
}
- SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
-
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
@@ -57,8 +51,6 @@ class Gem::Requirement
input
when Gem::Version, Array then
new input
- when '!' then
- source_set
else
if input.respond_to? :to_str then
new [input.to_str]
@@ -75,13 +67,6 @@ class Gem::Requirement
new '>= 0'
end
- ###
- # A source set requirement, used for Gemfiles and lockfiles
-
- def self.source_set # :nodoc:
- SOURCE_SET_REQUIREMENT
- end
-
##
# Parse +obj+, returning an <tt>[op, version]</tt> pair. +obj+ can
# be a String or a Gem::Version.
@@ -90,9 +75,9 @@ class Gem::Requirement
# specification, like <tt>">= 1.2"</tt>, or a simple version number,
# like <tt>"1.2"</tt>.
#
- # parse("> 1.0") # => [">", Gem::Version.new("1.0")]
- # parse("1.0") # => ["=", Gem::Version.new("1.0")]
- # parse(Gem::Version.new("1.0")) # => ["=, Gem::Version.new("1.0")]
+ # parse("> 1.0") # => [">", "1.0"]
+ # parse("1.0") # => ["=", "1.0"]
+ # parse(Gem::Version.new("1.0")) # => ["=, "1.0"]
def self.parse obj
return ["=", obj] if Gem::Version === obj
@@ -148,15 +133,7 @@ class Gem::Requirement
# Formats this requirement for use in a Gem::RequestSet::Lockfile.
def for_lockfile # :nodoc:
- return if [DefaultRequirement] == @requirements
-
- list = requirements.sort_by { |_, version|
- version
- }.map { |op, version|
- "#{op} #{version}"
- }.uniq
-
- " (#{list.join ', '})"
+ " (#{to_s})" unless [DefaultRequirement] == @requirements
end
##
@@ -170,20 +147,12 @@ class Gem::Requirement
end
end
- ##
- # true if the requirement is for only an exact version
-
- def exact?
- return false unless @requirements.size == 1
- @requirements[0][0] == "="
- end
-
def as_list # :nodoc:
requirements.map { |op, version| "#{op} #{version}" }.sort
end
def hash # :nodoc:
- requirements.sort.hash
+ requirements.hash
end
def marshal_dump # :nodoc:
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index 3a406d0444..828c61de01 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -1,7 +1,6 @@
-# frozen_string_literal: true
+require 'rubygems'
require 'rubygems/dependency'
require 'rubygems/exceptions'
-require 'rubygems/util'
require 'rubygems/util/list'
require 'uri'
@@ -14,43 +13,16 @@ require 'net/http'
# all the requirements.
class Gem::Resolver
- require 'rubygems/resolver/molinillo'
##
- # If the DEBUG_RESOLVER environment variable is set then debugging mode is
- # enabled for the resolver. This will display information about the state
- # of the resolver while a set of dependencies is being resolved.
+ # Contains all the conflicts encountered while doing resolution
- DEBUG_RESOLVER = !ENV['DEBUG_RESOLVER'].nil?
-
- ##
- # Set to true if all development dependencies should be considered.
+ attr_reader :conflicts
attr_accessor :development
- ##
- # Set to true if immediate development dependencies should be considered.
-
- attr_accessor :development_shallow
-
- ##
- # When true, no dependencies are looked up for requested gems.
-
- attr_accessor :ignore_dependencies
-
- ##
- # List of dependencies that could not be found in the configured sources.
-
attr_reader :missing
- attr_reader :stats
-
- ##
- # Hash of gems to skip resolution. Keyed by gem name, with arrays of
- # gem specifications as values.
-
- attr_accessor :skip_gems
-
##
# When a missing dependency, don't stop. Just go on and record what was
# missing.
@@ -67,8 +39,6 @@ class Gem::Resolver
sets = sets.map do |set|
case set
- when Gem::Resolver::BestSet then
- set
when Gem::Resolver::ComposedSet then
set.sets
else
@@ -87,8 +57,8 @@ class Gem::Resolver
end
##
- # Creates a Resolver that queries only against the already installed gems
- # for the +needed+ dependencies.
+ # Provide a Resolver that queries only against the already
+ # installed gems.
def self.for_current_gems needed
new needed, Gem::Resolver::CurrentSet.new
@@ -106,28 +76,28 @@ class Gem::Resolver
@set = set || Gem::Resolver::IndexSet.new
@needed = needed
- @development = false
- @development_shallow = false
- @ignore_dependencies = false
- @missing = []
- @skip_gems = {}
- @soft_missing = false
- @stats = Gem::Resolver::Stats.new
+ @conflicts = []
+ @development = false
+ @missing = []
+ @soft_missing = false
end
- def explain stage, *data # :nodoc:
- return unless DEBUG_RESOLVER
+ DEBUG_RESOLVER = !ENV['DEBUG_RESOLVER'].nil?
- d = data.map { |x| x.pretty_inspect }.join(", ")
- $stderr.printf "%10s %s\n", stage.to_s.upcase, d
+ def explain(stage, *data)
+ if DEBUG_RESOLVER
+ d = data.map { |x| x.inspect }.join(", ")
+ STDOUT.printf "%20s %s\n", stage.to_s.upcase, d
+ end
end
- def explain_list stage # :nodoc:
- return unless DEBUG_RESOLVER
-
- data = yield
- $stderr.printf "%10s (%d entries)\n", stage.to_s.upcase, data.size
- PP.pp data, $stderr unless data.empty?
+ def explain_list(stage, data)
+ if DEBUG_RESOLVER
+ STDOUT.printf "%20s (%d entries)\n", stage.to_s.upcase, data.size
+ data.each do |d|
+ STDOUT.printf "%20s %s\n", "", d
+ end
+ end
end
##
@@ -140,7 +110,6 @@ class Gem::Resolver
spec = possible.pop
explain :activate, [spec.full_name, possible.size]
- explain :possible, possible
activation_request =
Gem::Resolver::ActivationRequest.new spec, dep, possible
@@ -148,52 +117,58 @@ class Gem::Resolver
return spec, activation_request
end
- def requests s, act, reqs=[] # :nodoc:
- return reqs if @ignore_dependencies
-
- s.fetch_development_dependencies if @development
-
+ def requests s, act, reqs=nil
s.dependencies.reverse_each do |d|
next if d.type == :development and not @development
- next if d.type == :development and @development_shallow and
- act.development?
- next if d.type == :development and @development_shallow and
- act.parent
-
- reqs << Gem::Resolver::DependencyRequest.new(d, act)
- @stats.requirement!
+ reqs.add Gem::Resolver::DependencyRequest.new(d, act)
end
@set.prefetch reqs
- @stats.record_requirements reqs
-
reqs
end
- include Molinillo::UI
+ ##
+ # Proceed with resolution! Returns an array of ActivationRequest objects.
- def output
- @output ||= debug? ? $stdout : File.open(Gem::Util::NULL_DEVICE, 'w')
- end
+ def resolve
+ @conflicts = []
- def debug?
- DEBUG_RESOLVER
- end
+ needed = RequirementList.new
+
+ @needed.reverse_each do |n|
+ request = Gem::Resolver::DependencyRequest.new n, nil
+
+ needed.add request
+ end
+
+ res = resolve_for needed, nil
+
+ raise Gem::DependencyResolutionError, res if
+ res.kind_of? Gem::Resolver::Conflict
- include Molinillo::SpecificationProvider
+ res.to_a
+ end
##
- # Proceed with resolution! Returns an array of ActivationRequest objects.
+ # Finds the State in +states+ that matches the +conflict+ so that we can try
+ # other possible sets.
+ #
+ # If no good candidate is found, the first state is tried.
- def resolve
- locking_dg = Molinillo::DependencyGraph.new
- Molinillo::Resolver.new(self, self).resolve(@needed.map { |d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact
- rescue Molinillo::VersionConflict => e
- conflict = e.conflicts.values.first
- raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)
- ensure
- @output.close if @output and !debug?
+ def find_conflict_state conflict, states # :nodoc:
+ until states.empty? do
+ state = states.pop
+
+ explain :consider, state.dep, conflict.failed_dep
+
+ if conflict.for_spec? state.spec
+ state.conflicts << [state.spec, conflict]
+ return state
+ end
+ end
+
+ nil
end
##
@@ -202,58 +177,209 @@ class Gem::Resolver
def find_possible dependency # :nodoc:
all = @set.find_all dependency
+ matching_platform = select_local_platforms all
- if (skip_dep_gems = skip_gems[dependency.name]) && !skip_dep_gems.empty?
- matching = all.select do |api_spec|
- skip_dep_gems.any? { |s| api_spec.version == s.version }
- end
+ return matching_platform, all
+ end
- all = matching unless matching.empty?
+ def handle_conflict(dep, existing)
+ # There is a conflict! We return the conflict object which will be seen by
+ # the caller and be handled at the right level.
+
+ # If the existing activation indicates that there are other possibles for
+ # it, then issue the conflict on the dependency for the activation itself.
+ # Otherwise, if there was a requester, issue it on the requester's
+ # request itself.
+ # Finally, if the existing request has no requester (toplevel) unwind to
+ # it anyway.
+
+ if existing.others_possible?
+ conflict =
+ Gem::Resolver::Conflict.new dep, existing
+ elsif dep.requester
+ depreq = dep.requester.request
+ conflict =
+ Gem::Resolver::Conflict.new depreq, existing, dep
+ elsif existing.request.requester.nil?
+ conflict =
+ Gem::Resolver::Conflict.new dep, existing
+ else
+ raise Gem::DependencyError, "Unable to figure out how to unwind conflict"
end
- matching_platform = select_local_platforms all
+ @conflicts << conflict unless @conflicts.include? conflict
- return matching_platform, all
+ return conflict
end
- ##
- # Returns the gems in +specs+ that match the local platform.
+ # Contains the state for attempting activation of a set of possible specs.
+ # +needed+ is a Gem::List of DependencyRequest objects that, well, need
+ # to be satisfied.
+ # +specs+ is the List of ActivationRequest that are being tested.
+ # +dep+ is the DependencyRequest that was used to generate this state.
+ # +spec+ is the Specification for this state.
+ # +possible+ is List of DependencyRequest objects that can be tried to
+ # find a complete set.
+ # +conflicts+ is a [DependencyRequest, Conflict] hit tried to
+ # activate the state.
+ #
+ State = Struct.new(:needed, :specs, :dep, :spec, :possibles, :conflicts) do
+ def summary # :nodoc:
+ nd = needed.map { |s| s.to_s }.sort if nd
- def select_local_platforms specs # :nodoc:
- specs.select do |spec|
- Gem::Platform.installable? spec
+ if specs then
+ ss = specs.map { |s| s.full_name }.sort
+ ss.unshift ss.length
+ end
+
+ d = dep.to_s
+ d << " from #{dep.requester.full_name}" if dep.requester
+
+ ps = possibles.map { |p| p.full_name }.sort
+ ps.unshift ps.length
+
+ cs = conflicts.map do |(s, c)|
+ [s.full_name, c.conflicting_dependencies.map { |cd| cd.to_s }]
+ end
+
+ { :needed => nd, :specs => ss, :dep => d, :spec => spec.full_name,
+ :possibles => ps, :conflicts => cs }
end
end
- def search_for(dependency)
- possibles, all = find_possible(dependency)
- if !@soft_missing && possibles.empty?
- @missing << dependency
- exc = Gem::UnsatisfiableDependencyError.new dependency, all
- exc.errors = @set.errors
- raise exc
+ ##
+ # The meat of the algorithm. Given +needed+ DependencyRequest objects and
+ # +specs+ being a list to ActivationRequest, calculate a new list of
+ # ActivationRequest objects.
+
+ def resolve_for needed, specs
+ # The State objects that are used to attempt the activation tree.
+ states = []
+
+ while !needed.empty?
+ dep = needed.remove
+ explain :try, [dep, dep.requester ? dep.requester.request : :toplevel]
+ explain_list :next5, needed.next5
+ explain_list :specs, Array(specs).map { |x| x.full_name }.sort
+
+ # If there is already a spec activated for the requested name...
+ if specs && existing = specs.find { |s| dep.name == s.name }
+ # then we're done since this new dep matches the existing spec.
+ next if dep.matches_spec? existing
+
+ conflict = handle_conflict dep, existing
+ explain :conflict, conflict.explain
+
+ state = find_conflict_state conflict, states
+
+ return conflict unless state
+
+ needed, specs = resolve_for_conflict needed, specs, state
+
+ states << state unless state.possibles.empty?
+
+ next
+ end
+
+ matching, all = find_possible dep
+
+ case matching.size
+ when 0
+ resolve_for_zero dep, all
+ when 1
+ needed, specs =
+ resolve_for_single needed, specs, dep, matching
+ else
+ needed, specs =
+ resolve_for_multiple needed, specs, states, dep, matching
+ end
end
- possibles.sort_by { |s| [s.source, s.version, s.platform.to_s == Gem::Platform.local.to_s ? 1 : 0] }.
- map { |s| ActivationRequest.new s, dependency, [] }
+
+ specs
end
- def dependencies_for(specification)
- return [] if @ignore_dependencies
- spec = specification.spec
- requests(spec, specification)
+ ##
+ # Rewinds +needed+ and +specs+ to a previous state in +state+ for a conflict
+ # between +dep+ and +existing+.
+
+ def resolve_for_conflict needed, specs, state # :nodoc:
+ # We exhausted the possibles so it's definitely not going to work out,
+ # bail out.
+ raise Gem::ImpossibleDependenciesError.new state.dep, state.conflicts if
+ state.possibles.empty?
+
+ # Retry resolution with this spec and add it's dependencies
+ spec, act = activation_request state.dep, state.possibles
+
+ needed = requests spec, act, state.needed.dup
+ specs = Gem::List.prepend state.specs, act
+
+ return needed, specs
end
- def requirement_satisfied_by?(requirement, activated, spec)
- requirement.matches_spec? spec
+ ##
+ # There are multiple +possible+ specifications for this +dep+. Updates
+ # +needed+, +specs+ and +states+ for further resolution of the +possible+
+ # choices.
+
+ def resolve_for_multiple needed, specs, states, dep, possible # :nodoc:
+ # Sort them so that we try the highest versions first.
+ possible = possible.sort_by do |s|
+ [s.source, s.version, s.platform == Gem::Platform::RUBY ? -1 : 1]
+ end
+
+ spec, act = activation_request dep, possible
+
+ # We may need to try all of +possible+, so we setup state to unwind back
+ # to current +needed+ and +specs+ so we can try another. This is code is
+ # what makes conflict resolution possible.
+ states << State.new(needed.dup, specs, dep, spec, possible, [])
+
+ explain :states, states.map { |s| s.dep }
+
+ needed = requests spec, act, needed
+ specs = Gem::List.prepend specs, act
+
+ return needed, specs
end
- def name_for(dependency)
- dependency.name
+ ##
+ # Add the spec from the +possible+ list to +specs+ and process the spec's
+ # dependencies by adding them to +needed+.
+
+ def resolve_for_single needed, specs, dep, possible # :nodoc:
+ spec, act = activation_request dep, possible
+
+ specs = Gem::List.prepend specs, act
+
+ # Put the deps for at the beginning of needed
+ # rather than the end to match the depth first
+ # searching done by the multiple case code below.
+ #
+ # This keeps the error messages consistent.
+ needed = requests spec, act, needed
+
+ return needed, specs
end
- def allow_missing?(dependency)
- @missing << dependency
- @soft_missing
+ ##
+ # When there are no possible specifications for +dep+ our work is done.
+
+ def resolve_for_zero dep, platform_mismatch # :nodoc:
+ @missing << dep
+
+ unless @soft_missing
+ raise Gem::UnsatisfiableDependencyError.new(dep, platform_mismatch)
+ end
+ end
+
+ ##
+ # Returns the gems in +specs+ that match the local platform.
+
+ def select_local_platforms specs # :nodoc:
+ specs.select do |spec|
+ Gem::Platform.installable? spec
+ end
end
end
@@ -267,7 +393,6 @@ require 'rubygems/resolver/activation_request'
require 'rubygems/resolver/conflict'
require 'rubygems/resolver/dependency_request'
require 'rubygems/resolver/requirement_list'
-require 'rubygems/resolver/stats'
require 'rubygems/resolver/set'
require 'rubygems/resolver/api_set'
@@ -279,7 +404,6 @@ require 'rubygems/resolver/index_set'
require 'rubygems/resolver/installer_set'
require 'rubygems/resolver/lock_set'
require 'rubygems/resolver/vendor_set'
-require 'rubygems/resolver/source_set'
require 'rubygems/resolver/specification'
require 'rubygems/resolver/spec_specification'
@@ -287,6 +411,5 @@ require 'rubygems/resolver/api_specification'
require 'rubygems/resolver/git_specification'
require 'rubygems/resolver/index_specification'
require 'rubygems/resolver/installed_specification'
-require 'rubygems/resolver/local_specification'
-require 'rubygems/resolver/lock_specification'
require 'rubygems/resolver/vendor_specification'
+
diff --git a/lib/rubygems/resolver/activation_request.rb b/lib/rubygems/resolver/activation_request.rb
index 135d75d6bc..ca82ac408a 100644
--- a/lib/rubygems/resolver/activation_request.rb
+++ b/lib/rubygems/resolver/activation_request.rb
@@ -1,34 +1,21 @@
-# frozen_string_literal: true
##
-# Specifies a Specification object that should be activated. Also contains a
-# dependency that was used to introduce this activation.
+# Specifies a Specification object that should be activated.
+# Also contains a dependency that was used to introduce this
+# activation.
class Gem::Resolver::ActivationRequest
- ##
- # The parent request for this activation request.
-
attr_reader :request
- ##
- # The specification to be activated.
-
attr_reader :spec
- ##
- # Creates a new ActivationRequest that will activate +spec+. The parent
- # +request+ is used to provide diagnostics in case of conflicts.
- #
- # +others_possible+ indicates that other specifications may also match this
- # activation request.
-
- def initialize spec, request, others_possible = true
+ def initialize spec, req, others_possible = true
@spec = spec
- @request = request
+ @request = req
@others_possible = others_possible
end
- def == other # :nodoc:
+ def == other
case other
when Gem::Specification
@spec == other
@@ -39,52 +26,22 @@ class Gem::Resolver::ActivationRequest
end
end
- ##
- # Is this activation request for a development dependency?
-
- def development?
- @request.development?
- end
-
- ##
- # Downloads a gem at +path+ and returns the file path.
-
def download path
- Gem.ensure_gem_subdirectories path
-
- if @spec.respond_to? :sources
- exception = nil
- path = @spec.sources.find{ |source|
- begin
- source.download full_spec, path
- rescue exception
- end
- }
- return path if path
- raise exception if exception
-
- elsif @spec.respond_to? :source
+ if @spec.respond_to? :source
source = @spec.source
- source.download full_spec, path
-
else
source = Gem.sources.first
- source.download full_spec, path
end
- end
- ##
- # The full name of the specification to be activated.
+ Gem.ensure_gem_subdirectories path
+
+ source.download full_spec, path
+ end
def full_name
@spec.full_name
end
- alias_method :to_s, :full_name
-
- ##
- # The Gem::Specification for this activation request.
-
def full_spec
Gem::Specification === @spec ? @spec : @spec.spec
end
@@ -109,7 +66,7 @@ class Gem::Resolver::ActivationRequest
end
##
- # True if the requested gem has already been installed.
+ # Indicates if the requested gem has already been installed.
def installed?
case @spec
@@ -124,9 +81,6 @@ class Gem::Resolver::ActivationRequest
end
end
- ##
- # The name of this activation request's specification
-
def name
@spec.name
end
@@ -176,11 +130,9 @@ class Gem::Resolver::ActivationRequest
end
end
- ##
- # The version of this activation request's specification
-
def version
@spec.version
end
end
+
diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb
index ee3046af63..89ee3c9b15 100644
--- a/lib/rubygems/resolver/api_set.rb
+++ b/lib/rubygems/resolver/api_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# The global rubygems pool, available via the rubygems.org API.
# Returns instances of APISpecification.
@@ -26,17 +25,13 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
# http://guides.rubygems.org/rubygems-org-api
def initialize dep_uri = 'https://rubygems.org/api/v1/dependencies'
- super()
-
dep_uri = URI dep_uri unless URI === dep_uri # for ruby 1.8
@dep_uri = dep_uri
- @uri = dep_uri + '../..'
+ @uri = dep_uri + '../../..'
@data = Hash.new { |h,k| h[k] = [] }
@source = Gem::Source.new @uri
-
- @to_fetch = []
end
##
@@ -46,12 +41,6 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
def find_all req
res = []
- return res unless @remote
-
- if @to_fetch.include?(req.name)
- prefetch_now
- end
-
versions(req.name).each do |ver|
if req.dependency.match? req.name, ver[:number]
res << Gem::Resolver::APISpecification.new(self, ver)
@@ -66,15 +55,10 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
# data for DependencyRequests +reqs+.
def prefetch reqs
- return unless @remote
names = reqs.map { |r| r.dependency.name }
- needed = names - @data.keys - @to_fetch
-
- @to_fetch += needed
- end
+ needed = names - @data.keys
- def prefetch_now # :nodoc:
- needed, @to_fetch = @to_fetch, []
+ return if needed.empty?
uri = @dep_uri + "?gems=#{needed.sort.join ','}"
str = Gem::RemoteFetcher.fetcher.fetch_path uri
diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb
index 1e22dd0b6f..0ab8e830c6 100644
--- a/lib/rubygems/resolver/api_specification.rb
+++ b/lib/rubygems/resolver/api_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Represents a specification retrieved via the rubygems.org API.
#
@@ -20,7 +19,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
@set = set
@name = api_data[:name]
@version = Gem::Version.new api_data[:number]
- @platform = Gem::Platform.new api_data[:platform]
+ @platform = api_data[:platform]
@dependencies = api_data[:dependencies].map do |name, ver|
Gem::Dependency.new name, ver.split(/\s*,\s*/)
end
@@ -35,16 +34,6 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
@dependencies == other.dependencies
end
- def fetch_development_dependencies # :nodoc:
- spec = source.fetch_spec Gem::NameTuple.new @name, @version, @platform
-
- @dependencies = spec.dependencies
- end
-
- def installable_platform? # :nodoc:
- Gem::Platform.match @platform
- end
-
def pretty_print q # :nodoc:
q.group 2, '[APISpecification', ']' do
q.breakable
diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb
index 4479535abe..533a0db58f 100644
--- a/lib/rubygems/resolver/best_set.rb
+++ b/lib/rubygems/resolver/best_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# The BestSet chooses the best available method to query a remote index.
#
@@ -13,67 +12,10 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
def initialize sources = Gem.sources
super()
- @sources = sources
- end
-
- ##
- # Picks which sets to use for the configured sources.
-
- def pick_sets # :nodoc:
- @sources.each_source do |source|
+ sources.each_source do |source|
@sets << source.dependency_resolver_set
end
end
- def find_all req # :nodoc:
- pick_sets if @remote and @sets.empty?
-
- super
- rescue Gem::RemoteFetcher::FetchError => e
- replace_failed_api_set e
-
- retry
- end
-
- def prefetch reqs # :nodoc:
- pick_sets if @remote and @sets.empty?
-
- super
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[BestSet', ']' do
- q.breakable
- q.text 'sets:'
-
- q.breakable
- q.pp @sets
- end
- end
-
- ##
- # Replaces a failed APISet for the URI in +error+ with an IndexSet.
- #
- # If no matching APISet can be found the original +error+ is raised.
- #
- # The calling method must retry the exception to repeat the lookup.
-
- def replace_failed_api_set error # :nodoc:
- uri = error.uri
- uri = URI uri unless URI === uri
- uri.query = nil
-
- raise error unless api_set = @sets.find { |set|
- Gem::Resolver::APISet === set and set.dep_uri == uri
- }
-
- index_set = Gem::Resolver::IndexSet.new api_set.source
-
- @sets.map! do |set|
- next set unless set == api_set
- index_set
- end
- end
-
end
diff --git a/lib/rubygems/resolver/composed_set.rb b/lib/rubygems/resolver/composed_set.rb
index 0b65942dca..19227e095b 100644
--- a/lib/rubygems/resolver/composed_set.rb
+++ b/lib/rubygems/resolver/composed_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A ComposedSet allows multiple sets to be queried like a single set.
#
@@ -17,37 +16,10 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
# Gem::Resolver::compose_sets instead.
def initialize *sets
- super()
-
@sets = sets
end
##
- # When +allow_prerelease+ is set to +true+ prereleases gems are allowed to
- # match dependencies.
-
- def prerelease= allow_prerelease
- super
-
- sets.each do |set|
- set.prerelease = allow_prerelease
- end
- end
-
- ##
- # Sets the remote network access for all composed sets.
-
- def remote= remote
- super
-
- @sets.each { |set| set.remote = remote }
- end
-
- def errors
- @errors + @sets.map { |set| set.errors }.flatten
- end
-
- ##
# Finds all specs matching +req+ in all sets.
def find_all req
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb
index 7997f92950..20c6eced31 100644
--- a/lib/rubygems/resolver/conflict.rb
+++ b/lib/rubygems/resolver/conflict.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Used internally to indicate that a dependency conflicted
# with a spec that would be activated.
@@ -53,40 +52,11 @@ class Gem::Resolver::Conflict
def explanation
activated = @activated.spec.full_name
- dependency = @failed_dep.dependency
- requirement = dependency.requirement
- alternates = dependency.matching_specs.map { |spec| spec.full_name }
+ requirement = @failed_dep.dependency.requirement
- unless alternates.empty? then
- matching = <<-MATCHING.chomp
-
- Gems matching %s:
- %s
- MATCHING
-
- matching = matching % [
- dependency,
- alternates.join(', '),
- ]
- end
-
- explanation = <<-EXPLANATION
- Activated %s
- which does not match conflicting dependency (%s)
-
- Conflicting dependency chains:
- %s
-
- versus:
- %s
-%s
- EXPLANATION
-
- explanation % [
- activated, requirement,
- request_path(@activated).reverse.join(", depends on\n "),
- request_path(@failed_dep).reverse.join(", depends on\n "),
- matching,
+ " Activated %s via:\n %s\n instead of (%s) via:\n %s\n" % [
+ activated, request_path(@activated).join(', '),
+ requirement, request_path(requester).join(', '),
]
end
@@ -125,19 +95,11 @@ class Gem::Resolver::Conflict
path = []
while current do
- case current
- when Gem::Resolver::ActivationRequest then
- path <<
- "#{current.request.dependency}, #{current.spec.version} activated"
-
- current = current.parent
- when Gem::Resolver::DependencyRequest then
- path << "#{current.dependency}"
+ spec_name = current.spec.full_name
+ requirement = current.request.dependency.requirement
+ path << "#{current.spec.full_name} (#{requirement})"
- current = current.requester
- else
- raise Gem::Exception, "[BUG] unknown request class #{current.class}"
- end
+ current = current.parent
end
path = ['user request (gem command or Gemfile)'] if path.empty?
@@ -158,3 +120,4 @@ end
# TODO: Remove in RubyGems 3
Gem::Resolver::DependencyConflict = Gem::Resolver::Conflict # :nodoc:
+
diff --git a/lib/rubygems/resolver/current_set.rb b/lib/rubygems/resolver/current_set.rb
index 265c639f15..4e8d34026b 100644
--- a/lib/rubygems/resolver/current_set.rb
+++ b/lib/rubygems/resolver/current_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A set which represents the installed gems. Respects
# all the normal settings that control where to look
diff --git a/lib/rubygems/resolver/dependency_request.rb b/lib/rubygems/resolver/dependency_request.rb
index c2918911cd..e63b443c62 100644
--- a/lib/rubygems/resolver/dependency_request.rb
+++ b/lib/rubygems/resolver/dependency_request.rb
@@ -1,30 +1,19 @@
-# frozen_string_literal: true
##
# Used Internally. Wraps a Dependency object to also track which spec
# contained the Dependency.
class Gem::Resolver::DependencyRequest
- ##
- # The wrapped Gem::Dependency
-
attr_reader :dependency
- ##
- # The request for this dependency.
-
attr_reader :requester
- ##
- # Creates a new DependencyRequest for +dependency+ from +requester+.
- # +requester may be nil if the request came from a user.
-
- def initialize dependency, requester
- @dependency = dependency
- @requester = requester
+ def initialize(dep, act)
+ @dependency = dep
+ @requester = act
end
- def == other # :nodoc:
+ def ==(other)
case other
when Gem::Dependency
@dependency == other
@@ -35,62 +24,26 @@ class Gem::Resolver::DependencyRequest
end
end
- ##
- # Is this dependency a development dependency?
-
- def development?
- @dependency.type == :development
- end
-
- ##
- # Does this dependency request match +spec+?
- #
- # NOTE: #match? only matches prerelease versions when #dependency is a
- # prerelease dependency.
-
- def match? spec, allow_prerelease = false
- @dependency.match? spec, nil, allow_prerelease
- end
-
- ##
- # Does this dependency request match +spec+?
- #
- # NOTE: #matches_spec? matches prerelease versions. See also #match?
-
def matches_spec?(spec)
@dependency.matches_spec? spec
end
- ##
- # The name of the gem this dependency request is requesting.
-
def name
@dependency.name
end
- def type
- @dependency.type
- end
-
- ##
# Indicate that the request is for a gem explicitly requested by the user
-
def explicit?
@requester.nil?
end
- ##
- # Indicate that the request is for a gem requested as a dependency of
- # another gem
-
+ # Indicate that the requset is for a gem requested as a dependency of another gem
def implicit?
!explicit?
end
- ##
# Return a String indicating who caused this request to be added (only
# valid for implicit requests)
-
def request_context
@requester ? @requester.request : "(unknown)"
end
@@ -106,9 +59,6 @@ class Gem::Resolver::DependencyRequest
end
end
- ##
- # The version requirement for this dependency request
-
def requirement
@dependency.requirement
end
@@ -118,3 +68,4 @@ class Gem::Resolver::DependencyRequest
end
end
+
diff --git a/lib/rubygems/resolver/git_set.rb b/lib/rubygems/resolver/git_set.rb
index 723a202d7a..c912e367d9 100644
--- a/lib/rubygems/resolver/git_set.rb
+++ b/lib/rubygems/resolver/git_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A GitSet represents gems that are sourced from git repositories.
#
@@ -12,12 +11,6 @@
class Gem::Resolver::GitSet < Gem::Resolver::Set
##
- # The root directory for git gems in this set. This is usually Gem.dir, the
- # installation directory for regular gems.
-
- attr_accessor :root_dir
-
- ##
# Contains repositories needing submodules
attr_reader :need_submodules # :nodoc:
@@ -34,12 +27,9 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
attr_reader :specs # :nodoc:
def initialize # :nodoc:
- super()
-
@git = ENV['git'] || 'git'
@need_submodules = {}
@repositories = {}
- @root_dir = Gem.dir
@specs = {}
end
@@ -49,39 +39,13 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
end
##
- # Adds and returns a GitSpecification with the given +name+ and +version+
- # which came from a +repository+ at the given +reference+. If +submodules+
- # is true they are checked out along with the repository.
- #
- # This fills in the prefetch information as enough information about the gem
- # is present in the arguments.
-
- def add_git_spec name, version, repository, reference, submodules # :nodoc:
- add_git_gem name, repository, reference, submodules
-
- source = Gem::Source::Git.new name, repository, reference
- source.root_dir = @root_dir
-
- spec = Gem::Specification.new do |s|
- s.name = name
- s.version = version
- end
-
- git_spec = Gem::Resolver::GitSpecification.new self, spec, source
-
- @specs[spec.name] = git_spec
-
- git_spec
- end
-
- ##
# Finds all git gems matching +req+
def find_all req
prefetch nil
specs.values.select do |spec|
- req.match? spec
+ req.matches_spec? spec
end
end
@@ -93,8 +57,6 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
@repositories.each do |name, (repository, reference)|
source = Gem::Source::Git.new name, repository, reference
- source.root_dir = @root_dir
- source.remote = @remote
source.specs.each do |spec|
git_spec = Gem::Resolver::GitSpecification.new self, spec, source
@@ -104,20 +66,5 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
end
end
- def pretty_print q # :nodoc:
- q.group 2, '[GitSet', ']' do
- next if @repositories.empty?
- q.breakable
-
- repos = @repositories.map do |name, (repository, reference)|
- "#{name}: #{repository}@#{reference}"
- end
-
- q.seplist repos do |repo|
- q.text repo
- end
- end
- end
-
end
diff --git a/lib/rubygems/resolver/git_specification.rb b/lib/rubygems/resolver/git_specification.rb
index 2448797d3f..ac8d4e9aeb 100644
--- a/lib/rubygems/resolver/git_specification.rb
+++ b/lib/rubygems/resolver/git_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A GitSpecification represents a gem that is sourced from a git repository
# and is being loaded through a gem dependencies file through the +git:+
@@ -13,47 +12,5 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
@source == other.source
end
- def add_dependency dependency # :nodoc:
- spec.dependencies << dependency
- end
-
- ##
- # Installing a git gem only involves building the extensions and generating
- # the executables.
-
- def install options = {}
- require 'rubygems/installer'
-
- installer = Gem::Installer.for_spec spec, options
-
- yield installer if block_given?
-
- installer.run_pre_install_hooks
- installer.build_extensions
- installer.run_post_build_hooks
- installer.generate_bin
- installer.run_post_install_hooks
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[GitSpecification', ']' do
- q.breakable
- q.text "name: #{name}"
-
- q.breakable
- q.text "version: #{version}"
-
- q.breakable
- q.text 'dependencies:'
- q.breakable
- q.pp dependencies
-
- q.breakable
- q.text "source:"
- q.breakable
- q.pp @source
- end
- end
-
end
diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb
index 2450f14b4f..0ba3c78a44 100644
--- a/lib/rubygems/resolver/index_set.rb
+++ b/lib/rubygems/resolver/index_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# The global rubygems pool represented via the traditional
# source index.
@@ -6,8 +5,6 @@
class Gem::Resolver::IndexSet < Gem::Resolver::Set
def initialize source = nil # :nodoc:
- super()
-
@f =
if source then
sources = Gem::SourceList.from [source]
@@ -19,9 +16,7 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
@all = Hash.new { |h,k| h[k] = [] }
- list, errors = @f.available_specs :complete
-
- @errors.concat errors
+ list, = @f.available_specs :released
list.each do |uri, specs|
specs.each do |n|
@@ -39,12 +34,10 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
def find_all req
res = []
- return res unless @remote
-
name = req.dependency.name
@all[name].each do |uri, n|
- if req.match? n, @prerelease then
+ if req.dependency.match? n then
res << Gem::Resolver::IndexSpecification.new(
self, n.name, n.version, uri, n.platform)
end
@@ -53,29 +46,5 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
res
end
- def pretty_print q # :nodoc:
- q.group 2, '[IndexSet', ']' do
- q.breakable
- q.text 'sources:'
- q.breakable
- q.pp @f.sources
-
- q.breakable
- q.text 'specs:'
-
- q.breakable
-
- names = @all.values.map do |tuples|
- tuples.map do |_, tuple|
- tuple.full_name
- end
- end.flatten
-
- q.seplist names do |name|
- q.text name
- end
- end
- end
-
end
diff --git a/lib/rubygems/resolver/index_specification.rb b/lib/rubygems/resolver/index_specification.rb
index 4340f46943..56fecb5753 100644
--- a/lib/rubygems/resolver/index_specification.rb
+++ b/lib/rubygems/resolver/index_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Represents a possible Specification object returned from IndexSet. Used to
# delay needed to download full Specification objects when only the +name+
diff --git a/lib/rubygems/resolver/installed_specification.rb b/lib/rubygems/resolver/installed_specification.rb
index d9c6a5e5cf..647ff7499a 100644
--- a/lib/rubygems/resolver/installed_specification.rb
+++ b/lib/rubygems/resolver/installed_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# An InstalledSpecification represents a gem that is already installed
# locally.
@@ -12,39 +11,15 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
end
##
- # This is a null install as this specification is already installed.
- # +options+ are ignored.
-
- def install options = {}
- yield nil
- end
-
- ##
# Returns +true+ if this gem is installable for the current platform.
def installable_platform?
# BACKCOMPAT If the file is coming out of a specified file, then we
# ignore the platform. This code can be removed in RG 3.0.
- return true if @source.kind_of? Gem::Source::SpecificFile
-
- super
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[InstalledSpecification', ']' do
- q.breakable
- q.text "name: #{name}"
-
- q.breakable
- q.text "version: #{version}"
-
- q.breakable
- q.text "platform: #{platform}"
-
- q.breakable
- q.text 'dependencies:'
- q.breakable
- q.pp spec.dependencies
+ if @source.kind_of? Gem::Source::SpecificFile
+ return true
+ else
+ Gem::Platform.match @spec.platform
end
end
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
index 1ed02e6f9f..73d9e39651 100644
--- a/lib/rubygems/resolver/installer_set.rb
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A set of gems for installation sourced from remote sources and local .gem
# files
@@ -21,72 +20,20 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
attr_accessor :ignore_installed # :nodoc:
- ##
- # The remote_set looks up remote gems for installation.
-
- attr_reader :remote_set # :nodoc:
-
- ##
- # Creates a new InstallerSet that will look for gems in +domain+.
-
def initialize domain
- super()
-
@domain = domain
- @remote = consider_remote?
@f = Gem::SpecFetcher.fetcher
+ @all = Hash.new { |h,k| h[k] = [] }
@always_install = []
@ignore_dependencies = false
@ignore_installed = false
- @local = {}
- @remote_set = Gem::Resolver::BestSet.new
+ @loaded_remote_specs = []
@specs = {}
end
##
- # Looks up the latest specification for +dependency+ and adds it to the
- # always_install list.
-
- def add_always_install dependency
- request = Gem::Resolver::DependencyRequest.new dependency, nil
-
- found = find_all request
-
- found.delete_if { |s|
- s.version.prerelease? and not s.local?
- } unless dependency.prerelease?
-
- found = found.select do |s|
- Gem::Source::SpecificFile === s.source or
- Gem::Platform::RUBY == s.platform or
- Gem::Platform.local === s.platform
- end
-
- if found.empty? then
- exc = Gem::UnsatisfiableDependencyError.new request
- exc.errors = errors
-
- raise exc
- end
-
- newest = found.max_by do |s|
- [s.version, s.platform == Gem::Platform::RUBY ? -1 : 1]
- end
-
- @always_install << newest.spec
- end
-
- ##
- # Adds a local gem requested using +dep_name+ with the given +spec+ that can
- # be loaded and installed using the +source+.
-
- def add_local dep_name, spec, source
- @local[dep_name] = [spec, source]
- end
-
- ##
# Should local gems should be considered?
def consider_local? # :nodoc:
@@ -101,13 +48,6 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
##
- # Errors encountered while resolving gems
-
- def errors
- @errors + @remote_set.errors
- end
-
- ##
# Returns an array of IndexSpecification objects matching DependencyRequest
# +req+.
@@ -117,53 +57,39 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
dep = req.dependency
return res if @ignore_dependencies and
- @always_install.none? { |spec| dep.match? spec }
+ @always_install.none? { |spec| dep.matches_spec? spec }
name = dep.name
dep.matching_specs.each do |gemspec|
- next if @always_install.any? { |spec| spec.name == gemspec.name }
+ next if @always_install.include? gemspec
res << Gem::Resolver::InstalledSpecification.new(self, gemspec)
end unless @ignore_installed
if consider_local? then
- matching_local = @local.values.select do |spec, _|
- req.match? spec
- end.map do |spec, source|
- Gem::Resolver::LocalSpecification.new self, spec, source
- end
-
- res.concat matching_local
-
local_source = Gem::Source::Local.new
- if local_spec = local_source.find_gem(name, dep.requirement) then
+ if spec = local_source.find_gem(name, dep.requirement) then
res << Gem::Resolver::IndexSpecification.new(
- self, local_spec.name, local_spec.version,
- local_source, local_spec.platform)
+ self, spec.name, spec.version, local_source, spec.platform)
end
end
- res.delete_if do |spec|
- spec.version.prerelease? and not dep.prerelease?
- end
+ if consider_remote? then
+ load_remote_specs dep
- res.concat @remote_set.find_all req if consider_remote?
+ @all[name].each do |remote_source, n|
+ if dep.match? n then
+ res << Gem::Resolver::IndexSpecification.new(
+ self, n.name, n.version, remote_source, n.platform)
+ end
+ end
+ end
res
end
- def prefetch(reqs)
- @remote_set.prefetch(reqs) if consider_remote?
- end
-
- def prerelease= allow_prerelease
- super
-
- @remote_set.prerelease = allow_prerelease
- end
-
def inspect # :nodoc:
always_install = @always_install.map { |s| s.full_name }
@@ -173,6 +99,27 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
##
+ # Loads remote prerelease specs if +dep+ is a prerelease dependency
+
+ def load_remote_specs dep # :nodoc:
+ types = [:released]
+ types << :prerelease if dep.prerelease?
+
+ types.each do |type|
+ next if @loaded_remote_specs.include? type
+ @loaded_remote_specs << type
+
+ list, = @f.available_specs type
+
+ list.each do |uri, specs|
+ specs.each do |n|
+ @all[n.name] << [uri, n]
+ end
+ end
+ end
+ end
+
+ ##
# Called from IndexSpecification to get a true Specification
# object.
@@ -186,15 +133,6 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
end
- ##
- # Has a local gem for +dep_name+ been added to this set?
-
- def local? dep_name # :nodoc:
- spec, = @local[dep_name]
-
- spec
- end
-
def pretty_print q # :nodoc:
q.group 2, '[InstallerSet', ']' do
q.breakable
@@ -210,16 +148,5 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
end
- def remote= remote # :nodoc:
- case @domain
- when :local then
- @domain = :both if remote
- when :remote then
- @domain = nil unless remote
- when :both then
- @domain = :local unless remote
- end
- end
-
end
diff --git a/lib/rubygems/resolver/local_specification.rb b/lib/rubygems/resolver/local_specification.rb
deleted file mode 100644
index 1d9d22f0ac..0000000000
--- a/lib/rubygems/resolver/local_specification.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# frozen_string_literal: true
-##
-# A LocalSpecification comes from a .gem file on the local filesystem.
-
-class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
-
- ##
- # Returns +true+ if this gem is installable for the current platform.
-
- def installable_platform?
- return true if @source.kind_of? Gem::Source::SpecificFile
-
- super
- end
-
- def local? # :nodoc:
- true
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[LocalSpecification', ']' do
- q.breakable
- q.text "name: #{name}"
-
- q.breakable
- q.text "version: #{version}"
-
- q.breakable
- q.text "platform: #{platform}"
-
- q.breakable
- q.text 'dependencies:'
- q.breakable
- q.pp dependencies
-
- q.breakable
- q.text "source: #{@source.path}"
- end
- end
-
-end
-
diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb
index 7fddc93e1c..6885e70945 100644
--- a/lib/rubygems/resolver/lock_set.rb
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A set of gems from a gem dependencies lockfile.
@@ -7,16 +6,11 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
attr_reader :specs # :nodoc:
##
- # Creates a new LockSet from the given +sources+
+ # Creates a new LockSet from the given +source+
- def initialize sources
- super()
-
- @sources = sources.map do |source|
- Gem::Source::Lock.new source
- end
-
- @specs = []
+ def initialize source
+ @source = source
+ @specs = []
end
##
@@ -28,13 +22,12 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
def add name, version, platform # :nodoc:
version = Gem::Version.new version
- specs = [
- Gem::Resolver::LockSpecification.new(self, name, version, @sources, platform)
- ]
- @specs.concat specs
+ spec =
+ Gem::Resolver::IndexSpecification.new self, name, version, @source,
+ platform
- specs
+ @specs << spec
end
##
@@ -43,7 +36,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
def find_all req
@specs.select do |spec|
- req.match? spec
+ req.matches_spec? spec
end
end
@@ -63,21 +56,5 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
found.source.fetch_spec tuple
end
- def pretty_print q # :nodoc:
- q.group 2, '[LockSet', ']' do
- q.breakable
- q.text 'source:'
-
- q.breakable
- q.pp @source
-
- q.breakable
- q.text 'specs:'
-
- q.breakable
- q.pp @specs.map { |spec| spec.full_name }
- end
- end
-
end
diff --git a/lib/rubygems/resolver/lock_specification.rb b/lib/rubygems/resolver/lock_specification.rb
deleted file mode 100644
index f485675673..0000000000
--- a/lib/rubygems/resolver/lock_specification.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# frozen_string_literal: true
-##
-# The LockSpecification comes from a lockfile (Gem::RequestSet::Lockfile).
-#
-# A LockSpecification's dependency information is pre-filled from the
-# lockfile.
-
-class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
-
- attr_reader :sources
-
- def initialize set, name, version, sources, platform
- super()
-
- @name = name
- @platform = platform
- @set = set
- @source = sources.first
- @sources = sources
- @version = version
-
- @dependencies = []
- @spec = nil
- end
-
- ##
- # This is a null install as a locked specification is considered installed.
- # +options+ are ignored.
-
- def install options = {}
- destination = options[:install_dir] || Gem.dir
-
- if File.exist? File.join(destination, 'specifications', spec.spec_name) then
- yield nil
- return
- end
-
- super
- end
-
- ##
- # Adds +dependency+ from the lockfile to this specification
-
- def add_dependency dependency # :nodoc:
- @dependencies << dependency
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[LockSpecification', ']' do
- q.breakable
- q.text "name: #{@name}"
-
- q.breakable
- q.text "version: #{@version}"
-
- unless @platform == Gem::Platform::RUBY then
- q.breakable
- q.text "platform: #{@platform}"
- end
-
- unless @dependencies.empty? then
- q.breakable
- q.text 'dependencies:'
- q.breakable
- q.pp @dependencies
- end
- end
- end
-
- ##
- # A specification constructed from the lockfile is returned
-
- def spec
- @spec ||= Gem::Specification.find { |spec|
- spec.name == @name and spec.version == @version
- }
-
- @spec ||= Gem::Specification.new do |s|
- s.name = @name
- s.version = @version
- s.platform = @platform
-
- s.dependencies.concat @dependencies
- end
- end
-
-end
-
diff --git a/lib/rubygems/resolver/molinillo.rb b/lib/rubygems/resolver/molinillo.rb
deleted file mode 100644
index 2357f41bee..0000000000
--- a/lib/rubygems/resolver/molinillo.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# frozen_string_literal: true
-require 'rubygems/resolver/molinillo/lib/molinillo'
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo.rb b/lib/rubygems/resolver/molinillo/lib/molinillo.rb
deleted file mode 100644
index 0ae4b6a912..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-require 'rubygems/resolver/molinillo/lib/molinillo/gem_metadata'
-require 'rubygems/resolver/molinillo/lib/molinillo/errors'
-require 'rubygems/resolver/molinillo/lib/molinillo/resolver'
-require 'rubygems/resolver/molinillo/lib/molinillo/modules/ui'
-require 'rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider'
-
-# Gem::Resolver::Molinillo is a generic dependency resolution algorithm.
-module Gem::Resolver::Molinillo
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
deleted file mode 100644
index deb4659448..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
+++ /dev/null
@@ -1,287 +0,0 @@
-# frozen_string_literal: true
-require 'set'
-require 'tsort'
-
-module Gem::Resolver::Molinillo
- # A directed acyclic graph that is tuned to hold named dependencies
- class DependencyGraph
- include Enumerable
-
- # Enumerates through the vertices of the graph.
- # @return [Array<Vertex>] The graph's vertices.
- def each
- vertices.values.each { |v| yield v }
- end
-
- include TSort
-
- # @visibility private
- alias_method :tsort_each_node, :each
-
- # @visibility private
- def tsort_each_child(vertex, &block)
- vertex.successors.each(&block)
- end
-
- # Topologically sorts the given vertices.
- # @param [Enumerable<Vertex>] vertices the vertices to be sorted, which must
- # all belong to the same graph.
- # @return [Array<Vertex>] The sorted vertices.
- def self.tsort(vertices)
- TSort.tsort(
- lambda { |b| vertices.each(&b) },
- lambda { |v, &b| (v.successors & vertices).each(&b) }
- )
- end
-
- # A directed edge of a {DependencyGraph}
- # @attr [Vertex] origin The origin of the directed edge
- # @attr [Vertex] destination The destination of the directed edge
- # @attr [Object] requirement The requirement the directed edge represents
- Edge = Struct.new(:origin, :destination, :requirement)
-
- # @return [{String => Vertex}] the vertices of the dependency graph, keyed
- # by {Vertex#name}
- attr_reader :vertices
-
- # Initializes an empty dependency graph
- def initialize
- @vertices = {}
- end
-
- # Initializes a copy of a {DependencyGraph}, ensuring that all {#vertices}
- # are properly copied.
- # @param [DependencyGraph] other the graph to copy.
- def initialize_copy(other)
- super
- @vertices = {}
- traverse = lambda do |new_v, old_v|
- return if new_v.outgoing_edges.size == old_v.outgoing_edges.size
- old_v.outgoing_edges.each do |edge|
- destination = add_vertex(edge.destination.name, edge.destination.payload)
- add_edge_no_circular(new_v, destination, edge.requirement)
- traverse.call(destination, edge.destination)
- end
- end
- other.vertices.each do |name, vertex|
- new_vertex = add_vertex(name, vertex.payload, vertex.root?)
- new_vertex.explicit_requirements.replace(vertex.explicit_requirements)
- traverse.call(new_vertex, vertex)
- end
- end
-
- # @return [String] a string suitable for debugging
- def inspect
- "#{self.class}:#{vertices.values.inspect}"
- end
-
- # @return [Boolean] whether the two dependency graphs are equal, determined
- # by a recursive traversal of each {#root_vertices} and its
- # {Vertex#successors}
- def ==(other)
- return false unless other
- vertices.each do |name, vertex|
- other_vertex = other.vertex_named(name)
- return false unless other_vertex
- return false unless other_vertex.successors.map(&:name).to_set == vertex.successors.map(&:name).to_set
- end
- end
-
- # @param [String] name
- # @param [Object] payload
- # @param [Array<String>] parent_names
- # @param [Object] requirement the requirement that is requiring the child
- # @return [void]
- def add_child_vertex(name, payload, parent_names, requirement)
- vertex = add_vertex(name, payload)
- parent_names.each do |parent_name|
- unless parent_name
- vertex.root = true
- next
- end
- parent_node = vertex_named(parent_name)
- add_edge(parent_node, vertex, requirement)
- end
- vertex
- end
-
- # Adds a vertex with the given name, or updates the existing one.
- # @param [String] name
- # @param [Object] payload
- # @return [Vertex] the vertex that was added to `self`
- def add_vertex(name, payload, root = false)
- vertex = vertices[name] ||= Vertex.new(name, payload)
- vertex.payload ||= payload
- vertex.root ||= root
- vertex
- end
-
- # Detaches the {#vertex_named} `name` {Vertex} from the graph, recursively
- # removing any non-root vertices that were orphaned in the process
- # @param [String] name
- # @return [void]
- def detach_vertex_named(name)
- return unless vertex = vertices.delete(name)
- vertex.outgoing_edges.each do |e|
- v = e.destination
- v.incoming_edges.delete(e)
- detach_vertex_named(v.name) unless v.root? || v.predecessors.any?
- end
- end
-
- # @param [String] name
- # @return [Vertex,nil] the vertex with the given name
- def vertex_named(name)
- vertices[name]
- end
-
- # @param [String] name
- # @return [Vertex,nil] the root vertex with the given name
- def root_vertex_named(name)
- vertex = vertex_named(name)
- vertex if vertex && vertex.root?
- end
-
- # Adds a new {Edge} to the dependency graph
- # @param [Vertex] origin
- # @param [Vertex] destination
- # @param [Object] requirement the requirement that this edge represents
- # @return [Edge] the added edge
- def add_edge(origin, destination, requirement)
- if destination.path_to?(origin)
- raise CircularDependencyError.new([origin, destination])
- end
- add_edge_no_circular(origin, destination, requirement)
- end
-
- private
-
- # Adds a new {Edge} to the dependency graph without checking for
- # circularity.
- def add_edge_no_circular(origin, destination, requirement)
- edge = Edge.new(origin, destination, requirement)
- origin.outgoing_edges << edge
- destination.incoming_edges << edge
- edge
- end
-
- # A vertex in a {DependencyGraph} that encapsulates a {#name} and a
- # {#payload}
- class Vertex
- # @return [String] the name of the vertex
- attr_accessor :name
-
- # @return [Object] the payload the vertex holds
- attr_accessor :payload
-
- # @return [Arrary<Object>] the explicit requirements that required
- # this vertex
- attr_reader :explicit_requirements
-
- # @return [Boolean] whether the vertex is considered a root vertex
- attr_accessor :root
- alias_method :root?, :root
-
- # Initializes a vertex with the given name and payload.
- # @param [String] name see {#name}
- # @param [Object] payload see {#payload}
- def initialize(name, payload)
- @name = name
- @payload = payload
- @explicit_requirements = []
- @outgoing_edges = []
- @incoming_edges = []
- end
-
- # @return [Array<Object>] all of the requirements that required
- # this vertex
- def requirements
- incoming_edges.map(&:requirement) + explicit_requirements
- end
-
- # @return [Array<Edge>] the edges of {#graph} that have `self` as their
- # {Edge#origin}
- attr_accessor :outgoing_edges
-
- # @return [Array<Edge>] the edges of {#graph} that have `self` as their
- # {Edge#destination}
- attr_accessor :incoming_edges
-
- # @return [Array<Vertex>] the vertices of {#graph} that have an edge with
- # `self` as their {Edge#destination}
- def predecessors
- incoming_edges.map(&:origin)
- end
-
- # @return [Array<Vertex>] the vertices of {#graph} where `self` is a
- # {#descendent?}
- def recursive_predecessors
- vertices = predecessors
- vertices += vertices.map(&:recursive_predecessors).flatten(1)
- vertices.uniq!
- vertices
- end
-
- # @return [Array<Vertex>] the vertices of {#graph} that have an edge with
- # `self` as their {Edge#origin}
- def successors
- outgoing_edges.map(&:destination)
- end
-
- # @return [Array<Vertex>] the vertices of {#graph} where `self` is an
- # {#ancestor?}
- def recursive_successors
- vertices = successors
- vertices += vertices.map(&:recursive_successors).flatten(1)
- vertices.uniq!
- vertices
- end
-
- # @return [String] a string suitable for debugging
- def inspect
- "#{self.class}:#{name}(#{payload.inspect})"
- end
-
- # @return [Boolean] whether the two vertices are equal, determined
- # by a recursive traversal of each {Vertex#successors}
- def ==(other)
- shallow_eql?(other) &&
- successors.to_set == other.successors.to_set
- end
-
- # @param [Vertex] other the other vertex to compare to
- # @return [Boolean] whether the two vertices are equal, determined
- # solely by {#name} and {#payload} equality
- def shallow_eql?(other)
- other &&
- name == other.name &&
- payload == other.payload
- end
-
- alias_method :eql?, :==
-
- # @return [Fixnum] a hash for the vertex based upon its {#name}
- def hash
- name.hash
- end
-
- # Is there a path from `self` to `other` following edges in the
- # dependency graph?
- # @return true iff there is a path following edges within this {#graph}
- def path_to?(other)
- equal?(other) || successors.any? { |v| v.path_to?(other) }
- end
-
- alias_method :descendent?, :path_to?
-
- # Is there a path from `other` to `self` following edges in the
- # dependency graph?
- # @return true iff there is a path following edges within this {#graph}
- def ancestor?(other)
- other.path_to?(self)
- end
-
- alias_method :is_reachable_from?, :ancestor?
- end
- end
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb
deleted file mode 100644
index 3fad948392..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# frozen_string_literal: true
-module Gem::Resolver::Molinillo
- # An error that occurred during the resolution process
- class ResolverError < StandardError; end
-
- # An error caused by searching for a dependency that is completely unknown,
- # i.e. has no versions available whatsoever.
- class NoSuchDependencyError < ResolverError
- # @return [Object] the dependency that could not be found
- attr_accessor :dependency
-
- # @return [Array<Object>] the specifications that depended upon {#dependency}
- attr_accessor :required_by
-
- # Initializes a new error with the given missing dependency.
- # @param [Object] dependency @see {#dependency}
- # @param [Array<Object>] required_by @see {#required_by}
- def initialize(dependency, required_by = [])
- @dependency = dependency
- @required_by = required_by
- super()
- end
-
- # The error message for the missing dependency, including the specifications
- # that had this dependency.
- def message
- sources = required_by.map { |r| "`#{r}`" }.join(' and ')
- message = "Unable to find a specification for `#{dependency}`"
- message << " depended upon by #{sources}" unless sources.empty?
- message
- end
- end
-
- # An error caused by attempting to fulfil a dependency that was circular
- #
- # @note This exception will be thrown iff a {Vertex} is added to a
- # {DependencyGraph} that has a {DependencyGraph::Vertex#path_to?} an
- # existing {DependencyGraph::Vertex}
- class CircularDependencyError < ResolverError
- # [Set<Object>] the dependencies responsible for causing the error
- attr_reader :dependencies
-
- # Initializes a new error with the given circular vertices.
- # @param [Array<DependencyGraph::Vertex>] nodes the nodes in the dependency
- # that caused the error
- def initialize(nodes)
- super "There is a circular dependency between #{nodes.map(&:name).join(' and ')}"
- @dependencies = nodes.map(&:payload).to_set
- end
- end
-
- # An error caused by conflicts in version
- class VersionConflict < ResolverError
- # @return [{String => Resolution::Conflict}] the conflicts that caused
- # resolution to fail
- attr_reader :conflicts
-
- # Initializes a new error with the given version conflicts.
- # @param [{String => Resolution::Conflict}] conflicts see {#conflicts}
- def initialize(conflicts)
- pairs = []
- conflicts.values.flatten.map(&:requirements).flatten.each do |conflicting|
- conflicting.each do |source, conflict_requirements|
- conflict_requirements.each do |c|
- pairs << [c, source]
- end
- end
- end
-
- super "Unable to satisfy the following requirements:\n\n" \
- "#{pairs.map { |r, d| "- `#{r}` required by `#{d}`" }.join("\n")}"
- @conflicts = conflicts
- end
- end
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
deleted file mode 100644
index 79cae2c697..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-module Gem::Resolver::Molinillo
- # The version of Gem::Resolver::Molinillo.
- VERSION = '0.4.1'.freeze
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb
deleted file mode 100644
index 916345b12a..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-# frozen_string_literal: true
-module Gem::Resolver::Molinillo
- # Provides information about specifcations and dependencies to the resolver,
- # allowing the {Resolver} class to remain generic while still providing power
- # and flexibility.
- #
- # This module contains the methods that users of Gem::Resolver::Molinillo must to implement,
- # using knowledge of their own model classes.
- module SpecificationProvider
- # Search for the specifications that match the given dependency.
- # The specifications in the returned array will be considered in reverse
- # order, so the latest version ought to be last.
- # @note This method should be 'pure', i.e. the return value should depend
- # only on the `dependency` parameter.
- #
- # @param [Object] dependency
- # @return [Array<Object>] the specifications that satisfy the given
- # `dependency`.
- def search_for(dependency)
- []
- end
-
- # Returns the dependencies of `specification`.
- # @note This method should be 'pure', i.e. the return value should depend
- # only on the `specification` parameter.
- #
- # @param [Object] specification
- # @return [Array<Object>] the dependencies that are required by the given
- # `specification`.
- def dependencies_for(specification)
- []
- end
-
- # Determines whether the given `requirement` is satisfied by the given
- # `spec`, in the context of the current `activated` dependency graph.
- #
- # @param [Object] requirement
- # @param [DependencyGraph] activated the current dependency graph in the
- # resolution process.
- # @param [Object] spec
- # @return [Boolean] whether `requirement` is satisfied by `spec` in the
- # context of the current `activated` dependency graph.
- def requirement_satisfied_by?(requirement, activated, spec)
- true
- end
-
- # Returns the name for the given `dependency`.
- # @note This method should be 'pure', i.e. the return value should depend
- # only on the `dependency` parameter.
- #
- # @param [Object] dependency
- # @return [String] the name for the given `dependency`.
- def name_for(dependency)
- dependency.to_s
- end
-
- # @return [String] the name of the source of explicit dependencies, i.e.
- # those passed to {Resolver#resolve} directly.
- def name_for_explicit_dependency_source
- 'user-specified dependency'
- end
-
- # @return [String] the name of the source of 'locked' dependencies, i.e.
- # those passed to {Resolver#resolve} directly as the `base`
- def name_for_locking_dependency_source
- 'Lockfile'
- end
-
- # Sort dependencies so that the ones that are easiest to resolve are first.
- # Easiest to resolve is (usually) defined by:
- # 1) Is this dependency already activated?
- # 2) How relaxed are the requirements?
- # 3) Are there any conflicts for this dependency?
- # 4) How many possibilities are there to satisfy this dependency?
- #
- # @param [Array<Object>] dependencies
- # @param [DependencyGraph] activated the current dependency graph in the
- # resolution process.
- # @param [{String => Array<Conflict>}] conflicts
- # @return [Array<Object>] a sorted copy of `dependencies`.
- def sort_dependencies(dependencies, activated, conflicts)
- dependencies.sort_by do |dependency|
- name = name_for(dependency)
- [
- activated.vertex_named(name).payload ? 0 : 1,
- conflicts[name] ? 0 : 1,
- ]
- end
- end
-
- # Returns whether this dependency, which has no possible matching
- # specifications, can safely be ignored.
- #
- # @param [Object] dependency
- # @return [Boolean] whether this dependency can safely be skipped.
- def allow_missing?(dependency)
- false
- end
- end
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb
deleted file mode 100644
index 348ace286a..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# frozen_string_literal: true
-module Gem::Resolver::Molinillo
- # Conveys information about the resolution process to a user.
- module UI
- # The {IO} object that should be used to print output. `STDOUT`, by default.
- #
- # @return [IO]
- def output
- STDOUT
- end
-
- # Called roughly every {#progress_rate}, this method should convey progress
- # to the user.
- #
- # @return [void]
- def indicate_progress
- output.print '.' unless debug?
- end
-
- # How often progress should be conveyed to the user via
- # {#indicate_progress}, in seconds. A third of a second, by default.
- #
- # @return [Float]
- def progress_rate
- 0.33
- end
-
- # Called before resolution begins.
- #
- # @return [void]
- def before_resolution
- output.print 'Resolving dependencies...'
- end
-
- # Called after resolution ends (either successfully or with an error).
- # By default, prints a newline.
- #
- # @return [void]
- def after_resolution
- output.puts
- end
-
- # Conveys debug information to the user.
- #
- # @param [Integer] depth the current depth of the resolution process.
- # @return [void]
- def debug(depth = 0)
- if debug?
- debug_info = yield
- debug_info = debug_info.inspect unless debug_info.is_a?(String)
- output.puts debug_info.split("\n").map { |s| ' ' * depth + s }
- end
- end
-
- # Whether or not debug messages should be printed.
- # By default, whether or not the `MOLINILLO_DEBUG` environment variable is
- # set.
- #
- # @return [Boolean]
- def debug?
- @debug_mode ||= ENV['MOLINILLO_DEBUG']
- end
- end
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
deleted file mode 100644
index 0f822f0b82..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
+++ /dev/null
@@ -1,436 +0,0 @@
-# frozen_string_literal: true
-module Gem::Resolver::Molinillo
- class Resolver
- # A specific resolution from a given {Resolver}
- class Resolution
- # A conflict that the resolution process encountered
- # @attr [Object] requirement the requirement that immediately led to the conflict
- # @attr [{String,Nil=>[Object]}] requirements the requirements that caused the conflict
- # @attr [Object, nil] existing the existing spec that was in conflict with
- # the {#possibility}
- # @attr [Object] possibility the spec that was unable to be activated due
- # to a conflict
- # @attr [Object] locked_requirement the relevant locking requirement.
- # @attr [Array<Array<Object>>] requirement_trees the different requirement
- # trees that led to every requirement for the conflicting name.
- # @attr [{String=>Object}] activated_by_name the already-activated specs.
- Conflict = Struct.new(
- :requirement,
- :requirements,
- :existing,
- :possibility,
- :locked_requirement,
- :requirement_trees,
- :activated_by_name
- )
-
- # @return [SpecificationProvider] the provider that knows about
- # dependencies, requirements, specifications, versions, etc.
- attr_reader :specification_provider
-
- # @return [UI] the UI that knows how to communicate feedback about the
- # resolution process back to the user
- attr_reader :resolver_ui
-
- # @return [DependencyGraph] the base dependency graph to which
- # dependencies should be 'locked'
- attr_reader :base
-
- # @return [Array] the dependencies that were explicitly required
- attr_reader :original_requested
-
- # Initializes a new resolution.
- # @param [SpecificationProvider] specification_provider
- # see {#specification_provider}
- # @param [UI] resolver_ui see {#resolver_ui}
- # @param [Array] requested see {#original_requested}
- # @param [DependencyGraph] base see {#base}
- def initialize(specification_provider, resolver_ui, requested, base)
- @specification_provider = specification_provider
- @resolver_ui = resolver_ui
- @original_requested = requested
- @base = base
- @states = []
- @iteration_counter = 0
- end
-
- # Resolves the {#original_requested} dependencies into a full dependency
- # graph
- # @raise [ResolverError] if successful resolution is impossible
- # @return [DependencyGraph] the dependency graph of successfully resolved
- # dependencies
- def resolve
- start_resolution
-
- while state
- break unless state.requirements.any? || state.requirement
- indicate_progress
- if state.respond_to?(:pop_possibility_state) # DependencyState
- debug(depth) { "Creating possibility state for #{requirement} (#{possibilities.count} remaining)" }
- state.pop_possibility_state.tap { |s| states.push(s) if s }
- end
- process_topmost_state
- end
-
- activated.freeze
- ensure
- end_resolution
- end
-
- # @return [Integer] the number of resolver iterations in between calls to
- # {#resolver_ui}'s {UI#indicate_progress} method
- attr_accessor :iteration_rate
- private :iteration_rate
-
- # @return [Time] the time at which resolution began
- attr_accessor :started_at
- private :started_at
-
- # @return [Array<ResolutionState>] the stack of states for the resolution
- attr_accessor :states
- private :states
-
- private
-
- # Sets up the resolution process
- # @return [void]
- def start_resolution
- @started_at = Time.now
-
- handle_missing_or_push_dependency_state(initial_state)
-
- debug { "Starting resolution (#{@started_at})" }
- resolver_ui.before_resolution
- end
-
- # Ends the resolution process
- # @return [void]
- def end_resolution
- resolver_ui.after_resolution
- debug do
- "Finished resolution (#{@iteration_counter} steps) " \
- "(Took #{(ended_at = Time.now) - @started_at} seconds) (#{ended_at})"
- end
- debug { 'Unactivated: ' + Hash[activated.vertices.reject { |_n, v| v.payload }].keys.join(', ') } if state
- debug { 'Activated: ' + Hash[activated.vertices.select { |_n, v| v.payload }].keys.join(', ') } if state
- end
-
- require 'rubygems/resolver/molinillo/lib/molinillo/state'
- require 'rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider'
-
- ResolutionState.new.members.each do |member|
- define_method member do |*args, &block|
- current_state = state || ResolutionState.empty
- current_state.send(member, *args, &block)
- end
- end
-
- SpecificationProvider.instance_methods(false).each do |instance_method|
- define_method instance_method do |*args, &block|
- begin
- specification_provider.send(instance_method, *args, &block)
- rescue NoSuchDependencyError => error
- if state
- vertex = activated.vertex_named(name_for error.dependency)
- error.required_by += vertex.incoming_edges.map { |e| e.origin.name }
- error.required_by << name_for_explicit_dependency_source unless vertex.explicit_requirements.empty?
- end
- raise
- end
- end
- end
-
- # Processes the topmost available {RequirementState} on the stack
- # @return [void]
- def process_topmost_state
- if possibility
- attempt_to_activate
- else
- create_conflict if state.is_a? PossibilityState
- unwind_for_conflict until possibility && state.is_a?(DependencyState)
- end
- end
-
- # @return [Object] the current possibility that the resolution is trying
- # to activate
- def possibility
- possibilities.last
- end
-
- # @return [RequirementState] the current state the resolution is
- # operating upon
- def state
- states.last
- end
-
- # Creates the initial state for the resolution, based upon the
- # {#requested} dependencies
- # @return [DependencyState] the initial state for the resolution
- def initial_state
- graph = DependencyGraph.new.tap do |dg|
- original_requested.each { |r| dg.add_vertex(name_for(r), nil, true).tap { |v| v.explicit_requirements << r } }
- end
-
- requirements = sort_dependencies(original_requested, graph, {})
- initial_requirement = requirements.shift
- DependencyState.new(
- initial_requirement && name_for(initial_requirement),
- requirements,
- graph,
- initial_requirement,
- initial_requirement && search_for(initial_requirement),
- 0,
- {}
- )
- end
-
- # Unwinds the states stack because a conflict has been encountered
- # @return [void]
- def unwind_for_conflict
- debug(depth) { "Unwinding for conflict: #{requirement}" }
- conflicts.tap do |c|
- states.slice!((state_index_for_unwind + 1)..-1)
- raise VersionConflict.new(c) unless state
- state.conflicts = c
- end
- end
-
- # @return [Integer] The index to which the resolution should unwind in the
- # case of conflict.
- def state_index_for_unwind
- current_requirement = requirement
- existing_requirement = requirement_for_existing_name(name)
- until current_requirement.nil?
- current_state = find_state_for(current_requirement)
- return states.index(current_state) if state_any?(current_state)
- current_requirement = parent_of(current_requirement)
- end
-
- until existing_requirement.nil?
- existing_state = find_state_for(existing_requirement)
- return states.index(existing_state) if state_any?(existing_state)
- existing_requirement = parent_of(existing_requirement)
- end
- -1
- end
-
- # @return [Object] the requirement that led to `requirement` being added
- # to the list of requirements.
- def parent_of(requirement)
- return nil unless requirement
- seen = false
- state = states.reverse_each.find do |s|
- seen ||= s.requirement == requirement || s.requirements.include?(requirement)
- seen && s.requirement != requirement && !s.requirements.include?(requirement)
- end
- state && state.requirement
- end
-
- # @return [Object] the requirement that led to a version of a possibility
- # with the given name being activated.
- def requirement_for_existing_name(name)
- return nil unless activated.vertex_named(name).payload
- states.reverse_each.find { |s| !s.activated.vertex_named(name).payload }.requirement
- end
-
- # @return [ResolutionState] the state whose `requirement` is the given
- # `requirement`.
- def find_state_for(requirement)
- return nil unless requirement
- states.reverse_each.find { |i| requirement == i.requirement && i.is_a?(DependencyState) }
- end
-
- # @return [Boolean] whether or not the given state has any possibilities
- # left.
- def state_any?(state)
- state && state.possibilities.any?
- end
-
- # @return [Conflict] a {Conflict} that reflects the failure to activate
- # the {#possibility} in conjunction with the current {#state}
- def create_conflict
- vertex = activated.vertex_named(name)
- requirements = {
- name_for_explicit_dependency_source => vertex.explicit_requirements,
- name_for_locking_dependency_source => Array(locked_requirement_named(name)),
- }
- vertex.incoming_edges.each { |edge| (requirements[edge.origin.payload] ||= []).unshift(edge.requirement) }
- conflicts[name] = Conflict.new(
- requirement,
- Hash[requirements.select { |_, r| !r.empty? }],
- vertex.payload,
- possibility,
- locked_requirement_named(name),
- requirement_trees,
- Hash[activated.map { |v| [v.name, v.payload] }.select(&:last)]
- )
- end
-
- # @return [Array<Array<Object>>] The different requirement
- # trees that led to every requirement for the current spec.
- def requirement_trees
- vertex = activated.vertex_named(name)
- vertex.requirements.map { |r| requirement_tree_for(r) }
- end
-
- # @return [Array<Object>] the list of requirements that led to
- # `requirement` being required.
- def requirement_tree_for(requirement)
- tree = []
- while requirement
- tree.unshift(requirement)
- requirement = parent_of(requirement)
- end
- tree
- end
-
- # Indicates progress roughly once every second
- # @return [void]
- def indicate_progress
- @iteration_counter += 1
- @progress_rate ||= resolver_ui.progress_rate
- if iteration_rate.nil?
- if Time.now - started_at >= @progress_rate
- self.iteration_rate = @iteration_counter
- end
- end
-
- if iteration_rate && (@iteration_counter % iteration_rate) == 0
- resolver_ui.indicate_progress
- end
- end
-
- # Calls the {#resolver_ui}'s {UI#debug} method
- # @param [Integer] depth the depth of the {#states} stack
- # @param [Proc] block a block that yields a {#to_s}
- # @return [void]
- def debug(depth = 0, &block)
- resolver_ui.debug(depth, &block)
- end
-
- # Attempts to activate the current {#possibility}
- # @return [void]
- def attempt_to_activate
- debug(depth) { 'Attempting to activate ' + possibility.to_s }
- existing_node = activated.vertex_named(name)
- if existing_node.payload
- debug(depth) { "Found existing spec (#{existing_node.payload})" }
- attempt_to_activate_existing_spec(existing_node)
- else
- attempt_to_activate_new_spec
- end
- end
-
- # Attempts to activate the current {#possibility} (given that it has
- # already been activated)
- # @return [void]
- def attempt_to_activate_existing_spec(existing_node)
- existing_spec = existing_node.payload
- if requirement_satisfied_by?(requirement, activated, existing_spec)
- new_requirements = requirements.dup
- push_state_for_requirements(new_requirements, false)
- else
- return if attempt_to_swap_possibility
- create_conflict
- debug(depth) { "Unsatisfied by existing spec (#{existing_node.payload})" }
- unwind_for_conflict
- end
- end
-
- # Attempts to swp the current {#possibility} with the already-activated
- # spec with the given name
- # @return [Boolean] Whether the possibility was swapped into {#activated}
- def attempt_to_swap_possibility
- swapped = activated.dup
- swapped.vertex_named(name).payload = possibility
- return unless swapped.vertex_named(name).requirements.
- all? { |r| requirement_satisfied_by?(r, swapped, possibility) }
- attempt_to_activate_new_spec
- end
-
- # Attempts to activate the current {#possibility} (given that it hasn't
- # already been activated)
- # @return [void]
- def attempt_to_activate_new_spec
- satisfied = begin
- locked_requirement = locked_requirement_named(name)
- requested_spec_satisfied = requirement_satisfied_by?(requirement, activated, possibility)
- locked_spec_satisfied = !locked_requirement ||
- requirement_satisfied_by?(locked_requirement, activated, possibility)
- debug(depth) { 'Unsatisfied by requested spec' } unless requested_spec_satisfied
- debug(depth) { 'Unsatisfied by locked spec' } unless locked_spec_satisfied
- requested_spec_satisfied && locked_spec_satisfied
- end
- if satisfied
- activate_spec
- else
- create_conflict
- unwind_for_conflict
- end
- end
-
- # @param [String] requirement_name the spec name to search for
- # @return [Object] the locked spec named `requirement_name`, if one
- # is found on {#base}
- def locked_requirement_named(requirement_name)
- vertex = base.vertex_named(requirement_name)
- vertex && vertex.payload
- end
-
- # Add the current {#possibility} to the dependency graph of the current
- # {#state}
- # @return [void]
- def activate_spec
- conflicts.delete(name)
- debug(depth) { 'Activated ' + name + ' at ' + possibility.to_s }
- vertex = activated.vertex_named(name)
- vertex.payload = possibility
- require_nested_dependencies_for(possibility)
- end
-
- # Requires the dependencies that the recently activated spec has
- # @param [Object] activated_spec the specification that has just been
- # activated
- # @return [void]
- def require_nested_dependencies_for(activated_spec)
- nested_dependencies = dependencies_for(activated_spec)
- debug(depth) { "Requiring nested dependencies (#{nested_dependencies.map(&:to_s).join(', ')})" }
- nested_dependencies.each { |d| activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d) }
-
- push_state_for_requirements(requirements + nested_dependencies, nested_dependencies.size > 0)
- end
-
- # Pushes a new {DependencyState} that encapsulates both existing and new
- # requirements
- # @param [Array] new_requirements
- # @return [void]
- def push_state_for_requirements(new_requirements, requires_sort = true, new_activated = activated.dup)
- new_requirements = sort_dependencies(new_requirements.uniq, new_activated, conflicts) if requires_sort
- new_requirement = new_requirements.shift
- new_name = new_requirement ? name_for(new_requirement) : ''
- possibilities = new_requirement ? search_for(new_requirement) : []
- handle_missing_or_push_dependency_state DependencyState.new(
- new_name, new_requirements, new_activated,
- new_requirement, possibilities, depth, conflicts.dup
- )
- end
-
- # Pushes a new {DependencyState}.
- # If the {#specification_provider} says to
- # {SpecificationProvider#allow_missing?} that particular requirement, and
- # there are no possibilities for that requirement, then `state` is not
- # pushed, and the node in {#activated} is removed, and we continue
- # resolving the remaining requirements.
- # @param [DependencyState] state
- # @return [void]
- def handle_missing_or_push_dependency_state(state)
- if state.requirement && state.possibilities.empty? && allow_missing?(state.requirement)
- state.activated.detach_vertex_named(state.name)
- push_state_for_requirements(state.requirements.dup, false, state.activated)
- else
- states.push state
- end
- end
- end
- end
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb
deleted file mode 100644
index 5c59a45c3d..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# frozen_string_literal: true
-require 'rubygems/resolver/molinillo/lib/molinillo/dependency_graph'
-
-module Gem::Resolver::Molinillo
- # This class encapsulates a dependency resolver.
- # The resolver is responsible for determining which set of dependencies to
- # activate, with feedback from the {#specification_provider}
- #
- #
- class Resolver
- require 'rubygems/resolver/molinillo/lib/molinillo/resolution'
-
- # @return [SpecificationProvider] the specification provider used
- # in the resolution process
- attr_reader :specification_provider
-
- # @return [UI] the UI module used to communicate back to the user
- # during the resolution process
- attr_reader :resolver_ui
-
- # Initializes a new resolver.
- # @param [SpecificationProvider] specification_provider
- # see {#specification_provider}
- # @param [UI] resolver_ui
- # see {#resolver_ui}
- def initialize(specification_provider, resolver_ui)
- @specification_provider = specification_provider
- @resolver_ui = resolver_ui
- end
-
- # Resolves the requested dependencies into a {DependencyGraph},
- # locking to the base dependency graph (if specified)
- # @param [Array] requested an array of 'requested' dependencies that the
- # {#specification_provider} can understand
- # @param [DependencyGraph,nil] base the base dependency graph to which
- # dependencies should be 'locked'
- def resolve(requested, base = DependencyGraph.new)
- Resolution.new(specification_provider,
- resolver_ui,
- requested,
- base).
- resolve
- end
- end
-end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb
deleted file mode 100644
index ac25538a5a..0000000000
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# frozen_string_literal: true
-module Gem::Resolver::Molinillo
- # A state that a {Resolution} can be in
- # @attr [String] name the name of the current requirement
- # @attr [Array<Object>] requirements currently unsatisfied requirements
- # @attr [DependencyGraph] activated the graph of activated dependencies
- # @attr [Object] requirement the current requirement
- # @attr [Object] possibilities the possibilities to satisfy the current requirement
- # @attr [Integer] depth the depth of the resolution
- # @attr [Set<Object>] conflicts unresolved conflicts
- ResolutionState = Struct.new(
- :name,
- :requirements,
- :activated,
- :requirement,
- :possibilities,
- :depth,
- :conflicts
- )
-
- class ResolutionState
- # Returns an empty resolution state
- # @return [ResolutionState] an empty state
- def self.empty
- new(nil, [], DependencyGraph.new, nil, nil, 0, Set.new)
- end
- end
-
- # A state that encapsulates a set of {#requirements} with an {Array} of
- # possibilities
- class DependencyState < ResolutionState
- # Removes a possibility from `self`
- # @return [PossibilityState] a state with a single possibility,
- # the possibility that was removed from `self`
- def pop_possibility_state
- PossibilityState.new(
- name,
- requirements.dup,
- activated.dup,
- requirement,
- [possibilities.pop],
- depth + 1,
- conflicts.dup
- )
- end
- end
-
- # A state that encapsulates a single possibility to fulfill the given
- # {#requirement}
- class PossibilityState < ResolutionState
- end
-end
diff --git a/lib/rubygems/resolver/requirement_list.rb b/lib/rubygems/resolver/requirement_list.rb
index 2768c80170..04e437b2a9 100644
--- a/lib/rubygems/resolver/requirement_list.rb
+++ b/lib/rubygems/resolver/requirement_list.rb
@@ -1,37 +1,21 @@
-# frozen_string_literal: true
##
-# The RequirementList is used to hold the requirements being considered
-# while resolving a set of gems.
-#
-# The RequirementList acts like a queue where the oldest items are removed
-# first.
+# Used internally to hold the requirements being considered
+# while attempting to find a proper activation set.
class Gem::Resolver::RequirementList
include Enumerable
- ##
- # Creates a new RequirementList.
-
def initialize
- @exact = []
@list = []
end
- def initialize_copy other # :nodoc:
- @exact = @exact.dup
+ def initialize_copy(other)
@list = @list.dup
end
- ##
- # Adds Resolver::DependencyRequest +req+ to this requirements list.
-
def add(req)
- if req.requirement.exact?
- @exact.push req
- else
- @list.push req
- end
+ @list.push req
req
end
@@ -41,42 +25,20 @@ class Gem::Resolver::RequirementList
def each # :nodoc:
return enum_for __method__ unless block_given?
- @exact.each do |requirement|
- yield requirement
- end
-
@list.each do |requirement|
yield requirement
end
end
- ##
- # How many elements are in the list
-
- def size
- @exact.size + @list.size
- end
-
- ##
- # Is the list empty?
-
def empty?
- @exact.empty? && @list.empty?
+ @list.empty?
end
- ##
- # Remove the oldest DependencyRequest from the list.
-
def remove
- return @exact.shift unless @exact.empty?
@list.shift
end
- ##
- # Returns the oldest five entries from the list.
-
def next5
- x = @exact[0,5]
- x + @list[0,5 - x.size]
+ @list[0,5]
end
end
diff --git a/lib/rubygems/resolver/set.rb b/lib/rubygems/resolver/set.rb
index cc12633d46..32c137ef6b 100644
--- a/lib/rubygems/resolver/set.rb
+++ b/lib/rubygems/resolver/set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Resolver sets are used to look up specifications (and their
# dependencies) used in resolution. This set is abstract.
@@ -6,27 +5,6 @@
class Gem::Resolver::Set
##
- # Set to true to disable network access for this set
-
- attr_accessor :remote
-
- ##
- # Errors encountered when resolving gems
-
- attr_accessor :errors
-
- ##
- # When true, allows matching of requests to prerelease gems.
-
- attr_accessor :prerelease
-
- def initialize # :nodoc:
- @prerelease = false
- @remote = true
- @errors = []
- end
-
- ##
# The find_all method must be implemented. It returns all Resolver
# Specification objects matching the given DependencyRequest +req+.
@@ -45,13 +23,5 @@ class Gem::Resolver::Set
def prefetch reqs
end
- ##
- # When true, this set is allowed to access the network when looking up
- # specifications or dependencies.
-
- def remote? # :nodoc:
- @remote
- end
-
end
diff --git a/lib/rubygems/resolver/source_set.rb b/lib/rubygems/resolver/source_set.rb
deleted file mode 100644
index 66f5963e54..0000000000
--- a/lib/rubygems/resolver/source_set.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-##
-# The SourceSet chooses the best available method to query a remote index.
-#
-# Kind off like BestSet but filters the sources for gems
-
-class Gem::Resolver::SourceSet < Gem::Resolver::Set
-
- ##
- # Creates a SourceSet for the given +sources+ or Gem::sources if none are
- # specified. +sources+ must be a Gem::SourceList.
-
- def initialize
- super()
-
- @links = {}
- @sets = {}
- end
-
- def find_all req # :nodoc:
- if set = get_set(req.dependency.name)
- set.find_all req
- else
- []
- end
- end
-
- # potentially no-op
- def prefetch reqs # :nodoc:
- reqs.each do |req|
- if set = get_set(req.dependency.name)
- set.prefetch reqs
- end
- end
- end
-
- def add_source_gem name, source
- @links[name] = source
- end
-
-private
-
- def get_set(name)
- link = @links[name]
- @sets[link] ||= Gem::Source.new(link).dependency_resolver_set if link
- end
-
-end
-
diff --git a/lib/rubygems/resolver/spec_specification.rb b/lib/rubygems/resolver/spec_specification.rb
index 35ee8cc247..0c411bdf5f 100644
--- a/lib/rubygems/resolver/spec_specification.rb
+++ b/lib/rubygems/resolver/spec_specification.rb
@@ -1,10 +1,11 @@
-# frozen_string_literal: true
##
# The Resolver::SpecSpecification contains common functionality for
# Resolver specifications that are backed by a Gem::Specification.
class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification
+ attr_reader :spec # :nodoc:
+
##
# A SpecSpecification is created for a +set+ for a Gem::Specification in
# +spec+. The +source+ is either where the +spec+ came from, or should be
diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb
index 44989d39ae..7dd4c2e829 100644
--- a/lib/rubygems/resolver/specification.rb
+++ b/lib/rubygems/resolver/specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A Resolver::Specification contains a subset of the information
# contained in a Gem::Specification. Only the information necessary for
@@ -32,14 +31,6 @@ class Gem::Resolver::Specification
attr_reader :source
##
- # The Gem::Specification for this Resolver::Specification.
- #
- # Implementers, note that #install updates @spec, so be sure to cache the
- # Gem::Specification in @spec when overriding.
-
- attr_reader :spec
-
- ##
# The version of the gem for this specification.
attr_reader :version
@@ -57,13 +48,6 @@ class Gem::Resolver::Specification
end
##
- # Fetches development dependencies if the source does not provide them by
- # default (see APISpecification).
-
- def fetch_development_dependencies # :nodoc:
- end
-
- ##
# The name and version of the specification.
#
# Unlike Gem::Specification#full_name, the platform is not included.
@@ -72,40 +56,5 @@ class Gem::Resolver::Specification
"#{@name}-#{@version}"
end
- ##
- # Installs this specification using the Gem::Installer +options+. The
- # install method yields a Gem::Installer instance, which indicates the
- # gem will be installed, or +nil+, which indicates the gem is already
- # installed.
- #
- # After installation #spec is updated to point to the just-installed
- # specification.
-
- def install options = {}
- require 'rubygems/installer'
-
- destination = options[:install_dir] || Gem.dir
-
- Gem.ensure_gem_subdirectories destination
-
- gem = source.download spec, destination
-
- installer = Gem::Installer.at gem, options
-
- yield installer if block_given?
-
- @spec = installer.install
- end
-
- ##
- # Returns true if this specification is installable on this platform.
-
- def installable_platform?
- Gem::Platform.match spec.platform
- end
-
- def local? # :nodoc:
- false
- end
end
diff --git a/lib/rubygems/resolver/stats.rb b/lib/rubygems/resolver/stats.rb
deleted file mode 100644
index 3b95efebf7..0000000000
--- a/lib/rubygems/resolver/stats.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# frozen_string_literal: true
-class Gem::Resolver::Stats
- def initialize
- @max_depth = 0
- @max_requirements = 0
- @requirements = 0
- @backtracking = 0
- @iterations = 0
- end
-
- def record_depth(stack)
- if stack.size > @max_depth
- @max_depth = stack.size
- end
- end
-
- def record_requirements(reqs)
- if reqs.size > @max_requirements
- @max_requirements = reqs.size
- end
- end
-
- def requirement!
- @requirements += 1
- end
-
- def backtracking!
- @backtracking += 1
- end
-
- def iteration!
- @iterations += 1
- end
-
- PATTERN = "%20s: %d\n"
-
- def display
- $stdout.puts "=== Resolver Statistics ==="
- $stdout.printf PATTERN, "Max Depth", @max_depth
- $stdout.printf PATTERN, "Total Requirements", @requirements
- $stdout.printf PATTERN, "Max Requirements", @max_requirements
- $stdout.printf PATTERN, "Backtracking #", @backtracking
- $stdout.printf PATTERN, "Iteration #", @iterations
- end
-end
diff --git a/lib/rubygems/resolver/vendor_set.rb b/lib/rubygems/resolver/vendor_set.rb
index f30ce534af..e9cbcd8303 100644
--- a/lib/rubygems/resolver/vendor_set.rb
+++ b/lib/rubygems/resolver/vendor_set.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A VendorSet represents gems that have been unpacked into a specific
# directory that contains a gemspec.
@@ -16,14 +15,7 @@
class Gem::Resolver::VendorSet < Gem::Resolver::Set
- ##
- # The specifications for this set.
-
- attr_reader :specs # :nodoc:
-
def initialize # :nodoc:
- super()
-
@directories = {}
@specs = {}
end
@@ -40,12 +32,10 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
raise Gem::GemNotFoundException,
"unable to find #{gemspec} for gem #{name}" unless spec
- spec.full_gem_path = File.expand_path directory
+ key = "#{spec.name}-#{spec.version}-#{spec.platform}"
- @specs[spec.name] = spec
+ @specs[key] = spec
@directories[spec] = directory
-
- spec
end
##
@@ -54,7 +44,7 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
def find_all req
@specs.values.select do |spec|
- req.match? spec
+ req.matches_spec? spec
end.map do |spec|
source = Gem::Source::Vendor.new @directories[spec]
Gem::Resolver::VendorSpecification.new self, spec, source
@@ -62,26 +52,14 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
end
##
- # Loads a spec with the given +name+. +version+, +platform+ and +source+ are
- # ignored.
+ # Loads a spec with the given +name+, +version+ and +platform+. Since the
+ # +source+ is defined when the specification was added to index it is not
+ # used.
def load_spec name, version, platform, source # :nodoc:
- @specs.fetch name
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[VendorSet', ']' do
- next if @directories.empty?
- q.breakable
+ key = "#{name}-#{version}-#{platform}"
- dirs = @directories.map do |spec, directory|
- "#{spec.full_name}: #{directory}"
- end
-
- q.seplist dirs do |dir|
- q.text dir
- end
- end
+ @specs.fetch key
end
end
diff --git a/lib/rubygems/resolver/vendor_specification.rb b/lib/rubygems/resolver/vendor_specification.rb
index c624f3e834..24e033d084 100644
--- a/lib/rubygems/resolver/vendor_specification.rb
+++ b/lib/rubygems/resolver/vendor_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A VendorSpecification represents a gem that has been unpacked into a project
# and is being loaded through a gem dependencies file through the +path:+
@@ -13,13 +12,5 @@ class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification
@source == other.source
end
- ##
- # This is a null install as this gem was unpacked into a directory.
- # +options+ are ignored.
-
- def install options = {}
- yield nil
- end
-
end
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb
deleted file mode 100644
index b98cfaa5e6..0000000000
--- a/lib/rubygems/safe_yaml.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-module Gem
-
- ###
- # This module is used for safely loading YAML specs from a gem. The
- # `safe_load` method defined on this module is specifically designed for
- # loading Gem specifications. For loading other YAML safely, please see
- # Psych.safe_load
-
- module SafeYAML
- WHITELISTED_CLASSES = %w(
- Symbol
- Time
- Date
- Gem::Dependency
- Gem::Platform
- Gem::Requirement
- Gem::Specification
- Gem::Version
- Gem::Version::Requirement
- YAML::Syck::DefaultKey
- Syck::DefaultKey
- )
-
- WHITELISTED_SYMBOLS = %w(
- development
- runtime
- )
-
- if ::YAML.respond_to? :safe_load
- def self.safe_load input
- ::YAML.safe_load(input, WHITELISTED_CLASSES, WHITELISTED_SYMBOLS, true)
- end
-
- def self.load input
- ::YAML.safe_load(input, [::Symbol])
- end
- else
- warn "YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0)."
- def self.safe_load input, *args
- ::YAML.load input
- end
-
- def self.load input
- ::YAML.load input
- end
- end
- end
-end
diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb
index 119d6d56f7..bfd6fd225b 100644
--- a/lib/rubygems/security.rb
+++ b/lib/rubygems/security.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -121,11 +120,11 @@ end
# * HighSecurity - Here's the bugger that got us into this mess.
# The HighSecurity policy is identical to the MediumSecurity policy,
# except that it does not allow unsigned gems. A malicious user
-# doesn't have a whole lot of options here; they can't modify the
-# package contents without invalidating the signature, and they can't
+# doesn't have a whole lot of options here; he can't modify the
+# package contents without invalidating the signature, and he can't
# modify or remove signature or the signing certificate chain, or
# RubyGems will simply refuse to install the package. Oh well, maybe
-# they'll have better luck causing problems for CPAN users instead :).
+# he'll have better luck causing problems for CPAN users instead :).
#
# The reason RubyGems refused to install your shiny new signed gem was because
# it was from an untrusted source. Well, your code is infallible (naturally),
@@ -340,7 +339,7 @@ module Gem::Security
# Digest algorithm used to sign gems
DIGEST_ALGORITHM =
- if defined?(OpenSSL::Digest::SHA1) then
+ if defined?(OpenSSL::Digest) then
OpenSSL::Digest::SHA1
end
@@ -356,7 +355,7 @@ module Gem::Security
# Algorithm for creating the key pair used to sign gems
KEY_ALGORITHM =
- if defined?(OpenSSL::PKey::RSA) then
+ if defined?(OpenSSL::PKey) then
OpenSSL::PKey::RSA
end
diff --git a/lib/rubygems/security/policies.rb b/lib/rubygems/security/policies.rb
index f16c46306a..a976ecaf59 100644
--- a/lib/rubygems/security/policies.rb
+++ b/lib/rubygems/security/policies.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
module Gem::Security
##
diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb
index f43e6c8c96..7238b2e477 100644
--- a/lib/rubygems/security/policy.rb
+++ b/lib/rubygems/security/policy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/user_interaction'
##
@@ -158,7 +157,7 @@ class Gem::Security::Policy
path = Gem::Security.trust_dir.cert_path root
unless File.exist? path then
- message = "root cert #{root.subject} is not trusted".dup
+ message = "root cert #{root.subject} is not trusted"
message << " (root of signing cert #{chain.last.subject})" if
chain.length > 1
@@ -219,7 +218,6 @@ class Gem::Security::Policy
# against
else
alert_warning "#{full_name} is not signed"
- return
end
end
@@ -293,3 +291,4 @@ class Gem::Security::Policy
alias to_s name # :nodoc:
end
+
diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb
index 1c9d9b7d3b..bb1eae7cf2 100644
--- a/lib/rubygems/security/signer.rb
+++ b/lib/rubygems/security/signer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Basic OpenSSL-based package signing class.
@@ -123,7 +122,7 @@ class Gem::Security::Signer
# ~/.gem/gem-public_cert.pem.expired.%Y%m%d%H%M%S
#
# If the signing certificate can be re-signed the expired certificate will
- # be saved as ~/.gem/gem-public_cert.pem.expired.%Y%m%d%H%M%S where the
+ # be saved as ~/.gem/gem-pubilc_cert.pem.expired.%Y%m%d%H%M%S where the
# expiry time (not after) is used for the timestamp.
def re_sign_key # :nodoc:
diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb
index bf44975cc6..dd51308ee5 100644
--- a/lib/rubygems/security/trust_dir.rb
+++ b/lib/rubygems/security/trust_dir.rb
@@ -1,27 +1,10 @@
-# frozen_string_literal: true
-##
-# The TrustDir manages the trusted certificates for gem signature
-# verification.
-
class Gem::Security::TrustDir
- ##
- # Default permissions for the trust directory and its contents
-
DEFAULT_PERMISSIONS = {
:trust_dir => 0700,
:trusted_cert => 0600,
}
- ##
- # The directory where trusted certificates will be stored.
-
- attr_reader :dir
-
- ##
- # Creates a new TrustDir using +dir+ where the directory and file
- # permissions will be checked according to +permissions+
-
def initialize dir, permissions = DEFAULT_PERMISSIONS
@dir = dir
@permissions = permissions
@@ -29,6 +12,8 @@ class Gem::Security::TrustDir
@digester = Gem::Security::DIGEST_ALGORITHM
end
+ attr_reader :dir
+
##
# Returns the path to the trusted +certificate+
diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
index 8d6a96b1c2..ca6dc683f5 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'webrick'
require 'zlib'
require 'erb'
@@ -531,36 +530,6 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
end
end
- def prerelease_specs req, res
- reset_gems
-
- res['content-type'] = 'application/x-gzip'
-
- add_date res
-
- specs = Gem::Specification.select do |spec|
- spec.version.prerelease?
- end.sort.map do |spec|
- platform = spec.original_platform || Gem::Platform::RUBY
- [spec.name, spec.version, platform]
- end
-
- specs = Marshal.dump specs
-
- if req.path =~ /\.gz$/ then
- specs = Gem.gzip specs
- res['content-type'] = 'application/x-gzip'
- else
- res['content-type'] = 'application/octet-stream'
- end
-
- if req.request_method == 'HEAD' then
- res['content-length'] = specs.length
- else
- res.body << specs
- end
- end
-
def quick(req, res)
reset_gems
@@ -568,7 +537,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
add_date res
case req.request_uri.path
- when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)-([0-9.]+[^-]*?)(-.*?)?\.gemspec\.rz$| then
+ when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)-([0-9.]+)(-.*?)?\.gemspec\.rz$| then
marshal_format, name, version, platform = $1, $2, $3, $4
specs = Gem::Specification.find_all_by_name name, version
@@ -788,11 +757,6 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
@server.mount_proc "/latest_specs.#{Gem.marshal_version}.gz",
method(:latest_specs)
- @server.mount_proc "/prerelease_specs.#{Gem.marshal_version}",
- method(:prerelease_specs)
- @server.mount_proc "/prerelease_specs.#{Gem.marshal_version}.gz",
- method(:prerelease_specs)
-
@server.mount_proc "/quick/", method(:quick)
@server.mount_proc("/gem-server-rdoc-style.css") do |req, res|
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index 85f5268fa3..b6e2d97523 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'uri'
require 'fileutils'
@@ -27,12 +26,8 @@ class Gem::Source
# Creates a new Source which will use the index located at +uri+.
def initialize(uri)
- begin
- unless uri.kind_of? URI
- uri = URI.parse(uri.to_s)
- end
- rescue URI::InvalidURIError
- raise if Gem::Source == self.class
+ unless uri.kind_of? URI
+ uri = URI.parse(uri.to_s)
end
@uri = uri
@@ -54,7 +49,6 @@ class Gem::Source
case other
when Gem::Source::Installed,
Gem::Source::Local,
- Gem::Source::Lock,
Gem::Source::SpecificFile,
Gem::Source::Git,
Gem::Source::Vendor then
@@ -83,21 +77,15 @@ class Gem::Source
# Returns a Set that can fetch specifications from this source.
def dependency_resolver_set # :nodoc:
- return Gem::Resolver::IndexSet.new self if 'file' == api_uri.scheme
-
bundler_api_uri = api_uri + './api/v1/dependencies'
begin
fetcher = Gem::RemoteFetcher.fetcher
- response = fetcher.fetch_path bundler_api_uri, nil, true
+ fetcher.fetch_path bundler_api_uri, nil, true
rescue Gem::RemoteFetcher::FetchError
Gem::Resolver::IndexSet.new self
else
- if response.respond_to? :uri then
- Gem::Resolver::APISet.new response.uri
- else
- Gem::Resolver::APISet.new bundler_api_uri
- end
+ Gem::Resolver::APISet.new bundler_api_uri
end
end
@@ -111,8 +99,6 @@ class Gem::Source
def cache_dir(uri)
# Correct for windows paths
escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
- escaped_path.untaint
-
File.join Gem.spec_cache_dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
end
@@ -215,10 +201,7 @@ class Gem::Source
q.group 2, '[Remote:', ']' do
q.breakable
q.text @uri.to_s
-
if api = api_uri
- q.breakable
- q.text 'API URI: '
q.text api.to_s
end
end
@@ -230,6 +213,5 @@ require 'rubygems/source/git'
require 'rubygems/source/installed'
require 'rubygems/source/specific_file'
require 'rubygems/source/local'
-require 'rubygems/source/lock'
require 'rubygems/source/vendor'
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb
index 0900da0cbc..c4f2724645 100644
--- a/lib/rubygems/source/git.rb
+++ b/lib/rubygems/source/git.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'digest'
require 'rubygems/util'
@@ -10,7 +9,9 @@ require 'rubygems/util'
# source =
# Gem::Source::Git.new 'rake', 'git@example:rake.git', 'rake-10.1.0', false
#
-# source.specs
+# spec = source.load_spec 'rake'
+#
+# source.checkout
class Gem::Source::Git < Gem::Source
@@ -25,21 +26,11 @@ class Gem::Source::Git < Gem::Source
attr_reader :reference
##
- # When false the cache for this repository will not be updated.
-
- attr_accessor :remote
-
- ##
# The git repository this gem is sourced from.
attr_reader :repository
##
- # The directory for cache and git gem installation
-
- attr_accessor :root_dir
-
- ##
# Does this repository need submodules checked out too?
attr_reader :need_submodules
@@ -52,24 +43,21 @@ class Gem::Source::Git < Gem::Source
# will be checked out when the gem is installed.
def initialize name, repository, reference, submodules = false
- super repository
+ super(nil)
@name = name
@repository = repository
@reference = reference
@need_submodules = submodules
- @remote = true
- @root_dir = Gem.dir
- @git = ENV['git'] || 'git'
+ @git = ENV['git'] || 'git'
end
def <=> other
case other
when Gem::Source::Git then
0
- when Gem::Source::Vendor,
- Gem::Source::Lock then
+ when Gem::Source::Installed then
-1
when Gem::Source then
1
@@ -92,8 +80,6 @@ class Gem::Source::Git < Gem::Source
def checkout # :nodoc:
cache
- return false unless File.exist? repo_cache_dir
-
unless File.exist? install_dir then
system @git, 'clone', '--quiet', '--no-checkout',
repo_cache_dir, install_dir
@@ -102,11 +88,11 @@ class Gem::Source::Git < Gem::Source
Dir.chdir install_dir do
system @git, 'fetch', '--quiet', '--force', '--tags', install_dir
- success = system @git, 'reset', '--quiet', '--hard', rev_parse
+ success = system @git, 'reset', '--quiet', '--hard', @reference
success &&=
- Gem::Util.silent_system @git, 'submodule', 'update',
- '--quiet', '--init', '--recursive' if @need_submodules
+ system @git, 'submodule', 'update',
+ '--quiet', '--init', '--recursive', out: IO::NULL if @need_submodules
success
end
@@ -116,8 +102,6 @@ class Gem::Source::Git < Gem::Source
# Creates a local cache repository for the git gem.
def cache # :nodoc:
- return unless @remote
-
if File.exist? repo_cache_dir then
Dir.chdir repo_cache_dir do
system @git, 'fetch', '--quiet', '--force', '--tags',
@@ -130,13 +114,6 @@ class Gem::Source::Git < Gem::Source
end
##
- # Directory where git gems get unpacked and so-forth.
-
- def base_dir # :nodoc:
- File.join @root_dir, 'bundler'
- end
-
- ##
# A short reference for use in git gem directories
def dir_shortref # :nodoc:
@@ -153,43 +130,23 @@ class Gem::Source::Git < Gem::Source
# The directory where the git gem will be installed.
def install_dir # :nodoc:
- return unless File.exist? repo_cache_dir
-
- File.join base_dir, 'gems', "#{@name}-#{dir_shortref}"
- end
-
- def pretty_print q # :nodoc:
- q.group 2, '[Git: ', ']' do
- q.breakable
- q.text @repository
-
- q.breakable
- q.text @reference
- end
+ File.join Gem.dir, 'bundler', 'gems', "#{@name}-#{dir_shortref}"
end
##
# The directory where the git gem's repository will be cached.
def repo_cache_dir # :nodoc:
- File.join @root_dir, 'cache', 'bundler', 'git', "#{@name}-#{uri_hash}"
+ File.join Gem.dir, 'cache', 'bundler', 'git', "#{@name}-#{uri_hash}"
end
##
# Converts the git reference for the repository into a commit hash.
def rev_parse # :nodoc:
- hash = nil
-
Dir.chdir repo_cache_dir do
- hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip
+ Gem::Util.popen(@git, 'rev-parse', @reference).strip
end
-
- raise Gem::Exception,
- "unable to find reference #{@reference} in #{@repository}" unless
- $?.success?
-
- hash
end
##
@@ -198,25 +155,13 @@ class Gem::Source::Git < Gem::Source
def specs
checkout
- return [] unless install_dir
-
Dir.chdir install_dir do
Dir['{,*,*/*}.gemspec'].map do |spec_file|
directory = File.dirname spec_file
file = File.basename spec_file
Dir.chdir directory do
- spec = Gem::Specification.load file
- if spec then
- spec.base_dir = base_dir
-
- spec.extension_dir =
- File.join base_dir, 'extensions', Gem::Platform.local.to_s,
- Gem.extension_api_version, "#{name}-#{dir_shortref}"
-
- spec.full_gem_path = File.dirname spec.loaded_from if spec
- end
- spec
+ Gem::Specification.load file
end
end.compact
end
diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb
index 300491e467..2661dd6844 100644
--- a/lib/rubygems/source/installed.rb
+++ b/lib/rubygems/source/installed.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Represents an installed gem. This is used for dependency resolution.
@@ -13,9 +12,7 @@ class Gem::Source::Installed < Gem::Source
def <=> other
case other
- when Gem::Source::Git,
- Gem::Source::Lock,
- Gem::Source::Vendor then
+ when Gem::Source::Vendor then
-1
when Gem::Source::Installed then
0
@@ -33,9 +30,5 @@ class Gem::Source::Installed < Gem::Source
nil
end
- def pretty_print q # :nodoc:
- q.text '[Installed]'
- end
-
end
diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb
index 3227fb61b0..3aae20c8ed 100644
--- a/lib/rubygems/source/local.rb
+++ b/lib/rubygems/source/local.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# The local source finds gems in the current directory for fulfilling
# dependencies.
@@ -16,8 +15,7 @@ class Gem::Source::Local < Gem::Source
def <=> other
case other
- when Gem::Source::Installed,
- Gem::Source::Lock then
+ when Gem::Source::Installed then
-1
when Gem::Source::Local then
0
diff --git a/lib/rubygems/source/lock.rb b/lib/rubygems/source/lock.rb
deleted file mode 100644
index 86b16e964c..0000000000
--- a/lib/rubygems/source/lock.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# frozen_string_literal: true
-##
-# A Lock source wraps an installed gem's source and sorts before other sources
-# during dependency resolution. This allows RubyGems to prefer gems from
-# dependency lock files.
-
-class Gem::Source::Lock < Gem::Source
-
- ##
- # The wrapped Gem::Source
-
- attr_reader :wrapped
-
- ##
- # Creates a new Lock source that wraps +source+ and moves it earlier in the
- # sort list.
-
- def initialize source
- @wrapped = source
- end
-
- def <=> other # :nodoc:
- case other
- when Gem::Source::Lock then
- @wrapped <=> other.wrapped
- when Gem::Source then
- 1
- else
- nil
- end
- end
-
- def == other # :nodoc:
- 0 == (self <=> other)
- end
-
- ##
- # Delegates to the wrapped source's fetch_spec method.
-
- def fetch_spec name_tuple
- @wrapped.fetch_spec name_tuple
- end
-
- def uri # :nodoc:
- @wrapped.uri
- end
-
-end
-
diff --git a/lib/rubygems/source/specific_file.rb b/lib/rubygems/source/specific_file.rb
index 459c803e1a..a7b6c53542 100644
--- a/lib/rubygems/source/specific_file.rb
+++ b/lib/rubygems/source/specific_file.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# A source representing a single .gem file. This is used for installation of
# local gems.
@@ -6,11 +5,6 @@
class Gem::Source::SpecificFile < Gem::Source
##
- # The path to the gem for this specific file.
-
- attr_reader :path
-
- ##
# Creates a new SpecificFile for the gem in +file+
def initialize(file)
@@ -43,7 +37,7 @@ class Gem::Source::SpecificFile < Gem::Source
end
def pretty_print q # :nodoc:
- q.group 2, '[SpecificFile:', ']' do
+ q.group 2, '[Local:', ']' do
q.breakable
q.text @path
end
diff --git a/lib/rubygems/source/vendor.rb b/lib/rubygems/source/vendor.rb
index e1b3698607..244c4201d8 100644
--- a/lib/rubygems/source/vendor.rb
+++ b/lib/rubygems/source/vendor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# This represents a vendored source that is similar to an installed gem.
@@ -13,8 +12,6 @@ class Gem::Source::Vendor < Gem::Source::Installed
def <=> other
case other
- when Gem::Source::Lock then
- -1
when Gem::Source::Vendor then
0
when Gem::Source then
diff --git a/lib/rubygems/source_list.rb b/lib/rubygems/source_list.rb
index 942d657963..e01f11cc1e 100644
--- a/lib/rubygems/source_list.rb
+++ b/lib/rubygems/source_list.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/source'
##
@@ -10,7 +9,7 @@ require 'rubygems/source'
# Or by adding them:
#
# sources = Gem::SourceList.new
-# sources << 'https://rubygems.example'
+# sources.add 'https://rubygems.example'
#
# The most common way to get a SourceList is Gem.sources.
diff --git a/lib/rubygems/source_local.rb b/lib/rubygems/source_local.rb
index 07cb9e6e8f..0808f4694a 100644
--- a/lib/rubygems/source_local.rb
+++ b/lib/rubygems/source_local.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/source'
require 'rubygems/source_local'
diff --git a/lib/rubygems/source_specific_file.rb b/lib/rubygems/source_specific_file.rb
index d42e6e7440..f785c2667c 100644
--- a/lib/rubygems/source_specific_file.rb
+++ b/lib/rubygems/source_specific_file.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/source/specific_file'
# TODO warn upon require, this file is deprecated.
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 755d4be1eb..12b8fb27d8 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems/remote_fetcher'
require 'rubygems/user_interaction'
require 'rubygems/errors'
@@ -187,7 +186,7 @@ class Gem::SpecFetcher
def suggest_gems_from_name gem_name
gem_name = gem_name.downcase.tr('_-', '')
max = gem_name.size / 2
- names = available_specs(:latest).first.values.flatten(1)
+ names = available_specs(:complete).first.values.flatten(1)
matches = names.map { |n|
next unless n.match_platform?
@@ -259,11 +258,18 @@ class Gem::SpecFetcher
# etc.). If +gracefully_ignore+ is true, errors are ignored.
def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
- @caches[type][source.uri] ||=
- source.load_specs(type).sort_by { |tup| tup.name }
- rescue Gem::RemoteFetcher::FetchError
- raise unless gracefully_ignore
- []
+ cache = @caches[type]
+
+ tuples =
+ begin
+ cache[source.uri] ||=
+ source.load_specs(type).sort_by { |tup| tup.name }
+ rescue Gem::RemoteFetcher::FetchError
+ raise unless gracefully_ignore
+ []
+ end
+
+ tuples
end
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index de324d76d9..2bcc2c0ef2 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -13,8 +12,13 @@ require 'rubygems/platform'
require 'rubygems/deprecate'
require 'rubygems/basic_specification'
require 'rubygems/stub_specification'
-require 'rubygems/util/list'
-require 'stringio'
+require 'rubygems/util/stringio'
+
+# :stopdoc:
+# date.rb can't be loaded for `make install` due to miniruby
+# Date is needed for old gems that stored #date as Date instead of Time.
+class Date; end
+# :startdoc:
##
# The Specification class contains the information for a Gem. Typically
@@ -108,8 +112,6 @@ class Gem::Specification < Gem::BasicSpecification
private_constant :LOAD_CACHE if defined? private_constant
- VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc:
-
# :startdoc:
##
@@ -176,13 +178,6 @@ class Gem::Specification < Gem::BasicSpecification
@@default_value[k].nil?
}
- @@stubs_by_name = {}
-
- # Sentinel object to represent "not found" stubs
- NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
- @@spec_with_requirable_file = {}
- @@active_stub_with_requirable_file = {}
-
######################################################################
# :section: Required gemspec attributes
@@ -223,11 +218,9 @@ class Gem::Specification < Gem::BasicSpecification
# Usage:
#
# # If all library files are in the root directory...
- # spec.require_paths = ['.']
+ # spec.require_path = '.'
- def require_paths=(val)
- @require_paths = Array(val)
- end
+ attr_writer :require_paths
##
# The version of RubyGems used to create this gem.
@@ -248,41 +241,19 @@ class Gem::Specification < Gem::BasicSpecification
attr_reader :summary
##
- # Singular writer for #authors
- #
- # Usage:
- #
- # spec.author = 'John Jones'
-
- def author= o
- self.authors = [o]
- end
-
- ##
- # Sets the list of authors, ensuring it is an array.
- #
- # Usage:
- #
- # spec.authors = ['John Jones', 'Mary Smith']
-
- def authors= value
- @authors = Array(value).flatten.grep(String)
- end
-
- ##
# The platform this gem runs on.
#
# This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT.
#
# Most gems contain pure Ruby code; they should simply leave the default
# value in place. Some gems contain C (or other) code to be compiled into a
- # Ruby "extension". The gem should leave the default value in place unless
- # the code will only compile on a certain type of system. Some gems consist
- # of pre-compiled code ("binary gems"). It's especially important that they
- # set the platform attribute appropriately. A shortcut is to set the
- # platform to Gem::Platform::CURRENT, which will cause the gem builder to set
- # the platform to the appropriate value for the system on which the build is
- # being performed.
+ # Ruby "extension". The should leave the default value in place unless
+ # their code will only compile on a certain type of system. Some gems
+ # consist of pre-compiled code ("binary gems"). It's especially important
+ # that they set the platform attribute appropriately. A shortcut is to set
+ # the platform to Gem::Platform::CURRENT, which will cause the gem builder
+ # to set the platform to the appropriate value for the system on which the
+ # build is being performed.
#
# If this attribute is set to a non-default value, it will be included in
# the filename of the gem when it is built such as:
@@ -356,7 +327,7 @@ class Gem::Specification < Gem::BasicSpecification
add_bindir(@executables),
@extra_rdoc_files,
@extensions,
- ].flatten.compact.uniq.sort
+ ].flatten.sort.uniq.compact
end
######################################################################
@@ -380,9 +351,7 @@ class Gem::Specification < Gem::BasicSpecification
##
# A long description of this gem
#
- # The description should be more detailed than the summary but not
- # excessively long. A few paragraphs is a recommended length with no
- # examples or formatting.
+ # The description should be more detailed than the summary.
#
# Usage:
#
@@ -394,8 +363,6 @@ class Gem::Specification < Gem::BasicSpecification
attr_reader :description
##
- # :category: Recommended gemspec attributes
- #
# A contact email address (or addresses) for this gem
#
# Usage:
@@ -406,13 +373,11 @@ class Gem::Specification < Gem::BasicSpecification
attr_accessor :email
##
- # :category: Recommended gemspec attributes
- #
# The URL of this gem's home page
#
# Usage:
#
- # spec.homepage = 'https://github.com/ruby/rake'
+ # spec.homepage = 'http://rake.rubyforge.org'
attr_accessor :homepage
@@ -426,16 +391,6 @@ class Gem::Specification < Gem::BasicSpecification
attr_accessor :post_install_message
##
- # The version of Ruby required by this gem
-
- attr_reader :required_ruby_version
-
- ##
- # The RubyGems version required by this gem
-
- attr_reader :required_rubygems_version
-
- ##
# The key used to sign this gem. See Gem::Security for details.
attr_accessor :signing_key
@@ -488,6 +443,28 @@ class Gem::Specification < Gem::BasicSpecification
end
##
+ # Singular writer for #authors
+ #
+ # Usage:
+ #
+ # spec.author = 'John Jones'
+
+ def author= o
+ self.authors = [o]
+ end
+
+ ##
+ # Sets the list of authors, ensuring it is an array.
+ #
+ # Usage:
+ #
+ # spec.authors = ['John Jones', 'Mary Smith']
+
+ def authors= value
+ @authors = Array(value).flatten.grep(String)
+ end
+
+ ##
# Executables included in the gem.
#
# For example, the rake gem has rake as an executable. You don’t specify the
@@ -495,9 +472,6 @@ class Gem::Specification < Gem::BasicSpecification
# found in bindir. These files must be executable Ruby files. Files that
# use bash or other interpreters will not work.
#
- # Executables included may only be ruby scripts, not scripts for other
- # languages or compiled binaries.
- #
# Usage:
#
# spec.executables << 'rake'
@@ -558,26 +532,20 @@ class Gem::Specification < Gem::BasicSpecification
##
# :category: Recommended gemspec attributes
- #
# The license for this gem.
#
- # The license must be no more than 64 characters.
- #
- # This should just be the name of your license. The full text of the license
- # should be inside of the gem (at the top level) when you build it.
+ # The license must be a short name, no more than 64 characters.
#
- # The simplest way, is to specify the standard SPDX ID
- # https://spdx.org/licenses/ for the license.
- # Ideally you should pick one that is OSI (Open Source Initiative)
- # http://opensource.org/licenses/alphabetical approved.
+ # This should just be the name of your license. The full
+ # text of the license should be inside of the gem when you build it.
#
- # The most commonly used OSI approved licenses are MIT and Apache-2.0.
- # GitHub also provides a license picker at http://choosealicense.com/.
+ # See http://opensource.org/licenses/alphabetical for a list of licenses and
+ # their abbreviations (or short names). GitHub also provides a
+ # license picker at http://choosealicense.com/
#
- # You should specify a license for your gem so that people know how they are
- # permitted to use it, and any restrictions you're placing on it. Not
- # specifying a license means all rights are reserved; others have no rights
- # to use the code for any purpose.
+ # According to copyright law, not having an OSI-approved open source license
+ # means you have no rights to use the code for any purpose-- in other words,
+ # "all rights reserved".
#
# You can set multiple licenses with #licenses=
#
@@ -600,7 +568,7 @@ class Gem::Specification < Gem::BasicSpecification
# See #license= for more discussion
#
# Usage:
- # spec.licenses = ['MIT', 'GPL-2.0']
+ # spec.licenses = ['MIT', 'GPL-2']
def licenses= licenses
@licenses = Array licenses
@@ -627,10 +595,6 @@ class Gem::Specification < Gem::BasicSpecification
# ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
# #<Gem::Version "2.0.0.247">
#
- # Because patch-level is taken into account, be very careful specifying using
- # `<=`: `<= 2.2.2` will not match any patch-level of 2.2.2 after the `p0`
- # release. It is much safer to specify `< 2.2.3` instead
- #
# Usage:
#
# # This gem will work with 1.8.6 or greater...
@@ -638,22 +602,12 @@ class Gem::Specification < Gem::BasicSpecification
#
# # Only with ruby 2.0.x
# spec.required_ruby_version = '~> 2.0'
- #
- # # Only with ruby between 2.2.0 and 2.2.2
- # spec.required_ruby_version = ['>= 2.2.0', '< 2.2.3']
def required_ruby_version= req
@required_ruby_version = Gem::Requirement.create req
end
##
- # The RubyGems version required by this gem
-
- def required_rubygems_version= req
- @required_rubygems_version = Gem::Requirement.create req
- end
-
- ##
# Lists the external (to RubyGems) requirements that must be met for this gem
# to work. It's simply information for the user.
#
@@ -674,7 +628,7 @@ class Gem::Specification < Gem::BasicSpecification
# spec.test_files = Dir.glob('test/tc_*.rb')
# spec.test_files = ['tests/test-suite.rb']
- def test_files= files # :nodoc:
+ def test_files= files
@test_files = Array files
end
@@ -708,6 +662,16 @@ class Gem::Specification < Gem::BasicSpecification
attr_writer :original_platform # :nodoc:
##
+ # The version of Ruby required by this gem
+
+ attr_reader :required_ruby_version
+
+ ##
+ # The RubyGems version required by this gem
+
+ attr_reader :required_rubygems_version
+
+ ##
# The rubyforge project this gem lives under. i.e. RubyGems'
# rubyforge_project is "rubygems".
#
@@ -731,6 +695,8 @@ class Gem::Specification < Gem::BasicSpecification
specs = {}
Gem.loaded_specs.each_value{|s| specs[s] = true}
@@all.each{|s| s.activated = true if specs[s]}
+
+ _resort!(@@all)
end
@@all
end
@@ -747,75 +713,12 @@ class Gem::Specification < Gem::BasicSpecification
end
end
- def self.gemspec_stubs_in dir, pattern
- Dir[File.join(dir, pattern)].map { |path| yield path }.select(&:valid?)
- end
- private_class_method :gemspec_stubs_in
-
- def self.default_stubs pattern
- base_dir = Gem.default_dir
- gems_dir = File.join base_dir, "gems"
- gemspec_stubs_in(default_specifications_dir, pattern) do |path|
- Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
- end
- end
- private_class_method :default_stubs
-
- def self.installed_stubs dirs, pattern
- map_stubs(dirs, pattern) do |path, base_dir, gems_dir|
- Gem::StubSpecification.gemspec_stub(path, base_dir, gems_dir)
- end
- end
- private_class_method :installed_stubs
-
- if [].respond_to? :flat_map
- def self.map_stubs(dirs, pattern) # :nodoc:
- dirs.flat_map { |dir|
- base_dir = File.dirname dir
- gems_dir = File.join base_dir, "gems"
- gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
- }
- end
- else # FIXME: remove when 1.8 is dropped
- def self.map_stubs(dirs, pattern) # :nodoc:
- dirs.map { |dir|
- base_dir = File.dirname dir
- gems_dir = File.join base_dir, "gems"
- gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
- }.flatten 1
- end
- end
- private_class_method :map_stubs
-
- uniq_takes_a_block = false
- [1,2].uniq { uniq_takes_a_block = true }
-
- if uniq_takes_a_block
- def self.uniq_by(list, &block) # :nodoc:
- list.uniq(&block)
- end
- else # FIXME: remove when 1.8 is dropped
- def self.uniq_by(list) # :nodoc:
- values = {}
- list.each { |item|
- value = yield item
- values[value] ||= item
- }
- values.values
- end
- end
- private_class_method :uniq_by
-
- if [].respond_to? :sort_by!
- def self.sort_by! list, &block
- list.sort_by!(&block)
- end
- else # FIXME: remove when 1.8 is dropped
- def self.sort_by! list, &block
- list.replace list.sort_by(&block)
+ def self.each_stub(dirs) # :nodoc:
+ each_gemspec(dirs) do |path|
+ stub = Gem::StubSpecification.new(path)
+ yield stub if stub.valid?
end
end
- private_class_method :sort_by!
def self.each_spec(dirs) # :nodoc:
each_gemspec(dirs) do |path|
@@ -829,35 +732,17 @@ class Gem::Specification < Gem::BasicSpecification
def self.stubs
@@stubs ||= begin
- pattern = "*.gemspec"
- stubs = default_stubs(pattern).concat installed_stubs(dirs, pattern)
- stubs = uniq_by(stubs) { |stub| stub.full_name }
+ stubs = {}
+ each_stub([default_specifications_dir] + dirs) do |stub|
+ stubs[stub.full_name] ||= stub
+ end
+ stubs = stubs.values
_resort!(stubs)
- @@stubs_by_name = stubs.group_by(&:name)
stubs
end
end
- EMPTY = [].freeze # :nodoc:
-
- ##
- # Returns a Gem::StubSpecification for installed gem named +name+
-
- def self.stubs_for name
- if @@stubs
- @@stubs_by_name[name] || []
- else
- pattern = "#{name}-*.gemspec"
- stubs = default_stubs(pattern) + installed_stubs(dirs, pattern)
- stubs = uniq_by(stubs) { |stub| stub.full_name }.group_by(&:name)
- stubs.each_value { |v| sort_by!(v) { |i| i.version } }
-
- @@stubs_by_name.merge! stubs
- @@stubs_by_name[name] ||= EMPTY
- end
- end
-
def self._resort!(specs) # :nodoc:
specs.sort! { |a, b|
names = a.name <=> b.name
@@ -882,7 +767,6 @@ class Gem::Specification < Gem::BasicSpecification
# properly sorted.
def self.add_spec spec
- warn "Gem::Specification.add_spec is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
# TODO: find all extraneous adds
# puts
# p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
@@ -897,8 +781,6 @@ class Gem::Specification < Gem::BasicSpecification
_all << spec
stubs << spec
- (@@stubs_by_name[spec.name] ||= []) << spec
- sort_by!(@@stubs_by_name[spec.name]) { |s| s.version }
_resort!(_all)
_resort!(stubs)
end
@@ -907,18 +789,14 @@ class Gem::Specification < Gem::BasicSpecification
# Adds multiple specs to the known specifications.
def self.add_specs *specs
- warn "Gem::Specification.add_specs is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
-
raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
# TODO: this is much more efficient, but we need the extra checks for now
# _all.concat specs
# _resort!
- Gem::Deprecate.skip_during do
- specs.each do |spec| # TODO: slow
- add_spec spec
- end
+ specs.each do |spec| # TODO: slow
+ add_spec spec
end
end
@@ -945,7 +823,6 @@ class Gem::Specification < Gem::BasicSpecification
# -- wilsonb
def self.all= specs
- @@stubs_by_name = specs.group_by(&:name)
@@all = @@stubs = specs
end
@@ -1034,11 +911,9 @@ class Gem::Specification < Gem::BasicSpecification
# Return the best specification that contains the file matching +path+.
def self.find_by_path path
- path = path.dup.freeze
- spec = @@spec_with_requirable_file[path] ||= (stubs.find { |s|
- s.contains_requirable_file? path
- } || NOT_FOUND)
- spec.to_spec
+ self.find { |spec|
+ spec.contains_requirable_file? path
+ }
end
##
@@ -1052,13 +927,6 @@ class Gem::Specification < Gem::BasicSpecification
stub && stub.to_spec
end
- def self.find_active_stub_by_path path
- stub = @@active_stub_with_requirable_file[path] ||= (stubs.find { |s|
- s.activated? and s.contains_requirable_file? path
- } || NOT_FOUND)
- stub.this
- end
-
##
# Return currently unresolved specs that contain the file matching +path+.
@@ -1077,13 +945,15 @@ class Gem::Specification < Gem::BasicSpecification
specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
specs.reverse_each do |spec|
+ trails = []
spec.traverse do |from_spec, dep, to_spec, trail|
- if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
- :next
- else
- return trail.reverse if to_spec.contains_requirable_file? path
- end
+ next unless to_spec.conflicts.empty?
+ trails << trail if to_spec.contains_requirable_file? path
end
+
+ next if trails.empty?
+
+ return trails.map(&:reverse).sort.first.reverse
end
[]
@@ -1101,7 +971,7 @@ class Gem::Specification < Gem::BasicSpecification
Gem.load_yaml
input = normalize_yaml_input input
- spec = Gem::SafeYAML.safe_load input
+ spec = YAML.load input
if spec && spec.class == FalseClass then
raise Gem::EndOfYAMLException
@@ -1122,14 +992,10 @@ class Gem::Specification < Gem::BasicSpecification
# +prerelease+ is true.
def self.latest_specs prerelease = false
- _latest_specs Gem::Specification._all, prerelease
- end
-
- def self._latest_specs specs, prerelease = false # :nodoc:
result = Hash.new { |h,k| h[k] = {} }
native = {}
- specs.reverse_each do |spec|
+ Gem::Specification.reverse_each do |spec|
next if spec.version.prerelease? unless prerelease
native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
@@ -1147,13 +1013,12 @@ class Gem::Specification < Gem::BasicSpecification
def self.load file
return unless file
-
- _spec = LOAD_CACHE[file]
- return _spec if _spec
-
file = file.dup.untaint
return unless File.file?(file)
+ spec = LOAD_CACHE[file]
+ return spec if spec
+
code = if defined? Encoding
File.read file, :mode => 'r:UTF-8:-'
else
@@ -1163,15 +1028,15 @@ class Gem::Specification < Gem::BasicSpecification
code.untaint
begin
- _spec = eval code, binding, file
+ spec = eval code, binding, file
- if Gem::Specification === _spec
- _spec.loaded_from = File.expand_path file.to_s
- LOAD_CACHE[file] = _spec
- return _spec
+ if Gem::Specification === spec
+ spec.loaded_from = file.to_s
+ LOAD_CACHE[file] = spec
+ return spec
end
- warn "[#{file}] isn't a Gem::Specification (#{_spec.class} instead)."
+ warn "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
rescue SignalException, SystemExit
raise
rescue SyntaxError, Exception => e
@@ -1194,7 +1059,6 @@ class Gem::Specification < Gem::BasicSpecification
def self.normalize_yaml_input(input)
result = input.respond_to?(:read) ? input.read : input
result = "--- " + result unless result =~ /\A--- /
- result = result.dup
result.gsub!(/ !!null \n/, " \n")
# date: 2011-04-26 00:00:00.000000000Z
# date: 2011-04-26 00:00:00.000000000 Z
@@ -1246,11 +1110,8 @@ class Gem::Specification < Gem::BasicSpecification
# Removes +spec+ from the known specs.
def self.remove_spec spec
- warn "Gem::Specification.remove_spec is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
_all.delete spec
stubs.delete_if { |s| s.full_name == spec.full_name }
- (@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
- reset
end
##
@@ -1276,9 +1137,6 @@ class Gem::Specification < Gem::BasicSpecification
Gem.pre_reset_hooks.each { |hook| hook.call }
@@all = nil
@@stubs = nil
- @@stubs_by_name = {}
- @@spec_with_requirable_file = {}
- @@active_stub_with_requirable_file = {}
_clear_load_cache
unresolved = unresolved_deps
unless unresolved.empty? then
@@ -1401,14 +1259,10 @@ class Gem::Specification < Gem::BasicSpecification
# there are conflicts upon activation.
def activate
- other = Gem.loaded_specs[self.name]
- if other then
- check_version_conflict other
- return false
- end
-
raise_if_conflicts
+ return false if Gem.loaded_specs[self.name]
+
activate_dependencies
add_self_to_load_path
@@ -1421,7 +1275,7 @@ class Gem::Specification < Gem::BasicSpecification
##
# Activate all unambiguously resolved runtime dependencies of this
- # spec. Add any ambiguous dependencies to the unresolved list to be
+ # spec. Add any ambigous dependencies to the unresolved list to be
# resolved later, as needed.
def activate_dependencies
@@ -1452,50 +1306,6 @@ class Gem::Specification < Gem::BasicSpecification
end
##
- # Abbreviate the spec for downloading. Abbreviated specs are only used for
- # searching, downloading and related activities and do not need deployment
- # specific information (e.g. list of files). So we abbreviate the spec,
- # making it much smaller for quicker downloads.
-
- def abbreviate
- self.files = []
- self.test_files = []
- self.rdoc_options = []
- self.extra_rdoc_files = []
- self.cert_chain = []
- end
-
- ##
- # Sanitize the descriptive fields in the spec. Sometimes non-ASCII
- # characters will garble the site index. Non-ASCII characters will
- # be replaced by their XML entity equivalent.
-
- def sanitize
- self.summary = sanitize_string(summary)
- self.description = sanitize_string(description)
- self.post_install_message = sanitize_string(post_install_message)
- self.authors = authors.collect { |a| sanitize_string(a) }
- end
-
- ##
- # Sanitize a single string.
-
- def sanitize_string(string)
- return string unless string
-
- # HACK the #to_s is in here because RSpec has an Array of Arrays of
- # Strings for authors. Need a way to disallow bad values on gemspec
- # generation. (Probably won't happen.)
- string = string.to_s
-
- begin
- Builder::XChar.encode string
- rescue NameError, NoMethodError
- string.to_xs
- end
- end
-
- ##
# Returns an array with bindir attached to each executable in the
# +executables+ list
@@ -1524,7 +1334,7 @@ class Gem::Specification < Gem::BasicSpecification
end
unless dependency.respond_to?(:name) &&
- dependency.respond_to?(:requirement)
+ dependency.respond_to?(:version_requirements)
dependency = Gem::Dependency.new(dependency.to_s, requirements, type)
end
@@ -1593,10 +1403,7 @@ class Gem::Specification < Gem::BasicSpecification
def build_args
if File.exist? build_info_file
- build_info = File.readlines build_info_file
- build_info = build_info.map { |x| x.strip }
- build_info.delete ""
- build_info
+ File.readlines(build_info_file).map { |x| x.strip }
else
[]
end
@@ -1611,8 +1418,8 @@ class Gem::Specification < Gem::BasicSpecification
return if extensions.empty?
return if installed_by_version < Gem::Version.new('2.2.0.preview.2')
return if File.exist? gem_build_complete_path
- return if !File.writable?(base_dir)
- return if !File.exist?(File.join(base_dir, 'extensions'))
+ return if !File.writable?(base_dir) &&
+ !File.exist?(File.join(base_dir, 'extensions'))
begin
# We need to require things in $LOAD_PATH without looking for the
@@ -1624,13 +1431,11 @@ class Gem::Specification < Gem::BasicSpecification
require 'rubygems/ext'
require 'rubygems/user_interaction'
- ui = Gem::SilentUI.new
- Gem::DefaultUserInteraction.use_ui ui do
+ Gem::DefaultUserInteraction.use_ui Gem::SilentUI.new do
builder = Gem::Ext::Builder.new self
builder.build_extensions
end
ensure
- ui.close if ui
Gem::Specification.unresolved_deps.replace unresolved_deps
end
end
@@ -1651,16 +1456,6 @@ class Gem::Specification < Gem::BasicSpecification
end
##
- # Used to detect if the gem is bundled in older version of Ruby, but not
- # detectable as default gem (see BasicSpecification#default_gem?).
-
- def bundled_gem_in_old_ruby?
- !default_gem? &&
- RUBY_VERSION < "2.0.0" &&
- summary == "This #{name} is bundled with Ruby"
- end
-
- ##
# Returns the full path to the cache directory containing this
# spec's cached gem.
@@ -1680,37 +1475,14 @@ class Gem::Specification < Gem::BasicSpecification
def conflicts
conflicts = {}
- self.runtime_dependencies.each { |dep|
- spec = Gem.loaded_specs[dep.name]
- if spec and not spec.satisfies_requirement? dep
- (conflicts[spec] ||= []) << dep
- end
- }
- conflicts
- end
-
- ##
- # return true if there will be conflict when spec if loaded together with the list of specs.
-
- def conficts_when_loaded_with?(list_of_specs) # :nodoc:
- result = list_of_specs.any? { |spec|
- spec.dependencies.any? { |dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
- }
- result
- end
-
- ##
- # Return true if there are possible conflicts against the currently loaded specs.
+ Gem.loaded_specs.values.each do |spec|
+ bad = self.runtime_dependencies.find_all { |dep|
+ spec.name == dep.name and not spec.satisfies_requirement? dep
+ }
- def has_conflicts?
- self.dependencies.any? { |dep|
- if dep.runtime? then
- spec = Gem.loaded_specs[dep.name]
- spec and not spec.satisfies_requirement? dep
- else
- false
- end
- }
+ conflicts[spec] = bad unless bad.empty?
+ end
+ conflicts
end
##
@@ -1722,11 +1494,6 @@ class Gem::Specification < Gem::BasicSpecification
@date ||= TODAY
end
- DateLike = Object.new # :nodoc:
- def DateLike.===(obj) # :nodoc:
- defined?(::Date) and Date === obj
- end
-
DateTimeFormat = # :nodoc:
/\A
(\d{4})-(\d{2})-(\d{2})
@@ -1756,7 +1523,7 @@ class Gem::Specification < Gem::BasicSpecification
raise(Gem::InvalidSpecificationException,
"invalid date format in specification: #{date.inspect}")
end
- when Time, DateLike then
+ when Time, Date then
Time.utc(date.year, date.month, date.day)
else
TODAY
@@ -1842,7 +1609,7 @@ class Gem::Specification < Gem::BasicSpecification
##
# Returns the full path to this spec's documentation directory. If +type+
- # is given it will be appended to the end. For example:
+ # is given it will be appended to the end. For examlpe:
#
# spec.doc_dir # => "/path/to/gem_repo/doc/a-1"
#
@@ -1963,22 +1730,30 @@ class Gem::Specification < Gem::BasicSpecification
spec
end
+ def find_full_gem_path # :nodoc:
+ super || File.expand_path(File.join(gems_dir, original_name))
+ end
+ private :find_full_gem_path
+
def full_name
@full_name ||= super
end
##
+ # The path to the gem.build_complete file within the extension install
+ # directory.
+
+ def gem_build_complete_path # :nodoc:
+ File.join extension_install_dir, 'gem.build_complete'
+ end
+
+ ##
# Work around bundler removing my methods
def gem_dir # :nodoc:
super
end
- def gems_dir
- # TODO: this logic seems terribly broken, but tests fail if just base_dir
- @gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
- end
-
##
# Deprecated and ignored, defaults to true.
#
@@ -2002,7 +1777,7 @@ class Gem::Specification < Gem::BasicSpecification
##
# True if this gem has files in test_files
- def has_unit_tests? # :nodoc:
+ def has_unit_tests?
not test_files.empty?
end
@@ -2025,12 +1800,9 @@ class Gem::Specification < Gem::BasicSpecification
# +version+.
def initialize name = nil, version = nil
- super()
- @gems_dir = nil
- @base_dir = nil
@loaded = false
@activated = false
- @loaded_from = nil
+ self.loaded_from = nil
@original_platform = nil
@installed_by_version = nil
@@ -2077,15 +1849,6 @@ class Gem::Specification < Gem::BasicSpecification
end
end
- def base_dir
- return Gem.dir unless loaded_from
- @base_dir ||= if default_gem? then
- File.dirname File.dirname File.dirname loaded_from
- else
- File.dirname File.dirname loaded_from
- end
- end
-
##
# Expire memoized instance variables that can incorrectly generate, replace
# or miss files due changes in certain attributes used to compute them.
@@ -2106,6 +1869,20 @@ class Gem::Specification < Gem::BasicSpecification
end
##
+ # Returns a string usable in Dir.glob to match all requirable paths
+ # for this spec.
+
+ def lib_dirs_glob
+ dirs = if self.require_paths.size > 1 then
+ "{#{self.require_paths.join(',')}}"
+ else
+ self.require_paths.first
+ end
+
+ "#{self.full_gem_path}/#{dirs}"
+ end
+
+ ##
# Files in the Gem under one of the require_paths
def lib_files
@@ -2120,7 +1897,7 @@ class Gem::Specification < Gem::BasicSpecification
# Singular accessor for #licenses
def license
- licenses.first
+ val = licenses and val.first
end
##
@@ -2132,12 +1909,14 @@ class Gem::Specification < Gem::BasicSpecification
@licenses ||= []
end
- def internal_init # :nodoc:
+ def loaded_from= path # :nodoc:
super
+
@bin_dir = nil
@cache_dir = nil
@cache_file = nil
@doc_dir = nil
+ @gem_dir = nil
@ri_dir = nil
@spec_dir = nil
@spec_file = nil
@@ -2151,6 +1930,16 @@ class Gem::Specification < Gem::BasicSpecification
end
##
+ # Return all files in this gem that match for +glob+.
+
+ def matches_for_glob glob # TODO: rename?
+ # TODO: do we need these?? Kill it
+ glob = File.join(self.lib_dirs_glob, glob)
+
+ Dir[glob].map { |f| f.untaint } # FIX our tests are broken, run w/ SAFE=1
+ end
+
+ ##
# Warn about unknown attributes while loading a spec.
def method_missing(sym, *a, &b) # :nodoc:
@@ -2163,19 +1952,6 @@ class Gem::Specification < Gem::BasicSpecification
end
##
- # Is this specification missing its extensions? When this returns true you
- # probably want to build_extensions
-
- def missing_extensions?
- return false if default_gem?
- return false if extensions.empty?
- return false if installed_by_version < Gem::Version.new('2.2.0.preview.2')
- return false if File.exist? gem_build_complete_path
-
- true
- end
-
- ##
# Normalize the list of files so that:
# * All file lists have redundancies removed.
# * Files referenced in the extra_rdoc_files are included in the package
@@ -2259,32 +2035,34 @@ class Gem::Specification < Gem::BasicSpecification
end
##
- # Raise an exception if the version of this spec conflicts with the one
- # that is already loaded (+other+)
+ # Check the spec for possible conflicts and freak out if there are any.
+
+ def raise_if_conflicts
+ other = Gem.loaded_specs[self.name]
- def check_version_conflict other # :nodoc:
- return if self.version == other.version
+ if other and self.version != other.version then
+ # This gem is already loaded. If the currently loaded gem is not in the
+ # list of candidate gems, then we have a version conflict.
- # This gem is already loaded. If the currently loaded gem is not in the
- # list of candidate gems, then we have a version conflict.
+ msg = "can't activate #{full_name}, already activated #{other.full_name}"
- msg = "can't activate #{full_name}, already activated #{other.full_name}"
+ e = Gem::LoadError.new msg
+ e.name = self.name
+ # TODO: e.requirement = dep.requirement
- e = Gem::LoadError.new msg
- e.name = self.name
- # TODO: e.requirement = dep.requirement
+ raise e
+ end
- raise e
- end
+ conf = self.conflicts
- private :check_version_conflict
+ unless conf.empty? then
+ y = conf.map { |act,con|
+ "#{act.full_name} conflicts with #{con.join(", ")}"
+ }.join ", "
- ##
- # Check the spec for possible conflicts and freak out if there are any.
+ # TODO: improve message by saying who activated `con`
- def raise_if_conflicts # :nodoc:
- if has_conflicts? then
- raise Gem::ConflictError.new self, conflicts
+ raise Gem::LoadError, "Unable to activate #{self.full_name}, because #{y}"
end
end
@@ -2308,7 +2086,14 @@ class Gem::Specification < Gem::BasicSpecification
# Singular accessor for #require_paths
def require_path= path
- self.require_paths = Array(path)
+ self.require_paths = [path]
+ end
+
+ ##
+ # The RubyGems version required by this gem
+
+ def required_rubygems_version= req
+ @required_rubygems_version = Gem::Requirement.create req
end
##
@@ -2337,13 +2122,13 @@ class Gem::Specification < Gem::BasicSpecification
def ruby_code(obj)
case obj
- when String then obj.dump + ".freeze"
+ when String then obj.dump
when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
when Hash then
seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
"{ #{seg.join(', ')} }"
when Gem::Version then obj.to_s.dump
- when DateLike then obj.strftime('%Y-%m-%d').dump
+ when Date then obj.strftime('%Y-%m-%d').dump
when Time then obj.strftime('%Y-%m-%d').dump
when Numeric then obj.inspect
when true, false, nil then obj.inspect
@@ -2361,7 +2146,7 @@ class Gem::Specification < Gem::BasicSpecification
# List of dependencies that will automatically be activated at runtime.
def runtime_dependencies
- dependencies.select(&:runtime?)
+ dependencies.select { |d| d.type == :runtime }
end
##
@@ -2431,14 +2216,14 @@ class Gem::Specification < Gem::BasicSpecification
##
# Singular accessor for #test_files
- def test_file # :nodoc:
+ def test_file
val = test_files and val.first
end
##
# Singular mutator for #test_files
- def test_file= file # :nodoc:
+ def test_file= file
self.test_files = [file]
end
@@ -2446,7 +2231,7 @@ class Gem::Specification < Gem::BasicSpecification
# Test files included in this gem. You cannot append to this accessor, you
# must assign to it.
- def test_files # :nodoc:
+ def test_files
# Handle the possibility that we have @test_suite_file but not
# @test_files. This will happen when an old gem is loaded via
# YAML.
@@ -2470,7 +2255,7 @@ class Gem::Specification < Gem::BasicSpecification
mark_version
result = []
result << "# -*- encoding: utf-8 -*-"
- result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join("\0")}"
+ result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{@require_paths.join("\0")}"
result << "#{Gem::StubSpecification::PREFIX}#{extensions.join "\0"}" unless
extensions.empty?
result << nil
@@ -2487,7 +2272,7 @@ class Gem::Specification < Gem::BasicSpecification
if metadata and !metadata.empty?
result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
end
- result << " s.require_paths = #{ruby_code raw_require_paths}"
+ result << " s.require_paths = #{ruby_code @require_paths}"
handled = [
:dependencies,
@@ -2527,14 +2312,14 @@ class Gem::Specification < Gem::BasicSpecification
dependencies.each do |dep|
req = dep.requirements_list.inspect
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
- result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
+ result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{req})"
end
result << " else"
dependencies.each do |dep|
version_reqs_param = dep.requirements_list.inspect
- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
+ result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
end
result << ' end'
@@ -2542,7 +2327,7 @@ class Gem::Specification < Gem::BasicSpecification
result << " else"
dependencies.each do |dep|
version_reqs_param = dep.requirements_list.inspect
- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
+ result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
end
result << " end"
end
@@ -2575,8 +2360,7 @@ class Gem::Specification < Gem::BasicSpecification
end
def to_yaml(opts = {}) # :nodoc:
- if (YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?) ||
- (defined?(Psych) && YAML == Psych) then
+ if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? then
# Because the user can switch the YAML engine behind our
# back, we have to check again here to make sure that our
# psych code was properly loaded, and load it if not.
@@ -2588,7 +2372,7 @@ class Gem::Specification < Gem::BasicSpecification
builder << self
ast = builder.tree
- io = StringIO.new
+ io = Gem::StringSink.new
io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
Psych::Visitors::Emitter.new(io).accept(ast)
@@ -2607,29 +2391,14 @@ class Gem::Specification < Gem::BasicSpecification
# Recursively walk dependencies of this spec, executing the +block+ for each
# hop.
- def traverse trail = [], visited = {}, &block
- trail.push(self)
- begin
- dependencies.each do |dep|
- next unless dep.runtime?
- dep.to_specs.reverse_each do |dep_spec|
- next if visited.has_key?(dep_spec)
- visited[dep_spec] = true
- trail.push(dep_spec)
- begin
- result = block[self, dep, dep_spec, trail]
- ensure
- trail.pop
- end
- unless result == :next
- spec_name = dep_spec.name
- dep_spec.traverse(trail, visited, &block) unless
- trail.any? { |s| s.name == spec_name }
- end
- end
+ def traverse trail = [], &block
+ trail = trail + [self]
+ runtime_dependencies.each do |dep|
+ dep.to_specs.each do |dep_spec|
+ block[self, dep, dep_spec, trail + [dep_spec]]
+ dep_spec.traverse(trail, &block) unless
+ trail.map(&:name).include? dep_spec.name
end
- ensure
- trail.pop
end
end
@@ -2646,8 +2415,8 @@ class Gem::Specification < Gem::BasicSpecification
extend Gem::UserInteraction
normalize
- nil_attributes = self.class.non_nil_attributes.find_all do |attrname|
- instance_variable_get("@#{attrname}").nil?
+ nil_attributes = self.class.non_nil_attributes.find_all do |name|
+ instance_variable_get("@#{name}").nil?
end
unless nil_attributes.empty? then
@@ -2667,29 +2436,23 @@ class Gem::Specification < Gem::BasicSpecification
end
end
- if !name.is_a?(String) then
+ unless String === name then
raise Gem::InvalidSpecificationException,
- "invalid value for attribute name: \"#{name.inspect}\" must be a string"
- elsif name !~ /[a-zA-Z]/ then
- raise Gem::InvalidSpecificationException,
- "invalid value for attribute name: #{name.dump} must include at least one letter"
- elsif name !~ VALID_NAME_PATTERN then
- raise Gem::InvalidSpecificationException,
- "invalid value for attribute name: #{name.dump} can only include letters, numbers, dashes, and underscores"
+ "invalid value for attribute name: \"#{name.inspect}\""
end
- if raw_require_paths.empty? then
+ if @require_paths.empty? then
raise Gem::InvalidSpecificationException,
'specification must have at least one require_path'
end
- @files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
- @test_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
+ @files.delete_if { |x| File.directory?(x) }
+ @test_files.delete_if { |x| File.directory?(x) }
@executables.delete_if { |x| File.directory?(File.join(@bindir, x)) }
- @extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
- @extensions.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
+ @extra_rdoc_files.delete_if { |x| File.directory?(x) }
+ @extensions.delete_if { |x| File.directory?(x) }
- non_files = files.reject { |x| File.file?(x) || File.symlink?(x) }
+ non_files = files.reject { |x| File.file?(x) }
unless not packaging or non_files.empty? then
raise Gem::InvalidSpecificationException,
@@ -2768,21 +2531,11 @@ class Gem::Specification < Gem::BasicSpecification
raise Gem::InvalidSpecificationException,
"each license must be 64 characters or less"
end
-
- if !Gem::Licenses.match?(license)
- suggestions = Gem::Licenses.suggestions(license)
- message = <<-warning
-license value '#{license}' is invalid. Use a license identifier from
-http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
- warning
- message += "Did you mean #{suggestions.map { |s| "'#{s}'"}.join(', ')}?\n" unless suggestions.nil?
- warning(message)
- end
}
warning <<-warning if licenses.empty?
-licenses is empty, but is recommended. Use a license identifier from
-http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
+licenses is empty, but is recommended. Use a license abbreviation from:
+http://opensource.org/licenses/alphabetical
warning
validate_permissions
@@ -2815,7 +2568,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
# Warnings
- %w[author email homepage summary].each do |attribute|
+ %w[author description email homepage summary].each do |attribute|
value = self.send attribute
warning "no #{attribute} specified" if value.nil? or value.empty?
end
@@ -2834,11 +2587,6 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
warning "#{executable_path} is missing #! line" unless shebang
end
- files.each do |file|
- next unless File.symlink?(file)
- warning "#{file} is a symlink, which is not supported on all platforms"
- end
-
validate_dependencies
true
@@ -2854,34 +2602,30 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
# versioning.
def validate_dependencies # :nodoc:
- # NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
- seen = Gem::Dependency::TYPES.inject({}) { |types, type| types.merge({ type => {}}) }
+ seen = {}
- error_messages = []
- warning_messages = []
dependencies.each do |dep|
- if prev = seen[dep.type][dep.name] then
- error_messages << <<-MESSAGE
+ if prev = seen[dep.name] then
+ raise Gem::InvalidSpecificationException, <<-MESSAGE
duplicate dependency on #{dep}, (#{prev.requirement}) use:
- add_#{dep.type}_dependency '#{dep.name}', '#{dep.requirement}', '#{prev.requirement}'
+ add_runtime_dependency '#{dep.name}', '#{dep.requirement}', '#{prev.requirement}'
MESSAGE
end
- seen[dep.type][dep.name] = dep
+ seen[dep.name] = dep
prerelease_dep = dep.requirements_list.any? do |req|
Gem::Requirement.new(req).prerelease?
end
- warning_messages << "prerelease dependency on #{dep} is not recommended" if
- prerelease_dep && !version.prerelease?
+ warning "prerelease dependency on #{dep} is not recommended" if
+ prerelease_dep
overly_strict = dep.requirement.requirements.length == 1 &&
dep.requirement.requirements.any? do |op, version|
op == '~>' and
not version.prerelease? and
- version.segments.length > 2 and
- version.segments.first != 0
+ version.segments.length > 2
end
if overly_strict then
@@ -2889,7 +2633,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
base = dep_version.segments.first 2
- warning_messages << <<-WARNING
+ warning <<-WARNING
pessimistic dependency on #{dep} may be overly strict
if #{dep.name} is semantically versioned, use:
add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}', '>= #{dep_version}'
@@ -2911,19 +2655,13 @@ pessimistic dependency on #{dep} may be overly strict
", '>= #{dep_version}'"
end
- warning_messages << <<-WARNING
+ warning <<-WARNING
open-ended dependency on #{dep} is not recommended
if #{dep.name} is semantically versioned, use:
add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}
WARNING
end
end
- if error_messages.any?
- raise Gem::InvalidSpecificationException, error_messages.join
- end
- if warning_messages.any?
- warning_messages.each { |warning_message| warning warning_message }
- end
end
##
@@ -2933,14 +2671,12 @@ open-ended dependency on #{dep} is not recommended
return if Gem.win_platform?
files.each do |file|
- next unless File.file?(file)
next if File.stat(file).mode & 0444 == 0444
warning "#{file} is not world-readable"
end
executables.each do |name|
exec = File.join @bindir, name
- next unless File.file?(exec)
next if File.stat(exec).executable?
warning "#{exec} is not executable"
end
@@ -3006,10 +2742,6 @@ open-ended dependency on #{dep} is not recommended
alert_warning statement
end
- def raw_require_paths # :nodoc:
- @require_paths
- end
-
extend Gem::Deprecate
# TODO:
diff --git a/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem b/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem
deleted file mode 100644
index 20585f1c01..0000000000
--- a/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem
+++ /dev/null
@@ -1,25 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
-MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
-IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
-MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
-FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
-bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
-dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
-H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
-uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
-mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
-a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
-E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
-WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
-VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
-Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
-cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
-IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
-AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
-YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
-6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
-Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
-c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
-mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
------END CERTIFICATE-----
diff --git a/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem b/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem
deleted file mode 100644
index 6fbdf52b17..0000000000
--- a/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem
+++ /dev/null
@@ -1,32 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIFdDCCBFygAwIBAgIQJ2buVutJ846r13Ci/ITeIjANBgkqhkiG9w0BAQwFADBv
-MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
-ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
-eHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFow
-gYUxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
-BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMSswKQYD
-VQQDEyJDT01PRE8gUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkq
-hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAkehUktIKVrGsDSTdxc9EZ3SZKzejfSNw
-AHG8U9/E+ioSj0t/EFa9n3Byt2F/yUsPF6c947AEYe7/EZfH9IY+Cvo+XPmT5jR6
-2RRr55yzhaCCenavcZDX7P0N+pxs+t+wgvQUfvm+xKYvT3+Zf7X8Z0NyvQwA1onr
-ayzT7Y+YHBSrfuXjbvzYqOSSJNpDa2K4Vf3qwbxstovzDo2a5JtsaZn4eEgwRdWt
-4Q08RWD8MpZRJ7xnw8outmvqRsfHIKCxH2XeSAi6pE6p8oNGN4Tr6MyBSENnTnIq
-m1y9TBsoilwie7SrmNnu4FGDwwlGTm0+mfqVF9p8M1dBPI1R7Qu2XK8sYxrfV8g/
-vOldxJuvRZnio1oktLqpVj3Pb6r/SVi+8Kj/9Lit6Tf7urj0Czr56ENCHonYhMsT
-8dm74YlguIwoVqwUHZwK53Hrzw7dPamWoUi9PPevtQ0iTMARgexWO/bTouJbt7IE
-IlKVgJNp6I5MZfGRAy1wdALqi2cVKWlSArvX31BqVUa/oKMoYX9w0MOiqiwhqkfO
-KJwGRXa/ghgntNWutMtQ5mv0TIZxMOmm3xaG4Nj/QN370EKIf6MzOi5cHkERgWPO
-GHFrK+ymircxXDpqR+DDeVnWIBqv8mqYqnK8V0rSS527EPywTEHl7R09XiidnMy/
-s1Hap0flhFMCAwEAAaOB9DCB8TAfBgNVHSMEGDAWgBStvZh6NLQm9/rEJlTvA73g
-JMtUGjAdBgNVHQ4EFgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQD
-AgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAGBgRVHSAAMEQGA1UdHwQ9
-MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9BZGRUcnVzdEV4dGVy
-bmFsQ0FSb290LmNybDA1BggrBgEFBQcBAQQpMCcwJQYIKwYBBQUHMAGGGWh0dHA6
-Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggEBAGS/g/FfmoXQ
-zbihKVcN6Fr30ek+8nYEbvFScLsePP9NDXRqzIGCJdPDoCpdTPW6i6FtxFQJdcfj
-Jw5dhHk3QBN39bSsHNA7qxcS1u80GH4r6XnTq1dFDK8o+tDb5VCViLvfhVdpfZLY
-Uspzgb8c8+a4bmYRBbMelC1/kZWSWfFMzqORcUx8Rww7Cxn2obFshj5cqsQugsv5
-B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9Hvx
-PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR
-pu/xO28QOG8=
------END CERTIFICATE-----
diff --git a/lib/rubygems/ssl_certs/GlobalSignRootCA.pem b/lib/rubygems/ssl_certs/GlobalSignRootCA.pem
deleted file mode 100644
index f4ce4ca43d..0000000000
--- a/lib/rubygems/ssl_certs/GlobalSignRootCA.pem
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
-A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
-b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
-MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
-YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
-aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
-jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
-xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
-1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
-snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
-U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
-9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
-BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
-AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
-yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
-38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
-AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
-DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
-HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
------END CERTIFICATE-----
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index 61df5a2262..221dc1d404 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# Gem::StubSpecification reads the stub: line from the gemspec. This prevents
# us having to eval the entire gemspec in order to find out certain
@@ -16,83 +15,42 @@ class Gem::StubSpecification < Gem::BasicSpecification
end
class StubLine # :nodoc: all
- attr_reader :name, :version, :platform, :require_paths, :extensions,
- :full_name
-
- NO_EXTENSIONS = [].freeze
-
- # These are common require paths.
- REQUIRE_PATHS = { # :nodoc:
- 'lib' => 'lib'.freeze,
- 'test' => 'test'.freeze,
- 'ext' => 'ext'.freeze,
- }
-
- # These are common require path lists. This hash is used to optimize
- # and consolidate require_path objects. Most specs just specify "lib"
- # in their require paths, so lets take advantage of that by pre-allocating
- # a require path list for that case.
- REQUIRE_PATH_LIST = { # :nodoc:
- 'lib' => ['lib'].freeze
- }
-
- def initialize data, extensions
- parts = data[PREFIX.length..-1].split(" ".freeze, 4)
- @name = parts[0].freeze
- @version = Gem::Version.new parts[1]
- @platform = Gem::Platform.new parts[2]
- @extensions = extensions
- @full_name = if platform == Gem::Platform::RUBY
- "#{name}-#{version}"
- else
- "#{name}-#{version}-#{platform}"
- end
-
- path_list = parts.last
- @require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0".freeze).map! { |x|
- REQUIRE_PATHS[x] || x
- }
+ attr_reader :parts
+
+ def initialize(data)
+ @parts = data[PREFIX.length..-1].split(" ")
end
- end
- def self.default_gemspec_stub filename, base_dir, gems_dir
- new filename, base_dir, gems_dir, true
- end
+ def name
+ @parts[0]
+ end
- def self.gemspec_stub filename, base_dir, gems_dir
- new filename, base_dir, gems_dir, false
- end
+ def version
+ Gem::Version.new @parts[1]
+ end
- attr_reader :base_dir, :gems_dir
+ def platform
+ Gem::Platform.new @parts[2]
+ end
- def initialize filename, base_dir, gems_dir, default_gem
- super()
- filename.untaint
+ def require_paths
+ @parts[3..-1].join(" ").split("\0")
+ end
+ end
+ def initialize(filename)
self.loaded_from = filename
@data = nil
- @name = nil
+ @extensions = nil
@spec = nil
- @base_dir = base_dir
- @gems_dir = gems_dir
- @default_gem = default_gem
end
##
# True when this gem has been activated
def activated?
- @activated ||=
- begin
- loaded = Gem.loaded_specs[name]
- loaded && loaded.version == version
- end
- end
-
- def this; self; end
-
- def default_gem?
- @default_gem
+ loaded = Gem.loaded_specs[name]
+ loaded && loaded.version == version
end
def build_extensions # :nodoc:
@@ -108,26 +66,20 @@ class Gem::StubSpecification < Gem::BasicSpecification
def data
unless @data
- begin
- saved_lineno = $.
- open loaded_from, OPEN_MODE do |file|
- begin
- file.readline # discard encoding line
- stubline = file.readline.chomp
- if stubline.start_with?(PREFIX) then
- extensions = if /\A#{PREFIX}/ =~ file.readline.chomp
- $'.split "\0"
- else
- StubLine::NO_EXTENSIONS
- end
-
- @data = StubLine.new stubline, extensions
- end
- rescue EOFError
+ @extensions = []
+
+ open loaded_from, OPEN_MODE do |file|
+ begin
+ file.readline # discard encoding line
+ stubline = file.readline.chomp
+ if stubline.start_with?(PREFIX) then
+ @data = StubLine.new stubline
+
+ @extensions = $'.split "\0" if
+ /\A#{PREFIX}/ =~ file.readline.chomp
end
+ rescue EOFError
end
- ensure
- $. = saved_lineno
end
end
@@ -136,64 +88,66 @@ class Gem::StubSpecification < Gem::BasicSpecification
private :data
- def raw_require_paths # :nodoc:
- data.require_paths
- end
+ ##
+ # Extensions for this gem
+
+ def extensions
+ return @extensions if @extensions
- def missing_extensions?
- return false if default_gem?
- return false if extensions.empty?
- return false if File.exist? gem_build_complete_path
+ data # load
- to_spec.missing_extensions?
+ @extensions
end
##
- # Name of the gem
+ # If a gem has a stub specification it doesn't need to bother with
+ # compatibility with original_name gems. It was installed with the
+ # normalized name.
- def name
- data.name
+ def find_full_gem_path # :nodoc:
+ path = File.expand_path File.join gems_dir, full_name
+ path.untaint
+ path
end
##
- # Platform of the gem
+ # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
+ # activated.
- def platform
- data.platform
+ def full_require_paths
+ @require_paths ||= data.require_paths
+
+ super
end
##
- # Extensions for this gem
+ # Name of the gem
- def extensions
- data.extensions
+ def name
+ @name ||= data.name
end
##
- # Version of the gem
+ # Platform of the gem
- def version
- data.version
+ def platform
+ @platform ||= data.platform
end
- def full_name
- data.full_name
+ ##
+ # Require paths of the gem
+
+ def require_paths
+ @require_paths ||= data.require_paths
+
+ super
end
##
# The full Gem::Specification for this gem, loaded from evalling its gemspec
def to_spec
- @spec ||= if @data then
- Gem.loaded_specs.values.find { |spec|
- spec.name == name and spec.version == version
- }
- end
-
@spec ||= Gem::Specification.load(loaded_from)
- @spec.ignored = @ignored if @spec
-
- @spec
end
##
@@ -205,6 +159,13 @@ class Gem::StubSpecification < Gem::BasicSpecification
end
##
+ # Version of the gem
+
+ def version
+ @version ||= data.version
+ end
+
+ ##
# Is there a stub line present for this StubSpecification?
def stubbed?
diff --git a/lib/rubygems/syck_hack.rb b/lib/rubygems/syck_hack.rb
index 051483eac8..1229fe7c7a 100644
--- a/lib/rubygems/syck_hack.rb
+++ b/lib/rubygems/syck_hack.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
# :stopdoc:
# Hack to handle syck's DefaultKey bug
@@ -13,7 +12,7 @@
module YAML # :nodoc:
# In newer 1.9.2, there is a Syck toplevel constant instead of it
- # being underneath YAML. If so, reference it back under YAML as
+ # being underneith YAML. If so, reference it back under YAML as
# well.
if defined? ::Syck
# for tests that change YAML::ENGINE
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 43c4667822..f3967aba8b 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1,9 +1,8 @@
-# frozen_string_literal: true
# TODO: $SAFE = 1
begin
gem 'minitest', '~> 4.0'
-rescue NoMethodError, Gem::LoadError
+rescue NoMethodError
# for ruby tests
end
@@ -25,19 +24,18 @@ unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
gem 'json'
end
-require 'minitest/autorun'
-
require 'rubygems/deprecate'
-
+require 'minitest/autorun'
require 'fileutils'
-require 'pathname'
-require 'pp'
-require 'rubygems/package'
-require 'shellwords'
require 'tmpdir'
require 'uri'
+require 'rubygems/package'
+require 'pp'
require 'zlib'
-require 'benchmark' # stdlib
+require 'pathname'
+require 'shellwords'
+Gem.load_yaml
+
require 'rubygems/mock_gem_ui'
module Gem
@@ -87,10 +85,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
attr_accessor :fetcher # :nodoc:
- attr_accessor :gem_repo # :nodoc:
-
- attr_accessor :uri # :nodoc:
-
def assert_activate expected, *specs
specs.each do |spec|
case spec
@@ -114,23 +108,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
assert File.exist?(path), msg
end
- ##
- # Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
- # the original value when the block ends
-
- def enable_shared value
- enable_shared = RbConfig::CONFIG['ENABLE_SHARED']
- RbConfig::CONFIG['ENABLE_SHARED'] = value
-
- yield
- ensure
- if enable_shared then
- RbConfig::CONFIG['enable_shared'] = enable_shared
- else
- RbConfig::CONFIG.delete 'enable_shared'
- end
- end
-
# TODO: move to minitest
def refute_path_exists path, msg = nil
msg = message(msg) { "Expected path '#{path}' to not exist" }
@@ -217,14 +194,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def setup
super
- @orig_gem_home = ENV['GEM_HOME']
- @orig_gem_path = ENV['GEM_PATH']
- @orig_gem_vendor = ENV['GEM_VENDOR']
- @orig_gem_spec_cache = ENV['GEM_SPEC_CACHE']
- @orig_rubygems_gemdeps = ENV['RUBYGEMS_GEMDEPS']
- @orig_rubygems_host = ENV['RUBYGEMS_HOST']
-
- ENV['GEM_VENDOR'] = nil
+ @orig_gem_home = ENV['GEM_HOME']
+ @orig_gem_path = ENV['GEM_PATH']
@current_dir = Dir.pwd
@fetcher = nil
@@ -252,17 +223,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@tempdir.untaint
end
- # This makes the tempdir consistent on Windows.
- # Dir.tmpdir may return short path name, but Dir[Dir.tmpdir] returns long
- # path name. https://bugs.ruby-lang.org/issues/10819
- # File.expand_path or File.realpath doesn't convert path name to long path
- # name. Only Dir[] (= Dir.glob) works.
- # Short and long path name is specific to Windows filesystem.
- if win_platform?
- @tempdir = Dir[@tempdir][0]
- @tempdir.untaint
- end
-
@gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome'
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
@@ -278,16 +238,13 @@ class Gem::TestCase < MiniTest::Unit::TestCase
Gem.ensure_gem_subdirectories @gemhome
@orig_LOAD_PATH = $LOAD_PATH.dup
- $LOAD_PATH.map! { |s|
- (expand_path = File.expand_path(s)) == s ? s : expand_path.untaint
- }
+ $LOAD_PATH.map! { |s| File.expand_path(s).untaint }
Dir.chdir @tempdir
@orig_ENV_HOME = ENV['HOME']
ENV['HOME'] = @userhome
Gem.instance_variable_set :@user_home, nil
- Gem.instance_variable_set :@gemdeps, nil
Gem.send :remove_instance_variable, :@ruby_version if
Gem.instance_variables.include? :@ruby_version
@@ -330,10 +287,10 @@ class Gem::TestCase < MiniTest::Unit::TestCase
Gem.searcher = nil
Gem::SpecFetcher.fetcher = nil
- @orig_BASERUBY = RbConfig::CONFIG['BASERUBY']
- RbConfig::CONFIG['BASERUBY'] = RbConfig::CONFIG['ruby_install_name']
+ @orig_BASERUBY = Gem::ConfigMap[:BASERUBY]
+ Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:ruby_install_name]
- @orig_arch = RbConfig::CONFIG['arch']
+ @orig_arch = Gem::ConfigMap[:arch]
if win_platform?
util_set_arch 'i386-mswin32'
@@ -342,7 +299,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
@marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
- @orig_LOADED_FEATURES = $LOADED_FEATURES.dup
end
##
@@ -351,25 +307,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def teardown
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
- if @orig_LOADED_FEATURES
- if @orig_LOAD_PATH
- paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
- ($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
- unless paths.any? {|path| feat.start_with?(path)}
- $LOADED_FEATURES.delete(feat)
- end
- end
- else
- $LOADED_FEATURES.replace @orig_LOADED_FEATURES
- end
- end
- if @orig_BASERUBY
- RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
- else
- RbConfig::CONFIG.delete('BASERUBY')
- end
- RbConfig::CONFIG['arch'] = @orig_arch
+ Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY
+ Gem::ConfigMap[:arch] = @orig_arch
if defined? Gem::RemoteFetcher then
Gem::RemoteFetcher.fetcher = nil
@@ -379,12 +319,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
FileUtils.rm_rf @tempdir unless ENV['KEEP_FILES']
- ENV['GEM_HOME'] = @orig_gem_home
- ENV['GEM_PATH'] = @orig_gem_path
- ENV['GEM_VENDOR'] = @orig_gem_vendor
- ENV['GEM_SPEC_CACHE'] = @orig_gem_spec_cache
- ENV['RUBYGEMS_GEMDEPS'] = @orig_rubygems_gemdeps
- ENV['RUBYGEMS_HOST'] = @orig_rubygems_host
+ ENV['GEM_HOME'] = @orig_gem_home
+ ENV['GEM_PATH'] = @orig_gem_path
Gem.ruby = @orig_ruby if @orig_ruby
@@ -399,7 +335,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = @orig_gem_private_key_passphrase
Gem::Specification._clear_load_cache
- Gem::Specification.unresolved_deps.clear
end
def common_installer_setup
@@ -515,7 +450,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
gem = File.join(@tempdir, File.basename(spec.cache_file)).untaint
end
- Gem::Installer.at(gem, options.merge({:wrappers => true})).install
+ Gem::Installer.new(gem, options.merge({:wrappers => true})).install
end
##
@@ -530,11 +465,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def uninstall_gem spec
require 'rubygems/uninstaller'
- Class.new(Gem::Uninstaller) {
- def ask_if_ok spec
- true
- end
- }.new(spec.name, :executables => true, :user_install => true).uninstall
+ Gem::Uninstaller.new(spec.name,
+ :executables => true, :user_install => true).uninstall
end
##
@@ -553,7 +485,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
# Enables pretty-print for all tests
def mu_pp(obj)
- s = String.new
+ s = ''
s = PP.pp obj, s
s = s.force_encoding(Encoding.default_external) if defined? Encoding
s.chomp
@@ -628,7 +560,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
spec.loaded_from = spec.loaded_from = written_path
- Gem::Specification.reset
+ Gem::Specification.add_spec spec.for_cache
return spec
end
@@ -684,10 +616,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
# Install the provided specs
def install_specs(*specs)
- specs.each do |spec|
- Gem::Installer.for_spec(spec).install
- end
-
+ Gem::Specification.add_specs(*specs)
Gem.searcher = nil
end
@@ -708,9 +637,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
# Install the provided default specs
def install_default_specs(*specs)
+ install_specs(*specs)
specs.each do |spec|
- installer = Gem::Installer.for_spec(spec, :install_as_default => true)
- installer.install
Gem.register_default_spec(spec)
end
end
@@ -822,7 +750,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
end
- Gem::Specification.reset
+ spec.loaded_from = spec.spec_file
+
+ Gem::Specification.add_spec spec
return spec
end
@@ -961,7 +891,7 @@ Also, a list:
# Set the platform to +arch+
def util_set_arch(arch)
- RbConfig::CONFIG['arch'] = arch
+ Gem::ConfigMap[:arch] = arch
platform = Gem::Platform.new arch
Gem.instance_variable_set :@platforms, nil
@@ -1009,13 +939,14 @@ Also, a list:
# Best used with +@all_gems+ from #util_setup_fake_fetcher.
def util_setup_spec_fetcher(*specs)
- all_specs = Gem::Specification.to_a + specs
- Gem::Specification._resort! all_specs
+ specs -= Gem::Specification._all
+ Gem::Specification.add_specs(*specs)
spec_fetcher = Gem::SpecFetcher.fetcher
- prerelease, all = all_specs.partition { |spec| spec.version.prerelease? }
- latest = Gem::Specification._latest_specs all_specs
+ prerelease, all = Gem::Specification.partition { |spec|
+ spec.version.prerelease?
+ }
spec_fetcher.specs[@uri] = []
all.each do |spec|
@@ -1023,7 +954,7 @@ Also, a list:
end
spec_fetcher.latest_specs[@uri] = []
- latest.each do |spec|
+ Gem::Specification.latest_specs.each do |spec|
spec_fetcher.latest_specs[@uri] << spec.name_tuple
end
@@ -1039,7 +970,7 @@ Also, a list:
specs = all.map { |spec| spec.name_tuple }
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
- latest_specs = latest.map do |spec|
+ latest_specs = Gem::Specification.latest_specs.map do |spec|
spec.name_tuple
end
@@ -1054,7 +985,7 @@ Also, a list:
v = Gem.marshal_version
- all_specs.each do |spec|
+ Gem::Specification.each do |spec|
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
data = Marshal.dump spec
data_deflate = Zlib::Deflate.deflate data
@@ -1072,37 +1003,6 @@ Also, a list:
Zlib::Deflate.deflate data
end
- def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil)
- if Gem.instance_variables.include? :@ruby_version or
- Gem.instance_variables.include? '@ruby_version' then
- Gem.send :remove_instance_variable, :@ruby_version
- end
-
- @RUBY_VERSION = RUBY_VERSION
- @RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
- @RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
-
- Object.send :remove_const, :RUBY_VERSION
- Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
- Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
-
- Object.const_set :RUBY_VERSION, version
- Object.const_set :RUBY_PATCHLEVEL, patchlevel if patchlevel
- Object.const_set :RUBY_REVISION, revision if revision
- end
-
- def util_restore_RUBY_VERSION
- Object.send :remove_const, :RUBY_VERSION
- Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
- Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
-
- Object.const_set :RUBY_VERSION, @RUBY_VERSION
- Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
- defined?(@RUBY_PATCHLEVEL)
- Object.const_set :RUBY_REVISION, @RUBY_REVISION if
- defined?(@RUBY_REVISION)
- end
-
##
# Is this test being run on a Windows platform?
@@ -1139,7 +1039,7 @@ Also, a list:
# other platforms, including Cygwin, it will return 'make'.
def self.make_command
- ENV["make"] || ENV["MAKE"] || (vc_windows? ? 'nmake' : 'make')
+ ENV["make"] || (vc_windows? ? 'nmake' : 'make')
end
##
@@ -1148,7 +1048,7 @@ Also, a list:
# other platforms, including Cygwin, it will return 'make'.
def make_command
- ENV["make"] || ENV["MAKE"] || (vc_windows? ? 'nmake' : 'make')
+ ENV["make"] || (vc_windows? ? 'nmake' : 'make')
end
##
@@ -1231,8 +1131,8 @@ Also, a list:
end
@@ruby = rubybin
- @@good_rake = "#{rubybin} \"#{File.expand_path('../../../test/rubygems/good_rake.rb', __FILE__)}\""
- @@bad_rake = "#{rubybin} \"#{File.expand_path('../../../test/rubygems/bad_rake.rb', __FILE__)}\""
+ @@good_rake = "#{rubybin} #{File.expand_path('../../../test/rubygems/good_rake.rb', __FILE__)}"
+ @@bad_rake = "#{rubybin} #{File.expand_path('../../../test/rubygems/bad_rake.rb', __FILE__)}"
##
# Construct a new Gem::Dependency.
@@ -1296,8 +1196,8 @@ Also, a list:
# end
# end
- def spec_fetcher repository = @gem_repo
- Gem::TestCase::SpecFetcherSetup.declare self, repository do |spec_fetcher_setup|
+ def spec_fetcher
+ Gem::TestCase::SpecFetcherSetup.declare self do |spec_fetcher_setup|
yield spec_fetcher_setup if block_given?
end
end
@@ -1318,22 +1218,12 @@ Also, a list:
def vendor_gem name = 'a', version = 1
directory = File.join 'vendor', name
- FileUtils.mkdir_p directory
-
- save_gemspec name, version, directory
- end
-
- ##
- # create_gemspec creates gem specification in given +direcotry+ or '.'
- # for the given +name+ and +version+.
- #
- # Yields the +specification+ to the block, if given
-
- def save_gemspec name = 'a', version = 1, directory = '.'
vendor_spec = Gem::Specification.new name, version do |specification|
yield specification if block_given?
end
+ FileUtils.mkdir_p directory
+
open File.join(directory, "#{name}.gemspec"), 'w' do |io|
io.write vendor_spec.to_ruby
end
@@ -1345,22 +1235,13 @@ Also, a list:
# The StaticSet is a static set of gem specifications used for testing only.
# It is available by requiring Gem::TestCase.
- class StaticSet < Gem::Resolver::Set
-
- ##
- # A StaticSet ignores remote because it has a fixed set of gems.
-
- attr_accessor :remote
+ class StaticSet
##
# Creates a new StaticSet for the given +specs+
def initialize(specs)
- super()
-
@specs = specs
-
- @remote = true
end
##
@@ -1383,7 +1264,7 @@ Also, a list:
# Finds all gems matching +dep+ in this set.
def find_all(dep)
- @specs.find_all { |s| dep.match? s, @prerelease }
+ @specs.find_all { |s| dep.matches_spec? s }
end
##
@@ -1473,35 +1354,5 @@ Also, a list:
end
-# require dependencies that are not discoverable once GEM_HOME and GEM_PATH
-# are wiped
-begin
- gem 'rake'
-rescue Gem::LoadError
-end
-
-begin
- require 'rake/packagetask'
-rescue LoadError
-end
-
-begin
- gem 'rdoc'
- require 'rdoc'
-rescue LoadError, Gem::LoadError
-end
-
-begin
- gem 'builder'
- require 'builder/xchar'
-rescue LoadError, Gem::LoadError
-end
-
require 'rubygems/test_utilities'
-tmpdirs = []
-tmpdirs << (ENV['GEM_HOME'] = Dir.mktmpdir("home"))
-tmpdirs << (ENV['GEM_PATH'] = Dir.mktmpdir("path"))
-pid = $$
-END {tmpdirs.each {|dir| Dir.rmdir(dir)} if $$ == pid}
-Gem.clear_paths
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index 686916ea02..37f54e601e 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'tempfile'
require 'rubygems'
require 'rubygems/remote_fetcher'
@@ -39,8 +38,6 @@ class Gem::FakeFetcher
end
def find_data(path)
- return File.read path.path if URI === path and 'file' == path.scheme
-
if URI === path and "URI::#{path.scheme.upcase}" != path.class.name then
raise ArgumentError,
"mismatch for scheme #{path.scheme} and class #{path.class}"
@@ -104,24 +101,6 @@ class Gem::FakeFetcher
response
end
- def pretty_print q # :nodoc:
- q.group 2, '[FakeFetcher', ']' do
- q.breakable
- q.text 'URIs:'
-
- q.breakable
- q.pp @data.keys
-
- unless @api_endpoints.empty? then
- q.breakable
- q.text 'API endpoints:'
-
- q.breakable
- q.pp @api_endpoints.keys
- end
- end
- end
-
def fetch_size(path)
path = path.to_s
@paths << path
@@ -187,6 +166,7 @@ end
# f.gem 'a', 1
# f.spec 'a', 2
# f.gem 'b', 1' 'a' => '~> 1.0'
+# f.clear
# end
#
# The above declaration creates two gems, a-1 and b-1, with a dependency from
@@ -201,27 +181,29 @@ class Gem::TestCase::SpecFetcherSetup
# Executes a SpecFetcher setup block. Yields an instance then creates the
# gems and specifications defined in the instance.
- def self.declare test, repository
- setup = new test, repository
+ def self.declare test
+ setup = new test
yield setup
setup.execute
end
- def initialize test, repository # :nodoc:
- @test = test
- @repository = repository
+ def initialize test # :nodoc:
+ @test = test
@gems = {}
- @downloaded = []
@installed = []
@operations = []
end
##
- # Returns a Hash of created Specification full names and the corresponding
- # Specification.
+ # Removes any created gems or specifications from Gem.dir (the default
+ # install location).
+
+ def clear
+ @operations << [:clear]
+ end
def created_specs
created = {}
@@ -247,6 +229,9 @@ class Gem::TestCase::SpecFetcherSetup
def execute_operations # :nodoc:
@operations.each do |operation, *arguments|
case operation
+ when :clear then
+ @test.util_clear_gems
+ @installed.clear
when :gem then
spec, gem = @test.util_gem(*arguments, &arguments.pop)
@@ -254,11 +239,6 @@ class Gem::TestCase::SpecFetcherSetup
@gems[spec] = gem
@installed << spec
- when :download then
- spec, gem = @test.util_gem(*arguments, &arguments.pop)
-
- @gems[spec] = gem
- @downloaded << spec
when :spec then
spec = @test.util_spec(*arguments, &arguments.pop)
@@ -282,17 +262,6 @@ class Gem::TestCase::SpecFetcherSetup
end
##
- # Creates a gem with +name+, +version+ and +deps+. The created gem is
- # downloaded in to the cache directory but is not installed
- #
- # The specification will be yielded before gem creation for customization,
- # but only the block or the dependencies may be set, not both.
-
- def download name, version, dependencies = nil, &block
- @operations << [:download, name, version, dependencies, block]
- end
-
- ##
# Creates a legacy platform spec with the name 'pl' and version 1
def legacy_platform
@@ -302,32 +271,27 @@ class Gem::TestCase::SpecFetcherSetup
end
end
- def setup_fetcher # :nodoc:
+ def setup_fetcher # :nodoc;
require 'zlib'
require 'socket'
require 'rubygems/remote_fetcher'
- unless @test.fetcher then
- @test.fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @test.fetcher
- end
+ @test.fetcher = Gem::FakeFetcher.new
+ Gem::RemoteFetcher.fetcher = @test.fetcher
Gem::Specification.reset
- begin
- gem_repo, @test.gem_repo = @test.gem_repo, @repository
- @test.uri = URI @repository
+ @test.util_setup_spec_fetcher(*@gems.keys)
- @test.util_setup_spec_fetcher(*@downloaded)
- ensure
- @test.gem_repo = gem_repo
- @test.uri = URI gem_repo
- end
+ # This works around util_setup_spec_fetcher adding all created gems to the
+ # installed set.
+ Gem::Specification.reset
+ Gem::Specification.add_specs(*@installed)
@gems.each do |spec, gem|
next unless gem
- @test.fetcher.data["#{@repository}gems/#{spec.file_name}"] =
+ @test.fetcher.data["http://gems.example.com/gems/#{spec.file_name}"] =
Gem.read_binary(gem)
FileUtils.cp gem, spec.cache_file
diff --git a/lib/rubygems/text.rb b/lib/rubygems/text.rb
index b944b62c27..793cd953cb 100644
--- a/lib/rubygems/text.rb
+++ b/lib/rubygems/text.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'rubygems'
##
@@ -7,25 +6,12 @@ require 'rubygems'
module Gem::Text
##
- # Remove any non-printable characters and make the text suitable for
- # printing.
- def clean_text(text)
- text.gsub(/[\000-\b\v-\f\016-\037\177]/, ".".freeze)
- end
-
- def truncate_text(text, description, max_length = 100_000)
- raise ArgumentError, "max_length must be positive" unless max_length > 0
- return text if text.size <= max_length
- "Truncating #{description} to #{max_length.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse} characters:\n" + text[0, max_length]
- end
-
- ##
# Wraps +text+ to +wrap+ characters and optionally indents by +indent+
# characters
def format_text(text, wrap, indent=0)
result = []
- work = clean_text(text)
+ work = text.dup
while work.length > wrap do
if work =~ /^(.{0,#{wrap}})[ \n]/ then
@@ -40,16 +26,6 @@ module Gem::Text
result.join("\n").gsub(/^/, " " * indent)
end
- def min3 a, b, c # :nodoc:
- if a < b && a < c then
- a
- elsif b < c then
- b
- else
- c
- end
- end
-
# This code is based directly on the Text gem implementation
# Returns a value representing the "cost" of transforming str1 into str2
def levenshtein_distance str1, str2
@@ -57,23 +33,25 @@ module Gem::Text
t = str2
n = s.length
m = t.length
+ max = n/2
return m if (0 == n)
return n if (0 == m)
+ return n if (n - m).abs > max
d = (0..m).to_a
x = nil
- str1.each_char.each_with_index do |char1,i|
+ n.times do |i|
e = i+1
- str2.each_char.each_with_index do |char2,j|
- cost = (char1 == char2) ? 0 : 1
- x = min3(
+ m.times do |j|
+ cost = (s[i] == t[j]) ? 0 : 1
+ x = [
d[j+1] + 1, # insertion
e + 1, # deletion
d[j] + cost # substitution
- )
+ ].min
d[j] = e
e = x
end
@@ -84,3 +62,4 @@ module Gem::Text
return x
end
end
+
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 89f47a45fe..a1caacb10d 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -97,8 +96,6 @@ class Gem::Uninstaller
(@user_install and spec.base_dir == Gem.user_dir)
end
- list.sort!
-
if list.empty? then
if other_repo_specs.empty?
if default_specs.empty?
@@ -123,8 +120,7 @@ class Gem::Uninstaller
remove_all list
elsif list.size > 1 then
- gem_names = list.map { |gem| gem.full_name }
- gem_names << "All versions"
+ gem_names = list.collect {|gem| gem.full_name} + ["All versions"]
say
_, index = choose_from_list "Select gem to uninstall:", gem_names
@@ -241,7 +237,7 @@ class Gem::Uninstaller
unless path_ok?(@gem_home, spec) or
(@user_install and path_ok?(Gem.user_dir, spec)) then
e = Gem::GemNotInHomeException.new \
- "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}"
+ "Gem is not installed in directory #{@gem_home}"
e.spec = spec
raise e
@@ -251,7 +247,7 @@ class Gem::Uninstaller
File.writable?(spec.base_dir)
FileUtils.rm_rf spec.full_gem_path
- FileUtils.rm_rf spec.extension_dir
+ FileUtils.rm_rf spec.extension_install_dir
old_platform_name = spec.original_name
gemspec = spec.spec_file
@@ -272,7 +268,7 @@ class Gem::Uninstaller
say "Successfully uninstalled #{spec.full_name}"
- Gem::Specification.reset
+ Gem::Specification.remove_spec spec
end
##
diff --git a/lib/rubygems/uri_formatter.rb b/lib/rubygems/uri_formatter.rb
index bb128e4ef9..68aacc6369 100644
--- a/lib/rubygems/uri_formatter.rb
+++ b/lib/rubygems/uri_formatter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
require 'cgi'
require 'uri'
diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb
index 6c8534dd55..0e4449a2ec 100644
--- a/lib/rubygems/user_interaction.rb
+++ b/lib/rubygems/user_interaction.rb
@@ -1,15 +1,9 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
-begin
- require 'io/console'
-rescue LoadError
-end
-
##
# Module that defines the default UserInteraction. Any class including this
# module will have access to the +ui+ method that returns the default UI.
@@ -158,14 +152,6 @@ module Gem::UserInteraction
def terminate_interaction exit_code = 0
ui.terminate_interaction exit_code
end
-
- ##
- # Calls +say+ with +msg+ or the results of the block if really_verbose
- # is true.
-
- def verbose msg = nil
- say(msg || yield) if Gem.configuration.really_verbose
- end
end
##
@@ -297,28 +283,43 @@ class Gem::StreamUI
result
end
- ##
- # Ask for a password. Does not echo response to terminal.
+ if RUBY_VERSION > '1.9.2' then
+ ##
+ # Ask for a password. Does not echo response to terminal.
- def ask_for_password(question)
- return nil if not tty?
+ def ask_for_password(question)
+ return nil if not tty?
- @outs.print(question, " ")
- @outs.flush
+ require 'io/console'
- password = _gets_noecho
- @outs.puts
- password.chomp! if password
- password
- end
+ @outs.print(question + " ")
+ @outs.flush
- if IO.method_defined?(:noecho) then
- def _gets_noecho
- @ins.noecho {@ins.gets}
+ password = @ins.noecho {@ins.gets}
+ password.chomp! if password
+ password
end
- elsif Gem.win_platform?
- def _gets_noecho
+ else
+ ##
+ # Ask for a password. Does not echo response to terminal.
+
+ def ask_for_password(question)
+ return nil if not tty?
+
+ @outs.print(question + " ")
+ @outs.flush
+
+ Gem.win_platform? ? ask_for_password_on_windows : ask_for_password_on_unix
+ end
+
+ ##
+ # Asks for a password that works on windows. Ripped from the Heroku gem.
+
+ def ask_for_password_on_windows
+ return nil if not tty?
+
require "Win32API"
+ char = nil
password = ''
while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
@@ -329,16 +330,22 @@ class Gem::StreamUI
password << char.chr
end
end
+
+ puts
password
end
- else
- def _gets_noecho
+
+ ##
+ # Asks for a password that works on unix
+
+ def ask_for_password_on_unix
+ return nil if not tty?
+
system "stty -echo"
- begin
- @ins.gets
- ensure
- system "stty echo"
- end
+ password = @ins.gets
+ password.chomp! if password
+ system "stty echo"
+ password
end
end
@@ -386,17 +393,17 @@ class Gem::StreamUI
# handlers that might have been defined.
def terminate_interaction(status = 0)
- close
raise Gem::SystemExitException, status
end
- def close
- end
-
##
# Return a progress reporter object chosen from the current verbosity.
def progress_reporter(*args)
+ if self.kind_of?(Gem::SilentUI)
+ return SilentProgressReporter.new(@outs, *args)
+ end
+
case Gem.configuration.verbose
when nil, false
SilentProgressReporter.new(@outs, *args)
@@ -530,6 +537,10 @@ class Gem::StreamUI
# Return a download reporter object chosen from the current verbosity
def download_reporter(*args)
+ if self.kind_of?(Gem::SilentUI)
+ return SilentDownloadReporter.new(@outs, *args)
+ end
+
case Gem.configuration.verbose
when nil, false
SilentDownloadReporter.new(@outs, *args)
@@ -655,11 +666,6 @@ end
# STDOUT, and STDERR.
class Gem::ConsoleUI < Gem::StreamUI
-
- ##
- # The Console UI has no arguments as it defaults to reading input from
- # stdin, output to stdout and warnings or errors to stderr.
-
def initialize
super STDIN, STDOUT, STDERR, true
end
@@ -669,10 +675,6 @@ end
# SilentUI is a UI choice that is absolutely silent.
class Gem::SilentUI < Gem::StreamUI
-
- ##
- # The SilentUI has no arguments as it does not use any stream.
-
def initialize
reader, writer = nil, nil
@@ -687,17 +689,11 @@ class Gem::SilentUI < Gem::StreamUI
super reader, writer, writer, false
end
- def close
- super
- @ins.close
- @outs.close
- end
-
- def download_reporter(*args) # :nodoc:
+ def download_reporter(*args)
SilentDownloadReporter.new(@outs, *args)
end
- def progress_reporter(*args) # :nodoc:
+ def progress_reporter(*args)
SilentProgressReporter.new(@outs, *args)
end
end
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
index ead2babc1f..42663974a5 100644
--- a/lib/rubygems/util.rb
+++ b/lib/rubygems/util.rb
@@ -1,18 +1,11 @@
-# frozen_string_literal: true
-##
-# This module contains various utility methods as module methods.
-
module Gem::Util
-
- @silent_mutex = nil
-
##
# Zlib::GzipReader wrapper that unzips +data+.
def self.gunzip(data)
require 'zlib'
- require 'stringio'
- data = StringIO.new(data, 'r')
+ require 'rubygems/util/stringio'
+ data = Gem::StringSource.new data
unzipped = Zlib::GzipReader.new(data).read
unzipped.force_encoding Encoding::BINARY if Object.const_defined? :Encoding
@@ -24,8 +17,8 @@ module Gem::Util
def self.gzip(data)
require 'zlib'
- require 'stringio'
- zipped = StringIO.new(String.new, 'w')
+ require 'rubygems/util/stringio'
+ zipped = Gem::StringSink.new
zipped.set_encoding Encoding::BINARY if Object.const_defined? :Encoding
Zlib::GzipWriter.wrap zipped do |io| io.write data end
@@ -67,69 +60,4 @@ module Gem::Util
end
end
- NULL_DEVICE = defined?(IO::NULL) ? IO::NULL : Gem.win_platform? ? 'NUL' : '/dev/null'
-
- ##
- # Invokes system, but silences all output.
-
- def self.silent_system *command
- opt = {:out => NULL_DEVICE, :err => [:child, :out]}
- if Hash === command.last
- opt.update(command.last)
- cmds = command[0...-1]
- else
- cmds = command.dup
- end
- return system(*(cmds << opt))
- rescue TypeError
- require 'thread'
-
- @silent_mutex ||= Mutex.new
-
- null_device = NULL_DEVICE
-
- @silent_mutex.synchronize do
- begin
- stdout = STDOUT.dup
- stderr = STDERR.dup
-
- STDOUT.reopen null_device, 'w'
- STDERR.reopen null_device, 'w'
-
- return system(*command)
- ensure
- STDOUT.reopen stdout
- STDERR.reopen stderr
- stdout.close
- stderr.close
- end
- end
- end
-
- ##
- # Enumerates the parents of +directory+.
-
- def self.traverse_parents directory
- return enum_for __method__, directory unless block_given?
-
- here = File.expand_path directory
- start = here
-
- Dir.chdir start
-
- begin
- loop do
- yield here
-
- Dir.chdir '..'
-
- return if Dir.pwd == here # toplevel
-
- here = Dir.pwd
- end
- ensure
- Dir.chdir start
- end
- end
-
end
diff --git a/lib/rubygems/util/licenses.rb b/lib/rubygems/util/licenses.rb
deleted file mode 100644
index f4a99af39e..0000000000
--- a/lib/rubygems/util/licenses.rb
+++ /dev/null
@@ -1,343 +0,0 @@
-# frozen_string_literal: true
-require 'rubygems/text'
-
-class Gem::Licenses
- extend Gem::Text
-
- NONSTANDARD = 'Nonstandard'.freeze
-
- # Software Package Data Exchange (SPDX) standard open-source software
- # license identifiers
- IDENTIFIERS = %w(
- 0BSD
- AAL
- ADSL
- AFL-1.1
- AFL-1.2
- AFL-2.0
- AFL-2.1
- AFL-3.0
- AGPL-1.0
- AGPL-3.0
- AMDPLPA
- AML
- AMPAS
- ANTLR-PD
- APAFML
- APL-1.0
- APSL-1.0
- APSL-1.1
- APSL-1.2
- APSL-2.0
- Abstyles
- Adobe-2006
- Adobe-Glyph
- Afmparse
- Aladdin
- Apache-1.0
- Apache-1.1
- Apache-2.0
- Artistic-1.0
- Artistic-1.0-Perl
- Artistic-1.0-cl8
- Artistic-2.0
- BSD-2-Clause
- BSD-2-Clause-FreeBSD
- BSD-2-Clause-NetBSD
- BSD-3-Clause
- BSD-3-Clause-Attribution
- BSD-3-Clause-Clear
- BSD-3-Clause-LBNL
- BSD-4-Clause
- BSD-4-Clause-UC
- BSD-Protection
- BSL-1.0
- Bahyph
- Barr
- Beerware
- BitTorrent-1.0
- BitTorrent-1.1
- Borceux
- CATOSL-1.1
- CC-BY-1.0
- CC-BY-2.0
- CC-BY-2.5
- CC-BY-3.0
- CC-BY-4.0
- CC-BY-NC-1.0
- CC-BY-NC-2.0
- CC-BY-NC-2.5
- CC-BY-NC-3.0
- CC-BY-NC-4.0
- CC-BY-NC-ND-1.0
- CC-BY-NC-ND-2.0
- CC-BY-NC-ND-2.5
- CC-BY-NC-ND-3.0
- CC-BY-NC-ND-4.0
- CC-BY-NC-SA-1.0
- CC-BY-NC-SA-2.0
- CC-BY-NC-SA-2.5
- CC-BY-NC-SA-3.0
- CC-BY-NC-SA-4.0
- CC-BY-ND-1.0
- CC-BY-ND-2.0
- CC-BY-ND-2.5
- CC-BY-ND-3.0
- CC-BY-ND-4.0
- CC-BY-SA-1.0
- CC-BY-SA-2.0
- CC-BY-SA-2.5
- CC-BY-SA-3.0
- CC-BY-SA-4.0
- CC0-1.0
- CDDL-1.0
- CDDL-1.1
- CECILL-1.0
- CECILL-1.1
- CECILL-2.0
- CECILL-2.1
- CECILL-B
- CECILL-C
- CNRI-Jython
- CNRI-Python
- CNRI-Python-GPL-Compatible
- CPAL-1.0
- CPL-1.0
- CPOL-1.02
- CUA-OPL-1.0
- Caldera
- ClArtistic
- Condor-1.1
- Crossword
- CrystalStacker
- Cube
- D-FSL-1.0
- DOC
- DSDP
- Dotseqn
- ECL-1.0
- ECL-2.0
- EFL-1.0
- EFL-2.0
- EPL-1.0
- EUDatagrid
- EUPL-1.0
- EUPL-1.1
- Entessa
- ErlPL-1.1
- Eurosym
- FSFUL
- FSFULLR
- FTL
- Fair
- Frameworx-1.0
- FreeImage
- GFDL-1.1
- GFDL-1.2
- GFDL-1.3
- GL2PS
- GPL-1.0
- GPL-2.0
- GPL-3.0
- Giftware
- Glide
- Glulxe
- HPND
- HaskellReport
- IBM-pibs
- ICU
- IJG
- IPA
- IPL-1.0
- ISC
- ImageMagick
- Imlib2
- Intel
- Intel-ACPI
- Interbase-1.0
- JSON
- JasPer-2.0
- LGPL-2.0
- LGPL-2.1
- LGPL-3.0
- LGPLLR
- LPL-1.0
- LPL-1.02
- LPPL-1.0
- LPPL-1.1
- LPPL-1.2
- LPPL-1.3a
- LPPL-1.3c
- Latex2e
- Leptonica
- Libpng
- MIT
- MIT-CMU
- MIT-advertising
- MIT-enna
- MIT-feh
- MITNFA
- MPL-1.0
- MPL-1.1
- MPL-2.0
- MPL-2.0-no-copyleft-exception
- MS-PL
- MS-RL
- MTLL
- MakeIndex
- MirOS
- Motosoto
- Multics
- Mup
- NASA-1.3
- NBPL-1.0
- NCSA
- NGPL
- NLPL
- NOSL
- NPL-1.0
- NPL-1.1
- NPOSL-3.0
- NRL
- NTP
- Naumen
- NetCDF
- Newsletr
- Nokia
- Noweb
- Nunit
- OCLC-2.0
- ODbL-1.0
- OFL-1.0
- OFL-1.1
- OGTSL
- OLDAP-1.1
- OLDAP-1.2
- OLDAP-1.3
- OLDAP-1.4
- OLDAP-2.0
- OLDAP-2.0.1
- OLDAP-2.1
- OLDAP-2.2
- OLDAP-2.2.1
- OLDAP-2.2.2
- OLDAP-2.3
- OLDAP-2.4
- OLDAP-2.5
- OLDAP-2.6
- OLDAP-2.7
- OLDAP-2.8
- OML
- OPL-1.0
- OSL-1.0
- OSL-1.1
- OSL-2.0
- OSL-2.1
- OSL-3.0
- OpenSSL
- PDDL-1.0
- PHP-3.0
- PHP-3.01
- Plexus
- PostgreSQL
- Python-2.0
- QPL-1.0
- Qhull
- RHeCos-1.1
- RPL-1.1
- RPL-1.5
- RPSL-1.0
- RSA-MD
- RSCPL
- Rdisc
- Ruby
- SAX-PD
- SCEA
- SGI-B-1.0
- SGI-B-1.1
- SGI-B-2.0
- SISSL
- SISSL-1.2
- SMLNJ
- SNIA
- SPL-1.0
- SWL
- Saxpath
- Sendmail
- SimPL-2.0
- Sleepycat
- Spencer-86
- Spencer-94
- Spencer-99
- SugarCRM-1.1.3
- TCL
- TMate
- TORQUE-1.1
- TOSL
- UPL-1.0
- Unicode-TOU
- Unlicense
- VOSTROM
- VSL-1.0
- Vim
- W3C
- W3C-19980720
- WTFPL
- Watcom-1.0
- Wsuipa
- X11
- XFree86-1.1
- XSkat
- Xerox
- Xnet
- YPL-1.0
- YPL-1.1
- ZPL-1.1
- ZPL-2.0
- ZPL-2.1
- Zed
- Zend-2.0
- Zimbra-1.3
- Zimbra-1.4
- Zlib
- bzip2-1.0.5
- bzip2-1.0.6
- diffmark
- dvipdfm
- eGenix
- gSOAP-1.3b
- gnuplot
- iMatix
- libtiff
- mpich2
- psfrag
- psutils
- xinetd
- xpp
- zlib-acknowledgement
- ).freeze
-
- REGEXP = %r{
- \A
- (
- #{Regexp.union(IDENTIFIERS)}
- \+?
- (\s WITH \s .+)?
- | #{NONSTANDARD}
- )
- \Z
- }ox.freeze
-
- def self.match?(license)
- !REGEXP.match(license).nil?
- end
-
- def self.suggestions(license)
- by_distance = IDENTIFIERS.group_by do |identifier|
- levenshtein_distance(identifier, license)
- end
- lowest = by_distance.keys.min
- return unless lowest < license.size
- by_distance[lowest]
- end
-end
diff --git a/lib/rubygems/util/list.rb b/lib/rubygems/util/list.rb
index 9c25f6b6dc..9bc11fe334 100644
--- a/lib/rubygems/util/list.rb
+++ b/lib/rubygems/util/list.rb
@@ -1,14 +1,7 @@
-# frozen_string_literal: true
module Gem
- class List
- include Enumerable
- attr_accessor :value, :tail
-
- def initialize(value = nil, tail = nil)
- @value = value
- @tail = tail
- end
+ List = Struct.new(:value, :tail)
+ class List
def each
n = self
while n
@@ -18,7 +11,25 @@ module Gem
end
def to_a
- super.reverse
+ ary = []
+ n = self
+ while n
+ ary.unshift n.value
+ n = n.tail
+ end
+
+ ary
+ end
+
+ def find
+ n = self
+ while n
+ v = n.value
+ return v if yield(v)
+ n = n.tail
+ end
+
+ nil
end
def prepend(value)
diff --git a/lib/rubygems/util/stringio.rb b/lib/rubygems/util/stringio.rb
new file mode 100644
index 0000000000..2ea69617bc
--- /dev/null
+++ b/lib/rubygems/util/stringio.rb
@@ -0,0 +1,34 @@
+class Gem::StringSink
+ def initialize
+ @string = ""
+ end
+
+ attr_reader :string
+
+ def write(s)
+ @string += s
+ s.size
+ end
+
+ def set_encoding(enc)
+ @string.force_encoding enc
+ end
+end
+
+class Gem::StringSource
+ def initialize(str)
+ @string = str.dup
+ end
+
+ def read(count=nil)
+ if count
+ @string.slice!(0,count)
+ else
+ s = @string
+ @string = ""
+ s
+ end
+ end
+
+ alias_method :readpartial, :read
+end
diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb
index 83448229bb..1436a93ae6 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -87,7 +86,6 @@ class Gem::Validator
Gem::Specification.each do |spec|
next unless gems.include? spec.name unless gems.empty?
- next if spec.default_gem?
gem_name = spec.file_name
gem_path = spec.cache_file
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index 54da49e8e8..fda8b0b5d4 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
##
# The Version class processes string versions into comparable
# values. A version string should normally be a series of numbers
@@ -23,11 +22,6 @@
# 3. 1.0.a.2
# 4. 0.9
#
-# If you want to specify a version restriction that includes both prereleases
-# and regular releases of the 1.x series this is the best way:
-#
-# s.add_dependency 'example', '>= 1.0.0.a', '< 2.0.0'
-#
# == How Software Changes
#
# Users expect to be able to specify a version constraint that gives them
@@ -87,8 +81,8 @@
#
# * Any "public" release of a gem should have a different version. Normally
# that means incrementing the build number. This means a developer can
-# generate builds all day long, but as soon as they make a public release,
-# the version must be updated.
+# generate builds all day long for himself, but as soon as he/she makes a
+# public release, the version must be updated.
#
# === Examples
#
@@ -105,25 +99,26 @@
# Version 1.1.1:: Fixed a bug in the linked list implementation.
# Version 1.1.2:: Fixed a bug introduced in the last fix.
#
-# Client A needs a stack with basic push/pop capability. They write to the
-# original interface (no <tt>top</tt>), so their version constraint looks like:
+# Client A needs a stack with basic push/pop capability. He writes to the
+# original interface (no <tt>top</tt>), so his version constraint looks
+# like:
#
-# gem 'stack', '>= 0.0'
+# gem 'stack', '~> 0.0'
#
# Essentially, any version is OK with Client A. An incompatible change to
-# the library will cause them grief, but they are willing to take the chance
-# (we call Client A optimistic).
+# the library will cause him grief, but he is willing to take the chance (we
+# call Client A optimistic).
#
-# Client B is just like Client A except for two things: (1) They use the
-# <tt>depth</tt> method and (2) they are worried about future
-# incompatibilities, so they write their version constraint like this:
+# Client B is just like Client A except for two things: (1) He uses the
+# <tt>depth</tt> method and (2) he is worried about future
+# incompatibilities, so he writes his version constraint like this:
#
# gem 'stack', '~> 0.1'
#
# The <tt>depth</tt> method was introduced in version 0.1.0, so that version
# or anything later is fine, as long as the version stays below version 1.0
# where incompatibilities are introduced. We call Client B pessimistic
-# because they are worried about incompatible future changes (it is OK to be
+# because he is worried about incompatible future changes (it is OK to be
# pessimistic!).
#
# == Preventing Version Catastrophe:
@@ -144,10 +139,6 @@
# "~> 3.0.0" 3.0.0 ... 3.1
# "~> 3.5" 3.5 ... 4.0
# "~> 3.5.0" 3.5.0 ... 3.6
-# "~> 3" 3.0 ... 4.0
-#
-# For the last example, single-digit versions are automatically extended with
-# a zero to give a sensible result.
class Gem::Version
autoload :Requirement, 'rubygems/requirement'
@@ -194,8 +185,6 @@ class Gem::Version
@@all = {}
def self.new version # :nodoc:
- return super unless Gem::Version == self
-
@@all[version] ||= super
end
@@ -218,14 +207,12 @@ class Gem::Version
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
def bump
- @bump ||= begin
- segments = self.segments.dup
- segments.pop while segments.any? { |s| String === s }
- segments.pop if segments.size > 1
-
- segments[-1] = segments[-1].succ
- self.class.new segments.join(".")
- end
+ segments = self.segments.dup
+ segments.pop while segments.any? { |s| String === s }
+ segments.pop if segments.size > 1
+
+ segments[-1] = segments[-1].succ
+ self.class.new segments.join(".")
end
##
@@ -233,11 +220,11 @@ class Gem::Version
# same precision. Version "1.0" is not the same as version "1".
def eql? other
- self.class === other and @version == other._version
+ self.class === other and @version == other.version
end
def hash # :nodoc:
- @version.hash
+ @hash ||= segments.hash
end
def init_with coder # :nodoc:
@@ -282,10 +269,7 @@ class Gem::Version
# A version is considered a prerelease if it contains a letter.
def prerelease?
- unless instance_variable_defined? :@prerelease
- @prerelease = !!(@version =~ /[a-zA-Z]/)
- end
- @prerelease
+ @prerelease ||= !!(@version =~ /[a-zA-Z]/)
end
def pretty_print q # :nodoc:
@@ -297,13 +281,11 @@ class Gem::Version
# Non-prerelease versions return themselves.
def release
- @release ||= if prerelease?
- segments = self.segments.dup
- segments.pop while segments.any? { |s| String === s }
- self.class.new segments.join('.')
- else
- self
- end
+ return self unless prerelease?
+
+ segments = self.segments.dup
+ segments.pop while segments.any? { |s| String === s }
+ self.class.new segments.join('.')
end
def segments # :nodoc:
@@ -337,7 +319,7 @@ class Gem::Version
def <=> other
return unless Gem::Version === other
- return 0 if @version == other._version
+ return 0 if @version == other.version
lhsegments = segments
rhsegments = other.segments
@@ -361,10 +343,4 @@ class Gem::Version
return 0
end
-
- protected
-
- def _version
- @version
- end
end
diff --git a/lib/rubygems/version_option.rb b/lib/rubygems/version_option.rb
index 3209d95f0f..a0755d5020 100644
--- a/lib/rubygems/version_option.rb
+++ b/lib/rubygems/version_option.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
diff --git a/lib/scanf.rb b/lib/scanf.rb
index a98c359573..199eb16cce 100644
--- a/lib/scanf.rb
+++ b/lib/scanf.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# scanf for Ruby
#
#--
@@ -472,7 +471,8 @@ module Scanf
end
def width
- @spec_string[/%\*?(\d+)/, 1]&.to_i
+ w = @spec_string[/%\*?(\d+)/, 1]
+ w && w.to_i
end
def mid_match?
@@ -603,14 +603,14 @@ class IO
# If a block is given, the value from that is returned from
# the yield is added to an output array.
#
- # "123 456".block_scanf("%d") do |digit,| # the ',' unpacks the Array
+ # "123 456".block_scanf("%d) do |digit,| # the ',' unpacks the Array
# digit + 100
# end
# # => [223, 556]
#
# See Scanf for details on creating a format string.
#
- # You will need to require 'scanf' to use IO#scanf.
+ # You will need to require 'scanf' to use use IO#scanf.
def scanf(str,&b) #:yield: current_match
return block_scanf(str,&b) if b
return [] unless str.size > 0
@@ -657,12 +657,7 @@ class IO
break if fstr.last_spec
fstr.prune
end
-
- begin
- seek(start_position + matched_so_far, IO::SEEK_SET)
- rescue Errno::ESPIPE
- end
-
+ seek(start_position + matched_so_far, IO::SEEK_SET) rescue Errno::ESPIPE
soak_up_spaces if fstr.last_spec && fstr.space
return final_result
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 596d8ed389..4f2c35cabd 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -1,5 +1,3 @@
-# -*- coding: us-ascii -*-
-# frozen_string_literal: true
begin
require 'openssl'
rescue LoadError
@@ -7,14 +5,10 @@ end
# == Secure random number generator interface.
#
-# This library is an interface to secure random number generators which are
-# suitable for generating session keys in HTTP cookies, etc.
+# This library is an interface for secure random number generator which is
+# suitable for generating session key in HTTP cookies, etc.
#
-# You can use this library in your application by requiring it:
-#
-# require 'securerandom'
-#
-# It supports the following secure random number generators:
+# It supports following secure random number generators.
#
# * openssl
# * /dev/urandom
@@ -22,99 +16,122 @@ end
#
# === Examples
#
-# Generate random hexadecimal strings:
-#
-# require 'securerandom'
+# Hexadecimal string.
#
# p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
# p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
# p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
#
-# Generate random base64 strings:
+# Base64 string.
#
# p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA=="
# p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg=="
# p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8"
#
-# Generate random binary strings:
+# Binary string.
#
# p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
# p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
-#
-# Generate UUIDs:
-#
-# p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
-# p SecureRandom.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
-#
-
module SecureRandom
- if defined?(OpenSSL::Random) && /mswin|mingw/ !~ RUBY_PLATFORM
- def self.gen_random(n)
+ # SecureRandom.random_bytes generates a random binary string.
+ #
+ # The argument _n_ specifies the length of the result string.
+ #
+ # If _n_ is not specified or is nil, 16 is assumed.
+ # It may be larger in future.
+ #
+ # The result may contain any byte: "\x00" - "\xff".
+ #
+ # p SecureRandom.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6"
+ # p SecureRandom.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97"
+ #
+ # If secure random number generator is not available,
+ # NotImplementedError is raised.
+ def self.random_bytes(n=nil)
+ n = n ? n.to_int : 16
+
+ if defined? OpenSSL::Random
@pid = 0 unless defined?(@pid)
pid = $$
unless @pid == pid
now = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
ary = [now, @pid, pid]
OpenSSL::Random.random_add(ary.join("").to_s, 0.0)
- seed = Random.raw_seed(16)
- if (seed)
- OpenSSL::Random.random_add(seed, 16)
- end
@pid = pid
end
return OpenSSL::Random.random_bytes(n)
end
- else
- def self.gen_random(n)
- ret = Random.raw_seed(n)
- unless ret
- raise NotImplementedError, "No random device"
- end
- unless ret.length == n
- raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
+
+ if !defined?(@has_urandom) || @has_urandom
+ flags = File::RDONLY
+ flags |= File::NONBLOCK if defined? File::NONBLOCK
+ flags |= File::NOCTTY if defined? File::NOCTTY
+ begin
+ File.open("/dev/urandom", flags) {|f|
+ unless f.stat.chardev?
+ raise Errno::ENOENT
+ end
+ @has_urandom = true
+ ret = f.read(n)
+ unless ret.length == n
+ raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
+ end
+ return ret
+ }
+ rescue Errno::ENOENT
+ @has_urandom = false
end
- ret
end
- end
-end
-module Random::Formatter
+ unless defined?(@has_win32)
+ begin
+ require 'Win32API'
- # SecureRandom.random_bytes generates a random binary string.
- #
- # The argument _n_ specifies the length of the result string.
- #
- # If _n_ is not specified or is nil, 16 is assumed.
- # It may be larger in future.
- #
- # The result may contain any byte: "\x00" - "\xff".
- #
- # p SecureRandom.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6"
- # p SecureRandom.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97"
- #
- # If a secure random number generator is not available,
- # +NotImplementedError+ is raised.
- def random_bytes(n=nil)
- n = n ? n.to_int : 16
- gen_random(n)
+ crypt_acquire_context = Win32API.new("advapi32", "CryptAcquireContext", 'PPPII', 'L')
+ @crypt_gen_random = Win32API.new("advapi32", "CryptGenRandom", 'VIP', 'L')
+
+ hProvStr = " " * DL::SIZEOF_VOIDP
+ prov_rsa_full = 1
+ crypt_verifycontext = 0xF0000000
+
+ if crypt_acquire_context.call(hProvStr, nil, nil, prov_rsa_full, crypt_verifycontext) == 0
+ raise SystemCallError, "CryptAcquireContext failed: #{lastWin32ErrorMessage}"
+ end
+ type = DL::SIZEOF_VOIDP == DL::SIZEOF_LONG_LONG ? 'q' : 'l'
+ @hProv, = hProvStr.unpack(type)
+
+ @has_win32 = true
+ rescue LoadError
+ @has_win32 = false
+ end
+ end
+ if @has_win32
+ bytes = " ".force_encoding("ASCII-8BIT") * n
+ if @crypt_gen_random.call(@hProv, bytes.size, bytes) == 0
+ raise SystemCallError, "CryptGenRandom failed: #{lastWin32ErrorMessage}"
+ end
+ return bytes
+ end
+
+ raise NotImplementedError, "No random device"
end
# SecureRandom.hex generates a random hexadecimal string.
#
# The argument _n_ specifies the length, in bytes, of the random number to be generated.
- # The length of the resulting hexadecimal string is twice of _n_.
+ # The length of the resulting hexadecimal string is twice _n_.
#
# If _n_ is not specified or is nil, 16 is assumed.
- # It may be larger in the future.
+ # It may be larger in future.
#
# The result may contain 0-9 and a-f.
#
# p SecureRandom.hex #=> "eb693ec8252cd630102fd0d0fb7c3485"
# p SecureRandom.hex #=> "91dc3bfb4de5b11d029d376634589b61"
#
- # If a secure random number generator is not available,
- # +NotImplementedError+ is raised.
- def hex(n=nil)
+ # If secure random number generator is not available,
+ # NotImplementedError is raised.
+ def self.hex(n=nil)
random_bytes(n).unpack("H*")[0]
end
@@ -124,18 +141,18 @@ module Random::Formatter
# to be generated. The length of the result string is about 4/3 of _n_.
#
# If _n_ is not specified or is nil, 16 is assumed.
- # It may be larger in the future.
+ # It may be larger in future.
#
# The result may contain A-Z, a-z, 0-9, "+", "/" and "=".
#
# p SecureRandom.base64 #=> "/2BuBuLf3+WfSKyQbRcc/A=="
# p SecureRandom.base64 #=> "6BbW0pxO0YENxn38HMUbcQ=="
#
- # If a secure random number generator is not available,
- # +NotImplementedError+ is raised.
+ # If secure random number generator is not available,
+ # NotImplementedError is raised.
#
# See RFC 3548 for the definition of base64.
- def base64(n=nil)
+ def self.base64(n=nil)
[random_bytes(n)].pack("m*").delete("\n")
end
@@ -145,7 +162,7 @@ module Random::Formatter
# to be generated. The length of the result string is about 4/3 of _n_.
#
# If _n_ is not specified or is nil, 16 is assumed.
- # It may be larger in the future.
+ # It may be larger in future.
#
# The boolean argument _padding_ specifies the padding.
# If it is false or nil, padding is not generated.
@@ -161,11 +178,11 @@ module Random::Formatter
# p SecureRandom.urlsafe_base64(nil, true) #=> "i0XQ-7gglIsHGV2_BNPrdQ=="
# p SecureRandom.urlsafe_base64(nil, true) #=> "-M8rLhr7JEpJlqFGUMmOxg=="
#
- # If a secure random number generator is not available,
- # +NotImplementedError+ is raised.
+ # If secure random number generator is not available,
+ # NotImplementedError is raised.
#
# See RFC 3548 for the definition of URL-safe base64.
- def urlsafe_base64(n=nil, padding=false)
+ def self.urlsafe_base64(n=nil, padding=false)
s = [random_bytes(n)].pack("m*")
s.delete!("\n")
s.tr!("+/", "-_")
@@ -173,77 +190,71 @@ module Random::Formatter
s
end
-=begin
# SecureRandom.random_number generates a random number.
#
# If a positive integer is given as _n_,
- # +SecureRandom.random_number+ returns an integer, such that:
- # +0 <= SecureRandom.random_number(n) < n+.
+ # SecureRandom.random_number returns an integer:
+ # 0 <= SecureRandom.random_number(n) < n.
#
# p SecureRandom.random_number(100) #=> 15
# p SecureRandom.random_number(100) #=> 88
#
# If 0 is given or an argument is not given,
- # +SecureRandom.random_number+ returns a float, such that:
- # +0.0 <= SecureRandom.random_number() < 1.0+.
+ # SecureRandom.random_number returns a float:
+ # 0.0 <= SecureRandom.random_number() < 1.0.
#
# p SecureRandom.random_number #=> 0.596506046187744
# p SecureRandom.random_number #=> 0.350621695741409
#
- def random_number(n=0)
+ def self.random_number(n=0)
if 0 < n
- if defined? OpenSSL::BN
- OpenSSL::BN.rand_range(n).to_i
- else
- hex = n.to_s(16)
- hex = '0' + hex if (hex.length & 1) == 1
- bin = [hex].pack("H*")
- mask = bin[0].ord
- mask |= mask >> 1
- mask |= mask >> 2
- mask |= mask >> 4
- begin
- rnd = random_bytes(bin.length)
- rnd[0] = (rnd[0].ord & mask).chr
- end until rnd < bin
- rnd.unpack("H*")[0].hex
- end
+ hex = n.to_s(16)
+ hex = '0' + hex if (hex.length & 1) == 1
+ bin = [hex].pack("H*")
+ mask = bin[0].ord
+ mask |= mask >> 1
+ mask |= mask >> 2
+ mask |= mask >> 4
+ begin
+ rnd = SecureRandom.random_bytes(bin.length)
+ rnd[0] = (rnd[0].ord & mask).chr
+ end until rnd < bin
+ rnd.unpack("H*")[0].hex
else
# assumption: Float::MANT_DIG <= 64
- if defined? OpenSSL::BN
- i64 = OpenSSL::BN.rand(64, -1).to_i
- else
- i64 = random_bytes(8).unpack("Q")[0]
- end
+ i64 = SecureRandom.random_bytes(8).unpack("Q")[0]
Math.ldexp(i64 >> (64-Float::MANT_DIG), -Float::MANT_DIG)
end
end
-=end
- # SecureRandom.uuid generates a random v4 UUID (Universally Unique IDentifier).
+ # SecureRandom.uuid generates a v4 random UUID (Universally Unique IDentifier).
#
# p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
# p SecureRandom.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
# p SecureRandom.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
#
# The version 4 UUID is purely random (except the version).
- # It doesn't contain meaningful information such as MAC addresses, timestamps, etc.
- #
- # The result contains 122 random bits (15.25 random bytes).
+ # It doesn't contain meaningful information such as MAC address, time, etc.
#
# See RFC 4122 for details of UUID.
#
- def uuid
- ary = random_bytes(16).unpack("NnnnnN")
+ def self.uuid
+ ary = self.random_bytes(16).unpack("NnnnnN")
ary[2] = (ary[2] & 0x0fff) | 0x4000
ary[3] = (ary[3] & 0x3fff) | 0x8000
"%08x-%04x-%04x-%04x-%04x%08x" % ary
end
- private
- def gen_random(n)
- self.bytes(n)
+ # Following code is based on David Garamond's GUID library for Ruby.
+ def self.lastWin32ErrorMessage # :nodoc:
+ get_last_error = Win32API.new("kernel32", "GetLastError", '', 'L')
+ format_message = Win32API.new("kernel32", "FormatMessageA", 'LPLLPLPPPPPPPP', 'L')
+ format_message_ignore_inserts = 0x00000200
+ format_message_from_system = 0x00001000
+
+ code = get_last_error.call
+ msg = "\0" * 1024
+ len = format_message.call(format_message_ignore_inserts + format_message_from_system, 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil)
+ msg[0, len].force_encoding("filesystem").tr("\r", '').chomp
end
end
-
-SecureRandom.extend(Random::Formatter)
diff --git a/lib/set.rb b/lib/set.rb
index a8f4345f35..cc068f0a52 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -1,6 +1,4 @@
#--
-# frozen_string_literal: true
-#
# set.rb - defines the Set class
#++
# Copyright (c) 2002-2013 Akinori MUSHA <knu@iDaemons.org>
@@ -80,7 +78,7 @@ class Set
# If a block is given, the elements of enum are preprocessed by the
# given block.
def initialize(enum = nil, &block) # :yields: o
- @hash ||= Hash.new(false)
+ @hash ||= Hash.new
enum.nil? and return
@@ -93,27 +91,20 @@ class Set
def do_with_enum(enum, &block) # :nodoc:
if enum.respond_to?(:each_entry)
- enum.each_entry(&block) if block
+ enum.each_entry(&block)
elsif enum.respond_to?(:each)
- enum.each(&block) if block
+ enum.each(&block)
else
raise ArgumentError, "value must be enumerable"
end
end
private :do_with_enum
- # Dup internal hash.
- def initialize_dup(orig)
- super
+ # Copy internal hash.
+ def initialize_copy(orig)
@hash = orig.instance_variable_get(:@hash).dup
end
- # Clone internal hash.
- def initialize_clone(orig)
- super
- @hash = orig.instance_variable_get(:@hash).clone
- end
-
def freeze # :nodoc:
@hash.freeze
super
@@ -151,12 +142,12 @@ class Set
def replace(enum)
if enum.instance_of?(self.class)
@hash.replace(enum.instance_variable_get(:@hash))
- self
else
- do_with_enum(enum) # make sure enum is enumerable before calling clear
clear
merge(enum)
end
+
+ self
end
# Converts the set to an array. The order of elements is uncertain.
@@ -202,80 +193,53 @@ class Set
# Equivalent to Set#flatten, but replaces the receiver with the
# result in place. Returns nil if no modifications were made.
def flatten!
- replace(flatten()) if any? { |e| e.is_a?(Set) }
+ if detect { |e| e.is_a?(Set) }
+ replace(flatten())
+ else
+ nil
+ end
end
# Returns true if the set contains the given object.
- #
- # Note that <code>include?</code> and <code>member?</code> do not test member
- # equality using <code>==</code> as do other Enumerables.
- #
- # See also Enumerable#include?
def include?(o)
- @hash[o]
+ @hash.include?(o)
end
alias member? include?
# Returns true if the set is a superset of the given set.
def superset?(set)
- case
- when set.instance_of?(self.class)
- @hash >= set.instance_variable_get(:@hash)
- when set.is_a?(Set)
- size >= set.size && set.all? { |o| include?(o) }
- else
- raise ArgumentError, "value must be a set"
- end
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
+ return false if size < set.size
+ set.all? { |o| include?(o) }
end
alias >= superset?
# Returns true if the set is a proper superset of the given set.
def proper_superset?(set)
- case
- when set.instance_of?(self.class)
- @hash > set.instance_variable_get(:@hash)
- when set.is_a?(Set)
- size > set.size && set.all? { |o| include?(o) }
- else
- raise ArgumentError, "value must be a set"
- end
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
+ return false if size <= set.size
+ set.all? { |o| include?(o) }
end
alias > proper_superset?
# Returns true if the set is a subset of the given set.
def subset?(set)
- case
- when set.instance_of?(self.class)
- @hash <= set.instance_variable_get(:@hash)
- when set.is_a?(Set)
- size <= set.size && all? { |o| set.include?(o) }
- else
- raise ArgumentError, "value must be a set"
- end
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
+ return false if set.size < size
+ all? { |o| set.include?(o) }
end
alias <= subset?
# Returns true if the set is a proper subset of the given set.
def proper_subset?(set)
- case
- when set.instance_of?(self.class)
- @hash < set.instance_variable_get(:@hash)
- when set.is_a?(Set)
- size < set.size && all? { |o| set.include?(o) }
- else
- raise ArgumentError, "value must be a set"
- end
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
+ return false if set.size <= size
+ all? { |o| set.include?(o) }
end
alias < proper_subset?
# Returns true if the set and the given set have at least one
# element in common.
- #
- # e.g.:
- #
- # require 'set'
- # Set[1, 2, 3].intersect? Set[4, 5] # => false
- # Set[1, 2, 3].intersect? Set[3, 4] # => true
def intersect?(set)
set.is_a?(Set) or raise ArgumentError, "value must be a set"
if size < set.size
@@ -287,13 +251,6 @@ class Set
# Returns true if the set and the given set have no element in
# common. This method is the opposite of +intersect?+.
- #
- # e.g.:
- #
- # require 'set'
- # Set[1, 2, 3].disjoint? Set[3, 4] # => false
- # Set[1, 2, 3].disjoint? Set[4, 5] # => true
-
def disjoint?(set)
!intersect?(set)
end
@@ -302,7 +259,7 @@ class Set
# the element as parameter. Returns an enumerator if no block is
# given.
def each(&block)
- block or return enum_for(__method__) { size }
+ block or return enum_for(__method__)
@hash.each_key(&block)
self
end
@@ -318,7 +275,11 @@ class Set
# Adds the given object to the set and returns self. If the
# object is already in the set, returns nil.
def add?(o)
- add(o) unless include?(o)
+ if include?(o)
+ nil
+ else
+ add(o)
+ end
end
# Deletes the given object from the set and returns self. Use +subtract+ to
@@ -331,7 +292,11 @@ class Set
# Deletes the given object from the set and returns self. If the
# object is not in the set, returns nil.
def delete?(o)
- delete(o) if include?(o)
+ if include?(o)
+ delete(o)
+ else
+ nil
+ end
end
# Deletes every element of the set for which block evaluates to
@@ -357,7 +322,9 @@ class Set
# Replaces the elements with ones returned by collect().
def collect!
block_given? or return enum_for(__method__)
- replace(self.class.new(self) { |o| yield(o) })
+ set = self.class.new
+ each { |o| set << yield(o) }
+ replace(set)
end
alias map! collect!
@@ -367,7 +334,7 @@ class Set
block or return enum_for(__method__)
n = size
delete_if(&block)
- self if size != n
+ size == n ? nil : self
end
# Equivalent to Set#keep_if, but returns nil if no changes were
@@ -376,7 +343,7 @@ class Set
block or return enum_for(__method__)
n = size
keep_if(&block)
- self if size != n
+ size == n ? nil : self
end
# Merges the elements of the given enumerable object to the set and
@@ -427,7 +394,7 @@ class Set
# ((set | enum) - (set & enum)).
def ^(enum)
n = Set.new(enum)
- each { |o| n.add(o) unless n.delete?(o) }
+ each { |o| if n.include?(o) then n.delete(o) else n.add(o) end }
n
end
@@ -473,7 +440,8 @@ class Set
h = {}
each { |i|
- (h[yield(i)] ||= self.class.new).add(i)
+ x = yield(i)
+ (h[x] ||= self.class.new).add(i)
}
h
@@ -536,8 +504,8 @@ class Set
return sprintf('#<%s: {...}>', self.class.name)
end
- ids << object_id
begin
+ ids << object_id
return sprintf('#<%s: {%s}>', self.class, to_a.inspect[1..-2])
ensure
ids.pop
@@ -560,7 +528,7 @@ class Set
end
#
-# SortedSet implements a Set that guarantees that its elements are
+# SortedSet implements a Set that guarantees that it's element are
# yielded in sorted order (according to the return values of their
# #<=> methods) when iterating over them.
#
@@ -606,7 +574,7 @@ class SortedSet < Set
begin
require 'rbtree'
- module_eval <<-END, __FILE__, __LINE__+1
+ module_eval %{
def initialize(*args)
@hash = RBTree.new
super
@@ -617,9 +585,9 @@ class SortedSet < Set
super
end
alias << add
- END
+ }
rescue LoadError
- module_eval <<-END, __FILE__, __LINE__+1
+ module_eval %{
def initialize(*args)
@keys = nil
super
@@ -670,7 +638,7 @@ class SortedSet < Set
end
def each(&block)
- block or return enum_for(__method__) { size }
+ block or return enum_for(__method__)
to_a.each(&block)
self
end
@@ -679,7 +647,7 @@ class SortedSet < Set
(@keys = @hash.keys).sort! unless @keys
@keys
end
- END
+ }
end
module_eval {
# a hack to shut up warning
diff --git a/lib/shell.rb b/lib/shell.rb
index bf389795b7..76af3b6f86 100644
--- a/lib/shell.rb
+++ b/lib/shell.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell.rb -
# $Release Version: 0.7 $
@@ -38,7 +37,7 @@ require "shell/process-controller"
# sh.cd("shell-test-1") # Change to the /tmp/shell-test-1 directory
# for dir in ["dir1", "dir3", "dir5"]
# if !sh.exists?(dir)
-# sh.mkdir dir # make dir if it doesn't already exist
+# sh.mkdir dir # make dir if it doesnt' already exist
# sh.cd(dir) do
# # change to the `dir` directory
# f = sh.open("tmpFile", "w") # open a new file in write mode
@@ -88,10 +87,12 @@ require "shell/process-controller"
# (sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12"
#
class Shell
+ @RCS_ID='-$Id: shell.rb,v 1.9 2002/03/04 12:01:10 keiju Exp keiju $-'
include Error
extend Exception2MessageMapper
+# @cascade = true
# debug: true -> normal debug
# debug: 1 -> eval definition debug
# debug: 2 -> detail inspect debug
@@ -107,6 +108,7 @@ class Shell
attr_accessor :cascade, :debug, :verbose
+# alias cascade? cascade
alias debug? debug
alias verbose? verbose
@verbose = true
@@ -353,22 +355,7 @@ class Shell
@process_controller.kill_job(sig, command)
end
- # call-seq:
- # def_system_command(command, path = command)
- #
- # Convenience method for Shell::CommandProcessor.def_system_command.
- # Defines an instance method which will execute the given shell command.
- # If the executable is not in Shell.default_system_path, you must
- # supply the path to it.
- #
- # Shell.def_system_command('hostname')
- # Shell.new.hostname # => localhost
- #
- # # How to use an executable that's not in the default path
- #
- # Shell.def_system_command('run_my_program', "~/hello")
- # Shell.new.run_my_program # prints "Hello from a C program!"
- #
+ # Convenience method for Shell::CommandProcessor.def_system_command
def Shell.def_system_command(command, path = command)
CommandProcessor.def_system_command(command, path)
end
@@ -378,17 +365,7 @@ class Shell
CommandProcessor.undef_system_command(command)
end
- # call-seq:
- # alias_command(alias, command, *opts, &block)
- #
- # Convenience method for Shell::CommandProcessor.alias_command.
- # Defines an instance method which will execute a command under
- # an alternative name.
- #
- # Shell.def_system_command('date')
- # Shell.alias_command('date_in_utc', 'date', '-u')
- # Shell.new.date_in_utc # => Sat Jan 25 16:59:57 UTC 2014
- #
+ # Convenience method for Shell::CommandProcessor.alias_command
def Shell.alias_command(ali, command, *opts, &block)
CommandProcessor.alias_command(ali, command, *opts, &block)
end
@@ -398,17 +375,7 @@ class Shell
CommandProcessor.unalias_command(ali)
end
- # call-seq:
- # install_system_commands(pre = "sys_")
- #
- # Convenience method for Shell::CommandProcessor.install_system_commands.
- # Defines instance methods representing all the executable files found in
- # Shell.default_system_path, with the given prefix prepended to their
- # names.
- #
- # Shell.install_system_commands
- # Shell.new.sys_echo("hello") # => hello
- #
+ # Convenience method for Shell::CommandProcessor.install_system_commands
def Shell.install_system_commands(pre = "sys_")
CommandProcessor.install_system_commands(pre)
end
@@ -446,6 +413,7 @@ class Shell
yield mes if iterator?
if _head
_head = false
+# "shell" " + mes
prefix + mes
else
" "* prefix.size + mes
diff --git a/lib/shell/builtin-command.rb b/lib/shell/builtin-command.rb
index c76fa81ee1..b1ca5c38f6 100644
--- a/lib/shell/builtin-command.rb
+++ b/lib/shell/builtin-command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell/builtin-command.rb -
# $Release Version: 0.7 $
@@ -84,6 +83,20 @@ class Shell
end
end
+# class Sort < Cat
+# def initialize(sh, *filenames)
+# super
+# end
+#
+# def each(rs = nil)
+# ary = []
+# super{|l| ary.push l}
+# for l in ary.sort!
+# yield l
+# end
+# end
+# end
+
class AppendIO < BuiltInCommand
def initialize(sh, io, filter)
super sh
diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb
index 2239ca98f6..8a9ab55e73 100644
--- a/lib/shell/command-processor.rb
+++ b/lib/shell/command-processor.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell/command-controller.rb -
# $Release Version: 0.7 $
@@ -25,6 +24,7 @@ class Shell
# Alternatively, you can execute any command via
# Shell::CommandProcessor#system even if it is not defined.
class CommandProcessor
+# include Error
#
# initialize of Shell and related classes.
@@ -121,10 +121,11 @@ class Shell
end
f
else
- File.open(path, mode, perm, &b)
+ f = File.open(path, mode, perm, &b)
end
end
end
+ # public :open
# call-seq:
# unlink(path)
@@ -649,6 +650,7 @@ class Shell
["mtime", ["FILENAME"]],
["readlink", ["FILENAME"]],
["rename", ["FILENAME_FROM", "FILENAME_TO"]],
+ # ["size", ["FILENAME"]],
["split", ["pathname"]],
["stat", ["FILENAME"]],
["symlink", ["FILENAME_O", "FILENAME_N"]],
diff --git a/lib/shell/error.rb b/lib/shell/error.rb
index 677c424baf..2701338b5a 100644
--- a/lib/shell/error.rb
+++ b/lib/shell/error.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell/error.rb -
# $Release Version: 0.7 $
diff --git a/lib/shell/filter.rb b/lib/shell/filter.rb
index c1f4b28a45..d53ed06315 100644
--- a/lib/shell/filter.rb
+++ b/lib/shell/filter.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell/filter.rb -
# $Release Version: 0.7 $
@@ -11,7 +10,7 @@
#
class Shell #:nodoc:
- # Any result of command execution is a Filter.
+ # Any result of command exection is a Filter.
#
# This class includes Enumerable, therefore a Filter object can use all
# Enumerable
diff --git a/lib/shell/process-controller.rb b/lib/shell/process-controller.rb
index a100727aa6..b973539b4b 100644
--- a/lib/shell/process-controller.rb
+++ b/lib/shell/process-controller.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell/process-controller.rb -
# $Release Version: 0.7 $
@@ -158,16 +157,19 @@ class Shell
@waiting_jobs.delete command
else
command = @waiting_jobs.shift
+# command.notify "job(%id) pre-start.", @shell.debug?
return unless command
end
@active_jobs.push command
command.start
+# command.notify "job(%id) post-start.", @shell.debug?
# start all jobs that input from the job
for job in @waiting_jobs.dup
start_job(job) if job.input == command
end
+# command.notify "job(%id) post2-start.", @shell.debug?
end
end
@@ -252,6 +254,7 @@ class Shell
pid = fork {
Thread.list.each do |th|
+# th.kill unless [Thread.main, Thread.current].include?(th)
th.kill unless Thread.current == th
end
@@ -280,6 +283,8 @@ class Shell
rescue Errno::ECHILD
command.notify "warn: job(%id) was done already waitpid."
_pid = true
+ # rescue
+ # STDERR.puts $!
ensure
command.notify("Job(%id): Wait to finish when Process finished.", @shell.debug?)
# when the process ends, wait until the command terminates
@@ -291,8 +296,11 @@ class Shell
redo
end
+# command.notify "job(%id) pre-pre-finish.", @shell.debug?
@job_monitor.synchronize do
+# command.notify "job(%id) pre-finish.", @shell.debug?
terminate_job(command)
+# command.notify "job(%id) pre-finish2.", @shell.debug?
@job_condition.signal
command.notify "job(%id) finish.", @shell.debug?
end
diff --git a/lib/shell/system-command.rb b/lib/shell/system-command.rb
index 2a8ffd6ed9..1a8bb1a90f 100644
--- a/lib/shell/system-command.rb
+++ b/lib/shell/system-command.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# shell/system-command.rb -
# $Release Version: 0.7 $
@@ -83,6 +82,7 @@ class Shell
def start_import
notify "Job(%id) start imp-pipe.", @shell.debug?
+ rs = @shell.record_separator unless rs
_eop = true
Thread.start {
begin
diff --git a/lib/shell/version.rb b/lib/shell/version.rb
index bb4e7dfb8e..2568627e2b 100644
--- a/lib/shell/version.rb
+++ b/lib/shell/version.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# version.rb - shell version definition file
# $Release Version: 0.7$
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index 0030f0784f..c3586d29fa 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -1,4 +1,3 @@
-# frozen-string-literal: true
##
# == Manipulates strings like the UNIX Bourne shell
#
@@ -10,7 +9,7 @@
#
# === Usage
#
-# You can use Shellwords to parse a string into a Bourne shell friendly Array.
+# You can use shellwords to parse a string into a Bourne shell friendly Array.
#
# require 'shellwords'
#
@@ -28,13 +27,13 @@
# argv = "they all ran after the farmer's wife".shellsplit
# #=> ArgumentError: Unmatched double quote: ...
#
-# In this case, you might want to use Shellwords.escape, or its alias
+# In this case, you might want to use Shellwords.escape, or it's alias
# String#shellescape.
#
# This method will escape the String for you to safely use with a Bourne shell.
#
# argv = Shellwords.escape("special's.txt")
-# argv #=> "special\\'s.txt"
+# argv #=> "special\\s.txt"
# system("cat " + argv)
#
# Shellwords also comes with a core extension for Array, Array#shelljoin.
@@ -43,7 +42,7 @@
# system(argv.shelljoin)
#
# You can use this method to create an escaped string out of an array of tokens
-# separated by a space. In this example we used the literal shortcut for
+# separated by a space. In this example we'll use the literal shortcut for
# Array.new.
#
# === Authors
@@ -64,27 +63,20 @@ module Shellwords
# argv = Shellwords.split('here are "two words"')
# argv #=> ["here", "are", "two words"]
#
- # Note, however, that this is not a command line parser. Shell
- # metacharacters except for the single and double quotes and
- # backslash are not treated as such.
- #
- # argv = Shellwords.split('ruby my_prog.rb | less')
- # argv #=> ["ruby", "my_prog.rb", "|", "less"]
- #
# String#shellsplit is a shortcut for this function.
#
# argv = 'here are "two words"'.shellsplit
# argv #=> ["here", "are", "two words"]
def shellsplit(line)
words = []
- field = String.new
+ field = ''
line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/m) do
|word, sq, dq, esc, garbage, sep|
raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage
field << (word || sq || (dq || esc).gsub(/\\(.)/, '\\1'))
if sep
words << field
- field = String.new
+ field = ''
end
end
words
@@ -125,24 +117,24 @@ module Shellwords
# It is the caller's responsibility to encode the string in the right
# encoding for the shell environment where this string is used.
#
- # Multibyte characters are treated as multibyte characters, not as bytes.
+ # Multibyte characters are treated as multibyte characters, not bytes.
#
# Returns an empty quoted String if +str+ has a length of zero.
def shellescape(str)
str = str.to_s
# An empty argument will be skipped, so return empty quotes.
- return "''".dup if str.empty?
+ return "''" if str.empty?
str = str.dup
- # Treat multibyte characters as is. It is the caller's responsibility
+ # Treat multibyte characters as is. It is caller's responsibility
# to encode the string in the right encoding for the shell
# environment.
str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
# A LF cannot be escaped with a backslash because a backslash + LF
- # combo is regarded as a line continuation and simply ignored.
+ # combo is regarded as line continuation and simply ignored.
str.gsub!(/\n/, "'\n'")
return str
@@ -157,8 +149,8 @@ module Shellwords
# Builds a command line string from an argument list, +array+.
#
# All elements are joined into a single string with fields separated by a
- # space, where each element is escaped for the Bourne shell and stringified
- # using +to_s+.
+ # space, where each element is escaped for Bourne shell and stringified using
+ # +to_s+.
#
# ary = ["There's", "a", "time", "and", "place", "for", "everything"]
# argv = Shellwords.join(ary)
@@ -214,7 +206,7 @@ class Array
# array.shelljoin => string
#
# Builds a command line string from an argument list +array+ joining
- # all elements escaped for the Bourne shell and separated by a space.
+ # all elements escaped for Bourne shell and separated by a space.
#
# See Shellwords.shelljoin for details.
def shelljoin
diff --git a/lib/singleton.rb b/lib/singleton.rb
index 2ee9b5b3b5..be1f7ff6ca 100644
--- a/lib/singleton.rb
+++ b/lib/singleton.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'thread'
# The Singleton module implements the Singleton pattern.
diff --git a/lib/sync.rb b/lib/sync.rb
index ad6caf0743..09542d59f9 100644
--- a/lib/sync.rb
+++ b/lib/sync.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# sync.rb - 2 phase lock with counter
# $Release Version: 1.0$
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index a0f3fdd90a..5f4e8eedf1 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# tempfile - manipulates temporary files
#
@@ -7,6 +6,7 @@
require 'delegate'
require 'tmpdir'
+require 'thread'
# A utility class for managing temporary files. When you create a Tempfile
# object, it will create a temporary file with a unique filename. A Tempfile
@@ -79,8 +79,10 @@ require 'tmpdir'
# same Tempfile object from multiple threads then you should protect it with a
# mutex.
class Tempfile < DelegateClass(File)
+ include Dir::Tmpname
+
# call-seq:
- # new(basename = "", [tmpdir = Dir.tmpdir], [options])
+ # new(basename, [tmpdir = Dir.tmpdir], [options])
#
# Creates a temporary file with permissions 0600 (= only readable and
# writable by the owner) and opens it with mode "w+".
@@ -123,31 +125,49 @@ class Tempfile < DelegateClass(File)
#
# If Tempfile.new cannot find a unique filename within a limited
# number of tries, then it will raise an exception.
- def initialize(basename="", tmpdir=nil, mode: 0, **options)
- warn "Tempfile.new doesn't call the given block." if block_given?
+ def initialize(basename, *rest)
+ if block_given?
+ warn "Tempfile.new doesn't call the given block."
+ end
+ @data = []
+ @clean_proc = Remover.new(@data)
+ ObjectSpace.define_finalizer(self, @clean_proc)
- @unlinked = false
- @mode = mode|File::RDWR|File::CREAT|File::EXCL
- ::Dir::Tmpname.create(basename, tmpdir, options) do |tmpname, n, opts|
- opts[:perm] = 0600
- @tmpfile = File.open(tmpname, @mode, opts)
- @opts = opts.freeze
+ ::Dir::Tmpname.create(basename, *rest) do |tmpname, n, opts|
+ mode = File::RDWR|File::CREAT|File::EXCL
+ perm = 0600
+ if opts
+ mode |= opts.delete(:mode) || 0
+ opts[:perm] = perm
+ perm = nil
+ else
+ opts = perm
+ end
+ @data[1] = @tmpfile = File.open(tmpname, mode, opts)
+ @data[0] = @tmpname = tmpname
+ @mode = mode & ~(File::CREAT|File::EXCL)
+ perm or opts.freeze
+ @opts = opts
end
- ObjectSpace.define_finalizer(self, Remover.new(@tmpfile))
super(@tmpfile)
end
# Opens or reopens the file with mode "r+".
def open
- _close
- mode = @mode & ~(File::CREAT|File::EXCL)
- @tmpfile = File.open(@tmpfile.path, mode, @opts)
+ @tmpfile.close if @tmpfile
+ @tmpfile = File.open(@tmpname, @mode, @opts)
+ @data[1] = @tmpfile
__setobj__(@tmpfile)
end
def _close # :nodoc:
- @tmpfile.close unless @tmpfile.closed?
+ begin
+ @tmpfile.close if @tmpfile
+ ensure
+ @tmpfile = nil
+ @data[1] = nil if @data
+ end
end
protected :_close
@@ -158,14 +178,18 @@ class Tempfile < DelegateClass(File)
# If you don't explicitly unlink the temporary file, the removal
# will be delayed until the object is finalized.
def close(unlink_now=false)
- _close
- unlink if unlink_now
+ if unlink_now
+ close!
+ else
+ _close
+ end
end
# Closes and unlinks (deletes) the file. Has the same effect as called
# <tt>close(true)</tt>.
def close!
- close(true)
+ _close
+ unlink
end
# Unlinks (deletes) the file from the filesystem. One should always unlink
@@ -202,69 +226,74 @@ class Tempfile < DelegateClass(File)
# # to do so again.
# end
def unlink
- return if @unlinked
+ return unless @tmpname
begin
- File.unlink(@tmpfile.path)
+ File.unlink(@tmpname)
rescue Errno::ENOENT
rescue Errno::EACCES
# may not be able to unlink on Windows; just ignore
return
end
+ # remove tmpname from remover
+ @data[0] = @data[1] = nil
+ @tmpname = nil
ObjectSpace.undefine_finalizer(self)
- @unlinked = true
end
alias delete unlink
# Returns the full path name of the temporary file.
# This will be nil if #unlink has been called.
def path
- @unlinked ? nil : @tmpfile.path
+ @tmpname
end
# Returns the size of the temporary file. As a side effect, the IO
# buffer is flushed before determining the size.
def size
- if !@tmpfile.closed?
- @tmpfile.size # File#size calls rb_io_flush_raw()
+ if @tmpfile
+ @tmpfile.flush
+ @tmpfile.stat.size
+ elsif @tmpname
+ File.size(@tmpname)
else
- File.size(@tmpfile.path)
+ 0
end
end
alias length size
# :stopdoc:
def inspect
- if closed?
- "#<#{self.class}:#{path} (closed)>"
- else
- "#<#{self.class}:#{path}>"
- end
+ "#<#{self.class}:#{path}>"
end
class Remover
- def initialize(tmpfile)
- @pid = Process.pid
- @tmpfile = tmpfile
+ def initialize(data)
+ @pid = $$
+ @data = data
end
def call(*args)
- return if @pid != Process.pid
+ return if @pid != $$
+
+ path, tmpfile = *@data
- warn "removing #{@tmpfile.path}..." if $DEBUG
+ STDERR.print "removing ", path, "..." if $DEBUG
- @tmpfile.close unless @tmpfile.closed?
- begin
- File.unlink(@tmpfile.path)
- rescue Errno::ENOENT
+ tmpfile.close if tmpfile
+
+ if path
+ begin
+ File.unlink(path)
+ rescue Errno::ENOENT
+ end
end
- warn "done" if $DEBUG
+ STDERR.print "done\n" if $DEBUG
end
end
+ # :startdoc:
class << self
- # :startdoc:
-
# Creates a new Tempfile.
#
# If no block is given, this is a synonym for Tempfile.new.
@@ -303,8 +332,8 @@ class Tempfile < DelegateClass(File)
end
end
-# Creates a temporary file as usual File object (not Tempfile).
-# It doesn't use finalizer and delegation.
+# Creates a temporally file as usual File object (not Tempfile).
+# It don't use finalizer and delegation.
#
# If no block is given, this is similar to Tempfile.new except
# creating File instead of Tempfile.
@@ -314,7 +343,7 @@ end
# If a block is given, then a File object will be constructed,
# and the block is invoked with the object as the argument.
# The File object will be automatically closed and
-# the temporary file is removed after the block terminates.
+# the temporally file is removed after the block terminates.
# The call returns the value of the block.
#
# In any case, all arguments (+*args+) will be treated as Tempfile.new.
@@ -323,11 +352,18 @@ end
# ... do something with f ...
# end
#
-def Tempfile.create(basename, tmpdir=nil, mode: 0, **options)
+def Tempfile.create(basename, *rest)
tmpfile = nil
- Dir::Tmpname.create(basename, tmpdir, options) do |tmpname, n, opts|
- mode |= File::RDWR|File::CREAT|File::EXCL
- opts[:perm] = 0600
+ Dir::Tmpname.create(basename, *rest) do |tmpname, n, opts|
+ mode = File::RDWR|File::CREAT|File::EXCL
+ perm = 0600
+ if opts
+ mode |= opts.delete(:mode) || 0
+ opts[:perm] = perm
+ perm = nil
+ else
+ opts = perm
+ end
tmpfile = File.open(tmpname, mode, opts)
end
if block_given?
@@ -341,3 +377,13 @@ def Tempfile.create(basename, tmpdir=nil, mode: 0, **options)
tmpfile
end
end
+
+if __FILE__ == $0
+# $DEBUG = true
+ f = Tempfile.new("foo")
+ f.print("foo\n")
+ f.close
+ f.open
+ p f.gets # => "foo\n"
+ f.close!
+end
diff --git a/test/lib/test/unit.rb b/lib/test/unit.rb
index c92a5ec01d..13a993fc6c 100644
--- a/test/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -1,11 +1,5 @@
-# frozen_string_literal: false
-begin
- gem 'minitest', '< 5.0.0' if defined? Gem
-rescue Gem::LoadError
-end
require 'minitest/unit'
require 'test/unit/assertions'
-require_relative '../envutil'
require 'test/unit/testcase'
require 'optparse'
@@ -62,9 +56,13 @@ module Test
orig_args -= args
args = @init_hook.call(args, options) if @init_hook
non_options(args, options)
- @run_options = orig_args
@help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
@options = options
+ if @options[:parallel]
+ @files = args
+ @args = orig_args
+ end
+ options
end
private
@@ -72,6 +70,9 @@ module Test
opts.separator 'minitest options:'
opts.version = MiniTest::Unit::VERSION
+ options[:retry] = true
+ options[:job_status] = nil
+
opts.on '-h', '--help', 'Display this help.' do
puts opts
exit
@@ -86,67 +87,14 @@ module Test
self.verbose = options[:verbose]
end
- opts.on '-n', '--name PATTERN', "Filter test method names on pattern: /REGEXP/ or STRING" do |a|
- (options[:filter] ||= []) << a
- end
-
- opts.on '--test-order=random|alpha|sorted', [:random, :alpha, :sorted] do |a|
- MiniTest::Unit::TestCase.test_order = a
+ opts.on '-n', '--name PATTERN', "Filter test names on pattern." do |a|
+ options[:filter] = a
end
- end
- def non_options(files, options)
- filter = options[:filter]
- if filter
- pos_pat = /\A\/(.*)\/\z/
- neg_pat = /\A!\/(.*)\/\z/
- negative, positive = filter.partition {|s| neg_pat =~ s}
- if positive.empty?
- filter = nil
- elsif negative.empty? and positive.size == 1 and pos_pat !~ positive[0]
- filter = positive[0]
- else
- filter = Regexp.union(*positive.map! {|s| s[pos_pat, 1] || "\\A#{Regexp.quote(s)}\\z"})
- end
- unless negative.empty?
- negative = Regexp.union(*negative.map! {|s| s[neg_pat, 1]})
- filter = /\A(?!.*#{negative})#{filter}/
- end
- if Regexp === filter
- # bypass conversion in minitest
- def filter.=~(other) # :nodoc:
- super unless Regexp === other
- end
- end
- options[:filter] = filter
- end
- true
- end
- end
-
- module Parallel # :nodoc: all
- def process_args(args = [])
- return @options if @options
- options = super
- if @options[:parallel]
- @files = args
+ opts.on '--jobs-status [TYPE]', [:normal, :replace],
+ "Show status of jobs every file; Disabled when --jobs isn't specified." do |type|
+ options[:job_status] = type || :normal
end
- options
- end
-
- def status(*args)
- result = super
- raise @interrupt if @interrupt
- result
- end
-
- private
- def setup_options(opts, options)
- super
-
- opts.separator "parallel test options:"
-
- options[:retry] = true
opts.on '-j N', '--jobs N', "Allow run tests with N jobs at once" do |a|
if /^t/ =~ a
@@ -173,8 +121,150 @@ module Test
opts.on '--ruby VAL', "Path to ruby; It'll have used at -j option" do |a|
options[:ruby] = a.split(/ /).reject(&:empty?)
end
+
+ opts.on '-q', '--hide-skip', 'Hide skipped tests' do
+ options[:hide_skip] = true
+ end
+
+ opts.on '--show-skip', 'Show skipped tests' do
+ options[:hide_skip] = false
+ end
+
+ opts.on '--color[=WHEN]',
+ [:always, :never, :auto],
+ "colorize the output. WHEN defaults to 'always'", "or can be 'never' or 'auto'." do |c|
+ options[:color] = c || :always
+ end
+
+ opts.on '--tty[=WHEN]',
+ [:yes, :no],
+ "force to output tty control. WHEN defaults to 'yes'", "or can be 'no'." do |c|
+ @tty = c != :no
+ end
+ end
+
+ def non_options(files, options)
+ begin
+ require "rbconfig"
+ rescue LoadError
+ warn "#{caller(1)[0]}: warning: Parallel running disabled because can't get path to ruby; run specify with --ruby argument"
+ options[:parallel] = nil
+ else
+ options[:ruby] ||= [RbConfig.ruby]
+ end
+
+ true
+ end
+ end
+
+ module GlobOption # :nodoc: all
+ @@testfile_prefix = "test"
+
+ def setup_options(parser, options)
+ super
+ parser.on '-b', '--basedir=DIR', 'Base directory of test suites.' do |dir|
+ options[:base_directory] = dir
+ end
+ parser.on '-x', '--exclude PATTERN', 'Exclude test files on pattern.' do |pattern|
+ (options[:reject] ||= []) << pattern
+ end
+ end
+
+ def non_options(files, options)
+ paths = [options.delete(:base_directory), nil].uniq
+ if reject = options.delete(:reject)
+ reject_pat = Regexp.union(reject.map {|r| /#{r}/ })
+ end
+ files.map! {|f|
+ f = f.tr(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
+ ((paths if /\A\.\.?(?:\z|\/)/ !~ f) || [nil]).any? do |prefix|
+ if prefix
+ path = f.empty? ? prefix : "#{prefix}/#{f}"
+ else
+ next if f.empty?
+ path = f
+ end
+ if !(match = Dir["#{path}/**/#{@@testfile_prefix}_*.rb"]).empty?
+ if reject
+ match.reject! {|n|
+ n[(prefix.length+1)..-1] if prefix
+ reject_pat =~ n
+ }
+ end
+ break match
+ elsif !reject or reject_pat !~ f and File.exist? path
+ break path
+ end
+ end or
+ raise ArgumentError, "file not found: #{f}"
+ }
+ files.flatten!
+ super(files, options)
+ end
+ end
+
+ module LoadPathOption # :nodoc: all
+ def setup_options(parser, options)
+ super
+ parser.on '-Idirectory', 'Add library load path' do |dirs|
+ dirs.split(':').each { |d| $LOAD_PATH.unshift d }
+ end
+ end
+ end
+
+ module GCStressOption # :nodoc: all
+ def setup_options(parser, options)
+ super
+ parser.on '--[no-]gc-stress', 'Set GC.stress as true' do |flag|
+ options[:gc_stress] = flag
+ end
end
+ def non_options(files, options)
+ if options.delete(:gc_stress)
+ MiniTest::Unit::TestCase.class_eval do
+ oldrun = instance_method(:run)
+ define_method(:run) do |runner|
+ begin
+ gc_stress, GC.stress = GC.stress, true
+ oldrun.bind(self).call(runner)
+ ensure
+ GC.stress = gc_stress
+ end
+ end
+ end
+ end
+ super
+ end
+ end
+
+ module RequireFiles # :nodoc: all
+ def non_options(files, options)
+ return false if !super
+ result = false
+ files.each {|f|
+ d = File.dirname(path = File.realpath(f))
+ unless $:.include? d
+ $: << d
+ end
+ begin
+ require path unless options[:parallel]
+ result = true
+ rescue LoadError
+ puts "#{f}: #{$!}"
+ end
+ }
+ result
+ end
+ end
+
+ class Runner < MiniTest::Unit # :nodoc: all
+ include Test::Unit::Options
+ include Test::Unit::GlobOption
+ include Test::Unit::LoadPathOption
+ include Test::Unit::GCStressOption
+ include Test::Unit::RunCount
+
class Worker
def self.launch(ruby,args=[])
io = IO.popen([*ruby,
@@ -248,10 +338,6 @@ module Test
def died(*additional)
@status = :quit
@io.close
- status = $?
- if status and status.signaled?
- additional[0] ||= SignalException.new(status.termsig)
- end
call_hook(:dead,*additional)
end
@@ -277,6 +363,18 @@ module Test
end
+ class << self; undef autorun; end
+
+ @@stop_auto_run = false
+ def self.autorun
+ at_exit {
+ Test::Unit::RunCount.run_once {
+ exit(Test::Unit::Runner.new.run(ARGV) || true)
+ } unless @@stop_auto_run
+ } unless @@installed_at_exit
+ @@installed_at_exit = true
+ end
+
def after_worker_down(worker, e=nil, c=false)
return unless @options[:parallel]
return if @interrupt
@@ -291,6 +389,69 @@ module Test
exit c
end
+ def terminal_width
+ unless @terminal_width ||= nil
+ begin
+ require 'io/console'
+ width = $stdout.winsize[1]
+ rescue LoadError, NoMethodError, Errno::ENOTTY, Errno::EBADF
+ width = ENV["COLUMNS"].to_i.nonzero? || 80
+ end
+ width -= 1 if /mswin|mingw/ =~ RUBY_PLATFORM
+ @terminal_width = width
+ end
+ @terminal_width
+ end
+
+ def del_status_line
+ @status_line_size ||= 0
+ unless @options[:job_status] == :replace
+ $stdout.puts
+ return
+ end
+ print "\r"+" "*@status_line_size+"\r"
+ $stdout.flush
+ @status_line_size = 0
+ end
+
+ def put_status(line)
+ unless @options[:job_status] == :replace
+ print(line)
+ return
+ end
+ @status_line_size ||= 0
+ del_status_line
+ $stdout.flush
+ line = line[0...terminal_width]
+ print line
+ $stdout.flush
+ @status_line_size = line.size
+ end
+
+ def add_status(line)
+ unless @options[:job_status] == :replace
+ print(line)
+ return
+ end
+ @status_line_size ||= 0
+ line = line[0...(terminal_width-@status_line_size)]
+ print line
+ $stdout.flush
+ @status_line_size += line.size
+ end
+
+ def jobs_status
+ return unless @options[:job_status]
+ puts "" unless @options[:verbose] or @options[:job_status] == :replace
+ status_line = @workers.map(&:to_s).join(" ")
+ update_status(status_line) or (puts; nil)
+ end
+
+ def del_jobs_status
+ return unless @options[:job_status] == :replace && @status_line_size.nonzero?
+ del_status_line
+ end
+
def after_worker_quit(worker)
return unless @options[:parallel]
return if @interrupt
@@ -301,7 +462,7 @@ module Test
def launch_worker
begin
- worker = Worker.launch(@options[:ruby], @run_options)
+ worker = Worker.launch(@options[:ruby],@args)
rescue => e
abort "ERROR: Failed to launch job process - #{e.class}: #{e.message}"
end
@@ -325,7 +486,7 @@ module Test
return if @workers.empty?
@workers.reject! do |worker|
begin
- Timeout.timeout(1) do
+ timeout(1) do
worker.quit
end
rescue Errno::EPIPE
@@ -336,7 +497,7 @@ module Test
return if @workers.empty?
begin
- Timeout.timeout(0.2 * @workers.size) do
+ timeout(0.2 * @workers.size) do
Process.waitall
end
rescue Timeout::Error
@@ -347,13 +508,25 @@ module Test
end
end
+ def start_watchdog
+ Thread.new do
+ while stat = Process.wait2
+ break if @interrupt # Break when interrupt
+ pid, stat = stat
+ w = (@workers + @dead_workers).find{|x| pid == x.pid }
+ next unless w
+ w = w.dup
+ if w.status != :quit && !w.quit_called?
+ # Worker down
+ w.died(nil, !stat.signaled? && stat.exitstatus)
+ end
+ end
+ end
+ end
+
def deal(io, type, result, rep, shutting_down = false)
worker = @workers_hash[io]
- cmd = worker.read
- cmd.sub!(/\A\.+/, '') if cmd # read may return nil
- case cmd
- when ''
- # just only dots, ignore
+ case worker.read
when /^okay$/
worker.status = :running
jobs_status
@@ -371,12 +544,7 @@ module Test
jobs_status
when /^done (.+?)$/
- begin
- r = Marshal.load($1.unpack("m")[0])
- rescue
- print "unknown object: #{$1.unpack("m")[0].dump}"
- return true
- end
+ r = Marshal.load($1.unpack("m")[0])
result << r[0..1] unless r[0..1] == [nil,nil]
rep << {file: worker.real_file, report: r[2], result: r[3], testcase: r[5]}
$:.push(*r[4]).uniq!
@@ -395,8 +563,6 @@ module Test
else
after_worker_down worker
end
- else
- print "unknown command: #{cmd.dump}\n"
end
return false
end
@@ -421,6 +587,9 @@ module Test
@workers_hash = {} # out-IO => worker
@ios = [] # Array of worker IOs
begin
+ # Thread: watchdog
+ watchdog = start_watchdog
+
@options[:parallel].times {launch_worker}
while _io = IO.select(@ios)[0]
@@ -434,6 +603,7 @@ module Test
@interrupt = ex
return result
ensure
+ watchdog.kill if watchdog
if @interrupt
@ios.select!{|x| @workers_hash[x].status == :running }
while !@ios.empty? && (__io = IO.select(@ios,[],[],10))
@@ -497,87 +667,13 @@ module Test
end
}
end
- result
- end
- end
-
- module Skipping # :nodoc: all
- private
- def setup_options(opts, options)
- super
-
- opts.separator "skipping options:"
-
- options[:hide_skip] = true
-
- opts.on '-q', '--hide-skip', 'Hide skipped tests' do
- options[:hide_skip] = true
- end
-
- opts.on '--show-skip', 'Show skipped tests' do
- options[:hide_skip] = false
- end
- end
-
- private
- def _run_suites(suites, type)
- result = super
report.reject!{|r| r.start_with? "Skipped:" } if @options[:hide_skip]
report.sort_by!{|r| r.start_with?("Skipped:") ? 0 : \
(r.start_with?("Failure:") ? 1 : 2) }
result
end
- end
-
- module StatusLine # :nodoc: all
- def terminal_width
- unless @terminal_width ||= nil
- begin
- require 'io/console'
- width = $stdout.winsize[1]
- rescue LoadError, NoMethodError, Errno::ENOTTY, Errno::EBADF, Errno::EINVAL
- width = ENV["COLUMNS"].to_i.nonzero? || 80
- end
- width -= 1 if /mswin|mingw/ =~ RUBY_PLATFORM
- @terminal_width = width
- end
- @terminal_width
- end
- def del_status_line(flush = true)
- @status_line_size ||= 0
- unless @options[:job_status] == :replace
- $stdout.puts
- return
- end
- print "\r"+" "*@status_line_size+"\r"
- $stdout.flush if flush
- @status_line_size = 0
- end
-
- def add_status(line, flush: true)
- unless @options[:job_status] == :replace
- print(line)
- return
- end
- @status_line_size ||= 0
- line = line[0...(terminal_width-@status_line_size)]
- print line
- $stdout.flush if flush
- @status_line_size += line.size
- end
-
- def jobs_status
- return unless @options[:job_status]
- puts "" unless @options[:verbose] or @options[:job_status] == :replace
- status_line = @workers.map(&:to_s).join(" ")
- update_status(status_line) or (puts; nil)
- end
-
- def del_jobs_status
- return unless @options[:job_status] == :replace && @status_line_size.nonzero?
- del_status_line
- end
+ alias mini_run_suite _run_suite
def output
(@output ||= nil) || super
@@ -589,31 +685,27 @@ module Test
when :always
color = true
when :auto, nil
- color = (@tty || @options[:job_status] == :replace) && /dumb/ !~ ENV["TERM"]
+ color = @options[:job_status] == :replace && /dumb/ !~ ENV["TERM"]
else
color = false
end
if color
# dircolors-like style
- colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
- begin
- File.read(File.join(__dir__, "../../colors")).scan(/(\w+)=([^:\n]*)/) do |n, c|
- colors[n] ||= c
- end
- rescue
- end
- @passed_color = "\e[;#{colors["pass"] || "32"}m"
- @failed_color = "\e[;#{colors["fail"] || "31"}m"
- @skipped_color = "\e[;#{colors["skip"] || "33"}m"
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
+ @passed_color = "\e[#{colors["pass"] || "32"}m"
+ @failed_color = "\e[#{colors["fail"] || "31"}m"
+ @skipped_color = "\e[#{colors["skip"] || "33"}m"
@reset_color = "\e[m"
else
@passed_color = @failed_color = @skipped_color = @reset_color = ""
end
if color or @options[:job_status] == :replace
@verbose = !options[:parallel]
- @output = Output.new(self)
+ @output = StatusLineOutput.new(self)
+ end
+ if /\A\/(.*)\/\z/ =~ (filter = options[:filter])
+ filter = Regexp.new($1)
end
- filter = options[:filter]
type = "#{type}_methods"
total = if filter
suites.inject(0) {|n, suite| n + suite.send(type).grep(filter).size}
@@ -631,11 +723,7 @@ module Test
def update_status(s)
count = @test_count.to_s(10).rjust(@total_tests.size)
- del_status_line(false) if @options[:job_status] == :replace
- print(@passed_color)
- add_status("[#{count}/#{@total_tests}]", flush: false)
- print(@reset_color)
- add_status(" #{s}")
+ put_status("#{@passed_color}[#{count}/#{@total_tests}]#{@reset_color} #{s}")
end
def _print(s); $stdout.print(s); end
@@ -663,284 +751,56 @@ module Test
report.clear
end
+ # Overriding of MiniTest::Unit#puke
+ def puke klass, meth, e
+ # TODO:
+ # this overriding is for minitest feature that skip messages are
+ # hidden when not verbose (-v), note this is temporally.
+ n = report.size
+ rep = super
+ if MiniTest::Skip === e and /no message given\z/ =~ e.message
+ report.slice!(n..-1)
+ rep = "."
+ end
+ rep
+ end
+
def initialize
super
@tty = $stdout.tty?
end
- def run(*args)
+ def status(*args)
result = super
- puts "\nruby -v: #{RUBY_DESCRIPTION}"
+ raise @interrupt if @interrupt
result
end
- private
- def setup_options(opts, options)
- super
-
- opts.separator "status line options:"
-
- options[:job_status] = nil
-
- opts.on '--jobs-status [TYPE]', [:normal, :replace],
- "Show status of jobs every file; Disabled when --jobs isn't specified." do |type|
- options[:job_status] = type || :normal
- end
-
- opts.on '--color[=WHEN]',
- [:always, :never, :auto],
- "colorize the output. WHEN defaults to 'always'", "or can be 'never' or 'auto'." do |c|
- options[:color] = c || :always
- end
-
- opts.on '--tty[=WHEN]',
- [:yes, :no],
- "force to output tty control. WHEN defaults to 'yes'", "or can be 'no'." do |c|
- @tty = c != :no
- end
- end
-
- class Output < Struct.new(:runner) # :nodoc: all
- def puts(*a) $stdout.puts(*a) unless a.empty? end
- def respond_to_missing?(*a) $stdout.respond_to?(*a) end
- def method_missing(*a, &b) $stdout.__send__(*a, &b) end
-
- def print(s)
- case s
- when /\A(.*\#.*) = \z/
- runner.new_test($1)
- when /\A(.* s) = \z/
- runner.add_status(" = "+$1.chomp)
- when /\A\.+\z/
- runner.succeed
- when /\A[EFS]\z/
- runner.failed(s)
- else
- $stdout.print(s)
- end
- end
- end
- end
-
- module LoadPathOption # :nodoc: all
- def non_options(files, options)
- begin
- require "rbconfig"
- rescue LoadError
- warn "#{caller(1)[0]}: warning: Parallel running disabled because can't get path to ruby; run specify with --ruby argument"
- options[:parallel] = nil
- else
- options[:ruby] ||= [RbConfig.ruby]
- end
-
- super
- end
-
- def setup_options(parser, options)
- super
- parser.separator "load path options:"
- parser.on '-Idirectory', 'Add library load path' do |dirs|
- dirs.split(':').each { |d| $LOAD_PATH.unshift d }
- end
- end
- end
-
- module GlobOption # :nodoc: all
- @@testfile_prefix = "test"
-
- def setup_options(parser, options)
- super
- parser.separator "globbing options:"
- parser.on '-b', '--basedir=DIR', 'Base directory of test suites.' do |dir|
- options[:base_directory] = dir
- end
- parser.on '-x', '--exclude REGEXP', 'Exclude test files on pattern.' do |pattern|
- (options[:reject] ||= []) << pattern
- end
- end
-
- def non_options(files, options)
- paths = [options.delete(:base_directory), nil].uniq
- if reject = options.delete(:reject)
- reject_pat = Regexp.union(reject.map {|r| %r"#{r}"})
- end
- files.map! {|f|
- f = f.tr(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
- ((paths if /\A\.\.?(?:\z|\/)/ !~ f) || [nil]).any? do |prefix|
- if prefix
- path = f.empty? ? prefix : "#{prefix}/#{f}"
- else
- next if f.empty?
- path = f
- end
- if !(match = Dir["#{path}/**/#{@@testfile_prefix}_*.rb"]).empty?
- if reject
- match.reject! {|n|
- n[(prefix.length+1)..-1] if prefix
- reject_pat =~ n
- }
- end
- break match
- elsif !reject or reject_pat !~ f and File.exist? path
- break path
- end
- end or
- raise ArgumentError, "file not found: #{f}"
- }
- files.flatten!
- super(files, options)
- end
- end
-
- module GCStressOption # :nodoc: all
- def setup_options(parser, options)
- super
- parser.separator "GC options:"
- parser.on '--[no-]gc-stress', 'Set GC.stress as true' do |flag|
- options[:gc_stress] = flag
- end
- end
-
- def non_options(files, options)
- if options.delete(:gc_stress)
- MiniTest::Unit::TestCase.class_eval do
- oldrun = instance_method(:run)
- define_method(:run) do |runner|
- begin
- gc_stress, GC.stress = GC.stress, true
- oldrun.bind(self).call(runner)
- ensure
- GC.stress = gc_stress
- end
- end
- end
- end
- super
- end
- end
-
- module RequireFiles # :nodoc: all
- def non_options(files, options)
- return false if !super
- errors = {}
- result = false
- files.each {|f|
- d = File.dirname(path = File.realpath(f))
- unless $:.include? d
- $: << d
- end
- begin
- require path unless options[:parallel]
- result = true
- rescue LoadError
- next if errors[$!.message]
- errors[$!.message] = true
- puts "#{f}: #{$!}"
- end
- }
+ def run(*args)
+ result = super
+ puts "\nruby -v: #{RUBY_DESCRIPTION}"
result
end
end
- module ExcludesOption # :nodoc: all
- class ExcludedMethods < Struct.new(:excludes)
- def exclude(name, reason)
- excludes[name] = reason
- end
-
- def exclude_from(klass)
- excludes = self.excludes
- pattern = excludes.keys.grep(Regexp).tap {|k|
- break (Regexp.new(k.join('|')) unless k.empty?)
- }
- klass.class_eval do
- public_instance_methods(false).each do |method|
- if excludes[method] or (pattern and pattern =~ method)
- remove_method(method)
- end
- end
- public_instance_methods(true).each do |method|
- if excludes[method] or (pattern and pattern =~ method)
- undef_method(method)
- end
- end
- end
- end
-
- def self.load(dirs, name)
- return unless dirs and name
- instance = nil
- dirs.each do |dir|
- path = File.join(dir, name.gsub(/::/, '/') + ".rb")
- begin
- src = File.read(path)
- rescue Errno::ENOENT
- nil
- else
- instance ||= new({})
- instance.instance_eval(src)
- end
- end
- instance
- end
- end
-
- def setup_options(parser, options)
- super
- if excludes = ENV["EXCLUDES"]
- excludes = excludes.split(File::PATH_SEPARATOR)
- end
- options[:excludes] = excludes || []
- parser.on '-X', '--excludes-dir DIRECTORY', "Directory name of exclude files" do |d|
- options[:excludes].concat d.split(File::PATH_SEPARATOR)
- end
- end
-
- def _run_suite(suite, type)
- if ex = ExcludedMethods.load(@options[:excludes], suite.name)
- ex.exclude_from(suite)
- end
- super
- end
- end
-
- class Runner < MiniTest::Unit # :nodoc: all
- include Test::Unit::Options
- include Test::Unit::StatusLine
- include Test::Unit::Parallel
- include Test::Unit::Skipping
- include Test::Unit::GlobOption
- include Test::Unit::LoadPathOption
- include Test::Unit::GCStressOption
- include Test::Unit::ExcludesOption
- include Test::Unit::RunCount
-
- class << self; undef autorun; end
-
- @@stop_auto_run = false
- def self.autorun
- at_exit {
- Test::Unit::RunCount.run_once {
- exit(Test::Unit::Runner.new.run(ARGV) || true)
- } unless @@stop_auto_run
- } unless @@installed_at_exit
- @@installed_at_exit = true
- end
-
- alias mini_run_suite _run_suite
-
- # Overriding of MiniTest::Unit#puke
- def puke klass, meth, e
- # TODO:
- # this overriding is for minitest feature that skip messages are
- # hidden when not verbose (-v), note this is temporally.
- n = report.size
- rep = super
- if MiniTest::Skip === e and /no message given\z/ =~ e.message
- report.slice!(n..-1)
- rep = "."
+ class StatusLineOutput < Struct.new(:runner) # :nodoc: all
+ def puts(*a) $stdout.puts(*a) unless a.empty? end
+ def respond_to_missing?(*a) $stdout.respond_to?(*a) end
+ def method_missing(*a, &b) $stdout.__send__(*a, &b) end
+
+ def print(s)
+ case s
+ when /\A(.*\#.*) = \z/
+ runner.new_test($1)
+ when /\A(.* s) = \z/
+ runner.add_status(" = "+$1.chomp)
+ when /\A\.+\z/
+ runner.succeed
+ when /\A[EFS]\z/
+ runner.failed(s)
+ else
+ $stdout.print(s)
end
- rep
end
end
@@ -1002,15 +862,6 @@ module MiniTest # :nodoc: all
end
class MiniTest::Unit::TestCase # :nodoc: all
- test_order = self.test_order
- class << self
- attr_writer :test_order
- undef test_order
- end
- def self.test_order
- defined?(@test_order) ? @test_order : superclass.test_order
- end
- self.test_order = test_order
undef run_test
RUN_TEST_TRACE = "#{__FILE__}:#{__LINE__+3}:in `run_test'".freeze
def run_test(name)
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
new file mode 100644
index 0000000000..7da0c4e1eb
--- /dev/null
+++ b/lib/test/unit/assertions.rb
@@ -0,0 +1,396 @@
+require 'minitest/unit'
+require 'pp'
+
+module Test
+ module Unit
+ module Assertions
+ include MiniTest::Assertions
+
+ def mu_pp(obj) #:nodoc:
+ obj.pretty_inspect.chomp
+ end
+
+ MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc:
+
+ # :call-seq:
+ # assert(test, [failure_message])
+ #
+ #Tests if +test+ is true.
+ #
+ #+msg+ may be a String or a Proc. If +msg+ is a String, it will be used
+ #as the failure message. Otherwise, the result of calling +msg+ will be
+ #used as the message if the assertion fails.
+ #
+ #If no +msg+ is given, a default message will be used.
+ #
+ # assert(false, "This was expected to be true")
+ def assert(test, *msgs)
+ case msg = msgs.first
+ when String, Proc
+ when nil
+ msgs.shift
+ else
+ bt = caller.reject { |s| s.start_with?(MINI_DIR) }
+ raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt
+ end unless msgs.empty?
+ super
+ end
+
+ # :call-seq:
+ # assert_block( failure_message = nil )
+ #
+ #Tests the result of the given block. If the block does not return true,
+ #the assertion will fail. The optional +failure_message+ argument is the same as in
+ #Assertions#assert.
+ #
+ # assert_block do
+ # [1, 2, 3].any? { |num| num < 1 }
+ # end
+ def assert_block(*msgs)
+ assert yield, *msgs
+ end
+
+ # :call-seq:
+ # assert_raise( *args, &block )
+ #
+ #Tests if the given block raises an exception. Acceptable exception
+ #types maye be given as optional arguments. If the last argument is a
+ #String, it will be used as the error message.
+ #
+ # assert_raise do #Fails, no Exceptions are raised
+ # end
+ #
+ # assert_raise NameError do
+ # puts x #Raises NameError, so assertion succeeds
+ # end
+ def assert_raise(*args, &b)
+ assert_raises(*args, &b)
+ end
+
+ # :call-seq:
+ # assert_raise_with_message(exception, expected, msg = nil, &block)
+ #
+ #Tests if the given block raises an exception with the expected
+ #message.
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # nil #Fails, no Exceptions are raised
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise ArgumentError, "foo" #Fails, different Exception is raised
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise "bar" #Fails, RuntimeError is raised but the message differs
+ # end
+ #
+ # assert_raise_with_message(RuntimeError, "foo") do
+ # raise "foo" #Raises RuntimeError with the message, so assertion succeeds
+ # end
+ def assert_raise_with_message(exception, expected, msg = nil)
+ case expected
+ when String
+ assert = :assert_equal
+ when Regexp
+ assert = :assert_match
+ else
+ raise TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}"
+ end
+
+ ex = assert_raise(exception, *msg) {yield}
+ msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
+ __send__(assert, expected, ex.message, msg)
+ ex
+ end
+
+ # :call-seq:
+ # assert_nothing_raised( *args, &block )
+ #
+ #If any exceptions are given as arguments, the assertion will
+ #fail if one of those exceptions are raised. Otherwise, the test fails
+ #if any exceptions are raised.
+ #
+ #The final argument may be a failure message.
+ #
+ # assert_nothing_raised RuntimeError do
+ # raise Exception #Assertion passes, Exception is not a RuntimeError
+ # end
+ #
+ # assert_nothing_raised do
+ # raise Exception #Assertion fails
+ # end
+ def assert_nothing_raised(*args)
+ self._assertions += 1
+ if Module === args.last
+ msg = nil
+ else
+ msg = args.pop
+ end
+ begin
+ line = __LINE__; yield
+ rescue MiniTest::Skip
+ raise
+ rescue Exception => e
+ bt = e.backtrace
+ as = e.instance_of?(MiniTest::Assertion)
+ if as
+ ans = /\A#{Regexp.quote(__FILE__)}:#{line}:in /o
+ bt.reject! {|ln| ans =~ ln}
+ end
+ if ((args.empty? && !as) ||
+ args.any? {|a| a.instance_of?(Module) ? e.is_a?(a) : e.class == a })
+ msg = message(msg) { "Exception raised:\n<#{mu_pp(e)}>" }
+ raise MiniTest::Assertion, msg.call, bt
+ else
+ raise
+ end
+ end
+ nil
+ end
+
+ # :call-seq:
+ # assert_nothing_thrown( failure_message = nil, &block )
+ #
+ #Fails if the given block uses a call to Kernel#throw, and
+ #returns the result of the block otherwise.
+ #
+ #An optional failure message may be provided as the final argument.
+ #
+ # assert_nothing_thrown "Something was thrown!" do
+ # throw :problem?
+ # end
+ def assert_nothing_thrown(msg=nil)
+ begin
+ ret = yield
+ rescue ArgumentError => error
+ raise error if /\Auncaught throw (.+)\z/m !~ error.message
+ msg = message(msg) { "<#{$1}> was thrown when nothing was expected" }
+ flunk(msg)
+ end
+ assert(true, "Expected nothing to be thrown")
+ ret
+ end
+
+ # :call-seq:
+ # assert_throw( tag, failure_message = nil, &block )
+ #
+ #Fails unless the given block throws +tag+, returns the caught
+ #value otherwise.
+ #
+ #An optional failure message may be provided as the final argument.
+ #
+ # tag = Object.new
+ # assert_throw(tag, "#{tag} was not thrown!") do
+ # throw tag
+ # end
+ def assert_throw(tag, msg = nil)
+ catch(tag) do
+ yield(tag)
+ assert(false, message(msg) {"Expected #{mu_pp(tag)} to have been thrown"})
+ end
+ end
+
+ # :call-seq:
+ # assert_equal( expected, actual, failure_message = nil )
+ #
+ #Tests if +expected+ is equal to +actual+.
+ #
+ #An optional failure message may be provided as the final argument.
+ def assert_equal(exp, act, msg = nil)
+ msg = message(msg) {
+ exp_str = mu_pp(exp)
+ act_str = mu_pp(act)
+ exp_comment = ''
+ act_comment = ''
+ if exp_str == act_str
+ if (exp.is_a?(String) && act.is_a?(String)) ||
+ (exp.is_a?(Regexp) && act.is_a?(Regexp))
+ exp_comment = " (#{exp.encoding})"
+ act_comment = " (#{act.encoding})"
+ elsif exp.is_a?(Float) && act.is_a?(Float)
+ exp_str = "%\#.#{Float::DIG+2}g" % exp
+ act_str = "%\#.#{Float::DIG+2}g" % act
+ elsif exp.is_a?(Time) && act.is_a?(Time)
+ if exp.subsec * 1000_000_000 == exp.nsec
+ exp_comment = " (#{exp.nsec}[ns])"
+ else
+ exp_comment = " (subsec=#{exp.subsec})"
+ end
+ if act.subsec * 1000_000_000 == act.nsec
+ act_comment = " (#{act.nsec}[ns])"
+ else
+ act_comment = " (subsec=#{act.subsec})"
+ end
+ elsif exp.class != act.class
+ # a subclass of Range, for example.
+ exp_comment = " (#{exp.class})"
+ act_comment = " (#{act.class})"
+ end
+ elsif !Encoding.compatible?(exp_str, act_str)
+ if exp.is_a?(String) && act.is_a?(String)
+ exp_str = exp.dump
+ act_str = act.dump
+ exp_comment = " (#{exp.encoding})"
+ act_comment = " (#{act.encoding})"
+ else
+ exp_str = exp_str.dump
+ act_str = act_str.dump
+ end
+ end
+ "<#{exp_str}>#{exp_comment} expected but was\n<#{act_str}>#{act_comment}"
+ }
+ assert(exp == act, msg)
+ end
+
+ # :call-seq:
+ # assert_not_nil( expression, failure_message = nil )
+ #
+ #Tests if +expression+ is not nil.
+ #
+ #An optional failure message may be provided as the final argument.
+ def assert_not_nil(exp, msg=nil)
+ msg = message(msg) { "<#{mu_pp(exp)}> expected to not be nil" }
+ assert(!exp.nil?, msg)
+ end
+
+ # :call-seq:
+ # assert_not_equal( expected, actual, failure_message = nil )
+ #
+ #Tests if +expected+ is not equal to +actual+.
+ #
+ #An optional failure message may be provided as the final argument.
+ def assert_not_equal(exp, act, msg=nil)
+ msg = message(msg) { "<#{mu_pp(exp)}> expected to be != to\n<#{mu_pp(act)}>" }
+ assert(exp != act, msg)
+ end
+
+ # :call-seq:
+ # assert_no_match( regexp, string, failure_message = nil )
+ #
+ #Tests if the given Regexp does not match a given String.
+ #
+ #An optional failure message may be provided as the final argument.
+ def assert_no_match(regexp, string, msg=nil)
+ assert_instance_of(Regexp, regexp, "The first argument to assert_no_match should be a Regexp.")
+ self._assertions -= 1
+ msg = message(msg) { "<#{mu_pp(regexp)}> expected to not match\n<#{mu_pp(string)}>" }
+ assert(regexp !~ string, msg)
+ end
+
+ # :call-seq:
+ # assert_not_same( expected, actual, failure_message = nil )
+ #
+ #Tests if +expected+ is not the same object as +actual+.
+ #This test uses Object#equal? to test equality.
+ #
+ #An optional failure message may be provided as the final argument.
+ #
+ # assert_not_same("x", "x") #Succeeds
+ def assert_not_same(expected, actual, message="")
+ msg = message(msg) { build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__) }
+<?>
+with id <?> expected to not be equal\\? to
+<?>
+with id <?>.
+EOT
+ assert(!actual.equal?(expected), msg)
+ end
+
+ # :call-seq:
+ # assert_respond_to( object, method, failure_message = nil )
+ #
+ #Tests if the given Object responds to +method+.
+ #
+ #An optional failure message may be provided as the final argument.
+ #
+ # assert_respond_to("hello", :reverse) #Succeeds
+ # assert_respond_to("hello", :does_not_exist) #Fails
+ def assert_respond_to obj, (meth, priv), msg = nil
+ if priv
+ msg = message(msg) {
+ "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv}"
+ }
+ return assert obj.respond_to?(meth, priv), msg
+ end
+ #get rid of overcounting
+ super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth)
+ end
+
+ # :call-seq:
+ # assert_send( +send_array+, failure_message = nil )
+ #
+ # Passes if the method send returns a true value.
+ #
+ # +send_array+ is composed of:
+ # * A receiver
+ # * A method
+ # * Arguments to the method
+ #
+ # Example:
+ # assert_send(["Hello world", :include?, "Hello"]) # -> pass
+ # assert_send(["Hello world", :include?, "Goodbye"]) # -> fail
+ def assert_send send_ary, m = nil
+ recv, msg, *args = send_ary
+ m = message(m) {
+ if args.empty?
+ argsstr = ""
+ else
+ (argsstr = mu_pp(args)).sub!(/\A\[(.*)\]\z/m, '(\1)')
+ end
+ "Expected #{mu_pp(recv)}.#{msg}#{argsstr} to return true"
+ }
+ assert recv.__send__(msg, *args), m
+ end
+
+ # :call-seq:
+ # assert_not_send( +send_array+, failure_message = nil )
+ #
+ # Passes if the method send doesn't return a true value.
+ #
+ # +send_array+ is composed of:
+ # * A receiver
+ # * A method
+ # * Arguments to the method
+ #
+ # Example:
+ # assert_not_send([[1, 2], :member?, 1]) # -> fail
+ # assert_not_send([[1, 2], :member?, 4]) # -> pass
+ def assert_not_send send_ary, m = nil
+ recv, msg, *args = send_ary
+ m = message(m) {
+ if args.empty?
+ argsstr = ""
+ else
+ (argsstr = mu_pp(args)).sub!(/\A\[(.*)\]\z/m, '(\1)')
+ end
+ "Expected #{mu_pp(recv)}.#{msg}#{argsstr} to return false"
+ }
+ assert !recv.__send__(msg, *args), m
+ end
+
+ ms = instance_methods(true).map {|sym| sym.to_s }
+ ms.grep(/\Arefute_/) do |m|
+ mname = ('assert_not_' << m.to_s[/.*?_(.*)/, 1])
+ alias_method(mname, m) unless ms.include? mname
+ end
+ alias assert_include assert_includes
+ alias assert_not_include assert_not_includes
+
+ def build_message(head, template=nil, *arguments) #:nodoc:
+ template &&= template.chomp
+ template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) }
+ end
+
+ def message(msg = nil, *args, &default) # :nodoc:
+ if Proc === msg
+ super(nil, *args) do
+ [msg.call, (default.call if default)].compact.reject(&:empty?).join(".\n")
+ end
+ else
+ super
+ end
+ end
+ end
+ end
+end
diff --git a/test/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index a0d6a45a51..c1ecf29263 100644
--- a/test/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: false
-$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../.."
require 'test/unit'
module Test
@@ -36,7 +34,7 @@ module Test
th = Thread.new do
begin
- while buf = (self.verbose ? i.gets : i.readpartial(1024))
+ while buf = (self.verbose ? i.gets : i.read(5))
_report "p", buf
end
rescue IOError
@@ -77,8 +75,8 @@ module Test
return result
ensure
MiniTest::Unit.output = orig_stdout
- $stdin = orig_stdin if orig_stdin
- $stdout = orig_stdout if orig_stdout
+ $stdin = orig_stdin
+ $stdout = orig_stdout
o.close if o && !o.closed?
i.close if i && !i.closed?
end
@@ -113,7 +111,7 @@ module Test
suites = MiniTest::Unit::TestCase.test_suites
begin
- require File.realpath($1)
+ require $1
rescue LoadError
_report "after", Marshal.dump([$1, ProxyError.new($!)])
_report "ready"
@@ -139,7 +137,7 @@ module Test
rescue Errno::EPIPE
rescue Exception => e
begin
- trace = e.backtrace || ['unknown method']
+ trace = e.backtrace
err = ["#{trace.shift}: #{e.message} (#{e.class})"] + trace.map{|t| t.prepend("\t") }
_report "bye", Marshal.dump(err.join("\n"))
@@ -152,15 +150,11 @@ module Test
end
def _report(res, *args) # :nodoc:
- @stdout.write(args.empty? ? "#{res}\n" : "#{res} #{args.pack("m0")}\n")
+ res = "#{res} #{args.pack("m0")}" unless args.empty?
+ @stdout.puts(res)
end
def puke(klass, meth, e) # :nodoc:
- if e.is_a?(MiniTest::Skip)
- new_e = MiniTest::Skip.new(e.message)
- new_e.set_backtrace(e.backtrace)
- e = new_e
- end
@partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)]
super
end
@@ -183,7 +177,7 @@ if $0 == __FILE__
module Gem # :nodoc:
end
class Gem::TestCase < MiniTest::Unit::TestCase # :nodoc:
- @@project_dir = File.expand_path('../../../../..', __FILE__)
+ @@project_dir = File.expand_path('../../../..', __FILE__)
end
Test::Unit::Worker.new.run(ARGV)
diff --git a/lib/test/unit/test-unit.gemspec b/lib/test/unit/test-unit.gemspec
new file mode 100644
index 0000000000..6c7d22379d
--- /dev/null
+++ b/lib/test/unit/test-unit.gemspec
@@ -0,0 +1,14 @@
+# -*- ruby -*-
+
+Gem::Specification.new do |s|
+ s.name = "test-unit"
+ s.version = "#{RUBY_VERSION}.0"
+ s.homepage = "http://www.ruby-lang.org"
+ s.author = "Shota Fukumori"
+ s.email = "sorah@tubusu.net"
+ s.summary = "test/unit compatible API testing framework"
+ s.description =
+ "This library implements test/unit compatible API on minitest. " +
+ "The test/unit means that test/unit which was bundled with Ruby 1.8."
+ s.executables = ["testrb"]
+end
diff --git a/test/lib/test/unit/testcase.rb b/lib/test/unit/testcase.rb
index 10348b5c9b..984f08dd32 100644
--- a/test/lib/test/unit/testcase.rb
+++ b/lib/test/unit/testcase.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit/assertions'
module Test
@@ -23,7 +22,6 @@ module Test
end
def self.method_added(name)
- super
return unless name.to_s.start_with?("test_")
@test_methods ||= {}
if @test_methods[name]
diff --git a/lib/thwait.rb b/lib/thwait.rb
index db7e6b1ce5..f6bf314b4b 100644
--- a/lib/thwait.rb
+++ b/lib/thwait.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# thwait.rb - thread synchronization class
# $Release Version: 0.9 $
@@ -26,6 +25,8 @@ require "e2mmap.rb"
#
#
class ThreadsWait
+ RCS_ID='-$Id: thwait.rb,v 1.3 1998/06/26 03:19:34 keiju Exp keiju $-'
+
extend Exception2MessageMapper
def_exception("ErrNoWaitingThread", "No threads for waiting.")
def_exception("ErrNoFinishedThread", "No finished threads.")
@@ -56,7 +57,7 @@ class ThreadsWait
end
# Returns the array of threads that have not terminated yet.
- attr_reader :threads
+ attr :threads
#
# Returns +true+ if there are no threads in the pool still running.
diff --git a/lib/time.rb b/lib/time.rb
index 69e524fd61..0b55480334 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require 'date'
# = time.rb
@@ -39,7 +37,7 @@ require 'date'
# #parse takes a string representation of a Time and attempts to parse it
# using a heuristic.
#
-# Time.parse("2010-10-31") #=> 2010-10-31 00:00:00 -0500
+# Date.parse("2010-10-31") #=> 2010-10-31 00:00:00 -0500
#
# Any missing pieces of the date are inferred based on the current date.
#
@@ -176,24 +174,6 @@ class Time
end
private :zone_utc?
- def force_zone!(t, zone, offset=nil)
- if zone_utc?(zone)
- t.utc
- elsif offset ||= zone_offset(zone)
- # Prefer the local timezone over the fixed offset timezone because
- # the former is a real timezone and latter is an artificial timezone.
- t.localtime
- if t.utc_offset != offset
- # Use the fixed offset timezone only if the local timezone cannot
- # represent the given offset.
- t.localtime(offset)
- end
- else
- t.localtime
- end
- end
- private :force_zone!
-
LeapYearMonthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # :nodoc:
CommonYearMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # :nodoc:
def month_days(y, m)
@@ -216,8 +196,7 @@ class Time
if o != 0 then hour += o; o, hour = hour.divmod(24); off += o end
if off != 0
day += off
- days = month_days(year, mon)
- if days and days < day
+ if month_days(year, mon) < day
mon += 1
if 12 < mon
mon = 1
@@ -249,24 +228,9 @@ class Time
end
private :apply_offset
- def make_time(date, year, mon, day, hour, min, sec, sec_fraction, zone, now)
- if !year && !mon && !day && !hour && !min && !sec && !sec_fraction
- raise ArgumentError, "no time information in #{date.inspect}"
- end
-
- off_year = year || now.year
- off = nil
- off = zone_offset(zone, off_year) if zone
-
- if off
- now = now.getlocal(off) if now.utc_offset != off
- else
- now = now.getlocal
- end
-
+ def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
usec = nil
usec = sec_fraction * 1000000 if sec_fraction
-
if now
begin
break if year; year = now.year
@@ -287,16 +251,14 @@ class Time
sec ||= 0
usec ||= 0
- if year != off_year
- off = nil
- off = zone_offset(zone, year) if zone
- end
+ off = nil
+ off = zone_offset(zone, year) if zone
if off
year, mon, day, hour, min, sec =
apply_offset(year, mon, day, hour, min, sec, off)
t = self.utc(year, mon, day, hour, min, sec, usec)
- force_zone!(t, zone, off)
+ t.localtime if !zone_utc?(zone)
t
else
self.local(year, mon, day, hour, min, sec, usec)
@@ -316,13 +278,13 @@ class Time
# supplied with those of +now+. For the lower components, the minimum
# values (1 or 0) are assumed if broken or missing. For example:
#
- # # Suppose it is "Thu Nov 29 14:33:20 2001" now and
- # # your time zone is EST which is GMT-5.
- # now = Time.parse("Thu Nov 29 14:33:20 2001")
- # Time.parse("16:30", now) #=> 2001-11-29 16:30:00 -0500
- # Time.parse("7/23", now) #=> 2001-07-23 00:00:00 -0500
- # Time.parse("Aug 31", now) #=> 2001-08-31 00:00:00 -0500
- # Time.parse("Aug 2000", now) #=> 2000-08-01 00:00:00 -0500
+ # # Suppose it is "Thu Nov 29 14:33:20 GMT 2001" now and
+ # # your time zone is GMT:
+ # now = Time.parse("Thu Nov 29 14:33:20 GMT 2001")
+ # Time.parse("16:30", now) #=> 2001-11-29 16:30:00 +0900
+ # Time.parse("7/23", now) #=> 2001-07-23 00:00:00 +0900
+ # Time.parse("Aug 31", now) #=> 2001-08-31 00:00:00 +0900
+ # Time.parse("Aug 2000", now) #=> 2000-08-01 00:00:00 +0900
#
# Since there are numerous conflicts among locally defined time zone
# abbreviations all over the world, this method is not intended to
@@ -361,9 +323,12 @@ class Time
def parse(date, now=self.now)
comp = !block_given?
d = Date._parse(date, comp)
+ if !d[:year] && !d[:mon] && !d[:mday] && !d[:hour] && !d[:min] && !d[:sec] && !d[:sec_fraction]
+ raise ArgumentError, "no time information in #{date.inspect}"
+ end
year = d[:year]
year = yield(year) if year && !comp
- make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
+ make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
end
#
@@ -374,7 +339,7 @@ class Time
#
# Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
#
- # Below is a list of the formatting options:
+ # Below is a list of the formating options:
#
# %a :: The abbreviated weekday name ("Sun")
# %A :: The full weekday name ("Sunday")
@@ -419,7 +384,7 @@ class Time
# %x :: Preferred representation for the date alone, no time
# %X :: Preferred representation for the time alone, no date
# %y :: Year without a century (00..99)
- # %Y :: Year which may include century, if provided
+ # %Y :: Year with century
# %z :: Time zone as hour offset from UTC (e.g. +0900)
# %Z :: Time zone name
# %% :: Literal "%" character
@@ -428,22 +393,16 @@ class Time
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
- if sec_fraction = d[:sec_fraction]
- usec = sec_fraction * 1000000
- usec *= -1 if seconds < 0
+ if offset = d[:offset]
+ Time.at(seconds).localtime(offset)
else
- usec = 0
- end
- t = Time.at(seconds, usec)
- if zone = d[:zone]
- force_zone!(t, zone)
+ Time.at(seconds)
end
else
year = d[:year]
year = yield(year) if year && block_given?
- t = make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
+ make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
end
- t
end
MonthValue = { # :nodoc:
@@ -478,26 +437,24 @@ class Time
day = $1.to_i
mon = MonthValue[$2.upcase]
year = $3.to_i
- short_year_p = $3.length <= 3
hour = $4.to_i
min = $5.to_i
sec = $6 ? $6.to_i : 0
zone = $7
- if short_year_p
- # following year completion is compliant with RFC 2822.
- year = if year < 50
- 2000 + year
- else
- 1900 + year
- end
- end
+ # following year completion is compliant with RFC 2822.
+ year = if year < 50
+ 2000 + year
+ elsif year < 1000
+ 1900 + year
+ else
+ year
+ end
- off = zone_offset(zone)
year, mon, day, hour, min, sec =
- apply_offset(year, mon, day, hour, min, sec, off)
+ apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
t = self.utc(year, mon, day, hour, min, sec)
- force_zone!(t, zone, off)
+ t.localtime if !zone_utc?(zone)
t
else
raise ArgumentError.new("not RFC 2822 compliant date: #{date.inspect}")
@@ -525,7 +482,7 @@ class Time
(\d{2}):(\d{2}):(\d{2})\x20
GMT
\s*\z/ix =~ date
- self.rfc2822(date).utc
+ self.rfc2822(date)
elsif /\A\s*
(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday),\x20
(\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d)\x20
@@ -585,12 +542,9 @@ class Time
end
if $8
zone = $8
- off = zone_offset(zone)
year, mon, day, hour, min, sec =
- apply_offset(year, mon, day, hour, min, sec, off)
- t = self.utc(year, mon, day, hour, min, sec, usec)
- force_zone!(t, zone, off)
- t
+ apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
+ self.utc(year, mon, day, hour, min, sec, usec)
else
self.local(year, mon, day, hour, min, sec, usec)
end
@@ -616,7 +570,7 @@ class Time
sprintf('%s, %02d %s %0*d %02d:%02d:%02d ',
RFC2822_DAY_NAME[wday],
day, RFC2822_MONTH_NAME[mon-1], year < 0 ? 5 : 4, year,
- hour, min, sec) <<
+ hour, min, sec) +
if utc?
'-0000'
else
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 792a7c1093..ad951d2ffa 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Timeout long-running blocks
#
# == Synopsis
@@ -25,23 +24,18 @@
module Timeout
# Raised by Timeout#timeout when the block times out.
class Error < RuntimeError
- attr_reader :thread
+ end
+ class ExitException < ::Exception # :nodoc:
+ attr_reader :klass, :thread
- def self.catch(*args)
- exc = new(*args)
- exc.instance_variable_set(:@thread, Thread.current)
- ::Kernel.catch(exc) {yield exc}
+ def initialize(*)
+ super
+ @thread = Thread.current
+ freeze
end
def exception(*)
- # TODO: use Fiber.current to see if self can be thrown
- if self.thread == Thread.current
- bt = caller
- begin
- throw(self, bt)
- rescue UncaughtThrowError
- end
- end
+ throw(self, caller) if self.thread == Thread.current
self
end
end
@@ -49,7 +43,6 @@ module Timeout
# :stopdoc:
THIS_FILE = /\A#{Regexp.quote(__FILE__)}:/o
CALLER_OFFSET = ((c = caller[0]) && THIS_FILE =~ c) ? 1 : 0
- private_constant :THIS_FILE, :CALLER_OFFSET
# :startdoc:
# Perform an operation in a block, raising an error if it takes longer than
@@ -72,14 +65,12 @@ module Timeout
# a module method, so you can call it directly as Timeout.timeout().
def timeout(sec, klass = nil) #:yield: +sec+
return yield(sec) if sec == nil or sec.zero?
- message = "execution expired".freeze
- from = "from #{caller_locations(1, 1)[0]}" if $DEBUG
+ message = "execution expired"
e = Error
- bl = proc do |exception|
+ bt = catch((klass||ExitException).new) do |exception|
begin
x = Thread.current
y = Thread.start {
- Thread.current.name = from
begin
sleep sec
rescue => e
@@ -89,6 +80,8 @@ module Timeout
end
}
return yield(sec)
+ rescue (klass||ExitException) => e
+ e.backtrace
ensure
if y
y.kill
@@ -96,16 +89,9 @@ module Timeout
end
end
end
- if klass
- begin
- bl.call(klass)
- rescue klass => e
- bt = e.backtrace
- end
- else
- bt = Error.catch(message, &bl)
- end
- level = -caller(CALLER_OFFSET).size-2
+ rej = /\A#{Regexp.quote(__FILE__)}:#{__LINE__-4}\z/o
+ bt.reject! {|m| rej =~ m}
+ level = -caller(CALLER_OFFSET).size
while THIS_FILE =~ bt[level]
bt.delete_at(level)
end
@@ -115,14 +101,16 @@ module Timeout
module_function :timeout
end
-def timeout(*args, &block)
- warn "#{caller_locations(1, 1)[0]}: Object##{__method__} is deprecated, use Timeout.timeout instead."
- Timeout.timeout(*args, &block)
+# Identical to:
+#
+# Timeout::timeout(n, e, &block).
+#
+# This method is deprecated and provided only for backwards compatibility.
+# You should use Timeout#timeout instead.
+def timeout(n, e = nil, &block)
+ Timeout::timeout(n, e, &block)
end
# Another name for Timeout::Error, defined for backwards compatibility with
# earlier versions of timeout.rb.
TimeoutError = Timeout::Error
-class Object
- deprecate_constant :TimeoutError
-end
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb
index e4df93c2d0..2161768576 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#
# tmpdir - retrieve temporary directory path
#
@@ -8,7 +7,7 @@
require 'fileutils'
begin
require 'etc.so'
-rescue LoadError # rescue LoadError for miniruby
+rescue LoadError
end
class Dir
@@ -18,12 +17,12 @@ class Dir
##
# Returns the operating system's temporary file path.
- def self.tmpdir
+ def Dir::tmpdir
if $SAFE > 0
- @@systmpdir.dup
+ tmp = @@systmpdir
else
tmp = nil
- [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.'].each do |dir|
+ for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.']
next if !dir
dir = File.expand_path(dir)
if stat = File.stat(dir) and stat.directory? and stat.writable? and
@@ -32,7 +31,7 @@ class Dir
break
end rescue nil
end
- raise ArgumentError, "could not find a temporary directory" unless tmp
+ raise ArgumentError, "could not find a temporary directory" if !tmp
tmp
end
end
@@ -106,19 +105,32 @@ class Dir
Dir.tmpdir
end
- def make_tmpname((prefix, suffix), n)
- prefix = (String.try_convert(prefix) or
- raise ArgumentError, "unexpected prefix: #{prefix.inspect}")
- suffix &&= (String.try_convert(suffix) or
- raise ArgumentError, "unexpected suffix: #{suffix.inspect}")
+ def make_tmpname(prefix_suffix, n)
+ case prefix_suffix
+ when String
+ prefix = prefix_suffix
+ suffix = ""
+ when Array
+ prefix = prefix_suffix[0]
+ suffix = prefix_suffix[1]
+ else
+ raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
+ end
t = Time.now.strftime("%Y%m%d")
- path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}".dup
+ path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
path << "-#{n}" if n
- path << suffix if suffix
- path
+ path << suffix
end
- def create(basename, tmpdir=nil, max_try: nil, **opts)
+ def create(basename, *rest)
+ if opts = Hash.try_convert(rest[-1])
+ opts = opts.dup if rest.pop.equal?(opts)
+ max_try = opts.delete(:max_try)
+ opts = [opts]
+ else
+ opts = []
+ end
+ tmpdir, = *rest
if $SAFE > 0 and tmpdir.tainted?
tmpdir = '/tmp'
else
@@ -127,7 +139,7 @@ class Dir
n = nil
begin
path = File.join(tmpdir, make_tmpname(basename, n))
- yield(path, n, opts)
+ yield(path, n, *opts)
rescue Errno::EEXIST
n ||= 0
n += 1
diff --git a/lib/tracer.rb b/lib/tracer.rb
index fd45f003c8..1d6b019bcf 100644
--- a/lib/tracer.rb
+++ b/lib/tracer.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# $Release Version: 0.3$
# $Revision: 1.12 $
diff --git a/lib/tsort.rb b/lib/tsort.rb
index 2760b7d57f..cb8f67ef60 100644
--- a/lib/tsort.rb
+++ b/lib/tsort.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
#--
# tsort.rb - provides a module for topological sorting and strongly connected components.
#++
@@ -173,7 +171,9 @@ module TSort
# p TSort.tsort(each_node, each_child) # raises TSort::Cyclic
#
def TSort.tsort(each_node, each_child)
- TSort.tsort_each(each_node, each_child).to_a
+ result = []
+ TSort.tsort_each(each_node, each_child) {|element| result << element}
+ result
end
# The iterator version of the #tsort method.
@@ -221,8 +221,6 @@ module TSort
# # 1
#
def TSort.tsort_each(each_node, each_child) # :yields: node
- return to_enum(__method__, each_node, each_child) unless block_given?
-
TSort.each_strongly_connected_component(each_node, each_child) {|component|
if component.size == 1
yield component.first
@@ -278,7 +276,9 @@ module TSort
# #=> [[4], [2, 3], [1]]
#
def TSort.strongly_connected_components(each_node, each_child)
- TSort.each_strongly_connected_component(each_node, each_child).to_a
+ result = []
+ TSort.each_strongly_connected_component(each_node, each_child) {|component| result << component}
+ result
end
# The iterator version of the #strongly_connected_components method.
@@ -340,8 +340,6 @@ module TSort
# # [1]
#
def TSort.each_strongly_connected_component(each_node, each_child) # :yields: nodes
- return to_enum(__method__, each_node, each_child) unless block_given?
-
id_map = {}
stack = []
each_node.call {|node|
@@ -406,8 +404,6 @@ module TSort
# # [1]
#
def TSort.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
- return to_enum(__method__, node, each_child, id_map, stack) unless block_given?
-
minimum_id = node_id = id_map[node] = id_map.size
stack_length = stack.length
stack << node
diff --git a/lib/ubygems.rb b/lib/ubygems.rb
index 3d1798fe98..fec880f73b 100644
--- a/lib/ubygems.rb
+++ b/lib/ubygems.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# This file allows for the running of rubygems with a nice
# command line look-and-feel: ruby -rubygems foo.rb
#--
diff --git a/lib/un.rb b/lib/un.rb
index 9c1ce624a5..487ba9eb75 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# = un.rb
#
@@ -320,8 +319,10 @@ def httpd
[:Port, :MaxClients].each do |name|
opt = options[name] and (options[name] = Integer(opt)) rescue nil
end
- options[:Port] ||= 8080 # HTTP Alternate
- options[:DocumentRoot] = argv.shift || '.'
+ unless argv.size == 1
+ raise ArgumentError, "DocumentRoot is mandatory"
+ end
+ options[:DocumentRoot] = argv.shift
s = WEBrick::HTTPServer.new(options)
shut = proc {s.shutdown}
siglist = %w"TERM QUIT"
@@ -368,7 +369,7 @@ module UN # :nodoc:
end
end
if messages
- argv.each {|arg| output << messages[arg]}
+ argv.each {|cmd| output << messages[cmd]}
end
end
end
diff --git a/lib/unicode_normalize.rb b/lib/unicode_normalize.rb
deleted file mode 100644
index 8daf7b301a..0000000000
--- a/lib/unicode_normalize.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# coding: utf-8
-# frozen_string_literal: false
-
-# Copyright Ayumu Nojima (野島 歩) and Martin J. Dürst (duerst@it.aoyama.ac.jp)
-
-# additions to class String for Unicode normalization
-class String
- # === Unicode Normalization
- #
- # :call-seq:
- # str.unicode_normalize(form=:nfc)
- #
- # Returns a normalized form of +str+, using Unicode normalizations
- # NFC, NFD, NFKC, or NFKD. The normalization form used is determined
- # by +form+, which is any of the four values :nfc, :nfd, :nfkc, or :nfkd.
- # The default is :nfc.
- #
- # If the string is not in a Unicode Encoding, then an Exception is raised.
- # In this context, 'Unicode Encoding' means any of UTF-8, UTF-16BE/LE,
- # and UTF-32BE/LE, as well as GB18030, UCS_2BE, and UCS_4BE. Anything
- # else than UTF-8 is implemented by converting to UTF-8,
- # which makes it slower than UTF-8.
- #
- # _Examples_
- #
- # "a\u0300".unicode_normalize #=> 'à' (same as "\u00E0")
- # "a\u0300".unicode_normalize(:nfc) #=> 'à' (same as "\u00E0")
- # "\u00E0".unicode_normalize(:nfd) #=> 'à' (same as "a\u0300")
- # "\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nfd)
- # #=> Encoding::CompatibilityError raised
- #
- def unicode_normalize(form = :nfc)
- require 'unicode_normalize/normalize.rb' unless defined? UnicodeNormalize
- ## The following line can be uncommented to avoid repeated checking for
- ## UnicodeNormalize. However, tests didn't show any noticeable speedup
- ## when doing this. This comment also applies to the commented out lines
- ## in String#unicode_normalize! and String#unicode_normalized?.
- # String.send(:define_method, :unicode_normalize, ->(form = :nfc) { UnicodeNormalize.normalize(self, form) } )
- UnicodeNormalize.normalize(self, form)
- end
-
- # :call-seq:
- # str.unicode_normalize!(form=:nfc)
- #
- # Destructive version of String#unicode_normalize, doing Unicode
- # normalization in place.
- #
- def unicode_normalize!(form = :nfc)
- require 'unicode_normalize/normalize.rb' unless defined? UnicodeNormalize
- # String.send(:define_method, :unicode_normalize!, ->(form = :nfc) { replace(unicode_normalize(form)) } )
- replace(unicode_normalize(form))
- end
-
- # :call-seq:
- # str.unicode_normalized?(form=:nfc)
- #
- # Checks whether +str+ is in Unicode normalization form +form+,
- # which is any of the four values :nfc, :nfd, :nfkc, or :nfkd.
- # The default is :nfc.
- #
- # If the string is not in a Unicode Encoding, then an Exception is raised.
- # For details, see String#unicode_normalize.
- #
- # _Examples_
- #
- # "a\u0300".unicode_normalized? #=> false
- # "a\u0300".unicode_normalized?(:nfd) #=> true
- # "\u00E0".unicode_normalized? #=> true
- # "\u00E0".unicode_normalized?(:nfd) #=> false
- # "\xE0".force_encoding('ISO-8859-1').unicode_normalized?
- # #=> Encoding::CompatibilityError raised
- #
- def unicode_normalized?(form = :nfc)
- require 'unicode_normalize/normalize.rb' unless defined? UnicodeNormalize
- # String.send(:define_method, :unicode_normalized?, ->(form = :nfc) { UnicodeNormalize.normalized?(self, form) } )
- UnicodeNormalize.normalized?(self, form)
- end
-end
-
diff --git a/lib/unicode_normalize/normalize.rb b/lib/unicode_normalize/normalize.rb
deleted file mode 100644
index 8f0e8a20d1..0000000000
--- a/lib/unicode_normalize/normalize.rb
+++ /dev/null
@@ -1,161 +0,0 @@
-# coding: utf-8
-# frozen_string_literal: false
-
-# Copyright Ayumu Nojima (野島 歩) and Martin J. Dürst (duerst@it.aoyama.ac.jp)
-
-require 'unicode_normalize/tables.rb'
-
-
-module UnicodeNormalize
- ## Constant for max hash capacity to avoid DoS attack
- MAX_HASH_LENGTH = 18000 # enough for all test cases, otherwise tests get slow
-
- ## Regular Expressions and Hash Constants
- REGEXP_D = Regexp.compile(REGEXP_D_STRING, Regexp::EXTENDED)
- REGEXP_C = Regexp.compile(REGEXP_C_STRING, Regexp::EXTENDED)
- REGEXP_K = Regexp.compile(REGEXP_K_STRING, Regexp::EXTENDED)
- NF_HASH_D = Hash.new do |hash, key|
- hash.shift if hash.length>MAX_HASH_LENGTH # prevent DoS attack
- hash[key] = nfd_one(key)
- end
- NF_HASH_C = Hash.new do |hash, key|
- hash.shift if hash.length>MAX_HASH_LENGTH # prevent DoS attack
- hash[key] = nfc_one(key)
- end
-
- ## Constants For Hangul
- # for details such as the meaning of the identifiers below, please see
- # http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf, pp. 144/145
- SBASE = 0xAC00
- LBASE = 0x1100
- VBASE = 0x1161
- TBASE = 0x11A7
- LCOUNT = 19
- VCOUNT = 21
- TCOUNT = 28
- NCOUNT = VCOUNT * TCOUNT
- SCOUNT = LCOUNT * NCOUNT
-
- # Unicode-based encodings (except UTF-8)
- UNICODE_ENCODINGS = [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE,
- Encoding::GB18030, Encoding::UCS_2BE, Encoding::UCS_4BE]
-
- ## Hangul Algorithm
- def self.hangul_decomp_one(target)
- syllable_index = target.ord - SBASE
- return target if syllable_index < 0 || syllable_index >= SCOUNT
- l = LBASE + syllable_index / NCOUNT
- v = VBASE + (syllable_index % NCOUNT) / TCOUNT
- t = TBASE + syllable_index % TCOUNT
- (t==TBASE ? [l, v] : [l, v, t]).pack('U*') + target[1..-1]
- end
-
- def self.hangul_comp_one(string)
- length = string.length
- if length>1 and 0 <= (lead =string[0].ord-LBASE) and lead < LCOUNT and
- 0 <= (vowel=string[1].ord-VBASE) and vowel < VCOUNT
- lead_vowel = SBASE + (lead * VCOUNT + vowel) * TCOUNT
- if length>2 and 0 <= (trail=string[2].ord-TBASE) and trail < TCOUNT
- (lead_vowel + trail).chr(Encoding::UTF_8) + string[3..-1]
- else
- lead_vowel.chr(Encoding::UTF_8) + string[2..-1]
- end
- else
- string
- end
- end
-
- ## Canonical Ordering
- def self.canonical_ordering_one(string)
- sorting = string.each_char.collect { |c| [c, CLASS_TABLE[c]] }
- (sorting.length-2).downto(0) do |i| # almost, but not exactly bubble sort
- (0..i).each do |j|
- later_class = sorting[j+1].last
- if 0<later_class and later_class<sorting[j].last
- sorting[j], sorting[j+1] = sorting[j+1], sorting[j]
- end
- end
- end
- return sorting.collect(&:first).join('')
- end
-
- ## Normalization Forms for Patterns (not whole Strings)
- def self.nfd_one(string)
- string = string.chars.map! {|c| DECOMPOSITION_TABLE[c] || c}.join('')
- canonical_ordering_one(hangul_decomp_one(string))
- end
-
- def self.nfc_one(string)
- nfd_string = nfd_one string
- start = nfd_string[0]
- last_class = CLASS_TABLE[start]-1
- accents = ''
- nfd_string[1..-1].each_char do |accent|
- accent_class = CLASS_TABLE[accent]
- if last_class<accent_class and composite = COMPOSITION_TABLE[start+accent]
- start = composite
- else
- accents << accent
- last_class = accent_class
- end
- end
- hangul_comp_one(start+accents)
- end
-
- def self.normalize(string, form = :nfc)
- encoding = string.encoding
- case encoding
- when Encoding::UTF_8
- case form
- when :nfc then
- string.gsub REGEXP_C, NF_HASH_C
- when :nfd then
- string.gsub REGEXP_D, NF_HASH_D
- when :nfkc then
- string.gsub(REGEXP_K, KOMPATIBLE_TABLE).gsub(REGEXP_C, NF_HASH_C)
- when :nfkd then
- string.gsub(REGEXP_K, KOMPATIBLE_TABLE).gsub(REGEXP_D, NF_HASH_D)
- else
- raise ArgumentError, "Invalid normalization form #{form}."
- end
- when Encoding::US_ASCII
- string
- when *UNICODE_ENCODINGS
- normalize(string.encode(Encoding::UTF_8), form).encode(encoding)
- else
- raise Encoding::CompatibilityError, "Unicode Normalization not appropriate for #{encoding}"
- end
- end
-
- def self.normalized?(string, form = :nfc)
- encoding = string.encoding
- case encoding
- when Encoding::UTF_8
- case form
- when :nfc then
- string.scan REGEXP_C do |match|
- return false if NF_HASH_C[match] != match
- end
- true
- when :nfd then
- string.scan REGEXP_D do |match|
- return false if NF_HASH_D[match] != match
- end
- true
- when :nfkc then
- normalized?(string, :nfc) and string !~ REGEXP_K
- when :nfkd then
- normalized?(string, :nfd) and string !~ REGEXP_K
- else
- raise ArgumentError, "Invalid normalization form #{form}."
- end
- when Encoding::US_ASCII
- true
- when *UNICODE_ENCODINGS
- normalized? string.encode(Encoding::UTF_8), form
- else
- raise Encoding::CompatibilityError, "Unicode Normalization not appropriate for #{encoding}"
- end
- end
-
-end # module
diff --git a/lib/unicode_normalize/tables.rb b/lib/unicode_normalize/tables.rb
deleted file mode 100644
index 06d92714fe..0000000000
--- a/lib/unicode_normalize/tables.rb
+++ /dev/null
@@ -1,1160 +0,0 @@
-# coding: us-ascii
-# frozen_string_literal: true
-
-# automatically generated by template/unicode_norm_gen.tmpl
-
-module UnicodeNormalize
- UNICODE_VERSION = "8.0.0"
-
- accents = "" \
- "[\u0300-\u034E\u0350-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7" \
- "\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711" \
- "\u0730-\u074A\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u08FF" \
- "\u093C\u094D\u0951-\u0954\u09BC\u09BE\u09CD\u09D7\u0A3C" \
- "\u0A4D\u0ABC\u0ACD\u0B3C\u0B3E\u0B4D\u0B56\u0B57\u0BBE" \
- "\u0BCD\u0BD7\u0C4D\u0C55\u0C56\u0CBC\u0CC2\u0CCD\u0CD5\u0CD6" \
- "\u0D3E\u0D4D\u0D57\u0DCA\u0DCF\u0DDF\u0E38-\u0E3A\u0E48-\u0E4B" \
- "\u0EB8\u0EB9\u0EC8-\u0ECB\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71\u0F72\u0F74" \
- "\u0F7A-\u0F7D\u0F80\u0F82-\u0F84\u0F86\u0F87\u0FC6\u102E\u1037\u1039\u103A" \
- "\u108D\u135D-\u135F\u1714\u1734\u17D2\u17DD\u18A9\u1939-\u193B" \
- "\u1A17\u1A18\u1A60\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B35\u1B44\u1B6B-\u1B73" \
- "\u1BAA\u1BAB\u1BE6\u1BF2\u1BF3\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED" \
- "\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1" \
- "\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1" \
- "\uA806\uA8C4\uA8E0-\uA8F1\uA92B-\uA92D\uA953\uA9B3\uA9C0\uAAB0" \
- "\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAF6\uABED\uFB1E\uFE20-\uFE2F" \
- "\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A0D}\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}" \
- "\u{11046}\u{1107F}\u{110B9}\u{110BA}\u{11100}-\u{11102}\u{11127}\u{11133}\u{11134}\u{11173}\u{111C0}" \
- "\u{111CA}\u{11235}\u{11236}\u{112E9}\u{112EA}\u{1133C}\u{1133E}\u{1134D}\u{11357}\u{11366}-\u{1136C}" \
- "\u{11370}-\u{11374}\u{114B0}\u{114BA}\u{114BD}\u{114C2}\u{114C3}\u{115AF}\u{115BF}\u{115C0}\u{1163F}" \
- "\u{116B6}\u{116B7}\u{1172B}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{1BC9E}\u{1D165}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}" \
- "\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1E8D0}-\u{1E8D6}" \
- "]"
- ACCENTS = accents
- REGEXP_D_STRING = "#{'' # composition starters and composition exclusions
- }" \
- "[\u00C0-\u00C5\u00C7-\u00CF\u00D1-\u00D6\u00D9-\u00DD\u00E0-\u00E5\u00E7-\u00EF\u00F1-\u00F6\u00F9-\u00FD" \
- "\u00FF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165" \
- "\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B" \
- "\u021E\u021F\u0226-\u0233\u0340\u0341\u0343\u0344\u0374\u037E\u0385-\u038A\u038C" \
- "\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E" \
- "\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2" \
- "\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0" \
- "\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD" \
- "\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D" \
- "\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA" \
- "\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73" \
- "\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC" \
- "\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12" \
- "\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15" \
- "\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D" \
- "\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4" \
- "\u1FF6-\u1FFD\u2000\u2001\u2126\u212A\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204" \
- "\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249" \
- "\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289" \
- "\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2329\u232A\u2ADC\u304C\u304E\u3050" \
- "\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060" \
- "\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A" \
- "\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4" \
- "\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5" \
- "\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4" \
- "\u30F7-\u30FA\u30FE\uF900-\uFA0D\uFA10\uFA12\uFA15-\uFA1E\uFA20\uFA22" \
- "\uFA25\uFA26\uFA2A-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E" \
- "\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E\u{1109A}\u{1109C}\u{110AB}\u{1112E}\u{1112F}\u{1134B}\u{1134C}" \
- "\u{114BB}\u{114BC}\u{114BE}\u{115BA}\u{115BB}\u{1D15E}-\u{1D164}\u{1D1BB}-\u{1D1C0}\u{2F800}-\u{2FA1D}" \
- "]#{accents}*" \
- "|#{'' # characters that can be the result of a composition, except composition starters
- }" \
- "[<->A-PR-Za-pr-z\u00A8\u00C6\u00D8" \
- "\u00E6\u00F8\u017F\u01B7\u0292\u0391\u0395\u0397" \
- "\u0399\u039F\u03A1\u03A5\u03A9\u03B1\u03B5\u03B7" \
- "\u03B9\u03BF\u03C1\u03C5\u03C9\u03D2\u0406\u0410" \
- "\u0413\u0415-\u0418\u041A\u041E\u0423\u0427\u042B\u042D" \
- "\u0430\u0433\u0435-\u0438\u043A\u043E\u0443\u0447\u044B" \
- "\u044D\u0456\u0474\u0475\u04D8\u04D9\u04E8\u04E9\u0627\u0648\u064A" \
- "\u06C1\u06D2\u06D5\u0928\u0930\u0933\u09C7\u0B47" \
- "\u0B92\u0BC6\u0BC7\u0C46\u0CBF\u0CC6\u0D46\u0D47\u0DD9\u1025" \
- "\u1B05\u1B07\u1B09\u1B0B\u1B0D\u1B11\u1B3A\u1B3C" \
- "\u1B3E\u1B3F\u1B42\u1FBF\u1FFE\u2190\u2192\u2194\u21D0" \
- "\u21D2\u21D4\u2203\u2208\u220B\u2223\u2225\u223C" \
- "\u2243\u2245\u2248\u224D\u2261\u2264\u2265\u2272\u2273\u2276\u2277" \
- "\u227A-\u227D\u2282\u2283\u2286\u2287\u2291\u2292\u22A2\u22A8\u22A9\u22AB\u22B2-\u22B5" \
- "\u3046\u304B\u304D\u304F\u3051\u3053\u3055\u3057" \
- "\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068" \
- "\u306F\u3072\u3075\u3078\u307B\u309D\u30A6\u30AB" \
- "\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB" \
- "\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CF\u30D2" \
- "\u30D5\u30D8\u30DB\u30EF-\u30F2\u30FD\u{11099}\u{1109B}\u{110A5}" \
- "\u{11131}\u{11132}\u{11347}\u{114B9}\u{115B8}\u{115B9}" \
- "]?#{accents}+" \
- "|#{'' # precomposed Hangul syllables
- }" \
- "[\u{AC00}-\u{D7A4}]"
- REGEXP_C_STRING = "#{'' # composition exclusions
- }" \
- "[\u0340\u0341\u0343\u0344\u0374\u037E\u0387\u0958-\u095F\u09DC\u09DD\u09DF" \
- "\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B5C\u0B5D\u0F43\u0F4D\u0F52" \
- "\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93" \
- "\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1F71\u1F73\u1F75" \
- "\u1F77\u1F79\u1F7B\u1F7D\u1FBB\u1FBE\u1FC9\u1FCB" \
- "\u1FD3\u1FDB\u1FE3\u1FEB\u1FEE\u1FEF\u1FF9\u1FFB\u1FFD" \
- "\u2000\u2001\u2126\u212A\u212B\u2329\u232A\u2ADC\uF900-\uFA0D\uFA10\uFA12" \
- "\uFA15-\uFA1E\uFA20\uFA22\uFA25\uFA26\uFA2A-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F" \
- "\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E\u{1D15E}-\u{1D164}\u{1D1BB}-\u{1D1C0}" \
- "\u{2F800}-\u{2FA1D}" \
- "]#{accents}*" \
- "|#{'' # composition starters and characters that can be the result of a composition
- }" \
- "[<->A-PR-Za-pr-z\u00A8\u00C0-\u00CF\u00D1-\u00D6" \
- "\u00D8-\u00DD\u00E0-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u00FF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137" \
- "\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017F\u01A0\u01A1\u01AF\u01B0\u01B7" \
- "\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0292" \
- "\u0385\u0386\u0388-\u038A\u038C\u038E-\u0391\u0395\u0397\u0399\u039F" \
- "\u03A1\u03A5\u03A9-\u03B1\u03B5\u03B7\u03B9\u03BF\u03C1" \
- "\u03C5\u03C9-\u03CE\u03D2-\u03D4\u0400\u0401\u0403\u0406\u0407\u040C-\u040E\u0410" \
- "\u0413\u0415-\u041A\u041E\u0423\u0427\u042B\u042D\u0430" \
- "\u0433\u0435-\u043A\u043E\u0443\u0447\u044B\u044D\u0450\u0451" \
- "\u0453\u0456\u0457\u045C-\u045E\u0474-\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6-\u04DF\u04E2-\u04F5" \
- "\u04F8\u04F9\u0622-\u0627\u0648\u064A\u06C0-\u06C2\u06D2\u06D3\u06D5\u0928\u0929" \
- "\u0930\u0931\u0933\u0934\u09C7\u09CB\u09CC\u0B47\u0B48\u0B4B\u0B4C\u0B92\u0B94" \
- "\u0BC6\u0BC7\u0BCA-\u0BCC\u0C46\u0C48\u0CBF\u0CC0\u0CC6-\u0CC8\u0CCA\u0CCB\u0D46\u0D47" \
- "\u0D4A-\u0D4C\u0DD9\u0DDA\u0DDC-\u0DDE\u1025\u1026\u1B05-\u1B0E\u1B11\u1B12\u1B3A-\u1B43\u1E00-\u1E99" \
- "\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59" \
- "\u1F5B\u1F5D\u1F5F-\u1F70\u1F72\u1F74\u1F76\u1F78\u1F7A" \
- "\u1F7C\u1F80-\u1FB4\u1FB6-\u1FBA\u1FBC\u1FBF\u1FC1-\u1FC4\u1FC6-\u1FC8\u1FCA" \
- "\u1FCC-\u1FD2\u1FD6-\u1FDA\u1FDD-\u1FE2\u1FE4-\u1FEA\u1FEC\u1FED\u1FF2-\u1FF4\u1FF6-\u1FF8\u1FFA" \
- "\u1FFC\u1FFE\u2190\u2192\u2194\u219A\u219B\u21AE\u21CD-\u21D0" \
- "\u21D2\u21D4\u2203\u2204\u2208\u2209\u220B\u220C\u2223-\u2226\u223C\u2241" \
- "\u2243-\u2245\u2247-\u2249\u224D\u2260-\u2262\u2264\u2265\u226D-\u227D\u2280-\u2289\u2291\u2292" \
- "\u22A2\u22A8\u22A9\u22AB-\u22AF\u22B2-\u22B5\u22E0-\u22E3\u22EA-\u22ED\u3046\u304B-\u3062" \
- "\u3064-\u3069\u306F-\u307D\u3094\u309D\u309E\u30A6\u30AB-\u30C2\u30C4-\u30C9\u30CF-\u30DD" \
- "\u30EF-\u30F2\u30F4\u30F7-\u30FA\u30FD\u30FE\u{11099}-\u{1109C}\u{110A5}\u{110AB}\u{1112E}\u{1112F}" \
- "\u{11131}\u{11132}\u{11347}\u{1134B}\u{1134C}\u{114B9}\u{114BB}\u{114BC}\u{114BE}\u{115B8}-\u{115BB}" \
- "]?#{accents}+" \
- "|#{'' # Hangul syllables with separate trailer
- }" \
- "[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4" \
- "\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4" \
- "\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84" \
- "\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64" \
- "\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044" \
- "\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124" \
- "\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204" \
- "\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4" \
- "\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4" \
- "\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4" \
- "\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584" \
- "\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664" \
- "\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744" \
- "\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824" \
- "\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904" \
- "\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4" \
- "\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4" \
- "\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4" \
- "\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84" \
- "\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64" \
- "\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44" \
- "\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24" \
- "\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004" \
- "\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4" \
- "\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4" \
- "\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4" \
- "\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384" \
- "\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464" \
- "\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544" \
- "\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624" \
- "\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704" \
- "\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4" \
- "\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4" \
- "\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4" \
- "\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84" \
- "\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64" \
- "\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44" \
- "\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24" \
- "\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04" \
- "\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4" \
- "\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4" \
- "\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4" \
- "\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184" \
- "\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264" \
- "\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344" \
- "\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424" \
- "\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504" \
- "\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4" \
- "\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4" \
- "\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788" \
- "][\u11A8-\u11C2]" \
- "|#{'' # decomposed Hangul syllables
- }" \
- "[\u1100-\u1112][\u1161-\u1175][\u11A8-\u11C2]?"
- REGEXP_K_STRING = "" \
- "[\u00A0\u00A8\u00AA\u00AF\u00B2-\u00B5\u00B8-\u00BA\u00BC-\u00BE\u0132\u0133" \
- "\u013F\u0140\u0149\u017F\u01C4-\u01CC\u01F1-\u01F3\u02B0-\u02B8\u02D8-\u02DD\u02E0-\u02E4" \
- "\u037A\u0384\u0385\u03D0-\u03D6\u03F0-\u03F2\u03F4\u03F5\u03F9\u0587\u0675-\u0678" \
- "\u0E33\u0EB3\u0EDC\u0EDD\u0F0C\u0F77\u0F79\u10FC\u1D2C-\u1D2E" \
- "\u1D30-\u1D3A\u1D3C-\u1D4D\u1D4F-\u1D6A\u1D78\u1D9B-\u1DBF\u1E9A\u1E9B\u1FBD\u1FBF-\u1FC1" \
- "\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED\u1FEE\u1FFD\u1FFE\u2000-\u200A\u2011\u2017\u2024-\u2026" \
- "\u202F\u2033\u2034\u2036\u2037\u203C\u203E\u2047-\u2049\u2057\u205F" \
- "\u2070\u2071\u2074-\u208E\u2090-\u209C\u20A8\u2100-\u2103\u2105-\u2107\u2109-\u2113\u2115\u2116" \
- "\u2119-\u211D\u2120-\u2122\u2124\u2128\u212C\u212D\u212F-\u2131\u2133-\u2139\u213B-\u2140" \
- "\u2145-\u2149\u2150-\u217F\u2189\u222C\u222D\u222F\u2230\u2460-\u24EA\u2A0C\u2A74-\u2A76" \
- "\u2C7C\u2C7D\u2D6F\u2E9F\u2EF3\u2F00-\u2FD5\u3000\u3036\u3038-\u303A" \
- "\u309B\u309C\u309F\u30FF\u3131-\u318E\u3192-\u319F\u3200-\u321E\u3220-\u3247\u3250-\u327E" \
- "\u3280-\u32FE\u3300-\u33FF\uA69C\uA69D\uA770\uA7F8\uA7F9\uAB5C-\uAB5F\uFB00-\uFB06\uFB13-\uFB17" \
- "\uFB20-\uFB29\uFB4F-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE10-\uFE19\uFE30-\uFE44" \
- "\uFE47-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFE70-\uFE72\uFE74\uFE76-\uFEFC\uFF01-\uFFBE\uFFC2-\uFFC7" \
- "\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE0-\uFFE6\uFFE8-\uFFEE\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}" \
- "\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}" \
- "\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}" \
- "\u{1D6A8}-\u{1D7CB}\u{1D7CE}-\u{1D7FF}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}" \
- "\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}" \
- "\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}" \
- "\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}" \
- "\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1F100}-\u{1F10A}\u{1F110}-\u{1F12E}\u{1F130}-\u{1F14F}\u{1F16A}\u{1F16B}\u{1F190}" \
- "\u{1F200}-\u{1F202}\u{1F210}-\u{1F23A}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}" \
- "]"
-
- class_table = {
- "\u0300"=>230, "\u0301"=>230, "\u0302"=>230, "\u0303"=>230, "\u0304"=>230, "\u0305"=>230, "\u0306"=>230, "\u0307"=>230,
- "\u0308"=>230, "\u0309"=>230, "\u030A"=>230, "\u030B"=>230, "\u030C"=>230, "\u030D"=>230, "\u030E"=>230, "\u030F"=>230,
- "\u0310"=>230, "\u0311"=>230, "\u0312"=>230, "\u0313"=>230, "\u0314"=>230, "\u0315"=>232, "\u0316"=>220, "\u0317"=>220,
- "\u0318"=>220, "\u0319"=>220, "\u031A"=>232, "\u031B"=>216, "\u031C"=>220, "\u031D"=>220, "\u031E"=>220, "\u031F"=>220,
- "\u0320"=>220, "\u0321"=>202, "\u0322"=>202, "\u0323"=>220, "\u0324"=>220, "\u0325"=>220, "\u0326"=>220, "\u0327"=>202,
- "\u0328"=>202, "\u0329"=>220, "\u032A"=>220, "\u032B"=>220, "\u032C"=>220, "\u032D"=>220, "\u032E"=>220, "\u032F"=>220,
- "\u0330"=>220, "\u0331"=>220, "\u0332"=>220, "\u0333"=>220, "\u0334"=>1, "\u0335"=>1, "\u0336"=>1, "\u0337"=>1,
- "\u0338"=>1, "\u0339"=>220, "\u033A"=>220, "\u033B"=>220, "\u033C"=>220, "\u033D"=>230, "\u033E"=>230, "\u033F"=>230,
- "\u0340"=>230, "\u0341"=>230, "\u0342"=>230, "\u0343"=>230, "\u0344"=>230, "\u0345"=>240, "\u0346"=>230, "\u0347"=>220,
- "\u0348"=>220, "\u0349"=>220, "\u034A"=>230, "\u034B"=>230, "\u034C"=>230, "\u034D"=>220, "\u034E"=>220, "\u0350"=>230,
- "\u0351"=>230, "\u0352"=>230, "\u0353"=>220, "\u0354"=>220, "\u0355"=>220, "\u0356"=>220, "\u0357"=>230, "\u0358"=>232,
- "\u0359"=>220, "\u035A"=>220, "\u035B"=>230, "\u035C"=>233, "\u035D"=>234, "\u035E"=>234, "\u035F"=>233, "\u0360"=>234,
- "\u0361"=>234, "\u0362"=>233, "\u0363"=>230, "\u0364"=>230, "\u0365"=>230, "\u0366"=>230, "\u0367"=>230, "\u0368"=>230,
- "\u0369"=>230, "\u036A"=>230, "\u036B"=>230, "\u036C"=>230, "\u036D"=>230, "\u036E"=>230, "\u036F"=>230, "\u0483"=>230,
- "\u0484"=>230, "\u0485"=>230, "\u0486"=>230, "\u0487"=>230, "\u0591"=>220, "\u0592"=>230, "\u0593"=>230, "\u0594"=>230,
- "\u0595"=>230, "\u0596"=>220, "\u0597"=>230, "\u0598"=>230, "\u0599"=>230, "\u059A"=>222, "\u059B"=>220, "\u059C"=>230,
- "\u059D"=>230, "\u059E"=>230, "\u059F"=>230, "\u05A0"=>230, "\u05A1"=>230, "\u05A2"=>220, "\u05A3"=>220, "\u05A4"=>220,
- "\u05A5"=>220, "\u05A6"=>220, "\u05A7"=>220, "\u05A8"=>230, "\u05A9"=>230, "\u05AA"=>220, "\u05AB"=>230, "\u05AC"=>230,
- "\u05AD"=>222, "\u05AE"=>228, "\u05AF"=>230, "\u05B0"=>10, "\u05B1"=>11, "\u05B2"=>12, "\u05B3"=>13, "\u05B4"=>14,
- "\u05B5"=>15, "\u05B6"=>16, "\u05B7"=>17, "\u05B8"=>18, "\u05B9"=>19, "\u05BA"=>19, "\u05BB"=>20, "\u05BC"=>21,
- "\u05BD"=>22, "\u05BF"=>23, "\u05C1"=>24, "\u05C2"=>25, "\u05C4"=>230, "\u05C5"=>220, "\u05C7"=>18, "\u0610"=>230,
- "\u0611"=>230, "\u0612"=>230, "\u0613"=>230, "\u0614"=>230, "\u0615"=>230, "\u0616"=>230, "\u0617"=>230, "\u0618"=>30,
- "\u0619"=>31, "\u061A"=>32, "\u064B"=>27, "\u064C"=>28, "\u064D"=>29, "\u064E"=>30, "\u064F"=>31, "\u0650"=>32,
- "\u0651"=>33, "\u0652"=>34, "\u0653"=>230, "\u0654"=>230, "\u0655"=>220, "\u0656"=>220, "\u0657"=>230, "\u0658"=>230,
- "\u0659"=>230, "\u065A"=>230, "\u065B"=>230, "\u065C"=>220, "\u065D"=>230, "\u065E"=>230, "\u065F"=>220, "\u0670"=>35,
- "\u06D6"=>230, "\u06D7"=>230, "\u06D8"=>230, "\u06D9"=>230, "\u06DA"=>230, "\u06DB"=>230, "\u06DC"=>230, "\u06DF"=>230,
- "\u06E0"=>230, "\u06E1"=>230, "\u06E2"=>230, "\u06E3"=>220, "\u06E4"=>230, "\u06E7"=>230, "\u06E8"=>230, "\u06EA"=>220,
- "\u06EB"=>230, "\u06EC"=>230, "\u06ED"=>220, "\u0711"=>36, "\u0730"=>230, "\u0731"=>220, "\u0732"=>230, "\u0733"=>230,
- "\u0734"=>220, "\u0735"=>230, "\u0736"=>230, "\u0737"=>220, "\u0738"=>220, "\u0739"=>220, "\u073A"=>230, "\u073B"=>220,
- "\u073C"=>220, "\u073D"=>230, "\u073E"=>220, "\u073F"=>230, "\u0740"=>230, "\u0741"=>230, "\u0742"=>220, "\u0743"=>230,
- "\u0744"=>220, "\u0745"=>230, "\u0746"=>220, "\u0747"=>230, "\u0748"=>220, "\u0749"=>230, "\u074A"=>230, "\u07EB"=>230,
- "\u07EC"=>230, "\u07ED"=>230, "\u07EE"=>230, "\u07EF"=>230, "\u07F0"=>230, "\u07F1"=>230, "\u07F2"=>220, "\u07F3"=>230,
- "\u0816"=>230, "\u0817"=>230, "\u0818"=>230, "\u0819"=>230, "\u081B"=>230, "\u081C"=>230, "\u081D"=>230, "\u081E"=>230,
- "\u081F"=>230, "\u0820"=>230, "\u0821"=>230, "\u0822"=>230, "\u0823"=>230, "\u0825"=>230, "\u0826"=>230, "\u0827"=>230,
- "\u0829"=>230, "\u082A"=>230, "\u082B"=>230, "\u082C"=>230, "\u082D"=>230, "\u0859"=>220, "\u085A"=>220, "\u085B"=>220,
- "\u08E3"=>220, "\u08E4"=>230, "\u08E5"=>230, "\u08E6"=>220, "\u08E7"=>230, "\u08E8"=>230, "\u08E9"=>220, "\u08EA"=>230,
- "\u08EB"=>230, "\u08EC"=>230, "\u08ED"=>220, "\u08EE"=>220, "\u08EF"=>220, "\u08F0"=>27, "\u08F1"=>28, "\u08F2"=>29,
- "\u08F3"=>230, "\u08F4"=>230, "\u08F5"=>230, "\u08F6"=>220, "\u08F7"=>230, "\u08F8"=>230, "\u08F9"=>220, "\u08FA"=>220,
- "\u08FB"=>230, "\u08FC"=>230, "\u08FD"=>230, "\u08FE"=>230, "\u08FF"=>230, "\u093C"=>7, "\u094D"=>9, "\u0951"=>230,
- "\u0952"=>220, "\u0953"=>230, "\u0954"=>230, "\u09BC"=>7, "\u09CD"=>9, "\u0A3C"=>7, "\u0A4D"=>9, "\u0ABC"=>7,
- "\u0ACD"=>9, "\u0B3C"=>7, "\u0B4D"=>9, "\u0BCD"=>9, "\u0C4D"=>9, "\u0C55"=>84, "\u0C56"=>91, "\u0CBC"=>7,
- "\u0CCD"=>9, "\u0D4D"=>9, "\u0DCA"=>9, "\u0E38"=>103, "\u0E39"=>103, "\u0E3A"=>9, "\u0E48"=>107, "\u0E49"=>107,
- "\u0E4A"=>107, "\u0E4B"=>107, "\u0EB8"=>118, "\u0EB9"=>118, "\u0EC8"=>122, "\u0EC9"=>122, "\u0ECA"=>122, "\u0ECB"=>122,
- "\u0F18"=>220, "\u0F19"=>220, "\u0F35"=>220, "\u0F37"=>220, "\u0F39"=>216, "\u0F71"=>129, "\u0F72"=>130, "\u0F74"=>132,
- "\u0F7A"=>130, "\u0F7B"=>130, "\u0F7C"=>130, "\u0F7D"=>130, "\u0F80"=>130, "\u0F82"=>230, "\u0F83"=>230, "\u0F84"=>9,
- "\u0F86"=>230, "\u0F87"=>230, "\u0FC6"=>220, "\u1037"=>7, "\u1039"=>9, "\u103A"=>9, "\u108D"=>220, "\u135D"=>230,
- "\u135E"=>230, "\u135F"=>230, "\u1714"=>9, "\u1734"=>9, "\u17D2"=>9, "\u17DD"=>230, "\u18A9"=>228, "\u1939"=>222,
- "\u193A"=>230, "\u193B"=>220, "\u1A17"=>230, "\u1A18"=>220, "\u1A60"=>9, "\u1A75"=>230, "\u1A76"=>230, "\u1A77"=>230,
- "\u1A78"=>230, "\u1A79"=>230, "\u1A7A"=>230, "\u1A7B"=>230, "\u1A7C"=>230, "\u1A7F"=>220, "\u1AB0"=>230, "\u1AB1"=>230,
- "\u1AB2"=>230, "\u1AB3"=>230, "\u1AB4"=>230, "\u1AB5"=>220, "\u1AB6"=>220, "\u1AB7"=>220, "\u1AB8"=>220, "\u1AB9"=>220,
- "\u1ABA"=>220, "\u1ABB"=>230, "\u1ABC"=>230, "\u1ABD"=>220, "\u1B34"=>7, "\u1B44"=>9, "\u1B6B"=>230, "\u1B6C"=>220,
- "\u1B6D"=>230, "\u1B6E"=>230, "\u1B6F"=>230, "\u1B70"=>230, "\u1B71"=>230, "\u1B72"=>230, "\u1B73"=>230, "\u1BAA"=>9,
- "\u1BAB"=>9, "\u1BE6"=>7, "\u1BF2"=>9, "\u1BF3"=>9, "\u1C37"=>7, "\u1CD0"=>230, "\u1CD1"=>230, "\u1CD2"=>230,
- "\u1CD4"=>1, "\u1CD5"=>220, "\u1CD6"=>220, "\u1CD7"=>220, "\u1CD8"=>220, "\u1CD9"=>220, "\u1CDA"=>230, "\u1CDB"=>230,
- "\u1CDC"=>220, "\u1CDD"=>220, "\u1CDE"=>220, "\u1CDF"=>220, "\u1CE0"=>230, "\u1CE2"=>1, "\u1CE3"=>1, "\u1CE4"=>1,
- "\u1CE5"=>1, "\u1CE6"=>1, "\u1CE7"=>1, "\u1CE8"=>1, "\u1CED"=>220, "\u1CF4"=>230, "\u1CF8"=>230, "\u1CF9"=>230,
- "\u1DC0"=>230, "\u1DC1"=>230, "\u1DC2"=>220, "\u1DC3"=>230, "\u1DC4"=>230, "\u1DC5"=>230, "\u1DC6"=>230, "\u1DC7"=>230,
- "\u1DC8"=>230, "\u1DC9"=>230, "\u1DCA"=>220, "\u1DCB"=>230, "\u1DCC"=>230, "\u1DCD"=>234, "\u1DCE"=>214, "\u1DCF"=>220,
- "\u1DD0"=>202, "\u1DD1"=>230, "\u1DD2"=>230, "\u1DD3"=>230, "\u1DD4"=>230, "\u1DD5"=>230, "\u1DD6"=>230, "\u1DD7"=>230,
- "\u1DD8"=>230, "\u1DD9"=>230, "\u1DDA"=>230, "\u1DDB"=>230, "\u1DDC"=>230, "\u1DDD"=>230, "\u1DDE"=>230, "\u1DDF"=>230,
- "\u1DE0"=>230, "\u1DE1"=>230, "\u1DE2"=>230, "\u1DE3"=>230, "\u1DE4"=>230, "\u1DE5"=>230, "\u1DE6"=>230, "\u1DE7"=>230,
- "\u1DE8"=>230, "\u1DE9"=>230, "\u1DEA"=>230, "\u1DEB"=>230, "\u1DEC"=>230, "\u1DED"=>230, "\u1DEE"=>230, "\u1DEF"=>230,
- "\u1DF0"=>230, "\u1DF1"=>230, "\u1DF2"=>230, "\u1DF3"=>230, "\u1DF4"=>230, "\u1DF5"=>230, "\u1DFC"=>233, "\u1DFD"=>220,
- "\u1DFE"=>230, "\u1DFF"=>220, "\u20D0"=>230, "\u20D1"=>230, "\u20D2"=>1, "\u20D3"=>1, "\u20D4"=>230, "\u20D5"=>230,
- "\u20D6"=>230, "\u20D7"=>230, "\u20D8"=>1, "\u20D9"=>1, "\u20DA"=>1, "\u20DB"=>230, "\u20DC"=>230, "\u20E1"=>230,
- "\u20E5"=>1, "\u20E6"=>1, "\u20E7"=>230, "\u20E8"=>220, "\u20E9"=>230, "\u20EA"=>1, "\u20EB"=>1, "\u20EC"=>220,
- "\u20ED"=>220, "\u20EE"=>220, "\u20EF"=>220, "\u20F0"=>230, "\u2CEF"=>230, "\u2CF0"=>230, "\u2CF1"=>230, "\u2D7F"=>9,
- "\u2DE0"=>230, "\u2DE1"=>230, "\u2DE2"=>230, "\u2DE3"=>230, "\u2DE4"=>230, "\u2DE5"=>230, "\u2DE6"=>230, "\u2DE7"=>230,
- "\u2DE8"=>230, "\u2DE9"=>230, "\u2DEA"=>230, "\u2DEB"=>230, "\u2DEC"=>230, "\u2DED"=>230, "\u2DEE"=>230, "\u2DEF"=>230,
- "\u2DF0"=>230, "\u2DF1"=>230, "\u2DF2"=>230, "\u2DF3"=>230, "\u2DF4"=>230, "\u2DF5"=>230, "\u2DF6"=>230, "\u2DF7"=>230,
- "\u2DF8"=>230, "\u2DF9"=>230, "\u2DFA"=>230, "\u2DFB"=>230, "\u2DFC"=>230, "\u2DFD"=>230, "\u2DFE"=>230, "\u2DFF"=>230,
- "\u302A"=>218, "\u302B"=>228, "\u302C"=>232, "\u302D"=>222, "\u302E"=>224, "\u302F"=>224, "\u3099"=>8, "\u309A"=>8,
- "\uA66F"=>230, "\uA674"=>230, "\uA675"=>230, "\uA676"=>230, "\uA677"=>230, "\uA678"=>230, "\uA679"=>230, "\uA67A"=>230,
- "\uA67B"=>230, "\uA67C"=>230, "\uA67D"=>230, "\uA69E"=>230, "\uA69F"=>230, "\uA6F0"=>230, "\uA6F1"=>230, "\uA806"=>9,
- "\uA8C4"=>9, "\uA8E0"=>230, "\uA8E1"=>230, "\uA8E2"=>230, "\uA8E3"=>230, "\uA8E4"=>230, "\uA8E5"=>230, "\uA8E6"=>230,
- "\uA8E7"=>230, "\uA8E8"=>230, "\uA8E9"=>230, "\uA8EA"=>230, "\uA8EB"=>230, "\uA8EC"=>230, "\uA8ED"=>230, "\uA8EE"=>230,
- "\uA8EF"=>230, "\uA8F0"=>230, "\uA8F1"=>230, "\uA92B"=>220, "\uA92C"=>220, "\uA92D"=>220, "\uA953"=>9, "\uA9B3"=>7,
- "\uA9C0"=>9, "\uAAB0"=>230, "\uAAB2"=>230, "\uAAB3"=>230, "\uAAB4"=>220, "\uAAB7"=>230, "\uAAB8"=>230, "\uAABE"=>230,
- "\uAABF"=>230, "\uAAC1"=>230, "\uAAF6"=>9, "\uABED"=>9, "\uFB1E"=>26, "\uFE20"=>230, "\uFE21"=>230, "\uFE22"=>230,
- "\uFE23"=>230, "\uFE24"=>230, "\uFE25"=>230, "\uFE26"=>230, "\uFE27"=>220, "\uFE28"=>220, "\uFE29"=>220, "\uFE2A"=>220,
- "\uFE2B"=>220, "\uFE2C"=>220, "\uFE2D"=>220, "\uFE2E"=>230, "\uFE2F"=>230, "\u{101FD}"=>220, "\u{102E0}"=>220, "\u{10376}"=>230,
- "\u{10377}"=>230, "\u{10378}"=>230, "\u{10379}"=>230, "\u{1037A}"=>230, "\u{10A0D}"=>220, "\u{10A0F}"=>230, "\u{10A38}"=>230, "\u{10A39}"=>1,
- "\u{10A3A}"=>220, "\u{10A3F}"=>9, "\u{10AE5}"=>230, "\u{10AE6}"=>220, "\u{11046}"=>9, "\u{1107F}"=>9, "\u{110B9}"=>9, "\u{110BA}"=>7,
- "\u{11100}"=>230, "\u{11101}"=>230, "\u{11102}"=>230, "\u{11133}"=>9, "\u{11134}"=>9, "\u{11173}"=>7, "\u{111C0}"=>9, "\u{111CA}"=>7,
- "\u{11235}"=>9, "\u{11236}"=>7, "\u{112E9}"=>7, "\u{112EA}"=>9, "\u{1133C}"=>7, "\u{1134D}"=>9, "\u{11366}"=>230, "\u{11367}"=>230,
- "\u{11368}"=>230, "\u{11369}"=>230, "\u{1136A}"=>230, "\u{1136B}"=>230, "\u{1136C}"=>230, "\u{11370}"=>230, "\u{11371}"=>230, "\u{11372}"=>230,
- "\u{11373}"=>230, "\u{11374}"=>230, "\u{114C2}"=>9, "\u{114C3}"=>7, "\u{115BF}"=>9, "\u{115C0}"=>7, "\u{1163F}"=>9, "\u{116B6}"=>9,
- "\u{116B7}"=>7, "\u{1172B}"=>9, "\u{16AF0}"=>1, "\u{16AF1}"=>1, "\u{16AF2}"=>1, "\u{16AF3}"=>1, "\u{16AF4}"=>1, "\u{16B30}"=>230,
- "\u{16B31}"=>230, "\u{16B32}"=>230, "\u{16B33}"=>230, "\u{16B34}"=>230, "\u{16B35}"=>230, "\u{16B36}"=>230, "\u{1BC9E}"=>1, "\u{1D165}"=>216,
- "\u{1D166}"=>216, "\u{1D167}"=>1, "\u{1D168}"=>1, "\u{1D169}"=>1, "\u{1D16D}"=>226, "\u{1D16E}"=>216, "\u{1D16F}"=>216, "\u{1D170}"=>216,
- "\u{1D171}"=>216, "\u{1D172}"=>216, "\u{1D17B}"=>220, "\u{1D17C}"=>220, "\u{1D17D}"=>220, "\u{1D17E}"=>220, "\u{1D17F}"=>220, "\u{1D180}"=>220,
- "\u{1D181}"=>220, "\u{1D182}"=>220, "\u{1D185}"=>230, "\u{1D186}"=>230, "\u{1D187}"=>230, "\u{1D188}"=>230, "\u{1D189}"=>230, "\u{1D18A}"=>220,
- "\u{1D18B}"=>220, "\u{1D1AA}"=>230, "\u{1D1AB}"=>230, "\u{1D1AC}"=>230, "\u{1D1AD}"=>230, "\u{1D242}"=>230, "\u{1D243}"=>230, "\u{1D244}"=>230,
- "\u{1E8D0}"=>220, "\u{1E8D1}"=>220, "\u{1E8D2}"=>220, "\u{1E8D3}"=>220, "\u{1E8D4}"=>220, "\u{1E8D5}"=>220, "\u{1E8D6}"=>220,
- }
- class_table.default = 0
- CLASS_TABLE = class_table.freeze
-
- DECOMPOSITION_TABLE = {
- "\u00C0"=>"A\u0300", "\u00C1"=>"A\u0301", "\u00C2"=>"A\u0302", "\u00C3"=>"A\u0303", "\u00C4"=>"A\u0308", "\u00C5"=>"A\u030A", "\u00C7"=>"C\u0327", "\u00C8"=>"E\u0300",
- "\u00C9"=>"E\u0301", "\u00CA"=>"E\u0302", "\u00CB"=>"E\u0308", "\u00CC"=>"I\u0300", "\u00CD"=>"I\u0301", "\u00CE"=>"I\u0302", "\u00CF"=>"I\u0308", "\u00D1"=>"N\u0303",
- "\u00D2"=>"O\u0300", "\u00D3"=>"O\u0301", "\u00D4"=>"O\u0302", "\u00D5"=>"O\u0303", "\u00D6"=>"O\u0308", "\u00D9"=>"U\u0300", "\u00DA"=>"U\u0301", "\u00DB"=>"U\u0302",
- "\u00DC"=>"U\u0308", "\u00DD"=>"Y\u0301", "\u00E0"=>"a\u0300", "\u00E1"=>"a\u0301", "\u00E2"=>"a\u0302", "\u00E3"=>"a\u0303", "\u00E4"=>"a\u0308", "\u00E5"=>"a\u030A",
- "\u00E7"=>"c\u0327", "\u00E8"=>"e\u0300", "\u00E9"=>"e\u0301", "\u00EA"=>"e\u0302", "\u00EB"=>"e\u0308", "\u00EC"=>"i\u0300", "\u00ED"=>"i\u0301", "\u00EE"=>"i\u0302",
- "\u00EF"=>"i\u0308", "\u00F1"=>"n\u0303", "\u00F2"=>"o\u0300", "\u00F3"=>"o\u0301", "\u00F4"=>"o\u0302", "\u00F5"=>"o\u0303", "\u00F6"=>"o\u0308", "\u00F9"=>"u\u0300",
- "\u00FA"=>"u\u0301", "\u00FB"=>"u\u0302", "\u00FC"=>"u\u0308", "\u00FD"=>"y\u0301", "\u00FF"=>"y\u0308", "\u0100"=>"A\u0304", "\u0101"=>"a\u0304", "\u0102"=>"A\u0306",
- "\u0103"=>"a\u0306", "\u0104"=>"A\u0328", "\u0105"=>"a\u0328", "\u0106"=>"C\u0301", "\u0107"=>"c\u0301", "\u0108"=>"C\u0302", "\u0109"=>"c\u0302", "\u010A"=>"C\u0307",
- "\u010B"=>"c\u0307", "\u010C"=>"C\u030C", "\u010D"=>"c\u030C", "\u010E"=>"D\u030C", "\u010F"=>"d\u030C", "\u0112"=>"E\u0304", "\u0113"=>"e\u0304", "\u0114"=>"E\u0306",
- "\u0115"=>"e\u0306", "\u0116"=>"E\u0307", "\u0117"=>"e\u0307", "\u0118"=>"E\u0328", "\u0119"=>"e\u0328", "\u011A"=>"E\u030C", "\u011B"=>"e\u030C", "\u011C"=>"G\u0302",
- "\u011D"=>"g\u0302", "\u011E"=>"G\u0306", "\u011F"=>"g\u0306", "\u0120"=>"G\u0307", "\u0121"=>"g\u0307", "\u0122"=>"G\u0327", "\u0123"=>"g\u0327", "\u0124"=>"H\u0302",
- "\u0125"=>"h\u0302", "\u0128"=>"I\u0303", "\u0129"=>"i\u0303", "\u012A"=>"I\u0304", "\u012B"=>"i\u0304", "\u012C"=>"I\u0306", "\u012D"=>"i\u0306", "\u012E"=>"I\u0328",
- "\u012F"=>"i\u0328", "\u0130"=>"I\u0307", "\u0134"=>"J\u0302", "\u0135"=>"j\u0302", "\u0136"=>"K\u0327", "\u0137"=>"k\u0327", "\u0139"=>"L\u0301", "\u013A"=>"l\u0301",
- "\u013B"=>"L\u0327", "\u013C"=>"l\u0327", "\u013D"=>"L\u030C", "\u013E"=>"l\u030C", "\u0143"=>"N\u0301", "\u0144"=>"n\u0301", "\u0145"=>"N\u0327", "\u0146"=>"n\u0327",
- "\u0147"=>"N\u030C", "\u0148"=>"n\u030C", "\u014C"=>"O\u0304", "\u014D"=>"o\u0304", "\u014E"=>"O\u0306", "\u014F"=>"o\u0306", "\u0150"=>"O\u030B", "\u0151"=>"o\u030B",
- "\u0154"=>"R\u0301", "\u0155"=>"r\u0301", "\u0156"=>"R\u0327", "\u0157"=>"r\u0327", "\u0158"=>"R\u030C", "\u0159"=>"r\u030C", "\u015A"=>"S\u0301", "\u015B"=>"s\u0301",
- "\u015C"=>"S\u0302", "\u015D"=>"s\u0302", "\u015E"=>"S\u0327", "\u015F"=>"s\u0327", "\u0160"=>"S\u030C", "\u0161"=>"s\u030C", "\u0162"=>"T\u0327", "\u0163"=>"t\u0327",
- "\u0164"=>"T\u030C", "\u0165"=>"t\u030C", "\u0168"=>"U\u0303", "\u0169"=>"u\u0303", "\u016A"=>"U\u0304", "\u016B"=>"u\u0304", "\u016C"=>"U\u0306", "\u016D"=>"u\u0306",
- "\u016E"=>"U\u030A", "\u016F"=>"u\u030A", "\u0170"=>"U\u030B", "\u0171"=>"u\u030B", "\u0172"=>"U\u0328", "\u0173"=>"u\u0328", "\u0174"=>"W\u0302", "\u0175"=>"w\u0302",
- "\u0176"=>"Y\u0302", "\u0177"=>"y\u0302", "\u0178"=>"Y\u0308", "\u0179"=>"Z\u0301", "\u017A"=>"z\u0301", "\u017B"=>"Z\u0307", "\u017C"=>"z\u0307", "\u017D"=>"Z\u030C",
- "\u017E"=>"z\u030C", "\u01A0"=>"O\u031B", "\u01A1"=>"o\u031B", "\u01AF"=>"U\u031B", "\u01B0"=>"u\u031B", "\u01CD"=>"A\u030C", "\u01CE"=>"a\u030C", "\u01CF"=>"I\u030C",
- "\u01D0"=>"i\u030C", "\u01D1"=>"O\u030C", "\u01D2"=>"o\u030C", "\u01D3"=>"U\u030C", "\u01D4"=>"u\u030C", "\u01D5"=>"U\u0308\u0304", "\u01D6"=>"u\u0308\u0304", "\u01D7"=>"U\u0308\u0301",
- "\u01D8"=>"u\u0308\u0301", "\u01D9"=>"U\u0308\u030C", "\u01DA"=>"u\u0308\u030C", "\u01DB"=>"U\u0308\u0300", "\u01DC"=>"u\u0308\u0300", "\u01DE"=>"A\u0308\u0304", "\u01DF"=>"a\u0308\u0304", "\u01E0"=>"A\u0307\u0304",
- "\u01E1"=>"a\u0307\u0304", "\u01E2"=>"\u00C6\u0304", "\u01E3"=>"\u00E6\u0304", "\u01E6"=>"G\u030C", "\u01E7"=>"g\u030C", "\u01E8"=>"K\u030C", "\u01E9"=>"k\u030C", "\u01EA"=>"O\u0328",
- "\u01EB"=>"o\u0328", "\u01EC"=>"O\u0328\u0304", "\u01ED"=>"o\u0328\u0304", "\u01EE"=>"\u01B7\u030C", "\u01EF"=>"\u0292\u030C", "\u01F0"=>"j\u030C", "\u01F4"=>"G\u0301", "\u01F5"=>"g\u0301",
- "\u01F8"=>"N\u0300", "\u01F9"=>"n\u0300", "\u01FA"=>"A\u030A\u0301", "\u01FB"=>"a\u030A\u0301", "\u01FC"=>"\u00C6\u0301", "\u01FD"=>"\u00E6\u0301", "\u01FE"=>"\u00D8\u0301", "\u01FF"=>"\u00F8\u0301",
- "\u0200"=>"A\u030F", "\u0201"=>"a\u030F", "\u0202"=>"A\u0311", "\u0203"=>"a\u0311", "\u0204"=>"E\u030F", "\u0205"=>"e\u030F", "\u0206"=>"E\u0311", "\u0207"=>"e\u0311",
- "\u0208"=>"I\u030F", "\u0209"=>"i\u030F", "\u020A"=>"I\u0311", "\u020B"=>"i\u0311", "\u020C"=>"O\u030F", "\u020D"=>"o\u030F", "\u020E"=>"O\u0311", "\u020F"=>"o\u0311",
- "\u0210"=>"R\u030F", "\u0211"=>"r\u030F", "\u0212"=>"R\u0311", "\u0213"=>"r\u0311", "\u0214"=>"U\u030F", "\u0215"=>"u\u030F", "\u0216"=>"U\u0311", "\u0217"=>"u\u0311",
- "\u0218"=>"S\u0326", "\u0219"=>"s\u0326", "\u021A"=>"T\u0326", "\u021B"=>"t\u0326", "\u021E"=>"H\u030C", "\u021F"=>"h\u030C", "\u0226"=>"A\u0307", "\u0227"=>"a\u0307",
- "\u0228"=>"E\u0327", "\u0229"=>"e\u0327", "\u022A"=>"O\u0308\u0304", "\u022B"=>"o\u0308\u0304", "\u022C"=>"O\u0303\u0304", "\u022D"=>"o\u0303\u0304", "\u022E"=>"O\u0307", "\u022F"=>"o\u0307",
- "\u0230"=>"O\u0307\u0304", "\u0231"=>"o\u0307\u0304", "\u0232"=>"Y\u0304", "\u0233"=>"y\u0304", "\u0340"=>"\u0300", "\u0341"=>"\u0301", "\u0343"=>"\u0313", "\u0344"=>"\u0308\u0301",
- "\u0374"=>"\u02B9", "\u037E"=>";", "\u0385"=>"\u00A8\u0301", "\u0386"=>"\u0391\u0301", "\u0387"=>"\u00B7", "\u0388"=>"\u0395\u0301", "\u0389"=>"\u0397\u0301", "\u038A"=>"\u0399\u0301",
- "\u038C"=>"\u039F\u0301", "\u038E"=>"\u03A5\u0301", "\u038F"=>"\u03A9\u0301", "\u0390"=>"\u03B9\u0308\u0301", "\u03AA"=>"\u0399\u0308", "\u03AB"=>"\u03A5\u0308", "\u03AC"=>"\u03B1\u0301", "\u03AD"=>"\u03B5\u0301",
- "\u03AE"=>"\u03B7\u0301", "\u03AF"=>"\u03B9\u0301", "\u03B0"=>"\u03C5\u0308\u0301", "\u03CA"=>"\u03B9\u0308", "\u03CB"=>"\u03C5\u0308", "\u03CC"=>"\u03BF\u0301", "\u03CD"=>"\u03C5\u0301", "\u03CE"=>"\u03C9\u0301",
- "\u03D3"=>"\u03D2\u0301", "\u03D4"=>"\u03D2\u0308", "\u0400"=>"\u0415\u0300", "\u0401"=>"\u0415\u0308", "\u0403"=>"\u0413\u0301", "\u0407"=>"\u0406\u0308", "\u040C"=>"\u041A\u0301", "\u040D"=>"\u0418\u0300",
- "\u040E"=>"\u0423\u0306", "\u0419"=>"\u0418\u0306", "\u0439"=>"\u0438\u0306", "\u0450"=>"\u0435\u0300", "\u0451"=>"\u0435\u0308", "\u0453"=>"\u0433\u0301", "\u0457"=>"\u0456\u0308", "\u045C"=>"\u043A\u0301",
- "\u045D"=>"\u0438\u0300", "\u045E"=>"\u0443\u0306", "\u0476"=>"\u0474\u030F", "\u0477"=>"\u0475\u030F", "\u04C1"=>"\u0416\u0306", "\u04C2"=>"\u0436\u0306", "\u04D0"=>"\u0410\u0306", "\u04D1"=>"\u0430\u0306",
- "\u04D2"=>"\u0410\u0308", "\u04D3"=>"\u0430\u0308", "\u04D6"=>"\u0415\u0306", "\u04D7"=>"\u0435\u0306", "\u04DA"=>"\u04D8\u0308", "\u04DB"=>"\u04D9\u0308", "\u04DC"=>"\u0416\u0308", "\u04DD"=>"\u0436\u0308",
- "\u04DE"=>"\u0417\u0308", "\u04DF"=>"\u0437\u0308", "\u04E2"=>"\u0418\u0304", "\u04E3"=>"\u0438\u0304", "\u04E4"=>"\u0418\u0308", "\u04E5"=>"\u0438\u0308", "\u04E6"=>"\u041E\u0308", "\u04E7"=>"\u043E\u0308",
- "\u04EA"=>"\u04E8\u0308", "\u04EB"=>"\u04E9\u0308", "\u04EC"=>"\u042D\u0308", "\u04ED"=>"\u044D\u0308", "\u04EE"=>"\u0423\u0304", "\u04EF"=>"\u0443\u0304", "\u04F0"=>"\u0423\u0308", "\u04F1"=>"\u0443\u0308",
- "\u04F2"=>"\u0423\u030B", "\u04F3"=>"\u0443\u030B", "\u04F4"=>"\u0427\u0308", "\u04F5"=>"\u0447\u0308", "\u04F8"=>"\u042B\u0308", "\u04F9"=>"\u044B\u0308", "\u0622"=>"\u0627\u0653", "\u0623"=>"\u0627\u0654",
- "\u0624"=>"\u0648\u0654", "\u0625"=>"\u0627\u0655", "\u0626"=>"\u064A\u0654", "\u06C0"=>"\u06D5\u0654", "\u06C2"=>"\u06C1\u0654", "\u06D3"=>"\u06D2\u0654", "\u0929"=>"\u0928\u093C", "\u0931"=>"\u0930\u093C",
- "\u0934"=>"\u0933\u093C", "\u0958"=>"\u0915\u093C", "\u0959"=>"\u0916\u093C", "\u095A"=>"\u0917\u093C", "\u095B"=>"\u091C\u093C", "\u095C"=>"\u0921\u093C", "\u095D"=>"\u0922\u093C", "\u095E"=>"\u092B\u093C",
- "\u095F"=>"\u092F\u093C", "\u09CB"=>"\u09C7\u09BE", "\u09CC"=>"\u09C7\u09D7", "\u09DC"=>"\u09A1\u09BC", "\u09DD"=>"\u09A2\u09BC", "\u09DF"=>"\u09AF\u09BC", "\u0A33"=>"\u0A32\u0A3C", "\u0A36"=>"\u0A38\u0A3C",
- "\u0A59"=>"\u0A16\u0A3C", "\u0A5A"=>"\u0A17\u0A3C", "\u0A5B"=>"\u0A1C\u0A3C", "\u0A5E"=>"\u0A2B\u0A3C", "\u0B48"=>"\u0B47\u0B56", "\u0B4B"=>"\u0B47\u0B3E", "\u0B4C"=>"\u0B47\u0B57", "\u0B5C"=>"\u0B21\u0B3C",
- "\u0B5D"=>"\u0B22\u0B3C", "\u0B94"=>"\u0B92\u0BD7", "\u0BCA"=>"\u0BC6\u0BBE", "\u0BCB"=>"\u0BC7\u0BBE", "\u0BCC"=>"\u0BC6\u0BD7", "\u0C48"=>"\u0C46\u0C56", "\u0CC0"=>"\u0CBF\u0CD5", "\u0CC7"=>"\u0CC6\u0CD5",
- "\u0CC8"=>"\u0CC6\u0CD6", "\u0CCA"=>"\u0CC6\u0CC2", "\u0CCB"=>"\u0CC6\u0CC2\u0CD5", "\u0D4A"=>"\u0D46\u0D3E", "\u0D4B"=>"\u0D47\u0D3E", "\u0D4C"=>"\u0D46\u0D57", "\u0DDA"=>"\u0DD9\u0DCA", "\u0DDC"=>"\u0DD9\u0DCF",
- "\u0DDD"=>"\u0DD9\u0DCF\u0DCA", "\u0DDE"=>"\u0DD9\u0DDF", "\u0F43"=>"\u0F42\u0FB7", "\u0F4D"=>"\u0F4C\u0FB7", "\u0F52"=>"\u0F51\u0FB7", "\u0F57"=>"\u0F56\u0FB7", "\u0F5C"=>"\u0F5B\u0FB7", "\u0F69"=>"\u0F40\u0FB5",
- "\u0F73"=>"\u0F71\u0F72", "\u0F75"=>"\u0F71\u0F74", "\u0F76"=>"\u0FB2\u0F80", "\u0F78"=>"\u0FB3\u0F80", "\u0F81"=>"\u0F71\u0F80", "\u0F93"=>"\u0F92\u0FB7", "\u0F9D"=>"\u0F9C\u0FB7", "\u0FA2"=>"\u0FA1\u0FB7",
- "\u0FA7"=>"\u0FA6\u0FB7", "\u0FAC"=>"\u0FAB\u0FB7", "\u0FB9"=>"\u0F90\u0FB5", "\u1026"=>"\u1025\u102E", "\u1B06"=>"\u1B05\u1B35", "\u1B08"=>"\u1B07\u1B35", "\u1B0A"=>"\u1B09\u1B35", "\u1B0C"=>"\u1B0B\u1B35",
- "\u1B0E"=>"\u1B0D\u1B35", "\u1B12"=>"\u1B11\u1B35", "\u1B3B"=>"\u1B3A\u1B35", "\u1B3D"=>"\u1B3C\u1B35", "\u1B40"=>"\u1B3E\u1B35", "\u1B41"=>"\u1B3F\u1B35", "\u1B43"=>"\u1B42\u1B35", "\u1E00"=>"A\u0325",
- "\u1E01"=>"a\u0325", "\u1E02"=>"B\u0307", "\u1E03"=>"b\u0307", "\u1E04"=>"B\u0323", "\u1E05"=>"b\u0323", "\u1E06"=>"B\u0331", "\u1E07"=>"b\u0331", "\u1E08"=>"C\u0327\u0301",
- "\u1E09"=>"c\u0327\u0301", "\u1E0A"=>"D\u0307", "\u1E0B"=>"d\u0307", "\u1E0C"=>"D\u0323", "\u1E0D"=>"d\u0323", "\u1E0E"=>"D\u0331", "\u1E0F"=>"d\u0331", "\u1E10"=>"D\u0327",
- "\u1E11"=>"d\u0327", "\u1E12"=>"D\u032D", "\u1E13"=>"d\u032D", "\u1E14"=>"E\u0304\u0300", "\u1E15"=>"e\u0304\u0300", "\u1E16"=>"E\u0304\u0301", "\u1E17"=>"e\u0304\u0301", "\u1E18"=>"E\u032D",
- "\u1E19"=>"e\u032D", "\u1E1A"=>"E\u0330", "\u1E1B"=>"e\u0330", "\u1E1C"=>"E\u0327\u0306", "\u1E1D"=>"e\u0327\u0306", "\u1E1E"=>"F\u0307", "\u1E1F"=>"f\u0307", "\u1E20"=>"G\u0304",
- "\u1E21"=>"g\u0304", "\u1E22"=>"H\u0307", "\u1E23"=>"h\u0307", "\u1E24"=>"H\u0323", "\u1E25"=>"h\u0323", "\u1E26"=>"H\u0308", "\u1E27"=>"h\u0308", "\u1E28"=>"H\u0327",
- "\u1E29"=>"h\u0327", "\u1E2A"=>"H\u032E", "\u1E2B"=>"h\u032E", "\u1E2C"=>"I\u0330", "\u1E2D"=>"i\u0330", "\u1E2E"=>"I\u0308\u0301", "\u1E2F"=>"i\u0308\u0301", "\u1E30"=>"K\u0301",
- "\u1E31"=>"k\u0301", "\u1E32"=>"K\u0323", "\u1E33"=>"k\u0323", "\u1E34"=>"K\u0331", "\u1E35"=>"k\u0331", "\u1E36"=>"L\u0323", "\u1E37"=>"l\u0323", "\u1E38"=>"L\u0323\u0304",
- "\u1E39"=>"l\u0323\u0304", "\u1E3A"=>"L\u0331", "\u1E3B"=>"l\u0331", "\u1E3C"=>"L\u032D", "\u1E3D"=>"l\u032D", "\u1E3E"=>"M\u0301", "\u1E3F"=>"m\u0301", "\u1E40"=>"M\u0307",
- "\u1E41"=>"m\u0307", "\u1E42"=>"M\u0323", "\u1E43"=>"m\u0323", "\u1E44"=>"N\u0307", "\u1E45"=>"n\u0307", "\u1E46"=>"N\u0323", "\u1E47"=>"n\u0323", "\u1E48"=>"N\u0331",
- "\u1E49"=>"n\u0331", "\u1E4A"=>"N\u032D", "\u1E4B"=>"n\u032D", "\u1E4C"=>"O\u0303\u0301", "\u1E4D"=>"o\u0303\u0301", "\u1E4E"=>"O\u0303\u0308", "\u1E4F"=>"o\u0303\u0308", "\u1E50"=>"O\u0304\u0300",
- "\u1E51"=>"o\u0304\u0300", "\u1E52"=>"O\u0304\u0301", "\u1E53"=>"o\u0304\u0301", "\u1E54"=>"P\u0301", "\u1E55"=>"p\u0301", "\u1E56"=>"P\u0307", "\u1E57"=>"p\u0307", "\u1E58"=>"R\u0307",
- "\u1E59"=>"r\u0307", "\u1E5A"=>"R\u0323", "\u1E5B"=>"r\u0323", "\u1E5C"=>"R\u0323\u0304", "\u1E5D"=>"r\u0323\u0304", "\u1E5E"=>"R\u0331", "\u1E5F"=>"r\u0331", "\u1E60"=>"S\u0307",
- "\u1E61"=>"s\u0307", "\u1E62"=>"S\u0323", "\u1E63"=>"s\u0323", "\u1E64"=>"S\u0301\u0307", "\u1E65"=>"s\u0301\u0307", "\u1E66"=>"S\u030C\u0307", "\u1E67"=>"s\u030C\u0307", "\u1E68"=>"S\u0323\u0307",
- "\u1E69"=>"s\u0323\u0307", "\u1E6A"=>"T\u0307", "\u1E6B"=>"t\u0307", "\u1E6C"=>"T\u0323", "\u1E6D"=>"t\u0323", "\u1E6E"=>"T\u0331", "\u1E6F"=>"t\u0331", "\u1E70"=>"T\u032D",
- "\u1E71"=>"t\u032D", "\u1E72"=>"U\u0324", "\u1E73"=>"u\u0324", "\u1E74"=>"U\u0330", "\u1E75"=>"u\u0330", "\u1E76"=>"U\u032D", "\u1E77"=>"u\u032D", "\u1E78"=>"U\u0303\u0301",
- "\u1E79"=>"u\u0303\u0301", "\u1E7A"=>"U\u0304\u0308", "\u1E7B"=>"u\u0304\u0308", "\u1E7C"=>"V\u0303", "\u1E7D"=>"v\u0303", "\u1E7E"=>"V\u0323", "\u1E7F"=>"v\u0323", "\u1E80"=>"W\u0300",
- "\u1E81"=>"w\u0300", "\u1E82"=>"W\u0301", "\u1E83"=>"w\u0301", "\u1E84"=>"W\u0308", "\u1E85"=>"w\u0308", "\u1E86"=>"W\u0307", "\u1E87"=>"w\u0307", "\u1E88"=>"W\u0323",
- "\u1E89"=>"w\u0323", "\u1E8A"=>"X\u0307", "\u1E8B"=>"x\u0307", "\u1E8C"=>"X\u0308", "\u1E8D"=>"x\u0308", "\u1E8E"=>"Y\u0307", "\u1E8F"=>"y\u0307", "\u1E90"=>"Z\u0302",
- "\u1E91"=>"z\u0302", "\u1E92"=>"Z\u0323", "\u1E93"=>"z\u0323", "\u1E94"=>"Z\u0331", "\u1E95"=>"z\u0331", "\u1E96"=>"h\u0331", "\u1E97"=>"t\u0308", "\u1E98"=>"w\u030A",
- "\u1E99"=>"y\u030A", "\u1E9B"=>"\u017F\u0307", "\u1EA0"=>"A\u0323", "\u1EA1"=>"a\u0323", "\u1EA2"=>"A\u0309", "\u1EA3"=>"a\u0309", "\u1EA4"=>"A\u0302\u0301", "\u1EA5"=>"a\u0302\u0301",
- "\u1EA6"=>"A\u0302\u0300", "\u1EA7"=>"a\u0302\u0300", "\u1EA8"=>"A\u0302\u0309", "\u1EA9"=>"a\u0302\u0309", "\u1EAA"=>"A\u0302\u0303", "\u1EAB"=>"a\u0302\u0303", "\u1EAC"=>"A\u0323\u0302", "\u1EAD"=>"a\u0323\u0302",
- "\u1EAE"=>"A\u0306\u0301", "\u1EAF"=>"a\u0306\u0301", "\u1EB0"=>"A\u0306\u0300", "\u1EB1"=>"a\u0306\u0300", "\u1EB2"=>"A\u0306\u0309", "\u1EB3"=>"a\u0306\u0309", "\u1EB4"=>"A\u0306\u0303", "\u1EB5"=>"a\u0306\u0303",
- "\u1EB6"=>"A\u0323\u0306", "\u1EB7"=>"a\u0323\u0306", "\u1EB8"=>"E\u0323", "\u1EB9"=>"e\u0323", "\u1EBA"=>"E\u0309", "\u1EBB"=>"e\u0309", "\u1EBC"=>"E\u0303", "\u1EBD"=>"e\u0303",
- "\u1EBE"=>"E\u0302\u0301", "\u1EBF"=>"e\u0302\u0301", "\u1EC0"=>"E\u0302\u0300", "\u1EC1"=>"e\u0302\u0300", "\u1EC2"=>"E\u0302\u0309", "\u1EC3"=>"e\u0302\u0309", "\u1EC4"=>"E\u0302\u0303", "\u1EC5"=>"e\u0302\u0303",
- "\u1EC6"=>"E\u0323\u0302", "\u1EC7"=>"e\u0323\u0302", "\u1EC8"=>"I\u0309", "\u1EC9"=>"i\u0309", "\u1ECA"=>"I\u0323", "\u1ECB"=>"i\u0323", "\u1ECC"=>"O\u0323", "\u1ECD"=>"o\u0323",
- "\u1ECE"=>"O\u0309", "\u1ECF"=>"o\u0309", "\u1ED0"=>"O\u0302\u0301", "\u1ED1"=>"o\u0302\u0301", "\u1ED2"=>"O\u0302\u0300", "\u1ED3"=>"o\u0302\u0300", "\u1ED4"=>"O\u0302\u0309", "\u1ED5"=>"o\u0302\u0309",
- "\u1ED6"=>"O\u0302\u0303", "\u1ED7"=>"o\u0302\u0303", "\u1ED8"=>"O\u0323\u0302", "\u1ED9"=>"o\u0323\u0302", "\u1EDA"=>"O\u031B\u0301", "\u1EDB"=>"o\u031B\u0301", "\u1EDC"=>"O\u031B\u0300", "\u1EDD"=>"o\u031B\u0300",
- "\u1EDE"=>"O\u031B\u0309", "\u1EDF"=>"o\u031B\u0309", "\u1EE0"=>"O\u031B\u0303", "\u1EE1"=>"o\u031B\u0303", "\u1EE2"=>"O\u031B\u0323", "\u1EE3"=>"o\u031B\u0323", "\u1EE4"=>"U\u0323", "\u1EE5"=>"u\u0323",
- "\u1EE6"=>"U\u0309", "\u1EE7"=>"u\u0309", "\u1EE8"=>"U\u031B\u0301", "\u1EE9"=>"u\u031B\u0301", "\u1EEA"=>"U\u031B\u0300", "\u1EEB"=>"u\u031B\u0300", "\u1EEC"=>"U\u031B\u0309", "\u1EED"=>"u\u031B\u0309",
- "\u1EEE"=>"U\u031B\u0303", "\u1EEF"=>"u\u031B\u0303", "\u1EF0"=>"U\u031B\u0323", "\u1EF1"=>"u\u031B\u0323", "\u1EF2"=>"Y\u0300", "\u1EF3"=>"y\u0300", "\u1EF4"=>"Y\u0323", "\u1EF5"=>"y\u0323",
- "\u1EF6"=>"Y\u0309", "\u1EF7"=>"y\u0309", "\u1EF8"=>"Y\u0303", "\u1EF9"=>"y\u0303", "\u1F00"=>"\u03B1\u0313", "\u1F01"=>"\u03B1\u0314", "\u1F02"=>"\u03B1\u0313\u0300", "\u1F03"=>"\u03B1\u0314\u0300",
- "\u1F04"=>"\u03B1\u0313\u0301", "\u1F05"=>"\u03B1\u0314\u0301", "\u1F06"=>"\u03B1\u0313\u0342", "\u1F07"=>"\u03B1\u0314\u0342", "\u1F08"=>"\u0391\u0313", "\u1F09"=>"\u0391\u0314", "\u1F0A"=>"\u0391\u0313\u0300", "\u1F0B"=>"\u0391\u0314\u0300",
- "\u1F0C"=>"\u0391\u0313\u0301", "\u1F0D"=>"\u0391\u0314\u0301", "\u1F0E"=>"\u0391\u0313\u0342", "\u1F0F"=>"\u0391\u0314\u0342", "\u1F10"=>"\u03B5\u0313", "\u1F11"=>"\u03B5\u0314", "\u1F12"=>"\u03B5\u0313\u0300", "\u1F13"=>"\u03B5\u0314\u0300",
- "\u1F14"=>"\u03B5\u0313\u0301", "\u1F15"=>"\u03B5\u0314\u0301", "\u1F18"=>"\u0395\u0313", "\u1F19"=>"\u0395\u0314", "\u1F1A"=>"\u0395\u0313\u0300", "\u1F1B"=>"\u0395\u0314\u0300", "\u1F1C"=>"\u0395\u0313\u0301", "\u1F1D"=>"\u0395\u0314\u0301",
- "\u1F20"=>"\u03B7\u0313", "\u1F21"=>"\u03B7\u0314", "\u1F22"=>"\u03B7\u0313\u0300", "\u1F23"=>"\u03B7\u0314\u0300", "\u1F24"=>"\u03B7\u0313\u0301", "\u1F25"=>"\u03B7\u0314\u0301", "\u1F26"=>"\u03B7\u0313\u0342", "\u1F27"=>"\u03B7\u0314\u0342",
- "\u1F28"=>"\u0397\u0313", "\u1F29"=>"\u0397\u0314", "\u1F2A"=>"\u0397\u0313\u0300", "\u1F2B"=>"\u0397\u0314\u0300", "\u1F2C"=>"\u0397\u0313\u0301", "\u1F2D"=>"\u0397\u0314\u0301", "\u1F2E"=>"\u0397\u0313\u0342", "\u1F2F"=>"\u0397\u0314\u0342",
- "\u1F30"=>"\u03B9\u0313", "\u1F31"=>"\u03B9\u0314", "\u1F32"=>"\u03B9\u0313\u0300", "\u1F33"=>"\u03B9\u0314\u0300", "\u1F34"=>"\u03B9\u0313\u0301", "\u1F35"=>"\u03B9\u0314\u0301", "\u1F36"=>"\u03B9\u0313\u0342", "\u1F37"=>"\u03B9\u0314\u0342",
- "\u1F38"=>"\u0399\u0313", "\u1F39"=>"\u0399\u0314", "\u1F3A"=>"\u0399\u0313\u0300", "\u1F3B"=>"\u0399\u0314\u0300", "\u1F3C"=>"\u0399\u0313\u0301", "\u1F3D"=>"\u0399\u0314\u0301", "\u1F3E"=>"\u0399\u0313\u0342", "\u1F3F"=>"\u0399\u0314\u0342",
- "\u1F40"=>"\u03BF\u0313", "\u1F41"=>"\u03BF\u0314", "\u1F42"=>"\u03BF\u0313\u0300", "\u1F43"=>"\u03BF\u0314\u0300", "\u1F44"=>"\u03BF\u0313\u0301", "\u1F45"=>"\u03BF\u0314\u0301", "\u1F48"=>"\u039F\u0313", "\u1F49"=>"\u039F\u0314",
- "\u1F4A"=>"\u039F\u0313\u0300", "\u1F4B"=>"\u039F\u0314\u0300", "\u1F4C"=>"\u039F\u0313\u0301", "\u1F4D"=>"\u039F\u0314\u0301", "\u1F50"=>"\u03C5\u0313", "\u1F51"=>"\u03C5\u0314", "\u1F52"=>"\u03C5\u0313\u0300", "\u1F53"=>"\u03C5\u0314\u0300",
- "\u1F54"=>"\u03C5\u0313\u0301", "\u1F55"=>"\u03C5\u0314\u0301", "\u1F56"=>"\u03C5\u0313\u0342", "\u1F57"=>"\u03C5\u0314\u0342", "\u1F59"=>"\u03A5\u0314", "\u1F5B"=>"\u03A5\u0314\u0300", "\u1F5D"=>"\u03A5\u0314\u0301", "\u1F5F"=>"\u03A5\u0314\u0342",
- "\u1F60"=>"\u03C9\u0313", "\u1F61"=>"\u03C9\u0314", "\u1F62"=>"\u03C9\u0313\u0300", "\u1F63"=>"\u03C9\u0314\u0300", "\u1F64"=>"\u03C9\u0313\u0301", "\u1F65"=>"\u03C9\u0314\u0301", "\u1F66"=>"\u03C9\u0313\u0342", "\u1F67"=>"\u03C9\u0314\u0342",
- "\u1F68"=>"\u03A9\u0313", "\u1F69"=>"\u03A9\u0314", "\u1F6A"=>"\u03A9\u0313\u0300", "\u1F6B"=>"\u03A9\u0314\u0300", "\u1F6C"=>"\u03A9\u0313\u0301", "\u1F6D"=>"\u03A9\u0314\u0301", "\u1F6E"=>"\u03A9\u0313\u0342", "\u1F6F"=>"\u03A9\u0314\u0342",
- "\u1F70"=>"\u03B1\u0300", "\u1F71"=>"\u03B1\u0301", "\u1F72"=>"\u03B5\u0300", "\u1F73"=>"\u03B5\u0301", "\u1F74"=>"\u03B7\u0300", "\u1F75"=>"\u03B7\u0301", "\u1F76"=>"\u03B9\u0300", "\u1F77"=>"\u03B9\u0301",
- "\u1F78"=>"\u03BF\u0300", "\u1F79"=>"\u03BF\u0301", "\u1F7A"=>"\u03C5\u0300", "\u1F7B"=>"\u03C5\u0301", "\u1F7C"=>"\u03C9\u0300", "\u1F7D"=>"\u03C9\u0301", "\u1F80"=>"\u03B1\u0313\u0345", "\u1F81"=>"\u03B1\u0314\u0345",
- "\u1F82"=>"\u03B1\u0313\u0300\u0345", "\u1F83"=>"\u03B1\u0314\u0300\u0345", "\u1F84"=>"\u03B1\u0313\u0301\u0345", "\u1F85"=>"\u03B1\u0314\u0301\u0345", "\u1F86"=>"\u03B1\u0313\u0342\u0345", "\u1F87"=>"\u03B1\u0314\u0342\u0345", "\u1F88"=>"\u0391\u0313\u0345", "\u1F89"=>"\u0391\u0314\u0345",
- "\u1F8A"=>"\u0391\u0313\u0300\u0345", "\u1F8B"=>"\u0391\u0314\u0300\u0345", "\u1F8C"=>"\u0391\u0313\u0301\u0345", "\u1F8D"=>"\u0391\u0314\u0301\u0345", "\u1F8E"=>"\u0391\u0313\u0342\u0345", "\u1F8F"=>"\u0391\u0314\u0342\u0345", "\u1F90"=>"\u03B7\u0313\u0345", "\u1F91"=>"\u03B7\u0314\u0345",
- "\u1F92"=>"\u03B7\u0313\u0300\u0345", "\u1F93"=>"\u03B7\u0314\u0300\u0345", "\u1F94"=>"\u03B7\u0313\u0301\u0345", "\u1F95"=>"\u03B7\u0314\u0301\u0345", "\u1F96"=>"\u03B7\u0313\u0342\u0345", "\u1F97"=>"\u03B7\u0314\u0342\u0345", "\u1F98"=>"\u0397\u0313\u0345", "\u1F99"=>"\u0397\u0314\u0345",
- "\u1F9A"=>"\u0397\u0313\u0300\u0345", "\u1F9B"=>"\u0397\u0314\u0300\u0345", "\u1F9C"=>"\u0397\u0313\u0301\u0345", "\u1F9D"=>"\u0397\u0314\u0301\u0345", "\u1F9E"=>"\u0397\u0313\u0342\u0345", "\u1F9F"=>"\u0397\u0314\u0342\u0345", "\u1FA0"=>"\u03C9\u0313\u0345", "\u1FA1"=>"\u03C9\u0314\u0345",
- "\u1FA2"=>"\u03C9\u0313\u0300\u0345", "\u1FA3"=>"\u03C9\u0314\u0300\u0345", "\u1FA4"=>"\u03C9\u0313\u0301\u0345", "\u1FA5"=>"\u03C9\u0314\u0301\u0345", "\u1FA6"=>"\u03C9\u0313\u0342\u0345", "\u1FA7"=>"\u03C9\u0314\u0342\u0345", "\u1FA8"=>"\u03A9\u0313\u0345", "\u1FA9"=>"\u03A9\u0314\u0345",
- "\u1FAA"=>"\u03A9\u0313\u0300\u0345", "\u1FAB"=>"\u03A9\u0314\u0300\u0345", "\u1FAC"=>"\u03A9\u0313\u0301\u0345", "\u1FAD"=>"\u03A9\u0314\u0301\u0345", "\u1FAE"=>"\u03A9\u0313\u0342\u0345", "\u1FAF"=>"\u03A9\u0314\u0342\u0345", "\u1FB0"=>"\u03B1\u0306", "\u1FB1"=>"\u03B1\u0304",
- "\u1FB2"=>"\u03B1\u0300\u0345", "\u1FB3"=>"\u03B1\u0345", "\u1FB4"=>"\u03B1\u0301\u0345", "\u1FB6"=>"\u03B1\u0342", "\u1FB7"=>"\u03B1\u0342\u0345", "\u1FB8"=>"\u0391\u0306", "\u1FB9"=>"\u0391\u0304", "\u1FBA"=>"\u0391\u0300",
- "\u1FBB"=>"\u0391\u0301", "\u1FBC"=>"\u0391\u0345", "\u1FBE"=>"\u03B9", "\u1FC1"=>"\u00A8\u0342", "\u1FC2"=>"\u03B7\u0300\u0345", "\u1FC3"=>"\u03B7\u0345", "\u1FC4"=>"\u03B7\u0301\u0345", "\u1FC6"=>"\u03B7\u0342",
- "\u1FC7"=>"\u03B7\u0342\u0345", "\u1FC8"=>"\u0395\u0300", "\u1FC9"=>"\u0395\u0301", "\u1FCA"=>"\u0397\u0300", "\u1FCB"=>"\u0397\u0301", "\u1FCC"=>"\u0397\u0345", "\u1FCD"=>"\u1FBF\u0300", "\u1FCE"=>"\u1FBF\u0301",
- "\u1FCF"=>"\u1FBF\u0342", "\u1FD0"=>"\u03B9\u0306", "\u1FD1"=>"\u03B9\u0304", "\u1FD2"=>"\u03B9\u0308\u0300", "\u1FD3"=>"\u03B9\u0308\u0301", "\u1FD6"=>"\u03B9\u0342", "\u1FD7"=>"\u03B9\u0308\u0342", "\u1FD8"=>"\u0399\u0306",
- "\u1FD9"=>"\u0399\u0304", "\u1FDA"=>"\u0399\u0300", "\u1FDB"=>"\u0399\u0301", "\u1FDD"=>"\u1FFE\u0300", "\u1FDE"=>"\u1FFE\u0301", "\u1FDF"=>"\u1FFE\u0342", "\u1FE0"=>"\u03C5\u0306", "\u1FE1"=>"\u03C5\u0304",
- "\u1FE2"=>"\u03C5\u0308\u0300", "\u1FE3"=>"\u03C5\u0308\u0301", "\u1FE4"=>"\u03C1\u0313", "\u1FE5"=>"\u03C1\u0314", "\u1FE6"=>"\u03C5\u0342", "\u1FE7"=>"\u03C5\u0308\u0342", "\u1FE8"=>"\u03A5\u0306", "\u1FE9"=>"\u03A5\u0304",
- "\u1FEA"=>"\u03A5\u0300", "\u1FEB"=>"\u03A5\u0301", "\u1FEC"=>"\u03A1\u0314", "\u1FED"=>"\u00A8\u0300", "\u1FEE"=>"\u00A8\u0301", "\u1FEF"=>"`", "\u1FF2"=>"\u03C9\u0300\u0345", "\u1FF3"=>"\u03C9\u0345",
- "\u1FF4"=>"\u03C9\u0301\u0345", "\u1FF6"=>"\u03C9\u0342", "\u1FF7"=>"\u03C9\u0342\u0345", "\u1FF8"=>"\u039F\u0300", "\u1FF9"=>"\u039F\u0301", "\u1FFA"=>"\u03A9\u0300", "\u1FFB"=>"\u03A9\u0301", "\u1FFC"=>"\u03A9\u0345",
- "\u1FFD"=>"\u00B4", "\u2000"=>"\u2002", "\u2001"=>"\u2003", "\u2126"=>"\u03A9", "\u212A"=>"K", "\u212B"=>"A\u030A", "\u219A"=>"\u2190\u0338", "\u219B"=>"\u2192\u0338",
- "\u21AE"=>"\u2194\u0338", "\u21CD"=>"\u21D0\u0338", "\u21CE"=>"\u21D4\u0338", "\u21CF"=>"\u21D2\u0338", "\u2204"=>"\u2203\u0338", "\u2209"=>"\u2208\u0338", "\u220C"=>"\u220B\u0338", "\u2224"=>"\u2223\u0338",
- "\u2226"=>"\u2225\u0338", "\u2241"=>"\u223C\u0338", "\u2244"=>"\u2243\u0338", "\u2247"=>"\u2245\u0338", "\u2249"=>"\u2248\u0338", "\u2260"=>"=\u0338", "\u2262"=>"\u2261\u0338", "\u226D"=>"\u224D\u0338",
- "\u226E"=>"<\u0338", "\u226F"=>">\u0338", "\u2270"=>"\u2264\u0338", "\u2271"=>"\u2265\u0338", "\u2274"=>"\u2272\u0338", "\u2275"=>"\u2273\u0338", "\u2278"=>"\u2276\u0338", "\u2279"=>"\u2277\u0338",
- "\u2280"=>"\u227A\u0338", "\u2281"=>"\u227B\u0338", "\u2284"=>"\u2282\u0338", "\u2285"=>"\u2283\u0338", "\u2288"=>"\u2286\u0338", "\u2289"=>"\u2287\u0338", "\u22AC"=>"\u22A2\u0338", "\u22AD"=>"\u22A8\u0338",
- "\u22AE"=>"\u22A9\u0338", "\u22AF"=>"\u22AB\u0338", "\u22E0"=>"\u227C\u0338", "\u22E1"=>"\u227D\u0338", "\u22E2"=>"\u2291\u0338", "\u22E3"=>"\u2292\u0338", "\u22EA"=>"\u22B2\u0338", "\u22EB"=>"\u22B3\u0338",
- "\u22EC"=>"\u22B4\u0338", "\u22ED"=>"\u22B5\u0338", "\u2329"=>"\u3008", "\u232A"=>"\u3009", "\u2ADC"=>"\u2ADD\u0338", "\u304C"=>"\u304B\u3099", "\u304E"=>"\u304D\u3099", "\u3050"=>"\u304F\u3099",
- "\u3052"=>"\u3051\u3099", "\u3054"=>"\u3053\u3099", "\u3056"=>"\u3055\u3099", "\u3058"=>"\u3057\u3099", "\u305A"=>"\u3059\u3099", "\u305C"=>"\u305B\u3099", "\u305E"=>"\u305D\u3099", "\u3060"=>"\u305F\u3099",
- "\u3062"=>"\u3061\u3099", "\u3065"=>"\u3064\u3099", "\u3067"=>"\u3066\u3099", "\u3069"=>"\u3068\u3099", "\u3070"=>"\u306F\u3099", "\u3071"=>"\u306F\u309A", "\u3073"=>"\u3072\u3099", "\u3074"=>"\u3072\u309A",
- "\u3076"=>"\u3075\u3099", "\u3077"=>"\u3075\u309A", "\u3079"=>"\u3078\u3099", "\u307A"=>"\u3078\u309A", "\u307C"=>"\u307B\u3099", "\u307D"=>"\u307B\u309A", "\u3094"=>"\u3046\u3099", "\u309E"=>"\u309D\u3099",
- "\u30AC"=>"\u30AB\u3099", "\u30AE"=>"\u30AD\u3099", "\u30B0"=>"\u30AF\u3099", "\u30B2"=>"\u30B1\u3099", "\u30B4"=>"\u30B3\u3099", "\u30B6"=>"\u30B5\u3099", "\u30B8"=>"\u30B7\u3099", "\u30BA"=>"\u30B9\u3099",
- "\u30BC"=>"\u30BB\u3099", "\u30BE"=>"\u30BD\u3099", "\u30C0"=>"\u30BF\u3099", "\u30C2"=>"\u30C1\u3099", "\u30C5"=>"\u30C4\u3099", "\u30C7"=>"\u30C6\u3099", "\u30C9"=>"\u30C8\u3099", "\u30D0"=>"\u30CF\u3099",
- "\u30D1"=>"\u30CF\u309A", "\u30D3"=>"\u30D2\u3099", "\u30D4"=>"\u30D2\u309A", "\u30D6"=>"\u30D5\u3099", "\u30D7"=>"\u30D5\u309A", "\u30D9"=>"\u30D8\u3099", "\u30DA"=>"\u30D8\u309A", "\u30DC"=>"\u30DB\u3099",
- "\u30DD"=>"\u30DB\u309A", "\u30F4"=>"\u30A6\u3099", "\u30F7"=>"\u30EF\u3099", "\u30F8"=>"\u30F0\u3099", "\u30F9"=>"\u30F1\u3099", "\u30FA"=>"\u30F2\u3099", "\u30FE"=>"\u30FD\u3099", "\uF900"=>"\u8C48",
- "\uF901"=>"\u66F4", "\uF902"=>"\u8ECA", "\uF903"=>"\u8CC8", "\uF904"=>"\u6ED1", "\uF905"=>"\u4E32", "\uF906"=>"\u53E5", "\uF907"=>"\u9F9C", "\uF908"=>"\u9F9C",
- "\uF909"=>"\u5951", "\uF90A"=>"\u91D1", "\uF90B"=>"\u5587", "\uF90C"=>"\u5948", "\uF90D"=>"\u61F6", "\uF90E"=>"\u7669", "\uF90F"=>"\u7F85", "\uF910"=>"\u863F",
- "\uF911"=>"\u87BA", "\uF912"=>"\u88F8", "\uF913"=>"\u908F", "\uF914"=>"\u6A02", "\uF915"=>"\u6D1B", "\uF916"=>"\u70D9", "\uF917"=>"\u73DE", "\uF918"=>"\u843D",
- "\uF919"=>"\u916A", "\uF91A"=>"\u99F1", "\uF91B"=>"\u4E82", "\uF91C"=>"\u5375", "\uF91D"=>"\u6B04", "\uF91E"=>"\u721B", "\uF91F"=>"\u862D", "\uF920"=>"\u9E1E",
- "\uF921"=>"\u5D50", "\uF922"=>"\u6FEB", "\uF923"=>"\u85CD", "\uF924"=>"\u8964", "\uF925"=>"\u62C9", "\uF926"=>"\u81D8", "\uF927"=>"\u881F", "\uF928"=>"\u5ECA",
- "\uF929"=>"\u6717", "\uF92A"=>"\u6D6A", "\uF92B"=>"\u72FC", "\uF92C"=>"\u90CE", "\uF92D"=>"\u4F86", "\uF92E"=>"\u51B7", "\uF92F"=>"\u52DE", "\uF930"=>"\u64C4",
- "\uF931"=>"\u6AD3", "\uF932"=>"\u7210", "\uF933"=>"\u76E7", "\uF934"=>"\u8001", "\uF935"=>"\u8606", "\uF936"=>"\u865C", "\uF937"=>"\u8DEF", "\uF938"=>"\u9732",
- "\uF939"=>"\u9B6F", "\uF93A"=>"\u9DFA", "\uF93B"=>"\u788C", "\uF93C"=>"\u797F", "\uF93D"=>"\u7DA0", "\uF93E"=>"\u83C9", "\uF93F"=>"\u9304", "\uF940"=>"\u9E7F",
- "\uF941"=>"\u8AD6", "\uF942"=>"\u58DF", "\uF943"=>"\u5F04", "\uF944"=>"\u7C60", "\uF945"=>"\u807E", "\uF946"=>"\u7262", "\uF947"=>"\u78CA", "\uF948"=>"\u8CC2",
- "\uF949"=>"\u96F7", "\uF94A"=>"\u58D8", "\uF94B"=>"\u5C62", "\uF94C"=>"\u6A13", "\uF94D"=>"\u6DDA", "\uF94E"=>"\u6F0F", "\uF94F"=>"\u7D2F", "\uF950"=>"\u7E37",
- "\uF951"=>"\u964B", "\uF952"=>"\u52D2", "\uF953"=>"\u808B", "\uF954"=>"\u51DC", "\uF955"=>"\u51CC", "\uF956"=>"\u7A1C", "\uF957"=>"\u7DBE", "\uF958"=>"\u83F1",
- "\uF959"=>"\u9675", "\uF95A"=>"\u8B80", "\uF95B"=>"\u62CF", "\uF95C"=>"\u6A02", "\uF95D"=>"\u8AFE", "\uF95E"=>"\u4E39", "\uF95F"=>"\u5BE7", "\uF960"=>"\u6012",
- "\uF961"=>"\u7387", "\uF962"=>"\u7570", "\uF963"=>"\u5317", "\uF964"=>"\u78FB", "\uF965"=>"\u4FBF", "\uF966"=>"\u5FA9", "\uF967"=>"\u4E0D", "\uF968"=>"\u6CCC",
- "\uF969"=>"\u6578", "\uF96A"=>"\u7D22", "\uF96B"=>"\u53C3", "\uF96C"=>"\u585E", "\uF96D"=>"\u7701", "\uF96E"=>"\u8449", "\uF96F"=>"\u8AAA", "\uF970"=>"\u6BBA",
- "\uF971"=>"\u8FB0", "\uF972"=>"\u6C88", "\uF973"=>"\u62FE", "\uF974"=>"\u82E5", "\uF975"=>"\u63A0", "\uF976"=>"\u7565", "\uF977"=>"\u4EAE", "\uF978"=>"\u5169",
- "\uF979"=>"\u51C9", "\uF97A"=>"\u6881", "\uF97B"=>"\u7CE7", "\uF97C"=>"\u826F", "\uF97D"=>"\u8AD2", "\uF97E"=>"\u91CF", "\uF97F"=>"\u52F5", "\uF980"=>"\u5442",
- "\uF981"=>"\u5973", "\uF982"=>"\u5EEC", "\uF983"=>"\u65C5", "\uF984"=>"\u6FFE", "\uF985"=>"\u792A", "\uF986"=>"\u95AD", "\uF987"=>"\u9A6A", "\uF988"=>"\u9E97",
- "\uF989"=>"\u9ECE", "\uF98A"=>"\u529B", "\uF98B"=>"\u66C6", "\uF98C"=>"\u6B77", "\uF98D"=>"\u8F62", "\uF98E"=>"\u5E74", "\uF98F"=>"\u6190", "\uF990"=>"\u6200",
- "\uF991"=>"\u649A", "\uF992"=>"\u6F23", "\uF993"=>"\u7149", "\uF994"=>"\u7489", "\uF995"=>"\u79CA", "\uF996"=>"\u7DF4", "\uF997"=>"\u806F", "\uF998"=>"\u8F26",
- "\uF999"=>"\u84EE", "\uF99A"=>"\u9023", "\uF99B"=>"\u934A", "\uF99C"=>"\u5217", "\uF99D"=>"\u52A3", "\uF99E"=>"\u54BD", "\uF99F"=>"\u70C8", "\uF9A0"=>"\u88C2",
- "\uF9A1"=>"\u8AAA", "\uF9A2"=>"\u5EC9", "\uF9A3"=>"\u5FF5", "\uF9A4"=>"\u637B", "\uF9A5"=>"\u6BAE", "\uF9A6"=>"\u7C3E", "\uF9A7"=>"\u7375", "\uF9A8"=>"\u4EE4",
- "\uF9A9"=>"\u56F9", "\uF9AA"=>"\u5BE7", "\uF9AB"=>"\u5DBA", "\uF9AC"=>"\u601C", "\uF9AD"=>"\u73B2", "\uF9AE"=>"\u7469", "\uF9AF"=>"\u7F9A", "\uF9B0"=>"\u8046",
- "\uF9B1"=>"\u9234", "\uF9B2"=>"\u96F6", "\uF9B3"=>"\u9748", "\uF9B4"=>"\u9818", "\uF9B5"=>"\u4F8B", "\uF9B6"=>"\u79AE", "\uF9B7"=>"\u91B4", "\uF9B8"=>"\u96B8",
- "\uF9B9"=>"\u60E1", "\uF9BA"=>"\u4E86", "\uF9BB"=>"\u50DA", "\uF9BC"=>"\u5BEE", "\uF9BD"=>"\u5C3F", "\uF9BE"=>"\u6599", "\uF9BF"=>"\u6A02", "\uF9C0"=>"\u71CE",
- "\uF9C1"=>"\u7642", "\uF9C2"=>"\u84FC", "\uF9C3"=>"\u907C", "\uF9C4"=>"\u9F8D", "\uF9C5"=>"\u6688", "\uF9C6"=>"\u962E", "\uF9C7"=>"\u5289", "\uF9C8"=>"\u677B",
- "\uF9C9"=>"\u67F3", "\uF9CA"=>"\u6D41", "\uF9CB"=>"\u6E9C", "\uF9CC"=>"\u7409", "\uF9CD"=>"\u7559", "\uF9CE"=>"\u786B", "\uF9CF"=>"\u7D10", "\uF9D0"=>"\u985E",
- "\uF9D1"=>"\u516D", "\uF9D2"=>"\u622E", "\uF9D3"=>"\u9678", "\uF9D4"=>"\u502B", "\uF9D5"=>"\u5D19", "\uF9D6"=>"\u6DEA", "\uF9D7"=>"\u8F2A", "\uF9D8"=>"\u5F8B",
- "\uF9D9"=>"\u6144", "\uF9DA"=>"\u6817", "\uF9DB"=>"\u7387", "\uF9DC"=>"\u9686", "\uF9DD"=>"\u5229", "\uF9DE"=>"\u540F", "\uF9DF"=>"\u5C65", "\uF9E0"=>"\u6613",
- "\uF9E1"=>"\u674E", "\uF9E2"=>"\u68A8", "\uF9E3"=>"\u6CE5", "\uF9E4"=>"\u7406", "\uF9E5"=>"\u75E2", "\uF9E6"=>"\u7F79", "\uF9E7"=>"\u88CF", "\uF9E8"=>"\u88E1",
- "\uF9E9"=>"\u91CC", "\uF9EA"=>"\u96E2", "\uF9EB"=>"\u533F", "\uF9EC"=>"\u6EBA", "\uF9ED"=>"\u541D", "\uF9EE"=>"\u71D0", "\uF9EF"=>"\u7498", "\uF9F0"=>"\u85FA",
- "\uF9F1"=>"\u96A3", "\uF9F2"=>"\u9C57", "\uF9F3"=>"\u9E9F", "\uF9F4"=>"\u6797", "\uF9F5"=>"\u6DCB", "\uF9F6"=>"\u81E8", "\uF9F7"=>"\u7ACB", "\uF9F8"=>"\u7B20",
- "\uF9F9"=>"\u7C92", "\uF9FA"=>"\u72C0", "\uF9FB"=>"\u7099", "\uF9FC"=>"\u8B58", "\uF9FD"=>"\u4EC0", "\uF9FE"=>"\u8336", "\uF9FF"=>"\u523A", "\uFA00"=>"\u5207",
- "\uFA01"=>"\u5EA6", "\uFA02"=>"\u62D3", "\uFA03"=>"\u7CD6", "\uFA04"=>"\u5B85", "\uFA05"=>"\u6D1E", "\uFA06"=>"\u66B4", "\uFA07"=>"\u8F3B", "\uFA08"=>"\u884C",
- "\uFA09"=>"\u964D", "\uFA0A"=>"\u898B", "\uFA0B"=>"\u5ED3", "\uFA0C"=>"\u5140", "\uFA0D"=>"\u55C0", "\uFA10"=>"\u585A", "\uFA12"=>"\u6674", "\uFA15"=>"\u51DE",
- "\uFA16"=>"\u732A", "\uFA17"=>"\u76CA", "\uFA18"=>"\u793C", "\uFA19"=>"\u795E", "\uFA1A"=>"\u7965", "\uFA1B"=>"\u798F", "\uFA1C"=>"\u9756", "\uFA1D"=>"\u7CBE",
- "\uFA1E"=>"\u7FBD", "\uFA20"=>"\u8612", "\uFA22"=>"\u8AF8", "\uFA25"=>"\u9038", "\uFA26"=>"\u90FD", "\uFA2A"=>"\u98EF", "\uFA2B"=>"\u98FC", "\uFA2C"=>"\u9928",
- "\uFA2D"=>"\u9DB4", "\uFA2E"=>"\u90DE", "\uFA2F"=>"\u96B7", "\uFA30"=>"\u4FAE", "\uFA31"=>"\u50E7", "\uFA32"=>"\u514D", "\uFA33"=>"\u52C9", "\uFA34"=>"\u52E4",
- "\uFA35"=>"\u5351", "\uFA36"=>"\u559D", "\uFA37"=>"\u5606", "\uFA38"=>"\u5668", "\uFA39"=>"\u5840", "\uFA3A"=>"\u58A8", "\uFA3B"=>"\u5C64", "\uFA3C"=>"\u5C6E",
- "\uFA3D"=>"\u6094", "\uFA3E"=>"\u6168", "\uFA3F"=>"\u618E", "\uFA40"=>"\u61F2", "\uFA41"=>"\u654F", "\uFA42"=>"\u65E2", "\uFA43"=>"\u6691", "\uFA44"=>"\u6885",
- "\uFA45"=>"\u6D77", "\uFA46"=>"\u6E1A", "\uFA47"=>"\u6F22", "\uFA48"=>"\u716E", "\uFA49"=>"\u722B", "\uFA4A"=>"\u7422", "\uFA4B"=>"\u7891", "\uFA4C"=>"\u793E",
- "\uFA4D"=>"\u7949", "\uFA4E"=>"\u7948", "\uFA4F"=>"\u7950", "\uFA50"=>"\u7956", "\uFA51"=>"\u795D", "\uFA52"=>"\u798D", "\uFA53"=>"\u798E", "\uFA54"=>"\u7A40",
- "\uFA55"=>"\u7A81", "\uFA56"=>"\u7BC0", "\uFA57"=>"\u7DF4", "\uFA58"=>"\u7E09", "\uFA59"=>"\u7E41", "\uFA5A"=>"\u7F72", "\uFA5B"=>"\u8005", "\uFA5C"=>"\u81ED",
- "\uFA5D"=>"\u8279", "\uFA5E"=>"\u8279", "\uFA5F"=>"\u8457", "\uFA60"=>"\u8910", "\uFA61"=>"\u8996", "\uFA62"=>"\u8B01", "\uFA63"=>"\u8B39", "\uFA64"=>"\u8CD3",
- "\uFA65"=>"\u8D08", "\uFA66"=>"\u8FB6", "\uFA67"=>"\u9038", "\uFA68"=>"\u96E3", "\uFA69"=>"\u97FF", "\uFA6A"=>"\u983B", "\uFA6B"=>"\u6075", "\uFA6C"=>"\u{242EE}",
- "\uFA6D"=>"\u8218", "\uFA70"=>"\u4E26", "\uFA71"=>"\u51B5", "\uFA72"=>"\u5168", "\uFA73"=>"\u4F80", "\uFA74"=>"\u5145", "\uFA75"=>"\u5180", "\uFA76"=>"\u52C7",
- "\uFA77"=>"\u52FA", "\uFA78"=>"\u559D", "\uFA79"=>"\u5555", "\uFA7A"=>"\u5599", "\uFA7B"=>"\u55E2", "\uFA7C"=>"\u585A", "\uFA7D"=>"\u58B3", "\uFA7E"=>"\u5944",
- "\uFA7F"=>"\u5954", "\uFA80"=>"\u5A62", "\uFA81"=>"\u5B28", "\uFA82"=>"\u5ED2", "\uFA83"=>"\u5ED9", "\uFA84"=>"\u5F69", "\uFA85"=>"\u5FAD", "\uFA86"=>"\u60D8",
- "\uFA87"=>"\u614E", "\uFA88"=>"\u6108", "\uFA89"=>"\u618E", "\uFA8A"=>"\u6160", "\uFA8B"=>"\u61F2", "\uFA8C"=>"\u6234", "\uFA8D"=>"\u63C4", "\uFA8E"=>"\u641C",
- "\uFA8F"=>"\u6452", "\uFA90"=>"\u6556", "\uFA91"=>"\u6674", "\uFA92"=>"\u6717", "\uFA93"=>"\u671B", "\uFA94"=>"\u6756", "\uFA95"=>"\u6B79", "\uFA96"=>"\u6BBA",
- "\uFA97"=>"\u6D41", "\uFA98"=>"\u6EDB", "\uFA99"=>"\u6ECB", "\uFA9A"=>"\u6F22", "\uFA9B"=>"\u701E", "\uFA9C"=>"\u716E", "\uFA9D"=>"\u77A7", "\uFA9E"=>"\u7235",
- "\uFA9F"=>"\u72AF", "\uFAA0"=>"\u732A", "\uFAA1"=>"\u7471", "\uFAA2"=>"\u7506", "\uFAA3"=>"\u753B", "\uFAA4"=>"\u761D", "\uFAA5"=>"\u761F", "\uFAA6"=>"\u76CA",
- "\uFAA7"=>"\u76DB", "\uFAA8"=>"\u76F4", "\uFAA9"=>"\u774A", "\uFAAA"=>"\u7740", "\uFAAB"=>"\u78CC", "\uFAAC"=>"\u7AB1", "\uFAAD"=>"\u7BC0", "\uFAAE"=>"\u7C7B",
- "\uFAAF"=>"\u7D5B", "\uFAB0"=>"\u7DF4", "\uFAB1"=>"\u7F3E", "\uFAB2"=>"\u8005", "\uFAB3"=>"\u8352", "\uFAB4"=>"\u83EF", "\uFAB5"=>"\u8779", "\uFAB6"=>"\u8941",
- "\uFAB7"=>"\u8986", "\uFAB8"=>"\u8996", "\uFAB9"=>"\u8ABF", "\uFABA"=>"\u8AF8", "\uFABB"=>"\u8ACB", "\uFABC"=>"\u8B01", "\uFABD"=>"\u8AFE", "\uFABE"=>"\u8AED",
- "\uFABF"=>"\u8B39", "\uFAC0"=>"\u8B8A", "\uFAC1"=>"\u8D08", "\uFAC2"=>"\u8F38", "\uFAC3"=>"\u9072", "\uFAC4"=>"\u9199", "\uFAC5"=>"\u9276", "\uFAC6"=>"\u967C",
- "\uFAC7"=>"\u96E3", "\uFAC8"=>"\u9756", "\uFAC9"=>"\u97DB", "\uFACA"=>"\u97FF", "\uFACB"=>"\u980B", "\uFACC"=>"\u983B", "\uFACD"=>"\u9B12", "\uFACE"=>"\u9F9C",
- "\uFACF"=>"\u{2284A}", "\uFAD0"=>"\u{22844}", "\uFAD1"=>"\u{233D5}", "\uFAD2"=>"\u3B9D", "\uFAD3"=>"\u4018", "\uFAD4"=>"\u4039", "\uFAD5"=>"\u{25249}", "\uFAD6"=>"\u{25CD0}",
- "\uFAD7"=>"\u{27ED3}", "\uFAD8"=>"\u9F43", "\uFAD9"=>"\u9F8E", "\uFB1D"=>"\u05D9\u05B4", "\uFB1F"=>"\u05F2\u05B7", "\uFB2A"=>"\u05E9\u05C1", "\uFB2B"=>"\u05E9\u05C2", "\uFB2C"=>"\u05E9\u05BC\u05C1",
- "\uFB2D"=>"\u05E9\u05BC\u05C2", "\uFB2E"=>"\u05D0\u05B7", "\uFB2F"=>"\u05D0\u05B8", "\uFB30"=>"\u05D0\u05BC", "\uFB31"=>"\u05D1\u05BC", "\uFB32"=>"\u05D2\u05BC", "\uFB33"=>"\u05D3\u05BC", "\uFB34"=>"\u05D4\u05BC",
- "\uFB35"=>"\u05D5\u05BC", "\uFB36"=>"\u05D6\u05BC", "\uFB38"=>"\u05D8\u05BC", "\uFB39"=>"\u05D9\u05BC", "\uFB3A"=>"\u05DA\u05BC", "\uFB3B"=>"\u05DB\u05BC", "\uFB3C"=>"\u05DC\u05BC", "\uFB3E"=>"\u05DE\u05BC",
- "\uFB40"=>"\u05E0\u05BC", "\uFB41"=>"\u05E1\u05BC", "\uFB43"=>"\u05E3\u05BC", "\uFB44"=>"\u05E4\u05BC", "\uFB46"=>"\u05E6\u05BC", "\uFB47"=>"\u05E7\u05BC", "\uFB48"=>"\u05E8\u05BC", "\uFB49"=>"\u05E9\u05BC",
- "\uFB4A"=>"\u05EA\u05BC", "\uFB4B"=>"\u05D5\u05B9", "\uFB4C"=>"\u05D1\u05BF", "\uFB4D"=>"\u05DB\u05BF", "\uFB4E"=>"\u05E4\u05BF", "\u{1109A}"=>"\u{11099}\u{110BA}", "\u{1109C}"=>"\u{1109B}\u{110BA}", "\u{110AB}"=>"\u{110A5}\u{110BA}",
- "\u{1112E}"=>"\u{11131}\u{11127}", "\u{1112F}"=>"\u{11132}\u{11127}", "\u{1134B}"=>"\u{11347}\u{1133E}", "\u{1134C}"=>"\u{11347}\u{11357}", "\u{114BB}"=>"\u{114B9}\u{114BA}", "\u{114BC}"=>"\u{114B9}\u{114B0}", "\u{114BE}"=>"\u{114B9}\u{114BD}", "\u{115BA}"=>"\u{115B8}\u{115AF}",
- "\u{115BB}"=>"\u{115B9}\u{115AF}", "\u{1D15E}"=>"\u{1D157}\u{1D165}", "\u{1D15F}"=>"\u{1D158}\u{1D165}", "\u{1D160}"=>"\u{1D158}\u{1D165}\u{1D16E}", "\u{1D161}"=>"\u{1D158}\u{1D165}\u{1D16F}", "\u{1D162}"=>"\u{1D158}\u{1D165}\u{1D170}", "\u{1D163}"=>"\u{1D158}\u{1D165}\u{1D171}", "\u{1D164}"=>"\u{1D158}\u{1D165}\u{1D172}",
- "\u{1D1BB}"=>"\u{1D1B9}\u{1D165}", "\u{1D1BC}"=>"\u{1D1BA}\u{1D165}", "\u{1D1BD}"=>"\u{1D1B9}\u{1D165}\u{1D16E}", "\u{1D1BE}"=>"\u{1D1BA}\u{1D165}\u{1D16E}", "\u{1D1BF}"=>"\u{1D1B9}\u{1D165}\u{1D16F}", "\u{1D1C0}"=>"\u{1D1BA}\u{1D165}\u{1D16F}", "\u{2F800}"=>"\u4E3D", "\u{2F801}"=>"\u4E38",
- "\u{2F802}"=>"\u4E41", "\u{2F803}"=>"\u{20122}", "\u{2F804}"=>"\u4F60", "\u{2F805}"=>"\u4FAE", "\u{2F806}"=>"\u4FBB", "\u{2F807}"=>"\u5002", "\u{2F808}"=>"\u507A", "\u{2F809}"=>"\u5099",
- "\u{2F80A}"=>"\u50E7", "\u{2F80B}"=>"\u50CF", "\u{2F80C}"=>"\u349E", "\u{2F80D}"=>"\u{2063A}", "\u{2F80E}"=>"\u514D", "\u{2F80F}"=>"\u5154", "\u{2F810}"=>"\u5164", "\u{2F811}"=>"\u5177",
- "\u{2F812}"=>"\u{2051C}", "\u{2F813}"=>"\u34B9", "\u{2F814}"=>"\u5167", "\u{2F815}"=>"\u518D", "\u{2F816}"=>"\u{2054B}", "\u{2F817}"=>"\u5197", "\u{2F818}"=>"\u51A4", "\u{2F819}"=>"\u4ECC",
- "\u{2F81A}"=>"\u51AC", "\u{2F81B}"=>"\u51B5", "\u{2F81C}"=>"\u{291DF}", "\u{2F81D}"=>"\u51F5", "\u{2F81E}"=>"\u5203", "\u{2F81F}"=>"\u34DF", "\u{2F820}"=>"\u523B", "\u{2F821}"=>"\u5246",
- "\u{2F822}"=>"\u5272", "\u{2F823}"=>"\u5277", "\u{2F824}"=>"\u3515", "\u{2F825}"=>"\u52C7", "\u{2F826}"=>"\u52C9", "\u{2F827}"=>"\u52E4", "\u{2F828}"=>"\u52FA", "\u{2F829}"=>"\u5305",
- "\u{2F82A}"=>"\u5306", "\u{2F82B}"=>"\u5317", "\u{2F82C}"=>"\u5349", "\u{2F82D}"=>"\u5351", "\u{2F82E}"=>"\u535A", "\u{2F82F}"=>"\u5373", "\u{2F830}"=>"\u537D", "\u{2F831}"=>"\u537F",
- "\u{2F832}"=>"\u537F", "\u{2F833}"=>"\u537F", "\u{2F834}"=>"\u{20A2C}", "\u{2F835}"=>"\u7070", "\u{2F836}"=>"\u53CA", "\u{2F837}"=>"\u53DF", "\u{2F838}"=>"\u{20B63}", "\u{2F839}"=>"\u53EB",
- "\u{2F83A}"=>"\u53F1", "\u{2F83B}"=>"\u5406", "\u{2F83C}"=>"\u549E", "\u{2F83D}"=>"\u5438", "\u{2F83E}"=>"\u5448", "\u{2F83F}"=>"\u5468", "\u{2F840}"=>"\u54A2", "\u{2F841}"=>"\u54F6",
- "\u{2F842}"=>"\u5510", "\u{2F843}"=>"\u5553", "\u{2F844}"=>"\u5563", "\u{2F845}"=>"\u5584", "\u{2F846}"=>"\u5584", "\u{2F847}"=>"\u5599", "\u{2F848}"=>"\u55AB", "\u{2F849}"=>"\u55B3",
- "\u{2F84A}"=>"\u55C2", "\u{2F84B}"=>"\u5716", "\u{2F84C}"=>"\u5606", "\u{2F84D}"=>"\u5717", "\u{2F84E}"=>"\u5651", "\u{2F84F}"=>"\u5674", "\u{2F850}"=>"\u5207", "\u{2F851}"=>"\u58EE",
- "\u{2F852}"=>"\u57CE", "\u{2F853}"=>"\u57F4", "\u{2F854}"=>"\u580D", "\u{2F855}"=>"\u578B", "\u{2F856}"=>"\u5832", "\u{2F857}"=>"\u5831", "\u{2F858}"=>"\u58AC", "\u{2F859}"=>"\u{214E4}",
- "\u{2F85A}"=>"\u58F2", "\u{2F85B}"=>"\u58F7", "\u{2F85C}"=>"\u5906", "\u{2F85D}"=>"\u591A", "\u{2F85E}"=>"\u5922", "\u{2F85F}"=>"\u5962", "\u{2F860}"=>"\u{216A8}", "\u{2F861}"=>"\u{216EA}",
- "\u{2F862}"=>"\u59EC", "\u{2F863}"=>"\u5A1B", "\u{2F864}"=>"\u5A27", "\u{2F865}"=>"\u59D8", "\u{2F866}"=>"\u5A66", "\u{2F867}"=>"\u36EE", "\u{2F868}"=>"\u36FC", "\u{2F869}"=>"\u5B08",
- "\u{2F86A}"=>"\u5B3E", "\u{2F86B}"=>"\u5B3E", "\u{2F86C}"=>"\u{219C8}", "\u{2F86D}"=>"\u5BC3", "\u{2F86E}"=>"\u5BD8", "\u{2F86F}"=>"\u5BE7", "\u{2F870}"=>"\u5BF3", "\u{2F871}"=>"\u{21B18}",
- "\u{2F872}"=>"\u5BFF", "\u{2F873}"=>"\u5C06", "\u{2F874}"=>"\u5F53", "\u{2F875}"=>"\u5C22", "\u{2F876}"=>"\u3781", "\u{2F877}"=>"\u5C60", "\u{2F878}"=>"\u5C6E", "\u{2F879}"=>"\u5CC0",
- "\u{2F87A}"=>"\u5C8D", "\u{2F87B}"=>"\u{21DE4}", "\u{2F87C}"=>"\u5D43", "\u{2F87D}"=>"\u{21DE6}", "\u{2F87E}"=>"\u5D6E", "\u{2F87F}"=>"\u5D6B", "\u{2F880}"=>"\u5D7C", "\u{2F881}"=>"\u5DE1",
- "\u{2F882}"=>"\u5DE2", "\u{2F883}"=>"\u382F", "\u{2F884}"=>"\u5DFD", "\u{2F885}"=>"\u5E28", "\u{2F886}"=>"\u5E3D", "\u{2F887}"=>"\u5E69", "\u{2F888}"=>"\u3862", "\u{2F889}"=>"\u{22183}",
- "\u{2F88A}"=>"\u387C", "\u{2F88B}"=>"\u5EB0", "\u{2F88C}"=>"\u5EB3", "\u{2F88D}"=>"\u5EB6", "\u{2F88E}"=>"\u5ECA", "\u{2F88F}"=>"\u{2A392}", "\u{2F890}"=>"\u5EFE", "\u{2F891}"=>"\u{22331}",
- "\u{2F892}"=>"\u{22331}", "\u{2F893}"=>"\u8201", "\u{2F894}"=>"\u5F22", "\u{2F895}"=>"\u5F22", "\u{2F896}"=>"\u38C7", "\u{2F897}"=>"\u{232B8}", "\u{2F898}"=>"\u{261DA}", "\u{2F899}"=>"\u5F62",
- "\u{2F89A}"=>"\u5F6B", "\u{2F89B}"=>"\u38E3", "\u{2F89C}"=>"\u5F9A", "\u{2F89D}"=>"\u5FCD", "\u{2F89E}"=>"\u5FD7", "\u{2F89F}"=>"\u5FF9", "\u{2F8A0}"=>"\u6081", "\u{2F8A1}"=>"\u393A",
- "\u{2F8A2}"=>"\u391C", "\u{2F8A3}"=>"\u6094", "\u{2F8A4}"=>"\u{226D4}", "\u{2F8A5}"=>"\u60C7", "\u{2F8A6}"=>"\u6148", "\u{2F8A7}"=>"\u614C", "\u{2F8A8}"=>"\u614E", "\u{2F8A9}"=>"\u614C",
- "\u{2F8AA}"=>"\u617A", "\u{2F8AB}"=>"\u618E", "\u{2F8AC}"=>"\u61B2", "\u{2F8AD}"=>"\u61A4", "\u{2F8AE}"=>"\u61AF", "\u{2F8AF}"=>"\u61DE", "\u{2F8B0}"=>"\u61F2", "\u{2F8B1}"=>"\u61F6",
- "\u{2F8B2}"=>"\u6210", "\u{2F8B3}"=>"\u621B", "\u{2F8B4}"=>"\u625D", "\u{2F8B5}"=>"\u62B1", "\u{2F8B6}"=>"\u62D4", "\u{2F8B7}"=>"\u6350", "\u{2F8B8}"=>"\u{22B0C}", "\u{2F8B9}"=>"\u633D",
- "\u{2F8BA}"=>"\u62FC", "\u{2F8BB}"=>"\u6368", "\u{2F8BC}"=>"\u6383", "\u{2F8BD}"=>"\u63E4", "\u{2F8BE}"=>"\u{22BF1}", "\u{2F8BF}"=>"\u6422", "\u{2F8C0}"=>"\u63C5", "\u{2F8C1}"=>"\u63A9",
- "\u{2F8C2}"=>"\u3A2E", "\u{2F8C3}"=>"\u6469", "\u{2F8C4}"=>"\u647E", "\u{2F8C5}"=>"\u649D", "\u{2F8C6}"=>"\u6477", "\u{2F8C7}"=>"\u3A6C", "\u{2F8C8}"=>"\u654F", "\u{2F8C9}"=>"\u656C",
- "\u{2F8CA}"=>"\u{2300A}", "\u{2F8CB}"=>"\u65E3", "\u{2F8CC}"=>"\u66F8", "\u{2F8CD}"=>"\u6649", "\u{2F8CE}"=>"\u3B19", "\u{2F8CF}"=>"\u6691", "\u{2F8D0}"=>"\u3B08", "\u{2F8D1}"=>"\u3AE4",
- "\u{2F8D2}"=>"\u5192", "\u{2F8D3}"=>"\u5195", "\u{2F8D4}"=>"\u6700", "\u{2F8D5}"=>"\u669C", "\u{2F8D6}"=>"\u80AD", "\u{2F8D7}"=>"\u43D9", "\u{2F8D8}"=>"\u6717", "\u{2F8D9}"=>"\u671B",
- "\u{2F8DA}"=>"\u6721", "\u{2F8DB}"=>"\u675E", "\u{2F8DC}"=>"\u6753", "\u{2F8DD}"=>"\u{233C3}", "\u{2F8DE}"=>"\u3B49", "\u{2F8DF}"=>"\u67FA", "\u{2F8E0}"=>"\u6785", "\u{2F8E1}"=>"\u6852",
- "\u{2F8E2}"=>"\u6885", "\u{2F8E3}"=>"\u{2346D}", "\u{2F8E4}"=>"\u688E", "\u{2F8E5}"=>"\u681F", "\u{2F8E6}"=>"\u6914", "\u{2F8E7}"=>"\u3B9D", "\u{2F8E8}"=>"\u6942", "\u{2F8E9}"=>"\u69A3",
- "\u{2F8EA}"=>"\u69EA", "\u{2F8EB}"=>"\u6AA8", "\u{2F8EC}"=>"\u{236A3}", "\u{2F8ED}"=>"\u6ADB", "\u{2F8EE}"=>"\u3C18", "\u{2F8EF}"=>"\u6B21", "\u{2F8F0}"=>"\u{238A7}", "\u{2F8F1}"=>"\u6B54",
- "\u{2F8F2}"=>"\u3C4E", "\u{2F8F3}"=>"\u6B72", "\u{2F8F4}"=>"\u6B9F", "\u{2F8F5}"=>"\u6BBA", "\u{2F8F6}"=>"\u6BBB", "\u{2F8F7}"=>"\u{23A8D}", "\u{2F8F8}"=>"\u{21D0B}", "\u{2F8F9}"=>"\u{23AFA}",
- "\u{2F8FA}"=>"\u6C4E", "\u{2F8FB}"=>"\u{23CBC}", "\u{2F8FC}"=>"\u6CBF", "\u{2F8FD}"=>"\u6CCD", "\u{2F8FE}"=>"\u6C67", "\u{2F8FF}"=>"\u6D16", "\u{2F900}"=>"\u6D3E", "\u{2F901}"=>"\u6D77",
- "\u{2F902}"=>"\u6D41", "\u{2F903}"=>"\u6D69", "\u{2F904}"=>"\u6D78", "\u{2F905}"=>"\u6D85", "\u{2F906}"=>"\u{23D1E}", "\u{2F907}"=>"\u6D34", "\u{2F908}"=>"\u6E2F", "\u{2F909}"=>"\u6E6E",
- "\u{2F90A}"=>"\u3D33", "\u{2F90B}"=>"\u6ECB", "\u{2F90C}"=>"\u6EC7", "\u{2F90D}"=>"\u{23ED1}", "\u{2F90E}"=>"\u6DF9", "\u{2F90F}"=>"\u6F6E", "\u{2F910}"=>"\u{23F5E}", "\u{2F911}"=>"\u{23F8E}",
- "\u{2F912}"=>"\u6FC6", "\u{2F913}"=>"\u7039", "\u{2F914}"=>"\u701E", "\u{2F915}"=>"\u701B", "\u{2F916}"=>"\u3D96", "\u{2F917}"=>"\u704A", "\u{2F918}"=>"\u707D", "\u{2F919}"=>"\u7077",
- "\u{2F91A}"=>"\u70AD", "\u{2F91B}"=>"\u{20525}", "\u{2F91C}"=>"\u7145", "\u{2F91D}"=>"\u{24263}", "\u{2F91E}"=>"\u719C", "\u{2F91F}"=>"\u{243AB}", "\u{2F920}"=>"\u7228", "\u{2F921}"=>"\u7235",
- "\u{2F922}"=>"\u7250", "\u{2F923}"=>"\u{24608}", "\u{2F924}"=>"\u7280", "\u{2F925}"=>"\u7295", "\u{2F926}"=>"\u{24735}", "\u{2F927}"=>"\u{24814}", "\u{2F928}"=>"\u737A", "\u{2F929}"=>"\u738B",
- "\u{2F92A}"=>"\u3EAC", "\u{2F92B}"=>"\u73A5", "\u{2F92C}"=>"\u3EB8", "\u{2F92D}"=>"\u3EB8", "\u{2F92E}"=>"\u7447", "\u{2F92F}"=>"\u745C", "\u{2F930}"=>"\u7471", "\u{2F931}"=>"\u7485",
- "\u{2F932}"=>"\u74CA", "\u{2F933}"=>"\u3F1B", "\u{2F934}"=>"\u7524", "\u{2F935}"=>"\u{24C36}", "\u{2F936}"=>"\u753E", "\u{2F937}"=>"\u{24C92}", "\u{2F938}"=>"\u7570", "\u{2F939}"=>"\u{2219F}",
- "\u{2F93A}"=>"\u7610", "\u{2F93B}"=>"\u{24FA1}", "\u{2F93C}"=>"\u{24FB8}", "\u{2F93D}"=>"\u{25044}", "\u{2F93E}"=>"\u3FFC", "\u{2F93F}"=>"\u4008", "\u{2F940}"=>"\u76F4", "\u{2F941}"=>"\u{250F3}",
- "\u{2F942}"=>"\u{250F2}", "\u{2F943}"=>"\u{25119}", "\u{2F944}"=>"\u{25133}", "\u{2F945}"=>"\u771E", "\u{2F946}"=>"\u771F", "\u{2F947}"=>"\u771F", "\u{2F948}"=>"\u774A", "\u{2F949}"=>"\u4039",
- "\u{2F94A}"=>"\u778B", "\u{2F94B}"=>"\u4046", "\u{2F94C}"=>"\u4096", "\u{2F94D}"=>"\u{2541D}", "\u{2F94E}"=>"\u784E", "\u{2F94F}"=>"\u788C", "\u{2F950}"=>"\u78CC", "\u{2F951}"=>"\u40E3",
- "\u{2F952}"=>"\u{25626}", "\u{2F953}"=>"\u7956", "\u{2F954}"=>"\u{2569A}", "\u{2F955}"=>"\u{256C5}", "\u{2F956}"=>"\u798F", "\u{2F957}"=>"\u79EB", "\u{2F958}"=>"\u412F", "\u{2F959}"=>"\u7A40",
- "\u{2F95A}"=>"\u7A4A", "\u{2F95B}"=>"\u7A4F", "\u{2F95C}"=>"\u{2597C}", "\u{2F95D}"=>"\u{25AA7}", "\u{2F95E}"=>"\u{25AA7}", "\u{2F95F}"=>"\u7AEE", "\u{2F960}"=>"\u4202", "\u{2F961}"=>"\u{25BAB}",
- "\u{2F962}"=>"\u7BC6", "\u{2F963}"=>"\u7BC9", "\u{2F964}"=>"\u4227", "\u{2F965}"=>"\u{25C80}", "\u{2F966}"=>"\u7CD2", "\u{2F967}"=>"\u42A0", "\u{2F968}"=>"\u7CE8", "\u{2F969}"=>"\u7CE3",
- "\u{2F96A}"=>"\u7D00", "\u{2F96B}"=>"\u{25F86}", "\u{2F96C}"=>"\u7D63", "\u{2F96D}"=>"\u4301", "\u{2F96E}"=>"\u7DC7", "\u{2F96F}"=>"\u7E02", "\u{2F970}"=>"\u7E45", "\u{2F971}"=>"\u4334",
- "\u{2F972}"=>"\u{26228}", "\u{2F973}"=>"\u{26247}", "\u{2F974}"=>"\u4359", "\u{2F975}"=>"\u{262D9}", "\u{2F976}"=>"\u7F7A", "\u{2F977}"=>"\u{2633E}", "\u{2F978}"=>"\u7F95", "\u{2F979}"=>"\u7FFA",
- "\u{2F97A}"=>"\u8005", "\u{2F97B}"=>"\u{264DA}", "\u{2F97C}"=>"\u{26523}", "\u{2F97D}"=>"\u8060", "\u{2F97E}"=>"\u{265A8}", "\u{2F97F}"=>"\u8070", "\u{2F980}"=>"\u{2335F}", "\u{2F981}"=>"\u43D5",
- "\u{2F982}"=>"\u80B2", "\u{2F983}"=>"\u8103", "\u{2F984}"=>"\u440B", "\u{2F985}"=>"\u813E", "\u{2F986}"=>"\u5AB5", "\u{2F987}"=>"\u{267A7}", "\u{2F988}"=>"\u{267B5}", "\u{2F989}"=>"\u{23393}",
- "\u{2F98A}"=>"\u{2339C}", "\u{2F98B}"=>"\u8201", "\u{2F98C}"=>"\u8204", "\u{2F98D}"=>"\u8F9E", "\u{2F98E}"=>"\u446B", "\u{2F98F}"=>"\u8291", "\u{2F990}"=>"\u828B", "\u{2F991}"=>"\u829D",
- "\u{2F992}"=>"\u52B3", "\u{2F993}"=>"\u82B1", "\u{2F994}"=>"\u82B3", "\u{2F995}"=>"\u82BD", "\u{2F996}"=>"\u82E6", "\u{2F997}"=>"\u{26B3C}", "\u{2F998}"=>"\u82E5", "\u{2F999}"=>"\u831D",
- "\u{2F99A}"=>"\u8363", "\u{2F99B}"=>"\u83AD", "\u{2F99C}"=>"\u8323", "\u{2F99D}"=>"\u83BD", "\u{2F99E}"=>"\u83E7", "\u{2F99F}"=>"\u8457", "\u{2F9A0}"=>"\u8353", "\u{2F9A1}"=>"\u83CA",
- "\u{2F9A2}"=>"\u83CC", "\u{2F9A3}"=>"\u83DC", "\u{2F9A4}"=>"\u{26C36}", "\u{2F9A5}"=>"\u{26D6B}", "\u{2F9A6}"=>"\u{26CD5}", "\u{2F9A7}"=>"\u452B", "\u{2F9A8}"=>"\u84F1", "\u{2F9A9}"=>"\u84F3",
- "\u{2F9AA}"=>"\u8516", "\u{2F9AB}"=>"\u{273CA}", "\u{2F9AC}"=>"\u8564", "\u{2F9AD}"=>"\u{26F2C}", "\u{2F9AE}"=>"\u455D", "\u{2F9AF}"=>"\u4561", "\u{2F9B0}"=>"\u{26FB1}", "\u{2F9B1}"=>"\u{270D2}",
- "\u{2F9B2}"=>"\u456B", "\u{2F9B3}"=>"\u8650", "\u{2F9B4}"=>"\u865C", "\u{2F9B5}"=>"\u8667", "\u{2F9B6}"=>"\u8669", "\u{2F9B7}"=>"\u86A9", "\u{2F9B8}"=>"\u8688", "\u{2F9B9}"=>"\u870E",
- "\u{2F9BA}"=>"\u86E2", "\u{2F9BB}"=>"\u8779", "\u{2F9BC}"=>"\u8728", "\u{2F9BD}"=>"\u876B", "\u{2F9BE}"=>"\u8786", "\u{2F9BF}"=>"\u45D7", "\u{2F9C0}"=>"\u87E1", "\u{2F9C1}"=>"\u8801",
- "\u{2F9C2}"=>"\u45F9", "\u{2F9C3}"=>"\u8860", "\u{2F9C4}"=>"\u8863", "\u{2F9C5}"=>"\u{27667}", "\u{2F9C6}"=>"\u88D7", "\u{2F9C7}"=>"\u88DE", "\u{2F9C8}"=>"\u4635", "\u{2F9C9}"=>"\u88FA",
- "\u{2F9CA}"=>"\u34BB", "\u{2F9CB}"=>"\u{278AE}", "\u{2F9CC}"=>"\u{27966}", "\u{2F9CD}"=>"\u46BE", "\u{2F9CE}"=>"\u46C7", "\u{2F9CF}"=>"\u8AA0", "\u{2F9D0}"=>"\u8AED", "\u{2F9D1}"=>"\u8B8A",
- "\u{2F9D2}"=>"\u8C55", "\u{2F9D3}"=>"\u{27CA8}", "\u{2F9D4}"=>"\u8CAB", "\u{2F9D5}"=>"\u8CC1", "\u{2F9D6}"=>"\u8D1B", "\u{2F9D7}"=>"\u8D77", "\u{2F9D8}"=>"\u{27F2F}", "\u{2F9D9}"=>"\u{20804}",
- "\u{2F9DA}"=>"\u8DCB", "\u{2F9DB}"=>"\u8DBC", "\u{2F9DC}"=>"\u8DF0", "\u{2F9DD}"=>"\u{208DE}", "\u{2F9DE}"=>"\u8ED4", "\u{2F9DF}"=>"\u8F38", "\u{2F9E0}"=>"\u{285D2}", "\u{2F9E1}"=>"\u{285ED}",
- "\u{2F9E2}"=>"\u9094", "\u{2F9E3}"=>"\u90F1", "\u{2F9E4}"=>"\u9111", "\u{2F9E5}"=>"\u{2872E}", "\u{2F9E6}"=>"\u911B", "\u{2F9E7}"=>"\u9238", "\u{2F9E8}"=>"\u92D7", "\u{2F9E9}"=>"\u92D8",
- "\u{2F9EA}"=>"\u927C", "\u{2F9EB}"=>"\u93F9", "\u{2F9EC}"=>"\u9415", "\u{2F9ED}"=>"\u{28BFA}", "\u{2F9EE}"=>"\u958B", "\u{2F9EF}"=>"\u4995", "\u{2F9F0}"=>"\u95B7", "\u{2F9F1}"=>"\u{28D77}",
- "\u{2F9F2}"=>"\u49E6", "\u{2F9F3}"=>"\u96C3", "\u{2F9F4}"=>"\u5DB2", "\u{2F9F5}"=>"\u9723", "\u{2F9F6}"=>"\u{29145}", "\u{2F9F7}"=>"\u{2921A}", "\u{2F9F8}"=>"\u4A6E", "\u{2F9F9}"=>"\u4A76",
- "\u{2F9FA}"=>"\u97E0", "\u{2F9FB}"=>"\u{2940A}", "\u{2F9FC}"=>"\u4AB2", "\u{2F9FD}"=>"\u{29496}", "\u{2F9FE}"=>"\u980B", "\u{2F9FF}"=>"\u980B", "\u{2FA00}"=>"\u9829", "\u{2FA01}"=>"\u{295B6}",
- "\u{2FA02}"=>"\u98E2", "\u{2FA03}"=>"\u4B33", "\u{2FA04}"=>"\u9929", "\u{2FA05}"=>"\u99A7", "\u{2FA06}"=>"\u99C2", "\u{2FA07}"=>"\u99FE", "\u{2FA08}"=>"\u4BCE", "\u{2FA09}"=>"\u{29B30}",
- "\u{2FA0A}"=>"\u9B12", "\u{2FA0B}"=>"\u9C40", "\u{2FA0C}"=>"\u9CFD", "\u{2FA0D}"=>"\u4CCE", "\u{2FA0E}"=>"\u4CED", "\u{2FA0F}"=>"\u9D67", "\u{2FA10}"=>"\u{2A0CE}", "\u{2FA11}"=>"\u4CF8",
- "\u{2FA12}"=>"\u{2A105}", "\u{2FA13}"=>"\u{2A20E}", "\u{2FA14}"=>"\u{2A291}", "\u{2FA15}"=>"\u9EBB", "\u{2FA16}"=>"\u4D56", "\u{2FA17}"=>"\u9EF9", "\u{2FA18}"=>"\u9EFE", "\u{2FA19}"=>"\u9F05",
- "\u{2FA1A}"=>"\u9F0F", "\u{2FA1B}"=>"\u9F16", "\u{2FA1C}"=>"\u9F3B", "\u{2FA1D}"=>"\u{2A600}",
- }.freeze
-
- KOMPATIBLE_TABLE = {
- "\u00A0"=>" ", "\u00A8"=>" \u0308", "\u00AA"=>"a", "\u00AF"=>" \u0304", "\u00B2"=>"2", "\u00B3"=>"3", "\u00B4"=>" \u0301", "\u00B5"=>"\u03BC",
- "\u00B8"=>" \u0327", "\u00B9"=>"1", "\u00BA"=>"o", "\u00BC"=>"1\u20444", "\u00BD"=>"1\u20442", "\u00BE"=>"3\u20444", "\u0132"=>"IJ", "\u0133"=>"ij",
- "\u013F"=>"L\u00B7", "\u0140"=>"l\u00B7", "\u0149"=>"\u02BCn", "\u017F"=>"s", "\u01C4"=>"D\u017D", "\u01C5"=>"D\u017E", "\u01C6"=>"d\u017E", "\u01C7"=>"LJ",
- "\u01C8"=>"Lj", "\u01C9"=>"lj", "\u01CA"=>"NJ", "\u01CB"=>"Nj", "\u01CC"=>"nj", "\u01F1"=>"DZ", "\u01F2"=>"Dz", "\u01F3"=>"dz",
- "\u02B0"=>"h", "\u02B1"=>"\u0266", "\u02B2"=>"j", "\u02B3"=>"r", "\u02B4"=>"\u0279", "\u02B5"=>"\u027B", "\u02B6"=>"\u0281", "\u02B7"=>"w",
- "\u02B8"=>"y", "\u02D8"=>" \u0306", "\u02D9"=>" \u0307", "\u02DA"=>" \u030A", "\u02DB"=>" \u0328", "\u02DC"=>" \u0303", "\u02DD"=>" \u030B", "\u02E0"=>"\u0263",
- "\u02E1"=>"l", "\u02E2"=>"s", "\u02E3"=>"x", "\u02E4"=>"\u0295", "\u037A"=>" \u0345", "\u0384"=>" \u0301", "\u03D0"=>"\u03B2", "\u03D1"=>"\u03B8",
- "\u03D2"=>"\u03A5", "\u03D5"=>"\u03C6", "\u03D6"=>"\u03C0", "\u03F0"=>"\u03BA", "\u03F1"=>"\u03C1", "\u03F2"=>"\u03C2", "\u03F4"=>"\u0398", "\u03F5"=>"\u03B5",
- "\u03F9"=>"\u03A3", "\u0587"=>"\u0565\u0582", "\u0675"=>"\u0627\u0674", "\u0676"=>"\u0648\u0674", "\u0677"=>"\u06C7\u0674", "\u0678"=>"\u064A\u0674", "\u0E33"=>"\u0E4D\u0E32", "\u0EB3"=>"\u0ECD\u0EB2",
- "\u0EDC"=>"\u0EAB\u0E99", "\u0EDD"=>"\u0EAB\u0EA1", "\u0F0C"=>"\u0F0B", "\u0F77"=>"\u0FB2\u0F81", "\u0F79"=>"\u0FB3\u0F81", "\u10FC"=>"\u10DC", "\u1D2C"=>"A", "\u1D2D"=>"\u00C6",
- "\u1D2E"=>"B", "\u1D30"=>"D", "\u1D31"=>"E", "\u1D32"=>"\u018E", "\u1D33"=>"G", "\u1D34"=>"H", "\u1D35"=>"I", "\u1D36"=>"J",
- "\u1D37"=>"K", "\u1D38"=>"L", "\u1D39"=>"M", "\u1D3A"=>"N", "\u1D3C"=>"O", "\u1D3D"=>"\u0222", "\u1D3E"=>"P", "\u1D3F"=>"R",
- "\u1D40"=>"T", "\u1D41"=>"U", "\u1D42"=>"W", "\u1D43"=>"a", "\u1D44"=>"\u0250", "\u1D45"=>"\u0251", "\u1D46"=>"\u1D02", "\u1D47"=>"b",
- "\u1D48"=>"d", "\u1D49"=>"e", "\u1D4A"=>"\u0259", "\u1D4B"=>"\u025B", "\u1D4C"=>"\u025C", "\u1D4D"=>"g", "\u1D4F"=>"k", "\u1D50"=>"m",
- "\u1D51"=>"\u014B", "\u1D52"=>"o", "\u1D53"=>"\u0254", "\u1D54"=>"\u1D16", "\u1D55"=>"\u1D17", "\u1D56"=>"p", "\u1D57"=>"t", "\u1D58"=>"u",
- "\u1D59"=>"\u1D1D", "\u1D5A"=>"\u026F", "\u1D5B"=>"v", "\u1D5C"=>"\u1D25", "\u1D5D"=>"\u03B2", "\u1D5E"=>"\u03B3", "\u1D5F"=>"\u03B4", "\u1D60"=>"\u03C6",
- "\u1D61"=>"\u03C7", "\u1D62"=>"i", "\u1D63"=>"r", "\u1D64"=>"u", "\u1D65"=>"v", "\u1D66"=>"\u03B2", "\u1D67"=>"\u03B3", "\u1D68"=>"\u03C1",
- "\u1D69"=>"\u03C6", "\u1D6A"=>"\u03C7", "\u1D78"=>"\u043D", "\u1D9B"=>"\u0252", "\u1D9C"=>"c", "\u1D9D"=>"\u0255", "\u1D9E"=>"\u00F0", "\u1D9F"=>"\u025C",
- "\u1DA0"=>"f", "\u1DA1"=>"\u025F", "\u1DA2"=>"\u0261", "\u1DA3"=>"\u0265", "\u1DA4"=>"\u0268", "\u1DA5"=>"\u0269", "\u1DA6"=>"\u026A", "\u1DA7"=>"\u1D7B",
- "\u1DA8"=>"\u029D", "\u1DA9"=>"\u026D", "\u1DAA"=>"\u1D85", "\u1DAB"=>"\u029F", "\u1DAC"=>"\u0271", "\u1DAD"=>"\u0270", "\u1DAE"=>"\u0272", "\u1DAF"=>"\u0273",
- "\u1DB0"=>"\u0274", "\u1DB1"=>"\u0275", "\u1DB2"=>"\u0278", "\u1DB3"=>"\u0282", "\u1DB4"=>"\u0283", "\u1DB5"=>"\u01AB", "\u1DB6"=>"\u0289", "\u1DB7"=>"\u028A",
- "\u1DB8"=>"\u1D1C", "\u1DB9"=>"\u028B", "\u1DBA"=>"\u028C", "\u1DBB"=>"z", "\u1DBC"=>"\u0290", "\u1DBD"=>"\u0291", "\u1DBE"=>"\u0292", "\u1DBF"=>"\u03B8",
- "\u1E9A"=>"a\u02BE", "\u1FBD"=>" \u0313", "\u1FBF"=>" \u0313", "\u1FC0"=>" \u0342", "\u1FFE"=>" \u0314", "\u2002"=>" ", "\u2003"=>" ", "\u2004"=>" ",
- "\u2005"=>" ", "\u2006"=>" ", "\u2007"=>" ", "\u2008"=>" ", "\u2009"=>" ", "\u200A"=>" ", "\u2011"=>"\u2010", "\u2017"=>" \u0333",
- "\u2024"=>".", "\u2025"=>"..", "\u2026"=>"...", "\u202F"=>" ", "\u2033"=>"\u2032\u2032", "\u2034"=>"\u2032\u2032\u2032", "\u2036"=>"\u2035\u2035", "\u2037"=>"\u2035\u2035\u2035",
- "\u203C"=>"!!", "\u203E"=>" \u0305", "\u2047"=>"??", "\u2048"=>"?!", "\u2049"=>"!?", "\u2057"=>"\u2032\u2032\u2032\u2032", "\u205F"=>" ", "\u2070"=>"0",
- "\u2071"=>"i", "\u2074"=>"4", "\u2075"=>"5", "\u2076"=>"6", "\u2077"=>"7", "\u2078"=>"8", "\u2079"=>"9", "\u207A"=>"+",
- "\u207B"=>"\u2212", "\u207C"=>"=", "\u207D"=>"(", "\u207E"=>")", "\u207F"=>"n", "\u2080"=>"0", "\u2081"=>"1", "\u2082"=>"2",
- "\u2083"=>"3", "\u2084"=>"4", "\u2085"=>"5", "\u2086"=>"6", "\u2087"=>"7", "\u2088"=>"8", "\u2089"=>"9", "\u208A"=>"+",
- "\u208B"=>"\u2212", "\u208C"=>"=", "\u208D"=>"(", "\u208E"=>")", "\u2090"=>"a", "\u2091"=>"e", "\u2092"=>"o", "\u2093"=>"x",
- "\u2094"=>"\u0259", "\u2095"=>"h", "\u2096"=>"k", "\u2097"=>"l", "\u2098"=>"m", "\u2099"=>"n", "\u209A"=>"p", "\u209B"=>"s",
- "\u209C"=>"t", "\u20A8"=>"Rs", "\u2100"=>"a/c", "\u2101"=>"a/s", "\u2102"=>"C", "\u2103"=>"\u00B0C", "\u2105"=>"c/o", "\u2106"=>"c/u",
- "\u2107"=>"\u0190", "\u2109"=>"\u00B0F", "\u210A"=>"g", "\u210B"=>"H", "\u210C"=>"H", "\u210D"=>"H", "\u210E"=>"h", "\u210F"=>"\u0127",
- "\u2110"=>"I", "\u2111"=>"I", "\u2112"=>"L", "\u2113"=>"l", "\u2115"=>"N", "\u2116"=>"No", "\u2119"=>"P", "\u211A"=>"Q",
- "\u211B"=>"R", "\u211C"=>"R", "\u211D"=>"R", "\u2120"=>"SM", "\u2121"=>"TEL", "\u2122"=>"TM", "\u2124"=>"Z", "\u2128"=>"Z",
- "\u212C"=>"B", "\u212D"=>"C", "\u212F"=>"e", "\u2130"=>"E", "\u2131"=>"F", "\u2133"=>"M", "\u2134"=>"o", "\u2135"=>"\u05D0",
- "\u2136"=>"\u05D1", "\u2137"=>"\u05D2", "\u2138"=>"\u05D3", "\u2139"=>"i", "\u213B"=>"FAX", "\u213C"=>"\u03C0", "\u213D"=>"\u03B3", "\u213E"=>"\u0393",
- "\u213F"=>"\u03A0", "\u2140"=>"\u2211", "\u2145"=>"D", "\u2146"=>"d", "\u2147"=>"e", "\u2148"=>"i", "\u2149"=>"j", "\u2150"=>"1\u20447",
- "\u2151"=>"1\u20449", "\u2152"=>"1\u204410", "\u2153"=>"1\u20443", "\u2154"=>"2\u20443", "\u2155"=>"1\u20445", "\u2156"=>"2\u20445", "\u2157"=>"3\u20445", "\u2158"=>"4\u20445",
- "\u2159"=>"1\u20446", "\u215A"=>"5\u20446", "\u215B"=>"1\u20448", "\u215C"=>"3\u20448", "\u215D"=>"5\u20448", "\u215E"=>"7\u20448", "\u215F"=>"1\u2044", "\u2160"=>"I",
- "\u2161"=>"II", "\u2162"=>"III", "\u2163"=>"IV", "\u2164"=>"V", "\u2165"=>"VI", "\u2166"=>"VII", "\u2167"=>"VIII", "\u2168"=>"IX",
- "\u2169"=>"X", "\u216A"=>"XI", "\u216B"=>"XII", "\u216C"=>"L", "\u216D"=>"C", "\u216E"=>"D", "\u216F"=>"M", "\u2170"=>"i",
- "\u2171"=>"ii", "\u2172"=>"iii", "\u2173"=>"iv", "\u2174"=>"v", "\u2175"=>"vi", "\u2176"=>"vii", "\u2177"=>"viii", "\u2178"=>"ix",
- "\u2179"=>"x", "\u217A"=>"xi", "\u217B"=>"xii", "\u217C"=>"l", "\u217D"=>"c", "\u217E"=>"d", "\u217F"=>"m", "\u2189"=>"0\u20443",
- "\u222C"=>"\u222B\u222B", "\u222D"=>"\u222B\u222B\u222B", "\u222F"=>"\u222E\u222E", "\u2230"=>"\u222E\u222E\u222E", "\u2460"=>"1", "\u2461"=>"2", "\u2462"=>"3", "\u2463"=>"4",
- "\u2464"=>"5", "\u2465"=>"6", "\u2466"=>"7", "\u2467"=>"8", "\u2468"=>"9", "\u2469"=>"10", "\u246A"=>"11", "\u246B"=>"12",
- "\u246C"=>"13", "\u246D"=>"14", "\u246E"=>"15", "\u246F"=>"16", "\u2470"=>"17", "\u2471"=>"18", "\u2472"=>"19", "\u2473"=>"20",
- "\u2474"=>"(1)", "\u2475"=>"(2)", "\u2476"=>"(3)", "\u2477"=>"(4)", "\u2478"=>"(5)", "\u2479"=>"(6)", "\u247A"=>"(7)", "\u247B"=>"(8)",
- "\u247C"=>"(9)", "\u247D"=>"(10)", "\u247E"=>"(11)", "\u247F"=>"(12)", "\u2480"=>"(13)", "\u2481"=>"(14)", "\u2482"=>"(15)", "\u2483"=>"(16)",
- "\u2484"=>"(17)", "\u2485"=>"(18)", "\u2486"=>"(19)", "\u2487"=>"(20)", "\u2488"=>"1.", "\u2489"=>"2.", "\u248A"=>"3.", "\u248B"=>"4.",
- "\u248C"=>"5.", "\u248D"=>"6.", "\u248E"=>"7.", "\u248F"=>"8.", "\u2490"=>"9.", "\u2491"=>"10.", "\u2492"=>"11.", "\u2493"=>"12.",
- "\u2494"=>"13.", "\u2495"=>"14.", "\u2496"=>"15.", "\u2497"=>"16.", "\u2498"=>"17.", "\u2499"=>"18.", "\u249A"=>"19.", "\u249B"=>"20.",
- "\u249C"=>"(a)", "\u249D"=>"(b)", "\u249E"=>"(c)", "\u249F"=>"(d)", "\u24A0"=>"(e)", "\u24A1"=>"(f)", "\u24A2"=>"(g)", "\u24A3"=>"(h)",
- "\u24A4"=>"(i)", "\u24A5"=>"(j)", "\u24A6"=>"(k)", "\u24A7"=>"(l)", "\u24A8"=>"(m)", "\u24A9"=>"(n)", "\u24AA"=>"(o)", "\u24AB"=>"(p)",
- "\u24AC"=>"(q)", "\u24AD"=>"(r)", "\u24AE"=>"(s)", "\u24AF"=>"(t)", "\u24B0"=>"(u)", "\u24B1"=>"(v)", "\u24B2"=>"(w)", "\u24B3"=>"(x)",
- "\u24B4"=>"(y)", "\u24B5"=>"(z)", "\u24B6"=>"A", "\u24B7"=>"B", "\u24B8"=>"C", "\u24B9"=>"D", "\u24BA"=>"E", "\u24BB"=>"F",
- "\u24BC"=>"G", "\u24BD"=>"H", "\u24BE"=>"I", "\u24BF"=>"J", "\u24C0"=>"K", "\u24C1"=>"L", "\u24C2"=>"M", "\u24C3"=>"N",
- "\u24C4"=>"O", "\u24C5"=>"P", "\u24C6"=>"Q", "\u24C7"=>"R", "\u24C8"=>"S", "\u24C9"=>"T", "\u24CA"=>"U", "\u24CB"=>"V",
- "\u24CC"=>"W", "\u24CD"=>"X", "\u24CE"=>"Y", "\u24CF"=>"Z", "\u24D0"=>"a", "\u24D1"=>"b", "\u24D2"=>"c", "\u24D3"=>"d",
- "\u24D4"=>"e", "\u24D5"=>"f", "\u24D6"=>"g", "\u24D7"=>"h", "\u24D8"=>"i", "\u24D9"=>"j", "\u24DA"=>"k", "\u24DB"=>"l",
- "\u24DC"=>"m", "\u24DD"=>"n", "\u24DE"=>"o", "\u24DF"=>"p", "\u24E0"=>"q", "\u24E1"=>"r", "\u24E2"=>"s", "\u24E3"=>"t",
- "\u24E4"=>"u", "\u24E5"=>"v", "\u24E6"=>"w", "\u24E7"=>"x", "\u24E8"=>"y", "\u24E9"=>"z", "\u24EA"=>"0", "\u2A0C"=>"\u222B\u222B\u222B\u222B",
- "\u2A74"=>"::=", "\u2A75"=>"==", "\u2A76"=>"===", "\u2C7C"=>"j", "\u2C7D"=>"V", "\u2D6F"=>"\u2D61", "\u2E9F"=>"\u6BCD", "\u2EF3"=>"\u9F9F",
- "\u2F00"=>"\u4E00", "\u2F01"=>"\u4E28", "\u2F02"=>"\u4E36", "\u2F03"=>"\u4E3F", "\u2F04"=>"\u4E59", "\u2F05"=>"\u4E85", "\u2F06"=>"\u4E8C", "\u2F07"=>"\u4EA0",
- "\u2F08"=>"\u4EBA", "\u2F09"=>"\u513F", "\u2F0A"=>"\u5165", "\u2F0B"=>"\u516B", "\u2F0C"=>"\u5182", "\u2F0D"=>"\u5196", "\u2F0E"=>"\u51AB", "\u2F0F"=>"\u51E0",
- "\u2F10"=>"\u51F5", "\u2F11"=>"\u5200", "\u2F12"=>"\u529B", "\u2F13"=>"\u52F9", "\u2F14"=>"\u5315", "\u2F15"=>"\u531A", "\u2F16"=>"\u5338", "\u2F17"=>"\u5341",
- "\u2F18"=>"\u535C", "\u2F19"=>"\u5369", "\u2F1A"=>"\u5382", "\u2F1B"=>"\u53B6", "\u2F1C"=>"\u53C8", "\u2F1D"=>"\u53E3", "\u2F1E"=>"\u56D7", "\u2F1F"=>"\u571F",
- "\u2F20"=>"\u58EB", "\u2F21"=>"\u5902", "\u2F22"=>"\u590A", "\u2F23"=>"\u5915", "\u2F24"=>"\u5927", "\u2F25"=>"\u5973", "\u2F26"=>"\u5B50", "\u2F27"=>"\u5B80",
- "\u2F28"=>"\u5BF8", "\u2F29"=>"\u5C0F", "\u2F2A"=>"\u5C22", "\u2F2B"=>"\u5C38", "\u2F2C"=>"\u5C6E", "\u2F2D"=>"\u5C71", "\u2F2E"=>"\u5DDB", "\u2F2F"=>"\u5DE5",
- "\u2F30"=>"\u5DF1", "\u2F31"=>"\u5DFE", "\u2F32"=>"\u5E72", "\u2F33"=>"\u5E7A", "\u2F34"=>"\u5E7F", "\u2F35"=>"\u5EF4", "\u2F36"=>"\u5EFE", "\u2F37"=>"\u5F0B",
- "\u2F38"=>"\u5F13", "\u2F39"=>"\u5F50", "\u2F3A"=>"\u5F61", "\u2F3B"=>"\u5F73", "\u2F3C"=>"\u5FC3", "\u2F3D"=>"\u6208", "\u2F3E"=>"\u6236", "\u2F3F"=>"\u624B",
- "\u2F40"=>"\u652F", "\u2F41"=>"\u6534", "\u2F42"=>"\u6587", "\u2F43"=>"\u6597", "\u2F44"=>"\u65A4", "\u2F45"=>"\u65B9", "\u2F46"=>"\u65E0", "\u2F47"=>"\u65E5",
- "\u2F48"=>"\u66F0", "\u2F49"=>"\u6708", "\u2F4A"=>"\u6728", "\u2F4B"=>"\u6B20", "\u2F4C"=>"\u6B62", "\u2F4D"=>"\u6B79", "\u2F4E"=>"\u6BB3", "\u2F4F"=>"\u6BCB",
- "\u2F50"=>"\u6BD4", "\u2F51"=>"\u6BDB", "\u2F52"=>"\u6C0F", "\u2F53"=>"\u6C14", "\u2F54"=>"\u6C34", "\u2F55"=>"\u706B", "\u2F56"=>"\u722A", "\u2F57"=>"\u7236",
- "\u2F58"=>"\u723B", "\u2F59"=>"\u723F", "\u2F5A"=>"\u7247", "\u2F5B"=>"\u7259", "\u2F5C"=>"\u725B", "\u2F5D"=>"\u72AC", "\u2F5E"=>"\u7384", "\u2F5F"=>"\u7389",
- "\u2F60"=>"\u74DC", "\u2F61"=>"\u74E6", "\u2F62"=>"\u7518", "\u2F63"=>"\u751F", "\u2F64"=>"\u7528", "\u2F65"=>"\u7530", "\u2F66"=>"\u758B", "\u2F67"=>"\u7592",
- "\u2F68"=>"\u7676", "\u2F69"=>"\u767D", "\u2F6A"=>"\u76AE", "\u2F6B"=>"\u76BF", "\u2F6C"=>"\u76EE", "\u2F6D"=>"\u77DB", "\u2F6E"=>"\u77E2", "\u2F6F"=>"\u77F3",
- "\u2F70"=>"\u793A", "\u2F71"=>"\u79B8", "\u2F72"=>"\u79BE", "\u2F73"=>"\u7A74", "\u2F74"=>"\u7ACB", "\u2F75"=>"\u7AF9", "\u2F76"=>"\u7C73", "\u2F77"=>"\u7CF8",
- "\u2F78"=>"\u7F36", "\u2F79"=>"\u7F51", "\u2F7A"=>"\u7F8A", "\u2F7B"=>"\u7FBD", "\u2F7C"=>"\u8001", "\u2F7D"=>"\u800C", "\u2F7E"=>"\u8012", "\u2F7F"=>"\u8033",
- "\u2F80"=>"\u807F", "\u2F81"=>"\u8089", "\u2F82"=>"\u81E3", "\u2F83"=>"\u81EA", "\u2F84"=>"\u81F3", "\u2F85"=>"\u81FC", "\u2F86"=>"\u820C", "\u2F87"=>"\u821B",
- "\u2F88"=>"\u821F", "\u2F89"=>"\u826E", "\u2F8A"=>"\u8272", "\u2F8B"=>"\u8278", "\u2F8C"=>"\u864D", "\u2F8D"=>"\u866B", "\u2F8E"=>"\u8840", "\u2F8F"=>"\u884C",
- "\u2F90"=>"\u8863", "\u2F91"=>"\u897E", "\u2F92"=>"\u898B", "\u2F93"=>"\u89D2", "\u2F94"=>"\u8A00", "\u2F95"=>"\u8C37", "\u2F96"=>"\u8C46", "\u2F97"=>"\u8C55",
- "\u2F98"=>"\u8C78", "\u2F99"=>"\u8C9D", "\u2F9A"=>"\u8D64", "\u2F9B"=>"\u8D70", "\u2F9C"=>"\u8DB3", "\u2F9D"=>"\u8EAB", "\u2F9E"=>"\u8ECA", "\u2F9F"=>"\u8F9B",
- "\u2FA0"=>"\u8FB0", "\u2FA1"=>"\u8FB5", "\u2FA2"=>"\u9091", "\u2FA3"=>"\u9149", "\u2FA4"=>"\u91C6", "\u2FA5"=>"\u91CC", "\u2FA6"=>"\u91D1", "\u2FA7"=>"\u9577",
- "\u2FA8"=>"\u9580", "\u2FA9"=>"\u961C", "\u2FAA"=>"\u96B6", "\u2FAB"=>"\u96B9", "\u2FAC"=>"\u96E8", "\u2FAD"=>"\u9751", "\u2FAE"=>"\u975E", "\u2FAF"=>"\u9762",
- "\u2FB0"=>"\u9769", "\u2FB1"=>"\u97CB", "\u2FB2"=>"\u97ED", "\u2FB3"=>"\u97F3", "\u2FB4"=>"\u9801", "\u2FB5"=>"\u98A8", "\u2FB6"=>"\u98DB", "\u2FB7"=>"\u98DF",
- "\u2FB8"=>"\u9996", "\u2FB9"=>"\u9999", "\u2FBA"=>"\u99AC", "\u2FBB"=>"\u9AA8", "\u2FBC"=>"\u9AD8", "\u2FBD"=>"\u9ADF", "\u2FBE"=>"\u9B25", "\u2FBF"=>"\u9B2F",
- "\u2FC0"=>"\u9B32", "\u2FC1"=>"\u9B3C", "\u2FC2"=>"\u9B5A", "\u2FC3"=>"\u9CE5", "\u2FC4"=>"\u9E75", "\u2FC5"=>"\u9E7F", "\u2FC6"=>"\u9EA5", "\u2FC7"=>"\u9EBB",
- "\u2FC8"=>"\u9EC3", "\u2FC9"=>"\u9ECD", "\u2FCA"=>"\u9ED1", "\u2FCB"=>"\u9EF9", "\u2FCC"=>"\u9EFD", "\u2FCD"=>"\u9F0E", "\u2FCE"=>"\u9F13", "\u2FCF"=>"\u9F20",
- "\u2FD0"=>"\u9F3B", "\u2FD1"=>"\u9F4A", "\u2FD2"=>"\u9F52", "\u2FD3"=>"\u9F8D", "\u2FD4"=>"\u9F9C", "\u2FD5"=>"\u9FA0", "\u3000"=>" ", "\u3036"=>"\u3012",
- "\u3038"=>"\u5341", "\u3039"=>"\u5344", "\u303A"=>"\u5345", "\u309B"=>" \u3099", "\u309C"=>" \u309A", "\u309F"=>"\u3088\u308A", "\u30FF"=>"\u30B3\u30C8", "\u3131"=>"\u1100",
- "\u3132"=>"\u1101", "\u3133"=>"\u11AA", "\u3134"=>"\u1102", "\u3135"=>"\u11AC", "\u3136"=>"\u11AD", "\u3137"=>"\u1103", "\u3138"=>"\u1104", "\u3139"=>"\u1105",
- "\u313A"=>"\u11B0", "\u313B"=>"\u11B1", "\u313C"=>"\u11B2", "\u313D"=>"\u11B3", "\u313E"=>"\u11B4", "\u313F"=>"\u11B5", "\u3140"=>"\u111A", "\u3141"=>"\u1106",
- "\u3142"=>"\u1107", "\u3143"=>"\u1108", "\u3144"=>"\u1121", "\u3145"=>"\u1109", "\u3146"=>"\u110A", "\u3147"=>"\u110B", "\u3148"=>"\u110C", "\u3149"=>"\u110D",
- "\u314A"=>"\u110E", "\u314B"=>"\u110F", "\u314C"=>"\u1110", "\u314D"=>"\u1111", "\u314E"=>"\u1112", "\u314F"=>"\u1161", "\u3150"=>"\u1162", "\u3151"=>"\u1163",
- "\u3152"=>"\u1164", "\u3153"=>"\u1165", "\u3154"=>"\u1166", "\u3155"=>"\u1167", "\u3156"=>"\u1168", "\u3157"=>"\u1169", "\u3158"=>"\u116A", "\u3159"=>"\u116B",
- "\u315A"=>"\u116C", "\u315B"=>"\u116D", "\u315C"=>"\u116E", "\u315D"=>"\u116F", "\u315E"=>"\u1170", "\u315F"=>"\u1171", "\u3160"=>"\u1172", "\u3161"=>"\u1173",
- "\u3162"=>"\u1174", "\u3163"=>"\u1175", "\u3164"=>"\u1160", "\u3165"=>"\u1114", "\u3166"=>"\u1115", "\u3167"=>"\u11C7", "\u3168"=>"\u11C8", "\u3169"=>"\u11CC",
- "\u316A"=>"\u11CE", "\u316B"=>"\u11D3", "\u316C"=>"\u11D7", "\u316D"=>"\u11D9", "\u316E"=>"\u111C", "\u316F"=>"\u11DD", "\u3170"=>"\u11DF", "\u3171"=>"\u111D",
- "\u3172"=>"\u111E", "\u3173"=>"\u1120", "\u3174"=>"\u1122", "\u3175"=>"\u1123", "\u3176"=>"\u1127", "\u3177"=>"\u1129", "\u3178"=>"\u112B", "\u3179"=>"\u112C",
- "\u317A"=>"\u112D", "\u317B"=>"\u112E", "\u317C"=>"\u112F", "\u317D"=>"\u1132", "\u317E"=>"\u1136", "\u317F"=>"\u1140", "\u3180"=>"\u1147", "\u3181"=>"\u114C",
- "\u3182"=>"\u11F1", "\u3183"=>"\u11F2", "\u3184"=>"\u1157", "\u3185"=>"\u1158", "\u3186"=>"\u1159", "\u3187"=>"\u1184", "\u3188"=>"\u1185", "\u3189"=>"\u1188",
- "\u318A"=>"\u1191", "\u318B"=>"\u1192", "\u318C"=>"\u1194", "\u318D"=>"\u119E", "\u318E"=>"\u11A1", "\u3192"=>"\u4E00", "\u3193"=>"\u4E8C", "\u3194"=>"\u4E09",
- "\u3195"=>"\u56DB", "\u3196"=>"\u4E0A", "\u3197"=>"\u4E2D", "\u3198"=>"\u4E0B", "\u3199"=>"\u7532", "\u319A"=>"\u4E59", "\u319B"=>"\u4E19", "\u319C"=>"\u4E01",
- "\u319D"=>"\u5929", "\u319E"=>"\u5730", "\u319F"=>"\u4EBA", "\u3200"=>"(\u1100)", "\u3201"=>"(\u1102)", "\u3202"=>"(\u1103)", "\u3203"=>"(\u1105)", "\u3204"=>"(\u1106)",
- "\u3205"=>"(\u1107)", "\u3206"=>"(\u1109)", "\u3207"=>"(\u110B)", "\u3208"=>"(\u110C)", "\u3209"=>"(\u110E)", "\u320A"=>"(\u110F)", "\u320B"=>"(\u1110)", "\u320C"=>"(\u1111)",
- "\u320D"=>"(\u1112)", "\u320E"=>"(\u1100\u1161)", "\u320F"=>"(\u1102\u1161)", "\u3210"=>"(\u1103\u1161)", "\u3211"=>"(\u1105\u1161)", "\u3212"=>"(\u1106\u1161)", "\u3213"=>"(\u1107\u1161)", "\u3214"=>"(\u1109\u1161)",
- "\u3215"=>"(\u110B\u1161)", "\u3216"=>"(\u110C\u1161)", "\u3217"=>"(\u110E\u1161)", "\u3218"=>"(\u110F\u1161)", "\u3219"=>"(\u1110\u1161)", "\u321A"=>"(\u1111\u1161)", "\u321B"=>"(\u1112\u1161)", "\u321C"=>"(\u110C\u116E)",
- "\u321D"=>"(\u110B\u1169\u110C\u1165\u11AB)", "\u321E"=>"(\u110B\u1169\u1112\u116E)", "\u3220"=>"(\u4E00)", "\u3221"=>"(\u4E8C)", "\u3222"=>"(\u4E09)", "\u3223"=>"(\u56DB)", "\u3224"=>"(\u4E94)", "\u3225"=>"(\u516D)",
- "\u3226"=>"(\u4E03)", "\u3227"=>"(\u516B)", "\u3228"=>"(\u4E5D)", "\u3229"=>"(\u5341)", "\u322A"=>"(\u6708)", "\u322B"=>"(\u706B)", "\u322C"=>"(\u6C34)", "\u322D"=>"(\u6728)",
- "\u322E"=>"(\u91D1)", "\u322F"=>"(\u571F)", "\u3230"=>"(\u65E5)", "\u3231"=>"(\u682A)", "\u3232"=>"(\u6709)", "\u3233"=>"(\u793E)", "\u3234"=>"(\u540D)", "\u3235"=>"(\u7279)",
- "\u3236"=>"(\u8CA1)", "\u3237"=>"(\u795D)", "\u3238"=>"(\u52B4)", "\u3239"=>"(\u4EE3)", "\u323A"=>"(\u547C)", "\u323B"=>"(\u5B66)", "\u323C"=>"(\u76E3)", "\u323D"=>"(\u4F01)",
- "\u323E"=>"(\u8CC7)", "\u323F"=>"(\u5354)", "\u3240"=>"(\u796D)", "\u3241"=>"(\u4F11)", "\u3242"=>"(\u81EA)", "\u3243"=>"(\u81F3)", "\u3244"=>"\u554F", "\u3245"=>"\u5E7C",
- "\u3246"=>"\u6587", "\u3247"=>"\u7B8F", "\u3250"=>"PTE", "\u3251"=>"21", "\u3252"=>"22", "\u3253"=>"23", "\u3254"=>"24", "\u3255"=>"25",
- "\u3256"=>"26", "\u3257"=>"27", "\u3258"=>"28", "\u3259"=>"29", "\u325A"=>"30", "\u325B"=>"31", "\u325C"=>"32", "\u325D"=>"33",
- "\u325E"=>"34", "\u325F"=>"35", "\u3260"=>"\u1100", "\u3261"=>"\u1102", "\u3262"=>"\u1103", "\u3263"=>"\u1105", "\u3264"=>"\u1106", "\u3265"=>"\u1107",
- "\u3266"=>"\u1109", "\u3267"=>"\u110B", "\u3268"=>"\u110C", "\u3269"=>"\u110E", "\u326A"=>"\u110F", "\u326B"=>"\u1110", "\u326C"=>"\u1111", "\u326D"=>"\u1112",
- "\u326E"=>"\u1100\u1161", "\u326F"=>"\u1102\u1161", "\u3270"=>"\u1103\u1161", "\u3271"=>"\u1105\u1161", "\u3272"=>"\u1106\u1161", "\u3273"=>"\u1107\u1161", "\u3274"=>"\u1109\u1161", "\u3275"=>"\u110B\u1161",
- "\u3276"=>"\u110C\u1161", "\u3277"=>"\u110E\u1161", "\u3278"=>"\u110F\u1161", "\u3279"=>"\u1110\u1161", "\u327A"=>"\u1111\u1161", "\u327B"=>"\u1112\u1161", "\u327C"=>"\u110E\u1161\u11B7\u1100\u1169", "\u327D"=>"\u110C\u116E\u110B\u1174",
- "\u327E"=>"\u110B\u116E", "\u3280"=>"\u4E00", "\u3281"=>"\u4E8C", "\u3282"=>"\u4E09", "\u3283"=>"\u56DB", "\u3284"=>"\u4E94", "\u3285"=>"\u516D", "\u3286"=>"\u4E03",
- "\u3287"=>"\u516B", "\u3288"=>"\u4E5D", "\u3289"=>"\u5341", "\u328A"=>"\u6708", "\u328B"=>"\u706B", "\u328C"=>"\u6C34", "\u328D"=>"\u6728", "\u328E"=>"\u91D1",
- "\u328F"=>"\u571F", "\u3290"=>"\u65E5", "\u3291"=>"\u682A", "\u3292"=>"\u6709", "\u3293"=>"\u793E", "\u3294"=>"\u540D", "\u3295"=>"\u7279", "\u3296"=>"\u8CA1",
- "\u3297"=>"\u795D", "\u3298"=>"\u52B4", "\u3299"=>"\u79D8", "\u329A"=>"\u7537", "\u329B"=>"\u5973", "\u329C"=>"\u9069", "\u329D"=>"\u512A", "\u329E"=>"\u5370",
- "\u329F"=>"\u6CE8", "\u32A0"=>"\u9805", "\u32A1"=>"\u4F11", "\u32A2"=>"\u5199", "\u32A3"=>"\u6B63", "\u32A4"=>"\u4E0A", "\u32A5"=>"\u4E2D", "\u32A6"=>"\u4E0B",
- "\u32A7"=>"\u5DE6", "\u32A8"=>"\u53F3", "\u32A9"=>"\u533B", "\u32AA"=>"\u5B97", "\u32AB"=>"\u5B66", "\u32AC"=>"\u76E3", "\u32AD"=>"\u4F01", "\u32AE"=>"\u8CC7",
- "\u32AF"=>"\u5354", "\u32B0"=>"\u591C", "\u32B1"=>"36", "\u32B2"=>"37", "\u32B3"=>"38", "\u32B4"=>"39", "\u32B5"=>"40", "\u32B6"=>"41",
- "\u32B7"=>"42", "\u32B8"=>"43", "\u32B9"=>"44", "\u32BA"=>"45", "\u32BB"=>"46", "\u32BC"=>"47", "\u32BD"=>"48", "\u32BE"=>"49",
- "\u32BF"=>"50", "\u32C0"=>"1\u6708", "\u32C1"=>"2\u6708", "\u32C2"=>"3\u6708", "\u32C3"=>"4\u6708", "\u32C4"=>"5\u6708", "\u32C5"=>"6\u6708", "\u32C6"=>"7\u6708",
- "\u32C7"=>"8\u6708", "\u32C8"=>"9\u6708", "\u32C9"=>"10\u6708", "\u32CA"=>"11\u6708", "\u32CB"=>"12\u6708", "\u32CC"=>"Hg", "\u32CD"=>"erg", "\u32CE"=>"eV",
- "\u32CF"=>"LTD", "\u32D0"=>"\u30A2", "\u32D1"=>"\u30A4", "\u32D2"=>"\u30A6", "\u32D3"=>"\u30A8", "\u32D4"=>"\u30AA", "\u32D5"=>"\u30AB", "\u32D6"=>"\u30AD",
- "\u32D7"=>"\u30AF", "\u32D8"=>"\u30B1", "\u32D9"=>"\u30B3", "\u32DA"=>"\u30B5", "\u32DB"=>"\u30B7", "\u32DC"=>"\u30B9", "\u32DD"=>"\u30BB", "\u32DE"=>"\u30BD",
- "\u32DF"=>"\u30BF", "\u32E0"=>"\u30C1", "\u32E1"=>"\u30C4", "\u32E2"=>"\u30C6", "\u32E3"=>"\u30C8", "\u32E4"=>"\u30CA", "\u32E5"=>"\u30CB", "\u32E6"=>"\u30CC",
- "\u32E7"=>"\u30CD", "\u32E8"=>"\u30CE", "\u32E9"=>"\u30CF", "\u32EA"=>"\u30D2", "\u32EB"=>"\u30D5", "\u32EC"=>"\u30D8", "\u32ED"=>"\u30DB", "\u32EE"=>"\u30DE",
- "\u32EF"=>"\u30DF", "\u32F0"=>"\u30E0", "\u32F1"=>"\u30E1", "\u32F2"=>"\u30E2", "\u32F3"=>"\u30E4", "\u32F4"=>"\u30E6", "\u32F5"=>"\u30E8", "\u32F6"=>"\u30E9",
- "\u32F7"=>"\u30EA", "\u32F8"=>"\u30EB", "\u32F9"=>"\u30EC", "\u32FA"=>"\u30ED", "\u32FB"=>"\u30EF", "\u32FC"=>"\u30F0", "\u32FD"=>"\u30F1", "\u32FE"=>"\u30F2",
- "\u3300"=>"\u30A2\u30D1\u30FC\u30C8", "\u3301"=>"\u30A2\u30EB\u30D5\u30A1", "\u3302"=>"\u30A2\u30F3\u30DA\u30A2", "\u3303"=>"\u30A2\u30FC\u30EB", "\u3304"=>"\u30A4\u30CB\u30F3\u30B0", "\u3305"=>"\u30A4\u30F3\u30C1", "\u3306"=>"\u30A6\u30A9\u30F3", "\u3307"=>"\u30A8\u30B9\u30AF\u30FC\u30C9",
- "\u3308"=>"\u30A8\u30FC\u30AB\u30FC", "\u3309"=>"\u30AA\u30F3\u30B9", "\u330A"=>"\u30AA\u30FC\u30E0", "\u330B"=>"\u30AB\u30A4\u30EA", "\u330C"=>"\u30AB\u30E9\u30C3\u30C8", "\u330D"=>"\u30AB\u30ED\u30EA\u30FC", "\u330E"=>"\u30AC\u30ED\u30F3", "\u330F"=>"\u30AC\u30F3\u30DE",
- "\u3310"=>"\u30AE\u30AC", "\u3311"=>"\u30AE\u30CB\u30FC", "\u3312"=>"\u30AD\u30E5\u30EA\u30FC", "\u3313"=>"\u30AE\u30EB\u30C0\u30FC", "\u3314"=>"\u30AD\u30ED", "\u3315"=>"\u30AD\u30ED\u30B0\u30E9\u30E0", "\u3316"=>"\u30AD\u30ED\u30E1\u30FC\u30C8\u30EB", "\u3317"=>"\u30AD\u30ED\u30EF\u30C3\u30C8",
- "\u3318"=>"\u30B0\u30E9\u30E0", "\u3319"=>"\u30B0\u30E9\u30E0\u30C8\u30F3", "\u331A"=>"\u30AF\u30EB\u30BC\u30A4\u30ED", "\u331B"=>"\u30AF\u30ED\u30FC\u30CD", "\u331C"=>"\u30B1\u30FC\u30B9", "\u331D"=>"\u30B3\u30EB\u30CA", "\u331E"=>"\u30B3\u30FC\u30DD", "\u331F"=>"\u30B5\u30A4\u30AF\u30EB",
- "\u3320"=>"\u30B5\u30F3\u30C1\u30FC\u30E0", "\u3321"=>"\u30B7\u30EA\u30F3\u30B0", "\u3322"=>"\u30BB\u30F3\u30C1", "\u3323"=>"\u30BB\u30F3\u30C8", "\u3324"=>"\u30C0\u30FC\u30B9", "\u3325"=>"\u30C7\u30B7", "\u3326"=>"\u30C9\u30EB", "\u3327"=>"\u30C8\u30F3",
- "\u3328"=>"\u30CA\u30CE", "\u3329"=>"\u30CE\u30C3\u30C8", "\u332A"=>"\u30CF\u30A4\u30C4", "\u332B"=>"\u30D1\u30FC\u30BB\u30F3\u30C8", "\u332C"=>"\u30D1\u30FC\u30C4", "\u332D"=>"\u30D0\u30FC\u30EC\u30EB", "\u332E"=>"\u30D4\u30A2\u30B9\u30C8\u30EB", "\u332F"=>"\u30D4\u30AF\u30EB",
- "\u3330"=>"\u30D4\u30B3", "\u3331"=>"\u30D3\u30EB", "\u3332"=>"\u30D5\u30A1\u30E9\u30C3\u30C9", "\u3333"=>"\u30D5\u30A3\u30FC\u30C8", "\u3334"=>"\u30D6\u30C3\u30B7\u30A7\u30EB", "\u3335"=>"\u30D5\u30E9\u30F3", "\u3336"=>"\u30D8\u30AF\u30BF\u30FC\u30EB", "\u3337"=>"\u30DA\u30BD",
- "\u3338"=>"\u30DA\u30CB\u30D2", "\u3339"=>"\u30D8\u30EB\u30C4", "\u333A"=>"\u30DA\u30F3\u30B9", "\u333B"=>"\u30DA\u30FC\u30B8", "\u333C"=>"\u30D9\u30FC\u30BF", "\u333D"=>"\u30DD\u30A4\u30F3\u30C8", "\u333E"=>"\u30DC\u30EB\u30C8", "\u333F"=>"\u30DB\u30F3",
- "\u3340"=>"\u30DD\u30F3\u30C9", "\u3341"=>"\u30DB\u30FC\u30EB", "\u3342"=>"\u30DB\u30FC\u30F3", "\u3343"=>"\u30DE\u30A4\u30AF\u30ED", "\u3344"=>"\u30DE\u30A4\u30EB", "\u3345"=>"\u30DE\u30C3\u30CF", "\u3346"=>"\u30DE\u30EB\u30AF", "\u3347"=>"\u30DE\u30F3\u30B7\u30E7\u30F3",
- "\u3348"=>"\u30DF\u30AF\u30ED\u30F3", "\u3349"=>"\u30DF\u30EA", "\u334A"=>"\u30DF\u30EA\u30D0\u30FC\u30EB", "\u334B"=>"\u30E1\u30AC", "\u334C"=>"\u30E1\u30AC\u30C8\u30F3", "\u334D"=>"\u30E1\u30FC\u30C8\u30EB", "\u334E"=>"\u30E4\u30FC\u30C9", "\u334F"=>"\u30E4\u30FC\u30EB",
- "\u3350"=>"\u30E6\u30A2\u30F3", "\u3351"=>"\u30EA\u30C3\u30C8\u30EB", "\u3352"=>"\u30EA\u30E9", "\u3353"=>"\u30EB\u30D4\u30FC", "\u3354"=>"\u30EB\u30FC\u30D6\u30EB", "\u3355"=>"\u30EC\u30E0", "\u3356"=>"\u30EC\u30F3\u30C8\u30B2\u30F3", "\u3357"=>"\u30EF\u30C3\u30C8",
- "\u3358"=>"0\u70B9", "\u3359"=>"1\u70B9", "\u335A"=>"2\u70B9", "\u335B"=>"3\u70B9", "\u335C"=>"4\u70B9", "\u335D"=>"5\u70B9", "\u335E"=>"6\u70B9", "\u335F"=>"7\u70B9",
- "\u3360"=>"8\u70B9", "\u3361"=>"9\u70B9", "\u3362"=>"10\u70B9", "\u3363"=>"11\u70B9", "\u3364"=>"12\u70B9", "\u3365"=>"13\u70B9", "\u3366"=>"14\u70B9", "\u3367"=>"15\u70B9",
- "\u3368"=>"16\u70B9", "\u3369"=>"17\u70B9", "\u336A"=>"18\u70B9", "\u336B"=>"19\u70B9", "\u336C"=>"20\u70B9", "\u336D"=>"21\u70B9", "\u336E"=>"22\u70B9", "\u336F"=>"23\u70B9",
- "\u3370"=>"24\u70B9", "\u3371"=>"hPa", "\u3372"=>"da", "\u3373"=>"AU", "\u3374"=>"bar", "\u3375"=>"oV", "\u3376"=>"pc", "\u3377"=>"dm",
- "\u3378"=>"dm2", "\u3379"=>"dm3", "\u337A"=>"IU", "\u337B"=>"\u5E73\u6210", "\u337C"=>"\u662D\u548C", "\u337D"=>"\u5927\u6B63", "\u337E"=>"\u660E\u6CBB", "\u337F"=>"\u682A\u5F0F\u4F1A\u793E",
- "\u3380"=>"pA", "\u3381"=>"nA", "\u3382"=>"\u03BCA", "\u3383"=>"mA", "\u3384"=>"kA", "\u3385"=>"KB", "\u3386"=>"MB", "\u3387"=>"GB",
- "\u3388"=>"cal", "\u3389"=>"kcal", "\u338A"=>"pF", "\u338B"=>"nF", "\u338C"=>"\u03BCF", "\u338D"=>"\u03BCg", "\u338E"=>"mg", "\u338F"=>"kg",
- "\u3390"=>"Hz", "\u3391"=>"kHz", "\u3392"=>"MHz", "\u3393"=>"GHz", "\u3394"=>"THz", "\u3395"=>"\u03BCl", "\u3396"=>"ml", "\u3397"=>"dl",
- "\u3398"=>"kl", "\u3399"=>"fm", "\u339A"=>"nm", "\u339B"=>"\u03BCm", "\u339C"=>"mm", "\u339D"=>"cm", "\u339E"=>"km", "\u339F"=>"mm2",
- "\u33A0"=>"cm2", "\u33A1"=>"m2", "\u33A2"=>"km2", "\u33A3"=>"mm3", "\u33A4"=>"cm3", "\u33A5"=>"m3", "\u33A6"=>"km3", "\u33A7"=>"m\u2215s",
- "\u33A8"=>"m\u2215s2", "\u33A9"=>"Pa", "\u33AA"=>"kPa", "\u33AB"=>"MPa", "\u33AC"=>"GPa", "\u33AD"=>"rad", "\u33AE"=>"rad\u2215s", "\u33AF"=>"rad\u2215s2",
- "\u33B0"=>"ps", "\u33B1"=>"ns", "\u33B2"=>"\u03BCs", "\u33B3"=>"ms", "\u33B4"=>"pV", "\u33B5"=>"nV", "\u33B6"=>"\u03BCV", "\u33B7"=>"mV",
- "\u33B8"=>"kV", "\u33B9"=>"MV", "\u33BA"=>"pW", "\u33BB"=>"nW", "\u33BC"=>"\u03BCW", "\u33BD"=>"mW", "\u33BE"=>"kW", "\u33BF"=>"MW",
- "\u33C0"=>"k\u03A9", "\u33C1"=>"M\u03A9", "\u33C2"=>"a.m.", "\u33C3"=>"Bq", "\u33C4"=>"cc", "\u33C5"=>"cd", "\u33C6"=>"C\u2215kg", "\u33C7"=>"Co.",
- "\u33C8"=>"dB", "\u33C9"=>"Gy", "\u33CA"=>"ha", "\u33CB"=>"HP", "\u33CC"=>"in", "\u33CD"=>"KK", "\u33CE"=>"KM", "\u33CF"=>"kt",
- "\u33D0"=>"lm", "\u33D1"=>"ln", "\u33D2"=>"log", "\u33D3"=>"lx", "\u33D4"=>"mb", "\u33D5"=>"mil", "\u33D6"=>"mol", "\u33D7"=>"PH",
- "\u33D8"=>"p.m.", "\u33D9"=>"PPM", "\u33DA"=>"PR", "\u33DB"=>"sr", "\u33DC"=>"Sv", "\u33DD"=>"Wb", "\u33DE"=>"V\u2215m", "\u33DF"=>"A\u2215m",
- "\u33E0"=>"1\u65E5", "\u33E1"=>"2\u65E5", "\u33E2"=>"3\u65E5", "\u33E3"=>"4\u65E5", "\u33E4"=>"5\u65E5", "\u33E5"=>"6\u65E5", "\u33E6"=>"7\u65E5", "\u33E7"=>"8\u65E5",
- "\u33E8"=>"9\u65E5", "\u33E9"=>"10\u65E5", "\u33EA"=>"11\u65E5", "\u33EB"=>"12\u65E5", "\u33EC"=>"13\u65E5", "\u33ED"=>"14\u65E5", "\u33EE"=>"15\u65E5", "\u33EF"=>"16\u65E5",
- "\u33F0"=>"17\u65E5", "\u33F1"=>"18\u65E5", "\u33F2"=>"19\u65E5", "\u33F3"=>"20\u65E5", "\u33F4"=>"21\u65E5", "\u33F5"=>"22\u65E5", "\u33F6"=>"23\u65E5", "\u33F7"=>"24\u65E5",
- "\u33F8"=>"25\u65E5", "\u33F9"=>"26\u65E5", "\u33FA"=>"27\u65E5", "\u33FB"=>"28\u65E5", "\u33FC"=>"29\u65E5", "\u33FD"=>"30\u65E5", "\u33FE"=>"31\u65E5", "\u33FF"=>"gal",
- "\uA69C"=>"\u044A", "\uA69D"=>"\u044C", "\uA770"=>"\uA76F", "\uA7F8"=>"\u0126", "\uA7F9"=>"\u0153", "\uAB5C"=>"\uA727", "\uAB5D"=>"\uAB37", "\uAB5E"=>"\u026B",
- "\uAB5F"=>"\uAB52", "\uFB00"=>"ff", "\uFB01"=>"fi", "\uFB02"=>"fl", "\uFB03"=>"ffi", "\uFB04"=>"ffl", "\uFB05"=>"st", "\uFB06"=>"st",
- "\uFB13"=>"\u0574\u0576", "\uFB14"=>"\u0574\u0565", "\uFB15"=>"\u0574\u056B", "\uFB16"=>"\u057E\u0576", "\uFB17"=>"\u0574\u056D", "\uFB20"=>"\u05E2", "\uFB21"=>"\u05D0", "\uFB22"=>"\u05D3",
- "\uFB23"=>"\u05D4", "\uFB24"=>"\u05DB", "\uFB25"=>"\u05DC", "\uFB26"=>"\u05DD", "\uFB27"=>"\u05E8", "\uFB28"=>"\u05EA", "\uFB29"=>"+", "\uFB4F"=>"\u05D0\u05DC",
- "\uFB50"=>"\u0671", "\uFB51"=>"\u0671", "\uFB52"=>"\u067B", "\uFB53"=>"\u067B", "\uFB54"=>"\u067B", "\uFB55"=>"\u067B", "\uFB56"=>"\u067E", "\uFB57"=>"\u067E",
- "\uFB58"=>"\u067E", "\uFB59"=>"\u067E", "\uFB5A"=>"\u0680", "\uFB5B"=>"\u0680", "\uFB5C"=>"\u0680", "\uFB5D"=>"\u0680", "\uFB5E"=>"\u067A", "\uFB5F"=>"\u067A",
- "\uFB60"=>"\u067A", "\uFB61"=>"\u067A", "\uFB62"=>"\u067F", "\uFB63"=>"\u067F", "\uFB64"=>"\u067F", "\uFB65"=>"\u067F", "\uFB66"=>"\u0679", "\uFB67"=>"\u0679",
- "\uFB68"=>"\u0679", "\uFB69"=>"\u0679", "\uFB6A"=>"\u06A4", "\uFB6B"=>"\u06A4", "\uFB6C"=>"\u06A4", "\uFB6D"=>"\u06A4", "\uFB6E"=>"\u06A6", "\uFB6F"=>"\u06A6",
- "\uFB70"=>"\u06A6", "\uFB71"=>"\u06A6", "\uFB72"=>"\u0684", "\uFB73"=>"\u0684", "\uFB74"=>"\u0684", "\uFB75"=>"\u0684", "\uFB76"=>"\u0683", "\uFB77"=>"\u0683",
- "\uFB78"=>"\u0683", "\uFB79"=>"\u0683", "\uFB7A"=>"\u0686", "\uFB7B"=>"\u0686", "\uFB7C"=>"\u0686", "\uFB7D"=>"\u0686", "\uFB7E"=>"\u0687", "\uFB7F"=>"\u0687",
- "\uFB80"=>"\u0687", "\uFB81"=>"\u0687", "\uFB82"=>"\u068D", "\uFB83"=>"\u068D", "\uFB84"=>"\u068C", "\uFB85"=>"\u068C", "\uFB86"=>"\u068E", "\uFB87"=>"\u068E",
- "\uFB88"=>"\u0688", "\uFB89"=>"\u0688", "\uFB8A"=>"\u0698", "\uFB8B"=>"\u0698", "\uFB8C"=>"\u0691", "\uFB8D"=>"\u0691", "\uFB8E"=>"\u06A9", "\uFB8F"=>"\u06A9",
- "\uFB90"=>"\u06A9", "\uFB91"=>"\u06A9", "\uFB92"=>"\u06AF", "\uFB93"=>"\u06AF", "\uFB94"=>"\u06AF", "\uFB95"=>"\u06AF", "\uFB96"=>"\u06B3", "\uFB97"=>"\u06B3",
- "\uFB98"=>"\u06B3", "\uFB99"=>"\u06B3", "\uFB9A"=>"\u06B1", "\uFB9B"=>"\u06B1", "\uFB9C"=>"\u06B1", "\uFB9D"=>"\u06B1", "\uFB9E"=>"\u06BA", "\uFB9F"=>"\u06BA",
- "\uFBA0"=>"\u06BB", "\uFBA1"=>"\u06BB", "\uFBA2"=>"\u06BB", "\uFBA3"=>"\u06BB", "\uFBA4"=>"\u06C0", "\uFBA5"=>"\u06C0", "\uFBA6"=>"\u06C1", "\uFBA7"=>"\u06C1",
- "\uFBA8"=>"\u06C1", "\uFBA9"=>"\u06C1", "\uFBAA"=>"\u06BE", "\uFBAB"=>"\u06BE", "\uFBAC"=>"\u06BE", "\uFBAD"=>"\u06BE", "\uFBAE"=>"\u06D2", "\uFBAF"=>"\u06D2",
- "\uFBB0"=>"\u06D3", "\uFBB1"=>"\u06D3", "\uFBD3"=>"\u06AD", "\uFBD4"=>"\u06AD", "\uFBD5"=>"\u06AD", "\uFBD6"=>"\u06AD", "\uFBD7"=>"\u06C7", "\uFBD8"=>"\u06C7",
- "\uFBD9"=>"\u06C6", "\uFBDA"=>"\u06C6", "\uFBDB"=>"\u06C8", "\uFBDC"=>"\u06C8", "\uFBDD"=>"\u06C7\u0674", "\uFBDE"=>"\u06CB", "\uFBDF"=>"\u06CB", "\uFBE0"=>"\u06C5",
- "\uFBE1"=>"\u06C5", "\uFBE2"=>"\u06C9", "\uFBE3"=>"\u06C9", "\uFBE4"=>"\u06D0", "\uFBE5"=>"\u06D0", "\uFBE6"=>"\u06D0", "\uFBE7"=>"\u06D0", "\uFBE8"=>"\u0649",
- "\uFBE9"=>"\u0649", "\uFBEA"=>"\u0626\u0627", "\uFBEB"=>"\u0626\u0627", "\uFBEC"=>"\u0626\u06D5", "\uFBED"=>"\u0626\u06D5", "\uFBEE"=>"\u0626\u0648", "\uFBEF"=>"\u0626\u0648", "\uFBF0"=>"\u0626\u06C7",
- "\uFBF1"=>"\u0626\u06C7", "\uFBF2"=>"\u0626\u06C6", "\uFBF3"=>"\u0626\u06C6", "\uFBF4"=>"\u0626\u06C8", "\uFBF5"=>"\u0626\u06C8", "\uFBF6"=>"\u0626\u06D0", "\uFBF7"=>"\u0626\u06D0", "\uFBF8"=>"\u0626\u06D0",
- "\uFBF9"=>"\u0626\u0649", "\uFBFA"=>"\u0626\u0649", "\uFBFB"=>"\u0626\u0649", "\uFBFC"=>"\u06CC", "\uFBFD"=>"\u06CC", "\uFBFE"=>"\u06CC", "\uFBFF"=>"\u06CC", "\uFC00"=>"\u0626\u062C",
- "\uFC01"=>"\u0626\u062D", "\uFC02"=>"\u0626\u0645", "\uFC03"=>"\u0626\u0649", "\uFC04"=>"\u0626\u064A", "\uFC05"=>"\u0628\u062C", "\uFC06"=>"\u0628\u062D", "\uFC07"=>"\u0628\u062E", "\uFC08"=>"\u0628\u0645",
- "\uFC09"=>"\u0628\u0649", "\uFC0A"=>"\u0628\u064A", "\uFC0B"=>"\u062A\u062C", "\uFC0C"=>"\u062A\u062D", "\uFC0D"=>"\u062A\u062E", "\uFC0E"=>"\u062A\u0645", "\uFC0F"=>"\u062A\u0649", "\uFC10"=>"\u062A\u064A",
- "\uFC11"=>"\u062B\u062C", "\uFC12"=>"\u062B\u0645", "\uFC13"=>"\u062B\u0649", "\uFC14"=>"\u062B\u064A", "\uFC15"=>"\u062C\u062D", "\uFC16"=>"\u062C\u0645", "\uFC17"=>"\u062D\u062C", "\uFC18"=>"\u062D\u0645",
- "\uFC19"=>"\u062E\u062C", "\uFC1A"=>"\u062E\u062D", "\uFC1B"=>"\u062E\u0645", "\uFC1C"=>"\u0633\u062C", "\uFC1D"=>"\u0633\u062D", "\uFC1E"=>"\u0633\u062E", "\uFC1F"=>"\u0633\u0645", "\uFC20"=>"\u0635\u062D",
- "\uFC21"=>"\u0635\u0645", "\uFC22"=>"\u0636\u062C", "\uFC23"=>"\u0636\u062D", "\uFC24"=>"\u0636\u062E", "\uFC25"=>"\u0636\u0645", "\uFC26"=>"\u0637\u062D", "\uFC27"=>"\u0637\u0645", "\uFC28"=>"\u0638\u0645",
- "\uFC29"=>"\u0639\u062C", "\uFC2A"=>"\u0639\u0645", "\uFC2B"=>"\u063A\u062C", "\uFC2C"=>"\u063A\u0645", "\uFC2D"=>"\u0641\u062C", "\uFC2E"=>"\u0641\u062D", "\uFC2F"=>"\u0641\u062E", "\uFC30"=>"\u0641\u0645",
- "\uFC31"=>"\u0641\u0649", "\uFC32"=>"\u0641\u064A", "\uFC33"=>"\u0642\u062D", "\uFC34"=>"\u0642\u0645", "\uFC35"=>"\u0642\u0649", "\uFC36"=>"\u0642\u064A", "\uFC37"=>"\u0643\u0627", "\uFC38"=>"\u0643\u062C",
- "\uFC39"=>"\u0643\u062D", "\uFC3A"=>"\u0643\u062E", "\uFC3B"=>"\u0643\u0644", "\uFC3C"=>"\u0643\u0645", "\uFC3D"=>"\u0643\u0649", "\uFC3E"=>"\u0643\u064A", "\uFC3F"=>"\u0644\u062C", "\uFC40"=>"\u0644\u062D",
- "\uFC41"=>"\u0644\u062E", "\uFC42"=>"\u0644\u0645", "\uFC43"=>"\u0644\u0649", "\uFC44"=>"\u0644\u064A", "\uFC45"=>"\u0645\u062C", "\uFC46"=>"\u0645\u062D", "\uFC47"=>"\u0645\u062E", "\uFC48"=>"\u0645\u0645",
- "\uFC49"=>"\u0645\u0649", "\uFC4A"=>"\u0645\u064A", "\uFC4B"=>"\u0646\u062C", "\uFC4C"=>"\u0646\u062D", "\uFC4D"=>"\u0646\u062E", "\uFC4E"=>"\u0646\u0645", "\uFC4F"=>"\u0646\u0649", "\uFC50"=>"\u0646\u064A",
- "\uFC51"=>"\u0647\u062C", "\uFC52"=>"\u0647\u0645", "\uFC53"=>"\u0647\u0649", "\uFC54"=>"\u0647\u064A", "\uFC55"=>"\u064A\u062C", "\uFC56"=>"\u064A\u062D", "\uFC57"=>"\u064A\u062E", "\uFC58"=>"\u064A\u0645",
- "\uFC59"=>"\u064A\u0649", "\uFC5A"=>"\u064A\u064A", "\uFC5B"=>"\u0630\u0670", "\uFC5C"=>"\u0631\u0670", "\uFC5D"=>"\u0649\u0670", "\uFC5E"=>" \u064C\u0651", "\uFC5F"=>" \u064D\u0651", "\uFC60"=>" \u064E\u0651",
- "\uFC61"=>" \u064F\u0651", "\uFC62"=>" \u0650\u0651", "\uFC63"=>" \u0651\u0670", "\uFC64"=>"\u0626\u0631", "\uFC65"=>"\u0626\u0632", "\uFC66"=>"\u0626\u0645", "\uFC67"=>"\u0626\u0646", "\uFC68"=>"\u0626\u0649",
- "\uFC69"=>"\u0626\u064A", "\uFC6A"=>"\u0628\u0631", "\uFC6B"=>"\u0628\u0632", "\uFC6C"=>"\u0628\u0645", "\uFC6D"=>"\u0628\u0646", "\uFC6E"=>"\u0628\u0649", "\uFC6F"=>"\u0628\u064A", "\uFC70"=>"\u062A\u0631",
- "\uFC71"=>"\u062A\u0632", "\uFC72"=>"\u062A\u0645", "\uFC73"=>"\u062A\u0646", "\uFC74"=>"\u062A\u0649", "\uFC75"=>"\u062A\u064A", "\uFC76"=>"\u062B\u0631", "\uFC77"=>"\u062B\u0632", "\uFC78"=>"\u062B\u0645",
- "\uFC79"=>"\u062B\u0646", "\uFC7A"=>"\u062B\u0649", "\uFC7B"=>"\u062B\u064A", "\uFC7C"=>"\u0641\u0649", "\uFC7D"=>"\u0641\u064A", "\uFC7E"=>"\u0642\u0649", "\uFC7F"=>"\u0642\u064A", "\uFC80"=>"\u0643\u0627",
- "\uFC81"=>"\u0643\u0644", "\uFC82"=>"\u0643\u0645", "\uFC83"=>"\u0643\u0649", "\uFC84"=>"\u0643\u064A", "\uFC85"=>"\u0644\u0645", "\uFC86"=>"\u0644\u0649", "\uFC87"=>"\u0644\u064A", "\uFC88"=>"\u0645\u0627",
- "\uFC89"=>"\u0645\u0645", "\uFC8A"=>"\u0646\u0631", "\uFC8B"=>"\u0646\u0632", "\uFC8C"=>"\u0646\u0645", "\uFC8D"=>"\u0646\u0646", "\uFC8E"=>"\u0646\u0649", "\uFC8F"=>"\u0646\u064A", "\uFC90"=>"\u0649\u0670",
- "\uFC91"=>"\u064A\u0631", "\uFC92"=>"\u064A\u0632", "\uFC93"=>"\u064A\u0645", "\uFC94"=>"\u064A\u0646", "\uFC95"=>"\u064A\u0649", "\uFC96"=>"\u064A\u064A", "\uFC97"=>"\u0626\u062C", "\uFC98"=>"\u0626\u062D",
- "\uFC99"=>"\u0626\u062E", "\uFC9A"=>"\u0626\u0645", "\uFC9B"=>"\u0626\u0647", "\uFC9C"=>"\u0628\u062C", "\uFC9D"=>"\u0628\u062D", "\uFC9E"=>"\u0628\u062E", "\uFC9F"=>"\u0628\u0645", "\uFCA0"=>"\u0628\u0647",
- "\uFCA1"=>"\u062A\u062C", "\uFCA2"=>"\u062A\u062D", "\uFCA3"=>"\u062A\u062E", "\uFCA4"=>"\u062A\u0645", "\uFCA5"=>"\u062A\u0647", "\uFCA6"=>"\u062B\u0645", "\uFCA7"=>"\u062C\u062D", "\uFCA8"=>"\u062C\u0645",
- "\uFCA9"=>"\u062D\u062C", "\uFCAA"=>"\u062D\u0645", "\uFCAB"=>"\u062E\u062C", "\uFCAC"=>"\u062E\u0645", "\uFCAD"=>"\u0633\u062C", "\uFCAE"=>"\u0633\u062D", "\uFCAF"=>"\u0633\u062E", "\uFCB0"=>"\u0633\u0645",
- "\uFCB1"=>"\u0635\u062D", "\uFCB2"=>"\u0635\u062E", "\uFCB3"=>"\u0635\u0645", "\uFCB4"=>"\u0636\u062C", "\uFCB5"=>"\u0636\u062D", "\uFCB6"=>"\u0636\u062E", "\uFCB7"=>"\u0636\u0645", "\uFCB8"=>"\u0637\u062D",
- "\uFCB9"=>"\u0638\u0645", "\uFCBA"=>"\u0639\u062C", "\uFCBB"=>"\u0639\u0645", "\uFCBC"=>"\u063A\u062C", "\uFCBD"=>"\u063A\u0645", "\uFCBE"=>"\u0641\u062C", "\uFCBF"=>"\u0641\u062D", "\uFCC0"=>"\u0641\u062E",
- "\uFCC1"=>"\u0641\u0645", "\uFCC2"=>"\u0642\u062D", "\uFCC3"=>"\u0642\u0645", "\uFCC4"=>"\u0643\u062C", "\uFCC5"=>"\u0643\u062D", "\uFCC6"=>"\u0643\u062E", "\uFCC7"=>"\u0643\u0644", "\uFCC8"=>"\u0643\u0645",
- "\uFCC9"=>"\u0644\u062C", "\uFCCA"=>"\u0644\u062D", "\uFCCB"=>"\u0644\u062E", "\uFCCC"=>"\u0644\u0645", "\uFCCD"=>"\u0644\u0647", "\uFCCE"=>"\u0645\u062C", "\uFCCF"=>"\u0645\u062D", "\uFCD0"=>"\u0645\u062E",
- "\uFCD1"=>"\u0645\u0645", "\uFCD2"=>"\u0646\u062C", "\uFCD3"=>"\u0646\u062D", "\uFCD4"=>"\u0646\u062E", "\uFCD5"=>"\u0646\u0645", "\uFCD6"=>"\u0646\u0647", "\uFCD7"=>"\u0647\u062C", "\uFCD8"=>"\u0647\u0645",
- "\uFCD9"=>"\u0647\u0670", "\uFCDA"=>"\u064A\u062C", "\uFCDB"=>"\u064A\u062D", "\uFCDC"=>"\u064A\u062E", "\uFCDD"=>"\u064A\u0645", "\uFCDE"=>"\u064A\u0647", "\uFCDF"=>"\u0626\u0645", "\uFCE0"=>"\u0626\u0647",
- "\uFCE1"=>"\u0628\u0645", "\uFCE2"=>"\u0628\u0647", "\uFCE3"=>"\u062A\u0645", "\uFCE4"=>"\u062A\u0647", "\uFCE5"=>"\u062B\u0645", "\uFCE6"=>"\u062B\u0647", "\uFCE7"=>"\u0633\u0645", "\uFCE8"=>"\u0633\u0647",
- "\uFCE9"=>"\u0634\u0645", "\uFCEA"=>"\u0634\u0647", "\uFCEB"=>"\u0643\u0644", "\uFCEC"=>"\u0643\u0645", "\uFCED"=>"\u0644\u0645", "\uFCEE"=>"\u0646\u0645", "\uFCEF"=>"\u0646\u0647", "\uFCF0"=>"\u064A\u0645",
- "\uFCF1"=>"\u064A\u0647", "\uFCF2"=>"\u0640\u064E\u0651", "\uFCF3"=>"\u0640\u064F\u0651", "\uFCF4"=>"\u0640\u0650\u0651", "\uFCF5"=>"\u0637\u0649", "\uFCF6"=>"\u0637\u064A", "\uFCF7"=>"\u0639\u0649", "\uFCF8"=>"\u0639\u064A",
- "\uFCF9"=>"\u063A\u0649", "\uFCFA"=>"\u063A\u064A", "\uFCFB"=>"\u0633\u0649", "\uFCFC"=>"\u0633\u064A", "\uFCFD"=>"\u0634\u0649", "\uFCFE"=>"\u0634\u064A", "\uFCFF"=>"\u062D\u0649", "\uFD00"=>"\u062D\u064A",
- "\uFD01"=>"\u062C\u0649", "\uFD02"=>"\u062C\u064A", "\uFD03"=>"\u062E\u0649", "\uFD04"=>"\u062E\u064A", "\uFD05"=>"\u0635\u0649", "\uFD06"=>"\u0635\u064A", "\uFD07"=>"\u0636\u0649", "\uFD08"=>"\u0636\u064A",
- "\uFD09"=>"\u0634\u062C", "\uFD0A"=>"\u0634\u062D", "\uFD0B"=>"\u0634\u062E", "\uFD0C"=>"\u0634\u0645", "\uFD0D"=>"\u0634\u0631", "\uFD0E"=>"\u0633\u0631", "\uFD0F"=>"\u0635\u0631", "\uFD10"=>"\u0636\u0631",
- "\uFD11"=>"\u0637\u0649", "\uFD12"=>"\u0637\u064A", "\uFD13"=>"\u0639\u0649", "\uFD14"=>"\u0639\u064A", "\uFD15"=>"\u063A\u0649", "\uFD16"=>"\u063A\u064A", "\uFD17"=>"\u0633\u0649", "\uFD18"=>"\u0633\u064A",
- "\uFD19"=>"\u0634\u0649", "\uFD1A"=>"\u0634\u064A", "\uFD1B"=>"\u062D\u0649", "\uFD1C"=>"\u062D\u064A", "\uFD1D"=>"\u062C\u0649", "\uFD1E"=>"\u062C\u064A", "\uFD1F"=>"\u062E\u0649", "\uFD20"=>"\u062E\u064A",
- "\uFD21"=>"\u0635\u0649", "\uFD22"=>"\u0635\u064A", "\uFD23"=>"\u0636\u0649", "\uFD24"=>"\u0636\u064A", "\uFD25"=>"\u0634\u062C", "\uFD26"=>"\u0634\u062D", "\uFD27"=>"\u0634\u062E", "\uFD28"=>"\u0634\u0645",
- "\uFD29"=>"\u0634\u0631", "\uFD2A"=>"\u0633\u0631", "\uFD2B"=>"\u0635\u0631", "\uFD2C"=>"\u0636\u0631", "\uFD2D"=>"\u0634\u062C", "\uFD2E"=>"\u0634\u062D", "\uFD2F"=>"\u0634\u062E", "\uFD30"=>"\u0634\u0645",
- "\uFD31"=>"\u0633\u0647", "\uFD32"=>"\u0634\u0647", "\uFD33"=>"\u0637\u0645", "\uFD34"=>"\u0633\u062C", "\uFD35"=>"\u0633\u062D", "\uFD36"=>"\u0633\u062E", "\uFD37"=>"\u0634\u062C", "\uFD38"=>"\u0634\u062D",
- "\uFD39"=>"\u0634\u062E", "\uFD3A"=>"\u0637\u0645", "\uFD3B"=>"\u0638\u0645", "\uFD3C"=>"\u0627\u064B", "\uFD3D"=>"\u0627\u064B", "\uFD50"=>"\u062A\u062C\u0645", "\uFD51"=>"\u062A\u062D\u062C", "\uFD52"=>"\u062A\u062D\u062C",
- "\uFD53"=>"\u062A\u062D\u0645", "\uFD54"=>"\u062A\u062E\u0645", "\uFD55"=>"\u062A\u0645\u062C", "\uFD56"=>"\u062A\u0645\u062D", "\uFD57"=>"\u062A\u0645\u062E", "\uFD58"=>"\u062C\u0645\u062D", "\uFD59"=>"\u062C\u0645\u062D", "\uFD5A"=>"\u062D\u0645\u064A",
- "\uFD5B"=>"\u062D\u0645\u0649", "\uFD5C"=>"\u0633\u062D\u062C", "\uFD5D"=>"\u0633\u062C\u062D", "\uFD5E"=>"\u0633\u062C\u0649", "\uFD5F"=>"\u0633\u0645\u062D", "\uFD60"=>"\u0633\u0645\u062D", "\uFD61"=>"\u0633\u0645\u062C", "\uFD62"=>"\u0633\u0645\u0645",
- "\uFD63"=>"\u0633\u0645\u0645", "\uFD64"=>"\u0635\u062D\u062D", "\uFD65"=>"\u0635\u062D\u062D", "\uFD66"=>"\u0635\u0645\u0645", "\uFD67"=>"\u0634\u062D\u0645", "\uFD68"=>"\u0634\u062D\u0645", "\uFD69"=>"\u0634\u062C\u064A", "\uFD6A"=>"\u0634\u0645\u062E",
- "\uFD6B"=>"\u0634\u0645\u062E", "\uFD6C"=>"\u0634\u0645\u0645", "\uFD6D"=>"\u0634\u0645\u0645", "\uFD6E"=>"\u0636\u062D\u0649", "\uFD6F"=>"\u0636\u062E\u0645", "\uFD70"=>"\u0636\u062E\u0645", "\uFD71"=>"\u0637\u0645\u062D", "\uFD72"=>"\u0637\u0645\u062D",
- "\uFD73"=>"\u0637\u0645\u0645", "\uFD74"=>"\u0637\u0645\u064A", "\uFD75"=>"\u0639\u062C\u0645", "\uFD76"=>"\u0639\u0645\u0645", "\uFD77"=>"\u0639\u0645\u0645", "\uFD78"=>"\u0639\u0645\u0649", "\uFD79"=>"\u063A\u0645\u0645", "\uFD7A"=>"\u063A\u0645\u064A",
- "\uFD7B"=>"\u063A\u0645\u0649", "\uFD7C"=>"\u0641\u062E\u0645", "\uFD7D"=>"\u0641\u062E\u0645", "\uFD7E"=>"\u0642\u0645\u062D", "\uFD7F"=>"\u0642\u0645\u0645", "\uFD80"=>"\u0644\u062D\u0645", "\uFD81"=>"\u0644\u062D\u064A", "\uFD82"=>"\u0644\u062D\u0649",
- "\uFD83"=>"\u0644\u062C\u062C", "\uFD84"=>"\u0644\u062C\u062C", "\uFD85"=>"\u0644\u062E\u0645", "\uFD86"=>"\u0644\u062E\u0645", "\uFD87"=>"\u0644\u0645\u062D", "\uFD88"=>"\u0644\u0645\u062D", "\uFD89"=>"\u0645\u062D\u062C", "\uFD8A"=>"\u0645\u062D\u0645",
- "\uFD8B"=>"\u0645\u062D\u064A", "\uFD8C"=>"\u0645\u062C\u062D", "\uFD8D"=>"\u0645\u062C\u0645", "\uFD8E"=>"\u0645\u062E\u062C", "\uFD8F"=>"\u0645\u062E\u0645", "\uFD92"=>"\u0645\u062C\u062E", "\uFD93"=>"\u0647\u0645\u062C", "\uFD94"=>"\u0647\u0645\u0645",
- "\uFD95"=>"\u0646\u062D\u0645", "\uFD96"=>"\u0646\u062D\u0649", "\uFD97"=>"\u0646\u062C\u0645", "\uFD98"=>"\u0646\u062C\u0645", "\uFD99"=>"\u0646\u062C\u0649", "\uFD9A"=>"\u0646\u0645\u064A", "\uFD9B"=>"\u0646\u0645\u0649", "\uFD9C"=>"\u064A\u0645\u0645",
- "\uFD9D"=>"\u064A\u0645\u0645", "\uFD9E"=>"\u0628\u062E\u064A", "\uFD9F"=>"\u062A\u062C\u064A", "\uFDA0"=>"\u062A\u062C\u0649", "\uFDA1"=>"\u062A\u062E\u064A", "\uFDA2"=>"\u062A\u062E\u0649", "\uFDA3"=>"\u062A\u0645\u064A", "\uFDA4"=>"\u062A\u0645\u0649",
- "\uFDA5"=>"\u062C\u0645\u064A", "\uFDA6"=>"\u062C\u062D\u0649", "\uFDA7"=>"\u062C\u0645\u0649", "\uFDA8"=>"\u0633\u062E\u0649", "\uFDA9"=>"\u0635\u062D\u064A", "\uFDAA"=>"\u0634\u062D\u064A", "\uFDAB"=>"\u0636\u062D\u064A", "\uFDAC"=>"\u0644\u062C\u064A",
- "\uFDAD"=>"\u0644\u0645\u064A", "\uFDAE"=>"\u064A\u062D\u064A", "\uFDAF"=>"\u064A\u062C\u064A", "\uFDB0"=>"\u064A\u0645\u064A", "\uFDB1"=>"\u0645\u0645\u064A", "\uFDB2"=>"\u0642\u0645\u064A", "\uFDB3"=>"\u0646\u062D\u064A", "\uFDB4"=>"\u0642\u0645\u062D",
- "\uFDB5"=>"\u0644\u062D\u0645", "\uFDB6"=>"\u0639\u0645\u064A", "\uFDB7"=>"\u0643\u0645\u064A", "\uFDB8"=>"\u0646\u062C\u062D", "\uFDB9"=>"\u0645\u062E\u064A", "\uFDBA"=>"\u0644\u062C\u0645", "\uFDBB"=>"\u0643\u0645\u0645", "\uFDBC"=>"\u0644\u062C\u0645",
- "\uFDBD"=>"\u0646\u062C\u062D", "\uFDBE"=>"\u062C\u062D\u064A", "\uFDBF"=>"\u062D\u062C\u064A", "\uFDC0"=>"\u0645\u062C\u064A", "\uFDC1"=>"\u0641\u0645\u064A", "\uFDC2"=>"\u0628\u062D\u064A", "\uFDC3"=>"\u0643\u0645\u0645", "\uFDC4"=>"\u0639\u062C\u0645",
- "\uFDC5"=>"\u0635\u0645\u0645", "\uFDC6"=>"\u0633\u062E\u064A", "\uFDC7"=>"\u0646\u062C\u064A", "\uFDF0"=>"\u0635\u0644\u06D2", "\uFDF1"=>"\u0642\u0644\u06D2", "\uFDF2"=>"\u0627\u0644\u0644\u0647", "\uFDF3"=>"\u0627\u0643\u0628\u0631", "\uFDF4"=>"\u0645\u062D\u0645\u062F",
- "\uFDF5"=>"\u0635\u0644\u0639\u0645", "\uFDF6"=>"\u0631\u0633\u0648\u0644", "\uFDF7"=>"\u0639\u0644\u064A\u0647", "\uFDF8"=>"\u0648\u0633\u0644\u0645", "\uFDF9"=>"\u0635\u0644\u0649", "\uFDFA"=>"\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064A\u0647 \u0648\u0633\u0644\u0645", "\uFDFB"=>"\u062C\u0644 \u062C\u0644\u0627\u0644\u0647", "\uFDFC"=>"\u0631\u06CC\u0627\u0644",
- "\uFE10"=>",", "\uFE11"=>"\u3001", "\uFE12"=>"\u3002", "\uFE13"=>":", "\uFE14"=>";", "\uFE15"=>"!", "\uFE16"=>"?", "\uFE17"=>"\u3016",
- "\uFE18"=>"\u3017", "\uFE19"=>"...", "\uFE30"=>"..", "\uFE31"=>"\u2014", "\uFE32"=>"\u2013", "\uFE33"=>"_", "\uFE34"=>"_", "\uFE35"=>"(",
- "\uFE36"=>")", "\uFE37"=>"{", "\uFE38"=>"}", "\uFE39"=>"\u3014", "\uFE3A"=>"\u3015", "\uFE3B"=>"\u3010", "\uFE3C"=>"\u3011", "\uFE3D"=>"\u300A",
- "\uFE3E"=>"\u300B", "\uFE3F"=>"\u3008", "\uFE40"=>"\u3009", "\uFE41"=>"\u300C", "\uFE42"=>"\u300D", "\uFE43"=>"\u300E", "\uFE44"=>"\u300F", "\uFE47"=>"[",
- "\uFE48"=>"]", "\uFE49"=>" \u0305", "\uFE4A"=>" \u0305", "\uFE4B"=>" \u0305", "\uFE4C"=>" \u0305", "\uFE4D"=>"_", "\uFE4E"=>"_", "\uFE4F"=>"_",
- "\uFE50"=>",", "\uFE51"=>"\u3001", "\uFE52"=>".", "\uFE54"=>";", "\uFE55"=>":", "\uFE56"=>"?", "\uFE57"=>"!", "\uFE58"=>"\u2014",
- "\uFE59"=>"(", "\uFE5A"=>")", "\uFE5B"=>"{", "\uFE5C"=>"}", "\uFE5D"=>"\u3014", "\uFE5E"=>"\u3015", "\uFE5F"=>"#", "\uFE60"=>"&",
- "\uFE61"=>"*", "\uFE62"=>"+", "\uFE63"=>"-", "\uFE64"=>"<", "\uFE65"=>">", "\uFE66"=>"=", "\uFE68"=>"\\", "\uFE69"=>"$",
- "\uFE6A"=>"%", "\uFE6B"=>"@", "\uFE70"=>" \u064B", "\uFE71"=>"\u0640\u064B", "\uFE72"=>" \u064C", "\uFE74"=>" \u064D", "\uFE76"=>" \u064E", "\uFE77"=>"\u0640\u064E",
- "\uFE78"=>" \u064F", "\uFE79"=>"\u0640\u064F", "\uFE7A"=>" \u0650", "\uFE7B"=>"\u0640\u0650", "\uFE7C"=>" \u0651", "\uFE7D"=>"\u0640\u0651", "\uFE7E"=>" \u0652", "\uFE7F"=>"\u0640\u0652",
- "\uFE80"=>"\u0621", "\uFE81"=>"\u0622", "\uFE82"=>"\u0622", "\uFE83"=>"\u0623", "\uFE84"=>"\u0623", "\uFE85"=>"\u0624", "\uFE86"=>"\u0624", "\uFE87"=>"\u0625",
- "\uFE88"=>"\u0625", "\uFE89"=>"\u0626", "\uFE8A"=>"\u0626", "\uFE8B"=>"\u0626", "\uFE8C"=>"\u0626", "\uFE8D"=>"\u0627", "\uFE8E"=>"\u0627", "\uFE8F"=>"\u0628",
- "\uFE90"=>"\u0628", "\uFE91"=>"\u0628", "\uFE92"=>"\u0628", "\uFE93"=>"\u0629", "\uFE94"=>"\u0629", "\uFE95"=>"\u062A", "\uFE96"=>"\u062A", "\uFE97"=>"\u062A",
- "\uFE98"=>"\u062A", "\uFE99"=>"\u062B", "\uFE9A"=>"\u062B", "\uFE9B"=>"\u062B", "\uFE9C"=>"\u062B", "\uFE9D"=>"\u062C", "\uFE9E"=>"\u062C", "\uFE9F"=>"\u062C",
- "\uFEA0"=>"\u062C", "\uFEA1"=>"\u062D", "\uFEA2"=>"\u062D", "\uFEA3"=>"\u062D", "\uFEA4"=>"\u062D", "\uFEA5"=>"\u062E", "\uFEA6"=>"\u062E", "\uFEA7"=>"\u062E",
- "\uFEA8"=>"\u062E", "\uFEA9"=>"\u062F", "\uFEAA"=>"\u062F", "\uFEAB"=>"\u0630", "\uFEAC"=>"\u0630", "\uFEAD"=>"\u0631", "\uFEAE"=>"\u0631", "\uFEAF"=>"\u0632",
- "\uFEB0"=>"\u0632", "\uFEB1"=>"\u0633", "\uFEB2"=>"\u0633", "\uFEB3"=>"\u0633", "\uFEB4"=>"\u0633", "\uFEB5"=>"\u0634", "\uFEB6"=>"\u0634", "\uFEB7"=>"\u0634",
- "\uFEB8"=>"\u0634", "\uFEB9"=>"\u0635", "\uFEBA"=>"\u0635", "\uFEBB"=>"\u0635", "\uFEBC"=>"\u0635", "\uFEBD"=>"\u0636", "\uFEBE"=>"\u0636", "\uFEBF"=>"\u0636",
- "\uFEC0"=>"\u0636", "\uFEC1"=>"\u0637", "\uFEC2"=>"\u0637", "\uFEC3"=>"\u0637", "\uFEC4"=>"\u0637", "\uFEC5"=>"\u0638", "\uFEC6"=>"\u0638", "\uFEC7"=>"\u0638",
- "\uFEC8"=>"\u0638", "\uFEC9"=>"\u0639", "\uFECA"=>"\u0639", "\uFECB"=>"\u0639", "\uFECC"=>"\u0639", "\uFECD"=>"\u063A", "\uFECE"=>"\u063A", "\uFECF"=>"\u063A",
- "\uFED0"=>"\u063A", "\uFED1"=>"\u0641", "\uFED2"=>"\u0641", "\uFED3"=>"\u0641", "\uFED4"=>"\u0641", "\uFED5"=>"\u0642", "\uFED6"=>"\u0642", "\uFED7"=>"\u0642",
- "\uFED8"=>"\u0642", "\uFED9"=>"\u0643", "\uFEDA"=>"\u0643", "\uFEDB"=>"\u0643", "\uFEDC"=>"\u0643", "\uFEDD"=>"\u0644", "\uFEDE"=>"\u0644", "\uFEDF"=>"\u0644",
- "\uFEE0"=>"\u0644", "\uFEE1"=>"\u0645", "\uFEE2"=>"\u0645", "\uFEE3"=>"\u0645", "\uFEE4"=>"\u0645", "\uFEE5"=>"\u0646", "\uFEE6"=>"\u0646", "\uFEE7"=>"\u0646",
- "\uFEE8"=>"\u0646", "\uFEE9"=>"\u0647", "\uFEEA"=>"\u0647", "\uFEEB"=>"\u0647", "\uFEEC"=>"\u0647", "\uFEED"=>"\u0648", "\uFEEE"=>"\u0648", "\uFEEF"=>"\u0649",
- "\uFEF0"=>"\u0649", "\uFEF1"=>"\u064A", "\uFEF2"=>"\u064A", "\uFEF3"=>"\u064A", "\uFEF4"=>"\u064A", "\uFEF5"=>"\u0644\u0622", "\uFEF6"=>"\u0644\u0622", "\uFEF7"=>"\u0644\u0623",
- "\uFEF8"=>"\u0644\u0623", "\uFEF9"=>"\u0644\u0625", "\uFEFA"=>"\u0644\u0625", "\uFEFB"=>"\u0644\u0627", "\uFEFC"=>"\u0644\u0627", "\uFF01"=>"!", "\uFF02"=>"\"", "\uFF03"=>"#",
- "\uFF04"=>"$", "\uFF05"=>"%", "\uFF06"=>"&", "\uFF07"=>"'", "\uFF08"=>"(", "\uFF09"=>")", "\uFF0A"=>"*", "\uFF0B"=>"+",
- "\uFF0C"=>",", "\uFF0D"=>"-", "\uFF0E"=>".", "\uFF0F"=>"/", "\uFF10"=>"0", "\uFF11"=>"1", "\uFF12"=>"2", "\uFF13"=>"3",
- "\uFF14"=>"4", "\uFF15"=>"5", "\uFF16"=>"6", "\uFF17"=>"7", "\uFF18"=>"8", "\uFF19"=>"9", "\uFF1A"=>":", "\uFF1B"=>";",
- "\uFF1C"=>"<", "\uFF1D"=>"=", "\uFF1E"=>">", "\uFF1F"=>"?", "\uFF20"=>"@", "\uFF21"=>"A", "\uFF22"=>"B", "\uFF23"=>"C",
- "\uFF24"=>"D", "\uFF25"=>"E", "\uFF26"=>"F", "\uFF27"=>"G", "\uFF28"=>"H", "\uFF29"=>"I", "\uFF2A"=>"J", "\uFF2B"=>"K",
- "\uFF2C"=>"L", "\uFF2D"=>"M", "\uFF2E"=>"N", "\uFF2F"=>"O", "\uFF30"=>"P", "\uFF31"=>"Q", "\uFF32"=>"R", "\uFF33"=>"S",
- "\uFF34"=>"T", "\uFF35"=>"U", "\uFF36"=>"V", "\uFF37"=>"W", "\uFF38"=>"X", "\uFF39"=>"Y", "\uFF3A"=>"Z", "\uFF3B"=>"[",
- "\uFF3C"=>"\\", "\uFF3D"=>"]", "\uFF3E"=>"^", "\uFF3F"=>"_", "\uFF40"=>"`", "\uFF41"=>"a", "\uFF42"=>"b", "\uFF43"=>"c",
- "\uFF44"=>"d", "\uFF45"=>"e", "\uFF46"=>"f", "\uFF47"=>"g", "\uFF48"=>"h", "\uFF49"=>"i", "\uFF4A"=>"j", "\uFF4B"=>"k",
- "\uFF4C"=>"l", "\uFF4D"=>"m", "\uFF4E"=>"n", "\uFF4F"=>"o", "\uFF50"=>"p", "\uFF51"=>"q", "\uFF52"=>"r", "\uFF53"=>"s",
- "\uFF54"=>"t", "\uFF55"=>"u", "\uFF56"=>"v", "\uFF57"=>"w", "\uFF58"=>"x", "\uFF59"=>"y", "\uFF5A"=>"z", "\uFF5B"=>"{",
- "\uFF5C"=>"|", "\uFF5D"=>"}", "\uFF5E"=>"~", "\uFF5F"=>"\u2985", "\uFF60"=>"\u2986", "\uFF61"=>"\u3002", "\uFF62"=>"\u300C", "\uFF63"=>"\u300D",
- "\uFF64"=>"\u3001", "\uFF65"=>"\u30FB", "\uFF66"=>"\u30F2", "\uFF67"=>"\u30A1", "\uFF68"=>"\u30A3", "\uFF69"=>"\u30A5", "\uFF6A"=>"\u30A7", "\uFF6B"=>"\u30A9",
- "\uFF6C"=>"\u30E3", "\uFF6D"=>"\u30E5", "\uFF6E"=>"\u30E7", "\uFF6F"=>"\u30C3", "\uFF70"=>"\u30FC", "\uFF71"=>"\u30A2", "\uFF72"=>"\u30A4", "\uFF73"=>"\u30A6",
- "\uFF74"=>"\u30A8", "\uFF75"=>"\u30AA", "\uFF76"=>"\u30AB", "\uFF77"=>"\u30AD", "\uFF78"=>"\u30AF", "\uFF79"=>"\u30B1", "\uFF7A"=>"\u30B3", "\uFF7B"=>"\u30B5",
- "\uFF7C"=>"\u30B7", "\uFF7D"=>"\u30B9", "\uFF7E"=>"\u30BB", "\uFF7F"=>"\u30BD", "\uFF80"=>"\u30BF", "\uFF81"=>"\u30C1", "\uFF82"=>"\u30C4", "\uFF83"=>"\u30C6",
- "\uFF84"=>"\u30C8", "\uFF85"=>"\u30CA", "\uFF86"=>"\u30CB", "\uFF87"=>"\u30CC", "\uFF88"=>"\u30CD", "\uFF89"=>"\u30CE", "\uFF8A"=>"\u30CF", "\uFF8B"=>"\u30D2",
- "\uFF8C"=>"\u30D5", "\uFF8D"=>"\u30D8", "\uFF8E"=>"\u30DB", "\uFF8F"=>"\u30DE", "\uFF90"=>"\u30DF", "\uFF91"=>"\u30E0", "\uFF92"=>"\u30E1", "\uFF93"=>"\u30E2",
- "\uFF94"=>"\u30E4", "\uFF95"=>"\u30E6", "\uFF96"=>"\u30E8", "\uFF97"=>"\u30E9", "\uFF98"=>"\u30EA", "\uFF99"=>"\u30EB", "\uFF9A"=>"\u30EC", "\uFF9B"=>"\u30ED",
- "\uFF9C"=>"\u30EF", "\uFF9D"=>"\u30F3", "\uFF9E"=>"\u3099", "\uFF9F"=>"\u309A", "\uFFA0"=>"\u1160", "\uFFA1"=>"\u1100", "\uFFA2"=>"\u1101", "\uFFA3"=>"\u11AA",
- "\uFFA4"=>"\u1102", "\uFFA5"=>"\u11AC", "\uFFA6"=>"\u11AD", "\uFFA7"=>"\u1103", "\uFFA8"=>"\u1104", "\uFFA9"=>"\u1105", "\uFFAA"=>"\u11B0", "\uFFAB"=>"\u11B1",
- "\uFFAC"=>"\u11B2", "\uFFAD"=>"\u11B3", "\uFFAE"=>"\u11B4", "\uFFAF"=>"\u11B5", "\uFFB0"=>"\u111A", "\uFFB1"=>"\u1106", "\uFFB2"=>"\u1107", "\uFFB3"=>"\u1108",
- "\uFFB4"=>"\u1121", "\uFFB5"=>"\u1109", "\uFFB6"=>"\u110A", "\uFFB7"=>"\u110B", "\uFFB8"=>"\u110C", "\uFFB9"=>"\u110D", "\uFFBA"=>"\u110E", "\uFFBB"=>"\u110F",
- "\uFFBC"=>"\u1110", "\uFFBD"=>"\u1111", "\uFFBE"=>"\u1112", "\uFFC2"=>"\u1161", "\uFFC3"=>"\u1162", "\uFFC4"=>"\u1163", "\uFFC5"=>"\u1164", "\uFFC6"=>"\u1165",
- "\uFFC7"=>"\u1166", "\uFFCA"=>"\u1167", "\uFFCB"=>"\u1168", "\uFFCC"=>"\u1169", "\uFFCD"=>"\u116A", "\uFFCE"=>"\u116B", "\uFFCF"=>"\u116C", "\uFFD2"=>"\u116D",
- "\uFFD3"=>"\u116E", "\uFFD4"=>"\u116F", "\uFFD5"=>"\u1170", "\uFFD6"=>"\u1171", "\uFFD7"=>"\u1172", "\uFFDA"=>"\u1173", "\uFFDB"=>"\u1174", "\uFFDC"=>"\u1175",
- "\uFFE0"=>"\u00A2", "\uFFE1"=>"\u00A3", "\uFFE2"=>"\u00AC", "\uFFE3"=>" \u0304", "\uFFE4"=>"\u00A6", "\uFFE5"=>"\u00A5", "\uFFE6"=>"\u20A9", "\uFFE8"=>"\u2502",
- "\uFFE9"=>"\u2190", "\uFFEA"=>"\u2191", "\uFFEB"=>"\u2192", "\uFFEC"=>"\u2193", "\uFFED"=>"\u25A0", "\uFFEE"=>"\u25CB", "\u{1D400}"=>"A", "\u{1D401}"=>"B",
- "\u{1D402}"=>"C", "\u{1D403}"=>"D", "\u{1D404}"=>"E", "\u{1D405}"=>"F", "\u{1D406}"=>"G", "\u{1D407}"=>"H", "\u{1D408}"=>"I", "\u{1D409}"=>"J",
- "\u{1D40A}"=>"K", "\u{1D40B}"=>"L", "\u{1D40C}"=>"M", "\u{1D40D}"=>"N", "\u{1D40E}"=>"O", "\u{1D40F}"=>"P", "\u{1D410}"=>"Q", "\u{1D411}"=>"R",
- "\u{1D412}"=>"S", "\u{1D413}"=>"T", "\u{1D414}"=>"U", "\u{1D415}"=>"V", "\u{1D416}"=>"W", "\u{1D417}"=>"X", "\u{1D418}"=>"Y", "\u{1D419}"=>"Z",
- "\u{1D41A}"=>"a", "\u{1D41B}"=>"b", "\u{1D41C}"=>"c", "\u{1D41D}"=>"d", "\u{1D41E}"=>"e", "\u{1D41F}"=>"f", "\u{1D420}"=>"g", "\u{1D421}"=>"h",
- "\u{1D422}"=>"i", "\u{1D423}"=>"j", "\u{1D424}"=>"k", "\u{1D425}"=>"l", "\u{1D426}"=>"m", "\u{1D427}"=>"n", "\u{1D428}"=>"o", "\u{1D429}"=>"p",
- "\u{1D42A}"=>"q", "\u{1D42B}"=>"r", "\u{1D42C}"=>"s", "\u{1D42D}"=>"t", "\u{1D42E}"=>"u", "\u{1D42F}"=>"v", "\u{1D430}"=>"w", "\u{1D431}"=>"x",
- "\u{1D432}"=>"y", "\u{1D433}"=>"z", "\u{1D434}"=>"A", "\u{1D435}"=>"B", "\u{1D436}"=>"C", "\u{1D437}"=>"D", "\u{1D438}"=>"E", "\u{1D439}"=>"F",
- "\u{1D43A}"=>"G", "\u{1D43B}"=>"H", "\u{1D43C}"=>"I", "\u{1D43D}"=>"J", "\u{1D43E}"=>"K", "\u{1D43F}"=>"L", "\u{1D440}"=>"M", "\u{1D441}"=>"N",
- "\u{1D442}"=>"O", "\u{1D443}"=>"P", "\u{1D444}"=>"Q", "\u{1D445}"=>"R", "\u{1D446}"=>"S", "\u{1D447}"=>"T", "\u{1D448}"=>"U", "\u{1D449}"=>"V",
- "\u{1D44A}"=>"W", "\u{1D44B}"=>"X", "\u{1D44C}"=>"Y", "\u{1D44D}"=>"Z", "\u{1D44E}"=>"a", "\u{1D44F}"=>"b", "\u{1D450}"=>"c", "\u{1D451}"=>"d",
- "\u{1D452}"=>"e", "\u{1D453}"=>"f", "\u{1D454}"=>"g", "\u{1D456}"=>"i", "\u{1D457}"=>"j", "\u{1D458}"=>"k", "\u{1D459}"=>"l", "\u{1D45A}"=>"m",
- "\u{1D45B}"=>"n", "\u{1D45C}"=>"o", "\u{1D45D}"=>"p", "\u{1D45E}"=>"q", "\u{1D45F}"=>"r", "\u{1D460}"=>"s", "\u{1D461}"=>"t", "\u{1D462}"=>"u",
- "\u{1D463}"=>"v", "\u{1D464}"=>"w", "\u{1D465}"=>"x", "\u{1D466}"=>"y", "\u{1D467}"=>"z", "\u{1D468}"=>"A", "\u{1D469}"=>"B", "\u{1D46A}"=>"C",
- "\u{1D46B}"=>"D", "\u{1D46C}"=>"E", "\u{1D46D}"=>"F", "\u{1D46E}"=>"G", "\u{1D46F}"=>"H", "\u{1D470}"=>"I", "\u{1D471}"=>"J", "\u{1D472}"=>"K",
- "\u{1D473}"=>"L", "\u{1D474}"=>"M", "\u{1D475}"=>"N", "\u{1D476}"=>"O", "\u{1D477}"=>"P", "\u{1D478}"=>"Q", "\u{1D479}"=>"R", "\u{1D47A}"=>"S",
- "\u{1D47B}"=>"T", "\u{1D47C}"=>"U", "\u{1D47D}"=>"V", "\u{1D47E}"=>"W", "\u{1D47F}"=>"X", "\u{1D480}"=>"Y", "\u{1D481}"=>"Z", "\u{1D482}"=>"a",
- "\u{1D483}"=>"b", "\u{1D484}"=>"c", "\u{1D485}"=>"d", "\u{1D486}"=>"e", "\u{1D487}"=>"f", "\u{1D488}"=>"g", "\u{1D489}"=>"h", "\u{1D48A}"=>"i",
- "\u{1D48B}"=>"j", "\u{1D48C}"=>"k", "\u{1D48D}"=>"l", "\u{1D48E}"=>"m", "\u{1D48F}"=>"n", "\u{1D490}"=>"o", "\u{1D491}"=>"p", "\u{1D492}"=>"q",
- "\u{1D493}"=>"r", "\u{1D494}"=>"s", "\u{1D495}"=>"t", "\u{1D496}"=>"u", "\u{1D497}"=>"v", "\u{1D498}"=>"w", "\u{1D499}"=>"x", "\u{1D49A}"=>"y",
- "\u{1D49B}"=>"z", "\u{1D49C}"=>"A", "\u{1D49E}"=>"C", "\u{1D49F}"=>"D", "\u{1D4A2}"=>"G", "\u{1D4A5}"=>"J", "\u{1D4A6}"=>"K", "\u{1D4A9}"=>"N",
- "\u{1D4AA}"=>"O", "\u{1D4AB}"=>"P", "\u{1D4AC}"=>"Q", "\u{1D4AE}"=>"S", "\u{1D4AF}"=>"T", "\u{1D4B0}"=>"U", "\u{1D4B1}"=>"V", "\u{1D4B2}"=>"W",
- "\u{1D4B3}"=>"X", "\u{1D4B4}"=>"Y", "\u{1D4B5}"=>"Z", "\u{1D4B6}"=>"a", "\u{1D4B7}"=>"b", "\u{1D4B8}"=>"c", "\u{1D4B9}"=>"d", "\u{1D4BB}"=>"f",
- "\u{1D4BD}"=>"h", "\u{1D4BE}"=>"i", "\u{1D4BF}"=>"j", "\u{1D4C0}"=>"k", "\u{1D4C1}"=>"l", "\u{1D4C2}"=>"m", "\u{1D4C3}"=>"n", "\u{1D4C5}"=>"p",
- "\u{1D4C6}"=>"q", "\u{1D4C7}"=>"r", "\u{1D4C8}"=>"s", "\u{1D4C9}"=>"t", "\u{1D4CA}"=>"u", "\u{1D4CB}"=>"v", "\u{1D4CC}"=>"w", "\u{1D4CD}"=>"x",
- "\u{1D4CE}"=>"y", "\u{1D4CF}"=>"z", "\u{1D4D0}"=>"A", "\u{1D4D1}"=>"B", "\u{1D4D2}"=>"C", "\u{1D4D3}"=>"D", "\u{1D4D4}"=>"E", "\u{1D4D5}"=>"F",
- "\u{1D4D6}"=>"G", "\u{1D4D7}"=>"H", "\u{1D4D8}"=>"I", "\u{1D4D9}"=>"J", "\u{1D4DA}"=>"K", "\u{1D4DB}"=>"L", "\u{1D4DC}"=>"M", "\u{1D4DD}"=>"N",
- "\u{1D4DE}"=>"O", "\u{1D4DF}"=>"P", "\u{1D4E0}"=>"Q", "\u{1D4E1}"=>"R", "\u{1D4E2}"=>"S", "\u{1D4E3}"=>"T", "\u{1D4E4}"=>"U", "\u{1D4E5}"=>"V",
- "\u{1D4E6}"=>"W", "\u{1D4E7}"=>"X", "\u{1D4E8}"=>"Y", "\u{1D4E9}"=>"Z", "\u{1D4EA}"=>"a", "\u{1D4EB}"=>"b", "\u{1D4EC}"=>"c", "\u{1D4ED}"=>"d",
- "\u{1D4EE}"=>"e", "\u{1D4EF}"=>"f", "\u{1D4F0}"=>"g", "\u{1D4F1}"=>"h", "\u{1D4F2}"=>"i", "\u{1D4F3}"=>"j", "\u{1D4F4}"=>"k", "\u{1D4F5}"=>"l",
- "\u{1D4F6}"=>"m", "\u{1D4F7}"=>"n", "\u{1D4F8}"=>"o", "\u{1D4F9}"=>"p", "\u{1D4FA}"=>"q", "\u{1D4FB}"=>"r", "\u{1D4FC}"=>"s", "\u{1D4FD}"=>"t",
- "\u{1D4FE}"=>"u", "\u{1D4FF}"=>"v", "\u{1D500}"=>"w", "\u{1D501}"=>"x", "\u{1D502}"=>"y", "\u{1D503}"=>"z", "\u{1D504}"=>"A", "\u{1D505}"=>"B",
- "\u{1D507}"=>"D", "\u{1D508}"=>"E", "\u{1D509}"=>"F", "\u{1D50A}"=>"G", "\u{1D50D}"=>"J", "\u{1D50E}"=>"K", "\u{1D50F}"=>"L", "\u{1D510}"=>"M",
- "\u{1D511}"=>"N", "\u{1D512}"=>"O", "\u{1D513}"=>"P", "\u{1D514}"=>"Q", "\u{1D516}"=>"S", "\u{1D517}"=>"T", "\u{1D518}"=>"U", "\u{1D519}"=>"V",
- "\u{1D51A}"=>"W", "\u{1D51B}"=>"X", "\u{1D51C}"=>"Y", "\u{1D51E}"=>"a", "\u{1D51F}"=>"b", "\u{1D520}"=>"c", "\u{1D521}"=>"d", "\u{1D522}"=>"e",
- "\u{1D523}"=>"f", "\u{1D524}"=>"g", "\u{1D525}"=>"h", "\u{1D526}"=>"i", "\u{1D527}"=>"j", "\u{1D528}"=>"k", "\u{1D529}"=>"l", "\u{1D52A}"=>"m",
- "\u{1D52B}"=>"n", "\u{1D52C}"=>"o", "\u{1D52D}"=>"p", "\u{1D52E}"=>"q", "\u{1D52F}"=>"r", "\u{1D530}"=>"s", "\u{1D531}"=>"t", "\u{1D532}"=>"u",
- "\u{1D533}"=>"v", "\u{1D534}"=>"w", "\u{1D535}"=>"x", "\u{1D536}"=>"y", "\u{1D537}"=>"z", "\u{1D538}"=>"A", "\u{1D539}"=>"B", "\u{1D53B}"=>"D",
- "\u{1D53C}"=>"E", "\u{1D53D}"=>"F", "\u{1D53E}"=>"G", "\u{1D540}"=>"I", "\u{1D541}"=>"J", "\u{1D542}"=>"K", "\u{1D543}"=>"L", "\u{1D544}"=>"M",
- "\u{1D546}"=>"O", "\u{1D54A}"=>"S", "\u{1D54B}"=>"T", "\u{1D54C}"=>"U", "\u{1D54D}"=>"V", "\u{1D54E}"=>"W", "\u{1D54F}"=>"X", "\u{1D550}"=>"Y",
- "\u{1D552}"=>"a", "\u{1D553}"=>"b", "\u{1D554}"=>"c", "\u{1D555}"=>"d", "\u{1D556}"=>"e", "\u{1D557}"=>"f", "\u{1D558}"=>"g", "\u{1D559}"=>"h",
- "\u{1D55A}"=>"i", "\u{1D55B}"=>"j", "\u{1D55C}"=>"k", "\u{1D55D}"=>"l", "\u{1D55E}"=>"m", "\u{1D55F}"=>"n", "\u{1D560}"=>"o", "\u{1D561}"=>"p",
- "\u{1D562}"=>"q", "\u{1D563}"=>"r", "\u{1D564}"=>"s", "\u{1D565}"=>"t", "\u{1D566}"=>"u", "\u{1D567}"=>"v", "\u{1D568}"=>"w", "\u{1D569}"=>"x",
- "\u{1D56A}"=>"y", "\u{1D56B}"=>"z", "\u{1D56C}"=>"A", "\u{1D56D}"=>"B", "\u{1D56E}"=>"C", "\u{1D56F}"=>"D", "\u{1D570}"=>"E", "\u{1D571}"=>"F",
- "\u{1D572}"=>"G", "\u{1D573}"=>"H", "\u{1D574}"=>"I", "\u{1D575}"=>"J", "\u{1D576}"=>"K", "\u{1D577}"=>"L", "\u{1D578}"=>"M", "\u{1D579}"=>"N",
- "\u{1D57A}"=>"O", "\u{1D57B}"=>"P", "\u{1D57C}"=>"Q", "\u{1D57D}"=>"R", "\u{1D57E}"=>"S", "\u{1D57F}"=>"T", "\u{1D580}"=>"U", "\u{1D581}"=>"V",
- "\u{1D582}"=>"W", "\u{1D583}"=>"X", "\u{1D584}"=>"Y", "\u{1D585}"=>"Z", "\u{1D586}"=>"a", "\u{1D587}"=>"b", "\u{1D588}"=>"c", "\u{1D589}"=>"d",
- "\u{1D58A}"=>"e", "\u{1D58B}"=>"f", "\u{1D58C}"=>"g", "\u{1D58D}"=>"h", "\u{1D58E}"=>"i", "\u{1D58F}"=>"j", "\u{1D590}"=>"k", "\u{1D591}"=>"l",
- "\u{1D592}"=>"m", "\u{1D593}"=>"n", "\u{1D594}"=>"o", "\u{1D595}"=>"p", "\u{1D596}"=>"q", "\u{1D597}"=>"r", "\u{1D598}"=>"s", "\u{1D599}"=>"t",
- "\u{1D59A}"=>"u", "\u{1D59B}"=>"v", "\u{1D59C}"=>"w", "\u{1D59D}"=>"x", "\u{1D59E}"=>"y", "\u{1D59F}"=>"z", "\u{1D5A0}"=>"A", "\u{1D5A1}"=>"B",
- "\u{1D5A2}"=>"C", "\u{1D5A3}"=>"D", "\u{1D5A4}"=>"E", "\u{1D5A5}"=>"F", "\u{1D5A6}"=>"G", "\u{1D5A7}"=>"H", "\u{1D5A8}"=>"I", "\u{1D5A9}"=>"J",
- "\u{1D5AA}"=>"K", "\u{1D5AB}"=>"L", "\u{1D5AC}"=>"M", "\u{1D5AD}"=>"N", "\u{1D5AE}"=>"O", "\u{1D5AF}"=>"P", "\u{1D5B0}"=>"Q", "\u{1D5B1}"=>"R",
- "\u{1D5B2}"=>"S", "\u{1D5B3}"=>"T", "\u{1D5B4}"=>"U", "\u{1D5B5}"=>"V", "\u{1D5B6}"=>"W", "\u{1D5B7}"=>"X", "\u{1D5B8}"=>"Y", "\u{1D5B9}"=>"Z",
- "\u{1D5BA}"=>"a", "\u{1D5BB}"=>"b", "\u{1D5BC}"=>"c", "\u{1D5BD}"=>"d", "\u{1D5BE}"=>"e", "\u{1D5BF}"=>"f", "\u{1D5C0}"=>"g", "\u{1D5C1}"=>"h",
- "\u{1D5C2}"=>"i", "\u{1D5C3}"=>"j", "\u{1D5C4}"=>"k", "\u{1D5C5}"=>"l", "\u{1D5C6}"=>"m", "\u{1D5C7}"=>"n", "\u{1D5C8}"=>"o", "\u{1D5C9}"=>"p",
- "\u{1D5CA}"=>"q", "\u{1D5CB}"=>"r", "\u{1D5CC}"=>"s", "\u{1D5CD}"=>"t", "\u{1D5CE}"=>"u", "\u{1D5CF}"=>"v", "\u{1D5D0}"=>"w", "\u{1D5D1}"=>"x",
- "\u{1D5D2}"=>"y", "\u{1D5D3}"=>"z", "\u{1D5D4}"=>"A", "\u{1D5D5}"=>"B", "\u{1D5D6}"=>"C", "\u{1D5D7}"=>"D", "\u{1D5D8}"=>"E", "\u{1D5D9}"=>"F",
- "\u{1D5DA}"=>"G", "\u{1D5DB}"=>"H", "\u{1D5DC}"=>"I", "\u{1D5DD}"=>"J", "\u{1D5DE}"=>"K", "\u{1D5DF}"=>"L", "\u{1D5E0}"=>"M", "\u{1D5E1}"=>"N",
- "\u{1D5E2}"=>"O", "\u{1D5E3}"=>"P", "\u{1D5E4}"=>"Q", "\u{1D5E5}"=>"R", "\u{1D5E6}"=>"S", "\u{1D5E7}"=>"T", "\u{1D5E8}"=>"U", "\u{1D5E9}"=>"V",
- "\u{1D5EA}"=>"W", "\u{1D5EB}"=>"X", "\u{1D5EC}"=>"Y", "\u{1D5ED}"=>"Z", "\u{1D5EE}"=>"a", "\u{1D5EF}"=>"b", "\u{1D5F0}"=>"c", "\u{1D5F1}"=>"d",
- "\u{1D5F2}"=>"e", "\u{1D5F3}"=>"f", "\u{1D5F4}"=>"g", "\u{1D5F5}"=>"h", "\u{1D5F6}"=>"i", "\u{1D5F7}"=>"j", "\u{1D5F8}"=>"k", "\u{1D5F9}"=>"l",
- "\u{1D5FA}"=>"m", "\u{1D5FB}"=>"n", "\u{1D5FC}"=>"o", "\u{1D5FD}"=>"p", "\u{1D5FE}"=>"q", "\u{1D5FF}"=>"r", "\u{1D600}"=>"s", "\u{1D601}"=>"t",
- "\u{1D602}"=>"u", "\u{1D603}"=>"v", "\u{1D604}"=>"w", "\u{1D605}"=>"x", "\u{1D606}"=>"y", "\u{1D607}"=>"z", "\u{1D608}"=>"A", "\u{1D609}"=>"B",
- "\u{1D60A}"=>"C", "\u{1D60B}"=>"D", "\u{1D60C}"=>"E", "\u{1D60D}"=>"F", "\u{1D60E}"=>"G", "\u{1D60F}"=>"H", "\u{1D610}"=>"I", "\u{1D611}"=>"J",
- "\u{1D612}"=>"K", "\u{1D613}"=>"L", "\u{1D614}"=>"M", "\u{1D615}"=>"N", "\u{1D616}"=>"O", "\u{1D617}"=>"P", "\u{1D618}"=>"Q", "\u{1D619}"=>"R",
- "\u{1D61A}"=>"S", "\u{1D61B}"=>"T", "\u{1D61C}"=>"U", "\u{1D61D}"=>"V", "\u{1D61E}"=>"W", "\u{1D61F}"=>"X", "\u{1D620}"=>"Y", "\u{1D621}"=>"Z",
- "\u{1D622}"=>"a", "\u{1D623}"=>"b", "\u{1D624}"=>"c", "\u{1D625}"=>"d", "\u{1D626}"=>"e", "\u{1D627}"=>"f", "\u{1D628}"=>"g", "\u{1D629}"=>"h",
- "\u{1D62A}"=>"i", "\u{1D62B}"=>"j", "\u{1D62C}"=>"k", "\u{1D62D}"=>"l", "\u{1D62E}"=>"m", "\u{1D62F}"=>"n", "\u{1D630}"=>"o", "\u{1D631}"=>"p",
- "\u{1D632}"=>"q", "\u{1D633}"=>"r", "\u{1D634}"=>"s", "\u{1D635}"=>"t", "\u{1D636}"=>"u", "\u{1D637}"=>"v", "\u{1D638}"=>"w", "\u{1D639}"=>"x",
- "\u{1D63A}"=>"y", "\u{1D63B}"=>"z", "\u{1D63C}"=>"A", "\u{1D63D}"=>"B", "\u{1D63E}"=>"C", "\u{1D63F}"=>"D", "\u{1D640}"=>"E", "\u{1D641}"=>"F",
- "\u{1D642}"=>"G", "\u{1D643}"=>"H", "\u{1D644}"=>"I", "\u{1D645}"=>"J", "\u{1D646}"=>"K", "\u{1D647}"=>"L", "\u{1D648}"=>"M", "\u{1D649}"=>"N",
- "\u{1D64A}"=>"O", "\u{1D64B}"=>"P", "\u{1D64C}"=>"Q", "\u{1D64D}"=>"R", "\u{1D64E}"=>"S", "\u{1D64F}"=>"T", "\u{1D650}"=>"U", "\u{1D651}"=>"V",
- "\u{1D652}"=>"W", "\u{1D653}"=>"X", "\u{1D654}"=>"Y", "\u{1D655}"=>"Z", "\u{1D656}"=>"a", "\u{1D657}"=>"b", "\u{1D658}"=>"c", "\u{1D659}"=>"d",
- "\u{1D65A}"=>"e", "\u{1D65B}"=>"f", "\u{1D65C}"=>"g", "\u{1D65D}"=>"h", "\u{1D65E}"=>"i", "\u{1D65F}"=>"j", "\u{1D660}"=>"k", "\u{1D661}"=>"l",
- "\u{1D662}"=>"m", "\u{1D663}"=>"n", "\u{1D664}"=>"o", "\u{1D665}"=>"p", "\u{1D666}"=>"q", "\u{1D667}"=>"r", "\u{1D668}"=>"s", "\u{1D669}"=>"t",
- "\u{1D66A}"=>"u", "\u{1D66B}"=>"v", "\u{1D66C}"=>"w", "\u{1D66D}"=>"x", "\u{1D66E}"=>"y", "\u{1D66F}"=>"z", "\u{1D670}"=>"A", "\u{1D671}"=>"B",
- "\u{1D672}"=>"C", "\u{1D673}"=>"D", "\u{1D674}"=>"E", "\u{1D675}"=>"F", "\u{1D676}"=>"G", "\u{1D677}"=>"H", "\u{1D678}"=>"I", "\u{1D679}"=>"J",
- "\u{1D67A}"=>"K", "\u{1D67B}"=>"L", "\u{1D67C}"=>"M", "\u{1D67D}"=>"N", "\u{1D67E}"=>"O", "\u{1D67F}"=>"P", "\u{1D680}"=>"Q", "\u{1D681}"=>"R",
- "\u{1D682}"=>"S", "\u{1D683}"=>"T", "\u{1D684}"=>"U", "\u{1D685}"=>"V", "\u{1D686}"=>"W", "\u{1D687}"=>"X", "\u{1D688}"=>"Y", "\u{1D689}"=>"Z",
- "\u{1D68A}"=>"a", "\u{1D68B}"=>"b", "\u{1D68C}"=>"c", "\u{1D68D}"=>"d", "\u{1D68E}"=>"e", "\u{1D68F}"=>"f", "\u{1D690}"=>"g", "\u{1D691}"=>"h",
- "\u{1D692}"=>"i", "\u{1D693}"=>"j", "\u{1D694}"=>"k", "\u{1D695}"=>"l", "\u{1D696}"=>"m", "\u{1D697}"=>"n", "\u{1D698}"=>"o", "\u{1D699}"=>"p",
- "\u{1D69A}"=>"q", "\u{1D69B}"=>"r", "\u{1D69C}"=>"s", "\u{1D69D}"=>"t", "\u{1D69E}"=>"u", "\u{1D69F}"=>"v", "\u{1D6A0}"=>"w", "\u{1D6A1}"=>"x",
- "\u{1D6A2}"=>"y", "\u{1D6A3}"=>"z", "\u{1D6A4}"=>"\u0131", "\u{1D6A5}"=>"\u0237", "\u{1D6A8}"=>"\u0391", "\u{1D6A9}"=>"\u0392", "\u{1D6AA}"=>"\u0393", "\u{1D6AB}"=>"\u0394",
- "\u{1D6AC}"=>"\u0395", "\u{1D6AD}"=>"\u0396", "\u{1D6AE}"=>"\u0397", "\u{1D6AF}"=>"\u0398", "\u{1D6B0}"=>"\u0399", "\u{1D6B1}"=>"\u039A", "\u{1D6B2}"=>"\u039B", "\u{1D6B3}"=>"\u039C",
- "\u{1D6B4}"=>"\u039D", "\u{1D6B5}"=>"\u039E", "\u{1D6B6}"=>"\u039F", "\u{1D6B7}"=>"\u03A0", "\u{1D6B8}"=>"\u03A1", "\u{1D6B9}"=>"\u0398", "\u{1D6BA}"=>"\u03A3", "\u{1D6BB}"=>"\u03A4",
- "\u{1D6BC}"=>"\u03A5", "\u{1D6BD}"=>"\u03A6", "\u{1D6BE}"=>"\u03A7", "\u{1D6BF}"=>"\u03A8", "\u{1D6C0}"=>"\u03A9", "\u{1D6C1}"=>"\u2207", "\u{1D6C2}"=>"\u03B1", "\u{1D6C3}"=>"\u03B2",
- "\u{1D6C4}"=>"\u03B3", "\u{1D6C5}"=>"\u03B4", "\u{1D6C6}"=>"\u03B5", "\u{1D6C7}"=>"\u03B6", "\u{1D6C8}"=>"\u03B7", "\u{1D6C9}"=>"\u03B8", "\u{1D6CA}"=>"\u03B9", "\u{1D6CB}"=>"\u03BA",
- "\u{1D6CC}"=>"\u03BB", "\u{1D6CD}"=>"\u03BC", "\u{1D6CE}"=>"\u03BD", "\u{1D6CF}"=>"\u03BE", "\u{1D6D0}"=>"\u03BF", "\u{1D6D1}"=>"\u03C0", "\u{1D6D2}"=>"\u03C1", "\u{1D6D3}"=>"\u03C2",
- "\u{1D6D4}"=>"\u03C3", "\u{1D6D5}"=>"\u03C4", "\u{1D6D6}"=>"\u03C5", "\u{1D6D7}"=>"\u03C6", "\u{1D6D8}"=>"\u03C7", "\u{1D6D9}"=>"\u03C8", "\u{1D6DA}"=>"\u03C9", "\u{1D6DB}"=>"\u2202",
- "\u{1D6DC}"=>"\u03B5", "\u{1D6DD}"=>"\u03B8", "\u{1D6DE}"=>"\u03BA", "\u{1D6DF}"=>"\u03C6", "\u{1D6E0}"=>"\u03C1", "\u{1D6E1}"=>"\u03C0", "\u{1D6E2}"=>"\u0391", "\u{1D6E3}"=>"\u0392",
- "\u{1D6E4}"=>"\u0393", "\u{1D6E5}"=>"\u0394", "\u{1D6E6}"=>"\u0395", "\u{1D6E7}"=>"\u0396", "\u{1D6E8}"=>"\u0397", "\u{1D6E9}"=>"\u0398", "\u{1D6EA}"=>"\u0399", "\u{1D6EB}"=>"\u039A",
- "\u{1D6EC}"=>"\u039B", "\u{1D6ED}"=>"\u039C", "\u{1D6EE}"=>"\u039D", "\u{1D6EF}"=>"\u039E", "\u{1D6F0}"=>"\u039F", "\u{1D6F1}"=>"\u03A0", "\u{1D6F2}"=>"\u03A1", "\u{1D6F3}"=>"\u0398",
- "\u{1D6F4}"=>"\u03A3", "\u{1D6F5}"=>"\u03A4", "\u{1D6F6}"=>"\u03A5", "\u{1D6F7}"=>"\u03A6", "\u{1D6F8}"=>"\u03A7", "\u{1D6F9}"=>"\u03A8", "\u{1D6FA}"=>"\u03A9", "\u{1D6FB}"=>"\u2207",
- "\u{1D6FC}"=>"\u03B1", "\u{1D6FD}"=>"\u03B2", "\u{1D6FE}"=>"\u03B3", "\u{1D6FF}"=>"\u03B4", "\u{1D700}"=>"\u03B5", "\u{1D701}"=>"\u03B6", "\u{1D702}"=>"\u03B7", "\u{1D703}"=>"\u03B8",
- "\u{1D704}"=>"\u03B9", "\u{1D705}"=>"\u03BA", "\u{1D706}"=>"\u03BB", "\u{1D707}"=>"\u03BC", "\u{1D708}"=>"\u03BD", "\u{1D709}"=>"\u03BE", "\u{1D70A}"=>"\u03BF", "\u{1D70B}"=>"\u03C0",
- "\u{1D70C}"=>"\u03C1", "\u{1D70D}"=>"\u03C2", "\u{1D70E}"=>"\u03C3", "\u{1D70F}"=>"\u03C4", "\u{1D710}"=>"\u03C5", "\u{1D711}"=>"\u03C6", "\u{1D712}"=>"\u03C7", "\u{1D713}"=>"\u03C8",
- "\u{1D714}"=>"\u03C9", "\u{1D715}"=>"\u2202", "\u{1D716}"=>"\u03B5", "\u{1D717}"=>"\u03B8", "\u{1D718}"=>"\u03BA", "\u{1D719}"=>"\u03C6", "\u{1D71A}"=>"\u03C1", "\u{1D71B}"=>"\u03C0",
- "\u{1D71C}"=>"\u0391", "\u{1D71D}"=>"\u0392", "\u{1D71E}"=>"\u0393", "\u{1D71F}"=>"\u0394", "\u{1D720}"=>"\u0395", "\u{1D721}"=>"\u0396", "\u{1D722}"=>"\u0397", "\u{1D723}"=>"\u0398",
- "\u{1D724}"=>"\u0399", "\u{1D725}"=>"\u039A", "\u{1D726}"=>"\u039B", "\u{1D727}"=>"\u039C", "\u{1D728}"=>"\u039D", "\u{1D729}"=>"\u039E", "\u{1D72A}"=>"\u039F", "\u{1D72B}"=>"\u03A0",
- "\u{1D72C}"=>"\u03A1", "\u{1D72D}"=>"\u0398", "\u{1D72E}"=>"\u03A3", "\u{1D72F}"=>"\u03A4", "\u{1D730}"=>"\u03A5", "\u{1D731}"=>"\u03A6", "\u{1D732}"=>"\u03A7", "\u{1D733}"=>"\u03A8",
- "\u{1D734}"=>"\u03A9", "\u{1D735}"=>"\u2207", "\u{1D736}"=>"\u03B1", "\u{1D737}"=>"\u03B2", "\u{1D738}"=>"\u03B3", "\u{1D739}"=>"\u03B4", "\u{1D73A}"=>"\u03B5", "\u{1D73B}"=>"\u03B6",
- "\u{1D73C}"=>"\u03B7", "\u{1D73D}"=>"\u03B8", "\u{1D73E}"=>"\u03B9", "\u{1D73F}"=>"\u03BA", "\u{1D740}"=>"\u03BB", "\u{1D741}"=>"\u03BC", "\u{1D742}"=>"\u03BD", "\u{1D743}"=>"\u03BE",
- "\u{1D744}"=>"\u03BF", "\u{1D745}"=>"\u03C0", "\u{1D746}"=>"\u03C1", "\u{1D747}"=>"\u03C2", "\u{1D748}"=>"\u03C3", "\u{1D749}"=>"\u03C4", "\u{1D74A}"=>"\u03C5", "\u{1D74B}"=>"\u03C6",
- "\u{1D74C}"=>"\u03C7", "\u{1D74D}"=>"\u03C8", "\u{1D74E}"=>"\u03C9", "\u{1D74F}"=>"\u2202", "\u{1D750}"=>"\u03B5", "\u{1D751}"=>"\u03B8", "\u{1D752}"=>"\u03BA", "\u{1D753}"=>"\u03C6",
- "\u{1D754}"=>"\u03C1", "\u{1D755}"=>"\u03C0", "\u{1D756}"=>"\u0391", "\u{1D757}"=>"\u0392", "\u{1D758}"=>"\u0393", "\u{1D759}"=>"\u0394", "\u{1D75A}"=>"\u0395", "\u{1D75B}"=>"\u0396",
- "\u{1D75C}"=>"\u0397", "\u{1D75D}"=>"\u0398", "\u{1D75E}"=>"\u0399", "\u{1D75F}"=>"\u039A", "\u{1D760}"=>"\u039B", "\u{1D761}"=>"\u039C", "\u{1D762}"=>"\u039D", "\u{1D763}"=>"\u039E",
- "\u{1D764}"=>"\u039F", "\u{1D765}"=>"\u03A0", "\u{1D766}"=>"\u03A1", "\u{1D767}"=>"\u0398", "\u{1D768}"=>"\u03A3", "\u{1D769}"=>"\u03A4", "\u{1D76A}"=>"\u03A5", "\u{1D76B}"=>"\u03A6",
- "\u{1D76C}"=>"\u03A7", "\u{1D76D}"=>"\u03A8", "\u{1D76E}"=>"\u03A9", "\u{1D76F}"=>"\u2207", "\u{1D770}"=>"\u03B1", "\u{1D771}"=>"\u03B2", "\u{1D772}"=>"\u03B3", "\u{1D773}"=>"\u03B4",
- "\u{1D774}"=>"\u03B5", "\u{1D775}"=>"\u03B6", "\u{1D776}"=>"\u03B7", "\u{1D777}"=>"\u03B8", "\u{1D778}"=>"\u03B9", "\u{1D779}"=>"\u03BA", "\u{1D77A}"=>"\u03BB", "\u{1D77B}"=>"\u03BC",
- "\u{1D77C}"=>"\u03BD", "\u{1D77D}"=>"\u03BE", "\u{1D77E}"=>"\u03BF", "\u{1D77F}"=>"\u03C0", "\u{1D780}"=>"\u03C1", "\u{1D781}"=>"\u03C2", "\u{1D782}"=>"\u03C3", "\u{1D783}"=>"\u03C4",
- "\u{1D784}"=>"\u03C5", "\u{1D785}"=>"\u03C6", "\u{1D786}"=>"\u03C7", "\u{1D787}"=>"\u03C8", "\u{1D788}"=>"\u03C9", "\u{1D789}"=>"\u2202", "\u{1D78A}"=>"\u03B5", "\u{1D78B}"=>"\u03B8",
- "\u{1D78C}"=>"\u03BA", "\u{1D78D}"=>"\u03C6", "\u{1D78E}"=>"\u03C1", "\u{1D78F}"=>"\u03C0", "\u{1D790}"=>"\u0391", "\u{1D791}"=>"\u0392", "\u{1D792}"=>"\u0393", "\u{1D793}"=>"\u0394",
- "\u{1D794}"=>"\u0395", "\u{1D795}"=>"\u0396", "\u{1D796}"=>"\u0397", "\u{1D797}"=>"\u0398", "\u{1D798}"=>"\u0399", "\u{1D799}"=>"\u039A", "\u{1D79A}"=>"\u039B", "\u{1D79B}"=>"\u039C",
- "\u{1D79C}"=>"\u039D", "\u{1D79D}"=>"\u039E", "\u{1D79E}"=>"\u039F", "\u{1D79F}"=>"\u03A0", "\u{1D7A0}"=>"\u03A1", "\u{1D7A1}"=>"\u0398", "\u{1D7A2}"=>"\u03A3", "\u{1D7A3}"=>"\u03A4",
- "\u{1D7A4}"=>"\u03A5", "\u{1D7A5}"=>"\u03A6", "\u{1D7A6}"=>"\u03A7", "\u{1D7A7}"=>"\u03A8", "\u{1D7A8}"=>"\u03A9", "\u{1D7A9}"=>"\u2207", "\u{1D7AA}"=>"\u03B1", "\u{1D7AB}"=>"\u03B2",
- "\u{1D7AC}"=>"\u03B3", "\u{1D7AD}"=>"\u03B4", "\u{1D7AE}"=>"\u03B5", "\u{1D7AF}"=>"\u03B6", "\u{1D7B0}"=>"\u03B7", "\u{1D7B1}"=>"\u03B8", "\u{1D7B2}"=>"\u03B9", "\u{1D7B3}"=>"\u03BA",
- "\u{1D7B4}"=>"\u03BB", "\u{1D7B5}"=>"\u03BC", "\u{1D7B6}"=>"\u03BD", "\u{1D7B7}"=>"\u03BE", "\u{1D7B8}"=>"\u03BF", "\u{1D7B9}"=>"\u03C0", "\u{1D7BA}"=>"\u03C1", "\u{1D7BB}"=>"\u03C2",
- "\u{1D7BC}"=>"\u03C3", "\u{1D7BD}"=>"\u03C4", "\u{1D7BE}"=>"\u03C5", "\u{1D7BF}"=>"\u03C6", "\u{1D7C0}"=>"\u03C7", "\u{1D7C1}"=>"\u03C8", "\u{1D7C2}"=>"\u03C9", "\u{1D7C3}"=>"\u2202",
- "\u{1D7C4}"=>"\u03B5", "\u{1D7C5}"=>"\u03B8", "\u{1D7C6}"=>"\u03BA", "\u{1D7C7}"=>"\u03C6", "\u{1D7C8}"=>"\u03C1", "\u{1D7C9}"=>"\u03C0", "\u{1D7CA}"=>"\u03DC", "\u{1D7CB}"=>"\u03DD",
- "\u{1D7CE}"=>"0", "\u{1D7CF}"=>"1", "\u{1D7D0}"=>"2", "\u{1D7D1}"=>"3", "\u{1D7D2}"=>"4", "\u{1D7D3}"=>"5", "\u{1D7D4}"=>"6", "\u{1D7D5}"=>"7",
- "\u{1D7D6}"=>"8", "\u{1D7D7}"=>"9", "\u{1D7D8}"=>"0", "\u{1D7D9}"=>"1", "\u{1D7DA}"=>"2", "\u{1D7DB}"=>"3", "\u{1D7DC}"=>"4", "\u{1D7DD}"=>"5",
- "\u{1D7DE}"=>"6", "\u{1D7DF}"=>"7", "\u{1D7E0}"=>"8", "\u{1D7E1}"=>"9", "\u{1D7E2}"=>"0", "\u{1D7E3}"=>"1", "\u{1D7E4}"=>"2", "\u{1D7E5}"=>"3",
- "\u{1D7E6}"=>"4", "\u{1D7E7}"=>"5", "\u{1D7E8}"=>"6", "\u{1D7E9}"=>"7", "\u{1D7EA}"=>"8", "\u{1D7EB}"=>"9", "\u{1D7EC}"=>"0", "\u{1D7ED}"=>"1",
- "\u{1D7EE}"=>"2", "\u{1D7EF}"=>"3", "\u{1D7F0}"=>"4", "\u{1D7F1}"=>"5", "\u{1D7F2}"=>"6", "\u{1D7F3}"=>"7", "\u{1D7F4}"=>"8", "\u{1D7F5}"=>"9",
- "\u{1D7F6}"=>"0", "\u{1D7F7}"=>"1", "\u{1D7F8}"=>"2", "\u{1D7F9}"=>"3", "\u{1D7FA}"=>"4", "\u{1D7FB}"=>"5", "\u{1D7FC}"=>"6", "\u{1D7FD}"=>"7",
- "\u{1D7FE}"=>"8", "\u{1D7FF}"=>"9", "\u{1EE00}"=>"\u0627", "\u{1EE01}"=>"\u0628", "\u{1EE02}"=>"\u062C", "\u{1EE03}"=>"\u062F", "\u{1EE05}"=>"\u0648", "\u{1EE06}"=>"\u0632",
- "\u{1EE07}"=>"\u062D", "\u{1EE08}"=>"\u0637", "\u{1EE09}"=>"\u064A", "\u{1EE0A}"=>"\u0643", "\u{1EE0B}"=>"\u0644", "\u{1EE0C}"=>"\u0645", "\u{1EE0D}"=>"\u0646", "\u{1EE0E}"=>"\u0633",
- "\u{1EE0F}"=>"\u0639", "\u{1EE10}"=>"\u0641", "\u{1EE11}"=>"\u0635", "\u{1EE12}"=>"\u0642", "\u{1EE13}"=>"\u0631", "\u{1EE14}"=>"\u0634", "\u{1EE15}"=>"\u062A", "\u{1EE16}"=>"\u062B",
- "\u{1EE17}"=>"\u062E", "\u{1EE18}"=>"\u0630", "\u{1EE19}"=>"\u0636", "\u{1EE1A}"=>"\u0638", "\u{1EE1B}"=>"\u063A", "\u{1EE1C}"=>"\u066E", "\u{1EE1D}"=>"\u06BA", "\u{1EE1E}"=>"\u06A1",
- "\u{1EE1F}"=>"\u066F", "\u{1EE21}"=>"\u0628", "\u{1EE22}"=>"\u062C", "\u{1EE24}"=>"\u0647", "\u{1EE27}"=>"\u062D", "\u{1EE29}"=>"\u064A", "\u{1EE2A}"=>"\u0643", "\u{1EE2B}"=>"\u0644",
- "\u{1EE2C}"=>"\u0645", "\u{1EE2D}"=>"\u0646", "\u{1EE2E}"=>"\u0633", "\u{1EE2F}"=>"\u0639", "\u{1EE30}"=>"\u0641", "\u{1EE31}"=>"\u0635", "\u{1EE32}"=>"\u0642", "\u{1EE34}"=>"\u0634",
- "\u{1EE35}"=>"\u062A", "\u{1EE36}"=>"\u062B", "\u{1EE37}"=>"\u062E", "\u{1EE39}"=>"\u0636", "\u{1EE3B}"=>"\u063A", "\u{1EE42}"=>"\u062C", "\u{1EE47}"=>"\u062D", "\u{1EE49}"=>"\u064A",
- "\u{1EE4B}"=>"\u0644", "\u{1EE4D}"=>"\u0646", "\u{1EE4E}"=>"\u0633", "\u{1EE4F}"=>"\u0639", "\u{1EE51}"=>"\u0635", "\u{1EE52}"=>"\u0642", "\u{1EE54}"=>"\u0634", "\u{1EE57}"=>"\u062E",
- "\u{1EE59}"=>"\u0636", "\u{1EE5B}"=>"\u063A", "\u{1EE5D}"=>"\u06BA", "\u{1EE5F}"=>"\u066F", "\u{1EE61}"=>"\u0628", "\u{1EE62}"=>"\u062C", "\u{1EE64}"=>"\u0647", "\u{1EE67}"=>"\u062D",
- "\u{1EE68}"=>"\u0637", "\u{1EE69}"=>"\u064A", "\u{1EE6A}"=>"\u0643", "\u{1EE6C}"=>"\u0645", "\u{1EE6D}"=>"\u0646", "\u{1EE6E}"=>"\u0633", "\u{1EE6F}"=>"\u0639", "\u{1EE70}"=>"\u0641",
- "\u{1EE71}"=>"\u0635", "\u{1EE72}"=>"\u0642", "\u{1EE74}"=>"\u0634", "\u{1EE75}"=>"\u062A", "\u{1EE76}"=>"\u062B", "\u{1EE77}"=>"\u062E", "\u{1EE79}"=>"\u0636", "\u{1EE7A}"=>"\u0638",
- "\u{1EE7B}"=>"\u063A", "\u{1EE7C}"=>"\u066E", "\u{1EE7E}"=>"\u06A1", "\u{1EE80}"=>"\u0627", "\u{1EE81}"=>"\u0628", "\u{1EE82}"=>"\u062C", "\u{1EE83}"=>"\u062F", "\u{1EE84}"=>"\u0647",
- "\u{1EE85}"=>"\u0648", "\u{1EE86}"=>"\u0632", "\u{1EE87}"=>"\u062D", "\u{1EE88}"=>"\u0637", "\u{1EE89}"=>"\u064A", "\u{1EE8B}"=>"\u0644", "\u{1EE8C}"=>"\u0645", "\u{1EE8D}"=>"\u0646",
- "\u{1EE8E}"=>"\u0633", "\u{1EE8F}"=>"\u0639", "\u{1EE90}"=>"\u0641", "\u{1EE91}"=>"\u0635", "\u{1EE92}"=>"\u0642", "\u{1EE93}"=>"\u0631", "\u{1EE94}"=>"\u0634", "\u{1EE95}"=>"\u062A",
- "\u{1EE96}"=>"\u062B", "\u{1EE97}"=>"\u062E", "\u{1EE98}"=>"\u0630", "\u{1EE99}"=>"\u0636", "\u{1EE9A}"=>"\u0638", "\u{1EE9B}"=>"\u063A", "\u{1EEA1}"=>"\u0628", "\u{1EEA2}"=>"\u062C",
- "\u{1EEA3}"=>"\u062F", "\u{1EEA5}"=>"\u0648", "\u{1EEA6}"=>"\u0632", "\u{1EEA7}"=>"\u062D", "\u{1EEA8}"=>"\u0637", "\u{1EEA9}"=>"\u064A", "\u{1EEAB}"=>"\u0644", "\u{1EEAC}"=>"\u0645",
- "\u{1EEAD}"=>"\u0646", "\u{1EEAE}"=>"\u0633", "\u{1EEAF}"=>"\u0639", "\u{1EEB0}"=>"\u0641", "\u{1EEB1}"=>"\u0635", "\u{1EEB2}"=>"\u0642", "\u{1EEB3}"=>"\u0631", "\u{1EEB4}"=>"\u0634",
- "\u{1EEB5}"=>"\u062A", "\u{1EEB6}"=>"\u062B", "\u{1EEB7}"=>"\u062E", "\u{1EEB8}"=>"\u0630", "\u{1EEB9}"=>"\u0636", "\u{1EEBA}"=>"\u0638", "\u{1EEBB}"=>"\u063A", "\u{1F100}"=>"0.",
- "\u{1F101}"=>"0,", "\u{1F102}"=>"1,", "\u{1F103}"=>"2,", "\u{1F104}"=>"3,", "\u{1F105}"=>"4,", "\u{1F106}"=>"5,", "\u{1F107}"=>"6,", "\u{1F108}"=>"7,",
- "\u{1F109}"=>"8,", "\u{1F10A}"=>"9,", "\u{1F110}"=>"(A)", "\u{1F111}"=>"(B)", "\u{1F112}"=>"(C)", "\u{1F113}"=>"(D)", "\u{1F114}"=>"(E)", "\u{1F115}"=>"(F)",
- "\u{1F116}"=>"(G)", "\u{1F117}"=>"(H)", "\u{1F118}"=>"(I)", "\u{1F119}"=>"(J)", "\u{1F11A}"=>"(K)", "\u{1F11B}"=>"(L)", "\u{1F11C}"=>"(M)", "\u{1F11D}"=>"(N)",
- "\u{1F11E}"=>"(O)", "\u{1F11F}"=>"(P)", "\u{1F120}"=>"(Q)", "\u{1F121}"=>"(R)", "\u{1F122}"=>"(S)", "\u{1F123}"=>"(T)", "\u{1F124}"=>"(U)", "\u{1F125}"=>"(V)",
- "\u{1F126}"=>"(W)", "\u{1F127}"=>"(X)", "\u{1F128}"=>"(Y)", "\u{1F129}"=>"(Z)", "\u{1F12A}"=>"\u3014S\u3015", "\u{1F12B}"=>"C", "\u{1F12C}"=>"R", "\u{1F12D}"=>"CD",
- "\u{1F12E}"=>"WZ", "\u{1F130}"=>"A", "\u{1F131}"=>"B", "\u{1F132}"=>"C", "\u{1F133}"=>"D", "\u{1F134}"=>"E", "\u{1F135}"=>"F", "\u{1F136}"=>"G",
- "\u{1F137}"=>"H", "\u{1F138}"=>"I", "\u{1F139}"=>"J", "\u{1F13A}"=>"K", "\u{1F13B}"=>"L", "\u{1F13C}"=>"M", "\u{1F13D}"=>"N", "\u{1F13E}"=>"O",
- "\u{1F13F}"=>"P", "\u{1F140}"=>"Q", "\u{1F141}"=>"R", "\u{1F142}"=>"S", "\u{1F143}"=>"T", "\u{1F144}"=>"U", "\u{1F145}"=>"V", "\u{1F146}"=>"W",
- "\u{1F147}"=>"X", "\u{1F148}"=>"Y", "\u{1F149}"=>"Z", "\u{1F14A}"=>"HV", "\u{1F14B}"=>"MV", "\u{1F14C}"=>"SD", "\u{1F14D}"=>"SS", "\u{1F14E}"=>"PPV",
- "\u{1F14F}"=>"WC", "\u{1F16A}"=>"MC", "\u{1F16B}"=>"MD", "\u{1F190}"=>"DJ", "\u{1F200}"=>"\u307B\u304B", "\u{1F201}"=>"\u30B3\u30B3", "\u{1F202}"=>"\u30B5", "\u{1F210}"=>"\u624B",
- "\u{1F211}"=>"\u5B57", "\u{1F212}"=>"\u53CC", "\u{1F213}"=>"\u30C7", "\u{1F214}"=>"\u4E8C", "\u{1F215}"=>"\u591A", "\u{1F216}"=>"\u89E3", "\u{1F217}"=>"\u5929", "\u{1F218}"=>"\u4EA4",
- "\u{1F219}"=>"\u6620", "\u{1F21A}"=>"\u7121", "\u{1F21B}"=>"\u6599", "\u{1F21C}"=>"\u524D", "\u{1F21D}"=>"\u5F8C", "\u{1F21E}"=>"\u518D", "\u{1F21F}"=>"\u65B0", "\u{1F220}"=>"\u521D",
- "\u{1F221}"=>"\u7D42", "\u{1F222}"=>"\u751F", "\u{1F223}"=>"\u8CA9", "\u{1F224}"=>"\u58F0", "\u{1F225}"=>"\u5439", "\u{1F226}"=>"\u6F14", "\u{1F227}"=>"\u6295", "\u{1F228}"=>"\u6355",
- "\u{1F229}"=>"\u4E00", "\u{1F22A}"=>"\u4E09", "\u{1F22B}"=>"\u904A", "\u{1F22C}"=>"\u5DE6", "\u{1F22D}"=>"\u4E2D", "\u{1F22E}"=>"\u53F3", "\u{1F22F}"=>"\u6307", "\u{1F230}"=>"\u8D70",
- "\u{1F231}"=>"\u6253", "\u{1F232}"=>"\u7981", "\u{1F233}"=>"\u7A7A", "\u{1F234}"=>"\u5408", "\u{1F235}"=>"\u6E80", "\u{1F236}"=>"\u6709", "\u{1F237}"=>"\u6708", "\u{1F238}"=>"\u7533",
- "\u{1F239}"=>"\u5272", "\u{1F23A}"=>"\u55B6", "\u{1F240}"=>"\u3014\u672C\u3015", "\u{1F241}"=>"\u3014\u4E09\u3015", "\u{1F242}"=>"\u3014\u4E8C\u3015", "\u{1F243}"=>"\u3014\u5B89\u3015", "\u{1F244}"=>"\u3014\u70B9\u3015", "\u{1F245}"=>"\u3014\u6253\u3015",
- "\u{1F246}"=>"\u3014\u76D7\u3015", "\u{1F247}"=>"\u3014\u52DD\u3015", "\u{1F248}"=>"\u3014\u6557\u3015", "\u{1F250}"=>"\u5F97", "\u{1F251}"=>"\u53EF", "\u0385"=>" \u0308\u0301", "\u03D3"=>"\u03A5\u0301", "\u03D4"=>"\u03A5\u0308",
- "\u1E9B"=>"s\u0307", "\u1FC1"=>" \u0308\u0342", "\u1FCD"=>" \u0313\u0300", "\u1FCE"=>" \u0313\u0301", "\u1FCF"=>" \u0313\u0342", "\u1FDD"=>" \u0314\u0300", "\u1FDE"=>" \u0314\u0301", "\u1FDF"=>" \u0314\u0342",
- "\u1FED"=>" \u0308\u0300", "\u1FEE"=>" \u0308\u0301", "\u1FFD"=>" \u0301", "\u2000"=>" ", "\u2001"=>" ",
- }.freeze
-
- COMPOSITION_TABLE = {
- "A\u0300"=>"\u00C0", "A\u0301"=>"\u00C1", "A\u0302"=>"\u00C2", "A\u0303"=>"\u00C3", "A\u0308"=>"\u00C4", "A\u030A"=>"\u00C5", "C\u0327"=>"\u00C7", "E\u0300"=>"\u00C8",
- "E\u0301"=>"\u00C9", "E\u0302"=>"\u00CA", "E\u0308"=>"\u00CB", "I\u0300"=>"\u00CC", "I\u0301"=>"\u00CD", "I\u0302"=>"\u00CE", "I\u0308"=>"\u00CF", "N\u0303"=>"\u00D1",
- "O\u0300"=>"\u00D2", "O\u0301"=>"\u00D3", "O\u0302"=>"\u00D4", "O\u0303"=>"\u00D5", "O\u0308"=>"\u00D6", "U\u0300"=>"\u00D9", "U\u0301"=>"\u00DA", "U\u0302"=>"\u00DB",
- "U\u0308"=>"\u00DC", "Y\u0301"=>"\u00DD", "a\u0300"=>"\u00E0", "a\u0301"=>"\u00E1", "a\u0302"=>"\u00E2", "a\u0303"=>"\u00E3", "a\u0308"=>"\u00E4", "a\u030A"=>"\u00E5",
- "c\u0327"=>"\u00E7", "e\u0300"=>"\u00E8", "e\u0301"=>"\u00E9", "e\u0302"=>"\u00EA", "e\u0308"=>"\u00EB", "i\u0300"=>"\u00EC", "i\u0301"=>"\u00ED", "i\u0302"=>"\u00EE",
- "i\u0308"=>"\u00EF", "n\u0303"=>"\u00F1", "o\u0300"=>"\u00F2", "o\u0301"=>"\u00F3", "o\u0302"=>"\u00F4", "o\u0303"=>"\u00F5", "o\u0308"=>"\u00F6", "u\u0300"=>"\u00F9",
- "u\u0301"=>"\u00FA", "u\u0302"=>"\u00FB", "u\u0308"=>"\u00FC", "y\u0301"=>"\u00FD", "y\u0308"=>"\u00FF", "A\u0304"=>"\u0100", "a\u0304"=>"\u0101", "A\u0306"=>"\u0102",
- "a\u0306"=>"\u0103", "A\u0328"=>"\u0104", "a\u0328"=>"\u0105", "C\u0301"=>"\u0106", "c\u0301"=>"\u0107", "C\u0302"=>"\u0108", "c\u0302"=>"\u0109", "C\u0307"=>"\u010A",
- "c\u0307"=>"\u010B", "C\u030C"=>"\u010C", "c\u030C"=>"\u010D", "D\u030C"=>"\u010E", "d\u030C"=>"\u010F", "E\u0304"=>"\u0112", "e\u0304"=>"\u0113", "E\u0306"=>"\u0114",
- "e\u0306"=>"\u0115", "E\u0307"=>"\u0116", "e\u0307"=>"\u0117", "E\u0328"=>"\u0118", "e\u0328"=>"\u0119", "E\u030C"=>"\u011A", "e\u030C"=>"\u011B", "G\u0302"=>"\u011C",
- "g\u0302"=>"\u011D", "G\u0306"=>"\u011E", "g\u0306"=>"\u011F", "G\u0307"=>"\u0120", "g\u0307"=>"\u0121", "G\u0327"=>"\u0122", "g\u0327"=>"\u0123", "H\u0302"=>"\u0124",
- "h\u0302"=>"\u0125", "I\u0303"=>"\u0128", "i\u0303"=>"\u0129", "I\u0304"=>"\u012A", "i\u0304"=>"\u012B", "I\u0306"=>"\u012C", "i\u0306"=>"\u012D", "I\u0328"=>"\u012E",
- "i\u0328"=>"\u012F", "I\u0307"=>"\u0130", "J\u0302"=>"\u0134", "j\u0302"=>"\u0135", "K\u0327"=>"\u0136", "k\u0327"=>"\u0137", "L\u0301"=>"\u0139", "l\u0301"=>"\u013A",
- "L\u0327"=>"\u013B", "l\u0327"=>"\u013C", "L\u030C"=>"\u013D", "l\u030C"=>"\u013E", "N\u0301"=>"\u0143", "n\u0301"=>"\u0144", "N\u0327"=>"\u0145", "n\u0327"=>"\u0146",
- "N\u030C"=>"\u0147", "n\u030C"=>"\u0148", "O\u0304"=>"\u014C", "o\u0304"=>"\u014D", "O\u0306"=>"\u014E", "o\u0306"=>"\u014F", "O\u030B"=>"\u0150", "o\u030B"=>"\u0151",
- "R\u0301"=>"\u0154", "r\u0301"=>"\u0155", "R\u0327"=>"\u0156", "r\u0327"=>"\u0157", "R\u030C"=>"\u0158", "r\u030C"=>"\u0159", "S\u0301"=>"\u015A", "s\u0301"=>"\u015B",
- "S\u0302"=>"\u015C", "s\u0302"=>"\u015D", "S\u0327"=>"\u015E", "s\u0327"=>"\u015F", "S\u030C"=>"\u0160", "s\u030C"=>"\u0161", "T\u0327"=>"\u0162", "t\u0327"=>"\u0163",
- "T\u030C"=>"\u0164", "t\u030C"=>"\u0165", "U\u0303"=>"\u0168", "u\u0303"=>"\u0169", "U\u0304"=>"\u016A", "u\u0304"=>"\u016B", "U\u0306"=>"\u016C", "u\u0306"=>"\u016D",
- "U\u030A"=>"\u016E", "u\u030A"=>"\u016F", "U\u030B"=>"\u0170", "u\u030B"=>"\u0171", "U\u0328"=>"\u0172", "u\u0328"=>"\u0173", "W\u0302"=>"\u0174", "w\u0302"=>"\u0175",
- "Y\u0302"=>"\u0176", "y\u0302"=>"\u0177", "Y\u0308"=>"\u0178", "Z\u0301"=>"\u0179", "z\u0301"=>"\u017A", "Z\u0307"=>"\u017B", "z\u0307"=>"\u017C", "Z\u030C"=>"\u017D",
- "z\u030C"=>"\u017E", "O\u031B"=>"\u01A0", "o\u031B"=>"\u01A1", "U\u031B"=>"\u01AF", "u\u031B"=>"\u01B0", "A\u030C"=>"\u01CD", "a\u030C"=>"\u01CE", "I\u030C"=>"\u01CF",
- "i\u030C"=>"\u01D0", "O\u030C"=>"\u01D1", "o\u030C"=>"\u01D2", "U\u030C"=>"\u01D3", "u\u030C"=>"\u01D4", "\u00DC\u0304"=>"\u01D5", "\u00FC\u0304"=>"\u01D6", "\u00DC\u0301"=>"\u01D7",
- "\u00FC\u0301"=>"\u01D8", "\u00DC\u030C"=>"\u01D9", "\u00FC\u030C"=>"\u01DA", "\u00DC\u0300"=>"\u01DB", "\u00FC\u0300"=>"\u01DC", "\u00C4\u0304"=>"\u01DE", "\u00E4\u0304"=>"\u01DF", "\u0226\u0304"=>"\u01E0",
- "\u0227\u0304"=>"\u01E1", "\u00C6\u0304"=>"\u01E2", "\u00E6\u0304"=>"\u01E3", "G\u030C"=>"\u01E6", "g\u030C"=>"\u01E7", "K\u030C"=>"\u01E8", "k\u030C"=>"\u01E9", "O\u0328"=>"\u01EA",
- "o\u0328"=>"\u01EB", "\u01EA\u0304"=>"\u01EC", "\u01EB\u0304"=>"\u01ED", "\u01B7\u030C"=>"\u01EE", "\u0292\u030C"=>"\u01EF", "j\u030C"=>"\u01F0", "G\u0301"=>"\u01F4", "g\u0301"=>"\u01F5",
- "N\u0300"=>"\u01F8", "n\u0300"=>"\u01F9", "\u00C5\u0301"=>"\u01FA", "\u00E5\u0301"=>"\u01FB", "\u00C6\u0301"=>"\u01FC", "\u00E6\u0301"=>"\u01FD", "\u00D8\u0301"=>"\u01FE", "\u00F8\u0301"=>"\u01FF",
- "A\u030F"=>"\u0200", "a\u030F"=>"\u0201", "A\u0311"=>"\u0202", "a\u0311"=>"\u0203", "E\u030F"=>"\u0204", "e\u030F"=>"\u0205", "E\u0311"=>"\u0206", "e\u0311"=>"\u0207",
- "I\u030F"=>"\u0208", "i\u030F"=>"\u0209", "I\u0311"=>"\u020A", "i\u0311"=>"\u020B", "O\u030F"=>"\u020C", "o\u030F"=>"\u020D", "O\u0311"=>"\u020E", "o\u0311"=>"\u020F",
- "R\u030F"=>"\u0210", "r\u030F"=>"\u0211", "R\u0311"=>"\u0212", "r\u0311"=>"\u0213", "U\u030F"=>"\u0214", "u\u030F"=>"\u0215", "U\u0311"=>"\u0216", "u\u0311"=>"\u0217",
- "S\u0326"=>"\u0218", "s\u0326"=>"\u0219", "T\u0326"=>"\u021A", "t\u0326"=>"\u021B", "H\u030C"=>"\u021E", "h\u030C"=>"\u021F", "A\u0307"=>"\u0226", "a\u0307"=>"\u0227",
- "E\u0327"=>"\u0228", "e\u0327"=>"\u0229", "\u00D6\u0304"=>"\u022A", "\u00F6\u0304"=>"\u022B", "\u00D5\u0304"=>"\u022C", "\u00F5\u0304"=>"\u022D", "O\u0307"=>"\u022E", "o\u0307"=>"\u022F",
- "\u022E\u0304"=>"\u0230", "\u022F\u0304"=>"\u0231", "Y\u0304"=>"\u0232", "y\u0304"=>"\u0233", "\u00A8\u0301"=>"\u0385", "\u0391\u0301"=>"\u0386", "\u0395\u0301"=>"\u0388", "\u0397\u0301"=>"\u0389",
- "\u0399\u0301"=>"\u038A", "\u039F\u0301"=>"\u038C", "\u03A5\u0301"=>"\u038E", "\u03A9\u0301"=>"\u038F", "\u03CA\u0301"=>"\u0390", "\u0399\u0308"=>"\u03AA", "\u03A5\u0308"=>"\u03AB", "\u03B1\u0301"=>"\u03AC",
- "\u03B5\u0301"=>"\u03AD", "\u03B7\u0301"=>"\u03AE", "\u03B9\u0301"=>"\u03AF", "\u03CB\u0301"=>"\u03B0", "\u03B9\u0308"=>"\u03CA", "\u03C5\u0308"=>"\u03CB", "\u03BF\u0301"=>"\u03CC", "\u03C5\u0301"=>"\u03CD",
- "\u03C9\u0301"=>"\u03CE", "\u03D2\u0301"=>"\u03D3", "\u03D2\u0308"=>"\u03D4", "\u0415\u0300"=>"\u0400", "\u0415\u0308"=>"\u0401", "\u0413\u0301"=>"\u0403", "\u0406\u0308"=>"\u0407", "\u041A\u0301"=>"\u040C",
- "\u0418\u0300"=>"\u040D", "\u0423\u0306"=>"\u040E", "\u0418\u0306"=>"\u0419", "\u0438\u0306"=>"\u0439", "\u0435\u0300"=>"\u0450", "\u0435\u0308"=>"\u0451", "\u0433\u0301"=>"\u0453", "\u0456\u0308"=>"\u0457",
- "\u043A\u0301"=>"\u045C", "\u0438\u0300"=>"\u045D", "\u0443\u0306"=>"\u045E", "\u0474\u030F"=>"\u0476", "\u0475\u030F"=>"\u0477", "\u0416\u0306"=>"\u04C1", "\u0436\u0306"=>"\u04C2", "\u0410\u0306"=>"\u04D0",
- "\u0430\u0306"=>"\u04D1", "\u0410\u0308"=>"\u04D2", "\u0430\u0308"=>"\u04D3", "\u0415\u0306"=>"\u04D6", "\u0435\u0306"=>"\u04D7", "\u04D8\u0308"=>"\u04DA", "\u04D9\u0308"=>"\u04DB", "\u0416\u0308"=>"\u04DC",
- "\u0436\u0308"=>"\u04DD", "\u0417\u0308"=>"\u04DE", "\u0437\u0308"=>"\u04DF", "\u0418\u0304"=>"\u04E2", "\u0438\u0304"=>"\u04E3", "\u0418\u0308"=>"\u04E4", "\u0438\u0308"=>"\u04E5", "\u041E\u0308"=>"\u04E6",
- "\u043E\u0308"=>"\u04E7", "\u04E8\u0308"=>"\u04EA", "\u04E9\u0308"=>"\u04EB", "\u042D\u0308"=>"\u04EC", "\u044D\u0308"=>"\u04ED", "\u0423\u0304"=>"\u04EE", "\u0443\u0304"=>"\u04EF", "\u0423\u0308"=>"\u04F0",
- "\u0443\u0308"=>"\u04F1", "\u0423\u030B"=>"\u04F2", "\u0443\u030B"=>"\u04F3", "\u0427\u0308"=>"\u04F4", "\u0447\u0308"=>"\u04F5", "\u042B\u0308"=>"\u04F8", "\u044B\u0308"=>"\u04F9", "\u0627\u0653"=>"\u0622",
- "\u0627\u0654"=>"\u0623", "\u0648\u0654"=>"\u0624", "\u0627\u0655"=>"\u0625", "\u064A\u0654"=>"\u0626", "\u06D5\u0654"=>"\u06C0", "\u06C1\u0654"=>"\u06C2", "\u06D2\u0654"=>"\u06D3", "\u0928\u093C"=>"\u0929",
- "\u0930\u093C"=>"\u0931", "\u0933\u093C"=>"\u0934", "\u09C7\u09BE"=>"\u09CB", "\u09C7\u09D7"=>"\u09CC", "\u0B47\u0B56"=>"\u0B48", "\u0B47\u0B3E"=>"\u0B4B", "\u0B47\u0B57"=>"\u0B4C", "\u0B92\u0BD7"=>"\u0B94",
- "\u0BC6\u0BBE"=>"\u0BCA", "\u0BC7\u0BBE"=>"\u0BCB", "\u0BC6\u0BD7"=>"\u0BCC", "\u0C46\u0C56"=>"\u0C48", "\u0CBF\u0CD5"=>"\u0CC0", "\u0CC6\u0CD5"=>"\u0CC7", "\u0CC6\u0CD6"=>"\u0CC8", "\u0CC6\u0CC2"=>"\u0CCA",
- "\u0CCA\u0CD5"=>"\u0CCB", "\u0D46\u0D3E"=>"\u0D4A", "\u0D47\u0D3E"=>"\u0D4B", "\u0D46\u0D57"=>"\u0D4C", "\u0DD9\u0DCA"=>"\u0DDA", "\u0DD9\u0DCF"=>"\u0DDC", "\u0DDC\u0DCA"=>"\u0DDD", "\u0DD9\u0DDF"=>"\u0DDE",
- "\u1025\u102E"=>"\u1026", "\u1B05\u1B35"=>"\u1B06", "\u1B07\u1B35"=>"\u1B08", "\u1B09\u1B35"=>"\u1B0A", "\u1B0B\u1B35"=>"\u1B0C", "\u1B0D\u1B35"=>"\u1B0E", "\u1B11\u1B35"=>"\u1B12", "\u1B3A\u1B35"=>"\u1B3B",
- "\u1B3C\u1B35"=>"\u1B3D", "\u1B3E\u1B35"=>"\u1B40", "\u1B3F\u1B35"=>"\u1B41", "\u1B42\u1B35"=>"\u1B43", "A\u0325"=>"\u1E00", "a\u0325"=>"\u1E01", "B\u0307"=>"\u1E02", "b\u0307"=>"\u1E03",
- "B\u0323"=>"\u1E04", "b\u0323"=>"\u1E05", "B\u0331"=>"\u1E06", "b\u0331"=>"\u1E07", "\u00C7\u0301"=>"\u1E08", "\u00E7\u0301"=>"\u1E09", "D\u0307"=>"\u1E0A", "d\u0307"=>"\u1E0B",
- "D\u0323"=>"\u1E0C", "d\u0323"=>"\u1E0D", "D\u0331"=>"\u1E0E", "d\u0331"=>"\u1E0F", "D\u0327"=>"\u1E10", "d\u0327"=>"\u1E11", "D\u032D"=>"\u1E12", "d\u032D"=>"\u1E13",
- "\u0112\u0300"=>"\u1E14", "\u0113\u0300"=>"\u1E15", "\u0112\u0301"=>"\u1E16", "\u0113\u0301"=>"\u1E17", "E\u032D"=>"\u1E18", "e\u032D"=>"\u1E19", "E\u0330"=>"\u1E1A", "e\u0330"=>"\u1E1B",
- "\u0228\u0306"=>"\u1E1C", "\u0229\u0306"=>"\u1E1D", "F\u0307"=>"\u1E1E", "f\u0307"=>"\u1E1F", "G\u0304"=>"\u1E20", "g\u0304"=>"\u1E21", "H\u0307"=>"\u1E22", "h\u0307"=>"\u1E23",
- "H\u0323"=>"\u1E24", "h\u0323"=>"\u1E25", "H\u0308"=>"\u1E26", "h\u0308"=>"\u1E27", "H\u0327"=>"\u1E28", "h\u0327"=>"\u1E29", "H\u032E"=>"\u1E2A", "h\u032E"=>"\u1E2B",
- "I\u0330"=>"\u1E2C", "i\u0330"=>"\u1E2D", "\u00CF\u0301"=>"\u1E2E", "\u00EF\u0301"=>"\u1E2F", "K\u0301"=>"\u1E30", "k\u0301"=>"\u1E31", "K\u0323"=>"\u1E32", "k\u0323"=>"\u1E33",
- "K\u0331"=>"\u1E34", "k\u0331"=>"\u1E35", "L\u0323"=>"\u1E36", "l\u0323"=>"\u1E37", "\u1E36\u0304"=>"\u1E38", "\u1E37\u0304"=>"\u1E39", "L\u0331"=>"\u1E3A", "l\u0331"=>"\u1E3B",
- "L\u032D"=>"\u1E3C", "l\u032D"=>"\u1E3D", "M\u0301"=>"\u1E3E", "m\u0301"=>"\u1E3F", "M\u0307"=>"\u1E40", "m\u0307"=>"\u1E41", "M\u0323"=>"\u1E42", "m\u0323"=>"\u1E43",
- "N\u0307"=>"\u1E44", "n\u0307"=>"\u1E45", "N\u0323"=>"\u1E46", "n\u0323"=>"\u1E47", "N\u0331"=>"\u1E48", "n\u0331"=>"\u1E49", "N\u032D"=>"\u1E4A", "n\u032D"=>"\u1E4B",
- "\u00D5\u0301"=>"\u1E4C", "\u00F5\u0301"=>"\u1E4D", "\u00D5\u0308"=>"\u1E4E", "\u00F5\u0308"=>"\u1E4F", "\u014C\u0300"=>"\u1E50", "\u014D\u0300"=>"\u1E51", "\u014C\u0301"=>"\u1E52", "\u014D\u0301"=>"\u1E53",
- "P\u0301"=>"\u1E54", "p\u0301"=>"\u1E55", "P\u0307"=>"\u1E56", "p\u0307"=>"\u1E57", "R\u0307"=>"\u1E58", "r\u0307"=>"\u1E59", "R\u0323"=>"\u1E5A", "r\u0323"=>"\u1E5B",
- "\u1E5A\u0304"=>"\u1E5C", "\u1E5B\u0304"=>"\u1E5D", "R\u0331"=>"\u1E5E", "r\u0331"=>"\u1E5F", "S\u0307"=>"\u1E60", "s\u0307"=>"\u1E61", "S\u0323"=>"\u1E62", "s\u0323"=>"\u1E63",
- "\u015A\u0307"=>"\u1E64", "\u015B\u0307"=>"\u1E65", "\u0160\u0307"=>"\u1E66", "\u0161\u0307"=>"\u1E67", "\u1E62\u0307"=>"\u1E68", "\u1E63\u0307"=>"\u1E69", "T\u0307"=>"\u1E6A", "t\u0307"=>"\u1E6B",
- "T\u0323"=>"\u1E6C", "t\u0323"=>"\u1E6D", "T\u0331"=>"\u1E6E", "t\u0331"=>"\u1E6F", "T\u032D"=>"\u1E70", "t\u032D"=>"\u1E71", "U\u0324"=>"\u1E72", "u\u0324"=>"\u1E73",
- "U\u0330"=>"\u1E74", "u\u0330"=>"\u1E75", "U\u032D"=>"\u1E76", "u\u032D"=>"\u1E77", "\u0168\u0301"=>"\u1E78", "\u0169\u0301"=>"\u1E79", "\u016A\u0308"=>"\u1E7A", "\u016B\u0308"=>"\u1E7B",
- "V\u0303"=>"\u1E7C", "v\u0303"=>"\u1E7D", "V\u0323"=>"\u1E7E", "v\u0323"=>"\u1E7F", "W\u0300"=>"\u1E80", "w\u0300"=>"\u1E81", "W\u0301"=>"\u1E82", "w\u0301"=>"\u1E83",
- "W\u0308"=>"\u1E84", "w\u0308"=>"\u1E85", "W\u0307"=>"\u1E86", "w\u0307"=>"\u1E87", "W\u0323"=>"\u1E88", "w\u0323"=>"\u1E89", "X\u0307"=>"\u1E8A", "x\u0307"=>"\u1E8B",
- "X\u0308"=>"\u1E8C", "x\u0308"=>"\u1E8D", "Y\u0307"=>"\u1E8E", "y\u0307"=>"\u1E8F", "Z\u0302"=>"\u1E90", "z\u0302"=>"\u1E91", "Z\u0323"=>"\u1E92", "z\u0323"=>"\u1E93",
- "Z\u0331"=>"\u1E94", "z\u0331"=>"\u1E95", "h\u0331"=>"\u1E96", "t\u0308"=>"\u1E97", "w\u030A"=>"\u1E98", "y\u030A"=>"\u1E99", "\u017F\u0307"=>"\u1E9B", "A\u0323"=>"\u1EA0",
- "a\u0323"=>"\u1EA1", "A\u0309"=>"\u1EA2", "a\u0309"=>"\u1EA3", "\u00C2\u0301"=>"\u1EA4", "\u00E2\u0301"=>"\u1EA5", "\u00C2\u0300"=>"\u1EA6", "\u00E2\u0300"=>"\u1EA7", "\u00C2\u0309"=>"\u1EA8",
- "\u00E2\u0309"=>"\u1EA9", "\u00C2\u0303"=>"\u1EAA", "\u00E2\u0303"=>"\u1EAB", "\u1EA0\u0302"=>"\u1EAC", "\u1EA1\u0302"=>"\u1EAD", "\u0102\u0301"=>"\u1EAE", "\u0103\u0301"=>"\u1EAF", "\u0102\u0300"=>"\u1EB0",
- "\u0103\u0300"=>"\u1EB1", "\u0102\u0309"=>"\u1EB2", "\u0103\u0309"=>"\u1EB3", "\u0102\u0303"=>"\u1EB4", "\u0103\u0303"=>"\u1EB5", "\u1EA0\u0306"=>"\u1EB6", "\u1EA1\u0306"=>"\u1EB7", "E\u0323"=>"\u1EB8",
- "e\u0323"=>"\u1EB9", "E\u0309"=>"\u1EBA", "e\u0309"=>"\u1EBB", "E\u0303"=>"\u1EBC", "e\u0303"=>"\u1EBD", "\u00CA\u0301"=>"\u1EBE", "\u00EA\u0301"=>"\u1EBF", "\u00CA\u0300"=>"\u1EC0",
- "\u00EA\u0300"=>"\u1EC1", "\u00CA\u0309"=>"\u1EC2", "\u00EA\u0309"=>"\u1EC3", "\u00CA\u0303"=>"\u1EC4", "\u00EA\u0303"=>"\u1EC5", "\u1EB8\u0302"=>"\u1EC6", "\u1EB9\u0302"=>"\u1EC7", "I\u0309"=>"\u1EC8",
- "i\u0309"=>"\u1EC9", "I\u0323"=>"\u1ECA", "i\u0323"=>"\u1ECB", "O\u0323"=>"\u1ECC", "o\u0323"=>"\u1ECD", "O\u0309"=>"\u1ECE", "o\u0309"=>"\u1ECF", "\u00D4\u0301"=>"\u1ED0",
- "\u00F4\u0301"=>"\u1ED1", "\u00D4\u0300"=>"\u1ED2", "\u00F4\u0300"=>"\u1ED3", "\u00D4\u0309"=>"\u1ED4", "\u00F4\u0309"=>"\u1ED5", "\u00D4\u0303"=>"\u1ED6", "\u00F4\u0303"=>"\u1ED7", "\u1ECC\u0302"=>"\u1ED8",
- "\u1ECD\u0302"=>"\u1ED9", "\u01A0\u0301"=>"\u1EDA", "\u01A1\u0301"=>"\u1EDB", "\u01A0\u0300"=>"\u1EDC", "\u01A1\u0300"=>"\u1EDD", "\u01A0\u0309"=>"\u1EDE", "\u01A1\u0309"=>"\u1EDF", "\u01A0\u0303"=>"\u1EE0",
- "\u01A1\u0303"=>"\u1EE1", "\u01A0\u0323"=>"\u1EE2", "\u01A1\u0323"=>"\u1EE3", "U\u0323"=>"\u1EE4", "u\u0323"=>"\u1EE5", "U\u0309"=>"\u1EE6", "u\u0309"=>"\u1EE7", "\u01AF\u0301"=>"\u1EE8",
- "\u01B0\u0301"=>"\u1EE9", "\u01AF\u0300"=>"\u1EEA", "\u01B0\u0300"=>"\u1EEB", "\u01AF\u0309"=>"\u1EEC", "\u01B0\u0309"=>"\u1EED", "\u01AF\u0303"=>"\u1EEE", "\u01B0\u0303"=>"\u1EEF", "\u01AF\u0323"=>"\u1EF0",
- "\u01B0\u0323"=>"\u1EF1", "Y\u0300"=>"\u1EF2", "y\u0300"=>"\u1EF3", "Y\u0323"=>"\u1EF4", "y\u0323"=>"\u1EF5", "Y\u0309"=>"\u1EF6", "y\u0309"=>"\u1EF7", "Y\u0303"=>"\u1EF8",
- "y\u0303"=>"\u1EF9", "\u03B1\u0313"=>"\u1F00", "\u03B1\u0314"=>"\u1F01", "\u1F00\u0300"=>"\u1F02", "\u1F01\u0300"=>"\u1F03", "\u1F00\u0301"=>"\u1F04", "\u1F01\u0301"=>"\u1F05", "\u1F00\u0342"=>"\u1F06",
- "\u1F01\u0342"=>"\u1F07", "\u0391\u0313"=>"\u1F08", "\u0391\u0314"=>"\u1F09", "\u1F08\u0300"=>"\u1F0A", "\u1F09\u0300"=>"\u1F0B", "\u1F08\u0301"=>"\u1F0C", "\u1F09\u0301"=>"\u1F0D", "\u1F08\u0342"=>"\u1F0E",
- "\u1F09\u0342"=>"\u1F0F", "\u03B5\u0313"=>"\u1F10", "\u03B5\u0314"=>"\u1F11", "\u1F10\u0300"=>"\u1F12", "\u1F11\u0300"=>"\u1F13", "\u1F10\u0301"=>"\u1F14", "\u1F11\u0301"=>"\u1F15", "\u0395\u0313"=>"\u1F18",
- "\u0395\u0314"=>"\u1F19", "\u1F18\u0300"=>"\u1F1A", "\u1F19\u0300"=>"\u1F1B", "\u1F18\u0301"=>"\u1F1C", "\u1F19\u0301"=>"\u1F1D", "\u03B7\u0313"=>"\u1F20", "\u03B7\u0314"=>"\u1F21", "\u1F20\u0300"=>"\u1F22",
- "\u1F21\u0300"=>"\u1F23", "\u1F20\u0301"=>"\u1F24", "\u1F21\u0301"=>"\u1F25", "\u1F20\u0342"=>"\u1F26", "\u1F21\u0342"=>"\u1F27", "\u0397\u0313"=>"\u1F28", "\u0397\u0314"=>"\u1F29", "\u1F28\u0300"=>"\u1F2A",
- "\u1F29\u0300"=>"\u1F2B", "\u1F28\u0301"=>"\u1F2C", "\u1F29\u0301"=>"\u1F2D", "\u1F28\u0342"=>"\u1F2E", "\u1F29\u0342"=>"\u1F2F", "\u03B9\u0313"=>"\u1F30", "\u03B9\u0314"=>"\u1F31", "\u1F30\u0300"=>"\u1F32",
- "\u1F31\u0300"=>"\u1F33", "\u1F30\u0301"=>"\u1F34", "\u1F31\u0301"=>"\u1F35", "\u1F30\u0342"=>"\u1F36", "\u1F31\u0342"=>"\u1F37", "\u0399\u0313"=>"\u1F38", "\u0399\u0314"=>"\u1F39", "\u1F38\u0300"=>"\u1F3A",
- "\u1F39\u0300"=>"\u1F3B", "\u1F38\u0301"=>"\u1F3C", "\u1F39\u0301"=>"\u1F3D", "\u1F38\u0342"=>"\u1F3E", "\u1F39\u0342"=>"\u1F3F", "\u03BF\u0313"=>"\u1F40", "\u03BF\u0314"=>"\u1F41", "\u1F40\u0300"=>"\u1F42",
- "\u1F41\u0300"=>"\u1F43", "\u1F40\u0301"=>"\u1F44", "\u1F41\u0301"=>"\u1F45", "\u039F\u0313"=>"\u1F48", "\u039F\u0314"=>"\u1F49", "\u1F48\u0300"=>"\u1F4A", "\u1F49\u0300"=>"\u1F4B", "\u1F48\u0301"=>"\u1F4C",
- "\u1F49\u0301"=>"\u1F4D", "\u03C5\u0313"=>"\u1F50", "\u03C5\u0314"=>"\u1F51", "\u1F50\u0300"=>"\u1F52", "\u1F51\u0300"=>"\u1F53", "\u1F50\u0301"=>"\u1F54", "\u1F51\u0301"=>"\u1F55", "\u1F50\u0342"=>"\u1F56",
- "\u1F51\u0342"=>"\u1F57", "\u03A5\u0314"=>"\u1F59", "\u1F59\u0300"=>"\u1F5B", "\u1F59\u0301"=>"\u1F5D", "\u1F59\u0342"=>"\u1F5F", "\u03C9\u0313"=>"\u1F60", "\u03C9\u0314"=>"\u1F61", "\u1F60\u0300"=>"\u1F62",
- "\u1F61\u0300"=>"\u1F63", "\u1F60\u0301"=>"\u1F64", "\u1F61\u0301"=>"\u1F65", "\u1F60\u0342"=>"\u1F66", "\u1F61\u0342"=>"\u1F67", "\u03A9\u0313"=>"\u1F68", "\u03A9\u0314"=>"\u1F69", "\u1F68\u0300"=>"\u1F6A",
- "\u1F69\u0300"=>"\u1F6B", "\u1F68\u0301"=>"\u1F6C", "\u1F69\u0301"=>"\u1F6D", "\u1F68\u0342"=>"\u1F6E", "\u1F69\u0342"=>"\u1F6F", "\u03B1\u0300"=>"\u1F70", "\u03B5\u0300"=>"\u1F72", "\u03B7\u0300"=>"\u1F74",
- "\u03B9\u0300"=>"\u1F76", "\u03BF\u0300"=>"\u1F78", "\u03C5\u0300"=>"\u1F7A", "\u03C9\u0300"=>"\u1F7C", "\u1F00\u0345"=>"\u1F80", "\u1F01\u0345"=>"\u1F81", "\u1F02\u0345"=>"\u1F82", "\u1F03\u0345"=>"\u1F83",
- "\u1F04\u0345"=>"\u1F84", "\u1F05\u0345"=>"\u1F85", "\u1F06\u0345"=>"\u1F86", "\u1F07\u0345"=>"\u1F87", "\u1F08\u0345"=>"\u1F88", "\u1F09\u0345"=>"\u1F89", "\u1F0A\u0345"=>"\u1F8A", "\u1F0B\u0345"=>"\u1F8B",
- "\u1F0C\u0345"=>"\u1F8C", "\u1F0D\u0345"=>"\u1F8D", "\u1F0E\u0345"=>"\u1F8E", "\u1F0F\u0345"=>"\u1F8F", "\u1F20\u0345"=>"\u1F90", "\u1F21\u0345"=>"\u1F91", "\u1F22\u0345"=>"\u1F92", "\u1F23\u0345"=>"\u1F93",
- "\u1F24\u0345"=>"\u1F94", "\u1F25\u0345"=>"\u1F95", "\u1F26\u0345"=>"\u1F96", "\u1F27\u0345"=>"\u1F97", "\u1F28\u0345"=>"\u1F98", "\u1F29\u0345"=>"\u1F99", "\u1F2A\u0345"=>"\u1F9A", "\u1F2B\u0345"=>"\u1F9B",
- "\u1F2C\u0345"=>"\u1F9C", "\u1F2D\u0345"=>"\u1F9D", "\u1F2E\u0345"=>"\u1F9E", "\u1F2F\u0345"=>"\u1F9F", "\u1F60\u0345"=>"\u1FA0", "\u1F61\u0345"=>"\u1FA1", "\u1F62\u0345"=>"\u1FA2", "\u1F63\u0345"=>"\u1FA3",
- "\u1F64\u0345"=>"\u1FA4", "\u1F65\u0345"=>"\u1FA5", "\u1F66\u0345"=>"\u1FA6", "\u1F67\u0345"=>"\u1FA7", "\u1F68\u0345"=>"\u1FA8", "\u1F69\u0345"=>"\u1FA9", "\u1F6A\u0345"=>"\u1FAA", "\u1F6B\u0345"=>"\u1FAB",
- "\u1F6C\u0345"=>"\u1FAC", "\u1F6D\u0345"=>"\u1FAD", "\u1F6E\u0345"=>"\u1FAE", "\u1F6F\u0345"=>"\u1FAF", "\u03B1\u0306"=>"\u1FB0", "\u03B1\u0304"=>"\u1FB1", "\u1F70\u0345"=>"\u1FB2", "\u03B1\u0345"=>"\u1FB3",
- "\u03AC\u0345"=>"\u1FB4", "\u03B1\u0342"=>"\u1FB6", "\u1FB6\u0345"=>"\u1FB7", "\u0391\u0306"=>"\u1FB8", "\u0391\u0304"=>"\u1FB9", "\u0391\u0300"=>"\u1FBA", "\u0391\u0345"=>"\u1FBC", "\u00A8\u0342"=>"\u1FC1",
- "\u1F74\u0345"=>"\u1FC2", "\u03B7\u0345"=>"\u1FC3", "\u03AE\u0345"=>"\u1FC4", "\u03B7\u0342"=>"\u1FC6", "\u1FC6\u0345"=>"\u1FC7", "\u0395\u0300"=>"\u1FC8", "\u0397\u0300"=>"\u1FCA", "\u0397\u0345"=>"\u1FCC",
- "\u1FBF\u0300"=>"\u1FCD", "\u1FBF\u0301"=>"\u1FCE", "\u1FBF\u0342"=>"\u1FCF", "\u03B9\u0306"=>"\u1FD0", "\u03B9\u0304"=>"\u1FD1", "\u03CA\u0300"=>"\u1FD2", "\u03B9\u0342"=>"\u1FD6", "\u03CA\u0342"=>"\u1FD7",
- "\u0399\u0306"=>"\u1FD8", "\u0399\u0304"=>"\u1FD9", "\u0399\u0300"=>"\u1FDA", "\u1FFE\u0300"=>"\u1FDD", "\u1FFE\u0301"=>"\u1FDE", "\u1FFE\u0342"=>"\u1FDF", "\u03C5\u0306"=>"\u1FE0", "\u03C5\u0304"=>"\u1FE1",
- "\u03CB\u0300"=>"\u1FE2", "\u03C1\u0313"=>"\u1FE4", "\u03C1\u0314"=>"\u1FE5", "\u03C5\u0342"=>"\u1FE6", "\u03CB\u0342"=>"\u1FE7", "\u03A5\u0306"=>"\u1FE8", "\u03A5\u0304"=>"\u1FE9", "\u03A5\u0300"=>"\u1FEA",
- "\u03A1\u0314"=>"\u1FEC", "\u00A8\u0300"=>"\u1FED", "\u1F7C\u0345"=>"\u1FF2", "\u03C9\u0345"=>"\u1FF3", "\u03CE\u0345"=>"\u1FF4", "\u03C9\u0342"=>"\u1FF6", "\u1FF6\u0345"=>"\u1FF7", "\u039F\u0300"=>"\u1FF8",
- "\u03A9\u0300"=>"\u1FFA", "\u03A9\u0345"=>"\u1FFC", "\u2190\u0338"=>"\u219A", "\u2192\u0338"=>"\u219B", "\u2194\u0338"=>"\u21AE", "\u21D0\u0338"=>"\u21CD", "\u21D4\u0338"=>"\u21CE", "\u21D2\u0338"=>"\u21CF",
- "\u2203\u0338"=>"\u2204", "\u2208\u0338"=>"\u2209", "\u220B\u0338"=>"\u220C", "\u2223\u0338"=>"\u2224", "\u2225\u0338"=>"\u2226", "\u223C\u0338"=>"\u2241", "\u2243\u0338"=>"\u2244", "\u2245\u0338"=>"\u2247",
- "\u2248\u0338"=>"\u2249", "=\u0338"=>"\u2260", "\u2261\u0338"=>"\u2262", "\u224D\u0338"=>"\u226D", "<\u0338"=>"\u226E", ">\u0338"=>"\u226F", "\u2264\u0338"=>"\u2270", "\u2265\u0338"=>"\u2271",
- "\u2272\u0338"=>"\u2274", "\u2273\u0338"=>"\u2275", "\u2276\u0338"=>"\u2278", "\u2277\u0338"=>"\u2279", "\u227A\u0338"=>"\u2280", "\u227B\u0338"=>"\u2281", "\u2282\u0338"=>"\u2284", "\u2283\u0338"=>"\u2285",
- "\u2286\u0338"=>"\u2288", "\u2287\u0338"=>"\u2289", "\u22A2\u0338"=>"\u22AC", "\u22A8\u0338"=>"\u22AD", "\u22A9\u0338"=>"\u22AE", "\u22AB\u0338"=>"\u22AF", "\u227C\u0338"=>"\u22E0", "\u227D\u0338"=>"\u22E1",
- "\u2291\u0338"=>"\u22E2", "\u2292\u0338"=>"\u22E3", "\u22B2\u0338"=>"\u22EA", "\u22B3\u0338"=>"\u22EB", "\u22B4\u0338"=>"\u22EC", "\u22B5\u0338"=>"\u22ED", "\u304B\u3099"=>"\u304C", "\u304D\u3099"=>"\u304E",
- "\u304F\u3099"=>"\u3050", "\u3051\u3099"=>"\u3052", "\u3053\u3099"=>"\u3054", "\u3055\u3099"=>"\u3056", "\u3057\u3099"=>"\u3058", "\u3059\u3099"=>"\u305A", "\u305B\u3099"=>"\u305C", "\u305D\u3099"=>"\u305E",
- "\u305F\u3099"=>"\u3060", "\u3061\u3099"=>"\u3062", "\u3064\u3099"=>"\u3065", "\u3066\u3099"=>"\u3067", "\u3068\u3099"=>"\u3069", "\u306F\u3099"=>"\u3070", "\u306F\u309A"=>"\u3071", "\u3072\u3099"=>"\u3073",
- "\u3072\u309A"=>"\u3074", "\u3075\u3099"=>"\u3076", "\u3075\u309A"=>"\u3077", "\u3078\u3099"=>"\u3079", "\u3078\u309A"=>"\u307A", "\u307B\u3099"=>"\u307C", "\u307B\u309A"=>"\u307D", "\u3046\u3099"=>"\u3094",
- "\u309D\u3099"=>"\u309E", "\u30AB\u3099"=>"\u30AC", "\u30AD\u3099"=>"\u30AE", "\u30AF\u3099"=>"\u30B0", "\u30B1\u3099"=>"\u30B2", "\u30B3\u3099"=>"\u30B4", "\u30B5\u3099"=>"\u30B6", "\u30B7\u3099"=>"\u30B8",
- "\u30B9\u3099"=>"\u30BA", "\u30BB\u3099"=>"\u30BC", "\u30BD\u3099"=>"\u30BE", "\u30BF\u3099"=>"\u30C0", "\u30C1\u3099"=>"\u30C2", "\u30C4\u3099"=>"\u30C5", "\u30C6\u3099"=>"\u30C7", "\u30C8\u3099"=>"\u30C9",
- "\u30CF\u3099"=>"\u30D0", "\u30CF\u309A"=>"\u30D1", "\u30D2\u3099"=>"\u30D3", "\u30D2\u309A"=>"\u30D4", "\u30D5\u3099"=>"\u30D6", "\u30D5\u309A"=>"\u30D7", "\u30D8\u3099"=>"\u30D9", "\u30D8\u309A"=>"\u30DA",
- "\u30DB\u3099"=>"\u30DC", "\u30DB\u309A"=>"\u30DD", "\u30A6\u3099"=>"\u30F4", "\u30EF\u3099"=>"\u30F7", "\u30F0\u3099"=>"\u30F8", "\u30F1\u3099"=>"\u30F9", "\u30F2\u3099"=>"\u30FA", "\u30FD\u3099"=>"\u30FE",
- "\u{11099}\u{110BA}"=>"\u{1109A}", "\u{1109B}\u{110BA}"=>"\u{1109C}", "\u{110A5}\u{110BA}"=>"\u{110AB}", "\u{11131}\u{11127}"=>"\u{1112E}", "\u{11132}\u{11127}"=>"\u{1112F}", "\u{11347}\u{1133E}"=>"\u{1134B}", "\u{11347}\u{11357}"=>"\u{1134C}", "\u{114B9}\u{114BA}"=>"\u{114BB}",
- "\u{114B9}\u{114B0}"=>"\u{114BC}", "\u{114B9}\u{114BD}"=>"\u{114BE}", "\u{115B8}\u{115AF}"=>"\u{115BA}", "\u{115B9}\u{115AF}"=>"\u{115BB}",
- }.freeze
-end
diff --git a/lib/uri.rb b/lib/uri.rb
index 971a97038f..2e136eb682 100644
--- a/lib/uri.rb
+++ b/lib/uri.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# URI is a module providing classes to handle Uniform Resource Identifiers
# (RFC2396[http://tools.ietf.org/html/rfc2396])
#
@@ -96,7 +95,7 @@
module URI
# :stopdoc:
- VERSION_CODE = '001000'.freeze
+ VERSION_CODE = '000911'.freeze
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
# :startdoc:
diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index 4c7d112e61..771be971a5 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# = uri/common.rb
#
@@ -10,13 +9,537 @@
# See URI for general documentation
#
-require "uri/rfc2396_parser"
-require "uri/rfc3986_parser"
-
module URI
- REGEXP = RFC2396_REGEXP
- Parser = RFC2396_Parser
- RFC3986_PARSER = RFC3986_Parser.new
+ #
+ # Includes URI::REGEXP::PATTERN
+ #
+ module REGEXP
+ #
+ # Patterns used to parse URI's
+ #
+ module PATTERN
+ # :stopdoc:
+
+ # RFC 2396 (URI Generic Syntax)
+ # RFC 2732 (IPv6 Literal Addresses in URL's)
+ # RFC 2373 (IPv6 Addressing Architecture)
+
+ # alpha = lowalpha | upalpha
+ ALPHA = "a-zA-Z"
+ # alphanum = alpha | digit
+ ALNUM = "#{ALPHA}\\d"
+
+ # hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
+ # "a" | "b" | "c" | "d" | "e" | "f"
+ HEX = "a-fA-F\\d"
+ # escaped = "%" hex hex
+ ESCAPED = "%[#{HEX}]{2}"
+ # mark = "-" | "_" | "." | "!" | "~" | "*" | "'" |
+ # "(" | ")"
+ # unreserved = alphanum | mark
+ UNRESERVED = "\\-_.!~*'()#{ALNUM}"
+ # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
+ # "$" | ","
+ # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
+ # "$" | "," | "[" | "]" (RFC 2732)
+ RESERVED = ";/?:@&=+$,\\[\\]"
+
+ # domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
+ DOMLABEL = "(?:[#{ALNUM}](?:[-#{ALNUM}]*[#{ALNUM}])?)"
+ # toplabel = alpha | alpha *( alphanum | "-" ) alphanum
+ TOPLABEL = "(?:[#{ALPHA}](?:[-#{ALNUM}]*[#{ALNUM}])?)"
+ # hostname = *( domainlabel "." ) toplabel [ "." ]
+ HOSTNAME = "(?:#{DOMLABEL}\\.)*#{TOPLABEL}\\.?"
+
+ # :startdoc:
+ end # PATTERN
+
+ # :startdoc:
+ end # REGEXP
+
+ # class that Parses String's into URI's
+ #
+ # It contains a Hash set of patterns and Regexp's that match and validate.
+ #
+ class Parser
+ include REGEXP
+
+ #
+ # == Synopsis
+ #
+ # URI::Parser.new([opts])
+ #
+ # == Args
+ #
+ # The constructor accepts a hash as options for parser.
+ # Keys of options are pattern names of URI components
+ # and values of options are pattern strings.
+ # The constructor generetes set of regexps for parsing URIs.
+ #
+ # You can use the following keys:
+ #
+ # * :ESCAPED (URI::PATTERN::ESCAPED in default)
+ # * :UNRESERVED (URI::PATTERN::UNRESERVED in default)
+ # * :DOMLABEL (URI::PATTERN::DOMLABEL in default)
+ # * :TOPLABEL (URI::PATTERN::TOPLABEL in default)
+ # * :HOSTNAME (URI::PATTERN::HOSTNAME in default)
+ #
+ # == Examples
+ #
+ # p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
+ # u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP:0xb78cf4f8 URL:http://example.jp/%uABCD>
+ # URI.parse(u.to_s) #=> raises URI::InvalidURIError
+ #
+ # s = "http://examle.com/ABCD"
+ # u1 = p.parse(s) #=> #<URI::HTTP:0xb78c3220 URL:http://example.com/ABCD>
+ # u2 = URI.parse(s) #=> #<URI::HTTP:0xb78b6d54 URL:http://example.com/ABCD>
+ # u1 == u2 #=> true
+ # u1.eql?(u2) #=> false
+ #
+ def initialize(opts = {})
+ @pattern = initialize_pattern(opts)
+ @pattern.each_value {|v| v.freeze}
+ @pattern.freeze
+
+ @regexp = initialize_regexp(@pattern)
+ @regexp.each_value {|v| v.freeze}
+ @regexp.freeze
+ end
+
+ # The Hash of patterns.
+ #
+ # see also URI::Parser.initialize_pattern
+ attr_reader :pattern
+
+ # The Hash of Regexp
+ #
+ # see also URI::Parser.initialize_regexp
+ attr_reader :regexp
+
+ # Returns a split URI against regexp[:ABS_URI]
+ def split(uri)
+ case uri
+ when ''
+ # null uri
+
+ when @regexp[:ABS_URI]
+ scheme, opaque, userinfo, host, port,
+ registry, path, query, fragment = $~[1..-1]
+
+ # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
+
+ # absoluteURI = scheme ":" ( hier_part | opaque_part )
+ # hier_part = ( net_path | abs_path ) [ "?" query ]
+ # opaque_part = uric_no_slash *uric
+
+ # abs_path = "/" path_segments
+ # net_path = "//" authority [ abs_path ]
+
+ # authority = server | reg_name
+ # server = [ [ userinfo "@" ] hostport ]
+
+ if !scheme
+ raise InvalidURIError,
+ "bad URI(absolute but no scheme): #{uri}"
+ end
+ if !opaque && (!path && (!host && !registry))
+ raise InvalidURIError,
+ "bad URI(absolute but no path): #{uri}"
+ end
+
+ when @regexp[:REL_URI]
+ scheme = nil
+ opaque = nil
+
+ userinfo, host, port, registry,
+ rel_segment, abs_path, query, fragment = $~[1..-1]
+ if rel_segment && abs_path
+ path = rel_segment + abs_path
+ elsif rel_segment
+ path = rel_segment
+ elsif abs_path
+ path = abs_path
+ end
+
+ # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
+
+ # relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
+
+ # net_path = "//" authority [ abs_path ]
+ # abs_path = "/" path_segments
+ # rel_path = rel_segment [ abs_path ]
+
+ # authority = server | reg_name
+ # server = [ [ userinfo "@" ] hostport ]
+
+ else
+ raise InvalidURIError, "bad URI(is not URI?): #{uri}"
+ end
+
+ path = '' if !path && !opaque # (see RFC2396 Section 5.2)
+ ret = [
+ scheme,
+ userinfo, host, port, # X
+ registry, # X
+ path, # Y
+ opaque, # Y
+ query,
+ fragment
+ ]
+ return ret
+ end
+
+ #
+ # == Args
+ #
+ # +uri+::
+ # String
+ #
+ # == Description
+ #
+ # parses +uri+ and constructs either matching URI scheme object
+ # (FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic
+ #
+ # == Usage
+ #
+ # p = URI::Parser.new
+ # p.parse("ldap://ldap.example.com/dc=example?user=john")
+ # #=> #<URI::LDAP:0x00000000b9e7e8 URL:ldap://ldap.example.com/dc=example?user=john>
+ #
+ def parse(uri)
+ scheme, userinfo, host, port,
+ registry, path, opaque, query, fragment = self.split(uri)
+
+ if scheme && URI.scheme_list.include?(scheme.upcase)
+ URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
+ registry, path, opaque, query,
+ fragment, self)
+ else
+ Generic.new(scheme, userinfo, host, port,
+ registry, path, opaque, query,
+ fragment, self)
+ end
+ end
+
+
+ #
+ # == Args
+ #
+ # +uris+::
+ # an Array of Strings
+ #
+ # == Description
+ #
+ # Attempts to parse and merge a set of URIs
+ #
+ def join(*uris)
+ uris[0] = convert_to_uri(uris[0])
+ uris.inject :merge
+ end
+
+ #
+ # :call-seq:
+ # extract( str )
+ # extract( str, schemes )
+ # extract( str, schemes ) {|item| block }
+ #
+ # == Args
+ #
+ # +str+::
+ # String to search
+ # +schemes+::
+ # Patterns to apply to +str+
+ #
+ # == Description
+ #
+ # Attempts to parse and merge a set of URIs
+ # If no +block+ given , then returns the result,
+ # else it calls +block+ for each element in result.
+ #
+ # see also URI::Parser.make_regexp
+ #
+ def extract(str, schemes = nil)
+ if block_given?
+ str.scan(make_regexp(schemes)) { yield $& }
+ nil
+ else
+ result = []
+ str.scan(make_regexp(schemes)) { result.push $& }
+ result
+ end
+ end
+
+ # returns Regexp that is default self.regexp[:ABS_URI_REF],
+ # unless +schemes+ is provided. Then it is a Regexp.union with self.pattern[:X_ABS_URI]
+ def make_regexp(schemes = nil)
+ unless schemes
+ @regexp[:ABS_URI_REF]
+ else
+ /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x
+ end
+ end
+
+ #
+ # :call-seq:
+ # escape( str )
+ # escape( str, unsafe )
+ #
+ # == Args
+ #
+ # +str+::
+ # String to make safe
+ # +unsafe+::
+ # Regexp to apply. Defaults to self.regexp[:UNSAFE]
+ #
+ # == Description
+ #
+ # constructs a safe String from +str+, removing unsafe characters,
+ # replacing them with codes.
+ #
+ def escape(str, unsafe = @regexp[:UNSAFE])
+ unless unsafe.kind_of?(Regexp)
+ # perhaps unsafe is String object
+ unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false)
+ end
+ str.gsub(unsafe) do
+ us = $&
+ tmp = ''
+ us.each_byte do |uc|
+ tmp << sprintf('%%%02X', uc)
+ end
+ tmp
+ end.force_encoding(Encoding::US_ASCII)
+ end
+
+ #
+ # :call-seq:
+ # unescape( str )
+ # unescape( str, unsafe )
+ #
+ # == Args
+ #
+ # +str+::
+ # String to remove escapes from
+ # +unsafe+::
+ # Regexp to apply. Defaults to self.regexp[:ESCAPED]
+ #
+ # == Description
+ #
+ # Removes escapes from +str+
+ #
+ def unescape(str, escaped = @regexp[:ESCAPED])
+ str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding)
+ end
+
+ @@to_s = Kernel.instance_method(:to_s)
+ def inspect
+ @@to_s.bind(self).call
+ end
+
+ private
+
+ # Constructs the default Hash of patterns
+ def initialize_pattern(opts = {})
+ ret = {}
+ ret[:ESCAPED] = escaped = (opts.delete(:ESCAPED) || PATTERN::ESCAPED)
+ ret[:UNRESERVED] = unreserved = opts.delete(:UNRESERVED) || PATTERN::UNRESERVED
+ ret[:RESERVED] = reserved = opts.delete(:RESERVED) || PATTERN::RESERVED
+ ret[:DOMLABEL] = opts.delete(:DOMLABEL) || PATTERN::DOMLABEL
+ ret[:TOPLABEL] = opts.delete(:TOPLABEL) || PATTERN::TOPLABEL
+ ret[:HOSTNAME] = hostname = opts.delete(:HOSTNAME)
+
+ # RFC 2396 (URI Generic Syntax)
+ # RFC 2732 (IPv6 Literal Addresses in URL's)
+ # RFC 2373 (IPv6 Addressing Architecture)
+
+ # uric = reserved | unreserved | escaped
+ ret[:URIC] = uric = "(?:[#{unreserved}#{reserved}]|#{escaped})"
+ # uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
+ # "&" | "=" | "+" | "$" | ","
+ ret[:URIC_NO_SLASH] = uric_no_slash = "(?:[#{unreserved};?:@&=+$,]|#{escaped})"
+ # query = *uric
+ ret[:QUERY] = query = "#{uric}*"
+ # fragment = *uric
+ ret[:FRAGMENT] = fragment = "#{uric}*"
+
+ # hostname = *( domainlabel "." ) toplabel [ "." ]
+ # reg-name = *( unreserved / pct-encoded / sub-delims ) # RFC3986
+ unless hostname
+ ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-.]|%\\h\\h)+"
+ end
+
+ # RFC 2373, APPENDIX B:
+ # IPv6address = hexpart [ ":" IPv4address ]
+ # IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
+ # hexpart = hexseq | hexseq "::" [ hexseq ] | "::" [ hexseq ]
+ # hexseq = hex4 *( ":" hex4)
+ # hex4 = 1*4HEXDIG
+ #
+ # XXX: This definition has a flaw. "::" + IPv4address must be
+ # allowed too. Here is a replacement.
+ #
+ # IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
+ ret[:IPV4ADDR] = ipv4addr = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
+ # hex4 = 1*4HEXDIG
+ hex4 = "[#{PATTERN::HEX}]{1,4}"
+ # lastpart = hex4 | IPv4address
+ lastpart = "(?:#{hex4}|#{ipv4addr})"
+ # hexseq1 = *( hex4 ":" ) hex4
+ hexseq1 = "(?:#{hex4}:)*#{hex4}"
+ # hexseq2 = *( hex4 ":" ) lastpart
+ hexseq2 = "(?:#{hex4}:)*#{lastpart}"
+ # IPv6address = hexseq2 | [ hexseq1 ] "::" [ hexseq2 ]
+ ret[:IPV6ADDR] = ipv6addr = "(?:#{hexseq2}|(?:#{hexseq1})?::(?:#{hexseq2})?)"
+
+ # IPv6prefix = ( hexseq1 | [ hexseq1 ] "::" [ hexseq1 ] ) "/" 1*2DIGIT
+ # unused
+
+ # ipv6reference = "[" IPv6address "]" (RFC 2732)
+ ret[:IPV6REF] = ipv6ref = "\\[#{ipv6addr}\\]"
+
+ # host = hostname | IPv4address
+ # host = hostname | IPv4address | IPv6reference (RFC 2732)
+ ret[:HOST] = host = "(?:#{hostname}|#{ipv4addr}|#{ipv6ref})"
+ # port = *digit
+ port = '\d*'
+ # hostport = host [ ":" port ]
+ ret[:HOSTPORT] = hostport = "#{host}(?::#{port})?"
+
+ # userinfo = *( unreserved | escaped |
+ # ";" | ":" | "&" | "=" | "+" | "$" | "," )
+ ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,]|#{escaped})*"
+
+ # pchar = unreserved | escaped |
+ # ":" | "@" | "&" | "=" | "+" | "$" | ","
+ pchar = "(?:[#{unreserved}:@&=+$,]|#{escaped})"
+ # param = *pchar
+ param = "#{pchar}*"
+ # segment = *pchar *( ";" param )
+ segment = "#{pchar}*(?:;#{param})*"
+ # path_segments = segment *( "/" segment )
+ ret[:PATH_SEGMENTS] = path_segments = "#{segment}(?:/#{segment})*"
+
+ # server = [ [ userinfo "@" ] hostport ]
+ server = "(?:#{userinfo}@)?#{hostport}"
+ # reg_name = 1*( unreserved | escaped | "$" | "," |
+ # ";" | ":" | "@" | "&" | "=" | "+" )
+ ret[:REG_NAME] = reg_name = "(?:[#{unreserved}$,;:@&=+]|#{escaped})+"
+ # authority = server | reg_name
+ authority = "(?:#{server}|#{reg_name})"
+
+ # rel_segment = 1*( unreserved | escaped |
+ # ";" | "@" | "&" | "=" | "+" | "$" | "," )
+ ret[:REL_SEGMENT] = rel_segment = "(?:[#{unreserved};@&=+$,]|#{escaped})+"
+
+ # scheme = alpha *( alpha | digit | "+" | "-" | "." )
+ ret[:SCHEME] = scheme = "[#{PATTERN::ALPHA}][\\-+.#{PATTERN::ALPHA}\\d]*"
+
+ # abs_path = "/" path_segments
+ ret[:ABS_PATH] = abs_path = "/#{path_segments}"
+ # rel_path = rel_segment [ abs_path ]
+ ret[:REL_PATH] = rel_path = "#{rel_segment}(?:#{abs_path})?"
+ # net_path = "//" authority [ abs_path ]
+ ret[:NET_PATH] = net_path = "//#{authority}(?:#{abs_path})?"
+
+ # hier_part = ( net_path | abs_path ) [ "?" query ]
+ ret[:HIER_PART] = hier_part = "(?:#{net_path}|#{abs_path})(?:\\?(?:#{query}))?"
+ # opaque_part = uric_no_slash *uric
+ ret[:OPAQUE_PART] = opaque_part = "#{uric_no_slash}#{uric}*"
+
+ # absoluteURI = scheme ":" ( hier_part | opaque_part )
+ ret[:ABS_URI] = abs_uri = "#{scheme}:(?:#{hier_part}|#{opaque_part})"
+ # relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
+ ret[:REL_URI] = rel_uri = "(?:#{net_path}|#{abs_path}|#{rel_path})(?:\\?#{query})?"
+
+ # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
+ ret[:URI_REF] = "(?:#{abs_uri}|#{rel_uri})?(?:##{fragment})?"
+
+ ret[:X_ABS_URI] = "
+ (#{scheme}): (?# 1: scheme)
+ (?:
+ (#{opaque_part}) (?# 2: opaque)
+ |
+ (?:(?:
+ //(?:
+ (?:(?:(#{userinfo})@)? (?# 3: userinfo)
+ (?:(#{host})(?::(\\d*))?))? (?# 4: host, 5: port)
+ |
+ (#{reg_name}) (?# 6: registry)
+ )
+ |
+ (?!//)) (?# XXX: '//' is the mark for hostport)
+ (#{abs_path})? (?# 7: path)
+ )(?:\\?(#{query}))? (?# 8: query)
+ )
+ (?:\\#(#{fragment}))? (?# 9: fragment)
+ "
+
+ ret[:X_REL_URI] = "
+ (?:
+ (?:
+ //
+ (?:
+ (?:(#{userinfo})@)? (?# 1: userinfo)
+ (#{host})?(?::(\\d*))? (?# 2: host, 3: port)
+ |
+ (#{reg_name}) (?# 4: registry)
+ )
+ )
+ |
+ (#{rel_segment}) (?# 5: rel_segment)
+ )?
+ (#{abs_path})? (?# 6: abs_path)
+ (?:\\?(#{query}))? (?# 7: query)
+ (?:\\#(#{fragment}))? (?# 8: fragment)
+ "
+
+ ret
+ end
+
+ # Constructs the default Hash of Regexp's
+ def initialize_regexp(pattern)
+ ret = {}
+
+ # for URI::split
+ ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
+ ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
+
+ # for URI::extract
+ ret[:URI_REF] = Regexp.new(pattern[:URI_REF])
+ ret[:ABS_URI_REF] = Regexp.new(pattern[:X_ABS_URI], Regexp::EXTENDED)
+ ret[:REL_URI_REF] = Regexp.new(pattern[:X_REL_URI], Regexp::EXTENDED)
+
+ # for URI::escape/unescape
+ ret[:ESCAPED] = Regexp.new(pattern[:ESCAPED])
+ ret[:UNSAFE] = Regexp.new("[^#{pattern[:UNRESERVED]}#{pattern[:RESERVED]}]")
+
+ # for Generic#initialize
+ ret[:SCHEME] = Regexp.new("\\A#{pattern[:SCHEME]}\\z")
+ ret[:USERINFO] = Regexp.new("\\A#{pattern[:USERINFO]}\\z")
+ ret[:HOST] = Regexp.new("\\A#{pattern[:HOST]}\\z")
+ ret[:PORT] = Regexp.new("\\A#{pattern[:PORT]}\\z")
+ ret[:OPAQUE] = Regexp.new("\\A#{pattern[:OPAQUE_PART]}\\z")
+ ret[:REGISTRY] = Regexp.new("\\A#{pattern[:REG_NAME]}\\z")
+ ret[:ABS_PATH] = Regexp.new("\\A#{pattern[:ABS_PATH]}\\z")
+ ret[:REL_PATH] = Regexp.new("\\A#{pattern[:REL_PATH]}\\z")
+ ret[:QUERY] = Regexp.new("\\A#{pattern[:QUERY]}\\z")
+ ret[:FRAGMENT] = Regexp.new("\\A#{pattern[:FRAGMENT]}\\z")
+
+ ret
+ end
+
+ def convert_to_uri(uri)
+ if uri.is_a?(URI::Generic)
+ uri
+ elsif uri = String.try_convert(uri)
+ parse(uri)
+ else
+ raise ArgumentError,
+ "bad argument (expected URI object or URI string)"
+ end
+ end
+
+ end # class Parser
# URI::Parser.new
DEFAULT_PARSER = Parser.new
@@ -52,7 +575,7 @@ module URI
end
else
raise ArgumentError,
- "expected Array of or Hash of components of #{klass} (#{klass.component[1..-1].join(', ')})"
+ "expected Array of or Hash of components of #{klass.to_s} (#{klass.component[1..-1].join(', ')})"
end
tmp[:scheme] = klass.to_s.sub(/\A.*::/, '').downcase
@@ -186,7 +709,7 @@ module URI
# # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
#
def self.split(uri)
- RFC3986_PARSER.split(uri)
+ DEFAULT_PARSER.split(uri)
end
#
@@ -220,11 +743,8 @@ module URI
# p uri.host
# # => "www.ruby-lang.org"
#
- # It's recommended to first ::escape the provided +uri_str+ if there are any
- # invalid URI characters.
- #
def self.parse(uri)
- RFC3986_PARSER.parse(uri)
+ DEFAULT_PARSER.parse(uri)
end
#
@@ -235,7 +755,7 @@ module URI
# == Args
#
# +str+::
- # String(s) to work with, will be converted to RFC3986 URIs before merging.
+ # String(s) to work with
#
# == Description
#
@@ -246,7 +766,7 @@ module URI
# require 'uri'
#
# p URI.join("http://example.com/","main.rbx")
- # # => #<URI::HTTP:0x2022ac02 URL:http://example.com/main.rbx>
+ # # => #<URI::HTTP:0x2022ac02 URL:http://localhost/main.rbx>
#
# p URI.join('http://example.com', 'foo')
# # => #<URI::HTTP:0x01ab80a0 URL:http://example.com/foo>
@@ -262,7 +782,7 @@ module URI
#
#
def self.join(*str)
- RFC3986_PARSER.join(*str)
+ DEFAULT_PARSER.join(*str)
end
#
@@ -290,7 +810,6 @@ module URI
# # => ["http://foo.example.com/bla", "mailto:test@example.com"]
#
def self.extract(str, schemes = nil, &block)
- warn "#{caller(1)[0]}: warning: URI.extract is obsolete" if $VERBOSE
DEFAULT_PARSER.extract(str, schemes, &block)
end
@@ -326,7 +845,6 @@ module URI
# end
#
def self.regexp(schemes = nil)
- warn "#{caller(1)[0]}: warning: URI.regexp is obsolete" if $VERBOSE
DEFAULT_PARSER.make_regexp(schemes)
end
@@ -347,8 +865,8 @@ module URI
TBLDECWWWCOMP_['+'] = ' '
TBLDECWWWCOMP_.freeze
- HTML5ASCIIINCOMPAT = defined? Encoding::UTF_7 ? [Encoding::UTF_7, Encoding::UTF_16BE, Encoding::UTF_16LE,
- Encoding::UTF_32BE, Encoding::UTF_32LE] : [] # :nodoc:
+ HTML5ASCIIINCOMPAT = [Encoding::UTF_7, Encoding::UTF_16BE, Encoding::UTF_16LE,
+ Encoding::UTF_32BE, Encoding::UTF_32LE] # :nodoc:
# Encode given +str+ to URL-encoded form data.
#
@@ -358,7 +876,7 @@ module URI
# If +enc+ is given, convert +str+ to the encoding before percent encoding.
#
# This is an implementation of
- # http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data
+ # http://www.w3.org/TR/html5/association-of-controls-and-forms.html#url-encoded-form-data
#
# See URI.decode_www_form_component, URI.encode_www_form
def self.encode_www_form_component(str, enc=nil)
@@ -380,7 +898,7 @@ module URI
#
# See URI.encode_www_form_component, URI.decode_www_form
def self.decode_www_form_component(str, enc=Encoding::UTF_8)
- raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/ =~ str
+ raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str
str.b.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
end
@@ -439,12 +957,12 @@ module URI
# This refers http://url.spec.whatwg.org/#concept-urlencoded-parser ,
# so this supports only &-separator, don't support ;-separator.
#
- # ary = URI.decode_www_form("a=1&a=2&b=3")
- # p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
- # p ary.assoc('a').last #=> '1'
- # p ary.assoc('b').last #=> '3'
- # p ary.rassoc('a').last #=> '2'
- # p Hash[ary] # => {"a"=>"2", "b"=>"3"}
+ # ary = URI.decode_www_form("a=1&a=2&b=3")
+ # p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
+ # p ary.assoc('a').last #=> '1'
+ # p ary.assoc('b').last #=> '3'
+ # p ary.rassoc('a').last #=> '2'
+ # p Hash[ary] # => {"a"=>"2", "b"=>"3"}
#
# See URI.decode_www_form_component, URI.encode_www_form
def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb
index e5c00b34da..0c5b13a1b7 100644
--- a/lib/uri/ftp.rb
+++ b/lib/uri/ftp.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = uri/ftp.rb
#
# Author:: Akira Yamada <akira@ruby-lang.org>
@@ -86,8 +85,8 @@ module URI
# require 'uri'
#
# uri = URI::FTP.build(['user:password', 'ftp.example.com', nil,
- # '/path/file.zip', 'i'])
- # puts uri.to_s -> ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i
+ # '/path/file.> zip', 'i'])
+ # puts uri.to_s -> ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=a
#
# uri2 = URI::FTP.build({:host => 'ftp.example.com',
# :path => 'ruby/src'})
@@ -130,24 +129,17 @@ module URI
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
# +opaque+, +query+ and +fragment+, in that order.
#
- def initialize(scheme,
- userinfo, host, port, registry,
- path, opaque,
- query,
- fragment,
- parser = nil,
- arg_check = false)
- raise InvalidURIError unless path
- path = path.sub(/^\//,'')
- path.sub!(/^%2F/,'/')
- super(scheme, userinfo, host, port, registry, path, opaque,
- query, fragment, parser, arg_check)
+ def initialize(*arg)
+ raise InvalidURIError unless arg[5]
+ arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/')
+ super(*arg)
@typecode = nil
- if tmp = @path.index(TYPECODE_PREFIX)
+ tmp = @path.index(TYPECODE_PREFIX)
+ if tmp
typecode = @path[tmp + TYPECODE_PREFIX.size..-1]
@path = @path[0..tmp - 1]
- if arg_check
+ if arg[-1]
self.typecode = typecode
else
self.set_typecode(typecode)
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index 85d42d7bd2..b1195fdf0b 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# = uri/generic.rb
#
# Author:: Akira Yamada <akira@ruby-lang.org>
@@ -57,9 +55,16 @@ module URI
self::COMPONENT
end
- USE_REGISTRY = false # :nodoc:
+ #
+ # Default to not use the registry for a URI::Generic
+ #
+ USE_REGISTRY = false
- def self.use_registry # :nodoc:
+ #
+ # Returns whether a registry of naming
+ # authorities are being used.
+ #
+ def self.use_registry
self::USE_REGISTRY
end
@@ -180,17 +185,19 @@ module URI
@path = nil
@query = nil
@opaque = nil
+ @registry = nil
@fragment = nil
@parser = parser == DEFAULT_PARSER ? nil : parser
if arg_check
self.scheme = scheme
self.userinfo = userinfo
- self.hostname = host
+ self.host = host
self.port = port
self.path = path
self.query = query
self.opaque = opaque
+ self.registry = registry
self.fragment = fragment
else
self.set_scheme(scheme)
@@ -198,13 +205,14 @@ module URI
self.set_host(host)
self.set_port(port)
self.set_path(path)
- self.query = query
+ self.set_query(query)
self.set_opaque(opaque)
- self.fragment=(fragment)
+ self.set_registry(registry)
+ self.set_fragment(fragment)
end
- if registry
+ if @registry && !self.class.use_registry
raise InvalidURIError,
- "the scheme #{@scheme} does not accept registry part: #{registry} (or bad hostname?)"
+ "the scheme #{@scheme} does not accept registry part: #{@registry} (or bad hostname?)"
end
@scheme.freeze if @scheme
@@ -249,9 +257,11 @@ module URI
#
attr_reader :port
- def registry # :nodoc:
- nil
- end
+ # returns the registry component of the URI.
+ #
+ # (see RFC2396 Section 3.2)
+ #
+ attr_reader :registry
# returns the path component of the URI.
#
@@ -391,9 +401,9 @@ module URI
# with a user component defined.
#
def check_user(v)
- if @opaque
+ if @registry || @opaque
raise InvalidURIError,
- "can not set user with opaque"
+ "can not set user with registry or opaque"
end
return v unless v
@@ -415,9 +425,9 @@ module URI
# with a user component defined.
#
def check_password(v, user = @user)
- if @opaque
+ if @registry || @opaque
raise InvalidURIError,
- "can not set password with opaque"
+ "can not set password with registry or opaque"
end
return v unless v
@@ -428,7 +438,7 @@ module URI
if parser.regexp[:USERINFO] !~ v
raise InvalidComponentError,
- "bad password component"
+ "bad component(expected user component): #{v}"
end
return true
@@ -542,10 +552,10 @@ module URI
protected :set_password
# returns the userinfo +ui+ as user, password
- # if properly formatted as 'user:password'
+ # if properly formated as 'user:password'
def split_userinfo(ui)
return nil, nil unless ui
- user, password = ui.split(':', 2)
+ user, password = ui.split(/:/, 2)
return user, password
end
@@ -553,7 +563,7 @@ module URI
# escapes 'user:password' +v+ based on RFC 1738 section 3.1
def escape_userpass(v)
- parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
+ v = parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
end
private :escape_userpass
@@ -588,7 +598,7 @@ module URI
def check_host(v)
return v unless v
- if @opaque
+ if @registry || @opaque
raise InvalidURIError,
"can not set host with registry or opaque"
elsif parser.regexp[:HOST] !~ v
@@ -641,7 +651,7 @@ module URI
# extract the host part of the URI and unwrap brackets for IPv6 addresses.
#
# This method is same as URI::Generic#host except
- # brackets for IPv6 (and future IP) addresses are removed.
+ # brackets for IPv6 (andn future IP) addresses are removed.
#
# u = URI("http://[::1]/bar")
# p u.hostname #=> "::1"
@@ -662,7 +672,7 @@ module URI
# u.hostname = "::1"
# p u.to_s #=> "http://[::1]/bar"
#
- # If the argument seems IPv6 address,
+ # If the arugument seems IPv6 address,
# it is wrapped by brackets.
#
def hostname=(v)
@@ -680,12 +690,12 @@ module URI
def check_port(v)
return v unless v
- if @opaque
+ if @registry || @opaque
raise InvalidURIError,
"can not set port with registry or opaque"
elsif !v.kind_of?(Fixnum) && parser.regexp[:PORT] !~ v
raise InvalidComponentError,
- "bad component(expected port component): #{v.inspect}"
+ "bad component(expected port component): #{v}"
end
return true
@@ -697,7 +707,13 @@ module URI
# see also URI::Generic.port=
#
def set_port(v)
- v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Fixnum)
+ unless !v || v.kind_of?(Fixnum)
+ if v.empty?
+ v = nil
+ else
+ v = v.to_i
+ end
+ end
@port = v
end
protected :set_port
@@ -731,18 +747,57 @@ module URI
port
end
- def check_registry(v) # :nodoc:
- raise InvalidURIError, "can not set registry"
+ #
+ # check the registry +v+ component for RFC2396 compliance
+ # and against the URI::Parser Regexp for :REGISTRY
+ #
+ # Can not have a host, port or user component defined,
+ # with a registry component defined.
+ #
+ def check_registry(v)
+ return v unless v
+
+ # raise if both server and registry are not nil, because:
+ # authority = server | reg_name
+ # server = [ [ userinfo "@" ] hostport ]
+ if @host || @port || @user # userinfo = @user + ':' + @password
+ raise InvalidURIError,
+ "can not set registry with host, port, or userinfo"
+ elsif v && parser.regexp[:REGISTRY] !~ v
+ raise InvalidComponentError,
+ "bad component(expected registry component): #{v}"
+ end
+
+ return true
end
private :check_registry
- def set_registry(v) #:nodoc:
- raise InvalidURIError, "can not set registry"
+ # protected setter for the registry component +v+
+ #
+ # see also URI::Generic.registry=
+ #
+ def set_registry(v)
+ @registry = v
end
protected :set_registry
+ #
+ # == Args
+ #
+ # +v+::
+ # String
+ #
+ # == Description
+ #
+ # public setter for the registry component +v+.
+ # (with validation)
+ #
+ # see also URI::Generic.check_registry
+ #
def registry=(v)
- raise InvalidURIError, "can not set registry"
+ check_registry(v)
+ set_registry(v)
+ v
end
#
@@ -770,8 +825,7 @@ module URI
"bad component(expected absolute path component): #{v}"
end
else
- if v && v != '' && parser.regexp[:ABS_PATH] !~ v &&
- parser.regexp[:REL_PATH] !~ v
+ if v && v != '' && parser.regexp[:ABS_PATH] !~ v && parser.regexp[:REL_PATH] !~ v
raise InvalidComponentError,
"bad component(expected relative path component): #{v}"
end
@@ -820,6 +874,42 @@ module URI
end
#
+ # check the query +v+ component for RFC2396 compliance
+ # and against the URI::Parser Regexp for :QUERY
+ #
+ # Can not have a opaque component defined,
+ # with a query component defined.
+ #
+ def check_query(v)
+ return v unless v
+
+ # raise if both hier and opaque are not nil, because:
+ # absoluteURI = scheme ":" ( hier_part | opaque_part )
+ # hier_part = ( net_path | abs_path ) [ "?" query ]
+ if @opaque
+ raise InvalidURIError,
+ "query conflicts with opaque"
+ end
+
+ if v && v != '' && parser.regexp[:QUERY] !~ v
+ raise InvalidComponentError,
+ "bad component(expected query component): #{v}"
+ end
+
+ return true
+ end
+ private :check_query
+
+ # protected setter for the query component +v+
+ #
+ # see also URI::Generic.query=
+ #
+ def set_query(v)
+ @query = v
+ end
+ protected :set_query
+
+ #
# == Args
#
# +v+::
@@ -828,6 +918,9 @@ module URI
# == Description
#
# public setter for the query component +v+.
+ # (with validation)
+ #
+ # see also URI::Generic.check_query
#
# == Usage
#
@@ -840,17 +933,9 @@ module URI
# #=> #<URI::HTTP:0x000000008e89e8 URL:http://my.example.com/?id=1>
#
def query=(v)
- return @query = nil unless v
- raise InvalidURIError, "query conflicts with opaque" if @opaque
-
- x = v.to_str
- v = x.dup if x.equal? v
- v.encode!(Encoding::UTF_8) rescue nil
- v.delete!("\t\r\n")
- v.force_encoding(Encoding::ASCII_8BIT)
- v.gsub!(/(?!%\h\h|[!$-&(-;=?-_a-~])./n.freeze){'%%%02X' % $&.ord}
- v.force_encoding(Encoding::US_ASCII)
- @query = v
+ check_query(v)
+ set_query(v)
+ v
end
#
@@ -909,6 +994,27 @@ module URI
#
# check the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT
#
+ def check_fragment(v)
+ return v unless v
+
+ if v && v != '' && parser.regexp[:FRAGMENT] !~ v
+ raise InvalidComponentError,
+ "bad component(expected fragment component): #{v}"
+ end
+
+ return true
+ end
+ private :check_fragment
+
+ # protected setter for the fragment component +v+
+ #
+ # see also URI::Generic.fragment=
+ #
+ def set_fragment(v)
+ @fragment = v
+ end
+ protected :set_fragment
+
#
# == Args
#
@@ -920,6 +1026,8 @@ module URI
# public setter for the fragment component +v+.
# (with validation)
#
+ # see also URI::Generic.check_fragment
+ #
# == Usage
#
# require 'uri'
@@ -931,16 +1039,9 @@ module URI
# #=> #<URI::HTTP:0x000000007a81f8 URL:http://my.example.com/?id=25#time=1305212086>
#
def fragment=(v)
- return @fragment = nil unless v
-
- x = v.to_str
- v = x.dup if x.equal? v
- v.encode!(Encoding::UTF_8) rescue nil
- v.delete!("\t\r\n")
- v.force_encoding(Encoding::ASCII_8BIT)
- v.gsub!(/(?!%\h\h|[!-~])./n){'%%%02X' % $&.ord}
- v.force_encoding(Encoding::US_ASCII)
- @fragment = v
+ check_fragment(v)
+ set_fragment(v)
+ v
end
#
@@ -1110,12 +1211,12 @@ module URI
# RFC2396, Section 5.2, 2)
if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
- base.fragment=(rel.fragment) if rel.fragment
+ base.set_fragment(rel.fragment) if rel.fragment
return base
end
- base.query = nil
- base.fragment=(nil)
+ base.set_query(nil)
+ base.set_fragment(nil)
# RFC2396, Section 5.2, 4)
if !authority
@@ -1129,8 +1230,8 @@ module URI
base.set_userinfo(rel.userinfo) if rel.userinfo
base.set_host(rel.host) if rel.host
base.set_port(rel.port) if rel.port
- base.query = rel.query if rel.query
- base.fragment=(rel.fragment) if rel.fragment
+ base.set_query(rel.query) if rel.query
+ base.set_fragment(rel.fragment) if rel.fragment
return base
end # merge
@@ -1217,7 +1318,7 @@ module URI
end
rel = URI::Generic.new(nil, # it is relative URI
self.userinfo, self.host, self.port,
- nil, self.path, self.opaque,
+ self.registry, self.path, self.opaque,
self.query, self.fragment, parser)
if rel.userinfo != oth.userinfo ||
@@ -1237,11 +1338,11 @@ module URI
if rel.path && rel.path == oth.path
rel.set_path('')
- rel.query = nil if rel.query == oth.query
+ rel.set_query(nil) if rel.query == oth.query
return rel, rel
elsif rel.opaque && rel.opaque == oth.opaque
rel.set_opaque('')
- rel.query = nil if rel.query == oth.query
+ rel.set_query(nil) if rel.query == oth.query
return rel, rel
end
@@ -1326,7 +1427,7 @@ module URI
# Destructive version of #normalize
#
def normalize!
- if path&.empty?
+ if path && path == ''
set_path('/')
end
if scheme && scheme != scheme.downcase
@@ -1337,11 +1438,21 @@ module URI
end
end
+ # returns the assemble String with path and query components
+ def path_query
+ str = @path
+ if @query
+ str += '?' + @query
+ end
+ str
+ end
+ private :path_query
+
#
# Constructs String from URI
#
def to_s
- str = ''.dup
+ str = ''
if @scheme
str << @scheme
str << ':'
@@ -1349,31 +1460,35 @@ module URI
if @opaque
str << @opaque
+
else
- if @host
- str << '//'
- end
- if self.userinfo
- str << self.userinfo
- str << '@'
- end
- if @host
- str << @host
- end
- if @port && @port != self.default_port
- str << ':'
- str << @port.to_s
- end
- str << @path
- if @query
- str << '?'
- str << @query
+ if @registry
+ str << @registry
+ else
+ if @host
+ str << '//'
+ end
+ if self.userinfo
+ str << self.userinfo
+ str << '@'
+ end
+ if @host
+ str << @host
+ end
+ if @port && @port != self.default_port
+ str << ':'
+ str << @port.to_s
+ end
end
+
+ str << path_query
end
+
if @fragment
str << '#'
str << @fragment
end
+
str
end
@@ -1447,8 +1562,9 @@ module URI
end
end
+ @@to_s = Kernel.instance_method(:to_s)
def inspect
- "#<#{self.class} #{self}>"
+ @@to_s.bind(self).call.sub!(/>\z/) {" URL:#{self}>"}
end
#
diff --git a/lib/uri/http.rb b/lib/uri/http.rb
index 81ae846fd9..9877b1ee59 100644
--- a/lib/uri/http.rb
+++ b/lib/uri/http.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = uri/http.rb
#
# Author:: Akira Yamada <akira@ruby-lang.org>
@@ -63,7 +62,6 @@ module URI
return super(tmp)
end
-=begin
#
# == Description
#
@@ -76,8 +74,8 @@ module URI
#
# Example:
#
- # uri = URI::HTTP.new("http", nil, "www.example.com", nil, nil,
- # "/path", nil, "query", "fragment")
+ # uri = URI::HTTP.new('http', nil, "www.example.com", nil, "/path",
+ # "query", 'fragment')
#
#
# See also URI::Generic.new
@@ -85,7 +83,6 @@ module URI
def initialize(*arg)
super(*arg)
end
-=end
#
# == Description
@@ -96,12 +93,12 @@ module URI
# Otherwise, the path is simply URI#path.
#
def request_uri
- return nil unless @path
- if @path.start_with?(?/.freeze)
- @query ? "#@path?#@query" : @path.dup
- else
- @query ? "/#@path?#@query" : "/#@path"
+ r = path_query
+ if r && r[0] != ?/
+ r = '/' + r
end
+
+ r
end
end
diff --git a/lib/uri/https.rb b/lib/uri/https.rb
index 3c8c905cc3..7d242e7e79 100644
--- a/lib/uri/https.rb
+++ b/lib/uri/https.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = uri/https.rb
#
# Author:: Akira Yamada <akira@ruby-lang.org>
diff --git a/lib/uri/ldap.rb b/lib/uri/ldap.rb
index 4345875e28..56d748e59e 100644
--- a/lib/uri/ldap.rb
+++ b/lib/uri/ldap.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = uri/ldap.rb
#
# Author::
diff --git a/lib/uri/ldaps.rb b/lib/uri/ldaps.rb
index d03f8efa2d..42bbfe86ba 100644
--- a/lib/uri/ldaps.rb
+++ b/lib/uri/ldaps.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = uri/ldap.rb
#
# License:: You can redistribute it and/or modify it under the same term as Ruby.
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb
index 1494c3952b..079340cf58 100644
--- a/lib/uri/mailto.rb
+++ b/lib/uri/mailto.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# = uri/mailto.rb
#
# Author:: Akira Yamada <akira@ruby-lang.org>
@@ -13,7 +12,7 @@ require 'uri/generic'
module URI
#
- # RFC6068, The mailto URL scheme
+ # RFC2368, The mailto URL scheme
#
class MailTo < Generic
include REGEXP
@@ -38,22 +37,28 @@ module URI
#
# Within mailto URLs, the characters "?", "=", "&" are reserved.
- # ; RFC 6068
- # hfields = "?" hfield *( "&" hfield )
- # hfield = hfname "=" hfvalue
- # hfname = *qchar
- # hfvalue = *qchar
- # qchar = unreserved / pct-encoded / some-delims
- # some-delims = "!" / "$" / "'" / "(" / ")" / "*"
- # / "+" / "," / ";" / ":" / "@"
- #
- # ; RFC3986
- # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- # pct-encoded = "%" HEXDIG HEXDIG
- HEADER_REGEXP = /\A(?<hfield>(?:%\h\h|[!$'-.0-;@-Z_a-z~])*=(?:%\h\h|[!$'-.0-;@-Z_a-z~])*)(?:&\g<hfield>)*\z/
- # practical regexp for email address
- # http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
- EMAIL_REGEXP = /\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/
+ # hname = *urlc
+ # hvalue = *urlc
+ # header = hname "=" hvalue
+ HEADER_PATTERN = "(?:[^?=&]*=[^?=&]*)".freeze
+ HEADER_REGEXP = Regexp.new(HEADER_PATTERN).freeze
+ # headers = "?" header *( "&" header )
+ # to = #mailbox
+ # mailtoURL = "mailto:" [ to ] [ headers ]
+ MAILBOX_PATTERN = "(?:#{PATTERN::ESCAPED}|[^(),%?=&])".freeze
+ MAILTO_REGEXP = Regexp.new(" # :nodoc:
+ \\A
+ (#{MAILBOX_PATTERN}*?) (?# 1: to)
+ (?:
+ \\?
+ (#{HEADER_PATTERN}(?:\\&#{HEADER_PATTERN})*) (?# 2: headers)
+ )?
+ (?:
+ \\#
+ (#{PATTERN::FRAGMENT}) (?# 3: fragment)
+ )?
+ \\z
+ ", Regexp::EXTENDED).freeze
# :startdoc:
#
@@ -84,41 +89,37 @@ module URI
# puts m3.to_s -> mailto:listman@example.com?subject=subscribe
#
def self.build(args)
- tmp = Util.make_components_hash(self, args)
+ tmp = Util::make_components_hash(self, args)
- case tmp[:to]
- when Array
- tmp[:opaque] = tmp[:to].join(',')
- when String
- tmp[:opaque] = tmp[:to].dup
+ if tmp[:to]
+ tmp[:opaque] = tmp[:to]
else
tmp[:opaque] = ''
end
if tmp[:headers]
- query =
- case tmp[:headers]
- when Array
- tmp[:headers].collect { |x|
- if x.kind_of?(Array)
- x[0] + '=' + x[1..-1].join
- else
- x.to_s
- end
- }.join('&')
- when Hash
- tmp[:headers].collect { |h,v|
- h + '=' + v
- }.join('&')
- else
- tmp[:headers].to_s
- end
- unless query.empty?
- tmp[:opaque] << '?' << query
+ tmp[:opaque] << '?'
+
+ if tmp[:headers].kind_of?(Array)
+ tmp[:opaque] << tmp[:headers].collect { |x|
+ if x.kind_of?(Array)
+ x[0] + '=' + x[1..-1].join
+ else
+ x.to_s
+ end
+ }.join('&')
+
+ elsif tmp[:headers].kind_of?(Hash)
+ tmp[:opaque] << tmp[:headers].collect { |h,v|
+ h + '=' + v
+ }.join('&')
+
+ else
+ tmp[:opaque] << tmp[:headers].to_s
end
end
- super(tmp)
+ return super(tmp)
end
#
@@ -136,28 +137,19 @@ module URI
@to = nil
@headers = []
- # The RFC3986 parser does not normally populate opaque
- @opaque = "?#{@query}" if @query && !@opaque
+ if MAILTO_REGEXP =~ @opaque
+ if arg[-1]
+ self.to = $1
+ self.headers = $2
+ else
+ set_to($1)
+ set_headers($2)
+ end
- unless @opaque
- raise InvalidComponentError,
- "missing opaque part for mailto URL"
- end
- to, header = @opaque.split('?', 2)
- # allow semicolon as a addr-spec separator
- # http://support.microsoft.com/kb/820868
- unless /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ =~ to
+ else
raise InvalidComponentError,
"unrecognised opaque part for mailtoURL: #{@opaque}"
end
-
- if arg[10] # arg_check
- self.to = to
- self.headers = header
- else
- set_to(to)
- set_headers(header)
- end
end
# The primary e-mail address of the URL, as a String
@@ -166,28 +158,19 @@ module URI
# E-mail headers set by the URL, as an Array of Arrays
attr_reader :headers
- # check the to +v+ component
+ # check the to +v+ component against either
+ # * URI::Parser Regexp for :OPAQUE
+ # * MAILBOX_PATTERN
def check_to(v)
return true unless v
return true if v.size == 0
- v.split(/[,;]/).each do |addr|
- # check url safety as path-rootless
- if /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*\z/ !~ addr
- raise InvalidComponentError,
- "an address in 'to' is invalid as URI #{addr.dump}"
- end
-
- # check addr-spec
- # don't s/\+/ /g
- addr.gsub!(/%\h\h/, URI::TBLDECWWWCOMP_)
- if EMAIL_REGEXP !~ addr
- raise InvalidComponentError,
- "an address in 'to' is invalid as uri-escaped addr-spec #{addr.dump}"
- end
+ if parser.regexp[:OPAQUE] !~ v || /\A#{MAILBOX_PATTERN}*\z/o !~ v
+ raise InvalidComponentError,
+ "bad component(expected opaque component): #{v}"
end
- true
+ return true
end
private :check_to
@@ -205,16 +188,19 @@ module URI
end
# check the headers +v+ component against either
- # * HEADER_REGEXP
+ # * URI::Parser Regexp for :OPAQUE
+ # * HEADER_PATTERN
def check_headers(v)
return true unless v
return true if v.size == 0
- if HEADER_REGEXP !~ v
+
+ if parser.regexp[:OPAQUE] !~ v ||
+ /\A(#{HEADER_PATTERN}(?:\&#{HEADER_PATTERN})*)\z/o !~ v
raise InvalidComponentError,
"bad component(expected opaque component): #{v}"
end
- true
+ return true
end
private :check_headers
@@ -222,8 +208,8 @@ module URI
def set_headers(v)
@headers = []
if v
- v.split('&').each do |x|
- @headers << x.split(/=/, 2)
+ v.scan(HEADER_REGEXP) do |x|
+ @headers << x.split(/=/o, 2)
end
end
end
@@ -267,22 +253,22 @@ module URI
# # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
#
def to_mailtext
- to = URI.decode_www_form_component(@to)
+ to = parser.unescape(@to)
head = ''
body = ''
@headers.each do |x|
case x[0]
when 'body'
- body = URI.decode_www_form_component(x[1])
+ body = parser.unescape(x[1])
when 'to'
- to << ', ' + URI.decode_www_form_component(x[1])
+ to << ', ' + parser.unescape(x[1])
else
- head << URI.decode_www_form_component(x[0]).capitalize + ': ' +
- URI.decode_www_form_component(x[1]) + "\n"
+ head << parser.unescape(x[0]).capitalize + ': ' +
+ parser.unescape(x[1]) + "\n"
end
end
- "To: #{to}
+ return "To: #{to}
#{head}
#{body}
"
diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb
deleted file mode 100644
index b9e7b2b26e..0000000000
--- a/lib/uri/rfc2396_parser.rb
+++ /dev/null
@@ -1,544 +0,0 @@
-# frozen_string_literal: false
-#--
-# = uri/common.rb
-#
-# Author:: Akira Yamada <akira@ruby-lang.org>
-# Revision:: $Id$
-# License::
-# You can redistribute it and/or modify it under the same term as Ruby.
-#
-# See URI for general documentation
-#
-
-module URI
- #
- # Includes URI::REGEXP::PATTERN
- #
- module RFC2396_REGEXP
- #
- # Patterns used to parse URI's
- #
- module PATTERN
- # :stopdoc:
-
- # RFC 2396 (URI Generic Syntax)
- # RFC 2732 (IPv6 Literal Addresses in URL's)
- # RFC 2373 (IPv6 Addressing Architecture)
-
- # alpha = lowalpha | upalpha
- ALPHA = "a-zA-Z"
- # alphanum = alpha | digit
- ALNUM = "#{ALPHA}\\d"
-
- # hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
- # "a" | "b" | "c" | "d" | "e" | "f"
- HEX = "a-fA-F\\d"
- # escaped = "%" hex hex
- ESCAPED = "%[#{HEX}]{2}"
- # mark = "-" | "_" | "." | "!" | "~" | "*" | "'" |
- # "(" | ")"
- # unreserved = alphanum | mark
- UNRESERVED = "\\-_.!~*'()#{ALNUM}"
- # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
- # "$" | ","
- # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
- # "$" | "," | "[" | "]" (RFC 2732)
- RESERVED = ";/?:@&=+$,\\[\\]"
-
- # domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
- DOMLABEL = "(?:[#{ALNUM}](?:[-#{ALNUM}]*[#{ALNUM}])?)"
- # toplabel = alpha | alpha *( alphanum | "-" ) alphanum
- TOPLABEL = "(?:[#{ALPHA}](?:[-#{ALNUM}]*[#{ALNUM}])?)"
- # hostname = *( domainlabel "." ) toplabel [ "." ]
- HOSTNAME = "(?:#{DOMLABEL}\\.)*#{TOPLABEL}\\.?"
-
- # :startdoc:
- end # PATTERN
-
- # :startdoc:
- end # REGEXP
-
- # class that Parses String's into URI's
- #
- # It contains a Hash set of patterns and Regexp's that match and validate.
- #
- class RFC2396_Parser
- include RFC2396_REGEXP
-
- #
- # == Synopsis
- #
- # URI::Parser.new([opts])
- #
- # == Args
- #
- # The constructor accepts a hash as options for parser.
- # Keys of options are pattern names of URI components
- # and values of options are pattern strings.
- # The constructor generates set of regexps for parsing URIs.
- #
- # You can use the following keys:
- #
- # * :ESCAPED (URI::PATTERN::ESCAPED in default)
- # * :UNRESERVED (URI::PATTERN::UNRESERVED in default)
- # * :DOMLABEL (URI::PATTERN::DOMLABEL in default)
- # * :TOPLABEL (URI::PATTERN::TOPLABEL in default)
- # * :HOSTNAME (URI::PATTERN::HOSTNAME in default)
- #
- # == Examples
- #
- # p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
- # u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP:0xb78cf4f8 URL:http://example.jp/%uABCD>
- # URI.parse(u.to_s) #=> raises URI::InvalidURIError
- #
- # s = "http://example.com/ABCD"
- # u1 = p.parse(s) #=> #<URI::HTTP:0xb78c3220 URL:http://example.com/ABCD>
- # u2 = URI.parse(s) #=> #<URI::HTTP:0xb78b6d54 URL:http://example.com/ABCD>
- # u1 == u2 #=> true
- # u1.eql?(u2) #=> false
- #
- def initialize(opts = {})
- @pattern = initialize_pattern(opts)
- @pattern.each_value(&:freeze)
- @pattern.freeze
-
- @regexp = initialize_regexp(@pattern)
- @regexp.each_value(&:freeze)
- @regexp.freeze
- end
-
- # The Hash of patterns.
- #
- # see also URI::Parser.initialize_pattern
- attr_reader :pattern
-
- # The Hash of Regexp
- #
- # see also URI::Parser.initialize_regexp
- attr_reader :regexp
-
- # Returns a split URI against regexp[:ABS_URI]
- def split(uri)
- case uri
- when ''
- # null uri
-
- when @regexp[:ABS_URI]
- scheme, opaque, userinfo, host, port,
- registry, path, query, fragment = $~[1..-1]
-
- # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
-
- # absoluteURI = scheme ":" ( hier_part | opaque_part )
- # hier_part = ( net_path | abs_path ) [ "?" query ]
- # opaque_part = uric_no_slash *uric
-
- # abs_path = "/" path_segments
- # net_path = "//" authority [ abs_path ]
-
- # authority = server | reg_name
- # server = [ [ userinfo "@" ] hostport ]
-
- if !scheme
- raise InvalidURIError,
- "bad URI(absolute but no scheme): #{uri}"
- end
- if !opaque && (!path && (!host && !registry))
- raise InvalidURIError,
- "bad URI(absolute but no path): #{uri}"
- end
-
- when @regexp[:REL_URI]
- scheme = nil
- opaque = nil
-
- userinfo, host, port, registry,
- rel_segment, abs_path, query, fragment = $~[1..-1]
- if rel_segment && abs_path
- path = rel_segment + abs_path
- elsif rel_segment
- path = rel_segment
- elsif abs_path
- path = abs_path
- end
-
- # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
-
- # relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
-
- # net_path = "//" authority [ abs_path ]
- # abs_path = "/" path_segments
- # rel_path = rel_segment [ abs_path ]
-
- # authority = server | reg_name
- # server = [ [ userinfo "@" ] hostport ]
-
- else
- raise InvalidURIError, "bad URI(is not URI?): #{uri}"
- end
-
- path = '' if !path && !opaque # (see RFC2396 Section 5.2)
- ret = [
- scheme,
- userinfo, host, port, # X
- registry, # X
- path, # Y
- opaque, # Y
- query,
- fragment
- ]
- return ret
- end
-
- #
- # == Args
- #
- # +uri+::
- # String
- #
- # == Description
- #
- # parses +uri+ and constructs either matching URI scheme object
- # (FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic
- #
- # == Usage
- #
- # p = URI::Parser.new
- # p.parse("ldap://ldap.example.com/dc=example?user=john")
- # #=> #<URI::LDAP:0x00000000b9e7e8 URL:ldap://ldap.example.com/dc=example?user=john>
- #
- def parse(uri)
- scheme, userinfo, host, port,
- registry, path, opaque, query, fragment = self.split(uri)
-
- if scheme && URI.scheme_list.include?(scheme.upcase)
- URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
- registry, path, opaque, query,
- fragment, self)
- else
- Generic.new(scheme, userinfo, host, port,
- registry, path, opaque, query,
- fragment, self)
- end
- end
-
-
- #
- # == Args
- #
- # +uris+::
- # an Array of Strings
- #
- # == Description
- #
- # Attempts to parse and merge a set of URIs
- #
- def join(*uris)
- uris[0] = convert_to_uri(uris[0])
- uris.inject :merge
- end
-
- #
- # :call-seq:
- # extract( str )
- # extract( str, schemes )
- # extract( str, schemes ) {|item| block }
- #
- # == Args
- #
- # +str+::
- # String to search
- # +schemes+::
- # Patterns to apply to +str+
- #
- # == Description
- #
- # Attempts to parse and merge a set of URIs
- # If no +block+ given , then returns the result,
- # else it calls +block+ for each element in result.
- #
- # see also URI::Parser.make_regexp
- #
- def extract(str, schemes = nil)
- if block_given?
- str.scan(make_regexp(schemes)) { yield $& }
- nil
- else
- result = []
- str.scan(make_regexp(schemes)) { result.push $& }
- result
- end
- end
-
- # returns Regexp that is default self.regexp[:ABS_URI_REF],
- # unless +schemes+ is provided. Then it is a Regexp.union with self.pattern[:X_ABS_URI]
- def make_regexp(schemes = nil)
- unless schemes
- @regexp[:ABS_URI_REF]
- else
- /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x
- end
- end
-
- #
- # :call-seq:
- # escape( str )
- # escape( str, unsafe )
- #
- # == Args
- #
- # +str+::
- # String to make safe
- # +unsafe+::
- # Regexp to apply. Defaults to self.regexp[:UNSAFE]
- #
- # == Description
- #
- # constructs a safe String from +str+, removing unsafe characters,
- # replacing them with codes.
- #
- def escape(str, unsafe = @regexp[:UNSAFE])
- unless unsafe.kind_of?(Regexp)
- # perhaps unsafe is String object
- unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false)
- end
- str.gsub(unsafe) do
- us = $&
- tmp = ''
- us.each_byte do |uc|
- tmp << sprintf('%%%02X', uc)
- end
- tmp
- end.force_encoding(Encoding::US_ASCII)
- end
-
- #
- # :call-seq:
- # unescape( str )
- # unescape( str, unsafe )
- #
- # == Args
- #
- # +str+::
- # String to remove escapes from
- # +unsafe+::
- # Regexp to apply. Defaults to self.regexp[:ESCAPED]
- #
- # == Description
- #
- # Removes escapes from +str+
- #
- def unescape(str, escaped = @regexp[:ESCAPED])
- str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding)
- end
-
- @@to_s = Kernel.instance_method(:to_s)
- def inspect
- @@to_s.bind(self).call
- end
-
- private
-
- # Constructs the default Hash of patterns
- def initialize_pattern(opts = {})
- ret = {}
- ret[:ESCAPED] = escaped = (opts.delete(:ESCAPED) || PATTERN::ESCAPED)
- ret[:UNRESERVED] = unreserved = opts.delete(:UNRESERVED) || PATTERN::UNRESERVED
- ret[:RESERVED] = reserved = opts.delete(:RESERVED) || PATTERN::RESERVED
- ret[:DOMLABEL] = opts.delete(:DOMLABEL) || PATTERN::DOMLABEL
- ret[:TOPLABEL] = opts.delete(:TOPLABEL) || PATTERN::TOPLABEL
- ret[:HOSTNAME] = hostname = opts.delete(:HOSTNAME)
-
- # RFC 2396 (URI Generic Syntax)
- # RFC 2732 (IPv6 Literal Addresses in URL's)
- # RFC 2373 (IPv6 Addressing Architecture)
-
- # uric = reserved | unreserved | escaped
- ret[:URIC] = uric = "(?:[#{unreserved}#{reserved}]|#{escaped})"
- # uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
- # "&" | "=" | "+" | "$" | ","
- ret[:URIC_NO_SLASH] = uric_no_slash = "(?:[#{unreserved};?:@&=+$,]|#{escaped})"
- # query = *uric
- ret[:QUERY] = query = "#{uric}*"
- # fragment = *uric
- ret[:FRAGMENT] = fragment = "#{uric}*"
-
- # hostname = *( domainlabel "." ) toplabel [ "." ]
- # reg-name = *( unreserved / pct-encoded / sub-delims ) # RFC3986
- unless hostname
- ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-.]|%\\h\\h)+"
- end
-
- # RFC 2373, APPENDIX B:
- # IPv6address = hexpart [ ":" IPv4address ]
- # IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
- # hexpart = hexseq | hexseq "::" [ hexseq ] | "::" [ hexseq ]
- # hexseq = hex4 *( ":" hex4)
- # hex4 = 1*4HEXDIG
- #
- # XXX: This definition has a flaw. "::" + IPv4address must be
- # allowed too. Here is a replacement.
- #
- # IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
- ret[:IPV4ADDR] = ipv4addr = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
- # hex4 = 1*4HEXDIG
- hex4 = "[#{PATTERN::HEX}]{1,4}"
- # lastpart = hex4 | IPv4address
- lastpart = "(?:#{hex4}|#{ipv4addr})"
- # hexseq1 = *( hex4 ":" ) hex4
- hexseq1 = "(?:#{hex4}:)*#{hex4}"
- # hexseq2 = *( hex4 ":" ) lastpart
- hexseq2 = "(?:#{hex4}:)*#{lastpart}"
- # IPv6address = hexseq2 | [ hexseq1 ] "::" [ hexseq2 ]
- ret[:IPV6ADDR] = ipv6addr = "(?:#{hexseq2}|(?:#{hexseq1})?::(?:#{hexseq2})?)"
-
- # IPv6prefix = ( hexseq1 | [ hexseq1 ] "::" [ hexseq1 ] ) "/" 1*2DIGIT
- # unused
-
- # ipv6reference = "[" IPv6address "]" (RFC 2732)
- ret[:IPV6REF] = ipv6ref = "\\[#{ipv6addr}\\]"
-
- # host = hostname | IPv4address
- # host = hostname | IPv4address | IPv6reference (RFC 2732)
- ret[:HOST] = host = "(?:#{hostname}|#{ipv4addr}|#{ipv6ref})"
- # port = *digit
- ret[:PORT] = port = '\d*'
- # hostport = host [ ":" port ]
- ret[:HOSTPORT] = hostport = "#{host}(?::#{port})?"
-
- # userinfo = *( unreserved | escaped |
- # ";" | ":" | "&" | "=" | "+" | "$" | "," )
- ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,]|#{escaped})*"
-
- # pchar = unreserved | escaped |
- # ":" | "@" | "&" | "=" | "+" | "$" | ","
- pchar = "(?:[#{unreserved}:@&=+$,]|#{escaped})"
- # param = *pchar
- param = "#{pchar}*"
- # segment = *pchar *( ";" param )
- segment = "#{pchar}*(?:;#{param})*"
- # path_segments = segment *( "/" segment )
- ret[:PATH_SEGMENTS] = path_segments = "#{segment}(?:/#{segment})*"
-
- # server = [ [ userinfo "@" ] hostport ]
- server = "(?:#{userinfo}@)?#{hostport}"
- # reg_name = 1*( unreserved | escaped | "$" | "," |
- # ";" | ":" | "@" | "&" | "=" | "+" )
- ret[:REG_NAME] = reg_name = "(?:[#{unreserved}$,;:@&=+]|#{escaped})+"
- # authority = server | reg_name
- authority = "(?:#{server}|#{reg_name})"
-
- # rel_segment = 1*( unreserved | escaped |
- # ";" | "@" | "&" | "=" | "+" | "$" | "," )
- ret[:REL_SEGMENT] = rel_segment = "(?:[#{unreserved};@&=+$,]|#{escaped})+"
-
- # scheme = alpha *( alpha | digit | "+" | "-" | "." )
- ret[:SCHEME] = scheme = "[#{PATTERN::ALPHA}][\\-+.#{PATTERN::ALPHA}\\d]*"
-
- # abs_path = "/" path_segments
- ret[:ABS_PATH] = abs_path = "/#{path_segments}"
- # rel_path = rel_segment [ abs_path ]
- ret[:REL_PATH] = rel_path = "#{rel_segment}(?:#{abs_path})?"
- # net_path = "//" authority [ abs_path ]
- ret[:NET_PATH] = net_path = "//#{authority}(?:#{abs_path})?"
-
- # hier_part = ( net_path | abs_path ) [ "?" query ]
- ret[:HIER_PART] = hier_part = "(?:#{net_path}|#{abs_path})(?:\\?(?:#{query}))?"
- # opaque_part = uric_no_slash *uric
- ret[:OPAQUE_PART] = opaque_part = "#{uric_no_slash}#{uric}*"
-
- # absoluteURI = scheme ":" ( hier_part | opaque_part )
- ret[:ABS_URI] = abs_uri = "#{scheme}:(?:#{hier_part}|#{opaque_part})"
- # relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
- ret[:REL_URI] = rel_uri = "(?:#{net_path}|#{abs_path}|#{rel_path})(?:\\?#{query})?"
-
- # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
- ret[:URI_REF] = "(?:#{abs_uri}|#{rel_uri})?(?:##{fragment})?"
-
- ret[:X_ABS_URI] = "
- (#{scheme}): (?# 1: scheme)
- (?:
- (#{opaque_part}) (?# 2: opaque)
- |
- (?:(?:
- //(?:
- (?:(?:(#{userinfo})@)? (?# 3: userinfo)
- (?:(#{host})(?::(\\d*))?))? (?# 4: host, 5: port)
- |
- (#{reg_name}) (?# 6: registry)
- )
- |
- (?!//)) (?# XXX: '//' is the mark for hostport)
- (#{abs_path})? (?# 7: path)
- )(?:\\?(#{query}))? (?# 8: query)
- )
- (?:\\#(#{fragment}))? (?# 9: fragment)
- "
-
- ret[:X_REL_URI] = "
- (?:
- (?:
- //
- (?:
- (?:(#{userinfo})@)? (?# 1: userinfo)
- (#{host})?(?::(\\d*))? (?# 2: host, 3: port)
- |
- (#{reg_name}) (?# 4: registry)
- )
- )
- |
- (#{rel_segment}) (?# 5: rel_segment)
- )?
- (#{abs_path})? (?# 6: abs_path)
- (?:\\?(#{query}))? (?# 7: query)
- (?:\\#(#{fragment}))? (?# 8: fragment)
- "
-
- ret
- end
-
- # Constructs the default Hash of Regexp's
- def initialize_regexp(pattern)
- ret = {}
-
- # for URI::split
- ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
- ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
-
- # for URI::extract
- ret[:URI_REF] = Regexp.new(pattern[:URI_REF])
- ret[:ABS_URI_REF] = Regexp.new(pattern[:X_ABS_URI], Regexp::EXTENDED)
- ret[:REL_URI_REF] = Regexp.new(pattern[:X_REL_URI], Regexp::EXTENDED)
-
- # for URI::escape/unescape
- ret[:ESCAPED] = Regexp.new(pattern[:ESCAPED])
- ret[:UNSAFE] = Regexp.new("[^#{pattern[:UNRESERVED]}#{pattern[:RESERVED]}]")
-
- # for Generic#initialize
- ret[:SCHEME] = Regexp.new("\\A#{pattern[:SCHEME]}\\z")
- ret[:USERINFO] = Regexp.new("\\A#{pattern[:USERINFO]}\\z")
- ret[:HOST] = Regexp.new("\\A#{pattern[:HOST]}\\z")
- ret[:PORT] = Regexp.new("\\A#{pattern[:PORT]}\\z")
- ret[:OPAQUE] = Regexp.new("\\A#{pattern[:OPAQUE_PART]}\\z")
- ret[:REGISTRY] = Regexp.new("\\A#{pattern[:REG_NAME]}\\z")
- ret[:ABS_PATH] = Regexp.new("\\A#{pattern[:ABS_PATH]}\\z")
- ret[:REL_PATH] = Regexp.new("\\A#{pattern[:REL_PATH]}\\z")
- ret[:QUERY] = Regexp.new("\\A#{pattern[:QUERY]}\\z")
- ret[:FRAGMENT] = Regexp.new("\\A#{pattern[:FRAGMENT]}\\z")
-
- ret
- end
-
- def convert_to_uri(uri)
- if uri.is_a?(URI::Generic)
- uri
- elsif uri = String.try_convert(uri)
- parse(uri)
- else
- raise ArgumentError,
- "bad argument (expected URI object or URI string)"
- end
- end
-
- end # class Parser
-end # module URI
diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb
deleted file mode 100644
index 871280044a..0000000000
--- a/lib/uri/rfc3986_parser.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-# frozen_string_literal: false
-module URI
- class RFC3986_Parser # :nodoc:
- # URI defined in RFC3986
- # this regexp is modified not to host is not empty string
- RFC3986_URI = /\A(?<URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
- RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
- attr_reader :regexp
-
- def initialize
- @regexp = default_regexp.each_value(&:freeze).freeze
- end
-
- def split(uri) #:nodoc:
- begin
- uri = uri.to_str
- rescue NoMethodError
- raise InvalidURIError, "bad URI(is not URI?): #{uri}"
- end
- uri.ascii_only? or
- raise InvalidURIError, "URI must be ascii only #{uri.dump}"
- if m = RFC3986_URI.match(uri)
- query = m["query".freeze]
- scheme = m["scheme".freeze]
- opaque = m["path-rootless".freeze]
- if opaque
- opaque << "?#{query}" if query
- [ scheme,
- nil, # userinfo
- nil, # host
- nil, # port
- nil, # registry
- nil, # path
- opaque,
- nil, # query
- m["fragment".freeze]
- ]
- else # normal
- [ scheme,
- m["userinfo".freeze],
- m["host".freeze],
- m["port".freeze],
- nil, # registry
- (m["path-abempty".freeze] ||
- m["path-absolute".freeze] ||
- m["path-empty".freeze]),
- nil, # opaque
- query,
- m["fragment".freeze]
- ]
- end
- elsif m = RFC3986_relative_ref.match(uri)
- [ nil, # scheme
- m["userinfo".freeze],
- m["host".freeze],
- m["port".freeze],
- nil, # registry,
- (m["path-abempty".freeze] ||
- m["path-absolute".freeze] ||
- m["path-noscheme".freeze] ||
- m["path-empty".freeze]),
- nil, # opaque
- m["query".freeze],
- m["fragment".freeze]
- ]
- else
- raise InvalidURIError, "bad URI(is not URI?): #{uri}"
- end
- end
-
- def parse(uri) # :nodoc:
- scheme, userinfo, host, port,
- registry, path, opaque, query, fragment = self.split(uri)
- scheme_list = URI.scheme_list
- if scheme && scheme_list.include?(uc = scheme.upcase)
- scheme_list[uc].new(scheme, userinfo, host, port,
- registry, path, opaque, query,
- fragment, self)
- else
- Generic.new(scheme, userinfo, host, port,
- registry, path, opaque, query,
- fragment, self)
- end
- end
-
-
- def join(*uris) # :nodoc:
- uris[0] = convert_to_uri(uris[0])
- uris.inject :merge
- end
-
- @@to_s = Kernel.instance_method(:to_s)
- def inspect
- @@to_s.bind(self).call
- end
-
- private
-
- def default_regexp # :nodoc:
- {
- SCHEME: /\A[A-Za-z][A-Za-z0-9+\-.]*\z/,
- USERINFO: /\A(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*\z/,
- HOST: /\A(?:(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{,4}::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*))\z/,
- ABS_PATH: /\A\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
- REL_PATH: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
- QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
- FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
- OPAQUE: /\A(?:[^\/].*)?\z/,
- PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
- }
- end
-
- def convert_to_uri(uri)
- if uri.is_a?(URI::Generic)
- uri
- elsif uri = String.try_convert(uri)
- parse(uri)
- else
- raise ArgumentError,
- "bad argument (expected URI object or URI string)"
- end
- end
-
- end # class Parser
-end # module URI
diff --git a/lib/weakref.rb b/lib/weakref.rb
index cdfbe4a679..9a256e9c25 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require "delegate"
# Weak Reference class that allows a referenced object to be
@@ -105,3 +104,14 @@ class WeakRef < Delegator
@@__map.key?(self) or defined?(@delegate_sd_obj)
end
end
+
+if __FILE__ == $0
+# require 'thread'
+ foo = Object.new
+ p foo.to_s # original's class
+ foo = WeakRef.new(foo)
+ p foo.to_s # should be same class
+ ObjectSpace.garbage_collect
+ ObjectSpace.garbage_collect
+ p foo.to_s # should raise exception (recycled)
+end
diff --git a/lib/webrick.rb b/lib/webrick.rb
index cbaf18a792..fd8522a6c5 100644
--- a/lib/webrick.rb
+++ b/lib/webrick.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# = WEB server toolkit.
#
@@ -9,7 +8,7 @@
#
# A WEBrick server can be composed of multiple WEBrick servers or servlets to
# provide differing behavior on a per-host or per-path basis. WEBrick
-# includes servlets for handling CGI scripts, ERB pages, Ruby blocks and
+# includes servlets for handling CGI scripts, ERb pages, Ruby blocks and
# directory listings.
#
# WEBrick also includes tools for daemonizing a process and starting a process
diff --git a/lib/webrick/accesslog.rb b/lib/webrick/accesslog.rb
index 17e5b38ac9..0a3c380406 100644
--- a/lib/webrick/accesslog.rb
+++ b/lib/webrick/accesslog.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# accesslog.rb -- Access log handling utilities
#
@@ -86,7 +85,7 @@ module WEBrick
# %q:: Request query string
# %r:: First line of the request
# %s:: Request status
- # %t:: Time the request was received
+ # %t:: Time the request was recieved
# %T:: Time taken to process the request
# %u:: Remote user from auth
# %U:: Unparsed URI
diff --git a/lib/webrick/cgi.rb b/lib/webrick/cgi.rb
index 94f385f1dd..80f636edc3 100644
--- a/lib/webrick/cgi.rb
+++ b/lib/webrick/cgi.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cgi.rb -- Yet another CGI library
#
diff --git a/lib/webrick/compat.rb b/lib/webrick/compat.rb
index c497a1933c..33521f0a76 100644
--- a/lib/webrick/compat.rb
+++ b/lib/webrick/compat.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# compat.rb -- cross platform compatibility
#
@@ -10,7 +9,7 @@
# $IPR: compat.rb,v 1.6 2002/10/01 17:16:32 gotoyuzo Exp $
##
-# System call error module used by webrick for cross platform compatibility.
+# System call error module used by webrick for cross platform compatability.
#
# EPROTO:: protocol error
# ECONNRESET:: remote host reset the connection request
diff --git a/lib/webrick/config.rb b/lib/webrick/config.rb
index 5f7b0a7fa4..c347da4be6 100644
--- a/lib/webrick/config.rb
+++ b/lib/webrick/config.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# config.rb -- Default configurations.
#
diff --git a/lib/webrick/cookie.rb b/lib/webrick/cookie.rb
index 16f8d21827..d8df23133d 100644
--- a/lib/webrick/cookie.rb
+++ b/lib/webrick/cookie.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cookie.rb -- Cookie class
#
diff --git a/lib/webrick/htmlutils.rb b/lib/webrick/htmlutils.rb
index ed9f4ac0d3..4cb3d0d7f6 100644
--- a/lib/webrick/htmlutils.rb
+++ b/lib/webrick/htmlutils.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# htmlutils.rb -- HTMLUtils Module
#
diff --git a/lib/webrick/httpauth.rb b/lib/webrick/httpauth.rb
index bbb6776528..96d479b2d7 100644
--- a/lib/webrick/httpauth.rb
+++ b/lib/webrick/httpauth.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpauth.rb -- HTTP access authentication
#
diff --git a/lib/webrick/httpauth/authenticator.rb b/lib/webrick/httpauth/authenticator.rb
index 8655118a04..f6d4ab844f 100644
--- a/lib/webrick/httpauth/authenticator.rb
+++ b/lib/webrick/httpauth/authenticator.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# httpauth/authenticator.rb -- Authenticator mix-in module.
#
diff --git a/lib/webrick/httpauth/basicauth.rb b/lib/webrick/httpauth/basicauth.rb
index e23420fdfa..3ff20b56d2 100644
--- a/lib/webrick/httpauth/basicauth.rb
+++ b/lib/webrick/httpauth/basicauth.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpauth/basicauth.rb -- HTTP basic access authentication
#
@@ -90,7 +89,8 @@ module WEBrick
end
##
- # Returns a challenge response which asks for authentication information
+ # Returns a challenge response which asks for for authentication
+ # information
def challenge(req, res)
res[@response_field] = "#{@auth_scheme} realm=\"#{@realm}\""
diff --git a/lib/webrick/httpauth/digestauth.rb b/lib/webrick/httpauth/digestauth.rb
index 018989e6dd..78ad45b233 100644
--- a/lib/webrick/httpauth/digestauth.rb
+++ b/lib/webrick/httpauth/digestauth.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpauth/digestauth.rb -- HTTP digest access authentication
#
@@ -129,7 +128,8 @@ module WEBrick
end
##
- # Returns a challenge response which asks for authentication information
+ # Returns a challenge response which asks for for authentication
+ # information
def challenge(req, res, stale=false)
nonce = generate_next_nonce(req)
@@ -204,7 +204,7 @@ module WEBrick
password = @userdb.get_passwd(@realm, auth_req['username'], @reload_db)
unless password
- error('%s: the user is not allowed.', auth_req['username'])
+ error('%s: the user is not allowd.', auth_req['username'])
return false
end
diff --git a/lib/webrick/httpauth/htdigest.rb b/lib/webrick/httpauth/htdigest.rb
index 4bb25e1724..5fb0635e2a 100644
--- a/lib/webrick/httpauth/htdigest.rb
+++ b/lib/webrick/httpauth/htdigest.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpauth/htdigest.rb -- Apache compatible htdigest file
#
diff --git a/lib/webrick/httpauth/htgroup.rb b/lib/webrick/httpauth/htgroup.rb
index 832ae8bd04..0ecabef820 100644
--- a/lib/webrick/httpauth/htgroup.rb
+++ b/lib/webrick/httpauth/htgroup.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpauth/htgroup.rb -- Apache compatible htgroup file
#
diff --git a/lib/webrick/httpauth/htpasswd.rb b/lib/webrick/httpauth/htpasswd.rb
index f43fc2c548..69b739fbfe 100644
--- a/lib/webrick/httpauth/htpasswd.rb
+++ b/lib/webrick/httpauth/htpasswd.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpauth/htpasswd -- Apache compatible htpasswd file
#
diff --git a/lib/webrick/httpauth/userdb.rb b/lib/webrick/httpauth/userdb.rb
index 7a17715cdf..005c18dfd0 100644
--- a/lib/webrick/httpauth/userdb.rb
+++ b/lib/webrick/httpauth/userdb.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# httpauth/userdb.rb -- UserDB mix-in module.
#
diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb
index 79a2e8f55b..7c34d33df0 100644
--- a/lib/webrick/httpproxy.rb
+++ b/lib/webrick/httpproxy.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpproxy.rb -- HTTPProxy Class
#
@@ -13,6 +12,8 @@
require "webrick/httpserver"
require "net/http"
+Net::HTTP::version_1_2 if RUBY_VERSION < "1.7"
+
module WEBrick
NullReader = Object.new # :nodoc:
@@ -157,12 +158,12 @@ module WEBrick
os << proxy_request_line << CRLF
@logger.debug("CONNECT: > #{proxy_request_line}")
if credentials
- @logger.debug("CONNECT: sending credentials")
+ @logger.debug("CONNECT: sending a credentials")
os << "Proxy-Authorization: " << credentials << CRLF
end
os << CRLF
proxy_status_line = os.gets(LF)
- @logger.debug("CONNECT: read Status-Line from the upstream server")
+ @logger.debug("CONNECT: read a Status-Line form the upstream server")
@logger.debug("CONNECT: < #{proxy_status_line}")
if %r{^HTTP/\d+\.\d+\s+200\s*} =~ proxy_status_line
while line = os.gets(LF)
@@ -202,7 +203,7 @@ module WEBrick
ua.syswrite(buf)
end
end
- rescue
+ rescue => ex
os.close
@logger.debug("CONNECT #{host}:#{port}: closed")
end
@@ -313,7 +314,7 @@ module WEBrick
http.start do
if @config[:ProxyTimeout]
################################## these issues are
- http.open_timeout = 30 # secs # necessary (maybe because
+ http.open_timeout = 30 # secs # necessary (maybe bacause
http.read_timeout = 60 # secs # Ruby's bug, but why?)
##################################
end
diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb
index 88cdec8a52..76420730b1 100644
--- a/lib/webrick/httprequest.rb
+++ b/lib/webrick/httprequest.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httprequest.rb -- HTTPRequest Class
#
@@ -370,8 +369,7 @@ module WEBrick
# This method provides the metavariables defined by the revision 3
# of "The WWW Common Gateway Interface Version 1.1"
- # To browse the current document of CGI Version 1.1, see below:
- # http://tools.ietf.org/html/rfc3875
+ # http://Web.Golux.Com/coar/cgi/
def meta_vars
meta = Hash.new
@@ -522,7 +520,7 @@ module WEBrick
}
rescue Errno::ECONNRESET
return nil
- rescue Timeout::Error
+ rescue TimeoutError
raise HTTPStatus::RequestTimeout
end
end
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb
index 5fd54b77c7..044b8dfcaf 100644
--- a/lib/webrick/httpresponse.rb
+++ b/lib/webrick/httpresponse.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpresponse.rb -- HTTPResponse Class
#
@@ -172,7 +171,7 @@ module WEBrick
end
##
- # Iterates over each header in the response
+ # Iterates over each header in the resopnse
def each
@header.each{|field, value| yield(field, value) }
@@ -322,7 +321,7 @@ module WEBrick
# res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
def set_redirect(status, url)
- @body = "<HTML><A HREF=\"#{url}\">#{url}</A>.</HTML>\n"
+ @body = "<HTML><A HREF=\"#{url.to_s}\">#{url.to_s}</A>.</HTML>\n"
@header['location'] = url.to_s
raise status
end
diff --git a/lib/webrick/https.rb b/lib/webrick/https.rb
index 73875d7326..9194f9411c 100644
--- a/lib/webrick/https.rb
+++ b/lib/webrick/https.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# https.rb -- SSL/TLS enhancement for HTTPServer
#
diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb
index e46b3bd1ad..7a7b931dad 100644
--- a/lib/webrick/httpserver.rb
+++ b/lib/webrick/httpserver.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpserver.rb -- HTTPServer Class
#
@@ -9,7 +8,6 @@
#
# $IPR: httpserver.rb,v 1.63 2002/10/01 17:16:32 gotoyuzo Exp $
-require 'io/wait'
require 'webrick/server'
require 'webrick/httputils'
require 'webrick/httpstatus'
@@ -74,11 +72,11 @@ module WEBrick
begin
timeout = @config[:RequestTimeout]
while timeout > 0
- break if sock.to_io.wait_readable(0.5)
- break if @status != :Running
+ break if IO.select([sock], nil, nil, 0.5)
+ timeout = 0 if @status != :Running
timeout -= 0.5
end
- raise HTTPStatus::EOFError if timeout <= 0 || @status != :Running
+ raise HTTPStatus::EOFError if timeout <= 0
raise HTTPStatus::EOFError if sock.eof?
req.parse(sock)
res.request_method = req.request_method
@@ -267,12 +265,12 @@ module WEBrick
k.sort!
k.reverse!
k.collect!{|path| Regexp.escape(path) }
- @scanner = Regexp.new("\\A(" + k.join("|") +")(?=/|\\z)")
+ @scanner = Regexp.new("^(" + k.join("|") +")(?=/|$)")
end
def normalize(dir)
ret = dir ? dir.dup : ""
- ret.sub!(%r|/+\z|, "")
+ ret.sub!(%r|/+$|, "")
ret
end
end
diff --git a/lib/webrick/httpservlet.rb b/lib/webrick/httpservlet.rb
index 1ee04ec86f..ac7c022bd7 100644
--- a/lib/webrick/httpservlet.rb
+++ b/lib/webrick/httpservlet.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpservlet.rb -- HTTPServlet Utility File
#
diff --git a/lib/webrick/httpservlet/abstract.rb b/lib/webrick/httpservlet/abstract.rb
index ee558eb026..d3b00ab4e1 100644
--- a/lib/webrick/httpservlet/abstract.rb
+++ b/lib/webrick/httpservlet/abstract.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httpservlet.rb -- HTTPServlet Module
#
diff --git a/lib/webrick/httpservlet/cgi_runner.rb b/lib/webrick/httpservlet/cgi_runner.rb
index 597f48936b..32ecb6fe00 100644
--- a/lib/webrick/httpservlet/cgi_runner.rb
+++ b/lib/webrick/httpservlet/cgi_runner.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cgi_runner.rb -- CGI launcher.
#
diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb
index ba6b0b6032..7c012ca64b 100644
--- a/lib/webrick/httpservlet/cgihandler.rb
+++ b/lib/webrick/httpservlet/cgihandler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# cgihandler.rb -- CGIHandler Class
#
@@ -42,6 +41,9 @@ module WEBrick
# :stopdoc:
def do_GET(req, res)
+ data = nil
+ status = -1
+
cgi_in = IO::popen(@cgicmd, "wb")
cgi_out = Tempfile.new("webrick.cgiout.", @tempdir, mode: IO::BINARY)
cgi_out.set_encoding("ASCII-8BIT")
@@ -52,7 +54,6 @@ module WEBrick
meta = req.meta_vars
meta["SCRIPT_FILENAME"] = @script_filename
meta["PATH"] = @config[:CGIPathEnv]
- meta.delete("HTTP_PROXY")
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
meta["SystemRoot"] = ENV["SystemRoot"]
end
diff --git a/lib/webrick/httpservlet/erbhandler.rb b/lib/webrick/httpservlet/erbhandler.rb
index 9bcec69883..34b4b9e68b 100644
--- a/lib/webrick/httpservlet/erbhandler.rb
+++ b/lib/webrick/httpservlet/erbhandler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# erbhandler.rb -- ERBHandler Class
#
@@ -57,7 +56,7 @@ module WEBrick
res.body = evaluate(ERB.new(data), req, res)
res['content-type'] ||=
HTTPUtils::mime_type(@script_filename, @config[:MimeTypes])
- rescue StandardError
+ rescue StandardError => ex
raise
rescue Exception => ex
@logger.error(ex)
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb
index 068246c9d0..467b64f0c3 100644
--- a/lib/webrick/httpservlet/filehandler.rb
+++ b/lib/webrick/httpservlet/filehandler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# filehandler.rb -- FileHandler Module
#
@@ -488,7 +487,6 @@ module WEBrick
res.body << "</TR></THEAD>\n"
res.body << "<TBODY>\n"
- query.sub!(/\A&/, '?')
list.unshift [ "..", File::mtime(local_path+"/.."), -1 ]
list.each{ |name, time, size|
if name == ".."
@@ -498,7 +496,7 @@ module WEBrick
else
dname = name
end
- s = "<TR><TD class=\"name\"><A HREF=\"#{HTTPUtils::escape(name)}#{query if name.end_with?('/')}\">#{HTMLUtils::escape(dname)}</A></TD>"
+ s = "<TR><TD class=\"name\"><A HREF=\"#{HTTPUtils::escape(name)}\">#{HTMLUtils::escape(dname)}</A></TD>"
s << "<TD class=\"mtime\">" << (time ? time.strftime("%Y/%m/%d %H:%M") : "") << "</TD>"
s << "<TD class=\"size\">" << (size >= 0 ? size.to_s : "-") << "</TD></TR>\n"
res.body << s
diff --git a/lib/webrick/httpservlet/prochandler.rb b/lib/webrick/httpservlet/prochandler.rb
index c1f454e2f6..2f5aa66f45 100644
--- a/lib/webrick/httpservlet/prochandler.rb
+++ b/lib/webrick/httpservlet/prochandler.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# prochandler.rb -- ProcHandler Class
#
diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb
index ff9f18203c..afc8e75a47 100644
--- a/lib/webrick/httpstatus.rb
+++ b/lib/webrick/httpstatus.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# httpstatus.rb -- HTTPStatus Class
#
@@ -9,8 +8,6 @@
#
# $IPR: httpstatus.rb,v 1.11 2003/03/24 20:18:55 gotoyuzo Exp $
-require 'webrick/accesslog'
-
module WEBrick
##
@@ -23,6 +20,10 @@ module WEBrick
##
# Root of the HTTP status class hierarchy
class Status < StandardError
+ def initialize(*args) # :nodoc:
+ args[0] = AccessLog.escape(args[0]) unless args.empty?
+ super(*args)
+ end
class << self
attr_reader :code, :reason_phrase # :nodoc:
end
@@ -38,7 +39,7 @@ module WEBrick
# Root of the HTTP info statuses
class Info < Status; end
- # Root of the HTTP success statuses
+ # Root of the HTTP sucess statuses
class Success < Status; end
# Root of the HTTP redirect statuses
class Redirect < Status; end
diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb
index 28f906ef4d..a5f0632b86 100644
--- a/lib/webrick/httputils.rb
+++ b/lib/webrick/httputils.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# httputils.rb -- HTTPUtils Module
#
diff --git a/lib/webrick/httpversion.rb b/lib/webrick/httpversion.rb
index 8a251944a2..cdfb957296 100644
--- a/lib/webrick/httpversion.rb
+++ b/lib/webrick/httpversion.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# HTTPVersion.rb -- presentation of HTTP version
#
diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb
index 41e907cd3b..41cde4a740 100644
--- a/lib/webrick/log.rb
+++ b/lib/webrick/log.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# log.rb -- Log Class
#
@@ -118,10 +117,10 @@ module WEBrick
# * Otherwise it will return +arg+.inspect.
def format(arg)
if arg.is_a?(Exception)
- "#{arg.class}: #{AccessLog.escape(arg.message)}\n\t" <<
+ "#{arg.class}: #{arg.message}\n\t" <<
arg.backtrace.join("\n\t") << "\n"
elsif arg.respond_to?(:to_str)
- AccessLog.escape(arg.to_str)
+ arg.to_str
else
arg.inspect
end
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index 3c19f32bf4..3f5371ba47 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# server.rb -- GenericServer Class
#
@@ -49,9 +48,9 @@ module WEBrick
exit!(0) if fork
Dir::chdir("/")
File::umask(0)
- STDIN.reopen(IO::NULL)
- STDOUT.reopen(IO::NULL, "w")
- STDERR.reopen(IO::NULL, "w")
+ STDIN.reopen("/dev/null")
+ STDOUT.reopen("/dev/null", "w")
+ STDERR.reopen("/dev/null", "w")
yield if block_given?
end
end
@@ -107,7 +106,6 @@ module WEBrick
@logger.info("ruby #{rubyv}")
@listeners = []
- @shutdown_pipe = nil
unless @config[:DoNotListen]
if @config[:Listen]
warn(":Listen option is deprecated; use GenericServer#listen")
@@ -131,7 +129,7 @@ module WEBrick
# WEBrick::Utils::create_listeners for details.
def listen(address, port)
- @listeners += Utils::create_listeners(address, port)
+ @listeners += Utils::create_listeners(address, port, @logger)
end
##
@@ -159,35 +157,21 @@ module WEBrick
raise ServerError, "already started." if @status != :Stop
server_type = @config[:ServerType] || SimpleServer
- setup_shutdown_pipe
-
server_type.start{
@logger.info \
"#{self.class}#start: pid=#{$$} port=#{@config[:Port]}"
call_callback(:StartCallback)
- shutdown_pipe = @shutdown_pipe
-
thgroup = ThreadGroup.new
@status = :Running
begin
while @status == :Running
begin
- sp = shutdown_pipe[0]
- if svrs = IO.select([sp, *@listeners], nil, nil, 2.0)
- if svrs[0].include? sp
- # swallow shutdown pipe
- buf = String.new
- nil while String ===
- sp.read_nonblock([sp.nread, 8].max, buf, exception: false)
- break
- end
+ if svrs = IO.select(@listeners, nil, nil, 2.0)
svrs[0].each{|svr|
@tokens.pop # blocks while no token is there.
if sock = accept_client(svr)
- unless config[:DoNotReverseLookup].nil?
- sock.do_not_reverse_lookup = !!config[:DoNotReverseLookup]
- end
+ sock.do_not_reverse_lookup = config[:DoNotReverseLookup]
th = start_thread(sock, &block)
th[:WEBrickThread] = true
thgroup.add(th)
@@ -196,7 +180,7 @@ module WEBrick
end
}
end
- rescue Errno::EBADF, Errno::ENOTSOCK, IOError => ex
+ rescue Errno::EBADF, IOError => ex
# if the listening socket was closed in GenericServer#shutdown,
# IO::select raise it.
rescue StandardError => ex
@@ -207,9 +191,8 @@ module WEBrick
raise
end
end
+
ensure
- cleanup_shutdown_pipe(shutdown_pipe)
- cleanup_listener
@status = :Shutdown
@logger.info "going to shutdown ..."
thgroup.list.each{|th| th.join if th[:WEBrickThread] }
@@ -227,8 +210,6 @@ module WEBrick
if @status == :Running
@status = :Shutdown
end
-
- alarm_shutdown_pipe {|f| f.write_nonblock("\0")}
end
##
@@ -237,8 +218,25 @@ module WEBrick
def shutdown
stop
-
- alarm_shutdown_pipe {|f| f.close}
+ @listeners.each{|s|
+ if @logger.debug?
+ addr = s.addr
+ @logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})")
+ end
+ begin
+ s.shutdown
+ rescue Errno::ENOTCONN
+ # when `Errno::ENOTCONN: Socket is not connected' on some platforms,
+ # call #close instead of #shutdown.
+ # (ignore @config[:ShutdownSocketWithoutClose])
+ s.close
+ else
+ unless @config[:ShutdownSocketWithoutClose]
+ s.close
+ end
+ end
+ }
+ @listeners.clear
end
##
@@ -258,26 +256,19 @@ module WEBrick
# the client socket.
def accept_client(svr)
- case sock = svr.to_io.accept_nonblock(exception: false)
- when :wait_readable
- nil
- else
- if svr.respond_to?(:start_immediately)
- sock = OpenSSL::SSL::SSLSocket.new(sock, ssl_context)
- sock.sync_close = true
- # we cannot do OpenSSL::SSL::SSLSocket#accept here because
- # a slow client can prevent us from accepting connections
- # from other clients
- end
- sock
+ sock = nil
+ begin
+ sock = svr.accept
+ sock.sync = true
+ Utils::set_non_blocking(sock)
+ Utils::set_close_on_exec(sock)
+ rescue Errno::ECONNRESET, Errno::ECONNABORTED,
+ Errno::EPROTO, Errno::EINVAL => ex
+ rescue StandardError => ex
+ msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
+ @logger.error msg
end
- rescue Errno::ECONNRESET, Errno::ECONNABORTED,
- Errno::EPROTO, Errno::EINVAL
- nil
- rescue StandardError => ex
- msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
- @logger.error msg
- nil
+ return sock
end
##
@@ -300,16 +291,6 @@ module WEBrick
@logger.debug "accept: <address unknown>"
raise
end
- if sock.respond_to?(:sync_close=) && @config[:SSLStartImmediately]
- WEBrick::Utils.timeout(@config[:RequestTimeout]) do
- begin
- sock.accept # OpenSSL::SSL::SSLSocket#accept
- rescue Errno::ECONNRESET, Errno::ECONNABORTED,
- Errno::EPROTO, Errno::EINVAL
- Thread.exit
- end
- end
- end
call_callback(:AcceptCallback, sock)
block ? block.call(sock) : run(sock)
rescue Errno::ENOTCONN
@@ -340,59 +321,5 @@ module WEBrick
cb.call(*args)
end
end
-
- def setup_shutdown_pipe
- if !@shutdown_pipe
- @shutdown_pipe = IO.pipe
- end
- @shutdown_pipe
- end
-
- def cleanup_shutdown_pipe(shutdown_pipe)
- @shutdown_pipe = nil
- return if !shutdown_pipe
- shutdown_pipe.each {|io|
- if !io.closed?
- begin
- io.close
- rescue IOError # another thread closed io.
- end
- end
- }
- end
-
- def alarm_shutdown_pipe
- _, pipe = @shutdown_pipe # another thread may modify @shutdown_pipe.
- if pipe
- if !pipe.closed?
- begin
- yield pipe
- rescue IOError # closed by another thread.
- end
- end
- end
- end
-
- def cleanup_listener
- @listeners.each{|s|
- if @logger.debug?
- addr = s.addr
- @logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})")
- end
- begin
- s.shutdown
- rescue Errno::ENOTCONN
- # when `Errno::ENOTCONN: Socket is not connected' on some platforms,
- # call #close instead of #shutdown.
- # (ignore @config[:ShutdownSocketWithoutClose])
- s.close
- else
- unless @config[:ShutdownSocketWithoutClose]
- s.close
- end
- end
- }
- @listeners.clear
- end
end # end of GenericServer
end
diff --git a/lib/webrick/ssl.rb b/lib/webrick/ssl.rb
index 8eb3a442da..cf0f3ddb23 100644
--- a/lib/webrick/ssl.rb
+++ b/lib/webrick/ssl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# ssl.rb -- SSL/TLS enhancement for GenericServer
#
@@ -32,7 +31,7 @@ module WEBrick
# :SSLClientCA :: nil,
# Array of certificates that will be sent to the client.
# :SSLExtraChainCert :: nil,
- # Array of certificates that will be added to the certificate chain
+ # Array of certificates that willbe added to the certificate chain
# :SSLCACertificateFile :: nil,
# Path to a CA certificate file
# :SSLCACertificatePath :: nil,
@@ -150,7 +149,7 @@ module WEBrick
# Updates +listen+ to enable SSL when the SSL configuration is active.
def listen(address, port) # :nodoc:
- listeners = Utils::create_listeners(address, port)
+ listeners = Utils::create_listeners(address, port, @logger)
if @config[:SSLEnable]
unless ssl_context
@ssl_context = setup_ssl_context(@config)
@@ -163,7 +162,6 @@ module WEBrick
}
end
@listeners += listeners
- setup_shutdown_pipe
end
##
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb
index 9c978a2b7b..a6b5cc6a9c 100644
--- a/lib/webrick/utils.rb
+++ b/lib/webrick/utils.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# utils.rb -- Miscellaneous utilities
#
@@ -10,29 +9,40 @@
# $IPR: utils.rb,v 1.10 2003/02/16 22:22:54 gotoyuzo Exp $
require 'socket'
-require 'io/nonblock'
-require 'etc'
+require 'fcntl'
+begin
+ require 'etc'
+rescue LoadError
+ nil
+end
module WEBrick
module Utils
##
# Sets IO operations on +io+ to be non-blocking
def set_non_blocking(io)
- io.nonblock = true if io.respond_to?(:nonblock=)
+ flag = File::NONBLOCK
+ if defined?(Fcntl::F_GETFL)
+ flag |= io.fcntl(Fcntl::F_GETFL)
+ end
+ io.fcntl(Fcntl::F_SETFL, flag)
end
module_function :set_non_blocking
##
# Sets the close on exec flag for +io+
def set_close_on_exec(io)
- io.close_on_exec = true if io.respond_to?(:close_on_exec=)
+ if defined?(Fcntl::FD_CLOEXEC)
+ io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
+ end
end
module_function :set_close_on_exec
##
# Changes the process's uid and gid to the ones of +user+
def su(user)
- if pw = Etc.getpwnam(user)
+ if defined?(Etc)
+ pw = Etc.getpwnam(user)
Process::initgroups(user, pw.gid)
Process::Sys::setgid(pw.gid)
Process::Sys::setuid(pw.uid)
@@ -58,16 +68,14 @@ module WEBrick
# Creates TCP server sockets bound to +address+:+port+ and returns them.
#
# It will create IPV4 and IPV6 sockets on all interfaces.
- def create_listeners(address, port)
+ def create_listeners(address, port, logger=nil)
unless port
raise ArgumentError, "must specify port"
end
sockets = Socket.tcp_server_sockets(address, port)
sockets = sockets.map {|s|
s.autoclose = false
- ts = TCPServer.for_fd(s.fileno)
- s.close
- ts
+ TCPServer.for_fd(s.fileno)
}
return sockets
end
@@ -124,8 +132,6 @@ module WEBrick
class TimeoutHandler
include Singleton
- class Thread < ::Thread; end
-
##
# Mutex used to synchronize access across threads
TimeoutMutex = Mutex.new # :nodoc:
@@ -136,53 +142,36 @@ module WEBrick
# +time+:: Timeout in seconds
# +exception+:: Exception to raise when timeout elapsed
def TimeoutHandler.register(seconds, exception)
- instance.register(Thread.current, Time.now + seconds, exception)
+ TimeoutMutex.synchronize{
+ instance.register(Thread.current, Time.now + seconds, exception)
+ }
end
##
# Cancels the timeout handler +id+
def TimeoutHandler.cancel(id)
- instance.cancel(Thread.current, id)
+ TimeoutMutex.synchronize{
+ instance.cancel(Thread.current, id)
+ }
end
##
# Creates a new TimeoutHandler. You should use ::register and ::cancel
# instead of creating the timeout handler directly.
def initialize
- TimeoutMutex.synchronize{
- @timeout_info = Hash.new
- }
- @queue = Queue.new
- @watcher = Thread.start{
- to_interrupt = []
+ @timeout_info = Hash.new
+ Thread.start{
while true
now = Time.now
- wakeup = nil
- to_interrupt.clear
- TimeoutMutex.synchronize{
- @timeout_info.each {|thread, ary|
- next unless ary
- ary.each{|info|
- time, exception = *info
- if time < now
- to_interrupt.push [thread, info.object_id, exception]
- elsif !wakeup || time < wakeup
- wakeup = time
- end
- }
+ @timeout_info.keys.each{|thread|
+ ary = @timeout_info[thread]
+ next unless ary
+ ary.dup.each{|info|
+ time, exception = *info
+ interrupt(thread, info.object_id, exception) if time < now
}
}
- to_interrupt.each {|arg| interrupt(*arg)}
- if !wakeup
- @queue.pop
- elsif (wakeup -= now) > 0
- begin
- (th = Thread.start {@queue.pop}).join(wakeup)
- ensure
- th&.kill&.join
- end
- end
- @queue.clear
+ sleep 0.5
end
}
end
@@ -190,9 +179,11 @@ module WEBrick
##
# Interrupts the timeout handler +id+ and raises +exception+
def interrupt(thread, id, exception)
- if cancel(thread, id) && thread.alive?
- thread.raise(exception, "execution timeout")
- end
+ TimeoutMutex.synchronize{
+ if cancel(thread, id) && thread.alive?
+ thread.raise(exception, "execution timeout")
+ end
+ }
end
##
@@ -201,28 +192,22 @@ module WEBrick
# +time+:: Timeout in seconds
# +exception+:: Exception to raise when timeout elapsed
def register(thread, time, exception)
- info = nil
- TimeoutMutex.synchronize{
- @timeout_info[thread] ||= Array.new
- @timeout_info[thread] << (info = [time, exception])
- }
- @queue.push nil
- return info.object_id
+ @timeout_info[thread] ||= Array.new
+ @timeout_info[thread] << [time, exception]
+ return @timeout_info[thread].last.object_id
end
##
# Cancels the timeout handler +id+
def cancel(thread, id)
- TimeoutMutex.synchronize{
- if ary = @timeout_info[thread]
- ary.delete_if{|info| info.object_id == id }
- if ary.empty?
- @timeout_info.delete(thread)
- end
- return true
+ if ary = @timeout_info[thread]
+ ary.delete_if{|info| info.object_id == id }
+ if ary.empty?
+ @timeout_info.delete(thread)
end
- return false
- }
+ return true
+ end
+ return false
end
end
diff --git a/lib/webrick/version.rb b/lib/webrick/version.rb
index da5dac94a9..48bdc6d94d 100644
--- a/lib/webrick/version.rb
+++ b/lib/webrick/version.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#--
# version.rb -- version and release date
#
diff --git a/lib/xmlrpc.rb b/lib/xmlrpc.rb
index 3928bf0d95..d8208d02a8 100644
--- a/lib/xmlrpc.rb
+++ b/lib/xmlrpc.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# == Author and Copyright
#
# Copyright (C) 2001-2004 by Michael Neumann (mailto:mneumann@ntecs.de)
@@ -31,7 +30,7 @@
#
# == Documentation
#
-# See http://www.ntecs.de/ruby/xmlrpc4r/. There is plenty of detail there to
+# See http://www.ntecs.de/projects/xmlrpc4r. There is plenty of detail there to
# use the client and implement a server.
#
# == Features of XMLRPC for Ruby
@@ -49,29 +48,19 @@
#
# * Client
# * synchronous/asynchronous calls
-# * Basic HTTP-401 Authentication
+# * Basic HTTP-401 Authentification
# * HTTPS protocol (SSL)
#
# * Parsers
# * NQXML (XMLParser::NQXMLStreamParser, XMLParser::NQXMLTreeParser)
-# * Not compiled (pure ruby)
-# * Note: NQXML's website recommends rexml and isn't available on rubygems.org
-# * See http://nqxml.sourceforge.net/
# * Expat (XMLParser::XMLStreamParser, XMLParser::XMLTreeParser)
-# * Compiled
-# * Fastest parser and also uses the least memory
-# * See https://rubygems.org/gems/xmlparser
# * REXML (XMLParser::REXMLStreamParser)
-# * Not compiled (pure ruby)
-# * See ruby standard library
# * xml-scan (XMLParser::XMLScanStreamParser)
-# * Not compiled (pure ruby)
-# * See https://rubygems.org/gems/xmlscan
# * Fastest parser is Expat's XMLParser::XMLStreamParser!
#
# * General
# * possible to choose between XMLParser module (Expat wrapper) and REXML/NQXML (pure Ruby) parsers
-# * Marshalling Ruby objects to Hashes and reconstruct them later from a Hash
+# * Marshalling Ruby objects to Hashs and reconstruct them later from a Hash
# * SandStorm component architecture XMLRPC::Client interface
#
# == Howto
@@ -303,7 +292,7 @@
# # ...
#
#
-# Note XMLParser::XMLStreamParser (xmlparser gem) is faster and uses less memory than any
+# Note that XMLParser::XMLStreamParser is incredible faster (and uses less memory) than any
# other parser and scales well for large documents. For example for a 0.5 MB XML
# document with many tags, XMLParser::XMLStreamParser is ~350 (!) times faster than
# XMLParser::NQXMLTreeParser and still ~18 times as fast as XMLParser::XMLTreeParser.
diff --git a/lib/xmlrpc/base64.rb b/lib/xmlrpc/base64.rb
index 21f8c65ce2..4aac3520c5 100644
--- a/lib/xmlrpc/base64.rb
+++ b/lib/xmlrpc/base64.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# xmlrpc/base64.rb
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb
index 587a80bea3..ced3d0183f 100644
--- a/lib/xmlrpc/client.rb
+++ b/lib/xmlrpc/client.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# xmlrpc/client.rb
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
@@ -78,6 +77,8 @@ module XMLRPC # :nodoc:
#
# If +use_ssl+ is set to +true+, communication over SSL is enabled.
#
+ # Note, that you need the SSL package from RAA installed.
+ #
# Parameter +timeout+ is the time to wait for a XML-RPC response, defaults to 30.
def initialize(host=nil, path=nil, port=nil, proxy_host=nil, proxy_port=nil,
user=nil, password=nil, use_ssl=nil, timeout=nil)
@@ -246,7 +247,7 @@ module XMLRPC # :nodoc:
# * Date, Time, XMLRPC::DateTime
# * XMLRPC::Base64
# * A Ruby object which class includes XMLRPC::Marshallable
- # (only if Config::ENABLE_MARSHALLING is +true+).
+ # (only if Config::ENABLE_MARSHALLABLE is +true+).
# That object is converted into a hash, with one additional key/value
# pair <code>___class___</code> which contains the class name
# for restoring that object later.
@@ -433,24 +434,6 @@ module XMLRPC # :nodoc:
Net::HTTP.new host, port, proxy_host, proxy_port
end
- def dup_net_http
- http = net_http(@http.address,
- @http.port,
- @http.proxy_address,
- @http.proxy_port)
- http.proxy_user = @http.proxy_user
- http.proxy_pass = @http.proxy_pass
- if @http.use_ssl?
- http.use_ssl = true
- Net::HTTP::SSL_ATTRIBUTES.each do |attribute|
- http.__send__("#{attribute}=", @http.__send__(attribute))
- end
- end
- http.read_timeout = @http.read_timeout
- http.open_timeout = @http.open_timeout
- http
- end
-
def set_auth
if @user.nil?
@auth = nil
@@ -482,7 +465,10 @@ module XMLRPC # :nodoc:
if async
# use a new HTTP object for each call
- http = dup_net_http
+ http = net_http(@host, @port, @proxy_host, @proxy_port)
+ http.use_ssl = @use_ssl if @use_ssl
+ http.read_timeout = @timeout
+ http.open_timeout = @timeout
# post request
http.start {
@@ -490,7 +476,7 @@ module XMLRPC # :nodoc:
}
else
# reuse the HTTP object for each call => connection alive is possible
- # we must start connection explicitly first time so that http.request
+ # we must start connection explicitely first time so that http.request
# does not assume that we don't want keepalive
@http.start if not @http.started?
@@ -523,6 +509,8 @@ module XMLRPC # :nodoc:
expected = resp["Content-Length"] || "<unknown>"
if data.nil? or data.bytesize == 0
raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
+ elsif expected != "<unknown>" and expected.to_i != data.bytesize and resp["Transfer-Encoding"].nil?
+ raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
end
parse_set_cookies(resp.get_fields("Set-Cookie"))
@@ -627,3 +615,4 @@ module XMLRPC # :nodoc:
end # class Client
end # module XMLRPC
+
diff --git a/lib/xmlrpc/config.rb b/lib/xmlrpc/config.rb
index f49adb6892..98081473b4 100644
--- a/lib/xmlrpc/config.rb
+++ b/lib/xmlrpc/config.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# $Id$
# Configuration file for XML-RPC for Ruby
@@ -19,7 +18,6 @@ module XMLRPC # :nodoc:
# * XMLParser::XMLStreamParser (fastest)
# * XMLParser::REXMLStreamParser
# * XMLParser::XMLScanStreamParser
- # * XMLParser::LibXMLStreamParser
DEFAULT_PARSER = XMLParser::REXMLStreamParser
# enable <code><nil/></code> tag
diff --git a/lib/xmlrpc/create.rb b/lib/xmlrpc/create.rb
index 93822c4dd2..13c9cd8faa 100644
--- a/lib/xmlrpc/create.rb
+++ b/lib/xmlrpc/create.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
diff --git a/lib/xmlrpc/datetime.rb b/lib/xmlrpc/datetime.rb
index 431ac24aa9..dff2304f92 100644
--- a/lib/xmlrpc/datetime.rb
+++ b/lib/xmlrpc/datetime.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# xmlrpc/datetime.rb
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
@@ -10,7 +9,7 @@ require "date"
module XMLRPC # :nodoc:
# This class is important to handle XMLRPC +dateTime.iso8601+ values,
-# correctly, because normal UNIX-dates, ie: Date, only handle dates
+# correcly, because normal UNIX-dates, ie: Date, only handle dates
# from year 1970 on, and ruby's native Time class handles dates without the
# time component.
#
diff --git a/lib/xmlrpc/httpserver.rb b/lib/xmlrpc/httpserver.rb
new file mode 100644
index 0000000000..dd0d7417c1
--- /dev/null
+++ b/lib/xmlrpc/httpserver.rb
@@ -0,0 +1,173 @@
+# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
+#
+# $Id$
+#
+
+
+require "gserver"
+
+# Implements a simple HTTP-server by using John W. Small's (jsmall@laser.net)
+# ruby-generic-server: GServer.
+class HttpServer < GServer
+
+ ##
+ # +handle_obj+ specifies the object, that receives calls from +request_handler+
+ # and +ip_auth_handler+
+ def initialize(handle_obj, port = 8080, host = DEFAULT_HOST, maxConnections = 4,
+ stdlog = $stdout, audit = true, debug = true)
+ @handler = handle_obj
+ super(port, host, maxConnections, stdlog, audit, debug)
+ end
+
+private
+
+ CRLF = "\r\n"
+ HTTP_PROTO = "HTTP/1.0"
+ SERVER_NAME = "HttpServer (Ruby #{RUBY_VERSION})"
+
+ # Default header for the server name
+ DEFAULT_HEADER = {
+ "Server" => SERVER_NAME
+ }
+
+ # Mapping of status codes and error messages
+ StatusCodeMapping = {
+ 200 => "OK",
+ 400 => "Bad Request",
+ 403 => "Forbidden",
+ 405 => "Method Not Allowed",
+ 411 => "Length Required",
+ 500 => "Internal Server Error"
+ }
+
+ class Request
+ attr_reader :data, :header, :method, :path, :proto
+
+ def initialize(data, method=nil, path=nil, proto=nil)
+ @header, @data = Table.new, data
+ @method, @path, @proto = method, path, proto
+ end
+
+ def content_length
+ len = @header['Content-Length']
+ return nil if len.nil?
+ return len.to_i
+ end
+
+ end
+
+ class Response
+ attr_reader :header
+ attr_accessor :body, :status, :status_message
+
+ def initialize(status=200)
+ @status = status
+ @status_message = nil
+ @header = Table.new
+ end
+ end
+
+ # A case-insensitive Hash class for HTTP header
+ class Table
+ include Enumerable
+
+ def initialize(hash={})
+ @hash = hash
+ update(hash)
+ end
+
+ def [](key)
+ @hash[key.to_s.capitalize]
+ end
+
+ def []=(key, value)
+ @hash[key.to_s.capitalize] = value
+ end
+
+ def update(hash)
+ hash.each {|k,v| self[k] = v}
+ self
+ end
+
+ def each
+ @hash.each {|k,v| yield k.capitalize, v }
+ end
+
+ # Output the Hash table for the HTTP header
+ def writeTo(port)
+ each { |k,v| port << "#{k}: #{v}" << CRLF }
+ end
+ end # class Table
+
+
+ # Generates a Hash with the HTTP headers
+ def http_header(header=nil) # :doc:
+ new_header = Table.new(DEFAULT_HEADER)
+ new_header.update(header) unless header.nil?
+
+ new_header["Connection"] = "close"
+ new_header["Date"] = http_date(Time.now)
+
+ new_header
+ end
+
+ # Returns a string which represents the time as rfc1123-date of HTTP-date
+ def http_date( aTime ) # :doc:
+ aTime.gmtime.strftime( "%a, %d %b %Y %H:%M:%S GMT" )
+ end
+
+ # Returns a string which includes the status code message as,
+ # http headers, and body for the response.
+ def http_resp(status_code, status_message=nil, header=nil, body=nil) # :doc:
+ status_message ||= StatusCodeMapping[status_code]
+
+ str = ""
+ str << "#{HTTP_PROTO} #{status_code} #{status_message}" << CRLF
+ http_header(header).writeTo(str)
+ str << CRLF
+ str << body unless body.nil?
+ str
+ end
+
+ # Handles the HTTP request and writes the response back to the client, +io+.
+ #
+ # If an Exception is raised while handling the request, the client will receive
+ # a 500 "Internal Server Error" message.
+ def serve(io) # :doc:
+ # perform IP authentification
+ unless @handler.ip_auth_handler(io)
+ io << http_resp(403, "Forbidden")
+ return
+ end
+
+ # parse first line
+ if io.gets =~ /^(\S+)\s+(\S+)\s+(\S+)/
+ request = Request.new(io, $1, $2, $3)
+ else
+ io << http_resp(400, "Bad Request")
+ return
+ end
+
+ # parse HTTP headers
+ while (line=io.gets) !~ /^(\n|\r)/
+ if line =~ /^([\w-]+):\s*(.*)$/
+ request.header[$1] = $2.strip
+ end
+ end
+
+ io.binmode
+ response = Response.new
+
+ # execute request handler
+ @handler.request_handler(request, response)
+
+ # write response back to the client
+ io << http_resp(response.status, response.status_message,
+ response.header, response.body)
+
+ rescue Exception
+ io << http_resp(500, "Internal Server Error")
+ end
+
+end # class HttpServer
+
diff --git a/lib/xmlrpc/marshal.rb b/lib/xmlrpc/marshal.rb
index 42b7b1e125..ef1234f801 100644
--- a/lib/xmlrpc/marshal.rb
+++ b/lib/xmlrpc/marshal.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb
index 3b912b6be2..0afbd07e6b 100644
--- a/lib/xmlrpc/parser.rb
+++ b/lib/xmlrpc/parser.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
# $Id$
@@ -815,44 +814,12 @@ module XMLRPC # :nodoc:
end
end
- class LibXMLStreamParser < AbstractStreamParser
- def initialize
- require 'libxml'
- @parser_class = LibXMLStreamListener
- end
-
- class LibXMLStreamListener
- include StreamParserMixin
-
- def on_start_element_ns(name, attributes, prefix, uri, namespaces)
- startElement(name)
- end
-
- def on_end_element_ns(name, prefix, uri)
- endElement(name)
- end
-
- alias :on_characters :character
- alias :on_cdata_block :character
-
- def method_missing(*a)
- end
-
- def parse(str)
- parser = LibXML::XML::SaxParser.string(str)
- parser.callbacks = self
- parser.parse()
- end
- end
- end
-
XMLParser = XMLTreeParser
NQXMLParser = NQXMLTreeParser
Classes = [XMLStreamParser, XMLTreeParser,
NQXMLStreamParser, NQXMLTreeParser,
- REXMLStreamParser, XMLScanStreamParser,
- LibXMLStreamParser]
+ REXMLStreamParser, XMLScanStreamParser]
# yields an instance of each installed parser
def self.each_installed_parser
diff --git a/lib/xmlrpc/server.rb b/lib/xmlrpc/server.rb
index cd0fdbad38..c16375b405 100644
--- a/lib/xmlrpc/server.rb
+++ b/lib/xmlrpc/server.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
# xmlrpc/server.rb
# Copyright (C) 2001, 2002, 2003, 2005 by Michael Neumann (mneumann@ntecs.de)
#
@@ -51,7 +50,7 @@ class BasicServer
# method should be called from a subclass indirectly by a +super+ call
# in the initialize method.
#
- # The parameter +class_delim+ is used by add_handler, see
+ # The paramter +class_delim+ is used by add_handler, see
# XMLRPC::BasicServer#add_handler, when an object is added as a handler, to
# delimit the object-prefix and the method-name.
def initialize(class_delim=".")
diff --git a/lib/xmlrpc/utils.rb b/lib/xmlrpc/utils.rb
index cd2ab107d9..186938a56e 100644
--- a/lib/xmlrpc/utils.rb
+++ b/lib/xmlrpc/utils.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
#
diff --git a/lib/yaml.rb b/lib/yaml.rb
index 0c33305e1d..f9f8e6d665 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
##
# The YAML module is an alias of Psych, the YAML engine for Ruby.
@@ -13,6 +12,40 @@ end
YAML = Psych # :nodoc:
+module Psych # :nodoc:
+ # For compatibility, deprecated
+ class EngineManager # :nodoc:
+ attr_reader :yamler # :nodoc:
+
+ def initialize # :nodoc:
+ @yamler = 'psych'
+ end
+
+ def syck? # :nodoc:
+ false
+ end
+
+ # Psych is always used and this method has no effect.
+ #
+ # This method is still present for compatibility.
+ #
+ # You may still use the Syck engine by installing
+ # the 'syck' gem and using the Syck constant.
+ def yamler= engine # :nodoc:
+ case engine
+ when 'syck' then warn "syck has been removed, psych is used instead"
+ when 'psych' then @yamler = 'psych'
+ else
+ raise(ArgumentError, "bad engine")
+ end
+
+ engine
+ end
+ end
+
+ ENGINE = EngineManager.new # :nodoc:
+end
+
# YAML Ain't Markup Language
#
# This module provides a Ruby interface for data serialization in YAML format.
@@ -23,7 +56,7 @@ YAML = Psych # :nodoc:
#
# Working with YAML can be very simple, for example:
#
-# require 'yaml'
+# require 'yaml' # STEP ONE, REQUIRE YAML!
# # Parse a YAML string
# YAML.load("--- foo") #=> "foo"
#
@@ -52,9 +85,5 @@ YAML = Psych # :nodoc:
#
# For more advanced details on the implementation see Psych, and also check out
# http://yaml.org for spec details and other helpful information.
-#
-# Psych is maintained by Aaron Patterson on github: https://github.com/tenderlove/psych
-#
-# Syck can also be found on github: https://github.com/tenderlove/syck
module YAML
end
diff --git a/lib/yaml/dbm.rb b/lib/yaml/dbm.rb
index e2508cd74b..24a68bfa71 100644
--- a/lib/yaml/dbm.rb
+++ b/lib/yaml/dbm.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'yaml'
require 'dbm'
diff --git a/lib/yaml/store.rb b/lib/yaml/store.rb
index 57ef0ba500..b0b580ba1a 100644
--- a/lib/yaml/store.rb
+++ b/lib/yaml/store.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# YAML::Store
#
diff --git a/load.c b/load.c
index 70c734595e..141c02f33b 100644
--- a/load.c
+++ b/load.c
@@ -2,13 +2,15 @@
* load methods from eval.c
*/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/util.h"
+#include "internal.h"
#include "dln.h"
#include "eval_intern.h"
#include "probes.h"
+#include "node.h"
-static VALUE ruby_dln_librefs;
+VALUE ruby_dln_librefs;
#define IS_RBEXT(e) (strcmp((e), ".rb") == 0)
#define IS_SOEXT(e) (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0)
@@ -46,7 +48,7 @@ enum expand_type {
string objects in $LOAD_PATH are frozen.
*/
static void
-rb_construct_expanded_load_path(enum expand_type type, int *has_relative, int *has_non_cache)
+rb_construct_expanded_load_path(int type, int *has_relative, int *has_non_cache)
{
rb_vm_t *vm = GET_VM();
VALUE load_path = vm->load_path;
@@ -87,7 +89,7 @@ rb_construct_expanded_load_path(enum expand_type type, int *has_relative, int *h
as_str = rb_get_path_check_convert(path, as_str, level);
expanded_path = rb_file_expand_path_fast(as_str, Qnil);
rb_str_freeze(expanded_path);
- rb_ary_push(ary, rb_fstring(expanded_path));
+ rb_ary_push(ary, expanded_path);
}
rb_obj_freeze(ary);
vm->expanded_load_path = ary;
@@ -201,8 +203,7 @@ features_index_add_single(VALUE short_feature, VALUE offset)
VALUE feature_indexes[2];
feature_indexes[0] = this_feature_index;
feature_indexes[1] = offset;
- this_feature_index = (VALUE)xcalloc(1, sizeof(struct RArray));
- RBASIC(this_feature_index)->flags = T_ARRAY; /* fake VALUE, do not mark/sweep */
+ this_feature_index = rb_ary_tmp_new(numberof(feature_indexes));
rb_ary_cat(this_feature_index, feature_indexes, numberof(feature_indexes));
st_insert(features_index, (st_data_t)short_feature_cstr, (st_data_t)this_feature_index);
}
@@ -215,8 +216,8 @@ features_index_add_single(VALUE short_feature, VALUE offset)
/* Add to the loaded-features index all the required entries for
`feature`, located at `offset` in $LOADED_FEATURES. We add an
index entry at each string `short_feature` for which
- feature == "#{prefix}#{short_feature}#{ext}"
- where `ext` is empty or matches %r{^\.[^./]*$}, and `prefix` is empty
+ feature == "#{prefix}#{short_feature}#{e}"
+ where `e` is empty or matches %r{^\.[^./]*$}, and `prefix` is empty
or ends in '/'. This maintains the invariant that `rb_feature_p()`
relies on for its fast lookup.
*/
@@ -239,19 +240,16 @@ features_index_add(VALUE feature, VALUE offset)
p = ext ? ext : feature_end;
while (1) {
- long beg;
-
p--;
while (p >= feature_str && *p != '/')
p--;
if (p < feature_str)
break;
/* Now *p == '/'. We reach this point for every '/' in `feature`. */
- beg = p + 1 - feature_str;
- short_feature = rb_str_subseq(feature, beg, feature_end - p - 1);
+ short_feature = rb_str_subseq(feature, p + 1 - feature_str, feature_end - p - 1);
features_index_add_single(short_feature, offset);
if (ext) {
- short_feature = rb_str_subseq(feature, beg, ext - p - 1);
+ short_feature = rb_str_subseq(feature, p + 1 - feature_str, ext - p - 1);
features_index_add_single(short_feature, offset);
}
}
@@ -265,11 +263,6 @@ features_index_add(VALUE feature, VALUE offset)
static int
loaded_features_index_clear_i(st_data_t key, st_data_t val, st_data_t arg)
{
- VALUE obj = (VALUE)val;
- if (!SPECIAL_CONST_P(obj)) {
- rb_ary_free(obj);
- xfree((void *)obj);
- }
xfree((char *)key);
return ST_DELETE;
}
@@ -290,9 +283,9 @@ get_loaded_features_index(void)
VALUE entry, as_str;
as_str = entry = rb_ary_entry(features, i);
StringValue(as_str);
- as_str = rb_fstring(rb_str_freeze(as_str));
if (as_str != entry)
rb_ary_store(features, i, as_str);
+ rb_str_freeze(as_str);
features_index_add(as_str, INT2FIX(i));
}
reset_loaded_features_snapshot();
@@ -320,7 +313,7 @@ loaded_feature_path(const char *name, long vlen, const char *feature, long len,
const char *e;
if (vlen < len+1) return 0;
- if (strchr(feature, '.') && !strncmp(name+(vlen-len), feature, len)) {
+ if (!strncmp(name+(vlen-len), feature, len)) {
plen = vlen - len;
}
else {
@@ -466,54 +459,56 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
}
loading_tbl = get_loading_table();
- f = 0;
- if (!expanded) {
- struct loaded_feature_searching fs;
- fs.name = feature;
- fs.len = len;
- fs.type = type;
- fs.load_path = load_path ? load_path : rb_get_expanded_load_path();
- fs.result = 0;
- st_foreach(loading_tbl, loaded_feature_path_i, (st_data_t)&fs);
- if ((f = fs.result) != 0) {
- if (fn) *fn = f;
- goto loading;
- }
- }
- if (st_get_key(loading_tbl, (st_data_t)feature, &data)) {
- if (fn) *fn = (const char*)data;
- loading:
- if (!ext) return 'u';
- return !IS_RBEXT(ext) ? 's' : 'r';
- }
- else {
- VALUE bufstr;
- char *buf;
- static const char so_ext[][4] = {
- ".so", ".o",
- };
-
- if (ext && *ext) return 0;
- bufstr = rb_str_tmp_new(len + DLEXT_MAXLEN);
- buf = RSTRING_PTR(bufstr);
- MEMCPY(buf, feature, char, len);
- for (i = 0; (e = loadable_ext[i]) != 0; i++) {
- strlcpy(buf + len, e, DLEXT_MAXLEN + 1);
- if (st_get_key(loading_tbl, (st_data_t)buf, &data)) {
- rb_str_resize(bufstr, 0);
- if (fn) *fn = (const char*)data;
- return i ? 's' : 'r';
+ if (loading_tbl) {
+ f = 0;
+ if (!expanded) {
+ struct loaded_feature_searching fs;
+ fs.name = feature;
+ fs.len = len;
+ fs.type = type;
+ fs.load_path = load_path ? load_path : rb_get_expanded_load_path();
+ fs.result = 0;
+ st_foreach(loading_tbl, loaded_feature_path_i, (st_data_t)&fs);
+ if ((f = fs.result) != 0) {
+ if (fn) *fn = f;
+ goto loading;
}
}
- for (i = 0; i < numberof(so_ext); i++) {
- strlcpy(buf + len, so_ext[i], DLEXT_MAXLEN + 1);
- if (st_get_key(loading_tbl, (st_data_t)buf, &data)) {
- rb_str_resize(bufstr, 0);
- if (fn) *fn = (const char*)data;
- return 's';
+ if (st_get_key(loading_tbl, (st_data_t)feature, &data)) {
+ if (fn) *fn = (const char*)data;
+ loading:
+ if (!ext) return 'u';
+ return !IS_RBEXT(ext) ? 's' : 'r';
+ }
+ else {
+ VALUE bufstr;
+ char *buf;
+ static const char so_ext[][4] = {
+ ".so", ".o",
+ };
+
+ if (ext && *ext) return 0;
+ bufstr = rb_str_tmp_new(len + DLEXT_MAXLEN);
+ buf = RSTRING_PTR(bufstr);
+ MEMCPY(buf, feature, char, len);
+ for (i = 0; (e = loadable_ext[i]) != 0; i++) {
+ strlcpy(buf + len, e, DLEXT_MAXLEN + 1);
+ if (st_get_key(loading_tbl, (st_data_t)buf, &data)) {
+ rb_str_resize(bufstr, 0);
+ if (fn) *fn = (const char*)data;
+ return i ? 's' : 'r';
+ }
+ }
+ for (i = 0; i < numberof(so_ext); i++) {
+ strlcpy(buf + len, so_ext[i], DLEXT_MAXLEN + 1);
+ if (st_get_key(loading_tbl, (st_data_t)buf, &data)) {
+ rb_str_resize(bufstr, 0);
+ if (fn) *fn = (const char*)data;
+ return 's';
+ }
}
+ rb_str_resize(bufstr, 0);
}
- rb_str_resize(bufstr, 0);
}
return 0;
}
@@ -528,7 +523,7 @@ int
rb_feature_provided(const char *feature, const char **loading)
{
const char *ext = strrchr(feature, '.');
- VALUE fullpath = 0;
+ volatile VALUE fullpath = 0;
if (*feature == '.' &&
(feature[1] == '/' || strncmp(feature+1, "./", 2) == 0)) {
@@ -547,7 +542,6 @@ rb_feature_provided(const char *feature, const char **loading)
}
if (rb_feature_p(feature, 0, TRUE, FALSE, loading))
return TRUE;
- RB_GC_GUARD(fullpath);
return FALSE;
}
@@ -563,7 +557,7 @@ rb_provide_feature(VALUE feature)
}
rb_str_freeze(feature);
- rb_ary_push(features, rb_fstring(feature));
+ rb_ary_push(features, feature);
features_index_add(feature, INT2FIX(RARRAY_LEN(features)-1));
reset_loaded_features_snapshot();
}
@@ -575,14 +569,14 @@ rb_provide(const char *feature)
}
NORETURN(static void load_failed(VALUE));
-const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
-static int
+static inline void
rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
{
int state;
volatile VALUE wrapper = th->top_wrapper;
volatile VALUE self = th->top_self;
+ volatile int loaded = FALSE;
volatile int mild_compile_error;
#if !defined __GNUC__
rb_thread_t *volatile th0 = th;
@@ -601,24 +595,20 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
}
mild_compile_error = th->mild_compile_error;
- TH_PUSH_TAG(th);
+ PUSH_TAG();
state = EXEC_TAG();
if (state == 0) {
NODE *node;
- const rb_iseq_t *iseq;
+ VALUE iseq;
- if ((iseq = rb_iseq_load_iseq(fname)) != NULL) {
- /* OK */
- }
- else {
- th->mild_compile_error++;
- node = (NODE *)rb_load_file_str(fname);
- iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, rb_realpath_internal(Qnil, fname, 1), NULL);
- th->mild_compile_error--;
- }
+ th->mild_compile_error++;
+ node = (NODE *)rb_load_file_str(fname);
+ loaded = TRUE;
+ iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, rb_realpath_internal(Qnil, fname, 1), Qfalse);
+ th->mild_compile_error--;
rb_iseq_eval(iseq);
}
- TH_POP_TAG();
+ POP_TAG();
#if !defined __GNUC__
th = th0;
@@ -628,57 +618,44 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
th->top_self = self;
th->top_wrapper = wrapper;
+ if (!loaded && !FIXNUM_P(th->errinfo)) {
+ /* an error on loading don't include INT2FIX(TAG_FATAL) see r35625 */
+ rb_exc_raise(th->errinfo);
+ }
if (state) {
- VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
- if (NIL_P(exc)) return state;
- th->errinfo = exc;
- return TAG_RAISE;
+ rb_vm_jump_tag_but_local_jump(state);
}
if (!NIL_P(th->errinfo)) {
/* exception during load */
- return TAG_RAISE;
+ rb_exc_raise(th->errinfo);
}
- return state;
}
static void
rb_load_internal(VALUE fname, int wrap)
{
- rb_thread_t *curr_th = GET_THREAD();
- int state = rb_load_internal0(curr_th, fname, wrap);
- if (state) {
- if (state == TAG_RAISE) rb_exc_raise(curr_th->errinfo);
- JUMP_TAG(state);
- }
-}
-
-static VALUE
-file_to_load(VALUE fname)
-{
- VALUE tmp = rb_find_file(FilePathValue(fname));
- if (!tmp) load_failed(fname);
- return tmp;
+ rb_load_internal0(GET_THREAD(), fname, wrap);
}
void
rb_load(VALUE fname, int wrap)
{
- rb_load_internal(file_to_load(fname), wrap);
+ VALUE tmp = rb_find_file(FilePathValue(fname));
+ if (!tmp) load_failed(fname);
+ rb_load_internal(tmp, wrap);
}
void
rb_load_protect(VALUE fname, int wrap, int *state)
{
int status;
- volatile VALUE path = 0;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
- path = file_to_load(fname);
+ rb_load(fname, wrap);
}
POP_TAG();
- if (!status) status = rb_load_internal0(GET_THREAD(), path, wrap);
if (state)
*state = status;
}
@@ -700,23 +677,29 @@ rb_load_protect(VALUE fname, int wrap, int *state)
static VALUE
rb_f_load(int argc, VALUE *argv)
{
- VALUE fname, wrap, path, orig_fname;
+ VALUE fname, wrap, path;
rb_scan_args(argc, argv, "11", &fname, &wrap);
- RUBY_DTRACE_HOOK(LOAD_ENTRY, StringValuePtr(fname));
+ if (RUBY_DTRACE_LOAD_ENTRY_ENABLED()) {
+ RUBY_DTRACE_LOAD_ENTRY(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
- orig_fname = FilePathValue(fname);
- fname = rb_str_encode_ospath(orig_fname);
- path = rb_find_file(fname);
+ path = rb_find_file(FilePathValue(fname));
if (!path) {
if (!rb_file_load_ok(RSTRING_PTR(fname)))
- load_failed(orig_fname);
+ load_failed(fname);
path = fname;
}
rb_load_internal(path, RTEST(wrap));
- RUBY_DTRACE_HOOK(LOAD_RETURN, StringValuePtr(fname));
+ if (RUBY_DTRACE_LOAD_RETURN_ENABLED()) {
+ RUBY_DTRACE_LOAD_RETURN(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
return Qtrue;
}
@@ -727,16 +710,20 @@ load_lock(const char *ftptr)
st_data_t data;
st_table *loading_tbl = get_loading_table();
- if (!st_lookup(loading_tbl, (st_data_t)ftptr, &data)) {
+ if (!loading_tbl || !st_lookup(loading_tbl, (st_data_t)ftptr, &data)) {
+ /* loading ruby library should be serialized. */
+ if (!loading_tbl) {
+ GET_VM()->loading_table = loading_tbl = st_init_strtable();
+ }
/* partial state */
ftptr = ruby_strdup(ftptr);
data = (st_data_t)rb_thread_shield_new();
st_insert(loading_tbl, (st_data_t)ftptr, data);
return (char *)ftptr;
}
- else if (RB_TYPE_P((VALUE)data, T_IMEMO) && imemo_type((VALUE)data) == imemo_memo) {
- struct MEMO *memo = MEMO_CAST(data);
- void (*init)(void) = (void (*)(void))memo->u3.func;
+ else if (RB_TYPE_P((VALUE)data, T_NODE) && nd_type((VALUE)data) == NODE_MEMO) {
+ NODE *memo = RNODE(data);
+ void (*init)(void) = (void (*)(void))memo->nd_cfnc;
data = (st_data_t)rb_thread_shield_new();
st_insert(loading_tbl, (st_data_t)ftptr, data);
(*init)();
@@ -942,21 +929,14 @@ load_failed(VALUE fname)
static VALUE
load_ext(VALUE path)
{
- rb_scope_visibility_set(METHOD_VISI_PUBLIC);
+ SCOPE_SET(NOEX_PUBLIC);
return (VALUE)dln_load(RSTRING_PTR(path));
}
-/*
- * returns
- * 0: if already loaded (false)
- * 1: successfully loaded (true)
- * <0: not found (LoadError)
- * >1: exception
- */
-int
-rb_require_internal(VALUE fname, int safe)
+VALUE
+rb_require_safe(VALUE fname, int safe)
{
- volatile int result = -1;
+ volatile VALUE result = Qnil;
rb_thread_t *th = GET_THREAD();
volatile VALUE errinfo = th->errinfo;
int state;
@@ -965,9 +945,13 @@ rb_require_internal(VALUE fname, int safe)
} volatile saved;
char *volatile ftptr = 0;
- RUBY_DTRACE_HOOK(REQUIRE_ENTRY, StringValuePtr(fname));
+ if (RUBY_DTRACE_REQUIRE_ENTRY_ENABLED()) {
+ RUBY_DTRACE_REQUIRE_ENTRY(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
- TH_PUSH_TAG(th);
+ PUSH_TAG();
saved.safe = rb_safe_level();
if ((state = EXEC_TAG()) == 0) {
VALUE path;
@@ -978,24 +962,32 @@ rb_require_internal(VALUE fname, int safe)
FilePathValue(fname);
rb_set_safe_level_force(0);
- RUBY_DTRACE_HOOK(FIND_REQUIRE_ENTRY, StringValuePtr(fname));
+ if (RUBY_DTRACE_FIND_REQUIRE_ENTRY_ENABLED()) {
+ RUBY_DTRACE_FIND_REQUIRE_ENTRY(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
path = rb_str_encode_ospath(fname);
found = search_required(path, &path, safe);
- RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, StringValuePtr(fname));
+ if (RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) {
+ RUBY_DTRACE_FIND_REQUIRE_RETURN(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
if (found) {
if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
- result = 0;
+ result = Qfalse;
}
else if (!*ftptr) {
rb_provide_feature(path);
- result = TAG_RETURN;
+ result = Qtrue;
}
else {
switch (found) {
case 'r':
- state = rb_load_internal0(th, path, 0);
+ rb_load_internal(path, 0);
break;
case 's':
@@ -1004,53 +996,32 @@ rb_require_internal(VALUE fname, int safe)
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;
}
- if (!state) {
- rb_provide_feature(path);
- result = TAG_RETURN;
- }
+ rb_provide_feature(path);
+ result = Qtrue;
}
}
}
- TH_POP_TAG();
+ POP_TAG();
load_unlock(ftptr, !state);
rb_set_safe_level_force(saved.safe);
if (state) {
- /* never TAG_RETURN */
- return state;
+ JUMP_TAG(state);
}
- th->errinfo = errinfo;
-
- RUBY_DTRACE_HOOK(REQUIRE_RETURN, StringValuePtr(fname));
-
- return result;
-}
-
-int
-ruby_require_internal(const char *fname, unsigned int len)
-{
- struct RString fake;
- VALUE str = rb_setup_fake_str(&fake, fname, len, 0);
- int result = rb_require_internal(str, 0);
- rb_set_errinfo(Qnil);
- return result == TAG_RETURN ? 1 : result ? -1 : 0;
-}
+ if (NIL_P(result)) {
+ load_failed(fname);
+ }
-VALUE
-rb_require_safe(VALUE fname, int safe)
-{
- int result = rb_require_internal(fname, safe);
+ th->errinfo = errinfo;
- if (result > TAG_RETURN) {
- if (result == TAG_RAISE) rb_exc_raise(rb_errinfo());
- JUMP_TAG(result);
- }
- if (result < 0) {
- load_failed(fname);
+ if (RUBY_DTRACE_REQUIRE_RETURN_ENABLED()) {
+ RUBY_DTRACE_REQUIRE_RETURN(StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
}
- return result ? Qtrue : Qfalse;
+ return result;
}
VALUE
@@ -1070,7 +1041,7 @@ register_init_ext(st_data_t *key, st_data_t *value, st_data_t init, int existing
rb_warn("%s is already registered", name);
}
else {
- *value = (st_data_t)MEMO_NEW(0, 0, init);
+ *value = (st_data_t)NEW_MEMO(init, 0, 0);
*key = (st_data_t)ruby_strdup(name);
}
return ST_CONTINUE;
@@ -1081,8 +1052,9 @@ ruby_init_ext(const char *name, void (*init)(void))
{
st_table *loading_tbl = get_loading_table();
- if (rb_provided(name))
- return;
+ if (!loading_tbl) {
+ GET_VM()->loading_table = loading_tbl = st_init_strtable();
+ }
st_update(loading_tbl, (st_data_t)name, register_init_ext, (st_data_t)init);
}
@@ -1106,7 +1078,7 @@ rb_mod_autoload(VALUE mod, VALUE sym, VALUE file)
ID id = rb_to_id(sym);
FilePathValue(file);
- rb_autoload_str(mod, id, file);
+ rb_autoload(mod, id, RSTRING_PTR(file));
return Qnil;
}
@@ -1177,7 +1149,7 @@ rb_f_autoload_p(VALUE obj, VALUE sym)
}
void
-Init_load(void)
+Init_load()
{
#undef rb_intern
#define rb_intern(str) rb_intern2((str), strlen(str))
diff --git a/localeinit.c b/localeinit.c
index 6563a6f90a..369013fc26 100644
--- a/localeinit.c
+++ b/localeinit.c
@@ -9,8 +9,9 @@
**********************************************************************/
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "internal.h"
-#include "encindex.h"
#ifdef __CYGWIN__
#include <windows.h>
#endif
@@ -18,19 +19,14 @@
#include <langinfo.h>
#endif
-#if defined _WIN32 || defined __CYGWIN__
-#define SIZEOF_CP_NAME ((sizeof(UINT) * 8 / 3) + 4)
-#define CP_FORMAT(buf, codepage) snprintf(buf, sizeof(buf), "CP%u", (codepage))
-#endif
-
-static VALUE
-locale_charmap(VALUE (*conv)(const char *))
+VALUE
+rb_locale_charmap(VALUE klass)
{
#if defined NO_LOCALE_CHARMAP
# error NO_LOCALE_CHARMAP defined
#elif defined _WIN32 || defined __CYGWIN__
const char *codeset = 0;
- char cp[SIZEOF_CP_NAME];
+ char cp[sizeof(int) * 3 + 4];
# ifdef __CYGWIN__
const char *nl_langinfo_codeset(void);
codeset = nl_langinfo_codeset();
@@ -38,62 +34,19 @@ locale_charmap(VALUE (*conv)(const char *))
if (!codeset) {
UINT codepage = GetConsoleCP();
if (!codepage) codepage = GetACP();
- CP_FORMAT(cp, codepage);
+ snprintf(cp, sizeof(cp), "CP%d", codepage);
codeset = cp;
}
- return (*conv)(codeset);
+ return rb_usascii_str_new2(codeset);
#elif defined HAVE_LANGINFO_H
char *codeset;
codeset = nl_langinfo(CODESET);
- return (*conv)(codeset);
+ return rb_usascii_str_new2(codeset);
#else
- return ENCINDEX_US_ASCII;
+ return Qnil;
#endif
}
-/*
- * call-seq:
- * Encoding.locale_charmap -> string
- *
- * Returns the locale charmap name.
- * It returns nil if no appropriate information.
- *
- * Debian GNU/Linux
- * LANG=C
- * Encoding.locale_charmap #=> "ANSI_X3.4-1968"
- * LANG=ja_JP.EUC-JP
- * Encoding.locale_charmap #=> "EUC-JP"
- *
- * SunOS 5
- * LANG=C
- * Encoding.locale_charmap #=> "646"
- * LANG=ja
- * Encoding.locale_charmap #=> "eucJP"
- *
- * The result is highly platform dependent.
- * So Encoding.find(Encoding.locale_charmap) may cause an error.
- * If you need some encoding object even for unknown locale,
- * Encoding.find("locale") can be used.
- *
- */
-VALUE
-rb_locale_charmap(VALUE klass)
-{
- return locale_charmap(rb_usascii_str_new_cstr);
-}
-
-static VALUE
-enc_find_index(const char *name)
-{
- return (VALUE)rb_enc_find_index(name);
-}
-
-int
-rb_locale_charmap_index(void)
-{
- return (int)locale_charmap(enc_find_index);
-}
-
int
Init_enc_set_filesystem_encoding(void)
{
@@ -101,8 +54,8 @@ Init_enc_set_filesystem_encoding(void)
#if defined NO_LOCALE_CHARMAP
# error NO_LOCALE_CHARMAP defined
#elif defined _WIN32 || defined __CYGWIN__
- char cp[SIZEOF_CP_NAME];
- CP_FORMAT(cp, AreFileApisANSI() ? GetACP() : GetOEMCP());
+ char cp[sizeof(int) * 8 / 3 + 4];
+ snprintf(cp, sizeof cp, "CP%d", AreFileApisANSI() ? GetACP() : GetOEMCP());
idx = rb_enc_find_index(cp);
if (idx < 0) idx = ENCINDEX_ASCII;
#else
diff --git a/man/erb.1 b/man/erb.1
index 05d8f5634b..8c47e581d3 100644
--- a/man/erb.1
+++ b/man/erb.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd November 15, 2012
+.Dd November 7, 2012
.Dt ERB(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
diff --git a/man/goruby.1 b/man/goruby.1
index 857874f070..62a7bad23f 100644
--- a/man/goruby.1
+++ b/man/goruby.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd November 15, 2012
+.Dd November 7, 2012
.Dt GORUBY(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
diff --git a/man/irb.1 b/man/irb.1
index 269d2517b0..543217e099 100644
--- a/man/irb.1
+++ b/man/irb.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd November 15, 2012
+.Dd November 7, 2012
.Dt IRB(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
@@ -119,7 +119,7 @@ Sets internal debug level to n (not for popular use)
.El
.Pp
.Sh ENVIRONMENT
-.Bl -tag -compact
+.Bl -tag -width "RUBYLIB_PREFIX" -compact
.It Ev IRBRC
.Pp
.El
@@ -130,7 +130,7 @@ depends on same variables as
.Xr ruby 1 .
.Pp
.Sh FILES
-.Bl -tag -compact
+.Bl -tag -width "RUBYLIB_PREFIX" -compact
.It Pa ~/.irbrc
Personal irb initialization.
.Pp
diff --git a/man/rake.1 b/man/rake.1
new file mode 100644
index 0000000000..265112fca5
--- /dev/null
+++ b/man/rake.1
@@ -0,0 +1,205 @@
+.Dd November 7, 2012
+.Dt RAKE(1) "" "Ruby Programmers Reference Guide"
+.Os UNIX
+.Sh NAME
+.Nm rake
+.Nd Ruby Make
+.Sh SYNOPSIS
+.Nm
+.Op Fl -f Ar Rakefile
+.Op Fl -version
+.Op Fl CGNPgnqstv
+.Op Fl D Op Ar PATTERN
+.Op Fl E Ar CODE
+.Op Fl I Ar LIBDIR
+.Op Fl R Ar RAKELIBDIR
+.Op Fl T Op Ar PATTERN
+.Op Fl e Ar CODE
+.Op Fl p Ar CODE
+.Op Fl r Ar MODULE
+.Op Fl -rules
+.Op Ar variable Ns = Ns Ar value
+.Ar target ...
+.Sh DESCRIPTION
+.Nm Rake
+is a simple
+.Xr ruby 1
+build program with capabilities similar to the regular
+.Xr make 1
+command.
+.Pp
+.Nm Rake
+has the following features:
+.Bl -bullet
+.It
+Rakefiles (Rake's version of Makefiles) are completely defined in standard Ruby syntax.
+No XML files to edit. No quirky Makefile syntax to worry about (is that a tab or a space?).
+.It
+Users can specify tasks with prerequisites.
+.It
+Rake supports rule patterns to synthesize implicit tasks.
+.It
+Flexible FileLists that act like arrays but know about manipulating file names and paths.
+.It
+A library of prepackaged tasks to make building rakefiles easier.
+.El
+.Pp
+.Sh OPTIONS
+.Bl -tag -width "--execute-continue" -compact
+.Pp
+.It Fl -version
+Display the program version.
+.Pp
+.It Fl C
+.It Fl -classic-namespace
+Put Task and FileTask in the top level namespace
+.Pp
+.It Fl D Op Ar PATTERN
+.It Fl -describe Op Ar PATTERN
+Describe the tasks (matching optional
+.Ar PATTERN Ns
+), then exit.
+.Pp
+.It Fl E Ar CODE
+.It Fl -execute-continue Ar CODE
+Execute some Ruby code, then continue with normal task processing.
+.Pp
+.It Fl G
+.It Fl -no-system
+.It Fl -nosystem
+Use standard project Rakefile search paths, ignore system wide rakefiles.
+.Pp
+.It Fl I Ar LIBDIR
+.It Fl -libdir Ar LIBDIR
+Include
+.Ar LIBDIR
+in the search path for required modules.
+.Pp
+.It Fl N
+.It Fl -no-search
+.It Fl -nosearch
+Do not search parent directories for the Rakefile.
+.Pp
+.It Fl P
+.It Fl -prereqs
+Display the tasks and dependencies, then exit.
+.Pp
+.It Fl R Ar RAKELIBDIR
+.It Fl -rakelib Ar RAKELIBDIR
+.It Fl -rakelibdir Ar RAKELIBDIR
+Auto-import any .rake files in
+.Ar RAKELIBDIR .
+(default is
+.Pa rakelib
+)
+.Pp
+.It Fl T Op Ar PATTERN
+.It Fl -tasks Op Ar PATTERN
+Display the tasks (matching optional
+.Ar PATTERN Ns
+) with descriptions, then exit.
+.Pp
+.It Fl e Ar CODE
+.It Fl -execute Ar CODE
+Execute some Ruby code and exit.
+.Pp
+.It Fl f Ar FILE
+.It Fl -rakefile Ar FILE
+Use FILE as the rakefile.
+.Pp
+.It Fl h
+.It Fl -help
+Prints a summary of options.
+.Pp
+.It Fl g
+.It Fl -system
+Using system wide (global) rakefiles (usually
+.Pa ~/.rake/*.rake
+).
+.Pp
+.It Fl n
+.It Fl -dry-run
+Do a dry run without executing actions.
+.Pp
+.It Fl p Ar CODE
+.It Fl -execute-print Ar CODE
+Execute some Ruby code, print the result, then exit.
+.Pp
+.It Fl q
+.It Fl -quiet
+Do not log messages to standard output.
+.Pp
+.It Fl r Ar MODULE
+.It Fl -require Ar MODULE
+Require MODULE before executing rakefile.
+.Pp
+.It Fl s
+.It Fl -silent
+Like
+.Fl -quiet ,
+but also suppresses the 'in directory' announcement.
+.Pp
+.It Fl t
+.It Fl -trace
+Turn on invoke/execute tracing, enable full backtrace.
+.Pp
+.It Fl v
+.It Fl -verbose
+Log message to standard output (default).
+.Pp
+.It Fl -rules
+Trace the rules resolution.
+.Pp
+.El
+.Pp
+.Sh ENVIRONMENT
+.Bl -tag -width "RAKE_SYSTEM" -compact
+.It Ev RAKE_SYSTEM
+The directory path containing the system wide rakefiles.
+.Pp
+.It Ev RAKE_COLUMNS
+Override the number of columns used for output, such as
+.Fl Fl tasks
+.Pp
+.It Ev RAKEOPT
+Used to provide default command line arguments to Rake.
+.Pp
+.It Ev TAGS
+Generate an Emacs TAGS file
+.Pp
+.It Ev TEST
+The list of test files will be overridden to include only the filename specified on the command line.
+.Pp
+This provides an easy way to run just one test.
+.Pp
+.It Ev TESTOPTS
+.It Ev TESTOPT
+.It Ev TEST_OPTS
+.It Ev TEST_OPT
+The given options are passed to the test process after a
+.Fl Fl
+.Pp
+This allows Test::Unit options to be passed to the test suite.
+.Pp
+.It Ev USERPROFILE
+.It Ev HOME
+.It Ev HOMEDRIVE
+.It Ev HOMEPATH
+The standard directory containing system wide rake files on Win 32 systems.
+
+.Sh SEE ALSO
+.Xr ruby 1
+.Xr make 1
+.Pp
+.Pa http://rake.rubyforge.org/
+.Sh REPORTING BUGS
+Bugs, features requests and other issues can be logged at
+.Aq Pa http://onestepback.org/redmine/projects/show/rake .
+.Pp
+You will need an account to before you can post issues. Register at
+.Aq Pa http://onestepback.org/redmine/account/register .
+Or you can send an email to the author.
+.Sh AUTHOR
+.Nm Rake
+is written by
+.An Jim Weirich Aq jim@weirichhouse.org
diff --git a/man/ri.1 b/man/ri.1
index bf4efb1ac3..cadf4b8e16 100644
--- a/man/ri.1
+++ b/man/ri.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd July 10, 2013
+.Dd November 7, 2012
.Dt RI(1) "" "Ruby Programmers Reference Guide"
.Os UNIX
.Sh NAME
diff --git a/man/ruby.1 b/man/ruby.1
index e63521c6d8..0a9ba58df1 100644
--- a/man/ruby.1
+++ b/man/ruby.1
@@ -1,5 +1,5 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
-.Dd October 31, 2015
+.Dd November 7, 2012
.Dt RUBY(1) "" "Ruby Programmers Reference Guide"
.\".Dt RUBY 1
.Os UNIX
@@ -14,16 +14,16 @@
.Op Fl 0 Ns Op Ar octal
.Op Fl C Ar directory
.Op Fl E Ar external Ns Op : Ns Ar internal
-.Op Fl F Ns Op Ar pattern
+.Op Fl F Ar pattern
.Op Fl I Ar directory
-.Op Fl K Ns Op Ar c
+.Op Fl K Ar c
.Op Fl T Ns Op Ar level
.Op Fl W Ns Op Ar level
.Op Fl e Ar command
.Op Fl i Ns Op Ar extension
.Op Fl r Ar library
.Op Fl x Ns Op Ar directory
-.Op Fl - Ns Bro Cm enable Ns | Ns Cm disable Brc Ns - Ns Ar FEATURE
+.Op - Ns Bro Cm enable Ns | Ns Cm disable Brc Ns - Ns Ar FEATURE
.Op Fl -dump Ns = Ns Ar target
.Op Fl -verbose
.Op Fl -
@@ -409,41 +409,19 @@ Disables (or enables) all features.
.El
.Pp
.It Fl -dump Ns = Ns Ar target
-Dump some informations.
+DO NOT USE.
.Pp
Prints the specified target.
.Ar target
can be one of;
.Bl -hang -offset indent
-.It Sy version
-version description same as
-.Fl -version
-.It Sy usage
-brief usage message same as
-.Fl h
-.It Sy help
-Show long help message same as
-.Fl -help
-.It Sy syntax
-check of syntax same as
-.Fl c
-.Fl -yydebug
-.It Sy yydebug
-compiler debug mode, same as
-.Fl -yydebug
-.Pp
-Only specify this switch if you are going to debug the Ruby interpreter.
-.It Sy parsetree
-.It Sy parsetree_with_comment
-AST nodes tree
-.Pp
-Only specify this switch if you are going to debug the Ruby interpreter.
.It Sy insns
disassembled instructions
.Pp
-Only specify this switch if you are going to debug the Ruby interpreter.
.El
.Pp
+Only specify this switch if you are going to debug the Ruby interpreter.
+.Pp
.It Fl -verbose
Enables verbose mode without printing version message at the
beginning. It sets the
@@ -454,7 +432,7 @@ after printing its version.
.El
.Pp
.Sh ENVIRONMENT
-.Bl -tag -width "RUBYSHELL" -compact
+.Bl -tag -width "RUBYLIB_PREFIX" -compact
.It Ev RUBYLIB
A colon-separated list of directories that are added to Ruby's
library load path
@@ -494,140 +472,29 @@ variable is not defined, Ruby refers to
Ruby refers to the
.Ev PATH
environment variable on calling Kernel#system.
+.Pp
+.It Ev RUBYLIB_PREFIX
+This variable is obsolete.
.El
.Pp
And Ruby depends on some RubyGems related environment variables unless RubyGems is disabled.
See the help of
.Xr gem 1
-as below.
+as bellow.
.Bd -literal -offset indent
% gem help
.Ed
.Pp
-.Sh GC ENVIRONMENT
-The Ruby garbage collector (GC) tracks objects in fixed-sized slots,
-but each object may have auxiliary memory allocations handled by the
-malloc family of C standard library calls (
-.Xr malloc 3 ,
-.Xr calloc 3 ,
-and
-.Xr realloc 3 ) .
-In this documentatation, the "heap" refers to the Ruby object heap
-of fixed-sized slots, while "malloc" refers to auxiliary
-allocations commonly referred to as the "process heap".
-Thus there are at least two possible ways to trigger GC:
-.Bl -hang -offset indent
-.It Sy 1
-Reaching the object limit.
-.It Sy 2
-Reaching the malloc limit.
-.Pp
-.El
-In Ruby 2.1, the generational GC was introduced and the limits are divided
-into young and old generations, providing two additional ways to trigger
-a GC:
-.Bl -hang -offset indent
-.It Sy 3
-Reaching the old object limit.
-.It Sy 4
-Reaching the old malloc limit.
-.El
-.Pp
-There are currently 4 possible areas where the GC may be tuned by
-the the following 11 environment variables:
-.Bl -hang -compact -width "RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR"
-.It Ev RUBY_GC_HEAP_INIT_SLOTS
-Initial allocation slots. Introduced in Ruby 2.1, default: 10000.
-.Pp
-.It Ev RUBY_GC_HEAP_FREE_SLOTS
-Prepare at least this amount of slots after GC.
-Allocate this number slots if there are not enough slots.
-Introduced in Ruby 2.1, default: 4096
-.Pp
-.It Ev RUBY_GC_HEAP_GROWTH_FACTOR
-Increase allocation rate of heap slots by this factor.
-Introduced in Ruby 2.1, default: 1.8, minimum: 1.0 (no growth)
-.Pp
-.It Ev RUBY_GC_HEAP_GROWTH_MAX_SLOTS
-Allocation rate is limited to this number of slots,
-preventing excessive allocation due to RUBY_GC_HEAP_GROWTH_FACTOR.
-Introduced in Ruby 2.1, default: 0 (no limit)
-.Pp
-.It Ev RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR
-Perform a full GC when the number of old objects is more than R * N,
-where R is this factor and N is the number of old objects after the
-last full GC.
-Introduced in Ruby 2.1.1, default: 2.0
-.Pp
-.It Ev RUBY_GC_MALLOC_LIMIT
-The initial limit of young generation allocation from the malloc-family.
-GC will start when this limit is reached.
-Default: 16MB
-.Pp
-.It Ev RUBY_GC_MALLOC_LIMIT_MAX
-The maximum limit of young generation allocation from malloc before GC starts.
-Prevents excessive malloc growth due to RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.
-Introduced in Ruby 2.1, default: 32MB.
-.Pp
-.It Ev RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
-Increases the limit of young generation malloc calls, reducing
-GC frequency but increasing malloc growth until RUBY_GC_MALLOC_LIMIT_MAX
-is reached.
-Introduced in Ruby 2.1, default: 1.4, minimum: 1.0 (no growth)
-.Pp
-.It Ev RUBY_GC_OLDMALLOC_LIMIT
-The initial limit of old generation allocation from malloc,
-a full GC will start when this limit is reached.
-Introduced in Ruby 2.1, default: 16MB
-.Pp
-.It Ev RUBY_GC_OLDMALLOC_LIMIT_MAX
-The maximum limit of old generation allocation from malloc before a
-full GC starts.
-Prevents excessive malloc growth due to RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR.
-Introduced in Ruby 2.1, default: 128MB
-.Pp
-.It Ev RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
-Increases the limit of old generation malloc allocation, reducing full
-GC frequency but increasing malloc growth until RUBY_GC_OLDMALLOC_LIMIT_MAX
-is reached.
-Introduced in Ruby 2.1, default: 1.2, minimum: 1.0 (no growth)
-.Pp
-.El
-.Sh STACK SIZE ENVIRONMENT
-Stack size environment variables are implementation-dependent and
-subject to change with different versions of Ruby. The VM stack is used
-for pure-Ruby code and managed by the virtual machine. Machine stack is
-used by the operating system and its usage is dependent on C extensions
-as well as C compiler options. Using lower values for these may allow
-applications to keep more Fibers or Threads running; but increases the
-chance of SystemStackError exceptions and segmentation faults (SIGSEGV).
-These environment variables are available since Ruby 2.0.0.
-All values are specified in bytes.
-.Pp
-.Bl -hang -compact -width "RUBY_THREAD_MACHINE_STACK_SIZE"
-.It Ev RUBY_THREAD_VM_STACK_SIZE
-VM stack size used at thread creation.
-default: 131072 (32-bit CPU) or 262144 (64-bit)
-.Pp
-.It Ev RUBY_THREAD_MACHINE_STACK_SIZE
-Machine stack size used at thread creation.
-default: 524288 or 1048575
-.Pp
-.It Ev RUBY_FIBER_VM_STACK_SIZE
-VM stack size used at fiber creation.
-default: 65536 or 131072
-.Pp
-.It Ev RUBY_FIBER_MACHINE_STACK_SIZE
-Machine stack size used at fiber creation.
-default: 262144 or 524288
-.Pp
-.El
.Sh SEE ALSO
.Bl -hang -compact -width "http://www.ruby-lang.org/123"
-.It https://www.ruby-lang.org/
+.It http://www.ruby-lang.org
The official web site.
-.It https://www.ruby-toolbox.com/
-Comprehensive catalog of Ruby libraries.
+.It http://www.rubyforge.org
+hosting many open source ruby projects.
+.It http://raa.ruby-lang.org
+Ruby Application Archive.
+.It https://github.com/languages/Ruby
+Ruby projects on Github.
.El
.Pp
.Sh REPORTING BUGS
@@ -638,7 +505,7 @@ Comprehensive catalog of Ruby libraries.
Reported problems will be published after they've been fixed.
.Pp
.Li And you can report other bugs and feature requests via the
-Ruby Issue Tracking System (https://bugs.ruby-lang.org/).
+Ruby Issue Tracking System (http://bugs.ruby-lang.org).
Do not report security vulnerabilities
via the system because it publishes the vulnerabilities immediately.
.El
@@ -647,5 +514,5 @@ Ruby is designed and implemented by
.An Yukihiro Matsumoto Aq matz@netlab.jp .
.Pp
See
-.Aq Pa https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors
+.Aq Pa http://bugs.ruby-lang.org/wiki/ruby/Contributors
for contributors to Ruby.
diff --git a/marshal.c b/marshal.c
index adaec35826..c1b6a79752 100644
--- a/marshal.c
+++ b/marshal.c
@@ -9,16 +9,12 @@
**********************************************************************/
-#if defined __GNUC__ && __GNUC__ < 3
-# error too old GCC
-#endif
-
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/st.h"
#include "ruby/util.h"
-#include "encindex.h"
-#include "id_table.h"
+#include "ruby/encoding.h"
+#include "internal.h"
#include <math.h>
#ifdef HAVE_FLOAT_H
@@ -32,11 +28,11 @@
#define SHORTMASK ((1<<BITSPERSHORT)-1)
#define SHORTDN(x) RSHIFT((x),BITSPERSHORT)
-#if SIZEOF_SHORT == SIZEOF_BDIGIT
+#if SIZEOF_SHORT == SIZEOF_BDIGITS
#define SHORTLEN(x) (x)
#else
-static size_t
-shortlen(size_t len, BDIGIT *ds)
+static long
+shortlen(long len, BDIGIT *ds)
{
BDIGIT num;
int offset = 0;
@@ -46,7 +42,7 @@ shortlen(size_t len, BDIGIT *ds)
num = SHORTDN(num);
offset++;
}
- return (len - 1)*SIZEOF_BDIGIT/2 + offset;
+ return (len - 1)*SIZEOF_BDIGITS/2 + offset;
}
#define SHORTLEN(x) shortlen((x),d)
#endif
@@ -87,19 +83,6 @@ static ID s_dump, s_load, s_mdump, s_mload;
static ID s_dump_data, s_load_data, s_alloc, s_call;
static ID s_getbyte, s_read, s_write, s_binmode;
-#define name_s_dump "_dump"
-#define name_s_load "_load"
-#define name_s_mdump "marshal_dump"
-#define name_s_mload "marshal_load"
-#define name_s_dump_data "_dump_data"
-#define name_s_load_data "_load_data"
-#define name_s_alloc "_alloc"
-#define name_s_call "call"
-#define name_s_getbyte "getbyte"
-#define name_s_read "read"
-#define name_s_write "write"
-#define name_s_binmode "binmode"
-
typedef struct {
VALUE newclass;
VALUE oldclass;
@@ -109,8 +92,6 @@ typedef struct {
static st_table *compat_allocator_tbl;
static VALUE compat_allocator_tbl_wrapper;
-static VALUE rb_marshal_dump_limited(VALUE obj, VALUE port, int limit);
-static VALUE rb_marshal_load_with_proc(VALUE port, VALUE proc);
static int
mark_marshal_compat_i(st_data_t key, st_data_t value)
@@ -128,8 +109,6 @@ mark_marshal_compat_t(void *tbl)
st_foreach(tbl, mark_marshal_compat_i, 0);
}
-static st_table *compat_allocator_table(void);
-
void
rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE))
{
@@ -148,11 +127,11 @@ rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE),
compat->dumper = dumper;
compat->loader = loader;
- st_insert(compat_allocator_table(), (st_data_t)allocator, (st_data_t)compat);
+ st_insert(compat_allocator_tbl, (st_data_t)allocator, (st_data_t)compat);
}
#define MARSHAL_INFECTION FL_TAINT
-STATIC_ASSERT(marshal_infection_is_int, MARSHAL_INFECTION == (int)MARSHAL_INFECTION);
+typedef char ruby_check_marshal_viral_flags[MARSHAL_INFECTION == (int)MARSHAL_INFECTION ? 1 : -1];
struct dump_arg {
VALUE str, dest;
@@ -169,34 +148,15 @@ struct dump_call_arg {
int limit;
};
-static VALUE
-check_dump_arg(VALUE ret, struct dump_arg *arg, const char *name)
+static void
+check_dump_arg(struct dump_arg *arg, ID sym)
{
if (!arg->symbols) {
rb_raise(rb_eRuntimeError, "Marshal.dump reentered at %s",
- name);
+ rb_id2name(sym));
}
- return ret;
}
-static VALUE
-check_userdump_arg(VALUE obj, ID sym, int argc, const VALUE *argv,
- struct dump_arg *arg, const char *name)
-{
- VALUE ret = rb_funcallv(obj, sym, argc, argv);
- VALUE klass = CLASS_OF(obj);
- if (CLASS_OF(ret) == klass) {
- rb_raise(rb_eRuntimeError, "%"PRIsVALUE"#%s returned same class instance",
- klass, name);
- }
- return check_dump_arg(ret, arg, name);
-}
-
-#define dump_funcall(arg, obj, sym, argc, argv) \
- check_userdump_arg(obj, sym, argc, argv, arg, name_##sym)
-#define dump_check_funcall(arg, obj, sym, argc, argv) \
- check_dump_arg(rb_check_funcall(obj, sym, argc, argv), arg, name_##sym)
-
static void clear_dump_arg(struct dump_arg *arg);
static void
@@ -205,7 +165,6 @@ mark_dump_arg(void *ptr)
struct dump_arg *p = ptr;
if (!p->symbols)
return;
- rb_mark_set(p->symbols);
rb_mark_set(p->data);
rb_mark_hash(p->compat_tbl);
rb_gc_mark(p->str);
@@ -221,47 +180,46 @@ free_dump_arg(void *ptr)
static size_t
memsize_dump_arg(const void *ptr)
{
- return sizeof(struct dump_arg);
+ return ptr ? sizeof(struct dump_arg) : 0;
}
static const rb_data_type_t dump_arg_data = {
"dump_arg",
{mark_dump_arg, free_dump_arg, memsize_dump_arg,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
-static VALUE
+static const char *
must_not_be_anonymous(const char *type, VALUE path)
{
char *n = RSTRING_PTR(path);
if (!rb_enc_asciicompat(rb_enc_get(path))) {
/* cannot occur? */
- rb_raise(rb_eTypeError, "can't dump non-ascii %s name % "PRIsVALUE,
- type, path);
+ rb_raise(rb_eTypeError, "can't dump non-ascii %s name", type);
}
if (n[0] == '#') {
- rb_raise(rb_eTypeError, "can't dump anonymous %s % "PRIsVALUE,
- type, path);
+ rb_raise(rb_eTypeError, "can't dump anonymous %s %.*s", type,
+ (int)RSTRING_LEN(path), n);
}
- return path;
+ return n;
}
static VALUE
class2path(VALUE klass)
{
VALUE path = rb_class_path(klass);
+ const char *n;
- must_not_be_anonymous((RB_TYPE_P(klass, T_CLASS) ? "class" : "module"), path);
+ n = must_not_be_anonymous((RB_TYPE_P(klass, T_CLASS) ? "class" : "module"), path);
if (rb_path_to_class(path) != rb_class_real(klass)) {
- rb_raise(rb_eTypeError, "% "PRIsVALUE" can't be referred to", path);
+ rb_raise(rb_eTypeError, "%s can't be referred to", n);
}
return path;
}
static void w_long(long, struct dump_arg*);
-static void w_encoding(VALUE encname, struct dump_call_arg *arg);
-static VALUE encoding_name(VALUE obj, struct dump_arg *arg);
+static void w_encoding(VALUE obj, long num, struct dump_call_arg *arg);
static void
w_nbyte(const char *s, long n, struct dump_arg *arg)
@@ -301,7 +259,7 @@ static void
w_long(long x, struct dump_arg *arg)
{
char buf[sizeof(long)+1];
- int i;
+ int i, len = 0;
#if SIZEOF_LONG > 4
if (!(RSHIFT(x, 31) == 0 || RSHIFT(x, 31) == -1)) {
@@ -334,7 +292,10 @@ w_long(long x, struct dump_arg *arg)
break;
}
}
- w_nbyte(buf, i+1, arg);
+ len = i;
+ for (i=0;i<=len;i++) {
+ w_byte(buf[i], arg);
+ }
}
#ifdef DBL_MANT_DIG
@@ -394,6 +355,7 @@ load_mantissa(double d, const char *buf, long len)
static void
w_float(double d, struct dump_arg *arg)
{
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
char buf[FLOAT_DIG + (DECIMAL_MANT + 7) / 8 + 10];
if (isinf(d)) {
@@ -444,38 +406,37 @@ w_float(double d, struct dump_arg *arg)
}
static void
-w_symbol(VALUE sym, struct dump_arg *arg)
+w_symbol(ID id, struct dump_arg *arg)
{
+ VALUE sym;
st_data_t num;
- VALUE encname;
+ int encidx = -1;
- if (st_lookup(arg->symbols, sym, &num)) {
+ if (st_lookup(arg->symbols, id, &num)) {
w_byte(TYPE_SYMLINK, arg);
w_long((long)num, arg);
}
else {
- const VALUE orig_sym = sym;
- sym = rb_sym2str(sym);
+ sym = rb_id2str(id);
if (!sym) {
- rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, sym);
+ rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, id);
}
- encname = encoding_name(sym, arg);
- if (NIL_P(encname) ||
+ encidx = rb_enc_get_index(sym);
+ if (encidx == rb_usascii_encindex() ||
rb_enc_str_coderange(sym) == ENC_CODERANGE_7BIT) {
- encname = Qnil;
+ encidx = -1;
}
else {
w_byte(TYPE_IVAR, arg);
}
w_byte(TYPE_SYMBOL, arg);
w_bytes(RSTRING_PTR(sym), RSTRING_LEN(sym), arg);
- st_add_direct(arg->symbols, orig_sym, arg->symbols->num_entries);
- if (!NIL_P(encname)) {
+ st_add_direct(arg->symbols, id, arg->symbols->num_entries);
+ if (encidx != -1) {
struct dump_call_arg c_arg;
c_arg.limit = 1;
c_arg.arg = arg;
- w_long(1L, arg);
- w_encoding(encname, &c_arg);
+ w_encoding(sym, 0, &c_arg);
}
}
}
@@ -484,7 +445,7 @@ static void
w_unique(VALUE s, struct dump_arg *arg)
{
must_not_be_anonymous("class", s);
- w_symbol(rb_str_intern(s), arg);
+ w_symbol(rb_intern_str(s), arg);
}
static void w_object(VALUE,struct dump_arg*,int);
@@ -498,7 +459,7 @@ hash_each(VALUE key, VALUE value, struct dump_call_arg *arg)
}
#define SINGLETON_DUMP_UNABLE_P(klass) \
- (rb_id_table_size(RCLASS_M_TBL(klass)) > 0 || \
+ (RCLASS_M_TBL(klass)->num_entries || \
(RCLASS_IV_TBL(klass) && RCLASS_IV_TBL(klass)->num_entries > 1))
static void
@@ -527,8 +488,7 @@ w_class(char type, VALUE obj, struct dump_arg *arg, int check)
st_data_t real_obj;
VALUE klass;
- if (arg->compat_tbl &&
- st_lookup(arg->compat_tbl, (st_data_t)obj, &real_obj)) {
+ if (st_lookup(arg->compat_tbl, (st_data_t)obj, &real_obj)) {
obj = (VALUE)real_obj;
}
klass = CLASS_OF(obj);
@@ -551,8 +511,6 @@ w_uclass(VALUE obj, VALUE super, struct dump_arg *arg)
}
}
-#define to_be_skipped_id(id) (id == rb_id_encoding() || id == rb_intern("E") || !rb_id2str(id))
-
static int
w_obj_each(st_data_t key, st_data_t val, st_data_t a)
{
@@ -560,101 +518,75 @@ w_obj_each(st_data_t key, st_data_t val, st_data_t a)
VALUE value = (VALUE)val;
struct dump_call_arg *arg = (struct dump_call_arg *)a;
- if (to_be_skipped_id(id)) return ST_CONTINUE;
- w_symbol(ID2SYM(id), arg->arg);
+ if (id == rb_id_encoding()) return ST_CONTINUE;
+ if (id == rb_intern("E")) return ST_CONTINUE;
+ w_symbol(id, arg->arg);
w_object(value, arg->arg, arg->limit);
return ST_CONTINUE;
}
-static int
-obj_count_ivars(st_data_t key, st_data_t val, st_data_t a)
-{
- ID id = (ID)key;
- if (!to_be_skipped_id(id)) ++*(st_index_t *)a;
- return ST_CONTINUE;
-}
-
-static VALUE
-encoding_name(VALUE obj, struct dump_arg *arg)
+static void
+w_encoding(VALUE obj, long num, struct dump_call_arg *arg)
{
int encidx = rb_enc_get_index(obj);
rb_encoding *enc = 0;
st_data_t name;
if (encidx <= 0 || !(enc = rb_enc_from_index(encidx))) {
- return Qnil;
+ w_long(num, arg->arg);
+ return;
}
+ w_long(num + 1, arg->arg);
/* special treatment for US-ASCII and UTF-8 */
if (encidx == rb_usascii_encindex()) {
- return Qfalse;
+ w_symbol(rb_intern("E"), arg->arg);
+ w_object(Qfalse, arg->arg, arg->limit + 1);
+ return;
}
else if (encidx == rb_utf8_encindex()) {
- return Qtrue;
- }
-
- if (arg->encodings ?
- !st_lookup(arg->encodings, (st_data_t)rb_enc_name(enc), &name) :
- (arg->encodings = st_init_strcasetable(), 1)) {
- name = (st_data_t)rb_str_new_cstr(rb_enc_name(enc));
- st_insert(arg->encodings, (st_data_t)rb_enc_name(enc), name);
- }
- return (VALUE)name;
-}
-
-static void
-w_encoding(VALUE encname, struct dump_call_arg *arg)
-{
- switch (encname) {
- case Qfalse:
- case Qtrue:
- w_symbol(ID2SYM(rb_intern("E")), arg->arg);
- w_object(encname, arg->arg, arg->limit + 1);
- case Qnil:
+ w_symbol(rb_intern("E"), arg->arg);
+ w_object(Qtrue, arg->arg, arg->limit + 1);
return;
}
- w_symbol(ID2SYM(rb_id_encoding()), arg->arg);
- w_object(encname, arg->arg, arg->limit + 1);
-}
-
-static st_index_t
-has_ivars(VALUE obj, VALUE encname, VALUE *ivobj)
-{
- st_index_t enc = !NIL_P(encname);
- st_index_t num = 0;
-
- if (SPECIAL_CONST_P(obj)) goto generic;
- switch (BUILTIN_TYPE(obj)) {
- case T_OBJECT:
- case T_CLASS:
- case T_MODULE:
- break; /* counted elsewhere */
- default:
- generic:
- rb_ivar_foreach(obj, obj_count_ivars, (st_data_t)&num);
- if (num) *ivobj = obj;
- }
- return num + enc;
+ w_symbol(rb_id_encoding(), arg->arg);
+ do {
+ if (!arg->arg->encodings)
+ arg->arg->encodings = st_init_strcasetable();
+ else if (st_lookup(arg->arg->encodings, (st_data_t)rb_enc_name(enc), &name))
+ break;
+ name = (st_data_t)rb_str_new2(rb_enc_name(enc));
+ st_insert(arg->arg->encodings, (st_data_t)rb_enc_name(enc), name);
+ } while (0);
+ w_object(name, arg->arg, arg->limit + 1);
}
static void
-w_ivar(st_index_t num, VALUE ivobj, VALUE encname, struct dump_call_arg *arg)
+w_ivar(VALUE obj, st_table *tbl, struct dump_call_arg *arg)
{
- w_long(num, arg->arg);
- w_encoding(encname, arg);
- if (ivobj != Qundef) {
- rb_ivar_foreach(ivobj, w_obj_each, (st_data_t)arg);
+ long num = tbl ? tbl->num_entries : 0;
+
+ w_encoding(obj, num, arg);
+ if (tbl) {
+ st_foreach_safe(tbl, w_obj_each, (st_data_t)arg);
}
}
static void
w_objivar(VALUE obj, struct dump_call_arg *arg)
{
- st_data_t num = 0;
+ VALUE *ptr;
+ long i, len, num;
+
+ len = ROBJECT_NUMIV(obj);
+ ptr = ROBJECT_IVPTR(obj);
+ num = 0;
+ for (i = 0; i < len; i++)
+ if (ptr[i] != Qundef)
+ num += 1;
- rb_ivar_foreach(obj, obj_count_ivars, (st_data_t)&num);
- w_long(num, arg->arg);
+ w_encoding(obj, num, arg);
if (num != 0) {
rb_ivar_foreach(obj, w_obj_each, (st_data_t)arg);
}
@@ -664,10 +596,11 @@ static void
w_object(VALUE obj, struct dump_arg *arg, int limit)
{
struct dump_call_arg c_arg;
- VALUE ivobj = Qundef;
+ st_table *ivtbl = 0;
st_data_t num;
- st_index_t hasiv = 0;
- VALUE encname = Qnil;
+ int hasiv = 0;
+#define has_ivars(obj, ivtbl) ((((ivtbl) = rb_generic_ivar_table(obj)) != 0) || \
+ (!SPECIAL_CONST_P(obj) && !ENCODING_IS_ASCII8BIT(obj)))
if (limit == 0) {
rb_raise(rb_eArgError, "exceed depth limit");
@@ -707,7 +640,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
#endif
}
else if (SYMBOL_P(obj)) {
- w_symbol(obj, arg);
+ w_symbol(SYM2ID(obj), arg);
}
else if (FLONUM_P(obj)) {
st_add_direct(arg->data, obj, arg->data->num_entries);
@@ -717,43 +650,39 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
else {
VALUE v;
- if (!RBASIC_CLASS(obj)) {
- rb_raise(rb_eTypeError, "can't dump internal %s",
- rb_builtin_type_name(BUILTIN_TYPE(obj)));
- }
-
arg->infection |= (int)FL_TEST(obj, MARSHAL_INFECTION);
if (rb_obj_respond_to(obj, s_mdump, TRUE)) {
st_add_direct(arg->data, obj, arg->data->num_entries);
- v = dump_funcall(arg, obj, s_mdump, 0, 0);
+ v = rb_funcall2(obj, s_mdump, 0, 0);
+ check_dump_arg(arg, s_mdump);
w_class(TYPE_USRMARSHAL, obj, arg, FALSE);
w_object(v, arg, limit);
return;
}
if (rb_obj_respond_to(obj, s_dump, TRUE)) {
- VALUE ivobj2 = Qundef;
- st_index_t hasiv2;
- VALUE encname2;
+ st_table *ivtbl2 = 0;
+ int hasiv2;
v = INT2NUM(limit);
- v = dump_funcall(arg, obj, s_dump, 1, &v);
+ v = rb_funcall2(obj, s_dump, 1, &v);
+ check_dump_arg(arg, s_dump);
if (!RB_TYPE_P(v, T_STRING)) {
rb_raise(rb_eTypeError, "_dump() must return string");
}
- hasiv = has_ivars(obj, (encname = encoding_name(obj, arg)), &ivobj);
- hasiv2 = has_ivars(v, (encname2 = encoding_name(v, arg)), &ivobj2);
- if (hasiv2) {
- hasiv = hasiv2;
- ivobj = ivobj2;
- encname = encname2;
- }
+ hasiv = has_ivars(obj, ivtbl);
if (hasiv) w_byte(TYPE_IVAR, arg);
+ if ((hasiv2 = has_ivars(v, ivtbl2)) != 0 && !hasiv) {
+ w_byte(TYPE_IVAR, arg);
+ }
w_class(TYPE_USERDEF, obj, arg, FALSE);
w_bytes(RSTRING_PTR(v), RSTRING_LEN(v), arg);
- if (hasiv) {
- w_ivar(hasiv, ivobj, encname, &c_arg);
+ if (hasiv2) {
+ w_ivar(v, ivtbl2, &c_arg);
+ }
+ else if (hasiv) {
+ w_ivar(obj, ivtbl, &c_arg);
}
st_add_direct(arg->data, obj, arg->data->num_entries);
return;
@@ -761,7 +690,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
st_add_direct(arg->data, obj, arg->data->num_entries);
- hasiv = has_ivars(obj, (encname = encoding_name(obj, arg)), &ivobj);
+ hasiv = has_ivars(obj, ivtbl);
{
st_data_t compat_data;
rb_alloc_func_t allocator = rb_get_alloc_func(RBASIC(obj)->klass);
@@ -771,11 +700,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
marshal_compat_t *compat = (marshal_compat_t*)compat_data;
VALUE real_obj = obj;
obj = compat->dumper(real_obj);
- if (!arg->compat_tbl) {
- arg->compat_tbl = rb_init_identtable();
- }
st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
- if (obj != real_obj && ivobj == Qundef) hasiv = 0;
+ if (obj != real_obj && !ivtbl) hasiv = 0;
}
}
if (hasiv) w_byte(TYPE_IVAR, arg);
@@ -810,24 +736,18 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
case T_BIGNUM:
w_byte(TYPE_BIGNUM, arg);
{
- char sign = BIGNUM_SIGN(obj) ? '+' : '-';
- size_t len = BIGNUM_LEN(obj);
- size_t slen;
- BDIGIT *d = BIGNUM_DIGITS(obj);
-
- slen = SHORTLEN(len);
- if (LONG_MAX < slen) {
- rb_raise(rb_eTypeError, "too big Bignum can't be dumped");
- }
+ char sign = RBIGNUM_SIGN(obj) ? '+' : '-';
+ long len = RBIGNUM_LEN(obj);
+ BDIGIT *d = RBIGNUM_DIGITS(obj);
w_byte(sign, arg);
- w_long((long)slen, arg);
+ w_long(SHORTLEN(len), arg); /* w_short? */
while (len--) {
-#if SIZEOF_BDIGIT > SIZEOF_SHORT
+#if SIZEOF_BDIGITS > SIZEOF_SHORT
BDIGIT num = *d;
int i;
- for (i=0; i<SIZEOF_BDIGIT; i+=SIZEOF_SHORT) {
+ for (i=0; i<SIZEOF_BDIGITS; i+=SIZEOF_SHORT) {
w_short(num & SHORTMASK, arg);
num = SHORTDN(num);
if (len == 0 && num == 0) break;
@@ -877,7 +797,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
if (NIL_P(RHASH_IFNONE(obj))) {
w_byte(TYPE_HASH, arg);
}
- else if (FL_TEST(obj, HASH_PROC_DEFAULT)) {
+ else if (FL_TEST(obj, FL_USER2)) {
+ /* FL_USER2 means HASH_PROC_DEFAULT (see hash.c) */
rb_raise(rb_eTypeError, "can't dump hash with default proc");
}
else {
@@ -900,7 +821,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
w_long(len, arg);
mem = rb_struct_members(obj);
for (i=0; i<len; i++) {
- w_symbol(RARRAY_AREF(mem, i), arg);
+ w_symbol(SYM2ID(RARRAY_AREF(mem, i)), arg);
w_object(RSTRUCT_GET(obj, i), arg, limit);
}
}
@@ -917,24 +838,25 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
if (!rb_obj_respond_to(obj, s_dump_data, TRUE)) {
rb_raise(rb_eTypeError,
- "no _dump_data is defined for class %"PRIsVALUE,
- rb_obj_class(obj));
+ "no _dump_data is defined for class %s",
+ rb_obj_classname(obj));
}
- v = dump_funcall(arg, obj, s_dump_data, 0, 0);
+ v = rb_funcall2(obj, s_dump_data, 0, 0);
+ check_dump_arg(arg, s_dump_data);
w_class(TYPE_DATA, obj, arg, TRUE);
w_object(v, arg, limit);
}
break;
default:
- rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE,
- rb_obj_class(obj));
+ rb_raise(rb_eTypeError, "can't dump %s",
+ rb_obj_classname(obj));
break;
}
RB_GC_GUARD(obj);
}
if (hasiv) {
- w_ivar(hasiv, ivobj, encname, &c_arg);
+ w_ivar(obj, ivtbl, &c_arg);
}
}
@@ -946,10 +868,8 @@ clear_dump_arg(struct dump_arg *arg)
arg->symbols = 0;
st_free_table(arg->data);
arg->data = 0;
- if (arg->compat_tbl) {
- st_free_table(arg->compat_tbl);
- arg->compat_tbl = 0;
- }
+ st_free_table(arg->compat_tbl);
+ arg->compat_tbl = 0;
if (arg->encodings) {
st_free_table(arg->encodings);
arg->encodings = 0;
@@ -991,17 +911,19 @@ io_needed(void)
*
* Marshal can't dump following objects:
* * anonymous Class/Module.
- * * objects which are related to system (ex: Dir, File::Stat, IO, File, Socket
+ * * objects which related to its system (ex: Dir, File::Stat, IO, File, Socket
* and so on)
* * an instance of MatchData, Data, Method, UnboundMethod, Proc, Thread,
* ThreadGroup, Continuation
- * * objects which define singleton methods
+ * * objects which defines singleton methods
*/
static VALUE
marshal_dump(int argc, VALUE *argv)
{
VALUE obj, port, a1, a2;
int limit = -1;
+ struct dump_arg *arg;
+ volatile VALUE wrapper;
port = Qnil;
rb_scan_args(argc, argv, "12", &obj, &a1, &a2);
@@ -1015,21 +937,12 @@ marshal_dump(int argc, VALUE *argv)
else if (NIL_P(a1)) io_needed();
else port = a1;
}
- return rb_marshal_dump_limited(obj, port, limit);
-}
-
-VALUE
-rb_marshal_dump_limited(VALUE obj, VALUE port, int limit)
-{
- struct dump_arg *arg;
- volatile VALUE wrapper; /* used to avoid memory leak in case of exception */
-
- wrapper = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
+ RB_GC_GUARD(wrapper) = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
arg->dest = 0;
arg->symbols = st_init_numtable();
- arg->data = rb_init_identtable();
+ arg->data = st_init_numtable();
arg->infection = 0;
- arg->compat_tbl = 0;
+ arg->compat_tbl = st_init_numtable();
arg->encodings = 0;
arg->str = rb_str_buf_new(0);
if (!NIL_P(port)) {
@@ -1037,7 +950,9 @@ rb_marshal_dump_limited(VALUE obj, VALUE port, int limit)
io_needed();
}
arg->dest = port;
- dump_check_funcall(arg, port, s_binmode, 0, 0);
+ if (rb_check_funcall(port, s_binmode, 0, 0) != Qundef) {
+ check_dump_arg(arg, s_binmode);
+ }
}
else {
port = arg->str;
@@ -1070,17 +985,14 @@ struct load_arg {
int infection;
};
-static VALUE
-check_load_arg(VALUE ret, struct load_arg *arg, const char *name)
+static void
+check_load_arg(struct load_arg *arg, ID sym)
{
if (!arg->symbols) {
rb_raise(rb_eRuntimeError, "Marshal.load reentered at %s",
- name);
+ rb_id2name(sym));
}
- return ret;
}
-#define load_funcall(arg, obj, sym, argc, argv) \
- check_load_arg(rb_funcallv(obj, sym, argc, argv), arg, name_##sym)
static void clear_load_arg(struct load_arg *arg);
@@ -1090,7 +1002,6 @@ mark_load_arg(void *ptr)
struct load_arg *p = ptr;
if (!p->symbols)
return;
- rb_mark_tbl(p->symbols);
rb_mark_tbl(p->data);
rb_mark_hash(p->compat_tbl);
}
@@ -1105,19 +1016,19 @@ free_load_arg(void *ptr)
static size_t
memsize_load_arg(const void *ptr)
{
- return sizeof(struct load_arg);
+ return ptr ? sizeof(struct load_arg) : 0;
}
static const rb_data_type_t load_arg_data = {
"load_arg",
{mark_load_arg, free_load_arg, memsize_load_arg,},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#define r_entry(v, arg) r_entry0((v), (arg)->data->num_entries, (arg))
static VALUE r_entry0(VALUE v, st_index_t num, struct load_arg *arg);
static VALUE r_object(struct load_arg *arg);
-static VALUE r_symbol(struct load_arg *arg);
+static ID r_symbol(struct load_arg *arg);
static VALUE path2class(VALUE path);
NORETURN(static void too_short(void));
@@ -1143,7 +1054,9 @@ r_byte1_buffered(struct load_arg *arg)
long readable = arg->readable < BUFSIZ ? arg->readable : BUFSIZ;
VALUE str, n = LONG2NUM(readable);
- str = load_funcall(arg, arg->src, s_read, 1, &n);
+ str = rb_funcall2(arg->src, s_read, 1, &n);
+
+ check_load_arg(arg, s_read);
if (NIL_P(str)) too_short();
StringValue(str);
arg->infection |= (int)FL_TEST(str, MARSHAL_INFECTION);
@@ -1173,7 +1086,8 @@ r_byte(struct load_arg *arg)
c = r_byte1_buffered(arg);
}
else {
- VALUE v = load_funcall(arg, arg->src, s_getbyte, 0, 0);
+ VALUE v = rb_funcall2(arg->src, s_getbyte, 0, 0);
+ check_load_arg(arg, s_getbyte);
if (NIL_P(v)) rb_eof_error();
c = (unsigned char)NUM2CHR(v);
}
@@ -1234,7 +1148,8 @@ r_bytes1(long len, struct load_arg *arg)
{
VALUE str, n = LONG2NUM(len);
- str = load_funcall(arg, arg->src, s_read, 1, &n);
+ str = rb_funcall2(arg->src, s_read, 1, &n);
+ check_load_arg(arg, s_read);
if (NIL_P(str)) too_short();
StringValue(str);
if (RSTRING_LEN(str) != len) too_short();
@@ -1262,7 +1177,9 @@ r_bytes1_buffered(long len, struct load_arg *arg)
readable = readable < BUFSIZ ? readable : BUFSIZ;
read_len = need_len > readable ? need_len : readable;
n = LONG2NUM(read_len);
- tmp = load_funcall(arg, arg->src, s_read, 1, &n);
+ tmp = rb_funcall2(arg->src, s_read, 1, &n);
+
+ check_load_arg(arg, s_read);
if (NIL_P(tmp)) too_short();
StringValue(tmp);
@@ -1317,20 +1234,13 @@ r_bytes0(long len, struct load_arg *arg)
}
static int
-sym2encidx(VALUE sym, VALUE val)
-{
- static const char name_encoding[8] = "encoding";
- const char *p;
- long l;
- if (rb_enc_get_index(sym) != ENCINDEX_US_ASCII) return -1;
- RSTRING_GETMEM(sym, p, l);
- if (l <= 0) return -1;
- if (l == sizeof(name_encoding) &&
- memcmp(p, name_encoding, sizeof(name_encoding)) == 0) {
+id2encidx(ID id, VALUE val)
+{
+ if (id == rb_id_encoding()) {
int idx = rb_enc_find_index(StringValueCStr(val));
return idx;
}
- else if (l == 1 && *p == 'E') {
+ else if (id == rb_intern("E")) {
if (val == Qfalse) return rb_usascii_encindex();
else if (val == Qtrue) return rb_utf8_encindex();
/* bogus ignore */
@@ -1338,41 +1248,42 @@ sym2encidx(VALUE sym, VALUE val)
return -1;
}
-static VALUE
+static ID
r_symlink(struct load_arg *arg)
{
- st_data_t sym;
+ st_data_t id;
long num = r_long(arg);
- if (!st_lookup(arg->symbols, num, &sym)) {
+ if (!st_lookup(arg->symbols, num, &id)) {
rb_raise(rb_eArgError, "bad symbol");
}
- return (VALUE)sym;
+ return (ID)id;
}
-static VALUE
+static ID
r_symreal(struct load_arg *arg, int ivar)
{
VALUE s = r_bytes(arg);
- VALUE sym;
+ ID id;
int idx = -1;
st_index_t n = arg->symbols->num_entries;
- if (rb_enc_str_asciionly_p(s)) rb_enc_associate_index(s, ENCINDEX_US_ASCII);
- st_insert(arg->symbols, (st_data_t)n, (st_data_t)s);
+ st_insert(arg->symbols, (st_data_t)n, (st_data_t)0);
if (ivar) {
long num = r_long(arg);
while (num-- > 0) {
- sym = r_symbol(arg);
- idx = sym2encidx(sym, r_object(arg));
+ id = r_symbol(arg);
+ idx = id2encidx(id, r_object(arg));
}
}
if (idx > 0) rb_enc_associate_index(s, idx);
+ id = rb_intern_str(s);
+ st_insert(arg->symbols, (st_data_t)n, (st_data_t)id);
- return s;
+ return id;
}
-static VALUE
+static ID
r_symbol(struct load_arg *arg)
{
int type, ivar = 0;
@@ -1397,7 +1308,7 @@ r_symbol(struct load_arg *arg)
static VALUE
r_unique(struct load_arg *arg)
{
- return r_symbol(arg);
+ return rb_id2str(r_symbol(arg));
}
static VALUE
@@ -1410,7 +1321,7 @@ static VALUE
r_entry0(VALUE v, st_index_t num, struct load_arg *arg)
{
st_data_t real_obj = (VALUE)Qundef;
- if (arg->compat_tbl && st_lookup(arg->compat_tbl, v, &real_obj)) {
+ if (st_lookup(arg->compat_tbl, v, &real_obj)) {
st_insert(arg->data, num, (st_data_t)real_obj);
}
else {
@@ -1418,9 +1329,9 @@ r_entry0(VALUE v, st_index_t num, struct load_arg *arg)
}
if (arg->infection &&
!RB_TYPE_P(v, T_CLASS) && !RB_TYPE_P(v, T_MODULE)) {
- OBJ_TAINT(v);
+ FL_SET(v, arg->infection);
if ((VALUE)real_obj != Qundef)
- OBJ_TAINT((VALUE)real_obj);
+ FL_SET((VALUE)real_obj, arg->infection);
}
return v;
}
@@ -1429,14 +1340,15 @@ static VALUE
r_fixup_compat(VALUE v, struct load_arg *arg)
{
st_data_t data;
- st_data_t key = (st_data_t)v;
- if (arg->compat_tbl && st_delete(arg->compat_tbl, &key, &data)) {
+ if (st_lookup(arg->compat_tbl, v, &data)) {
VALUE real_obj = (VALUE)data;
rb_alloc_func_t allocator = rb_get_alloc_func(CLASS_OF(real_obj));
+ st_data_t key = v;
if (st_lookup(compat_allocator_tbl, (st_data_t)allocator, &data)) {
marshal_compat_t *compat = (marshal_compat_t*)data;
compat->loader(real_obj, v);
}
+ st_delete(arg->compat_tbl, &key, 0);
v = real_obj;
}
return v;
@@ -1446,7 +1358,8 @@ static VALUE
r_post_proc(VALUE v, struct load_arg *arg)
{
if (arg->proc) {
- v = load_funcall(arg, arg->proc, s_call, 1, &v);
+ v = rb_funcall(arg->proc, s_call, 1, v);
+ check_load_arg(arg, s_call);
}
return v;
}
@@ -1485,15 +1398,15 @@ r_ivar(VALUE obj, int *has_encoding, struct load_arg *arg)
len = r_long(arg);
if (len > 0) {
do {
- VALUE sym = r_symbol(arg);
+ ID id = r_symbol(arg);
VALUE val = r_object(arg);
- int idx = sym2encidx(sym, val);
+ int idx = id2encidx(id, val);
if (idx >= 0) {
rb_enc_associate_index(obj, idx);
if (has_encoding) *has_encoding = TRUE;
}
else {
- rb_ivar_set(obj, rb_intern_str(sym), val);
+ rb_ivar_set(obj, id, val);
}
} while (--len > 0);
}
@@ -1533,10 +1446,6 @@ obj_alloc_by_klass(VALUE klass, struct load_arg *arg, VALUE *oldclass)
VALUE real_obj = rb_obj_alloc(klass);
VALUE obj = rb_obj_alloc(compat->oldclass);
if (oldclass) *oldclass = compat->oldclass;
-
- if (!arg->compat_tbl) {
- arg->compat_tbl = rb_init_identtable();
- }
st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
return obj;
}
@@ -1583,7 +1492,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
rb_raise(rb_eArgError, "dump format error (unlinked)");
}
v = (VALUE)link;
- v = r_post_proc(v, arg);
+ r_post_proc(v, arg);
break;
case TYPE_IVAR:
@@ -1599,7 +1508,6 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
{
VALUE path = r_unique(arg);
VALUE m = rb_path_to_class(path);
- if (NIL_P(extmod)) extmod = rb_ary_tmp_new(0);
if (RB_TYPE_P(m, T_CLASS)) { /* prepended */
VALUE c;
@@ -1619,6 +1527,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
}
else {
must_be_module(m, path);
+ if (NIL_P(extmod)) extmod = rb_ary_tmp_new(0);
rb_ary_push(extmod, m);
v = r_object0(arg, 0, extmod);
@@ -1759,7 +1668,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_ARRAY:
{
- long len = r_long(arg);
+ volatile long len = r_long(arg); /* gcc 2.7.2.3 -O2 bug?? */
v = rb_ary_new2(len);
v = r_entry(v, arg);
@@ -1798,33 +1707,33 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_STRUCT:
{
VALUE mem, values;
- long i;
- VALUE slot;
+ volatile long i; /* gcc 2.7.2.3 -O2 bug?? */
+ ID slot;
st_index_t idx = r_prepare(arg);
VALUE klass = path2class(r_unique(arg));
long len = r_long(arg);
v = rb_obj_alloc(klass);
if (!RB_TYPE_P(v, T_STRUCT)) {
- rb_raise(rb_eTypeError, "class %"PRIsVALUE" not a struct", rb_class_name(klass));
+ rb_raise(rb_eTypeError, "class %s not a struct", rb_class2name(klass));
}
mem = rb_struct_s_members(klass);
if (RARRAY_LEN(mem) != len) {
- rb_raise(rb_eTypeError, "struct %"PRIsVALUE" not compatible (struct size differs)",
- rb_class_name(klass));
+ rb_raise(rb_eTypeError, "struct %s not compatible (struct size differs)",
+ rb_class2name(klass));
}
arg->readable += (len - 1) * 2;
v = r_entry0(v, idx, arg);
values = rb_ary_new2(len);
for (i=0; i<len; i++) {
- VALUE n = rb_sym2str(RARRAY_AREF(mem, i));
slot = r_symbol(arg);
- if (!rb_str_equal(n, slot)) {
- rb_raise(rb_eTypeError, "struct %"PRIsVALUE" not compatible (:%"PRIsVALUE" for :%"PRIsVALUE")",
- rb_class_name(klass),
- slot, n);
+ if (RARRAY_AREF(mem, i) != ID2SYM(slot)) {
+ rb_raise(rb_eTypeError, "struct %s not compatible (:%s for :%s)",
+ rb_class2name(klass),
+ rb_id2name(slot),
+ rb_id2name(SYM2ID(RARRAY_AREF(mem, i))));
}
rb_ary_push(values, r_object(arg));
arg->readable -= 2;
@@ -1837,34 +1746,28 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_USERDEF:
{
- VALUE name = r_unique(arg);
- VALUE klass = path2class(name);
+ VALUE klass = path2class(r_unique(arg));
VALUE data;
- st_data_t d;
if (!rb_obj_respond_to(klass, s_load, TRUE)) {
- rb_raise(rb_eTypeError, "class %"PRIsVALUE" needs to have method `_load'",
- name);
+ rb_raise(rb_eTypeError, "class %s needs to have method `_load'",
+ rb_class2name(klass));
}
data = r_string(arg);
if (ivp) {
r_ivar(data, NULL, arg);
*ivp = FALSE;
}
- v = load_funcall(arg, klass, s_load, 1, &data);
+ v = rb_funcall2(klass, s_load, 1, &data);
+ check_load_arg(arg, s_load);
v = r_entry(v, arg);
- if (st_lookup(compat_allocator_tbl, (st_data_t)rb_get_alloc_func(klass), &d)) {
- marshal_compat_t *compat = (marshal_compat_t*)d;
- v = compat->loader(klass, v);
- }
- v = r_post_proc(v, arg);
+ v = r_leave(v, arg);
}
break;
case TYPE_USRMARSHAL:
{
- VALUE name = r_unique(arg);
- VALUE klass = path2class(name);
+ VALUE klass = path2class(r_unique(arg));
VALUE oldclass = 0;
VALUE data;
@@ -1874,12 +1777,13 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
append_extmod(v, extmod);
}
if (!rb_obj_respond_to(v, s_mload, TRUE)) {
- rb_raise(rb_eTypeError, "instance of %"PRIsVALUE" needs to have method `marshal_load'",
- name);
+ rb_raise(rb_eTypeError, "instance of %s needs to have method `marshal_load'",
+ rb_class2name(klass));
}
v = r_entry(v, arg);
data = r_object(arg);
- load_funcall(arg, v, s_mload, 1, &data);
+ rb_funcall2(v, s_mload, 1, &data);
+ check_load_arg(arg, s_mload);
v = r_fixup_compat(v, arg);
v = r_copy_ivar(v, data);
v = r_post_proc(v, arg);
@@ -1905,8 +1809,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_DATA:
{
- VALUE name = r_unique(arg);
- VALUE klass = path2class(name);
+ VALUE klass = path2class(r_unique(arg));
VALUE oldclass = 0;
VALUE r;
@@ -1917,11 +1820,12 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
v = r_entry(v, arg);
if (!rb_obj_respond_to(v, s_load_data, TRUE)) {
rb_raise(rb_eTypeError,
- "class %"PRIsVALUE" needs to have instance method `_load_data'",
- name);
+ "class %s needs to have instance method `_load_data'",
+ rb_class2name(klass));
}
r = r_object0(arg, 0, extmod);
- load_funcall(arg, v, s_load_data, 1, &r);
+ rb_funcall2(v, s_load_data, 1, &r);
+ check_load_arg(arg, s_load_data);
v = r_leave(v, arg);
}
break;
@@ -1961,29 +1865,23 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_SYMBOL:
if (ivp) {
- v = r_symreal(arg, *ivp);
+ v = ID2SYM(r_symreal(arg, *ivp));
*ivp = FALSE;
}
else {
- v = r_symreal(arg, 0);
+ v = ID2SYM(r_symreal(arg, 0));
}
- v = rb_str_intern(v);
v = r_leave(v, arg);
break;
case TYPE_SYMLINK:
- v = rb_str_intern(r_symlink(arg));
+ v = ID2SYM(r_symlink(arg));
break;
default:
rb_raise(rb_eArgError, "dump format error(0x%x)", type);
break;
}
-
- if (v == Qundef) {
- rb_raise(rb_eArgError, "dump format error (bad link)");
- }
-
return v;
}
@@ -2008,10 +1906,8 @@ clear_load_arg(struct load_arg *arg)
arg->symbols = 0;
st_free_table(arg->data);
arg->data = 0;
- if (arg->compat_tbl) {
- st_free_table(arg->compat_tbl);
- arg->compat_tbl = 0;
- }
+ st_free_table(arg->compat_tbl);
+ arg->compat_tbl = 0;
}
/*
@@ -2022,8 +1918,8 @@ clear_load_arg(struct load_arg *arg)
* Returns the result of converting the serialized data in source into a
* Ruby object (possibly with associated subordinate objects). source
* may be either an instance of IO or an object that responds to
- * to_str. If proc is specified, each object will be passed to the proc, as the object
- * is being deserialized.
+ * to_str. If proc is specified, it will be passed each object as it
+ * is deserialized.
*
* Never pass untrusted data (including user supplied input) to this method.
* Please see the overview for further details.
@@ -2032,21 +1928,12 @@ static VALUE
marshal_load(int argc, VALUE *argv)
{
VALUE port, proc;
-
- rb_check_arity(argc, 1, 2);
- port = argv[0];
- proc = argc > 1 ? argv[1] : Qnil;
- return rb_marshal_load_with_proc(port, proc);
-}
-
-VALUE
-rb_marshal_load_with_proc(VALUE port, VALUE proc)
-{
int major, minor, infection = 0;
VALUE v;
- volatile VALUE wrapper; /* used to avoid memory leak in case of exception */
+ volatile VALUE wrapper;
struct load_arg *arg;
+ rb_scan_args(argc, argv, "11", &port, &proc);
v = rb_check_string_type(port);
if (!NIL_P(v)) {
infection = (int)FL_TEST(port, MARSHAL_INFECTION); /* original taintedness */
@@ -2059,13 +1946,13 @@ rb_marshal_load_with_proc(VALUE port, VALUE proc)
else {
io_needed();
}
- wrapper = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
+ RB_GC_GUARD(wrapper) = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
arg->infection = infection;
arg->src = port;
arg->offset = 0;
arg->symbols = st_init_numtable();
- arg->data = rb_init_identtable();
- arg->compat_tbl = 0;
+ arg->data = st_init_numtable();
+ arg->compat_tbl = st_init_numtable();
arg->proc = 0;
arg->readable = 0;
@@ -2204,7 +2091,7 @@ rb_marshal_load_with_proc(VALUE port, VALUE proc)
* end
* end
*
- * Since Marshal.dump outputs a string you can have _dump return a Marshal
+ * Since Marhsal.dump outputs a string you can have _dump return a Marshal
* string which is Marshal.loaded in _load for complex objects.
*/
void
@@ -2214,19 +2101,19 @@ Init_marshal(void)
#define rb_intern(str) rb_intern_const(str)
VALUE rb_mMarshal = rb_define_module("Marshal");
-#define set_id(sym) sym = rb_intern_const(name_##sym)
- set_id(s_dump);
- set_id(s_load);
- set_id(s_mdump);
- set_id(s_mload);
- set_id(s_dump_data);
- set_id(s_load_data);
- set_id(s_alloc);
- set_id(s_call);
- set_id(s_getbyte);
- set_id(s_read);
- set_id(s_write);
- set_id(s_binmode);
+
+ s_dump = rb_intern("_dump");
+ s_load = rb_intern("_load");
+ s_mdump = rb_intern("marshal_dump");
+ s_mload = rb_intern("marshal_load");
+ s_dump_data = rb_intern("_dump_data");
+ s_load_data = rb_intern("_load_data");
+ s_alloc = rb_intern("_alloc");
+ s_call = rb_intern("call");
+ s_getbyte = rb_intern("getbyte");
+ s_read = rb_intern("read");
+ s_write = rb_intern("write");
+ s_binmode = rb_intern("binmode");
rb_define_module_function(rb_mMarshal, "dump", marshal_dump, -1);
rb_define_module_function(rb_mMarshal, "load", marshal_load, -1);
@@ -2236,29 +2123,27 @@ Init_marshal(void)
rb_define_const(rb_mMarshal, "MAJOR_VERSION", INT2FIX(MARSHAL_MAJOR));
/* minor version */
rb_define_const(rb_mMarshal, "MINOR_VERSION", INT2FIX(MARSHAL_MINOR));
-}
-static st_table *
-compat_allocator_table(void)
-{
- if (compat_allocator_tbl) return compat_allocator_tbl;
compat_allocator_tbl = st_init_numtable();
-#undef RUBY_UNTYPED_DATA_WARNING
-#define RUBY_UNTYPED_DATA_WARNING 0
compat_allocator_tbl_wrapper =
Data_Wrap_Struct(rb_cData, mark_marshal_compat_t, 0, compat_allocator_tbl);
rb_gc_register_mark_object(compat_allocator_tbl_wrapper);
- return compat_allocator_tbl;
}
VALUE
rb_marshal_dump(VALUE obj, VALUE port)
{
- return rb_marshal_dump_limited(obj, port, -1);
+ int argc = 1;
+ VALUE argv[2];
+
+ argv[0] = obj;
+ argv[1] = port;
+ if (!NIL_P(port)) argc = 2;
+ return marshal_dump(argc, argv);
}
VALUE
rb_marshal_load(VALUE port)
{
- return rb_marshal_load_with_proc(port, Qnil);
+ return marshal_load(1, &port);
}
diff --git a/math.c b/math.c
index 9ac898f0ba..e621d1af77 100644
--- a/math.c
+++ b/math.c
@@ -9,6 +9,7 @@
**********************************************************************/
+#include "ruby/ruby.h"
#include "internal.h"
#include <float.h>
#include <math.h>
@@ -24,7 +25,11 @@
VALUE rb_mMath;
VALUE rb_eMathDomainError;
-#define Get_Double(x) rb_num_to_dbl(x)
+#define Need_Float(x) do {if (!RB_TYPE_P(x, T_FLOAT)) {(x) = rb_to_float(x);}} while(0)
+#define Need_Float2(x,y) do {\
+ Need_Float(x);\
+ Need_Float(y);\
+} while (0)
#define domain_error(msg) \
rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg)
@@ -34,9 +39,7 @@ VALUE rb_eMathDomainError;
* Math.atan2(y, x) -> Float
*
* Computes the arc tangent given +y+ and +x+.
- * Returns a Float in the range -PI..PI. Return value is a angle
- * in radians between the positive x-axis of cartesian plane
- * and the point given by the coordinates (+x+, +y+) on it.
+ * Returns a Float in the range -PI..PI.
*
* Domain: (-INFINITY, INFINITY)
*
@@ -52,19 +55,19 @@ VALUE rb_eMathDomainError;
* Math.atan2(1.0, 0.0) #=> 1.5707963267948966
* Math.atan2(1.0, -1.0) #=> 2.356194490192345
* Math.atan2(0.0, -1.0) #=> 3.141592653589793
- * Math.atan2(INFINITY, INFINITY) #=> 0.7853981633974483
- * Math.atan2(INFINITY, -INFINITY) #=> 2.356194490192345
- * Math.atan2(-INFINITY, INFINITY) #=> -0.7853981633974483
- * Math.atan2(-INFINITY, -INFINITY) #=> -2.356194490192345
*
*/
static VALUE
math_atan2(VALUE obj, VALUE y, VALUE x)
{
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
double dx, dy;
- dx = Get_Double(x);
- dy = Get_Double(y);
+ Need_Float2(y, x);
+ dx = RFLOAT_VALUE(x);
+ dy = RFLOAT_VALUE(y);
if (dx == 0.0 && dy == 0.0) {
if (!signbit(dx))
return DBL2NUM(dy);
@@ -72,19 +75,7 @@ math_atan2(VALUE obj, VALUE y, VALUE x)
return DBL2NUM(M_PI);
return DBL2NUM(-M_PI);
}
-#ifndef ATAN2_INF_C99
- if (isinf(dx) && isinf(dy)) {
- /* optimization for FLONUM */
- if (dx < 0.0) {
- const double dz = (3.0 * M_PI / 4.0);
- return (dy < 0.0) ? DBL2NUM(-dz) : DBL2NUM(dz);
- }
- else {
- const double dz = (M_PI / 4.0);
- return (dy < 0.0) ? DBL2NUM(-dz) : DBL2NUM(dz);
- }
- }
-#endif
+ if (isinf(dx) && isinf(dy)) domain_error("atan2");
return DBL2NUM(atan2(dy, dx));
}
@@ -107,7 +98,8 @@ math_atan2(VALUE obj, VALUE y, VALUE x)
static VALUE
math_cos(VALUE obj, VALUE x)
{
- return DBL2NUM(cos(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(cos(RFLOAT_VALUE(x)));
}
/*
@@ -128,7 +120,8 @@ math_cos(VALUE obj, VALUE x)
static VALUE
math_sin(VALUE obj, VALUE x)
{
- return DBL2NUM(sin(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(sin(RFLOAT_VALUE(x)));
}
@@ -149,7 +142,8 @@ math_sin(VALUE obj, VALUE x)
static VALUE
math_tan(VALUE obj, VALUE x)
{
- return DBL2NUM(tan(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(tan(RFLOAT_VALUE(x)));
}
/*
@@ -169,12 +163,14 @@ math_tan(VALUE obj, VALUE x)
static VALUE
math_acos(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < -1.0 || 1.0 < d) domain_error("acos");
- return DBL2NUM(acos(d));
+ if (d0 < -1.0 || 1.0 < d0) domain_error("acos");
+ d = acos(d0);
+ return DBL2NUM(d);
}
/*
@@ -193,12 +189,14 @@ math_acos(VALUE obj, VALUE x)
static VALUE
math_asin(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < -1.0 || 1.0 < d) domain_error("asin");
- return DBL2NUM(asin(d));
+ if (d0 < -1.0 || 1.0 < d0) domain_error("asin");
+ d = asin(d0);
+ return DBL2NUM(d);
}
/*
@@ -217,7 +215,8 @@ math_asin(VALUE obj, VALUE x)
static VALUE
math_atan(VALUE obj, VALUE x)
{
- return DBL2NUM(atan(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(atan(RFLOAT_VALUE(x)));
}
#ifndef HAVE_COSH
@@ -245,7 +244,8 @@ cosh(double x)
static VALUE
math_cosh(VALUE obj, VALUE x)
{
- return DBL2NUM(cosh(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(cosh(RFLOAT_VALUE(x)));
}
#ifndef HAVE_SINH
@@ -273,7 +273,8 @@ sinh(double x)
static VALUE
math_sinh(VALUE obj, VALUE x)
{
- return DBL2NUM(sinh(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(sinh(RFLOAT_VALUE(x)));
}
#ifndef HAVE_TANH
@@ -301,7 +302,8 @@ tanh(double x)
static VALUE
math_tanh(VALUE obj, VALUE x)
{
- return DBL2NUM(tanh(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(tanh(RFLOAT_VALUE(x)));
}
/*
@@ -321,12 +323,14 @@ math_tanh(VALUE obj, VALUE x)
static VALUE
math_acosh(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < 1.0) domain_error("acosh");
- return DBL2NUM(acosh(d));
+ if (d0 < 1.0) domain_error("acosh");
+ d = acosh(d0);
+ return DBL2NUM(d);
}
/*
@@ -346,7 +350,8 @@ math_acosh(VALUE obj, VALUE x)
static VALUE
math_asinh(VALUE obj, VALUE x)
{
- return DBL2NUM(asinh(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(asinh(RFLOAT_VALUE(x)));
}
/*
@@ -366,15 +371,17 @@ math_asinh(VALUE obj, VALUE x)
static VALUE
math_atanh(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < -1.0 || +1.0 < d) domain_error("atanh");
+ if (d0 < -1.0 || +1.0 < d0) domain_error("atanh");
/* check for pole error */
- if (d == -1.0) return DBL2NUM(-INFINITY);
- if (d == +1.0) return DBL2NUM(+INFINITY);
- return DBL2NUM(atanh(d));
+ if (d0 == -1.0) return DBL2NUM(-INFINITY);
+ if (d0 == +1.0) return DBL2NUM(+INFINITY);
+ d = atanh(d0);
+ return DBL2NUM(d);
}
/*
@@ -396,7 +403,8 @@ math_atanh(VALUE obj, VALUE x)
static VALUE
math_exp(VALUE obj, VALUE x)
{
- return DBL2NUM(exp(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(exp(RFLOAT_VALUE(x)));
}
#if defined __CYGWIN__
@@ -408,8 +416,6 @@ math_exp(VALUE obj, VALUE x)
# define log10(x) ((x) < 0.0 ? nan("") : log10(x))
#endif
-static double math_log1(VALUE x);
-
/*
* call-seq:
* Math.log(x) -> Float
@@ -432,26 +438,15 @@ static double math_log1(VALUE x);
*/
static VALUE
-math_log(int argc, const VALUE *argv, VALUE obj)
+math_log(int argc, VALUE *argv)
{
VALUE x, base;
- double d;
+ double d0, d;
+ size_t numbits;
rb_scan_args(argc, argv, "11", &x, &base);
- d = math_log1(x);
- if (argc == 2) {
- d /= math_log1(base);
- }
- return DBL2NUM(d);
-}
-
-static double
-math_log1(VALUE x)
-{
- double d;
- size_t numbits;
- if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
+ if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
numbits -= DBL_MANT_DIG;
x = rb_big_rshift(x, SIZET2NUM(numbits));
@@ -460,13 +455,20 @@ math_log1(VALUE x)
numbits = 0;
}
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < 0.0) domain_error("log");
+ if (d0 < 0.0) domain_error("log");
/* check for pole error */
- if (d == 0.0) return -INFINITY;
-
- return log(d) + numbits * log(2); /* log(d * 2 ** numbits) */
+ if (d0 == 0.0) return DBL2NUM(-INFINITY);
+ d = log(d0);
+ if (numbits)
+ d += numbits * log(2); /* log(2**numbits) */
+ if (argc == 2) {
+ Need_Float(base);
+ d /= log(RFLOAT_VALUE(base));
+ }
+ return DBL2NUM(d);
}
#ifndef log2
@@ -501,10 +503,10 @@ extern double log2(double);
static VALUE
math_log2(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
size_t numbits;
- if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
+ if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
numbits -= DBL_MANT_DIG;
x = rb_big_rshift(x, SIZET2NUM(numbits));
@@ -513,13 +515,15 @@ math_log2(VALUE obj, VALUE x)
numbits = 0;
}
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < 0.0) domain_error("log2");
+ if (d0 < 0.0) domain_error("log2");
/* check for pole error */
- if (d == 0.0) return DBL2NUM(-INFINITY);
-
- return DBL2NUM(log2(d) + numbits); /* log2(d * 2 ** numbits) */
+ if (d0 == 0.0) return DBL2NUM(-INFINITY);
+ d = log2(d0);
+ d += numbits;
+ return DBL2NUM(d);
}
/*
@@ -541,10 +545,10 @@ math_log2(VALUE obj, VALUE x)
static VALUE
math_log10(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
size_t numbits;
- if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
+ if (RB_BIGNUM_TYPE_P(x) && RBIGNUM_POSITIVE_P(x) &&
DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
numbits -= DBL_MANT_DIG;
x = rb_big_rshift(x, SIZET2NUM(numbits));
@@ -553,13 +557,16 @@ math_log10(VALUE obj, VALUE x)
numbits = 0;
}
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < 0.0) domain_error("log10");
+ if (d0 < 0.0) domain_error("log10");
/* check for pole error */
- if (d == 0.0) return DBL2NUM(-INFINITY);
-
- return DBL2NUM(log10(d) + numbits * log10(2)); /* log10(d * 2 ** numbits) */
+ if (d0 == 0.0) return DBL2NUM(-INFINITY);
+ d = log10(d0);
+ if (numbits)
+ d += numbits * log10(2); /* log10(2**numbits) */
+ return DBL2NUM(d);
}
/*
@@ -591,13 +598,15 @@ math_log10(VALUE obj, VALUE x)
static VALUE
math_sqrt(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (d < 0.0) domain_error("sqrt");
- if (d == 0.0) return DBL2NUM(0.0);
- return DBL2NUM(sqrt(d));
+ if (d0 < 0.0) domain_error("sqrt");
+ if (d0 == 0.0) return DBL2NUM(0.0);
+ d = sqrt(d0);
+ return DBL2NUM(d);
}
/*
@@ -606,9 +615,9 @@ math_sqrt(VALUE obj, VALUE x)
*
* Returns the cube root of +x+.
*
- * Domain: (-INFINITY, INFINITY)
+ * Domain: [0, INFINITY)
*
- * Codomain: (-INFINITY, INFINITY)
+ * Codomain:[0, INFINITY)
*
* -9.upto(9) {|x|
* p [x, Math.cbrt(x), Math.cbrt(x)**3]
@@ -638,7 +647,8 @@ math_sqrt(VALUE obj, VALUE x)
static VALUE
math_cbrt(VALUE obj, VALUE x)
{
- return DBL2NUM(cbrt(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(cbrt(RFLOAT_VALUE(x)));
}
/*
@@ -658,7 +668,9 @@ math_frexp(VALUE obj, VALUE x)
double d;
int exp;
- d = frexp(Get_Double(x), &exp);
+ Need_Float(x);
+
+ d = frexp(RFLOAT_VALUE(x), &exp);
return rb_assoc_new(DBL2NUM(d), INT2NUM(exp));
}
@@ -675,7 +687,8 @@ math_frexp(VALUE obj, VALUE x)
static VALUE
math_ldexp(VALUE obj, VALUE x, VALUE n)
{
- return DBL2NUM(ldexp(Get_Double(x), NUM2INT(n)));
+ Need_Float(x);
+ return DBL2NUM(ldexp(RFLOAT_VALUE(x), NUM2INT(n)));
}
/*
@@ -691,7 +704,8 @@ math_ldexp(VALUE obj, VALUE x, VALUE n)
static VALUE
math_hypot(VALUE obj, VALUE x, VALUE y)
{
- return DBL2NUM(hypot(Get_Double(x), Get_Double(y)));
+ Need_Float2(x, y);
+ return DBL2NUM(hypot(RFLOAT_VALUE(x), RFLOAT_VALUE(y)));
}
/*
@@ -711,7 +725,8 @@ math_hypot(VALUE obj, VALUE x, VALUE y)
static VALUE
math_erf(VALUE obj, VALUE x)
{
- return DBL2NUM(erf(Get_Double(x)));
+ Need_Float(x);
+ return DBL2NUM(erf(RFLOAT_VALUE(x)));
}
/*
@@ -731,40 +746,9 @@ math_erf(VALUE obj, VALUE x)
static VALUE
math_erfc(VALUE obj, VALUE x)
{
- return DBL2NUM(erfc(Get_Double(x)));
-}
-
-#if defined __MINGW32__
-static inline double
-ruby_tgamma(const double d)
-{
- const double g = tgamma(d);
- if (isinf(g)) {
- if (d == 0.0 && signbit(d)) return -INFINITY;
- }
- if (isnan(g)) {
- if (!signbit(d)) return INFINITY;
- }
- return g;
+ Need_Float(x);
+ return DBL2NUM(erfc(RFLOAT_VALUE(x)));
}
-#define tgamma(d) ruby_tgamma(d)
-#endif
-
-#if defined LGAMMA_R_M0_FIX
-static inline double
-ruby_lgamma_r(const double d, int *sign)
-{
- const double g = lgamma_r(d, sign);
- if (isinf(g)) {
- if (d == 0.0 && signbit(d)) {
- *sign = -1;
- return INFINITY;
- }
- }
- return g;
-}
-#define lgamma_r(d, sign) ruby_lgamma_r(d, sign)
-#endif
/*
* call-seq:
@@ -837,18 +821,22 @@ math_gamma(VALUE obj, VALUE x)
* impossible to represent exactly in IEEE 754 double which have
* 53bit mantissa. */
};
- enum {NFACT_TABLE = numberof(fact_table)};
- double d;
- d = Get_Double(x);
+ double d0, d;
+ double intpart, fracpart;
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (isinf(d) && signbit(d)) domain_error("gamma");
- if (d == floor(d)) {
- if (d < 0.0) domain_error("gamma");
- if (1.0 <= d && d <= (double)NFACT_TABLE) {
- return DBL2NUM(fact_table[(int)d - 1]);
+ if (isinf(d0) && signbit(d0)) domain_error("gamma");
+ fracpart = modf(d0, &intpart);
+ if (fracpart == 0.0) {
+ if (intpart < 0) domain_error("gamma");
+ if (0 < intpart &&
+ intpart - 1 < (double)numberof(fact_table)) {
+ return DBL2NUM(fact_table[(int)intpart - 1]);
}
}
- return DBL2NUM(tgamma(d));
+ d = tgamma(d0);
+ return DBL2NUM(d);
}
/*
@@ -868,16 +856,18 @@ math_gamma(VALUE obj, VALUE x)
static VALUE
math_lgamma(VALUE obj, VALUE x)
{
- double d;
+ double d0, d;
int sign=1;
VALUE v;
- d = Get_Double(x);
+ Need_Float(x);
+ d0 = RFLOAT_VALUE(x);
/* check for domain error */
- if (isinf(d)) {
- if (signbit(d)) domain_error("lgamma");
+ if (isinf(d0)) {
+ if (signbit(d0)) domain_error("lgamma");
return rb_assoc_new(DBL2NUM(INFINITY), INT2FIX(1));
}
- v = DBL2NUM(lgamma_r(d, &sign));
+ d = lgamma_r(d0, &sign);
+ v = DBL2NUM(d);
return rb_assoc_new(v, INT2FIX(sign));
}
@@ -903,16 +893,14 @@ exp1(exp)
exp2(hypot)
VALUE
-rb_math_log(int argc, const VALUE *argv)
+rb_math_log(int argc, VALUE *argv)
{
- return math_log(argc, argv, rb_mMath);
+ return math_log(argc, argv);
}
exp1(sin)
exp1(sinh)
-#if 0
exp1(sqrt)
-#endif
/*
@@ -944,7 +932,7 @@ exp1(sqrt)
void
-InitVM_Math(void)
+Init_Math(void)
{
rb_mMath = rb_define_module("Math");
rb_eMathDomainError = rb_define_class_under(rb_mMath, "DomainError", rb_eStandardError);
@@ -998,9 +986,3 @@ InitVM_Math(void)
rb_define_module_function(rb_mMath, "gamma", math_gamma, 1);
rb_define_module_function(rb_mMath, "lgamma", math_lgamma, 1);
}
-
-void
-Init_Math(void)
-{
- InitVM(Math);
-}
diff --git a/method.h b/method.h
index 510c9b6f40..9604722500 100644
--- a/method.h
+++ b/method.h
@@ -8,8 +8,8 @@
Copyright (C) 2009 Koichi Sasada
**********************************************************************/
-#ifndef RUBY_METHOD_H
-#define RUBY_METHOD_H 1
+#ifndef METHOD_H
+#define METHOD_H
#include "internal.h"
@@ -21,82 +21,29 @@
# endif
#endif
-/* cref */
-
typedef enum {
- METHOD_VISI_UNDEF = 0x00,
- METHOD_VISI_PUBLIC = 0x01,
- METHOD_VISI_PRIVATE = 0x02,
- METHOD_VISI_PROTECTED = 0x03,
-
- METHOD_VISI_MASK = 0x03
-} rb_method_visibility_t;
-
-typedef struct rb_scope_visi_struct {
- rb_method_visibility_t method_visi : 3;
- unsigned int module_func : 1;
-} rb_scope_visibility_t;
-
-typedef struct rb_cref_struct {
- VALUE flags;
- const VALUE refinements;
- const VALUE klass;
- struct rb_cref_struct * const next;
- const rb_scope_visibility_t scope_visi;
-} rb_cref_t;
+ NOEX_PUBLIC = 0x00,
+ NOEX_NOSUPER = 0x01,
+ NOEX_PRIVATE = 0x02,
+ NOEX_PROTECTED = 0x04,
+ NOEX_MASK = 0x06,
+ NOEX_BASIC = 0x08,
+ NOEX_UNDEF = NOEX_NOSUPER,
+ NOEX_MODFUNC = 0x12,
+ NOEX_SUPER = 0x20,
+ NOEX_VCALL = 0x40,
+ NOEX_RESPONDS = 0x80,
+
+ NOEX_BIT_WIDTH = 8,
+ NOEX_SAFE_SHIFT_OFFSET = ((NOEX_BIT_WIDTH+3)/4)*4 /* round up to nibble */
+} rb_method_flag_t;
+
+#define NOEX_SAFE(n) ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F)
+#define NOEX_WITH(n, s) (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC))
+#define NOEX_WITH_SAFE(n) NOEX_WITH((n), rb_safe_level())
/* method data type */
-typedef struct rb_method_entry_struct {
- VALUE flags;
- const VALUE defined_class;
- struct rb_method_definition_struct * const def;
- ID called_id;
- const VALUE owner;
-} rb_method_entry_t;
-
-typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_entry_t */
- VALUE flags;
- const VALUE defined_class;
- struct rb_method_definition_struct * const def;
- ID called_id;
- const VALUE owner;
-} rb_callable_method_entry_t;
-
-#define METHOD_ENTRY_VISI(me) (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
-#define METHOD_ENTRY_BASIC(me) (int) (((me)->flags & (IMEMO_FL_USER2 )) >> (IMEMO_FL_USHIFT+2))
-#define METHOD_ENTRY_COMPLEMENTED(me) ((me)->flags & IMEMO_FL_USER3)
-#define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags = (me)->flags | IMEMO_FL_USER3)
-
-static inline void
-METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
-{
- VM_ASSERT((int)visi >= 0 && visi <= 3);
- me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << (IMEMO_FL_USHIFT+0));
-}
-static inline void
-METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, unsigned int basic)
-{
- VM_ASSERT(basic <= 1);
- me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << (IMEMO_FL_USHIFT+2));
-}
-static inline void
-METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic)
-{
- VM_ASSERT((int)visi >= 0 && visi <= 3);
- VM_ASSERT(basic <= 1);
- me->flags =
- (me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
- ((visi << (IMEMO_FL_USHIFT+0)) | (basic << (IMEMO_FL_USHIFT+2)));
-}
-static inline void
-METHOD_ENTRY_FLAGS_COPY(rb_method_entry_t *dst, const rb_method_entry_t *src)
-{
- dst->flags =
- (dst->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
- (src->flags & (IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2));
-}
-
typedef enum {
VM_METHOD_TYPE_ISEQ,
VM_METHOD_TYPE_CFUNC,
@@ -104,7 +51,6 @@ typedef enum {
VM_METHOD_TYPE_IVAR,
VM_METHOD_TYPE_BMETHOD,
VM_METHOD_TYPE_ZSUPER,
- VM_METHOD_TYPE_ALIAS,
VM_METHOD_TYPE_UNDEF,
VM_METHOD_TYPE_NOTIMPLEMENTED,
VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
@@ -114,15 +60,7 @@ typedef enum {
END_OF_ENUMERATION(VM_METHOD_TYPE)
} rb_method_type_t;
-#ifndef rb_iseq_t
-typedef struct rb_iseq_struct rb_iseq_t;
-#define rb_iseq_t rb_iseq_t
-#endif
-
-typedef struct rb_method_iseq_struct {
- const rb_iseq_t * const iseqptr; /* should be separated from iseqval */
- rb_cref_t * const cref; /* should be marked */
-} rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
+struct rb_call_info_struct;
typedef struct rb_method_cfunc_struct {
VALUE (*func)(ANYARGS);
@@ -132,82 +70,72 @@ typedef struct rb_method_cfunc_struct {
typedef struct rb_method_attr_struct {
ID id;
- const VALUE location; /* should be marked */
+ const VALUE location;
} rb_method_attr_t;
-typedef struct rb_method_alias_struct {
- const struct rb_method_entry_struct * const original_me; /* original_me->klass is original owner */
-} rb_method_alias_t;
-
-typedef struct rb_method_refined_struct {
- const struct rb_method_entry_struct * const orig_me;
- const VALUE owner;
-} rb_method_refined_t;
+typedef struct rb_iseq_struct rb_iseq_t;
typedef struct rb_method_definition_struct {
- rb_method_type_t type : 8; /* method type */
- int alias_count : 28;
- int complemented_count: 28;
-
+ rb_method_type_t type; /* method type */
+ ID original_id;
union {
- rb_method_iseq_t iseq;
+ rb_iseq_t * const iseq; /* should be mark */
rb_method_cfunc_t cfunc;
rb_method_attr_t attr;
- rb_method_alias_t alias;
- rb_method_refined_t refined;
-
- const VALUE proc; /* should be marked */
+ const VALUE proc; /* should be mark */
enum method_optimized_type {
OPTIMIZED_METHOD_TYPE_SEND,
OPTIMIZED_METHOD_TYPE_CALL,
OPTIMIZED_METHOD_TYPE__MAX
} optimize_type;
+ struct rb_method_entry_struct *orig_me;
} body;
-
- ID original_id;
+ int alias_count;
} rb_method_definition_t;
-#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
-#define UNDEFINED_REFINED_METHOD_P(def) \
- ((def)->type == VM_METHOD_TYPE_REFINED && \
- UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me))
-
-void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi);
-void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi);
-void rb_add_refined_method_entry(VALUE refined_class, ID mid);
+typedef struct rb_method_entry_struct {
+ rb_method_flag_t flag;
+ char mark;
+ rb_method_definition_t *def;
+ ID called_id;
+ VALUE klass; /* should be mark */
+} rb_method_entry_t;
-rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi);
-rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
-rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
+struct unlinked_method_entry_list_entry {
+ struct unlinked_method_entry_list_entry *next;
+ rb_method_entry_t *me;
+};
-const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
+#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
-const rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
-const rb_method_entry_t *rb_method_entry_with_refinements(VALUE klass, ID id);
-const rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id);
-const rb_method_entry_t *rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
+void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
+rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
+rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr);
+rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
+void rb_add_refined_method_entry(VALUE refined_class, ID mid);
+rb_method_entry_t *rb_resolve_refined_method(VALUE refinements,
+ const rb_method_entry_t *me,
+ VALUE *defined_class_ptr);
+rb_method_entry_t *rb_method_entry_with_refinements(VALUE klass, ID id,
+ VALUE *defined_class_ptr);
+rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id,
+ VALUE *defined_class_ptr);
-const rb_callable_method_entry_t *rb_callable_method_entry(VALUE klass, ID id);
-const rb_callable_method_entry_t *rb_callable_method_entry_with_refinements(VALUE klass, ID id);
-const rb_callable_method_entry_t *rb_callable_method_entry_without_refinements(VALUE klass, ID id);
-const rb_callable_method_entry_t *rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
+rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id, VALUE *define_class_ptr);
+rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
int rb_method_entry_arity(const rb_method_entry_t *me);
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
-VALUE rb_method_entry_location(const rb_method_entry_t *me);
+VALUE rb_method_entry_location(rb_method_entry_t *me);
VALUE rb_mod_method_location(VALUE mod, ID id);
VALUE rb_obj_method_location(VALUE obj, ID id);
-void rb_free_method_entry(const rb_method_entry_t *me);
+void rb_mark_method_entry(const rb_method_entry_t *me);
+void rb_free_method_entry(rb_method_entry_t *me);
void rb_sweep_method_entry(void *vm);
+void rb_free_m_table(st_table *tbl);
-const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
-const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
-void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
-
-void rb_scope_visibility_set(rb_method_visibility_t);
-
-#endif /* RUBY_METHOD_H */
+#endif /* METHOD_H */
diff --git a/miniinit.c b/miniinit.c
index 7284e2e62d..bc6138a774 100644
--- a/miniinit.c
+++ b/miniinit.c
@@ -20,14 +20,7 @@ const char ruby_initial_load_paths[] = "";
VALUE
rb_locale_charmap(VALUE klass)
{
- /* never used */
- return Qnil;
-}
-
-int
-rb_locale_charmap_index(void)
-{
- return -1;
+ return rb_usascii_str_new2("ASCII-8BIT");
}
int
@@ -35,15 +28,3 @@ Init_enc_set_filesystem_encoding(void)
{
return rb_enc_to_index(rb_default_external_encoding());
}
-
-void rb_encdb_declare(const char *name);
-int rb_encdb_alias(const char *alias, const char *orig);
-void
-Init_enc(void)
-{
- rb_encdb_declare("ASCII-8BIT");
- rb_encdb_declare("US-ASCII");
- rb_encdb_declare("UTF-8");
- rb_encdb_alias("BINARY", "ASCII-8BIT");
- rb_encdb_alias("ASCII", "US-ASCII");
-}
diff --git a/misc/README b/misc/README
index 08a9010f58..93d1de90b2 100644
--- a/misc/README
+++ b/misc/README
@@ -9,4 +9,4 @@ rubydb2x.el ruby debugger support for emacs 19.2x or before
rubydb3x.el ruby debugger support for emacs 19.3x or later
ruby-electric.el emacs minor mode providing electric commands
-Check out https://github.com/ruby-debug/ also.
+Check out http://rubyforge.org/projects/ruby-debug/ also.
diff --git a/misc/rdoc-mode.el b/misc/rdoc-mode.el
index c26c2ee564..1bfd34bf2d 100644
--- a/misc/rdoc-mode.el
+++ b/misc/rdoc-mode.el
@@ -32,49 +32,15 @@
(run-hooks 'rdoc-mode-hook)
)
-(defun rdoc-fill-paragraph (&optional justify region)
+(defun rdoc-fill-paragraph (&rest args)
"Fills paragraph, except for cited region"
(interactive (progn
(barf-if-buffer-read-only)
(list (if current-prefix-arg 'full))))
(save-excursion
(beginning-of-line)
- (save-restriction
- (let ((pos (point)) beg end indent hanging)
- (cond
- ((looking-at "^ +\\(\\*\\s *\\)")
- (setq indent (- (match-end 0) (match-beginning 0))
- hanging (- (match-end 1) (match-beginning 1))))
- ((looking-at "^ +")
- (setq indent (- (match-end 0) (match-beginning 0)))
- (when (and (re-search-backward "^[^ ]\\|^\\( *\\(\\* *\\)\\)" nil t)
- (match-beginning 1)
- (= indent (- (match-end 1) (match-beginning 1))))
- (setq hanging (- (match-end 2) (match-beginning 2)))
- (setq beg (match-beginning 1))))
- ((setq beg t)))
- (when beg
- (when indent
- (goto-char pos)
- (while (progn (beginning-of-line 2)
- (and (looking-at "^\\( +\\)\\S ")
- (= indent (- (match-end 1) (match-beginning 1))))))
- (setq end (point))
- (when (and beg (not region))
- (setq region (list beg end))
- (narrow-to-region beg end)
- ))
- (goto-char pos)
- (fill-paragraph justify region)
- (when (and indent
- (or (goto-char beg) t)
- (or (beginning-of-line 2) t)
- (looking-at "^\\( +\\)")
- (= (- indent hanging) (- (match-end 0) (match-beginning 0))))
- (insert-char ?\s hanging)
- (beginning-of-line)
- (narrow-to-region (point) end)
- (fill-paragraph justify (list (point) end))))))))
+ (unless (looking-at "^ +")
+ (apply 'fill-paragraph args))))
(defun rdoc-setup-keys ()
(interactive)
diff --git a/misc/ruby-additional.el b/misc/ruby-additional.el
index 46c3cd23f2..c06003d6da 100644
--- a/misc/ruby-additional.el
+++ b/misc/ruby-additional.el
@@ -106,26 +106,8 @@ Emacs to Ruby."
(t (when ruby-insert-encoding-magic-comment
(insert "# -*- coding: " coding-system " -*-\n"))))))))
- (define-key ruby-mode-map "\C-cU" 'ruby-encode-unicode)
-
- (defun ruby-encode-unicode (beg end)
- "Convert non-ascii string in the given region to \\u{} form."
- (interactive "r")
- (setq end (set-marker (make-marker) end))
- (goto-char beg)
- (while (and (< (point) end)
- (re-search-forward "\\Ca+" end t))
- (let ((u (mapconcat (lambda (c) (format "%x" c)) (match-string-no-properties 0) " ")))
- (delete-region (match-beginning 0) (match-end 0))
- (insert "\\u{" u "}"))
- ))
))
-;; monkey-patching ruby-mode.el in Emacs 24, as r49872.
-(when (and (boundp 'ruby-syntax-before-regexp-re)
- (not (string-match ruby-syntax-before-regexp-re "foo {|" 1)))
- (replace-regexp-in-string "\\[\\[" "\\&{|" ruby-syntax-before-regexp-re))
-
(provide 'ruby-additional)
;;; ruby-additional.el ends here
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index f54e91ccbc..8eb872d909 100644
--- a/misc/ruby-electric.el
+++ b/misc/ruby-electric.el
@@ -10,7 +10,7 @@
;; URL: https://github.com/knu/ruby-electric.el
;; Keywords: languages ruby
;; License: The same license terms as Ruby
-;; Version: 2.2.3
+;; Version: 2.1
;;; Commentary:
;;
@@ -33,9 +33,6 @@
(require 'ruby-mode)
-(eval-when-compile
- (require 'cl))
-
(defgroup ruby-electric nil
"Minor mode providing electric editing commands for ruby files"
:group 'ruby)
@@ -164,13 +161,17 @@ cons, ACTION can be set to one of the following values:
"$"))))
:group 'ruby-electric)
+(defcustom ruby-electric-simple-keywords-re nil
+ "Obsolete and ignored. Customize `ruby-electric-keywords-alist'
+instead."
+ :type 'regexp :group 'ruby-electric)
+
(defvar ruby-electric-mode-map
(let ((map (make-sparse-keymap)))
(define-key map " " 'ruby-electric-space/return)
(define-key map [remap delete-backward-char] 'ruby-electric-delete-backward-char)
(define-key map [remap newline] 'ruby-electric-space/return)
(define-key map [remap newline-and-indent] 'ruby-electric-space/return)
- (define-key map [remap electric-newline-and-maybe-indent] 'ruby-electric-space/return)
(dolist (x ruby-electric-delimiters-alist)
(let* ((delim (car x))
(plist (cdr x))
@@ -246,11 +247,8 @@ enabled."
(interactive "*P")
(and (boundp 'sp-last-operation)
(setq sp-delayed-pair nil))
- (cond ((or arg
- (region-active-p))
- (or (= last-command-event ?\s)
- (setq last-command-event ?\n))
- (ruby-electric-replace-region-or-insert))
+ (cond (arg
+ (insert (make-string (prefix-numeric-value arg) last-command-event)))
((ruby-electric-space/return-can-be-expanded-p)
(let (action)
(save-excursion
@@ -272,7 +270,7 @@ enabled."
(ruby-indent-line)
(save-excursion
(newline)
- (ruby-electric-end)))
+ (ruby-insert-end)))
((eq action 'reindent)
(ruby-indent-line)))
(ruby-electric-space/return-fallback)))
@@ -282,31 +280,19 @@ enabled."
(t
(ruby-electric-space/return-fallback))))
-(defun ruby-electric--get-faces-at-point ()
- (let* ((point (point))
- (value (or
- (get-text-property point 'read-face-name)
- (get-text-property point 'face))))
- (if (listp value) value (list value))))
-
-(defun ruby-electric--faces-at-point-include-p (&rest faces)
- (and ruby-electric-mode
- (loop for face in faces
- with pfaces = (ruby-electric--get-faces-at-point)
- thereis (memq face pfaces))))
-
(defun ruby-electric-code-at-point-p()
- (not (ruby-electric--faces-at-point-include-p
- 'font-lock-string-face
- 'font-lock-comment-face)))
+ (and ruby-electric-mode
+ (let* ((properties (text-properties-at (point))))
+ (and (null (memq 'font-lock-string-face properties))
+ (null (memq 'font-lock-comment-face properties))))))
(defun ruby-electric-string-at-point-p()
- (ruby-electric--faces-at-point-include-p
- 'font-lock-string-face))
+ (and ruby-electric-mode
+ (consp (memq 'font-lock-string-face (text-properties-at (point))))))
(defun ruby-electric-comment-at-point-p()
- (ruby-electric--faces-at-point-include-p
- 'font-lock-comment-face))
+ (and ruby-electric-mode
+ (consp (memq 'font-lock-comment-face (text-properties-at (point))))))
(defun ruby-electric-escaped-p()
(let ((f nil))
@@ -324,198 +310,129 @@ enabled."
(and (ruby-electric-code-at-point-p)
(looking-back ruby-electric-expandable-keyword-re)))
-(defun ruby-electric-replace-region-or-insert ()
- (and (region-active-p)
- (bound-and-true-p delete-selection-mode)
- (fboundp 'delete-selection-helper)
- (delete-selection-helper (get 'self-insert-command 'delete-selection)))
- (insert (make-string (prefix-numeric-value current-prefix-arg)
- last-command-event))
- (setq this-command 'self-insert-command))
+(defun ruby-electric-cua-replace-region-maybe()
+ (let ((func (key-binding [remap self-insert-command])))
+ (when (memq func '(cua-replace-region
+ sp--cua-replace-region))
+ (setq this-original-command 'self-insert-command)
+ (funcall (setq this-command func))
+ t)))
(defmacro ruby-electric-insert (arg &rest body)
- `(cond ((and
+ `(cond ((ruby-electric-cua-replace-region-maybe))
+ ((and
(null ,arg)
(ruby-electric-command-char-expandable-punct-p last-command-event))
- (let ((region-beginning
- (cond ((region-active-p)
- (prog1
- (save-excursion
- (goto-char (region-beginning))
- (insert last-command-event)
- (point))
- (goto-char (region-end))))
- (t
- (insert last-command-event)
- nil))))
- ,@body
- (and region-beginning
- ;; If no extra character is inserted, go back to the
- ;; region beginning.
- (eq this-command 'self-insert-command)
- (goto-char region-beginning))))
- ((ruby-electric-replace-region-or-insert))))
-
-(defun ruby-electric-curlies (arg)
+ (insert last-command-event)
+ ,@body)
+ (t
+ (setq this-command 'self-insert-command)
+ (insert (make-string (prefix-numeric-value ,arg) last-command-event)))))
+
+(defun ruby-electric-curlies(arg)
(interactive "*P")
(ruby-electric-insert
arg
(cond
((ruby-electric-code-at-point-p)
- (save-excursion
- (insert "}")
- (font-lock-fontify-region (line-beginning-position) (point)))
+ (insert "}")
+ (backward-char 1)
+ (redisplay)
(cond
((ruby-electric-string-at-point-p) ;; %w{}, %r{}, etc.
- (if region-beginning
- (forward-char 1)))
+ t)
(ruby-electric-newline-before-closing-bracket
- (cond (region-beginning
- (save-excursion
- (goto-char region-beginning)
- (newline))
- (newline)
- (forward-char 1)
- (indent-region region-beginning (line-end-position)))
- (t
- (insert " ")
- (save-excursion
- (newline)
- (ruby-indent-line t)))))
- (t
- (if region-beginning
- (save-excursion
- (goto-char region-beginning)
- (insert " "))
- (insert " "))
(insert " ")
- (and region-beginning
- (forward-char 1)))))
+ (save-excursion
+ (newline)
+ (ruby-indent-line t)))
+ (t
+ (insert " ")
+ (backward-char 1))))
((ruby-electric-string-at-point-p)
- (let ((start-position (1- (or region-beginning (point)))))
+ (save-excursion
+ (backward-char 1)
(cond
- ((char-equal ?\# (char-before start-position))
+ ((char-equal ?\# (preceding-char))
(unless (save-excursion
- (goto-char (1- start-position))
+ (backward-char 1)
(ruby-electric-escaped-p))
- (insert "}")
- (or region-beginning
- (backward-char 1))))
+ (forward-char 1)
+ (insert "}")))
((or
(ruby-electric-command-char-expandable-punct-p ?\#)
- (save-excursion
- (goto-char start-position)
- (ruby-electric-escaped-p)))
- (if region-beginning
- (goto-char region-beginning))
+ (ruby-electric-escaped-p))
(setq this-command 'self-insert-command))
(t
- (save-excursion
- (goto-char start-position)
- (insert "#"))
- (insert "}")
- (or region-beginning
- (backward-char 1))))))
- (t
- (delete-char -1)
- (ruby-electric-replace-region-or-insert)))))
-
-(defun ruby-electric-hash (arg)
+ (insert "#")
+ (forward-char 1)
+ (insert "}"))))))))
+
+(defun ruby-electric-hash(arg)
(interactive "*P")
(ruby-electric-insert
arg
- (if (ruby-electric-string-at-point-p)
- (let ((start-position (1- (or region-beginning (point)))))
- (cond
- ((char-equal (following-char) ?')) ;; likely to be in ''
- ((save-excursion
- (goto-char start-position)
- (ruby-electric-escaped-p)))
- (region-beginning
- (save-excursion
- (goto-char (1+ start-position))
- (insert "{"))
- (insert "}"))
- (t
- (insert "{")
- (save-excursion
- (insert "}")))))
- (delete-char -1)
- (ruby-electric-replace-region-or-insert))))
-
-(defun ruby-electric-matching-char (arg)
+ (and (ruby-electric-string-at-point-p)
+ (or (char-equal (following-char) ?') ;; likely to be in ''
+ (save-excursion
+ (backward-char 1)
+ (ruby-electric-escaped-p))
+ (progn
+ (insert "{}")
+ (backward-char 1))))))
+
+(defmacro ruby-electric-avoid-eob(&rest body)
+ `(if (eobp)
+ (save-excursion
+ (insert "\n")
+ (backward-char)
+ ,@body
+ (prog1
+ (ruby-electric-string-at-point-p)
+ (delete-char 1)))
+ ,@body))
+
+(defun ruby-electric-matching-char(arg)
(interactive "*P")
(ruby-electric-insert
arg
(let ((closing (cdr (assoc last-command-event
ruby-electric-matching-delimeter-alist))))
(cond
- ;; quotes
((char-equal closing last-command-event)
- (cond ((let ((start-position (or region-beginning (point))))
- ;; check if this quote has just started a string
- (and
- (unwind-protect
- (save-excursion
- (subst-char-in-region (1- start-position) start-position
- last-command-event ?\s)
- (goto-char (1- start-position))
- (save-excursion
- (font-lock-fontify-region (line-beginning-position) (1+ (point))))
- (not (ruby-electric-string-at-point-p)))
- (subst-char-in-region (1- start-position) start-position
- ?\s last-command-event))
- (save-excursion
- (goto-char (1- start-position))
- (save-excursion
- (font-lock-fontify-region (line-beginning-position) (1+ (point))))
- (ruby-electric-string-at-point-p))))
- (if region-beginning
- ;; escape quotes of the same kind, backslash and hash
- (let ((re (format "[%c\\%s]"
- last-command-event
- (if (char-equal last-command-event ?\")
- "#" "")))
- (bound (point)))
- (save-excursion
- (goto-char region-beginning)
- (while (re-search-forward re bound t)
- (let ((end (point)))
- (replace-match "\\\\\\&")
- (setq bound (+ bound (- (point) end))))))))
- (insert closing)
- (or region-beginning
- (backward-char 1)))
- (t
- (and (eq last-command 'ruby-electric-matching-char)
- (char-equal (following-char) closing) ;; repeated quotes
- (delete-char 1))
- (setq this-command 'self-insert-command))))
+ (if (and (not (ruby-electric-string-at-point-p))
+ (ruby-electric-avoid-eob
+ (redisplay)
+ (ruby-electric-string-at-point-p)))
+ (save-excursion (insert closing))
+ (and (eq last-command 'ruby-electric-matching-char)
+ (char-equal (following-char) closing) ;; repeated quotes
+ (delete-forward-char 1))
+ (setq this-command 'self-insert-command)))
((ruby-electric-code-at-point-p)
- (insert closing)
- (or region-beginning
- (backward-char 1)))))))
+ (save-excursion (insert closing)))))))
(defun ruby-electric-closing-char(arg)
(interactive "*P")
(cond
+ ((ruby-electric-cua-replace-region-maybe))
(arg
- (ruby-electric-replace-region-or-insert))
+ (setq this-command 'self-insert-command)
+ (insert (make-string (prefix-numeric-value arg) last-command-event)))
((and
(eq last-command 'ruby-electric-curlies)
- (= last-command-event ?})
- (not (char-equal (preceding-char) last-command-event))) ;; {}
+ (= last-command-event ?})) ;; {}
(if (char-equal (following-char) ?\n) (delete-char 1))
(delete-horizontal-space)
(forward-char))
((and
(= last-command-event (following-char))
- (not (char-equal (preceding-char) last-command-event))
(memq last-command '(ruby-electric-matching-char
ruby-electric-closing-char))) ;; ()/[] and (())/[[]]
(forward-char))
(t
- (ruby-electric-replace-region-or-insert)
+ (setq this-command 'self-insert-command)
+ (self-insert-command 1)
(if ruby-electric-autoindent-on-closing-char
(ruby-indent-line)))))
@@ -527,11 +444,10 @@ enabled."
(looking-back ruby-electric-expandable-bar-re))
(save-excursion (insert "|")))
(t
- (delete-char -1)
- (ruby-electric-replace-region-or-insert)))))
+ (setq this-command 'self-insert-command)))))
(defun ruby-electric-delete-backward-char(arg)
- (interactive "*p")
+ (interactive "*P")
(cond ((memq last-command '(ruby-electric-matching-char
ruby-electric-bar))
(delete-char 1))
@@ -550,19 +466,7 @@ enabled."
((eq last-command 'ruby-electric-hash)
(and (char-equal (preceding-char) ?{)
(delete-char 1))))
- (delete-char (- arg)))
-
-(put 'ruby-electric-delete-backward-char 'delete-selection 'supersede)
-
-(defun ruby-electric-end ()
- (interactive)
- (if (eq (char-syntax (preceding-char)) ?w)
- (insert " "))
- (insert "end")
- (save-excursion
- (if (eq (char-syntax (following-char)) ?w)
- (insert " "))
- (ruby-indent-line t)))
+ (delete-char -1))
(provide 'ruby-electric)
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 77371cf30f..e244ae4827 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -898,7 +898,7 @@ Emacs to Ruby."
(goto-char ruby-indent-point)
(beginning-of-line)
(skip-syntax-forward " ")
- (if (looking-at "\\.[^.]\\|&\\.")
+ (if (looking-at "\\.[^.]")
(+ indent ruby-indent-level)
indent))))
@@ -1198,17 +1198,11 @@ balanced expression is found."
(defun ruby-brace-to-do-end ()
(when (looking-at "{")
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))
- oneline (end (make-marker)))
- (setq oneline (and (eolp) (<= (point-at-bol) orig)))
+ (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
(when (eq (char-before) ?\})
(delete-char -1)
- (cond
- (oneline
- (insert "\n")
- (set-marker end (point)))
- ((eq (char-syntax (preceding-char)) ?w)
- (insert " ")))
+ (if (eq (char-syntax (preceding-char)) ?w)
+ (insert " "))
(insert "end")
(if (eq (char-syntax (following-char)) ?w)
(insert " "))
@@ -1220,54 +1214,20 @@ balanced expression is found."
(when (looking-at "\\sw\\||")
(insert " ")
(backward-char))
- (when oneline
- (setq orig (point))
- (when (cond
- ((looking-at "\\s *|")
- (goto-char (match-end 0))
- (and (search-forward "|" (point-at-eol) 'move)
- (not (eolp))))
- (t))
- (while (progn
- (insert "\n")
- (ruby-forward-sexp)
- (looking-at "\\s *;\\s *"))
- (delete-char (- (match-end 0) (match-beginning 0))))
- (goto-char orig)
- (beginning-of-line 2)
- (indent-region (point) end))
- (goto-char orig))
t))))
(defun ruby-do-end-to-brace ()
(when (and (or (bolp)
(not (memq (char-syntax (preceding-char)) '(?w ?_))))
(looking-at "\\<do\\(\\s \\|$\\)"))
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))
- first last)
+ (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
(backward-char 3)
(when (looking-at ruby-block-end-re)
(delete-char 3)
(insert "}")
- (setq last (and (eolp)
- (progn (backward-char 1)
- (skip-syntax-backward " ")
- (bolp))
- (1- (point-at-eol -1))))
(goto-char orig)
(delete-char 2)
(insert "{")
- (setq orig (point))
- (when (and last (<= last (point))
- (not (search-forward "#" (setq first (point-at-eol)) t)))
- (goto-char (- end 4))
- (end-of-line 0)
- (if (looking-at "\n\\s *")
- (delete-char (- (match-end 0) (match-beginning 0))) t)
- (goto-char first)
- (if (looking-at "\n\\s *")
- (delete-char (- (match-end 0) (match-beginning 0))) t))
- (goto-char orig)
(if (looking-at "\\s +|")
(delete-char (- (match-end 0) (match-beginning 0) 1)))
t))))
@@ -1304,7 +1264,7 @@ balanced expression is found."
;; ?' ?" ?` are ascii codes
("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
;; regexps
- ("\\(^\\|[[{|=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
+ ("\\(^\\|[[=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
(4 (7 . ?/))
(6 (7 . ?/)))
("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil))
diff --git a/missing/crypt.c b/missing/crypt.c
index 0fe564c354..366fba0919 100644
--- a/missing/crypt.c
+++ b/missing/crypt.c
@@ -84,7 +84,7 @@ static char sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93";
* define "LONG_IS_32_BITS" only if sizeof(long)==4.
* This avoids use of bit fields (your compiler may be sloppy with them).
*/
-#if SIZEOF_LONG == 4
+#if !defined(cray)
#define LONG_IS_32_BITS
#endif
@@ -92,9 +92,10 @@ static char sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93";
* define "B64" to be the declaration for a 64 bit integer.
* XXX this feature is currently unused, see "endian" comment below.
*/
-#if SIZEOF_LONG == 8
+#if defined(cray)
#define B64 long
-#elif SIZEOF_LONG_LONG == 8
+#endif
+#if defined(convex)
#define B64 long long
#endif
@@ -107,13 +108,16 @@ static char sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93";
#define LARGEDATA
#endif
-void des_setkey(const char *key);
-void des_cipher(const char *in, char *out, long salt, int num_iter);
+int des_setkey(), des_cipher();
/* compile with "-DSTATIC=int" when profiling */
#ifndef STATIC
#define STATIC static
#endif
+STATIC void init_des(), init_perm(), permute();
+#ifdef DEBUG
+STATIC void prtab();
+#endif
/* ==================================== */
@@ -299,7 +303,11 @@ typedef union {
{ C_block tblk; permute((cpp),&tblk,(p),4); LOAD ((d),(d0),(d1),tblk); }
STATIC void
-permute(unsigned char *cp, C_block *out, register C_block *p, int chars_in)
+permute(cp, out, p, chars_in)
+ unsigned char *cp;
+ C_block *out;
+ register C_block *p;
+ int chars_in;
{
register DCL_BLOCK(D,D0,D1);
register C_block *tp;
@@ -315,12 +323,6 @@ permute(unsigned char *cp, C_block *out, register C_block *p, int chars_in)
}
#endif /* LARGEDATA */
-STATIC void init_des(void);
-STATIC void init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS], unsigned char p[64], int chars_in, int chars_out);
-
-#ifdef DEBUG
-STATIC void prtab(const char *s, const unsigned char *t, int num_rows);
-#endif
/* ===== (mostly) Standard DES Tables ==================== */
@@ -495,7 +497,9 @@ static char cryptresult[1+4+4+11+1]; /* encrypted result */
* followed by an encryption produced by the "key" and "setting".
*/
char *
-crypt(const char *key, const char *setting)
+crypt(key, setting)
+ register const char *key;
+ register const char *setting;
{
register char *encp;
register long i;
@@ -509,7 +513,8 @@ crypt(const char *key, const char *setting)
key++;
keyblock.b[i] = t;
}
- des_setkey((char *)keyblock.b); /* also initializes "a64toi" */
+ if (des_setkey((char *)keyblock.b)) /* also initializes "a64toi" */
+ return (NULL);
encp = &cryptresult[0];
switch (*setting) {
@@ -518,14 +523,16 @@ crypt(const char *key, const char *setting)
* Involve the rest of the password 8 characters at a time.
*/
while (*key) {
- des_cipher((char *)&keyblock,
- (char *)&keyblock, 0L, 1);
+ if (des_cipher((char *)&keyblock,
+ (char *)&keyblock, 0L, 1))
+ return (NULL);
for (i = 0; i < 8; i++) {
if ((t = 2*(unsigned char)(*key)) != 0)
key++;
keyblock.b[i] ^= t;
}
- des_setkey((char *)keyblock.b);
+ if (des_setkey((char *)keyblock.b))
+ return (NULL);
}
*encp++ = *setting++;
@@ -555,8 +562,9 @@ crypt(const char *key, const char *setting)
salt = (salt<<6) | a64toi[t];
}
encp += salt_size;
- des_cipher((char *)&constdatablock, (char *)&rsltblock,
- salt, num_iter);
+ if (des_cipher((char *)&constdatablock, (char *)&rsltblock,
+ salt, num_iter))
+ return (NULL);
/*
* Encode the 64 cipher bits as 11 ascii characters.
@@ -591,8 +599,9 @@ static C_block KS[KS_SIZE];
/*
* Set up the key schedule from the key.
*/
-void
-des_setkey(const char *key)
+int
+des_setkey(key)
+ register const char *key;
{
register DCL_BLOCK(K, K0, K1);
register C_block *ptabp;
@@ -614,6 +623,7 @@ des_setkey(const char *key)
PERM6464(K,K0,K1,(unsigned char *)key,ptabp);
STORE(K&~0x03030303L, K0&~0x03030303L, K1, *(C_block *)key);
}
+ return (0);
}
/*
@@ -624,8 +634,12 @@ des_setkey(const char *key)
* NOTE: the performance of this routine is critically dependent on your
* compiler and machine architecture.
*/
-void
-des_cipher(const char *in, char *out, long salt, int num_iter)
+int
+des_cipher(in, out, salt, num_iter)
+ const char *in;
+ char *out;
+ long salt;
+ int num_iter;
{
/* variables that we want in registers, most important first */
#if defined(pdp11)
@@ -733,6 +747,7 @@ des_cipher(const char *in, char *out, long salt, int num_iter)
#else
STORE(L,L0,L1,*(C_block *)out);
#endif
+ return (0);
}
@@ -741,7 +756,7 @@ des_cipher(const char *in, char *out, long salt, int num_iter)
* done at compile time, if the compiler were capable of that sort of thing.
*/
STATIC void
-init_des(void)
+init_des()
{
register int i, j;
register long k;
@@ -885,8 +900,10 @@ init_des(void)
* "perm" must be all-zeroes on entry to this routine.
*/
STATIC void
-init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS],
- unsigned char p[64], int chars_in, int chars_out)
+init_perm(perm, p, chars_in, chars_out)
+ C_block perm[64/CHUNKBITS][1<<CHUNKBITS];
+ unsigned char p[64];
+ int chars_in, chars_out;
{
register int i, j, k, l;
@@ -906,8 +923,9 @@ init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS],
/*
* "setkey" routine (for backwards compatibility)
*/
-void
-setkey(const char *key)
+int
+setkey(key)
+ register const char *key;
{
register int i, j, k;
C_block keyblock;
@@ -920,14 +938,16 @@ setkey(const char *key)
}
keyblock.b[i] = k;
}
- des_setkey((char *)keyblock.b);
+ return (des_setkey((char *)keyblock.b));
}
/*
* "encrypt" routine (for backwards compatibility)
*/
-void
-encrypt(char *block, int flag)
+int
+encrypt(block, flag)
+ register char *block;
+ int flag;
{
register int i, j, k;
C_block cblock;
@@ -940,7 +960,8 @@ encrypt(char *block, int flag)
}
cblock.b[i] = k;
}
- des_cipher((char *)&cblock, (char *)&cblock, 0L, (flag ? -1: 1));
+ if (des_cipher((char *)&cblock, (char *)&cblock, 0L, (flag ? -1: 1)))
+ return (1);
for (i = 7; i >= 0; i--) {
k = cblock.b[i];
for (j = 7; j >= 0; j--) {
@@ -948,11 +969,15 @@ encrypt(char *block, int flag)
k >>= 1;
}
}
+ return (0);
}
#ifdef DEBUG
STATIC void
-prtab(const char *s, const unsigned char *t, int num_rows)
+prtab(s, t, num_rows)
+ char *s;
+ unsigned char *t;
+ int num_rows;
{
register int i, j;
diff --git a/missing/explicit_bzero.c b/missing/explicit_bzero.c
deleted file mode 100644
index a7ff9cb517..0000000000
--- a/missing/explicit_bzero.c
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __STDC_WANT_LIB_EXT1__
-#define __STDC_WANT_LIB_EXT1__ 1
-#endif
-
-#include "ruby/missing.h"
-#include <string.h>
-#ifdef HAVE_MEMSET_S
-# include <string.h>
-#endif
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-/* Similar to bzero(), but has a guarantee not to be eliminated from compiler
- optimization. */
-
-/* OS support note:
- * BSDs have explicit_bzero().
- * OS-X has memset_s().
- * Windows has SecureZeroMemory() since XP.
- * Linux has none. *Sigh*
- */
-
-/*
- * Following URL explains why memset_s is added to the standard.
- * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1381.pdf
- */
-
-#ifndef FUNC_UNOPTIMIZED
-# define FUNC_UNOPTIMIZED(x) x
-#endif
-
-#undef explicit_bzero
-#ifndef HAVE_EXPLICIT_BZERO
- #ifdef HAVE_MEMSET_S
-void
-explicit_bzero(void *b, size_t len)
-{
- memset_s(b, len, 0, len);
-}
- #elif defined SecureZeroMemory
-void
-explicit_bzero(void *b, size_t len)
-{
- SecureZeroMemory(b, len);
-}
-
- #elif defined HAVE_FUNC_WEAK
-
-/* A weak function never be optimized away. Even if nobody uses it. */
-WEAK(void ruby_explicit_bzero_hook_unused(void *buf, size_t len));
-void
-ruby_explicit_bzero_hook_unused(void *buf, size_t len)
-{
-}
-
-void
-explicit_bzero(void *b, size_t len)
-{
- memset(b, 0, len);
- ruby_explicit_bzero_hook_unused(b, len);
-}
-
- #else /* Your OS have no capability. Sigh. */
-
-FUNC_UNOPTIMIZED(void explicit_bzero(void *b, size_t len));
-#undef explicit_bzero
-
-void
-explicit_bzero(void *b, size_t len)
-{
- /*
- * volatile is not enough if the compiler has an LTO (link time
- * optimization). At least, the standard provides no guarantee.
- * However, gcc and major other compilers never optimize a volatile
- * variable away. So, using volatile is practically ok.
- */
- volatile char* p = (volatile char*)b;
-
- while(len) {
- *p = 0;
- p++;
- len--;
- }
-}
- #endif
-#endif /* HAVE_EXPLICIT_BZERO */
diff --git a/missing/lgamma_r.c b/missing/lgamma_r.c
index 01066d2930..6d2f38f40c 100644
--- a/missing/lgamma_r.c
+++ b/missing/lgamma_r.c
@@ -66,7 +66,7 @@ lgamma_r(double x, int *signp)
double i, f, s;
f = modf(-x, &i);
if (f == 0.0) { /* pole error */
- *signp = signbit(x) ? -1 : 1;
+ *signp = 1;
errno = ERANGE;
return HUGE_VAL;
}
diff --git a/missing/nextafter.c b/missing/nextafter.c
deleted file mode 100644
index dd1f1f2319..0000000000
--- a/missing/nextafter.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "ruby/missing.h"
-
-#include <math.h>
-#include <float.h>
-
-/* This function doesn't set errno. It should on POSIX, though. */
-
-double
-nextafter(double x, double y)
-{
- double x1, x2, d;
- int e;
-
- if (isnan(x))
- return x;
- if (isnan(y))
- return y;
-
- if (x == y)
- return y;
-
- if (x == 0) {
- /* the minimum "subnormal" float */
- x1 = ldexp(0.5, DBL_MIN_EXP - DBL_MANT_DIG + 1);
- if (x1 == 0)
- x1 = DBL_MIN; /* the minimum "normal" float */
- if (0 < y)
- return x1;
- else
- return -x1;
- }
-
- if (x < 0) {
- if (isinf(x))
- return -DBL_MAX;
- if (x == -DBL_MAX && y < 0 && isinf(y))
- return y;
- }
- else {
- if (isinf(x))
- return DBL_MAX;
- if (x == DBL_MAX && 0 < y && isinf(y))
- return y;
- }
-
- x1 = frexp(x, &e);
-
- if (x < y) {
- d = DBL_EPSILON/2;
- if (x1 == -0.5) {
- x1 *= 2;
- e--;
- }
- }
- else {
- d = -DBL_EPSILON/2;
- if (x1 == 0.5) {
- x1 *= 2;
- e--;
- }
- }
-
- if (e < DBL_MIN_EXP) {
- d = ldexp(d, DBL_MIN_EXP-e);
- }
-
- x2 = x1 + d;
-
- if (x2 == 0.0) {
- if (x1 < 0)
- return -0.0;
- else
- return +0.0;
- }
-
- return ldexp(x2, e);
-}
diff --git a/missing/os2.c b/missing/os2.c
new file mode 100644
index 0000000000..27dc2f1964
--- /dev/null
+++ b/missing/os2.c
@@ -0,0 +1,138 @@
+/* os/2 compatibility functions -- follows Ruby's license */
+
+#include "ruby.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <process.h>
+#include <limits.h>
+#include <errno.h>
+
+#define INCL_DOS
+#include <os2.h>
+
+int
+chown(char *path, int owner, int group)
+{
+ return 0;
+}
+
+#if 0
+int
+link(char *from, char *to)
+{
+ return -1;
+}
+#endif
+
+#if defined(EMX_REPLACE_GETCWD) && (EMX_REPLACE_GETCWD) \
+ || defined(EMX_REPLACE_CHDIR) && (EMX_REPLACE_CHDIR)
+#include <unistd.h>
+
+#if defined(EMX_REPLACE_GETCWD) && (EMX_REPLACE_GETCWD)
+/* to handle the drive letter and DBCS characters within a given path */
+char *
+getcwd(char *path, size_t len)
+{
+ return _getcwd2(path, (int)len);
+}
+#endif
+
+#if defined(EMX_REPLACE_CHDIR) && (EMX_REPLACE_CHDIR)
+/* to handle the drive letter and DBCS characters within a given path */
+int
+chdir(__const__ char *path)
+{
+ return _chdir2(path);
+}
+#endif
+#endif
+
+typedef char* CHARP;
+
+int
+do_spawn(cmd)
+char *cmd;
+{
+ register char **a;
+ register char *s;
+ char **argv;
+ char *shell, *sw, *cmd2;
+ int status;
+
+ if ((shell = getenv("RUBYSHELL")) != NULL && *shell != '\0') {
+ s = shell;
+ do
+ *s = isupper(*s) ? tolower(*s) : *s;
+ while (*++s);
+ if (strstr(shell, "cmd") || strstr(shell, "4os2"))
+ sw = "/c";
+ else
+ sw = "-c";
+ } else if ((shell = getenv("SHELL")) != NULL && *shell != '\0') {
+ s = shell;
+ do
+ *s = isupper(*s) ? tolower(*s) : *s;
+ while (*++s);
+ if (strstr(shell, "cmd") || strstr(shell, "4os2"))
+ sw = "/c";
+ else
+ sw = "-c";
+ } else if ((shell = getenv("COMSPEC")) != NULL && *shell != '\0') {
+ s = shell;
+ do
+ *s = isupper(*s) ? tolower(*s) : *s;
+ while (*++s);
+ if (strstr(shell, "cmd") || strstr(shell, "4os2"))
+ sw = "/c";
+ else
+ sw = "-c";
+ }
+ /* see if there are shell metacharacters in it */
+ /*SUPPRESS 530*/
+ /* for (s = cmd; *s && isalpha(*s); s++) ;
+ if (*s == '=')
+ goto doshell; */
+ for (s = cmd; *s; s++) {
+ if (*sw == '-' && *s != ' ' &&
+ !isalpha(*s) && index("$&*(){}[]'\";\\|?<>~`\n",*s)) {
+ if (*s == '\n' && !s[1]) {
+ *s = '\0';
+ break;
+ }
+ goto doshell;
+ } else if (*sw == '/' && *s != ' ' &&
+ !isalpha(*s) && index("^()<>|&\n",*s)) {
+ if (*s == '\n' && !s[1]) {
+ *s = '\0';
+ break;
+ }
+ doshell:
+ status = spawnlp(P_WAIT,shell,shell,sw,cmd,(char*)NULL);
+ return status;
+ }
+ }
+ argv = ALLOC_N(CHARP,(strlen(cmd) / 2 + 2));
+ cmd2 = ALLOC_N(char, (strlen(cmd) + 1));
+ strcpy(cmd2, cmd);
+ a = argv;
+ for (s = cmd2; *s;) {
+ while (*s && isspace(*s)) s++;
+ if (*s)
+ *(a++) = s;
+ while (*s && !isspace(*s)) s++;
+ if (*s)
+ *s++ = '\0';
+ }
+ *a = NULL;
+ if (argv[0]) {
+ if ((status = spawnvp(P_WAIT, argv[0], argv)) == -1) {
+ free(argv);
+ free(cmd2);
+ return -1;
+ }
+ }
+ free(cmd2);
+ free(argv);
+ return status;
+}
diff --git a/missing/setproctitle.c b/missing/setproctitle.c
index 602ddf105c..9dcf37560b 100644
--- a/missing/setproctitle.c
+++ b/missing/setproctitle.c
@@ -74,7 +74,6 @@
static char *argv_start = NULL;
static size_t argv_env_len = 0;
static size_t argv_len = 0;
-static char **argv1_addr = NULL;
#endif
#endif /* HAVE_SETPROCTITLE */
@@ -120,9 +119,7 @@ compat_init_setproctitle(int argc, char *argv[])
lastenvp = envp[i] + strlen(envp[i]);
}
- /* We keep argv[1], argv[2], etc. at this moment,
- because the ps command of AIX refers to them. */
- argv1_addr = &argv[1];
+ argv[1] = NULL;
argv_start = argv[0];
argv_len = lastargv - argv[0];
argv_env_len = lastenvp - argv[0];
@@ -165,8 +162,6 @@ setproctitle(const char *fmt, ...)
argvlen = len > argv_len ? argv_env_len : argv_len;
for(; len < argvlen; len++)
argv_start[len] = SPT_PADCHAR;
- /* argv[1], argv[2], etc. are no longer valid. */
- *argv1_addr = NULL;
#endif
#endif /* SPT_NONE */
diff --git a/nacl/GNUmakefile.in b/nacl/GNUmakefile.in
index 1fffcee898..c1aaa36c7c 100644
--- a/nacl/GNUmakefile.in
+++ b/nacl/GNUmakefile.in
@@ -7,58 +7,45 @@ include Makefile
NACL_SDK_ROOT=@NACL_SDK_ROOT@
NACL_TOOLCHAIN=@NACL_TOOLCHAIN@
NACL_TOOLCHAIN_DIR=$(NACL_SDK_ROOT)/toolchain/$(NACL_TOOLCHAIN)
-CXX=@CXX@
-
-# Don't override CC/LD/etc if they are already set to absolute
-# paths (this is the case when building in the naclports tree).
-ifeq ($(dir $(CC)),./)
CC:=$(NACL_TOOLCHAIN_DIR)/bin/$(CC)
-endif
-ifeq ($(dir $(CXX)),./)
-CXX:=$(NACL_TOOLCHAIN_DIR)/bin/$(CXX)
-endif
-ifeq ($(dir $(LD)),./)
LD:=$(NACL_TOOLCHAIN_DIR)/bin/$(LD)
-endif
-ifeq ($(dir $(NM)),./)
NM:=$(NACL_TOOLCHAIN_DIR)/bin/$(NM)
-endif
-ifeq ($(dir $(AR)),./)
AR:=$(NACL_TOOLCHAIN_DIR)/bin/$(AR)
-endif
-ifeq ($(dir $(AS)),./)
AS:=$(NACL_TOOLCHAIN_DIR)/bin/$(AS)
-endif
-ifeq ($(dir $(RANLIB)),./)
RANLIB:=$(NACL_TOOLCHAIN_DIR)/bin/$(RANLIB)
-endif
-ifeq ($(dir $(OBJDUMP)),./)
OBJDUMP:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJDUMP)
-endif
-ifeq ($(dir $(OBJCOPY)),./)
OBJCOPY:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJCOPY)
-endif
PYTHON=@PYTHON@
PPROGRAM=pepper-$(PROGRAM)
-PEPPER_LIBS=-lppapi -lnacl_io
-PROGRAM_NMF=$(PROGRAM:$(EXEEXT)=.nmf)
-PPROGRAM_NMF=$(PPROGRAM:$(EXEEXT)=.nmf)
+PEPPER_LIBS=-lppapi
+PROGRAM_NMF=$(PROGRAM:.nexe=.nmf)
+PPROGRAM_NMF=$(PPROGRAM:.nexe=.nmf)
GNUmakefile: $(srcdir)/nacl/GNUmakefile.in
$(PPROGRAM): $(PROGRAM) pepper_main.$(OBJEXT)
- $(Q)$(MAKE) $(MFLAGS) PROGRAM=$(PPROGRAM) MAINOBJ="pepper_main.$(OBJEXT)" LIBS="$(LIBS) $(PEPPER_LIBS)" CC="$(CXX)" program
-$(PROGRAM_NMF) $(PPROGRAM_NMF): $(@:.nmf=$(EXEEXT)) nacl/create_nmf.rb
+ $(Q)$(MAKE) $(MFLAGS) PROGRAM=$(PPROGRAM) MAINOBJ="pepper_main.$(OBJEXT)" LIBS="$(LIBS) $(PEPPER_LIBS)" program
+$(PROGRAM_NMF) $(PPROGRAM_NMF): $(@:.nmf=.nexe) nacl/create_nmf.rb
.PHONY: pprogram package show_naclflags
-.SUFFIXES: $(EXEEXT) .nmf
-$(EXEEXT).nmf:
+.SUFFIXES: .nexe .nmf
+.nexe.nmf:
$(ECHO) generating manifest $@
- $(Q)$(MINIRUBY) $(srcdir)/nacl/create_nmf.rb --verbose=$(V) $(@:.nmf=$(EXEEXT)) $@
+ $(Q)$(MINIRUBY) $(srcdir)/nacl/create_nmf.rb --verbose=$(V) $(@:.nmf=.nexe) $@
pepper_main.$(OBJEXT): $(srcdir)/nacl/pepper_main.c
@$(ECHO) compiling nacl/pepper_main.c
$(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $(srcdir)/nacl/pepper_main.c
+ruby.$(OBJEXT):
+ @$(ECHO) compiling $<
+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@.tmp -c $<
+ $(Q) $(OBJCOPY) --weaken-symbol=rb_load_file $@.tmp $@
+ @-$(RM) $@.tmp
+file.$(OBJEXT):
+ @$(ECHO) compiling $<
+ $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@.tmp -c $<
+ $(Q) $(OBJCOPY) --weaken-symbol=rb_file_load_ok $@.tmp $@
+ @-$(RM) $@.tmp
.rbconfig.time:
@$(MAKE) .rbconfig.raw.time RBCONFIG=.rbconfig.raw.time
diff --git a/nacl/README.nacl b/nacl/README.nacl
index 77140e0f75..471c3b5e5f 100644
--- a/nacl/README.nacl
+++ b/nacl/README.nacl
@@ -6,16 +6,16 @@
You need to install the following things before building NaCl port of Ruby.
* Ruby 1.9.3 or later
* Python 2.6 or later
-* NativeClient SDK pepper 37 or later
+* NativeClient SDK pepper 22 or later
* GNU make
== Steps
(1) Extract all files from the tarball:
$ tar xzf ruby-X.Y.Z.tar.gz
(2) Set NACL_SDK_ROOT environment variable to the path to the Native Client SDK you installed:
- $ export NACL_SDK_ROOT=/home/yugui/src/nacl_sdk/pepper_37
+ $ export NACL_SDK_ROOT=/home/yugui/src/nacl_sdk/pepper_16
(3) Configure
- $ ./configure --prefix=/tmp/nacl-ruby --host=x86_64-nacl --with-baseruby=/path/to/ruby-1.9.3-or-later
+ $ ./configure --prefix=/tmp/nacl-ruby --host=x86_64-nacl --with-baseruby=/path/to/ruby-1.9.3
(4) Make
$ make
$ make package
@@ -28,23 +28,6 @@ embeds Ruby", and libraries to $prefix. You can run it by the following steps:
(6) Visit the example.html on the web server by a browser that implements Pepper 18 or later.
-- e.g., Chrome 18 implements Pepper 18, Chrome 19 implements Pepper 19, ...
-=== Example Configurations
-* x86_32 Native Client
- $ ./configure --prefix=/tmp/nacl-ruby \
- --host=i686-nacl \
- --with-baseruby=/path/to/ruby-1.9.3-or-later
-* arm Native Client
- $ ./configure --prefix=/tmp/nacl-ruby \
- --host=arm-nacl \
- --with-newlib \
- --with-baseruby=/path/to/ruby-1.9.3-or-later
-* Portable Native Client
- $ ./configure --prefix=/tmp/nacl-ruby \
- --host=le32-nacl \
- --with-newlib \
- --with-static-linked-ext \
- --with-baseruby=/path/to/ruby-1.9.3-or-later
-
= Copyright
* Copyright 2012 Google Inc. All Rights Reserved.
* Author: yugui@google.com (Yugui Sonoda)
diff --git a/nacl/ioctl.h b/nacl/ioctl.h
new file mode 100644
index 0000000000..0a18eeb3f5
--- /dev/null
+++ b/nacl/ioctl.h
@@ -0,0 +1,7 @@
+// Copyright 2012 Google Inc. All Rights Reserved.
+// Author: yugui@google.com (Yugui Sonoda)
+#ifndef RUBY_NACL_IOCTL_H
+#define RUBY_NACL_IOCTL_H
+int ioctl(int fd, int request, ...);
+struct flock{};
+#endif
diff --git a/nacl/nacl-config.rb b/nacl/nacl-config.rb
index 66481301f5..b90c9ed100 100755..100644
--- a/nacl/nacl-config.rb
+++ b/nacl/nacl-config.rb
@@ -24,17 +24,17 @@ module NaClConfig
].find{|path| File.exist?(path) } or raise "No create_nmf found"
HOST_LIB = File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], HOST, "lib#{lib_suffix}")
- NACL_LIB = File.join(SDK_ROOT, 'lib', config['NACL_LIB_PATH'], 'Release')
-
INSTALL_PROGRAM = config['INSTALL_PROGRAM']
INSTALL_LIBRARY = config['INSTALL_DATA']
- if cpu_nick == 'x86_64' or cpu_nick == 'x86_32'
- SEL_LDR = File.join(SDK_ROOT, 'tools', "sel_ldr_#{cpu_nick}")
- IRT_CORE = File.join(SDK_ROOT, 'tools', "irt_core_#{cpu_nick}.nexe")
- raise "No sel_ldr found" if not File.executable?(SEL_LDR)
- raise "No irt_core found" if not File.exists?(IRT_CORE)
- end
+ SEL_LDR = [
+ File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], 'bin', "sel_ldr_#{cpu_nick}"),
+ File.join(SDK_ROOT, 'tools', "sel_ldr_#{cpu_nick}")
+ ].find{|path| File.executable?(path)} or raise "No sel_ldr found"
+ IRT_CORE = [
+ File.join(SDK_ROOT, 'toolchain', config['NACL_TOOLCHAIN'], 'bin', "irt_core_#{cpu_nick}.nexe"),
+ File.join(SDK_ROOT, 'tools', "irt_core_#{cpu_nick}.nexe")
+ ].find{|path| File.executable?(path)} or raise "No irt_core found"
RUNNABLE_LD = File.join(HOST_LIB, 'runnable-ld.so')
module_function
diff --git a/nacl/package.rb b/nacl/package.rb
index 9ba95888c4..f4f50f24ed 100644
--- a/nacl/package.rb
+++ b/nacl/package.rb
@@ -15,11 +15,7 @@ include NaClConfig
class Installation
include NaClConfig
- SRC_DIRS = [
- Dir.pwd,
- HOST_LIB,
- NACL_LIB,
- ]
+ SRC_DIRS = [ Dir.pwd, HOST_LIB ]
def initialize(destdir)
@destdir = destdir
diff --git a/nacl/pepper_main.c b/nacl/pepper_main.c
index 168e8f9fd4..c0e497b387 100644
--- a/nacl/pepper_main.c
+++ b/nacl/pepper_main.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <pthread.h>
#include <sys/stat.h>
-#include <sys/mount.h>
#include <fcntl.h>
#include <pthread.h>
#include "ppapi/c/pp_errors.h"
@@ -26,7 +25,6 @@
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/ppp_messaging.h"
-#include "nacl_io/nacl_io.h"
#include "verconf.h"
#include "ruby/ruby.h"
@@ -56,7 +54,6 @@ typedef struct PPP_Instance PPP_Instance;
#endif
static PP_Module module_id = 0;
-static PPB_GetInterface get_browser_interface = NULL;
static PPB_Core* core_interface = NULL;
static PPB_Messaging* messaging_interface = NULL;
static PPB_Var* var_interface = NULL;
@@ -213,7 +210,7 @@ pruby_async_return_value(void* data, VALUE value)
static struct PP_Var
pruby_cstr_to_var(const char* str)
{
-#ifndef PPB_VAR_INTERFACE_1_1
+#ifdef PPB_VAR_INTERFACE_1_0
if (var_interface != NULL)
return var_interface->VarFromUtf8(module_id, str, strlen(str));
return PP_MakeUndefined();
@@ -255,7 +252,7 @@ pruby_str_to_var(volatile VALUE str)
fprintf(stderr, "[BUG] Unexpected object type: %x\n", TYPE(str));
exit(EXIT_FAILURE);
}
-#ifndef PPB_VAR_INTERFACE_1_1
+#ifdef PPB_VAR_INTERFACE_1_0
if (var_interface != NULL) {
return var_interface->VarFromUtf8(module_id, RSTRING_PTR(str), RSTRING_LEN(str));
}
@@ -405,24 +402,6 @@ init_libraries_if_necessary(void)
}
static int
-reopen_fd(int fd, const char* path, int flags) {
- int fd2 = open(path, flags);
- if (fd2 < 0) {
- perror("open fd");
- return -1;
- }
- if (dup2(fd2, fd) < 0) {
- perror("dup2 fd");
- return -1;
- }
- if (close(fd2)) {
- perror("close old fd");
- return -1;
- }
- return fd;
-}
-
-static int
pruby_init(void)
{
RUBY_INIT_STACK;
@@ -510,34 +489,6 @@ Instance_DidCreate(PP_Instance instance,
{
struct PepperInstance* data = pruby_register_instance(instance);
current_instance = instance;
-
- nacl_io_init_ppapi(instance, get_browser_interface);
-
- if (mount("", "/dev2", "dev", 0, "")) {
- perror("mount dev");
- return PP_FALSE;
- }
- if (reopen_fd(0, "/dev2/stdin", O_RDONLY) < 0) {
- perror("reopen stdin");
- return PP_FALSE;
- }
- if (reopen_fd(1, "/dev2/stdout", O_WRONLY) < 0) {
- perror("reopen stdout");
- return PP_FALSE;
- }
- if (reopen_fd(2, "/dev2/console1", O_WRONLY) < 0) {
- perror("reopen stderr");
- return PP_FALSE;
- }
-
- /* TODO(yugui) Unmount original /dev */
-
- if (mount("/lib", "/lib", "httpfs",
- 0, "allow_cross_origin_requests=false")) {
- perror("mount httpfs");
- return PP_FALSE;
- }
-
return init_libraries_if_necessary() ? PP_FALSE : PP_TRUE;
}
@@ -566,7 +517,7 @@ static void Instance_DidDestroy(PP_Instance instance) {
* the top left of the plugin's coordinate system (not the page). If the
* plugin is invisible, @a clip will be (0, 0, 0, 0).
*/
-#ifndef PPP_INSTANCE_INTERFACE_1_1
+#ifdef PPP_INSTANCE_INTERFACE_1_0
static void
Instance_DidChangeView(PP_Instance instance,
const struct PP_Rect* position,
@@ -667,10 +618,9 @@ Messaging_HandleMessage(PP_Instance instance, struct PP_Var var_message)
* @return PP_OK on success, any other value on failure.
*/
PP_EXPORT int32_t
-PPP_InitializeModule(PP_Module a_module_id, PPB_GetInterface a_get_browser_interface)
+PPP_InitializeModule(PP_Module a_module_id, PPB_GetInterface get_browser_interface)
{
module_id = a_module_id;
- get_browser_interface = a_get_browser_interface;
core_interface = (PPB_Core*)(get_browser_interface(PPB_CORE_INTERFACE));
if (core_interface == NULL) return PP_ERROR_NOINTERFACE;
@@ -726,7 +676,195 @@ PPP_GetInterface(const char* interface_name)
* Called before the plugin module is unloaded.
*/
PP_EXPORT void
-PPP_ShutdownModule(void)
+PPP_ShutdownModule()
{
ruby_cleanup(0);
}
+
+/******************************************************************************
+ * Overwrites rb_file_load_ok
+ ******************************************************************************/
+
+static void
+load_ok_internal(void* data, int32_t unused)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ const char *const path = (const char*)instance->async_call_args;
+ PP_Resource req;
+ int result;
+
+ instance->url_loader = loader_interface->Create(instance->instance);
+ req = request_interface->Create(instance->instance);
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_METHOD, pruby_cstr_to_var("HEAD"));
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_URL, pruby_cstr_to_var(path));
+
+ result = loader_interface->Open(
+ instance->url_loader, req,
+ PP_MakeCompletionCallback(pruby_async_return_int, instance));
+ if (result != PP_OK_COMPLETIONPENDING) {
+ pruby_async_return_int(instance, result);
+ }
+}
+
+static void
+pruby_file_fetch_check_response(void* data, int32_t unused)
+{
+ /* PPAPI main thread */
+ PP_Resource res;
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+
+ res = loader_interface->GetResponseInfo(instance->url_loader);
+ if (res) {
+ struct PP_Var status =
+ response_interface->GetProperty(res, PP_URLRESPONSEPROPERTY_STATUSCODE);
+ if (status.type == PP_VARTYPE_INT32) {
+ pruby_async_return_int(instance, status.value.as_int / 100 == 2 ? PP_OK : PP_ERROR_FAILED);
+ return;
+ }
+ else {
+ messaging_interface->PostMessage(
+ instance->instance, pruby_cstr_to_var("Unexpected type: ResponseInfoInterface::GetProperty"));
+ }
+ }
+ else {
+ messaging_interface->PostMessage(
+ instance->instance, pruby_cstr_to_var("Failed to open URL: URLLoaderInterface::GetResponseInfo"));
+ }
+ pruby_async_return_int(instance, PP_ERROR_FAILED);
+}
+
+
+int
+rb_file_load_ok(const char *path)
+{
+ struct PepperInstance* const instance = GET_PEPPER_INSTANCE();
+ if (path[0] == '.' && path[1] == '/') path += 2;
+
+ instance->async_call_args = (void*)path;
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(load_ok_internal, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (instance->async_call_result.as_int != PP_OK) {
+ fprintf(stderr, "Failed to open URL: %d: %s\n",
+ instance->async_call_result.as_int, path);
+ return 0;
+ }
+
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_file_fetch_check_response, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ return instance->async_call_result.as_int == PP_OK;
+}
+
+/******************************************************************************
+ * Overwrites rb_load_file
+ ******************************************************************************/
+
+static void
+load_file_internal(void* data, int32_t unused)
+{
+ /* PPAPI main thread */
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ const char *const path = (const char*)instance->async_call_args;
+ PP_Resource req;
+ int result;
+
+ instance->url_loader = loader_interface->Create(instance->instance);
+ req = request_interface->Create(instance->instance);
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_METHOD, pruby_cstr_to_var("GET"));
+ request_interface->SetProperty(
+ req, PP_URLREQUESTPROPERTY_URL, pruby_cstr_to_var(path));
+
+ result = loader_interface->Open(
+ instance->url_loader, req,
+ PP_MakeCompletionCallback(pruby_async_return_int, instance));
+ if (result != PP_OK_COMPLETIONPENDING) {
+ pruby_async_return_int(instance, result);
+ }
+}
+
+static void
+load_file_read_contents_callback(void *data, int result)
+{
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ if (result > 0) {
+ rb_str_buf_cat(instance->async_call_result.as_value,
+ instance->buf, result);
+ loader_interface->ReadResponseBody(
+ instance->url_loader, instance->buf, 1000, PP_MakeCompletionCallback(load_file_read_contents_callback, instance));
+ }
+ else if (result == 0) {
+ pruby_async_return_value(data, instance->async_call_result.as_value);
+ }
+ else {
+ pruby_async_return_value(data, INT2FIX(result));
+ }
+}
+
+static void
+load_file_read_contents(void *data, int result)
+{
+ struct PepperInstance* const instance = (struct PepperInstance*)data;
+ instance->async_call_result.as_value = rb_str_new(0, 0);
+ loader_interface->ReadResponseBody(
+ instance->url_loader, instance->buf, 1000, PP_MakeCompletionCallback(load_file_read_contents_callback, instance));
+}
+
+void*
+rb_load_file(const char *path)
+{
+ const char *real_path;
+ struct PepperInstance* instance;
+ if (path[0] != '.' || path[1] != '/') path += 2;
+
+ instance = GET_PEPPER_INSTANCE();
+
+ instance->async_call_args = (void*)path;
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(load_file_internal, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (instance->async_call_result.as_int != PP_OK) {
+ fprintf(stderr, "Failed to open URL: %d: %s\n",
+ instance->async_call_result.as_int, path);
+ return 0;
+ }
+
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(pruby_file_fetch_check_response, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (instance->async_call_result.as_int != PP_OK) return 0;
+
+ core_interface->CallOnMainThread(
+ 0, PP_MakeCompletionCallback(load_file_read_contents, instance), 0);
+ if (pthread_cond_wait(&instance->cond, &instance->mutex)) {
+ perror("pepper-ruby:pthread_cond_wait");
+ return 0;
+ }
+ if (FIXNUM_P(instance->async_call_result.as_value)) {
+ return 0;
+ }
+ else if (RB_TYPE_P(instance->async_call_result.as_value, T_STRING)) {
+ VALUE str = instance->async_call_result.as_value;
+ extern void* rb_compile_cstr(const char *f, const char *s, int len, int line);
+ return rb_compile_cstr(path, RSTRING_PTR(str), RSTRING_LEN(str), 0);
+ }
+ else {
+ return 0;
+ }
+}
diff --git a/node.c b/node.c
index a8ccf05780..472a959ef9 100644
--- a/node.c
+++ b/node.c
@@ -20,50 +20,44 @@
#define A_INT(val) rb_str_catf(buf, "%d", (val))
#define A_LONG(val) rb_str_catf(buf, "%ld", (val))
#define A_LIT(lit) AR(rb_inspect(lit))
-#define A_NODE_HEADER(node, term) \
- rb_str_catf(buf, "@ %s (line: %d)"term, ruby_node_name(nd_type(node)), nd_line(node))
-#define A_FIELD_HEADER(len, name, term) \
- rb_str_catf(buf, "+- %.*s:"term, (len), (name))
-#define D_FIELD_HEADER(len, name, term) (A_INDENT, A_FIELD_HEADER(len, name, term))
+#define A_NODE_HEADER(node) \
+ rb_str_catf(buf, "@ %s (line: %d)", ruby_node_name(nd_type(node)), nd_line(node))
+#define A_FIELD_HEADER(name) \
+ rb_str_catf(buf, "+- %s:", (name))
-#define D_NULL_NODE (A_INDENT, A("(null node)\n"))
-#define D_NODE_HEADER(node) (A_INDENT, A_NODE_HEADER(node, "\n"))
+#define D_NULL_NODE A_INDENT; A("(null node)"); A("\n");
+#define D_NODE_HEADER(node) A_INDENT; A_NODE_HEADER(node); A("\n");
-#define COMPOUND_FIELD(len, name, block) \
+#define COMPOUND_FIELD(name, name2, block) \
do { \
- D_FIELD_HEADER((len), (name), "\n"); \
+ A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A("\n"); \
rb_str_cat2(indent, next_indent); \
block; \
rb_str_resize(indent, RSTRING_LEN(indent) - 4); \
} while (0)
-#define FIELD_NAME_DESC(name, ann) name " (" ann ")"
-#define FIELD_NAME_LEN(name, ann) (int)( \
- comment ? \
- rb_strlen_lit(FIELD_NAME_DESC(name, ann)) : \
- rb_strlen_lit(name))
-#define SIMPLE_FIELD(len, name) \
- for (D_FIELD_HEADER((len), (name), " "), field_flag = 1; \
- field_flag; /* should be optimized away */ \
- A("\n"), field_flag = 0)
-
-#define SIMPLE_FIELD1(name, ann) SIMPLE_FIELD(FIELD_NAME_LEN(name, ann), FIELD_NAME_DESC(name, ann))
-#define F_CUSTOM1(name, ann) SIMPLE_FIELD1(#name, ann)
-#define F_ID(name, ann) SIMPLE_FIELD1(#name, ann) A_ID(node->name)
-#define F_GENTRY(name, ann) SIMPLE_FIELD1(#name, ann) A_ID((node->name)->id)
-#define F_INT(name, ann) SIMPLE_FIELD1(#name, ann) A_INT(node->name)
-#define F_LONG(name, ann) SIMPLE_FIELD1(#name, ann) A_LONG(node->name)
-#define F_LIT(name, ann) SIMPLE_FIELD1(#name, ann) A_LIT(node->name)
-#define F_MSG(name, ann, desc) SIMPLE_FIELD1(#name, ann) A(desc)
+#define SIMPLE_FIELD(name, name2, block) \
+ do { \
+ A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A(" "); block; A("\n"); \
+ } while (0)
+
+#define F_CUSTOM1(name, ann, block) SIMPLE_FIELD(#name, #name " (" ann ")", block)
+#define F_ID(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_ID(node->name))
+#define F_GENTRY(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_ID((node->name)->id))
+#define F_INT(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_INT(node->name))
+#define F_LONG(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_LONG(node->name))
+#define F_LIT(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_LIT(node->name))
+#define F_MSG(name, ann, desc) SIMPLE_FIELD(#name, #name " (" ann ")", A(desc))
+
+#define F_CUSTOM2(name, ann, block) \
+ COMPOUND_FIELD(#name, #name " (" ann ")", block)
#define F_NODE(name, ann) \
- COMPOUND_FIELD(FIELD_NAME_LEN(#name, ann), \
- FIELD_NAME_DESC(#name, ann), \
- dump_node(buf, indent, comment, node->name))
+ COMPOUND_FIELD(#name, #name " (" ann ")", dump_node(buf, indent, comment, node->name))
#define ANN(ann) \
if (comment) { \
- A_INDENT; A("| # " ann "\n"); \
+ A_INDENT; A("| # "); A(ann); A("\n"); \
}
#define LAST_NODE (next_indent = " ")
@@ -94,7 +88,6 @@ add_id(VALUE buf, ID id)
static void
dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
{
- int field_flag;
const char *next_indent = "| ";
if (!node) {
@@ -158,10 +151,10 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("format: until [nd_cond]; [nd_body]; end");
ANN("example: until x == 1; foo; end");
loop:
- F_CUSTOM1(nd_state, "begin-end-while?") {
- A_INT((int)node->nd_state);
- A((node->nd_state == 1) ? " (while-end)" : " (begin-end-while)");
- }
+ F_CUSTOM1(nd_state, "begin-end-while?", {
+ A_INT((int)node->nd_state);
+ A((node->nd_state == 1) ? " (while-end)" : " (begin-end-while)");
+ });
F_NODE(nd_cond, "condition");
LAST_NODE;
F_NODE(nd_body, "body");
@@ -176,7 +169,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("for statement");
ANN("format: for * in [nd_iter] do [nd_body] end");
ANN("example: for i in 1..3 do foo end");
- iter:
+ iter:
F_NODE(nd_iter, "iteration receiver");
LAST_NODE;
F_NODE(nd_body, "body");
@@ -196,7 +189,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("return statement");
ANN("format: return [nd_stts]");
ANN("example: return 1");
- jump:
+ jump:
LAST_NODE;
F_NODE(nd_stts, "value");
break;
@@ -259,7 +252,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("|| operator");
ANN("format: [nd_1st] || [nd_2nd]");
ANN("example: foo && bar");
- andor:
+ andor:
F_NODE(nd_1st, "left expr");
LAST_NODE;
F_NODE(nd_2nd, "right expr");
@@ -304,15 +297,10 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("class variable assignment");
ANN("format: [nd_vid](cvar) = [nd_value]");
ANN("example: @@x = foo");
- asgn:
+ asgn:
F_ID(nd_vid, "variable");
LAST_NODE;
- if (node->nd_value == (NODE *)-1) {
- F_MSG(nd_value, "rvalue", "(required keyword argument)");
- }
- else {
- F_NODE(nd_value, "rvalue");
- }
+ F_NODE(nd_value, "rvalue");
break;
case NODE_GASGN:
@@ -354,20 +342,19 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
case NODE_OP_ASGN2:
ANN("attr assignment with operator");
ANN("format: [nd_value].[attr] [nd_next->nd_mid]= [nd_value]");
- ANN(" where [attr]: [nd_next->nd_vid]");
+ ANN(" where [attr] reader: [nd_next->nd_vid]");
+ ANN(" [attr] writer: [nd_next->nd_aid]");
ANN("example: struct.field += foo");
F_NODE(nd_recv, "receiver");
- F_CUSTOM1(nd_next->nd_vid, "attr") {
- if (node->nd_next->nd_aid) A("? ");
- A_ID(node->nd_next->nd_vid);
- }
- F_CUSTOM1(nd_next->nd_mid, "operator") {
- switch (node->nd_next->nd_mid) {
- case 0: A("0 (||)"); break;
- case 1: A("1 (&&)"); break;
- default: A_ID(node->nd_next->nd_mid);
- }
- }
+ F_ID(nd_next->nd_vid, "reader");
+ F_ID(nd_next->nd_aid, "writer");
+ F_CUSTOM1(nd_next->nd_mid, "operator", {
+ switch (node->nd_next->nd_mid) {
+ case 0: A("0 (||)"); break;
+ case 1: A("1 (&&)"); break;
+ default: A_ID(node->nd_next->nd_mid);
+ }
+ });
LAST_NODE;
F_NODE(nd_value, "rvalue");
break;
@@ -381,7 +368,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("assignment with || operator");
ANN("format: [nd_head] ||= [nd_value]");
ANN("example: foo ||= bar");
- asgn_andor:
+ asgn_andor:
F_NODE(nd_head, "variable");
LAST_NODE;
F_NODE(nd_value, "rvalue");
@@ -413,16 +400,6 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
F_ID(nd_mid, "method id");
break;
- case NODE_QCALL:
- ANN("safe method invocation");
- ANN("format: [nd_recv]&.[nd_mid]([nd_args])");
- ANN("example: obj&.foo(1)");
- F_ID(nd_mid, "method id");
- F_NODE(nd_recv, "receiver");
- LAST_NODE;
- F_NODE(nd_args, "arguments");
- break;
-
case NODE_SUPER:
ANN("super invocation");
ANN("format: super [nd_args]");
@@ -446,7 +423,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("return arguments");
ANN("format: [ [nd_head], [nd_next].. ] (length: [nd_alen])");
ANN("example: return 1, 2, 3");
- ary:
+ ary:
F_LONG(nd_alen, "length");
F_NODE(nd_head, "element");
LAST_NODE;
@@ -499,7 +476,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("class variable reference");
ANN("format: [nd_vid](cvar)");
ANN("example: @@x");
- var:
+ var:
F_ID(nd_vid, "local variable");
break;
@@ -514,20 +491,20 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("nth special variable reference");
ANN("format: $[nd_nth]");
ANN("example: $1, $2, ..");
- F_CUSTOM1(nd_nth, "variable") { A("$"); A_LONG(node->nd_nth); }
+ F_CUSTOM1(nd_nth, "variable", { A("$"); A_LONG(node->nd_nth); });
break;
case NODE_BACK_REF:
ANN("back special variable reference");
ANN("format: $[nd_nth]");
ANN("example: $&, $`, $', $+");
- F_CUSTOM1(nd_nth, "variable") {
- char name[3];
- name[0] = '$';
- name[1] = (char)node->nd_nth;
- name[2] = '\0';
- A(name);
- }
+ F_CUSTOM1(nd_nth, "variable", {
+ char name[3];
+ name[0] = '$';
+ name[1] = (char)node->nd_nth;
+ name[2] = '\0';
+ A(name);
+ });
break;
case NODE_MATCH:
@@ -569,7 +546,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("xstring literal");
ANN("format: [nd_lit]");
ANN("example: `foo`");
- lit:
+ lit:
F_LIT(nd_lit, "literal");
break;
@@ -597,11 +574,11 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("symbol literal with interpolation");
ANN("format: [nd_lit]");
ANN("example: :\"foo#{ bar }baz\"");
- dlit:
- F_LIT(nd_lit, "preceding string");
- F_NODE(nd_next->nd_head, "interpolation");
+ dlit:
+ F_LIT(nd_lit, "literal");
+ F_NODE(nd_next->nd_head, "preceding string");
LAST_NODE;
- F_NODE(nd_next->nd_next, "tailing strings");
+ F_NODE(nd_next->nd_next, "interpolation");
break;
case NODE_EVSTR:
@@ -754,7 +731,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("flip-flop condition (excl.)");
ANN("format: [nd_beg]...[nd_end]");
ANN("example: if (x==1)...(x==5); foo; end");
- dot:
+ dot:
F_NODE(nd_beg, "begin");
LAST_NODE;
F_NODE(nd_end, "end");
@@ -825,10 +802,8 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("format: BEGIN { [nd_head] }; [nd_body]");
ANN("example: bar; BEGIN { foo }");
F_NODE(nd_head, "prelude");
- F_NODE(nd_body, "body");
LAST_NODE;
-#define nd_compile_option u3.value
- F_LIT(nd_compile_option, "compile_option");
+ F_NODE(nd_body, "body");
break;
case NODE_LAMBDA:
@@ -891,15 +866,15 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
case NODE_SCOPE:
ANN("new scope");
ANN("format: [nd_tbl]: local table, [nd_args]: arguments, [nd_body]: body");
- F_CUSTOM1(nd_tbl, "local table") {
- ID *tbl = node->nd_tbl;
- int i;
- int size = tbl ? (int)*tbl++ : 0;
- if (size == 0) A("(empty)");
- for (i = 0; i < size; i++) {
+ F_CUSTOM1(nd_tbl, "local table", {
+ ID *tbl = node->nd_tbl;
+ int i;
+ int size = tbl ? (int)*tbl++ : 0;
+ if (size == 0) A("(empty)");
+ for (i = 0; i < size; i++) {
A_ID(tbl[i]); if (i < size - 1) A(",");
- }
- }
+ }
+ });
F_NODE(nd_args, "arguments");
LAST_NODE;
F_NODE(nd_body, "body");
@@ -922,179 +897,3 @@ rb_parser_dump_tree(NODE *node, int comment)
dump_node(buf, rb_str_new_cstr("# "), comment, node);
return buf;
}
-
-void
-rb_gc_free_node(VALUE obj)
-{
- switch (nd_type(obj)) {
- case NODE_SCOPE:
- if (RNODE(obj)->nd_tbl) {
- xfree(RNODE(obj)->nd_tbl);
- }
- break;
- case NODE_ARGS:
- if (RNODE(obj)->nd_ainfo) {
- xfree(RNODE(obj)->nd_ainfo);
- }
- break;
- case NODE_ALLOCA:
- xfree(RNODE(obj)->u1.node);
- break;
- }
-}
-
-size_t
-rb_node_memsize(VALUE obj)
-{
- size_t size = 0;
- switch (nd_type(obj)) {
- case NODE_SCOPE:
- if (RNODE(obj)->nd_tbl) {
- size += (RNODE(obj)->nd_tbl[0]+1) * sizeof(*RNODE(obj)->nd_tbl);
- }
- break;
- case NODE_ARGS:
- if (RNODE(obj)->nd_ainfo) {
- size += sizeof(*RNODE(obj)->nd_ainfo);
- }
- break;
- case NODE_ALLOCA:
- size += RNODE(obj)->nd_cnt * sizeof(VALUE);
- break;
- }
- return size;
-}
-
-VALUE
-rb_gc_mark_node(NODE *obj)
-{
- switch (nd_type(obj)) {
- case NODE_IF: /* 1,2,3 */
- case NODE_FOR:
- case NODE_ITER:
- case NODE_WHEN:
- case NODE_MASGN:
- case NODE_RESCUE:
- case NODE_RESBODY:
- case NODE_CLASS:
- case NODE_BLOCK_PASS:
- rb_gc_mark(RNODE(obj)->u2.value);
- /* fall through */
- case NODE_BLOCK: /* 1,3 */
- case NODE_ARRAY:
- case NODE_DSTR:
- case NODE_DXSTR:
- case NODE_DREGX:
- case NODE_DREGX_ONCE:
- case NODE_ENSURE:
- case NODE_CALL:
- case NODE_DEFS:
- case NODE_OP_ASGN1:
- rb_gc_mark(RNODE(obj)->u1.value);
- /* fall through */
- case NODE_SUPER: /* 3 */
- case NODE_FCALL:
- case NODE_DEFN:
- case NODE_ARGS_AUX:
- return RNODE(obj)->u3.value;
-
- case NODE_WHILE: /* 1,2 */
- case NODE_UNTIL:
- case NODE_AND:
- case NODE_OR:
- case NODE_CASE:
- case NODE_SCLASS:
- case NODE_DOT2:
- case NODE_DOT3:
- case NODE_FLIP2:
- case NODE_FLIP3:
- case NODE_MATCH2:
- case NODE_MATCH3:
- case NODE_OP_ASGN_OR:
- case NODE_OP_ASGN_AND:
- case NODE_MODULE:
- case NODE_ALIAS:
- case NODE_VALIAS:
- case NODE_ARGSCAT:
- rb_gc_mark(RNODE(obj)->u1.value);
- /* fall through */
- case NODE_GASGN: /* 2 */
- case NODE_LASGN:
- case NODE_DASGN:
- case NODE_DASGN_CURR:
- case NODE_IASGN:
- case NODE_IASGN2:
- case NODE_CVASGN:
- case NODE_COLON3:
- case NODE_OPT_N:
- case NODE_EVSTR:
- case NODE_UNDEF:
- case NODE_POSTEXE:
- return RNODE(obj)->u2.value;
-
- case NODE_HASH: /* 1 */
- case NODE_LIT:
- case NODE_STR:
- case NODE_XSTR:
- case NODE_DEFINED:
- case NODE_MATCH:
- case NODE_RETURN:
- case NODE_BREAK:
- case NODE_NEXT:
- case NODE_YIELD:
- case NODE_COLON2:
- case NODE_SPLAT:
- case NODE_TO_ARY:
- return RNODE(obj)->u1.value;
-
- case NODE_SCOPE: /* 2,3 */
- case NODE_CDECL:
- case NODE_OPT_ARG:
- rb_gc_mark(RNODE(obj)->u3.value);
- return RNODE(obj)->u2.value;
-
- case NODE_ARGS: /* custom */
- {
- struct rb_args_info *args = obj->u3.args;
- if (args) {
- if (args->pre_init) rb_gc_mark((VALUE)args->pre_init);
- if (args->post_init) rb_gc_mark((VALUE)args->post_init);
- if (args->opt_args) rb_gc_mark((VALUE)args->opt_args);
- if (args->kw_args) rb_gc_mark((VALUE)args->kw_args);
- if (args->kw_rest_arg) rb_gc_mark((VALUE)args->kw_rest_arg);
- }
- }
- return RNODE(obj)->u2.value;
-
- case NODE_ZARRAY: /* - */
- case NODE_ZSUPER:
- case NODE_VCALL:
- case NODE_GVAR:
- case NODE_LVAR:
- case NODE_DVAR:
- case NODE_IVAR:
- case NODE_CVAR:
- case NODE_NTH_REF:
- case NODE_BACK_REF:
- case NODE_REDO:
- case NODE_RETRY:
- case NODE_SELF:
- case NODE_NIL:
- case NODE_TRUE:
- case NODE_FALSE:
- case NODE_ERRINFO:
- case NODE_BLOCK_ARG:
- break;
- case NODE_ALLOCA:
- rb_gc_mark_locations((VALUE*)RNODE(obj)->u1.value,
- (VALUE*)RNODE(obj)->u1.value + RNODE(obj)->u3.cnt);
- rb_gc_mark(RNODE(obj)->u2.value);
- break;
-
- default: /* unlisted NODE */
- rb_gc_mark_maybe(RNODE(obj)->u1.value);
- rb_gc_mark_maybe(RNODE(obj)->u2.value);
- rb_gc_mark_maybe(RNODE(obj)->u3.value);
- }
- return 0;
-}
diff --git a/node.h b/node.h
index 8fbe226a87..9ee07048c2 100644
--- a/node.h
+++ b/node.h
@@ -96,8 +96,6 @@ enum node_type {
#define NODE_FCALL NODE_FCALL
NODE_VCALL,
#define NODE_VCALL NODE_VCALL
- NODE_QCALL,
-#define NODE_QCALL NODE_QCALL
NODE_SUPER,
#define NODE_SUPER NODE_SUPER
NODE_ZSUPER,
@@ -194,6 +192,8 @@ enum node_type {
#define NODE_COLON2 NODE_COLON2
NODE_COLON3,
#define NODE_COLON3 NODE_COLON3
+ NODE_CREF,
+#define NODE_CREF NODE_CREF
NODE_DOT2,
#define NODE_DOT2 NODE_DOT2
NODE_DOT3,
@@ -220,6 +220,10 @@ enum node_type {
#define NODE_ALLOCA NODE_ALLOCA
NODE_BMETHOD,
#define NODE_BMETHOD NODE_BMETHOD
+ NODE_MEMO,
+#define NODE_MEMO NODE_MEMO
+ NODE_IFUNC,
+#define NODE_IFUNC NODE_IFUNC
NODE_DSYM,
#define NODE_DSYM NODE_DSYM
NODE_ATTRASGN,
@@ -261,12 +265,16 @@ typedef struct RNode {
#define RNODE(obj) (R_CAST(RNode)(obj))
-/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTED, 10: EXIVAR, 11: FREEZE */
+/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTERD, 10: EXIVAR, 11: FREEZE */
/* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE|NODE_FL_CREF_PUSHED_BY_EVAL,
* 8..14: nd_type,
- * 15..: nd_line
+ * 15..: nd_line or
+ * 15: NODE_FL_CREF_PUSHED_BY_EVAL
+ * 16: NODE_FL_CREF_OMOD_SHARED
*/
-#define NODE_FL_NEWLINE (((VALUE)1)<<7)
+#define NODE_FL_NEWLINE (((VALUE)1)<<7)
+#define NODE_FL_CREF_PUSHED_BY_EVAL (((VALUE)1)<<15)
+#define NODE_FL_CREF_OMOD_SHARED (((VALUE)1)<<16)
#define NODE_TYPESHIFT 8
#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
@@ -277,11 +285,11 @@ typedef struct RNode {
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
-#define nd_line(n) (int)(((SIGNED_VALUE)RNODE(n)->flags)>>NODE_LSHIFT)
+#define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
#define nd_set_line(n,l) \
- RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
+ RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
-#define nd_refinements_ nd_reserved
+#define nd_refinements nd_reserved
#define nd_head u1.node
#define nd_alen u2.argc
@@ -339,7 +347,7 @@ typedef struct RNode {
#define nd_super u3.node
#define nd_modl u1.id
-#define nd_clss_ u1.value
+#define nd_clss u1.value
#define nd_beg u1.node
#define nd_end u2.node
@@ -351,12 +359,13 @@ typedef struct RNode {
#define nd_tag u1.id
#define nd_tval u2.value
-#define nd_visi_ u2.argc
+#define nd_visi u2.argc
#define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
#define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
#define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
+#define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
#define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
#define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
#define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
@@ -394,8 +403,8 @@ typedef struct RNode {
#define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
#define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
#define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
-#define NEW_OP_ASGN2(r,t,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o,t))
-#define NEW_OP_ASGN22(i,o,t) NEW_NODE(NODE_OP_ASGN2,i,o,t)
+#define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
+#define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
#define NEW_OP_CDECL(v,op,val) NEW_NODE(NODE_OP_CDECL,v,val,op)
@@ -440,6 +449,7 @@ typedef struct RNode {
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
+#define NEW_CREF(a) NEW_NODE(NODE_CREF,a,0,0)
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
#define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
@@ -452,7 +462,15 @@ typedef struct RNode {
#define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
-#define NEW_PRELUDE(p,b,o) NEW_NODE(NODE_PRELUDE,p,b,o)
+#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
+#define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
+
+#define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
+#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
+#define NEW_MEMO_FOR(type, value) \
+ (rb_ary_set_len(((value) = rb_ary_tmp_new(roomof(type, VALUE))), \
+ roomof(type, VALUE)), \
+ MEMO_FOR(type, value))
RUBY_SYMBOL_EXPORT_BEGIN
@@ -465,11 +483,11 @@ VALUE rb_parser_dump_tree(NODE *node, int comment);
NODE *rb_parser_append_print(VALUE, NODE *);
NODE *rb_parser_while_loop(VALUE, NODE *, int, int);
-NODE *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
-NODE *rb_parser_compile_string(VALUE, const char*, VALUE, int);
-NODE *rb_parser_compile_file(VALUE, const char*, VALUE, int);
-NODE *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
-NODE *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
+NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int);
+NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int);
+NODE *rb_parser_compile_file(volatile VALUE, const char*, VALUE, int);
+NODE *rb_parser_compile_string_path(volatile VALUE vparser, VALUE fname, VALUE src, int line);
+NODE *rb_parser_compile_file_path(volatile VALUE vparser, VALUE fname, VALUE input, int line);
NODE *rb_compile_cstr(const char*, const char*, int, int);
NODE *rb_compile_string(const char*, VALUE, int);
@@ -477,10 +495,16 @@ NODE *rb_compile_file(const char*, VALUE, int);
NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
-void rb_gc_free_node(VALUE obj);
-size_t rb_node_memsize(VALUE obj);
-VALUE rb_gc_mark_node(NODE *obj);
+struct rb_global_entry {
+ struct rb_global_variable *var;
+ ID id;
+};
+
+struct rb_global_entry *rb_global_entry(ID);
+VALUE rb_gvar_get(struct rb_global_entry *);
+VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
+VALUE rb_gvar_defined(struct rb_global_entry *);
const struct kwtable *rb_reserved_word(const char *, unsigned int);
struct rb_args_info {
@@ -506,7 +530,6 @@ void *rb_parser_malloc(struct parser_params *, size_t);
void *rb_parser_realloc(struct parser_params *, void *, size_t);
void *rb_parser_calloc(struct parser_params *, size_t, size_t);
void rb_parser_free(struct parser_params *, void *);
-void rb_parser_printf(struct parser_params *parser, const char *fmt, ...);
RUBY_SYMBOL_EXPORT_END
diff --git a/numeric.c b/numeric.c
index c1c673927c..734ab3455b 100644
--- a/numeric.c
+++ b/numeric.c
@@ -9,8 +9,10 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "ruby/util.h"
+#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <math.h>
@@ -28,6 +30,10 @@
#include <ieeefp.h>
#endif
+#if defined HAVE_FINITE && !defined finite && !defined _WIN32
+extern int finite(double);
+#endif
+
/* use IEEE 64bit values if not defined */
#ifndef FLT_RADIX
#define FLT_RADIX 2
@@ -99,10 +105,7 @@ static VALUE fix_uminus(VALUE num);
static VALUE fix_mul(VALUE x, VALUE y);
static VALUE int_pow(long x, unsigned long y);
-static ID id_coerce, id_div, id_divmod;
-#define id_to_i idTo_i
-#define id_eq idEq
-#define id_cmp idCmp
+static ID id_coerce, id_to_i, id_eq, id_div;
VALUE rb_cNumeric;
VALUE rb_cFloat;
@@ -112,7 +115,7 @@ VALUE rb_cFixnum;
VALUE rb_eZeroDivError;
VALUE rb_eFloatDomainError;
-static ID id_to, id_by;
+static VALUE sym_to, sym_by;
void
rb_num_zerodiv(void)
@@ -138,7 +141,7 @@ rb_num_to_uint(VALUE val, unsigned int *ret)
}
if (RB_TYPE_P(val, T_BIGNUM)) {
- if (BIGNUM_NEGATIVE_P(val)) return NUMERR_NEGATIVE;
+ if (RBIGNUM_NEGATIVE_P(val)) return NUMERR_NEGATIVE;
#if SIZEOF_INT < SIZEOF_LONG
/* long is 64bit */
return NUMERR_TOOLARGE;
@@ -154,17 +157,6 @@ rb_num_to_uint(VALUE val, unsigned int *ret)
#define method_basic_p(klass) rb_method_basic_definition_p(klass, mid)
-static VALUE
-compare_with_zero(VALUE num, ID mid)
-{
- VALUE zero = INT2FIX(0);
- VALUE r = rb_check_funcall(num, mid, 1, &zero);
- if (r == Qundef) {
- rb_cmperr(mid, zero);
- }
- return r;
-}
-
static inline int
positive_int_p(VALUE num)
{
@@ -176,9 +168,9 @@ positive_int_p(VALUE num)
}
else if (RB_TYPE_P(num, T_BIGNUM)) {
if (method_basic_p(rb_cBignum))
- return BIGNUM_POSITIVE_P(num);
+ return RBIGNUM_POSITIVE_P(num);
}
- return RTEST(compare_with_zero(num, mid));
+ return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
}
static inline int
@@ -192,9 +184,9 @@ negative_int_p(VALUE num)
}
else if (RB_TYPE_P(num, T_BIGNUM)) {
if (method_basic_p(rb_cBignum))
- return BIGNUM_NEGATIVE_P(num);
+ return RBIGNUM_NEGATIVE_P(num);
}
- return RTEST(compare_with_zero(num, mid));
+ return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
}
int
@@ -207,7 +199,7 @@ rb_num_negative_p(VALUE num)
* call-seq:
* num.coerce(numeric) -> array
*
- * If a +numeric+ is the same type as +num+, returns an array containing
+ * If a +numeric is the same type as +num+, returns an array containing
* +numeric+ and +num+. Otherwise, returns an array with both a +numeric+ and
* +num+ represented as Float objects.
*
@@ -236,31 +228,18 @@ coerce_body(VALUE *x)
return rb_funcall(x[1], id_coerce, 1, x[0]);
}
-NORETURN(static void coerce_failed(VALUE x, VALUE y));
-static void
-coerce_failed(VALUE x, VALUE y)
-{
- if (SPECIAL_CONST_P(y) || BUILTIN_TYPE(y) == T_FLOAT) {
- y = rb_inspect(y);
- }
- else {
- y = rb_obj_class(y);
- }
- rb_raise(rb_eTypeError, "%"PRIsVALUE" can't be coerced into %"PRIsVALUE,
- y, rb_obj_class(x));
-}
-
static VALUE
coerce_rescue(VALUE *x)
{
- coerce_failed(x[0], x[1]);
- return Qnil; /* dummy */
-}
+ volatile VALUE v = rb_inspect(x[1]);
-static VALUE
-coerce_rescue_quiet(VALUE *x)
-{
- return Qundef;
+ rb_raise(rb_eTypeError, "%s can't be coerced into %s",
+ rb_special_const_p(x[1])?
+ RSTRING_PTR(v):
+ rb_obj_classname(x[1]),
+ rb_obj_classname(x[0]));
+
+ return Qnil; /* dummy */
}
static int
@@ -278,20 +257,11 @@ do_coerce(VALUE *x, VALUE *y, int err)
return FALSE;
}
- ary = rb_rescue(coerce_body, (VALUE)a, err ? coerce_rescue : coerce_rescue_quiet, (VALUE)a);
- if (ary == Qundef) {
- rb_warn("Numerical comparison operators will no more rescue exceptions of #coerce");
- rb_warn("in the next release. Return nil in #coerce if the coercion is impossible.");
- return FALSE;
- }
+ ary = rb_rescue(coerce_body, (VALUE)a, err ? coerce_rescue : 0, (VALUE)a);
if (!RB_TYPE_P(ary, T_ARRAY) || RARRAY_LEN(ary) != 2) {
if (err) {
rb_raise(rb_eTypeError, "coerce must return [x, y]");
}
- else if (!NIL_P(ary)) {
- rb_warn("Bad return value for #coerce, called by numerical comparison operators.");
- rb_warn("#coerce must return [x, y]. The next release will raise an error for this.");
- }
return FALSE;
}
@@ -341,9 +311,9 @@ num_sadded(VALUE x, VALUE name)
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
rb_remove_method_id(rb_singleton_class(x), mid);
rb_raise(rb_eTypeError,
- "can't define singleton method \"%"PRIsVALUE"\" for %"PRIsVALUE,
- rb_id2str(mid),
- rb_obj_class(x));
+ "can't define singleton method \"%s\" for %s",
+ rb_id2name(mid),
+ rb_obj_classname(x));
UNREACHABLE;
}
@@ -356,7 +326,7 @@ num_sadded(VALUE x, VALUE name)
static VALUE
num_init_copy(VALUE x, VALUE y)
{
- rb_raise(rb_eTypeError, "can't copy %"PRIsVALUE, rb_obj_class(x));
+ rb_raise(rb_eTypeError, "can't copy %s", rb_obj_classname(x));
UNREACHABLE;
}
@@ -457,7 +427,7 @@ num_modulo(VALUE x, VALUE y)
{
return rb_funcall(x, '-', 1,
rb_funcall(y, '*', 1,
- rb_funcall(x, id_div, 1, y)));
+ rb_funcall(x, rb_intern("div"), 1, y)));
}
/*
@@ -579,7 +549,7 @@ static VALUE
num_abs(VALUE num)
{
if (negative_int_p(num)) {
- return rb_funcall(num, idUMinus, 0);
+ return rb_funcall(num, rb_intern("-@"), 0);
}
return num;
}
@@ -618,7 +588,7 @@ num_zero_p(VALUE num)
static VALUE
num_nonzero_p(VALUE num)
{
- if (RTEST(rb_funcallv(num, rb_intern("zero?"), 0, 0))) {
+ if (RTEST(rb_funcall(num, rb_intern("zero?"), 0, 0))) {
return Qnil;
}
return num;
@@ -638,43 +608,7 @@ num_nonzero_p(VALUE num)
static VALUE
num_to_int(VALUE num)
{
- return rb_funcallv(num, id_to_i, 0, 0);
-}
-
-/*
- * call-seq:
- * num.positive? -> true or false
- *
- * Returns +true+ if +num+ is greater than 0.
- */
-
-static VALUE
-num_positive_p(VALUE num)
-{
- const ID mid = '>';
-
- if (FIXNUM_P(num)) {
- if (method_basic_p(rb_cFixnum))
- return (SIGNED_VALUE)num > (SIGNED_VALUE)INT2FIX(0) ? Qtrue : Qfalse;
- }
- else if (RB_TYPE_P(num, T_BIGNUM)) {
- if (method_basic_p(rb_cBignum))
- return BIGNUM_POSITIVE_P(num) && !rb_bigzero_p(num) ? Qtrue : Qfalse;
- }
- return compare_with_zero(num, mid);
-}
-
-/*
- * call-seq:
- * num.negative? -> true or false
- *
- * Returns +true+ if +num+ is less than 0.
- */
-
-static VALUE
-num_negative_p(VALUE num)
-{
- return negative_int_p(num) ? Qtrue : Qfalse;
+ return rb_funcall(num, id_to_i, 0, 0);
}
@@ -715,6 +649,7 @@ rb_float_new_in_heap(double d)
static VALUE
flo_to_s(VALUE flt)
{
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
enum {decimal_mant = DBL_MANT_DIG-DBL_DIG};
enum {float_dig = DBL_DIG+1};
char buf[float_dig + (decimal_mant + CHAR_BIT - 1) / CHAR_BIT + 10];
@@ -932,12 +867,6 @@ flodivmod(double x, double y, double *divp, double *modp)
{
double div, mod;
- if (isnan(y)) {
- /* y is NaN so all results are NaN */
- if (modp) *modp = y;
- if (divp) *divp = y;
- return;
- }
if (y == 0.0) rb_num_zerodiv();
if ((x == 0.0) || (isinf(y) && !isinf(x)))
mod = x;
@@ -951,7 +880,7 @@ flodivmod(double x, double y, double *divp, double *modp)
mod = x - z * y;
#endif
}
- if (isinf(x) && !isinf(y))
+ if (isinf(x) && !isinf(y) && !isnan(y))
div = x;
else
div = (x - mod) / y;
@@ -1044,7 +973,7 @@ flo_divmod(VALUE x, VALUE y)
fy = RFLOAT_VALUE(y);
}
else {
- return rb_num_coerce_bin(x, y, id_divmod);
+ return rb_num_coerce_bin(x, y, rb_intern("divmod"));
}
flodivmod(RFLOAT_VALUE(x), fy, &div, &mod);
a = dbl2ival(div);
@@ -1065,25 +994,24 @@ flo_divmod(VALUE x, VALUE y)
static VALUE
flo_pow(VALUE x, VALUE y)
{
- double dx, dy;
if (RB_TYPE_P(y, T_FIXNUM)) {
- dx = RFLOAT_VALUE(x);
- dy = (double)FIX2LONG(y);
+ return DBL2NUM(pow(RFLOAT_VALUE(x), (double)FIX2LONG(y)));
}
else if (RB_TYPE_P(y, T_BIGNUM)) {
- dx = RFLOAT_VALUE(x);
- dy = rb_big2dbl(y);
+ return DBL2NUM(pow(RFLOAT_VALUE(x), rb_big2dbl(y)));
}
else if (RB_TYPE_P(y, T_FLOAT)) {
- dx = RFLOAT_VALUE(x);
- dy = RFLOAT_VALUE(y);
- if (dx < 0 && dy != round(dy))
- return rb_funcall(rb_complex_raw1(x), idPow, 1, y);
+ {
+ double dx = RFLOAT_VALUE(x);
+ double dy = RFLOAT_VALUE(y);
+ if (dx < 0 && dy != round(dy))
+ return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
+ return DBL2NUM(pow(dx, dy));
+ }
}
else {
- return rb_num_coerce_bin(x, y, idPow);
+ return rb_num_coerce_bin(x, y, rb_intern("**"));
}
- return DBL2NUM(pow(dx, dy));
}
/*
@@ -1171,21 +1099,15 @@ flo_eq(VALUE x, VALUE y)
* float.hash -> integer
*
* Returns a hash code for this float.
- *
- * See also Object#hash.
*/
static VALUE
flo_hash(VALUE num)
{
- return rb_dbl_hash(RFLOAT_VALUE(num));
-}
-
-VALUE
-rb_dbl_hash(double d)
-{
+ double d;
st_index_t hash;
+ d = RFLOAT_VALUE(num);
/* normalize -0.0 to 0.0 */
if (d == 0.0) d = 0.0;
hash = rb_memhash(&d, sizeof(d));
@@ -1242,7 +1164,7 @@ flo_cmp(VALUE x, VALUE y)
if (a > 0.0) return INT2FIX(1);
return INT2FIX(-1);
}
- return rb_num_coerce_cmp(x, y, id_cmp);
+ return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
}
return rb_dbl_cmp(a, b);
}
@@ -1313,7 +1235,7 @@ flo_ge(VALUE x, VALUE y)
#endif
}
else {
- return rb_num_coerce_relop(x, y, idGE);
+ return rb_num_coerce_relop(x, y, rb_intern(">="));
}
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(a)) return Qfalse;
@@ -1387,7 +1309,7 @@ flo_le(VALUE x, VALUE y)
#endif
}
else {
- return rb_num_coerce_relop(x, y, idLE);
+ return rb_num_coerce_relop(x, y, rb_intern("<="));
}
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(a)) return Qfalse;
@@ -1535,8 +1457,8 @@ flo_is_finite_p(VALUE num)
{
double value = RFLOAT_VALUE(num);
-#ifdef HAVE_ISFINITE
- if (!isfinite(value))
+#if HAVE_FINITE
+ if (!finite(value))
return Qfalse;
#else
if (isinf(value) || isnan(value))
@@ -1548,119 +1470,6 @@ flo_is_finite_p(VALUE num)
/*
* call-seq:
- * float.next_float -> float
- *
- * Returns the next representable floating-point number.
- *
- * Float::MAX.next_float and Float::INFINITY.next_float is Float::INFINITY.
- *
- * Float::NAN.next_float is Float::NAN.
- *
- * For example:
- *
- * p 0.01.next_float #=> 0.010000000000000002
- * p 1.0.next_float #=> 1.0000000000000002
- * p 100.0.next_float #=> 100.00000000000001
- *
- * p 0.01.next_float - 0.01 #=> 1.734723475976807e-18
- * p 1.0.next_float - 1.0 #=> 2.220446049250313e-16
- * p 100.0.next_float - 100.0 #=> 1.4210854715202004e-14
- *
- * f = 0.01; 20.times { printf "%-20a %s\n", f, f.to_s; f = f.next_float }
- * #=> 0x1.47ae147ae147bp-7 0.01
- * # 0x1.47ae147ae147cp-7 0.010000000000000002
- * # 0x1.47ae147ae147dp-7 0.010000000000000004
- * # 0x1.47ae147ae147ep-7 0.010000000000000005
- * # 0x1.47ae147ae147fp-7 0.010000000000000007
- * # 0x1.47ae147ae148p-7 0.010000000000000009
- * # 0x1.47ae147ae1481p-7 0.01000000000000001
- * # 0x1.47ae147ae1482p-7 0.010000000000000012
- * # 0x1.47ae147ae1483p-7 0.010000000000000014
- * # 0x1.47ae147ae1484p-7 0.010000000000000016
- * # 0x1.47ae147ae1485p-7 0.010000000000000018
- * # 0x1.47ae147ae1486p-7 0.01000000000000002
- * # 0x1.47ae147ae1487p-7 0.010000000000000021
- * # 0x1.47ae147ae1488p-7 0.010000000000000023
- * # 0x1.47ae147ae1489p-7 0.010000000000000024
- * # 0x1.47ae147ae148ap-7 0.010000000000000026
- * # 0x1.47ae147ae148bp-7 0.010000000000000028
- * # 0x1.47ae147ae148cp-7 0.01000000000000003
- * # 0x1.47ae147ae148dp-7 0.010000000000000031
- * # 0x1.47ae147ae148ep-7 0.010000000000000033
- *
- * f = 0.0
- * 100.times { f += 0.1 }
- * p f #=> 9.99999999999998 # should be 10.0 in the ideal world.
- * p 10-f #=> 1.9539925233402755e-14 # the floating-point error.
- * p(10.0.next_float-10) #=> 1.7763568394002505e-15 # 1 ulp (units in the last place).
- * p((10-f)/(10.0.next_float-10)) #=> 11.0 # the error is 11 ulp.
- * p((10-f)/(10*Float::EPSILON)) #=> 8.8 # approximation of the above.
- * p "%a" % f #=> "0x1.3fffffffffff5p+3" # the last hex digit is 5. 16 - 5 = 11 ulp.
- *
- */
-static VALUE
-flo_next_float(VALUE vx)
-{
- double x, y;
- x = NUM2DBL(vx);
- y = nextafter(x, INFINITY);
- return DBL2NUM(y);
-}
-
-/*
- * call-seq:
- * float.prev_float -> float
- *
- * Returns the previous representable floating-point number.
- *
- * (-Float::MAX).prev_float and (-Float::INFINITY).prev_float is -Float::INFINITY.
- *
- * Float::NAN.prev_float is Float::NAN.
- *
- * For example:
- *
- * p 0.01.prev_float #=> 0.009999999999999998
- * p 1.0.prev_float #=> 0.9999999999999999
- * p 100.0.prev_float #=> 99.99999999999999
- *
- * p 0.01 - 0.01.prev_float #=> 1.734723475976807e-18
- * p 1.0 - 1.0.prev_float #=> 1.1102230246251565e-16
- * p 100.0 - 100.0.prev_float #=> 1.4210854715202004e-14
- *
- * f = 0.01; 20.times { printf "%-20a %s\n", f, f.to_s; f = f.prev_float }
- * #=> 0x1.47ae147ae147bp-7 0.01
- * # 0x1.47ae147ae147ap-7 0.009999999999999998
- * # 0x1.47ae147ae1479p-7 0.009999999999999997
- * # 0x1.47ae147ae1478p-7 0.009999999999999995
- * # 0x1.47ae147ae1477p-7 0.009999999999999993
- * # 0x1.47ae147ae1476p-7 0.009999999999999992
- * # 0x1.47ae147ae1475p-7 0.00999999999999999
- * # 0x1.47ae147ae1474p-7 0.009999999999999988
- * # 0x1.47ae147ae1473p-7 0.009999999999999986
- * # 0x1.47ae147ae1472p-7 0.009999999999999985
- * # 0x1.47ae147ae1471p-7 0.009999999999999983
- * # 0x1.47ae147ae147p-7 0.009999999999999981
- * # 0x1.47ae147ae146fp-7 0.00999999999999998
- * # 0x1.47ae147ae146ep-7 0.009999999999999978
- * # 0x1.47ae147ae146dp-7 0.009999999999999976
- * # 0x1.47ae147ae146cp-7 0.009999999999999974
- * # 0x1.47ae147ae146bp-7 0.009999999999999972
- * # 0x1.47ae147ae146ap-7 0.00999999999999997
- * # 0x1.47ae147ae1469p-7 0.009999999999999969
- * # 0x1.47ae147ae1468p-7 0.009999999999999967
- *
- */
-static VALUE
-flo_prev_float(VALUE vx)
-{
- double x, y;
- x = NUM2DBL(vx);
- y = nextafter(x, -INFINITY);
- return DBL2NUM(y);
-}
-
-/*
- * call-seq:
* float.floor -> integer
*
* Returns the largest integer less than or equal to +float+.
@@ -1741,7 +1550,7 @@ int_round_0(VALUE num, int ndigits)
h = rb_funcall(f, '/', 1, INT2FIX(2));
r = rb_funcall(num, '%', 1, f);
n = rb_funcall(num, '-', 1, r);
- op = negative_int_p(num) ? idLE : '<';
+ op = negative_int_p(num) ? rb_intern("<=") : '<';
if (!RTEST(rb_funcall(r, op, 1, h))) {
n = rb_funcall(n, '+', 1, f);
}
@@ -1786,7 +1595,7 @@ static VALUE
flo_round(int argc, VALUE *argv, VALUE num)
{
VALUE nd;
- double number, f, x;
+ double number, f;
int ndigits = 0;
int binexp;
enum {float_dig = DBL_DIG+2};
@@ -1828,14 +1637,8 @@ flo_round(int argc, VALUE *argv, VALUE num)
return DBL2NUM(0);
}
f = pow(10, ndigits);
- x = round(number * f);
- if (x > 0) {
- if ((double)((x + 0.5) / f) <= number) x += 1;
- }
- else {
- if ((double)((x - 0.5) / f) >= number) x -= 1;
- }
- return DBL2NUM(x / f);}
+ return DBL2NUM(round(number * f) / f);
+}
/*
* call-seq:
@@ -1866,34 +1669,6 @@ flo_truncate(VALUE num)
/*
* call-seq:
- * float.positive? -> true or false
- *
- * Returns +true+ if +float+ is greater than 0.
- */
-
-static VALUE
-flo_positive_p(VALUE num)
-{
- double f = RFLOAT_VALUE(num);
- return f > 0.0 ? Qtrue : Qfalse;
-}
-
-/*
- * call-seq:
- * float.negative? -> true or false
- *
- * Returns +true+ if +float+ is less than 0.
- */
-
-static VALUE
-flo_negative_p(VALUE num)
-{
- double f = RFLOAT_VALUE(num);
- return f < 0.0 ? Qtrue : Qfalse;
-}
-
-/*
- * call-seq:
* num.floor -> integer
*
* Returns the largest integer less than or equal to +num+.
@@ -1979,9 +1754,6 @@ ruby_float_step_size(double beg, double end, double unit, int excl)
if (isinf(unit)) {
return unit > 0 ? beg <= end : beg >= end;
}
- if (unit == 0) {
- return INFINITY;
- }
if (err>0.5) err=0.5;
if (excl) {
if (n<=0) return 0;
@@ -2011,11 +1783,6 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
/* if unit is infinity, i*unit+beg is NaN */
if (n) rb_yield(DBL2NUM(beg));
}
- else if (unit == 0) {
- VALUE val = DBL2NUM(beg);
- for (;;)
- rb_yield(val);
- }
else {
for (i=0; i<n; i++) {
double d = i*unit+beg;
@@ -2032,39 +1799,25 @@ VALUE
ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
{
if (FIXNUM_P(from) && FIXNUM_P(to) && FIXNUM_P(step)) {
- long delta, diff;
+ long delta, diff, result;
diff = FIX2LONG(step);
- if (diff == 0) {
- return DBL2NUM(INFINITY);
- }
delta = FIX2LONG(to) - FIX2LONG(from);
- if (diff < 0) {
- diff = -diff;
- delta = -delta;
- }
if (excl) {
- delta--;
- }
- if (delta < 0) {
- return INT2FIX(0);
+ delta += (diff > 0 ? -1 : +1);
}
- return ULONG2NUM(delta / diff + 1UL);
+ result = delta / diff;
+ return LONG2FIX(result >= 0 ? result + 1 : 0);
}
else if (RB_TYPE_P(from, T_FLOAT) || RB_TYPE_P(to, T_FLOAT) || RB_TYPE_P(step, T_FLOAT)) {
double n = ruby_float_step_size(NUM2DBL(from), NUM2DBL(to), NUM2DBL(step), excl);
if (isinf(n)) return DBL2NUM(n);
- if (POSFIXABLE(n)) return LONG2FIX(n);
- return rb_dbl2big(n);
+ return LONG2FIX(n);
}
else {
VALUE result;
- ID cmp = '>';
- switch (rb_cmpint(rb_num_coerce_cmp(step, INT2FIX(0), id_cmp), step, INT2FIX(0))) {
- case 0: return DBL2NUM(INFINITY);
- case -1: cmp = '<'; break;
- }
+ ID cmp = RTEST(rb_funcall(step, '>', 1, INT2FIX(0))) ? '>' : '<';
if (RTEST(rb_funcall(from, cmp, 1, to))) return INT2FIX(0);
result = rb_funcall(rb_funcall(to, '-', 1, from), id_div, 1, step);
if (!excl || RTEST(rb_funcall(rb_funcall(from, '+', 1, rb_funcall(result, '*', 1, step)), cmp, 1, to))) {
@@ -2074,62 +1827,54 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
}
}
-static int
-num_step_scan_args(int argc, const VALUE *argv, VALUE *to, VALUE *step)
-{
- VALUE hash;
- int desc;
+#define NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc) do { \
+ argc = rb_scan_args(argc, argv, "02:", &to, &step, &hash); \
+ if (!NIL_P(hash)) { \
+ step = rb_hash_aref(hash, sym_by); \
+ to = rb_hash_aref(hash, sym_to); \
+ } \
+ else { \
+ /* compatibility */ \
+ if (argc > 1 && NIL_P(step)) { \
+ rb_raise(rb_eTypeError, "step must be numeric"); \
+ } \
+ if (rb_equal(step, INT2FIX(0))) { \
+ rb_raise(rb_eArgError, "step can't be 0"); \
+ } \
+ } \
+ if (NIL_P(step)) { \
+ step = INT2FIX(1); \
+ } \
+ desc = !positive_int_p(step); \
+ if (NIL_P(to)) { \
+ to = desc ? DBL2NUM(-INFINITY) : DBL2NUM(INFINITY); \
+ } \
+} while (0)
- argc = rb_scan_args(argc, argv, "02:", to, step, &hash);
- if (!NIL_P(hash)) {
- ID keys[2];
- VALUE values[2];
- keys[0] = id_to;
- keys[1] = id_by;
- rb_get_kwargs(hash, keys, 0, 2, values);
- if (values[0] != Qundef) {
- if (argc > 0) rb_raise(rb_eArgError, "to is given twice");
- *to = values[0];
- }
- if (values[1] != Qundef) {
- if (argc > 1) rb_raise(rb_eArgError, "step is given twice");
- *step = values[1];
- }
- }
- else {
- /* compatibility */
- if (argc > 1 && NIL_P(*step)) {
- rb_raise(rb_eTypeError, "step must be numeric");
- }
- if (rb_equal(*step, INT2FIX(0))) {
- rb_raise(rb_eArgError, "step can't be 0");
- }
- }
- if (NIL_P(*step)) {
- *step = INT2FIX(1);
- }
- desc = !positive_int_p(*step);
- if (NIL_P(*to)) {
- *to = desc ? DBL2NUM(-INFINITY) : DBL2NUM(INFINITY);
- }
- return desc;
-}
+#define NUM_STEP_GET_INF(to, desc, inf) do { \
+ if (RB_TYPE_P(to, T_FLOAT)) { \
+ double f = RFLOAT_VALUE(to); \
+ inf = isinf(f) && (signbit(f) ? desc : !desc); \
+ } \
+ else inf = 0; \
+} while (0)
static VALUE
num_step_size(VALUE from, VALUE args, VALUE eobj)
{
- VALUE to, step;
+ VALUE to, step, hash;
+ int desc;
int argc = args ? RARRAY_LENINT(args) : 0;
- const VALUE *argv = args ? RARRAY_CONST_PTR(args) : 0;
+ VALUE *argv = args ? RARRAY_PTR(args) : 0;
- num_step_scan_args(argc, argv, &to, &step);
+ NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc);
return ruby_num_interval_step_size(from, to, step, FALSE);
}
/*
* call-seq:
- * num.step(by: step, to: limit) {|i| block } -> self
- * num.step(by: step, to: limit) -> an_enumerator
+ * num.step(by: step, to: limit]) {|i| block } -> self
+ * num.step(by: step, to: limit]) -> an_enumerator
* num.step(limit=nil, step=1) {|i| block } -> self
* num.step(limit=nil, step=1) -> an_enumerator
*
@@ -2142,7 +1887,7 @@ num_step_size(VALUE from, VALUE args, VALUE eobj)
*
* In the recommended keyword argument style, either or both of
* +step+ and +limit+ (default infinity) can be omitted. In the
- * fixed position argument style, zero as a step
+ * fixed position argument style, integer zero as a step
* (i.e. num.step(limit, 0)) is not allowed for historical
* compatibility reasons.
*
@@ -2183,20 +1928,14 @@ num_step_size(VALUE from, VALUE args, VALUE eobj)
static VALUE
num_step(int argc, VALUE *argv, VALUE from)
{
- VALUE to, step;
+ VALUE to, step, hash;
int desc, inf;
RETURN_SIZED_ENUMERATOR(from, argc, argv, num_step_size);
- desc = num_step_scan_args(argc, argv, &to, &step);
- if (RTEST(rb_num_coerce_cmp(step, INT2FIX(0), id_eq))) {
- inf = 1;
- }
- else if (RB_TYPE_P(to, T_FLOAT)) {
- double f = RFLOAT_VALUE(to);
- inf = isinf(f) && (signbit(f) ? desc : !desc);
- }
- else inf = 0;
+ NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc);
+ NUM_STEP_GET_INF(to, desc, inf);
+
if (FIXNUM_P(from) && (inf || FIXNUM_P(to)) && FIXNUM_P(step)) {
long i = FIX2LONG(from);
@@ -2236,23 +1975,6 @@ num_step(int argc, VALUE *argv, VALUE from)
return from;
}
-static char *
-out_of_range_float(char (*pbuf)[24], VALUE val)
-{
- char *const buf = *pbuf;
- char *s;
-
- snprintf(buf, sizeof(*pbuf), "%-.10g", RFLOAT_VALUE(val));
- if ((s = strchr(buf, ' ')) != 0) *s = '\0';
- return buf;
-}
-
-#define FLOAT_OUT_OF_RANGE(val, type) do { \
- char buf[24]; \
- rb_raise(rb_eRangeError, "float %s out of range of "type, \
- out_of_range_float(&buf, (val))); \
-} while (0)
-
#define LONG_MIN_MINUS_ONE ((double)LONG_MIN-1)
#define LONG_MAX_PLUS_ONE (2*(double)(LONG_MAX/2+1))
#define ULONG_MAX_PLUS_ONE (2*(double)(ULONG_MAX/2+1))
@@ -2261,7 +1983,7 @@ out_of_range_float(char (*pbuf)[24], VALUE val)
LONG_MIN <= (n): \
LONG_MIN_MINUS_ONE < (n))
-long
+SIGNED_VALUE
rb_num2long(VALUE val)
{
again:
@@ -2277,7 +1999,12 @@ rb_num2long(VALUE val)
return (long)RFLOAT_VALUE(val);
}
else {
- FLOAT_OUT_OF_RANGE(val, "integer");
+ char buf[24];
+ char *s;
+
+ snprintf(buf, sizeof(buf), "%-.10g", RFLOAT_VALUE(val));
+ if ((s = strchr(buf, ' ')) != 0) *s = '\0';
+ rb_raise(rb_eRangeError, "float %s out of range of integer", buf);
}
}
else if (RB_TYPE_P(val, T_BIGNUM)) {
@@ -2314,14 +2041,19 @@ rb_num2ulong_internal(VALUE val, int *wrap_p)
return (unsigned long)(long)d;
}
else {
- FLOAT_OUT_OF_RANGE(val, "integer");
+ char buf[24];
+ char *s;
+
+ snprintf(buf, sizeof(buf), "%-.10g", RFLOAT_VALUE(val));
+ if ((s = strchr(buf, ' ')) != 0) *s = '\0';
+ rb_raise(rb_eRangeError, "float %s out of range of integer", buf);
}
}
else if (RB_TYPE_P(val, T_BIGNUM)) {
{
unsigned long ul = rb_big2ulong(val);
if (wrap_p)
- *wrap_p = BIGNUM_NEGATIVE_P(val);
+ *wrap_p = RBIGNUM_NEGATIVE_P(val);
return ul;
}
}
@@ -2331,7 +2063,7 @@ rb_num2ulong_internal(VALUE val, int *wrap_p)
}
}
-unsigned long
+VALUE
rb_num2ulong(VALUE val)
{
return rb_num2ulong_internal(val, NULL);
@@ -2536,7 +2268,12 @@ rb_num2ll(VALUE val)
return (LONG_LONG)(RFLOAT_VALUE(val));
}
else {
- FLOAT_OUT_OF_RANGE(val, "long long");
+ char buf[24];
+ char *s;
+
+ snprintf(buf, sizeof(buf), "%-.10g", RFLOAT_VALUE(val));
+ if ((s = strchr(buf, ' ')) != 0) *s = '\0';
+ rb_raise(rb_eRangeError, "float %s out of range of long long", buf);
}
}
else if (RB_TYPE_P(val, T_BIGNUM)) {
@@ -2570,7 +2307,12 @@ rb_num2ull(VALUE val)
return (unsigned LONG_LONG)(LONG_LONG)(RFLOAT_VALUE(val));
}
else {
- FLOAT_OUT_OF_RANGE(val, "unsigned long long");
+ char buf[24];
+ char *s;
+
+ snprintf(buf, sizeof(buf), "%-.10g", RFLOAT_VALUE(val));
+ if ((s = strchr(buf, ' ')) != 0) *s = '\0';
+ rb_raise(rb_eRangeError, "float %s out of range of unsgined long long", buf);
}
}
else if (RB_TYPE_P(val, T_BIGNUM)) {
@@ -2859,6 +2601,7 @@ fix_uminus(VALUE num)
VALUE
rb_fix2str(VALUE x, int base)
{
+ extern const char ruby_digitmap[];
char buf[SIZEOF_VALUE*CHAR_BIT + 2], *b = buf + sizeof buf;
long val = FIX2LONG(x);
int neg = 0;
@@ -2943,10 +2686,6 @@ fix_plus(VALUE x, VALUE y)
else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM((double)FIX2LONG(x) + RFLOAT_VALUE(y));
}
- else if (RB_TYPE_P(y, T_COMPLEX)) {
- VALUE rb_nucomp_add(VALUE, VALUE);
- return rb_nucomp_add(y, x);
- }
else {
return rb_num_coerce_bin(x, y, '+');
}
@@ -3036,10 +2775,6 @@ fix_mul(VALUE x, VALUE y)
else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM((double)FIX2LONG(x) * RFLOAT_VALUE(y));
}
- else if (RB_TYPE_P(y, T_COMPLEX)) {
- VALUE rb_nucomp_mul(VALUE, VALUE);
- return rb_nucomp_mul(y, x);
- }
else {
return rb_num_coerce_bin(x, y, '*');
}
@@ -3161,7 +2896,7 @@ fix_div(VALUE x, VALUE y)
static VALUE
fix_idiv(VALUE x, VALUE y)
{
- return fix_divide(x, y, id_div);
+ return fix_divide(x, y, rb_intern("div"));
}
/*
@@ -3227,7 +2962,7 @@ fix_divmod(VALUE x, VALUE y)
}
}
else {
- return rb_num_coerce_bin(x, y, id_divmod);
+ return rb_num_coerce_bin(x, y, rb_intern("divmod"));
}
}
@@ -3249,8 +2984,6 @@ int_pow(long x, unsigned long y)
VALUE v;
bignum:
v = rb_big_pow(rb_int2big(x), LONG2NUM(y));
- if (RB_FLOAT_TYPE_P(v)) /* infinity due to overflow */
- return v;
if (z != 1) v = rb_big_mul(rb_int2big(neg ? -z : z), v);
return v;
}
@@ -3302,7 +3035,7 @@ fix_pow(VALUE x, VALUE y)
return INT2FIX(-1);
}
if (b < 0)
- return rb_funcall(rb_rational_raw1(x), idPow, 1, y);
+ return rb_funcall(rb_rational_raw1(x), rb_intern("**"), 1, y);
if (b == 0) return INT2FIX(1);
if (b == 1) return x;
@@ -3319,7 +3052,7 @@ fix_pow(VALUE x, VALUE y)
else return INT2FIX(-1);
}
if (negative_int_p(y))
- return rb_funcall(rb_rational_raw1(x), idPow, 1, y);
+ return rb_funcall(rb_rational_raw1(x), rb_intern("**"), 1, y);
if (a == 0) return INT2FIX(0);
x = rb_int2big(FIX2LONG(x));
return rb_big_pow(x, y);
@@ -3333,12 +3066,12 @@ fix_pow(VALUE x, VALUE y)
{
double dy = RFLOAT_VALUE(y);
if (a < 0 && dy != round(dy))
- return rb_funcall(rb_complex_raw1(x), idPow, 1, y);
+ return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
return DBL2NUM(pow((double)a, dy));
}
}
else {
- return rb_num_coerce_bin(x, y, idPow);
+ return rb_num_coerce_bin(x, y, rb_intern("**"));
}
}
@@ -3395,7 +3128,7 @@ fix_cmp(VALUE x, VALUE y)
return rb_integer_float_cmp(x, y);
}
else {
- return rb_num_coerce_cmp(x, y, id_cmp);
+ return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
}
}
@@ -3447,7 +3180,7 @@ fix_ge(VALUE x, VALUE y)
return rel == INT2FIX(1) || rel == INT2FIX(0) ? Qtrue : Qfalse;
}
else {
- return rb_num_coerce_relop(x, y, idGE);
+ return rb_num_coerce_relop(x, y, rb_intern(">="));
}
}
@@ -3499,7 +3232,7 @@ fix_le(VALUE x, VALUE y)
return rel == INT2FIX(-1) || rel == INT2FIX(0) ? Qtrue : Qfalse;
}
else {
- return rb_num_coerce_relop(x, y, idLE);
+ return rb_num_coerce_relop(x, y, rb_intern("<="));
}
}
@@ -3517,14 +3250,18 @@ fix_rev(VALUE num)
}
static int
-bit_coerce(VALUE *x, VALUE *y)
+bit_coerce(VALUE *x, VALUE *y, int err)
{
if (!FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
- VALUE orig = *x;
- do_coerce(x, y, TRUE);
+ do_coerce(x, y, err);
if (!FIXNUM_P(*x) && !RB_TYPE_P(*x, T_BIGNUM)
&& !FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
- coerce_failed(orig, *y);
+ if (!err) return FALSE;
+ rb_raise(rb_eTypeError,
+ "%s can't be coerced into %s for bitwise arithmetic",
+ rb_special_const_p(*y) ?
+ RSTRING_PTR(rb_inspect(*y)) : rb_obj_classname(*y),
+ rb_obj_classname(*x));
}
}
return TRUE;
@@ -3533,7 +3270,7 @@ bit_coerce(VALUE *x, VALUE *y)
VALUE
rb_num_coerce_bit(VALUE x, VALUE y, ID func)
{
- bit_coerce(&x, &y);
+ bit_coerce(&x, &y, TRUE);
return rb_funcall(x, func, 1, y);
}
@@ -3556,8 +3293,8 @@ fix_and(VALUE x, VALUE y)
return rb_big_and(y, x);
}
- bit_coerce(&x, &y);
- return rb_funcall(x, '&', 1, y);
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, rb_intern("&"), 1, y);
}
/*
@@ -3579,8 +3316,8 @@ fix_or(VALUE x, VALUE y)
return rb_big_or(y, x);
}
- bit_coerce(&x, &y);
- return rb_funcall(x, '|', 1, y);
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, rb_intern("|"), 1, y);
}
/*
@@ -3602,8 +3339,8 @@ fix_xor(VALUE x, VALUE y)
return rb_big_xor(y, x);
}
- bit_coerce(&x, &y);
- return rb_funcall(x, '^', 1, y);
+ bit_coerce(&x, &y, TRUE);
+ return rb_funcall(x, rb_intern("^"), 1, y);
}
static VALUE fix_lshift(long, unsigned long);
@@ -3698,7 +3435,7 @@ fix_aref(VALUE fix, VALUE idx)
if (!FIXNUM_P(idx)) {
idx = rb_big_norm(idx);
if (!FIXNUM_P(idx)) {
- if (!BIGNUM_SIGN(idx) || val >= 0)
+ if (!RBIGNUM_SIGN(idx) || val >= 0)
return INT2FIX(0);
return INT2FIX(1);
}
@@ -3802,14 +3539,6 @@ fix_size(VALUE fix)
* (2**12-1).bit_length #=> 12
* (2**12).bit_length #=> 13
* (2**12+1).bit_length #=> 13
- *
- * This method can be used to detect overflow in Array#pack as follows.
- *
- * if n.bit_length < 32
- * [n].pack("l") # no overflow
- * else
- * raise "overflow"
- * end
*/
static VALUE
@@ -3950,7 +3679,7 @@ int_dotimes(VALUE num)
end = FIX2LONG(num);
for (i=0; i<end; i++) {
- rb_yield_1(LONG2FIX(i));
+ rb_yield(LONG2FIX(i));
}
}
else {
@@ -4072,75 +3801,7 @@ fix_even_p(VALUE num)
*/
/*
- * Document-class: Numeric
- *
- * Numeric is the class from which all higher-level numeric classes should inherit.
- *
- * Numeric allows instantiation of heap-allocated objects. Other core numeric classes such as
- * Integer are implemented as immediates, which means that each Integer is a single immutable
- * object which is always passed by value.
- *
- * a = 1
- * puts 1.object_id == a.object_id #=> true
- *
- * There can only ever be one instance of the integer +1+, for example. Ruby ensures this
- * by preventing instantiation and duplication.
- *
- * Integer.new(1) #=> NoMethodError: undefined method `new' for Integer:Class
- * 1.dup #=> TypeError: can't dup Fixnum
- *
- * For this reason, Numeric should be used when defining other numeric classes.
- *
- * Classes which inherit from Numeric must implement +coerce+, which returns a two-member
- * Array containing an object that has been coerced into an instance of the new class
- * and +self+ (see #coerce).
- *
- * Inheriting classes should also implement arithmetic operator methods (<code>+</code>,
- * <code>-</code>, <code>*</code> and <code>/</code>) and the <code><=></code> operator (see
- * Comparable). These methods may rely on +coerce+ to ensure interoperability with
- * instances of other numeric classes.
- *
- * class Tally < Numeric
- * def initialize(string)
- * @string = string
- * end
- *
- * def to_s
- * @string
- * end
- *
- * def to_i
- * @string.size
- * end
- *
- * def coerce(other)
- * [self.class.new('|' * other.to_i), self]
- * end
- *
- * def <=>(other)
- * to_i <=> other.to_i
- * end
- *
- * def +(other)
- * self.class.new('|' * (to_i + other.to_i))
- * end
- *
- * def -(other)
- * self.class.new('|' * (to_i - other.to_i))
- * end
- *
- * def *(other)
- * self.class.new('|' * (to_i * other.to_i))
- * end
- *
- * def /(other)
- * self.class.new('|' * (to_i / other.to_i))
- * end
- * end
- *
- * tally = Tally.new('||')
- * puts tally * 2 #=> "||||"
- * puts tally > 1 #=> true
+ * The top-level number class.
*/
void
Init_Numeric(void)
@@ -4154,10 +3815,15 @@ Init_Numeric(void)
#elif defined(_UNICOSMP)
/* Turn off floating point exceptions for divide by zero, etc. */
_set_Creg(0, 0);
+#elif defined(__BORLANDC__)
+ /* Turn off floating point exceptions for overflow, etc. */
+ _control87(MCW_EM, MCW_EM);
+ _control87(_control87(0,0),0x1FFF);
#endif
id_coerce = rb_intern("coerce");
+ id_to_i = rb_intern("to_i");
+ id_eq = rb_intern("==");
id_div = rb_intern("div");
- id_divmod = rb_intern("divmod");
rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError);
rb_eFloatDomainError = rb_define_class("FloatDomainError", rb_eRangeError);
@@ -4193,8 +3859,6 @@ Init_Numeric(void)
rb_define_method(rb_cNumeric, "round", num_round, -1);
rb_define_method(rb_cNumeric, "truncate", num_truncate, 0);
rb_define_method(rb_cNumeric, "step", num_step, -1);
- rb_define_method(rb_cNumeric, "positive?", num_positive_p, 0);
- rb_define_method(rb_cNumeric, "negative?", num_negative_p, 0);
rb_cInteger = rb_define_class("Integer", rb_cNumeric);
rb_undef_alloc_func(rb_cInteger);
@@ -4296,8 +3960,7 @@ Init_Numeric(void)
*/
rb_define_const(rb_cFloat, "MANT_DIG", INT2FIX(DBL_MANT_DIG));
/*
- * The minimum number of significant decimal digits in a double-precision
- * floating point.
+ * The number of decimal digits in a double-precision floating point.
*
* Usually defaults to 15.
*/
@@ -4331,14 +3994,9 @@ Init_Numeric(void)
*/
rb_define_const(rb_cFloat, "MAX_10_EXP", INT2FIX(DBL_MAX_10_EXP));
/*
- * The smallest positive normalized number in a double-precision floating point.
+ * The smallest positive integer in a double-precision floating point.
*
* Usually defaults to 2.2250738585072014e-308.
- *
- * If the platform supports denormalized numbers,
- * there are numbers between zero and Float::MIN.
- * 0.0.next_float returns the smallest positive floating point number
- * including denormalized numbers.
*/
rb_define_const(rb_cFloat, "MIN", DBL2NUM(DBL_MIN));
/*
@@ -4349,7 +4007,7 @@ Init_Numeric(void)
rb_define_const(rb_cFloat, "MAX", DBL2NUM(DBL_MAX));
/*
* The difference between 1 and the smallest double-precision floating
- * point number greater than 1.
+ * point number.
*
* Usually defaults to 2.2204460492503131e-16.
*/
@@ -4401,13 +4059,9 @@ Init_Numeric(void)
rb_define_method(rb_cFloat, "nan?", flo_is_nan_p, 0);
rb_define_method(rb_cFloat, "infinite?", flo_is_infinite_p, 0);
rb_define_method(rb_cFloat, "finite?", flo_is_finite_p, 0);
- rb_define_method(rb_cFloat, "next_float", flo_next_float, 0);
- rb_define_method(rb_cFloat, "prev_float", flo_prev_float, 0);
- rb_define_method(rb_cFloat, "positive?", flo_positive_p, 0);
- rb_define_method(rb_cFloat, "negative?", flo_negative_p, 0);
- id_to = rb_intern("to");
- id_by = rb_intern("by");
+ sym_to = ID2SYM(rb_intern("to"));
+ sym_by = ID2SYM(rb_intern("by"));
}
#undef rb_float_value
diff --git a/object.c b/object.c
index 58d9c23ea1..70f6d66e5e 100644
--- a/object.c
+++ b/object.c
@@ -11,15 +11,17 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
+#include "ruby/encoding.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include "constant.h"
+#include "internal.h"
#include "id.h"
#include "probes.h"
@@ -70,6 +72,7 @@ rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
{
RBASIC(obj)->flags = type;
RBASIC_SET_CLASS(obj, klass);
+ if (rb_safe_level() >= 3) FL_SET((obj), FL_TAINT);
return obj;
}
@@ -142,11 +145,7 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
return Qfalse;
}
-#if 0
/*
- * call-seq:
- * obj.hash -> fixnum
- *
* Generates a Fixnum hash value for this object. This function must have the
* property that <code>a.eql?(b)</code> implies <code>a.hash == b.hash</code>.
*
@@ -155,7 +154,7 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
* capacity of a Fixnum will be truncated before being used.
*
* The hash value for an object may not be identical across invocations or
- * implementations of Ruby. If you need a stable identifier across Ruby
+ * implementations of ruby. If you need a stable identifier across ruby
* invocations and implementations you will need to generate one with a custom
* method.
*/
@@ -170,11 +169,9 @@ rb_obj_hash(VALUE obj)
#else
# error not supported
#endif
- return LONG2FIX(rb_objid_hash(index));
+ st_index_t h = rb_hash_end(rb_hash_start(index));
+ return LONG2FIX(h);
}
-#else
-VALUE rb_obj_hash(VALUE obj);
-#endif
/*
* call-seq:
@@ -206,8 +203,9 @@ rb_obj_not_equal(VALUE obj1, VALUE obj2)
VALUE
rb_class_real(VALUE cl)
{
- while (cl &&
- ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS)) {
+ if (cl == 0)
+ return 0;
+ while ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS) {
cl = RCLASS_SUPER(cl);
}
return cl;
@@ -236,7 +234,7 @@ rb_obj_class(VALUE obj)
* obj.singleton_class -> class
*
* Returns the singleton class of <i>obj</i>. This method creates
- * a new singleton class if <i>obj</i> does not have one.
+ * a new singleton class if <i>obj</i> does not have it.
*
* If <i>obj</i> is <code>nil</code>, <code>true</code>, or
* <code>false</code>, it returns NilClass, TrueClass, or FalseClass,
@@ -254,33 +252,6 @@ rb_obj_singleton_class(VALUE obj)
return rb_singleton_class(obj);
}
-void
-rb_obj_copy_ivar(VALUE dest, VALUE obj)
-{
- if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_IVPTR(dest)) {
- xfree(ROBJECT_IVPTR(dest));
- ROBJECT(dest)->as.heap.ivptr = 0;
- ROBJECT(dest)->as.heap.numiv = 0;
- ROBJECT(dest)->as.heap.iv_index_tbl = 0;
- }
- if (RBASIC(obj)->flags & ROBJECT_EMBED) {
- MEMCPY(ROBJECT(dest)->as.ary, ROBJECT(obj)->as.ary, VALUE, ROBJECT_EMBED_LEN_MAX);
- RBASIC(dest)->flags |= ROBJECT_EMBED;
- }
- else {
- long len = ROBJECT(obj)->as.heap.numiv;
- VALUE *ptr = 0;
- if (len > 0) {
- ptr = ALLOC_N(VALUE, len);
- MEMCPY(ptr, ROBJECT(obj)->as.heap.ivptr, VALUE, len);
- }
- ROBJECT(dest)->as.heap.ivptr = ptr;
- ROBJECT(dest)->as.heap.numiv = len;
- ROBJECT(dest)->as.heap.iv_index_tbl = ROBJECT(obj)->as.heap.iv_index_tbl;
- RBASIC(dest)->flags &= ~ROBJECT_EMBED;
- }
-}
-
static void
init_copy(VALUE dest, VALUE obj)
{
@@ -289,11 +260,44 @@ init_copy(VALUE dest, VALUE obj)
}
RBASIC(dest)->flags &= ~(T_MASK|FL_EXIVAR);
RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR|FL_TAINT);
- rb_copy_wb_protected_attribute(dest, obj);
rb_copy_generic_ivar(dest, obj);
rb_gc_copy_finalizer(dest, obj);
- if (RB_TYPE_P(obj, T_OBJECT)) {
- rb_obj_copy_ivar(dest, obj);
+ switch (TYPE(obj)) {
+ case T_OBJECT:
+ if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_IVPTR(dest)) {
+ xfree(ROBJECT_IVPTR(dest));
+ ROBJECT(dest)->as.heap.ivptr = 0;
+ ROBJECT(dest)->as.heap.numiv = 0;
+ ROBJECT(dest)->as.heap.iv_index_tbl = 0;
+ }
+ if (RBASIC(obj)->flags & ROBJECT_EMBED) {
+ MEMCPY(ROBJECT(dest)->as.ary, ROBJECT(obj)->as.ary, VALUE, ROBJECT_EMBED_LEN_MAX);
+ RBASIC(dest)->flags |= ROBJECT_EMBED;
+ }
+ else {
+ long len = ROBJECT(obj)->as.heap.numiv;
+ VALUE *ptr = ALLOC_N(VALUE, len);
+ MEMCPY(ptr, ROBJECT(obj)->as.heap.ivptr, VALUE, len);
+ ROBJECT(dest)->as.heap.ivptr = ptr;
+ ROBJECT(dest)->as.heap.numiv = len;
+ ROBJECT(dest)->as.heap.iv_index_tbl = ROBJECT(obj)->as.heap.iv_index_tbl;
+ RBASIC(dest)->flags &= ~ROBJECT_EMBED;
+ }
+ break;
+ case T_CLASS:
+ case T_MODULE:
+ if (RCLASS_IV_TBL(dest)) {
+ st_free_table(RCLASS_IV_TBL(dest));
+ RCLASS_IV_TBL(dest) = 0;
+ }
+ if (RCLASS_CONST_TBL(dest)) {
+ rb_free_const_table(RCLASS_CONST_TBL(dest));
+ RCLASS_CONST_TBL(dest) = 0;
+ }
+ if (RCLASS_IV_TBL(obj)) {
+ RCLASS_IV_TBL(dest) = rb_st_copy(dest, RCLASS_IV_TBL(obj));
+ }
+ break;
}
}
@@ -302,9 +306,9 @@ init_copy(VALUE dest, VALUE obj)
* obj.clone -> an_object
*
* Produces a shallow copy of <i>obj</i>---the instance variables of
- * <i>obj</i> are copied, but not the objects they reference.
- * <code>clone</code> copies the frozen and tainted state of <i>obj</i>.
- * See also the discussion under <code>Object#dup</code>.
+ * <i>obj</i> are copied, but not the objects they reference. Copies
+ * the frozen and tainted state of <i>obj</i>. See also the discussion
+ * under <code>Object#dup</code>.
*
* class Klass
* attr_accessor :str
@@ -331,8 +335,8 @@ rb_obj_clone(VALUE obj)
rb_raise(rb_eTypeError, "can't clone %s", rb_obj_classname(obj));
}
clone = rb_obj_alloc(rb_obj_class(obj));
- RBASIC(clone)->flags &= (FL_TAINT|FL_PROMOTED0|FL_PROMOTED1);
- RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_PROMOTED0|FL_PROMOTED1|FL_FREEZE|FL_FINALIZE);
+ RBASIC(clone)->flags &= FL_TAINT;
+ RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_PROMOTED|FL_FREEZE|FL_FINALIZE);
singleton = rb_singleton_class_clone_and_attach(obj, clone);
RBASIC_SET_CLASS(clone, singleton);
@@ -352,8 +356,8 @@ rb_obj_clone(VALUE obj)
* obj.dup -> an_object
*
* Produces a shallow copy of <i>obj</i>---the instance variables of
- * <i>obj</i> are copied, but not the objects they reference.
- * <code>dup</code> copies the tainted state of <i>obj</i>.
+ * <i>obj</i> are copied, but not the objects they reference. <code>dup</code>
+ * copies the tainted state of <i>obj</i>.
*
* This method may have class-specific behavior. If so, that
* behavior will be documented under the #+initialize_copy+ method of
@@ -367,7 +371,7 @@ rb_obj_clone(VALUE obj)
* typically uses the class of the descendant object to create the new
* instance.
*
- * When using #dup, any modules that the object has been extended with will not
+ * When using #dup any modules that the object has been extended with will not
* be copied.
*
* class Klass
@@ -405,23 +409,6 @@ rb_obj_dup(VALUE obj)
return dup;
}
-/*
- * call-seq:
- * obj.itself -> an_object
- *
- * Returns <i>obj</i>.
- *
- * string = 'my string' #=> "my string"
- * string.itself.object_id == string.object_id #=> true
- *
- */
-
-static VALUE
-rb_obj_itself(VALUE obj)
-{
- return obj;
-}
-
/* :nodoc: */
VALUE
rb_obj_init_copy(VALUE obj, VALUE orig)
@@ -450,7 +437,7 @@ rb_obj_init_dup_clone(VALUE obj, VALUE orig)
* Returns a string representing <i>obj</i>. The default
* <code>to_s</code> prints the object's class and an encoding of the
* object id. As a special case, the top-level object that is the
- * initial execution context of Ruby programs returns ``main''.
+ * initial execution context of Ruby programs returns ``main.''
*/
VALUE
@@ -465,26 +452,24 @@ rb_any_to_s(VALUE obj)
return str;
}
-VALUE rb_str_escape(VALUE str);
/*
- * If the default internal or external encoding is ASCII compatible,
- * the encoding of the inspected result must be compatible with it.
- * If the default internal or external encoding is ASCII incompatible,
+ * If the default external encoding is ASCII compatible, the encoding of
+ * inspected result must be compatible with it.
+ * If the default external encoding is ASCII incompatible,
* the result must be ASCII only.
*/
VALUE
rb_inspect(VALUE obj)
{
- VALUE str = rb_obj_as_string(rb_funcallv(obj, id_inspect, 0, 0));
- rb_encoding *enc = rb_default_internal_encoding();
- if (enc == NULL) enc = rb_default_external_encoding();
- if (!rb_enc_asciicompat(enc)) {
+ VALUE str = rb_obj_as_string(rb_funcall(obj, id_inspect, 0, 0));
+ rb_encoding *ext = rb_default_external_encoding();
+ if (!rb_enc_asciicompat(ext)) {
if (!rb_enc_str_asciionly_p(str))
- return rb_str_escape(str);
+ rb_raise(rb_eEncCompatError, "inspected result must be ASCII only if default external encoding is ASCII incompatible");
return str;
}
- if (rb_enc_get(str) != enc && !rb_enc_str_asciionly_p(str))
- return rb_str_escape(str);
+ if (rb_enc_get(str) != ext && !rb_enc_str_asciionly_p(str))
+ rb_raise(rb_eEncCompatError, "inspected result must be ASCII only or use the default external encoding");
return str;
}
@@ -494,6 +479,8 @@ inspect_i(st_data_t k, st_data_t v, st_data_t a)
ID id = (ID)k;
VALUE value = (VALUE)v;
VALUE str = (VALUE)a;
+ VALUE str2;
+ const char *ivname;
/* need not to show internal data */
if (CLASS_OF(value) == 0) return ST_CONTINUE;
@@ -505,8 +492,12 @@ inspect_i(st_data_t k, st_data_t v, st_data_t a)
else {
rb_str_cat2(str, ", ");
}
- rb_str_catf(str, "%"PRIsVALUE"=%+"PRIsVALUE,
- rb_id2str(id), value);
+ ivname = rb_id2name(id);
+ rb_str_cat2(str, ivname);
+ rb_str_cat2(str, "=");
+ str2 = rb_inspect(value);
+ rb_str_append(str, str2);
+ OBJ_INFECT(str, str2);
return ST_CONTINUE;
}
@@ -532,10 +523,9 @@ inspect_obj(VALUE obj, VALUE str, int recur)
* obj.inspect -> string
*
* Returns a string containing a human-readable representation of <i>obj</i>.
- * The default <code>inspect</code> shows the object's class name,
- * an encoding of the object id, and a list of the instance variables and
+ * By default, show the class name and the list of the instance variables and
* their values (by calling #inspect on each of them).
- * User defined classes should override this method to provide a better
+ * User defined classes should override this method to make better
* representation of <i>obj</i>. When overriding this method, it should
* return a string whose encoding is compatible with the default external
* encoding.
@@ -553,6 +543,13 @@ inspect_obj(VALUE obj, VALUE str, int recur)
* end
* end
* Bar.new.inspect #=> "#<Bar:0x0300c868 @bar=1>"
+ *
+ * class Baz
+ * def to_s
+ * "baz"
+ * end
+ * end
+ * Baz.new.inspect #=> "#<Baz:0x0300c868>"
*/
static VALUE
@@ -587,8 +584,6 @@ class_or_module_required(VALUE c)
return c;
}
-static VALUE class_search_ancestor(VALUE cl, VALUE c);
-
/*
* call-seq:
* obj.instance_of?(class) -> true or false
@@ -649,40 +644,28 @@ rb_obj_is_kind_of(VALUE obj, VALUE c)
VALUE cl = CLASS_OF(obj);
c = class_or_module_required(c);
- return class_search_ancestor(cl, RCLASS_ORIGIN(c)) ? Qtrue : Qfalse;
-}
-
-static VALUE
-class_search_ancestor(VALUE cl, VALUE c)
-{
+ c = RCLASS_ORIGIN(c);
while (cl) {
if (cl == c || RCLASS_M_TBL(cl) == RCLASS_M_TBL(c))
- return cl;
+ return Qtrue;
cl = RCLASS_SUPER(cl);
}
- return 0;
+ return Qfalse;
}
-VALUE
-rb_class_search_ancestor(VALUE cl, VALUE c)
-{
- cl = class_or_module_required(cl);
- c = class_or_module_required(c);
- return class_search_ancestor(cl, RCLASS_ORIGIN(c));
-}
/*
* call-seq:
* obj.tap{|x|...} -> obj
*
- * Yields self to the block, and then returns self.
+ * Yields <code>x</code> to the block, and then returns <code>x</code>.
* The primary purpose of this method is to "tap into" a method chain,
* in order to perform operations on intermediate results within the chain.
*
* (1..10) .tap {|x| puts "original: #{x.inspect}"}
* .to_a .tap {|x| puts "array: #{x.inspect}"}
* .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"}
- * .map {|x| x*x} .tap {|x| puts "squares: #{x.inspect}"}
+ * .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"}
*
*/
@@ -716,7 +699,7 @@ rb_obj_tap(VALUE obj)
* class Baz < Bar
* end
*
- * <em>produces:</em>
+ * produces:
*
* New subclass: Bar
* New subclass: Baz
@@ -738,7 +721,7 @@ rb_obj_tap(VALUE obj)
* def some_instance_method() end
* end
*
- * <em>produces:</em>
+ * produces:
*
* Adding :some_instance_method
*
@@ -764,7 +747,7 @@ rb_obj_tap(VALUE obj)
* remove_method :some_instance_method
* end
*
- * <em>produces:</em>
+ * produces:
*
* Removing :some_instance_method
*
@@ -952,19 +935,22 @@ rb_obj_tainted(VALUE obj)
*
* Objects that are marked as tainted will be restricted from various built-in
* methods. This is to prevent insecure data, such as command-line arguments
- * or strings read from Kernel#gets, from inadvertently compromising the user's
+ * or strings read from Kernel#gets, from inadvertently compromising the users
* system.
*
- * To check whether an object is tainted, use #tainted?.
+ * To check whether an object is tainted, use #tainted?
*
* You should only untaint a tainted object if your code has inspected it and
- * determined that it is safe. To do so use #untaint.
+ * determined that it is safe. To do so use #untaint
+ *
+ * In $SAFE level 3, all newly created objects are tainted and you can't untaint
+ * objects.
*/
VALUE
rb_obj_taint(VALUE obj)
{
- if (!OBJ_TAINTED(obj) && OBJ_TAINTABLE(obj)) {
+ if (!OBJ_TAINTED(obj)) {
rb_check_frozen(obj);
OBJ_TAINT(obj);
}
@@ -984,6 +970,7 @@ rb_obj_taint(VALUE obj)
VALUE
rb_obj_untaint(VALUE obj)
{
+ rb_secure(3);
if (OBJ_TAINTED(obj)) {
rb_check_frozen(obj);
FL_UNSET(obj, FL_TAINT);
@@ -1040,6 +1027,8 @@ rb_obj_infect(VALUE obj1, VALUE obj2)
OBJ_INFECT(obj1, obj2);
}
+static st_table *immediate_frozen_tbl = 0;
+
/*
* call-seq:
* obj.freeze -> obj
@@ -1057,11 +1046,8 @@ rb_obj_infect(VALUE obj1, VALUE obj2)
*
* <em>produces:</em>
*
- * prog.rb:3:in `<<': can't modify frozen Array (RuntimeError)
+ * prog.rb:3:in `<<': can't modify frozen array (RuntimeError)
* from prog.rb:3
- *
- * Objects of the following classes are always frozen: Fixnum,
- * Bignum, Float, Symbol.
*/
VALUE
@@ -1070,7 +1056,10 @@ rb_obj_freeze(VALUE obj)
if (!OBJ_FROZEN(obj)) {
OBJ_FREEZE(obj);
if (SPECIAL_CONST_P(obj)) {
- rb_bug("special consts should be frozen.");
+ if (!immediate_frozen_tbl) {
+ immediate_frozen_tbl = st_init_numtable();
+ }
+ st_insert(immediate_frozen_tbl, obj, (st_data_t)Qtrue);
}
}
return obj;
@@ -1090,7 +1079,12 @@ rb_obj_freeze(VALUE obj)
VALUE
rb_obj_frozen_p(VALUE obj)
{
- return OBJ_FROZEN(obj) ? Qtrue : Qfalse;
+ if (OBJ_FROZEN(obj)) return Qtrue;
+ if (SPECIAL_CONST_P(obj)) {
+ if (!immediate_frozen_tbl) return Qfalse;
+ if (st_lookup(immediate_frozen_tbl, obj, 0)) return Qtrue;
+ }
+ return Qfalse;
}
@@ -1233,7 +1227,7 @@ true_and(VALUE obj, VALUE obj2)
* call-seq:
* true | obj -> true
*
- * Or---Returns <code>true</code>. As <i>obj</i> is an argument to
+ * Or---Returns <code>true</code>. As <i>anObject</i> is an argument to
* a method call, it is always evaluated; there is no short-circuit
* evaluation in this case.
*
@@ -1357,12 +1351,10 @@ rb_true(VALUE obj)
/*
* call-seq:
- * obj.nil? -> true or false
+ * nil.nil? -> true
+ * <anything_else>.nil? -> false
*
* Only the object <i>nil</i> responds <code>true</code> to <code>nil?</code>.
- *
- * Object.new.nil? #=> false
- * nil.nil? #=> true
*/
@@ -1411,16 +1403,16 @@ rb_obj_not_match(VALUE obj1, VALUE obj2)
* Returns 0 if +obj+ and +other+ are the same object
* or <code>obj == other</code>, otherwise nil.
*
- * The <code><=></code> is used by various methods to compare objects, for example
+ * The <=> is used by various methods to compare objects, for example
* Enumerable#sort, Enumerable#max etc.
*
- * Your implementation of <code><=></code> should return one of the following values: -1, 0,
+ * Your implementation of <=> should return one of the following values: -1, 0,
* 1 or nil. -1 means self is smaller than other. 0 means self is equal to other.
* 1 means self is bigger than other. Nil means the two values could not be
* compared.
*
- * When you define <code><=></code>, you can include Comparable to gain the methods
- * <code><=</code>, <code><</code>, <code>==</code>, <code>>=</code>, <code>></code> and <code>between?</code>.
+ * When you define <=>, you can include Comparable to gain the methods <=, <,
+ * ==, >=, > and between?.
*/
static VALUE
rb_obj_cmp(VALUE obj1, VALUE obj2)
@@ -1439,7 +1431,7 @@ rb_obj_cmp(VALUE obj1, VALUE obj2)
* Instance methods appear as methods in a class when the module is
* included, module methods do not. Conversely, module methods may be
* called without creating an encapsulating object, while instance
- * methods may not. (See <code>Module#module_function</code>.)
+ * methods may not. (See <code>Module#module_function</code>)
*
* In the descriptions that follow, the parameter <i>sym</i> refers
* to a symbol, which is either a quoted string or a
@@ -1462,7 +1454,7 @@ rb_obj_cmp(VALUE obj1, VALUE obj2)
* call-seq:
* mod.to_s -> string
*
- * Returns a string representing this module or class. For basic
+ * Return a string representing this module or class. For basic
* classes and modules, this is the name. For singletons, we
* show information on the thing we're attached to as well.
*/
@@ -1522,10 +1514,10 @@ rb_mod_freeze(VALUE mod)
* call-seq:
* mod === obj -> true or false
*
- * Case Equality---Returns <code>true</code> if <i>obj</i> is an
- * instance of <i>mod</i> or and instance of one of <i>mod</i>'s descendants.
- * Of limited use for modules, but can be used in <code>case</code> statements
- * to classify objects by class.
+ * Case Equality---Returns <code>true</code> if <i>anObject</i> is an
+ * instance of <i>mod</i> or one of <i>mod</i>'s descendants. Of
+ * limited use for modules, but can be used in <code>case</code>
+ * statements to classify objects by class.
*/
static VALUE
@@ -1542,7 +1534,7 @@ rb_mod_eqq(VALUE mod, VALUE arg)
* is the same as <i>other</i>. Returns
* <code>nil</code> if there's no relationship between the two.
* (Think of the relationship in terms of the class definition:
- * "class A<B" implies "A<B".)
+ * "class A<B" implies "A<B").
*
*/
@@ -1556,12 +1548,16 @@ rb_class_inherited_p(VALUE mod, VALUE arg)
rb_raise(rb_eTypeError, "compared with non class/module");
}
arg = RCLASS_ORIGIN(arg);
- if (class_search_ancestor(mod, arg)) {
- return Qtrue;
+ while (mod) {
+ if (RCLASS_M_TBL(mod) == RCLASS_M_TBL(arg))
+ return Qtrue;
+ mod = RCLASS_SUPER(mod);
}
/* not mod < arg; check if mod > arg */
- if (class_search_ancestor(arg, start)) {
- return Qfalse;
+ while (arg) {
+ if (RCLASS_M_TBL(arg) == RCLASS_M_TBL(start))
+ return Qfalse;
+ arg = RCLASS_SUPER(arg);
}
return Qnil;
}
@@ -1573,7 +1569,7 @@ rb_class_inherited_p(VALUE mod, VALUE arg)
* Returns true if <i>mod</i> is a subclass of <i>other</i>. Returns
* <code>nil</code> if there's no relationship between the two.
* (Think of the relationship in terms of the class definition:
- * "class A<B" implies "A<B".)
+ * "class A<B" implies "A<B").
*
*/
@@ -1593,7 +1589,7 @@ rb_mod_lt(VALUE mod, VALUE arg)
* two modules are the same. Returns
* <code>nil</code> if there's no relationship between the two.
* (Think of the relationship in terms of the class definition:
- * "class A<B" implies "B>A".)
+ * "class A<B" implies "B>A").
*
*/
@@ -1614,7 +1610,7 @@ rb_mod_ge(VALUE mod, VALUE arg)
* Returns true if <i>mod</i> is an ancestor of <i>other</i>. Returns
* <code>nil</code> if there's no relationship between the two.
* (Think of the relationship in terms of the class definition:
- * "class A<B" implies "B>A".)
+ * "class A<B" implies "B>A").
*
*/
@@ -1631,7 +1627,7 @@ rb_mod_gt(VALUE mod, VALUE arg)
*
* Comparison---Returns -1, 0, +1 or nil depending on whether +module+
* includes +other_module+, they are the same, or if +module+ is included by
- * +other_module+.
+ * +other_module+. This is the basis for the tests in Comparable.
*
* Returns +nil+ if +module+ has no relationship with +other_module+, if
* +other_module+ is not a module, or if the two values are incomparable.
@@ -1705,17 +1701,6 @@ rb_mod_initialize(VALUE module)
return Qnil;
}
-/* :nodoc: */
-static VALUE
-rb_mod_initialize_clone(VALUE clone, VALUE orig)
-{
- VALUE ret;
- ret = rb_obj_init_dup_clone(clone, orig);
- if (OBJ_FROZEN(orig))
- rb_class_name(clone);
- return ret;
-}
-
/*
* call-seq:
* Class.new(super_class=Object) -> a_class
@@ -1772,13 +1757,6 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass)
return klass;
}
-void
-rb_undefined_alloc(VALUE klass)
-{
- rb_raise(rb_eTypeError, "allocator undefined for %"PRIsVALUE,
- klass);
-}
-
/*
* call-seq:
* class.allocate() -> obj
@@ -1815,10 +1793,18 @@ rb_obj_alloc(VALUE klass)
}
allocator = rb_get_alloc_func(klass);
if (!allocator) {
- rb_undefined_alloc(klass);
+ rb_raise(rb_eTypeError, "allocator undefined for %"PRIsVALUE,
+ klass);
}
- RUBY_DTRACE_CREATE_HOOK(OBJECT, rb_class2name(klass));
+#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
+ if (RUBY_DTRACE_OBJECT_CREATE_ENABLED()) {
+ const char * file = rb_sourcefile();
+ RUBY_DTRACE_OBJECT_CREATE(rb_class2name(klass),
+ file ? file : "",
+ rb_sourceline());
+ }
+#endif
obj = (*allocator)(klass);
@@ -1848,7 +1834,7 @@ rb_class_allocate_instance(VALUE klass)
*/
VALUE
-rb_class_new_instance(int argc, const VALUE *argv, VALUE klass)
+rb_class_new_instance(int argc, VALUE *argv, VALUE klass)
{
VALUE obj;
@@ -1871,7 +1857,7 @@ rb_class_new_instance(int argc, const VALUE *argv, VALUE klass)
* class Bar < Foo; end
* Bar.superclass #=> Foo
*
- * Returns nil when the given class does not have a parent class:
+ * returns nil when the given class hasn't a parent class:
*
* BasicObject.superclass #=> nil
*
@@ -1898,48 +1884,62 @@ rb_class_superclass(VALUE klass)
VALUE
rb_class_get_superclass(VALUE klass)
{
- return RCLASS(klass)->super;
+ return RCLASS_EXT(klass)->super;
}
-#define id_for_var(obj, name, part, type) \
- id_for_setter(obj, name, type, "`%1$s' is not allowed as "#part" "#type" variable name")
-#define id_for_setter(obj, name, type, message) \
- check_setter_id(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
+#define id_for_setter(name, type, message) \
+ check_setter_id(name, rb_is_##type##_id, rb_is_##type##_name, message)
static ID
-check_setter_id(VALUE obj, VALUE *pname,
- int (*valid_id_p)(ID), int (*valid_name_p)(VALUE),
- const char *message, size_t message_len)
+check_setter_id(VALUE name, int (*valid_id_p)(ID), int (*valid_name_p)(VALUE),
+ const char *message)
{
- ID id = rb_check_id(pname);
- VALUE name = *pname;
-
- if (id ? !valid_id_p(id) : !valid_name_p(name)) {
- rb_name_err_raise_str(rb_fstring_new(message, message_len),
- obj, name);
+ ID id;
+ if (SYMBOL_P(name)) {
+ id = SYM2ID(name);
+ if (!valid_id_p(id)) {
+ rb_name_error(id, message, QUOTE_ID(id));
+ }
+ }
+ else {
+ VALUE str = rb_check_string_type(name);
+ if (NIL_P(str)) {
+ rb_raise(rb_eTypeError, "%+"PRIsVALUE" is not a symbol or string",
+ str);
+ }
+ if (!valid_name_p(str)) {
+ rb_name_error_str(str, message, QUOTE(str));
+ }
+ id = rb_to_id(str);
}
return id;
}
static int
-rb_is_attr_name(VALUE name)
+rb_is_attr_id(ID id)
{
- return rb_is_local_name(name) || rb_is_const_name(name);
+ return rb_is_local_id(id) || rb_is_const_id(id);
}
static int
-rb_is_attr_id(ID id)
+rb_is_attr_name(VALUE name)
{
- return rb_is_local_id(id) || rb_is_const_id(id);
+ return rb_is_local_name(name) || rb_is_const_name(name);
}
-static const char wrong_constant_name[] = "wrong constant name %1$s";
-static const char invalid_attribute_name[] = "invalid attribute name `%1$s'";
+static const char invalid_attribute_name[] = "invalid attribute name `%"PRIsVALUE"'";
static ID
-id_for_attr(VALUE obj, VALUE name)
+id_for_attr(VALUE name)
+{
+ return id_for_setter(name, attr, invalid_attribute_name);
+}
+
+ID
+rb_check_attr_id(ID id)
{
- ID id = id_for_setter(obj, name, attr, invalid_attribute_name);
- if (!id) id = rb_intern_str(name);
+ if (!rb_is_attr_id(id)) {
+ rb_name_error_str(id, invalid_attribute_name, QUOTE_ID(id));
+ }
return id;
}
@@ -1962,7 +1962,7 @@ rb_mod_attr_reader(int argc, VALUE *argv, VALUE klass)
int i;
for (i=0; i<argc; i++) {
- rb_attr(klass, id_for_attr(klass, argv[i]), TRUE, FALSE, TRUE);
+ rb_attr(klass, id_for_attr(argv[i]), TRUE, FALSE, TRUE);
}
return Qnil;
}
@@ -1972,7 +1972,7 @@ rb_mod_attr(int argc, VALUE *argv, VALUE klass)
{
if (argc == 2 && (argv[1] == Qtrue || argv[1] == Qfalse)) {
rb_warning("optional boolean argument is obsoleted");
- rb_attr(klass, id_for_attr(klass, argv[0]), 1, RTEST(argv[1]), TRUE);
+ rb_attr(klass, id_for_attr(argv[0]), 1, RTEST(argv[1]), TRUE);
return Qnil;
}
return rb_mod_attr_reader(argc, argv, klass);
@@ -1994,7 +1994,7 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass)
int i;
for (i=0; i<argc; i++) {
- rb_attr(klass, id_for_attr(klass, argv[i]), FALSE, TRUE, TRUE);
+ rb_attr(klass, id_for_attr(argv[i]), FALSE, TRUE, TRUE);
}
return Qnil;
}
@@ -2022,7 +2022,7 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
int i;
for (i=0; i<argc; i++) {
- rb_attr(klass, id_for_attr(klass, argv[i]), TRUE, TRUE, TRUE);
+ rb_attr(klass, id_for_attr(argv[i]), TRUE, TRUE, TRUE);
}
return Qnil;
}
@@ -2032,9 +2032,9 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
* mod.const_get(sym, inherit=true) -> obj
* mod.const_get(str, inherit=true) -> obj
*
- * Checks for a constant with the given name in <i>mod</i>.
+ * Checks for a constant with the given name in <i>mod</i>
* If +inherit+ is set, the lookup will also search
- * the ancestors (and +Object+ if <i>mod</i> is a +Module+).
+ * the ancestors (and +Object+ if <i>mod</i> is a +Module+.)
*
* The value of the constant is returned if a definition is found,
* otherwise a +NameError+ is raised.
@@ -2060,7 +2060,7 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
* Object.const_get 'Foo::Baz::VAL' # => 10
* Object.const_get 'Foo::Baz::VAL', false # => NameError
*
- * If the argument is not a valid constant name a +NameError+ will be
+ * If neither +sym+ nor +str+ is not a valid constant name a NameError will be
* raised with a warning "wrong constant name".
*
* Object.const_get 'foobar' #=> NameError: wrong constant name foobar
@@ -2074,20 +2074,26 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
rb_encoding *enc;
const char *pbeg, *p, *path, *pend;
ID id;
+ int nestable = 1;
- rb_check_arity(argc, 1, 2);
- name = argv[0];
- recur = (argc == 1) ? Qtrue : argv[1];
+ if (argc == 1) {
+ name = argv[0];
+ recur = Qtrue;
+ }
+ else {
+ rb_scan_args(argc, argv, "11", &name, &recur);
+ }
if (SYMBOL_P(name)) {
- if (!rb_is_const_sym(name)) goto wrong_name;
- id = rb_check_id(&name);
- if (!id) return rb_const_missing(mod, name);
- return RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
+ name = rb_sym_to_s(name);
+ nestable = 0;
}
- path = StringValuePtr(name);
+ name = rb_check_string_type(name);
+ Check_Type(name, T_STRING);
+
enc = rb_enc_get(name);
+ path = RSTRING_PTR(name);
if (!rb_enc_asciicompat(enc)) {
rb_raise(rb_eArgError, "invalid class path encoding (non ASCII)");
@@ -2098,10 +2104,12 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
if (p >= pend || !*p) {
wrong_name:
- rb_name_err_raise(wrong_constant_name, mod, name);
+ rb_raise(rb_eNameError, "wrong constant name %"PRIsVALUE,
+ QUOTE(name));
}
if (p + 2 < pend && p[0] == ':' && p[1] == ':') {
+ if (!nestable) goto wrong_name;
mod = rb_cObject;
p += 2;
pbeg = p;
@@ -2119,6 +2127,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
beglen = pbeg-path;
if (p < pend && p[0] == ':') {
+ if (!nestable) goto wrong_name;
if (p + 2 >= pend || p[1] != ':') goto wrong_name;
p += 2;
pbeg = p;
@@ -2130,24 +2139,24 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
}
if (!id) {
- part = rb_str_subseq(name, beglen, len);
- OBJ_FREEZE(part);
- if (!ISUPPER(*pbeg) || !rb_is_const_name(part)) {
- name = part;
- goto wrong_name;
+ if (!ISUPPER(*pbeg) || !rb_enc_symname2_p(pbeg, len, enc)) {
+ part = rb_str_subseq(name, beglen, len);
+ rb_name_error_str(part, "wrong constant name %"PRIsVALUE,
+ QUOTE(part));
}
else if (!rb_method_basic_definition_p(CLASS_OF(mod), id_const_missing)) {
- part = rb_str_intern(part);
- mod = rb_const_missing(mod, part);
- continue;
+ id = rb_intern3(pbeg, len, enc);
}
else {
- rb_mod_const_missing(mod, part);
+ part = rb_str_subseq(name, beglen, len);
+ rb_name_error_str(part, "uninitialized constant %"PRIsVALUE"%"PRIsVALUE,
+ rb_str_subseq(name, 0, beglen),
+ QUOTE(part));
}
}
if (!rb_is_const_id(id)) {
- name = ID2SYM(id);
- goto wrong_name;
+ rb_name_error(id, "wrong constant name %"PRIsVALUE,
+ QUOTE_ID(id));
}
mod = RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
}
@@ -2167,7 +2176,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
* Math.const_set("HIGH_SCHOOL_PI", 22.0/7.0) #=> 3.14285714285714
* Math::HIGH_SCHOOL_PI - Math::PI #=> 0.00126448926734968
*
- * If +sym+ or +str+ is not a valid constant name a +NameError+ will be
+ * If neither +sym+ nor +str+ is not a valid constant name a NameError will be
* raised with a warning "wrong constant name".
*
* Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
@@ -2177,8 +2186,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
static VALUE
rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
{
- ID id = id_for_setter(mod, name, const, wrong_constant_name);
- if (!id) id = rb_intern_str(name);
+ ID id = id_for_setter(name, const, "wrong constant name %"PRIsVALUE);
rb_const_set(mod, id, value);
return value;
}
@@ -2188,39 +2196,20 @@ rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
* mod.const_defined?(sym, inherit=true) -> true or false
* mod.const_defined?(str, inherit=true) -> true or false
*
- * Says whether _mod_ or its ancestors have a constant with the given name:
- *
- * Float.const_defined?(:EPSILON) #=> true, found in Float itself
- * Float.const_defined?("String") #=> true, found in Object (ancestor)
- * BasicObject.const_defined?(:Hash) #=> false
- *
- * If _mod_ is a +Module+, additionally +Object+ and its ancestors are checked:
- *
- * Math.const_defined?(:String) #=> true, found in Object
- *
- * In each of the checked classes or modules, if the constant is not present
- * but there is an autoload for it, +true+ is returned directly without
- * autoloading:
- *
- * module Admin
- * autoload :User, 'admin/user'
- * end
- * Admin.const_defined?(:User) #=> true
- *
- * If the constant is not found the callback +const_missing+ is *not* called
- * and the method returns +false+.
- *
- * If +inherit+ is false, the lookup only checks the constants in the receiver:
+ * Checks for a constant with the given name in <i>mod</i>
+ * If +inherit+ is set, the lookup will also search
+ * the ancestors (and +Object+ if <i>mod</i> is a +Module+.)
*
- * IO.const_defined?(:SYNC) #=> true, found in File::Constants (ancestor)
- * IO.const_defined?(:SYNC, false) #=> false, not found in IO itself
+ * Returns whether or not a definition is found:
*
- * In this case, the same logic for autoloading applies.
+ * Math.const_defined? "PI" #=> true
+ * IO.const_defined? :SYNC #=> true
+ * IO.const_defined? :SYNC, false #=> false
*
- * If the argument is not a valid constant name a +NameError+ is raised with the
- * message "wrong constant name _name_":
+ * If neither +sym+ nor +str+ is not a valid constant name a NameError will be
+ * raised with a warning "wrong constant name".
*
- * Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
+ * Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
*
*/
@@ -2228,93 +2217,29 @@ static VALUE
rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
{
VALUE name, recur;
- rb_encoding *enc;
- const char *pbeg, *p, *path, *pend;
ID id;
- rb_check_arity(argc, 1, 2);
- name = argv[0];
- recur = (argc == 1) ? Qtrue : argv[1];
-
- if (SYMBOL_P(name)) {
- if (!rb_is_const_sym(name)) goto wrong_name;
- id = rb_check_id(&name);
- if (!id) return Qfalse;
- return RTEST(recur) ? rb_const_defined(mod, id) : rb_const_defined_at(mod, id);
- }
-
- path = StringValuePtr(name);
- enc = rb_enc_get(name);
-
- if (!rb_enc_asciicompat(enc)) {
- rb_raise(rb_eArgError, "invalid class path encoding (non ASCII)");
- }
-
- pbeg = p = path;
- pend = path + RSTRING_LEN(name);
-
- if (p >= pend || !*p) {
- wrong_name:
- rb_name_err_raise(wrong_constant_name, mod, name);
+ if (argc == 1) {
+ name = argv[0];
+ recur = Qtrue;
}
-
- if (p + 2 < pend && p[0] == ':' && p[1] == ':') {
- mod = rb_cObject;
- p += 2;
- pbeg = p;
+ else {
+ rb_scan_args(argc, argv, "11", &name, &recur);
}
-
- while (p < pend) {
- VALUE part;
- long len, beglen;
-
- while (p < pend && *p != ':') p++;
-
- if (pbeg == p) goto wrong_name;
-
- id = rb_check_id_cstr(pbeg, len = p-pbeg, enc);
- beglen = pbeg-path;
-
- if (p < pend && p[0] == ':') {
- if (p + 2 >= pend || p[1] != ':') goto wrong_name;
- p += 2;
- pbeg = p;
- }
-
- if (!id) {
- part = rb_str_subseq(name, beglen, len);
- OBJ_FREEZE(part);
- if (!ISUPPER(*pbeg) || !rb_is_const_name(part)) {
- name = part;
- goto wrong_name;
- }
- else {
- return Qfalse;
- }
- }
- if (!rb_is_const_id(id)) {
- name = ID2SYM(id);
- goto wrong_name;
- }
- if (RTEST(recur)) {
- if (!rb_const_defined(mod, id))
- return Qfalse;
- mod = rb_const_get(mod, id);
+ if (!(id = rb_check_id(&name))) {
+ if (rb_is_const_name(name)) {
+ return Qfalse;
}
else {
- if (!rb_const_defined_at(mod, id))
- return Qfalse;
- mod = rb_const_get_at(mod, id);
- }
- recur = Qfalse;
-
- if (p < pend && !RB_TYPE_P(mod, T_MODULE) && !RB_TYPE_P(mod, T_CLASS)) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE" does not refer to class/module",
- QUOTE(name));
+ rb_name_error_str(name, "wrong constant name %"PRIsVALUE,
+ QUOTE(name));
}
}
-
- return Qtrue;
+ if (!rb_is_const_id(id)) {
+ rb_name_error(id, "wrong constant name %"PRIsVALUE,
+ QUOTE_ID(id));
+ }
+ return RTEST(recur) ? rb_const_defined(mod, id) : rb_const_defined_at(mod, id);
}
/*
@@ -2342,10 +2267,20 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
static VALUE
rb_obj_ivar_get(VALUE obj, VALUE iv)
{
- ID id = id_for_var(obj, iv, an, instance);
+ ID id = rb_check_id(&iv);
if (!id) {
- return Qnil;
+ if (rb_is_instance_name(iv)) {
+ return Qnil;
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE(iv));
+ }
+ }
+ if (!rb_is_instance_id(id)) {
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE_ID(id));
}
return rb_ivar_get(obj, id);
}
@@ -2355,10 +2290,10 @@ rb_obj_ivar_get(VALUE obj, VALUE iv)
* obj.instance_variable_set(symbol, obj) -> obj
* obj.instance_variable_set(string, obj) -> obj
*
- * Sets the instance variable named by <i>symbol</i> to the given
- * object, thereby frustrating the efforts of the class's
+ * Sets the instance variable names by <i>symbol</i> to
+ * <i>object</i>, thereby frustrating the efforts of the class's
* author to attempt to provide proper encapsulation. The variable
- * does not have to exist prior to this call.
+ * did not have to exist prior to this call.
* If the instance variable name is passed as a string, that string
* is converted to a symbol.
*
@@ -2376,8 +2311,7 @@ rb_obj_ivar_get(VALUE obj, VALUE iv)
static VALUE
rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val)
{
- ID id = id_for_var(obj, iv, an, instance);
- if (!id) id = rb_intern_str(iv);
+ ID id = id_for_setter(iv, instance, "`%"PRIsVALUE"' is not allowed as an instance variable name");
return rb_ivar_set(obj, id, val);
}
@@ -2404,10 +2338,20 @@ rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val)
static VALUE
rb_obj_ivar_defined(VALUE obj, VALUE iv)
{
- ID id = id_for_var(obj, iv, an, instance);
+ ID id = rb_check_id(&iv);
if (!id) {
- return Qfalse;
+ if (rb_is_instance_name(iv)) {
+ return Qfalse;
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE(iv));
+ }
+ }
+ if (!rb_is_instance_id(id)) {
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as an instance variable name",
+ QUOTE_ID(id));
}
return rb_ivar_defined(obj, id);
}
@@ -2419,7 +2363,7 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv)
*
* Returns the value of the given class variable (or throws a
* <code>NameError</code> exception). The <code>@@</code> part of the
- * variable name should be included for regular class variables.
+ * variable name should be included for regular class variables
* String arguments are converted to symbols.
*
* class Fred
@@ -2431,11 +2375,21 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv)
static VALUE
rb_mod_cvar_get(VALUE obj, VALUE iv)
{
- ID id = id_for_var(obj, iv, a, class);
+ ID id = rb_check_id(&iv);
if (!id) {
- rb_name_err_raise("uninitialized class variable %1$s in %2$s",
- obj, iv);
+ if (rb_is_class_name(iv)) {
+ rb_name_error_str(iv, "uninitialized class variable %"PRIsVALUE" in %"PRIsVALUE"",
+ iv, rb_class_name(obj));
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE(iv));
+ }
+ }
+ if (!rb_is_class_id(id)) {
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE_ID(id));
}
return rb_cvar_get(obj, id);
}
@@ -2445,8 +2399,8 @@ rb_mod_cvar_get(VALUE obj, VALUE iv)
* obj.class_variable_set(symbol, obj) -> obj
* obj.class_variable_set(string, obj) -> obj
*
- * Sets the class variable named by <i>symbol</i> to the given
- * object.
+ * Sets the class variable names by <i>symbol</i> to
+ * <i>object</i>.
* If the class variable name is passed as a string, that string
* is converted to a symbol.
*
@@ -2463,8 +2417,7 @@ rb_mod_cvar_get(VALUE obj, VALUE iv)
static VALUE
rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
{
- ID id = id_for_var(obj, iv, a, class);
- if (!id) id = rb_intern_str(iv);
+ ID id = id_for_setter(iv, class, "`%"PRIsVALUE"' is not allowed as a class variable name");
rb_cvar_set(obj, id, val);
return val;
}
@@ -2488,27 +2441,24 @@ rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
static VALUE
rb_mod_cvar_defined(VALUE obj, VALUE iv)
{
- ID id = id_for_var(obj, iv, a, class);
+ ID id = rb_check_id(&iv);
if (!id) {
- return Qfalse;
+ if (rb_is_class_name(iv)) {
+ return Qfalse;
+ }
+ else {
+ rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE(iv));
+ }
+ }
+ if (!rb_is_class_id(id)) {
+ rb_name_error(id, "`%"PRIsVALUE"' is not allowed as a class variable name",
+ QUOTE_ID(id));
}
return rb_cvar_defined(obj, id);
}
-/*
- * call-seq:
- * mod.singleton_class? -> true or false
- *
- * Returns <code>true</code> if <i>mod</i> is a singleton class or
- * <code>false</code> if it is an ordinary class or module.
- *
- * class C
- * end
- * C.singleton_class? #=> false
- * C.singleton_class.singleton_class? #=> true
- */
-
static VALUE
rb_mod_singleton_p(VALUE klass)
{
@@ -2517,22 +2467,20 @@ rb_mod_singleton_p(VALUE klass)
return Qfalse;
}
-static const struct conv_method_tbl {
- const char method[6];
- unsigned short id;
+static struct conv_method_tbl {
+ const char *method;
+ ID id;
} conv_method_names[] = {
-#define M(n) {#n, (unsigned short)idTo_##n}
- M(int),
- M(ary),
- M(str),
- M(sym),
- M(hash),
- M(proc),
- M(io),
- M(a),
- M(s),
- M(i),
-#undef M
+ {"to_int", 0},
+ {"to_ary", 0},
+ {"to_str", 0},
+ {"to_sym", 0},
+ {"to_hash", 0},
+ {"to_proc", 0},
+ {"to_io", 0},
+ {"to_a", 0},
+ {"to_s", 0},
+ {NULL, 0}
};
#define IMPLICIT_CONVERSIONS 7
@@ -2540,34 +2488,27 @@ static VALUE
convert_type(VALUE val, const char *tname, const char *method, int raise)
{
ID m = 0;
- int i = numberof(conv_method_names);
+ int i;
VALUE r;
- static const char prefix[] = "to_";
-
- if (strncmp(prefix, method, sizeof(prefix)-1) == 0) {
- const char *const meth = &method[sizeof(prefix)-1];
- for (i=0; i < numberof(conv_method_names); i++) {
- if (conv_method_names[i].method[0] == meth[0] &&
- strcmp(conv_method_names[i].method, meth) == 0) {
- m = conv_method_names[i].id;
- break;
- }
+
+ for (i=0; conv_method_names[i].method; i++) {
+ if (conv_method_names[i].method[0] == method[0] &&
+ strcmp(conv_method_names[i].method, method) == 0) {
+ m = conv_method_names[i].id;
+ break;
}
}
if (!m) m = rb_intern(method);
r = rb_check_funcall(val, m, 0, 0);
if (r == Qundef) {
if (raise) {
- const char *msg = i < IMPLICIT_CONVERSIONS ?
- "no implicit conversion of" : "can't convert";
- const char *cname = NIL_P(val) ? "nil" :
- val == Qtrue ? "true" :
- val == Qfalse ? "false" :
- NULL;
- if (cname)
- rb_raise(rb_eTypeError, "%s %s into %s", msg, cname, tname);
- rb_raise(rb_eTypeError, "%s %"PRIsVALUE" into %s", msg,
- rb_obj_class(val),
+ rb_raise(rb_eTypeError, i < IMPLICIT_CONVERSIONS
+ ? "no implicit conversion of %s into %s"
+ : "can't convert %s into %s",
+ NIL_P(val) ? "nil" :
+ val == Qtrue ? "true" :
+ val == Qfalse ? "false" :
+ rb_obj_classname(val),
tname);
}
return Qnil;
@@ -2575,16 +2516,6 @@ convert_type(VALUE val, const char *tname, const char *method, int raise)
return r;
}
-NORETURN(static void conversion_mismatch(VALUE, const char *, const char *, VALUE));
-static void
-conversion_mismatch(VALUE val, const char *tname, const char *method, VALUE result)
-{
- VALUE cname = rb_obj_class(val);
- rb_raise(rb_eTypeError,
- "can't convert %"PRIsVALUE" to %s (%"PRIsVALUE"#%s gives %"PRIsVALUE")",
- cname, tname, cname, method, rb_obj_class(result));
-}
-
VALUE
rb_convert_type(VALUE val, int type, const char *tname, const char *method)
{
@@ -2593,7 +2524,9 @@ rb_convert_type(VALUE val, int type, const char *tname, const char *method)
if (TYPE(val) == type) return val;
v = convert_type(val, tname, method, TRUE);
if (TYPE(v) != type) {
- conversion_mismatch(val, tname, method, v);
+ const char *cname = rb_obj_classname(val);
+ rb_raise(rb_eTypeError, "can't convert %s to %s (%s#%s gives %s)",
+ cname, tname, cname, method, rb_obj_classname(v));
}
return v;
}
@@ -2608,7 +2541,9 @@ rb_check_convert_type(VALUE val, int type, const char *tname, const char *method
v = convert_type(val, tname, method, FALSE);
if (NIL_P(v)) return Qnil;
if (TYPE(v) != type) {
- conversion_mismatch(val, tname, method, v);
+ const char *cname = rb_obj_classname(val);
+ rb_raise(rb_eTypeError, "can't convert %s to %s (%s#%s gives %s)",
+ cname, tname, cname, method, rb_obj_classname(v));
}
return v;
}
@@ -2623,7 +2558,9 @@ rb_to_integer(VALUE val, const char *method)
if (RB_TYPE_P(val, T_BIGNUM)) return val;
v = convert_type(val, "Integer", method, TRUE);
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
- conversion_mismatch(val, "Integer", method, v);
+ const char *cname = rb_obj_classname(val);
+ rb_raise(rb_eTypeError, "can't convert %s to Integer (%s#%s gives %s)",
+ cname, cname, method, rb_obj_classname(v));
}
return v;
}
@@ -2707,26 +2644,24 @@ rb_Integer(VALUE val)
/*
* call-seq:
- * Integer(arg, base=0) -> integer
+ * Integer(arg,base=0) -> integer
*
* Converts <i>arg</i> to a <code>Fixnum</code> or <code>Bignum</code>.
* Numeric types are converted directly (with floating point numbers
- * being truncated). <i>base</i> (0, or between 2 and 36) is a base for
+ * being truncated). <i>base</i> (0, or between 2 and 36) is a base for
* integer string representation. If <i>arg</i> is a <code>String</code>,
- * when <i>base</i> is omitted or equals zero, radix indicators
+ * when <i>base</i> is omitted or equals to zero, radix indicators
* (<code>0</code>, <code>0b</code>, and <code>0x</code>) are honored.
* In any case, strings should be strictly conformed to numeric
* representation. This behavior is different from that of
- * <code>String#to_i</code>. Non string values will be converted by first
- * trying <code>to_int</code>, then <code>to_i</code>. Passing <code>nil</code>
- * raises a TypeError.
+ * <code>String#to_i</code>. Non string values will be converted using
+ * <code>to_int</code>, and <code>to_i</code>.
*
* Integer(123.999) #=> 123
* Integer("0x1a") #=> 26
* Integer(Time.new) #=> 1204973019
* Integer("0930", 10) #=> 930
* Integer("111", 2) #=> 7
- * Integer(nil) #=> TypeError
*/
static VALUE
@@ -2860,97 +2795,43 @@ rb_str_to_dbl(VALUE str, int badcheck)
return ret;
}
-#define fix2dbl_without_to_f(x) (double)FIX2LONG(x)
-#define big2dbl_without_to_f(x) rb_big2dbl(x)
-#define int2dbl_without_to_f(x) \
- (FIXNUM_P(x) ? fix2dbl_without_to_f(x) : big2dbl_without_to_f(x))
-#define rat2dbl_without_to_f(x) \
- (int2dbl_without_to_f(rb_rational_num(x)) / \
- int2dbl_without_to_f(rb_rational_den(x)))
-
-#define special_const_to_float(val, pre, post) \
- switch (val) { \
- case Qnil: \
- rb_raise(rb_eTypeError, pre "nil" post); \
- case Qtrue: \
- rb_raise(rb_eTypeError, pre "true" post); \
- case Qfalse: \
- rb_raise(rb_eTypeError, pre "false" post); \
- }
-
-static inline void
-conversion_to_float(VALUE val)
-{
- special_const_to_float(val, "can't convert ", " into Float");
-}
-
-static inline void
-implicit_conversion_to_float(VALUE val)
-{
- special_const_to_float(val, "no implicit conversion to float from ", "");
-}
-
-static int
-to_float(VALUE *valp)
-{
- VALUE val = *valp;
- if (SPECIAL_CONST_P(val)) {
- if (FIXNUM_P(val)) {
- *valp = DBL2NUM(fix2dbl_without_to_f(val));
- return T_FLOAT;
- }
- else if (FLONUM_P(val)) {
- return T_FLOAT;
- }
- else {
- conversion_to_float(val);
- }
- }
- else {
- int type = BUILTIN_TYPE(val);
- switch (type) {
- case T_FLOAT:
- return T_FLOAT;
- case T_BIGNUM:
- *valp = DBL2NUM(big2dbl_without_to_f(val));
- return T_FLOAT;
- case T_RATIONAL:
- *valp = DBL2NUM(rat2dbl_without_to_f(val));
- return T_FLOAT;
- case T_STRING:
- return T_STRING;
- }
- }
- return T_NONE;
-}
-
VALUE
rb_Float(VALUE val)
{
- switch (to_float(&val)) {
+ switch (TYPE(val)) {
+ case T_FIXNUM:
+ return DBL2NUM((double)FIX2LONG(val));
+
case T_FLOAT:
return val;
+
+ case T_BIGNUM:
+ return DBL2NUM(rb_big2dbl(val));
+
case T_STRING:
return DBL2NUM(rb_str_to_dbl(val, TRUE));
+
+ case T_NIL:
+ rb_raise(rb_eTypeError, "can't convert nil into Float");
+ break;
+
+ default:
+ return rb_convert_type(val, T_FLOAT, "Float", "to_f");
}
- return rb_convert_type(val, T_FLOAT, "Float", "to_f");
-}
-FUNC_MINIMIZED(static VALUE rb_f_float(VALUE obj, VALUE arg));
+ UNREACHABLE;
+}
/*
* call-seq:
* Float(arg) -> float
*
* Returns <i>arg</i> converted to a float. Numeric types are converted
- * directly, and with exception to string and nil the rest are converted using <i>arg</i>.to_f.
- * Converting a <code>string</code> with invalid characters will result in a <code>ArgumentError</code>.
- * Converting <code>nil</code> generates a <code>TypeError</code>.
+ * directly, the rest are converted using <i>arg</i>.to_f. As of Ruby
+ * 1.8, converting <code>nil</code> generates a <code>TypeError</code>.
*
- * Float(1) #=> 1.0
- * Float("123.456") #=> 123.456
- * Float("123.0_badstring") #=> ArgumentError: invalid value for Float(): "123.0_badstring"
- * Float(nil) #=> TypeError: can't convert nil into Float
+ * Float(1) #=> 1.0
+ * Float("123.456") #=> 123.456
*/
static VALUE
@@ -2959,24 +2840,18 @@ rb_f_float(VALUE obj, VALUE arg)
return rb_Float(arg);
}
-static VALUE
-numeric_to_float(VALUE val)
-{
- if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
- rb_raise(rb_eTypeError, "can't convert %"PRIsVALUE" into Float",
- rb_obj_class(val));
- }
- return rb_convert_type(val, T_FLOAT, "Float", "to_f");
-}
-
VALUE
rb_to_float(VALUE val)
{
- switch (to_float(&val)) {
- case T_FLOAT:
- return val;
+ if (RB_TYPE_P(val, T_FLOAT)) return val;
+ if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
+ rb_raise(rb_eTypeError, "can't convert %s into Float",
+ NIL_P(val) ? "nil" :
+ val == Qtrue ? "true" :
+ val == Qfalse ? "false" :
+ rb_obj_classname(val));
}
- return numeric_to_float(val);
+ return rb_convert_type(val, T_FLOAT, "Float", "to_f");
}
VALUE
@@ -2989,75 +2864,26 @@ rb_check_to_float(VALUE val)
return rb_check_convert_type(val, T_FLOAT, "Float", "to_f");
}
-static ID id_to_f;
-
-static inline int
-basic_to_f_p(VALUE klass)
-{
- return rb_method_basic_definition_p(klass, id_to_f);
-}
-
-double
-rb_num_to_dbl(VALUE val)
-{
- if (SPECIAL_CONST_P(val)) {
- if (FIXNUM_P(val)) {
- if (basic_to_f_p(rb_cFixnum))
- return fix2dbl_without_to_f(val);
- }
- else if (FLONUM_P(val)) {
- return rb_float_flonum_value(val);
- }
- else {
- conversion_to_float(val);
- }
- }
- else {
- switch (BUILTIN_TYPE(val)) {
- case T_FLOAT:
- return rb_float_noflonum_value(val);
- case T_BIGNUM:
- if (basic_to_f_p(rb_cBignum))
- return big2dbl_without_to_f(val);
- break;
- case T_RATIONAL:
- if (basic_to_f_p(rb_cRational))
- return rat2dbl_without_to_f(val);
- break;
- }
- }
- val = numeric_to_float(val);
- return RFLOAT_VALUE(val);
-}
-
double
rb_num2dbl(VALUE val)
{
- if (SPECIAL_CONST_P(val)) {
- if (FIXNUM_P(val)) {
- return fix2dbl_without_to_f(val);
- }
- else if (FLONUM_P(val)) {
- return rb_float_flonum_value(val);
- }
- else {
- implicit_conversion_to_float(val);
- }
- }
- else {
- switch (BUILTIN_TYPE(val)) {
- case T_FLOAT:
- return rb_float_noflonum_value(val);
- case T_BIGNUM:
- return big2dbl_without_to_f(val);
- case T_RATIONAL:
- return rat2dbl_without_to_f(val);
- case T_STRING:
- rb_raise(rb_eTypeError, "no implicit conversion to float from string");
- }
+ switch (TYPE(val)) {
+ case T_FLOAT:
+ return RFLOAT_VALUE(val);
+
+ case T_STRING:
+ rb_raise(rb_eTypeError, "no implicit conversion to float from string");
+ break;
+
+ case T_NIL:
+ rb_raise(rb_eTypeError, "no implicit conversion to float from nil");
+ break;
+
+ default:
+ break;
}
- val = rb_convert_type(val, T_FLOAT, "Float", "to_f");
- return RFLOAT_VALUE(val);
+
+ return RFLOAT_VALUE(rb_Float(val));
}
VALUE
@@ -3074,9 +2900,8 @@ rb_String(VALUE val)
* call-seq:
* String(arg) -> string
*
- * Returns <i>arg</i> as a <code>String</code>.
- *
- * First tries to call its <code>to_str</code> method, then its <code>to_s</code> method.
+ * Converts <i>arg</i> to a <code>String</code> by calling its
+ * <code>to_s</code> method.
*
* String(self) #=> "main"
* String(self.class) #=> "Object"
@@ -3109,7 +2934,7 @@ rb_Array(VALUE val)
*
* Returns +arg+ as an Array.
*
- * First tries to call <code>to_ary</code> on +arg+, then <code>to_a</code>.
+ * First tries to call Array#to_ary on +arg+, then Array#to_a.
*
* Array(1..5) #=> [1, 2, 3, 4, 5]
*/
@@ -3155,68 +2980,6 @@ rb_f_hash(VALUE obj, VALUE arg)
return rb_Hash(arg);
}
-struct dig_method {
- VALUE klass;
- int basic;
-};
-
-static ID id_dig;
-
-static int
-dig_basic_p(VALUE obj, struct dig_method *cache)
-{
- VALUE klass = RBASIC_CLASS(obj);
- if (klass != cache->klass) {
- cache->klass = klass;
- cache->basic = rb_method_basic_definition_p(klass, id_dig);
- }
- return cache->basic;
-}
-
-static void
-no_dig_method(int found, VALUE recv, ID mid, int argc, const VALUE *argv, VALUE data)
-{
- if (!found) {
- rb_raise(rb_eTypeError, "%"PRIsVALUE" does not have #dig method",
- CLASS_OF(data));
- }
-}
-
-VALUE
-rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
-{
- struct dig_method hash = {Qnil}, ary = {Qnil}, strt = {Qnil};
-
- for (; argc > 0; ++argv, --argc) {
- if (NIL_P(obj)) return notfound;
- if (!SPECIAL_CONST_P(obj)) {
- switch (BUILTIN_TYPE(obj)) {
- case T_HASH:
- if (dig_basic_p(obj, &hash)) {
- obj = rb_hash_aref(obj, *argv);
- continue;
- }
- break;
- case T_ARRAY:
- if (dig_basic_p(obj, &ary)) {
- obj = rb_ary_at(obj, *argv);
- continue;
- }
- break;
- case T_STRUCT:
- if (dig_basic_p(obj, &strt)) {
- obj = rb_struct_lookup(obj, *argv);
- continue;
- }
- break;
- }
- }
- return rb_check_funcall_with_hook(obj, id_dig, argc, argv,
- no_dig_method, obj);
- }
- return obj;
-}
-
/*
* Document-class: Class
*
@@ -3226,7 +2989,7 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
* Typically, you create a new class by using:
*
* class Name
- * # some code describing the class behavior
+ * # some class describing the class behavior
* end
*
* When a new class is created, an object of type Class is initialized and
@@ -3238,17 +3001,19 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
* <code>Class</code>:
*
* class Class
- * alias old_new new
- * def new(*args)
- * print "Creating a new ", self.name, "\n"
- * old_new(*args)
- * end
- * end
+ * alias oldNew new
+ * def new(*args)
+ * print "Creating a new ", self.name, "\n"
+ * oldNew(*args)
+ * end
+ * end
*
- * class Name
- * end
*
- * n = Name.new
+ * class Name
+ * end
+ *
+ *
+ * n = Name.new
*
* <em>produces:</em>
*
@@ -3256,7 +3021,7 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
*
* Classes, modules, and objects are interrelated. In the diagram
* that follows, the vertical arrows represent inheritance, and the
- * parentheses metaclasses. All metaclasses are instances
+ * parentheses meta-classes. All metaclasses are instances
* of the class `Class'.
* +---------+ +-...
* | | |
@@ -3317,7 +3082,7 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
*
* BasicObject does not include Kernel (for methods like +puts+) and
* BasicObject is outside of the namespace of the standard library so common
- * classes will not be found without using a full class path.
+ * classes will not be found without a using a full class path.
*
* A variety of strategies can be used to provide useful portions of the
* standard library to subclasses of BasicObject. A subclass could
@@ -3355,7 +3120,7 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
*
* Object is the default root of all Ruby objects. Object inherits from
* BasicObject which allows creating alternate object hierarchies. Methods
- * on Object are available to all classes unless explicitly overridden.
+ * on object are available to all classes unless explicitly overridden.
*
* Object mixes in the Kernel module, making the built-in kernel functions
* globally accessible. Although the instance methods of Object are defined
@@ -3371,8 +3136,10 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound)
*/
void
-InitVM_Object(void)
+Init_Object(void)
{
+ int i;
+
Init_class_hierarchy();
#if 0
@@ -3431,7 +3198,6 @@ InitVM_Object(void)
rb_define_method(rb_mKernel, "singleton_class", rb_obj_singleton_class, 0);
rb_define_method(rb_mKernel, "clone", rb_obj_clone, 0);
rb_define_method(rb_mKernel, "dup", rb_obj_dup, 0);
- rb_define_method(rb_mKernel, "itself", rb_obj_itself, 0);
rb_define_method(rb_mKernel, "initialize_copy", rb_obj_init_copy, 1);
rb_define_method(rb_mKernel, "initialize_dup", rb_obj_init_dup_clone, 1);
rb_define_method(rb_mKernel, "initialize_clone", rb_obj_init_dup_clone, 1);
@@ -3484,7 +3250,6 @@ InitVM_Object(void)
rb_define_method(rb_cNilClass, "&", false_and, 1);
rb_define_method(rb_cNilClass, "|", false_or, 1);
rb_define_method(rb_cNilClass, "^", false_xor, 1);
- rb_define_method(rb_cNilClass, "===", rb_equal, 1);
rb_define_method(rb_cNilClass, "nil?", rb_true, 0);
rb_undef_alloc_func(rb_cNilClass);
@@ -3517,7 +3282,6 @@ InitVM_Object(void)
rb_define_alloc_func(rb_cModule, rb_module_s_alloc);
rb_define_method(rb_cModule, "initialize", rb_mod_initialize, 0);
- rb_define_method(rb_cModule, "initialize_clone", rb_mod_initialize_clone, 1);
rb_define_method(rb_cModule, "instance_methods", rb_class_instance_methods, -1); /* in class.c */
rb_define_method(rb_cModule, "public_instance_methods",
rb_class_public_instance_methods, -1); /* in class.c */
@@ -3543,7 +3307,6 @@ InitVM_Object(void)
rb_define_method(rb_cModule, "class_variable_defined?", rb_mod_cvar_defined, 1);
rb_define_method(rb_cModule, "public_constant", rb_mod_public_constant, -1); /* in variable.c */
rb_define_method(rb_cModule, "private_constant", rb_mod_private_constant, -1); /* in variable.c */
- rb_define_method(rb_cModule, "deprecate_constant", rb_mod_deprecate_constant, -1); /* in variable.c */
rb_define_method(rb_cModule, "singleton_class?", rb_mod_singleton_p, 0);
rb_define_method(rb_cClass, "allocate", rb_obj_alloc, 0);
@@ -3570,7 +3333,6 @@ InitVM_Object(void)
rb_define_method(rb_cTrueClass, "&", true_and, 1);
rb_define_method(rb_cTrueClass, "|", true_or, 1);
rb_define_method(rb_cTrueClass, "^", true_xor, 1);
- rb_define_method(rb_cTrueClass, "===", rb_equal, 1);
rb_undef_alloc_func(rb_cTrueClass);
rb_undef_method(CLASS_OF(rb_cTrueClass), "new");
/*
@@ -3584,19 +3346,14 @@ InitVM_Object(void)
rb_define_method(rb_cFalseClass, "&", false_and, 1);
rb_define_method(rb_cFalseClass, "|", false_or, 1);
rb_define_method(rb_cFalseClass, "^", false_xor, 1);
- rb_define_method(rb_cFalseClass, "===", rb_equal, 1);
rb_undef_alloc_func(rb_cFalseClass);
rb_undef_method(CLASS_OF(rb_cFalseClass), "new");
/*
* An alias of +false+
*/
rb_define_global_const("FALSE", Qfalse);
-}
-void
-Init_Object(void)
-{
- id_to_f = rb_intern_const("to_f");
- id_dig = rb_intern_const("dig");
- InitVM(Object);
+ for (i=0; conv_method_names[i].method; i++) {
+ conv_method_names[i].id = rb_intern(conv_method_names[i].method);
+ }
}
diff --git a/pack.c b/pack.c
index d19f9d1dd2..71dd6afcb3 100644
--- a/pack.c
+++ b/pack.c
@@ -9,6 +9,8 @@
**********************************************************************/
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "internal.h"
#include <sys/types.h>
#include <ctype.h>
@@ -23,11 +25,11 @@
* This behavior is consistent with the document of pack/unpack.
*/
#ifdef HAVE_TRUE_LONG_LONG
-static const char natstr[] = "sSiIlLqQjJ";
+static const char natstr[] = "sSiIlLqQ";
#else
-static const char natstr[] = "sSiIlLjJ";
+static const char natstr[] = "sSiIlL";
#endif
-static const char endstr[] = "sSiIlLqQjJ";
+static const char endstr[] = "sSiIlLqQ";
#ifdef HAVE_TRUE_LONG_LONG
/* It is intentional to use long long instead of LONG_LONG. */
@@ -68,18 +70,99 @@ static const char endstr[] = "sSiIlLqQjJ";
# define NATINT_LEN(type,len) ((int)sizeof(type))
#endif
-typedef union {
- float f;
- uint32_t u;
- char buf[4];
-} FLOAT_SWAPPER;
-typedef union {
- double d;
- uint64_t u;
- char buf[8];
-} DOUBLE_SWAPPER;
-#define swapf(x) swap32(x)
-#define swapd(x) swap64(x)
+#if SIZEOF_LONG == 8
+# define INT64toNUM(x) LONG2NUM(x)
+# define UINT64toNUM(x) ULONG2NUM(x)
+#elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8
+# define INT64toNUM(x) LL2NUM(x)
+# define UINT64toNUM(x) ULL2NUM(x)
+#endif
+
+#define define_swapx(x, xtype) \
+static xtype \
+TOKEN_PASTE(swap,x)(xtype z) \
+{ \
+ xtype r; \
+ xtype *zp; \
+ unsigned char *s, *t; \
+ int i; \
+ \
+ zp = xmalloc(sizeof(xtype)); \
+ *zp = z; \
+ s = (unsigned char*)zp; \
+ t = xmalloc(sizeof(xtype)); \
+ for (i=0; i<sizeof(xtype); i++) { \
+ t[sizeof(xtype)-i-1] = s[i]; \
+ } \
+ r = *(xtype *)t; \
+ xfree(t); \
+ xfree(zp); \
+ return r; \
+}
+
+#if SIZEOF_SHORT == 2
+# define swaps(x) swap16(x)
+#elif SIZEOF_SHORT == 4
+# define swaps(x) swap32(x)
+#else
+ define_swapx(s,short)
+#endif
+
+#if SIZEOF_INT == 2
+# define swapi(x) swap16(x)
+#elif SIZEOF_INT == 4
+# define swapi(x) swap32(x)
+#else
+ define_swapx(i,int)
+#endif
+
+#if SIZEOF_LONG == 4
+# define swapl(x) swap32(x)
+#elif SIZEOF_LONG == 8
+# define swapl(x) swap64(x)
+#else
+ define_swapx(l,long)
+#endif
+
+#ifdef HAVE_LONG_LONG
+# if SIZEOF_LONG_LONG == 8
+# define swapll(x) swap64(x)
+# else
+ define_swapx(ll,LONG_LONG)
+# endif
+#endif
+
+#if SIZEOF_FLOAT == 4 && defined(HAVE_INT32_T)
+# define swapf(x) swap32(x)
+# define FLOAT_SWAPPER uint32_t
+#else
+ define_swapx(f,float)
+#endif
+
+#if SIZEOF_DOUBLE == 8 && defined(HAVE_INT64_T)
+# define swapd(x) swap64(x)
+# define DOUBLE_SWAPPER uint64_t
+#elif SIZEOF_DOUBLE == 8 && defined(HAVE_INT32_T)
+ static double
+ swapd(const double d)
+ {
+ double dtmp = d;
+ uint32_t utmp[2];
+ uint32_t utmp0;
+
+ utmp[0] = 0; utmp[1] = 0;
+ memcpy(utmp,&dtmp,sizeof(double));
+ utmp0 = utmp[0];
+ utmp[0] = swap32(utmp[1]);
+ utmp[1] = swap32(utmp0);
+ memcpy(&dtmp,utmp,sizeof(double));
+ return dtmp;
+ }
+#else
+ define_swapx(d, double)
+#endif
+
+#undef define_swapx
#define rb_ntohf(x) (BIGENDIAN_P()?(x):swapf(x))
#define rb_ntohd(x) (BIGENDIAN_P()?(x):swapd(x))
@@ -90,17 +173,57 @@ typedef union {
#define rb_vtohf(x) (BIGENDIAN_P()?swapf(x):(x))
#define rb_vtohd(x) (BIGENDIAN_P()?swapd(x):(x))
-#define FLOAT_CONVWITH(x) FLOAT_SWAPPER x;
-#define HTONF(x) ((x).u = rb_htonf((x).u))
-#define HTOVF(x) ((x).u = rb_htovf((x).u))
-#define NTOHF(x) ((x).u = rb_ntohf((x).u))
-#define VTOHF(x) ((x).u = rb_vtohf((x).u))
+#ifdef FLOAT_SWAPPER
+# define FLOAT_CONVWITH(y) FLOAT_SWAPPER y;
+# define HTONF(x,y) (memcpy(&(y),&(x),sizeof(float)), \
+ (y) = rb_htonf((FLOAT_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(float)), \
+ (x))
+# define HTOVF(x,y) (memcpy(&(y),&(x),sizeof(float)), \
+ (y) = rb_htovf((FLOAT_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(float)), \
+ (x))
+# define NTOHF(x,y) (memcpy(&(y),&(x),sizeof(float)), \
+ (y) = rb_ntohf((FLOAT_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(float)), \
+ (x))
+# define VTOHF(x,y) (memcpy(&(y),&(x),sizeof(float)), \
+ (y) = rb_vtohf((FLOAT_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(float)), \
+ (x))
+#else
+# define FLOAT_CONVWITH(y)
+# define HTONF(x,y) rb_htonf(x)
+# define HTOVF(x,y) rb_htovf(x)
+# define NTOHF(x,y) rb_ntohf(x)
+# define VTOHF(x,y) rb_vtohf(x)
+#endif
-#define DOUBLE_CONVWITH(x) DOUBLE_SWAPPER x;
-#define HTOND(x) ((x).u = rb_htond((x).u))
-#define HTOVD(x) ((x).u = rb_htovd((x).u))
-#define NTOHD(x) ((x).u = rb_ntohd((x).u))
-#define VTOHD(x) ((x).u = rb_vtohd((x).u))
+#ifdef DOUBLE_SWAPPER
+# define DOUBLE_CONVWITH(y) DOUBLE_SWAPPER y;
+# define HTOND(x,y) (memcpy(&(y),&(x),sizeof(double)), \
+ (y) = rb_htond((DOUBLE_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(double)), \
+ (x))
+# define HTOVD(x,y) (memcpy(&(y),&(x),sizeof(double)), \
+ (y) = rb_htovd((DOUBLE_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(double)), \
+ (x))
+# define NTOHD(x,y) (memcpy(&(y),&(x),sizeof(double)), \
+ (y) = rb_ntohd((DOUBLE_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(double)), \
+ (x))
+# define VTOHD(x,y) (memcpy(&(y),&(x),sizeof(double)), \
+ (y) = rb_vtohd((DOUBLE_SWAPPER)(y)), \
+ memcpy(&(x),&(y),sizeof(double)), \
+ (x))
+#else
+# define DOUBLE_CONVWITH(y)
+# define HTOND(x,y) rb_htond(x)
+# define HTOVD(x,y) rb_htovd(x)
+# define NTOHD(x,y) rb_ntohd(x)
+# define VTOHD(x,y) rb_vtohd(x)
+#endif
#define MAX_INTEGER_PACK_SIZE 8
@@ -111,45 +234,6 @@ static void qpencode(VALUE,VALUE,long);
static unsigned long utf8_to_uv(const char*,long*);
-static ID id_associated;
-
-static void
-str_associate(VALUE str, VALUE add)
-{
- VALUE assoc;
-
- assoc = rb_attr_get(str, id_associated);
- if (RB_TYPE_P(assoc, T_ARRAY)) {
- /* already associated */
- rb_ary_concat(assoc, add);
- }
- else {
- rb_ivar_set(str, id_associated, add);
- }
-}
-
-static VALUE
-str_associated(VALUE str)
-{
- VALUE assoc = rb_attr_get(str, id_associated);
- if (NIL_P(assoc)) assoc = Qfalse;
- return assoc;
-}
-
-void
-rb_str_associate(VALUE str, VALUE add)
-{
- rb_warn("rb_str_associate() is only for internal use and deprecated; do not use");
- str_associate(str, add);
-}
-
-VALUE
-rb_str_associated(VALUE str)
-{
- rb_warn("rb_str_associated() is only for internal use and deprecated; do not use");
- return str_associated(str);
-}
-
/*
* call-seq:
* arr.pack ( aTemplateString ) -> aBinaryString
@@ -183,15 +267,11 @@ rb_str_associated(VALUE str)
* S | Integer | 16-bit unsigned, native endian (uint16_t)
* L | Integer | 32-bit unsigned, native endian (uint32_t)
* Q | Integer | 64-bit unsigned, native endian (uint64_t)
- * J | Integer | pointer width unsigned, native endian (uintptr_t)
- * | | (J is available since Ruby 2.3.)
* | |
* c | Integer | 8-bit signed (signed char)
* s | Integer | 16-bit signed, native endian (int16_t)
* l | Integer | 32-bit signed, native endian (int32_t)
* q | Integer | 64-bit signed, native endian (int64_t)
- * j | Integer | pointer width signed, native endian (intptr_t)
- * | | (j is available since Ruby 2.3.)
* | |
* S_, S! | Integer | unsigned short, native endian
* I, I_, I! | Integer | unsigned int, native endian
@@ -199,8 +279,6 @@ rb_str_associated(VALUE str)
* Q_, Q! | Integer | unsigned long long, native endian (ArgumentError
* | | if the platform has no long long type.)
* | | (Q_ and Q! is available since Ruby 2.1.)
- * J! | Integer | uintptr_t, native endian (same with J)
- * | | (J! is available since Ruby 2.3.)
* | |
* s_, s! | Integer | signed short, native endian
* i, i_, i! | Integer | signed int, native endian
@@ -208,26 +286,20 @@ rb_str_associated(VALUE str)
* q_, q! | Integer | signed long long, native endian (ArgumentError
* | | if the platform has no long long type.)
* | | (q_ and q! is available since Ruby 2.1.)
- * j! | Integer | intptr_t, native endian (same with j)
- * | | (j! is available since Ruby 2.3.)
* | |
* S> L> Q> | Integer | same as the directives without ">" except
- * J> s> l> | | big endian
- * q> j> | | (available since Ruby 1.9.3)
- * S!> I!> | | "S>" is same as "n"
- * L!> Q!> | | "L>" is same as "N"
- * J!> s!> | |
- * i!> l!> | |
- * q!> j!> | |
+ * s> l> q> | | big endian
+ * S!> I!> | | (available since Ruby 1.9.3)
+ * L!> Q!> | | "S>" is same as "n"
+ * s!> i!> | | "L>" is same as "N"
+ * l!> q!> | |
* | |
* S< L< Q< | Integer | same as the directives without "<" except
- * J< s< l< | | little endian
- * q< j< | | (available since Ruby 1.9.3)
- * S!< I!< | | "S<" is same as "v"
- * L!< Q!< | | "L<" is same as "V"
- * J!< s!< | |
- * i!< l!< | |
- * q!< j!< | |
+ * s< l< q< | | little endian
+ * S!< I!< | | (available since Ruby 1.9.3)
+ * L!< Q!< | | "S<" is same as "v"
+ * s!< i!< | | "L<" is same as "V"
+ * l!< q!< | |
* | |
* n | Integer | 16-bit unsigned, network (big-endian) byte order
* N | Integer | 32-bit unsigned, network (big-endian) byte order
@@ -280,7 +352,7 @@ pack_pack(VALUE ary, VALUE fmt)
const char *p, *pend;
VALUE res, from, associates = 0;
char type;
- long len, idx, plen;
+ long items, len, idx, plen;
const char *ptr;
int enc_info = 1; /* 0 - BINARY, 1 - US-ASCII, 2 - UTF-8 */
#ifdef NATINT_PACK
@@ -293,12 +365,12 @@ pack_pack(VALUE ary, VALUE fmt)
pend = p + RSTRING_LEN(fmt);
res = rb_str_buf_new(0);
+ items = RARRAY_LEN(ary);
idx = 0;
#define TOO_FEW (rb_raise(rb_eArgError, toofew), 0)
-#define MORE_ITEM (idx < RARRAY_LEN(ary))
-#define THISFROM (MORE_ITEM ? RARRAY_AREF(ary, idx) : TOO_FEW)
-#define NEXTFROM (MORE_ITEM ? RARRAY_AREF(ary, idx++) : TOO_FEW)
+#define THISFROM (items > 0 ? RARRAY_AREF(ary, idx) : TOO_FEW)
+#define NEXTFROM (items-- > 0 ? RARRAY_AREF(ary, idx++) : TOO_FEW)
while (p < pend) {
int explicit_endian = 0;
@@ -350,7 +422,7 @@ pack_pack(VALUE ary, VALUE fmt)
if (*p == '*') { /* set data length */
len = strchr("@Xxu", type) ? 0
: strchr("PMm", type) ? 1
- : RARRAY_LEN(ary) - idx;
+ : items;
p++;
}
else if (ISDIGIT(*p)) {
@@ -589,16 +661,6 @@ pack_pack(VALUE ary, VALUE fmt)
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'j': /* j for intptr_t */
- integer_size = sizeof(intptr_t);
- bigendian_p = BIGENDIAN_P();
- goto pack_integer;
-
- case 'J': /* J for uintptr_t */
- integer_size = sizeof(uintptr_t);
- bigendian_p = BIGENDIAN_P();
- goto pack_integer;
-
case 'n': /* 16 bit (2 bytes) integer (network byte-order) */
integer_size = 2;
bigendian_p = 1;
@@ -649,22 +711,25 @@ pack_pack(VALUE ary, VALUE fmt)
case 'e': /* single precision float in VAX byte-order */
while (len-- > 0) {
- FLOAT_CONVWITH(tmp);
+ float f;
+ FLOAT_CONVWITH(ftmp);
from = NEXTFROM;
- tmp.f = (float)RFLOAT_VALUE(rb_to_float(from));
- HTOVF(tmp);
- rb_str_buf_cat(res, tmp.buf, sizeof(float));
+ f = (float)RFLOAT_VALUE(rb_to_float(from));
+ f = HTOVF(f,ftmp);
+ rb_str_buf_cat(res, (char*)&f, sizeof(float));
}
break;
case 'E': /* double precision float in VAX byte-order */
while (len-- > 0) {
- DOUBLE_CONVWITH(tmp);
+ double d;
+ DOUBLE_CONVWITH(dtmp);
+
from = NEXTFROM;
- tmp.d = RFLOAT_VALUE(rb_to_float(from));
- HTOVD(tmp);
- rb_str_buf_cat(res, tmp.buf, sizeof(double));
+ d = RFLOAT_VALUE(rb_to_float(from));
+ d = HTOVD(d,dtmp);
+ rb_str_buf_cat(res, (char*)&d, sizeof(double));
}
break;
@@ -681,22 +746,25 @@ pack_pack(VALUE ary, VALUE fmt)
case 'g': /* single precision float in network byte-order */
while (len-- > 0) {
- FLOAT_CONVWITH(tmp);
+ float f;
+ FLOAT_CONVWITH(ftmp);
+
from = NEXTFROM;
- tmp.f = (float)RFLOAT_VALUE(rb_to_float(from));
- HTONF(tmp);
- rb_str_buf_cat(res, tmp.buf, sizeof(float));
+ f = (float)RFLOAT_VALUE(rb_to_float(from));
+ f = HTONF(f,ftmp);
+ rb_str_buf_cat(res, (char*)&f, sizeof(float));
}
break;
case 'G': /* double precision float in network byte-order */
while (len-- > 0) {
- DOUBLE_CONVWITH(tmp);
+ double d;
+ DOUBLE_CONVWITH(dtmp);
from = NEXTFROM;
- tmp.d = RFLOAT_VALUE(rb_to_float(from));
- HTOND(tmp);
- rb_str_buf_cat(res, tmp.buf, sizeof(double));
+ d = RFLOAT_VALUE(rb_to_float(from));
+ d = HTOND(d,dtmp);
+ rb_str_buf_cat(res, (char*)&d, sizeof(double));
}
break;
@@ -803,12 +871,12 @@ pack_pack(VALUE ary, VALUE fmt)
}
else {
t = StringValuePtr(from);
- rb_obj_taint(from);
}
if (!associates) {
associates = rb_ary_new();
}
rb_ary_push(associates, from);
+ rb_obj_taint(from);
rb_str_buf_cat(res, (char*)&t, sizeof(char*));
}
break;
@@ -845,24 +913,15 @@ pack_pack(VALUE ary, VALUE fmt)
}
break;
- default: {
- char unknown[5];
- if (ISPRINT(type)) {
- unknown[0] = type;
- unknown[1] = '\0';
- }
- else {
- snprintf(unknown, sizeof(unknown), "\\x%.2x", type & 0xff);
- }
- rb_warning("unknown pack directive '%s' in '% "PRIsVALUE"'",
- unknown, fmt);
+ default:
+ rb_warning("unknown pack directive '%c' in '%s'",
+ type, RSTRING_PTR(fmt));
break;
- }
}
}
if (associates) {
- str_associate(res, associates);
+ rb_str_associate(res, associates);
}
OBJ_INFECT(res, fmt);
switch (enc_info) {
@@ -885,14 +944,12 @@ static const char b64_table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static void
-encodes(VALUE str, const char *s0, long len, int type, int tail_lf)
+encodes(VALUE str, const char *s, long len, int type, int tail_lf)
{
- enum {buff_size = 4096, encoded_unit = 4, input_unit = 3};
- char buff[buff_size + 1]; /* +1 for tail_lf */
+ char buff[4096];
long i = 0;
- const char *const trans = type == 'u' ? uu_table : b64_table;
+ const char *trans = type == 'u' ? uu_table : b64_table;
char padding;
- const unsigned char *s = (const unsigned char *)s0;
if (type == 'u') {
buff[i++] = (char)len + ' ';
@@ -901,16 +958,16 @@ encodes(VALUE str, const char *s0, long len, int type, int tail_lf)
else {
padding = '=';
}
- while (len >= input_unit) {
- while (len >= input_unit && buff_size-i >= encoded_unit) {
+ while (len >= 3) {
+ while (len >= 3 && sizeof(buff)-i >= 4) {
buff[i++] = trans[077 & (*s >> 2)];
buff[i++] = trans[077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))];
buff[i++] = trans[077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))];
buff[i++] = trans[077 & s[2]];
- s += input_unit;
- len -= input_unit;
+ s += 3;
+ len -= 3;
}
- if (buff_size-i < encoded_unit) {
+ if (sizeof(buff)-i < 4) {
rb_str_buf_cat(str, buff, i);
i = 0;
}
@@ -930,7 +987,6 @@ encodes(VALUE str, const char *s0, long len, int type, int tail_lf)
}
if (tail_lf) buff[i++] = '\n';
rb_str_buf_cat(str, buff, i);
- if ((size_t)i > sizeof(buff)) rb_bug("encodes() buffer overrun");
}
static const char hex_table[] = "0123456789ABCDEF";
@@ -1013,15 +1069,6 @@ hex2num(char c)
rb_ary_store(ary, RARRAY_LEN(ary)+tmp_len-1, Qnil); \
} while (0)
-/* Workaround for Oracle Solaris Studio 12.4 C compiler optimization bug
- * with "-xO4" optimization option.
- */
-#if defined(__SUNPRO_C) && __SUNPRO_C == 0x5130
-# define AVOID_CC_BUG volatile
-#else
-# define AVOID_CC_BUG
-#endif
-
static VALUE
infected_str_new(const char *ptr, long len, VALUE str)
{
@@ -1148,13 +1195,12 @@ infected_str_new(const char *ptr, long len, VALUE str)
static VALUE
pack_unpack(VALUE str, VALUE fmt)
{
-#define hexdigits ruby_hexdigits
+ static const char hexdigits[] = "0123456789abcdef";
char *s, *send;
char *p, *pend;
VALUE ary;
char type;
- long len;
- AVOID_CC_BUG long tmp_len;
+ long len, tmp_len;
int star;
#ifdef NATINT_PACK
int natint; /* native integer */
@@ -1291,14 +1337,13 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 8)
len = (send - s) * 8;
bits = 0;
- bitstr = rb_usascii_str_new(0, len);
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 7) bits >>= 1;
- else bits = (unsigned char)*s++;
+ else bits = *s++;
*t++ = (bits & 1) ? '1' : '0';
}
- UNPACK_PUSH(bitstr);
}
break;
@@ -1312,14 +1357,13 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 8)
len = (send - s) * 8;
bits = 0;
- bitstr = rb_usascii_str_new(0, len);
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 7) bits <<= 1;
- else bits = (unsigned char)*s++;
+ else bits = *s++;
*t++ = (bits & 128) ? '1' : '0';
}
- UNPACK_PUSH(bitstr);
}
break;
@@ -1333,16 +1377,15 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 2)
len = (send - s) * 2;
bits = 0;
- bitstr = rb_usascii_str_new(0, len);
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 1)
bits >>= 4;
else
- bits = (unsigned char)*s++;
+ bits = *s++;
*t++ = hexdigits[bits & 15];
}
- UNPACK_PUSH(bitstr);
}
break;
@@ -1356,16 +1399,15 @@ pack_unpack(VALUE str, VALUE fmt)
if (p[-1] == '*' || len > (send - s) * 2)
len = (send - s) * 2;
bits = 0;
- bitstr = rb_usascii_str_new(0, len);
+ UNPACK_PUSH(bitstr = rb_usascii_str_new(0, len));
t = RSTRING_PTR(bitstr);
for (i=0; i<len; i++) {
if (i & 1)
bits <<= 4;
else
- bits = (unsigned char)*s++;
+ bits = *s++;
*t++ = hexdigits[(bits >> 4) & 15];
}
- UNPACK_PUSH(bitstr);
}
break;
@@ -1429,18 +1471,6 @@ pack_unpack(VALUE str, VALUE fmt)
bigendian_p = BIGENDIAN_P();
goto unpack_integer;
- case 'j':
- signed_p = 1;
- integer_size = sizeof(intptr_t);
- bigendian_p = BIGENDIAN_P();
- goto unpack_integer;
-
- case 'J':
- signed_p = 0;
- integer_size = sizeof(uintptr_t);
- bigendian_p = BIGENDIAN_P();
- goto unpack_integer;
-
case 'n':
signed_p = 0;
integer_size = 2;
@@ -1497,11 +1527,13 @@ pack_unpack(VALUE str, VALUE fmt)
case 'e':
PACK_LENGTH_ADJUST_SIZE(sizeof(float));
while (len-- > 0) {
- FLOAT_CONVWITH(tmp);
- memcpy(tmp.buf, s, sizeof(float));
+ float tmp;
+ FLOAT_CONVWITH(ftmp);
+
+ memcpy(&tmp, s, sizeof(float));
s += sizeof(float);
- VTOHF(tmp);
- UNPACK_PUSH(DBL2NUM(tmp.f));
+ tmp = VTOHF(tmp,ftmp);
+ UNPACK_PUSH(DBL2NUM((double)tmp));
}
PACK_ITEM_ADJUST();
break;
@@ -1509,11 +1541,13 @@ pack_unpack(VALUE str, VALUE fmt)
case 'E':
PACK_LENGTH_ADJUST_SIZE(sizeof(double));
while (len-- > 0) {
- DOUBLE_CONVWITH(tmp);
- memcpy(tmp.buf, s, sizeof(double));
+ double tmp;
+ DOUBLE_CONVWITH(dtmp);
+
+ memcpy(&tmp, s, sizeof(double));
s += sizeof(double);
- VTOHD(tmp);
- UNPACK_PUSH(DBL2NUM(tmp.d));
+ tmp = VTOHD(tmp,dtmp);
+ UNPACK_PUSH(DBL2NUM(tmp));
}
PACK_ITEM_ADJUST();
break;
@@ -1533,11 +1567,13 @@ pack_unpack(VALUE str, VALUE fmt)
case 'g':
PACK_LENGTH_ADJUST_SIZE(sizeof(float));
while (len-- > 0) {
- FLOAT_CONVWITH(tmp);
- memcpy(tmp.buf, s, sizeof(float));
+ float tmp;
+ FLOAT_CONVWITH(ftmp);
+
+ memcpy(&tmp, s, sizeof(float));
s += sizeof(float);
- NTOHF(tmp);
- UNPACK_PUSH(DBL2NUM(tmp.f));
+ tmp = NTOHF(tmp,ftmp);
+ UNPACK_PUSH(DBL2NUM((double)tmp));
}
PACK_ITEM_ADJUST();
break;
@@ -1545,11 +1581,13 @@ pack_unpack(VALUE str, VALUE fmt)
case 'G':
PACK_LENGTH_ADJUST_SIZE(sizeof(double));
while (len-- > 0) {
- DOUBLE_CONVWITH(tmp);
- memcpy(tmp.buf, s, sizeof(double));
+ double tmp;
+ DOUBLE_CONVWITH(dtmp);
+
+ memcpy(&tmp, s, sizeof(double));
s += sizeof(double);
- NTOHD(tmp);
- UNPACK_PUSH(DBL2NUM(tmp.d));
+ tmp = NTOHD(tmp,dtmp);
+ UNPACK_PUSH(DBL2NUM(tmp));
}
PACK_ITEM_ADJUST();
break;
@@ -1572,12 +1610,12 @@ pack_unpack(VALUE str, VALUE fmt)
char *ptr = RSTRING_PTR(buf);
long total = 0;
- while (s < send && (unsigned char)*s > ' ' && (unsigned char)*s < 'a') {
+ while (s < send && *s > ' ' && *s < 'a') {
long a,b,c,d;
- char hunk[3];
-
- len = ((unsigned char)*s++ - ' ') & 077;
+ char hunk[4];
+ hunk[3] = '\0';
+ len = (*s++ - ' ') & 077;
total += len;
if (total > RSTRING_LEN(buf)) {
len -= total - RSTRING_LEN(buf);
@@ -1587,20 +1625,20 @@ pack_unpack(VALUE str, VALUE fmt)
while (len > 0) {
long mlen = len > 3 ? 3 : len;
- if (s < send && (unsigned char)*s >= ' ' && (unsigned char)*s < 'a')
- a = ((unsigned char)*s++ - ' ') & 077;
+ if (s < send && *s >= ' ')
+ a = (*s++ - ' ') & 077;
else
a = 0;
- if (s < send && (unsigned char)*s >= ' ' && (unsigned char)*s < 'a')
- b = ((unsigned char)*s++ - ' ') & 077;
+ if (s < send && *s >= ' ')
+ b = (*s++ - ' ') & 077;
else
b = 0;
- if (s < send && (unsigned char)*s >= ' ' && (unsigned char)*s < 'a')
- c = ((unsigned char)*s++ - ' ') & 077;
+ if (s < send && *s >= ' ')
+ c = (*s++ - ' ') & 077;
else
c = 0;
- if (s < send && (unsigned char)*s >= ' ' && (unsigned char)*s < 'a')
- d = ((unsigned char)*s++ - ' ') & 077;
+ if (s < send && *s >= ' ')
+ d = (*s++ - ' ') & 077;
else
d = 0;
hunk[0] = (char)(a << 2 | b >> 4);
@@ -1610,10 +1648,10 @@ pack_unpack(VALUE str, VALUE fmt)
ptr += mlen;
len -= mlen;
}
- if (s < send && (unsigned char)*s != '\r' && *s != '\n')
- s++; /* possible checksum byte */
- if (s < send && *s == '\r') s++;
- if (s < send && *s == '\n') s++;
+ if (*s == '\r') s++;
+ if (*s == '\n') s++;
+ else if (s < send && (s+1 == send || s[1] == '\n'))
+ s += 2; /* possible checksum byte */
}
rb_str_set_len(buf, total);
@@ -1763,7 +1801,7 @@ pack_unpack(VALUE str, VALUE fmt)
VALUE a;
const VALUE *p, *pend;
- if (!(a = str_associated(str))) {
+ if (!(a = rb_str_associated(str))) {
rb_raise(rb_eArgError, "no associated pointer");
}
p = RARRAY_CONST_PTR(a);
@@ -1772,7 +1810,7 @@ pack_unpack(VALUE str, VALUE fmt)
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
if (len < RSTRING_LEN(*p)) {
tmp = rb_tainted_str_new(t, len);
- str_associate(tmp, a);
+ rb_str_associate(tmp, a);
}
else {
tmp = *p;
@@ -1806,7 +1844,7 @@ pack_unpack(VALUE str, VALUE fmt)
VALUE a;
const VALUE *p, *pend;
- if (!(a = str_associated(str))) {
+ if (!(a = rb_str_associated(str))) {
rb_raise(rb_eArgError, "no associated pointer");
}
p = RARRAY_CONST_PTR(a);
@@ -1854,6 +1892,8 @@ pack_unpack(VALUE str, VALUE fmt)
return ary;
}
+#define BYTEWIDTH 8
+
int
rb_uv_to_utf8(char buf[6], unsigned long uv)
{
@@ -1966,6 +2006,4 @@ Init_pack(void)
{
rb_define_method(rb_cArray, "pack", pack_pack, 1);
rb_define_method(rb_cString, "unpack", pack_unpack, 1);
-
- id_associated = rb_make_internal_id();
}
diff --git a/parse.y b/parse.y
index aba64e6920..8207ad7133 100644
--- a/parse.y
+++ b/parse.y
@@ -11,9 +11,6 @@
%{
-#if !YYPURE
-# error needs pure parser
-#endif
#ifndef PARSER_DEBUG
#define PARSER_DEBUG 0
#endif
@@ -27,39 +24,44 @@
#include "internal.h"
#include "node.h"
#include "parse.h"
-#include "symbol.h"
+#include "id.h"
#include "regenc.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include "probes.h"
-#ifndef WARN_PAST_SCOPE
-# define WARN_PAST_SCOPE 0
-#endif
-
-#define TAB_WIDTH 8
-
#define YYMALLOC(size) rb_parser_malloc(parser, (size))
#define YYREALLOC(ptr, size) rb_parser_realloc(parser, (ptr), (size))
#define YYCALLOC(nelem, size) rb_parser_calloc(parser, (nelem), (size))
#define YYFREE(ptr) rb_parser_free(parser, (ptr))
-#define YYFPRINTF rb_parser_printf
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- rb_parser_printf(parser, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-#endif
-#undef malloc
-#undef realloc
-#undef calloc
-#undef free
#define malloc YYMALLOC
#define realloc YYREALLOC
#define calloc YYCALLOC
#define free YYFREE
+#ifndef RIPPER
+static ID register_symid(ID, const char *, long, rb_encoding *);
+static ID register_symid_str(ID, VALUE);
+#define REGISTER_SYMID(id, name) register_symid((id), (name), strlen(name), enc)
+#include "id.c"
+#endif
+
+#define is_notop_id(id) ((id)>tLAST_OP_ID)
+#define is_local_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_LOCAL)
+#define is_global_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_GLOBAL)
+#define is_instance_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_INSTANCE)
+#define is_attrset_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_ATTRSET)
+#define is_const_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_CONST)
+#define is_class_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_CLASS)
+#define is_junk_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_JUNK)
+#define id_type(id) (is_notop_id(id) ? (int)((id)&ID_SCOPE_MASK) : -1)
+
+#define is_asgn_or_id(id) ((is_notop_id(id)) && \
+ (((id)&ID_SCOPE_MASK) == ID_GLOBAL || \
+ ((id)&ID_SCOPE_MASK) == ID_INSTANCE || \
+ ((id)&ID_SCOPE_MASK) == ID_CLASS))
+
enum lex_state_bits {
EXPR_BEG_bit, /* ignore newline, +/- is a sign. */
EXPR_END_bit, /* newline significant, +/- is an operator. */
@@ -71,9 +73,7 @@ enum lex_state_bits {
EXPR_FNAME_bit, /* ignore newline, no reserved words. */
EXPR_DOT_bit, /* right after `.' or `::', no reserved words. */
EXPR_CLASS_bit, /* immediate after `class', no here document. */
- EXPR_LABEL_bit, /* flag bit, label is allowed. */
- EXPR_LABELED_bit, /* flag bit, just after a label. */
- EXPR_FITEM_bit, /* symbol literal as FNAME. */
+ EXPR_VALUE_bit, /* alike EXPR_BEG but label is disallowed. */
EXPR_MAX_STATE
};
/* examine combinations */
@@ -89,23 +89,17 @@ enum lex_state_e {
DEF_EXPR(FNAME),
DEF_EXPR(DOT),
DEF_EXPR(CLASS),
- DEF_EXPR(LABEL),
- DEF_EXPR(LABELED),
- DEF_EXPR(FITEM),
- EXPR_VALUE = EXPR_BEG,
- EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS),
+ DEF_EXPR(VALUE),
+ EXPR_BEG_ANY = (EXPR_BEG | EXPR_VALUE | EXPR_MID | EXPR_CLASS),
EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
EXPR_END_ANY = (EXPR_END | EXPR_ENDARG | EXPR_ENDFN)
};
#define IS_lex_state_for(x, ls) ((x) & (ls))
-#define IS_lex_state_all_for(x, ls) (((x) & (ls)) == (ls))
#define IS_lex_state(ls) IS_lex_state_for(lex_state, (ls))
-#define IS_lex_state_all(ls) IS_lex_state_all_for(lex_state, (ls))
-# define SET_LEX_STATE(ls) \
- (lex_state = (yydebug ? trace_lex_state(lex_state, (ls), __LINE__) : \
- (enum lex_state_e)(ls)))
-static enum lex_state_e trace_lex_state(enum lex_state_e from, enum lex_state_e to, int line);
+#if PARSER_DEBUG
+static const char *lex_state_name(enum lex_state_e state);
+#endif
typedef VALUE stack_type;
@@ -135,11 +129,7 @@ struct local_vars {
struct vtable *args;
struct vtable *vars;
struct vtable *used;
-# if WARN_PAST_SCOPE
- struct vtable *past;
-# endif
struct local_vars *prev;
- stack_type cmdargs;
};
#define DVARS_INHERIT ((void*)1)
@@ -190,7 +180,7 @@ vtable_add(struct vtable *tbl, ID id)
if (!POINTER_P(tbl)) {
rb_bug("vtable_add: vtable is not allocated (%p)", (void *)tbl);
}
- if (VTBL_DEBUG) printf("vtable_add: %p, %"PRIsVALUE"\n", (void *)tbl, rb_id2str(id));
+ if (VTBL_DEBUG) printf("vtable_add: %p, %s\n", (void *)tbl, rb_id2name(id));
if (tbl->pos == tbl->capa) {
tbl->capa = tbl->capa * 2;
@@ -199,15 +189,6 @@ vtable_add(struct vtable *tbl, ID id)
tbl->tbl[tbl->pos++] = id;
}
-#ifndef RIPPER
-static void
-vtable_pop(struct vtable *tbl, int n)
-{
- if (tbl->pos < n) rb_bug("vtable_pop: unreachable");
- tbl->pos -= n;
-}
-#endif
-
static int
vtable_included(const struct vtable * tbl, ID id)
{
@@ -224,6 +205,7 @@ vtable_included(const struct vtable * tbl, ID id)
}
+#ifndef RIPPER
typedef struct token_info {
const char *token;
int linenum;
@@ -231,6 +213,7 @@ typedef struct token_info {
int nonspc;
struct token_info *next;
} token_info;
+#endif
/*
Structure of Lexer Buffer:
@@ -242,77 +225,65 @@ typedef struct token_info {
token
*/
struct parser_params {
+ int is_ripper;
NODE *heap;
- YYSTYPE *lval;
-
- struct {
- NODE *strterm;
- VALUE (*gets)(struct parser_params*,VALUE);
- VALUE input;
- VALUE lastline;
- VALUE nextline;
- const char *pbeg;
- const char *pcur;
- const char *pend;
- long gets_ptr;
- enum lex_state_e state;
- int paren_nest;
- int lpar_beg;
- int brace_nest;
- } lex;
- stack_type cond_stack;
- stack_type cmdarg_stack;
- int tokidx;
- int toksiz;
- int tokline;
- int heredoc_end;
- int heredoc_indent;
- int heredoc_line_indent;
- char *tokenbuf;
- NODE *deferred_nodes;
- struct local_vars *lvtbl;
+ YYSTYPE *parser_yylval;
+ VALUE eofp;
+
+ NODE *parser_lex_strterm;
+ enum lex_state_e parser_lex_state;
+ stack_type parser_cond_stack;
+ stack_type parser_cmdarg_stack;
+ int parser_class_nest;
+ int parser_paren_nest;
+ int parser_lpar_beg;
+ int parser_in_single;
+ int parser_in_def;
+ int parser_brace_nest;
+ int parser_compile_for_eval;
+ VALUE parser_cur_mid;
+ int parser_in_defined;
+ char *parser_tokenbuf;
+ int parser_tokidx;
+ int parser_toksiz;
+ int parser_tokline;
+ VALUE parser_lex_input;
+ VALUE parser_lex_lastline;
+ VALUE parser_lex_nextline;
+ const char *parser_lex_pbeg;
+ const char *parser_lex_p;
+ const char *parser_lex_pend;
+ int parser_heredoc_end;
+ int parser_command_start;
+ NODE *parser_deferred_nodes;
+ long parser_lex_gets_ptr;
+ VALUE (*parser_lex_gets)(struct parser_params*,VALUE);
+ struct local_vars *parser_lvtbl;
+ int parser_ruby__end__seen;
int line_count;
- int ruby_sourceline; /* current line no. */
- char *ruby_sourcefile; /* current source file */
- VALUE ruby_sourcefile_string;
+ int has_shebang;
+ char *parser_ruby_sourcefile; /* current source file */
+ int parser_ruby_sourceline; /* current line no. */
+ VALUE parser_ruby_sourcefile_string;
rb_encoding *enc;
- token_info *token_info;
- VALUE compile_option;
- VALUE debug_buffer;
-
- ID cur_arg;
+ int parser_yydebug;
int last_cr_line;
- unsigned int command_start:1;
- unsigned int eofp: 1;
- unsigned int ruby__end__seen: 1;
- unsigned int yydebug: 1;
- unsigned int has_shebang: 1;
- unsigned int in_defined: 1;
- unsigned int compile_for_eval: 1;
- unsigned int in_kwarg: 1;
- unsigned int in_single: 1;
- unsigned int in_def: 1;
- unsigned int token_seen: 1;
- unsigned int token_info_enabled: 1;
-# if WARN_PAST_SCOPE
- unsigned int past_scope_enabled: 1;
-# endif
- unsigned int error_p: 1;
-
#ifndef RIPPER
/* Ruby core only */
-
- NODE *eval_tree_begin;
- NODE *eval_tree;
+ NODE *parser_eval_tree_begin;
+ NODE *parser_eval_tree;
VALUE debug_lines;
VALUE coverage;
+ int nerr;
+
+ int parser_token_info_enabled;
+ token_info *parser_token_info;
#else
/* Ripper only */
-
const char *tokp;
VALUE delayed;
int delayed_line;
@@ -321,84 +292,68 @@ struct parser_params {
VALUE value;
VALUE result;
VALUE parsing_thread;
+ int toplevel_p;
#endif
};
-#ifdef RIPPER
-#define intern_cstr(n,l,en) rb_intern3(n,l,en)
-#else
-#define intern_cstr(n,l,en) rb_intern3(n,l,en)
-#endif
-
#define STR_NEW(p,n) rb_enc_str_new((p),(n),current_enc)
#define STR_NEW0() rb_enc_str_new(0,0,current_enc)
#define STR_NEW2(p) rb_enc_str_new((p),strlen(p),current_enc)
#define STR_NEW3(p,n,e,func) parser_str_new((p),(n),(e),(func),current_enc)
-#define TOK_INTERN() intern_cstr(tok(), toklen(), current_enc)
+#define ENC_SINGLE(cr) ((cr)==ENC_CODERANGE_7BIT)
+#define TOK_INTERN(mb) rb_intern3(tok(), toklen(), current_enc)
static int parser_yyerror(struct parser_params*, const char*);
#define yyerror(msg) parser_yyerror(parser, (msg))
-#define lex_strterm (parser->lex.strterm)
-#define lex_state (parser->lex.state)
-#define cond_stack (parser->cond_stack)
-#define cmdarg_stack (parser->cmdarg_stack)
-#define paren_nest (parser->lex.paren_nest)
-#define lpar_beg (parser->lex.lpar_beg)
-#define brace_nest (parser->lex.brace_nest)
-#define in_single (parser->in_single)
-#define in_def (parser->in_def)
-#define compile_for_eval (parser->compile_for_eval)
-#define in_defined (parser->in_defined)
-#define tokenbuf (parser->tokenbuf)
-#define tokidx (parser->tokidx)
-#define toksiz (parser->toksiz)
-#define tokline (parser->tokline)
-#define lex_input (parser->lex.input)
-#define lex_lastline (parser->lex.lastline)
-#define lex_nextline (parser->lex.nextline)
-#define lex_pbeg (parser->lex.pbeg)
-#define lex_p (parser->lex.pcur)
-#define lex_pend (parser->lex.pend)
-#define heredoc_end (parser->heredoc_end)
-#define heredoc_indent (parser->heredoc_indent)
-#define heredoc_line_indent (parser->heredoc_line_indent)
-#define command_start (parser->command_start)
-#define deferred_nodes (parser->deferred_nodes)
-#define lex_gets_ptr (parser->lex.gets_ptr)
-#define lex_gets (parser->lex.gets)
-#define lvtbl (parser->lvtbl)
-#define ruby__end__seen (parser->ruby__end__seen)
-#define ruby_sourceline (parser->ruby_sourceline)
-#define ruby_sourcefile (parser->ruby_sourcefile)
-#define ruby_sourcefile_string (parser->ruby_sourcefile_string)
+#define lex_strterm (parser->parser_lex_strterm)
+#define lex_state (parser->parser_lex_state)
+#define cond_stack (parser->parser_cond_stack)
+#define cmdarg_stack (parser->parser_cmdarg_stack)
+#define class_nest (parser->parser_class_nest)
+#define paren_nest (parser->parser_paren_nest)
+#define lpar_beg (parser->parser_lpar_beg)
+#define brace_nest (parser->parser_brace_nest)
+#define in_single (parser->parser_in_single)
+#define in_def (parser->parser_in_def)
+#define compile_for_eval (parser->parser_compile_for_eval)
+#define cur_mid (parser->parser_cur_mid)
+#define in_defined (parser->parser_in_defined)
+#define tokenbuf (parser->parser_tokenbuf)
+#define tokidx (parser->parser_tokidx)
+#define toksiz (parser->parser_toksiz)
+#define tokline (parser->parser_tokline)
+#define lex_input (parser->parser_lex_input)
+#define lex_lastline (parser->parser_lex_lastline)
+#define lex_nextline (parser->parser_lex_nextline)
+#define lex_pbeg (parser->parser_lex_pbeg)
+#define lex_p (parser->parser_lex_p)
+#define lex_pend (parser->parser_lex_pend)
+#define heredoc_end (parser->parser_heredoc_end)
+#define command_start (parser->parser_command_start)
+#define deferred_nodes (parser->parser_deferred_nodes)
+#define lex_gets_ptr (parser->parser_lex_gets_ptr)
+#define lex_gets (parser->parser_lex_gets)
+#define lvtbl (parser->parser_lvtbl)
+#define ruby__end__seen (parser->parser_ruby__end__seen)
+#define ruby_sourceline (parser->parser_ruby_sourceline)
+#define ruby_sourcefile (parser->parser_ruby_sourcefile)
+#define ruby_sourcefile_string (parser->parser_ruby_sourcefile_string)
#define current_enc (parser->enc)
-#define current_arg (parser->cur_arg)
-#define yydebug (parser->yydebug)
+#define yydebug (parser->parser_yydebug)
#ifdef RIPPER
#else
-#define ruby_eval_tree (parser->eval_tree)
-#define ruby_eval_tree_begin (parser->eval_tree_begin)
+#define ruby_eval_tree (parser->parser_eval_tree)
+#define ruby_eval_tree_begin (parser->parser_eval_tree_begin)
#define ruby_debug_lines (parser->debug_lines)
#define ruby_coverage (parser->coverage)
#endif
-#define CALL_Q_P(q) ((q) == tANDDOT)
-#define NODE_CALL_Q(q) (CALL_Q_P(q) ? NODE_QCALL : NODE_CALL)
-#define NEW_QCALL(q,r,m,a) NEW_NODE(NODE_CALL_Q(q),r,m,a)
-
-static int yylex(YYSTYPE*, struct parser_params*);
-
-static inline void
-set_line_body(NODE *body, int line)
-{
- if (!body) return;
- switch (nd_type(body)) {
- case NODE_RESCUE:
- case NODE_ENSURE:
- nd_set_line(body, line);
- }
-}
+#if YYPURE
+static int yylex(void*, void*);
+#else
+static int yylex(void*);
+#endif
#ifndef RIPPER
#define yyparse ruby_yyparse
@@ -408,9 +363,6 @@ static NODE* node_newnode(struct parser_params *, enum node_type, VALUE, VALUE,
static NODE *cond_gen(struct parser_params*,NODE*);
#define cond(node) cond_gen(parser, (node))
-static NODE *new_if_gen(struct parser_params*,NODE*,NODE*,NODE*);
-#define new_if(cc,left,right) new_if_gen(parser, (cc), (left), (right))
-#define new_unless(cc,left,right) new_if_gen(parser, (cc), (right), (left))
static NODE *logop_gen(struct parser_params*,enum node_type,NODE*,NODE*);
#define logop(type,node1,node2) logop_gen(parser, (type), (node1), (node2))
@@ -435,7 +387,8 @@ static NODE *block_append_gen(struct parser_params*,NODE*,NODE*);
#define block_append(h,t) block_append_gen(parser,(h),(t))
static NODE *list_append_gen(struct parser_params*,NODE*,NODE*);
#define list_append(l,i) list_append_gen(parser,(l),(i))
-static NODE *list_concat(NODE*,NODE*);
+static NODE *list_concat_gen(struct parser_params*,NODE*,NODE*);
+#define list_concat(h,t) list_concat_gen(parser,(h),(t))
static NODE *arg_append_gen(struct parser_params*,NODE*,NODE*);
#define arg_append(h,t) arg_append_gen(parser,(h),(t))
static NODE *arg_concat_gen(struct parser_params*,NODE*,NODE*);
@@ -458,9 +411,8 @@ static NODE *new_args_gen(struct parser_params*,NODE*,NODE*,ID,NODE*,NODE*);
#define new_args(f,o,r,p,t) new_args_gen(parser, (f),(o),(r),(p),(t))
static NODE *new_args_tail_gen(struct parser_params*,NODE*,ID,ID);
#define new_args_tail(k,kr,b) new_args_tail_gen(parser, (k),(kr),(b))
-#define new_kw_arg(k) ((k) ? NEW_KW_ARG(0, (k)) : 0)
-static VALUE negate_lit(VALUE);
+static NODE *negate_lit(NODE*);
static NODE *ret_args_gen(struct parser_params*,NODE*);
#define ret_args(node) ret_args_gen(parser, (node))
static NODE *arg_blk_pass(NODE*,NODE*);
@@ -476,8 +428,8 @@ static NODE *assignable_gen(struct parser_params*,ID,NODE*);
static NODE *aryset_gen(struct parser_params*,NODE*,NODE*);
#define aryset(node1,node2) aryset_gen(parser, (node1), (node2))
-static NODE *attrset_gen(struct parser_params*,NODE*,ID,ID);
-#define attrset(node,q,id) attrset_gen(parser, (node), (q), (id))
+static NODE *attrset_gen(struct parser_params*,NODE*,ID);
+#define attrset(node,id) attrset_gen(parser, (node), (id))
static void rb_backref_error_gen(struct parser_params*,NODE*);
#define rb_backref_error(n) rb_backref_error_gen(parser,(n))
@@ -485,16 +437,11 @@ static NODE *node_assign_gen(struct parser_params*,NODE*,NODE*);
#define node_assign(node1, node2) node_assign_gen(parser, (node1), (node2))
static NODE *new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs);
-static NODE *new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID atype, ID attr, ID op, NODE *rhs);
-#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), (type), (attr), (op), (rhs))
+static NODE *new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID attr, ID op, NODE *rhs);
+#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), (attr), (op), (rhs))
static NODE *new_const_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs);
#define new_const_op_assign(lhs, op, rhs) new_const_op_assign_gen(parser, (lhs), (op), (rhs))
-static NODE *kwd_append(NODE*, NODE*);
-
-static NODE *new_hash_gen(struct parser_params *parser, NODE *hash);
-#define new_hash(hash) new_hash_gen(parser, (hash))
-
#define new_defined(expr) NEW_DEFINED(remove_begin_all(expr))
static NODE *match_op_gen(struct parser_params*,NODE*,NODE*);
@@ -514,26 +461,9 @@ static int reg_fragment_check_gen(struct parser_params*, VALUE, int);
static NODE *reg_named_capture_assign_gen(struct parser_params* parser, VALUE regexp, NODE *match);
#define reg_named_capture_assign(regexp,match) reg_named_capture_assign_gen(parser,(regexp),(match))
-static void parser_heredoc_dedent(struct parser_params*,NODE*);
-# define heredoc_dedent(str) parser_heredoc_dedent(parser, (str))
-
#define get_id(id) (id)
#define get_value(val) (val)
#else
-#define NODE_RIPPER NODE_CDECL
-
-static inline VALUE
-ripper_new_yylval(ID a, VALUE b, VALUE c)
-{
- return (VALUE)NEW_CDECL(a, b, c);
-}
-
-static inline int
-ripper_is_node_yylval(VALUE n)
-{
- return RB_TYPE_P(n, T_NODE) && nd_type(RNODE(n)) == NODE_RIPPER;
-}
-
#define value_expr(node) ((void)(node))
#define remove_begin(node) (node)
#define rb_dvar_defined(id) 0
@@ -557,8 +487,6 @@ static VALUE new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VAL
#define new_op_assign(lhs, op, rhs) new_op_assign_gen(parser, (lhs), (op), (rhs))
-RUBY_FUNC_EXPORTED VALUE rb_parser_reg_compile(struct parser_params* parser, VALUE str, int options, VALUE *errmsg);
-
static ID formal_argument_gen(struct parser_params*, ID);
#define formal_argument(id) formal_argument_gen(parser, (id))
static ID shadowing_lvar_gen(struct parser_params*,ID);
@@ -570,9 +498,9 @@ static void local_push_gen(struct parser_params*,int);
#define local_push(top) local_push_gen(parser,(top))
static void local_pop_gen(struct parser_params*);
#define local_pop() local_pop_gen(parser)
-static void local_var_gen(struct parser_params*, ID);
+static int local_var_gen(struct parser_params*, ID);
#define local_var(id) local_var_gen(parser, (id))
-static void arg_var_gen(struct parser_params*, ID);
+static int arg_var_gen(struct parser_params*, ID);
#define arg_var(id) arg_var_gen(parser, (id))
static int local_id_gen(struct parser_params*, ID);
#define local_id(id) local_id_gen(parser, (id))
@@ -620,8 +548,6 @@ static int lvar_defined_gen(struct parser_params*, ID);
#ifdef RIPPER
#define RIPPER_VERSION "0.1.0"
-static inline VALUE intern_sym(const char *name);
-
#include "eventids1.c"
#include "eventids2.c"
@@ -632,8 +558,6 @@ static VALUE ripper_dispatch3(struct parser_params*,ID,VALUE,VALUE,VALUE);
static VALUE ripper_dispatch4(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE);
static VALUE ripper_dispatch5(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE,VALUE);
static VALUE ripper_dispatch7(struct parser_params*,ID,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE);
-static void ripper_error_gen(struct parser_params *parser);
-#define ripper_error() ripper_error_gen(parser)
#define dispatch0(n) ripper_dispatch0(parser, TOKEN_PASTE(ripper_id_, n))
#define dispatch1(n,a) ripper_dispatch1(parser, TOKEN_PASTE(ripper_id_, n), (a))
@@ -648,7 +572,7 @@ static void ripper_error_gen(struct parser_params *parser);
#define ripper_intern(s) ID2SYM(rb_intern(s))
static VALUE ripper_id2sym(ID);
#ifdef __GNUC__
-#define ripper_id2sym(id) (rb_ispunct((int)(id)) ? \
+#define ripper_id2sym(id) ((id) < 256 && rb_ispunct(id) ? \
ID2SYM(id) : ripper_id2sym(id))
#endif
@@ -694,15 +618,12 @@ new_args_gen(struct parser_params *parser, VALUE f, VALUE o, VALUE r, VALUE p, V
static inline VALUE
new_args_tail_gen(struct parser_params *parser, VALUE k, VALUE kr, VALUE b)
{
- return (VALUE)MEMO_NEW(k, kr, b);
+ return (VALUE)rb_node_newnode(NODE_MEMO, k, kr, b);
}
#define new_args_tail(k,kr,b) new_args_tail_gen(parser, (k),(kr),(b))
#define new_defined(expr) dispatch1(defined, (expr))
-static void parser_heredoc_dedent(struct parser_params*,VALUE);
-# define heredoc_dedent(str) parser_heredoc_dedent(parser, (str))
-
#define FIXME 0
#endif /* RIPPER */
@@ -715,54 +636,36 @@ static void parser_heredoc_dedent(struct parser_params*,VALUE);
# define ifndef_ripper(x)
#endif
-# define rb_warn0(fmt) WARN_CALL(WARN_ARGS(fmt, 1))
-# define rb_warn1(fmt,a) WARN_CALL(WARN_ARGS(fmt, 2), (a))
-# define rb_warn2(fmt,a,b) WARN_CALL(WARN_ARGS(fmt, 3), (a), (b))
-# define rb_warn3(fmt,a,b,c) WARN_CALL(WARN_ARGS(fmt, 4), (a), (b), (c))
-# define rb_warn4(fmt,a,b,c,d) WARN_CALL(WARN_ARGS(fmt, 5), (a), (b), (c), (d))
-# define rb_warning0(fmt) WARNING_CALL(WARNING_ARGS(fmt, 1))
-# define rb_warning1(fmt,a) WARNING_CALL(WARNING_ARGS(fmt, 2), (a))
-# define rb_warning2(fmt,a,b) WARNING_CALL(WARNING_ARGS(fmt, 3), (a), (b))
-# define rb_warning3(fmt,a,b,c) WARNING_CALL(WARNING_ARGS(fmt, 4), (a), (b), (c))
-# define rb_warning4(fmt,a,b,c,d) WARNING_CALL(WARNING_ARGS(fmt, 5), (a), (b), (c), (d))
-# define rb_warn0L(l,fmt) WARN_CALL(WARN_ARGS_L(l, fmt, 1))
-# define rb_warn1L(l,fmt,a) WARN_CALL(WARN_ARGS_L(l, fmt, 2), (a))
-# define rb_warn2L(l,fmt,a,b) WARN_CALL(WARN_ARGS_L(l, fmt, 3), (a), (b))
-# define rb_warn3L(l,fmt,a,b,c) WARN_CALL(WARN_ARGS_L(l, fmt, 4), (a), (b), (c))
-# define rb_warn4L(l,fmt,a,b,c,d) WARN_CALL(WARN_ARGS_L(l, fmt, 5), (a), (b), (c), (d))
-# define rb_warning0L(l,fmt) WARNING_CALL(WARNING_ARGS_L(l, fmt, 1))
-# define rb_warning1L(l,fmt,a) WARNING_CALL(WARNING_ARGS_L(l, fmt, 2), (a))
-# define rb_warning2L(l,fmt,a,b) WARNING_CALL(WARNING_ARGS_L(l, fmt, 3), (a), (b))
-# define rb_warning3L(l,fmt,a,b,c) WARNING_CALL(WARNING_ARGS_L(l, fmt, 4), (a), (b), (c))
-# define rb_warning4L(l,fmt,a,b,c,d) WARNING_CALL(WARNING_ARGS_L(l, fmt, 5), (a), (b), (c), (d))
+#ifndef RIPPER
+# define rb_warn0(fmt) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt))
+# define rb_warnI(fmt,a) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt), (a))
+# define rb_warnS(fmt,a) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt), (a))
+# define rb_warn4S(file,line,fmt,a) rb_compile_warn((file), (line), (fmt), (a))
+# define rb_warning0(fmt) rb_compile_warning(ruby_sourcefile, ruby_sourceline, (fmt))
+# define rb_warningS(fmt,a) rb_compile_warning(ruby_sourcefile, ruby_sourceline, (fmt), (a))
+#else
+# define rb_warn0(fmt) ripper_warn0(parser, (fmt))
+# define rb_warnI(fmt,a) ripper_warnI(parser, (fmt), (a))
+# define rb_warnS(fmt,a) ripper_warnS(parser, (fmt), (a))
+# define rb_warn4S(file,line,fmt,a) ripper_warnS(parser, (fmt), (a))
+# define rb_warning0(fmt) ripper_warning0(parser, (fmt))
+# define rb_warningS(fmt,a) ripper_warningS(parser, (fmt), (a))
+static void ripper_warn0(struct parser_params*, const char*);
+static void ripper_warnI(struct parser_params*, const char*, int);
+static void ripper_warnS(struct parser_params*, const char*, const char*);
+static void ripper_warning0(struct parser_params*, const char*);
+static void ripper_warningS(struct parser_params*, const char*, const char*);
+#endif
+
#ifdef RIPPER
-static ID id_warn, id_warning;
-# define WARN_S(s) STR_NEW2(s)
-# define WARN_I(i) INT2NUM(i)
-# define PRIsWARN "s"
-# define WARN_ARGS(fmt,n) parser->value, id_warn, n, rb_usascii_str_new_lit(fmt)
-# define WARN_ARGS_L(l,fmt,n) WARN_ARGS(fmt,n)
-# define WARN_CALL rb_funcall
-# define WARNING_ARGS(fmt,n) parser->value, id_warning, n, rb_usascii_str_new_lit(fmt)
-# define WARNING_ARGS_L(l, fmt,n) WARNING_ARGS(fmt,n)
-# define WARNING_CALL rb_funcall
static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
# define rb_compile_error ripper_compile_error
# define compile_error ripper_compile_error
# define PARSER_ARG parser,
#else
-# define WARN_S(s) s
-# define WARN_I(i) i
-# define PRIsWARN PRIsVALUE
-# define WARN_ARGS(fmt,n) WARN_ARGS_L(ruby_sourceline,fmt,n)
-# define WARN_ARGS_L(l,fmt,n) ruby_sourcefile, (l), (fmt)
-# define WARN_CALL rb_compile_warn
-# define WARNING_ARGS(fmt,n) WARN_ARGS(fmt,n)
-# define WARNING_ARGS_L(l,fmt,n) WARN_ARGS_L(l,fmt,n)
-# define WARNING_CALL rb_compile_warning
-# define rb_compile_error rb_compile_error_str
-# define compile_error (parser->error_p = 1),rb_compile_error_str
-# define PARSER_ARG ruby_sourcefile_string, ruby_sourceline, (void *)current_enc,
+# define rb_compile_error rb_compile_error_with_enc
+# define compile_error parser->nerr++,rb_compile_error_with_enc
+# define PARSER_ARG ruby_sourcefile, ruby_sourceline, current_enc,
#endif
/* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150,
@@ -774,10 +677,15 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
#endif
#endif
-static void token_info_push(struct parser_params*, const char *token, size_t len);
-static void token_info_pop(struct parser_params*, const char *token, size_t len);
-#define token_info_push(token) token_info_push(parser, (token), rb_strlen_lit(token))
-#define token_info_pop(token) token_info_pop(parser, (token), rb_strlen_lit(token))
+#ifndef RIPPER
+static void token_info_push(struct parser_params*, const char *token);
+static void token_info_pop(struct parser_params*, const char *token);
+#define token_info_push(token) (RTEST(ruby_verbose) ? token_info_push(parser, (token)) : (void)0)
+#define token_info_pop(token) (RTEST(ruby_verbose) ? token_info_pop(parser, (token)) : (void)0)
+#else
+#define token_info_push(token) /* nothing */
+#define token_info_pop(token) /* nothing */
+#endif
%}
%pure-parser
@@ -875,7 +783,7 @@ static void token_info_pop(struct parser_params*, const char *token, size_t len)
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
%type <id> fsym keyword_variable user_variable sym symbol operation operation2 operation3
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
-%type <id> f_kwrest f_label f_arg_asgn call_op call_op2
+%type <id> f_kwrest f_label
/*%%%*/
/*%
%type <val> program reswords then do dot_or_colon
@@ -890,8 +798,8 @@ static void token_info_pop(struct parser_params*, const char *token, size_t len)
%token tNEQ RUBY_TOKEN(NEQ) "!="
%token tGEQ RUBY_TOKEN(GEQ) ">="
%token tLEQ RUBY_TOKEN(LEQ) "<="
-%token tANDOP RUBY_TOKEN(ANDOP) "&&"
-%token tOROP RUBY_TOKEN(OROP) "||"
+%token tANDOP "&&"
+%token tOROP "||"
%token tMATCH RUBY_TOKEN(MATCH) "=~"
%token tNMATCH RUBY_TOKEN(NMATCH) "!~"
%token tDOT2 RUBY_TOKEN(DOT2) ".."
@@ -900,7 +808,6 @@ static void token_info_pop(struct parser_params*, const char *token, size_t len)
%token tASET RUBY_TOKEN(ASET) "[]="
%token tLSHFT RUBY_TOKEN(LSHFT) "<<"
%token tRSHFT RUBY_TOKEN(RSHFT) ">>"
-%token tANDDOT RUBY_TOKEN(ANDDOT) "&."
%token tCOLON2 "::"
%token tCOLON3 ":: at EXPR_BEG"
%token <id> tOP_ASGN /* +=, -= etc. */
@@ -916,7 +823,7 @@ static void token_info_pop(struct parser_params*, const char *token, size_t len)
%token tAMPER "&"
%token tLAMBDA "->"
%token tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG
-%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG tLABEL_END
+%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG
/*
* precedence table
@@ -950,7 +857,7 @@ static void token_info_pop(struct parser_params*, const char *token, size_t len)
%%
program : {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
/*%%%*/
local_push(compile_for_eval || rb_parse_in_main());
/*%
@@ -1144,7 +1051,7 @@ stmt_or_begin : stmt
%*/
}
-stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
+stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
{
/*%%%*/
$$ = NEW_ALIAS($2, $4);
@@ -1179,7 +1086,6 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
/*%
$$ = dispatch2(var_alias, $2, $3);
$$ = dispatch1(alias_error, $$);
- ripper_error();
%*/
}
| keyword_undef undef_list
@@ -1193,7 +1099,7 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
| stmt modifier_if expr_value
{
/*%%%*/
- $$ = new_if($3, remove_begin($1), 0);
+ $$ = NEW_IF(cond($3), remove_begin($1), 0);
fixpos($$, $3);
/*%
$$ = dispatch2(if_mod, $3, $1);
@@ -1202,7 +1108,7 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
| stmt modifier_unless expr_value
{
/*%%%*/
- $$ = new_unless($3, remove_begin($1), 0);
+ $$ = NEW_UNLESS(cond($3), remove_begin($1), 0);
fixpos($$, $3);
/*%
$$ = dispatch2(unless_mod, $3, $1);
@@ -1292,15 +1198,15 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
$$ = dispatch3(opassign, $$, $5, $6);
%*/
}
- | primary_value call_op tIDENTIFIER tOP_ASGN command_call
+ | primary_value '.' tIDENTIFIER tOP_ASGN command_call
{
value_expr($5);
- $$ = new_attr_op_assign($1, $2, $3, $4, $5);
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
- | primary_value call_op tCONSTANT tOP_ASGN command_call
+ | primary_value '.' tCONSTANT tOP_ASGN command_call
{
value_expr($5);
- $$ = new_attr_op_assign($1, $2, $3, $4, $5);
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_call
{
@@ -1315,7 +1221,7 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_call
{
value_expr($5);
- $$ = new_attr_op_assign($1, idCOLON2, $3, $4, $5);
+ $$ = new_attr_op_assign($1, ripper_intern("::"), $3, $4, $5);
}
| backref tOP_ASGN command_call
{
@@ -1325,7 +1231,6 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
/*%
$$ = dispatch2(assign, dispatch1(var_field, $1), $3);
$$ = dispatch1(assign_error, $$);
- ripper_error();
%*/
}
| lhs '=' mrhs
@@ -1423,10 +1328,10 @@ command_call : command
;
block_command : block_call
- | block_call call_op2 operation2 command_args
+ | block_call dot_or_colon operation2 command_args
{
/*%%%*/
- $$ = NEW_QCALL($2, $1, $3, $4);
+ $$ = NEW_CALL($1, $3, $4);
/*%
$$ = dispatch3(call, $1, $2, $3);
$$ = method_arg($$, $4);
@@ -1488,24 +1393,24 @@ command : fcall command_args %prec tLOWEST
$$ = method_add_block($$, $3);
%*/
}
- | primary_value call_op operation2 command_args %prec tLOWEST
+ | primary_value '.' operation2 command_args %prec tLOWEST
{
/*%%%*/
- $$ = NEW_QCALL($2, $1, $3, $4);
+ $$ = NEW_CALL($1, $3, $4);
fixpos($$, $1);
/*%
- $$ = dispatch4(command_call, $1, $2, $3, $4);
+ $$ = dispatch4(command_call, $1, ripper_id2sym('.'), $3, $4);
%*/
}
- | primary_value call_op operation2 command_args cmd_brace_block
+ | primary_value '.' operation2 command_args cmd_brace_block
{
/*%%%*/
block_dup_check($4,$5);
- $5->nd_iter = NEW_QCALL($2, $1, $3, $4);
+ $5->nd_iter = NEW_CALL($1, $3, $4);
$$ = $5;
fixpos($$, $1);
/*%
- $$ = dispatch4(command_call, $1, $2, $3, $4);
+ $$ = dispatch4(command_call, $1, ripper_id2sym('.'), $3, $4);
$$ = method_add_block($$, $5);
%*/
}
@@ -1515,7 +1420,7 @@ command : fcall command_args %prec tLOWEST
$$ = NEW_CALL($1, $3, $4);
fixpos($$, $1);
/*%
- $$ = dispatch4(command_call, $1, ID2SYM(idCOLON2), $3, $4);
+ $$ = dispatch4(command_call, $1, ripper_intern("::"), $3, $4);
%*/
}
| primary_value tCOLON2 operation2 command_args cmd_brace_block
@@ -1526,7 +1431,7 @@ command : fcall command_args %prec tLOWEST
$$ = $5;
fixpos($$, $1);
/*%
- $$ = dispatch4(command_call, $1, ID2SYM(idCOLON2), $3, $4);
+ $$ = dispatch4(command_call, $1, ripper_intern("::"), $3, $4);
$$ = method_add_block($$, $5);
%*/
}
@@ -1745,28 +1650,28 @@ mlhs_node : user_variable
$$ = dispatch2(aref_field, $1, escape_Qundef($3));
%*/
}
- | primary_value call_op tIDENTIFIER
+ | primary_value '.' tIDENTIFIER
{
/*%%%*/
- $$ = attrset($1, $2, $3);
+ $$ = attrset($1, $3);
/*%
- $$ = dispatch3(field, $1, $2, $3);
+ $$ = dispatch3(field, $1, ripper_id2sym('.'), $3);
%*/
}
| primary_value tCOLON2 tIDENTIFIER
{
/*%%%*/
- $$ = attrset($1, idCOLON2, $3);
+ $$ = attrset($1, $3);
/*%
$$ = dispatch2(const_path_field, $1, $3);
%*/
}
- | primary_value call_op tCONSTANT
+ | primary_value '.' tCONSTANT
{
/*%%%*/
- $$ = attrset($1, $2, $3);
+ $$ = attrset($1, $3);
/*%
- $$ = dispatch3(field, $1, $2, $3);
+ $$ = dispatch3(field, $1, ripper_id2sym('.'), $3);
%*/
}
| primary_value tCOLON2 tCONSTANT
@@ -1776,11 +1681,9 @@ mlhs_node : user_variable
yyerror("dynamic constant assignment");
$$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3));
/*%
+ if (in_def || in_single)
+ yyerror("dynamic constant assignment");
$$ = dispatch2(const_path_field, $1, $3);
- if (in_def || in_single) {
- $$ = dispatch1(assign_error, $$);
- ripper_error();
- }
%*/
}
| tCOLON3 tCONSTANT
@@ -1791,10 +1694,6 @@ mlhs_node : user_variable
$$ = NEW_CDECL(0, 0, NEW_COLON3($2));
/*%
$$ = dispatch1(top_const_field, $2);
- if (in_def || in_single) {
- $$ = dispatch1(assign_error, $$);
- ripper_error();
- }
%*/
}
| backref
@@ -1805,7 +1704,6 @@ mlhs_node : user_variable
/*%
$$ = dispatch1(var_field, $1);
$$ = dispatch1(assign_error, $$);
- ripper_error();
%*/
}
;
@@ -1836,28 +1734,28 @@ lhs : user_variable
$$ = dispatch2(aref_field, $1, escape_Qundef($3));
%*/
}
- | primary_value call_op tIDENTIFIER
+ | primary_value '.' tIDENTIFIER
{
/*%%%*/
- $$ = attrset($1, $2, $3);
+ $$ = attrset($1, $3);
/*%
- $$ = dispatch3(field, $1, $2, $3);
+ $$ = dispatch3(field, $1, ripper_id2sym('.'), $3);
%*/
}
| primary_value tCOLON2 tIDENTIFIER
{
/*%%%*/
- $$ = attrset($1, idCOLON2, $3);
+ $$ = attrset($1, $3);
/*%
- $$ = dispatch3(field, $1, ID2SYM(idCOLON2), $3);
+ $$ = dispatch3(field, $1, ripper_intern("::"), $3);
%*/
}
- | primary_value call_op tCONSTANT
+ | primary_value '.' tCONSTANT
{
/*%%%*/
- $$ = attrset($1, $2, $3);
+ $$ = attrset($1, $3);
/*%
- $$ = dispatch3(field, $1, $2, $3);
+ $$ = dispatch3(field, $1, ripper_id2sym('.'), $3);
%*/
}
| primary_value tCOLON2 tCONSTANT
@@ -1870,7 +1768,6 @@ lhs : user_variable
$$ = dispatch2(const_path_field, $1, $3);
if (in_def || in_single) {
$$ = dispatch1(assign_error, $$);
- ripper_error();
}
%*/
}
@@ -1884,7 +1781,6 @@ lhs : user_variable
$$ = dispatch1(top_const_field, $2);
if (in_def || in_single) {
$$ = dispatch1(assign_error, $$);
- ripper_error();
}
%*/
}
@@ -1895,7 +1791,6 @@ lhs : user_variable
$$ = NEW_BEGIN(0);
/*%
$$ = dispatch1(assign_error, $1);
- ripper_error();
%*/
}
;
@@ -1906,7 +1801,6 @@ cname : tIDENTIFIER
yyerror("class/module name must be CONSTANT");
/*%
$$ = dispatch1(class_name_error, $1);
- ripper_error();
%*/
}
| tCONSTANT
@@ -1943,12 +1837,12 @@ fname : tIDENTIFIER
| tFID
| op
{
- SET_LEX_STATE(EXPR_ENDFN);
+ lex_state = EXPR_ENDFN;
$$ = $1;
}
| reswords
{
- SET_LEX_STATE(EXPR_ENDFN);
+ lex_state = EXPR_ENDFN;
/*%%%*/
$$ = $<id>1;
/*%
@@ -1980,7 +1874,7 @@ undef_list : fitem
$$ = rb_ary_new3(1, $1);
%*/
}
- | undef_list ',' {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
+ | undef_list ',' {lex_state = EXPR_FNAME;} fitem
{
/*%%%*/
$$ = block_append($1, NEW_UNDEF($4));
@@ -2096,20 +1990,20 @@ arg : lhs '=' arg
$$ = dispatch3(opassign, $1, $5, $6);
%*/
}
- | primary_value call_op tIDENTIFIER tOP_ASGN arg
+ | primary_value '.' tIDENTIFIER tOP_ASGN arg
{
value_expr($5);
- $$ = new_attr_op_assign($1, $2, $3, $4, $5);
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
- | primary_value call_op tCONSTANT tOP_ASGN arg
+ | primary_value '.' tCONSTANT tOP_ASGN arg
{
value_expr($5);
- $$ = new_attr_op_assign($1, $2, $3, $4, $5);
+ $$ = new_attr_op_assign($1, ripper_id2sym('.'), $3, $4, $5);
}
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg
{
value_expr($5);
- $$ = new_attr_op_assign($1, idCOLON2, $3, $4, $5);
+ $$ = new_attr_op_assign($1, ripper_intern("::"), $3, $4, $5);
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg
{
@@ -2140,7 +2034,6 @@ arg : lhs '=' arg
$$ = dispatch1(var_field, $1);
$$ = dispatch3(opassign, $$, $2, $3);
$$ = dispatch1(assign_error, $$);
- ripper_error();
%*/
}
| arg tDOT2 arg
@@ -2149,8 +2042,8 @@ arg : lhs '=' arg
value_expr($1);
value_expr($3);
$$ = NEW_DOT2($1, $3);
- if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
- $3 && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
+ if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
+ nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
deferred_nodes = list_append(deferred_nodes, $$);
}
/*%
@@ -2163,8 +2056,8 @@ arg : lhs '=' arg
value_expr($1);
value_expr($3);
$$ = NEW_DOT3($1, $3);
- if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
- $3 && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
+ if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
+ nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
deferred_nodes = list_append(deferred_nodes, $$);
}
/*%
@@ -2216,7 +2109,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tPOW, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idPow), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("**"), $3);
%*/
}
| tUMINUS_NUM simple_numeric tPOW arg
@@ -2224,8 +2117,8 @@ arg : lhs '=' arg
/*%%%*/
$$ = NEW_CALL(call_bin_op($2, tPOW, $4), tUMINUS, 0);
/*%
- $$ = dispatch3(binary, $2, ID2SYM(idPow), $4);
- $$ = dispatch2(unary, ID2SYM(idUMinus), $$);
+ $$ = dispatch3(binary, $2, ripper_intern("**"), $4);
+ $$ = dispatch2(unary, ripper_intern("-@"), $$);
%*/
}
| tUPLUS arg
@@ -2233,7 +2126,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_uni_op($2, tUPLUS);
/*%
- $$ = dispatch2(unary, ID2SYM(idUPlus), $2);
+ $$ = dispatch2(unary, ripper_intern("+@"), $2);
%*/
}
| tUMINUS arg
@@ -2241,7 +2134,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_uni_op($2, tUMINUS);
/*%
- $$ = dispatch2(unary, ID2SYM(idUMinus), $2);
+ $$ = dispatch2(unary, ripper_intern("-@"), $2);
%*/
}
| arg '|' arg
@@ -2273,7 +2166,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tCMP, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idCmp), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("<=>"), $3);
%*/
}
| arg '>' arg
@@ -2289,7 +2182,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tGEQ, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idGE), $3);
+ $$ = dispatch3(binary, $1, ripper_intern(">="), $3);
%*/
}
| arg '<' arg
@@ -2305,7 +2198,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tLEQ, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idLE), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("<="), $3);
%*/
}
| arg tEQ arg
@@ -2313,7 +2206,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tEQ, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idEq), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("=="), $3);
%*/
}
| arg tEQQ arg
@@ -2321,7 +2214,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tEQQ, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idEqq), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("==="), $3);
%*/
}
| arg tNEQ arg
@@ -2329,7 +2222,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tNEQ, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idNeq), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("!="), $3);
%*/
}
| arg tMATCH arg
@@ -2340,7 +2233,7 @@ arg : lhs '=' arg
$$ = reg_named_capture_assign($1->nd_lit, $$);
}
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idEqTilde), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("=~"), $3);
%*/
}
| arg tNMATCH arg
@@ -2348,7 +2241,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tNMATCH, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idNeqTilde), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("!~"), $3);
%*/
}
| '!' arg
@@ -2372,7 +2265,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tLSHFT, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idLTLT), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("<<"), $3);
%*/
}
| arg tRSHFT arg
@@ -2380,7 +2273,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = call_bin_op($1, tRSHFT, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idGTGT), $3);
+ $$ = dispatch3(binary, $1, ripper_intern(">>"), $3);
%*/
}
| arg tANDOP arg
@@ -2388,7 +2281,7 @@ arg : lhs '=' arg
/*%%%*/
$$ = logop(NODE_AND, $1, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idANDOP), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("&&"), $3);
%*/
}
| arg tOROP arg
@@ -2396,15 +2289,16 @@ arg : lhs '=' arg
/*%%%*/
$$ = logop(NODE_OR, $1, $3);
/*%
- $$ = dispatch3(binary, $1, ID2SYM(idOROP), $3);
+ $$ = dispatch3(binary, $1, ripper_intern("||"), $3);
%*/
}
| keyword_defined opt_nl {in_defined = 1;} arg
{
- in_defined = 0;
/*%%%*/
+ in_defined = 0;
$$ = new_defined($4);
/*%
+ in_defined = 0;
$$ = dispatch1(defined, $4);
%*/
}
@@ -2412,7 +2306,7 @@ arg : lhs '=' arg
{
/*%%%*/
value_expr($1);
- $$ = new_if($1, $3, $6);
+ $$ = NEW_IF(cond($1), $3, $6);
fixpos($$, $1);
/*%
$$ = dispatch3(ifop, $1, $3, $6);
@@ -2444,7 +2338,7 @@ aref_args : none
| args ',' assocs trailer
{
/*%%%*/
- $$ = $3 ? arg_append($1, new_hash($3)) : $1;
+ $$ = arg_append($1, NEW_HASH($3));
/*%
$$ = arg_add_assocs($1, $3);
%*/
@@ -2452,7 +2346,7 @@ aref_args : none
| assocs trailer
{
/*%%%*/
- $$ = $1 ? NEW_LIST(new_hash($1)) : 0;
+ $$ = NEW_LIST(NEW_HASH($1));
/*%
$$ = arg_add_assocs(arg_new(), $1);
%*/
@@ -2482,7 +2376,7 @@ opt_call_args : none
| args ',' assocs ','
{
/*%%%*/
- $$ = $3 ? arg_append($1, new_hash($3)) : $1;
+ $$ = arg_append($1, NEW_HASH($3));
/*%
$$ = arg_add_assocs($1, $3);
%*/
@@ -2490,7 +2384,7 @@ opt_call_args : none
| assocs ','
{
/*%%%*/
- $$ = $1 ? NEW_LIST(new_hash($1)) : 0;
+ $$ = NEW_LIST(NEW_HASH($1));
/*%
$$ = arg_add_assocs(arg_new(), $1);
%*/
@@ -2517,7 +2411,7 @@ call_args : command
| assocs opt_block_arg
{
/*%%%*/
- $$ = $1 ? NEW_LIST(new_hash($1)) : 0;
+ $$ = NEW_LIST(NEW_HASH($1));
$$ = arg_blk_pass($$, $2);
/*%
$$ = arg_add_assocs(arg_new(), $1);
@@ -2527,7 +2421,7 @@ call_args : command
| args ',' assocs opt_block_arg
{
/*%%%*/
- $$ = $3 ? arg_append($1, new_hash($3)) : $1;
+ $$ = arg_append($1, NEW_HASH($3));
$$ = arg_blk_pass($$, $4);
/*%
$$ = arg_add_optblock(arg_add_assocs($1, $3), $4);
@@ -2699,7 +2593,9 @@ primary : literal
$$ = NEW_NIL();
}
else {
- set_line_body($3, $<num>2);
+ if (nd_type($3) == NODE_RESCUE ||
+ nd_type($3) == NODE_ENSURE)
+ nd_set_line($3, $<num>2);
$$ = NEW_BEGIN($3);
}
nd_set_line($$, $<num>2);
@@ -2707,26 +2603,20 @@ primary : literal
$$ = dispatch1(begin, $3);
%*/
}
- | tLPAREN_ARG {SET_LEX_STATE(EXPR_ENDARG);} rparen
+ | tLPAREN_ARG {lex_state = EXPR_ENDARG;} rparen
{
/*%%%*/
- $$ = NEW_BEGIN(0);
+ $$ = 0;
/*%
$$ = dispatch1(paren, 0);
%*/
}
- | tLPAREN_ARG
- {
- $<val>1 = cmdarg_stack;
- cmdarg_stack = 0;
- }
- expr {SET_LEX_STATE(EXPR_ENDARG);} rparen
+ | tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen
{
- cmdarg_stack = $<val>1;
/*%%%*/
- $$ = $3;
+ $$ = $2;
/*%
- $$ = dispatch1(paren, $3);
+ $$ = dispatch1(paren, $2);
%*/
}
| tLPAREN compstmt ')'
@@ -2769,7 +2659,7 @@ primary : literal
| tLBRACE assoc_list '}'
{
/*%%%*/
- $$ = new_hash($2);
+ $$ = NEW_HASH($2);
/*%
$$ = dispatch1(hash, escape_Qundef($2));
%*/
@@ -2808,10 +2698,11 @@ primary : literal
}
| keyword_defined opt_nl '(' {in_defined = 1;} expr rparen
{
- in_defined = 0;
/*%%%*/
+ in_defined = 0;
$$ = new_defined($5);
/*%
+ in_defined = 0;
$$ = dispatch1(defined, $5);
%*/
}
@@ -2862,7 +2753,7 @@ primary : literal
k_end
{
/*%%%*/
- $$ = new_if($2, $4, $5);
+ $$ = NEW_IF(cond($2), $4, $5);
fixpos($$, $2);
/*%
$$ = dispatch3(if, $2, $4, escape_Qundef($5));
@@ -2874,7 +2765,7 @@ primary : literal
k_end
{
/*%%%*/
- $$ = new_unless($2, $4, $5);
+ $$ = NEW_UNLESS(cond($2), $4, $5);
fixpos($$, $2);
/*%
$$ = dispatch3(unless, $2, $4, escape_Qundef($5));
@@ -2932,7 +2823,7 @@ primary : literal
/*
* for a, b, c in e
* #=>
- * e.each{|*x| a, b, c = x}
+ * e.each{|*x| a, b, c = x
*
* for a in e
* #=>
@@ -2943,23 +2834,41 @@ primary : literal
NODE *m = NEW_ARGS_AUX(0, 0);
NODE *args, *scope;
- switch (nd_type($2)) {
- case NODE_MASGN:
- m->nd_next = node_assign($2, NEW_FOR(NEW_DVAR(id), 0, 0));
- args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
- break;
- case NODE_LASGN:
- case NODE_DASGN:
- case NODE_DASGN_CURR:
- $2->nd_value = NEW_DVAR(id);
- m->nd_plen = 1;
- m->nd_next = $2;
- args = new_args(m, 0, 0, 0, new_args_tail(0, 0, 0));
- break;
- default:
- m->nd_next = node_assign(NEW_MASGN(NEW_LIST($2), 0), NEW_DVAR(id));
+ if (nd_type($2) == NODE_MASGN) {
+ /* if args.length == 1 && args[0].kind_of?(Array)
+ * args = args[0]
+ * end
+ */
+ NODE *one = NEW_LIST(NEW_LIT(INT2FIX(1)));
+ NODE *zero = NEW_LIST(NEW_LIT(INT2FIX(0)));
+ m->nd_next = block_append(
+ NEW_IF(
+ NEW_NODE(NODE_AND,
+ NEW_CALL(NEW_CALL(NEW_DVAR(id), idLength, 0),
+ idEq, one),
+ NEW_CALL(NEW_CALL(NEW_DVAR(id), idAREF, zero),
+ rb_intern("kind_of?"), NEW_LIST(NEW_LIT(rb_cArray))),
+ 0),
+ NEW_DASGN_CURR(id,
+ NEW_CALL(NEW_DVAR(id), idAREF, zero)),
+ 0),
+ node_assign($2, NEW_DVAR(id)));
+
args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
- break;
+ }
+ else {
+ if (nd_type($2) == NODE_LASGN ||
+ nd_type($2) == NODE_DASGN ||
+ nd_type($2) == NODE_DASGN_CURR) {
+ $2->nd_value = NEW_DVAR(id);
+ m->nd_plen = 1;
+ m->nd_next = $2;
+ args = new_args(m, 0, 0, 0, new_args_tail(0, 0, 0));
+ }
+ else {
+ m->nd_next = node_assign(NEW_MASGN(NEW_LIST($2), 0), NEW_DVAR(id));
+ args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
+ }
}
scope = NEW_NODE(NODE_SCOPE, tbl, $8, args);
tbl[0] = 1; tbl[1] = id;
@@ -2984,7 +2893,6 @@ primary : literal
{
/*%%%*/
$$ = NEW_CLASS($2, $5, $3);
- set_line_body($5, $<num>4);
nd_set_line($$, $<num>4);
/*%
$$ = dispatch3(class, $2, $3, $5);
@@ -2993,25 +2901,27 @@ primary : literal
}
| k_class tLSHFT expr
{
- $<num>$ = (in_def << 1) | in_single;
+ $<num>$ = in_def;
in_def = 0;
+ }
+ term
+ {
+ $<num>$ = in_single;
in_single = 0;
local_push(0);
}
- term
bodystmt
k_end
{
/*%%%*/
- $$ = NEW_SCLASS($3, $6);
- set_line_body($6, nd_line($3));
+ $$ = NEW_SCLASS($3, $7);
fixpos($$, $3);
/*%
- $$ = dispatch2(sclass, $3, $6);
+ $$ = dispatch2(sclass, $3, $7);
%*/
local_pop();
- in_def = ($<num>4 >> 1) & 1;
- in_single = $<num>4 & 1;
+ in_def = $<num>4;
+ in_single = $<num>6;
}
| k_module cpath
{
@@ -3028,7 +2938,6 @@ primary : literal
{
/*%%%*/
$$ = NEW_MODULE($2, $4);
- set_line_body($4, $<num>3);
nd_set_line($$, $<num>3);
/*%
$$ = dispatch2(module, $2, $4);
@@ -3037,39 +2946,32 @@ primary : literal
}
| k_def fname
{
+ $<id>$ = cur_mid;
+ cur_mid = $2;
+ in_def++;
local_push(0);
- $<id>$ = current_arg;
- current_arg = 0;
- }
- {
- $<num>$ = in_def;
- in_def = 1;
}
f_arglist
bodystmt
k_end
{
/*%%%*/
- NODE *body = remove_begin($6);
+ NODE *body = remove_begin($5);
reduce_nodes(&body);
- $$ = NEW_DEFN($2, $5, body, METHOD_VISI_PRIVATE);
- set_line_body(body, $<num>1);
+ $$ = NEW_DEFN($2, $4, body, NOEX_PRIVATE);
nd_set_line($$, $<num>1);
/*%
- $$ = dispatch3(def, $2, $5, $6);
+ $$ = dispatch3(def, $2, $4, $5);
%*/
local_pop();
- in_def = $<num>4 & 1;
- current_arg = $<id>3;
+ in_def--;
+ cur_mid = $<id>3;
}
- | k_def singleton dot_or_colon {SET_LEX_STATE(EXPR_FNAME);} fname
+ | k_def singleton dot_or_colon {lex_state = EXPR_FNAME;} fname
{
- $<num>4 = in_single;
- in_single = 1;
- SET_LEX_STATE(EXPR_ENDFN|EXPR_LABEL); /* force for args */
+ in_single++;
+ lex_state = EXPR_ENDFN; /* force for args */
local_push(0);
- $<id>$ = current_arg;
- current_arg = 0;
}
f_arglist
bodystmt
@@ -3079,14 +2981,12 @@ primary : literal
NODE *body = remove_begin($8);
reduce_nodes(&body);
$$ = NEW_DEFS($2, $5, $7, body);
- set_line_body(body, $<num>1);
nd_set_line($$, $<num>1);
/*%
$$ = dispatch5(defs, $2, $3, $5, $7, $8);
%*/
local_pop();
- in_single = $<num>4 & 1;
- current_arg = $<id>6;
+ in_single--;
}
| keyword_break
{
@@ -3231,7 +3131,7 @@ if_tail : opt_else
if_tail
{
/*%%%*/
- $$ = new_if($2, $4, $5);
+ $$ = NEW_IF(cond($2), $4, $5);
fixpos($$, $2);
/*%
$$ = dispatch3(elsif, $2, $4, escape_Qundef($5));
@@ -3475,7 +3375,6 @@ opt_block_param : none
block_param_def : '|' opt_bv_decl '|'
{
- current_arg = 0;
/*%%%*/
$$ = 0;
/*%
@@ -3494,7 +3393,6 @@ block_param_def : '|' opt_bv_decl '|'
}
| '|' block_param opt_bv_decl '|'
{
- current_arg = 0;
/*%%%*/
$$ = $2;
/*%
@@ -3559,20 +3457,14 @@ lambda : {
{
$<num>$ = ruby_sourceline;
}
- {
- $<val>$ = cmdarg_stack;
- cmdarg_stack = 0;
- }
lambda_body
{
lpar_beg = $<num>2;
- cmdarg_stack = $<val>5;
- CMDARG_LEXPOP();
/*%%%*/
- $$ = NEW_LAMBDA($3, $6);
+ $$ = NEW_LAMBDA($3, $5);
nd_set_line($$, $<num>4);
/*%
- $$ = dispatch2(lambda, $3, $6);
+ $$ = dispatch2(lambda, $3, $5);
%*/
dyna_pop($<vars>1);
}
@@ -3639,20 +3531,20 @@ block_call : command do_block
$$ = method_add_block($1, $2);
%*/
}
- | block_call call_op2 operation2 opt_paren_args
+ | block_call dot_or_colon operation2 opt_paren_args
{
/*%%%*/
- $$ = NEW_QCALL($2, $1, $3, $4);
+ $$ = NEW_CALL($1, $3, $4);
/*%
$$ = dispatch3(call, $1, $2, $3);
$$ = method_optarg($$, $4);
%*/
}
- | block_call call_op2 operation2 opt_paren_args brace_block
+ | block_call dot_or_colon operation2 opt_paren_args brace_block
{
/*%%%*/
block_dup_check($4, $5);
- $5->nd_iter = NEW_QCALL($2, $1, $3, $4);
+ $5->nd_iter = NEW_CALL($1, $3, $4);
$$ = $5;
fixpos($$, $1);
/*%
@@ -3660,11 +3552,11 @@ block_call : command do_block
$$ = method_add_block($$, $5);
%*/
}
- | block_call call_op2 operation2 command_args do_block
+ | block_call dot_or_colon operation2 command_args do_block
{
/*%%%*/
block_dup_check($4, $5);
- $5->nd_iter = NEW_QCALL($2, $1, $3, $4);
+ $5->nd_iter = NEW_CALL($1, $3, $4);
$$ = $5;
fixpos($$, $1);
/*%
@@ -3683,7 +3575,7 @@ method_call : fcall paren_args
$$ = method_arg(dispatch1(fcall, $1), $2);
%*/
}
- | primary_value call_op operation2
+ | primary_value '.' operation2
{
/*%%%*/
$<num>$ = ruby_sourceline;
@@ -3692,10 +3584,10 @@ method_call : fcall paren_args
opt_paren_args
{
/*%%%*/
- $$ = NEW_QCALL($2, $1, $3, $5);
+ $$ = NEW_CALL($1, $3, $5);
nd_set_line($$, $<num>4);
/*%
- $$ = dispatch3(call, $1, $2, $3);
+ $$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
$$ = method_optarg($$, $5);
%*/
}
@@ -3711,7 +3603,7 @@ method_call : fcall paren_args
$$ = NEW_CALL($1, $3, $5);
nd_set_line($$, $<num>4);
/*%
- $$ = dispatch3(call, $1, ripper_id2sym(idCOLON2), $3);
+ $$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
$$ = method_optarg($$, $5);
%*/
}
@@ -3720,10 +3612,10 @@ method_call : fcall paren_args
/*%%%*/
$$ = NEW_CALL($1, $3, 0);
/*%
- $$ = dispatch3(call, $1, ID2SYM(idCOLON2), $3);
+ $$ = dispatch3(call, $1, ripper_intern("::"), $3);
%*/
}
- | primary_value call_op
+ | primary_value '.'
{
/*%%%*/
$<num>$ = ruby_sourceline;
@@ -3732,10 +3624,11 @@ method_call : fcall paren_args
paren_args
{
/*%%%*/
- $$ = NEW_QCALL($2, $1, idCall, $4);
+ $$ = NEW_CALL($1, rb_intern("call"), $4);
nd_set_line($$, $<num>3);
/*%
- $$ = dispatch3(call, $1, $2, ID2SYM(idCall));
+ $$ = dispatch3(call, $1, ripper_id2sym('.'),
+ ripper_intern("call"));
$$ = method_optarg($$, $4);
%*/
}
@@ -3748,11 +3641,11 @@ method_call : fcall paren_args
paren_args
{
/*%%%*/
- $$ = NEW_CALL($1, idCall, $4);
+ $$ = NEW_CALL($1, rb_intern("call"), $4);
nd_set_line($$, $<num>3);
/*%
- $$ = dispatch3(call, $1, ID2SYM(idCOLON2),
- ID2SYM(idCall));
+ $$ = dispatch3(call, $1, ripper_intern("::"),
+ ripper_intern("call"));
$$ = method_optarg($$, $4);
%*/
}
@@ -3944,8 +3837,6 @@ string : tCHAR
string1 : tSTRING_BEG string_contents tSTRING_END
{
- heredoc_dedent($2);
- heredoc_indent = 0;
/*%%%*/
$$ = $2;
/*%
@@ -3958,11 +3849,6 @@ xstring : tXSTRING_BEG xstring_contents tSTRING_END
{
/*%%%*/
NODE *node = $2;
- /*%
- %*/
- heredoc_dedent($2);
- heredoc_indent = 0;
- /*%%%*/
if (!node) {
node = NEW_XSTR(STR_NEW0());
}
@@ -4046,19 +3932,6 @@ regexp : tREGEXP_BEG regexp_contents tREGEXP_END
}
$$ = node;
/*%
- VALUE re = $2, opt = $3, src = 0, err;
- int options = 0;
- if (ripper_is_node_yylval(re)) {
- $2 = RNODE(re)->nd_rval;
- src = RNODE(re)->nd_cval;
- }
- if (ripper_is_node_yylval(opt)) {
- $3 = RNODE(opt)->nd_rval;
- options = (int)RNODE(opt)->nd_tag;
- }
- if (src && NIL_P(rb_parser_reg_compile(parser, src, options, &err))) {
- compile_error(PARSER_ARG "%"PRIsVALUE, err);
- }
$$ = dispatch2(regexp_literal, $2, $3);
%*/
}
@@ -4150,13 +4023,7 @@ symbol_list : /* none */
{
/*%%%*/
$2 = evstr2dstr($2);
- if (nd_type($2) == NODE_DSTR) {
- nd_set_type($2, NODE_DSYM);
- }
- else {
- nd_set_type($2, NODE_LIT);
- $2->nd_lit = rb_str_intern($2->nd_lit);
- }
+ nd_set_type($2, NODE_DSYM);
$$ = list_append($1, $2);
/*%
$$ = dispatch2(symbols_add, $1, $2);
@@ -4283,7 +4150,7 @@ regexp_contents: /* none */
/*%%%*/
$$ = 0;
/*%
- $$ = ripper_new_yylval(0, dispatch0(regexp_new), 0);
+ $$ = dispatch0(regexp_new);
%*/
}
| regexp_contents string_content
@@ -4310,19 +4177,7 @@ regexp_contents: /* none */
$$ = list_append(head, tail);
}
/*%
- VALUE s1 = 1, s2 = 0, n1 = $1, n2 = $2;
- if (ripper_is_node_yylval(n1)) {
- s1 = RNODE(n1)->nd_cval;
- n1 = RNODE(n1)->nd_rval;
- }
- if (ripper_is_node_yylval(n2)) {
- s2 = RNODE(n2)->nd_cval;
- n2 = RNODE(n2)->nd_rval;
- }
- $$ = dispatch2(regexp_add, n1, n2);
- if (!s1 && s2) {
- $$ = ripper_new_yylval(0, $$, s2);
- }
+ $$ = dispatch2(regexp_add, $1, $2);
%*/
}
;
@@ -4332,14 +4187,15 @@ string_content : tSTRING_CONTENT
{
$<node>$ = lex_strterm;
lex_strterm = 0;
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
}
string_dvar
{
- lex_strterm = $<node>2;
/*%%%*/
+ lex_strterm = $<node>2;
$$ = NEW_EVSTR($3);
/*%
+ lex_strterm = $<node>2;
$$ = dispatch1(string_dvar, $3);
%*/
}
@@ -4353,33 +4209,23 @@ string_content : tSTRING_CONTENT
{
$<node>$ = lex_strterm;
lex_strterm = 0;
- }
- {
- $<num>$ = lex_state;
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
}
{
$<num>$ = brace_nest;
brace_nest = 0;
}
- {
- $<num>$ = heredoc_indent;
- heredoc_indent = 0;
- }
compstmt tSTRING_DEND
{
cond_stack = $<val>1;
cmdarg_stack = $<val>2;
lex_strterm = $<node>3;
- SET_LEX_STATE($<num>4);
- brace_nest = $<num>5;
- heredoc_indent = $<num>6;
- heredoc_line_indent = -1;
+ brace_nest = $<num>4;
/*%%%*/
- if ($7) $7->flags &= ~NODE_FL_NEWLINE;
- $$ = new_evstr($7);
+ if ($5) $5->flags &= ~NODE_FL_NEWLINE;
+ $$ = new_evstr($5);
/*%
- $$ = dispatch1(string_embexpr, $7);
+ $$ = dispatch1(string_embexpr, $5);
%*/
}
;
@@ -4413,7 +4259,7 @@ string_dvar : tGVAR
symbol : tSYMBEG sym
{
- SET_LEX_STATE(EXPR_END);
+ lex_state = EXPR_END;
/*%%%*/
$$ = $2;
/*%
@@ -4430,7 +4276,7 @@ sym : fname
dsym : tSYMBEG xstring_contents tSTRING_END
{
- SET_LEX_STATE(EXPR_END);
+ lex_state = EXPR_END;
/*%%%*/
$$ = dsym_node($2);
/*%
@@ -4443,10 +4289,9 @@ numeric : simple_numeric
| tUMINUS_NUM simple_numeric %prec tLOWEST
{
/*%%%*/
- $$ = $2;
- $$->nd_lit = negate_lit($$->nd_lit);
+ $$ = negate_lit($2);
/*%
- $$ = dispatch2(unary, ID2SYM(idUMinus), $2);
+ $$ = dispatch2(unary, ripper_intern("-@"), $2);
%*/
}
;
@@ -4518,20 +4363,30 @@ backref : tNTH_REF
| tBACK_REF
;
-superclass : '<'
+superclass : term
{
- SET_LEX_STATE(EXPR_BEG);
+ /*%%%*/
+ $$ = 0;
+ /*%
+ $$ = Qnil;
+ %*/
+ }
+ | '<'
+ {
+ lex_state = EXPR_BEG;
command_start = TRUE;
}
expr_value term
{
$$ = $3;
}
- | /* none */
+ | error term
{
/*%%%*/
+ yyerrok;
$$ = 0;
/*%
+ yyerrok;
$$ = Qnil;
%*/
}
@@ -4544,19 +4399,13 @@ f_arglist : '(' f_args rparen
/*%
$$ = dispatch1(paren, $2);
%*/
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
command_start = TRUE;
}
- | {
- $<num>$ = parser->in_kwarg;
- parser->in_kwarg = 1;
- lex_state |= EXPR_LABEL; /* force for args */
- }
- f_args term
+ | f_args term
{
- parser->in_kwarg = !!$<num>1;
- $$ = $2;
- SET_LEX_STATE(EXPR_BEG);
+ $$ = $1;
+ lex_state = EXPR_BEG;
command_start = TRUE;
}
;
@@ -4659,7 +4508,6 @@ f_bad_arg : tCONSTANT
$$ = 0;
/*%
$$ = dispatch1(param_error, $1);
- ripper_error();
%*/
}
| tIVAR
@@ -4669,7 +4517,6 @@ f_bad_arg : tCONSTANT
$$ = 0;
/*%
$$ = dispatch1(param_error, $1);
- ripper_error();
%*/
}
| tGVAR
@@ -4679,7 +4526,6 @@ f_bad_arg : tCONSTANT
$$ = 0;
/*%
$$ = dispatch1(param_error, $1);
- ripper_error();
%*/
}
| tCVAR
@@ -4689,7 +4535,6 @@ f_bad_arg : tCONSTANT
$$ = 0;
/*%
$$ = dispatch1(param_error, $1);
- ripper_error();
%*/
}
;
@@ -4702,18 +4547,9 @@ f_norm_arg : f_bad_arg
}
;
-f_arg_asgn : f_norm_arg
- {
- ID id = get_id($1);
- arg_var(id);
- current_arg = id;
- $$ = $1;
- }
- ;
-
-f_arg_item : f_arg_asgn
+f_arg_item : f_norm_arg
{
- current_arg = 0;
+ arg_var(get_id($1));
/*%%%*/
$$ = NEW_ARGS_AUX($1, 1);
/*%
@@ -4762,29 +4598,25 @@ f_arg : f_arg_item
f_label : tLABEL
{
- ID id = get_id($1);
- arg_var(formal_argument(id));
- current_arg = id;
+ arg_var(formal_argument(get_id($1)));
$$ = $1;
}
;
f_kw : f_label arg_value
{
- current_arg = 0;
$$ = assignable($1, $2);
/*%%%*/
- $$ = new_kw_arg($$);
+ $$ = NEW_KW_ARG(0, $$);
/*%
$$ = rb_assoc_new($$, $2);
%*/
}
| f_label
{
- current_arg = 0;
$$ = assignable($1, (NODE *)-1);
/*%%%*/
- $$ = new_kw_arg($$);
+ $$ = NEW_KW_ARG(0, $$);
/*%
$$ = rb_assoc_new($$, 0);
%*/
@@ -4795,7 +4627,7 @@ f_block_kw : f_label primary_value
{
$$ = assignable($1, $2);
/*%%%*/
- $$ = new_kw_arg($$);
+ $$ = NEW_KW_ARG(0, $$);
/*%
$$ = rb_assoc_new($$, $2);
%*/
@@ -4804,7 +4636,7 @@ f_block_kw : f_label primary_value
{
$$ = assignable($1, (NODE *)-1);
/*%%%*/
- $$ = new_kw_arg($$);
+ $$ = NEW_KW_ARG(0, $$);
/*%
$$ = rb_assoc_new($$, 0);
%*/
@@ -4822,7 +4654,13 @@ f_block_kwarg : f_block_kw
| f_block_kwarg ',' f_block_kw
{
/*%%%*/
- $$ = kwd_append($1, $3);
+ NODE *kws = $1;
+
+ while (kws->nd_next) {
+ kws = kws->nd_next;
+ }
+ kws->nd_next = $3;
+ $$ = $1;
/*%
$$ = rb_ary_push($1, $3);
%*/
@@ -4841,7 +4679,13 @@ f_kwarg : f_kw
| f_kwarg ',' f_kw
{
/*%%%*/
- $$ = kwd_append($1, $3);
+ NODE *kws = $1;
+
+ while (kws->nd_next) {
+ kws = kws->nd_next;
+ }
+ kws->nd_next = $3;
+ $$ = $1;
/*%
$$ = rb_ary_push($1, $3);
%*/
@@ -4860,13 +4704,12 @@ f_kwrest : kwrest_mark tIDENTIFIER
| kwrest_mark
{
$$ = internal_id();
- arg_var($$);
}
;
-f_opt : f_arg_asgn '=' arg_value
+f_opt : f_norm_arg '=' arg_value
{
- current_arg = 0;
+ arg_var(get_id($1));
$$ = assignable($1, $3);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$);
@@ -4876,9 +4719,9 @@ f_opt : f_arg_asgn '=' arg_value
}
;
-f_block_opt : f_arg_asgn '=' primary_value
+f_block_opt : f_norm_arg '=' primary_value
{
- current_arg = 0;
+ arg_var(get_id($1));
$$ = assignable($1, $3);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$);
@@ -5009,7 +4852,7 @@ singleton : var_ref
$$ = $1;
%*/
}
- | '(' {SET_LEX_STATE(EXPR_BEG);} expr rparen
+ | '(' {lex_state = EXPR_BEG;} expr rparen
{
/*%%%*/
if ($3 == 0) {
@@ -5059,21 +4902,7 @@ assocs : assoc
| assocs ',' assoc
{
/*%%%*/
- NODE *assocs = $1;
- NODE *tail = $3;
- if (!assocs) {
- assocs = tail;
- }
- else if (tail) {
- if (assocs->nd_head &&
- !tail->nd_head && nd_type(tail->nd_next) == NODE_ARRAY &&
- nd_type(tail->nd_next->nd_head) == NODE_HASH) {
- /* DSTAR */
- tail = tail->nd_next->nd_head->nd_head;
- }
- assocs = list_concat(assocs, tail);
- }
- $$ = assocs;
+ $$ = list_concat($1, $3);
/*%
$$ = rb_ary_push($1, $3);
%*/
@@ -5083,10 +4912,6 @@ assocs : assoc
assoc : arg_value tASSOC arg_value
{
/*%%%*/
- if (nd_type($1) == NODE_STR) {
- nd_set_type($1, NODE_LIT);
- $1->nd_lit = rb_fstring($1->nd_lit);
- }
$$ = list_append(NEW_LIST($1), $3);
/*%
$$ = dispatch2(assoc_new, $1, $3);
@@ -5100,28 +4925,18 @@ assoc : arg_value tASSOC arg_value
$$ = dispatch2(assoc_new, $1, $2);
%*/
}
- | tSTRING_BEG string_contents tLABEL_END arg_value
- {
- /*%%%*/
- $$ = list_append(NEW_LIST(dsym_node($2)), $4);
- /*%
- $$ = dispatch2(assoc_new, dispatch1(dyna_symbol, $2), $4);
- %*/
- }
| tDSTAR arg_value
{
/*%%%*/
- if (nd_type($2) == NODE_HASH &&
- !($2->nd_head && $2->nd_head->nd_alen))
- $$ = 0;
- else
- $$ = list_append(NEW_LIST(0), $2);
+ $$ = list_append(NEW_LIST(0), $2);
/*%
$$ = dispatch1(assoc_splat, $2);
%*/
}
;
+ ;
+
operation : tIDENTIFIER
| tCONSTANT
| tFID
@@ -5150,35 +4965,6 @@ dot_or_colon : '.'
%*/
;
-call_op : '.'
- {
- /*%%%*/
- $$ = '.';
- /*%
- $$ = ripper_id2sym('.');
- %*/
- }
- | tANDDOT
- {
- /*%%%*/
- $$ = tANDDOT;
- /*%
- $$ = ripper_id2sym(idANDDOT);
- %*/
- }
- ;
-
-call_op2 : call_op
- | tCOLON2
- {
- /*%%%*/
- $$ = tCOLON2;
- /*%
- $$ = ripper_id2sym(idCOLON2);
- %*/
- }
- ;
-
opt_terms : /* none */
| terms
;
@@ -5219,7 +5005,7 @@ none : /* none */
# undef parser
# undef yylex
# undef yylval
-# define yylval (*parser->lval)
+# define yylval (*((YYSTYPE*)(parser->parser_yylval)))
static int parser_regx_options(struct parser_params*);
static int parser_tokadd_string(struct parser_params*,int,int,int,long*,rb_encoding**);
@@ -5260,10 +5046,10 @@ static int parser_here_document(struct parser_params*,NODE*);
static inline VALUE
ripper_yylval_id(ID x)
{
- return ripper_new_yylval(x, ID2SYM(x), 0);
+ return (VALUE)NEW_LASGN(x, ID2SYM(x));
}
-# define set_yylval_str(x) (yylval.val = (x))
-# define set_yylval_num(x) (yylval.val = ripper_new_yylval((x), 0, 0))
+# define set_yylval_str(x) (void)(x)
+# define set_yylval_num(x) (void)(x)
# define set_yylval_id(x) (void)(x)
# define set_yylval_name(x) (void)(yylval.val = ripper_yylval_id(x))
# define set_yylval_literal(x) (void)(x)
@@ -5273,21 +5059,11 @@ ripper_yylval_id(ID x)
#ifndef RIPPER
#define ripper_flush(p) (void)(p)
-#define dispatch_scan_event(t) ((void)0)
-#define dispatch_delayed_token(t) ((void)0)
-#define has_delayed_token() (0)
#else
-#define ripper_flush(p) ((p)->tokp = (p)->lex.pcur)
+#define ripper_flush(p) ((p)->tokp = (p)->parser_lex_p)
#define yylval_rval (*(RB_TYPE_P(yylval.val, T_NODE) ? &yylval.node->nd_rval : &yylval.val))
-static inline VALUE
-intern_sym(const char *name)
-{
- ID id = rb_intern_const(name);
- return ID2SYM(id);
-}
-
static int
ripper_has_scan_event(struct parser_params *parser)
{
@@ -5311,7 +5087,13 @@ ripper_dispatch_scan_event(struct parser_params *parser, int t)
if (!ripper_has_scan_event(parser)) return;
yylval_rval = ripper_scan_event_val(parser, t);
}
-#define dispatch_scan_event(t) ripper_dispatch_scan_event(parser, t)
+
+static void
+ripper_dispatch_ignored_scan_event(struct parser_params *parser, int t)
+{
+ if (!ripper_has_scan_event(parser)) return;
+ (void)ripper_scan_event_val(parser, t);
+}
static void
ripper_dispatch_delayed_token(struct parser_params *parser, int t)
@@ -5326,8 +5108,6 @@ ripper_dispatch_delayed_token(struct parser_params *parser, int t)
ruby_sourceline = saved_line;
parser->tokp = saved_tokp;
}
-#define dispatch_delayed_token(t) ripper_dispatch_delayed_token(parser, t)
-#define has_delayed_token() (!NIL_P(parser->delayed))
#endif /* RIPPER */
#include "ruby/regex.h"
@@ -5347,19 +5127,21 @@ ripper_dispatch_delayed_token(struct parser_params *parser, int t)
#define parser_encoding_name() (current_enc->name)
#define parser_mbclen() mbclen((lex_p-1),lex_pend,current_enc)
+#define parser_precise_mbclen() rb_enc_precise_mbclen((lex_p-1),lex_pend,current_enc)
#define is_identchar(p,e,enc) (rb_enc_isalnum((unsigned char)(*(p)),(enc)) || (*(p)) == '_' || !ISASCII(*(p)))
#define parser_is_identchar() (!parser->eofp && is_identchar((lex_p-1),lex_pend,current_enc))
#define parser_isascii() ISASCII(*(lex_p-1))
+#ifndef RIPPER
static int
-token_info_get_column(struct parser_params *parser, const char *pend)
+token_info_get_column(struct parser_params *parser, const char *token)
{
int column = 1;
- const char *p;
+ const char *p, *pend = lex_p - strlen(token);
for (p = lex_pbeg; p < pend; p++) {
if (*p == '\t') {
- column = (((column - 1) / TAB_WIDTH) + 1) * TAB_WIDTH;
+ column = (((column - 1) / 8) + 1) * 8;
}
column++;
}
@@ -5367,9 +5149,9 @@ token_info_get_column(struct parser_params *parser, const char *pend)
}
static int
-token_info_has_nonspaces(struct parser_params *parser, const char *pend)
+token_info_has_nonspaces(struct parser_params *parser, const char *token)
{
- const char *p;
+ const char *p, *pend = lex_p - strlen(token);
for (p = lex_pbeg; p < pend; p++) {
if (*p != ' ' && *p != '\t') {
return 1;
@@ -5380,56 +5162,50 @@ token_info_has_nonspaces(struct parser_params *parser, const char *pend)
#undef token_info_push
static void
-token_info_push(struct parser_params *parser, const char *token, size_t len)
+token_info_push(struct parser_params *parser, const char *token)
{
token_info *ptinfo;
- const char *t = lex_p - len;
- if (!parser->token_info_enabled) return;
+ if (!parser->parser_token_info_enabled) return;
ptinfo = ALLOC(token_info);
ptinfo->token = token;
ptinfo->linenum = ruby_sourceline;
- ptinfo->column = token_info_get_column(parser, t);
- ptinfo->nonspc = token_info_has_nonspaces(parser, t);
- ptinfo->next = parser->token_info;
+ ptinfo->column = token_info_get_column(parser, token);
+ ptinfo->nonspc = token_info_has_nonspaces(parser, token);
+ ptinfo->next = parser->parser_token_info;
- parser->token_info = ptinfo;
+ parser->parser_token_info = ptinfo;
}
#undef token_info_pop
static void
-token_info_pop(struct parser_params *parser, const char *token, size_t len)
+token_info_pop(struct parser_params *parser, const char *token)
{
int linenum;
- token_info *ptinfo = parser->token_info;
- const char *t = lex_p - len;
+ token_info *ptinfo = parser->parser_token_info;
if (!ptinfo) return;
- parser->token_info = ptinfo->next;
+ parser->parser_token_info = ptinfo->next;
+ if (token_info_get_column(parser, token) == ptinfo->column) { /* OK */
+ goto finish;
+ }
linenum = ruby_sourceline;
- if (parser->token_info_enabled &&
- linenum != ptinfo->linenum && !ptinfo->nonspc &&
- !token_info_has_nonspaces(parser, t) &&
- token_info_get_column(parser, t) != ptinfo->column) {
- rb_warn3L(linenum,
- "mismatched indentations at '%s' with '%s' at %d",
- WARN_S(token), WARN_S(ptinfo->token), WARN_I(ptinfo->linenum));
+ if (linenum == ptinfo->linenum) { /* SKIP */
+ goto finish;
}
-
- xfree(ptinfo);
-}
-
-static int
-parser_precise_mbclen(struct parser_params *parser, const char *p)
-{
- int len = rb_enc_precise_mbclen(p, lex_pend, current_enc);
- if (!MBCLEN_CHARFOUND_P(len)) {
- compile_error(PARSER_ARG "invalid multibyte char (%s)", parser_encoding_name());
- return -1;
+ if (token_info_has_nonspaces(parser, token) || ptinfo->nonspc) { /* SKIP */
+ goto finish;
+ }
+ if (parser->parser_token_info_enabled) {
+ rb_compile_warn(ruby_sourcefile, linenum,
+ "mismatched indentations at '%s' with '%s' at %d",
+ token, ptinfo->token, ptinfo->linenum);
}
- return len;
+ finish:
+ xfree(ptinfo);
}
+#endif /* RIPPER */
static int
parser_yyerror(struct parser_params *parser, const char *msg)
@@ -5437,12 +5213,11 @@ parser_yyerror(struct parser_params *parser, const char *msg)
#ifndef RIPPER
const int max_line_margin = 30;
const char *p, *pe;
- const char *pre = "", *post = "";
- const char *code = "", *caret = "", *newline = "";
char *buf;
long len;
int i;
+ compile_error(PARSER_ARG "%s", msg);
p = lex_p;
while (lex_pbeg <= p) {
if (*p == '\n') break;
@@ -5459,6 +5234,7 @@ parser_yyerror(struct parser_params *parser, const char *msg)
len = pe - p;
if (len > 4) {
char *p2;
+ const char *pre = "", *post = "";
if (len > max_line_margin * 2 + 10) {
if (lex_p - p > max_line_margin) {
@@ -5471,27 +5247,24 @@ parser_yyerror(struct parser_params *parser, const char *msg)
}
len = pe - p;
}
+ buf = ALLOCA_N(char, len+2);
+ MEMCPY(buf, p, char, len);
+ buf[len] = '\0';
+ rb_compile_error_append("%s%s%s", pre, buf, post);
+
i = (int)(lex_p - p);
- buf = ALLOCA_N(char, i+2);
- code = p;
- caret = p2 = buf;
- while (i-- > 0) {
- *p2++ = *p++ == '\t' ? '\t' : ' ';
+ p2 = buf; pe = buf + len;
+
+ while (p2 < pe) {
+ if (*p2 != '\t') *p2 = ' ';
+ p2++;
}
- *p2++ = '^';
- *p2 = '\0';
- newline = "\n";
+ buf[i] = '^';
+ buf[i+1] = '\0';
+ rb_compile_error_append("%s%s", pre, buf);
}
- else {
- len = 0;
- }
- compile_error(PARSER_ARG "%s%s""%s%.*s%s%s""%s%s",
- msg, newline,
- pre, (int)len, code, post, newline,
- pre, caret);
#else
dispatch1(parse_error, STR_NEW2(msg));
- ripper_error();
#endif /* !RIPPER */
return 0;
}
@@ -5520,7 +5293,11 @@ coverage(VALUE fname, int n)
{
VALUE coverages = rb_get_coverages();
if (RTEST(coverages) && RBASIC(coverages)->klass == 0) {
- VALUE lines = n > 0 ? rb_ary_tmp_new_fill(n) : rb_ary_tmp_new(0);
+ VALUE lines = rb_ary_new2(n);
+ int i;
+ RBASIC_CLEAR_CLASS(lines);
+ for (i = 0; i < n; i++) RARRAY_ASET(lines, i, Qnil);
+ RARRAY(lines)->as.heap.len = n;
rb_hash_aset(coverages, fname, lines);
return lines;
}
@@ -5557,16 +5334,22 @@ yycompile0(VALUE arg)
parser->last_cr_line = ruby_sourceline - 1;
parser_prepare(parser);
+ deferred_nodes = 0;
+#ifndef RIPPER
+ parser->parser_token_info_enabled = !compile_for_eval && RTEST(ruby_verbose);
+#endif
#ifndef RIPPER
-#define RUBY_DTRACE_PARSE_HOOK(name) \
- if (RUBY_DTRACE_PARSE_##name##_ENABLED()) { \
- RUBY_DTRACE_PARSE_##name(ruby_sourcefile, ruby_sourceline); \
+ if (RUBY_DTRACE_PARSE_BEGIN_ENABLED()) {
+ RUBY_DTRACE_PARSE_BEGIN(parser->parser_ruby_sourcefile,
+ parser->parser_ruby_sourceline);
}
- RUBY_DTRACE_PARSE_HOOK(BEGIN);
#endif
n = yyparse((void*)parser);
#ifndef RIPPER
- RUBY_DTRACE_PARSE_HOOK(END);
+ if (RUBY_DTRACE_PARSE_END_ENABLED()) {
+ RUBY_DTRACE_PARSE_END(parser->parser_ruby_sourcefile,
+ parser->parser_ruby_sourceline);
+ }
#endif
ruby_debug_lines = 0;
ruby_coverage = 0;
@@ -5575,15 +5358,15 @@ yycompile0(VALUE arg)
lex_strterm = 0;
lex_p = lex_pbeg = lex_pend = 0;
lex_lastline = lex_nextline = 0;
- if (parser->error_p) {
+ if (parser->nerr) {
return 0;
}
tree = ruby_eval_tree;
if (!tree) {
tree = NEW_NIL();
}
- else {
- tree->nd_body = NEW_PRELUDE(ruby_eval_tree_begin, tree->nd_body, parser->compile_option);
+ else if (ruby_eval_tree_begin) {
+ tree->nd_body = NEW_PRELUDE(ruby_eval_tree_begin, tree->nd_body);
}
return (VALUE)tree;
}
@@ -5611,27 +5394,27 @@ must_be_ascii_compatible(VALUE s)
static VALUE
lex_get_str(struct parser_params *parser, VALUE s)
{
- char *beg, *end, *start;
- long len;
+ char *beg, *end, *pend;
+ rb_encoding *enc = must_be_ascii_compatible(s);
beg = RSTRING_PTR(s);
- len = RSTRING_LEN(s);
- start = beg;
if (lex_gets_ptr) {
- if (len == lex_gets_ptr) return Qnil;
+ if (RSTRING_LEN(s) == lex_gets_ptr) return Qnil;
beg += lex_gets_ptr;
- len -= lex_gets_ptr;
}
- end = memchr(beg, '\n', len);
- if (end) len = ++end - beg;
- lex_gets_ptr += len;
- return rb_str_subseq(s, beg - start, len);
+ pend = RSTRING_PTR(s) + RSTRING_LEN(s);
+ end = beg;
+ while (end < pend) {
+ if (*end++ == '\n') break;
+ }
+ lex_gets_ptr = end - RSTRING_PTR(s);
+ return rb_enc_str_new(beg, end - beg, enc);
}
static VALUE
lex_getline(struct parser_params *parser)
{
- VALUE line = (*lex_gets)(parser, lex_input);
+ VALUE line = (*parser->parser_lex_gets)(parser, parser->parser_lex_input);
if (NIL_P(line)) return line;
must_be_ascii_compatible(line);
#ifndef RIPPER
@@ -5646,11 +5429,13 @@ lex_getline(struct parser_params *parser)
return line;
}
+#ifdef RIPPER
+static rb_data_type_t parser_data_type;
+#else
static const rb_data_type_t parser_data_type;
-#ifndef RIPPER
static NODE*
-parser_compile_string(VALUE vparser, VALUE fname, VALUE s, int line)
+parser_compile_string(volatile VALUE vparser, VALUE fname, VALUE s, int line)
{
struct parser_params *parser;
NODE *node;
@@ -5658,9 +5443,9 @@ parser_compile_string(VALUE vparser, VALUE fname, VALUE s, int line)
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
lex_gets = lex_get_str;
lex_gets_ptr = 0;
- lex_input = rb_str_new_frozen(s);
+ lex_input = s;
lex_pbeg = lex_p = lex_pend = 0;
- compile_for_eval = !!rb_parse_in_eval();
+ compile_for_eval = rb_parse_in_eval();
node = yycompile(parser, fname, line);
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
@@ -5676,13 +5461,13 @@ rb_compile_string(const char *f, VALUE s, int line)
}
NODE*
-rb_parser_compile_string(VALUE vparser, const char *f, VALUE s, int line)
+rb_parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
{
return rb_parser_compile_string_path(vparser, rb_filesystem_str_new_cstr(f), s, line);
}
NODE*
-rb_parser_compile_string_path(VALUE vparser, VALUE f, VALUE s, int line)
+rb_parser_compile_string_path(volatile VALUE vparser, VALUE f, VALUE s, int line)
{
must_be_ascii_compatible(s);
return parser_compile_string(vparser, f, s, line);
@@ -5696,7 +5481,7 @@ rb_compile_cstr(const char *f, const char *s, int len, int line)
}
NODE*
-rb_parser_compile_cstr(VALUE vparser, const char *f, const char *s, int len, int line)
+rb_parser_compile_cstr(volatile VALUE vparser, const char *f, const char *s, int len, int line)
{
VALUE str = rb_str_new(s, len);
return parser_compile_string(vparser, rb_filesystem_str_new_cstr(f), str, line);
@@ -5711,19 +5496,19 @@ lex_io_gets(struct parser_params *parser, VALUE io)
NODE*
rb_compile_file(const char *f, VALUE file, int start)
{
- VALUE vparser = rb_parser_new();
+ VALUE volatile vparser = rb_parser_new();
return rb_parser_compile_file(vparser, f, file, start);
}
NODE*
-rb_parser_compile_file(VALUE vparser, const char *f, VALUE file, int start)
+rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int start)
{
return rb_parser_compile_file_path(vparser, rb_filesystem_str_new_cstr(f), file, start);
}
NODE*
-rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE file, int start)
+rb_parser_compile_file_path(volatile VALUE vparser, VALUE fname, VALUE file, int start)
{
struct parser_params *parser;
NODE *node;
@@ -5732,7 +5517,7 @@ rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE file, int start)
lex_gets = lex_io_gets;
lex_input = file;
lex_pbeg = lex_p = lex_pend = 0;
- compile_for_eval = !!rb_parse_in_eval();
+ compile_for_eval = rb_parse_in_eval();
node = yycompile(parser, fname, start);
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
@@ -5747,10 +5532,8 @@ rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE file, int start)
#define STR_FUNC_QWORDS 0x08
#define STR_FUNC_SYMBOL 0x10
#define STR_FUNC_INDENT 0x20
-#define STR_FUNC_LABEL 0x40
enum string_type {
- str_label = STR_FUNC_LABEL,
str_squote = (0),
str_dquote = (STR_FUNC_EXPAND),
str_xquote = (STR_FUNC_EXPAND),
@@ -5778,12 +5561,10 @@ parser_str_new(const char *p, long n, rb_encoding *enc, int func, rb_encoding *e
return str;
}
-#define lex_goto_eol(parser) ((parser)->lex.pcur = (parser)->lex.pend)
+#define lex_goto_eol(parser) ((parser)->parser_lex_p = (parser)->parser_lex_pend)
#define lex_eol_p() (lex_p >= lex_pend)
#define peek(c) peek_n((c), 0)
#define peek_n(c,n) (lex_p+(n) < lex_pend && (c) == (unsigned char)lex_p[n])
-#define peekc() peekc_n(0)
-#define peekc_n(n) (lex_p+(n) < lex_pend ? (unsigned char)lex_p[n] : -1)
static inline int
parser_nextc(struct parser_params *parser)
@@ -5798,7 +5579,7 @@ parser_nextc(struct parser_params *parser)
return -1;
if (!lex_input || NIL_P(v = lex_getline(parser))) {
- parser->eofp = 1;
+ parser->eofp = Qtrue;
lex_goto_eol(parser);
return -1;
}
@@ -5806,7 +5587,7 @@ parser_nextc(struct parser_params *parser)
{
#ifdef RIPPER
if (parser->tokp < lex_pend) {
- if (!has_delayed_token()) {
+ if (NIL_P(parser->delayed)) {
parser->delayed = rb_str_buf_new(1024);
rb_enc_associate(parser->delayed, current_enc);
rb_str_buf_cat(parser->delayed,
@@ -5840,7 +5621,7 @@ parser_nextc(struct parser_params *parser)
}
else if (ruby_sourceline > parser->last_cr_line) {
parser->last_cr_line = ruby_sourceline;
- rb_warn0("encountered \\r in middle of line, treated as a mere space");
+ rb_compile_warn(ruby_sourcefile, ruby_sourceline, "encountered \\r in middle of line, treated as a mere space");
}
}
@@ -6211,8 +5992,11 @@ dispose_string(VALUE str)
static int
parser_tokadd_mbchar(struct parser_params *parser, int c)
{
- int len = parser_precise_mbclen(parser, lex_p-1);
- if (len < 0) return -1;
+ int len = parser_precise_mbclen();
+ if (!MBCLEN_CHARFOUND_P(len)) {
+ compile_error(PARSER_ARG "invalid multibyte char (%s)", parser_encoding_name());
+ return -1;
+ }
tokadd(c);
lex_p += --len;
if (len > 0) tokcopy(len);
@@ -6235,32 +6019,6 @@ simple_re_meta(int c)
}
static int
-parser_update_heredoc_indent(struct parser_params *parser, int c)
-{
- if (heredoc_line_indent == -1) {
- if (c == '\n') heredoc_line_indent = 0;
- }
- else {
- if (c == ' ') {
- heredoc_line_indent++;
- return TRUE;
- }
- else if (c == '\t') {
- int w = (heredoc_line_indent / TAB_WIDTH) + 1;
- heredoc_line_indent = w * TAB_WIDTH;
- return TRUE;
- }
- else if (c != '\n') {
- if (heredoc_indent > heredoc_line_indent) {
- heredoc_indent = heredoc_line_indent;
- }
- heredoc_line_indent = -1;
- }
- }
- return FALSE;
-}
-
-static int
parser_tokadd_string(struct parser_params *parser,
int func, int term, int paren, long *nest,
rb_encoding **encp)
@@ -6289,10 +6047,6 @@ parser_tokadd_string(struct parser_params *parser,
} while (0)
while ((c = nextc()) != -1) {
- if (heredoc_indent > 0) {
- parser_update_heredoc_indent(parser, c);
- }
-
if (paren && c == paren) {
++*nest;
}
@@ -6405,22 +6159,14 @@ parser_tokadd_string(struct parser_params *parser,
static void
ripper_flush_string_content(struct parser_params *parser, rb_encoding *enc)
{
- VALUE content = yylval.val;
- if (!ripper_is_node_yylval(content))
- content = ripper_new_yylval(0, 0, content);
- if (has_delayed_token()) {
+ if (!NIL_P(parser->delayed)) {
ptrdiff_t len = lex_p - parser->tokp;
if (len > 0) {
rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc);
}
- dispatch_delayed_token(tSTRING_CONTENT);
+ ripper_dispatch_delayed_token(parser, tSTRING_CONTENT);
parser->tokp = lex_p;
- RNODE(content)->nd_rval = yylval.val;
}
- dispatch_scan_event(tSTRING_CONTENT);
- if (yylval.val != content)
- RNODE(content)->nd_rval = yylval.val;
- yylval.val = content;
}
#define flush_string_content(enc) ripper_flush_string_content(parser, (enc))
@@ -6449,6 +6195,13 @@ const unsigned int ruby_global_name_punct_bits[] = {
#undef SPECIAL_PUNCT
#endif
+static inline int
+is_global_name_punct(const int c)
+{
+ if (c <= 0x20 || 0x7e < c) return 0;
+ return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
+}
+
static int
parser_peek_variable_name(struct parser_params *parser)
{
@@ -6507,7 +6260,6 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
}
if (!(func & STR_FUNC_REGEXP)) return tSTRING_END;
set_yylval_num(regx_options());
- dispatch_scan_event(tREGEXP_END);
return tREGEXP_END;
}
if (space) {
@@ -6524,14 +6276,16 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
pushback(c);
if (tokadd_string(func, term, paren, &quote->nd_nest,
&enc) == -1) {
- if (parser->eofp) {
- if (func & STR_FUNC_REGEXP) {
+ ruby_sourceline = nd_line(quote);
+ if (func & STR_FUNC_REGEXP) {
+ if (parser->eofp)
compile_error(PARSER_ARG "unterminated regexp meets end of file");
- }
- else {
+ return tREGEXP_END;
+ }
+ else {
+ if (parser->eofp)
compile_error(PARSER_ARG "unterminated string meets end of file");
- }
- quote->nd_func = -1;
+ return tSTRING_END;
}
}
@@ -6546,28 +6300,19 @@ static int
parser_heredoc_identifier(struct parser_params *parser)
{
int c = nextc(), term, func = 0;
- int token = tSTRING_BEG;
long len;
- int indent = 0;
if (c == '-') {
c = nextc();
func = STR_FUNC_INDENT;
}
- else if (c == '~') {
- c = nextc();
- func = STR_FUNC_INDENT;
- indent = INT_MAX;
- }
switch (c) {
case '\'':
func |= str_squote; goto quoted;
case '"':
func |= str_dquote; goto quoted;
case '`':
- token = tXSTRING_BEG;
- func |= str_xquote; goto quoted;
-
+ func |= str_xquote;
quoted:
newtok();
tokadd(func);
@@ -6585,11 +6330,12 @@ parser_heredoc_identifier(struct parser_params *parser)
if (!parser_is_identchar()) {
pushback(c);
if (func & STR_FUNC_INDENT) {
- pushback(indent > 0 ? '~' : '-');
+ pushback('-');
}
return 0;
}
newtok();
+ term = '"';
tokadd(func |= str_dquote);
do {
if (tokadd_mbchar(c) == -1) return 0;
@@ -6599,7 +6345,9 @@ parser_heredoc_identifier(struct parser_params *parser)
}
tokfix();
- dispatch_scan_event(tHEREDOC_BEG);
+#ifdef RIPPER
+ ripper_dispatch_scan_event(parser, tHEREDOC_BEG);
+#endif
len = lex_p - lex_pbeg;
lex_goto_eol(parser);
lex_strterm = rb_node_newnode(NODE_HEREDOC,
@@ -6608,9 +6356,7 @@ parser_heredoc_identifier(struct parser_params *parser)
lex_lastline); /* nd_orig */
nd_set_line(lex_strterm, ruby_sourceline);
ripper_flush(parser);
- heredoc_indent = indent;
- heredoc_line_indent = 0;
- return token;
+ return term == '`' ? tXSTRING_BEG : tSTRING_BEG;
}
static void
@@ -6632,114 +6378,6 @@ parser_heredoc_restore(struct parser_params *parser, NODE *here)
}
static int
-dedent_pos(const char *str, long len, int width)
-{
- int i, col = 0;
-
- for (i = 0; i < len && col < width; i++) {
- if (str[i] == ' ') {
- col++;
- }
- else if (str[i] == '\t') {
- int n = TAB_WIDTH * (col / TAB_WIDTH + 1);
- if (n > width) break;
- col = n;
- }
- else {
- break;
- }
- }
- return i;
-}
-
-#ifndef RIPPER
-static VALUE
-parser_heredoc_dedent_string(VALUE input, int width, int first)
-{
- long len;
- int col;
- char *str, *p, *out_p, *end, *t;
-
- RSTRING_GETMEM(input, str, len);
- end = &str[len];
-
- p = str;
- if (!first) {
- p = memchr(p, '\n', end - p);
- if (!p) return input;
- p++;
- }
- out_p = p;
- while (p < end) {
- col = dedent_pos(p, end - p, width);
- p += col;
- if (!(t = memchr(p, '\n', end - p)))
- t = end;
- else
- ++t;
- if (p > out_p) memmove(out_p, p, t - p);
- out_p += t - p;
- p = t;
- }
- rb_str_set_len(input, out_p - str);
-
- return input;
-}
-
-static void
-parser_heredoc_dedent(struct parser_params *parser, NODE *root)
-{
- NODE *node, *str_node;
- int first = TRUE;
- int indent = heredoc_indent;
-
- if (indent <= 0) return;
-
- node = str_node = root;
-
- while (str_node) {
- VALUE lit = str_node->nd_lit;
- if (NIL_P(parser_heredoc_dedent_string(lit, indent, first)))
- compile_error(PARSER_ARG "dedent failure: %d: %"PRIsVALUE, indent, lit);
- first = FALSE;
-
- str_node = 0;
- while ((node = node->nd_next) != 0 && nd_type(node) == NODE_ARRAY) {
- if ((str_node = node->nd_head) != 0) {
- enum node_type type = nd_type(str_node);
- if (type == NODE_STR || type == NODE_DSTR) break;
- }
- }
- }
-}
-#else /* RIPPER */
-static void
-parser_heredoc_dedent(struct parser_params *parser, VALUE array)
-{
- if (heredoc_indent <= 0) return;
-
- dispatch2(heredoc_dedent, array, INT2NUM(heredoc_indent));
-}
-
-static VALUE
-parser_dedent_string(VALUE self, VALUE input, VALUE width)
-{
- char *str;
- long len;
- int wid, col;
-
- StringValue(input);
- wid = NUM2UINT(width);
- rb_str_modify(input);
- RSTRING_GETMEM(input, str, len);
- col = dedent_pos(str, len, wid);
- MEMMOVE(str, str + col, char, len - col);
- rb_str_set_len(input, len - col);
- return INT2NUM(col);
-}
-#endif
-
-static int
parser_whole_match_p(struct parser_params *parser,
const char *eos, long len, int indent)
{
@@ -6786,14 +6424,6 @@ parser_number_literal_suffix(struct parser_params *parser, int mask)
return 0;
}
pushback(c);
- if (c == '.') {
- c = peekc_n(1);
- if (ISDIGIT(c)) {
- yyerror("unexpected fraction part after numeric literal");
- lex_p += 2;
- while (parser_is_identchar()) nextc();
- }
- }
break;
}
return result;
@@ -6825,13 +6455,10 @@ parser_set_integer_literal(struct parser_params *parser, VALUE v, int suffix)
static void
ripper_dispatch_heredoc_end(struct parser_params *parser)
{
- VALUE str;
- if (has_delayed_token())
- dispatch_delayed_token(tSTRING_CONTENT);
- str = STR_NEW(parser->tokp, lex_pend - parser->tokp);
- ripper_dispatch1(parser, ripper_token2eventid(tHEREDOC_END), str);
+ if (!NIL_P(parser->delayed))
+ ripper_dispatch_delayed_token(parser, tSTRING_CONTENT);
lex_goto_eol(parser);
- ripper_flush(parser);
+ ripper_dispatch_ignored_scan_event(parser, tHEREDOC_END);
}
#define dispatch_heredoc_end() ripper_dispatch_heredoc_end(parser)
@@ -6856,26 +6483,16 @@ parser_here_document(struct parser_params *parser, NODE *here)
error:
compile_error(PARSER_ARG "can't find string \"%s\" anywhere before EOF", eos);
#ifdef RIPPER
- if (!has_delayed_token()) {
- dispatch_scan_event(tSTRING_CONTENT);
+ if (NIL_P(parser->delayed)) {
+ ripper_dispatch_scan_event(parser, tSTRING_CONTENT);
}
else {
- if (str) {
+ if (str ||
+ ((len = lex_p - parser->tokp) > 0 &&
+ (str = STR_NEW3(parser->tokp, len, enc, func), 1))) {
rb_str_append(parser->delayed, str);
}
- else if ((len = lex_p - parser->tokp) > 0) {
- if (!(func & STR_FUNC_REGEXP) && rb_enc_asciicompat(enc)) {
- int cr = ENC_CODERANGE_UNKNOWN;
- rb_str_coderange_scan_restartable(parser->tokp, lex_p, enc, &cr);
- if (cr != ENC_CODERANGE_7BIT &&
- current_enc == rb_usascii_encoding() &&
- enc != rb_utf8_encoding()) {
- enc = rb_ascii8bit_encoding();
- }
- }
- rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc);
- }
- dispatch_delayed_token(tSTRING_CONTENT);
+ ripper_dispatch_delayed_token(parser, tSTRING_CONTENT);
}
lex_goto_eol(parser);
#endif
@@ -6890,15 +6507,7 @@ parser_here_document(struct parser_params *parser, NODE *here)
}
if (!(func & STR_FUNC_EXPAND)) {
- int end = 0;
do {
-#ifdef RIPPER
- if (end && heredoc_indent > 0) {
- set_yylval_str(str);
- flush_string_content(enc);
- return tSTRING_CONTENT;
- }
-#endif
p = RSTRING_PTR(lex_lastline);
pend = lex_pend;
if (pend > p) {
@@ -6912,14 +6521,6 @@ parser_here_document(struct parser_params *parser, NODE *here)
--pend;
}
}
-
- if (heredoc_indent > 0) {
- long i = 0;
- while (p + i < pend && parser_update_heredoc_indent(parser, p[i]))
- i++;
- heredoc_line_indent = 0;
- }
-
if (str)
rb_str_cat(str, p, pend - p);
else
@@ -6927,13 +6528,10 @@ parser_here_document(struct parser_params *parser, NODE *here)
if (pend < lex_pend) rb_str_cat(str, "\n", 1);
lex_goto_eol(parser);
if (nextc() == -1) {
- if (str) {
- dispose_string(str);
- str = 0;
- }
+ if (str) dispose_string(str);
goto error;
}
- } while (!(end = whole_match_p(eos, len, indent)));
+ } while (!whole_match_p(eos, len, indent));
}
else {
/* int mb = ENC_CODERANGE_7BIT, *mbp = &mb;*/
@@ -6951,30 +6549,17 @@ parser_here_document(struct parser_params *parser, NODE *here)
goto restore;
}
if (c != '\n') {
-#ifdef RIPPER
- flush:
-#endif
set_yylval_str(STR_NEW3(tok(), toklen(), enc, func));
flush_string_content(enc);
return tSTRING_CONTENT;
}
tokadd(nextc());
-#ifdef RIPPER
- if (c == '\n' && heredoc_indent > 0) {
- lex_goto_eol(parser);
- goto flush;
- }
-#endif
/* if (mbp && mb == ENC_CODERANGE_UNKNOWN) mbp = 0;*/
if ((c = nextc()) == -1) goto error;
} while (!whole_match_p(eos, len, indent));
str = STR_NEW3(tok(), toklen(), enc, func);
}
dispatch_heredoc_end();
-#ifdef RIPPER
- str = ripper_new_yylval(ripper_token2eventid(tSTRING_CONTENT),
- yylval.val, str);
-#endif
heredoc_restore(lex_strterm);
lex_strterm = NEW_STRTERM(-1, 0, 0);
set_yylval_str(str);
@@ -6984,45 +6569,23 @@ parser_here_document(struct parser_params *parser, NODE *here)
#include "lex.c"
static void
-arg_ambiguous_gen(struct parser_params *parser, char c)
+arg_ambiguous_gen(struct parser_params *parser)
{
#ifndef RIPPER
- rb_warning1("ambiguous first argument; put parentheses or a space even after `%c' operator", WARN_I(c));
+ rb_warning0("ambiguous first argument; put parentheses or even spaces");
#else
- dispatch1(arg_ambiguous, rb_usascii_str_new(&c, 1));
+ dispatch0(arg_ambiguous);
#endif
}
-#define arg_ambiguous(c) (arg_ambiguous_gen(parser, (c)), 1)
+#define arg_ambiguous() (arg_ambiguous_gen(parser), 1)
static ID
formal_argument_gen(struct parser_params *parser, ID lhs)
{
- switch (id_type(lhs)) {
- case ID_LOCAL:
- break;
#ifndef RIPPER
- case ID_CONST:
- yyerror("formal argument cannot be a constant");
- return 0;
- case ID_INSTANCE:
- yyerror("formal argument cannot be an instance variable");
- return 0;
- case ID_GLOBAL:
- yyerror("formal argument cannot be a global variable");
- return 0;
- case ID_CLASS:
- yyerror("formal argument cannot be a class variable");
- return 0;
- default:
+ if (!is_local_id(lhs))
yyerror("formal argument must be local variable");
- return 0;
-#else
- default:
- lhs = dispatch1(param_error, lhs);
- ripper_error();
- return 0;
#endif
- }
shadowing_lvar(lhs);
return lhs;
}
@@ -7066,7 +6629,7 @@ parser_set_encode(struct parser_params *parser, const char *name)
error:
excargs[0] = rb_eArgError;
excargs[2] = rb_make_backtrace();
- rb_ary_unshift(excargs[2], rb_sprintf("%"PRIsVALUE":%d", ruby_sourcefile_string, ruby_sourceline));
+ rb_ary_unshift(excargs[2], rb_sprintf("%s:%d", ruby_sourcefile, ruby_sourceline));
rb_exc_raise(rb_make_exception(3, excargs));
}
enc = rb_enc_from_index(idx);
@@ -7098,6 +6661,7 @@ comment_at_top(struct parser_params *parser)
return 1;
}
+#ifndef RIPPER
typedef long (*rb_magic_comment_length_t)(struct parser_params *parser, const char *name, long len);
typedef void (*rb_magic_comment_setter_t)(struct parser_params *parser, const char *name, const char *val);
@@ -7110,59 +6674,27 @@ magic_comment_encoding(struct parser_params *parser, const char *name, const cha
parser_set_encode(parser, val);
}
-static int
-parser_get_bool(struct parser_params *parser, const char *name, const char *val)
+static void
+parser_set_token_info(struct parser_params *parser, const char *name, const char *val)
{
+ int *p = &parser->parser_token_info_enabled;
+
switch (*val) {
case 't': case 'T':
if (strcasecmp(val, "true") == 0) {
- return TRUE;
+ *p = TRUE;
+ return;
}
break;
case 'f': case 'F':
if (strcasecmp(val, "false") == 0) {
- return FALSE;
+ *p = FALSE;
+ return;
}
break;
}
rb_compile_warning(ruby_sourcefile, ruby_sourceline, "invalid value for %s: %s", name, val);
- return -1;
-}
-
-static void
-parser_set_token_info(struct parser_params *parser, const char *name, const char *val)
-{
- int b = parser_get_bool(parser, name, val);
- if (b >= 0) parser->token_info_enabled = b;
-}
-
-static void
-parser_set_compile_option_flag(struct parser_params *parser, const char *name, const char *val)
-{
- int b;
-
- if (parser->token_seen) {
- rb_warning1("`%s' is ignored after any tokens", WARN_S(name));
- return;
- }
-
- b = parser_get_bool(parser, name, val);
- if (b < 0) return;
-
- if (!parser->compile_option)
- parser->compile_option = rb_ident_hash_new();
- rb_hash_aset(parser->compile_option, ID2SYM(rb_intern(name)),
- (b ? Qtrue : Qfalse));
-}
-
-# if WARN_PAST_SCOPE
-static void
-parser_set_past_scope(struct parser_params *parser, const char *name, const char *val)
-{
- int b = parser_get_bool(parser, name, val);
- if (b >= 0) parser->past_scope_enabled = b;
}
-# endif
struct magic_comment {
const char *name;
@@ -7173,12 +6705,9 @@ struct magic_comment {
static const struct magic_comment magic_comments[] = {
{"coding", magic_comment_encoding, parser_encode_length},
{"encoding", magic_comment_encoding, parser_encode_length},
- {"frozen_string_literal", parser_set_compile_option_flag},
{"warn_indent", parser_set_token_info},
-# if WARN_PAST_SCOPE
- {"warn_past_scope", parser_set_past_scope},
-# endif
};
+#endif
static const char *
magic_comment_marker(const char *str, long len)
@@ -7216,7 +6745,6 @@ magic_comment_marker(const char *str, long len)
static int
parser_magic_comment(struct parser_params *parser, const char *str, long len)
{
- int indicator = 0;
VALUE name = 0, val = 0;
const char *beg, *end, *vbeg, *vend;
#define str_copy(_s, _p, _n) ((_s) \
@@ -7225,17 +6753,16 @@ parser_magic_comment(struct parser_params *parser, const char *str, long len)
: (void)((_s) = STR_NEW((_p), (_n))))
if (len <= 7) return FALSE;
- if (!!(beg = magic_comment_marker(str, len))) {
- if (!(end = magic_comment_marker(beg, str + len - beg)))
- return FALSE;
- indicator = TRUE;
- str = beg;
- len = end - beg - 3;
- }
+ if (!(beg = magic_comment_marker(str, len))) return FALSE;
+ if (!(end = magic_comment_marker(beg, str + len - beg))) return FALSE;
+ str = beg;
+ len = end - beg - 3;
/* %r"([^\\s\'\":;]+)\\s*:\\s*(\"(?:\\\\.|[^\"])*\"|[^\"\\s;]+)[\\s;]*" */
while (len > 0) {
+#ifndef RIPPER
const struct magic_comment *p = magic_comments;
+#endif
char *s;
int i;
long n = 0;
@@ -7259,10 +6786,7 @@ parser_magic_comment(struct parser_params *parser, const char *str, long len)
}
for (end = str; len > 0 && ISSPACE(*str); str++, --len);
if (!len) break;
- if (*str != ':') {
- if (!indicator) return FALSE;
- continue;
- }
+ if (*str != ':') continue;
do str++; while (--len > 0 && ISSPACE(*str));
if (!len) break;
@@ -7283,13 +6807,7 @@ parser_magic_comment(struct parser_params *parser, const char *str, long len)
for (vbeg = str; len > 0 && *str != '"' && *str != ';' && !ISSPACE(*str); --len, str++);
vend = str;
}
- if (indicator) {
- while (len > 0 && (*str == ';' || ISSPACE(*str))) --len, str++;
- }
- else {
- while (len > 0 && (ISSPACE(*str))) --len, str++;
- if (len) return FALSE;
- }
+ while (len > 0 && (*str == ';' || ISSPACE(*str))) --len, str++;
n = end - beg;
str_copy(name, beg, n);
@@ -7297,18 +6815,19 @@ parser_magic_comment(struct parser_params *parser, const char *str, long len)
for (i = 0; i < n; ++i) {
if (s[i] == '-') s[i] = '_';
}
+#ifndef RIPPER
do {
- if (STRNCASECMP(p->name, s, n) == 0 && !p->name[n]) {
+ if (STRNCASECMP(p->name, s, n) == 0) {
n = vend - vbeg;
if (p->length) {
n = (*p->length)(parser, vbeg, n);
}
str_copy(val, vbeg, n);
- (*p->func)(parser, p->name, RSTRING_PTR(val));
+ (*p->func)(parser, s, RSTRING_PTR(val));
break;
}
} while (++p < magic_comments + numberof(magic_comments));
-#ifdef RIPPER
+#else
str_copy(val, vbeg, vend - vbeg);
dispatch2(magic_comment, name, val);
#endif
@@ -7383,17 +6902,13 @@ parser_prepare(struct parser_params *parser)
}
pushback(c);
parser->enc = rb_enc_get(lex_lastline);
- deferred_nodes = 0;
- parser->token_info_enabled = !compile_for_eval && RTEST(ruby_verbose);
}
#define IS_ARG() IS_lex_state(EXPR_ARG_ANY)
#define IS_END() IS_lex_state(EXPR_END_ANY)
-#define IS_BEG() (IS_lex_state(EXPR_BEG_ANY) || IS_lex_state_all(EXPR_ARG|EXPR_LABELED))
+#define IS_BEG() IS_lex_state(EXPR_BEG_ANY)
#define IS_SPCARG(c) (IS_ARG() && space_seen && !ISSPACE(c))
-#define IS_LABEL_POSSIBLE() (\
- (IS_lex_state(EXPR_LABEL|EXPR_ENDFN) && !cmd_state) || \
- IS_ARG())
+#define IS_LABEL_POSSIBLE() ((IS_lex_state(EXPR_BEG | EXPR_ENDFN) && !cmd_state) || IS_ARG())
#define IS_LABEL_SUFFIX(n) (peek_n(':',(n)) && !peek_n(':', (n)+1))
#define IS_AFTER_OPERATOR() IS_lex_state(EXPR_FNAME | EXPR_DOT)
@@ -7409,743 +6924,18 @@ parser_prepare(struct parser_params *parser)
space_seen && !ISSPACE(c) && \
(ambiguous_operator(op, syn), 0)))
-static VALUE
-parse_rational(struct parser_params *parser, char *str, int len, int seen_point)
-{
- VALUE v;
- char *point = &str[seen_point];
- size_t fraclen = len-seen_point-1;
- memmove(point, point+1, fraclen+1);
- v = rb_cstr_to_inum(str, 10, FALSE);
- return rb_rational_new(v, rb_int_positive_pow(10, fraclen));
-}
-
-static int
-parse_numeric(struct parser_params *parser, int c)
-{
- int is_float, seen_point, seen_e, nondigit;
- int suffix;
-
- is_float = seen_point = seen_e = nondigit = 0;
- SET_LEX_STATE(EXPR_END);
- newtok();
- if (c == '-' || c == '+') {
- tokadd(c);
- c = nextc();
- }
- if (c == '0') {
-#define no_digits() do {yyerror("numeric literal without digits"); return 0;} while (0)
- int start = toklen();
- c = nextc();
- if (c == 'x' || c == 'X') {
- /* hexadecimal */
- c = nextc();
- if (c != -1 && ISXDIGIT(c)) {
- do {
- if (c == '_') {
- if (nondigit) break;
- nondigit = c;
- continue;
- }
- if (!ISXDIGIT(c)) break;
- nondigit = 0;
- tokadd(c);
- } while ((c = nextc()) != -1);
- }
- pushback(c);
- tokfix();
- if (toklen() == start) {
- no_digits();
- }
- else if (nondigit) goto trailing_uc;
- suffix = number_literal_suffix(NUM_SUFFIX_ALL);
- return set_integer_literal(rb_cstr_to_inum(tok(), 16, FALSE), suffix);
- }
- if (c == 'b' || c == 'B') {
- /* binary */
- c = nextc();
- if (c == '0' || c == '1') {
- do {
- if (c == '_') {
- if (nondigit) break;
- nondigit = c;
- continue;
- }
- if (c != '0' && c != '1') break;
- nondigit = 0;
- tokadd(c);
- } while ((c = nextc()) != -1);
- }
- pushback(c);
- tokfix();
- if (toklen() == start) {
- no_digits();
- }
- else if (nondigit) goto trailing_uc;
- suffix = number_literal_suffix(NUM_SUFFIX_ALL);
- return set_integer_literal(rb_cstr_to_inum(tok(), 2, FALSE), suffix);
- }
- if (c == 'd' || c == 'D') {
- /* decimal */
- c = nextc();
- if (c != -1 && ISDIGIT(c)) {
- do {
- if (c == '_') {
- if (nondigit) break;
- nondigit = c;
- continue;
- }
- if (!ISDIGIT(c)) break;
- nondigit = 0;
- tokadd(c);
- } while ((c = nextc()) != -1);
- }
- pushback(c);
- tokfix();
- if (toklen() == start) {
- no_digits();
- }
- else if (nondigit) goto trailing_uc;
- suffix = number_literal_suffix(NUM_SUFFIX_ALL);
- return set_integer_literal(rb_cstr_to_inum(tok(), 10, FALSE), suffix);
- }
- if (c == '_') {
- /* 0_0 */
- goto octal_number;
- }
- if (c == 'o' || c == 'O') {
- /* prefixed octal */
- c = nextc();
- if (c == -1 || c == '_' || !ISDIGIT(c)) {
- no_digits();
- }
- }
- if (c >= '0' && c <= '7') {
- /* octal */
- octal_number:
- do {
- if (c == '_') {
- if (nondigit) break;
- nondigit = c;
- continue;
- }
- if (c < '0' || c > '9') break;
- if (c > '7') goto invalid_octal;
- nondigit = 0;
- tokadd(c);
- } while ((c = nextc()) != -1);
- if (toklen() > start) {
- pushback(c);
- tokfix();
- if (nondigit) goto trailing_uc;
- suffix = number_literal_suffix(NUM_SUFFIX_ALL);
- return set_integer_literal(rb_cstr_to_inum(tok(), 8, FALSE), suffix);
- }
- if (nondigit) {
- pushback(c);
- goto trailing_uc;
- }
- }
- if (c > '7' && c <= '9') {
- invalid_octal:
- yyerror("Invalid octal digit");
- }
- else if (c == '.' || c == 'e' || c == 'E') {
- tokadd('0');
- }
- else {
- pushback(c);
- suffix = number_literal_suffix(NUM_SUFFIX_ALL);
- return set_integer_literal(INT2FIX(0), suffix);
- }
- }
-
- for (;;) {
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- nondigit = 0;
- tokadd(c);
- break;
-
- case '.':
- if (nondigit) goto trailing_uc;
- if (seen_point || seen_e) {
- goto decode_num;
- }
- else {
- int c0 = nextc();
- if (c0 == -1 || !ISDIGIT(c0)) {
- pushback(c0);
- goto decode_num;
- }
- c = c0;
- }
- seen_point = toklen();
- tokadd('.');
- tokadd(c);
- is_float++;
- nondigit = 0;
- break;
-
- case 'e':
- case 'E':
- if (nondigit) {
- pushback(c);
- c = nondigit;
- goto decode_num;
- }
- if (seen_e) {
- goto decode_num;
- }
- nondigit = c;
- c = nextc();
- if (c != '-' && c != '+' && !ISDIGIT(c)) {
- pushback(c);
- nondigit = 0;
- goto decode_num;
- }
- tokadd(nondigit);
- seen_e++;
- is_float++;
- tokadd(c);
- nondigit = (c == '-' || c == '+') ? c : 0;
- break;
-
- case '_': /* `_' in number just ignored */
- if (nondigit) goto decode_num;
- nondigit = c;
- break;
-
- default:
- goto decode_num;
- }
- c = nextc();
- }
-
- decode_num:
- pushback(c);
- if (nondigit) {
- char tmp[30];
- trailing_uc:
- snprintf(tmp, sizeof(tmp), "trailing `%c' in number", nondigit);
- yyerror(tmp);
- }
- tokfix();
- if (is_float) {
- int type = tFLOAT;
- VALUE v;
-
- suffix = number_literal_suffix(seen_e ? NUM_SUFFIX_I : NUM_SUFFIX_ALL);
- if (suffix & NUM_SUFFIX_R) {
- type = tRATIONAL;
- v = parse_rational(parser, tok(), toklen(), seen_point);
- }
- else {
- double d = strtod(tok(), 0);
- if (errno == ERANGE) {
- rb_warning1("Float %s out of range", WARN_S(tok()));
- errno = 0;
- }
- v = DBL2NUM(d);
- }
- return set_number_literal(v, type, suffix);
- }
- suffix = number_literal_suffix(NUM_SUFFIX_ALL);
- return set_integer_literal(rb_cstr_to_inum(tok(), 10, FALSE), suffix);
-}
-
-static int
-parse_qmark(struct parser_params *parser)
-{
- rb_encoding *enc;
- register int c;
-
- if (IS_END()) {
- SET_LEX_STATE(EXPR_VALUE);
- return '?';
- }
- c = nextc();
- if (c == -1) {
- compile_error(PARSER_ARG "incomplete character syntax");
- return 0;
- }
- if (rb_enc_isspace(c, current_enc)) {
- if (!IS_ARG()) {
- int c2 = 0;
- switch (c) {
- case ' ':
- c2 = 's';
- break;
- case '\n':
- c2 = 'n';
- break;
- case '\t':
- c2 = 't';
- break;
- case '\v':
- c2 = 'v';
- break;
- case '\r':
- c2 = 'r';
- break;
- case '\f':
- c2 = 'f';
- break;
- }
- if (c2) {
- rb_warn1("invalid character syntax; use ?\\%c", WARN_I(c2));
- }
- }
- ternary:
- pushback(c);
- SET_LEX_STATE(EXPR_VALUE);
- return '?';
- }
- newtok();
- enc = current_enc;
- if (!parser_isascii()) {
- if (tokadd_mbchar(c) == -1) return 0;
- }
- else if ((rb_enc_isalnum(c, current_enc) || c == '_') &&
- lex_p < lex_pend && is_identchar(lex_p, lex_pend, current_enc)) {
- goto ternary;
- }
- else if (c == '\\') {
- if (peek('u')) {
- nextc();
- c = parser_tokadd_utf8(parser, &enc, 0, 0, 0);
- if (0x80 <= c) {
- tokaddmbc(c, enc);
- }
- else {
- tokadd(c);
- }
- }
- else if (!lex_eol_p() && !(c = *lex_p, ISASCII(c))) {
- nextc();
- if (tokadd_mbchar(c) == -1) return 0;
- }
- else {
- c = read_escape(0, &enc);
- tokadd(c);
- }
- }
- else {
- tokadd(c);
- }
- tokfix();
- set_yylval_str(STR_NEW3(tok(), toklen(), enc, 0));
- SET_LEX_STATE(EXPR_END);
- return tCHAR;
-}
-
-static int
-parse_percent(struct parser_params *parser, const int space_seen, const enum lex_state_e last_state)
-{
- register int c;
-
- if (IS_BEG()) {
- int term;
- int paren;
-
- c = nextc();
- quotation:
- if (c == -1 || !ISALNUM(c)) {
- term = c;
- c = 'Q';
- }
- else {
- term = nextc();
- if (rb_enc_isalnum(term, current_enc) || !parser_isascii()) {
- yyerror("unknown type of %string");
- return 0;
- }
- }
- if (c == -1 || term == -1) {
- compile_error(PARSER_ARG "unterminated quoted string meets end of file");
- return 0;
- }
- paren = term;
- if (term == '(') term = ')';
- else if (term == '[') term = ']';
- else if (term == '{') term = '}';
- else if (term == '<') term = '>';
- else paren = 0;
-
- switch (c) {
- case 'Q':
- lex_strterm = NEW_STRTERM(str_dquote, term, paren);
- return tSTRING_BEG;
-
- case 'q':
- lex_strterm = NEW_STRTERM(str_squote, term, paren);
- return tSTRING_BEG;
-
- case 'W':
- lex_strterm = NEW_STRTERM(str_dword, term, paren);
- do {c = nextc();} while (ISSPACE(c));
- pushback(c);
- return tWORDS_BEG;
-
- case 'w':
- lex_strterm = NEW_STRTERM(str_sword, term, paren);
- do {c = nextc();} while (ISSPACE(c));
- pushback(c);
- return tQWORDS_BEG;
-
- case 'I':
- lex_strterm = NEW_STRTERM(str_dword, term, paren);
- do {c = nextc();} while (ISSPACE(c));
- pushback(c);
- return tSYMBOLS_BEG;
-
- case 'i':
- lex_strterm = NEW_STRTERM(str_sword, term, paren);
- do {c = nextc();} while (ISSPACE(c));
- pushback(c);
- return tQSYMBOLS_BEG;
-
- case 'x':
- lex_strterm = NEW_STRTERM(str_xquote, term, paren);
- return tXSTRING_BEG;
-
- case 'r':
- lex_strterm = NEW_STRTERM(str_regexp, term, paren);
- return tREGEXP_BEG;
-
- case 's':
- lex_strterm = NEW_STRTERM(str_ssym, term, paren);
- SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);
- return tSYMBEG;
-
- default:
- yyerror("unknown type of %string");
- return 0;
- }
- }
- if ((c = nextc()) == '=') {
- set_yylval_id('%');
- SET_LEX_STATE(EXPR_BEG);
- return tOP_ASGN;
- }
- if (IS_SPCARG(c) || (IS_lex_state(EXPR_FITEM) && c == 's')) {
- goto quotation;
- }
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
- pushback(c);
- warn_balanced("%%", "string literal");
- return '%';
-}
-
-static int
-tokadd_ident(struct parser_params *parser, int c)
-{
- do {
- if (tokadd_mbchar(c) == -1) return -1;
- c = nextc();
- } while (parser_is_identchar());
- pushback(c);
- return 0;
-}
-
-static ID
-tokenize_ident(struct parser_params *parser, const enum lex_state_e last_state)
-{
- ID ident = TOK_INTERN();
-
- set_yylval_name(ident);
-
- return ident;
-}
-
-static int
-parse_numvar(struct parser_params *parser)
-{
- size_t len;
- int overflow;
- unsigned long n = ruby_scan_digits(tok()+1, toklen()-1, 10, &len, &overflow);
- const unsigned long nth_ref_max =
- ((FIXNUM_MAX < INT_MAX) ? FIXNUM_MAX : INT_MAX) >> 1;
- /* NTH_REF is left-shifted to be ORed with back-ref flag and
- * turned into a Fixnum, in compile.c */
-
- if (overflow || n > nth_ref_max) {
- /* compile_error()? */
- rb_warn1("`%s' is too big for a number variable, always nil", WARN_S(tok()));
- return 0; /* $0 is $PROGRAM_NAME, not NTH_REF */
- }
- else {
- return (int)n;
- }
-}
-
-static int
-parse_gvar(struct parser_params *parser, const enum lex_state_e last_state)
-{
- register int c;
-
- SET_LEX_STATE(EXPR_END);
- newtok();
- c = nextc();
- switch (c) {
- case '_': /* $_: last read line string */
- c = nextc();
- if (parser_is_identchar()) {
- tokadd('$');
- tokadd('_');
- break;
- }
- pushback(c);
- c = '_';
- /* fall through */
- case '~': /* $~: match-data */
- case '*': /* $*: argv */
- case '$': /* $$: pid */
- case '?': /* $?: last status */
- case '!': /* $!: error string */
- case '@': /* $@: error position */
- case '/': /* $/: input record separator */
- case '\\': /* $\: output record separator */
- case ';': /* $;: field separator */
- case ',': /* $,: output field separator */
- case '.': /* $.: last read line number */
- case '=': /* $=: ignorecase */
- case ':': /* $:: load path */
- case '<': /* $<: reading filename */
- case '>': /* $>: default output handle */
- case '\"': /* $": already loaded files */
- tokadd('$');
- tokadd(c);
- goto gvar;
-
- case '-':
- tokadd('$');
- tokadd(c);
- c = nextc();
- if (parser_is_identchar()) {
- if (tokadd_mbchar(c) == -1) return 0;
- }
- else {
- pushback(c);
- pushback('-');
- return '$';
- }
- gvar:
- set_yylval_name(TOK_INTERN());
- return tGVAR;
-
- case '&': /* $&: last match */
- case '`': /* $`: string before last match */
- case '\'': /* $': string after last match */
- case '+': /* $+: string matches last paren. */
- if (IS_lex_state_for(last_state, EXPR_FNAME)) {
- tokadd('$');
- tokadd(c);
- goto gvar;
- }
- set_yylval_node(NEW_BACK_REF(c));
- return tBACK_REF;
-
- case '1': case '2': case '3':
- case '4': case '5': case '6':
- case '7': case '8': case '9':
- tokadd('$');
- do {
- tokadd(c);
- c = nextc();
- } while (c != -1 && ISDIGIT(c));
- pushback(c);
- if (IS_lex_state_for(last_state, EXPR_FNAME)) goto gvar;
- tokfix();
- set_yylval_node(NEW_NTH_REF(parse_numvar(parser)));
- return tNTH_REF;
-
- default:
- if (!parser_is_identchar()) {
- if (c == -1 || ISSPACE(c)) {
- compile_error(PARSER_ARG "`$' without identifiers is not allowed as a global variable name");
- }
- else {
- pushback(c);
- compile_error(PARSER_ARG "`$%c' is not allowed as a global variable name", c);
- }
- return 0;
- }
- case '0':
- tokadd('$');
- }
-
- if (tokadd_ident(parser, c)) return 0;
- SET_LEX_STATE(EXPR_END);
- tokenize_ident(parser, last_state);
- return tGVAR;
-}
-
-static int
-parse_atmark(struct parser_params *parser, const enum lex_state_e last_state)
-{
- int result = tIVAR;
- register int c = nextc();
-
- newtok();
- tokadd('@');
- if (c == '@') {
- result = tCVAR;
- tokadd('@');
- c = nextc();
- }
- if (c == -1 || ISSPACE(c)) {
- if (result == tIVAR) {
- compile_error(PARSER_ARG "`@' without identifiers is not allowed as an instance variable name");
- }
- else {
- compile_error(PARSER_ARG "`@@' without identifiers is not allowed as a class variable name");
- }
- return 0;
- }
- else if (ISDIGIT(c) || !parser_is_identchar()) {
- pushback(c);
- if (result == tIVAR) {
- compile_error(PARSER_ARG "`@%c' is not allowed as an instance variable name", c);
- }
- else {
- compile_error(PARSER_ARG "`@@%c' is not allowed as a class variable name", c);
- }
- return 0;
- }
-
- if (tokadd_ident(parser, c)) return 0;
- SET_LEX_STATE(EXPR_END);
- tokenize_ident(parser, last_state);
- return result;
-}
-
-static int
-parse_ident(struct parser_params *parser, int c, int cmd_state)
-{
- int result = 0;
- int mb = ENC_CODERANGE_7BIT;
- const enum lex_state_e last_state = lex_state;
- ID ident;
-
- do {
- if (!ISASCII(c)) mb = ENC_CODERANGE_UNKNOWN;
- if (tokadd_mbchar(c) == -1) return 0;
- c = nextc();
- } while (parser_is_identchar());
- if ((c == '!' || c == '?') && !peek('=')) {
- tokadd(c);
- }
- else {
- pushback(c);
- }
- tokfix();
-
- if (toklast() == '!' || toklast() == '?') {
- result = tFID;
- }
- else {
- if (IS_lex_state(EXPR_FNAME)) {
- register int c = nextc();
- if (c == '=' && !peek('~') && !peek('>') &&
- (!peek('=') || (peek_n('>', 1)))) {
- result = tIDENTIFIER;
- tokadd(c);
- tokfix();
- }
- else {
- pushback(c);
- }
- }
- if (result == 0 && ISUPPER(tok()[0])) {
- result = tCONSTANT;
- }
- else {
- result = tIDENTIFIER;
- }
- }
-
- if (IS_LABEL_POSSIBLE()) {
- if (IS_LABEL_SUFFIX(0)) {
- SET_LEX_STATE(EXPR_ARG|EXPR_LABELED);
- nextc();
- set_yylval_name(TOK_INTERN());
- return tLABEL;
- }
- }
- if (mb == ENC_CODERANGE_7BIT && !IS_lex_state(EXPR_DOT)) {
- const struct kwtable *kw;
-
- /* See if it is a reserved word. */
- kw = rb_reserved_word(tok(), toklen());
- if (kw) {
- enum lex_state_e state = lex_state;
- SET_LEX_STATE(kw->state);
- if (IS_lex_state_for(state, EXPR_FNAME)) {
- set_yylval_name(rb_intern2(tok(), toklen()));
- return kw->id[0];
- }
- if (IS_lex_state(EXPR_BEG)) {
- command_start = TRUE;
- }
- if (kw->id[0] == keyword_do) {
- if (lpar_beg && lpar_beg == paren_nest) {
- lpar_beg = 0;
- --paren_nest;
- return keyword_do_LAMBDA;
- }
- if (COND_P()) return keyword_do_cond;
- if (CMDARG_P() && !IS_lex_state_for(state, EXPR_CMDARG))
- return keyword_do_block;
- if (IS_lex_state_for(state, (EXPR_BEG | EXPR_ENDARG)))
- return keyword_do_block;
- return keyword_do;
- }
- if (IS_lex_state_for(state, (EXPR_BEG | EXPR_LABELED)))
- return kw->id[0];
- else {
- if (kw->id[0] != kw->id[1])
- SET_LEX_STATE(EXPR_BEG | EXPR_LABEL);
- return kw->id[1];
- }
- }
- }
-
- if (IS_lex_state(EXPR_BEG_ANY | EXPR_ARG_ANY | EXPR_DOT)) {
- if (cmd_state) {
- SET_LEX_STATE(EXPR_CMDARG);
- }
- else {
- SET_LEX_STATE(EXPR_ARG);
- }
- }
- else if (lex_state == EXPR_FNAME) {
- SET_LEX_STATE(EXPR_ENDFN);
- }
- else {
- SET_LEX_STATE(EXPR_END);
- }
-
- ident = tokenize_ident(parser, last_state);
- if (!IS_lex_state_for(last_state, EXPR_DOT|EXPR_FNAME) &&
- (result == tIDENTIFIER) && /* not EXPR_FNAME, not attrasgn */
- lvar_defined(ident)) {
- SET_LEX_STATE(EXPR_END|EXPR_LABEL);
- }
- return result;
-}
-
static int
parser_yylex(struct parser_params *parser)
{
register int c;
int space_seen = 0;
int cmd_state;
- int label;
enum lex_state_e last_state;
+ rb_encoding *enc;
+ int mb;
+#ifdef RIPPER
int fallthru = FALSE;
- int token_seen = parser->token_seen;
+#endif
if (lex_strterm) {
int token;
@@ -8153,29 +6943,21 @@ parser_yylex(struct parser_params *parser)
token = here_document(lex_strterm);
if (token == tSTRING_END) {
lex_strterm = 0;
- SET_LEX_STATE(EXPR_END);
+ lex_state = EXPR_END;
}
}
else {
token = parse_string(lex_strterm);
- if ((token == tSTRING_END) && (lex_strterm->nd_func & STR_FUNC_LABEL)) {
- if (((IS_lex_state(EXPR_BEG | EXPR_ENDFN) && !COND_P()) || IS_ARG()) &&
- IS_LABEL_SUFFIX(0)) {
- nextc();
- token = tLABEL_END;
- }
- }
- if (token == tSTRING_END || token == tREGEXP_END || token == tLABEL_END) {
+ if (token == tSTRING_END || token == tREGEXP_END) {
rb_gc_force_recycle((VALUE)lex_strterm);
lex_strterm = 0;
- SET_LEX_STATE(token == tLABEL_END ? EXPR_BEG|EXPR_LABEL : EXPR_END);
+ lex_state = EXPR_END;
}
}
return token;
}
cmd_state = command_start;
command_start = FALSE;
- parser->token_seen = TRUE;
retry:
last_state = lex_state;
switch (c = nextc()) {
@@ -8201,12 +6983,11 @@ parser_yylex(struct parser_params *parser)
}
outofloop:
pushback(c);
- dispatch_scan_event(tSP);
+ ripper_dispatch_scan_event(parser, tSP);
#endif
goto retry;
case '#': /* it's a comment */
- parser->token_seen = token_seen;
/* no magic_comment in shebang line */
if (!parser_magic_comment(parser, lex_p, lex_pend - lex_p)) {
if (comment_at_top(parser)) {
@@ -8214,21 +6995,19 @@ parser_yylex(struct parser_params *parser)
}
}
lex_p = lex_pend;
- dispatch_scan_event(tCOMMENT);
+#ifdef RIPPER
+ ripper_dispatch_scan_event(parser, tCOMMENT);
fallthru = TRUE;
+#endif
/* fall through */
case '\n':
- parser->token_seen = token_seen;
- c = (IS_lex_state(EXPR_BEG|EXPR_CLASS|EXPR_FNAME|EXPR_DOT) &&
- !IS_lex_state(EXPR_LABELED));
- if (c || IS_lex_state_all(EXPR_ARG|EXPR_LABELED)) {
+ if (IS_lex_state(EXPR_BEG | EXPR_VALUE | EXPR_CLASS | EXPR_FNAME | EXPR_DOT)) {
+#ifdef RIPPER
if (!fallthru) {
- dispatch_scan_event(tIGNORED_NL);
+ ripper_dispatch_scan_event(parser, tIGNORED_NL);
}
fallthru = FALSE;
- if (!c && parser->in_kwarg) {
- goto normal_newline;
- }
+#endif
goto retry;
}
while ((c = nextc())) {
@@ -8237,14 +7016,12 @@ parser_yylex(struct parser_params *parser)
case '\13': /* '\v' */
space_seen = 1;
break;
- case '&':
case '.': {
- dispatch_delayed_token(tIGNORED_NL);
- if (peek('.') == (c == '&')) {
- pushback(c);
- dispatch_scan_event(tSP);
- goto retry;
- }
+ if ((c = nextc()) != '.') {
+ pushback(c);
+ pushback('.');
+ goto retry;
+ }
}
default:
--ruby_sourceline;
@@ -8261,14 +7038,14 @@ parser_yylex(struct parser_params *parser)
}
normal_newline:
command_start = TRUE;
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return '\n';
case '*':
if ((c = nextc()) == '*') {
if ((c = nextc()) == '=') {
set_yylval_id(tPOW);
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -8287,7 +7064,7 @@ parser_yylex(struct parser_params *parser)
else {
if (c == '=') {
set_yylval_id('*');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -8303,19 +7080,19 @@ parser_yylex(struct parser_params *parser)
c = '*';
}
}
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
return c;
case '!':
c = nextc();
if (IS_AFTER_OPERATOR()) {
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
if (c == '@') {
return '!';
}
}
else {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
}
if (c == '=') {
return tNEQ;
@@ -8330,34 +7107,40 @@ parser_yylex(struct parser_params *parser)
if (was_bol()) {
/* skip embedded rd document */
if (strncmp(lex_p, "begin", 5) == 0 && ISSPACE(lex_p[5])) {
- int first_p = TRUE;
+#ifdef RIPPER
+ int first_p = TRUE;
- lex_goto_eol(parser);
- dispatch_scan_event(tEMBDOC_BEG);
+ lex_goto_eol(parser);
+ ripper_dispatch_scan_event(parser, tEMBDOC_BEG);
+#endif
for (;;) {
lex_goto_eol(parser);
- if (!first_p) {
- dispatch_scan_event(tEMBDOC);
- }
- first_p = FALSE;
+#ifdef RIPPER
+ if (!first_p) {
+ ripper_dispatch_scan_event(parser, tEMBDOC);
+ }
+ first_p = FALSE;
+#endif
c = nextc();
if (c == -1) {
compile_error(PARSER_ARG "embedded document meets end of file");
return 0;
}
if (c != '=') continue;
- if (c == '=' && strncmp(lex_p, "end", 3) == 0 &&
+ if (strncmp(lex_p, "end", 3) == 0 &&
(lex_p + 3 == lex_pend || ISSPACE(lex_p[3]))) {
break;
}
}
lex_goto_eol(parser);
- dispatch_scan_event(tEMBDOC_END);
+#ifdef RIPPER
+ ripper_dispatch_scan_event(parser, tEMBDOC_END);
+#endif
goto retry;
}
}
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
if ((c = nextc()) == '=') {
if ((c = nextc()) == '=') {
return tEQQ;
@@ -8380,17 +7163,17 @@ parser_yylex(struct parser_params *parser)
if (c == '<' &&
!IS_lex_state(EXPR_DOT | EXPR_CLASS) &&
!IS_END() &&
- (!IS_ARG() || IS_lex_state(EXPR_LABELED) || space_seen)) {
+ (!IS_ARG() || space_seen)) {
int token = heredoc_identifier();
if (token) return token;
}
if (IS_AFTER_OPERATOR()) {
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
}
else {
if (IS_lex_state(EXPR_CLASS))
command_start = TRUE;
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
}
if (c == '=') {
if ((c = nextc()) == '>') {
@@ -8402,7 +7185,7 @@ parser_yylex(struct parser_params *parser)
if (c == '<') {
if ((c = nextc()) == '=') {
set_yylval_id(tLSHFT);
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -8413,14 +7196,14 @@ parser_yylex(struct parser_params *parser)
return '<';
case '>':
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
if ((c = nextc()) == '=') {
return tGEQ;
}
if (c == '>') {
if ((c = nextc()) == '=') {
set_yylval_id(tRSHFT);
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -8430,39 +7213,113 @@ parser_yylex(struct parser_params *parser)
return '>';
case '"':
- label = (IS_LABEL_POSSIBLE() ? str_label : 0);
- lex_strterm = NEW_STRTERM(str_dquote | label, '"', 0);
+ lex_strterm = NEW_STRTERM(str_dquote, '"', 0);
return tSTRING_BEG;
case '`':
if (IS_lex_state(EXPR_FNAME)) {
- SET_LEX_STATE(EXPR_ENDFN);
+ lex_state = EXPR_ENDFN;
return c;
}
if (IS_lex_state(EXPR_DOT)) {
if (cmd_state)
- SET_LEX_STATE(EXPR_CMDARG);
+ lex_state = EXPR_CMDARG;
else
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
return c;
}
lex_strterm = NEW_STRTERM(str_xquote, '`', 0);
return tXSTRING_BEG;
case '\'':
- label = (IS_LABEL_POSSIBLE() ? str_label : 0);
- lex_strterm = NEW_STRTERM(str_squote | label, '\'', 0);
+ lex_strterm = NEW_STRTERM(str_squote, '\'', 0);
return tSTRING_BEG;
case '?':
- return parse_qmark(parser);
+ if (IS_END()) {
+ lex_state = EXPR_VALUE;
+ return '?';
+ }
+ c = nextc();
+ if (c == -1) {
+ compile_error(PARSER_ARG "incomplete character syntax");
+ return 0;
+ }
+ if (rb_enc_isspace(c, current_enc)) {
+ if (!IS_ARG()) {
+ int c2 = 0;
+ switch (c) {
+ case ' ':
+ c2 = 's';
+ break;
+ case '\n':
+ c2 = 'n';
+ break;
+ case '\t':
+ c2 = 't';
+ break;
+ case '\v':
+ c2 = 'v';
+ break;
+ case '\r':
+ c2 = 'r';
+ break;
+ case '\f':
+ c2 = 'f';
+ break;
+ }
+ if (c2) {
+ rb_warnI("invalid character syntax; use ?\\%c", c2);
+ }
+ }
+ ternary:
+ pushback(c);
+ lex_state = EXPR_VALUE;
+ return '?';
+ }
+ newtok();
+ enc = current_enc;
+ if (!parser_isascii()) {
+ if (tokadd_mbchar(c) == -1) return 0;
+ }
+ else if ((rb_enc_isalnum(c, current_enc) || c == '_') &&
+ lex_p < lex_pend && is_identchar(lex_p, lex_pend, current_enc)) {
+ goto ternary;
+ }
+ else if (c == '\\') {
+ if (peek('u')) {
+ nextc();
+ c = parser_tokadd_utf8(parser, &enc, 0, 0, 0);
+ if (0x80 <= c) {
+ tokaddmbc(c, enc);
+ }
+ else {
+ tokadd(c);
+ }
+ }
+ else if (!lex_eol_p() && !(c = *lex_p, ISASCII(c))) {
+ nextc();
+ if (tokadd_mbchar(c) == -1) return 0;
+ }
+ else {
+ c = read_escape(0, &enc);
+ tokadd(c);
+ }
+ }
+ else {
+ tokadd(c);
+ }
+ tokfix();
+ set_yylval_str(STR_NEW3(tok(), toklen(), enc, 0));
+ lex_state = EXPR_END;
+ return tCHAR;
case '&':
if ((c = nextc()) == '&') {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
if ((c = nextc()) == '=') {
set_yylval_id(tANDOP);
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -8470,13 +7327,9 @@ parser_yylex(struct parser_params *parser)
}
else if (c == '=') {
set_yylval_id('&');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
- else if (c == '.') {
- SET_LEX_STATE(EXPR_DOT);
- return tANDDOT;
- }
pushback(c);
if (IS_SPCARG(c)) {
rb_warning0("`&' interpreted as argument prefix");
@@ -8489,15 +7342,15 @@ parser_yylex(struct parser_params *parser)
warn_balanced("&", "argument prefix");
c = '&';
}
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
return c;
case '|':
if ((c = nextc()) == '|') {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
if ((c = nextc()) == '=') {
set_yylval_id(tOROP);
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -8505,17 +7358,17 @@ parser_yylex(struct parser_params *parser)
}
if (c == '=') {
set_yylval_id('|');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG|EXPR_LABEL);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
pushback(c);
return '|';
case '+':
c = nextc();
if (IS_AFTER_OPERATOR()) {
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
if (c == '@') {
return tUPLUS;
}
@@ -8524,18 +7377,19 @@ parser_yylex(struct parser_params *parser)
}
if (c == '=') {
set_yylval_id('+');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
- if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous('+'))) {
- SET_LEX_STATE(EXPR_BEG);
+ if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous())) {
+ lex_state = EXPR_BEG;
pushback(c);
if (c != -1 && ISDIGIT(c)) {
- return parse_numeric(parser, '+');
+ c = '+';
+ goto start_num;
}
return tUPLUS;
}
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
pushback(c);
warn_balanced("+", "unary operator");
return '+';
@@ -8543,7 +7397,7 @@ parser_yylex(struct parser_params *parser)
case '-':
c = nextc();
if (IS_AFTER_OPERATOR()) {
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
if (c == '@') {
return tUMINUS;
}
@@ -8552,28 +7406,28 @@ parser_yylex(struct parser_params *parser)
}
if (c == '=') {
set_yylval_id('-');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
if (c == '>') {
- SET_LEX_STATE(EXPR_ENDFN);
+ lex_state = EXPR_ENDFN;
return tLAMBDA;
}
- if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous('-'))) {
- SET_LEX_STATE(EXPR_BEG);
+ if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous())) {
+ lex_state = EXPR_BEG;
pushback(c);
if (c != -1 && ISDIGIT(c)) {
return tUMINUS_NUM;
}
return tUMINUS;
}
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
pushback(c);
warn_balanced("-", "unary operator");
return '-';
case '.':
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
if ((c = nextc()) == '.') {
if ((c = nextc()) == '.') {
return tDOT3;
@@ -8585,12 +7439,248 @@ parser_yylex(struct parser_params *parser)
if (c != -1 && ISDIGIT(c)) {
yyerror("no .<digit> floating literal anymore; put 0 before dot");
}
- SET_LEX_STATE(EXPR_DOT);
+ lex_state = EXPR_DOT;
return '.';
+ start_num:
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- return parse_numeric(parser, c);
+ {
+ int is_float, seen_point, seen_e, nondigit;
+ int suffix;
+
+ is_float = seen_point = seen_e = nondigit = 0;
+ lex_state = EXPR_END;
+ newtok();
+ if (c == '-' || c == '+') {
+ tokadd(c);
+ c = nextc();
+ }
+ if (c == '0') {
+#define no_digits() do {yyerror("numeric literal without digits"); return 0;} while (0)
+ int start = toklen();
+ c = nextc();
+ if (c == 'x' || c == 'X') {
+ /* hexadecimal */
+ c = nextc();
+ if (c != -1 && ISXDIGIT(c)) {
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (!ISXDIGIT(c)) break;
+ nondigit = 0;
+ tokadd(c);
+ } while ((c = nextc()) != -1);
+ }
+ pushback(c);
+ tokfix();
+ if (toklen() == start) {
+ no_digits();
+ }
+ else if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 16, FALSE), suffix);
+ }
+ if (c == 'b' || c == 'B') {
+ /* binary */
+ c = nextc();
+ if (c == '0' || c == '1') {
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (c != '0' && c != '1') break;
+ nondigit = 0;
+ tokadd(c);
+ } while ((c = nextc()) != -1);
+ }
+ pushback(c);
+ tokfix();
+ if (toklen() == start) {
+ no_digits();
+ }
+ else if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 2, FALSE), suffix);
+ }
+ if (c == 'd' || c == 'D') {
+ /* decimal */
+ c = nextc();
+ if (c != -1 && ISDIGIT(c)) {
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (!ISDIGIT(c)) break;
+ nondigit = 0;
+ tokadd(c);
+ } while ((c = nextc()) != -1);
+ }
+ pushback(c);
+ tokfix();
+ if (toklen() == start) {
+ no_digits();
+ }
+ else if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 10, FALSE), suffix);
+ }
+ if (c == '_') {
+ /* 0_0 */
+ goto octal_number;
+ }
+ if (c == 'o' || c == 'O') {
+ /* prefixed octal */
+ c = nextc();
+ if (c == -1 || c == '_' || !ISDIGIT(c)) {
+ no_digits();
+ }
+ }
+ if (c >= '0' && c <= '7') {
+ /* octal */
+ octal_number:
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (c < '0' || c > '9') break;
+ if (c > '7') goto invalid_octal;
+ nondigit = 0;
+ tokadd(c);
+ } while ((c = nextc()) != -1);
+ if (toklen() > start) {
+ pushback(c);
+ tokfix();
+ if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 8, FALSE), suffix);
+ }
+ if (nondigit) {
+ pushback(c);
+ goto trailing_uc;
+ }
+ }
+ if (c > '7' && c <= '9') {
+ invalid_octal:
+ yyerror("Invalid octal digit");
+ }
+ else if (c == '.' || c == 'e' || c == 'E') {
+ tokadd('0');
+ }
+ else {
+ pushback(c);
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(INT2FIX(0), suffix);
+ }
+ }
+
+ for (;;) {
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ nondigit = 0;
+ tokadd(c);
+ break;
+
+ case '.':
+ if (nondigit) goto trailing_uc;
+ if (seen_point || seen_e) {
+ goto decode_num;
+ }
+ else {
+ int c0 = nextc();
+ if (c0 == -1 || !ISDIGIT(c0)) {
+ pushback(c0);
+ goto decode_num;
+ }
+ c = c0;
+ }
+ seen_point = toklen();
+ tokadd('.');
+ tokadd(c);
+ is_float++;
+ nondigit = 0;
+ break;
+
+ case 'e':
+ case 'E':
+ if (nondigit) {
+ pushback(c);
+ c = nondigit;
+ goto decode_num;
+ }
+ if (seen_e) {
+ goto decode_num;
+ }
+ nondigit = c;
+ c = nextc();
+ if (c != '-' && c != '+' && !ISDIGIT(c)) {
+ pushback(c);
+ nondigit = 0;
+ goto decode_num;
+ }
+ tokadd(nondigit);
+ seen_e++;
+ is_float++;
+ tokadd(c);
+ nondigit = (c == '-' || c == '+') ? c : 0;
+ break;
+
+ case '_': /* `_' in number just ignored */
+ if (nondigit) goto decode_num;
+ nondigit = c;
+ break;
+
+ default:
+ goto decode_num;
+ }
+ c = nextc();
+ }
+
+ decode_num:
+ pushback(c);
+ if (nondigit) {
+ char tmp[30];
+ trailing_uc:
+ snprintf(tmp, sizeof(tmp), "trailing `%c' in number", nondigit);
+ yyerror(tmp);
+ }
+ tokfix();
+ if (is_float) {
+ int type = tFLOAT;
+ VALUE v;
+
+ suffix = number_literal_suffix(seen_e ? NUM_SUFFIX_I : NUM_SUFFIX_ALL);
+ if (suffix & NUM_SUFFIX_R) {
+ char *point = &tok()[seen_point];
+ size_t fraclen = toklen()-seen_point-1;
+ type = tRATIONAL;
+ memmove(point, point+1, fraclen+1);
+ v = rb_cstr_to_inum(tok(), 10, FALSE);
+ v = rb_rational_new(v, rb_int_positive_pow(10, fraclen));
+ }
+ else {
+ double d = strtod(tok(), 0);
+ if (errno == ERANGE) {
+ rb_warningS("Float %s out of range", tok());
+ errno = 0;
+ }
+ v = DBL2NUM(d);
+ }
+ return set_number_literal(v, type, suffix);
+ }
+ suffix = number_literal_suffix(NUM_SUFFIX_ALL);
+ return set_integer_literal(rb_cstr_to_inum(tok(), 10, FALSE), suffix);
+ }
case ')':
case ']':
@@ -8599,9 +7689,9 @@ parser_yylex(struct parser_params *parser)
COND_LEXPOP();
CMDARG_LEXPOP();
if (c == ')')
- SET_LEX_STATE(EXPR_ENDFN);
+ lex_state = EXPR_ENDFN;
else
- SET_LEX_STATE(EXPR_ENDARG);
+ lex_state = EXPR_ENDARG;
if (c == '}') {
if (!brace_nest--) c = tSTRING_DEND;
}
@@ -8611,16 +7701,16 @@ parser_yylex(struct parser_params *parser)
c = nextc();
if (c == ':') {
if (IS_BEG() || IS_lex_state(EXPR_CLASS) || IS_SPCARG(-1)) {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tCOLON3;
}
- SET_LEX_STATE(EXPR_DOT);
+ lex_state = EXPR_DOT;
return tCOLON2;
}
- if (IS_END() || ISSPACE(c) || c == '#') {
+ if (IS_END() || ISSPACE(c)) {
pushback(c);
warn_balanced(":", "symbol literal");
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return ':';
}
switch (c) {
@@ -8634,46 +7724,46 @@ parser_yylex(struct parser_params *parser)
pushback(c);
break;
}
- SET_LEX_STATE(EXPR_FNAME);
+ lex_state = EXPR_FNAME;
return tSYMBEG;
case '/':
- if (IS_BEG()) {
+ if (IS_lex_state(EXPR_BEG_ANY)) {
lex_strterm = NEW_STRTERM(str_regexp, '/', 0);
return tREGEXP_BEG;
}
if ((c = nextc()) == '=') {
set_yylval_id('/');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
if (IS_SPCARG(c)) {
- (void)arg_ambiguous('/');
+ (void)arg_ambiguous();
lex_strterm = NEW_STRTERM(str_regexp, '/', 0);
return tREGEXP_BEG;
}
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
warn_balanced("/", "regexp literal");
return '/';
case '^':
if ((c = nextc()) == '=') {
set_yylval_id('^');
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
- SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG);
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
pushback(c);
return '^';
case ';':
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
command_start = TRUE;
return ';';
case ',':
- SET_LEX_STATE(EXPR_BEG|EXPR_LABEL);
+ lex_state = EXPR_BEG;
return ',';
case '~':
@@ -8681,10 +7771,10 @@ parser_yylex(struct parser_params *parser)
if ((c = nextc()) != '@') {
pushback(c);
}
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
}
else {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
}
return '~';
@@ -8698,13 +7788,13 @@ parser_yylex(struct parser_params *parser)
paren_nest++;
COND_PUSH(0);
CMDARG_PUSH(0);
- SET_LEX_STATE(EXPR_BEG|EXPR_LABEL);
+ lex_state = EXPR_BEG;
return c;
case '[':
paren_nest++;
if (IS_AFTER_OPERATOR()) {
- SET_LEX_STATE(EXPR_ARG);
+ lex_state = EXPR_ARG;
if ((c = nextc()) == ']') {
if ((c = nextc()) == '=') {
return tASET;
@@ -8713,16 +7803,15 @@ parser_yylex(struct parser_params *parser)
return tAREF;
}
pushback(c);
- lex_state |= EXPR_LABEL;
return '[';
}
else if (IS_BEG()) {
c = tLBRACK;
}
- else if (IS_ARG() && (space_seen || IS_lex_state(EXPR_LABELED))) {
+ else if (IS_ARG() && space_seen) {
c = tLBRACK;
}
- SET_LEX_STATE(EXPR_BEG|EXPR_LABEL);
+ lex_state = EXPR_BEG;
COND_PUSH(0);
CMDARG_PUSH(0);
return c;
@@ -8730,16 +7819,14 @@ parser_yylex(struct parser_params *parser)
case '{':
++brace_nest;
if (lpar_beg && lpar_beg == paren_nest) {
- SET_LEX_STATE(EXPR_BEG);
+ lex_state = EXPR_BEG;
lpar_beg = 0;
--paren_nest;
COND_PUSH(0);
CMDARG_PUSH(0);
return tLAMBEG;
}
- if (IS_lex_state(EXPR_LABELED))
- c = tLBRACE; /* hash */
- else if (IS_lex_state(EXPR_ARG_ANY | EXPR_END | EXPR_ENDFN))
+ if (IS_ARG() || IS_lex_state(EXPR_END | EXPR_ENDFN))
c = '{'; /* block (primary) */
else if (IS_lex_state(EXPR_ENDARG))
c = tLBRACE_ARG; /* block (expr) */
@@ -8747,8 +7834,7 @@ parser_yylex(struct parser_params *parser)
c = tLBRACE; /* hash */
COND_PUSH(0);
CMDARG_PUSH(0);
- SET_LEX_STATE(EXPR_BEG);
- if (c != tLBRACE_ARG) lex_state |= EXPR_LABEL;
+ lex_state = EXPR_BEG;
if (c != tLBRACE) command_start = TRUE;
return c;
@@ -8756,30 +7842,224 @@ parser_yylex(struct parser_params *parser)
c = nextc();
if (c == '\n') {
space_seen = 1;
- dispatch_scan_event(tSP);
+#ifdef RIPPER
+ ripper_dispatch_scan_event(parser, tSP);
+#endif
goto retry; /* skip \\n */
}
pushback(c);
return '\\';
case '%':
- return parse_percent(parser, space_seen, last_state);
+ if (IS_lex_state(EXPR_BEG_ANY)) {
+ int term;
+ int paren;
+
+ c = nextc();
+ quotation:
+ if (c == -1 || !ISALNUM(c)) {
+ term = c;
+ c = 'Q';
+ }
+ else {
+ term = nextc();
+ if (rb_enc_isalnum(term, current_enc) || !parser_isascii()) {
+ yyerror("unknown type of %string");
+ return 0;
+ }
+ }
+ if (c == -1 || term == -1) {
+ compile_error(PARSER_ARG "unterminated quoted string meets end of file");
+ return 0;
+ }
+ paren = term;
+ if (term == '(') term = ')';
+ else if (term == '[') term = ']';
+ else if (term == '{') term = '}';
+ else if (term == '<') term = '>';
+ else paren = 0;
+
+ switch (c) {
+ case 'Q':
+ lex_strterm = NEW_STRTERM(str_dquote, term, paren);
+ return tSTRING_BEG;
+
+ case 'q':
+ lex_strterm = NEW_STRTERM(str_squote, term, paren);
+ return tSTRING_BEG;
+
+ case 'W':
+ lex_strterm = NEW_STRTERM(str_dword, term, paren);
+ do {c = nextc();} while (ISSPACE(c));
+ pushback(c);
+ return tWORDS_BEG;
+
+ case 'w':
+ lex_strterm = NEW_STRTERM(str_sword, term, paren);
+ do {c = nextc();} while (ISSPACE(c));
+ pushback(c);
+ return tQWORDS_BEG;
+
+ case 'I':
+ lex_strterm = NEW_STRTERM(str_dword, term, paren);
+ do {c = nextc();} while (ISSPACE(c));
+ pushback(c);
+ return tSYMBOLS_BEG;
+
+ case 'i':
+ lex_strterm = NEW_STRTERM(str_sword, term, paren);
+ do {c = nextc();} while (ISSPACE(c));
+ pushback(c);
+ return tQSYMBOLS_BEG;
+
+ case 'x':
+ lex_strterm = NEW_STRTERM(str_xquote, term, paren);
+ return tXSTRING_BEG;
+
+ case 'r':
+ lex_strterm = NEW_STRTERM(str_regexp, term, paren);
+ return tREGEXP_BEG;
+
+ case 's':
+ lex_strterm = NEW_STRTERM(str_ssym, term, paren);
+ lex_state = EXPR_FNAME;
+ return tSYMBEG;
+
+ default:
+ yyerror("unknown type of %string");
+ return 0;
+ }
+ }
+ if ((c = nextc()) == '=') {
+ set_yylval_id('%');
+ lex_state = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ if (IS_SPCARG(c)) {
+ goto quotation;
+ }
+ lex_state = IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG;
+ pushback(c);
+ warn_balanced("%%", "string literal");
+ return '%';
case '$':
- return parse_gvar(parser, last_state);
+ lex_state = EXPR_END;
+ newtok();
+ c = nextc();
+ switch (c) {
+ case '_': /* $_: last read line string */
+ c = nextc();
+ if (parser_is_identchar()) {
+ tokadd('$');
+ tokadd('_');
+ break;
+ }
+ pushback(c);
+ c = '_';
+ /* fall through */
+ case '~': /* $~: match-data */
+ case '*': /* $*: argv */
+ case '$': /* $$: pid */
+ case '?': /* $?: last status */
+ case '!': /* $!: error string */
+ case '@': /* $@: error position */
+ case '/': /* $/: input record separator */
+ case '\\': /* $\: output record separator */
+ case ';': /* $;: field separator */
+ case ',': /* $,: output field separator */
+ case '.': /* $.: last read line number */
+ case '=': /* $=: ignorecase */
+ case ':': /* $:: load path */
+ case '<': /* $<: reading filename */
+ case '>': /* $>: default output handle */
+ case '\"': /* $": already loaded files */
+ tokadd('$');
+ tokadd(c);
+ goto gvar;
+
+ case '-':
+ tokadd('$');
+ tokadd(c);
+ c = nextc();
+ if (parser_is_identchar()) {
+ if (tokadd_mbchar(c) == -1) return 0;
+ }
+ else {
+ pushback(c);
+ pushback('-');
+ return '$';
+ }
+ gvar:
+ set_yylval_name(rb_intern3(tok(), tokidx, current_enc));
+ return tGVAR;
+
+ case '&': /* $&: last match */
+ case '`': /* $`: string before last match */
+ case '\'': /* $': string after last match */
+ case '+': /* $+: string matches last paren. */
+ if (IS_lex_state_for(last_state, EXPR_FNAME)) {
+ tokadd('$');
+ tokadd(c);
+ goto gvar;
+ }
+ set_yylval_node(NEW_BACK_REF(c));
+ return tBACK_REF;
+
+ case '1': case '2': case '3':
+ case '4': case '5': case '6':
+ case '7': case '8': case '9':
+ tokadd('$');
+ do {
+ tokadd(c);
+ c = nextc();
+ } while (c != -1 && ISDIGIT(c));
+ pushback(c);
+ if (IS_lex_state_for(last_state, EXPR_FNAME)) goto gvar;
+ tokfix();
+ set_yylval_node(NEW_NTH_REF(atoi(tok()+1)));
+ return tNTH_REF;
+
+ default:
+ if (!parser_is_identchar()) {
+ pushback(c);
+ compile_error(PARSER_ARG "`$%c' is not allowed as a global variable name", c);
+ return 0;
+ }
+ case '0':
+ tokadd('$');
+ }
+ break;
case '@':
- return parse_atmark(parser, last_state);
+ c = nextc();
+ newtok();
+ tokadd('@');
+ if (c == '@') {
+ tokadd('@');
+ c = nextc();
+ }
+ if (c != -1 && (ISDIGIT(c) || !parser_is_identchar())) {
+ pushback(c);
+ if (tokidx == 1) {
+ compile_error(PARSER_ARG "`@%c' is not allowed as an instance variable name", c);
+ }
+ else {
+ compile_error(PARSER_ARG "`@@%c' is not allowed as a class variable name", c);
+ }
+ return 0;
+ }
+ break;
case '_':
if (was_bol() && whole_match_p("__END__", 7, 0)) {
ruby__end__seen = 1;
- parser->eofp = 1;
+ parser->eofp = Qtrue;
#ifndef RIPPER
return -1;
#else
lex_goto_eol(parser);
- dispatch_scan_event(k__END__);
+ ripper_dispatch_scan_event(parser, k__END__);
return 0;
#endif
}
@@ -8788,7 +8068,7 @@ parser_yylex(struct parser_params *parser)
default:
if (!parser_is_identchar()) {
- compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
+ rb_compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
goto retry;
}
@@ -8796,21 +8076,164 @@ parser_yylex(struct parser_params *parser)
break;
}
- return parse_ident(parser, c, cmd_state);
+ mb = ENC_CODERANGE_7BIT;
+ do {
+ if (!ISASCII(c)) mb = ENC_CODERANGE_UNKNOWN;
+ if (tokadd_mbchar(c) == -1) return 0;
+ c = nextc();
+ } while (parser_is_identchar());
+ switch (tok()[0]) {
+ case '@': case '$':
+ pushback(c);
+ break;
+ default:
+ if ((c == '!' || c == '?') && !peek('=')) {
+ tokadd(c);
+ }
+ else {
+ pushback(c);
+ }
+ }
+ tokfix();
+
+ {
+ int result = 0;
+
+ last_state = lex_state;
+ switch (tok()[0]) {
+ case '$':
+ lex_state = EXPR_END;
+ result = tGVAR;
+ break;
+ case '@':
+ lex_state = EXPR_END;
+ if (tok()[1] == '@')
+ result = tCVAR;
+ else
+ result = tIVAR;
+ break;
+
+ default:
+ if (toklast() == '!' || toklast() == '?') {
+ result = tFID;
+ }
+ else {
+ if (IS_lex_state(EXPR_FNAME)) {
+ if ((c = nextc()) == '=' && !peek('~') && !peek('>') &&
+ (!peek('=') || (peek_n('>', 1)))) {
+ result = tIDENTIFIER;
+ tokadd(c);
+ tokfix();
+ }
+ else {
+ pushback(c);
+ }
+ }
+ if (result == 0 && ISUPPER(tok()[0])) {
+ result = tCONSTANT;
+ }
+ else {
+ result = tIDENTIFIER;
+ }
+ }
+
+ if (IS_LABEL_POSSIBLE()) {
+ if (IS_LABEL_SUFFIX(0)) {
+ lex_state = EXPR_BEG;
+ nextc();
+ set_yylval_name(TOK_INTERN(!ENC_SINGLE(mb)));
+ return tLABEL;
+ }
+ }
+ if (mb == ENC_CODERANGE_7BIT && !IS_lex_state(EXPR_DOT)) {
+ const struct kwtable *kw;
+
+ /* See if it is a reserved word. */
+ kw = rb_reserved_word(tok(), toklen());
+ if (kw) {
+ enum lex_state_e state = lex_state;
+ lex_state = kw->state;
+ if (IS_lex_state_for(state, EXPR_FNAME)) {
+ set_yylval_name(rb_intern(kw->name));
+ return kw->id[0];
+ }
+ if (IS_lex_state(EXPR_BEG)) {
+ command_start = TRUE;
+ }
+ if (kw->id[0] == keyword_do) {
+ if (lpar_beg && lpar_beg == paren_nest) {
+ lpar_beg = 0;
+ --paren_nest;
+ return keyword_do_LAMBDA;
+ }
+ if (COND_P()) return keyword_do_cond;
+ if (CMDARG_P() && !IS_lex_state_for(state, EXPR_CMDARG))
+ return keyword_do_block;
+ if (IS_lex_state_for(state, (EXPR_BEG | EXPR_ENDARG)))
+ return keyword_do_block;
+ return keyword_do;
+ }
+ if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE)))
+ return kw->id[0];
+ else {
+ if (kw->id[0] != kw->id[1])
+ lex_state = EXPR_BEG;
+ return kw->id[1];
+ }
+ }
+ }
+
+ if (IS_lex_state(EXPR_BEG_ANY | EXPR_ARG_ANY | EXPR_DOT)) {
+ if (cmd_state) {
+ lex_state = EXPR_CMDARG;
+ }
+ else {
+ lex_state = EXPR_ARG;
+ }
+ }
+ else if (lex_state == EXPR_FNAME) {
+ lex_state = EXPR_ENDFN;
+ }
+ else {
+ lex_state = EXPR_END;
+ }
+ }
+ {
+ ID ident = TOK_INTERN(!ENC_SINGLE(mb));
+
+ set_yylval_name(ident);
+ if (!IS_lex_state_for(last_state, EXPR_DOT|EXPR_FNAME) &&
+ is_local_id(ident) && lvar_defined(ident)) {
+ lex_state = EXPR_END;
+ }
+ }
+ return result;
+ }
}
+#if YYPURE
static int
-yylex(YYSTYPE *lval, struct parser_params *parser)
+yylex(void *lval, void *p)
+#else
+yylex(void *p)
+#endif
{
+ struct parser_params *parser = (struct parser_params*)p;
int t;
- parser->lval = lval;
- lval->val = Qundef;
+#if YYPURE
+ parser->parser_yylval = lval;
+ parser->parser_yylval->val = Qundef;
+#endif
t = parser_yylex(parser);
- if (has_delayed_token())
- dispatch_delayed_token(t);
- else if (t != 0)
- dispatch_scan_event(t);
+#ifdef RIPPER
+ if (!NIL_P(parser->delayed)) {
+ ripper_dispatch_delayed_token(parser, t);
+ return t;
+ }
+ if (t != 0)
+ ripper_dispatch_scan_event(parser, t);
+#endif
return t;
}
@@ -8944,7 +8367,7 @@ list_append_gen(struct parser_params *parser, NODE *list, NODE *item)
/* concat two lists */
static NODE*
-list_concat(NODE *head, NODE *tail)
+list_concat_gen(struct parser_params *parser, NODE *head, NODE *tail)
{
NODE *last;
@@ -8996,7 +8419,7 @@ literal_concat_gen(struct parser_params *parser, NODE *head, NODE *tail)
htype = nd_type(head);
if (htype == NODE_EVSTR) {
- NODE *node = NEW_DSTR(STR_NEW0());
+ NODE *node = NEW_DSTR(Qnil);
head = list_append(node, head);
htype = NODE_DSTR;
}
@@ -9069,7 +8492,7 @@ static NODE *
evstr2dstr_gen(struct parser_params *parser, NODE *node)
{
if (nd_type(node) == NODE_EVSTR) {
- node = list_append(NEW_DSTR(STR_NEW0()), node);
+ node = list_append(NEW_DSTR(Qnil), node);
}
return node;
}
@@ -9137,19 +8560,6 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2)
return NEW_CALL(node1, tMATCH, NEW_LIST(node2));
}
-# if WARN_PAST_SCOPE
-static int
-past_dvar_p(struct parser_params *parser, ID id)
-{
- struct vtable *past = lvtbl->past;
- while (past) {
- if (vtable_included(past, id)) return 1;
- past = past->prev;
- }
- return 0;
-}
-# endif
-
static NODE*
gettable_gen(struct parser_params *parser, ID id)
{
@@ -9171,23 +8581,8 @@ gettable_gen(struct parser_params *parser, ID id)
}
switch (id_type(id)) {
case ID_LOCAL:
- if (dyna_in_block() && dvar_defined(id)) {
- if (id == current_arg) {
- rb_warn1("circular argument reference - %"PRIsWARN, rb_id2str(id));
- }
- return NEW_DVAR(id);
- }
- if (local_id(id)) {
- if (id == current_arg) {
- rb_warn1("circular argument reference - %"PRIsWARN, rb_id2str(id));
- }
- return NEW_LVAR(id);
- }
-# if WARN_PAST_SCOPE
- if (!in_defined && RTEST(ruby_verbose) && past_dvar_p(parser, id)) {
- rb_warning1("possible reference to past scope - %"PRIsWARN, rb_id2str(id));
- }
-# endif
+ if (dyna_in_block() && dvar_defined(id)) return NEW_DVAR(id);
+ if (local_id(id)) return NEW_LVAR(id);
/* method call without arguments */
return NEW_VCALL(id);
case ID_GLOBAL:
@@ -9199,22 +8594,9 @@ gettable_gen(struct parser_params *parser, ID id)
case ID_CLASS:
return NEW_CVAR(id);
}
- compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to get", rb_id2str(id));
+ compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2name(id));
return 0;
}
-
-static NODE *
-kwd_append(NODE *kwlist, NODE *kw)
-{
- if (kwlist) {
- NODE *kws = kwlist;
- while (kws->nd_next) {
- kws = kws->nd_next;
- }
- kws->nd_next = kw;
- }
- return kwlist;
-}
#else /* !RIPPER */
static int
id_is_var_gen(struct parser_params *parser, ID id)
@@ -9230,51 +8612,26 @@ id_is_var_gen(struct parser_params *parser, ID id)
return 0;
}
}
- compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2str(id));
+ compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2name(id));
return 0;
}
#endif /* !RIPPER */
-static const char lex_state_names[][13] = {
- "EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG",
- "EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS",
- "EXPR_LABEL", "EXPR_LABELED","EXPR_FITEM",
-};
-
-static VALUE
-append_lex_state_name(enum lex_state_e state, VALUE buf)
+#if PARSER_DEBUG
+static const char *
+lex_state_name(enum lex_state_e state)
{
- int i, sep = 0;
- unsigned int mask = 1;
- static const char none[] = "EXPR_NONE";
-
- for (i = 0; i < EXPR_MAX_STATE; ++i, mask <<= 1) {
- if ((unsigned)state & mask) {
- if (sep) {
- rb_str_cat(buf, "|", 1);
- }
- sep = 1;
- rb_str_cat_cstr(buf, lex_state_names[i]);
- }
- }
- if (!sep) {
- rb_str_cat(buf, none, sizeof(none)-1);
- }
- return buf;
-}
+ static const char names[][12] = {
+ "EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG",
+ "EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS",
+ "EXPR_VALUE",
+ };
-static enum lex_state_e
-trace_lex_state(enum lex_state_e from, enum lex_state_e to, int line)
-{
- VALUE mesg;
- mesg = rb_str_new_cstr("lex_state: ");
- append_lex_state_name(from, mesg);
- rb_str_cat_cstr(mesg, " -> ");
- append_lex_state_name(to, mesg);
- rb_str_catf(mesg, " at line %d\n", line);
- rb_io_write(rb_stdout, mesg);
- return to;
+ if ((unsigned)state & ~(~0u << EXPR_MAX_STATE))
+ return names[ffs(state)];
+ return NULL;
}
+#endif
#ifdef RIPPER
static VALUE
@@ -9287,7 +8644,7 @@ assignable_gen(struct parser_params *parser, ID id, NODE *val)
#ifdef RIPPER
ID id = get_id(lhs);
# define assignable_result(x) get_value(lhs)
-# define parser_yyerror(parser, x) (dispatch1(assign_error, lhs), ripper_error())
+# define parser_yyerror(parser, x) dispatch1(assign_error, lhs)
#else
# define assignable_result(x) (x)
#endif
@@ -9351,7 +8708,7 @@ assignable_gen(struct parser_params *parser, ID id, NODE *val)
case ID_CLASS:
return assignable_result(NEW_CVASGN(id, val));
default:
- compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to set", rb_id2str(id));
+ compile_error(PARSER_ARG "identifier %s is not valid to set", rb_id2name(id));
}
error:
return assignable_result(0);
@@ -9372,21 +8729,20 @@ is_private_local_id(ID name)
#define LVAR_USED ((ID)1 << (sizeof(ID) * CHAR_BIT - 1))
-static int
-shadowing_lvar_0(struct parser_params *parser, ID name)
+static ID
+shadowing_lvar_gen(struct parser_params *parser, ID name)
{
- if (is_private_local_id(name)) return 1;
+ if (is_private_local_id(name)) return name;
if (dyna_in_block()) {
if (dvar_curr(name)) {
yyerror("duplicated argument name");
}
else if (dvar_defined_get(name) || local_id(name)) {
- rb_warning1("shadowing outer local variable - %"PRIsWARN, rb_id2str(name));
+ rb_warningS("shadowing outer local variable - %s", rb_id2name(name));
vtable_add(lvtbl->vars, name);
if (lvtbl->used) {
vtable_add(lvtbl->used, (ID)ruby_sourceline | LVAR_USED);
}
- return 0;
}
}
else {
@@ -9394,13 +8750,6 @@ shadowing_lvar_0(struct parser_params *parser, ID name)
yyerror("duplicated argument name");
}
}
- return 1;
-}
-
-static ID
-shadowing_lvar_gen(struct parser_params *parser, ID name)
-{
- shadowing_lvar_0(parser, name);
return name;
}
@@ -9409,11 +8758,11 @@ new_bv_gen(struct parser_params *parser, ID name)
{
if (!name) return;
if (!is_local_id(name)) {
- compile_error(PARSER_ARG "invalid local variable - %"PRIsVALUE,
- rb_id2str(name));
+ compile_error(PARSER_ARG "invalid local variable - %s",
+ rb_id2name(name));
return;
}
- if (!shadowing_lvar_0(parser, name)) return;
+ shadowing_lvar(name);
dyna_var(name);
}
@@ -9421,6 +8770,8 @@ new_bv_gen(struct parser_params *parser, ID name)
static NODE *
aryset_gen(struct parser_params *parser, NODE *recv, NODE *idx)
{
+ if (recv && nd_type(recv) == NODE_SELF)
+ recv = (NODE *)1;
return NEW_ATTRASGN(recv, tASET, idx);
}
@@ -9432,11 +8783,52 @@ block_dup_check_gen(struct parser_params *parser, NODE *node1, NODE *node2)
}
}
+static const char id_type_names[][9] = {
+ "LOCAL",
+ "INSTANCE",
+ "", /* INSTANCE2 */
+ "GLOBAL",
+ "ATTRSET",
+ "CONST",
+ "CLASS",
+ "JUNK",
+};
+
+ID
+rb_id_attrset(ID id)
+{
+ if (!is_notop_id(id)) {
+ switch (id) {
+ case tAREF: case tASET:
+ return tASET; /* only exception */
+ }
+ rb_name_error(id, "cannot make operator ID :%s attrset", rb_id2name(id));
+ }
+ else {
+ int scope = (int)(id & ID_SCOPE_MASK);
+ switch (scope) {
+ case ID_LOCAL: case ID_INSTANCE: case ID_GLOBAL:
+ case ID_CONST: case ID_CLASS: case ID_JUNK:
+ break;
+ case ID_ATTRSET:
+ return id;
+ default:
+ rb_name_error(id, "cannot make %s ID %+"PRIsVALUE" attrset",
+ id_type_names[scope], ID2SYM(id));
+
+ }
+ }
+ id &= ~ID_SCOPE_MASK;
+ id |= ID_ATTRSET;
+ return id;
+}
+
static NODE *
-attrset_gen(struct parser_params *parser, NODE *recv, ID atype, ID id)
+attrset_gen(struct parser_params *parser, NODE *recv, ID id)
{
- if (!CALL_Q_P(atype)) id = rb_id_attrset(id);
- return NEW_ATTRASGN(recv, id, 0);
+ if (recv && nd_type(recv) == NODE_SELF)
+ recv = (NODE *)1;
+ return NEW_ATTRASGN(recv, rb_id_attrset(id), 0);
}
static void
@@ -9672,7 +9064,11 @@ void_expr_gen(struct parser_params *parser, NODE *node)
}
if (useless) {
- rb_warn1L(nd_line(node), "possibly useless use of %s in void context", WARN_S(useless));
+ int line = ruby_sourceline;
+
+ ruby_sourceline = nd_line(node);
+ rb_warnS("possibly useless use of %s in void context", useless);
+ ruby_sourceline = line;
}
}
@@ -9967,14 +9363,6 @@ cond_gen(struct parser_params *parser, NODE *node)
}
static NODE*
-new_if_gen(struct parser_params *parser, NODE *cc, NODE *left, NODE *right)
-{
- if (!cc) return right;
- cc = cond0(parser, cc);
- return newline_node(NEW_IF(cc, left, right));
-}
-
-static NODE*
logop_gen(struct parser_params *parser, enum node_type type, NODE *left, NODE *right)
{
value_expr(left);
@@ -10022,33 +9410,35 @@ new_yield_gen(struct parser_params *parser, NODE *node)
return NEW_YIELD(node);
}
-static VALUE
-negate_lit(VALUE lit)
+static NODE*
+negate_lit(NODE *node)
{
- int type = TYPE(lit);
- switch (type) {
+ switch (TYPE(node->nd_lit)) {
case T_FIXNUM:
- lit = LONG2FIX(-FIX2LONG(lit));
+ node->nd_lit = LONG2FIX(-FIX2LONG(node->nd_lit));
break;
case T_BIGNUM:
case T_RATIONAL:
case T_COMPLEX:
- lit = rb_funcallv(lit, tUMINUS, 0, 0);
+ node->nd_lit = rb_funcall(node->nd_lit,tUMINUS,0,0);
break;
case T_FLOAT:
#if USE_FLONUM
- if (FLONUM_P(lit)) {
- lit = DBL2NUM(-RFLOAT_VALUE(lit));
- break;
+ if (FLONUM_P(node->nd_lit)) {
+ node->nd_lit = DBL2NUM(-RFLOAT_VALUE(node->nd_lit));
+ }
+ else {
+ RFLOAT(node->nd_lit)->float_value = -RFLOAT_VALUE(node->nd_lit);
}
+#else
+ RFLOAT(node->nd_lit)->float_value = -RFLOAT_VALUE(node->nd_lit);
#endif
- RFLOAT(lit)->float_value = -RFLOAT_VALUE(lit);
break;
default:
- rb_bug("unknown literal type (%d) passed to negate_lit", type);
+ rb_bug("unknown literal type passed to negate_lit");
break;
}
- return lit;
+ return node;
}
static NODE *
@@ -10089,63 +9479,21 @@ new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b)
{
int saved_line = ruby_sourceline;
struct rb_args_info *args;
+ NODE *kw_rest_arg = 0;
NODE *node;
- args = ZALLOC(struct rb_args_info);
+ args = ALLOC(struct rb_args_info);
+ MEMZERO(args, struct rb_args_info, 1);
node = NEW_NODE(NODE_ARGS, 0, 0, args);
args->block_arg = b;
args->kw_args = k;
-
- if (k) {
- /*
- * def foo(k1: 1, kr1:, k2: 2, **krest, &b)
- * variable order: k1, kr1, k2, &b, internal_id, krest
- * #=> <reorder>
- * variable order: kr1, k1, k2, internal_id, krest, &b
- */
- ID kw_bits;
- NODE *kwn = k;
- struct vtable *required_kw_vars = vtable_alloc(NULL);
- struct vtable *kw_vars = vtable_alloc(NULL);
- int i;
-
- while (kwn) {
- NODE *val_node = kwn->nd_body->nd_value;
- ID vid = kwn->nd_body->nd_vid;
-
- if (val_node == (NODE *)-1) {
- vtable_add(required_kw_vars, vid);
- }
- else {
- vtable_add(kw_vars, vid);
- }
-
- kwn = kwn->nd_next;
- }
-
- kw_bits = internal_id();
- if (kr && is_junk_id(kr)) vtable_pop(lvtbl->args, 1);
- vtable_pop(lvtbl->args, vtable_size(required_kw_vars) + vtable_size(kw_vars) + (b != 0));
-
- for (i=0; i<vtable_size(required_kw_vars); i++) arg_var(required_kw_vars->tbl[i]);
- for (i=0; i<vtable_size(kw_vars); i++) arg_var(kw_vars->tbl[i]);
- vtable_free(required_kw_vars);
- vtable_free(kw_vars);
-
- arg_var(kw_bits);
- if (kr) arg_var(kr);
- if (b) arg_var(b);
-
- args->kw_rest_arg = NEW_DVAR(kw_bits);
- args->kw_rest_arg->nd_cflag = kr;
- }
- else if (kr) {
- if (b) vtable_pop(lvtbl->args, 1); /* reorder */
+ if (k && !kr) kr = internal_id();
+ if (kr) {
arg_var(kr);
- if (b) arg_var(b);
- args->kw_rest_arg = NEW_DVAR(kr);
+ kw_rest_arg = NEW_DVAR(kr);
}
+ args->kw_rest_arg = kw_rest_arg;
ruby_sourceline = saved_line;
return node;
@@ -10175,61 +9523,6 @@ dsym_node_gen(struct parser_params *parser, NODE *node)
}
return node;
}
-
-static int
-append_literal_keys(st_data_t k, st_data_t v, st_data_t h)
-{
- NODE *node = (NODE *)v;
- NODE **result = (NODE **)h;
- node->nd_alen = 2;
- node->nd_next->nd_end = node->nd_next;
- node->nd_next->nd_next = 0;
- if (*result)
- list_concat(*result, node);
- else
- *result = node;
- return ST_CONTINUE;
-}
-
-static NODE *
-remove_duplicate_keys(struct parser_params *parser, NODE *hash)
-{
- st_table *literal_keys = st_init_numtable_with_size(hash->nd_alen / 2);
- NODE *result = 0;
- while (hash && hash->nd_head && hash->nd_next) {
- NODE *head = hash->nd_head;
- NODE *value = hash->nd_next;
- NODE *next = value->nd_next;
- VALUE key = (VALUE)head;
- st_data_t data;
- if (nd_type(head) == NODE_LIT &&
- st_lookup(literal_keys, (key = head->nd_lit), &data)) {
- rb_compile_warn(ruby_sourcefile, nd_line((NODE *)data),
- "key %+"PRIsVALUE" is duplicated and overwritten on line %d",
- head->nd_lit, nd_line(head));
- head = ((NODE *)data)->nd_next;
- head->nd_head = block_append(head->nd_head, value->nd_head);
- }
- else {
- st_insert(literal_keys, (st_data_t)key, (st_data_t)hash);
- }
- hash = next;
- }
- st_foreach(literal_keys, append_literal_keys, (st_data_t)&result);
- st_free_table(literal_keys);
- if (hash) {
- if (!result) result = hash;
- else list_concat(result, hash);
- }
- return result;
-}
-
-static NODE *
-new_hash_gen(struct parser_params *parser, NODE *hash)
-{
- if (hash) hash = remove_duplicate_keys(parser, hash);
- return NEW_HASH(hash);
-}
#endif /* !RIPPER */
#ifndef RIPPER
@@ -10243,13 +9536,8 @@ new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs)
if (op == tOROP) {
lhs->nd_value = rhs;
asgn = NEW_OP_ASGN_OR(gettable(vid), lhs);
- if (is_notop_id(vid)) {
- switch (id_type(vid)) {
- case ID_GLOBAL:
- case ID_INSTANCE:
- case ID_CLASS:
- asgn->nd_aid = vid;
- }
+ if (is_asgn_or_id(vid)) {
+ asgn->nd_aid = vid;
}
}
else if (op == tANDOP) {
@@ -10268,8 +9556,7 @@ new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs)
}
static NODE *
-new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs,
- ID atype, ID attr, ID op, NODE *rhs)
+new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID attr, ID op, NODE *rhs)
{
NODE *asgn;
@@ -10279,7 +9566,7 @@ new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs,
else if (op == tANDOP) {
op = 1;
}
- asgn = NEW_OP_ASGN2(lhs, CALL_Q_P(atype), attr, op, rhs);
+ asgn = NEW_OP_ASGN2(lhs, attr, op, rhs);
fixpos(asgn, lhs);
return asgn;
}
@@ -10335,7 +9622,7 @@ warn_unused_var(struct parser_params *parser, struct local_vars *local)
for (i = 0; i < cnt; ++i) {
if (!v[i] || (u[i] & LVAR_USED)) continue;
if (is_private_local_id(v[i])) continue;
- rb_warn1L((int)u[i], "assigned but unused variable - %"PRIsWARN, rb_id2str(v[i]));
+ rb_warn4S(ruby_sourcefile, (int)u[i], "assigned but unused variable - %s", rb_id2name(v[i]));
}
}
@@ -10351,11 +9638,6 @@ local_push_gen(struct parser_params *parser, int inherit_dvars)
local->used = !(inherit_dvars &&
(ifndef_ripper(compile_for_eval || e_option_supplied(parser))+0)) &&
RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
-# if WARN_PAST_SCOPE
- local->past = 0;
-# endif
- local->cmdargs = cmdarg_stack;
- cmdarg_stack = 0;
lvtbl = local;
}
@@ -10367,59 +9649,58 @@ local_pop_gen(struct parser_params *parser)
warn_unused_var(parser, lvtbl);
vtable_free(lvtbl->used);
}
-# if WARN_PAST_SCOPE
- while (lvtbl->past) {
- struct vtable *past = lvtbl->past;
- lvtbl->past = past->prev;
- vtable_free(past);
- }
-# endif
vtable_free(lvtbl->args);
vtable_free(lvtbl->vars);
- cmdarg_stack = lvtbl->cmdargs;
xfree(lvtbl);
lvtbl = local;
}
#ifndef RIPPER
static ID*
+vtable_tblcpy(ID *buf, const struct vtable *src)
+{
+ int i, cnt = vtable_size(src);
+
+ if (cnt > 0) {
+ buf[0] = cnt;
+ for (i = 0; i < cnt; i++) {
+ buf[i] = src->tbl[i];
+ }
+ return buf;
+ }
+ return 0;
+}
+
+static ID*
local_tbl_gen(struct parser_params *parser)
{
- int cnt_args = vtable_size(lvtbl->args);
- int cnt_vars = vtable_size(lvtbl->vars);
- int cnt = cnt_args + cnt_vars;
- int i, j;
+ int cnt = vtable_size(lvtbl->args) + vtable_size(lvtbl->vars);
ID *buf;
if (cnt <= 0) return 0;
buf = ALLOC_N(ID, cnt + 1);
- MEMCPY(buf+1, lvtbl->args->tbl, ID, cnt_args);
- /* remove IDs duplicated to warn shadowing */
- for (i = 0, j = cnt_args+1; i < cnt_vars; ++i) {
- ID id = lvtbl->vars->tbl[i];
- if (!vtable_included(lvtbl->args, id)) {
- buf[j++] = id;
- }
- }
- if (--j < cnt) REALLOC_N(buf, ID, (cnt = j) + 1);
+ vtable_tblcpy(buf+1, lvtbl->args);
+ vtable_tblcpy(buf+vtable_size(lvtbl->args)+1, lvtbl->vars);
buf[0] = cnt;
return buf;
}
#endif
-static void
+static int
arg_var_gen(struct parser_params *parser, ID id)
{
vtable_add(lvtbl->args, id);
+ return vtable_size(lvtbl->args) - 1;
}
-static void
+static int
local_var_gen(struct parser_params *parser, ID id)
{
vtable_add(lvtbl->vars, id);
if (lvtbl->used) {
vtable_add(lvtbl->used, (ID)ruby_sourceline);
}
+ return vtable_size(lvtbl->vars) - 1;
}
static int
@@ -10462,21 +9743,6 @@ dyna_push_gen(struct parser_params *parser)
}
static void
-dyna_pop_vtable(struct parser_params *parser, struct vtable **vtblp)
-{
- struct vtable *tmp = *vtblp;
- *vtblp = tmp->prev;
-# if WARN_PAST_SCOPE
- if (parser->past_scope_enabled) {
- tmp->prev = lvtbl->past;
- lvtbl->past = tmp;
- return;
- }
-# endif
- vtable_free(tmp);
-}
-
-static void
dyna_pop_1(struct parser_params *parser)
{
struct vtable *tmp;
@@ -10486,8 +9752,12 @@ dyna_pop_1(struct parser_params *parser)
lvtbl->used = lvtbl->used->prev;
vtable_free(tmp);
}
- dyna_pop_vtable(parser, &lvtbl->args);
- dyna_pop_vtable(parser, &lvtbl->vars);
+ tmp = lvtbl->args;
+ lvtbl->args = lvtbl->args->prev;
+ vtable_free(tmp);
+ tmp = lvtbl->vars;
+ lvtbl->vars = lvtbl->vars->prev;
+ vtable_free(tmp);
}
static void
@@ -10633,10 +9903,10 @@ reg_named_capture_assign_iter(const OnigUChar *name, const OnigUChar *name_end,
!rb_enc_symname2_p(s, len, enc)) {
return ST_CONTINUE;
}
- var = intern_cstr(s, len, enc);
+ var = rb_intern3(s, len, enc);
if (dvar_defined(var) || local_id(var)) {
- rb_warning1("named capture conflicts a local variable - %"PRIsWARN,
- rb_id2str(var));
+ rb_warningS("named capture conflicts a local variable - %s",
+ rb_id2name(var));
}
arg->succ_block = block_append(arg->succ_block,
newline_node(node_assign(assignable(var,0),
@@ -10660,7 +9930,7 @@ reg_named_capture_assign_gen(struct parser_params* parser, VALUE regexp, NODE *m
arg.succ_block = 0;
arg.fail_block = 0;
arg.num = 0;
- onig_foreach_name(RREGEXP(regexp)->ptr, reg_named_capture_assign_iter, &arg);
+ onig_foreach_name(RREGEXP(regexp)->ptr, reg_named_capture_assign_iter, (void*)&arg);
if (arg.num == 0)
return match;
@@ -10683,25 +9953,20 @@ reg_named_capture_assign_gen(struct parser_params* parser, VALUE regexp, NODE *m
}
static VALUE
-parser_reg_compile(struct parser_params* parser, VALUE str, int options)
-{
- reg_fragment_setenc(str, options);
- return rb_reg_compile(str, options & RE_OPTION_MASK, ruby_sourcefile, ruby_sourceline);
-}
-
-static VALUE
reg_compile_gen(struct parser_params* parser, VALUE str, int options)
{
VALUE re;
VALUE err;
+ reg_fragment_setenc(str, options);
err = rb_errinfo();
- re = parser_reg_compile(parser, str, options);
+ re = rb_reg_compile(str, options & RE_OPTION_MASK, ruby_sourcefile, ruby_sourceline);
if (NIL_P(re)) {
- VALUE m = rb_attr_get(rb_errinfo(), idMesg);
+ ID mesg = rb_intern("mesg");
+ VALUE m = rb_attr_get(rb_errinfo(), mesg);
rb_set_errinfo(err);
if (!NIL_P(err)) {
- rb_str_append(rb_str_cat(rb_attr_get(err, idMesg), "\n", 1), m);
+ rb_str_append(rb_str_cat(rb_attr_get(err, mesg), "\n", 1), m);
}
else {
compile_error(PARSER_ARG "%"PRIsVALUE, m);
@@ -10711,16 +9976,9 @@ reg_compile_gen(struct parser_params* parser, VALUE str, int options)
return re;
}
-VALUE
-rb_parser_reg_compile(struct parser_params* parser, VALUE str, int options, VALUE *errmsg)
+void
+rb_gc_mark_parser(void)
{
- VALUE err = rb_errinfo();
- VALUE re = parser_reg_compile(parser, str, options);
- if (NIL_P(re)) {
- *errmsg = rb_attr_get(rb_errinfo(), idMesg);
- rb_set_errinfo(err);
- }
- return re;
}
NODE*
@@ -10796,12 +10054,110 @@ rb_parser_while_loop(VALUE vparser, NODE *node, int chop, int split)
return scope;
}
+static const struct {
+ ID token;
+ const char *name;
+} op_tbl[] = {
+ {tDOT2, ".."},
+ {tDOT3, "..."},
+ {tPOW, "**"},
+ {tDSTAR, "**"},
+ {tUPLUS, "+@"},
+ {tUMINUS, "-@"},
+ {tCMP, "<=>"},
+ {tGEQ, ">="},
+ {tLEQ, "<="},
+ {tEQ, "=="},
+ {tEQQ, "==="},
+ {tNEQ, "!="},
+ {tMATCH, "=~"},
+ {tNMATCH, "!~"},
+ {tAREF, "[]"},
+ {tASET, "[]="},
+ {tLSHFT, "<<"},
+ {tRSHFT, ">>"},
+ {tCOLON2, "::"},
+};
+
+#define op_tbl_count numberof(op_tbl)
+
+#ifndef ENABLE_SELECTOR_NAMESPACE
+#define ENABLE_SELECTOR_NAMESPACE 0
+#endif
+
+static struct symbols {
+ ID last_id;
+ st_table *sym_id;
+ st_table *id_str;
+#if ENABLE_SELECTOR_NAMESPACE
+ st_table *ivar2_id;
+ st_table *id_ivar2;
+#endif
+ VALUE op_sym[tLAST_OP_ID];
+ int minor_marked;
+} global_symbols = {tLAST_TOKEN};
+
+static const struct st_hash_type symhash = {
+ rb_str_hash_cmp,
+ rb_str_hash,
+};
+
+#if ENABLE_SELECTOR_NAMESPACE
+struct ivar2_key {
+ ID id;
+ VALUE klass;
+};
+
+static int
+ivar2_cmp(struct ivar2_key *key1, struct ivar2_key *key2)
+{
+ if (key1->id == key2->id && key1->klass == key2->klass) {
+ return 0;
+ }
+ return 1;
+}
+
+static int
+ivar2_hash(struct ivar2_key *key)
+{
+ return (key->id << 8) ^ (key->klass >> 2);
+}
+
+static const struct st_hash_type ivar2_hash_type = {
+ ivar2_cmp,
+ ivar2_hash,
+};
+#endif
+
void
-rb_init_parse(void)
+Init_sym(void)
{
- /* just to suppress unused-function warnings */
+ global_symbols.sym_id = st_init_table_with_size(&symhash, 1000);
+ global_symbols.id_str = st_init_numtable_with_size(1000);
+#if ENABLE_SELECTOR_NAMESPACE
+ global_symbols.ivar2_id = st_init_table_with_size(&ivar2_hash_type, 1000);
+ global_symbols.id_ivar2 = st_init_numtable_with_size(1000);
+#endif
+
(void)nodetype;
(void)nodeline;
+#if PARSER_DEBUG
+ (void)lex_state_name(-1);
+#endif
+
+ Init_id();
+}
+
+void
+rb_gc_mark_symbols(int full_mark)
+{
+ if (full_mark || global_symbols.minor_marked == 0) {
+ rb_mark_tbl(global_symbols.id_str);
+ rb_gc_mark_locations(global_symbols.op_sym,
+ global_symbols.op_sym + numberof(global_symbols.op_sym));
+
+ if (!full_mark) global_symbols.minor_marked = 1;
+ }
}
#endif /* !RIPPER */
@@ -10810,21 +10166,694 @@ internal_id_gen(struct parser_params *parser)
{
ID id = (ID)vtable_size(lvtbl->args) + (ID)vtable_size(lvtbl->vars);
id += ((tLAST_TOKEN - ID_INTERNAL) >> ID_SCOPE_SHIFT) + 1;
- return ID_STATIC_SYM | ID_INTERNAL | (id << ID_SCOPE_SHIFT);
+ return ID_INTERNAL | (id << ID_SCOPE_SHIFT);
+}
+
+#ifndef RIPPER
+static int
+is_special_global_name(const char *m, const char *e, rb_encoding *enc)
+{
+ int mb = 0;
+
+ if (m >= e) return 0;
+ if (is_global_name_punct(*m)) {
+ ++m;
+ }
+ else if (*m == '-') {
+ if (++m >= e) return 0;
+ if (is_identchar(m, e, enc)) {
+ if (!ISASCII(*m)) mb = 1;
+ m += rb_enc_mbclen(m, e, enc);
+ }
+ }
+ else {
+ if (!rb_enc_isdigit(*m, enc)) return 0;
+ do {
+ if (!ISASCII(*m)) mb = 1;
+ ++m;
+ } while (m < e && rb_enc_isdigit(*m, enc));
+ }
+ return m == e ? mb + 1 : 0;
+}
+
+int
+rb_symname_p(const char *name)
+{
+ return rb_enc_symname_p(name, rb_ascii8bit_encoding());
}
+int
+rb_enc_symname_p(const char *name, rb_encoding *enc)
+{
+ return rb_enc_symname2_p(name, strlen(name), enc);
+}
+
+#define IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST))
+#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<ID_SCOPE_MASK) & ~(1U<<ID_ATTRSET))
+
+static int
+rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset)
+{
+ const char *m = name;
+ const char *e = m + len;
+ int type = ID_JUNK;
+
+ if (!m || len <= 0) return -1;
+ switch (*m) {
+ case '\0':
+ return -1;
+
+ case '$':
+ type = ID_GLOBAL;
+ if (is_special_global_name(++m, e, enc)) return type;
+ goto id;
+
+ case '@':
+ type = ID_INSTANCE;
+ if (*++m == '@') {
+ ++m;
+ type = ID_CLASS;
+ }
+ goto id;
+
+ case '<':
+ switch (*++m) {
+ case '<': ++m; break;
+ case '=': if (*++m == '>') ++m; break;
+ default: break;
+ }
+ break;
+
+ case '>':
+ switch (*++m) {
+ case '>': case '=': ++m; break;
+ }
+ break;
+
+ case '=':
+ switch (*++m) {
+ case '~': ++m; break;
+ case '=': if (*++m == '=') ++m; break;
+ default: return -1;
+ }
+ break;
+
+ case '*':
+ if (*++m == '*') ++m;
+ break;
+
+ case '+': case '-':
+ if (*++m == '@') ++m;
+ break;
+
+ case '|': case '^': case '&': case '/': case '%': case '~': case '`':
+ ++m;
+ break;
+
+ case '[':
+ if (*++m != ']') return -1;
+ if (*++m == '=') ++m;
+ break;
+
+ case '!':
+ if (len == 1) return ID_JUNK;
+ switch (*++m) {
+ case '=': case '~': ++m; break;
+ default: return -1;
+ }
+ break;
+
+ default:
+ type = rb_enc_isupper(*m, enc) ? ID_CONST : ID_LOCAL;
+ id:
+ if (m >= e || (*m != '_' && !rb_enc_isalpha(*m, enc) && ISASCII(*m)))
+ return -1;
+ while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc);
+ if (m >= e) break;
+ switch (*m) {
+ case '!': case '?':
+ if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
+ type = ID_JUNK;
+ ++m;
+ break;
+ case '=':
+ if (!(allowed_attrset & (1U << type))) return -1;
+ type = ID_ATTRSET;
+ ++m;
+ break;
+ }
+ break;
+ }
+ return m == e ? type : -1;
+}
+
+int
+rb_enc_symname2_p(const char *name, long len, rb_encoding *enc)
+{
+ return rb_enc_symname_type(name, len, enc, IDSET_ATTRSET_FOR_SYNTAX) != -1;
+}
+
+static int
+rb_str_symname_type(VALUE name, unsigned int allowed_attrset)
+{
+ const char *ptr = StringValuePtr(name);
+ long len = RSTRING_LEN(name);
+ int type = rb_enc_symname_type(ptr, len, rb_enc_get(name), allowed_attrset);
+ RB_GC_GUARD(name);
+ return type;
+}
+
+static ID
+register_symid(ID id, const char *name, long len, rb_encoding *enc)
+{
+ VALUE str = rb_enc_str_new(name, len, enc);
+ return register_symid_str(id, str);
+}
+
+static ID
+register_symid_str(ID id, VALUE str)
+{
+ OBJ_FREEZE(str);
+
+ if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
+ RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(str), rb_sourcefile(), rb_sourceline());
+ }
+
+ st_add_direct(global_symbols.sym_id, (st_data_t)str, id);
+ st_add_direct(global_symbols.id_str, id, (st_data_t)str);
+ global_symbols.minor_marked = 0;
+ return id;
+}
+
+static int
+sym_check_asciionly(VALUE str)
+{
+ if (!rb_enc_asciicompat(rb_enc_get(str))) return FALSE;
+ switch (rb_enc_str_coderange(str)) {
+ case ENC_CODERANGE_BROKEN:
+ rb_raise(rb_eEncodingError, "invalid encoding symbol");
+ case ENC_CODERANGE_7BIT:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*
+ * _str_ itself will be registered at the global symbol table. _str_
+ * can be modified before the registration, since the encoding will be
+ * set to ASCII-8BIT if it is a special global name.
+ */
+static ID intern_str(VALUE str);
+
+static VALUE
+setup_fake_str(struct RString *fake_str, const char *name, long len)
+{
+ fake_str->basic.flags = T_STRING|RSTRING_NOEMBED;
+ RBASIC_SET_CLASS((VALUE)fake_str, rb_cString);
+ fake_str->as.heap.len = len;
+ fake_str->as.heap.ptr = (char *)name;
+ fake_str->as.heap.aux.capa = len;
+ return (VALUE)fake_str;
+}
+
+ID
+rb_intern3(const char *name, long len, rb_encoding *enc)
+{
+ st_data_t data;
+ struct RString fake_str;
+ VALUE str = setup_fake_str(&fake_str, name, len);
+ rb_enc_associate(str, enc);
+ OBJ_FREEZE(str);
+
+ if (st_lookup(global_symbols.sym_id, str, &data))
+ return (ID)data;
+
+ str = rb_enc_str_new(name, len, enc); /* make true string */
+ return intern_str(str);
+}
+
+static ID
+intern_str(VALUE str)
+{
+ const char *name, *m, *e;
+ long len, last;
+ rb_encoding *enc, *symenc;
+ unsigned char c;
+ ID id;
+ int mb;
+
+ RSTRING_GETMEM(str, name, len);
+ m = name;
+ e = m + len;
+ enc = rb_enc_get(str);
+ symenc = enc;
+
+ if (!len || (rb_cString && !rb_enc_asciicompat(enc))) {
+ junk:
+ id = ID_JUNK;
+ goto new_id;
+ }
+ last = len-1;
+ id = 0;
+ switch (*m) {
+ case '$':
+ if (len < 2) goto junk;
+ id |= ID_GLOBAL;
+ if ((mb = is_special_global_name(++m, e, enc)) != 0) {
+ if (!--mb) symenc = rb_usascii_encoding();
+ goto new_id;
+ }
+ break;
+ case '@':
+ if (m[1] == '@') {
+ if (len < 3) goto junk;
+ m++;
+ id |= ID_CLASS;
+ }
+ else {
+ if (len < 2) goto junk;
+ id |= ID_INSTANCE;
+ }
+ m++;
+ break;
+ default:
+ c = m[0];
+ if (c != '_' && rb_enc_isascii(c, enc) && rb_enc_ispunct(c, enc)) {
+ /* operators */
+ int i;
+
+ if (len == 1) {
+ id = c;
+ goto id_register;
+ }
+ for (i = 0; i < op_tbl_count; i++) {
+ if (*op_tbl[i].name == *m &&
+ strcmp(op_tbl[i].name, m) == 0) {
+ id = op_tbl[i].token;
+ goto id_register;
+ }
+ }
+ }
+ break;
+ }
+ if (name[last] == '=') {
+ /* attribute assignment */
+ if (last > 1 && name[last-1] == '=')
+ goto junk;
+ id = rb_intern3(name, last, enc);
+ if (id > tLAST_OP_ID && !is_attrset_id(id)) {
+ enc = rb_enc_get(rb_id2str(id));
+ id = rb_id_attrset(id);
+ goto id_register;
+ }
+ id = ID_ATTRSET;
+ }
+ else if (id == 0) {
+ if (rb_enc_isupper(m[0], enc)) {
+ id = ID_CONST;
+ }
+ else {
+ id = ID_LOCAL;
+ }
+ }
+ if (!rb_enc_isdigit(*m, enc)) {
+ while (m <= name + last && is_identchar(m, e, enc)) {
+ if (ISASCII(*m)) {
+ m++;
+ }
+ else {
+ m += rb_enc_mbclen(m, e, enc);
+ }
+ }
+ }
+ if (id != ID_ATTRSET && m - name < len) id = ID_JUNK;
+ if (sym_check_asciionly(str)) symenc = rb_usascii_encoding();
+ new_id:
+ if (symenc != enc) rb_enc_associate(str, symenc);
+ if (global_symbols.last_id >= ~(ID)0 >> (ID_SCOPE_SHIFT+RUBY_SPECIAL_SHIFT)) {
+ if (len > 20) {
+ rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.20s...)",
+ name);
+ }
+ else {
+ rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %.*s)",
+ (int)len, name);
+ }
+ }
+ id |= ++global_symbols.last_id << ID_SCOPE_SHIFT;
+ id_register:
+ return register_symid_str(id, str);
+}
+
+ID
+rb_intern2(const char *name, long len)
+{
+ return rb_intern3(name, len, rb_usascii_encoding());
+}
+
+#undef rb_intern
+ID
+rb_intern(const char *name)
+{
+ return rb_intern2(name, strlen(name));
+}
+
+ID
+rb_intern_str(VALUE str)
+{
+ st_data_t id;
+
+ if (st_lookup(global_symbols.sym_id, str, &id))
+ return (ID)id;
+ return intern_str(rb_str_dup(str));
+}
+
+VALUE
+rb_id2str(ID id)
+{
+ st_data_t data;
+
+ if (id < tLAST_TOKEN) {
+ int i = 0;
+
+ if (id < INT_MAX && rb_ispunct((int)id)) {
+ VALUE str = global_symbols.op_sym[i = (int)id];
+ if (!str) {
+ char name[2];
+ name[0] = (char)id;
+ name[1] = 0;
+ str = rb_usascii_str_new(name, 1);
+ OBJ_FREEZE(str);
+ global_symbols.op_sym[i] = str;
+ global_symbols.minor_marked = 0;
+ }
+ return str;
+ }
+ for (i = 0; i < op_tbl_count; i++) {
+ if (op_tbl[i].token == id) {
+ VALUE str = global_symbols.op_sym[i];
+ if (!str) {
+ str = rb_usascii_str_new2(op_tbl[i].name);
+ OBJ_FREEZE(str);
+ global_symbols.op_sym[i] = str;
+ global_symbols.minor_marked = 0;
+ }
+ return str;
+ }
+ }
+ }
+
+ if (st_lookup(global_symbols.id_str, id, &data)) {
+ VALUE str = (VALUE)data;
+ if (RBASIC(str)->klass == 0)
+ RBASIC_SET_CLASS_RAW(str, rb_cString);
+ return str;
+ }
+
+ if (is_attrset_id(id)) {
+ ID id_stem = (id & ~ID_SCOPE_MASK);
+ VALUE str;
+
+ do {
+ if (!!(str = rb_id2str(id_stem | ID_LOCAL))) break;
+ if (!!(str = rb_id2str(id_stem | ID_CONST))) break;
+ if (!!(str = rb_id2str(id_stem | ID_INSTANCE))) break;
+ if (!!(str = rb_id2str(id_stem | ID_GLOBAL))) break;
+ if (!!(str = rb_id2str(id_stem | ID_CLASS))) break;
+ if (!!(str = rb_id2str(id_stem | ID_JUNK))) break;
+ return 0;
+ } while (0);
+ str = rb_str_dup(str);
+ rb_str_cat(str, "=", 1);
+ register_symid_str(id, str);
+ if (st_lookup(global_symbols.id_str, id, &data)) {
+ VALUE str = (VALUE)data;
+ if (RBASIC(str)->klass == 0)
+ RBASIC_SET_CLASS_RAW(str, rb_cString);
+ return str;
+ }
+ }
+ return 0;
+}
+
+const char *
+rb_id2name(ID id)
+{
+ VALUE str = rb_id2str(id);
+
+ if (!str) return 0;
+ return RSTRING_PTR(str);
+}
+
+static int
+symbols_i(VALUE sym, ID value, VALUE ary)
+{
+ rb_ary_push(ary, ID2SYM(value));
+ return ST_CONTINUE;
+}
+
+/*
+ * call-seq:
+ * Symbol.all_symbols => array
+ *
+ * Returns an array of all the symbols currently in Ruby's symbol
+ * table.
+ *
+ * Symbol.all_symbols.size #=> 903
+ * Symbol.all_symbols[1,20] #=> [:floor, :ARGV, :Binding, :symlink,
+ * :chown, :EOFError, :$;, :String,
+ * :LOCK_SH, :"setuid?", :$<,
+ * :default_proc, :compact, :extend,
+ * :Tms, :getwd, :$=, :ThreadGroup,
+ * :wait2, :$>]
+ */
+
+VALUE
+rb_sym_all_symbols(void)
+{
+ VALUE ary = rb_ary_new2(global_symbols.sym_id->num_entries);
+
+ st_foreach(global_symbols.sym_id, symbols_i, ary);
+ return ary;
+}
+
+int
+rb_is_const_id(ID id)
+{
+ return is_const_id(id);
+}
+
+int
+rb_is_class_id(ID id)
+{
+ return is_class_id(id);
+}
+
+int
+rb_is_global_id(ID id)
+{
+ return is_global_id(id);
+}
+
+int
+rb_is_instance_id(ID id)
+{
+ return is_instance_id(id);
+}
+
+int
+rb_is_attrset_id(ID id)
+{
+ return is_attrset_id(id);
+}
+
+int
+rb_is_local_id(ID id)
+{
+ return is_local_id(id);
+}
+
+int
+rb_is_junk_id(ID id)
+{
+ return is_junk_id(id);
+}
+
+/**
+ * Returns ID for the given name if it is interned already, or 0.
+ *
+ * \param namep the pointer to the name object
+ * \return the ID for *namep
+ * \pre the object referred by \p namep must be a Symbol or
+ * a String, or possible to convert with to_str method.
+ * \post the object referred by \p namep is a Symbol or a
+ * String if non-zero value is returned, or is a String
+ * if 0 is returned.
+ */
+ID
+rb_check_id(volatile VALUE *namep)
+{
+ st_data_t id;
+ VALUE tmp;
+ VALUE name = *namep;
+
+ if (SYMBOL_P(name)) {
+ return SYM2ID(name);
+ }
+ else if (!RB_TYPE_P(name, T_STRING)) {
+ tmp = rb_check_string_type(name);
+ if (NIL_P(tmp)) {
+ tmp = rb_inspect(name);
+ rb_raise(rb_eTypeError, "%s is not a symbol",
+ RSTRING_PTR(tmp));
+ }
+ name = tmp;
+ *namep = name;
+ }
+
+ sym_check_asciionly(name);
+
+ if (st_lookup(global_symbols.sym_id, (st_data_t)name, &id))
+ return (ID)id;
+
+ if (rb_is_attrset_name(name)) {
+ struct RString fake_str;
+ /* make local name by chopping '=' */
+ const VALUE localname = setup_fake_str(&fake_str, RSTRING_PTR(name), RSTRING_LEN(name) - 1);
+ rb_enc_copy(localname, name);
+ OBJ_FREEZE(localname);
+
+ if (st_lookup(global_symbols.sym_id, (st_data_t)localname, &id)) {
+ return rb_id_attrset((ID)id);
+ }
+ RB_GC_GUARD(name);
+ }
+
+ return (ID)0;
+}
+
+ID
+rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
+{
+ st_data_t id;
+ struct RString fake_str;
+ const VALUE name = setup_fake_str(&fake_str, ptr, len);
+ rb_enc_associate(name, enc);
+
+ sym_check_asciionly(name);
+
+ if (st_lookup(global_symbols.sym_id, (st_data_t)name, &id))
+ return (ID)id;
+
+ if (rb_is_attrset_name(name)) {
+ fake_str.as.heap.len = len - 1;
+ if (st_lookup(global_symbols.sym_id, (st_data_t)name, &id)) {
+ return rb_id_attrset((ID)id);
+ }
+ }
+
+ return (ID)0;
+}
+
+int
+rb_is_const_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_CONST;
+}
+
+int
+rb_is_class_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_CLASS;
+}
+
+int
+rb_is_global_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_GLOBAL;
+}
+
+int
+rb_is_instance_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_INSTANCE;
+}
+
+int
+rb_is_attrset_name(VALUE name)
+{
+ return rb_str_symname_type(name, IDSET_ATTRSET_FOR_INTERN) == ID_ATTRSET;
+}
+
+int
+rb_is_local_name(VALUE name)
+{
+ return rb_str_symname_type(name, 0) == ID_LOCAL;
+}
+
+int
+rb_is_method_name(VALUE name)
+{
+ switch (rb_str_symname_type(name, 0)) {
+ case ID_LOCAL: case ID_ATTRSET: case ID_JUNK:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+rb_is_junk_name(VALUE name)
+{
+ return rb_str_symname_type(name, IDSET_ATTRSET_FOR_SYNTAX) == -1;
+}
+
+#endif /* !RIPPER */
+
static void
parser_initialize(struct parser_params *parser)
{
- /* note: we rely on TypedData_Make_Struct to set most fields to 0 */
- command_start = TRUE;
- ruby_sourcefile_string = Qnil;
-#ifdef RIPPER
+ parser->eofp = Qfalse;
+
+ parser->parser_lex_strterm = 0;
+ parser->parser_cond_stack = 0;
+ parser->parser_cmdarg_stack = 0;
+ parser->parser_class_nest = 0;
+ parser->parser_paren_nest = 0;
+ parser->parser_lpar_beg = 0;
+ parser->parser_brace_nest = 0;
+ parser->parser_in_single = 0;
+ parser->parser_in_def = 0;
+ parser->parser_in_defined = 0;
+ parser->parser_compile_for_eval = 0;
+ parser->parser_cur_mid = 0;
+ parser->parser_tokenbuf = NULL;
+ parser->parser_tokidx = 0;
+ parser->parser_toksiz = 0;
+ parser->parser_heredoc_end = 0;
+ parser->parser_command_start = TRUE;
+ parser->parser_deferred_nodes = 0;
+ parser->parser_lex_pbeg = 0;
+ parser->parser_lex_p = 0;
+ parser->parser_lex_pend = 0;
+ parser->parser_lvtbl = 0;
+ parser->parser_ruby__end__seen = 0;
+ parser->parser_ruby_sourcefile = 0;
+ parser->parser_ruby_sourcefile_string = Qnil;
+#ifndef RIPPER
+ parser->is_ripper = 0;
+ parser->parser_eval_tree_begin = 0;
+ parser->parser_eval_tree = 0;
+#else
+ parser->is_ripper = 1;
parser->delayed = Qnil;
+
parser->result = Qnil;
parser->parsing_thread = Qnil;
+ parser->toplevel_p = TRUE;
+#endif
+#ifdef YYMALLOC
+ parser->heap = NULL;
#endif
- parser->debug_buffer = Qnil;
parser->enc = rb_utf8_encoding();
}
@@ -10836,82 +10865,74 @@ parser_initialize(struct parser_params *parser)
static void
parser_mark(void *ptr)
{
- struct parser_params *parser = (struct parser_params*)ptr;
+ struct parser_params *p = (struct parser_params*)ptr;
- rb_gc_mark((VALUE)lex_strterm);
- rb_gc_mark((VALUE)deferred_nodes);
- rb_gc_mark(lex_input);
- rb_gc_mark(lex_lastline);
- rb_gc_mark(lex_nextline);
- rb_gc_mark(ruby_sourcefile_string);
+ rb_gc_mark((VALUE)p->parser_lex_strterm);
+ rb_gc_mark((VALUE)p->parser_deferred_nodes);
+ rb_gc_mark(p->parser_lex_input);
+ rb_gc_mark(p->parser_lex_lastline);
+ rb_gc_mark(p->parser_lex_nextline);
+ rb_gc_mark(p->parser_ruby_sourcefile_string);
#ifndef RIPPER
- rb_gc_mark((VALUE)ruby_eval_tree_begin);
- rb_gc_mark((VALUE)ruby_eval_tree);
- rb_gc_mark(ruby_debug_lines);
- rb_gc_mark(parser->compile_option);
+ rb_gc_mark((VALUE)p->parser_eval_tree_begin) ;
+ rb_gc_mark((VALUE)p->parser_eval_tree) ;
+ rb_gc_mark(p->debug_lines);
#else
- rb_gc_mark(parser->delayed);
- rb_gc_mark(parser->value);
- rb_gc_mark(parser->result);
- rb_gc_mark(parser->parsing_thread);
+ rb_gc_mark(p->delayed);
+ rb_gc_mark(p->value);
+ rb_gc_mark(p->result);
+ rb_gc_mark(p->parsing_thread);
#endif
- rb_gc_mark(parser->debug_buffer);
#ifdef YYMALLOC
- rb_gc_mark((VALUE)parser->heap);
+ rb_gc_mark((VALUE)p->heap);
#endif
}
static void
parser_free(void *ptr)
{
- struct parser_params *parser = (struct parser_params*)ptr;
+ struct parser_params *p = (struct parser_params*)ptr;
struct local_vars *local, *prev;
- if (tokenbuf) {
- xfree(tokenbuf);
+ if (p->parser_tokenbuf) {
+ xfree(p->parser_tokenbuf);
}
- for (local = lvtbl; local; local = prev) {
+ for (local = p->parser_lvtbl; local; local = prev) {
if (local->vars) xfree(local->vars);
prev = local->prev;
xfree(local);
}
- {
- token_info *ptinfo;
- while ((ptinfo = parser->token_info) != 0) {
- parser->token_info = ptinfo->next;
- xfree(ptinfo);
- }
- }
- xfree(ptr);
+ xfree(p);
}
static size_t
parser_memsize(const void *ptr)
{
- struct parser_params *parser = (struct parser_params*)ptr;
+ struct parser_params *p = (struct parser_params*)ptr;
struct local_vars *local;
- size_t size = sizeof(*parser);
+ size_t size = sizeof(*p);
- size += toksiz;
- for (local = lvtbl; local; local = local->prev) {
+ if (!ptr) return 0;
+ size += p->parser_toksiz;
+ for (local = p->parser_lvtbl; local; local = local->prev) {
size += sizeof(*local);
if (local->vars) size += local->vars->capa * sizeof(ID);
}
return size;
}
-static const rb_data_type_t parser_data_type = {
+static
#ifndef RIPPER
- "parser",
-#else
- "ripper",
+const
#endif
+rb_data_type_t parser_data_type = {
+ "parser",
{
parser_mark,
parser_free,
parser_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#ifndef RIPPER
@@ -10923,42 +10944,24 @@ rb_reserved_word(const char *str, unsigned int len)
return reserved_word(str, len);
}
-VALUE
-rb_parser_new(void)
+static struct parser_params *
+parser_new(void)
{
struct parser_params *p;
- VALUE parser = TypedData_Make_Struct(0, struct parser_params,
- &parser_data_type, p);
+
+ p = ALLOC_N(struct parser_params, 1);
+ MEMZERO(p, struct parser_params, 1);
parser_initialize(p);
- return parser;
+ return p;
}
-#endif
-#ifdef RIPPER
-#define rb_parser_end_seen_p ripper_parser_end_seen_p
-#define rb_parser_encoding ripper_parser_encoding
-#define rb_parser_get_yydebug ripper_parser_get_yydebug
-#define rb_parser_set_yydebug ripper_parser_set_yydebug
-static VALUE ripper_parser_end_seen_p(VALUE vparser);
-static VALUE ripper_parser_encoding(VALUE vparser);
-static VALUE ripper_parser_get_yydebug(VALUE self);
-static VALUE ripper_parser_set_yydebug(VALUE self, VALUE flag);
-
-/*
- * call-seq:
- * ripper#error? -> Boolean
- *
- * Return true if parsed source has errors.
- */
-static VALUE
-ripper_error_p(VALUE vparser)
+VALUE
+rb_parser_new(void)
{
- struct parser_params *parser;
+ struct parser_params *p = parser_new();
- TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
- return parser->error_p ? Qtrue : Qfalse;
+ return TypedData_Wrap_Struct(0, &parser_data_type, p);
}
-#endif
/*
* call-seq:
@@ -11021,7 +11024,6 @@ rb_parser_set_yydebug(VALUE self, VALUE flag)
return flag;
}
-#ifndef RIPPER
#ifdef YYMALLOC
#define HEAPCNT(n, size) ((n) * (size) / sizeof(YYSTYPE))
#define NEWHEAP() rb_node_newnode(NODE_ALLOCA, 0, (VALUE)parser->heap, 0)
@@ -11084,22 +11086,6 @@ rb_parser_free(struct parser_params *parser, void *ptr)
xfree(ptr);
}
#endif
-
-void
-rb_parser_printf(struct parser_params *parser, const char *fmt, ...)
-{
- va_list ap;
- VALUE mesg = parser->debug_buffer;
-
- if (NIL_P(mesg)) parser->debug_buffer = mesg = rb_str_new(0, 0);
- va_start(ap, fmt);
- rb_str_vcatf(mesg, fmt, ap);
- va_end(ap);
- if (RSTRING_END(mesg)[-1] == '\n') {
- rb_io_write(rb_stdout, mesg);
- parser->debug_buffer = Qnil;
- }
-}
#endif
#ifdef RIPPER
@@ -11129,7 +11115,7 @@ ripper_validate_object(VALUE self, VALUE x)
case T_RATIONAL:
return x;
case T_NODE:
- if (nd_type(x) != NODE_RIPPER) {
+ if (nd_type(x) != NODE_LASGN) {
rb_raise(rb_eArgError, "NODE given: %p", x);
}
return ((NODE *)x)->nd_rval;
@@ -11281,7 +11267,7 @@ ripper_id2sym(ID id)
const char *name;
char buf[8];
- if (ISASCII(id)) {
+ if (id <= 256) {
buf[0] = (char)id;
buf[1] = '\0';
return ID2SYM(rb_intern2(buf, 1));
@@ -11289,10 +11275,21 @@ ripper_id2sym(ID id)
if ((name = keyword_id_to_str(id))) {
return ID2SYM(rb_intern(name));
}
- if (!rb_id2str(id)) {
- rb_bug("cannot convert ID to string: %ld", (unsigned long)id);
+ switch (id) {
+ case tOROP:
+ name = "||";
+ break;
+ case tANDOP:
+ name = "&&";
+ break;
+ default:
+ name = rb_id2name(id);
+ if (!name) {
+ rb_bug("cannot convert ID to string: %ld", (unsigned long)id);
+ }
+ return ID2SYM(id);
}
- return ID2SYM(id);
+ return ID2SYM(rb_intern(name));
}
static ID
@@ -11301,7 +11298,7 @@ ripper_get_id(VALUE v)
NODE *nd;
if (!RB_TYPE_P(v, T_NODE)) return 0;
nd = (NODE *)v;
- if (nd_type(nd) != NODE_RIPPER) return 0;
+ if (nd_type(nd) != NODE_LASGN) return 0;
return nd->nd_vid;
}
@@ -11312,17 +11309,11 @@ ripper_get_value(VALUE v)
if (v == Qundef) return Qnil;
if (!RB_TYPE_P(v, T_NODE)) return v;
nd = (NODE *)v;
- if (nd_type(nd) != NODE_RIPPER) return Qnil;
+ if (nd_type(nd) != NODE_LASGN) return Qnil;
return nd->nd_rval;
}
static void
-ripper_error_gen(struct parser_params *parser)
-{
- parser->error_p = TRUE;
-}
-
-static void
ripper_compile_error(struct parser_params *parser, const char *fmt, ...)
{
VALUE str;
@@ -11332,7 +11323,39 @@ ripper_compile_error(struct parser_params *parser, const char *fmt, ...)
str = rb_vsprintf(fmt, args);
va_end(args);
rb_funcall(parser->value, rb_intern("compile_error"), 1, str);
- ripper_error_gen(parser);
+}
+
+static void
+ripper_warn0(struct parser_params *parser, const char *fmt)
+{
+ rb_funcall(parser->value, rb_intern("warn"), 1, STR_NEW2(fmt));
+}
+
+static void
+ripper_warnI(struct parser_params *parser, const char *fmt, int a)
+{
+ rb_funcall(parser->value, rb_intern("warn"), 2,
+ STR_NEW2(fmt), INT2NUM(a));
+}
+
+static void
+ripper_warnS(struct parser_params *parser, const char *fmt, const char *str)
+{
+ rb_funcall(parser->value, rb_intern("warn"), 2,
+ STR_NEW2(fmt), STR_NEW2(str));
+}
+
+static void
+ripper_warning0(struct parser_params *parser, const char *fmt)
+{
+ rb_funcall(parser->value, rb_intern("warning"), 1, STR_NEW2(fmt));
+}
+
+static void
+ripper_warningS(struct parser_params *parser, const char *fmt, const char *str)
+{
+ rb_funcall(parser->value, rb_intern("warning"), 2,
+ STR_NEW2(fmt), STR_NEW2(str));
}
static VALUE
@@ -11345,13 +11368,16 @@ static VALUE
ripper_s_allocate(VALUE klass)
{
struct parser_params *p;
- VALUE self = TypedData_Make_Struct(klass, struct parser_params,
- &parser_data_type, p);
+ VALUE self;
+
+ p = ALLOC_N(struct parser_params, 1);
+ MEMZERO(p, struct parser_params, 1);
+ self = TypedData_Wrap_Struct(klass, &parser_data_type, p);
p->value = self;
return self;
}
-#define ripper_initialized_p(r) ((r)->lex.input != 0)
+#define ripper_initialized_p(r) ((r)->parser_lex_input != 0)
/*
* call-seq:
@@ -11372,27 +11398,25 @@ ripper_initialize(int argc, VALUE *argv, VALUE self)
TypedData_Get_Struct(self, struct parser_params, &parser_data_type, parser);
rb_scan_args(argc, argv, "12", &src, &fname, &lineno);
if (RB_TYPE_P(src, T_FILE)) {
- lex_gets = ripper_lex_get_generic;
+ parser->parser_lex_gets = ripper_lex_get_generic;
}
else {
StringValue(src);
- lex_gets = lex_get_str;
+ parser->parser_lex_gets = lex_get_str;
}
- lex_input = src;
- parser->eofp = 0;
+ parser->parser_lex_input = src;
+ parser->eofp = Qfalse;
if (NIL_P(fname)) {
fname = STR_NEW2("(ripper)");
- OBJ_FREEZE(fname);
}
else {
StringValue(fname);
- fname = rb_str_new_frozen(fname);
}
parser_initialize(parser);
- ruby_sourcefile_string = fname;
- ruby_sourcefile = RSTRING_PTR(fname);
- ruby_sourceline = NIL_P(lineno) ? 0 : NUM2INT(lineno) - 1;
+ parser->parser_ruby_sourcefile_string = fname;
+ parser->parser_ruby_sourcefile = RSTRING_PTR(fname);
+ parser->parser_ruby_sourceline = NIL_P(lineno) ? 0 : NUM2INT(lineno) - 1;
return Qnil;
}
@@ -11469,7 +11493,7 @@ ripper_column(VALUE self)
rb_raise(rb_eArgError, "method called for uninitialized object");
}
if (NIL_P(parser->parsing_thread)) return Qnil;
- col = parser->tokp - lex_pbeg;
+ col = parser->tokp - parser->parser_lex_pbeg;
return LONG2NUM(col);
}
@@ -11488,7 +11512,7 @@ ripper_filename(VALUE self)
if (!ripper_initialized_p(parser)) {
rb_raise(rb_eArgError, "method called for uninitialized object");
}
- return ruby_sourcefile_string;
+ return parser->parser_ruby_sourcefile_string;
}
/*
@@ -11508,7 +11532,7 @@ ripper_lineno(VALUE self)
rb_raise(rb_eArgError, "method called for uninitialized object");
}
if (NIL_P(parser->parsing_thread)) return Qnil;
- return INT2NUM(ruby_sourceline);
+ return INT2NUM(parser->parser_ruby_sourceline);
}
#ifdef RIPPER_DEBUG
@@ -11535,10 +11559,13 @@ ripper_value(VALUE self, VALUE obj)
void
Init_ripper(void)
{
+ parser_data_type.parent = RTYPEDDATA_TYPE(rb_parser_new());
+
ripper_init_eventids1();
ripper_init_eventids2();
- id_warn = rb_intern_const("warn");
- id_warning = rb_intern_const("warning");
+ /* ensure existing in symbol table */
+ (void)rb_intern("||");
+ (void)rb_intern("&&");
InitVM(ripper);
}
@@ -11561,16 +11588,12 @@ InitVM_ripper(void)
rb_define_method(Ripper, "encoding", rb_parser_encoding, 0);
rb_define_method(Ripper, "yydebug", rb_parser_get_yydebug, 0);
rb_define_method(Ripper, "yydebug=", rb_parser_set_yydebug, 1);
- rb_define_method(Ripper, "error?", ripper_error_p, 0);
#ifdef RIPPER_DEBUG
rb_define_method(rb_mKernel, "assert_Qundef", ripper_assert_Qundef, 2);
rb_define_method(rb_mKernel, "rawVALUE", ripper_value, 1);
rb_define_method(rb_mKernel, "validate_object", ripper_validate_object, 1);
#endif
- rb_define_singleton_method(Ripper, "dedent_string", parser_dedent_string, 2);
- rb_define_private_method(Ripper, "dedent_string", parser_dedent_string, 2);
-
ripper_init_eventids1_table(Ripper);
ripper_init_eventids2_table(Ripper);
diff --git a/prelude.rb b/prelude.rb
index 80f178d3bd..2b371e7134 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -4,131 +4,12 @@ class Thread
# call-seq:
# Thread.exclusive { block } => obj
#
- # Wraps the block in a single, VM-global Mutex.synchronize, returning the
- # value of the block. A thread executing inside the exclusive section will
- # only block other threads which also use the Thread.exclusive mechanism.
+ # Wraps a block in Thread.critical, restoring the original value
+ # upon exit from the critical section, and returns the value of the
+ # block.
def self.exclusive
- warn "Thread.exclusive is deprecated, use Mutex", caller
MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
yield
}
end
end
-
-class IO
-
- # call-seq:
- # ios.read_nonblock(maxlen [, options]) -> string
- # ios.read_nonblock(maxlen, outbuf [, options]) -> outbuf
- #
- # Reads at most <i>maxlen</i> bytes from <em>ios</em> using
- # the read(2) system call after O_NONBLOCK is set for
- # the underlying file descriptor.
- #
- # If the optional <i>outbuf</i> argument is present,
- # it must reference a String, which will receive the data.
- # The <i>outbuf</i> will contain only the received data after the method call
- # even if it is not empty at the beginning.
- #
- # read_nonblock just calls the read(2) system call.
- # It causes all errors the read(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc.
- # The caller should care such errors.
- #
- # If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN,
- # it is extended by IO::WaitReadable.
- # So IO::WaitReadable can be used to rescue the exceptions for retrying
- # read_nonblock.
- #
- # read_nonblock causes EOFError on EOF.
- #
- # If the read byte buffer is not empty,
- # read_nonblock reads from the buffer like readpartial.
- # In this case, the read(2) system call is not called.
- #
- # When read_nonblock raises an exception kind of IO::WaitReadable,
- # read_nonblock should not be called
- # until io is readable for avoiding busy loop.
- # This can be done as follows.
- #
- # # emulates blocking read (readpartial).
- # begin
- # result = io.read_nonblock(maxlen)
- # rescue IO::WaitReadable
- # IO.select([io])
- # retry
- # end
- #
- # Although IO#read_nonblock doesn't raise IO::WaitWritable.
- # OpenSSL::Buffering#read_nonblock can raise IO::WaitWritable.
- # If IO and SSL should be used polymorphically,
- # IO::WaitWritable should be rescued too.
- # See the document of OpenSSL::Buffering#read_nonblock for sample code.
- #
- # Note that this method is identical to readpartial
- # except the non-blocking flag is set.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that read_nonblock should not raise an IO::WaitReadable exception, but
- # return the symbol :wait_readable instead.
- def read_nonblock(len, buf = nil, exception: true)
- __read_nonblock(len, buf, exception)
- end
-
- # call-seq:
- # ios.write_nonblock(string) -> integer
- # ios.write_nonblock(string [, options]) -> integer
- #
- # Writes the given string to <em>ios</em> using
- # the write(2) system call after O_NONBLOCK is set for
- # the underlying file descriptor.
- #
- # It returns the number of bytes written.
- #
- # write_nonblock just calls the write(2) system call.
- # It causes all errors the write(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc.
- # The result may also be smaller than string.length (partial write).
- # The caller should care such errors and partial write.
- #
- # If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN,
- # it is extended by IO::WaitWritable.
- # So IO::WaitWritable can be used to rescue the exceptions for retrying write_nonblock.
- #
- # # Creates a pipe.
- # r, w = IO.pipe
- #
- # # write_nonblock writes only 65536 bytes and return 65536.
- # # (The pipe size is 65536 bytes on this environment.)
- # s = "a" #100000
- # p w.write_nonblock(s) #=> 65536
- #
- # # write_nonblock cannot write a byte and raise EWOULDBLOCK (EAGAIN).
- # p w.write_nonblock("b") # Resource temporarily unavailable (Errno::EAGAIN)
- #
- # If the write buffer is not empty, it is flushed at first.
- #
- # When write_nonblock raises an exception kind of IO::WaitWritable,
- # write_nonblock should not be called
- # until io is writable for avoiding busy loop.
- # This can be done as follows.
- #
- # begin
- # result = io.write_nonblock(string)
- # rescue IO::WaitWritable, Errno::EINTR
- # IO.select(nil, [io])
- # retry
- # end
- #
- # Note that this doesn't guarantee to write all data in string.
- # The length written is reported as result and it should be checked later.
- #
- # On some platforms such as Windows, write_nonblock is not supported
- # according to the kind of the IO object.
- # In such cases, write_nonblock raises <code>Errno::EBADF</code>.
- #
- # By specifying `exception: false`, the options hash allows you to indicate
- # that write_nonblock should not raise an IO::WaitWritable exception, but
- # return the symbol :wait_writable instead.
- def write_nonblock(buf, exception: true)
- __write_nonblock(buf, exception)
- end
-end
diff --git a/probes.d b/probes.d
index 57a3d762bd..dd7a7bfcd3 100644
--- a/probes.d
+++ b/probes.d
@@ -17,7 +17,7 @@ provider ruby {
ruby:::method-return(classname, methodname, filename, lineno);
This probe is fired just after a method has returned. The arguments are
- the same as "ruby:::method-entry".
+ the same as "ruby:::function-entry".
*/
probe method__return(const char *classname, const char *methodname, const char *filename, int lineno);
@@ -25,14 +25,14 @@ provider ruby {
ruby:::cmethod-entry(classname, methodname, filename, lineno);
This probe is fired just before a C method is entered. The arguments are
- the same as "ruby:::method-entry".
+ the same as "ruby:::function-entry".
*/
probe cmethod__entry(const char *classname, const char *methodname, const char *filename, int lineno);
/*
ruby:::cmethod-return(classname, methodname, filename, lineno);
This probe is fired just before a C method returns. The arguments are
- the same as "ruby:::method-entry".
+ the same as "ruby:::function-entry".
*/
probe cmethod__return(const char *classname, const char *methodname, const char *filename, int lineno);
@@ -214,17 +214,6 @@ provider ruby {
Fired at the end of a sweep phase.
*/
probe gc__sweep__end();
-
- /*
- ruby:::method-cache-clear(class, filename, lineno);
-
- This probe is fired when the method cache is cleared.
-
- * `class` the name of the class or "global" (a string)
- * `filename` the file name where the cache is _being cleared_ (a string)
- * `lineno` the line number where the cache is _being cleared_ (an int)
- */
- probe method__cache__clear(const char *class, const char *filename, int lineno);
};
#pragma D attributes Stable/Evolving/Common provider ruby provider
diff --git a/probes_helper.h b/probes_helper.h
index 1becae5a8d..12a18dcb34 100644
--- a/probes_helper.h
+++ b/probes_helper.h
@@ -4,40 +4,64 @@
#include "ruby/ruby.h"
#include "probes.h"
-struct ruby_dtrace_method_hook_args {
- const char *classname;
- const char *methodname;
- const char *filename;
- int line_no;
- volatile VALUE klass;
- volatile VALUE name;
-};
-
-NOINLINE(int ruby_th_dtrace_setup(rb_thread_t *, VALUE, ID, struct ruby_dtrace_method_hook_args *));
-
-#define RUBY_DTRACE_METHOD_HOOK(name, th, klazz, id) \
+VALUE rb_class_path_no_cache(VALUE _klass);
+
+#define RUBY_DTRACE_HOOK(name, th, klazz, id) \
do { \
- if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
- struct ruby_dtrace_method_hook_args args; \
- if (ruby_th_dtrace_setup(th, klazz, id, &args)) { \
- RUBY_DTRACE_##name(args.classname, \
- args.methodname, \
- args.filename, \
- args.line_no); \
+ if (RUBY_DTRACE_##name##_ENABLED()) { \
+ VALUE _klass = (klazz); \
+ VALUE _id = (id); \
+ const char * classname; \
+ const char * methodname; \
+ const char * filename; \
+ if (!_klass) { \
+ rb_thread_method_id_and_class((th), &_id, &_klass); \
+ } \
+ if (_klass) { \
+ if (RB_TYPE_P(_klass, T_ICLASS)) { \
+ _klass = RBASIC(_klass)->klass; \
+ } \
+ else if (FL_TEST(_klass, FL_SINGLETON)) { \
+ _klass = rb_iv_get(_klass, "__attached__"); \
+ } \
+ switch (TYPE(_klass)) { \
+ case T_CLASS: \
+ case T_ICLASS: \
+ case T_MODULE: \
+ { \
+ VALUE _name = rb_class_path_no_cache(_klass); \
+ if (!NIL_P(_name)) { \
+ classname = StringValuePtr(_name); \
+ } \
+ else { \
+ classname = "<unknown>"; \
+ } \
+ methodname = rb_id2name(_id); \
+ filename = rb_sourcefile(); \
+ if (classname && methodname && filename) { \
+ RUBY_DTRACE_##name( \
+ classname, \
+ methodname, \
+ filename, \
+ rb_sourceline()); \
+ } \
+ break; \
+ } \
+ } \
} \
} \
} while (0)
#define RUBY_DTRACE_METHOD_ENTRY_HOOK(th, klass, id) \
- RUBY_DTRACE_METHOD_HOOK(METHOD_ENTRY, th, klass, id)
+ RUBY_DTRACE_HOOK(METHOD_ENTRY, th, klass, id)
#define RUBY_DTRACE_METHOD_RETURN_HOOK(th, klass, id) \
- RUBY_DTRACE_METHOD_HOOK(METHOD_RETURN, th, klass, id)
+ RUBY_DTRACE_HOOK(METHOD_RETURN, th, klass, id)
#define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, klass, id) \
- RUBY_DTRACE_METHOD_HOOK(CMETHOD_ENTRY, th, klass, id)
+ RUBY_DTRACE_HOOK(CMETHOD_ENTRY, th, klass, id)
#define RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, klass, id) \
- RUBY_DTRACE_METHOD_HOOK(CMETHOD_RETURN, th, klass, id)
+ RUBY_DTRACE_HOOK(CMETHOD_RETURN, th, klass, id)
#endif /* RUBY_PROBES_HELPER_H */
diff --git a/proc.c b/proc.c
index eeec99232c..f3e38e9e02 100644
--- a/proc.c
+++ b/proc.c
@@ -14,17 +14,13 @@
#include "gc.h"
#include "iseq.h"
-/* Proc.new with no block will raise an exception in the future
- * versions */
-#define PROC_NEW_REQUIRES_BLOCK 0
-
-const rb_cref_t *rb_vm_cref_in_context(VALUE self, VALUE cbase);
-
struct METHOD {
- const VALUE recv;
- const VALUE klass;
- const rb_method_entry_t * const me;
- /* for bound methods, `me' should be rb_callable_method_entry_t * */
+ VALUE recv;
+ VALUE rclass;
+ VALUE defined_class;
+ ID id;
+ rb_method_entry_t *me;
+ struct unlinked_method_entry_list_entry *ume;
};
VALUE rb_cUnboundMethod;
@@ -35,55 +31,54 @@ VALUE rb_cProc;
static VALUE bmcall(VALUE, VALUE, int, VALUE *, VALUE);
static int method_arity(VALUE);
static int method_min_max_arity(VALUE, int *max);
-
#define attached id__attached__
/* Proc */
-#define IS_METHOD_PROC_IFUNC(ifunc) ((ifunc)->func == bmcall)
-#define IS_METHOD_PROC_ISEQ(iseq) \
- (RUBY_VM_IFUNC_P(iseq) && \
- IS_METHOD_PROC_IFUNC((struct vm_ifunc *)(iseq)))
+#define IS_METHOD_PROC_NODE(node) (nd_type(node) == NODE_IFUNC && (node)->nd_cfnc == bmcall)
static void
-proc_mark(void *ptr)
+proc_free(void *ptr)
{
- rb_proc_t *proc = ptr;
- RUBY_MARK_UNLESS_NULL(proc->block.proc);
- RUBY_MARK_UNLESS_NULL(proc->block.self);
- if (proc->block.ep) {
- RUBY_MARK_UNLESS_NULL(rb_vm_proc_envval(proc));
+ RUBY_FREE_ENTER("proc");
+ if (ptr) {
+ ruby_xfree(ptr);
}
- if (proc->block.iseq && RUBY_VM_IFUNC_P(proc->block.iseq)) {
- rb_gc_mark((VALUE)(proc->block.iseq));
+ RUBY_FREE_LEAVE("proc");
+}
+
+static void
+proc_mark(void *ptr)
+{
+ rb_proc_t *proc;
+ RUBY_MARK_ENTER("proc");
+ if (ptr) {
+ proc = ptr;
+ RUBY_MARK_UNLESS_NULL(proc->envval);
+ RUBY_MARK_UNLESS_NULL(proc->blockprocval);
+ RUBY_MARK_UNLESS_NULL(proc->block.proc);
+ RUBY_MARK_UNLESS_NULL(proc->block.self);
+ if (proc->block.iseq && RUBY_VM_IFUNC_P(proc->block.iseq)) {
+ RUBY_MARK_UNLESS_NULL((VALUE)(proc->block.iseq));
+ }
}
RUBY_MARK_LEAVE("proc");
}
-typedef struct {
- rb_proc_t basic;
- VALUE env[3]; /* me, specval, envval */
-} cfunc_proc_t;
-
-#define IS_SYM_PROC(proc) (proc->block.ep == ((const cfunc_proc_t *)proc)->env+1)
-
static size_t
proc_memsize(const void *ptr)
{
- const rb_proc_t *proc = ptr;
- if (IS_SYM_PROC(proc))
- return sizeof(cfunc_proc_t);
- return sizeof(rb_proc_t);
+ return ptr ? sizeof(rb_proc_t) : 0;
}
static const rb_data_type_t proc_data_type = {
"proc",
{
proc_mark,
- RUBY_TYPED_DEFAULT_FREE,
+ proc_free,
proc_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
VALUE
@@ -108,18 +103,17 @@ rb_obj_is_proc(VALUE proc)
static VALUE
proc_dup(VALUE self)
{
- VALUE procval;
- rb_proc_t *src;
- rb_proc_t *dst;
-
+ VALUE procval = rb_proc_alloc(rb_cProc);
+ rb_proc_t *src, *dst;
GetProcPtr(self, src);
- if (IS_SYM_PROC(src))
- return self;
- procval = rb_proc_alloc(rb_cProc);
GetProcPtr(procval, dst);
- *dst = *src;
+
+ dst->block = src->block;
dst->block.proc = procval;
- RB_GC_GUARD(self); /* for: body = proc_dup(body) */
+ dst->blockprocval = src->blockprocval;
+ dst->envval = src->envval;
+ dst->safe_level = src->safe_level;
+ dst->is_lambda = src->is_lambda;
return procval;
}
@@ -260,20 +254,20 @@ binding_free(void *ptr)
static void
binding_mark(void *ptr)
{
- rb_binding_t *bind = ptr;
-
+ rb_binding_t *bind;
RUBY_MARK_ENTER("binding");
-
- RUBY_MARK_UNLESS_NULL(bind->env);
- RUBY_MARK_UNLESS_NULL(bind->path);
-
+ if (ptr) {
+ bind = ptr;
+ RUBY_MARK_UNLESS_NULL(bind->env);
+ RUBY_MARK_UNLESS_NULL(bind->path);
+ }
RUBY_MARK_LEAVE("binding");
}
static size_t
binding_memsize(const void *ptr)
{
- return sizeof(rb_binding_t);
+ return ptr ? sizeof(rb_binding_t) : 0;
}
const rb_data_type_t ruby_binding_data_type = {
@@ -283,11 +277,11 @@ const rb_data_type_t ruby_binding_data_type = {
binding_free,
binding_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
-VALUE
-rb_binding_alloc(VALUE klass)
+static VALUE
+binding_alloc(VALUE klass)
{
VALUE obj;
rb_binding_t *bind;
@@ -299,7 +293,7 @@ rb_binding_alloc(VALUE klass)
static VALUE
binding_dup(VALUE self)
{
- VALUE bindval = rb_binding_alloc(rb_cBinding);
+ VALUE bindval = binding_alloc(rb_cBinding);
rb_binding_t *src, *dst;
GetBindingPtr(self, src);
GetBindingPtr(bindval, dst);
@@ -319,10 +313,39 @@ binding_clone(VALUE self)
}
VALUE
+rb_binding_new_with_cfp(rb_thread_t *th, const rb_control_frame_t *src_cfp)
+{
+ rb_control_frame_t *cfp = rb_vm_get_binding_creatable_next_cfp(th, src_cfp);
+ rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp);
+ VALUE bindval, envval;
+ rb_binding_t *bind;
+
+ if (cfp == 0 || ruby_level_cfp == 0) {
+ rb_raise(rb_eRuntimeError, "Can't create Binding Object on top of Fiber.");
+ }
+
+ while (1) {
+ envval = rb_vm_make_env_object(th, cfp);
+ if (cfp == ruby_level_cfp) {
+ break;
+ }
+ cfp = rb_vm_get_binding_creatable_next_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
+ }
+
+ bindval = binding_alloc(rb_cBinding);
+ GetBindingPtr(bindval, bind);
+ bind->env = envval;
+ bind->path = ruby_level_cfp->iseq->location.path;
+ bind->first_lineno = rb_vm_get_sourceline(ruby_level_cfp);
+
+ return bindval;
+}
+
+VALUE
rb_binding_new(void)
{
rb_thread_t *th = GET_THREAD();
- return rb_vm_make_binding(th, th->cfp);
+ return rb_binding_new_with_cfp(th, th->cfp);
}
/*
@@ -335,7 +358,7 @@ rb_binding_new(void)
* environment. See also the description of class +Binding+.
*
* def get_binding(param)
- * binding
+ * return binding
* end
* b = get_binding("hello")
* eval("param", b) #=> "hello"
@@ -357,7 +380,7 @@ rb_f_binding(VALUE self)
* reporting syntax errors.
*
* def get_binding(param)
- * binding
+ * return binding
* end
* b = get_binding("hello")
* b.eval("param") #=> "hello"
@@ -376,28 +399,23 @@ bind_eval(int argc, VALUE *argv, VALUE bindval)
static VALUE *
get_local_variable_ptr(VALUE envval, ID lid)
{
- rb_env_t *env;
+ const rb_env_t *env;
do {
const rb_iseq_t *iseq;
- unsigned int i;
+ int i;
GetEnvPtr(envval, env);
iseq = env->block.iseq;
- if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
- for (i=0; i<iseq->body->local_table_size; i++) {
- if (iseq->body->local_table[i] == lid) {
- return &env->env[i];
- }
+ for (i=0; i<iseq->local_table_size; i++) {
+ if (iseq->local_table[i] == lid) {
+ return &env->env[i];
}
}
- else {
- return NULL;
- }
- } while ((envval = rb_vm_env_prev_envval(env)) != Qfalse);
+ } while ((envval = env->prev_envval) != 0);
- return NULL;
+ return 0;
}
/*
@@ -409,19 +427,18 @@ static ID
check_local_id(VALUE bindval, volatile VALUE *pname)
{
ID lid = rb_check_id(pname);
- VALUE name = *pname;
+ VALUE name = *pname, sym = name;
if (lid) {
if (!rb_is_local_id(lid)) {
- rb_name_err_raise("wrong local variable name `%1$s' for %2$s",
- bindval, ID2SYM(lid));
+ name = rb_id2str(lid);
+ wrong:
+ rb_name_error_str(sym, "wrong local variable name `% "PRIsVALUE"' for %"PRIsVALUE,
+ name, bindval);
}
}
else {
- if (!rb_is_local_name(name)) {
- rb_name_err_raise("wrong local variable name `%1$s' for %2$s",
- bindval, name);
- }
+ if (!rb_is_local_name(sym)) goto wrong;
return 0;
}
return lid;
@@ -429,39 +446,9 @@ check_local_id(VALUE bindval, volatile VALUE *pname)
/*
* call-seq:
- * binding.local_variables -> Array
- *
- * Returns the names of the binding's local variables as symbols.
- *
- * def foo
- * a = 1
- * 2.times do |n|
- * binding.local_variables #=> [:a, :n]
- * end
- * end
- *
- * This method is the short version of the following code:
- *
- * binding.eval("local_variables")
- *
- */
-static VALUE
-bind_local_variables(VALUE bindval)
-{
- const rb_binding_t *bind;
- const rb_env_t *env;
-
- GetBindingPtr(bindval, bind);
- GetEnvPtr(bind->env, env);
-
- return rb_vm_env_local_variables(env);
-}
-
-/*
- * call-seq:
* binding.local_variable_get(symbol) -> obj
*
- * Returns the value of the local variable +symbol+.
+ * Returns a +value+ of local variable +symbol+.
*
* def foo
* a = 1
@@ -469,7 +456,7 @@ bind_local_variables(VALUE bindval)
* binding.local_variable_get(:b) #=> NameError
* end
*
- * This method is the short version of the following code:
+ * This method is short version of the following code.
*
* binding.eval("#{symbol}")
*
@@ -486,10 +473,9 @@ bind_local_variable_get(VALUE bindval, VALUE sym)
GetBindingPtr(bindval, bind);
if ((ptr = get_local_variable_ptr(bind->env, lid)) == NULL) {
- sym = ID2SYM(lid);
undefined:
- rb_name_err_raise("local variable `%1$s' not defined for %2$s",
- bindval, sym);
+ rb_name_error_str(sym, "local variable `%"PRIsVALUE"' not defined for %"PRIsVALUE,
+ sym, bindval);
}
return *ptr;
@@ -503,22 +489,21 @@ bind_local_variable_get(VALUE bindval, VALUE sym)
*
* def foo
* a = 1
- * bind = binding
- * bind.local_variable_set(:a, 2) # set existing local variable `a'
- * bind.local_variable_set(:b, 3) # create new local variable `b'
- * # `b' exists only in binding
- *
- * p bind.local_variable_get(:a) #=> 2
- * p bind.local_variable_get(:b) #=> 3
- * p a #=> 2
- * p b #=> NameError
+ * b = binding
+ * b.local_variable_set(:a, 2) # set existing local variable `a'
+ * b.local_variable_set(:b, 3) # create new local variable `b'
+ * # `b' exists only in binding.
+ * b.local_variable_get(:a) #=> 2
+ * b.local_variable_get(:b) #=> 3
+ * p a #=> 2
+ * p b #=> NameError
* end
*
- * This method behaves similarly to the following code:
+ * This method is a similar behavior of the following code
*
* binding.eval("#{symbol} = #{obj}")
*
- * if +obj+ can be dumped in Ruby code.
+ * if obj can be dumped in Ruby code.
*/
static VALUE
bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
@@ -544,7 +529,7 @@ bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
* call-seq:
* binding.local_variable_defined?(symbol) -> obj
*
- * Returns +true+ if a local variable +symbol+ exists.
+ * Returns a +true+ if a local variable +symbol+ exists.
*
* def foo
* a = 1
@@ -552,7 +537,7 @@ bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
* binding.local_variable_defined?(:b) #=> false
* end
*
- * This method is the short version of the following code:
+ * This method is short version of the following code.
*
* binding.eval("defined?(#{symbol}) == 'local-variable'")
*
@@ -569,90 +554,35 @@ bind_local_variable_defined_p(VALUE bindval, VALUE sym)
return get_local_variable_ptr(bind->env, lid) ? Qtrue : Qfalse;
}
-/*
- * call-seq:
- * binding.receiver -> object
- *
- * Returns the bound receiver of the binding object.
- */
-static VALUE
-bind_receiver(VALUE bindval)
-{
- const rb_binding_t *bind;
- const rb_env_t *env;
-
- GetBindingPtr(bindval, bind);
- GetEnvPtr(bind->env, env);
- return env->block.self;
-}
-
-static VALUE
-cfunc_proc_new(VALUE klass, VALUE ifunc, int8_t is_lambda)
-{
- rb_proc_t *proc;
- cfunc_proc_t *sproc;
- VALUE procval = TypedData_Make_Struct(klass, cfunc_proc_t, &proc_data_type, sproc);
- sproc->env[1] = VM_ENVVAL_BLOCK_PTR(0);
- proc = &sproc->basic;
- proc->block.ep = sproc->env+1;
- proc->block.iseq = (rb_iseq_t *)ifunc;
- proc->block.proc = procval;
- proc->is_lambda = is_lambda;
- return procval;
-}
-
static VALUE
-sym_proc_new(VALUE klass, VALUE sym)
-{
- return cfunc_proc_new(klass, sym, 0);
-}
-
-VALUE
-rb_func_proc_new(rb_block_call_func_t func, VALUE val)
-{
- return cfunc_proc_new(rb_cProc, (VALUE)IFUNC_NEW(func, val, 0), 0);
-}
-
-VALUE
-rb_func_lambda_new(rb_block_call_func_t func, VALUE val)
-{
- return cfunc_proc_new(rb_cProc, (VALUE)IFUNC_NEW(func, val, 0), 1);
-}
-
-static const char proc_without_block[] = "tried to create Proc object without a block";
-
-static VALUE
-proc_new(VALUE klass, int8_t is_lambda)
+proc_new(VALUE klass, int is_lambda)
{
VALUE procval = Qnil;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
rb_block_t *block;
- if (!(block = rb_vm_control_frame_block_ptr(cfp))) {
-#if !PROC_NEW_REQUIRES_BLOCK
+ if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) {
+ /* block found */
+ }
+ else {
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) {
if (is_lambda) {
- rb_warn(proc_without_block);
+ rb_warn("tried to create Proc object without a block");
}
}
-#else
- if (0)
-#endif
else {
- rb_raise(rb_eArgError, proc_without_block);
+ rb_raise(rb_eArgError,
+ "tried to create Proc object without a block");
}
}
procval = block->proc;
if (procval) {
- if (SYMBOL_P(procval)) {
- return (klass != rb_cProc) ? sym_proc_new(klass, procval) : rb_sym_to_proc(procval);
- }
- else if (RBASIC_CLASS(procval) == klass) {
+ if (RBASIC(procval)->klass == klass) {
return procval;
}
else {
@@ -662,7 +592,13 @@ proc_new(VALUE klass, int8_t is_lambda)
}
}
- procval = rb_vm_make_proc_lambda(th, block, klass, is_lambda);
+ procval = rb_vm_make_proc(th, block, klass);
+
+ if (is_lambda) {
+ rb_proc_t *proc;
+ GetProcPtr(procval, proc);
+ proc->is_lambda = TRUE;
+ }
return procval;
}
@@ -719,6 +655,13 @@ rb_block_lambda(void)
return proc_new(rb_cProc, TRUE);
}
+VALUE
+rb_f_lambda(void)
+{
+ rb_warn("rb_f_lambda() is deprecated; use rb_block_proc() instead");
+ return rb_block_lambda();
+}
+
/* Document-method: ===
*
* call-seq:
@@ -732,59 +675,55 @@ rb_block_lambda(void)
/* CHECKME: are the argument checking semantics correct? */
/*
- * Document-method: []
- * Document-method: call
- * Document-method: yield
- *
* call-seq:
* prc.call(params,...) -> obj
* prc[params,...] -> obj
* prc.(params,...) -> obj
- * prc.yield(params,...) -> obj
*
* Invokes the block, setting the block's parameters to the values in
* <i>params</i> using something close to method calling semantics.
- * Returns the value of the last expression evaluated in the block.
+ * Generates a warning if multiple values are passed to a proc that
+ * expects just one (previously this silently converted the parameters
+ * to an array). Note that prc.() invokes prc.call() with the parameters
+ * given. It's a syntax sugar to hide "call".
*
- * a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
- * a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
- * a_proc[9, 1, 2, 3] #=> [9, 18, 27]
- * a_proc.(9, 1, 2, 3) #=> [9, 18, 27]
- * a_proc.yield(9, 1, 2, 3) #=> [9, 18, 27]
+ * For procs created using <code>lambda</code> or <code>->()</code> an error
+ * is generated if the wrong number of parameters are passed to a Proc with
+ * multiple parameters. For procs created using <code>Proc.new</code> or
+ * <code>Kernel.proc</code>, extra parameters are silently discarded.
*
- * Note that <code>prc.()</code> invokes <code>prc.call()</code> with
- * the parameters given. It's syntactic sugar to hide "call".
+ * Returns the value of the last expression evaluated in the block. See
+ * also <code>Proc#yield</code>.
*
- * For procs created using <code>lambda</code> or <code>->()</code> an error
- * is generated if the wrong number of parameters are passed to the proc.
- * For procs created using <code>Proc.new</code> or <code>Kernel.proc</code>,
- * extra parameters are silently discarded and missing parameters are
- * set to +nil+.
+ * a_proc = Proc.new {|a, *b| b.collect {|i| i*a }}
+ * a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
+ * a_proc[9, 1, 2, 3] #=> [9, 18, 27]
+ * a_proc = lambda {|a,b| a}
+ * a_proc.call(1,2,3)
*
- * a_proc = proc {|a,b| [a,b] }
- * a_proc.call(1) #=> [1, nil]
+ * <em>produces:</em>
*
- * a_proc = lambda {|a,b| [a,b] }
- * a_proc.call(1) # ArgumentError: wrong number of arguments (given 1, expected 2)
+ * prog.rb:4:in `block in <main>': wrong number of arguments (3 for 2) (ArgumentError)
+ * from prog.rb:5:in `call'
+ * from prog.rb:5:in `<main>'
*
- * See also Proc#lambda?.
*/
-#if 0
+
static VALUE
proc_call(int argc, VALUE *argv, VALUE procval)
{
VALUE vret;
- const rb_block_t *blockptr = 0;
- const rb_iseq_t *iseq;
rb_proc_t *proc;
+ rb_block_t *blockptr = 0;
+ rb_iseq_t *iseq;
VALUE passed_procval;
GetProcPtr(procval, proc);
iseq = proc->block.iseq;
- if (RUBY_VM_IFUNC_P(iseq) || iseq->body->param.flags.has_block) {
+ if (BUILTIN_TYPE(iseq) == T_NODE || iseq->arg_block != -1) {
if (rb_block_given_p()) {
rb_proc_t *passed_proc;
- passed_procval = rb_block_proc();
+ RB_GC_GUARD(passed_procval) = rb_block_proc();
GetProcPtr(passed_procval, passed_proc);
blockptr = &passed_proc->block;
}
@@ -792,10 +731,8 @@ proc_call(int argc, VALUE *argv, VALUE procval)
vret = rb_vm_invoke_proc(GET_THREAD(), proc, argc, argv, blockptr);
RB_GC_GUARD(procval);
- RB_GC_GUARD(passed_procval);
return vret;
}
-#endif
#if SIZEOF_LONG > SIZEOF_INT
static inline int
@@ -811,20 +748,6 @@ check_argc(long argc)
#define check_argc(argc) (argc)
#endif
-static rb_block_t *
-passed_block(VALUE pass_procval)
-{
- if (!NIL_P(pass_procval)) {
- rb_proc_t *pass_proc;
- if (SYMBOL_P(pass_procval)) {
- pass_procval = sym_proc_new(rb_cProc, pass_procval);
- }
- GetProcPtr(pass_procval, pass_proc);
- return &pass_proc->block;
- }
- return 0;
-}
-
VALUE
rb_proc_call(VALUE self, VALUE args)
{
@@ -845,7 +768,12 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc
rb_block_t *block = 0;
GetProcPtr(self, proc);
- block = passed_block(pass_procval);
+ if (!NIL_P(pass_procval)) {
+ rb_proc_t *pass_proc;
+ GetProcPtr(pass_procval, pass_proc);
+ block = &pass_proc->block;
+ }
+
vret = rb_vm_invoke_proc(GET_THREAD(), proc, argc, argv, block);
RB_GC_GUARD(self);
RB_GC_GUARD(pass_procval);
@@ -857,41 +785,32 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc
* call-seq:
* prc.arity -> fixnum
*
- * Returns the number of mandatory arguments. If the block
+ * Returns the number of arguments that would not be ignored. If the block
* is declared to take no arguments, returns 0. If the block is known
- * to take exactly n arguments, returns n.
- * If the block has optional arguments, returns -n-1, where n is the
- * number of mandatory arguments, with the exception for blocks that
- * are not lambdas and have only a finite number of optional arguments;
- * in this latter case, returns n.
- * Keywords arguments will considered as a single additional argument,
- * that argument being mandatory if any keyword argument is mandatory.
- * A <code>proc</code> with no argument declarations
- * is the same as a block declaring <code>||</code> as its arguments.
- *
- * proc {}.arity #=> 0
- * proc { || }.arity #=> 0
- * proc { |a| }.arity #=> 1
- * proc { |a, b| }.arity #=> 2
- * proc { |a, b, c| }.arity #=> 3
- * proc { |*a| }.arity #=> -1
- * proc { |a, *b| }.arity #=> -2
- * proc { |a, *b, c| }.arity #=> -3
- * proc { |x:, y:, z:0| }.arity #=> 1
- * proc { |*a, x:, y:0| }.arity #=> -2
- *
- * proc { |x=0| }.arity #=> 0
- * lambda { |x=0| }.arity #=> -1
- * proc { |x=0, y| }.arity #=> 1
+ * to take exactly n arguments, returns n. If the block has optional
+ * arguments, return -n-1, where n is the number of mandatory
+ * arguments. A <code>proc</code> with no argument declarations
+ * is the same a block declaring <code>||</code> as its arguments.
+ *
+ * proc {}.arity #=> 0
+ * proc {||}.arity #=> 0
+ * proc {|a|}.arity #=> 1
+ * proc {|a,b|}.arity #=> 2
+ * proc {|a,b,c|}.arity #=> 3
+ * proc {|*a|}.arity #=> -1
+ * proc {|a,*b|}.arity #=> -2
+ * proc {|a,*b, c|}.arity #=> -3
+ *
+ * proc { |x = 0| }.arity #=> 0
+ * lambda { |a = 0| }.arity #=> -1
+ * proc { |x=0, y| }.arity #=> 1
* lambda { |x=0, y| }.arity #=> -2
- * proc { |x=0, y=0| }.arity #=> 0
+ * proc { |x=0, y=0| }.arity #=> 0
* lambda { |x=0, y=0| }.arity #=> -1
- * proc { |x, y=0| }.arity #=> 1
+ * proc { |x, y=0| }.arity #=> 1
* lambda { |x, y=0| }.arity #=> -2
- * proc { |(x, y), z=0| }.arity #=> 1
+ * proc { |(x, y), z=0| }.arity #=> 1
* lambda { |(x, y), z=0| }.arity #=> -2
- * proc { |a, x:0, y:0| }.arity #=> 1
- * lambda { |a, x:0, y:0| }.arity #=> -2
*/
static VALUE
@@ -904,27 +823,25 @@ proc_arity(VALUE self)
static inline int
rb_iseq_min_max_arity(const rb_iseq_t *iseq, int *max)
{
- *max = iseq->body->param.flags.has_rest == FALSE ?
- iseq->body->param.lead_num + iseq->body->param.opt_num + iseq->body->param.post_num +
- (iseq->body->param.flags.has_kw == TRUE || iseq->body->param.flags.has_kwrest == TRUE)
+ *max = iseq->arg_rest == -1 ?
+ iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
: UNLIMITED_ARGUMENTS;
- return iseq->body->param.lead_num + iseq->body->param.post_num + (iseq->body->param.flags.has_kw && iseq->body->param.keyword->required_num > 0);
+ return iseq->argc + iseq->arg_post_len;
}
static int
rb_block_min_max_arity(rb_block_t *block, int *max)
{
- const rb_iseq_t *iseq = block->iseq;
-
+ rb_iseq_t *iseq = block->iseq;
if (iseq) {
- if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
+ if (BUILTIN_TYPE(iseq) != T_NODE) {
return rb_iseq_min_max_arity(iseq, max);
}
else {
- if (IS_METHOD_PROC_ISEQ(iseq)) {
- const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
+ NODE *node = (NODE *)iseq;
+ if (IS_METHOD_PROC_NODE(node)) {
/* e.g. method(:foo).to_proc.arity */
- return method_min_max_arity((VALUE)ifunc->data, max);
+ return method_min_max_arity(node->nd_tval, max);
}
}
}
@@ -970,56 +887,46 @@ rb_block_arity(void)
min = rb_block_min_max_arity(block, &max);
proc_value = block->proc;
if (proc_value) {
- if (SYMBOL_P(proc_value)) {
- return -1;
- }
- else {
- rb_proc_t *proc;
- GetProcPtr(proc_value, proc);
- if (proc)
- return (proc->is_lambda ? min == max : max != UNLIMITED_ARGUMENTS) ? min : -min-1;
- }
+ rb_proc_t *proc;
+ GetProcPtr(proc_value, proc);
+ if (proc)
+ return (proc->is_lambda ? min == max : max != UNLIMITED_ARGUMENTS) ? min : -min-1;
}
return max != UNLIMITED_ARGUMENTS ? min : -min-1;
}
-const rb_iseq_t *
+#define get_proc_iseq rb_proc_get_iseq
+
+rb_iseq_t *
rb_proc_get_iseq(VALUE self, int *is_proc)
{
- const rb_proc_t *proc;
- const rb_iseq_t *iseq;
+ rb_proc_t *proc;
+ rb_iseq_t *iseq;
GetProcPtr(self, proc);
iseq = proc->block.iseq;
if (is_proc) *is_proc = !proc->is_lambda;
- if (RUBY_VM_IFUNC_P(iseq)) {
- const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
+ if (!RUBY_VM_NORMAL_ISEQ_P(iseq)) {
+ NODE *node = (NODE *)iseq;
iseq = 0;
- if (IS_METHOD_PROC_IFUNC(ifunc)) {
+ if (IS_METHOD_PROC_NODE(node)) {
/* method(:foo).to_proc */
- iseq = rb_method_iseq((VALUE)ifunc->data);
+ iseq = rb_method_get_iseq(node->nd_tval);
if (is_proc) *is_proc = 0;
}
- return iseq;
- }
- else if (SYMBOL_P(iseq)) {
- return NULL;
- }
- else {
- return rb_iseq_check(iseq);
}
+ return iseq;
}
static VALUE
-iseq_location(const rb_iseq_t *iseq)
+iseq_location(rb_iseq_t *iseq)
{
VALUE loc[2];
if (!iseq) return Qnil;
- rb_iseq_check(iseq);
- loc[0] = iseq->body->location.path;
- if (iseq->body->line_info_table) {
- loc[1] = rb_iseq_first_lineno(iseq);
+ loc[0] = iseq->location.path;
+ if (iseq->line_info_table) {
+ loc[1] = rb_iseq_first_lineno(iseq->self);
}
else {
loc[1] = Qnil;
@@ -1032,13 +939,13 @@ iseq_location(const rb_iseq_t *iseq)
* prc.source_location -> [String, Fixnum]
*
* Returns the Ruby source filename and line number containing this proc
- * or +nil+ if this proc was not defined in Ruby (i.e. native).
+ * or +nil+ if this proc was not defined in Ruby (i.e. native)
*/
VALUE
rb_proc_location(VALUE self)
{
- return iseq_location(rb_proc_get_iseq(self, 0));
+ return iseq_location(get_proc_iseq(self, 0));
}
static VALUE
@@ -1074,7 +981,7 @@ static VALUE
rb_proc_parameters(VALUE self)
{
int is_proc;
- const rb_iseq_t *iseq = rb_proc_get_iseq(self, &is_proc);
+ rb_iseq_t *iseq = get_proc_iseq(self, &is_proc);
if (!iseq) {
return unnamed_parameters(rb_proc_arity(self));
}
@@ -1087,47 +994,15 @@ rb_hash_proc(st_index_t hash, VALUE prc)
rb_proc_t *proc;
GetProcPtr(prc, proc);
hash = rb_hash_uint(hash, (st_index_t)proc->block.iseq);
+ hash = rb_hash_uint(hash, (st_index_t)proc->envval);
return rb_hash_uint(hash, (st_index_t)proc->block.ep >> 16);
}
-VALUE
-rb_sym_to_proc(VALUE sym)
-{
- static VALUE sym_proc_cache = Qfalse;
- enum {SYM_PROC_CACHE_SIZE = 67};
- VALUE proc;
- long index;
- ID id;
- VALUE *aryp;
-
- if (!sym_proc_cache) {
- sym_proc_cache = rb_ary_tmp_new(SYM_PROC_CACHE_SIZE * 2);
- rb_gc_register_mark_object(sym_proc_cache);
- rb_ary_store(sym_proc_cache, SYM_PROC_CACHE_SIZE*2 - 1, Qnil);
- }
-
- id = SYM2ID(sym);
- index = (id % SYM_PROC_CACHE_SIZE) << 1;
-
- aryp = RARRAY_PTR(sym_proc_cache);
- if (aryp[index] == sym) {
- return aryp[index + 1];
- }
- else {
- proc = sym_proc_new(rb_cProc, ID2SYM(id));
- aryp[index] = sym;
- aryp[index + 1] = proc;
- return proc;
- }
-}
-
/*
* call-seq:
* prc.hash -> integer
*
* Returns a hash value corresponding to proc body.
- *
- * See also Object#hash.
*/
static VALUE
@@ -1154,25 +1029,21 @@ proc_to_s(VALUE self)
VALUE str = 0;
rb_proc_t *proc;
const char *cname = rb_obj_classname(self);
- const rb_iseq_t *iseq;
+ rb_iseq_t *iseq;
const char *is_lambda;
GetProcPtr(self, proc);
iseq = proc->block.iseq;
is_lambda = proc->is_lambda ? " (lambda)" : "";
- if (RUBY_VM_NORMAL_ISEQ_P(iseq) && rb_iseq_check(iseq)) {
+ if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
int first_lineno = 0;
- if (iseq->body->line_info_table) {
- first_lineno = FIX2INT(rb_iseq_first_lineno(iseq));
+ if (iseq->line_info_table) {
+ first_lineno = FIX2INT(rb_iseq_first_lineno(iseq->self));
}
str = rb_sprintf("#<%s:%p@%"PRIsVALUE":%d%s>", cname, (void *)self,
- iseq->body->location.path, first_lineno, is_lambda);
- }
- else if (SYMBOL_P(iseq)) {
- str = rb_sprintf("#<%s:%p(&%+"PRIsVALUE")%s>", cname, (void *)self,
- (VALUE)iseq, is_lambda);
+ iseq->location.path, first_lineno, is_lambda);
}
else {
str = rb_sprintf("#<%s:%p%s>", cname, (void *)proc->block.iseq,
@@ -1187,7 +1058,7 @@ proc_to_s(VALUE self)
/*
* call-seq:
- * prc.to_proc -> proc
+ * prc.to_proc -> prc
*
* Part of the protocol for converting objects to <code>Proc</code>
* objects. Instances of class <code>Proc</code> simply return
@@ -1204,25 +1075,38 @@ static void
bm_mark(void *ptr)
{
struct METHOD *data = ptr;
+ rb_gc_mark(data->defined_class);
+ rb_gc_mark(data->rclass);
rb_gc_mark(data->recv);
- rb_gc_mark(data->klass);
- rb_gc_mark((VALUE)data->me);
+ if (data->me) rb_mark_method_entry(data->me);
+}
+
+static void
+bm_free(void *ptr)
+{
+ struct METHOD *data = ptr;
+ struct unlinked_method_entry_list_entry *ume = data->ume;
+ data->me->mark = 0;
+ ume->me = data->me;
+ ume->next = GET_VM()->unlinked_method_entry_list;
+ GET_VM()->unlinked_method_entry_list = ume;
+ xfree(ptr);
}
static size_t
bm_memsize(const void *ptr)
{
- return sizeof(struct METHOD);
+ return ptr ? sizeof(struct METHOD) : 0;
}
static const rb_data_type_t method_data_type = {
"method",
{
bm_mark,
- RUBY_TYPED_DEFAULT_FREE,
+ bm_free,
bm_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
VALUE
@@ -1236,121 +1120,109 @@ rb_obj_is_method(VALUE m)
}
}
-static int
-respond_to_missing_p(VALUE klass, VALUE obj, VALUE sym, int scope)
-{
- /* TODO: merge with obj_respond_to() */
- ID rmiss = idRespond_to_missing;
-
- if (obj == Qundef) return 0;
- if (rb_method_basic_definition_p(klass, rmiss)) return 0;
- return RTEST(rb_funcall(obj, rmiss, 2, sym, scope ? Qfalse : Qtrue));
-}
-
-
static VALUE
-mnew_missing(VALUE klass, VALUE obj, ID id, ID rid, VALUE mclass)
-{
- struct METHOD *data;
- VALUE method = TypedData_Make_Struct(mclass, struct METHOD, &method_data_type, data);
- rb_method_entry_t *me;
- rb_method_definition_t *def;
-
- RB_OBJ_WRITE(method, &data->recv, obj);
- RB_OBJ_WRITE(method, &data->klass, klass);
-
- def = ZALLOC(rb_method_definition_t);
- def->type = VM_METHOD_TYPE_MISSING;
- def->original_id = id;
-
- me = rb_method_entry_create(id, klass, METHOD_VISI_UNDEF, def);
-
- RB_OBJ_WRITE(method, &data->me, me);
-
- OBJ_INFECT(method, klass);
-
- return method;
-}
-
-static VALUE
-mnew_internal(const rb_method_entry_t *me, VALUE klass,
- VALUE obj, ID id, VALUE mclass, int scope, int error)
+mnew_from_me(rb_method_entry_t *me, VALUE defined_class, VALUE klass,
+ VALUE obj, ID id, VALUE mclass, int scope)
{
- struct METHOD *data;
VALUE method;
+ VALUE rclass = klass;
ID rid = id;
- rb_method_visibility_t visi = METHOD_VISI_UNDEF;
+ struct METHOD *data;
+ rb_method_definition_t *def = 0;
+ rb_method_flag_t flag = NOEX_UNDEF;
again:
if (UNDEFINED_METHOD_ENTRY_P(me)) {
- if (respond_to_missing_p(klass, obj, ID2SYM(id), scope)) {
- return mnew_missing(klass, obj, id, rid, mclass);
+ ID rmiss = idRespond_to_missing;
+ VALUE sym = ID2SYM(id);
+
+ if (obj != Qundef && !rb_method_basic_definition_p(klass, rmiss)) {
+ if (RTEST(rb_funcall(obj, rmiss, 2, sym, scope ? Qfalse : Qtrue))) {
+ me = 0;
+
+ goto gen_method;
+ }
}
- if (!error) return Qnil;
rb_print_undef(klass, id, 0);
}
- if (visi == METHOD_VISI_UNDEF) {
- visi = METHOD_ENTRY_VISI(me);
- if (scope && (visi != METHOD_VISI_PUBLIC)) {
- if (!error) return Qnil;
- rb_print_inaccessible(klass, id, visi);
+ def = me->def;
+ if (flag == NOEX_UNDEF) {
+ flag = me->flag;
+ if (scope && (flag & NOEX_MASK) != NOEX_PUBLIC) {
+ const char *v = "";
+ switch (flag & NOEX_MASK) {
+ case NOEX_PRIVATE: v = "private"; break;
+ case NOEX_PROTECTED: v = "protected"; break;
+ }
+ rb_name_error(id, "method `%s' for %s `% "PRIsVALUE"' is %s",
+ rb_id2name(id),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass),
+ v);
}
}
- if (me->def->type == VM_METHOD_TYPE_ZSUPER) {
- if (me->defined_class) {
- VALUE klass = RCLASS_SUPER(RCLASS_ORIGIN(me->defined_class));
- id = me->def->original_id;
- me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(klass, id);
- }
- else {
- VALUE klass = RCLASS_SUPER(me->owner);
- id = me->def->original_id;
- me = rb_method_entry_without_refinements(klass, id);
- }
+ if (def && def->type == VM_METHOD_TYPE_ZSUPER) {
+ klass = RCLASS_SUPER(defined_class);
+ id = def->original_id;
+ me = rb_method_entry_without_refinements(klass, id, &defined_class);
goto again;
}
- while (klass != me->owner && (FL_TEST(klass, FL_SINGLETON) || RB_TYPE_P(klass, T_ICLASS))) {
- klass = RCLASS_SUPER(klass);
+ klass = defined_class;
+
+ while (rclass != klass &&
+ (FL_TEST(rclass, FL_SINGLETON) || RB_TYPE_P(rclass, T_ICLASS))) {
+ rclass = RCLASS_SUPER(rclass);
}
+ if (RB_TYPE_P(klass, T_ICLASS)) {
+ klass = RBASIC(klass)->klass;
+ }
+
+ gen_method:
method = TypedData_Make_Struct(mclass, struct METHOD, &method_data_type, data);
- RB_OBJ_WRITE(method, &data->recv, obj);
- RB_OBJ_WRITE(method, &data->klass, klass);
- RB_OBJ_WRITE(method, &data->me, me);
+ data->recv = obj;
+ data->rclass = rclass;
+ data->defined_class = defined_class;
+ data->id = rid;
+ data->me = ALLOC(rb_method_entry_t);
+ if (me) {
+ *data->me = *me;
+ }
+ else {
+ me = data->me;
+ me->flag = 0;
+ me->mark = 0;
+ me->called_id = id;
+ me->klass = klass;
+ me->def = 0;
+
+ def = ALLOC(rb_method_definition_t);
+ me->def = def;
+
+ def->type = VM_METHOD_TYPE_MISSING;
+ def->original_id = id;
+ def->alias_count = 0;
+
+ }
+ data->ume = ALLOC(struct unlinked_method_entry_list_entry);
+ data->me->def->alias_count++;
OBJ_INFECT(method, klass);
- return method;
-}
-static VALUE
-mnew_from_me(const rb_method_entry_t *me, VALUE klass,
- VALUE obj, ID id, VALUE mclass, int scope)
-{
- return mnew_internal(me, klass, obj, id, mclass, scope, TRUE);
+ return method;
}
static VALUE
mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
{
- const rb_method_entry_t *me;
-
- if (obj == Qundef) { /* UnboundMethod */
- me = rb_method_entry_without_refinements(klass, id);
- }
- else {
- me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(klass, id);
- }
- return mnew_from_me(me, klass, obj, id, mclass, scope);
+ VALUE defined_class;
+ rb_method_entry_t *me =
+ rb_method_entry_without_refinements(klass, id, &defined_class);
+ return mnew_from_me(me, defined_class, klass, obj, id, mclass, scope);
}
-static inline VALUE
-method_entry_defined_class(const rb_method_entry_t *me)
-{
- VALUE defined_class = me->defined_class;
- return defined_class ? defined_class : me->owner;
-}
/**********************************************************************
*
@@ -1390,7 +1262,6 @@ static VALUE
method_eq(VALUE method, VALUE other)
{
struct METHOD *m1, *m2;
- VALUE klass1, klass2;
if (!rb_obj_is_method(other))
return Qfalse;
@@ -1401,12 +1272,8 @@ method_eq(VALUE method, VALUE other)
m1 = (struct METHOD *)DATA_PTR(method);
m2 = (struct METHOD *)DATA_PTR(other);
- klass1 = method_entry_defined_class(m1->me);
- klass2 = method_entry_defined_class(m2->me);
-
if (!rb_method_entry_eq(m1->me, m2->me) ||
- klass1 != klass2 ||
- m1->klass != m2->klass ||
+ m1->rclass != m2->rclass ||
m1->recv != m2->recv) {
return Qfalse;
}
@@ -1419,8 +1286,6 @@ method_eq(VALUE method, VALUE other)
* meth.hash -> integer
*
* Returns a hash value corresponding to the method object.
- *
- * See also Object#hash.
*/
static VALUE
@@ -1430,7 +1295,8 @@ method_hash(VALUE method)
st_index_t hash;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, m);
- hash = rb_hash_start((st_index_t)m->recv);
+ hash = rb_hash_start((st_index_t)m->rclass);
+ hash = rb_hash_uint(hash, (st_index_t)m->recv);
hash = rb_hash_method_entry(hash, m->me);
hash = rb_hash_end(hash);
@@ -1455,9 +1321,14 @@ method_unbind(VALUE obj)
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, orig);
method = TypedData_Make_Struct(rb_cUnboundMethod, struct METHOD,
&method_data_type, data);
- RB_OBJ_WRITE(method, &data->recv, Qundef);
- RB_OBJ_WRITE(method, &data->klass, orig->klass);
- RB_OBJ_WRITE(method, &data->me, rb_method_entry_clone(orig->me));
+ data->recv = Qundef;
+ data->id = orig->id;
+ data->me = ALLOC(rb_method_entry_t);
+ *data->me = *orig->me;
+ if (orig->me->def) orig->me->def->alias_count++;
+ data->rclass = orig->rclass;
+ data->defined_class = orig->defined_class;
+ data->ume = ALLOC(struct unlinked_method_entry_list_entry);
OBJ_INFECT(method, obj);
return method;
@@ -1492,7 +1363,7 @@ method_name(VALUE obj)
struct METHOD *data;
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
- return ID2SYM(data->me->called_id);
+ return ID2SYM(data->id);
}
/*
@@ -1522,54 +1393,32 @@ static VALUE
method_owner(VALUE obj)
{
struct METHOD *data;
+
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
- return data->me->owner;
+ return data->me->klass;
}
void
rb_method_name_error(VALUE klass, VALUE str)
{
-#define MSG(s) rb_fstring_cstr("undefined method `%1$s' for"s" `%2$s'")
+ const char *s0 = " class";
VALUE c = klass;
- VALUE s;
if (FL_TEST(c, FL_SINGLETON)) {
VALUE obj = rb_ivar_get(klass, attached);
- switch (BUILTIN_TYPE(obj)) {
+ switch (TYPE(obj)) {
case T_MODULE:
case T_CLASS:
c = obj;
- s = MSG("");
+ s0 = "";
}
- goto normal_class;
}
else if (RB_TYPE_P(c, T_MODULE)) {
- s = MSG(" module");
+ s0 = " module";
}
- else {
- normal_class:
- s = MSG(" class");
- }
- rb_name_err_raise_str(s, c, str);
-#undef MSG
-}
-
-static VALUE
-obj_method(VALUE obj, VALUE vid, int scope)
-{
- ID id = rb_check_id(&vid);
- const VALUE klass = CLASS_OF(obj);
- const VALUE mclass = rb_cMethod;
-
- if (!id) {
- if (respond_to_missing_p(klass, obj, vid, scope)) {
- id = rb_intern_str(vid);
- return mnew_missing(klass, obj, id, id, mclass);
- }
- rb_method_name_error(klass, vid);
- }
- return mnew(klass, obj, id, mclass, scope);
+ rb_name_error_str(str, "undefined method `%"PRIsVALUE"' for%s `%"PRIsVALUE"'",
+ QUOTE(str), s0, rb_class_name(c));
}
/*
@@ -1603,7 +1452,11 @@ obj_method(VALUE obj, VALUE vid, int scope)
VALUE
rb_obj_method(VALUE obj, VALUE vid)
{
- return obj_method(obj, vid, FALSE);
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_method_name_error(CLASS_OF(obj), vid);
+ }
+ return mnew(CLASS_OF(obj), obj, id, rb_cMethod, FALSE);
}
/*
@@ -1616,7 +1469,11 @@ rb_obj_method(VALUE obj, VALUE vid)
VALUE
rb_obj_public_method(VALUE obj, VALUE vid)
{
- return obj_method(obj, vid, TRUE);
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_method_name_error(CLASS_OF(obj), vid);
+ }
+ return mnew(CLASS_OF(obj), obj, id, rb_cMethod, TRUE);
}
/*
@@ -1646,27 +1503,19 @@ rb_obj_public_method(VALUE obj, VALUE vid)
VALUE
rb_obj_singleton_method(VALUE obj, VALUE vid)
{
- const rb_method_entry_t *me;
+ rb_method_entry_t *me;
VALUE klass;
ID id = rb_check_id(&vid);
-
if (!id) {
- if (!NIL_P(klass = rb_singleton_class_get(obj)) &&
- respond_to_missing_p(klass, obj, vid, FALSE)) {
- id = rb_intern_str(vid);
- return mnew_missing(klass, obj, id, id, rb_cMethod);
- }
- undef:
- rb_name_err_raise("undefined singleton method `%1$s' for `%2$s'",
- obj, vid);
+ rb_name_error_str(vid, "undefined singleton method `%"PRIsVALUE"' for `%"PRIsVALUE"'",
+ QUOTE(vid), obj);
}
if (NIL_P(klass = rb_singleton_class_get(obj)) ||
- UNDEFINED_METHOD_ENTRY_P(me = rb_method_entry_at(klass, id)) ||
- UNDEFINED_REFINED_METHOD_P(me->def)) {
- vid = ID2SYM(id);
- goto undef;
+ !(me = rb_method_entry_at(klass, id))) {
+ rb_name_error(id, "undefined singleton method `%"PRIsVALUE"' for `%"PRIsVALUE"'",
+ QUOTE_ID(id), obj);
}
- return mnew_from_me(me, klass, obj, id, rb_cMethod, FALSE);
+ return mnew_from_me(me, klass, klass, obj, id, rb_cMethod, FALSE);
}
/*
@@ -1769,87 +1618,63 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
{
ID id;
VALUE body;
- VALUE name;
- const rb_cref_t *cref = rb_vm_cref_in_context(mod, mod);
- const rb_scope_visibility_t default_scope_visi = {METHOD_VISI_PUBLIC, FALSE};
- const rb_scope_visibility_t *scope_visi = &default_scope_visi;
- int is_method = FALSE;
+ int noex = (int)rb_vm_cref()->nd_visi;
- if (cref) {
- scope_visi = CREF_SCOPE_VISI(cref);
- }
-
- rb_check_arity(argc, 1, 2);
- name = argv[0];
- id = rb_check_id(&name);
if (argc == 1) {
-#if PROC_NEW_REQUIRES_BLOCK
+ id = rb_to_id(argv[0]);
body = rb_block_lambda();
-#else
- rb_thread_t *th = GET_THREAD();
- rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp);
- if (!block) rb_raise(rb_eArgError, proc_without_block);
-
- body = block->proc;
-
- if (SYMBOL_P(body)) {
- body = rb_sym_to_proc(body);
- }
- else if (!body) {
- body = rb_vm_make_proc_lambda(th, block, rb_cProc, TRUE);
- }
-#endif
}
else {
+ rb_check_arity(argc, 1, 2);
+ id = rb_to_id(argv[0]);
body = argv[1];
-
- if (rb_obj_is_method(body)) {
- is_method = TRUE;
- }
- else if (rb_obj_is_proc(body)) {
- is_method = FALSE;
- }
- else {
+ if (!rb_obj_is_method(body) && !rb_obj_is_proc(body)) {
rb_raise(rb_eTypeError,
"wrong argument type %s (expected Proc/Method)",
rb_obj_classname(body));
}
}
- if (!id) id = rb_to_id(name);
- if (is_method) {
+ if (rb_obj_is_method(body)) {
struct METHOD *method = (struct METHOD *)DATA_PTR(body);
- if (method->me->owner != mod && !RB_TYPE_P(method->me->owner, T_MODULE) &&
- !RTEST(rb_class_inherited_p(mod, method->me->owner))) {
- if (FL_TEST(method->me->owner, FL_SINGLETON)) {
+ VALUE rclass = method->rclass;
+ if (rclass != mod && !RB_TYPE_P(rclass, T_MODULE) &&
+ !RTEST(rb_class_inherited_p(mod, rclass))) {
+ if (FL_TEST(rclass, FL_SINGLETON)) {
rb_raise(rb_eTypeError,
"can't bind singleton method to a different class");
}
else {
rb_raise(rb_eTypeError,
"bind argument must be a subclass of % "PRIsVALUE,
- rb_class_name(method->me->owner));
+ rb_class_name(rclass));
}
}
- rb_method_entry_set(mod, id, method->me, scope_visi->method_visi);
- if (scope_visi->module_func) {
- rb_method_entry_set(rb_singleton_class(mod), id, method->me, METHOD_VISI_PUBLIC);
+ rb_method_entry_set(mod, id, method->me, noex);
+ if (noex == NOEX_MODFUNC) {
+ rb_method_entry_set(rb_singleton_class(mod), id, method->me, NOEX_PUBLIC);
}
- RB_GC_GUARD(body);
}
- else {
+ else if (rb_obj_is_proc(body)) {
rb_proc_t *proc;
body = proc_dup(body);
GetProcPtr(body, proc);
- if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
+ if (BUILTIN_TYPE(proc->block.iseq) != T_NODE) {
+ proc->block.iseq->defined_method_id = id;
+ OBJ_WRITE(proc->block.iseq->self, &proc->block.iseq->klass, mod);
proc->is_lambda = TRUE;
proc->is_from_method = TRUE;
+ proc->block.klass = mod;
}
- rb_add_method(mod, id, VM_METHOD_TYPE_BMETHOD, (void *)body, scope_visi->method_visi);
- if (scope_visi->module_func) {
- rb_add_method(rb_singleton_class(mod), id, VM_METHOD_TYPE_BMETHOD, (void *)body, METHOD_VISI_PUBLIC);
+ rb_add_method(mod, id, VM_METHOD_TYPE_BMETHOD, (void *)body, noex);
+ if (noex == NOEX_MODFUNC) {
+ rb_add_method(rb_singleton_class(mod), id, VM_METHOD_TYPE_BMETHOD, (void *)body, NOEX_PUBLIC);
}
}
+ else {
+ /* type error */
+ rb_raise(rb_eTypeError, "wrong argument type (expected Proc/Method)");
+ }
return ID2SYM(id);
}
@@ -1937,9 +1762,12 @@ method_clone(VALUE self)
TypedData_Get_Struct(self, struct METHOD, &method_data_type, orig);
clone = TypedData_Make_Struct(CLASS_OF(self), struct METHOD, &method_data_type, data);
CLONESETUP(clone, self);
- RB_OBJ_WRITE(clone, &data->recv, orig->recv);
- RB_OBJ_WRITE(clone, &data->klass, orig->klass);
- RB_OBJ_WRITE(clone, &data->me, rb_method_entry_clone(orig->me));
+ *data = *orig;
+ data->me = ALLOC(rb_method_entry_t);
+ *data->me = *orig->me;
+ if (data->me->def) data->me->def->alias_count++;
+ data->ume = ALLOC(struct unlinked_method_entry_list_entry);
+
return clone;
}
@@ -1957,21 +1785,14 @@ method_clone(VALUE self)
*/
VALUE
-rb_method_call(int argc, const VALUE *argv, VALUE method)
+rb_method_call(int argc, VALUE *argv, VALUE method)
{
VALUE proc = rb_block_given_p() ? rb_block_proc() : Qnil;
return rb_method_call_with_block(argc, argv, method, proc);
}
-static const rb_callable_method_entry_t *
-method_callable_method_entry(struct METHOD *data)
-{
- if (data->me->defined_class == 0) rb_bug("method_callable_method_entry: not callable.");
- return (const rb_callable_method_entry_t *)data->me;
-}
-
VALUE
-rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE pass_procval)
+rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procval)
{
VALUE result = Qnil; /* OK */
struct METHOD *data;
@@ -1984,18 +1805,24 @@ rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE pass_
}
PUSH_TAG();
if (OBJ_TAINTED(method)) {
- const int safe_level_to_run = RUBY_SAFE_LEVEL_MAX;
+ const int safe_level_to_run = 4 /*SAFE_LEVEL_MAX*/;
safe = rb_safe_level();
- if (safe < safe_level_to_run) {
+ if (rb_safe_level() < safe_level_to_run) {
rb_set_safe_level_force(safe_level_to_run);
}
}
if ((state = EXEC_TAG()) == 0) {
rb_thread_t *th = GET_THREAD();
+ rb_block_t *block = 0;
+
+ if (!NIL_P(pass_procval)) {
+ rb_proc_t *pass_proc;
+ GetProcPtr(pass_procval, pass_proc);
+ block = &pass_proc->block;
+ }
- th->passed_block = passed_block(pass_procval);
- VAR_INITIALIZED(data);
- result = rb_vm_call(th, data->recv, data->me->called_id, argc, argv, method_callable_method_entry(data));
+ th->passed_block = block;
+ result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me, data->defined_class);
}
POP_TAG();
if (safe >= 0)
@@ -2022,7 +1849,7 @@ rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE pass_
* these is an <code>UnboundMethod</code> object.
*
* Unbound methods can only be called after they are bound to an
- * object. That object must be a kind_of? the method's original
+ * object. That object must be be a kind_of? the method's original
* class.
*
* class Square
@@ -2100,12 +1927,11 @@ static VALUE
umethod_bind(VALUE method, VALUE recv)
{
struct METHOD *data, *bound;
- VALUE methclass, klass;
+ VALUE methclass;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
- methclass = data->me->owner;
-
+ methclass = data->rclass;
if (!RB_TYPE_P(methclass, T_MODULE) &&
methclass != CLASS_OF(recv) && !rb_obj_is_kind_of(recv, methclass)) {
if (FL_TEST(methclass, FL_SINGLETON)) {
@@ -2118,23 +1944,14 @@ umethod_bind(VALUE method, VALUE recv)
}
}
- klass = CLASS_OF(recv);
-
method = TypedData_Make_Struct(rb_cMethod, struct METHOD, &method_data_type, bound);
- RB_OBJ_WRITE(method, &bound->recv, recv);
- RB_OBJ_WRITE(method, &bound->klass, data->klass);
- RB_OBJ_WRITE(method, &bound->me, rb_method_entry_clone(data->me));
-
- if (RB_TYPE_P(bound->me->owner, T_MODULE)) {
- VALUE ic = rb_class_search_ancestor(klass, bound->me->owner);
- if (ic) {
- klass = ic;
- }
- else {
- klass = rb_include_class_new(methclass, klass);
- }
- RB_OBJ_WRITE(method, &bound->me, rb_method_entry_complement_defined_class(bound->me, bound->me->called_id, klass));
- }
+ *bound = *data;
+ bound->me = ALLOC(rb_method_entry_t);
+ *bound->me = *data->me;
+ if (bound->me->def) bound->me->def->alias_count++;
+ bound->recv = recv;
+ bound->rclass = CLASS_OF(recv);
+ data->ume = ALLOC(struct unlinked_method_entry_list_entry);
return method;
}
@@ -2148,7 +1965,6 @@ static int
rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
{
const rb_method_definition_t *def = me->def;
-
if (!def) return *max = 0;
switch (def->type) {
case VM_METHOD_TYPE_CFUNC:
@@ -2164,12 +1980,10 @@ rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
return *max = 1;
case VM_METHOD_TYPE_IVAR:
return *max = 0;
- case VM_METHOD_TYPE_ALIAS:
- return rb_method_entry_min_max_arity(def->body.alias.original_me, max);
case VM_METHOD_TYPE_BMETHOD:
return rb_proc_min_max_arity(def->body.proc, max);
case VM_METHOD_TYPE_ISEQ: {
- const rb_iseq_t *iseq = rb_iseq_check(def->body.iseq.iseqptr);
+ rb_iseq_t *iseq = def->body.iseq;
return rb_iseq_min_max_arity(iseq, max);
}
case VM_METHOD_TYPE_UNDEF:
@@ -2183,9 +1997,6 @@ rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
case OPTIMIZED_METHOD_TYPE_SEND:
*max = UNLIMITED_ARGUMENTS;
return 0;
- case OPTIMIZED_METHOD_TYPE_CALL:
- *max = UNLIMITED_ARGUMENTS;
- return 0;
default:
break;
}
@@ -2255,15 +2066,16 @@ method_arity(VALUE method)
return rb_method_entry_arity(data->me);
}
-static const rb_method_entry_t *
+static rb_method_entry_t *
original_method_entry(VALUE mod, ID id)
{
- const rb_method_entry_t *me;
-
- while ((me = rb_method_entry(mod, id)) != 0) {
- const rb_method_definition_t *def = me->def;
+ VALUE rclass;
+ rb_method_entry_t *me;
+ while ((me = rb_method_entry(mod, id, &rclass)) != 0) {
+ rb_method_definition_t *def = me->def;
+ if (!def) break;
if (def->type != VM_METHOD_TYPE_ZSUPER) break;
- mod = RCLASS_SUPER(me->owner);
+ mod = RCLASS_SUPER(rclass);
id = def->original_id;
}
return me;
@@ -2272,7 +2084,7 @@ original_method_entry(VALUE mod, ID id)
static int
method_min_max_arity(VALUE method, int *max)
{
- const struct METHOD *data;
+ struct METHOD *data;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
return rb_method_entry_min_max_arity(data->me, max);
@@ -2281,7 +2093,7 @@ method_min_max_arity(VALUE method, int *max)
int
rb_mod_method_arity(VALUE mod, ID id)
{
- const rb_method_entry_t *me = original_method_entry(mod, id);
+ rb_method_entry_t *me = original_method_entry(mod, id);
if (!me) return 0; /* should raise? */
return rb_method_entry_arity(me);
}
@@ -2292,84 +2104,56 @@ rb_obj_method_arity(VALUE obj, ID id)
return rb_mod_method_arity(CLASS_OF(obj), id);
}
-static inline const rb_method_definition_t *
-method_def(VALUE method)
+static inline rb_method_definition_t *
+method_get_def(VALUE method)
{
- const struct METHOD *data;
+ struct METHOD *data;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
return data->me->def;
}
-static const rb_iseq_t *
-method_def_iseq(const rb_method_definition_t *def)
+static rb_iseq_t *
+method_get_iseq(rb_method_definition_t *def)
{
switch (def->type) {
- case VM_METHOD_TYPE_ISEQ:
- return rb_iseq_check(def->body.iseq.iseqptr);
case VM_METHOD_TYPE_BMETHOD:
- return rb_proc_get_iseq(def->body.proc, 0);
- case VM_METHOD_TYPE_ALIAS:
- return method_def_iseq(def->body.alias.original_me->def);
- case VM_METHOD_TYPE_CFUNC:
- case VM_METHOD_TYPE_ATTRSET:
- case VM_METHOD_TYPE_IVAR:
- case VM_METHOD_TYPE_ZSUPER:
- case VM_METHOD_TYPE_UNDEF:
- case VM_METHOD_TYPE_NOTIMPLEMENTED:
- case VM_METHOD_TYPE_OPTIMIZED:
- case VM_METHOD_TYPE_MISSING:
- case VM_METHOD_TYPE_REFINED:
- break;
+ return get_proc_iseq(def->body.proc, 0);
+ case VM_METHOD_TYPE_ISEQ:
+ return def->body.iseq;
+ default:
+ return 0;
}
- return NULL;
-}
-
-const rb_iseq_t *
-rb_method_iseq(VALUE method)
-{
- return method_def_iseq(method_def(method));
}
-static const rb_cref_t *
-method_cref(VALUE method)
+rb_iseq_t *
+rb_method_get_iseq(VALUE method)
{
- const rb_method_definition_t *def = method_def(method);
-
- again:
- switch (def->type) {
- case VM_METHOD_TYPE_ISEQ:
- return def->body.iseq.cref;
- case VM_METHOD_TYPE_ALIAS:
- def = def->body.alias.original_me->def;
- goto again;
- default:
- return NULL;
- }
+ return method_get_iseq(method_get_def(method));
}
static VALUE
-method_def_location(const rb_method_definition_t *def)
+method_def_location(rb_method_definition_t *def)
{
if (def->type == VM_METHOD_TYPE_ATTRSET || def->type == VM_METHOD_TYPE_IVAR) {
if (!def->body.attr.location)
return Qnil;
return rb_ary_dup(def->body.attr.location);
}
- return iseq_location(method_def_iseq(def));
+ return iseq_location(method_get_iseq(def));
}
VALUE
-rb_method_entry_location(const rb_method_entry_t *me)
+rb_method_entry_location(rb_method_entry_t *me)
{
- if (!me) return Qnil;
+ if (!me || !me->def) return Qnil;
return method_def_location(me->def);
}
VALUE
rb_mod_method_location(VALUE mod, ID id)
{
- const rb_method_entry_t *me = original_method_entry(mod, id);
+ rb_method_entry_t *me = original_method_entry(mod, id);
return rb_method_entry_location(me);
}
@@ -2384,13 +2168,14 @@ rb_obj_method_location(VALUE obj, ID id)
* meth.source_location -> [String, Fixnum]
*
* Returns the Ruby source filename and line number containing this method
- * or nil if this method was not defined in Ruby (i.e. native).
+ * or nil if this method was not defined in Ruby (i.e. native)
*/
VALUE
rb_method_location(VALUE method)
{
- return method_def_location(method_def(method));
+ rb_method_definition_t *def = method_get_def(method);
+ return method_def_location(def);
}
/*
@@ -2403,7 +2188,7 @@ rb_method_location(VALUE method)
static VALUE
rb_method_parameters(VALUE method)
{
- const rb_iseq_t *iseq = rb_method_iseq(method);
+ rb_iseq_t *iseq = rb_method_get_iseq(method);
if (!iseq) {
return unnamed_parameters(method_arity(method));
}
@@ -2427,8 +2212,6 @@ method_inspect(VALUE method)
VALUE str;
const char *s;
const char *sharp = "#";
- VALUE mklass;
- VALUE defined_class;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
str = rb_str_buf_new2("#<");
@@ -2436,24 +2219,11 @@ method_inspect(VALUE method)
rb_str_buf_cat2(str, s);
rb_str_buf_cat2(str, ": ");
- mklass = data->klass;
-
- if (data->me->def->type == VM_METHOD_TYPE_ALIAS) {
- defined_class = data->me->def->body.alias.original_me->owner;
- }
- else {
- defined_class = method_entry_defined_class(data->me);
- }
-
- if (RB_TYPE_P(defined_class, T_ICLASS)) {
- defined_class = RBASIC_CLASS(defined_class);
- }
-
- if (FL_TEST(mklass, FL_SINGLETON)) {
- VALUE v = rb_ivar_get(mklass, attached);
+ if (FL_TEST(data->me->klass, FL_SINGLETON)) {
+ VALUE v = rb_ivar_get(data->me->klass, attached);
if (data->recv == Qundef) {
- rb_str_buf_append(str, rb_inspect(mklass));
+ rb_str_buf_append(str, rb_inspect(data->me->klass));
}
else if (data->recv == v) {
rb_str_buf_append(str, rb_inspect(v));
@@ -2468,16 +2238,16 @@ method_inspect(VALUE method)
}
}
else {
- rb_str_buf_append(str, rb_class_name(mklass));
- if (defined_class != mklass) {
+ rb_str_buf_append(str, rb_class_name(data->rclass));
+ if (data->rclass != data->me->klass) {
rb_str_buf_cat2(str, "(");
- rb_str_buf_append(str, rb_class_name(defined_class));
+ rb_str_buf_append(str, rb_class_name(data->me->klass));
rb_str_buf_cat2(str, ")");
}
}
rb_str_buf_cat2(str, sharp);
- rb_str_append(str, rb_id2str(data->me->called_id));
- if (data->me->called_id != data->me->def->original_id) {
+ rb_str_append(str, rb_id2str(data->id));
+ if (data->id != data->me->def->original_id) {
rb_str_catf(str, "(%"PRIsVALUE")",
rb_id2str(data->me->def->original_id));
}
@@ -2492,13 +2262,13 @@ method_inspect(VALUE method)
static VALUE
mproc(VALUE method)
{
- return rb_funcallv(rb_mRubyVMFrozenCore, idProc, 0, 0);
+ return rb_funcall2(rb_mRubyVMFrozenCore, idProc, 0, 0);
}
static VALUE
mlambda(VALUE method)
{
- return rb_funcallv(rb_mRubyVMFrozenCore, idLambda, 0, 0);
+ return rb_funcall(rb_mRubyVMFrozenCore, idLambda, 0, 0);
}
static VALUE
@@ -2530,21 +2300,20 @@ rb_proc_new(
/*
* call-seq:
- * meth.to_proc -> proc
+ * meth.to_proc -> prc
*
* Returns a <code>Proc</code> object corresponding to this method.
*/
static VALUE
-method_to_proc(VALUE method)
+method_proc(VALUE method)
{
VALUE procval;
rb_proc_t *proc;
-
/*
* class Method
* def to_proc
- * lambda{|*args|
+ * proc{|*args|
* self.call(*args)
* }
* end
@@ -2558,29 +2327,6 @@ method_to_proc(VALUE method)
/*
* call-seq:
- * meth.super_method -> method
- *
- * Returns a Method of superclass which would be called when super is used
- * or nil if there is no method on superclass.
- */
-
-static VALUE
-method_super_method(VALUE method)
-{
- const struct METHOD *data;
- VALUE super_class;
- const rb_method_entry_t *me;
-
- TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
- super_class = RCLASS_SUPER(RCLASS_ORIGIN(method_entry_defined_class(data->me)));
- if (!super_class) return Qnil;
- me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(super_class, data->me->called_id);
- if (!me) return Qnil;
- return mnew_internal(me, super_class, data->recv, data->me->called_id, rb_obj_class(method), FALSE, FALSE);
-}
-
-/*
- * call-seq:
* local_jump_error.exit_value -> obj
*
* Returns the exit value associated with this +LocalJumpError+.
@@ -2605,29 +2351,6 @@ localjump_reason(VALUE exc)
return rb_iv_get(exc, "@reason");
}
-rb_cref_t *rb_vm_cref_new_toplevel(void); /* vm.c */
-
-static VALUE
-env_clone(VALUE envval, VALUE receiver, const rb_cref_t *cref)
-{
- VALUE newenvval = TypedData_Wrap_Struct(RBASIC_CLASS(envval), RTYPEDDATA_TYPE(envval), 0);
- rb_env_t *env, *newenv;
- int envsize;
-
- if (cref == NULL) {
- cref = rb_vm_cref_new_toplevel();
- }
-
- GetEnvPtr(envval, env);
- envsize = sizeof(rb_env_t) + (env->env_size - 1) * sizeof(VALUE);
- newenv = xmalloc(envsize);
- memcpy(newenv, env, envsize);
- RTYPEDDATA_DATA(newenvval) = newenv;
- newenv->block.self = receiver;
- newenv->block.ep[-1] = (VALUE)cref;
- return newenvval;
-}
-
/*
* call-seq:
* prc.binding -> binding
@@ -2646,42 +2369,28 @@ env_clone(VALUE envval, VALUE receiver, const rb_cref_t *cref)
static VALUE
proc_binding(VALUE self)
{
- VALUE bindval, envval;
- const rb_proc_t *proc;
- const rb_iseq_t *iseq;
+ rb_proc_t *proc;
+ VALUE bindval;
rb_binding_t *bind;
GetProcPtr(self, proc);
- envval = rb_vm_proc_envval(proc);
- iseq = proc->block.iseq;
- if (SYMBOL_P(iseq)) goto error;
- if (RUBY_VM_IFUNC_P(iseq)) {
- struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
- if (IS_METHOD_PROC_IFUNC(ifunc)) {
- VALUE method = (VALUE)ifunc->data;
- envval = env_clone(envval, method_receiver(method), method_cref(method));
- iseq = rb_method_iseq(method);
- }
- else {
- error:
+ if (RB_TYPE_P((VALUE)proc->block.iseq, T_NODE)) {
+ if (!IS_METHOD_PROC_NODE((NODE *)proc->block.iseq)) {
rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
}
}
- bindval = rb_binding_alloc(rb_cBinding);
+ bindval = binding_alloc(rb_cBinding);
GetBindingPtr(bindval, bind);
- bind->env = envval;
-
- if (iseq) {
- rb_iseq_check(iseq);
- bind->path = iseq->body->location.path;
- bind->first_lineno = FIX2INT(rb_iseq_first_lineno(iseq));
+ bind->env = proc->envval;
+ if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
+ bind->path = proc->block.iseq->location.path;
+ bind->first_lineno = FIX2INT(rb_iseq_first_lineno(proc->block.iseq->self));
}
else {
bind->path = Qnil;
bind->first_lineno = 0;
}
-
return bindval;
}
@@ -2755,22 +2464,22 @@ curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
*
* b = lambda {|x, y, z| (x||0) + (y||0) + (z||0) }
* p b.curry[1][2][3] #=> 6
- * p b.curry[1, 2][3, 4] #=> wrong number of arguments (given 4, expected 3)
- * p b.curry(5) #=> wrong number of arguments (given 5, expected 3)
- * p b.curry(1) #=> wrong number of arguments (given 1, expected 3)
+ * p b.curry[1, 2][3, 4] #=> wrong number of arguments (4 for 3)
+ * p b.curry(5) #=> wrong number of arguments (5 for 3)
+ * p b.curry(1) #=> wrong number of arguments (1 for 3)
*
* b = lambda {|x, y, z, *w| (x||0) + (y||0) + (z||0) + w.inject(0, &:+) }
* p b.curry[1][2][3] #=> 6
* p b.curry[1, 2][3, 4] #=> 10
* p b.curry(5)[1][2][3][4][5] #=> 15
* p b.curry(5)[1, 2][3, 4][5] #=> 15
- * p b.curry(1) #=> wrong number of arguments (given 1, expected 3)
+ * p b.curry(1) #=> wrong number of arguments (1 for 3)
*
* b = proc { :foo }
* p b.curry[] #=> :foo
*/
static VALUE
-proc_curry(int argc, const VALUE *argv, VALUE self)
+proc_curry(int argc, VALUE *argv, VALUE self)
{
int sarity, max_arity, min_arity = rb_proc_min_max_arity(self, &max_arity);
VALUE arity;
@@ -2790,45 +2499,6 @@ proc_curry(int argc, const VALUE *argv, VALUE self)
}
/*
- * call-seq:
- * meth.curry -> proc
- * meth.curry(arity) -> proc
- *
- * Returns a curried proc based on the method. When the proc is called with a number of
- * arguments that is lower than the method's arity, then another curried proc is returned.
- * Only when enough arguments have been supplied to satisfy the method signature, will the
- * method actually be called.
- *
- * The optional <i>arity</i> argument should be supplied when currying methods with
- * variable arguments to determine how many arguments are needed before the method is
- * called.
- *
- * def foo(a,b,c)
- * [a, b, c]
- * end
- *
- * proc = self.method(:foo).curry
- * proc2 = proc.call(1, 2) #=> #<Proc>
- * proc2.call(3) #=> [1,2,3]
- *
- * def vararg(*args)
- * args
- * end
- *
- * proc = self.method(:vararg).curry(4)
- * proc2 = proc.call(:x) #=> #<Proc>
- * proc3 = proc2.call(:y, :z) #=> #<Proc>
- * proc3.call(:a) #=> [:x, :y, :z, :a]
- */
-
-static VALUE
-rb_method_curry(int argc, const VALUE *argv, VALUE self)
-{
- VALUE proc = method_to_proc(self);
- return proc_curry(argc, argv, proc);
-}
-
-/*
* Document-class: LocalJumpError
*
* Raised when Ruby can't yield as requested.
@@ -2897,22 +2567,21 @@ Init_Proc(void)
rb_undef_alloc_func(rb_cProc);
rb_define_singleton_method(rb_cProc, "new", rb_proc_s_new, -1);
+#if 0 /* incomplete. */
rb_add_method(rb_cProc, rb_intern("call"), VM_METHOD_TYPE_OPTIMIZED,
- (void *)OPTIMIZED_METHOD_TYPE_CALL, METHOD_VISI_PUBLIC);
+ (void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
rb_add_method(rb_cProc, rb_intern("[]"), VM_METHOD_TYPE_OPTIMIZED,
- (void *)OPTIMIZED_METHOD_TYPE_CALL, METHOD_VISI_PUBLIC);
+ (void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
rb_add_method(rb_cProc, rb_intern("==="), VM_METHOD_TYPE_OPTIMIZED,
- (void *)OPTIMIZED_METHOD_TYPE_CALL, METHOD_VISI_PUBLIC);
+ (void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
rb_add_method(rb_cProc, rb_intern("yield"), VM_METHOD_TYPE_OPTIMIZED,
- (void *)OPTIMIZED_METHOD_TYPE_CALL, METHOD_VISI_PUBLIC);
-
-#if 0 /* for RDoc */
+ (void *)OPTIMIZED_METHOD_TYPE_CALL, 0);
+#else
rb_define_method(rb_cProc, "call", proc_call, -1);
rb_define_method(rb_cProc, "[]", proc_call, -1);
rb_define_method(rb_cProc, "===", proc_call, -1);
rb_define_method(rb_cProc, "yield", proc_call, -1);
#endif
-
rb_define_method(rb_cProc, "to_proc", proc_to_proc, 0);
rb_define_method(rb_cProc, "arity", proc_arity, 0);
rb_define_method(rb_cProc, "clone", proc_clone, 0);
@@ -2932,7 +2601,9 @@ Init_Proc(void)
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eException);
- rb_vm_register_special_exception(ruby_error_sysstack, rb_eSysStackError, "stack level too deep");
+ sysstack_error = rb_exc_new3(rb_eSysStackError,
+ rb_obj_freeze(rb_str_new2("stack level too deep")));
+ OBJ_TAINT(sysstack_error);
/* utility functions */
rb_define_global_function("proc", rb_block_proc, 0);
@@ -2947,12 +2618,11 @@ Init_Proc(void)
rb_define_method(rb_cMethod, "hash", method_hash, 0);
rb_define_method(rb_cMethod, "clone", method_clone, 0);
rb_define_method(rb_cMethod, "call", rb_method_call, -1);
- rb_define_method(rb_cMethod, "curry", rb_method_curry, -1);
rb_define_method(rb_cMethod, "[]", rb_method_call, -1);
rb_define_method(rb_cMethod, "arity", method_arity_m, 0);
rb_define_method(rb_cMethod, "inspect", method_inspect, 0);
rb_define_method(rb_cMethod, "to_s", method_inspect, 0);
- rb_define_method(rb_cMethod, "to_proc", method_to_proc, 0);
+ rb_define_method(rb_cMethod, "to_proc", method_proc, 0);
rb_define_method(rb_cMethod, "receiver", method_receiver, 0);
rb_define_method(rb_cMethod, "name", method_name, 0);
rb_define_method(rb_cMethod, "original_name", method_original_name, 0);
@@ -2960,7 +2630,6 @@ Init_Proc(void)
rb_define_method(rb_cMethod, "unbind", method_unbind, 0);
rb_define_method(rb_cMethod, "source_location", rb_method_location, 0);
rb_define_method(rb_cMethod, "parameters", rb_method_parameters, 0);
- rb_define_method(rb_cMethod, "super_method", method_super_method, 0);
rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
rb_define_method(rb_mKernel, "public_method", rb_obj_public_method, 1);
rb_define_method(rb_mKernel, "singleton_method", rb_obj_singleton_method, 1);
@@ -2982,7 +2651,6 @@ Init_Proc(void)
rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
rb_define_method(rb_cUnboundMethod, "source_location", rb_method_location, 0);
rb_define_method(rb_cUnboundMethod, "parameters", rb_method_parameters, 0);
- rb_define_method(rb_cUnboundMethod, "super_method", method_super_method, 0);
/* Module#*_method */
rb_define_method(rb_cModule, "instance_method", rb_mod_instance_method, 1);
@@ -3014,7 +2682,7 @@ Init_Proc(void)
* @secret = n
* end
* def get_binding
- * binding
+ * return binding()
* end
* end
*
@@ -3040,10 +2708,9 @@ Init_Binding(void)
rb_define_method(rb_cBinding, "clone", binding_clone, 0);
rb_define_method(rb_cBinding, "dup", binding_dup, 0);
rb_define_method(rb_cBinding, "eval", bind_eval, -1);
- rb_define_method(rb_cBinding, "local_variables", bind_local_variables, 0);
rb_define_method(rb_cBinding, "local_variable_get", bind_local_variable_get, 1);
rb_define_method(rb_cBinding, "local_variable_set", bind_local_variable_set, 2);
rb_define_method(rb_cBinding, "local_variable_defined?", bind_local_variable_defined_p, 1);
- rb_define_method(rb_cBinding, "receiver", bind_receiver, 0);
rb_define_global_function("binding", rb_f_binding, 0);
}
+
diff --git a/process.c b/process.c
index dc3784cd7c..c12182abfe 100644
--- a/process.c
+++ b/process.c
@@ -11,10 +11,11 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
+#include "internal.h"
#include "vm_core.h"
#include <stdio.h>
@@ -49,9 +50,6 @@
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
-#ifdef HAVE_VFORK_H
-# include <vfork.h>
-#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
@@ -60,13 +58,14 @@
#endif
#include "ruby/st.h"
+#ifdef __EMX__
+#undef HAVE_GETPGRP
+#endif
+
#include <sys/stat.h>
#if defined(__native_client__) && defined(NACL_NEWLIB)
-# include <sys/unistd.h>
# include "nacl/stat.h"
# include "nacl/unistd.h"
-# include "nacl/resource.h"
-# undef HAVE_ISSETUGID
#endif
#ifdef HAVE_SYS_TIME_H
@@ -81,24 +80,12 @@
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
-# ifdef __CYGWIN__
-int initgroups(const char *, rb_gid_t);
-# endif
-#endif
-#ifdef HAVE_SYS_ID_H
-#include <sys/id.h>
#endif
#ifdef __APPLE__
# include <mach/mach_time.h>
#endif
-/* define system APIs */
-#ifdef _WIN32
-#undef open
-#define open rb_w32_uopen
-#endif
-
#if defined(HAVE_TIMES) || defined(_WIN32)
static VALUE rb_cProcessTms;
#endif
@@ -164,38 +151,20 @@ static void check_gid_switch(void);
#if defined(HAVE_PWD_H)
# if defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX)
# define USE_GETPWNAM_R 1
-# define GETPW_R_SIZE_INIT sysconf(_SC_GETPW_R_SIZE_MAX)
-# define GETPW_R_SIZE_DEFAULT 0x1000
-# define GETPW_R_SIZE_LIMIT 0x10000
# endif
# ifdef USE_GETPWNAM_R
# define PREPARE_GETPWNAM \
- VALUE getpw_buf = 0
-# define FINISH_GETPWNAM \
- (getpw_buf ? (void)rb_str_resize(getpw_buf, 0) : (void)0)
-# define OBJ2UID1(id) obj2uid((id), &getpw_buf)
-# define OBJ2UID(id) obj2uid0(id)
-static rb_uid_t obj2uid(VALUE id, VALUE *getpw_buf);
-static inline rb_uid_t
-obj2uid0(VALUE id)
-{
- rb_uid_t uid;
- PREPARE_GETPWNAM;
- uid = OBJ2UID1(id);
- FINISH_GETPWNAM;
- return uid;
-}
+ long getpw_buf_len = sysconf(_SC_GETPW_R_SIZE_MAX); \
+ char *getpw_buf = ALLOCA_N(char, (getpw_buf_len < 0 ? (getpw_buf_len = 4096) : getpw_buf_len));
+# define OBJ2UID(id) obj2uid((id), getpw_buf, getpw_buf_len)
+static rb_uid_t obj2uid(VALUE id, char *getpw_buf, size_t getpw_buf_len);
# else
# define PREPARE_GETPWNAM /* do nothing */
-# define FINISH_GETPWNAM /* do nothing */
-# define OBJ2UID1(id) obj2uid((id))
# define OBJ2UID(id) obj2uid((id))
static rb_uid_t obj2uid(VALUE id);
# endif
#else
# define PREPARE_GETPWNAM /* do nothing */
-# define FINISH_GETPWNAM /* do nothing */
-# define OBJ2UID1(id) NUM2UIDT(id)
# define OBJ2UID(id) NUM2UIDT(id)
# ifdef p_uid_from_name
# undef p_uid_from_name
@@ -206,39 +175,20 @@ static rb_uid_t obj2uid(VALUE id);
#if defined(HAVE_GRP_H)
# if defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
# define USE_GETGRNAM_R
-# define GETGR_R_SIZE_INIT sysconf(_SC_GETGR_R_SIZE_MAX)
-# define GETGR_R_SIZE_DEFAULT 0x1000
-# define GETGR_R_SIZE_LIMIT 0x10000
# endif
# ifdef USE_GETGRNAM_R
# define PREPARE_GETGRNAM \
- VALUE getgr_buf = 0
-# define FINISH_GETGRNAM \
- (getgr_buf ? (void)rb_str_resize(getgr_buf, 0) : (void)0)
-# define OBJ2GID1(id) obj2gid((id), &getgr_buf)
-# define OBJ2GID(id) obj2gid0(id)
-static rb_gid_t obj2gid(VALUE id, VALUE *getgr_buf);
-static inline rb_gid_t
-obj2gid0(VALUE id)
-{
- rb_gid_t gid;
- PREPARE_GETGRNAM;
- gid = OBJ2GID1(id);
- FINISH_GETGRNAM;
- return gid;
-}
-static rb_gid_t obj2gid(VALUE id, VALUE *getgr_buf);
+ long getgr_buf_len = sysconf(_SC_GETGR_R_SIZE_MAX); \
+ char *getgr_buf = ALLOCA_N(char, (getgr_buf_len < 0 ? (getgr_buf_len = 4096) : getgr_buf_len));
+# define OBJ2GID(id) obj2gid((id), getgr_buf, getgr_buf_len)
+static rb_gid_t obj2gid(VALUE id, char *getgr_buf, size_t getgr_buf_len);
# else
# define PREPARE_GETGRNAM /* do nothing */
-# define FINISH_GETGRNAM /* do nothing */
-# define OBJ2GID1(id) obj2gid((id))
# define OBJ2GID(id) obj2gid((id))
static rb_gid_t obj2gid(VALUE id);
# endif
#else
# define PREPARE_GETGRNAM /* do nothing */
-# define FINISH_GETGRNAM /* do nothing */
-# define OBJ2GID1(id) NUM2GIDT(id)
# define OBJ2GID(id) NUM2GIDT(id)
# ifdef p_gid_from_name
# undef p_gid_from_name
@@ -254,152 +204,6 @@ typedef unsigned long unsigned_clock_t;
typedef unsigned LONG_LONG unsigned_clock_t;
#endif
-static ID id_in, id_out, id_err, id_pid, id_uid, id_gid;
-static ID id_close, id_child;
-#ifdef HAVE_SETPGID
-static ID id_pgroup;
-#endif
-#ifdef _WIN32
-static ID id_new_pgroup;
-#endif
-static ID id_unsetenv_others, id_chdir, id_umask, id_close_others, id_ENV;
-static ID id_nanosecond, id_microsecond, id_millisecond, id_second;
-static ID id_float_microsecond, id_float_millisecond, id_float_second;
-static ID id_GETTIMEOFDAY_BASED_CLOCK_REALTIME, id_TIME_BASED_CLOCK_REALTIME;
-#ifdef HAVE_TIMES
-static ID id_TIMES_BASED_CLOCK_MONOTONIC;
-static ID id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID;
-#endif
-#ifdef RUSAGE_SELF
-static ID id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID;
-#endif
-static ID id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID;
-#ifdef __APPLE__
-static ID id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC;
-#endif
-static ID id_hertz;
-extern ID ruby_static_id_status;
-#define id_status ruby_static_id_status
-
-/* execv and execl are async-signal-safe since SUSv4 (POSIX.1-2008, XPG7) */
-#if defined(__sun) && !defined(_XPG7) /* Solaris 10, 9, ... */
-#define execv(path, argv) (rb_async_bug_errno("unreachable: async-signal-unsafe execv() is called", 0))
-#define execl(path, arg0, arg1, arg2, term) do { extern char **environ; execle((path), (arg0), (arg1), (arg2), (term), (environ)); } while (0)
-#define ALWAYS_NEED_ENVP 1
-#else
-#define ALWAYS_NEED_ENVP 0
-#endif
-
-static inline int
-close_unless_reserved(int fd)
-{
- /* We should not have reserved FDs at this point */
- if (rb_reserved_fd_p(fd)) { /* async-signal-safe */
- rb_async_bug_errno("BUG timer thread still running", 0 /* EDOOFUS */);
- return 0;
- }
- return close(fd); /* async-signal-safe */
-}
-
-/*#define DEBUG_REDIRECT*/
-#if defined(DEBUG_REDIRECT)
-
-#include <stdarg.h>
-
-static void
-ttyprintf(const char *fmt, ...)
-{
- va_list ap;
- FILE *tty;
- int save = errno;
-#ifdef _WIN32
- tty = fopen("con", "w");
-#else
- tty = fopen("/dev/tty", "w");
-#endif
- if (!tty)
- return;
-
- va_start(ap, fmt);
- vfprintf(tty, fmt, ap);
- va_end(ap);
- fclose(tty);
- errno = save;
-}
-
-static int
-redirect_dup(int oldfd)
-{
- int ret;
- ret = dup(oldfd);
- ttyprintf("dup(%d) => %d\n", oldfd, ret);
- return ret;
-}
-
-static int
-redirect_dup2(int oldfd, int newfd)
-{
- int ret;
- ret = dup2(oldfd, newfd);
- ttyprintf("dup2(%d, %d) => %d\n", oldfd, newfd, ret);
- return ret;
-}
-
-static int
-redirect_cloexec_dup(int oldfd)
-{
- int ret;
- ret = rb_cloexec_dup(oldfd);
- ttyprintf("cloexec_dup(%d) => %d\n", oldfd, ret);
- return ret;
-}
-
-static int
-redirect_cloexec_dup2(int oldfd, int newfd)
-{
- int ret;
- ret = rb_cloexec_dup2(oldfd, newfd);
- ttyprintf("cloexec_dup2(%d, %d) => %d\n", oldfd, newfd, ret);
- return ret;
-}
-
-static int
-redirect_close(int fd)
-{
- int ret;
- ret = close_unless_reserved(fd);
- ttyprintf("close(%d) => %d\n", fd, ret);
- return ret;
-}
-
-static int
-parent_redirect_open(const char *pathname, int flags, mode_t perm)
-{
- int ret;
- ret = rb_cloexec_open(pathname, flags, perm);
- ttyprintf("parent_open(\"%s\", 0x%x, 0%o) => %d\n", pathname, flags, perm, ret);
- return ret;
-}
-
-static int
-parent_redirect_close(int fd)
-{
- int ret;
- ret = close_unless_reserved(fd);
- ttyprintf("parent_close(%d) => %d\n", fd, ret);
- return ret;
-}
-
-#else
-#define redirect_dup(oldfd) dup(oldfd)
-#define redirect_dup2(oldfd, newfd) dup2((oldfd), (newfd))
-#define redirect_cloexec_dup(oldfd) rb_cloexec_dup(oldfd)
-#define redirect_cloexec_dup2(oldfd, newfd) rb_cloexec_dup2((oldfd), (newfd))
-#define redirect_close(fd) close_unless_reserved(fd)
-#define parent_redirect_open(pathname, flags, perm) rb_cloexec_open((pathname), (flags), (perm))
-#define parent_redirect_close(fd) close_unless_reserved(fd)
-#endif
-
/*
* call-seq:
* Process.pid -> fixnum
@@ -413,6 +217,7 @@ parent_redirect_close(int fd)
static VALUE
get_pid(void)
{
+ rb_secure(2);
return PIDT2NUM(getpid());
}
@@ -436,6 +241,7 @@ get_pid(void)
static VALUE
get_ppid(void)
{
+ rb_secure(2);
return PIDT2NUM(getppid());
}
@@ -483,8 +289,8 @@ rb_last_status_set(int status, rb_pid_t pid)
{
rb_thread_t *th = GET_THREAD();
th->last_status = rb_obj_alloc(rb_cProcessStatus);
- rb_ivar_set(th->last_status, id_status, INT2FIX(status));
- rb_ivar_set(th->last_status, id_pid, PIDT2NUM(pid));
+ rb_iv_set(th->last_status, "status", INT2FIX(status));
+ rb_iv_set(th->last_status, "pid", PIDT2NUM(pid));
}
void
@@ -509,7 +315,7 @@ rb_last_status_clear(void)
static VALUE
pst_to_i(VALUE st)
{
- return rb_ivar_get(st, id_status);
+ return rb_iv_get(st, "status");
}
#define PST2INT(st) NUM2INT(pst_to_i(st))
@@ -528,7 +334,7 @@ pst_to_i(VALUE st)
static VALUE
pst_pid(VALUE st)
{
- return rb_attr_get(st, id_pid);
+ return rb_attr_get(st, rb_intern("pid"));
}
static void
@@ -856,60 +662,121 @@ pst_wcoredump(VALUE st)
#endif
}
-struct waitpid_arg {
+#if !defined(HAVE_WAITPID) && !defined(HAVE_WAIT4)
+#define NO_WAITPID
+static st_table *pid_tbl;
+
+struct wait_data {
rb_pid_t pid;
- int flags;
- int *st;
+ int status;
};
-static rb_pid_t
-do_waitpid(rb_pid_t pid, int *st, int flags)
+static int
+wait_each(rb_pid_t pid, int status, struct wait_data *data)
{
-#if defined HAVE_WAITPID
- return waitpid(pid, st, flags);
-#elif defined HAVE_WAIT4
- return wait4(pid, st, flags, NULL);
+ if (data->status != -1) return ST_STOP;
+
+ data->pid = pid;
+ data->status = status;
+ return ST_DELETE;
+}
+
+static int
+waitall_each(rb_pid_t pid, int status, VALUE ary)
+{
+ rb_last_status_set(status, pid);
+ rb_ary_push(ary, rb_assoc_new(PIDT2NUM(pid), rb_last_status_get()));
+ return ST_DELETE;
+}
#else
-# error waitpid or wait4 is required.
+struct waitpid_arg {
+ rb_pid_t pid;
+ int *st;
+ int flags;
+};
#endif
-}
static void *
rb_waitpid_blocking(void *data)
{
+ rb_pid_t result;
+#ifndef NO_WAITPID
struct waitpid_arg *arg = data;
- rb_pid_t result = do_waitpid(arg->pid, arg->st, arg->flags);
+#endif
+
+#if defined NO_WAITPID
+ result = wait(data);
+#elif defined HAVE_WAITPID
+ result = waitpid(arg->pid, arg->st, arg->flags);
+#else /* HAVE_WAIT4 */
+ result = wait4(arg->pid, arg->st, arg->flags, NULL);
+#endif
+
return (void *)(VALUE)result;
}
-static rb_pid_t
-do_waitpid_nonblocking(rb_pid_t pid, int *st, int flags)
+rb_pid_t
+rb_waitpid(rb_pid_t pid, int *st, int flags)
{
- void *result;
+ rb_pid_t result;
+#ifndef NO_WAITPID
struct waitpid_arg arg;
+
+ retry:
arg.pid = pid;
arg.st = st;
arg.flags = flags;
- result = rb_thread_call_without_gvl(rb_waitpid_blocking, &arg,
- RUBY_UBF_PROCESS, 0);
- return (rb_pid_t)(VALUE)result;
-}
-
-rb_pid_t
-rb_waitpid(rb_pid_t pid, int *st, int flags)
-{
- rb_pid_t result;
+ result = (rb_pid_t)(VALUE)rb_thread_call_without_gvl(rb_waitpid_blocking, &arg,
+ RUBY_UBF_PROCESS, 0);
+ if (result < 0) {
+ if (errno == EINTR) {
+ RUBY_VM_CHECK_INTS(GET_THREAD());
+ goto retry;
+ }
+ return (rb_pid_t)-1;
+ }
+#else /* NO_WAITPID */
+ if (pid_tbl) {
+ st_data_t status, piddata = (st_data_t)pid;
+ if (pid == (rb_pid_t)-1) {
+ struct wait_data data;
+ data.pid = (rb_pid_t)-1;
+ data.status = -1;
+ st_foreach(pid_tbl, wait_each, (st_data_t)&data);
+ if (data.status != -1) {
+ rb_last_status_set(data.status, data.pid);
+ return data.pid;
+ }
+ }
+ else if (st_delete(pid_tbl, &piddata, &status)) {
+ rb_last_status_set(*st = (int)status, pid);
+ return pid;
+ }
+ }
- if (flags & WNOHANG) {
- result = do_waitpid(pid, st, flags);
+ if (flags) {
+ rb_raise(rb_eArgError, "can't do waitpid with flags");
}
- else {
- while ((result = do_waitpid_nonblocking(pid, st, flags)) < 0 &&
- (errno == EINTR)) {
- rb_thread_t *th = GET_THREAD();
- RUBY_VM_CHECK_INTS(th);
+
+ for (;;) {
+ result = (rb_pid_t)(VALUE)rb_thread_blocking_region(rb_waitpid_blocking,
+ st, RUBY_UBF_PROCESS, 0);
+ if (result < 0) {
+ if (errno == EINTR) {
+ rb_thread_schedule();
+ continue;
+ }
+ return (rb_pid_t)-1;
+ }
+ if (result == pid || pid == (rb_pid_t)-1) {
+ break;
}
+ if (!pid_tbl)
+ pid_tbl = st_init_numtable();
+ st_insert(pid_tbl, pid, (st_data_t)st);
+ if (!rb_thread_alone()) rb_thread_schedule();
}
+#endif
if (result > 0) {
rb_last_status_set(*st, result);
}
@@ -982,6 +849,7 @@ proc_wait(int argc, VALUE *argv)
rb_pid_t pid;
int flags, status;
+ rb_secure(2);
flags = 0;
if (argc == 0) {
pid = -1;
@@ -1055,28 +923,53 @@ proc_waitall(void)
rb_pid_t pid;
int status;
+ rb_secure(2);
result = rb_ary_new();
+#ifdef NO_WAITPID
+ if (pid_tbl) {
+ st_foreach(pid_tbl, waitall_each, result);
+ }
+#else
rb_last_status_clear();
+#endif
for (pid = -1;;) {
+#ifdef NO_WAITPID
+ pid = wait(&status);
+#else
pid = rb_waitpid(-1, &status, 0);
+#endif
if (pid == -1) {
- int e = errno;
- if (e == ECHILD)
+ if (errno == ECHILD)
break;
- rb_syserr_fail(e, 0);
+#ifdef NO_WAITPID
+ if (errno == EINTR) {
+ rb_thread_schedule();
+ continue;
+ }
+#endif
+ rb_sys_fail(0);
}
+#ifdef NO_WAITPID
+ rb_last_status_set(status, pid);
+#endif
rb_ary_push(result, rb_assoc_new(PIDT2NUM(pid), rb_last_status_get()));
}
return result;
}
-static VALUE rb_cWaiter;
+static inline ID
+id_pid(void)
+{
+ ID pid;
+ CONST_ID(pid, "pid");
+ return pid;
+}
static VALUE
detach_process_pid(VALUE thread)
{
- return rb_thread_local_aref(thread, id_pid);
+ return rb_thread_local_aref(thread, id_pid());
}
static VALUE
@@ -1095,8 +988,8 @@ VALUE
rb_detach_process(rb_pid_t pid)
{
VALUE watcher = rb_thread_create(detach_process_watcher, (void*)(VALUE)pid);
- rb_thread_local_aset(watcher, id_pid, PIDT2NUM(pid));
- RBASIC_SET_CLASS(watcher, rb_cWaiter);
+ rb_thread_local_aset(watcher, id_pid(), PIDT2NUM(pid));
+ rb_define_singleton_method(watcher, "pid", detach_process_pid, 0);
return watcher;
}
@@ -1107,12 +1000,12 @@ rb_detach_process(rb_pid_t pid)
*
* Some operating systems retain the status of terminated child
* processes until the parent collects that status (normally using
- * some variant of <code>wait()</code>). If the parent never collects
+ * some variant of <code>wait()</code>. If the parent never collects
* this status, the child stays around as a <em>zombie</em> process.
* <code>Process::detach</code> prevents this by setting up a
* separate Ruby thread whose sole job is to reap the status of the
* process _pid_ when it terminates. Use <code>detach</code>
- * only when you do not intend to explicitly wait for the child to
+ * only when you do not intent to explicitly wait for the child to
* terminate.
*
* The waiting thread returns the exit status of the detached process
@@ -1151,28 +1044,51 @@ rb_detach_process(rb_pid_t pid)
static VALUE
proc_detach(VALUE obj, VALUE pid)
{
+ rb_secure(2);
return rb_detach_process(NUM2PIDT(pid));
}
+static int forked_child = 0;
+
+#ifdef SIGPIPE
+static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0;
+#endif
+
+#ifdef SIGPIPE
+static RETSIGTYPE
+sig_do_nothing(int sig)
+{
+}
+#endif
+
/* This function should be async-signal-safe. Actually it is. */
static void
before_exec_async_signal_safe(void)
{
+#ifdef SIGPIPE
+ /*
+ * Some OS commands don't initialize signal handler properly. Thus we have
+ * to reset signal handler before exec(). Otherwise, system() and similar
+ * child process interaction might fail. (e.g. ruby -e "system 'yes | ls'")
+ * [ruby-dev:12261]
+ */
+ saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing); /* async-signal-safe */
+#endif
}
static void
before_exec_non_async_signal_safe(void)
{
- /*
- * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUP
- * if the process have multiple threads. Therefore we have to kill
- * internal threads temporary. [ruby-core:10583]
- * This is also true on Haiku. It returns Errno::EPERM against exec()
- * in multiple threads.
- *
- * Nowadays, we always stop the timer thread completely to allow redirects.
- */
- rb_thread_stop_timer_thread();
+ if (!forked_child) {
+ /*
+ * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUP
+ * if the process have multiple threads. Therefore we have to kill
+ * internal threads temporary. [ruby-core:10583]
+ * This is also true on Haiku. It returns Errno::EPERM against exec()
+ * in multiple threads.
+ */
+ rb_thread_stop_timer_thread(0);
+ }
}
static void
@@ -1186,6 +1102,9 @@ before_exec(void)
static void
after_exec_async_signal_safe(void)
{
+#ifdef SIGPIPE
+ signal(SIGPIPE, saved_sigpipe_handler); /* async-signal-safe */
+#endif
}
static void
@@ -1193,6 +1112,8 @@ after_exec_non_async_signal_safe(void)
{
rb_thread_reset_timer_thread();
rb_thread_start_timer_thread();
+
+ forked_child = 0;
}
static void
@@ -1202,8 +1123,8 @@ after_exec(void)
after_exec_non_async_signal_safe();
}
-#define before_fork_ruby() before_exec()
-#define after_fork_ruby() (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())
+#define before_fork() before_exec()
+#define after_fork() (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())
#include "dln.h"
@@ -1217,7 +1138,7 @@ security(const char *str)
}
}
-#if defined(HAVE_WORKING_FORK) && !defined(__native_client__)
+#if defined(HAVE_FORK) && !defined(__native_client__)
/* try_with_sh and exec_with_sh should be async-signal-safe. Actually it is.*/
#define try_with_sh(prog, argv, envp) ((saved_errno == ENOEXEC) ? exec_with_sh((prog), (argv), (envp)) : (void)0)
@@ -1229,7 +1150,7 @@ exec_with_sh(const char *prog, char **argv, char **envp)
if (envp)
execve("/bin/sh", argv, envp); /* async-signal-safe */
else
- execv("/bin/sh", argv); /* async-signal-safe (since SUSv4) */
+ execv("/bin/sh", argv); /* async-signal-safe */
}
#else
@@ -1246,6 +1167,9 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
#else
char **argv;
char **envp;
+# if defined(__EMX__) || defined(OS2)
+ char **new_argv = NULL;
+# endif
argv = ARGVSTR2ARGV(argv_str);
@@ -1254,16 +1178,98 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
return -1;
}
+# if defined(__EMX__) || defined(OS2)
+ {
+# define COMMAND "cmd.exe"
+ char *extension;
+
+ if ((extension = strrchr(prog, '.')) != NULL && STRCASECMP(extension, ".bat") == 0) {
+ char *p;
+ int n;
+
+ for (n = 0; argv[n]; n++)
+ /* no-op */;
+ new_argv = ALLOC_N(char*, n + 2);
+ for (; n > 0; n--)
+ new_argv[n + 1] = argv[n];
+ new_argv[1] = strcpy(ALLOC_N(char, strlen(argv[0]) + 1), argv[0]);
+ for (p = new_argv[1]; *p != '\0'; p++)
+ if (*p == '/')
+ *p = '\\';
+ new_argv[0] = COMMAND;
+ argv = new_argv;
+ prog = dln_find_exe_r(argv[0], 0, fbuf, sizeof(fbuf));
+ if (!prog) {
+ errno = ENOENT;
+ return -1;
+ }
+ }
+ }
+# endif /* __EMX__ */
envp = envp_str ? (char **)RSTRING_PTR(envp_str) : NULL;
if (envp_str)
execve(prog, argv, envp); /* async-signal-safe */
else
- execv(prog, argv); /* async-signal-safe (since SUSv4) */
+ execv(prog, argv); /* async-signal-safe */
preserving_errno(try_with_sh(prog, argv, envp)); /* try_with_sh() is async-signal-safe. */
+# if defined(__EMX__) || defined(OS2)
+ if (new_argv) {
+ xfree(new_argv[0]);
+ xfree(new_argv);
+ }
+# endif
return -1;
#endif
}
+/* deprecated */
+static int
+proc_exec_v(char **argv, const char *prog)
+{
+ char fbuf[MAXPATHLEN];
+
+ if (!prog)
+ prog = argv[0];
+ prog = dln_find_exe_r(prog, 0, fbuf, sizeof(fbuf));
+ if (!prog) {
+ errno = ENOENT;
+ return -1;
+ }
+ before_exec();
+ execv(prog, argv);
+ preserving_errno(try_with_sh(prog, argv, 0); after_exec());
+ return -1;
+}
+
+/* deprecated */
+int
+rb_proc_exec_n(int argc, VALUE *argv, const char *prog)
+{
+#define ARGV_COUNT(n) ((n)+1)
+#define ARGV_SIZE(n) (sizeof(char*) * ARGV_COUNT(n))
+#define ALLOC_ARGV(n, v) ALLOCV_N(char*, (v), ARGV_COUNT(n))
+
+ char **args;
+ int i;
+ int ret = -1;
+ VALUE v;
+
+ args = ALLOC_ARGV(argc+1, v);
+ for (i=0; i<argc; i++) {
+ args[i] = RSTRING_PTR(argv[i]);
+ }
+ args[i] = 0;
+ if (args[0]) {
+ ret = proc_exec_v(args, prog);
+ }
+ ALLOCV_END(v);
+ return ret;
+
+#undef ARGV_COUNT
+#undef ARGV_SIZE
+#undef ALLOC_ARGV
+}
+
/* This function should be async-signal-safe. Actually it is. */
static int
proc_exec_sh(const char *str, VALUE envp_str)
@@ -1287,7 +1293,7 @@ proc_exec_sh(const char *str, VALUE envp_str)
rb_w32_uspawn(P_OVERLAY, (char *)str, 0);
return -1;
#else
-#if defined(__CYGWIN32__)
+#if defined(__CYGWIN32__) || defined(__EMX__)
{
char fbuf[MAXPATHLEN];
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
@@ -1303,7 +1309,7 @@ proc_exec_sh(const char *str, VALUE envp_str)
if (envp_str)
execle("/bin/sh", "sh", "-c", str, (char *)NULL, (char **)RSTRING_PTR(envp_str)); /* async-signal-safe */
else
- execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe (since SUSv4) */
+ execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe */
#endif
return -1;
#endif /* _WIN32 */
@@ -1345,16 +1351,22 @@ mark_exec_arg(void *ptr)
rb_gc_mark(eargp->chdir_dir);
}
+static void
+free_exec_arg(void *ptr)
+{
+ xfree(ptr);
+}
+
static size_t
memsize_exec_arg(const void *ptr)
{
- return sizeof(struct rb_execarg);
+ return ptr ? sizeof(struct rb_execarg) : 0;
}
static const rb_data_type_t exec_arg_data_type = {
"exec_arg",
- {mark_exec_arg, RUBY_TYPED_DEFAULT_FREE, memsize_exec_arg},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ {mark_exec_arg, free_exec_arg, memsize_exec_arg},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#ifdef _WIN32
@@ -1375,7 +1387,7 @@ export_dup(VALUE str)
# define EXPORT_DUP(str) rb_str_dup(str)
#endif
-#if !defined(HAVE_WORKING_FORK) && defined(HAVE_SPAWNV)
+#if !defined(HAVE_FORK) && defined(HAVE_SPAWNV)
# define USE_SPAWNV 1
#else
# define USE_SPAWNV 0
@@ -1467,12 +1479,12 @@ check_exec_redirect_fd(VALUE v, int iskey)
fd = FIX2INT(v);
}
else if (SYMBOL_P(v)) {
- ID id = rb_check_id(&v);
- if (id == id_in)
+ ID id = SYM2ID(v);
+ if (id == rb_intern("in"))
fd = 0;
- else if (id == id_out)
+ else if (id == rb_intern("out"))
fd = 1;
- else if (id == id_err)
+ else if (id == rb_intern("err"))
fd = 2;
else
goto wrong;
@@ -1531,27 +1543,26 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
switch (TYPE(val)) {
case T_SYMBOL:
- if (!(id = rb_check_id(&val))) goto wrong_symbol;
- if (id == id_close) {
+ id = SYM2ID(val);
+ if (id == rb_intern("close")) {
param = Qnil;
eargp->fd_close = check_exec_redirect1(eargp->fd_close, key, param);
}
- else if (id == id_in) {
+ else if (id == rb_intern("in")) {
param = INT2FIX(0);
eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
- else if (id == id_out) {
+ else if (id == rb_intern("out")) {
param = INT2FIX(1);
eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
- else if (id == id_err) {
+ else if (id == rb_intern("err")) {
param = INT2FIX(2);
eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
else {
- wrong_symbol:
- rb_raise(rb_eArgError, "wrong exec redirect symbol: %"PRIsVALUE,
- val);
+ rb_raise(rb_eArgError, "wrong exec redirect symbol: %s",
+ rb_id2name(id));
}
break;
@@ -1567,7 +1578,7 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
case T_ARRAY:
path = rb_ary_entry(val, 0);
if (RARRAY_LEN(val) == 2 && SYMBOL_P(path) &&
- path == ID2SYM(id_child)) {
+ SYM2ID(path) == rb_intern("child")) {
param = check_exec_redirect_fd(rb_ary_entry(val, 1), 0);
eargp->fd_dup2_child = check_exec_redirect1(eargp->fd_dup2_child, key, param);
}
@@ -1582,8 +1593,8 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
flags = rb_to_int(flags);
perm = rb_ary_entry(val, 2);
perm = NIL_P(perm) ? INT2FIX(0644) : rb_to_int(perm);
- param = hide_obj(rb_ary_new3(4, hide_obj(EXPORT_DUP(path)),
- flags, perm, Qnil));
+ param = hide_obj(rb_ary_new3(3, hide_obj(EXPORT_DUP(path)),
+ flags, perm));
eargp->fd_open = check_exec_redirect1(eargp->fd_open, key, param);
}
break;
@@ -1595,23 +1606,11 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
key = check_exec_redirect_fd(key, 1);
if (FIXNUM_P(key) && (FIX2INT(key) == 1 || FIX2INT(key) == 2))
flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);
- else if (RB_TYPE_P(key, T_ARRAY)) {
- int i;
- for (i = 0; i < RARRAY_LEN(key); i++) {
- VALUE v = RARRAY_PTR(key)[i];
- VALUE fd = check_exec_redirect_fd(v, 1);
- if (FIX2INT(fd) != 1 && FIX2INT(fd) != 2) break;
- }
- if (i == RARRAY_LEN(key))
- flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);
- else
- flags = INT2NUM(O_RDONLY);
- }
- else
+ else
flags = INT2NUM(O_RDONLY);
perm = INT2FIX(0644);
- param = hide_obj(rb_ary_new3(4, hide_obj(EXPORT_DUP(path)),
- flags, perm, Qnil));
+ param = hide_obj(rb_ary_new3(3, hide_obj(EXPORT_DUP(path)),
+ flags, perm));
eargp->fd_open = check_exec_redirect1(eargp->fd_open, key, param);
break;
@@ -1625,35 +1624,7 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
}
#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
-static int rlimit_type_by_sym(VALUE key);
-
-static void
-rb_execarg_addopt_rlimit(struct rb_execarg *eargp, int rtype, VALUE val)
-{
- VALUE ary = eargp->rlimit_limits;
- VALUE tmp, softlim, hardlim;
- if (eargp->rlimit_limits == Qfalse)
- ary = eargp->rlimit_limits = hide_obj(rb_ary_new());
- else
- ary = eargp->rlimit_limits;
- tmp = rb_check_array_type(val);
- if (!NIL_P(tmp)) {
- if (RARRAY_LEN(tmp) == 1)
- softlim = hardlim = rb_to_int(rb_ary_entry(tmp, 0));
- else if (RARRAY_LEN(tmp) == 2) {
- softlim = rb_to_int(rb_ary_entry(tmp, 0));
- hardlim = rb_to_int(rb_ary_entry(tmp, 1));
- }
- else {
- rb_raise(rb_eArgError, "wrong exec rlimit option");
- }
- }
- else {
- softlim = hardlim = rb_to_int(val);
- }
- tmp = hide_obj(rb_ary_new3(3, INT2NUM(rtype), softlim, hardlim));
- rb_ary_push(ary, tmp);
-}
+static int rlimit_type_by_lname(const char *name);
#endif
int
@@ -1662,22 +1633,17 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
ID id;
+#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
+ int rtype;
+#endif
+
+ rb_secure(2);
switch (TYPE(key)) {
case T_SYMBOL:
-#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
- {
- int rtype = rlimit_type_by_sym(key);
- if (rtype != -1) {
- rb_execarg_addopt_rlimit(eargp, rtype, val);
- RB_GC_GUARD(execarg_obj);
- return ST_CONTINUE;
- }
- }
-#endif
- if (!(id = rb_check_id(&key))) return ST_STOP;
+ id = SYM2ID(key);
#ifdef HAVE_SETPGID
- if (id == id_pgroup) {
+ if (id == rb_intern("pgroup")) {
rb_pid_t pgroup;
if (eargp->pgroup_given) {
rb_raise(rb_eArgError, "pgroup option specified twice");
@@ -1698,7 +1664,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
else
#endif
#ifdef _WIN32
- if (id == id_new_pgroup) {
+ if (id == rb_intern("new_pgroup")) {
if (eargp->new_pgroup_given) {
rb_raise(rb_eArgError, "new_pgroup option specified twice");
}
@@ -1707,23 +1673,51 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
}
else
#endif
- if (id == id_unsetenv_others) {
+#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
+ if (strncmp("rlimit_", rb_id2name(id), 7) == 0 &&
+ (rtype = rlimit_type_by_lname(rb_id2name(id)+7)) != -1) {
+ VALUE ary = eargp->rlimit_limits;
+ VALUE tmp, softlim, hardlim;
+ if (eargp->rlimit_limits == Qfalse)
+ ary = eargp->rlimit_limits = hide_obj(rb_ary_new());
+ else
+ ary = eargp->rlimit_limits;
+ tmp = rb_check_array_type(val);
+ if (!NIL_P(tmp)) {
+ if (RARRAY_LEN(tmp) == 1)
+ softlim = hardlim = rb_to_int(rb_ary_entry(tmp, 0));
+ else if (RARRAY_LEN(tmp) == 2) {
+ softlim = rb_to_int(rb_ary_entry(tmp, 0));
+ hardlim = rb_to_int(rb_ary_entry(tmp, 1));
+ }
+ else {
+ rb_raise(rb_eArgError, "wrong exec rlimit option");
+ }
+ }
+ else {
+ softlim = hardlim = rb_to_int(val);
+ }
+ tmp = hide_obj(rb_ary_new3(3, INT2NUM(rtype), softlim, hardlim));
+ rb_ary_push(ary, tmp);
+ }
+ else
+#endif
+ if (id == rb_intern("unsetenv_others")) {
if (eargp->unsetenv_others_given) {
rb_raise(rb_eArgError, "unsetenv_others option specified twice");
}
eargp->unsetenv_others_given = 1;
eargp->unsetenv_others_do = RTEST(val) ? 1 : 0;
}
- else if (id == id_chdir) {
+ else if (id == rb_intern("chdir")) {
if (eargp->chdir_given) {
rb_raise(rb_eArgError, "chdir option specified twice");
}
FilePathValue(val);
- val = rb_str_encode_ospath(val);
eargp->chdir_given = 1;
eargp->chdir_dir = hide_obj(EXPORT_DUP(val));
}
- else if (id == id_umask) {
+ else if (id == rb_intern("umask")) {
mode_t cmask = NUM2MODET(val);
if (eargp->umask_given) {
rb_raise(rb_eArgError, "umask option specified twice");
@@ -1731,32 +1725,33 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
eargp->umask_given = 1;
eargp->umask_mask = cmask;
}
- else if (id == id_close_others) {
+ else if (id == rb_intern("close_others")) {
if (eargp->close_others_given) {
rb_raise(rb_eArgError, "close_others option specified twice");
}
eargp->close_others_given = 1;
eargp->close_others_do = RTEST(val) ? 1 : 0;
}
- else if (id == id_in) {
+ else if (id == rb_intern("in")) {
key = INT2FIX(0);
goto redirect;
}
- else if (id == id_out) {
+ else if (id == rb_intern("out")) {
key = INT2FIX(1);
goto redirect;
}
- else if (id == id_err) {
+ else if (id == rb_intern("err")) {
key = INT2FIX(2);
goto redirect;
}
- else if (id == id_uid) {
+ else if (id == rb_intern("uid")) {
#ifdef HAVE_SETUID
if (eargp->uid_given) {
rb_raise(rb_eArgError, "uid option specified twice");
}
check_uid_switch();
{
+ PREPARE_GETPWNAM;
eargp->uid = OBJ2UID(val);
eargp->uid_given = 1;
}
@@ -1765,13 +1760,14 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
"uid option is unimplemented on this machine");
#endif
}
- else if (id == id_gid) {
+ else if (id == rb_intern("gid")) {
#ifdef HAVE_SETGID
if (eargp->gid_given) {
rb_raise(rb_eArgError, "gid option specified twice");
}
check_gid_switch();
{
+ PREPARE_GETGRNAM;
eargp->gid = OBJ2GID(val);
eargp->gid_given = 1;
}
@@ -1800,6 +1796,12 @@ redirect:
return ST_CONTINUE;
}
+int
+rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
+{
+ return rb_execarg_addopt(e->execarg_obj, key, val);
+}
+
static int
check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
{
@@ -1808,7 +1810,7 @@ check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
VALUE execarg_obj = (VALUE)arg;
if (rb_execarg_addopt(execarg_obj, key, val) != ST_CONTINUE) {
if (SYMBOL_P(key))
- rb_raise(rb_eArgError, "wrong exec option symbol: % "PRIsVALUE,
+ rb_raise(rb_eArgError, "wrong exec option symbol: %"PRIsVALUE,
key);
rb_raise(rb_eArgError, "wrong exec option");
}
@@ -1842,7 +1844,7 @@ check_exec_fds_1(struct rb_execarg *eargp, VALUE h, int maxhint, VALUE ary)
if (RTEST(rb_hash_lookup(h, INT2FIX(fd)))) {
rb_raise(rb_eArgError, "fd %d specified twice", fd);
}
- if (ary == eargp->fd_dup2)
+ if (ary == eargp->fd_open || ary == eargp->fd_dup2)
rb_hash_aset(h, INT2FIX(fd), Qtrue);
else if (ary == eargp->fd_dup2_child)
rb_hash_aset(h, INT2FIX(fd), RARRAY_AREF(elt, 1));
@@ -1870,6 +1872,7 @@ check_exec_fds(struct rb_execarg *eargp)
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_dup2);
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_close);
+ maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_open);
maxhint = check_exec_fds_1(eargp, h, maxhint, eargp->fd_dup2_child);
if (eargp->fd_dup2_child) {
@@ -1993,24 +1996,12 @@ rb_check_argv(int argc, VALUE *argv)
}
static VALUE
-check_hash(VALUE obj)
-{
- if (RB_SPECIAL_CONST_P(obj)) return Qnil;
- switch (RB_BUILTIN_TYPE(obj)) {
- case T_STRING:
- case T_ARRAY:
- return Qnil;
- }
- return rb_check_hash_type(obj);
-}
-
-static VALUE
rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, VALUE *opthash_ret)
{
VALUE hash, prog;
if (0 < *argc_p) {
- hash = check_hash((*argv_p)[*argc_p-1]);
+ hash = rb_check_hash_type((*argv_p)[*argc_p-1]);
if (!NIL_P(hash)) {
*opthash_ret = hash;
(*argc_p)--;
@@ -2018,7 +2009,7 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
}
if (0 < *argc_p) {
- hash = check_hash((*argv_p)[0]);
+ hash = rb_check_hash_type((*argv_p)[0]);
if (!NIL_P(hash)) {
*env_ret = hash;
(*argc_p)--;
@@ -2230,7 +2221,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
}
VALUE
-rb_execarg_new(int argc, const VALUE *argv, int accept_shell)
+rb_execarg_new(int argc, VALUE *argv, int accept_shell)
{
VALUE execarg_obj;
struct rb_execarg *eargp;
@@ -2249,22 +2240,24 @@ rb_execarg_get(VALUE execarg_obj)
}
VALUE
-rb_execarg_init(int argc, const VALUE *orig_argv, int accept_shell, VALUE execarg_obj)
+rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj)
{
struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
VALUE prog, ret;
VALUE env = Qnil, opthash = Qnil;
- VALUE argv_buf;
- VALUE *argv = ALLOCV_N(VALUE, argv_buf, argc);
- MEMCPY(argv, orig_argv, VALUE, argc);
prog = rb_exec_getargs(&argc, &argv, accept_shell, &env, &opthash);
rb_exec_fillarg(prog, argc, argv, env, opthash, execarg_obj);
- ALLOCV_END(argv_buf);
ret = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
RB_GC_GUARD(execarg_obj);
return ret;
}
+VALUE
+rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
+{
+ return rb_execarg_init(argc, argv, accept_shell, e->execarg_obj);
+}
+
void
rb_execarg_setenv(VALUE execarg_obj, VALUE env)
{
@@ -2291,74 +2284,14 @@ fill_envp_buf_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
static long run_exec_dup2_tmpbuf_size(long n);
-struct open_struct {
- VALUE fname;
- int oflags;
- mode_t perm;
- int ret;
- int err;
-};
-
-static void *
-open_func(void *ptr)
-{
- struct open_struct *data = ptr;
- const char *fname = RSTRING_PTR(data->fname);
- data->ret = parent_redirect_open(fname, data->oflags, data->perm);
- data->err = errno;
- return NULL;
-}
-
-static VALUE
-rb_execarg_parent_start1(VALUE execarg_obj)
+void
+rb_execarg_fixup(VALUE execarg_obj)
{
struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
int unsetenv_others;
VALUE envopts;
VALUE ary;
- ary = eargp->fd_open;
- if (ary != Qfalse) {
- long i;
- for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_AREF(ary, i);
- int fd = FIX2INT(RARRAY_AREF(elt, 0));
- VALUE param = RARRAY_AREF(elt, 1);
- VALUE vpath = RARRAY_AREF(param, 0);
- int flags = NUM2INT(RARRAY_AREF(param, 1));
- int perm = NUM2INT(RARRAY_AREF(param, 2));
- VALUE fd2v = RARRAY_AREF(param, 3);
- int fd2;
- if (NIL_P(fd2v)) {
- struct open_struct open_data;
- FilePathValue(vpath);
- vpath = rb_str_encode_ospath(vpath);
- again:
- open_data.fname = vpath;
- open_data.oflags = flags;
- open_data.perm = perm;
- open_data.ret = -1;
- open_data.err = EINTR;
- rb_thread_call_without_gvl2(open_func, (void *)&open_data, RUBY_UBF_IO, 0);
- if (open_data.ret == -1) {
- if (open_data.err == EINTR) {
- rb_thread_check_ints();
- goto again;
- }
- rb_syserr_fail_str(open_data.err, vpath);
- }
- fd2 = open_data.ret;
- rb_update_max_fd(fd2);
- RARRAY_ASET(param, 3, INT2FIX(fd2));
- rb_thread_check_ints();
- }
- else {
- fd2 = NUM2INT(fd2v);
- }
- rb_execarg_addopt(execarg_obj, INT2FIX(fd), INT2FIX(fd2));
- }
- }
-
eargp->redirect_fds = check_exec_fds(eargp);
ary = eargp->fd_dup2;
@@ -2371,38 +2304,36 @@ rb_execarg_parent_start1(VALUE execarg_obj)
unsetenv_others = eargp->unsetenv_others_given && eargp->unsetenv_others_do;
envopts = eargp->env_modification;
- if (ALWAYS_NEED_ENVP || unsetenv_others || envopts != Qfalse) {
+ if (unsetenv_others || envopts != Qfalse) {
VALUE envtbl, envp_str, envp_buf;
char *p, *ep;
if (unsetenv_others) {
envtbl = rb_hash_new();
}
else {
- envtbl = rb_const_get(rb_cObject, id_ENV);
+ envtbl = rb_const_get(rb_cObject, rb_intern("ENV"));
envtbl = rb_convert_type(envtbl, T_HASH, "Hash", "to_hash");
}
hide_obj(envtbl);
if (envopts != Qfalse) {
- st_table *stenv = RHASH_TBL_RAW(envtbl);
+ st_table *stenv = RHASH_TBL(envtbl);
long i;
for (i = 0; i < RARRAY_LEN(envopts); i++) {
VALUE pair = RARRAY_AREF(envopts, i);
VALUE key = RARRAY_AREF(pair, 0);
VALUE val = RARRAY_AREF(pair, 1);
if (NIL_P(val)) {
- st_data_t stkey = (st_data_t)key;
- st_delete(stenv, &stkey, NULL);
+ st_data_t stkey = (st_data_t)key;
+ st_delete(stenv, &stkey, NULL);
}
else {
- st_insert(stenv, (st_data_t)key, (st_data_t)val);
- RB_OBJ_WRITTEN(envtbl, Qundef, key);
- RB_OBJ_WRITTEN(envtbl, Qundef, val);
+ st_insert(stenv, (st_data_t)key, (st_data_t)val);
}
}
}
envp_buf = rb_str_buf_new(0);
hide_obj(envp_buf);
- st_foreach(RHASH_TBL_RAW(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
+ st_foreach(RHASH_TBL(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
envp_str = rb_str_buf_new(sizeof(char*) * (RHASH_SIZE(envtbl) + 1));
hide_obj(envp_str);
p = RSTRING_PTR(envp_buf);
@@ -2424,76 +2355,16 @@ rb_execarg_parent_start1(VALUE execarg_obj)
}
*/
}
-
RB_GC_GUARD(execarg_obj);
- return Qnil;
-}
-
-void
-rb_execarg_parent_start(VALUE execarg_obj)
-{
- int state;
- rb_protect(rb_execarg_parent_start1, execarg_obj, &state);
- if (state) {
- rb_execarg_parent_end(execarg_obj);
- rb_jump_tag(state);
- }
-}
-
-static VALUE
-execarg_parent_end(VALUE execarg_obj)
-{
- struct rb_execarg *eargp = rb_execarg_get(execarg_obj);
- int err = errno;
- VALUE ary;
-
- ary = eargp->fd_open;
- if (ary != Qfalse) {
- long i;
- for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_AREF(ary, i);
- VALUE param = RARRAY_AREF(elt, 1);
- VALUE fd2v;
- int fd2;
- fd2v = RARRAY_AREF(param, 3);
- if (!NIL_P(fd2v)) {
- fd2 = FIX2INT(fd2v);
- parent_redirect_close(fd2);
- RARRAY_ASET(param, 3, Qnil);
- }
- }
- }
-
- errno = err;
- return execarg_obj;
}
void
-rb_execarg_parent_end(VALUE execarg_obj)
+rb_exec_arg_fixup(struct rb_exec_arg *e)
{
- execarg_parent_end(execarg_obj);
- RB_GC_GUARD(execarg_obj);
+ rb_execarg_fixup(e->execarg_obj);
}
-static void
-rb_exec_fail(struct rb_execarg *eargp, int err, const char *errmsg)
-{
- if (!errmsg || !*errmsg) return;
- if (strcmp(errmsg, "chdir") == 0) {
- rb_sys_fail_str(eargp->chdir_dir);
- }
- rb_sys_fail(errmsg);
-}
-
-#if 0
-void
-rb_execarg_fail(VALUE execarg_obj, int err, const char *errmsg)
-{
- if (!errmsg || !*errmsg) return;
- rb_exec_fail(rb_execarg_get(execarg_obj), err, errmsg);
- RB_GC_GUARD(execarg_obj);
-}
-#endif
+static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen);
/*
* call-seq:
@@ -2569,45 +2440,117 @@ rb_execarg_fail(VALUE execarg_obj, int err, const char *errmsg)
*/
VALUE
-rb_f_exec(int argc, const VALUE *argv)
+rb_f_exec(int argc, VALUE *argv)
{
VALUE execarg_obj, fail_str;
struct rb_execarg *eargp;
#define CHILD_ERRMSG_BUFLEN 80
char errmsg[CHILD_ERRMSG_BUFLEN] = { '\0' };
- int err;
execarg_obj = rb_execarg_new(argc, argv, TRUE);
eargp = rb_execarg_get(execarg_obj);
- before_exec(); /* stop timer thread before redirects */
- rb_execarg_parent_start(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
+#if defined(__APPLE__) || defined(__HAIKU__)
+ rb_exec_without_timer_thread(eargp, errmsg, sizeof(errmsg));
+#else
rb_exec_async_signal_safe(eargp, errmsg, sizeof(errmsg));
-
- err = errno;
- after_exec(); /* restart timer thread */
-
- rb_exec_fail(eargp, err, errmsg);
+#endif
RB_GC_GUARD(execarg_obj);
- rb_syserr_fail_str(err, fail_str);
+ if (errmsg[0])
+ rb_sys_fail(errmsg);
+ rb_sys_fail_str(fail_str);
return Qnil; /* dummy */
}
#define ERRMSG(str) do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0)
-#define ERRMSG1(str, a) do { if (errmsg && 0 < errmsg_buflen) snprintf(errmsg, errmsg_buflen, (str), (a)); } while (0)
-#define ERRMSG2(str, a, b) do { if (errmsg && 0 < errmsg_buflen) snprintf(errmsg, errmsg_buflen, (str), (a), (b)); } while (0)
-static int fd_get_cloexec(int fd, char *errmsg, size_t errmsg_buflen);
-static int fd_set_cloexec(int fd, char *errmsg, size_t errmsg_buflen);
-static int fd_clear_cloexec(int fd, char *errmsg, size_t errmsg_buflen);
+/*#define DEBUG_REDIRECT*/
+#if defined(DEBUG_REDIRECT)
+
+#include <stdarg.h>
+
+static void
+ttyprintf(const char *fmt, ...)
+{
+ va_list ap;
+ FILE *tty;
+ int save = errno;
+#ifdef _WIN32
+ tty = fopen("con", "w");
+#else
+ tty = fopen("/dev/tty", "w");
+#endif
+ if (!tty)
+ return;
+
+ va_start(ap, fmt);
+ vfprintf(tty, fmt, ap);
+ va_end(ap);
+ fclose(tty);
+ errno = save;
+}
+
+static int
+redirect_dup(int oldfd)
+{
+ int ret;
+ ret = dup(oldfd);
+ ttyprintf("dup(%d) => %d\n", oldfd, ret);
+ return ret;
+}
+#else
+#define redirect_dup(oldfd) dup(oldfd)
+#endif
+
+#if defined(DEBUG_REDIRECT) || defined(_WIN32)
+static int
+redirect_dup2(int oldfd, int newfd)
+{
+ int ret;
+ ret = dup2(oldfd, newfd);
+ if (newfd >= 0 && newfd <= 2)
+ SetStdHandle(newfd == 0 ? STD_INPUT_HANDLE : newfd == 1 ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE, (HANDLE)rb_w32_get_osfhandle(newfd));
+#if defined(DEBUG_REDIRECT)
+ ttyprintf("dup2(%d, %d)\n", oldfd, newfd);
+#endif
+ return ret;
+}
+#else
+#define redirect_dup2(oldfd, newfd) dup2((oldfd), (newfd))
+#endif
+
+#if defined(DEBUG_REDIRECT)
+static int
+redirect_close(int fd)
+{
+ int ret;
+ ret = close(fd);
+ ttyprintf("close(%d)\n", fd);
+ return ret;
+}
+
+static int
+redirect_open(const char *pathname, int flags, mode_t perm)
+{
+ int ret;
+ ret = open(pathname, flags, perm);
+ ttyprintf("open(\"%s\", 0x%x, 0%o) => %d\n", pathname, flags, perm, ret);
+ return ret;
+}
+
+#else
+#define redirect_close(fd) close(fd)
+#define redirect_open(pathname, flags, perm) open((pathname), (flags), (perm))
+#endif
static int
save_redirect_fd(int fd, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
if (sargp) {
- VALUE newary, redirection;
- int save_fd = redirect_cloexec_dup(fd), cloexec;
+ VALUE newary;
+ int save_fd = redirect_dup(fd);
if (save_fd == -1) {
if (errno == EBADF)
return 0;
@@ -2620,10 +2563,8 @@ save_redirect_fd(int fd, struct rb_execarg *sargp, char *errmsg, size_t errmsg_b
newary = hide_obj(rb_ary_new());
sargp->fd_dup2 = newary;
}
- cloexec = fd_get_cloexec(fd, errmsg, errmsg_buflen);
- redirection = hide_obj(rb_assoc_new(INT2FIX(fd), INT2FIX(save_fd)));
- if (cloexec) rb_ary_push(redirection, Qtrue);
- rb_ary_push(newary, redirection);
+ rb_ary_push(newary,
+ hide_obj(rb_assoc_new(INT2FIX(fd), INT2FIX(save_fd))));
newary = sargp->fd_close;
if (newary == Qfalse) {
@@ -2653,7 +2594,6 @@ struct run_exec_dup2_fd_pair {
int newfd;
long older_index;
long num_newer;
- int cloexec;
};
static long
@@ -2662,68 +2602,6 @@ run_exec_dup2_tmpbuf_size(long n)
return sizeof(struct run_exec_dup2_fd_pair) * n;
}
-/* This function should be async-signal-safe. Actually it is. */
-static int
-fd_get_cloexec(int fd, char *errmsg, size_t errmsg_buflen)
-{
-#ifdef F_GETFD
- int ret = 0;
- ret = fcntl(fd, F_GETFD); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("fcntl(F_GETFD)");
- return -1;
- }
- if (ret & FD_CLOEXEC) return 1;
-#endif
- return 0;
-}
-
-/* This function should be async-signal-safe. Actually it is. */
-static int
-fd_set_cloexec(int fd, char *errmsg, size_t errmsg_buflen)
-{
-#ifdef F_GETFD
- int ret = 0;
- ret = fcntl(fd, F_GETFD); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("fcntl(F_GETFD)");
- return -1;
- }
- if (!(ret & FD_CLOEXEC)) {
- ret |= FD_CLOEXEC;
- ret = fcntl(fd, F_SETFD, ret); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("fcntl(F_SETFD)");
- return -1;
- }
- }
-#endif
- return 0;
-}
-
-/* This function should be async-signal-safe. Actually it is. */
-static int
-fd_clear_cloexec(int fd, char *errmsg, size_t errmsg_buflen)
-{
-#ifdef F_GETFD
- int ret;
- ret = fcntl(fd, F_GETFD); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("fcntl(F_GETFD)");
- return -1;
- }
- if (ret & FD_CLOEXEC) {
- ret &= ~FD_CLOEXEC;
- ret = fcntl(fd, F_SETFD, ret); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("fcntl(F_SETFD)");
- return -1;
- }
- }
-#endif
- return 0;
-}
-
/* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */
static int
run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
@@ -2741,7 +2619,6 @@ run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, s
VALUE elt = RARRAY_AREF(ary, i);
pairs[i].oldfd = FIX2INT(RARRAY_AREF(elt, 1));
pairs[i].newfd = FIX2INT(RARRAY_AREF(elt, 0)); /* unique */
- pairs[i].cloexec = RARRAY_LEN(elt) > 2 && RTEST(RARRAY_AREF(elt, 2));
pairs[i].older_index = -1;
}
@@ -2780,10 +2657,6 @@ run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, s
ERRMSG("dup2");
goto fail;
}
- if (pairs[j].cloexec &&
- fd_set_cloexec(pairs[j].newfd, errmsg, errmsg_buflen)) {
- goto fail;
- }
rb_update_max_fd(pairs[j].newfd); /* async-signal-safe but don't need to call it in a child process. */
pairs[j].oldfd = -1;
j = pairs[j].older_index;
@@ -2798,8 +2671,22 @@ run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, s
if (pairs[i].oldfd == -1)
continue;
if (pairs[i].oldfd == pairs[i].newfd) { /* self cycle */
- if (fd_clear_cloexec(pairs[i].oldfd, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
+#ifdef F_GETFD
+ int fd = pairs[i].oldfd;
+ ret = fcntl(fd, F_GETFD); /* async-signal-safe */
+ if (ret == -1) {
+ ERRMSG("fcntl(F_GETFD)");
goto fail;
+ }
+ if (ret & FD_CLOEXEC) {
+ ret &= ~FD_CLOEXEC;
+ ret = fcntl(fd, F_SETFD, ret); /* async-signal-safe */
+ if (ret == -1) {
+ ERRMSG("fcntl(F_SETFD)");
+ goto fail;
+ }
+ }
+#endif
pairs[i].oldfd = -1;
continue;
}
@@ -2868,6 +2755,56 @@ run_exec_close(VALUE ary, char *errmsg, size_t errmsg_buflen)
/* This function should be async-signal-safe when sargp is NULL. Actually it is. */
static int
+run_exec_open(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
+{
+ long i;
+ int ret;
+
+ for (i = 0; i < RARRAY_LEN(ary);) {
+ VALUE elt = RARRAY_AREF(ary, i);
+ int fd = FIX2INT(RARRAY_AREF(elt, 0));
+ VALUE param = RARRAY_AREF(elt, 1);
+ char *path = RSTRING_PTR(RARRAY_AREF(param, 0));
+ int flags = NUM2INT(RARRAY_AREF(param, 1));
+ int perm = NUM2INT(RARRAY_AREF(param, 2));
+ int need_close = 1;
+ int fd2 = redirect_open(path, flags, perm); /* async-signal-safe */
+ if (fd2 == -1) {
+ ERRMSG("open");
+ return -1;
+ }
+ rb_update_max_fd(fd2);
+ while (i < RARRAY_LEN(ary) &&
+ (elt = RARRAY_AREF(ary, i), RARRAY_AREF(elt, 1) == param)) {
+ fd = FIX2INT(RARRAY_AREF(elt, 0));
+ if (fd == fd2) {
+ need_close = 0;
+ }
+ else {
+ if (save_redirect_fd(fd, sargp, errmsg, errmsg_buflen) < 0) /* async-signal-safe */
+ return -1;
+ ret = redirect_dup2(fd2, fd); /* async-signal-safe */
+ if (ret == -1) {
+ ERRMSG("dup2");
+ return -1;
+ }
+ rb_update_max_fd(fd);
+ }
+ i++;
+ }
+ if (need_close) {
+ ret = redirect_close(fd2); /* async-signal-safe */
+ if (ret == -1) {
+ ERRMSG("close");
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
+
+/* This function should be async-signal-safe when sargp is NULL. Actually it is. */
+static int
run_exec_dup2_child(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
long i;
@@ -2896,9 +2833,8 @@ static int
run_exec_pgroup(const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
{
/*
- * If FD_CLOEXEC is available, rb_fork_async_signal_safe waits the child's execve.
- * So setpgid is done in the child when rb_fork_async_signal_safe is returned in
- * the parent.
+ * If FD_CLOEXEC is available, rb_fork waits the child's execve.
+ * So setpgid is done in the child when rb_fork is returned in the parent.
* No race condition, even without setpgid from the parent.
* (Is there an environment which has setpgid but no FD_CLOEXEC?)
*/
@@ -2960,9 +2896,9 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
}
#endif
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
static VALUE
-save_env_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
+save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0])));
return Qnil;
@@ -2974,7 +2910,7 @@ save_env(struct rb_execarg *sargp)
if (!sargp)
return;
if (sargp->env_modification == Qfalse) {
- VALUE env = rb_const_get(rb_cObject, id_ENV);
+ VALUE env = rb_const_get(rb_cObject, rb_intern("ENV"));
if (RTEST(env)) {
VALUE ary = hide_obj(rb_ary_new());
rb_block_call(env, idEach, 0, 0, save_env_i,
@@ -2987,11 +2923,6 @@ save_env(struct rb_execarg *sargp)
}
#endif
-#ifdef _WIN32
-#undef chdir
-#define chdir(p) rb_w32_uchdir(p)
-#endif
-
/* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */
int
rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
@@ -3019,7 +2950,7 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
}
#endif
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
if (eargp->unsetenv_others_given && eargp->unsetenv_others_do) {
save_env(sargp);
rb_env_clear();
@@ -3066,12 +2997,18 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
}
}
-#ifdef HAVE_WORKING_FORK
+#ifdef HAVE_FORK
if (!eargp->close_others_given || eargp->close_others_do) {
rb_close_before_exec(3, eargp->close_others_maxhint, eargp->redirect_fds); /* async-signal-safe */
}
#endif
+ obj = eargp->fd_open;
+ if (obj != Qfalse) {
+ if (run_exec_open(obj, sargp, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
+ return -1;
+ }
+
obj = eargp->fd_dup2_child;
if (obj != Qfalse) {
if (run_exec_dup2_child(obj, sargp, errmsg, errmsg_buflen) == -1) /* async-signal-safe */
@@ -3121,16 +3058,30 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
return 0;
}
+int
+rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
+{
+ return rb_execarg_run_options(rb_execarg_get(e->execarg_obj), rb_execarg_get(s->execarg_obj), errmsg, errmsg_buflen);
+}
+
+int
+rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s)
+{
+ return rb_execarg_run_options(rb_execarg_get(e->execarg_obj), rb_execarg_get(s->execarg_obj), NULL, 0);
+}
+
/* This function should be async-signal-safe. Hopefully it is. */
int
rb_exec_async_signal_safe(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
{
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
struct rb_execarg sarg, *const sargp = &sarg;
#else
struct rb_execarg *const sargp = NULL;
#endif
+ before_exec_async_signal_safe(); /* async-signal-safe */
+
if (rb_execarg_run_options(eargp, sargp, errmsg, errmsg_buflen) < 0) { /* hopefully async-signal-safe */
goto failure;
}
@@ -3144,15 +3095,54 @@ rb_exec_async_signal_safe(const struct rb_execarg *eargp, char *errmsg, size_t e
abspath = RSTRING_PTR(eargp->invoke.cmd.command_abspath);
proc_exec_cmd(abspath, eargp->invoke.cmd.argv_str, eargp->envp_str); /* async-signal-safe */
}
-#if !defined(HAVE_WORKING_FORK)
+#if !defined(HAVE_FORK)
preserving_errno(rb_execarg_run_options(sargp, NULL, errmsg, errmsg_buflen));
#endif
failure:
+ preserving_errno(after_exec_async_signal_safe()); /* async-signal-safe */
return -1;
}
-#ifdef HAVE_WORKING_FORK
+static int
+rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
+{
+ int ret;
+ before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */
+ ret = rb_exec_async_signal_safe(eargp, errmsg, errmsg_buflen); /* hopefully async-signal-safe */
+ preserving_errno(after_exec_non_async_signal_safe()); /* not async-signal-safe because it calls rb_thread_start_timer_thread. */
+ return ret;
+}
+
+int
+rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
+{
+ return rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), errmsg, errmsg_buflen);
+}
+
+int
+rb_exec(const struct rb_exec_arg *e)
+{
+#if !defined FD_CLOEXEC && !defined HAVE_SPAWNV
+ char errmsg[80] = { '\0' };
+ int ret = rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), errmsg, sizeof(errmsg));
+ preserving_errno(
+ if (errmsg[0]) {
+ fprintf(stderr, "%s\n", errmsg);
+ }
+ else {
+ fprintf(stderr, "%s:%d: command not found: %s\n",
+ rb_sourcefile(), rb_sourceline(),
+ RSTRING_PTR(e->use_shell ? e->invoke.sh.shell_script : e->invoke.cmd.command_name));
+ }
+ );
+ return ret;
+#else
+ return rb_exec_without_timer_thread(rb_execarg_get(e->execarg_obj), NULL, 0);
+#endif
+}
+
+#ifdef HAVE_FORK
/* This function should be async-signal-safe. Hopefully it is. */
static int
rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
@@ -3161,7 +3151,7 @@ rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
}
#endif
-#ifdef HAVE_WORKING_FORK
+#ifdef HAVE_FORK
#if SIZEOF_INT == SIZEOF_LONG
#define proc_syswait (VALUE (*)(VALUE))rb_syswait
#else
@@ -3215,48 +3205,24 @@ pipe_nocrash(int filedes[2], VALUE fds)
return ret;
}
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
+struct chfunc_protect_t {
+ int (*chfunc)(void*, char *, size_t);
+ void *arg;
+ char *errmsg;
+ size_t buflen;
+};
-static int
-handle_fork_error(int *status, int *ep, volatile int *try_gc_p)
+static VALUE
+chfunc_protect(VALUE arg)
{
- int state = 0;
+ struct chfunc_protect_t *p = (struct chfunc_protect_t *)arg;
- switch (errno) {
- case ENOMEM:
- if ((*try_gc_p)-- > 0 && !rb_during_gc()) {
- rb_gc();
- return 0;
- }
- break;
- case EAGAIN:
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
- case EWOULDBLOCK:
-#endif
- if (!status && !ep) {
- rb_thread_sleep(1);
- return 0;
- }
- else {
- rb_protect((VALUE (*)())rb_thread_sleep, 1, &state);
- if (status) *status = state;
- if (!state) return 0;
- }
- break;
- }
- if (ep) {
- preserving_errno((close(ep[0]), close(ep[1])));
- }
- if (state && !status) rb_jump_tag(state);
- return -1;
+ return (VALUE)(*p->chfunc)(p->arg, p->errmsg, p->buflen);
}
-#define prefork() ( \
- rb_io_flush(rb_stdout), \
- rb_io_flush(rb_stderr) \
- )
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
/*
* Forks child process, and returns the process ID in the parent
@@ -3284,409 +3250,239 @@ handle_fork_error(int *status, int *ep, volatile int *try_gc_p)
* +chfunc+ must not raise any exceptions.
*/
-static ssize_t
-write_retry(int fd, const void *buf, size_t len)
-{
- ssize_t w;
-
- do {
- w = write(fd, buf, len);
- } while (w < 0 && errno == EINTR);
-
- return w;
-}
-
-static ssize_t
-read_retry(int fd, void *buf, size_t len)
+static rb_pid_t
+retry_fork(int *status, int *ep, int chfunc_is_async_signal_safe)
{
- ssize_t r;
+ rb_pid_t pid;
+ int state = 0;
+ int try_gc = 1;
- do {
- r = read(fd, buf, len);
- } while (r < 0 && errno == EINTR);
+#define prefork() ( \
+ rb_io_flush(rb_stdout), \
+ rb_io_flush(rb_stderr) \
+ )
- return r;
+ while (1) {
+ prefork();
+ if (!chfunc_is_async_signal_safe)
+ before_fork();
+ pid = fork();
+ if (pid == 0) /* fork succeed, child process */
+ return pid;
+ if (!chfunc_is_async_signal_safe)
+ preserving_errno(after_fork());
+ if (0 < pid) /* fork succeed, parent process */
+ return pid;
+ /* fork failed */
+ switch (errno) {
+ case ENOMEM:
+ if (try_gc-- > 0 && !rb_during_gc()) {
+ rb_gc();
+ continue;
+ }
+ break;
+ case EAGAIN:
+#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+#endif
+ if (!status && !ep) {
+ rb_thread_sleep(1);
+ continue;
+ }
+ else {
+ rb_protect((VALUE (*)())rb_thread_sleep, 1, &state);
+ if (status) *status = state;
+ if (!state) continue;
+ }
+ break;
+ }
+ if (ep) {
+ preserving_errno((close(ep[0]), close(ep[1])));
+ }
+ if (state && !status) rb_jump_tag(state);
+ return -1;
+ }
}
static void
-send_child_error(int fd, char *errmsg, size_t errmsg_buflen)
+send_child_error(int fd, int state, char *errmsg, size_t errmsg_buflen, int chfunc_is_async_signal_safe)
{
+ VALUE io = Qnil;
int err;
+ if (!chfunc_is_async_signal_safe) {
+ if (write(fd, &state, sizeof(state)) == sizeof(state) && state) {
+ VALUE errinfo = rb_errinfo();
+ io = rb_io_fdopen(fd, O_WRONLY|O_BINARY, NULL);
+ rb_marshal_dump(errinfo, io);
+ rb_io_flush(io);
+ }
+ }
err = errno;
- if (write_retry(fd, &err, sizeof(err)) < 0) err = errno;
+ if (write(fd, &err, sizeof(err)) < 0) err = errno;
if (errmsg && 0 < errmsg_buflen) {
errmsg[errmsg_buflen-1] = '\0';
errmsg_buflen = strlen(errmsg);
- if (errmsg_buflen > 0 && write_retry(fd, errmsg, errmsg_buflen) < 0)
+ if (errmsg_buflen > 0 && write(fd, errmsg, errmsg_buflen) < 0)
err = errno;
}
+ if (!NIL_P(io)) rb_io_close(io);
}
static int
-recv_child_error(int fd, int *errp, char *errmsg, size_t errmsg_buflen)
+recv_child_error(int fd, int *statep, VALUE *excp, int *errp, char *errmsg, size_t errmsg_buflen, int chfunc_is_async_signal_safe)
{
- int err;
+ int err, state = 0;
+ VALUE io = Qnil;
ssize_t size;
- if ((size = read_retry(fd, &err, sizeof(err))) < 0) {
+ VALUE exc = Qnil;
+ if (!chfunc_is_async_signal_safe) {
+ if ((read(fd, &state, sizeof(state))) == sizeof(state) && state) {
+ io = rb_io_fdopen(fd, O_RDONLY|O_BINARY, NULL);
+ exc = rb_marshal_load(io);
+ rb_set_errinfo(exc);
+ }
+ if (!*statep && state) *statep = state;
+ *excp = exc;
+ }
+#define READ_FROM_CHILD(ptr, len) \
+ (NIL_P(io) ? read(fd, (ptr), (len)) : rb_io_bufread(io, (ptr), (len)))
+ if ((size = READ_FROM_CHILD(&err, sizeof(err))) < 0) {
err = errno;
}
*errp = err;
if (size == sizeof(err) &&
errmsg && 0 < errmsg_buflen) {
- ssize_t ret = read_retry(fd, errmsg, errmsg_buflen-1);
+ ssize_t ret = READ_FROM_CHILD(errmsg, errmsg_buflen-1);
if (0 <= ret) {
errmsg[ret] = '\0';
}
}
- close(fd);
+ if (NIL_P(io))
+ close(fd);
+ else
+ rb_io_close(io);
return size != 0;
}
-#ifdef HAVE_WORKING_VFORK
-#if !defined(HAVE_GETRESUID) && defined(HAVE_GETUIDX)
-/* AIX 7.1 */
-static int
-getresuid(rb_uid_t *ruid, rb_uid_t *euid, rb_uid_t *suid)
-{
- rb_uid_t ret;
-
- *ruid = getuid();
- *euid = geteuid();
- ret = getuidx(ID_SAVED);
- if (ret == (rb_uid_t)-1)
- return -1;
- *suid = ret;
- return 0;
-}
-#define HAVE_GETRESUID
-#endif
-
-#if !defined(HAVE_GETRESGID) && defined(HAVE_GETGIDX)
-/* AIX 7.1 */
-static int
-getresgid(rb_gid_t *rgid, rb_gid_t *egid, rb_gid_t *sgid)
-{
- rb_gid_t ret;
-
- *rgid = getgid();
- *egid = getegid();
- ret = getgidx(ID_SAVED);
- if (ret == (rb_gid_t)-1)
- return -1;
- *sgid = ret;
- return 0;
-}
-#define HAVE_GETRESGID
-#endif
-
-static int
-has_privilege(void)
-{
- /*
- * has_privilege() is used to choose vfork() or fork().
- *
- * If the process has privilege, the parent process or
- * the child process can change UID/GID.
- * If vfork() is used to create the child process and
- * the parent or child process change effective UID/GID,
- * different privileged processes shares memory.
- * It is a bad situation.
- * So, fork() should be used.
- */
-
- rb_uid_t ruid, euid;
- rb_gid_t rgid, egid;
-
-#if defined HAVE_ISSETUGID
- if (issetugid())
- return 1;
-#endif
-
-#ifdef HAVE_GETRESUID
- {
- int ret;
- rb_uid_t suid;
- ret = getresuid(&ruid, &euid, &suid);
- if (ret == -1)
- rb_sys_fail("getresuid(2)");
- if (euid != suid)
- return 1;
- }
-#else
- ruid = getuid();
- euid = geteuid();
-#endif
-
- if (euid == 0 || euid != ruid)
- return 1;
-
-#ifdef HAVE_GETRESGID
- {
- int ret;
- rb_gid_t sgid;
- ret = getresgid(&rgid, &egid, &sgid);
- if (ret == -1)
- rb_sys_fail("getresgid(2)");
- if (egid != sgid)
- return 1;
- }
-#else
- rgid = getgid();
- egid = getegid();
-#endif
-
- if (egid != rgid)
- return 1;
-
- return 0;
-}
-#endif
-
-struct child_handler_disabler_state
-{
- sigset_t sigmask;
- int cancelstate;
-};
-
-static void
-disable_child_handler_before_fork(struct child_handler_disabler_state *old)
-{
- int ret;
- sigset_t all;
-
-#ifdef HAVE_PTHREAD_SIGMASK
- ret = sigfillset(&all);
- if (ret == -1)
- rb_sys_fail("sigfillset");
-
- ret = pthread_sigmask(SIG_SETMASK, &all, &old->sigmask); /* not async-signal-safe */
- if (ret != 0) {
- rb_syserr_fail(ret, "pthread_sigmask");
- }
-#else
-# pragma GCC warning "pthread_sigmask on fork is not available. potentially dangerous"
-#endif
-
-#ifdef PTHREAD_CANCEL_DISABLE
- ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old->cancelstate);
- if (ret != 0) {
- rb_syserr_fail(ret, "pthread_setcancelstate");
- }
-#endif
-}
-
-static void
-disable_child_handler_fork_parent(struct child_handler_disabler_state *old)
-{
- int ret;
-
-#ifdef PTHREAD_CANCEL_DISABLE
- ret = pthread_setcancelstate(old->cancelstate, NULL);
- if (ret != 0) {
- rb_syserr_fail(ret, "pthread_setcancelstate");
- }
-#endif
-
-#ifdef HAVE_PTHREAD_SIGMASK
- ret = pthread_sigmask(SIG_SETMASK, &old->sigmask, NULL); /* not async-signal-safe */
- if (ret != 0) {
- rb_syserr_fail(ret, "pthread_sigmask");
- }
-#else
-# pragma GCC warning "pthread_sigmask on fork is not available. potentially dangerous"
-#endif
-}
-
-/* This function should be async-signal-safe. Actually it is. */
-static int
-disable_child_handler_fork_child(struct child_handler_disabler_state *old, char *errmsg, size_t errmsg_buflen)
-{
- int sig;
- int ret;
-#ifdef POSIX_SIGNAL
- struct sigaction act, oact;
-
- act.sa_handler = SIG_DFL;
- act.sa_flags = 0;
- ret = sigemptyset(&act.sa_mask); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("sigemptyset");
- return -1;
- }
-#else
- sig_t handler;
-#endif
-
- for (sig = 1; sig < NSIG; sig++) {
- int reset = 0;
-#ifdef SIGPIPE
- if (sig == SIGPIPE)
- reset = 1;
-#endif
- if (!reset) {
-#ifdef POSIX_SIGNAL
- ret = sigaction(sig, NULL, &oact); /* async-signal-safe */
- if (ret == -1 && errno == EINVAL) {
- continue; /* Ignore invalid signal number. */
- }
- if (ret == -1) {
- ERRMSG("sigaction to obtain old action");
- return -1;
- }
- reset = (oact.sa_flags & SA_SIGINFO) ||
- (oact.sa_handler != SIG_IGN && oact.sa_handler != SIG_DFL);
-#else
- handler = signal(sig, SIG_DFL);
- if (handler == SIG_ERR && errno == EINVAL) {
- continue; /* Ignore invalid signal number */
- }
- if (handler == SIG_ERR) {
- ERRMSG("signal to obtain old action");
- return -1;
- }
- reset = (handler != SIG_IGN && handler != SIG_DFL);
-#endif
- }
- if (reset) {
-#ifdef POSIX_SIGNAL
- ret = sigaction(sig, &act, NULL); /* async-signal-safe */
- if (ret == -1) {
- ERRMSG("sigaction to set default action");
- return -1;
- }
-#else
- handler = signal(sig, handler);
- if (handler == SIG_ERR) {
- ERRMSG("signal to set default action");
- return -1;
- }
-#endif
- }
- }
-
- ret = sigprocmask(SIG_SETMASK, &old->sigmask, NULL); /* async-signal-safe */
- if (ret != 0) {
- ERRMSG("sigprocmask");
- return -1;
- }
- return 0;
-}
-
static rb_pid_t
-retry_fork_async_signal_safe(int *status, int *ep,
- int (*chfunc)(void*, char *, size_t), void *charg,
+rb_fork_internal(int *status, int (*chfunc)(void*, char *, size_t), void *charg,
+ int chfunc_is_async_signal_safe, VALUE fds,
char *errmsg, size_t errmsg_buflen)
{
rb_pid_t pid;
- volatile int try_gc = 1;
- struct child_handler_disabler_state old;
+ int err, state = 0;
+ int ep[2];
+ VALUE exc = Qnil;
+ int error_occurred;
- while (1) {
- prefork();
- disable_child_handler_before_fork(&old);
-#ifdef HAVE_WORKING_VFORK
- if (!has_privilege())
- pid = vfork();
- else
- pid = fork();
-#else
- pid = fork();
-#endif
- if (pid == 0) {/* fork succeed, child process */
+ if (status) *status = 0;
+
+ if (!chfunc) {
+ pid = retry_fork(status, NULL, FALSE);
+ if (pid < 0)
+ return pid;
+ if (!pid) {
+ forked_child = 1;
+ after_fork();
+ }
+ return pid;
+ }
+ else {
+ if (pipe_nocrash(ep, fds)) return -1;
+ pid = retry_fork(status, ep, chfunc_is_async_signal_safe);
+ if (pid < 0)
+ return pid;
+ if (!pid) {
int ret;
+ forked_child = 1;
close(ep[0]);
- ret = disable_child_handler_fork_child(&old, errmsg, errmsg_buflen); /* async-signal-safe */
- if (ret == 0) {
+ if (chfunc_is_async_signal_safe)
ret = chfunc(charg, errmsg, errmsg_buflen);
- if (!ret) _exit(EXIT_SUCCESS);
+ else {
+ struct chfunc_protect_t arg;
+ arg.chfunc = chfunc;
+ arg.arg = charg;
+ arg.errmsg = errmsg;
+ arg.buflen = errmsg_buflen;
+ ret = (int)rb_protect(chfunc_protect, (VALUE)&arg, &state);
}
- send_child_error(ep[1], errmsg, errmsg_buflen);
+ if (!ret) _exit(EXIT_SUCCESS);
+ send_child_error(ep[1], state, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
#if EXIT_SUCCESS == 127
_exit(EXIT_FAILURE);
#else
_exit(127);
#endif
}
- preserving_errno(disable_child_handler_fork_parent(&old));
- if (0 < pid) /* fork succeed, parent process */
- return pid;
- /* fork failed */
- if (handle_fork_error(status, ep, &try_gc))
+ close(ep[1]);
+ error_occurred = recv_child_error(ep[0], &state, &exc, &err, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
+ if (state || error_occurred) {
+ if (status) {
+ rb_protect(proc_syswait, (VALUE)pid, status);
+ if (state) *status = state;
+ }
+ else {
+ rb_syswait(pid);
+ if (state) rb_exc_raise(exc);
+ }
+ errno = err;
return -1;
+ }
+ return pid;
}
}
rb_pid_t
+rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds,
+ char *errmsg, size_t errmsg_buflen)
+{
+ return rb_fork_internal(status, chfunc, charg, FALSE, fds, errmsg, errmsg_buflen);
+}
+
+rb_pid_t
rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds,
char *errmsg, size_t errmsg_buflen)
{
- rb_pid_t pid;
- int err;
- int ep[2];
- int error_occurred;
+ return rb_fork_internal(status, chfunc, charg, TRUE, fds, errmsg, errmsg_buflen);
+}
- if (status) *status = 0;
+struct chfunc_wrapper_t {
+ int (*chfunc)(void*);
+ void *arg;
+};
- if (pipe_nocrash(ep, fds)) return -1;
- pid = retry_fork_async_signal_safe(status, ep, chfunc, charg, errmsg, errmsg_buflen);
- if (pid < 0)
- return pid;
- close(ep[1]);
- error_occurred = recv_child_error(ep[0], &err, errmsg, errmsg_buflen);
- if (error_occurred) {
- if (status) {
- rb_protect(proc_syswait, (VALUE)pid, status);
- }
- else {
- rb_syswait(pid);
- }
- errno = err;
- return -1;
- }
- return pid;
+static int
+chfunc_wrapper(void *arg_, char *errmsg, size_t errmsg_buflen)
+{
+ struct chfunc_wrapper_t *arg = arg_;
+ return arg->chfunc(arg->arg);
}
-static rb_pid_t
-retry_fork_ruby(int *status)
+rb_pid_t
+rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
{
- rb_pid_t pid;
- int try_gc = 1;
-
- while (1) {
- prefork();
- before_fork_ruby();
- pid = fork();
- if (pid == 0) /* fork succeed, child process */
- return pid;
- preserving_errno(after_fork_ruby());
- if (0 < pid) /* fork succeed, parent process */
- return pid;
- /* fork failed */
- if (handle_fork_error(status, NULL, &try_gc))
- return -1;
+ if (chfunc) {
+ struct chfunc_wrapper_t warg;
+ warg.chfunc = chfunc;
+ warg.arg = charg;
+ return rb_fork_internal(status, chfunc_wrapper, &warg, FALSE, fds, NULL, 0);
}
+ else {
+ return rb_fork_internal(status, NULL, NULL, FALSE, fds, NULL, 0);
+ }
+
}
rb_pid_t
rb_fork_ruby(int *status)
{
- rb_pid_t pid;
-
- if (status) *status = 0;
-
- pid = retry_fork_ruby(status);
- if (pid < 0)
- return pid;
- if (!pid) {
- after_fork_ruby();
- }
- return pid;
+ return rb_fork_internal(status, NULL, NULL, FALSE, Qnil, NULL, 0);
}
#endif
-#if defined(HAVE_WORKING_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
+#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
/*
* call-seq:
* Kernel.fork [{ block }] -> fixnum or nil
@@ -3709,7 +3505,7 @@ rb_fork_ruby(int *status)
*
* If fork is not usable, Process.respond_to?(:fork) returns false.
*
- * Note that fork(2) is not available on some platforms like Windows and NetBSD 4.
+ * Note that fork(2) is not avaiable on some platforms like Windows and NetBSD 4.
* Therefore you should use spawn() instead of fork().
*/
@@ -3718,6 +3514,8 @@ rb_f_fork(VALUE obj)
{
rb_pid_t pid;
+ rb_secure(2);
+
switch (pid = rb_fork_ruby(NULL)) {
case 0:
rb_thread_atfork();
@@ -3802,7 +3600,8 @@ rb_exit(int status)
args[1] = rb_str_new2("exit");
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
- ruby_stop(status);
+ ruby_finalize();
+ exit(status);
}
@@ -3848,7 +3647,7 @@ rb_exit(int status)
*/
VALUE
-rb_f_exit(int argc, const VALUE *argv)
+rb_f_exit(int argc, VALUE *argv)
{
VALUE status;
int istatus;
@@ -3877,9 +3676,8 @@ rb_f_exit(int argc, const VALUE *argv)
*/
VALUE
-rb_f_abort(int argc, const VALUE *argv)
+rb_f_abort(int argc, VALUE *argv)
{
- rb_check_arity(argc, 0, 1);
if (argc == 0) {
if (!NIL_P(GET_THREAD()->errinfo)) {
ruby_error_print();
@@ -3889,9 +3687,9 @@ rb_f_abort(int argc, const VALUE *argv)
else {
VALUE args[2];
- args[1] = args[0] = argv[0];
- StringValue(args[0]);
- rb_io_puts(1, args, rb_stderr);
+ rb_scan_args(argc, argv, "1", &args[1]);
+ StringValue(argv[0]);
+ rb_io_puts(argc, argv, rb_stderr);
args[0] = INT2NUM(EXIT_FAILURE);
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
@@ -3907,43 +3705,20 @@ rb_syswait(rb_pid_t pid)
rb_waitpid(pid, &status, 0);
}
-#if !defined HAVE_WORKING_FORK && !defined HAVE_SPAWNV
-char *
-rb_execarg_commandline(const struct rb_execarg *eargp, VALUE *prog)
-{
- VALUE cmd = *prog;
- if (eargp && !eargp->use_shell) {
- VALUE str = eargp->invoke.cmd.argv_str;
- VALUE buf = eargp->invoke.cmd.argv_buf;
- char *p, **argv = ARGVSTR2ARGV(str);
- long i, argc = ARGVSTR2ARGC(str);
- const char *start = RSTRING_PTR(buf);
- cmd = rb_str_new(start, RSTRING_LEN(buf));
- p = RSTRING_PTR(cmd);
- for (i = 1; i < argc; ++i) {
- p[argv[i] - start - 1] = ' ';
- }
- *prog = cmd;
- return p;
- }
- return StringValueCStr(*prog);
-}
-#endif
-
static rb_pid_t
rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
{
rb_pid_t pid;
-#if !defined HAVE_WORKING_FORK || USE_SPAWNV
+#if !USE_SPAWNV
+ int status;
+#endif
+#if !defined HAVE_FORK || USE_SPAWNV
VALUE prog;
struct rb_execarg sarg;
-# if !defined HAVE_SPAWNV
- int status;
-# endif
#endif
-#if defined HAVE_WORKING_FORK && !USE_SPAWNV
- pid = rb_fork_async_signal_safe(NULL, rb_exec_atfork, eargp, eargp->redirect_fds, errmsg, errmsg_buflen);
+#if defined HAVE_FORK && !USE_SPAWNV
+ pid = rb_fork_async_signal_safe(&status, rb_exec_atfork, eargp, eargp->redirect_fds, errmsg, errmsg_buflen);
#else
prog = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
@@ -3966,9 +3741,13 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
if (pid == -1)
rb_last_status_set(0x7f << 8, 0);
# else
- status = system(rb_execarg_commandline(eargp, &prog));
+ if (!eargp->use_shell) {
+ char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
+ int argc = ARGVSTR2ARGC(eargp->invoke.cmd.argv_str);
+ prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
+ }
+ status = system(StringValuePtr(prog));
rb_last_status_set((status & 0xff) << 8, 0);
- pid = 1; /* dummy */
# endif
rb_execarg_run_options(&sarg, NULL, errmsg, errmsg_buflen);
@@ -3976,52 +3755,29 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
return pid;
}
-struct spawn_args {
- VALUE execarg;
- struct {
- char *ptr;
- size_t buflen;
- } errmsg;
-};
-
-static VALUE
-do_spawn_process(VALUE arg)
-{
- struct spawn_args *argp = (struct spawn_args *)arg;
- rb_execarg_parent_start1(argp->execarg);
- return (VALUE)rb_spawn_process(DATA_PTR(argp->execarg),
- argp->errmsg.ptr, argp->errmsg.buflen);
-}
-
static rb_pid_t
-rb_execarg_spawn(VALUE execarg_obj, char *errmsg, size_t errmsg_buflen)
-{
- struct spawn_args args;
-
- args.execarg = execarg_obj;
- args.errmsg.ptr = errmsg;
- args.errmsg.buflen = errmsg_buflen;
- return (rb_pid_t)rb_ensure(do_spawn_process, (VALUE)&args,
- execarg_parent_end, execarg_obj);
-}
-
-static rb_pid_t
-rb_spawn_internal(int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen)
+rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
VALUE execarg_obj;
+ struct rb_execarg *eargp;
+ rb_pid_t ret;
execarg_obj = rb_execarg_new(argc, argv, TRUE);
- return rb_execarg_spawn(execarg_obj, errmsg, errmsg_buflen);
+ eargp = rb_execarg_get(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
+ ret = rb_spawn_process(eargp, errmsg, errmsg_buflen);
+ RB_GC_GUARD(execarg_obj);
+ return ret;
}
rb_pid_t
-rb_spawn_err(int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen)
+rb_spawn_err(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
return rb_spawn_internal(argc, argv, errmsg, errmsg_buflen);
}
rb_pid_t
-rb_spawn(int argc, const VALUE *argv)
+rb_spawn(int argc, VALUE *argv)
{
return rb_spawn_internal(argc, argv, NULL, 0);
}
@@ -4076,7 +3832,7 @@ rb_f_system(int argc, VALUE *argv)
chfunc = signal(SIGCHLD, SIG_DFL);
#endif
pid = rb_spawn_internal(argc, argv, NULL, 0);
-#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
if (pid > 0) {
int ret, status;
ret = rb_waitpid(pid, &status, 0);
@@ -4123,8 +3879,6 @@ rb_f_system(int argc, VALUE *argv)
* env: hash
* name => val : set the environment variable
* name => nil : unset the environment variable
- *
- * the keys and the values except for +nil+ must be strings.
* command...:
* commandline : command line string which is passed to the standard shell
* cmdname, arg1, ... : command name and one or more arguments (This form does not use the shell. See below for caveats.)
@@ -4135,7 +3889,7 @@ rb_f_system(int argc, VALUE *argv)
* :unsetenv_others => false : don't clear (default)
* process group:
* :pgroup => true or 0 : make a new process group
- * :pgroup => pgid : join the specified process group
+ * :pgroup => pgid : join to specified process group
* :pgroup => nil : don't change the process group (default)
* create new process group: Windows only
* :new_pgroup => true : the new process is the root process of a new process group
@@ -4200,10 +3954,10 @@ rb_f_system(int argc, VALUE *argv)
* pid = spawn({"FOO"=>"BAR"}, command, :unsetenv_others=>true) # FOO only
*
* The <code>:pgroup</code> key in +options+ specifies a process group.
- * The corresponding value should be true, zero, a positive integer, or nil.
- * true and zero cause the process to be a process leader of a new process group.
- * A non-zero positive integer causes the process to join the provided process group.
- * The default value, nil, causes the process to remain in the same process group.
+ * The corresponding value should be true, zero or positive integer.
+ * true and zero means the process should be a process leader of a new
+ * process group.
+ * Other values specifies a process group to be belongs.
*
* pid = spawn(command, :pgroup=>true) # process leader
* pid = spawn(command, :pgroup=>10) # belongs to the process group 10
@@ -4263,10 +4017,9 @@ rb_f_system(int argc, VALUE *argv)
* pid = spawn(command, :in=>"/dev/null") # read mode
* pid = spawn(command, :out=>"/dev/null") # write mode
* pid = spawn(command, :err=>"log") # write mode
- * pid = spawn(command, [:out, :err]=>"/dev/null") # write mode
* pid = spawn(command, 3=>"/dev/null") # read mode
*
- * For stdout and stderr (and combination of them),
+ * For stdout and stderr,
* it is opened in write mode.
* Otherwise read mode is used.
*
@@ -4373,17 +4126,20 @@ rb_f_spawn(int argc, VALUE *argv)
execarg_obj = rb_execarg_new(argc, argv, TRUE);
eargp = rb_execarg_get(execarg_obj);
+ rb_execarg_fixup(execarg_obj);
fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
- pid = rb_execarg_spawn(execarg_obj, errmsg, sizeof(errmsg));
+ pid = rb_spawn_process(eargp, errmsg, sizeof(errmsg));
+ RB_GC_GUARD(execarg_obj);
if (pid == -1) {
- int err = errno;
- rb_exec_fail(eargp, err, errmsg);
- RB_GC_GUARD(execarg_obj);
- rb_syserr_fail_str(err, fail_str);
+ const char *prog = errmsg;
+ if (!prog[0]) {
+ rb_sys_fail_str(fail_str);
+ }
+ rb_sys_fail(prog);
}
-#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
return PIDT2NUM(pid);
#else
return Qnil;
@@ -4444,6 +4200,7 @@ proc_getpgrp(void)
{
rb_pid_t pgrp;
+ rb_secure(2);
#if defined(HAVE_GETPGRP) && defined(GETPGRP_VOID)
pgrp = getpgrp();
if (pgrp < 0) rb_sys_fail(0);
@@ -4471,6 +4228,7 @@ proc_getpgrp(void)
static VALUE
proc_setpgrp(void)
{
+ rb_secure(2);
/* check for posix setpgid() first; this matches the posix */
/* getpgrp() above. It appears that configure will set SETPGRP_VOID */
/* even though setpgrp(0,0) would be preferred. The posix call avoids */
@@ -4503,6 +4261,7 @@ proc_getpgid(VALUE obj, VALUE pid)
{
rb_pid_t i;
+ rb_secure(2);
i = getpgid(NUM2PIDT(pid));
if (i < 0) rb_sys_fail(0);
return PIDT2NUM(i);
@@ -4526,6 +4285,7 @@ proc_setpgid(VALUE obj, VALUE pid, VALUE pgrp)
{
rb_pid_t ipid, ipgrp;
+ rb_secure(2);
ipid = NUM2PIDT(pid);
ipgrp = NUM2PIDT(pgrp);
@@ -4543,7 +4303,7 @@ proc_setpgid(VALUE obj, VALUE pid, VALUE pgrp)
* Process.getsid() -> integer
* Process.getsid(pid) -> integer
*
- * Returns the session ID for the given process id. If not given,
+ * Returns the session ID for for the given process id. If not give,
* return current process sid. Not available on all platforms.
*
* Process.getsid() #=> 27422
@@ -4556,6 +4316,7 @@ proc_getsid(int argc, VALUE *argv)
rb_pid_t sid;
VALUE pid;
+ rb_secure(2);
rb_scan_args(argc, argv, "01", &pid);
if (NIL_P(pid))
@@ -4591,6 +4352,7 @@ proc_setsid(void)
{
rb_pid_t pid;
+ rb_secure(2);
pid = setsid();
if (pid < 0) rb_sys_fail(0);
return PIDT2NUM(pid);
@@ -4651,6 +4413,7 @@ proc_getpriority(VALUE obj, VALUE which, VALUE who)
{
int prio, iwhich, iwho;
+ rb_secure(2);
iwhich = NUM2INT(which);
iwho = NUM2INT(who);
@@ -4682,6 +4445,7 @@ proc_setpriority(VALUE obj, VALUE which, VALUE who, VALUE prio)
{
int iwhich, iwho, iprio;
+ rb_secure(2);
iwhich = NUM2INT(which);
iwho = NUM2INT(who);
iprio = NUM2INT(prio);
@@ -4696,13 +4460,13 @@ proc_setpriority(VALUE obj, VALUE which, VALUE who, VALUE prio)
#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
static int
-rlimit_resource_name2int(const char *name, long len, int casetype)
+rlimit_resource_name2int(const char *name, int casetype)
{
int resource;
const char *p;
#define RESCHECK(r) \
do { \
- if (len == rb_strlen_lit(#r) && STRCASECMP(name, #r) == 0) { \
+ if (STRCASECMP(name, #r) == 0) { \
resource = RLIMIT_##r; \
goto found; \
} \
@@ -4805,48 +4569,27 @@ rlimit_resource_name2int(const char *name, long len, int casetype)
}
static int
-rlimit_type_by_hname(const char *name, long len)
+rlimit_type_by_hname(const char *name)
{
- return rlimit_resource_name2int(name, len, 0);
+ return rlimit_resource_name2int(name, 0);
}
static int
-rlimit_type_by_lname(const char *name, long len)
+rlimit_type_by_lname(const char *name)
{
- return rlimit_resource_name2int(name, len, 1);
-}
-
-static int
-rlimit_type_by_sym(VALUE key)
-{
- VALUE name = rb_sym2str(key);
- const char *rname = RSTRING_PTR(name);
- long len = RSTRING_LEN(name);
- int rtype = -1;
- static const char prefix[] = "rlimit_";
- enum {prefix_len = sizeof(prefix)-1};
-
- if (len > prefix_len && strncmp(prefix, rname, prefix_len) == 0) {
- rtype = rlimit_type_by_lname(rname + prefix_len, len - prefix_len);
- }
-
- RB_GC_GUARD(key);
- return rtype;
+ return rlimit_resource_name2int(name, 1);
}
static int
rlimit_resource_type(VALUE rtype)
{
const char *name;
- long len;
VALUE v;
int r;
switch (TYPE(rtype)) {
case T_SYMBOL:
- v = rb_sym2str(rtype);
- name = RSTRING_PTR(v);
- len = RSTRING_LEN(v);
+ name = rb_id2name(SYM2ID(rtype));
break;
default:
@@ -4855,7 +4598,6 @@ rlimit_resource_type(VALUE rtype)
rtype = v;
case T_STRING:
name = StringValueCStr(rtype);
- len = RSTRING_LEN(rtype);
break;
}
/* fall through */
@@ -4865,11 +4607,11 @@ rlimit_resource_type(VALUE rtype)
return NUM2INT(rtype);
}
- r = rlimit_type_by_hname(name, len);
+ r = rlimit_type_by_hname(name);
if (r != -1)
return r;
- rb_raise(rb_eArgError, "invalid resource name: % "PRIsVALUE, rtype);
+ rb_raise(rb_eArgError, "invalid resource name: %s", name);
UNREACHABLE;
}
@@ -4882,8 +4624,7 @@ rlimit_resource_value(VALUE rval)
switch (TYPE(rval)) {
case T_SYMBOL:
- v = rb_sym2str(rval);
- name = RSTRING_PTR(v);
+ name = rb_id2name(SYM2ID(rval));
break;
default:
@@ -4910,7 +4651,7 @@ rlimit_resource_value(VALUE rval)
#ifdef RLIM_SAVED_CUR
if (strcmp(name, "SAVED_CUR") == 0) return RLIM_SAVED_CUR;
#endif
- rb_raise(rb_eArgError, "invalid resource value: %"PRIsVALUE, rval);
+ rb_raise(rb_eArgError, "invalid resource value: %s", name);
UNREACHABLE;
}
@@ -4942,6 +4683,8 @@ proc_getrlimit(VALUE obj, VALUE resource)
{
struct rlimit rlim;
+ rb_secure(2);
+
if (getrlimit(rlimit_resource_type(resource), &rlim) < 0) {
rb_sys_fail("getrlimit");
}
@@ -5009,6 +4752,8 @@ proc_setrlimit(int argc, VALUE *argv, VALUE obj)
VALUE resource, rlim_cur, rlim_max;
struct rlimit rlim;
+ rb_secure(2);
+
rb_scan_args(argc, argv, "21", &resource, &rlim_cur, &rlim_max);
if (rlim_max == Qnil)
rlim_max = rlim_cur;
@@ -5029,6 +4774,7 @@ static int under_uid_switch = 0;
static void
check_uid_switch(void)
{
+ rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID while evaluating block given to Process::UID.switch method");
}
@@ -5038,6 +4784,7 @@ static int under_gid_switch = 0;
static void
check_gid_switch(void)
{
+ rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID while evaluating block given to Process::UID.switch method");
}
@@ -5058,7 +4805,7 @@ check_gid_switch(void)
static rb_uid_t
obj2uid(VALUE id
# ifdef USE_GETPWNAM_R
- , VALUE *getpw_tmp
+ , char *getpw_buf, size_t getpw_buf_len
# endif
)
{
@@ -5073,28 +4820,8 @@ obj2uid(VALUE id
struct passwd *pwptr;
#ifdef USE_GETPWNAM_R
struct passwd pwbuf;
- char *getpw_buf;
- long getpw_buf_len;
- if (!*getpw_tmp) {
- getpw_buf_len = GETPW_R_SIZE_INIT;
- if (getpw_buf_len < 0) getpw_buf_len = GETPW_R_SIZE_DEFAULT;
- *getpw_tmp = rb_str_tmp_new(getpw_buf_len);
- }
- getpw_buf = RSTRING_PTR(*getpw_tmp);
- getpw_buf_len = rb_str_capacity(*getpw_tmp);
- rb_str_set_len(*getpw_tmp, getpw_buf_len);
- errno = ERANGE;
- /* gepwnam_r() on MacOS X doesn't set errno if buffer size is insufficient */
- while (getpwnam_r(usrname, &pwbuf, getpw_buf, getpw_buf_len, &pwptr)) {
- int e = errno;
- if (e != ERANGE || getpw_buf_len >= GETPW_R_SIZE_LIMIT) {
- rb_str_resize(*getpw_tmp, 0);
- rb_syserr_fail(e, "getpwnam_r");
- }
- rb_str_modify_expand(*getpw_tmp, getpw_buf_len);
- getpw_buf = RSTRING_PTR(*getpw_tmp);
- getpw_buf_len = rb_str_capacity(*getpw_tmp);
- }
+ if (getpwnam_r(usrname, &pwbuf, getpw_buf, getpw_buf_len, &pwptr))
+ rb_sys_fail("getpwnam_r");
#else
pwptr = getpwnam(usrname);
#endif
@@ -5127,6 +4854,7 @@ obj2uid(VALUE id
static VALUE
p_uid_from_name(VALUE self, VALUE id)
{
+ PREPARE_GETPWNAM
return UIDT2NUM(OBJ2UID(id));
}
# endif
@@ -5136,7 +4864,7 @@ p_uid_from_name(VALUE self, VALUE id)
static rb_gid_t
obj2gid(VALUE id
# ifdef USE_GETGRNAM_R
- , VALUE *getgr_tmp
+ , char *getgr_buf, size_t getgr_buf_len
# endif
)
{
@@ -5151,32 +4879,10 @@ obj2gid(VALUE id
struct group *grptr;
#ifdef USE_GETGRNAM_R
struct group grbuf;
- char *getgr_buf;
- long getgr_buf_len;
- if (!*getgr_tmp) {
- getgr_buf_len = GETGR_R_SIZE_INIT;
- if (getgr_buf_len < 0) getgr_buf_len = GETGR_R_SIZE_DEFAULT;
- *getgr_tmp = rb_str_tmp_new(getgr_buf_len);
- }
- getgr_buf = RSTRING_PTR(*getgr_tmp);
- getgr_buf_len = rb_str_capacity(*getgr_tmp);
- rb_str_set_len(*getgr_tmp, getgr_buf_len);
- errno = ERANGE;
- /* gegrnam_r() on MacOS X doesn't set errno if buffer size is insufficient */
- while (getgrnam_r(grpname, &grbuf, getgr_buf, getgr_buf_len, &grptr)) {
- int e = errno;
- if (e != ERANGE || getgr_buf_len >= GETGR_R_SIZE_LIMIT) {
- rb_str_resize(*getgr_tmp, 0);
- rb_syserr_fail(e, "getgrnam_r");
- }
- rb_str_modify_expand(*getgr_tmp, getgr_buf_len);
- getgr_buf = RSTRING_PTR(*getgr_tmp);
- getgr_buf_len = rb_str_capacity(*getgr_tmp);
- }
-#elif defined(HAVE_GETGRNAM)
- grptr = getgrnam(grpname);
+ if (getgrnam_r(grpname, &grbuf, getgr_buf, getgr_buf_len, &grptr))
+ rb_sys_fail("getgrnam_r");
#else
- grptr = NULL;
+ grptr = getgrnam(grpname);
#endif
if (!grptr) {
#if !defined(USE_GETGRNAM_R) && defined(HAVE_ENDGRENT)
@@ -5207,6 +4913,7 @@ obj2gid(VALUE id
static VALUE
p_gid_from_name(VALUE self, VALUE id)
{
+ PREPARE_GETGRNAM;
return GIDT2NUM(OBJ2GID(id));
}
# endif
@@ -5225,6 +4932,7 @@ p_gid_from_name(VALUE self, VALUE id)
static VALUE
p_sys_setuid(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
if (setuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
@@ -5247,6 +4955,7 @@ p_sys_setuid(VALUE obj, VALUE id)
static VALUE
p_sys_setruid(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
if (setruid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
@@ -5269,6 +4978,7 @@ p_sys_setruid(VALUE obj, VALUE id)
static VALUE
p_sys_seteuid(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
if (seteuid(OBJ2UID(id)) != 0) rb_sys_fail(0);
return Qnil;
@@ -5293,13 +5003,9 @@ p_sys_seteuid(VALUE obj, VALUE id)
static VALUE
p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
{
- rb_uid_t ruid, euid;
PREPARE_GETPWNAM;
check_uid_switch();
- ruid = OBJ2UID1(rid);
- euid = OBJ2UID1(eid);
- FINISH_GETPWNAM;
- if (setreuid(ruid, euid) != 0) rb_sys_fail(0);
+ if (setreuid(OBJ2UID(rid), OBJ2UID(eid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -5322,14 +5028,9 @@ p_sys_setreuid(VALUE obj, VALUE rid, VALUE eid)
static VALUE
p_sys_setresuid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
- rb_uid_t ruid, euid, suid;
PREPARE_GETPWNAM;
check_uid_switch();
- ruid = OBJ2UID1(rid);
- euid = OBJ2UID1(eid);
- suid = OBJ2UID1(sid);
- FINISH_GETPWNAM;
- if (setresuid(ruid, euid, suid) != 0) rb_sys_fail(0);
+ if (setresuid(OBJ2UID(rid), OBJ2UID(eid), OBJ2UID(sid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -5369,6 +5070,7 @@ static VALUE
proc_setuid(VALUE obj, VALUE id)
{
rb_uid_t uid;
+ PREPARE_GETPWNAM;
check_uid_switch();
@@ -5440,6 +5142,7 @@ static VALUE
p_uid_change_privilege(VALUE obj, VALUE id)
{
rb_uid_t uid;
+ PREPARE_GETPWNAM;
check_uid_switch();
@@ -5558,7 +5261,8 @@ p_uid_change_privilege(VALUE obj, VALUE id)
if (setruid(uid) < 0) rb_sys_fail(0);
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#elif defined HAVE_44BSD_SETUID
if (getuid() == uid) {
@@ -5567,21 +5271,24 @@ p_uid_change_privilege(VALUE obj, VALUE id)
SAVED_USER_ID = uid;
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#elif defined HAVE_SETEUID
if (getuid() == uid && SAVED_USER_ID == uid) {
if (seteuid(uid) < 0) rb_sys_fail(0);
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#elif defined HAVE_SETUID
if (getuid() == uid && SAVED_USER_ID == uid) {
if (setuid(uid) < 0) rb_sys_fail(0);
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#else
rb_notimplement();
@@ -5605,6 +5312,7 @@ p_uid_change_privilege(VALUE obj, VALUE id)
static VALUE
p_sys_setgid(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
if (setgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
@@ -5627,6 +5335,7 @@ p_sys_setgid(VALUE obj, VALUE id)
static VALUE
p_sys_setrgid(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
if (setrgid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
@@ -5649,6 +5358,7 @@ p_sys_setrgid(VALUE obj, VALUE id)
static VALUE
p_sys_setegid(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
check_gid_switch();
if (setegid(OBJ2GID(id)) != 0) rb_sys_fail(0);
return Qnil;
@@ -5673,13 +5383,9 @@ p_sys_setegid(VALUE obj, VALUE id)
static VALUE
p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
{
- rb_gid_t rgid, egid;
PREPARE_GETGRNAM;
check_gid_switch();
- rgid = OBJ2GID(rid);
- egid = OBJ2GID(eid);
- FINISH_GETGRNAM;
- if (setregid(rgid, egid) != 0) rb_sys_fail(0);
+ if (setregid(OBJ2GID(rid), OBJ2GID(eid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -5701,14 +5407,9 @@ p_sys_setregid(VALUE obj, VALUE rid, VALUE eid)
static VALUE
p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
{
- rb_gid_t rgid, egid, sgid;
PREPARE_GETGRNAM;
check_gid_switch();
- rgid = OBJ2GID(rid);
- egid = OBJ2GID(eid);
- sgid = OBJ2GID(sid);
- FINISH_GETGRNAM;
- if (setresgid(rgid, egid, sgid) != 0) rb_sys_fail(0);
+ if (setresgid(OBJ2GID(rid), OBJ2GID(eid), OBJ2GID(sid)) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -5732,6 +5433,7 @@ p_sys_setresgid(VALUE obj, VALUE rid, VALUE eid, VALUE sid)
static VALUE
p_sys_issetugid(VALUE obj)
{
+ rb_secure(2);
if (issetugid()) {
return Qtrue;
}
@@ -5775,6 +5477,7 @@ static VALUE
proc_setgid(VALUE obj, VALUE id)
{
rb_gid_t gid;
+ PREPARE_GETGRNAM;
check_gid_switch();
@@ -5802,7 +5505,7 @@ proc_setgid(VALUE obj, VALUE id)
#endif
-#if defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX)
+#if defined(HAVE_SETGROUPS) || defined(HAVE_GETGROUPS)
/*
* Maximum supplementary groups are platform dependent.
* FWIW, 65536 is enough big for our supported OSs.
@@ -5865,7 +5568,7 @@ maxgroups(void)
static VALUE
proc_getgroups(VALUE obj)
{
- VALUE ary, tmp;
+ VALUE ary;
int i, ngroups;
rb_gid_t *groups;
@@ -5873,7 +5576,7 @@ proc_getgroups(VALUE obj)
if (ngroups == -1)
rb_sys_fail(0);
- groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
+ groups = ALLOCA_N(rb_gid_t, ngroups);
ngroups = getgroups(ngroups, groups);
if (ngroups == -1)
@@ -5883,8 +5586,6 @@ proc_getgroups(VALUE obj)
for (i = 0; i < ngroups; i++)
rb_ary_push(ary, GIDT2NUM(groups[i]));
- ALLOCV_END(tmp);
-
return ary;
}
#else
@@ -5911,7 +5612,6 @@ proc_setgroups(VALUE obj, VALUE ary)
{
int ngroups, i;
rb_gid_t *groups;
- VALUE tmp;
PREPARE_GETGRNAM;
Check_Type(ary, T_ARRAY);
@@ -5920,20 +5620,17 @@ proc_setgroups(VALUE obj, VALUE ary)
if (ngroups > maxgroups())
rb_raise(rb_eArgError, "too many groups, %d max", maxgroups());
- groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
+ groups = ALLOCA_N(rb_gid_t, ngroups);
for (i = 0; i < ngroups; i++) {
VALUE g = RARRAY_AREF(ary, i);
- groups[i] = OBJ2GID1(g);
+ groups[i] = OBJ2GID(g);
}
- FINISH_GETGRNAM;
if (setgroups(ngroups, groups) == -1) /* ngroups <= maxgroups */
rb_sys_fail(0);
- ALLOCV_END(tmp);
-
return proc_getgroups(obj);
}
#else
@@ -5962,6 +5659,7 @@ proc_setgroups(VALUE obj, VALUE ary)
static VALUE
proc_initgroups(VALUE obj, VALUE uname, VALUE base_grp)
{
+ PREPARE_GETGRNAM;
if (initgroups(StringValuePtr(uname), OBJ2GID(base_grp)) != 0) {
rb_sys_fail(0);
}
@@ -6023,7 +5721,7 @@ proc_setmaxgroups(VALUE obj, VALUE val)
#define proc_setmaxgroups rb_f_notimplement
#endif
-#if defined(HAVE_DAEMON) || (defined(HAVE_WORKING_FORK) && defined(HAVE_SETSID))
+#if defined(HAVE_DAEMON) || (defined(HAVE_FORK) && defined(HAVE_SETSID))
static int rb_daemon(int nochdir, int noclose);
/*
@@ -6046,6 +5744,7 @@ proc_daemon(int argc, VALUE *argv)
VALUE nochdir, noclose;
int n;
+ rb_secure(2);
rb_scan_args(argc, argv, "02", &nochdir, &noclose);
prefork();
@@ -6059,9 +5758,9 @@ rb_daemon(int nochdir, int noclose)
{
int err = 0;
#ifdef HAVE_DAEMON
- before_fork_ruby();
+ before_fork();
err = daemon(nochdir, noclose);
- after_fork_ruby();
+ after_fork();
rb_thread_atfork();
#else
int n;
@@ -6142,6 +5841,7 @@ static VALUE
p_gid_change_privilege(VALUE obj, VALUE id)
{
rb_gid_t gid;
+ PREPARE_GETGRNAM;
check_gid_switch();
@@ -6260,7 +5960,8 @@ p_gid_change_privilege(VALUE obj, VALUE id)
if (setrgid(gid) < 0) rb_sys_fail(0);
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#elif defined HAVE_44BSD_SETGID
if (getgid() == gid) {
@@ -6269,21 +5970,24 @@ p_gid_change_privilege(VALUE obj, VALUE id)
SAVED_GROUP_ID = gid;
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#elif defined HAVE_SETEGID
if (getgid() == gid && SAVED_GROUP_ID == gid) {
if (setegid(gid) < 0) rb_sys_fail(0);
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#elif defined HAVE_SETGID
if (getgid() == gid && SAVED_GROUP_ID == gid) {
if (setgid(gid) < 0) rb_sys_fail(0);
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
#else
(void)gid;
@@ -6347,6 +6051,7 @@ proc_seteuid(rb_uid_t uid)
static VALUE
proc_seteuid_m(VALUE mod, VALUE euid)
{
+ PREPARE_GETPWNAM;
check_uid_switch();
proc_seteuid(OBJ2UID(euid));
return euid;
@@ -6412,6 +6117,7 @@ rb_seteuid_core(rb_uid_t euid)
static VALUE
p_uid_grant_privilege(VALUE obj, VALUE id)
{
+ PREPARE_GETPWNAM;
rb_seteuid_core(OBJ2UID(id));
return id;
}
@@ -6451,6 +6157,7 @@ proc_setegid(VALUE obj, VALUE egid)
{
#if defined(HAVE_SETRESGID) || defined(HAVE_SETREGID) || defined(HAVE_SETEGID) || defined(HAVE_SETGID)
rb_gid_t gid;
+ PREPARE_GETGRNAM;
#endif
check_gid_switch();
@@ -6542,6 +6249,7 @@ rb_setegid_core(rb_gid_t egid)
static VALUE
p_gid_grant_privilege(VALUE obj, VALUE id)
{
+ PREPARE_GETGRNAM;
rb_setegid_core(OBJ2GID(id));
return id;
}
@@ -6746,7 +6454,8 @@ p_uid_switch(VALUE obj)
}
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
UNREACHABLE;
@@ -6770,7 +6479,8 @@ p_uid_switch(VALUE obj)
euid = geteuid();
if (uid == euid) {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
p_uid_exchange(obj);
if (rb_block_given_p()) {
@@ -6859,7 +6569,8 @@ p_gid_switch(VALUE obj)
}
}
else {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
UNREACHABLE;
@@ -6883,7 +6594,8 @@ p_gid_switch(VALUE obj)
egid = getegid();
if (gid == egid) {
- rb_syserr_fail(EPERM, 0);
+ errno = EPERM;
+ rb_sys_fail(0);
}
p_gid_exchange(obj);
if (rb_block_given_p()) {
@@ -7109,30 +6821,27 @@ make_clock_result(struct timetick *ttp,
timetick_int_t *denominators, int num_denominators,
VALUE unit)
{
- if (unit == ID2SYM(id_nanosecond)) {
+ if (unit == ID2SYM(rb_intern("nanosecond"))) {
numerators[num_numerators++] = 1000000000;
return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
}
- else if (unit == ID2SYM(id_microsecond)) {
+ else if (unit == ID2SYM(rb_intern("microsecond"))) {
numerators[num_numerators++] = 1000000;
return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
}
- else if (unit == ID2SYM(id_millisecond)) {
+ else if (unit == ID2SYM(rb_intern("millisecond"))) {
numerators[num_numerators++] = 1000;
return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
}
- else if (unit == ID2SYM(id_second)) {
- return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
- }
- else if (unit == ID2SYM(id_float_microsecond)) {
+ else if (unit == ID2SYM(rb_intern("float_microsecond"))) {
numerators[num_numerators++] = 1000000;
return timetick2dblnum(ttp, numerators, num_numerators, denominators, num_denominators);
}
- else if (unit == ID2SYM(id_float_millisecond)) {
+ else if (unit == ID2SYM(rb_intern("float_millisecond"))) {
numerators[num_numerators++] = 1000;
return timetick2dblnum(ttp, numerators, num_numerators, denominators, num_denominators);
}
- else if (NIL_P(unit) || unit == ID2SYM(id_float_second)) {
+ else if (NIL_P(unit) || unit == ID2SYM(rb_intern("float_second"))) {
return timetick2dblnum(ttp, numerators, num_numerators, denominators, num_denominators);
}
else
@@ -7163,7 +6872,7 @@ get_mach_timebase_info(void)
* #=> 896053.968060096
*
* +clock_id+ specifies a kind of clock.
- * It is specified as a constant which begins with <code>Process::CLOCK_</code>
+ * It is specifed as a constant which begins with <code>Process::CLOCK_</code>
* such as Process::CLOCK_REALTIME and Process::CLOCK_MONOTONIC.
*
* The supported constants depends on OS and version.
@@ -7171,8 +6880,8 @@ get_mach_timebase_info(void)
*
* [CLOCK_REALTIME] SUSv2 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, OpenBSD 2.1
* [CLOCK_MONOTONIC] SUSv3 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, OpenBSD 3.4
- * [CLOCK_PROCESS_CPUTIME_ID] SUSv3 to 4, Linux 2.5.63, OpenBSD 5.4
- * [CLOCK_THREAD_CPUTIME_ID] SUSv3 to 4, Linux 2.5.63, FreeBSD 7.1, OpenBSD 5.4
+ * [CLOCK_PROCESS_CPUTIME_ID] SUSv3 to 4, Linux 2.5.63
+ * [CLOCK_THREAD_CPUTIME_ID] SUSv3 to 4, Linux 2.5.63, FreeBSD 7.1
* [CLOCK_VIRTUAL] FreeBSD 3.0, OpenBSD 2.1
* [CLOCK_PROF] FreeBSD 3.0, OpenBSD 2.1
* [CLOCK_REALTIME_FAST] FreeBSD 8.1
@@ -7185,7 +6894,7 @@ get_mach_timebase_info(void)
* [CLOCK_MONOTONIC_RAW] Linux 2.6.28
* [CLOCK_BOOTTIME] Linux 2.6.39
* [CLOCK_BOOTTIME_ALARM] Linux 3.0
- * [CLOCK_UPTIME] FreeBSD 7.0, OpenBSD 5.5
+ * [CLOCK_UPTIME] FreeBSD 7.0
* [CLOCK_UPTIME_FAST] FreeBSD 8.1
* [CLOCK_UPTIME_PRECISE] FreeBSD 8.1
* [CLOCK_SECOND] FreeBSD 8.1
@@ -7257,7 +6966,6 @@ get_mach_timebase_info(void)
* [:float_second] number of seconds as a float (default)
* [:float_millisecond] number of milliseconds as a float
* [:float_microsecond] number of microseconds as a float
- * [:second] number of seconds as an integer
* [:millisecond] number of milliseconds as an integer
* [:microsecond] number of microseconds as an integer
* [:nanosecond] number of nanoseconds as an integer
@@ -7298,7 +7006,7 @@ rb_clock_gettime(int argc, VALUE *argv)
* GETTIMEOFDAY_BASED_CLOCK_REALTIME is used for
* CLOCK_REALTIME if clock_gettime is not available.
*/
-#define RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME ID2SYM(id_GETTIMEOFDAY_BASED_CLOCK_REALTIME)
+#define RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME ID2SYM(rb_intern("GETTIMEOFDAY_BASED_CLOCK_REALTIME"))
if (clk_id == RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME) {
struct timeval tv;
ret = gettimeofday(&tv, 0);
@@ -7310,7 +7018,7 @@ rb_clock_gettime(int argc, VALUE *argv)
goto success;
}
-#define RUBY_TIME_BASED_CLOCK_REALTIME ID2SYM(id_TIME_BASED_CLOCK_REALTIME)
+#define RUBY_TIME_BASED_CLOCK_REALTIME ID2SYM(rb_intern("TIME_BASED_CLOCK_REALTIME"))
if (clk_id == RUBY_TIME_BASED_CLOCK_REALTIME) {
time_t t;
t = time(NULL);
@@ -7324,7 +7032,7 @@ rb_clock_gettime(int argc, VALUE *argv)
#ifdef HAVE_TIMES
#define RUBY_TIMES_BASED_CLOCK_MONOTONIC \
- ID2SYM(id_TIMES_BASED_CLOCK_MONOTONIC)
+ ID2SYM(rb_intern("TIMES_BASED_CLOCK_MONOTONIC"))
if (clk_id == RUBY_TIMES_BASED_CLOCK_MONOTONIC) {
struct tms buf;
clock_t c;
@@ -7342,7 +7050,7 @@ rb_clock_gettime(int argc, VALUE *argv)
#ifdef RUSAGE_SELF
#define RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID \
- ID2SYM(id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID)
+ ID2SYM(rb_intern("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID"))
if (clk_id == RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) {
struct rusage usage;
int32_t usec;
@@ -7363,7 +7071,7 @@ rb_clock_gettime(int argc, VALUE *argv)
#ifdef HAVE_TIMES
#define RUBY_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID \
- ID2SYM(id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID)
+ ID2SYM(rb_intern("TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID"))
if (clk_id == RUBY_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID) {
struct tms buf;
unsigned_clock_t utime, stime;
@@ -7383,7 +7091,7 @@ rb_clock_gettime(int argc, VALUE *argv)
#endif
#define RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID \
- ID2SYM(id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID)
+ ID2SYM(rb_intern("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID"))
if (clk_id == RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID) {
clock_t c;
unsigned_clock_t uc;
@@ -7399,7 +7107,7 @@ rb_clock_gettime(int argc, VALUE *argv)
}
#ifdef __APPLE__
-#define RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC ID2SYM(id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC)
+#define RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC ID2SYM(rb_intern("MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC"))
if (clk_id == RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC) {
mach_timebase_info_data_t *info = get_mach_timebase_info();
uint64_t t = mach_absolute_time();
@@ -7427,7 +7135,8 @@ rb_clock_gettime(int argc, VALUE *argv)
#endif
}
/* EINVAL emulates clock_gettime behavior when clock_id is invalid. */
- rb_syserr_fail(EINVAL, 0);
+ errno = EINVAL;
+ rb_sys_fail(0);
success:
return make_clock_result(&tt, numerators, num_numerators, denominators, num_denominators, unit);
@@ -7565,10 +7274,11 @@ rb_clock_getres(int argc, VALUE *argv)
#endif
}
/* EINVAL emulates clock_getres behavior when clock_id is invalid. */
- rb_syserr_fail(EINVAL, 0);
+ errno = EINVAL;
+ rb_sys_fail(0);
success:
- if (unit == ID2SYM(id_hertz)) {
+ if (unit == ID2SYM(rb_intern("hertz"))) {
return timetick2dblnum_reciprocal(&tt, numerators, num_numerators, denominators, num_denominators);
}
else {
@@ -7588,7 +7298,7 @@ VALUE rb_mProcID_Syscall;
*/
void
-InitVM_process(void)
+Init_process(void)
{
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
@@ -7635,11 +7345,6 @@ InitVM_process(void)
rb_define_module_function(rb_mProcess, "waitall", proc_waitall, 0);
rb_define_module_function(rb_mProcess, "detach", proc_detach, 1);
- rb_cWaiter = rb_define_class_under(rb_mProcess, "Waiter", rb_cThread);
- rb_undef_alloc_func(rb_cWaiter);
- rb_undef_method(CLASS_OF(rb_cWaiter), "new");
- rb_define_method(rb_cWaiter, "pid", detach_process_pid, 0);
-
rb_cProcessStatus = rb_define_class_under(rb_mProcess, "Status", rb_cObject);
rb_undef_method(CLASS_OF(rb_cProcessStatus), "new");
@@ -7969,50 +7674,3 @@ InitVM_process(void)
rb_define_module_function(rb_mProcID_Syscall, "setresgid", p_sys_setresgid, 3);
rb_define_module_function(rb_mProcID_Syscall, "issetugid", p_sys_issetugid, 0);
}
-
-void
-Init_process(void)
-{
- id_in = rb_intern("in");
- id_out = rb_intern("out");
- id_err = rb_intern("err");
- id_pid = rb_intern("pid");
- id_uid = rb_intern("uid");
- id_gid = rb_intern("gid");
- id_close = rb_intern("close");
- id_child = rb_intern("child");
-#ifdef HAVE_SETPGID
- id_pgroup = rb_intern("pgroup");
-#endif
-#ifdef _WIN32
- id_new_pgroup = rb_intern("new_pgroup");
-#endif
- id_unsetenv_others = rb_intern("unsetenv_others");
- id_chdir = rb_intern("chdir");
- id_umask = rb_intern("umask");
- id_close_others = rb_intern("close_others");
- id_ENV = rb_intern("ENV");
- id_nanosecond = rb_intern("nanosecond");
- id_microsecond = rb_intern("microsecond");
- id_millisecond = rb_intern("millisecond");
- id_second = rb_intern("second");
- id_float_microsecond = rb_intern("float_microsecond");
- id_float_millisecond = rb_intern("float_millisecond");
- id_float_second = rb_intern("float_second");
- id_GETTIMEOFDAY_BASED_CLOCK_REALTIME = rb_intern("GETTIMEOFDAY_BASED_CLOCK_REALTIME");
- id_TIME_BASED_CLOCK_REALTIME = rb_intern("TIME_BASED_CLOCK_REALTIME");
-#ifdef HAVE_TIMES
- id_TIMES_BASED_CLOCK_MONOTONIC = rb_intern("TIMES_BASED_CLOCK_MONOTONIC");
- id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern("TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID");
-#endif
-#ifdef RUSAGE_SELF
- id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID");
-#endif
- id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID");
-#ifdef __APPLE__
- id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC = rb_intern("MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC");
-#endif
- id_hertz = rb_intern("hertz");
-
- InitVM(process);
-}
diff --git a/random.c b/random.c
index 8e5d1659a8..e77f56eb49 100644
--- a/random.c
+++ b/random.c
@@ -59,6 +59,7 @@ The original copyright notice follows.
email: matumoto@math.keio.ac.jp
*/
+#include "ruby/ruby.h"
#include "internal.h"
#include <limits.h>
@@ -77,22 +78,14 @@ The original copyright notice follows.
#include <sys/time.h>
#endif
-#ifdef HAVE_SYSCALL_H
-#include <syscall.h>
-#elif defined HAVE_SYS_SYSCALL_H
-#include <sys/syscall.h>
-#endif
-
#ifdef _WIN32
# if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0400
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x400
# undef __WINCRYPT_H__
# endif
-#include <windows.h>
#include <wincrypt.h>
#endif
-#include "ruby_atomic.h"
typedef int int_must_be_32bit_at_least[sizeof(int) * CHAR_BIT < 32 ? -1 : 1];
@@ -203,26 +196,16 @@ genrand_int32(struct MT *mt)
}
/* generates a random number on [0,1) with 53-bit resolution*/
-static double int_pair_to_real_exclusive(uint32_t a, uint32_t b);
static double
genrand_real(struct MT *mt)
{
/* mt must be initialized */
- unsigned int a = genrand_int32(mt), b = genrand_int32(mt);
- return int_pair_to_real_exclusive(a, b);
-}
-
-static double
-int_pair_to_real_exclusive(uint32_t a, uint32_t b)
-{
- a >>= 5;
- b >>= 6;
+ unsigned int a = genrand_int32(mt)>>5, b = genrand_int32(mt)>>6;
return(a*67108864.0+b)*(1.0/9007199254740992.0);
}
/* generates a random number on [0,1] with 53-bit resolution*/
static double int_pair_to_real_inclusive(uint32_t a, uint32_t b);
-#if 0
static double
genrand_real2(struct MT *mt)
{
@@ -230,7 +213,6 @@ genrand_real2(struct MT *mt)
uint32_t a = genrand_int32(mt), b = genrand_int32(mt);
return int_pair_to_real_inclusive(a, b);
}
-#endif
/* These real versions are due to Isaku Wada, 2002/01/09 added */
@@ -343,7 +325,7 @@ random_free(void *ptr)
static size_t
random_memsize(const void *ptr)
{
- return sizeof(rb_random_t);
+ return ptr ? sizeof(rb_random_t) : 0;
}
static const rb_data_type_t random_data_type = {
@@ -353,7 +335,7 @@ static const rb_data_type_t random_data_type = {
random_free,
random_memsize,
},
- 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static rb_random_t *
@@ -361,7 +343,7 @@ get_rnd(VALUE obj)
{
rb_random_t *ptr;
TypedData_Get_Struct(obj, rb_random_t, &random_data_type, ptr);
- return rand_start(ptr);
+ return ptr;
}
static rb_random_t *
@@ -371,7 +353,7 @@ try_get_rnd(VALUE obj)
return rand_start(&default_rand);
}
if (!rb_typeddata_is_kind_of(obj, &random_data_type)) return NULL;
- return rand_start(DATA_PTR(obj));
+ return DATA_PTR(obj);
}
/* :nodoc: */
@@ -452,133 +434,54 @@ random_init(int argc, VALUE *argv, VALUE obj)
# define USE_DEV_URANDOM 0
#endif
-#if USE_DEV_URANDOM
-static int
-fill_random_bytes_urandom(void *seed, size_t size)
+static void
+fill_random_seed(uint32_t seed[DEFAULT_SEED_CNT])
{
- /*
- O_NONBLOCK and O_NOCTTY is meaningless if /dev/urandom correctly points
- to a urandom device. But it protects from several strange hazard if
- /dev/urandom is not a urandom device.
- */
- int fd = rb_cloexec_open("/dev/urandom",
-# ifdef O_NONBLOCK
- O_NONBLOCK|
-# endif
-# ifdef O_NOCTTY
- O_NOCTTY|
-# endif
- O_RDONLY, 0);
+ static int n = 0;
+ struct timeval tv;
+#if USE_DEV_URANDOM
+ int fd;
struct stat statbuf;
- ssize_t ret = 0;
-
- if (fd < 0) return -1;
- rb_update_max_fd(fd);
- if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) {
- ret = read(fd, seed, size);
- }
- close(fd);
- if (ret < 0 || (size_t)ret < size) return -1;
- return 0;
-}
-#else
-# define fill_random_bytes_urandom(seed, size) -1
+#elif defined(_WIN32)
+ HCRYPTPROV prov;
#endif
-#if defined(_WIN32)
-static void
-release_crypt(void *p)
-{
- HCRYPTPROV prov = (HCRYPTPROV)ATOMIC_PTR_EXCHANGE(*(HCRYPTPROV *)p, INVALID_HANDLE_VALUE);
- if (prov && prov != (HCRYPTPROV)INVALID_HANDLE_VALUE) {
- CryptReleaseContext(prov, 0);
- }
-}
+ memset(seed, 0, DEFAULT_SEED_LEN);
-static int
-fill_random_bytes_syscall(void *seed, size_t size, int unused)
-{
- static HCRYPTPROV perm_prov;
- HCRYPTPROV prov = perm_prov, old_prov;
- if (!prov) {
- if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
- prov = (HCRYPTPROV)INVALID_HANDLE_VALUE;
- }
- old_prov = (HCRYPTPROV)ATOMIC_PTR_CAS(perm_prov, 0, prov);
- if (LIKELY(!old_prov)) { /* no other threads acquried */
- if (prov != (HCRYPTPROV)INVALID_HANDLE_VALUE) {
- rb_gc_register_mark_object(Data_Wrap_Struct(0, 0, release_crypt, &perm_prov));
- }
- }
- else { /* another thread acquried */
- if (prov != (HCRYPTPROV)INVALID_HANDLE_VALUE) {
- CryptReleaseContext(prov, 0);
+#if USE_DEV_URANDOM
+ if ((fd = rb_cloexec_open("/dev/urandom", O_RDONLY
+#ifdef O_NONBLOCK
+ |O_NONBLOCK
+#endif
+#ifdef O_NOCTTY
+ |O_NOCTTY
+#endif
+ , 0)) >= 0) {
+ rb_update_max_fd(fd);
+ if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) {
+ if (read(fd, seed, DEFAULT_SEED_LEN) < DEFAULT_SEED_LEN) {
+ /* abandon */;
}
- prov = old_prov;
- }
+ }
+ close(fd);
}
- if (prov == (HCRYPTPROV)INVALID_HANDLE_VALUE) return -1;
- CryptGenRandom(prov, size, seed);
- return 0;
-}
-#elif defined __linux__ && defined SYS_getrandom
-#include <linux/random.h>
-
-# ifndef GRND_NONBLOCK
-# define GRND_NONBLOCK 0x0001 /* not defined in musl libc */
-# endif
-
-static int
-fill_random_bytes_syscall(void *seed, size_t size, int need_secure)
-{
- static rb_atomic_t try_syscall = 1;
- if (try_syscall) {
- long ret;
- int flags = 0;
- if (!need_secure)
- flags = GRND_NONBLOCK;
- errno = 0;
- ret = syscall(SYS_getrandom, seed, size, flags);
- if (errno == ENOSYS) {
- ATOMIC_SET(try_syscall, 0);
- return -1;
- }
- if ((size_t)ret == size) return 0;
+#elif defined(_WIN32)
+ if (CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
+ CryptGenRandom(prov, DEFAULT_SEED_LEN, (void *)seed);
+ CryptReleaseContext(prov, 0);
}
- return -1;
-}
-#else
-# define fill_random_bytes_syscall(seed, size, need_secure) -1
#endif
-static int
-fill_random_bytes(void *seed, size_t size, int need_secure)
-{
- int ret = fill_random_bytes_syscall(seed, size, need_secure);
- if (ret == 0) return ret;
- return fill_random_bytes_urandom(seed, size);
-}
-
-static void
-fill_random_seed(uint32_t seed[DEFAULT_SEED_CNT])
-{
- static int n = 0;
- struct timeval tv;
-
- memset(seed, 0, DEFAULT_SEED_LEN);
-
- fill_random_bytes(seed, DEFAULT_SEED_LEN, TRUE);
-
gettimeofday(&tv, 0);
seed[0] ^= tv.tv_usec;
- seed[1] ^= (uint32_t)tv.tv_sec;
+ seed[1] ^= (unsigned int)tv.tv_sec;
#if SIZEOF_TIME_T > SIZEOF_INT
- seed[0] ^= (uint32_t)((time_t)tv.tv_sec >> SIZEOF_INT * CHAR_BIT);
+ seed[0] ^= (unsigned int)((time_t)tv.tv_sec >> SIZEOF_INT * CHAR_BIT);
#endif
seed[2] ^= getpid() ^ (n++ << 16);
- seed[3] ^= (uint32_t)(VALUE)&seed;
+ seed[3] ^= (unsigned int)(VALUE)&seed;
#if SIZEOF_VOIDP > SIZEOF_INT
- seed[2] ^= (uint32_t)((VALUE)&seed >> SIZEOF_INT * CHAR_BIT);
+ seed[2] ^= (unsigned int)((VALUE)&seed >> SIZEOF_INT * CHAR_BIT);
#endif
}
@@ -623,23 +526,6 @@ random_seed(void)
}
/*
- * call-seq: Random.raw_seed(size) -> string
- *
- * Returns a raw seed string, using platform providing features.
- *
- * Random.raw_seed(8) #=> "\x78\x41\xBA\xAF\x7D\xEA\xD8\xEA"
- */
-static VALUE
-random_raw_seed(VALUE self, VALUE size)
-{
- long n = NUM2ULONG(size);
- VALUE buf = rb_str_new(0, n);
- if (n == 0) return buf;
- if (fill_random_bytes(RSTRING_PTR(buf), n, FALSE)) return Qnil;
- return buf;
-}
-
-/*
* call-seq: prng.seed -> integer
*
* Returns the seed value used to initialize the generator. This may be used to
@@ -905,9 +791,10 @@ rb_genrand_ulong_limited(unsigned long limit)
return limited_rand(default_mt(), limit);
}
-static unsigned int
-random_int32(VALUE obj, rb_random_t *rnd)
+unsigned int
+rb_random_int32(VALUE obj)
{
+ rb_random_t *rnd = try_get_rnd(obj);
if (!rnd) {
#if SIZEOF_LONG * CHAR_BIT > 32
VALUE lim = ULONG2NUM(0x100000000UL);
@@ -921,25 +808,6 @@ random_int32(VALUE obj, rb_random_t *rnd)
return genrand_int32(&rnd->mt);
}
-unsigned int
-rb_random_int32(VALUE obj)
-{
- return random_int32(obj, try_get_rnd(obj));
-}
-
-static double
-random_real(VALUE obj, rb_random_t *rnd, int excl)
-{
- uint32_t a = random_int32(obj, rnd);
- uint32_t b = random_int32(obj, rnd);
- if (excl) {
- return int_pair_to_real_exclusive(a, b);
- }
- else {
- return int_pair_to_real_inclusive(a, b);
- }
-}
-
double
rb_random_real(VALUE obj)
{
@@ -971,9 +839,10 @@ ulong_to_num_plus_1(unsigned long n)
#endif
}
-static unsigned long
-random_ulong_limited(VALUE obj, rb_random_t *rnd, unsigned long limit)
+unsigned long
+rb_random_ulong_limited(VALUE obj, unsigned long limit)
{
+ rb_random_t *rnd = try_get_rnd(obj);
if (!rnd) {
extern int rb_num_negative_p(VALUE);
VALUE lim = ulong_to_num_plus_1(limit);
@@ -990,32 +859,6 @@ random_ulong_limited(VALUE obj, rb_random_t *rnd, unsigned long limit)
return limited_rand(&rnd->mt, limit);
}
-static VALUE
-random_ulong_limited_big(VALUE obj, rb_random_t *rnd, VALUE vmax)
-{
- if (!rnd) {
- extern int rb_num_negative_p(VALUE);
- VALUE lim = rb_big_plus(vmax, INT2FIX(1));
- VALUE v = rb_to_int(rb_funcall2(obj, id_rand, 1, &lim));
- if (rb_num_negative_p(v)) {
- rb_raise(rb_eRangeError, "random number too small %"PRIsVALUE, v);
- }
- if (FIX2LONG(rb_big_cmp(vmax, v)) < 0) {
- rb_raise(rb_eRangeError, "random number too big %"PRIsVALUE, v);
- }
- return v;
- }
- return limited_big_rand(&rnd->mt, vmax);
-}
-
-unsigned long
-rb_random_ulong_limited(VALUE obj, unsigned long limit)
-{
- return random_ulong_limited(obj, try_get_rnd(obj), limit);
-}
-
-static VALUE genrand_bytes(rb_random_t *rnd, long n);
-
/*
* call-seq: prng.bytes(size) -> a_string
*
@@ -1027,16 +870,21 @@ static VALUE genrand_bytes(rb_random_t *rnd, long n);
static VALUE
random_bytes(VALUE obj, VALUE len)
{
- return genrand_bytes(get_rnd(obj), NUM2LONG(rb_to_int(len)));
+ return rb_random_bytes(obj, NUM2LONG(rb_to_int(len)));
}
-static VALUE
-genrand_bytes(rb_random_t *rnd, long n)
+VALUE
+rb_random_bytes(VALUE obj, long n)
{
+ rb_random_t *rnd = try_get_rnd(obj);
VALUE bytes;
char *ptr;
unsigned int r, i;
+ if (!rnd) {
+ VALUE len = LONG2NUM(n);
+ return rb_funcall2(obj, id_bytes, 1, &len);
+ }
bytes = rb_str_new(0, n);
ptr = RSTRING_PTR(bytes);
for (; n >= SIZEOF_INT32; n -= SIZEOF_INT32) {
@@ -1057,17 +905,6 @@ genrand_bytes(rb_random_t *rnd, long n)
return bytes;
}
-VALUE
-rb_random_bytes(VALUE obj, long n)
-{
- rb_random_t *rnd = try_get_rnd(obj);
- if (!rnd) {
- VALUE len = LONG2NUM(n);
- return rb_funcall2(obj, id_bytes, 1, &len);
- }
- return genrand_bytes(rnd, n);
-}
-
static VALUE
range_values(VALUE vmax, VALUE *begp, VALUE *endp, int *exclp)
{
@@ -1082,81 +919,55 @@ range_values(VALUE vmax, VALUE *begp, VALUE *endp, int *exclp)
}
static VALUE
-rand_int(VALUE obj, rb_random_t *rnd, VALUE vmax, int restrictive)
+rand_int(struct MT *mt, VALUE vmax, int restrictive)
{
/* mt must be initialized */
+ long max;
unsigned long r;
if (FIXNUM_P(vmax)) {
- long max = FIX2LONG(vmax);
+ max = FIX2LONG(vmax);
if (!max) return Qnil;
if (max < 0) {
if (restrictive) return Qnil;
max = -max;
}
- r = random_ulong_limited(obj, rnd, (unsigned long)max - 1);
+ r = limited_rand(mt, (unsigned long)max - 1);
return ULONG2NUM(r);
}
else {
VALUE ret;
if (rb_bigzero_p(vmax)) return Qnil;
- if (!BIGNUM_SIGN(vmax)) {
+ if (!RBIGNUM_SIGN(vmax)) {
if (restrictive) return Qnil;
vmax = rb_big_uminus(vmax);
}
vmax = rb_big_minus(vmax, INT2FIX(1));
if (FIXNUM_P(vmax)) {
- long max = FIX2LONG(vmax);
+ max = FIX2LONG(vmax);
if (max == -1) return Qnil;
- r = random_ulong_limited(obj, rnd, max);
+ r = limited_rand(mt, max);
return LONG2NUM(r);
}
- ret = random_ulong_limited_big(obj, rnd, vmax);
+ ret = limited_big_rand(mt, vmax);
RB_GC_GUARD(vmax);
return ret;
}
}
-NORETURN(static void domain_error(void));
-static void
-domain_error(void)
-{
- VALUE error = INT2FIX(EDOM);
- rb_exc_raise(rb_class_new_instance(1, &error, rb_eSystemCallError));
-}
-
-NORETURN(static void invalid_argument(VALUE));
-static void
-invalid_argument(VALUE arg0)
-{
- rb_raise(rb_eArgError, "invalid argument - %"PRIsVALUE, arg0);
-}
-
-static VALUE
-check_random_number(VALUE v, const VALUE *argv)
-{
- switch (v) {
- case Qfalse:
- (void)NUM2LONG(argv[0]);
- break;
- case Qnil:
- invalid_argument(argv[0]);
- }
- return v;
-}
-
static inline double
float_value(VALUE v)
{
double x = RFLOAT_VALUE(v);
if (isinf(x) || isnan(x)) {
- domain_error();
+ VALUE error = INT2FIX(EDOM);
+ rb_exc_raise(rb_class_new_instance(1, &error, rb_eSystemCallError));
}
return x;
}
static inline VALUE
-rand_range(VALUE obj, rb_random_t* rnd, VALUE range)
+rand_range(struct MT* mt, VALUE range)
{
VALUE beg = Qundef, end = Qundef, vmax, v;
int excl = 0;
@@ -1170,17 +981,17 @@ rand_range(VALUE obj, rb_random_t* rnd, VALUE range)
if (FIXNUM_P(vmax)) {
fixnum:
if ((max = FIX2LONG(vmax) - excl) >= 0) {
- unsigned long r = random_ulong_limited(obj, rnd, (unsigned long)max);
+ unsigned long r = limited_rand(mt, (unsigned long)max);
v = ULONG2NUM(r);
}
}
- else if (BUILTIN_TYPE(vmax) == T_BIGNUM && BIGNUM_SIGN(vmax) && !rb_bigzero_p(vmax)) {
+ else if (BUILTIN_TYPE(vmax) == T_BIGNUM && RBIGNUM_SIGN(vmax) && !rb_bigzero_p(vmax)) {
vmax = excl ? rb_big_minus(vmax, INT2FIX(1)) : rb_big_norm(vmax);
if (FIXNUM_P(vmax)) {
excl = 0;
goto fixnum;
}
- v = random_ulong_limited_big(obj, rnd, vmax);
+ v = limited_big_rand(mt, vmax);
}
}
else if (v = rb_check_to_float(vmax), !NIL_P(v)) {
@@ -1193,12 +1004,17 @@ rand_range(VALUE obj, rb_random_t* rnd, VALUE range)
mid = max + min;
max -= min;
}
- else if (isnan(max)) {
- domain_error();
+ else {
+ float_value(v);
}
v = Qnil;
if (max > 0.0) {
- r = random_real(obj, rnd, excl);
+ if (excl) {
+ r = genrand_real(mt);
+ }
+ else {
+ r = genrand_real2(mt);
+ }
if (scale > 1) {
return rb_float_new(+(+(+(r - 0.5) * max) * scale) + mid);
}
@@ -1231,7 +1047,7 @@ rand_range(VALUE obj, rb_random_t* rnd, VALUE range)
return v;
}
-static VALUE rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd);
+static VALUE rand_random(int argc, VALUE *argv, rb_random_t *rnd);
/*
* call-seq:
@@ -1265,19 +1081,16 @@ static VALUE rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd);
static VALUE
random_rand(int argc, VALUE *argv, VALUE obj)
{
- VALUE v = rand_random(argc, argv, obj, get_rnd(obj));
- check_random_number(v, argv);
- return v;
+ return rand_random(argc, argv, get_rnd(obj));
}
static VALUE
-rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd)
+rand_random(int argc, VALUE *argv, rb_random_t *rnd)
{
VALUE vmax, v;
- double max = 0.0;
if (argc == 0) {
- goto float_rand;
+ return rb_float_new(genrand_real(&rnd->mt));
}
else {
rb_check_arity(argc, 0, 1);
@@ -1287,41 +1100,28 @@ rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd)
v = Qnil;
}
else if (!RB_TYPE_P(vmax, T_FLOAT) && (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {
- v = rand_int(obj, rnd, v, 1);
+ v = rand_int(&rnd->mt, v, 1);
}
else if (v = rb_check_to_float(vmax), !NIL_P(v)) {
- max = float_value(v);
- if (max < 0.0) {
+ double max = float_value(v);
+ if (max > 0.0)
+ v = rb_float_new(max * genrand_real(&rnd->mt));
+ else
v = Qnil;
- }
- else {
- uint32_t a, b;
- double r;
-
- float_rand:
- a = random_int32(obj, rnd);
- b = random_int32(obj, rnd);
- r = int_pair_to_real_exclusive(a, b);
- if (max > 0.0) r *= max;;
- v = rb_float_new(r);
- }
}
- else if ((v = rand_range(obj, rnd, vmax)) != Qfalse) {
+ else if ((v = rand_range(&rnd->mt, vmax)) != Qfalse) {
/* nothing to do */
}
else {
- return Qfalse;
+ v = Qnil;
+ (void)NUM2LONG(vmax);
+ }
+ if (NIL_P(v)) {
+ VALUE mesg = rb_str_new_cstr("invalid argument - ");
+ rb_str_append(mesg, rb_obj_as_string(argv[0]));
+ rb_exc_raise(rb_exc_new3(rb_eArgError, mesg));
}
- return v;
-}
-static VALUE
-rand_random_number(int argc, VALUE *argv, VALUE obj)
-{
- rb_random_t *rnd = try_get_rnd(obj);
- VALUE v = rand_random(argc, argv, obj, rnd);
- if (NIL_P(v)) v = rand_random(0, 0, obj, rnd);
- else if (!v) invalid_argument(argv[0]);
return v;
}
@@ -1398,18 +1198,18 @@ static VALUE
rb_f_rand(int argc, VALUE *argv, VALUE obj)
{
VALUE v, vmax, r;
- rb_random_t *rnd = rand_start(&default_rand);
+ struct MT *mt = default_mt();
if (argc == 0) goto zero_arg;
rb_scan_args(argc, argv, "01", &vmax);
if (NIL_P(vmax)) goto zero_arg;
- if ((v = rand_range(Qnil, rnd, vmax)) != Qfalse) {
+ if ((v = rand_range(mt, vmax)) != Qfalse) {
return v;
}
vmax = rb_to_int(vmax);
- if (vmax == INT2FIX(0) || NIL_P(r = rand_int(Qnil, rnd, vmax, 0))) {
+ if (vmax == INT2FIX(0) || NIL_P(r = rand_int(mt, vmax, 0))) {
zero_arg:
- return DBL2NUM(genrand_real(&rnd->mt));
+ return DBL2NUM(genrand_real(mt));
}
return r;
}
@@ -1425,9 +1225,7 @@ rb_f_rand(int argc, VALUE *argv, VALUE obj)
static VALUE
random_s_rand(int argc, VALUE *argv, VALUE obj)
{
- VALUE v = rand_random(argc, argv, Qnil, rand_start(&default_rand));
- check_random_number(v, argv);
- return v;
+ return rand_random(argc, argv, rand_start(&default_rand));
}
#define SIP_HASH_STREAMING 0
@@ -1453,9 +1251,26 @@ static union {
uint32_t u32[(16 * sizeof(uint8_t) - 1) / sizeof(uint32_t)];
} sipseed;
-static void
-init_hashseed(struct MT *mt)
+static VALUE
+init_randomseed(struct MT *mt, uint32_t initial[DEFAULT_SEED_CNT])
{
+ VALUE seed;
+ fill_random_seed(initial);
+ init_by_array(mt, initial, DEFAULT_SEED_CNT);
+ seed = make_seed_value(initial);
+ memset(initial, 0, DEFAULT_SEED_LEN);
+ return seed;
+}
+
+void
+Init_RandomSeed(void)
+{
+ rb_random_t *r = &default_rand;
+ uint32_t initial[DEFAULT_SEED_CNT];
+ struct MT *mt = &r->mt;
+ VALUE seed = init_randomseed(mt, initial);
+ int i;
+
hashseed = genrand_int32(mt);
#if SIZEOF_ST_INDEX_T*CHAR_BIT > 4*8
hashseed <<= 32;
@@ -1469,15 +1284,12 @@ init_hashseed(struct MT *mt)
hashseed <<= 32;
hashseed |= genrand_int32(mt);
#endif
-}
-
-static void
-init_siphash(struct MT *mt)
-{
- int i;
for (i = 0; i < numberof(sipseed.u32); ++i)
sipseed.u32[i] = genrand_int32(mt);
+
+ rb_global_variable(&r->seed);
+ r->seed = seed;
}
st_index_t
@@ -1497,55 +1309,14 @@ rb_memhash(const void *ptr, long len)
#endif
}
-/* Initialize Ruby internal seeds. This function is called at very early stage
- * of Ruby startup. Thus, you can't use Ruby's object. */
-void
-Init_RandomSeedCore(void)
-{
- /*
- Don't reuse this MT for Random::DEFAULT. Random::DEFAULT::seed shouldn't
- provide a hint that an attacker guess siphash's seed.
- */
- struct MT mt;
- uint32_t initial_seed[DEFAULT_SEED_CNT];
-
- fill_random_seed(initial_seed);
- init_by_array(&mt, initial_seed, DEFAULT_SEED_CNT);
-
- init_hashseed(&mt);
- init_siphash(&mt);
-
- explicit_bzero(initial_seed, DEFAULT_SEED_LEN);
-}
-
-static VALUE
-init_randomseed(struct MT *mt)
-{
- uint32_t initial[DEFAULT_SEED_CNT];
- VALUE seed;
-
- fill_random_seed(initial);
- init_by_array(mt, initial, DEFAULT_SEED_CNT);
- seed = make_seed_value(initial);
- explicit_bzero(initial, DEFAULT_SEED_LEN);
- return seed;
-}
-
-/* construct Random::DEFAULT bits */
-static VALUE
-Init_Random_default(void)
+static void
+Init_RandomSeed2(void)
{
- rb_random_t *r = &default_rand;
- struct MT *mt = &r->mt;
- VALUE v;
-
- r->seed = init_randomseed(mt);
- rb_global_variable(&r->seed);
-
- v = TypedData_Wrap_Struct(rb_cRandom, &random_data_type, r);
- rb_gc_register_mark_object(v);
+ VALUE seed = default_rand.seed;
- return v;
+ if (RB_TYPE_P(seed, T_BIGNUM)) {
+ rb_obj_reveal(seed, rb_cBignum);
+ }
}
void
@@ -1581,8 +1352,9 @@ rb_reset_random_seed(void)
*/
void
-InitVM_Random(void)
+Init_Random(void)
{
+ Init_RandomSeed2();
rb_define_global_function("srand", rb_f_srand, -1);
rb_define_global_function("rand", rb_f_rand, -1);
@@ -1600,31 +1372,18 @@ InitVM_Random(void)
rb_define_method(rb_cRandom, "==", random_equal, 1);
{
+ VALUE rand_default = TypedData_Wrap_Struct(rb_cRandom, &random_data_type, &default_rand);
+ rb_gc_register_mark_object(rand_default);
/* Direct access to Ruby's Pseudorandom number generator (PRNG). */
- VALUE rand_default = Init_Random_default();
rb_define_const(rb_cRandom, "DEFAULT", rand_default);
}
rb_define_singleton_method(rb_cRandom, "srand", rb_f_srand, -1);
rb_define_singleton_method(rb_cRandom, "rand", random_s_rand, -1);
rb_define_singleton_method(rb_cRandom, "new_seed", random_seed, 0);
- rb_define_singleton_method(rb_cRandom, "raw_seed", random_raw_seed, 1);
rb_define_private_method(CLASS_OF(rb_cRandom), "state", random_s_state, 0);
rb_define_private_method(CLASS_OF(rb_cRandom), "left", random_s_left, 0);
- {
- VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
- rb_include_module(rb_cRandom, m);
- rb_define_method(m, "random_number", rand_random_number, -1);
- }
-}
-
-#undef rb_intern
-void
-Init_Random(void)
-{
id_rand = rb_intern("rand");
id_bytes = rb_intern("bytes");
-
- InitVM(Random);
}
diff --git a/range.c b/range.c
index ab3f1af9e2..ebd0811a98 100644
--- a/range.c
+++ b/range.c
@@ -9,6 +9,8 @@
**********************************************************************/
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "internal.h"
#include "id.h"
@@ -18,11 +20,7 @@
#include <math.h>
VALUE rb_cRange;
-static ID id_beg, id_end, id_excl, id_integer_p, id_div;
-#define id_cmp idCmp
-#define id_succ idSucc
-
-static VALUE r_cover_p(VALUE, VALUE, VALUE, VALUE);
+static ID id_cmp, id_succ, id_beg, id_end, id_excl, id_integer_p, id_div;
#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
#define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
@@ -33,6 +31,13 @@ static VALUE r_cover_p(VALUE, VALUE, VALUE, VALUE);
#define RBOOL(v) ((v) ? Qtrue : Qfalse)
#define EXCL(r) RTEST(RANGE_EXCL(r))
+static inline VALUE
+SET_EXCL(VALUE r, VALUE v)
+{
+ v = RBOOL(RTEST(v));
+ RANGE_SET_EXCL(r, v);
+ return v;
+}
static VALUE
range_failed(void)
@@ -82,7 +87,7 @@ range_modify(VALUE range)
{
/* Ranges are immutable, so that they should be initialized only once. */
if (RANGE_EXCL(range) != Qnil) {
- rb_name_err_raise("`initialize' called twice", range, ID2SYM(idInitialize));
+ rb_name_error(idInitialize, "`initialize' called twice");
}
}
@@ -171,21 +176,35 @@ range_eq(VALUE range, VALUE obj)
return rb_exec_recursive_paired(recursive_equal, range, obj, obj);
}
-/* compares _a_ and _b_ and returns:
- * < 0: a < b
- * = 0: a = b
- * > 0: a > b or non-comparable
- */
static int
-r_less(VALUE a, VALUE b)
+r_lt(VALUE a, VALUE b)
{
VALUE r = rb_funcall(a, id_cmp, 1, b);
if (NIL_P(r))
- return INT_MAX;
- return rb_cmpint(r, a, b);
+ return (int)Qfalse;
+ if (rb_cmpint(r, a, b) < 0)
+ return (int)Qtrue;
+ return (int)Qfalse;
}
+static int
+r_le(VALUE a, VALUE b)
+{
+ int c;
+ VALUE r = rb_funcall(a, id_cmp, 1, b);
+
+ if (NIL_P(r))
+ return (int)Qfalse;
+ c = rb_cmpint(r, a, b);
+ if (c == 0)
+ return (int)INT2FIX(0);
+ if (c < 0)
+ return (int)Qtrue;
+ return (int)Qfalse;
+}
+
+
static VALUE
recursive_eql(VALUE range, VALUE obj, int recur)
{
@@ -224,6 +243,25 @@ range_eql(VALUE range, VALUE obj)
return rb_exec_recursive_paired(recursive_eql, range, obj, obj);
}
+static VALUE
+recursive_hash(VALUE range, VALUE dummy, int recur)
+{
+ st_index_t hash = EXCL(range);
+ VALUE v;
+
+ hash = rb_hash_start(hash);
+ if (!recur) {
+ v = rb_hash(RANGE_BEG(range));
+ hash = rb_hash_uint(hash, NUM2LONG(v));
+ v = rb_hash(RANGE_END(range));
+ hash = rb_hash_uint(hash, NUM2LONG(v));
+ }
+ hash = rb_hash_uint(hash, EXCL(range) << 24);
+ hash = rb_hash_end(hash);
+
+ return LONG2FIX(hash);
+}
+
/*
* call-seq:
* rng.hash -> fixnum
@@ -231,29 +269,16 @@ range_eql(VALUE range, VALUE obj)
* Compute a hash-code for this range. Two ranges with equal
* begin and end points (using <code>eql?</code>), and the same
* #exclude_end? value will generate the same hash-code.
- *
- * See also Object#hash.
*/
static VALUE
range_hash(VALUE range)
{
- st_index_t hash = EXCL(range);
- VALUE v;
-
- hash = rb_hash_start(hash);
- v = rb_hash(RANGE_BEG(range));
- hash = rb_hash_uint(hash, NUM2LONG(v));
- v = rb_hash(RANGE_END(range));
- hash = rb_hash_uint(hash, NUM2LONG(v));
- hash = rb_hash_uint(hash, EXCL(range) << 24);
- hash = rb_hash_end(hash);
-
- return LONG2FIX(hash);
+ return rb_exec_recursive_outer(recursive_hash, range, 0);
}
static void
-range_each_func(VALUE range, rb_block_call_func *func, VALUE arg)
+range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
{
int c;
VALUE b = RANGE_BEG(range);
@@ -261,24 +286,25 @@ range_each_func(VALUE range, rb_block_call_func *func, VALUE arg)
VALUE v = b;
if (EXCL(range)) {
- while (r_less(v, e) < 0) {
- (*func) (v, arg, 0, 0, 0);
- v = rb_funcallv(v, id_succ, 0, 0);
+ while (r_lt(v, e)) {
+ (*func) (v, arg);
+ v = rb_funcall(v, id_succ, 0, 0);
}
}
else {
- while ((c = r_less(v, e)) <= 0) {
- (*func) (v, arg, 0, 0, 0);
- if (!c) break;
- v = rb_funcallv(v, id_succ, 0, 0);
+ while ((c = r_le(v, e)) != Qfalse) {
+ (*func) (v, arg);
+ if (c == (int)INT2FIX(0))
+ break;
+ v = rb_funcall(v, id_succ, 0, 0);
}
}
}
static VALUE
-sym_step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+sym_step_i(VALUE i, void *arg)
{
- VALUE *iter = (VALUE *)arg;
+ VALUE *iter = arg;
if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
@@ -294,9 +320,9 @@ sym_step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
}
static VALUE
-step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+step_i(VALUE i, void *arg)
{
- VALUE *iter = (VALUE *)arg;
+ VALUE *iter = arg;
if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
@@ -318,21 +344,6 @@ discrete_object_p(VALUE obj)
return rb_respond_to(obj, id_succ);
}
-static int
-linear_object_p(VALUE obj)
-{
- if (FIXNUM_P(obj) || FLONUM_P(obj)) return TRUE;
- if (SPECIAL_CONST_P(obj)) return FALSE;
- switch (BUILTIN_TYPE(obj)) {
- case T_FLOAT:
- case T_BIGNUM:
- return TRUE;
- }
- if (rb_obj_is_kind_of(obj, rb_cNumeric)) return TRUE;
- if (rb_obj_is_kind_of(obj, rb_cTime)) return TRUE;
- return FALSE;
-}
-
static VALUE
range_step_size(VALUE range, VALUE args, VALUE eobj)
{
@@ -433,11 +444,11 @@ range_step(int argc, VALUE *argv, VALUE range)
else if (SYMBOL_P(b) && SYMBOL_P(e)) { /* symbols are special */
VALUE args[2], iter[2];
- args[0] = rb_sym2str(e);
+ args[0] = rb_sym_to_s(e);
args[1] = EXCL(range) ? Qtrue : Qfalse;
iter[0] = INT2FIX(1);
iter[1] = step;
- rb_block_call(rb_sym2str(b), rb_intern("upto"), 2, args, sym_step_i, (VALUE)iter);
+ rb_block_call(rb_sym_to_s(b), rb_intern("upto"), 2, args, sym_step_i, (VALUE)iter);
}
else if (ruby_float_step(b, e, step, EXCL(range))) {
/* done */
@@ -477,7 +488,7 @@ range_step(int argc, VALUE *argv, VALUE range)
}
args[0] = INT2FIX(1);
args[1] = step;
- range_each_func(range, step_i, (VALUE)args);
+ range_each_func(range, step_i, args);
}
}
return range;
@@ -536,7 +547,7 @@ is_integer_p(VALUE v)
*
* - the block returns false for any value which is less than x, and
* - the block returns true for any value which is greater than or
- * equal to x.
+ * equal to i.
*
* If x is within the range, this method returns the value x.
* Otherwise, it returns nil.
@@ -574,8 +585,8 @@ is_integer_p(VALUE v)
static VALUE
range_bsearch(VALUE range)
{
- VALUE beg, end, satisfied = Qnil;
- int smaller;
+ VALUE beg, end;
+ int smaller, satisfied = 0;
/* Implementation notes:
* Floats are handled by mapping them to 64 bits integers.
@@ -591,16 +602,15 @@ range_bsearch(VALUE range)
* (-1...0.0).bsearch to yield -0.0.
*/
-#define BSEARCH_CHECK(expr) \
+#define BSEARCH_CHECK(val) \
do { \
- VALUE val = (expr); \
VALUE v = rb_yield(val); \
if (FIXNUM_P(v)) { \
- if (v == INT2FIX(0)) return val; \
- smaller = (SIGNED_VALUE)v < 0; \
+ if (FIX2INT(v) == 0) return val; \
+ smaller = FIX2INT(v) < 0; \
} \
else if (v == Qtrue) { \
- satisfied = val; \
+ satisfied = 1; \
smaller = 1; \
} \
else if (v == Qfalse || v == Qnil) { \
@@ -612,9 +622,9 @@ range_bsearch(VALUE range)
smaller = cmp < 0; \
} \
else { \
- rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE \
- " (must be numeric, true, false or nil)", \
- rb_obj_class(v)); \
+ rb_raise(rb_eTypeError, "wrong argument type %s" \
+ " (must be numeric, true, false or nil)", \
+ rb_obj_classname(v)); \
} \
} while (0)
@@ -638,7 +648,8 @@ range_bsearch(VALUE range)
BSEARCH_CHECK(conv(low)); \
if (!smaller) return Qnil; \
} \
- return satisfied; \
+ if (!satisfied) return Qnil; \
+ return conv(low); \
} while (0)
@@ -681,7 +692,8 @@ range_bsearch(VALUE range)
BSEARCH_CHECK(low);
if (!smaller) return Qnil;
}
- return satisfied;
+ if (!satisfied) return Qnil;
+ return low;
}
else {
rb_raise(rb_eTypeError, "can't do binary search for %s", rb_obj_classname(beg));
@@ -690,14 +702,14 @@ range_bsearch(VALUE range)
}
static VALUE
-each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
+each_i(VALUE v, void *arg)
{
rb_yield(v);
return Qnil;
}
static VALUE
-sym_each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
+sym_each_i(VALUE v, void *arg)
{
rb_yield(rb_str_intern(v));
return Qnil;
@@ -707,12 +719,9 @@ sym_each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
* call-seq:
* rng.size -> num
*
- * Returns the number of elements in the range. Both the begin and the end of
- * the Range must be Numeric, otherwise nil is returned.
+ * Returns the number of elements in the range.
*
* (10..20).size #=> 11
- * ('a'..'z').size #=> nil
- * (-Float::INFINITY..Float::INFINITY).size #=> Infinity
*/
static VALUE
@@ -775,9 +784,9 @@ range_each(VALUE range)
else if (SYMBOL_P(beg) && SYMBOL_P(end)) { /* symbols are special */
VALUE args[2];
- args[0] = rb_sym2str(end);
+ args[0] = rb_sym_to_s(end);
args[1] = EXCL(range) ? Qtrue : Qfalse;
- rb_block_call(rb_sym2str(beg), rb_intern("upto"), 2, args, sym_each_i, 0);
+ rb_block_call(rb_sym_to_s(beg), rb_intern("upto"), 2, args, sym_each_i, 0);
}
else {
VALUE tmp = rb_check_string_type(beg);
@@ -787,14 +796,14 @@ range_each(VALUE range)
args[0] = end;
args[1] = EXCL(range) ? Qtrue : Qfalse;
- rb_block_call(tmp, rb_intern("upto"), 2, args, each_i, 0);
+ rb_block_call(tmp, rb_intern("upto"), 2, args, rb_yield, 0);
}
else {
if (!discrete_object_p(beg)) {
rb_raise(rb_eTypeError, "can't iterate from %s",
rb_obj_classname(beg));
}
- range_each_func(range, each_i, 0);
+ range_each_func(range, each_i, NULL);
}
}
return range;
@@ -835,9 +844,8 @@ range_end(VALUE range)
static VALUE
-first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, cbarg))
+first_i(VALUE i, VALUE *ary)
{
- VALUE *ary = (VALUE *)cbarg;
long n = NUM2LONG(ary[0]);
if (n <= 0) {
@@ -904,10 +912,8 @@ range_last(int argc, VALUE *argv, VALUE range)
/*
* call-seq:
- * rng.min -> obj
- * rng.min {| a,b | block } -> obj
- * rng.min(n) -> array
- * rng.min(n) {| a,b | block } -> array
+ * rng.min -> obj
+ * rng.min {| a,b | block } -> obj
*
* Returns the minimum value in the range. Returns +nil+ if the begin
* value of the range is larger than the end value.
@@ -920,13 +926,10 @@ range_last(int argc, VALUE *argv, VALUE range)
static VALUE
-range_min(int argc, VALUE *argv, VALUE range)
+range_min(VALUE range)
{
if (rb_block_given_p()) {
- return rb_call_super(argc, argv);
- }
- else if (argc != 0) {
- return range_first(argc, argv, range);
+ return rb_call_super(0, 0);
}
else {
VALUE b = RANGE_BEG(range);
@@ -941,10 +944,8 @@ range_min(int argc, VALUE *argv, VALUE range)
/*
* call-seq:
- * rng.max -> obj
- * rng.max {| a,b | block } -> obj
- * rng.max(n) -> obj
- * rng.max(n) {| a,b | block } -> obj
+ * rng.max -> obj
+ * rng.max {| a,b | block } -> obj
*
* Returns the maximum value in the range. Returns +nil+ if the begin
* value of the range larger than the end value.
@@ -956,13 +957,13 @@ range_min(int argc, VALUE *argv, VALUE range)
*/
static VALUE
-range_max(int argc, VALUE *argv, VALUE range)
+range_max(VALUE range)
{
VALUE e = RANGE_END(range);
int nm = FIXNUM_P(e) || rb_obj_is_kind_of(e, rb_cNumeric);
- if (rb_block_given_p() || (EXCL(range) && !nm) || argc) {
- return rb_call_super(argc, argv);
+ if (rb_block_given_p() || (EXCL(range) && !nm)) {
+ return rb_call_super(0, 0);
}
else {
VALUE b = RANGE_BEG(range);
@@ -1073,7 +1074,7 @@ range_to_s(VALUE range)
str = rb_str_dup(str);
rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
rb_str_append(str, str2);
- OBJ_INFECT(str, range);
+ OBJ_INFECT(str, str2);
return str;
}
@@ -1091,7 +1092,7 @@ inspect_range(VALUE range, VALUE dummy, int recur)
str = rb_str_dup(str);
rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
rb_str_append(str, str2);
- OBJ_INFECT(str, range);
+ OBJ_INFECT(str, str2);
return str;
}
@@ -1158,16 +1159,42 @@ range_include(VALUE range, VALUE val)
VALUE beg = RANGE_BEG(range);
VALUE end = RANGE_END(range);
int nv = FIXNUM_P(beg) || FIXNUM_P(end) ||
- linear_object_p(beg) || linear_object_p(end);
+ rb_obj_is_kind_of(beg, rb_cNumeric) ||
+ rb_obj_is_kind_of(end, rb_cNumeric);
if (nv ||
!NIL_P(rb_check_to_integer(beg, "to_int")) ||
!NIL_P(rb_check_to_integer(end, "to_int"))) {
- return r_cover_p(range, beg, end, val);
+ if (r_le(beg, val)) {
+ if (EXCL(range)) {
+ if (r_lt(val, end))
+ return Qtrue;
+ }
+ else {
+ if (r_le(val, end))
+ return Qtrue;
+ }
+ }
+ return Qfalse;
}
- else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING)) {
- VALUE rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive);
- return rb_str_include_range_p(beg, end, val, RANGE_EXCL(range));
+ else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING) &&
+ RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
+ if (NIL_P(val)) return Qfalse;
+ if (RB_TYPE_P(val, T_STRING)) {
+ if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1)
+ return Qfalse;
+ else {
+ char b = RSTRING_PTR(beg)[0];
+ char e = RSTRING_PTR(end)[0];
+ char v = RSTRING_PTR(val)[0];
+
+ if (ISASCII(b) && ISASCII(e) && ISASCII(v)) {
+ if (b <= v && v < e) return Qtrue;
+ if (!EXCL(range) && v == e) return Qtrue;
+ return Qfalse;
+ }
+ }
+ }
}
/* TODO: ruby_frame->this_func = rb_intern("include?"); */
return rb_call_super(1, &val);
@@ -1196,16 +1223,15 @@ range_cover(VALUE range, VALUE val)
beg = RANGE_BEG(range);
end = RANGE_END(range);
- return r_cover_p(range, beg, end, val);
-}
-
-static VALUE
-r_cover_p(VALUE range, VALUE beg, VALUE end, VALUE val)
-{
- if (r_less(beg, val) <= 0) {
- int excl = EXCL(range);
- if (r_less(val, end) <= -excl)
- return Qtrue;
+ if (r_le(beg, val)) {
+ if (EXCL(range)) {
+ if (r_lt(val, end))
+ return Qtrue;
+ }
+ else {
+ if (r_le(val, end))
+ return Qtrue;
+ }
}
return Qfalse;
}
@@ -1309,6 +1335,8 @@ Init_Range(void)
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
+ id_cmp = rb_intern("<=>");
+ id_succ = rb_intern("succ");
id_beg = rb_intern("begin");
id_end = rb_intern("end");
id_excl = rb_intern("excl");
@@ -1334,8 +1362,8 @@ Init_Range(void)
rb_define_method(rb_cRange, "end", range_end, 0);
rb_define_method(rb_cRange, "first", range_first, -1);
rb_define_method(rb_cRange, "last", range_last, -1);
- rb_define_method(rb_cRange, "min", range_min, -1);
- rb_define_method(rb_cRange, "max", range_max, -1);
+ rb_define_method(rb_cRange, "min", range_min, 0);
+ rb_define_method(rb_cRange, "max", range_max, 0);
rb_define_method(rb_cRange, "size", range_size, 0);
rb_define_method(rb_cRange, "to_s", range_to_s, 0);
rb_define_method(rb_cRange, "inspect", range_inspect, 0);
diff --git a/rational.c b/rational.c
index ca65518c82..53bc11c4ef 100644
--- a/rational.c
+++ b/rational.c
@@ -5,6 +5,7 @@
which is written in ruby.
*/
+#include "ruby.h"
#include "internal.h"
#include <math.h>
#include <float.h>
@@ -30,7 +31,7 @@
VALUE rb_cRational;
static ID id_abs, id_cmp, id_convert, id_eqeq_p, id_expt, id_fdiv,
- id_idiv, id_integer_p, id_negate, id_to_f,
+ id_floor, id_idiv, id_integer_p, id_negate, id_to_f,
id_to_i, id_truncate, id_i_num, id_i_den;
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
@@ -91,6 +92,14 @@ f_div(VALUE x, VALUE y)
}
inline static VALUE
+f_gt_p(VALUE x, VALUE y)
+{
+ if (FIXNUM_P(x) && FIXNUM_P(y))
+ return f_boolcast(FIX2LONG(x) > FIX2LONG(y));
+ return rb_funcall(x, '>', 1, y);
+}
+
+inline static VALUE
f_lt_p(VALUE x, VALUE y)
{
if (FIXNUM_P(x) && FIXNUM_P(y))
@@ -133,6 +142,7 @@ f_sub(VALUE x, VALUE y)
}
fun1(abs)
+fun1(floor)
fun1(integer_p)
fun1(negate)
@@ -151,6 +161,8 @@ f_to_f(VALUE x)
return rb_funcall(x, id_to_f, 0);
}
+fun1(truncate)
+
inline static VALUE
f_eqeq_p(VALUE x, VALUE y)
{
@@ -272,7 +284,7 @@ k_rational_p(VALUE x)
VALUE
rb_gcd_gmp(VALUE x, VALUE y)
{
- const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGITS)*CHAR_BIT;
mpz_t mx, my, mz;
size_t count;
VALUE z;
@@ -281,19 +293,14 @@ rb_gcd_gmp(VALUE x, VALUE y)
mpz_init(mx);
mpz_init(my);
mpz_init(mz);
- mpz_import(mx, BIGNUM_LEN(x), -1, sizeof(BDIGIT), 0, nails, BIGNUM_DIGITS(x));
- mpz_import(my, BIGNUM_LEN(y), -1, sizeof(BDIGIT), 0, nails, BIGNUM_DIGITS(y));
+ mpz_import(mx, RBIGNUM_LEN(x), -1, sizeof(BDIGIT), 0, nails, RBIGNUM_DIGITS(x));
+ mpz_import(my, RBIGNUM_LEN(y), -1, sizeof(BDIGIT), 0, nails, RBIGNUM_DIGITS(y));
mpz_gcd(mz, mx, my);
- mpz_clear(mx);
- mpz_clear(my);
-
- zn = (mpz_sizeinbase(mz, 16) + SIZEOF_BDIGIT*2 - 1) / (SIZEOF_BDIGIT*2);
+ zn = (mpz_sizeinbase(mz, 16) + SIZEOF_BDIGITS*2 - 1) / (SIZEOF_BDIGITS*2);
z = rb_big_new(zn, 1);
- mpz_export(BIGNUM_DIGITS(z), &count, -1, sizeof(BDIGIT), 0, nails, mz);
-
- mpz_clear(mz);
+ mpz_export(RBIGNUM_DIGITS(z), &count, -1, sizeof(BDIGIT), 0, nails, mz);
return rb_big_norm(z);
}
@@ -367,8 +374,8 @@ f_gcd(VALUE x, VALUE y)
{
#ifdef USE_GMP
if (RB_TYPE_P(x, T_BIGNUM) && RB_TYPE_P(y, T_BIGNUM)) {
- size_t xn = BIGNUM_LEN(x);
- size_t yn = BIGNUM_LEN(y);
+ long xn = RBIGNUM_LEN(x);
+ long yn = RBIGNUM_LEN(y);
if (GMP_GCD_DIGITS <= xn || GMP_GCD_DIGITS <= yn)
return rb_gcd_gmp(x, y);
}
@@ -408,9 +415,6 @@ f_lcm(VALUE x, VALUE y)
adat = ((struct RRational *)(x));\
bdat = ((struct RRational *)(y))
-#define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
-#define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
-
inline static VALUE
nurat_s_new_internal(VALUE klass, VALUE num, VALUE den)
{
@@ -470,6 +474,14 @@ f_rational_new_bang1(VALUE klass, VALUE x)
return nurat_s_new_internal(klass, x, ONE);
}
+inline static VALUE
+f_rational_new_bang2(VALUE klass, VALUE x, VALUE y)
+{
+ assert(f_positive_p(y));
+ assert(f_nonzero_p(y));
+ return nurat_s_new_internal(klass, x, y);
+}
+
#ifdef CANONICALIZATION_FOR_MATHN
#define CANON
#endif
@@ -568,6 +580,13 @@ nurat_s_new(int argc, VALUE *argv, VALUE klass)
}
inline static VALUE
+f_rational_new1(VALUE klass, VALUE x)
+{
+ assert(!k_rational_p(x));
+ return nurat_s_canonicalize_internal(klass, x, ONE);
+}
+
+inline static VALUE
f_rational_new2(VALUE klass, VALUE x, VALUE y)
{
assert(!k_rational_p(x));
@@ -576,6 +595,13 @@ f_rational_new2(VALUE klass, VALUE x, VALUE y)
}
inline static VALUE
+f_rational_new_no_reduce1(VALUE klass, VALUE x)
+{
+ assert(!k_rational_p(x));
+ return nurat_s_canonicalize_internal_no_reduce(klass, x, ONE);
+}
+
+inline static VALUE
f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
{
assert(!k_rational_p(x));
@@ -591,8 +617,6 @@ f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
*
* Rational(1, 2) #=> (1/2)
* Rational('1/2') #=> (1/2)
- * Rational(nil) #=> TypeError
- * Rational(1, nil) #=> TypeError
*
* Syntax of string form:
*
@@ -744,7 +768,7 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
* Performs addition.
*
* Rational(2, 3) + Rational(2, 3) #=> (4/3)
- * Rational(900) + Rational(1) #=> (901/1)
+ * Rational(900) + Rational(1) #=> (900/1)
* Rational(-2, 9) + Rational(-9, 2) #=> (-85/18)
* Rational(9, 8) + 4 #=> (41/8)
* Rational(20, 9) + 9.8 #=> 12.022222222222222
@@ -1043,14 +1067,6 @@ nurat_expt(VALUE self, VALUE other)
den = ONE;
break;
}
- if (RB_FLOAT_TYPE_P(num)) { /* infinity due to overflow */
- if (RB_FLOAT_TYPE_P(den)) return DBL2NUM(NAN);
- return num;
- }
- if (RB_FLOAT_TYPE_P(den)) { /* infinity due to overflow */
- num = ZERO;
- den = ONE;
- }
return f_rational_new2(CLASS_OF(self), num, den);
}
}
@@ -1790,18 +1806,6 @@ rb_Rational(VALUE x, VALUE y)
return nurat_s_convert(2, a, rb_cRational);
}
-VALUE
-rb_rational_num(VALUE rat)
-{
- return nurat_numerator(rat);
-}
-
-VALUE
-rb_rational_den(VALUE rat)
-{
- return nurat_denominator(rat);
-}
-
#define id_numerator rb_intern("numerator")
#define f_numerator(x) rb_funcall((x), id_numerator, 0)
@@ -2163,14 +2167,13 @@ read_digits(const char **s, int strict,
{
char *b, *bb;
int us = 1, ret = 1;
- VALUE tmp;
if (!isdecimal(**s)) {
*num = ZERO;
return 0;
}
- bb = b = ALLOCV_N(char, tmp, strlen(*s) + 1);
+ bb = b = ALLOCA_N(char, strlen(*s) + 1);
while (isdecimal(**s) || **s == '_') {
if (**s == '_') {
@@ -2197,7 +2200,6 @@ read_digits(const char **s, int strict,
conv:
*b = '\0';
*num = rb_cstr_to_inum(bb, 10, 0);
- ALLOCV_END(tmp);
return ret;
}
@@ -2340,8 +2342,9 @@ string_to_r_strict(VALUE self)
s = (char *)"";
if (!parse_rat(s, 1, &num)) {
- rb_raise(rb_eArgError, "invalid value for convert(): %+"PRIsVALUE,
- self);
+ VALUE ins = f_inspect(self);
+ rb_raise(rb_eArgError, "invalid value for convert(): %s",
+ StringValuePtr(ins));
}
if (RB_TYPE_P(num, T_FLOAT))
@@ -2477,14 +2480,13 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
* a/b (b>0). Where a is numerator and b is denominator. Integer a
* equals rational a/1 mathematically.
*
- * In ruby, you can create rational object with Rational, to_r,
- * rationalize method or suffixing r to a literal. The return values will be irreducible.
+ * In ruby, you can create rational object with Rational, to_r or
+ * rationalize method. The return values will be irreducible.
*
* Rational(1) #=> (1/1)
* Rational(2, 3) #=> (2/3)
* Rational(4, -6) #=> (-2/3)
* 3.to_r #=> (3/1)
- * 2/3r #=> (2/3)
*
* You can also create rational object from floating-point numbers or
* strings.
@@ -2528,6 +2530,7 @@ Init_Rational(void)
id_eqeq_p = rb_intern("==");
id_expt = rb_intern("**");
id_fdiv = rb_intern("fdiv");
+ id_floor = rb_intern("floor");
id_idiv = rb_intern("div");
id_integer_p = rb_intern("integer?");
id_negate = rb_intern("-@");
@@ -2566,6 +2569,10 @@ Init_Rational(void)
rb_define_method(rb_cRational, "==", nurat_eqeq_p, 1);
rb_define_method(rb_cRational, "coerce", nurat_coerce, 1);
+#if 0 /* NUBY */
+ rb_define_method(rb_cRational, "//", nurat_idiv, 1);
+#endif
+
#if 0
rb_define_method(rb_cRational, "quot", nurat_quot, 1);
rb_define_method(rb_cRational, "quotrem", nurat_quotrem, 1);
@@ -2622,8 +2629,6 @@ Init_Rational(void)
rb_define_method(rb_cString, "to_r", string_to_r, 0);
rb_define_private_method(CLASS_OF(rb_cRational), "convert", nurat_s_convert, -1);
-
- rb_provide("rational.so"); /* for backward compatibility */
}
/*
diff --git a/re.c b/re.c
index 500d667592..a7074d8282 100644
--- a/re.c
+++ b/re.c
@@ -9,11 +9,12 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/re.h"
+#include "ruby/encoding.h"
#include "ruby/util.h"
+#include "internal.h"
#include "regint.h"
-#include "encindex.h"
#include <ctype.h>
VALUE rb_eRegexpError;
@@ -222,32 +223,6 @@ rb_memsearch_qs_utf8(const unsigned char *xs, long m, const unsigned char *ys, l
return -1;
}
-static inline long
-rb_memsearch_wchar(const unsigned char *xs, long m, const unsigned char *ys, long n)
-{
- const unsigned char *x = xs, x0 = *xs, *y = ys;
- enum {char_size = 2};
-
- for (n -= m; n >= 0; n -= char_size, y += char_size) {
- if (x0 == *y && memcmp(x+1, y+1, m-1) == 0)
- return y - ys;
- }
- return -1;
-}
-
-static inline long
-rb_memsearch_qchar(const unsigned char *xs, long m, const unsigned char *ys, long n)
-{
- const unsigned char *x = xs, x0 = *xs, *y = ys;
- enum {char_size = 4};
-
- for (n -= m; n >= 0; n -= char_size, y += char_size) {
- if (x0 == *y && memcmp(x+1, y+1, m-1) == 0)
- return y - ys;
- }
- return -1;
-}
-
long
rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
{
@@ -268,21 +243,15 @@ rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
else
return -1;
}
- else if (LIKELY(rb_enc_mbminlen(enc) == 1)) {
- if (m <= SIZEOF_VALUE) {
- return rb_memsearch_ss(x0, m, y0, n);
- }
- else if (enc == rb_utf8_encoding()){
- return rb_memsearch_qs_utf8(x0, m, y0, n);
- }
+ else if (m <= SIZEOF_VALUE) {
+ return rb_memsearch_ss(x0, m, y0, n);
}
- else if (LIKELY(rb_enc_mbminlen(enc) == 2)) {
- return rb_memsearch_wchar(x0, m, y0, n);
+ else if (enc == rb_utf8_encoding()){
+ return rb_memsearch_qs_utf8(x0, m, y0, n);
}
- else if (LIKELY(rb_enc_mbminlen(enc) == 4)) {
- return rb_memsearch_qchar(x0, m, y0, n);
+ else {
+ return rb_memsearch_qs(x0, m, y0, n);
}
- return rb_memsearch_qs(x0, m, y0, n);
}
#define REG_LITERAL FL_USER5
@@ -373,7 +342,8 @@ rb_reg_expr_str(VALUE str, const char *s, long len,
p = s; pend = p + len;
rb_str_coderange_scan_restartable(p, pend, enc, &cr);
- if (rb_enc_asciicompat(enc) && ENC_CODERANGE_CLEAN_P(cr)) {
+ if (rb_enc_asciicompat(enc) &&
+ (cr == ENC_CODERANGE_VALID || cr == ENC_CODERANGE_7BIT)) {
while (p < pend) {
c = rb_enc_ascget(p, pend, &clen, enc);
if (c == -1) {
@@ -660,7 +630,7 @@ rb_reg_to_s(VALUE re)
static void
rb_reg_raise(const char *s, long len, const char *err, VALUE re)
{
- VALUE desc = rb_reg_desc(s, len, re);
+ volatile VALUE desc = rb_reg_desc(s, len, re);
rb_raise(rb_eRegexpError, "%s: %"PRIsVALUE, err, desc);
}
@@ -757,7 +727,7 @@ reg_names_iter(const OnigUChar *name, const OnigUChar *name_end,
int back_num, int *back_refs, OnigRegex regex, void *arg)
{
VALUE ary = (VALUE)arg;
- rb_ary_push(ary, rb_enc_str_new((const char *)name, name_end-name, regex->enc));
+ rb_ary_push(ary, rb_str_new((const char *)name, name_end-name));
return 0;
}
@@ -835,24 +805,24 @@ rb_reg_named_captures(VALUE re)
static int
onig_new_with_source(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
- OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax,
- OnigErrorInfo* einfo, const char *sourcefile, int sourceline)
+ OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax,
+ OnigErrorInfo* einfo, const char *sourcefile, int sourceline)
{
- int r;
+ int r;
- *reg = (regex_t* )malloc(sizeof(regex_t));
- if (IS_NULL(*reg)) return ONIGERR_MEMORY;
+ *reg = (regex_t* )malloc(sizeof(regex_t));
+ if (IS_NULL(*reg)) return ONIGERR_MEMORY;
- r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
- if (r) goto err;
+ r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
+ if (r) goto err;
- r = onig_compile(*reg, pattern, pattern_end, einfo, sourcefile, sourceline);
- if (r) {
- err:
- onig_free(*reg);
- *reg = NULL;
- }
- return r;
+ r = onig_compile(*reg, pattern, pattern_end, einfo, sourcefile, sourceline);
+ if (r) {
+ err:
+ onig_free(*reg);
+ *reg = NULL;
+ }
+ return r;
}
static Regexp*
@@ -902,22 +872,12 @@ match_alloc(VALUE klass)
match->str = 0;
match->rmatch = 0;
match->regexp = 0;
- match->rmatch = ZALLOC(struct rmatch);
+ match->rmatch = ALLOC(struct rmatch);
+ MEMZERO(match->rmatch, struct rmatch, 1);
return (VALUE)match;
}
-int
-rb_reg_region_copy(struct re_registers *to, const struct re_registers *from)
-{
- onig_region_copy(to, (OnigRegion *)from);
- if (to->allocated) return 0;
- rb_gc();
- onig_region_copy(to, (OnigRegion *)from);
- if (to->allocated) return 0;
- return ONIGERR_MEMORY;
-}
-
typedef struct {
long byte_pos;
long char_pos;
@@ -1025,8 +985,7 @@ match_init_copy(VALUE obj, VALUE orig)
RMATCH(obj)->regexp = RMATCH(orig)->regexp;
rm = RMATCH(obj)->rmatch;
- if (rb_reg_region_copy(&rm->regs, RMATCH_REGS(orig)))
- rb_memerror();
+ onig_region_copy(&rm->regs, RMATCH_REGS(orig));
if (!RMATCH(orig)->rmatch->char_offset_updated) {
rm->char_offset_updated = 0;
@@ -1039,7 +998,6 @@ match_init_copy(VALUE obj, VALUE orig)
MEMCPY(rm->char_offset, RMATCH(orig)->rmatch->char_offset,
struct rmatch_offset, rm->regs.num_regs);
rm->char_offset_updated = 1;
- RB_GC_GUARD(orig);
}
return obj;
@@ -1059,15 +1017,8 @@ match_init_copy(VALUE obj, VALUE orig)
static VALUE
match_regexp(VALUE match)
{
- VALUE regexp;
match_check(match);
- regexp = RMATCH(match)->regexp;
- if (NIL_P(regexp)) {
- VALUE str = rb_reg_nth_match(0, match);
- regexp = rb_reg_regcomp(rb_reg_quote(str));
- RMATCH(match)->regexp = regexp;
- }
- return regexp;
+ return RMATCH(match)->regexp;
}
/*
@@ -1088,8 +1039,6 @@ static VALUE
match_names(VALUE match)
{
match_check(match);
- if (NIL_P(RMATCH(match)->regexp))
- return rb_ary_new_capa(0);
return rb_reg_names(RMATCH(match)->regexp);
}
@@ -1127,8 +1076,8 @@ match_backref_number(VALUE match, VALUE backref)
return NUM2INT(backref);
case T_SYMBOL:
- backref = rb_sym2str(backref);
- /* fall through */
+ name = rb_id2name(SYM2ID(backref));
+ break;
case T_STRING:
name = StringValueCStr(backref);
@@ -1267,32 +1216,6 @@ rb_match_busy(VALUE match)
FL_SET(match, MATCH_BUSY);
}
-static void
-match_set_string(VALUE m, VALUE string, long pos, long len)
-{
- struct RMatch *match = (struct RMatch *)m;
- struct rmatch *rmatch = match->rmatch;
-
- match->str = string;
- match->regexp = Qnil;
- onig_region_resize(&rmatch->regs, 1);
- rmatch->regs.beg[0] = pos;
- rmatch->regs.end[0] = pos + len;
- rmatch->char_offset_updated = 0;
- OBJ_INFECT(match, string);
-}
-
-void
-rb_backref_set_string(VALUE string, long pos, long len)
-{
- VALUE match = rb_backref_get();
- if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
- match = match_alloc(rb_cMatch);
- }
- match_set_string(match, string, pos, len);
- rb_backref_set(match);
-}
-
/*
* call-seq:
* rxp.fixed_encoding? -> true or false
@@ -1452,7 +1375,7 @@ rb_reg_adjust_startpos(VALUE re, VALUE str, long pos, int reverse)
/* returns byte offset */
long
-rb_reg_search0(VALUE re, VALUE str, long pos, int reverse, int set_backref_str)
+rb_reg_search(VALUE re, VALUE str, long pos, int reverse)
{
long result;
VALUE match;
@@ -1516,36 +1439,28 @@ rb_reg_search0(VALUE re, VALUE str, long pos, int reverse, int set_backref_str)
}
if (NIL_P(match)) {
- int err;
match = match_alloc(rb_cMatch);
- err = rb_reg_region_copy(RMATCH_REGS(match), regs);
+ onig_region_copy(RMATCH_REGS(match), regs);
onig_region_free(regs, 0);
- if (err) rb_memerror();
}
else {
- FL_UNSET(match, FL_TAINT);
- }
-
- if (set_backref_str) {
- RMATCH(match)->str = rb_str_new4(str);
- OBJ_INFECT(match, str);
+ if (rb_safe_level() >= 3)
+ OBJ_TAINT(match);
+ else
+ FL_UNSET(match, FL_TAINT);
}
+ RMATCH(match)->str = rb_str_new4(str);
RMATCH(match)->regexp = re;
RMATCH(match)->rmatch->char_offset_updated = 0;
rb_backref_set(match);
OBJ_INFECT(match, re);
+ OBJ_INFECT(match, str);
return result;
}
-long
-rb_reg_search(VALUE re, VALUE str, long pos, int reverse)
-{
- return rb_reg_search0(re, str, pos, reverse, 1);
-}
-
VALUE
rb_reg_nth_defined(int nth, VALUE match)
{
@@ -1722,6 +1637,10 @@ match_array(VALUE match, int start)
}
+/* [MG]:FIXME: I put parens around the /.../.match() in the first line of the
+ second example to prevent the '*' followed by a '/' from ending the
+ comment. */
+
/*
* call-seq:
* mtch.to_a -> anArray
@@ -1737,7 +1656,7 @@ match_array(VALUE match, int start)
* accessing the fields directly (as an intermediate array is
* generated).
*
- * all,f1,f2,f3 = * /(.)(.)(\d+)(\d)/.match("THX1138.")
+ * all,f1,f2,f3 = *(/(.)(.)(\d+)(\d)/.match("THX1138."))
* all #=> "HX1138"
* f1 #=> "H"
* f2 #=> "X"
@@ -1772,16 +1691,20 @@ match_captures(VALUE match)
static int
name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end)
{
- return onig_name_to_backref_number(RREGEXP(regexp)->ptr,
+ int num;
+
+ num = onig_name_to_backref_number(RREGEXP(regexp)->ptr,
(const unsigned char* )name, (const unsigned char* )name_end, regs);
-}
+ if (num >= 1) {
+ return num;
+ }
+ else {
+ VALUE s = rb_str_new(name, (long )(name_end - name));
+ rb_raise(rb_eIndexError, "undefined group name reference: %s",
+ StringValuePtr(s));
+ }
-NORETURN(static void name_to_backref_error(VALUE name));
-static void
-name_to_backref_error(VALUE name)
-{
- rb_raise(rb_eIndexError, "undefined group name reference: % "PRIsVALUE,
- name);
+ UNREACHABLE;
}
/*
@@ -1814,7 +1737,7 @@ name_to_backref_error(VALUE name)
static VALUE
match_aref(int argc, VALUE *argv, VALUE match)
{
- VALUE idx, rest, re;
+ VALUE idx, rest;
match_check(match);
rb_scan_args(argc, argv, "11", &idx, &rest);
@@ -1831,17 +1754,17 @@ match_aref(int argc, VALUE *argv, VALUE match)
switch (TYPE(idx)) {
case T_SYMBOL:
- idx = rb_sym2str(idx);
- /* fall through */
+ p = rb_id2name(SYM2ID(idx));
+ goto name_to_backref;
+ break;
case T_STRING:
p = StringValuePtr(idx);
- re = RMATCH(match)->regexp;
- if (NIL_P(re) || !rb_enc_compatible(RREGEXP(re)->src, idx) ||
- (num = name_to_backref_number(RMATCH_REGS(match), RMATCH(match)->regexp,
- p, p + RSTRING_LEN(idx))) < 1) {
- name_to_backref_error(idx);
- }
+
+ name_to_backref:
+ num = name_to_backref_number(RMATCH_REGS(match),
+ RMATCH(match)->regexp, p, p + strlen(p));
return rb_reg_nth_match(num, match);
+ break;
default:
break;
@@ -1966,7 +1889,7 @@ match_inspect_name_iter(const OnigUChar *name, const OnigUChar *name_end,
static VALUE
match_inspect(VALUE match)
{
- VALUE cname = rb_class_path(rb_obj_class(match));
+ const char *cname = rb_obj_classname(match);
VALUE str;
int i;
struct re_registers *regs = RMATCH_REGS(match);
@@ -1975,11 +1898,7 @@ match_inspect(VALUE match)
VALUE regexp = RMATCH(match)->regexp;
if (regexp == 0) {
- return rb_sprintf("#<%"PRIsVALUE":%p>", cname, (void*)match);
- }
- else if (NIL_P(regexp)) {
- return rb_sprintf("#<%"PRIsVALUE": %"PRIsVALUE">",
- cname, rb_reg_nth_match(0, match));
+ return rb_sprintf("#<%s:%p>", cname, (void*)match);
}
names = ALLOCA_N(struct backref_name_tag, num_regs);
@@ -1989,7 +1908,7 @@ match_inspect(VALUE match)
match_inspect_name_iter, names);
str = rb_str_buf_new2("#<");
- rb_str_append(str, cname);
+ rb_str_buf_cat2(str, cname);
for (i = 0; i < num_regs; i++) {
VALUE v;
@@ -2308,8 +2227,8 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc,
case '1': case '2': case '3':
case '4': case '5': case '6': case '7': /* \O, \OO, \OOO or backref */
{
- size_t len = end-(p-1), octlen;
- if (ruby_scan_oct(p-1, len < 3 ? len : 3, &octlen) <= 0177) {
+ size_t octlen;
+ if (ruby_scan_oct(p-1, end-(p-1), &octlen) <= 0177) {
/* backref or 7bit octal.
no need to unescape anyway.
re-escaping may break backref */
@@ -2325,16 +2244,8 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc,
case 'C': /* \C-X, \C-\M-X */
case 'M': /* \M-X, \M-\C-X, \M-\cX */
p = p-2;
- if (enc == rb_usascii_encoding()) {
- const char *pbeg = p;
- c = read_escaped_byte(&p, end, err);
- if (c == (char)-1) return -1;
- rb_str_buf_cat(buf, pbeg, p-pbeg);
- }
- else {
- if (unescape_escaped_nonascii(&p, end, enc, buf, encp, err) != 0)
- return -1;
- }
+ if (unescape_escaped_nonascii(&p, end, enc, buf, encp, err) != 0)
+ return -1;
break;
case 'u':
@@ -2549,7 +2460,8 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc,
options & ARG_REG_OPTION_MASK, err,
sourcefile, sourceline);
if (!re->ptr) return -1;
- RB_OBJ_WRITE(obj, &re->src, rb_fstring(rb_enc_str_new(s, len, enc)));
+ OBJ_WRITE(obj, &re->src, rb_enc_str_new(s, len, enc));
+ OBJ_FREEZE(re->src);
RB_GC_GUARD(unescaped);
return 0;
}
@@ -2583,7 +2495,7 @@ rb_reg_s_alloc(VALUE klass)
NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP | (RGENGC_WB_PROTECTED_REGEXP ? FL_WB_PROTECTED : 0));
re->ptr = 0;
- RB_OBJ_WRITE(re, &re->src, 0);
+ OBJ_WRITE(re, &re->src, 0);
re->usecnt = 0;
return (VALUE)re;
@@ -2658,12 +2570,13 @@ static VALUE reg_cache;
VALUE
rb_reg_regcomp(VALUE str)
{
+ volatile VALUE save_str = str;
if (reg_cache && RREGEXP_SRC_LEN(reg_cache) == RSTRING_LEN(str)
&& ENCODING_GET(reg_cache) == ENCODING_GET(str)
&& memcmp(RREGEXP_SRC_PTR(reg_cache), RSTRING_PTR(str), RSTRING_LEN(str)) == 0)
return reg_cache;
- return reg_cache = rb_reg_new_str(str, 0);
+ return reg_cache = rb_reg_new_str(save_str, 0);
}
static st_index_t reg_hash(VALUE re);
@@ -2672,8 +2585,6 @@ static st_index_t reg_hash(VALUE re);
* rxp.hash -> fixnum
*
* Produce a hash based on the text and options of this regular expression.
- *
- * See also Object#hash.
*/
static VALUE
@@ -2732,8 +2643,6 @@ rb_reg_equal(VALUE re1, VALUE re2)
*
* Produce a hash based on the target string, regexp and matched
* positions of this matchdata.
- *
- * See also Object#hash.
*/
static VALUE
@@ -2742,7 +2651,7 @@ match_hash(VALUE match)
const struct re_registers *regs;
st_index_t hashval = rb_hash_start(rb_str_hash(RMATCH(match)->str));
- rb_hash_uint(hashval, reg_hash(match_regexp(match)));
+ rb_hash_uint(hashval, reg_hash(RMATCH(match)->regexp));
regs = RMATCH_REGS(match);
hashval = rb_hash_uint(hashval, regs->num_regs);
hashval = rb_hash_uint(hashval, rb_memhash(regs->beg, regs->num_regs * sizeof(*regs->beg)));
@@ -2764,11 +2673,10 @@ static VALUE
match_equal(VALUE match1, VALUE match2)
{
const struct re_registers *regs1, *regs2;
-
if (match1 == match2) return Qtrue;
if (!RB_TYPE_P(match2, T_MATCH)) return Qfalse;
if (!rb_str_equal(RMATCH(match1)->str, RMATCH(match2)->str)) return Qfalse;
- if (!rb_reg_equal(match_regexp(match1), match_regexp(match2))) return Qfalse;
+ if (!rb_reg_equal(RMATCH(match1)->regexp, RMATCH(match2)->regexp)) return Qfalse;
regs1 = RMATCH_REGS(match1);
regs2 = RMATCH_REGS(match2);
if (regs1->num_regs != regs2->num_regs) return Qfalse;
@@ -2781,7 +2689,7 @@ static VALUE
reg_operand(VALUE s, int check)
{
if (SYMBOL_P(s)) {
- return rb_sym2str(s);
+ return rb_sym_to_s(s);
}
else {
return (check ? rb_str_to_str : rb_check_string_type)(s);
@@ -2955,16 +2863,12 @@ rb_reg_match2(VALUE re)
* If a block is given, invoke the block with MatchData if match succeed, so
* that you can write
*
- * /M(.*)/.match("Matz") do |m|
- * puts m[0]
- * puts m[1]
- * end
+ * pat.match(str) {|m| ...}
*
* instead of
*
- * if m = /M(.*)/.match("Matz")
- * puts m[0]
- * puts m[1]
+ * if m = pat.match(str)
+ * ...
* end
*
* The return value is a value from block execution in this case.
@@ -2999,15 +2903,16 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re)
/*
* Document-method: compile
*
- * Alias for <code>Regexp.new</code>
+ * Synonym for <code>Regexp.new</code>
*/
+
/*
* call-seq:
- * Regexp.new(string, [options]) -> regexp
- * Regexp.new(regexp) -> regexp
- * Regexp.compile(string, [options) -> regexp
- * Regexp.compile(regexp) -> regexp
+ * Regexp.new(string, [options [, kcode]]) -> regexp
+ * Regexp.new(regexp) -> regexp
+ * Regexp.compile(string, [options [, kcode]]) -> regexp
+ * Regexp.compile(regexp) -> regexp
*
* Constructs a new regular expression from +pattern+, which can be either a
* String or a Regexp (in which case that regexp's options are propagated),
@@ -3018,6 +2923,9 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re)
* <em>or</em>-ed together. Otherwise, if +options+ is not
* +nil+ or +false+, the regexp will be case insensitive.
*
+ * When the +kcode+ parameter is `n' or `N' sets the regexp no encoding.
+ * It means that the regexp is for binary strings.
+ *
* r1 = Regexp.new('^a-z+:\\s+\w+') #=> /^a-z+:\s+\w+/
* r2 = Regexp.new('cat', true) #=> /cat/i
* r3 = Regexp.new(r2) #=> /cat/i
@@ -3447,7 +3355,7 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
switch (c) {
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- if (!NIL_P(regexp) && onig_noname_group_capture_is_active(RREGEXP(regexp)->ptr)) {
+ if (onig_noname_group_capture_is_active(RREGEXP(regexp)->ptr)) {
no = c - '0';
}
else {
@@ -3466,13 +3374,7 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
name_end += c == -1 ? mbclen(name_end, e, str_enc) : clen;
}
if (name_end < e) {
- VALUE n = rb_str_subseq(str, (long)(name - RSTRING_PTR(str)),
- (long)(name_end - name));
- if (NIL_P(regexp) ||
- !rb_enc_compatible(RREGEXP(regexp)->src, n) ||
- (no = name_to_backref_number(regs, regexp, name, name_end)) < 1) {
- name_to_backref_error(n);
- }
+ no = name_to_backref_number(regs, regexp, name, name_end);
p = s = name_end + clen;
break;
}
diff --git a/regcomp.c b/regcomp.c
index c2595cbba9..705e0faad7 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2,8 +2,8 @@
regcomp.c - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,15 +30,6 @@
#include "regparse.h"
-#if defined(USE_MULTI_THREAD_SYSTEM) \
- && defined(USE_DEFAULT_MULTI_THREAD_SYSTEM)
-#ifdef _WIN32
-CRITICAL_SECTION gOnigMutex;
-#else
-pthread_mutex_t gOnigMutex;
-#endif
-#endif
-
OnigCaseFoldType OnigDefaultCaseFoldFlag = ONIGENC_CASE_FOLD_MIN;
extern OnigCaseFoldType
@@ -330,10 +321,9 @@ static int compile_tree(Node* node, regex_t* reg);
(op) == OP_EXACTMB3N || (op) == OP_EXACTMBN || (op) == OP_EXACTN_IC)
static int
-select_str_opcode(int mb_len, OnigDistance byte_len, int ignore_case)
+select_str_opcode(int mb_len, OnigDistance str_len, int ignore_case)
{
int op;
- OnigDistance str_len = (byte_len + mb_len - 1) / mb_len;
if (ignore_case) {
switch (str_len) {
@@ -435,11 +425,11 @@ compile_tree_n_times(Node* node, int n, regex_t* reg)
}
static int
-add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, OnigDistance byte_len,
+add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, OnigDistance str_len,
regex_t* reg ARG_UNUSED, int ignore_case)
{
int len;
- int op = select_str_opcode(mb_len, byte_len, ignore_case);
+ int op = select_str_opcode(mb_len, str_len, ignore_case);
len = SIZE_OPCODE;
@@ -447,15 +437,15 @@ add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, OnigDistance byte_len
if (IS_NEED_STR_LEN_OP_EXACT(op))
len += SIZE_LENGTH;
- len += (int )byte_len;
+ len += mb_len * (int )str_len;
return len;
}
static int
-add_compile_string(UChar* s, int mb_len, OnigDistance byte_len,
+add_compile_string(UChar* s, int mb_len, OnigDistance str_len,
regex_t* reg, int ignore_case)
{
- int op = select_str_opcode(mb_len, byte_len, ignore_case);
+ int op = select_str_opcode(mb_len, str_len, ignore_case);
add_opcode(reg, op);
if (op == OP_EXACTMBN)
@@ -463,12 +453,12 @@ add_compile_string(UChar* s, int mb_len, OnigDistance byte_len,
if (IS_NEED_STR_LEN_OP_EXACT(op)) {
if (op == OP_EXACTN_IC)
- add_length(reg, byte_len);
+ add_length(reg, mb_len * str_len);
else
- add_length(reg, byte_len / mb_len);
+ add_length(reg, str_len);
}
- add_bytes(reg, s, byte_len);
+ add_bytes(reg, s, mb_len * str_len);
return 0;
}
@@ -476,7 +466,7 @@ add_compile_string(UChar* s, int mb_len, OnigDistance byte_len,
static int
compile_length_string_node(Node* node, regex_t* reg)
{
- int rlen, r, len, prev_len, blen, ambig;
+ int rlen, r, len, prev_len, slen, ambig;
OnigEncoding enc = reg->enc;
UChar *p, *prev;
StrNode* sn;
@@ -490,24 +480,24 @@ compile_length_string_node(Node* node, regex_t* reg)
p = prev = sn->s;
prev_len = enclen(enc, p, sn->end);
p += prev_len;
- blen = prev_len;
+ slen = 1;
rlen = 0;
for (; p < sn->end; ) {
len = enclen(enc, p, sn->end);
- if (len == prev_len || ambig) {
- blen += len;
+ if (len == prev_len) {
+ slen++;
}
else {
- r = add_compile_string_length(prev, prev_len, blen, reg, ambig);
+ r = add_compile_string_length(prev, prev_len, slen, reg, ambig);
rlen += r;
prev = p;
- blen = len;
+ slen = 1;
prev_len = len;
}
p += len;
}
- r = add_compile_string_length(prev, prev_len, blen, reg, ambig);
+ r = add_compile_string_length(prev, prev_len, slen, reg, ambig);
rlen += r;
return rlen;
}
@@ -524,7 +514,7 @@ compile_length_string_raw_node(StrNode* sn, regex_t* reg)
static int
compile_string_node(Node* node, regex_t* reg)
{
- int r, len, prev_len, blen, ambig;
+ int r, len, prev_len, slen, ambig;
OnigEncoding enc = reg->enc;
UChar *p, *prev, *end;
StrNode* sn;
@@ -539,25 +529,25 @@ compile_string_node(Node* node, regex_t* reg)
p = prev = sn->s;
prev_len = enclen(enc, p, end);
p += prev_len;
- blen = prev_len;
+ slen = 1;
for (; p < end; ) {
len = enclen(enc, p, end);
- if (len == prev_len || ambig) {
- blen += len;
+ if (len == prev_len) {
+ slen++;
}
else {
- r = add_compile_string(prev, prev_len, blen, reg, ambig);
+ r = add_compile_string(prev, prev_len, slen, reg, ambig);
if (r) return r;
prev = p;
- blen = len;
+ slen = 1;
prev_len = len;
}
p += len;
}
- return add_compile_string(prev, prev_len, blen, reg, ambig);
+ return add_compile_string(prev, prev_len, slen, reg, ambig);
}
static int
@@ -1592,15 +1582,13 @@ compile_length_tree(Node* node, regex_t* reg)
case NT_ALT:
{
- int n = 0;
- len = 0;
+ int n;
+
+ n = r = 0;
do {
- r = compile_length_tree(NCAR(node), reg);
- if (r < 0) return r;
- len += r;
- n++;
+ r += compile_length_tree(NCAR(node), reg);
+ n++;
} while (IS_NOT_NULL(node = NCDR(node)));
- r = len;
r += (SIZE_OP_PUSH + SIZE_OP_JUMP) * (n - 1);
}
break;
@@ -1876,16 +1864,17 @@ noname_disable_map(Node** plink, GroupNumRemap* map, int* counter)
(*counter)++;
map[en->regnum].new_val = *counter;
en->regnum = *counter;
+ r = noname_disable_map(&(en->target), map, counter);
}
- else if (en->regnum != 0) {
+ else {
*plink = en->target;
en->target = NULL_NODE;
onig_node_free(node);
r = noname_disable_map(plink, map, counter);
- break;
}
}
- r = noname_disable_map(&(en->target), map, counter);
+ else
+ r = noname_disable_map(&(en->target), map, counter);
}
break;
@@ -2593,7 +2582,6 @@ is_not_included(Node* x, Node* y, regex_t* reg)
return 0;
}
else {
- if (IS_NOT_NULL(xc->mbuf)) return 0;
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
int is_word;
if (NCTYPE(y)->ascii_range)
@@ -2681,22 +2669,22 @@ is_not_included(Node* x, Node* y, regex_t* reg)
break;
case NT_CCLASS:
- {
- CClassNode* cc = NCCLASS(y);
+ {
+ CClassNode* cc = NCCLASS(y);
- code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s,
- xs->s + ONIGENC_MBC_MAXLEN(reg->enc));
- return (onig_is_code_in_cc(reg->enc, code, cc) != 0 ? 0 : 1);
- }
- break;
+ code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s,
+ xs->s + ONIGENC_MBC_MAXLEN(reg->enc));
+ return (onig_is_code_in_cc(reg->enc, code, cc) != 0 ? 0 : 1);
+ }
+ break;
case NT_STR:
- {
- UChar *q;
- StrNode* ys = NSTR(y);
- len = NSTRING_LEN(x);
- if (len > NSTRING_LEN(y)) len = NSTRING_LEN(y);
- if (NSTRING_IS_AMBIG(x) || NSTRING_IS_AMBIG(y)) {
+ {
+ UChar *q;
+ StrNode* ys = NSTR(y);
+ len = NSTRING_LEN(x);
+ if (len > NSTRING_LEN(y)) len = NSTRING_LEN(y);
+ if (NSTRING_IS_AMBIG(x) || NSTRING_IS_AMBIG(y)) {
/* tiny version */
return 0;
}
@@ -2709,7 +2697,7 @@ is_not_included(Node* x, Node* y, regex_t* reg)
break;
default:
- break;
+ break;
}
}
break;
@@ -3314,7 +3302,7 @@ next_setup(Node* node, Node* next_node, int in_root, regex_t* reg)
qn->next_head_exact = n;
}
#endif
- /* automatic possessification a*b ==> (?>a*)b */
+ /* automatic possessivation a*b ==> (?>a*)b */
if (qn->lower <= 1) {
int ttype = NTYPE(qn->target);
if (IS_NODE_TYPE_SIMPLE(ttype)) {
@@ -3436,39 +3424,26 @@ expand_case_fold_make_rem_string(Node** rnode, UChar *s, UChar *end,
}
static int
-is_case_fold_variable_len(int item_num, OnigCaseFoldCodeItem items[],
- int slen)
-{
- int i;
-
- for (i = 0; i < item_num; i++) {
- if (items[i].byte_len != slen) {
- return 1;
- }
- if (items[i].code_len != 1) {
- return 1;
- }
- }
- return 0;
-}
-
-static int
expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[],
UChar *p, int slen, UChar *end,
regex_t* reg, Node **rnode)
{
- int r, i, j, len, varlen;
+ int r, i, j, len, varlen, varclen;
Node *anode, *var_anode, *snode, *xnode, *an;
UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN];
*rnode = var_anode = NULL_NODE;
varlen = 0;
+ varclen = 0;
for (i = 0; i < item_num; i++) {
if (items[i].byte_len != slen) {
varlen = 1;
break;
}
+ if (items[i].code_len != 1) {
+ varclen = 1;
+ }
}
if (varlen != 0) {
@@ -3518,29 +3493,29 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[],
UChar *q = p + items[i].byte_len;
if (q < end) {
- r = expand_case_fold_make_rem_string(&rem, q, end, reg);
- if (r != 0) {
- onig_node_free(an);
- goto mem_err2;
- }
+ r = expand_case_fold_make_rem_string(&rem, q, end, reg);
+ if (r != 0) {
+ onig_node_free(an);
+ goto mem_err2;
+ }
- xnode = onig_node_list_add(NULL_NODE, snode);
- if (IS_NULL(xnode)) {
- onig_node_free(an);
- onig_node_free(rem);
- goto mem_err2;
- }
- if (IS_NULL(onig_node_list_add(xnode, rem))) {
- onig_node_free(an);
- onig_node_free(xnode);
- onig_node_free(rem);
- goto mem_err;
- }
+ xnode = onig_node_list_add(NULL_NODE, snode);
+ if (IS_NULL(xnode)) {
+ onig_node_free(an);
+ onig_node_free(rem);
+ goto mem_err2;
+ }
+ if (IS_NULL(onig_node_list_add(xnode, rem))) {
+ onig_node_free(an);
+ onig_node_free(xnode);
+ onig_node_free(rem);
+ goto mem_err;
+ }
- NCAR(an) = xnode;
+ NCAR(an) = xnode;
}
else {
- NCAR(an) = snode;
+ NCAR(an) = snode;
}
NCDR(var_anode) = an;
@@ -3553,6 +3528,8 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[],
}
}
+ if (varclen && !varlen)
+ return 2;
return varlen;
mem_err2:
@@ -3596,8 +3573,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
len = enclen(reg->enc, p, end);
- varlen = is_case_fold_variable_len(n, items, len);
- if (n == 0 || varlen == 0) {
+ if (n == 0) {
if (IS_NULL(snode)) {
if (IS_NULL(root) && IS_NOT_NULL(prev_node)) {
top_root = root = onig_node_list_add(NULL_NODE, prev_node);
@@ -3624,12 +3600,6 @@ expand_case_fold_string(Node* node, regex_t* reg)
alt_num *= (n + 1);
if (alt_num > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) break;
- if (IS_NOT_NULL(snode)) {
- r = update_string_node_case_fold(reg, snode);
- if (r == 0) {
- NSTRING_SET_AMBIG(snode);
- }
- }
if (IS_NULL(root) && IS_NOT_NULL(prev_node)) {
top_root = root = onig_node_list_add(NULL_NODE, prev_node);
if (IS_NULL(root)) {
@@ -3640,6 +3610,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
r = expand_case_fold_string_alt(n, items, p, len, end, reg, &prev_node);
if (r < 0) goto mem_err;
+ if (r > 0) varlen = 1;
if (r == 1) {
if (IS_NULL(root)) {
top_root = prev_node;
@@ -3653,7 +3624,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
root = NCAR(prev_node);
}
- else { /* r == 0 */
+ else { /* r == 0 || r == 2 */
if (IS_NOT_NULL(root)) {
if (IS_NULL(onig_node_list_add(root, prev_node))) {
onig_node_free(prev_node);
@@ -3667,12 +3638,6 @@ expand_case_fold_string(Node* node, regex_t* reg)
p += len;
}
- if (IS_NOT_NULL(snode)) {
- r = update_string_node_case_fold(reg, snode);
- if (r == 0) {
- NSTRING_SET_AMBIG(snode);
- }
- }
if (p < end) {
Node *srem;
@@ -3702,9 +3667,20 @@ expand_case_fold_string(Node* node, regex_t* reg)
/* ending */
top_root = (IS_NOT_NULL(top_root) ? top_root : prev_node);
- swap_node(node, top_root);
+ if (!varlen) {
+ /* When all expanded strings are same length, case-insensitive
+ BM search will be used. */
+ r = update_string_node_case_fold(reg, node);
+ if (r == 0) {
+ NSTRING_SET_AMBIG(node);
+ }
+ }
+ else {
+ swap_node(node, top_root);
+ r = 0;
+ }
onig_node_free(top_root);
- return 0;
+ return r;
mem_err:
r = ONIGERR_MEMORY;
@@ -4192,8 +4168,6 @@ set_bm_skip(UChar* s, UChar* end, regex_t* reg,
n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
p, end, items);
clen = enclen(enc, p, end);
- if (p + clen > end)
- clen = (int )(end - p);
for (j = 0; j < n; j++) {
if ((items[j].code_len != 1) || (items[j].byte_len != clen))
@@ -4224,8 +4198,6 @@ set_bm_skip(UChar* s, UChar* end, regex_t* reg,
n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
p, end, items);
clen = enclen(enc, p, end);
- if (p + clen > end)
- clen = (int )(end - p);
for (j = 0; j < n; j++) {
if ((items[j].code_len != 1) || (items[j].byte_len != clen))
@@ -4269,8 +4241,6 @@ set_bm_skip(UChar* s, UChar* end, regex_t* reg,
n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
p, end, items);
clen = enclen(enc, p, end);
- if (p + clen > end)
- clen = (int )(end - p);
for (j = 0; j < n; j++) {
if ((items[j].code_len != 1) || (items[j].byte_len != clen))
@@ -4301,8 +4271,6 @@ set_bm_skip(UChar* s, UChar* end, regex_t* reg,
n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag,
p, end, items);
clen = enclen(enc, p, end);
- if (p + clen > end)
- clen = (int )(end - p);
for (j = 0; j < n; j++) {
if ((items[j].code_len != 1) || (items[j].byte_len != clen))
@@ -4387,7 +4355,7 @@ map_position_value(OnigEncoding enc, int i)
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 1
};
- if (i < numberof(ByteValTable)) {
+ if (i < (int )(sizeof(ByteValTable)/sizeof(ByteValTable[0]))) {
if (i == 0 && ONIGENC_MBC_MINLEN(enc) > 1)
return 20;
else
@@ -4419,7 +4387,7 @@ distance_value(MinMaxLen* mm)
if (mm->max == ONIG_INFINITE_DISTANCE) return 0;
d = mm->max - mm->min;
- if (d < numberof(dist_vals))
+ if (d < sizeof(dist_vals)/sizeof(dist_vals[0]))
/* return dist_vals[d] * 16 / (mm->min + 12); */
return (int )dist_vals[d];
else
@@ -4527,9 +4495,6 @@ concat_opt_anc_info(OptAncInfo* to, OptAncInfo* left, OptAncInfo* right,
if (right_len == 0) {
to->right_anchor |= left->right_anchor;
}
- else {
- to->right_anchor |= (left->right_anchor & ANCHOR_PREC_READ_NOT);
- }
}
static int
@@ -5103,8 +5068,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
case ANCHOR_END_BUF:
case ANCHOR_SEMI_END_BUF:
case ANCHOR_END_LINE:
- case ANCHOR_LOOK_BEHIND: /* just for (?<=x).* */
- case ANCHOR_PREC_READ_NOT: /* just for (?!x).* */
+ case ANCHOR_LOOK_BEHIND: /* just for (?<=x).* */
add_opt_anc_info(&opt->anc, NANCHOR(node)->type);
break;
@@ -5127,6 +5091,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
}
break;
+ case ANCHOR_PREC_READ_NOT:
case ANCHOR_LOOK_BEHIND_NOT:
break;
}
@@ -5392,8 +5357,7 @@ set_optimize_info_from_tree(Node* node, regex_t* reg, ScanEnv* scan_env)
ANCHOR_BEGIN_POSITION | ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML |
ANCHOR_LOOK_BEHIND);
- reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF |
- ANCHOR_PREC_READ_NOT);
+ reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF);
if (reg->anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)) {
reg->anchor_dmin = opt.len.min;
@@ -5484,14 +5448,14 @@ print_distance_range(FILE* f, OnigDistance a, OnigDistance b)
if (a == ONIG_INFINITE_DISTANCE)
fputs("inf", f);
else
- fprintf(f, "(%"PRIuPTR")", a);
+ fprintf(f, "(%"PRIuSIZE")", a);
fputs("-", f);
if (b == ONIG_INFINITE_DISTANCE)
fputs("inf", f);
else
- fprintf(f, "(%"PRIuPTR")", b);
+ fprintf(f, "(%"PRIuSIZE")", b);
}
static void
@@ -5568,7 +5532,7 @@ print_optimize_info(FILE* f, regex_t* reg)
for (p = reg->exact; p < reg->exact_end; p++) {
fputc(*p, f);
}
- fprintf(f, "]: length: %"PRIdPTR"\n", (reg->exact_end - reg->exact));
+ fprintf(f, "]: length: %ld\n", (reg->exact_end - reg->exact));
}
else if (reg->optimize & ONIG_OPTIMIZE_MAP) {
int c, i, n = 0;
@@ -6032,44 +5996,11 @@ onig_init(void)
}
-static OnigEndCallListItemType* EndCallTop;
-
-extern void onig_add_end_call(void (*func)(void))
-{
- OnigEndCallListItemType* item;
-
- item = (OnigEndCallListItemType* )xmalloc(sizeof(*item));
- if (item == 0) return ;
-
- item->next = EndCallTop;
- item->func = func;
-
- EndCallTop = item;
-}
-
-static void
-exec_end_call_list(void)
-{
- OnigEndCallListItemType* prev;
- void (*func)(void);
-
- while (EndCallTop != 0) {
- func = EndCallTop->func;
- (*func)();
-
- prev = EndCallTop;
- EndCallTop = EndCallTop->next;
- xfree(prev);
- }
-}
-
extern int
onig_end(void)
{
THREAD_ATOMIC_START;
- exec_end_call_list();
-
#ifdef ONIG_DEBUG_STATISTICS
if (!onig_is_prelude()) onig_print_statistics(stderr);
#endif
@@ -6463,7 +6394,7 @@ onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar* bpend, UChar** nextp,
GET_POINTER_INC(cc, bp);
n = bitset_on_num(cc->bs);
- fprintf(f, ":%"PRIuPTR":%d", (uintptr_t )cc, n);
+ fprintf(f, ":%"PRIuPTR":%d", (uintptr_t)cc, n);
}
break;
@@ -6599,9 +6530,9 @@ print_indent_tree(FILE* f, Node* node, int indent)
case NT_LIST:
case NT_ALT:
if (NTYPE(node) == NT_LIST)
- fprintf(f, "<list:%"PRIxPTR">\n", (intptr_t )node);
+ fprintf(f, "<list:%"PRIxPTR">\n", (intptr_t)node);
else
- fprintf(f, "<alt:%"PRIxPTR">\n", (intptr_t )node);
+ fprintf(f, "<alt:%"PRIxPTR">\n", (intptr_t)node);
print_indent_tree(f, NCAR(node), indent + add);
while (IS_NOT_NULL(node = NCDR(node))) {
@@ -6615,7 +6546,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
case NT_STR:
fprintf(f, "<string%s:%"PRIxPTR">",
- (NSTRING_IS_RAW(node) ? "-raw" : ""), (intptr_t )node);
+ (NSTRING_IS_RAW(node) ? "-raw" : ""), (intptr_t)node);
for (p = NSTR(node)->s; p < NSTR(node)->end; p++) {
if (*p >= 0x20 && *p < 0x7f)
fputc(*p, f);
@@ -6626,7 +6557,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
break;
case NT_CCLASS:
- fprintf(f, "<cclass:%"PRIxPTR">", (intptr_t )node);
+ fprintf(f, "<cclass:%"PRIxPTR">", (intptr_t)node);
if (IS_NCCLASS_NOT(NCCLASS(node))) fputs(" not", f);
if (NCCLASS(node)->mbuf) {
BBuf* bbuf = NCCLASS(node)->mbuf;
@@ -6638,7 +6569,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
break;
case NT_CTYPE:
- fprintf(f, "<ctype:%"PRIxPTR"> ", (intptr_t )node);
+ fprintf(f, "<ctype:%"PRIxPTR"> ", (intptr_t)node);
switch (NCTYPE(node)->ctype) {
case ONIGENC_CTYPE_WORD:
if (NCTYPE(node)->not != 0)
@@ -6654,11 +6585,11 @@ print_indent_tree(FILE* f, Node* node, int indent)
break;
case NT_CANY:
- fprintf(f, "<anychar:%"PRIxPTR">", (intptr_t )node);
+ fprintf(f, "<anychar:%"PRIxPTR">", (intptr_t)node);
break;
case NT_ANCHOR:
- fprintf(f, "<anchor:%"PRIxPTR"> ", (intptr_t )node);
+ fprintf(f, "<anchor:%"PRIxPTR"> ", (intptr_t)node);
switch (NANCHOR(node)->type) {
case ANCHOR_BEGIN_BUF: fputs("begin buf", f); break;
case ANCHOR_END_BUF: fputs("end buf", f); break;
@@ -6691,7 +6622,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
int* p;
BRefNode* br = NBREF(node);
p = BACKREFS_P(br);
- fprintf(f, "<backref:%"PRIxPTR">", (intptr_t )node);
+ fprintf(f, "<backref:%"PRIxPTR">", (intptr_t)node);
for (i = 0; i < br->back_num; i++) {
if (i > 0) fputs(", ", f);
fprintf(f, "%d", p[i]);
@@ -6703,21 +6634,21 @@ print_indent_tree(FILE* f, Node* node, int indent)
case NT_CALL:
{
CallNode* cn = NCALL(node);
- fprintf(f, "<call:%"PRIxPTR">", (intptr_t )node);
+ fprintf(f, "<call:%"PRIxPTR">", (intptr_t)node);
p_string(f, cn->name_end - cn->name, cn->name);
}
break;
#endif
case NT_QTFR:
- fprintf(f, "<quantifier:%"PRIxPTR">{%d,%d}%s\n", (intptr_t )node,
+ fprintf(f, "<quantifier:%"PRIxPTR">{%d,%d}%s\n", (intptr_t)node,
NQTFR(node)->lower, NQTFR(node)->upper,
(NQTFR(node)->greedy ? "" : "?"));
print_indent_tree(f, NQTFR(node)->target, indent + add);
break;
case NT_ENCLOSE:
- fprintf(f, "<enclose:%"PRIxPTR"> ", (intptr_t )node);
+ fprintf(f, "<enclose:%"PRIxPTR"> ", (intptr_t)node);
switch (NENCLOSE(node)->type) {
case ENCLOSE_OPTION:
fprintf(f, "option:%d", NENCLOSE(node)->option);
diff --git a/regenc.c b/regenc.c
index de768efd72..288eac433d 100644
--- a/regenc.c
+++ b/regenc.c
@@ -52,7 +52,7 @@ onigenc_set_default_encoding(OnigEncoding enc)
}
extern int
-onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, OnigEncoding enc)
+onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc)
{
int ret = ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e);
if (ONIGENC_MBCLEN_CHARFOUND_P(ret))
@@ -414,7 +414,9 @@ onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigCodePoint code;
int i, r;
- for (i = 0; i < numberof(OnigAsciiLowerMap); i++) {
+ for (i = 0;
+ i < (int )(sizeof(OnigAsciiLowerMap)/sizeof(OnigPairCaseFoldCodes));
+ i++) {
code = OnigAsciiLowerMap[i].to;
r = (*f)(OnigAsciiLowerMap[i].from, &code, 1, arg);
if (r != 0) return r;
@@ -429,8 +431,8 @@ onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
extern int
onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
- const OnigUChar* p, const OnigUChar* end ARG_UNUSED,
- OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED)
+ const OnigUChar* p, const OnigUChar* end ARG_UNUSED, OnigCaseFoldCodeItem items[],
+ OnigEncoding enc ARG_UNUSED)
{
if (0x41 <= *p && *p <= 0x5a) {
items[0].byte_len = 1;
@@ -568,10 +570,9 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
extern int
-onigenc_not_support_get_ctype_code_range(OnigCtype ctype ARG_UNUSED,
- OnigCodePoint* sb_out ARG_UNUSED,
- const OnigCodePoint* ranges[] ARG_UNUSED,
- OnigEncoding enc)
+onigenc_not_support_get_ctype_code_range(OnigCtype ctype,
+ OnigCodePoint* sb_out, const OnigCodePoint* ranges[],
+ OnigEncoding enc)
{
return ONIG_NO_SUPPORT_CONFIG;
}
@@ -588,7 +589,7 @@ onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end, OnigEncoding enc A
/* for single byte encodings */
extern int
onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
- const UChar* end, UChar* lower, OnigEncoding enc ARG_UNUSED)
+ const UChar*end, UChar* lower, OnigEncoding enc ARG_UNUSED)
{
*lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p);
@@ -632,31 +633,28 @@ extern int
onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
{
if (code > 0xff)
- rb_raise(rb_eRangeError, "%u out of char range", code);
+ rb_raise(rb_eRangeError, "%u out of char range", code);
*buf = (UChar )(code & 0xff);
return 1;
}
extern UChar*
-onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED,
- const UChar* s,
- const UChar* end ARG_UNUSED,
+onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED, const UChar* s,
+ const UChar* end,
OnigEncoding enc ARG_UNUSED)
{
return (UChar* )s;
}
extern int
-onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED,
- const UChar* end ARG_UNUSED,
+onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
{
return TRUE;
}
extern int
-onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED,
- const UChar* end ARG_UNUSED,
+onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
OnigEncoding enc ARG_UNUSED)
{
return FALSE;
@@ -718,7 +716,7 @@ onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED,
#if 0
extern int
onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigCaseFoldType flag,
- const UChar** pp, const UChar* end ARG_UNUSED)
+ const UChar** pp ARG_UNUSED, const UChar* end ARG_UNUSED)
{
const UChar* p = *pp;
@@ -790,30 +788,30 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
}
extern int
-onigenc_minimum_property_name_to_ctype(OnigEncoding enc, const UChar* p, const UChar* end)
+onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
static const PosixBracketEntryType PBS[] = {
- POSIX_BRACKET_ENTRY_INIT("Alnum", ONIGENC_CTYPE_ALNUM),
- POSIX_BRACKET_ENTRY_INIT("Alpha", ONIGENC_CTYPE_ALPHA),
- POSIX_BRACKET_ENTRY_INIT("Blank", ONIGENC_CTYPE_BLANK),
- POSIX_BRACKET_ENTRY_INIT("Cntrl", ONIGENC_CTYPE_CNTRL),
- POSIX_BRACKET_ENTRY_INIT("Digit", ONIGENC_CTYPE_DIGIT),
- POSIX_BRACKET_ENTRY_INIT("Graph", ONIGENC_CTYPE_GRAPH),
- POSIX_BRACKET_ENTRY_INIT("Lower", ONIGENC_CTYPE_LOWER),
- POSIX_BRACKET_ENTRY_INIT("Print", ONIGENC_CTYPE_PRINT),
- POSIX_BRACKET_ENTRY_INIT("Punct", ONIGENC_CTYPE_PUNCT),
- POSIX_BRACKET_ENTRY_INIT("Space", ONIGENC_CTYPE_SPACE),
- POSIX_BRACKET_ENTRY_INIT("Upper", ONIGENC_CTYPE_UPPER),
- POSIX_BRACKET_ENTRY_INIT("XDigit", ONIGENC_CTYPE_XDIGIT),
- POSIX_BRACKET_ENTRY_INIT("ASCII", ONIGENC_CTYPE_ASCII),
- POSIX_BRACKET_ENTRY_INIT("Word", ONIGENC_CTYPE_WORD),
+ PosixBracketEntryInit("Alnum", ONIGENC_CTYPE_ALNUM),
+ PosixBracketEntryInit("Alpha", ONIGENC_CTYPE_ALPHA),
+ PosixBracketEntryInit("Blank", ONIGENC_CTYPE_BLANK),
+ PosixBracketEntryInit("Cntrl", ONIGENC_CTYPE_CNTRL),
+ PosixBracketEntryInit("Digit", ONIGENC_CTYPE_DIGIT),
+ PosixBracketEntryInit("Graph", ONIGENC_CTYPE_GRAPH),
+ PosixBracketEntryInit("Lower", ONIGENC_CTYPE_LOWER),
+ PosixBracketEntryInit("Print", ONIGENC_CTYPE_PRINT),
+ PosixBracketEntryInit("Punct", ONIGENC_CTYPE_PUNCT),
+ PosixBracketEntryInit("Space", ONIGENC_CTYPE_SPACE),
+ PosixBracketEntryInit("Upper", ONIGENC_CTYPE_UPPER),
+ PosixBracketEntryInit("XDigit", ONIGENC_CTYPE_XDIGIT),
+ PosixBracketEntryInit("ASCII", ONIGENC_CTYPE_ASCII),
+ PosixBracketEntryInit("Word", ONIGENC_CTYPE_WORD),
};
- const PosixBracketEntryType *pb;
+ const PosixBracketEntryType *pb, *pbe;
int len;
len = onigenc_strlen(enc, p, end);
- for (pb = PBS; pb < PBS + numberof(PBS); pb++) {
+ for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
if (len == pb->len &&
onigenc_with_ascii_strnicmp(enc, p, end, pb->name, pb->len) == 0)
return pb->ctype;
@@ -902,15 +900,13 @@ resize_property_list(int new_size, const OnigCodePoint*** plist, int* psize)
size = sizeof(OnigCodePoint*) * new_size;
if (IS_NULL(list)) {
list = (const OnigCodePoint** )xmalloc(size);
- if (IS_NULL(list)) return ONIGERR_MEMORY;
}
else {
- const OnigCodePoint **tmp;
- tmp = (const OnigCodePoint** )xrealloc((void* )list, size);
- if (IS_NULL(tmp)) return ONIGERR_MEMORY;
- list = tmp;
+ list = (const OnigCodePoint** )xrealloc((void* )list, size);
}
+ if (IS_NULL(list)) return ONIGERR_MEMORY;
+
*plist = list;
*psize = new_size;
diff --git a/regenc.h b/regenc.h
index 1457573207..04a5e70db3 100644
--- a/regenc.h
+++ b/regenc.h
@@ -29,18 +29,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
#ifndef REGINT_H
#ifndef RUBY_EXTERN
#include "ruby/config.h"
#include "ruby/defines.h"
#endif
-#endif
-
#ifdef ONIG_ESCAPE_UCHAR_COLLISION
#undef ONIG_ESCAPE_UCHAR_COLLISION
#endif
-
+#endif
#include "ruby/oniguruma.h"
RUBY_SYMBOL_EXPORT_BEGIN
@@ -102,22 +99,15 @@ typedef struct {
typedef struct {
- short int len;
- const UChar name[6];
+ const UChar *name;
int ctype;
+ short int len;
} PosixBracketEntryType;
-#define POSIX_BRACKET_ENTRY_INIT(name, ctype) \
- {(short int )(sizeof(name) - 1), (name), (ctype)}
-
-#ifndef numberof
-#define numberof(array) (int )(sizeof(array) / sizeof((array)[0]))
-#endif
-
+#define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
#define USE_CRNL_AS_LINE_TERMINATOR
#define USE_UNICODE_PROPERTIES
-#define USE_UNICODE_AGE_PROPERTIES
/* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */
@@ -149,8 +139,8 @@ ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UC
ONIG_EXTERN int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));
ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
-ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, const UChar* p, const UChar* end));
-ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, const UChar* p, const UChar* end));
+ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
+ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
@@ -168,10 +158,6 @@ ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, O
#define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
-#define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8)
-#define UNICODE_VALID_CODEPOINT_P(c) ( \
- ((c) <= 0x10ffff) && \
- !((c) < 0x10000 && UTF16_IS_SURROGATE((c) >> 8)))
#define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
OnigEncISO_8859_1_ToLowerCaseTable[c]
@@ -211,9 +197,9 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
#ifdef ONIG_ENC_REGISTER
-extern int ONIG_ENC_REGISTER(const char *, OnigEncoding);
+extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
#define OnigEncodingName(n) encoding_##n
-#define OnigEncodingDeclare(n) static const OnigEncodingType OnigEncodingName(n)
+#define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n)
#define OnigEncodingDefine(f,n) \
OnigEncodingDeclare(n); \
void Init_##f(void) { \
@@ -223,7 +209,7 @@ extern int ONIG_ENC_REGISTER(const char *, OnigEncoding);
OnigEncodingDeclare(n)
#else
#define OnigEncodingName(n) OnigEncoding##n
-#define OnigEncodingDeclare(n) const OnigEncodingType OnigEncodingName(n)
+#define OnigEncodingDeclare(n) OnigEncodingType OnigEncodingName(n)
#define OnigEncodingDefine(f,n) OnigEncodingDeclare(n)
#endif
diff --git a/regerror.c b/regerror.c
index 9ec3f65f4c..9c94d23018 100644
--- a/regerror.c
+++ b/regerror.c
@@ -3,7 +3,7 @@
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,8 @@ onig_error_code_to_format(OnigPosition code)
p = "no support in this configuration"; break;
case ONIGERR_MEMORY:
p = "failed to allocate memory"; break;
+ case ONIGERR_MATCH_STACK_LIMIT_OVER:
+ p = "match-stack limit over"; break;
case ONIGERR_TYPE_BUG:
p = "undefined type (bug)"; break;
case ONIGERR_PARSER_BUG:
@@ -63,8 +65,6 @@ onig_error_code_to_format(OnigPosition code)
p = "undefined bytecode (bug)"; break;
case ONIGERR_UNEXPECTED_BYTECODE:
p = "unexpected bytecode (bug)"; break;
- case ONIGERR_MATCH_STACK_LIMIT_OVER:
- p = "match-stack limit over"; break;
case ONIGERR_DEFAULT_ENCODING_IS_NOT_SET:
p = "default multibyte-encoding is not set"; break;
case ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR:
@@ -141,10 +141,14 @@ onig_error_code_to_format(OnigPosition code)
#endif
case ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED:
p = "numbered backref/call is not allowed. (use name)"; break;
+ case ONIGERR_TOO_BIG_WIDE_CHAR_VALUE:
+ p = "too big wide-char value"; break;
case ONIGERR_TOO_SHORT_DIGITS:
p = "too short digits"; break;
case ONIGERR_TOO_LONG_WIDE_CHAR_VALUE:
p = "too long wide-char value"; break;
+ case ONIGERR_INVALID_CODE_POINT_VALUE:
+ p = "invalid code point value"; break;
case ONIGERR_EMPTY_GROUP_NAME:
p = "group name is empty"; break;
case ONIGERR_INVALID_GROUP_NAME:
@@ -169,12 +173,6 @@ onig_error_code_to_format(OnigPosition code)
p = "group number is too big for capture history"; break;
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
p = "invalid character property name {%n}"; break;
- case ONIGERR_TOO_MANY_CAPTURE_GROUPS:
- p = "too many capture groups are specified"; break;
- case ONIGERR_INVALID_CODE_POINT_VALUE:
- p = "invalid code point value"; break;
- case ONIGERR_TOO_BIG_WIDE_CHAR_VALUE:
- p = "too big wide-char value"; break;
case ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION:
p = "not supported encoding combination"; break;
case ONIGERR_INVALID_COMBINATION_OF_OPTIONS:
@@ -309,12 +307,8 @@ onig_error_code_to_str(s, code, va_alist)
default:
q = onig_error_code_to_format(code);
- if (q) {
- len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);
- xmemcpy(s, q, len);
- } else {
- len = 0;
- }
+ len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);
+ xmemcpy(s, q, len);
s[len] = '\0';
break;
}
diff --git a/regexec.c b/regexec.c
index 0c379aa678..997849695e 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3,7 +3,7 @@
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,14 +32,6 @@
/* #define USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE */
-#ifndef USE_DIRECT_THREADED_VM
-# ifdef __GNUC__
-# define USE_DIRECT_THREADED_VM 1
-# else
-# define USE_DIRECT_THREADED_VM 0
-# endif
-#endif
-
#ifdef USE_CRNL_AS_LINE_TERMINATOR
#define ONIGENC_IS_MBC_CRNL(enc,p,end) \
(ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \
@@ -452,26 +444,9 @@ onig_region_copy(OnigRegion* to, OnigRegion* from)
-#define MAX_PTR_NUM 100
-
-#define STACK_INIT(alloc_addr, heap_addr, ptr_num, stack_num) do {\
- if (ptr_num > MAX_PTR_NUM) {\
- alloc_addr = (char* )xmalloc(sizeof(OnigStackIndex) * (ptr_num));\
- heap_addr = alloc_addr;\
- if (msa->stack_p) {\
- stk_alloc = (OnigStackType* )(msa->stack_p);\
- stk_base = stk_alloc;\
- stk = stk_base;\
- stk_end = stk_base + msa->stack_n;\
- } else {\
- stk_alloc = (OnigStackType* )xalloca(sizeof(OnigStackType) * (stack_num));\
- stk_base = stk_alloc;\
- stk = stk_base;\
- stk_end = stk_base + (stack_num);\
- }\
- } else if (msa->stack_p) {\
+#define STACK_INIT(alloc_addr, ptr_num, stack_num) do {\
+ if (msa->stack_p) {\
alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num));\
- heap_addr = NULL;\
stk_alloc = (OnigStackType* )(msa->stack_p);\
stk_base = stk_alloc;\
stk = stk_base;\
@@ -480,7 +455,6 @@ onig_region_copy(OnigRegion* to, OnigRegion* from)
else {\
alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num)\
+ sizeof(OnigStackType) * (stack_num));\
- heap_addr = NULL;\
stk_alloc = (OnigStackType* )(alloc_addr + sizeof(OnigStackIndex) * (ptr_num));\
stk_base = stk_alloc;\
stk = stk_base;\
@@ -555,11 +529,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
#define STACK_ENSURE(n) do {\
if (stk_end - stk < (n)) {\
int r = stack_double(&stk_base, &stk_end, &stk, stk_alloc, msa);\
- if (r != 0) {\
- STACK_SAVE;\
- if (xmalloc_base) xfree(xmalloc_base);\
- return r;\
- }\
+ if (r != 0) { STACK_SAVE; return r; } \
}\
} while(0)
@@ -1300,7 +1270,7 @@ onig_print_statistics(FILE* f)
int i;
fprintf(f, " count prev time\n");
for (i = 0; OnigOpInfo[i].opcode >= 0; i++) {
- fprintf(f, "%8d: %8d: %10lu: %s\n",
+ fprintf(f, "%8d: %8d: %10ld: %s\n",
OpCounter[i], OpPrevCounter[i], OpTime[i], OnigOpInfo[i].name);
}
fprintf(f, "\nmax stack depth: %d\n", MaxStackDepth);
@@ -1329,6 +1299,9 @@ typedef struct {
regoff_t rm_eo;
} posix_regmatch_t;
+void onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar* bpend, UChar** nextp,
+ OnigEncoding enc);
+
/* match data(str - end) from position (sstart). */
/* if sstart == str then set sprev to NULL. */
static OnigPosition
@@ -1352,7 +1325,6 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
UChar *p = reg->p;
UChar *pkeep;
char *alloca_base;
- char *xmalloc_base = NULL;
OnigStackType *stk_alloc, *stk_base, *stk, *stk_end;
OnigStackType *stkp; /* used as any purpose. */
OnigStackIndex si;
@@ -1364,197 +1336,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
int num_comb_exp_check = reg->num_comb_exp_check;
#endif
-#if USE_DIRECT_THREADED_VM
-#define VM_LOOP JUMP;
-#define VM_LOOP_END
-#define CASE(x) L_##x: sbegin = s; OPCODE_EXEC_HOOK;
-#define DEFAULT L_DEFAULT:
-#define NEXT sprev = sbegin; JUMP
-#define JUMP goto *oplabels[*p++]
-
- static void *oplabels[] = {
- &&L_OP_FINISH, /* matching process terminator (no more alternative) */
- &&L_OP_END, /* pattern code terminator (success end) */
-
- &&L_OP_EXACT1, /* single byte, N = 1 */
- &&L_OP_EXACT2, /* single byte, N = 2 */
- &&L_OP_EXACT3, /* single byte, N = 3 */
- &&L_OP_EXACT4, /* single byte, N = 4 */
- &&L_OP_EXACT5, /* single byte, N = 5 */
- &&L_OP_EXACTN, /* single byte */
- &&L_OP_EXACTMB2N1, /* mb-length = 2 N = 1 */
- &&L_OP_EXACTMB2N2, /* mb-length = 2 N = 2 */
- &&L_OP_EXACTMB2N3, /* mb-length = 2 N = 3 */
- &&L_OP_EXACTMB2N, /* mb-length = 2 */
- &&L_OP_EXACTMB3N, /* mb-length = 3 */
- &&L_OP_EXACTMBN, /* other length */
-
- &&L_OP_EXACT1_IC, /* single byte, N = 1, ignore case */
- &&L_OP_EXACTN_IC, /* single byte, ignore case */
-
- &&L_OP_CCLASS,
- &&L_OP_CCLASS_MB,
- &&L_OP_CCLASS_MIX,
- &&L_OP_CCLASS_NOT,
- &&L_OP_CCLASS_MB_NOT,
- &&L_OP_CCLASS_MIX_NOT,
- &&L_OP_CCLASS_NODE, /* pointer to CClassNode node */
-
- &&L_OP_ANYCHAR, /* "." */
- &&L_OP_ANYCHAR_ML, /* "." multi-line */
- &&L_OP_ANYCHAR_STAR, /* ".*" */
- &&L_OP_ANYCHAR_ML_STAR, /* ".*" multi-line */
- &&L_OP_ANYCHAR_STAR_PEEK_NEXT,
- &&L_OP_ANYCHAR_ML_STAR_PEEK_NEXT,
-
- &&L_OP_WORD,
- &&L_OP_NOT_WORD,
- &&L_OP_WORD_BOUND,
- &&L_OP_NOT_WORD_BOUND,
-#ifdef USE_WORD_BEGIN_END
- &&L_OP_WORD_BEGIN,
- &&L_OP_WORD_END,
-#else
- &&L_DEFAULT,
- &&L_DEFAULT,
-#endif
- &&L_OP_ASCII_WORD,
- &&L_OP_NOT_ASCII_WORD,
- &&L_OP_ASCII_WORD_BOUND,
- &&L_OP_NOT_ASCII_WORD_BOUND,
-#ifdef USE_WORD_BEGIN_END
- &&L_OP_ASCII_WORD_BEGIN,
- &&L_OP_ASCII_WORD_END,
-#else
- &&L_DEFAULT,
- &&L_DEFAULT,
-#endif
-
- &&L_OP_BEGIN_BUF,
- &&L_OP_END_BUF,
- &&L_OP_BEGIN_LINE,
- &&L_OP_END_LINE,
- &&L_OP_SEMI_END_BUF,
- &&L_OP_BEGIN_POSITION,
- &&L_OP_BEGIN_POS_OR_LINE, /* used for implicit anchor optimization */
-
- &&L_OP_BACKREF1,
- &&L_OP_BACKREF2,
- &&L_OP_BACKREFN,
- &&L_OP_BACKREFN_IC,
- &&L_OP_BACKREF_MULTI,
- &&L_OP_BACKREF_MULTI_IC,
-#ifdef USE_BACKREF_WITH_LEVEL
- &&L_OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */
-#else
- &&L_DEFAULT,
-#endif
- &&L_OP_MEMORY_START,
- &&L_OP_MEMORY_START_PUSH, /* push back-tracker to stack */
- &&L_OP_MEMORY_END_PUSH, /* push back-tracker to stack */
-#ifdef USE_SUBEXP_CALL
- &&L_OP_MEMORY_END_PUSH_REC, /* push back-tracker to stack */
-#else
- &&L_DEFAULT,
-#endif
- &&L_OP_MEMORY_END,
-#ifdef USE_SUBEXP_CALL
- &&L_OP_MEMORY_END_REC, /* push marker to stack */
-#else
- &&L_DEFAULT,
-#endif
-
- &&L_OP_KEEP,
-
- &&L_OP_FAIL, /* pop stack and move */
- &&L_OP_JUMP,
- &&L_OP_PUSH,
- &&L_OP_POP,
- &&L_OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
- &&L_OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
- &&L_OP_REPEAT, /* {n,m} */
- &&L_OP_REPEAT_NG, /* {n,m}? (non greedy) */
- &&L_OP_REPEAT_INC,
- &&L_OP_REPEAT_INC_NG, /* non greedy */
- &&L_OP_REPEAT_INC_SG, /* search and get in stack */
- &&L_OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */
- &&L_OP_NULL_CHECK_START, /* null loop checker start */
- &&L_OP_NULL_CHECK_END, /* null loop checker end */
-#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT
- &&L_OP_NULL_CHECK_END_MEMST, /* null loop checker end (with capture status) */
-#else
- &&L_DEFAULT,
-#endif
-#ifdef USE_SUBEXP_CALL
- &&L_OP_NULL_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
-#else
- &&L_DEFAULT,
-#endif
-
- &&L_OP_PUSH_POS, /* (?=...) start */
- &&L_OP_POP_POS, /* (?=...) end */
- &&L_OP_PUSH_POS_NOT, /* (?!...) start */
- &&L_OP_FAIL_POS, /* (?!...) end */
- &&L_OP_PUSH_STOP_BT, /* (?>...) start */
- &&L_OP_POP_STOP_BT, /* (?>...) end */
- &&L_OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
- &&L_OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
- &&L_OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */
-
-#ifdef USE_SUBEXP_CALL
- &&L_OP_CALL, /* \g<name> */
- &&L_OP_RETURN,
-#else
- &&L_DEFAULT,
- &&L_DEFAULT,
-#endif
- &&L_OP_CONDITION,
-
-#ifdef USE_COMBINATION_EXPLOSION_CHECK
- &&L_OP_STATE_CHECK_PUSH, /* combination explosion check and push */
- &&L_OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */
- &&L_OP_STATE_CHECK, /* check only */
-#else
- &&L_DEFAULT,
- &&L_DEFAULT,
- &&L_DEFAULT,
-#endif
-#ifdef USE_COMBINATION_EXPLOSION_CHECK
- &&L_OP_STATE_CHECK_ANYCHAR_STAR,
- &&L_OP_STATE_CHECK_ANYCHAR_ML_STAR,
-#else
- &&L_DEFAULT,
- &&L_DEFAULT,
-#endif
- /* no need: IS_DYNAMIC_OPTION() == 0 */
-#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */
- &&L_OP_SET_OPTION_PUSH, /* set option and push recover option */
- &&L_OP_SET_OPTION /* set option */
-#else
- &&L_DEFAULT,
- &&L_DEFAULT
-#endif
- };
-#else
-
-#define VM_LOOP \
- while (1) { \
- OPCODE_EXEC_HOOK; \
- sbegin = s; \
- switch (*p++) {
-#define VM_LOOP_END } sprev = sbegin; }
-#define CASE(x) case x:
-#define DEFAULT default:
-#define NEXT break
-#define JUMP continue; break
-#endif
-
-
#ifdef USE_SUBEXP_CALL
/* Stack #0 is used to store the pattern itself and used for (?R), \g<0>, etc. */
n = reg->num_repeat + (reg->num_mem + 1) * 2;
- STACK_INIT(alloca_base, xmalloc_base, n, INIT_MATCH_STACK_SIZE);
+ STACK_INIT(alloca_base, n, INIT_MATCH_STACK_SIZE);
pop_level = reg->stack_pop_level;
num_mem = reg->num_mem;
repeat_stk = (OnigStackIndex* )alloca_base;
@@ -1568,7 +1354,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
/* Stack #0 not is used. */
n = reg->num_repeat + reg->num_mem * 2;
- STACK_INIT(alloca_base, xmalloc_base, n, INIT_MATCH_STACK_SIZE);
+ STACK_INIT(alloca_base, n, INIT_MATCH_STACK_SIZE);
pop_level = reg->stack_pop_level;
num_mem = reg->num_mem;
repeat_stk = (OnigStackIndex* )alloca_base;
@@ -1586,47 +1372,41 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#ifdef ONIG_DEBUG_MATCH
fprintf(stderr, "match_at: str: %"PRIdPTR" (%p), end: %"PRIdPTR" (%p), start: %"PRIdPTR" (%p), sprev: %"PRIdPTR" (%p)\n",
- (intptr_t )str, str, (intptr_t )end, end, (intptr_t )sstart, sstart, (intptr_t )sprev, sprev);
+ (intptr_t)str, str, (intptr_t)end, end, (intptr_t)sstart, sstart, (intptr_t)sprev, sprev);
fprintf(stderr, "size: %d, start offset: %d\n",
(int )(end - str), (int )(sstart - str));
#endif
- STACK_PUSH_ENSURED(STK_ALT, (UChar* )FinishCode); /* bottom stack */
+ STACK_PUSH_ENSURED(STK_ALT, (UChar *)FinishCode); /* bottom stack */
best_len = ONIG_MISMATCH;
s = (UChar* )sstart;
pkeep = (UChar* )sstart;
-
-
+ while (1) {
#ifdef ONIG_DEBUG_MATCH
-#define OPCODE_EXEC_HOOK \
- if (s) { \
- UChar *q, *bp, buf[50]; \
- int len; \
- fprintf(stderr, "%4"PRIdPTR"> \"", (*p == OP_FINISH) ? (ptrdiff_t )-1 : s - str); \
- bp = buf; \
- q = s; \
- if (*p != OP_FINISH) { /* s may not be a valid pointer if OP_FINISH. */ \
- for (i = 0; i < 7 && q < end; i++) { \
- len = enclen(encode, q, end); \
- while (len-- > 0) *bp++ = *q++; \
- } \
- } \
- if (q < end) { xmemcpy(bp, "...\"", 4); bp += 4; } \
- else { xmemcpy(bp, "\"", 1); bp += 1; } \
- *bp = 0; \
- fputs((char* )buf, stderr); \
- for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr); \
- fprintf(stderr, "%4"PRIdPTR":", (p == FinishCode) ? (ptrdiff_t )-1 : p - reg->p); \
- onig_print_compiled_byte_code(stderr, p, p + strlen((char *)p),NULL, encode); \
- fprintf(stderr, "\n"); \
+ if (s) {
+ UChar *q, *bp, buf[50];
+ int len;
+ fprintf(stderr, "%4d> \"", (int )(s - str));
+ bp = buf;
+ if (*p != OP_FINISH) { /* s may not be a valid pointer if OP_FINISH. */
+ for (i = 0, q = s; i < 7 && q < end; i++) {
+ len = enclen(encode, q, end);
+ while (len-- > 0) *bp++ = *q++;
+ }
+ }
+ if (q < end) { xmemcpy(bp, "...\"", 4); bp += 4; }
+ else { xmemcpy(bp, "\"", 1); bp += 1; }
+ *bp = 0;
+ fputs((char* )buf, stderr);
+ for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr);
+ onig_print_compiled_byte_code(stderr, p, p + strlen((char *)p), NULL, encode);
+ fprintf(stderr, "\n");
}
-#else
-#define OPCODE_EXEC_HOOK ((void) 0)
#endif
-
- VM_LOOP {
- CASE(OP_END) MOP_IN(OP_END);
+ sbegin = s;
+ switch (*p++) {
+ case OP_END: MOP_IN(OP_END);
n = s - sstart;
if (n > best_len) {
OnigRegion* region;
@@ -1735,9 +1515,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
/* default behavior: return first-matching result. */
goto finish;
- NEXT;
+ break;
- CASE(OP_EXACT1) MOP_IN(OP_EXACT1);
+ case OP_EXACT1: MOP_IN(OP_EXACT1);
#if 0
DATA_ENSURE(1);
if (*p != *s) goto fail;
@@ -1747,9 +1527,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
DATA_ENSURE(0);
p++;
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_EXACT1_IC) MOP_IN(OP_EXACT1_IC);
+ case OP_EXACT1_IC: MOP_IN(OP_EXACT1_IC);
{
int len;
UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
@@ -1769,9 +1549,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_EXACT2) MOP_IN(OP_EXACT2);
+ case OP_EXACT2: MOP_IN(OP_EXACT2);
DATA_ENSURE(2);
if (*p != *s) goto fail;
p++; s++;
@@ -1779,9 +1559,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev = s;
p++; s++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACT3) MOP_IN(OP_EXACT3);
+ case OP_EXACT3: MOP_IN(OP_EXACT3);
DATA_ENSURE(3);
if (*p != *s) goto fail;
p++; s++;
@@ -1791,9 +1572,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev = s;
p++; s++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACT4) MOP_IN(OP_EXACT4);
+ case OP_EXACT4: MOP_IN(OP_EXACT4);
DATA_ENSURE(4);
if (*p != *s) goto fail;
p++; s++;
@@ -1805,9 +1587,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev = s;
p++; s++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACT5) MOP_IN(OP_EXACT5);
+ case OP_EXACT5: MOP_IN(OP_EXACT5);
DATA_ENSURE(5);
if (*p != *s) goto fail;
p++; s++;
@@ -1821,9 +1604,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev = s;
p++; s++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTN) MOP_IN(OP_EXACTN);
+ case OP_EXACTN: MOP_IN(OP_EXACTN);
GET_LENGTH_INC(tlen, p);
DATA_ENSURE(tlen);
while (tlen-- > 0) {
@@ -1831,9 +1615,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
sprev = s - 1;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTN_IC) MOP_IN(OP_EXACTN_IC);
+ case OP_EXACTN_IC: MOP_IN(OP_EXACTN_IC);
{
int len;
UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];
@@ -1858,18 +1643,19 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTMB2N1) MOP_IN(OP_EXACTMB2N1);
+ case OP_EXACTMB2N1: MOP_IN(OP_EXACTMB2N1);
DATA_ENSURE(2);
if (*p != *s) goto fail;
p++; s++;
if (*p != *s) goto fail;
p++; s++;
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_EXACTMB2N2) MOP_IN(OP_EXACTMB2N2);
+ case OP_EXACTMB2N2: MOP_IN(OP_EXACTMB2N2);
DATA_ENSURE(4);
if (*p != *s) goto fail;
p++; s++;
@@ -1881,9 +1667,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (*p != *s) goto fail;
p++; s++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTMB2N3) MOP_IN(OP_EXACTMB2N3);
+ case OP_EXACTMB2N3: MOP_IN(OP_EXACTMB2N3);
DATA_ENSURE(6);
if (*p != *s) goto fail;
p++; s++;
@@ -1899,9 +1686,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (*p != *s) goto fail;
p++; s++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTMB2N) MOP_IN(OP_EXACTMB2N);
+ case OP_EXACTMB2N: MOP_IN(OP_EXACTMB2N);
GET_LENGTH_INC(tlen, p);
DATA_ENSURE(tlen * 2);
while (tlen-- > 0) {
@@ -1912,9 +1700,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
sprev = s - 2;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTMB3N) MOP_IN(OP_EXACTMB3N);
+ case OP_EXACTMB3N: MOP_IN(OP_EXACTMB3N);
GET_LENGTH_INC(tlen, p);
DATA_ENSURE(tlen * 3);
while (tlen-- > 0) {
@@ -1927,9 +1716,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
sprev = s - 3;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_EXACTMBN) MOP_IN(OP_EXACTMBN);
+ case OP_EXACTMBN: MOP_IN(OP_EXACTMBN);
GET_LENGTH_INC(tlen, p); /* mb-len */
GET_LENGTH_INC(tlen2, p); /* string len */
tlen2 *= tlen;
@@ -1940,17 +1730,18 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
sprev = s - tlen;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_CCLASS) MOP_IN(OP_CCLASS);
+ case OP_CCLASS: MOP_IN(OP_CCLASS);
DATA_ENSURE(1);
if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail;
p += SIZE_BITSET;
s += enclen(encode, s, end); /* OP_CCLASS can match mb-code. \D, \S */
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_CCLASS_MB) MOP_IN(OP_CCLASS_MB);
+ case OP_CCLASS_MB: MOP_IN(OP_CCLASS_MB);
if (! ONIGENC_IS_MBC_HEAD(encode, s, end)) goto fail;
cclass_mb:
@@ -1977,9 +1768,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
p += tlen;
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_CCLASS_MIX) MOP_IN(OP_CCLASS_MIX);
+ case OP_CCLASS_MIX: MOP_IN(OP_CCLASS_MIX);
DATA_ENSURE(1);
if (ONIGENC_IS_MBC_HEAD(encode, s, end)) {
p += SIZE_BITSET;
@@ -1995,17 +1786,17 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
s++;
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_CCLASS_NOT) MOP_IN(OP_CCLASS_NOT);
+ case OP_CCLASS_NOT: MOP_IN(OP_CCLASS_NOT);
DATA_ENSURE(1);
if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail;
p += SIZE_BITSET;
s += enclen(encode, s, end);
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_CCLASS_MB_NOT) MOP_IN(OP_CCLASS_MB_NOT);
+ case OP_CCLASS_MB_NOT: MOP_IN(OP_CCLASS_MB_NOT);
DATA_ENSURE(1);
if (! ONIGENC_IS_MBC_HEAD(encode, s, end)) {
s++;
@@ -2044,9 +1835,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
cc_mb_not_success:
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_CCLASS_MIX_NOT) MOP_IN(OP_CCLASS_MIX_NOT);
+ case OP_CCLASS_MIX_NOT: MOP_IN(OP_CCLASS_MIX_NOT);
DATA_ENSURE(1);
if (ONIGENC_IS_MBC_HEAD(encode, s, end)) {
p += SIZE_BITSET;
@@ -2062,9 +1853,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
s++;
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_CCLASS_NODE) MOP_IN(OP_CCLASS_NODE);
+ case OP_CCLASS_NODE: MOP_IN(OP_CCLASS_NODE);
{
OnigCodePoint code;
void *node;
@@ -2081,26 +1872,26 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (onig_is_code_in_cc_len(mb_len, code, node) == 0) goto fail;
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ANYCHAR) MOP_IN(OP_ANYCHAR);
+ case OP_ANYCHAR: MOP_IN(OP_ANYCHAR);
DATA_ENSURE(1);
n = enclen(encode, s, end);
DATA_ENSURE(n);
if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail;
s += n;
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ANYCHAR_ML) MOP_IN(OP_ANYCHAR_ML);
+ case OP_ANYCHAR_ML: MOP_IN(OP_ANYCHAR_ML);
DATA_ENSURE(1);
n = enclen(encode, s, end);
DATA_ENSURE(n);
s += n;
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ANYCHAR_STAR) MOP_IN(OP_ANYCHAR_STAR);
+ case OP_ANYCHAR_STAR: MOP_IN(OP_ANYCHAR_STAR);
while (DATA_ENSURE_CHECK1) {
STACK_PUSH_ALT(p, s, sprev, pkeep);
n = enclen(encode, s, end);
@@ -2110,9 +1901,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
s += n;
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ANYCHAR_ML_STAR) MOP_IN(OP_ANYCHAR_ML_STAR);
+ case OP_ANYCHAR_ML_STAR: MOP_IN(OP_ANYCHAR_ML_STAR);
while (DATA_ENSURE_CHECK1) {
STACK_PUSH_ALT(p, s, sprev, pkeep);
n = enclen(encode, s, end);
@@ -2127,9 +1918,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ANYCHAR_STAR_PEEK_NEXT) MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);
+ case OP_ANYCHAR_STAR_PEEK_NEXT: MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);
while (DATA_ENSURE_CHECK1) {
if (*p == *s) {
STACK_PUSH_ALT(p + 1, s, sprev, pkeep);
@@ -2142,9 +1933,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
p++;
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ANYCHAR_ML_STAR_PEEK_NEXT)MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);
+ case OP_ANYCHAR_ML_STAR_PEEK_NEXT:MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);
while (DATA_ENSURE_CHECK1) {
if (*p == *s) {
STACK_PUSH_ALT(p + 1, s, sprev, pkeep);
@@ -2162,10 +1953,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
p++;
MOP_OUT;
- NEXT;
+ break;
#ifdef USE_COMBINATION_EXPLOSION_CHECK
- CASE(OP_STATE_CHECK_ANYCHAR_STAR) MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR);
+ case OP_STATE_CHECK_ANYCHAR_STAR: MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR);
GET_STATE_CHECK_NUM_INC(mem, p);
while (DATA_ENSURE_CHECK1) {
STATE_CHECK_VAL(scv, mem);
@@ -2179,9 +1970,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
s += n;
}
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_STATE_CHECK_ANYCHAR_ML_STAR)
+ case OP_STATE_CHECK_ANYCHAR_ML_STAR:
MOP_IN(OP_STATE_CHECK_ANYCHAR_ML_STAR);
GET_STATE_CHECK_NUM_INC(mem, p);
@@ -2202,46 +1993,46 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- NEXT;
+ break;
#endif /* USE_COMBINATION_EXPLOSION_CHECK */
- CASE(OP_WORD) MOP_IN(OP_WORD);
+ case OP_WORD: MOP_IN(OP_WORD);
DATA_ENSURE(1);
if (! ONIGENC_IS_MBC_WORD(encode, s, end))
goto fail;
s += enclen(encode, s, end);
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_ASCII_WORD) MOP_IN(OP_ASCII_WORD);
+ case OP_ASCII_WORD: MOP_IN(OP_ASCII_WORD);
DATA_ENSURE(1);
if (! ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
goto fail;
s += enclen(encode, s, end);
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_NOT_WORD) MOP_IN(OP_NOT_WORD);
+ case OP_NOT_WORD: MOP_IN(OP_NOT_WORD);
DATA_ENSURE(1);
if (ONIGENC_IS_MBC_WORD(encode, s, end))
goto fail;
s += enclen(encode, s, end);
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_NOT_ASCII_WORD) MOP_IN(OP_NOT_ASCII_WORD);
+ case OP_NOT_ASCII_WORD: MOP_IN(OP_NOT_ASCII_WORD);
DATA_ENSURE(1);
if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
goto fail;
s += enclen(encode, s, end);
MOP_OUT;
- NEXT;
+ break;
- CASE(OP_WORD_BOUND) MOP_IN(OP_WORD_BOUND);
+ case OP_WORD_BOUND: MOP_IN(OP_WORD_BOUND);
if (ON_STR_BEGIN(s)) {
DATA_ENSURE(1);
if (! ONIGENC_IS_MBC_WORD(encode, s, end))
@@ -2257,9 +2048,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto fail;
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_ASCII_WORD_BOUND) MOP_IN(OP_ASCII_WORD_BOUND);
+ case OP_ASCII_WORD_BOUND: MOP_IN(OP_ASCII_WORD_BOUND);
if (ON_STR_BEGIN(s)) {
DATA_ENSURE(1);
if (! ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
@@ -2275,9 +2067,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto fail;
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_NOT_WORD_BOUND) MOP_IN(OP_NOT_WORD_BOUND);
+ case OP_NOT_WORD_BOUND: MOP_IN(OP_NOT_WORD_BOUND);
if (ON_STR_BEGIN(s)) {
if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end))
goto fail;
@@ -2292,9 +2085,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto fail;
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_NOT_ASCII_WORD_BOUND) MOP_IN(OP_NOT_ASCII_WORD_BOUND);
+ case OP_NOT_ASCII_WORD_BOUND: MOP_IN(OP_NOT_ASCII_WORD_BOUND);
if (ON_STR_BEGIN(s)) {
if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_ASCII_WORD(encode, s, end))
goto fail;
@@ -2309,70 +2103,71 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto fail;
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
#ifdef USE_WORD_BEGIN_END
- CASE(OP_WORD_BEGIN) MOP_IN(OP_WORD_BEGIN);
+ case OP_WORD_BEGIN: MOP_IN(OP_WORD_BEGIN);
if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) {
if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_WORD(encode, sprev, end)) {
MOP_OUT;
- JUMP;
+ continue;
}
}
goto fail;
- NEXT;
+ break;
- CASE(OP_ASCII_WORD_BEGIN) MOP_IN(OP_ASCII_WORD_BEGIN);
+ case OP_ASCII_WORD_BEGIN: MOP_IN(OP_ASCII_WORD_BEGIN);
if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) {
if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) {
MOP_OUT;
- JUMP;
+ continue;
}
}
goto fail;
- NEXT;
+ break;
- CASE(OP_WORD_END) MOP_IN(OP_WORD_END);
+ case OP_WORD_END: MOP_IN(OP_WORD_END);
if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) {
if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) {
MOP_OUT;
- JUMP;
+ continue;
}
}
goto fail;
- NEXT;
+ break;
- CASE(OP_ASCII_WORD_END) MOP_IN(OP_ASCII_WORD_END);
+ case OP_ASCII_WORD_END: MOP_IN(OP_ASCII_WORD_END);
if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) {
if (ON_STR_END(s) || !ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) {
MOP_OUT;
- JUMP;
+ continue;
}
}
goto fail;
- NEXT;
+ break;
#endif
- CASE(OP_BEGIN_BUF) MOP_IN(OP_BEGIN_BUF);
+ case OP_BEGIN_BUF: MOP_IN(OP_BEGIN_BUF);
if (! ON_STR_BEGIN(s)) goto fail;
- if (IS_NOTBOS(msa->options)) goto fail;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_END_BUF) MOP_IN(OP_END_BUF);
+ case OP_END_BUF: MOP_IN(OP_END_BUF);
if (! ON_STR_END(s)) goto fail;
- if (IS_NOTEOS(msa->options)) goto fail;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_BEGIN_LINE) MOP_IN(OP_BEGIN_LINE);
+ case OP_BEGIN_LINE: MOP_IN(OP_BEGIN_LINE);
op_begin_line:
if (ON_STR_BEGIN(s)) {
if (IS_NOTBOL(msa->options)) goto fail;
MOP_OUT;
- JUMP;
+ continue;
}
else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)
#ifdef USE_CRNL_AS_LINE_TERMINATOR
@@ -2381,38 +2176,38 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#endif
&& !ON_STR_END(s)) {
MOP_OUT;
- JUMP;
+ continue;
}
goto fail;
- NEXT;
+ break;
- CASE(OP_END_LINE) MOP_IN(OP_END_LINE);
+ case OP_END_LINE: MOP_IN(OP_END_LINE);
if (ON_STR_END(s)) {
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE_EX(encode, sprev, str, end, option, 1)) {
#endif
if (IS_NOTEOL(msa->options)) goto fail;
MOP_OUT;
- JUMP;
+ continue;
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
}
#endif
}
else if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 1)) {
MOP_OUT;
- JUMP;
+ continue;
}
goto fail;
- NEXT;
+ break;
- CASE(OP_SEMI_END_BUF) MOP_IN(OP_SEMI_END_BUF);
+ case OP_SEMI_END_BUF: MOP_IN(OP_SEMI_END_BUF);
if (ON_STR_END(s)) {
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE_EX(encode, sprev, str, end, option, 1)) {
#endif
if (IS_NOTEOL(msa->options)) goto fail;
MOP_OUT;
- JUMP;
+ continue;
#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
}
#endif
@@ -2421,7 +2216,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
UChar* ss = s + enclen(encode, s, end);
if (ON_STR_END(ss)) {
MOP_OUT;
- JUMP;
+ continue;
}
#ifdef USE_CRNL_AS_LINE_TERMINATOR
else if (IS_NEWLINE_CRLF(option)
@@ -2429,67 +2224,75 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
ss += enclen(encode, ss, end);
if (ON_STR_END(ss)) {
MOP_OUT;
- JUMP;
+ continue;
}
}
#endif
}
goto fail;
- NEXT;
+ break;
- CASE(OP_BEGIN_POSITION) MOP_IN(OP_BEGIN_POSITION);
+ case OP_BEGIN_POSITION: MOP_IN(OP_BEGIN_POSITION);
if (s != msa->gpos)
goto fail;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_BEGIN_POS_OR_LINE) MOP_IN(OP_BEGIN_POS_OR_LINE);
+ case OP_BEGIN_POS_OR_LINE: MOP_IN(OP_BEGIN_POS_OR_LINE);
if (s != msa->gpos)
goto op_begin_line;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_MEMORY_START_PUSH) MOP_IN(OP_MEMORY_START_PUSH);
+ case OP_MEMORY_START_PUSH: MOP_IN(OP_MEMORY_START_PUSH);
GET_MEMNUM_INC(mem, p);
STACK_PUSH_MEM_START(mem, s);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_MEMORY_START) MOP_IN(OP_MEMORY_START);
+ case OP_MEMORY_START: MOP_IN(OP_MEMORY_START);
GET_MEMNUM_INC(mem, p);
mem_start_stk[mem] = (OnigStackIndex )((void* )s);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_MEMORY_END_PUSH) MOP_IN(OP_MEMORY_END_PUSH);
+ case OP_MEMORY_END_PUSH: MOP_IN(OP_MEMORY_END_PUSH);
GET_MEMNUM_INC(mem, p);
STACK_PUSH_MEM_END(mem, s);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_MEMORY_END) MOP_IN(OP_MEMORY_END);
+ case OP_MEMORY_END: MOP_IN(OP_MEMORY_END);
GET_MEMNUM_INC(mem, p);
mem_end_stk[mem] = (OnigStackIndex )((void* )s);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_KEEP) MOP_IN(OP_KEEP);
+ case OP_KEEP: MOP_IN(OP_KEEP);
pkeep = s;
MOP_OUT;
- JUMP;
+ continue;
+ break;
#ifdef USE_SUBEXP_CALL
- CASE(OP_MEMORY_END_PUSH_REC) MOP_IN(OP_MEMORY_END_PUSH_REC);
+ case OP_MEMORY_END_PUSH_REC: MOP_IN(OP_MEMORY_END_PUSH_REC);
GET_MEMNUM_INC(mem, p);
STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */
STACK_PUSH_MEM_END(mem, s);
mem_start_stk[mem] = GET_STACK_INDEX(stkp);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_MEMORY_END_REC) MOP_IN(OP_MEMORY_END_REC);
+ case OP_MEMORY_END_REC: MOP_IN(OP_MEMORY_END_REC);
GET_MEMNUM_INC(mem, p);
mem_end_stk[mem] = (OnigStackIndex )((void* )s);
STACK_GET_MEM_START(mem, stkp);
@@ -2501,20 +2304,21 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_PUSH_MEM_END_MARK(mem);
MOP_OUT;
- JUMP;
+ continue;
+ break;
#endif
- CASE(OP_BACKREF1) MOP_IN(OP_BACKREF1);
+ case OP_BACKREF1: MOP_IN(OP_BACKREF1);
mem = 1;
goto backref;
- NEXT;
+ break;
- CASE(OP_BACKREF2) MOP_IN(OP_BACKREF2);
+ case OP_BACKREF2: MOP_IN(OP_BACKREF2);
mem = 2;
goto backref;
- NEXT;
+ break;
- CASE(OP_BACKREFN) MOP_IN(OP_BACKREFN);
+ case OP_BACKREFN: MOP_IN(OP_BACKREFN);
GET_MEMNUM_INC(mem, p);
backref:
{
@@ -2543,10 +2347,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev += len;
MOP_OUT;
- JUMP;
+ continue;
}
+ break;
- CASE(OP_BACKREFN_IC) MOP_IN(OP_BACKREFN_IC);
+ case OP_BACKREFN_IC: MOP_IN(OP_BACKREFN_IC);
GET_MEMNUM_INC(mem, p);
{
int len;
@@ -2574,11 +2379,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev += len;
MOP_OUT;
- JUMP;
+ continue;
}
- NEXT;
+ break;
- CASE(OP_BACKREF_MULTI) MOP_IN(OP_BACKREF_MULTI);
+ case OP_BACKREF_MULTI: MOP_IN(OP_BACKREF_MULTI);
{
int len, is_fail;
UChar *pstart, *pend, *swork;
@@ -2613,11 +2418,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
if (i == tlen) goto fail;
MOP_OUT;
- JUMP;
+ continue;
}
- NEXT;
+ break;
- CASE(OP_BACKREF_MULTI_IC) MOP_IN(OP_BACKREF_MULTI_IC);
+ case OP_BACKREF_MULTI_IC: MOP_IN(OP_BACKREF_MULTI_IC);
{
int len, is_fail;
UChar *pstart, *pend, *swork;
@@ -2652,11 +2457,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
if (i == tlen) goto fail;
MOP_OUT;
- JUMP;
+ continue;
}
+ break;
#ifdef USE_BACKREF_WITH_LEVEL
- CASE(OP_BACKREF_WITH_LEVEL)
+ case OP_BACKREF_WITH_LEVEL:
{
int len;
OnigOptionType ic;
@@ -2678,32 +2484,36 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto fail;
MOP_OUT;
- JUMP;
+ continue;
}
+ break;
#endif
#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */
- CASE(OP_SET_OPTION_PUSH) MOP_IN(OP_SET_OPTION_PUSH);
+ case OP_SET_OPTION_PUSH: MOP_IN(OP_SET_OPTION_PUSH);
GET_OPTION_INC(option, p);
STACK_PUSH_ALT(p, s, sprev, pkeep);
p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_SET_OPTION) MOP_IN(OP_SET_OPTION);
+ case OP_SET_OPTION: MOP_IN(OP_SET_OPTION);
GET_OPTION_INC(option, p);
MOP_OUT;
- JUMP;
+ continue;
+ break;
#endif
- CASE(OP_NULL_CHECK_START) MOP_IN(OP_NULL_CHECK_START);
+ case OP_NULL_CHECK_START: MOP_IN(OP_NULL_CHECK_START);
GET_MEMNUM_INC(mem, p); /* mem: null check id */
STACK_PUSH_NULL_CHECK_START(mem, s);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_NULL_CHECK_END) MOP_IN(OP_NULL_CHECK_END);
+ case OP_NULL_CHECK_END: MOP_IN(OP_NULL_CHECK_END);
{
int isnull;
@@ -2734,10 +2544,11 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT
- CASE(OP_NULL_CHECK_END_MEMST) MOP_IN(OP_NULL_CHECK_END_MEMST);
+ case OP_NULL_CHECK_END_MEMST: MOP_IN(OP_NULL_CHECK_END_MEMST);
{
int isnull;
@@ -2753,11 +2564,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
#endif
#ifdef USE_SUBEXP_CALL
- CASE(OP_NULL_CHECK_END_MEMST_PUSH)
+ case OP_NULL_CHECK_END_MEMST_PUSH:
MOP_IN(OP_NULL_CHECK_END_MEMST_PUSH);
{
int isnull;
@@ -2781,24 +2593,27 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
#endif
- CASE(OP_JUMP) MOP_IN(OP_JUMP);
+ case OP_JUMP: MOP_IN(OP_JUMP);
GET_RELADDR_INC(addr, p);
p += addr;
MOP_OUT;
CHECK_INTERRUPT_IN_MATCH_AT;
- JUMP;
+ continue;
+ break;
- CASE(OP_PUSH) MOP_IN(OP_PUSH);
+ case OP_PUSH: MOP_IN(OP_PUSH);
GET_RELADDR_INC(addr, p);
STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
MOP_OUT;
- JUMP;
+ continue;
+ break;
#ifdef USE_COMBINATION_EXPLOSION_CHECK
- CASE(OP_STATE_CHECK_PUSH) MOP_IN(OP_STATE_CHECK_PUSH);
+ case OP_STATE_CHECK_PUSH: MOP_IN(OP_STATE_CHECK_PUSH);
GET_STATE_CHECK_NUM_INC(mem, p);
STATE_CHECK_VAL(scv, mem);
if (scv) goto fail;
@@ -2806,9 +2621,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
GET_RELADDR_INC(addr, p);
STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem, pkeep);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_STATE_CHECK_PUSH_OR_JUMP) MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP);
+ case OP_STATE_CHECK_PUSH_OR_JUMP: MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP);
GET_STATE_CHECK_NUM_INC(mem, p);
GET_RELADDR_INC(addr, p);
STATE_CHECK_VAL(scv, mem);
@@ -2819,48 +2635,53 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem, pkeep);
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_STATE_CHECK) MOP_IN(OP_STATE_CHECK);
+ case OP_STATE_CHECK: MOP_IN(OP_STATE_CHECK);
GET_STATE_CHECK_NUM_INC(mem, p);
STATE_CHECK_VAL(scv, mem);
if (scv) goto fail;
STACK_PUSH_STATE_CHECK(s, mem);
MOP_OUT;
- JUMP;
+ continue;
+ break;
#endif /* USE_COMBINATION_EXPLOSION_CHECK */
- CASE(OP_POP) MOP_IN(OP_POP);
+ case OP_POP: MOP_IN(OP_POP);
STACK_POP_ONE;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_PUSH_OR_JUMP_EXACT1) MOP_IN(OP_PUSH_OR_JUMP_EXACT1);
+ case OP_PUSH_OR_JUMP_EXACT1: MOP_IN(OP_PUSH_OR_JUMP_EXACT1);
GET_RELADDR_INC(addr, p);
if (*p == *s && DATA_ENSURE_CHECK1) {
p++;
STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
MOP_OUT;
- JUMP;
+ continue;
}
p += (addr + 1);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_PUSH_IF_PEEK_NEXT) MOP_IN(OP_PUSH_IF_PEEK_NEXT);
+ case OP_PUSH_IF_PEEK_NEXT: MOP_IN(OP_PUSH_IF_PEEK_NEXT);
GET_RELADDR_INC(addr, p);
if (*p == *s) {
p++;
STACK_PUSH_ALT(p + addr, s, sprev, pkeep);
MOP_OUT;
- JUMP;
+ continue;
}
p++;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_REPEAT) MOP_IN(OP_REPEAT);
+ case OP_REPEAT: MOP_IN(OP_REPEAT);
{
GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */
GET_RELADDR_INC(addr, p);
@@ -2874,9 +2695,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_REPEAT_NG) MOP_IN(OP_REPEAT_NG);
+ case OP_REPEAT_NG: MOP_IN(OP_REPEAT_NG);
{
GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */
GET_RELADDR_INC(addr, p);
@@ -2891,9 +2713,10 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_REPEAT_INC) MOP_IN(OP_REPEAT_INC);
+ case OP_REPEAT_INC: MOP_IN(OP_REPEAT_INC);
GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */
si = repeat_stk[mem];
stkp = STACK_AT(si);
@@ -2913,16 +2736,17 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
STACK_PUSH_REPEAT_INC(si);
MOP_OUT;
CHECK_INTERRUPT_IN_MATCH_AT;
- JUMP;
+ continue;
+ break;
- CASE(OP_REPEAT_INC_SG) MOP_IN(OP_REPEAT_INC_SG);
+ case OP_REPEAT_INC_SG: MOP_IN(OP_REPEAT_INC_SG);
GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */
STACK_GET_REPEAT(mem, stkp);
si = GET_STACK_INDEX(stkp);
goto repeat_inc;
- NEXT;
+ break;
- CASE(OP_REPEAT_INC_NG) MOP_IN(OP_REPEAT_INC_NG);
+ case OP_REPEAT_INC_NG: MOP_IN(OP_REPEAT_INC_NG);
GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */
si = repeat_stk[mem];
stkp = STACK_AT(si);
@@ -2946,59 +2770,66 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
}
MOP_OUT;
CHECK_INTERRUPT_IN_MATCH_AT;
- JUMP;
+ continue;
+ break;
- CASE(OP_REPEAT_INC_NG_SG) MOP_IN(OP_REPEAT_INC_NG_SG);
+ case OP_REPEAT_INC_NG_SG: MOP_IN(OP_REPEAT_INC_NG_SG);
GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */
STACK_GET_REPEAT(mem, stkp);
si = GET_STACK_INDEX(stkp);
goto repeat_inc_ng;
- NEXT;
+ break;
- CASE(OP_PUSH_POS) MOP_IN(OP_PUSH_POS);
+ case OP_PUSH_POS: MOP_IN(OP_PUSH_POS);
STACK_PUSH_POS(s, sprev, pkeep);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_POP_POS) MOP_IN(OP_POP_POS);
+ case OP_POP_POS: MOP_IN(OP_POP_POS);
{
STACK_POS_END(stkp);
s = stkp->u.state.pstr;
sprev = stkp->u.state.pstr_prev;
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_PUSH_POS_NOT) MOP_IN(OP_PUSH_POS_NOT);
+ case OP_PUSH_POS_NOT: MOP_IN(OP_PUSH_POS_NOT);
GET_RELADDR_INC(addr, p);
STACK_PUSH_POS_NOT(p + addr, s, sprev, pkeep);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_FAIL_POS) MOP_IN(OP_FAIL_POS);
+ case OP_FAIL_POS: MOP_IN(OP_FAIL_POS);
STACK_POP_TIL_POS_NOT;
goto fail;
- NEXT;
+ break;
- CASE(OP_PUSH_STOP_BT) MOP_IN(OP_PUSH_STOP_BT);
+ case OP_PUSH_STOP_BT: MOP_IN(OP_PUSH_STOP_BT);
STACK_PUSH_STOP_BT;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_POP_STOP_BT) MOP_IN(OP_POP_STOP_BT);
+ case OP_POP_STOP_BT: MOP_IN(OP_POP_STOP_BT);
STACK_STOP_BT_END;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_LOOK_BEHIND) MOP_IN(OP_LOOK_BEHIND);
+ case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND);
GET_LENGTH_INC(tlen, p);
s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen);
if (IS_NULL(s)) goto fail;
sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end);
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_PUSH_LOOK_BEHIND_NOT) MOP_IN(OP_PUSH_LOOK_BEHIND_NOT);
+ case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT);
GET_RELADDR_INC(addr, p);
GET_LENGTH_INC(tlen, p);
q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen);
@@ -3014,29 +2845,32 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end);
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_FAIL_LOOK_BEHIND_NOT) MOP_IN(OP_FAIL_LOOK_BEHIND_NOT);
+ case OP_FAIL_LOOK_BEHIND_NOT: MOP_IN(OP_FAIL_LOOK_BEHIND_NOT);
STACK_POP_TIL_LOOK_BEHIND_NOT;
goto fail;
- NEXT;
+ break;
#ifdef USE_SUBEXP_CALL
- CASE(OP_CALL) MOP_IN(OP_CALL);
+ case OP_CALL: MOP_IN(OP_CALL);
GET_ABSADDR_INC(addr, p);
STACK_PUSH_CALL_FRAME(p);
p = reg->p + addr;
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_RETURN) MOP_IN(OP_RETURN);
+ case OP_RETURN: MOP_IN(OP_RETURN);
STACK_RETURN(p);
STACK_PUSH_RETURN;
MOP_OUT;
- JUMP;
+ continue;
+ break;
#endif
- CASE(OP_CONDITION) MOP_IN(OP_CONDITION);
+ case OP_CONDITION: MOP_IN(OP_CONDITION);
GET_MEMNUM_INC(mem, p);
GET_RELADDR_INC(addr, p);
if ((mem > num_mem) ||
@@ -3045,16 +2879,17 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
p += addr;
}
MOP_OUT;
- JUMP;
+ continue;
+ break;
- CASE(OP_FINISH)
+ case OP_FINISH:
goto finish;
- NEXT;
+ break;
fail:
MOP_OUT;
/* fall */
- CASE(OP_FAIL) MOP_IN(OP_FAIL);
+ case OP_FAIL: MOP_IN(OP_FAIL);
STACK_POP;
p = stk->u.state.pcode;
s = stk->u.state.pstr;
@@ -3069,32 +2904,32 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#endif
MOP_OUT;
- JUMP;
+ continue;
+ break;
- DEFAULT
+ default:
goto bytecode_error;
- } VM_LOOP_END
+
+ } /* end of switch */
+ sprev = sbegin;
+ } /* end of while(1) */
finish:
STACK_SAVE;
- if (xmalloc_base) xfree(xmalloc_base);
return best_len;
#ifdef ONIG_DEBUG
stack_error:
STACK_SAVE;
- if (xmalloc_base) xfree(xmalloc_base);
return ONIGERR_STACK_BUG;
#endif
bytecode_error:
STACK_SAVE;
- if (xmalloc_base) xfree(xmalloc_base);
return ONIGERR_UNDEFINED_BYTECODE;
unexpected_bytecode_error:
STACK_SAVE;
- if (xmalloc_base) xfree(xmalloc_base);
return ONIGERR_UNEXPECTED_BYTECODE;
}
@@ -3324,8 +3159,8 @@ bm_search(regex_t* reg, const UChar* target, const UChar* target_end,
p = s;
t = tail;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "bm_search_loop: pos: %"PRIdPTR" %s\n",
- (intptr_t )(s - text), s);
+ fprintf(stderr, "bm_search_loop: pos: %d %s\n",
+ (int)(s - text), s);
#endif
while (*p == *t) {
if (t == target) return (UChar* )p;
@@ -3459,8 +3294,8 @@ bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end,
OnigEncoding enc = reg->enc;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "bm_search_notrev: text: %"PRIdPTR" (%p), text_end: %"PRIdPTR" (%p), text_range: %"PRIdPTR" (%p)\n",
- (intptr_t )text, text, (intptr_t )text_end, text_end, (intptr_t )text_range, text_range);
+ fprintf(stderr, "bm_search_notrev: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n",
+ (int )text, text, (int )text_end, text_end, (int )text_range, text_range);
#endif
tail = target_end - 1;
@@ -3563,8 +3398,8 @@ bm_search_notrev_ic(regex_t* reg, const UChar* target, const UChar* target_end,
int case_fold_flag = reg->case_fold_flag;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "bm_search_notrev_ic: text: %"PRIdPTR" (%p), text_end: %"PRIdPTR" (%p), text_range: %"PRIdPTR" (%p)\n",
- (intptr_t )text, text, (intptr_t )text_end, text_end, (intptr_t )text_range, text_range);
+ fprintf(stderr, "bm_search_notrev_ic: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n",
+ (int )text, text, (int )text_end, text_end, (int )text_range, text_range);
#endif
tail = target_end - 1;
@@ -3619,8 +3454,8 @@ bm_search_ic(regex_t* reg, const UChar* target, const UChar* target_end,
int case_fold_flag = reg->case_fold_flag;
#ifdef ONIG_DEBUG_SEARCH
- fprintf(stderr, "bm_search_ic: text: %"PRIdPTR" (%p), text_end: %"PRIdPTR" (%p), text_range: %"PRIdPTR" (%p)\n",
- (intptr_t )text, text, (intptr_t )text_end, text_end, (intptr_t )text_range, text_range);
+ fprintf(stderr, "bm_search_ic: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n",
+ (int )text, text, (int )text_end, text_end, (int )text_range, text_range);
#endif
tail = target_end - 1;
@@ -3806,7 +3641,7 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
#ifdef ONIG_DEBUG_SEARCH
fprintf(stderr, "forward_search_range: str: %"PRIuPTR" (%p), end: %"PRIuPTR" (%p), s: %"PRIuPTR" (%p), range: %"PRIuPTR" (%p)\n",
- (intptr_t )str, str, (intptr_t )end, end, (intptr_t )s, s, (intptr_t )range, range);
+ str, str, end, end, s, s, range, range);
#endif
p = s;
@@ -3919,8 +3754,8 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
#ifdef ONIG_DEBUG_SEARCH
fprintf(stderr,
- "forward_search_range success: low: %"PRIdPTR", high: %"PRIdPTR", dmin: %"PRIdPTR", dmax: %"PRIdPTR"\n",
- *low - str, *high - str, reg->dmin, reg->dmax);
+ "forward_search_range success: low: %d, high: %d, dmin: %d, dmax: %d\n",
+ (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax);
#endif
return 1; /* success */
}
@@ -3928,6 +3763,9 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
return 0; /* fail */
}
+static int set_bm_backward_skip P_((UChar* s, UChar* end, OnigEncoding enc,
+ int** skip));
+
#define BM_BACKWARD_SEARCH_LENGTH_THRESHOLD 100
static int
@@ -4081,7 +3919,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
#ifdef ONIG_DEBUG_SEARCH
fprintf(stderr,
"onig_search (entry point): str: %"PRIuPTR" (%p), end: %"PRIuPTR", start: %"PRIuPTR", range: %"PRIuPTR"\n",
- (intptr_t )str, str, end - str, start - str, range - str);
+ str, str, end - str, start - str, range - str);
#endif
if (region
@@ -4319,7 +4157,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
prev = s;
s += enclen(reg->enc, s, end);
- if ((reg->anchor & (ANCHOR_LOOK_BEHIND | ANCHOR_PREC_READ_NOT)) == 0) {
+ if ((reg->anchor & ANCHOR_LOOK_BEHIND) == 0) {
while (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0)
&& s < range) {
prev = s;
@@ -4343,6 +4181,11 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
}
}
else { /* backward search */
+#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
+ if (orig_start < end)
+ orig_start += enclen(reg->enc, orig_start, end); /* is upper range */
+#endif
+
if (reg->optimize != ONIG_OPTIMIZE_NONE) {
UChar *low, *high, *adjrange, *sch_start;
@@ -4425,7 +4268,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
#ifdef ONIG_DEBUG
if (r != ONIG_MISMATCH)
- fprintf(stderr, "onig_search: error %"PRIdPTRDIFF"\n", r);
+ fprintf(stderr, "onig_search: error %d\n", r);
#endif
return r;
@@ -4435,7 +4278,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
ONIG_STATE_DEC_THREAD(reg);
#ifdef ONIG_DEBUG
if (r != ONIG_MISMATCH)
- fprintf(stderr, "onig_search: error %"PRIdPTRDIFF"\n", r);
+ fprintf(stderr, "onig_search: error %d\n", r);
#endif
return r;
@@ -4493,7 +4336,7 @@ onig_number_of_capture_histories(regex_t* reg)
}
extern void
-onig_copy_encoding(OnigEncodingType *to, OnigEncoding from)
+onig_copy_encoding(OnigEncoding to, OnigEncoding from)
{
*to = *from;
}
diff --git a/regint.h b/regint.h
index 9fda5509a9..a3e92ee217 100644
--- a/regint.h
+++ b/regint.h
@@ -4,8 +4,8 @@
regint.h - Onigmo (Oniguruma-mod) (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2011-2012 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,6 @@
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
- defined(__powerpc64__) || \
defined(__mc68020__)
#define PLATFORM_UNALIGNED_WORD_ACCESS
#endif
@@ -93,6 +92,8 @@
# define ARG_UNUSED
#endif
+/* */
+/* escape other system UChar definition */
#ifndef RUBY_DEFINES_H
#include "ruby/ruby.h"
#undef xmalloc
@@ -100,67 +101,23 @@
#undef xcalloc
#undef xfree
#endif
-
-/* */
-/* escape other system UChar definition */
#ifdef ONIG_ESCAPE_UCHAR_COLLISION
#undef ONIG_ESCAPE_UCHAR_COLLISION
#endif
-
#define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */
+#undef USE_MATCH_RANGE_IS_COMPLETE_RANGE
#undef USE_CAPTURE_HISTORY
#define USE_VARIABLE_META_CHARS
#define USE_POSIX_API_REGION_OPTION /* needed for POSIX API support */
#define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
/* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */
-/* multithread config */
/* #define USE_MULTI_THREAD_SYSTEM */
-/* #define USE_DEFAULT_MULTI_THREAD_SYSTEM */
-
-#if defined(USE_MULTI_THREAD_SYSTEM) \
- && defined(USE_DEFAULT_MULTI_THREAD_SYSTEM)
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-extern CRITICAL_SECTION gOnigMutex;
-#define THREAD_SYSTEM_INIT InitializeCriticalSection(&gOnigMutex)
-#define THREAD_SYSTEM_END DeleteCriticalSection(&gOnigMutex)
-#define THREAD_ATOMIC_START EnterCriticalSection(&gOnigMutex)
-#define THREAD_ATOMIC_END LeaveCriticalSection(&gOnigMutex)
-#define THREAD_PASS Sleep(0)
-#else /* _WIN32 */
-#include <pthread.h>
-#include <sched.h>
-extern pthread_mutex_t gOnigMutex;
-#define THREAD_SYSTEM_INIT pthread_mutex_init(&gOnigMutex, NULL)
-#define THREAD_SYSTEM_END pthread_mutex_destroy(&gOnigMutex)
-#define THREAD_ATOMIC_START pthread_mutex_lock(&gOnigMutex)
-#define THREAD_ATOMIC_END pthread_mutex_unlock(&gOnigMutex)
-#define THREAD_PASS sched_yield()
-#endif /* _WIN32 */
-
-#else /* USE_DEFAULT_MULTI_THREAD_SYSTEM */
-
-#ifndef THREAD_SYSTEM_INIT
#define THREAD_SYSTEM_INIT /* depend on thread system */
-#endif
-#ifndef THREAD_SYSTEM_END
#define THREAD_SYSTEM_END /* depend on thread system */
-#endif
-#ifndef THREAD_ATOMIC_START
#define THREAD_ATOMIC_START /* depend on thread system */
-#endif
-#ifndef THREAD_ATOMIC_END
#define THREAD_ATOMIC_END /* depend on thread system */
-#endif
-#ifndef THREAD_PASS
#define THREAD_PASS /* depend on thread system */
-#endif
-
-#endif /* USE_DEFAULT_MULTI_THREAD_SYSTEM */
-
#ifndef xmalloc
#define xmalloc malloc
#define xrealloc realloc
@@ -193,8 +150,6 @@ extern pthread_mutex_t gOnigMutex;
#define USE_UPPER_CASE_TABLE
#else
-#define CHECK_INTERRUPT_IN_MATCH_AT
-
#define st_init_table onig_st_init_table
#define st_init_table_with_size onig_st_init_table_with_size
#define st_init_numtable onig_st_init_numtable
@@ -215,6 +170,8 @@ extern pthread_mutex_t gOnigMutex;
/* */
#define onig_st_is_member st_is_member
+#define CHECK_INTERRUPT_IN_MATCH_AT
+
#endif
#define STATE_CHECK_STRING_THRESHOLD_LEN 7
@@ -278,16 +235,12 @@ extern pthread_mutex_t gOnigMutex;
# include <stdint.h>
#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-
#ifdef STDC_HEADERS
# include <stddef.h>
#endif
-#ifdef _WIN32
-#include <malloc.h> /* for alloca() */
+#ifdef __BORLANDC__
+#include <malloc.h>
#endif
#ifdef ONIG_DEBUG
@@ -307,18 +260,6 @@ typedef unsigned int uintptr_t;
#endif
#endif /* _WIN32 */
-#ifndef PRIdPTR
-#ifdef _WIN64
-#define PRIdPTR "I64d"
-#define PRIuPTR "I64u"
-#define PRIxPTR "I64x"
-#else
-#define PRIdPTR "ld"
-#define PRIuPTR "lu"
-#define PRIxPTR "lx"
-#endif
-#endif
-
#include "regenc.h"
RUBY_SYMBOL_EXPORT_BEGIN
@@ -392,17 +333,17 @@ typedef unsigned int BitStatusType;
#define BIT_STATUS_CLEAR(stats) (stats) = 0
#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
#define BIT_STATUS_AT(stats,n) \
- ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & ((BitStatusType )1 << n)) : ((stats) & 1))
+ ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1))
#define BIT_STATUS_ON_AT(stats,n) do {\
- if ((n) < (int )BIT_STATUS_BITS_NUM)\
+ if ((n) < (int )BIT_STATUS_BITS_NUM) \
(stats) |= (1 << (n));\
else\
(stats) |= 1;\
} while (0)
#define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
- if ((n) < (int )BIT_STATUS_BITS_NUM)\
+ if ((n) < (int )BIT_STATUS_BITS_NUM)\
(stats) |= (1 << (n));\
} while (0)
@@ -425,8 +366,6 @@ typedef unsigned int BitStatusType;
(ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY))
#define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
#define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
-#define IS_NOTBOS(option) ((option) & ONIG_OPTION_NOTBOS)
-#define IS_NOTEOS(option) ((option) & ONIG_OPTION_NOTEOS)
#define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
#define IS_ASCII_RANGE(option) ((option) & ONIG_OPTION_ASCII_RANGE)
#define IS_POSIX_BRACKET_ALL_RANGE(option) ((option) & ONIG_OPTION_POSIX_BRACKET_ALL_RANGE)
@@ -468,7 +407,7 @@ typedef Bits* BitSetRef;
} while (0)
#define BS_ROOM(bs,pos) (bs)[(int )(pos) / BITS_IN_ROOM]
-#define BS_BIT(pos) (1U << ((int )(pos) % BITS_IN_ROOM))
+#define BS_BIT(pos) (1 << ((int )(pos) % BITS_IN_ROOM))
#define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
#define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
@@ -485,29 +424,23 @@ typedef struct _BBuf {
#define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
#define BBUF_SIZE_INC(buf,inc) do{\
- UChar *tmp;\
(buf)->alloc += (inc);\
- tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
- if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
- (buf)->p = tmp;\
+ (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
+ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
} while (0)
#define BBUF_EXPAND(buf,low) do{\
- UChar *tmp;\
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
- tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
- if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
- (buf)->p = tmp;\
+ (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
+ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
} while (0)
#define BBUF_ENSURE_SIZE(buf,size) do{\
unsigned int new_alloc = (buf)->alloc;\
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
if ((buf)->alloc != new_alloc) {\
- UChar *tmp;\
- tmp = (UChar* )xrealloc((buf)->p, new_alloc);\
- if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
- (buf)->p = tmp;\
+ (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
+ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
(buf)->alloc = new_alloc;\
}\
} while (0)
@@ -909,14 +842,6 @@ typedef struct {
#define IS_CODE_SB_WORD(enc,code) \
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
-typedef struct OnigEndCallListItem {
- struct OnigEndCallListItem* next;
- void (*func)(void);
-} OnigEndCallListItemType;
-
-extern void onig_add_end_call(void (*func)(void));
-
-
#ifdef ONIG_DEBUG
typedef struct {
@@ -927,8 +852,7 @@ typedef struct {
extern OnigOpInfoType OnigOpInfo[];
-
-extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc));
+/* extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc)); */
#ifdef ONIG_DEBUG_STATISTICS
extern void onig_statistics_init P_((void));
diff --git a/regparse.c b/regparse.c
index cc48945c3c..774ee0a960 100644
--- a/regparse.c
+++ b/regparse.c
@@ -3,7 +3,7 @@
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -281,14 +281,6 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end)
p += enclen(enc, p, end); \
} while (0)
-#define PINC_S do { \
- p += enclen(enc, p, end); \
-} while (0)
-#define PFETCH_S(c) do { \
- c = ((enc->max_enc_len == 1) ? *p : ONIGENC_MBC_TO_CODE(enc, p, end)); \
- p += enclen(enc, p, end); \
-} while (0)
-
#define PPEEK (p < end ? ONIGENC_MBC_TO_CODE(enc, p, end) : PEND_VALUE)
#define PPEEK_IS(c) (PPEEK == (OnigCodePoint )c)
@@ -986,8 +978,6 @@ scan_env_add_mem_entry(ScanEnv* env)
Node** p;
need = env->num_mem + 1;
- if (need > ONIG_MAX_CAPTURE_GROUP_NUM)
- return ONIGERR_TOO_MANY_CAPTURE_GROUPS;
if (need >= SCANENV_MEMNODES_SIZE) {
if (env->mem_alloc <= need) {
if (IS_NULL(env->mem_nodes_dynamic)) {
@@ -1153,25 +1143,6 @@ node_new(void)
return node;
}
-#if defined(USE_MULTI_THREAD_SYSTEM) && \
- defined(USE_SHARED_CCLASS_TABLE) && \
- defined(USE_PARSE_TREE_NODE_RECYCLE)
-static Node*
-node_new_locked(void)
-{
- Node* node;
-
- if (IS_NOT_NULL(FreeNodeList)) {
- node = (Node* )FreeNodeList;
- FreeNodeList = FreeNodeList->next;
- return node;
- }
-
- node = (Node* )xmalloc(sizeof(Node));
- /* xmemset(node, 0, sizeof(Node)); */
- return node;
-}
-#endif
static void
initialize_cclass(CClassNode* cc)
@@ -1193,24 +1164,6 @@ node_new_cclass(void)
return node;
}
-#if defined(USE_MULTI_THREAD_SYSTEM) && \
- defined(USE_SHARED_CCLASS_TABLE) && \
- defined(USE_PARSE_TREE_NODE_RECYCLE)
-static Node*
-node_new_cclass_locked(void)
-{
- Node* node = node_new_locked();
- CHECK_NULL_RETURN(node);
-
- SET_NTYPE(node, NT_CCLASS);
- initialize_cclass(NCCLASS(node));
- return node;
-}
-#else
-#define node_new_cclass_locked() node_new_cclass()
-#endif
-
-#ifdef USE_SHARED_CCLASS_TABLE
static Node*
node_new_cclass_by_codepoint_range(int not, OnigCodePoint sb_out,
const OnigCodePoint ranges[])
@@ -1219,7 +1172,7 @@ node_new_cclass_by_codepoint_range(int not, OnigCodePoint sb_out,
CClassNode* cc;
OnigCodePoint j;
- Node* node = node_new_cclass_locked();
+ Node* node = node_new_cclass();
CHECK_NULL_RETURN(node);
cc = NCCLASS(node);
@@ -1260,7 +1213,6 @@ node_new_cclass_by_codepoint_range(int not, OnigCodePoint sb_out,
return node;
}
-#endif /* USE_SHARED_CCLASS_TABLE */
static Node*
node_new_ctype(int type, int not, int ascii_range)
@@ -2534,21 +2486,22 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env)
OnigCodePoint c;
OnigEncoding enc = env->enc;
UChar* p = *src;
+ PFETCH_READY;
if (PEND) return ONIGERR_END_PATTERN_AT_ESCAPE;
- PFETCH_S(c);
+ PFETCH(c);
switch (c) {
case 'M':
if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META)) {
if (PEND) return ONIGERR_END_PATTERN_AT_META;
- PFETCH_S(c);
+ PFETCH(c);
if (c != '-') return ONIGERR_META_CODE_SYNTAX;
if (PEND) return ONIGERR_END_PATTERN_AT_META;
- PFETCH_S(c);
+ PFETCH(c);
if (c == MC_ESC(env->syntax)) {
- v = fetch_escaped_value(&p, end, env);
- if (v < 0) return v;
+ v = fetch_escaped_value(&p, end, env);
+ if (v < 0) return v;
c = (OnigCodePoint )v;
}
c = ((c & 0xff) | 0x80);
@@ -2560,7 +2513,7 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env)
case 'C':
if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL)) {
if (PEND) return ONIGERR_END_PATTERN_AT_CONTROL;
- PFETCH_S(c);
+ PFETCH(c);
if (c != '-') return ONIGERR_CONTROL_CODE_SYNTAX;
goto control;
}
@@ -2571,9 +2524,9 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env)
if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_C_CONTROL)) {
control:
if (PEND) return ONIGERR_END_PATTERN_AT_CONTROL;
- PFETCH_S(c);
+ PFETCH(c);
if (c == '?') {
- c = 0177;
+ c = 0177;
}
else {
if (c == MC_ESC(env->syntax)) {
@@ -2581,7 +2534,7 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env)
if (v < 0) return v;
c = (OnigCodePoint )v;
}
- c &= 0x9f;
+ c &= 0x9f;
}
break;
}
@@ -2677,11 +2630,11 @@ fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end,
if (is_num != 0) {
if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
- is_num = 1;
+ is_num = 1;
}
else {
- r = ONIGERR_INVALID_GROUP_NAME;
- is_num = 0;
+ r = ONIGERR_INVALID_GROUP_NAME;
+ is_num = 0;
}
}
else if (!ONIGENC_IS_CODE_WORD(enc, c)) {
@@ -2748,6 +2701,7 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
UChar *name_end;
UChar *pnum_head;
UChar *p = *src;
+ PFETCH_READY;
*rback_num = 0;
@@ -2762,23 +2716,23 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
return ONIGERR_EMPTY_GROUP_NAME;
}
else {
- PFETCH_S(c);
+ PFETCH(c);
if (c == end_code)
return ONIGERR_EMPTY_GROUP_NAME;
if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
if (ref == 1)
- is_num = 1;
+ is_num = 1;
else {
- r = ONIGERR_INVALID_GROUP_NAME;
- is_num = 0;
+ r = ONIGERR_INVALID_GROUP_NAME;
+ is_num = 0;
}
}
else if (c == '-') {
if (ref == 1) {
- is_num = 2;
- sign = -1;
- pnum_head = p;
+ is_num = 2;
+ sign = -1;
+ pnum_head = p;
}
else {
r = ONIGERR_INVALID_GROUP_NAME;
@@ -2793,28 +2747,29 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
if (r == 0) {
while (!PEND) {
name_end = p;
- PFETCH_S(c);
+ PFETCH(c);
if (c == end_code || c == ')') {
if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME;
break;
}
if (is_num != 0) {
- if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
- is_num = 1;
- }
- else {
- if (!ONIGENC_IS_CODE_WORD(enc, c))
- r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
- else
- r = ONIGERR_INVALID_GROUP_NAME;
- is_num = 0;
- }
+ if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
+ is_num = 1;
+ }
+ else {
+ if (!ONIGENC_IS_CODE_WORD(enc, c))
+ r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
+ else
+ r = ONIGERR_INVALID_GROUP_NAME;
+
+ is_num = 0;
+ }
}
else {
- if (!ONIGENC_IS_CODE_WORD(enc, c)) {
- r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
- }
+ if (!ONIGENC_IS_CODE_WORD(enc, c)) {
+ r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
+ }
}
}
@@ -2827,8 +2782,8 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
*rback_num = onig_scan_unsigned_number(&pnum_head, name_end, enc);
if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER;
else if (*rback_num == 0) {
- r = ONIGERR_INVALID_GROUP_NAME;
- goto err;
+ r = ONIGERR_INVALID_GROUP_NAME;
+ goto err;
}
*rback_num *= sign;
@@ -2841,9 +2796,9 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
else {
while (!PEND) {
name_end = p;
- PFETCH_S(c);
+ PFETCH(c);
if (c == end_code || c == ')')
- break;
+ break;
}
if (PEND)
name_end = end;
@@ -3222,7 +3177,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
PUNFETCH;
prev = p;
num = scan_unsigned_octal_number(&p, end, 3, enc);
- if (num < 0 || 0xff < num) return ONIGERR_TOO_BIG_NUMBER;
+ if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
if (p == prev) { /* can't read nothing. */
num = 0; /* but, it's not error */
}
@@ -4153,13 +4108,16 @@ add_ctype_to_cc_by_range(CClassNode* cc, int ctype ARG_UNUSED, int not,
}
static int
-add_ctype_to_cc(CClassNode* cc, int ctype, int not, int ascii_range, ScanEnv* env)
+add_ctype_to_cc(CClassNode* cc, int ctype, int not, int char_prop, ScanEnv* env)
{
- int maxcode;
+ int maxcode, ascii_range;
int c, r;
const OnigCodePoint *ranges;
OnigCodePoint sb_out;
OnigEncoding enc = env->enc;
+ OnigOptionType option = env->option;
+
+ ascii_range = IS_ASCII_RANGE(option) && (char_prop == 0);
r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &sb_out, &ranges);
if (r == 0) {
@@ -4277,38 +4235,38 @@ add_ctype_to_cc(CClassNode* cc, int ctype, int not, int ascii_range, ScanEnv* en
}
static int
-parse_posix_bracket(CClassNode* cc, CClassNode* asc_cc,
- UChar** src, UChar* end, ScanEnv* env)
+parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
{
#define POSIX_BRACKET_CHECK_LIMIT_LENGTH 20
#define POSIX_BRACKET_NAME_MIN_LEN 4
static const PosixBracketEntryType PBS[] = {
- POSIX_BRACKET_ENTRY_INIT("alnum", ONIGENC_CTYPE_ALNUM),
- POSIX_BRACKET_ENTRY_INIT("alpha", ONIGENC_CTYPE_ALPHA),
- POSIX_BRACKET_ENTRY_INIT("blank", ONIGENC_CTYPE_BLANK),
- POSIX_BRACKET_ENTRY_INIT("cntrl", ONIGENC_CTYPE_CNTRL),
- POSIX_BRACKET_ENTRY_INIT("digit", ONIGENC_CTYPE_DIGIT),
- POSIX_BRACKET_ENTRY_INIT("graph", ONIGENC_CTYPE_GRAPH),
- POSIX_BRACKET_ENTRY_INIT("lower", ONIGENC_CTYPE_LOWER),
- POSIX_BRACKET_ENTRY_INIT("print", ONIGENC_CTYPE_PRINT),
- POSIX_BRACKET_ENTRY_INIT("punct", ONIGENC_CTYPE_PUNCT),
- POSIX_BRACKET_ENTRY_INIT("space", ONIGENC_CTYPE_SPACE),
- POSIX_BRACKET_ENTRY_INIT("upper", ONIGENC_CTYPE_UPPER),
- POSIX_BRACKET_ENTRY_INIT("xdigit", ONIGENC_CTYPE_XDIGIT),
- POSIX_BRACKET_ENTRY_INIT("ascii", ONIGENC_CTYPE_ASCII),
- POSIX_BRACKET_ENTRY_INIT("word", ONIGENC_CTYPE_WORD),
+ { (UChar* )"alnum", ONIGENC_CTYPE_ALNUM, 5 },
+ { (UChar* )"alpha", ONIGENC_CTYPE_ALPHA, 5 },
+ { (UChar* )"blank", ONIGENC_CTYPE_BLANK, 5 },
+ { (UChar* )"cntrl", ONIGENC_CTYPE_CNTRL, 5 },
+ { (UChar* )"digit", ONIGENC_CTYPE_DIGIT, 5 },
+ { (UChar* )"graph", ONIGENC_CTYPE_GRAPH, 5 },
+ { (UChar* )"lower", ONIGENC_CTYPE_LOWER, 5 },
+ { (UChar* )"print", ONIGENC_CTYPE_PRINT, 5 },
+ { (UChar* )"punct", ONIGENC_CTYPE_PUNCT, 5 },
+ { (UChar* )"space", ONIGENC_CTYPE_SPACE, 5 },
+ { (UChar* )"upper", ONIGENC_CTYPE_UPPER, 5 },
+ { (UChar* )"xdigit", ONIGENC_CTYPE_XDIGIT, 6 },
+ { (UChar* )"ascii", ONIGENC_CTYPE_ASCII, 5 },
+ { (UChar* )"word", ONIGENC_CTYPE_WORD, 4 },
+ { (UChar* )NULL, -1, 0 }
};
const PosixBracketEntryType *pb;
int not, i, r;
- int ascii_range;
OnigCodePoint c;
OnigEncoding enc = env->enc;
UChar *p = *src;
+ PFETCH_READY;
if (PPEEK_IS('^')) {
- PINC_S;
+ PINC;
not = 1;
}
else
@@ -4317,26 +4275,18 @@ parse_posix_bracket(CClassNode* cc, CClassNode* asc_cc,
if (onigenc_strlen(enc, p, end) < POSIX_BRACKET_NAME_MIN_LEN + 3)
goto not_posix_bracket;
- ascii_range = IS_ASCII_RANGE(env->option) &&
- ! IS_POSIX_BRACKET_ALL_RANGE(env->option);
- for (pb = PBS; pb < PBS + numberof(PBS); pb++) {
+ for (pb = PBS; IS_NOT_NULL(pb->name); pb++) {
if (onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0) {
p = (UChar* )onigenc_step(enc, p, end, pb->len);
if (onigenc_with_ascii_strncmp(enc, p, end, (UChar* )":]", 2) != 0)
- return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
+ return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
- r = add_ctype_to_cc(cc, pb->ctype, not, ascii_range, env);
+ r = add_ctype_to_cc(cc, pb->ctype, not,
+ IS_POSIX_BRACKET_ALL_RANGE(env->option),
+ env);
if (r != 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- if (pb->ctype != ONIGENC_CTYPE_WORD &&
- pb->ctype != ONIGENC_CTYPE_ASCII &&
- !ascii_range)
- r = add_ctype_to_cc(asc_cc, pb->ctype, not, ascii_range, env);
- if (r != 0) return r;
- }
-
- PINC_S; PINC_S;
+ PINC; PINC;
*src = p;
return 0;
}
@@ -4346,15 +4296,15 @@ parse_posix_bracket(CClassNode* cc, CClassNode* asc_cc,
c = 0;
i = 0;
while (!PEND && ((c = PPEEK) != ':') && c != ']') {
- PINC_S;
+ PINC;
if (++i > POSIX_BRACKET_CHECK_LIMIT_LENGTH) break;
}
if (c == ':' && ! PEND) {
- PINC_S;
+ PINC;
if (! PEND) {
- PFETCH_S(c);
+ PFETCH(c);
if (c == ']')
- return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
+ return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
}
}
@@ -4368,13 +4318,14 @@ fetch_char_property_to_ctype(UChar** src, UChar* end, ScanEnv* env)
OnigCodePoint c;
OnigEncoding enc = env->enc;
UChar *prev, *start, *p = *src;
+ PFETCH_READY;
r = 0;
start = prev = p;
while (!PEND) {
prev = p;
- PFETCH_S(c);
+ PFETCH(c);
if (c == '}') {
r = ONIGENC_PROPERTY_NAME_TO_CTYPE(enc, start, prev);
if (r < 0) break;
@@ -4392,8 +4343,6 @@ fetch_char_property_to_ctype(UChar** src, UChar* end, ScanEnv* env)
return r;
}
-static int cclass_case_fold(Node** np, CClassNode* cc, CClassNode* asc_cc, ScanEnv* env);
-
static int
parse_char_property(Node** np, OnigToken* tok, UChar** src, UChar* end,
ScanEnv* env)
@@ -4407,15 +4356,11 @@ parse_char_property(Node** np, OnigToken* tok, UChar** src, UChar* end,
*np = node_new_cclass();
CHECK_NULL_RETURN_MEMERR(*np);
cc = NCCLASS(*np);
- r = add_ctype_to_cc(cc, ctype, 0, 0, env);
+ r = add_ctype_to_cc(cc, ctype, 0, 1, env);
if (r != 0) return r;
if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
- if (IS_IGNORECASE(env->option)) {
- if (ctype != ONIGENC_CTYPE_ASCII)
- r = cclass_case_fold(np, cc, cc, env);
- }
- return r;
+ return 0;
}
@@ -4433,8 +4378,7 @@ enum CCVALTYPE {
};
static int
-next_state_class(CClassNode* cc, CClassNode* asc_cc,
- OnigCodePoint* vs, enum CCVALTYPE* type,
+next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,
enum CCSTATE* state, ScanEnv* env)
{
int r;
@@ -4443,18 +4387,11 @@ next_state_class(CClassNode* cc, CClassNode* asc_cc,
return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE;
if (*state == CCS_VALUE && *type != CCV_CLASS) {
- if (*type == CCV_SB) {
+ if (*type == CCV_SB)
BITSET_SET_BIT_CHKDUP(cc->bs, (int )(*vs));
- if (IS_NOT_NULL(asc_cc))
- BITSET_SET_BIT(asc_cc->bs, (int )(*vs));
- }
else if (*type == CCV_CODE_POINT) {
r = add_code_range(&(cc->mbuf), env, *vs, *vs);
if (r < 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- r = add_code_range0(&(asc_cc->mbuf), env, *vs, *vs, 0);
- if (r < 0) return r;
- }
}
}
@@ -4464,8 +4401,7 @@ next_state_class(CClassNode* cc, CClassNode* asc_cc,
}
static int
-next_state_val(CClassNode* cc, CClassNode* asc_cc,
- OnigCodePoint *vs, OnigCodePoint v,
+next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
int* vs_israw, int v_israw,
enum CCVALTYPE intype, enum CCVALTYPE* type,
enum CCSTATE* state, ScanEnv* env)
@@ -4474,18 +4410,11 @@ next_state_val(CClassNode* cc, CClassNode* asc_cc,
switch (*state) {
case CCS_VALUE:
- if (*type == CCV_SB) {
+ if (*type == CCV_SB)
BITSET_SET_BIT_CHKDUP(cc->bs, (int )(*vs));
- if (IS_NOT_NULL(asc_cc))
- BITSET_SET_BIT(asc_cc->bs, (int )(*vs));
- }
else if (*type == CCV_CODE_POINT) {
r = add_code_range(&(cc->mbuf), env, *vs, *vs);
if (r < 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- r = add_code_range0(&(asc_cc->mbuf), env, *vs, *vs, 0);
- if (r < 0) return r;
- }
}
break;
@@ -4502,16 +4431,10 @@ next_state_val(CClassNode* cc, CClassNode* asc_cc,
return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;
}
bitset_set_range(env, cc->bs, (int )*vs, (int )v);
- if (IS_NOT_NULL(asc_cc))
- bitset_set_range(env, asc_cc->bs, (int )*vs, (int )v);
}
else {
r = add_code_range(&(cc->mbuf), env, *vs, v);
if (r < 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- r = add_code_range0(&(asc_cc->mbuf), env, *vs, v, 0);
- if (r < 0) return r;
- }
}
}
else {
@@ -4527,11 +4450,6 @@ next_state_val(CClassNode* cc, CClassNode* asc_cc,
bitset_set_range(env, cc->bs, (int )*vs, (int )(v < 0xff ? v : 0xff));
r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*vs, v);
if (r < 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- bitset_set_range(env, asc_cc->bs, (int )*vs, (int )(v < 0xff ? v : 0xff));
- r = add_code_range0(&(asc_cc->mbuf), env, (OnigCodePoint )*vs, v, 0);
- if (r < 0) return r;
- }
#if 0
}
else
@@ -4565,6 +4483,7 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped,
OnigCodePoint code;
OnigEncoding enc = env->enc;
UChar* p = from;
+ PFETCH_READY;
in_esc = 0;
while (! PEND) {
@@ -4572,7 +4491,7 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped,
in_esc = 0;
}
else {
- PFETCH_S(code);
+ PFETCH(code);
if (code == c) return 1;
if (code == MC_ESC(env->syntax)) in_esc = 1;
}
@@ -4581,24 +4500,22 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped,
}
static int
-parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* end,
+parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
ScanEnv* env)
{
int r, neg, len, fetched, and_start;
OnigCodePoint v, vs;
UChar *p;
Node* node;
- Node* asc_node;
CClassNode *cc, *prev_cc;
- CClassNode *asc_cc, *asc_prev_cc;
- CClassNode work_cc, asc_work_cc;
+ CClassNode work_cc;
enum CCSTATE state;
enum CCVALTYPE val_type, in_type;
int val_israw, in_israw;
- prev_cc = asc_prev_cc = (CClassNode* )NULL;
- *np = *asc_np = NULL_NODE;
+ prev_cc = (CClassNode* )NULL;
+ *np = NULL_NODE;
r = fetch_token_in_cc(tok, src, end, env);
if (r == TK_CHAR && tok->u.c == '^' && tok->escaped == 0) {
neg = 1;
@@ -4622,16 +4539,6 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
CHECK_NULL_RETURN_MEMERR(node);
cc = NCCLASS(node);
- if (IS_IGNORECASE(env->option)) {
- *asc_np = asc_node = node_new_cclass();
- CHECK_NULL_RETURN_MEMERR(asc_node);
- asc_cc = NCCLASS(asc_node);
- }
- else {
- asc_node = NULL_NODE;
- asc_cc = NULL;
- }
-
and_start = 0;
state = CCS_START;
p = *src;
@@ -4722,13 +4629,13 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
}
in_type = (len == 1 ? CCV_SB : CCV_CODE_POINT);
val_entry2:
- r = next_state_val(cc, asc_cc, &vs, v, &val_israw, in_israw, in_type, &val_type,
+ r = next_state_val(cc, &vs, v, &val_israw, in_israw, in_type, &val_type,
&state, env);
if (r != 0) goto err;
break;
case TK_POSIX_BRACKET_OPEN:
- r = parse_posix_bracket(cc, asc_cc, &p, end, env);
+ r = parse_posix_bracket(cc, &p, end, env);
if (r < 0) goto err;
if (r == 1) { /* is not POSIX bracket */
CC_ESC_WARN(env, (UChar* )"[");
@@ -4741,18 +4648,11 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
break;
case TK_CHAR_TYPE:
- r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not,
- IS_ASCII_RANGE(env->option), env);
+ r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not, 0, env);
if (r != 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- if (tok->u.prop.ctype != ONIGENC_CTYPE_WORD)
- r = add_ctype_to_cc(asc_cc, tok->u.prop.ctype, tok->u.prop.not,
- IS_ASCII_RANGE(env->option), env);
- if (r != 0) return r;
- }
next_class:
- r = next_state_class(cc, asc_cc, &vs, &val_type, &state, env);
+ r = next_state_class(cc, &vs, &val_type, &state, env);
if (r != 0) goto err;
break;
@@ -4762,13 +4662,8 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
ctype = fetch_char_property_to_ctype(&p, end, env);
if (ctype < 0) return ctype;
- r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, 0, env);
+ r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, 1, env);
if (r != 0) return r;
- if (IS_NOT_NULL(asc_cc)) {
- if (ctype != ONIGENC_CTYPE_ASCII)
- r = add_ctype_to_cc(asc_cc, ctype, tok->u.prop.not, 0, env);
- if (r != 0) return r;
- }
goto next_class;
}
break;
@@ -4829,20 +4724,15 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
case TK_CC_CC_OPEN: /* [ */
{
- Node *anode, *aasc_node;
+ Node *anode;
CClassNode* acc;
- r = parse_char_class(&anode, &aasc_node, tok, &p, end, env);
+ r = parse_char_class(&anode, tok, &p, end, env);
if (r == 0) {
acc = NCCLASS(anode);
r = or_cclass(cc, acc, env);
}
- if (r == 0 && IS_NOT_NULL(aasc_node)) {
- acc = NCCLASS(aasc_node);
- r = or_cclass(asc_cc, acc, env);
- }
onig_node_free(anode);
- onig_node_free(aasc_node);
if (r != 0) goto err;
}
break;
@@ -4850,7 +4740,7 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
case TK_CC_AND: /* && */
{
if (state == CCS_VALUE) {
- r = next_state_val(cc, asc_cc, &vs, 0, &val_israw, 0, val_type,
+ r = next_state_val(cc, &vs, 0, &val_israw, 0, val_type,
&val_type, &state, env);
if (r != 0) goto err;
}
@@ -4862,23 +4752,12 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
r = and_cclass(prev_cc, cc, env);
if (r != 0) goto err;
bbuf_free(cc->mbuf);
- if (IS_NOT_NULL(asc_cc)) {
- r = and_cclass(asc_prev_cc, asc_cc, env);
- if (r != 0) goto err;
- bbuf_free(asc_cc->mbuf);
- }
}
else {
prev_cc = cc;
cc = &work_cc;
- if (IS_NOT_NULL(asc_cc)) {
- asc_prev_cc = asc_cc;
- asc_cc = &asc_work_cc;
- }
}
initialize_cclass(cc);
- if (IS_NOT_NULL(asc_cc))
- initialize_cclass(asc_cc);
}
break;
@@ -4901,7 +4780,7 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
}
if (state == CCS_VALUE) {
- r = next_state_val(cc, asc_cc, &vs, 0, &val_israw, 0, val_type,
+ r = next_state_val(cc, &vs, 0, &val_israw, 0, val_type,
&val_type, &state, env);
if (r != 0) goto err;
}
@@ -4911,24 +4790,12 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
if (r != 0) goto err;
bbuf_free(cc->mbuf);
cc = prev_cc;
- if (IS_NOT_NULL(asc_cc)) {
- r = and_cclass(asc_prev_cc, asc_cc, env);
- if (r != 0) goto err;
- bbuf_free(asc_cc->mbuf);
- asc_cc = asc_prev_cc;
- }
}
- if (neg != 0) {
+ if (neg != 0)
NCCLASS_SET_NOT(cc);
- if (IS_NOT_NULL(asc_cc))
- NCCLASS_SET_NOT(asc_cc);
- }
- else {
+ else
NCCLASS_CLEAR_NOT(cc);
- if (IS_NOT_NULL(asc_cc))
- NCCLASS_CLEAR_NOT(asc_cc);
- }
if (IS_NCCLASS_NOT(cc) &&
IS_SYNTAX_BV(env->syntax, ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC)) {
int is_empty;
@@ -4956,8 +4823,6 @@ parse_char_class(Node** np, Node** asc_np, OnigToken* tok, UChar** src, UChar* e
err:
if (cc != NCCLASS(*np))
bbuf_free(cc->mbuf);
- if (IS_NOT_NULL(asc_cc) && (asc_cc != NCCLASS(*asc_np)))
- bbuf_free(asc_cc->mbuf);
return r;
}
@@ -5095,10 +4960,14 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
*np = node_new_enclose_memory(env->option, 0);
CHECK_NULL_RETURN_MEMERR(*np);
num = scan_env_add_mem_entry(env);
- if (num < 0) return num;
- if (num >= (int )BIT_STATUS_BITS_NUM)
+ if (num < 0) {
+ onig_node_free(*np);
+ return num;
+ }
+ else if (num >= (int )BIT_STATUS_BITS_NUM) {
+ onig_node_free(*np);
return ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY;
-
+ }
NENCLOSE(*np)->regnum = num;
BIT_STATUS_ON_AT_SIMPLE(env->capture_history, num);
}
@@ -5116,14 +4985,11 @@ parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
PUNFETCH;
r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &num, 1);
if (r < 0) return r;
-#if 0
- /* Relative number is not currently supported. (same as Perl) */
if (num < 0) {
num = BACKREF_REL_TO_ABS(num, env);
if (num <= 0)
return ONIGERR_INVALID_BACKREF;
}
-#endif
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_STRICT_CHECK_BACKREF)) {
if (num > env->num_mem ||
IS_NULL(SCANENV_MEM_NODES(env)[num]))
@@ -5425,23 +5291,30 @@ set_quantifier(Node* qnode, Node* target, int group, ScanEnv* env)
#ifdef USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
if (!IS_QUANTIFIER_BY_NUMBER(qn) && !IS_QUANTIFIER_BY_NUMBER(qnt) &&
IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT)) {
+ UChar buf[WARN_BUFSIZE];
+
switch (ReduceTypeTable[targetq_num][nestq_num]) {
case RQ_ASIS:
break;
case RQ_DEL:
- if (onig_warn != onig_null_warn) {
- onig_syntax_warn(env, "regular expression has redundant nested repeat operator '%s'",
- PopularQStr[targetq_num]);
+ if (onig_verb_warn != onig_null_warn) {
+ onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc,
+ env->pattern, env->pattern_end,
+ (UChar* )"redundant nested repeat operator");
+ (*onig_verb_warn)((char* )buf);
}
goto warn_exit;
break;
default:
- if (onig_warn != onig_null_warn) {
- onig_syntax_warn(env, "nested repeat operator '%s' and '%s' was replaced with '%s' in regular expression",
- PopularQStr[targetq_num], PopularQStr[nestq_num],
- ReduceQStr[ReduceTypeTable[targetq_num][nestq_num]]);
+ if (onig_verb_warn != onig_null_warn) {
+ onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc,
+ env->pattern, env->pattern_end,
+ (UChar* )"nested repeat operator %s and %s was replaced with '%s'",
+ PopularQStr[targetq_num], PopularQStr[nestq_num],
+ ReduceQStr[ReduceTypeTable[targetq_num][nestq_num]]);
+ (*onig_verb_warn)((char* )buf);
}
goto warn_exit;
break;
@@ -5540,13 +5413,13 @@ i_free_shared_class(type_cclass_key* key, Node* node, void* arg ARG_UNUSED)
extern int
onig_free_shared_cclass_table(void)
{
- /* THREAD_ATOMIC_START; */
+ THREAD_ATOMIC_START;
if (IS_NOT_NULL(OnigTypeCClassTable)) {
onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0);
onig_st_free_table(OnigTypeCClassTable);
OnigTypeCClassTable = NULL;
}
- /* THREAD_ATOMIC_END; */
+ THREAD_ATOMIC_END;
return 0;
}
@@ -5582,7 +5455,6 @@ clear_not_flag_cclass(CClassNode* cc, OnigEncoding enc)
typedef struct {
ScanEnv* env;
CClassNode* cc;
- CClassNode* asc_cc;
Node* alt_root;
Node** ptail;
} IApplyCaseFoldArg;
@@ -5594,57 +5466,37 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
IApplyCaseFoldArg* iarg;
ScanEnv* env;
CClassNode* cc;
- CClassNode* asc_cc;
BitSetRef bs;
- int add_flag;
iarg = (IApplyCaseFoldArg* )arg;
env = iarg->env;
cc = iarg->cc;
- asc_cc = iarg->asc_cc;
bs = cc->bs;
- if (IS_NULL(asc_cc)) {
- add_flag = 0;
- }
- else if (ONIGENC_IS_ASCII_CODE(from) == ONIGENC_IS_ASCII_CODE(*to)) {
- add_flag = 1;
- }
- else {
- add_flag = onig_is_code_in_cc(env->enc, from, asc_cc);
- if (IS_NCCLASS_NOT(asc_cc))
- add_flag = !add_flag;
- }
-
if (to_len == 1) {
int is_in = onig_is_code_in_cc(env->enc, from, cc);
#ifdef CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS
if ((is_in != 0 && !IS_NCCLASS_NOT(cc)) ||
(is_in == 0 && IS_NCCLASS_NOT(cc))) {
- if (add_flag) {
- if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
- add_code_range0(&(cc->mbuf), env, *to, *to, 0);
- }
- else {
- BITSET_SET_BIT(bs, *to);
- }
+ if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
+ add_code_range0(&(cc->mbuf), env, *to, *to, 0);
+ }
+ else {
+ BITSET_SET_BIT(bs, *to);
}
}
#else
if (is_in != 0) {
- if (add_flag) {
- if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
- if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, env->enc);
- add_code_range0(&(cc->mbuf), env, *to, *to, 0);
- }
- else {
- if (IS_NCCLASS_NOT(cc)) {
- BITSET_CLEAR_BIT(bs, *to);
- }
- else {
- BITSET_SET_BIT(bs, *to);
- }
+ if (ONIGENC_MBC_MINLEN(env->enc) > 1 || *to >= SINGLE_BYTE_SIZE) {
+ if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, env->enc);
+ add_code_range0(&(cc->mbuf), env, *to, *to, 0);
+ }
+ else {
+ if (IS_NCCLASS_NOT(cc)) {
+ BITSET_CLEAR_BIT(bs, *to);
}
+ else
+ BITSET_SET_BIT(bs, *to);
}
}
#endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */
@@ -5688,35 +5540,6 @@ i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[],
}
static int
-cclass_case_fold(Node** np, CClassNode* cc, CClassNode* asc_cc, ScanEnv* env)
-{
- int r;
- IApplyCaseFoldArg iarg;
-
- iarg.env = env;
- iarg.cc = cc;
- iarg.asc_cc = asc_cc;
- iarg.alt_root = NULL_NODE;
- iarg.ptail = &(iarg.alt_root);
-
- r = ONIGENC_APPLY_ALL_CASE_FOLD(env->enc, env->case_fold_flag,
- i_apply_case_fold, &iarg);
- if (r != 0) {
- onig_node_free(iarg.alt_root);
- return r;
- }
- if (IS_NOT_NULL(iarg.alt_root)) {
- Node* work = onig_node_new_alt(*np, iarg.alt_root);
- if (IS_NULL(work)) {
- onig_node_free(iarg.alt_root);
- return ONIGERR_MEMORY;
- }
- *np = work;
- }
- return r;
-}
-
-static int
node_linebreak(Node** np, ScanEnv* env)
{
/* same as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */
@@ -5801,7 +5624,7 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env)
np1 = node_new_cclass();
if (IS_NULL(np1)) goto err;
cc1 = NCCLASS(np1);
- r = add_ctype_to_cc(cc1, ctype, 0, 0, env);
+ r = add_ctype_to_cc(cc1, ctype, 0, 1, env);
if (r != 0) goto err;
NCCLASS_SET_NOT(cc1);
@@ -5809,7 +5632,7 @@ node_extended_grapheme_cluster(Node** np, ScanEnv* env)
np2 = node_new_cclass();
if (IS_NULL(np2)) goto err;
cc2 = NCCLASS(np2);
- r = add_ctype_to_cc(cc2, ctype, 0, 0, env);
+ r = add_ctype_to_cc(cc2, ctype, 0, 1, env);
if (r != 0) goto err;
qn = node_new_quantifier(0, REPEAT_INFINITE, 0);
@@ -6156,8 +5979,7 @@ parse_exp(Node** np, OnigToken* tok, int term,
*np = node_new_cclass();
CHECK_NULL_RETURN_MEMERR(*np);
cc = NCCLASS(*np);
- r = add_ctype_to_cc(cc, tok->u.prop.ctype, 0,
- IS_ASCII_RANGE(env->option), env);
+ r = add_ctype_to_cc(cc, tok->u.prop.ctype, 0, 0, env);
if (r != 0) return r;
if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
#ifdef USE_SHARED_CCLASS_TABLE
@@ -6180,20 +6002,15 @@ parse_exp(Node** np, OnigToken* tok, int term,
case TK_CC_OPEN:
{
- Node *asc_node;
CClassNode* cc;
OnigCodePoint code;
- r = parse_char_class(np, &asc_node, tok, src, end, env);
- if (r != 0) {
- onig_node_free(asc_node);
- return r;
- }
+ r = parse_char_class(np, tok, src, end, env);
+ if (r != 0) return r;
cc = NCCLASS(*np);
if (is_onechar_cclass(cc, &code)) {
onig_node_free(*np);
- onig_node_free(asc_node);
*np = node_new_empty();
CHECK_NULL_RETURN_MEMERR(*np);
r = node_str_cat_codepoint(*np, env->enc, code);
@@ -6201,13 +6018,28 @@ parse_exp(Node** np, OnigToken* tok, int term,
goto string_loop;
}
if (IS_IGNORECASE(env->option)) {
- r = cclass_case_fold(np, cc, NCCLASS(asc_node), env);
+ IApplyCaseFoldArg iarg;
+
+ iarg.env = env;
+ iarg.cc = cc;
+ iarg.alt_root = NULL_NODE;
+ iarg.ptail = &(iarg.alt_root);
+
+ r = ONIGENC_APPLY_ALL_CASE_FOLD(env->enc, env->case_fold_flag,
+ i_apply_case_fold, &iarg);
if (r != 0) {
- onig_node_free(asc_node);
+ onig_node_free(iarg.alt_root);
return r;
}
+ if (IS_NOT_NULL(iarg.alt_root)) {
+ Node* work = onig_node_new_alt(*np, iarg.alt_root);
+ if (IS_NULL(work)) {
+ onig_node_free(iarg.alt_root);
+ return ONIGERR_MEMORY;
+ }
+ *np = work;
+ }
}
- onig_node_free(asc_node);
}
break;
diff --git a/regparse.h b/regparse.h
index caf0790b1c..c92babfebe 100644
--- a/regparse.h
+++ b/regparse.h
@@ -67,11 +67,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
BIT_NT_CANY | BIT_NT_BREF)) != 0)
#define NTYPE(node) ((node)->u.base.type)
-#define SET_NTYPE(node, ntype) \
- do { \
- int value = ntype; \
- memcpy(&((node)->u.base.type), &value, sizeof(int)); \
- } while (0)
+#define SET_NTYPE(node, ntype) (node)->u.base.type = (ntype)
#define NSTR(node) (&((node)->u.str))
#define NCCLASS(node) (&((node)->u.cclass))
@@ -197,8 +193,8 @@ typedef struct {
int type;
int regnum;
OnigOptionType option;
- AbsAddrType call_addr;
struct _Node* target;
+ AbsAddrType call_addr;
/* for multiple call reference */
OnigDistance min_len; /* min length (byte) */
OnigDistance max_len; /* max length (byte) */
@@ -300,10 +296,10 @@ typedef struct {
UChar* error;
UChar* error_end;
regex_t* reg; /* for reg->names only */
+ int num_call;
#ifdef USE_SUBEXP_CALL
UnsetAddrList* unset_addr_list;
#endif
- int num_call;
int num_mem;
#ifdef USE_NAMED_GROUP
int num_named;
diff --git a/ruby.c b/ruby.c
index 7c32d4170d..034425e296 100644
--- a/ruby.c
+++ b/ruby.c
@@ -15,8 +15,9 @@
#include <windows.h>
#include <sys/cygwin.h>
#endif
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
#include "internal.h"
-#include "ruby/thread.h"
#include "eval_intern.h"
#include "dln.h"
#include <stdio.h>
@@ -44,9 +45,6 @@
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
-#ifndef O_ACCMODE
-# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
-#endif
#include "ruby/util.h"
@@ -63,18 +61,13 @@ char *getenv();
#define DEFAULT_RUBYGEMS_ENABLED "enabled"
#endif
-#define FEATURE_BIT(bit) (1U << feature_##bit)
-enum feature_flag_bits {
- feature_gems,
- feature_did_you_mean,
- feature_rubyopt,
- feature_frozen_string_literal,
- feature_debug_frozen_string_literal,
- feature_flag_count
+#define DISABLE_BIT(bit) (1U << disable_##bit)
+enum disable_flag_bits {
+ disable_gems,
+ disable_rubyopt,
+ disable_flag_count
};
-#define DEBUG_BIT(bit) (1U << feature_debug_##bit)
-
#define DUMP_BIT(bit) (1U << dump_##bit)
enum dump_flag_bits {
dump_version,
@@ -95,7 +88,7 @@ struct cmdline_options {
int do_loop, do_print;
int do_line, do_split;
int do_search;
- unsigned int features;
+ unsigned int disable;
int verbose;
int safe_level;
unsigned int setids;
@@ -116,22 +109,6 @@ static void init_ids(struct cmdline_options *);
#define src_encoding_index GET_VM()->src_encoding_index
-enum {
- COMPILATION_FEATURES = (
- 0
- | FEATURE_BIT(frozen_string_literal)
- | FEATURE_BIT(debug_frozen_string_literal)
- ),
- DEFAULT_FEATURES = (
- ~0U
-#if DISABLE_RUBYGEMS
- & ~FEATURE_BIT(gems)
-#endif
- & ~FEATURE_BIT(frozen_string_literal)
- & ~FEATURE_BIT(debug_frozen_string_literal)
- )
-};
-
static struct cmdline_options *
cmdline_options_init(struct cmdline_options *opt)
{
@@ -140,7 +117,9 @@ cmdline_options_init(struct cmdline_options *opt)
opt->src.enc.index = src_encoding_index;
opt->ext.enc.index = -1;
opt->intern.enc.index = -1;
- opt->features = DEFAULT_FEATURES;
+#if DISABLE_RUBYGEMS
+ opt->disable |= DISABLE_BIT(gems);
+#endif
return opt;
}
@@ -154,18 +133,6 @@ static struct {
} origarg;
static void
-show_usage_line(const char *str, unsigned int namelen, unsigned int secondlen, int help)
-{
- const unsigned int w = 16;
- const int wrap = help && namelen + secondlen - 2 > w;
- printf(" %.*s%-*.*s%-*s%s\n", namelen-1, str,
- (wrap ? 0 : w - namelen + 1),
- (help ? secondlen-1 : 0), str + namelen,
- (wrap ? w + 3 : 0), (wrap ? "\n" : ""),
- str + namelen + secondlen);
-}
-
-static void
usage(const char *name, int help)
{
/* This message really ought to be max 23 lines.
@@ -215,13 +182,17 @@ usage(const char *name, int help)
};
static const struct message features[] = {
M("gems", "", "rubygems (default: "DEFAULT_RUBYGEMS_ENABLED")"),
- M("did_you_mean", "", "did_you_mean (default: "DEFAULT_RUBYGEMS_ENABLED")"),
M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"),
- M("frozen-string-literal", "", "freeze all string literals (default: disabled)"),
};
- int i;
- const int num = numberof(usage_msg) - (help ? 1 : 0);
-#define SHOW(m) show_usage_line((m).str, (m).namelen, (m).secondlen, help)
+ int i, w = 16, num = numberof(usage_msg) - (help ? 1 : 0);
+#define SHOW(m) do { \
+ int wrap = help && (m).namelen + (m).secondlen - 2 > w; \
+ printf(" %.*s%-*.*s%-*s%s\n", (m).namelen-1, (m).str, \
+ (wrap ? 0 : w - (m).namelen + 1), \
+ (help ? (m).secondlen-1 : 0), (m).str + (m).namelen, \
+ (wrap ? w + 3 : 0), (wrap ? "\n" : ""), \
+ (m).str + (m).namelen + (m).secondlen); \
+ } while (0)
printf("Usage: %s [switches] [--] [programfile] [arguments]\n", name);
for (i = 0; i < num; ++i)
@@ -236,7 +207,49 @@ usage(const char *name, int help)
SHOW(features[i]);
}
-#define rubylib_path_new rb_str_new
+#ifdef MANGLED_PATH
+static VALUE
+rubylib_mangled_path(const char *s, unsigned int l)
+{
+ static char *newp, *oldp;
+ static int newl, oldl, notfound;
+ char *ptr;
+ VALUE ret;
+
+ if (!newp && !notfound) {
+ newp = getenv("RUBYLIB_PREFIX");
+ if (newp) {
+ oldp = newp = strdup(newp);
+ while (*newp && !ISSPACE(*newp) && *newp != ';') {
+ newp = CharNext(newp); /* Skip digits. */
+ }
+ oldl = newp - oldp;
+ while (*newp && (ISSPACE(*newp) || *newp == ';')) {
+ newp = CharNext(newp); /* Skip whitespace. */
+ }
+ newl = strlen(newp);
+ if (newl == 0 || oldl == 0) {
+ rb_fatal("malformed RUBYLIB_PREFIX");
+ }
+ translit_char(newp, '\\', '/');
+ }
+ else {
+ notfound = 1;
+ }
+ }
+ if (!newp || l < oldl || STRNCASECMP(oldp, s, oldl) != 0) {
+ return rb_str_new(s, l);
+ }
+ ret = rb_str_new(0, l + newl - oldl);
+ ptr = RSTRING_PTR(ret);
+ memcpy(ptr, newp, newl);
+ memcpy(ptr + newl, s + oldl, l - oldl);
+ ptr[l + newl - oldl] = 0;
+ return ret;
+}
+#else
+#define rubylib_mangled_path rb_str_new
+#endif
static void
push_include(const char *path, VALUE (*filter)(VALUE))
@@ -251,7 +264,7 @@ push_include(const char *path, VALUE (*filter)(VALUE))
p++;
if (!*p) break;
for (s = p; *s && *s != sep; s = CharNext(s));
- rb_ary_push(load_path, (*filter)(rubylib_path_new(p, s - p)));
+ rb_ary_push(load_path, (*filter)(rubylib_mangled_path(p, s - p)));
p = s;
}
}
@@ -286,7 +299,8 @@ push_include_cygwin(const char *path, VALUE (*filter)(VALUE))
#define CONV_TO_POSIX_PATH(p, lib) \
cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, (p), (lib), sizeof(lib))
#else
-# error no cygwin_conv_path
+#define CONV_TO_POSIX_PATH(p, lib) \
+ cygwin_conv_to_posix_path((p), (lib))
#endif
if (CONV_TO_POSIX_PATH(p, rubylib) == 0)
p = rubylib;
@@ -342,7 +356,6 @@ ruby_incpush_expand(const char *path)
ruby_push_include(path, expand_include_path);
}
-#undef UTF8_PATH
#if defined _WIN32 || defined __CYGWIN__
static HMODULE libruby;
@@ -359,34 +372,6 @@ rb_libruby_handle(void)
{
return libruby;
}
-
-static inline void
-translit_char_bin(char *p, int from, int to)
-{
- while (*p) {
- if ((unsigned char)*p == from)
- *p = to;
- p++;
- }
-}
-#endif
-
-#ifdef _WIN32
-# define UTF8_PATH 1
-#endif
-
-#ifndef UTF8_PATH
-# define UTF8_PATH 0
-#endif
-
-#if UTF8_PATH
-static VALUE
-str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to)
-{
- return rb_str_conv_enc_opts(str, from, to,
- ECONV_UNDEF_REPLACE|ECONV_INVALID_REPLACE,
- Qnil);
-}
#endif
void ruby_init_loadpath_safe(int safe_level);
@@ -397,41 +382,15 @@ ruby_init_loadpath(void)
ruby_init_loadpath_safe(0);
}
-#if defined(LOAD_RELATIVE) && defined(HAVE_DLADDR)
-static VALUE
-dladdr_path(const void* addr)
-{
- Dl_info dli;
- VALUE fname, path;
-
- if (!dladdr(addr, &dli)) {
- return rb_str_new(0, 0);
- }
-#ifdef __linux__
- else if (dli.dli_fname == origarg.argv[0]) {
- fname = rb_str_new_cstr("/proc/self/exe");
- path = rb_readlink(fname, NULL);
- }
-#endif
- else {
- fname = rb_str_new_cstr(dli.dli_fname);
- path = rb_realpath_internal(Qnil, fname, 1);
- }
- rb_str_resize(fname, 0);
- return path;
-}
-#endif
-
-#define INITIAL_LOAD_PATH_MARK rb_intern_const("@gem_prelude_index")
-
void
ruby_init_loadpath_safe(int safe_level)
{
VALUE load_path;
ID id_initial_load_path_mark;
+ extern const char ruby_initial_load_paths[];
const char *paths = ruby_initial_load_paths;
#if defined LOAD_RELATIVE
-# if defined HAVE_DLADDR || defined __CYGWIN__ || defined _WIN32
+# if defined HAVE_DLADDR || defined HAVE_CYGWIN_CONV_PATH
# define VARIABLE_LIBPATH 1
# else
# define VARIABLE_LIBPATH 0
@@ -446,11 +405,27 @@ ruby_init_loadpath_safe(int safe_level)
char *p;
#if defined _WIN32 || defined __CYGWIN__
+# if VARIABLE_LIBPATH
sopath = rb_str_new(0, MAXPATHLEN);
libpath = RSTRING_PTR(sopath);
GetModuleFileName(libruby, libpath, MAXPATHLEN);
+# else
+ GetModuleFileName(libruby, libpath, sizeof libpath);
+# endif
+#elif defined(__EMX__)
+ _execname(libpath, sizeof(libpath) - 1);
#elif defined(HAVE_DLADDR)
- sopath = dladdr_path((void *)(VALUE)expand_include_path);
+ Dl_info dli;
+ if (dladdr((void *)(VALUE)expand_include_path, &dli)) {
+ char fbuf[MAXPATHLEN];
+ char *f = dln_find_file_r(dli.dli_fname, getenv(PATH_ENV), fbuf, sizeof(fbuf));
+ VALUE fname = rb_str_new_cstr(f ? f : dli.dli_fname);
+ rb_str_freeze(fname);
+ sopath = rb_realpath_internal(Qnil, fname, 1);
+ }
+ else {
+ sopath = rb_str_new(0, 0);
+ }
libpath = RSTRING_PTR(sopath);
#endif
@@ -461,6 +436,7 @@ ruby_init_loadpath_safe(int safe_level)
translit_char(libpath, '\\', '/');
#elif defined __CYGWIN__
{
+# if VARIABLE_LIBPATH
const int win_to_posix = CCP_WIN_A_TO_POSIX | CCP_RELATIVE;
size_t newsize = cygwin_conv_path(win_to_posix, libpath, 0, 0);
if (newsize > 0) {
@@ -472,6 +448,11 @@ ruby_init_loadpath_safe(int safe_level)
libpath = p;
}
}
+# else
+ char rubylib[FILENAME_MAX];
+ cygwin_conv_to_posix_path(libpath, rubylib);
+ strncpy(libpath, rubylib, sizeof(libpath));
+# endif
}
#endif
p = strrchr(libpath, '/');
@@ -507,9 +488,7 @@ ruby_init_loadpath_safe(int safe_level)
p = p2;
}
#endif
-#if !VARIABLE_LIBPATH
*p = 0;
-#endif
}
#if !VARIABLE_LIBPATH
else {
@@ -529,17 +508,21 @@ ruby_init_loadpath_safe(int safe_level)
#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), (path), (len))
#else
+ extern const char ruby_exec_prefix[];
const size_t exec_prefix_len = strlen(ruby_exec_prefix);
-#define RUBY_RELATIVE(path, len) rubylib_path_new((path), (len))
+#define RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len))
#define PREFIX_PATH() RUBY_RELATIVE(ruby_exec_prefix, exec_prefix_len)
#endif
load_path = GET_VM()->load_path;
if (safe_level == 0) {
+#ifdef MANGLED_PATH
+ rubylib_mangled_path("", 0);
+#endif
ruby_push_include(getenv("RUBYLIB"), identical_path);
}
- id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK;
+ id_initial_load_path_mark = rb_intern_const("@gem_prelude_index");
while (*paths) {
size_t len = strlen(paths);
VALUE path = RUBY_RELATIVE(paths, len);
@@ -715,26 +698,8 @@ moreswitches(const char *s, struct cmdline_options *opt, int envopt)
rb_str_resize(argstr, 0);
}
-static int
-name_match_p(const char *name, const char *str, size_t len)
-{
- if (len == 0) return 0;
- do {
- while (TOLOWER(*str) == *name) {
- if (!--len || !*++str) return 1;
- ++name;
- }
- if (*str != '-' && *str != '_') return 0;
- while (ISALNUM(*name)) name++;
- if (*name != '-' && *name != '_') return 0;
- ++name;
- ++str;
- } while (len > 0);
- return !*name;
-}
-
#define NAME_MATCH_P(name, str, len) \
- ((len) < (int)sizeof(name) && name_match_p((name), (str), (len)))
+ ((len) < (int)sizeof(name) && strncmp((str), (name), (len)) == 0)
#define UNSET_WHEN(name, bit, str, len) \
if (NAME_MATCH_P((name), (str), (len))) { \
@@ -749,43 +714,29 @@ name_match_p(const char *name, const char *str, size_t len)
}
static void
-feature_option(const char *str, int len, void *arg, const unsigned int enable)
+enable_option(const char *str, int len, void *arg)
{
- unsigned int *argp = arg;
- unsigned int mask = ~0U;
-#define SET_FEATURE(bit) \
- if (NAME_MATCH_P(#bit, str, len)) {mask = FEATURE_BIT(bit); goto found;}
- SET_FEATURE(gems);
- SET_FEATURE(did_you_mean);
- SET_FEATURE(rubyopt);
- SET_FEATURE(frozen_string_literal);
+#define UNSET_WHEN_DISABLE(bit) UNSET_WHEN(#bit, DISABLE_BIT(bit), str, len)
+ UNSET_WHEN_DISABLE(gems);
+ UNSET_WHEN_DISABLE(rubyopt);
if (NAME_MATCH_P("all", str, len)) {
- found:
- *argp = (*argp & ~mask) | (mask & enable);
+ *(unsigned int *)arg = 0U;
return;
}
- rb_warn("unknown argument for --%s: `%.*s'",
- enable ? "enable" : "disable", len, str);
-}
-
-static void
-enable_option(const char *str, int len, void *arg)
-{
- feature_option(str, len, arg, ~0U);
+ rb_warn("unknown argument for --enable: `%.*s'", len, str);
}
static void
disable_option(const char *str, int len, void *arg)
{
- feature_option(str, len, arg, 0U);
-}
-
-static void
-debug_option(const char *str, int len, void *arg)
-{
-#define SET_WHEN_DEBUG(t, bit) SET_WHEN(#bit, t##_BIT(bit), str, len)
- SET_WHEN_DEBUG(DEBUG, frozen_string_literal);
- rb_warn("unknown argument for --debug: `%.*s'", len, str);
+#define SET_WHEN_DISABLE(bit) SET_WHEN(#bit, DISABLE_BIT(bit), str, len)
+ SET_WHEN_DISABLE(gems);
+ SET_WHEN_DISABLE(rubyopt);
+ if (NAME_MATCH_P("all", str, len)) {
+ *(unsigned int *)arg = ~0U;
+ return;
+ }
+ rb_warn("unknown argument for --disable: `%.*s'", len, str);
}
static void
@@ -946,9 +897,11 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
if (envopt) goto noenvopt;
forbid_setid("-e");
if (!*++s) {
- if (!--argc)
- rb_raise(rb_eRuntimeError, "no code specified for -e");
- s = *++argv;
+ s = argv[1];
+ argc--, argv++;
+ }
+ if (!s) {
+ rb_raise(rb_eRuntimeError, "no code specified for -e");
}
if (!opt->e_script) {
opt->e_script = rb_str_new(0, 0);
@@ -964,7 +917,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
if (*++s) {
add_modules(&opt->req_list, s);
}
- else if (argc > 1) {
+ else if (argv[1]) {
add_modules(&opt->req_list, argv[1]);
argc--, argv++;
}
@@ -988,7 +941,12 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
case 'C':
case 'X':
if (envopt) goto noenvopt;
- if (!*++s && (!--argc || !(s = *++argv) || !*s)) {
+ s++;
+ if (!*s) {
+ s = argv[1];
+ argc--, argv++;
+ }
+ if (!s || !*s) {
rb_fatal("Can't chdir");
}
if (chdir(s) < 0) {
@@ -1059,7 +1017,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
forbid_setid("-I");
if (*++s)
ruby_incpush_expand(s);
- else if (argc > 1) {
+ else if (argv[1]) {
ruby_incpush_expand(argv[1]);
argc--, argv++;
}
@@ -1098,35 +1056,30 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
# define check_envopt(name, allow_envopt) \
(((allow_envopt) || !envopt) ? (void)0 : \
rb_raise(rb_eRuntimeError, "invalid switch in RUBYOPT: --" name))
-# define need_argument(name, s, needs_arg, next_arg) \
- ((*(s) ? !*++(s) : (next_arg) && (!argc || !((s) = argv[1]) || (--argc, ++argv, 0))) && (needs_arg) ? \
+# define need_argument(name, s, needs_arg) \
+ ((*(s)++ ? !*(s) : (!--argc || !((s) = *++argv))) && (needs_arg) ? \
rb_raise(rb_eRuntimeError, "missing argument for --" name) \
: (void)0)
# define is_option_with_arg(name, allow_hyphen, allow_envopt) \
- is_option_with_optarg(name, allow_hyphen, allow_envopt, Qtrue, Qtrue)
-# define is_option_with_optarg(name, allow_hyphen, allow_envopt, needs_arg, next_arg) \
+ is_option_with_optarg(name, allow_hyphen, allow_envopt, Qtrue)
+# define is_option_with_optarg(name, allow_hyphen, allow_envopt, needs_arg) \
(strncmp((name), s, n = sizeof(name) - 1) == 0 && is_option_end(s[n], (allow_hyphen)) ? \
(check_envopt(name, (allow_envopt)), s += n, \
- need_argument(name, s, needs_arg, next_arg), 1) : 0)
+ need_argument(name, s, needs_arg), 1) : 0)
if (strcmp("copyright", s) == 0) {
if (envopt) goto noenvopt_long;
opt->dump |= DUMP_BIT(copyright);
}
- else if (is_option_with_optarg("debug", Qtrue, Qtrue, Qfalse, Qfalse)) {
- if (s && *s) {
- ruby_each_words(s, debug_option, &opt->features);
- }
- else {
- ruby_debug = Qtrue;
- ruby_verbose = Qtrue;
- }
+ else if (strcmp("debug", s) == 0) {
+ ruby_debug = Qtrue;
+ ruby_verbose = Qtrue;
}
else if (is_option_with_arg("enable", Qtrue, Qtrue)) {
- ruby_each_words(s, enable_option, &opt->features);
+ ruby_each_words(s, enable_option, &opt->disable);
}
else if (is_option_with_arg("disable", Qtrue, Qtrue)) {
- ruby_each_words(s, disable_option, &opt->features);
+ ruby_each_words(s, disable_option, &opt->disable);
}
else if (is_option_with_arg("encoding", Qfalse, Qtrue)) {
char *p;
@@ -1361,16 +1314,16 @@ rb_f_chomp(int argc, VALUE *argv)
return str;
}
+/* blank function in dmyext.c or generated by enc/make_encmake.rb */
+extern void Init_enc(void);
+
static VALUE
process_options(int argc, char **argv, struct cmdline_options *opt)
{
NODE *tree = 0;
VALUE parser;
- const rb_iseq_t *iseq;
+ VALUE iseq;
rb_encoding *enc, *lenc;
-#if UTF8_PATH
- rb_encoding *uenc, *ienc = 0;
-#endif
const char *s;
char fbuf[MAXPATHLEN];
int i = (int)proc_options(argc, argv, opt, 0);
@@ -1385,7 +1338,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
return Qtrue;
}
- if ((opt->features & FEATURE_BIT(rubyopt)) &&
+ if (!(opt->disable & DISABLE_BIT(rubyopt)) &&
opt->safe_level == 0 && (s = getenv("RUBYOPT"))) {
VALUE src_enc_name = opt->src.enc.name;
VALUE ext_enc_name = opt->ext.enc.name;
@@ -1412,6 +1365,11 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
ruby_show_copyright();
}
+ if (opt->safe_level >= 4) {
+ OBJ_TAINT(rb_argv);
+ OBJ_TAINT(GET_VM()->load_path);
+ }
+
if (!opt->e_script) {
if (argc == 0) { /* no more args */
if (opt->verbose)
@@ -1443,16 +1401,13 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
opt->script_name = rb_str_new_cstr(opt->script);
opt->script = RSTRING_PTR(opt->script_name);
-
-#if _WIN32
- translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
-#elif defined DOSISH
+#if defined DOSISH || defined __CYGWIN__
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
#endif
- ruby_gc_set_params(opt->safe_level);
ruby_init_loadpath_safe(opt->safe_level);
Init_enc();
+ rb_enc_find_index("encdb");
lenc = rb_locale_encoding();
rb_enc_associate(rb_progname, lenc);
rb_obj_freeze(rb_progname);
@@ -1481,49 +1436,22 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
enc = rb_enc_from_index(opt->intern.enc.index);
rb_enc_set_default_internal(rb_enc_from_encoding(enc));
opt->intern.enc.index = -1;
-#if UTF8_PATH
- ienc = enc;
-#endif
}
rb_enc_associate(opt->script_name, lenc);
rb_obj_freeze(opt->script_name);
{
long i;
VALUE load_path = GET_VM()->load_path;
- const ID id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK;
for (i = 0; i < RARRAY_LEN(load_path); ++i) {
- VALUE path = RARRAY_AREF(load_path, i);
- int mark = rb_attr_get(path, id_initial_load_path_mark) == path;
- path = rb_enc_associate(rb_str_dup(path), lenc);
- if (mark) rb_ivar_set(path, id_initial_load_path_mark, path);
- RARRAY_ASET(load_path, i, path);
+ RARRAY_ASET(load_path, i,
+ rb_enc_associate(rb_str_dup(RARRAY_AREF(load_path, i)), lenc));
}
}
Init_ext(); /* load statically linked extensions before rubygems */
- if (opt->features & FEATURE_BIT(gems)) {
+ if (!(opt->disable & DISABLE_BIT(gems))) {
rb_define_module("Gem");
}
- if (opt->features & FEATURE_BIT(did_you_mean)) {
- rb_define_module("DidYouMean");
- }
ruby_init_prelude();
- if ((opt->features ^ DEFAULT_FEATURES) & COMPILATION_FEATURES) {
- VALUE option = rb_hash_new();
-#define SET_COMPILE_OPTION(h, o, name) \
- rb_hash_aset((h), ID2SYM(rb_intern_const(#name)), \
- ((o)->features & FEATURE_BIT(name) ? Qtrue : Qfalse));
- SET_COMPILE_OPTION(option, opt, frozen_string_literal);
- SET_COMPILE_OPTION(option, opt, debug_frozen_string_literal);
- rb_funcallv(rb_cISeq, rb_intern_const("compile_option="), 1, &option);
-#undef SET_COMPILE_OPTION
- }
-#if UTF8_PATH
- uenc = rb_utf8_encoding();
- if (uenc != lenc) {
- opt->script_name = str_conv_enc(opt->script_name, uenc, lenc);
- opt->script = RSTRING_PTR(opt->script_name);
- }
-#endif
ruby_set_argv(argc, argv);
process_sflag(&opt->sflag);
@@ -1546,20 +1474,10 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
}
else {
eenc = lenc;
-#if UTF8_PATH
- if (ienc) eenc = ienc;
-#endif
}
-#if UTF8_PATH
- if (eenc != uenc) {
- opt->e_script = str_conv_enc(opt->e_script, uenc, eenc);
- }
-#endif
rb_enc_associate(opt->e_script, eenc);
- if (!(opt->dump & ~DUMP_BIT(version_v))) {
- ruby_set_script_name(opt->script_name);
- require_libraries(&opt->req_list);
- }
+ ruby_set_script_name(opt->script_name);
+ require_libraries(&opt->req_list);
ruby_set_script_name(progname);
PREPARE_PARSE_MAIN({
@@ -1600,6 +1518,11 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
process_sflag(&opt->sflag);
opt->xflag = 0;
+ if (opt->safe_level >= 4) {
+ FL_UNSET(rb_argv, FL_TAINT);
+ FL_UNSET(GET_VM()->load_path, FL_TAINT);
+ }
+
if (opt->dump & DUMP_BIT(syntax)) {
printf("Syntax OK\n");
return Qtrue;
@@ -1635,7 +1558,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
});
if (opt->dump & DUMP_BIT(insns)) {
- rb_io_write(rb_stdout, rb_iseq_disasm((const rb_iseq_t *)iseq));
+ rb_io_write(rb_stdout, rb_iseq_disasm(iseq));
rb_io_flush(rb_stdout);
return Qtrue;
}
@@ -1645,36 +1568,68 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
rb_define_readonly_boolean("$-a", opt->do_split);
rb_set_safe_level(opt->safe_level);
+ ruby_gc_set_params();
- return (VALUE)iseq;
+ return iseq;
}
struct load_file_arg {
VALUE parser;
VALUE fname;
int script;
- int xflag;
struct cmdline_options *opt;
- VALUE f;
- VALUE lineno;
};
static VALUE
-load_file_internal(VALUE argp_v)
+load_file_internal(VALUE arg)
{
- struct load_file_arg *argp = (struct load_file_arg *)argp_v;
+ extern VALUE rb_stdin;
+ struct load_file_arg *argp = (struct load_file_arg *)arg;
VALUE parser = argp->parser;
VALUE orig_fname = argp->fname;
+ VALUE fname_v = rb_str_encode_ospath(orig_fname);
+ const char *fname = StringValueCStr(fname_v);
int script = argp->script;
struct cmdline_options *opt = argp->opt;
- VALUE f = argp->f;
+ VALUE f;
int line_start = 1;
NODE *tree = 0;
rb_encoding *enc;
ID set_encoding;
- int xflag = argp->xflag;
+ int xflag = 0;
+
+ if (strcmp(fname, "-") == 0) {
+ f = rb_stdin;
+ }
+ else {
+ int fd, mode = O_RDONLY;
+#if defined DOSISH || defined __CYGWIN__
+ {
+ const char *ext = strrchr(fname, '.');
+ if (ext && STRCASECMP(ext, ".exe") == 0) {
+ mode |= O_BINARY;
+ xflag = 1;
+ }
+ }
+#endif
+ if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
+ rb_load_fail(fname_v, strerror(errno));
+ }
+ rb_update_max_fd(fd);
+#if !defined DOSISH && !defined __CYGWIN__
+ {
+ struct stat st;
+ if (fstat(fd, &st) != 0)
+ rb_load_fail(fname_v, strerror(errno));
+ if (S_ISDIR(st.st_mode)) {
+ errno = EISDIR;
+ rb_load_fail(fname_v, strerror(EISDIR));
+ }
+ }
+#endif
+ f = rb_io_fdopen(fd, mode, fname);
+ }
- argp->script = 0;
CONST_ID(set_encoding, "set_encoding");
if (script) {
VALUE c = 1; /* something not nil */
@@ -1697,7 +1652,7 @@ load_file_internal(VALUE argp_v)
if (RSTRING_LEN(line) > 2
&& RSTRING_PTR(line)[0] == '#'
&& RSTRING_PTR(line)[1] == '!') {
- if ((p = strstr(RSTRING_PTR(line), ruby_engine)) != 0) {
+ if ((p = strstr(RSTRING_PTR(line), "ruby")) != 0) {
goto start_read;
}
}
@@ -1713,7 +1668,7 @@ load_file_internal(VALUE argp_v)
if (NIL_P(line))
return 0;
- if ((p = strstr(RSTRING_PTR(line), ruby_engine)) == 0) {
+ if ((p = strstr(RSTRING_PTR(line), "ruby")) == 0) {
/* not ruby script, assume -x flag */
goto search_shebang;
}
@@ -1752,10 +1707,8 @@ load_file_internal(VALUE argp_v)
if (f != rb_stdin) rb_io_close(f);
f = Qnil;
}
- if (!(opt->dump & ~DUMP_BIT(version_v))) {
- ruby_set_script_name(opt->script_name);
- require_libraries(&opt->req_list); /* Why here? unnatural */
- }
+ ruby_set_script_name(opt->script_name);
+ require_libraries(&opt->req_list); /* Why here? unnatural */
}
if (opt->src.enc.index >= 0) {
enc = rb_enc_from_index(opt->src.enc.index);
@@ -1774,93 +1727,7 @@ load_file_internal(VALUE argp_v)
rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
tree = rb_parser_compile_file_path(parser, orig_fname, f, line_start);
rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser));
- if (script && rb_parser_end_seen_p(parser)) argp->script = script;
- return (VALUE)tree;
-}
-
-static VALUE
-open_load_file(VALUE fname_v, int *xflag)
-{
- const char *fname = StringValueCStr(fname_v);
- VALUE f;
- int e;
-
- if (RSTRING_LEN(fname_v) == 1 && fname[0] == '-') {
- f = rb_stdin;
- }
- else {
- int fd;
- /* open(2) may block if fname is point to FIFO and it's empty. Let's
- use O_NONBLOCK. */
-#if defined O_NONBLOCK && HAVE_FCNTL && !(O_NONBLOCK & O_ACCMODE)
- /* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */
-# define MODE_TO_LOAD (O_RDONLY | O_NONBLOCK)
-#elif defined O_NDELAY && HAVE_FCNTL && !(O_NDELAY & O_ACCMODE)
-# define MODE_TO_LOAD (O_RDONLY | O_NDELAY)
-#else
-# define MODE_TO_LOAD (O_RDONLY)
-#endif
- int mode = MODE_TO_LOAD;
-#if defined DOSISH || defined __CYGWIN__
- {
- const char *ext = strrchr(fname, '.');
- if (ext && STRCASECMP(ext, ".exe") == 0) {
- mode |= O_BINARY;
- *xflag = 1;
- }
- }
-#endif
-
- if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
- rb_load_fail(fname_v, strerror(errno));
- }
- rb_update_max_fd(fd);
-
-#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
- /* disabling O_NONBLOCK */
- if (fcntl(fd, F_SETFL, 0) < 0) {
- e = errno;
- (void)close(fd);
- rb_load_fail(fname_v, strerror(e));
- }
-#endif
-
-#ifdef S_ISFIFO
- {
- struct stat st;
- if (fstat(fd, &st) != 0) {
- e = errno;
- (void)close(fd);
- rb_load_fail(fname_v, strerror(e));
- }
- if (S_ISFIFO(st.st_mode)) {
- /*
- We need to wait if FIFO is empty. It's FIFO's semantics.
- rb_thread_wait_fd() release GVL. So, it's safe.
- */
- rb_thread_wait_fd(fd);
- }
- }
-#endif
- if (!ruby_is_fd_loadable(fd)) {
- e = errno;
- (void)close(fd);
- rb_load_fail(fname_v, strerror(e));
- }
-
- f = rb_io_fdopen(fd, mode, fname);
- }
- return f;
-}
-
-static VALUE
-restore_load_file(VALUE arg)
-{
- struct load_file_arg *argp = (struct load_file_arg *)arg;
- VALUE f = argp->f;
- VALUE lineno = argp->lineno;
-
- if (argp->script) {
+ if (script && tree && rb_parser_end_seen_p(parser)) {
/*
* DATA is a File that contains the data section of the executed file.
* To create a data section use <tt>__END__</tt>:
@@ -1878,6 +1745,12 @@ restore_load_file(VALUE arg)
else if (f != rb_stdin) {
rb_io_close(f);
}
+ return (VALUE)tree;
+}
+
+static VALUE
+restore_lineno(VALUE lineno)
+{
return rb_gv_set("$.", lineno);
}
@@ -1889,11 +1762,7 @@ load_file(VALUE parser, VALUE fname, int script, struct cmdline_options *opt)
arg.fname = fname;
arg.script = script;
arg.opt = opt;
- arg.xflag = 0;
- arg.lineno = rb_gv_get("$.");
- arg.f = open_load_file(rb_str_encode_ospath(fname), &arg.xflag);
- return (NODE *)rb_ensure(load_file_internal, (VALUE)&arg,
- restore_load_file, (VALUE)&arg);
+ return (NODE *)rb_ensure(load_file_internal, (VALUE)&arg, restore_lineno, rb_gv_get("$."));
}
void *
@@ -1964,17 +1833,6 @@ set_arg0(VALUE val, ID id)
rb_progname = rb_str_new_frozen(proc_setproctitle(rb_mProcess, val));
}
-static inline VALUE
-external_str_new_cstr(const char *p)
-{
-#if UTF8_PATH
- VALUE str = rb_utf8_str_new_cstr(p);
- return str_conv_enc(str, NULL, rb_default_external_encoding());
-#else
- return rb_external_str_new_cstr(p);
-#endif
-}
-
/*! Sets the current script name to this value.
*
* This is similar to <code>$0 = name</code> in Ruby level but also affects
@@ -1984,7 +1842,7 @@ void
ruby_script(const char *name)
{
if (name) {
- rb_orig_progname = rb_progname = external_str_new_cstr(name);
+ rb_orig_progname = rb_progname = rb_external_str_new(name, strlen(name));
rb_vm_set_progname(rb_progname);
}
}
@@ -2068,7 +1926,8 @@ ruby_prog_init(void)
rb_define_module_function(rb_mProcess, "setproctitle", proc_setproctitle, 1);
/*
- * ARGV contains the command line arguments used to run ruby.
+ * ARGV contains the command line arguments used to run ruby with the
+ * first value containing the name of the executable.
*
* A library like OptionParser can be used to process command-line
* arguments.
@@ -2090,7 +1949,7 @@ ruby_set_argv(int argc, char **argv)
#endif
rb_ary_clear(av);
for (i = 0; i < argc; i++) {
- VALUE arg = external_str_new_cstr(argv[i]);
+ VALUE arg = rb_external_str_new_cstr(argv[i]);
OBJ_FREEZE(arg);
rb_ary_push(av, arg);
@@ -2102,7 +1961,7 @@ ruby_process_options(int argc, char **argv)
{
struct cmdline_options opt;
VALUE iseq;
- const char *script_name = (argc > 0 && argv[0]) ? argv[0] : ruby_engine;
+ const char *script_name = (argc > 0 && argv[0]) ? argv[0] : "ruby";
ruby_script(script_name); /* for the time being */
rb_argv0 = rb_str_new4(rb_progname);
@@ -2110,7 +1969,10 @@ ruby_process_options(int argc, char **argv)
iseq = process_options(argc, argv, cmdline_options_init(&opt));
#ifndef HAVE_SETPROCTITLE
- ruby_init_setproctitle(argc, argv);
+ {
+ extern void ruby_init_setproctitle(int argc, char *argv[]);
+ ruby_init_setproctitle(argc, argv);
+ }
#endif
return (void*)(struct RData*)iseq;
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 4bc9f37e0d..7e16d287f8 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -3,23 +3,6 @@
#if 0
#elif defined HAVE_GCC_ATOMIC_BUILTINS
-typedef unsigned int rb_atomic_t;
-# define ATOMIC_SET(var, val) (void)__atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
-# define ATOMIC_INC(var) __atomic_fetch_add(&(var), 1, __ATOMIC_SEQ_CST)
-# define ATOMIC_DEC(var) __atomic_fetch_sub(&(var), 1, __ATOMIC_SEQ_CST)
-# define ATOMIC_OR(var, val) __atomic_fetch_or(&(var), (val), __ATOMIC_SEQ_CST)
-# define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
-# define ATOMIC_CAS(var, oldval, newval) \
-({ __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
- __atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
- oldvaldup; })
-
-# define ATOMIC_SIZE_ADD(var, val) __atomic_fetch_add(&(var), (val), __ATOMIC_SEQ_CST)
-# define ATOMIC_SIZE_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
-
-# define RUBY_ATOMIC_GENERIC_MACRO 1
-
-#elif defined HAVE_GCC_SYNC_BUILTINS
/* @shyouhei hack to support atomic operations in case of gcc. Gcc
* has its own pseudo-insns to support them. See info, or
* http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html */
@@ -28,14 +11,15 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
# define ATOMIC_SET(var, val) (void)__sync_lock_test_and_set(&(var), (val))
# define ATOMIC_INC(var) __sync_fetch_and_add(&(var), 1)
# define ATOMIC_DEC(var) __sync_fetch_and_sub(&(var), 1)
-# define ATOMIC_OR(var, val) __sync_fetch_and_or(&(var), (val))
+# define ATOMIC_OR(var, val) __sync_or_and_fetch(&(var), (val))
# define ATOMIC_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
# define ATOMIC_CAS(var, oldval, newval) __sync_val_compare_and_swap(&(var), (oldval), (newval))
# define ATOMIC_SIZE_ADD(var, val) __sync_fetch_and_add(&(var), (val))
# define ATOMIC_SIZE_SUB(var, val) __sync_fetch_and_sub(&(var), (val))
-
-# define RUBY_ATOMIC_GENERIC_MACRO 1
+# define ATOMIC_SIZE_INC(var) __sync_fetch_and_add(&(var), 1)
+# define ATOMIC_SIZE_DEC(var) __sync_fetch_and_sub(&(var), 1)
+# define ATOMIC_SIZE_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
#elif defined _WIN32
#if defined _MSC_VER && _MSC_VER > 1200
@@ -81,7 +65,7 @@ rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t new
# define ATOMIC_SIZE_INC(var) InterlockedIncrement64(&(var))
# define ATOMIC_SIZE_DEC(var) InterlockedDecrement64(&(var))
# define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange64(&(var), (val))
-# define ATOMIC_SIZE_CAS(var, oldval, newval) InterlockedCompareExchange64(&(var), (newval), (oldval))
+# define ATOMIC_SIZE_CAS(var, oldval, val) InterlockedCompareExchange64(&(var), (oldval), (val))
# else
# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd((LONG *)&(var), (val))
# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(LONG)(val))
@@ -133,9 +117,11 @@ extern rb_atomic_t ruby_atomic_compare_and_swap(rb_atomic_t *ptr,
# define ATOMIC_SIZE_ADD(var, val) (void)((var) += (val))
# define ATOMIC_SIZE_SUB(var, val) (void)((var) -= (val))
-# define ATOMIC_SIZE_EXCHANGE(var, val) ruby_atomic_size_exchange(&(var), (val))
+# define ATOMIC_SIZE_INC(var) ((var)++)
+# define ATOMIC_SIZE_DEC(var) ((var)--)
+# define ATOMIC_SIZE_EXCHANGE(var, val) atomic_size_exchange(&(var), (val))
static inline size_t
-ruby_atomic_size_exchange(size_t *ptr, size_t val)
+atomic_size_exchange(size_t *ptr, size_t val)
{
size_t old = *ptr;
*ptr = val;
@@ -143,91 +129,8 @@ ruby_atomic_size_exchange(size_t *ptr, size_t val)
}
#endif
-#ifndef ATOMIC_SIZE_INC
-# define ATOMIC_SIZE_INC(var) ATOMIC_INC(var)
-#endif
-#ifndef ATOMIC_SIZE_DEC
-# define ATOMIC_SIZE_DEC(var) ATOMIC_DEC(var)
-#endif
-#ifndef ATOMIC_SIZE_EXCHANGE
-# define ATOMIC_SIZE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
-#endif
#ifndef ATOMIC_SIZE_CAS
# define ATOMIC_SIZE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
#endif
-#if RUBY_ATOMIC_GENERIC_MACRO
-# ifndef ATOMIC_PTR_EXCHANGE
-# define ATOMIC_PTR_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
-# endif
-# ifndef ATOMIC_PTR_CAS
-# define ATOMIC_PTR_CAS(var, oldval, newval) ATOMIC_CAS(var, oldval, newval)
-# endif
-
-# ifndef ATOMIC_VALUE_EXCHANGE
-# define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
-# endif
-# ifndef ATOMIC_VALUE_CAS
-# define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
-# endif
-#endif
-
-#ifndef ATOMIC_PTR_EXCHANGE
-# if SIZEOF_VOIDP == SIZEOF_SIZE_T
-# define ATOMIC_PTR_EXCHANGE(var, val) (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
-# else
-# define ATOMIC_PTR_EXCHANGE(var, val) ruby_atomic_ptr_exchange((const void **)&(var), (val))
-static inline void *
-ruby_atomic_ptr_exchange(const void **ptr, const void *val)
-{
- const void *const old = *ptr;
- *ptr = val;
- return (void *)old;
-}
-# endif
-#endif
-#ifndef ATOMIC_PTR_CAS
-# if SIZEOF_VOIDP == SIZEOF_SIZE_T
-# define ATOMIC_PTR_CAS(var, oldval, val) (void *)ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
-# else
-# define ATOMIC_PTR_CAS(var, oldval, val) ruby_atomic_ptr_cas(&(var), (oldval), (val))
-static inline void *
-ruby_atomic_ptr_cas(const void **ptr, const void *oldval, const void *val)
-{
- const void *const old = *ptr;
- if (old == oldval) *ptr = val;
- return (void *)old;
-}
-# endif
-#endif
-
-#ifndef ATOMIC_VALUE_EXCHANGE
-# if SIZEOF_VALUE == SIZEOF_SIZE_T
-# define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
-# else
-# define ATOMIC_VALUE_EXCHANGE(var, val) ruby_atomic_value_exchange(&(var), (val))
-static inline VALUE
-ruby_atomic_value_exchange(VALUE *ptr, VALUE val)
-{
- const VALUE old = *ptr;
- *ptr = val;
- return old;
-}
-# endif
-#endif
-#ifndef ATOMIC_VALUE_CAS
-# if SIZEOF_VALUE == SIZEOF_SIZE_T
-# define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
-# else
-# define ATOMIC_VALUE_CAS(var, oldval, val) ruby_atomic_value_cas(&(var), (oldval), (val))
-static inline VALUE
-ruby_atomic_value_cas(VALUE *ptr, VALUE oldval, VALUE val)
-{
- const VALUE old = *ptr;
- if (old == oldval) *ptr = val;
- return old;
-}
-# endif
-#endif
-
#endif /* RUBY_ATOMIC_H */
diff --git a/safe.c b/safe.c
index 7aae978272..d9ded85b89 100644
--- a/safe.c
+++ b/safe.c
@@ -12,6 +12,8 @@
/* safe-level:
0 - strings from streams/environment/ARGV are tainted (default)
1 - no dangerous operation by tainted value
+ 2 - process/file operations prohibited
+ 3 - all generated objects are tainted
*/
#define SAFE_LEVEL_MAX RUBY_SAFE_LEVEL_MAX
@@ -23,12 +25,12 @@
#undef rb_secure
#undef rb_set_safe_level
-#undef ruby_safe_level_2_warning
+#undef ruby_safe_level_4_warning
int
-ruby_safe_level_2_warning(void)
+ruby_safe_level_4_warning(void)
{
- return 2;
+ return 4;
}
int
@@ -50,7 +52,7 @@ rb_set_safe_level(int level)
if (level > th->safe_level) {
if (level > SAFE_LEVEL_MAX) {
- rb_raise(rb_eArgError, "$SAFE=2 to 4 are obsolete");
+ rb_raise(rb_eArgError, "$SAFE=4 is obsolete");
}
th->safe_level = level;
}
@@ -73,8 +75,11 @@ safe_setter(VALUE val)
"tried to downgrade safe level from %d to %d",
th->safe_level, level);
}
+ if (level == 3) {
+ rb_warning("$SAFE=3 does no sandboxing");
+ }
if (level > SAFE_LEVEL_MAX) {
- rb_raise(rb_eArgError, "$SAFE=2 to 4 are obsolete");
+ rb_raise(rb_eArgError, "$SAFE=4 is obsolete");
}
th->safe_level = level;
}
@@ -85,8 +90,8 @@ rb_secure(int level)
if (level <= rb_safe_level()) {
ID caller_name = rb_frame_callee();
if (caller_name) {
- rb_raise(rb_eSecurityError, "Insecure operation `%"PRIsVALUE"' at level %d",
- rb_id2str(caller_name), rb_safe_level());
+ rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
+ rb_id2name(caller_name), rb_safe_level());
}
else {
rb_raise(rb_eSecurityError, "Insecure operation at level %d",
@@ -105,8 +110,8 @@ rb_insecure_operation(void)
{
ID caller_name = rb_frame_callee();
if (caller_name) {
- rb_raise(rb_eSecurityError, "Insecure operation - %"PRIsVALUE,
- rb_id2str(caller_name));
+ rb_raise(rb_eSecurityError, "Insecure operation - %s",
+ rb_id2name(caller_name));
}
else {
rb_raise(rb_eSecurityError, "Insecure operation: -r");
@@ -122,6 +127,16 @@ rb_check_safe_obj(VALUE x)
}
void
+rb_check_safe_str(VALUE x)
+{
+ rb_check_safe_obj(x);
+ if (!RB_TYPE_P(x, T_STRING)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected String)",
+ rb_obj_classname(x));
+ }
+}
+
+void
Init_safe(void)
{
rb_define_virtual_variable("$SAFE", safe_getter, safe_setter);
diff --git a/sample/benchmark.rb b/sample/benchmark.rb
deleted file mode 100644
index de5d66f505..0000000000
--- a/sample/benchmark.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'benchmark'
-
-include Benchmark
-
-n = ARGV[0].to_i.nonzero? || 50000
-puts %Q([#{n} times iterations of `a = "1"'])
-benchmark(CAPTION, 7, FORMAT) do |x|
- x.report("for:") {for _ in 1..n; _ = "1"; end} # Benchmark.measure
- x.report("times:") {n.times do ; _ = "1"; end}
- x.report("upto:") {1.upto(n) do ; _ = "1"; end}
-end
-
-benchmark do
- [
- measure{for _ in 1..n; _ = "1"; end}, # Benchmark.measure
- measure{n.times do ; _ = "1"; end},
- measure{1.upto(n) do ; _ = "1"; end}
- ]
-end
diff --git a/sample/cgi-session-pstore.rb b/sample/cgi-session-pstore.rb
deleted file mode 100644
index ec8b4989d6..0000000000
--- a/sample/cgi-session-pstore.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'cgi'
-require 'cgi/session/pstore'
-
-STDIN.reopen(IO::NULL)
-cgi = CGI.new
-session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore)
-session['key'] = {'k' => 'v'}
-puts session['key'].class
-fail unless Hash === session['key']
-puts session['key'].inspect
-fail unless session['key'].inspect == '{"k"=>"v"}'
diff --git a/sample/curses/hello.rb b/sample/curses/hello.rb
new file mode 100644
index 0000000000..a630fb999b
--- /dev/null
+++ b/sample/curses/hello.rb
@@ -0,0 +1,27 @@
+require "curses"
+
+def show_message(message)
+ width = message.length + 6
+ win = Curses::Window.new(5, width,
+ (Curses.lines - 5) / 2, (Curses.cols - width) / 2)
+ win.box('|', '-')
+ win.setpos(2, 3)
+ win.addstr(message)
+ win.refresh
+ win.getch
+ win.close
+end
+
+Curses.init_screen
+begin
+ Curses.crmode
+# show_message("Hit any key")
+ Curses.setpos((Curses.lines - 5) / 2, (Curses.cols - 10) / 2)
+ Curses.addstr("Hit any key")
+ Curses.refresh
+ char = Curses.getch
+ show_message("You typed: #{char}")
+ Curses.refresh
+ensure
+ Curses.close_screen
+end
diff --git a/sample/curses/mouse.rb b/sample/curses/mouse.rb
new file mode 100644
index 0000000000..cc4beeb83d
--- /dev/null
+++ b/sample/curses/mouse.rb
@@ -0,0 +1,52 @@
+require "curses"
+
+def show_message(*msgs)
+ message = msgs.join
+ width = message.length + 6
+ win = Curses::Window.new(5, width,
+ (Curses.lines - 5) / 2, (Curses.cols - width) / 2)
+ win.keypad = true
+ win.attron(Curses.color_pair(Curses::COLOR_RED)){
+ win.box(?|, ?-, ?+)
+ }
+ win.setpos(2, 3)
+ win.addstr(message)
+ win.refresh
+ win.getch
+ win.close
+end
+
+Curses.init_screen
+Curses.start_color
+Curses.init_pair(Curses::COLOR_BLUE, Curses::COLOR_BLUE, Curses::COLOR_WHITE)
+Curses.init_pair(Curses::COLOR_RED, Curses::COLOR_RED, Curses::COLOR_WHITE)
+Curses.crmode
+Curses.noecho
+Curses.stdscr.keypad(true)
+
+begin
+ Curses.mousemask(
+ Curses::BUTTON1_CLICKED|Curses::BUTTON2_CLICKED|Curses::BUTTON3_CLICKED|Curses::BUTTON4_CLICKED
+ )
+ Curses.setpos((Curses.lines - 5) / 2, (Curses.cols - 10) / 2)
+ Curses.attron(Curses.color_pair(Curses::COLOR_BLUE)|Curses::A_BOLD){
+ Curses.addstr("click")
+ }
+ Curses.refresh
+ while( true )
+ c = Curses.getch
+ case c
+ when Curses::KEY_MOUSE
+ m = Curses::getmouse
+ if( m )
+ show_message("getch = #{c.inspect}, ",
+ "mouse event = #{'0x%x' % m.bstate}, ",
+ "axis = (#{m.x},#{m.y},#{m.z})")
+ end
+ break
+ end
+ end
+ Curses.refresh
+ensure
+ Curses.close_screen
+end
diff --git a/sample/curses/rain.rb b/sample/curses/rain.rb
new file mode 100644
index 0000000000..845da2f522
--- /dev/null
+++ b/sample/curses/rain.rb
@@ -0,0 +1,74 @@
+# rain for a curses test
+
+require "curses"
+
+def onsig(sig)
+ Curses.close_screen
+ exit sig
+end
+
+def ranf
+ rand(32767).to_f / 32767
+end
+
+# main #
+for i in %w[HUP INT QUIT TERM]
+ if trap(i, "SIG_IGN") != 0 then # 0 for SIG_IGN
+ trap(i) {|sig| onsig(sig) }
+ end
+end
+
+Curses.init_screen
+Curses.nl
+Curses.noecho
+srand
+
+xpos = {}
+ypos = {}
+r = Curses.lines - 4
+c = Curses.cols - 4
+for i in 0 .. 4
+ xpos[i] = (c * ranf).to_i + 2
+ ypos[i] = (r * ranf).to_i + 2
+end
+
+i = 0
+while TRUE
+ x = (c * ranf).to_i + 2
+ y = (r * ranf).to_i + 2
+
+
+ Curses.setpos(y, x); Curses.addstr(".")
+
+ Curses.setpos(ypos[i], xpos[i]); Curses.addstr("o")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i], xpos[i]); Curses.addstr("O")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i] - 1, xpos[i]); Curses.addstr("-")
+ Curses.setpos(ypos[i], xpos[i] - 1); Curses.addstr("|.|")
+ Curses.setpos(ypos[i] + 1, xpos[i]); Curses.addstr("-")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i] - 2, xpos[i]); Curses.addstr("-")
+ Curses.setpos(ypos[i] - 1, xpos[i] - 1); Curses.addstr("/ \\")
+ Curses.setpos(ypos[i], xpos[i] - 2); Curses.addstr("| O |")
+ Curses.setpos(ypos[i] + 1, xpos[i] - 1); Curses.addstr("\\ /")
+ Curses.setpos(ypos[i] + 2, xpos[i]); Curses.addstr("-")
+
+ i = if i == 0 then 4 else i - 1 end
+ Curses.setpos(ypos[i] - 2, xpos[i]); Curses.addstr(" ")
+ Curses.setpos(ypos[i] - 1, xpos[i] - 1); Curses.addstr(" ")
+ Curses.setpos(ypos[i], xpos[i] - 2); Curses.addstr(" ")
+ Curses.setpos(ypos[i] + 1, xpos[i] - 1); Curses.addstr(" ")
+ Curses.setpos(ypos[i] + 2, xpos[i]); Curses.addstr(" ")
+
+
+ xpos[i] = x
+ ypos[i] = y
+ Curses.refresh
+ sleep(0.5)
+end
+
+# end of main
diff --git a/sample/curses/view.rb b/sample/curses/view.rb
new file mode 100644
index 0000000000..bc54aeb9af
--- /dev/null
+++ b/sample/curses/view.rb
@@ -0,0 +1,91 @@
+#!/usr/local/bin/ruby
+
+require "curses"
+include Curses
+
+#
+# main
+#
+
+if ARGV.size != 1 then
+ printf("usage: view file\n");
+ exit
+end
+begin
+ fp = open(ARGV[0], "r")
+rescue
+ raise "cannot open file: #{ARGV[1]}"
+end
+
+# signal(SIGINT, finish)
+
+init_screen
+#keypad(stdscr, TRUE)
+nonl
+cbreak
+noecho
+#scrollok(stdscr, TRUE)
+
+# slurp the file
+data_lines = []
+fp.each_line { |l|
+ data_lines.push(l)
+}
+fp.close
+
+
+lptr = 0
+while TRUE
+ i = 0
+ while i < lines
+ setpos(i, 0)
+ #clrtoeol
+ addstr(data_lines[lptr + i] || '')
+ i += 1
+ end
+ refresh
+
+ explicit = FALSE
+ n = 0
+ while TRUE
+ c = getch
+ if c =~ /[0-9]/
+ n = 10 * n + c.to_i
+ else
+ break
+ end
+ end
+
+ n = 1 if !explicit && n == 0
+
+ case c
+ when "n" #when KEY_DOWN
+ i = 0
+ while i < n
+ if lptr + lines < data_lines.size then
+ lptr += 1
+ else
+ break
+ end
+ i += 1
+ end
+ #wscrl(i)
+
+ when "p" #when KEY_UP
+ i = 0
+ while i < n
+ if lptr > 0 then
+ lptr -= 1
+ else
+ break
+ end
+ i += 1
+ end
+ #wscrl(-i)
+
+ when "q"
+ break
+ end
+
+end
+close_screen
diff --git a/sample/curses/view2.rb b/sample/curses/view2.rb
new file mode 100644
index 0000000000..037771a226
--- /dev/null
+++ b/sample/curses/view2.rb
@@ -0,0 +1,149 @@
+#!/usr/local/bin/ruby
+
+require "curses"
+
+
+# A curses based file viewer
+class FileViewer
+
+ # Create a new fileviewer, and view the file.
+ def initialize(filename)
+ @data_lines = []
+ @screen = nil
+ @top = nil
+ init_curses
+ load_file(filename)
+ interact
+ end
+
+ # Perform the curses setup
+ def init_curses
+ # signal(SIGINT, finish)
+
+ Curses.init_screen
+ Curses.nonl
+ Curses.cbreak
+ Curses.noecho
+
+ @screen = Curses.stdscr
+
+ @screen.scrollok(true)
+ #$screen.keypad(true)
+ end
+
+ # Load the file into memory, and put
+ # the first part on the curses display.
+ def load_file(filename)
+ fp = open(filename, "r") do |fp|
+ # slurp the file
+ fp.each_line { |l|
+ @data_lines.push(l.chop)
+ }
+ end
+ @top = 0
+ @data_lines[0..@screen.maxy-1].each_with_index{|line, idx|
+ @screen.setpos(idx, 0)
+ @screen.addstr(line)
+ }
+ @screen.setpos(0,0)
+ @screen.refresh
+ rescue
+ raise "cannot open file '#{filename}' for reading"
+ end
+
+
+ # Scroll the display up by one line
+ def scroll_up
+ if( @top > 0 )
+ @screen.scrl(-1)
+ @top -= 1
+ str = @data_lines[@top]
+ if( str )
+ @screen.setpos(0, 0)
+ @screen.addstr(str)
+ end
+ return true
+ else
+ return false
+ end
+ end
+
+ # Scroll the display down by one line
+ def scroll_down
+ if( @top + @screen.maxy < @data_lines.length )
+ @screen.scrl(1)
+ @top += 1
+ str = @data_lines[@top + @screen.maxy - 1]
+ if( str )
+ @screen.setpos(@screen.maxy - 1, 0)
+ @screen.addstr(str)
+ end
+ return true
+ else
+ return false
+ end
+ end
+
+ # Allow the user to interact with the display.
+ # This uses EMACS-like keybindings, and also
+ # vi-like keybindings as well, except that left
+ # and right move to the beginning and end of the
+ # file, respectively.
+ def interact
+ while true
+ result = true
+ c = Curses.getch
+ case c
+ when Curses::KEY_DOWN, Curses::KEY_CTRL_N, ?j
+ result = scroll_down
+ when Curses::KEY_UP, Curses::KEY_CTRL_P, ?k
+ result = scroll_up
+ when Curses::KEY_NPAGE, ?\s # white space
+ for i in 0..(@screen.maxy - 2)
+ if( ! scroll_down )
+ if( i == 0 )
+ result = false
+ end
+ break
+ end
+ end
+ when Curses::KEY_PPAGE
+ for i in 0..(@screen.maxy - 2)
+ if( ! scroll_up )
+ if( i == 0 )
+ result = false
+ end
+ break
+ end
+ end
+ when Curses::KEY_LEFT, Curses::KEY_CTRL_T, ?h
+ while( scroll_up )
+ end
+ when Curses::KEY_RIGHT, Curses::KEY_CTRL_B, ?l
+ while( scroll_down )
+ end
+ when ?q
+ break
+ else
+ @screen.setpos(0,0)
+ @screen.addstr("[unknown key `#{Curses.keyname(c)}'=#{c}] ")
+ end
+ if( !result )
+ Curses.beep
+ end
+ @screen.setpos(0,0)
+ end
+ Curses.close_screen
+ end
+end
+
+
+# If we are being run as a main program...
+if __FILE__ == $0
+ if ARGV.size != 1 then
+ printf("usage: #{$0} file\n");
+ exit
+ end
+
+ viewer = FileViewer.new(ARGV[0])
+end
diff --git a/sample/delegate.rb b/sample/delegate.rb
deleted file mode 100644
index 918dc08877..0000000000
--- a/sample/delegate.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-require 'delegate'
-
-class ExtArray<DelegateClass(Array)
- def initialize()
- super([])
- end
-end
-
-ary = ExtArray.new
-p ary.class
-ary.push 25
-p ary
-ary.push 42
-ary.each {|x| p x}
-
-foo = Object.new
-def foo.test
- 25
-end
-def foo.iter
- yield self
-end
-def foo.error
- raise 'this is OK'
-end
-foo2 = SimpleDelegator.new(foo)
-p foo2
-foo2.instance_eval{print "foo\n"}
-p foo.test == foo2.test # => true
-p foo2.iter{[55,true]} # => true
-foo2.error # raise error!
diff --git a/sample/drb/acl.rb b/sample/drb/acl.rb
deleted file mode 100644
index d93eb9c1fc..0000000000
--- a/sample/drb/acl.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'drb/acl'
-
-list = %w(deny all
- allow 192.168.1.1
- allow ::ffff:192.168.1.2
- allow 192.168.1.3
-)
-
-addr = ["AF_INET", 10, "lc630", "192.168.1.3"]
-
-acl = ACL.new
-p acl.allow_addr?(addr)
-
-acl = ACL.new(list, ACL::DENY_ALLOW)
-p acl.allow_addr?(addr)
diff --git a/sample/drb/ring_place.rb b/sample/drb/ring_place.rb
index 11c6c2fe80..0ceef7c65a 100644
--- a/sample/drb/ring_place.rb
+++ b/sample/drb/ring_place.rb
@@ -18,8 +18,8 @@ if $DEBUG
puts DRb.uri
DRb.thread.join
else
- STDIN.reopen(IO::NULL)
- STDOUT.reopen(IO::NULL, 'w')
- STDERR.reopen(IO::NULL, 'w')
+ STDIN.reopen('/dev/null')
+ STDOUT.reopen('/dev/null', 'w')
+ STDERR.reopen('/dev/null', 'w')
DRb.thread.join
end
diff --git a/sample/exyacc.rb b/sample/exyacc.rb
index 9a9435a0dc..c96ebfd676 100644
--- a/sample/exyacc.rb
+++ b/sample/exyacc.rb
@@ -1,20 +1,20 @@
#! /usr/local/bin/ruby -Kn
# usage: exyacc.rb [yaccfiles]
-# this is covered from exyacc.pl in the camel book
+# this is coverted from exyacc.pl in the camel book
ARGF.each(nil) do |source|
sbeg = source.index("\n%%") + 1
send = source.rindex("\n%%") + 1
- grammar = source[sbeg, send-sbeg]
- grammar.sub!(/.*\n/, "")
- grammar.gsub!(/'\{'/, "'\001'")
- grammar.gsub!(/'\}'/, "'\002'")
- grammar.gsub!(%r{\*/}, "\003\003")
- grammar.gsub!(%r{/\*[^\003]*\003\003}, '')
- while grammar.gsub!(/\{[^{}]*\}/, ''); end
- grammar.gsub!(/'\001'/, "'{'")
- grammar.gsub!(/'\002'/, "'}'")
- while grammar.gsub!(/^[ \t]*\n(\s)/, '\1'); end
- grammar.gsub!(/([:|])[ \t\n]+(\w)/, '\1 \2')
- print grammar
+ grammer = source[sbeg, send-sbeg]
+ grammer.sub!(/.*\n/, "")
+ grammer.gsub!(/'\{'/, "'\001'")
+ grammer.gsub!(/'\}'/, "'\002'")
+ grammer.gsub!(%r{\*/}, "\003\003")
+ grammer.gsub!(%r{/\*[^\003]*\003\003}, '')
+ while grammer.gsub!(/\{[^{}]*\}/, ''); end
+ grammer.gsub!(/'\001'/, "'{'")
+ grammer.gsub!(/'\002'/, "'}'")
+ while grammer.gsub!(/^[ \t]*\n(\s)/, '\1'); end
+ grammer.gsub!(/([:|])[ \t\n]+(\w)/, '\1 \2')
+ print grammer
end
diff --git a/sample/iseq_loader.rb b/sample/iseq_loader.rb
deleted file mode 100644
index bb2d92ea77..0000000000
--- a/sample/iseq_loader.rb
+++ /dev/null
@@ -1,243 +0,0 @@
-#
-# iseq_loader.rb - sample of compiler/loader for binary compiled file
-#
-# Usage as a compiler: ruby iseq_loader.rb [file or directory] ...
-#
-# It compiles and stores specified files.
-# If directories are specified, then compiles and stores all *.rb files.
-# (using Dir.glob)
-#
-# TODO: add remove option
-# TODO: add verify option
-#
-# Usage as a loader: simply require this file with the following setting.
-#
-# Setting with environment variables.
-#
-# * RUBY_ISEQ_LOADER_STORAGE to select storage type
-# * dbm: use dbm
-# * fs: [default] use file system. locate a compiled binary files in same
-# directory of scripts like Rubinius. foo.rb.yarb will be created for foo.rb.
-# * fs2: use file system. locate compiled file in specified directory.
-# * nothing: do nothing.
-#
-# * RUBY_ISEQ_LOADER_STORAGE_DIR to select directory
-# * default: ~/.ruby_binaries/
-#
-# * RUBY_ISEQ_LOADER_STORAGE_COMPILE_IF_NOT_COMPILED
-# * true: store compiled file if compiled data is not available.
-# * false: [default] do nothing if there is no compiled iseq data.
-
-class RubyVM::InstructionSequence
- $ISEQ_LOADER_LOADED = 0
- $ISEQ_LOADER_COMPILED = 0
- $ISEQ_LOADER_IGNORED = 0
- LAUNCHED_TIME = Time.now
- COMPILE_FILE_ENABLE = false || true
- COMPILE_VERBOSE = $VERBOSE || false # || true
- COMPILE_DEBUG = ENV['RUBY_ISEQ_LOADER_DEBUG']
- COMPILE_IF_NOT_COMPILED = ENV['RUBY_ISEQ_LOADER_STORAGE_COMPILE_IF_NOT_COMPILED'] == 'true'
-
- at_exit{
- STDERR.puts "[ISEQ_LOADER] #{Process.pid} time: #{Time.now - LAUNCHED_TIME}, " +
- "loaded: #{$ISEQ_LOADER_LOADED}, " +
- "compied: #{$ISEQ_LOADER_COMPILED}, " +
- "ignored: #{$ISEQ_LOADER_IGNORED}"
- } if COMPILE_VERBOSE
-
- unless cf_dir = ENV['RUBY_ISEQ_LOADER_STORAGE_DIR']
- cf_dir = File.expand_path("~/.ruby_binaries")
- unless File.exist?(cf_dir)
- Dir.mkdir(cf_dir)
- end
- end
- CF_PREFIX = "#{cf_dir}/cb."
-
- class NullStorage
- def load_iseq fname; end
- def compile_and_save_isq fname; end
- def unlink_compiled_iseq; end
- end
-
- class BasicStorage
- def initialize
- require 'digest/sha1'
- end
-
- def load_iseq fname
- iseq_key = iseq_key_name(fname)
- if compiled_iseq_exist?(fname, iseq_key) && compiled_iseq_is_younger?(fname, iseq_key)
- $ISEQ_LOADER_LOADED += 1
- STDERR.puts "[ISEQ_LOADER] #{Process.pid} load #{fname} from #{iseq_key}" if COMPILE_DEBUG
- binary = read_compiled_iseq(fname, iseq_key)
- iseq = RubyVM::InstructionSequence.load_from_binary(binary)
- # p [extra_data(iseq.path), RubyVM::InstructionSequence.load_from_binary_extra_data(binary)]
- # raise unless extra_data(iseq.path) == RubyVM::InstructionSequence.load_from_binary_extra_data(binary)
- iseq
- elsif COMPILE_IF_NOT_COMPILED
- compile_and_save_iseq(fname, iseq_key)
- else
- $ISEQ_LOADER_IGNORED += 1
- # p fname
- nil
- end
- end
-
- def extra_data fname
- "SHA-1:#{::Digest::SHA1.file(fname).digest}"
- end
-
- def compile_and_save_iseq fname, iseq_key = iseq_key_name(fname)
- $ISEQ_LOADER_COMPILED += 1
- STDERR.puts "[RUBY_COMPILED_FILE] compile #{fname}" if COMPILE_DEBUG
- iseq = RubyVM::InstructionSequence.compile_file(fname)
-
- binary = iseq.to_binary(extra_data(fname))
- write_compiled_iseq(fname, iseq_key, binary)
- iseq
- end
-
- # def unlink_compiled_iseq; nil; end # should implement at sub classes
-
- private
-
- def iseq_key_name fname
- fname
- end
-
- # should implement at sub classes
- # def compiled_iseq_younger? fname, iseq_key; end
- # def compiled_iseq_exist? fname, iseq_key; end
- # def read_compiled_file fname, iseq_key; end
- # def write_compiled_file fname, iseq_key, binary; end
- end
-
- class FSStorage < BasicStorage
- def initialize
- super
- require 'fileutils'
- @dir = CF_PREFIX + "files"
- unless File.directory?(@dir)
- FileUtils.mkdir_p(@dir)
- end
- end
-
- def unlink_compiled_iseq
- File.unlink(compile_file_path)
- end
-
- private
-
- def iseq_key_name fname
- "#{fname}.yarb" # same directory
- end
-
- def compiled_iseq_exist? fname, iseq_key
- File.exist?(iseq_key)
- end
-
- def compiled_iseq_is_younger? fname, iseq_key
- File.mtime(iseq_key) >= File.mtime(fname)
- end
-
- def read_compiled_iseq fname, iseq_key
- open(iseq_key, 'rb'){|f| f.read}
- end
-
- def write_compiled_iseq fname, iseq_key, binary
- open(iseq_key, 'wb'){|f| f.write(binary)}
- end
- end
-
- class FS2Storage < FSStorage
- def iseq_key_name fname
- @dir + fname.gsub(/[^A-Za-z0-9\._-]/){|c| '%02x' % c.ord} # special directory
- end
- end
-
- class DBMStorage < BasicStorage
- def initialize
- require 'dbm'
- @db = DBM.open(CF_PREFIX+'db')
- end
-
- def unlink_compiled_iseq
- @db.delete fname
- end
-
- private
-
- def date_key_name fname
- "date.#{fname}"
- end
-
- def iseq_key_name fname
- "body.#{fname}"
- end
-
- def compiled_iseq_exist? fname, iseq_key
- @db.has_key? iseq_key
- end
-
- def compiled_iseq_is_younger? fname, iseq_key
- date_key = date_key_name(fname)
- if @db.has_key? date_key
- @db[date_key].to_i >= File.mtime(fname).to_i
- end
- end
-
- def read_compiled_iseq fname, iseq_key
- @db[iseq_key]
- end
-
- def write_compiled_iseq fname, iseq_key, binary
- date_key = date_key_name(fname)
- @db[iseq_key] = binary
- @db[date_key] = Time.now.to_i
- end
- end
-
- STORAGE = case ENV['RUBY_ISEQ_LOADER_STORAGE']
- when 'dbm'
- DBMStorage.new
- when 'fs'
- FSStorage.new
- when 'fs2'
- FS2Storage.new
- when 'null'
- NullStorage.new
- else
- FSStorage.new
- end
-
- STDERR.puts "[ISEQ_LOADER] use #{STORAGE.class} " if COMPILE_VERBOSE
-
- def self.load_iseq fname
- STORAGE.load_iseq(fname)
- end
-
- def self.compile_and_save_iseq fname
- STORAGE.compile_and_save_iseq fname
- end
-
- def self.unlink_compiled_iseq fname
- STORAGE.unlink_compiled_iseq fname
- end
-end
-
-if __FILE__ == $0
- ARGV.each{|path|
- if File.directory?(path)
- pattern = File.join(path, '**/*.rb')
- Dir.glob(pattern){|file|
- begin
- RubyVM::InstructionSequence.compile_and_save_iseq(file)
- rescue SyntaxError => e
- STDERR.puts e
- end
- }
- else
- RubyVM::InstructionSequence.compile_and_save_iseq(path)
- end
- }
-end
diff --git a/sample/list.rb b/sample/list.rb
index b4d1d653e4..85899ce7ff 100644
--- a/sample/list.rb
+++ b/sample/list.rb
@@ -76,6 +76,6 @@ $list2.add_to_list(20)
$list2.add_to_list(Point.new(4, 5))
$list2.add_to_list($list1)
-# parenthesises around method arguments can be omitted unless ambiguous.
+# parenthesises around method arguments can be ommitted unless ambiguous.
print "list1:\n", $list1, "\n"
print "list2:\n", $list2, "\n"
diff --git a/sample/net-imap.rb b/sample/net-imap.rb
deleted file mode 100644
index b93ecb746e..0000000000
--- a/sample/net-imap.rb
+++ /dev/null
@@ -1,167 +0,0 @@
-require 'net/imap'
-require "getoptlong"
-
-$stdout.sync = true
-$port = nil
-$user = ENV["USER"] || ENV["LOGNAME"]
-$auth = "login"
-$ssl = false
-$starttls = false
-
-def usage
- <<EOF
-usage: #{$0} [options] <host>
-
- --help print this message
- --port=PORT specifies port
- --user=USER specifies user
- --auth=AUTH specifies auth type
- --starttls use starttls
- --ssl use ssl
-EOF
-end
-
-begin
- require 'io/console'
-rescue LoadError
- def _noecho(&block)
- system("stty", "-echo")
- begin
- yield STDIN
- ensure
- system("stty", "echo")
- end
- end
-else
- def _noecho(&block)
- STDIN.noecho(&block)
- end
-end
-
-def get_password
- print "password: "
- begin
- return _noecho(&:gets).chomp
- ensure
- puts
- end
-end
-
-def get_command
- printf("%s@%s> ", $user, $host)
- if line = gets
- return line.strip.split(/\s+/)
- else
- return nil
- end
-end
-
-parser = GetoptLong.new
-parser.set_options(['--debug', GetoptLong::NO_ARGUMENT],
- ['--help', GetoptLong::NO_ARGUMENT],
- ['--port', GetoptLong::REQUIRED_ARGUMENT],
- ['--user', GetoptLong::REQUIRED_ARGUMENT],
- ['--auth', GetoptLong::REQUIRED_ARGUMENT],
- ['--starttls', GetoptLong::NO_ARGUMENT],
- ['--ssl', GetoptLong::NO_ARGUMENT])
-begin
- parser.each_option do |name, arg|
- case name
- when "--port"
- $port = arg
- when "--user"
- $user = arg
- when "--auth"
- $auth = arg
- when "--ssl"
- $ssl = true
- when "--starttls"
- $starttls = true
- when "--debug"
- Net::IMAP.debug = true
- when "--help"
- usage
- exit
- end
- end
-rescue
- abort usage
-end
-
-$host = ARGV.shift
-unless $host
- abort usage
-end
-
-imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl)
-begin
- imap.starttls if $starttls
- class << password = method(:get_password)
- alias to_str call
- end
- imap.authenticate($auth, $user, password)
- while true
- cmd, *args = get_command
- break unless cmd
- begin
- case cmd
- when "list"
- for mbox in imap.list("", args[0] || "*")
- if mbox.attr.include?(Net::IMAP::NOSELECT)
- prefix = "!"
- elsif mbox.attr.include?(Net::IMAP::MARKED)
- prefix = "*"
- else
- prefix = " "
- end
- print prefix, mbox.name, "\n"
- end
- when "select"
- imap.select(args[0] || "inbox")
- print "ok\n"
- when "close"
- imap.close
- print "ok\n"
- when "summary"
- unless messages = imap.responses["EXISTS"][-1]
- puts "not selected"
- next
- end
- if messages > 0
- for data in imap.fetch(1..-1, ["ENVELOPE"])
- print data.seqno, ": ", data.attr["ENVELOPE"].subject, "\n"
- end
- else
- puts "no message"
- end
- when "fetch"
- if args[0]
- data = imap.fetch(args[0].to_i, ["RFC822.HEADER", "RFC822.TEXT"])[0]
- puts data.attr["RFC822.HEADER"]
- puts data.attr["RFC822.TEXT"]
- else
- puts "missing argument"
- end
- when "logout", "exit", "quit"
- break
- when "help", "?"
- print <<EOF
-list [pattern] list mailboxes
-select [mailbox] select mailbox
-close close mailbox
-summary display summary
-fetch [msgno] display message
-logout logout
-help, ? display help message
-EOF
- else
- print "unknown command: ", cmd, "\n"
- end
- rescue Net::IMAP::Error
- puts $!
- end
- end
-ensure
- imap.logout
- imap.disconnect
-end
diff --git a/sample/open3.rb b/sample/open3.rb
deleted file mode 100644
index bc6cdfe3bf..0000000000
--- a/sample/open3.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'open3'
-
-a = Open3.popen3("nroff -man")
-Thread.start do
- while line = gets
- a[0].print line
- end
- a[0].close
-end
-while line = a[1].gets
- print ":", line
-end
diff --git a/sample/pstore.rb b/sample/pstore.rb
deleted file mode 100644
index 38c2305516..0000000000
--- a/sample/pstore.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'pstore'
-
-db = PStore.new("/tmp/foo")
-db.transaction do
- p db.roots
- ary = db["root"] = [1,2,3,4]
- ary[1] = [1,1.5]
-end
-
-1000.times do
- db.transaction do
- db["root"][0] += 1
- p db["root"][0]
- end
-end
-
-db.transaction(true) do
- p db["root"]
-end
diff --git a/sample/pty/shl.rb b/sample/pty/shl.rb
index 980748e8f5..cdaf8d7398 100644
--- a/sample/pty/shl.rb
+++ b/sample/pty/shl.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
#
# old-fashioned 'shl' like program
# by A. Ito
@@ -11,40 +10,39 @@
# q quit
require 'pty'
-require 'io/console'
$shells = []
+$n_shells = 0
$r_pty = nil
$w_pty = nil
def writer
- STDIN.raw!
+ system "stty -echo raw"
begin
while true
c = STDIN.getc
- if c == ?\C-z then
- $reader.raise('Suspend')
+ if c == 26 then # C-z
+ $reader.raise(nil)
return 'Suspend'
end
$w_pty.print c.chr
$w_pty.flush
end
rescue
- $reader.raise('Exit')
+ $reader.raise(nil)
return 'Exit'
ensure
- STDIN.cooked!
+ system "stty echo -raw"
end
end
$reader = Thread.new {
while true
begin
- Thread.stop unless $r_pty
+ next if $r_pty.nil?
c = $r_pty.getc
if c.nil? then
- Thread.main.raise('Exit')
Thread.stop
end
print c.chr
@@ -61,14 +59,19 @@ $reader = Thread.new {
while true
print ">> "
STDOUT.flush
- n = nil
case gets
when /^c/i
- $shells << PTY.spawn("/bin/csh")
- n = -1
+ $shells[$n_shells] = PTY.spawn("/bin/csh")
+ $r_pty,$w_pty = $shells[$n_shells]
+ $n_shells += 1
+ $reader.run
+ if writer == 'Exit'
+ $n_shells -= 1
+ $shells[$n_shells] = nil
+ end
when /^p/i
- $shells.each_with_index do |s, i|
- if s
+ for i in 0..$n_shells
+ unless $shells[i].nil?
print i,"\n"
end
end
@@ -76,18 +79,14 @@ while true
n = $1.to_i
if $shells[n].nil?
print "\##{i} doesn't exist\n"
- n = nil
+ else
+ $r_pty,$w_pty = $shells[n]
+ $reader.run
+ if writer == 'Exit' then
+ $shells[n] = nil
+ end
end
when /^q/i
exit
end
- if n
- $r_pty, $w_pty, pid = $shells[n]
- $reader.run
- if writer == 'Exit' then
- Process.wait(pid)
- $shells[n] = nil
- $shells.pop until $shells.empty? or $shells[-1]
- end
- end
end
diff --git a/sample/rinda-ring.rb b/sample/rinda-ring.rb
deleted file mode 100644
index f9bd934029..0000000000
--- a/sample/rinda-ring.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'rinda/ring'
-
-DRb.start_service
-case ARGV.shift
-when 's'
- require 'rinda/tuplespace'
- ts = Rinda::TupleSpace.new
- Rinda::RingServer.new(ts)
- $stdin.gets
-when 'w'
- finger = Rinda::RingFinger.new(nil)
- finger.lookup_ring do |ts2|
- p ts2
- ts2.write([:hello, :world])
- end
-when 'r'
- finger = Rinda::RingFinger.new(nil)
- finger.lookup_ring do |ts2|
- p ts2
- p ts2.take([nil, nil])
- end
-end
diff --git a/sample/simple-bench.rb b/sample/simple-bench.rb
deleted file mode 100644
index 607fdbf6e9..0000000000
--- a/sample/simple-bench.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-require 'benchmark'
-
-def foo0
-end
-def foo3 a, b, c
-end
-def foo6 a, b, c, d, e, f
-end
-
-def iter0
- yield
-end
-
-def iter1
- yield 1
-end
-
-def iter3
- yield 1, 2, 3
-end
-
-def iter6
- yield 1, 2, 3, 4, 5, 6
-end
-
-(1..6).each{|i|
- kws = (1..i).map{|e| "k#{e}: #{e}"}
- eval %Q{
- def foo_kw#{i}(#{kws.join(', ')})
- end
- }
-
- kws = (1..i).map{|e| "k#{e}:"}
- eval %Q{
- def foo_required_kw#{i}(#{kws.join(', ')})
- end
- }
-}
-
-(1..6).each{|i|
- kws = (1..i).map{|e| "k#{e}: #{e} + 1"}
- eval %Q{
- def foo_complex_kw#{i}(#{kws.join(', ')})
- end
- }
-}
-
-(1..6).each{|i|
- kws = (1..i).map{|e| "k#{e}: #{e}"}
- eval %Q{
- def iter_kw#{i}
- yield #{kws.join(', ')}
- end
- }
-}
-
-ary1 = [1]
-ary2 = [[1, 2, 3, 4, 5]]
-
-test_methods = %Q{
- # empty 1
- # empty 2
- foo0
- foo3 1, 2, 3
- foo6 1, 2, 3, 4, 5, 6
- foo_kw1
- foo_kw2
- foo_kw3
- foo_kw4
- foo_kw5
- foo_kw6
- foo_kw6 k1: 1
- foo_kw6 k1: 1, k2: 2
- foo_kw6 k1: 1, k2: 2, k3: 3
- foo_kw6 k1: 1, k2: 2, k3: 3, k4: 4
- foo_kw6 k1: 1, k2: 2, k3: 3, k4: 4, k5: 5
- foo_kw6 k1: 1, k2: 2, k3: 3, k4: 4, k5: 5, k6: 6
- foo_required_kw1 k1: 1
- foo_required_kw2 k1: 1, k2: 2
- foo_required_kw3 k1: 1, k2: 2, k3: 3
- foo_required_kw4 k1: 1, k2: 2, k3: 3, k4: 4
- foo_required_kw5 k1: 1, k2: 2, k3: 3, k4: 4, k5: 5
- foo_required_kw6 k1: 1, k2: 2, k3: 3, k4: 4, k5: 5, k6: 6
- foo_complex_kw1
- foo_complex_kw2
- foo_complex_kw3
- foo_complex_kw4
- foo_complex_kw5
- foo_complex_kw6
- foo_complex_kw6 k1: 1
- foo_complex_kw6 k1: 1, k2: 2
- foo_complex_kw6 k1: 1, k2: 2, k3: 3
- foo_complex_kw6 k1: 1, k2: 2, k3: 3, k4: 4
- foo_complex_kw6 k1: 1, k2: 2, k3: 3, k4: 4, k5: 5
- foo_complex_kw6 k1: 1, k2: 2, k3: 3, k4: 4, k5: 5, k6: 6
- iter0{}
- iter1{}
- iter1{|a|}
- iter3{}
- iter3{|a|}
- iter3{|a, b, c|}
- iter6{}
- iter6{|a|}
- iter6{|a, b, c, d, e, f, g|}
- iter0{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- iter_kw1{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- iter_kw2{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- iter_kw3{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- iter_kw4{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- iter_kw5{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- iter_kw6{|k1: nil, k2: nil, k3: nil, k4: nil, k5: nil, k6: nil|}
- ary1.each{|e|}
- ary1.each{|e,|}
- ary1.each{|a, b, c, d, e|}
- ary2.each{|e|}
- ary2.each{|e,|}
- ary2.each{|a, b, c, d, e|}
-}
-
-N = 10_000_000
-
-max_line = test_methods.each_line.max_by{|line| line.strip.size}
-max_size = max_line.strip.size
-
-Benchmark.bm(max_size){|x|
-
- str = test_methods.each_line.map{|line| line.strip!
- next if line.empty?
- %Q{
- x.report(#{line.dump}){
- i = 0
- while i<#{N}
- #{line}
- i+=1
- end
- }
- }
- }.join("\n")
- eval str
-}
diff --git a/sample/tempfile.rb b/sample/tempfile.rb
deleted file mode 100644
index 5a363614a3..0000000000
--- a/sample/tempfile.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'tempfile'
-
-f = Tempfile.new("foo")
-f.print("foo\n")
-f.close
-f.open
-p f.gets # => "foo\n"
-f.close!
diff --git a/sample/test.rb b/sample/test.rb
index 14f4d4a0f1..4bef6bc392 100755
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -33,15 +33,9 @@ class Progress
end
if @color
# dircolors-like style
- colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
- begin
- File.read(File.join(__dir__, "../test/colors")).scan(/(\w+)=([^:\n]*)/) do |n, c|
- colors[n] ||= c
- end
- rescue
- end
- @passed = "\e[;#{colors["pass"] || "32"}m"
- @failed = "\e[;#{colors["fail"] || "31"}m"
+ colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:]*)/)] : {}
+ @passed = "\e[#{colors["pass"] || "32"}m"
+ @failed = "\e[#{colors["fail"] || "31"}m"
@reset = "\e[m"
else
@passed = @failed = @reset = ""
@@ -819,7 +813,7 @@ test_ok(catch(:foo) {
break
end
break
- test_ok(false) # should not reach here
+ test_ok(false) # should no reach here
end
false
})
diff --git a/sample/timeout.rb b/sample/timeout.rb
index 8d25d72a76..2870ddb239 100644
--- a/sample/timeout.rb
+++ b/sample/timeout.rb
@@ -8,7 +8,7 @@ end
p timeout(5) {
45
}
-p timeout(5, Timeout::Error) {
+p timeout(5, TimeoutError) {
45
}
p timeout(nil) {
diff --git a/sample/trick2013/README.md b/sample/trick2013/README.md
deleted file mode 100644
index d6458c9d51..0000000000
--- a/sample/trick2013/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-This directory contains the award-winning entries of
-the 1st Transcendental Ruby Imbroglio Contest for rubyKaigi (TRICK 2013).
-
-THESE ARE BAD EXAMPLES! You must NOT use them as a sample code.
-
-* kinaba/entry.rb: "Best pangram" - Gold award
-* mame/entry.rb: "Most classic" - Bronze award
-* shinh/entry.rb: "Most Readable" - Silver award
-* yhara/entry.rb: "Worst abuse of constants" - Dishonorable mention
-
-These files are licensed under MIT license.
-
-For the contest outline and other winning entries, see:
-
-https://github.com/tric/trick2013
diff --git a/sample/trick2013/kinaba/authors.markdown b/sample/trick2013/kinaba/authors.markdown
deleted file mode 100644
index 84c011ee05..0000000000
--- a/sample/trick2013/kinaba/authors.markdown
+++ /dev/null
@@ -1,3 +0,0 @@
-* kinaba
- * kiki@kmonos.net
- * cctld: jp
diff --git a/sample/trick2013/kinaba/entry.rb b/sample/trick2013/kinaba/entry.rb
deleted file mode 100644
index 8a3f855e46..0000000000
--- a/sample/trick2013/kinaba/entry.rb
+++ /dev/null
@@ -1 +0,0 @@
-!@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz&[%r{\"}mosx,4>6]|?'while(putc 3_0-~$.+=9/2^5;)<18*7and:`#
diff --git a/sample/trick2013/kinaba/remarks.markdown b/sample/trick2013/kinaba/remarks.markdown
deleted file mode 100644
index a454a5f0a1..0000000000
--- a/sample/trick2013/kinaba/remarks.markdown
+++ /dev/null
@@ -1,37 +0,0 @@
-### Remarks
-
-Just run it with no argument:
-
- ruby entry.rb
-
-I confirmed the following implementations/platforms:
-
-* ruby 2.0.0p0 (2013-02-24) [i386-mswin32\_100]
-
-### Description
-
-The program prints each ASCII character from 0x20 ' ' to 0x7e '~' exactly once.
-
-The program contains each ASCII character from 0x20 ' ' to 0x7e '~' exactly once.
-
-### Internals
-
-The algorthim is the obvious loop "32.upto(126){|x| putc x}".
-
-It is not so hard to transform it to use each character *at most once*. The only slight difficulty comes from the constraint that we cannot "declare and then use" variables, because then the code will contain the variable name twice. This restriction is worked around by the $. global variable, the best friend of Ruby golfers.
-
-The relatively interesting part is to use all the charcters *at least once*. Of course, this is easily accomplished by putting everything into a comment (i.e., #unused...) or to a string literal (%(unused...), note that normal string literals are forbidden since they use quotation marks twice). Hey, but that's not fun at all! I tried to minimize the escapeway.
-
-* "@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz". Trash box of unused alphabet. I wish I could have used "gkyz" somewhere else.
-
-* "%r{\"}mosx". Regex literal, with %-syntax. I don't even know what each m,o,s,x means...
-
-* "?'" Symbol literal. The quote characters (' " \`) are the first obstacle to this trial because they have to be used in pair usually. These are escaped as \" and ?' and :\`.
-
-* "4>6" "3\_0-~$.+=9/2^5" "18\*7". I had to consume many arithmetic operators +-\*/^~<>, but I only have ten literals 0 to 9 and $. as operands. Besides I have to express the print loop. This is an interesting puzzle.
-
-* "(putc ...;)<18*7". Trail semicolon doesn't change the value of the expression.
-
-### Limitation
-
-n/a.
diff --git a/sample/trick2013/mame/authors.markdown b/sample/trick2013/mame/authors.markdown
deleted file mode 100644
index e99cd71554..0000000000
--- a/sample/trick2013/mame/authors.markdown
+++ /dev/null
@@ -1,3 +0,0 @@
-* Yusuke Endoh
- * mame@tsg.ne.jp
- * cctld: jp
diff --git a/sample/trick2013/mame/entry.rb b/sample/trick2013/mame/entry.rb
deleted file mode 100644
index 8abfc2be40..0000000000
--- a/sample/trick2013/mame/entry.rb
+++ /dev/null
@@ -1,97 +0,0 @@
- eval$C=%q(at_exit{
- open("/dev/dsp","wb"){|g|h=[0]*80
- $><<"\s"*18+"eval$C=%q(#$C);S=%:"
- (S<<m=58).lines{|l|s=[128]*n=20E2
- t=0; h.map!{|v|d=?!==l[
- t]?1 :(l[
- t]== ?#)?
- 0*v= 6:03
- (v<1 ?[]:
- 0..n -1).
- each {|z|
- s[z] +=2*
- M.sin(($*[0] ||1)
- .to_f*M.sin(y= 40*(z+m)*2**
- (t/12E0)/463)+ y)*(v-z*d/n)};
- t+=1;v-d};m+= n;g.flush<<(s.
- pack"C*"); puts(l)}}};M=
- Math);S=%:
-
- Jesu, Joy of Man's Desiring
- Johann Sebastian Bach
-
- #
- | #
- | #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | #
- # # # #
- | | | #
- | #| #
- # # | #
- | | | #
- | | # #
- # # # #
- | | # |
- | | # #
- # # # #
- | | | #
- | | #
- # # # #
- | | # |
- | # # |
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | | # #
- # # # #
- | | | #
- | # #
- # # #
- | | | #
- | # | #
- # # # #
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | :
diff --git a/sample/trick2013/mame/music-box.mp4 b/sample/trick2013/mame/music-box.mp4
deleted file mode 100644
index 6d1e87c01c..0000000000
--- a/sample/trick2013/mame/music-box.mp4
+++ /dev/null
Binary files differ
diff --git a/sample/trick2013/mame/remarks.markdown b/sample/trick2013/mame/remarks.markdown
deleted file mode 100644
index 8c1988c809..0000000000
--- a/sample/trick2013/mame/remarks.markdown
+++ /dev/null
@@ -1,47 +0,0 @@
-### Remarks
-
-Run the program under a platform that `/dev/dsp` is available.
-For example, if you are using pulseaudio, use `padsp`:
-
- padsp ruby entry.rb
-
-Please see Limitation if you want to run this program on os x.
-
-I confirmed the following platforms.
-
-* ruby 2.0.0p0 (2013-02-24 revision 39474) [x86\_64-linux]
-* ruby 1.9.3p194 (2012-04-20 revision 35410) [x86\_64-linux]
-* ruby 1.9.3p327 (2012-11-10 revision 37606) [x86\_64-darwin10.8.0]
-
-For those who are lazy, I'm attaching a screencast.
-
-### Description
-
-This program is a music-box quine.
-It prints itself with playing "Jesu, Joy of Man's Desiring".
-
-### Internal
-
-Like a real music box, this program consists of a mechanical part (code) and a piano roll.
-In the piano roll, `#` represents a pin that hits a note, and `|` represents a slur.
-The leftmost column corresponds 110Hz (low A).
-Every column corresponds a semitone higher than the left one.
-
-This program uses [the frequency modulation synthesis](http://en.wikipedia.org/wiki/Frequency_modulation_synthesis) to play the sound like a music-box.
-You can create a different-sounding tone by changing the parameter.
-For example, the following will play the sound like a harpsichord.
-
- padsp ruby entry.rb 2.0
-
-Note that this program does *not* use an idiom to remove whitespace, such as `.split.join`. All newlines and spaces do not violate any of the Ruby syntax rules.
-
-### Limitation
-
-On os x, `/dev/dsp` is not available.
-You have to use sox by replacing the following part:
-
- open("/dev/dsp","wb")
-
-with:
-
- IO.popen("./pl","wb") \ No newline at end of file
diff --git a/sample/trick2013/shinh/authors.markdown b/sample/trick2013/shinh/authors.markdown
deleted file mode 100644
index 7ea2298a1a..0000000000
--- a/sample/trick2013/shinh/authors.markdown
+++ /dev/null
@@ -1,2 +0,0 @@
-Shinichiro Hamaji
-Japan, .jp
diff --git a/sample/trick2013/shinh/entry.rb b/sample/trick2013/shinh/entry.rb
deleted file mode 100644
index cd4517358a..0000000000
--- a/sample/trick2013/shinh/entry.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-begin with an easy program.
-you should be able to write
-a program unless for you,
-program in ruby language is
-too difficult. At the end
-of your journey towards the
-ultimate program; you must
-be a part of a programming
-language. You will end if
-you != program
diff --git a/sample/trick2013/shinh/remarks.markdown b/sample/trick2013/shinh/remarks.markdown
deleted file mode 100644
index 1cd190db9f..0000000000
--- a/sample/trick2013/shinh/remarks.markdown
+++ /dev/null
@@ -1,4 +0,0 @@
-This program is a meaningless poem.
-This does nothing for you.
-Almost everything in this code is junk,
-but you and program would confuse you a bit.
diff --git a/sample/trick2013/yhara/authors.markdown b/sample/trick2013/yhara/authors.markdown
deleted file mode 100644
index c0adc2bfdb..0000000000
--- a/sample/trick2013/yhara/authors.markdown
+++ /dev/null
@@ -1,3 +0,0 @@
-* Yutaka Hara
- * yutaka.hara.gmail.com
- * cctld: jp
diff --git a/sample/trick2013/yhara/entry.rb b/sample/trick2013/yhara/entry.rb
deleted file mode 100644
index a2deb54399..0000000000
--- a/sample/trick2013/yhara/entry.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-def _(&b)$><<->(x){x ? (String===x ?x.upcase:
-(Class===x ? x : x.class).name[$a?0:($a=5)]):
-" "}[ begin b[];rescue Exception;$!;end ] end
-
-_ { return }
-_ { method(:p).unbind }
-_ { eval "{ " }
-_ { Thread.current.join }
-_ { nil }
-_ { select }
-_ { ruby }
-_ { self.class }
-_ { Thread.current.group }
-_ { nil.to_h }
-_ { "\xFF".encode("big5") }
-_ { raise }
-_ { [0][1] }
-_ { Regexp.compile "*" }
-_ { RUBY_COPYRIGHT[32] }
-_ { binding }
-_ { :s.class.name[1] }
-_ { warn }
-_ { [a: :b][0] }
-_ { methods }
-_ { IO.class }
-_ { {}.fetch(0) }
-_ { open " " }
-_ { 1000000.chr }
diff --git a/sample/trick2013/yhara/remarks.en.markdown b/sample/trick2013/yhara/remarks.en.markdown
deleted file mode 100644
index bd821e882c..0000000000
--- a/sample/trick2013/yhara/remarks.en.markdown
+++ /dev/null
@@ -1,23 +0,0 @@
-### Remarks
-
-Just run it with no argument:
-
- ruby entry.rb
-
-I confirmed the following implementations/platforms:
-
-* ruby 2.0.0p0 (2013-02-24 revision 39474) [x86\_64-darwin12.2.1]
-
-### Description
-
-It prints JUST ANOTHER RUBY HACKER
-
-### Internals
-
-This script uses characters in constants in Object class. It
-intentionally raises some exceptions. The second 'U' comes from
-RUBY\_COPYRIGHT, "Yukihiro Matsumoto".
-
-### Limitation
-
-This program does not work on JRuby because "return" does not raise an exception.
diff --git a/sample/trick2013/yhara/remarks.markdown b/sample/trick2013/yhara/remarks.markdown
deleted file mode 100644
index 99cb4b557c..0000000000
--- a/sample/trick2013/yhara/remarks.markdown
+++ /dev/null
@@ -1,24 +0,0 @@
-### Remarks
-
-引数なしで普通に実行してください。
-
- ruby entry.rb
-
-以下の実装・プラットフォームで動作確認しています。
-
-* ruby 2.0.0p0 (2013-02-24 revision 39474) [x86\_64-darwin12.2.1]
-
-### Description
-
-JUST ANOTHER RUBY HACKERと表示します。
-
-### Internals
-
-Objectクラスの定数から文字を拾っています。
-そのために、意図的に例外を起こしています。
-「U」が一つしか見つからなかったので、もう一個はRUBY\_COPYRIGHTの
-「Yukihiro Matsumoto」から取っています。
-
-### Limitation
-
-JRubyはreturnがエラーにならなくて、動きませんでした。
diff --git a/sample/trick2015/README.md b/sample/trick2015/README.md
deleted file mode 100644
index 6cae824796..0000000000
--- a/sample/trick2015/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-This directory contains the award-winning entries of
-the 2nd Transcendental Ruby Imbroglio Contest for rubyKaigi (TRICK 2015).
-
-THESE ARE BAD EXAMPLES! You must NOT use them as a sample code.
-
-* kinaba/entry.rb: "Best piphilology" - **Gold award**
-* ksk\_1/entry.rb: "Most unreadable ALU" - **Silver award**
-* monae/entry.rb: "Doubling amphisbaena award" - **Bronze award**
-* eregon/entry.rb: "Least general solver" - 4th prize
-* ksk\_2/entry.rb: "Most general solver" - 5th prize
-
-These files are licensed under MIT license.
-
-For the contest outline and other winning entries, see:
-
-https://github.com/tric/trick2015
diff --git a/sample/trick2015/eregon/authors.markdown b/sample/trick2015/eregon/authors.markdown
deleted file mode 100644
index 68ca8cdfe0..0000000000
--- a/sample/trick2015/eregon/authors.markdown
+++ /dev/null
@@ -1,3 +0,0 @@
-* Benoit Daloze (eregon)
- * eregontp@gmail.com
- * cctld: be
diff --git a/sample/trick2015/eregon/entry.rb b/sample/trick2015/eregon/entry.rb
deleted file mode 100644
index 51d5c768b2..0000000000
--- a/sample/trick2015/eregon/entry.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class String;def[]*a;$*<<a;b;end;end;
-_=0;z="C=Fiber;s=$*;a=*0..8;l=C.new{e
-xit},*a.product(a).select{|r,c|s[r][c
-]==0}."[1,9,_, _,_,8, _,_,5]+"map{|r,
-c|C.ne"[_,_,2, _,5,_, _,8,9]+"w{o=s[r
-][c];l"[8,_,6, 7,4,_, _,_,_]+"oop{(1.
-.9).map{|n|C.yield(s[r][c]=n)if a.non
-e?{|k|"[_,_,_, _,_,4, _,9,2]+"s[r][k]
-==n||s"[_,2,3, _,7,_, 8,1,_]+"[k][c]=
-=n||s["[5,6,_, 8,_,_, _,_,_]+"r-r%3+k
-%3][c-c%3+k/3]==n}};s[r][c]=o;C.yield
-}}},C."[_,_,_, _,2,7, 9,_,3]+"new{loo
-p{puts"[9,3,_, _,8,_, 1,_,_]+" s.map{
-|r|r*'"[2,_,_, 5,_,_, _,4,8]+" '}<<''
-;C.yield}};c=l[i=1];loop{c=l[i+=c.res
-ume ? 1:-1]}";eval z.tr ?\n,''
diff --git a/sample/trick2015/eregon/remarks.markdown b/sample/trick2015/eregon/remarks.markdown
deleted file mode 100644
index a56f24da71..0000000000
--- a/sample/trick2015/eregon/remarks.markdown
+++ /dev/null
@@ -1,70 +0,0 @@
-### Remarks
-
-Just run it without arguments:
-
- ruby entry.rb
-
-I confirmed the following implementations and platforms:
-
-* Linux:
- * ruby 2.3.0dev (2015-10-30 trunk 52394) [x86\_64-linux]
- * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86\_64-linux]
- * ruby 2.0.0p647 (2015-08-18) [x86\_64-linux]
-* Darwin:
- * ruby 2.0.0p247 (2013-06-27 revision 41674) [x86\_64-darwin10.8.0]
- * jruby 9.0.3.0 (2.2.2) 2015-10-21 633c9aa Java HotSpot(TM) 64-Bit Server VM 25.11-b03 on 1.8.0\_11-b12 +jit [darwin-x86\_64]
- * rubinius 2.2.6.n74 (2.1.0 94b3a9b4 2014-03-15 JI) [x86\_64-darwin12.5.0]
-
-### Description
-
-This program shows all solutions of any sudoku puzzle.
-
-The embedded sudoku puzzle can be changed at wish.
-
-Giving an empty puzzle (all `0` or `_`), the program will print every possible completed sudoku puzzle.
-We do not however make any time guarantee on such behavior.
-
-The program is rather small for the task: the solver is actually 302 characters long,
-assuming the sudoku puzzle is in a variable `s` and encoded as an array of rows of numbers.
-
-### Internals
-
-* The program implements backtracking and keeps state in a very elegant way.
-* The whole program never goes deeper than 9 stack frames,
- but yet can backtrack up to 81 levels!
-* The main loop of a program is a dance between cells.
- On one end is the solutions, on the other the program ends.
-* The program only uses *infinite* loops and no `break`.
-* The program interleaves the creation of the solver and the puzzle.
-* The program is easy to deobfuscate but finding how it works will be more challenging.
-* The last line contains a smiley.
-
-The author likes good numbers:
-
- $ wc entry.rb
- 15 42 600
-
-The inspiration for this entry comes from:
-
-* A newspaper sudoku with multiple solutions
-* An inspiring paper: `Revisiting Coroutines`
-
-Various tricks used for brevity:
-
-* The method defined is one of the fews which may contain neither parenthesis nor spaces.
-* The program uses the return value of Fiber.yield without arguments.
-* `String#b` is used as a very short `self`.
-
-Design issues:
-
-* Since `return`-ing from a Fiber is not allowed, the programs must `exit`.
-* The program reveals that the cartesian product operator is still too long: `a.product(a)` while it could be `a*a`.
-
-Note:
-
-* In the original code, the last cell was: `C.new{loop{yield s; C.yield}}`,
- implementing some sort of "forwarding coroutine".
-
-### Limitation
-
-* The program does not want any *argument* with you and will quit quietly if you try some.
diff --git a/sample/trick2015/kinaba/authors.markdown b/sample/trick2015/kinaba/authors.markdown
deleted file mode 100644
index 23d4448cf3..0000000000
--- a/sample/trick2015/kinaba/authors.markdown
+++ /dev/null
@@ -1,4 +0,0 @@
-* kinaba
- * twitter.com/kinaba
- * kiki@kmonos.net
- * cctld: jp
diff --git a/sample/trick2015/kinaba/entry.rb b/sample/trick2015/kinaba/entry.rb
deleted file mode 100644
index 18923a6a9f..0000000000
--- a/sample/trick2015/kinaba/entry.rb
+++ /dev/null
@@ -1,150 +0,0 @@
-big, temp = Array 100000000**0x04e2
-srand big
-alias $curTerm $initTerm
-
-Numeric
-Interrupt
-
-big += big
-printout _pi_ finish if $never
-init ||= big
-$counter ||= 02
-
-private
-@mainloop
-while 0x00012345 >= $counter
-
- Rational aprx = 3.141592r
- numbase = 0o0000
-
- @justonce
- def increment
- $initTerm ||= Integer srand * 0x00000002
- srand $counter += 0x00000001
-
- $noaction
- Integer rand
- $noaction
- rand
- rand
- alias $line_cnt $.
- end
-
- @lets_just
- @assume
- diameter = 100000
-
- @you
- @then_have
- permtr |= +3_14159
-
- return if $nomeaning
-
- @onlyuse
- increment
-
- beautiful computer action if $nothing
- $sigmaTerm ||= init
- $curTerm /= srand and init
- pi, = Integer $sigmaTerm unless $nomean
-
- iterator?
- $counter += 1
- atan real_one multiplied by__four unless
- srand +big && $counter >> 0b1
-
- Enumerable
- Fixnum
- Bignum
- Math
- Complex
- Comparable
- TrueClass
- Dir
- Encoding
- Data
- Hash
- Method
- Enumerator
- Exception
- Fiber
- Errno
- FalseClass
- Mutex
- NilClass
- IO
- GC
-
- num = numbase |= srand
-
- ENV
- Float
- MatchData
- Proc
- TracePoint
- KeyError
- p or
- FileTest
- File
- EOFError
- p
- p
- p
- Binding
- Time
- Class
-
- $sigmaTerm += $curTerm
- puts a HelloWorld if $nomean
- SystemExit
-
- !LoadError
- 31i
- 3.1415e0
- Array 14 + 3
- IndexError
- Range
- false
- 55555
- NameError
-
- Object
- @ori
- @ent
- RubyVM
-
- pi += 3_3_1_3_8
-
- @use
- @lots_of
- @keywords
- begin
- self
- $noaction
- not $important
- nil
- __FILE__.object_id
- rescue
- next
- redo if __LINE__
- defined? +$nomeaning
- $noaction
- $nomean
- break $never
- ensure
- class PiCompute
- end
- end
-
- This code cannot _ be executed with typical style unless true
- $curTerm *= num
-end
-
-@ll_set
-@re_U_ok
-
-$Enjoy
-$Superb
-$TRICK15 and a number
-
-print pi
diff --git a/sample/trick2015/kinaba/remarks.markdown b/sample/trick2015/kinaba/remarks.markdown
deleted file mode 100644
index 6316c51fb6..0000000000
--- a/sample/trick2015/kinaba/remarks.markdown
+++ /dev/null
@@ -1,85 +0,0 @@
-### Remarks
-
-Just run it with no argument:
-
- $ ruby entry.rb
-
-I confirmed the following implementation/platform:
-
-- ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]
-
-
-### Description
-
-The program is a [Piphilology](https://en.wikipedia.org/wiki/Piphilology#Examples_in_English)
-suitable for Rubyists to memorize the digits of [Pi](https://en.wikipedia.org/wiki/Pi).
-
-In English, the poems for memorizing Pi start with a word consisting of 3-letters,
-1-letter, 4-letters, 1-letter, 5-letters, ... and so on. 10-letter words are used for the
-digit `0`. In Ruby, the lengths of the lexical tokens tell you the number.
-
- $ ruby -r ripper -e \
- 'puts Ripper.tokenize(STDIN).grep(/\S/).map{|t|t.size%10}.join' < entry.rb
- 31415926535897932384626433832795028841971693993751058209749445923078164062862...
-
-The program also tells you the first 10000 digits of Pi, by running.
-
- $ ruby entry.rb
- 31415926535897932384626433832795028841971693993751058209749445923078164062862...
-
-
-### Internals
-
-Random notes on what you might think interesting:
-
-- The 10000 digits output of Pi is seriously computed with no cheets. It is calculated
- by the formula `Pi/2 = 1 + 1/3 + 1/3*2/5 + 1/3*2/5*3/7 + 1/3*2/5*3/7*4/9 + ...`.
-
-- Lexical tokens are not just space-separated units. For instance, `a*b + cdef` does
- not represent [3,1,4]; rather it's [1,1,1,1,4]. The token length
- burden imposes hard constraints on what we can write.
-
-- That said, Pi is [believed](https://en.wikipedia.org/wiki/Normal_number) to contain
- all digit sequences in it. If so, you can find any program inside Pi in theory.
- In practice it isn't that easy particularly under the TRICK's 4096-char
- limit rule. Suppose we want to embed `g += hij`. We have to find [1,2,3] from Pi.
- Assuming uniform distribution, it occurs once in 1000 digits, which already consumes
- 5000 chars in average to reach the point. We need some TRICK.
-
- - `alias` of global variables was useful. It allows me to access the same value from
- different token-length positions.
-
- - `srand` was amazingly useful. Since it returns the "previous seed", the token-length
- `5` essentially becomes a value-store that can be written without waiting for the
- 1-letter token `=`.
-
-- Combination of these techniques leads to a carefully chosen 77-token Pi computation
- program (quoted below), which is embeddable to the first 242 tokens of Pi.
- Though the remaining 165 tokens are just no-op fillers, it's not so bad compared to
- the 1000/3 = 333x blowup mentioned above.
-
-
- big, temp = Array 100000000**0x04e2
- srand big
- alias $curTerm $initTerm
- big += big
- init ||= big
- $counter ||= 02
- while 0x00012345 >= $counter
- numbase = 0x0000
- $initTerm ||= Integer srand * 0x00000002
- srand $counter += 0x00000001
- $sigmaTerm ||= init
- $curTerm /= srand
- pi, = Integer $sigmaTerm
- $counter += 1
- srand +big && $counter >> 0b1
- num = numbase |= srand
- $sigmaTerm += $curTerm
- pi += 3_3_1_3_8
- $curTerm *= num
- end
- print pi
-
-- By the way, what's the blowup ratio of the final code, then?
- It's 242/77, whose first three digits are, of course, 3.14.
diff --git a/sample/trick2015/ksk_1/authors.markdown b/sample/trick2015/ksk_1/authors.markdown
deleted file mode 100644
index bd6d41f6c7..0000000000
--- a/sample/trick2015/ksk_1/authors.markdown
+++ /dev/null
@@ -1,3 +0,0 @@
-* Keisuke Nakano
- * ksk@github, ksknac@twitter
- * cctld: jp
diff --git a/sample/trick2015/ksk_1/entry.rb b/sample/trick2015/ksk_1/entry.rb
deleted file mode 100644
index 64d3efd799..0000000000
--- a/sample/trick2015/ksk_1/entry.rb
+++ /dev/null
@@ -1 +0,0 @@
-%%%while eval '_=%%r%%(.)...\1=%%=~[%%%%,,,,,%%%s ?=]*%%%%%%#"]*%%%%3x+1?%%'.% %%",%*p(_||=eval($**%%%))
diff --git a/sample/trick2015/ksk_1/remarks.markdown b/sample/trick2015/ksk_1/remarks.markdown
deleted file mode 100644
index b822dc55c8..0000000000
--- a/sample/trick2015/ksk_1/remarks.markdown
+++ /dev/null
@@ -1,120 +0,0 @@
-### Remarks
-
-The program is run with a positive integer as an argument, e.g.,
-```shell
- ruby entry.rb 27
-```
-It has been confirmed to be run on
-```
- ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-darwin11.4.2]
- ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
- ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
-```
-
-
-### Description
-
-The program prints a Collatz sequence started with a given number,
-that is, it repeatedly outputs numbers obtained by applying the
-following Half-Or-Triple-Plus-One (HOTPO) process to the previous
-number:
-
-> If the number is even, divide it by two, otherwise, multiply it by three and add one.
-
-until the number becomes 1. Collatz conjectured that no matter from
-the process starts it always eventually terminates. This is still
-an open problem, hence the program may not terminate for some
-numbers. It is known that there is no such exception below 2<sup>60</sup>.
-
-
-### Internals
-
-The source code does not contain either conditional branch or arithmetic operation.
-The trick shall be revealed step by step.
-
-First, the code is obfuscated by using `%`-notations,
-`*`(String#join), `%`-formatting, restructuring, and so on.
-Here is an equivalent readable program:
-```ruby
-n = ARGV[0].to_i
-begin
- # do nothing
-end while begin
- puts n
- n = (/(.)...\1=/ =~ eval('[",,,,,"'+ '",'*n + ' ?=].join#"].join("3x+1?")'))
-end
-```
-The line
-```ruby
- n = (/(.)...\1=/ =~ eval('[",,,,,"'+ '",'*n + ' ?=].join#"].join("3x+1?")'))
-```
-performs the HOTPO process.
-The `eval` expression here returns a string as explained in detail later.
-Since *regex*`=~`*str* returns index of first match of *regex* in *str*,
-the regular expression `(.)...\1` must match the string
-at index `n/2` if `n` is even and
-at `3*n+1` if `n` is odd greater than 1.
-The match must fail in the case of `n = 1` so that it returns `nil`.
-
-The key of simulating the even-odd conditional branch on `n` in the
-HOTPO process is an `n`-length sequence of the incomplete fragments
-`",` where the double-quote `"` changes its role of opening/closing
-string literals alternately. If `n` is even, the string in the `eval`
-expression is evaluated as
-```ruby
- => '[",,,,,"'+ '",' + '",' + '",' + ... + '",' + ' ?=].join#...'
- => '[",,,,,"",",",...", ?=].join#...'
-```
-where the last double-quote `"` is closing hence the code after `#` is
-ignored as comments. Note that `"ab""cd"` in Ruby is equivalent to
-`"abcd"`. Therefore the `eval` expression is evaluated into
-```ruby
- ",,,,,...,="
-```
-where the number of commas is `5+n/2`.
-As a result, the regular expression `(.)...\1=` matches `,,,,,=`
-at the end of string, that is, at index `5+n/2-5 = n/2`.
-
-If `n` is odd, the string in the `eval` expression is evaluated as
-```ruby
- => '[",,,,,"'+ '",' + '",' + '",' + '",' + ... + '",' + ' ?=].join#"].join("3x+1?")'
- => '[",,,,,"",",",",...,", ?=].join#"].join("3x+1?")'
-```
-where the last element in the array is `", ?=].join#"`. Threfore the
-`eval` expression is evaluated into
-```
- ",,,,,,3x+1?,3x+1?,...,3x+1?, ?=].join#"
-```
-where the number of `,3x+1?` is `(n-1)/2`. As a result, the regular
-expression `(.)...\1=` matches `?, ?=` at the almost end of string,
-that is, at index `5+(n-1)/2*6-1 = 3n+1`, provided that the match
-fails in the case of `n = 1` because the symbol `?` occurs only once
-in the string.
-
-One may notice that the string `3x+1` in the code could be other
-four-character words. I chose it because the Collatz conjecture is
-also called the 3x+1 problem.
-
-
-### Variant
-
-The Collatz conjecture is equivalently stated as,
-
-> no matter from the HOTPO process starts, it always eventually
- reaches the cycle of 4, 2, and 1
-
-instead of termination of the process at 1. This alternative
-statement makes the program simpler because we do not have to care the
-case of n = 1. It can be obtained by replacing the regular expression
-is simply `/=/` and removing a padding `",,,,,"`. The program no
-longer terminates, though.
-
-
-### Limination
-
-The implementation requires to manipulate long strings even for some
-small starting numbers. For example, starting from 1,819, the number
-will reach up to 1,276,936 which causes SystemStackError on Ruby 1.9.3.
-The program works on Ruby 2.0.0 and 2.2.3, though.
-
-
diff --git a/sample/trick2015/ksk_2/abnormal.cnf b/sample/trick2015/ksk_2/abnormal.cnf
deleted file mode 100644
index 084303f041..0000000000
--- a/sample/trick2015/ksk_2/abnormal.cnf
+++ /dev/null
@@ -1,6 +0,0 @@
-c Example CNF format file
-c
-p cnf 4 3
-1 3 -4 0
-4 0 2
--3
diff --git a/sample/trick2015/ksk_2/authors.markdown b/sample/trick2015/ksk_2/authors.markdown
deleted file mode 100644
index bd6d41f6c7..0000000000
--- a/sample/trick2015/ksk_2/authors.markdown
+++ /dev/null
@@ -1,3 +0,0 @@
-* Keisuke Nakano
- * ksk@github, ksknac@twitter
- * cctld: jp
diff --git a/sample/trick2015/ksk_2/entry.rb b/sample/trick2015/ksk_2/entry.rb
deleted file mode 100644
index 55b488e3a8..0000000000
--- a/sample/trick2015/ksk_2/entry.rb
+++ /dev/null
@@ -1 +0,0 @@
-_='s %sSATISFIABLE';puts eval$<.read.gsub(/.*p.*?(\d+).*?$|\d+/m){$1?%w[?-* +'=-'=~/#{'(-?)'* }-*=(?=]*$1:$&>?0?"\\#$&$|":'$)(?='}+')/x?[_%p%i=0,[*$~].map{|x|x>?-?:v:eval(x+?1)*i-=1}*" "]:_%:UN'
diff --git a/sample/trick2015/ksk_2/quinn.cnf b/sample/trick2015/ksk_2/quinn.cnf
deleted file mode 100644
index 556a9b33f5..0000000000
--- a/sample/trick2015/ksk_2/quinn.cnf
+++ /dev/null
@@ -1,21 +0,0 @@
-c quinn.cnf
-c
-p cnf 16 18
- 1 2 0
- -2 -4 0
- 3 4 0
- -4 -5 0
- 5 -6 0
- 6 -7 0
- 6 7 0
- 7 -16 0
- 8 -9 0
- -8 -14 0
- 9 10 0
- 9 -10 0
--10 -11 0
- 10 12 0
- 11 12 0
- 13 14 0
- 14 -15 0
- 15 16 0 \ No newline at end of file
diff --git a/sample/trick2015/ksk_2/remarks.markdown b/sample/trick2015/ksk_2/remarks.markdown
deleted file mode 100644
index bb9b705773..0000000000
--- a/sample/trick2015/ksk_2/remarks.markdown
+++ /dev/null
@@ -1,204 +0,0 @@
-### Remarks
-
-The program is run with a data file from the standard input, e.g.,
-```shell
- ruby entry.rb < data
-```
-where ``<`` can be omitted. The data file must be in the DIMACS CNF
-format (see Description for detail). It has been confirmed to be run on
-```
- ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-darwin11.4.2]
- ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
- ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
-```
-For particular inputs, the program works differently on these environments
-(see Limitation).
-
-
-### Description
-
-The program is a very small SAT solver with 194 bytes making use of a
-powerful feature of Regexp matching in Ruby. It receives a data file
-from the standard input in the DIMACS CNF that is a standard format
-for inputs of SAT solvers. For example, the text in the DIMACS CNF
-format,
-```
-c
-c This is a sample input file.
-c
-p cnf 3 5
- 1 -2 3 0
--1 2 0
--2 -3 0
- 1 2 -3 0
- 1 3 0
-```
-corresponds to a propositional formula in conjunctive normal form,
-
- (L1 &or; &not;L2 &or; L3) &and;
- (&not;L1 &or; L2) &and;
- (&not;L2 &or; &not;L3) &and;
- (L1 &or; L2 &or; &not;L3) &and;
- (L1 &or; L3).
-
-In the DIMACS CNF format, the lines starting with ``c`` are comments
-that are allowed only before the line ``p cnf ...``. The line ``p cnf
-3 5`` represents that the problem is given in conjunctive normal form
-with 3 variables (L1,L2,and L3) and 5 clauses. A clause is given by a
-sequence of the indices of positive literals and the negative indices
-of negative literals. Each clause is terminated by ``0``. For the
-input above, the program outputs
-```
-s SATISFIABLE
-v 1 2 -3
-```
-because the formula is satisfiable by L1=true, L2=true, and L3=false.
-If an unsatisfiable formula is given, the program should output
-```
-s UNSATISFIABLE
-```
-This specification is common in most exiting SAT solvers and required
-for entries of [SAT competition](http://www.satcompetition.org/).
-
-The program is very small with no other external libraries thanks to
-the wealth of string manipulations in Ruby. It is much smaller than
-existing small SAT solvers like [minisat](http://minisat.se/) and
-[picosat](http://fmv.jku.at/picosat/)!
-
-
-### Internals
-
-The basic idea of the program is a translation from DIMACS CNF format
-into Ruby. For example, the data file above is translated into a
-``Regexp`` matching expression equivalent to
-```ruby
- '---=-' =~
- /(-?)(-?)(-?)-*=(?=\1$|-\2$|\3$|$)(?=-\1$|\2$|$)(?=-\2$|-\3$|$)(?=\1$|\2$|-\3$|$)(?=\1$|\3$|$)(?=)/
-```
-that returns ``MatchData`` if the formula is satisfiable and otherwise
-returns ``nil``. The beginning of regular expression
-``(-?)(-?)(-?)-*=`` matches a string ``"---="`` so that each
-capturing pattern ``(-?)`` matches either ``"-"`` or `""`, which
-corresponds to an assignment of true or false, respectively, for a
-propositional variable. Each clause is translated into positive
-lookahead assertion like ``(?=\1$|-\2$|\3$|$)`` that matches
-``"-"`` only when ``\1`` holds ``"-"``, ``\2`` holds ``""``, or ``\3``
-holds ``"-"``. This exactly corresponds to the condition for
-L1&or;&not;L2&or;L3 to be true. The last case ``|$`` never matches
-``"-"`` but it is required for making the translation simple.
-The last meaningless positive lookahead assertion ``(?=)`` is added
-for a similar reason. This translation is based on
-[Abigail's idea](http://perl.plover.com/NPC/NPC-3SAT.html) where a
-3SAT formula is translated into a similar Perl regular expression.
-The differences are the submitted Ruby program translates directly
-from the DIMACS CNF format and tries to make the code shorter by using
-lookahead assertion which can also make matching more faster.
-
-Thanks to the ``x`` option for regular expression, the input above is
-simply translated into
-```ruby
- ?-*3+'=-'=~/#{'(-?)'*3}-*=(?=
- \1$| -\2$| \3$| $)(?=
- -\1$| \2$| $)(?=
- -\2$| -\3$| $)(?=
- \1$| \2$| -\3$| $)(?=
- \1$| \3$| $)(?=
- )/x
-```
-which has a structure similar to the DIMACS CNF format.
-
-The part of formatting outputs in the program is obfuscated as an
-inevitable result of 'golfing' the original program
-```ruby
- if ...the matching expression above... then
- puts 's SATISFIABLE'
- puts 'v '+$~[1..-1].map.with_index{|x,i|
- if x == '-' then
- i+1
- else
- ['-',i+1].join
- end
- }.join(' ')
- else
- puts 's UNSATISFIABLE'
- end
-```
-In the satisfiable case, the MatchData ``$~`` obtained by the regular expression
-has the form of
-```
- #<MatchData "---=" 1:"-" 2:"-" 3:"">
-```
-which should be translated into a string ``1 2 -3``. The golfed code simply
-does it by `eval(x+?1)*i-=1` where ``x`` is matched string ``"x"`` or ``""``
-and ``i`` be a negated index.
-
-
-### Data files
-
-The submission includes some input files in the DIMACS CNF format for
-testing the program.
-
-* [sample.cnf](sample.cnf) : an example shown above.
-
-* [unsat.cnf](unsat.cnf) : an example of an unsatisfiable formula.
-
-* [quinn.cnf](quinn.cnf) : an example from Quinn's text, 16 variables and 18 clauses
- (available from [http://people.sc.fsu.edu/~jburkardt/data/cnf/cnf.html])
-
-* [abnormal.cnf](abnormal.cnf) : an example from [the unofficial manual of the DIMACS challenge](http://www.domagoj-babic.com/uploads/ResearchProjects/Spear/dimacs-cnf.pdf)
- where a single clause may be on multiple lines.
-
-* [uf20-01.cnf](uf20-01.cnf) : an example, with 20 variables and 91 clauses, from [SATLIB benchmark suite](http://www.cs.ubc.ca/~hoos/SATLIB/benchm.html). The last two lines are removed from the original because they are illegal in the DIMACS CNF format (all examples in 'Uniform Random-3-SAT' of the linked page need this modification).
-
-
-### Limitation
-
-The program may not work when the number of variables exceeds 99
-because ``\nnn`` in regular expression with number ``nnn`` does not
-always represent backreference but octal notation of characters. For
-example,
-```ruby
- /#{"(x)"*999}:\502/=~"x"*999+":x"
- /#{"(x)"*999}:\661/=~"x"*999+":x"
- /#{"(x)"*999}:\775/=~"x"*999+":x"
-```
-fail due to the syntax error (invalid escape), while
-```ruby
- /#{"(x)"*999}:\508/=~"x"*999+":x"
- /#{"(x)"*999}:\691/=~"x"*999+":x"
- /#{"(x)"*999}:\785/=~"x"*999+":x"
-```
-succeed (to return 0) because 508, 691, and 785 are not in octal notation.
-Since Ruby 1.9.3 incorrectly returns ``nil`` instead of terminating
-with the error for
-```ruby
- /#{"(x)"*999}:\201/=~"x"*999+":x"
- /#{"(x)"*999}:\325/=~"x"*999+":x"
-```
-the present SAT solver may unexpectedly return "UNSATISFIABLE" even
-for satisfiable inputs. This happens when the number is in octal
-notation starting with either 2 or 3.
-
-In the case of the number starting with 1, the code like the above
-does work on all versions of Ruby I tried. For example,
-```ruby
- /#{"(x)"*999}:\101/=~"x"*999+":x"
- /#{"(x)"*999}:\177/=~"x"*999+":x"
-```
-succeed (to return 0). Interestingly,
-```ruby
- /#{"(x)"*999}:\101/=~"x"*999+":\101"
- /#{"(x)"*999}:\177/=~"x"*999+":\177"
-```
-return ``nil``, while
-```ruby
- /:\101/=~":\101"
- /:\177/=~":\177"
-```
-succeed to return 0. The meaning of ``\1nn`` in regular expression
-seems to depend on the existence of capturing expressions.
-
-In spite of these Ruby's behaviors, we have a good news! The present
-SAT sover does not suffer from the issues because the program cannot
-return solutions in practical time for inputs with variables more than
-40. \ No newline at end of file
diff --git a/sample/trick2015/ksk_2/sample.cnf b/sample/trick2015/ksk_2/sample.cnf
deleted file mode 100644
index 295f81c942..0000000000
--- a/sample/trick2015/ksk_2/sample.cnf
+++ /dev/null
@@ -1,9 +0,0 @@
-c
-c This is a sample input file.
-c
-p cnf 3 5
- 1 -2 3 0
--1 2 0
--2 -3 0
- 1 2 -3 0
- 1 3 0
diff --git a/sample/trick2015/ksk_2/uf20-01.cnf b/sample/trick2015/ksk_2/uf20-01.cnf
deleted file mode 100644
index 0d9503c451..0000000000
--- a/sample/trick2015/ksk_2/uf20-01.cnf
+++ /dev/null
@@ -1,99 +0,0 @@
-c This Formular is generated by mcnf
-c
-c horn? no
-c forced? no
-c mixed sat? no
-c clause length = 3
-c
-p cnf 20 91
- 4 -18 19 0
-3 18 -5 0
--5 -8 -15 0
--20 7 -16 0
-10 -13 -7 0
--12 -9 17 0
-17 19 5 0
--16 9 15 0
-11 -5 -14 0
-18 -10 13 0
--3 11 12 0
--6 -17 -8 0
--18 14 1 0
--19 -15 10 0
-12 18 -19 0
--8 4 7 0
--8 -9 4 0
-7 17 -15 0
-12 -7 -14 0
--10 -11 8 0
-2 -15 -11 0
-9 6 1 0
--11 20 -17 0
-9 -15 13 0
-12 -7 -17 0
--18 -2 20 0
-20 12 4 0
-19 11 14 0
--16 18 -4 0
--1 -17 -19 0
--13 15 10 0
--12 -14 -13 0
-12 -14 -7 0
--7 16 10 0
-6 10 7 0
-20 14 -16 0
--19 17 11 0
--7 1 -20 0
--5 12 15 0
--4 -9 -13 0
-12 -11 -7 0
--5 19 -8 0
-1 16 17 0
-20 -14 -15 0
-13 -4 10 0
-14 7 10 0
--5 9 20 0
-10 1 -19 0
--16 -15 -1 0
-16 3 -11 0
--15 -10 4 0
-4 -15 -3 0
--10 -16 11 0
--8 12 -5 0
-14 -6 12 0
-1 6 11 0
--13 -5 -1 0
--7 -2 12 0
-1 -20 19 0
--2 -13 -8 0
-15 18 4 0
--11 14 9 0
--6 -15 -2 0
-5 -12 -15 0
--6 17 5 0
--13 5 -19 0
-20 -1 14 0
-9 -17 15 0
--5 19 -18 0
--12 8 -10 0
--18 14 -4 0
-15 -9 13 0
-9 -5 -1 0
-10 -19 -14 0
-20 9 4 0
--9 -2 19 0
--5 13 -17 0
-2 -10 -18 0
--18 3 11 0
-7 -9 17 0
--15 -6 -3 0
--2 3 -13 0
-12 3 -2 0
--2 -3 17 0
-20 -15 -16 0
--5 -17 -19 0
--20 -18 11 0
--9 1 -5 0
--19 9 17 0
-12 -2 17 0
-4 -16 -5 0
diff --git a/sample/trick2015/ksk_2/unsat.cnf b/sample/trick2015/ksk_2/unsat.cnf
deleted file mode 100644
index 7283933a9f..0000000000
--- a/sample/trick2015/ksk_2/unsat.cnf
+++ /dev/null
@@ -1,11 +0,0 @@
-c
-c This is a sample input file.
-c (unsatisfiable)
-c
-p cnf 3 5
-1 -2 3 0
--1 2 0
--2 -3 0
-1 2 -3 0
-1 3 0
--1 -2 3 0
diff --git a/sample/trick2015/monae/authors.markdown b/sample/trick2015/monae/authors.markdown
deleted file mode 100644
index 58d63b16ac..0000000000
--- a/sample/trick2015/monae/authors.markdown
+++ /dev/null
@@ -1 +0,0 @@
-monae (@monae, jp)
diff --git a/sample/trick2015/monae/entry.rb b/sample/trick2015/monae/entry.rb
deleted file mode 100644
index 6961df21cd..0000000000
--- a/sample/trick2015/monae/entry.rb
+++ /dev/null
@@ -1,26 +0,0 @@
- ;; ;; ;; ;;
- ;; ;; ;; ;;
- ;;eval$s =%q[i=1#
- eval(%q[ xxxxxxxx
- xx xxxx xx xx xxxx xx
- xx xxxx xx xx xxxx xx
- xxxxxxxx xxxxxxxx
- xxxxxxxx xxxxxxxx
- xx xx xxxxxxxxxx xx xxxxxxxx
- j, t, p=0,[?;]," ev al$s=%qx
-[#$s]".split*"";i,j,t=i-j,i+j,(x
- [b=?\s]*j.abs+t).map{|s|r=t.shix
-ft ||b;r.gsub!(?;){p.slice!0}if $x
- f| |=p>p=p.center(i*i+j*j,?;);r ,x
- s=[s,r]if(i*j<0);(b*i.abs+s).ljx
- ust(r.size).gsub(b){r[$`.size]|x
- |b}}unti l$ f;puts(t)# xx xx
- xxxxxxxx xx xxxxxxxxxx xx xx
-xxxxxxxx xxxxxxxx
- xxxxxxxx xxxxxxxx
-xx xxxx xx xx xxxx xx
- xx xxxx xx xx xxxx xx
- xxxxxxxx x].gsub\
- /x.*|\s/ ,"")#];;
- ;; ;; ;; ;;
- ;; ;; ;; ;;
diff --git a/sample/trick2015/monae/remarks.markdown b/sample/trick2015/monae/remarks.markdown
deleted file mode 100644
index 48be61bd12..0000000000
--- a/sample/trick2015/monae/remarks.markdown
+++ /dev/null
@@ -1,25 +0,0 @@
-
-# How to run
-
-```
-ruby entry.rb
-ruby entry.rb | ruby
-ruby entry.rb | ruby | ruby
-ruby entry.rb | ruby | ruby | ruby
-...
-```
-
-Confirmed on the following environments:
-- ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
-- ruby 2.0.0p353 (2013-11-22) [i386-mingw32]
-
-# Description
-
-A simple quine which prints itself twice
-on a slightly complex base.
-
-> geminum caput amphisbaenae, hoc est et a cauda,
-> tamquam parum esset uno ore fundi venenum.
-> aliis squamas esse, aliis picturas, omnibus exitiale virus.
->
-> &mdash; <cite>GAIUS PLINIUS SECUNDUS, Naturalis Historia 8.85.1</cite>
diff --git a/sample/weakref.rb b/sample/weakref.rb
deleted file mode 100644
index b9f38f954f..0000000000
--- a/sample/weakref.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'weakref'
-
-foo = Object.new
-p foo.to_s # original's class
-foo = WeakRef.new(foo)
-p foo.to_s # should be same class
-ObjectSpace.garbage_collect
-ObjectSpace.garbage_collect
-p foo.to_s # should raise exception (recycled)
diff --git a/signal.c b/signal.c
index 49b547ae4f..b07a99db15 100644
--- a/signal.c
+++ b/signal.c
@@ -11,22 +11,17 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "vm_core.h"
#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include "ruby_atomic.h"
#include "eval_intern.h"
+#include "internal.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-#ifdef HAVE_UCONTEXT_H
-#include <ucontext.h>
-#endif
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
@@ -45,9 +40,6 @@
# include "nacl/signal.h"
#endif
-extern ID ruby_static_id_signo;
-#define id_signo ruby_static_id_signo
-
#ifdef NEED_RUBY_ATOMIC_OPS
rb_atomic_t
ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val)
@@ -69,6 +61,10 @@ ruby_atomic_compare_and_swap(rb_atomic_t *ptr, rb_atomic_t cmp,
}
#endif
+#if defined(__BEOS__) || defined(__HAIKU__)
+#undef SIGBUS
+#endif
+
#ifndef NSIG
# define NSIG (_SIGMAX + 1) /* For QNX */
#endif
@@ -212,8 +208,6 @@ static const struct signals {
{NULL, 0}
};
-static const char signame_prefix[3] = "SIG";
-
static int
signm2signo(const char *nm)
{
@@ -253,7 +247,6 @@ static VALUE
sig_signame(VALUE recv, VALUE signo)
{
const char *signame = signo2signm(NUM2INT(signo));
- if (!signame) return Qnil;
return rb_str_new_cstr(signame);
}
@@ -263,18 +256,6 @@ ruby_signal_name(int no)
return signo2signm(no);
}
-static VALUE
-rb_signo2signm(int signo)
-{
- const char *const signm = signo2signm(signo);
- if (signm) {
- return rb_sprintf("SIG%s", signm);
- }
- else {
- return rb_sprintf("SIG%u", signo);
- }
-}
-
/*
* call-seq:
* SignalException.new(sig_name) -> signal_exception
@@ -307,26 +288,26 @@ esignal_init(int argc, VALUE *argv, VALUE self)
sig = argv[1];
}
else {
- sig = rb_signo2signm(signo);
+ signm = signo2signm(signo);
+ if (signm) {
+ sig = rb_sprintf("SIG%s", signm);
+ }
+ else {
+ sig = rb_sprintf("SIG%u", signo);
+ }
}
}
else {
- int len = sizeof(signame_prefix);
- if (SYMBOL_P(sig)) sig = rb_sym2str(sig); else StringValue(sig);
- signm = RSTRING_PTR(sig);
- if (strncmp(signm, signame_prefix, len) == 0) {
- signm += len;
- len = 0;
- }
+ signm = SYMBOL_P(sig) ? rb_id2name(SYM2ID(sig)) : StringValuePtr(sig);
+ if (strncmp(signm, "SIG", 3) == 0) signm += 3;
signo = signm2signo(signm);
if (!signo) {
- rb_raise(rb_eArgError, "unsupported name `%.*s%"PRIsVALUE"'",
- len, signame_prefix, sig);
+ rb_raise(rb_eArgError, "unsupported name `SIG%s'", signm);
}
sig = rb_sprintf("SIG%s", signm);
}
rb_call_super(1, &sig);
- rb_ivar_set(self, id_signo, INT2NUM(signo));
+ rb_iv_set(self, "signo", INT2NUM(signo));
return self;
}
@@ -341,7 +322,7 @@ esignal_init(int argc, VALUE *argv, VALUE self)
static VALUE
esignal_signo(VALUE self)
{
- return rb_ivar_get(self, id_signo);
+ return rb_iv_get(self, "signo");
}
/* :nodoc: */
@@ -362,10 +343,6 @@ ruby_default_signal(int sig)
raise(sig);
}
-static RETSIGTYPE sighandler(int sig);
-static int signal_ignored(int sig);
-static void signal_enque(int sig);
-
/*
* call-seq:
* Process.kill(signal, pid, ...) -> fixnum
@@ -376,8 +353,6 @@ static void signal_enque(int sig);
* a POSIX signal name (either with or without a +SIG+ prefix). If _signal_ is
* negative (or starts with a minus sign), kills process groups instead of
* processes. Not all signals are available on all platforms.
- * The keys and values of +Signal.list+ are known signal names and numbers,
- * respectively.
*
* pid = fork do
* Signal.trap("HUP") { puts "Ouch!"; exit }
@@ -403,7 +378,7 @@ static void signal_enque(int sig);
*/
VALUE
-rb_f_kill(int argc, const VALUE *argv)
+rb_f_kill(int argc, VALUE *argv)
{
#ifndef HAVE_KILLPG
#define killpg(pg, sig) kill(-(pg), (sig))
@@ -411,9 +386,10 @@ rb_f_kill(int argc, const VALUE *argv)
int negative = 0;
int sig;
int i;
- VALUE str;
+ volatile VALUE str;
const char *s;
+ rb_secure(2);
rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
switch (TYPE(argv[0])) {
@@ -422,24 +398,21 @@ rb_f_kill(int argc, const VALUE *argv)
break;
case T_SYMBOL:
- str = rb_sym2str(argv[0]);
+ s = rb_id2name(SYM2ID(argv[0]));
+ if (!s) rb_raise(rb_eArgError, "bad signal");
goto str_signal;
case T_STRING:
- str = argv[0];
+ s = RSTRING_PTR(argv[0]);
str_signal:
- s = RSTRING_PTR(str);
if (s[0] == '-') {
negative++;
s++;
}
- if (strncmp(signame_prefix, s, sizeof(signame_prefix)) == 0)
+ if (strncmp("SIG", s, 3) == 0)
s += 3;
- if ((sig = signm2signo(s)) == 0) {
- long ofs = s - RSTRING_PTR(str);
- if (ofs) str = rb_str_subseq(str, ofs, RSTRING_LEN(str)-ofs);
- rb_raise(rb_eArgError, "unsupported name `SIG%"PRIsVALUE"'", str);
- }
+ if ((sig = signm2signo(s)) == 0)
+ rb_raise(rb_eArgError, "unsupported name `SIG%s'", s);
if (negative)
sig = -sig;
@@ -448,6 +421,7 @@ rb_f_kill(int argc, const VALUE *argv)
default:
str = rb_check_string_type(argv[0]);
if (!NIL_P(str)) {
+ s = RSTRING_PTR(str);
goto str_signal;
}
rb_raise(rb_eArgError, "bad signal type %s",
@@ -455,8 +429,6 @@ rb_f_kill(int argc, const VALUE *argv)
break;
}
- if (argc <= 1) return INT2FIX(0);
-
if (sig < 0) {
sig = -sig;
for (i=1; i<argc; i++) {
@@ -465,48 +437,8 @@ rb_f_kill(int argc, const VALUE *argv)
}
}
else {
- const rb_pid_t self = (GET_THREAD() == GET_VM()->main_thread) ? getpid() : -1;
- int wakeup = 0;
-
for (i=1; i<argc; i++) {
- rb_pid_t pid = NUM2PIDT(argv[i]);
-
- if ((sig != 0) && (self != -1) && (pid == self)) {
- int t;
- /*
- * When target pid is self, many caller assume signal will be
- * delivered immediately and synchronously.
- */
- switch (sig) {
- case SIGSEGV:
-#ifdef SIGBUS
- case SIGBUS:
-#endif
-#ifdef SIGKILL
- case SIGKILL:
-#endif
-#ifdef SIGSTOP
- case SIGSTOP:
-#endif
- ruby_kill(pid, sig);
- break;
- default:
- t = signal_ignored(sig);
- if (t) {
- if (t < 0 && kill(pid, sig))
- rb_sys_fail(0);
- break;
- }
- signal_enque(sig);
- wakeup = 1;
- }
- }
- else if (kill(pid, sig) < 0) {
- rb_sys_fail(0);
- }
- }
- if (wakeup) {
- rb_threadptr_check_signal(GET_VM()->main_thread);
+ ruby_kill(NUM2PIDT(argv[i]), sig);
}
}
rb_thread_execute_interrupts(rb_thread_current());
@@ -529,11 +461,9 @@ typedef RETSIGTYPE (*sighandler_t)(int);
#ifdef USE_SIGALTSTACK
typedef void ruby_sigaction_t(int, siginfo_t*, void*);
#define SIGINFO_ARG , siginfo_t *info, void *ctx
-#define SIGINFO_CTX ctx
#else
typedef RETSIGTYPE ruby_sigaction_t(int);
#define SIGINFO_ARG
-#define SIGINFO_CTX 0
#endif
#ifdef USE_SIGALTSTACK
@@ -541,7 +471,7 @@ int
rb_sigaltstack_size(void)
{
/* XXX: BSD_vfprintf() uses >1500KiB stack and x86-64 need >5KiB stack. */
- int size = 16*1024;
+ int size = 8192;
#ifdef MINSIGSTKSZ
if (size < MINSIGSTKSZ)
@@ -588,43 +518,32 @@ ruby_signal(int signum, sighandler_t handler)
sigemptyset(&sigact.sa_mask);
#ifdef USE_SIGALTSTACK
- if (handler == SIG_IGN || handler == SIG_DFL) {
- sigact.sa_handler = handler;
- sigact.sa_flags = 0;
- }
- else {
- sigact.sa_sigaction = (ruby_sigaction_t*)handler;
- sigact.sa_flags = SA_SIGINFO;
- }
+ sigact.sa_sigaction = (ruby_sigaction_t*)handler;
+ sigact.sa_flags = SA_SIGINFO;
#else
sigact.sa_handler = handler;
sigact.sa_flags = 0;
#endif
- switch (signum) {
#ifdef SA_NOCLDWAIT
- case SIGCHLD:
- if (handler == SIG_IGN)
- sigact.sa_flags |= SA_NOCLDWAIT;
- break;
+ if (signum == SIGCHLD && handler == SIG_IGN)
+ sigact.sa_flags |= SA_NOCLDWAIT;
#endif
#if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK)
- case SIGSEGV:
+ if (signum == SIGSEGV
#ifdef SIGBUS
- case SIGBUS:
+ || signum == SIGBUS
#endif
+ )
sigact.sa_flags |= SA_ONSTACK;
- break;
#endif
- }
(void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
if (sigaction(signum, &sigact, &old) < 0) {
- return SIG_ERR;
+ if (errno != 0 && errno != EINVAL) {
+ rb_bug_errno("sigaction", errno);
+ }
}
- if (old.sa_flags & SA_SIGINFO)
- return (sighandler_t)old.sa_sigaction;
- else
- return old.sa_handler;
+ return old.sa_handler;
}
sighandler_t
@@ -633,17 +552,6 @@ posix_signal(int signum, sighandler_t handler)
return ruby_signal(signum, handler);
}
-#elif defined _WIN32
-static inline sighandler_t
-ruby_signal(int signum, sighandler_t handler)
-{
- if (signum == SIGKILL) {
- errno = EINVAL;
- return SIG_ERR;
- }
- return signal(signum, handler);
-}
-
#else /* !POSIX_SIGNAL */
#define ruby_signal(sig,handler) (/* rb_trap_accept_nativethreads[(sig)] = 0,*/ signal((sig),(handler)))
#if 0 /* def HAVE_NATIVETHREAD */
@@ -659,43 +567,15 @@ ruby_nativethread_signal(int signum, sighandler_t handler)
#endif
#endif
-static int
-signal_ignored(int sig)
-{
- sighandler_t func;
-#ifdef POSIX_SIGNAL
- struct sigaction old;
- (void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
- if (sigaction(sig, NULL, &old) < 0) return FALSE;
- func = old.sa_handler;
-#else
- sighandler_t old = signal(sig, SIG_DFL);
- signal(sig, old);
- func = old;
-#endif
- if (func == SIG_IGN) return 1;
- return func == sighandler ? 0 : -1;
-}
-
-static void
-signal_enque(int sig)
-{
- ATOMIC_INC(signal_buff.cnt[sig]);
- ATOMIC_INC(signal_buff.size);
-}
-
static RETSIGTYPE
sighandler(int sig)
{
- int old_errnum = errno;
-
- signal_enque(sig);
+ ATOMIC_INC(signal_buff.cnt[sig]);
+ ATOMIC_INC(signal_buff.size);
rb_thread_wakeup_timer_thread();
#if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL)
ruby_signal(sig, sighandler);
#endif
-
- errno = old_errnum;
}
int
@@ -746,127 +626,44 @@ rb_get_next_signal(void)
return sig;
}
-#if defined SIGSEGV || defined SIGBUS || defined SIGILL || defined SIGFPE
-static const char *received_signal;
-# define clear_received_signal() (void)(ruby_disable_gc = 0, received_signal = 0)
-#else
-# define clear_received_signal() ((void)0)
-#endif
#if defined(USE_SIGALTSTACK) || defined(_WIN32)
-NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
-# if defined __HAIKU__
-# define USE_UCONTEXT_REG 1
-# elif !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
-# elif defined __linux__
-# define USE_UCONTEXT_REG 1
-# elif defined __APPLE__
-# define USE_UCONTEXT_REG 1
-# elif defined __FreeBSD__
-# define USE_UCONTEXT_REG 1
-# endif
-# ifdef USE_UCONTEXT_REG
-static void
-check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
-{
- const DEFINE_MCONTEXT_PTR(mctx, ctx);
-# if defined __linux__
-# if defined REG_RSP
- const greg_t sp = mctx->gregs[REG_RSP];
-# else
- const greg_t sp = mctx->gregs[REG_ESP];
-# endif
-# elif defined __APPLE__
-# if defined(__LP64__)
- const uintptr_t sp = mctx->__ss.__rsp;
-# else
- const uintptr_t sp = mctx->__ss.__esp;
-# endif
-# elif defined __FreeBSD__
-# if defined(__amd64__)
- const __register_t sp = mctx->mc_rsp;
-# else
- const __register_t sp = mctx->mc_esp;
-# endif
-# elif defined __HAIKU__
-# if defined(__amd64__)
- const unsigned long sp = mctx->rsp;
-# else
- const unsigned long sp = mctx->esp;
-# endif
-# endif
- enum {pagesize = 4096};
- const uintptr_t sp_page = (uintptr_t)sp / pagesize;
- const uintptr_t fault_page = addr / pagesize;
-
- /* SP in ucontext is not decremented yet when `push` failed, so
- * the fault page can be the next. */
- if (sp_page == fault_page || sp_page == fault_page + 1) {
- rb_thread_t *th = ruby_current_thread;
- if ((uintptr_t)th->tag->buf / pagesize == sp_page) {
- /* drop the last tag if it is close to the fault,
- * otherwise it can cause stack overflow again at the same
- * place. */
- th->tag = th->tag->prev;
- }
- clear_received_signal();
- ruby_thread_stack_overflow(th);
- }
-}
-# else
static void
check_stack_overflow(const void *addr)
{
int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
- rb_thread_t *th = ruby_current_thread;
+ NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
+ rb_thread_t *th = GET_THREAD();
if (ruby_stack_overflowed_p(th, addr)) {
- clear_received_signal();
ruby_thread_stack_overflow(th);
}
}
-# endif
-# ifdef _WIN32
-# define CHECK_STACK_OVERFLOW() check_stack_overflow(0)
-# else
-# define FAULT_ADDRESS info->si_addr
-# ifdef USE_UCONTEXT_REG
-# define CHECK_STACK_OVERFLOW() check_stack_overflow((uintptr_t)FAULT_ADDRESS, ctx)
-# else
-# define CHECK_STACK_OVERFLOW() check_stack_overflow(FAULT_ADDRESS)
-# endif
-# define MESSAGE_FAULT_ADDRESS " at %p", FAULT_ADDRESS
-# endif
+#ifdef _WIN32
+#define CHECK_STACK_OVERFLOW() check_stack_overflow(0)
#else
-# define CHECK_STACK_OVERFLOW() (void)0
+#define CHECK_STACK_OVERFLOW() check_stack_overflow(info->si_addr)
#endif
-#ifndef MESSAGE_FAULT_ADDRESS
-# define MESSAGE_FAULT_ADDRESS
+#else
+#define CHECK_STACK_OVERFLOW() (void)0
#endif
-#if defined SIGSEGV || defined SIGBUS || defined SIGILL || defined SIGFPE
-NOINLINE(static void check_reserved_signal_(const char *name, size_t name_len));
-/* noinine to reduce stack usage in signal handers */
-
-#define check_reserved_signal(name) check_reserved_signal_(name, sizeof(name)-1)
-
#ifdef SIGBUS
static RETSIGTYPE
sigbus(int sig SIGINFO_ARG)
{
- check_reserved_signal("BUS");
/*
* Mac OS X makes KERN_PROTECTION_FAILURE when thread touch guard page.
* and it's delivered as SIGBUS instead of SIGSEGV to userland. It's crazy
* wrong IMHO. but anyway we have to care it. Sigh.
*/
- /* Seems Linux also delivers SIGBUS. */
-#if defined __APPLE__ || defined __linux__
+#if defined __APPLE__
CHECK_STACK_OVERFLOW();
#endif
- rb_bug_context(SIGINFO_CTX, "Bus Error" MESSAGE_FAULT_ADDRESS);
+ rb_bug("Bus Error");
}
#endif
+#ifdef SIGSEGV
static void
ruby_abort(void)
{
@@ -881,68 +678,25 @@ ruby_abort(void)
}
-#ifdef SIGSEGV
-static RETSIGTYPE
-sigsegv(int sig SIGINFO_ARG)
-{
- check_reserved_signal("SEGV");
- CHECK_STACK_OVERFLOW();
- rb_bug_context(SIGINFO_CTX, "Segmentation fault" MESSAGE_FAULT_ADDRESS);
-}
-#endif
+static int segv_received = 0;
+extern int ruby_disable_gc_stress;
-#ifdef SIGILL
static RETSIGTYPE
-sigill(int sig SIGINFO_ARG)
-{
- check_reserved_signal("ILL");
-#if defined __APPLE__
- CHECK_STACK_OVERFLOW();
-#endif
- rb_bug_context(SIGINFO_CTX, "Illegal instruction" MESSAGE_FAULT_ADDRESS);
-}
-#endif
-
-static void
-check_reserved_signal_(const char *name, size_t name_len)
+sigsegv(int sig SIGINFO_ARG)
{
- const char *prev = ATOMIC_PTR_EXCHANGE(received_signal, name);
-
- if (prev) {
+ if (segv_received) {
ssize_t RB_UNUSED_VAR(err);
-#define NOZ(name, str) name[sizeof(str)-1] = str
- static const char NOZ(msg1, " received in ");
- static const char NOZ(msg2, " handler\n");
-
-#ifdef HAVE_WRITEV
- struct iovec iov[4];
-
- iov[0].iov_base = (void *)name;
- iov[0].iov_len = name_len;
- iov[1].iov_base = (void *)msg1;
- iov[1].iov_len = sizeof(msg1);
- iov[2].iov_base = (void *)prev;
- iov[2].iov_len = strlen(prev);
- iov[3].iov_base = (void *)msg2;
- iov[3].iov_len = sizeof(msg2);
- err = writev(2, iov, 4);
-#else
- err = write(2, name, name_len);
- err = write(2, msg1, sizeof(msg1));
- err = write(2, prev, strlen(prev));
- err = write(2, msg2, sizeof(msg2));
-#endif
+ char msg[] = "SEGV received in SEGV handler\n";
+
+ err = write(2, msg, sizeof(msg));
ruby_abort();
}
- ruby_disable_gc = 1;
-}
-#endif
+ CHECK_STACK_OVERFLOW();
-#if defined SIGPIPE || defined SIGSYS
-static RETSIGTYPE
-sig_do_nothing(int sig)
-{
+ segv_received = 1;
+ ruby_disable_gc_stress = 1;
+ rb_bug("Segmentation fault");
}
#endif
@@ -953,15 +707,6 @@ signal_exec(VALUE cmd, int safe, int sig)
volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask;
int state;
- /*
- * workaround the following race:
- * 1. signal_enque queues signal for execution
- * 2. user calls trap(sig, "IGNORE"), setting SIG_IGN
- * 3. rb_signal_exec runs on queued signal
- */
- if (IMMEDIATE_P(cmd))
- return;
-
cur_th->interrupt_mask |= TRAP_INTERRUPT_MASK;
TH_PUSH_TAG(cur_th);
if ((state = EXEC_TAG()) == 0) {
@@ -1070,12 +815,7 @@ default_handler(int sig)
#endif
#ifdef SIGPIPE
case SIGPIPE:
- func = sig_do_nothing;
- break;
-#endif
-#ifdef SIGSYS
- case SIGSYS:
- func = sig_do_nothing;
+ func = SIG_IGN;
break;
#endif
default:
@@ -1098,47 +838,44 @@ trap_handler(VALUE *cmd, int sig)
else {
command = rb_check_string_type(*cmd);
if (NIL_P(command) && SYMBOL_P(*cmd)) {
- command = rb_sym2str(*cmd);
+ command = rb_id2str(SYM2ID(*cmd));
if (!command) rb_raise(rb_eArgError, "bad handler");
}
if (!NIL_P(command)) {
- const char *cptr;
- long len;
SafeStringValue(command); /* taint check */
*cmd = command;
- RSTRING_GETMEM(command, cptr, len);
- switch (len) {
+ switch (RSTRING_LEN(command)) {
case 0:
goto sig_ign;
break;
case 14:
- if (memcmp(cptr, "SYSTEM_DEFAULT", 14) == 0) {
+ if (strncmp(RSTRING_PTR(command), "SYSTEM_DEFAULT", 14) == 0) {
func = SIG_DFL;
*cmd = 0;
}
break;
case 7:
- if (memcmp(cptr, "SIG_IGN", 7) == 0) {
+ if (strncmp(RSTRING_PTR(command), "SIG_IGN", 7) == 0) {
sig_ign:
func = SIG_IGN;
- *cmd = Qtrue;
+ *cmd = 0;
}
- else if (memcmp(cptr, "SIG_DFL", 7) == 0) {
+ else if (strncmp(RSTRING_PTR(command), "SIG_DFL", 7) == 0) {
sig_dfl:
func = default_handler(sig);
*cmd = 0;
}
- else if (memcmp(cptr, "DEFAULT", 7) == 0) {
+ else if (strncmp(RSTRING_PTR(command), "DEFAULT", 7) == 0) {
goto sig_dfl;
}
break;
case 6:
- if (memcmp(cptr, "IGNORE", 6) == 0) {
+ if (strncmp(RSTRING_PTR(command), "IGNORE", 6) == 0) {
goto sig_ign;
}
break;
case 4:
- if (memcmp(cptr, "EXIT", 4) == 0) {
+ if (strncmp(RSTRING_PTR(command), "EXIT", 4) == 0) {
*cmd = Qundef;
}
break;
@@ -1169,22 +906,19 @@ trap_signm(VALUE vsig)
break;
case T_SYMBOL:
- vsig = rb_sym2str(vsig);
- s = RSTRING_PTR(vsig);
+ s = rb_id2name(SYM2ID(vsig));
+ if (!s) rb_raise(rb_eArgError, "bad signal");
goto str_signal;
default:
s = StringValuePtr(vsig);
str_signal:
- if (strncmp(signame_prefix, s, sizeof(signame_prefix)) == 0)
+ if (strncmp("SIG", s, 3) == 0)
s += 3;
sig = signm2signo(s);
- if (sig == 0 && strcmp(s, "EXIT") != 0) {
- long ofs = s - RSTRING_PTR(vsig);
- if (ofs) vsig = rb_str_subseq(vsig, ofs, RSTRING_LEN(vsig)-ofs);
- rb_raise(rb_eArgError, "unsupported signal SIG%"PRIsVALUE"", vsig);
- }
+ if (sig == 0 && strcmp(s, "EXIT") != 0)
+ rb_raise(rb_eArgError, "unsupported signal SIG%s", s);
}
return sig;
}
@@ -1201,24 +935,14 @@ trap(int sig, sighandler_t func, VALUE command)
* atomically. In current implementation, we only need to don't call
* RUBY_VM_CHECK_INTS().
*/
- if (sig == 0) {
- oldfunc = SIG_ERR;
- }
- else {
- oldfunc = ruby_signal(sig, func);
- if (oldfunc == SIG_ERR) rb_sys_fail_str(rb_signo2signm(sig));
- }
+ oldfunc = ruby_signal(sig, func);
oldcmd = vm->trap_list[sig].cmd;
switch (oldcmd) {
case 0:
- case Qtrue:
if (oldfunc == SIG_IGN) oldcmd = rb_str_new2("IGNORE");
- else if (oldfunc == SIG_DFL) oldcmd = rb_str_new2("SYSTEM_DEFAULT");
else if (oldfunc == sighandler) oldcmd = rb_str_new2("DEFAULT");
else oldcmd = Qnil;
break;
- case Qnil:
- break;
case Qundef:
oldcmd = rb_str_new2("EXIT");
break;
@@ -1298,6 +1022,7 @@ sig_trap(int argc, VALUE *argv)
sighandler_t func;
VALUE cmd;
+ rb_secure(2);
rb_check_arity(argc, 1, 2);
sig = trap_signm(argv[0]);
@@ -1346,42 +1071,36 @@ sig_list(void)
return h;
}
-static int
+static void
install_sighandler(int signum, sighandler_t handler)
{
sighandler_t old;
+ /* At this time, there is no subthread. Then sigmask guarantee atomics. */
+ rb_disable_interrupt();
old = ruby_signal(signum, handler);
- if (old == SIG_ERR) return -1;
/* signal handler should be inherited during exec. */
if (old != SIG_DFL) {
ruby_signal(signum, old);
}
- return 0;
+ rb_enable_interrupt();
}
-#ifndef __native_client__
-# define install_sighandler(signum, handler) (install_sighandler(signum, handler) ? rb_bug(#signum) : (void)0)
-#endif
#if defined(SIGCLD) || defined(SIGCHLD)
-static int
+static void
init_sigchld(int sig)
{
sighandler_t oldfunc;
+ rb_disable_interrupt();
oldfunc = ruby_signal(sig, SIG_DFL);
- if (oldfunc == SIG_ERR) return -1;
if (oldfunc != SIG_DFL && oldfunc != SIG_IGN) {
ruby_signal(sig, oldfunc);
- }
- else {
+ } else {
GET_VM()->trap_list[sig].cmd = 0;
}
- return 0;
+ rb_enable_interrupt();
}
-# ifndef __native_client__
-# define init_sigchld(signum) (init_sigchld(signum) ? rb_bug(#signum) : (void)0)
-# endif
#endif
void
@@ -1450,12 +1169,9 @@ Init_signal(void)
rb_define_method(rb_eSignal, "initialize", esignal_init, -1);
rb_define_method(rb_eSignal, "signo", esignal_signo, 0);
- rb_alias(rb_eSignal, rb_intern_const("signm"), rb_intern_const("message"));
+ rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
- /* At this time, there is no subthread. Then sigmask guarantee atomics. */
- rb_disable_interrupt();
-
install_sighandler(SIGINT, sighandler);
#ifdef SIGHUP
install_sighandler(SIGHUP, sighandler);
@@ -1480,9 +1196,6 @@ Init_signal(void)
#ifdef SIGBUS
install_sighandler(SIGBUS, (sighandler_t)sigbus);
#endif
-#ifdef SIGILL
- install_sighandler(SIGILL, (sighandler_t)sigill);
-#endif
#ifdef SIGSEGV
# ifdef USE_SIGALTSTACK
rb_register_sigaltstack(GET_THREAD());
@@ -1491,10 +1204,7 @@ Init_signal(void)
#endif
}
#ifdef SIGPIPE
- install_sighandler(SIGPIPE, sig_do_nothing);
-#endif
-#ifdef SIGSYS
- install_sighandler(SIGSYS, sig_do_nothing);
+ install_sighandler(SIGPIPE, SIG_IGN);
#endif
#if defined(SIGCLD)
@@ -1502,6 +1212,4 @@ Init_signal(void)
#elif defined(SIGCHLD)
init_sigchld(SIGCHLD);
#endif
-
- rb_enable_interrupt();
}
diff --git a/siphash.c b/siphash.c
index 0df96f8320..2018ade431 100644
--- a/siphash.c
+++ b/siphash.c
@@ -30,7 +30,6 @@
#ifndef UNALIGNED_WORD_ACCESS
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
- defined(__powerpc64__) || \
defined(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
# endif
@@ -418,7 +417,7 @@ sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len)
SIP_2_ROUND(m, v0, v1, v2, v3);
}
}
-#else
+#elif BYTE_ORDER == BIG_ENDIAN
for (; data != end; data += sizeof(uint64_t)) {
m = U8TO64_LE(data);
SIP_2_ROUND(m, v0, v1, v2, v3);
@@ -454,7 +453,7 @@ sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len)
last.lo |= ((uint32_t *) end)[0];
#endif
break;
-#else
+#elif BYTE_ORDER == BIG_ENDIAN
OR_BYTE(3);
#endif
case 3:
diff --git a/spec/default.mspec b/spec/default.mspec
index da21470053..c4b75f614a 100644
--- a/spec/default.mspec
+++ b/spec/default.mspec
@@ -1,24 +1,21 @@
-# -*- ruby -*-
-load "./rbconfig.rb"
-load File.dirname(__FILE__) + '/rubyspec/default.mspec'
+load File.dirname(__FILE__) + '/rubyspec/ruby.1.9.mspec'
class MSpecScript
builddir = Dir.pwd
srcdir = ENV['SRCDIR']
- if !srcdir and File.exist?("#{builddir}/Makefile") then
+ if !srcdir and File.exist?("#{builddir}/Makefile") then
File.open("#{builddir}/Makefile", "r:US-ASCII") {|f|
f.read[/^\s*srcdir\s*=\s*(.+)/i] and srcdir = $1
}
end
- config = RbConfig::CONFIG
+ config = proc{|name| `#{builddir}/miniruby -I#{srcdir} -r#{builddir}/rbconfig -e 'print RbConfig::CONFIG["#{name}"]'`}
# The default implementation to run the specs.
set :target, File.join(builddir, "miniruby#{config['exeext']}")
set :prefix, File.expand_path('rubyspec', File.dirname(__FILE__))
set :flags, %W[
-I#{File.expand_path srcdir}/lib
- -I#{File.expand_path srcdir}
-I#{File.expand_path srcdir}/#{config['EXTOUT']}/common
+ -I#{File.expand_path srcdir}/-
#{File.expand_path srcdir}/tool/runruby.rb --archdir=#{Dir.pwd} --extout=#{config['EXTOUT']}
- --
]
end
diff --git a/sprintf.c b/sprintf.c
index bc1c629058..97b2126422 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -11,9 +11,10 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/re.h"
-#include "id.h"
+#include "ruby/encoding.h"
+#include "internal.h"
#include <math.h>
#include <stdarg.h>
@@ -23,6 +24,8 @@
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
+extern const char ruby_digitmap[];
+
static void fmt_setup(char*,size_t,int,int,int,int);
static char
@@ -76,96 +79,58 @@ sign_bits(int base, const char *p)
} while (0)
#define GETARG() (nextvalue != Qundef ? nextvalue : \
- GETNEXTARG())
-
-#define GETNEXTARG() ( \
- check_next_arg(posarg, nextarg), \
+ posarg == -1 ? \
+ (rb_raise(rb_eArgError, "unnumbered(%d) mixed with numbered", nextarg), 0) : \
+ posarg == -2 ? \
+ (rb_raise(rb_eArgError, "unnumbered(%d) mixed with named", nextarg), 0) : \
(posarg = nextarg++, GETNTHARG(posarg)))
-#define GETPOSARG(n) ( \
- check_pos_arg(posarg, (n)), \
- (posarg = -1, GETNTHARG(n)))
+#define GETPOSARG(n) (posarg > 0 ? \
+ (rb_raise(rb_eArgError, "numbered(%d) after unnumbered(%d)", (n), posarg), 0) : \
+ posarg == -2 ? \
+ (rb_raise(rb_eArgError, "numbered(%d) after named", (n)), 0) : \
+ (((n) < 1) ? (rb_raise(rb_eArgError, "invalid index - %d$", (n)), 0) : \
+ (posarg = -1, GETNTHARG(n))))
#define GETNTHARG(nth) \
(((nth) >= argc) ? (rb_raise(rb_eArgError, "too few arguments"), 0) : argv[(nth)])
-#define CHECKNAMEARG(name, len, enc) ( \
- check_name_arg(posarg, name, len, enc), \
- posarg = -2)
+#define GETNAMEARG(id, name, len, enc) ( \
+ posarg > 0 ? \
+ (rb_enc_raise((enc), rb_eArgError, "named%.*s after unnumbered(%d)", (len), (name), posarg), 0) : \
+ posarg == -1 ? \
+ (rb_enc_raise((enc), rb_eArgError, "named%.*s after numbered", (len), (name)), 0) : \
+ (posarg = -2, rb_hash_lookup2(get_hash(&hash, argc, argv), (id), Qundef)))
#define GETNUM(n, val) \
- (!(p = get_num(p, end, enc, &(n))) ? \
- rb_raise(rb_eArgError, #val " too big") : (void)0)
+ for (; p < end && rb_enc_isdigit(*p, enc); p++) { \
+ int next_n = (n); \
+ if (MUL_OVERFLOW_INT_P(10, next_n)) \
+ rb_raise(rb_eArgError, #val " too big"); \
+ next_n *= 10; \
+ if (INT_MAX - (*p - '0') < next_n) \
+ rb_raise(rb_eArgError, #val " too big"); \
+ next_n += *p - '0'; \
+ (n) = next_n; \
+ } \
+ if (p >= end) { \
+ rb_raise(rb_eArgError, "malformed format string - %%*[0-9]"); \
+ }
#define GETASTER(val) do { \
t = p++; \
n = 0; \
- GETNUM(n, val); \
+ GETNUM(n, (val)); \
if (*p == '$') { \
tmp = GETPOSARG(n); \
} \
else { \
- tmp = GETNEXTARG(); \
+ tmp = GETARG(); \
p = t; \
} \
(val) = NUM2INT(tmp); \
} while (0)
-static const char *
-get_num(const char *p, const char *end, rb_encoding *enc, int *valp)
-{
- int next_n = *valp;
- for (; p < end && rb_enc_isdigit(*p, enc); p++) {
- if (MUL_OVERFLOW_INT_P(10, next_n))
- return NULL;
- next_n *= 10;
- if (INT_MAX - (*p - '0') < next_n)
- return NULL;
- next_n += *p - '0';
- }
- if (p >= end) {
- rb_raise(rb_eArgError, "malformed format string - %%*[0-9]");
- }
- *valp = next_n;
- return p;
-}
-
-static void
-check_next_arg(int posarg, int nextarg)
-{
- switch (posarg) {
- case -1:
- rb_raise(rb_eArgError, "unnumbered(%d) mixed with numbered", nextarg);
- case -2:
- rb_raise(rb_eArgError, "unnumbered(%d) mixed with named", nextarg);
- }
-}
-
-static void
-check_pos_arg(int posarg, int n)
-{
- if (posarg > 0) {
- rb_raise(rb_eArgError, "numbered(%d) after unnumbered(%d)", n, posarg);
- }
- if (posarg == -2) {
- rb_raise(rb_eArgError, "numbered(%d) after named", n);
- }
- if (n < 1) {
- rb_raise(rb_eArgError, "invalid index - %d$", n);
- }
-}
-
-static void
-check_name_arg(int posarg, const char *name, int len, rb_encoding *enc)
-{
- if (posarg > 0) {
- rb_enc_raise(enc, rb_eArgError, "named%.*s after unnumbered(%d)", len, name, posarg);
- }
- if (posarg == -1) {
- rb_enc_raise(enc, rb_eArgError, "named%.*s after numbered", len, name);
- }
-}
-
static VALUE
get_hash(volatile VALUE *hash, int argc, const VALUE *argv)
{
@@ -452,7 +417,6 @@ rb_f_sprintf(int argc, const VALUE *argv)
VALUE
rb_str_format(int argc, const VALUE *argv, VALUE fmt)
{
- enum {default_float_precision = 6};
rb_encoding *enc;
const char *p, *end;
char *buf;
@@ -504,7 +468,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
for (; p < end; p++) {
const char *t;
int n;
- VALUE sym = Qnil;
+ ID id = 0;
for (t = p; t < end && *t != '%'; t++) ;
PUSH(p, t - p);
@@ -599,26 +563,17 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
}
#endif
len = (int)(p - start + 1); /* including parenthesis */
- if (sym != Qnil) {
- rb_enc_raise(enc, rb_eArgError, "named%.*s after <%"PRIsVALUE">",
- len, start, rb_sym2str(sym));
+ if (id) {
+ rb_enc_raise(enc, rb_eArgError, "named%.*s after <%s>",
+ len, start, rb_id2name(id));
}
- CHECKNAMEARG(start, len, enc);
- get_hash(&hash, argc, argv);
- sym = rb_check_symbol_cstr(start + 1,
- len - 2 /* without parenthesis */,
- enc);
- if (!NIL_P(sym)) nextvalue = rb_hash_lookup2(hash, sym, Qundef);
+ nextvalue = GETNAMEARG((id = rb_check_id_cstr(start + 1,
+ len - 2 /* without parenthesis */,
+ enc),
+ ID2SYM(id)),
+ start, len, enc);
if (nextvalue == Qundef) {
- if (NIL_P(sym)) {
- sym = rb_sym_intern(start + 1,
- len - 2 /* without parenthesis */,
- enc);
- }
- nextvalue = rb_hash_default_value(hash, sym);
- if (NIL_P(nextvalue)) {
- rb_enc_raise(enc, rb_eKeyError, "key%.*s not found", len, start);
- }
+ rb_enc_raise(enc, rb_eKeyError, "key%.*s not found", len, start);
}
if (term == '}') goto format_s;
p++;
@@ -697,10 +652,10 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
CHECK(n);
rb_enc_mbcput(c, &buf[blen], enc);
blen += n;
- if (width > 1) FILL(' ', width-1);
+ FILL(' ', width-1);
}
else {
- if (width > 1) FILL(' ', width-1);
+ FILL(' ', width-1);
CHECK(n);
rb_enc_mbcput(c, &buf[blen], enc);
blen += n;
@@ -715,12 +670,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
VALUE arg = GETARG();
long len, slen;
- if (*p == 'p') {
- str = rb_inspect(arg);
- }
- else {
- str = rb_obj_as_string(arg);
- }
+ if (*p == 'p') arg = rb_inspect(arg);
+ str = rb_obj_as_string(arg);
if (OBJ_TAINTED(str)) tainted = 1;
len = RSTRING_LEN(str);
rb_str_set_len(result, blen);
@@ -902,7 +853,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
if (numdigits == 0 ||
((abs_nlz_bits != (size_t)(numbits-1) ||
!rb_absint_singlebit_p(val)) &&
- (!bignum ? v < 0 : BIGNUM_NEGATIVE_P(val))))
+ (!bignum ? v < 0 : RBIGNUM_NEGATIVE_P(val))))
numdigits++;
tmp = rb_str_new(NULL, numdigits);
valsign = rb_integer_pack(val, RSTRING_PTR(tmp), RSTRING_LEN(tmp),
@@ -1031,124 +982,21 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
break;
case 'f':
- {
- VALUE val = GETARG(), num, den;
- int sign = (flags&FPLUS) ? 1 : 0, zero = 0;
- long len, done = 0;
- int prefix = 0;
- if (FIXNUM_P(val) || RB_TYPE_P(val, T_BIGNUM)) {
- den = INT2FIX(1);
- num = val;
- }
- else if (RB_TYPE_P(val, T_RATIONAL)) {
- den = rb_rational_den(val);
- num = rb_rational_num(val);
- }
- else {
- nextvalue = val;
- goto float_value;
- }
- if (!(flags&FPREC)) prec = default_float_precision;
- if (FIXNUM_P(num)) {
- if ((SIGNED_VALUE)num < 0) {
- long n = -FIX2LONG(num);
- num = LONG2FIX(n);
- sign = -1;
- }
- }
- else if (rb_num_negative_p(num)) {
- sign = -1;
- num = rb_funcallv(num, idUMinus, 0, 0);
- }
- if (den != INT2FIX(1) || prec > 1) {
- const ID idDiv = rb_intern("div");
- VALUE p10 = rb_int_positive_pow(10, prec);
- VALUE den_2 = rb_funcall(den, idDiv, 1, INT2FIX(2));
- num = rb_funcallv(num, '*', 1, &p10);
- num = rb_funcallv(num, '+', 1, &den_2);
- num = rb_funcallv(num, idDiv, 1, &den);
- }
- else if (prec >= 0) {
- zero = prec;
- }
- val = rb_obj_as_string(num);
- len = RSTRING_LEN(val) + zero;
- if (prec >= len) len = prec + 1; /* integer part 0 */
- if (sign || (flags&FSPACE)) ++len;
- if (prec > 0) ++len; /* period */
- CHECK(len > width ? len : width);
- if (sign || (flags&FSPACE)) {
- buf[blen++] = sign > 0 ? '+' : sign < 0 ? '-' : ' ';
- prefix++;
- done++;
- }
- len = RSTRING_LEN(val) + zero;
- t = RSTRING_PTR(val);
- if (len > prec) {
- memcpy(&buf[blen], t, len - prec);
- blen += len - prec;
- done += len - prec;
- }
- else {
- buf[blen++] = '0';
- done++;
- }
- if (prec > 0) {
- buf[blen++] = '.';
- done++;
- }
- if (zero) {
- FILL('0', zero);
- done += zero;
- }
- else if (prec > len) {
- FILL('0', prec - len);
- memcpy(&buf[blen], t, len);
- blen += len;
- done += prec;
- }
- else if (prec > 0) {
- memcpy(&buf[blen], t + len - prec, prec);
- blen += prec;
- done += prec;
- }
- if ((flags & FWIDTH) && width > done) {
- int fill = ' ';
- long shifting = 0;
- if (!(flags&FMINUS)) {
- shifting = done;
- if (flags&FZERO) {
- shifting -= prefix;
- fill = '0';
- }
- blen -= shifting;
- memmove(&buf[blen + width - done], &buf[blen], shifting);
- }
- FILL(fill, width - done);
- blen += shifting;
- }
- RB_GC_GUARD(val);
- break;
- }
case 'g':
case 'G':
case 'e':
case 'E':
- /* TODO: rational support */
case 'a':
case 'A':
- float_value:
{
VALUE val = GETARG();
double fval;
- int i, need;
+ int i, need = 6;
char fbuf[32];
fval = RFLOAT_VALUE(rb_Float(val));
if (isnan(fval) || isinf(fval)) {
const char *expr;
- int elen;
- char sign = '\0';
if (isnan(fval)) {
expr = "NaN";
@@ -1157,28 +1005,33 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
expr = "Inf";
}
need = (int)strlen(expr);
- elen = need;
- i = 0;
- if (!isnan(fval) && fval < 0.0)
- sign = '-';
- else if (flags & (FPLUS|FSPACE))
- sign = (flags & FPLUS) ? '+' : ' ';
- if (sign)
- ++need;
+ if ((!isnan(fval) && fval < 0.0) || (flags & FPLUS))
+ need++;
if ((flags & FWIDTH) && need < width)
need = width;
- FILL(' ', need);
+ CHECK(need + 1);
+ snprintf(&buf[blen], need + 1, "%*s", need, "");
if (flags & FMINUS) {
- if (sign)
- buf[blen - need--] = sign;
- memcpy(&buf[blen - need], expr, elen);
+ if (!isnan(fval) && fval < 0.0)
+ buf[blen++] = '-';
+ else if (flags & FPLUS)
+ buf[blen++] = '+';
+ else if (flags & FSPACE)
+ blen++;
+ memcpy(&buf[blen], expr, strlen(expr));
}
else {
- if (sign)
- buf[blen - elen - 1] = sign;
- memcpy(&buf[blen - elen], expr, elen);
+ if (!isnan(fval) && fval < 0.0)
+ buf[blen + need - strlen(expr) - 1] = '-';
+ else if (flags & FPLUS)
+ buf[blen + need - strlen(expr) - 1] = '+';
+ else if ((flags & FSPACE) && need > width)
+ blen++;
+ memcpy(&buf[blen + need - strlen(expr)], expr,
+ strlen(expr));
}
+ blen += strlen(&buf[blen]);
break;
}
@@ -1190,7 +1043,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
if (i > 0)
need = BIT_DIGITS(i);
}
- need += (flags&FPREC) ? prec : default_float_precision;
+ need += (flags&FPREC) ? prec : 6;
if ((flags&FWIDTH) && need < width)
need = width;
need += 20;
@@ -1267,46 +1120,8 @@ fmt_setup(char *buf, size_t size, int c, int flags, int width, int prec)
#define FLOATING_POINT 1
#define BSD__dtoa ruby_dtoa
#define BSD__hdtoa ruby_hdtoa
-#ifdef RUBY_PRI_VALUE_MARK
-# define PRI_EXTRA_MARK RUBY_PRI_VALUE_MARK
-#endif
-#define lower_hexdigits (ruby_hexdigits+0)
-#define upper_hexdigits (ruby_hexdigits+16)
#include "vsnprintf.c"
-int
-ruby_vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
-{
- int ret;
- rb_printf_buffer f;
-
- if ((int)n < 1)
- return (EOF);
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *)str;
- f._bf._size = f._w = n - 1;
- f.vwrite = BSD__sfvwrite;
- f.vextra = 0;
- ret = (int)BSD_vfprintf(&f, fmt, ap);
- *f._p = 0;
- return ret;
-}
-
-int
-ruby_snprintf(char *str, size_t n, char const *fmt, ...)
-{
- int ret;
- va_list ap;
-
- if ((int)n < 1)
- return (EOF);
-
- va_start(ap, fmt);
- ret = ruby_vsnprintf(str, n, fmt, ap);
- va_end(ap);
- return ret;
-}
-
typedef struct {
rb_printf_buffer base;
volatile VALUE value;
@@ -1339,7 +1154,7 @@ ruby__sfvwrite(register rb_printf_buffer *fp, register struct __suio *uio)
return 0;
}
-static const char *
+static char *
ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int sign)
{
VALUE value, result = (VALUE)fp->_bf._base;
@@ -1352,26 +1167,6 @@ ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int s
rb_raise(rb_eRuntimeError, "rb_vsprintf reentered");
}
if (sign == '+') {
- if (RB_TYPE_P(value, T_CLASS)) {
-# define LITERAL(str) (*sz = rb_strlen_lit(str), str)
-
- if (value == rb_cNilClass) {
- return LITERAL("nil");
- }
- else if (value == rb_cFixnum) {
- return LITERAL("Fixnum");
- }
- else if (value == rb_cSymbol) {
- return LITERAL("Symbol");
- }
- else if (value == rb_cTrueClass) {
- return LITERAL("true");
- }
- else if (value == rb_cFalseClass) {
- return LITERAL("false");
- }
-# undef LITERAL
- }
value = rb_inspect(value);
}
else {
diff --git a/st.c b/st.c
index 9b79704e2c..c8f72c68c8 100644
--- a/st.c
+++ b/st.c
@@ -6,7 +6,7 @@
#include "regint.h"
#include "st.h"
#else
-#include "internal.h"
+#include "ruby/ruby.h"
#endif
#include <stdio.h>
@@ -14,7 +14,6 @@
#include <stdlib.h>
#endif
#include <string.h>
-#include "ccan/list/list.h"
typedef struct st_table_entry st_table_entry;
@@ -23,7 +22,7 @@ struct st_table_entry {
st_data_t key;
st_data_t record;
st_table_entry *next;
- struct list_node olist;
+ st_table_entry *fore, *back;
};
typedef struct st_packed_entry {
@@ -31,18 +30,17 @@ typedef struct st_packed_entry {
st_data_t key, val;
} st_packed_entry;
-#ifndef STATIC_ASSERT
-#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[(expr) ? 1 : -1]
-#endif
+#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[(expr) ? 1 : -1];
#define ST_DEFAULT_MAX_DENSITY 5
-#define ST_DEFAULT_INIT_TABLE_SIZE 16
+#define ST_DEFAULT_INIT_TABLE_SIZE 11
+#define ST_DEFAULT_SECOND_TABLE_SIZE 19
#define ST_DEFAULT_PACKED_TABLE_SIZE 18
#define PACKED_UNIT (int)(sizeof(st_packed_entry) / sizeof(st_table_entry*))
#define MAX_PACKED_HASH (int)(ST_DEFAULT_PACKED_TABLE_SIZE * sizeof(st_table_entry*) / sizeof(st_packed_entry))
-STATIC_ASSERT(st_packed_entry, sizeof(st_packed_entry) == sizeof(st_table_entry*[PACKED_UNIT]));
-STATIC_ASSERT(st_packed_bins, sizeof(st_packed_entry[MAX_PACKED_HASH]) <= sizeof(st_table_entry*[ST_DEFAULT_PACKED_TABLE_SIZE]));
+STATIC_ASSERT(st_packed_entry, sizeof(st_packed_entry) == sizeof(st_table_entry*[PACKED_UNIT]))
+STATIC_ASSERT(st_packed_bins, sizeof(st_packed_entry[MAX_PACKED_HASH]) <= sizeof(st_table_entry*[ST_DEFAULT_PACKED_TABLE_SIZE]))
/*
* DEFAULT_MAX_DENSITY is the default for the largest we allow the
@@ -76,20 +74,18 @@ static const struct st_hash_type type_strcasehash = {
static void rehash(st_table *);
#ifdef RUBY
-#undef malloc
-#undef realloc
-#undef calloc
-#undef free
#define malloc xmalloc
#define calloc xcalloc
#define realloc xrealloc
#define free(x) xfree(x)
#endif
-#define EQUAL(table,x,ent) ((x)==(ent)->key || (*(table)->type->compare)((x),(ent)->key) == 0)
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
+#define EQUAL(table,x,y) ((x)==(y) || (*(table)->type->compare)((x),(y)) == 0)
#define do_hash(key,table) (st_index_t)(*(table)->type->hash)((key))
-#define hash_pos(h,n) ((h) & (n - 1))
+#define do_hash_bin(key,table) (do_hash((key), (table))%(table)->num_bins)
/* preparation for possible allocation improvements */
#define st_alloc_entry() (st_table_entry *)malloc(sizeof(st_table_entry))
@@ -108,6 +104,8 @@ st_realloc_bins(st_table_entry **bins, st_index_t newsize, st_index_t oldsize)
/* Shortcut */
#define bins as.big.bins
+#define head as.big.head
+#define tail as.big.tail
#define real_entries as.packed.real_entries
/* preparation for possible packing improvements */
@@ -141,35 +139,69 @@ remove_safe_packed_entry(st_table *table, st_index_t i, st_data_t never)
PHASH_SET(table, i, 0);
}
-static st_index_t
-next_pow2(st_index_t x)
-{
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
-#if SIZEOF_ST_INDEX_T == 8
- x |= x >> 32;
-#endif
- return x + 1;
-}
+/*
+ * MINSIZE is the minimum size of a dictionary.
+ */
+
+#define MINSIZE 8
+
+/*
+Table of prime numbers 2^n+a, 2<=n<=30.
+*/
+static const unsigned int primes[] = {
+ ST_DEFAULT_INIT_TABLE_SIZE,
+ ST_DEFAULT_SECOND_TABLE_SIZE,
+ 32 + 5,
+ 64 + 3,
+ 128 + 3,
+ 256 + 27,
+ 512 + 9,
+ 1024 + 9,
+ 2048 + 5,
+ 4096 + 3,
+ 8192 + 27,
+ 16384 + 43,
+ 32768 + 3,
+ 65536 + 45,
+ 131072 + 29,
+ 262144 + 3,
+ 524288 + 21,
+ 1048576 + 7,
+ 2097152 + 17,
+ 4194304 + 15,
+ 8388608 + 9,
+ 16777216 + 43,
+ 33554432 + 35,
+ 67108864 + 15,
+ 134217728 + 29,
+ 268435456 + 3,
+ 536870912 + 11,
+ 1073741824 + 85,
+ 0
+};
static st_index_t
new_size(st_index_t size)
{
- st_index_t n;
+ int i;
- if (size && (size & ~(size - 1)) == size) /* already a power-of-two? */
- return size;
+#if 0
+ for (i=3; i<31; i++) {
+ if ((1<<i) > size) return 1<<i;
+ }
+ return -1;
+#else
+ st_index_t newsize;
- n = next_pow2(size);
- if (n > size)
- return n;
+ for (i = 0, newsize = MINSIZE; i < numberof(primes); i++, newsize <<= 1) {
+ if (newsize > size) return primes[i];
+ }
+ /* Ran out of polynomials */
#ifndef NOT_RUBY
rb_raise(rb_eRuntimeError, "st_table too big");
#endif
return -1; /* should raise exception */
+#endif
}
#ifdef HASH_LOG
@@ -193,13 +225,6 @@ stat_col(void)
}
#endif
-static struct list_head *
-st_head(const st_table *tbl)
-{
- uintptr_t addr = (uintptr_t)&tbl->as.big.private_list_head;
- return (struct list_head *)addr;
-}
-
st_table*
st_init_table_with_size(const struct st_hash_type *type, st_index_t size)
{
@@ -225,14 +250,14 @@ st_init_table_with_size(const struct st_hash_type *type, st_index_t size)
tbl->entries_packed = size <= MAX_PACKED_HASH;
if (tbl->entries_packed) {
size = ST_DEFAULT_PACKED_TABLE_SIZE;
- tbl->real_entries = 0;
}
else {
- size = new_size(size); /* round up to power-of-two */
- list_head_init(st_head(tbl));
+ size = new_size(size); /* round up to prime number */
}
tbl->num_bins = size;
tbl->bins = st_alloc_bins(size);
+ tbl->head = 0;
+ tbl->tail = 0;
return tbl;
}
@@ -282,7 +307,8 @@ st_init_strcasetable_with_size(st_index_t size)
void
st_clear(st_table *table)
{
- register st_table_entry *ptr = 0, *next;
+ register st_table_entry *ptr, *next;
+ st_index_t i;
if (table->entries_packed) {
table->num_entries = 0;
@@ -290,13 +316,18 @@ st_clear(st_table *table)
return;
}
- list_for_each_safe(st_head(table), ptr, next, olist) {
- /* list_del is not needed */
- st_free_entry(ptr);
+ for (i = 0; i < table->num_bins; i++) {
+ ptr = table->bins[i];
+ table->bins[i] = 0;
+ while (ptr != 0) {
+ next = ptr->next;
+ st_free_entry(ptr);
+ ptr = next;
+ }
}
table->num_entries = 0;
- MEMZERO(table->bins, st_table_entry*, table->num_bins);
- list_head_init(st_head(table));
+ table->head = 0;
+ table->tail = 0;
}
void
@@ -319,7 +350,7 @@ st_memsize(const st_table *table)
}
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
-((ptr) != 0 && ((ptr)->hash != (hash_val) || !EQUAL((table), (key), (ptr))))
+((ptr) != 0 && ((ptr)->hash != (hash_val) || !EQUAL((table), (key), (ptr)->key)))
#ifdef HASH_LOG
static void
@@ -344,11 +375,10 @@ count_collision(const struct st_hash_type *type)
#endif
#define FIND_ENTRY(table, ptr, hash_val, bin_pos) \
- ((ptr) = find_entry((table), key, (hash_val), ((bin_pos) = hash_pos(hash_val, (table)->num_bins))))
+ ((ptr) = find_entry((table), key, (hash_val), ((bin_pos) = (hash_val)%(table)->num_bins)))
static st_table_entry *
-find_entry(const st_table *table, st_data_t key, st_index_t hash_val,
- st_index_t bin_pos)
+find_entry(st_table *table, st_data_t key, st_index_t hash_val, st_index_t bin_pos)
{
register st_table_entry *ptr = table->bins[bin_pos];
FOUND_ENTRY;
@@ -363,22 +393,16 @@ find_entry(const st_table *table, st_data_t key, st_index_t hash_val,
}
static inline st_index_t
-find_packed_index_from(const st_table *table, st_index_t hash_val,
- st_data_t key, st_index_t i)
+find_packed_index(st_table *table, st_index_t hash_val, st_data_t key)
{
+ st_index_t i = 0;
while (i < table->real_entries &&
- (PHASH(table, i) != hash_val || !EQUAL(table, key, &PACKED_ENT(table, i)))) {
+ (PHASH(table, i) != hash_val || !EQUAL(table, key, PKEY(table, i)))) {
i++;
}
return i;
}
-static inline st_index_t
-find_packed_index(const st_table *table, st_index_t hash_val, st_data_t key)
-{
- return find_packed_index_from(table, hash_val, key, 0);
-}
-
#define collision_check 0
int
@@ -398,7 +422,7 @@ st_lookup(st_table *table, register st_data_t key, st_data_t *value)
return 0;
}
- ptr = find_entry(table, key, hash_val, hash_pos(hash_val, table->num_bins));
+ ptr = find_entry(table, key, hash_val, hash_val % table->num_bins);
if (ptr == 0) {
return 0;
@@ -426,7 +450,7 @@ st_get_key(st_table *table, register st_data_t key, st_data_t *result)
return 0;
}
- ptr = find_entry(table, key, hash_val, hash_pos(hash_val, table->num_bins));
+ ptr = find_entry(table, key, hash_val, hash_val % table->num_bins);
if (ptr == 0) {
return 0;
@@ -462,11 +486,20 @@ add_direct(st_table *table, st_data_t key, st_data_t value,
register st_table_entry *entry;
if (table->num_entries > ST_DEFAULT_MAX_DENSITY * table->num_bins) {
rehash(table);
- bin_pos = hash_pos(hash_val, table->num_bins);
+ bin_pos = hash_val % table->num_bins;
}
entry = new_entry(table, key, value, hash_val, bin_pos);
- list_add_tail(st_head(table), &entry->olist);
+
+ if (table->head != 0) {
+ entry->fore = 0;
+ (entry->back = table->tail)->fore = entry;
+ table->tail = entry;
+ }
+ else {
+ table->head = table->tail = entry;
+ entry->fore = entry->back = 0;
+ }
table->num_entries++;
}
@@ -475,7 +508,7 @@ unpack_entries(register st_table *table)
{
st_index_t i;
st_packed_entry packed_bins[MAX_PACKED_HASH];
- register st_table_entry *entry;
+ register st_table_entry *entry, *preventry = 0, **chain;
st_table tmp_table = *table;
MEMCPY(packed_bins, PACKED_BINS(table), st_packed_entry, MAX_PACKED_HASH);
@@ -487,24 +520,22 @@ unpack_entries(register st_table *table)
tmp_table.bins = st_realloc_bins(tmp_table.bins, ST_DEFAULT_INIT_TABLE_SIZE, tmp_table.num_bins);
tmp_table.num_bins = ST_DEFAULT_INIT_TABLE_SIZE;
#endif
-
- /*
- * order is important here, we need to keep the original table
- * walkable during GC (GC may be triggered by new_entry call)
- */
i = 0;
- list_head_init(st_head(&tmp_table));
+ chain = &tmp_table.head;
do {
st_data_t key = packed_bins[i].key;
st_data_t val = packed_bins[i].val;
st_index_t hash = packed_bins[i].hash;
entry = new_entry(&tmp_table, key, val, hash,
- hash_pos(hash, ST_DEFAULT_INIT_TABLE_SIZE));
- list_add_tail(st_head(&tmp_table), &entry->olist);
+ hash % ST_DEFAULT_INIT_TABLE_SIZE);
+ *chain = entry;
+ entry->back = preventry;
+ preventry = entry;
+ chain = &entry->fore;
} while (++i < MAX_PACKED_HASH);
+ *chain = NULL;
+ tmp_table.tail = entry;
*table = tmp_table;
- list_head_init(st_head(table));
- list_append_list(st_head(table), st_head(&tmp_table));
}
static void
@@ -519,7 +550,7 @@ add_packed_direct(st_table *table, st_data_t key, st_data_t value, st_index_t ha
}
else {
unpack_entries(table);
- add_direct(table, key, value, hash_val, hash_pos(hash_val, table->num_bins));
+ add_direct(table, key, value, hash_val, hash_val % table->num_bins);
}
}
@@ -600,13 +631,13 @@ st_add_direct(st_table *table, st_data_t key, st_data_t value)
return;
}
- add_direct(table, key, value, hash_val, hash_pos(hash_val, table->num_bins));
+ add_direct(table, key, value, hash_val, hash_val % table->num_bins);
}
static void
rehash(register st_table *table)
{
- register st_table_entry *ptr = 0, **new_bins;
+ register st_table_entry *ptr, **new_bins;
st_index_t new_num_bins, hash_val;
new_num_bins = new_size(table->num_bins+1);
@@ -614,10 +645,12 @@ rehash(register st_table *table)
table->num_bins = new_num_bins;
table->bins = new_bins;
- list_for_each(st_head(table), ptr, olist) {
- hash_val = hash_pos(ptr->hash, new_num_bins);
- ptr->next = new_bins[hash_val];
- new_bins[hash_val] = ptr;
+ if ((ptr = table->head) != 0) {
+ do {
+ hash_val = ptr->hash % new_num_bins;
+ ptr->next = new_bins[hash_val];
+ new_bins[hash_val] = ptr;
+ } while ((ptr = ptr->fore) != 0);
}
}
@@ -625,8 +658,9 @@ st_table*
st_copy(st_table *old_table)
{
st_table *new_table;
- st_table_entry *ptr = 0, *entry;
+ st_table_entry *ptr, *entry, *prev, **tailp;
st_index_t num_bins = old_table->num_bins;
+ st_index_t hash_val;
new_table = st_alloc_table();
if (new_table == 0) {
@@ -646,12 +680,24 @@ st_copy(st_table *old_table)
return new_table;
}
- list_head_init(st_head(new_table));
-
- list_for_each(st_head(old_table), ptr, olist) {
- entry = new_entry(new_table, ptr->key, ptr->record, ptr->hash,
- hash_pos(ptr->hash, num_bins));
- list_add_tail(st_head(new_table), &entry->olist);
+ if ((ptr = old_table->head) != 0) {
+ prev = 0;
+ tailp = &new_table->head;
+ do {
+ entry = st_alloc_entry();
+ if (entry == 0) {
+ st_free_table(new_table);
+ return 0;
+ }
+ *entry = *ptr;
+ hash_val = entry->hash % num_bins;
+ entry->next = new_table->bins[hash_val];
+ new_table->bins[hash_val] = entry;
+ entry->back = prev;
+ *tailp = prev = entry;
+ tailp = &entry->fore;
+ } while ((ptr = ptr->fore) != 0);
+ new_table->tail = prev;
}
return new_table;
@@ -660,7 +706,17 @@ st_copy(st_table *old_table)
static inline void
remove_entry(st_table *table, st_table_entry *ptr)
{
- list_del(&ptr->olist);
+ if (ptr->fore == 0 && ptr->back == 0) {
+ table->head = 0;
+ table->tail = 0;
+ }
+ else {
+ st_table_entry *fore = ptr->fore, *back = ptr->back;
+ if (fore) fore->back = back;
+ if (back) back->fore = fore;
+ if (ptr == table->head) table->head = fore;
+ if (ptr == table->tail) table->tail = back;
+ }
table->num_entries--;
}
@@ -685,9 +741,9 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
return 0;
}
- prev = &table->bins[hash_pos(hash_val, table->num_bins)];
+ prev = &table->bins[hash_val % table->num_bins];
for (;(ptr = *prev) != 0; prev = &ptr->next) {
- if (EQUAL(table, *key, ptr)) {
+ if (EQUAL(table, *key, ptr->key)) {
*prev = ptr->next;
remove_entry(table, ptr);
if (value != 0) *value = ptr->record;
@@ -721,10 +777,10 @@ st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *val
return 0;
}
- ptr = table->bins[hash_pos(hash_val, table->num_bins)];
+ ptr = table->bins[hash_val % table->num_bins];
for (; ptr != 0; ptr = ptr->next) {
- if ((ptr->key != never) && EQUAL(table, *key, ptr)) {
+ if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
remove_entry(table, ptr);
*key = ptr->key;
if (value != 0) *value = ptr->record;
@@ -740,7 +796,6 @@ st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *val
int
st_shift(register st_table *table, register st_data_t *key, st_data_t *value)
{
- st_table_entry *old;
st_table_entry **prev;
register st_table_entry *ptr;
@@ -756,13 +811,12 @@ st_shift(register st_table *table, register st_data_t *key, st_data_t *value)
return 1;
}
- old = list_pop(st_head(table), st_table_entry, olist);
- table->num_entries--;
- prev = &table->bins[hash_pos(old->hash, table->num_bins)];
- while ((ptr = *prev) != old) prev = &ptr->next;
+ prev = &table->bins[table->head->hash % table->num_bins];
+ while ((ptr = *prev) != table->head) prev = &ptr->next;
*prev = ptr->next;
if (value != 0) *value = ptr->record;
*key = ptr->key;
+ remove_entry(table, ptr);
st_free_entry(ptr);
return 1;
}
@@ -809,7 +863,7 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
{
st_index_t hash_val, bin_pos;
register st_table_entry *ptr, **last, *tmp;
- st_data_t value = 0, old_key;
+ st_data_t value = 0;
int retval, existing = 0;
hash_val = do_hash(key, table);
@@ -822,7 +876,6 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
existing = 1;
}
{
- old_key = key;
retval = (*func)(&key, &value, arg, existing);
if (!table->entries_packed) {
FIND_ENTRY(table, ptr, hash_val, bin_pos);
@@ -834,9 +887,6 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
add_packed_direct(table, key, value, hash_val);
break;
}
- if (old_key != key) {
- PKEY(table, i) = key;
- }
PVAL_SET(table, i, value);
break;
case ST_DELETE:
@@ -855,18 +905,14 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
existing = 1;
}
{
- old_key = key;
retval = (*func)(&key, &value, arg, existing);
unpacked:
switch (retval) {
case ST_CONTINUE:
if (!existing) {
- add_direct(table, key, value, hash_val, hash_pos(hash_val, table->num_bins));
+ add_direct(table, key, value, hash_val, hash_val % table->num_bins);
break;
}
- if (old_key != key) {
- ptr->key = key;
- }
ptr->record = value;
break;
case ST_DELETE:
@@ -874,6 +920,7 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
last = &table->bins[bin_pos];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
+ tmp = ptr->fore;
*last = ptr->next;
remove_entry(table, ptr);
st_free_entry(ptr);
@@ -889,8 +936,7 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
int
st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t never)
{
- st_table_entry *ptr = 0, **last, *tmp, *next;
- struct list_head *head;
+ st_table_entry *ptr, **last, *tmp;
enum st_retval retval;
st_index_t i;
@@ -907,10 +953,8 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
FIND_ENTRY(table, ptr, hash, i);
if (retval == ST_CHECK) {
if (!ptr) goto deleted;
+ goto unpacked_continue;
}
- if (table->num_entries == 0) return 0;
- head = st_head(table);
- next = list_entry(ptr->olist.next, st_table_entry, olist);
goto unpacked;
}
switch (retval) {
@@ -918,10 +962,9 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
if (PHASH(table, i) == 0 && PKEY(table, i) == never) {
break;
}
- i = find_packed_index_from(table, hash, key, i);
- if (i >= table->real_entries) {
- i = find_packed_index(table, hash, key);
- if (i >= table->real_entries) goto deleted;
+ i = find_packed_index(table, hash, key);
+ if (i == table->real_entries) {
+ goto deleted;
}
/* fall through */
case ST_CONTINUE:
@@ -935,11 +978,15 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
}
return 0;
}
+ else {
+ ptr = table->head;
+ }
- head = st_head(table);
- list_for_each_safe(head, ptr, next, olist) {
- if (ptr->key != never) {
- i = hash_pos(ptr->hash, table->num_bins);
+ if (ptr != 0) {
+ do {
+ if (ptr->key == never)
+ goto unpacked_continue;
+ i = ptr->hash % table->num_bins;
retval = (*func)(ptr->key, ptr->record, arg, 0);
unpacked:
switch (retval) {
@@ -954,22 +1001,25 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
}
/* fall through */
case ST_CONTINUE:
+ unpacked_continue:
+ ptr = ptr->fore;
break;
case ST_STOP:
return 0;
case ST_DELETE:
- last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
+ last = &table->bins[ptr->hash % table->num_bins];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
+ tmp = ptr->fore;
remove_entry(table, ptr);
ptr->key = ptr->record = never;
ptr->hash = 0;
+ ptr = tmp;
break;
}
}
- if (table->num_entries == 0) return 0;
}
- }
+ } while (ptr && table->head);
}
return 0;
}
@@ -977,15 +1027,13 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
int
st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
{
- st_table_entry *ptr = 0, **last, *tmp, *next;
+ st_table_entry *ptr, **last, *tmp;
enum st_retval retval;
- struct list_head *head;
st_index_t i;
if (table->entries_packed) {
for (i = 0; i < table->real_entries; i++) {
- st_data_t key, val;
- st_index_t hash;
+ st_data_t key, val, hash;
key = PKEY(table, i);
val = PVAL(table, i);
hash = PHASH(table, i);
@@ -993,8 +1041,6 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
if (!table->entries_packed) {
FIND_ENTRY(table, ptr, hash, i);
if (!ptr) return 0;
- head = st_head(table);
- next = list_entry(ptr->olist.next, st_table_entry, olist);
goto unpacked;
}
switch (retval) {
@@ -1011,185 +1057,88 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
}
return 0;
}
+ else {
+ ptr = table->head;
+ }
- head = st_head(table);
- list_for_each_safe(head, ptr, next, olist) {
- i = hash_pos(ptr->hash, table->num_bins);
- retval = (*func)(ptr->key, ptr->record, arg, 0);
- unpacked:
- switch (retval) {
- case ST_CONTINUE:
- break;
- case ST_CHECK:
- case ST_STOP:
- return 0;
- case ST_DELETE:
- last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
- for (; (tmp = *last) != 0; last = &tmp->next) {
- if (ptr == tmp) {
- *last = ptr->next;
- remove_entry(table, ptr);
- st_free_entry(ptr);
- break;
+ if (ptr != 0) {
+ do {
+ i = ptr->hash % table->num_bins;
+ retval = (*func)(ptr->key, ptr->record, arg, 0);
+ unpacked:
+ switch (retval) {
+ case ST_CONTINUE:
+ ptr = ptr->fore;
+ break;
+ case ST_CHECK:
+ case ST_STOP:
+ return 0;
+ case ST_DELETE:
+ last = &table->bins[ptr->hash % table->num_bins];
+ for (; (tmp = *last) != 0; last = &tmp->next) {
+ if (ptr == tmp) {
+ tmp = ptr->fore;
+ *last = ptr->next;
+ remove_entry(table, ptr);
+ st_free_entry(ptr);
+ ptr = tmp;
+ break;
+ }
}
}
- if (table->num_entries == 0) return 0;
- }
+ } while (ptr && table->head);
}
return 0;
}
-static st_index_t
-get_keys(const st_table *table, st_data_t *keys, st_index_t size,
- int check, st_data_t never)
-{
- st_data_t key;
- st_data_t *keys_start = keys;
-
- if (table->entries_packed) {
- st_index_t i;
-
- if (size > table->real_entries) size = table->real_entries;
- for (i = 0; i < size; i++) {
- key = PKEY(table, i);
- if (check && key == never) continue;
- *keys++ = key;
- }
- }
- else {
- st_table_entry *ptr = 0;
- st_data_t *keys_end = keys + size;
-
- list_for_each(st_head(table), ptr, olist) {
- if (keys >= keys_end) break;
- key = ptr->key;
- if (check && key == never) continue;
- *keys++ = key;
- }
- }
-
- return keys - keys_start;
-}
-
-st_index_t
-st_keys(st_table *table, st_data_t *keys, st_index_t size)
-{
- return get_keys(table, keys, size, 0, 0);
-}
-
-st_index_t
-st_keys_check(st_table *table, st_data_t *keys, st_index_t size, st_data_t never)
-{
- return get_keys(table, keys, size, 1, never);
-}
-
-static st_index_t
-get_values(const st_table *table, st_data_t *values, st_index_t size,
- int check, st_data_t never)
-{
- st_data_t key;
- st_data_t *values_start = values;
-
- if (table->entries_packed) {
- st_index_t i;
-
- if (size > table->real_entries) size = table->real_entries;
- for (i = 0; i < size; i++) {
- key = PKEY(table, i);
- if (check && key == never) continue;
- *values++ = PVAL(table, i);
- }
- }
- else {
- st_table_entry *ptr = 0;
- st_data_t *values_end = values + size;
-
- list_for_each(st_head(table), ptr, olist) {
- if (values >= values_end) break;
- key = ptr->key;
- if (check && key == never) continue;
- *values++ = ptr->record;
- }
- }
-
- return values - values_start;
-}
-
-st_index_t
-st_values(st_table *table, st_data_t *values, st_index_t size)
-{
- return get_values(table, values, size, 0, 0);
-}
-
-st_index_t
-st_values_check(st_table *table, st_data_t *values, st_index_t size, st_data_t never)
-{
- return get_values(table, values, size, 1, never);
-}
-
#if 0 /* unused right now */
int
-st_reverse_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t never)
+st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
{
- st_table_entry *ptr, **last, *tmp, *next;
- struct list_head *head;
+ st_table_entry *ptr, **last, *tmp;
enum st_retval retval;
- st_index_t i;
+ int i;
if (table->entries_packed) {
- for (i = table->real_entries; 0 < i;) {
- st_data_t key, val;
- st_index_t hash;
- --i;
- key = PKEY(table, i);
- val = PVAL(table, i);
- hash = PHASH(table, i);
- if (key == never) continue;
- retval = (*func)(key, val, arg, 0);
- if (!table->entries_packed) {
- FIND_ENTRY(table, ptr, hash, i);
- if (retval == ST_CHECK) {
- if (!ptr) goto deleted;
- }
- if (table->num_entries == 0) return 0;
- head = st_head(table);
- next = list_entry(ptr->olist.next, st_table_entry, olist);
- goto unpacked;
- }
- switch (retval) {
+ for (i = table->num_entries-1; 0 <= i; i--) {
+ int j;
+ st_data_t key, val;
+ key = PKEY(table, i);
+ val = PVAL(table, i);
+ retval = (*func)(key, val, arg, 0);
+ switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
- if (PHASH(table, i) == 0 && PKEY(table, i) == never) {
- break;
- }
- i = find_packed_index_from(table, hash, key, i);
- if (i >= table->real_entries) {
- i = find_packed_index(table, hash, key);
- if (i >= table->real_entries) goto deleted;
- }
+ for (j = 0; j < table->num_entries; j++) {
+ if (PKEY(table, j) == key)
+ break;
+ }
+ if (j == table->num_entries) {
+ /* call func with error notice */
+ retval = (*func)(0, 0, arg, 1);
+ return 1;
+ }
/* fall through */
case ST_CONTINUE:
break;
case ST_STOP:
return 0;
case ST_DELETE:
- remove_safe_packed_entry(table, i, never);
- break;
- }
- }
- return 0;
+ remove_packed_entry(table, i);
+ break;
+ }
+ }
+ return 0;
}
- head = st_head(table);
- list_for_each_rev_safe(head, ptr, next, olist) {
- if (ptr->key != never) {
- i = hash_pos(ptr->hash, table->num_bins);
+ if ((ptr = table->head) != 0) {
+ ptr = ptr->back;
+ do {
retval = (*func)(ptr->key, ptr->record, arg, 0);
- unpacked:
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
+ i = ptr->hash % table->num_bins;
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
if (!tmp) {
- deleted:
/* call func with error notice */
retval = (*func)(0, 0, arg, 1);
return 1;
@@ -1197,87 +1146,27 @@ st_reverse_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, s
}
/* fall through */
case ST_CONTINUE:
+ ptr = ptr->back;
break;
case ST_STOP:
return 0;
case ST_DELETE:
- last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
+ last = &table->bins[ptr->hash % table->num_bins];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
+ tmp = ptr->back;
+ *last = ptr->next;
remove_entry(table, ptr);
- ptr->key = ptr->record = never;
- ptr->hash = 0;
+ st_free_entry(ptr);
+ ptr = tmp;
break;
}
}
- if (table->num_entries == 0) return 0;
+ ptr = ptr->next;
+ free(tmp);
+ table->num_entries--;
}
- }
- }
- return 0;
-}
-
-int
-st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
-{
- st_table_entry *ptr, **last, *tmp, *next;
- enum st_retval retval;
- struct list_head *head;
- st_index_t i;
-
- if (table->entries_packed) {
- for (i = table->real_entries; 0 < i;) {
- st_data_t key, val;
- st_index_t hash;
- --i;
- key = PKEY(table, i);
- val = PVAL(table, i);
- hash = PHASH(table, i);
- retval = (*func)(key, val, arg, 0);
- if (!table->entries_packed) {
- FIND_ENTRY(table, ptr, hash, i);
- if (!ptr) return 0;
- head = st_head(table);
- next = list_entry(ptr->olist.next, st_table_entry, olist);
- goto unpacked;
- }
- switch (retval) {
- case ST_CONTINUE:
- break;
- case ST_CHECK:
- case ST_STOP:
- return 0;
- case ST_DELETE:
- remove_packed_entry(table, i);
- break;
- }
- }
- return 0;
- }
-
- head = st_head(table);
- list_for_each_rev_safe(head, ptr, next, olist) {
- i = hash_pos(ptr->hash, table->num_bins);
- retval = (*func)(ptr->key, ptr->record, arg, 0);
- unpacked:
- switch (retval) {
- case ST_CONTINUE:
- break;
- case ST_CHECK:
- case ST_STOP:
- return 0;
- case ST_DELETE:
- last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
- for (; (tmp = *last) != 0; last = &tmp->next) {
- if (ptr == tmp) {
- *last = ptr->next;
- remove_entry(table, ptr);
- st_free_entry(ptr);
- break;
- }
- }
- if (table->num_entries == 0) return 0;
- }
+ } while (ptr && table->head);
}
return 0;
}
@@ -1382,7 +1271,6 @@ strhash(st_data_t arg)
#ifndef UNALIGNED_WORD_ACCESS
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
- defined(__powerpc64__) || \
defined(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
# endif
@@ -1714,6 +1602,5 @@ st_numcmp(st_data_t x, st_data_t y)
st_index_t
st_numhash(st_data_t n)
{
- enum {s1 = 11, s2 = 3};
- return (st_index_t)((n>>s1|(n<<s2)) ^ (n>>s2));
+ return (st_index_t)n;
}
diff --git a/strftime.c b/strftime.c
index e8099a3f12..83550e9a7f 100644
--- a/strftime.c
+++ b/strftime.c
@@ -497,7 +497,7 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encodi
goto unknown;
}
i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"),
- precision + (padding == ' '), sign * (off / 3600));
+ precision + 1, sign * (off / 3600));
if (i < 0) goto err;
if (sign < 0 && off < 3600) {
*(padding == ' ' ? s + i - 2 : s) = '-';
diff --git a/string.c b/string.c
index d54ff0ade7..4114f2d8b5 100644
--- a/string.c
+++ b/string.c
@@ -11,13 +11,13 @@
**********************************************************************/
-#include "internal.h"
+#include "ruby/ruby.h"
#include "ruby/re.h"
-#include "encindex.h"
+#include "ruby/encoding.h"
+#include "vm_core.h"
+#include "internal.h"
#include "probes.h"
-#include "gc.h"
#include <assert.h>
-#include "id.h"
#define BEG(no) (regs->beg[(no)])
#define END(no) (regs->end[(no)])
@@ -31,53 +31,33 @@
#define STRING_ENUMERATORS_WANTARRAY 0 /* next major */
-#undef rb_str_new
-#undef rb_usascii_str_new
-#undef rb_utf8_str_new
-#undef rb_enc_str_new
#undef rb_str_new_cstr
#undef rb_tainted_str_new_cstr
#undef rb_usascii_str_new_cstr
-#undef rb_utf8_str_new_cstr
#undef rb_enc_str_new_cstr
#undef rb_external_str_new_cstr
#undef rb_locale_str_new_cstr
#undef rb_str_dup_frozen
#undef rb_str_buf_new_cstr
-#undef rb_str_buf_cat
#undef rb_str_buf_cat2
#undef rb_str_cat2
-#undef rb_str_cat_cstr
-#undef rb_fstring_cstr
static VALUE rb_str_clear(VALUE str);
VALUE rb_cString;
VALUE rb_cSymbol;
-/* FLAGS of RString
- *
- * 1: RSTRING_NOEMBED
- * 2: STR_SHARED (== ELTS_SHARED)
- * 2-6: RSTRING_EMBED_LEN (5 bits == 32)
- * 7: STR_TMPLOCK
- * 8-9: ENC_CODERANGE (2 bits)
- * 10-16: ENCODING (7 bits == 128)
- * 17: RSTRING_FSTR
- * 18: STR_NOFREE
- * 19: STR_FAKESTR
- */
-
#define RUBY_MAX_CHAR_LEN 16
#define STR_TMPLOCK FL_USER7
-#define STR_NOFREE FL_USER18
-#define STR_FAKESTR FL_USER19
+#define STR_UNSET_NOCAPA(s) do {\
+ if (FL_TEST((s),STR_NOEMBED)) FL_UNSET((s),(ELTS_SHARED|STR_ASSOC));\
+} while (0)
#define STR_SET_NOEMBED(str) do {\
FL_SET((str), STR_NOEMBED);\
STR_SET_EMBED_LEN((str), 0);\
} while (0)
-#define STR_SET_EMBED(str) FL_UNSET((str), (STR_NOEMBED|STR_NOFREE))
+#define STR_SET_EMBED(str) FL_UNSET((str), STR_NOEMBED)
#define STR_SET_EMBED_LEN(str, n) do { \
long tmp_n = (n);\
RBASIC(str)->flags &= ~RSTRING_EMBED_LEN_MASK;\
@@ -115,11 +95,8 @@ VALUE rb_cSymbol;
#define RESIZE_CAPA(str,capacity) do {\
const int termlen = TERM_LEN(str);\
- RESIZE_CAPA_TERM(str,capacity,termlen);\
-} while (0)
-#define RESIZE_CAPA_TERM(str,capacity,termlen) do {\
if (STR_EMBED_P(str)) {\
- if ((capacity) > (RSTRING_EMBED_LEN_MAX + 1 - (termlen))) {\
+ if ((capacity) > RSTRING_EMBED_LEN_MAX) {\
char *const tmp = ALLOC_N(char, (capacity)+termlen);\
const long tlen = RSTRING_LEN(str);\
memcpy(tmp, RSTRING_PTR(str), tlen);\
@@ -130,255 +107,57 @@ VALUE rb_cSymbol;
}\
}\
else {\
- assert(!FL_TEST((str), STR_SHARED)); \
REALLOC_N(RSTRING(str)->as.heap.ptr, char, (capacity)+termlen);\
- RSTRING(str)->as.heap.aux.capa = (capacity);\
+ if (!STR_NOCAPA_P(str))\
+ RSTRING(str)->as.heap.aux.capa = (capacity);\
}\
} while (0)
#define STR_SET_SHARED(str, shared_str) do { \
- if (!FL_TEST(str, STR_FAKESTR)) { \
- RB_OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
- FL_SET((str), STR_SHARED); \
- } \
+ OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
+ FL_SET((str), ELTS_SHARED); \
} while (0)
#define STR_HEAP_PTR(str) (RSTRING(str)->as.heap.ptr)
#define STR_HEAP_SIZE(str) (RSTRING(str)->as.heap.aux.capa + TERM_LEN(str))
-#define STR_ENC_GET(str) get_encoding(str)
-
-#if !defined SHARABLE_MIDDLE_SUBSTRING
-# define SHARABLE_MIDDLE_SUBSTRING 0
-#endif
-#if !SHARABLE_MIDDLE_SUBSTRING
-#define SHARABLE_SUBSTRING_P(beg, len, end) ((beg) + (len) == (end))
-#else
-#define SHARABLE_SUBSTRING_P(beg, len, end) 1
-#endif
-
-static VALUE str_replace_shared_without_enc(VALUE str2, VALUE str);
-static VALUE str_new_shared(VALUE klass, VALUE str);
-static VALUE str_new_frozen(VALUE klass, VALUE orig);
-static VALUE str_new_static(VALUE klass, const char *ptr, long len, int encindex);
-static void str_make_independent_expand(VALUE str, long len, long expand, const int termlen);
-
-static inline void
-str_make_independent(VALUE str)
-{
- long len = RSTRING_LEN(str);
- int termlen = TERM_LEN(str);
- str_make_independent_expand((str), len, 0L, termlen);
-}
-
-static rb_encoding *
-get_actual_encoding(const int encidx, VALUE str)
-{
- const unsigned char *q;
-
- switch (encidx) {
- case ENCINDEX_UTF_16:
- if (RSTRING_LEN(str) < 2) break;
- q = (const unsigned char *)RSTRING_PTR(str);
- if (q[0] == 0xFE && q[1] == 0xFF) {
- return rb_enc_get_from_index(ENCINDEX_UTF_16BE);
- }
- if (q[0] == 0xFF && q[1] == 0xFE) {
- return rb_enc_get_from_index(ENCINDEX_UTF_16LE);
- }
- return rb_ascii8bit_encoding();
- case ENCINDEX_UTF_32:
- if (RSTRING_LEN(str) < 4) break;
- q = (const unsigned char *)RSTRING_PTR(str);
- if (q[0] == 0 && q[1] == 0 && q[2] == 0xFE && q[3] == 0xFF) {
- return rb_enc_get_from_index(ENCINDEX_UTF_32BE);
- }
- if (q[3] == 0 && q[2] == 0 && q[1] == 0xFE && q[0] == 0xFF) {
- return rb_enc_get_from_index(ENCINDEX_UTF_32LE);
- }
- return rb_ascii8bit_encoding();
- }
- return rb_enc_from_index(encidx);
-}
-
-static rb_encoding *
-get_encoding(VALUE str)
-{
- return get_actual_encoding(ENCODING_GET(str), str);
-}
-
-static void
-mustnot_broken(VALUE str)
-{
- if (is_broken_string(str)) {
- rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(STR_ENC_GET(str)));
- }
-}
-
-static void
-mustnot_wchar(VALUE str)
-{
- rb_encoding *enc = STR_ENC_GET(str);
- if (rb_enc_mbminlen(enc) > 1) {
- rb_raise(rb_eArgError, "wide char encoding: %s", rb_enc_name(enc));
- }
-}
+#define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str))
static int fstring_cmp(VALUE a, VALUE b);
-static VALUE register_fstring(VALUE str);
-
-st_table *rb_vm_fstring_table(void);
+static st_table* frozen_strings;
-const struct st_hash_type rb_fstring_hash_type = {
+static const struct st_hash_type fstring_hash_type = {
fstring_cmp,
rb_str_hash,
};
-#define BARE_STRING_P(str) (!FL_ANY_RAW(str, FL_TAINT|FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString)
-
-static int
-fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+VALUE
+rb_fstring(VALUE str)
{
- VALUE *fstr = (VALUE *)arg;
- VALUE str = (VALUE)*key;
-
- if (existing) {
- /* because of lazy sweep, str may be unmarked already and swept
+ st_data_t fstr;
+ if (st_lookup(frozen_strings, (st_data_t)str, &fstr)) {
+ str = (VALUE)fstr;
+ /* because of lazy sweep, str may be unmaked already and swept
* at next time */
-
- if (rb_objspace_garbage_object_p(str)) {
- *fstr = Qundef;
- return ST_DELETE;
- }
-
- *fstr = str;
- return ST_STOP;
+ rb_gc_resurrect(str);
}
else {
- if (FL_TEST_RAW(str, STR_FAKESTR)) {
- str = str_new_static(rb_cString, RSTRING(str)->as.heap.ptr,
- RSTRING(str)->as.heap.len,
- ENCODING_GET(str));
- OBJ_FREEZE_RAW(str);
- }
- else {
- str = str_new_frozen(rb_cString, str);
- if (STR_SHARED_P(str)) { /* str should not be shared */
- /* shared substring */
- str_make_independent(str);
- assert(OBJ_FROZEN(str));
- }
- if (!BARE_STRING_P(str)) {
- str = str_new_frozen(rb_cString, str);
- }
- }
+ str = rb_str_new_frozen(str);
RBASIC(str)->flags |= RSTRING_FSTR;
-
- *key = *value = *fstr = str;
- return ST_CONTINUE;
- }
-}
-
-RUBY_FUNC_EXPORTED
-VALUE
-rb_fstring(VALUE str)
-{
- VALUE fstr;
- int bare;
-
- Check_Type(str, T_STRING);
-
- if (FL_TEST(str, RSTRING_FSTR))
- return str;
-
- bare = BARE_STRING_P(str);
- if (STR_EMBED_P(str) && !bare) {
- OBJ_FREEZE_RAW(str);
- return str;
+ st_insert(frozen_strings, str, str);
}
-
- fstr = register_fstring(str);
-
- if (!bare) {
- str_replace_shared_without_enc(str, fstr);
- OBJ_FREEZE_RAW(str);
- return str;
- }
- return fstr;
-}
-
-static VALUE
-register_fstring(VALUE str)
-{
- VALUE ret;
- st_table *frozen_strings = rb_vm_fstring_table();
-
- do {
- ret = str;
- st_update(frozen_strings, (st_data_t)str,
- fstr_update_callback, (st_data_t)&ret);
- } while (ret == Qundef);
-
- assert(OBJ_FROZEN(ret));
- assert(!FL_TEST_RAW(ret, STR_FAKESTR));
- assert(!FL_TEST_RAW(ret, FL_EXIVAR));
- assert(!FL_TEST_RAW(ret, FL_TAINT));
- assert(RBASIC_CLASS(ret) == rb_cString);
- return ret;
-}
-
-static VALUE
-setup_fake_str(struct RString *fake_str, const char *name, long len, int encidx)
-{
- fake_str->basic.flags = T_STRING|RSTRING_NOEMBED|STR_NOFREE|STR_FAKESTR;
- /* SHARED to be allocated by the callback */
-
- ENCODING_SET_INLINED((VALUE)fake_str, encidx);
-
- RBASIC_SET_CLASS_RAW((VALUE)fake_str, rb_cString);
- fake_str->as.heap.len = len;
- fake_str->as.heap.ptr = (char *)name;
- fake_str->as.heap.aux.capa = len;
- return (VALUE)fake_str;
-}
-
-VALUE
-rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc)
-{
- return setup_fake_str(fake_str, name, len, rb_enc_to_index(enc));
-}
-
-VALUE
-rb_fstring_new(const char *ptr, long len)
-{
- struct RString fake_str;
- return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII));
-}
-
-VALUE
-rb_fstring_cstr(const char *ptr)
-{
- return rb_fstring_new(ptr, strlen(ptr));
-}
-
-static int
-fstring_set_class_i(st_data_t key, st_data_t val, st_data_t arg)
-{
- RBASIC_SET_CLASS((VALUE)key, (VALUE)arg);
- return ST_CONTINUE;
+ return str;
}
static int
fstring_cmp(VALUE a, VALUE b)
{
- long alen, blen;
- const char *aptr, *bptr;
- RSTRING_GETMEM(a, aptr, alen);
- RSTRING_GETMEM(b, bptr, blen);
- return (alen != blen ||
- ENCODING_GET(a) != ENCODING_GET(b) ||
- memcmp(aptr, bptr, alen) != 0);
+ int cmp = rb_str_hash_cmp(a, b);
+ if (cmp != 0) {
+ return cmp;
+ }
+ return ENCODING_GET(b) - ENCODING_GET(a);
}
static inline int
@@ -404,22 +183,22 @@ VALUE rb_fs;
static inline const char *
search_nonascii(const char *p, const char *e)
{
-#if SIZEOF_VOIDP == 8
+#if SIZEOF_VALUE == 8
# define NONASCII_MASK 0x8080808080808080ULL
-#elif SIZEOF_VOIDP == 4
+#elif SIZEOF_VALUE == 4
# define NONASCII_MASK 0x80808080UL
#endif
#ifdef NONASCII_MASK
- if ((int)SIZEOF_VOIDP * 2 < e - p) {
- const uintptr_t *s, *t;
- const uintptr_t lowbits = SIZEOF_VOIDP - 1;
- s = (const uintptr_t*)(~lowbits & ((uintptr_t)p + lowbits));
+ if ((int)sizeof(VALUE) * 2 < e - p) {
+ const VALUE *s, *t;
+ const VALUE lowbits = sizeof(VALUE) - 1;
+ s = (const VALUE*)(~lowbits & ((VALUE)p + lowbits));
while (p < (const char *)s) {
if (!ISASCII(*p))
return p;
p++;
}
- t = (const uintptr_t*)(~lowbits & (uintptr_t)e);
+ t = (const VALUE*)(~lowbits & (VALUE)e);
while (s < t) {
if (*s & NONASCII_MASK) {
t = s;
@@ -443,7 +222,7 @@ coderange_scan(const char *p, long len, rb_encoding *enc)
{
const char *e = p + len;
- if (rb_enc_to_index(enc) == rb_ascii8bit_encindex()) {
+ if (rb_enc_to_index(enc) == 0) {
/* enc is ASCII-8BIT. ASCII-8BIT string never be broken. */
p = search_nonascii(p, e);
return p ? ENC_CODERANGE_VALID : ENC_CODERANGE_7BIT;
@@ -451,22 +230,38 @@ coderange_scan(const char *p, long len, rb_encoding *enc)
if (rb_enc_asciicompat(enc)) {
p = search_nonascii(p, e);
- if (!p) return ENC_CODERANGE_7BIT;
- for (;;) {
- int ret = rb_enc_precise_mbclen(p, e, enc);
- if (!MBCLEN_CHARFOUND_P(ret)) return ENC_CODERANGE_BROKEN;
- p += MBCLEN_CHARFOUND_LEN(ret);
- if (p == e) break;
- p = search_nonascii(p, e);
- if (!p) break;
+ if (!p) {
+ return ENC_CODERANGE_7BIT;
}
- }
- else {
while (p < e) {
int ret = rb_enc_precise_mbclen(p, e, enc);
- if (!MBCLEN_CHARFOUND_P(ret)) return ENC_CODERANGE_BROKEN;
+ if (!MBCLEN_CHARFOUND_P(ret)) {
+ return ENC_CODERANGE_BROKEN;
+ }
p += MBCLEN_CHARFOUND_LEN(ret);
+ if (p < e) {
+ p = search_nonascii(p, e);
+ if (!p) {
+ return ENC_CODERANGE_VALID;
+ }
+ }
+ }
+ if (e < p) {
+ return ENC_CODERANGE_BROKEN;
}
+ return ENC_CODERANGE_VALID;
+ }
+
+ while (p < e) {
+ int ret = rb_enc_precise_mbclen(p, e, enc);
+
+ if (!MBCLEN_CHARFOUND_P(ret)) {
+ return ENC_CODERANGE_BROKEN;
+ }
+ p += MBCLEN_CHARFOUND_LEN(ret);
+ }
+ if (e < p) {
+ return ENC_CODERANGE_BROKEN;
}
return ENC_CODERANGE_VALID;
}
@@ -479,11 +274,10 @@ rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc
if (*cr == ENC_CODERANGE_BROKEN)
return e - s;
- if (rb_enc_to_index(enc) == rb_ascii8bit_encindex()) {
+ if (rb_enc_to_index(enc) == 0) {
/* enc is ASCII-8BIT. ASCII-8BIT string never be broken. */
- if (*cr == ENC_CODERANGE_VALID) return e - s;
p = search_nonascii(p, e);
- *cr = p ? ENC_CODERANGE_VALID : ENC_CODERANGE_7BIT;
+ *cr = (!p && *cr != ENC_CODERANGE_VALID) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID;
return e - s;
}
else if (rb_enc_asciicompat(enc)) {
@@ -492,17 +286,23 @@ rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc
if (*cr != ENC_CODERANGE_VALID) *cr = ENC_CODERANGE_7BIT;
return e - s;
}
- for (;;) {
+ while (p < e) {
int ret = rb_enc_precise_mbclen(p, e, enc);
if (!MBCLEN_CHARFOUND_P(ret)) {
*cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_UNKNOWN;
return p - s;
}
p += MBCLEN_CHARFOUND_LEN(ret);
- if (p == e) break;
- p = search_nonascii(p, e);
- if (!p) break;
+ if (p < e) {
+ p = search_nonascii(p, e);
+ if (!p) {
+ *cr = ENC_CODERANGE_VALID;
+ return e - s;
+ }
+ }
}
+ *cr = e < p ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_VALID;
+ return p - s;
}
else {
while (p < e) {
@@ -513,9 +313,9 @@ rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc
}
p += MBCLEN_CHARFOUND_LEN(ret);
}
+ *cr = e < p ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_VALID;
+ return p - s;
}
- *cr = ENC_CODERANGE_VALID;
- return e - s;
}
static inline void
@@ -567,15 +367,8 @@ rb_enc_str_coderange(VALUE str)
int cr = ENC_CODERANGE(str);
if (cr == ENC_CODERANGE_UNKNOWN) {
- int encidx = ENCODING_GET(str);
- rb_encoding *enc = rb_enc_from_index(encidx);
- if (rb_enc_mbminlen(enc) > 1 && rb_enc_dummy_p(enc)) {
- cr = ENC_CODERANGE_BROKEN;
- }
- else {
- cr = coderange_scan(RSTRING_PTR(str), RSTRING_LEN(str),
- get_actual_encoding(encidx, str));
- }
+ rb_encoding *enc = STR_ENC_GET(str);
+ cr = coderange_scan(RSTRING_PTR(str), RSTRING_LEN(str), enc);
ENC_CODERANGE_SET(str, cr);
}
return cr;
@@ -601,13 +394,13 @@ str_mod_check(VALUE s, const char *p, long len)
}
}
-static size_t
-str_capacity(VALUE str, const int termlen)
+size_t
+rb_str_capacity(VALUE str)
{
if (STR_EMBED_P(str)) {
- return (RSTRING_EMBED_LEN_MAX + 1 - termlen);
+ return RSTRING_EMBED_LEN_MAX;
}
- else if (FL_TEST(str, STR_SHARED|STR_NOFREE)) {
+ else if (STR_NOCAPA_P(str)) {
return RSTRING(str)->as.heap.len;
}
else {
@@ -615,20 +408,6 @@ str_capacity(VALUE str, const int termlen)
}
}
-size_t
-rb_str_capacity(VALUE str)
-{
- return str_capacity(str, TERM_LEN(str));
-}
-
-static inline void
-must_not_null(const char *ptr)
-{
- if (!ptr) {
- rb_raise(rb_eArgError, "NULL pointer given");
- }
-}
-
static inline VALUE
str_alloc(VALUE klass)
{
@@ -639,7 +418,9 @@ str_alloc(VALUE klass)
static inline VALUE
empty_str_alloc(VALUE klass)
{
- RUBY_DTRACE_CREATE_HOOK(STRING, 0);
+ if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
+ RUBY_DTRACE_STRING_CREATE(0, rb_sourcefile(), rb_sourceline());
+ }
return str_alloc(klass);
}
@@ -652,10 +433,12 @@ str_new0(VALUE klass, const char *ptr, long len, int termlen)
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
- RUBY_DTRACE_CREATE_HOOK(STRING, len);
+ if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
+ RUBY_DTRACE_STRING_CREATE(len, rb_sourcefile(), rb_sourceline());
+ }
str = str_alloc(klass);
- if (len > (RSTRING_EMBED_LEN_MAX + 1 - termlen)) {
+ if (len > RSTRING_EMBED_LEN_MAX) {
RSTRING(str)->as.heap.aux.capa = len;
RSTRING(str)->as.heap.ptr = ALLOC_N(char, len + termlen);
STR_SET_NOEMBED(str);
@@ -692,14 +475,6 @@ rb_usascii_str_new(const char *ptr, long len)
}
VALUE
-rb_utf8_str_new(const char *ptr, long len)
-{
- VALUE str = str_new(rb_cString, ptr, len);
- rb_enc_associate_index(str, rb_utf8_encindex());
- return str;
-}
-
-VALUE
rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
{
VALUE str;
@@ -714,86 +489,32 @@ rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
VALUE
rb_str_new_cstr(const char *ptr)
{
- must_not_null(ptr);
+ if (!ptr) {
+ rb_raise(rb_eArgError, "NULL pointer given");
+ }
return rb_str_new(ptr, strlen(ptr));
}
VALUE
rb_usascii_str_new_cstr(const char *ptr)
{
- VALUE str = rb_str_new_cstr(ptr);
+ VALUE str = rb_str_new2(ptr);
ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
return str;
}
VALUE
-rb_utf8_str_new_cstr(const char *ptr)
-{
- VALUE str = rb_str_new_cstr(ptr);
- rb_enc_associate_index(str, rb_utf8_encindex());
- return str;
-}
-
-VALUE
rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc)
{
- must_not_null(ptr);
+ if (!ptr) {
+ rb_raise(rb_eArgError, "NULL pointer given");
+ }
if (rb_enc_mbminlen(enc) != 1) {
rb_raise(rb_eArgError, "wchar encoding given");
}
return rb_enc_str_new(ptr, strlen(ptr), enc);
}
-static VALUE
-str_new_static(VALUE klass, const char *ptr, long len, int encindex)
-{
- VALUE str;
-
- if (len < 0) {
- rb_raise(rb_eArgError, "negative string size (or size too big)");
- }
-
- if (!ptr) {
- rb_encoding *enc = rb_enc_get_from_index(encindex);
- str = str_new0(klass, ptr, len, rb_enc_mbminlen(enc));
- }
- else {
- RUBY_DTRACE_CREATE_HOOK(STRING, len);
- str = str_alloc(klass);
- RSTRING(str)->as.heap.len = len;
- RSTRING(str)->as.heap.ptr = (char *)ptr;
- RSTRING(str)->as.heap.aux.capa = len;
- STR_SET_NOEMBED(str);
- RBASIC(str)->flags |= STR_NOFREE;
- }
- rb_enc_associate_index(str, encindex);
- return str;
-}
-
-VALUE
-rb_str_new_static(const char *ptr, long len)
-{
- return str_new_static(rb_cString, ptr, len, 0);
-}
-
-VALUE
-rb_usascii_str_new_static(const char *ptr, long len)
-{
- return str_new_static(rb_cString, ptr, len, ENCINDEX_US_ASCII);
-}
-
-VALUE
-rb_utf8_str_new_static(const char *ptr, long len)
-{
- return str_new_static(rb_cString, ptr, len, ENCINDEX_UTF_8);
-}
-
-VALUE
-rb_enc_str_new_static(const char *ptr, long len, rb_encoding *enc)
-{
- return str_new_static(rb_cString, ptr, len, rb_enc_to_index(enc));
-}
-
VALUE
rb_tainted_str_new(const char *ptr, long len)
{
@@ -803,34 +524,27 @@ rb_tainted_str_new(const char *ptr, long len)
return str;
}
-static VALUE
-rb_tainted_str_new_with_enc(const char *ptr, long len, rb_encoding *enc)
-{
- VALUE str = rb_enc_str_new(ptr, len, enc);
-
- OBJ_TAINT(str);
- return str;
-}
-
VALUE
rb_tainted_str_new_cstr(const char *ptr)
{
- VALUE str = rb_str_new_cstr(ptr);
+ VALUE str = rb_str_new2(ptr);
OBJ_TAINT(str);
return str;
}
-static VALUE str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
- rb_encoding *from, rb_encoding *to,
- int ecflags, VALUE ecopts);
-
VALUE
rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
{
- long len;
- const char *ptr;
+ extern VALUE rb_cEncodingConverter;
+ rb_econv_t *ec;
+ rb_econv_result_t ret;
+ long len, olen;
+ VALUE econv_wrapper;
VALUE newstr;
+ const unsigned char *start, *sp;
+ unsigned char *dest, *dp;
+ size_t converted_output = 0;
if (!to) return str;
if (!from) from = rb_enc_get(str);
@@ -844,60 +558,18 @@ rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags,
return str;
}
- RSTRING_GETMEM(str, ptr, len);
- newstr = str_cat_conv_enc_opts(rb_str_buf_new(len), 0, ptr, len,
- from, to, ecflags, ecopts);
- if (NIL_P(newstr)) {
- /* some error, return original */
- return str;
- }
+ len = RSTRING_LEN(str);
+ newstr = rb_str_new(0, len);
OBJ_INFECT(newstr, str);
- return newstr;
-}
-
-VALUE
-rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
- rb_encoding *from, int ecflags, VALUE ecopts)
-{
- long olen;
-
- olen = RSTRING_LEN(newstr);
- if (ofs < -olen || olen <= ofs)
- rb_raise(rb_eIndexError, "index %ld out of string", ofs);
- if (ofs < 0) ofs += olen;
- if (!from) {
- STR_SET_LEN(newstr, ofs);
- return rb_str_cat(newstr, ptr, len);
- }
-
- rb_str_modify(newstr);
- return str_cat_conv_enc_opts(newstr, ofs, ptr, len, from,
- rb_enc_get(newstr),
- ecflags, ecopts);
-}
-
-static VALUE
-str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
- rb_encoding *from, rb_encoding *to,
- int ecflags, VALUE ecopts)
-{
- rb_econv_t *ec;
- rb_econv_result_t ret;
- long olen;
- VALUE econv_wrapper;
- const unsigned char *start, *sp;
- unsigned char *dest, *dp;
- size_t converted_output = (size_t)ofs;
-
- olen = rb_str_capacity(newstr);
+ olen = len;
econv_wrapper = rb_obj_alloc(rb_cEncodingConverter);
RBASIC_CLEAR_CLASS(econv_wrapper);
ec = rb_econv_open_opts(from->name, to->name, ecflags, ecopts);
- if (!ec) return Qnil;
+ if (!ec) return str;
DATA_PTR(econv_wrapper) = ec;
- sp = (unsigned char*)ptr;
+ sp = (unsigned char*)RSTRING_PTR(str);
start = sp;
while ((dest = (unsigned char*)RSTRING_PTR(newstr)),
(dp = dest + converted_output),
@@ -929,7 +601,8 @@ str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
return newstr;
default:
- return Qnil;
+ /* some error, return original */
+ return str;
}
}
@@ -944,7 +617,7 @@ rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *eenc)
{
VALUE str;
- str = rb_tainted_str_new_with_enc(ptr, len, eenc);
+ str = rb_tainted_str_new(ptr, len);
return rb_external_str_with_enc(str, eenc);
}
@@ -1017,24 +690,16 @@ rb_str_export_to_enc(VALUE str, rb_encoding *enc)
static VALUE
str_replace_shared_without_enc(VALUE str2, VALUE str)
{
- const int termlen = TERM_LEN(str);
- char *ptr;
- long len;
-
- RSTRING_GETMEM(str, ptr, len);
- if (len+termlen <= RSTRING_EMBED_LEN_MAX+1) {
- char *ptr2 = RSTRING(str2)->as.ary;
+ if (RSTRING_LEN(str) <= RSTRING_EMBED_LEN_MAX) {
STR_SET_EMBED(str2);
- memcpy(ptr2, RSTRING_PTR(str), len);
- STR_SET_EMBED_LEN(str2, len);
- TERM_FILL(ptr2+len, termlen);
+ memcpy(RSTRING_PTR(str2), RSTRING_PTR(str), RSTRING_LEN(str)+1);
+ STR_SET_EMBED_LEN(str2, RSTRING_LEN(str));
}
else {
str = rb_str_new_frozen(str);
FL_SET(str2, STR_NOEMBED);
- RSTRING_GETMEM(str, ptr, len);
- RSTRING(str2)->as.heap.len = len;
- RSTRING(str2)->as.heap.ptr = ptr;
+ RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
+ RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);
STR_SET_SHARED(str2, str);
}
return str2;
@@ -1054,75 +719,80 @@ str_new_shared(VALUE klass, VALUE str)
return str_replace_shared(str_alloc(klass), str);
}
+static VALUE
+str_new3(VALUE klass, VALUE str)
+{
+ return str_new_shared(klass, str);
+}
+
VALUE
rb_str_new_shared(VALUE str)
{
- VALUE str2 = str_new_shared(rb_obj_class(str), str);
+ VALUE str2 = str_new3(rb_obj_class(str), str);
OBJ_INFECT(str2, str);
return str2;
}
-VALUE
-rb_str_new_frozen(VALUE orig)
+static VALUE
+str_new4(VALUE klass, VALUE str)
{
- VALUE str;
-
- if (OBJ_FROZEN(orig)) return orig;
+ VALUE str2;
- str = str_new_frozen(rb_obj_class(orig), orig);
- OBJ_INFECT(str, orig);
- return str;
+ str2 = str_alloc(klass);
+ STR_SET_NOEMBED(str2);
+ RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
+ RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);
+ if (STR_SHARED_P(str)) {
+ VALUE shared = RSTRING(str)->as.heap.aux.shared;
+ assert(OBJ_FROZEN(shared));
+ STR_SET_SHARED(str2, shared); /* TODO: WB is not needed because str2 is *new* object */
+ }
+ else {
+ STR_SET_SHARED(str, str2);
+ }
+ rb_enc_cr_str_exact_copy(str2, str);
+ OBJ_INFECT(str2, str);
+ return str2;
}
-static VALUE
-str_new_frozen(VALUE klass, VALUE orig)
+VALUE
+rb_str_new_frozen(VALUE orig)
{
- VALUE str;
+ VALUE klass, str;
- if (STR_EMBED_P(orig)) {
+ if (OBJ_FROZEN(orig)) return orig;
+ klass = rb_obj_class(orig);
+ if (STR_SHARED_P(orig) && (str = RSTRING(orig)->as.heap.aux.shared)) {
+ long ofs;
+ assert(OBJ_FROZEN(str));
+ ofs = RSTRING_LEN(str) - RSTRING_LEN(orig);
+ if ((ofs > 0) || (klass != RBASIC(str)->klass) ||
+ ((RBASIC(str)->flags ^ RBASIC(orig)->flags) & FL_TAINT) ||
+ ENCODING_GET(str) != ENCODING_GET(orig)) {
+ str = str_new3(klass, str);
+ RSTRING(str)->as.heap.ptr += ofs;
+ RSTRING(str)->as.heap.len -= ofs;
+ rb_enc_cr_str_exact_copy(str, orig);
+ OBJ_INFECT(str, orig);
+ }
+ }
+ else if (STR_EMBED_P(orig)) {
str = str_new(klass, RSTRING_PTR(orig), RSTRING_LEN(orig));
+ rb_enc_cr_str_exact_copy(str, orig);
+ OBJ_INFECT(str, orig);
+ }
+ else if (STR_ASSOC_P(orig)) {
+ VALUE assoc = RSTRING(orig)->as.heap.aux.shared;
+ FL_UNSET(orig, STR_ASSOC);
+ str = str_new4(klass, orig);
+ FL_SET(str, STR_ASSOC);
+ OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, assoc);
+ /* TODO: WB is not needed because str is new object */
}
else {
- if (FL_TEST_RAW(orig, STR_SHARED)) {
- VALUE shared = RSTRING(orig)->as.heap.aux.shared;
- long ofs = RSTRING(orig)->as.heap.ptr - RSTRING(shared)->as.heap.ptr;
- long rest = RSTRING(shared)->as.heap.len - ofs - RSTRING(orig)->as.heap.len;
- assert(!STR_EMBED_P(shared));
- assert(OBJ_FROZEN(shared));
-
- if ((ofs > 0) || (rest > 0) ||
- (klass != RBASIC(shared)->klass) ||
- ((RBASIC(shared)->flags ^ RBASIC(orig)->flags) & FL_TAINT) ||
- ENCODING_GET(shared) != ENCODING_GET(orig)) {
- str = str_new_shared(klass, shared);
- RSTRING(str)->as.heap.ptr += ofs;
- RSTRING(str)->as.heap.len -= ofs + rest;
- }
- else {
- return shared;
- }
- }
- else if (RSTRING_LEN(orig)+TERM_LEN(orig) <= RSTRING_EMBED_LEN_MAX+1) {
- str = str_alloc(klass);
- STR_SET_EMBED(str);
- memcpy(RSTRING_PTR(str), RSTRING_PTR(orig), RSTRING_LEN(orig));
- STR_SET_EMBED_LEN(str, RSTRING_LEN(orig));
- TERM_FILL(RSTRING_END(str), TERM_LEN(orig));
- }
- else {
- str = str_alloc(klass);
- STR_SET_NOEMBED(str);
- RSTRING(str)->as.heap.len = RSTRING_LEN(orig);
- RSTRING(str)->as.heap.ptr = RSTRING_PTR(orig);
- RSTRING(str)->as.heap.aux.capa = RSTRING(orig)->as.heap.aux.capa;
- RBASIC(str)->flags |= RBASIC(orig)->flags & STR_NOFREE;
- RBASIC(orig)->flags &= ~STR_NOFREE;
- STR_SET_SHARED(orig, str);
- }
+ str = str_new4(klass, orig);
}
-
- rb_enc_cr_str_exact_copy(str, orig);
OBJ_FREEZE(str);
return str;
}
@@ -1130,13 +800,13 @@ str_new_frozen(VALUE klass, VALUE orig)
VALUE
rb_str_new_with_class(VALUE obj, const char *ptr, long len)
{
- return str_new0(rb_obj_class(obj), ptr, len, TERM_LEN(obj));
+ return str_new(rb_obj_class(obj), ptr, len);
}
static VALUE
str_new_empty(VALUE str)
{
- VALUE v = rb_str_new_with_class(str, 0, 0);
+ VALUE v = rb_str_new5(str, 0, 0);
rb_enc_copy(v, str);
OBJ_INFECT(v, str);
return v;
@@ -1178,15 +848,30 @@ rb_str_tmp_new(long len)
return str_new(0, 0, len);
}
+void *
+rb_alloc_tmp_buffer(volatile VALUE *store, long len)
+{
+ VALUE s = rb_str_tmp_new(len);
+ *store = s;
+ return RSTRING_PTR(s);
+}
+
+void
+rb_free_tmp_buffer(volatile VALUE *store)
+{
+ VALUE s = *store;
+ *store = 0;
+ if (s) rb_str_clear(s);
+}
+
void
rb_str_free(VALUE str)
{
if (FL_TEST(str, RSTRING_FSTR)) {
st_data_t fstr = (st_data_t)str;
- st_delete(rb_vm_fstring_table(), &fstr, NULL);
+ st_delete(frozen_strings, &fstr, NULL);
}
-
- if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED|STR_NOFREE)) {
+ if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
}
@@ -1194,7 +879,7 @@ rb_str_free(VALUE str)
RUBY_FUNC_EXPORTED size_t
rb_str_memsize(VALUE str)
{
- if (FL_TEST(str, STR_NOEMBED|STR_SHARED|STR_NOFREE) == STR_NOEMBED) {
+ if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
return STR_HEAP_SIZE(str);
}
else {
@@ -1209,58 +894,46 @@ rb_str_to_str(VALUE str)
}
static inline void str_discard(VALUE str);
-static void str_shared_replace(VALUE str, VALUE str2);
void
rb_str_shared_replace(VALUE str, VALUE str2)
{
- if (str != str2) str_shared_replace(str, str2);
-}
-
-static void
-str_shared_replace(VALUE str, VALUE str2)
-{
rb_encoding *enc;
int cr;
- int termlen;
-
- ASSUME(str2 != str);
+ if (str == str2) return;
enc = STR_ENC_GET(str2);
cr = ENC_CODERANGE(str2);
str_discard(str);
OBJ_INFECT(str, str2);
- termlen = rb_enc_mbminlen(enc);
-
- if (RSTRING_LEN(str2) <= (RSTRING_EMBED_LEN_MAX + 1 - termlen)) {
+ if (RSTRING_LEN(str2) <= RSTRING_EMBED_LEN_MAX) {
STR_SET_EMBED(str);
- memcpy(RSTRING_PTR(str), RSTRING_PTR(str2), RSTRING_LEN(str2)+termlen);
+ memcpy(RSTRING_PTR(str), RSTRING_PTR(str2), RSTRING_LEN(str2)+1);
STR_SET_EMBED_LEN(str, RSTRING_LEN(str2));
rb_enc_associate(str, enc);
ENC_CODERANGE_SET(str, cr);
+ return;
+ }
+ STR_SET_NOEMBED(str);
+ STR_UNSET_NOCAPA(str);
+ RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
+ RSTRING(str)->as.heap.len = RSTRING_LEN(str2);
+ if (STR_NOCAPA_P(str2)) {
+ VALUE shared = RSTRING(str2)->as.heap.aux.shared;
+ FL_SET(str, RBASIC(str2)->flags & STR_NOCAPA);
+ OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, shared);
}
else {
- STR_SET_NOEMBED(str);
- FL_UNSET(str, STR_SHARED);
- RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
- RSTRING(str)->as.heap.len = RSTRING_LEN(str2);
-
- if (FL_TEST(str2, STR_SHARED)) {
- VALUE shared = RSTRING(str2)->as.heap.aux.shared;
- STR_SET_SHARED(str, shared);
- }
- else {
- RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa;
- }
-
- /* abandon str2 */
- STR_SET_EMBED(str2);
- RSTRING_PTR(str2)[0] = 0;
- STR_SET_EMBED_LEN(str2, 0);
- rb_enc_associate(str, enc);
- ENC_CODERANGE_SET(str, cr);
+ RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa;
}
+ STR_SET_EMBED(str2); /* abandon str2 */
+ RSTRING_PTR(str2)[0] = 0;
+ STR_SET_EMBED_LEN(str2, 0);
+ rb_enc_associate(str, enc);
+ ENC_CODERANGE_SET(str, cr);
}
+static ID id_to_s;
+
VALUE
rb_obj_as_string(VALUE obj)
{
@@ -1269,12 +942,10 @@ rb_obj_as_string(VALUE obj)
if (RB_TYPE_P(obj, T_STRING)) {
return obj;
}
- str = rb_funcall(obj, idTo_s, 0);
+ str = rb_funcall(obj, id_to_s, 0);
if (!RB_TYPE_P(str, T_STRING))
return rb_any_to_s(obj);
- if (!FL_TEST_RAW(str, RSTRING_FSTR) && FL_ABLE(obj))
- /* fstring must not be tainted, at least */
- OBJ_INFECT_RAW(str, obj);
+ if (OBJ_TAINTED(obj)) OBJ_TAINT(str);
return str;
}
@@ -1284,52 +955,33 @@ str_replace(VALUE str, VALUE str2)
long len;
len = RSTRING_LEN(str2);
+ if (STR_ASSOC_P(str2)) {
+ str2 = rb_str_new4(str2);
+ }
if (STR_SHARED_P(str2)) {
VALUE shared = RSTRING(str2)->as.heap.aux.shared;
assert(OBJ_FROZEN(shared));
STR_SET_NOEMBED(str);
RSTRING(str)->as.heap.len = len;
RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
+ FL_SET(str, ELTS_SHARED);
+ FL_UNSET(str, STR_ASSOC);
STR_SET_SHARED(str, shared);
- rb_enc_cr_str_exact_copy(str, str2);
}
else {
str_replace_shared(str, str2);
}
OBJ_INFECT(str, str2);
+ rb_enc_cr_str_exact_copy(str, str2);
return str;
}
-static inline VALUE
+static VALUE
str_duplicate(VALUE klass, VALUE str)
{
- enum {embed_size = RSTRING_EMBED_LEN_MAX + 1};
- const VALUE flag_mask =
- RSTRING_NOEMBED | RSTRING_EMBED_LEN_MASK |
- ENC_CODERANGE_MASK | ENCODING_MASK |
- FL_TAINT | FL_FREEZE
- ;
- VALUE flags = FL_TEST_RAW(str, flag_mask);
VALUE dup = str_alloc(klass);
- MEMCPY(RSTRING(dup)->as.ary, RSTRING(str)->as.ary,
- char, embed_size);
- if (flags & STR_NOEMBED) {
- if (UNLIKELY(!(flags & FL_FREEZE))) {
- str = str_new_frozen(klass, str);
- FL_SET_RAW(str, flags & FL_TAINT);
- flags = FL_TEST_RAW(str, flag_mask);
- }
- if (flags & STR_NOEMBED) {
- RB_OBJ_WRITE(dup, &RSTRING(dup)->as.heap.aux.shared, str);
- flags |= STR_SHARED;
- }
- else {
- MEMCPY(RSTRING(dup)->as.ary, RSTRING(str)->as.ary,
- char, embed_size);
- }
- }
- FL_SET_RAW(dup, flags & ~FL_FREEZE);
+ str_replace(dup, str);
return dup;
}
@@ -1342,80 +994,30 @@ rb_str_dup(VALUE str)
VALUE
rb_str_resurrect(VALUE str)
{
- RUBY_DTRACE_CREATE_HOOK(STRING, RSTRING_LEN(str));
+ if (RUBY_DTRACE_STRING_CREATE_ENABLED()) {
+ RUBY_DTRACE_STRING_CREATE(RSTRING_LEN(str),
+ rb_sourcefile(), rb_sourceline());
+ }
return str_duplicate(rb_cString, str);
}
/*
* call-seq:
* String.new(str="") -> new_str
- * String.new(str="", encoding: enc) -> new_str
*
* Returns a new string object containing a copy of <i>str</i>.
- * The optional <i>enc</i> argument specifies the encoding of the new string.
- * If not specified, the encoding of <i>str</i> (or ASCII-8BIT, if <i>str</i>
- * is not specified) is used.
*/
static VALUE
rb_str_init(int argc, VALUE *argv, VALUE str)
{
- static ID keyword_ids[1];
- VALUE orig, opt, enc;
- int n;
-
- if (!keyword_ids[0])
- keyword_ids[0] = rb_id_encoding();
+ VALUE orig;
- n = rb_scan_args(argc, argv, "01:", &orig, &opt);
- if (argc > 0 && n == 1)
+ if (argc > 0 && rb_scan_args(argc, argv, "01", &orig) == 1)
rb_str_replace(str, orig);
- if (!NIL_P(opt)) {
- rb_get_kwargs(opt, keyword_ids, 0, 1, &enc);
- if (enc != Qundef && !NIL_P(enc)) {
- rb_enc_associate(str, rb_to_encoding(enc));
- ENC_CODERANGE_CLEAR(str);
- }
- }
return str;
}
-#ifdef NONASCII_MASK
-#define is_utf8_lead_byte(c) (((c)&0xC0) != 0x80)
-
-/*
- * UTF-8 leading bytes have either 0xxxxxxx or 11xxxxxx
- * bit representation. (see http://en.wikipedia.org/wiki/UTF-8)
- * Therefore, the following pseudocode can detect UTF-8 leading bytes.
- *
- * if (!(byte & 0x80))
- * byte |= 0x40; // turn on bit6
- * return ((byte>>6) & 1); // bit6 represent whether this byte is leading or not.
- *
- * This function calculates whether a byte is leading or not for all bytes
- * in the argument word by concurrently using the above logic, and then
- * adds up the number of leading bytes in the word.
- */
-static inline uintptr_t
-count_utf8_lead_bytes_with_word(const uintptr_t *s)
-{
- uintptr_t d = *s;
-
- /* Transform so that bit0 indicates whether we have a UTF-8 leading byte or not. */
- d |= ~(d>>1);
- d >>= 6;
- d &= NONASCII_MASK >> 7;
-
- /* Gather all bytes. */
- d += (d>>8);
- d += (d>>16);
-#if SIZEOF_VOIDP == 8
- d += (d>>32);
-#endif
- return (d&0xF);
-}
-#endif
-
static inline long
enc_strlen(const char *p, const char *e, rb_encoding *enc, int cr)
{
@@ -1425,34 +1027,9 @@ enc_strlen(const char *p, const char *e, rb_encoding *enc, int cr)
if (rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) {
return (e - p + rb_enc_mbminlen(enc) - 1) / rb_enc_mbminlen(enc);
}
-#ifdef NONASCII_MASK
- else if (cr == ENC_CODERANGE_VALID && enc == rb_utf8_encoding()) {
- uintptr_t len = 0;
- if ((int)sizeof(uintptr_t) * 2 < e - p) {
- const uintptr_t *s, *t;
- const uintptr_t lowbits = sizeof(uintptr_t) - 1;
- s = (const uintptr_t*)(~lowbits & ((uintptr_t)p + lowbits));
- t = (const uintptr_t*)(~lowbits & (uintptr_t)e);
- while (p < (const char *)s) {
- if (is_utf8_lead_byte(*p)) len++;
- p++;
- }
- while (s < t) {
- len += count_utf8_lead_bytes_with_word(s);
- s++;
- }
- p = (const char *)s;
- }
- while (p < e) {
- if (is_utf8_lead_byte(*p)) len++;
- p++;
- }
- return (long)len;
- }
-#endif
else if (rb_enc_asciicompat(enc)) {
c = 0;
- if (ENC_CODERANGE_CLEAN_P(cr)) {
+ if (cr == ENC_CODERANGE_7BIT || cr == ENC_CODERANGE_VALID) {
while (p < e) {
if (ISASCII(*p)) {
q = search_nonascii(p, e);
@@ -1493,9 +1070,6 @@ rb_enc_strlen(const char *p, const char *e, rb_encoding *enc)
return enc_strlen(p, e, enc, ENC_CODERANGE_UNKNOWN);
}
-/* To get strlen with cr
- * Note that given cr is not used.
- */
long
rb_enc_strlen_cr(const char *p, const char *e, rb_encoding *enc, int *cr)
{
@@ -1552,11 +1126,46 @@ rb_enc_strlen_cr(const char *p, const char *e, rb_encoding *enc, int *cr)
return c;
}
-/* enc must be str's enc or rb_enc_check(str, str2) */
+#ifdef NONASCII_MASK
+#define is_utf8_lead_byte(c) (((c)&0xC0) != 0x80)
+
+/*
+ * UTF-8 leading bytes have either 0xxxxxxx or 11xxxxxx
+ * bit representation. (see http://en.wikipedia.org/wiki/UTF-8)
+ * Therefore, following pseudo code can detect UTF-8 leading byte.
+ *
+ * if (!(byte & 0x80))
+ * byte |= 0x40; // turn on bit6
+ * return ((byte>>6) & 1); // bit6 represent it's leading byte or not.
+ *
+ * This function calculate every bytes in the argument word `s'
+ * using the above logic concurrently. and gather every bytes result.
+ */
+static inline VALUE
+count_utf8_lead_bytes_with_word(const VALUE *s)
+{
+ VALUE d = *s;
+
+ /* Transform into bit0 represent UTF-8 leading or not. */
+ d |= ~(d>>1);
+ d >>= 6;
+ d &= NONASCII_MASK >> 7;
+
+ /* Gather every bytes. */
+ d += (d>>8);
+ d += (d>>16);
+#if SIZEOF_VALUE == 8
+ d += (d>>32);
+#endif
+ return (d&0xF);
+}
+#endif
+
static long
str_strlen(VALUE str, rb_encoding *enc)
{
const char *p, *e;
+ long n;
int cr;
if (single_byte_optimizable(str)) return RSTRING_LEN(str);
@@ -1564,21 +1173,44 @@ str_strlen(VALUE str, rb_encoding *enc)
p = RSTRING_PTR(str);
e = RSTRING_END(str);
cr = ENC_CODERANGE(str);
+#ifdef NONASCII_MASK
+ if (ENC_CODERANGE(str) == ENC_CODERANGE_VALID &&
+ enc == rb_utf8_encoding()) {
- if (cr == ENC_CODERANGE_UNKNOWN) {
- long n = rb_enc_strlen_cr(p, e, enc, &cr);
- if (cr) ENC_CODERANGE_SET(str, cr);
- return n;
+ VALUE len = 0;
+ if ((int)sizeof(VALUE) * 2 < e - p) {
+ const VALUE *s, *t;
+ const VALUE lowbits = sizeof(VALUE) - 1;
+ s = (const VALUE*)(~lowbits & ((VALUE)p + lowbits));
+ t = (const VALUE*)(~lowbits & (VALUE)e);
+ while (p < (const char *)s) {
+ if (is_utf8_lead_byte(*p)) len++;
+ p++;
+ }
+ while (s < t) {
+ len += count_utf8_lead_bytes_with_word(s);
+ s++;
+ }
+ p = (const char *)s;
+ }
+ while (p < e) {
+ if (is_utf8_lead_byte(*p)) len++;
+ p++;
+ }
+ return (long)len;
}
- else {
- return enc_strlen(p, e, enc, cr);
+#endif
+ n = rb_enc_strlen_cr(p, e, enc, &cr);
+ if (cr) {
+ ENC_CODERANGE_SET(str, cr);
}
+ return n;
}
long
rb_str_strlen(VALUE str)
{
- return str_strlen(str, NULL);
+ return str_strlen(str, STR_ENC_GET(str));
}
/*
@@ -1592,7 +1224,10 @@ rb_str_strlen(VALUE str)
VALUE
rb_str_length(VALUE str)
{
- return LONG2NUM(str_strlen(str, NULL));
+ long len;
+
+ len = str_strlen(str, STR_ENC_GET(str));
+ return LONG2NUM(len);
}
/*
@@ -1645,26 +1280,19 @@ rb_str_plus(VALUE str1, VALUE str2)
{
VALUE str3;
rb_encoding *enc;
- char *ptr1, *ptr2, *ptr3;
- long len1, len2;
- int termlen;
StringValue(str2);
- enc = rb_enc_check_str(str1, str2);
- RSTRING_GETMEM(str1, ptr1, len1);
- RSTRING_GETMEM(str2, ptr2, len2);
- termlen = rb_enc_mbminlen(enc);
- str3 = str_new0(rb_cString, 0, len1+len2, termlen);
- ptr3 = RSTRING_PTR(str3);
- memcpy(ptr3, ptr1, len1);
- memcpy(ptr3+len1, ptr2, len2);
- TERM_FILL(&ptr3[len1+len2], termlen);
-
- FL_SET_RAW(str3, OBJ_TAINTED_RAW(str1) | OBJ_TAINTED_RAW(str2));
+ enc = rb_enc_check(str1, str2);
+ str3 = rb_str_new(0, RSTRING_LEN(str1)+RSTRING_LEN(str2));
+ memcpy(RSTRING_PTR(str3), RSTRING_PTR(str1), RSTRING_LEN(str1));
+ memcpy(RSTRING_PTR(str3) + RSTRING_LEN(str1),
+ RSTRING_PTR(str2), RSTRING_LEN(str2));
+ RSTRING_PTR(str3)[RSTRING_LEN(str3)] = '\0';
+
+ if (OBJ_TAINTED(str1) || OBJ_TAINTED(str2))
+ OBJ_TAINT(str3);
ENCODING_CODERANGE_SET(str3, rb_enc_to_index(enc),
ENC_CODERANGE_AND(ENC_CODERANGE(str1), ENC_CODERANGE(str2)));
- RB_GC_GUARD(str1);
- RB_GC_GUARD(str2);
return str3;
}
@@ -1685,17 +1313,7 @@ rb_str_times(VALUE str, VALUE times)
VALUE str2;
long n, len;
char *ptr2;
- int termlen;
- if (times == INT2FIX(1)) {
- return rb_str_dup(str);
- }
- if (times == INT2FIX(0)) {
- str2 = str_alloc(rb_obj_class(str));
- rb_enc_copy(str2, str);
- OBJ_INFECT(str2, str);
- return str2;
- }
len = NUM2LONG(times);
if (len < 0) {
rb_raise(rb_eArgError, "negative argument");
@@ -1704,9 +1322,7 @@ rb_str_times(VALUE str, VALUE times)
rb_raise(rb_eArgError, "argument too big");
}
- len *= RSTRING_LEN(str);
- termlen = TERM_LEN(str);
- str2 = str_new0(rb_obj_class(str), 0, len, termlen);
+ str2 = rb_str_new5(str, 0, len *= RSTRING_LEN(str));
ptr2 = RSTRING_PTR(str2);
if (len) {
n = RSTRING_LEN(str);
@@ -1717,8 +1333,7 @@ rb_str_times(VALUE str, VALUE times)
}
memcpy(ptr2 + n, ptr2, len-n);
}
- STR_SET_LEN(str2, len);
- TERM_FILL(&ptr2[len], termlen);
+ ptr2[RSTRING_LEN(str2)] = '\0';
OBJ_INFECT(str2, str);
rb_enc_cr_str_copy_for_substr(str2, str);
@@ -1743,80 +1358,55 @@ rb_str_times(VALUE str, VALUE times)
static VALUE
rb_str_format_m(VALUE str, VALUE arg)
{
- VALUE tmp = rb_check_array_type(arg);
+ volatile VALUE tmp = rb_check_array_type(arg);
if (!NIL_P(tmp)) {
- VALUE rv = rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
- RB_GC_GUARD(tmp);
- return rv;
+ return rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
}
return rb_str_format(1, &arg, str);
}
static inline void
-rb_check_lockedtmp(VALUE str)
+str_modifiable(VALUE str)
{
if (FL_TEST(str, STR_TMPLOCK)) {
rb_raise(rb_eRuntimeError, "can't modify string; temporarily locked");
}
-}
-
-static inline void
-str_modifiable(VALUE str)
-{
- rb_check_lockedtmp(str);
rb_check_frozen(str);
}
static inline int
-str_dependent_p(VALUE str)
-{
- if (STR_EMBED_P(str) || !FL_TEST(str, STR_SHARED|STR_NOFREE)) {
- return 0;
- }
- else {
- return 1;
- }
-}
-
-static inline int
str_independent(VALUE str)
{
str_modifiable(str);
- return !str_dependent_p(str);
+ if (!STR_SHARED_P(str)) return 1;
+ if (STR_EMBED_P(str)) return 1;
+ return 0;
}
static void
-str_make_independent_expand(VALUE str, long len, long expand, const int termlen)
+str_make_independent_expand(VALUE str, long expand)
{
char *ptr;
- const char *oldptr;
+ long len = RSTRING_LEN(str);
+ const int termlen = TERM_LEN(str);
long capa = len + expand;
if (len > capa) len = capa;
-
- if (capa + termlen - 1 <= RSTRING_EMBED_LEN_MAX && !STR_EMBED_P(str)) {
- ptr = RSTRING(str)->as.heap.ptr;
- STR_SET_EMBED(str);
- memcpy(RSTRING(str)->as.ary, ptr, len);
- TERM_FILL(RSTRING(str)->as.ary + len, termlen);
- STR_SET_EMBED_LEN(str, len);
- return;
- }
-
ptr = ALLOC_N(char, capa + termlen);
- oldptr = RSTRING_PTR(str);
- if (oldptr) {
- memcpy(ptr, oldptr, len);
+ if (RSTRING_PTR(str)) {
+ memcpy(ptr, RSTRING_PTR(str), len);
}
STR_SET_NOEMBED(str);
- FL_UNSET(str, STR_SHARED|STR_NOFREE);
+ STR_UNSET_NOCAPA(str);
TERM_FILL(ptr + len, termlen);
RSTRING(str)->as.heap.ptr = ptr;
RSTRING(str)->as.heap.len = len;
RSTRING(str)->as.heap.aux.capa = capa;
}
+#define str_make_independent(str) str_make_independent_expand((str), 0L)
+
void
rb_str_modify(VALUE str)
{
@@ -1828,27 +1418,22 @@ rb_str_modify(VALUE str)
void
rb_str_modify_expand(VALUE str, long expand)
{
- int termlen;
if (expand < 0) {
rb_raise(rb_eArgError, "negative expanding string size");
}
- termlen = TERM_LEN(str);
if (!str_independent(str)) {
- long len = RSTRING_LEN(str);
- str_make_independent_expand(str, len, expand, termlen);
+ str_make_independent_expand(str, expand);
}
else if (expand > 0) {
long len = RSTRING_LEN(str);
long capa = len + expand;
- if (expand >= LONG_MAX - len - termlen) {
- rb_raise(rb_eArgError, "string size too big");
- }
+ int termlen = TERM_LEN(str);
if (!STR_EMBED_P(str)) {
REALLOC_N(RSTRING(str)->as.heap.ptr, char, capa + termlen);
RSTRING(str)->as.heap.aux.capa = capa;
}
else if (capa + termlen > RSTRING_EMBED_LEN_MAX + 1) {
- str_make_independent_expand(str, len, expand, termlen);
+ str_make_independent_expand(str, expand);
}
}
ENC_CODERANGE_CLEAR(str);
@@ -1869,7 +1454,7 @@ static inline void
str_discard(VALUE str)
{
str_modifiable(str);
- if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED|STR_NOFREE)) {
+ if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) {
ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
RSTRING(str)->as.heap.ptr = 0;
RSTRING(str)->as.heap.len = 0;
@@ -1877,6 +1462,47 @@ str_discard(VALUE str)
}
void
+rb_str_associate(VALUE str, VALUE add)
+{
+ /* sanity check */
+ rb_check_frozen(str);
+ if (STR_ASSOC_P(str)) {
+ /* already associated */
+ rb_ary_concat(RSTRING(str)->as.heap.aux.shared, add);
+ }
+ else {
+ if (STR_SHARED_P(str)) {
+ VALUE assoc = RSTRING(str)->as.heap.aux.shared;
+ str_make_independent(str);
+ if (STR_ASSOC_P(assoc)) {
+ assoc = RSTRING(assoc)->as.heap.aux.shared;
+ rb_ary_concat(assoc, add);
+ add = assoc;
+ }
+ }
+ else if (STR_EMBED_P(str)) {
+ str_make_independent(str);
+ }
+ else if (RSTRING(str)->as.heap.aux.capa != RSTRING_LEN(str)) {
+ RESIZE_CAPA(str, RSTRING_LEN(str));
+ }
+ FL_SET(str, STR_ASSOC);
+ RBASIC_CLEAR_CLASS(add);
+ OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, add);
+ }
+}
+
+VALUE
+rb_str_associated(VALUE str)
+{
+ if (STR_SHARED_P(str)) str = RSTRING(str)->as.heap.aux.shared;
+ if (STR_ASSOC_P(str)) {
+ return RSTRING(str)->as.heap.aux.shared;
+ }
+ return Qfalse;
+}
+
+void
rb_must_asciicompat(VALUE str)
{
rb_encoding *enc = rb_enc_get(str);
@@ -1924,56 +1550,22 @@ str_null_char(const char *s, long len, const int minlen, rb_encoding *enc)
}
static char *
-str_fill_term(VALUE str, char *s, long len, int termlen)
+str_fill_term(VALUE str, char *s, long len, int oldtermlen, int termlen)
{
- long capa = str_capacity(str, termlen);
-
- /* This function assumes that (capa + termlen) bytes of memory
- * is allocated, like many other functions in this file.
- */
+ long capa = rb_str_capacity(str) + 1;
- if (capa < len) {
- rb_check_lockedtmp(str);
- str_make_independent_expand(str, len, 0L, termlen);
- }
- else if (str_dependent_p(str)) {
- if (!zero_filled(s + len, termlen))
- str_make_independent_expand(str, len, 0L, termlen);
+ if (capa < len + termlen) {
+ rb_str_modify_expand(str, termlen);
}
- else {
- TERM_FILL(s + len, termlen);
+ else if (!str_independent(str)) {
+ if (zero_filled(s + len, termlen)) return s;
+ str_make_independent(str);
}
+ s = RSTRING_PTR(str);
+ TERM_FILL(s + len, termlen);
return s;
}
-void
-rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen)
-{
- long capa = str_capacity(str, oldtermlen);
- long len = RSTRING_LEN(str);
-
- if (capa < len + termlen - oldtermlen) {
- rb_check_lockedtmp(str);
- str_make_independent_expand(str, len, 0L, termlen);
- }
- else if (str_dependent_p(str)) {
- if (termlen > oldtermlen)
- str_make_independent_expand(str, len, 0L, termlen);
- }
- else {
- if (!STR_EMBED_P(str)) {
- /* modify capa instead of realloc */
- assert(!FL_TEST((str), STR_SHARED));
- RSTRING(str)->as.heap.aux.capa = capa - (termlen - oldtermlen);
- }
- if (termlen > oldtermlen) {
- TERM_FILL(RSTRING_PTR(str) + len, termlen);
- }
- }
-
- return;
-}
-
char *
rb_string_value_cstr(volatile VALUE *ptr)
{
@@ -1987,13 +1579,15 @@ rb_string_value_cstr(volatile VALUE *ptr)
if (str_null_char(s, len, minlen, enc)) {
rb_raise(rb_eArgError, "string contains null char");
}
- return str_fill_term(str, s, len, minlen);
+ return str_fill_term(str, s, len, minlen, minlen);
}
if (!s || memchr(s, 0, len)) {
rb_raise(rb_eArgError, "string contains null byte");
}
if (s[len]) {
- s = str_fill_term(str, s, len, minlen);
+ rb_str_modify(str);
+ s = RSTRING_PTR(str);
+ s[RSTRING_LEN(str)] = 0;
}
return s;
}
@@ -2003,7 +1597,8 @@ rb_str_fill_terminator(VALUE str, const int newminlen)
{
char *s = RSTRING_PTR(str);
long len = RSTRING_LEN(str);
- str_fill_term(str, s, len, newminlen);
+ rb_encoding *enc = rb_enc_get(str);
+ str_fill_term(str, s, len, rb_enc_mbminlen(enc), newminlen);
}
VALUE
@@ -2120,11 +1715,11 @@ static char *
str_utf8_nth(const char *p, const char *e, long *nthp)
{
long nth = *nthp;
- if ((int)SIZEOF_VOIDP * 2 < e - p && (int)SIZEOF_VOIDP * 2 < nth) {
- const uintptr_t *s, *t;
- const uintptr_t lowbits = SIZEOF_VOIDP - 1;
- s = (const uintptr_t*)(~lowbits & ((uintptr_t)p + lowbits));
- t = (const uintptr_t*)(~lowbits & (uintptr_t)e);
+ if ((int)SIZEOF_VALUE * 2 < e - p && (int)SIZEOF_VALUE * 2 < nth) {
+ const VALUE *s, *t;
+ const VALUE lowbits = sizeof(VALUE) - 1;
+ s = (const VALUE*)(~lowbits & ((VALUE)p + lowbits));
+ t = (const VALUE*)(~lowbits & (VALUE)e);
while (p < (const char *)s) {
if (is_utf8_lead_byte(*p)) nth--;
p++;
@@ -2132,7 +1727,7 @@ str_utf8_nth(const char *p, const char *e, long *nthp)
do {
nth -= count_utf8_lead_bytes_with_word(s);
s++;
- } while (s < t && (int)SIZEOF_VOIDP <= nth);
+ } while (s < t && (int)sizeof(VALUE) <= nth);
p = (char *)s;
}
while (p < e) {
@@ -2171,15 +1766,13 @@ rb_str_subseq(VALUE str, long beg, long len)
{
VALUE str2;
- if ((RSTRING_EMBED_LEN_MAX + 1 - TERM_LEN(str)) < len && SHARABLE_SUBSTRING_P(beg, len, RSTRING_LEN(str))) {
- long olen;
- str2 = rb_str_new_shared(rb_str_new_frozen(str));
- RSTRING(str2)->as.heap.ptr += beg;
- olen = RSTRING(str2)->as.heap.len;
- if (olen > len) RSTRING(str2)->as.heap.len = len;
+ if (RSTRING_LEN(str) == beg + len &&
+ RSTRING_EMBED_LEN_MAX < len) {
+ str2 = rb_str_new_shared(rb_str_new_frozen(str));
+ rb_str_drop_bytes(str2, beg);
}
else {
- str2 = rb_str_new_with_class(str, RSTRING_PTR(str)+beg, len);
+ str2 = rb_str_new5(str, RSTRING_PTR(str)+beg, len);
RB_GC_GUARD(str);
}
@@ -2238,7 +1831,7 @@ rb_str_subpos(VALUE str, long beg, long *lenp)
return 0;
}
if (len == 0) {
- if (beg > str_strlen(str, enc)) return 0; /* str's enc */
+ if (beg > str_strlen(str, enc)) return 0;
p = s + beg;
}
#ifdef NONASCII_MASK
@@ -2281,19 +1874,18 @@ rb_str_substr(VALUE str, long beg, long len)
char *p = rb_str_subpos(str, beg, &len);
if (!p) return Qnil;
- if (len > (RSTRING_EMBED_LEN_MAX + 1 - TERM_LEN(str)) && SHARABLE_SUBSTRING_P(p, len, RSTRING_END(str))) {
- long ofs = p - RSTRING_PTR(str);
- str2 = rb_str_new_frozen(str);
- str2 = str_new_shared(rb_obj_class(str2), str2);
- RSTRING(str2)->as.heap.ptr += ofs;
+ if (len > RSTRING_EMBED_LEN_MAX && p + len == RSTRING_END(str)) {
+ str2 = rb_str_new4(str);
+ str2 = str_new3(rb_obj_class(str2), str2);
+ RSTRING(str2)->as.heap.ptr += RSTRING(str2)->as.heap.len - len;
RSTRING(str2)->as.heap.len = len;
}
else {
- str2 = rb_str_new_with_class(str, p, len);
+ str2 = rb_str_new5(str, p, len);
+ rb_enc_cr_str_copy_for_substr(str2, str);
OBJ_INFECT(str2, str);
RB_GC_GUARD(str);
}
- rb_enc_cr_str_copy_for_substr(str2, str);
return str2;
}
@@ -2301,49 +1893,11 @@ rb_str_substr(VALUE str, long beg, long len)
VALUE
rb_str_freeze(VALUE str)
{
- if (OBJ_FROZEN(str)) return str;
- rb_str_resize(str, RSTRING_LEN(str));
- return rb_obj_freeze(str);
-}
-
-
-/*
- * call-seq:
- * +str -> str (mutable)
- *
- * If the string is frozen, then return duplicated mutable string.
- *
- * If the string is not frozen, then return the string itself.
- */
-static VALUE
-str_uplus(VALUE str)
-{
- if (OBJ_FROZEN(str)) {
- return rb_str_dup(str);
- }
- else {
- return str;
- }
-}
-
-/*
- * call-seq:
- * -str -> str (frozen)
- *
- * If the string is frozen, then return the string itself.
- *
- * If the string is not frozen, then duplicate the string
- * freeze it and return it.
- */
-static VALUE
-str_uminus(VALUE str)
-{
- if (OBJ_FROZEN(str)) {
- return str;
- }
- else {
- return rb_str_freeze(rb_str_dup(str));
+ if (STR_ASSOC_P(str)) {
+ VALUE ary = RSTRING(str)->as.heap.aux.shared;
+ OBJ_FREEZE(ary);
}
+ return rb_obj_freeze(str);
}
RUBY_ALIAS_FUNCTION(rb_str_dup_frozen(VALUE str), rb_str_new_frozen, (str))
@@ -2369,7 +1923,7 @@ rb_str_unlocktmp(VALUE str)
return str;
}
-RUBY_FUNC_EXPORTED VALUE
+VALUE
rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg)
{
rb_str_locktmp(str);
@@ -2406,39 +1960,37 @@ rb_str_resize(VALUE str, long len)
independent = str_independent(str);
ENC_CODERANGE_CLEAR(str);
slen = RSTRING_LEN(str);
-
- {
- long capa;
+ if (len != slen) {
const int termlen = TERM_LEN(str);
if (STR_EMBED_P(str)) {
- if (len == slen) return str;
if (len + termlen <= RSTRING_EMBED_LEN_MAX + 1) {
STR_SET_EMBED_LEN(str, len);
TERM_FILL(RSTRING(str)->as.ary + len, termlen);
return str;
}
- str_make_independent_expand(str, slen, len - slen, termlen);
+ str_make_independent_expand(str, len - slen);
+ STR_SET_NOEMBED(str);
}
else if (len + termlen <= RSTRING_EMBED_LEN_MAX + 1) {
char *ptr = STR_HEAP_PTR(str);
+ size_t size = STR_HEAP_SIZE(str);
STR_SET_EMBED(str);
if (slen > len) slen = len;
if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen);
TERM_FILL(RSTRING(str)->as.ary + len, termlen);
STR_SET_EMBED_LEN(str, len);
- if (independent) ruby_xfree(ptr);
+ if (independent) ruby_sized_xfree(ptr, size);
return str;
}
else if (!independent) {
- if (len == slen) return str;
- str_make_independent_expand(str, slen, len - slen, termlen);
+ str_make_independent_expand(str, len - slen);
}
- else if ((capa = RSTRING(str)->as.heap.aux.capa) < len ||
- (capa - len) > (len < 1024 ? len : 1024)) {
+ else if (slen < len || slen - len > 1024) {
REALLOC_N(RSTRING(str)->as.heap.ptr, char, len + termlen);
+ }
+ if (!STR_NOCAPA_P(str)) {
RSTRING(str)->as.heap.aux.capa = len;
}
- else if (len == slen) return str;
RSTRING(str)->as.heap.len = len;
TERM_FILL(RSTRING(str)->as.heap.ptr + len, termlen); /* sentinel */
}
@@ -2448,52 +2000,44 @@ rb_str_resize(VALUE str, long len)
static VALUE
str_buf_cat(VALUE str, const char *ptr, long len)
{
- long capa, total, olen, off = -1;
- char *sptr;
+ long capa, total, off = -1;
const int termlen = TERM_LEN(str);
- RSTRING_GETMEM(str, sptr, olen);
- if (ptr >= sptr && ptr <= sptr + olen) {
- off = ptr - sptr;
+ if (ptr >= RSTRING_PTR(str) && ptr <= RSTRING_END(str)) {
+ off = ptr - RSTRING_PTR(str);
}
rb_str_modify(str);
if (len == 0) return 0;
- if (STR_EMBED_P(str)) {
- capa = RSTRING_EMBED_LEN_MAX + 1 - termlen;
- sptr = RSTRING(str)->as.ary;
- olen = RSTRING_EMBED_LEN(str);
+ if (STR_ASSOC_P(str)) {
+ FL_UNSET(str, STR_ASSOC);
+ capa = RSTRING(str)->as.heap.aux.capa = RSTRING_LEN(str);
+ }
+ else if (STR_EMBED_P(str)) {
+ capa = RSTRING_EMBED_LEN_MAX;
}
else {
capa = RSTRING(str)->as.heap.aux.capa;
- sptr = RSTRING(str)->as.heap.ptr;
- olen = RSTRING(str)->as.heap.len;
}
- if (olen >= LONG_MAX - len) {
+ if (RSTRING_LEN(str) >= LONG_MAX - len) {
rb_raise(rb_eArgError, "string sizes too big");
}
- total = olen + len;
+ total = RSTRING_LEN(str)+len;
if (capa <= total) {
- if (LIKELY(capa > 0)) {
- while (total > capa) {
- if (capa > LONG_MAX / 2) {
- capa = (total + 4095) / 4096 * 4096;
- break;
- }
- capa = 2 * capa;
+ while (total > capa) {
+ if (capa + termlen >= LONG_MAX / 2) {
+ capa = (total + 4095) / 4096;
+ break;
}
+ capa = (capa + termlen) * 2;
}
- else {
- capa = total;
- }
- RESIZE_CAPA_TERM(str, capa, termlen);
- sptr = RSTRING_PTR(str);
+ RESIZE_CAPA(str, capa);
}
if (off != -1) {
- ptr = sptr + off;
+ ptr = RSTRING_PTR(str) + off;
}
- memcpy(sptr + olen, ptr, len);
+ memcpy(RSTRING_PTR(str) + RSTRING_LEN(str), ptr, len);
STR_SET_LEN(str, total);
- TERM_FILL(sptr + total, termlen); /* sentinel */
+ RSTRING_PTR(str)[total] = '\0'; /* sentinel */
return str;
}
@@ -2501,7 +2045,7 @@ str_buf_cat(VALUE str, const char *ptr, long len)
#define str_buf_cat2(str, ptr) str_buf_cat((str), (ptr), strlen(ptr))
VALUE
-rb_str_cat(VALUE str, const char *ptr, long len)
+rb_str_buf_cat(VALUE str, const char *ptr, long len)
{
if (len == 0) return str;
if (len < 0) {
@@ -2511,15 +2055,35 @@ rb_str_cat(VALUE str, const char *ptr, long len)
}
VALUE
-rb_str_cat_cstr(VALUE str, const char *ptr)
+rb_str_buf_cat2(VALUE str, const char *ptr)
{
- must_not_null(ptr);
return rb_str_buf_cat(str, ptr, strlen(ptr));
}
-RUBY_ALIAS_FUNCTION(rb_str_buf_cat(VALUE str, const char *ptr, long len), rb_str_cat, (str, ptr, len))
-RUBY_ALIAS_FUNCTION(rb_str_buf_cat2(VALUE str, const char *ptr), rb_str_cat_cstr, (str, ptr))
-RUBY_ALIAS_FUNCTION(rb_str_cat2(VALUE str, const char *ptr), rb_str_cat_cstr, (str, ptr))
+VALUE
+rb_str_cat(VALUE str, const char *ptr, long len)
+{
+ if (len < 0) {
+ rb_raise(rb_eArgError, "negative string size (or size too big)");
+ }
+ if (STR_ASSOC_P(str)) {
+ char *p;
+ rb_str_modify_expand(str, len);
+ p = RSTRING(str)->as.heap.ptr;
+ memcpy(p + RSTRING(str)->as.heap.len, ptr, len);
+ len = RSTRING(str)->as.heap.len += len;
+ TERM_FILL(p, TERM_LEN(str)); /* sentinel */
+ return str;
+ }
+
+ return rb_str_buf_cat(str, ptr, len);
+}
+
+VALUE
+rb_str_cat2(VALUE str, const char *ptr)
+{
+ return rb_str_cat(str, ptr, strlen(ptr));
+}
static VALUE
rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
@@ -2528,18 +2092,19 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
int str_encindex = ENCODING_GET(str);
int res_encindex;
int str_cr, res_cr;
- rb_encoding *str_enc, *ptr_enc;
str_cr = RSTRING_LEN(str) ? ENC_CODERANGE(str) : ENC_CODERANGE_7BIT;
if (str_encindex == ptr_encindex) {
- if (str_cr != ENC_CODERANGE_UNKNOWN && ptr_cr == ENC_CODERANGE_UNKNOWN) {
+ if (str_cr == ENC_CODERANGE_UNKNOWN)
+ ptr_cr = ENC_CODERANGE_UNKNOWN;
+ else if (ptr_cr == ENC_CODERANGE_UNKNOWN) {
ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex));
}
}
else {
- str_enc = rb_enc_from_index(str_encindex);
- ptr_enc = rb_enc_from_index(ptr_encindex);
+ rb_encoding *str_enc = rb_enc_from_index(str_encindex);
+ rb_encoding *ptr_enc = rb_enc_from_index(ptr_encindex);
if (!rb_enc_asciicompat(str_enc) || !rb_enc_asciicompat(ptr_enc)) {
if (len == 0)
return str;
@@ -2565,11 +2130,10 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
if (str_encindex != ptr_encindex &&
str_cr != ENC_CODERANGE_7BIT &&
ptr_cr != ENC_CODERANGE_7BIT) {
- str_enc = rb_enc_from_index(str_encindex);
- ptr_enc = rb_enc_from_index(ptr_encindex);
incompatible:
rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s",
- rb_enc_name(str_enc), rb_enc_name(ptr_enc));
+ rb_enc_name(rb_enc_from_index(str_encindex)),
+ rb_enc_name(rb_enc_from_index(ptr_encindex)));
}
if (str_cr == ENC_CODERANGE_UNKNOWN) {
@@ -2588,7 +2152,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
}
else if (str_cr == ENC_CODERANGE_VALID) {
res_encindex = str_encindex;
- if (ENC_CODERANGE_CLEAN_P(ptr_cr))
+ if (ptr_cr == ENC_CODERANGE_7BIT || ptr_cr == ENC_CODERANGE_VALID)
res_cr = str_cr;
else
res_cr = ptr_cr;
@@ -2657,20 +2221,27 @@ rb_str_buf_append(VALUE str, VALUE str2)
VALUE
rb_str_append(VALUE str, VALUE str2)
{
- StringValue(str2);
- return rb_str_buf_append(str, str2);
-}
+ rb_encoding *enc;
+ int cr, cr2;
+ long len2;
-VALUE
-rb_str_append_literal(VALUE str, VALUE str2)
-{
- int encidx = rb_enc_get_index(str2);
- rb_str_buf_append(str, str2);
- if (encidx != ENCINDEX_US_ASCII) {
- if (rb_enc_get_index(str) == ENCINDEX_US_ASCII)
- rb_enc_associate_index(str, encidx);
+ StringValue(str2);
+ if ((len2 = RSTRING_LEN(str2)) > 0 && STR_ASSOC_P(str)) {
+ long len1 = RSTRING(str)->as.heap.len, len = len1 + len2;
+ enc = rb_enc_check(str, str2);
+ cr = ENC_CODERANGE(str);
+ if ((cr2 = ENC_CODERANGE(str2)) > cr || RSTRING_LEN(str) == 0)
+ cr = cr2;
+ rb_str_modify_expand(str, len2);
+ memcpy(RSTRING(str)->as.heap.ptr + len1, RSTRING_PTR(str2), len2);
+ TERM_FILL(RSTRING(str)->as.heap.ptr + len, rb_enc_mbminlen(enc));
+ RSTRING(str)->as.heap.len = len;
+ rb_enc_associate(str, enc);
+ ENC_CODERANGE_SET(str, cr);
+ OBJ_INFECT(str, str2);
+ return str;
}
- return str;
+ return rb_str_buf_append(str, str2);
}
/*
@@ -2784,22 +2355,21 @@ rb_str_hash(VALUE str)
int
rb_str_hash_cmp(VALUE str1, VALUE str2)
{
- long len1, len2;
- const char *ptr1, *ptr2;
- RSTRING_GETMEM(str1, ptr1, len1);
- RSTRING_GETMEM(str2, ptr2, len2);
- return (len1 != len2 ||
- !rb_str_comparable(str1, str2) ||
- memcmp(ptr1, ptr2, len1) != 0);
+ long len;
+
+ if (!rb_str_comparable(str1, str2)) return 1;
+ if (RSTRING_LEN(str1) == (len = RSTRING_LEN(str2)) &&
+ memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len) == 0) {
+ return 0;
+ }
+ return 1;
}
/*
* call-seq:
* str.hash -> fixnum
*
- * Return a hash based on the string's length, content and encoding.
- *
- * See also Object#hash.
+ * Return a hash based on the string's length and content.
*/
static VALUE
@@ -2898,7 +2468,7 @@ rb_str_equal(VALUE str1, VALUE str2)
{
if (str1 == str2) return Qtrue;
if (!RB_TYPE_P(str2, T_STRING)) {
- if (!rb_respond_to(str2, idTo_str)) {
+ if (!rb_respond_to(str2, rb_intern("to_str"))) {
return Qfalse;
}
return rb_equal(str2, str1);
@@ -2944,7 +2514,6 @@ rb_str_eql(VALUE str1, VALUE str2)
* "abcdef" <=> "abcdef" #=> 0
* "abcdef" <=> "abcdefg" #=> -1
* "abcdef" <=> "ABCDEF" #=> 1
- * "abcdef" <=> 1 #=> nil
*/
static VALUE
@@ -2953,7 +2522,7 @@ rb_str_cmp_m(VALUE str1, VALUE str2)
int result;
if (!RB_TYPE_P(str2, T_STRING)) {
- VALUE tmp = rb_check_funcall(str2, idTo_str, 0, 0);
+ VALUE tmp = rb_check_funcall(str2, rb_intern("to_str"), 0, 0);
if (RB_TYPE_P(tmp, T_STRING)) {
result = rb_str_cmp(str1, tmp);
}
@@ -3037,12 +2606,10 @@ rb_str_casecmp(VALUE str1, VALUE str2)
return INT2FIX(-1);
}
-#define rb_str_index(str, sub, offset) rb_strseq_index(str, sub, offset, 0)
-
static long
-rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte)
+rb_str_index(VALUE str, VALUE sub, long offset)
{
- const char *s, *sptr, *e;
+ char *s, *sptr, *e;
long pos, len, slen;
int single_byte = single_byte_optimizable(str);
rb_encoding *enc;
@@ -3050,8 +2617,8 @@ rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte)
enc = rb_enc_check(str, sub);
if (is_broken_string(sub)) return -1;
- len = (in_byte || single_byte) ? RSTRING_LEN(str) : str_strlen(str, enc); /* rb_enc_check */
- slen = in_byte ? RSTRING_LEN(sub) : str_strlen(sub, enc); /* rb_enc_check */
+ len = single_byte ? RSTRING_LEN(str) : str_strlen(str, enc);
+ slen = str_strlen(sub, enc);
if (offset < 0) {
offset += len;
if (offset < 0) return -1;
@@ -3061,7 +2628,7 @@ rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte)
s = RSTRING_PTR(str);
e = RSTRING_END(str);
if (offset) {
- if (!in_byte) offset = str_offset(s, e, offset, enc, single_byte);
+ offset = str_offset(s, e, offset, enc, single_byte);
s += offset;
}
if (slen == 0) return offset;
@@ -3070,7 +2637,7 @@ rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte)
slen = RSTRING_LEN(sub);
len = RSTRING_LEN(str) - offset;
for (;;) {
- const char *t;
+ char *t;
pos = rb_memsearch(sptr, slen, s, len, enc);
if (pos < 0) return pos;
t = rb_enc_right_char_head(s, s+pos, e, enc);
@@ -3115,7 +2682,7 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
pos = 0;
}
if (pos < 0) {
- pos += str_strlen(str, NULL);
+ pos += str_strlen(str, STR_ENC_GET(str));
if (pos < 0) {
if (RB_TYPE_P(sub, T_REGEXP)) {
rb_backref_set(Qnil);
@@ -3127,7 +2694,7 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
if (SPECIAL_CONST_P(sub)) goto generic;
switch (BUILTIN_TYPE(sub)) {
case T_REGEXP:
- if (pos > str_strlen(str, NULL))
+ if (pos > str_strlen(str, STR_ENC_GET(str)))
return Qnil;
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
rb_enc_check(str, sub), single_byte_optimizable(str));
@@ -3226,8 +2793,8 @@ rb_str_rindex(VALUE str, VALUE sub, long pos)
enc = rb_enc_check(str, sub);
if (is_broken_string(sub)) return -1;
singlebyte = single_byte_optimizable(str);
- len = singlebyte ? RSTRING_LEN(str) : str_strlen(str, enc); /* rb_enc_check */
- slen = str_strlen(sub, enc); /* rb_enc_check */
+ len = singlebyte ? RSTRING_LEN(str) : str_strlen(str, enc);
+ slen = str_strlen(sub, enc);
/* substring longer than string */
if (len < slen) return -1;
@@ -3272,7 +2839,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
VALUE sub;
VALUE vpos;
rb_encoding *enc = STR_ENC_GET(str);
- long pos, len = str_strlen(str, enc); /* str's enc */
+ long pos, len = str_strlen(str, enc);
if (rb_scan_args(argc, argv, "11", &sub, &vpos) == 2) {
pos = NUM2LONG(vpos);
@@ -3296,10 +2863,12 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
case T_REGEXP:
/* enc = rb_get_check(str, sub); */
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
- enc, single_byte_optimizable(str));
+ STR_ENC_GET(str), single_byte_optimizable(str));
- pos = rb_reg_search(sub, str, pos, 1);
- pos = rb_str_sublen(str, pos);
+ if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) {
+ pos = rb_reg_search(sub, str, pos, 1);
+ pos = rb_str_sublen(str, pos);
+ }
if (pos >= 0) return LONG2NUM(pos);
break;
@@ -3354,12 +2923,12 @@ rb_str_match(VALUE x, VALUE y)
generic:
default:
- return rb_funcall(y, idEqTilde, 1, x);
+ return rb_funcall(y, rb_intern("=~"), 1, x);
}
}
-static VALUE get_pat(VALUE);
+static VALUE get_pat(VALUE, int);
/*
@@ -3399,7 +2968,7 @@ rb_str_match_m(int argc, VALUE *argv, VALUE str)
rb_check_arity(argc, 1, 2);
re = argv[0];
argv[0] = str;
- result = rb_funcall2(get_pat(re), rb_intern("match"), argc, argv);
+ result = rb_funcall2(get_pat(re, 0), rb_intern("match"), argc, argv);
if (!NIL_P(result) && rb_block_given_p()) {
return rb_yield(result);
}
@@ -3535,10 +3104,6 @@ enc_succ_alnum_char(char *p, long len, rb_encoding *enc, char *carry)
int range;
char save[ONIGENC_CODE_TO_MBC_MAXLEN];
- /* skip 03A2, invalid char between GREEK CAPITAL LETTERS */
- int try;
- const int max_gaps = 1;
-
c = rb_enc_mbc_to_codepoint(p, p+len, enc);
if (rb_enc_isctype(c, ONIGENC_CTYPE_DIGIT, enc))
ctype = ONIGENC_CTYPE_DIGIT;
@@ -3548,13 +3113,11 @@ enc_succ_alnum_char(char *p, long len, rb_encoding *enc, char *carry)
return NEIGHBOR_NOT_CHAR;
MEMCPY(save, p, char, len);
- for (try = 0; try <= max_gaps; ++try) {
- ret = enc_succ_char(p, len, enc);
- if (ret == NEIGHBOR_FOUND) {
- c = rb_enc_mbc_to_codepoint(p, p+len, enc);
- if (rb_enc_isctype(c, ctype, enc))
- return NEIGHBOR_FOUND;
- }
+ ret = enc_succ_char(p, len, enc);
+ if (ret == NEIGHBOR_FOUND) {
+ c = rb_enc_mbc_to_codepoint(p, p+len, enc);
+ if (rb_enc_isctype(c, ctype, enc))
+ return NEIGHBOR_FOUND;
}
MEMCPY(p, save, char, len);
range = 1;
@@ -3589,8 +3152,6 @@ enc_succ_alnum_char(char *p, long len, rb_encoding *enc, char *carry)
}
-static VALUE str_succ(VALUE str);
-
/*
* call-seq:
* str.succ -> new_str
@@ -3619,30 +3180,23 @@ static VALUE str_succ(VALUE str);
VALUE
rb_str_succ(VALUE orig)
{
- VALUE str;
- str = rb_str_new_with_class(orig, RSTRING_PTR(orig), RSTRING_LEN(orig));
- rb_enc_cr_str_copy_for_substr(str, orig);
- OBJ_INFECT(str, orig);
- return str_succ(str);
-}
-
-static VALUE
-str_succ(VALUE str)
-{
rb_encoding *enc;
+ VALUE str;
char *sbeg, *s, *e, *last_alnum = 0;
int c = -1;
- long l, slen;
+ long l;
char carry[ONIGENC_CODE_TO_MBC_MAXLEN] = "\1";
long carry_pos = 0, carry_len = 1;
enum neighbor_char neighbor = NEIGHBOR_FOUND;
- slen = RSTRING_LEN(str);
- if (slen == 0) return str;
+ str = rb_str_new5(orig, RSTRING_PTR(orig), RSTRING_LEN(orig));
+ rb_enc_cr_str_copy_for_substr(str, orig);
+ OBJ_INFECT(str, orig);
+ if (RSTRING_LEN(str) == 0) return str;
- enc = STR_ENC_GET(str);
+ enc = STR_ENC_GET(orig);
sbeg = RSTRING_PTR(str);
- s = e = sbeg + slen;
+ s = e = sbeg + RSTRING_LEN(str);
while ((s = rb_enc_prev_char(sbeg, s, e, enc)) != 0) {
if (neighbor == NEIGHBOR_NOT_CHAR && last_alnum) {
@@ -3701,14 +3255,12 @@ str_succ(VALUE str)
carry_pos = s - sbeg;
}
}
- RESIZE_CAPA(str, slen + carry_len);
- sbeg = RSTRING_PTR(str);
- s = sbeg + carry_pos;
- memmove(s + carry_len, s, slen - carry_pos);
+ RESIZE_CAPA(str, RSTRING_LEN(str) + carry_len);
+ s = RSTRING_PTR(str) + carry_pos;
+ memmove(s + carry_len, s, RSTRING_LEN(str) - carry_pos);
memmove(s, carry, carry_len);
- slen += carry_len;
- STR_SET_LEN(str, slen);
- TERM_FILL(&sbeg[slen], rb_enc_mbminlen(enc));
+ STR_SET_LEN(str, RSTRING_LEN(str) + carry_len);
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
rb_enc_str_coderange(str);
return str;
}
@@ -3726,29 +3278,11 @@ str_succ(VALUE str)
static VALUE
rb_str_succ_bang(VALUE str)
{
- rb_str_modify(str);
- str_succ(str);
- return str;
-}
+ rb_str_shared_replace(str, rb_str_succ(str));
-static int
-all_digits_p(const char *s, long len)
-{
- while (len-- > 0) {
- if (!ISDIGIT(*s)) return 0;
- s++;
- }
- return 1;
+ return str;
}
-static VALUE str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE);
-
-static int
-str_upto_i(VALUE str, VALUE arg)
-{
- rb_yield(str);
- return 0;
-}
/*
* call-seq:
@@ -3786,20 +3320,14 @@ static VALUE
rb_str_upto(int argc, VALUE *argv, VALUE beg)
{
VALUE end, exclusive;
-
- rb_scan_args(argc, argv, "11", &end, &exclusive);
- RETURN_ENUMERATOR(beg, argc, argv);
- return str_upto_each(beg, end, RTEST(exclusive), str_upto_i, Qnil);
-}
-
-static VALUE
-str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE arg)
-{
VALUE current, after_end;
ID succ;
- int n, ascii;
+ int n, excl, ascii;
rb_encoding *enc;
+ rb_scan_args(argc, argv, "11", &end, &exclusive);
+ RETURN_ENUMERATOR(beg, argc, argv);
+ excl = RTEST(exclusive);
CONST_ID(succ, "succ");
StringValue(end);
enc = rb_enc_check(beg, end);
@@ -3811,7 +3339,7 @@ str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE a
if (c > e || (excl && c == e)) return beg;
for (;;) {
- if ((*each)(rb_enc_str_new(&c, 1, enc), arg)) break;
+ rb_yield(rb_enc_str_new(&c, 1, enc));
if (!excl && c == e) break;
c++;
if (excl && c == e) break;
@@ -3819,13 +3347,22 @@ str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE a
return beg;
}
/* both edges are all digits */
- if (ascii && ISDIGIT(RSTRING_PTR(beg)[0]) && ISDIGIT(RSTRING_PTR(end)[0]) &&
- all_digits_p(RSTRING_PTR(beg), RSTRING_LEN(beg)) &&
- all_digits_p(RSTRING_PTR(end), RSTRING_LEN(end))) {
+ if (ascii && ISDIGIT(RSTRING_PTR(beg)[0]) && ISDIGIT(RSTRING_PTR(end)[0])) {
+ char *s, *send;
VALUE b, e;
int width;
- width = RSTRING_LENINT(beg);
+ s = RSTRING_PTR(beg); send = RSTRING_END(beg);
+ width = rb_long2int(send - s);
+ while (s < send) {
+ if (!ISDIGIT(*s)) goto no_digits;
+ s++;
+ }
+ s = RSTRING_PTR(end); send = RSTRING_END(end);
+ while (s < send) {
+ if (!ISDIGIT(*s)) goto no_digits;
+ s++;
+ }
b = rb_str_to_inum(beg, 10, FALSE);
e = rb_str_to_inum(end, 10, FALSE);
if (FIXNUM_P(b) && FIXNUM_P(e)) {
@@ -3835,34 +3372,35 @@ str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE a
while (bi <= ei) {
if (excl && bi == ei) break;
- if ((*each)(rb_enc_sprintf(usascii, "%.*ld", width, bi), arg)) break;
+ rb_yield(rb_enc_sprintf(usascii, "%.*ld", width, bi));
bi++;
}
}
else {
- ID op = excl ? '<' : idLE;
+ ID op = excl ? '<' : rb_intern("<=");
VALUE args[2], fmt = rb_obj_freeze(rb_usascii_str_new_cstr("%.*d"));
args[0] = INT2FIX(width);
while (rb_funcall(b, op, 1, e)) {
args[1] = b;
- if ((*each)(rb_str_format(numberof(args), args, fmt), arg)) break;
- b = rb_funcallv(b, succ, 0, 0);
+ rb_yield(rb_str_format(numberof(args), args, fmt));
+ b = rb_funcall(b, succ, 0, 0);
}
}
return beg;
}
/* normal case */
+ no_digits:
n = rb_str_cmp(beg, end);
if (n > 0 || (excl && n == 0)) return beg;
- after_end = rb_funcallv(end, succ, 0, 0);
+ after_end = rb_funcall(end, succ, 0, 0);
current = rb_str_dup(beg);
while (!rb_str_equal(current, after_end)) {
VALUE next = Qnil;
if (excl || !rb_str_equal(current, end))
- next = rb_funcallv(current, succ, 0, 0);
- if ((*each)(current, arg)) break;
+ next = rb_funcall(current, succ, 0, 0);
+ rb_yield(current);
if (NIL_P(next)) break;
current = next;
StringValue(current);
@@ -3874,59 +3412,6 @@ str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALUE a
return beg;
}
-static int
-include_range_i(VALUE str, VALUE arg)
-{
- VALUE *argp = (VALUE *)arg;
- if (!rb_equal(str, *argp)) return 0;
- *argp = Qnil;
- return 1;
-}
-
-VALUE
-rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive)
-{
- beg = rb_str_new_frozen(beg);
- StringValue(end);
- end = rb_str_new_frozen(end);
- if (NIL_P(val)) return Qfalse;
- val = rb_check_string_type(val);
- if (NIL_P(val)) return Qfalse;
- if (rb_enc_asciicompat(STR_ENC_GET(beg)) &&
- rb_enc_asciicompat(STR_ENC_GET(end)) &&
- rb_enc_asciicompat(STR_ENC_GET(val))) {
- const char *bp = RSTRING_PTR(beg);
- const char *ep = RSTRING_PTR(end);
- const char *vp = RSTRING_PTR(val);
- if (RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
- if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1)
- return Qfalse;
- else {
- char b = *bp;
- char e = *ep;
- char v = *vp;
-
- if (ISASCII(b) && ISASCII(e) && ISASCII(v)) {
- if (b <= v && v < e) return Qtrue;
- if (!RTEST(exclusive) && v == e) return Qtrue;
- return Qfalse;
- }
- }
- }
-#if 0
- /* both edges are all digits */
- if (ISDIGIT(*bp) && ISDIGIT(*ep) &&
- all_digits_p(bp, RSTRING_LEN(beg)) &&
- all_digits_p(ep, RSTRING_LEN(end))) {
- /* TODO */
- }
-#endif
- }
- str_upto_each(beg, end, RTEST(exclusive), include_range_i, (VALUE)&val);
-
- return NIL_P(val) ? Qtrue : Qfalse;
-}
-
static VALUE
rb_str_subpat(VALUE str, VALUE re, VALUE backref)
{
@@ -3969,7 +3454,7 @@ rb_str_aref(VALUE str, VALUE indx)
long beg, len;
VALUE tmp;
- len = str_strlen(str, NULL);
+ len = str_strlen(str, STR_ENC_GET(str));
switch (rb_range_beg_len(indx, &beg, &len, len, 0)) {
case Qfalse:
break;
@@ -4006,7 +3491,7 @@ rb_str_aref(VALUE str, VALUE indx)
* Element Reference --- If passed a single +index+, returns a substring of
* one character at that index. If passed a +start+ index and a +length+,
* returns a substring containing +length+ characters starting at the
- * +start+ index. If passed a +range+, its beginning and end are interpreted as
+ * +index+. If passed a +range+, its beginning and end are interpreted as
* offsets delimiting the substring to be returned.
*
* In these three cases, if an index is negative, it is counted from the end
@@ -4079,9 +3564,9 @@ rb_str_drop_bytes(VALUE str, long len)
str_modifiable(str);
if (len > olen) len = olen;
nlen = olen - len;
- if (nlen <= (RSTRING_EMBED_LEN_MAX + 1 - TERM_LEN(str))) {
+ if (nlen <= RSTRING_EMBED_LEN_MAX) {
char *oldptr = ptr;
- int fl = (int)(RBASIC(str)->flags & (STR_NOEMBED|STR_SHARED|STR_NOFREE));
+ int fl = (int)(RBASIC(str)->flags & (STR_NOEMBED|ELTS_SHARED));
STR_SET_EMBED(str);
STR_SET_EMBED_LEN(str, nlen);
ptr = RSTRING(str)->as.ary;
@@ -4089,7 +3574,7 @@ rb_str_drop_bytes(VALUE str, long len)
if (fl == STR_NOEMBED) xfree(oldptr);
}
else {
- if (!STR_SHARED_P(str)) rb_str_new_frozen(str);
+ if (!STR_SHARED_P(str)) rb_str_new4(str);
ptr = RSTRING(str)->as.heap.ptr += len;
RSTRING(str)->as.heap.len = nlen;
}
@@ -4101,42 +3586,38 @@ rb_str_drop_bytes(VALUE str, long len)
static void
rb_str_splice_0(VALUE str, long beg, long len, VALUE val)
{
- char *sptr;
- long slen, vlen = RSTRING_LEN(val);
-
- if (beg == 0 && vlen == 0) {
+ if (beg == 0 && RSTRING_LEN(val) == 0) {
rb_str_drop_bytes(str, len);
OBJ_INFECT(str, val);
return;
}
rb_str_modify(str);
- RSTRING_GETMEM(str, sptr, slen);
- if (len < vlen) {
+ if (len < RSTRING_LEN(val)) {
/* expand string */
- RESIZE_CAPA(str, slen + vlen - len);
- sptr = RSTRING_PTR(str);
+ RESIZE_CAPA(str, RSTRING_LEN(str) + RSTRING_LEN(val) - len + TERM_LEN(str));
}
- if (vlen != len) {
- memmove(sptr + beg + vlen,
- sptr + beg + len,
- slen - (beg + len));
+ if (RSTRING_LEN(val) != len) {
+ memmove(RSTRING_PTR(str) + beg + RSTRING_LEN(val),
+ RSTRING_PTR(str) + beg + len,
+ RSTRING_LEN(str) - (beg + len));
}
- if (vlen < beg && len < 0) {
- MEMZERO(sptr + slen, char, -len);
+ if (RSTRING_LEN(val) < beg && len < 0) {
+ MEMZERO(RSTRING_PTR(str) + RSTRING_LEN(str), char, -len);
}
- if (vlen > 0) {
- memmove(sptr + beg, RSTRING_PTR(val), vlen);
+ if (RSTRING_LEN(val) > 0) {
+ memmove(RSTRING_PTR(str)+beg, RSTRING_PTR(val), RSTRING_LEN(val));
+ }
+ STR_SET_LEN(str, RSTRING_LEN(str) + RSTRING_LEN(val) - len);
+ if (RSTRING_PTR(str)) {
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
}
- slen += vlen - len;
- STR_SET_LEN(str, slen);
- TERM_FILL(&sptr[slen], TERM_LEN(str));
OBJ_INFECT(str, val);
}
-void
-rb_str_update(VALUE str, long beg, long len, VALUE val)
+static void
+rb_str_splice(VALUE str, long beg, long len, VALUE val)
{
long slen;
char *p, *e;
@@ -4148,7 +3629,7 @@ rb_str_update(VALUE str, long beg, long len, VALUE val)
StringValue(val);
enc = rb_enc_check(str, val);
- slen = str_strlen(str, enc); /* rb_enc_check */
+ slen = str_strlen(str, enc);
if (slen < beg) {
out_of_range:
@@ -4178,7 +3659,11 @@ rb_str_update(VALUE str, long beg, long len, VALUE val)
ENC_CODERANGE_SET(str, cr);
}
-#define rb_str_splice(str, beg, len, val) rb_str_update(str, beg, len, val)
+void
+rb_str_update(VALUE str, long beg, long len, VALUE val)
+{
+ rb_str_splice(str, beg, len, val);
+}
static void
rb_str_subpat_set(VALUE str, VALUE re, VALUE backref, VALUE val)
@@ -4213,7 +3698,7 @@ rb_str_subpat_set(VALUE str, VALUE re, VALUE backref, VALUE val)
end = END(nth);
len = end - start;
StringValue(val);
- enc = rb_enc_check_str(str, val);
+ enc = rb_enc_check(str, val);
rb_str_splice_0(str, start, len, val);
rb_enc_associate(str, enc);
}
@@ -4242,7 +3727,7 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
rb_raise(rb_eIndexError, "string not matched");
}
beg = rb_str_sublen(str, beg);
- rb_str_splice(str, beg, str_strlen(indx, NULL), val);
+ rb_str_splice(str, beg, str_strlen(indx, 0), val);
return val;
generic:
@@ -4250,7 +3735,7 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
/* check if indx is Range */
{
long beg, len;
- if (rb_range_beg_len(indx, &beg, &len, str_strlen(str, NULL), 2)) {
+ if (rb_range_beg_len(indx, &beg, &len, str_strlen(str, 0), 2)) {
rb_str_splice(str, beg, len, val);
return val;
}
@@ -4336,7 +3821,7 @@ rb_str_insert(VALUE str, VALUE idx, VALUE str2)
/*
* call-seq:
- * str.slice!(fixnum) -> new_str or nil
+ * str.slice!(fixnum) -> fixnum or nil
* str.slice!(fixnum, fixnum) -> new_str or nil
* str.slice!(range) -> new_str or nil
* str.slice!(regexp) -> new_str or nil
@@ -4374,12 +3859,11 @@ rb_str_slice_bang(int argc, VALUE *argv, VALUE str)
}
static VALUE
-get_pat(VALUE pat)
+get_pat(VALUE pat, int quote)
{
VALUE val;
- if (SPECIAL_CONST_P(pat)) goto to_string;
- switch (BUILTIN_TYPE(pat)) {
+ switch (TYPE(pat)) {
case T_REGEXP:
return pat;
@@ -4387,7 +3871,6 @@ get_pat(VALUE pat)
break;
default:
- to_string:
val = rb_check_string_type(pat);
if (NIL_P(val)) {
Check_Type(pat, T_REGEXP);
@@ -4395,58 +3878,11 @@ get_pat(VALUE pat)
pat = val;
}
- return rb_reg_regcomp(pat);
-}
-
-static VALUE
-get_pat_quoted(VALUE pat, int check)
-{
- VALUE val;
-
- if (SPECIAL_CONST_P(pat)) goto to_string;
- switch (BUILTIN_TYPE(pat)) {
- case T_REGEXP:
- return pat;
-
- case T_STRING:
- break;
-
- default:
- to_string:
- val = rb_check_string_type(pat);
- if (NIL_P(val)) {
- Check_Type(pat, T_REGEXP);
- }
- pat = val;
+ if (quote) {
+ pat = rb_reg_quote(pat);
}
- if (check && is_broken_string(pat)) {
- rb_exc_raise(rb_reg_check_preprocess(pat));
- }
- return pat;
-}
-static long
-rb_pat_search(VALUE pat, VALUE str, long pos, int set_backref_str)
-{
- if (BUILTIN_TYPE(pat) == T_STRING) {
- pos = rb_strseq_index(str, pat, pos, 1);
- if (set_backref_str) {
- if (pos >= 0) {
- VALUE match;
- str = rb_str_new_frozen(str);
- rb_backref_set_string(str, pos, RSTRING_LEN(pat));
- match = rb_backref_get();
- OBJ_INFECT(match, pat);
- }
- else {
- rb_backref_set(Qnil);
- }
- }
- return pos;
- }
- else {
- return rb_reg_search0(pat, str, pos, 0, set_backref_str);
- }
+ return rb_reg_regcomp(pat);
}
@@ -4469,7 +3905,6 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
int tainted = 0;
long plen;
int min_arity = rb_block_given_p() ? 1 : 2;
- long beg;
rb_check_arity(argc, min_arity, 2);
if (argc == 1) {
@@ -4481,40 +3916,26 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
if (NIL_P(hash)) {
StringValue(repl);
}
- tainted = OBJ_TAINTED_RAW(repl);
+ if (OBJ_TAINTED(repl)) tainted = 1;
}
- pat = get_pat_quoted(argv[0], 1);
-
+ pat = get_pat(argv[0], 1);
str_modifiable(str);
- beg = rb_pat_search(pat, str, 0, 1);
- if (beg >= 0) {
+ if (rb_reg_search(pat, str, 0, 0) >= 0) {
rb_encoding *enc;
int cr = ENC_CODERANGE(str);
- long beg0, end0;
- VALUE match, match0 = Qnil;
- struct re_registers *regs;
+ VALUE match = rb_backref_get();
+ struct re_registers *regs = RMATCH_REGS(match);
+ long beg0 = BEG(0);
+ long end0 = END(0);
char *p, *rp;
long len, rlen;
- match = rb_backref_get();
- regs = RMATCH_REGS(match);
- if (RB_TYPE_P(pat, T_STRING)) {
- beg0 = beg;
- end0 = beg0 + RSTRING_LEN(pat);
- match0 = pat;
- }
- else {
- beg0 = BEG(0);
- end0 = END(0);
- if (iter) match0 = rb_reg_nth_match(0, match);
- }
-
if (iter || !NIL_P(hash)) {
p = RSTRING_PTR(str); len = RSTRING_LEN(str);
if (iter) {
- repl = rb_obj_as_string(rb_yield(match0));
+ repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
}
else {
repl = rb_hash_aref(hash, rb_str_subseq(str, beg0, end0 - beg0));
@@ -4524,9 +3945,8 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
rb_check_frozen(str);
}
else {
- repl = rb_reg_regsub(repl, str, regs, RB_TYPE_P(pat, T_STRING) ? Qnil : pat);
+ repl = rb_reg_regsub(repl, str, regs, pat);
}
-
enc = rb_enc_compatible(str, repl);
if (!enc) {
rb_encoding *str_enc = STR_ENC_GET(str);
@@ -4541,7 +3961,7 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
}
rb_str_modify(str);
rb_enc_associate(str, enc);
- tainted |= OBJ_TAINTED_RAW(repl);
+ if (OBJ_TAINTED(repl)) tainted = 1;
if (ENC_CODERANGE_UNKNOWN < cr && cr < ENC_CODERANGE_BROKEN) {
int cr2 = ENC_CODERANGE(repl);
if (cr2 == ENC_CODERANGE_BROKEN ||
@@ -4563,9 +3983,9 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
memcpy(p + beg0, rp, rlen);
len += rlen - plen;
STR_SET_LEN(str, len);
- TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str));
+ RSTRING_PTR(str)[len] = '\0';
ENC_CODERANGE_SET(str, cr);
- FL_SET_RAW(str, tainted);
+ if (tainted) OBJ_TAINT(str);
return str;
}
@@ -4592,9 +4012,6 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
* double-quoted string, both back-references must be preceded by an
* additional backslash. However, within +replacement+ the special match
* variables, such as <code>&$</code>, will not refer to the current match.
- * If +replacement+ is a String that looks like a pattern's capture group but
- * is actually not a pattern capture group e.g. <code>"\\'"</code>, then it
- * will have to be preceded by two backslashes like so <code>"\\\\'"</code>.
*
* If the second argument is a Hash, and the matched text is one of its keys,
* the corresponding value is the replacement string.
@@ -4626,20 +4043,20 @@ rb_str_sub(int argc, VALUE *argv, VALUE str)
static VALUE
str_gsub(int argc, VALUE *argv, VALUE str, int bang)
{
- VALUE pat, val = Qnil, repl, match, match0 = Qnil, dest, hash = Qnil;
+ VALUE pat, val, repl, match, dest, hash = Qnil;
struct re_registers *regs;
- long beg, beg0, end0;
+ long beg, n;
+ long beg0, end0;
long offset, blen, slen, len, last;
- enum {STR, ITER, MAP} mode = STR;
+ int iter = 0;
char *sp, *cp;
int tainted = 0;
- int need_backref = -1;
rb_encoding *str_enc;
switch (argc) {
case 1:
RETURN_ENUMERATOR(str, argc, argv);
- mode = ITER;
+ iter = 1;
break;
case 2:
repl = argv[1];
@@ -4647,23 +4064,21 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
if (NIL_P(hash)) {
StringValue(repl);
}
- else {
- mode = MAP;
- }
- tainted = OBJ_TAINTED_RAW(repl);
+ if (OBJ_TAINTED(repl)) tainted = 1;
break;
default:
rb_check_arity(argc, 1, 2);
}
- pat = get_pat_quoted(argv[0], 1);
- beg = rb_pat_search(pat, str, 0, need_backref);
+ pat = get_pat(argv[0], 1);
+ beg = rb_reg_search(pat, str, 0, 0);
if (beg < 0) {
if (bang) return Qnil; /* no match, no substitution */
return rb_str_dup(str);
}
offset = 0;
+ n = 0;
blen = RSTRING_LEN(str) + 30; /* len + margin */
dest = rb_str_buf_new(blen);
sp = RSTRING_PTR(str);
@@ -4674,25 +4089,17 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
ENC_CODERANGE_SET(dest, rb_enc_asciicompat(str_enc) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID);
do {
+ n++;
match = rb_backref_get();
regs = RMATCH_REGS(match);
- if (RB_TYPE_P(pat, T_STRING)) {
- beg0 = beg;
- end0 = beg0 + RSTRING_LEN(pat);
- match0 = pat;
- }
- else {
- beg0 = BEG(0);
- end0 = END(0);
- if (mode == ITER) match0 = rb_reg_nth_match(0, match);
- }
-
- if (mode) {
- if (mode == ITER) {
- val = rb_obj_as_string(rb_yield(match0));
+ beg0 = BEG(0);
+ end0 = END(0);
+ if (iter || !NIL_P(hash)) {
+ if (iter) {
+ val = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
}
else {
- val = rb_hash_aref(hash, rb_str_subseq(str, beg0, end0 - beg0));
+ val = rb_hash_aref(hash, rb_str_subseq(str, BEG(0), END(0) - BEG(0)));
val = rb_obj_as_string(val);
}
str_mod_check(str, sp, slen);
@@ -4700,17 +4107,11 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
rb_raise(rb_eRuntimeError, "block should not cheat");
}
}
- else if (need_backref) {
- val = rb_reg_regsub(repl, str, regs, RB_TYPE_P(pat, T_STRING) ? Qnil : pat);
- if (need_backref < 0) {
- need_backref = val != repl;
- }
- }
else {
- val = repl;
+ val = rb_reg_regsub(repl, str, regs, pat);
}
- tainted |= OBJ_TAINTED_RAW(val);
+ if (OBJ_TAINTED(val)) tainted = 1;
len = beg0 - offset; /* copy pre-match substr */
if (len) {
@@ -4733,22 +4134,22 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
}
cp = RSTRING_PTR(str) + offset;
if (offset > RSTRING_LEN(str)) break;
- beg = rb_pat_search(pat, str, offset, need_backref);
+ beg = rb_reg_search(pat, str, offset, 0);
} while (beg >= 0);
if (RSTRING_LEN(str) > offset) {
rb_enc_str_buf_cat(dest, cp, RSTRING_LEN(str) - offset, str_enc);
}
- rb_pat_search(pat, str, last, 1);
+ rb_reg_search(pat, str, last, 0);
if (bang) {
- str_shared_replace(str, dest);
+ rb_str_shared_replace(str, dest);
}
else {
RBASIC_SET_CLASS(dest, rb_obj_class(str));
- tainted |= OBJ_TAINTED_RAW(str);
+ OBJ_INFECT(dest, str);
str = dest;
}
- FL_SET_RAW(str, tainted);
+ if (tainted) OBJ_TAINT(str);
return str;
}
@@ -4756,7 +4157,6 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
/*
* call-seq:
* str.gsub!(pattern, replacement) -> str or nil
- * str.gsub!(pattern, hash) -> str or nil
* str.gsub!(pattern) {|match| block } -> str or nil
* str.gsub!(pattern) -> an_enumerator
*
@@ -4915,50 +4315,16 @@ rb_str_setbyte(VALUE str, VALUE index, VALUE value)
{
long pos = NUM2LONG(index);
int byte = NUM2INT(value);
- long len = RSTRING_LEN(str);
- char *head, *ptr, *left = 0;
- rb_encoding *enc;
- int cr = ENC_CODERANGE_UNKNOWN, width, nlen;
- if (pos < -len || len <= pos)
+ rb_str_modify(str);
+
+ if (pos < -RSTRING_LEN(str) || RSTRING_LEN(str) <= pos)
rb_raise(rb_eIndexError, "index %ld out of string", pos);
if (pos < 0)
- pos += len;
+ pos += RSTRING_LEN(str);
- if (!str_independent(str))
- str_make_independent(str);
- enc = STR_ENC_GET(str);
- head = RSTRING_PTR(str);
- ptr = &head[pos];
- if (len > (RSTRING_EMBED_LEN_MAX + 1 - rb_enc_mbminlen(enc))) {
- cr = ENC_CODERANGE(str);
- switch (cr) {
- case ENC_CODERANGE_7BIT:
- left = ptr;
- *ptr = byte;
- if (ISASCII(byte)) break;
- nlen = rb_enc_precise_mbclen(left, head+len, enc);
- if (!MBCLEN_CHARFOUND_P(nlen))
- ENC_CODERANGE_SET(str, ENC_CODERANGE_BROKEN);
- else
- ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID);
- goto end;
- case ENC_CODERANGE_VALID:
- left = rb_enc_left_char_head(head, ptr, head+len, enc);
- width = rb_enc_precise_mbclen(left, head+len, enc);
- *ptr = byte;
- nlen = rb_enc_precise_mbclen(left, head+len, enc);
- if (!MBCLEN_CHARFOUND_P(nlen))
- ENC_CODERANGE_SET(str, ENC_CODERANGE_BROKEN);
- else if (MBCLEN_CHARFOUND_LEN(nlen) != width || ISASCII(byte))
- ENC_CODERANGE_CLEAR(str);
- goto end;
- }
- }
- ENC_CODERANGE_CLEAR(str);
- *ptr = byte;
+ RSTRING_PTR(str)[pos] = byte;
- end:
return value;
}
@@ -4983,14 +4349,14 @@ str_byte_substr(VALUE str, long beg, long len)
else
p = s + beg;
- if (len > (RSTRING_EMBED_LEN_MAX + 1 - TERM_LEN(str)) && SHARABLE_SUBSTRING_P(beg, len, n)) {
- str2 = rb_str_new_frozen(str);
- str2 = str_new_shared(rb_obj_class(str2), str2);
- RSTRING(str2)->as.heap.ptr += beg;
+ if (len > RSTRING_EMBED_LEN_MAX && beg + len == n) {
+ str2 = rb_str_new4(str);
+ str2 = str_new3(rb_obj_class(str2), str2);
+ RSTRING(str2)->as.heap.ptr += RSTRING(str2)->as.heap.len - len;
RSTRING(str2)->as.heap.len = len;
}
else {
- str2 = rb_str_new_with_class(str, p, len);
+ str2 = rb_str_new5(str, p, len);
}
str_enc_copy(str2, str);
@@ -5012,7 +4378,7 @@ str_byte_substr(VALUE str, long beg, long len)
}
}
- OBJ_INFECT_RAW(str2, str);
+ OBJ_INFECT(str2, str);
return str2;
}
@@ -5099,14 +4465,13 @@ rb_str_reverse(VALUE str)
rb_encoding *enc;
VALUE rev;
char *s, *e, *p;
- int cr;
+ int single = 1;
if (RSTRING_LEN(str) <= 1) return rb_str_dup(str);
enc = STR_ENC_GET(str);
- rev = rb_str_new_with_class(str, 0, RSTRING_LEN(str));
+ rev = rb_str_new5(str, 0, RSTRING_LEN(str));
s = RSTRING_PTR(str); e = RSTRING_END(str);
p = RSTRING_END(rev);
- cr = ENC_CODERANGE(str);
if (RSTRING_LEN(str) > 1) {
if (single_byte_optimizable(str)) {
@@ -5114,22 +4479,21 @@ rb_str_reverse(VALUE str)
*--p = *s++;
}
}
- else if (cr == ENC_CODERANGE_VALID) {
+ else if (ENC_CODERANGE(str) == ENC_CODERANGE_VALID) {
while (s < e) {
int clen = rb_enc_fast_mbclen(s, e, enc);
+ if (clen > 1 || (*s & 0x80)) single = 0;
p -= clen;
memcpy(p, s, clen);
s += clen;
}
}
else {
- cr = rb_enc_asciicompat(enc) ?
- ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID;
while (s < e) {
int clen = rb_enc_mbclen(s, e, enc);
- if (clen > 1 || (*s & 0x80)) cr = ENC_CODERANGE_UNKNOWN;
+ if (clen > 1 || (*s & 0x80)) single = 0;
p -= clen;
memcpy(p, s, clen);
s += clen;
@@ -5137,9 +4501,16 @@ rb_str_reverse(VALUE str)
}
}
STR_SET_LEN(rev, RSTRING_LEN(str));
- OBJ_INFECT_RAW(rev, str);
- str_enc_copy(rev, str);
- ENC_CODERANGE_SET(rev, cr);
+ OBJ_INFECT(rev, str);
+ if (ENC_CODERANGE(str) == ENC_CODERANGE_UNKNOWN) {
+ if (single) {
+ ENC_CODERANGE_SET(str, ENC_CODERANGE_7BIT);
+ }
+ else {
+ ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID);
+ }
+ }
+ rb_enc_cr_str_copy_for_substr(rev, str);
return rev;
}
@@ -5169,7 +4540,7 @@ rb_str_reverse_bang(VALUE str)
}
}
else {
- str_shared_replace(str, rb_str_reverse(str));
+ rb_str_shared_replace(str, rb_str_reverse(str));
}
}
else {
@@ -5270,9 +4641,7 @@ rb_str_to_f(VALUE str)
* str.to_s -> str
* str.to_str -> str
*
- * Returns +self+.
- *
- * If called on a subclass of String, converts the receiver to a String object.
+ * Returns the receiver.
*/
static VALUE
@@ -5331,70 +4700,6 @@ rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p)
return l;
}
-VALUE
-rb_str_escape(VALUE str)
-{
- int encidx = ENCODING_GET(str);
- rb_encoding *enc = rb_enc_from_index(encidx);
- const char *p = RSTRING_PTR(str);
- const char *pend = RSTRING_END(str);
- const char *prev = p;
- char buf[CHAR_ESC_LEN + 1];
- VALUE result = rb_str_buf_new(0);
- int unicode_p = rb_enc_unicode_p(enc);
- int asciicompat = rb_enc_asciicompat(enc);
-
- while (p < pend) {
- unsigned int c, cc;
- int n = rb_enc_precise_mbclen(p, pend, enc);
- if (!MBCLEN_CHARFOUND_P(n)) {
- if (p > prev) str_buf_cat(result, prev, p - prev);
- n = rb_enc_mbminlen(enc);
- if (pend < p + n)
- n = (int)(pend - p);
- while (n--) {
- snprintf(buf, CHAR_ESC_LEN, "\\x%02X", *p & 0377);
- str_buf_cat(result, buf, strlen(buf));
- prev = ++p;
- }
- continue;
- }
- n = MBCLEN_CHARFOUND_LEN(n);
- c = rb_enc_mbc_to_codepoint(p, pend, enc);
- p += n;
- switch (c) {
- case '\n': cc = 'n'; break;
- case '\r': cc = 'r'; break;
- case '\t': cc = 't'; break;
- case '\f': cc = 'f'; break;
- case '\013': cc = 'v'; break;
- case '\010': cc = 'b'; break;
- case '\007': cc = 'a'; break;
- case 033: cc = 'e'; break;
- default: cc = 0; break;
- }
- if (cc) {
- if (p - n > prev) str_buf_cat(result, prev, p - n - prev);
- buf[0] = '\\';
- buf[1] = (char)cc;
- str_buf_cat(result, buf, 2);
- prev = p;
- }
- else if (asciicompat && rb_enc_isascii(c, enc) && ISPRINT(c)) {
- }
- else {
- if (p - n > prev) str_buf_cat(result, prev, p - n - prev);
- rb_str_buf_cat_escaped_char(result, c, unicode_p);
- prev = p;
- }
- }
- if (p > prev) str_buf_cat(result, prev, p - prev);
- ENCODING_CODERANGE_SET(result, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
-
- OBJ_INFECT_RAW(result, str);
- return result;
-}
-
/*
* call-seq:
* str.inspect -> string
@@ -5410,8 +4715,8 @@ rb_str_escape(VALUE str)
VALUE
rb_str_inspect(VALUE str)
{
- int encidx = ENCODING_GET(str);
- rb_encoding *enc = rb_enc_from_index(encidx), *actenc;
+ rb_encoding *enc = STR_ENC_GET(str);
+ int encidx = rb_enc_to_index(enc);
const char *p, *pend, *prev;
char buf[CHAR_ESC_LEN + 1];
VALUE result = rb_str_buf_new(0);
@@ -5426,10 +4731,27 @@ rb_str_inspect(VALUE str)
p = RSTRING_PTR(str); pend = RSTRING_END(str);
prev = p;
- actenc = get_actual_encoding(encidx, str);
- if (actenc != enc) {
- enc = actenc;
- if (unicode_p) unicode_p = rb_enc_unicode_p(enc);
+ if (encidx == ENCINDEX_UTF_16 && p + 2 <= pend) {
+ const unsigned char *q = (const unsigned char *)p;
+ if (q[0] == 0xFE && q[1] == 0xFF)
+ enc = rb_enc_from_index(ENCINDEX_UTF_16BE);
+ else if (q[0] == 0xFF && q[1] == 0xFE)
+ enc = rb_enc_from_index(ENCINDEX_UTF_16LE);
+ else {
+ enc = rb_ascii8bit_encoding();
+ unicode_p = 0;
+ }
+ }
+ else if (encidx == ENCINDEX_UTF_32 && p + 4 <= pend) {
+ const unsigned char *q = (const unsigned char *)p;
+ if (q[0] == 0 && q[1] == 0 && q[2] == 0xFE && q[3] == 0xFF)
+ enc = rb_enc_from_index(ENCINDEX_UTF_32BE);
+ else if (q[3] == 0 && q[2] == 0 && q[1] == 0xFE && q[0] == 0xFF)
+ enc = rb_enc_from_index(ENCINDEX_UTF_32LE);
+ else {
+ enc = rb_ascii8bit_encoding();
+ unicode_p = 0;
+ }
}
while (p < pend) {
unsigned int c, cc;
@@ -5498,7 +4820,7 @@ rb_str_inspect(VALUE str)
if (p > prev) str_buf_cat(result, prev, p - prev);
str_buf_cat2(result, "\"");
- OBJ_INFECT_RAW(result, str);
+ OBJ_INFECT(result, str);
return result;
}
@@ -5565,7 +4887,7 @@ rb_str_dump(VALUE str)
len += strlen(enc->name);
}
- result = rb_str_new_with_class(str, 0, len);
+ result = rb_str_new5(str, 0, len);
p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str);
q = RSTRING_PTR(result); qend = q + len + 1;
@@ -5638,7 +4960,7 @@ rb_str_dump(VALUE str)
snprintf(q, qend-q, ".force_encoding(\"%s\")", enc->name);
enc = rb_ascii8bit_encoding();
}
- OBJ_INFECT_RAW(result, str);
+ OBJ_INFECT(result, str);
/* result from dump is ASCII */
rb_enc_associate(result, enc);
ENC_CODERANGE_SET(result, ENC_CODERANGE_7BIT);
@@ -6031,7 +5353,6 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
char *s, *send;
VALUE hash = 0;
int singlebyte = single_byte_optimizable(str);
- int termlen;
int cr;
#define CHECK_IF_ASCII(c) \
@@ -6113,12 +5434,11 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
cr = ENC_CODERANGE_7BIT;
str_modify_keep_cr(str);
s = RSTRING_PTR(str); send = RSTRING_END(str);
- termlen = rb_enc_mbminlen(enc);
if (sflag) {
int clen, tlen;
long offset, max = RSTRING_LEN(str);
unsigned int save = -1;
- char *buf = ALLOC_N(char, max + termlen), *t = buf;
+ char *buf = ALLOC_N(char, max), *t = buf;
while (s < send) {
int may_modify = 0;
@@ -6159,7 +5479,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
while (t - buf + tlen >= max) {
offset = t - buf;
max *= 2;
- REALLOC_N(buf, char, max + termlen);
+ REALLOC_N(buf, char, max);
t = buf + offset;
}
rb_enc_mbcput(c, t, enc);
@@ -6172,7 +5492,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
if (!STR_EMBED_P(str)) {
ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
- TERM_FILL(t, termlen);
+ *t = '\0';
RSTRING(str)->as.heap.ptr = buf;
RSTRING(str)->as.heap.len = t - buf;
STR_SET_NOEMBED(str);
@@ -6197,9 +5517,9 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
}
}
else {
- int clen, tlen;
- long offset, max = (long)((send - s) * 1.2);
- char *buf = ALLOC_N(char, max + termlen), *t = buf;
+ int clen, tlen, max = (int)(RSTRING_LEN(str) * 1.2);
+ long offset;
+ char *buf = ALLOC_N(char, max), *t = buf;
while (s < send) {
int may_modify = 0;
@@ -6232,7 +5552,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
while (t - buf + tlen >= max) {
offset = t - buf;
max *= 2;
- REALLOC_N(buf, char, max + termlen);
+ REALLOC_N(buf, char, max);
t = buf + offset;
}
if (s != t) {
@@ -6248,7 +5568,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
if (!STR_EMBED_P(str)) {
ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
- TERM_FILL(t, termlen);
+ *t = '\0';
RSTRING(str)->as.heap.ptr = buf;
RSTRING(str)->as.heap.len = t - buf;
STR_SET_NOEMBED(str);
@@ -6301,7 +5621,7 @@ rb_str_tr_bang(VALUE str, VALUE src, VALUE repl)
* "hello".tr('a-y', 'b-z') #=> "ifmmp"
* "hello".tr('^aeiou', '*') #=> "*e**o"
*
- * The backslash character <code>\\</code> can be used to escape
+ * The backslash character <code>\</code> can be used to escape
* <code>^</code> or <code>-</code> and is otherwise ignored unless it
* appears at the end of a range or the end of the +from_str+ or +to_str+:
*
@@ -6472,7 +5792,7 @@ rb_str_delete_bang(int argc, VALUE *argv, VALUE str)
s += clen;
}
}
- TERM_FILL(t, TERM_LEN(str));
+ *t = '\0';
STR_SET_LEN(str, t - RSTRING_PTR(str));
ENC_CODERANGE_SET(str, cr);
@@ -6552,8 +5872,7 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
*t++ = save = c;
}
}
- }
- else {
+ } else {
while (s < send) {
unsigned int c;
int clen;
@@ -6577,7 +5896,7 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
}
}
- TERM_FILL(t, TERM_LEN(str));
+ *t = '\0';
if (t - RSTRING_PTR(str) != RSTRING_LEN(str)) {
STR_SET_LEN(str, t - RSTRING_PTR(str));
modify = 1;
@@ -6657,7 +5976,7 @@ rb_str_tr_s(VALUE str, VALUE src, VALUE repl)
* intersection of these sets defines the characters to count in +str+. Any
* +other_str+ that starts with a caret <code>^</code> is negated. The
* sequence <code>c1-c2</code> means all characters between c1 and c2. The
- * backslash character <code>\\</code> can be used to escape <code>^</code> or
+ * backslash character <code>\</code> can be used to escape <code>^</code> or
* <code>-</code> and is otherwise ignored unless it appears at the end of a
* sequence or the end of a +other_str+.
*
@@ -6681,25 +6000,21 @@ rb_str_count(int argc, VALUE *argv, VALUE str)
{
char table[TR_TABLE_SIZE];
rb_encoding *enc = 0;
- VALUE del = 0, nodel = 0, tstr;
+ VALUE del = 0, nodel = 0;
char *s, *send;
int i;
int ascompat;
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
+ for (i=0; i<argc; i++) {
+ VALUE tstr = argv[i];
+ unsigned char c;
- tstr = argv[0];
- StringValue(tstr);
- enc = rb_enc_check(str, tstr);
- if (argc == 1) {
- const char *ptstr;
- if (RSTRING_LEN(tstr) == 1 && rb_enc_asciicompat(enc) &&
- (ptstr = RSTRING_PTR(tstr),
- ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc, (const unsigned char *)ptstr, (const unsigned char *)ptstr+1)) &&
- !is_broken_string(str)) {
+ StringValue(tstr);
+ enc = rb_enc_check(str, tstr);
+ if (argc == 1 && RSTRING_LEN(tstr) == 1 && rb_enc_asciicompat(enc) &&
+ (c = RSTRING_PTR(tstr)[0]) < 0x80 && !is_broken_string(str)) {
int n = 0;
- int clen;
- unsigned char c = rb_enc_codepoint_len(ptstr, ptstr+1, &clen, enc);
s = RSTRING_PTR(str);
if (!s || RSTRING_LEN(str) == 0) return INT2FIX(0);
@@ -6709,14 +6024,7 @@ rb_str_count(int argc, VALUE *argv, VALUE str)
}
return INT2NUM(n);
}
- }
-
- tr_setup_table(tstr, table, TRUE, &del, &nodel, enc);
- for (i=1; i<argc; i++) {
- tstr = argv[i];
- StringValue(tstr);
- enc = rb_enc_check(str, tstr);
- tr_setup_table(tstr, table, FALSE, &del, &nodel, enc);
+ tr_setup_table(tstr, table, i==0, &del, &nodel, enc);
}
s = RSTRING_PTR(str);
@@ -6769,7 +6077,7 @@ static const char isspacetable[256] = {
/*
* call-seq:
- * str.split(pattern=nil, [limit]) -> an_array
+ * str.split(pattern=$;, [limit]) -> anArray
*
* Divides <i>str</i> into substrings based on a delimiter, returning an array
* of these substrings.
@@ -6784,16 +6092,14 @@ static const char isspacetable[256] = {
* <i>str</i> is split into individual characters. If <i>pattern</i> contains
* groups, the respective matches will be returned in the array as well.
*
- * If <i>pattern</i> is <code>nil</code>, the value of <code>$;</code> is used.
- * If <code>$;</code> is <code>nil</code> (which is the default), <i>str</i> is
+ * If <i>pattern</i> is omitted, the value of <code>$;</code> is used. If
+ * <code>$;</code> is <code>nil</code> (which is the default), <i>str</i> is
* split on whitespace as if ` ' were specified.
*
* If the <i>limit</i> parameter is omitted, trailing null fields are
- * suppressed. If <i>limit</i> is a positive number, at most that number
- * of split substrings will be returned (captured groups will be returned
- * as well, but are not counted towards the limit).
- * If <i>limit</i> is <code>1</code>, the entire
- * string is returned as the only entry in an array. If negative, there is no
+ * suppressed. If <i>limit</i> is a positive number, at most that number of
+ * fields will be returned (if <i>limit</i> is <code>1</code>, the entire
+ * string is returned as the only entry in an array). If negative, there is no
* limit to the number of fields returned, and trailing null fields are not
* suppressed.
*
@@ -6813,8 +6119,6 @@ static const char isspacetable[256] = {
* "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"]
* "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""]
*
- * "1:2:3".split(/(:)()()/, 2) #=> ["1", ":", "", "", "2:3"]
- *
* "".split(',', -1) #=> []
*/
@@ -6841,15 +6145,18 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
}
enc = STR_ENC_GET(str);
- if (NIL_P(spat) && NIL_P(spat = rb_fs)) {
+ if (NIL_P(spat)) {
+ if (!NIL_P(rb_fs)) {
+ spat = rb_fs;
+ goto fs_set;
+ }
split_type = awk;
}
else {
- spat = get_pat_quoted(spat, 0);
- if (BUILTIN_TYPE(spat) == T_STRING) {
+ fs_set:
+ if (RB_TYPE_P(spat, T_STRING)) {
rb_encoding *enc2 = STR_ENC_GET(spat);
- mustnot_broken(spat);
split_type = string;
if (RSTRING_LEN(spat) == 0) {
/* Special case - split into chars */
@@ -6870,6 +6177,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
}
}
else {
+ spat = get_pat(spat, 1);
split_type = regexp;
}
}
@@ -6943,7 +6251,12 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
char *sptr = RSTRING_PTR(spat);
long slen = RSTRING_LEN(spat);
- mustnot_broken(str);
+ if (is_broken_string(str)) {
+ rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(STR_ENC_GET(str)));
+ }
+ if (is_broken_string(spat)) {
+ rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(STR_ENC_GET(spat)));
+ }
enc = rb_enc_check(str, spat);
while (ptr < eptr &&
(end = rb_memsearch(sptr, slen, ptr, eptr - ptr, enc)) >= 0) {
@@ -6982,7 +6295,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
beg = start;
}
else {
- if (start == len)
+ if (ptr+start == ptr+len)
start++;
else
start += rb_enc_fast_mbclen(ptr+start,ptr+len,enc);
@@ -7030,7 +6343,7 @@ rb_str_split(VALUE str, const char *sep0)
VALUE sep;
StringValue(str);
- sep = rb_str_new_cstr(sep0);
+ sep = rb_str_new2(sep0);
return rb_str_split_m(1, &sep, str);
}
@@ -7066,7 +6379,7 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray)
if (wantarray)
ary = rb_ary_new();
else
- return SIZED_ENUMERATOR(str, argc, argv, 0);
+ RETURN_ENUMERATOR(str, argc, argv);
}
if (NIL_P(rs)) {
@@ -7080,7 +6393,7 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray)
}
}
- str = rb_str_new_frozen(str);
+ str = rb_str_new4(str);
ptr = subptr = RSTRING_PTR(str);
pend = RSTRING_END(str);
len = RSTRING_LEN(str);
@@ -7235,7 +6548,7 @@ rb_str_enumerate_bytes(VALUE str, int wantarray)
if (wantarray)
ary = rb_ary_new2(RSTRING_LEN(str));
else
- return SIZED_ENUMERATOR(str, 0, 0, rb_str_each_byte_size);
+ RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_byte_size);
}
for (i=0; i<RSTRING_LEN(str); i++) {
@@ -7304,7 +6617,7 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
rb_encoding *enc;
VALUE UNINITIALIZED_VAR(ary);
- str = rb_str_new_frozen(str);
+ str = rb_str_new4(str);
ptr = RSTRING_PTR(str);
len = RSTRING_LEN(str);
enc = rb_enc_get(str);
@@ -7313,7 +6626,7 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
if (wantarray) {
#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
- ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
+ ary = rb_ary_new_capa(str_strlen(str, enc));
#else
rb_warning("passing a block to String#chars is deprecated");
wantarray = 0;
@@ -7322,12 +6635,14 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
}
else {
if (wantarray)
- ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
+ ary = rb_ary_new_capa(str_strlen(str, enc));
else
- return SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
+ RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
}
- if (ENC_CODERANGE_CLEAN_P(ENC_CODERANGE(str))) {
+ switch (ENC_CODERANGE(str)) {
+ case ENC_CODERANGE_VALID:
+ case ENC_CODERANGE_7BIT:
for (i = 0; i < len; i += n) {
n = rb_enc_fast_mbclen(ptr + i, ptr + len, enc);
substr = rb_str_subseq(str, i, n);
@@ -7336,8 +6651,8 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
else
rb_yield(substr);
}
- }
- else {
+ break;
+ default:
for (i = 0; i < len; i += n) {
n = rb_enc_mbclen(ptr + i, ptr + len, enc);
substr = rb_str_subseq(str, i, n);
@@ -7406,7 +6721,7 @@ rb_str_enumerate_codepoints(VALUE str, int wantarray)
if (single_byte_optimizable(str))
return rb_str_enumerate_bytes(str, wantarray);
- str = rb_str_new_frozen(str);
+ str = rb_str_new4(str);
ptr = RSTRING_PTR(str);
end = RSTRING_END(str);
enc = STR_ENC_GET(str);
@@ -7415,7 +6730,7 @@ rb_str_enumerate_codepoints(VALUE str, int wantarray)
if (wantarray) {
#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
- ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
+ ary = rb_ary_new_capa(str_strlen(str, enc));
#else
rb_warning("passing a block to String#codepoints is deprecated");
wantarray = 0;
@@ -7424,9 +6739,9 @@ rb_str_enumerate_codepoints(VALUE str, int wantarray)
}
else {
if (wantarray)
- ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
+ ary = rb_ary_new_capa(str_strlen(str, enc));
else
- return SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
+ RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
}
while (ptr < end) {
@@ -7522,7 +6837,7 @@ rb_str_chop_bang(VALUE str)
long len;
len = chopped_length(str);
STR_SET_LEN(str, len);
- TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str));
+ RSTRING_PTR(str)[len] = '\0';
if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
ENC_CODERANGE_CLEAR(str);
}
@@ -7556,144 +6871,110 @@ rb_str_chop(VALUE str)
}
-static long
-chompped_length(VALUE str, VALUE rs)
+/*
+ * call-seq:
+ * str.chomp!(separator=$/) -> str or nil
+ *
+ * Modifies <i>str</i> in place as described for <code>String#chomp</code>,
+ * returning <i>str</i>, or <code>nil</code> if no modifications were made.
+ */
+
+static VALUE
+rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
{
rb_encoding *enc;
+ VALUE rs;
int newline;
- char *pp, *e, *rsptr;
- long rslen;
- char *const p = RSTRING_PTR(str);
- long len = RSTRING_LEN(str);
+ char *p, *pp, *e;
+ long len, rslen;
- if (len == 0) return 0;
+ str_modify_keep_cr(str);
+ len = RSTRING_LEN(str);
+ if (len == 0) return Qnil;
+ p = RSTRING_PTR(str);
e = p + len;
- if (rs == rb_default_rs) {
- smart_chomp:
- enc = rb_enc_get(str);
- if (rb_enc_mbminlen(enc) > 1) {
- pp = rb_enc_left_char_head(p, e-rb_enc_mbminlen(enc), e, enc);
- if (rb_enc_is_newline(pp, e, enc)) {
- e = pp;
- }
- pp = e - rb_enc_mbminlen(enc);
- if (pp >= p) {
- pp = rb_enc_left_char_head(p, pp, e, enc);
- if (rb_enc_ascget(pp, e, 0, enc) == '\r') {
+ if (argc == 0) {
+ rs = rb_rs;
+ if (rs == rb_default_rs) {
+ smart_chomp:
+ enc = rb_enc_get(str);
+ if (rb_enc_mbminlen(enc) > 1) {
+ pp = rb_enc_left_char_head(p, e-rb_enc_mbminlen(enc), e, enc);
+ if (rb_enc_is_newline(pp, e, enc)) {
e = pp;
}
- }
- }
- else {
- switch (*(e-1)) { /* not e[-1] to get rid of VC bug */
- case '\n':
- if (--e > p && *(e-1) == '\r') {
- --e;
- }
- break;
- case '\r':
- --e;
- break;
- }
- }
- return e - p;
- }
-
- enc = rb_enc_get(str);
- RSTRING_GETMEM(rs, rsptr, rslen);
- if (rslen == 0) {
- if (rb_enc_mbminlen(enc) > 1) {
- while (e > p) {
- pp = rb_enc_left_char_head(p, e-rb_enc_mbminlen(enc), e, enc);
- if (!rb_enc_is_newline(pp, e, enc)) break;
- e = pp;
- pp -= rb_enc_mbminlen(enc);
+ pp = e - rb_enc_mbminlen(enc);
if (pp >= p) {
pp = rb_enc_left_char_head(p, pp, e, enc);
if (rb_enc_ascget(pp, e, 0, enc) == '\r') {
e = pp;
}
}
+ if (e == RSTRING_END(str)) {
+ return Qnil;
+ }
+ len = e - RSTRING_PTR(str);
+ STR_SET_LEN(str, len);
}
- }
- else {
- while (e > p && *(e-1) == '\n') {
- --e;
- if (e > p && *(e-1) == '\r')
- --e;
+ else {
+ if (RSTRING_PTR(str)[len-1] == '\n') {
+ STR_DEC_LEN(str);
+ if (RSTRING_LEN(str) > 0 &&
+ RSTRING_PTR(str)[RSTRING_LEN(str)-1] == '\r') {
+ STR_DEC_LEN(str);
+ }
+ }
+ else if (RSTRING_PTR(str)[len-1] == '\r') {
+ STR_DEC_LEN(str);
+ }
+ else {
+ return Qnil;
+ }
}
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+ return str;
}
- return e - p;
}
- if (rslen > len) return len;
-
- enc = rb_enc_get(rs);
- newline = rsptr[rslen-1];
- if (rslen == rb_enc_mbminlen(enc)) {
- if (rslen == 1) {
- if (newline == '\n')
- goto smart_chomp;
+ else {
+ rb_scan_args(argc, argv, "01", &rs);
+ }
+ if (NIL_P(rs)) return Qnil;
+ StringValue(rs);
+ rslen = RSTRING_LEN(rs);
+ if (rslen == 0) {
+ while (len>0 && p[len-1] == '\n') {
+ len--;
+ if (len>0 && p[len-1] == '\r')
+ len--;
}
- else {
- if (rb_enc_is_newline(rsptr, rsptr+rslen, enc))
- goto smart_chomp;
+ if (len < RSTRING_LEN(str)) {
+ STR_SET_LEN(str, len);
+ RSTRING_PTR(str)[len] = '\0';
+ return str;
}
+ return Qnil;
}
+ if (rslen > len) return Qnil;
+ newline = RSTRING_PTR(rs)[rslen-1];
+ if (rslen == 1 && newline == '\n')
+ goto smart_chomp;
enc = rb_enc_check(str, rs);
if (is_broken_string(rs)) {
- return len;
+ return Qnil;
}
pp = e - rslen;
if (p[len-1] == newline &&
(rslen <= 1 ||
- memcmp(rsptr, pp, rslen) == 0)) {
- if (rb_enc_left_char_head(p, pp, e, enc) == pp)
- return len - rslen;
- RB_GC_GUARD(rs);
- }
- return len;
-}
-
-static VALUE
-chomp_rs(int argc, const VALUE *argv)
-{
- rb_check_arity(argc, 0, 1);
- if (argc > 0) {
- VALUE rs = argv[0];
- if (!NIL_P(rs)) StringValue(rs);
- return rs;
- }
- else {
- return rb_rs;
- }
-}
-
-/*
- * call-seq:
- * str.chomp!(separator=$/) -> str or nil
- *
- * Modifies <i>str</i> in place as described for <code>String#chomp</code>,
- * returning <i>str</i>, or <code>nil</code> if no modifications were made.
- */
-
-static VALUE
-rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
-{
- VALUE rs;
- long olen;
- str_modify_keep_cr(str);
- if ((olen = RSTRING_LEN(str)) > 0 && !NIL_P(rs = chomp_rs(argc, argv))) {
- long len;
- len = chompped_length(str, rs);
- if (len < olen) {
- STR_SET_LEN(str, len);
- TERM_FILL(&RSTRING_PTR(str)[len], TERM_LEN(str));
- if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
- ENC_CODERANGE_CLEAR(str);
- }
- return str;
+ memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
+ if (rb_enc_left_char_head(p, pp, e, enc) != pp)
+ return Qnil;
+ if (ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
+ ENC_CODERANGE_CLEAR(str);
}
+ STR_SET_LEN(str, RSTRING_LEN(str) - rslen);
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
+ return str;
}
return Qnil;
}
@@ -7707,43 +6988,23 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
* from the end of <i>str</i> (if present). If <code>$/</code> has not been
* changed from the default Ruby record separator, then <code>chomp</code> also
* removes carriage return characters (that is it will remove <code>\n</code>,
- * <code>\r</code>, and <code>\r\n</code>). If <code>$/</code> is an empty string,
- * it will remove all trailing newlines from the string.
- *
- * "hello".chomp #=> "hello"
- * "hello\n".chomp #=> "hello"
- * "hello\r\n".chomp #=> "hello"
- * "hello\n\r".chomp #=> "hello\n"
- * "hello\r".chomp #=> "hello"
- * "hello \n there".chomp #=> "hello \n there"
- * "hello".chomp("llo") #=> "he"
- * "hello\r\n\r\n".chomp('') #=> "hello"
- * "hello\r\n\r\r\n".chomp('') #=> "hello\r\n\r"
+ * <code>\r</code>, and <code>\r\n</code>).
+ *
+ * "hello".chomp #=> "hello"
+ * "hello\n".chomp #=> "hello"
+ * "hello\r\n".chomp #=> "hello"
+ * "hello\n\r".chomp #=> "hello\n"
+ * "hello\r".chomp #=> "hello"
+ * "hello \n there".chomp #=> "hello \n there"
+ * "hello".chomp("llo") #=> "he"
*/
static VALUE
rb_str_chomp(int argc, VALUE *argv, VALUE str)
{
- VALUE rs = chomp_rs(argc, argv);
- if (NIL_P(rs)) return rb_str_dup(str);
- return rb_str_subseq(str, 0, chompped_length(str, rs));
-}
-
-static long
-lstrip_offset(VALUE str, const char *s, const char *e, rb_encoding *enc)
-{
- const char *const start = s;
-
- if (!s || s >= e) return 0;
- /* remove spaces at head */
- while (s < e) {
- int n;
- unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
-
- if (!rb_isspace(cc)) break;
- s += n;
- }
- return s - start;
+ str = rb_str_dup(str);
+ rb_str_chomp_bang(argc, argv, str);
+ return str;
}
/*
@@ -7754,8 +7015,6 @@ lstrip_offset(VALUE str, const char *s, const char *e, rb_encoding *enc)
* change was made. See also <code>String#rstrip!</code> and
* <code>String#strip!</code>.
*
- * Refer to <code>strip</code> for the definition of whitespace.
- *
* " hello ".lstrip #=> "hello "
* "hello".lstrip! #=> nil
*/
@@ -7764,21 +7023,26 @@ static VALUE
rb_str_lstrip_bang(VALUE str)
{
rb_encoding *enc;
- char *start, *s;
- long olen, loffset;
+ char *s, *t, *e;
str_modify_keep_cr(str);
enc = STR_ENC_GET(str);
- RSTRING_GETMEM(str, start, olen);
- loffset = lstrip_offset(str, start, start+olen, enc);
- if (loffset > 0) {
- long len = olen-loffset;
- s = start + loffset;
- memmove(start, s, len);
- STR_SET_LEN(str, len);
-#if !SHARABLE_MIDDLE_SUBSTRING
- TERM_FILL(start+len, rb_enc_mbminlen(enc));
-#endif
+ s = RSTRING_PTR(str);
+ if (!s || RSTRING_LEN(str) == 0) return Qnil;
+ e = t = RSTRING_END(str);
+ /* remove spaces at head */
+ while (s < e) {
+ int n;
+ unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
+
+ if (!rb_isspace(cc)) break;
+ s += n;
+ }
+
+ if (s > RSTRING_PTR(str)) {
+ STR_SET_LEN(str, t-s);
+ memmove(RSTRING_PTR(str), s, RSTRING_LEN(str));
+ RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0';
return str;
}
return Qnil;
@@ -7792,8 +7056,6 @@ rb_str_lstrip_bang(VALUE str)
* Returns a copy of <i>str</i> with leading whitespace removed. See also
* <code>String#rstrip</code> and <code>String#strip</code>.
*
- * Refer to <code>strip</code> for the definition of whitespace.
- *
* " hello ".lstrip #=> "hello "
* "hello".lstrip #=> "hello"
*/
@@ -7801,39 +7063,11 @@ rb_str_lstrip_bang(VALUE str)
static VALUE
rb_str_lstrip(VALUE str)
{
- char *start;
- long len, loffset;
- RSTRING_GETMEM(str, start, len);
- loffset = lstrip_offset(str, start, start+len, STR_ENC_GET(str));
- if (loffset <= 0) return rb_str_dup(str);
- return rb_str_subseq(str, loffset, len - loffset);
+ str = rb_str_dup(str);
+ rb_str_lstrip_bang(str);
+ return str;
}
-static long
-rstrip_offset(VALUE str, const char *s, const char *e, rb_encoding *enc)
-{
- const char *t;
-
- rb_str_check_dummy_enc(enc);
- if (!s || s >= e) return 0;
- t = e;
-
- /* remove trailing spaces or '\0's */
- if (single_byte_optimizable(str)) {
- unsigned char c;
- while (s < t && ((c = *(t-1)) == '\0' || ascii_isspace(c))) t--;
- }
- else {
- char *tp;
-
- while ((tp = rb_enc_prev_char(s, t, e, enc)) != NULL) {
- unsigned int c = rb_enc_codepoint(tp, e, enc);
- if (c && !rb_isspace(c)) break;
- t = tp;
- }
- }
- return e - t;
-}
/*
* call-seq:
@@ -7843,8 +7077,6 @@ rstrip_offset(VALUE str, const char *s, const char *e, rb_encoding *enc)
* no change was made. See also <code>String#lstrip!</code> and
* <code>String#strip!</code>.
*
- * Refer to <code>strip</code> for the definition of whitespace.
- *
* " hello ".rstrip #=> " hello"
* "hello".rstrip! #=> nil
*/
@@ -7853,20 +7085,34 @@ static VALUE
rb_str_rstrip_bang(VALUE str)
{
rb_encoding *enc;
- char *start;
- long olen, roffset;
+ char *s, *t, *e;
str_modify_keep_cr(str);
enc = STR_ENC_GET(str);
- RSTRING_GETMEM(str, start, olen);
- roffset = rstrip_offset(str, start, start+olen, enc);
- if (roffset > 0) {
- long len = olen - roffset;
+ rb_str_check_dummy_enc(enc);
+ s = RSTRING_PTR(str);
+ if (!s || RSTRING_LEN(str) == 0) return Qnil;
+ t = e = RSTRING_END(str);
+
+ /* remove trailing spaces or '\0's */
+ if (single_byte_optimizable(str)) {
+ unsigned char c;
+ while (s < t && ((c = *(t-1)) == '\0' || ascii_isspace(c))) t--;
+ }
+ else {
+ char *tp;
+
+ while ((tp = rb_enc_prev_char(s, t, e, enc)) != NULL) {
+ unsigned int c = rb_enc_codepoint(tp, e, enc);
+ if (c && !rb_isspace(c)) break;
+ t = tp;
+ }
+ }
+ if (t < e) {
+ long len = t-RSTRING_PTR(str);
STR_SET_LEN(str, len);
-#if !SHARABLE_MIDDLE_SUBSTRING
- TERM_FILL(start+len, rb_enc_mbminlen(enc));
-#endif
+ RSTRING_PTR(str)[len] = '\0';
return str;
}
return Qnil;
@@ -7880,8 +7126,6 @@ rb_str_rstrip_bang(VALUE str)
* Returns a copy of <i>str</i> with trailing whitespace removed. See also
* <code>String#lstrip</code> and <code>String#strip</code>.
*
- * Refer to <code>strip</code> for the definition of whitespace.
- *
* " hello ".rstrip #=> " hello"
* "hello".rstrip #=> "hello"
*/
@@ -7889,16 +7133,9 @@ rb_str_rstrip_bang(VALUE str)
static VALUE
rb_str_rstrip(VALUE str)
{
- rb_encoding *enc;
- char *start;
- long olen, roffset;
-
- enc = STR_ENC_GET(str);
- RSTRING_GETMEM(str, start, olen);
- roffset = rstrip_offset(str, start, start+olen, enc);
-
- if (roffset <= 0) return rb_str_dup(str);
- return rb_str_subseq(str, 0, olen-roffset);
+ str = rb_str_dup(str);
+ rb_str_rstrip_bang(str);
+ return str;
}
@@ -7908,36 +7145,16 @@ rb_str_rstrip(VALUE str)
*
* Removes leading and trailing whitespace from <i>str</i>. Returns
* <code>nil</code> if <i>str</i> was not altered.
- *
- * Refer to <code>strip</code> for the definition of whitespace.
*/
static VALUE
rb_str_strip_bang(VALUE str)
{
- char *start;
- long olen, loffset, roffset;
- rb_encoding *enc;
-
- str_modify_keep_cr(str);
- enc = STR_ENC_GET(str);
- RSTRING_GETMEM(str, start, olen);
- loffset = lstrip_offset(str, start, start+olen, enc);
- roffset = rstrip_offset(str, start+loffset, start+olen, enc);
+ VALUE l = rb_str_lstrip_bang(str);
+ VALUE r = rb_str_rstrip_bang(str);
- if (loffset > 0 || roffset > 0) {
- long len = olen-roffset;
- if (loffset > 0) {
- len -= loffset;
- memmove(start, start + loffset, len);
- }
- STR_SET_LEN(str, len);
-#if !SHARABLE_MIDDLE_SUBSTRING
- TERM_FILL(start+len, rb_enc_mbminlen(enc));
-#endif
- return str;
- }
- return Qnil;
+ if (NIL_P(l) && NIL_P(r)) return Qnil;
+ return str;
}
@@ -7947,27 +7164,16 @@ rb_str_strip_bang(VALUE str)
*
* Returns a copy of <i>str</i> with leading and trailing whitespace removed.
*
- * Whitespace is defined as any of the following characters:
- * null, horizontal tab, line feed, vertical tab, form feed, carriage return, space.
- *
* " hello ".strip #=> "hello"
* "\tgoodbye\r\n".strip #=> "goodbye"
- * "\x00\t\n\v\f\r ".strip #=> ""
*/
static VALUE
rb_str_strip(VALUE str)
{
- char *start;
- long olen, loffset, roffset;
- rb_encoding *enc = STR_ENC_GET(str);
-
- RSTRING_GETMEM(str, start, olen);
- loffset = lstrip_offset(str, start, start+olen, enc);
- roffset = rstrip_offset(str, start+loffset, start+olen, enc);
-
- if (loffset <= 0 && roffset <= 0) return rb_str_dup(str);
- return rb_str_subseq(str, loffset, olen-loffset-roffset);
+ str = rb_str_dup(str);
+ rb_str_strip_bang(str);
+ return str;
}
static VALUE
@@ -7977,7 +7183,7 @@ scan_once(VALUE str, VALUE pat, long *start)
struct re_registers *regs;
int i;
- if (rb_pat_search(pat, str, *start, 1) >= 0) {
+ if (rb_reg_search(pat, str, *start, 0) >= 0) {
match = rb_backref_get();
regs = RMATCH_REGS(match);
if (BEG(0) == END(0)) {
@@ -8047,8 +7253,7 @@ rb_str_scan(VALUE str, VALUE pat)
long last = -1, prev = 0;
char *p = RSTRING_PTR(str); long len = RSTRING_LEN(str);
- pat = get_pat_quoted(pat, 1);
- mustnot_broken(str);
+ pat = get_pat(pat, 1);
if (!rb_block_given_p()) {
VALUE ary = rb_ary_new();
@@ -8057,7 +7262,7 @@ rb_str_scan(VALUE str, VALUE pat)
prev = start;
rb_ary_push(ary, result);
}
- if (last >= 0) rb_pat_search(pat, str, last, 1);
+ if (last >= 0) rb_reg_search(pat, str, last, 0);
return ary;
}
@@ -8067,7 +7272,7 @@ rb_str_scan(VALUE str, VALUE pat)
rb_yield(result);
str_mod_check(str, p, len);
}
- if (last >= 0) rb_pat_search(pat, str, last, 1);
+ if (last >= 0) rb_reg_search(pat, str, last, 0);
return str;
}
@@ -8105,9 +7310,6 @@ rb_str_hex(VALUE str)
* "-377".oct #=> -255
* "bad".oct #=> 0
* "0377bad".oct #=> 255
- *
- * If +str+ starts with <code>0</code>, radix indicators are hornored.
- * See Kernel#Integer.
*/
static VALUE
@@ -8146,16 +7348,12 @@ rb_str_crypt(VALUE str, VALUE salt)
#endif
StringValue(salt);
- mustnot_wchar(str);
- mustnot_wchar(salt);
- if (RSTRING_LEN(salt) < 2) {
- short_salt:
+ if (RSTRING_LEN(salt) < 2)
rb_raise(rb_eArgError, "salt too short (need >=2 bytes)");
- }
- s = StringValueCStr(str);
+ s = RSTRING_PTR(str);
+ if (!s) s = "";
saltp = RSTRING_PTR(salt);
- if (!saltp[0] || !saltp[1]) goto short_salt;
#ifdef BROKEN_CRYPT
if (!ISASCII((unsigned char)saltp[0]) || !ISASCII((unsigned char)saltp[1])) {
salt_8bit_clean[0] = saltp[0] & 0x7f;
@@ -8168,14 +7366,46 @@ rb_str_crypt(VALUE str, VALUE salt)
if (!res) {
rb_sys_fail("crypt");
}
- result = rb_str_new_cstr(res);
- FL_SET_RAW(result, OBJ_TAINTED_RAW(str) | OBJ_TAINTED_RAW(salt));
+ result = rb_str_new2(res);
+ OBJ_INFECT(result, str);
+ OBJ_INFECT(result, salt);
return result;
}
/*
* call-seq:
+ * str.intern -> symbol
+ * str.to_sym -> symbol
+ *
+ * Returns the <code>Symbol</code> corresponding to <i>str</i>, creating the
+ * symbol if it did not previously exist. See <code>Symbol#id2name</code>.
+ *
+ * "Koala".intern #=> :Koala
+ * s = 'cat'.to_sym #=> :cat
+ * s == :cat #=> true
+ * s = '@cat'.to_sym #=> :@cat
+ * s == :@cat #=> true
+ *
+ * This can also be used to create symbols that cannot be represented using the
+ * <code>:xxx</code> notation.
+ *
+ * 'cat and dog'.to_sym #=> :"cat and dog"
+ */
+
+VALUE
+rb_str_intern(VALUE s)
+{
+ VALUE str = RB_GC_GUARD(s);
+ ID id;
+
+ id = rb_intern_str(str);
+ return ID2SYM(id);
+}
+
+
+/*
+ * call-seq:
* str.ord -> integer
*
* Return the <code>Integer</code> ordinal of a one-character string.
@@ -8197,7 +7427,7 @@ rb_str_ord(VALUE s)
*
* Returns a basic <em>n</em>-bit checksum of the characters in <i>str</i>,
* where <em>n</em> is the optional <code>Fixnum</code> parameter, defaulting
- * to 16. The result is simply the sum of the binary value of each byte in
+ * to 16. The result is simply the sum of the binary value of each character in
* <i>str</i> modulo <code>2**n - 1</code>. This is not a particularly good
* checksum.
*/
@@ -8218,8 +7448,6 @@ rb_str_sum(int argc, VALUE *argv, VALUE str)
else {
rb_scan_args(argc, argv, "01", &vbits);
bits = NUM2INT(vbits);
- if (bits < 0)
- bits = 0;
}
ptr = p = RSTRING_PTR(str);
len = RSTRING_LEN(str);
@@ -8254,7 +7482,7 @@ rb_str_sum(int argc, VALUE *argv, VALUE str)
sum = rb_funcall(sum, '+', 1, LONG2FIX(sum0));
}
- mod = rb_funcall(INT2FIX(1), idLTLT, 1, INT2FIX(bits));
+ mod = rb_funcall(INT2FIX(1), rb_intern("<<"), 1, INT2FIX(bits));
mod = rb_funcall(mod, '-', 1, INT2FIX(1));
sum = rb_funcall(sum, '&', 1, mod);
}
@@ -8272,26 +7500,24 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
char *p;
const char *f = " ";
long n, size, llen, rlen, llen2 = 0, rlen2 = 0;
- VALUE pad;
+ volatile VALUE pad;
int singlebyte = 1, cr;
- int termlen;
rb_scan_args(argc, argv, "11", &w, &pad);
enc = STR_ENC_GET(str);
- termlen = rb_enc_mbminlen(enc);
width = NUM2LONG(w);
if (argc == 2) {
StringValue(pad);
enc = rb_enc_check(str, pad);
f = RSTRING_PTR(pad);
flen = RSTRING_LEN(pad);
- fclen = str_strlen(pad, enc); /* rb_enc_check */
+ fclen = str_strlen(pad, enc);
singlebyte = single_byte_optimizable(pad);
if (flen == 0 || fclen == 0) {
rb_raise(rb_eArgError, "zero width padding");
}
}
- len = str_strlen(str, enc); /* rb_enc_check */
+ len = str_strlen(str, enc);
if (width < 0 || len >= width) return rb_str_dup(str);
n = width - len;
llen = (jflag == 'l') ? 0 : ((jflag == 'r') ? n : n/2);
@@ -8308,7 +7534,7 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
rb_raise(rb_eArgError, "argument too big");
}
len += size;
- res = str_new0(rb_obj_class(str), 0, len, termlen);
+ res = rb_str_new5(str, 0, len);
p = RSTRING_PTR(res);
if (flen <= 1) {
memset(p, *f, llen);
@@ -8342,17 +7568,15 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
p += rlen2;
}
}
- TERM_FILL(p, termlen);
+ *p = '\0';
STR_SET_LEN(res, p-RSTRING_PTR(res));
- OBJ_INFECT_RAW(res, str);
- if (!NIL_P(pad)) OBJ_INFECT_RAW(res, pad);
+ OBJ_INFECT(res, str);
+ if (!NIL_P(pad)) OBJ_INFECT(res, pad);
rb_enc_associate(res, enc);
if (argc == 2)
cr = ENC_CODERANGE_AND(cr, ENC_CODERANGE(pad));
if (cr != ENC_CODERANGE_BROKEN)
ENC_CODERANGE_SET(res, cr);
-
- RB_GC_GUARD(pad);
return res;
}
@@ -8435,20 +7659,30 @@ static VALUE
rb_str_partition(VALUE str, VALUE sep)
{
long pos;
+ int regex = FALSE;
- sep = get_pat_quoted(sep, 0);
if (RB_TYPE_P(sep, T_REGEXP)) {
pos = rb_reg_search(sep, str, 0, 0);
- if (pos < 0) {
- failed:
- return rb_ary_new3(3, str, str_new_empty(str), str_new_empty(str));
- }
- sep = rb_str_subpat(str, sep, INT2FIX(0));
- if (pos == 0 && RSTRING_LEN(sep) == 0) goto failed;
+ regex = TRUE;
}
else {
+ VALUE tmp;
+
+ tmp = rb_check_string_type(sep);
+ if (NIL_P(tmp)) {
+ rb_raise(rb_eTypeError, "type mismatch: %s given",
+ rb_obj_classname(sep));
+ }
+ sep = tmp;
pos = rb_str_index(str, sep, 0);
- if (pos < 0) goto failed;
+ }
+ if (pos < 0) {
+ failed:
+ return rb_ary_new3(3, str, str_new_empty(str), str_new_empty(str));
+ }
+ if (regex) {
+ sep = rb_str_subpat(str, sep, INT2FIX(0));
+ if (pos == 0 && RSTRING_LEN(sep) == 0) goto failed;
}
return rb_ary_new3(3, rb_str_subseq(str, 0, pos),
sep,
@@ -8542,12 +7776,6 @@ rb_str_start_with(int argc, VALUE *argv, VALUE str)
* str.end_with?([suffixes]+) -> true or false
*
* Returns true if +str+ ends with one of the +suffixes+ given.
- *
- * "hello".end_with?("ello") #=> true
- *
- * # returns true if one of the +suffixes+ matches.
- * "hello".end_with?("heaven", "ello") #=> true
- * "hello".end_with?("heaven", "paradise") #=> false
*/
static VALUE
@@ -8577,7 +7805,7 @@ void
rb_str_setter(VALUE val, ID id, VALUE *var)
{
if (!NIL_P(val) && !RB_TYPE_P(val, T_STRING)) {
- rb_raise(rb_eTypeError, "value of %"PRIsVALUE" must be String", rb_id2str(id));
+ rb_raise(rb_eTypeError, "value of %s must be String", rb_id2name(id));
}
*var = val;
}
@@ -8611,7 +7839,7 @@ rb_str_b(VALUE str)
{
VALUE str2 = str_alloc(rb_cString);
str_replace_shared_without_enc(str2, str);
- OBJ_INFECT_RAW(str2, str);
+ OBJ_INFECT(str2, str);
ENC_CODERANGE_CLEAR(str2);
return str2;
}
@@ -8713,63 +7941,40 @@ str_compat_and_valid(VALUE str, rb_encoding *enc)
if (cr == ENC_CODERANGE_BROKEN) {
rb_raise(rb_eArgError, "replacement must be valid byte sequence '%+"PRIsVALUE"'", str);
}
- else {
+ else if (cr == ENC_CODERANGE_7BIT) {
rb_encoding *e = STR_ENC_GET(str);
- if (cr == ENC_CODERANGE_7BIT ? rb_enc_mbminlen(enc) != 1 : enc != e) {
+ if (!rb_enc_asciicompat(enc)) {
rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s",
- rb_enc_name(enc), rb_enc_name(e));
+ rb_enc_name(enc), rb_enc_name(e));
+ }
+ }
+ else { /* ENC_CODERANGE_VALID */
+ rb_encoding *e = STR_ENC_GET(str);
+ if (enc != e) {
+ rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s",
+ rb_enc_name(enc), rb_enc_name(e));
}
}
return str;
}
-static VALUE enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr);
-
/**
- * @param str the string to be scrubbed
* @param repl the replacement character
* @return If given string is invalid, returns a new string. Otherwise, returns Qnil.
*/
VALUE
rb_str_scrub(VALUE str, VALUE repl)
{
- rb_encoding *enc = STR_ENC_GET(str);
- return enc_str_scrub(enc, str, repl, ENC_CODERANGE(str));
-}
-
-VALUE
-rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl)
-{
- int cr = ENC_CODERANGE_UNKNOWN;
- if (enc == STR_ENC_GET(str)) {
- /* cached coderange makes sense only when enc equals the
- * actual encoding of str */
- cr = ENC_CODERANGE(str);
- }
- return enc_str_scrub(enc, str, repl, cr);
-}
-
-static VALUE
-enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
-{
+ int cr = ENC_CODERANGE(str);
+ rb_encoding *enc;
int encidx;
- VALUE buf = Qnil;
- const char *rep;
- long replen = -1;
- int tainted = 0;
-
- if (rb_block_given_p()) {
- if (!NIL_P(repl))
- rb_raise(rb_eArgError, "both of block and replacement given");
- replen = 0;
- }
- if (ENC_CODERANGE_CLEAN_P(cr))
+ if (cr == ENC_CODERANGE_7BIT || cr == ENC_CODERANGE_VALID)
return Qnil;
+ enc = STR_ENC_GET(str);
if (!NIL_P(repl)) {
repl = str_compat_and_valid(repl, enc);
- tainted = OBJ_TAINTED_RAW(repl);
}
if (rb_enc_dummy_p(enc)) {
@@ -8786,9 +7991,13 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
const char *p = RSTRING_PTR(str);
const char *e = RSTRING_END(str);
const char *p1 = p;
+ const char *rep;
+ long replen;
int rep7bit_p;
- if (!replen) {
+ VALUE buf = Qnil;
+ if (rb_block_given_p()) {
rep = NULL;
+ replen = 0;
rep7bit_p = FALSE;
}
else if (!NIL_P(repl)) {
@@ -8851,7 +8060,6 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
else {
repl = rb_yield(rb_enc_str_new(p, clen, enc));
repl = str_compat_and_valid(repl, enc);
- tainted |= OBJ_TAINTED_RAW(repl);
rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
if (ENC_CODERANGE(repl) == ENC_CODERANGE_VALID)
cr = ENC_CODERANGE_VALID;
@@ -8886,23 +8094,24 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
else {
repl = rb_yield(rb_enc_str_new(p, e-p, enc));
repl = str_compat_and_valid(repl, enc);
- tainted |= OBJ_TAINTED_RAW(repl);
rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
if (ENC_CODERANGE(repl) == ENC_CODERANGE_VALID)
cr = ENC_CODERANGE_VALID;
}
}
+ ENCODING_CODERANGE_SET(buf, rb_enc_to_index(enc), cr);
+ return buf;
}
else {
/* ASCII incompatible */
const char *p = RSTRING_PTR(str);
const char *e = RSTRING_END(str);
const char *p1 = p;
+ VALUE buf = Qnil;
+ const char *rep;
+ long replen;
long mbminlen = rb_enc_mbminlen(enc);
- if (!replen) {
- rep = NULL;
- }
- else if (!NIL_P(repl)) {
+ if (!NIL_P(repl)) {
rep = RSTRING_PTR(repl);
replen = RSTRING_LEN(repl);
}
@@ -8953,9 +8162,8 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
rb_str_buf_cat(buf, rep, replen);
}
else {
- repl = rb_yield(rb_enc_str_new(p, clen, enc));
+ repl = rb_yield(rb_enc_str_new(p, e-p, enc));
repl = str_compat_and_valid(repl, enc);
- tainted |= OBJ_TAINTED_RAW(repl);
rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
}
p += clen;
@@ -8982,15 +8190,12 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
else {
repl = rb_yield(rb_enc_str_new(p, e-p, enc));
repl = str_compat_and_valid(repl, enc);
- tainted |= OBJ_TAINTED_RAW(repl);
rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
}
}
- cr = ENC_CODERANGE_VALID;
+ ENCODING_CODERANGE_SET(buf, rb_enc_to_index(enc), ENC_CODERANGE_VALID);
+ return buf;
}
- FL_SET_RAW(buf, tainted|OBJ_TAINTED_RAW(str));
- ENCODING_CODERANGE_SET(buf, rb_enc_to_index(enc), cr);
- return buf;
}
/*
@@ -9080,18 +8285,21 @@ str_scrub_bang(int argc, VALUE *argv, VALUE str)
* symbol, returns <code>true</code>.
*/
-#define sym_equal rb_obj_equal
+static VALUE
+sym_equal(VALUE sym1, VALUE sym2)
+{
+ if (sym1 == sym2) return Qtrue;
+ return Qfalse;
+}
+
static int
sym_printable(const char *s, const char *send, rb_encoding *enc)
{
while (s < send) {
int n;
- int c = rb_enc_precise_mbclen(s, send, enc);
+ int c = rb_enc_codepoint_len(s, send, &n, enc);
- if (!MBCLEN_CHARFOUND_P(c)) return FALSE;
- n = MBCLEN_CHARFOUND_LEN(c);
- c = rb_enc_mbc_to_codepoint(s, send, enc);
if (!rb_enc_isprint(c, enc)) return FALSE;
s += n;
}
@@ -9156,26 +8364,30 @@ rb_id_quote_unprintable(ID id)
static VALUE
sym_inspect(VALUE sym)
{
- VALUE str = rb_sym2str(sym);
+ VALUE str;
const char *ptr;
long len;
+ ID id = SYM2ID(sym);
char *dest;
- if (!rb_str_symname_p(str)) {
- str = rb_str_inspect(str);
+ sym = rb_id2str(id);
+ if (!rb_str_symname_p(sym)) {
+ str = rb_str_inspect(sym);
len = RSTRING_LEN(str);
rb_str_resize(str, len + 1);
dest = RSTRING_PTR(str);
memmove(dest + 1, dest, len);
+ dest[0] = ':';
}
else {
- rb_encoding *enc = STR_ENC_GET(str);
- RSTRING_GETMEM(str, ptr, len);
+ rb_encoding *enc = STR_ENC_GET(sym);
+ ptr = RSTRING_PTR(sym);
+ len = RSTRING_LEN(sym);
str = rb_enc_str_new(0, len + 1, enc);
dest = RSTRING_PTR(str);
+ dest[0] = ':';
memcpy(dest + 1, ptr, len);
}
- dest[0] = ':';
return str;
}
@@ -9194,7 +8406,9 @@ sym_inspect(VALUE sym)
VALUE
rb_sym_to_s(VALUE sym)
{
- return str_new_shared(rb_cString, rb_sym2str(sym));
+ ID id = SYM2ID(sym);
+
+ return str_new3(rb_cString, rb_id2str(id));
}
@@ -9214,8 +8428,8 @@ sym_to_sym(VALUE sym)
return sym;
}
-VALUE
-rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passed_proc)
+static VALUE
+sym_call(VALUE args, VALUE sym, int argc, VALUE *argv, VALUE passed_proc)
{
VALUE obj;
@@ -9226,7 +8440,6 @@ rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passe
return rb_funcall_with_block(obj, (ID)sym, argc - 1, argv + 1, passed_proc);
}
-#if 0
/*
* call-seq:
* sym.to_proc
@@ -9236,11 +8449,35 @@ rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passe
* (1..3).collect(&:to_s) #=> ["1", "2", "3"]
*/
-VALUE
-rb_sym_to_proc(VALUE sym)
+static VALUE
+sym_to_proc(VALUE sym)
{
+ static VALUE sym_proc_cache = Qfalse;
+ enum {SYM_PROC_CACHE_SIZE = 67};
+ VALUE proc;
+ long id, index;
+ VALUE *aryp;
+
+ if (!sym_proc_cache) {
+ sym_proc_cache = rb_ary_tmp_new(SYM_PROC_CACHE_SIZE * 2);
+ rb_gc_register_mark_object(sym_proc_cache);
+ rb_ary_store(sym_proc_cache, SYM_PROC_CACHE_SIZE*2 - 1, Qnil);
+ }
+
+ id = SYM2ID(sym);
+ index = (id % SYM_PROC_CACHE_SIZE) << 1;
+
+ aryp = RARRAY_PTR(sym_proc_cache);
+ if (aryp[index] == sym) {
+ return aryp[index + 1];
+ }
+ else {
+ proc = rb_proc_new(sym_call, (VALUE)id);
+ aryp[index] = sym;
+ aryp[index + 1] = proc;
+ return proc;
+ }
}
-#endif
/*
* call-seq:
@@ -9253,7 +8490,7 @@ rb_sym_to_proc(VALUE sym)
static VALUE
sym_succ(VALUE sym)
{
- return rb_str_intern(rb_str_succ(rb_sym2str(sym)));
+ return rb_str_intern(rb_str_succ(rb_sym_to_s(sym)));
}
/*
@@ -9276,7 +8513,7 @@ sym_cmp(VALUE sym, VALUE other)
if (!SYMBOL_P(other)) {
return Qnil;
}
- return rb_str_cmp_m(rb_sym2str(sym), rb_sym2str(other));
+ return rb_str_cmp_m(rb_sym_to_s(sym), rb_sym_to_s(other));
}
/*
@@ -9293,7 +8530,7 @@ sym_casecmp(VALUE sym, VALUE other)
if (!SYMBOL_P(other)) {
return Qnil;
}
- return rb_str_casecmp(rb_sym2str(sym), rb_sym2str(other));
+ return rb_str_casecmp(rb_sym_to_s(sym), rb_sym_to_s(other));
}
/*
@@ -9307,7 +8544,7 @@ sym_casecmp(VALUE sym, VALUE other)
static VALUE
sym_match(VALUE sym, VALUE other)
{
- return rb_str_match(rb_sym2str(sym), other);
+ return rb_str_match(rb_sym_to_s(sym), other);
}
/*
@@ -9323,7 +8560,7 @@ sym_match(VALUE sym, VALUE other)
static VALUE
sym_aref(int argc, VALUE *argv, VALUE sym)
{
- return rb_str_aref_m(argc, argv, rb_sym2str(sym));
+ return rb_str_aref_m(argc, argv, rb_sym_to_s(sym));
}
/*
@@ -9337,7 +8574,7 @@ sym_aref(int argc, VALUE *argv, VALUE sym)
static VALUE
sym_length(VALUE sym)
{
- return rb_str_length(rb_sym2str(sym));
+ return rb_str_length(rb_id2str(SYM2ID(sym)));
}
/*
@@ -9350,7 +8587,7 @@ sym_length(VALUE sym)
static VALUE
sym_empty(VALUE sym)
{
- return rb_str_empty(rb_sym2str(sym));
+ return rb_str_empty(rb_id2str(SYM2ID(sym)));
}
/*
@@ -9363,7 +8600,7 @@ sym_empty(VALUE sym)
static VALUE
sym_upcase(VALUE sym)
{
- return rb_str_intern(rb_str_upcase(rb_sym2str(sym)));
+ return rb_str_intern(rb_str_upcase(rb_id2str(SYM2ID(sym))));
}
/*
@@ -9376,7 +8613,7 @@ sym_upcase(VALUE sym)
static VALUE
sym_downcase(VALUE sym)
{
- return rb_str_intern(rb_str_downcase(rb_sym2str(sym)));
+ return rb_str_intern(rb_str_downcase(rb_id2str(SYM2ID(sym))));
}
/*
@@ -9389,7 +8626,7 @@ sym_downcase(VALUE sym)
static VALUE
sym_capitalize(VALUE sym)
{
- return rb_str_intern(rb_str_capitalize(rb_sym2str(sym)));
+ return rb_str_intern(rb_str_capitalize(rb_id2str(SYM2ID(sym))));
}
/*
@@ -9402,7 +8639,7 @@ sym_capitalize(VALUE sym)
static VALUE
sym_swapcase(VALUE sym)
{
- return rb_str_intern(rb_str_swapcase(rb_sym2str(sym)));
+ return rb_str_intern(rb_str_swapcase(rb_id2str(SYM2ID(sym))));
}
/*
@@ -9415,43 +8652,28 @@ sym_swapcase(VALUE sym)
static VALUE
sym_encoding(VALUE sym)
{
- return rb_obj_encoding(rb_sym2str(sym));
+ return rb_obj_encoding(rb_id2str(SYM2ID(sym)));
}
-static VALUE
-string_for_symbol(VALUE name)
+ID
+rb_to_id(VALUE name)
{
+ VALUE tmp;
+
+ if (SYMBOL_P(name)) {
+ return SYM2ID(name);
+ }
if (!RB_TYPE_P(name, T_STRING)) {
- VALUE tmp = rb_check_string_type(name);
+ tmp = rb_check_string_type(name);
if (NIL_P(tmp)) {
rb_raise(rb_eTypeError, "%+"PRIsVALUE" is not a symbol",
name);
}
name = tmp;
}
- return name;
-}
-
-ID
-rb_to_id(VALUE name)
-{
- if (SYMBOL_P(name)) {
- return SYM2ID(name);
- }
- name = string_for_symbol(name);
return rb_intern_str(name);
}
-VALUE
-rb_to_symbol(VALUE name)
-{
- if (SYMBOL_P(name)) {
- return name;
- }
- name = string_for_symbol(name);
- return rb_str_intern(name);
-}
-
/*
* A <code>String</code> object holds and manipulates an arbitrary sequence of
* bytes, typically representing characters. String objects may be created
@@ -9471,6 +8693,8 @@ Init_String(void)
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
+ frozen_strings = st_init_table(&fstring_hash_type);
+
rb_cString = rb_define_class("String", rb_cObject);
rb_include_module(rb_cString, rb_mComparable);
rb_define_alloc_func(rb_cString, empty_str_alloc);
@@ -9510,9 +8734,7 @@ Init_String(void)
rb_define_method(rb_cString, "byteslice", rb_str_byteslice, -1);
rb_define_method(rb_cString, "scrub", str_scrub, -1);
rb_define_method(rb_cString, "scrub!", str_scrub_bang, -1);
- rb_define_method(rb_cString, "freeze", rb_str_freeze, 0);
- rb_define_method(rb_cString, "+@", str_uplus, 0);
- rb_define_method(rb_cString, "-@", str_uminus, 0);
+ rb_define_method(rb_cString, "freeze", rb_obj_freeze, 0);
rb_define_method(rb_cString, "to_i", rb_str_to_i, -1);
rb_define_method(rb_cString, "to_f", rb_str_to_f, 0);
@@ -9544,8 +8766,8 @@ Init_String(void)
rb_define_method(rb_cString, "<<", rb_str_concat, 1);
rb_define_method(rb_cString, "prepend", rb_str_prepend, 1);
rb_define_method(rb_cString, "crypt", rb_str_crypt, 1);
- rb_define_method(rb_cString, "intern", rb_str_intern, 0); /* in symbol.c */
- rb_define_method(rb_cString, "to_sym", rb_str_intern, 0); /* in symbol.c */
+ rb_define_method(rb_cString, "intern", rb_str_intern, 0);
+ rb_define_method(rb_cString, "to_sym", rb_str_intern, 0);
rb_define_method(rb_cString, "ord", rb_str_ord, 0);
rb_define_method(rb_cString, "include?", rb_str_include, 1);
@@ -9604,6 +8826,8 @@ Init_String(void)
rb_define_method(rb_cString, "valid_encoding?", rb_str_valid_encoding_p, 0);
rb_define_method(rb_cString, "ascii_only?", rb_str_is_ascii_only_p, 0);
+ id_to_s = rb_intern("to_s");
+
rb_fs = Qnil;
rb_define_variable("$;", &rb_fs);
rb_define_variable("$-F", &rb_fs);
@@ -9612,7 +8836,7 @@ Init_String(void)
rb_include_module(rb_cSymbol, rb_mComparable);
rb_undef_alloc_func(rb_cSymbol);
rb_undef_method(CLASS_OF(rb_cSymbol), "new");
- rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in symbol.c */
+ rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in parse.y */
rb_define_method(rb_cSymbol, "==", sym_equal, 1);
rb_define_method(rb_cSymbol, "===", sym_equal, 1);
@@ -9621,7 +8845,7 @@ Init_String(void)
rb_define_method(rb_cSymbol, "id2name", rb_sym_to_s, 0);
rb_define_method(rb_cSymbol, "intern", sym_to_sym, 0);
rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0);
- rb_define_method(rb_cSymbol, "to_proc", rb_sym_to_proc, 0);
+ rb_define_method(rb_cSymbol, "to_proc", sym_to_proc, 0);
rb_define_method(rb_cSymbol, "succ", sym_succ, 0);
rb_define_method(rb_cSymbol, "next", sym_succ, 0);
@@ -9642,7 +8866,4 @@ Init_String(void)
rb_define_method(rb_cSymbol, "swapcase", sym_swapcase, 0);
rb_define_method(rb_cSymbol, "encoding", sym_encoding, 0);
-
- assert(rb_vm_fstring_table());
- st_foreach(rb_vm_fstring_table(), fstring_set_class_i, rb_cString);
}
diff --git a/struct.c b/struct.c
index 02e32626c2..a961ac8600 100644
--- a/struct.c
+++ b/struct.c
@@ -9,45 +9,33 @@
**********************************************************************/
+#include "ruby/ruby.h"
#include "internal.h"
-#include "vm_core.h"
-#include "id.h"
-
-/* only for struct[:field] access */
-enum {
- AREF_HASH_UNIT = 5,
- AREF_HASH_THRESHOLD = 10
-};
-
-const rb_iseq_t *rb_method_for_self_aref(VALUE name, VALUE arg, rb_insn_func_t func);
-const rb_iseq_t *rb_method_for_self_aset(VALUE name, VALUE arg, rb_insn_func_t func);
VALUE rb_cStruct;
-static ID id_members, id_back_members;
+static ID id_members;
static VALUE struct_alloc(VALUE);
static inline VALUE
struct_ivar_get(VALUE c, ID id)
{
- VALUE orig = c;
- VALUE ivar = rb_attr_get(c, id);
-
- if (!NIL_P(ivar))
- return ivar;
-
for (;;) {
+ if (rb_ivar_defined(c, id))
+ return rb_ivar_get(c, id);
c = RCLASS_SUPER(c);
if (c == 0 || c == rb_cStruct)
return Qnil;
- ivar = rb_attr_get(c, id);
- if (!NIL_P(ivar)) {
- return rb_ivar_set(orig, id, ivar);
- }
}
}
VALUE
+rb_struct_iv_get(VALUE c, const char *name)
+{
+ return struct_ivar_get(c, rb_intern(name));
+}
+
+VALUE
rb_struct_s_members(VALUE klass)
{
VALUE members = struct_ivar_get(klass, id_members);
@@ -73,109 +61,6 @@ rb_struct_members(VALUE s)
return members;
}
-static long
-struct_member_pos_ideal(VALUE name, long mask)
-{
- /* (id & (mask/2)) * 2 */
- return (SYM2ID(name) >> (ID_SCOPE_SHIFT - 1)) & mask;
-}
-
-static long
-struct_member_pos_probe(long prev, long mask)
-{
- /* (((prev/2) * AREF_HASH_UNIT + 1) & (mask/2)) * 2 */
- return (prev * AREF_HASH_UNIT + 2) & mask;
-}
-
-static VALUE
-struct_set_members(VALUE klass, VALUE /* frozen hidden array */ members)
-{
- VALUE back;
- const long members_length = RARRAY_LEN(members);
-
- if (members_length <= AREF_HASH_THRESHOLD) {
- back = members;
- }
- else {
- long i, j, mask = 64;
- VALUE name;
-
- while (mask < members_length * AREF_HASH_UNIT) mask *= 2;
-
- back = rb_ary_tmp_new(mask + 1);
- rb_ary_store(back, mask, INT2FIX(members_length));
- mask -= 2; /* mask = (2**k-1)*2 */
-
- for (i=0; i < members_length; i++) {
- name = RARRAY_AREF(members, i);
-
- j = struct_member_pos_ideal(name, mask);
-
- for (;;) {
- if (!RTEST(RARRAY_AREF(back, j))) {
- rb_ary_store(back, j, name);
- rb_ary_store(back, j + 1, INT2FIX(i));
- break;
- }
- j = struct_member_pos_probe(j, mask);
- }
- }
- OBJ_FREEZE_RAW(back);
- }
- rb_ivar_set(klass, id_members, members);
- rb_ivar_set(klass, id_back_members, back);
-
- return members;
-}
-
-static inline int
-struct_member_pos(VALUE s, VALUE name)
-{
- VALUE back = struct_ivar_get(rb_obj_class(s), id_back_members);
- VALUE const * p;
- long j, mask;
-
- if (UNLIKELY(NIL_P(back))) {
- rb_raise(rb_eTypeError, "uninitialized struct");
- }
- if (UNLIKELY(!RB_TYPE_P(back, T_ARRAY))) {
- rb_raise(rb_eTypeError, "corrupted struct");
- }
-
- p = RARRAY_CONST_PTR(back);
- mask = RARRAY_LEN(back);
-
- if (mask <= AREF_HASH_THRESHOLD) {
- if (UNLIKELY(RSTRUCT_LEN(s) != mask)) {
- rb_raise(rb_eTypeError,
- "struct size differs (%ld required %ld given)",
- mask, RSTRUCT_LEN(s));
- }
- for (j = 0; j < mask; j++) {
- if (p[j] == name)
- return (int)j;
- }
- return -1;
- }
-
- if (UNLIKELY(RSTRUCT_LEN(s) != FIX2INT(RARRAY_AREF(back, mask-1)))) {
- rb_raise(rb_eTypeError, "struct size differs (%d required %ld given)",
- FIX2INT(RARRAY_AREF(back, mask-1)), RSTRUCT_LEN(s));
- }
-
- mask -= 3;
- j = struct_member_pos_ideal(name, mask);
-
- for (;;) {
- if (p[j] == name)
- return FIX2INT(p[j + 1]);
- if (!RTEST(p[j])) {
- return -1;
- }
- j = struct_member_pos_probe(j, mask);
- }
-}
-
static VALUE
rb_struct_s_members_m(VALUE klass)
{
@@ -204,16 +89,28 @@ rb_struct_members_m(VALUE obj)
VALUE
rb_struct_getmember(VALUE obj, ID id)
{
- VALUE slot = ID2SYM(id);
- int i = struct_member_pos(obj, slot);
- if (i != -1) {
- return RSTRUCT_GET(obj, i);
+ VALUE members, slot;
+ long i, len;
+
+ members = rb_struct_members(obj);
+ slot = ID2SYM(id);
+ len = RARRAY_LEN(members);
+ for (i=0; i<len; i++) {
+ if (RARRAY_AREF(members, i) == slot) {
+ return RSTRUCT_GET(obj, i);
+ }
}
- rb_name_err_raise("`%1$s' is not a struct member", obj, ID2SYM(id));
+ rb_name_error(id, "%s is not struct member", rb_id2name(id));
UNREACHABLE;
}
+static VALUE
+rb_struct_ref(VALUE obj)
+{
+ return rb_struct_getmember(obj, rb_frame_this_func());
+}
+
static VALUE rb_struct_ref0(VALUE obj) {return RSTRUCT_GET(obj, 0);}
static VALUE rb_struct_ref1(VALUE obj) {return RSTRUCT_GET(obj, 1);}
static VALUE rb_struct_ref2(VALUE obj) {return RSTRUCT_GET(obj, 2);}
@@ -248,6 +145,27 @@ rb_struct_modify(VALUE s)
}
static VALUE
+rb_struct_set(VALUE obj, VALUE val)
+{
+ VALUE members, slot;
+ long i, len;
+
+ members = rb_struct_members(obj);
+ len = RARRAY_LEN(members);
+ rb_struct_modify(obj);
+ for (i=0; i<len; i++) {
+ slot = RARRAY_AREF(members, i);
+ if (rb_id_attrset(SYM2ID(slot)) == rb_frame_this_func()) {
+ return RSTRUCT_SET(obj, i, val);
+ }
+ }
+ rb_name_error(rb_frame_this_func(), "`%s' is not a struct member",
+ rb_id2name(rb_frame_this_func()));
+
+ UNREACHABLE;
+}
+
+static VALUE
anonymous_struct(VALUE klass)
{
VALUE nstr;
@@ -265,8 +183,8 @@ new_struct(VALUE name, VALUE super)
ID id;
name = rb_str_to_str(name);
if (!rb_is_const_name(name)) {
- rb_name_err_raise("identifier %1$s needs to be constant",
- super, name);
+ rb_name_error_str(name, "identifier %"PRIsVALUE" needs to be constant",
+ QUOTE(name));
}
id = rb_to_id(name);
if (rb_const_defined_at(super, id)) {
@@ -276,31 +194,14 @@ new_struct(VALUE name, VALUE super)
return rb_define_class_id_under(super, id, super);
}
-static void
-define_aref_method(VALUE nstr, VALUE name, VALUE off)
-{
- rb_control_frame_t *FUNC_FASTCALL(rb_vm_opt_struct_aref)(rb_thread_t *, rb_control_frame_t *);
- const rb_iseq_t *iseq = rb_method_for_self_aref(name, off, rb_vm_opt_struct_aref);
-
- rb_add_method_iseq(nstr, SYM2ID(name), iseq, NULL, METHOD_VISI_PUBLIC);
-}
-
-static void
-define_aset_method(VALUE nstr, VALUE name, VALUE off)
-{
- rb_control_frame_t *FUNC_FASTCALL(rb_vm_opt_struct_aset)(rb_thread_t *, rb_control_frame_t *);
- const rb_iseq_t *iseq = rb_method_for_self_aset(name, off, rb_vm_opt_struct_aset);
-
- rb_add_method_iseq(nstr, SYM2ID(name), iseq, NULL, METHOD_VISI_PUBLIC);
-}
-
static VALUE
setup_struct(VALUE nstr, VALUE members)
{
const VALUE *ptr_members;
long i, len;
- members = struct_set_members(nstr, members);
+ OBJ_FREEZE(members);
+ rb_ivar_set(nstr, id_members, members);
rb_define_alloc_func(nstr, struct_alloc);
rb_define_singleton_method(nstr, "new", rb_class_new_instance, -1);
@@ -310,15 +211,13 @@ setup_struct(VALUE nstr, VALUE members)
len = RARRAY_LEN(members);
for (i=0; i< len; i++) {
ID id = SYM2ID(ptr_members[i]);
- VALUE off = LONG2NUM(i);
-
if (i < N_REF_FUNC) {
rb_define_method_id(nstr, id, ref_func[i], 0);
}
else {
- define_aref_method(nstr, ptr_members[i], off);
+ rb_define_method_id(nstr, id, rb_struct_ref, 0);
}
- define_aset_method(nstr, ID2SYM(rb_id_attrset(id)), off);
+ rb_define_method_id(nstr, rb_id_attrset(id), rb_struct_set, 1);
}
return nstr;
@@ -331,27 +230,6 @@ rb_struct_alloc_noinit(VALUE klass)
}
static VALUE
-struct_make_members_list(va_list ar)
-{
- char *mem;
- VALUE ary, list = rb_ident_hash_new();
- st_table *tbl = RHASH_TBL(list);
-
- RBASIC_CLEAR_CLASS(list);
- while ((mem = va_arg(ar, char*)) != 0) {
- VALUE sym = rb_sym_intern_ascii_cstr(mem);
- if (st_insert(tbl, sym, Qtrue)) {
- rb_raise(rb_eArgError, "duplicate member: %s", mem);
- }
- }
- ary = rb_hash_keys(list);
- st_clear(tbl);
- RBASIC_CLEAR_CLASS(ary);
- OBJ_FREEZE_RAW(ary);
- return ary;
-}
-
-static VALUE
struct_define_without_accessor(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, VALUE members)
{
VALUE klass;
@@ -368,7 +246,7 @@ struct_define_without_accessor(VALUE outer, const char *class_name, VALUE super,
klass = anonymous_struct(super);
}
- struct_set_members(klass, members);
+ rb_ivar_set(klass, id_members, members);
if (alloc) {
rb_define_alloc_func(klass, alloc);
@@ -385,10 +263,15 @@ rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VAL
{
va_list ar;
VALUE members;
+ char *name;
+ members = rb_ary_tmp_new(0);
va_start(ar, alloc);
- members = struct_make_members_list(ar);
+ while ((name = va_arg(ar, char*)) != NULL) {
+ rb_ary_push(members, ID2SYM(rb_intern(name)));
+ }
va_end(ar);
+ OBJ_FREEZE(members);
return struct_define_without_accessor(outer, class_name, super, alloc, members);
}
@@ -398,10 +281,15 @@ rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_
{
va_list ar;
VALUE members;
+ char *name;
+ members = rb_ary_tmp_new(0);
va_start(ar, alloc);
- members = struct_make_members_list(ar);
+ while ((name = va_arg(ar, char*)) != NULL) {
+ rb_ary_push(members, ID2SYM(rb_intern(name)));
+ }
va_end(ar);
+ OBJ_FREEZE(members);
return struct_define_without_accessor(0, class_name, super, alloc, members);
}
@@ -411,9 +299,15 @@ rb_struct_define(const char *name, ...)
{
va_list ar;
VALUE st, ary;
+ char *mem;
+
+ ary = rb_ary_tmp_new(0);
va_start(ar, name);
- ary = struct_make_members_list(ar);
+ while ((mem = va_arg(ar, char*)) != 0) {
+ ID slot = rb_intern(mem);
+ rb_ary_push(ary, ID2SYM(slot));
+ }
va_end(ar);
if (!name) st = anonymous_struct(rb_cStruct);
@@ -426,9 +320,15 @@ rb_struct_define_under(VALUE outer, const char *name, ...)
{
va_list ar;
VALUE ary;
+ char *mem;
+
+ ary = rb_ary_tmp_new(0);
va_start(ar, name);
- ary = struct_make_members_list(ar);
+ while ((mem = va_arg(ar, char*)) != 0) {
+ ID slot = rb_intern(mem);
+ rb_ary_push(ary, ID2SYM(slot));
+ }
va_end(ar);
return setup_struct(rb_define_class_under(outer, name, rb_cStruct), ary);
@@ -489,7 +389,7 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
VALUE name, rest;
long i;
VALUE st;
- st_table *tbl;
+ ID id;
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
name = argv[0];
@@ -500,19 +400,12 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
--argc;
++argv;
}
- rest = rb_ident_hash_new();
- RBASIC_CLEAR_CLASS(rest);
- tbl = RHASH_TBL(rest);
+ rest = rb_ary_tmp_new(argc);
for (i=0; i<argc; i++) {
- VALUE mem = rb_to_symbol(argv[i]);
- if (st_insert(tbl, mem, Qtrue)) {
- rb_raise(rb_eArgError, "duplicate member: %"PRIsVALUE, mem);
- }
+ id = rb_to_id(argv[i]);
+ RARRAY_ASET(rest, i, ID2SYM(id));
+ rb_ary_set_len(rest, i+1);
}
- rest = rb_hash_keys(rest);
- st_clear(tbl);
- RBASIC_CLEAR_CLASS(rest);
- OBJ_FREEZE_RAW(rest);
if (NIL_P(name)) {
st = anonymous_struct(klass);
}
@@ -592,7 +485,7 @@ struct_alloc(VALUE klass)
VALUE
rb_struct_alloc(VALUE klass, VALUE values)
{
- return rb_class_new_instance(RARRAY_LENINT(values), RARRAY_CONST_PTR(values), klass);
+ return rb_class_new_instance(RARRAY_LENINT(values), RARRAY_PTR(values), klass);
}
VALUE
@@ -703,7 +596,7 @@ rb_struct_each_pair(VALUE s)
static VALUE
inspect_struct(VALUE s, VALUE dummy, int recur)
{
- VALUE cname = rb_class_path(rb_obj_class(s));
+ VALUE cname = rb_class_name(rb_obj_class(s));
VALUE members, str = rb_str_new2("#<struct ");
long i, len;
char first = RSTRING_PTR(cname)[0];
@@ -819,57 +712,20 @@ rb_struct_init_copy(VALUE copy, VALUE s)
return copy;
}
-static int
-rb_struct_pos(VALUE s, VALUE *name)
+static VALUE
+rb_struct_aref_id(VALUE s, ID id)
{
- long i;
- VALUE idx = *name;
+ VALUE members = rb_struct_members(s);
+ long i, len = RARRAY_LEN(members);
- if (RB_TYPE_P(idx, T_SYMBOL)) {
- return struct_member_pos(s, idx);
- }
- else if (RB_TYPE_P(idx, T_STRING)) {
- idx = rb_check_symbol(name);
- if (NIL_P(idx)) return -1;
- return struct_member_pos(s, idx);
- }
- else {
- long len;
- i = NUM2LONG(idx);
- len = RSTRUCT_LEN(s);
- if (i < 0) {
- if (i + len < 0) {
- *name = LONG2FIX(i);
- return -1;
- }
- i += len;
- }
- else if (len <= i) {
- *name = LONG2FIX(i);
- return -1;
+ for (i=0; i<len; i++) {
+ if (SYM2ID(RARRAY_AREF(members, i)) == id) {
+ return RSTRUCT_GET(s, i);
}
- return (int)i;
}
-}
+ rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
-NORETURN(static void invalid_struct_pos(VALUE s, VALUE idx));
-static void
-invalid_struct_pos(VALUE s, VALUE idx)
-{
- if (FIXNUM_P(idx)) {
- long i = FIX2INT(idx), len = RSTRUCT_LEN(s);
- if (i < 0) {
- rb_raise(rb_eIndexError, "offset %ld too small for struct(size:%ld)",
- i, len);
- }
- else {
- rb_raise(rb_eIndexError, "offset %ld too large for struct(size:%ld)",
- i, len);
- }
- }
- else {
- rb_name_err_raise("no member '%1$s' in struct", s, idx);
- }
+ UNREACHABLE;
}
/*
@@ -892,18 +748,61 @@ invalid_struct_pos(VALUE s, VALUE idx)
VALUE
rb_struct_aref(VALUE s, VALUE idx)
{
- int i = rb_struct_pos(s, &idx);
- if (i < 0) invalid_struct_pos(s, idx);
+ long i;
+
+ if (RB_TYPE_P(idx, T_SYMBOL)) {
+ return rb_struct_aref_id(s, SYM2ID(idx));
+ }
+ else if (RB_TYPE_P(idx, T_STRING)) {
+ ID id = rb_check_id(&idx);
+ if (!id) {
+ rb_name_error_str(idx, "no member '%"PRIsVALUE"' in struct",
+ QUOTE(idx));
+ }
+ return rb_struct_aref_id(s, id);
+ }
+
+ i = NUM2LONG(idx);
+ if (i < 0) i = RSTRUCT_LEN(s) + i;
+ if (i < 0)
+ rb_raise(rb_eIndexError, "offset %ld too small for struct(size:%ld)",
+ i, RSTRUCT_LEN(s));
+ if (RSTRUCT_LEN(s) <= i)
+ rb_raise(rb_eIndexError, "offset %ld too large for struct(size:%ld)",
+ i, RSTRUCT_LEN(s));
return RSTRUCT_GET(s, i);
}
+static VALUE
+rb_struct_aset_id(VALUE s, ID id, VALUE val)
+{
+ VALUE members = rb_struct_members(s);
+ long i, len = RARRAY_LEN(members);
+
+ if (RSTRUCT_LEN(s) != len) {
+ rb_raise(rb_eTypeError, "struct size differs (%ld required %ld given)",
+ len, RSTRUCT_LEN(s));
+ }
+
+ for (i=0; i<len; i++) {
+ if (SYM2ID(RARRAY_AREF(members, i)) == id) {
+ rb_struct_modify(s);
+ RSTRUCT_SET(s, i, val);
+ return val;
+ }
+ }
+ rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
+
+ UNREACHABLE;
+}
+
/*
* call-seq:
- * struct[member] = obj -> obj
- * struct[index] = obj -> obj
+ * struct[name] = obj -> obj
+ * struct[index] = obj -> obj
*
* Attribute Assignment---Sets the value of the given struct +member+ or
- * the member at the given +index+. Raises NameError if the +member+ does not
+ * the member at the given +index+. Raises NameError if the +name+ does not
* exist and IndexError if the +index+ is out of range.
*
* Customer = Struct.new(:name, :address, :zip)
@@ -919,30 +818,35 @@ rb_struct_aref(VALUE s, VALUE idx)
VALUE
rb_struct_aset(VALUE s, VALUE idx, VALUE val)
{
- int i = rb_struct_pos(s, &idx);
- if (i < 0) invalid_struct_pos(s, idx);
+ long i;
+
+ if (RB_TYPE_P(idx, T_SYMBOL)) {
+ return rb_struct_aset_id(s, SYM2ID(idx), val);
+ }
+ if (RB_TYPE_P(idx, T_STRING)) {
+ ID id = rb_check_id(&idx);
+ if (!id) {
+ rb_name_error_str(idx, "no member '%"PRIsVALUE"' in struct",
+ QUOTE(idx));
+ }
+ return rb_struct_aset_id(s, id, val);
+ }
+
+ i = NUM2LONG(idx);
+ if (i < 0) i = RSTRUCT_LEN(s) + i;
+ if (i < 0) {
+ rb_raise(rb_eIndexError, "offset %ld too small for struct(size:%ld)",
+ i, RSTRUCT_LEN(s));
+ }
+ if (RSTRUCT_LEN(s) <= i) {
+ rb_raise(rb_eIndexError, "offset %ld too large for struct(size:%ld)",
+ i, RSTRUCT_LEN(s));
+ }
rb_struct_modify(s);
RSTRUCT_SET(s, i, val);
return val;
}
-FUNC_MINIMIZED(VALUE rb_struct_lookup(VALUE s, VALUE idx));
-NOINLINE(static VALUE rb_struct_lookup_default(VALUE s, VALUE idx, VALUE notfound));
-
-VALUE
-rb_struct_lookup(VALUE s, VALUE idx)
-{
- return rb_struct_lookup_default(s, idx, Qnil);
-}
-
-static VALUE
-rb_struct_lookup_default(VALUE s, VALUE idx, VALUE notfound)
-{
- int i = rb_struct_pos(s, &idx);
- if (i < 0) return notfound;
- return RSTRUCT_GET(s, i);
-}
-
static VALUE
struct_entry(VALUE s, long n)
{
@@ -1045,17 +949,8 @@ rb_struct_equal(VALUE s, VALUE s2)
return rb_exec_recursive_paired(recursive_equal, s, s2, s2);
}
-/*
- * call-seq:
- * struct.hash -> fixnum
- *
- * Returns a hash value based on this struct's contents (see Object#hash).
- *
- * See also Object#hash.
- */
-
static VALUE
-rb_struct_hash(VALUE s)
+recursive_hash(VALUE s, VALUE dummy, int recur)
{
long i, len;
st_index_t h;
@@ -1063,16 +958,31 @@ rb_struct_hash(VALUE s)
const VALUE *ptr;
h = rb_hash_start(rb_hash(rb_obj_class(s)));
- ptr = RSTRUCT_CONST_PTR(s);
- len = RSTRUCT_LEN(s);
- for (i = 0; i < len; i++) {
- n = rb_hash(ptr[i]);
- h = rb_hash_uint(h, NUM2LONG(n));
+ if (!recur) {
+ ptr = RSTRUCT_CONST_PTR(s);
+ len = RSTRUCT_LEN(s);
+ for (i = 0; i < len; i++) {
+ n = rb_hash(ptr[i]);
+ h = rb_hash_uint(h, NUM2LONG(n));
+ }
}
h = rb_hash_end(h);
return INT2FIX(h);
}
+/*
+ * call-seq:
+ * struct.hash -> fixnum
+ *
+ * Returns a hash value based on this struct's contents (see Object#hash).
+ */
+
+static VALUE
+rb_struct_hash(VALUE s)
+{
+ return rb_exec_recursive_outer(recursive_hash, s, 0);
+}
+
static VALUE
recursive_eql(VALUE s, VALUE s2, int recur)
{
@@ -1130,33 +1040,6 @@ rb_struct_size(VALUE s)
}
/*
- * call-seq:
- * struct.dig(key, ...) -> object
- *
- * Extracts the nested value specified by the sequence of +key+
- * objects by calling +dig+ at each step, returning +nil+ if any
- * intermediate step is +nil+.
- *
- * klass = Struct.new(:a)
- * o = klass.new(klass.new({b: [1, 2, 3]}))
- *
- * o.dig(:a, :a, :b, 0) #=> 1
- * o.dig(:b, 0) #=> nil
- */
-
-static VALUE
-rb_struct_dig(int argc, VALUE *argv, VALUE self)
-{
- rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
- self = rb_struct_lookup(self, *argv);
- if (!--argc) return self;
- ++argv;
- return rb_obj_dig(argc, argv, self, Qnil);
-}
-
-/*
- * Document-class: Struct
- *
* A Struct is a convenient way to bundle a number of attributes together,
* using accessor methods, without having to write an explicit class.
*
@@ -1182,7 +1065,7 @@ rb_struct_dig(int argc, VALUE *argv, VALUE self)
* Symbol (<code>:name</code>).
*/
void
-InitVM_Struct(void)
+Init_Struct(void)
{
rb_cStruct = rb_define_class("Struct", rb_cObject);
rb_include_module(rb_cStruct, rb_mEnumerable);
@@ -1213,15 +1096,5 @@ InitVM_Struct(void)
rb_define_method(rb_cStruct, "values_at", rb_struct_values_at, -1);
rb_define_method(rb_cStruct, "members", rb_struct_members_m, 0);
- rb_define_method(rb_cStruct, "dig", rb_struct_dig, -1);
-}
-
-#undef rb_intern
-void
-Init_Struct(void)
-{
id_members = rb_intern("__members__");
- id_back_members = rb_intern("__members_back__");
-
- InitVM(Struct);
}
diff --git a/symbian/README.SYMBIAN b/symbian/README.SYMBIAN
new file mode 100644
index 0000000000..5b500e3234
--- /dev/null
+++ b/symbian/README.SYMBIAN
@@ -0,0 +1,93 @@
+=begin
+
+= How to build ruby using Symbian SDK
+
+== Requirement
+
+(1) Nokia S60 SDK version 3.2 or later from http://www.forum.nokia.com/Resources_and_Information/Tools/Platforms/S60_Platform_SDKs/ with the latest OpenC plugin installed.
+
+ Note: if you want to build dynamic extensions support you need to install the latest version of GCC compiler from http://www.codesourcery.com/gnu_toolchains/arm/portal/release643. After that you need to apply a patch below to a header file (SDK_ROOT)\epoc32\include\gcce\gcce.h
+
+===================================================================
+--- Epoc32/include/gcce/gcce.h
++++ Epoc32/include/gcce/gcce.h
+@@ -22,4 +22,6 @@
+ #define IMPORT_C __declspec(dllimport)
+ #define EXPORT_C __declspec(dllexport)
++#define IMPORT_D __declspec(dllimport)
++#define EXPORT_D __declspec(dllexport)
+
+
+@@ -79,6 +81,6 @@
+
+ // __NAKED__ from cpudefs.h
+-#define __NAKED__ __asm
+-#define ____ONLY_USE_NAKED_IN_CIA____ __asm
++#define __NAKED__ __declspec(naked)
++#define ____ONLY_USE_NAKED_IN_CIA____ __declspec(naked)
+
+ // Int64 and Uint64 from nkern\nklib.h
+@@ -94,5 +96,9 @@
+ #endif /* __cplusplus */
+
++#if __GNUC__ < 4
+ typedef struct __va_list { void *__ap; } va_list;
++#else
++typedef __builtin_va_list va_list;
++#endif
+
+
+@@ -104,7 +110,13 @@
+ #endif
+
++#if __GNUC__ < 4
+ #define va_start(ap, parmN) __builtin_va_start(ap.__ap, parmN)
+ #define va_arg(ap, type) __builtin_va_arg(ap.__ap, type)
+ #define va_end(ap) __builtin_va_end(ap.__ap)
++#else
++#define va_start(ap, parmN) __builtin_va_start(ap, parmN)
++#define va_arg(ap, type) __builtin_va_arg(ap, type)
++#define va_end(ap) __builtin_va_end(ap)
++#endif
+
+
+@@ -139,5 +151,7 @@
+
+ // Deal with operator new issues here
++#ifndef __SYMBIAN_STDCPP_SUPPORT__
+ #include "..\symcpp.h"
++#endif
+
+ #ifdef __cplusplus
+===================================================================
+
+
+(2) If you want to build from SVN source, following command line binaries are required that are not a part of Symbain SDK.
+ * sed
+ * ruby 1.8
+ * svn
+
+== How to compile and install
+
+(1) Execute symbian\configure.bat on your build directory (symbian is default).
+
+(2) Run the following commands from symbian\group directory
+ 'bldmake bldfiles'
+ 'abld makefile gcce'
+ 'abld build gcce urel ruby'
+ 'abld freeze gcce ruby'
+ 'abld build gcce urel'
+
+(3) Run 'makesis ruby.pkg' from symbian\sis directory
+ This command will create unsigned installation file ruby.sis. To sign it follow the guidlines from www.symbiansigned.com
+
+(4) In case dynamic extensions support was enabled repeat (3) for ruby_core_ext.pkg
+
+== Known problems
+
+Currently gems are not supported.
+Currently signals are supported with reduced functionality (see OpenC release notes.)
+Dynamic extensions could be installed only on internal drive "C".
+
+=end
+
diff --git a/symbian/configure.bat b/symbian/configure.bat
new file mode 100644
index 0000000000..58a83a35fc
--- /dev/null
+++ b/symbian/configure.bat
@@ -0,0 +1,123 @@
+@echo off
+
+setlocal
+
+echo> ~tmp~.mak ####
+echo> ~ver~.mak ####
+
+:loop
+if "%1" == "" goto :end
+if "%1" == "--srcdir" goto :srcdir
+if "%1" == "srcdir" goto :srcdir
+if "%1" == "--target" goto :target
+if "%1" == "target" goto :target
+if "%1" == "--with-static-linked-ext" goto :extstatic
+if "%1" == "--extout" goto :extout
+if "%1" == "--with-baseruby" goto :baseruby
+if "%1" == "-h" goto :help
+if "%1" == "--help" goto :help
+ shift
+goto :loop
+:srcdir
+ echo>> ~tmp~.mak srcdir=%2
+ echo> ~ver~.mak srcdir=%2
+ set srcdir=%2
+ shift
+ shift
+goto :loop
+:target
+ echo>> ~tmp~.mak arch=%2
+ set arch=%2
+ shift
+ shift
+goto :loop
+:extstatic
+ echo>> ~tmp~.mak EXTSTATIC=static
+ shift
+goto :loop
+:extout
+ echo>> ~tmp~.mak EXTOUT=%2
+ set EXTOUT=%2
+ shift
+ shift
+goto :loop
+:baseruby
+ echo>> ~tmp~.mak BASERUBY=%2
+ set BASERUBY=%2
+ shift
+ shift
+goto :loop
+:help
+ echo Configuration:
+ echo --help display this help
+ echo --srcdir=DIR find the sources in DIR [configure dir or ..]
+ echo System types:
+ echo --target=TARGET configure for TARGET [arm-symbianelf]
+ echo Optional Package:
+ echo --with-baseruby=RUBY use RUBY as baseruby [ruby]
+ echo --with-static-linked-ext link external modules statically
+ del ~tmp~.mak > nul
+goto :exit
+:end
+
+echo>> ~ver~.mak CC = arm-none-symbianelf-gcc
+echo>> ~ver~.mak CPP = $(CC) -E
+if "%srcdir%" == "" echo>> ~ver~.mak srcdir=..
+echo>> ~ver~.mak all:
+echo>> ~ver~.mak ^ @echo^> ~tmp~.c #define RUBY_REVISION 0
+echo>> ~ver~.mak ^ @echo^>^> ~tmp~.c #define RUBY_LIB_VERSION_STYLE 3
+echo>> ~ver~.mak ^ @echo^>^> ~tmp~.c #include "version.h"
+echo>> ~ver~.mak ^ @echo^>^> ~tmp~.c MAJOR = RUBY_API_VERSION_MAJOR
+echo>> ~ver~.mak ^ @echo^>^> ~tmp~.c MINOR = RUBY_API_VERSION_MINOR
+echo>> ~ver~.mak ^ @echo^>^> ~tmp~.c TEENY = RUBY_API_VERSION_TEENY
+echo>> ~ver~.mak ^ @$(CPP) -I$(srcdir) -I$(srcdir)\include ~tmp~.c ^| find "=" ^>^>~tmp~.mak
+echo>> ~ver~.mak ^ @del /Q ~tmp~.c
+
+make -f ~ver~.mak
+del /Q ~ver~.mak
+
+:: Defaults
+if "%srcdir%" == "" echo>> ~tmp~.mak srcdir=..
+if "%arch%" == "" echo>> ~tmp~.mak arch=arm-symbianelf
+if "%EXTOUT%" == "" echo>> ~tmp~.mak EXTOUT=$(srcdir)/.ext
+if "%BASERUBY%" == "" echo>> ~tmp~.mak BASERUBY=ruby
+::
+
+echo>> ~tmp~.mak arch_hdrdir = $(EXTOUT)/include/$(arch)
+echo>> ~tmp~.mak hdrdir = $(srcdir)/include
+
+echo>> ~tmp~.mak ifndef EXTSTATIC
+echo>> ~tmp~.mak EXT_LIST=stringio bigdecimal zlib
+echo>> ~tmp~.mak endif
+
+echo>> ~tmp~.mak all:
+echo>> ~tmp~.mak ^ @if not exist $(subst /,\,$(arch_hdrdir))\ruby\nul md $(subst /,\,$(arch_hdrdir)\ruby)
+echo>> ~tmp~.mak ^ $(call config_h,$(subst /,\,$(arch_hdrdir))\ruby\config.h)
+echo>> ~tmp~.mak ^ @if not exist group\nul md group
+echo>> ~tmp~.mak ^ $(call pre_build_mk,pre-build.mk)
+echo>> ~tmp~.mak ^ $(call bld_inf,group\bld.inf)
+echo>> ~tmp~.mak ^ $(call ruby_mmp,group\ruby.mmp,64000,2000000,16000000)
+echo>> ~tmp~.mak ifndef EXTSTATIC
+echo>> ~tmp~.mak ^ $(call ext_mmp,group\,stringio,$(STRINGIO_UID))
+echo>> ~tmp~.mak ^ $(call ext_mmp,group\,bigdecimal,$(BIGDECIMAL_UID),,libm.lib)
+echo>> ~tmp~.mak ^ $(call ext_mmp,group\,zlib,$(ZLIB_UID),,libz.lib)
+echo>> ~tmp~.mak endif
+echo>> ~tmp~.mak ^ @if not exist sis\nul md sis
+echo>> ~tmp~.mak ^ $(call ruby_pkg,sis\ruby.pkg)
+echo>> ~tmp~.mak ifndef EXTSTATIC
+echo>> ~tmp~.mak ^ $(call core_ext_pkg,sis\ruby_core_ext.pkg)
+echo>> ~tmp~.mak ^ $(call ext_bigdecimal,sis\ruby_core_ext.pkg)
+echo>> ~tmp~.mak ^ $(call ext_pkg,sis\ruby_core_ext.pkg,stringio)
+echo>> ~tmp~.mak ^ $(call ext_pkg,sis\ruby_core_ext.pkg,zlib)
+echo>> ~tmp~.mak ^ @if not exist eabi\nul md eabi
+echo>> ~tmp~.mak ^ $(call ext_def,eabi\,stringio)
+echo>> ~tmp~.mak ^ $(call ext_def,eabi\,bigdecimal)
+echo>> ~tmp~.mak ^ $(call ext_def,eabi\,zlib)
+echo>> ~tmp~.mak endif
+
+echo>> ~tmp~.mak include setup
+
+make -f ~tmp~.mak
+del /Q ~tmp~.mak
+
+:exit
diff --git a/symbian/missing-aeabi.c b/symbian/missing-aeabi.c
new file mode 100644
index 0000000000..f8d7a85039
--- /dev/null
+++ b/symbian/missing-aeabi.c
@@ -0,0 +1,18 @@
+#if __GNUC__ > 3
+
+/* GCCE 4.3.2 generates these functions which are are missing from exports (they are simple aliases) */
+extern int __aeabi_uidivmod(unsigned int a, unsigned int b);
+extern int __aeabi_idivmod(int a, int b);
+int __aeabi_idiv(int a, int b)
+{
+ return __aeabi_idivmod(a, b);
+}
+
+int __aeabi_uidiv(unsigned int a, unsigned int b)
+{
+ return __aeabi_uidivmod(a, b);
+}
+
+#endif
+
+
diff --git a/symbian/missing-pips.c b/symbian/missing-pips.c
new file mode 100644
index 0000000000..c5649fb45a
--- /dev/null
+++ b/symbian/missing-pips.c
@@ -0,0 +1,65 @@
+#include <sys/signal.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <pthreadtypes.h>
+
+char **environ = 0;
+
+typedef void (*sighandler_t)(int);
+sighandler_t signal(int signum, sighandler_t handler);
+
+int kill(pid_t pid, int sig);
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
+int execl(const char *path, const char *arg0, ... /*, (char *)0 */);
+int execv(const char *path, char *const argv[]);
+int pthread_kill(pthread_t thread, int sig);
+
+int kill(pid_t pid, int sig)
+{
+ return 0;
+}
+
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
+{
+ return -1;
+}
+
+int execl(const char *path, const char *arg0, ...)
+{
+ return 0;
+}
+
+int execv(const char *path, char *const argv[])
+{
+ return 0;
+}
+
+int pthread_kill(pthread_t thread, int sig)
+{
+ return -1;
+}
+
+
+sighandler_t posix_signal(int signum, sighandler_t handler)
+{
+ return signal((signum),(handler));
+}
+
+int getrlimit(int resource, struct rlimit *rlp)
+{
+ return 0;
+}
+
+int setrlimit(int resource, const struct rlimit *rlp)
+{
+ return 0;
+}
+
+int getrusage(int who, struct rusage *r_usage)
+{
+ return 0;
+}
+
+
+
+
diff --git a/symbian/pre-build b/symbian/pre-build
new file mode 100644
index 0000000000..e118f793e0
--- /dev/null
+++ b/symbian/pre-build
@@ -0,0 +1,83 @@
+YACC = bison
+IFCHANGE = cmd /C $(srcdir)\win32\ifchange.bat
+RM = del
+MV = cmd /C move
+VCS = svn
+
+
+parse.c: $(srcdir)\parse.y $(srcdir)\tool\ytab.sed
+ $(YACC) -d $(YFLAGS) -o y.tab.c $(<:\\=/)
+ sed -f $(srcdir)/tool/ytab.sed -e "/^#/s!y\.tab\.c!$@!" y.tab.c > $@.new
+ @$(MV) $@.new $(@)
+ sed -e "/^#line.*y\.tab\.h/d;/^#line.*parse\.y/d" y.tab.h > $(@:.c=.h).new
+ @$(IFCHANGE) $(@:.c=.h) $(@:.c=.h).new
+ @$(RM) y.tab.c y.tab.h
+
+INSNS = optinsn.inc insns.inc insns_info.inc vmtc.inc vm.inc
+
+INSNS2VMOPT = --srcdir="$(srcdir)"
+
+$(INSNS): $(srcdir)/insns.def $(srcdir)/vm_opts.h $(srcdir)/defs/opt_operand.def $(srcdir)/defs/opt_insn_unif.def
+ $(BASERUBY) -Ks $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT) $@
+
+minsns.inc: $(srcdir)/template/minsns.inc.tmpl
+
+opt_sc.inc: $(srcdir)/template/opt_sc.inc.tmpl
+
+optinsn.inc: $(srcdir)/template/optinsn.inc.tmpl
+
+optunifs.inc: $(srcdir)/template/optunifs.inc.tmpl
+
+insns.inc: $(srcdir)/template/insns.inc.tmpl
+
+insns_info.inc: $(srcdir)/template/insns_info.inc.tmpl
+
+vmtc.inc: $(srcdir)/template/vmtc.inc.tmpl
+
+vm.inc: $(srcdir)/template/vm.inc.tmpl
+
+$(srcdir)/id.h: parse.h $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl
+ $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ $(srcdir)/template/id.h.tmpl parse.h
+
+node_name.inc: $(srcdir)/node.h
+ $(BASERUBY) -n $(srcdir)/tool/node_name.rb $? > $@
+
+known_errors.inc: $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def
+ $(BASERUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/known_errors.inc.tmpl $(srcdir)/defs/known_errors.def
+
+newline.c:
+ $(BASERUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo newline.c $(srcdir)/enc/trans/newline.trans
+
+miniprelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
+ $(BASERUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $@
+
+$(srcdir)/ext/socket/constants.h: $(srcdir)/ext/socket/mkconstants.rb
+ $(BASERUBY) $(srcdir)/ext/socket/mkconstants.rb >$@
+
+
+
+$(srcdir)/revision.h: $(srcdir)/version.h $(srcdir)/ChangeLog
+ @set LC_MESSAGES=C
+ -@$(SET_LC_MESSAGES) $(VCS) info "$(@D)" | \
+ sed -n "s/.*Rev:/#define RUBY_REVISION/p" > "$@.tmp"
+ @$(IFCHANGE) "$@" "$@.tmp"
+
+incs: $(srcdir)/revision.h $(INSNS) node_name.inc known_errors.inc
+
+ids: $(srcdir)/id.h
+
+srcs: parse.c newline.c lex.c miniprelude.c
+
+lex.c: $(srcdir)\lex.c.blt
+ copy $(?:/=\) $@
+
+socket_const: $(srcdir)/ext/socket/constants.h
+
+MAKMAKE: incs srcs ids socket_const
+
+CLEAN :
+ del $(INSNS) node_name.inc known_errors.inc
+ $(RM) parse.c parse.h newline.c lex.c miniprelude.c $(srcdir)\revision.h $(srcdir)\id.h
+
+BLD LIB CLEANLIB RESOURCE FREEZE SAVESPACE RELEASABLES FINAL :
+
diff --git a/symbian/setup b/symbian/setup
new file mode 100644
index 0000000000..74ff21c16a
--- /dev/null
+++ b/symbian/setup
@@ -0,0 +1,440 @@
+define config_h
+@echo>$(1) #define HAVE_PIPS 1
+@echo>>$(1) #define STDC_HEADERS 1
+@echo>>$(1) #define HAVE_SYS_TYPES_H 1
+@echo>>$(1) #define HAVE_SYS_STAT_H 1
+@echo>>$(1) #define HAVE_STDLIB_H 1
+@echo>>$(1) #define HAVE_STRING_H 1
+@echo>>$(1) #define HAVE_MEMORY_H 1
+@echo>>$(1) #define HAVE_STRINGS_H 1
+@echo>>$(1) #define HAVE_INTTYPES_H 1
+@echo>>$(1) #define HAVE_STDINT_H 1
+@echo>>$(1) #define HAVE_UNISTD_H 1
+@echo>>$(1) #define HAVE_LONG_LONG 1
+@echo>>$(1) #define HAVE_OFF_T 1
+@echo>>$(1) #define SIZEOF_INT 4
+@echo>>$(1) #define SIZEOF_SHORT 2
+@echo>>$(1) #define SIZEOF_LONG 4
+@echo>>$(1) #define SIZEOF_LONG_LONG 8
+@echo>>$(1) #define SIZEOF___INT64 8
+@echo>>$(1) #define SIZEOF_OFF_T 8
+@echo>>$(1) #define SIZEOF_VOIDP 4
+@echo>>$(1) #define SIZEOF_FLOAT 4
+@echo>>$(1) #define SIZEOF_DOUBLE 8
+@echo>>$(1) #define SIZEOF_TIME_T 4
+@echo>>$(1) #define TIMET2NUM(v) LONG2NUM(v)
+@echo>>$(1) #define NUM2TIMET(v) NUM2LONG(v)
+@echo>>$(1) #define SIZEOF_SIZE_T 4
+@echo>>$(1) #define SIZEOF_PTRDIFF_T 4
+@echo>>$(1) #define rb_pid_t pid_t
+@echo>>$(1) #define PIDT2NUM(v) LONG2NUM(v)
+@echo>>$(1) #define NUM2PIDT(v) NUM2LONG(v)
+@echo>>$(1) #define rb_uid_t uid_t
+@echo>>$(1) #define UIDT2NUM(v) ULONG2NUM(v)
+@echo>>$(1) #define NUM2UIDT(v) NUM2ULONG(v)
+@echo>>$(1) #define rb_gid_t gid_t
+@echo>>$(1) #define GIDT2NUM(v) ULONG2NUM(v)
+@echo>>$(1) #define NUM2GIDT(v) NUM2ULONG(v)
+@echo>>$(1) #define HAVE_PROTOTYPES 1
+@echo>>$(1) #define TOKEN_PASTE(x,y) x##y
+@echo>>$(1) #define STRINGIZE(expr) STRINGIZE0(expr)
+@echo>>$(1) #define HAVE_STDARG_PROTOTYPES 1
+@echo>>$(1) #define NORETURN(x) __attribute__ ((noreturn)) x
+@echo>>$(1) #define DEPRECATED(x) __attribute__ ((deprecated)) x
+@echo>>$(1) #define NOINLINE(x) __attribute__ ((noinline)) x
+@echo>>$(1) #define FUNC_STDCALL(x) x
+@echo>>$(1) #define FUNC_CDECL(x) x
+@echo>>$(1) #define FUNC_FASTCALL(x) x
+@echo>>$(1) #define HAVE_DECL_SYS_NERR 0
+@echo>>$(1) #define HAVE_LIBDL 1
+@echo>>$(1) #define HAVE_DIRENT_H 1
+@echo>>$(1) #define STDC_HEADERS 1
+@echo>>$(1) #define HAVE_SYS_WAIT_H 1
+@echo>>$(1) #define HAVE_STDLIB_H 1
+@echo>>$(1) #define HAVE_STRING_H 1
+@echo>>$(1) #define HAVE_UNISTD_H 1
+@echo>>$(1) #define HAVE_LIMITS_H 1
+@echo>>$(1) #define HAVE_SYS_IOCTL_H 1
+@echo>>$(1) #define HAVE_FCNTL_H 1
+@echo>>$(1) #define HAVE_SYS_FCNTL_H 1
+@echo>>$(1) #define HAVE_SYS_SELECT_H 1
+@echo>>$(1) #define HAVE_SYS_TIME_H 1
+@echo>>$(1) #define HAVE_SYS_PARAM_H 1
+@echo>>$(1) #define HAVE_PWD_H 1
+@echo>>$(1) #define HAVE_GRP_H 1
+@echo>>$(1) #define HAVE_UTIME_H 1
+@echo>>$(1) #define HAVE_MEMORY_H 1
+@echo>>$(1) #define HAVE_SYS_RESOURCE_H 1
+@echo>>$(1) #define HAVE_FLOAT_H 1
+@echo>>$(1) #define HAVE_PTHREAD_H 1
+@echo>>$(1) #define HAVE_LANGINFO_H 1
+@echo>>$(1) #define HAVE_LOCALE_H 1
+@echo>>$(1) #define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+@echo>>$(1) #define HAVE_ST_BLKSIZE 1
+@echo>>$(1) #define HAVE_STRUCT_STAT_ST_BLOCKS 1
+@echo>>$(1) #define HAVE_ST_BLOCKS 1
+@echo>>$(1) #define HAVE_STRUCT_STAT_ST_RDEV 1
+@echo>>$(1) #define HAVE_ST_RDEV 1
+@echo>>$(1) #define HAVE_INT8_T 1
+@echo>>$(1) #define HAVE_UINT8_T 1
+@echo>>$(1) #define SIZEOF_INT8_T 1
+@echo>>$(1) #define HAVE_INT16_T 1
+@echo>>$(1) #define HAVE_UINT16_T 1
+@echo>>$(1) #define SIZEOF_INT16_T 2
+@echo>>$(1) #define HAVE_INT32_T 1
+@echo>>$(1) #define HAVE_UINT32_T 1
+@echo>>$(1) #define SIZEOF_INT32_T 4
+@echo>>$(1) #define HAVE_INT64_T 1
+@echo>>$(1) #define HAVE_UINT64_T 1
+@echo>>$(1) #define SIZEOF_INT64_T 8
+@echo>>$(1) #define HAVE_STRUCT_STAT_ST_ATIMESPEC 1
+@echo>>$(1) #define HAVE_STRUCT_STAT_ST_MTIMESPEC 1
+@echo>>$(1) #define HAVE_STRUCT_STAT_ST_CTIMESPEC 1
+@echo>>$(1) #define HAVE_STRUCT_TIMESPEC 1
+@echo>>$(1) #define HAVE_STRUCT_TIMEZONE 1
+@echo>>$(1) #define HAVE_RB_FD_INIT 1
+@echo>>$(1) #define GETGROUPS_T gid_t
+@echo>>$(1) #define RETSIGTYPE void
+@echo>>$(1) #define C_ALLOCA 1
+@echo>>$(1) #define HAVE_DUP2 1
+@echo>>$(1) #define HAVE_MEMMOVE 1
+@echo>>$(1) #define HAVE_STRCASECMP 1
+@echo>>$(1) #define HAVE_STRNCASECMP 1
+@echo>>$(1) #define HAVE_STRERROR 1
+@echo>>$(1) #define HAVE_STRFTIME 1
+@echo>>$(1) #define HAVE_STRCHR 1
+@echo>>$(1) #define HAVE_STRSTR 1
+@echo>>$(1) #define HAVE_STRTOUL 1
+@echo>>$(1) #define HAVE_VSNPRINTF 1
+@echo>>$(1) #define HAVE_ISNAN 1
+@echo>>$(1) #define HAVE_FINITE 1
+@echo>>$(1) #define HAVE_ISINF 1
+@echo>>$(1) #define HAVE_HYPOT 1
+@echo>>$(1) #define HAVE_ACOSH 1
+@echo>>$(1) #define HAVE_ERF 1
+@echo>>$(1) #define HAVE_STRLCPY 1
+@echo>>$(1) #define HAVE_STRLCAT 1
+@echo>>$(1) #define HAVE_FMOD 1
+@echo>>$(1) #define HAVE_WAITPID 1
+@echo>>$(1) #define HAVE_FSYNC 1
+@echo>>$(1) #define HAVE_GETCWD 1
+@echo>>$(1) #define HAVE_TRUNCATE 1
+@echo>>$(1) #define HAVE_UTIMES 1
+@echo>>$(1) #define HAVE_FCNTL 1
+@echo>>$(1) #define HAVE_LSTAT 1
+@echo>>$(1) #define HAVE_LINK 1
+@echo>>$(1) #define HAVE_SYMLINK 1
+@echo>>$(1) #define HAVE_READLINK 1
+@echo>>$(1) #define HAVE_SETEUID 1
+@echo>>$(1) #define HAVE_SETREUID 1
+@echo>>$(1) #define HAVE_SETEGID 1
+@echo>>$(1) #define HAVE_SETREGID 1
+@echo>>$(1) #define HAVE_ISSETUGID 1
+@echo>>$(1) #define HAVE_LCHOWN 1
+@echo>>$(1) #define HAVE_GETPGRP 1
+@echo>>$(1) #define HAVE_SETPGRP 1
+@echo>>$(1) #define HAVE_GETPGID 1
+@echo>>$(1) #define HAVE_SETPGID 1
+@echo>>$(1) #define HAVE_INITGROUPS 1
+@echo>>$(1) #define HAVE_GETGROUPS 1
+@echo>>$(1) #define HAVE_SETGROUPS 1
+@echo>>$(1) #define HAVE_GETPRIORITY 1
+@echo>>$(1) #define HAVE_SYSCONF 1
+@echo>>$(1) #define HAVE_DLOPEN 1
+@echo>>$(1) #define HAVE_SIGACTION 1
+@echo>>$(1) #define HAVE_VSNPRINTF 1
+@echo>>$(1) #define HAVE_SNPRINTF 1
+@echo>>$(1) #define HAVE_SETSID 1
+@echo>>$(1) #define HAVE_TELLDIR 1
+@echo>>$(1) #define HAVE_SEEKDIR 1
+@echo>>$(1) #define HAVE_FCHMOD 1
+@echo>>$(1) #define HAVE_COSH 1
+@echo>>$(1) #define HAVE_SINH 1
+@echo>>$(1) #define HAVE_TANH 1
+@echo>>$(1) #define HAVE_ROUND 1
+@echo>>$(1) #define HAVE_SETUID 1
+@echo>>$(1) #define HAVE_SETGID 1
+@echo>>$(1) #define HAVE_SETENV 1
+@echo>>$(1) #define HAVE_UNSETENV 1
+@echo>>$(1) #define VOID_UNSETENV 1
+@echo>>$(1) #define HAVE_MKTIME 1
+@echo>>$(1) #define HAVE_CLOCK_GETTIME 1
+@echo>>$(1) #define HAVE_GETTIMEOFDAY 1
+@echo>>$(1) #define HAVE_STRUCT_TM_TM_ZONE 1
+@echo>>$(1) #define HAVE_TM_ZONE 1
+@echo>>$(1) #define HAVE_STRUCT_TM_TM_GMTOFF 1
+@echo>>$(1) #define NEGATIVE_TIME_T 1
+@echo>>$(1) #define RSHIFT(x,y) ((x)^>^>(int)y)
+@echo>>$(1) #define DOSISH 1
+@echo>>$(1) #define DOSISH_DRIVE_LETTER
+@echo>>$(1) #define RUBY_JMP_BUF jmp_buf
+@echo>>$(1) #define RUBY_SETJMP(env) _setjmp(env)
+@echo>>$(1) #define RUBY_LONGJMP(env,val) _longjmp(env,val)
+@echo>>$(1) #define FILE_COUNT _r
+@echo>>$(1) #define FILE_READPTR _p
+@echo>>$(1) #define HAVE__SC_CLK_TCK 1
+@echo>>$(1) #define STACK_GROW_DIRECTION -1
+@echo>>$(1) #define _REENTRANT 1
+@echo>>$(1) #define _THREAD_SAFE 1
+@echo>>$(1) #define HAVE_LIBPTHREAD 1
+@echo>>$(1) #define HAVE_NANOSLEEP 1
+@echo>>$(1) #define HAVE_LABS 1
+@echo>>$(1) #define HAVE_LLABS 1
+@echo>>$(1) #define USE_ELF 1
+@echo>>$(1) #define MANGLED_PATH 1
+@echo>>$(1) #define DLEXT_MAXLEN 4
+@echo>>$(1) #define DLEXT ".dll"
+@echo>>$(1) #define EXECUTABLE_EXTS ".exe",".com",".cmd",".bat"
+@echo>>$(1) #define RUBY_EXEC_PREFIX ""
+@echo>>$(1) #define DLN_NEEDS_ALT_SEPARATOR '\\'
+@echo>>$(1) #define RUBY_LIB_VERSION_STYLE 3
+@echo>>$(1) #define RUBY_LIB_PREFIX "C:/Data/Ruby/lib"
+@echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib"
+@echo>>$(1) #define RUBY_VENDOR_LIB "F:/Data/Ruby/lib"
+@echo>>$(1) #define RUBY_PLATFORM "$(arch)"
+endef
+
+define pre_build_mk
+@echo>$(1) srcdir = $(srcdir)
+@echo>>$(1) BASERUBY = $(BASERUBY)
+@echo>>$(1) include pre-build
+endef
+
+define bld_inf
+@echo>$(1) PRJ_PLATFORMS
+@echo>>$(1) GCCE $(2)
+@echo>>$(1) PRJ_MMPFILES
+@echo>>$(1) gnumakefile ..\pre-build.mk
+@echo>>$(1) ruby.mmp
+@if not "$(EXT_LIST)" == "" for %%f in ($(EXT_LIST)) do echo>>$(1) %%f.mmp
+endef
+
+
+ifndef EXTSTATIC
+DLN=dln
+else
+DLN=dmydln
+endif
+
+define ruby_mmp
+@echo>$(1) TARGET Ruby.exe
+@echo>>$(1) TARGETTYPE EXEXP
+
+@echo>>$(1) UID 0x100039CE $(RUBY_UID)
+@echo>>$(1) VENDORID 0
+@echo>>$(1) SECUREID $(RUBY_UID)
+@echo>>$(1) CAPABILITY LocalServices NetworkServices ReadUserData UserEnvironment WriteUserData
+
+@echo>>$(1) MACRO RUBY_EXPORT
+
+
+@echo>>$(1) USERINCLUDE ..\$(subst /,\,$(arch_hdrdir))
+@echo>>$(1) USERINCLUDE ..
+@echo>>$(1) USERINCLUDE ..\$(subst /,\,$(srcdir))
+@echo>>$(1) USERINCLUDE ..\$(subst /,\,$(hdrdir))
+@echo>>$(1) USERINCLUDE ..\$(subst /,\,$(hdrdir))\ruby
+@echo>>$(1) USERINCLUDE ..\$(subst /,\,$(srcdir))\missing
+
+@echo>>$(1) SYSTEMINCLUDE ..\$(subst /,\,$(arch_hdrdir))
+@echo>>$(1) SYSTEMINCLUDE ..
+@echo>>$(1) SYSTEMINCLUDE ..\$(subst /,\,$(srcdir))
+@echo>>$(1) SYSTEMINCLUDE ..\$(subst /,\,$(hdrdir))
+@echo>>$(1) SYSTEMINCLUDE ..\$(subst /,\,$(hdrdir))\ruby
+@echo>>$(1) SYSTEMINCLUDE ..\$(subst /,\,$(srcdir))\missing
+
+@echo>>$(1) SYSTEMINCLUDE \epoc32\include
+@echo>>$(1) SYSTEMINCLUDE \epoc32\include\stdapis
+
+@echo>>$(1) SOURCEPATH ..\$(subst /,\,$(srcdir))
+@echo>>$(1) SOURCE array.c
+@echo>>$(1) SOURCE bignum.c
+@echo>>$(1) SOURCE class.c
+@echo>>$(1) SOURCE compar.c
+@echo>>$(1) SOURCE compile.c
+@echo>>$(1) SOURCE cont.c
+@echo>>$(1) SOURCE debug.c
+@echo>>$(1) SOURCE dir.c
+@echo>>$(1) SOURCE $(DLN).c
+@echo>>$(1) SOURCE dln_find.c
+@echo>>$(1) SOURCE dmyext.c
+@echo>>$(1) SOURCE encoding.c
+@echo>>$(1) SOURCE enum.c
+@echo>>$(1) SOURCE enumerator.c
+@echo>>$(1) SOURCE error.c
+@echo>>$(1) SOURCE eval.c
+@echo>>$(1) SOURCE file.c
+@echo>>$(1) SOURCE gc.c
+@echo>>$(1) SOURCE hash.c
+@echo>>$(1) SOURCE inits.c
+@echo>>$(1) SOURCE io.c
+@echo>>$(1) SOURCE iseq.c
+@echo>>$(1) SOURCE load.c
+@echo>>$(1) SOURCE main.c
+@echo>>$(1) SOURCE marshal.c
+@echo>>$(1) SOURCE math.c
+@echo>>$(1) SOURCE node.c
+@echo>>$(1) SOURCE numeric.c
+@echo>>$(1) SOURCE object.c
+@echo>>$(1) SOURCE pack.c
+@echo>>$(1) SOURCE proc.c
+@echo>>$(1) SOURCE process.c
+@echo>>$(1) SOURCE random.c
+@echo>>$(1) SOURCE range.c
+@echo>>$(1) SOURCE re.c
+@echo>>$(1) SOURCE regcomp.c
+@echo>>$(1) SOURCE regenc.c
+@echo>>$(1) SOURCE regerror.c
+@echo>>$(1) SOURCE regexec.c
+@echo>>$(1) SOURCE regparse.c
+@echo>>$(1) SOURCE regsyntax.c
+@echo>>$(1) SOURCE ruby.c
+@echo>>$(1) SOURCE signal.c
+@echo>>$(1) SOURCE sprintf.c
+@echo>>$(1) SOURCE st.c
+@echo>>$(1) SOURCE string.c
+@echo>>$(1) SOURCE struct.c
+@echo>>$(1) SOURCE thread.c
+@echo>>$(1) SOURCE time.c
+@echo>>$(1) SOURCE transcode.c
+@echo>>$(1) SOURCE util.c
+@echo>>$(1) SOURCE variable.c
+@echo>>$(1) SOURCE version.c
+@echo>>$(1) SOURCE vm.c
+@echo>>$(1) SOURCE vm_dump.c
+@echo>>$(1) SOURCE safe.c
+@echo>>$(1) SOURCE rational.c
+@echo>>$(1) SOURCE strftime.c
+@echo>>$(1) SOURCE complex.c
+
+@echo>>$(1) SOURCEPATH ..\$(subst /,\,$(srcdir))\missing
+@echo>>$(1) SOURCE alloca.c
+@echo>>$(1) SOURCE crypt.c
+@echo>>$(1) SOURCE tgamma.c
+@echo>>$(1) SOURCE flock.c
+
+@echo>>$(1) SOURCEPATH ..\$(subst /,\,$(srcdir))\enc
+@echo>>$(1) SOURCE ascii.c
+@echo>>$(1) SOURCE unicode.c
+@echo>>$(1) SOURCE utf_8.c
+@echo>>$(1) SOURCE us_ascii.c
+
+@echo>>$(1) SOURCEPATH ..
+@echo>>$(1) SOURCE miniprelude.c
+@echo>>$(1) SOURCE parse.c
+@echo>>$(1) SOURCE newline.c
+@echo>>$(1) SOURCE missing-pips.c
+@echo>>$(1) SOURCE missing-aeabi.c
+
+
+@echo>>$(1) LIBRARY euser.lib
+@echo>>$(1) LIBRARY libc.lib
+@echo>>$(1) LIBRARY libm.lib
+@echo>>$(1) LIBRARY libpthread.lib
+@echo>>$(1) LIBRARY libdl.lib
+
+@echo>>$(1) STATICLIBRARY libcrt0.lib
+
+@echo>>$(1) EPOCSTACKSIZE $(2)
+@echo>>$(1) EPOCHEAPSIZE $(3) $(4)
+
+@if "$(EXTSTATIC)" == "" echo>>$(1) OPTION GCCE -fvisibility=default
+endef
+
+define ext_mmp
+@echo>$(1)$(2).mmp TARGET $(2).dll
+@echo>>$(1)$(2).mmp TARGETTYPE DLL
+@echo>>$(1)$(2).mmp EPOCALLOWDLLDATA
+@echo>>$(1)$(2).mmp UID 0x10004262 $(3)
+@echo>>$(1)$(2).mmp VENDORID 0
+@echo>>$(1)$(2).mmp SECUREID $(3)
+@echo>>$(1)$(2).mmp CAPABILITY LocalServices NetworkServices ReadUserData UserEnvironment WriteUserData
+
+@echo>>$(1)$(2).mmp USERINCLUDE ..\$(subst /,\,$(arch_hdrdir))
+@echo>>$(1)$(2).mmp USERINCLUDE ..\$(subst /,\,$(srcdir))
+@echo>>$(1)$(2).mmp USERINCLUDE ..\$(subst /,\,$(hdrdir))
+@echo>>$(1)$(2).mmp USERINCLUDE ..\$(subst /,\,$(hdrdir))\ruby
+@echo>>$(1)$(2).mmp USERINCLUDE ..\$(subst /,\,$(srcdir))\missing
+
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE ..\$(subst /,\,$(arch_hdrdir))
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE ..\$(subst /,\,$(srcdir))
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE ..\$(subst /,\,$(hdrdir))
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE ..\$(subst /,\,$(hdrdir))\ruby
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE ..\$(subst /,\,$(srcdir))\missing
+
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE \epoc32\include\stdapis
+@echo>>$(1)$(2).mmp SYSTEMINCLUDE \epoc32\include
+
+@echo>>$(1)$(2).mmp SOURCEPATH ..\$(subst /,\,$(srcdir))\ext\$(2)
+@echo>>$(1)$(2).mmp SOURCE $(2).c $(4)
+
+@echo>>$(1)$(2).mmp LIBRARY euser.lib
+@echo>>$(1)$(2).mmp LIBRARY libc.lib $(5)
+@echo>>$(1)$(2).mmp LIBRARY Ruby.lib
+
+@echo>>$(1)$(2).mmp OPTION GCCE -fvisibility=default
+endef
+
+define ext_def
+@echo>$(1)$(2)u.def EXPORTS
+@echo>>$(1)$(2)u.def ^ Init_$(2) @ 1 NONAME
+endef
+
+define ruby_pkg
+@echo>$(1) ^&EN
+
+@echo>>$(1) #{"Ruby Core"},($(RUBY_UID)),$(MAJOR),$(MINOR),$(TEENY)
+
+@echo>>$(1) %%{"Symbian Research"}
+
+@echo>>$(1) :"Symbian Research"
+
+@echo>>$(1) (0x20013851), 1, 6, 0, {"Symbian OS PIPS"}
+
+@echo>>$(1) [0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+@echo>>$(1) "$(EPOCROOT)epoc32\release\gcce\urel\Ruby.exe"-"!:\sys\bin\Ruby.exe"
+endef
+
+define core_ext_pkg
+@echo>$(1) ^&EN
+
+@echo>>$(1) #{"Ruby Core Extensions"},($(STRINGIO_UID)),$(MAJOR),$(MINOR),$(TEENY)
+
+@echo>>$(1) %%{"Symbian Research"}
+
+@echo>>$(1) :"Symbian Research"
+
+@echo>>$(1) ($(RUBY_UID)), $(MAJOR),$(MINOR),$(TEENY), {"Symbian Ruby"}
+
+@echo>>$(1) [0x101F7961], 0, 0, 0, {"S60ProductID"}
+endef
+
+define ext_pkg
+@echo>>$(1) "$(EPOCROOT)epoc32\release\gcce\urel\$(2).dll"-"!:\sys\bin\$(2).dll"
+@echo>>$(1) "$(EPOCROOT)epoc32\release\gcce\urel\$(2).dll"-"!:\Data\Ruby\lib\$(MAJOR).$(MINOR).$(TEENY)\$(arch)\$(2).dll"
+endef
+
+define ext_bigdecimal
+$(call ext_pkg,$(1),bigdecimal)
+@echo>>$(1) "..\$(subst /,\,$(srcdir))\ext\bigdecimal\lib\bigdecimal\jacobian.rb"-"!:\Data\Ruby\lib\bigdecimal\jacobian.rb"
+@echo>>$(1) "..\$(subst /,\,$(srcdir))\ext\bigdecimal\lib\bigdecimal\ludcmp.rb"-"!:\Data\Ruby\lib\bigdecimal\ludcmp.rb"
+@echo>>$(1) "..\$(subst /,\,$(srcdir))\ext\bigdecimal\lib\bigdecimal\math.rb"-"!:\Data\Ruby\lib\bigdecimal\math.rb"
+@echo>>$(1) "..\$(subst /,\,$(srcdir))\ext\bigdecimal\lib\bigdecimal\newton.rb"-"!:\Data\Ruby\lib\bigdecimal\newton.rb"
+@echo>>$(1) "..\$(subst /,\,$(srcdir))\ext\bigdecimal\lib\bigdecimal\util.rb"-"!:\Data\Ruby\lib\bigdecimal\util.rb"
+endef
+
+EPOCROOT := $(addsuffix \,$(word 3,$(shell devices -info @$(word 3,$(shell devices -default)) | find "Root")))
+
+ifndef SIGNED
+RUBY_UID=0xA0001BC6
+STRINGIO_UID=0xA0001BC7
+BIGDECIMAL_UID=0xA0001BC8
+ZLIB_UID=0xA0001BCB
+else
+RUBY_UID=0x200205CC
+STRINGIO_UID=0x200205CD
+BIGDECIMAL_UID=0x200205CE
+ZLIB_UID=0x200205D0
+endif
+
+
diff --git a/symbol.c b/symbol.c
deleted file mode 100644
index 8e3e0c3c55..0000000000
--- a/symbol.c
+++ /dev/null
@@ -1,1134 +0,0 @@
-/**********************************************************************
-
- symbol.h -
-
- $Author$
- created at: Tue Jul 8 15:49:54 JST 2014
-
- Copyright (C) 2014 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#include "internal.h"
-#include "ruby/st.h"
-#include "symbol.h"
-#include "gc.h"
-#include "probes.h"
-
-#ifndef SYMBOL_DEBUG
-# define SYMBOL_DEBUG 0
-#endif
-
-#define SYMBOL_PINNED_P(sym) (RSYMBOL(sym)->id&~ID_SCOPE_MASK)
-
-#define STATIC_SYM2ID(sym) RSHIFT((unsigned long)(sym), RUBY_SPECIAL_SHIFT)
-
-static ID register_static_symid(ID, const char *, long, rb_encoding *);
-static ID register_static_symid_str(ID, VALUE);
-#define REGISTER_SYMID(id, name) register_static_symid((id), (name), strlen(name), enc)
-#include "id.c"
-
-#define is_identchar(p,e,enc) (rb_enc_isalnum((unsigned char)(*(p)),(enc)) || (*(p)) == '_' || !ISASCII(*(p)))
-
-#define op_tbl_count numberof(op_tbl)
-STATIC_ASSERT(op_tbl_name_size, sizeof(op_tbl[0].name) == 3);
-#define op_tbl_len(i) (!op_tbl[i].name[1] ? 1 : !op_tbl[i].name[2] ? 2 : 3)
-
-static void
-Init_op_tbl(void)
-{
- int i;
- rb_encoding *const enc = rb_usascii_encoding();
-
- for (i = '!'; i <= '~'; ++i) {
- if (!ISALNUM(i) && i != '_') {
- char c = (char)i;
- register_static_symid(i, &c, 1, enc);
- }
- }
- for (i = 0; i < op_tbl_count; ++i) {
- register_static_symid(op_tbl[i].token, op_tbl[i].name, op_tbl_len(i), enc);
- }
-}
-
-enum {ID_ENTRY_UNIT = 512};
-
-enum id_entry_type {
- ID_ENTRY_STR,
- ID_ENTRY_SYM,
- ID_ENTRY_SIZE
-};
-
-static struct symbols {
- rb_id_serial_t last_id;
- st_table *str_sym;
- VALUE ids;
- VALUE dsymbol_fstr_hash;
-} global_symbols = {tNEXT_ID-1};
-
-static const struct st_hash_type symhash = {
- rb_str_hash_cmp,
- rb_str_hash,
-};
-
-void
-Init_sym(void)
-{
- VALUE dsym_fstrs = rb_ident_hash_new();
- global_symbols.dsymbol_fstr_hash = dsym_fstrs;
- rb_gc_register_mark_object(dsym_fstrs);
- rb_obj_hide(dsym_fstrs);
-
- global_symbols.str_sym = st_init_table_with_size(&symhash, 1000);
- global_symbols.ids = rb_ary_tmp_new(0);
- rb_gc_register_mark_object(global_symbols.ids);
-
- Init_op_tbl();
- Init_id();
-}
-
-WARN_UNUSED_RESULT(static VALUE dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding *const enc, const ID type));
-WARN_UNUSED_RESULT(static VALUE dsymbol_check(const VALUE sym));
-WARN_UNUSED_RESULT(static ID lookup_str_id(VALUE str));
-WARN_UNUSED_RESULT(static VALUE lookup_str_sym(const VALUE str));
-WARN_UNUSED_RESULT(static VALUE lookup_id_str(ID id));
-WARN_UNUSED_RESULT(static ID attrsetname_to_attr(VALUE name));
-WARN_UNUSED_RESULT(static ID attrsetname_to_attr_id(VALUE name));
-WARN_UNUSED_RESULT(static ID intern_str(VALUE str, int mutable));
-
-ID
-rb_id_attrset(ID id)
-{
- VALUE str, sym;
- int scope;
-
- if (!is_notop_id(id)) {
- switch (id) {
- case tAREF: case tASET:
- return tASET; /* only exception */
- }
- rb_name_error(id, "cannot make operator ID :%"PRIsVALUE" attrset",
- rb_id2str(id));
- }
- else {
- scope = id_type(id);
- switch (scope) {
- case ID_LOCAL: case ID_INSTANCE: case ID_GLOBAL:
- case ID_CONST: case ID_CLASS: case ID_JUNK:
- break;
- case ID_ATTRSET:
- return id;
- default:
- {
- if ((str = lookup_id_str(id)) != 0) {
- rb_name_error(id, "cannot make unknown type ID %d:%"PRIsVALUE" attrset",
- scope, str);
- }
- else {
- rb_name_error_str(Qnil, "cannot make unknown type anonymous ID %d:%"PRIxVALUE" attrset",
- scope, (VALUE)id);
- }
- }
- }
- }
-
- /* make new symbol and ID */
- if (!(str = lookup_id_str(id))) {
- static const char id_types[][8] = {
- "local",
- "instance",
- "invalid",
- "global",
- "attrset",
- "const",
- "class",
- "junk",
- };
- rb_name_error(id, "cannot make anonymous %.*s ID %"PRIxVALUE" attrset",
- (int)sizeof(id_types[0]), id_types[scope], (VALUE)id);
- }
- str = rb_str_dup(str);
- rb_str_cat(str, "=", 1);
- sym = lookup_str_sym(str);
- id = sym ? rb_sym2id(sym) : intern_str(str, 1);
- return id;
-}
-
-ID
-rb_id_attrget(ID id)
-{
- return attrsetname_to_attr(rb_id2str(id));
-}
-
-static int
-is_special_global_name(const char *m, const char *e, rb_encoding *enc)
-{
- int mb = 0;
-
- if (m >= e) return 0;
- if (is_global_name_punct(*m)) {
- ++m;
- }
- else if (*m == '-') {
- if (++m >= e) return 0;
- if (is_identchar(m, e, enc)) {
- if (!ISASCII(*m)) mb = 1;
- m += rb_enc_mbclen(m, e, enc);
- }
- }
- else {
- if (!rb_enc_isdigit(*m, enc)) return 0;
- do {
- if (!ISASCII(*m)) mb = 1;
- ++m;
- } while (m < e && rb_enc_isdigit(*m, enc));
- }
- return m == e ? mb + 1 : 0;
-}
-
-int
-rb_symname_p(const char *name)
-{
- return rb_enc_symname_p(name, rb_ascii8bit_encoding());
-}
-
-int
-rb_enc_symname_p(const char *name, rb_encoding *enc)
-{
- return rb_enc_symname2_p(name, strlen(name), enc);
-}
-
-#define IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST))
-#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET))
-
-static int
-rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset)
-{
- const char *m = name;
- const char *e = m + len;
- int type = ID_JUNK;
-
- if (!rb_enc_asciicompat(enc)) return -1;
- if (!m || len <= 0) return -1;
- switch (*m) {
- case '\0':
- return -1;
-
- case '$':
- type = ID_GLOBAL;
- if (is_special_global_name(++m, e, enc)) return type;
- goto id;
-
- case '@':
- type = ID_INSTANCE;
- if (*++m == '@') {
- ++m;
- type = ID_CLASS;
- }
- goto id;
-
- case '<':
- switch (*++m) {
- case '<': ++m; break;
- case '=': if (*++m == '>') ++m; break;
- default: break;
- }
- break;
-
- case '>':
- switch (*++m) {
- case '>': case '=': ++m; break;
- }
- break;
-
- case '=':
- switch (*++m) {
- case '~': ++m; break;
- case '=': if (*++m == '=') ++m; break;
- default: return -1;
- }
- break;
-
- case '*':
- if (*++m == '*') ++m;
- break;
-
- case '+': case '-':
- if (*++m == '@') ++m;
- break;
-
- case '|': case '^': case '&': case '/': case '%': case '~': case '`':
- ++m;
- break;
-
- case '[':
- if (m[1] != ']') goto id;
- ++m;
- if (*++m == '=') ++m;
- break;
-
- case '!':
- if (len == 1) return ID_JUNK;
- switch (*++m) {
- case '=': case '~': ++m; break;
- default:
- if (allowed_attrset & (1U << ID_JUNK)) goto id;
- return -1;
- }
- break;
-
- default:
- type = rb_enc_isupper(*m, enc) ? ID_CONST : ID_LOCAL;
- id:
- if (m >= e || (*m != '_' && !rb_enc_isalpha(*m, enc) && ISASCII(*m))) {
- if (len > 1 && *(e-1) == '=') {
- type = rb_enc_symname_type(name, len-1, enc, allowed_attrset);
- if (type != ID_ATTRSET) return ID_ATTRSET;
- }
- return -1;
- }
- while (m < e && is_identchar(m, e, enc)) m += rb_enc_mbclen(m, e, enc);
- if (m >= e) break;
- switch (*m) {
- case '!': case '?':
- if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
- type = ID_JUNK;
- ++m;
- if (m + 1 < e || *m != '=') break;
- /* fall through */
- case '=':
- if (!(allowed_attrset & (1U << type))) return -1;
- type = ID_ATTRSET;
- ++m;
- break;
- }
- break;
- }
- return m == e ? type : -1;
-}
-
-int
-rb_enc_symname2_p(const char *name, long len, rb_encoding *enc)
-{
- return rb_enc_symname_type(name, len, enc, IDSET_ATTRSET_FOR_SYNTAX) != -1;
-}
-
-static int
-rb_str_symname_type(VALUE name, unsigned int allowed_attrset)
-{
- const char *ptr = StringValuePtr(name);
- long len = RSTRING_LEN(name);
- int type = rb_enc_symname_type(ptr, len, rb_enc_get(name), allowed_attrset);
- RB_GC_GUARD(name);
- return type;
-}
-
-static void
-set_id_entry(rb_id_serial_t num, VALUE str, VALUE sym)
-{
- size_t idx = num / ID_ENTRY_UNIT;
- VALUE ary, ids = global_symbols.ids;
- if (idx >= (size_t)RARRAY_LEN(ids) || NIL_P(ary = rb_ary_entry(ids, (long)idx))) {
- ary = rb_ary_tmp_new(ID_ENTRY_UNIT * ID_ENTRY_SIZE);
- rb_ary_store(ids, (long)idx, ary);
- }
- idx = (num % ID_ENTRY_UNIT) * ID_ENTRY_SIZE;
- rb_ary_store(ary, (long)idx + ID_ENTRY_STR, str);
- rb_ary_store(ary, (long)idx + ID_ENTRY_SYM, sym);
-}
-
-static VALUE
-get_id_entry(rb_id_serial_t num, const enum id_entry_type t)
-{
- if (num && num <= global_symbols.last_id) {
- size_t idx = num / ID_ENTRY_UNIT;
- VALUE ids = global_symbols.ids;
- VALUE ary;
- if (idx < (size_t)RARRAY_LEN(ids) && !NIL_P(ary = rb_ary_entry(ids, (long)idx))) {
- VALUE result = rb_ary_entry(ary, (long)(num % ID_ENTRY_UNIT) * ID_ENTRY_SIZE + t);
- if (!NIL_P(result)) return result;
- }
- }
- return 0;
-}
-
-static inline ID
-#ifdef __GNUC__
-__attribute__((unused))
-#endif
-rb_id_serial_to_id(rb_id_serial_t num)
-{
- if (is_notop_id((ID)num)) {
- VALUE sym = get_id_entry(num, ID_ENTRY_SYM);
- return SYM2ID(sym);
- }
- else {
- return (ID)num;
- }
-}
-
-#if SYMBOL_DEBUG
-static int
-register_sym_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
-{
- if (existing) {
- rb_fatal("symbol :% "PRIsVALUE" is already registered with %"PRIxVALUE,
- (VALUE)*key, (VALUE)*value);
- }
- *value = arg;
- return ST_CONTINUE;
-}
-#endif
-
-static void
-register_sym(VALUE str, VALUE sym)
-{
-#if SYMBOL_DEBUG
- st_update(global_symbols.str_sym, (st_data_t)str,
- register_sym_update_callback, (st_data_t)sym);
-#else
- st_add_direct(global_symbols.str_sym, (st_data_t)str, (st_data_t)sym);
-#endif
-}
-
-static void
-unregister_sym(VALUE str, VALUE sym)
-{
- st_data_t str_data = (st_data_t)str;
- if (!st_delete(global_symbols.str_sym, &str_data, NULL)) {
- rb_bug("%p can't remove str from str_id (%s)", (void *)sym, RSTRING_PTR(str));
- }
-}
-
-static ID
-register_static_symid(ID id, const char *name, long len, rb_encoding *enc)
-{
- VALUE str = rb_enc_str_new(name, len, enc);
- return register_static_symid_str(id, str);
-}
-
-static ID
-register_static_symid_str(ID id, VALUE str)
-{
- rb_id_serial_t num = rb_id_to_serial(id);
- VALUE sym = STATIC_ID2SYM(id);
-
- OBJ_FREEZE(str);
- str = rb_fstring(str);
-
- RUBY_DTRACE_CREATE_HOOK(SYMBOL, RSTRING_PTR(str));
-
- register_sym(str, sym);
- set_id_entry(num, str, sym);
-
- return id;
-}
-
-static int
-sym_check_asciionly(VALUE str)
-{
- if (!rb_enc_asciicompat(rb_enc_get(str))) return FALSE;
- switch (rb_enc_str_coderange(str)) {
- case ENC_CODERANGE_BROKEN:
- rb_raise(rb_eEncodingError, "invalid encoding symbol");
- case ENC_CODERANGE_7BIT:
- return TRUE;
- }
- return FALSE;
-}
-
-#if 0
-/*
- * _str_ itself will be registered at the global symbol table. _str_
- * can be modified before the registration, since the encoding will be
- * set to ASCII-8BIT if it is a special global name.
- */
-
-static inline void
-must_be_dynamic_symbol(VALUE x)
-{
- if (UNLIKELY(!DYNAMIC_SYM_P(x))) {
- if (STATIC_SYM_P(x)) {
- VALUE str = lookup_id_str(RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT));
-
- if (str) {
- rb_bug("wrong argument: %s (inappropriate Symbol)", RSTRING_PTR(str));
- }
- else {
- rb_bug("wrong argument: inappropriate Symbol (%p)", (void *)x);
- }
- }
- else {
- rb_bug("wrong argument type %s (expected Symbol)", rb_builtin_class_name(x));
- }
- }
-}
-#endif
-
-static VALUE
-dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding * const enc, const ID type)
-{
- const VALUE dsym = rb_newobj_of(klass, T_SYMBOL | FL_WB_PROTECTED);
- long hashval;
-
- rb_enc_associate(dsym, enc);
- OBJ_FREEZE(dsym);
- RB_OBJ_WRITE(dsym, &RSYMBOL(dsym)->fstr, str);
- RSYMBOL(dsym)->id = type;
-
- /* we want hashval to be in Fixnum range [ruby-core:15713] r15672 */
- hashval = (long)rb_str_hash(str);
- RSYMBOL(dsym)->hashval = RSHIFT((long)hashval, 1);
-
- register_sym(str, dsym);
- rb_hash_aset(global_symbols.dsymbol_fstr_hash, str, Qtrue);
-
- RUBY_DTRACE_CREATE_HOOK(SYMBOL, RSTRING_PTR(RSYMBOL(dsym)->fstr));
-
- return dsym;
-}
-
-static inline VALUE
-dsymbol_check(const VALUE sym)
-{
- if (UNLIKELY(rb_objspace_garbage_object_p(sym))) {
- const VALUE fstr = RSYMBOL(sym)->fstr;
- const ID type = RSYMBOL(sym)->id & ID_SCOPE_MASK;
- RSYMBOL(sym)->fstr = 0;
-
- unregister_sym(fstr, sym);
- return dsymbol_alloc(rb_cSymbol, fstr, rb_enc_get(fstr), type);
- }
- else {
- return sym;
- }
-}
-
-static ID
-lookup_str_id(VALUE str)
-{
- st_data_t sym_data;
- if (st_lookup(global_symbols.str_sym, (st_data_t)str, &sym_data)) {
- const VALUE sym = (VALUE)sym_data;
-
- if (STATIC_SYM_P(sym)) {
- return STATIC_SYM2ID(sym);
- }
- else if (DYNAMIC_SYM_P(sym)) {
- ID id = RSYMBOL(sym)->id;
- if (id & ~ID_SCOPE_MASK) return id;
- }
- else {
- rb_bug("non-symbol object %s:%"PRIxVALUE" for %"PRIsVALUE" in symbol table",
- rb_builtin_class_name(sym), sym, str);
- }
- }
- return (ID)0;
-}
-
-static VALUE
-lookup_str_sym(const VALUE str)
-{
- st_data_t sym_data;
- if (st_lookup(global_symbols.str_sym, (st_data_t)str, &sym_data)) {
- VALUE sym = (VALUE)sym_data;
-
- if (DYNAMIC_SYM_P(sym)) {
- sym = dsymbol_check(sym);
- }
- return sym;
- }
- else {
- return (VALUE)0;
- }
-}
-
-static VALUE
-lookup_id_str(ID id)
-{
- return get_id_entry(rb_id_to_serial(id), ID_ENTRY_STR);
-}
-
-ID
-rb_intern3(const char *name, long len, rb_encoding *enc)
-{
- VALUE sym;
- struct RString fake_str;
- VALUE str = rb_setup_fake_str(&fake_str, name, len, enc);
- OBJ_FREEZE(str);
-
- sym = lookup_str_sym(str);
- if (sym) return rb_sym2id(sym);
- str = rb_enc_str_new(name, len, enc); /* make true string */
- return intern_str(str, 1);
-}
-
-static ID
-next_id_base(void)
-{
- rb_id_serial_t next_serial = global_symbols.last_id + 1;
-
- if (next_serial == 0) {
- return (ID)-1;
- }
- else {
- const size_t num = ++global_symbols.last_id;
- return num << ID_SCOPE_SHIFT;
- }
-}
-
-static ID
-intern_str(VALUE str, int mutable)
-{
- ID id;
- ID nid;
-
- id = rb_str_symname_type(str, IDSET_ATTRSET_FOR_INTERN);
- if (id == (ID)-1) id = ID_JUNK;
- if (sym_check_asciionly(str)) {
- if (!mutable) str = rb_str_dup(str);
- rb_enc_associate(str, rb_usascii_encoding());
- }
- if ((nid = next_id_base()) == (ID)-1) {
- str = rb_str_ellipsize(str, 20);
- rb_raise(rb_eRuntimeError, "symbol table overflow (symbol %"PRIsVALUE")",
- str);
- }
- id |= nid;
- id |= ID_STATIC_SYM;
- return register_static_symid_str(id, str);
-}
-
-ID
-rb_intern2(const char *name, long len)
-{
- return rb_intern3(name, len, rb_usascii_encoding());
-}
-
-#undef rb_intern
-ID
-rb_intern(const char *name)
-{
- return rb_intern2(name, strlen(name));
-}
-
-ID
-rb_intern_str(VALUE str)
-{
- VALUE sym = lookup_str_sym(str);
-
- if (sym) {
- return SYM2ID(sym);
- }
-
- return intern_str(str, 0);
-}
-
-void
-rb_gc_free_dsymbol(VALUE sym)
-{
- VALUE str = RSYMBOL(sym)->fstr;
-
- if (str) {
- RSYMBOL(sym)->fstr = 0;
- unregister_sym(str, sym);
- rb_hash_delete_entry(global_symbols.dsymbol_fstr_hash, str);
- }
-}
-
-/*
- * call-seq:
- * str.intern -> symbol
- * str.to_sym -> symbol
- *
- * Returns the <code>Symbol</code> corresponding to <i>str</i>, creating the
- * symbol if it did not previously exist. See <code>Symbol#id2name</code>.
- *
- * "Koala".intern #=> :Koala
- * s = 'cat'.to_sym #=> :cat
- * s == :cat #=> true
- * s = '@cat'.to_sym #=> :@cat
- * s == :@cat #=> true
- *
- * This can also be used to create symbols that cannot be represented using the
- * <code>:xxx</code> notation.
- *
- * 'cat and dog'.to_sym #=> :"cat and dog"
- */
-
-VALUE
-rb_str_intern(VALUE str)
-{
-#if USE_SYMBOL_GC
- rb_encoding *enc, *ascii;
- int type;
-#else
- ID id;
-#endif
- VALUE sym = lookup_str_sym(str);
-
- if (sym) {
- return sym;
- }
-
-#if USE_SYMBOL_GC
- enc = rb_enc_get(str);
- ascii = rb_usascii_encoding();
- if (enc != ascii && sym_check_asciionly(str)) {
- str = rb_str_dup(str);
- rb_enc_associate(str, ascii);
- OBJ_FREEZE(str);
- enc = ascii;
- }
- else {
- str = rb_str_new_frozen(str);
- }
- str = rb_fstring(str);
- type = rb_str_symname_type(str, IDSET_ATTRSET_FOR_INTERN);
- if (type < 0) type = ID_JUNK;
- return dsymbol_alloc(rb_cSymbol, str, enc, type);
-#else
- id = intern_str(str, 0);
- return ID2SYM(id);
-#endif
-}
-
-ID
-rb_sym2id(VALUE sym)
-{
- ID id;
- if (STATIC_SYM_P(sym)) {
- id = STATIC_SYM2ID(sym);
- }
- else if (DYNAMIC_SYM_P(sym)) {
- sym = dsymbol_check(sym);
- id = RSYMBOL(sym)->id;
- if (UNLIKELY(!(id & ~ID_SCOPE_MASK))) {
- VALUE fstr = RSYMBOL(sym)->fstr;
- ID num = next_id_base();
-
- RSYMBOL(sym)->id = id |= num;
- /* make it permanent object */
- set_id_entry(rb_id_to_serial(num), fstr, sym);
- rb_hash_delete_entry(global_symbols.dsymbol_fstr_hash, fstr);
- }
- }
- else {
- rb_raise(rb_eTypeError, "wrong argument type %s (expected Symbol)",
- rb_builtin_class_name(sym));
- }
- return id;
-}
-
-#undef rb_id2sym
-VALUE
-rb_id2sym(ID x)
-{
- if (!DYNAMIC_ID_P(x)) return STATIC_ID2SYM(x);
- return get_id_entry(rb_id_to_serial(x), ID_ENTRY_SYM);
-}
-
-
-VALUE
-rb_sym2str(VALUE sym)
-{
- if (DYNAMIC_SYM_P(sym)) {
- return RSYMBOL(sym)->fstr;
- }
- else {
- return rb_id2str(STATIC_SYM2ID(sym));
- }
-}
-
-VALUE
-rb_id2str(ID id)
-{
- VALUE str;
-
- if ((str = lookup_id_str(id)) != 0) {
- if (RBASIC(str)->klass == 0)
- RBASIC_SET_CLASS_RAW(str, rb_cString);
- return str;
- }
-
- return 0;
-}
-
-const char *
-rb_id2name(ID id)
-{
- VALUE str = rb_id2str(id);
-
- if (!str) return 0;
- return RSTRING_PTR(str);
-}
-
-ID
-rb_make_internal_id(void)
-{
- return next_id_base() | ID_INTERNAL | ID_STATIC_SYM;
-}
-
-static int
-symbols_i(st_data_t key, st_data_t value, st_data_t arg)
-{
- VALUE ary = (VALUE)arg;
- VALUE sym = (VALUE)value;
-
- if (STATIC_SYM_P(sym)) {
- rb_ary_push(ary, sym);
- return ST_CONTINUE;
- }
- else if (!DYNAMIC_SYM_P(sym)) {
- rb_bug("invalid symbol: %s", RSTRING_PTR((VALUE)key));
- }
- else if (!SYMBOL_PINNED_P(sym) && rb_objspace_garbage_object_p(sym)) {
- RSYMBOL(sym)->fstr = 0;
- return ST_DELETE;
- }
- else {
- rb_ary_push(ary, sym);
- return ST_CONTINUE;
- }
-
-}
-
-/*
- * call-seq:
- * Symbol.all_symbols => array
- *
- * Returns an array of all the symbols currently in Ruby's symbol
- * table.
- *
- * Symbol.all_symbols.size #=> 903
- * Symbol.all_symbols[1,20] #=> [:floor, :ARGV, :Binding, :symlink,
- * :chown, :EOFError, :$;, :String,
- * :LOCK_SH, :"setuid?", :$<,
- * :default_proc, :compact, :extend,
- * :Tms, :getwd, :$=, :ThreadGroup,
- * :wait2, :$>]
- */
-
-VALUE
-rb_sym_all_symbols(void)
-{
- VALUE ary = rb_ary_new2(global_symbols.str_sym->num_entries);
- st_foreach(global_symbols.str_sym, symbols_i, ary);
- return ary;
-}
-
-size_t
-rb_sym_immortal_count(void)
-{
- return (size_t)global_symbols.last_id;
-}
-
-int
-rb_is_const_id(ID id)
-{
- return is_const_id(id);
-}
-
-int
-rb_is_class_id(ID id)
-{
- return is_class_id(id);
-}
-
-int
-rb_is_global_id(ID id)
-{
- return is_global_id(id);
-}
-
-int
-rb_is_instance_id(ID id)
-{
- return is_instance_id(id);
-}
-
-int
-rb_is_attrset_id(ID id)
-{
- return is_attrset_id(id);
-}
-
-int
-rb_is_local_id(ID id)
-{
- return is_local_id(id);
-}
-
-int
-rb_is_junk_id(ID id)
-{
- return is_junk_id(id);
-}
-
-int
-rb_is_const_sym(VALUE sym)
-{
- return is_const_sym(sym);
-}
-
-int
-rb_is_class_sym(VALUE sym)
-{
- return is_class_sym(sym);
-}
-
-int
-rb_is_global_sym(VALUE sym)
-{
- return is_global_sym(sym);
-}
-
-int
-rb_is_instance_sym(VALUE sym)
-{
- return is_instance_sym(sym);
-}
-
-int
-rb_is_attrset_sym(VALUE sym)
-{
- return is_attrset_sym(sym);
-}
-
-int
-rb_is_local_sym(VALUE sym)
-{
- return is_local_sym(sym);
-}
-
-int
-rb_is_junk_sym(VALUE sym)
-{
- return is_junk_sym(sym);
-}
-
-/**
- * Returns ID for the given name if it is interned already, or 0.
- *
- * \param namep the pointer to the name object
- * \return the ID for *namep
- * \pre the object referred by \p namep must be a Symbol or
- * a String, or possible to convert with to_str method.
- * \post the object referred by \p namep is a Symbol or a
- * String if non-zero value is returned, or is a String
- * if 0 is returned.
- */
-ID
-rb_check_id(volatile VALUE *namep)
-{
- VALUE tmp;
- VALUE name = *namep;
-
- if (STATIC_SYM_P(name)) {
- return STATIC_SYM2ID(name);
- }
- else if (DYNAMIC_SYM_P(name)) {
- if (SYMBOL_PINNED_P(name)) {
- return RSYMBOL(name)->id;
- }
- else {
- *namep = RSYMBOL(name)->fstr;
- return 0;
- }
- }
- else if (!RB_TYPE_P(name, T_STRING)) {
- tmp = rb_check_string_type(name);
- if (NIL_P(tmp)) {
- rb_raise(rb_eTypeError, "%+"PRIsVALUE" is not a symbol nor a string",
- name);
- }
- name = tmp;
- *namep = name;
- }
-
- sym_check_asciionly(name);
-
- return lookup_str_id(name);
-}
-
-VALUE
-rb_check_symbol(volatile VALUE *namep)
-{
- VALUE sym;
- VALUE tmp;
- VALUE name = *namep;
-
- if (STATIC_SYM_P(name)) {
- return name;
- }
- else if (DYNAMIC_SYM_P(name)) {
- if (!SYMBOL_PINNED_P(name)) {
- name = dsymbol_check(name);
- *namep = name;
- }
- return name;
- }
- else if (!RB_TYPE_P(name, T_STRING)) {
- tmp = rb_check_string_type(name);
- if (NIL_P(tmp)) {
- rb_raise(rb_eTypeError, "%+"PRIsVALUE" is not a symbol nor a string",
- name);
- }
- name = tmp;
- *namep = name;
- }
-
- sym_check_asciionly(name);
-
- if ((sym = lookup_str_sym(name)) != 0) {
- return sym;
- }
-
- return Qnil;
-}
-
-ID
-rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
-{
- struct RString fake_str;
- const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);
-
- sym_check_asciionly(name);
-
- return lookup_str_id(name);
-}
-
-VALUE
-rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
-{
- VALUE sym;
- struct RString fake_str;
- const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);
-
- sym_check_asciionly(name);
-
- if ((sym = lookup_str_sym(name)) != 0) {
- return sym;
- }
-
- return Qnil;
-}
-
-#undef rb_sym_intern_cstr
-#undef rb_sym_intern_ascii_cstr
-#ifdef __clang__
-NOINLINE(VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc));
-#else
-FUNC_MINIMIZED(VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc));
-FUNC_MINIMIZED(VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc));
-FUNC_MINIMIZED(VALUE rb_sym_intern_ascii(const char *ptr, long len));
-FUNC_MINIMIZED(VALUE rb_sym_intern_ascii_cstr(const char *ptr));
-#endif
-
-VALUE
-rb_sym_intern(const char *ptr, long len, rb_encoding *enc)
-{
- struct RString fake_str;
- const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);
- return rb_str_intern(name);
-}
-
-VALUE
-rb_sym_intern_cstr(const char *ptr, rb_encoding *enc)
-{
- return rb_sym_intern(ptr, strlen(ptr), enc);
-}
-
-VALUE
-rb_sym_intern_ascii(const char *ptr, long len)
-{
- return rb_sym_intern(ptr, len, rb_usascii_encoding());
-}
-
-VALUE
-rb_sym_intern_ascii_cstr(const char *ptr)
-{
- return rb_sym_intern_ascii(ptr, strlen(ptr));
-}
-
-static ID
-attrsetname_to_attr_id(VALUE name)
-{
- ID id;
- struct RString fake_str;
- /* make local name by chopping '=' */
- const VALUE localname = rb_setup_fake_str(&fake_str,
- RSTRING_PTR(name), RSTRING_LEN(name) - 1,
- rb_enc_get(name));
- OBJ_FREEZE(localname);
-
- if ((id = lookup_str_id(localname)) != 0) {
- return id;
- }
- RB_GC_GUARD(name);
- return (ID)0;
-}
-
-static ID
-attrsetname_to_attr(VALUE name)
-{
- if (rb_is_attrset_name(name)) {
- return attrsetname_to_attr_id(name);
- }
-
- return (ID)0;
-}
-
-int
-rb_is_const_name(VALUE name)
-{
- return rb_str_symname_type(name, 0) == ID_CONST;
-}
-
-int
-rb_is_class_name(VALUE name)
-{
- return rb_str_symname_type(name, 0) == ID_CLASS;
-}
-
-int
-rb_is_global_name(VALUE name)
-{
- return rb_str_symname_type(name, 0) == ID_GLOBAL;
-}
-
-int
-rb_is_instance_name(VALUE name)
-{
- return rb_str_symname_type(name, 0) == ID_INSTANCE;
-}
-
-int
-rb_is_attrset_name(VALUE name)
-{
- return rb_str_symname_type(name, IDSET_ATTRSET_FOR_INTERN) == ID_ATTRSET;
-}
-
-int
-rb_is_local_name(VALUE name)
-{
- return rb_str_symname_type(name, 0) == ID_LOCAL;
-}
-
-int
-rb_is_method_name(VALUE name)
-{
- switch (rb_str_symname_type(name, 0)) {
- case ID_LOCAL: case ID_ATTRSET: case ID_JUNK:
- return TRUE;
- }
- return FALSE;
-}
-
-int
-rb_is_junk_name(VALUE name)
-{
- return rb_str_symname_type(name, IDSET_ATTRSET_FOR_SYNTAX) == -1;
-}
-
-#include "id_table.c"
diff --git a/symbol.h b/symbol.h
deleted file mode 100644
index 641b9792ed..0000000000
--- a/symbol.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/**********************************************************************
-
- symbol.h -
-
- $Author$
- created at: Tue Jul 8 15:49:54 JST 2014
-
- Copyright (C) 2014 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#ifndef RUBY_SYMBOL_H
-#define RUBY_SYMBOL_H 1
-
-#include "id.h"
-
-#define DYNAMIC_ID_P(id) (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)
-#define STATIC_ID2SYM(id) (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
-
-#ifdef __GNUC__
-#define rb_id2sym(id) \
- __extension__(__builtin_constant_p(id) && !DYNAMIC_ID_P(id) ? \
- STATIC_ID2SYM(id) : rb_id2sym(id))
-#endif
-
-struct RSymbol {
- struct RBasic basic;
- st_index_t hashval;
- VALUE fstr;
- ID id;
-};
-
-#define RSYMBOL(obj) (R_CAST(RSymbol)(obj))
-
-#define is_notop_id(id) ((id)>tLAST_OP_ID)
-#define is_local_id(id) (id_type(id)==ID_LOCAL)
-#define is_global_id(id) (id_type(id)==ID_GLOBAL)
-#define is_instance_id(id) (id_type(id)==ID_INSTANCE)
-#define is_attrset_id(id) ((id)==idASET||id_type(id)==ID_ATTRSET)
-#define is_const_id(id) (id_type(id)==ID_CONST)
-#define is_class_id(id) (id_type(id)==ID_CLASS)
-#define is_junk_id(id) (id_type(id)==ID_JUNK)
-
-static inline int
-id_type(ID id)
-{
- if (is_notop_id(id)) {
- return (int)(id&ID_SCOPE_MASK);
- }
- else {
- return -1;
- }
-}
-
-typedef uint32_t rb_id_serial_t;
-
-static inline rb_id_serial_t
-rb_id_to_serial(ID id)
-{
- if (is_notop_id(id)) {
- return (rb_id_serial_t)(id >> ID_SCOPE_SHIFT);
- }
- else {
- return (rb_id_serial_t)id;
- }
-}
-
-static inline int
-sym_type(VALUE sym)
-{
- ID id;
- if (STATIC_SYM_P(sym)) {
- id = RSHIFT(sym, RUBY_SPECIAL_SHIFT);
- if (id<=tLAST_OP_ID) {
- return -1;
- }
- }
- else {
- id = RSYMBOL(sym)->id;
- }
- return (int)(id&ID_SCOPE_MASK);
-}
-
-#define is_local_sym(sym) (sym_type(sym)==ID_LOCAL)
-#define is_global_sym(sym) (sym_type(sym)==ID_GLOBAL)
-#define is_instance_sym(sym) (sym_type(sym)==ID_INSTANCE)
-#define is_attrset_sym(sym) (sym_type(sym)==ID_ATTRSET)
-#define is_const_sym(sym) (sym_type(sym)==ID_CONST)
-#define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
-#define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
-
-RUBY_FUNC_EXPORTED const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
-
-static inline int
-is_global_name_punct(const int c)
-{
- if (c <= 0x20 || 0x7e < c) return 0;
- return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
-}
-
-ID rb_intern_cstr_without_pindown(const char *, long, rb_encoding *);
-
-RUBY_SYMBOL_EXPORT_BEGIN
-
-size_t rb_sym_immortal_count(void);
-
-RUBY_SYMBOL_EXPORT_END
-#endif
diff --git a/template/Doxyfile.tmpl b/template/Doxyfile.tmpl
index 2fb7588b02..6b91e20c1d 100644
--- a/template/Doxyfile.tmpl
+++ b/template/Doxyfile.tmpl
@@ -104,7 +104,7 @@ WARN_LOGFILE =
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c *.h *.y *.def
RECURSIVE = YES
-EXCLUDE = ext/dl/callback ccan
+EXCLUDE = ext/dl/callback
EXCLUDE_SYMLINKS = YES
EXCLUDE_PATTERNS = *.src doc enc build */ext/-test-/* tmp test yarvtest lib bootstraptest spec .ext .git .svn extconf.h *prelude.c encdb.h transdb.h insns.def
EXCLUDE_SYMBOLS =
diff --git a/template/fake.rb.in b/template/fake.rb.in
index 5e95530c38..c94eec3516 100644
--- a/template/fake.rb.in
+++ b/template/fake.rb.in
@@ -1,40 +1,47 @@
-<%
-arg = {}
-while /\A(\w+)=(.*)/ =~ ARGV[0]
- arg[$1] = $2
- arg[$1].tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
- ARGV.shift
-end
-if inc = arg['i']
- src = inc == '-' ? STDIN.read : File.read(inc)
- arg['versions'] = version = {}
- File.read(File.join(arg['srcdir'], 'version.c')).
- scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|STR)\(([^()]*)\)/m) do |n, v|
- version[n] =
- eval(src[/\bruby_#{v}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
- end
-end
-%>baseruby="<%=arg['BASERUBY']%>"
-_\
-=begin
-_=
+baseruby="@BASERUBY@"
ruby="${RUBY-$baseruby}"
-case "$ruby" in "echo "*) $ruby; exit $?;; esac
-case "$0" in /*) r=-r"$0";; *) r=-r"./$0";; esac
-exec $ruby "$r" "$@"
-=end
-=baseruby
+"eval" "{" \
+"`expr \"$ruby\" : echo > /dev/null || echo exec`" \
+"$ruby" '-r"`expr \"$0\" : / > /dev/null || pwd`/${0#/}" "$@";' \
+"}" || "exit" "$?"
+ruby=ruby
class Object
remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
CROSS_COMPILING = RUBY_PLATFORM
- constants.grep(/^RUBY_/) {|n| remove_const n}
-% arg['versions'].each {|n, v|
- <%=n%> = <%=v.inspect%>
-% }
+ remove_const :RUBY_PLATFORM
+ remove_const :RUBY_VERSION
+ remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
+ RUBY_PLATFORM = "@arch@"
+ RUBY_VERSION = "@RUBY_PROGRAM_VERSION@"
+ RUBY_DESCRIPTION = "ruby #{RUBY_VERSION} (@RUBY_RELEASE_DATE@) [#{RUBY_PLATFORM}]"
+end
+if RUBY_PLATFORM =~ /mswin|bccwin|mingw/
+ class File
+ remove_const :ALT_SEPARATOR
+ ALT_SEPARATOR = "\\"
+ end
+end
+
+builddir = File.expand_path(File.dirname(__FILE__))
+$:.unshift(builddir)
+posthook = proc do
+ mkconfig = RbConfig::MAKEFILE_CONFIG
+ extout = File.expand_path(mkconfig["EXTOUT"], builddir)
+ $arch_hdrdir = "#{extout}/include/$(arch)"
+ $ruby = baseruby
+ untrace_var(:$ruby, posthook)
+end
+prehook = proc do |extmk|
+ unless extmk
+ config = RbConfig::CONFIG
+ mkconfig = RbConfig::MAKEFILE_CONFIG
+ mkconfig["top_srcdir"] = $top_srcdir = File.expand_path("@top_srcdir@", builddir)
+ mkconfig["rubyhdrdir"] = "$(top_srcdir)/include"
+ mkconfig["builddir"] = config["builddir"] = builddir
+ config["rubyhdrdir"] = File.join(mkconfig["top_srcdir"], "include")
+ mkconfig["libdir"] = config["libdir"] = mkconfig["topdir"]
+ trace_var(:$ruby, posthook)
+ end
+ untrace_var(:$extmk, prehook)
end
-builddir = File.dirname(File.expand_path(__FILE__))
-srcdir = "<%=arg['srcdir']%>"
-top_srcdir = File.realpath(srcdir, builddir)
-fake = File.join(top_srcdir, "tool/fake.rb")
-eval(File.read(fake), nil, fake)
-ENV["RUBYOPT"] = ["-r#{__FILE__}", ENV["RUBYOPT"]].compact.join(" ")
+trace_var(:$extmk, prehook)
diff --git a/template/id.c.tmpl b/template/id.c.tmpl
index 477a76bc26..cac213a8fb 100644
--- a/template/id.c.tmpl
+++ b/template/id.c.tmpl
@@ -13,23 +13,7 @@
<%
defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
ids = eval(File.read(defs), binding, defs)
-ops = ids[:token_op].uniq {|id, op, token| token && op}
%>
-% ops.each do |_id, _op, token|
-% next unless token
-#define t<%=token%> RUBY_TOKEN(<%=token%>)
-% end
-
-static const struct {
- unsigned short token;
- const char name[3], term;
-} op_tbl[] = {
-% ops.each do |_id, op, token|
-% next unless token
- {t<%=token%>, "<%=op%>"},
-% end
-};
-
static void
Init_id(void)
{
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index 0db35c1802..9df7947214 100644
--- a/template/id.h.tmpl
+++ b/template/id.h.tmpl
@@ -15,6 +15,12 @@ require 'optparse'
op_id_offset = 128
+token_op_ids = %w[
+ tDOT2 tDOT3 tUPLUS tUMINUS tPOW tDSTAR tCMP tLSHFT tRSHFT
+ tLEQ tGEQ tEQ tEQQ tNEQ tMATCH tNMATCH tAREF tASET
+ tCOLON2 tCOLON3
+]
+
defs = File.join(File.dirname(File.dirname(erb.filename)), "defs/id.def")
ids = eval(File.read(defs), binding, defs)
types = ids.keys.grep(/^[A-Z]/)
@@ -23,20 +29,18 @@ types = ids.keys.grep(/^[A-Z]/)
#define RUBY_ID_H
enum ruby_id_types {
- RUBY_ID_STATIC_SYM = 0x01,
RUBY_ID_LOCAL = 0x00,
- RUBY_ID_INSTANCE = (0x01<<1),
- RUBY_ID_GLOBAL = (0x03<<1),
- RUBY_ID_ATTRSET = (0x04<<1),
- RUBY_ID_CONST = (0x05<<1),
- RUBY_ID_CLASS = (0x06<<1),
- RUBY_ID_JUNK = (0x07<<1),
+ RUBY_ID_INSTANCE = 0x01,
+ RUBY_ID_GLOBAL = 0x03,
+ RUBY_ID_ATTRSET = 0x04,
+ RUBY_ID_CONST = 0x05,
+ RUBY_ID_CLASS = 0x06,
+ RUBY_ID_JUNK = 0x07,
RUBY_ID_INTERNAL = RUBY_ID_JUNK,
- RUBY_ID_SCOPE_SHIFT = 4,
- RUBY_ID_SCOPE_MASK = (~(~0U<<(RUBY_ID_SCOPE_SHIFT-1))<<1)
+ RUBY_ID_SCOPE_SHIFT = 3,
+ RUBY_ID_SCOPE_MASK = ~(~0U<<RUBY_ID_SCOPE_SHIFT)
};
-#define ID_STATIC_SYM RUBY_ID_STATIC_SYM
#define ID_SCOPE_SHIFT RUBY_ID_SCOPE_SHIFT
#define ID_SCOPE_MASK RUBY_ID_SCOPE_MASK
#define ID_LOCAL RUBY_ID_LOCAL
@@ -48,22 +52,43 @@ enum ruby_id_types {
#define ID_JUNK RUBY_ID_JUNK
#define ID_INTERNAL RUBY_ID_INTERNAL
+#define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)
+
#define symIFUNC ID2SYM(idIFUNC)
#define symCFUNC ID2SYM(idCFUNC)
-% index = op_id_offset
-% ids[:token_op].each do |_id, _op, token|
-% next unless token
-#define RUBY_TOKEN_<%=token%> <%=index%>
-% index += 1
+% token_op_ids.each_with_index do |token, index|
+#define RUBY_TOKEN_<%=token[/\At(.+)\z/, 1]%> <%=op_id_offset + index%>
% end
#define RUBY_TOKEN(t) RUBY_TOKEN_##t
enum ruby_method_ids {
-% ids[:token_op].uniq {|_, op| op}.each do |id, op, token|
- id<%=id%> = <%=token ? "RUBY_TOKEN(#{token})" : "'#{op}'"%>,
-% end
- tPRESERVED_ID_BEGIN = <%=index-1%>,
+ idDot2 = RUBY_TOKEN(DOT2),
+ idDot3 = RUBY_TOKEN(DOT3),
+ idUPlus = RUBY_TOKEN(UPLUS),
+ idUMinus = RUBY_TOKEN(UMINUS),
+ idPow = RUBY_TOKEN(POW),
+ idCmp = RUBY_TOKEN(CMP),
+ idPLUS = '+',
+ idMINUS = '-',
+ idMULT = '*',
+ idDIV = '/',
+ idMOD = '%',
+ idLT = '<',
+ idLTLT = RUBY_TOKEN(LSHFT),
+ idLE = RUBY_TOKEN(LEQ),
+ idGT = '>',
+ idGE = RUBY_TOKEN(GEQ),
+ idEq = RUBY_TOKEN(EQ),
+ idEqq = RUBY_TOKEN(EQQ),
+ idNeq = RUBY_TOKEN(NEQ),
+ idNot = '!',
+ idBackquote = '`',
+ idEqTilde = RUBY_TOKEN(MATCH),
+ idNeqTilde = RUBY_TOKEN(NMATCH),
+ idAREF = RUBY_TOKEN(AREF),
+ idASET = RUBY_TOKEN(ASET),
+ tPRESERVED_ID_BEGIN = <%=op_id_offset + token_op_ids.size - 1%>,
% ids[:preserved].each do |token|
id<%=token%>,
% end
@@ -71,11 +96,10 @@ enum ruby_method_ids {
% ids.values_at(*types).flatten.each do |token|
t<%=token%>,
% end
- tNEXT_ID,
% types.each do |type|
% types = ids[type] or next
% types.empty? and next
-#define TOKEN2<%=type%>ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_<%=type%>|ID_STATIC_SYM)
+#define TOKEN2<%=type%>ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_<%=type%>)
% types.each do |token|
TOKEN2<%=type%>ID(<%=token%>),
% end
diff --git a/template/insns.inc.tmpl b/template/insns.inc.tmpl
index 203273f92b..6543686003 100644
--- a/template/insns.inc.tmpl
+++ b/template/insns.inc.tmpl
@@ -6,7 +6,7 @@
DO NOT TOUCH!
If you want to fix something, you must edit 'template/insns.inc.tmpl'
- or tool/insns2vm.rb
+ or insns2vm.rb
*/
diff --git a/template/insns_info.inc.tmpl b/template/insns_info.inc.tmpl
index 14b4ef50ab..99e4b7b5b3 100644
--- a/template/insns_info.inc.tmpl
+++ b/template/insns_info.inc.tmpl
@@ -6,7 +6,7 @@
DO NOT TOUCH!
If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
- or tool/insns2vm.rb
+ or insns2vm.rb
*/
<%= insn_type_chars %>
diff --git a/template/known_errors.inc.tmpl b/template/known_errors.inc.tmpl
index c3aee77477..deb54e44d7 100644
--- a/template/known_errors.inc.tmpl
+++ b/template/known_errors.inc.tmpl
@@ -1,6 +1,6 @@
/** -*-c-*-
* DO NOT EDIT
- * This file is automatically generated by tool/generic_erb.rb from
+ * This file is automatically generated by tools/generic_erb.rb from
* template/known_errors.inc.tmpl and defs/known_errors.def.
*/
diff --git a/template/minsns.inc.tmpl b/template/minsns.inc.tmpl
index 54b192898f..b9e037e978 100644
--- a/template/minsns.inc.tmpl
+++ b/template/minsns.inc.tmpl
@@ -6,7 +6,7 @@
DO NOT TOUCH!
If you want to fix something, you must edit 'template/minsns.inc.tmpl'
- or tool/insns2vm.rb
+ or insns2vm.rb
*/
<%= defs %>
diff --git a/template/opt_sc.inc.tmpl b/template/opt_sc.inc.tmpl
index 41492b2bb6..7d7ce717dc 100644
--- a/template/opt_sc.inc.tmpl
+++ b/template/opt_sc.inc.tmpl
@@ -9,7 +9,7 @@
DO NOT TOUCH!
If you want to fix something, you must edit 'template/opt_sc.inc.tmpl'
- or tool/insns2vm.rb
+ or rb/insns2vm.rb
*/
#define SC_STATE_SIZE 6
diff --git a/template/optinsn.inc.tmpl b/template/optinsn.inc.tmpl
index 3c4f732290..b4b4b6b05a 100644
--- a/template/optinsn.inc.tmpl
+++ b/template/optinsn.inc.tmpl
@@ -9,7 +9,7 @@
DO NOT TOUCH!
If you want to fix something, you must edit 'template/optinsn.inc.tmpl'
- or tool/insns2vm.rb
+ or rb/insns2vm.rb
*/
static INSN *
diff --git a/template/optunifs.inc.tmpl b/template/optunifs.inc.tmpl
index af313a9b45..61364a3bd4 100644
--- a/template/optunifs.inc.tmpl
+++ b/template/optunifs.inc.tmpl
@@ -9,7 +9,7 @@
DO NOT TOUCH!
If you want to fix something, you must edit 'template/optunifs.inc.tmpl'
- or tool/insns2vm.rb
+ or rb/insns2vm.rb
*/
/*
diff --git a/template/ruby-runner.c.in b/template/ruby-runner.c.in
deleted file mode 100644
index 75be21573f..0000000000
--- a/template/ruby-runner.c.in
+++ /dev/null
@@ -1,37 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define BUILDDIR "@abs_top_builddir@"
-#define LIBPATHENV "@LIBPATHENV@"
-#define PATH_SEP '@PATH_SEPARATOR@'
-
-#define STRINGIZE(expr) STRINGIZE0(expr)
-#define STRINGIZE0(expr) #expr
-
-int
-main(int argc, char **argv)
-{
- static const char builddir[] = BUILDDIR;
- const char *libpath = getenv(LIBPATHENV);
- char c = 0;
-
- if (libpath) {
- while ((c = *libpath) == PATH_SEP) ++libpath;
- }
- if (c) {
- size_t n = strlen(libpath);
- char *e = malloc(sizeof(builddir)+n+1);
- memcpy(e, builddir, sizeof(builddir)-1);
- e[sizeof(builddir)-1] = PATH_SEP;
- memcpy(e+sizeof(builddir), libpath, n+1);
- libpath = e;
- }
- else {
- libpath = builddir;
- }
- setenv(LIBPATHENV, libpath, 1);
- execv(BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME), argv);
- return -1;
-}
diff --git a/template/sizes.c.tmpl b/template/sizes.c.tmpl
index bd4a7c56de..ac9964dd5b 100644
--- a/template/sizes.c.tmpl
+++ b/template/sizes.c.tmpl
@@ -6,9 +6,7 @@ class String
strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
end
end
-types = ARGF.grep(/^\s*RUBY_CHECK_SIZEOF\((\w[^\[\],#]*)[^#]*\)|
- ^\s*RUBY_DEFINT\((\w[^\[\],#]*)[^#]*\)|
- ^\s*check_sizeof\('(.+?)'/x) {$+}
+types = ARGF.grep(/^\s*RUBY_CHECK_SIZEOF\((\w[^\[\],#]*)[^#]*\)/) {$1}
conditions = {
"long long" => 'defined(HAVE_TRUE_LONG_LONG)',
}
@@ -19,7 +17,7 @@ Init_sizeof(void)
VALUE s = rb_hash_new();
rb_define_const(rb_define_module("RbConfig"), "SIZEOF", s);
-#define DEFINE(type, size) rb_hash_aset(s, rb_str_new_cstr(#type), INT2FIX(SIZEOF_##size))
+#define DEFINE(type, size) rb_hash_aset(s, rb_str_new_cstr(#type), INT2FIX(SIZEOF_##size));
% types.each do |type|
% cond = conditions[type]
diff --git a/template/unicode_norm_gen.tmpl b/template/unicode_norm_gen.tmpl
deleted file mode 100644
index f95d842865..0000000000
--- a/template/unicode_norm_gen.tmpl
+++ /dev/null
@@ -1,222 +0,0 @@
-%# -*- mode: ruby; coding: utf-8 -*-
-<%
-# Copyright Ayumu Nojima (野島 歩) and Martin J. Dürst (duerst@it.aoyama.ac.jp)
-
-# Script to generate Ruby data structures used in implementing
-# String#unicode_normalize,...
-
-# Constants for input and ouput directory
-InputDataDir = ARGV[0] || 'enc/unicode/data'
-unicode_version = InputDataDir[/[\d.]+\z/]
-
-# convenience methods
-class Integer
- def to_UTF8() # convert to string, taking legibility into account
- if self>0xFFFF
- "\\u{#{to_s(16).upcase}}"
- elsif self>0x7f
- "\\u#{to_s(16).upcase.rjust(4, '0')}"
- else
- chr.sub(/[\\\"]/, "\\\\\\\&")
- end
- end
-end
-
-module Enumerable
- unless method_defined?(:each_slice)
- def each_slice(n)
- ary = []
- each do |i|
- ary << i
- if ary.size >= n
- yield ary
- ary = []
- end
- end
- yield ary unless ary.empty?
- self
- end
- end
-end
-
-class Array
- def to_UTF8() collect {|c| c.to_UTF8}.join('') end
-
- def each_regexp_chars(n = 8) # converts an array of Integers to character ranges
- sort.inject([]) do |ranges, value|
- if ranges.last and ranges.last[1]+1>=value
- ranges.last[1] = value
- ranges
- else
- ranges << [value, value]
- end
- end.collect do |first, last|
- case last-first
- when 0
- first.to_UTF8
- when 1
- first.to_UTF8 + last.to_UTF8
- else
- first.to_UTF8 + '-' + last.to_UTF8
- end
- end.each_slice(n) do |slice|
- yield slice.join('')
- end
- end
-end
-
-# read the file 'CompositionExclusions.txt'
-composition_exclusions = vpath.open("#{InputDataDir}/CompositionExclusions.txt") {|f|
- base = Regexp.quote(File.basename(f.path, '.*'))
- ext = Regexp.quote(File.extname(f.path))
- version = (line = f.gets)[/^# *#{base}-([\d.]+)#{ext}\s*$/, 1] or
- abort "No file version in #{f.path}: #{line}"
- (unicode_version ||= version) == version or
- abort "Unicode version of directory (#{unicode_version}) and file (#{version}) mismatch"
- f.grep(/^[A-Z0-9]{4,5}/) {|code| code.hex}
-}
-
-decomposition_table = {}
-kompatible_table = {}
-combining_class = {} # constant to allow use in Integer#to_UTF8
-
-# read the file 'UnicodeData.txt'
-vpath.foreach("#{InputDataDir}/UnicodeData.txt") do |line|
- codepoint, name, _2, char_class, _4, decomposition, *_rest = line.split(";")
-
- case decomposition
- when /^[0-9A-F]/
- decomposition_table[codepoint.hex] = decomposition.split(' ').collect {|w| w.hex}
- when /^</
- kompatible_table[codepoint.hex] = decomposition.split(' ')[1..-1].collect {|w| w.hex}
- end
- combining_class[codepoint.hex] = char_class.to_i if char_class != "0"
-
- if name=~/(First|Last)>$/ and (char_class!="0" or decomposition!="")
- warn "Unexpected: Character range with data relevant to normalization!"
- end
-end
-
-# calculate compositions from decompositions
-composition_table = decomposition_table.reject do |character, decomposition|
- composition_exclusions.member? character or # predefined composition exclusion
- decomposition.length<=1 or # Singleton Decomposition
- combining_class[character] or # character is not a Starter
- combining_class[decomposition.first] # decomposition begins with a character that is not a Starter
-end.invert
-
-# recalculate composition_exclusions
-composition_exclusions = decomposition_table.keys - composition_table.values
-
-accent_array = combining_class.keys + composition_table.keys.collect {|key| key.last}
-
-composition_starters = composition_table.keys.collect {|key| key.first}
-
-hangul_no_trailing = []
-0xAC00.step(0xD7A3, 28) {|c| hangul_no_trailing << c}
-
-# expand decomposition table values
-decomposition_table.each do |key, value|
- position = 0
- while position < value.length
- if decomposition = decomposition_table[value[position]]
- decomposition_table[key] = value = value.dup # avoid overwriting composition_table key
- value[position, 1] = decomposition
- else
- position += 1
- end
- end
-end
-
-# deal with relationship between canonical and kompatibility decompositions
-decomposition_table.each do |key, value|
- value = value.dup
- expanded = false
- position = 0
- while position < value.length
- if decomposition = kompatible_table[value[position]]
- value[position, 1] = decomposition
- expanded = true
- else
- position += 1
- end
- end
- kompatible_table[key] = value if expanded
-end
-
-while kompatible_table.any? {|key, value|
- expanded = value.map {|v| kompatible_table[v] || v}.flatten
- kompatible_table[key] = expanded unless value == expanded
- }
-end
-
-# generate normalization tables file
-%># coding: us-ascii
-# -*- frozen_string_literal: true -*-
-%# >
-
-# automatically generated by template/unicode_norm_gen.tmpl
-
-module UnicodeNormalize
- UNICODE_VERSION = "<%=unicode_version%>"
-
- accents = "" \
- "[<% accent_array.each_regexp_chars do |rx|%><%=rx%>" \
- "<% end%>]"
- ACCENTS = accents
- REGEXP_D_STRING = "#{'' # composition starters and composition exclusions
- }" \
- "[<% (composition_table.values+composition_exclusions).each_regexp_chars do |rx|%><%=rx%>" \
- "<% end%>]#{accents}*" \
- "|#{'' # characters that can be the result of a composition, except composition starters
- }" \
- "[<% (composition_starters-composition_table.values).each_regexp_chars do |rx|%><%=rx%>" \
- "<% end%>]?#{accents}+" \
- "|#{'' # precomposed Hangul syllables
- }" \
- "[\u{AC00}-\u{D7A4}]"
- REGEXP_C_STRING = "#{'' # composition exclusions
- }" \
- "[<% composition_exclusions.each_regexp_chars do |rx|%><%=rx%>" \
- "<% end%>]#{accents}*" \
- "|#{'' # composition starters and characters that can be the result of a composition
- }" \
- "[<% (composition_starters+composition_table.values).each_regexp_chars do |rx|%><%=rx%>" \
- "<% end%>]?#{accents}+" \
- "|#{'' # Hangul syllables with separate trailer
- }" \
- "[<% hangul_no_trailing.each_regexp_chars do |rx|%><%=rx%>" \
- "<% end%>][\u11A8-\u11C2]" \
- "|#{'' # decomposed Hangul syllables
- }" \
- "[\u1100-\u1112][\u1161-\u1175][\u11A8-\u11C2]?"
- REGEXP_K_STRING = "" \
- "[<% kompatible_table.keys.each_regexp_chars do |rx|%><%=rx%>" \
- "<%end%>]"
-
- class_table = {
-% combining_class.each_slice(8) do |slice|
- <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=><%=value%><%=%>,<% end%>
-% end
- }
- class_table.default = 0
- CLASS_TABLE = class_table.freeze
-
- DECOMPOSITION_TABLE = {
-% decomposition_table.each_slice(8) do |slice|
- <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>"<%=%>,<% end%>
-% end
- }.freeze
-
- KOMPATIBLE_TABLE = {
-% kompatible_table.each_slice(8) do |slice|
- <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>"<%=%>,<% end%>
-% end
- }.freeze
-
- COMPOSITION_TABLE = {
-% composition_table.each_slice(8) do |slice|
- <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>"<%=%>,<% end%>
-% end
- }.freeze
-end
diff --git a/template/verconf.h.tmpl b/template/verconf.h.in
index 9325aee0ff..79c003e09f 100644
--- a/template/verconf.h.tmpl
+++ b/template/verconf.h.in
@@ -1,7 +1,5 @@
-% config = File.read(conffile = 'rbconfig.rb')
-% config.sub!(/^(\s*)RUBY_VERSION\b.*(\sor\s*)$/, '\1true\2')
-% rbconfig = Module.new {module_eval(config, conffile)}::RbConfig
-% C = rbconfig::MAKEFILE_CONFIG.dup
+% require './rbconfig'
+% C = RbConfig::MAKEFILE_CONFIG.dup
% def C.[](name) str = super and (str unless str.empty?); end
#define RUBY_BASE_NAME "${RUBY_BASE_NAME}"
#define RUBY_VERSION_NAME RUBY_BASE_NAME"-"RUBY_LIB_VERSION
@@ -10,7 +8,7 @@
% elsif !C["RUBY_LIB_VERSION"]
#define RUBY_LIB_VERSION_STYLE 3 /* full */
% else
-#define RUBY_LIB_VERSION "${RUBY_LIB_VERSION}"
+#define RUBY_LIB_VERSION ${RUBY_LIB_VERSION}
% end
#define RUBY_EXEC_PREFIX "<%='${RUBY_EXEC_PREFIX}' if C['RUBY_EXEC_PREFIX']%>"
#define RUBY_LIB_PREFIX "${rubylibprefix}"
@@ -51,12 +49,12 @@
% R["rubysitearchprefix"] = '"RUBY_SITEARCH_PREFIX_FOR(arch)"'
% R["exec_prefix"] = '"RUBY_EXEC_PREFIX"'
% R["prefix"] = '"RUBY_EXEC_PREFIX"'
-% exec_prefix_pat = /\A"#{Regexp.quote(rbconfig::CONFIG['exec_prefix'])}(?=\/|\z)/
+% exec_prefix_pat = /\A"#{Regexp.quote(RbConfig::CONFIG['exec_prefix'])}(?=\/|\z)/
% _erbout.gsub!(/^(#define\s+(\S+)\s+)(.*)/) {
% pre, name, repl = $1, $2, $3
% pat = %["#{name}"]
% c = C.merge(R.reject {|key, value| key == name or value.include?(pat)})
-% rbconfig.expand(repl, c)
+% RbConfig.expand(repl, c)
% repl.gsub!(/^""(?!$)|(.)""$/, '\1')
% repl.sub!(exec_prefix_pat, 'RUBY_EXEC_PREFIX"')
% pre + repl
diff --git a/template/vm.inc.tmpl b/template/vm.inc.tmpl
index 11c6d1bcf5..c21b3a83eb 100644
--- a/template/vm.inc.tmpl
+++ b/template/vm.inc.tmpl
@@ -8,7 +8,7 @@
This file is auto generated by insns2vm.rb
DO NOT TOUCH!
- If you want to fix something, you must edit 'insns.def'
+ If you want to fix something, you must edit 'insns.c'
*/
<%=
diff --git a/template/yarvarch.ja b/template/yarvarch.ja
index 2739ec6b14..bb90f0c0d2 100644
--- a/template/yarvarch.ja
+++ b/template/yarvarch.ja
@@ -34,7 +34,7 @@ YARV は、Ruby プログラムのための次の機能を提供します。
* Compiler (compile.h, compile.c)
-コンパイラは、Ruby インタプリタのパーサによって生成された構文木(RNode
+コンパイラは、Ruby インタプリタのパーサによって生成された構文木(RNode
データによる木)を YARV 命令列に変換します。YARV 命令については後述しま
す。
@@ -43,7 +43,7 @@ YARV は、Ruby プログラムのための次の機能を提供します。
変換中は Ruby の Array オブジェクトに YARV 命令オブジェクト、およびオペ
ランドを格納していき、最後に実行できる形に変換します。コンパイラでは、コ
-ンパイル中に生成するメモリ領域の管理が問題になることがありますが、YARV
+ンパイル中に生成するメモリ領域の管理が問題になることがありますが、YARV
の場合、Ruby インタプリタがすべて面倒をみてくれるのでこの部分は非常に楽
に作ることができました(ガーベージコレクタによって自動的にメモリ管理をし
てくれるため)。
@@ -153,7 +153,7 @@ Lisp の処理系などをかんがえると、わざわざブロックローカ
側に辿れば必ずたどり着くことができるからです(つまり、lfp は必要ない)。
しかし、Ruby ではいくつか状況が違います。まず、メソッドローカルな情報が
-あること、具体的にはブロックとself(callee からみると receiver)です。こ
+あること、具体的にはブロックとself(callee からみると reciever)です。こ
の情報をそれぞれのフレームにもたせるのは無駄です。
また、Ruby2.0 からはブロックローカル変数はなくなります(ブロックローカル
@@ -235,7 +235,7 @@ end
正常系(例外が発生しなかった場合)と異常系(例外が発生したときなど)の2
種類の命令列が生成されます。正常系では、ただの連続したコード領域としてコ
-ンパイルされます。また、異常系ではブロックとして実装します。最後は必ず
+ンパイルされます。また、異常系ではブロックとして実装します。最後は必ず
throw 命令で締めることになります。
@@ -301,7 +301,7 @@ YARV では高速化を目的としているので、さまざまな最適化手
*** threaded code
-GCC の C 言語拡張である値としてのラベルを利用して direct threaded code
+GCC の C 言語拡張である値としてのラベルを利用して direct threaded code
を実現しています。
@@ -322,7 +322,7 @@ GCC の C 言語拡張である値としてのラベルを利用して direct th
*** ブロックと Proc オブジェクトの分離
-ブロック付きメソッド呼び出しが行なわれたときにはすぐにはブロックを Proc
+ブロック付きメソッド呼び出しが行なわれたときにはすぐにはブロックを Proc
オブジェクトとして生成しません。これにより、必要ない Proc オブジェクトの
生成を抑えています。
@@ -377,7 +377,7 @@ YARV 命令列のアセンブラを用意しました。使い方は rb/yasm.rb
* Dis-Assembler (disasm.c)
-YARV 命令列を示すオブジェクト YARVCore::InstructionSequence には disasm
+YARV 命令列を示すオブジェクト YARVCore::InstructionSequence には disasm
メソッドがあります。これは、命令列を逆アセンブルした文字列を返します。
diff --git a/test/-ext-/array/test_resize.rb b/test/-ext-/array/test_resize.rb
index f6a368cb75..8e526b5a0c 100644
--- a/test/-ext-/array/test_resize.rb
+++ b/test/-ext-/array/test_resize.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require '-test-/array/resize'
diff --git a/test/-ext-/bignum/test_big2str.rb b/test/-ext-/bignum/test_big2str.rb
index 4fae24eb34..f03d2328a1 100644
--- a/test/-ext-/bignum/test_big2str.rb
+++ b/test/-ext-/bignum/test_big2str.rb
@@ -1,11 +1,10 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/bignum"
class TestBignum < Test::Unit::TestCase
class TestBig2str < Test::Unit::TestCase
- SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS
BITSPERDIG = Bignum::BITSPERDIG
BDIGMAX = (1 << BITSPERDIG) - 1
diff --git a/test/-ext-/bignum/test_bigzero.rb b/test/-ext-/bignum/test_bigzero.rb
index 8529e54456..f75c4590b8 100644
--- a/test/-ext-/bignum/test_bigzero.rb
+++ b/test/-ext-/bignum/test_bigzero.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/bignum"
diff --git a/test/-ext-/bignum/test_div.rb b/test/-ext-/bignum/test_div.rb
index 9a8e93b081..882d2d164f 100644
--- a/test/-ext-/bignum/test_div.rb
+++ b/test/-ext-/bignum/test_div.rb
@@ -1,11 +1,10 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/bignum"
class TestBignum < Test::Unit::TestCase
class TestDiv < Test::Unit::TestCase
- SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS
BITSPERDIG = Bignum::BITSPERDIG
BDIGMAX = (1 << BITSPERDIG) - 1
diff --git a/test/-ext-/bignum/test_mul.rb b/test/-ext-/bignum/test_mul.rb
index 103a00fbad..7841dfffb2 100644
--- a/test/-ext-/bignum/test_mul.rb
+++ b/test/-ext-/bignum/test_mul.rb
@@ -1,11 +1,10 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/bignum"
class TestBignum < Test::Unit::TestCase
class TestMul < Test::Unit::TestCase
- SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS
BITSPERDIG = Bignum::BITSPERDIG
BDIGMAX = (1 << BITSPERDIG) - 1
diff --git a/test/-ext-/bignum/test_pack.rb b/test/-ext-/bignum/test_pack.rb
index 04bf3e02de..0614e1046c 100644
--- a/test/-ext-/bignum/test_pack.rb
+++ b/test/-ext-/bignum/test_pack.rb
@@ -1,5 +1,4 @@
# coding: ASCII-8BIT
-# frozen_string_literal: false
require 'test/unit'
require "-test-/bignum"
@@ -213,30 +212,6 @@ class TestBignum < Test::Unit::TestCase
}
}
- 2.upto(16) {|wordsize|
- w = wordsize
- b = 8*wordsize-1
- n = 2**b
- assert_equal([-2, "\x7F"+"\xFF"*(w-2)+"\xFF"], (-n-1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST))
- assert_equal([-1, "\x00"+"\x00"*(w-2)+"\x00"], (-n ).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST))
- assert_equal([-1, "\x00"+"\x00"*(w-2)+"\x01"], (-n+1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST))
- assert_equal([+1, "\x7F"+"\xFF"*(w-2)+"\xFF"], (+n-1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST))
- assert_equal([+2, "\x00"+"\x00"*(w-2)+"\x00"], (+n ).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST))
- assert_equal([+2, "\x00"+"\x00"*(w-2)+"\x01"], (+n+1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST))
- }
-
- 2.upto(16) {|wordsize|
- w = wordsize
- b = 8*wordsize-1
- n = 2**b
- assert_equal([-2, "\xFF"+"\xFF"*(w-2)+"\x7F"], (-n-1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST))
- assert_equal([-1, "\x00"+"\x00"*(w-2)+"\x00"], (-n ).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST))
- assert_equal([-1, "\x01"+"\x00"*(w-2)+"\x00"], (-n+1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST))
- assert_equal([+1, "\xFF"+"\xFF"*(w-2)+"\x7F"], (+n-1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST))
- assert_equal([+2, "\x00"+"\x00"*(w-2)+"\x00"], (+n ).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST))
- assert_equal([+2, "\x01"+"\x00"*(w-2)+"\x00"], (+n+1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST))
- }
-
end
def test_unpack_zero
diff --git a/test/-ext-/bignum/test_str2big.rb b/test/-ext-/bignum/test_str2big.rb
index 3b5750154e..f77641b350 100644
--- a/test/-ext-/bignum/test_str2big.rb
+++ b/test/-ext-/bignum/test_str2big.rb
@@ -1,11 +1,10 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/bignum"
class TestBignum < Test::Unit::TestCase
class TestStr2big < Test::Unit::TestCase
- SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS
BITSPERDIG = Bignum::BITSPERDIG
BDIGMAX = (1 << BITSPERDIG) - 1
diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb
index fb37658c92..01f8fdc933 100644
--- a/test/-ext-/bug_reporter/test_bug_reporter.rb
+++ b/test/-ext-/bug_reporter/test_bug_reporter.rb
@@ -1,24 +1,9 @@
-# frozen_string_literal: false
require 'test/unit'
-require 'tmpdir'
+require_relative "../../ruby/envutil"
class TestBugReporter < Test::Unit::TestCase
def test_bug_reporter_add
- expected_stderr = [
- :*,
- /\[BUG\]\sSegmentation\sfault.*\n/,
- /#{ Regexp.quote(RUBY_DESCRIPTION) }\n\n/,
- :*,
- /Sample bug reporter: 12345/,
- :*
- ]
- tmpdir = Dir.mktmpdir
-
- args = ["--disable-gems", "-r-test-/bug_reporter/bug_reporter",
- "-C", tmpdir]
- stdin = "register_sample_bug_reporter(12345); Process.kill :SEGV, $$"
- assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT")
- ensure
- FileUtils.rm_rf(tmpdir) if tmpdir
+ expected_stderr = /Sample bug reporter: 12345/
+ assert_in_out_err(["--disable-gems", "-r-test-/bug_reporter/bug_reporter", "-e", "register_sample_bug_reporter(12345); Process.kill :SEGV, $$"], "", [], expected_stderr, nil)
end
end
diff --git a/test/-ext-/class/test_class2name.rb b/test/-ext-/class/test_class2name.rb
index e61964d9eb..070be5a130 100644
--- a/test/-ext-/class/test_class2name.rb
+++ b/test/-ext-/class/test_class2name.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/class"
diff --git a/test/-ext-/debug/test_debug.rb b/test/-ext-/debug/test_debug.rb
index 3804714d0d..ec506e0ca5 100644
--- a/test/-ext-/debug/test_debug.rb
+++ b/test/-ext-/debug/test_debug.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require '-test-/debug'
diff --git a/test/-ext-/debug/test_profile_frames.rb b/test/-ext-/debug/test_profile_frames.rb
index 5ea506046e..1879c222c2 100644
--- a/test/-ext-/debug/test_profile_frames.rb
+++ b/test/-ext-/debug/test_profile_frames.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require '-test-/debug'
@@ -26,12 +25,12 @@ class TestProfileFrames < Test::Unit::TestCase
}.resume
labels = [
- "test_profile_frames",
+ "block (2 levels) in test_profile_frames",
"zab",
"baz",
"bar",
"foo",
- "test_profile_frames",
+ "block in test_profile_frames",
]
base_labels = [
"test_profile_frames",
@@ -42,12 +41,12 @@ class TestProfileFrames < Test::Unit::TestCase
"test_profile_frames",
]
full_labels = [
- "TestProfileFrames#test_profile_frames",
+ "block (2 levels) in TestProfileFrames#test_profile_frames",
"#{obj.inspect}.zab",
"SampleClassForTestProfileFrames::Sample2#baz",
"SampleClassForTestProfileFrames.bar",
"SampleClassForTestProfileFrames#foo",
- "TestProfileFrames#test_profile_frames",
+ "block in TestProfileFrames#test_profile_frames",
]
classes = [
TestProfileFrames,
@@ -102,21 +101,4 @@ class TestProfileFrames < Test::Unit::TestCase
end
}
end
-
- def test_ifunc_frame
- bug11851 = '[ruby-core:72409] [Bug #11851]'
- assert_ruby_status([], <<~'end;', bug11851) # do
- require '-test-/debug'
- class A
- include Bug::Debug
- def x
- profile_frames(0, 10)
- end
- end
- def a
- [A.new].each(&:x)
- end
- a
- end;
- end
end
diff --git a/test/-ext-/exception/test_data_error.rb b/test/-ext-/exception/test_data_error.rb
deleted file mode 100644
index d33d8ca43f..0000000000
--- a/test/-ext-/exception/test_data_error.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-
-module Bug
- class TestException < Test::Unit::TestCase
- def test_cleanup_data_error
- bug9167 = '[ruby-core:58643] [Bug #9167]'
- assert_normal_exit(<<-'end;', bug9167) # do
- require '-test-/exception'
- raise Bug::Exception::DataError, "Error"
- end;
- end
- end
-end
diff --git a/test/-ext-/exception/test_enc_raise.rb b/test/-ext-/exception/test_enc_raise.rb
index 2bc7f02413..a578b167ea 100644
--- a/test/-ext-/exception/test_enc_raise.rb
+++ b/test/-ext-/exception/test_enc_raise.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require '-test-/exception'
diff --git a/test/-ext-/exception/test_ensured.rb b/test/-ext-/exception/test_ensured.rb
index 858245868b..103250c678 100644
--- a/test/-ext-/exception/test_ensured.rb
+++ b/test/-ext-/exception/test_ensured.rb
@@ -1,5 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
+require_relative '../../ruby/envutil'
module Bug
class Bug7802 < RuntimeError
diff --git a/test/-ext-/file/test_stat.rb b/test/-ext-/file/test_stat.rb
index 9eebcd97b9..b9aa132932 100644
--- a/test/-ext-/file/test_stat.rb
+++ b/test/-ext-/file/test_stat.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/file"
diff --git a/test/-ext-/float/test_nextafter.rb b/test/-ext-/float/test_nextafter.rb
deleted file mode 100644
index 636f803fac..0000000000
--- a/test/-ext-/float/test_nextafter.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require "-test-/float"
-
-class TestFloatExt < Test::Unit::TestCase
- NEXTAFTER_VALUES = [
- -Float::INFINITY,
- -Float::MAX,
- -100.0,
- -1.0-Float::EPSILON,
- -1.0,
- -Float::EPSILON,
- -Float::MIN/2,
- -Math.ldexp(0.5, Float::MIN_EXP - Float::MANT_DIG + 1),
- -0.0,
- 0.0,
- Math.ldexp(0.5, Float::MIN_EXP - Float::MANT_DIG + 1),
- Float::MIN/2,
- Float::MIN,
- Float::EPSILON,
- 1.0,
- 1.0+Float::EPSILON,
- 100.0,
- Float::MAX,
- Float::INFINITY,
- Float::NAN
- ]
-
- test_number = 0
- NEXTAFTER_VALUES.each {|n1|
- NEXTAFTER_VALUES.each {|n2|
- tag = n2.infinite? ? "ruby" : "other"
- test_name = "test_nextafter_#{test_number}_#{tag}_#{n1}_#{n2}"
- test_number += 1
- define_method(test_name) {
- v1 = Bug::Float.missing_nextafter(n1, n2)
- v2 = Bug::Float.system_nextafter(n1, n2)
- assert_kind_of(Float, v1)
- assert_kind_of(Float, v2)
- if v1.nan?
- assert(v2.nan?, "Bug::Float.system_nextafter(#{n1}, #{n2}).nan?")
- else
- assert_equal(v1, v2,
- "Bug::Float.missing_nextafter(#{'%a' % n1}, #{'%a' % n2}) = #{'%a' % v1} != " +
- "#{'%a' % v2} = Bug::Float.system_nextafter(#{'%a' % n1}, #{'%a' % n2})")
- if v1 == 0
- s1 = 1.0/v1 < 0 ? "negative-zero" : "positive-zero"
- s2 = 1.0/v2 < 0 ? "negative-zero" : "positive-zero"
- begin
- assert_equal(s1, s2,
- "Bug::Float.missing_nextafter(#{'%a' % n1}, #{'%a' % n2}) = #{'%a' % v1} != " +
- "#{'%a' % v2} = Bug::Float.system_nextafter(#{'%a' % n1}, #{'%a' % n2})")
- rescue Minitest::Assertion
- if /aix/ =~ RUBY_PLATFORM
- skip "Known bug in nextafter(3) on AIX"
- end
- raise $!
- end
- end
- end
- }
- }
- }
-
-end
diff --git a/test/-ext-/funcall/test_passing_block.rb b/test/-ext-/funcall/test_passing_block.rb
index fac7eaf953..87aed2212c 100644
--- a/test/-ext-/funcall/test_passing_block.rb
+++ b/test/-ext-/funcall/test_passing_block.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
class TestFuncall < Test::Unit::TestCase
diff --git a/test/-ext-/gvl/test_last_thread.rb b/test/-ext-/gvl/test_last_thread.rb
deleted file mode 100644
index 3b297a5b31..0000000000
--- a/test/-ext-/gvl/test_last_thread.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: false
-class TestLastThread < Test::Unit::TestCase
-
- # [Bug #11237]
- def test_last_thread
-
- assert_separately([], <<-"end;") #do
- require '-test-/gvl/call_without_gvl'
-
- Thread.new {
- sleep 0.2
- }
-
- t0 = Time.now
- Thread.current.__runnable_sleep__ 1
- t1 = Time.now
- t = t1 - t0
-
- assert_in_delta(1.0, t, 0.16)
- end;
- end
-end
-
diff --git a/test/-ext-/hash/test_delete.rb b/test/-ext-/hash/test_delete.rb
deleted file mode 100644
index e2ad3cbdbc..0000000000
--- a/test/-ext-/hash/test_delete.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require '-test-/hash'
-
-class TestHash < Test::Unit::TestCase
- class TestDelete < Test::Unit::TestCase
- def test_delete
- hash = Bug::Hash.new
- hash[1] = 2
- called = false
- assert_equal 1, hash.size
- assert_equal [2], hash.delete!(1) {called = true}
- assert_equal false, called, "block called"
- assert_equal 0, hash.size
- assert_equal nil, hash.delete!(1) {called = true}
- assert_equal false, called, "block called"
- assert_equal 0, hash.size
- end
- end
-end
diff --git a/test/-ext-/iseq_load/test_iseq_load.rb b/test/-ext-/iseq_load/test_iseq_load.rb
deleted file mode 100644
index 7eb8f4bfc8..0000000000
--- a/test/-ext-/iseq_load/test_iseq_load.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-
-class TestIseqLoad < Test::Unit::TestCase
- require '-test-/iseq_load/iseq_load'
- ISeq = RubyVM::InstructionSequence
-
- def test_bug8543
- assert_iseq_roundtrip <<-'end;'
- puts "tralivali"
- def funct(a, b)
- a**b
- end
- 3.times { |i| puts "Hello, world#{funct(2,i)}!" }
- end;
- end
-
- def test_case_when
- assert_iseq_roundtrip <<-'end;'
- def user_mask(target)
- target.each_char.inject(0) do |mask, chr|
- case chr
- when "u"
- mask | 04700
- when "g"
- mask | 02070
- when "o"
- mask | 01007
- when "a"
- mask | 07777
- else
- raise ArgumentError, "invalid `who' symbol in file mode: #{chr}"
- end
- end
- end
- end;
- end
-
- def test_splatsplat
- assert_iseq_roundtrip('def splatsplat(**); end')
- end
-
- def test_hidden
- assert_iseq_roundtrip('def x(a, (b, *c), d: false); end')
- end
-
- def assert_iseq_roundtrip(src)
- a = ISeq.compile(src).to_a
- b = ISeq.iseq_load(a).to_a
- warn diff(a, b) if a != b
- assert_equal a, b
- assert_equal a, ISeq.iseq_load(b).to_a
- end
-
- def test_next_in_block_in_block
- @next_broke = false
- src = <<-'end;'
- 3.times { 3.times { next; @next_broke = true } }
- end;
- a = ISeq.compile(src).to_a
- iseq = ISeq.iseq_load(a)
- iseq.eval
- assert_equal false, @next_broke
- skip "failing due to stack_max mismatch"
- assert_iseq_roundtrip(src)
- end
-
- def test_break_ensure
- src = <<-'end;'
- def test_break_ensure_def_method
- bad = true
- while true
- begin
- break
- ensure
- bad = false
- end
- end
- bad
- end
- end;
- a = ISeq.compile(src).to_a
- iseq = ISeq.iseq_load(a)
- iseq.eval
- assert_equal false, test_break_ensure_def_method
- skip "failing due to exception entry sp mismatch"
- assert_iseq_roundtrip(src)
- end
-
- def test_kwarg
- assert_iseq_roundtrip <<-'end;'
- def foo(kwarg: :foo)
- kwarg
- end
- foo(kwarg: :bar)
- end;
- end
-
- # FIXME: still failing
- def test_require_integration
- skip "iseq loader require integration tests still failing"
- f = File.expand_path(__FILE__)
- # $(top_srcdir)/test/ruby/test_....rb
- 3.times { f = File.dirname(f) }
- Dir[File.join(f, 'ruby', '*.rb')].each do |f|
- iseq = ISeq.compile_file(f)
- orig = iseq.to_a.freeze
-
- loaded = ISeq.iseq_load(orig).to_a
- if loaded != orig
- warn f
- warn diff(orig, loaded)
- end
- #assert_equal orig, loaded
- end
- end
-end
diff --git a/test/-ext-/iter/test_iter_break.rb b/test/-ext-/iter/test_iter_break.rb
index 8c2379960a..1ef2aad3c2 100644
--- a/test/-ext-/iter/test_iter_break.rb
+++ b/test/-ext-/iter/test_iter_break.rb
@@ -1,16 +1,12 @@
-# frozen_string_literal: false
require 'test/unit'
-require '-test-/iter'
+require '-test-/iter/break'
-module TestIter
-end
-
-class TestIter::IterBreak < Test::Unit::TestCase
+class TestIterBreak < Test::Unit::TestCase
def test_iter_break
backport7896 = '[ruby-core:52607]'
- assert_equal(nil, 1.times{Bug::Iter::Breakable.iter_break}, backport7896)
+ assert_equal(nil, 1.times{Bug::Breakable.iter_break}, backport7896)
feature5895 = '[ruby-dev:45132]'
- assert_equal(42, 1.times{Bug::Iter::Breakable.iter_break_value(42)}, feature5895)
+ assert_equal(42, 1.times{Bug::Breakable.iter_break_value(42)}, feature5895)
end
end
diff --git a/test/-ext-/iter/test_yield_block.rb b/test/-ext-/iter/test_yield_block.rb
deleted file mode 100644
index d4f1fa3c35..0000000000
--- a/test/-ext-/iter/test_yield_block.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require '-test-/iter'
-
-module TestIter
-end
-
-class TestIter::YieldBlock < Test::Unit::TestCase
- class YieldTest
- include Bug::Iter::Yield
- attr_reader :blockarg
- def test(arg, &block)
- block.call(arg) {|blockarg| @blockarg = blockarg}
- end
- end
-
- def test_yield_block
- a = YieldTest.new
- a.yield_block(:test, "foo") {|x, &b| assert_kind_of(Proc, b); b.call(x)}
- assert_equal("foo", a.blockarg)
- end
-end
diff --git a/test/-ext-/load/test_dot_dot.rb b/test/-ext-/load/test_dot_dot.rb
index 1b2c871608..82aa10a95f 100644
--- a/test/-ext-/load/test_dot_dot.rb
+++ b/test/-ext-/load/test_dot_dot.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
class Test_DotDot < Test::Unit::TestCase
diff --git a/test/-ext-/marshal/test_internal_ivar.rb b/test/-ext-/marshal/test_internal_ivar.rb
deleted file mode 100644
index 51529667b5..0000000000
--- a/test/-ext-/marshal/test_internal_ivar.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require '-test-/marshal/internal_ivar'
-
-module Bug end
-
-module Bug::Marshal
- class TestInternalIVar < Test::Unit::TestCase
- def test_marshal
- v = InternalIVar.new("hello", "world")
- assert_equal("hello", v.normal)
- assert_equal("world", v.internal)
- dump = ::Marshal.dump(v)
- v = assert_nothing_raised {break ::Marshal.load(dump)}
- assert_instance_of(InternalIVar, v)
- assert_equal("hello", v.normal)
- assert_nil(v.internal)
- end
- end
-end
diff --git a/test/-ext-/marshal/test_usrmarshal.rb b/test/-ext-/marshal/test_usrmarshal.rb
index 263dcb8297..ae23223e15 100644
--- a/test/-ext-/marshal/test_usrmarshal.rb
+++ b/test/-ext-/marshal/test_usrmarshal.rb
@@ -1,5 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
+require_relative '../../ruby/envutil'
require '-test-/marshal/usr'
module Bug end
diff --git a/test/-ext-/method/test_arity.rb b/test/-ext-/method/test_arity.rb
index d0032c6a50..79ef23b34f 100644
--- a/test/-ext-/method/test_arity.rb
+++ b/test/-ext-/method/test_arity.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require '-test-/method'
require 'test/unit'
diff --git a/test/-ext-/num2int/test_num2int.rb b/test/-ext-/num2int/test_num2int.rb
index c00bb56833..f579659929 100644
--- a/test/-ext-/num2int/test_num2int.rb
+++ b/test/-ext-/num2int/test_num2int.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require '-test-/num2int/num2int'
diff --git a/test/-ext-/old_thread_select/test_old_thread_select.rb b/test/-ext-/old_thread_select/test_old_thread_select.rb
new file mode 100644
index 0000000000..99a0a506bd
--- /dev/null
+++ b/test/-ext-/old_thread_select/test_old_thread_select.rb
@@ -0,0 +1,103 @@
+require 'test/unit'
+
+class TestOldThreadSelect < Test::Unit::TestCase
+ require '-test-/old_thread_select/old_thread_select'
+
+ ANCIENT_LINUX = RUBY_PLATFORM =~ /linux/ && `uname -r`.chomp < '2.6.32'
+ DARWIN_10 = RUBY_PLATFORM =~ /darwin10/
+ WINDOWS = RUBY_PLATFORM =~ /mswin|mingw/
+
+ def with_pipe
+ r, w = IO.pipe
+ begin
+ yield r, w
+ ensure
+ r.close unless r.closed?
+ w.close unless w.closed?
+ end
+ end
+
+ def test_old_select_read_timeout
+ with_pipe do |r, w|
+ t0 = Time.now
+ rc = IO.old_thread_select([r.fileno], nil, nil, 0.001)
+ diff = Time.now - t0
+ assert_equal 0, rc
+ assert_operator diff, :>=, 0.001, "returned too early: diff=#{diff}"
+ end
+ end unless ANCIENT_LINUX
+
+ def test_old_select_error_timeout
+ bug5299 = '[ruby-core:39380]'
+ with_pipe do |r, w|
+ t0 = Time.now
+ rc = IO.old_thread_select(nil, nil, [r.fileno], 0.001)
+ diff = Time.now - t0
+ assert_equal 0, rc, bug5299
+ assert_operator diff, :>=, 0.001, "returned too early: diff=#{diff}"
+ end
+ end unless ANCIENT_LINUX
+
+ def test_old_select_false_positive
+ bug5306 = '[ruby-core:39435]'
+ with_pipe do |r2, w2|
+ with_pipe do |r, w|
+ t0 = Time.now
+ w.syswrite '.'
+ rfds = [ r.fileno, r2.fileno ]
+ rc = IO.old_thread_select(rfds, nil, nil, nil)
+ diff = Time.now - t0
+ assert_equal [ r.fileno ], rfds, bug5306
+ assert_equal 1, rc, bug5306
+ assert_operator diff, :>=, 0, "returned too early: diff=#{diff}"
+ end
+ end
+ end
+
+ def test_old_select_read_write_check
+ with_pipe do |r, w|
+ w.syswrite('.')
+ rc = IO.old_thread_select([r.fileno], nil, nil, nil)
+ assert_equal 1, rc
+
+ rc = IO.old_thread_select([r.fileno], [w.fileno], nil, nil)
+ assert_equal 2, rc
+
+ assert_equal '.', r.read(1)
+
+ rc = IO.old_thread_select([r.fileno], [w.fileno], nil, nil)
+ assert_equal 1, rc
+ end
+ end
+
+ def test_old_select_signal_safe
+ return unless Process.respond_to?(:kill)
+ received = false
+ trap(:INT) { received = true }
+ main = Thread.current
+ thr = Thread.new do
+ Thread.pass until main.stop?
+ Process.kill(:INT, $$)
+ true
+ end
+
+ rc = nil
+ diff = nil
+ with_pipe do |r,w|
+ assert_nothing_raised do
+ t0 = Time.now
+ rc = IO.old_thread_select([r.fileno], nil, nil, 1)
+ diff = Time.now - t0
+ end
+ end
+
+ unless ANCIENT_LINUX || DARWIN_10 || WINDOWS
+ assert_operator diff, :>=, 1, "interrupted or short wait: diff=#{diff}"
+ end
+ assert_equal 0, rc
+ assert_equal true, thr.value
+ assert_not_equal false, received, "SIGINT not received"
+ ensure
+ trap(:INT, "DEFAULT")
+ end
+end
diff --git a/test/-ext-/path_to_class/test_path_to_class.rb b/test/-ext-/path_to_class/test_path_to_class.rb
index 57e3a9233a..fdf4097fde 100644
--- a/test/-ext-/path_to_class/test_path_to_class.rb
+++ b/test/-ext-/path_to_class/test_path_to_class.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
class Test_PathToClass < Test::Unit::TestCase
diff --git a/test/-ext-/popen_deadlock/test_popen_deadlock.rb b/test/-ext-/popen_deadlock/test_popen_deadlock.rb
deleted file mode 100644
index 97892e5008..0000000000
--- a/test/-ext-/popen_deadlock/test_popen_deadlock.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: false
-begin
- require '-test-/popen_deadlock/infinite_loop_dlsym'
-rescue LoadError
- skip = true
-end
-
-class TestPopenDeadlock < Test::Unit::TestCase
-
- # [Bug #11265]
- def assert_popen_without_deadlock
- assert_separately([], <<-"end;", timeout: 90) #do
- require '-test-/popen_deadlock/infinite_loop_dlsym'
-
- bug = '11265'.freeze
- begin
- t = Thread.new {
- Thread.current.__infinite_loop_dlsym__("_ex_unwind")
- }
- str = IO.popen([ 'echo', bug ], 'r+') { |io| io.read }
- assert_equal(bug, str.chomp)
- ensure
- t.kill if t
- end
- end;
- end
- private :assert_popen_without_deadlock
-
- # 10 test methods are defined for showing progess reports
- 10.times do |i|
- define_method("test_popen_without_deadlock_#{i}") {
- assert_popen_without_deadlock
- }
- end
-
-end unless skip #class TestPopenDeadlock
diff --git a/test/-ext-/postponed_job/test_postponed_job.rb b/test/-ext-/postponed_job/test_postponed_job.rb
index da3b579eba..032e35c055 100644
--- a/test/-ext-/postponed_job/test_postponed_job.rb
+++ b/test/-ext-/postponed_job/test_postponed_job.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require 'thread'
require '-test-/postponed_job'
diff --git a/test/-ext-/proc/test_bmethod.rb b/test/-ext-/proc/test_bmethod.rb
deleted file mode 100644
index 344f975755..0000000000
--- a/test/-ext-/proc/test_bmethod.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require '-test-/proc'
-
-class TestProc < Test::Unit::TestCase
- class TestBMethod < Test::Unit::TestCase
- end
-end
-
-class TestProc::TestBMethod
- class Base
- def foo(*a)
- a
- end
- end
-
- class Bound < Base
- define_method(:foo, Bug::Proc.make_call_super(42))
- define_method(:receiver, Bug::Proc.make_call_receiver(nil))
- end
-
- def test_super_in_bmethod
- obj = Bound.new
- assert_equal([1, 42], obj.foo(1))
- end
-
- def test_block_super
- obj = Bound.new
- result = nil
- obj.foo(2) {|*a| result = a}
- assert_equal([2, 42], result)
- end
-
- def test_receiver_in_bmethod
- obj = Bound.new
- assert_same(obj, obj.receiver)
- end
-end
diff --git a/test/-ext-/rational/test_rat.rb b/test/-ext-/rational/test_rat.rb
index 626ffb9661..ef7e7fe535 100644
--- a/test/-ext-/rational/test_rat.rb
+++ b/test/-ext-/rational/test_rat.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/rational"
diff --git a/test/-ext-/st/test_foreach.rb b/test/-ext-/st/test_foreach.rb
deleted file mode 100644
index 4b3eb870e4..0000000000
--- a/test/-ext-/st/test_foreach.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require '-test-/st/foreach'
-
-class Test_StForeachUnpack < Test::Unit::TestCase
- def test_st_foreach_check_unpack
- assert_nil Bug.unp_st_foreach_check(:check), "goto unpacked_continue"
- assert_nil Bug.unp_st_foreach_check(:delete1), "goto unpacked"
- assert_nil Bug.unp_st_foreach_check(:delete2), "goto deleted"
- end
-
- def test_st_foreach_unpack
- assert_nil Bug.unp_st_foreach(:unpacked), "goto unpacked"
- assert_nil Bug.unp_st_foreach(:unpack_delete), "if (!ptr) return 0"
- end
-end
diff --git a/test/-ext-/st/test_numhash.rb b/test/-ext-/st/test_numhash.rb
index 97c3a755bb..24dc87c1d9 100644
--- a/test/-ext-/st/test_numhash.rb
+++ b/test/-ext-/st/test_numhash.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/st/numhash"
diff --git a/test/-ext-/st/test_update.rb b/test/-ext-/st/test_update.rb
index db86eeb8d7..1b41d2bc03 100644
--- a/test/-ext-/st/test_update.rb
+++ b/test/-ext-/st/test_update.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
require 'test/unit'
require "-test-/st/update"
diff --git a/test/-ext-/string/test_coderange.rb b/test/-ext-/string/test_coderange.rb
deleted file mode 100644
index 18b256fcea..0000000000
--- a/test/-ext-/string/test_coderange.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# coding: ascii-8bit
-# frozen_string_literal: false
-require 'test/unit'
-require "-test-/string"
-require "rbconfig/sizeof"
-
-class Test_StringCoderange < Test::Unit::TestCase
- def setup
- @sizeof_voidp = RbConfig::SIZEOF["void*"]
- @a8 = Encoding::ASCII_8BIT
- @a7 = Encoding::US_ASCII
- @u8 = Encoding::UTF_8
- end
-
- def test_ascii8bit
- enc = @a8
- str = "a"
- str.force_encoding(enc)
- assert_equal :"7bit", Bug::String.new(str).coderange_scan
-
- str = "a\xBE".force_encoding(enc)
- assert_equal :valid, Bug::String.new(str).coderange_scan
- end
-
- def test_usascii
- enc = @a7
- str = "a"
- str.force_encoding(enc)
- assert_equal :"7bit", Bug::String.new(str).coderange_scan
-
- str = "a" * (@sizeof_voidp * 2)
- str << "\xBE"
- str.force_encoding(enc)
- assert_equal :broken, Bug::String.new(str).coderange_scan
- end
-
- def test_utf8
- enc = @u8
- str = "a"
- str.force_encoding(enc)
- assert_equal :"7bit", Bug::String.new(str).coderange_scan
-
- str = "a" * (@sizeof_voidp * 3)
- str << "aa\xC2\x80"
- str.force_encoding(enc)
- assert_equal :valid, Bug::String.new(str).coderange_scan
-
- str = "a" * (@sizeof_voidp * 2)
- str << "\xC2\x80"
- str << "a" * (@sizeof_voidp * 2)
- str.force_encoding(enc)
- assert_equal :valid, Bug::String.new(str).coderange_scan
-
- str = "a" * (@sizeof_voidp * 2)
- str << "\xC1\x80"
- str << "a" * (@sizeof_voidp * 2)
- str.force_encoding(enc)
- assert_equal :broken, Bug::String.new(str).coderange_scan
- end
-end
diff --git a/test/-ext-/string/test_cstr.rb b/test/-ext-/string/test_cstr.rb
index 35b5fe5931..f691da6f79 100644
--- a/test/-ext-/string/test_cstr.rb
+++ b/test/-ext-/string/test_cstr.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
class Test_StringCStr < Test::Unit::TestCase
Bug4319 = '[ruby-dev:43094]'
@@ -8,50 +7,22 @@ class Test_StringCStr < Test::Unit::TestCase
def test_embed
s = Bug::String.new("abcdef")
s.set_len(3)
- s.cstr_unterm('x')
assert_equal(0, s.cstr_term, Bug4319)
end
def test_long
s = Bug::String.new("abcdef")*100000
- s.cstr_unterm('x')
assert_equal(0, s.cstr_term, Bug4319)
end
- def test_frozen
- s0 = Bug::String.new("abcdefgh"*8)
-
- [4, 4*3-1, 8*3-1, 64].each do |n|
- s = s0[0, n]
- s.cstr_unterm('x')
- s.freeze
- assert_equal(0, s.cstr_term)
- WCHARS.each do |enc|
- s = s0.encode(enc)
- s.set_len(n - n % s[0].bytesize)
- s.cstr_unterm('x')
- s.freeze
- assert_equal(0, s.cstr_term)
- end
- end
- end
-
- def test_rb_str_new_frozen_embed
- str = Bug::String.cstr_noembed("rbconfig.rb")
- str = Bug::String.rb_str_new_frozen(str)
- assert_equal true, Bug::String.cstr_embedded?(str)
- end
-
WCHARS = [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE]
def test_wchar_embed
WCHARS.each do |enc|
s = Bug::String.new("\u{4022}a".encode(enc))
- s.cstr_unterm('x')
assert_nothing_raised(ArgumentError) {s.cstr_term}
s.set_len(s.bytesize / 2)
assert_equal(1, s.size)
- s.cstr_unterm('x')
assert_equal(0, s.cstr_term)
end
end
@@ -62,97 +33,10 @@ class Test_StringCStr < Test::Unit::TestCase
len = str.size * n
WCHARS.each do |enc|
s = Bug::String.new(str.encode(enc))*n
- s.cstr_unterm('x')
- assert_nothing_raised(ArgumentError, enc.name) {s.cstr_term}
+ assert_nothing_raised(ArgumentError) {s.cstr_term}
s.set_len(s.bytesize / 2)
- assert_equal(len / 2, s.size, enc.name)
- s.cstr_unterm('x')
- assert_equal(0, s.cstr_term, enc.name)
- end
- end
-
- def test_wchar_lstrip!
- assert_wchars_term_char(" a") {|s| s.lstrip!}
- end
-
- def test_wchar_rstrip!
- assert_wchars_term_char("a ") {|s| s.rstrip!}
- end
-
- def test_wchar_chop!
- assert_wchars_term_char("a\n") {|s| s.chop!}
- end
-
- def test_wchar_chomp!
- assert_wchars_term_char("a\n") {|s| s.chomp!}
- end
-
- def test_wchar_aset
- assert_wchars_term_char("a"*30) {|s| s[29,1] = ""}
- end
-
- def test_wchar_sub!
- assert_wchars_term_char("foobar") {|s| s.sub!(/#{"foo".encode(s.encoding)}/, "")}
- end
-
- def test_wchar_delete!
- assert_wchars_term_char("foobar") {|s| s.delete!("ao".encode(s.encoding))}
- end
-
- def test_wchar_squeeze!
- assert_wchars_term_char("foo!") {|s| s.squeeze!}
- end
-
- def test_wchar_tr!
- assert_wchars_term_char("\u{3042}foobar") {|s|
- enc = s.encoding
- s.tr!("\u{3042}".encode(enc), "c".encode(enc))
- }
- end
-
- def test_wchar_tr_s!
- assert_wchars_term_char("\u{3042}foobar") {|s|
- enc = s.encoding
- s.tr_s!("\u{3042}".encode(enc), "c".encode(enc))
- }
- end
-
- def test_wchar_replace
- assert_wchars_term_char("abc") {|s|
- w = s.dup
- s.replace("abcdefghijklmnop")
- s.replace(w)
- }
- end
-
- def test_embedded_from_heap
- gh821 = "[GH-821]"
- embedded_string = "abcdefghi"
- string = embedded_string.gsub("efg", "123")
- {}[string] = 1
- non_terminated = "#{string}#{nil}"
- assert_nil(Bug::String.cstr_term_char(non_terminated), gh821)
-
- result = {}
- WCHARS.map do |enc|
- embedded_string = "ab".encode(enc)
- string = embedded_string.gsub("b".encode(enc), "1".encode(enc))
- {}[string] = 1
- non_terminated = "#{string}#{nil}"
- c = Bug::String.cstr_term_char(non_terminated)
- result[enc] = c if c
- end
- assert_empty(result, gh821)
- end
-
- def assert_wchars_term_char(str)
- result = {}
- WCHARS.map do |enc|
- s = Bug::String.new(str.encode(enc))
- yield s
- c = s.cstr_term_char
- result[enc] = c if c
+ assert_equal(len / 2, s.size)
+ assert_equal(0, s.cstr_term)
end
- assert_empty(result)
end
end
diff --git a/test/-ext-/string/test_ellipsize.rb b/test/-ext-/string/test_ellipsize.rb
index d7947041d5..2c14c0cf84 100644
--- a/test/-ext-/string/test_ellipsize.rb
+++ b/test/-ext-/string/test_ellipsize.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
class Test_StringEllipsize < Test::Unit::TestCase
def setup
diff --git a/test/-ext-/string/test_enc_associate.rb b/test/-ext-/string/test_enc_associate.rb
index 4fad8e1cc8..edddfb4316 100644
--- a/test/-ext-/string/test_enc_associate.rb
+++ b/test/-ext-/string/test_enc_associate.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
class Test_StrEncAssociate < Test::Unit::TestCase
def test_frozen
@@ -10,15 +9,4 @@ class Test_StrEncAssociate < Test::Unit::TestCase
assert_raise(RuntimeError) {s.associate_encoding!(Encoding::US_ASCII)}
assert_raise(RuntimeError) {s.associate_encoding!(Encoding::UTF_8)}
end
-
- Encoding.list.select(&:dummy?).each do |enc|
- enc = enc.name.tr('-', '_')
- define_method("test_dummy_encoding_index_#{enc}") do
- assert_separately(["-r-test-/string", "-", enc], <<-"end;") #do
- enc = Encoding.const_get(ARGV[0])
- index = Bug::String.encoding_index(enc)
- assert(index < 0xffff, "<%#x> expected but was\n<%#x>" % [index & 0xffff, index])
- end;
- end
- end
end
diff --git a/test/-ext-/string/test_enc_str_buf_cat.rb b/test/-ext-/string/test_enc_str_buf_cat.rb
index 72f903903c..9582fe268c 100644
--- a/test/-ext-/string/test_enc_str_buf_cat.rb
+++ b/test/-ext-/string/test_enc_str_buf_cat.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
class Test_StringEncStrBufCat < Test::Unit::TestCase
Bug6509 = '[ruby-dev:45688]'
diff --git a/test/-ext-/string/test_fstring.rb b/test/-ext-/string/test_fstring.rb
deleted file mode 100644
index 1b3b15c922..0000000000
--- a/test/-ext-/string/test_fstring.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require '-test-/string'
-require_relative '../symbol/noninterned_name'
-
-class Test_String_Fstring < Test::Unit::TestCase
- include Test_Symbol::NonInterned
-
- def assert_fstring(str)
- fstr = Bug::String.fstring(str)
- yield str
- yield fstr
- end
-
- def test_taint_shared_string
- str = __method__.to_s.dup
- str.taint
- assert_fstring(str) {|s| assert_predicate(s, :tainted?)}
- end
-
- def test_taint_normal_string
- str = __method__.to_s * 3
- str.taint
- assert_fstring(str) {|s| assert_predicate(s, :tainted?)}
- end
-
- def test_taint_registered_tainted
- str = __method__.to_s * 3
- str.taint
- assert_fstring(str) {|s| assert_predicate(s, :tainted?)}
-
- str = __method__.to_s * 3
- assert_fstring(str) {|s| assert_not_predicate(s, :tainted?)}
- end
-
- def test_taint_registered_untainted
- str = __method__.to_s * 3
- assert_fstring(str) {|s| assert_not_predicate(s, :tainted?)}
-
- str = __method__.to_s * 3
- str.taint
- assert_fstring(str) {|s| assert_predicate(s, :tainted?)}
- end
-
- def test_instance_variable
- str = __method__.to_s * 3
- str.instance_variable_set(:@test, 42)
- str.freeze
- assert_fstring(str) {|s| assert_send([s, :instance_variable_defined?, :@test])}
- end
-
- def test_singleton_method
- str = __method__.to_s * 3
- def str.foo
- end
- str.freeze
- assert_fstring(str) {|s| assert_send([s, :respond_to?, :foo])}
- end
-
- def test_singleton_class
- str = noninterned_name.force_encoding("us-ascii")
- fstr = Bug::String.fstring(str)
- assert_raise(TypeError) {fstr.singleton_class}
- end
-
- class S < String
- end
-
- def test_subclass
- str = S.new(__method__.to_s * 3)
- str.freeze
- assert_fstring(str) {|s| assert_instance_of(S, s)}
- end
-end
diff --git a/test/-ext-/string/test_modify_expand.rb b/test/-ext-/string/test_modify_expand.rb
index c7093e3892..6a18560bd4 100644
--- a/test/-ext-/string/test_modify_expand.rb
+++ b/test/-ext-/string/test_modify_expand.rb
@@ -1,12 +1,10 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
-require "rbconfig/sizeof"
+require "-test-/string/string"
+require_relative '../../ruby/envutil'
class Test_StringModifyExpand < Test::Unit::TestCase
def test_modify_expand_memory_leak
- assert_no_memory_leak(["-r-test-/string"],
- <<-PRE, <<-CMD, "rb_str_modify_expand()", limit: 2.5)
+ assert_no_memory_leak(["-r-test-/string/string"], <<-PRE, <<-CMD, "rb_str_modify_expand()")
s=Bug::String.new
PRE
size = $initial_size
@@ -14,13 +12,4 @@ class Test_StringModifyExpand < Test::Unit::TestCase
s.replace("")
CMD
end
-
- def test_integer_overflow
- bug12390 = '[ruby-core:75592] [Bug #12390]'
- s = Bug::String.new
- long_max = (1 << (8 * RbConfig::SIZEOF['long'] - 1)) - 1
- assert_raise(ArgumentError, bug12390) {
- s.modify_expand!(long_max)
- }
- end
end
diff --git a/test/-ext-/string/test_nofree.rb b/test/-ext-/string/test_nofree.rb
deleted file mode 100644
index 86681e4652..0000000000
--- a/test/-ext-/string/test_nofree.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-
-class Test_StringNoFree < Test::Unit::TestCase
- def test_no_memory_leak
- bug10942 = '[ruby-core:68436] [Bug #10942] no leak on nofree string'
- code = '.times {Bug::String.nofree << "a" * 100}'
- assert_no_memory_leak(%w(-r-test-/string),
- "100_000#{code}",
- "1_000_000#{code}",
- bug10942, rss: true)
- end
-end
diff --git a/test/-ext-/string/test_normalize.rb b/test/-ext-/string/test_normalize.rb
index 8c11bfe3d4..283ca93db7 100644
--- a/test/-ext-/string/test_normalize.rb
+++ b/test/-ext-/string/test_normalize.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
require "tempfile"
class Test_StringNormalize < Test::Unit::TestCase
@@ -60,6 +59,7 @@ class Test_StringNormalize < Test::Unit::TestCase
assert_equal expected, result,
"#{expected.dump} is expected but #{src.dump}"
end
+ rescue NotImplementedError
end
def test_not_normalize_kc
@@ -79,6 +79,7 @@ class Test_StringNormalize < Test::Unit::TestCase
assert_equal src, result,
"#{src.dump} is expected not to be normalized, but #{result.dump}"
end
+ rescue NotImplementedError
end
def test_dont_normalize_hfsplus
@@ -100,11 +101,6 @@ class Test_StringNormalize < Test::Unit::TestCase
assert_equal src, result,
"#{src.dump} is expected not to be normalized, but #{result.dump}"
end
+ rescue NotImplementedError
end
-
- def test_invalid_sequence
- assert_separately(%w[-r-test-/string], <<-'end;')
- assert_equal("\u{fffd}", Bug::String.new("\xff").normalize_ospath)
- end;
- end
-end if Bug::String.method_defined?(:normalize_ospath)
+end
diff --git a/test/-ext-/string/test_qsort.rb b/test/-ext-/string/test_qsort.rb
index 94aff8c3c4..3a58523200 100644
--- a/test/-ext-/string/test_qsort.rb
+++ b/test/-ext-/string/test_qsort.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
class Test_StringQSort < Test::Unit::TestCase
def test_qsort
diff --git a/test/-ext-/string/test_set_len.rb b/test/-ext-/string/test_set_len.rb
index 1c5252a5f6..e257cacb83 100644
--- a/test/-ext-/string/test_set_len.rb
+++ b/test/-ext-/string/test_set_len.rb
@@ -1,6 +1,5 @@
-# frozen_string_literal: false
require 'test/unit'
-require "-test-/string"
+require "-test-/string/string"
class Test_StrSetLen < Test::Unit::TestCase
def setup
diff --git a/test/-ext-/struct/test_duplicate.rb b/test/-ext-/struct/test_duplicate.rb
deleted file mode 100644
index 77d61988b6..0000000000
--- a/test/-ext-/struct/test_duplicate.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require "-test-/struct"
-
-class Bug::Struct::Test_Duplicate < Test::Unit::TestCase
- def test_new_dupilicate
- bug12291 = '[ruby-core:74971] [Bug #12291]'
- assert_raise_with_message(ArgumentError, /duplicate member/, bug12291) {
- Bug::Struct.new_duplicate(nil, "a")
- }
- assert_raise_with_message(ArgumentError, /duplicate member/, bug12291) {
- Bug::Struct.new_duplicate("X", "a")
- }
- end
-
- def test_new_dupilicate_under
- bug12291 = '[ruby-core:74971] [Bug #12291]'
- assert_raise_with_message(ArgumentError, /duplicate member/, bug12291) {
- Bug::Struct.new_duplicate_under("x", "a")
- }
- end
-end
diff --git a/test/-ext-/struct/test_member.rb b/test/-ext-/struct/test_member.rb
deleted file mode 100644